/*!--------------------------------------------------------
 * 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 YNo=Object.defineProperty;var XNo=Object.getOwnPropertyDescriptor;var g2i=a=>{throw TypeError(a)};var I=(a,i,e,t)=>{for(var o=t>1?void 0:t?XNo(i,e):i,n=a.length-1,r;n>=0;n--)(r=a[n])&&(o=(t?r(i,e,o):r(o))||o);return t&&o&&YNo(i,e,o),o},m=(a,i)=>(e,t)=>i(e,t,a);var bXt=(a,i,e)=>i.has(a)||g2i("Cannot "+e);var Nf=(a,i,e)=>(bXt(a,i,"read from private field"),e?e.call(a):i.get(a)),ASe=(a,i,e)=>i.has(a)?g2i("Cannot add the same private member more than once"):i instanceof WeakSet?i.add(a):i.set(a,e),Zqe=(a,i,e,t)=>(bXt(a,i,"write to private field"),t?t.call(a,e):i.set(a,e),e),e$e=(a,i,e)=>(bXt(a,i,"access private method"),e);function t$e(){return globalThis._VSCODE_NLS_MESSAGES}function Pse(){return globalThis._VSCODE_NLS_LANGUAGE}var JNo=Pse()==="pseudo"||typeof document<"u"&&document.location&&typeof document.location.hash=="string"&&document.location.hash.indexOf("pseudo=true")>=0;function Zmt(a,i){let e;return i.length===0?e=a:e=a.replace(/\{(\d+)\}/g,(t,o)=>{let n=o[0],r=i[n],s=t;return typeof r=="string"?s=r:(typeof r=="number"||typeof r=="boolean"||r===void 0||r===null)&&(s=String(r)),s}),JNo&&(e="\uFF3B"+e.replace(/[aouei]/g,"$&$&")+"\uFF3D"),e}function d(a,i,...e){return Zmt(typeof a=="number"?f2i(a,i):i,e)}function f2i(a,i){let e=t$e()?.[a];if(typeof e!="string"){if(typeof i=="string")return i;throw new Error(`!!! NLS MISSING: ${a} !!!`)}return e}function L(a,i,...e){let t;typeof a=="number"?t=f2i(a,i):t=i;let o=Zmt(t,e);return{value:o,original:i===t?o:Zmt(i,e)}}function eht(a,i){let e=a;typeof e.vscodeWindowId!="number"&&Object.defineProperty(e,"vscodeWindowId",{get:()=>i})}var ut=window;function zy(a){return a===ut?!1:typeof a?.vscodeWindowId=="number"}function MI(a,i){let e=Object.create(null);for(let t of a){let o=i(t),n=e[o];n||(n=e[o]=[]),n.push(t)}return e}function S2i(a,i){let e=new Map;for(let t of a){let o=i(t),n=e.get(o);n||(n=[],e.set(o,n)),n.push(t)}return e}function t1(a,i){let e=[],t=[];for(let o of a)i.has(o)||e.push(o);for(let o of i)a.has(o)||t.push(o);return{removed:e,added:t}}function i$e(a,i){let e=[],t=[];for(let[o,n]of a)i.has(o)||e.push(n);for(let[o,n]of i)a.has(o)||t.push(n);return{removed:e,added:t}}function tht(a,i){let e=new Set;for(let t of i)a.has(t)&&e.add(t);return e}var v2i,b2i,Ase=class{constructor(i,e){this.toKey=e;this._map=new Map;this[v2i]="SetWithKey";for(let t of i)this.add(t)}get size(){return this._map.size}add(i){let e=this.toKey(i);return this._map.set(e,i),this}delete(i){return this._map.delete(this.toKey(i))}has(i){return this._map.has(this.toKey(i))}*entries(){for(let i of this._map.values())yield[i,i]}keys(){return this.values()}*values(){for(let i of this._map.values())yield i}clear(){this._map.clear()}forEach(i,e){this._map.forEach(t=>i.call(e,t,t,this))}[(b2i=Symbol.iterator,v2i=Symbol.toStringTag,b2i)](){return this.values()}};var SXt=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(i){setTimeout(()=>{throw i.stack?pa.isErrorNoTelemetry(i)?new pa(i.message+`

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

`+i.stack):i},0)}}addListener(i){return this.listeners.push(i),()=>{this._removeListener(i)}}emit(i){this.listeners.forEach(e=>{e(i)})}_removeListener(i){this.listeners.splice(this.listeners.indexOf(i),1)}setUnexpectedErrorHandler(i){this.unexpectedErrorHandler=i}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(i){this.unexpectedErrorHandler(i),this.emit(i)}onUnexpectedExternalError(i){this.unexpectedErrorHandler(i)}},k9=new SXt;function I2i(a){k9.setUnexpectedErrorHandler(a)}function E9(a){k9.onUnexpectedError(a)}function mt(a){ao(a)||k9.onUnexpectedError(a)}function ys(a){ao(a)||k9.onUnexpectedExternalError(a)}function S$(a){if(a instanceof Error){let{name:i,message:e,cause:t}=a,o=a.stacktrace||a.stack;return{$isError:!0,name:i,message:e,stack:o,noTelemetry:pa.isErrorNoTelemetry(a),cause:t?S$(t):void 0,code:a.code}}return a}function T9(a){let i;return a.noTelemetry?i=new pa:(i=new Error,i.name=a.name),i.message=a.message,i.stack=a.stack,a.code&&(i.code=a.code),a.cause&&(i.cause=T9(a.cause)),i}var x9="Canceled";function ao(a){return a instanceof go?!0:a instanceof Error&&a.name===x9&&a.message===x9}var go=class extends Error{constructor(){super(x9),this.name=this.message}},iht=class a extends Error{static{this._name="PendingMigrationError"}static is(i){return i instanceof a||i instanceof Error&&i.name===a._name}constructor(i){super(i),this.name=a._name}};function PI(){let a=new Error(x9);return a.name=a.message,a}function Yr(a){return a?new Error(`Illegal argument: ${a}`):new Error("Illegal argument")}function NSe(a){return a?new Error(`Illegal state: ${a}`):new Error("Illegal state")}function Pn(a){return a?a.message?a.message:a.stack?a.stack.split(`
`)[0]:String(a):"Error"}var b$=class extends Error{constructor(i){super("NotSupported"),i&&(this.message=i)}};var pa=class a extends Error{constructor(i){super(i),this.name="CodeExpectedError"}static fromError(i){if(i instanceof a)return i;let e=new a;return e.message=i.message,e.stack=i.stack,e}static isErrorNoTelemetry(i){return i.name==="CodeExpectedError"}},li=class a extends Error{constructor(i){super(i||"An unexpected bug occurred."),Object.setPrototypeOf(this,a.prototype)}};function $c(a,i){let e=this,t=!1,o;return function(){if(t)return o;if(t=!0,i)try{o=a.apply(e,arguments)}finally{i()}else o=a.apply(e,arguments);return o}}function fd(a,i,e=a.length-1){let t=OSe(a,i,e);if(t!==-1)return a[t]}function OSe(a,i,e=a.length-1){for(let t=e;t>=0;t--){let o=a[t];if(i(o,t))return t}return-1}function oht(a,i,e=0){let t=eOo(a,i,e);if(t!==-1)return a[t]}function eOo(a,i,e=0){for(let t=e;t<a.length;t++){let o=a[t];if(i(o,t))return t}return-1}function I$(a,i){let e=y$(a,i);return e===-1?void 0:a[e]}function y$(a,i,e=0,t=a.length){let o=e,n=t;for(;o<n;){let r=Math.floor((o+n)/2);i(a[r])?o=r+1:n=r}return o-1}function y2i(a,i){let e=Ky(a,i);return e===a.length?void 0:a[e]}function Ky(a,i,e=0,t=a.length){let o=e,n=t;for(;o<n;){let r=Math.floor((o+n)/2);i(a[r])?n=r:o=r+1}return o}var o$e=class a{constructor(i){this._array=i;this._findLastMonotonousLastIdx=0}static{this.assertInvariants=!1}findLastMonotonous(i){if(a.assertInvariants){if(this._prevFindLastPredicate){for(let t of this._array)if(this._prevFindLastPredicate(t)&&!i(t))throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=i}let e=y$(this._array,i,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=e+1,e===-1?void 0:this._array[e]}};function n$e(a,i){if(a.length===0)return;let e=a[0];for(let t=1;t<a.length;t++){let o=a[t];i(o,e)>0&&(e=o)}return e}function nht(a,i){if(a.length===0)return;let e=a[0];for(let t=1;t<a.length;t++){let o=a[t];i(o,e)>=0&&(e=o)}return e}function rht(a,i){return n$e(a,(e,t)=>-i(e,t))}function w2i(a,i){if(a.length===0)return-1;let e=0;for(let t=1;t<a.length;t++){let o=a[t];i(o,a[e])>0&&(e=t)}return e}function d_(a,i){for(let e of a){let t=i(e);if(t!==void 0)return t}}function Xg(a){if(a.length===0)throw new Error("Invalid tail call");return[a.slice(0,a.length-1),a[a.length-1]]}function $i(a,i,e=(t,o)=>t===o){if(a===i)return!0;if(!a||!i||a.length!==i.length)return!1;for(let t=0,o=a.length;t<o;t++)if(!e(a[t],i[t]))return!1;return!0}function C2i(a,i){let e=a.length-1;i<e&&(a[i]=a[e]),a.pop()}function Px(a,i,e){return aP(a.length,t=>e(a[t],i))}function aP(a,i){let e=0,t=a-1;for(;e<=t;){let o=(e+t)/2|0,n=i(o);if(n<0)e=o+1;else if(n>0)t=o-1;else return o}return-(e+1)}function _9(a,i,e){if(a=a|0,a>=i.length)throw new TypeError("invalid index");let t=i[Math.floor(i.length*Math.random())],o=[],n=[],r=[];for(let s of i){let l=e(s,t);l<0?o.push(s):l>0?n.push(s):r.push(s)}return a<o.length?_9(a,o,e):a<o.length+r.length?r[0]:_9(a-(o.length+r.length),n,e)}function Jg(a,i){let e=[],t;for(let o of a.slice(0).sort(i))!t||i(t[0],o)!==0?(t=[o],e.push(t)):t.push(o);return e}function*D9(a,i){let e,t;for(let o of a)t!==void 0&&i(t,o)?e.push(o):(e&&(yield e),e=[o]),t=o;e&&(yield e)}function aht(a,i){for(let e=0;e<=a.length;e++)i(e===0?void 0:a[e-1],e===a.length?void 0:a[e])}function x2i(a,i){for(let e=0;e<a.length;e++)i(e===0?void 0:a[e-1],a[e],e+1===a.length?void 0:a[e+1])}function lht(...a){return[].concat(...a)}function r$e(a,i,e){let t=[];function o(s,l,c){if(l===0&&c.length===0)return;let u=t[t.length-1];u&&u.start+u.deleteCount===s?(u.deleteCount+=l,u.toInsert.push(...c)):t.push({start:s,deleteCount:l,toInsert:c})}let n=0,r=0;for(;;){if(n===a.length){o(n,0,i.slice(r));break}if(r===i.length){o(n,a.length-n,[]);break}let s=a[n],l=i[r],c=e(s,l);c===0?(n+=1,r+=1):c<0?(o(n,1,[]),n+=1):c>0&&(o(n,0,[l]),r+=1)}return t}function lP(a,i,e){let t=r$e(a,i,e),o=[],n=[];for(let r of t)o.push(...a.slice(r.start,r.start+r.deleteCount)),n.push(...r.toInsert);return{removed:o,added:n}}function k2i(a,i,e){if(e===0)return[];let t=a.slice(0,e).sort(i);return tOo(a,i,t,e,a.length),t}function tOo(a,i,e,t,o){for(let n=e.length;t<o;t++){let r=a[t];if(i(r,e[n-1])<0){e.pop();let s=Ky(e,l=>i(r,l)<0);e.splice(s,0,r)}}}function di(a){return a.filter(i=>!!i)}function C$(a){let i=0;for(let e=0;e<a.length;e++)a[e]&&(a[i]=a[e],i+=1);a.length=i}function E2i(a,i,e){a.splice(e,0,a.splice(i,1)[0])}function $N(a){return!Array.isArray(a)||a.length===0}function yr(a){return Array.isArray(a)&&a.length>0}function zo(a,i=e=>e){let e=new Set;return a.filter(t=>{let o=i(t);return e.has(o)?!1:(e.add(o),!0)})}function T2i(a){let i=new Set;return e=>{let t=a(e);return i.has(t)?!1:(i.add(t),!0)}}function _2i(a,i,e=(t,o)=>t===o){let t=0;for(let o=0,n=Math.min(a.length,i.length);o<n&&e(a[o],i[o]);o++)t++;return t}function Ig(a,i){let e=typeof i=="number"?a:0;typeof i=="number"?e=a:(e=0,i=a);let t=[];if(e<=i)for(let o=e;o<i;o++)t.push(o);else for(let o=e;o>i;o--)t.push(o);return t}function L9(a,i,e){return a.reduce((t,o)=>(t[i(o)]=e?e(o):o,t),Object.create(null))}function ah(a,i){return a.push(i),()=>s$e(a,i)}function s$e(a,i){let e=a.indexOf(i);if(e>-1)return a.splice(e,1),i}function i1(a,i,e){let t=a.slice(0,i),o=a.slice(i);return t.concat(e,o)}function R9(a,i){let e;if(typeof i=="number"){let t=i;e=()=>{let o=Math.sin(t++)*179426549;return o-Math.floor(o)}}else e=Math.random;for(let t=a.length-1;t>0;t-=1){let o=Math.floor(e()*(t+1)),n=a[t];a[t]=a[o],a[o]=n}}function cht(a,i){let e=a.indexOf(i);e>-1&&(a.splice(e,1),a.unshift(i))}function a$e(a,i){let e=a.indexOf(i);e>-1&&(a.splice(e,1),a.push(i))}function x$(a,i){for(let e of i)a.push(e)}function D2i(a,i){return Array.isArray(a)?a.map(i):i(a)}function L2i(a,i){let e=[];for(let t of a){let o=i(t);o!==void 0&&e.push(o)}return e}function R2i(a){let i=new Set(a);return Array.from(i)}function cc(a){return Array.isArray(a)?a:[a]}function Nse(a,i,e){let t=M2i(a,i),o=a.length,n=e.length;a.length=o+n;for(let r=o-1;r>=t;r--)a[r+n]=a[r];for(let r=0;r<n;r++)a[r+t]=e[r]}function Ose(a,i,e,t){let o=M2i(a,i),n=a.splice(o,e);return n===void 0&&(n=[]),Nse(a,o,t),n}function M2i(a,i){return i<0?Math.max(i+a.length,0):Math.min(i,a.length)}var dC;(s=>{function a(l){return l<0}s.isLessThan=a;function i(l){return l<=0}s.isLessThanOrEqual=i;function e(l){return l>0}s.isGreaterThan=e;function t(l){return l===0}s.isNeitherLessOrGreaterThan=t,s.greaterThan=1,s.lessThan=-1,s.neitherLessOrGreaterThan=0})(dC||={});function cl(a,i){return(e,t)=>i(a(e),a(t))}function dht(...a){return(i,e)=>{for(let t of a){let o=t(i,e);if(!dC.isNeitherLessOrGreaterThan(o))return o}return dC.neitherLessOrGreaterThan}}var hu=(a,i)=>a-i,uht=(a,i)=>hu(a?1:0,i?1:0);function Fse(a){return(i,e)=>-a(i,e)}function P2i(a){return(i,e)=>i===void 0?e===void 0?dC.neitherLessOrGreaterThan:dC.lessThan:e===void 0?dC.greaterThan:a(i,e)}var uE=class{constructor(i){this.firstIdx=0;this.items=i,this.lastIdx=this.items.length-1}get length(){return this.lastIdx-this.firstIdx+1}takeWhile(i){let e=this.firstIdx;for(;e<this.items.length&&i(this.items[e]);)e++;let t=e===this.firstIdx?null:this.items.slice(this.firstIdx,e);return this.firstIdx=e,t}takeFromEndWhile(i){let e=this.lastIdx;for(;e>=0&&i(this.items[e]);)e--;let t=e===this.lastIdx?null:this.items.slice(e+1,this.lastIdx+1);return this.lastIdx=e,t}peek(){if(this.length!==0)return this.items[this.firstIdx]}peekLast(){if(this.length!==0)return this.items[this.lastIdx]}dequeue(){let i=this.items[this.firstIdx];return this.firstIdx++,i}removeLast(){let i=this.items[this.lastIdx];return this.lastIdx--,i}takeCount(i){let e=this.items.slice(this.firstIdx,this.firstIdx+i);return this.firstIdx+=i,e}},w$=class a{constructor(i){this.iterate=i}static{this.empty=new a(i=>{})}forEach(i){this.iterate(e=>(i(e),!0))}toArray(){let i=[];return this.iterate(e=>(i.push(e),!0)),i}filter(i){return new a(e=>this.iterate(t=>i(t)?e(t):!0))}map(i){return new a(e=>this.iterate(t=>e(i(t))))}some(i){let e=!1;return this.iterate(t=>(e=i(t),!e)),e}findFirst(i){let e;return this.iterate(t=>i(t)?(e=t,!1):!0),e}findLast(i){let e;return this.iterate(t=>(i(t)&&(e=t),!0)),e}findLastMaxBy(i){let e,t=!0;return this.iterate(o=>((t||dC.isGreaterThan(i(o,e)))&&(t=!1,e=o),!0)),e}},sht=class a{constructor(i){this._indexMap=i}static createSortPermutation(i,e){let t=Array.from(i.keys()).sort((o,n)=>e(i[o],i[n]));return new a(t)}apply(i){return i.map((e,t)=>i[this._indexMap[t]])}inverse(){let i=this._indexMap.slice();for(let e=0;e<this._indexMap.length;e++)i[this._indexMap[e]]=e;return new a(i)}};async function A2i(a,i){return(await Promise.all(a.map(async(t,o)=>({element:t,ok:await i(t,o)})))).find(t=>t.ok)?.element}function FSe(a){return a.reduce((i,e)=>i+e,0)}function Gy(a,i){return a.reduce((e,t)=>e+i(t),0)}function aV(a,i,e){let t=a.get(i);return t===void 0&&(t=e,a.set(i,t)),t}var IXt=class{constructor(i,e){this.uri=i;this.value=e}};function iOo(a){return Array.isArray(a)}var N2i,gt=class a{constructor(i,e){this[N2i]="ResourceMap";if(i instanceof a)this.map=new Map(i.map),this.toKey=e??a.defaultToKey;else if(iOo(i)){this.map=new Map,this.toKey=e??a.defaultToKey;for(let[t,o]of i)this.set(t,o)}else this.map=new Map,this.toKey=i??a.defaultToKey}static{this.defaultToKey=i=>i.toString()}set(i,e){return this.map.set(this.toKey(i),new IXt(i,e)),this}get(i){return this.map.get(this.toKey(i))?.value}has(i){return this.map.has(this.toKey(i))}get size(){return this.map.size}clear(){this.map.clear()}delete(i){return this.map.delete(this.toKey(i))}forEach(i,e){typeof e<"u"&&(i=i.bind(e));for(let[t,o]of this.map)i(o.value,o.uri,this)}*values(){for(let i of this.map.values())yield i.value}*keys(){for(let i of this.map.values())yield i.uri}*entries(){for(let i of this.map.values())yield[i.uri,i.value]}*[(N2i=Symbol.toStringTag,Symbol.iterator)](){for(let[,i]of this.map)yield[i.uri,i.value]}},O2i,En=class{constructor(i,e){this[O2i]="ResourceSet";!i||typeof i=="function"?this._map=new gt(i):(this._map=new gt(e),i.forEach(this.add,this))}get size(){return this._map.size}add(i){return this._map.set(i,i),this}clear(){this._map.clear()}delete(i){return this._map.delete(i)}forEach(i,e){this._map.forEach((t,o)=>i.call(e,o,o,this))}has(i){return this._map.has(i)}entries(){return this._map.entries()}keys(){return this._map.keys()}values(){return this._map.keys()}[(O2i=Symbol.toStringTag,Symbol.iterator)](){return this.keys()}};var F2i,o1=class{constructor(){this[F2i]="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(i){return this._map.has(i)}get(i,e=0){let t=this._map.get(i);if(t)return e!==0&&this.touch(t,e),t.value}set(i,e,t=0){let o=this._map.get(i);if(o)o.value=e,t!==0&&this.touch(o,t);else{switch(o={key:i,value:e,next:void 0,previous:void 0},t){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(i,o),this._size++}return this}delete(i){return!!this.remove(i)}remove(i){let e=this._map.get(i);if(e)return this._map.delete(i),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 i=this._head;return this._map.delete(i.key),this.removeItem(i),this._size--,i.value}forEach(i,e){let t=this._state,o=this._head;for(;o;){if(e?i.bind(e)(o.value,o.key,this):i(o.value,o.key,this),this._state!==t)throw new Error("LinkedMap got modified during iteration.");o=o.next}}keys(){let i=this,e=this._state,t=this._head,o={[Symbol.iterator](){return o},next(){if(i._state!==e)throw new Error("LinkedMap got modified during iteration.");if(t){let n={value:t.key,done:!1};return t=t.next,n}else return{value:void 0,done:!0}}};return o}values(){let i=this,e=this._state,t=this._head,o={[Symbol.iterator](){return o},next(){if(i._state!==e)throw new Error("LinkedMap got modified during iteration.");if(t){let n={value:t.value,done:!1};return t=t.next,n}else return{value:void 0,done:!0}}};return o}entries(){let i=this,e=this._state,t=this._head,o={[Symbol.iterator](){return o},next(){if(i._state!==e)throw new Error("LinkedMap got modified during iteration.");if(t){let n={value:[t.key,t.value],done:!1};return t=t.next,n}else return{value:void 0,done:!0}}};return o}[(F2i=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(i){if(i>=this.size)return;if(i===0){this.clear();return}let e=this._head,t=this.size;for(;e&&t>i;)this._map.delete(e.key),e=e.next,t--;this._head=e,this._size=t,e&&(e.previous=void 0),this._state++}trimNew(i){if(i>=this.size)return;if(i===0){this.clear();return}let e=this._tail,t=this.size;for(;e&&t>i;)this._map.delete(e.key),e=e.previous,t--;this._tail=e,this._size=t,e&&(e.next=void 0),this._state++}addItemFirst(i){if(!this._head&&!this._tail)this._tail=i;else if(this._head)i.next=this._head,this._head.previous=i;else throw new Error("Invalid list");this._head=i,this._state++}addItemLast(i){if(!this._head&&!this._tail)this._head=i;else if(this._tail)i.previous=this._tail,this._tail.next=i;else throw new Error("Invalid list");this._tail=i,this._state++}removeItem(i){if(i===this._head&&i===this._tail)this._head=void 0,this._tail=void 0;else if(i===this._head){if(!i.next)throw new Error("Invalid list");i.next.previous=void 0,this._head=i.next}else if(i===this._tail){if(!i.previous)throw new Error("Invalid list");i.previous.next=void 0,this._tail=i.previous}else{let e=i.next,t=i.previous;if(!e||!t)throw new Error("Invalid list");e.previous=t,t.next=e}i.next=void 0,i.previous=void 0,this._state++}touch(i,e){if(!this._head||!this._tail)throw new Error("Invalid list");if(!(e!==1&&e!==2)){if(e===1){if(i===this._head)return;let t=i.next,o=i.previous;i===this._tail?(o.next=void 0,this._tail=o):(t.previous=o,o.next=t),i.previous=void 0,i.next=this._head,this._head.previous=i,this._head=i,this._state++}else if(e===2){if(i===this._tail)return;let t=i.next,o=i.previous;i===this._head?(t.previous=void 0,this._head=t):(t.previous=o,o.next=t),i.next=void 0,i.previous=this._tail,this._tail.next=i,this._tail=i,this._state++}}}toJSON(){let i=[];return this.forEach((e,t)=>{i.push([t,e])}),i}fromJSON(i){this.clear();for(let[e,t]of i)this.set(e,t)}},pht=class extends o1{constructor(i,e=1){super(),this._limit=i,this._ratio=Math.min(Math.max(0,e),1)}get limit(){return this._limit}set limit(i){this._limit=i,this.checkTrim()}get ratio(){return this._ratio}set ratio(i){this._ratio=Math.min(Math.max(0,i),1),this.checkTrim()}get(i,e=2){return super.get(i,e)}peek(i){return super.get(i,0)}set(i,e){return super.set(i,e,2),this}checkTrim(){this.size>this._limit&&this.trim(Math.round(this._limit*this._ratio))}},dl=class extends pht{constructor(i,e=1){super(i,e)}trim(i){this.trimOld(i)}set(i,e){return super.set(i,e),this.checkTrim(),this}},mht=class extends pht{constructor(i,e=1){super(i,e)}trim(i){this.trimNew(i)}set(i,e){return this._limit<=this.size&&!this.has(i)&&this.trim(Math.round(this._limit*this._ratio)-1),super.set(i,e),this}},WSe=class{constructor(){this.map=new Map}add(i){return this.map.set(i,(this.map.get(i)||0)+1),this}delete(i){let e=this.map.get(i)||0;return e===0?!1:(e--,e===0?this.map.delete(i):this.map.set(i,e),!0)}has(i){return this.map.has(i)}},hht=class{constructor(i){this._m1=new Map;this._m2=new Map;if(i)for(let[e,t]of i)this.set(e,t)}clear(){this._m1.clear(),this._m2.clear()}set(i,e){this._m1.set(i,e),this._m2.set(e,i)}get(i){return this._m1.get(i)}getKey(i){return this._m2.get(i)}delete(i){let e=this._m1.get(i);return e===void 0?!1:(this._m1.delete(i),this._m2.delete(e),!0)}forEach(i,e){this._m1.forEach((t,o)=>{i.call(e,t,o,this)})}keys(){return this._m1.keys()}values(){return this._m1.values()}},n1=class{constructor(){this.map=new Map}add(i,e){let t=this.map.get(i);t||(t=new Set,this.map.set(i,t)),t.add(e)}delete(i,e){let t=this.map.get(i);t&&(t.delete(e),t.size===0&&this.map.delete(i))}forEach(i,e){let t=this.map.get(i);t&&t.forEach(e)}get(i){let e=this.map.get(i);return e||new Set}};function Wse(a,i){if(a===i)return!0;if(a.size!==i.size)return!1;for(let[e,t]of a)if(!i.has(e)||i.get(e)!==t)return!1;for(let[e]of i)if(!a.has(e))return!1;return!0}var r1=class{constructor(){this._data=new Map}set(i,...e){let t=this._data;for(let o=0;o<e.length-1;o++){let n=t.get(e[o]);n===void 0&&(n=new Map,t.set(e[o],n)),t=n}t.set(e[e.length-1],i)}get(...i){let e=this._data;for(let t=0;t<i.length-1;t++){let o=e.get(i[t]);if(o===void 0)return;e=o}return e.get(i[i.length-1])}clear(){this._data.clear()}*values(){function*i(e){for(let t of e.values())t instanceof Map?yield*i(t):yield t}yield*i(this._data)}toString(){let i=(e,t)=>{let o="";for(let[n,r]of e)o+=`${"  ".repeat(t)}${n}: `,r instanceof Map?o+=`
`+i(r,t+1):o+=`${r}
`;return o};return i(this._data,0)}};function M9(a,i){if(!a)throw new Error(i?`Assertion failed (${i})`:"Assertion Failed")}function os(a,i="Unreachable"){throw new Error(i)}function qy(a,i="unexpected state"){if(!a)throw typeof i=="string"?new li(`Assertion Failed: ${i}`):i}function yXt(a,i="Soft Assertion Failed"){a||mt(new li(i))}function lh(a){if(!a()){debugger;a(),mt(new li("Assertion Failed"))}}function $y(a,i){let e=0;for(;e<a.length-1;){let t=a[e],o=a[e+1];if(!i(t,o))return!1;e++}return!0}function Fe(a){return typeof a=="string"}function HS(a){return wXt(a,Fe)}function wXt(a,i){return Array.isArray(a)&&a.every(i)}function xi(a){return typeof a=="object"&&a!==null&&!Array.isArray(a)&&!(a instanceof RegExp)&&!(a instanceof Date)}function V2i(a){let i=Object.getPrototypeOf(Uint8Array);return typeof a=="object"&&a instanceof i}function Yo(a){return typeof a=="number"&&!isNaN(a)}function l$e(a){return!!a&&typeof a[Symbol.iterator]=="function"}function Wa(a){return a===!0||a===!1}function gn(a){return typeof a>"u"}function lo(a){return!nr(a)}function nr(a){return gn(a)||a===null}function wo(a,i){if(!a)throw new Error(i?`Unexpected type, expected '${i}'`:"Unexpected type")}function Ci(a){return qy(a!=null,"Argument is `undefined` or `null`."),a}function CXt(a,i){if(a==null)throw typeof i=="string"?new Error(i):i}function jy(...a){let i=[];for(let e=0;e<a.length;e++){let t=a[e];if(nr(t))throw new Error(`Assertion Failed: argument at index ${e} is undefined or null`);i.push(t)}return i}var oOo=Object.prototype.hasOwnProperty;function Of(a){if(!xi(a))return!1;for(let i in a)if(oOo.call(a,i))return!1;return!0}function xL(a){return typeof a=="function"}function ght(...a){return a.length>0&&a.every(xL)}function B2i(a,i){let e=Math.min(a.length,i.length);for(let t=0;t<e;t++)nOo(a[t],i[t])}function nOo(a,i){if(Fe(i)){if(typeof a!==i)throw new Error(`argument does not match constraint: typeof ${i}`)}else if(xL(i)){try{if(a instanceof i)return}catch{}if(!nr(a)&&a.constructor===i||i.length===1&&i.call(void 0,a)===!0)return;throw new Error("argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}function No(a,i){for(let e in i)if(!(e in a))return!1;return!0}var vt;(P=>{function a(O){return!!O&&typeof O=="object"&&typeof O[Symbol.iterator]=="function"}P.is=a;let i=Object.freeze([]);function e(){return i}P.empty=e;function*t(O){yield O}P.single=t;function o(O){return a(O)?O:t(O)}P.wrap=o;function n(O){return O??i}P.from=n;function*r(O){for(let V=O.length-1;V>=0;V--)yield O[V]}P.reverse=r;function s(O){return!O||O[Symbol.iterator]().next().done===!0}P.isEmpty=s;function l(O){return O[Symbol.iterator]().next().value}P.first=l;function c(O,V){let H=0;for(let G of O)if(V(G,H++))return!0;return!1}P.some=c;function u(O,V){let H=0;for(let G of O)if(!V(G,H++))return!1;return!0}P.every=u;function p(O,V){for(let H of O)if(V(H))return H}P.find=p;function*h(O,V){for(let H of O)V(H)&&(yield H)}P.filter=h;function*g(O,V){let H=0;for(let G of O)yield V(G,H++)}P.map=g;function*f(O,V){let H=0;for(let G of O)yield*V(G,H++)}P.flatMap=f;function*v(...O){for(let V of O)l$e(V)?yield*V:yield V}P.concat=v;function b(O,V,H){let G=H;for(let $ of O)G=V(G,$);return G}P.reduce=b;function S(O){let V=0;for(let H of O)V++;return V}P.length=S;function*y(O,V,H=O.length){for(V<-O.length&&(V=0),V<0&&(V+=O.length),H<0?H+=O.length:H>O.length&&(H=O.length);V<H;V++)yield O[V]}P.slice=y;function w(O,V=Number.POSITIVE_INFINITY){let H=[];if(V===0)return[H,O];let G=O[Symbol.iterator]();for(let $=0;$<V;$++){let J=G.next();if(J.done)return[H,P.empty()];H.push(J.value)}return[H,{[Symbol.iterator](){return G}}]}P.consume=w;async function k(O){let V=[];for await(let H of O)V.push(H);return V}P.asyncToArray=k;async function T(O){let V=[];for await(let H of O)V=V.concat(H);return V}P.asyncToArrayFlat=T})(vt||={});var rOo=!1,Vse=null,fht=class{constructor(){this._registry=new FinalizationRegistry(i=>{console.warn(`[LEAKED DISPOSABLE] ${i}`)})}trackDisposable(i){let e=new Error("CREATED via:").stack;this._registry.register(i,e,i)}setParent(i,e){e?this._registry.unregister(i):this.trackDisposable(i)}markAsDisposed(i){this._registry.unregister(i)}markAsSingleton(i){this._registry.unregister(i)}},vht=class a{constructor(){this.livingDisposables=new Map}static{this.idx=0}getDisposableData(i){let e=this.livingDisposables.get(i);return e||(e={parent:null,source:null,isSingleton:!1,value:i,idx:a.idx++},this.livingDisposables.set(i,e)),e}trackDisposable(i){let e=this.getDisposableData(i);e.source||(e.source=new Error().stack)}setParent(i,e){let t=this.getDisposableData(i);t.parent=e}markAsDisposed(i){this.livingDisposables.delete(i)}markAsSingleton(i){this.getDisposableData(i).isSingleton=!0}getRootParent(i,e){let t=e.get(i);if(t)return t;let o=i.parent?this.getRootParent(this.getDisposableData(i.parent),e):i;return e.set(i,o),o}getTrackedDisposables(){let i=new Map;return[...this.livingDisposables.entries()].filter(([,t])=>t.source!==null&&!this.getRootParent(t,i).isSingleton).flatMap(([t])=>t)}computeLeakingDisposables(i=10,e){let t;if(e)t=e;else{let l=new Map,c=[...this.livingDisposables.values()].filter(p=>p.source!==null&&!this.getRootParent(p,l).isSingleton);if(c.length===0)return;let u=new Set(c.map(p=>p.value));if(t=c.filter(p=>!(p.parent&&u.has(p.parent))),t.length===0)throw new Error("There are cyclic diposable chains!")}if(!t)return;function o(l){function c(p,h){for(;p.length>0&&h.some(g=>typeof g=="string"?g===p[0]:p[0].match(g));)p.shift()}let u=l.source.split(`
`).map(p=>p.trim().replace("at ","")).filter(p=>p!=="");return c(u,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),u.reverse()}let n=new n1;for(let l of t){let c=o(l);for(let u=0;u<=c.length;u++)n.add(c.slice(0,u).join(`
`),l)}t.sort(cl(l=>l.idx,hu));let r="",s=0;for(let l of t.slice(0,i)){s++;let c=o(l),u=[];for(let p=0;p<c.length;p++){let h=c[p];h=`(shared with ${n.get(c.slice(0,p+1).join(`
`)).size}/${t.length} leaks) at ${h}`;let f=n.get(c.slice(0,p).join(`
`)),v=MI([...f].map(b=>o(b)[p]),b=>b);delete v[c[p]];for(let[b,S]of Object.entries(v))S&&u.unshift(`    - stacktraces of ${S.length} other leaks continue with ${b}`);u.unshift(h)}r+=`


==================== Leaking disposable ${s}/${t.length}: ${l.value.constructor.name} ====================
${u.join(`
`)}
============================================================

`}return t.length>i&&(r+=`


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

`),{leaks:t,details:r}}};function HSe(a){Vse=a}if(rOo){let a="__is_disposable_tracked__";HSe(new class{trackDisposable(i){let e=new Error("Potentially leaked disposable").stack;setTimeout(()=>{i[a]||console.log(e)},3e3)}setParent(i,e){if(i&&i!==x.None)try{i[a]=!0}catch{}}markAsDisposed(i){if(i&&i!==x.None)try{i[a]=!0}catch{}}markAsSingleton(i){}})}function E$(a){return Vse?.trackDisposable(a),a}function T$(a){Vse?.markAsDisposed(a)}function k$(a,i){Vse?.setParent(a,i)}function sOo(a,i){if(Vse)for(let e of a)Vse.setParent(e,i)}function im(a){return Vse?.markAsSingleton(a),a}function jc(a){return typeof a=="object"&&a!==null&&typeof a.dispose=="function"&&a.dispose.length===0}function Be(a){if(vt.is(a)){let i=[];for(let e of a)if(e)try{e.dispose()}catch(t){i.push(t)}if(i.length===1)throw i[0];if(i.length>1)throw new AggregateError(i,"Encountered errors while disposing of store");return Array.isArray(a)?[]:a}else if(a)return a.dispose(),a}function a1(a){for(let i of a)jc(i)&&i.dispose();return[]}function wn(...a){let i=Z(()=>Be(a));return sOo(a,i),i}var xXt=class{constructor(i){this._isDisposed=!1,this._fn=i,E$(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,T$(this),this._fn()}}};function Z(a){return new xXt(a)}var N=class a{constructor(){this._toDispose=new Set;this._isDisposed=!1;E$(this)}static{this.DISABLE_DISPOSED_WARNING=!1}dispose(){this._isDisposed||(T$(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Be(this._toDispose)}finally{this._toDispose.clear()}}add(i){if(!i||i===x.None)return i;if(i===this)throw new Error("Cannot register a disposable on itself!");return k$(i,this),this._isDisposed?a.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(i),i}delete(i){if(i){if(i===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(i),i.dispose()}}deleteAndLeak(i){i&&this._toDispose.delete(i)&&k$(i,null)}assertNotDisposed(){this._isDisposed&&mt(new li("Object disposed"))}},x=class{constructor(){this._store=new N;E$(this),k$(this._store,this)}static{this.None=Object.freeze({dispose(){}})}dispose(){T$(this),this._store.dispose()}_register(i){if(i===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(i)}},me=class{constructor(){this._isDisposed=!1;E$(this)}get value(){return this._isDisposed?void 0:this._value}set value(i){this._isDisposed||i===this._value||(this._value?.dispose(),i&&k$(i,this),this._value=i)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,T$(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let i=this._value;return this._value=void 0,i&&k$(i,null),i}},bht=class{constructor(i){this._disposable=new me;this._isDisposed=!1;this._disposable.value=i}get value(){return this._disposable.value}set value(i){this._isDisposed||i===this._disposable.value||(this._disposable.value=i)}dispose(){this._isDisposed=!0,this._disposable.dispose()}},s1=class{constructor(i){this._disposable=i;this._counter=1}acquire(){return this._counter++,this}release(){return--this._counter===0&&this._disposable.dispose(),this}},uC=class{constructor(){this.references=new Map}acquire(i,...e){let t=this.references.get(i);t||(t={counter:0,object:this.createReferencedObject(i,...e)},this.references.set(i,t));let{object:o}=t,n=$c(()=>{--t.counter===0&&(this.destroyReferencedObject(i,t.object),this.references.delete(i))});return t.counter++,{object:o,dispose:n}}},VSe=class{constructor(i){this.referenceCollection=i}async acquire(i,...e){let t=this.referenceCollection.acquire(i,...e);try{return{object:await t.object,dispose:()=>t.dispose()}}catch(o){throw t.dispose(),o}}},Sht=class{constructor(i){this.object=i}dispose(){}};var Vt=class{constructor(i=new Map){this._isDisposed=!1;this._store=i,E$(this)}dispose(){T$(this),this._isDisposed=!0,this.clearAndDisposeAll()}clearAndDisposeAll(){if(this._store.size)try{Be(this._store.values())}finally{this._store.clear()}}has(i){return this._store.has(i)}get size(){return this._store.size}get(i){return this._store.get(i)}set(i,e,t=!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),t||this._store.get(i)?.dispose(),this._store.set(i,e),k$(e,this)}deleteAndDispose(i){this._store.get(i)?.dispose(),this._store.delete(i)}deleteAndLeak(i){let e=this._store.get(i);return e&&k$(e,null),this._store.delete(i),e}keys(){return this._store.keys()}values(){return this._store.values()}[Symbol.iterator](){return this._store[Symbol.iterator]()}},BSe=class{constructor(i=new Set){this._isDisposed=!1;this._store=i,E$(this)}dispose(){T$(this),this._isDisposed=!0,this.clearAndDisposeAll()}clearAndDisposeAll(){if(this._store.size)try{Be(this._store.values())}finally{this._store.clear()}}has(i){return this._store.has(i)}get size(){return this._store.size}add(i){this._isDisposed&&console.warn(new Error("Trying to add a disposable to a DisposableSet that has already been disposed of. The added object will be leaked!").stack),this._store.add(i),k$(i,this)}deleteAndDispose(i){this._store.delete(i)&&i.dispose()}deleteAndLeak(i){if(this._store.delete(i))return k$(i,null),i}values(){return this._store.values()}[Symbol.iterator](){return this._store[Symbol.iterator]()}};function USe(a,i){let e=!1;return a.then(t=>{e||i(t)}),Z(()=>{e=!0})}function Iht(a,i){return a.then(e=>(i.isDisposed?e.dispose():i.add(e),e))}var Xb=class extends Vt{constructor(){super(new gt)}};var Zg=class a{static{this.Undefined=new a(void 0)}constructor(i){this.element=i,this.next=a.Undefined,this.prev=a.Undefined}},qs=class{constructor(){this._first=Zg.Undefined;this._last=Zg.Undefined;this._size=0}get size(){return this._size}isEmpty(){return this._first===Zg.Undefined}clear(){let i=this._first;for(;i!==Zg.Undefined;){let e=i.next;i.prev=Zg.Undefined,i.next=Zg.Undefined,i=e}this._first=Zg.Undefined,this._last=Zg.Undefined,this._size=0}unshift(i){return this._insert(i,!1)}push(i){return this._insert(i,!0)}_insert(i,e){let t=new Zg(i);if(this._first===Zg.Undefined)this._first=t,this._last=t;else if(e){let n=this._last;this._last=t,t.prev=n,n.next=t}else{let n=this._first;this._first=t,t.next=n,n.prev=t}this._size+=1;let o=!1;return()=>{o||(o=!0,this._remove(t))}}shift(){if(this._first!==Zg.Undefined){let i=this._first.element;return this._remove(this._first),i}}pop(){if(this._last!==Zg.Undefined){let i=this._last.element;return this._remove(this._last),i}}peek(){if(this._last!==Zg.Undefined)return this._last.element}_remove(i){if(i.prev!==Zg.Undefined&&i.next!==Zg.Undefined){let e=i.prev;e.next=i.next,i.next.prev=e}else i.prev===Zg.Undefined&&i.next===Zg.Undefined?(this._first=Zg.Undefined,this._last=Zg.Undefined):i.next===Zg.Undefined?(this._last=this._last.prev,this._last.next=Zg.Undefined):i.prev===Zg.Undefined&&(this._first=this._first.next,this._first.prev=Zg.Undefined);this._size-=1}*[Symbol.iterator](){let i=this._first;for(;i!==Zg.Undefined;)yield i.element,i=i.next}};var l1="en",u$e=!1,p$e=!1,d$e=!1,K2i=!1,G2i=!1,EXt=!1,q2i=!1,TXt=!1,$2i=!1,j2i=!1,c$e,yht=l1,kXt=l1,Q2i,_$,D$=globalThis,kL;typeof D$.vscode<"u"&&typeof D$.vscode.process<"u"?kL=D$.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(kL=process);var Y2i=typeof kL?.versions?.electron=="string",aOo=Y2i&&kL?.type==="renderer";if(typeof kL=="object"){u$e=kL.platform==="win32",p$e=kL.platform==="darwin",d$e=kL.platform==="linux",K2i=d$e&&!!kL.env.SNAP&&!!kL.env.SNAP_REVISION,q2i=Y2i,$2i=!!kL.env.CI||!!kL.env.BUILD_ARTIFACTSTAGINGDIRECTORY||!!kL.env.GITHUB_WORKSPACE,c$e=l1,yht=l1;let a=kL.env.VSCODE_NLS_CONFIG;if(a)try{let i=JSON.parse(a);c$e=i.userLocale,kXt=i.osLocale,yht=i.resolvedLanguage||l1,Q2i=i.languagePack?.translationsConfigFile}catch{}G2i=!0}else typeof navigator=="object"&&!aOo?(_$=navigator.userAgent,u$e=_$.indexOf("Windows")>=0,p$e=_$.indexOf("Macintosh")>=0,TXt=(_$.indexOf("Macintosh")>=0||_$.indexOf("iPad")>=0||_$.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,d$e=_$.indexOf("Linux")>=0,j2i=_$?.indexOf("Mobi")>=0,EXt=!0,yht=Pse()||l1,c$e=navigator.language.toLowerCase(),kXt=c$e):console.error("Unable to resolve platform.");function u_(a){switch(a){case 0:return"Web";case 1:return"Mac";case 2:return"Linux";case 3:return"Windows"}}var wht=0;p$e?wht=1:u$e?wht=3:d$e&&(wht=2);var ei=u$e,Ze=p$e,fn=d$e,zSe=K2i,Vr=G2i,Cht=q2i,Wt=EXt,lOo=EXt&&typeof D$.importScripts=="function",X2i=lOo?D$.origin:void 0,dc=TXt,KSe=j2i,ef=$2i,om=wht,c1=_$,wr=yht,US;(t=>{function a(){return wr}t.value=a;function i(){return wr.length===2?wr==="en":wr.length>=3?wr[0]==="e"&&wr[1]==="n"&&wr[2]==="-":!1}t.isDefaultVariant=i;function e(){return wr==="en"}t.isDefault=e})(US||={});var GSe=c$e,J2i=kXt,_Xt=Q2i,cOo=typeof D$.postMessage=="function"&&!D$.importScripts,pC=(()=>{if(cOo){let a=[];D$.addEventListener("message",e=>{if(e.data&&e.data.vscodeScheduleAsyncWork)for(let t=0,o=a.length;t<o;t++){let n=a[t];if(n.id===e.data.vscodeScheduleAsyncWork){a.splice(t,1),n.callback();return}}});let i=0;return e=>{let t=++i;a.push({id:t,callback:e}),D$.postMessage({vscodeScheduleAsyncWork:t},"*")}}return a=>setTimeout(a)})();var Po=p$e||TXt?2:u$e?1:3,U2i=!0,z2i=!1;function m$e(){if(!z2i){z2i=!0;let a=new Uint8Array(2);a[0]=1,a[1]=2,U2i=new Uint16Array(a.buffer)[0]===513}return U2i}var d1=!!(c1&&c1.indexOf("Chrome")>=0),qSe=!!(c1&&c1.indexOf("Firefox")>=0),$Se=!!(!d1&&c1&&c1.indexOf("Safari")>=0),jSe=!!(c1&&c1.indexOf("Edg/")>=0),xht=!!(c1&&c1.indexOf("Android")>=0);function kht(a){return parseFloat(a)>=25}var Bse,DXt=globalThis.vscode;if(typeof DXt<"u"&&typeof DXt.process<"u"){let a=DXt.process;Bse={get platform(){return a.platform},get arch(){return a.arch},get env(){return a.env},cwd(){return a.cwd()}}}else typeof process<"u"&&typeof process?.versions?.node=="string"?Bse={get platform(){return process.platform},get arch(){return process.arch},get env(){return process.env},cwd(){return process.env.VSCODE_CWD||process.cwd()}}:Bse={get platform(){return ei?"win32":Ze?"darwin":"linux"},get arch(){},get env(){return{}},cwd(){return"/"}};var Hse=Bse.cwd,$u=Bse.env,jN=Bse.platform,QSe=Bse.arch;var dOo=globalThis.performance.now.bind(globalThis.performance),Dn=class a{static create(i){return new a(i)}constructor(i){this._now=i===!1?Date.now:dOo,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 eGi=!1,uOo=!1,pOo=100,tGi=6e4;function iGi(){return!!$u.VSCODE_DEV}var U;(he=>{he.None=()=>x.None;function i(oe){if(uOo){let{onDidAddListener:de}=oe,Ce=JSe.create(),xe=0;oe.onDidAddListener=()=>{++xe===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),Ce.print()),de?.()}}}function e(oe,de,Ce){return g(oe,()=>{},0,void 0,de??!0,void 0,Ce)}he.defer=e;function t(oe){return(de,Ce=null,xe)=>{let ze=!1,De;return De=oe(Oe=>{if(!ze)return De?De.dispose():ze=!0,de.call(Ce,Oe)},null,xe),ze&&De.dispose(),De}}he.once=t;function o(oe,de){return he.once(he.filter(oe,de))}he.onceIf=o;function n(oe,de,Ce){return p((xe,ze=null,De)=>oe(Oe=>xe.call(ze,de(Oe)),null,De),Ce)}he.map=n;function r(oe,de,Ce){return p((xe,ze=null,De)=>oe(Oe=>{de(Oe),xe.call(ze,Oe)},null,De),Ce)}he.forEach=r;function s(oe,de,Ce){return p((xe,ze=null,De)=>oe(Oe=>de(Oe)&&xe.call(ze,Oe),null,De),Ce)}he.filter=s;function l(oe){return oe}he.signal=l;function c(...oe){return(de,Ce=null,xe)=>{let ze=wn(...oe.map(De=>De(Oe=>de.call(Ce,Oe))));return h(ze,xe)}}he.any=c;function u(oe,de,Ce,xe){let ze=Ce;return n(oe,De=>(ze=de(ze,De),ze),xe)}he.reduce=u;function p(oe,de){let Ce,xe={onWillAddFirstListener(){Ce=oe(ze.fire,ze)},onDidRemoveLastListener(){Ce?.dispose()}};de||i(xe);let ze=new E(xe);return de?.add(ze),ze.event}function h(oe,de){return de instanceof Array?de.push(oe):de&&de.add(oe),oe}function g(oe,de,Ce=100,xe=!1,ze=!1,De,Oe){let pt,et,Ti,Ht=0,zi,Vo={leakWarningThreshold:De,onWillAddFirstListener(){pt=oe(_n=>{Ht++,et=de(et,_n),xe&&!Ti&&(sn.fire(et),et=void 0),zi=()=>{let mn=et;et=void 0,Ti=void 0,(!xe||Ht>1)&&sn.fire(mn),Ht=0},typeof Ce=="number"?(Ti&&clearTimeout(Ti),Ti=setTimeout(zi,Ce)):Ti===void 0&&(Ti=null,queueMicrotask(zi))})},onWillRemoveListener(){ze&&Ht>0&&zi?.()},onDidRemoveLastListener(){zi=void 0,pt.dispose()}};Oe||i(Vo);let sn=new E(Vo);return Oe?.add(sn),sn.event}he.debounce=g;function f(oe,de=0,Ce,xe){return he.debounce(oe,(ze,De)=>ze?(ze.push(De),ze):[De],de,void 0,Ce??!0,void 0,xe)}he.accumulate=f;function v(oe,de,Ce=100,xe=!0,ze=!0,De,Oe){let pt,et,Ti,Ht=0,zi={leakWarningThreshold:De,onWillAddFirstListener(){pt=oe(sn=>{Ht++,et=de(et,sn),Ti===void 0&&(xe&&(Vo.fire(et),et=void 0,Ht=0),typeof Ce=="number"?Ti=setTimeout(()=>{ze&&Ht>0&&Vo.fire(et),et=void 0,Ti=void 0,Ht=0},Ce):(Ti=0,queueMicrotask(()=>{ze&&Ht>0&&Vo.fire(et),et=void 0,Ti=void 0,Ht=0})))})},onDidRemoveLastListener(){pt.dispose()}};Oe||i(zi);let Vo=new E(zi);return Oe?.add(Vo),Vo.event}he.throttle=v;function b(oe,de=(xe,ze)=>xe===ze,Ce){let xe=!0,ze;return s(oe,De=>{let Oe=xe||!de(De,ze);return xe=!1,ze=De,Oe},Ce)}he.latch=b;function S(oe,de,Ce){return[he.filter(oe,de,Ce),he.filter(oe,xe=>!de(xe),Ce)]}he.split=S;function y(oe,de,Ce=!1,xe=[],ze){let De=xe.slice(),Oe;iGi()&&(Oe={stack:JSe.create(),timerId:setTimeout(()=>{De&&De.length>0&&Oe&&!Oe.warned&&(Oe.warned=!0,console.warn(`[Event.buffer][${de}] potential LEAK detected: ${De.length} events buffered for ${tGi/1e3}s without being consumed. Buffered here:`),Oe.stack.print())},tGi),warned:!1},ze&&ze.add(Z(()=>clearTimeout(Oe.timerId))));let pt=()=>{Oe&&clearTimeout(Oe.timerId)},et=oe(zi=>{De?(De.push(zi),iGi()&&Oe&&!Oe.warned&&De.length>=pOo&&(Oe.warned=!0,console.warn(`[Event.buffer][${de}] potential LEAK detected: ${De.length} events buffered without being consumed. Buffered here:`),Oe.stack.print())):Ht.fire(zi)});ze&&ze.add(et);let Ti=()=>{De?.forEach(zi=>Ht.fire(zi)),De=null,pt()},Ht=new E({onWillAddFirstListener(){et||(et=oe(zi=>Ht.fire(zi)),ze&&ze.add(et))},onDidAddFirstListener(){De&&(Ce?setTimeout(Ti):Ti())},onDidRemoveLastListener(){et&&et.dispose(),et=null,pt()}});return ze&&ze.add(Ht),Ht.event}he.buffer=y;function w(oe,de){return(xe,ze,De)=>{let Oe=de(new T);return oe(function(pt){let et=Oe.evaluate(pt);et!==k&&xe.call(ze,et)},void 0,De)}}he.chain=w;let k=Symbol("HaltChainable");class T{constructor(){this.steps=[]}map(de){return this.steps.push(de),this}forEach(de){return this.steps.push(Ce=>(de(Ce),Ce)),this}filter(de){return this.steps.push(Ce=>de(Ce)?Ce:k),this}reduce(de,Ce){let xe=Ce;return this.steps.push(ze=>(xe=de(xe,ze),xe)),this}latch(de=(Ce,xe)=>Ce===xe){let Ce=!0,xe;return this.steps.push(ze=>{let De=Ce||!de(ze,xe);return Ce=!1,xe=ze,De?ze:k}),this}evaluate(de){for(let Ce of this.steps)if(de=Ce(de),de===k)break;return de}}function P(oe,de,Ce=xe=>xe){let xe=(...pt)=>Oe.fire(Ce(...pt)),ze=()=>oe.on(de,xe),De=()=>oe.removeListener(de,xe),Oe=new E({onWillAddFirstListener:ze,onDidRemoveLastListener:De});return Oe.event}he.fromNodeEventEmitter=P;function O(oe,de,Ce=xe=>xe){let xe=(...pt)=>Oe.fire(Ce(...pt)),ze=()=>oe.addEventListener(de,xe),De=()=>oe.removeEventListener(de,xe),Oe=new E({onWillAddFirstListener:ze,onDidRemoveLastListener:De});return Oe.event}he.fromDOMEventEmitter=O;function V(oe,de){let Ce,xe,ze=new Promise(De=>{xe=t(oe)(De),AXt(xe,de),Ce=()=>{oGi(xe,de)}});return ze.cancel=Ce,de&&ze.finally(()=>oGi(xe,de)),ze}he.toPromise=V;function H(oe,de){return oe(Ce=>de.fire(Ce))}he.forward=H;function G(oe,de,Ce){return de(Ce),oe(xe=>de(xe))}he.runAndSubscribe=G;class ${constructor(de,Ce){this._observable=de;this._counter=0;this._hasChanged=!1;let xe={onWillAddFirstListener:()=>{de.addObserver(this),this._observable.reportChanges()},onDidRemoveLastListener:()=>{de.removeObserver(this)}};Ce||i(xe),this.emitter=new E(xe),Ce&&Ce.add(this.emitter)}beginUpdate(de){this._counter++}handlePossibleChange(de){}handleChange(de,Ce){this._hasChanged=!0}endUpdate(de){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function J(oe,de){return new $(oe,de).emitter.event}he.fromObservable=J;function ae(oe){return(de,Ce,xe)=>{let ze=0,De=!1,Oe={beginUpdate(){ze++},endUpdate(){ze--,ze===0&&(oe.reportChanges(),De&&(De=!1,de.call(Ce)))},handlePossibleChange(){},handleChange(){De=!0}};oe.addObserver(Oe),oe.reportChanges();let pt={dispose(){oe.removeObserver(Oe)}};return AXt(pt,xe),pt}}he.fromObservableLight=ae})(U||={});var XSe=class a{constructor(i){this.listenerCount=0;this.invocationCount=0;this.elapsedOverall=0;this.durations=[];this.name=`${i}_${a._idPool++}`,a.all.add(this)}static{this.all=new Set}static{this._idPool=0}start(i){this._stopWatch=new Dn,this.listenerCount=i}stop(){if(this._stopWatch){let i=this._stopWatch.elapsed();this.durations.push(i),this.elapsedOverall+=i,this.invocationCount+=1,this._stopWatch=void 0}}},h$e=-1;function nGi(a){let i=h$e;return h$e=a,{dispose(){h$e=i}}}var LXt=class a{constructor(i,e,t=(a._idPool++).toString(16).padStart(3,"0")){this._errorHandler=i;this.threshold=e;this.name=t;this._warnCountdown=0}static{this._idPool=1}dispose(){this._stacks?.clear()}check(i,e){let t=this.threshold;if(t<=0||e<t)return;this._stacks||(this._stacks=new Map);let o=this._stacks.get(i.value)||0;if(this._stacks.set(i.value,o+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=t*.5;let[n,r]=this.getMostFrequentStack(),s=`[${this.name}] potential listener LEAK detected, having ${e} listeners already. MOST frequent listener (${r}):`;console.warn(s),console.warn(n);let l=r/e>.3?"dominated":"popular",c=new RXt(l,s,n);this._errorHandler(c)}return()=>{let n=this._stacks.get(i.value)||0;this._stacks.set(i.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let i,e=0;for(let[t,o]of this._stacks)(!i||e<o)&&(i=[t,o],e=o);return i}},JSe=class a{constructor(i){this.value=i}static create(){let i=new Error;return new a(i.stack??"")}print(){console.warn(this.value.split(`
`).slice(2).join(`
`))}},RXt=class extends Error{constructor(i,e,t){super(`potential listener LEAK detected, ${i}`),this.name="ListenerLeakError",this.details=e,this.stack=t}},MXt=class extends Error{constructor(i,e,t){super(`potential listener LEAK detected, ${i} (REFUSED to add)`),this.name="ListenerRefusalError",this.details=e,this.stack=t}},mOo=0,YSe=class{constructor(i){this.value=i;this.id=mOo++}},hOo=2,rGi=(a,i)=>{if(a instanceof YSe)i(a);else for(let e=0;e<a.length;e++){let t=a[e];t&&i(t)}},E=class{constructor(i){this._size=0;this._options=i,this._leakageMon=h$e>0||this._options?.leakWarningThreshold?new LXt(i?.onListenerError??mt,this._options?.leakWarningThreshold??h$e):void 0,this._perfMon=this._options?._profName?new XSe(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(eGi){let i=this._listeners;queueMicrotask(()=>{rGi(i,e=>e.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??=(i,e,t)=>{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 c=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],u=c[1]/this._size>.3?"dominated":"popular",p=new MXt(u,`${l}. HINT: Stack shows most frequent listener (${c[1]}-times)`,c[0]);return(this._options?.onListenerError||mt)(p),x.None}if(this._disposed)return x.None;e&&(i=i.bind(e));let o=new YSe(i),n,r;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(o.stack=JSe.create(),n=this._leakageMon.check(o.stack,this._size+1)),eGi&&(o.stack=r??JSe.create()),this._listeners?this._listeners instanceof YSe?(this._deliveryQueue??=new Eht,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 s=Z(()=>{n?.(),this._removeListener(o)});return AXt(s,t),s},this._event}_removeListener(i){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,t=e.indexOf(i);if(t===-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[t]=void 0;let o=this._deliveryQueue.current===this;if(this._size*hOo<=e.length){let n=0;for(let r=0;r<e.length;r++)e[r]?e[n++]=e[r]:o&&n<this._deliveryQueue.end&&(this._deliveryQueue.end--,n<this._deliveryQueue.i&&this._deliveryQueue.i--);e.length=n}}_deliver(i,e){if(!i)return;let t=this._options?.onListenerError||mt;if(!t){i.value(e);return}try{i.value(e)}catch(o){t(o)}}_deliverQueue(i){let e=i.current._listeners;for(;i.i<i.end;)this._deliver(e[i.i++],i.value);i.reset()}fire(i){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof YSe)this._deliver(this._listeners,i);else{let e=this._deliveryQueue;e.enqueue(this,i,this._listeners.length),this._deliverQueue(e)}this._perfMon?.stop()}hasListeners(){return this._size>0}},sGi=()=>new Eht,Eht=class{constructor(){this.i=-1;this.end=0}enqueue(i,e,t){this.i=0,this.end=t,this.current=i,this.value=e}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},P9=class extends E{async fireAsync(i,e,t){if(this._listeners)for(this._asyncDeliveryQueue||(this._asyncDeliveryQueue=new qs),rGi(this._listeners,o=>this._asyncDeliveryQueue.push([o.value,i]));this._asyncDeliveryQueue.size>0&&!e.isCancellationRequested;){let[o,n]=this._asyncDeliveryQueue.shift(),r=[],s={...n,token:e,waitUntil:l=>{if(Object.isFrozen(r))throw new Error("waitUntil can NOT be called asynchronous");t&&(l=t(l,o)),r.push(l)}};try{o(s)}catch(l){mt(l);continue}Object.freeze(r),await Promise.allSettled(r).then(l=>{for(let c of l)c.status==="rejected"&&mt(c.reason)})}}},Gm=class extends E{constructor(e){super(e);this._isPaused=0;this._eventQueue=new qs;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))}},ZSe=class extends Gm{constructor(i){super(i),this._delay=i.delay??100}fire(i){this._handle||(this.pause(),this._handle=setTimeout(()=>{this._handle=void 0,this.resume()},this._delay)),super.fire(i)}},A9=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(t=>super.fire(t)),this._queuedEvents=[]}))}},AI=class{constructor(){this.hasListeners=!1;this.events=[];this.emitter=new E({onWillAddFirstListener:()=>this.onFirstListenerAdd(),onDidRemoveLastListener:()=>this.onLastListenerRemove()})}get event(){return this.emitter.event}add(i){let e={event:i,listener:null};return this.events.push(e),this.hasListeners&&this.hook(e),Z($c(()=>{this.hasListeners&&this.unhook(e);let o=this.events.indexOf(e);this.events.splice(o,1)}))}onFirstListenerAdd(){this.hasListeners=!0,this.events.forEach(i=>this.hook(i))}onLastListenerRemove(){this.hasListeners=!1,this.events.forEach(i=>this.unhook(i))}hook(i){i.listener=i.event(e=>this.emitter.fire(e))}unhook(i){i.listener?.dispose(),i.listener=null}dispose(){this.emitter.dispose();for(let i of this.events)i.listener?.dispose();this.events=[]}},Use=class{constructor(i,e,t,o){this._store=new N;let n=this._store.add(new AI),r=this._store.add(new Vt);function s(l){r.set(l,n.add(o(l)))}for(let l of i)s(l);this._store.add(e(l=>{s(l)})),this._store.add(t(l=>{r.deleteAndDispose(l)})),this.event=n.event}dispose(){this._store.dispose()}},QN=class{constructor(){this.data=[]}wrapEvent(i,e,t){return(o,n,r)=>i(s=>{let l=this.data[this.data.length-1];if(!e){l?l.buffers.push(()=>o.call(n,s)):o.call(n,s);return}let c=l;if(!c){o.call(n,e(t,s));return}c.items??=[],c.items.push(s),c.buffers.length===0&&l.buffers.push(()=>{c.reducedResult??=t?c.items.reduce(e,t):c.items.reduce(e),o.call(n,c.reducedResult)})},void 0,r)}bufferEvents(i){let e={buffers:new Array};this.data.push(e);let t=i();return this.data.pop(),e.buffers.forEach(o=>o()),t}},Bh=class{constructor(){this.listening=!1;this.inputEvent=U.None;this.inputEventListener=x.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(i){this.inputEvent=i,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=i(this.emitter.fire,this.emitter))}dispose(){this.inputEventListener.dispose(),this.emitter.dispose()}},eIe=class{constructor(i){this._value=i;this._onDidChange=new E;this.onDidChange=this._onDidChange.event}static const(i){return new PXt(i)}get value(){return this._value}set value(i){i!==this._value&&(this._value=i,this._onDidChange.fire(void 0))}},PXt=class{constructor(i){this.value=i;this.onDidChange=U.None}};function aGi(a,i,e){let t=new Vt,o=new Set(a());for(let r of o)t.set(r,e(r));let n=new N;return n.add(i(()=>{let r=a(),s=t1(o,r);for(let l of s.removed)t.deleteAndDispose(l);for(let l of s.added)t.set(l,e(l));o=new Set(r)})),n.add(t),n}function AXt(a,i){i instanceof N?i.add(a):Array.isArray(i)&&i.push(a)}function oGi(a,i){if(i instanceof N)i.delete(a);else if(Array.isArray(i)){let e=i.indexOf(a);e!==-1&&i.splice(e,1)}a.dispose()}var u1=class a{constructor(){this.mapWindowIdToZoomLevel=new Map;this._onDidChangeZoomLevel=new E;this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event;this.mapWindowIdToZoomFactor=new Map;this._onDidChangeFullscreen=new E;this.onDidChangeFullscreen=this._onDidChangeFullscreen.event;this.mapWindowIdToFullScreen=new Map}static{this.INSTANCE=new a}getZoomLevel(i){return this.mapWindowIdToZoomLevel.get(this.getWindowId(i))??0}setZoomLevel(i,e){if(this.getZoomLevel(e)===i)return;let t=this.getWindowId(e);this.mapWindowIdToZoomLevel.set(t,i),this._onDidChangeZoomLevel.fire(t)}getZoomFactor(i){return this.mapWindowIdToZoomFactor.get(this.getWindowId(i))??1}setZoomFactor(i,e){this.mapWindowIdToZoomFactor.set(this.getWindowId(e),i)}setFullscreen(i,e){if(this.isFullscreen(e)===i)return;let t=this.getWindowId(e);this.mapWindowIdToFullScreen.set(t,i),this._onDidChangeFullscreen.fire(t)}isFullscreen(i){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(i))}getWindowId(i){return i.vscodeWindowId}};function gOo(a,i,e){typeof i=="string"&&(i=a.matchMedia(i)),i.addEventListener("change",e)}function cGi(a,i){u1.INSTANCE.setZoomLevel(a,i)}function mC(a){return u1.INSTANCE.getZoomLevel(a)}var tIe=u1.INSTANCE.onDidChangeZoomLevel;function Zv(a){return u1.INSTANCE.getZoomFactor(a)}function dGi(a,i){u1.INSTANCE.setZoomFactor(a,i)}function L$(a,i){u1.INSTANCE.setFullscreen(a,i)}function hC(a){return u1.INSTANCE.isFullscreen(a)}var YN=u1.INSTANCE.onDidChangeFullscreen,iIe=navigator.userAgent,Ac=iIe.indexOf("Firefox")>=0,lV=iIe.indexOf("AppleWebKit")>=0,p1=iIe.indexOf("Chrome")>=0,Jb=!p1&&iIe.indexOf("Safari")>=0,uGi=!p1&&!Jb&&lV,fCn=iIe.indexOf("Electron/")>=0,NXt=iIe.indexOf("Android")>=0,Tht=!1;if(typeof ut.matchMedia=="function"){let a=ut.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),i=ut.matchMedia("(display-mode: fullscreen)");Tht=a.matches,gOo(ut,a,({matches:e})=>{Tht&&i.matches||(Tht=e)})}function oIe(){return Tht}function zse(){return!!navigator?.windowControlsOverlay?.visible}function pGi(a){return a.navigator?.windowControlsOverlay?.getTitlebarAreaRect()}function mGi(){return globalThis.MonacoEnvironment}var g$e=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(i,e){this._keyCodeToStr[i]=e,this._strToKeyCode[e.toLowerCase()]=i}keyCodeToStr(i){return this._keyCodeToStr[i]}strToKeyCode(i){return this._strToKeyCode[i.toLowerCase()]||0}},_ht=new g$e,OXt=new g$e,FXt=new g$e,WXt=new Array(230),Dht={},fOo={},hGi=[],gGi=Object.create(null),fGi=Object.create(null),Zb={lowerCaseToEnum:a=>fGi[a]||0,toEnum:a=>gGi[a]||0,toString:a=>hGi[a]||"None"},Qy=[],nIe=[];for(let a=0;a<=193;a++)Qy[a]=-1;for(let a=0;a<=132;a++)nIe[a]=-1;(function(){let i=[[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=[],t=[];for(let o of i){let[n,r,s,l,c,u,p,h,g]=o;if(t[r]||(t[r]=!0,hGi[r]=s,gGi[s]=r,fGi[s.toLowerCase()]=r,n&&(Qy[r]=l,l!==0&&l!==3&&!XN(l)&&(nIe[l]=r))),!e[l]){if(e[l]=!0,!c)throw new Error(`String representation missing for key code ${l} around scan code ${s}`);_ht.define(l,c),OXt.define(l,h||c),FXt.define(l,g||h||c)}u&&(WXt[u]=l),s&&(fOo[s]=u),p&&(Dht[p]=l)}nIe[3]=46})();var Fp;(r=>{function a(s){return _ht.keyCodeToStr(s)}r.toString=a;function i(s){return _ht.strToKeyCode(s)}r.fromString=i;function e(s){return OXt.keyCodeToStr(s)}r.toUserSettingsUS=e;function t(s){return FXt.keyCodeToStr(s)}r.toUserSettingsGeneral=t;function o(s){return OXt.strToKeyCode(s)||FXt.strToKeyCode(s)}r.fromUserSettings=o;function n(s){if(s>=98&&s<=113)return null;switch(s){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right";case 20:return"Delete"}return _ht.keyCodeToStr(s)}r.toElectronAccelerator=n})(Fp||={});function Vi(a,i){let e=(i&65535)<<16>>>0;return(a|e)>>>0}function XN(a){return a===5||a===4||a===6||a===57}var yg={clipboard:{writeText:Vr||document.queryCommandSupported&&document.queryCommandSupported("copy")||!!(navigator&&navigator.clipboard&&navigator.clipboard.writeText),readText:Vr||!!(navigator&&navigator.clipboard&&navigator.clipboard.readText)},keyboard:Vr||oIe()?0:navigator.keyboard||Jb?1:2,touch:"ontouchstart"in ut||navigator.maxTouchPoints>0,pointerEvents:ut.PointerEvent&&("ontouchstart"in ut||navigator.maxTouchPoints>0)};function f$e(a,i){if(typeof a=="number"){if(a===0)return null;let e=(a&65535)>>>0,t=(a&4294901760)>>>16;return t!==0?new m1([Lht(e,i),Lht(t,i)]):new m1([Lht(e,i)])}else{let e=[];for(let t=0;t<a.length;t++)e.push(Lht(a[t],i));return new m1(e)}}function Lht(a,i){let e=!!(a&2048),t=!!(a&256),o=i===2?t:e,n=!!(a&1024),r=!!(a&512),s=i===2?e:t,l=a&255;return new eS(o,n,r,s,l)}var eS=class a{constructor(i,e,t,o,n){this.ctrlKey=i;this.shiftKey=e;this.altKey=t;this.metaKey=o;this.keyCode=n}equals(i){return i instanceof a&&this.ctrlKey===i.ctrlKey&&this.shiftKey===i.shiftKey&&this.altKey===i.altKey&&this.metaKey===i.metaKey&&this.keyCode===i.keyCode}getHashCode(){let i=this.ctrlKey?"1":"0",e=this.shiftKey?"1":"0",t=this.altKey?"1":"0",o=this.metaKey?"1":"0";return`K${i}${e}${t}${o}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new m1([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},EL=class a{constructor(i,e,t,o,n){this.ctrlKey=i;this.shiftKey=e;this.altKey=t;this.metaKey=o;this.scanCode=n}equals(i){return i instanceof a&&this.ctrlKey===i.ctrlKey&&this.shiftKey===i.shiftKey&&this.altKey===i.altKey&&this.metaKey===i.metaKey&&this.scanCode===i.scanCode}getHashCode(){let i=this.ctrlKey?"1":"0",e=this.shiftKey?"1":"0",t=this.altKey?"1":"0",o=this.metaKey?"1":"0";return`S${i}${e}${t}${o}${this.scanCode}`}isDuplicateModifierCase(){return this.ctrlKey&&(this.scanCode===157||this.scanCode===161)||this.shiftKey&&(this.scanCode===158||this.scanCode===162)||this.altKey&&(this.scanCode===159||this.scanCode===163)||this.metaKey&&(this.scanCode===160||this.scanCode===164)}},m1=class{constructor(i){if(i.length===0)throw Yr("chords");this.chords=i}getHashCode(){let i="";for(let e=0,t=this.chords.length;e<t;e++)e!==0&&(i+=";"),i+=this.chords[e].getHashCode();return i}equals(i){if(i===null||this.chords.length!==i.chords.length)return!1;for(let e=0;e<this.chords.length;e++)if(!this.chords[e].equals(i.chords[e]))return!1;return!0}},Rht=class{constructor(i,e,t,o,n,r){this.ctrlKey=i;this.shiftKey=e;this.altKey=t;this.metaKey=o;this.keyLabel=n;this.keyAriaLabel=r}},rIe=class{};function vOo(a){if(a.charCode){let e=String.fromCharCode(a.charCode).toUpperCase();return Fp.fromString(e)}let i=a.keyCode;if(i===3)return 7;if(Ac)switch(i){case 59:return 85;case 60:if(fn)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Ze)return 57;break}else if(lV){if(Ze&&i===93)return 57;if(!Ze&&i===92)return 57}return WXt[i]||0}var bOo=Ze?256:2048,SOo=512,IOo=1024,yOo=Ze?2048:256;function vGi(a){let i=[];return a.ctrlKey&&i.push("ctrl"),a.shiftKey&&i.push("shift"),a.altKey&&i.push("alt"),a.metaKey&&i.push("meta"),`modifiers: [${i.join(",")}], code: ${a.code}, keyCode: ${a.keyCode}, key: ${a.key}`}function bGi(a){let i=[];return a.ctrlKey&&i.push("ctrl"),a.shiftKey&&i.push("shift"),a.altKey&&i.push("alt"),a.metaKey&&i.push("meta"),`modifiers: [${i.join(",")}], code: ${a.code}, keyCode: ${a.keyCode} ('${Fp.toString(a.keyCode)}')`}function Mht(a){return a.ctrlKey||a.shiftKey||a.altKey||a.metaKey}var gi=class{constructor(i){this._standardKeyboardEventBrand=!0;let e=i;this.browserEvent=e,this.target=e.target,this.ctrlKey=e.ctrlKey,this.shiftKey=e.shiftKey,this.altKey=e.altKey,this.metaKey=e.metaKey,this.altGraphKey=e.getModifierState?.("AltGraph"),this.keyCode=vOo(e),this.code=e.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(i){return this._asKeybinding===i}_computeKeybinding(){let i=0;XN(this.keyCode)||(i=this.keyCode);let e=0;return this.ctrlKey&&(e|=bOo),this.altKey&&(e|=SOo),this.shiftKey&&(e|=IOo),this.metaKey&&(e|=yOo),e|=i,e}_computeKeyCodeChord(){let i=0;return XN(this.keyCode)||(i=this.keyCode),new eS(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,i)}};var SGi=new WeakMap;function wOo(a){if(!a.parent||a.parent===a)return null;try{let i=a.location,e=a.parent.location;if(i.origin!=="null"&&e.origin!=="null"&&i.origin!==e.origin)return null}catch{return null}return a.parent}var Pht=class{static getSameOriginWindowChain(i){let e=SGi.get(i);if(!e){e=[],SGi.set(i,e);let t=i,o;do o=wOo(t),o?e.push({window:new WeakRef(t),iframeElement:t.frameElement||null}):e.push({window:new WeakRef(t),iframeElement:null}),t=o;while(t)}return e.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(i,e){if(!e||i===e)return{top:0,left:0};let t=0,o=0,n=this.getSameOriginWindowChain(i);for(let r of n){let s=r.window.deref();if(t+=s?.scrollY??0,o+=s?.scrollX??0,s===e||!r.iframeElement)break;let l=r.iframeElement.getBoundingClientRect();t+=l.top,o+=l.left}return{top:t,left:o}}};async function Aht(a,i){if(!crypto.subtle)throw new Error("'crypto.subtle' is not available so webviews will not work. This is likely because the editor is not running in a secure context (https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts).");let e=JSON.stringify({parentOrigin:a,salt:i}),o=new TextEncoder().encode(e),n=await crypto.subtle.digest("sha-256",o);return COo(n)}function COo(a){let e=Array.from(new Uint8Array(a)).map(t=>t.toString(16).padStart(2,"0")).join("");return BigInt(`0x${e}`).toString(32).padStart(52,"0")}var Cn=class{constructor(i,e){this.timestamp=Date.now(),this.browserEvent=e,this.leftButton=e.button===0,this.middleButton=e.button===1,this.rightButton=e.button===2,this.buttons=e.buttons,this.defaultPrevented=e.defaultPrevented,this.target=e.target,this.detail=e.detail||1,e.type==="dblclick"&&(this.detail=2),this.ctrlKey=e.ctrlKey,this.shiftKey=e.shiftKey,this.altKey=e.altKey,this.metaKey=e.metaKey,typeof e.pageX=="number"?(this.posx=e.pageX,this.posy=e.pageY):(this.posx=e.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=e.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let t=Pht.getPositionOfChildWindowRelativeToAncestorWindow(i,e.view);this.posx-=t.left,this.posy-=t.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}};var p_=class{constructor(i,e=0,t=0){this.browserEvent=i||null,this.target=i?i.target||i.targetNode||i.srcElement:null,this.deltaY=t,this.deltaX=e;let o=!1;if(p1){let n=navigator.userAgent.match(/Chrome\/(\d+)/);o=(n?parseInt(n[1]):123)<=122}if(i){let n=i,r=i,s=i.view?.devicePixelRatio||1;if(typeof n.wheelDeltaY<"u")o?this.deltaY=n.wheelDeltaY/(120*s):this.deltaY=n.wheelDeltaY/120;else if(typeof r.VERTICAL_AXIS<"u"&&r.axis===r.VERTICAL_AXIS)this.deltaY=-r.detail/3;else if(i.type==="wheel"){let l=i;l.deltaMode===l.DOM_DELTA_LINE?Ac&&!Ze?this.deltaY=-i.deltaY/3:this.deltaY=-i.deltaY:this.deltaY=-i.deltaY/40}if(typeof n.wheelDeltaX<"u")Jb&&ei?this.deltaX=-(n.wheelDeltaX/120):o?this.deltaX=n.wheelDeltaX/(120*s):this.deltaX=n.wheelDeltaX/120;else if(typeof r.HORIZONTAL_AXIS<"u"&&r.axis===r.HORIZONTAL_AXIS)this.deltaX=-i.detail/3;else if(i.type==="wheel"){let l=i;l.deltaMode===l.DOM_DELTA_LINE?Ac&&!Ze?this.deltaX=-i.deltaX/3:this.deltaX=-i.deltaX:this.deltaX=-i.deltaX/40}this.deltaY===0&&this.deltaX===0&&i.wheelDelta&&(o?this.deltaY=i.wheelDelta/(120*s):this.deltaY=i.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}};var IGi=Object.freeze(function(a,i){let e=setTimeout(a.bind(i),0);return{dispose(){clearTimeout(e)}}}),Se;(t=>{function a(o){return o===t.None||o===t.Cancelled||o instanceof aIe?!0:!o||typeof o!="object"?!1:typeof o.isCancellationRequested=="boolean"&&typeof o.onCancellationRequested=="function"}t.isCancellationToken=a,t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:U.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:IGi})})(Se||={});var aIe=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?IGi:(this._emitter||(this._emitter=new E),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Ye=class{constructor(i){this._token=void 0;this._parentListener=void 0;this._parentListener=i&&i.onCancellationRequested(this.cancel,this)}get token(){return this._token||(this._token=new aIe),this._token}cancel(){this._token?this._token instanceof aIe&&this._token.cancel():this._token=Se.Cancelled}dispose(i=!1){i&&this.cancel(),this._parentListener?.dispose(),this._token?this._token instanceof aIe&&this._token.dispose():this._token=Se.None}};function N9(a){let i=new Ye;return a.add({dispose(){i.cancel()}}),i.token}var Nht=class{constructor(){this._source=new Ye;this._listeners=new N;this._total=0;this._cancelled=0;this._isDone=!1}get token(){return this._source.token}add(i){if(this._isDone)return;if(this._total++,i.isCancellationRequested){this._cancelled++,this._check();return}let e=i.onCancellationRequested(()=>{e.dispose(),this._cancelled++,this._check()});this._listeners.add(e)}_check(){!this._isDone&&this._total>0&&this._total===this._cancelled&&(this._isDone=!0,this._listeners.dispose(),this._source.cancel())}dispose(){this._listeners.dispose(),this._source.dispose()}};var xOo=65,kOo=97,EOo=90,TOo=122,Kse=46,gC=47,TL=92,R$=58,_Oo=63,Oht=class extends Error{constructor(i,e,t){let o;typeof e=="string"&&e.indexOf("not ")===0?(o="must not be",e=e.replace(/^not /,"")):o="must be";let n=i.indexOf(".")!==-1?"property":"argument",r=`The "${i}" ${n} ${o} of type ${e}`;r+=`. Received type ${typeof t}`,super(r),this.code="ERR_INVALID_ARG_TYPE"}};function DOo(a,i){if(a===null||typeof a!="object")throw new Oht(i,"Object",a)}function tS(a,i){if(typeof a!="string")throw new Oht(i,"string",a)}var _L=jN==="win32";function Qc(a){return a===gC||a===TL}function VXt(a){return a===gC}function M$(a){return a>=xOo&&a<=EOo||a>=kOo&&a<=TOo}function Fht(a,i,e,t){let o="",n=0,r=-1,s=0,l=0;for(let c=0;c<=a.length;++c){if(c<a.length)l=a.charCodeAt(c);else{if(t(l))break;l=gC}if(t(l)){if(!(r===c-1||s===1))if(s===2){if(o.length<2||n!==2||o.charCodeAt(o.length-1)!==Kse||o.charCodeAt(o.length-2)!==Kse){if(o.length>2){let u=o.lastIndexOf(e);u===-1?(o="",n=0):(o=o.slice(0,u),n=o.length-1-o.lastIndexOf(e)),r=c,s=0;continue}else if(o.length!==0){o="",n=0,r=c,s=0;continue}}i&&(o+=o.length>0?`${e}..`:"..",n=2)}else o.length>0?o+=`${e}${a.slice(r+1,c)}`:o=a.slice(r+1,c),n=c-r-1;r=c,s=0}else l===Kse&&s!==-1?++s:s=-1}return o}function LOo(a){return a?`${a[0]==="."?"":"."}${a}`:""}function yGi(a,i){DOo(i,"pathObject");let e=i.dir||i.root,t=i.base||`${i.name||""}${LOo(i.ext)}`;return e?e===i.root?`${e}${t}`:`${e}${a}${t}`:t}var $s={resolve(...a){let i="",e="",t=!1;for(let o=a.length-1;o>=-1;o--){let n;if(o>=0){if(n=a[o],tS(n,`paths[${o}]`),n.length===0)continue}else i.length===0?n=Hse():(n=$u[`=${i}`]||Hse(),(n===void 0||n.slice(0,2).toLowerCase()!==i.toLowerCase()&&n.charCodeAt(2)===TL)&&(n=`${i}\\`));let r=n.length,s=0,l="",c=!1,u=n.charCodeAt(0);if(r===1)Qc(u)&&(s=1,c=!0);else if(Qc(u))if(c=!0,Qc(n.charCodeAt(1))){let p=2,h=p;for(;p<r&&!Qc(n.charCodeAt(p));)p++;if(p<r&&p!==h){let g=n.slice(h,p);for(h=p;p<r&&Qc(n.charCodeAt(p));)p++;if(p<r&&p!==h){for(h=p;p<r&&!Qc(n.charCodeAt(p));)p++;(p===r||p!==h)&&(l=`\\\\${g}\\${n.slice(h,p)}`,s=p)}}}else s=1;else M$(u)&&n.charCodeAt(1)===R$&&(l=n.slice(0,2),s=2,r>2&&Qc(n.charCodeAt(2))&&(c=!0,s=3));if(l.length>0)if(i.length>0){if(l.toLowerCase()!==i.toLowerCase())continue}else i=l;if(t){if(i.length>0)break}else if(e=`${n.slice(s)}\\${e}`,t=c,c&&i.length>0)break}return e=Fht(e,!t,"\\",Qc),t?`${i}\\${e}`:`${i}${e}`||"."},normalize(a){tS(a,"path");let i=a.length;if(i===0)return".";let e=0,t,o=!1,n=a.charCodeAt(0);if(i===1)return VXt(n)?"\\":a;if(Qc(n))if(o=!0,Qc(a.charCodeAt(1))){let s=2,l=s;for(;s<i&&!Qc(a.charCodeAt(s));)s++;if(s<i&&s!==l){let c=a.slice(l,s);for(l=s;s<i&&Qc(a.charCodeAt(s));)s++;if(s<i&&s!==l){for(l=s;s<i&&!Qc(a.charCodeAt(s));)s++;if(s===i)return`\\\\${c}\\${a.slice(l)}\\`;s!==l&&(t=`\\\\${c}\\${a.slice(l,s)}`,e=s)}}}else e=1;else M$(n)&&a.charCodeAt(1)===R$&&(t=a.slice(0,2),e=2,i>2&&Qc(a.charCodeAt(2))&&(o=!0,e=3));let r=e<i?Fht(a.slice(e),!o,"\\",Qc):"";if(r.length===0&&!o&&(r="."),r.length>0&&Qc(a.charCodeAt(i-1))&&(r+="\\"),!o&&t===void 0&&a.includes(":")){if(r.length>=2&&M$(r.charCodeAt(0))&&r.charCodeAt(1)===R$)return`.\\${r}`;let s=a.indexOf(":");do if(s===i-1||Qc(a.charCodeAt(s+1)))return`.\\${r}`;while((s=a.indexOf(":",s+1))!==-1)}return t===void 0?o?`\\${r}`:r:o?`${t}\\${r}`:`${t}${r}`},isAbsolute(a){tS(a,"path");let i=a.length;if(i===0)return!1;let e=a.charCodeAt(0);return Qc(e)||i>2&&M$(e)&&a.charCodeAt(1)===R$&&Qc(a.charCodeAt(2))},join(...a){if(a.length===0)return".";let i,e;for(let n=0;n<a.length;++n){let r=a[n];tS(r,"path"),r.length>0&&(i===void 0?i=e=r:i+=`\\${r}`)}if(i===void 0)return".";let t=!0,o=0;if(typeof e=="string"&&Qc(e.charCodeAt(0))){++o;let n=e.length;n>1&&Qc(e.charCodeAt(1))&&(++o,n>2&&(Qc(e.charCodeAt(2))?++o:t=!1))}if(t){for(;o<i.length&&Qc(i.charCodeAt(o));)o++;o>=2&&(i=`\\${i.slice(o)}`)}return $s.normalize(i)},relative(a,i){if(tS(a,"from"),tS(i,"to"),a===i)return"";let e=$s.resolve(a),t=$s.resolve(i);if(e===t||(a=e.toLowerCase(),i=t.toLowerCase(),a===i))return"";if(e.length!==a.length||t.length!==i.length){let f=e.split("\\"),v=t.split("\\");f[f.length-1]===""&&f.pop(),v[v.length-1]===""&&v.pop();let b=f.length,S=v.length,y=b<S?b:S,w;for(w=0;w<y&&f[w].toLowerCase()===v[w].toLowerCase();w++);return w===0?t:w===y?S>y?v.slice(w).join("\\"):b>y?"..\\".repeat(b-1-w)+"..":"":"..\\".repeat(b-w)+v.slice(w).join("\\")}let o=0;for(;o<a.length&&a.charCodeAt(o)===TL;)o++;let n=a.length;for(;n-1>o&&a.charCodeAt(n-1)===TL;)n--;let r=n-o,s=0;for(;s<i.length&&i.charCodeAt(s)===TL;)s++;let l=i.length;for(;l-1>s&&i.charCodeAt(l-1)===TL;)l--;let c=l-s,u=r<c?r:c,p=-1,h=0;for(;h<u;h++){let f=a.charCodeAt(o+h);if(f!==i.charCodeAt(s+h))break;f===TL&&(p=h)}if(h!==u){if(p===-1)return t}else{if(c>u){if(i.charCodeAt(s+h)===TL)return t.slice(s+h+1);if(h===2)return t.slice(s+h)}r>u&&(a.charCodeAt(o+h)===TL?p=h:h===2&&(p=3)),p===-1&&(p=0)}let g="";for(h=o+p+1;h<=n;++h)(h===n||a.charCodeAt(h)===TL)&&(g+=g.length===0?"..":"\\..");return s+=p,g.length>0?`${g}${t.slice(s,l)}`:(t.charCodeAt(s)===TL&&++s,t.slice(s,l))},toNamespacedPath(a){if(typeof a!="string"||a.length===0)return a;let i=$s.resolve(a);if(i.length<=2)return a;if(i.charCodeAt(0)===TL){if(i.charCodeAt(1)===TL){let e=i.charCodeAt(2);if(e!==_Oo&&e!==Kse)return`\\\\?\\UNC\\${i.slice(2)}`}}else if(M$(i.charCodeAt(0))&&i.charCodeAt(1)===R$&&i.charCodeAt(2)===TL)return`\\\\?\\${i}`;return i},dirname(a){tS(a,"path");let i=a.length;if(i===0)return".";let e=-1,t=0,o=a.charCodeAt(0);if(i===1)return Qc(o)?a:".";if(Qc(o)){if(e=t=1,Qc(a.charCodeAt(1))){let s=2,l=s;for(;s<i&&!Qc(a.charCodeAt(s));)s++;if(s<i&&s!==l){for(l=s;s<i&&Qc(a.charCodeAt(s));)s++;if(s<i&&s!==l){for(l=s;s<i&&!Qc(a.charCodeAt(s));)s++;if(s===i)return a;s!==l&&(e=t=s+1)}}}}else M$(o)&&a.charCodeAt(1)===R$&&(e=i>2&&Qc(a.charCodeAt(2))?3:2,t=e);let n=-1,r=!0;for(let s=i-1;s>=t;--s)if(Qc(a.charCodeAt(s))){if(!r){n=s;break}}else r=!1;if(n===-1){if(e===-1)return".";n=e}return a.slice(0,n)},basename(a,i){i!==void 0&&tS(i,"suffix"),tS(a,"path");let e=0,t=-1,o=!0,n;if(a.length>=2&&M$(a.charCodeAt(0))&&a.charCodeAt(1)===R$&&(e=2),i!==void 0&&i.length>0&&i.length<=a.length){if(i===a)return"";let r=i.length-1,s=-1;for(n=a.length-1;n>=e;--n){let l=a.charCodeAt(n);if(Qc(l)){if(!o){e=n+1;break}}else s===-1&&(o=!1,s=n+1),r>=0&&(l===i.charCodeAt(r)?--r===-1&&(t=n):(r=-1,t=s))}return e===t?t=s:t===-1&&(t=a.length),a.slice(e,t)}for(n=a.length-1;n>=e;--n)if(Qc(a.charCodeAt(n))){if(!o){e=n+1;break}}else t===-1&&(o=!1,t=n+1);return t===-1?"":a.slice(e,t)},extname(a){tS(a,"path");let i=0,e=-1,t=0,o=-1,n=!0,r=0;a.length>=2&&a.charCodeAt(1)===R$&&M$(a.charCodeAt(0))&&(i=t=2);for(let s=a.length-1;s>=i;--s){let l=a.charCodeAt(s);if(Qc(l)){if(!n){t=s+1;break}continue}o===-1&&(n=!1,o=s+1),l===Kse?e===-1?e=s:r!==1&&(r=1):e!==-1&&(r=-1)}return e===-1||o===-1||r===0||r===1&&e===o-1&&e===t+1?"":a.slice(e,o)},format:yGi.bind(null,"\\"),parse(a){tS(a,"path");let i={root:"",dir:"",base:"",ext:"",name:""};if(a.length===0)return i;let e=a.length,t=0,o=a.charCodeAt(0);if(e===1)return Qc(o)?(i.root=i.dir=a,i):(i.base=i.name=a,i);if(Qc(o)){if(t=1,Qc(a.charCodeAt(1))){let p=2,h=p;for(;p<e&&!Qc(a.charCodeAt(p));)p++;if(p<e&&p!==h){for(h=p;p<e&&Qc(a.charCodeAt(p));)p++;if(p<e&&p!==h){for(h=p;p<e&&!Qc(a.charCodeAt(p));)p++;p===e?t=p:p!==h&&(t=p+1)}}}}else if(M$(o)&&a.charCodeAt(1)===R$){if(e<=2)return i.root=i.dir=a,i;if(t=2,Qc(a.charCodeAt(2))){if(e===3)return i.root=i.dir=a,i;t=3}}t>0&&(i.root=a.slice(0,t));let n=-1,r=t,s=-1,l=!0,c=a.length-1,u=0;for(;c>=t;--c){if(o=a.charCodeAt(c),Qc(o)){if(!l){r=c+1;break}continue}s===-1&&(l=!1,s=c+1),o===Kse?n===-1?n=c:u!==1&&(u=1):n!==-1&&(u=-1)}return s!==-1&&(n===-1||u===0||u===1&&n===s-1&&n===r+1?i.base=i.name=a.slice(r,s):(i.name=a.slice(r,n),i.base=a.slice(r,s),i.ext=a.slice(n,s))),r>0&&r!==t?i.dir=a.slice(0,r-1):i.dir=i.root,i},sep:"\\",delimiter:";",win32:null,posix:null},ROo=(()=>{if(_L){let a=/\\/g;return()=>{let i=Hse().replace(a,"/");return i.slice(i.indexOf("/"))}}return()=>Hse()})(),Oo={resolve(...a){let i="",e=!1;for(let t=a.length-1;t>=0&&!e;t--){let o=a[t];tS(o,`paths[${t}]`),o.length!==0&&(i=`${o}/${i}`,e=o.charCodeAt(0)===gC)}if(!e){let t=ROo();i=`${t}/${i}`,e=t.charCodeAt(0)===gC}return i=Fht(i,!e,"/",VXt),e?`/${i}`:i.length>0?i:"."},normalize(a){if(tS(a,"path"),a.length===0)return".";let i=a.charCodeAt(0)===gC,e=a.charCodeAt(a.length-1)===gC;return a=Fht(a,!i,"/",VXt),a.length===0?i?"/":e?"./":".":(e&&(a+="/"),i?`/${a}`:a)},isAbsolute(a){return tS(a,"path"),a.length>0&&a.charCodeAt(0)===gC},join(...a){if(a.length===0)return".";let i=[];for(let e=0;e<a.length;++e){let t=a[e];tS(t,"path"),t.length>0&&i.push(t)}return i.length===0?".":Oo.normalize(i.join("/"))},relative(a,i){if(tS(a,"from"),tS(i,"to"),a===i||(a=Oo.resolve(a),i=Oo.resolve(i),a===i))return"";let e=1,t=a.length,o=t-e,n=1,r=i.length-n,s=o<r?o:r,l=-1,c=0;for(;c<s;c++){let p=a.charCodeAt(e+c);if(p!==i.charCodeAt(n+c))break;p===gC&&(l=c)}if(c===s)if(r>s){if(i.charCodeAt(n+c)===gC)return i.slice(n+c+1);if(c===0)return i.slice(n+c)}else o>s&&(a.charCodeAt(e+c)===gC?l=c:c===0&&(l=0));let u="";for(c=e+l+1;c<=t;++c)(c===t||a.charCodeAt(c)===gC)&&(u+=u.length===0?"..":"/..");return`${u}${i.slice(n+l)}`},toNamespacedPath(a){return a},dirname(a){if(tS(a,"path"),a.length===0)return".";let i=a.charCodeAt(0)===gC,e=-1,t=!0;for(let o=a.length-1;o>=1;--o)if(a.charCodeAt(o)===gC){if(!t){e=o;break}}else t=!1;return e===-1?i?"/":".":i&&e===1?"//":a.slice(0,e)},basename(a,i){i!==void 0&&tS(i,"suffix"),tS(a,"path");let e=0,t=-1,o=!0,n;if(i!==void 0&&i.length>0&&i.length<=a.length){if(i===a)return"";let r=i.length-1,s=-1;for(n=a.length-1;n>=0;--n){let l=a.charCodeAt(n);if(l===gC){if(!o){e=n+1;break}}else s===-1&&(o=!1,s=n+1),r>=0&&(l===i.charCodeAt(r)?--r===-1&&(t=n):(r=-1,t=s))}return e===t?t=s:t===-1&&(t=a.length),a.slice(e,t)}for(n=a.length-1;n>=0;--n)if(a.charCodeAt(n)===gC){if(!o){e=n+1;break}}else t===-1&&(o=!1,t=n+1);return t===-1?"":a.slice(e,t)},extname(a){tS(a,"path");let i=-1,e=0,t=-1,o=!0,n=0;for(let r=a.length-1;r>=0;--r){let s=a[r];if(s==="/"){if(!o){e=r+1;break}continue}t===-1&&(o=!1,t=r+1),s==="."?i===-1?i=r:n!==1&&(n=1):i!==-1&&(n=-1)}return i===-1||t===-1||n===0||n===1&&i===t-1&&i===e+1?"":a.slice(i,t)},format:yGi.bind(null,"/"),parse(a){tS(a,"path");let i={root:"",dir:"",base:"",ext:"",name:""};if(a.length===0)return i;let e=a.charCodeAt(0)===gC,t;e?(i.root="/",t=1):t=0;let o=-1,n=0,r=-1,s=!0,l=a.length-1,c=0;for(;l>=t;--l){let u=a.charCodeAt(l);if(u===gC){if(!s){n=l+1;break}continue}r===-1&&(s=!1,r=l+1),u===Kse?o===-1?o=l:c!==1&&(c=1):o!==-1&&(c=-1)}if(r!==-1){let u=n===0&&e?1:n;o===-1||c===0||c===1&&o===r-1&&o===n+1?i.base=i.name=a.slice(u,r):(i.name=a.slice(u,o),i.base=a.slice(u,r),i.ext=a.slice(o,r))}return n>0?i.dir=a.slice(0,n-1):e&&(i.dir="/"),i},sep:"/",delimiter:":",win32:null,posix:null};Oo.win32=$s.win32=$s;Oo.posix=$s.posix=Oo;var ch=_L?$s.normalize:Oo.normalize,Zl=_L?$s.isAbsolute:Oo.isAbsolute,Yc=_L?$s.join:Oo.join,cP=_L?$s.resolve:Oo.resolve,dP=_L?$s.relative:Oo.relative,ad=_L?$s.dirname:Oo.dirname,jo=_L?$s.basename:Oo.basename,qm=_L?$s.extname:Oo.extname,NCn=_L?$s.format:Oo.format,P$=_L?$s.parse:Oo.parse,OCn=_L?$s.toNamespacedPath:Oo.toNamespacedPath,Qd=_L?$s.sep:Oo.sep,FCn=_L?$s.delimiter:Oo.delimiter;var dV=class{constructor(i){this.task=i;this.result=null}get(){if(this.result)return this.result;let i=new Ye,e=this.task(i.token);return this.result={promise:e,dispose:()=>{this.result=null,i.cancel(),i.dispose()}},this.result}};function BXt(a){return a}var lIe=class{constructor(i,e){this.lastCache=void 0;this.lastArgKey=void 0;typeof i=="function"?(this._fn=i,this._computeKey=BXt):(this._fn=e,this._computeKey=i.getCacheKey)}get(i){let e=this._computeKey(i);return this.lastArgKey!==e&&(this.lastArgKey=e,this.lastCache=this._fn(i)),this.lastCache}},NI=class{constructor(i,e){this._map=new Map;this._map2=new Map;typeof i=="function"?(this._fn=i,this._computeKey=BXt):(this._fn=e,this._computeKey=i.getCacheKey)}get cachedValues(){return this._map}get(i){let e=this._computeKey(i);if(this._map2.has(e))return this._map2.get(e);let t=this._fn(i);return this._map.set(i,t),this._map2.set(e,t),t}},Wht=class{constructor(i,e){this._map=new WeakMap;typeof i=="function"?(this._fn=i,this._computeKey=BXt):(this._fn=e,this._computeKey=i.getCacheKey)}get(i){let e=this._computeKey(i);if(this._map.has(e))return this._map.get(e);let t=this._fn(i);return this._map.set(e,t),t}};var co=class{constructor(i){this.executor=i;this._state=0}get hasValue(){return this._state===2}get value(){if(this._state===0){this._state=1;try{this._value=this.executor()}catch(i){this._error=i}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 Gse(a){return a<0?0:a>255?255:a|0}function qse(a){return a<0?0:a>4294967295?4294967295:a|0}function uc(a){return!a||typeof a!="string"?!0:a.trim().length===0}var MOo=/{(\d+)}/g;function vd(a,...i){return i.length===0?a:a.replace(MOo,function(e,t){let o=parseInt(t,10);return isNaN(o)||o<0||o>=i.length?e:i[o]})}var POo=/{([^}]+)}/g;function m_(a,i){return Object.keys(i).length===0?a:a.replace(POo,(e,t)=>i[t]??e)}function Bht(a){return a.replace(/[<>"'&]/g,i=>{switch(i){case"<":return"&lt;";case">":return"&gt;";case'"':return"&quot;";case"'":return"&apos;";case"&":return"&amp;"}return i})}function mr(a){return a.replace(/[<>&]/g,function(i){switch(i){case"<":return"&lt;";case">":return"&gt;";case"&":return"&amp;";default:return i}})}function ns(a){return a.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function DL(a,i){let e=0,t=a.indexOf(i);for(;t!==-1;)e++,t=a.indexOf(i,t+i.length);return e}function JN(a,i,e=AGi){return a.length<=i?a:`${a.substr(0,i)}${e}`}function UXt(a,i,e=AGi){if(a.length<=i)return a;let t=Math.ceil(i/2)-e.length/2,o=Math.floor(i/2)-e.length/2;return`${a.substr(0,t)}${e}${a.substr(a.length-o)}`}function LL(a,i=" "){let e=fC(a,i);return dh(e,i)}function fC(a,i){if(!a||!i)return a;let e=i.length,t=0;if(e===1){let o=i.charCodeAt(0);for(;t<a.length&&a.charCodeAt(t)===o;)t++}else for(;a.startsWith(i,t);)t+=e;return a.substring(t)}function dh(a,i){if(!a||!i)return a;let e=i.length,t=a.length;if(e===1){let n=t,r=i.charCodeAt(0);for(;n>0&&a.charCodeAt(n-1)===r;)n--;return a.substring(0,n)}let o=t;for(;o>0&&a.endsWith(i,o);)o-=e;return a.substring(0,o)}function CGi(a){return a.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function N$(a,i,e={}){if(!a)throw new Error("Cannot create regex from empty string");i||(a=ns(a)),e.wholeWord&&(/\B/.test(a.charAt(0))||(a="\\b"+a),/\B/.test(a.charAt(a.length-1))||(a=a+"\\b"));let t="";return e.global&&(t+="g"),e.matchCase||(t+="i"),e.multiline&&(t+="m"),e.unicode&&(t+="u"),new RegExp(a,t)}function cIe(a){return a.source==="^"||a.source==="^$"||a.source==="$"||a.source==="^\\s*$"?!1:!!(a.exec("")&&a.lastIndex===0)}function xGi(a,i){return a.filter(e=>e!=null&&e!==!1).join(i)}function yc(a){return a.split(/\r\n|\r|\n/)}function kGi(a){let i=[],e=a.split(/(\r\n|\r|\n)/);for(let t=0;t<Math.ceil(e.length/2);t++)i.push(e[2*t]+(e[2*t+1]??""));return i}function nm(a){for(let i=0,e=a.length;i<e;i++){let t=a.charCodeAt(i);if(t!==32&&t!==9)return i}return-1}function Ll(a,i=0,e=a.length){for(let t=i;t<e;t++){let o=a.charCodeAt(t);if(o!==32&&o!==9)return a.substring(i,t)}return a.substring(i,e)}function hv(a,i=a.length-1){for(let e=i;e>=0;e--){let t=a.charCodeAt(e);if(t!==32&&t!==9)return e}return-1}function Hl(a,i){return a<i?-1:a>i?1:0}function dIe(a,i,e=0,t=a.length,o=0,n=i.length){for(;e<t&&o<n;e++,o++){let l=a.charCodeAt(e),c=i.charCodeAt(o);if(l<c)return-1;if(l>c)return 1}let r=t-e,s=n-o;return r<s?-1:r>s?1:0}function OI(a,i){return jse(a,i,0,a.length,0,i.length)}function jse(a,i,e=0,t=a.length,o=0,n=i.length){for(;e<t&&o<n;e++,o++){let l=a.charCodeAt(e),c=i.charCodeAt(o);if(l===c)continue;if(l>=128||c>=128)return dIe(a.toLowerCase(),i.toLowerCase(),e,t,o,n);h1(l)&&(l-=32),h1(c)&&(c-=32);let u=l-c;if(u!==0)return u}let r=t-e,s=n-o;return r<s?-1:r>s?1:0}function v$e(a){return a>=48&&a<=57}function h1(a){return a>=97&&a<=122}function pE(a){return a>=65&&a<=90}function vr(a,i){return a.length===i.length&&jse(a,i)===0}function EGi(a,i,e){return a===i||!!e&&a!==void 0&&i!==void 0&&vr(a,i)}function mE(a,i){let e=i.length;return e<=a.length&&jse(a,i,0,e)===0}function Hht(a,i){let e=a.length,t=e-i.length;return t>=0&&jse(a,i,t,e)===0}function tf(a,i){let e=Math.min(a.length,i.length),t;for(t=0;t<e;t++)if(a.charCodeAt(t)!==i.charCodeAt(t))return t;return e}function vC(a,i){let e=Math.min(a.length,i.length),t,o=a.length-1,n=i.length-1;for(t=0;t<e;t++)if(a.charCodeAt(o-t)!==i.charCodeAt(n-t))return t;return e}function ju(a){return 55296<=a&&a<=56319}function ZN(a){return 56320<=a&&a<=57343}function Uht(a,i){return(a-55296<<10)+(i-56320)+65536}function uIe(a,i,e){let t=a.charCodeAt(e);if(ju(t)&&e+1<i){let o=a.charCodeAt(e+1);if(ZN(o))return Uht(t,o)}return t}function AOo(a,i){let e=a.charCodeAt(i-1);if(ZN(e)&&i>1){let t=a.charCodeAt(i-2);if(ju(t))return Uht(t,e)}return e}var $se=class{get offset(){return this._offset}constructor(i,e=0){this._str=i,this._len=i.length,this._offset=e}setOffset(i){this._offset=i}prevCodePoint(){let i=AOo(this._str,this._offset);return this._offset-=i>=65536?2:1,i}nextCodePoint(){let i=uIe(this._str,this._len,this._offset);return this._offset+=i>=65536?2:1,i}eol(){return this._offset>=this._len}},A$=class{get offset(){return this._iterator.offset}constructor(i,e=0){this._iterator=new $se(i,e)}nextGraphemeLength(){let i=Vht.getInstance(),e=this._iterator,t=e.offset,o=i.getGraphemeBreakType(e.nextCodePoint());for(;!e.eol();){let n=e.offset,r=i.getGraphemeBreakType(e.nextCodePoint());if(wGi(o,r)){e.setOffset(n);break}o=r}return e.offset-t}prevGraphemeLength(){let i=Vht.getInstance(),e=this._iterator,t=e.offset,o=i.getGraphemeBreakType(e.prevCodePoint());for(;e.offset>0;){let n=e.offset,r=i.getGraphemeBreakType(e.prevCodePoint());if(wGi(r,o)){e.setOffset(n);break}o=r}return t-e.offset}eol(){return this._iterator.eol()}};function pIe(a,i){return new A$(a,i).nextGraphemeLength()}function zXt(a,i){return new A$(a,i).prevGraphemeLength()}function zht(a,i){i>0&&ZN(a.charCodeAt(i))&&i--;let e=i+pIe(a,i);return[e-zXt(a,e),e]}var HXt;function NOo(){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 uP(a){return HXt||(HXt=NOo()),HXt.test(a)}var OOo=/^[\t\n\r\x20-\x7E]*$/;function g1(a){return OOo.test(a)}var KXt=/[\u2028\u2029]/;function Kht(a){return KXt.test(a)}function h_(a){return a>=11904&&a<=55215||a>=63744&&a<=64255||a>=65281&&a<=65374||a>=65504&&a<=65510}function b$e(a){return a>=127462&&a<=127487||a===8986||a===8987||a===9200||a===9203||a>=9728&&a<=10175||a===11088||a===11093||a>=127744&&a<=128591||a>=128640&&a<=128764||a>=128992&&a<=129008||a>=129280&&a<=129535||a>=129648&&a<=129782}function TGi(a,i,e=""){let t=a.trimStart();if(t.length<i)return t;let o=/\b/g,n=0;for(;o.test(t)&&!(t.length-o.lastIndex<i);)n=o.lastIndex,o.lastIndex+=1;return n===0?t:e+t.substring(n).trimStart()}function GXt(a,i,e=""){let t=a.trimEnd();if(t.length<=i)return t;let o=/\b/g,n=0,r=!1;for(;o.test(t);){if(o.lastIndex>i){r=!0;break}n=o.lastIndex,o.lastIndex+=1}if(!r)return t;if(n===0)return e;let s=t.substring(0,n).trimEnd();return s.length<n/2?t:s+e}var FOo=/(?:\x1b\[|\x9b)[=?>!]?[\d;:]*["$#'* ]?[a-zA-Z@^`{}|~]/,WOo=/(?:\x1b\]|\x9d).*?(?:\x1b\\|\x07|\x9c)/,VOo=/\x1b(?:[ #%\(\)\*\+\-\.\/]?[a-zA-Z0-9\|}~@])/,_Gi=new RegExp("(?:"+[FOo.source,WOo.source,VOo.source].join("|")+")","g");function*DGi(a){let i=0;for(let e of a.matchAll(_Gi))i!==e.index&&(yield{isCode:!1,str:a.substring(i,e.index)}),yield{isCode:!0,str:e[0]},i=e.index+e[0].length;i!==a.length&&(yield{isCode:!1,str:a.substring(i)})}function zS(a){return a&&(a=a.replace(_Gi,"")),a}var BOo=/\\\[.*?\\\]/g;function LGi(a){return zS(a).replace(BOo,"")}var RGi=String.fromCharCode(65279);function Ght(a){return!!(a&&a.length>0&&a.charCodeAt(0)===65279)}function S$e(a,i){if(!a||!i||a.length<i.length)return!1;let e=i.length,t=a.toLowerCase(),o=0,n=-1;for(;o<e;){let r=t.indexOf(i[o],n+1);if(r<0)return!1;n=r,o++}return!0}function I$e(a,i=!1){return a?(i&&(a=a.replace(/\\./g,"")),a.toLowerCase()!==a):!1}function Qse(a){return a.charAt(0).toUpperCase()+a.slice(1)}function MGi(a,i=1){if(i===0)return"";let e=-1;do e=a.indexOf(`
`,e+1),i--;while(i>0&&e>=0);return e===-1?a:(a[e-1]==="\r"&&e--,a.substr(0,e))}function mIe(a){let i=26;return a=a%(2*i),a<i?String.fromCharCode(97+a):String.fromCharCode(65+a-i)}function wGi(a,i){return a===0?i!==5&&i!==7:a===2&&i===3?!1:a===4||a===2||a===3||i===4||i===2||i===3?!0:!(a===8&&(i===8||i===9||i===11||i===12)||(a===11||a===9)&&(i===9||i===10)||(a===12||a===10)&&i===10||i===5||i===13||i===7||a===1||a===13&&i===14||a===6&&i===6)}var Vht=class a{static{this._INSTANCE=null}static getInstance(){return a._INSTANCE||(a._INSTANCE=new a),a._INSTANCE}constructor(){this._data=HOo()}getGraphemeBreakType(i){if(i<32)return i===10?3:i===13?2:4;if(i<127)return 0;let e=this._data,t=e.length/3,o=1;for(;o<=t;)if(i<e[3*o])o=2*o;else if(i>e[3*o+1])o=2*o+1;else return e[3*o+2];return 0}};function HOo(){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]")}function PGi(a,i){if(a===0)return 0;let e=UOo(a,i);if(e!==void 0)return e;let t=new $se(i,a);return t.prevCodePoint(),t.offset}function UOo(a,i){let e=new $se(i,a),t=e.prevCodePoint();for(;zOo(t)||t===65039||t===8419;){if(e.offset===0)return;t=e.prevCodePoint()}if(!b$e(t))return;let o=e.offset;return o>0&&e.prevCodePoint()===8205&&(o=e.offset),o}function zOo(a){return 127995<=a&&a<=127999}var eO="\xA0",O9=class a{constructor(i){this.confusableDictionary=i}static{this.ambiguousCharacterData=new co(()=>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 lIe(i=>{let e=i.split(",");function t(p){let h=new Map;for(let g=0;g<p.length;g+=2)h.set(p[g],p[g+1]);return h}function o(p,h){let g=new Map(p);for(let[f,v]of h)g.set(f,v);return g}function n(p,h){if(!p)return h;let g=new Map;for(let[f,v]of p)h.has(f)&&g.set(f,v);return g}let r=this.ambiguousCharacterData.value,s=e.filter(p=>!p.startsWith("_")&&Object.hasOwn(r,p));s.length===0&&(s=["_default"]);let l;for(let p of s){let h=t(r[p]);l=n(l,h)}let c=t(r._common),u=o(c,l);return new a(u)})}static getInstance(i){return a.cache.get(Array.from(i).join(","))}static{this._locales=new co(()=>Object.keys(a.ambiguousCharacterData.value).filter(i=>!i.startsWith("_")))}static getLocales(){return a._locales.value}isAmbiguous(i){return this.confusableDictionary.has(i)}containsAmbiguousCharacter(i){for(let e=0;e<i.length;e++){let t=i.codePointAt(e);if(typeof t=="number"&&this.isAmbiguous(t))return!0}return!1}getPrimaryConfusable(i){return this.confusableDictionary.get(i)}getConfusableCodePoints(){return new Set(this.confusableDictionary.keys())}},uV=class a{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(a.getRawData())].flat())),this._data}static isInvisibleCharacter(i){return a.getData().has(i)}static containsInvisibleCharacter(i){for(let e=0;e<i.length;e++){let t=i.codePointAt(e);if(typeof t=="number"&&(a.isInvisibleCharacter(t)||t===32))return!0}return!1}static get codePoints(){return a.getData()}},AGi="\u2026";function KOo(a){let i=new Uint16Array(a.length);for(let o=0;o<i.length;o++)i[o]=a.charCodeAt(o);let e="",t=new Uint8Array(i.buffer);for(let o=0;o<t.length;o++)e+=String.fromCharCode(t[o]);return e}function F9(a){return btoa(KOo(a))}function W9(a){return a===47||a===92}function f1(a){return a.replace(/[\\/]/g,Oo.sep)}function NGi(a){return a.indexOf("/")===-1&&(a=f1(a)),/^[a-zA-Z]:(\/|$)/.test(a)&&(a="/"+a),a}function qXt(a,i=Oo.sep){if(!a)return"";let e=a.length,t=a.charCodeAt(0);if(W9(t)){if(W9(a.charCodeAt(1))&&!W9(a.charCodeAt(2))){let n=3,r=n;for(;n<e&&!W9(a.charCodeAt(n));n++);if(r!==n&&!W9(a.charCodeAt(n+1))){for(n+=1;n<e;n++)if(W9(a.charCodeAt(n)))return a.slice(0,n+1).replace(/[\\/]/g,i)}}return i}else if(FGi(t)&&a.charCodeAt(1)===58)return W9(a.charCodeAt(2))?a.slice(0,2)+i:a.slice(0,2);let o=a.indexOf("://");if(o!==-1){for(o+=3;o<e;o++)if(W9(a.charCodeAt(o)))return a.slice(0,o+1)}return""}function O$(a){if(!ei||!a||a.length<5)return!1;let i=a.charCodeAt(0);if(i!==92||(i=a.charCodeAt(1),i!==92))return!1;let e=2,t=e;for(;e<a.length&&(i=a.charCodeAt(e),i!==92);e++);return!(t===e||(i=a.charCodeAt(e+1),isNaN(i)||i===92))}var GOo=/[\\/:\*\?"<>\|]/g,qOo=/[/]/g,$Oo=/^(con|prn|aux|clock\$|nul|lpt[0-9]|com[0-9])(\.(.*?))?$/i;function v1(a,i=ei){let e=i?GOo:qOo;return!(!a||a.length===0||/^\s+$/.test(a)||(e.lastIndex=0,e.test(a))||i&&$Oo.test(a)||a==="."||a===".."||i&&a[a.length-1]==="."||i&&a.length!==a.trim().length||a.length>255)}function OGi(a,i,e){let t=a===i;return!e||t?t:!a||!i?!1:vr(a,i)}function Yse(a,i,e,t=Qd){if(a===i)return!0;if(!a||!i||i.length>a.length)return!1;if(e){if(!mE(a,i))return!1;if(i.length===a.length)return!0;let n=i.length;return i.charAt(i.length-1)===t&&n--,a.charAt(n)===t}return i.charAt(i.length-1)!==t&&(i+=t),a.indexOf(i)===0}function FGi(a){return a>=65&&a<=90||a>=97&&a<=122}function WGi(a){return ei?(a=dh(a,Qd),a.endsWith(":")&&(a+=Qd)):(a=dh(a,Qd),a||(a=Qd)),a}function V9(a,i=ei){return i?FGi(a.charCodeAt(0))&&a.charCodeAt(1)===58:!1}function VGi(a,i=ei){return V9(a,i)?a[0]:void 0}function hIe(a,i,e){return i.length>a.length?-1:a===i?0:(e&&(a=a.toLowerCase(),i=i.toLowerCase()),a.indexOf(i))}function BGi(a){let i=a.split(":"),e,t,o;for(let n of i){let r=Number(n);Yo(r)?t===void 0?t=r:o===void 0&&(o=r):e=e?[e,n].join(":"):n}if(!e)throw new Error("Format for `--goto` should be: `FILE:LINE(:COLUMN)`");return{path:e,line:t!==void 0?t:void 0,column:o!==void 0?o:t!==void 0?1:void 0}}var jOo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",QOo="BDEFGHIJKMOQRSTUVWXYZbdefghijkmoqrstuvwxyz0123456789";function gIe(a,i,e=8){let t="";for(let n=0;n<e;n++){let r;n===0&&ei&&!i&&(e===3||e===4)?r=QOo:r=jOo,t+=r.charAt(Math.floor(Math.random()*r.length))}let o;return i?o=`${i}-${t}`:o=t,a?Yc(a,o):o}var YOo=/^\w[\w\d+.-]*$/,XOo=/^\//,JOo=/^\/\//;function ZOo(a,i){if(!a.scheme&&i)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${a.authority}", path: "${a.path}", query: "${a.query}", fragment: "${a.fragment}"}`);if(a.scheme&&!YOo.test(a.scheme)){let e=[...a.scheme.matchAll(/[^\w\d+.-]/gu)],t=e.length>0?` Found '${e[0][0]}' at index ${e[0].index} (${e.length} total)`:"";throw new Error(`[UriError]: Scheme contains illegal characters.${t} (len:${a.scheme.length})`)}if(a.path){if(a.authority){if(!XOo.test(a.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(JOo.test(a.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}function eFo(a,i){return!a&&!i?"file":a}function tFo(a,i){switch(a){case"https":case"http":case"file":i?i[0]!==pV&&(i=pV+i):i=pV;break}return i}var wg="",pV="/",iFo=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/,A=class a{static isUri(i){return i instanceof a?!0:!i||typeof i!="object"?!1:typeof i.authority=="string"&&typeof i.fragment=="string"&&typeof i.path=="string"&&typeof i.query=="string"&&typeof i.scheme=="string"&&typeof i.fsPath=="string"&&typeof i.with=="function"&&typeof i.toString=="function"}constructor(i,e,t,o,n,r=!1){typeof i=="object"?(this.scheme=i.scheme||wg,this.authority=i.authority||wg,this.path=i.path||wg,this.query=i.query||wg,this.fragment=i.fragment||wg):(this.scheme=eFo(i,r),this.authority=e||wg,this.path=tFo(this.scheme,t||wg),this.query=o||wg,this.fragment=n||wg,ZOo(this,r))}get fsPath(){return Xse(this,!1)}with(i){if(!i)return this;let{scheme:e,authority:t,path:o,query:n,fragment:r}=i;return e===void 0?e=this.scheme:e===null&&(e=wg),t===void 0?t=this.authority:t===null&&(t=wg),o===void 0?o=this.path:o===null&&(o=wg),n===void 0?n=this.query:n===null&&(n=wg),r===void 0?r=this.fragment:r===null&&(r=wg),e===this.scheme&&t===this.authority&&o===this.path&&n===this.query&&r===this.fragment?this:new B9(e,t,o,n,r)}static parse(i,e=!1){let t=iFo.exec(i);return t?new B9(t[2]||wg,qht(t[4]||wg),qht(t[5]||wg),qht(t[7]||wg),qht(t[9]||wg),e):new B9(wg,wg,wg,wg,wg)}static file(i){let e=wg;if(ei&&(i=i.replace(/\\/g,pV)),i[0]===pV&&i[1]===pV){let t=i.indexOf(pV,2);t===-1?(e=i.substring(2),i=pV):(e=i.substring(2,t),i=i.substring(t)||pV)}return new B9("file",e,i,wg,wg)}static from(i,e){return new B9(i.scheme,i.authority,i.path,i.query,i.fragment,e)}static joinPath(i,...e){if(!i.path)throw new Error("[UriError]: cannot call joinPath on URI without path");let t;return ei&&i.scheme==="file"?t=a.file($s.join(Xse(i,!0),...e)).path:t=Oo.join(i.path,...e),i.with({path:t})}toString(i=!1){return $Xt(this,i)}toJSON(){return this}static revive(i){if(i){if(i instanceof a)return i;{let e=new B9(i);return e._formatted=i.external??null,e._fsPath=i._sep===KGi?i.fsPath??null:null,e}}else return i}[Symbol.for("debug.description")](){return`URI(${this.toString()})`}};function km(a){return!a||typeof a!="object"?!1:typeof a.scheme=="string"&&(typeof a.authority=="string"||typeof a.authority>"u")&&(typeof a.path=="string"||typeof a.path>"u")&&(typeof a.query=="string"||typeof a.query>"u")&&(typeof a.fragment=="string"||typeof a.fragment>"u")}var KGi=ei?1:void 0,B9=class extends A{constructor(){super(...arguments);this._formatted=null;this._fsPath=null}get fsPath(){return this._fsPath||(this._fsPath=Xse(this,!1)),this._fsPath}toString(e=!1){return e?$Xt(this,!0):(this._formatted||(this._formatted=$Xt(this,!1)),this._formatted)}toJSON(){let e={$mid:1};return this._fsPath&&(e.fsPath=this._fsPath,e._sep=KGi),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}},GGi={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 UGi(a,i,e){let t,o=-1;for(let n=0;n<a.length;n++){let r=a.charCodeAt(n);if(r>=97&&r<=122||r>=65&&r<=90||r>=48&&r<=57||r===45||r===46||r===95||r===126||i&&r===47||e&&r===91||e&&r===93||e&&r===58)o!==-1&&(t+=encodeURIComponent(a.substring(o,n)),o=-1),t!==void 0&&(t+=a.charAt(n));else{t===void 0&&(t=a.substr(0,n));let s=GGi[r];s!==void 0?(o!==-1&&(t+=encodeURIComponent(a.substring(o,n)),o=-1),t+=s):o===-1&&(o=n)}}return o!==-1&&(t+=encodeURIComponent(a.substring(o))),t!==void 0?t:a}function oFo(a){let i;for(let e=0;e<a.length;e++){let t=a.charCodeAt(e);t===35||t===63?(i===void 0&&(i=a.substr(0,e)),i+=GGi[t]):i!==void 0&&(i+=a[e])}return i!==void 0?i:a}function Xse(a,i){let e;return a.authority&&a.path.length>1&&a.scheme==="file"?e=`//${a.authority}${a.path}`:a.path.charCodeAt(0)===47&&(a.path.charCodeAt(1)>=65&&a.path.charCodeAt(1)<=90||a.path.charCodeAt(1)>=97&&a.path.charCodeAt(1)<=122)&&a.path.charCodeAt(2)===58?i?e=a.path.substr(1):e=a.path[1].toLowerCase()+a.path.substr(2):e=a.path,ei&&(e=e.replace(/\//g,"\\")),e}function $Xt(a,i){let e=i?oFo:UGi,t="",{scheme:o,authority:n,path:r,query:s,fragment:l}=a;if(o&&(t+=o,t+=":"),(n||o==="file")&&(t+=pV,t+=pV),n){let c=n.indexOf("@");if(c!==-1){let u=n.substr(0,c);n=n.substr(c+1),c=u.lastIndexOf(":"),c===-1?t+=e(u,!1,!1):(t+=e(u.substr(0,c),!1,!1),t+=":",t+=e(u.substr(c+1),!1,!0)),t+="@"}n=n.toLowerCase(),c=n.lastIndexOf(":"),c===-1?t+=e(n,!1,!0):(t+=e(n.substr(0,c),!1,!0),t+=n.substr(c))}if(r){if(r.length>=3&&r.charCodeAt(0)===47&&r.charCodeAt(2)===58){let c=r.charCodeAt(1);c>=65&&c<=90&&(r=`/${String.fromCharCode(c+32)}:${r.substr(3)}`)}else if(r.length>=2&&r.charCodeAt(1)===58){let c=r.charCodeAt(0);c>=65&&c<=90&&(r=`${String.fromCharCode(c+32)}:${r.substr(2)}`)}t+=e(r,!0,!1)}return s&&(t+="?",t+=e(s,!1,!1)),l&&(t+="#",t+=i?l:UGi(l,!1,!1)),t}function qGi(a){try{return decodeURIComponent(a)}catch{return a.length>3?a.substr(0,3)+qGi(a.substr(3)):a}}var zGi=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function qht(a){return a.match(zGi)?a.replace(zGi,i=>qGi(i)):a}var Q;(yo=>(yo.inMemory="inmemory",yo.vscode="vscode",yo.internal="private",yo.walkThrough="walkThrough",yo.walkThroughSnippet="walkThroughSnippet",yo.http="http",yo.https="https",yo.file="file",yo.mailto="mailto",yo.untitled="untitled",yo.data="data",yo.command="command",yo.vscodeRemote="vscode-remote",yo.vscodeRemoteResource="vscode-remote-resource",yo.vscodeManagedRemoteResource="vscode-managed-remote-resource",yo.vscodeUserData="vscode-userdata",yo.vscodeCustomEditor="vscode-custom-editor",yo.vscodeNotebookCell="vscode-notebook-cell",yo.vscodeNotebookCellMetadata="vscode-notebook-cell-metadata",yo.vscodeNotebookCellMetadataDiff="vscode-notebook-cell-metadata-diff",yo.vscodeNotebookCellOutput="vscode-notebook-cell-output",yo.vscodeNotebookCellOutputDiff="vscode-notebook-cell-output-diff",yo.vscodeNotebookMetadata="vscode-notebook-metadata",yo.vscodeInteractiveInput="vscode-interactive-input",yo.vscodeSettings="vscode-settings",yo.vscodeWorkspaceTrust="vscode-workspace-trust",yo.vscodeTerminal="vscode-terminal",yo.vscodeImageCarousel="vscode-image-carousel",yo.vscodeChatCodeBlock="vscode-chat-code-block",yo.vscodeChatCodeCompareBlock="vscode-chat-code-compare-block",yo.vscodeChatEditor="vscode-chat-editor",yo.vscodeChatInput="chatSessionInput",yo.vscodeLocalChatSession="vscode-chat-session",yo.webviewPanel="webview-panel",yo.vscodeWebview="vscode-webview",yo.vscodeBrowser="vscode-browser",yo.extension="extension",yo.vscodeFileResource="vscode-file",yo.tmp="tmp",yo.vsls="vsls",yo.vscodeSourceControl="vscode-scm",yo.commentsInput="comment",yo.codeSetting="code-setting",yo.outputChannel="output",yo.accessibleView="accessible-view",yo.chatEditingSnapshotScheme="chat-editing-snapshot-text-model",yo.chatEditingModel="chat-editing-text-model",yo.copilotPr="copilot-pr"))(Q||={});function ec(a,i){return A.isUri(a)?vr(a.scheme,i):mE(a,i+":")}function mV(a,...i){return i.some(e=>ec(a,e))}var nFo="tkn",jXt=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(i){this._preferredWebSchema=i}setDelegate(i){this._delegate=i}setServerRootPath(i,e){this._serverRootPath=Oo.join(e??"/",rFo(i))}getServerRootPath(){return this._serverRootPath}get _remoteResourcesPath(){return Oo.join(this._serverRootPath,Q.vscodeRemoteResource)}set(i,e,t){this._hosts[i]=e,this._ports[i]=t}setConnectionToken(i,e){this._connectionTokens[i]=e}getPreferredWebSchema(){return this._preferredWebSchema}rewrite(i){if(this._delegate)try{return this._delegate(i)}catch(s){return mt(s),i}let e=i.authority,t=this._hosts[e];t&&t.indexOf(":")!==-1&&t.indexOf("[")===-1&&(t=`[${t}]`);let o=this._ports[e],n=this._connectionTokens[e],r=`path=${encodeURIComponent(i.path)}`;return typeof n=="string"&&(r+=`&${nFo}=${encodeURIComponent(n)}`),A.from({scheme:Wt?this._preferredWebSchema:Q.vscodeRemoteResource,authority:`${t}:${o}`,path:this._remoteResourcesPath,query:r})}},RL=new jXt;function rFo(a){return`${a.quality??"oss"}-${a.commit??"dev"}`}var $Gi="vs/../../extensions",tO="vs/../../node_modules",H9="vs/../../node_modules.asar",$ht="vs/../../node_modules.asar.unpacked",YXt="vscode-app",QXt=class a{static{this.FALLBACK_AUTHORITY=YXt}asBrowserUri(i){let e=this.toUri(i);return this.uriToBrowserUri(e)}uriToBrowserUri(i){return i.scheme===Q.vscodeRemote?RL.rewrite(i):i.scheme===Q.file&&(Vr||X2i===`${Q.vscodeFileResource}://${a.FALLBACK_AUTHORITY}`)?i.with({scheme:Q.vscodeFileResource,authority:i.authority||a.FALLBACK_AUTHORITY,query:null,fragment:null}):i}asFileUri(i){let e=this.toUri(i);return this.uriToFileUri(e)}uriToFileUri(i){return i.scheme===Q.vscodeFileResource?i.with({scheme:Q.file,authority:i.authority!==a.FALLBACK_AUTHORITY?i.authority:null,query:null,fragment:null}):i}toUri(i){if(A.isUri(i))return i;if(globalThis._VSCODE_FILE_ROOT){let e=globalThis._VSCODE_FILE_ROOT;if(/^\w[\w\d+.-]*:\/\//.test(e))return A.joinPath(A.parse(e,!0),i);let t=Yc(e,i);return A.file(t)}throw new Error("Cannot determine URI for module id!")}},vn=new QXt,rxn=Object.freeze({"Cache-Control":"no-cache, no-store"}),sxn=Object.freeze({"Document-Policy":"include-js-call-stacks-in-crash-reports"}),Jse;(n=>{let a=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"}]]);n.CoopAndCoep=Object.freeze(a.get("3"));let e="vscode-coi";function t(r){let s;typeof r=="string"?s=new URL(r).searchParams:r instanceof URL?s=r.searchParams:A.isUri(r)&&(s=new URL(r.toString(!0)).searchParams);let l=s?.get(e);if(l)return a.get(l)}n.getHeadersFromQuery=t;function o(r,s,l){if(!globalThis.crossOriginIsolated)return;let c=s&&l?"3":l?"2":"1";r instanceof URLSearchParams?r.set(e,c):r[e]=c}n.addSearchParam=o})(Jse||={});function hV(a){return Xse(a,!0)}var Zse=class{constructor(i){this._ignorePathCasing=i}compare(i,e,t=!1){return i===e?0:Hl(this.getComparisonKey(i,t),this.getComparisonKey(e,t))}isEqual(i,e,t=!1){return i===e?!0:!i||!e?!1:this.getComparisonKey(i,t)===this.getComparisonKey(e,t)}getComparisonKey(i,e=!1){return i.with({path:this._ignorePathCasing(i)?i.path.toLowerCase():void 0,fragment:e?null:void 0}).toString()}ignorePathCasing(i){return this._ignorePathCasing(i)}isEqualOrParent(i,e,t=!1){if(i.scheme===e.scheme){if(i.scheme===Q.file)return Yse(hV(i),hV(e),this._ignorePathCasing(i))&&i.query===e.query&&(t||i.fragment===e.fragment);if(gV(i.authority,e.authority))return Yse(i.path,e.path,this._ignorePathCasing(i),"/")&&i.query===e.query&&(t||i.fragment===e.fragment)}return!1}joinPath(i,...e){return A.joinPath(i,...e)}basenameOrAuthority(i){return He(i)||i.authority}basename(i,e){return Oo.basename(i.path,e)}extname(i){return Oo.extname(i.path)}dirname(i){if(i.path.length===0)return i;let e;return i.scheme===Q.file?e=A.file(ad(hV(i))).path:(e=Oo.dirname(i.path),i.authority&&e.length&&e.charCodeAt(0)!==47&&(console.error(`dirname("${i.toString})) resulted in a relative path`),e="/")),i.with({path:e})}normalizePath(i){if(!i.path.length)return i;let e;return i.scheme===Q.file?e=A.file(ch(hV(i))).path:e=Oo.normalize(i.path),i.with({path:e})}relativePath(i,e){if(i.scheme!==e.scheme||!gV(i.authority,e.authority))return;if(i.scheme===Q.file){let n=dP(hV(i),hV(e));return ei?f1(n):n}let t=i.path||"/",o=e.path||"/";if(this._ignorePathCasing(i)){let n=0;for(let r=Math.min(t.length,o.length);n<r&&!(t.charCodeAt(n)!==o.charCodeAt(n)&&t.charAt(n).toLowerCase()!==o.charAt(n).toLowerCase());n++);t=o.substr(0,n)+t.substr(n)}return Oo.relative(t,o)}resolvePath(i,e){if(i.scheme===Q.file){let t=A.file(cP(hV(i),e));return i.with({authority:t.authority,path:t.path})}return e=NGi(e),i.with({path:Oo.resolve(i.path,e)})}isAbsolutePath(i){return!!i.path&&i.path[0]==="/"}isEqualAuthority(i,e){return i===e||i!==void 0&&e!==void 0&&vr(i,e)}hasTrailingPathSeparator(i,e=Qd){if(i.scheme===Q.file){let t=hV(i);return t.length>qXt(t).length&&t[t.length-1]===e}else{let t=i.path;return t.length>1&&t.charCodeAt(t.length-1)===47&&!/^[a-zA-Z]:(\/$|\\$)/.test(i.fsPath)}}removeTrailingPathSeparator(i,e=Qd){return eae(i,e)?i.with({path:i.path.substr(0,i.path.length-1)}):i}addTrailingPathSeparator(i,e=Qd){let t=!1;if(i.scheme===Q.file){let o=hV(i);t=o!==void 0&&o.length===qXt(o).length&&o[o.length-1]===e}else{e="/";let o=i.path;t=o.length===1&&o.charCodeAt(o.length-1)===47}return!t&&!eae(i,e)?i.with({path:i.path+"/"}):i}},ar=new Zse(()=>!1),tae=new Zse(a=>a.scheme===Q.file?!fn:!0),Ax=new Zse(a=>!0),Qe=ar.isEqual.bind(ar),ws=ar.isEqualOrParent.bind(ar),pxn=ar.getComparisonKey.bind(ar),Ga=ar.basenameOrAuthority.bind(ar),He=ar.basename.bind(ar),es=ar.extname.bind(ar),ci=ar.dirname.bind(ar),Ge=ar.joinPath.bind(ar),F$=ar.normalizePath.bind(ar),Wd=ar.relativePath.bind(ar),JXt=ar.resolvePath.bind(ar),jht=ar.isAbsolutePath.bind(ar),gV=ar.isEqualAuthority.bind(ar),eae=ar.hasTrailingPathSeparator.bind(ar),iae=ar.removeTrailingPathSeparator.bind(ar),W$=ar.addTrailingPathSeparator.bind(ar);function y$e(a,i){let e=[];for(let t=0;t<a.length;t++){let o=i(a[t]);a.some((n,r)=>r===t?!1:ws(o,i(n)))||e.push(a[t])}return e}var V$;(n=>{n.META_DATA_LABEL="label",n.META_DATA_DESCRIPTION="description",n.META_DATA_SIZE="size",n.META_DATA_MIME="mime";function o(r){let s=new Map;r.path.substring(r.path.indexOf(";")+1,r.path.lastIndexOf(";")).split(";").forEach(u=>{let[p,h]=u.split(":");p&&h&&s.set(p,h)});let c=r.path.substring(0,r.path.indexOf(";"));return c&&s.set(n.META_DATA_MIME,c),s}n.parseMetaData=o})(V$||={});function of(a,i,e){if(i){let t=a.path;return t&&t[0]!==Oo.sep&&(t=Oo.sep+t),a.with({scheme:e,authority:i,path:t})}return a.with({scheme:e})}var ML=Symbol("MicrotaskDelay");function f_(a){return!!a&&typeof a.then=="function"}function Ln(a){let i=new Ye,e=a(i.token),t=!1,o=new Promise((n,r)=>{let s=i.token.onCancellationRequested(()=>{t=!0,s.dispose(),r(new go)});Promise.resolve(e).then(l=>{s.dispose(),i.dispose(),t?jc(l)&&l.dispose():n(l)},l=>{s.dispose(),i.dispose(),r(l)})});return new class{cancel(){i.cancel(),i.dispose()}then(n,r){return o.then(n,r)}catch(n){return this.then(void 0,n)}finally(n){return o.finally(n)}}}function Va(a,i,e){return new Promise((t,o)=>{let n=i.onCancellationRequested(()=>{n.dispose(),t(e)});a.then(t,o).finally(()=>n.dispose())})}function Wp(a,i){return new Promise((e,t)=>{let o=i.onCancellationRequested(()=>{o.dispose(),t(new go)});a.then(e,t).finally(()=>o.dispose())})}function jGi(a){return new Promise((i,e)=>{a.then(i,e)})}function oae(a){let i=-1,e=a.map((o,n)=>o.then(r=>(i=n,r))),t=Promise.race(e);return t.cancel=()=>{a.forEach((o,n)=>{n!==i&&o.cancel&&o.cancel()})},t.finally(()=>{t.cancel()}),t}function vp(a,i,e){let t,o=setTimeout(()=>{t?.(void 0),e?.()},i);return Promise.race([a.finally(()=>clearTimeout(o)),new Promise(n=>t=n)])}function WI(){let a,i;return{promise:new Promise((t,o)=>{a=t,i=o}),resolve:a,reject:i}}var gu=class{constructor(){this.activePromise=null,this.queuedPromise=null,this.queuedPromiseFactory=null,this.cancellationTokenSource=new Ye}queue(i){if(this.cancellationTokenSource.token.isCancellationRequested)return Promise.reject(new Error("Throttler is disposed"));if(this.activePromise){if(this.queuedPromiseFactory=i,!this.queuedPromise){let e=()=>{if(this.queuedPromise=null,this.cancellationTokenSource.token.isCancellationRequested)return;let t=this.queue(this.queuedPromiseFactory);return this.queuedPromiseFactory=null,t};this.queuedPromise=new Promise(t=>{this.activePromise.then(e,e).then(t)})}return new Promise((e,t)=>{this.queuedPromise.then(e,t)})}return this.activePromise=i(this.cancellationTokenSource.token),new Promise((e,t)=>{this.activePromise.then(o=>{this.activePromise=null,e(o)},o=>{this.activePromise=null,t(o)})})}dispose(){this.cancellationTokenSource.cancel()}},rm=class{constructor(){this.current=Promise.resolve(null)}queue(i){return this.current=this.current.then(()=>i(),()=>i())}},Nx=class{constructor(){this.promiseMap=new Map}queue(i,e){let o=(this.promiseMap.get(i)??Promise.resolve()).catch(()=>{}).then(e).finally(()=>{this.promiseMap.get(i)===o&&this.promiseMap.delete(i)});return this.promiseMap.set(i,o),o}peek(i){return this.promiseMap.get(i)||void 0}keys(){return this.promiseMap.keys()}},sFo=(a,i)=>{let e=!0,t=setTimeout(()=>{e=!1,i()},a);return{isTriggered:()=>e,dispose:()=>{clearTimeout(t),e=!1}}},aFo=a=>{let i=!0;return queueMicrotask(()=>{i&&(i=!1,a())}),{isTriggered:()=>i,dispose:()=>{i=!1}}},Xo=class{constructor(i){this.defaultDelay=i;this.deferred=null,this.completionPromise=null,this.doResolve=null,this.doReject=null,this.task=null}trigger(i,e=this.defaultDelay){this.task=i,this.cancelTimeout(),this.completionPromise||(this.completionPromise=new Promise((o,n)=>{this.doResolve=o,this.doReject=n}).then(()=>{if(this.completionPromise=null,this.doResolve=null,this.task){let o=this.task;return this.task=null,o()}}));let t=()=>{this.deferred=null,this.doResolve?.(null)};return this.deferred=e===ML?aFo(t):sFo(e,t),this.completionPromise}isTriggered(){return!!this.deferred?.isTriggered()}cancel(){this.cancelTimeout(),this.completionPromise&&(this.doReject?.(new go),this.completionPromise=null)}cancelTimeout(){this.deferred?.dispose(),this.deferred=null}dispose(){this.cancel()}},ya=class{constructor(i){this.delayer=new Xo(i),this.throttler=new gu}trigger(i,e){return this.delayer.trigger(()=>this.throttler.queue(i),e)}isTriggered(){return this.delayer.isTriggered()}cancel(){this.delayer.cancel()}dispose(){this.delayer.dispose(),this.throttler.dispose()}},gp=class{constructor(){this._isOpen=!1,this._promise=new Promise((i,e)=>{this._completePromise=i})}isOpen(){return this._isOpen}open(){this._isOpen=!0,this._completePromise(!0)}wait(){return this._promise}},B$=class extends gp{constructor(i){super(),this._timeout=setTimeout(()=>this.open(),i)}open(){clearTimeout(this._timeout),super.open()}};function Li(a,i){return i?new Promise((e,t)=>{let o=setTimeout(()=>{n.dispose(),e()},a),n=i.onCancellationRequested(()=>{clearTimeout(o),n.dispose(),t(new go)})}):Ln(e=>Li(a,e))}function tn(a,i=0,e){let t=setTimeout(()=>{a(),e&&o.dispose()},i),o=Z(()=>{clearTimeout(t),e?.delete(o)});return e?.add(o),o}function Zht(a){let i=[],e=0,t=a.length;function o(){return e<t?a[e++]():null}function n(r){r!=null&&i.push(r);let s=o();return s?s.then(n):Promise.resolve(i)}return Promise.resolve(null).then(n)}function nae(a,i=t=>!!t,e=null){let t=0,o=a.length,n=()=>{if(t>=o)return Promise.resolve(e);let r=a[t++];return Promise.resolve(r()).then(l=>i(l)?Promise.resolve(l):n())};return n()}var g_=class{constructor(i){this._size=0;this._isDisposed=!1;this.maxDegreeOfParalellism=i,this.outstandingPromises=[],this.runningPromises=0,this._onDrained=new E}whenIdle(){return this.size>0?U.toPromise(this.onDrained):Promise.resolve()}get onDrained(){return this._onDrained.event}get size(){return this._size}queue(i){if(this._isDisposed)throw new Error("Object has been disposed");return this._size++,new Promise((e,t)=>{this.outstandingPromises.push({factory:i,c:e,e:t}),this.consume()})}consume(){for(;this.outstandingPromises.length&&this.runningPromises<this.maxDegreeOfParalellism;){let i=this.outstandingPromises.shift();this.runningPromises++;let e=i.factory();e.then(i.c,i.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()}},uh=class extends g_{constructor(){super(1)}};var b1=class{constructor(){this.queues=new Map;this.drainers=new Set;this.drainListeners=void 0;this.drainListenerCount=0}async whenDrained(){if(this.isDrained())return;let i=new Ko;return this.drainers.add(i),i.p}isDrained(){for(let[,i]of this.queues)if(i.size>0)return!1;return!0}queueSize(i,e=ar){let t=e.getComparisonKey(i);return this.queues.get(t)?.size??0}queueFor(i,e,t=ar){let o=t.getComparisonKey(i),n=this.queues.get(o);if(!n){n=new uh;let r=this.drainListenerCount++,s=U.once(n.onDrained)(()=>{n?.dispose(),this.queues.delete(o),this.onDidQueueDrain(),this.drainListeners?.deleteAndDispose(r),this.drainListeners?.size===0&&(this.drainListeners.dispose(),this.drainListeners=void 0)});this.drainListeners||(this.drainListeners=new Vt),this.drainListeners.set(r,s),this.queues.set(o,n)}return n.queue(e)}onDidQueueDrain(){this.isDrained()&&this.releaseDrainers()}releaseDrainers(){for(let i of this.drainers)i.complete();this.drainers.clear()}dispose(){for(let[,i]of this.queues)i.dispose();this.queues.clear(),this.releaseDrainers(),this.drainListeners?.dispose()}},vIe=class{constructor(){this._runningTask=void 0;this._pendingTasks=[]}schedule(i){let e=new Ko;return this._pendingTasks.push({task:i,deferred:e,setUndefinedWhenCleared:!1}),this._runIfNotRunning(),e.p}scheduleSkipIfCleared(i){let e=new Ko;return this._pendingTasks.push({task:i,deferred:e,setUndefinedWhenCleared:!0}),this._runIfNotRunning(),e.p}_runIfNotRunning(){this._runningTask===void 0&&this._processQueue()}async _processQueue(){if(this._pendingTasks.length===0)return;let i=this._pendingTasks.shift();if(i){if(this._runningTask)throw new li;this._runningTask=i.task;try{let e=await i.task();i.deferred.complete(e)}catch(e){i.deferred.error(e)}finally{this._runningTask=void 0,this._processQueue()}}}clearPending(){let i=this._pendingTasks;this._pendingTasks=[];for(let e of i)e.setUndefinedWhenCleared?e.deferred.complete(void 0):e.deferred.error(new go)}},Ul=class{constructor(i,e){this._isDisposed=!1;this._token=void 0,typeof i=="function"&&typeof e=="number"&&this.setIfNotSet(i,e)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==void 0&&(clearTimeout(this._token),this._token=void 0)}cancelAndSet(i,e){if(this._isDisposed)throw new li("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=void 0,i()},e)}setIfNotSet(i,e){if(this._isDisposed)throw new li("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===void 0&&(this._token=setTimeout(()=>{this._token=void 0,i()},e))}},FI=class{constructor(){this.disposable=void 0;this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(i,e,t=globalThis){if(this.isDisposed)throw new li("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let o=t.setInterval(()=>{i()},e);this.disposable=Z(()=>{t.clearInterval(o),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},Dt=class{constructor(i,e){this.timeoutToken=void 0,this.runner=i,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(i=this.timeout){this.cancel(),this.timeoutToken=setTimeout(this.timeoutHandler,i)}get delay(){return this.timeout}set delay(i){this.timeout=i}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?.()}};var pP=class extends Dt{constructor(e,t){super(e,t);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()}};var PL,fIe;(function(){let a=globalThis;typeof a.requestIdleCallback!="function"||typeof a.cancelIdleCallback!="function"?fIe=(i,e,t)=>{pC(()=>{if(o)return;let n=Date.now()+15;e(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,n-Date.now())}}))});let o=!1;return{dispose(){o||(o=!0)}}}:fIe=(i,e,t)=>{let o=i.requestIdleCallback(e,typeof t=="number"?{timeout:t}:void 0),n=!1;return{dispose(){n||(n=!0,i.cancelIdleCallback(o))}}},PL=(i,e)=>fIe(globalThis,i,e)})();var w$e=class{constructor(i,e){this._didRun=!1;this._executor=()=>{try{this._value=e()}catch(t){this._error=t}finally{this._didRun=!0}},this._handle=fIe(i,()=>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}},H$=class extends w$e{constructor(i){super(globalThis,i)}};async function QGi(a,i,e){let t;for(let o=0;o<e;o++)try{return await a()}catch(n){t=n,await Li(i)}throw t}var bIe=class{isRunning(i){return typeof i=="number"?this._running?.taskId===i:!!this._running}get running(){return this._running?.promise}cancelRunning(){this._running?.cancel()}run(i,e,t){return this._running={taskId:i,cancel:()=>t?.(),promise:e},e.then(()=>this.doneRunning(i),()=>this.doneRunning(i)),e}doneRunning(i){this._running&&i===this._running.taskId&&(this._running=void 0,this.runQueued())}runQueued(){if(this._queued){let i=this._queued;this._queued=void 0,i.run().then(i.promiseResolve,i.promiseReject)}}queue(i){if(this._queued)this._queued.run=i;else{let{promise:e,resolve:t,reject:o}=WI();this._queued={run:i,promise:e,promiseResolve:t,promiseReject:o}}return this._queued.promise}hasQueued(){return!!this._queued}async join(){return this._queued?.promise??this._running?.promise}},Qht=class{constructor(i,e=()=>Date.now()){this.interval=i;this.nowFn=e;this.lastIncrementTime=0;this.value=0}increment(){let i=this.nowFn();return i-this.lastIncrementTime>this.interval&&(this.lastIncrementTime=i,this.value=0),this.value++,this.value}};var Ko=class a{static fromPromise(i){let e=new a;return e.settleWith(i),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((i,e)=>{this.completeCallback=i,this.errorCallback=e})}complete(i){return this.isSettled?Promise.resolve():new Promise(e=>{this.completeCallback(i),this.outcome={outcome:0,value:i},e()})}error(i){return this.isSettled?Promise.resolve():new Promise(e=>{this.errorCallback(i),this.outcome={outcome:1,value:i},e()})}settleWith(i){return i.then(e=>this.complete(e),e=>this.error(e))}cancel(){return this.error(new go)}},dn;(e=>{async function a(t){let o,n=await Promise.all(t.map(r=>r.then(s=>s,s=>{o||(o=s)})));if(typeof o<"u")throw o;return n}e.settled=a;function i(t){return new Promise(async(o,n)=>{try{await t(o,n)}catch(r){n(r)}})}e.withAsyncBody=i})(dn||={});var ZXt=class{constructor(i){this._value=void 0;this._error=void 0;this._isResolved=!1;this.promise=i.then(e=>(this._value=e,this._isResolved=!0,e),e=>{throw this._error=e,this._isResolved=!0,e})}get value(){return this._value}get error(){return this._error}get isResolved(){return this._isResolved}requireValue(){if(!this._isResolved)throw new li("Promise is not resolved yet");if(this._error)throw this._error;return this._value}},Yht=class{constructor(i){this._compute=i;this._promise=new co(()=>new ZXt(this._compute()))}requireValue(){return this._promise.value.requireValue()}getPromise(){return this._promise.value.promise}get currentValue(){return this._promise.rawValue?.value}};var eJt=class a{static fromArray(i){return new a(e=>{e.emitMany(i)})}static fromPromise(i){return new a(async e=>{e.emitMany(await i)})}static fromPromisesResolveOrder(i){return new a(async e=>{await Promise.all(i.map(async t=>e.emitOne(await t)))})}static merge(i){return new a(async e=>{await Promise.all(i.map(async t=>{for await(let o of t)e.emitOne(o)}))})}static{this.EMPTY=a.fromArray([])}constructor(i,e){this._state=0,this._results=[],this._error=null,this._onReturn=e,this._onStateChanged=new E,queueMicrotask(async()=>{let t={emitOne:o=>this.emitOne(o),emitMany:o=>this.emitMany(o),reject:o=>this.reject(o)};try{await Promise.resolve(i(t)),this.resolve()}catch(o){this.reject(o)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let i=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(i<this._results.length)return{done:!1,value:this._results[i++]};if(this._state===1)return{done:!0,value:void 0};await U.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(i,e){return new a(async t=>{for await(let o of i)t.emitOne(e(o))})}map(i){return a.map(this,i)}static filter(i,e){return new a(async t=>{for await(let o of i)e(o)&&t.emitOne(o)})}filter(i){return a.filter(this,i)}static coalesce(i){return a.filter(i,e=>!!e)}coalesce(){return a.coalesce(this)}static async toPromise(i){let e=[];for await(let t of i)e.push(t);return e}toPromise(){return a.toPromise(this)}emitOne(i){this._state===0&&(this._results.push(i),this._onStateChanged.fire())}emitMany(i){this._state===0&&(this._results=this._results.concat(i),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(i){this._state===0&&(this._state=2,this._error=i,this._onStateChanged.fire())}};function YGi(a){let i=new Ye,e=a(i.token);return new iJt(i,async t=>{let o=i.token.onCancellationRequested(()=>{o.dispose(),i.dispose(),t.reject(new go)});try{for await(let n of e){if(i.token.isCancellationRequested)return;t.emitOne(n)}o.dispose(),i.dispose()}catch(n){o.dispose(),i.dispose(),t.reject(n)}})}var Xht=class{constructor(i){this._deferred=new Ko;this._asyncIterable=new eJt(o=>{if(e){o.reject(e);return}return t&&o.emitMany(t),this._errorFn=n=>o.reject(n),this._emitOneFn=n=>o.emitOne(n),this._emitManyFn=n=>o.emitMany(n),this._deferred.p},i);let e,t;this._errorFn=o=>{e||(e=o)},this._emitOneFn=o=>{t||(t=[]),t.push(o)},this._emitManyFn=o=>{t?o.forEach(n=>t.push(n)):t=o.slice()}}get asyncIterable(){return this._asyncIterable}resolve(){this._deferred.complete()}reject(i){this._errorFn(i),this._deferred.complete()}emitOne(i){this._emitOneFn(i)}emitMany(i){this._emitManyFn(i)}};var tJt=class{constructor(){this._unsatisfiedConsumers=[];this._unconsumedValues=[]}get hasFinalValue(){return!!this._finalValue}produce(i){if(this._ensureNoFinalValue(),this._unsatisfiedConsumers.length>0){let e=this._unsatisfiedConsumers.shift();this._resolveOrRejectDeferred(e,i)}else this._unconsumedValues.push(i)}produceFinal(i){this._ensureNoFinalValue(),this._finalValue=i;for(let e of this._unsatisfiedConsumers)this._resolveOrRejectDeferred(e,i);this._unsatisfiedConsumers.length=0}_ensureNoFinalValue(){if(this._finalValue)throw new li("ProducerConsumer: cannot produce after final value has been set")}_resolveOrRejectDeferred(i,e){e.ok?i.complete(e.value):i.error(e.error)}consume(){if(this._unconsumedValues.length>0||this._finalValue){let i=this._unconsumedValues.length>0?this._unconsumedValues.shift():this._finalValue;return i.ok?Promise.resolve(i.value):Promise.reject(i.error)}else{let i=new Ko;return this._unsatisfiedConsumers.push(i),i.p}}},fp=class a{constructor(i,e){this._onReturn=e;this._producerConsumer=new tJt;this._iterator={next:()=>this._producerConsumer.consume(),return:()=>(this._onReturn?.(),Promise.resolve({done:!0,value:void 0})),throw:async i=>(this._finishError(i),{done:!0,value:void 0})};queueMicrotask(async()=>{let t=i({emitOne:o=>this._producerConsumer.produce({ok:!0,value:{done:!1,value:o}}),emitMany:o=>{for(let n of o)this._producerConsumer.produce({ok:!0,value:{done:!1,value:n}})},reject:o=>this._finishError(o)});if(!this._producerConsumer.hasFinalValue)try{await t,this._finishOk()}catch(o){this._finishError(o)}})}static fromArray(i){return new a(e=>{e.emitMany(i)})}static fromPromise(i){return new a(async e=>{e.emitMany(await i)})}static fromPromisesResolveOrder(i){return new a(async e=>{await Promise.all(i.map(async t=>e.emitOne(await t)))})}static merge(i){return new a(async e=>{await Promise.all(i.map(async t=>{for await(let o of t)e.emitOne(o)}))})}static{this.EMPTY=a.fromArray([])}static map(i,e){return new a(async t=>{for await(let o of i)t.emitOne(e(o))})}static tee(i){let e,t,o=new Ko,n=async()=>{if(!(!e||!t))try{for await(let l of i)e.emitOne(l),t.emitOne(l)}catch(l){e.reject(l),t.reject(l)}finally{o.complete()}},r=new a(async l=>(e=l,n(),o.p)),s=new a(async l=>(t=l,n(),o.p));return[r,s]}map(i){return a.map(this,i)}static coalesce(i){return a.filter(i,e=>!!e)}coalesce(){return a.coalesce(this)}static filter(i,e){return new a(async t=>{for await(let o of i)e(o)&&t.emitOne(o)})}filter(i){return a.filter(this,i)}_finishOk(){this._producerConsumer.hasFinalValue||this._producerConsumer.produceFinal({ok:!0,value:{done:!0,value:void 0}})}_finishError(i){this._producerConsumer.hasFinalValue||this._producerConsumer.produceFinal({ok:!1,error:i})}[Symbol.asyncIterator](){return this._iterator}},iJt=class extends fp{constructor(e,t){super(t);this._source=e}cancel(){this._source.cancel()}},U9=Symbol("AsyncReaderEndOfStream"),Jht=class{constructor(i){this._source=i;this._buffer=[];this._atEnd=!1}get endOfStream(){return this._buffer.length===0&&this._atEnd}async read(){return this._buffer.length===0&&!this._atEnd&&await this._extendBuffer(),this._buffer.length===0?U9:this._buffer.shift()}async readWhile(i,e){do{let t=await this.peek();if(t===U9||!i(t))break;await this.read(),await e(t)}while(!0)}readBufferedOrThrow(){let i=this.peekBufferedOrThrow();return this._buffer.shift(),i}async consumeToEnd(){for(;!this.endOfStream;)await this.read()}async peek(){return this._buffer.length===0&&!this._atEnd&&await this._extendBuffer(),this._buffer.length===0?U9:this._buffer[0]}peekBufferedOrThrow(){if(this._buffer.length===0){if(this._atEnd)return U9;throw new li("No buffered elements")}return this._buffer[0]}async peekTimeout(i){if(this._buffer.length===0&&!this._atEnd&&await vp(this._extendBuffer(),i),this._atEnd)return U9;if(this._buffer.length!==0)return this._buffer[0]}_extendBuffer(){return this._atEnd?Promise.resolve():(this._extendBufferPromise||(this._extendBufferPromise=(async()=>{let{value:i,done:e}=await this._source.next();this._extendBufferPromise=void 0,e?this._atEnd=!0:this._buffer.push(i)})()),this._extendBufferPromise)}};function z9(a){let i=a;return i?[i.on,i.pause,i.resume,i.destroy].every(e=>typeof e=="function"):!1}function egt(a){let i=a;return i?z9(i.stream)&&Array.isArray(i.buffer)&&typeof i.ended=="boolean":!1}function VI(a,i){return new oJt(a,i)}var oJt=class{constructor(i,e){this.reducer=i;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(i){if(!this.state.destroyed){if(this.state.flowing)this.emitData(i);else if(this.buffer.data.push(i),typeof this.options?.highWaterMark=="number"&&this.buffer.data.length>this.options.highWaterMark)return new Promise(e=>this.pendingWritePromises.push(e))}}error(i){this.state.destroyed||(this.state.flowing?this.emitError(i):this.buffer.error.push(i))}end(i){this.state.destroyed||(typeof i<"u"&&this.write(i),this.state.flowing?(this.emitEnd(),this.destroy()):this.state.ended=!0)}emitData(i){this.listeners.data.slice(0).forEach(e=>e(i))}emitError(i){this.listeners.error.length===0?mt(i):this.listeners.error.slice(0).forEach(e=>e(i))}emitEnd(){this.listeners.end.slice(0).forEach(i=>i())}on(i,e){if(!this.state.destroyed)switch(i){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(i,e){if(this.state.destroyed)return;let t;switch(i){case"data":t=this.listeners.data;break;case"end":t=this.listeners.end;break;case"error":t=this.listeners.error;break}if(t){let o=t.indexOf(e);o>=0&&t.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 i=[...this.pendingWritePromises];this.pendingWritePromises.length=0,i.forEach(e=>e())}flowErrors(){if(this.listeners.error.length>0){for(let i of this.buffer.error)this.emitError(i);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 XGi(a,i){let e=[],t;for(;(t=a.read())!==null;)e.push(t);return i(e)}function JGi(a,i,e){let t=[],o;for(;(o=a.read())!==null&&t.length<e;)t.push(o);return o===null&&t.length>0?i(t):{read:()=>{if(t.length>0)return t.shift();if(typeof o<"u"){let n=o;return o=void 0,n}return a.read()}}}function K9(a,i){return new Promise((e,t)=>{let o=[];fV(a,{onData:n=>{i&&o.push(n)},onError:n=>{i?t(n):e(void 0)},onEnd:()=>{e(i?i(o):void 0)}})})}function fV(a,i,e){a.on("error",t=>{e?.isCancellationRequested||i.onError(t)}),a.on("end",()=>{e?.isCancellationRequested||i.onEnd()}),a.on("data",t=>{e?.isCancellationRequested||i.onData(t)})}function tgt(a,i){return new Promise((e,t)=>{let o=new N,n=[],r=c=>{if(n.push(c),n.length>i)return o.dispose(),a.pause(),e({stream:a,buffer:n,ended:!1})},s=c=>(o.dispose(),t(c)),l=()=>(o.dispose(),e({stream:a,buffer:n,ended:!0}));o.add(Z(()=>a.removeListener("error",s))),a.on("error",s),o.add(Z(()=>a.removeListener("end",l))),a.on("end",l),o.add(Z(()=>a.removeListener("data",r))),a.on("data",r)})}function ZGi(a,i){let e=VI(i);return e.end(a),e}function eqi(){let a=VI(()=>{throw new Error("not supported")});return a.end(),a}function tqi(a){let i=!1;return{read:()=>i?null:(i=!0,a)}}function nJt(a,i,e){let t=VI(e);return fV(a,{onData:o=>t.write(i.data(o)),onError:o=>t.error(i.error?i.error(o):o),onEnd:()=>t.end()}),t}function iqi(a,i,e){let t=!1;return{read:()=>{let o=i.read();return t?o:(t=!0,o!==null?e([a,o]):a)}}}function oqi(a,i,e){let t=!1,o=VI(e);return fV(i,{onData:n=>t?o.write(n):(t=!0,o.write(e([a,n]))),onError:n=>o.error(n),onEnd:()=>{t||(t=!0,o.write(a)),o.end()}}),o}var C$e=typeof Buffer<"u",dFo=new co(()=>new Uint8Array(256)),rJt,sJt,qe=class a{static alloc(i){return C$e?new a(Buffer.allocUnsafe(i)):new a(new Uint8Array(i))}static wrap(i){return C$e&&!Buffer.isBuffer(i)&&(i=Buffer.from(i.buffer,i.byteOffset,i.byteLength)),new a(i)}static fromString(i,e){return!(e?.dontUseNodeBuffer||!1)&&C$e?new a(Buffer.from(i)):(rJt||(rJt=new TextEncoder),new a(rJt.encode(i)))}static fromByteArray(i){let e=a.alloc(i.length);for(let t=0,o=i.length;t<o;t++)e.buffer[t]=i[t];return e}static concat(i,e){if(typeof e>"u"){e=0;for(let n=0,r=i.length;n<r;n++)e+=i[n].byteLength}let t=a.alloc(e),o=0;for(let n=0,r=i.length;n<r;n++){let s=i[n];t.set(s,o),o+=s.byteLength}return t}static isNativeBuffer(i){return C$e&&Buffer.isBuffer(i)}constructor(i){this.buffer=i,this.byteLength=this.buffer.byteLength}clone(){let i=a.alloc(this.byteLength);return i.set(this),i}toString(){return C$e?this.buffer.toString():(sJt||(sJt=new TextDecoder(void 0,{ignoreBOM:!0})),sJt.decode(this.buffer))}slice(i,e){return new a(this.buffer.subarray(i,e))}set(i,e){if(i instanceof a)this.buffer.set(i.buffer,e);else if(i instanceof Uint8Array)this.buffer.set(i,e);else if(i instanceof ArrayBuffer)this.buffer.set(new Uint8Array(i),e);else if(ArrayBuffer.isView(i))this.buffer.set(new Uint8Array(i.buffer,i.byteOffset,i.byteLength),e);else throw new Error("Unknown argument 'array'")}readUInt32BE(i){return BI(this.buffer,i)}writeUInt32BE(i,e){HI(this.buffer,i,e)}readUInt32LE(i){return pFo(this.buffer,i)}writeUInt32LE(i,e){mFo(this.buffer,i,e)}readUInt8(i){return igt(this.buffer,i)}writeUInt8(i,e){ogt(this.buffer,i,e)}indexOf(i,e=0){return uFo(this.buffer,i instanceof a?i.buffer:i,e)}equals(i){return this===i?!0:this.byteLength!==i.byteLength?!1:this.buffer.every((e,t)=>e===i.buffer[t])}};function uFo(a,i,e=0){let t=i.byteLength,o=a.byteLength;if(t===0)return 0;if(t===1)return a.indexOf(i[0],e);if(t>o-e)return-1;let n=dFo.value;n.fill(i.length);for(let c=0;c<i.length;c++)n[i[c]]=i.length-c-1;let r=e+i.length-1,s=r,l=-1;for(;r<o;)if(a[r]===i[s]){if(s===0){l=r;break}r--,s--}else r+=Math.max(i.length-s,n[a[r]]),s=i.length-1;return l}function sqi(a,i){return a[i+0]<<0>>>0|a[i+1]<<8>>>0}function aqi(a,i,e){a[e+0]=i&255,i=i>>>8,a[e+1]=i&255}function BI(a,i){return a[i]*2**24+a[i+1]*2**16+a[i+2]*2**8+a[i+3]}function HI(a,i,e){a[e+3]=i,i=i>>>8,a[e+2]=i,i=i>>>8,a[e+1]=i,i=i>>>8,a[e]=i}function pFo(a,i){return a[i+0]<<0>>>0|a[i+1]<<8>>>0|a[i+2]<<16>>>0|a[i+3]<<24>>>0}function mFo(a,i,e){a[e+0]=i&255,i=i>>>8,a[e+1]=i&255,i=i>>>8,a[e+2]=i&255,i=i>>>8,a[e+3]=i&255}function igt(a,i){return a[i]}function ogt(a,i,e){a[e]=i}function ngt(a){return XGi(a,i=>qe.concat(i))}function SIe(a){return tqi(a)}function tb(a){return K9(a,i=>qe.concat(i))}async function lqi(a){return a.ended?qe.concat(a.buffer):qe.concat([...a.buffer,await tb(a.stream)])}function v_(a){return ZGi(a,i=>qe.concat(i))}function IIe(a){return VI(i=>qe.concat(i),a)}function cqi(a,i){return iqi(a,i,e=>qe.concat(e))}function aJt(a,i){return oqi(a,i,e=>qe.concat(e))}function qa(a){let i=0,e=0,t=0,o=new Uint8Array(Math.floor(a.length/4*3)),n=s=>{switch(e){case 3:o[t++]=i|s,e=0;break;case 2:o[t++]=i|s>>>2,i=s<<6,e=3;break;case 1:o[t++]=i|s>>>4,i=s<<4,e=2;break;default:i=s<<2,e=1}};for(let s=0;s<a.length;s++){let l=a.charCodeAt(s);if(l>=65&&l<=90)n(l-65);else if(l>=97&&l<=122)n(l-97+26);else if(l>=48&&l<=57)n(l-48+52);else if(l===43||l===45)n(62);else if(l===47||l===95)n(63);else{if(l===61)break;throw new SyntaxError(`Unexpected base64 character ${a[s]}`)}}let r=t;for(;e>0;)n(0);return qe.wrap(o).slice(0,r)}var hFo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",gFo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";function Yd({buffer:a},i=!0,e=!1){let t=e?gFo:hFo,o="",n=a.byteLength%3,r=0;for(;r<a.byteLength-n;r+=3){let s=a[r+0],l=a[r+1],c=a[r+2];o+=t[s>>>2],o+=t[(s<<4|l>>>4)&63],o+=t[(l<<2|c>>>6)&63],o+=t[c&63]}if(n===1){let s=a[r+0];o+=t[s>>>2],o+=t[s<<4&63],i&&(o+="==")}else if(n===2){let s=a[r+0],l=a[r+1];o+=t[s>>>2],o+=t[(s<<4|l>>>4)&63],o+=t[l<<2&63],i&&(o+="=")}return o}var nqi="0123456789abcdef";function U$({buffer:a}){let i="";for(let e=0;e<a.length;e++){let t=a[e];i+=nqi[t>>>4],i+=nqi[t&15]}return i}function yIe(a){if(a.length%2!==0)throw new SyntaxError("Hex string must have an even length");let i=new Uint8Array(a.length>>1);for(let e=0;e<a.length;)i[e>>1]=rqi(a,e++)<<4|rqi(a,e++);return qe.wrap(i)}function rqi(a,i){let e=a.charCodeAt(i);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 ${i}`)}function _r(a){return x$e(a,0)}function x$e(a,i){switch(typeof a){case"object":return a===null?z$(349,i):Array.isArray(a)?vFo(a,i):bFo(a,i);case"string":return CIe(a,i);case"boolean":return fFo(a,i);case"number":return z$(a,i);case"undefined":return z$(937,i);default:return z$(617,i)}}function z$(a,i){return(i<<5)-i+a|0}function fFo(a,i){return z$(a?433:863,i)}function CIe(a,i){i=z$(149417,i);for(let e=0,t=a.length;e<t;e++)i=z$(a.charCodeAt(e),i);return i}function vFo(a,i){return i=z$(104579,i),a.reduce((e,t)=>x$e(t,e),i)}function bFo(a,i){return i=z$(181387,i),Object.keys(a).sort().reduce((e,t)=>(e=CIe(t,e),x$e(a[t],e)),i)}var vV=a=>{if(typeof a=="string"&&a.length<250){let e=new Yy;return e.update(a),Promise.resolve(e.digest())}let i;return typeof a=="string"?i=new TextEncoder().encode(a):a instanceof qe?i=a.buffer:i=a,crypto.subtle.digest("sha-1",i).then(wIe)};function cJt(a,i,e=32){let t=e-i,o=~((1<<t)-1);return(a<<i|(o&a)>>>t)>>>0}function wIe(a,i=32){return a instanceof ArrayBuffer?U$(qe.wrap(new Uint8Array(a))):(a>>>0).toString(16).padStart(i/4,"0")}var Yy=class a{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(i){let e=i.length;if(e===0)return;let t=this._buff,o=this._buffLen,n=this._leftoverHighSurrogate,r,s;for(n!==0?(r=n,s=-1,n=0):(r=i.charCodeAt(0),s=0);;){let l=r;if(ju(r))if(s+1<e){let c=i.charCodeAt(s+1);ZN(c)?(s++,l=Uht(r,c)):l=65533}else{n=r;break}else ZN(r)&&(l=65533);if(o=this._push(t,o,l),s++,s<e)r=i.charCodeAt(s);else break}this._buffLen=o,this._leftoverHighSurrogate=n}_push(i,e,t){return t<128?i[e++]=t:t<2048?(i[e++]=192|(t&1984)>>>6,i[e++]=128|(t&63)>>>0):t<65536?(i[e++]=224|(t&61440)>>>12,i[e++]=128|(t&4032)>>>6,i[e++]=128|(t&63)>>>0):(i[e++]=240|(t&1835008)>>>18,i[e++]=128|(t&258048)>>>12,i[e++]=128|(t&4032)>>>6,i[e++]=128|(t&63)>>>0),e>=64&&(this._step(),e-=64,this._totalLen+=64,i[0]=i[64],i[1]=i[65],i[2]=i[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()),wIe(this._h0)+wIe(this._h1)+wIe(this._h2)+wIe(this._h3)+wIe(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 i=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(i/4294967296),!1),this._buffDV.setUint32(60,i%4294967296,!1),this._step()}_step(){let i=a._bigBlock32,e=this._buffDV;for(let p=0;p<64;p+=4)i.setUint32(p,e.getUint32(p,!1),!1);for(let p=64;p<320;p+=4)i.setUint32(p,cJt(i.getUint32(p-12,!1)^i.getUint32(p-32,!1)^i.getUint32(p-56,!1)^i.getUint32(p-64,!1),1),!1);let t=this._h0,o=this._h1,n=this._h2,r=this._h3,s=this._h4,l,c,u;for(let p=0;p<80;p++)p<20?(l=o&n|~o&r,c=1518500249):p<40?(l=o^n^r,c=1859775393):p<60?(l=o&n|o&r|n&r,c=2400959708):(l=o^n^r,c=3395469782),u=cJt(t,5)+l+s+c+i.getUint32(p*4,!1)&4294967295,s=r,r=n,n=cJt(o,30),o=t,t=u;this._h0=this._h0+t&4294967295,this._h1=this._h1+o&4294967295,this._h2=this._h2+n&4294967295,this._h3=this._h3+r&4294967295,this._h4=this._h4+s&4294967295}};function Bn(a,i,e){return Math.min(Math.max(a,i),e)}function bV(a,i){return(i+a%i)%i}var k$e=class{constructor(){this._n=1;this._val=0}update(i){return this._val=this._val+(i-this._val)/this._n,this._n+=1,this._val}get value(){return this._val}},rgt=class{constructor(i){this._n=0;this._val=0;this._values=[];this._index=0;this._sum=0;this._values=new Array(i),this._values.fill(0,0,i)}update(i){let e=this._values[this._index];return this._values[this._index]=i,this._index=(this._index+1)%this._values.length,this._sum-=e,this._sum+=i,this._n<this._values.length&&(this._n+=1),this._val=this._sum/this._n,this._val}get value(){return this._val}};function dqi(a,i,e,t,o,n,r,s){let l=r-e,c=s-t,u=o-e,p=n-t,h=a-e,g=i-t,f=l*l+c*c,v=l*u+c*p,b=l*h+c*g,S=u*u+p*p,y=u*h+p*g,w=1/(f*S-v*v),k=(S*b-v*y)*w,T=(f*y-v*b)*w;return k>=0&&T>=0&&k+T<1}function uqi(a){return qy(a>=0&&a<=1,"p must be between 0 and 1"),Math.random()<a}var Qu=class{constructor(i,e,t){this.owner=i;this.debugNameSource=e;this.referenceFn=t}getDebugName(i){return uJt(i,this)}},pqi=new Map,dJt=new WeakMap;function uJt(a,i){let e=dJt.get(a);if(e)return e;let t=SFo(a,i);if(t){let o=pqi.get(t)??0;o++,pqi.set(t,o);let n=o===1?t:`${t}#${o}`;return dJt.set(a,n),n}}function SFo(a,i){let e=dJt.get(a);if(e)return e;let t=i.owner?yFo(i.owner)+".":"",o,n=i.debugNameSource;if(n!==void 0)if(typeof n=="function"){if(o=n(),o!==void 0)return t+o}else return t+n;let r=i.referenceFn;if(r!==void 0&&(o=E$e(r),o!==void 0))return t+o;if(i.owner!==void 0){let s=IFo(i.owner,a);if(s!==void 0)return t+s}}function IFo(a,i){for(let e in a)if(a[e]===i)return e}var mqi=new Map,hqi=new WeakMap;function yFo(a){let i=hqi.get(a);if(i)return i;let e=pJt(a)??"Object",t=mqi.get(e)??0;t++,mqi.set(e,t);let o=t===1?e:`${e}#${t}`;return hqi.set(a,o),o}function pJt(a){let i=a.constructor;if(i)return i.name==="Object"?void 0:i.name}function E$e(a){let i=a.toString(),t=/\/\*\*\s*@description\s*([^*]*)\*\//.exec(i);return(t?t[1]:void 0)?.trim()}function Ff(a,i){return a===i}function wFo(){return(a,i)=>a===i}function hJt(a,i,e){return $i(a,i,e??Ff)}function iO(a){return(i,e)=>$i(i,e,a??Ff)}function b_(a,i){if(a===i)return!0;if(Array.isArray(a)&&Array.isArray(i)){if(a.length!==i.length)return!1;for(let e=0;e<a.length;e++)if(!b_(a[e],i[e]))return!1;return!0}if(a&&typeof a=="object"&&i&&typeof i=="object"&&Object.getPrototypeOf(a)===Object.prototype&&Object.getPrototypeOf(i)===Object.prototype){let e=a,t=i,o=Object.keys(e),n=Object.keys(t),r=new Set(n);if(o.length!==n.length)return!1;for(let s of o)if(!r.has(s)||!b_(e[s],t[s]))return!1;return!0}return!1}function CFo(){return(a,i)=>b_(a,i)}function fqi(a){return JSON.stringify(mJt(a))}var xFo=0,gqi=new WeakMap;function mJt(a){if(Array.isArray(a))return a.map(mJt);if(a&&typeof a=="object")if(Object.getPrototypeOf(a)===Object.prototype){let i=a,e=Object.create(null);for(let t of Object.keys(i).sort())e[t]=mJt(i[t]);return e}else{let i=gqi.get(a);return i===void 0&&(i=xFo++,gqi.set(a,i)),i+"----2b76a038c20c4bcc"}return a}function kFo(a,i){return JSON.stringify(a)===JSON.stringify(i)}function EFo(){return(a,i)=>JSON.stringify(a)===JSON.stringify(i)}function G9(){return(a,i)=>a.equals(i)}function gJt(a,i,e){return a==null||i===void 0||i===null?i===a:e(a,i)}function S1(a){return(i,e)=>i==null||e===void 0||e===null?e===i:a(i,e)}var sgt;(p=>(p.strict=Ff,p.strictC=wFo,p.array=hJt,p.arrayC=iO,p.structural=b_,p.structuralC=CFo,p.jsonStringify=kFo,p.jsonStringifyC=EFo,p.thisC=G9,p.ifDefined=gJt,p.ifDefinedC=S1))(sgt||={});function fJt(a){let i=new Error("BugIndicatingErrorRecovery: "+a);mt(i),console.error("recovered from an error that indicates a bug",i)}var rae;function T$e(a){rae?rae instanceof agt?rae.loggers.push(a):rae=new agt([rae,a]):rae=a}function Hh(){return rae}var vJt;function vqi(a){vJt=a}function bqi(a){vJt&&vJt(a)}var agt=class{constructor(i){this.loggers=i}handleObservableCreated(i,e){for(let t of this.loggers)t.handleObservableCreated(i,e)}handleOnListenerCountChanged(i,e){for(let t of this.loggers)t.handleOnListenerCountChanged(i,e)}handleObservableUpdated(i,e){for(let t of this.loggers)t.handleObservableUpdated(i,e)}handleAutorunCreated(i,e){for(let t of this.loggers)t.handleAutorunCreated(i,e)}handleAutorunDisposed(i){for(let e of this.loggers)e.handleAutorunDisposed(i)}handleAutorunDependencyChanged(i,e,t){for(let o of this.loggers)o.handleAutorunDependencyChanged(i,e,t)}handleAutorunStarted(i){for(let e of this.loggers)e.handleAutorunStarted(i)}handleAutorunFinished(i){for(let e of this.loggers)e.handleAutorunFinished(i)}handleDerivedDependencyChanged(i,e,t){for(let o of this.loggers)o.handleDerivedDependencyChanged(i,e,t)}handleDerivedCleared(i){for(let e of this.loggers)e.handleDerivedCleared(i)}handleBeginTransaction(i){for(let e of this.loggers)e.handleBeginTransaction(i)}handleEndTransaction(i){for(let e of this.loggers)e.handleEndTransaction(i)}};function Gi(a,i){let e=new oO(a,i);try{a(e)}finally{e.finish()}}var lgt;function q9(a){if(lgt)a(lgt);else{let i=new oO(a,void 0);lgt=i;try{a(i)}finally{i.finish(),lgt=void 0}}}async function bJt(a,i){let e=new oO(a,i);try{await a(e)}finally{e.finish()}}function nO(a,i,e){a?i(a):Gi(i,e)}var oO=class{constructor(i,e){this._fn=i;this._getDebugName=e;this._updatingObservers=[];Hh()?.handleBeginTransaction(this)}getDebugName(){return this._getDebugName?this._getDebugName():E$e(this._fn)}updateObserver(i,e){if(!this._updatingObservers){fJt("Transaction already finished!"),Gi(t=>{t.updateObserver(i,e)});return}this._updatingObservers.push({observer:i,observable:e}),i.beginUpdate(e)}finish(){let i=this._updatingObservers;if(!i){fJt("transaction.finish() has already been called!");return}for(let e=0;e<i.length;e++){let{observer:t,observable:o}=i[e];t.endUpdate(o)}this._updatingObservers=null,Hh()?.handleEndTransaction(this)}debugGetUpdatingObservers(){return this._updatingObservers}};var Rl;(t=>{let a=!1;function i(){a=!0}t.enable=i;function e(){if(!a)return;let o=Error,n=o.stackTraceLimit;o.stackTraceLimit=3;let r=new Error().stack;return o.stackTraceLimit=n,SJt.fromStack(r,2)}t.ofCaller=e})(Rl||={});var SJt=class a{constructor(i,e,t,o){this.fileName=i;this.line=e;this.column=t;this.id=o}static fromStack(i,e){let t=i.split(`
`),o=TFo(t[e+1]);if(o)return new a(o.fileName,o.line,o.column,o.id)}};function TFo(a){let i=a.match(/\((.*):(\d+):(\d+)\)/);if(i)return{fileName:i[1],line:parseInt(i[2]),column:parseInt(i[3]),id:a};let e=a.match(/at ([^\(\)]*):(\d+):(\d+)/);if(e)return{fileName:e[1],line:parseInt(e[2]),column:parseInt(e[3]),id:a}}var IJt;function Sqi(a){IJt=a}var Iqi;function yqi(a){Iqi=a}var wqi;function Cqi(a){wqi=a}var yJt;function xqi(a){yJt=a}var _$e=class{get TChange(){return null}reportChanges(){this.get()}read(i){return i?i.readObservable(this):this.get()}map(i,e,t=Rl.ofCaller()){let o=e===void 0?void 0:i,n=e===void 0?i:e;return IJt({owner:o,debugName:()=>{let r=E$e(n);if(r!==void 0)return r;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(n.toString());if(l)return`${this.debugName}.${l[2]}`;if(!o)return`${this.debugName} (mapped)`},debugReferenceFn:n},r=>n(this.read(r),r),t)}flatten(){return IJt({owner:void 0,debugName:()=>`${this.debugName} (flattened)`},i=>this.read(i).read(i))}recomputeInitiallyAndOnChange(i,e){return i.add(Iqi(this,e)),this}keepObserved(i){return i.add(wqi(this)),this}get debugValue(){return this.get()}get debug(){return new wJt(this)}},wJt=class{constructor(i){this.observable=i}getDependencyGraph(){return yJt(this.observable,{type:"dependencies"})}getObserverGraph(){return yJt(this.observable,{type:"observers"})}},AL=class extends _$e{constructor(e){super();this._observers=new Set;Hh()?.handleObservableCreated(this,e)}addObserver(e){let t=this._observers.size;this._observers.add(e),t===0&&this.onFirstObserverAdded(),t!==this._observers.size&&Hh()?.handleOnListenerCountChanged(this,this._observers.size)}removeObserver(e){let t=this._observers.delete(e);t&&this._observers.size===0&&this.onLastObserverRemoved(),t&&Hh()?.handleOnListenerCountChanged(this,this._observers.size)}onFirstObserverAdded(){}onLastObserverRemoved(){}log(){let e=!!Hh();return bqi(this),e||Hh()?.handleObservableCreated(this,Rl.ofCaller()),this}debugGetObservers(){return this._observers}};function Me(a,i,e=Rl.ofCaller()){let t;return typeof a=="string"?t=new Qu(void 0,a,void 0):t=new Qu(a,void 0,void 0),new mP(t,i,Ff,e)}var mP=class extends AL{constructor(e,t,o,n){super(n);this._debugNameData=e;this._equalityComparator=o;this._value=t,Hh()?.handleObservableUpdated(this,{hadValue:!1,newValue:t,change:void 0,didChange:!0,oldValue:void 0})}get debugName(){return this._debugNameData.getDebugName(this)??"ObservableValue"}get(){return this._value}set(e,t,o){if(o===void 0&&this._equalityComparator(this._value,e))return;let n;t||(t=n=new oO(()=>{},()=>`Setting ${this.debugName}`));try{let r=this._value;this._setValue(e),Hh()?.handleObservableUpdated(this,{oldValue:r,newValue:e,change:o,didChange:!0,hadValue:!0});for(let s of this._observers)t.updateObserver(s,this),s.handleChange(this,o)}finally{n&&n.finish()}}toString(){return`${this.debugName}: ${this._value}`}_setValue(e){this._value=e}debugGetState(){return{value:this._value}}debugSetValue(e){this._value=e}};function SV(a,i,e=Rl.ofCaller()){let t;return typeof a=="string"?t=new Qu(void 0,a,void 0):t=new Qu(a,void 0,void 0),new CJt(t,i,Ff,e)}var CJt=class extends mP{_setValue(i){this._value!==i&&(this._value&&this._value.dispose(),this._value=i)}dispose(){this._value?.dispose()}};var cgt=class extends AL{constructor(e,t,o,n){super(n);this._debugNameData=e;this._equalityComparator=o;this._isUpToDate=!0;this._deltas=[];this._updateCounter=0;this._value=t}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){Hh()?.handleObservableUpdated(this,{change:e,didChange:!0,oldValue:"(unknown)",newValue:this._value,hadValue:!0});for(let t of this._observers)t.handleChange(this,e)}this._deltas.length=0}else{Hh()?.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 t of e)t.endUpdate(this)}}addObserver(e){let t=!this._observers.has(e)&&this._updateCounter>0;super.addObserver(e),t&&e.beginUpdate(this)}removeObserver(e){let t=this._observers.has(e)&&this._updateCounter>0;super.removeObserver(e),t&&e.endUpdate(this)}set(e,t,o){if(o===void 0&&this._equalityComparator(this._value,e))return;let n;t||(t=n=new oO(()=>{},()=>`Setting ${this.debugName}`));try{if(this._isUpToDate=!1,this._setValue(e),o!==void 0&&this._deltas.push(o),t.updateObserver({beginUpdate:()=>this._beginUpdate(),endUpdate:()=>this._endUpdate(),handleChange:(r,s)=>{},handlePossibleChange:r=>{}},this),this._updateCounter>1)for(let r of this._observers)r.handlePossibleChange(this)}finally{n&&n.finish()}}toString(){return`${this.debugName}: ${this._value}`}_setValue(e){this._value=e}};function ph(a,i,e=Rl.ofCaller()){return a.lazy?new cgt(new Qu(a.owner,a.debugName,void 0),i,a.equalsFn??Ff,e):new mP(new Qu(a.owner,a.debugName,void 0),i,a.equalsFn??Ff,e)}function _Fo(a){switch(a){case 1:return"dependenciesMightHaveChanged";case 2:return"stale";case 3:return"upToDate";default:return"<unknown>"}}var IV=class{constructor(i,e,t,o){this._debugNameData=i;this._runFn=e;this._changeTracker=t;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),Hh()?.handleAutorunCreated(this,o),this._run(),E$(this)}get debugName(){return this._debugNameData.getDebugName(this)??"(anonymous)"}dispose(){if(!this._disposed){this._disposed=!0;for(let i of this._dependencies)i.removeObserver(this);this._dependencies.clear(),this._store!==void 0&&this._store.dispose(),this._delayedStore!==void 0&&this._delayedStore.dispose(),Hh()?.handleAutorunDisposed(this),T$(this)}}_run(){let i=this._dependenciesToBeRemoved;this._dependenciesToBeRemoved=this._dependencies,this._dependencies=i,this._state=3;try{if(!this._disposed){Hh()?.handleAutorunStarted(this);let e=this._changeSummary,t=this._delayedStore;t!==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){E9(o)}finally{this._isRunning=!1,t!==void 0&&t.dispose()}}}finally{this._disposed||Hh()?.handleAutorunFinished(this);for(let e of this._dependenciesToBeRemoved)e.removeObserver(this);this._dependenciesToBeRemoved.clear()}}toString(){return`Autorun<${this.debugName}>`}beginUpdate(i){this._state===3&&(this._checkIterations(),this._state=1),this._updateCount++}endUpdate(i){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--}lh(()=>this._updateCount>=0)}handlePossibleChange(i){this._state===3&&this._isDependency(i)&&(this._checkIterations(),this._state=1)}handleChange(i,e){if(this._isDependency(i)){Hh()?.handleAutorunDependencyChanged(this,i,e);try{(!this._changeTracker||this._changeTracker.handleChange({changedObservable:i,change:e,didChange:o=>o===i},this._changeSummary))&&(this._checkIterations(),this._state=2)}catch(t){E9(t)}}}_isDependency(i){return this._dependencies.has(i)&&!this._dependenciesToBeRemoved.has(i)}_ensureNoRunning(){if(!this._isRunning)throw new li("The reader object cannot be used outside its compute function!")}readObservable(i){if(this._ensureNoRunning(),this._disposed)return i.get();i.addObserver(this);let e=i.get();return this._dependencies.add(i),this._dependenciesToBeRemoved.delete(i),e}get store(){if(this._ensureNoRunning(),this._disposed)throw new li("Cannot access store after dispose");return this._store===void 0&&(this._store=new N),this._store}get delayedStore(){if(this._ensureNoRunning(),this._disposed)throw new li("Cannot access store after dispose");return this._delayedStore===void 0&&(this._delayedStore=new N),this._delayedStore}debugGetState(){return{isRunning:this._isRunning,updateCount:this._updateCount,dependencies:this._dependencies,state:this._state,stateStr:_Fo(this._state)}}debugRerun(){this._isRunning?this._state=2:this._run()}_checkIterations(){return this._iteration>100?(E9(new li(`Autorun '${this.debugName}' is stuck in an infinite update loop.`)),!0):!1}};function be(a,i=Rl.ofCaller()){return new IV(new Qu(void 0,void 0,a),a,void 0,i)}function NL(a,i,e=Rl.ofCaller()){return new IV(new Qu(a.owner,a.debugName,a.debugReferenceFn??i),i,void 0,e)}function hP(a,i,e=Rl.ofCaller()){return new IV(new Qu(a.owner,a.debugName,a.debugReferenceFn??i),i,a.changeTracker,e)}function xJt(a,i){let e=new N,t=hP({owner:a.owner,debugName:a.debugName,debugReferenceFn:a.debugReferenceFn??i,changeTracker:a.changeTracker},(o,n)=>{e.clear(),i(o,n,e)});return Z(()=>{t.dispose(),e.dispose()})}function il(a){let i=new N,e=NL({owner:void 0,debugName:void 0,debugReferenceFn:a},t=>{i.clear(),a(t,i)});return Z(()=>{e.dispose(),i.dispose()})}function sae(a,i){let e;return NL({debugReferenceFn:i},t=>{let o=a.read(t),n=e;e=o,i({lastValue:n,newValue:o})})}function aae(a,i,e=t=>t){let t=new Map;return NL({debugReferenceFn:a},o=>{let n=new Map,r=new Map(t);for(let s of a(o)){let l=e(s);t.has(l)?r.delete(l):(n.set(l,s),t.set(l,s))}for(let s of r.keys())t.delete(s);(n.size||r.size)&&i({addedValues:[...n.values()],removedValues:[...r.values()]})})}function Ox(a,i=Rl.ofCaller()){let e,t=!1;return e=be(o=>{a({delayedStore:o.delayedStore,store:o.store,readObservable:o.readObservable.bind(o),dispose:()=>{e?.dispose(),t=!0}})},i),t&&e.dispose(),e}function DFo(a){switch(a){case 0:return"initial";case 1:return"dependenciesMightHaveChanged";case 2:return"stale";case 3:return"upToDate";default:return"<unknown>"}}var ib=class extends AL{constructor(e,t,o,n=void 0,r,s){super(s);this._debugNameData=e;this._computeFn=t;this._changeTracker=o;this._handleLastObserverRemoved=n;this._equalityComparator=r;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,Hh()?.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 t;try{this._isReaderValid=!0;let o;this._changeTracker&&(o=this._changeTracker.createChangeSummary(void 0),this._changeTracker.beforeUpdate?.(this,o)),t=this._computeFn(this,o)}finally{this._isReaderValid=!1}return this.onLastObserverRemoved(),t}else{do{if(this._state===1){for(let t of this._dependencies)if(t.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 t=this._dependenciesToBeRemoved;this._dependenciesToBeRemoved=this._dependencies,this._dependencies=t;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 n=this._state!==0,r=this._value;this._state=3;let s=this._delayedStore;s!==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(),s!==void 0&&s.dispose()}e=this._didReportChange||n&&!this._equalityComparator(r,this._value),Hh()?.handleObservableUpdated(this,{oldValue:r,newValue:this._value,change:void 0,didChange:e,hadValue:n})}catch(o){E9(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 li("Cyclic deriveds are not supported yet!");this._updateCount++,this._isUpdating=!0;try{let t=this._updateCount===1;if(this._state===3&&(this._state=1,!t))for(let o of this._observers)o.handlePossibleChange(this);if(t)for(let o of this._observers)o.beginUpdate(this)}finally{this._isUpdating=!1}}endUpdate(e){if(this._updateCount--,this._updateCount===0){let t=[...this._observers];for(let o of t)o.endUpdate(this);if(this._removedObserverToCallEndUpdateOn){let o=[...this._removedObserverToCallEndUpdateOn];this._removedObserverToCallEndUpdateOn=null;for(let n of o)n.endUpdate(this)}}lh(()=>this._updateCount>=0)}handlePossibleChange(e){if(this._state===3&&this._dependencies.has(e)&&!this._dependenciesToBeRemoved.has(e)){this._state=1;for(let t of this._observers)t.handlePossibleChange(this)}}handleChange(e,t){if(this._dependencies.has(e)&&!this._dependenciesToBeRemoved.has(e)||this._isInBeforeUpdate){Hh()?.handleDerivedDependencyChanged(this,e,t);let o=!1;try{o=this._changeTracker?this._changeTracker.handleChange({changedObservable:e,change:t,didChange:r=>r===e},this._changeSummary):!0}catch(r){E9(r)}let n=this._state===3;if(o&&(this._state===1||n)&&(this._state=2,n))for(let r of this._observers)r.handlePossibleChange(this)}}_ensureReaderValid(){if(!this._isReaderValid)throw new li("The reader object cannot be used outside its compute function!")}readObservable(e){this._ensureReaderValid(),e.addObserver(this);let t=e.get();return this._dependencies.add(e),this._dependenciesToBeRemoved.delete(e),t}reportChange(e){this._ensureReaderValid(),this._didReportChange=!0;for(let t of this._observers)t.handleChange(this,e)}get store(){return this._ensureReaderValid(),this._store===void 0&&(this._store=new N),this._store}get delayedStore(){return this._ensureReaderValid(),this._delayedStore===void 0&&(this._delayedStore=new N),this._delayedStore}addObserver(e){let t=!this._observers.has(e)&&this._updateCount>0;super.addObserver(e),t&&(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:DFo(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,t,o){this._value=e;let n=this._observers;t.updateObserver(this,this);for(let r of n)r.handleChange(this,o)}},xIe=class extends ib{constructor(e,t,o,n=void 0,r,s,l){super(e,t,o,n,r,l);this.set=s}};function ke(a,i,e=Rl.ofCaller()){return i!==void 0?new ib(new Qu(a,void 0,i),i,void 0,void 0,Ff,e):new ib(new Qu(void 0,void 0,a),a,void 0,void 0,Ff,e)}function K$(a,i,e,t=Rl.ofCaller()){return new xIe(new Qu(a,void 0,i),i,void 0,void 0,Ff,e,t)}function Os(a,i,e=Rl.ofCaller()){return new ib(new Qu(a.owner,a.debugName,a.debugReferenceFn),i,void 0,a.onLastObserverRemoved,a.equalsFn??Ff,e)}Sqi(Os);function kIe(a,i,e=Rl.ofCaller()){return new ib(new Qu(a.owner,a.debugName,void 0),i,a.changeTracker,void 0,a.equalityComparer??Ff,e)}function UI(a,i,e=Rl.ofCaller()){let t,o;i===void 0?(t=a,o=void 0):(o=a,t=i);let n;return new ib(new Qu(o,void 0,t),r=>{n?n.clear():n=new N;let s=t(r);return s&&n.add(s),s},void 0,()=>{n&&(n.dispose(),n=void 0)},Ff,e)}var dgt=class{constructor(i){this._computeValue=i;this._value=Me(this,void 0)}get cachedValue(){return this._value}getValue(){let i=this._value.get();return i||(i=this._computeValue(),this._value.set(i,void 0)),i}},bd=class a{constructor(i){this._value=Me(this,void 0);this.promiseResult=this._value;this.resolvedValue=ke(this,i=>{let e=this.promiseResult.read(i);if(e)return e.getDataOrThrow()});this.promise=i.then(e=>(Gi(t=>{this._value.set(new D$e(e,void 0),t)}),e),e=>{throw Gi(t=>{this._value.set(new D$e(void 0,e),t)}),e})}static fromFn(i){return new a(i())}static resolved(i){return new a(Promise.resolve(i))}},D$e=class{constructor(i,e){this.data=i;this.error=e}getDataOrThrow(){if(this.error)throw this.error;return this.data}},L$e=class{constructor(i){this._computePromise=i;this._lazyValue=new dgt(()=>new bd(this._computePromise()));this.cachedPromiseResult=ke(this,i=>this._lazyValue.cachedValue.read(i)?.promiseResult.read(i))}getPromise(){return this._lazyValue.getValue().promise}};function Wf(a,i,e,t){return i||(i=o=>o!=null),new Promise((o,n)=>{let r=!0,s=!1,l=a.map(u=>({isFinished:i(u),error:e?e(u):!1,state:u})),c=be(u=>{let{isFinished:p,error:h,state:g}=l.read(u);(p||h)&&(r?s=!0:c.dispose(),h?n(h===!0?g:h):o(g))});if(t){let u=t.onCancellationRequested(()=>{c.dispose(),u.dispose(),n(new go)});if(t.isCancellationRequested){c.dispose(),u.dispose(),n(new go);return}}r=!1,s&&c.dispose()})}function ui(...a){let i,e,t,o;return a.length===2?[e,t]=a:[i,e,t,o]=a,new OL(new Qu(i,void 0,t),e,t,()=>OL.globalTransaction,Ff,o??Rl.ofCaller())}function Vf(a,i,e,t=Rl.ofCaller()){return new OL(new Qu(a.owner,a.debugName,a.debugReferenceFn??e),i,e,()=>a.getTransaction?.()??OL.globalTransaction,a.equalsFn??Ff,t)}var OL=class extends AL{constructor(e,t,o,n,r,s){super(s);this._debugNameData=e;this.event=t;this._getValue=o;this._getTransaction=n;this._equalityComparator=r;this._hasValue=!1;this.handleEvent=e=>{let t=this._getValue(e),o=this._value,n=!this._hasValue||!this._equalityComparator(o,t),r=!1;n&&(this._value=t,this._hasValue&&(r=!0,nO(this._getTransaction(),s=>{Hh()?.handleObservableUpdated(this,{oldValue:o,newValue:t,change:void 0,didChange:n,hadValue:this._hasValue});for(let l of this._observers)s.updateObserver(l,this),l.handleChange(this,void 0)},()=>{let s=this.getDebugName();return"Event fired"+(s?`: ${s}`:"")})),this._hasValue=!0),r||Hh()?.handleObservableUpdated(this,{oldValue:o,newValue:t,change:void 0,didChange:n,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=OL;function i(t,o){let n=!1;OL.globalTransaction===void 0&&(OL.globalTransaction=t,n=!0);try{o()}finally{n&&(OL.globalTransaction=void 0)}}e.batchEventsGlobally=i})(ui||={});function wc(a,i=Rl.ofCaller()){return typeof a=="string"?new ugt(a,void 0,i):new ugt(void 0,a,i)}var ugt=class extends AL{constructor(e,t,o){super(o);this._debugName=e;this._owner=t}get debugName(){return new Qu(this._owner,this._debugName,void 0).getDebugName(this)??"Observable Signal"}toString(){return this.debugName}trigger(e,t){if(!e){Gi(o=>{this.trigger(o,t)},()=>`Trigger signal ${this.debugName}`);return}for(let o of this._observers)e.updateObserver(o,this),o.handleChange(this,t)}get(){}};function R$e(a){let i=Me("promiseValue",{});return a.then(e=>{i.set({value:e},void 0)}),i}function gP(a,i,e=Rl.ofCaller()){let t=!1,o,n;return ui(void 0,r=>{let s=be(l=>{let c=a.read(l);if(!t)t=!0,o=c;else{n&&clearTimeout(n);let u=typeof i=="number"?i:i(o,c);if(u===0){o=c,r();return}n=setTimeout(()=>{o=c,r()},u)}});return{dispose(){s.dispose(),t=!1,o=void 0}}},()=>t?o:a.get(),e)}function kJt(a,i,e=Rl.ofCaller()){let t=wc("handleTimeout"),o,n;return Os({owner:void 0,onLastObserverRemoved:()=>{o=void 0}},s=>{let l=a.read(s);if(t.read(s),l!==o){let c=typeof i=="number"?i:i(o,l);if(c===0)return o=l,l;n&&clearTimeout(n),n=setTimeout(()=>{o=l,t.trigger(void 0)},c)}return o},e)}function EJt(a,i,e){let t=Me("triggeredRecently",!1),o;return e.add(a(()=>{t.set(!0,void 0),o&&clearTimeout(o),o=setTimeout(()=>{t.set(!1,void 0)},i)})),t}function I1(a){let i=new pgt(!1,void 0);return a.addObserver(i),Z(()=>{a.removeObserver(i)})}Cqi(I1);function fP(a,i){let e=new pgt(!0,i);a.addObserver(e);try{e.beginUpdate(a)}finally{e.endUpdate(a)}return Z(()=>{a.removeObserver(e)})}yqi(fP);var pgt=class{constructor(i,e){this._forceRecompute=i;this._handleValue=e;this._counter=0}beginUpdate(i){this._counter++}endUpdate(i){this._counter===1&&this._forceRecompute&&(this._handleValue?this._handleValue(i.get()):i.reportChanges()),this._counter--}handlePossibleChange(i){}handleChange(i,e){}};function Bf(a,i){let e;return Os({owner:a,debugReferenceFn:i},o=>(e=i(o,e),e))}function M$e(a,i){let e,t=wc("derivedObservableWithWritableCache"),o=ke(a,n=>(t.read(n),e=i(n,e),e));return Object.assign(o,{clearCache:n=>{e=void 0,t.trigger(n)},setCache:(n,r)=>{e=n,t.trigger(r)}})}function ob(a,i,e,t){let o=new mgt(e,t);return Os({debugReferenceFn:e,owner:a,onLastObserverRemoved:()=>{o.dispose(),o=new mgt(e)}},r=>{let s=i.read(r);return o.setItems(s),o.getItems()})}var mgt=class{constructor(i,e){this._map=i;this._keySelector=e;this._cache=new Map;this._items=[]}dispose(){this._cache.forEach(i=>i.store.dispose()),this._cache.clear()}setItems(i){let e=[],t=new Set(this._cache.keys());for(let o of i){let n=this._keySelector?this._keySelector(o):o,r=this._cache.get(n);if(r)t.delete(n);else{let s=new N;r={out:this._map(o,s),store:s},this._cache.set(n,r)}e.push(r.out)}for(let o of t)this._cache.get(o).store.dispose(),this._cache.delete(o);this._items=e}getItems(){return this._items}};function rO(a){return!!a&&a.read!==void 0&&a.reportChanges!==void 0}function TJt(a){return{createChangeSummary:i=>({changes:[]}),handleChange(i,e){for(let t in a)i.didChange(a[t])&&e.changes.push({key:t,change:i.change});return!0},beforeUpdate(i,e){for(let t in a){if(t==="changes")throw new li('property name "changes" is reserved for change tracking');e[t]=a[t].read(i)}}}}function _Jt(a){let i;return{createChangeSummary:e=>({changes:[]}),handleChange(e,t){i||(i=a());for(let o in i)e.didChange(i[o])&&t.changes.push({key:o,change:e.change});return!0},beforeUpdate(e,t){i||(i=a());for(let o in i){if(o==="changes")throw new li('property name "changes" is reserved for change tracking');t[o]=i[o].read(e)}}}}function So(a){return new DJt(a)}var DJt=class extends _$e{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 Fr(a,i,e=Rl.ofCaller()){return new LJt(typeof a=="string"?a:new Qu(a,void 0,void 0),i,e)}var LJt=class extends AL{constructor(e,t,o){super(o);this.event=t;this.handleEvent=()=>{Gi(e=>{for(let t of this._observers)e.updateObserver(t,this),t.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 sO=class{constructor(i){this.observable=i}get onDidChange(){return U.fromObservableLight(this.observable)}get value(){return this.observable.get()}};function lae(a,i){return i instanceof sO?i.observable:ui(a,i.onDidChange,()=>i.value)}function Vs(a,i){let e,t=!0;return xJt({changeTracker:{createChangeSummary:()=>({deltas:[],didChange:!1}),handleChange:(o,n)=>{if(o.didChange(a)){let r=o.change;r!==void 0&&n.deltas.push(r),n.didChange=!0}return!0}}},(o,n)=>{let r=a.read(o),s=e;n.didChange&&(e=r,i(r,s,n.deltas)),t&&(t=!1,e=r)})}function hgt(a,i){let e=new N,t=Vs(a,(o,n,r)=>{e.clear(),i(o,n,r,e)});return{dispose(){t.dispose(),e.dispose()}}}function RJt(a,i){return hgt(a,(e,t,o,n)=>{i(e,t,o,N9(n))})}function P$e(a,i){if(i.length===0)throw new li;let e=!1,t,o=ui(a,n=>{let r=new N;for(let s of i)r.add(NL({debugName:()=>uJt(o,new Qu(a,void 0,void 0))+".updateLastChangedValue"},l=>{e=!0,t=s.read(l),n()}));return r.add({dispose(){e=!1,t=void 0}}),r},()=>e?t:i[i.length-1].get());return o}function MJt(a,i){return Bf(a,(e,t)=>t??i(e))}var $9=class{constructor(){this._data=new Set;this._obs=ph({equalsFn:()=>!1},this);this.observable=this._obs}get size(){return this._data.size}has(i){return this._data.has(i)}add(i,e){return this._data.has(i)||(this._data.add(i),this._obs.set(this,e)),this}delete(i,e){let t=this._data.delete(i);return t&&this._obs.set(this,e),t}clear(i){this._data.size>0&&(this._data.clear(),this._obs.set(this,i))}forEach(i,e){this._data.forEach((t,o,n)=>{i.call(e,t,o,this)})}*entries(){for(let i of this._data)yield[i,i]}*keys(){yield*this._data.keys()}*values(){yield*this._data.values()}[Symbol.iterator](){return this.values()}get[Symbol.toStringTag](){return"ObservableSet"}};var G$=class{constructor(){this._data=new Map;this._obs=ph({equalsFn:()=>!1},this);this.observable=this._obs}get size(){return this._data.size}has(i){return this._data.has(i)}get(i){return this._data.get(i)}set(i,e,t){let o=this._data.has(i),n=this._data.get(i);return(!o||n!==e)&&(this._data.set(i,e),this._obs.set(this,t)),this}delete(i,e){let t=this._data.delete(i);return t&&this._obs.set(this,e),t}clear(i){this._data.size>0&&(this._data.clear(),this._obs.set(this,i))}forEach(i,e){this._data.forEach((t,o,n)=>{i.call(e,t,o,this)})}*entries(){yield*this._data.entries()}*keys(){yield*this._data.keys()}*values(){yield*this._data.values()}[Symbol.iterator](){return this.entries()}get[Symbol.toStringTag](){return"ObservableMap"}};var ggt;function kqi(a){ggt||(ggt=new A$e,T$e(ggt)),ggt.addFilteredObj(a)}var A$e=class{constructor(){this.indentation=0;this.changedObservablesSets=new WeakMap}addFilteredObj(i){this._filteredObjects||(this._filteredObjects=new Set),this._filteredObjects.add(i)}_isIncluded(i){return this._filteredObjects?.has(i)??!0}textToConsoleArgs(i){return LFo([EIe(PFo("|  ",this.indentation)),i])}formatInfo(i){return i.hadValue?i.didChange?[EIe(" "),aO(vP(i.oldValue,70),{color:"red",strikeThrough:!0}),EIe(" "),aO(vP(i.newValue,60),{color:"green"})]:[EIe(" (unchanged)")]:[EIe(" "),aO(vP(i.newValue,60),{color:"green"}),EIe(" (initial)")]}handleObservableCreated(i){if(i instanceof ib){let e=i;if(this.changedObservablesSets.set(e,new Set),!1){let o=[];e.__debugUpdating=o;let n=e.beginUpdate;e.beginUpdate=s=>(o.push(s),n.apply(e,[s]));let r=e.endUpdate;e.endUpdate=s=>{let l=o.indexOf(s);return l===-1&&console.error("endUpdate called without beginUpdate",e.debugName,s.debugName),o.splice(l,1),r.apply(e,[s])}}}}handleOnListenerCountChanged(i,e){}handleObservableUpdated(i,e){if(this._isIncluded(i)){if(i instanceof ib){this._handleDerivedRecomputed(i,e);return}console.log(...this.textToConsoleArgs([TIe("observable value changed"),aO(i.debugName,{color:"BlueViolet"}),...this.formatInfo(e)]))}}formatChanges(i){if(i.size!==0)return aO(" (changed deps: "+[...i].map(e=>e.debugName).join(", ")+")",{color:"gray"})}handleDerivedDependencyChanged(i,e,t){this._isIncluded(i)&&this.changedObservablesSets.get(i)?.add(e)}_handleDerivedRecomputed(i,e){if(!this._isIncluded(i))return;let t=this.changedObservablesSets.get(i);t&&(console.log(...this.textToConsoleArgs([TIe("derived recomputed"),aO(i.debugName,{color:"BlueViolet"}),...this.formatInfo(e),this.formatChanges(t),{data:[{fn:i._debugNameData.referenceFn??i._computeFn}]}])),t.clear())}handleDerivedCleared(i){this._isIncluded(i)&&console.log(...this.textToConsoleArgs([TIe("derived cleared"),aO(i.debugName,{color:"BlueViolet"})]))}handleFromEventObservableTriggered(i,e){this._isIncluded(i)&&console.log(...this.textToConsoleArgs([TIe("observable from event triggered"),aO(i.debugName,{color:"BlueViolet"}),...this.formatInfo(e),{data:[{fn:i._getValue}]}]))}handleAutorunCreated(i){this._isIncluded(i)&&this.changedObservablesSets.set(i,new Set)}handleAutorunDisposed(i){}handleAutorunDependencyChanged(i,e,t){this._isIncluded(i)&&this.changedObservablesSets.get(i).add(e)}handleAutorunStarted(i){let e=this.changedObservablesSets.get(i);e&&(this._isIncluded(i)&&console.log(...this.textToConsoleArgs([TIe("autorun"),aO(i.debugName,{color:"BlueViolet"}),this.formatChanges(e),{data:[{fn:i._debugNameData.referenceFn??i._runFn}]}])),e.clear(),this.indentation++)}handleAutorunFinished(i){this.indentation--}handleBeginTransaction(i){let e=i.getDebugName();e===void 0&&(e=""),this._isIncluded(i)&&console.log(...this.textToConsoleArgs([TIe("transaction"),aO(e,{color:"BlueViolet"}),{data:[{fn:i._fn}]}])),this.indentation++}handleEndTransaction(){this.indentation--}};function LFo(a){let i=new Array,e=[],t="";function o(r){if("length"in r)for(let s of r)s&&o(s);else"text"in r?(t+=`%c${r.text}`,i.push(r.style),r.data&&e.push(...r.data)):"data"in r&&e.push(...r.data)}o(a);let n=[t,...i];return n.push(...e),n}function EIe(a){return aO(a,{color:"black"})}function TIe(a){return aO(AFo(`${a}: `,10),{color:"black",bold:!0})}function aO(a,i={color:"black"}){function e(o){return Object.entries(o).reduce((n,[r,s])=>`${n}${r}:${s};`,"")}let t={color:i.color};return i.strikeThrough&&(t["text-decoration"]="line-through"),i.bold&&(t["font-weight"]="bold"),{text:a,style:e(t)}}function vP(a,i){switch(typeof a){case"number":return""+a;case"string":return a.length+2<=i?`"${a}"`:`"${a.substr(0,i-7)}"+...`;case"boolean":return a?"true":"false";case"undefined":return"undefined";case"object":return a===null?"null":Array.isArray(a)?RFo(a,i):MFo(a,i);case"symbol":return a.toString();case"function":return`[[Function${a.name?" "+a.name:""}]]`;default:return""+a}}function RFo(a,i){let e="[ ",t=!0;for(let o of a){if(t||(e+=", "),e.length-5>i){e+="...";break}t=!1,e+=`${vP(o,i-e.length)}`}return e+=" ]",e}function MFo(a,i){if(typeof a.toString=="function"&&a.toString!==Object.prototype.toString){let n=a.toString();return n.length<=i?n:n.substring(0,i-3)+"..."}let e=pJt(a),t=e?e+"(":"{ ",o=!0;for(let[n,r]of Object.entries(a)){if(o||(t+=", "),t.length-5>i){t+="...";break}o=!1,t+=`${n}: ${vP(r,i-t.length)}`}return t+=e?")":" }",t}function PFo(a,i){let e="";for(let t=1;t<=i;t++)e+=a;return e}function AFo(a,i){for(;a.length<i;)a+=" ";return a}var fgt=class a{constructor(i,e){this._channelFactory=i;this._getHandler=e;this._channel=this._channelFactory({handleNotification:n=>{let r=n,s=this._getHandler().notifications[r[0]];if(!s)throw new Error(`Unknown notification "${r[0]}"!`);s(...r[1])},handleRequest:n=>{let r=n;try{return{type:"result",value:this._getHandler().requests[r[0]](...r[1])}}catch(s){return{type:"error",value:s}}}});let t=new Proxy({},{get:(n,r)=>async(...s)=>{let l=await this._channel.sendRequest([r,s]);if(l.type==="error")throw l.value;return l.value}}),o=new Proxy({},{get:(n,r)=>(...s)=>{this._channel.sendNotification([r,s])}});this.api={notifications:o,requests:t}}static createHost(i,e){return new a(i,e)}static createClient(i,e){return new a(i,e)}};function Eqi(a,i){let e=globalThis,t=[],o,{channel:n,handler:r}=NFo({sendNotification:l=>{o?o.sendNotification(l):t.push(l)}}),s;return(e.$$debugValueEditor_debugChannels??(e.$$debugValueEditor_debugChannels={}))[a]=l=>{s=i(),o=l;for(let c of t)l.sendNotification(c);return t=[],r},fgt.createClient(n,()=>{if(!s)throw new Error("Not supported");return s})}function NFo(a){let i;return{channel:t=>(i=t,{sendNotification:o=>{a.sendNotification(o)},sendRequest:o=>{throw new Error("not supported")}}),handler:{handleRequest:t=>t.type==="notification"?i?.handleNotification(t.data):i?.handleRequest(t.data)}}}var vgt=class{constructor(){this._timeout=void 0}throttle(i,e){this._timeout===void 0&&(this._timeout=setTimeout(()=>{this._timeout=void 0,i()},e))}dispose(){this._timeout!==void 0&&clearTimeout(this._timeout)}};function PJt(a,i){for(let e in i)a[e]&&typeof a[e]=="object"&&i[e]&&typeof i[e]=="object"?PJt(a[e],i[e]):a[e]=i[e]}function AJt(a,i){for(let e in i)i[e]===null?delete a[e]:a[e]&&typeof a[e]=="object"&&i[e]&&typeof i[e]=="object"?AJt(a[e],i[e]):a[e]=i[e]}var bgt=class a{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=Eqi("observableDevTools",()=>({notifications:{setDeclarationIdFilter:i=>{},logObservableValue:i=>{console.log("logObservableValue",i)},flushUpdates:()=>{this._flushUpdates()},resetUpdates:()=>{this._pendingChanges=null,this._channel.api.notifications.handleChange(this._fullState,!0)}},requests:{getDeclarations:()=>{let i={};for(let e of this._declarations.values())i[e.id]=e;return{decls:i}},getSummarizedInstances:()=>null,getObservableValueInfo:i=>({observers:[...this._aliveInstances.get(i).debugGetObservers()].map(t=>this._formatObserver(t)).filter(lo)}),getDerivedInfo:i=>{let e=this._aliveInstances.get(i);return{dependencies:[...e.debugGetState().dependencies].map(t=>this._formatObservable(t)).filter(lo),observers:[...e.debugGetObservers()].map(t=>this._formatObserver(t)).filter(lo)}},getAutorunInfo:i=>({dependencies:[...this._aliveInstances.get(i).debugGetState().dependencies].map(t=>this._formatObservable(t)).filter(lo)}),getTransactionState:()=>this.getTransactionState(),setValue:(i,e)=>{let t=this._aliveInstances.get(i);if(t instanceof ib)t.debugSetValue(e);else if(t instanceof mP)t.debugSetValue(e);else if(t instanceof OL)t.debugSetValue(e);else throw new li("Observable is not supported");let o=[...t.debugGetObservers()];for(let n of o)n.beginUpdate(t);for(let n of o)n.handleChange(t,void 0);for(let n of o)n.endUpdate(t)},getValue:i=>{let e=this._aliveInstances.get(i);if(e instanceof ib)return vP(e.debugGetState().value,200);if(e instanceof mP)return vP(e.debugGetState().value,200)},logValue:i=>{let e=this._aliveInstances.get(i);if(e&&"get"in e)console.log("Logged Value:",e.get());else throw new li("Observable is not supported")},rerun:i=>{let e=this._aliveInstances.get(i);if(e instanceof ib)e.debugRecompute();else if(e instanceof IV)e.debugRerun();else throw new li("Observable is not supported")}}}));this._pendingChanges=null;this._changeThrottler=new vgt;this._fullState={};this._flushUpdates=()=>{this._pendingChanges!==null&&(this._channel.api.notifications.handleChange(this._pendingChanges,!1),this._pendingChanges=null)};Rl.enable()}static{this._instance=void 0}static getInstance(){return a._instance===void 0&&(a._instance=new a),a._instance}getTransactionState(){let i=[],e=[...this._activeTransactions];if(e.length===0)return;let t=e.flatMap(n=>n.debugGetUpdatingObservers()??[]).map(n=>n.observer),o=new Set;for(;t.length>0;){let n=t.shift();if(o.has(n))continue;o.add(n);let r=this._getInfo(n,s=>{o.has(s)||t.push(s)});r&&i.push(r)}return{names:e.map(n=>n.getDebugName()??"tx"),affected:i}}_getObservableInfo(i){let e=this._instanceInfos.get(i);if(!e){mt(new li("No info found"));return}return e}_getAutorunInfo(i){let e=this._instanceInfos.get(i);if(!e){mt(new li("No info found"));return}return e}_getInfo(i,e){if(i instanceof ib){let t=[...i.debugGetObservers()];for(let l of t)e(l);let o=this._getObservableInfo(i);if(!o)return;let n=i.debugGetState(),r={name:i.debugName,instanceId:o.instanceId,updateCount:n.updateCount},s=[...o.changedObservables].map(l=>this._instanceInfos.get(l)?.instanceId).filter(lo);if(n.isComputing)return{...r,type:"observable/derived",state:"updating",changedDependencies:s,initialComputation:!1};switch(n.state){case 0:return{...r,type:"observable/derived",state:"noValue"};case 3:return{...r,type:"observable/derived",state:"upToDate"};case 2:return{...r,type:"observable/derived",state:"stale",changedDependencies:s};case 1:return{...r,type:"observable/derived",state:"possiblyStale"}}}else if(i instanceof IV){let t=this._getAutorunInfo(i);if(!t)return;let o={name:i.debugName,instanceId:t.instanceId,updateCount:t.updateCount},n=[...t.changedObservables].map(r=>this._instanceInfos.get(r).instanceId);if(i.debugGetState().isRunning)return{...o,type:"autorun",state:"updating",changedDependencies:n};switch(i.debugGetState().state){case 3:return{...o,type:"autorun",state:"upToDate"};case 2:return{...o,type:"autorun",state:"stale",changedDependencies:n};case 1:return{...o,type:"autorun",state:"possiblyStale"}}}}_formatObservable(i){let e=this._getObservableInfo(i);if(e)return{name:i.debugName,instanceId:e.instanceId}}_formatObserver(i){if(i instanceof ib)return{name:i.toString(),instanceId:this._getObservableInfo(i)?.instanceId};let e=this._getAutorunInfo(i);if(e)return{name:i.toString(),instanceId:e.instanceId}}_handleChange(i){AJt(this._fullState,i),this._pendingChanges===null?this._pendingChanges=i:PJt(this._pendingChanges,i),this._changeThrottler.throttle(this._flushUpdates,10)}_getDeclarationId(i,e){if(!e)return-1;let t=this._declarations.get(e.id);return t===void 0&&(t={id:this._declarationId++,type:i,url:e.fileName,line:e.line,column:e.column},this._declarations.set(e.id,t),this._handleChange({decls:{[t.id]:t}})),t.id}handleObservableCreated(i,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(i,o)}handleOnListenerCountChanged(i,e){let t=this._getObservableInfo(i);if(t){if(t.listenerCount===0&&e>0){let o=i instanceof ib?"observable/derived":"observable/value";this._aliveInstances.set(t.instanceId,i),this._handleChange({instances:{[t.instanceId]:{instanceId:t.instanceId,declarationId:t.declarationId,formattedValue:t.lastValue,type:o,name:i.debugName}}})}else t.listenerCount>0&&e===0&&(this._handleChange({instances:{[t.instanceId]:null}}),this._aliveInstances.delete(t.instanceId));t.listenerCount=e}}handleObservableUpdated(i,e){if(i instanceof ib){this._handleDerivedRecomputed(i,e);return}let t=this._getObservableInfo(i);t&&e.didChange&&(t.lastValue=vP(e.newValue,30),t.listenerCount>0&&this._handleChange({instances:{[t.instanceId]:{formattedValue:t.lastValue}}}))}handleAutorunCreated(i,e){let o={declarationId:this._getDeclarationId("autorun",e),instanceId:this._instanceId++,updateCount:0,changedObservables:new Set};this._instanceInfos.set(i,o),this._aliveInstances.set(o.instanceId,i),o&&this._handleChange({instances:{[o.instanceId]:{instanceId:o.instanceId,declarationId:o.declarationId,runCount:0,type:"autorun",name:i.debugName}}})}handleAutorunDisposed(i){let e=this._getAutorunInfo(i);e&&(this._handleChange({instances:{[e.instanceId]:null}}),this._instanceInfos.delete(i),this._aliveInstances.delete(e.instanceId))}handleAutorunDependencyChanged(i,e,t){let o=this._getAutorunInfo(i);o&&o.changedObservables.add(e)}handleAutorunStarted(i){}handleAutorunFinished(i){let e=this._getAutorunInfo(i);e&&(e.changedObservables.clear(),e.updateCount++,this._handleChange({instances:{[e.instanceId]:{runCount:e.updateCount}}}))}handleDerivedDependencyChanged(i,e,t){let o=this._getObservableInfo(i);o&&o.changedObservables.add(e)}_handleDerivedRecomputed(i,e){let t=this._getObservableInfo(i);if(!t)return;let o=vP(e.newValue,30);t.updateCount++,t.changedObservables.clear(),t.lastValue=o,t.listenerCount>0&&this._handleChange({instances:{[t.instanceId]:{formattedValue:o,recomputationCount:t.updateCount}}})}handleDerivedCleared(i){let e=this._getObservableInfo(i);e&&(e.lastValue=void 0,e.changedObservables.clear(),e.listenerCount>0&&this._handleChange({instances:{[e.instanceId]:{formattedValue:void 0}}}))}handleBeginTransaction(i){this._activeTransactions.add(i)}handleEndTransaction(i){this._activeTransactions.delete(i)}};function Tqi(a,i){let e=i?.debugNamePostProcessor??(n=>n),t=cae.from(a,e);if(!t)return"";let o=new Set;return i.type==="observers"?Dqi(t,0,o,i).trim():_qi(t,0,o,i).trim()}function _qi(a,i,e,t){let o="		".repeat(i),n=[];if(e.has(a.sourceObj))return n.push(`${o}* ${a.type} ${a.name} (already listed)`),n.join(`
`);if(e.add(a.sourceObj),n.push(`${o}* ${a.type} ${a.name}:`),n.push(`${o}  value: ${vP(a.value,50)}`),n.push(`${o}  state: ${a.state}`),a.dependencies.length>0){n.push(`${o}  dependencies:`);for(let s of a.dependencies){let l=cae.from(s,t.debugNamePostProcessor??(c=>c))??cae.unknown(s);n.push(_qi(l,i+1,e,t))}}return n.join(`
`)}function Dqi(a,i,e,t){let o="		".repeat(i),n=[];if(e.has(a.sourceObj))return n.push(`${o}* ${a.type} ${a.name} (already listed)`),n.join(`
`);if(e.add(a.sourceObj),n.push(`${o}* ${a.type} ${a.name}:`),n.push(`${o}  value: ${vP(a.value,50)}`),n.push(`${o}  state: ${a.state}`),a.observers.length>0){n.push(`${o}  observers:`);for(let s of a.observers){let l=cae.from(s,t.debugNamePostProcessor??(c=>c))??cae.unknown(s);n.push(Dqi(l,i+1,e,t))}}return n.join(`
`)}var cae=class a{constructor(i,e,t,o,n,r,s){this.sourceObj=i;this.name=e;this.type=t;this.value=o;this.state=n;this.dependencies=r;this.observers=s}static from(i,e){if(i instanceof IV){let t=i.debugGetState();return new a(i,e(i.debugName),"autorun",void 0,t.stateStr,Array.from(t.dependencies),[])}else if(i instanceof ib){let t=i.debugGetState();return new a(i,e(i.debugName),"derived",t.value,t.stateStr,Array.from(t.dependencies),Array.from(i.debugGetObservers()))}else if(i instanceof mP){let t=i.debugGetState();return new a(i,e(i.debugName),"observableValue",t.value,"upToDate",[],Array.from(i.debugGetObservers()))}else if(i instanceof OL){let t=i.debugGetState();return new a(i,e(i.debugName),"fromEvent",t.value,t.hasValue?"upToDate":"initial",[],Array.from(i.debugGetObservers()))}}static unknown(i){return new a(i,"(unknown)","unknown",void 0,"unknown",[],[])}};xqi(Tqi);vqi(kqi);var OFo=!1;OFo&&T$e(new A$e);$u&&$u.VSCODE_DEV_DEBUG_OBSERVABLES&&T$e(bgt.getInstance());var{registerWindow:Oqi,getWindow:Re,getDocument:uae,getWindows:SC,getWindowsCount:_Ie,getWindowId:gv,getWindowById:rb,hasWindow:j9,onDidRegisterWindow:nf,onWillUnregisterWindow:Fqi,onDidUnregisterWindow:Wqi}=(function(){let a=new Map;eht(ut,1);let i={window:ut,disposables:new N};a.set(ut.vscodeWindowId,i);let e=new E,t=new E,o=new E;function n(r,s){return(typeof r=="number"?a.get(r):void 0)??(s?i:void 0)}return{onDidRegisterWindow:e.event,onWillUnregisterWindow:o.event,onDidUnregisterWindow:t.event,registerWindow(r){if(a.has(r.vscodeWindowId))return x.None;let s=new N,l={window:r,disposables:s.add(new N)};return a.set(r.vscodeWindowId,l),s.add(Z(()=>{a.delete(r.vscodeWindowId),t.fire(r)})),s.add(j(r,re.BEFORE_UNLOAD,()=>{o.fire(r)})),e.fire(l),s},getWindows(){return a.values()},getWindowsCount(){return a.size},getWindowId(r){return r.vscodeWindowId},hasWindow(r){return a.has(r)},getWindowById:n,getWindow(r){let s=r;if(s?.ownerDocument?.defaultView)return s.ownerDocument.defaultView.window;let l=r;return l?.view?l.view.window:ut},getDocument(r){return Re(r).document}}})(),Sgt=new Set;function Vqi(a){return Sgt.add(a),Z(()=>{Sgt.delete(a)})}function FFo(){for(let a of Sgt)if(a().hasFocus)return!0;return!1}function WFo(){for(let a of Sgt){let i=a();if(i.hasFocus&&i.window)return i.window}}function Bqi(){for(let{window:a}of SC())if(a.document.hasFocus())return!0;return!!FFo()}function Rt(a){for(;a.firstChild;)a.firstChild.remove()}var NJt=class{constructor(i,e,t,o){this._node=i,this._type=e,this._handler=t,this._options=o||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function j(a,i,e,t){return new NJt(a,i,e,t)}function HJt(a,i){return function(e){return i(new Cn(a,e))}}function VFo(a){return function(i){return a(new gi(i))}}var Jo=function(i,e,t,o){let n=t;return e==="click"||e==="mousedown"||e==="contextmenu"?n=HJt(Re(i),t):(e==="keydown"||e==="keypress"||e==="keyup")&&(n=VFo(t)),j(i,e,n,o)},DIe=function(i,e,t){let o=HJt(Re(i),e);return q$(i,o,t)},ygt=function(i,e,t){let o=HJt(Re(i),e);return pae(i,o,t)};function q$(a,i,e){return j(a,dc&&yg.pointerEvents?re.POINTER_DOWN:re.MOUSE_DOWN,i,e)}function LIe(a,i,e){return j(a,dc&&yg.pointerEvents?re.POINTER_MOVE:re.MOUSE_MOVE,i,e)}function pae(a,i,e){return j(a,dc&&yg.pointerEvents?re.POINTER_UP:re.MOUSE_UP,i,e)}function rf(a,i,e){return fIe(a,i,e)}var lO=class extends w$e{constructor(i,e){super(i,e)}},zh,Wr;function zI(a,i,e,t){let o=0,n=a.setInterval(()=>{o++,(typeof t=="number"&&o>=t||i()===!0)&&r.dispose()},e),r=Z(()=>{a.clearInterval(n)});return r}var FL=class extends FI{constructor(i){super(),this.defaultTarget=i&&Re(i)}cancelAndSet(i,e,t){return super.cancelAndSet(i,e,t??this.defaultTarget)}},N$e=class{constructor(i,e=0){this._runner=i,this.priority=e,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(i){mt(i)}}static sort(i,e){return e.priority-i.priority}};(function(){let a=new Map,i=new Map,e=new Map,t=new Map,o=n=>{e.set(n,!1);let r=a.get(n)??[];for(i.set(n,r),a.set(n,[]),t.set(n,!0);r.length>0;)r.sort(N$e.sort),r.shift().execute();t.set(n,!1)};Wr=(n,r,s=0)=>{let l=gv(n),c=new N$e(r,s),u=a.get(l);return u||(u=[],a.set(l,u)),u.push(c),e.get(l)||(e.set(l,!0),n.requestAnimationFrame(()=>o(l))),c},zh=(n,r,s)=>{let l=gv(n);if(t.get(l)){let c=new N$e(r,s),u=i.get(l);return u||(u=[],i.set(l,u)),u.push(c),c}else return Wr(n,r,s)}})();function UJt(a,i){return Wr(a,i,1e4)}function Q9(a,i){return Wr(a,i,-1e4)}var Igt=class{constructor(i,e){this.pendingRunner=new me;this.node=i,this.runner=e}dispose(){this.pendingRunner.dispose()}cancel(){this.pendingRunner.clear()}schedule(){this.pendingRunner.value||(this.pendingRunner.value=zh(Re(this.node),()=>{this.pendingRunner.clear(),this.runner()}))}isScheduled(){return this.pendingRunner.value!==void 0}};function y1(a){return Re(a).getComputedStyle(a,null)}function $m(a,i,e){let t=Re(a),o=t.document;if(a!==o.body)return new si(a.clientWidth,a.clientHeight);if(dc&&t?.visualViewport)return new si(t.visualViewport.width,t.visualViewport.height);if(t?.innerWidth&&t.innerHeight)return new si(t.innerWidth,t.innerHeight);if(o.body&&o.body.clientWidth&&o.body.clientHeight)return new si(o.body.clientWidth,o.body.clientHeight);if(o.documentElement&&o.documentElement.clientWidth&&o.documentElement.clientHeight)return new si(o.documentElement.clientWidth,o.documentElement.clientHeight);if(e)return $m(e,i);if(i)return i;throw new Error("Unable to figure out browser width and height")}var bC=class a{static convertToPixels(i,e){return parseFloat(e)||0}static getDimension(i,e){let t=y1(i),o=t?t.getPropertyValue(e):"0";return a.convertToPixels(i,o)}static getBorderLeftWidth(i){return a.getDimension(i,"border-left-width")}static getBorderRightWidth(i){return a.getDimension(i,"border-right-width")}static getBorderTopWidth(i){return a.getDimension(i,"border-top-width")}static getBorderBottomWidth(i){return a.getDimension(i,"border-bottom-width")}static getPaddingLeft(i){return a.getDimension(i,"padding-left")}static getPaddingRight(i){return a.getDimension(i,"padding-right")}static getPaddingTop(i){return a.getDimension(i,"padding-top")}static getPaddingBottom(i){return a.getDimension(i,"padding-bottom")}static getMarginLeft(i){return a.getDimension(i,"margin-left")}static getMarginTop(i){return a.getDimension(i,"margin-top")}static getMarginRight(i){return a.getDimension(i,"margin-right")}static getMarginBottom(i){return a.getDimension(i,"margin-bottom")}},si=class a{constructor(i,e){this.width=i;this.height=e}static{this.None=new a(0,0)}with(i=this.width,e=this.height){return i!==this.width||e!==this.height?new a(i,e):this}static is(i){return typeof i=="object"&&typeof i.height=="number"&&typeof i.width=="number"}static lift(i){return i instanceof a?i:new a(i.width,i.height)}static equals(i,e){return i===e?!0:!i||!e?!1:i.width===e.width&&i.height===e.height}};function cO(a){let i=a.offsetParent,e=a.offsetTop,t=a.offsetLeft;for(;(a=a.parentNode)!==null&&a!==a.ownerDocument.body&&a!==a.ownerDocument.documentElement;){e-=a.scrollTop;let o=Kqi(a)?null:y1(a);o&&(t-=o.direction!=="rtl"?a.scrollLeft:-a.scrollLeft),a===i&&(t+=bC.getBorderLeftWidth(a),e+=bC.getBorderTopWidth(a),e+=a.offsetTop,t+=a.offsetLeft,i=a.offsetParent)}return{left:t,top:e}}function VL(a,i,e){typeof i=="number"&&(a.style.width=`${i}px`),typeof e=="number"&&(a.style.height=`${e}px`)}function Hqi(a,i,e,t,o,n="absolute"){typeof i=="number"&&(a.style.top=`${i}px`),typeof e=="number"&&(a.style.right=`${e}px`),typeof t=="number"&&(a.style.bottom=`${t}px`),typeof o=="number"&&(a.style.left=`${o}px`),a.style.position=n}function ir(a){let i=a.getBoundingClientRect(),e=Re(a);return{left:i.left+e.scrollX,top:i.top+e.scrollY,width:i.width,height:i.height}}function Y9(a){let i=a,e=1;do{let t=y1(i).zoom;t!=null&&t!=="1"&&(e*=t),i=i.parentElement}while(i!==null&&i!==i.ownerDocument.documentElement);return e}function zl(a){let i=bC.getMarginLeft(a)+bC.getMarginRight(a);return a.offsetWidth+i}function X9(a){let i=bC.getBorderLeftWidth(a)+bC.getBorderRightWidth(a),e=bC.getPaddingLeft(a)+bC.getPaddingRight(a);return a.offsetWidth-i-e}function BFo(a){let i=bC.getMarginLeft(a)+bC.getMarginRight(a);return a.scrollWidth+i}function RIe(a){let i=bC.getBorderTopWidth(a)+bC.getBorderBottomWidth(a),e=bC.getPaddingTop(a)+bC.getPaddingBottom(a);return a.offsetHeight-i-e}function mh(a){let i=bC.getMarginTop(a)+bC.getMarginBottom(a);return a.offsetHeight+i}function HFo(a,i){if(a===null)return 0;let e=cO(a),t=cO(i);return e.left-t.left}function MIe(a,i){let e=i.map(o=>Math.max(BFo(o),zl(o))+HFo(o,a)||0);return Math.max(...e)}function ts(a,i){return!!i?.contains(a)}var Uqi="parentFlowToElementId";function dO(a,i){a.dataset[Uqi]=i.id}function UFo(a){let i=a.dataset[Uqi];return typeof i=="string"?a.ownerDocument.getElementById(i):null}function zqi(a,i){let e=a;for(;e;){if(e===i)return!0;if(Do(e)){let t=UFo(e);if(t){e=t;continue}}e=e.parentNode}return!1}function Cg(a,i,e){for(;a&&a.nodeType===a.ELEMENT_NODE;){if(a.classList.contains(i))return a;if(e){if(typeof e=="string"){if(a.classList.contains(e))return null}else if(a===e)return null}a=a.parentNode}return null}function PIe(a,i,e){return!!Cg(a,i,e)}function Kqi(a){return a&&!!a.host&&!!a.mode}function $$(a){return!!bP(a)}function bP(a){for(;a.parentNode;){if(a===a.ownerDocument?.body)return null;a=a.parentNode}return Kqi(a)?a:null}function Nn(){let a=sm().activeElement;for(;a?.shadowRoot;)a=a.shadowRoot.activeElement;return a}function wa(a){return Nn()===a}function Gr(a){return ts(Nn(),a)}function wgt(a){return a.ownerDocument===sm()}function sm(){if(_Ie()<=1)return ut.document;let i=Array.from(SC()).map(({window:t})=>t.document).find(t=>t.hasFocus());if(i)return i;let e=WFo();return e?e.document:ut.document}function Ki(){return sm().defaultView?.window??ut}var F$e=new class{constructor(){this.mutationObservers=new Map}observe(a,i,e){let t=this.mutationObservers.get(a);t||(t=new Map,this.mutationObservers.set(a,t));let o=_r(e),n=t.get(o);if(n)n.users+=1;else{let r=new E,s=new MutationObserver(c=>r.fire(c));s.observe(a,e);let l=n={users:1,observer:s,onDidMutate:r.event};i.add(Z(()=>{l.users-=1,l.users===0&&(r.dispose(),s.disconnect(),t?.delete(o),t?.size===0&&this.mutationObservers.delete(a))})),t.set(o,n)}return n.onDidMutate}};function Cgt(a=ut.document.head){return Gqi("meta",a)}function xgt(a=ut.document.head){return Gqi("link",a)}function Gqi(a,i=ut.document.head){let e=document.createElement(a);return i.appendChild(e),e}function Do(a){return a instanceof HTMLElement||a instanceof Re(a).HTMLElement}function W$e(a){return a instanceof HTMLAnchorElement||a instanceof Re(a).HTMLAnchorElement}function J9(a){return a instanceof HTMLTextAreaElement||a instanceof Re(a).HTMLTextAreaElement}function mae(a){return a instanceof HTMLInputElement||a instanceof Re(a).HTMLInputElement}function qqi(a){return a instanceof HTMLButtonElement||a instanceof Re(a).HTMLButtonElement}function zJt(a){return a instanceof HTMLDivElement||a instanceof Re(a).HTMLDivElement}function KJt(a){return a instanceof SVGElement||a instanceof Re(a).SVGElement}function Ru(a){return a instanceof MouseEvent||a instanceof Re(a).MouseEvent}function xg(a){return a instanceof KeyboardEvent||a instanceof Re(a).KeyboardEvent}function kgt(a){return a instanceof PointerEvent||a instanceof Re(a).PointerEvent}function $qi(a){return a instanceof DragEvent||a instanceof Re(a).DragEvent}var re={CLICK:"click",AUXCLICK:"auxclick",DBLCLICK:"dblclick",MOUSE_UP:"mouseup",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_MOVE:"mousemove",MOUSE_OUT:"mouseout",MOUSE_ENTER:"mouseenter",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",POINTER_LEAVE:"pointerleave",CONTEXT_MENU:"contextmenu",WHEEL:"wheel",KEY_DOWN:"keydown",KEY_PRESS:"keypress",KEY_UP:"keyup",LOAD:"load",BEFORE_UNLOAD:"beforeunload",UNLOAD:"unload",PAGE_SHOW:"pageshow",PAGE_HIDE:"pagehide",PASTE:"paste",ABORT:"abort",ERROR:"error",RESIZE:"resize",SCROLL:"scroll",FULLSCREEN_CHANGE:"fullscreenchange",WK_FULLSCREEN_CHANGE:"webkitfullscreenchange",SELECT:"select",CHANGE:"change",SUBMIT:"submit",RESET:"reset",FOCUS:"focus",FOCUS_IN:"focusin",FOCUS_OUT:"focusout",BLUR:"blur",INPUT:"input",STORAGE:"storage",DRAG_START:"dragstart",DRAG:"drag",DRAG_ENTER:"dragenter",DRAG_LEAVE:"dragleave",DRAG_OVER:"dragover",DROP:"drop",DRAG_END:"dragend",ANIMATION_START:lV?"webkitAnimationStart":"animationstart",ANIMATION_END:lV?"webkitAnimationEnd":"animationend",ANIMATION_ITERATION:lV?"webkitAnimationIteration":"animationiteration"};function Egt(a){let i=a;return!!(i&&typeof i.preventDefault=="function"&&typeof i.stopPropagation=="function")}var Xt={stop:(a,i)=>(a.preventDefault(),i&&a.stopPropagation(),a)};function jqi(a){let i=[];for(let e=0;a&&a.nodeType===a.ELEMENT_NODE;e++)i[e]=a.scrollTop,a=a.parentNode;return i}function Qqi(a,i){for(let e=0;a&&a.nodeType===a.ELEMENT_NODE;e++)a.scrollTop!==i[e]&&(a.scrollTop=i[e]),a=a.parentNode}var OJt=class a extends x{constructor(e){super();this._onDidFocus=this._register(new E);this._onDidBlur=this._register(new E);let t=a.hasFocusWithin(e),o=!1,n=()=>{o=!1,t||(t=!0,this._onDidFocus.fire())},r=()=>{t&&(o=!0,(Do(e)?Re(e):e).setTimeout(()=>{o&&(o=!1,t=!1,this._onDidBlur.fire())},0))};this._refreshStateHandler=()=>{a.hasFocusWithin(e)!==t&&(t?r():n())},this._register(j(e,re.FOCUS,n,!0)),this._register(j(e,re.BLUR,r,!0)),Do(e)&&(this._register(j(e,re.FOCUS_IN,()=>this._refreshStateHandler())),this._register(j(e,re.FOCUS_OUT,()=>this._refreshStateHandler())))}get onDidFocus(){return this._onDidFocus.event}get onDidBlur(){return this._onDidBlur.event}static hasFocusWithin(e){if(Do(e)){let t=bP(e),o=t?t.activeElement:e.ownerDocument.activeElement;return ts(o,e)}else{let t=e;return ts(t.document.activeElement,t.document)}}refreshState(){this._refreshStateHandler()}};function qn(a){return new OJt(a)}function Tgt(a,i){return a.after(i),i}function M(a,...i){if(a.append(...i),i.length===1&&typeof i[0]!="string")return i[0]}function KS(a,i){return a.insertBefore(i,a.firstChild),i}function vi(a,...i){a.textContent="",M(a,...i)}var zFo=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function Yqi(a,i,e,...t){let o=zFo.exec(i);if(!o)throw new Error("Bad use of emmet");let n=o[1]||"div",r;return a!=="http://www.w3.org/1999/xhtml"?r=document.createElementNS(a,n):r=document.createElement(n),o[3]&&(r.id=o[3]),o[4]&&(r.className=o[4].replace(/\./g," ").trim()),e&&Object.entries(e).forEach(([s,l])=>{typeof l>"u"||(/^on\w+$/.test(s)?r[s]=l:s==="selected"?l&&r.setAttribute(s,"true"):r.setAttribute(s,l))}),r.append(...t),r}function _(a,i,...e){return Yqi("http://www.w3.org/1999/xhtml",a,i,...e)}_.SVG=function(a,i,...e){return Yqi("http://www.w3.org/2000/svg",a,i,...e)};function hh(a,...i){a?un(...i):vo(...i)}function un(...a){for(let i of a)i.style.display="",i.removeAttribute("aria-hidden")}function vo(...a){for(let i of a)i.style.display="none",i.setAttribute("aria-hidden","true")}function AIe(a){return i=>{i.preventDefault(),i.stopPropagation(),a(i)}}function Xqi(a){return new Promise(i=>{if(a.document.readyState==="complete"||a.document&&a.document.body!==null)i(void 0);else{let t=()=>{a.window.removeEventListener("DOMContentLoaded",t,!1),i()};a.window.addEventListener("DOMContentLoaded",t,!1)}})}function NIe(a,i){let e=a.devicePixelRatio*i;return Math.max(1,Math.floor(e))/a.devicePixelRatio}function V$e(a){ut.open(a,"_blank","noopener")}var Lqi=780,Rqi=640;function GJt(a){let i=Math.floor(ut.screenLeft+ut.innerWidth/2-Lqi/2),e=Math.floor(ut.screenTop+ut.innerHeight/2-Rqi/2);ut.open(a,"_blank",`width=${Lqi},height=${Rqi},top=${e},left=${i}`)}function Jqi(a,i=!0){let e=ut.open();return e?(i&&(e.opener=null),e.location.href=a,!0):!1}function Zqi(a,i){let e=()=>{i(),t=Wr(a,e)},t=Wr(a,e);return Z(()=>t.dispose())}RL.setPreferredWebSchema(/^https:/.test(ut.location.href)?"https":"http");function e$i(a,i){let e;if(A.isUri(a))e=a.toString(!0);else{let n=new Blob([a]);e=URL.createObjectURL(n),setTimeout(()=>URL.revokeObjectURL(e))}let t=Ki(),o=document.createElement("a");t.document.body.appendChild(o),o.download=i,o.href=e,o.click(),setTimeout(()=>o.remove())}function t$i(){return new Promise(a=>{let i=Ki(),e=document.createElement("input");i.document.body.appendChild(e),e.type="file",e.multiple=!0,U.once(U.fromDOMEventEmitter(e,"input"))(()=>{a(e.files??void 0)}),e.click(),setTimeout(()=>e.remove())})}var nb=class a extends E{constructor(){super();this._subscriptions=new N;this._keyStatus={altKey:!1,shiftKey:!1,ctrlKey:!1,metaKey:!1},this._subscriptions.add(U.runAndSubscribe(nf,({window:e,disposables:t})=>this.registerListeners(e,t),{window:ut,disposables:this._subscriptions}))}registerListeners(e,t){t.add(j(e,"keydown",o=>{if(o.defaultPrevented)return;let n=new gi(o);if(!(n.keyCode===6&&o.repeat)){if(o.altKey&&!this._keyStatus.altKey)this._keyStatus.lastKeyPressed="alt";else if(o.ctrlKey&&!this._keyStatus.ctrlKey)this._keyStatus.lastKeyPressed="ctrl";else if(o.metaKey&&!this._keyStatus.metaKey)this._keyStatus.lastKeyPressed="meta";else if(o.shiftKey&&!this._keyStatus.shiftKey)this._keyStatus.lastKeyPressed="shift";else if(n.keyCode!==6)this._keyStatus.lastKeyPressed=void 0;else return;this._keyStatus.altKey=o.altKey,this._keyStatus.ctrlKey=o.ctrlKey,this._keyStatus.metaKey=o.metaKey,this._keyStatus.shiftKey=o.shiftKey,this._keyStatus.lastKeyPressed&&(this._keyStatus.event=o,this.fire(this._keyStatus))}},!0)),t.add(j(e,"keyup",o=>{o.defaultPrevented||(!o.altKey&&this._keyStatus.altKey?this._keyStatus.lastKeyReleased="alt":!o.ctrlKey&&this._keyStatus.ctrlKey?this._keyStatus.lastKeyReleased="ctrl":!o.metaKey&&this._keyStatus.metaKey?this._keyStatus.lastKeyReleased="meta":!o.shiftKey&&this._keyStatus.shiftKey?this._keyStatus.lastKeyReleased="shift":this._keyStatus.lastKeyReleased=void 0,this._keyStatus.lastKeyPressed!==this._keyStatus.lastKeyReleased&&(this._keyStatus.lastKeyPressed=void 0),this._keyStatus.altKey=o.altKey,this._keyStatus.ctrlKey=o.ctrlKey,this._keyStatus.metaKey=o.metaKey,this._keyStatus.shiftKey=o.shiftKey,this._keyStatus.lastKeyReleased&&(this._keyStatus.event=o,this.fire(this._keyStatus)))},!0)),t.add(j(e.document.body,"mousedown",()=>{this._keyStatus.lastKeyPressed=void 0},!0)),t.add(j(e.document.body,"mouseup",()=>{this._keyStatus.lastKeyPressed=void 0},!0)),t.add(j(e.document.body,"mousemove",o=>{o.buttons&&(this._keyStatus.lastKeyPressed=void 0)},!0)),t.add(j(e,"blur",()=>{this.resetKeyStatus()}))}get keyStatus(){return this._keyStatus}get isModifierPressed(){return Mht(this._keyStatus)}resetKeyStatus(){this.doResetKeyStatus(),this.fire(this._keyStatus)}doResetKeyStatus(){this._keyStatus={altKey:!1,shiftKey:!1,ctrlKey:!1,metaKey:!1}}static getInstance(){return a.instance||(a.instance=new a),a.instance}static disposeInstance(){a.instance&&(a.instance.dispose(),a.instance=void 0)}dispose(){super.dispose(),this._subscriptions.dispose()}};var Uh=class extends x{constructor(e,t){super();this.element=e;this.callbacks=t;this.counter=0;this.dragStartTime=0;this.registerListeners()}registerListeners(){this.callbacks.onDragStart&&this._register(j(this.element,re.DRAG_START,e=>{this.callbacks.onDragStart?.(e)})),this.callbacks.onDrag&&this._register(j(this.element,re.DRAG,e=>{this.callbacks.onDrag?.(e)})),this._register(j(this.element,re.DRAG_ENTER,e=>{this.counter++,this.dragStartTime=e.timeStamp,this.callbacks.onDragEnter?.(e)})),this._register(j(this.element,re.DRAG_OVER,e=>{e.preventDefault(),this.callbacks.onDragOver?.(e,e.timeStamp-this.dragStartTime)})),this._register(j(this.element,re.DRAG_LEAVE,e=>{this.counter--,this.counter===0&&(this.dragStartTime=0,this.callbacks.onDragLeave?.(e))})),this._register(j(this.element,re.DRAG_END,e=>{this.counter=0,this.dragStartTime=0,this.callbacks.onDragEnd?.(e)})),this._register(j(this.element,re.DROP,e=>{this.counter=0,this.dragStartTime=0,this.callbacks.onDrop?.(e)}))}},WL=class extends x{constructor(i){super(),this.observer=new ResizeObserver(i),this._register(Z(()=>this.observer.disconnect()))}observe(i,e){return this.observer.observe(i,e),Z(()=>this.observer.unobserve(i))}},i$i=/(?<tag>[\w\-]+)?(?:#(?<id>[\w\-]+))?(?<class>(?:\.(?:[\w\-]+))*)(?:@(?<name>(?:[\w\_])+))?/;function ct(a,...i){let e,t;Array.isArray(i[0])?(e={},t=i[0]):(e=i[0]||{},t=i[1]);let o=i$i.exec(a);if(!o||!o.groups)throw new Error("Bad use of h");let n=o.groups.tag||"div",r=document.createElement(n);o.groups.id&&(r.id=o.groups.id);let s=[];if(o.groups.class)for(let c of o.groups.class.split("."))c!==""&&s.push(c);if(e.className!==void 0)for(let c of e.className.split("."))c!==""&&s.push(c);s.length>0&&(r.className=s.join(" "));let l={};if(o.groups.name&&(l[o.groups.name]=r),t)for(let c of t)Do(c)?r.appendChild(c):typeof c=="string"?r.append(c):"root"in c&&(Object.assign(l,c),r.appendChild(c.root));for(let[c,u]of Object.entries(e))if(c!=="className")if(c==="style")for(let[p,h]of Object.entries(u))r.style.setProperty(dae(p),typeof h=="number"?h+"px":""+h);else c==="tabIndex"?r.tabIndex=u:r.setAttribute(dae(c),u.toString());return l.root=r,l}function o$i(a,...i){let e,t;Array.isArray(i[0])?(e={},t=i[0]):(e=i[0]||{},t=i[1]);let o=i$i.exec(a);if(!o||!o.groups)throw new Error("Bad use of h");let n=o.groups.tag||"div",r=document.createElementNS("http://www.w3.org/2000/svg",n);o.groups.id&&(r.id=o.groups.id);let s=[];if(o.groups.class)for(let c of o.groups.class.split("."))c!==""&&s.push(c);if(e.className!==void 0)for(let c of e.className.split("."))c!==""&&s.push(c);s.length>0&&(r.className=s.join(" "));let l={};if(o.groups.name&&(l[o.groups.name]=r),t)for(let c of t)Do(c)?r.appendChild(c):typeof c=="string"?r.append(c):"root"in c&&(Object.assign(l,c),r.appendChild(c.root));for(let[c,u]of Object.entries(e))if(c!=="className")if(c==="style")for(let[p,h]of Object.entries(u))r.style.setProperty(dae(p),typeof h=="number"?h+"px":""+h);else c==="tabIndex"?r.tabIndex=u:r.setAttribute(dae(c),u.toString());return l.root=r,l}function dae(a){return a.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function _gt(a,i,e){for(let{name:t,value:o}of a.attributes)(!e||e.includes(t))&&i.setAttribute(t,o)}function KFo(a,i,e){let t=a.getAttribute(e);t?i.setAttribute(e,t):i.removeAttribute(e)}function Dgt(a,i,e){_gt(a,i,e);let t=new N;return t.add(F$e.observe(a,t,{attributes:!0,attributeFilter:e})(o=>{for(let n of o)n.type==="attributes"&&n.attributeName&&KFo(a,i,n.attributeName)})),t}function Kh(a){return a.tagName.toLowerCase()==="input"||a.tagName.toLowerCase()==="textarea"||Do(a)&&!!a.editContext}var O$e=class{constructor(i,e,t){this.originX=i;this.originY=e;this.points=new Int16Array(8);let{top:o,left:n,right:r,bottom:s}=t.getBoundingClientRect(),l=this.points,c=0;l[c++]=n,l[c++]=o,l[c++]=r,l[c++]=o,l[c++]=n,l[c++]=s,l[c++]=r,l[c++]=s}contains(i,e){let{points:t,originX:o,originY:n}=this;for(let r=0;r<4;r++){let s=2*r,l=2*((r+1)%4);if(dqi(i,e,o,n,t[s],t[s+1],t[l],t[l+1]))return!0}return!1}},Bo;(s=>{function a(l=void 0){return(c,u,p)=>{let h=u.class;delete u.class;let g=u.ref;delete u.ref;let f=u.obsRef;return delete u.obsRef,new VJt(c,g,f,l,h,u,p)}}function i(l,c=void 0){let u=a(c);return(p,h)=>u(l,p,h)}s.div=i("div"),s.elem=a(void 0),s.svg=i("svg","http://www.w3.org/2000/svg"),s.svgElem=a("http://www.w3.org/2000/svg");function r(){let l,c=function(u){l=u};return Object.defineProperty(c,"element",{get(){if(!l)throw new li("Make sure the ref is set before accessing the element. Maybe wrong initialization order?");return l}}),c}s.ref=r})(Bo||={});var FJt=class a{constructor(i,e,t,o,n,r,s){this._deriveds=[];this._isHovered=void 0;this._didMouseMoveDuringHover=void 0;this._element=o?document.createElementNS(o,i):document.createElement(i),e&&e(this._element),t&&this._deriveds.push(ke(l=>{t(this),l.store.add({dispose:()=>{t(null)}})})),n&&(r$i(n)?this._deriveds.push(ke(this,l=>{Mqi(this._element,Pqi(n,l))})):Mqi(this._element,Pqi(n,void 0)));for(let[l,c]of Object.entries(r))if(l==="style")for(let[u,p]of Object.entries(c)){let h=dae(u);rO(p)?this._deriveds.push(Os({owner:this,debugName:()=>`set.style.${h}`},g=>{this._element.style.setProperty(h,Aqi(p.read(g)))})):this._element.style.setProperty(h,Aqi(p))}else l==="tabIndex"?rO(c)?this._deriveds.push(ke(this,u=>{this._element.tabIndex=c.read(u)})):this._element.tabIndex=c:l.startsWith("on")?this._element[l]=c:rO(c)?this._deriveds.push(Os({owner:this,debugName:()=>`set.${l}`},u=>{Nqi(this._element,l,c.read(u))})):Nqi(this._element,l,c);if(s){let l=function(u,p){return rO(p)?l(u,p.read(u)):Array.isArray(p)?p.flatMap(h=>l(u,h)):p instanceof a?(u&&p.readEffect(u),[p._element]):p?[p]:[]},c=ke(this,u=>{this._element.replaceChildren(...l(u,s))});this._deriveds.push(c),s$i(s)||c.get()}}readEffect(i){for(let e of this._deriveds)e.read(i)}keepUpdated(i){return ke(e=>{this.readEffect(e)}).recomputeInitiallyAndOnChange(i),this}toDisposableLiveElement(){let i=new N;return this.keepUpdated(i),new WJt(this._element,i)}get isHovered(){if(!this._isHovered){let i=Me("hovered",!1);this._element.addEventListener("mouseenter",e=>i.set(!0,void 0)),this._element.addEventListener("mouseleave",e=>i.set(!1,void 0)),this._isHovered=i}return this._isHovered}get didMouseMoveDuringHover(){if(!this._didMouseMoveDuringHover){let i=!1,e=Me("didMouseMoveDuringHover",!1);this._element.addEventListener("mouseenter",t=>{i=!0}),this._element.addEventListener("mousemove",t=>{i&&e.set(!0,void 0)}),this._element.addEventListener("mouseleave",t=>{i=!1,e.set(!1,void 0)}),this._didMouseMoveDuringHover=e}return this._didMouseMoveDuringHover}};function Mqi(a,i){KJt(a)?a.setAttribute("class",i):a.className=i}function n$i(a,i,e){if(rO(a)){e(a.read(i));return}if(Array.isArray(a)){for(let t of a)n$i(t,i,e);return}e(a)}function Pqi(a,i){let e="";return n$i(a,i,t=>{t&&(e.length===0?e=t:e+=" "+t)}),e}function r$i(a){return rO(a)?!0:Array.isArray(a)?a.some(i=>r$i(i)):!1}function Aqi(a){return typeof a=="number"?a+"px":a}function s$i(a){return rO(a)?!0:Array.isArray(a)?a.some(i=>s$i(i)):!1}var WJt=class{constructor(i,e){this.element=i;this._disposable=e}dispose(){this._disposable.dispose()}},VJt=class extends FJt{get element(){return this._element}};function Nqi(a,i,e){e==null?a.removeAttribute(dae(i)):a.setAttribute(dae(i),String(e))}var BJt=class extends HTMLElement{disconnectedCallback(){this.onDidDisconnect?.()}connectedCallback(){this.onDidConnect?.()}};customElements.get("connection-observer")||customElements.define("connection-observer",BJt);var a$i=2e4,hae,Lgt,qJt,Rgt,$Jt;function l$i(a){hae=document.createElement("div"),hae.className="monaco-aria-container";let i=()=>{let t=document.createElement("div");return t.className="monaco-alert",t.setAttribute("role","alert"),t.setAttribute("aria-atomic","true"),hae.appendChild(t),t};Lgt=i(),qJt=i();let e=()=>{let t=document.createElement("div");return t.className="monaco-status",t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),hae.appendChild(t),t};Rgt=e(),$Jt=e(),a.appendChild(hae)}function en(a){hae&&(Lgt.textContent!==a?(Rt(qJt),Mgt(Lgt,a)):(Rt(Lgt),Mgt(qJt,a)))}function qr(a){hae&&(Rgt.textContent!==a?(Rt($Jt),Mgt(Rgt,a)):(Rt(Rgt),Mgt($Jt,a)))}function Mgt(a,i){Rt(a),i.length>a$i&&(i=i.substr(0,a$i)),a.textContent=i,a.style.visibility="hidden",a.style.visibility="visible"}var yV;(o=>{o.serviceIds=new Map,o.DI_TARGET="$di$target",o.DI_DEPENDENCIES="$di$dependencies";function t(n){return n[o.DI_DEPENDENCIES]||[]}o.getServiceDependencies=t})(yV||={});var F=le("instantiationService");function GFo(a,i,e){i[yV.DI_TARGET]===i?i[yV.DI_DEPENDENCIES].push({id:a,index:e}):(i[yV.DI_DEPENDENCIES]=[{id:a,index:e}],i[yV.DI_TARGET]=i)}function le(a){if(yV.serviceIds.has(a))return yV.serviceIds.get(a);let i=function(e,t,o){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");GFo(i,e,o)};return i.toString=()=>a,yV.serviceIds.set(a,i),i}var qt=le("codeEditorService");var ye=class a{constructor(i,e){this.lineNumber=i,this.column=e}with(i=this.lineNumber,e=this.column){return i===this.lineNumber&&e===this.column?this:new a(i,e)}delta(i=0,e=0){return this.with(Math.max(1,this.lineNumber+i),Math.max(1,this.column+e))}equals(i){return a.equals(this,i)}static equals(i,e){return!i&&!e?!0:!!i&&!!e&&i.lineNumber===e.lineNumber&&i.column===e.column}isBefore(i){return a.isBefore(this,i)}static isBefore(i,e){return i.lineNumber<e.lineNumber?!0:e.lineNumber<i.lineNumber?!1:i.column<e.column}isBeforeOrEqual(i){return a.isBeforeOrEqual(this,i)}static isBeforeOrEqual(i,e){return i.lineNumber<e.lineNumber?!0:e.lineNumber<i.lineNumber?!1:i.column<=e.column}static compare(i,e){let t=i.lineNumber|0,o=e.lineNumber|0;if(t===o){let n=i.column|0,r=e.column|0;return n-r}return t-o}clone(){return new a(this.lineNumber,this.column)}toString(){return"("+this.lineNumber+","+this.column+")"}static lift(i){return new a(i.lineNumber,i.column)}static isIPosition(i){return!!i&&typeof i.lineNumber=="number"&&typeof i.column=="number"}toJSON(){return{lineNumber:this.lineNumber,column:this.column}}};var Tt=le("modelService");var Bt=le("textModelService");function c$i(a){return!!a.textEditorModel}var it=class extends x{constructor(e,t="",o="",n=!0,r){super();this._onDidChange=this._register(new E);this._enabled=!0;this._id=e,this._label=t,this._cssClass=o,this._enabled=n,this._actionCallback=r}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,t){this._actionCallback&&await this._actionCallback(e)}},rs=class extends x{constructor(){super(...arguments);this._onWillRun=this._register(new E);this._onDidRun=this._register(new E)}get onWillRun(){return this._onWillRun.event}get onDidRun(){return this._onDidRun.event}async run(e,t){if(!e.enabled)return;this._onWillRun.fire({action:e});let o;try{await this.runAction(e,t)}catch(n){o=n}this._onDidRun.fire({action:e,error:o})}async runAction(e,t){await e.run(t)}},ri=class a{constructor(){this.id=a.ID;this.label="";this.tooltip="";this.class="separator";this.enabled=!1;this.checked=void 0}static join(...i){let e=[];for(let t of i)t.length&&(e.length?e=[...e,new a,...t]:e=t);return e}static clean(i){for(;i.length>0&&i[0].id===a.ID;)i.shift();for(;i.length>0&&i[i.length-1].id===a.ID;)i.pop();for(let e=i.length-2;e>=0;e--)i[e].id===a.ID&&i[e+1].id===a.ID&&i.splice(e+1,1);return i}static{this.ID="vs.actions.separator"}async run(){}},Fs=class{constructor(i,e,t,o){this.tooltip="";this.enabled=!0;this.checked=void 0;this.id=i,this.label=e,this.class=o,this._actions=t}get actions(){return this._actions}async run(){}},Pgt=class a extends it{static{this.ID="vs.actions.empty"}constructor(){super(a.ID,d(46,null),void 0,!1)}};function ii(a){return{id:a.id,label:a.label,tooltip:a.tooltip??a.label,class:a.class,enabled:a.enabled??!0,checked:a.checked,run:async(...i)=>a.run(...i)}}var jJt=Object.create(null);function ue(a,i){if(Fe(i)){let e=jJt[i];if(e===void 0)throw new Error(`${a} references an unknown codicon: ${i}`);i=e}return jJt[a]=i,{id:a}}function Agt(){return jJt}var Z9={add:ue("add",6e4),plus:ue("plus",6e4),gistNew:ue("gist-new",6e4),repoCreate:ue("repo-create",6e4),lightbulb:ue("lightbulb",60001),lightBulb:ue("light-bulb",60001),repo:ue("repo",60002),repoDelete:ue("repo-delete",60002),gistFork:ue("gist-fork",60003),repoForked:ue("repo-forked",60003),gitPullRequest:ue("git-pull-request",60004),gitPullRequestAbandoned:ue("git-pull-request-abandoned",60004),recordKeys:ue("record-keys",60005),keyboard:ue("keyboard",60005),tag:ue("tag",60006),gitPullRequestLabel:ue("git-pull-request-label",60006),tagAdd:ue("tag-add",60006),tagRemove:ue("tag-remove",60006),person:ue("person",60007),personFollow:ue("person-follow",60007),personOutline:ue("person-outline",60007),personFilled:ue("person-filled",60007),sourceControl:ue("source-control",60008),mirror:ue("mirror",60009),mirrorPublic:ue("mirror-public",60009),star:ue("star",60010),starAdd:ue("star-add",60010),starDelete:ue("star-delete",60010),starEmpty:ue("star-empty",60010),comment:ue("comment",60011),commentAdd:ue("comment-add",60011),alert:ue("alert",60012),warning:ue("warning",60012),search:ue("search",60013),searchSave:ue("search-save",60013),logOut:ue("log-out",60014),signOut:ue("sign-out",60014),logIn:ue("log-in",60015),signIn:ue("sign-in",60015),eye:ue("eye",60016),eyeUnwatch:ue("eye-unwatch",60016),eyeWatch:ue("eye-watch",60016),circleFilled:ue("circle-filled",60017),primitiveDot:ue("primitive-dot",60017),closeDirty:ue("close-dirty",60017),debugBreakpoint:ue("debug-breakpoint",60017),debugBreakpointDisabled:ue("debug-breakpoint-disabled",60017),debugHint:ue("debug-hint",60017),terminalDecorationSuccess:ue("terminal-decoration-success",60017),primitiveSquare:ue("primitive-square",60018),edit:ue("edit",60019),pencil:ue("pencil",60019),info:ue("info",60020),issueOpened:ue("issue-opened",60020),gistPrivate:ue("gist-private",60021),gitForkPrivate:ue("git-fork-private",60021),lock:ue("lock",60021),mirrorPrivate:ue("mirror-private",60021),close:ue("close",60022),removeClose:ue("remove-close",60022),x:ue("x",60022),repoSync:ue("repo-sync",60023),sync:ue("sync",60023),clone:ue("clone",60024),desktopDownload:ue("desktop-download",60024),beaker:ue("beaker",60025),microscope:ue("microscope",60025),vm:ue("vm",60026),deviceDesktop:ue("device-desktop",60026),file:ue("file",60027),more:ue("more",60028),ellipsis:ue("ellipsis",60028),kebabHorizontal:ue("kebab-horizontal",60028),mailReply:ue("mail-reply",60029),reply:ue("reply",60029),organization:ue("organization",60030),organizationFilled:ue("organization-filled",60030),organizationOutline:ue("organization-outline",60030),newFile:ue("new-file",60031),fileAdd:ue("file-add",60031),newFolder:ue("new-folder",60032),fileDirectoryCreate:ue("file-directory-create",60032),trash:ue("trash",60033),trashcan:ue("trashcan",60033),history:ue("history",60034),clock:ue("clock",60034),folder:ue("folder",60035),fileDirectory:ue("file-directory",60035),symbolFolder:ue("symbol-folder",60035),logoGithub:ue("logo-github",60036),markGithub:ue("mark-github",60036),github:ue("github",60036),terminal:ue("terminal",60037),console:ue("console",60037),repl:ue("repl",60037),zap:ue("zap",60038),symbolEvent:ue("symbol-event",60038),error:ue("error",60039),stop:ue("stop",60039),variable:ue("variable",60040),symbolVariable:ue("symbol-variable",60040),array:ue("array",60042),symbolArray:ue("symbol-array",60042),symbolModule:ue("symbol-module",60043),symbolPackage:ue("symbol-package",60043),symbolNamespace:ue("symbol-namespace",60043),symbolObject:ue("symbol-object",60043),symbolMethod:ue("symbol-method",60044),symbolFunction:ue("symbol-function",60044),symbolConstructor:ue("symbol-constructor",60044),symbolBoolean:ue("symbol-boolean",60047),symbolNull:ue("symbol-null",60047),symbolNumeric:ue("symbol-numeric",60048),symbolNumber:ue("symbol-number",60048),symbolStructure:ue("symbol-structure",60049),symbolStruct:ue("symbol-struct",60049),symbolParameter:ue("symbol-parameter",60050),symbolTypeParameter:ue("symbol-type-parameter",60050),symbolKey:ue("symbol-key",60051),symbolText:ue("symbol-text",60051),symbolReference:ue("symbol-reference",60052),goToFile:ue("go-to-file",60052),symbolEnum:ue("symbol-enum",60053),symbolValue:ue("symbol-value",60053),symbolRuler:ue("symbol-ruler",60054),symbolUnit:ue("symbol-unit",60054),activateBreakpoints:ue("activate-breakpoints",60055),archive:ue("archive",60056),arrowBoth:ue("arrow-both",60057),arrowDown:ue("arrow-down",60058),arrowLeft:ue("arrow-left",60059),arrowRight:ue("arrow-right",60060),arrowSmallDown:ue("arrow-small-down",60061),arrowSmallLeft:ue("arrow-small-left",60062),arrowSmallRight:ue("arrow-small-right",60063),arrowSmallUp:ue("arrow-small-up",60064),arrowUp:ue("arrow-up",60065),bell:ue("bell",60066),bold:ue("bold",60067),book:ue("book",60068),bookmark:ue("bookmark",60069),debugBreakpointConditionalUnverified:ue("debug-breakpoint-conditional-unverified",60070),debugBreakpointConditional:ue("debug-breakpoint-conditional",60071),debugBreakpointConditionalDisabled:ue("debug-breakpoint-conditional-disabled",60071),debugBreakpointDataUnverified:ue("debug-breakpoint-data-unverified",60072),debugBreakpointData:ue("debug-breakpoint-data",60073),debugBreakpointDataDisabled:ue("debug-breakpoint-data-disabled",60073),debugBreakpointLogUnverified:ue("debug-breakpoint-log-unverified",60074),debugBreakpointLog:ue("debug-breakpoint-log",60075),debugBreakpointLogDisabled:ue("debug-breakpoint-log-disabled",60075),briefcase:ue("briefcase",60076),broadcast:ue("broadcast",60077),browser:ue("browser",60078),bug:ue("bug",60079),calendar:ue("calendar",60080),caseSensitive:ue("case-sensitive",60081),check:ue("check",60082),checklist:ue("checklist",60083),chevronDown:ue("chevron-down",60084),chevronLeft:ue("chevron-left",60085),chevronRight:ue("chevron-right",60086),chevronUp:ue("chevron-up",60087),chromeClose:ue("chrome-close",60088),chromeMaximize:ue("chrome-maximize",60089),chromeMinimize:ue("chrome-minimize",60090),chromeRestore:ue("chrome-restore",60091),circleOutline:ue("circle-outline",60092),circle:ue("circle",60092),debugBreakpointUnverified:ue("debug-breakpoint-unverified",60092),terminalDecorationIncomplete:ue("terminal-decoration-incomplete",60092),circleSlash:ue("circle-slash",60093),circuitBoard:ue("circuit-board",60094),clearAll:ue("clear-all",60095),clippy:ue("clippy",60096),closeAll:ue("close-all",60097),cloudDownload:ue("cloud-download",60098),cloudUpload:ue("cloud-upload",60099),code:ue("code",60100),collapseAll:ue("collapse-all",60101),colorMode:ue("color-mode",60102),commentDiscussion:ue("comment-discussion",60103),creditCard:ue("credit-card",60105),dash:ue("dash",60108),dashboard:ue("dashboard",60109),database:ue("database",60110),debugContinue:ue("debug-continue",60111),debugDisconnect:ue("debug-disconnect",60112),debugPause:ue("debug-pause",60113),debugRestart:ue("debug-restart",60114),debugStart:ue("debug-start",60115),debugStepInto:ue("debug-step-into",60116),debugStepOut:ue("debug-step-out",60117),debugStepOver:ue("debug-step-over",60118),debugStop:ue("debug-stop",60119),debug:ue("debug",60120),deviceCameraVideo:ue("device-camera-video",60121),deviceCamera:ue("device-camera",60122),deviceMobile:ue("device-mobile",60123),diffAdded:ue("diff-added",60124),diffIgnored:ue("diff-ignored",60125),diffModified:ue("diff-modified",60126),diffRemoved:ue("diff-removed",60127),diffRenamed:ue("diff-renamed",60128),diff:ue("diff",60129),diffSidebyside:ue("diff-sidebyside",60129),discard:ue("discard",60130),editorLayout:ue("editor-layout",60131),emptyWindow:ue("empty-window",60132),exclude:ue("exclude",60133),extensions:ue("extensions",60134),eyeClosed:ue("eye-closed",60135),fileBinary:ue("file-binary",60136),fileCode:ue("file-code",60137),fileMedia:ue("file-media",60138),filePdf:ue("file-pdf",60139),fileSubmodule:ue("file-submodule",60140),fileSymlinkDirectory:ue("file-symlink-directory",60141),fileSymlinkFile:ue("file-symlink-file",60142),fileZip:ue("file-zip",60143),files:ue("files",60144),filter:ue("filter",60145),flame:ue("flame",60146),foldDown:ue("fold-down",60147),foldUp:ue("fold-up",60148),fold:ue("fold",60149),folderActive:ue("folder-active",60150),folderOpened:ue("folder-opened",60151),gear:ue("gear",60152),gift:ue("gift",60153),gistSecret:ue("gist-secret",60154),gist:ue("gist",60155),gitCommit:ue("git-commit",60156),gitCompare:ue("git-compare",60157),compareChanges:ue("compare-changes",60157),gitMerge:ue("git-merge",60158),githubAction:ue("github-action",60159),githubAlt:ue("github-alt",60160),globe:ue("globe",60161),grabber:ue("grabber",60162),graph:ue("graph",60163),gripper:ue("gripper",60164),heart:ue("heart",60165),home:ue("home",60166),horizontalRule:ue("horizontal-rule",60167),hubot:ue("hubot",60168),inbox:ue("inbox",60169),issueReopened:ue("issue-reopened",60171),issues:ue("issues",60172),italic:ue("italic",60173),jersey:ue("jersey",60174),json:ue("json",60175),bracket:ue("bracket",60175),kebabVertical:ue("kebab-vertical",60176),key:ue("key",60177),law:ue("law",60178),lightbulbAutofix:ue("lightbulb-autofix",60179),linkExternal:ue("link-external",60180),link:ue("link",60181),listOrdered:ue("list-ordered",60182),listUnordered:ue("list-unordered",60183),liveShare:ue("live-share",60184),loading:ue("loading",60185),location:ue("location",60186),mailRead:ue("mail-read",60187),mail:ue("mail",60188),markdown:ue("markdown",60189),megaphone:ue("megaphone",60190),mention:ue("mention",60191),milestone:ue("milestone",60192),gitPullRequestMilestone:ue("git-pull-request-milestone",60192),mortarBoard:ue("mortar-board",60193),move:ue("move",60194),multipleWindows:ue("multiple-windows",60195),mute:ue("mute",60196),noNewline:ue("no-newline",60197),note:ue("note",60198),octoface:ue("octoface",60199),openPreview:ue("open-preview",60200),package:ue("package",60201),paintcan:ue("paintcan",60202),pin:ue("pin",60203),play:ue("play",60204),run:ue("run",60204),plug:ue("plug",60205),preserveCase:ue("preserve-case",60206),preview:ue("preview",60207),project:ue("project",60208),pulse:ue("pulse",60209),question:ue("question",60210),quote:ue("quote",60211),radioTower:ue("radio-tower",60212),reactions:ue("reactions",60213),references:ue("references",60214),refresh:ue("refresh",60215),regex:ue("regex",60216),remoteExplorer:ue("remote-explorer",60217),remote:ue("remote",60218),remove:ue("remove",60219),replaceAll:ue("replace-all",60220),replace:ue("replace",60221),repoClone:ue("repo-clone",60222),repoForcePush:ue("repo-force-push",60223),repoPull:ue("repo-pull",60224),repoPush:ue("repo-push",60225),report:ue("report",60226),requestChanges:ue("request-changes",60227),rocket:ue("rocket",60228),rootFolderOpened:ue("root-folder-opened",60229),rootFolder:ue("root-folder",60230),rss:ue("rss",60231),ruby:ue("ruby",60232),saveAll:ue("save-all",60233),saveAs:ue("save-as",60234),save:ue("save",60235),screenFull:ue("screen-full",60236),screenNormal:ue("screen-normal",60237),searchStop:ue("search-stop",60238),server:ue("server",60240),settingsGear:ue("settings-gear",60241),settings:ue("settings",60242),shield:ue("shield",60243),smiley:ue("smiley",60244),sortPrecedence:ue("sort-precedence",60245),splitHorizontal:ue("split-horizontal",60246),splitVertical:ue("split-vertical",60247),squirrel:ue("squirrel",60248),starFull:ue("star-full",60249),starHalf:ue("star-half",60250),symbolClass:ue("symbol-class",60251),symbolColor:ue("symbol-color",60252),symbolConstant:ue("symbol-constant",60253),symbolEnumMember:ue("symbol-enum-member",60254),symbolField:ue("symbol-field",60255),symbolFile:ue("symbol-file",60256),symbolInterface:ue("symbol-interface",60257),symbolKeyword:ue("symbol-keyword",60258),symbolMisc:ue("symbol-misc",60259),symbolOperator:ue("symbol-operator",60260),symbolProperty:ue("symbol-property",60261),wrench:ue("wrench",60261),wrenchSubaction:ue("wrench-subaction",60261),symbolSnippet:ue("symbol-snippet",60262),tasklist:ue("tasklist",60263),telescope:ue("telescope",60264),textSize:ue("text-size",60265),threeBars:ue("three-bars",60266),thumbsdown:ue("thumbsdown",60267),thumbsup:ue("thumbsup",60268),tools:ue("tools",60269),triangleDown:ue("triangle-down",60270),triangleLeft:ue("triangle-left",60271),triangleRight:ue("triangle-right",60272),triangleUp:ue("triangle-up",60273),twitter:ue("twitter",60274),unfold:ue("unfold",60275),unlock:ue("unlock",60276),unmute:ue("unmute",60277),unverified:ue("unverified",60278),verified:ue("verified",60279),versions:ue("versions",60280),vmActive:ue("vm-active",60281),vmOutline:ue("vm-outline",60282),vmRunning:ue("vm-running",60283),watch:ue("watch",60284),whitespace:ue("whitespace",60285),wholeWord:ue("whole-word",60286),window:ue("window",60287),wordWrap:ue("word-wrap",60288),zoomIn:ue("zoom-in",60289),zoomOut:ue("zoom-out",60290),listFilter:ue("list-filter",60291),listFlat:ue("list-flat",60292),listSelection:ue("list-selection",60293),selection:ue("selection",60293),listTree:ue("list-tree",60294),debugBreakpointFunctionUnverified:ue("debug-breakpoint-function-unverified",60295),debugBreakpointFunction:ue("debug-breakpoint-function",60296),debugBreakpointFunctionDisabled:ue("debug-breakpoint-function-disabled",60296),debugStackframeActive:ue("debug-stackframe-active",60297),circleSmallFilled:ue("circle-small-filled",60298),debugStackframeDot:ue("debug-stackframe-dot",60298),terminalDecorationMark:ue("terminal-decoration-mark",60298),debugStackframe:ue("debug-stackframe",60299),debugStackframeFocused:ue("debug-stackframe-focused",60299),debugBreakpointUnsupported:ue("debug-breakpoint-unsupported",60300),symbolString:ue("symbol-string",60301),debugReverseContinue:ue("debug-reverse-continue",60302),debugStepBack:ue("debug-step-back",60303),debugRestartFrame:ue("debug-restart-frame",60304),debugAlt:ue("debug-alt",60305),callIncoming:ue("call-incoming",60306),callOutgoing:ue("call-outgoing",60307),menu:ue("menu",60308),expandAll:ue("expand-all",60309),feedback:ue("feedback",60310),gitPullRequestReviewer:ue("git-pull-request-reviewer",60310),groupByRefType:ue("group-by-ref-type",60311),ungroupByRefType:ue("ungroup-by-ref-type",60312),account:ue("account",60313),gitPullRequestAssignee:ue("git-pull-request-assignee",60313),bellDot:ue("bell-dot",60314),debugConsole:ue("debug-console",60315),library:ue("library",60316),output:ue("output",60317),runAll:ue("run-all",60318),syncIgnored:ue("sync-ignored",60319),pinned:ue("pinned",60320),githubInverted:ue("github-inverted",60321),serverProcess:ue("server-process",60322),serverEnvironment:ue("server-environment",60323),pass:ue("pass",60324),issueClosed:ue("issue-closed",60324),stopCircle:ue("stop-circle",60325),playCircle:ue("play-circle",60326),record:ue("record",60327),debugAltSmall:ue("debug-alt-small",60328),vmConnect:ue("vm-connect",60329),cloud:ue("cloud",60330),merge:ue("merge",60331),export:ue("export",60332),graphLeft:ue("graph-left",60333),magnet:ue("magnet",60334),notebook:ue("notebook",60335),redo:ue("redo",60336),checkAll:ue("check-all",60337),pinnedDirty:ue("pinned-dirty",60338),passFilled:ue("pass-filled",60339),circleLargeFilled:ue("circle-large-filled",60340),circleLarge:ue("circle-large",60341),circleLargeOutline:ue("circle-large-outline",60341),combine:ue("combine",60342),gather:ue("gather",60342),table:ue("table",60343),variableGroup:ue("variable-group",60344),typeHierarchy:ue("type-hierarchy",60345),typeHierarchySub:ue("type-hierarchy-sub",60346),typeHierarchySuper:ue("type-hierarchy-super",60347),gitPullRequestCreate:ue("git-pull-request-create",60348),runAbove:ue("run-above",60349),runBelow:ue("run-below",60350),notebookTemplate:ue("notebook-template",60351),debugRerun:ue("debug-rerun",60352),workspaceTrusted:ue("workspace-trusted",60353),workspaceUntrusted:ue("workspace-untrusted",60354),workspaceUnknown:ue("workspace-unknown",60355),terminalCmd:ue("terminal-cmd",60356),terminalDebian:ue("terminal-debian",60357),terminalLinux:ue("terminal-linux",60358),terminalPowershell:ue("terminal-powershell",60359),terminalTmux:ue("terminal-tmux",60360),terminalUbuntu:ue("terminal-ubuntu",60361),terminalBash:ue("terminal-bash",60362),arrowSwap:ue("arrow-swap",60363),copy:ue("copy",60364),personAdd:ue("person-add",60365),filterFilled:ue("filter-filled",60366),wand:ue("wand",60367),debugLineByLine:ue("debug-line-by-line",60368),inspect:ue("inspect",60369),layers:ue("layers",60370),layersDot:ue("layers-dot",60371),layersActive:ue("layers-active",60372),compass:ue("compass",60373),compassDot:ue("compass-dot",60374),compassActive:ue("compass-active",60375),azure:ue("azure",60376),issueDraft:ue("issue-draft",60377),gitPullRequestClosed:ue("git-pull-request-closed",60378),gitPullRequestDraft:ue("git-pull-request-draft",60379),debugAll:ue("debug-all",60380),debugCoverage:ue("debug-coverage",60381),runErrors:ue("run-errors",60382),folderLibrary:ue("folder-library",60383),debugContinueSmall:ue("debug-continue-small",60384),beakerStop:ue("beaker-stop",60385),graphLine:ue("graph-line",60386),graphScatter:ue("graph-scatter",60387),pieChart:ue("pie-chart",60388),bracketDot:ue("bracket-dot",60389),bracketError:ue("bracket-error",60390),lockSmall:ue("lock-small",60391),azureDevops:ue("azure-devops",60392),verifiedFilled:ue("verified-filled",60393),newline:ue("newline",60394),layout:ue("layout",60395),layoutActivitybarLeft:ue("layout-activitybar-left",60396),layoutActivitybarRight:ue("layout-activitybar-right",60397),layoutPanelLeft:ue("layout-panel-left",60398),layoutPanelCenter:ue("layout-panel-center",60399),layoutPanelJustify:ue("layout-panel-justify",60400),layoutPanelRight:ue("layout-panel-right",60401),layoutPanel:ue("layout-panel",60402),layoutSidebarLeft:ue("layout-sidebar-left",60403),layoutSidebarRight:ue("layout-sidebar-right",60404),layoutStatusbar:ue("layout-statusbar",60405),layoutMenubar:ue("layout-menubar",60406),layoutCentered:ue("layout-centered",60407),target:ue("target",60408),indent:ue("indent",60409),recordSmall:ue("record-small",60410),errorSmall:ue("error-small",60411),terminalDecorationError:ue("terminal-decoration-error",60411),arrowCircleDown:ue("arrow-circle-down",60412),arrowCircleLeft:ue("arrow-circle-left",60413),arrowCircleRight:ue("arrow-circle-right",60414),arrowCircleUp:ue("arrow-circle-up",60415),layoutSidebarRightOff:ue("layout-sidebar-right-off",60416),layoutPanelOff:ue("layout-panel-off",60417),layoutSidebarLeftOff:ue("layout-sidebar-left-off",60418),blank:ue("blank",60419),heartFilled:ue("heart-filled",60420),map:ue("map",60421),mapHorizontal:ue("map-horizontal",60421),foldHorizontal:ue("fold-horizontal",60421),mapFilled:ue("map-filled",60422),mapHorizontalFilled:ue("map-horizontal-filled",60422),foldHorizontalFilled:ue("fold-horizontal-filled",60422),circleSmall:ue("circle-small",60423),bellSlash:ue("bell-slash",60424),bellSlashDot:ue("bell-slash-dot",60425),commentUnresolved:ue("comment-unresolved",60426),gitPullRequestGoToChanges:ue("git-pull-request-go-to-changes",60427),gitPullRequestNewChanges:ue("git-pull-request-new-changes",60428),searchFuzzy:ue("search-fuzzy",60429),commentDraft:ue("comment-draft",60430),send:ue("send",60431),sparkle:ue("sparkle",60432),insert:ue("insert",60433),mic:ue("mic",60434),thumbsdownFilled:ue("thumbsdown-filled",60435),thumbsupFilled:ue("thumbsup-filled",60436),coffee:ue("coffee",60437),snake:ue("snake",60438),game:ue("game",60439),vr:ue("vr",60440),chip:ue("chip",60441),piano:ue("piano",60442),music:ue("music",60443),micFilled:ue("mic-filled",60444),repoFetch:ue("repo-fetch",60445),copilot:ue("copilot",60446),lightbulbSparkle:ue("lightbulb-sparkle",60447),robot:ue("robot",60448),sparkleFilled:ue("sparkle-filled",60449),diffSingle:ue("diff-single",60450),diffMultiple:ue("diff-multiple",60451),surroundWith:ue("surround-with",60452),share:ue("share",60453),gitStash:ue("git-stash",60454),gitStashApply:ue("git-stash-apply",60455),gitStashPop:ue("git-stash-pop",60456),vscode:ue("vscode",60457),vscodeInsiders:ue("vscode-insiders",60458),codeOss:ue("code-oss",60459),runCoverage:ue("run-coverage",60460),runAllCoverage:ue("run-all-coverage",60461),coverage:ue("coverage",60462),githubProject:ue("github-project",60463),mapVertical:ue("map-vertical",60464),foldVertical:ue("fold-vertical",60464),mapVerticalFilled:ue("map-vertical-filled",60465),foldVerticalFilled:ue("fold-vertical-filled",60465),goToSearch:ue("go-to-search",60466),percentage:ue("percentage",60467),sortPercentage:ue("sort-percentage",60467),attach:ue("attach",60468),goToEditingSession:ue("go-to-editing-session",60469),editSession:ue("edit-session",60470),codeReview:ue("code-review",60471),copilotWarning:ue("copilot-warning",60472),python:ue("python",60473),copilotLarge:ue("copilot-large",60474),copilotWarningLarge:ue("copilot-warning-large",60475),keyboardTab:ue("keyboard-tab",60476),copilotBlocked:ue("copilot-blocked",60477),copilotNotConnected:ue("copilot-not-connected",60478),flag:ue("flag",60479),lightbulbEmpty:ue("lightbulb-empty",60480),symbolMethodArrow:ue("symbol-method-arrow",60481),copilotUnavailable:ue("copilot-unavailable",60482),repoPinned:ue("repo-pinned",60483),keyboardTabAbove:ue("keyboard-tab-above",60484),keyboardTabBelow:ue("keyboard-tab-below",60485),gitPullRequestDone:ue("git-pull-request-done",60486),mcp:ue("mcp",60487),extensionsLarge:ue("extensions-large",60488),layoutPanelDock:ue("layout-panel-dock",60489),layoutSidebarLeftDock:ue("layout-sidebar-left-dock",60490),layoutSidebarRightDock:ue("layout-sidebar-right-dock",60491),copilotInProgress:ue("copilot-in-progress",60492),copilotError:ue("copilot-error",60493),copilotSuccess:ue("copilot-success",60494),chatSparkle:ue("chat-sparkle",60495),searchSparkle:ue("search-sparkle",60496),editSparkle:ue("edit-sparkle",60497),copilotSnooze:ue("copilot-snooze",60498),sendToRemoteAgent:ue("send-to-remote-agent",60499),commentDiscussionSparkle:ue("comment-discussion-sparkle",60500),chatSparkleWarning:ue("chat-sparkle-warning",60501),chatSparkleError:ue("chat-sparkle-error",60502),collection:ue("collection",60503),newCollection:ue("new-collection",60504),thinking:ue("thinking",60505),build:ue("build",60506),commentDiscussionQuote:ue("comment-discussion-quote",60507),cursor:ue("cursor",60508),eraser:ue("eraser",60509),fileText:ue("file-text",60510),quotes:ue("quotes",60512),rename:ue("rename",60513),runWithDeps:ue("run-with-deps",60514),debugConnected:ue("debug-connected",60515),strikethrough:ue("strikethrough",60516),openInProduct:ue("open-in-product",60517),indexZero:ue("index-zero",60518),agent:ue("agent",60519),editCode:ue("edit-code",60520),repoSelected:ue("repo-selected",60521),skip:ue("skip",60522),mergeInto:ue("merge-into",60523),gitBranchChanges:ue("git-branch-changes",60524),gitBranchStagedChanges:ue("git-branch-staged-changes",60525),gitBranchConflicts:ue("git-branch-conflicts",60526),gitBranch:ue("git-branch",60527),gitBranchCreate:ue("git-branch-create",60527),gitBranchDelete:ue("git-branch-delete",60527),searchLarge:ue("search-large",60528),terminalGitBash:ue("terminal-git-bash",60529),windowActive:ue("window-active",60530),forward:ue("forward",60531),download:ue("download",60532),clockface:ue("clockface",60533),unarchive:ue("unarchive",60534),sessionInProgress:ue("session-in-progress",60535),collectionSmall:ue("collection-small",60536),vmSmall:ue("vm-small",60537),cloudSmall:ue("cloud-small",60538),addSmall:ue("add-small",60539),removeSmall:ue("remove-small",60540),worktreeSmall:ue("worktree-small",60541),worktree:ue("worktree",60542),screenCut:ue("screen-cut",60543),ask:ue("ask",60544),openai:ue("openai",60545),claude:ue("claude",60546),openInWindow:ue("open-in-window",60547),newSession:ue("new-session",60548),terminalSecure:ue("terminal-secure",60549)};function j$(){return Object.values(R)}var $Fo={dialogError:ue("dialog-error","error"),dialogWarning:ue("dialog-warning","warning"),dialogInfo:ue("dialog-info","info"),dialogClose:ue("dialog-close","close"),treeItemExpanded:ue("tree-item-expanded","chevron-down"),treeFilterOnTypeOn:ue("tree-filter-on-type-on","list-filter"),treeFilterOnTypeOff:ue("tree-filter-on-type-off","list-selection"),treeFilterClear:ue("tree-filter-clear","close"),treeItemLoading:ue("tree-item-loading","loading"),menuSelection:ue("menu-selection","check"),menuSubmenu:ue("menu-submenu","chevron-right"),menuBarMore:ue("menubar-more","more"),scrollbarButtonLeft:ue("scrollbar-button-left","triangle-left"),scrollbarButtonRight:ue("scrollbar-button-right","triangle-right"),scrollbarButtonUp:ue("scrollbar-button-up","triangle-up"),scrollbarButtonDown:ue("scrollbar-button-down","triangle-down"),toolBarMore:ue("toolbar-more","more"),quickInputBack:ue("quick-input-back","arrow-left"),dropDownButton:ue("drop-down-button",60084),symbolCustomColor:ue("symbol-customcolor",60252),exportIcon:ue("export",60332),workspaceUnspecified:ue("workspace-unspecified",60355),newLine:ue("newline",60394),thumbsDownFilled:ue("thumbsdown-filled",60435),thumbsUpFilled:ue("thumbsup-filled",60436),gitFetch:ue("git-fetch",60445),lightbulbSparkleAutofix:ue("lightbulb-sparkle-autofix",60447),debugBreakpointPending:ue("debug-breakpoint-pending",60377),chatImport:ue("chat-import",60550),chatExport:ue("chat-export",60551)},R={...Z9,...$Fo};var d$i;(i=>{function a(e){return!!e&&typeof e=="object"&&typeof e.id=="string"}i.isThemeColor=a})(d$i||={});function Yu(a){return{id:a}}var q;(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 n(y){let w=o.exec(y.id);if(!w)return n(R.error);let[,k,T]=w,P=["codicon","codicon-"+k];return T&&P.push("codicon-modifier-"+T.substring(1)),P}S.asClassNameArray=n;function r(y){return n(y).join(" ")}S.asClassName=r;function s(y){return"."+n(y).join(".")}S.asCSSSelector=s;function l(y){return!!y&&typeof y=="object"&&typeof y.id=="string"&&(typeof y.color>"u"||d$i.isThemeColor(y.color))}S.isThemeIcon=l;let c=new RegExp(`^\\$\\((${S.iconNameExpression}(?:${S.iconModifierExpression})?)\\)$`);function u(y){let w=c.exec(y);if(!w)return;let[,k]=w;return{id:k}}S.fromString=u;function p(y){return{id:y}}S.fromId=p;function h(y,w){let k=y.id,T=k.lastIndexOf("~");return T!==-1&&(k=k.substring(0,T)),w&&(k=`${k}~${w}`),{id:k}}S.modify=h;function g(y){let w=y.id.lastIndexOf("~");if(w!==-1)return y.id.substring(w+1)}S.getModifier=g;function f(y,w){return y.id===w.id&&y.color?.id===w.color?.id}S.isEqual=f;function v(y){return y?.id===R.file.id}S.isFile=v;function b(y){return y?.id===R.folder.id}S.isFolder=b})(q||={});var ge=le("commandService"),$e=new class{constructor(){this._commands=new Map;this._onDidRegisterCommand=new E;this.onDidRegisterCommand=this._onDidRegisterCommand.event}registerCommand(a,i){if(!a)throw new Error("invalid command");if(typeof a=="string"){if(!i)throw new Error("invalid command");return this.registerCommand({id:a,handler:i})}if(a.metadata&&Array.isArray(a.metadata.args)){let r=[];for(let l of a.metadata.args)r.push(l.constraint);let s=a.handler;a.handler=function(l,...c){return B2i(c,r),s(l,...c)}}let{id:e}=a,t=this._commands.get(e);t||(t=new qs,this._commands.set(e,t));let o=t.unshift(a),n=Z(()=>{o(),this._commands.get(e)?.isEmpty()&&this._commands.delete(e)});return this._onDidRegisterCommand.fire(e),im(n)}registerCommandAlias(a,i){return $e.registerCommand(a,(e,...t)=>e.get(ge).executeCommand(i,...t))}getCommand(a){let i=this._commands.get(a);if(!(!i||i.isEmpty()))return vt.first(i)}getCommands(){let a=new Map;for(let i of this._commands.keys()){let e=this.getCommand(i);e&&a.set(i,e)}return a}};$e.registerCommand("noop",()=>{});function QJt(...a){switch(a.length){case 1:return d(1931,null,a[0]);case 2:return d(1932,null,a[0],a[1]);case 3:return d(1933,null,a[0],a[1],a[2]);default:return}}var jFo=d(1930,null),QFo=d(1929,null),e7=class a{constructor(){this._input="";this._start=0;this._current=0;this._tokens=[];this._errors=[];this.stringRe=/[a-zA-Z0-9_<>\-\./\\:\*\?\+\[\]\^,#@;"%\$\p{L}-]+/uy}static getLexeme(i){switch(i.type){case 0:return"(";case 1:return")";case 2:return"!";case 3:return i.isTripleEq?"===":"==";case 4:return i.isTripleEq?"!==":"!=";case 5:return"<";case 6:return"<=";case 7:return">=";case 8:return">=";case 9:return"=~";case 10:return i.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 i.lexeme;case 18:return i.lexeme;case 19:return i.lexeme;case 20:return"EOF";default:throw NSe(`unhandled token type: ${JSON.stringify(i)}; have you forgotten to add a case?`)}}static{this._regexFlags=new Set(["i","g","s","m","y","u"].map(i=>i.charCodeAt(0)))}static{this._keywords=new Map([["not",14],["in",13],["false",12],["true",11]])}get errors(){return this._errors}reset(i){return this._input=i,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(QJt("==","=~"));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(QJt("&&"));break;case 124:this._match(124)?this._addToken(16):this._error(QJt("||"));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(i){return this._isAtEnd()||this._input.charCodeAt(this._current)!==i?!1:(this._current++,!0)}_advance(){return this._input.charCodeAt(this._current++)}_peek(){return this._isAtEnd()?0:this._input.charCodeAt(this._current)}_addToken(i){this._tokens.push({type:i,offset:this._start})}_error(i){let e=this._start,t=this._input.substring(this._start,this._current),o={type:19,offset:this._start,lexeme:t};this._errors.push({offset:e,lexeme:t,additionalInfo:i}),this._tokens.push(o)}_string(){this.stringRe.lastIndex=this._start;let i=this.stringRe.exec(this._input);if(i){this._current=this._start+i[0].length;let e=this._input.substring(this._start,this._current),t=a._keywords.get(e);t?this._addToken(t):this._tokens.push({type:17,lexeme:e,offset:this._start})}}_quotedString(){for(;this._peek()!==39&&!this._isAtEnd();)this._advance();if(this._isAtEnd()){this._error(jFo);return}this._advance(),this._tokens.push({type:18,lexeme:this._input.substring(this._start+1,this._current-1),offset:this._start+1})}_regex(){let i=this._current,e=!1,t=!1;for(;;){if(i>=this._input.length){this._current=i,this._error(QFo);return}let n=this._input.charCodeAt(i);if(e)e=!1;else if(n===47&&!t){i++;break}else n===91?t=!0:n===92?e=!0:n===93&&(t=!1);i++}for(;i<this._input.length&&a._regexFlags.has(this._input.charCodeAt(i));)i++;this._current=i;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 GS=new Map;GS.set("false",!1);GS.set("true",!0);GS.set("isMac",Ze);GS.set("isLinux",fn);GS.set("isWindows",ei);GS.set("isWeb",Wt);GS.set("isMacNative",Ze&&!Wt);GS.set("isEdge",jSe);GS.set("isFirefox",qSe);GS.set("isChrome",d1);GS.set("isSafari",$Se);function h$i(a,i){if(GS.get(a)!==void 0)throw Yr("contextkey.setConstant(k, v) invoked with already set constant `k`");GS.set(a,i)}var YFo=Object.prototype.hasOwnProperty;var XFo={regexParsingWithErrorRecovery:!0},JFo=d(1910,null),ZFo=d(1911,null),e0o=d(1913,null),u$i=d(1909,null),t0o=d(1916,null),i0o=d(1917,null),o0o=d(1914,null),n0o=d(1915,null),YJt=class a{constructor(i=XFo){this._config=i;this._scanner=new e7;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(i){if(i===""){this._parsingErrors.push({message:JFo,offset:0,lexeme:"",additionalInfo:ZFo});return}this._tokens=this._scanner.reset(i).scan(),this._current=0,this._parsingErrors=[];try{let e=this._expr();if(!this._isAtEnd()){let t=this._peek(),o=t.type===17?i0o:void 0;throw this._parsingErrors.push({message:t0o,offset:t.offset,lexeme:e7.getLexeme(t),additionalInfo:o}),a._parseError}return e}catch(e){if(e!==a._parseError)throw e;return}}_expr(){return this._or()}_or(){let i=[this._and()];for(;this._matchOne(16);){let e=this._and();i.push(e)}return i.length===1?i[0]:C.or(...i)}_and(){let i=[this._term()];for(;this._matchOne(15);){let e=this._term();i.push(e)}return i.length===1?i[0]:C.and(...i)}_term(){if(this._matchOne(2)){let i=this._peek();switch(i.type){case 11:return this._advance(),Xy.INSTANCE;case 12:return this._advance(),KI.INSTANCE;case 0:{this._advance();let e=this._expr();return this._consume(1,u$i),e?.negate()}case 17:return this._advance(),gae.create(i.lexeme);default:throw this._errExpectedButGot("KEY | true | false | '(' expression ')'",i)}}return this._primary()}_primary(){let i=this._peek();switch(i.type){case 11:return this._advance(),C.true();case 12:return this._advance(),C.false();case 0:{this._advance();let e=this._expr();return this._consume(1,u$i),e}case 17:{let e=i.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 n=o.lexeme,r=n.lastIndexOf("/"),s=r===n.length-1?void 0:this._removeFlagsGY(n.substring(r+1)),l;try{l=new RegExp(n.substring(1,r),s)}catch{throw this._errExpectedButGot("REGEX",o)}return G$e.create(e,l)}switch(o.type){case 10:case 19:{let n=[o.lexeme];this._advance();let r=this._peek(),s=0;for(let h=0;h<o.lexeme.length;h++)o.lexeme.charCodeAt(h)===40?s++:o.lexeme.charCodeAt(h)===41&&s--;for(;!this._isAtEnd()&&r.type!==15&&r.type!==16;){switch(r.type){case 0:s++;break;case 1:s--;break;case 10:case 18:for(let h=0;h<r.lexeme.length;h++)r.lexeme.charCodeAt(h)===40?s++:o.lexeme.charCodeAt(h)===41&&s--}if(s<0)break;n.push(e7.getLexeme(r)),this._advance(),r=this._peek()}let l=n.join(""),c=l.lastIndexOf("/"),u=c===l.length-1?void 0:this._removeFlagsGY(l.substring(c+1)),p;try{p=new RegExp(l.substring(1,c),u)}catch{throw this._errExpectedButGot("REGEX",o)}return C.regex(e,p)}case 18:{let n=o.lexeme;this._advance();let r=null;if(!uc(n)){let s=n.indexOf("/"),l=n.lastIndexOf("/");if(s!==l&&s>=0){let c=n.slice(s+1,l),u=n[l+1]==="i"?"i":"";try{r=new RegExp(c,u)}catch{throw this._errExpectedButGot("REGEX",o)}}}if(r===null)throw this._errExpectedButGot("REGEX",o);return G$e.create(e,r)}default:throw this._errExpectedButGot("REGEX",this._peek())}}if(this._matchOne(14)){this._consume(13,e0o);let o=this._value();return C.notIn(e,o)}switch(this._peek().type){case 3:{this._advance();let o=this._value();if(this._previous().type===18)return C.equals(e,o);switch(o){case"true":return C.has(e);case"false":return C.not(e);default:return C.equals(e,o)}}case 4:{this._advance();let o=this._value();if(this._previous().type===18)return C.notEquals(e,o);switch(o){case"true":return C.not(e);case"false":return C.has(e);default:return C.notEquals(e,o)}}case 5:return this._advance(),z$e.create(e,this._value());case 6:return this._advance(),K$e.create(e,this._value());case 7:return this._advance(),t7.create(e,this._value());case 8:return this._advance(),U$e.create(e,this._value());case 13:return this._advance(),C.in(e,this._value());default:return C.has(e)}}case 20:throw this._parsingErrors.push({message:o0o,offset:i.offset,lexeme:"",additionalInfo:n0o}),a._parseError;default:throw this._errExpectedButGot(`true | false | KEY 
	| KEY '=~' REGEX 
	| KEY ('==' | '!=' | '<' | '<=' | '>' | '>=' | 'in' | 'not' 'in') value`,this._peek())}}_value(){let i=this._peek();switch(i.type){case 17:case 18:return this._advance(),i.lexeme;case 11:return this._advance(),"true";case 12:return this._advance(),"false";case 13:return this._advance(),"in";default:return""}}_removeFlagsGY(i){return i.replaceAll(this._flagsGYRe,"")}_previous(){return this._tokens[this._current-1]}_matchOne(i){return this._check(i)?(this._advance(),!0):!1}_advance(){return this._isAtEnd()||this._current++,this._previous()}_consume(i,e){if(this._check(i))return this._advance();throw this._errExpectedButGot(e,this._peek())}_errExpectedButGot(i,e,t){let o=d(1912,null,i,e7.getLexeme(e)),n=e.offset,r=e7.getLexeme(e);return this._parsingErrors.push({message:o,offset:n,lexeme:r,additionalInfo:t}),a._parseError}_check(i){return this._peek().type===i}_peek(){return this._tokens[this._current]}_isAtEnd(){return this._peek().type===20}},C=class{static false(){return Xy.INSTANCE}static true(){return KI.INSTANCE}static has(i){return hE.create(i)}static equals(i,e){return wV.create(i,e)}static notEquals(i,e){return H$e.create(i,e)}static regex(i,e){return G$e.create(i,e)}static in(i,e){return Ngt.create(i,e)}static notIn(i,e){return Ogt.create(i,e)}static not(i){return gae.create(i)}static and(...i){return Fgt.create(i,null,!0)}static or(...i){return q$e.create(i,null,!0)}static greater(i,e){return t7.create(i,e)}static greaterEquals(i,e){return U$e.create(i,e)}static smaller(i,e){return z$e.create(i,e)}static smallerEquals(i,e){return K$e.create(i,e)}static{this._parser=new YJt({regexParsingWithErrorRecovery:!1})}static deserialize(i){return i==null?void 0:this._parser.parse(i)}};function g$i(a,i){let e=a?a.substituteConstants():void 0,t=i?i.substituteConstants():void 0;return!e&&!t?!0:!e||!t?!1:e.equals(t)}function B$e(a,i){return a.cmp(i)}var Xy=class a{constructor(){this.type=0}static{this.INSTANCE=new a}cmp(i){return this.type-i.type}equals(i){return i.type===this.type}substituteConstants(){return this}evaluate(i){return!1}serialize(){return"false"}keys(){return[]}map(i){return this}negate(){return KI.INSTANCE}},KI=class a{constructor(){this.type=1}static{this.INSTANCE=new a}cmp(i){return this.type-i.type}equals(i){return i.type===this.type}substituteConstants(){return this}evaluate(i){return!0}serialize(){return"true"}keys(){return[]}map(i){return this}negate(){return Xy.INSTANCE}},hE=class a{constructor(i,e){this.key=i;this.negated=e;this.type=2}static create(i,e=null){let t=GS.get(i);return typeof t=="boolean"?t?KI.INSTANCE:Xy.INSTANCE:new a(i,e)}cmp(i){return i.type!==this.type?this.type-i.type:v$i(this.key,i.key)}equals(i){return i.type===this.type?this.key===i.key:!1}substituteConstants(){let i=GS.get(this.key);return typeof i=="boolean"?i?KI.INSTANCE:Xy.INSTANCE:this}evaluate(i){return!!i.getValue(this.key)}serialize(){return this.key}keys(){return[this.key]}map(i){return i.mapDefined(this.key)}negate(){return this.negated||(this.negated=gae.create(this.key,this)),this.negated}},wV=class a{constructor(i,e,t){this.key=i;this.value=e;this.negated=t;this.type=4}static create(i,e,t=null){if(typeof e=="boolean")return e?hE.create(i,t):gae.create(i,t);let o=GS.get(i);return typeof o=="boolean"?e===(o?"true":"false")?KI.INSTANCE:Xy.INSTANCE:new a(i,e,t)}cmp(i){return i.type!==this.type?this.type-i.type:fae(this.key,this.value,i.key,i.value)}equals(i){return i.type===this.type?this.key===i.key&&this.value===i.value:!1}substituteConstants(){let i=GS.get(this.key);if(typeof i=="boolean"){let e=i?"true":"false";return this.value===e?KI.INSTANCE:Xy.INSTANCE}return this}evaluate(i){return i.getValue(this.key)==this.value}serialize(){return`${this.key} == '${this.value}'`}keys(){return[this.key]}map(i){return i.mapEquals(this.key,this.value)}negate(){return this.negated||(this.negated=H$e.create(this.key,this.value,this)),this.negated}},Ngt=class a{constructor(i,e){this.key=i;this.valueKey=e;this.type=10;this.negated=null}static create(i,e){return new a(i,e)}cmp(i){return i.type!==this.type?this.type-i.type:fae(this.key,this.valueKey,i.key,i.valueKey)}equals(i){return i.type===this.type?this.key===i.key&&this.valueKey===i.valueKey:!1}substituteConstants(){return this}evaluate(i){let e=i.getValue(this.valueKey),t=i.getValue(this.key);if(Array.isArray(e)){if(e.includes(t))return!0;if(ei&&typeof t=="string"&&t.startsWith("file:///")){let o=t.toLowerCase();return e.some(n=>typeof n=="string"&&n.toLowerCase()===o)}return!1}if(typeof t=="string"&&typeof e=="object"&&e!==null){if(YFo.call(e,t))return!0;if(ei&&t.startsWith("file:///")){let o=t.toLowerCase();return Object.keys(e).some(n=>n.toLowerCase()===o)}return!1}return!1}serialize(){return`${this.key} in '${this.valueKey}'`}keys(){return[this.key,this.valueKey]}map(i){return i.mapIn(this.key,this.valueKey)}negate(){return this.negated||(this.negated=Ogt.create(this.key,this.valueKey)),this.negated}},Ogt=class a{constructor(i,e){this.key=i;this.valueKey=e;this.type=11;this._negated=Ngt.create(i,e)}static create(i,e){return new a(i,e)}cmp(i){return i.type!==this.type?this.type-i.type:this._negated.cmp(i._negated)}equals(i){return i.type===this.type?this._negated.equals(i._negated):!1}substituteConstants(){return this}evaluate(i){return!this._negated.evaluate(i)}serialize(){return`${this.key} not in '${this.valueKey}'`}keys(){return this._negated.keys()}map(i){return i.mapNotIn(this.key,this.valueKey)}negate(){return this._negated}},H$e=class a{constructor(i,e,t){this.key=i;this.value=e;this.negated=t;this.type=5}static create(i,e,t=null){if(typeof e=="boolean")return e?gae.create(i,t):hE.create(i,t);let o=GS.get(i);return typeof o=="boolean"?e===(o?"true":"false")?Xy.INSTANCE:KI.INSTANCE:new a(i,e,t)}cmp(i){return i.type!==this.type?this.type-i.type:fae(this.key,this.value,i.key,i.value)}equals(i){return i.type===this.type?this.key===i.key&&this.value===i.value:!1}substituteConstants(){let i=GS.get(this.key);if(typeof i=="boolean"){let e=i?"true":"false";return this.value===e?Xy.INSTANCE:KI.INSTANCE}return this}evaluate(i){return i.getValue(this.key)!=this.value}serialize(){return`${this.key} != '${this.value}'`}keys(){return[this.key]}map(i){return i.mapNotEquals(this.key,this.value)}negate(){return this.negated||(this.negated=wV.create(this.key,this.value,this)),this.negated}},gae=class a{constructor(i,e){this.key=i;this.negated=e;this.type=3}static create(i,e=null){let t=GS.get(i);return typeof t=="boolean"?t?Xy.INSTANCE:KI.INSTANCE:new a(i,e)}cmp(i){return i.type!==this.type?this.type-i.type:v$i(this.key,i.key)}equals(i){return i.type===this.type?this.key===i.key:!1}substituteConstants(){let i=GS.get(this.key);return typeof i=="boolean"?i?Xy.INSTANCE:KI.INSTANCE:this}evaluate(i){return!i.getValue(this.key)}serialize(){return`!${this.key}`}keys(){return[this.key]}map(i){return i.mapNot(this.key)}negate(){return this.negated||(this.negated=hE.create(this.key,this)),this.negated}};function Vgt(a,i){if(typeof a=="string"){let e=parseFloat(a);isNaN(e)||(a=e)}return typeof a=="string"||typeof a=="number"?i(a):Xy.INSTANCE}var t7=class a{constructor(i,e,t){this.key=i;this.value=e;this.negated=t;this.type=12}static create(i,e,t=null){return Vgt(e,o=>new a(i,o,t))}cmp(i){return i.type!==this.type?this.type-i.type:fae(this.key,this.value,i.key,i.value)}equals(i){return i.type===this.type?this.key===i.key&&this.value===i.value:!1}substituteConstants(){return this}evaluate(i){return typeof this.value=="string"?!1:parseFloat(i.getValue(this.key))>this.value}serialize(){return`${this.key} > ${this.value}`}keys(){return[this.key]}map(i){return i.mapGreater(this.key,this.value)}negate(){return this.negated||(this.negated=K$e.create(this.key,this.value,this)),this.negated}},U$e=class a{constructor(i,e,t){this.key=i;this.value=e;this.negated=t;this.type=13}static create(i,e,t=null){return Vgt(e,o=>new a(i,o,t))}cmp(i){return i.type!==this.type?this.type-i.type:fae(this.key,this.value,i.key,i.value)}equals(i){return i.type===this.type?this.key===i.key&&this.value===i.value:!1}substituteConstants(){return this}evaluate(i){return typeof this.value=="string"?!1:parseFloat(i.getValue(this.key))>=this.value}serialize(){return`${this.key} >= ${this.value}`}keys(){return[this.key]}map(i){return i.mapGreaterEquals(this.key,this.value)}negate(){return this.negated||(this.negated=z$e.create(this.key,this.value,this)),this.negated}},z$e=class a{constructor(i,e,t){this.key=i;this.value=e;this.negated=t;this.type=14}static create(i,e,t=null){return Vgt(e,o=>new a(i,o,t))}cmp(i){return i.type!==this.type?this.type-i.type:fae(this.key,this.value,i.key,i.value)}equals(i){return i.type===this.type?this.key===i.key&&this.value===i.value:!1}substituteConstants(){return this}evaluate(i){return typeof this.value=="string"?!1:parseFloat(i.getValue(this.key))<this.value}serialize(){return`${this.key} < ${this.value}`}keys(){return[this.key]}map(i){return i.mapSmaller(this.key,this.value)}negate(){return this.negated||(this.negated=U$e.create(this.key,this.value,this)),this.negated}},K$e=class a{constructor(i,e,t){this.key=i;this.value=e;this.negated=t;this.type=15}static create(i,e,t=null){return Vgt(e,o=>new a(i,o,t))}cmp(i){return i.type!==this.type?this.type-i.type:fae(this.key,this.value,i.key,i.value)}equals(i){return i.type===this.type?this.key===i.key&&this.value===i.value:!1}substituteConstants(){return this}evaluate(i){return typeof this.value=="string"?!1:parseFloat(i.getValue(this.key))<=this.value}serialize(){return`${this.key} <= ${this.value}`}keys(){return[this.key]}map(i){return i.mapSmallerEquals(this.key,this.value)}negate(){return this.negated||(this.negated=t7.create(this.key,this.value,this)),this.negated}},G$e=class a{constructor(i,e){this.key=i;this.regexp=e;this.type=7;this.negated=null}static create(i,e){return new a(i,e)}cmp(i){if(i.type!==this.type)return this.type-i.type;if(this.key<i.key)return-1;if(this.key>i.key)return 1;let e=this.regexp?this.regexp.source:"",t=i.regexp?i.regexp.source:"";return e<t?-1:e>t?1:0}equals(i){if(i.type===this.type){let e=this.regexp?this.regexp.source:"",t=i.regexp?i.regexp.source:"";return this.key===i.key&&e===t}return!1}substituteConstants(){return this}evaluate(i){let e=i.getValue(this.key);return this.regexp?this.regexp.test(e):!1}serialize(){let i=this.regexp?`/${this.regexp.source}/${this.regexp.flags}`:"/invalid/";return`${this.key} =~ ${i}`}keys(){return[this.key]}map(i){return i.mapRegex(this.key,this.regexp)}negate(){return this.negated||(this.negated=XJt.create(this)),this.negated}},XJt=class a{constructor(i){this._actual=i;this.type=8}static create(i){return new a(i)}cmp(i){return i.type!==this.type?this.type-i.type:this._actual.cmp(i._actual)}equals(i){return i.type===this.type?this._actual.equals(i._actual):!1}substituteConstants(){return this}evaluate(i){return!this._actual.evaluate(i)}serialize(){return`!(${this._actual.serialize()})`}keys(){return this._actual.keys()}map(i){return new a(this._actual.map(i))}negate(){return this._actual}};function f$i(a){let i=null;for(let e=0,t=a.length;e<t;e++){let o=a[e].substituteConstants();if(a[e]!==o&&i===null){i=[];for(let n=0;n<e;n++)i[n]=a[n]}i!==null&&(i[e]=o)}return i===null?a:i}var Fgt=class a{constructor(i,e){this.expr=i;this.negated=e;this.type=6}static create(i,e,t){return a._normalizeArr(i,e,t)}cmp(i){if(i.type!==this.type)return this.type-i.type;if(this.expr.length<i.expr.length)return-1;if(this.expr.length>i.expr.length)return 1;for(let e=0,t=this.expr.length;e<t;e++){let o=B$e(this.expr[e],i.expr[e]);if(o!==0)return o}return 0}equals(i){if(i.type===this.type){if(this.expr.length!==i.expr.length)return!1;for(let e=0,t=this.expr.length;e<t;e++)if(!this.expr[e].equals(i.expr[e]))return!1;return!0}return!1}substituteConstants(){let i=f$i(this.expr);return i===this.expr?this:a.create(i,this.negated,!1)}evaluate(i){for(let e=0,t=this.expr.length;e<t;e++)if(!this.expr[e].evaluate(i))return!1;return!0}static _normalizeArr(i,e,t){let o=[],n=!1;for(let r of i)if(r){if(r.type===1){n=!0;continue}if(r.type===0)return Xy.INSTANCE;if(r.type===6){o.push(...r.expr);continue}o.push(r)}if(o.length===0&&n)return KI.INSTANCE;if(o.length!==0){if(o.length===1)return o[0];o.sort(B$e);for(let r=1;r<o.length;r++)o[r-1].equals(o[r])&&(o.splice(r,1),r--);if(o.length===1)return o[0];for(;o.length>1;){let r=o[o.length-1];if(r.type!==9)break;o.pop();let s=o.pop(),l=o.length===0,c=q$e.create(r.expr.map(u=>a.create([u,s],null,t)),null,l);c&&(o.push(c),o.sort(B$e))}if(o.length===1)return o[0];if(t){for(let r=0;r<o.length;r++)for(let s=r+1;s<o.length;s++)if(o[r].negate().equals(o[s]))return Xy.INSTANCE;if(o.length===1)return o[0]}return new a(o,e)}}serialize(){return this.expr.map(i=>i.serialize()).join(" && ")}keys(){let i=[];for(let e of this.expr)i.push(...e.keys());return i}map(i){return new a(this.expr.map(e=>e.map(i)),null)}negate(){if(!this.negated){let i=[];for(let e of this.expr)i.push(e.negate());this.negated=q$e.create(i,this,!0)}return this.negated}},q$e=class a{constructor(i,e){this.expr=i;this.negated=e;this.type=9}static create(i,e,t){return a._normalizeArr(i,e,t)}cmp(i){if(i.type!==this.type)return this.type-i.type;if(this.expr.length<i.expr.length)return-1;if(this.expr.length>i.expr.length)return 1;for(let e=0,t=this.expr.length;e<t;e++){let o=B$e(this.expr[e],i.expr[e]);if(o!==0)return o}return 0}equals(i){if(i.type===this.type){if(this.expr.length!==i.expr.length)return!1;for(let e=0,t=this.expr.length;e<t;e++)if(!this.expr[e].equals(i.expr[e]))return!1;return!0}return!1}substituteConstants(){let i=f$i(this.expr);return i===this.expr?this:a.create(i,this.negated,!1)}evaluate(i){for(let e=0,t=this.expr.length;e<t;e++)if(this.expr[e].evaluate(i))return!0;return!1}static _normalizeArr(i,e,t){let o=[],n=!1;if(i){for(let r=0,s=i.length;r<s;r++){let l=i[r];if(l){if(l.type===0){n=!0;continue}if(l.type===1)return KI.INSTANCE;if(l.type===9){o=o.concat(l.expr);continue}o.push(l)}}if(o.length===0&&n)return Xy.INSTANCE;o.sort(B$e)}if(o.length!==0){if(o.length===1)return o[0];for(let r=1;r<o.length;r++)o[r-1].equals(o[r])&&(o.splice(r,1),r--);if(o.length===1)return o[0];if(t){for(let r=0;r<o.length;r++)for(let s=r+1;s<o.length;s++)if(o[r].negate().equals(o[s]))return KI.INSTANCE;if(o.length===1)return o[0]}return new a(o,e)}}serialize(){return this.expr.map(i=>i.serialize()).join(" || ")}keys(){let i=[];for(let e of this.expr)i.push(...e.keys());return i}map(i){return new a(this.expr.map(e=>e.map(i)),null)}negate(){if(!this.negated){let i=[];for(let e of this.expr)i.push(e.negate());for(;i.length>1;){let e=i.shift(),t=i.shift(),o=[];for(let n of m$i(e))for(let r of m$i(t))o.push(Fgt.create([n,r],null,!1));i.unshift(a.create(o,null,!1))}this.negated=a.create(i,this,!0)}return this.negated}},Y=class a extends hE{static{this._info=[]}static all(){return a._info.values()}constructor(i,e,t){super(i,null),this._defaultValue=e,typeof t=="object"?a._info.push({...t,key:i}):t!==!0&&a._info.push({key:i,description:t,type:e!=null?typeof e:void 0})}bindTo(i){return i.createKey(this.key,this._defaultValue)}getValue(i){return i.getContextKeyValue(this.key)}toNegated(){return this.negate()}isEqualTo(i){return wV.create(this.key,i)}notEqualsTo(i){return H$e.create(this.key,i)}greater(i){return t7.create(this.key,i)}},X=le("contextKeyService");function v$i(a,i){return a<i?-1:a>i?1:0}function fae(a,i,e,t){return a<e?-1:a>e?1:i<t?-1:i>t?1:0}function Wgt(a,i){if(a.type===0||i.type===1)return!0;if(a.type===9)return i.type===9?p$i(a.expr,i.expr):!1;if(i.type===9){for(let e of i.expr)if(Wgt(a,e))return!0;return!1}if(a.type===6){if(i.type===6)return p$i(i.expr,a.expr);for(let e of a.expr)if(Wgt(e,i))return!0;return!1}return a.equals(i)}function p$i(a,i){let e=0,t=0;for(;e<a.length&&t<i.length;){let o=a[e].cmp(i[t]);if(o<0)return!1;o===0&&e++,t++}return e===a.length}function m$i(a){return a.type===9?a.expr:[a]}var JJt=class{constructor(){this.data=new Map}add(i,e){M9(Fe(i)),M9(xi(e)),M9(!this.data.has(i),"There is already an extension with this id"),this.data.set(i,e)}knows(i){return this.data.has(i)}as(i){return this.data.get(i)||null}dispose(){this.data.forEach(i=>{xL(i.dispose)&&i.dispose()}),this.data.clear()}},ne=new JJt;var ZJt=class a{constructor(){this._coreKeybindings=new qs,this._coreKeybindingRules=new qs,this._extensionKeybindings=[],this._cachedMergedKeybindings=null}static bindToPlatform(i,e){if(e===1){if(i&&i.win)return i.win}else if(e===2){if(i&&i.mac)return i.mac}else if(i&&i.linux)return i.linux;return i}static bindToCurrentPlatform(i){return a.bindToPlatform(i,Po)}registerKeybindingRule(i){let e=a.bindToCurrentPlatform(i),t=new N;if(e&&e.primary){let n=f$e(e.primary,Po);n&&t.add(this._registerDefaultKeybinding(n,i.id,i.args,i.weight,0,i.when))}if(e&&Array.isArray(e.secondary))for(let n=0,r=e.secondary.length;n<r;n++){let s=e.secondary[n],l=f$e(s,Po);l&&t.add(this._registerDefaultKeybinding(l,i.id,i.args,i.weight,-n-1,i.when))}let o=this._coreKeybindingRules.push(i);return t.add(Z(()=>{o()})),t}setExtensionKeybindings(i){let e=[],t=0;for(let o of i)o.keybinding&&(e[t++]={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(i){return wn(this.registerKeybindingRule(i),$e.registerCommand(i))}_registerDefaultKeybinding(i,e,t,o,n,r){let s=this._coreKeybindings.push({keybinding:i,command:e,commandArgs:t,when:r,weight1:o,weight2:n,extensionId:null,isBuiltinExtension:!1});return this._cachedMergedKeybindings=null,Z(()=>{s(),this._cachedMergedKeybindings=null})}getDefaultKeybindings(){return this._cachedMergedKeybindings||(this._cachedMergedKeybindings=Array.from(this._coreKeybindings).concat(this._extensionKeybindings),this._cachedMergedKeybindings.sort(b$i)),this._cachedMergedKeybindings.slice(0)}getDefaultKeybindingsForOS(i){let e=[];for(let t of this._coreKeybindingRules){let o=a.bindToPlatform(t,i);if(o&&o.primary){let n=f$e(o.primary,i);n&&e.push({keybinding:n,command:t.id,commandArgs:t.args,when:t.when,weight1:t.weight,weight2:0,extensionId:null,isBuiltinExtension:!1})}if(o&&Array.isArray(o.secondary))for(let n=0,r=o.secondary.length;n<r;n++){let s=o.secondary[n],l=f$e(s,i);l&&e.push({keybinding:l,command:t.id,commandArgs:t.args,when:t.when,weight1:t.weight,weight2:-n-1,extensionId:null,isBuiltinExtension:!1})}}return e.sort(b$i),e}},Ct=new ZJt,r0o={EditorModes:"platform.keybindingsRegistry"};ne.add(r0o.EditorModes,Ct);function b$i(a,i){if(a.weight1!==i.weight1)return a.weight1-i.weight1;if(a.command&&i.command){if(a.command<i.command)return-1;if(a.command>i.command)return 1}return a.weight2-i.weight2}function gE(a){return a.command!==void 0}function S$i(a){return a.submenu!==void 0}var D=class a{static{this._instances=new Map}static{this.CommandPalette=new a("CommandPalette")}static{this.DebugBreakpointsContext=new a("DebugBreakpointsContext")}static{this.DebugCallStackContext=new a("DebugCallStackContext")}static{this.DebugConsoleContext=new a("DebugConsoleContext")}static{this.DebugVariablesContext=new a("DebugVariablesContext")}static{this.NotebookVariablesContext=new a("NotebookVariablesContext")}static{this.DebugHoverContext=new a("DebugHoverContext")}static{this.DebugWatchContext=new a("DebugWatchContext")}static{this.DebugToolBar=new a("DebugToolBar")}static{this.DebugToolBarStop=new a("DebugToolBarStop")}static{this.DebugDisassemblyContext=new a("DebugDisassemblyContext")}static{this.DebugCallStackToolbar=new a("DebugCallStackToolbar")}static{this.DebugCreateConfiguration=new a("DebugCreateConfiguration")}static{this.DebugScopesContext=new a("DebugScopesContext")}static{this.EditorContext=new a("EditorContext")}static{this.SimpleEditorContext=new a("SimpleEditorContext")}static{this.EditorContent=new a("EditorContent")}static{this.EditorLineNumberContext=new a("EditorLineNumberContext")}static{this.EditorContextCopy=new a("EditorContextCopy")}static{this.EditorContextPeek=new a("EditorContextPeek")}static{this.EditorContextShare=new a("EditorContextShare")}static{this.EditorTitle=new a("EditorTitle")}static{this.ModalEditorTitle=new a("ModalEditorTitle")}static{this.ModalEditorEditorTitle=new a("ModalEditorEditorTitle")}static{this.CompactWindowEditorTitle=new a("CompactWindowEditorTitle")}static{this.EditorTitleRun=new a("EditorTitleRun")}static{this.EditorTitleContext=new a("EditorTitleContext")}static{this.EditorTitleContextShare=new a("EditorTitleContextShare")}static{this.EmptyEditorGroup=new a("EmptyEditorGroup")}static{this.EmptyEditorGroupContext=new a("EmptyEditorGroupContext")}static{this.EditorTabsBarContext=new a("EditorTabsBarContext")}static{this.EditorTabsBarShowTabsSubmenu=new a("EditorTabsBarShowTabsSubmenu")}static{this.EditorTabsBarShowTabsZenModeSubmenu=new a("EditorTabsBarShowTabsZenModeSubmenu")}static{this.EditorActionsPositionSubmenu=new a("EditorActionsPositionSubmenu")}static{this.EditorSplitMoveSubmenu=new a("EditorSplitMoveSubmenu")}static{this.ExplorerContext=new a("ExplorerContext")}static{this.ExplorerContextShare=new a("ExplorerContextShare")}static{this.ExtensionContext=new a("ExtensionContext")}static{this.ExtensionEditorContextMenu=new a("ExtensionEditorContextMenu")}static{this.GlobalActivity=new a("GlobalActivity")}static{this.CommandCenter=new a("CommandCenter")}static{this.CommandCenterCenter=new a("CommandCenterCenter")}static{this.LayoutControlMenuSubmenu=new a("LayoutControlMenuSubmenu")}static{this.LayoutControlMenu=new a("LayoutControlMenu")}static{this.MenubarMainMenu=new a("MenubarMainMenu")}static{this.MenubarAppearanceMenu=new a("MenubarAppearanceMenu")}static{this.MenubarDebugMenu=new a("MenubarDebugMenu")}static{this.MenubarEditMenu=new a("MenubarEditMenu")}static{this.MenubarCopy=new a("MenubarCopy")}static{this.MenubarFileMenu=new a("MenubarFileMenu")}static{this.MenubarGoMenu=new a("MenubarGoMenu")}static{this.MenubarHelpMenu=new a("MenubarHelpMenu")}static{this.MenubarLayoutMenu=new a("MenubarLayoutMenu")}static{this.MenubarNewBreakpointMenu=new a("MenubarNewBreakpointMenu")}static{this.PanelAlignmentMenu=new a("PanelAlignmentMenu")}static{this.PanelPositionMenu=new a("PanelPositionMenu")}static{this.ActivityBarPositionMenu=new a("ActivityBarPositionMenu")}static{this.NotificationsCenterPositionMenu=new a("NotificationsCenterPositionMenu")}static{this.MenubarPreferencesMenu=new a("MenubarPreferencesMenu")}static{this.MenubarRecentMenu=new a("MenubarRecentMenu")}static{this.MenubarSelectionMenu=new a("MenubarSelectionMenu")}static{this.MenubarShare=new a("MenubarShare")}static{this.MenubarSwitchEditorMenu=new a("MenubarSwitchEditorMenu")}static{this.MenubarSwitchGroupMenu=new a("MenubarSwitchGroupMenu")}static{this.MenubarTerminalMenu=new a("MenubarTerminalMenu")}static{this.MenubarTerminalSuggestStatusMenu=new a("MenubarTerminalSuggestStatusMenu")}static{this.MenubarViewMenu=new a("MenubarViewMenu")}static{this.MenubarHomeMenu=new a("MenubarHomeMenu")}static{this.OpenEditorsContext=new a("OpenEditorsContext")}static{this.OpenEditorsContextShare=new a("OpenEditorsContextShare")}static{this.ProblemsPanelContext=new a("ProblemsPanelContext")}static{this.SCMInputBox=new a("SCMInputBox")}static{this.SCMChangeContext=new a("SCMChangeContext")}static{this.SCMResourceContext=new a("SCMResourceContext")}static{this.SCMResourceContextShare=new a("SCMResourceContextShare")}static{this.SCMResourceFolderContext=new a("SCMResourceFolderContext")}static{this.SCMResourceGroupContext=new a("SCMResourceGroupContext")}static{this.SCMSourceControl=new a("SCMSourceControl")}static{this.SCMSourceControlInline=new a("SCMSourceControlInline")}static{this.SCMSourceControlTitle=new a("SCMSourceControlTitle")}static{this.SCMHistoryTitle=new a("SCMHistoryTitle")}static{this.SCMHistoryItemContext=new a("SCMHistoryItemContext")}static{this.SCMHistoryItemChangeContext=new a("SCMHistoryItemChangeContext")}static{this.SCMHistoryItemRefContext=new a("SCMHistoryItemRefContext")}static{this.SCMArtifactGroupContext=new a("SCMArtifactGroupContext")}static{this.SCMArtifactContext=new a("SCMArtifactContext")}static{this.SCMQuickDiffDecorations=new a("SCMQuickDiffDecorations")}static{this.SCMTitle=new a("SCMTitle")}static{this.SearchContext=new a("SearchContext")}static{this.SearchActionMenu=new a("SearchActionContext")}static{this.StatusBarWindowIndicatorMenu=new a("StatusBarWindowIndicatorMenu")}static{this.StatusBarRemoteIndicatorMenu=new a("StatusBarRemoteIndicatorMenu")}static{this.StickyScrollContext=new a("StickyScrollContext")}static{this.TestItem=new a("TestItem")}static{this.TestItemGutter=new a("TestItemGutter")}static{this.TestProfilesContext=new a("TestProfilesContext")}static{this.TestMessageContext=new a("TestMessageContext")}static{this.TestMessageContent=new a("TestMessageContent")}static{this.TestPeekElement=new a("TestPeekElement")}static{this.TestPeekTitle=new a("TestPeekTitle")}static{this.TestCallStack=new a("TestCallStack")}static{this.TestCoverageFilterItem=new a("TestCoverageFilterItem")}static{this.TouchBarContext=new a("TouchBarContext")}static{this.TitleBar=new a("TitleBar")}static{this.TitleBarAdjacentCenter=new a("TitleBarAdjacentCenter")}static{this.TitleBarContext=new a("TitleBarContext")}static{this.TitleBarTitleContext=new a("TitleBarTitleContext")}static{this.TunnelContext=new a("TunnelContext")}static{this.TunnelPrivacy=new a("TunnelPrivacy")}static{this.TunnelProtocol=new a("TunnelProtocol")}static{this.TunnelPortInline=new a("TunnelInline")}static{this.TunnelTitle=new a("TunnelTitle")}static{this.TunnelLocalAddressInline=new a("TunnelLocalAddressInline")}static{this.TunnelOriginInline=new a("TunnelOriginInline")}static{this.ViewItemContext=new a("ViewItemContext")}static{this.ViewContainerTitle=new a("ViewContainerTitle")}static{this.ViewContainerTitleContext=new a("ViewContainerTitleContext")}static{this.ViewTitle=new a("ViewTitle")}static{this.ViewTitleContext=new a("ViewTitleContext")}static{this.CommentEditorActions=new a("CommentEditorActions")}static{this.CommentThreadTitle=new a("CommentThreadTitle")}static{this.CommentThreadActions=new a("CommentThreadActions")}static{this.CommentThreadAdditionalActions=new a("CommentThreadAdditionalActions")}static{this.CommentThreadTitleContext=new a("CommentThreadTitleContext")}static{this.CommentThreadCommentContext=new a("CommentThreadCommentContext")}static{this.CommentTitle=new a("CommentTitle")}static{this.CommentActions=new a("CommentActions")}static{this.CommentsViewThreadActions=new a("CommentsViewThreadActions")}static{this.InteractiveToolbar=new a("InteractiveToolbar")}static{this.InteractiveCellTitle=new a("InteractiveCellTitle")}static{this.InteractiveCellDelete=new a("InteractiveCellDelete")}static{this.InteractiveCellExecute=new a("InteractiveCellExecute")}static{this.InteractiveInputExecute=new a("InteractiveInputExecute")}static{this.InteractiveInputConfig=new a("InteractiveInputConfig")}static{this.ReplInputExecute=new a("ReplInputExecute")}static{this.IssueReporter=new a("IssueReporter")}static{this.NotebookToolbar=new a("NotebookToolbar")}static{this.NotebookToolbarContext=new a("NotebookToolbarContext")}static{this.NotebookStickyScrollContext=new a("NotebookStickyScrollContext")}static{this.NotebookCellTitle=new a("NotebookCellTitle")}static{this.NotebookCellDelete=new a("NotebookCellDelete")}static{this.NotebookCellInsert=new a("NotebookCellInsert")}static{this.NotebookCellBetween=new a("NotebookCellBetween")}static{this.NotebookCellListTop=new a("NotebookCellTop")}static{this.NotebookCellExecute=new a("NotebookCellExecute")}static{this.NotebookCellExecuteGoTo=new a("NotebookCellExecuteGoTo")}static{this.NotebookCellExecutePrimary=new a("NotebookCellExecutePrimary")}static{this.NotebookDiffCellInputTitle=new a("NotebookDiffCellInputTitle")}static{this.NotebookDiffDocumentMetadata=new a("NotebookDiffDocumentMetadata")}static{this.NotebookDiffCellMetadataTitle=new a("NotebookDiffCellMetadataTitle")}static{this.NotebookDiffCellOutputsTitle=new a("NotebookDiffCellOutputsTitle")}static{this.NotebookOutputToolbar=new a("NotebookOutputToolbar")}static{this.NotebookOutlineFilter=new a("NotebookOutlineFilter")}static{this.NotebookOutlineActionMenu=new a("NotebookOutlineActionMenu")}static{this.NotebookEditorLayoutConfigure=new a("NotebookEditorLayoutConfigure")}static{this.NotebookKernelSource=new a("NotebookKernelSource")}static{this.BulkEditTitle=new a("BulkEditTitle")}static{this.BulkEditContext=new a("BulkEditContext")}static{this.TimelineItemContext=new a("TimelineItemContext")}static{this.TimelineTitle=new a("TimelineTitle")}static{this.TimelineTitleContext=new a("TimelineTitleContext")}static{this.TimelineFilterSubMenu=new a("TimelineFilterSubMenu")}static{this.AccountsContext=new a("AccountsContext")}static{this.SidebarTitle=new a("SidebarTitle")}static{this.PanelTitle=new a("PanelTitle")}static{this.AuxiliaryBarTitle=new a("AuxiliaryBarTitle")}static{this.TerminalInstanceContext=new a("TerminalInstanceContext")}static{this.TerminalEditorInstanceContext=new a("TerminalEditorInstanceContext")}static{this.TerminalNewDropdownContext=new a("TerminalNewDropdownContext")}static{this.TerminalTabContext=new a("TerminalTabContext")}static{this.TerminalTabEmptyAreaContext=new a("TerminalTabEmptyAreaContext")}static{this.TerminalStickyScrollContext=new a("TerminalStickyScrollContext")}static{this.WebviewContext=new a("WebviewContext")}static{this.InlineCompletionsActions=new a("InlineCompletionsActions")}static{this.InlineEditsActions=new a("InlineEditsActions")}static{this.NewFile=new a("NewFile")}static{this.MergeInput1Toolbar=new a("MergeToolbar1Toolbar")}static{this.MergeInput2Toolbar=new a("MergeToolbar2Toolbar")}static{this.MergeBaseToolbar=new a("MergeBaseToolbar")}static{this.MergeInputResultToolbar=new a("MergeToolbarResultToolbar")}static{this.InlineSuggestionToolbar=new a("InlineSuggestionToolbar")}static{this.InlineEditToolbar=new a("InlineEditToolbar")}static{this.ChatContext=new a("ChatContext")}static{this.ChatCodeBlock=new a("ChatCodeblock")}static{this.ChatCompareBlock=new a("ChatCompareBlock")}static{this.ChatMessageTitle=new a("ChatMessageTitle")}static{this.ChatWelcomeContext=new a("ChatWelcomeContext")}static{this.ChatMessageFooter=new a("ChatMessageFooter")}static{this.ChatExecute=new a("ChatExecute")}static{this.ChatExecuteQueue=new a("ChatExecuteQueue")}static{this.ChatInput=new a("ChatInput")}static{this.ChatInputSecondary=new a("ChatInputSecondary")}static{this.ChatInputSide=new a("ChatInputSide")}static{this.ChatModePicker=new a("ChatModePicker")}static{this.ChatEditingWidgetToolbar=new a("ChatEditingWidgetToolbar")}static{this.ChatEditingSessionChangesToolbar=new a("ChatEditingSessionChangesToolbar")}static{this.ChatEditingSessionApplySubmenu=new a("ChatEditingSessionApplySubmenu")}static{this.ChatEditingSessionTitleToolbar=new a("ChatEditingSessionTitleToolbar")}static{this.ChatEditingSessionChangeToolbar=new a("ChatEditingSessionChangeToolbar")}static{this.ChatEditingSessionChangesVersionsSubmenu=new a("ChatEditingSessionChangesVersionsSubmenu")}static{this.ChatEditingSessionChangesFileHeaderToolbar=new a("ChatEditingSessionChangesFileHeaderToolbar")}static{this.ChatEditingEditorContent=new a("ChatEditingEditorContent")}static{this.ChatEditingEditorHunk=new a("ChatEditingEditorHunk")}static{this.ChatEditingDeletedNotebookCell=new a("ChatEditingDeletedNotebookCell")}static{this.ChatInputAttachmentToolbar=new a("ChatInputAttachmentToolbar")}static{this.ChatEditingWidgetModifiedFilesToolbar=new a("ChatEditingWidgetModifiedFilesToolbar")}static{this.ChatInputResourceAttachmentContext=new a("ChatInputResourceAttachmentContext")}static{this.ChatInputSymbolAttachmentContext=new a("ChatInputSymbolAttachmentContext")}static{this.ChatInlineResourceAnchorContext=new a("ChatInlineResourceAnchorContext")}static{this.ChatInlineSymbolAnchorContext=new a("ChatInlineSymbolAnchorContext")}static{this.ChatMessageCheckpoint=new a("ChatMessageCheckpoint")}static{this.ChatMessageRestoreCheckpoint=new a("ChatMessageRestoreCheckpoint")}static{this.ChatNewMenu=new a("ChatNewMenu")}static{this.ChatEditingCodeBlockContext=new a("ChatEditingCodeBlockContext")}static{this.ChatTitleBarMenu=new a("ChatTitleBarMenu")}static{this.ChatAttachmentsContext=new a("ChatAttachmentsContext")}static{this.ChatTipContext=new a("ChatTipContext")}static{this.ChatTipToolbar=new a("ChatTipToolbar")}static{this.ChatToolOutputResourceToolbar=new a("ChatToolOutputResourceToolbar")}static{this.ChatTextEditorMenu=new a("ChatTextEditorMenu")}static{this.ChatToolOutputResourceContext=new a("ChatToolOutputResourceContext")}static{this.ChatMultiDiffContext=new a("ChatMultiDiffContext")}static{this.ChatConfirmationMenu=new a("ChatConfirmationMenu")}static{this.ChatEditorInlineMenu=new a("ChatEditorInlineGutter")}static{this.ChatEditorInlineExecute=new a("ChatEditorInputExecute")}static{this.ChatEditorInlineInputSide=new a("ChatEditorInputSide")}static{this.InlineChatEditorAffordance=new a("InlineChatEditorAffordance")}static{this.InlineChatInput=new a("InlineChatInput")}static{this.AccessibleView=new a("AccessibleView")}static{this.MultiDiffEditorContent=new a("MultiDiffEditorContent")}static{this.MultiDiffEditorFileToolbar=new a("MultiDiffEditorFileToolbar")}static{this.DiffEditorHunkToolbar=new a("DiffEditorHunkToolbar")}static{this.DiffEditorSelectionToolbar=new a("DiffEditorSelectionToolbar")}static{this.BrowserNavigationToolbar=new a("BrowserNavigationToolbar")}static{this.BrowserActionsToolbar=new a("BrowserActionsToolbar")}static{this.AgentSessionsViewerFilterSubMenu=new a("AgentSessionsViewerFilterSubMenu")}static{this.AgentSessionsContext=new a("AgentSessionsContext")}static{this.AgentSessionSectionContext=new a("AgentSessionSectionContext")}static{this.AgentSessionsCreateSubMenu=new a("AgentSessionsCreateSubMenu")}static{this.AgentSessionsToolbar=new a("AgentSessionsToolbar")}static{this.AgentSessionItemToolbar=new a("AgentSessionItemToolbar")}static{this.AgentSessionSectionToolbar=new a("AgentSessionSectionToolbar")}static{this.AgentsTitleBarControlMenu=new a("AgentsTitleBarControlMenu")}static{this.ChatViewSessionTitleNavigationToolbar=new a("ChatViewSessionTitleNavigationToolbar")}static{this.ChatViewSessionTitleToolbar=new a("ChatViewSessionTitleToolbar")}static{this.ChatContextUsageActions=new a("ChatContextUsageActions")}static{this.MarkerHoverStatusBar=new a("MarkerHoverParticipant.StatusBar")}static for(i){return a._instances.get(i)??new a(i)}constructor(i){if(a._instances.has(i))throw new TypeError(`MenuId with identifier '${i}' already exists. Use MenuId.for(ident) or a unique identifier`);a._instances.set(i,this),this.id=i}},Kt=le("menuService"),vae=class a{constructor(i){this.id=i;this.has=e=>e===i}static{this._all=new Map}static for(i){let e=this._all.get(i);return e||(e=new a(i),this._all.set(i,e)),e}static merge(i){let e=new Set;for(let t of i)t instanceof a&&e.add(t.id);return e}},ve=new class{constructor(){this._commands=new Map;this._menuItems=new Map;this._onDidChangeMenu=new A9({merge:vae.merge});this.onDidChangeMenu=this._onDidChangeMenu.event}addCommand(a){return this._commands.set(a.id,a),this._onDidChangeMenu.fire(vae.for(D.CommandPalette)),im(Z(()=>{this._commands.delete(a.id)&&this._onDidChangeMenu.fire(vae.for(D.CommandPalette))}))}getCommand(a){return this._commands.get(a)}getCommands(){let a=new Map;return this._commands.forEach((i,e)=>a.set(e,i)),a}appendMenuItem(a,i){let e=this._menuItems.get(a);e||(e=new qs,this._menuItems.set(a,e));let t=e.push(i);return this._onDidChangeMenu.fire(vae.for(a)),im(Z(()=>{t(),this._onDidChangeMenu.fire(vae.for(a))}))}appendMenuItems(a){let i=new N;for(let{id:e,item:t}of a)i.add(this.appendMenuItem(e,t));return i}getMenuItems(a){let i;return this._menuItems.has(a)?i=[...this._menuItems.get(a)]:i=[],a===D.CommandPalette&&this._appendImplicitItems(i),i}_appendImplicitItems(a){let i=new Set;for(let e of a)gE(e)&&(i.add(e.command.id),e.alt&&i.add(e.alt.id));this._commands.forEach((e,t)=>{i.has(t)||a.push({command:e})})}},Nc=class extends Fs{constructor(e,t,o){super(`submenuitem.${e.submenu.id}`,typeof e.title=="string"?e.title:e.title.value,o,"submenu");this.item=e;this.hideActions=t}},Lo=class{constructor(i,e,t,o,n,r,s){this.hideActions=o;this.menuKeybinding=n;this._commandService=s;this.id=i.id,this.label=Lo.label(i,t),this.tooltip=(typeof i.tooltip=="string"?i.tooltip:i.tooltip?.value)??"",this.enabled=!i.precondition||r.contextMatchesRules(i.precondition),this.checked=void 0;let l;if(i.toggled){let c=i.toggled.condition?i.toggled:{condition:i.toggled};this.checked=r.contextMatchesRules(c.condition),this.checked&&c.tooltip&&(this.tooltip=typeof c.tooltip=="string"?c.tooltip:c.tooltip.value),this.checked&&q.isThemeIcon(c.icon)&&(l=c.icon),this.checked&&c.title&&(this.label=typeof c.title=="string"?c.title:c.title.value)}l||(l=q.isThemeIcon(i.icon)?i.icon:void 0),this.item=i,this.alt=e?new Lo(e,void 0,t,o,void 0,r,s):void 0,this._options=t,this.class=l&&q.asClassName(l)}static label(i,e){return e?.renderShortTitle&&i.shortTitle?typeof i.shortTitle=="string"?i.shortTitle:i.shortTitle.value:typeof i.title=="string"?i.title:i.title.value}run(...i){let e=[];return this._options?.args?e=[...e,...this._options.args]:this._options?.arg&&(e=[...e,this._options.arg]),this._options?.shouldForwardArgs&&(e=[...e,...i]),this._commandService.executeCommand(this.id,...e)}};Lo=I([m(5,X),m(6,ge)],Lo);var K=class{constructor(i){this.desc=i}};function W(a){let i=[],e=new a,{f1:t,menu:o,keybinding:n,...r}=e.desc;if($e.getCommand(r.id))throw new Error(`Cannot register two commands with the same id: ${r.id}`);if(i.push($e.registerCommand({id:r.id,handler:(s,...l)=>e.run(s,...l),metadata:r.metadata??{description:e.desc.title}})),Array.isArray(o))for(let s of o)i.push(ve.appendMenuItem(s.id,{command:{...r,precondition:s.precondition===null?void 0:r.precondition},...s}));else o&&i.push(ve.appendMenuItem(o.id,{command:{...r,precondition:o.precondition===null?void 0:r.precondition},...o}));if(t&&(i.push(ve.appendMenuItem(D.CommandPalette,{command:r,when:r.precondition})),i.push(ve.addCommand(r))),Array.isArray(n))for(let s of n)i.push(Ct.registerKeybindingRule({...s,id:r.id,when:r.precondition?C.and(r.precondition,s.when):s.when}));else n&&i.push(Ct.registerKeybindingRule({...n,id:r.id,when:r.precondition?C.and(r.precondition,n.when):n.when}));return{dispose(){Be(i)}}}var Te=le("telemetryService");function I$i(a,i){return a.telemetryLevel>=i}var Bgt=le("customEndpointTelemetryService");var Hgt="telemetry.firstSessionDate",y$i="telemetry.lastSessionDate";var w$i="telemetry",uO="telemetry.telemetryLevel",Ugt="telemetry.enableCrashReporter",bae="telemetry.enableTelemetry";function eZt(a,i){return i&&(a.stack||a.stacktrace)?d(116,null,x$i(a),C$i(a.stack)||C$i(a.stacktrace)):x$i(a)}function C$i(a){return Array.isArray(a)?a.join(`
`):a}function x$i(a){return a.code==="ERR_UNC_HOST_NOT_ALLOWED"?`${a.message}. Please update the 'security.allowedUNCHosts' setting if you want to allow this host.`:typeof a.code=="string"&&typeof a.errno=="number"&&typeof a.syscall=="string"?d(115,null,a.message):a.message||d(113,null)}function xn(a=null,i=!1){if(!a)return d(113,null);if(Array.isArray(a)){let e=di(a),t=xn(e[0],i);return e.length>1?d(114,null,t,e.length):t}if(Fe(a))return a;if(a.detail){let e=a.detail;if(e.error)return eZt(e.error,i);if(e.exception)return eZt(e.exception,i)}return a.stack?eZt(a,i):a.message?a.message:d(113,null)}function i7(a){let i=a;return i instanceof Error&&Array.isArray(i.actions)}function w1(a,i){let e;return typeof a=="string"?e=new Error(a):e=a,e.actions=i,e}var se=le("logService"),Il=le("loggerService");function o7(a){return Yo(a)}var j$e=3;function VIe(a,i){return a!==0&&a<=i}function Sae(a,i,e){switch(i){case 1:a.trace(e);break;case 2:a.debug(e);break;case 3:a.info(e);break;case 4:a.warn(e);break;case 5:a.error(e);break;case 0:break;default:throw new Error(`Invalid log level ${i}`)}}function FIe(a,i=!1){let e="";for(let t=0;t<a.length;t++){let o=a[t];if(o instanceof Error&&(o=xn(o,i)),typeof o=="object")try{o=JSON.stringify(o)}catch{}e+=(t>0?" ":"")+o}return e}var C1=class extends x{constructor(){super(...arguments);this.level=j$e;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 VIe(this.level,e)}canLog(e){return this._store.isDisposed?!1:this.checkLogLevel(e)}},WIe=class extends C1{constructor(e){super();this.logAlways=e}checkLogLevel(e){return this.logAlways||super.checkLogLevel(e)}trace(e,...t){this.canLog(1)&&this.log(1,FIe([e,...t],!0))}debug(e,...t){this.canLog(2)&&this.log(2,FIe([e,...t]))}info(e,...t){this.canLog(3)&&this.log(3,FIe([e,...t]))}warn(e,...t){this.canLog(4)&&this.log(4,FIe([e,...t]))}error(e,...t){if(this.canLog(5))if(e instanceof Error){let o=Array.prototype.slice.call(arguments);o[0]=e.stack,this.log(5,FIe(o))}else this.log(5,FIe([e,...t]))}flush(){}};var zgt=class extends C1{constructor(e=j$e,t=!0){super();this.useColors=t;this.setLevel(e)}trace(e,...t){this.canLog(1)&&(this.useColors?console.log("%cTRACE","color: #888",e,...t):console.log(e,...t))}debug(e,...t){this.canLog(2)&&(this.useColors?console.log("%cDEBUG","background: #eee; color: #888",e,...t):console.log(e,...t))}info(e,...t){this.canLog(3)&&(this.useColors?console.log("%c INFO","color: #33f",e,...t):console.log(e,...t))}warn(e,...t){this.canLog(4)&&(this.useColors?console.warn("%c WARN","color: #993",e,...t):console.log(e,...t))}error(e,...t){this.canLog(5)&&(this.useColors?console.error("%c  ERR","color: #f33",e,...t):console.error(e,...t))}flush(){}},$$e=class extends C1{constructor(e,t=j$e){super();this.adapter=e;this.setLevel(t)}trace(e,...t){this.canLog(1)&&this.adapter.log(1,[this.extractMessage(e),...t])}debug(e,...t){this.canLog(2)&&this.adapter.log(2,[this.extractMessage(e),...t])}info(e,...t){this.canLog(3)&&this.adapter.log(3,[this.extractMessage(e),...t])}warn(e,...t){this.canLog(4)&&this.adapter.log(4,[this.extractMessage(e),...t])}error(e,...t){this.canLog(5)&&this.adapter.log(5,[this.extractMessage(e),...t])}extractMessage(e){return typeof e=="string"?e:xn(e,this.canLog(1))}flush(){}},Kgt=class extends C1{constructor(e){super();this.loggers=e;e.length&&this.setLevel(e[0].getLevel())}setLevel(e){for(let t of this.loggers)t.setLevel(e);super.setLevel(e)}trace(e,...t){for(let o of this.loggers)o.trace(e,...t)}debug(e,...t){for(let o of this.loggers)o.debug(e,...t)}info(e,...t){for(let o of this.loggers)o.info(e,...t)}warn(e,...t){for(let o of this.loggers)o.warn(e,...t)}error(e,...t){for(let o of this.loggers)o.error(e,...t)}flush(){for(let e of this.loggers)e.flush()}dispose(){for(let e of this.loggers)e.dispose();super.dispose()}},Ggt=class extends x{constructor(e,t,o){super();this.logLevel=e;this.logsHome=t;this._loggers=new gt;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 n of o)this._loggers.set(n.resource,{logger:void 0,info:n})}getLoggerEntry(e){return Fe(e)?[...this._loggers.values()].find(t=>t.info.id===e):this._loggers.get(e)}getLogger(e){return this.getLoggerEntry(e)?.logger}createLogger(e,t){let o=this.toResource(e),n=Fe(e)?e:t?.id??_r(o.toString()).toString(16),r=this._loggers.get(o)?.logger,s=t?.logLevel==="always"?1:t?.logLevel;r||(r=this.doCreateLogger(o,s??this.getLogLevel(o)??this.logLevel,{...t,id:n}));let l={logger:r,info:{resource:o,id:n,logLevel:s,name:t?.name,hidden:t?.hidden,group:t?.group,extensionId:t?.extensionId,when:t?.when}};return this.registerLogger(l.info),this._loggers.set(o,l),r}toResource(e){return Fe(e)?Ge(this.logsHome,`${e.replace(/[\\/:\*\?"<>\|]/g,"")}.log`):e}setLogLevel(e,t){if(A.isUri(e)){let o=e,n=t,r=this._loggers.get(o);r&&n!==r.info.logLevel&&(r.info.logLevel=n===this.logLevel?void 0:n,r.logger?.setLevel(n),this._loggers.set(r.info.resource,r),this._onDidChangeLogLevel.fire([o,n]))}else{this.logLevel=e;for(let[o,n]of this._loggers.entries())this._loggers.get(o)?.info.logLevel===void 0&&n.logger?.setLevel(this.logLevel);this._onDidChangeLogLevel.fire(this.logLevel)}}setVisibility(e,t){let o=this.getLoggerEntry(e);o&&t!==!o.info.hidden&&(o.info.hidden=!t,this._loggers.set(o.info.resource,o),this._onDidChangeVisibility.fire([o.info.resource,t]))}getLogLevel(e){let t;return e&&(t=this._loggers.get(e)?.info.logLevel),t??this.logLevel}registerLogger(e){let t=this._loggers.get(e.resource);t?t.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 t=this.toResource(e),o=this._loggers.get(t);o&&(o.logger&&o.logger.dispose(),this._loggers.delete(t),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()}},tZt=class{constructor(){this.onDidChangeLogLevel=new E().event}setLevel(i){}getLevel(){return 3}trace(i,...e){}debug(i,...e){}info(i,...e){}warn(i,...e){}error(i,...e){}critical(i,...e){}dispose(){}flush(){}},qgt=class extends tZt{};function iZt(a){if(a.verbose)return 1;if(typeof a.logLevel=="string"){let i=Iae(a.logLevel.toLowerCase());if(i!==void 0)return i}return j$e}function IC(a){switch(a){case 1:return"trace";case 2:return"debug";case 3:return"info";case 4:return"warn";case 5:return"error";case 0:return"off"}}function Q$e(a){switch(a){case 1:return{original:"Trace",value:d(2213,null)};case 2:return{original:"Debug",value:d(2209,null)};case 3:return{original:"Info",value:d(2211,null)};case 4:return{original:"Warning",value:d(2214,null)};case 5:return{original:"Error",value:d(2210,null)};case 0:return{original:"Off",value:d(2212,null)}}}function Iae(a){switch(a){case"trace":return 1;case"debug":return 2;case"info":return 3;case"warn":return 4;case"error":return 5;case"critical":return 5;case"off":return 0}}var k$i=new Y("logLevel",IC(3));var BIe=class a{static{this.REGISTERED_COMMANDS=new Set}static getRegisteredCommands(){return[...a.REGISTERED_COMMANDS]}static registerCommand(i){a.REGISTERED_COMMANDS.add(i)}};var yae=class{constructor(i){this.id=i.id,this.precondition=i.precondition,this._kbOpts=i.kbOpts,this._menuOpts=i.menuOpts,this.metadata=i.metadata,this.canTriggerInlineEdits=i.canTriggerInlineEdits}register(){if(Array.isArray(this._menuOpts)?this._menuOpts.forEach(this._registerMenuItem,this):this._menuOpts&&this._registerMenuItem(this._menuOpts),this._kbOpts){let i=Array.isArray(this._kbOpts)?this._kbOpts:[this._kbOpts];for(let e of i){let t=e.kbExpr;this.precondition&&(t?t=C.and(t,this.precondition):t=this.precondition);let o={id:this.id,weight:e.weight,args:e.args,when:t,primary:e.primary,secondary:e.secondary,win:e.win,linux:e.linux,mac:e.mac};Ct.registerKeybindingRule(o)}}$e.registerCommand({id:this.id,handler:(i,e)=>this.runCommand(i,e),metadata:this.metadata}),this.canTriggerInlineEdits&&BIe.registerCommand(this.id)}_registerMenuItem(i){ve.appendMenuItem(i.menuId,{group:i.group,command:{id:this.id,title:i.title,icon:i.icon,precondition:this.precondition},when:i.when,order:i.order})}},pO=class extends yae{constructor(){super(...arguments);this._implementations=[]}addImplementation(e,t,o,n){return this._implementations.push({priority:e,name:t,implementation:o,when:n}),this._implementations.sort((r,s)=>s.priority-r.priority),{dispose:()=>{for(let r=0;r<this._implementations.length;r++)if(this._implementations[r].implementation===o){this._implementations.splice(r,1);return}}}}runCommand(e,t){let o=e.get(se),n=e.get(X);o.trace(`Executing Command '${this.id}' which has ${this._implementations.length} bound.`);for(let r of this._implementations){if(r.when){let l=n.getContext(Nn());if(!r.when.evaluate(l))continue}let s=r.implementation(e,t);if(s)return o.trace(`Command '${this.id}' was handled by '${r.name}'.`),typeof s=="boolean"?void 0:s}o.trace(`The Command '${this.id}' was not handled by any implementation.`)}},$gt=class extends yae{constructor(e,t){super(t);this.command=e}runCommand(e,t){return this.command.runCommand(e,t)}},Oc=class a extends yae{static bindToContribution(i){return class extends a{constructor(t){super(t),this._callback=t.handler}runEditorCommand(t,o,n){let r=i(o);r&&this._callback(r,n)}}}static runEditorCommand(i,e,t,o){let n=i.get(qt),r=n.getFocusedCodeEditor()||n.getActiveCodeEditor();if(r)return r.invokeWithinContext(s=>{if(s.get(X).contextMatchesRules(t??void 0))return o(s,r,e)})}runCommand(i,e){return a.runEditorCommand(i,e,this.precondition,(t,o,n)=>this.runEditorCommand(t,o,n))}},Di=class a extends Oc{static convertOptions(i){let e;Array.isArray(i.menuOpts)?e=i.menuOpts:i.menuOpts?e=[i.menuOpts]:e=[];function t(o){return o.menuId||(o.menuId=D.EditorContext),o.title||(o.title=typeof i.label=="string"?i.label:i.label.value),o.when=C.and(i.precondition,o.when),o}return Array.isArray(i.contextMenuOpts)?e.push(...i.contextMenuOpts.map(t)):i.contextMenuOpts&&e.push(t(i.contextMenuOpts)),i.menuOpts=e,i}constructor(i){super(a.convertOptions(i)),typeof i.label=="string"?(this.label=i.label,this.alias=i.alias??i.label):(this.label=i.label.value,this.alias=i.alias??i.label.original)}runEditorCommand(i,e,t){return this.reportTelemetry(i,e),this.run(i,e,t||{})}reportTelemetry(i,e){i.get(Te).publicLog2("editorActionInvoked",{name:this.label,id:this.id})}},wae=class extends Di{constructor(){super(...arguments);this._implementations=[]}addImplementation(e,t){return this._implementations.push([e,t]),this._implementations.sort((o,n)=>n[0]-o[0]),{dispose:()=>{for(let o=0;o<this._implementations.length;o++)if(this._implementations[o][1]===t){this._implementations.splice(o,1);return}}}}run(e,t,o){for(let n of this._implementations){let r=n[1](e,t,o);if(r)return typeof r=="boolean"?void 0:r}}},pl=class extends K{run(i,...e){let t=i.get(qt),o=t.getFocusedCodeEditor()||t.getActiveCodeEditor();if(o)return o.invokeWithinContext(n=>{let r=n.get(X),s=n.get(se);if(!r.contextMatchesRules(this.desc.precondition??void 0)){s.debug("[EditorAction2] NOT running command because its precondition is FALSE",this.desc.id,this.desc.precondition?.serialize());return}return this.runEditorCommand(n,o,...e)})}};function qS(a,i){$e.registerCommand(a,function(e,...t){let o=e.get(F),[n,r]=t;wo(A.isUri(n)),wo(ye.isIPosition(r));let s=e.get(Tt).getModel(n);if(s){let l=ye.lift(r);return o.invokeFunction(i,s,l,...t.slice(2))}return e.get(Bt).createModelReference(n).then(l=>new Promise((c,u)=>{try{let p=o.invokeFunction(i,l.object.textEditorModel,ye.lift(r),t.slice(2));c(p)}catch(p){u(p)}}).finally(()=>{l.dispose()}))})}function Xi(a){return BL.INSTANCE.registerEditorCommand(a),a}function ni(a){let i=new a;return BL.INSTANCE.registerEditorAction(i),i}function Y$e(a){return BL.INSTANCE.registerEditorAction(a),a}function E$i(a){BL.INSTANCE.registerEditorAction(a)}function xo(a,i,e){BL.INSTANCE.registerEditorContribution(a,i,e)}function jgt(a,i){BL.INSTANCE.registerDiffEditorContribution(a,i)}var Ba;(n=>{function a(r){return BL.INSTANCE.getEditorCommand(r)}n.getEditorCommand=a;function i(){return BL.INSTANCE.getEditorActions()}n.getEditorActions=i;function e(){return BL.INSTANCE.getEditorContributions()}n.getEditorContributions=e;function t(r){return BL.INSTANCE.getEditorContributions().filter(s=>r.indexOf(s.id)>=0)}n.getSomeEditorContributions=t;function o(){return BL.INSTANCE.getDiffEditorContributions()}n.getDiffEditorContributions=o})(Ba||={});var s0o={EditorCommonContributions:"editor.contributions"},BL=class a{constructor(){this.editorContributions=[];this.diffEditorContributions=[];this.editorActions=[];this.editorCommands=Object.create(null)}static{this.INSTANCE=new a}registerEditorContribution(i,e,t){this.editorContributions.push({id:i,ctor:e,instantiation:t})}getEditorContributions(){return this.editorContributions.slice(0)}registerDiffEditorContribution(i,e){this.diffEditorContributions.push({id:i,ctor:e})}getDiffEditorContributions(){return this.diffEditorContributions.slice(0)}registerEditorAction(i){i.register(),this.editorActions.push(i)}getEditorActions(){return this.editorActions}registerEditorCommand(i){i.register(),this.editorCommands[i.id]=i}getEditorCommand(i){return this.editorCommands[i]||null}};ne.add(s0o.EditorCommonContributions,BL.INSTANCE);function X$e(a){return a.register(),a}var S_=X$e(new pO({id:"undo",precondition:void 0,kbOpts:{weight:0,primary:2104},menuOpts:[{menuId:D.MenubarEditMenu,group:"1_do",title:d(185,null),order:1},{menuId:D.CommandPalette,group:"",title:d(188,null),order:1},{menuId:D.SimpleEditorContext,group:"1_do",title:d(188,null),order:1}]}));X$e(new $gt(S_,{id:"default:undo",precondition:void 0}));var I_=X$e(new pO({id:"redo",precondition:void 0,kbOpts:{weight:0,primary:2103,secondary:[3128],mac:{primary:3128}},menuOpts:[{menuId:D.MenubarEditMenu,group:"1_do",title:d(183,null),order:2},{menuId:D.CommandPalette,group:"",title:d(186,null),order:1},{menuId:D.SimpleEditorContext,group:"1_do",title:d(186,null),order:2}]}));X$e(new $gt(I_,{id:"default:redo",precondition:void 0}));var Qgt=X$e(new pO({id:"editor.action.selectAll",precondition:void 0,kbOpts:{weight:0,kbExpr:null,primary:2079},menuOpts:[{menuId:D.MenubarSelectionMenu,group:"1_basic",title:d(184,null),order:1},{menuId:D.CommandPalette,group:"",title:d(187,null),order:1},{menuId:D.SimpleEditorContext,group:"9_select",title:d(187,null),order:1}]}));function Ji(a){if(!a||typeof a!="object"||a instanceof RegExp)return a;let i=Array.isArray(a)?[]:{};return Object.entries(a).forEach(([e,t])=>{i[e]=t&&typeof t=="object"?Ji(t):t}),i}function T$i(a){if(!a||typeof a!="object")return a;let i=[a];for(;i.length>0;){let e=i.shift();Object.freeze(e);for(let t in e)if(_$i.call(e,t)){let o=e[t];typeof o=="object"&&!Object.isFrozen(o)&&!V2i(o)&&i.push(o)}}return a}var _$i=Object.prototype.hasOwnProperty;function Fx(a,i){return oZt(a,i,new Set)}function oZt(a,i,e){if(nr(a))return a;let t=i(a);if(typeof t<"u")return t;if(Array.isArray(a)){let o=[];for(let n of a)o.push(oZt(n,i,e));return o}if(xi(a)){if(e.has(a))throw new Error("Cannot clone recursive data-structure");e.add(a);let o={};for(let n in a)_$i.call(a,n)&&(o[n]=oZt(a[n],i,e));return e.delete(a),o}return a}function Xu(a,i,e=!0){return xi(a)?(xi(i)&&Object.keys(i).forEach(t=>{t in a?e&&(xi(a[t])&&xi(i[t])?Xu(a[t],i[t],e):a[t]=i[t]):a[t]=i[t]}),a):i}function eo(a,i){if(a===i)return!0;if(a==null||i===null||i===void 0||typeof a!=typeof i||typeof a!="object"||Array.isArray(a)!==Array.isArray(i))return!1;let e,t;if(Array.isArray(a)){if(a.length!==i.length)return!1;for(e=0;e<a.length;e++)if(!eo(a[e],i[e]))return!1}else{let o=[];for(t in a)o.push(t);o.sort();let n=[];for(t in i)n.push(t);if(n.sort(),!eo(o,n))return!1;for(e=0;e<o.length;e++)if(!eo(a[o[e]],i[o[e]]))return!1}return!0}function CV(a){let i=new Set;return JSON.stringify(a,(e,t)=>{if(xi(t)||Array.isArray(t)){if(i.has(t))return"[Circular]";i.add(t)}return typeof t=="bigint"?`[BigInt ${t.toString()}]`:t})}function J$e(a,i){let e=Object.create(null);return!a||!i||Object.keys(i).forEach(o=>{let n=a[o],r=i[o];eo(n,r)||(e[o]=r)}),e}function IP(a,i){let e=Object.create(null);for(let[t,o]of Object.entries(a))i(t,o)&&(e[t]=o);return e}function HIe(a,i){let e={};for(let[t,o]of Object.entries(a))e[t]=i(o,t);return e}var rZt=class a{constructor(i,e,t,o,n,r,s){this._forceIntegerValues=i;this._scrollStateBrand=void 0;this._forceIntegerValues&&(e=e|0,t=t|0,o=o|0,n=n|0,r=r|0,s=s|0),this.rawScrollLeft=o,this.rawScrollTop=s,e<0&&(e=0),o+e>t&&(o=t-e),o<0&&(o=0),n<0&&(n=0),s+n>r&&(s=r-n),s<0&&(s=0),this.width=e,this.scrollWidth=t,this.scrollLeft=o,this.height=n,this.scrollHeight=r,this.scrollTop=s}equals(i){return this.rawScrollLeft===i.rawScrollLeft&&this.rawScrollTop===i.rawScrollTop&&this.width===i.width&&this.scrollWidth===i.scrollWidth&&this.scrollLeft===i.scrollLeft&&this.height===i.height&&this.scrollHeight===i.scrollHeight&&this.scrollTop===i.scrollTop}withScrollDimensions(i,e){return new a(this._forceIntegerValues,typeof i.width<"u"?i.width:this.width,typeof i.scrollWidth<"u"?i.scrollWidth:this.scrollWidth,e?this.rawScrollLeft:this.scrollLeft,typeof i.height<"u"?i.height:this.height,typeof i.scrollHeight<"u"?i.scrollHeight:this.scrollHeight,e?this.rawScrollTop:this.scrollTop)}withScrollPosition(i){return new a(this._forceIntegerValues,this.width,this.scrollWidth,typeof i.scrollLeft<"u"?i.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof i.scrollTop<"u"?i.scrollTop:this.rawScrollTop)}createScrollEvent(i,e){let t=this.width!==i.width,o=this.scrollWidth!==i.scrollWidth,n=this.scrollLeft!==i.scrollLeft,r=this.height!==i.height,s=this.scrollHeight!==i.scrollHeight,l=this.scrollTop!==i.scrollTop;return{inSmoothScrolling:e,oldWidth:i.width,oldScrollWidth:i.scrollWidth,oldScrollLeft:i.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:i.height,oldScrollHeight:i.scrollHeight,oldScrollTop:i.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:t,scrollWidthChanged:o,scrollLeftChanged:n,heightChanged:r,scrollHeightChanged:s,scrollTopChanged:l}}},y_=class extends x{constructor(e){super();this._scrollableBrand=void 0;this._onScroll=this._register(new E);this.onScroll=this._onScroll.event;this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new rZt(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){let o=this._state.withScrollDimensions(e,t);this._setState(o,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let o=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===o.scrollLeft&&this._smoothScrolling.to.scrollTop===o.scrollTop)return;let n;t?n=new Xgt(this._smoothScrolling.from,o,this._smoothScrolling.startTime,this._smoothScrolling.duration):n=this._smoothScrolling.combine(this._state,o,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=n}else{let o=this._state.withScrollPosition(e);this._smoothScrolling=Xgt.start(this._state,o,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let o=this._state;o.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(o,t)))}},Ygt=class{constructor(i,e,t){this.scrollLeft=i,this.scrollTop=e,this.isDone=t}};function nZt(a,i){let e=i-a;return function(t){return a+e*c0o(t)}}function a0o(a,i,e){return function(t){return t<e?a(t/e):i((t-e)/(1-e))}}var Xgt=class a{constructor(i,e,t,o){this.from=i,this.to=e,this.duration=o,this.startTime=t,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(i,e,t){if(Math.abs(i-e)>2.5*t){let n,r;return i<e?(n=i+.75*t,r=e-.75*t):(n=i-.75*t,r=e+.75*t),a0o(nZt(i,n),nZt(r,e),.33)}return nZt(i,e)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(i){this.to=i.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(i){let e=(i-this.startTime)/this.duration;if(e<1){let t=this.scrollLeft(e),o=this.scrollTop(e);return new Ygt(t,o,!1)}return new Ygt(this.to.scrollLeft,this.to.scrollTop,!0)}combine(i,e,t){return a.start(i,e,t)}static start(i,e,t){t=t+10;let o=Date.now()-10;return new a(i,e,o,t)}};function l0o(a){return Math.pow(a,3)}function c0o(a){return 1-l0o(1-a)}var fE=new class{constructor(){this._zoomLevel=0;this._onDidChangeZoomLevel=new E;this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event}getZoomLevel(){return this._zoomLevel}setZoomLevel(a){a=Math.min(Math.max(-5,a),20),this._zoomLevel!==a&&(this._zoomLevel=a,this._onDidChangeZoomLevel.fire(this._zoomLevel))}};var aZt=Ze?1.5:1.35,sZt=8,UIe=class a{constructor(i){this._bareFontInfoBrand=void 0;this.pixelRatio=i.pixelRatio,this.fontFamily=String(i.fontFamily),this.fontWeight=String(i.fontWeight),this.fontSize=i.fontSize,this.fontFeatureSettings=i.fontFeatureSettings,this.fontVariationSettings=i.fontVariationSettings,this.lineHeight=i.lineHeight|0,this.letterSpacing=i.letterSpacing}static _create(i,e,t,o,n,r,s,l,c){r===0?r=aZt*t:r<sZt&&(r=r*t),r=Math.round(r),r<sZt&&(r=sZt);let u=1+(c?0:fE.getZoomLevel()*.1);return t*=u,r*=u,n===dZt&&(e==="normal"||e==="bold"?n=cZt:(n=`'wght' ${parseInt(e,10)}`,e="normal")),new a({pixelRatio:l,fontFamily:i,fontWeight:e,fontSize:t,fontFeatureSettings:o,fontVariationSettings:n,lineHeight:r,letterSpacing:s})}getId(){return`${this.pixelRatio}-${this.fontFamily}-${this.fontWeight}-${this.fontSize}-${this.fontFeatureSettings}-${this.fontVariationSettings}-${this.lineHeight}-${this.letterSpacing}`}getMassagedFontFamily(){let i=fu.fontFamily,e=a._wrapInQuotes(this.fontFamily);return i&&this.fontFamily!==i?`${e}, ${i}`:e}static _wrapInQuotes(i){return/[,"']/.test(i)?i:/[+ ]/.test(i)?`"${i}"`:i}},lZt=2,n7=class extends UIe{constructor(e,t){super(e);this._editorStylingBrand=void 0;this.version=lZt;this.isTrusted=t,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}},cZt="normal",dZt="translate",d0o="Consolas, 'Courier New', monospace",u0o="Menlo, Monaco, 'Courier New', monospace",p0o="'Droid Sans Mono', monospace",fu={fontFamily:Ze?u0o:ei?d0o:p0o,fontWeight:"normal",fontSize:Ze?12:14,lineHeight:0,letterSpacing:0};var fv={tabSize:4,indentSize:4,insertSpaces:!0,detectIndentation:!0,trimAutoWhitespace:!0,largeFileOptimizations:!0,bracketPairColorizationOptions:{enabled:!0,independentColorPoolPerBracketType:!1}};var xV="`~!@#$%^&*()-=+[{]}\\|;:'\",.<>/?";function m0o(a=""){let i="(-?\\d*\\.\\d\\w*)|([^";for(let e of xV)a.indexOf(e)>=0||(i+="\\"+e);return i+="\\s]+)",new RegExp(i,"g")}var r7=m0o();function Q$(a){let i=r7;if(a&&a instanceof RegExp)if(a.global)i=a;else{let e="g";a.ignoreCase&&(e+="i"),a.multiline&&(e+="m"),a.unicode&&(e+="u"),i=new RegExp(a.source,e)}return i.lastIndex=0,i}var D$i=new qs;D$i.unshift({maxLen:1e3,windowSize:15,timeBudget:150});function Wx(a,i,e,t,o){if(i=Q$(i),o||(o=vt.first(D$i)),e.length>o.maxLen){let c=a-o.maxLen/2;return c<0?c=0:t+=c,e=e.substring(c,a+o.maxLen/2),Wx(a,i,e,t,o)}let n=Date.now(),r=a-1-t,s=-1,l=null;for(let c=1;!(Date.now()-n>=o.timeBudget);c++){let u=r-o.windowSize*c;i.lastIndex=Math.max(0,u);let p=h0o(i,e,r,s);if(!p&&l||(l=p,u<=0))break;s=u}if(l){let c={word:l[0],startColumn:t+1+l.index,endColumn:t+1+l.index+l[0].length};return i.lastIndex=0,c}return null}function h0o(a,i,e,t){let o;for(;o=a.exec(i);){let n=o.index||0;if(n<=e&&a.lastIndex>=e)return o;if(t>0&&n>t)return null}return null}var Oi=le("accessibilityService");var $a=new Y("accessibilityModeEnabled",!1);function L$i(a){if(!a||typeof a!="object")return!1;let i=a;return typeof i.label=="string"&&(typeof i.role>"u"||typeof i.role=="string")}var Z$e="ACCESSIBLE_VIEW_SHOWN_";var kV=8,Jgt=class{constructor(i){this._values=i}hasChanged(i){return this._values[i]}},eje=class{constructor(){this.stableMinimapLayoutInput=null,this.stableFitMaxMinimapScale=0,this.stableFitRemainingWidth=0}},Zu=class{constructor(i,e,t,o){this.id=i,this.name=e,this.defaultValue=t,this.schema=o}applyUpdate(i,e){return eft(i,e)}compute(i,e,t){return t}},zIe=class{constructor(i,e){this.newValue=i;this.didChange=e}};function eft(a,i){if(typeof a!="object"||typeof i!="object"||!a||!i)return new zIe(i,a!==i);if(Array.isArray(a)||Array.isArray(i)){let t=Array.isArray(a)&&Array.isArray(i)&&$i(a,i);return new zIe(i,!t)}let e=!1;for(let t in i)if(i.hasOwnProperty(t)){let o=eft(a[t],i[t]);o.didChange&&(a[t]=o.newValue,e=!0)}return new zIe(a,e)}var x1=class{constructor(i,e){this.schema=void 0;this.id=i,this.name="_never_",this.defaultValue=e}applyUpdate(i,e){return eft(i,e)}validate(i){return this.defaultValue}},s7=class{constructor(i,e,t,o){this.id=i,this.name=e,this.defaultValue=t,this.schema=o}applyUpdate(i,e){return eft(i,e)}compute(i,e,t){return t}};function yn(a,i){return typeof a>"u"?i:a==="false"?!1:!!a}var Ds=class extends s7{constructor(i,e,t,o=void 0){typeof o<"u"&&(o.type="boolean",o.default=t),super(i,e,t,o)}validate(i){return yn(i,this.defaultValue)}};function EV(a,i,e,t){if(typeof a=="string"&&(a=parseInt(a,10)),typeof a!="number"||isNaN(a))return i;let o=a;return o=Math.max(e,o),o=Math.min(t,o),o|0}var Xc=class a extends s7{static clampedInt(i,e,t,o){return EV(i,e,t,o)}constructor(i,e,t,o,n,r=void 0){typeof r<"u"&&(r.type="integer",r.default=t,r.minimum=o,r.maximum=n),super(i,e,t,r),this.minimum=o,this.maximum=n}validate(i){return a.clampedInt(i,this.defaultValue,this.minimum,this.maximum)}};function M$i(a,i,e,t){if(typeof a>"u")return i;let o=vE.float(a,i);return vE.clamp(o,e,t)}var vE=class a extends s7{static clamp(i,e,t){return i<e?e:i>t?t:i}static float(i,e){return typeof i=="string"&&(i=parseFloat(i)),typeof i!="number"||isNaN(i)?e:i}constructor(i,e,t,o,n,r,s){typeof n<"u"&&(n.type="number",n.default=t,n.minimum=r,n.maximum=s),super(i,e,t,n),this.validationFn=o,this.minimum=r,this.maximum=s}validate(i){return this.validationFn(a.float(i,this.defaultValue))}},yC=class a extends s7{static string(i,e){return typeof i!="string"?e:i}constructor(i,e,t,o=void 0){typeof o<"u"&&(o.type="string",o.default=t),super(i,e,t,o)}validate(i){return a.string(i,this.defaultValue)}};function Xd(a,i,e,t){return typeof a!="string"?i:t&&a in t?t[a]:e.indexOf(a)===-1?i:a}var Ju=class extends s7{constructor(i,e,t,o,n=void 0){typeof n<"u"&&(n.type="string",n.enum=o.slice(0),n.default=t),super(i,e,t,n),this._allowedValues=o}validate(i){return Xd(i,this.defaultValue,this._allowedValues)}},Cae=class extends Zu{constructor(i,e,t,o,n,r,s=void 0){typeof s<"u"&&(s.type="string",s.enum=n,s.default=o),super(i,e,t,s),this._allowedValues=n,this._convert=r}validate(i){return typeof i!="string"?this.defaultValue:this._allowedValues.indexOf(i)===-1?this.defaultValue:this._convert(i)}};function g0o(a){switch(a){case"none":return 0;case"keep":return 1;case"brackets":return 2;case"advanced":return 3;case"full":return 4}}var uZt=class extends Zu{constructor(){super(2,"accessibilitySupport",0,{type:"string",enum:["auto","on","off"],enumDescriptions:[d(315,null),d(317,null),d(316,null)],default:"auto",tags:["accessibility"],description:d(314,null)})}validate(i){switch(i){case"auto":return 0;case"off":return 1;case"on":return 2}return this.defaultValue}compute(i,e,t){return t===0?i.accessibilitySupport:t}},pZt=class extends Zu{constructor(){let i={insertSpace:!0,ignoreEmptyLines:!0};super(29,"comments",i,{"editor.comments.insertSpace":{type:"boolean",default:i.insertSpace,description:d(345,null)},"editor.comments.ignoreEmptyLines":{type:"boolean",default:i.ignoreEmptyLines,description:d(344,null)}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{insertSpace:yn(e.insertSpace,this.defaultValue.insertSpace),ignoreEmptyLines:yn(e.ignoreEmptyLines,this.defaultValue.ignoreEmptyLines)}}};function JZt(a){switch(a){case"blink":return 1;case"smooth":return 2;case"phase":return 3;case"expand":return 4;case"solid":return 5}}function P$i(a){switch(a){case 1:return"line";case 2:return"block";case 3:return"underline";case 4:return"line-thin";case 5:return"block-outline";case 6:return"underline-thin"}}function Zgt(a){switch(a){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 mZt=class extends x1{constructor(){super(162,"")}compute(i,e,t){let o=["monaco-editor"];return e.get(48)&&o.push(e.get(48)),i.extraEditorClassName&&o.push(i.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(" ")}},hZt=class extends Ds{constructor(){super(45,"emptySelectionClipboard",!0,{description:d(468,null)})}compute(i,e,t){return t&&i.emptySelectionClipboard}},gZt=class extends Zu{constructor(){let i={cursorMoveOnType:!0,findOnType:!0,seedSearchStringFromSelection:"always",autoFindInSelection:"never",globalFindClipboard:!1,addExtraSpaceOnTop:!0,loop:!0,closeOnResult:!1,history:"workspace",replaceHistory:"workspace"};super(50,"find",i,{"editor.find.cursorMoveOnType":{type:"boolean",default:i.cursorMoveOnType,description:d(481,null)},"editor.find.seedSearchStringFromSelection":{type:"string",enum:["never","always","selection"],default:i.seedSearchStringFromSelection,enumDescriptions:[d(404,null),d(403,null),d(405,null)],description:d(487,null)},"editor.find.autoFindInSelection":{type:"string",enum:["never","always","multiline"],default:i.autoFindInSelection,enumDescriptions:[d(398,null),d(396,null),d(397,null)],description:d(479,null)},"editor.find.globalFindClipboard":{type:"boolean",default:i.globalFindClipboard,description:d(483,null),included:Ze},"editor.find.addExtraSpaceOnTop":{type:"boolean",default:i.addExtraSpaceOnTop,description:d(478,null)},"editor.find.loop":{type:"boolean",default:i.loop,description:d(485,null)},"editor.find.closeOnResult":{type:"boolean",default:i.closeOnResult,description:d(480,null)},"editor.find.history":{type:"string",enum:["never","workspace"],default:"workspace",enumDescriptions:[d(399,null),d(400,null)],description:d(484,null)},"editor.find.replaceHistory":{type:"string",enum:["never","workspace"],default:"workspace",enumDescriptions:[d(401,null),d(402,null)],description:d(486,null)},"editor.find.findOnType":{type:"boolean",default:i.findOnType,description:d(482,null)}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{cursorMoveOnType:yn(e.cursorMoveOnType,this.defaultValue.cursorMoveOnType),findOnType:yn(e.findOnType,this.defaultValue.findOnType),seedSearchStringFromSelection:typeof e.seedSearchStringFromSelection=="boolean"?e.seedSearchStringFromSelection?"always":"never":Xd(e.seedSearchStringFromSelection,this.defaultValue.seedSearchStringFromSelection,["never","always","selection"]),autoFindInSelection:typeof e.autoFindInSelection=="boolean"?e.autoFindInSelection?"always":"never":Xd(e.autoFindInSelection,this.defaultValue.autoFindInSelection,["never","always","multiline"]),globalFindClipboard:yn(e.globalFindClipboard,this.defaultValue.globalFindClipboard),addExtraSpaceOnTop:yn(e.addExtraSpaceOnTop,this.defaultValue.addExtraSpaceOnTop),loop:yn(e.loop,this.defaultValue.loop),closeOnResult:yn(e.closeOnResult,this.defaultValue.closeOnResult),history:Xd(e.history,this.defaultValue.history,["never","workspace"]),replaceHistory:Xd(e.replaceHistory,this.defaultValue.replaceHistory,["never","workspace"])}}},Bx=class a extends Zu{static{this.OFF='"liga" off, "calt" off'}static{this.ON='"liga" on, "calt" on'}constructor(){super(60,"fontLigatures",a.OFF,{anyOf:[{type:"boolean",description:d(497,null)},{type:"string",description:d(496,null)}],description:d(498,null),default:!1})}validate(i){return typeof i>"u"?this.defaultValue:typeof i=="string"?i==="false"||i.length===0?a.OFF:i==="true"?a.ON:i:i?a.ON:a.OFF}},fZt=class a extends Zu{static{this.OFF=cZt}static{this.TRANSLATE=dZt}constructor(){super(63,"fontVariations",a.OFF,{anyOf:[{type:"boolean",description:d(500,null)},{type:"string",description:d(501,null)}],description:d(502,null),default:!1})}validate(i){return typeof i>"u"?this.defaultValue:typeof i=="string"?i==="false"?a.OFF:i==="true"?a.TRANSLATE:i:i?a.TRANSLATE:a.OFF}compute(i,e,t){return i.fontInfo.fontVariationSettings}},vZt=class extends x1{constructor(){super(59,new n7({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(i,e,t){return i.fontInfo}},bZt=class extends x1{constructor(){super(161,1)}compute(i,e,t){return i.inputMode==="overtype"?e.get(92):e.get(34)}},SZt=class extends x1{constructor(){super(170,!1)}compute(i,e){return i.editContextSupported&&e.get(44)}},IZt=class extends x1{constructor(){super(172,!1)}compute(i,e){return i.accessibilitySupport===2?e.get(7):e.get(6)}},yZt=class extends s7{constructor(){super(61,"fontSize",fu.fontSize,{type:"number",minimum:6,maximum:100,default:fu.fontSize,description:d(499,null)})}validate(i){let e=vE.float(i,this.defaultValue);return e===0?fu.fontSize:vE.clamp(e,6,100)}compute(i,e,t){return i.fontInfo.fontSize}},wZt=class a extends Zu{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",fu.fontWeight,{anyOf:[{type:"number",minimum:a.MINIMUM_VALUE,maximum:a.MAXIMUM_VALUE,errorMessage:d(504,null)},{type:"string",pattern:"^(normal|bold|1000|[1-9][0-9]{0,2})$"},{enum:a.SUGGESTION_VALUES}],default:fu.fontWeight,description:d(503,null)})}validate(i){return i==="normal"||i==="bold"?i:String(Xc.clampedInt(i,fu.fontWeight,a.MINIMUM_VALUE,a.MAXIMUM_VALUE))}},CZt=class extends Zu{constructor(){let i={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:i.multiple,enumDescriptions:[d(409,null),d(408,null),d(407,null)]},t=["","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",i,{"editor.gotoLocation.multiple":{deprecationMessage:d(406,null)},"editor.gotoLocation.multipleDefinitions":{description:d(392,null),...e},"editor.gotoLocation.multipleTypeDefinitions":{description:d(395,null),...e},"editor.gotoLocation.multipleDeclarations":{description:d(391,null),...e},"editor.gotoLocation.multipleImplementations":{description:d(393,null),...e},"editor.gotoLocation.multipleReferences":{description:d(394,null),...e},"editor.gotoLocation.alternativeDefinitionCommand":{type:"string",default:i.alternativeDefinitionCommand,enum:t,description:d(322,null)},"editor.gotoLocation.alternativeTypeDefinitionCommand":{type:"string",default:i.alternativeTypeDefinitionCommand,enum:t,description:d(325,null)},"editor.gotoLocation.alternativeDeclarationCommand":{type:"string",default:i.alternativeDeclarationCommand,enum:t,description:d(321,null)},"editor.gotoLocation.alternativeImplementationCommand":{type:"string",default:i.alternativeImplementationCommand,enum:t,description:d(323,null)},"editor.gotoLocation.alternativeReferenceCommand":{type:"string",default:i.alternativeReferenceCommand,enum:t,description:d(324,null)}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{multiple:Xd(e.multiple,this.defaultValue.multiple,["peek","gotoAndPeek","goto"]),multipleDefinitions:Xd(e.multipleDefinitions,"peek",["peek","gotoAndPeek","goto"]),multipleTypeDefinitions:Xd(e.multipleTypeDefinitions,"peek",["peek","gotoAndPeek","goto"]),multipleDeclarations:Xd(e.multipleDeclarations,"peek",["peek","gotoAndPeek","goto"]),multipleImplementations:Xd(e.multipleImplementations,"peek",["peek","gotoAndPeek","goto"]),multipleReferences:Xd(e.multipleReferences,"peek",["peek","gotoAndPeek","goto"]),multipleTests:Xd(e.multipleTests,"peek",["peek","gotoAndPeek","goto"]),alternativeDefinitionCommand:yC.string(e.alternativeDefinitionCommand,this.defaultValue.alternativeDefinitionCommand),alternativeTypeDefinitionCommand:yC.string(e.alternativeTypeDefinitionCommand,this.defaultValue.alternativeTypeDefinitionCommand),alternativeDeclarationCommand:yC.string(e.alternativeDeclarationCommand,this.defaultValue.alternativeDeclarationCommand),alternativeImplementationCommand:yC.string(e.alternativeImplementationCommand,this.defaultValue.alternativeImplementationCommand),alternativeReferenceCommand:yC.string(e.alternativeReferenceCommand,this.defaultValue.alternativeReferenceCommand),alternativeTestsCommand:yC.string(e.alternativeTestsCommand,this.defaultValue.alternativeTestsCommand)}}},xZt=class extends Zu{constructor(){let i={enabled:"on",delay:300,hidingDelay:300,sticky:!0,above:!0,showLongLineWarning:!0};super(69,"hover",i,{"editor.hover.enabled":{type:"string",enum:["on","off","onKeyboardModifier"],default:i.enabled,markdownEnumDescriptions:[d(513,null),d(512,null),d(514,null,Ze?"Command":"Control")],description:d(511,null)},"editor.hover.delay":{type:"number",default:i.delay,minimum:0,maximum:1e4,description:d(510,null)},"editor.hover.sticky":{type:"boolean",default:i.sticky,description:d(517,null)},"editor.hover.hidingDelay":{type:"integer",minimum:0,default:i.hidingDelay,markdownDescription:d(515,null)},"editor.hover.above":{type:"boolean",default:i.above,description:d(509,null)},"editor.hover.showLongLineWarning":{type:"boolean",default:i.showLongLineWarning,description:d(516,null)}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{enabled:Xd(e.enabled,this.defaultValue.enabled,["on","off","onKeyboardModifier"]),delay:Xc.clampedInt(e.delay,this.defaultValue.delay,0,1e4),sticky:yn(e.sticky,this.defaultValue.sticky),hidingDelay:Xc.clampedInt(e.hidingDelay,this.defaultValue.hidingDelay,0,6e5),above:yn(e.above,this.defaultValue.above),showLongLineWarning:yn(e.showLongLineWarning,this.defaultValue.showLongLineWarning)}}};var tje=class a extends x1{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(i,e,t){return a.computeLayout(e,{memory:i.memory,outerWidth:i.outerWidth,outerHeight:i.outerHeight,isDominatedByLongLines:i.isDominatedByLongLines,lineHeight:i.fontInfo.lineHeight,viewLineCount:i.viewLineCount,lineNumbersDigitCount:i.lineNumbersDigitCount,typicalHalfwidthCharacterWidth:i.fontInfo.typicalHalfwidthCharacterWidth,maxDigitWidth:i.fontInfo.maxDigitWidth,pixelRatio:i.pixelRatio,glyphMarginDecorationLaneCount:i.glyphMarginDecorationLaneCount})}static computeContainedMinimapLineCount(i){let e=i.height/i.lineHeight,t=Math.floor(i.paddingTop/i.lineHeight),o=Math.floor(i.paddingBottom/i.lineHeight);i.scrollBeyondLastLine&&(o=Math.max(o,e-1));let n=(t+i.viewLineCount+o)/(i.pixelRatio*i.height),r=Math.floor(i.viewLineCount/n);return{typicalViewportLineCount:e,extraLinesBeforeFirstLine:t,extraLinesBeyondLastLine:o,desiredRatio:n,minimapLineCount:r}}static _computeMinimapLayout(i,e){let t=i.outerWidth,o=i.outerHeight,n=i.pixelRatio;if(!i.minimap.enabled)return{renderMinimap:0,minimapLeft:0,minimapWidth:0,minimapHeightIsEditorHeight:!1,minimapIsSampling:!1,minimapScale:1,minimapLineHeight:1,minimapCanvasInnerWidth:0,minimapCanvasInnerHeight:Math.floor(n*o),minimapCanvasOuterWidth:0,minimapCanvasOuterHeight:o};let r=e.stableMinimapLayoutInput,s=r&&i.outerHeight===r.outerHeight&&i.lineHeight===r.lineHeight&&i.typicalHalfwidthCharacterWidth===r.typicalHalfwidthCharacterWidth&&i.pixelRatio===r.pixelRatio&&i.scrollBeyondLastLine===r.scrollBeyondLastLine&&i.paddingTop===r.paddingTop&&i.paddingBottom===r.paddingBottom&&i.minimap.enabled===r.minimap.enabled&&i.minimap.side===r.minimap.side&&i.minimap.size===r.minimap.size&&i.minimap.showSlider===r.minimap.showSlider&&i.minimap.renderCharacters===r.minimap.renderCharacters&&i.minimap.maxColumn===r.minimap.maxColumn&&i.minimap.scale===r.minimap.scale&&i.verticalScrollbarWidth===r.verticalScrollbarWidth&&i.isViewportWrapping===r.isViewportWrapping,l=i.lineHeight,c=i.typicalHalfwidthCharacterWidth,u=i.scrollBeyondLastLine,p=i.minimap.renderCharacters,h=n>=2?Math.round(i.minimap.scale*2):i.minimap.scale,g=i.minimap.maxColumn,f=i.minimap.size,v=i.minimap.side,b=i.verticalScrollbarWidth,S=i.viewLineCount,y=i.remainingWidth,w=i.isViewportWrapping,k=p?2:3,T=Math.floor(n*o),P=T/n,O=!1,V=!1,H=k*h,G=h/n,$=1;if(f==="fill"||f==="fit"){let{typicalViewportLineCount:xe,extraLinesBeforeFirstLine:ze,extraLinesBeyondLastLine:De,desiredRatio:Oe,minimapLineCount:pt}=a.computeContainedMinimapLineCount({viewLineCount:S,scrollBeyondLastLine:u,paddingTop:i.paddingTop,paddingBottom:i.paddingBottom,height:o,lineHeight:l,pixelRatio:n});if(S/pt>1)O=!0,V=!0,h=1,H=1,G=h/n;else{let Ti=!1,Ht=h+1;if(f==="fit"){let zi=Math.ceil((ze+S+De)*H);w&&s&&y<=e.stableFitRemainingWidth?(Ti=!0,Ht=e.stableFitMaxMinimapScale):Ti=zi>T}if(f==="fill"||Ti){O=!0;let zi=h;H=Math.min(l*n,Math.max(1,Math.floor(1/Oe))),w&&s&&y<=e.stableFitRemainingWidth&&(Ht=e.stableFitMaxMinimapScale),h=Math.min(Ht,Math.max(1,Math.floor(H/k))),h>zi&&($=Math.min(2,h/zi)),G=h/n/$,T=Math.ceil(Math.max(xe,ze+S+De)*H),w?(e.stableMinimapLayoutInput=i,e.stableFitRemainingWidth=y,e.stableFitMaxMinimapScale=h):(e.stableMinimapLayoutInput=null,e.stableFitRemainingWidth=0)}}}let J=Math.floor(g*G),ae=Math.min(J,Math.max(0,Math.floor((y-b-2)*G/(c+G)))+kV),he=Math.floor(n*ae),oe=he/n;he=Math.floor(he*$);let de=p?1:2,Ce=v==="left"?0:t-ae-b;return{renderMinimap:de,minimapLeft:Ce,minimapWidth:ae,minimapHeightIsEditorHeight:O,minimapIsSampling:V,minimapScale:h,minimapLineHeight:H,minimapCanvasInnerWidth:he,minimapCanvasInnerHeight:T,minimapCanvasOuterWidth:oe,minimapCanvasOuterHeight:P}}static computeLayout(i,e){let t=e.outerWidth|0,o=e.outerHeight|0,n=e.lineHeight|0,r=e.lineNumbersDigitCount|0,s=e.typicalHalfwidthCharacterWidth,l=e.maxDigitWidth,c=e.pixelRatio,u=e.viewLineCount,p=i.get(154),h=p==="inherit"?i.get(153):p,g=h==="inherit"?i.get(149):h,f=i.get(152),v=e.isDominatedByLongLines,b=i.get(66),S=i.get(76).renderType!==0,y=i.get(77),w=i.get(119),k=i.get(96),T=i.get(81),P=i.get(117),O=P.verticalScrollbarSize,V=P.verticalHasArrows,H=P.arrowSize,G=P.horizontalScrollbarSize,$=i.get(52),J=i.get(126)!=="never",ae=i.get(74);$&&J&&(ae+=16);let he=0;if(S){let sn=Math.max(r,y);he=Math.round(sn*l)}let oe=0;b&&(oe=n*e.glyphMarginDecorationLaneCount);let de=0,Ce=de+oe,xe=Ce+he,ze=xe+ae,De=t-oe-he-ae,Oe=!1,pt=!1,et=-1;i.get(2)===2&&h==="inherit"&&v?(Oe=!0,pt=!0):g==="on"||g==="bounded"?pt=!0:g==="wordWrapColumn"&&(et=f);let Ti=a._computeMinimapLayout({outerWidth:t,outerHeight:o,lineHeight:n,typicalHalfwidthCharacterWidth:s,pixelRatio:c,scrollBeyondLastLine:w,paddingTop:k.top,paddingBottom:k.bottom,minimap:T,verticalScrollbarWidth:O,viewLineCount:u,remainingWidth:De,isViewportWrapping:pt},e.memory||new eje);Ti.renderMinimap!==0&&Ti.minimapLeft===0&&(de+=Ti.minimapWidth,Ce+=Ti.minimapWidth,xe+=Ti.minimapWidth,ze+=Ti.minimapWidth);let Ht=De-Ti.minimapWidth,zi=Math.max(1,Math.floor((Ht-O-2)/s)),Vo=V?H:0;return pt&&(et=Math.max(1,zi),g==="bounded"&&(et=Math.min(et,f))),{width:t,height:o,glyphMarginLeft:de,glyphMarginWidth:oe,glyphMarginDecorationLaneCount:e.glyphMarginDecorationLaneCount,lineNumbersLeft:Ce,lineNumbersWidth:he,decorationsLeft:xe,decorationsWidth:ae,contentLeft:ze,contentWidth:Ht,minimap:Ti,viewportColumn:zi,isWordWrapMinified:Oe,isViewportWrapping:pt,wrappingColumn:et,verticalScrollbarWidth:O,horizontalScrollbarHeight:G,overviewRuler:{top:Vo,width:O,height:o-2*Vo,right:0}}}},kZt=class extends Zu{constructor(){super(156,"wrappingStrategy","simple",{"editor.wrappingStrategy":{enumDescriptions:[d(730,null),d(729,null)],type:"string",enum:["simple","advanced"],default:"simple",description:d(728,null)}})}validate(i){return Xd(i,"simple",["simple","advanced"])}compute(i,e,t){return e.get(2)===2?"advanced":t}};var EZt=class extends Zu{constructor(){let i={enabled:"onCode"};super(73,"lightbulb",i,{"editor.lightbulb.enabled":{type:"string",enum:["off","onCode","on"],default:i.enabled,enumDescriptions:[d(430,null),d(432,null),d(431,null)],description:d(469,null)}})}validate(i){return!i||typeof i!="object"?this.defaultValue:{enabled:Xd(i.enabled,this.defaultValue.enabled,["off","onCode","on"])}}},TZt=class extends Zu{constructor(){let i={enabled:!0,maxLineCount:5,defaultModel:"outlineModel",scrollWithEditor:!0};super(131,"stickyScroll",i,{"editor.stickyScroll.enabled":{type:"boolean",default:i.enabled,description:d(434,null)},"editor.stickyScroll.maxLineCount":{type:"number",default:i.maxLineCount,minimum:1,maximum:20,description:d(435,null)},"editor.stickyScroll.defaultModel":{type:"string",enum:["outlineModel","foldingProviderModel","indentationModel"],default:i.defaultModel,description:d(433,null)},"editor.stickyScroll.scrollWithEditor":{type:"boolean",default:i.scrollWithEditor,description:d(436,null)}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{enabled:yn(e.enabled,this.defaultValue.enabled),maxLineCount:Xc.clampedInt(e.maxLineCount,this.defaultValue.maxLineCount,1,20),defaultModel:Xd(e.defaultModel,this.defaultValue.defaultModel,["outlineModel","foldingProviderModel","indentationModel"]),scrollWithEditor:yn(e.scrollWithEditor,this.defaultValue.scrollWithEditor)}}},_Zt=class extends Zu{constructor(){let i={enabled:"on",fontSize:0,fontFamily:"",padding:!1,maximumLength:43};super(159,"inlayHints",i,{"editor.inlayHints.enabled":{type:"string",default:i.enabled,description:d(519,null),enum:["on","onUnlessPressed","offUnlessPressed","off"],markdownEnumDescriptions:[d(426,null),d(427,null,Ze?"Ctrl+Option":"Ctrl+Alt"),d(425,null,Ze?"Ctrl+Option":"Ctrl+Alt"),d(424,null)]},"editor.inlayHints.fontSize":{type:"number",default:i.fontSize,markdownDescription:d(521,null,"`#editor.fontSize#`","`5`")},"editor.inlayHints.fontFamily":{type:"string",default:i.fontFamily,markdownDescription:d(520,null,"`#editor.fontFamily#`")},"editor.inlayHints.padding":{type:"boolean",default:i.padding,description:d(523,null)},"editor.inlayHints.maximumLength":{type:"number",default:i.maximumLength,markdownDescription:d(522,null)}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return typeof e.enabled=="boolean"&&(e.enabled=e.enabled?"on":"off"),{enabled:Xd(e.enabled,this.defaultValue.enabled,["on","off","offUnlessPressed","onUnlessPressed"]),fontSize:Xc.clampedInt(e.fontSize,this.defaultValue.fontSize,0,100),fontFamily:yC.string(e.fontFamily,this.defaultValue.fontFamily),padding:yn(e.padding,this.defaultValue.padding),maximumLength:Xc.clampedInt(e.maximumLength,this.defaultValue.maximumLength,0,Number.MAX_SAFE_INTEGER)}}},DZt=class extends Zu{constructor(){super(74,"lineDecorationsWidth",10)}validate(i){return typeof i=="string"&&/^\d+(\.\d+)?ch$/.test(i)?-parseFloat(i.substring(0,i.length-2)):Xc.clampedInt(i,this.defaultValue,0,1e3)}compute(i,e,t){return t<0?Xc.clampedInt(-t*i.fontInfo.typicalHalfwidthCharacterWidth,this.defaultValue,0,1e3):t}},LZt=class extends vE{constructor(){super(75,"lineHeight",fu.lineHeight,i=>vE.clamp(i,0,150),{markdownDescription:d(545,null)},0,150)}compute(i,e,t){return i.fontInfo.lineHeight}},RZt=class extends Zu{constructor(){let i={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",i,{"editor.minimap.enabled":{type:"boolean",default:i.enabled,description:d(558,null)},"editor.minimap.autohide":{type:"string",enum:["none","mouseover","scroll"],enumDescriptions:[d(556,null),d(555,null),d(557,null)],default:i.autohide,description:d(554,null)},"editor.minimap.size":{type:"string",enum:["proportional","fill","fit"],enumDescriptions:[d(572,null),d(570,null),d(571,null)],default:i.size,description:d(569,null)},"editor.minimap.side":{type:"string",enum:["left","right"],default:i.side,description:d(568,null)},"editor.minimap.showSlider":{type:"string",enum:["always","mouseover"],default:i.showSlider,description:d(567,null)},"editor.minimap.scale":{type:"number",default:i.scale,minimum:1,maximum:3,enum:[1,2,3],description:d(562,null)},"editor.minimap.renderCharacters":{type:"boolean",default:i.renderCharacters,description:d(561,null)},"editor.minimap.maxColumn":{type:"number",default:i.maxColumn,description:d(560,null)},"editor.minimap.showRegionSectionHeaders":{type:"boolean",default:i.showRegionSectionHeaders,description:d(566,null)},"editor.minimap.showMarkSectionHeaders":{type:"boolean",default:i.showMarkSectionHeaders,description:d(565,null)},"editor.minimap.markSectionHeaderRegex":{type:"string",default:i.markSectionHeaderRegex,description:d(559,null)},"editor.minimap.sectionHeaderFontSize":{type:"number",default:i.sectionHeaderFontSize,description:d(563,null)},"editor.minimap.sectionHeaderLetterSpacing":{type:"number",default:i.sectionHeaderLetterSpacing,description:d(564,null)}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i,t=this.defaultValue.markSectionHeaderRegex,o=e.markSectionHeaderRegex;if(typeof o=="string")try{new RegExp(o,"d"),t=o}catch{}return{enabled:yn(e.enabled,this.defaultValue.enabled),autohide:Xd(e.autohide,this.defaultValue.autohide,["none","mouseover","scroll"]),size:Xd(e.size,this.defaultValue.size,["proportional","fill","fit"]),side:Xd(e.side,this.defaultValue.side,["right","left"]),showSlider:Xd(e.showSlider,this.defaultValue.showSlider,["always","mouseover"]),renderCharacters:yn(e.renderCharacters,this.defaultValue.renderCharacters),scale:Xc.clampedInt(e.scale,1,1,3),maxColumn:Xc.clampedInt(e.maxColumn,this.defaultValue.maxColumn,1,1e4),showRegionSectionHeaders:yn(e.showRegionSectionHeaders,this.defaultValue.showRegionSectionHeaders),showMarkSectionHeaders:yn(e.showMarkSectionHeaders,this.defaultValue.showMarkSectionHeaders),markSectionHeaderRegex:t,sectionHeaderFontSize:vE.clamp(vE.float(e.sectionHeaderFontSize,this.defaultValue.sectionHeaderFontSize),4,32),sectionHeaderLetterSpacing:vE.clamp(vE.float(e.sectionHeaderLetterSpacing,this.defaultValue.sectionHeaderLetterSpacing),0,5)}}};function f0o(a){return a==="ctrlCmd"?Ze?"metaKey":"ctrlKey":"altKey"}var MZt=class extends Zu{constructor(){super(96,"padding",{top:0,bottom:0},{"editor.padding.top":{type:"number",default:0,minimum:0,maximum:1e3,description:d(597,null)},"editor.padding.bottom":{type:"number",default:0,minimum:0,maximum:1e3,description:d(596,null)}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{top:Xc.clampedInt(e.top,0,0,1e3),bottom:Xc.clampedInt(e.bottom,0,0,1e3)}}},PZt=class extends Zu{constructor(){let i={enabled:!0,cycle:!0};super(98,"parameterHints",i,{"editor.parameterHints.enabled":{type:"boolean",default:i.enabled,description:d(599,null)},"editor.parameterHints.cycle":{type:"boolean",default:i.cycle,description:d(598,null)}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{enabled:yn(e.enabled,this.defaultValue.enabled),cycle:yn(e.cycle,this.defaultValue.cycle)}}},AZt=class extends x1{constructor(){super(163,1)}compute(i,e,t){return i.pixelRatio}},NZt=class extends Zu{constructor(){super(100,"placeholder",void 0)}validate(i){return typeof i>"u"?this.defaultValue:typeof i=="string"?i:this.defaultValue}},OZt=class extends Zu{constructor(){let i={other:"on",comments:"off",strings:"off"},e=[{type:"boolean"},{type:"string",enum:["on","inline","off","offWhenInlineCompletions"],enumDescriptions:[d(592,null),d(524,null),d(590,null),d(591,null)]}];super(102,"quickSuggestions",i,{anyOf:[{type:"boolean"},{type:"string",enum:["on","inline","off","offWhenInlineCompletions"],enumDescriptions:[d(614,null),d(611,null),d(612,null),d(613,null)]},{type:"object",additionalProperties:!1,properties:{strings:{anyOf:e,default:i.strings,description:d(610,null)},comments:{anyOf:e,default:i.comments,description:d(608,null)},other:{anyOf:e,default:i.other,description:d(609,null)}}}],default:i,markdownDescription:d(607,null,"`#editor.suggestOnTriggerCharacters#`"),experiment:{mode:"auto"}}),this.defaultValue=i}validate(i){if(typeof i=="boolean"){let c=i?"on":"off";return{comments:c,strings:c,other:c}}if(typeof i=="string"){let c=["on","inline","off","offWhenInlineCompletions"],u=Xd(i,this.defaultValue.other,c);return{comments:u,strings:u,other:u}}if(!i||typeof i!="object")return this.defaultValue;let{other:e,comments:t,strings:o}=i,n=["on","inline","off","offWhenInlineCompletions"],r,s,l;return typeof e=="boolean"?r=e?"on":"off":r=Xd(e,this.defaultValue.other,n),typeof t=="boolean"?s=t?"on":"off":s=Xd(t,this.defaultValue.comments,n),typeof o=="boolean"?l=o?"on":"off":l=Xd(o,this.defaultValue.strings,n),{other:r,comments:s,strings:l}}};var FZt=class extends Zu{constructor(){super(76,"lineNumbers",{renderType:1,renderFn:null},{type:"string",enum:["off","on","relative","interval"],enumDescriptions:[d(548,null),d(549,null),d(550,null),d(547,null)],default:"on",description:d(546,null)})}validate(i){let e=this.defaultValue.renderType,t=this.defaultValue.renderFn;return typeof i<"u"&&(typeof i=="function"?(e=4,t=i):i==="interval"?e=3:i==="relative"?e=2:i==="on"?e=1:e=0),{renderType:e,renderFn:t}}};function xae(a){let i=a.get(112);return i==="editable"?a.get(104):i!=="on"}function kae(a){return!a.get(172)}var WZt=class extends Zu{constructor(){let i=[],e={type:"number",description:d(631,null)};super(116,"rulers",i,{type:"array",items:{anyOf:[e,{type:["object"],properties:{column:e,color:{type:"string",description:d(630,null),format:"color-hex"}}}]},default:i,description:d(629,null)})}validate(i){if(Array.isArray(i)){let e=[];for(let t of i)if(typeof t=="number")e.push({column:Xc.clampedInt(t,0,0,1e4),color:null});else if(t&&typeof t=="object"){let o=t;e.push({column:Xc.clampedInt(o.column,0,0,1e4),color:o.color})}return e.sort((t,o)=>t.column-o.column),e}return this.defaultValue}},VZt=class extends Zu{constructor(){super(105,"readOnlyMessage",void 0)}validate(i){return!i||typeof i!="object"?this.defaultValue:i}};function R$i(a,i){if(typeof a!="string")return i;switch(a){case"hidden":return 2;case"visible":return 3;default:return 1}}var BZt=class extends Zu{constructor(){let i={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",i,{"editor.scrollbar.vertical":{type:"string",enum:["auto","visible","hidden"],enumDescriptions:[d(641,null),d(643,null),d(642,null)],default:"auto",description:d(640,null)},"editor.scrollbar.horizontal":{type:"string",enum:["auto","visible","hidden"],enumDescriptions:[d(634,null),d(636,null),d(635,null)],default:"auto",description:d(633,null)},"editor.scrollbar.verticalScrollbarSize":{type:"number",default:i.verticalScrollbarSize,description:d(644,null)},"editor.scrollbar.horizontalScrollbarSize":{type:"number",default:i.horizontalScrollbarSize,description:d(637,null)},"editor.scrollbar.scrollByPage":{type:"boolean",default:i.scrollByPage,description:d(639,null)},"editor.scrollbar.ignoreHorizontalScrollbarInContentHeight":{type:"boolean",default:i.ignoreHorizontalScrollbarInContentHeight,description:d(638,null)}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i,t=Xc.clampedInt(e.horizontalScrollbarSize,this.defaultValue.horizontalScrollbarSize,0,1e3),o=Xc.clampedInt(e.verticalScrollbarSize,this.defaultValue.verticalScrollbarSize,0,1e3);return{arrowSize:Xc.clampedInt(e.arrowSize,this.defaultValue.arrowSize,0,1e3),vertical:R$i(e.vertical,this.defaultValue.vertical),horizontal:R$i(e.horizontal,this.defaultValue.horizontal),useShadows:yn(e.useShadows,this.defaultValue.useShadows),verticalHasArrows:yn(e.verticalHasArrows,this.defaultValue.verticalHasArrows),horizontalHasArrows:yn(e.horizontalHasArrows,this.defaultValue.horizontalHasArrows),handleMouseWheel:yn(e.handleMouseWheel,this.defaultValue.handleMouseWheel),alwaysConsumeMouseWheel:yn(e.alwaysConsumeMouseWheel,this.defaultValue.alwaysConsumeMouseWheel),horizontalScrollbarSize:t,horizontalSliderSize:Xc.clampedInt(e.horizontalSliderSize,t,0,1e3),verticalScrollbarSize:o,verticalSliderSize:Xc.clampedInt(e.verticalSliderSize,o,0,1e3),scrollByPage:yn(e.scrollByPage,this.defaultValue.scrollByPage),ignoreHorizontalScrollbarInContentHeight:yn(e.ignoreHorizontalScrollbarInContentHeight,this.defaultValue.ignoreHorizontalScrollbarInContentHeight)}}},w_="inUntrustedWorkspace",Vx={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"},HZt=class extends Zu{constructor(){let i={nonBasicASCII:w_,invisibleCharacters:!0,ambiguousCharacters:!0,includeComments:w_,includeStrings:!0,allowedCharacters:{},allowedLocales:{_os:!0,_vscode:!0}};super(142,"unicodeHighlight",i,{[Vx.nonBasicASCII]:{restricted:!0,type:["boolean","string"],enum:[!0,!1,w_],default:i.nonBasicASCII,description:d(705,null)},[Vx.invisibleCharacters]:{restricted:!0,type:"boolean",default:i.invisibleCharacters,description:d(704,null)},[Vx.ambiguousCharacters]:{restricted:!0,type:"boolean",default:i.ambiguousCharacters,description:d(701,null)},[Vx.includeComments]:{restricted:!0,type:["boolean","string"],enum:[!0,!1,w_],default:i.includeComments,description:d(702,null)},[Vx.includeStrings]:{restricted:!0,type:["boolean","string"],enum:[!0,!1,w_],default:i.includeStrings,description:d(703,null)},[Vx.allowedCharacters]:{restricted:!0,type:"object",default:i.allowedCharacters,description:d(699,null),additionalProperties:{type:"boolean"}},[Vx.allowedLocales]:{restricted:!0,type:"object",additionalProperties:{type:"boolean"},default:i.allowedLocales,description:d(700,null)}})}applyUpdate(i,e){let t=!1;e.allowedCharacters&&i&&(eo(i.allowedCharacters,e.allowedCharacters)||(i={...i,allowedCharacters:e.allowedCharacters},t=!0)),e.allowedLocales&&i&&(eo(i.allowedLocales,e.allowedLocales)||(i={...i,allowedLocales:e.allowedLocales},t=!0));let o=super.applyUpdate(i,e);return t?new zIe(o.newValue,!0):o}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{nonBasicASCII:KIe(e.nonBasicASCII,w_,[!0,!1,w_]),invisibleCharacters:yn(e.invisibleCharacters,this.defaultValue.invisibleCharacters),ambiguousCharacters:yn(e.ambiguousCharacters,this.defaultValue.ambiguousCharacters),includeComments:KIe(e.includeComments,w_,[!0,!1,w_]),includeStrings:KIe(e.includeStrings,w_,[!0,!1,w_]),allowedCharacters:this.validateBooleanMap(e.allowedCharacters,this.defaultValue.allowedCharacters),allowedLocales:this.validateBooleanMap(e.allowedLocales,this.defaultValue.allowedLocales)}}validateBooleanMap(i,e){if(typeof i!="object"||!i)return e;let t={};for(let[o,n]of Object.entries(i))n===!0&&(t[o]=!0);return t}},UZt=class extends Zu{constructor(){let i={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",i,{"editor.inlineSuggest.enabled":{type:"boolean",default:i.enabled,description:d(531,null)},"editor.inlineSuggest.showToolbar":{type:"string",default:i.showToolbar,enum:["always","onHover","never"],enumDescriptions:[d(536,null),d(538,null),d(537,null)],description:d(535,null)},"editor.inlineSuggest.syntaxHighlightingEnabled":{type:"boolean",default:i.syntaxHighlightingEnabled,description:d(542,null)},"editor.inlineSuggest.suppressSuggestions":{type:"boolean",default:i.suppressSuggestions,description:d(541,null)},"editor.inlineSuggest.suppressInSnippetMode":{type:"boolean",default:i.suppressInSnippetMode,description:d(540,null)},"editor.inlineSuggest.minShowDelay":{type:"number",default:0,minimum:0,maximum:1e4,description:d(533,null)},"editor.inlineSuggest.experimental.suppressInlineSuggestions":{type:"string",default:i.experimental.suppressInlineSuggestions,tags:["experimental"],description:d(539,null),experiment:{mode:"auto"}},"editor.inlineSuggest.experimental.emptyResponseInformation":{type:"boolean",default:i.experimental.emptyResponseInformation,tags:["experimental"],description:d(530,null),experiment:{mode:"auto"}},"editor.inlineSuggest.triggerCommandOnProviderChange":{type:"boolean",default:i.triggerCommandOnProviderChange,tags:["experimental"],description:d(543,null),experiment:{mode:"auto"}},"editor.inlineSuggest.experimental.showOnSuggestConflict":{type:"string",default:i.experimental.showOnSuggestConflict,tags:["experimental"],enum:["always","never","whenSuggestListIsIncomplete"],description:d(534,null),experiment:{mode:"auto"}},"editor.inlineSuggest.fontFamily":{type:"string",default:i.fontFamily,description:d(532,null)},"editor.inlineSuggest.edits.allowCodeShifting":{type:"string",default:i.edits.allowCodeShifting,description:d(526,null),enum:["always","horizontal","never"],tags:["nextEditSuggestions"]},"editor.inlineSuggest.edits.showLongDistanceHint":{type:"boolean",default:i.edits.showLongDistanceHint,description:d(529,null),tags:["nextEditSuggestions","experimental"]},"editor.inlineSuggest.edits.renderSideBySide":{type:"string",default:i.edits.renderSideBySide,description:d(527,null),enum:["auto","never"],enumDescriptions:[d(428,null),d(429,null)],tags:["nextEditSuggestions"]},"editor.inlineSuggest.edits.showCollapsed":{type:"boolean",default:i.edits.showCollapsed,description:d(528,null),tags:["nextEditSuggestions"]}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{enabled:yn(e.enabled,this.defaultValue.enabled),mode:Xd(e.mode,this.defaultValue.mode,["prefix","subword","subwordSmart"]),showToolbar:Xd(e.showToolbar,this.defaultValue.showToolbar,["always","onHover","never"]),suppressSuggestions:yn(e.suppressSuggestions,this.defaultValue.suppressSuggestions),keepOnBlur:yn(e.keepOnBlur,this.defaultValue.keepOnBlur),fontFamily:yC.string(e.fontFamily,this.defaultValue.fontFamily),syntaxHighlightingEnabled:yn(e.syntaxHighlightingEnabled,this.defaultValue.syntaxHighlightingEnabled),minShowDelay:Xc.clampedInt(e.minShowDelay,0,0,1e4),suppressInSnippetMode:yn(e.suppressInSnippetMode,this.defaultValue.suppressInSnippetMode),edits:this._validateEdits(e.edits),triggerCommandOnProviderChange:yn(e.triggerCommandOnProviderChange,this.defaultValue.triggerCommandOnProviderChange),experimental:this._validateExperimental(e.experimental)}}_validateEdits(i){if(!i||typeof i!="object")return this.defaultValue.edits;let e=i;return{enabled:yn(e.enabled,this.defaultValue.edits.enabled),showCollapsed:yn(e.showCollapsed,this.defaultValue.edits.showCollapsed),allowCodeShifting:Xd(e.allowCodeShifting,this.defaultValue.edits.allowCodeShifting,["always","horizontal","never"]),showLongDistanceHint:yn(e.showLongDistanceHint,this.defaultValue.edits.showLongDistanceHint),renderSideBySide:Xd(e.renderSideBySide,this.defaultValue.edits.renderSideBySide,["never","auto"])}}_validateExperimental(i){if(!i||typeof i!="object")return this.defaultValue.experimental;let e=i;return{suppressInlineSuggestions:yC.string(e.suppressInlineSuggestions,this.defaultValue.experimental.suppressInlineSuggestions),showOnSuggestConflict:Xd(e.showOnSuggestConflict,this.defaultValue.experimental.showOnSuggestConflict,["always","never","whenSuggestListIsIncomplete"]),emptyResponseInformation:yn(e.emptyResponseInformation,this.defaultValue.experimental.emptyResponseInformation)}}},zZt=class extends Zu{constructor(){let i={enabled:fv.bracketPairColorizationOptions.enabled,independentColorPoolPerBracketType:fv.bracketPairColorizationOptions.independentColorPoolPerBracketType};super(21,"bracketPairColorization",i,{"editor.bracketPairColorization.enabled":{type:"boolean",default:i.enabled,markdownDescription:d(335,null,"`#workbench.colorCustomizations#`")},"editor.bracketPairColorization.independentColorPoolPerBracketType":{type:"boolean",default:i.independentColorPoolPerBracketType,description:d(336,null)}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{enabled:yn(e.enabled,this.defaultValue.enabled),independentColorPoolPerBracketType:yn(e.independentColorPoolPerBracketType,this.defaultValue.independentColorPoolPerBracketType)}}},KZt=class extends Zu{constructor(){let i={bracketPairs:!1,bracketPairsHorizontal:"active",highlightActiveBracketPair:!0,indentation:!0,highlightActiveIndentation:!0};super(22,"guides",i,{"editor.guides.bracketPairs":{type:["boolean","string"],enum:[!0,"active",!1],enumDescriptions:[d(413,null),d(411,null),d(412,null)],default:i.bracketPairs,description:d(410,null)},"editor.guides.bracketPairsHorizontal":{type:["boolean","string"],enum:[!0,"active",!1],enumDescriptions:[d(417,null),d(415,null),d(416,null)],default:i.bracketPairsHorizontal,description:d(414,null)},"editor.guides.highlightActiveBracketPair":{type:"boolean",default:i.highlightActiveBracketPair,description:d(418,null)},"editor.guides.indentation":{type:"boolean",default:i.indentation,description:d(423,null)},"editor.guides.highlightActiveIndentation":{type:["boolean","string"],enum:[!0,"always",!1],enumDescriptions:[d(422,null),d(420,null),d(421,null)],default:i.highlightActiveIndentation,description:d(419,null)}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{bracketPairs:KIe(e.bracketPairs,this.defaultValue.bracketPairs,[!0,!1,"active"]),bracketPairsHorizontal:KIe(e.bracketPairsHorizontal,this.defaultValue.bracketPairsHorizontal,[!0,!1,"active"]),highlightActiveBracketPair:yn(e.highlightActiveBracketPair,this.defaultValue.highlightActiveBracketPair),indentation:yn(e.indentation,this.defaultValue.indentation),highlightActiveIndentation:KIe(e.highlightActiveIndentation,this.defaultValue.highlightActiveIndentation,[!0,!1,"always"])}}};function KIe(a,i,e){let t=e.indexOf(a);return t===-1?i:e[t]}var GZt=class extends Zu{constructor(){let i={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",i,{"editor.suggest.insertMode":{type:"string",enum:["insert","replace"],enumDescriptions:[d(671,null),d(673,null)],default:i.insertMode,description:d(669,null)},"editor.suggest.filterGraceful":{type:"boolean",default:i.filterGraceful,description:d(668,null)},"editor.suggest.localityBonus":{type:"boolean",default:i.localityBonus,description:d(676,null)},"editor.suggest.shareSuggestSelections":{type:"boolean",default:i.shareSuggestSelections,markdownDescription:d(680,null)},"editor.suggest.selectionMode":{type:"string",enum:["always","never","whenTriggerCharacter","whenQuickSuggestion"],enumDescriptions:[d(670,null),d(672,null),d(675,null),d(674,null)],default:i.selectionMode,markdownDescription:d(679,null,"`#editor.quickSuggestions#`","`#editor.suggestOnTriggerCharacters#`")},"editor.suggest.snippetsPreventQuickSuggestions":{type:"boolean",default:i.snippetsPreventQuickSuggestions,description:d(684,null)},"editor.suggest.showIcons":{type:"boolean",default:i.showIcons,description:d(681,null)},"editor.suggest.showStatusBar":{type:"boolean",default:i.showStatusBar,description:d(683,null)},"editor.suggest.preview":{type:"boolean",default:i.preview,description:d(678,null)},"editor.suggest.showInlineDetails":{type:"boolean",default:i.showInlineDetails,description:d(682,null)},"editor.suggest.maxVisibleSuggestions":{type:"number",deprecationMessage:d(677,null)},"editor.suggest.filteredTypes":{type:"object",deprecationMessage:d(361,null)},"editor.suggest.showMethods":{type:"boolean",default:!0,markdownDescription:d(454,null)},"editor.suggest.showFunctions":{type:"boolean",default:!0,markdownDescription:d(450,null)},"editor.suggest.showConstructors":{type:"boolean",default:!0,markdownDescription:d(441,null)},"editor.suggest.showDeprecated":{type:"boolean",default:!0,markdownDescription:d(443,null)},"editor.suggest.matchOnWordStartOnly":{type:"boolean",default:!0,markdownDescription:d(437,null)},"editor.suggest.showFields":{type:"boolean",default:!0,markdownDescription:d(447,null)},"editor.suggest.showVariables":{type:"boolean",default:!0,markdownDescription:d(466,null)},"editor.suggest.showClasses":{type:"boolean",default:!0,markdownDescription:d(438,null)},"editor.suggest.showStructs":{type:"boolean",default:!0,markdownDescription:d(460,null)},"editor.suggest.showInterfaces":{type:"boolean",default:!0,markdownDescription:d(451,null)},"editor.suggest.showModules":{type:"boolean",default:!0,markdownDescription:d(455,null)},"editor.suggest.showProperties":{type:"boolean",default:!0,markdownDescription:d(457,null)},"editor.suggest.showEvents":{type:"boolean",default:!0,markdownDescription:d(446,null)},"editor.suggest.showOperators":{type:"boolean",default:!0,markdownDescription:d(456,null)},"editor.suggest.showUnits":{type:"boolean",default:!0,markdownDescription:d(463,null)},"editor.suggest.showValues":{type:"boolean",default:!0,markdownDescription:d(465,null)},"editor.suggest.showConstants":{type:"boolean",default:!0,markdownDescription:d(440,null)},"editor.suggest.showEnums":{type:"boolean",default:!0,markdownDescription:d(445,null)},"editor.suggest.showEnumMembers":{type:"boolean",default:!0,markdownDescription:d(444,null)},"editor.suggest.showKeywords":{type:"boolean",default:!0,markdownDescription:d(453,null)},"editor.suggest.showWords":{type:"boolean",default:!0,markdownDescription:d(461,null)},"editor.suggest.showColors":{type:"boolean",default:!0,markdownDescription:d(439,null)},"editor.suggest.showFiles":{type:"boolean",default:!0,markdownDescription:d(448,null)},"editor.suggest.showReferences":{type:"boolean",default:!0,markdownDescription:d(458,null)},"editor.suggest.showCustomcolors":{type:"boolean",default:!0,markdownDescription:d(442,null)},"editor.suggest.showFolders":{type:"boolean",default:!0,markdownDescription:d(449,null)},"editor.suggest.showTypeParameters":{type:"boolean",default:!0,markdownDescription:d(462,null)},"editor.suggest.showSnippets":{type:"boolean",default:!0,markdownDescription:d(459,null)},"editor.suggest.showUsers":{type:"boolean",default:!0,markdownDescription:d(464,null)},"editor.suggest.showIssues":{type:"boolean",default:!0,markdownDescription:d(452,null)}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{insertMode:Xd(e.insertMode,this.defaultValue.insertMode,["insert","replace"]),filterGraceful:yn(e.filterGraceful,this.defaultValue.filterGraceful),snippetsPreventQuickSuggestions:yn(e.snippetsPreventQuickSuggestions,this.defaultValue.filterGraceful),localityBonus:yn(e.localityBonus,this.defaultValue.localityBonus),shareSuggestSelections:yn(e.shareSuggestSelections,this.defaultValue.shareSuggestSelections),selectionMode:Xd(e.selectionMode,this.defaultValue.selectionMode,["always","never","whenQuickSuggestion","whenTriggerCharacter"]),showIcons:yn(e.showIcons,this.defaultValue.showIcons),showStatusBar:yn(e.showStatusBar,this.defaultValue.showStatusBar),preview:yn(e.preview,this.defaultValue.preview),previewMode:Xd(e.previewMode,this.defaultValue.previewMode,["prefix","subword","subwordSmart"]),showInlineDetails:yn(e.showInlineDetails,this.defaultValue.showInlineDetails),showMethods:yn(e.showMethods,this.defaultValue.showMethods),showFunctions:yn(e.showFunctions,this.defaultValue.showFunctions),showConstructors:yn(e.showConstructors,this.defaultValue.showConstructors),showDeprecated:yn(e.showDeprecated,this.defaultValue.showDeprecated),matchOnWordStartOnly:yn(e.matchOnWordStartOnly,this.defaultValue.matchOnWordStartOnly),showFields:yn(e.showFields,this.defaultValue.showFields),showVariables:yn(e.showVariables,this.defaultValue.showVariables),showClasses:yn(e.showClasses,this.defaultValue.showClasses),showStructs:yn(e.showStructs,this.defaultValue.showStructs),showInterfaces:yn(e.showInterfaces,this.defaultValue.showInterfaces),showModules:yn(e.showModules,this.defaultValue.showModules),showProperties:yn(e.showProperties,this.defaultValue.showProperties),showEvents:yn(e.showEvents,this.defaultValue.showEvents),showOperators:yn(e.showOperators,this.defaultValue.showOperators),showUnits:yn(e.showUnits,this.defaultValue.showUnits),showValues:yn(e.showValues,this.defaultValue.showValues),showConstants:yn(e.showConstants,this.defaultValue.showConstants),showEnums:yn(e.showEnums,this.defaultValue.showEnums),showEnumMembers:yn(e.showEnumMembers,this.defaultValue.showEnumMembers),showKeywords:yn(e.showKeywords,this.defaultValue.showKeywords),showWords:yn(e.showWords,this.defaultValue.showWords),showColors:yn(e.showColors,this.defaultValue.showColors),showFiles:yn(e.showFiles,this.defaultValue.showFiles),showReferences:yn(e.showReferences,this.defaultValue.showReferences),showFolders:yn(e.showFolders,this.defaultValue.showFolders),showTypeParameters:yn(e.showTypeParameters,this.defaultValue.showTypeParameters),showSnippets:yn(e.showSnippets,this.defaultValue.showSnippets),showUsers:yn(e.showUsers,this.defaultValue.showUsers),showIssues:yn(e.showIssues,this.defaultValue.showIssues)}}},qZt=class extends Zu{constructor(){super(129,"smartSelect",{selectLeadingAndTrailingWhitespace:!0,selectSubwords:!0},{"editor.smartSelect.selectLeadingAndTrailingWhitespace":{description:d(653,null),default:!0,type:"boolean"},"editor.smartSelect.selectSubwords":{description:d(654,null),default:!0,type:"boolean"}})}validate(i){return!i||typeof i!="object"?this.defaultValue:{selectLeadingAndTrailingWhitespace:yn(i.selectLeadingAndTrailingWhitespace,this.defaultValue.selectLeadingAndTrailingWhitespace),selectSubwords:yn(i.selectSubwords,this.defaultValue.selectSubwords)}}},$Zt=class extends Zu{constructor(){let i=[];super(147,"wordSegmenterLocales",i,{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}],description:d(714,null),type:"array",items:{type:"string"},default:i})}validate(i){if(typeof i=="string"&&(i=[i]),Array.isArray(i)){let e=[];for(let t of i)if(typeof t=="string")try{Intl.Segmenter.supportedLocalesOf(t).length>0&&e.push(t)}catch{}return e}return this.defaultValue}};var jZt=class extends Zu{constructor(){super(155,"wrappingIndent",1,{"editor.wrappingIndent":{type:"string",enum:["none","same","indent","deepIndent"],enumDescriptions:[d(726,null),d(727,null),d(725,null),d(724,null)],description:d(723,null),default:"same"}})}validate(i){switch(i){case"none":return 0;case"same":return 1;case"indent":return 2;case"deepIndent":return 3}return 1}compute(i,e,t){return e.get(2)===2?0:t}},QZt=class extends x1{constructor(){super(166,{isDominatedByLongLines:!1,isWordWrapMinified:!1,isViewportWrapping:!1,wrappingColumn:-1})}compute(i,e,t){let o=e.get(165);return{isDominatedByLongLines:i.isDominatedByLongLines,isWordWrapMinified:o.isWordWrapMinified,isViewportWrapping:o.isViewportWrapping,wrappingColumn:o.wrappingColumn}}},YZt=class extends Zu{constructor(){let i={enabled:!0,showDropSelector:"afterDrop"};super(43,"dropIntoEditor",i,{"editor.dropIntoEditor.enabled":{type:"boolean",default:i.enabled,markdownDescription:d(364,null)},"editor.dropIntoEditor.showDropSelector":{type:"string",markdownDescription:d(365,null),enum:["afterDrop","never"],enumDescriptions:[d(366,null),d(367,null)],default:"afterDrop"}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{enabled:yn(e.enabled,this.defaultValue.enabled),showDropSelector:Xd(e.showDropSelector,this.defaultValue.showDropSelector,["afterDrop","never"])}}},XZt=class extends Zu{constructor(){let i={enabled:!0,showPasteSelector:"afterPaste"};super(97,"pasteAs",i,{"editor.pasteAs.enabled":{type:"boolean",default:i.enabled,markdownDescription:d(600,null)},"editor.pasteAs.showPasteSelector":{type:"string",markdownDescription:d(601,null),enum:["afterPaste","never"],enumDescriptions:[d(602,null),d(603,null)],default:"afterPaste"}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{enabled:yn(e.enabled,this.defaultValue.enabled),showPasteSelector:Xd(e.showPasteSelector,this.defaultValue.showPasteSelector,["afterPaste","never"])}}},k1=[];function Ai(a){return k1[a.id]=a,a}var iS={acceptSuggestionOnCommitCharacter:Ai(new Ds(0,"acceptSuggestionOnCommitCharacter",!0,{markdownDescription:d(310,null)})),acceptSuggestionOnEnter:Ai(new Ju(1,"acceptSuggestionOnEnter","on",["on","smart","off"],{markdownEnumDescriptions:["",d(312,null),""],markdownDescription:d(311,null)})),accessibilitySupport:Ai(new uZt),accessibilityPageSize:Ai(new Xc(3,"accessibilityPageSize",500,1,1073741824,{description:d(313,null),tags:["accessibility"]})),allowOverflow:Ai(new Ds(4,"allowOverflow",!0)),allowVariableLineHeights:Ai(new Ds(5,"allowVariableLineHeights",!0,{description:d(320,null)})),allowVariableFonts:Ai(new Ds(6,"allowVariableFonts",!0,{description:d(318,null)})),allowVariableFontsInAccessibilityMode:Ai(new Ds(7,"allowVariableFontsInAccessibilityMode",!1,{description:d(319,null),tags:["accessibility"]})),ariaLabel:Ai(new yC(8,"ariaLabel",d(467,null))),ariaRequired:Ai(new Ds(9,"ariaRequired",!1,void 0)),screenReaderAnnounceInlineSuggestion:Ai(new Ds(12,"screenReaderAnnounceInlineSuggestion",!0,{description:d(632,null),tags:["accessibility"]})),autoClosingBrackets:Ai(new Ju(10,"autoClosingBrackets","languageDefined",["always","languageDefined","beforeWhitespace","never"],{enumDescriptions:["",d(370,null),d(369,null),""],description:d(326,null)})),autoClosingComments:Ai(new Ju(11,"autoClosingComments","languageDefined",["always","languageDefined","beforeWhitespace","never"],{enumDescriptions:["",d(372,null),d(371,null),""],description:d(327,null)})),autoClosingDelete:Ai(new Ju(13,"autoClosingDelete","auto",["always","auto","never"],{enumDescriptions:["",d(373,null),""],description:d(328,null)})),autoClosingOvertype:Ai(new Ju(14,"autoClosingOvertype","auto",["always","auto","never"],{enumDescriptions:["",d(374,null),""],description:d(329,null)})),autoClosingQuotes:Ai(new Ju(15,"autoClosingQuotes","languageDefined",["always","languageDefined","beforeWhitespace","never"],{enumDescriptions:["",d(376,null),d(375,null),""],description:d(330,null)})),autoIndent:Ai(new Cae(16,"autoIndent",4,"full",["none","keep","brackets","advanced","full"],g0o,{enumDescriptions:[d(381,null),d(380,null),d(378,null),d(377,null),d(379,null)],description:d(331,null)})),autoIndentOnPaste:Ai(new Ds(17,"autoIndentOnPaste",!1,{description:d(332,null)})),autoIndentOnPasteWithinString:Ai(new Ds(18,"autoIndentOnPasteWithinString",!0,{description:d(333,null)})),automaticLayout:Ai(new Ds(19,"automaticLayout",!1)),autoSurround:Ai(new Ju(20,"autoSurround","languageDefined",["languageDefined","quotes","brackets","never"],{enumDescriptions:[d(383,null),d(384,null),d(382,null),""],description:d(334,null)})),bracketPairColorization:Ai(new zZt),bracketPairGuides:Ai(new KZt),stickyTabStops:Ai(new Ds(132,"stickyTabStops",!1,{description:d(667,null)})),codeLens:Ai(new Ds(23,"codeLens",!0,{description:d(337,null)})),codeLensFontFamily:Ai(new yC(24,"codeLensFontFamily","",{description:d(338,null)})),codeLensFontSize:Ai(new Xc(25,"codeLensFontSize",0,0,100,{type:"number",default:0,minimum:0,maximum:100,markdownDescription:d(339,null)})),colorDecorators:Ai(new Ds(26,"colorDecorators",!0,{description:d(341,null)})),colorDecoratorActivatedOn:Ai(new Ju(168,"colorDecoratorsActivatedOn","clickAndHover",["clickAndHover","hover","click"],{enumDescriptions:[d(386,null),d(387,null),d(385,null)],description:d(340,null)})),colorDecoratorsLimit:Ai(new Xc(27,"colorDecoratorsLimit",500,1,1e6,{markdownDescription:d(342,null)})),columnSelection:Ai(new Ds(28,"columnSelection",!1,{description:d(343,null)})),comments:Ai(new pZt),contextmenu:Ai(new Ds(30,"contextmenu",!0)),copyWithSyntaxHighlighting:Ai(new Ds(31,"copyWithSyntaxHighlighting",!0,{description:d(346,null)})),cursorBlinking:Ai(new Cae(32,"cursorBlinking",1,"blink",["blink","smooth","phase","expand","solid"],JZt,{description:d(347,null)})),cursorSmoothCaretAnimation:Ai(new Ju(33,"cursorSmoothCaretAnimation","off",["off","explicit","on"],{enumDescriptions:[d(351,null),d(350,null),d(352,null)],description:d(349,null)})),cursorStyle:Ai(new Cae(34,"cursorStyle",1,"line",["line","block","underline","line-thin","block-outline","underline-thin"],Zgt,{description:d(353,null)})),overtypeCursorStyle:Ai(new Cae(92,"overtypeCursorStyle",2,"block",["line","block","underline","line-thin","block-outline","underline-thin"],Zgt,{description:d(593,null)})),cursorSurroundingLines:Ai(new Xc(35,"cursorSurroundingLines",0,0,1073741824,{description:d(354,null)})),cursorSurroundingLinesStyle:Ai(new Ju(36,"cursorSurroundingLinesStyle","default",["default","all"],{enumDescriptions:[d(357,null),d(356,null)],markdownDescription:d(355,null)})),cursorWidth:Ai(new Xc(37,"cursorWidth",0,0,1073741824,{markdownDescription:d(358,null)})),cursorHeight:Ai(new Xc(38,"cursorHeight",0,0,1073741824,{markdownDescription:d(348,null)})),disableLayerHinting:Ai(new Ds(39,"disableLayerHinting",!1)),disableMonospaceOptimizations:Ai(new Ds(40,"disableMonospaceOptimizations",!1)),domReadOnly:Ai(new Ds(41,"domReadOnly",!1)),doubleClickSelectsBlock:Ai(new Ds(173,"doubleClickSelectsBlock",!0,{description:d(362,null)})),dragAndDrop:Ai(new Ds(42,"dragAndDrop",!0,{description:d(363,null)})),emptySelectionClipboard:Ai(new hZt),dropIntoEditor:Ai(new YZt),editContext:Ai(new Ds(44,"editContext",!0,{description:d(368,null),included:d1||jSe||Vr})),renderRichScreenReaderContent:Ai(new Ds(107,"renderRichScreenReaderContent",!1,{markdownDescription:d(623,null)})),stickyScroll:Ai(new TZt),experimentalGpuAcceleration:Ai(new Ju(46,"experimentalGpuAcceleration","off",["off","on"],{tags:["experimental"],enumDescriptions:[d(471,null),d(472,null)],description:d(470,null)})),experimentalWhitespaceRendering:Ai(new Ju(47,"experimentalWhitespaceRendering","svg",["svg","font","off"],{enumDescriptions:[d(476,null),d(474,null),d(475,null)],description:d(473,null)})),extraEditorClassName:Ai(new yC(48,"extraEditorClassName","")),fastScrollSensitivity:Ai(new vE(49,"fastScrollSensitivity",5,a=>a<=0?5:a,{markdownDescription:d(477,null)})),find:Ai(new gZt),fixedOverflowWidgets:Ai(new Ds(51,"fixedOverflowWidgets",!1)),folding:Ai(new Ds(52,"folding",!0,{description:d(488,null)})),foldingStrategy:Ai(new Ju(53,"foldingStrategy","auto",["auto","indentation"],{enumDescriptions:[d(493,null),d(494,null)],description:d(492,null)})),foldingHighlight:Ai(new Ds(54,"foldingHighlight",!0,{description:d(489,null)})),foldingImportsByDefault:Ai(new Ds(55,"foldingImportsByDefault",!1,{description:d(490,null)})),foldingMaximumRegions:Ai(new Xc(56,"foldingMaximumRegions",5e3,10,65e3,{description:d(491,null)})),unfoldOnClickAfterEndOfLine:Ai(new Ds(57,"unfoldOnClickAfterEndOfLine",!1,{description:d(698,null)})),fontFamily:Ai(new yC(58,"fontFamily",fu.fontFamily,{description:d(495,null)})),fontInfo:Ai(new vZt),fontLigatures2:Ai(new Bx),fontSize:Ai(new yZt),fontWeight:Ai(new wZt),fontVariations:Ai(new fZt),formatOnPaste:Ai(new Ds(64,"formatOnPaste",!1,{description:d(505,null)})),formatOnType:Ai(new Ds(65,"formatOnType",!1,{description:d(506,null)})),glyphMargin:Ai(new Ds(66,"glyphMargin",!0,{description:d(507,null)})),gotoLocation:Ai(new CZt),hideCursorInOverviewRuler:Ai(new Ds(68,"hideCursorInOverviewRuler",!1,{description:d(508,null)})),hover:Ai(new xZt),inDiffEditor:Ai(new Ds(70,"inDiffEditor",!1)),inertialScroll:Ai(new Ds(158,"inertialScroll",!1,{description:d(518,null)})),letterSpacing:Ai(new vE(72,"letterSpacing",fu.letterSpacing,a=>vE.clamp(a,-5,20),{description:d(544,null)})),lightbulb:Ai(new EZt),lineDecorationsWidth:Ai(new DZt),lineHeight:Ai(new LZt),lineNumbers:Ai(new FZt),lineNumbersMinChars:Ai(new Xc(77,"lineNumbersMinChars",5,1,300)),linkedEditing:Ai(new Ds(78,"linkedEditing",!1,{description:d(551,null)})),links:Ai(new Ds(79,"links",!0,{description:d(552,null)})),matchBrackets:Ai(new Ju(80,"matchBrackets","always",["always","near","never"],{description:d(553,null)})),minimap:Ai(new RZt),mouseStyle:Ai(new Ju(82,"mouseStyle","text",["text","default","copy"])),mouseWheelScrollSensitivity:Ai(new vE(83,"mouseWheelScrollSensitivity",1,a=>a===0?1:a,{markdownDescription:d(574,null)})),mouseWheelZoom:Ai(new Ds(84,"mouseWheelZoom",!1,{markdownDescription:Ze?d(576,null):d(575,null)})),multiCursorMergeOverlapping:Ai(new Ds(85,"multiCursorMergeOverlapping",!0,{description:d(578,null)})),multiCursorModifier:Ai(new Cae(86,"multiCursorModifier","altKey","alt",["ctrlCmd","alt"],f0o,{markdownEnumDescriptions:[d(581,null),d(580,null)],markdownDescription:d(579,null)})),mouseMiddleClickAction:Ai(new Ju(87,"mouseMiddleClickAction","default",["default","openLink","ctrlLeftClick"],{description:d(573,null)})),multiCursorPaste:Ai(new Ju(88,"multiCursorPaste","spread",["spread","full"],{markdownEnumDescriptions:[d(584,null),d(583,null)],markdownDescription:d(582,null)})),multiCursorLimit:Ai(new Xc(89,"multiCursorLimit",1e4,1,1e5,{markdownDescription:d(577,null)})),occurrencesHighlight:Ai(new Ju(90,"occurrencesHighlight","singleFile",["off","singleFile","multiFile"],{markdownEnumDescriptions:[d(587,null),d(588,null),d(586,null)],markdownDescription:d(585,null)})),occurrencesHighlightDelay:Ai(new Xc(91,"occurrencesHighlightDelay",0,0,2e3,{description:d(589,null),tags:["preview"]})),overtypeOnPaste:Ai(new Ds(93,"overtypeOnPaste",!0,{description:d(594,null)})),overviewRulerBorder:Ai(new Ds(94,"overviewRulerBorder",!0,{description:d(595,null)})),overviewRulerLanes:Ai(new Xc(95,"overviewRulerLanes",3,0,3)),padding:Ai(new MZt),pasteAs:Ai(new XZt),parameterHints:Ai(new PZt),peekWidgetDefaultFocus:Ai(new Ju(99,"peekWidgetDefaultFocus","tree",["tree","editor"],{enumDescriptions:[d(606,null),d(605,null)],description:d(604,null)})),placeholder:Ai(new NZt),definitionLinkOpensInPeek:Ai(new Ds(101,"definitionLinkOpensInPeek",!1,{description:d(360,null)})),quickSuggestions:Ai(new OZt),quickSuggestionsDelay:Ai(new Xc(103,"quickSuggestionsDelay",10,0,1073741824,{description:d(615,null),experiment:{mode:"auto"}})),readOnly:Ai(new Ds(104,"readOnly",!1)),readOnlyMessage:Ai(new VZt),renameOnType:Ai(new Ds(106,"renameOnType",!1,{description:d(616,null),markdownDeprecationMessage:d(617,null)})),renderControlCharacters:Ai(new Ds(108,"renderControlCharacters",!0,{description:d(618,null),restricted:!0})),renderFinalNewline:Ai(new Ju(109,"renderFinalNewline",fn?"dimmed":"on",["off","on","dimmed"],{description:d(619,null)})),renderLineHighlight:Ai(new Ju(110,"renderLineHighlight","line",["none","gutter","line","all"],{enumDescriptions:["","","",d(621,null)],description:d(620,null)})),renderLineHighlightOnlyWhenFocus:Ai(new Ds(111,"renderLineHighlightOnlyWhenFocus",!1,{description:d(622,null)})),renderValidationDecorations:Ai(new Ju(112,"renderValidationDecorations","editable",["editable","on","off"])),renderWhitespace:Ai(new Ju(113,"renderWhitespace","selection",["none","boundary","selection","trailing","all"],{enumDescriptions:["",d(625,null),d(626,null),d(627,null),""],description:d(624,null)})),revealHorizontalRightPadding:Ai(new Xc(114,"revealHorizontalRightPadding",15,0,1e3)),roundedSelection:Ai(new Ds(115,"roundedSelection",!0,{description:d(628,null)})),rulers:Ai(new WZt),scrollbar:Ai(new BZt),scrollBeyondLastColumn:Ai(new Xc(118,"scrollBeyondLastColumn",4,0,1073741824,{description:d(645,null)})),scrollBeyondLastLine:Ai(new Ds(119,"scrollBeyondLastLine",!0,{description:d(646,null)})),scrollOnMiddleClick:Ai(new Ds(171,"scrollOnMiddleClick",!1,{description:d(647,null)})),scrollPredominantAxis:Ai(new Ds(120,"scrollPredominantAxis",!0,{description:d(648,null)})),selectionClipboard:Ai(new Ds(121,"selectionClipboard",!0,{description:d(649,null),included:fn})),selectionHighlight:Ai(new Ds(122,"selectionHighlight",!0,{description:d(650,null)})),selectionHighlightMaxLength:Ai(new Xc(123,"selectionHighlightMaxLength",200,0,1073741824,{description:d(651,null)})),selectionHighlightMultiline:Ai(new Ds(124,"selectionHighlightMultiline",!1,{description:d(652,null)})),selectOnLineNumbers:Ai(new Ds(125,"selectOnLineNumbers",!0)),showFoldingControls:Ai(new Ju(126,"showFoldingControls","mouseover",["always","never","mouseover"],{enumDescriptions:[d(657,null),d(659,null),d(658,null)],description:d(656,null)})),showUnused:Ai(new Ds(127,"showUnused",!0,{description:d(660,null)})),showDeprecated:Ai(new Ds(157,"showDeprecated",!0,{description:d(655,null)})),inlayHints:Ai(new _Zt),snippetSuggestions:Ai(new Ju(128,"snippetSuggestions","inline",["top","bottom","inline","none"],{enumDescriptions:[d(666,null),d(663,null),d(664,null),d(665,null)],description:d(662,null)})),smartSelect:Ai(new qZt),smoothScrolling:Ai(new Ds(130,"smoothScrolling",!1,{description:d(661,null)})),stopRenderingLineAfter:Ai(new Xc(133,"stopRenderingLineAfter",1e4,-1,1073741824)),suggest:Ai(new GZt),inlineSuggest:Ai(new UZt),inlineCompletionsAccessibilityVerbose:Ai(new Ds(169,"inlineCompletionsAccessibilityVerbose",!1,{description:d(525,null)})),suggestFontSize:Ai(new Xc(135,"suggestFontSize",0,0,1e3,{markdownDescription:d(685,null,"`0`","`#editor.fontSize#`")})),suggestLineHeight:Ai(new Xc(136,"suggestLineHeight",0,0,1e3,{markdownDescription:d(686,null,"`0`","`#editor.lineHeight#`")})),suggestOnTriggerCharacters:Ai(new Ds(137,"suggestOnTriggerCharacters",!0,{description:d(687,null)})),suggestSelection:Ai(new Ju(138,"suggestSelection","first",["first","recentlyUsed","recentlyUsedByPrefix"],{markdownEnumDescriptions:[d(689,null),d(690,null),d(691,null)],description:d(688,null)})),tabCompletion:Ai(new Ju(139,"tabCompletion","off",["on","off","onlySnippets"],{enumDescriptions:[d(694,null),d(693,null),d(695,null)],description:d(692,null)})),tabIndex:Ai(new Xc(140,"tabIndex",0,-1,1073741824)),trimWhitespaceOnDelete:Ai(new Ds(141,"trimWhitespaceOnDelete",!1,{description:d(697,null)})),unicodeHighlight:Ai(new HZt),unusualLineTerminators:Ai(new Ju(143,"unusualLineTerminators","prompt",["auto","off","prompt"],{enumDescriptions:[d(707,null),d(708,null),d(709,null)],description:d(706,null)})),useShadowDOM:Ai(new Ds(144,"useShadowDOM",!0)),useTabStops:Ai(new Ds(145,"useTabStops",!0,{description:d(710,null)})),wordBreak:Ai(new Ju(146,"wordBreak","normal",["normal","keepAll"],{markdownEnumDescriptions:[d(713,null),d(712,null)],description:d(711,null)})),wordSegmenterLocales:Ai(new $Zt),wordSeparators:Ai(new yC(148,"wordSeparators",xV,{description:d(715,null)})),wordWrap:Ai(new Ju(149,"wordWrap","off",["off","on","wordWrapColumn","bounded"],{markdownEnumDescriptions:[d(718,null),d(719,null),d(720,null),d(717,null)],description:d(716,null)})),wordWrapBreakAfterCharacters:Ai(new yC(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:Ai(new yC(151,"wordWrapBreakBeforeCharacters","([{\u2018\u201C\u3008\u300A\u300C\u300E\u3010\u3014\uFF08\uFF3B\uFF5B\uFF62\xA3\xA5\uFF04\uFFE1\uFFE5+\uFF0B")),wordWrapColumn:Ai(new Xc(152,"wordWrapColumn",80,1,1073741824,{markdownDescription:d(721,null)})),wordWrapOverride1:Ai(new Ju(153,"wordWrapOverride1","inherit",["off","on","inherit"])),wordWrapOverride2:Ai(new Ju(154,"wordWrapOverride2","inherit",["off","on","inherit"])),wrapOnEscapedLineFeeds:Ai(new Ds(160,"wrapOnEscapedLineFeeds",!1,{markdownDescription:d(722,null)})),effectiveCursorStyle:Ai(new bZt),editorClassName:Ai(new mZt),defaultColorDecorators:Ai(new Ju(167,"defaultColorDecorators","auto",["auto","always","never"],{enumDescriptions:[d(389,null),d(388,null),d(390,null)],description:d(359,null)})),pixelRatio:Ai(new AZt),tabFocusMode:Ai(new Ds(164,"tabFocusMode",!1,{markdownDescription:d(696,null)})),layoutInfo:Ai(new tje),wrappingInfo:Ai(new QZt),wrappingIndent:Ai(new jZt),wrappingStrategy:Ai(new kZt),effectiveEditContextEnabled:Ai(new SZt),effectiveAllowVariableFonts:Ai(new IZt)};var z=class a{constructor(i,e,t,o){i>t||i===t&&e>o?(this.startLineNumber=t,this.startColumn=o,this.endLineNumber=i,this.endColumn=e):(this.startLineNumber=i,this.startColumn=e,this.endLineNumber=t,this.endColumn=o)}isEmpty(){return a.isEmpty(this)}static isEmpty(i){return i.startLineNumber===i.endLineNumber&&i.startColumn===i.endColumn}containsPosition(i){return a.containsPosition(this,i)}static containsPosition(i,e){return!(e.lineNumber<i.startLineNumber||e.lineNumber>i.endLineNumber||e.lineNumber===i.startLineNumber&&e.column<i.startColumn||e.lineNumber===i.endLineNumber&&e.column>i.endColumn)}static strictContainsPosition(i,e){return!(e.lineNumber<i.startLineNumber||e.lineNumber>i.endLineNumber||e.lineNumber===i.startLineNumber&&e.column<=i.startColumn||e.lineNumber===i.endLineNumber&&e.column>=i.endColumn)}containsRange(i){return a.containsRange(this,i)}static containsRange(i,e){return!(e.startLineNumber<i.startLineNumber||e.endLineNumber<i.startLineNumber||e.startLineNumber>i.endLineNumber||e.endLineNumber>i.endLineNumber||e.startLineNumber===i.startLineNumber&&e.startColumn<i.startColumn||e.endLineNumber===i.endLineNumber&&e.endColumn>i.endColumn)}strictContainsRange(i){return a.strictContainsRange(this,i)}static strictContainsRange(i,e){return!(e.startLineNumber<i.startLineNumber||e.endLineNumber<i.startLineNumber||e.startLineNumber>i.endLineNumber||e.endLineNumber>i.endLineNumber||e.startLineNumber===i.startLineNumber&&e.startColumn<=i.startColumn||e.endLineNumber===i.endLineNumber&&e.endColumn>=i.endColumn)}plusRange(i){return a.plusRange(this,i)}static plusRange(i,e){let t,o,n,r;return e.startLineNumber<i.startLineNumber?(t=e.startLineNumber,o=e.startColumn):e.startLineNumber===i.startLineNumber?(t=e.startLineNumber,o=Math.min(e.startColumn,i.startColumn)):(t=i.startLineNumber,o=i.startColumn),e.endLineNumber>i.endLineNumber?(n=e.endLineNumber,r=e.endColumn):e.endLineNumber===i.endLineNumber?(n=e.endLineNumber,r=Math.max(e.endColumn,i.endColumn)):(n=i.endLineNumber,r=i.endColumn),new a(t,o,n,r)}intersectRanges(i){return a.intersectRanges(this,i)}static intersectRanges(i,e){let t=i.startLineNumber,o=i.startColumn,n=i.endLineNumber,r=i.endColumn,s=e.startLineNumber,l=e.startColumn,c=e.endLineNumber,u=e.endColumn;return t<s?(t=s,o=l):t===s&&(o=Math.max(o,l)),n>c?(n=c,r=u):n===c&&(r=Math.min(r,u)),t>n||t===n&&o>r?null:new a(t,o,n,r)}equalsRange(i){return a.equalsRange(this,i)}static equalsRange(i,e){return!i&&!e?!0:!!i&&!!e&&i.startLineNumber===e.startLineNumber&&i.startColumn===e.startColumn&&i.endLineNumber===e.endLineNumber&&i.endColumn===e.endColumn}getEndPosition(){return a.getEndPosition(this)}static getEndPosition(i){return new ye(i.endLineNumber,i.endColumn)}getStartPosition(){return a.getStartPosition(this)}static getStartPosition(i){return new ye(i.startLineNumber,i.startColumn)}toString(){return"["+this.startLineNumber+","+this.startColumn+" -> "+this.endLineNumber+","+this.endColumn+"]"}setEndPosition(i,e){return new a(this.startLineNumber,this.startColumn,i,e)}setStartPosition(i,e){return new a(i,e,this.endLineNumber,this.endColumn)}collapseToStart(){return a.collapseToStart(this)}static collapseToStart(i){return new a(i.startLineNumber,i.startColumn,i.startLineNumber,i.startColumn)}collapseToEnd(){return a.collapseToEnd(this)}static collapseToEnd(i){return new a(i.endLineNumber,i.endColumn,i.endLineNumber,i.endColumn)}delta(i){return new a(this.startLineNumber+i,this.startColumn,this.endLineNumber+i,this.endColumn)}isSingleLine(){return this.startLineNumber===this.endLineNumber}static fromPositions(i,e=i){return new a(i.lineNumber,i.column,e.lineNumber,e.column)}static lift(i){return i?new a(i.startLineNumber,i.startColumn,i.endLineNumber,i.endColumn):null}static isIRange(i){return!!i&&typeof i.startLineNumber=="number"&&typeof i.startColumn=="number"&&typeof i.endLineNumber=="number"&&typeof i.endColumn=="number"}static areIntersectingOrTouching(i,e){return!(i.endLineNumber<e.startLineNumber||i.endLineNumber===e.startLineNumber&&i.endColumn<e.startColumn||e.endLineNumber<i.startLineNumber||e.endLineNumber===i.startLineNumber&&e.endColumn<i.startColumn)}static areIntersecting(i,e){return!(i.endLineNumber<e.startLineNumber||i.endLineNumber===e.startLineNumber&&i.endColumn<=e.startColumn||e.endLineNumber<i.startLineNumber||e.endLineNumber===i.startLineNumber&&e.endColumn<=i.startColumn)}static areOnlyIntersecting(i,e){return!(i.endLineNumber<e.startLineNumber-1||i.endLineNumber===e.startLineNumber&&i.endColumn<e.startColumn-1||e.endLineNumber<i.startLineNumber-1||e.endLineNumber===i.startLineNumber&&e.endColumn<i.startColumn-1)}static compareRangesUsingStarts(i,e){if(i&&e){let n=i.startLineNumber|0,r=e.startLineNumber|0;if(n===r){let s=i.startColumn|0,l=e.startColumn|0;if(s===l){let c=i.endLineNumber|0,u=e.endLineNumber|0;if(c===u){let p=i.endColumn|0,h=e.endColumn|0;return p-h}return c-u}return s-l}return n-r}return(i?1:0)-(e?1:0)}static compareRangesUsingEnds(i,e){return i.endLineNumber===e.endLineNumber?i.endColumn===e.endColumn?i.startLineNumber===e.startLineNumber?i.startColumn-e.startColumn:i.startLineNumber-e.startLineNumber:i.endColumn-e.endColumn:i.endLineNumber-e.endLineNumber}static spansMultipleLines(i){return i.endLineNumber>i.startLineNumber}toJSON(){return this}};var ti=class a extends z{constructor(i,e,t,o){super(i,e,t,o),this.selectionStartLineNumber=i,this.selectionStartColumn=e,this.positionLineNumber=t,this.positionColumn=o}toString(){return"["+this.selectionStartLineNumber+","+this.selectionStartColumn+" -> "+this.positionLineNumber+","+this.positionColumn+"]"}equalsSelection(i){return a.selectionsEqual(this,i)}static selectionsEqual(i,e){return i.selectionStartLineNumber===e.selectionStartLineNumber&&i.selectionStartColumn===e.selectionStartColumn&&i.positionLineNumber===e.positionLineNumber&&i.positionColumn===e.positionColumn}getDirection(){return this.selectionStartLineNumber===this.startLineNumber&&this.selectionStartColumn===this.startColumn?0:1}setEndPosition(i,e){return this.getDirection()===0?new a(this.startLineNumber,this.startColumn,i,e):new a(i,e,this.startLineNumber,this.startColumn)}getPosition(){return new ye(this.positionLineNumber,this.positionColumn)}getSelectionStart(){return new ye(this.selectionStartLineNumber,this.selectionStartColumn)}setStartPosition(i,e){return this.getDirection()===0?new a(i,e,this.endLineNumber,this.endColumn):new a(this.endLineNumber,this.endColumn,i,e)}static fromPositions(i,e=i){return new a(i.lineNumber,i.column,e.lineNumber,e.column)}static fromRange(i,e){return e===0?new a(i.startLineNumber,i.startColumn,i.endLineNumber,i.endColumn):new a(i.endLineNumber,i.endColumn,i.startLineNumber,i.startColumn)}static liftSelection(i){return new a(i.selectionStartLineNumber,i.selectionStartColumn,i.positionLineNumber,i.positionColumn)}static selectionsArrEqual(i,e){if(i&&!e||!i&&e)return!1;if(!i&&!e)return!0;if(i.length!==e.length)return!1;for(let t=0,o=i.length;t<o;t++)if(!this.selectionsEqual(i[t],e[t]))return!1;return!0}static isISelection(i){return!!i&&typeof i.selectionStartLineNumber=="number"&&typeof i.selectionStartColumn=="number"&&typeof i.positionLineNumber=="number"&&typeof i.positionColumn=="number"}static createWithDirection(i,e,t,o,n){return n===0?new a(i,e,t,o):new a(t,o,i,e)}};var bp=class{static getLanguageId(i){return(i&255)>>>0}static getTokenType(i){return(i&768)>>>8}static containsBalancedBrackets(i){return(i&1024)!==0}static getFontStyle(i){return(i&30720)>>>11}static getForeground(i){return(i&16744448)>>>15}static getBackground(i){return(i&4278190080)>>>24}static getClassNameFromMetadata(i){let t="mtk"+this.getForeground(i),o=this.getFontStyle(i);return o&1&&(t+=" mtki"),o&2&&(t+=" mtkb"),o&4&&(t+=" mtku"),o&8&&(t+=" mtks"),t}static getInlineStyleFromMetadata(i,e){let t=this.getForeground(i),o=this.getFontStyle(i),n=`color: ${e[t]};`;o&1&&(n+="font-style: italic;"),o&2&&(n+="font-weight: bold;");let r="";return o&4&&(r+=" underline"),o&8&&(r+=" line-through"),r&&(n+=`text-decoration:${r};`),n}static getPresentationFromMetadata(i){let e=this.getForeground(i),t=this.getFontStyle(i);return{foreground:e,italic:!!(t&1),bold:!!(t&2),underline:!!(t&4),strikethrough:!!(t&8)}}};function E1(a,i){let e=a.getCount(),t=a.findTokenIndexAtOffset(i),o=a.getLanguageId(t),n=t;for(;n+1<e&&a.getLanguageId(n+1)===o;)n++;let r=t;for(;r>0&&a.getLanguageId(r-1)===o;)r--;return new ZZt(a,o,r,n+1,a.getStartOffset(r),a.getEndOffset(n))}var ZZt=class{constructor(i,e,t,o,n,r){this._scopedLineTokensBrand=void 0;this._actual=i,this.languageId=e,this._firstTokenIndex=t,this._lastTokenIndex=o,this.firstCharOffset=n,this._lastCharOffset=r,this.languageIdCodec=i.languageIdCodec}getLineContent(){return this._actual.getLineContent().substring(this.firstCharOffset,this._lastCharOffset)}getLineLength(){return this._lastCharOffset-this.firstCharOffset}getActualLineContentBefore(i){return this._actual.getLineContent().substring(0,this.firstCharOffset+i)}getTokenCount(){return this._lastTokenIndex-this._firstTokenIndex}findTokenIndexAtOffset(i){return this._actual.findTokenIndexAtOffset(i+this.firstCharOffset)-this._firstTokenIndex}getStandardTokenType(i){return this._actual.getStandardTokenType(i+this._firstTokenIndex)}toIViewLineTokens(){return this._actual.sliceAndInflate(this.firstCharOffset,this._lastCharOffset,0)}},A$i=(i=>(i[i.value=3]="value",i))(A$i||{});function mO(a){return(a&A$i.value)!==0}var fl=class a{static _nextVisibleColumn(i,e,t){return i===9?a.nextRenderTabStop(e,t):h_(i)||b$e(i)?e+2:e+1}static visibleColumnFromColumn(i,e,t){let o=Math.min(e-1,i.length),n=i.substring(0,o),r=new A$(n),s=0;for(;!r.eol();){let l=uIe(n,o,r.offset);r.nextGraphemeLength(),s=this._nextVisibleColumn(l,s,t)}return s}static toStatusbarColumn(i,e,t){let o=i.substring(0,Math.min(e-1,i.length)),n=new $se(o),r=0;for(;!n.eol();)n.nextCodePoint()===9?r=a.nextRenderTabStop(r,t):r=r+1;return r+1}static columnFromVisibleColumn(i,e,t){if(e<=0)return 1;let o=i.length,n=new A$(i),r=0,s=1;for(;!n.eol();){let l=uIe(i,o,n.offset);n.nextGraphemeLength();let c=this._nextVisibleColumn(l,r,t),u=n.offset+1;if(c>=e){let p=e-r;return c-e<p?u:s}r=c,s=u}return o+1}static nextRenderTabStop(i,e){return i+e-i%e}static nextIndentTabStop(i,e){return a.nextRenderTabStop(i,e)}static prevRenderTabStop(i,e){return Math.max(0,i-1-(i-1)%e)}static prevIndentTabStop(i,e){return a.prevRenderTabStop(i,e)}};function S0o(a,i,e){let t=0;for(let n=0;n<a.length;n++)a.charAt(n)==="	"?t=fl.nextIndentTabStop(t,i):t++;let o="";if(!e){let n=Math.floor(t/i);t=t%i;for(let r=0;r<n;r++)o+="	"}for(let n=0;n<t;n++)o+=" ";return o}function GIe(a,i,e){let t=nm(a);return t===-1&&(t=a.length),S0o(a.substring(0,t),i,e)+a.substring(t)}var eei=class{constructor(){this._inputMode="insert";this._onDidChangeInputMode=new E;this.onDidChangeInputMode=this._onDidChangeInputMode.event}getInputMode(){return this._inputMode}setInputMode(i){this._inputMode=i,this._onDidChangeInputMode.fire(this._inputMode)}},TV=new eei;var I0o=()=>!0,y0o=()=>!1,w0o=a=>a===" "||a==="	",_V=class{constructor(i,e,t,o){this.languageConfigurationService=o;this._cursorMoveConfigurationBrand=void 0;this._languageId=i;let n=t.options,r=n.get(165),s=n.get(59);this.readOnly=n.get(104),this.tabSize=e.tabSize,this.indentSize=e.indentSize,this.insertSpaces=e.insertSpaces,this.stickyTabStops=n.get(132),this.lineHeight=s.lineHeight,this.typicalHalfwidthCharacterWidth=s.typicalHalfwidthCharacterWidth,this.pageSize=Math.max(1,Math.floor(r.height/this.lineHeight)-2),this.useTabStops=n.get(145),this.trimWhitespaceOnDelete=n.get(141),this.wordSeparators=n.get(148),this.emptySelectionClipboard=n.get(45),this.copyWithSyntaxHighlighting=n.get(31),this.multiCursorMergeOverlapping=n.get(85),this.multiCursorPaste=n.get(88),this.multiCursorLimit=n.get(89),this.autoClosingBrackets=n.get(10),this.autoClosingComments=n.get(11),this.autoClosingQuotes=n.get(15),this.autoClosingDelete=n.get(13),this.autoClosingOvertype=n.get(14),this.autoSurround=n.get(20),this.autoIndent=n.get(16),this.wordSegmenterLocales=n.get(147),this.overtypeOnPaste=n.get(93),this.surroundingPairs={},this._electricChars=null,this.shouldAutoCloseBefore={quote:this._getShouldAutoClose(i,this.autoClosingQuotes,!0),comment:this._getShouldAutoClose(i,this.autoClosingComments,!1),bracket:this._getShouldAutoClose(i,this.autoClosingBrackets,!1)},this.autoClosingPairs=this.languageConfigurationService.getLanguageConfiguration(i).getAutoClosingPairs();let l=this.languageConfigurationService.getLanguageConfiguration(i).getSurroundingPairs();if(l)for(let u of l)this.surroundingPairs[u.open]=u.close;let c=this.languageConfigurationService.getLanguageConfiguration(i).comments;this.blockCommentStartToken=c?.blockCommentStartToken??null}static shouldRecreate(i){return i.hasChanged(165)||i.hasChanged(148)||i.hasChanged(45)||i.hasChanged(85)||i.hasChanged(88)||i.hasChanged(89)||i.hasChanged(10)||i.hasChanged(11)||i.hasChanged(15)||i.hasChanged(13)||i.hasChanged(14)||i.hasChanged(20)||i.hasChanged(145)||i.hasChanged(141)||i.hasChanged(59)||i.hasChanged(104)||i.hasChanged(147)||i.hasChanged(93)}get electricChars(){if(!this._electricChars){this._electricChars={};let i=this.languageConfigurationService.getLanguageConfiguration(this._languageId).electricCharacter?.getElectricCharacters();if(i)for(let e of i)this._electricChars[e]=!0}return this._electricChars}get inputMode(){return TV.getInputMode()}onElectricCharacter(i,e,t){let o=E1(e,t-1),n=this.languageConfigurationService.getLanguageConfiguration(o.languageId).electricCharacter;return n?n.onElectricCharacter(i,o,t-o.firstCharOffset):null}normalizeIndentation(i){return GIe(i,this.indentSize,this.insertSpaces)}_getShouldAutoClose(i,e,t){switch(e){case"beforeWhitespace":return w0o;case"languageDefined":return this._getLanguageDefinedShouldAutoClose(i,t);case"always":return I0o;case"never":return y0o}}_getLanguageDefinedShouldAutoClose(i,e){let t=this.languageConfigurationService.getLanguageConfiguration(i).getAutoCloseBeforeSet(e);return o=>t.indexOf(o)!==-1}visibleColumnFromColumn(i,e){return fl.visibleColumnFromColumn(i.getLineContent(e.lineNumber),e.column,this.tabSize)}columnFromVisibleColumn(i,e,t){let o=fl.columnFromVisibleColumn(i.getLineContent(e),t,this.tabSize),n=i.getLineMinColumn(e);if(o<n)return n;let r=i.getLineMaxColumn(e);return o>r?r:o}},js=class a{constructor(i,e){this._cursorStateBrand=void 0;this.modelState=i,this.viewState=e}static fromModelState(i){return new tei(i)}static fromViewState(i){return new iei(i)}static fromModelSelection(i){let e=ti.liftSelection(i),t=new vv(z.fromPositions(e.getSelectionStart()),0,0,e.getPosition(),0);return a.fromModelState(t)}static fromModelSelections(i){let e=[];for(let t=0,o=i.length;t<o;t++)e[t]=this.fromModelSelection(i[t]);return e}equals(i){return this.viewState.equals(i.viewState)&&this.modelState.equals(i.modelState)}},tei=class{constructor(i){this.modelState=i,this.viewState=null}},iei=class{constructor(i){this.modelState=null,this.viewState=i}};var vv=class a{constructor(i,e,t,o,n){this.selectionStart=i;this.selectionStartKind=e;this.selectionStartLeftoverVisibleColumns=t;this.position=o;this.leftoverVisibleColumns=n;this._singleCursorStateBrand=void 0;this.selection=a._computeSelection(this.selectionStart,this.position)}equals(i){return this.selectionStartLeftoverVisibleColumns===i.selectionStartLeftoverVisibleColumns&&this.leftoverVisibleColumns===i.leftoverVisibleColumns&&this.selectionStartKind===i.selectionStartKind&&this.position.equals(i.position)&&this.selectionStart.equalsRange(i.selectionStart)}hasSelection(){return!this.selection.isEmpty()||!this.selectionStart.isEmpty()}move(i,e,t,o){return i?new a(this.selectionStart,this.selectionStartKind,this.selectionStartLeftoverVisibleColumns,new ye(e,t),o):new a(new z(e,t,e,t),0,o,new ye(e,t),o)}static _computeSelection(i,e){return i.isEmpty()||!e.isBeforeOrEqual(i.getStartPosition())?ti.fromPositions(i.getStartPosition(),e):ti.fromPositions(i.getEndPosition(),e)}},ab=class{constructor(i,e,t){this._editOperationResultBrand=void 0;this.type=i,this.commands=e,this.shouldPushStackElementBefore=t.shouldPushStackElementBefore,this.shouldPushStackElementAfter=t.shouldPushStackElementAfter}};function DV(a){return a==="'"||a==='"'||a==="`"}var a7=class a{static columnSelect(i,e,t,o,n,r){let s=Math.abs(n-t)+1,l=t>n,c=o>r,u=o<r,p=[];for(let h=0;h<s;h++){let g=t+(l?-h:h),f=i.columnFromVisibleColumn(e,g,o),v=i.columnFromVisibleColumn(e,g,r),b=i.visibleColumnFromColumn(e,new ye(g,f)),S=i.visibleColumnFromColumn(e,new ye(g,v));u&&(b>r||S<o)||c&&(S>o||b<r)||p.push(new vv(new z(g,f,g,f),0,0,new ye(g,v),0))}if(p.length===0)for(let h=0;h<s;h++){let g=t+(l?-h:h),f=e.getLineMaxColumn(g);p.push(new vv(new z(g,f,g,f),0,0,new ye(g,f),0))}return{viewStates:p,reversed:l,fromLineNumber:t,fromVisualColumn:o,toLineNumber:n,toVisualColumn:r}}static columnSelectLeft(i,e,t){let o=t.toViewVisualColumn;return o>0&&o--,a.columnSelect(i,e,t.fromViewLineNumber,t.fromViewVisualColumn,t.toViewLineNumber,o)}static columnSelectRight(i,e,t){let o=0,n=Math.min(t.fromViewLineNumber,t.toViewLineNumber),r=Math.max(t.fromViewLineNumber,t.toViewLineNumber);for(let l=n;l<=r;l++){let c=e.getLineMaxColumn(l),u=i.visibleColumnFromColumn(e,new ye(l,c));o=Math.max(o,u)}let s=t.toViewVisualColumn;return s<o&&s++,this.columnSelect(i,e,t.fromViewLineNumber,t.fromViewVisualColumn,t.toViewLineNumber,s)}static columnSelectUp(i,e,t,o){let n=o?i.pageSize:1,r=Math.max(1,t.toViewLineNumber-n);return this.columnSelect(i,e,t.fromViewLineNumber,t.fromViewVisualColumn,r,t.toViewVisualColumn)}static columnSelectDown(i,e,t,o){let n=o?i.pageSize:1,r=Math.min(e.getLineCount(),t.toViewLineNumber+n);return this.columnSelect(i,e,t.fromViewLineNumber,t.fromViewVisualColumn,r,t.toViewVisualColumn)}};var qh=class{constructor(i,e,t=!1){this._range=i,this._text=e,this.insertsAutoWhitespace=t}getEditOperations(i,e){e.addTrackedEditOperation(this._range,this._text)}computeCursorState(i,e){let o=e.getInverseEditOperations()[0].range;return ti.fromPositions(o.getEndPosition())}},qIe=class{constructor(i,e,t=!1){this._range=i,this._text=e,this.insertsAutoWhitespace=t}getEditOperations(i,e){let t=this._range.getStartPosition(),o=this._range.getEndPosition(),n=o.lineNumber,r=this._text.length+(this._range.isEmpty()?0:-1),s=N$i(i,o,r);s.lineNumber>n&&(s=new ye(n,i.getLineMaxColumn(n)));let l=z.fromPositions(t,s);e.addTrackedEditOperation(l,this._text)}computeCursorState(i,e){let o=e.getInverseEditOperations()[0].range;return ti.fromPositions(o.getEndPosition())}},ift=class{constructor(i,e){this._range=i,this._text=e}getEditOperations(i,e){e.addTrackedEditOperation(this._range,this._text)}computeCursorState(i,e){let o=e.getInverseEditOperations()[0].range;return ti.fromRange(o,0)}},Eae=class{constructor(i,e,t=!1){this._range=i,this._text=e,this.insertsAutoWhitespace=t}getEditOperations(i,e){e.addTrackedEditOperation(this._range,this._text)}computeCursorState(i,e){let o=e.getInverseEditOperations()[0].range;return ti.fromPositions(o.getStartPosition())}},Tae=class{constructor(i,e,t,o,n=!1){this._range=i,this._text=e,this._columnDeltaOffset=o,this._lineNumberDeltaOffset=t,this.insertsAutoWhitespace=n}getEditOperations(i,e){e.addTrackedEditOperation(this._range,this._text)}computeCursorState(i,e){let o=e.getInverseEditOperations()[0].range;return ti.fromPositions(o.getEndPosition().delta(this._lineNumberDeltaOffset,this._columnDeltaOffset))}},oft=class{constructor(i){this._range=i}getEditOperations(i,e){let t=i.getValueInRange(this._range),o=this._range.getEndPosition(),n=o.lineNumber,r=N$i(i,o,t.length);r.lineNumber>n&&(r=new ye(n,i.getLineMaxColumn(n)));let s=z.fromPositions(o,r);e.addTrackedEditOperation(s,"")}computeCursorState(i,e){let o=e.getInverseEditOperations()[0].range;return ti.fromPositions(o.getEndPosition())}},l7=class{constructor(i,e,t,o=!1){this._range=i,this._text=e,this._initialSelection=t,this._forceMoveMarkers=o,this._selectionId=null}getEditOperations(i,e){e.addTrackedEditOperation(this._range,this._text,this._forceMoveMarkers),this._selectionId=e.trackSelection(this._initialSelection)}computeCursorState(i,e){return e.getTrackedSelection(this._selectionId)}};function N$i(a,i,e){if(e<0)throw new Error("Unexpected negative delta");let t=a.getLineCount(),o=new ye(t,a.getLineMaxColumn(t));for(let n=i.lineNumber;n<=t;n++)if(n===i.lineNumber){let r=e-a.getLineMaxColumn(i.lineNumber)+i.column;if(r<=0){o=new ye(i.lineNumber,i.column+e);break}e=r}else{let r=e-a.getLineMaxColumn(n);if(r<=0){o=new ye(n,e);break}e=r}return o}var _ae=class a{static whitespaceVisibleColumn(i,e,t){let o=i.length,n=0,r=-1,s=-1;for(let l=0;l<o;l++){if(l===e)return[r,s,n];switch(n%t===0&&(r=l,s=n),i.charCodeAt(l)){case 32:n+=1;break;case 9:n=fl.nextRenderTabStop(n,t);break;default:return[-1,-1,-1]}}return e===o?[r,s,n]:[-1,-1,-1]}static atomicPosition(i,e,t,o){let n=i.length,[r,s,l]=a.whitespaceVisibleColumn(i,e,t);if(l===-1)return-1;let c;switch(o){case 0:c=!0;break;case 1:c=!1;break;case 2:if(l%t===0)return e;c=l%t<=t/2;break}if(c){if(r===-1)return-1;let h=s;for(let g=r;g<n;++g){if(h===s+t)return r;switch(i.charCodeAt(g)){case 32:h+=1;break;case 9:h=fl.nextRenderTabStop(h,t);break;default:return-1}}return h===s+t?r:-1}let u=fl.nextRenderTabStop(l,t),p=l;for(let h=e;h<n;h++){if(p===u)return h;switch(i.charCodeAt(h)){case 32:p+=1;break;case 9:p=fl.nextRenderTabStop(p,t);break;default:return-1}}return p===u?n:-1}};var $Ie=class{constructor(i){this._textModelResolvedOptionsBrand=void 0;this.tabSize=Math.max(1,i.tabSize|0),i.indentSize==="tabSize"?(this.indentSize=this.tabSize,this._indentSizeIsTabSize=!0):(this.indentSize=Math.max(1,i.indentSize|0),this._indentSizeIsTabSize=!1),this.insertSpaces=!!i.insertSpaces,this.defaultEOL=i.defaultEOL|0,this.trimAutoWhitespace=!!i.trimAutoWhitespace,this.bracketPairColorizationOptions=i.bracketPairColorizationOptions}get originalIndentSize(){return this._indentSizeIsTabSize?"tabSize":this.indentSize}equals(i){return this.tabSize===i.tabSize&&this._indentSizeIsTabSize===i._indentSizeIsTabSize&&this.indentSize===i.indentSize&&this.insertSpaces===i.insertSpaces&&this.defaultEOL===i.defaultEOL&&this.trimAutoWhitespace===i.trimAutoWhitespace&&eo(this.bracketPairColorizationOptions,i.bracketPairColorizationOptions)}createChangeEvent(i){return{tabSize:this.tabSize!==i.tabSize,indentSize:this.indentSize!==i.indentSize,insertSpaces:this.insertSpaces!==i.insertSpaces,trimAutoWhitespace:this.trimAutoWhitespace!==i.trimAutoWhitespace}}},T1=class{constructor(i,e){this._findMatchBrand=void 0;this.range=i,this.matches=e}};function O$i(a){return!!a&&typeof a.read=="function"}function d7(a){return!!(a&&a.uri)}var c7=class{constructor(i,e,t,o,n,r){this.identifier=i;this.range=e;this.text=t;this.forceMoveMarkers=o;this.isAutoWhitespaceEdit=n;this._isTracked=r}},nft=class{constructor(i,e,t){this.regex=i,this.wordSeparators=e,this.simpleSearch=t}},rft=class{constructor(i,e,t){this.reverseEdits=i;this.changes=e;this.trimAutoWhitespaceLineNumbers=t}};function Hx(a){return!a.isTooLargeForSyncing()&&!a.isForSimpleWidget}var ije=class{constructor(i,e,t){this._cursorPositionBrand=void 0;this.lineNumber=i,this.column=e,this.leftoverVisibleColumns=t}},Mu=class a{static leftPosition(i,e){if(e.column>i.getLineMinColumn(e.lineNumber))return e.delta(void 0,-zXt(i.getLineContent(e.lineNumber),e.column-1));if(e.lineNumber>1){let t=e.lineNumber-1;return new ye(t,i.getLineMaxColumn(t))}else return e}static leftPositionAtomicSoftTabs(i,e,t){if(e.column<=i.getLineIndentColumn(e.lineNumber)){let o=i.getLineMinColumn(e.lineNumber),n=i.getLineContent(e.lineNumber),r=_ae.atomicPosition(n,e.column-1,t,0);if(r!==-1&&r+1>=o)return new ye(e.lineNumber,r+1)}return this.leftPosition(i,e)}static left(i,e,t){let o=i.stickyTabStops?a.leftPositionAtomicSoftTabs(e,t,i.tabSize):a.leftPosition(e,t);return new ije(o.lineNumber,o.column,0)}static moveLeft(i,e,t,o,n){let r,s;if(t.hasSelection()&&!o)r=t.selection.startLineNumber,s=t.selection.startColumn;else{let l=t.position.delta(void 0,-(n-1)),c=e.normalizePosition(a.clipPositionColumn(l,e),0),u=a.left(i,e,c);r=u.lineNumber,s=u.column}return t.move(o,r,s,0)}static clipPositionColumn(i,e){return new ye(i.lineNumber,a.clipRange(i.column,e.getLineMinColumn(i.lineNumber),e.getLineMaxColumn(i.lineNumber)))}static clipRange(i,e,t){return i<e?e:i>t?t:i}static rightPosition(i,e,t){return t<i.getLineMaxColumn(e)?t=t+pIe(i.getLineContent(e),t-1):e<i.getLineCount()&&(e=e+1,t=i.getLineMinColumn(e)),new ye(e,t)}static rightPositionAtomicSoftTabs(i,e,t,o,n){if(t<i.getLineIndentColumn(e)){let r=i.getLineContent(e),s=_ae.atomicPosition(r,t-1,o,1);if(s!==-1)return new ye(e,s+1)}return this.rightPosition(i,e,t)}static right(i,e,t){let o=i.stickyTabStops?a.rightPositionAtomicSoftTabs(e,t.lineNumber,t.column,i.tabSize,i.indentSize):a.rightPosition(e,t.lineNumber,t.column);return new ije(o.lineNumber,o.column,0)}static moveRight(i,e,t,o,n){let r,s;if(t.hasSelection()&&!o)r=t.selection.endLineNumber,s=t.selection.endColumn;else{let l=t.position.delta(void 0,n-1),c=e.normalizePosition(a.clipPositionColumn(l,e),1),u=a.right(i,e,c);r=u.lineNumber,s=u.column}return t.move(o,r,s,0)}static vertical(i,e,t,o,n,r,s,l){let c=fl.visibleColumnFromColumn(e.getLineContent(t),o,i.tabSize)+n,u=e.getLineCount(),p=t===1&&o===1,h=t===u&&o===e.getLineMaxColumn(t),g=r<t?p:h;if(t=r,t<1?(t=1,s?o=e.getLineMinColumn(t):o=Math.min(e.getLineMaxColumn(t),o)):t>u?(t=u,s?o=e.getLineMaxColumn(t):o=Math.min(e.getLineMaxColumn(t),o)):o=i.columnFromVisibleColumn(e,t,c),g?n=0:n=c-fl.visibleColumnFromColumn(e.getLineContent(t),o,i.tabSize),l!==void 0){let f=new ye(t,o),v=e.normalizePosition(f,l);n=n+(o-v.column),t=v.lineNumber,o=v.column}return new ije(t,o,n)}static down(i,e,t,o,n,r,s){return this.vertical(i,e,t,o,n,t+r,s,4)}static moveDown(i,e,t,o,n){let r,s;t.hasSelection()&&!o?(r=t.selection.endLineNumber,s=t.selection.endColumn):(r=t.position.lineNumber,s=t.position.column);let l=0,c;do if(c=a.down(i,e,r+l,s,t.leftoverVisibleColumns,n,!0),e.normalizePosition(new ye(c.lineNumber,c.column),2).lineNumber>r)break;while(l++<10&&r+l<e.getLineCount());return t.move(o,c.lineNumber,c.column,c.leftoverVisibleColumns)}static translateDown(i,e,t){let o=t.selection,n=a.down(i,e,o.selectionStartLineNumber,o.selectionStartColumn,t.selectionStartLeftoverVisibleColumns,1,!1),r=a.down(i,e,o.positionLineNumber,o.positionColumn,t.leftoverVisibleColumns,1,!1);return new vv(new z(n.lineNumber,n.column,n.lineNumber,n.column),0,n.leftoverVisibleColumns,new ye(r.lineNumber,r.column),r.leftoverVisibleColumns)}static up(i,e,t,o,n,r,s){return this.vertical(i,e,t,o,n,t-r,s,3)}static moveUp(i,e,t,o,n){let r,s;t.hasSelection()&&!o?(r=t.selection.startLineNumber,s=t.selection.startColumn):(r=t.position.lineNumber,s=t.position.column);let l=a.up(i,e,r,s,t.leftoverVisibleColumns,n,!0);return t.move(o,l.lineNumber,l.column,l.leftoverVisibleColumns)}static translateUp(i,e,t){let o=t.selection,n=a.up(i,e,o.selectionStartLineNumber,o.selectionStartColumn,t.selectionStartLeftoverVisibleColumns,1,!1),r=a.up(i,e,o.positionLineNumber,o.positionColumn,t.leftoverVisibleColumns,1,!1);return new vv(new z(n.lineNumber,n.column,n.lineNumber,n.column),0,n.leftoverVisibleColumns,new ye(r.lineNumber,r.column),r.leftoverVisibleColumns)}static _isBlankLine(i,e){return i.getLineFirstNonWhitespaceColumn(e)===0}static moveToPrevBlankLine(i,e,t,o){let n=t.position.lineNumber;for(;n>1&&this._isBlankLine(e,n);)n--;for(;n>1&&!this._isBlankLine(e,n);)n--;return t.move(o,n,e.getLineMinColumn(n),0)}static moveToNextBlankLine(i,e,t,o){let n=e.getLineCount(),r=t.position.lineNumber;for(;r<n&&this._isBlankLine(e,r);)r++;for(;r<n&&!this._isBlankLine(e,r);)r++;return t.move(o,r,e.getLineMinColumn(r),0)}static moveToBeginningOfLine(i,e,t,o){let n=t.position.lineNumber,r=e.getLineMinColumn(n),s=e.getLineFirstNonWhitespaceColumn(n)||r,l;return t.position.column===s?l=r:l=s,t.move(o,n,l,0)}static moveToEndOfLine(i,e,t,o,n){let r=t.position.lineNumber,s=e.getLineMaxColumn(r);return t.move(o,r,s,n?1073741824-s:0)}static moveToBeginningOfBuffer(i,e,t,o){return t.move(o,1,1,0)}static moveToEndOfBuffer(i,e,t,o){let n=e.getLineCount(),r=e.getLineMaxColumn(n);return t.move(o,n,r,0)}};var gO=class a{static deleteRight(i,e,t,o){let n=[],r=i!==3;for(let s=0,l=o.length;s<l;s++){let c=o[s],u=this.getDeleteRightRange(c,t,e);if(u.isEmpty()){n[s]=null;continue}u.startLineNumber!==u.endLineNumber&&(r=!0),n[s]=new qh(u,"")}return[r,n]}static getDeleteRightRange(i,e,t){if(!i.isEmpty())return i;let o=i.getPosition(),n=Mu.right(t,e,o);if(t.trimWhitespaceOnDelete&&n.lineNumber!==o.lineNumber){let r=e.getLineFirstNonWhitespaceColumn(o.lineNumber)>0,s=e.getLineFirstNonWhitespaceColumn(n.lineNumber);if(r&&s>0)return new z(n.lineNumber,s,o.lineNumber,o.column)}return new z(n.lineNumber,n.column,o.lineNumber,o.column)}static isAutoClosingPairDelete(i,e,t,o,n,r,s){if(e==="never"&&t==="never"||i==="never")return!1;for(let l=0,c=r.length;l<c;l++){let u=r[l],p=u.getPosition();if(!u.isEmpty())return!1;let h=n.getLineContent(p.lineNumber);if(p.column<2||p.column>=h.length+1)return!1;let g=h.charAt(p.column-2),f=o.get(g);if(!f)return!1;if(DV(g)){if(t==="never")return!1}else if(e==="never")return!1;let v=h.charAt(p.column-1),b=!1;for(let S of f)S.open===g&&S.close===v&&(b=!0);if(!b)return!1;if(i==="auto"){let S=!1;for(let y=0,w=s.length;y<w;y++){let k=s[y];if(p.lineNumber===k.startLineNumber&&p.column===k.startColumn){S=!0;break}}if(!S)return!1}}return!0}static _runAutoClosingPairDelete(i,e,t){let o=[];for(let n=0,r=t.length;n<r;n++){let s=t[n].getPosition(),l=new z(s.lineNumber,s.column-1,s.lineNumber,s.column+1);o[n]=new qh(l,"")}return[!0,o]}static deleteLeft(i,e,t,o,n){if(this.isAutoClosingPairDelete(e.autoClosingDelete,e.autoClosingBrackets,e.autoClosingQuotes,e.autoClosingPairs.autoClosingPairsOpenByEnd,t,o,n))return this._runAutoClosingPairDelete(e,t,o);let r=[],s=i!==2;for(let l=0,c=o.length;l<c;l++){let u=a.getDeleteLeftRange(o[l],t,e);if(u.isEmpty()){r[l]=null;continue}u.startLineNumber!==u.endLineNumber&&(s=!0),r[l]=new qh(u,"")}return[s,r]}static getDeleteLeftRange(i,e,t){if(!i.isEmpty())return i;let o=i.getPosition();if(t.useTabStops&&o.column>1){let n=e.getLineContent(o.lineNumber),r=nm(n),s=r===-1?n.length+1:r+1;if(o.column<=s){let l=t.visibleColumnFromColumn(e,o),c=fl.prevIndentTabStop(l,t.indentSize),u=t.columnFromVisibleColumn(e,o.lineNumber,c);return new z(o.lineNumber,u,o.lineNumber,o.column)}}return z.fromPositions(a.getPositionAfterDeleteLeft(o,e),o)}static getPositionAfterDeleteLeft(i,e){if(i.column>1){let t=PGi(i.column-1,e.getLineContent(i.lineNumber));return i.with(void 0,t+1)}else if(i.lineNumber>1){let t=i.lineNumber-1;return new ye(t,e.getLineMaxColumn(t))}else return i}static cut(i,e,t){let o=[],n=null;t.sort((r,s)=>ye.compare(r.getStartPosition(),s.getEndPosition()));for(let r=0,s=t.length;r<s;r++){let l=t[r];if(l.isEmpty())if(i.emptySelectionClipboard){let c=l.getPosition(),u,p,h,g;c.lineNumber<e.getLineCount()?(u=c.lineNumber,p=1,h=c.lineNumber+1,g=1):c.lineNumber>1&&n?.endLineNumber!==c.lineNumber?(u=c.lineNumber-1,p=e.getLineMaxColumn(c.lineNumber-1),h=c.lineNumber,g=e.getLineMaxColumn(c.lineNumber)):(u=c.lineNumber,p=1,h=c.lineNumber,g=e.getLineMaxColumn(c.lineNumber));let f=new z(u,p,h,g);n=f,f.isEmpty()?o[r]=null:o[r]=new qh(f,"")}else o[r]=null;else o[r]=new qh(l,"")}return new ab(0,o,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!0})}};var jIe=60,QIe=jIe*60,Dae=QIe*24,W$i=Dae*7,V$i=Dae*30,B$i=Dae*365;function ea(a,i,e,t){if(typeof a>"u")return d(85,null);typeof a!="number"&&(a=a.getTime());let o=Math.round((new Date().getTime()-a)/1e3);if(o<-30)return d(59,null,ea(new Date().getTime()+o*1e3,!1));if(!t&&o<30)return d(76,null);let n;return o<jIe?(n=o,i?n===1?e?d(83,null,n):d(82,null,n):e?d(79,null,n):d(78,null,n):n===1?e?d(84,null,n):d(81,null,n):e?d(80,null,n):d(77,null,n)):o<QIe?(n=Math.round(o/jIe),i?n===1?e?d(66,null,n):d(65,null,n):e?d(62,null,n):d(61,null,n):n===1?e?d(67,null,n):d(64,null,n):e?d(63,null,n):d(60,null,n)):o<Dae?(n=Math.round(o/QIe),i?n===1?e?d(57,null,n):d(56,null,n):e?d(53,null,n):d(52,null,n):n===1?e?d(58,null,n):d(55,null,n):e?d(54,null,n):d(51,null,n)):o<W$i?(n=Math.round(o/Dae),i?n===1?d(50,null,n):d(48,null,n):n===1?d(49,null,n):d(47,null,n)):o<V$i?(n=Math.round(o/W$i),i?n===1?e?d(92,null,n):d(91,null,n):e?d(88,null,n):d(87,null,n):n===1?e?d(93,null,n):d(90,null,n):e?d(89,null,n):d(86,null,n)):o<B$i?(n=Math.round(o/V$i),i?n===1?e?d(74,null,n):d(73,null,n):e?d(70,null,n):d(69,null,n):n===1?e?d(75,null,n):d(72,null,n):e?d(71,null,n):d(68,null,n)):(n=Math.round(o/B$i),i?n===1?e?d(100,null,n):d(99,null,n):e?d(96,null,n):d(95,null,n):n===1?e?d(101,null,n):d(98,null,n):e?d(97,null,n):d(94,null,n))}function u7(a,i){let e=Math.abs(a/1e3);return e<1?i?d(108,null,a):d(107,null,a):e<jIe?i?d(110,null,Math.round(a)/1e3):d(109,null,Math.round(a)/1e3):e<QIe?i?d(106,null,Math.round(a/(1e3*jIe))):d(105,null,Math.round(a/(1e3*jIe))):e<Dae?i?d(104,null,Math.round(a/(1e3*QIe))):d(103,null,Math.round(a/(1e3*QIe))):d(102,null,Math.round(a/(1e3*Dae)))}function aft(a){return a.getFullYear()+"-"+String(a.getMonth()+1).padStart(2,"0")+"-"+String(a.getDate()).padStart(2,"0")+"T"+String(a.getHours()).padStart(2,"0")+":"+String(a.getMinutes()).padStart(2,"0")+":"+String(a.getSeconds()).padStart(2,"0")+"."+(a.getMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"}var Jc={DateTimeFormat(a,i){return new co(()=>{try{return new Intl.DateTimeFormat(a,i)}catch{return new Intl.DateTimeFormat(void 0,i)}})},Collator(a,i){return new co(()=>{try{return new Intl.Collator(a,i)}catch{return new Intl.Collator(void 0,i)}})},Segmenter(a,i){return new co(()=>{try{return new Intl.Segmenter(a,i)}catch{return new Intl.Segmenter(void 0,i)}})},Locale(a,i){return new co(()=>{try{return new Intl.Locale(a,i)}catch{return new Intl.Locale(l1,i)}})},NumberFormat(a,i){return new co(()=>{try{return new Intl.NumberFormat(a,i)}catch{return new Intl.NumberFormat(void 0,i)}})}};var J$=class a{constructor(i){let e=Gse(i);this._defaultValue=e,this._asciiMap=a._createAsciiMap(e),this._map=new Map}static _createAsciiMap(i){let e=new Uint8Array(256);return e.fill(i),e}set(i,e){let t=Gse(e);i>=0&&i<256?this._asciiMap[i]=t:this._map.set(i,t)}get(i){return i>=0&&i<256?this._asciiMap[i]:this._map.get(i)||this._defaultValue}clear(){this._asciiMap.fill(this._defaultValue),this._map.clear()}};var Z$=class{constructor(){this._actual=new J$(0)}add(i){this._actual.set(i,1)}has(i){return this._actual.get(i)===1}clear(){return this._actual.clear()}};var oei=class extends J${constructor(e,t){super(0);this._segmenter=null;this._cachedLine=null;this._cachedSegments=[];this.intlSegmenterLocales=t,this.intlSegmenterLocales.length>0?this._segmenter=Jc.Segmenter(this.intlSegmenterLocales,{granularity:"word"}):this._segmenter=null;for(let o=0,n=e.length;o<n;o++)this.set(e.charCodeAt(o),2);this.set(32,1),this.set(9,1)}findPrevIntlWordBeforeOrAtOffset(e,t){let o=null;for(let n of this._getIntlSegmenterWordsOnLine(e)){if(n.index>t)break;o=n}return o}findNextIntlWordAtOrAfterOffset(e,t){for(let o of this._getIntlSegmenterWordsOnLine(e))if(!(o.index<t))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 t=[];for(let o of e)this._isWordLike(o)&&t.push(o);return t}_isWordLike(e){return!!e.isWordLike}},H$i=new dl(10);function wC(a,i){let e=`${a}/${i.join(",")}`,t=H$i.get(e);return t||(t=new oei(a,i),H$i.set(e,t)),t}var Hf=class a{static _createWord(i,e,t,o,n){return{start:o,end:n,wordType:e,nextCharClass:t}}static _createIntlWord(i,e){return{start:i.index,end:i.index+i.segment.length,wordType:1,nextCharClass:e}}static _findPreviousWordOnLine(i,e,t){let o=e.getLineContent(t.lineNumber);return this._doFindPreviousWordOnLine(o,i,t)}static _doFindPreviousWordOnLine(i,e,t){let o=0,n=e.findPrevIntlWordBeforeOrAtOffset(i,t.column-2);for(let r=t.column-2;r>=0;r--){let s=i.charCodeAt(r),l=e.get(s);if(n&&r===n.index)return this._createIntlWord(n,l);if(l===0){if(o===2)return this._createWord(i,o,l,r+1,this._findEndOfWord(i,e,o,r+1));o=1}else if(l===2){if(o===1)return this._createWord(i,o,l,r+1,this._findEndOfWord(i,e,o,r+1));o=2}else if(l===1&&o!==0)return this._createWord(i,o,l,r+1,this._findEndOfWord(i,e,o,r+1))}return o!==0?this._createWord(i,o,1,0,this._findEndOfWord(i,e,o,0)):null}static _findEndOfWord(i,e,t,o){let n=e.findNextIntlWordAtOrAfterOffset(i,o),r=i.length;for(let s=o;s<r;s++){let l=i.charCodeAt(s),c=e.get(l);if(n&&s===n.index+n.segment.length||c===1||t===1&&c===2||t===2&&c===0)return s}return r}static _findNextWordOnLine(i,e,t){let o=e.getLineContent(t.lineNumber);return this._doFindNextWordOnLine(o,i,t)}static _doFindNextWordOnLine(i,e,t){let o=0,n=i.length,r=e.findNextIntlWordAtOrAfterOffset(i,t.column-1);for(let s=t.column-1;s<n;s++){let l=i.charCodeAt(s),c=e.get(l);if(r&&s===r.index)return this._createIntlWord(r,c);if(c===0){if(o===2)return this._createWord(i,o,c,this._findStartOfWord(i,e,o,s-1),s);o=1}else if(c===2){if(o===1)return this._createWord(i,o,c,this._findStartOfWord(i,e,o,s-1),s);o=2}else if(c===1&&o!==0)return this._createWord(i,o,c,this._findStartOfWord(i,e,o,s-1),s)}return o!==0?this._createWord(i,o,1,this._findStartOfWord(i,e,o,n-1),n):null}static _findStartOfWord(i,e,t,o){let n=e.findPrevIntlWordBeforeOrAtOffset(i,o);for(let r=o;r>=0;r--){let s=i.charCodeAt(r),l=e.get(s);if(n&&r===n.index)return r;if(l===1||t===1&&l===2||t===2&&l===0)return r+1}return 0}static moveWordLeft(i,e,t,o,n){let r=t.lineNumber,s=t.column;s===1&&r>1&&(r=r-1,s=e.getLineMaxColumn(r));let l=a._findPreviousWordOnLine(i,e,new ye(r,s));if(o===0)return new ye(r,l?l.start+1:1);if(o===1)return!n&&l&&l.wordType===2&&l.end-l.start===1&&l.nextCharClass===0&&(l=a._findPreviousWordOnLine(i,e,new ye(r,l.start+1))),new ye(r,l?l.start+1:1);if(o===3){for(;l&&l.wordType===2;)l=a._findPreviousWordOnLine(i,e,new ye(r,l.start+1));return new ye(r,l?l.start+1:1)}return l&&s<=l.end+1&&(l=a._findPreviousWordOnLine(i,e,new ye(r,l.start+1))),new ye(r,l?l.end+1:1)}static _moveWordPartLeft(i,e){let t=e.lineNumber,o=i.getLineMaxColumn(t);if(e.column===1)return t>1?new ye(t-1,i.getLineMaxColumn(t-1)):e;let n=i.getLineContent(t);for(let r=e.column-1;r>1;r--){let s=n.charCodeAt(r-2),l=n.charCodeAt(r-1);if(s===95&&l!==95)return new ye(t,r);if(s===45&&l!==45)return new ye(t,r);if((h1(s)||v$e(s))&&pE(l))return new ye(t,r);if(pE(s)&&pE(l)&&r+1<o){let c=n.charCodeAt(r);if(h1(c)||v$e(c))return new ye(t,r)}}return new ye(t,1)}static moveWordRight(i,e,t,o){let n=t.lineNumber,r=t.column,s=!1;r===e.getLineMaxColumn(n)&&n<e.getLineCount()&&(s=!0,n=n+1,r=1);let l=a._findNextWordOnLine(i,e,new ye(n,r));if(o===2)l&&l.wordType===2&&l.end-l.start===1&&l.nextCharClass===0&&(l=a._findNextWordOnLine(i,e,new ye(n,l.end+1))),l?r=l.end+1:r=e.getLineMaxColumn(n);else if(o===3){for(s&&(r=0);l&&(l.wordType===2||l.start+1<=r);)l=a._findNextWordOnLine(i,e,new ye(n,l.end+1));l?r=l.start+1:r=e.getLineMaxColumn(n)}else l&&!s&&r>=l.start+1&&(l=a._findNextWordOnLine(i,e,new ye(n,l.end+1))),l?r=l.start+1:r=e.getLineMaxColumn(n);return new ye(n,r)}static _moveWordPartRight(i,e){let t=e.lineNumber,o=i.getLineMaxColumn(t);if(e.column===o)return t<i.getLineCount()?new ye(t+1,1):e;let n=i.getLineContent(t);for(let r=e.column+1;r<o;r++){let s=n.charCodeAt(r-2),l=n.charCodeAt(r-1);if(s!==95&&l===95)return new ye(t,r);if(s!==45&&l===45)return new ye(t,r);if((h1(s)||v$e(s))&&pE(l))return new ye(t,r);if(pE(s)&&pE(l)&&r+1<o){let c=n.charCodeAt(r);if(h1(c)||v$e(c))return new ye(t,r)}}return new ye(t,o)}static _deleteWordLeftWhitespace(i,e){let t=i.getLineContent(e.lineNumber),o=e.column-2,n=hv(t,o);return n+1<o?new z(e.lineNumber,n+2,e.lineNumber,e.column):null}static deleteWordLeft(i,e){let t=i.wordSeparators,o=i.model,n=i.selection,r=i.whitespaceHeuristics;if(!n.isEmpty())return n;if(gO.isAutoClosingPairDelete(i.autoClosingDelete,i.autoClosingBrackets,i.autoClosingQuotes,i.autoClosingPairs.autoClosingPairsOpenByEnd,i.model,[i.selection],i.autoClosedCharacters)){let p=i.selection.getPosition();return new z(p.lineNumber,p.column-1,p.lineNumber,p.column+1)}let s=new ye(n.positionLineNumber,n.positionColumn),l=s.lineNumber,c=s.column;if(l===1&&c===1)return null;if(r){let p=this._deleteWordLeftWhitespace(o,s);if(p)return p}let u=a._findPreviousWordOnLine(t,o,s);return e===0?u?c=u.start+1:c>1?c=1:(l--,c=o.getLineMaxColumn(l)):(u&&c<=u.end+1&&(u=a._findPreviousWordOnLine(t,o,new ye(l,u.start+1))),u?c=u.end+1:c>1?c=1:(l--,c=o.getLineMaxColumn(l))),new z(l,c,s.lineNumber,s.column)}static deleteInsideWord(i,e,t,o=!1){if(!t.isEmpty())return t;let n=new ye(t.positionLineNumber,t.positionColumn),r=this._deleteInsideWordWhitespace(e,n);return r||this._deleteInsideWordDetermineDeleteRange(i,e,n,o)}static _charAtIsWhitespace(i,e){let t=i.charCodeAt(e);return t===32||t===9}static _deleteInsideWordWhitespace(i,e){let t=i.getLineContent(e.lineNumber),o=t.length;if(o===0)return null;let n=Math.max(e.column-2,0);if(!this._charAtIsWhitespace(t,n))return null;let r=Math.min(e.column-1,o-1);if(!this._charAtIsWhitespace(t,r))return null;for(;n>0&&this._charAtIsWhitespace(t,n-1);)n--;for(;r+1<o&&this._charAtIsWhitespace(t,r+1);)r++;return new z(e.lineNumber,n+1,e.lineNumber,r+2)}static _deleteInsideWordDetermineDeleteRange(i,e,t,o){let n=e.getLineContent(t.lineNumber),r=n.length;if(r===0)return t.lineNumber>1?new z(t.lineNumber-1,e.getLineMaxColumn(t.lineNumber-1),t.lineNumber,1):t.lineNumber<e.getLineCount()?new z(t.lineNumber,1,t.lineNumber+1,1):new z(t.lineNumber,1,t.lineNumber,1);let s=h=>h.start+1<=t.column&&t.column<=h.end+1,l=(h,g)=>(h=Math.min(h,t.column),g=Math.max(g,t.column),new z(t.lineNumber,h,t.lineNumber,g)),c=h=>{let g=h.start+1,f=h.end+1;if(o)return l(g,f);let v=!1;for(;f-1<r&&this._charAtIsWhitespace(n,f-1);)v=!0,f++;if(!v)for(;g>1&&this._charAtIsWhitespace(n,g-2);)g--;return l(g,f)},u=a._findPreviousWordOnLine(i,e,t);if(u&&s(u))return c(u);let p=a._findNextWordOnLine(i,e,t);return p&&s(p)?c(p):u&&p?l(u.end+1,p.start+1):u?l(u.start+1,u.end+1):p?l(p.start+1,p.end+1):l(1,r+1)}static _deleteWordPartLeft(i,e){if(!e.isEmpty())return e;let t=e.getPosition(),o=a._moveWordPartLeft(i,t);return new z(t.lineNumber,t.column,o.lineNumber,o.column)}static _findFirstNonWhitespaceChar(i,e){let t=i.length;for(let o=e;o<t;o++){let n=i.charAt(o);if(n!==" "&&n!=="	")return o}return t}static _deleteWordRightWhitespace(i,e){let t=i.getLineContent(e.lineNumber),o=e.column-1,n=this._findFirstNonWhitespaceChar(t,o);return o+1<n?new z(e.lineNumber,e.column,e.lineNumber,n+1):null}static deleteWordRight(i,e){let t=i.wordSeparators,o=i.model,n=i.selection,r=i.whitespaceHeuristics;if(!n.isEmpty())return n;let s=new ye(n.positionLineNumber,n.positionColumn),l=s.lineNumber,c=s.column,u=o.getLineCount(),p=o.getLineMaxColumn(l);if(l===u&&c===p)return null;if(r){let g=this._deleteWordRightWhitespace(o,s);if(g)return g}let h=a._findNextWordOnLine(t,o,s);return e===2?h?c=h.end+1:c<p||l===u?c=p:(l++,h=a._findNextWordOnLine(t,o,new ye(l,1)),h?c=h.start+1:c=o.getLineMaxColumn(l)):(h&&c>=h.start+1&&(h=a._findNextWordOnLine(t,o,new ye(l,h.end+1))),h?c=h.start+1:c<p||l===u?c=p:(l++,h=a._findNextWordOnLine(t,o,new ye(l,1)),h?c=h.start+1:c=o.getLineMaxColumn(l))),new z(l,c,s.lineNumber,s.column)}static _deleteWordPartRight(i,e){if(!e.isEmpty())return e;let t=e.getPosition(),o=a._moveWordPartRight(i,t);return new z(t.lineNumber,t.column,o.lineNumber,o.column)}static _createWordAtPosition(i,e,t){let o=new z(e,t.start+1,e,t.end+1);return{word:i.getValueInRange(o),startColumn:o.startColumn,endColumn:o.endColumn}}static getWordAtPosition(i,e,t,o){let n=wC(e,t),r=a._findPreviousWordOnLine(n,i,o);if(r&&r.wordType===1&&r.start<=o.column-1&&o.column-1<=r.end)return a._createWordAtPosition(i,o.lineNumber,r);let s=a._findNextWordOnLine(n,i,o);return s&&s.wordType===1&&s.start<=o.column-1&&o.column-1<=s.end?a._createWordAtPosition(i,o.lineNumber,s):null}static word(i,e,t,o,n){let r=wC(i.wordSeparators,i.wordSegmenterLocales),s=a._findPreviousWordOnLine(r,e,n),l=a._findNextWordOnLine(r,e,n);if(!o){let g,f;return s&&s.wordType===1&&s.start<=n.column-1&&n.column-1<=s.end||s&&s.wordType===2&&s.start<=n.column-1&&n.column-1<s.end?(g=s.start+1,f=s.end+1):l&&l.wordType===1&&l.start<=n.column-1&&n.column-1<=l.end||l&&l.wordType===2&&l.start<=n.column-1&&n.column-1<l.end?(g=l.start+1,f=l.end+1):(s?g=s.end+1:g=1,l?f=l.start+1:f=e.getLineMaxColumn(n.lineNumber)),new vv(new z(n.lineNumber,g,n.lineNumber,f),1,0,new ye(n.lineNumber,f),0)}let c,u;s&&s.wordType===1&&s.start<n.column-1&&n.column-1<s.end?(c=s.start+1,u=s.end+1):l&&l.wordType===1&&l.start<n.column-1&&n.column-1<l.end?(c=l.start+1,u=l.end+1):(c=n.column,u=n.column);let p=n.lineNumber,h;if(t.selectionStart.containsPosition(n))h=t.selectionStart.endColumn;else if(n.isBeforeOrEqual(t.selectionStart.getStartPosition())){h=c;let g=new ye(p,h);t.selectionStart.containsPosition(g)&&(h=t.selectionStart.endColumn)}else{h=u;let g=new ye(p,h);t.selectionStart.containsPosition(g)&&(h=t.selectionStart.startColumn)}return t.move(!0,p,h,0)}},Lae=class extends Hf{static deleteWordPartLeft(i){let e=lft([Hf.deleteWordLeft(i,0),Hf.deleteWordLeft(i,2),Hf._deleteWordPartLeft(i.model,i.selection)]);return e.sort(z.compareRangesUsingEnds),e[2]}static deleteWordPartRight(i){let e=lft([Hf.deleteWordRight(i,0),Hf.deleteWordRight(i,2),Hf._deleteWordPartRight(i.model,i.selection)]);return e.sort(z.compareRangesUsingStarts),e[0]}static moveWordPartLeft(i,e,t,o){let n=lft([Hf.moveWordLeft(i,e,t,0,o),Hf.moveWordLeft(i,e,t,2,o),Hf._moveWordPartLeft(e,t)]);return n.sort(ye.compare),n[2]}static moveWordPartRight(i,e,t){let o=lft([Hf.moveWordRight(i,e,t,0),Hf.moveWordRight(i,e,t,2),Hf._moveWordPartRight(e,t)]);return o.sort(ye.compare),o[0]}};function lft(a){return a.filter(i=>!!i)}var sf=class a{static addCursorDown(i,e,t){let o=[],n=0;for(let r=0,s=e.length;r<s;r++){let l=e[r];o[n++]=new js(l.modelState,l.viewState),t?o[n++]=js.fromModelState(Mu.translateDown(i.cursorConfig,i.model,l.modelState)):o[n++]=js.fromViewState(Mu.translateDown(i.cursorConfig,i,l.viewState))}return o}static addCursorUp(i,e,t){let o=[],n=0;for(let r=0,s=e.length;r<s;r++){let l=e[r];o[n++]=new js(l.modelState,l.viewState),t?o[n++]=js.fromModelState(Mu.translateUp(i.cursorConfig,i.model,l.modelState)):o[n++]=js.fromViewState(Mu.translateUp(i.cursorConfig,i,l.viewState))}return o}static moveToBeginningOfLine(i,e,t){let o=[];for(let n=0,r=e.length;n<r;n++){let s=e[n];o[n]=this._moveToLineStart(i,s,t)}return o}static _moveToLineStart(i,e,t){let o=e.viewState.position.column,n=e.modelState.position.column,r=o===n,s=e.viewState.position.lineNumber,l=i.getLineFirstNonWhitespaceColumn(s);return!r&&!(o===l)?this._moveToLineStartByView(i,e,t):this._moveToLineStartByModel(i,e,t)}static _moveToLineStartByView(i,e,t){return js.fromViewState(Mu.moveToBeginningOfLine(i.cursorConfig,i,e.viewState,t))}static _moveToLineStartByModel(i,e,t){return js.fromModelState(Mu.moveToBeginningOfLine(i.cursorConfig,i.model,e.modelState,t))}static moveToEndOfLine(i,e,t,o){let n=[];for(let r=0,s=e.length;r<s;r++){let l=e[r];n[r]=this._moveToLineEnd(i,l,t,o)}return n}static _moveToLineEnd(i,e,t,o){let n=e.viewState.position,r=i.getLineMaxColumn(n.lineNumber),s=n.column===r,l=e.modelState.position,c=i.model.getLineMaxColumn(l.lineNumber),u=r-n.column===c-l.column;return s||u?this._moveToLineEndByModel(i,e,t,o):this._moveToLineEndByView(i,e,t,o)}static _moveToLineEndByView(i,e,t,o){return js.fromViewState(Mu.moveToEndOfLine(i.cursorConfig,i,e.viewState,t,o))}static _moveToLineEndByModel(i,e,t,o){return js.fromModelState(Mu.moveToEndOfLine(i.cursorConfig,i.model,e.modelState,t,o))}static expandLineSelection(i,e){let t=[];for(let o=0,n=e.length;o<n;o++){let r=e[o],s=r.modelState.selection.startLineNumber,l=i.model.getLineCount(),c=r.modelState.selection.endLineNumber,u;c===l?u=i.model.getLineMaxColumn(l):(c++,u=1),t[o]=js.fromModelState(new vv(new z(s,1,s,1),0,0,new ye(c,u),0))}return t}static moveToBeginningOfBuffer(i,e,t){let o=[];for(let n=0,r=e.length;n<r;n++){let s=e[n];o[n]=js.fromModelState(Mu.moveToBeginningOfBuffer(i.cursorConfig,i.model,s.modelState,t))}return o}static moveToEndOfBuffer(i,e,t){let o=[];for(let n=0,r=e.length;n<r;n++){let s=e[n];o[n]=js.fromModelState(Mu.moveToEndOfBuffer(i.cursorConfig,i.model,s.modelState,t))}return o}static selectAll(i,e){let t=i.model.getLineCount(),o=i.model.getLineMaxColumn(t);return js.fromModelState(new vv(new z(1,1,1,1),0,0,new ye(t,o),0))}static line(i,e,t,o,n){let r=i.model.validatePosition(o),s=n?i.coordinatesConverter.validateViewPosition(new ye(n.lineNumber,n.column),r):i.coordinatesConverter.convertModelPositionToViewPosition(r);if(!t){let c=i.model.getLineCount(),u=r.lineNumber+1,p=1;return u>c&&(u=c,p=i.model.getLineMaxColumn(u)),js.fromModelState(new vv(new z(r.lineNumber,1,u,p),2,0,new ye(u,p),0))}let l=e.modelState.selectionStart.getStartPosition().lineNumber;if(r.lineNumber<l)return js.fromViewState(e.viewState.move(!0,s.lineNumber,1,0));if(r.lineNumber>l){let c=i.getLineCount(),u=s.lineNumber+1,p=1;return u>c&&(u=c,p=i.getLineMaxColumn(u)),js.fromViewState(e.viewState.move(!0,u,p,0))}else{let c=e.modelState.selectionStart.getEndPosition();return js.fromModelState(e.modelState.move(!0,c.lineNumber,c.column,0))}}static word(i,e,t,o){let n=i.model.validatePosition(o);return js.fromModelState(Hf.word(i.cursorConfig,i.model,e.modelState,t,n))}static cancelSelection(i,e){if(!e.modelState.hasSelection())return new js(e.modelState,e.viewState);let t=e.viewState.position.lineNumber,o=e.viewState.position.column;return js.fromViewState(new vv(new z(t,o,t,o),0,0,new ye(t,o),0))}static moveTo(i,e,t,o,n){if(t){if(e.modelState.selectionStartKind===1)return this.word(i,e,t,o);if(e.modelState.selectionStartKind===2)return this.line(i,e,t,o,n)}let r=i.model.validatePosition(o),s=n?i.coordinatesConverter.validateViewPosition(new ye(n.lineNumber,n.column),r):i.coordinatesConverter.convertModelPositionToViewPosition(r);return js.fromViewState(e.viewState.move(t,s.lineNumber,s.column,0))}static simpleMove(i,e,t,o,n,r){switch(t){case Ls.Direction.Left:return r===Ls.Unit.HalfLine?this._moveHalfLineLeft(i,e,o):this._moveLeft(i,e,o,n);case Ls.Direction.Right:return r===Ls.Unit.HalfLine?this._moveHalfLineRight(i,e,o):this._moveRight(i,e,o,n);case Ls.Direction.Up:return r===Ls.Unit.WrappedLine?this._moveUpByViewLines(i,e,o,n):r===Ls.Unit.FoldedLine?this._moveUpByFoldedLines(i,e,o,n):this._moveUpByModelLines(i,e,o,n);case Ls.Direction.Down:return r===Ls.Unit.WrappedLine?this._moveDownByViewLines(i,e,o,n):r===Ls.Unit.FoldedLine?this._moveDownByFoldedLines(i,e,o,n):this._moveDownByModelLines(i,e,o,n);case Ls.Direction.PrevBlankLine:return r===Ls.Unit.WrappedLine?e.map(s=>js.fromViewState(Mu.moveToPrevBlankLine(i.cursorConfig,i,s.viewState,o))):e.map(s=>js.fromModelState(Mu.moveToPrevBlankLine(i.cursorConfig,i.model,s.modelState,o)));case Ls.Direction.NextBlankLine:return r===Ls.Unit.WrappedLine?e.map(s=>js.fromViewState(Mu.moveToNextBlankLine(i.cursorConfig,i,s.viewState,o))):e.map(s=>js.fromModelState(Mu.moveToNextBlankLine(i.cursorConfig,i.model,s.modelState,o)));case Ls.Direction.WrappedLineStart:return this._moveToViewMinColumn(i,e,o);case Ls.Direction.WrappedLineFirstNonWhitespaceCharacter:return this._moveToViewFirstNonWhitespaceColumn(i,e,o);case Ls.Direction.WrappedLineColumnCenter:return this._moveToViewCenterColumn(i,e,o);case Ls.Direction.WrappedLineEnd:return this._moveToViewMaxColumn(i,e,o);case Ls.Direction.WrappedLineLastNonWhitespaceCharacter:return this._moveToViewLastNonWhitespaceColumn(i,e,o);default:return null}}static viewportMove(i,e,t,o,n){let r=i.getCompletelyVisibleViewRange(),s=i.coordinatesConverter.convertViewRangeToModelRange(r);switch(t){case Ls.Direction.ViewPortTop:{let l=this._firstLineNumberInRange(i.model,s,n),c=i.model.getLineFirstNonWhitespaceColumn(l);return[this._moveToModelPosition(i,e[0],o,l,c)]}case Ls.Direction.ViewPortBottom:{let l=this._lastLineNumberInRange(i.model,s,n),c=i.model.getLineFirstNonWhitespaceColumn(l);return[this._moveToModelPosition(i,e[0],o,l,c)]}case Ls.Direction.ViewPortCenter:{let l=Math.round((s.startLineNumber+s.endLineNumber)/2),c=i.model.getLineFirstNonWhitespaceColumn(l);return[this._moveToModelPosition(i,e[0],o,l,c)]}case Ls.Direction.ViewPortIfOutside:{let l=[];for(let c=0,u=e.length;c<u;c++){let p=e[c];l[c]=this.findPositionInViewportIfOutside(i,p,r,o)}return l}default:return null}}static findPositionInViewportIfOutside(i,e,t,o){let n=e.viewState.position.lineNumber;if(t.startLineNumber<=n&&n<=t.endLineNumber-1)return new js(e.modelState,e.viewState);{let r;n>t.endLineNumber-1?r=t.endLineNumber-1:n<t.startLineNumber?r=t.startLineNumber:r=n;let s=Mu.vertical(i.cursorConfig,i,n,e.viewState.position.column,e.viewState.leftoverVisibleColumns,r,!1);return js.fromViewState(e.viewState.move(o,s.lineNumber,s.column,s.leftoverVisibleColumns))}}static _firstLineNumberInRange(i,e,t){let o=e.startLineNumber;return e.startColumn!==i.getLineMinColumn(o)&&o++,Math.min(e.endLineNumber,o+t-1)}static _lastLineNumberInRange(i,e,t){let o=e.startLineNumber;return e.startColumn!==i.getLineMinColumn(o)&&o++,Math.max(o,e.endLineNumber-t+1)}static _moveLeft(i,e,t,o){return e.map(n=>{let s=i.getTextDirection(n.viewState.position.lineNumber)===1;return js.fromViewState(s?Mu.moveRight(i.cursorConfig,i,n.viewState,t,o):Mu.moveLeft(i.cursorConfig,i,n.viewState,t,o))})}static _moveHalfLineLeft(i,e,t){let o=[];for(let n=0,r=e.length;n<r;n++){let s=e[n],l=s.viewState.position.lineNumber,c=Math.round(i.getLineLength(l)/2);o[n]=js.fromViewState(Mu.moveLeft(i.cursorConfig,i,s.viewState,t,c))}return o}static _moveRight(i,e,t,o){return e.map(n=>{let s=i.getTextDirection(n.viewState.position.lineNumber)===1;return js.fromViewState(s?Mu.moveLeft(i.cursorConfig,i,n.viewState,t,o):Mu.moveRight(i.cursorConfig,i,n.viewState,t,o))})}static _moveHalfLineRight(i,e,t){let o=[];for(let n=0,r=e.length;n<r;n++){let s=e[n],l=s.viewState.position.lineNumber,c=Math.round(i.getLineLength(l)/2);o[n]=js.fromViewState(Mu.moveRight(i.cursorConfig,i,s.viewState,t,c))}return o}static _moveDownByViewLines(i,e,t,o){let n=[];for(let r=0,s=e.length;r<s;r++){let l=e[r];n[r]=js.fromViewState(Mu.moveDown(i.cursorConfig,i,l.viewState,t,o))}return n}static _moveDownByModelLines(i,e,t,o){let n=[];for(let r=0,s=e.length;r<s;r++){let l=e[r];n[r]=js.fromModelState(Mu.moveDown(i.cursorConfig,i.model,l.modelState,t,o))}return n}static _moveUpByViewLines(i,e,t,o){let n=[];for(let r=0,s=e.length;r<s;r++){let l=e[r];n[r]=js.fromViewState(Mu.moveUp(i.cursorConfig,i,l.viewState,t,o))}return n}static _moveUpByModelLines(i,e,t,o){let n=[];for(let r=0,s=e.length;r<s;r++){let l=e[r];n[r]=js.fromModelState(Mu.moveUp(i.cursorConfig,i.model,l.modelState,t,o))}return n}static _moveDownByFoldedLines(i,e,t,o){let n=i.model,r=n.getLineCount(),s=i.getHiddenAreas();return e.map(l=>{let c=l.modelState.hasSelection()&&!t?l.modelState.selection.endLineNumber:l.modelState.position.lineNumber,p=a._targetFoldedDown(c,o,s,r)-c;return p===0?js.fromModelState(l.modelState):js.fromModelState(Mu.moveDown(i.cursorConfig,n,l.modelState,t,p))})}static _moveUpByFoldedLines(i,e,t,o){let n=i.model,r=i.getHiddenAreas();return e.map(s=>{let l=s.modelState.hasSelection()&&!t?s.modelState.selection.startLineNumber:s.modelState.position.lineNumber,c=a._targetFoldedUp(l,o,r),u=l-c;return u===0?js.fromModelState(s.modelState):js.fromModelState(Mu.moveUp(i.cursorConfig,n,s.modelState,t,u))})}static _targetFoldedDown(i,e,t,o){let n=i,r=0;for(;r<t.length&&t[r].endLineNumber<n+1;)r++;for(let s=0;s<e;s++){if(n>=o)return o;let l=n+1;for(;r<t.length&&t[r].endLineNumber<l;)r++;if(r<t.length&&t[r].startLineNumber<=l&&(l=t[r].endLineNumber+1),l>o)return n;n=l}return n}static _targetFoldedUp(i,e,t){let o=i,n=t.length-1;for(;n>=0&&t[n].startLineNumber>o-1;)n--;for(let r=0;r<e;r++){if(o<=1)return 1;let s=o-1;for(;n>=0&&t[n].startLineNumber>s;)n--;if(n>=0&&t[n].endLineNumber>=s&&(s=t[n].startLineNumber-1),s<1)return o;o=s}return o}static _moveToViewPosition(i,e,t,o,n){return js.fromViewState(e.viewState.move(t,o,n,0))}static _moveToModelPosition(i,e,t,o,n){return js.fromModelState(e.modelState.move(t,o,n,0))}static _moveToViewMinColumn(i,e,t){let o=[];for(let n=0,r=e.length;n<r;n++){let s=e[n],l=s.viewState.position.lineNumber,c=i.getLineMinColumn(l);o[n]=this._moveToViewPosition(i,s,t,l,c)}return o}static _moveToViewFirstNonWhitespaceColumn(i,e,t){let o=[];for(let n=0,r=e.length;n<r;n++){let s=e[n],l=s.viewState.position.lineNumber,c=i.getLineFirstNonWhitespaceColumn(l);o[n]=this._moveToViewPosition(i,s,t,l,c)}return o}static _moveToViewCenterColumn(i,e,t){let o=[];for(let n=0,r=e.length;n<r;n++){let s=e[n],l=s.viewState.position.lineNumber,c=Math.round((i.getLineMaxColumn(l)+i.getLineMinColumn(l))/2);o[n]=this._moveToViewPosition(i,s,t,l,c)}return o}static _moveToViewMaxColumn(i,e,t){let o=[];for(let n=0,r=e.length;n<r;n++){let s=e[n],l=s.viewState.position.lineNumber,c=i.getLineMaxColumn(l);o[n]=this._moveToViewPosition(i,s,t,l,c)}return o}static _moveToViewLastNonWhitespaceColumn(i,e,t){let o=[];for(let n=0,r=e.length;n<r;n++){let s=e[n],l=s.viewState.position.lineNumber,c=i.getLineLastNonWhitespaceColumn(l);o[n]=this._moveToViewPosition(i,s,t,l,c)}return o}},Ls;(s=>{let a=function(l){if(!xi(l))return!1;let c=l;return!(!Fe(c.to)||!gn(c.select)&&!Wa(c.select)||!gn(c.by)&&!Fe(c.by)||!gn(c.value)&&!Yo(c.value)||!gn(c.noHistory)&&!Wa(c.noHistory))};s.metadata={description:"Move cursor to a logical position in the view",args:[{name:"Cursor move argument object",description:`Property-value pairs that can be passed through this argument:
					* 'to': A mandatory logical position value providing where to move the cursor.
						\`\`\`
						'left', 'right', 'up', 'down', 'prevBlankLine', 'nextBlankLine',
						'wrappedLineStart', 'wrappedLineEnd', 'wrappedLineColumnCenter'
						'wrappedLineFirstNonWhitespaceCharacter', 'wrappedLineLastNonWhitespaceCharacter'
						'viewPortTop', 'viewPortCenter', 'viewPortBottom', 'viewPortIfOutside'
						\`\`\`
					* 'by': Unit to move. Default is computed based on 'to' value.
						\`\`\`
						'line', 'wrappedLine', 'character', 'halfLine', 'foldedLine'
						\`\`\`
						Use 'foldedLine' with 'up'/'down' to move by logical lines while treating each
						folded region as a single step.
					* 'value': Number of units to move. Default is '1'.
					* 'select': If 'true' makes the selection. Default is 'false'.
					* 'noHistory': If 'true' does not add the movement to navigation history. Default is 'false'.
				`,constraint:a,schema:{type:"object",required:["to"],properties:{to:{type:"string",enum:["left","right","up","down","prevBlankLine","nextBlankLine","wrappedLineStart","wrappedLineEnd","wrappedLineColumnCenter","wrappedLineFirstNonWhitespaceCharacter","wrappedLineLastNonWhitespaceCharacter","viewPortTop","viewPortCenter","viewPortBottom","viewPortIfOutside"]},by:{type:"string",enum:["line","wrappedLine","character","halfLine","foldedLine"]},value:{type:"number",default:1},select:{type:"boolean",default:!1},noHistory:{type:"boolean",default:!1}}}}]},s.RawDirection={Left:"left",Right:"right",Up:"up",Down:"down",PrevBlankLine:"prevBlankLine",NextBlankLine:"nextBlankLine",WrappedLineStart:"wrappedLineStart",WrappedLineFirstNonWhitespaceCharacter:"wrappedLineFirstNonWhitespaceCharacter",WrappedLineColumnCenter:"wrappedLineColumnCenter",WrappedLineEnd:"wrappedLineEnd",WrappedLineLastNonWhitespaceCharacter:"wrappedLineLastNonWhitespaceCharacter",ViewPortTop:"viewPortTop",ViewPortCenter:"viewPortCenter",ViewPortBottom:"viewPortBottom",ViewPortIfOutside:"viewPortIfOutside"},s.RawUnit={Line:"line",WrappedLine:"wrappedLine",Character:"character",HalfLine:"halfLine",FoldedLine:"foldedLine"};function o(l){if(!l.to)return null;let c;switch(l.to){case s.RawDirection.Left:c=0;break;case s.RawDirection.Right:c=1;break;case s.RawDirection.Up:c=2;break;case s.RawDirection.Down:c=3;break;case s.RawDirection.PrevBlankLine:c=4;break;case s.RawDirection.NextBlankLine:c=5;break;case s.RawDirection.WrappedLineStart:c=6;break;case s.RawDirection.WrappedLineFirstNonWhitespaceCharacter:c=7;break;case s.RawDirection.WrappedLineColumnCenter:c=8;break;case s.RawDirection.WrappedLineEnd:c=9;break;case s.RawDirection.WrappedLineLastNonWhitespaceCharacter:c=10;break;case s.RawDirection.ViewPortTop:c=11;break;case s.RawDirection.ViewPortBottom:c=13;break;case s.RawDirection.ViewPortCenter:c=12;break;case s.RawDirection.ViewPortIfOutside:c=14;break;default:return null}let u=0;switch(l.by){case s.RawUnit.Line:u=1;break;case s.RawUnit.WrappedLine:u=2;break;case s.RawUnit.Character:u=3;break;case s.RawUnit.HalfLine:u=4;break;case s.RawUnit.FoldedLine:u=5;break}return{direction:c,unit:u,select:!!l.select,value:l.value||1,noHistory:!!l.noHistory}}s.parse=o;let n;(O=>(O[O.Left=0]="Left",O[O.Right=1]="Right",O[O.Up=2]="Up",O[O.Down=3]="Down",O[O.PrevBlankLine=4]="PrevBlankLine",O[O.NextBlankLine=5]="NextBlankLine",O[O.WrappedLineStart=6]="WrappedLineStart",O[O.WrappedLineFirstNonWhitespaceCharacter=7]="WrappedLineFirstNonWhitespaceCharacter",O[O.WrappedLineColumnCenter=8]="WrappedLineColumnCenter",O[O.WrappedLineEnd=9]="WrappedLineEnd",O[O.WrappedLineLastNonWhitespaceCharacter=10]="WrappedLineLastNonWhitespaceCharacter",O[O.ViewPortTop=11]="ViewPortTop",O[O.ViewPortCenter=12]="ViewPortCenter",O[O.ViewPortBottom=13]="ViewPortBottom",O[O.ViewPortIfOutside=14]="ViewPortIfOutside"))(n=s.Direction||={});let r;(f=>(f[f.None=0]="None",f[f.Line=1]="Line",f[f.WrappedLine=2]="WrappedLine",f[f.Character=3]="Character",f[f.HalfLine=4]="HalfLine",f[f.FoldedLine=5]="FoldedLine"))(r=s.Unit||={})})(Ls||={});var XIe=class{constructor(i){this._neutralCharacter=null;this._neutralCharacterSearched=!1;if(this.open=i.open,this.close=i.close,this._inString=!0,this._inComment=!0,this._inRegEx=!0,Array.isArray(i.notIn))for(let e=0,t=i.notIn.length;e<t;e++)switch(i.notIn[e]){case"string":this._inString=!1;break;case"comment":this._inComment=!1;break;case"regex":this._inRegEx=!1;break}}isOK(i){switch(i){case 0:return!0;case 1:return this._inComment;case 2:return this._inString;case 3:return this._inRegEx}}shouldAutoClose(i,e){if(i.getTokenCount()===0)return!0;let t=i.findTokenIndexAtOffset(e-2),o=i.getStandardTokenType(t);return this.isOK(o)}_findNeutralCharacterInRange(i,e){for(let t=i;t<=e;t++){let o=String.fromCharCode(t);if(!this.open.includes(o)&&!this.close.includes(o))return o}return null}findNeutralCharacter(){return this._neutralCharacterSearched||(this._neutralCharacterSearched=!0,this._neutralCharacter||(this._neutralCharacter=this._findNeutralCharacterInRange(48,57)),this._neutralCharacter||(this._neutralCharacter=this._findNeutralCharacterInRange(97,122)),this._neutralCharacter||(this._neutralCharacter=this._findNeutralCharacterInRange(65,90))),this._neutralCharacter}},cft=class{constructor(i){this.autoClosingPairsOpenByStart=new Map,this.autoClosingPairsOpenByEnd=new Map,this.autoClosingPairsCloseByStart=new Map,this.autoClosingPairsCloseByEnd=new Map,this.autoClosingPairsCloseSingleChar=new Map;for(let e of i)oje(this.autoClosingPairsOpenByStart,e.open.charAt(0),e),oje(this.autoClosingPairsOpenByEnd,e.open.charAt(e.open.length-1),e),oje(this.autoClosingPairsCloseByStart,e.close.charAt(0),e),oje(this.autoClosingPairsCloseByEnd,e.close.charAt(e.close.length-1),e),e.close.length===1&&e.open.length===1&&oje(this.autoClosingPairsCloseSingleChar,e.close,e)}};function oje(a,i,e){a.has(i)?a.get(i).push(e):a.set(i,[e])}var dft=class a{static{this.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_QUOTES=`;:.,=}])> 
	`}static{this.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_BRACKETS=`'"\`;:.,=}])> 
	`}static{this.DEFAULT_AUTOCLOSE_BEFORE_WHITESPACE=` 
	`}constructor(i){if(i.autoClosingPairs?this._autoClosingPairs=i.autoClosingPairs.map(e=>new XIe(e)):i.brackets?this._autoClosingPairs=i.brackets.map(e=>new XIe({open:e[0],close:e[1]})):this._autoClosingPairs=[],i.__electricCharacterSupport&&i.__electricCharacterSupport.docComment){let e=i.__electricCharacterSupport.docComment;this._autoClosingPairs.push(new XIe({open:e.open,close:e.close||""}))}this._autoCloseBeforeForQuotes=typeof i.autoCloseBefore=="string"?i.autoCloseBefore:a.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_QUOTES,this._autoCloseBeforeForBrackets=typeof i.autoCloseBefore=="string"?i.autoCloseBefore:a.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_BRACKETS,this._surroundingPairs=i.surroundingPairs||this._autoClosingPairs}getAutoClosingPairs(){return this._autoClosingPairs}getAutoCloseBeforeSet(i){return i?this._autoCloseBeforeForQuotes:this._autoCloseBeforeForBrackets}getSurroundingPairs(){return this._surroundingPairs}};var rei;function U$i(){return rei||(rei=new TextDecoder("UTF-16LE")),rei}var sei;function x0o(){return sei||(sei=new TextDecoder("UTF-16BE")),sei}var aei;function lei(){return aei||(aei=m$e()?U$i():x0o()),aei}function z$i(a,i,e){let t=new Uint16Array(a.buffer,i,e);return e>0&&(t[0]===65279||t[0]===65534)?k0o(a,i,e):U$i().decode(t)}function k0o(a,i,e){let t=[],o=0;for(let n=0;n<e;n++){let r=sqi(a,i);i+=2,t[o++]=String.fromCharCode(r)}return t.join("")}var $S=class{constructor(i){this._capacity=i|0,this._buffer=new Uint16Array(this._capacity),this._completedStrings=null,this._bufferLength=0}reset(){this._completedStrings=null,this._bufferLength=0}build(){return this._completedStrings!==null?(this._flushBuffer(),this._completedStrings.join("")):this._buildBuffer()}_buildBuffer(){if(this._bufferLength===0)return"";let i=new Uint16Array(this._buffer.buffer,0,this._bufferLength);return lei().decode(i)}_flushBuffer(){let i=this._buildBuffer();this._bufferLength=0,this._completedStrings===null?this._completedStrings=[i]:this._completedStrings[this._completedStrings.length]=i}appendCharCode(i){let e=this._capacity-this._bufferLength;e<=1&&(e===0||ju(i))&&this._flushBuffer(),this._buffer[this._bufferLength++]=i}appendASCIICharCode(i){this._bufferLength===this._capacity&&this._flushBuffer(),this._buffer[this._bufferLength++]=i}appendString(i){let e=i.length;if(this._bufferLength+e>=this._capacity){this._flushBuffer(),this._completedStrings[this._completedStrings.length]=i;return}for(let t=0;t<e;t++)this._buffer[this._bufferLength++]=i.charCodeAt(t)}};var cei=class a{constructor(i,e,t,o,n,r){this._richEditBracketBrand=void 0;this.languageId=i,this.index=e,this.open=t,this.close=o,this.forwardRegex=n,this.reversedRegex=r,this._openSet=a._toSet(this.open),this._closeSet=a._toSet(this.close)}isOpen(i){return this._openSet.has(i)}isClose(i){return this._closeSet.has(i)}static _toSet(i){let e=new Set;for(let t of i)e.add(t);return e}};function T0o(a){let i=a.length;a=a.map(r=>[r[0].toLowerCase(),r[1].toLowerCase()]);let e=[];for(let r=0;r<i;r++)e[r]=r;let t=(r,s)=>{let[l,c]=r,[u,p]=s;return l===u||l===p||c===u||c===p},o=(r,s)=>{let l=Math.min(r,s),c=Math.max(r,s);for(let u=0;u<i;u++)e[u]===c&&(e[u]=l)};for(let r=0;r<i;r++){let s=a[r];for(let l=r+1;l<i;l++){let c=a[l];t(s,c)&&o(e[r],e[l])}}let n=[];for(let r=0;r<i;r++){let s=[],l=[];for(let c=0;c<i;c++)if(e[c]===r){let[u,p]=a[c];s.push(u),l.push(p)}s.length>0&&n.push({open:s,close:l})}return n}var uft=class{constructor(i,e){this._richEditBracketsBrand=void 0;let t=T0o(e);this.brackets=t.map((o,n)=>new cei(i,n,o.open,o.close,_0o(o.open,o.close,t,n),D0o(o.open,o.close,t,n))),this.forwardRegex=L0o(this.brackets),this.reversedRegex=R0o(this.brackets),this.textIsBracket={},this.textIsOpenBracket={},this.maxBracketLength=0;for(let o of this.brackets){for(let n of o.open)this.textIsBracket[n]=o,this.textIsOpenBracket[n]=!0,this.maxBracketLength=Math.max(this.maxBracketLength,n.length);for(let n of o.close)this.textIsBracket[n]=o,this.textIsOpenBracket[n]=!1,this.maxBracketLength=Math.max(this.maxBracketLength,n.length)}}};function K$i(a,i,e,t){for(let o=0,n=i.length;o<n;o++){if(o===e)continue;let r=i[o];for(let s of r.open)s.indexOf(a)>=0&&t.push(s);for(let s of r.close)s.indexOf(a)>=0&&t.push(s)}}function G$i(a,i){return a.length-i.length}function pft(a){if(a.length<=1)return a;let i=[],e=new Set;for(let t of a)e.has(t)||(i.push(t),e.add(t));return i}function _0o(a,i,e,t){let o=[];o=o.concat(a),o=o.concat(i);for(let n=0,r=o.length;n<r;n++)K$i(o[n],e,t,o);return o=pft(o),o.sort(G$i),o.reverse(),JIe(o)}function D0o(a,i,e,t){let o=[];o=o.concat(a),o=o.concat(i);for(let n=0,r=o.length;n<r;n++)K$i(o[n],e,t,o);return o=pft(o),o.sort(G$i),o.reverse(),JIe(o.map(dei))}function L0o(a){let i=[];for(let e of a){for(let t of e.open)i.push(t);for(let t of e.close)i.push(t)}return i=pft(i),JIe(i)}function R0o(a){let i=[];for(let e of a){for(let t of e.open)i.push(t);for(let t of e.close)i.push(t)}return i=pft(i),JIe(i.map(dei))}function M0o(a){let i=/^[\w ]+$/.test(a);return a=ns(a),i?`\\b${a}\\b`:a}function JIe(a,i){let e=`(${a.map(M0o).join(")|(")})`;return N$(e,!0,i)}var dei=(function(){function a(t){let o=new Uint16Array(t.length),n=0;for(let r=t.length-1;r>=0;r--)o[n++]=t.charCodeAt(r);return lei().decode(o)}let i=null,e=null;return function(o){return i!==o&&(i=o,e=a(i)),e}})(),bE=class{static _findPrevBracketInText(i,e,t,o){let n=t.match(i);if(!n)return null;let r=t.length-(n.index||0),s=n[0].length,l=o+r;return new z(e,l-s+1,e,l+1)}static findPrevBracketInRange(i,e,t,o,n){let s=dei(t).substring(t.length-n,t.length-o);return this._findPrevBracketInText(i,e,s,o)}static findNextBracketInText(i,e,t,o){let n=t.match(i);if(!n)return null;let r=n.index||0,s=n[0].length;if(s===0)return null;let l=o+r;return new z(e,l+1,e,l+1+s)}static findNextBracketInRange(i,e,t,o,n){let r=t.substring(o,n);return this.findNextBracketInText(i,e,r,o)}};var mft=class{constructor(i){this._richEditBrackets=i}getElectricCharacters(){let i=[];if(this._richEditBrackets)for(let e of this._richEditBrackets.brackets)for(let t of e.close){let o=t.charAt(t.length-1);i.push(o)}return zo(i)}onElectricCharacter(i,e,t){if(!this._richEditBrackets||this._richEditBrackets.brackets.length===0)return null;let o=e.findTokenIndexAtOffset(t-1);if(mO(e.getStandardTokenType(o)))return null;let n=this._richEditBrackets.reversedRegex,r=e.getLineContent().substring(0,t-1)+i,s=bE.findPrevBracketInRange(n,1,r,0,r.length);if(!s)return null;let l=r.substring(s.startColumn-1,s.endColumn-1).toLowerCase();if(this._richEditBrackets.textIsOpenBracket[l])return null;let u=e.getActualLineContentBefore(s.startColumn-1);return/^\s*$/.test(u)?{matchOpenBracket:l}:null}};function hft(a){return a.global&&(a.lastIndex=0),!0}var gft=class{constructor(i){this._indentationRules=i}shouldIncrease(i){return!!(this._indentationRules&&this._indentationRules.increaseIndentPattern&&hft(this._indentationRules.increaseIndentPattern)&&this._indentationRules.increaseIndentPattern.test(i))}shouldDecrease(i){return!!(this._indentationRules&&this._indentationRules.decreaseIndentPattern&&hft(this._indentationRules.decreaseIndentPattern)&&this._indentationRules.decreaseIndentPattern.test(i))}shouldIndentNextLine(i){return!!(this._indentationRules&&this._indentationRules.indentNextLinePattern&&hft(this._indentationRules.indentNextLinePattern)&&this._indentationRules.indentNextLinePattern.test(i))}shouldIgnore(i){return!!(this._indentationRules&&this._indentationRules.unIndentedLinePattern&&hft(this._indentationRules.unIndentedLinePattern)&&this._indentationRules.unIndentedLinePattern.test(i))}getIndentMetadata(i){let e=0;return this.shouldIncrease(i)&&(e+=1),this.shouldDecrease(i)&&(e+=2),this.shouldIndentNextLine(i)&&(e+=4),this.shouldIgnore(i)&&(e+=8),e}};var fft=class a{constructor(i){i=i||{},i.brackets=i.brackets||[["(",")"],["{","}"],["[","]"]],this._brackets=[],i.brackets.forEach(e=>{let t=a._createOpenBracketRegExp(e[0]),o=a._createCloseBracketRegExp(e[1]);t&&o&&this._brackets.push({open:e[0],openRegExp:t,close:e[1],closeRegExp:o})}),this._regExpRules=i.onEnterRules||[]}onEnter(i,e,t,o){if(i>=3)for(let n=0,r=this._regExpRules.length;n<r;n++){let s=this._regExpRules[n];if([{reg:s.beforeText,text:t},{reg:s.afterText,text:o},{reg:s.previousLineText,text:e}].every(c=>c.reg?(c.reg.lastIndex=0,c.reg.test(c.text)):!0))return s.action}if(i>=2&&t.length>0&&o.length>0)for(let n=0,r=this._brackets.length;n<r;n++){let s=this._brackets[n];if(s.openRegExp.test(t)&&s.closeRegExp.test(o))return{indentAction:2}}if(i>=2&&t.length>0){for(let n=0,r=this._brackets.length;n<r;n++)if(this._brackets[n].openRegExp.test(t))return{indentAction:1}}return null}static _createOpenBracketRegExp(i){let e=ns(i);return/\B/.test(e.charAt(0))||(e="\\b"+e),e+="\\s*$",a._safeRegExp(e)}static _createCloseBracketRegExp(i){let e=ns(i);return/\B/.test(e.charAt(e.length-1))||(e=e+"\\b"),e="^\\s*"+e,a._safeRegExp(e)}static _safeRegExp(i){try{return new RegExp(i)}catch(e){return mt(e),null}}};var B=le("configurationService");function bft(a){let i=a;return i&&typeof i=="object"&&(!i.overrideIdentifier||typeof i.overrideIdentifier=="string")&&(!i.resource||i.resource instanceof A)}function q$i(a){let i=a;return i&&typeof i=="object"&&(!i.overrideIdentifiers||Array.isArray(i.overrideIdentifiers))&&!i.overrideIdentifier&&(!i.resource||i.resource instanceof A)}function p7(a){switch(a){case 1:return"APPLICATION";case 2:return"USER";case 3:return"USER_LOCAL";case 4:return"USER_REMOTE";case 5:return"WORKSPACE";case 6:return"WORKSPACE_FOLDER";case 7:return"DEFAULT";case 8:return"MEMORY"}}function rje(a,i){switch(i){case 1:return a.applicationValue;case 2:return a.userValue;case 3:return a.userLocalValue;case 4:return a.userRemoteValue;case 5:return a.workspaceValue;case 6:return a.workspaceFolderValue;case 7:return a.defaultValue;case 8:return a.memoryValue;default:os(i)}}function Rae(a){return a.applicationValue!==void 0||a.userValue!==void 0||a.userLocalValue!==void 0||a.userRemoteValue!==void 0||a.workspaceValue!==void 0||a.workspaceFolderValue!==void 0}function Mae(a,i){let e=Object.create(null);for(let t in a)uei(e,t,a[t],i);return e}function uei(a,i,e,t){let o=i.split("."),n=o.pop(),r=a;for(let s=0;s<o.length;s++){let l=o[s],c=r[l];switch(typeof c){case"undefined":c=r[l]=Object.create(null);break;case"object":if(c===null){t(`Ignoring ${i} as ${o.slice(0,s+1).join(".")} is null`);return}break;default:t(`Ignoring ${i} as ${o.slice(0,s+1).join(".")} is ${JSON.stringify(c)}`);return}r=c}if(typeof r=="object"&&r!==null)try{r[n]=e}catch{t(`Ignoring ${i} as ${o.join(".")} is ${JSON.stringify(r)}`)}else t(`Ignoring ${i} as ${o.join(".")} is ${JSON.stringify(r)}`)}function $$i(a,i){let e=i.split(".");j$i(a,e)}function j$i(a,i){if(!a)return;let e=a,t=i.shift();if(i.length===0){delete e[t];return}if(Object.keys(e).indexOf(t)!==-1){let o=e[t];typeof o=="object"&&!Array.isArray(o)&&(j$i(o,i),Object.keys(o).length===0&&delete e[t])}}function sje(a,i,e){function t(r,s){let l=r;for(let c of s){if(typeof l!="object"||l===null)return;l=l[c]}return l}let o=i.split("."),n=t(a,o);return typeof n>"u"?e:n}function ZIe(a){return a.replace(/^\[/,"").replace(/]$/g,"").replace(/\]\[/g,", ")}var _t=le("languageService");var Ft=class{constructor(i,e=[],t=!1){this.ctor=i,this.staticArguments=e,this.supportsDelayedInstantiation=t}};var Q$i=[];function Ee(a,i,e){i instanceof Ft||(i=new Ft(i,[],!!e)),Q$i.push([a,i])}function Y$i(){return Q$i}var tr=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"}),P0o={".css":"text/css",".csv":"text/csv",".htm":"text/html",".html":"text/html",".ics":"text/calendar",".js":"text/javascript",".mjs":"text/javascript",".txt":"text/plain",".xml":"text/xml"},pei={".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 X$i(a){let i=qm(a),e=P0o[i.toLowerCase()];return e!==void 0?e:GI(a)}function GI(a){let i=qm(a),e=pei[i.toLowerCase()];return Array.isArray(e)?e[0]:e}function yP(a){for(let i in pei){let e=pei[i];if(Array.isArray(e)?e.includes(a):e===a)return i}}var A0o=/^(.+)\/(.+?)(;.+)?$/;function mei(a,i){let e=A0o.exec(a);return e?`${e[1].toLowerCase()}/${e[2].toLowerCase()}${e[3]??""}`:i?void 0:a}function HL(a){return["application/vnd.code.notebook.stdout","application/vnd.code.notebook.stderr"].includes(a)}function J$i(a){let i=!1,e=new Map,t=new Map;if(N0o(a,u=>{if(a===u)return!0;let p=JSON.stringify(u);if(p.length<30)return!0;let h=e.get(p);if(!h){let g={schemas:[u]};return e.set(p,g),t.set(u,g),!0}return h.schemas.push(u),t.set(u,h),i=!0,!1}),e.clear(),!i)return JSON.stringify(a);let n="$defs";for(;a.hasOwnProperty(n);)n+="_";let r=[];function s(u){return JSON.stringify(u,(p,h)=>{if(h!==u){let g=t.get(h);if(g&&g.schemas.length>1)return g.id||(g.id=`_${r.length}`,r.push(g.schemas[0])),{$ref:`#/${n}/${g.id}`}}return h})}let l=s(a),c=[];for(let u=0;u<r.length;u++)c.push(`"_${u}":${s(r[u])}`);return c.length?`${l.substring(0,l.length-1)},"${n}":{${c.join(",")}}}`:l}function eye(a){return typeof a=="object"&&a!==null}function N0o(a,i){if(!a||typeof a!="object")return;let e=(...l)=>{for(let c of l)eye(c)&&r.push(c)},t=(...l)=>{for(let c of l)if(eye(c))for(let u in c){let p=c[u];eye(p)&&r.push(p)}},o=(...l)=>{for(let c of l)if(Array.isArray(c))for(let u of c)eye(u)&&r.push(u)},n=l=>{if(Array.isArray(l))for(let c of l)eye(c)&&r.push(c);else eye(l)&&r.push(l)},r=[a],s=r.pop();for(;s;)i(s)&&(e(s.additionalItems,s.additionalProperties,s.not,s.contains,s.propertyNames,s.if,s.then,s.else,s.unevaluatedItems,s.unevaluatedProperties),t(s.definitions,s.$defs,s.properties,s.patternProperties,s.dependencies,s.dependentSchemas),o(s.anyOf,s.allOf,s.oneOf,s.prefixItems),n(s.items)),s=r.pop()}var ma={JSONContribution:"base.contributions.json"};function Z$i(a){return a.length>0&&a.charAt(a.length-1)==="#"?a.substring(0,a.length-1):a}var hei=class extends x{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,t,o){let n=Z$i(e);this.schemasById[n]=t,this._onDidChangeSchema.fire(e),o&&o.add(Z(()=>{delete this.schemasById[n],this._onDidChangeSchema.fire(e)}))}registerSchemaAssociation(e,t){let o=Z$i(e);return this.schemaAssociations[o]||(this.schemaAssociations[o]=[]),this.schemaAssociations[o].includes(t)||(this.schemaAssociations[o].push(t),this._onDidChangeSchemaAssociations.fire()),Z(()=>{let n=this.schemaAssociations[o];if(n){let r=n.indexOf(t);r!==-1&&(n.splice(r,1),n.length===0&&delete this.schemaAssociations[o],this._onDidChangeSchemaAssociations.fire())}})}notifySchemaChanged(e){this._onDidChangeSchema.fire(e)}getSchemaContributions(){return{schemas:this.schemasById}}getSchemaContent(e){let t=this.schemasById[e];return t?J$i(t):void 0}hasSchemaContent(e){return!!this.schemasById[e]}getSchemaAssociations(){return this.schemaAssociations}},O0o=new hei;ne.add(ma.JSONContribution,O0o);var UL,gei=globalThis.vscode;if(typeof gei<"u"&&typeof gei.context<"u"){let a=gei.context.configuration();if(a)UL=a.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(UL=globalThis._VSCODE_PRODUCT_JSON,$u.VSCODE_DEV&&Object.assign(UL,{nameShort:`${UL.nameShort} Dev`,nameLong:`${UL.nameLong} Dev`,dataFolderName:`${UL.dataFolderName}-dev`,serverDataFolderName:UL.serverDataFolderName?`${UL.serverDataFolderName}-dev`:void 0}),!UL.version){let a=globalThis._VSCODE_PACKAGE_JSON;Object.assign(UL,{version:a.version})}}else UL={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(UL).length===0&&Object.assign(UL,{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 ro=UL;var Jt={Configuration:"base.contributions.configuration"};function vei(a,i){return a===i?!0:!a||!i?!1:typeof a=="string"||typeof i=="string"?a===i:a.id===i.id}var qI={properties:{},patternProperties:{}},tye={properties:{},patternProperties:{}},iye={properties:{},patternProperties:{}},Aae={properties:{},patternProperties:{}},D1={properties:{},patternProperties:{}},L1={properties:{},patternProperties:{}},fO={properties:{},patternProperties:{}},ej="vscode://schemas/settings/resourceLanguage",Ift="vscode://schemas/settings/configurationDefaults",Sft=ne.as(ma.JSONContribution),fei=class extends x{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:d(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={},Sft.registerSchema(ej,this.resourceLanguageSettingsSchema),this.registerOverridePropertyPatternKey()}registerConfiguration(e,t=!0){return this.registerConfigurations([e],t),e}registerConfigurations(e,t=!0){let o=new Set;this.doRegisterConfigurations(e,t,o),Sft.registerSchema(ej,this.resourceLanguageSettingsSchema),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:o})}deregisterConfigurations(e){let t=new Set;this.doDeregisterConfigurations(e,t),Sft.registerSchema(ej,this.resourceLanguageSettingsSchema),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:t})}updateConfigurations({add:e,remove:t}){let o=new Set;this.doDeregisterConfigurations(t,o),this.doRegisterConfigurations(e,!1,o),Sft.registerSchema(ej,this.resourceLanguageSettingsSchema),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:o})}registerDefaultConfigurations(e){let t=new Set;this.doRegisterDefaultConfigurations(e,t),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:t,defaultsOverrides:!0})}doRegisterDefaultConfigurations(e,t){this.registeredConfigurationDefaults.push(...e);let o=[];for(let{overrides:n,source:r}of e)for(let s in n){t.add(s);let l=this.configurationDefaultsOverrides.get(s)??this.configurationDefaultsOverrides.set(s,{configurationDefaultOverrides:[]}).get(s),c=n[s];if(l.configurationDefaultOverrides.push({value:c,source:r}),kg.test(s)){let u=this.mergeDefaultConfigurationsForOverrideIdentifier(s,c,r,l.configurationDefaultOverrideValue);if(!u)continue;l.configurationDefaultOverrideValue=u,this.updateDefaultOverrideProperty(s,u,r),o.push(...R1(s))}else{let u=this.mergeDefaultConfigurationsForConfigurationProperty(s,c,r,l.configurationDefaultOverrideValue);if(!u)continue;l.configurationDefaultOverrideValue=u;let p=this.configurationProperties[s];p&&(this.updatePropertyDefaultValue(s,p),this.updateSchema(s,p))}}this.doRegisterOverrideIdentifiers(o)}deregisterDefaultConfigurations(e){let t=new Set;this.doDeregisterDefaultConfigurations(e,t),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:t,defaultsOverrides:!0})}doDeregisterDefaultConfigurations(e,t){for(let o of e){let n=this.registeredConfigurationDefaults.indexOf(o);n!==-1&&this.registeredConfigurationDefaults.splice(n,1)}for(let{overrides:o,source:n}of e)for(let r in o){let s=this.configurationDefaultsOverrides.get(r);if(!s)continue;let l=s.configurationDefaultOverrides.findIndex(c=>n?vei(c.source,n):c.value===o[r]);if(l!==-1){if(s.configurationDefaultOverrides.splice(l,1),s.configurationDefaultOverrides.length===0&&this.configurationDefaultsOverrides.delete(r),kg.test(r)){let c;for(let u of s.configurationDefaultOverrides)c=this.mergeDefaultConfigurationsForOverrideIdentifier(r,u.value,u.source,c);c&&!Of(c.value)?(s.configurationDefaultOverrideValue=c,this.updateDefaultOverrideProperty(r,c,n)):(this.configurationDefaultsOverrides.delete(r),delete this.configurationProperties[r],delete this.defaultLanguageConfigurationOverridesNode.properties[r])}else{let c;for(let p of s.configurationDefaultOverrides)c=this.mergeDefaultConfigurationsForConfigurationProperty(r,p.value,p.source,c);s.configurationDefaultOverrideValue=c;let u=this.configurationProperties[r];u&&(this.updatePropertyDefaultValue(r,u),this.updateSchema(r,u))}t.add(r)}}this.updateOverridePropertyPatternKey()}updateDefaultOverrideProperty(e,t,o){let n={section:{id:this.defaultLanguageConfigurationOverridesNode.id,title:this.defaultLanguageConfigurationOverridesNode.title,order:this.defaultLanguageConfigurationOverridesNode.order,extensionInfo:this.defaultLanguageConfigurationOverridesNode.extensionInfo},type:"object",default:t.value,description:d(1904,null,ZIe(e)),$ref:ej,defaultDefaultValue:t.value,source:o,defaultValueSource:o};this.configurationProperties[e]=n,this.defaultLanguageConfigurationOverridesNode.properties[e]=n}mergeDefaultConfigurationsForOverrideIdentifier(e,t,o,n){let r=n?.value||{},s=n?.source??new Map;if(!(s instanceof Map)){console.error("objectConfigurationSources is not a Map");return}for(let l of Object.keys(t)){let c=t[l];if(xi(c)&&(gn(r[l])||xi(r[l]))){if(r[l]={...r[l]??{},...c},o)for(let p in c)s.set(`${l}.${p}`,o)}else r[l]=c,o?s.set(l,o):s.delete(l)}return{value:r,source:s}}mergeDefaultConfigurationsForConfigurationProperty(e,t,o,n){let r=this.configurationProperties[e],s=n?.value??r?.defaultDefaultValue,l=o;if(xi(t)&&(r!==void 0&&r.type==="object"||r===void 0&&(gn(s)||xi(s)))){if(l=n?.source??new Map,!(l instanceof Map)){console.error("defaultValueSource is not a Map");return}for(let u in t)o&&l.set(`${e}.${u}`,o);t={...xi(s)?s:{},...t}}return{value:t,source:l}}deltaConfiguration(e){let t=!1,o=new Set;e.removedDefaults&&(this.doDeregisterDefaultConfigurations(e.removedDefaults,o),t=!0),e.addedDefaults&&(this.doRegisterDefaultConfigurations(e.addedDefaults,o),t=!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:t})}notifyConfigurationSchemaUpdated(...e){this._onDidSchemaChange.fire()}registerOverrideIdentifiers(e){this.doRegisterOverrideIdentifiers(e),this._onDidSchemaChange.fire()}doRegisterOverrideIdentifiers(e){for(let t of e)this.overrideIdentifiers.add(t);this.updateOverridePropertyPatternKey()}doRegisterConfigurations(e,t,o){e.forEach(n=>{this.validateAndRegisterProperties(n,t,n.extensionInfo,n.restrictedProperties,void 0,o),this.configurationContributors.push(n),this.registerJSONConfiguration(n)})}doDeregisterConfigurations(e,t){let o=n=>{if(n.properties)for(let r in n.properties){t.add(r);let s=this.configurationProperties[r];s?.policy?.name&&this.policyConfigurations.delete(s.policy.name),delete this.configurationProperties[r],this.removeFromSchema(r,n.properties[r])}n.allOf?.forEach(r=>o(r))};for(let n of e){o(n);let r=this.configurationContributors.indexOf(n);r!==-1&&this.configurationContributors.splice(r,1)}}validateAndRegisterProperties(e,t=!0,o,n,r=4,s){r=nr(e.scope)?r:e.scope;let l=e.properties;if(l)for(let u in l){let p=l[u];if(p.section={id:e.id,title:e.title,order:e.order,extensionInfo:e.extensionInfo},t&&bei(u,p,o?.id)){delete l[u];continue}p.source=o,p.defaultDefaultValue=l[u].default,this.updatePropertyDefaultValue(u,p),kg.test(u)?p.scope=void 0:(p.scope=nr(p.scope)?r:p.scope,p.restricted=nr(p.restricted)?!!n?.includes(u):p.restricted),p.experiment?p.tags?.some(f=>f.toLowerCase()==="onexp")||(p.tags=p.tags??[],p.tags.push("onExP")):p.tags?.some(f=>f.toLowerCase()==="onexp")&&(console.error(`Invalid tag 'onExP' found for property '${u}'. Please use 'experiment' property instead.`),p.experiment={mode:"startup"});let h=l[u].hasOwnProperty("included")&&!l[u].included,g=l[u].policy?.name;h?(this.excludedConfigurationProperties[u]=l[u],g&&(this.policyConfigurations.set(g,u),s.add(u)),delete l[u]):(s.add(u),g&&this.policyConfigurations.set(g,u),this.configurationProperties[u]=l[u],!l[u].deprecationMessage&&l[u].markdownDeprecationMessage&&(l[u].deprecationMessage=l[u].markdownDeprecationMessage))}let c=e.allOf;if(c)for(let u of c)this.validateAndRegisterProperties(u,t,o,n,r,s)}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[t,o]of this.configurationDefaultsOverrides)o.configurationDefaultOverrideValue&&e.set(t,o.configurationDefaultOverrideValue);return e}registerJSONConfiguration(e){let t=o=>{let n=o.properties;if(n)for(let s in n)this.updateSchema(s,n[s]);o.allOf?.forEach(t)};t(e)}updateSchema(e,t){switch(qI.properties[e]=t,t.scope){case 1:tye.properties[e]=t;break;case 2:Aae.properties[e]=t;break;case 3:iye.properties[e]=t;break;case 7:D1.properties[e]=t;break;case 4:L1.properties[e]=t;break;case 5:fO.properties[e]=t;break;case 6:fO.properties[e]=t,this.resourceLanguageSettingsSchema.properties[e]=t;break}}removeFromSchema(e,t){switch(delete qI.properties[e],t.scope){case 1:delete tye.properties[e];break;case 2:delete Aae.properties[e];break;case 3:delete iye.properties[e];break;case 7:delete D1.properties[e];break;case 4:delete L1.properties[e];break;case 5:case 6:delete fO.properties[e],delete this.resourceLanguageSettingsSchema.properties[e];break}}updateOverridePropertyPatternKey(){for(let e of this.overrideIdentifiers.values()){let t=`[${e}]`,o={type:"object",description:d(1906,null),errorMessage:d(1907,null),$ref:ej};this.updatePropertyDefaultValue(t,o),qI.properties[t]=o,tye.properties[t]=o,iye.properties[t]=o,Aae.properties[t]=o,D1.properties[t]=o,L1.properties[t]=o,fO.properties[t]=o}}registerOverridePropertyPatternKey(){let e={type:"object",description:d(1906,null),errorMessage:d(1907,null),$ref:ej};qI.patternProperties[_1]=e,tye.patternProperties[_1]=e,iye.patternProperties[_1]=e,Aae.patternProperties[_1]=e,D1.patternProperties[_1]=e,L1.patternProperties[_1]=e,fO.patternProperties[_1]=e,this._onDidSchemaChange.fire()}updatePropertyDefaultValue(e,t){let o=this.configurationDefaultsOverrides.get(e)?.configurationDefaultOverrideValue,n,r;o&&(!t.disallowConfigurationDefault||!o.source)&&(n=o.value,r=o.source),gn(n)&&(n=t.defaultDefaultValue,r=void 0),gn(n)&&(n=lje(t.type)),t.default=n,t.defaultValueSource=r}},tji="\\[([^\\]]+)\\]",eji=new RegExp(tji,"g"),_1=`^(${tji})+$`,kg=new RegExp(_1);function R1(a){let i=[];if(kg.test(a)){let e=eji.exec(a);for(;e?.length;){let t=e[1].trim();t&&i.push(t),e=eji.exec(a)}}return zo(i)}function yft(a){return a.reduce((i,e)=>`${i}[${e}]`,"")}function lje(a){switch(Array.isArray(a)?a[0]:a){case"boolean":return!1;case"integer":case"number":return 0;case"string":return"";case"array":return[];case"object":return{};default:return null}}var aje=new fei;ne.add(Jt.Configuration,aje);function bei(a,i,e){return a.trim()?kg.test(a)?d(1903,null,a):aje.getConfigurationProperties()[a]!==void 0&&(!e||!Sei.has(e.toLowerCase()))?d(1901,null,a):i.policy?.name&&aje.getPolicyConfigurations().get(i.policy?.name)!==void 0?d(1900,null,a,i.policy?.name,aje.getPolicyConfigurations().get(i.policy?.name)):null:d(1902,null)}function iji(){let a=[],i=aje.getConfigurationProperties();for(let e of Object.keys(i))a.push([e,i[e].scope]);return a.push(["launch",5]),a.push(["task",5]),a}function wft(a){let i={};for(let e of a){let t=e.properties;if(xi(t))for(let o in t)i[o]=t[o];e.allOf&&Object.assign(i,wft(e.allOf))}return i}function Cft(a){switch(a){case"application":return 1;case"machine":return 2;case"resource":return 5;case"machine-overridable":return 7;case"language-overridable":return 6;default:return 4}}var Sei=new Set(ro.defaultChatAgent?[ro.defaultChatAgent.extensionId,ro.defaultChatAgent.chatExtensionId].map(a=>a.toLowerCase()):[]);var F0o={ModesRegistry:"editor.modesRegistry"},Iei=class extends x{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 t=0,o=this._languages.length;t<o;t++)if(this._languages[t]===e){this._languages.splice(t,1);return}}}}getLanguages(){return this._languages}},wP=new Iei;ne.add(F0o.ModesRegistry,wP);var $r="plaintext",cje=".txt";wP.registerLanguage({id:$r,extensions:[cje],aliases:[d(908,null),"text"],mimetypes:[tr.text]});ne.as(Jt.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 xft=class{constructor(i,e){this.languageId=i;let t=e.brackets?oji(e.brackets):[],o=new NI(s=>{let l=new Set;return{info:new yei(this,s,l),closing:l}}),n=new NI(s=>{let l=new Set,c=new Set;return{info:new wei(this,s,l,c),opening:l,openingColorized:c}});for(let[s,l]of t){let c=o.get(s),u=n.get(l);c.closing.add(u.info),u.opening.add(c.info)}let r=e.colorizedBracketPairs?oji(e.colorizedBracketPairs):t.filter(s=>!(s[0]==="<"&&s[1]===">"));for(let[s,l]of r){let c=o.get(s),u=n.get(l);c.closing.add(u.info),u.openingColorized.add(c.info),u.opening.add(c.info)}this._openingBrackets=new Map([...o.cachedValues].map(([s,l])=>[s,l.info])),this._closingBrackets=new Map([...n.cachedValues].map(([s,l])=>[s,l.info]))}get openingBrackets(){return[...this._openingBrackets.values()]}get closingBrackets(){return[...this._closingBrackets.values()]}getOpeningBracketInfo(i){return this._openingBrackets.get(i)}getClosingBracketInfo(i){return this._closingBrackets.get(i)}getBracketInfo(i){return this.getOpeningBracketInfo(i)||this.getClosingBracketInfo(i)}getBracketRegExp(i){let e=Array.from([...this._openingBrackets.keys(),...this._closingBrackets.keys()]);return JIe(e,i)}};function oji(a){return a.filter(([i,e])=>i!==""&&e!=="")}var kft=class{constructor(i,e){this.config=i;this.bracketText=e}get languageId(){return this.config.languageId}},yei=class extends kft{constructor(e,t,o){super(e,t);this.openedBrackets=o;this.isOpeningBracket=!0}},wei=class extends kft{constructor(e,t,o,n){super(e,t);this.openingBrackets=o;this.openingColorizedBrackets=n;this.isOpeningBracket=!1}closes(e){return e.config!==this.config?!1:this.openingBrackets.has(e)}closesColorized(e){return e.config!==this.config?!1:this.openingColorizedBrackets.has(e)}getOpeningBrackets(){return[...this.openingBrackets]}};var uje=class{constructor(i){this.languageId=i}affects(i){return this.languageId?this.languageId===i:!0}},Rs=le("languageConfigurationService"),dje=class extends x{constructor(e,t){super();this.configurationService=e;this.languageService=t;this._registry=this._register(new kei);this.onDidChangeEmitter=this._register(new E);this.onDidChange=this.onDidChangeEmitter.event;this.configurations=new Map;let o=new Set(Object.values(Cei));this._register(this.configurationService.onDidChangeConfiguration(n=>{let r=n.change.keys.some(l=>o.has(l)),s=n.change.overrides.filter(([l,c])=>c.some(u=>o.has(u))).map(([l])=>l);if(r)this.configurations.clear(),this.onDidChangeEmitter.fire(new uje(void 0));else for(let l of s)this.languageService.isRegisteredLanguageId(l)&&(this.configurations.delete(l),this.onDidChangeEmitter.fire(new uje(l)))})),this._register(this._registry.onDidChange(n=>{this.configurations.delete(n.languageId),this.onDidChangeEmitter.fire(new uje(n.languageId))}))}register(e,t,o){return this._registry.register(e,t,o)}getLanguageConfiguration(e){let t=this.configurations.get(e);return t||(t=W0o(e,this._registry,this.configurationService,this.languageService),this.configurations.set(e,t)),t}};dje=I([m(0,B),m(1,_t)],dje);function W0o(a,i,e,t){let o=i.getLanguageConfiguration(a);if(!o){if(!t.isRegisteredLanguageId(a))return new oye(a,{});o=new oye(a,{})}let n=V0o(o.languageId,e),r=rji([o.underlyingConfig,n]);return new oye(o.languageId,r)}var Cei={brackets:"editor.language.brackets",colorizedBracketPairs:"editor.language.colorizedBracketPairs"};function V0o(a,i){let e=i.getValue(Cei.brackets,{overrideIdentifier:a}),t=i.getValue(Cei.colorizedBracketPairs,{overrideIdentifier:a});return{brackets:nji(e),colorizedBracketPairs:nji(t)}}function nji(a){if(Array.isArray(a))return a.map(i=>{if(!(!Array.isArray(i)||i.length!==2))return[i[0],i[1]]}).filter(i=>!!i)}function _ft(a,i,e){let t=a.getLineContent(i),o=Ll(t);return o.length>e-1&&(o=o.substring(0,e-1)),o}var xei=class{constructor(i){this.languageId=i;this._resolved=null;this._entries=[],this._order=0,this._resolved=null}register(i,e){let t=new Eft(i,e,++this._order);return this._entries.push(t),this._resolved=null,im(Z(()=>{for(let o=0;o<this._entries.length;o++)if(this._entries[o]===t){this._entries.splice(o,1),this._resolved=null;break}}))}getResolvedConfiguration(){if(!this._resolved){let i=this._resolve();i&&(this._resolved=new oye(this.languageId,i))}return this._resolved}_resolve(){return this._entries.length===0?null:(this._entries.sort(Eft.cmp),rji(this._entries.map(i=>i.configuration)))}};function rji(a){let i={comments:void 0,brackets:void 0,wordPattern:void 0,indentationRules:void 0,onEnterRules:void 0,autoClosingPairs:void 0,surroundingPairs:void 0,autoCloseBefore:void 0,folding:void 0,colorizedBracketPairs:void 0,__electricCharacterSupport:void 0};for(let e of a)i={comments:e.comments||i.comments,brackets:e.brackets||i.brackets,wordPattern:e.wordPattern||i.wordPattern,indentationRules:e.indentationRules||i.indentationRules,onEnterRules:e.onEnterRules||i.onEnterRules,autoClosingPairs:e.autoClosingPairs||i.autoClosingPairs,surroundingPairs:e.surroundingPairs||i.surroundingPairs,autoCloseBefore:e.autoCloseBefore||i.autoCloseBefore,folding:e.folding||i.folding,colorizedBracketPairs:e.colorizedBracketPairs||i.colorizedBracketPairs,__electricCharacterSupport:e.__electricCharacterSupport||i.__electricCharacterSupport};return i}var Eft=class{constructor(i,e,t){this.configuration=i;this.priority=e;this.order=t}static cmp(i,e){return i.priority===e.priority?i.order-e.order:i.priority-e.priority}},Tft=class{constructor(i){this.languageId=i}},kei=class extends x{constructor(){super();this._entries=new Map;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._register(this.register($r,{brackets:[["(",")"],["[","]"],["{","}"]],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:"<",close:">"},{open:'"',close:'"'},{open:"'",close:"'"},{open:"`",close:"`"}],colorizedBracketPairs:[],folding:{offSide:!0}},0))}register(e,t,o=0){let n=this._entries.get(e);n||(n=new xei(e),this._entries.set(e,n));let r=n.register(t,o);return this._onDidChange.fire(new Tft(e)),im(Z(()=>{r.dispose(),this._onDidChange.fire(new Tft(e))}))}getLanguageConfiguration(e){return this._entries.get(e)?.getResolvedConfiguration()||null}},oye=class a{constructor(i,e){this.languageId=i;this.underlyingConfig=e;this._brackets=null,this._electricCharacter=null,this._onEnterSupport=this.underlyingConfig.brackets||this.underlyingConfig.indentationRules||this.underlyingConfig.onEnterRules?new fft(this.underlyingConfig):null,this.comments=a._handleComments(this.underlyingConfig),this.characterPair=new dft(this.underlyingConfig),this.wordDefinition=this.underlyingConfig.wordPattern||r7,this.indentationRules=this.underlyingConfig.indentationRules,this.underlyingConfig.indentationRules?this.indentRulesSupport=new gft(this.underlyingConfig.indentationRules):this.indentRulesSupport=null,this.foldingRules=this.underlyingConfig.folding||{},this.bracketsNew=new xft(i,this.underlyingConfig)}getWordDefinition(){return Q$(this.wordDefinition)}get brackets(){return!this._brackets&&this.underlyingConfig.brackets&&(this._brackets=new uft(this.languageId,this.underlyingConfig.brackets)),this._brackets}get electricCharacter(){return this._electricCharacter||(this._electricCharacter=new mft(this.brackets)),this._electricCharacter}onEnter(i,e,t,o){return this._onEnterSupport?this._onEnterSupport.onEnter(i,e,t,o):null}getAutoClosingPairs(){return new cft(this.characterPair.getAutoClosingPairs())}getAutoCloseBeforeSet(i){return this.characterPair.getAutoCloseBeforeSet(i)}getSurroundingPairs(){return this.characterPair.getSurroundingPairs()}static _handleComments(i){let e=i.comments;if(!e)return null;let t={};if(e.lineComment&&(typeof e.lineComment=="string"?t.lineCommentToken=e.lineComment:(t.lineCommentToken=e.lineComment.comment,t.lineCommentNoIndent=e.lineComment.noIndent)),e.blockComment){let[o,n]=e.blockComment;t.blockCommentStartToken=o,t.blockCommentEndToken=n}return t}};Ee(Rs,dje,1);var pi=class a{constructor(i,e){this.start=i;this.endExclusive=e;if(i>e)throw new li(`Invalid range: ${this.toString()}`)}static fromTo(i,e){return new a(i,e)}static equals(i,e){return i.start===e.start&&i.endExclusive===e.endExclusive}static addRange(i,e){let t=0;for(;t<e.length&&e[t].endExclusive<i.start;)t++;let o=t;for(;o<e.length&&e[o].start<=i.endExclusive;)o++;if(t===o)e.splice(t,0,i);else{let n=Math.min(i.start,e[t].start),r=Math.max(i.endExclusive,e[o-1].endExclusive);e.splice(t,o-t,new a(n,r))}}static tryCreate(i,e){if(!(i>e))return new a(i,e)}static ofLength(i){return new a(0,i)}static ofStartAndLength(i,e){return new a(i,i+e)}static emptyAt(i){return new a(i,i)}get isEmpty(){return this.start===this.endExclusive}delta(i){return new a(this.start+i,this.endExclusive+i)}deltaStart(i){return new a(this.start+i,this.endExclusive)}deltaEnd(i){return new a(this.start,this.endExclusive+i)}get length(){return this.endExclusive-this.start}toString(){return`[${this.start}, ${this.endExclusive})`}equals(i){return this.start===i.start&&this.endExclusive===i.endExclusive}containsRange(i){return this.start<=i.start&&i.endExclusive<=this.endExclusive}contains(i){return this.start<=i&&i<this.endExclusive}join(i){return new a(Math.min(this.start,i.start),Math.max(this.endExclusive,i.endExclusive))}intersect(i){let e=Math.max(this.start,i.start),t=Math.min(this.endExclusive,i.endExclusive);if(e<=t)return new a(e,t)}intersectionLength(i){let e=Math.max(this.start,i.start),t=Math.min(this.endExclusive,i.endExclusive);return Math.max(0,t-e)}intersects(i){let e=Math.max(this.start,i.start),t=Math.min(this.endExclusive,i.endExclusive);return e<t}intersectsOrTouches(i){let e=Math.max(this.start,i.start),t=Math.min(this.endExclusive,i.endExclusive);return e<=t}isBefore(i){return this.endExclusive<=i.start}isAfter(i){return this.start>=i.endExclusive}slice(i){return i.slice(this.start,this.endExclusive)}substring(i){return i.substring(this.start,this.endExclusive)}clip(i){if(this.isEmpty)throw new li(`Invalid clipping range: ${this.toString()}`);return Math.max(this.start,Math.min(this.endExclusive-1,i))}clipCyclic(i){if(this.isEmpty)throw new li(`Invalid clipping range: ${this.toString()}`);return i<this.start?this.endExclusive-(this.start-i)%this.length:i>=this.endExclusive?this.start+(i-this.start)%this.length:i}map(i){let e=[];for(let t=this.start;t<this.endExclusive;t++)e.push(i(t));return e}forEach(i){for(let e=this.start;e<this.endExclusive;e++)i(e)}joinRightTouching(i){if(this.endExclusive!==i.start)throw new li(`Invalid join: ${this.toString()} and ${i.toString()}`);return new a(this.start,i.endExclusive)}withMargin(i,e){return e===void 0&&(e=i),new a(this.start-i,this.endExclusive+e)}},Dft=class a{constructor(){this._sortedRanges=[]}get ranges(){return[...this._sortedRanges]}addRange(i){let e=0;for(;e<this._sortedRanges.length&&this._sortedRanges[e].endExclusive<i.start;)e++;let t=e;for(;t<this._sortedRanges.length&&this._sortedRanges[t].start<=i.endExclusive;)t++;if(e===t)this._sortedRanges.splice(e,0,i);else{let o=Math.min(i.start,this._sortedRanges[e].start),n=Math.max(i.endExclusive,this._sortedRanges[t-1].endExclusive);this._sortedRanges.splice(e,t-e,new pi(o,n))}}toString(){return this._sortedRanges.map(i=>i.toString()).join(", ")}intersectsStrict(i){let e=0;for(;e<this._sortedRanges.length&&this._sortedRanges[e].endExclusive<=i.start;)e++;return e<this._sortedRanges.length&&this._sortedRanges[e].start<i.endExclusive}intersectWithRange(i){let e=new a;for(let t of this._sortedRanges){let o=t.intersect(i);o&&e.addRange(o)}return e}intersectWithRangeLength(i){return this.intersectWithRange(i).length}get length(){return this._sortedRanges.reduce((i,e)=>i+e.length,0)}};var Zc=class a{constructor(i,e,t){this._lineTokensBrand=void 0;(i.length>1?i[i.length-2]:0)!==e.length&&mt(new Error("Token length and text length do not match!")),this._tokens=i,this._tokensCount=this._tokens.length>>>1,this._text=e,this.languageIdCodec=t}static createEmpty(i,e){let t=a.defaultTokenMetadata,o=new Uint32Array(2);return o[0]=i.length,o[1]=t,new a(o,i,e)}static createFromTextAndMetadata(i,e){let t=0,o="",n=new Array;for(let{text:r,metadata:s}of i)n.push(t+r.length,s),t+=r.length,o+=r;return new a(new Uint32Array(n),o,e)}static convertToEndOffset(i,e){let o=(i.length>>>1)-1;for(let n=0;n<o;n++)i[n<<1]=i[n+1<<1];i[o<<1]=e}static findIndexInTokensArray(i,e){if(i.length<=2)return 0;let t=0,o=(i.length>>>1)-1;for(;t<o;){let n=t+Math.floor((o-t)/2),r=i[n<<1];if(r===e)return n+1;r<e?t=n+1:r>e&&(o=n)}return t}static{this.defaultTokenMetadata=(32768|2<<24)>>>0}getTextLength(){return this._text.length}equals(i){return i instanceof a?this.slicedEquals(i,0,this._tokensCount):!1}slicedEquals(i,e,t){if(this._text!==i._text||this._tokensCount!==i._tokensCount)return!1;let o=e<<1,n=o+(t<<1);for(let r=o;r<n;r++)if(this._tokens[r]!==i._tokens[r])return!1;return!0}getLineContent(){return this._text}getCount(){return this._tokensCount}getStartOffset(i){return i>0?this._tokens[i-1<<1]:0}getMetadata(i){return this._tokens[(i<<1)+1]}getLanguageId(i){let e=this._tokens[(i<<1)+1],t=bp.getLanguageId(e);return this.languageIdCodec.decodeLanguageId(t)}getStandardTokenType(i){let e=this._tokens[(i<<1)+1];return bp.getTokenType(e)}getForeground(i){let e=this._tokens[(i<<1)+1];return bp.getForeground(e)}getClassName(i){let e=this._tokens[(i<<1)+1];return bp.getClassNameFromMetadata(e)}getInlineStyle(i,e){let t=this._tokens[(i<<1)+1];return bp.getInlineStyleFromMetadata(t,e)}getPresentation(i){let e=this._tokens[(i<<1)+1];return bp.getPresentationFromMetadata(e)}getEndOffset(i){return this._tokens[i<<1]}findTokenIndexAtOffset(i){return a.findIndexInTokensArray(this._tokens,i)}inflate(){return this}sliceAndInflate(i,e,t){return new Eei(this,i,e,t)}sliceZeroCopy(i){return this.sliceAndInflate(i.start,i.endExclusive,0)}withInserted(i){if(i.length===0)return this;let e=0,t=0,o="",n=new Array,r=0;for(;;){let s=e<this._tokensCount?this._tokens[e<<1]:-1,l=t<i.length?i[t]:null;if(s!==-1&&(l===null||s<=l.offset)){o+=this._text.substring(r,s);let c=this._tokens[(e<<1)+1];n.push(o.length,c),e++,r=s}else if(l){if(l.offset>r){o+=this._text.substring(r,l.offset);let c=this._tokens[(e<<1)+1];n.push(o.length,c),r=l.offset}o+=l.text,n.push(o.length,l.tokenMetadata),t++}else break}return new a(new Uint32Array(n),o,this.languageIdCodec)}getTokensInRange(i){let e=new Tei,t=this.findTokenIndexAtOffset(i.start),o=this.findTokenIndexAtOffset(i.endExclusive);for(let n=t;n<=o;n++){let s=new pi(this.getStartOffset(n),this.getEndOffset(n)).intersectionLength(i);s>0&&e.add(s,this.getMetadata(n))}return e.build()}getTokenText(i){let e=this.getStartOffset(i),t=this.getEndOffset(i);return this._text.substring(e,t)}forEach(i){let e=this.getCount();for(let t=0;t<e;t++)i(t)}toString(){let i="";return this.forEach(e=>{i+=`[${this.getTokenText(e)}]{${this.getClassName(e)}}`}),i}},Eei=class a{constructor(i,e,t,o){this._source=i,this._startOffset=e,this._endOffset=t,this._deltaOffset=o,this._firstTokenIndex=i.findTokenIndexAtOffset(e),this.languageIdCodec=i.languageIdCodec,this._tokensCount=0;for(let n=this._firstTokenIndex,r=i.getCount();n<r&&!(i.getStartOffset(n)>=t);n++)this._tokensCount++}getMetadata(i){return this._source.getMetadata(this._firstTokenIndex+i)}getLanguageId(i){return this._source.getLanguageId(this._firstTokenIndex+i)}getLineContent(){return this._source.getLineContent().substring(this._startOffset,this._endOffset)}equals(i){return i instanceof a?this._startOffset===i._startOffset&&this._endOffset===i._endOffset&&this._deltaOffset===i._deltaOffset&&this._source.slicedEquals(i._source,this._firstTokenIndex,this._tokensCount):!1}getCount(){return this._tokensCount}getStandardTokenType(i){return this._source.getStandardTokenType(this._firstTokenIndex+i)}getForeground(i){return this._source.getForeground(this._firstTokenIndex+i)}getEndOffset(i){let e=this._source.getEndOffset(this._firstTokenIndex+i);return Math.min(this._endOffset,e)-this._startOffset+this._deltaOffset}getClassName(i){return this._source.getClassName(this._firstTokenIndex+i)}getInlineStyle(i,e){return this._source.getInlineStyle(this._firstTokenIndex+i,e)}getPresentation(i){return this._source.getPresentation(this._firstTokenIndex+i)}findTokenIndexAtOffset(i){return this._source.findTokenIndexAtOffset(i+this._startOffset-this._deltaOffset)-this._firstTokenIndex}getTokenText(i){let e=this._firstTokenIndex+i,t=this._source.getStartOffset(e),o=this._source.getEndOffset(e),n=this._source.getTokenText(e);return t<this._startOffset&&(n=n.substring(this._startOffset-t)),o>this._endOffset&&(n=n.substring(0,n.length-(o-this._endOffset))),n}forEach(i){for(let e=0;e<this.getCount();e++)i(e)}};function sji(a,i){let e=i.lineNumber;if(!a.tokenization.isCheapToTokenize(e))return;a.tokenization.forceTokenization(e);let t=a.tokenization.getLineTokens(e),o=t.findTokenIndexAtOffset(i.column-1);return t.getStandardTokenType(o)}var LV=class a{constructor(i){this._tokenInfo=i}static fromLineTokens(i){let e=[];for(let t=0;t<i.getCount();t++)e.push(new pje(i.getEndOffset(t)-i.getStartOffset(t),i.getMetadata(t)));return a.create(e)}static create(i){return new a(i)}toLineTokens(i,e){return Zc.createFromTextAndMetadata(this.map((t,o)=>({text:t.substring(i),metadata:o.metadata})),e)}forEach(i){let e=0;for(let t of this._tokenInfo){let o=new pi(e,e+t.length);i(o,t),e+=t.length}}map(i){let e=[],t=0;for(let o of this._tokenInfo){let n=new pi(t,t+o.length);e.push(i(n,o)),t+=o.length}return e}slice(i){let e=[],t=0;for(let o of this._tokenInfo){let n=t,r=n+o.length;if(r>i.start){if(n>=i.endExclusive)break;let s=Math.max(0,i.start-n),l=Math.max(0,r-i.endExclusive);e.push(new pje(o.length-s-l,o.metadata))}t+=o.length}return a.create(e)}append(i){let e=this._tokenInfo.concat(i._tokenInfo);return a.create(e)}},pje=class{constructor(i,e){this.length=i;this.metadata=e}},Tei=class{constructor(){this._tokens=[]}add(i,e){this._tokens.push(new pje(i,e))}build(){return LV.create(this._tokens)}};var Fae=class{constructor(i,e,t){this._indentRulesSupport=e,this._indentationLineProcessor=new Lft(i,t)}shouldIncrease(i,e){let t=this._indentationLineProcessor.getProcessedLine(i,e);return this._indentRulesSupport.shouldIncrease(t)}shouldDecrease(i,e){let t=this._indentationLineProcessor.getProcessedLine(i,e);return this._indentRulesSupport.shouldDecrease(t)}shouldIgnore(i,e){let t=this._indentationLineProcessor.getProcessedLine(i,e);return this._indentRulesSupport.shouldIgnore(t)}shouldIndentNextLine(i,e){let t=this._indentationLineProcessor.getProcessedLine(i,e);return this._indentRulesSupport.shouldIndentNextLine(t)}},Wae=class{constructor(i,e){this.model=i,this.indentationLineProcessor=new Lft(i,e)}getProcessedTokenContextAroundRange(i){let e=this._getProcessedTokensBeforeRange(i),t=this._getProcessedTokensAfterRange(i),o=this._getProcessedPreviousLineTokens(i);return{beforeRangeProcessedTokens:e,afterRangeProcessedTokens:t,previousLineProcessedTokens:o}}_getProcessedTokensBeforeRange(i){this.model.tokenization.forceTokenization(i.startLineNumber);let e=this.model.tokenization.getLineTokens(i.startLineNumber),t=E1(e,i.startColumn-1),o;if(Rft(this.model,i.getStartPosition())){let r=i.startColumn-1-t.firstCharOffset,s=t.firstCharOffset,l=s+r;o=e.sliceAndInflate(s,l,0)}else{let r=i.startColumn-1;o=e.sliceAndInflate(0,r,0)}return this.indentationLineProcessor.getProcessedTokens(o)}_getProcessedTokensAfterRange(i){let e=i.isEmpty()?i.getStartPosition():i.getEndPosition();this.model.tokenization.forceTokenization(e.lineNumber);let t=this.model.tokenization.getLineTokens(e.lineNumber),o=E1(t,e.column-1),n=e.column-1-o.firstCharOffset,r=o.firstCharOffset+n,s=o.firstCharOffset+o.getLineLength(),l=t.sliceAndInflate(r,s,0);return this.indentationLineProcessor.getProcessedTokens(l)}_getProcessedPreviousLineTokens(i){let e=g=>{this.model.tokenization.forceTokenization(g);let f=this.model.tokenization.getLineTokens(g),v=this.model.getLineMaxColumn(g)-1;return E1(f,v)};this.model.tokenization.forceTokenization(i.startLineNumber);let t=this.model.tokenization.getLineTokens(i.startLineNumber),o=E1(t,i.startColumn-1),n=Zc.createEmpty("",o.languageIdCodec),r=i.startLineNumber-1;if(r===0||!(o.firstCharOffset===0))return n;let c=e(r);if(!(o.languageId===c.languageId))return n;let p=c.toIViewLineTokens();return this.indentationLineProcessor.getProcessedTokens(p)}},Lft=class{constructor(i,e){this.model=i;this.languageConfigurationService=e}getProcessedLine(i,e){let t=(r,s)=>{let l=Ll(r);return s+r.substring(l.length)};this.model.tokenization.forceTokenization?.(i);let o=this.model.tokenization.getLineTokens(i),n=this.getProcessedTokens(o).getLineContent();return e!==void 0&&(n=t(n,e)),n}getProcessedTokens(i){let e=l=>l===2||l===3||l===1,t=i.getLanguageId(0),n=this.languageConfigurationService.getLanguageConfiguration(t).bracketsNew.getBracketRegExp({global:!0}),r=[];return i.forEach(l=>{let c=i.getStandardTokenType(l),u=i.getTokenText(l);e(c)&&(u=u.replace(n,""));let p=i.getMetadata(l);r.push({text:u,metadata:p})}),Zc.createFromTextAndMetadata(r,i.languageIdCodec)}};function Rft(a,i){a.tokenization.forceTokenization(i.lineNumber);let e=a.tokenization.getLineTokens(i.lineNumber),t=E1(e,i.column-1),o=t.firstCharOffset===0,n=e.getLanguageId(0)===t.languageId;return!o&&!n}function tj(a,i,e,t){i.tokenization.forceTokenization(e.startLineNumber);let o=i.getLanguageIdAtPosition(e.startLineNumber,e.startColumn),n=t.getLanguageConfiguration(o);if(!n)return null;let s=new Wae(i,t).getProcessedTokenContextAroundRange(e),l=s.previousLineProcessedTokens.getLineContent(),c=s.beforeRangeProcessedTokens.getLineContent(),u=s.afterRangeProcessedTokens.getLineContent(),p=n.onEnter(a,l,c,u);if(!p)return null;let h=p.indentAction,g=p.appendText,f=p.removeText||0;g?h===1&&(g="	"+g):h===1||h===2?g="	":g="";let v=_ft(i,e.startLineNumber,e.startColumn);return f&&(v=v.substring(0,v.length-f)),{indentAction:h,appendText:g,removeText:f,indentation:v}}var _ei=Object.create(null);function Vae(a,i){if(i<=0)return"";_ei[a]||(_ei[a]=["",a]);let e=_ei[a];for(let t=e.length;t<=i;t++)e[t]=e[t-1]+a;return e[i]}var lb=class{constructor(i,e,t){this._languageConfigurationService=t;this._opts=e,this._selection=i,this._selectionId=null,this._useLastEditRangeForCursorEndPosition=!1,this._selectionStartColumnStaysPut=!1}static unshiftIndent(i,e,t,o,n){let r=fl.visibleColumnFromColumn(i,e,t);if(n){let s=Vae(" ",o),c=fl.prevIndentTabStop(r,o)/o;return Vae(s,c)}else{let c=fl.prevRenderTabStop(r,t)/t;return Vae("	",c)}}static shiftIndent(i,e,t,o,n){let r=fl.visibleColumnFromColumn(i,e,t);if(n){let s=Vae(" ",o),c=fl.nextIndentTabStop(r,o)/o;return Vae(s,c)}else{let c=fl.nextRenderTabStop(r,t)/t;return Vae("	",c)}}_addEditOperation(i,e,t){this._useLastEditRangeForCursorEndPosition?i.addTrackedEditOperation(e,t):i.addEditOperation(e,t)}getEditOperations(i,e){let t=this._selection.startLineNumber,o=this._selection.endLineNumber;this._selection.endColumn===1&&t!==o&&(o=o-1);let{tabSize:n,indentSize:r,insertSpaces:s}=this._opts,l=t===o;if(this._opts.useTabStops){this._selection.isEmpty()&&/^\s*$/.test(i.getLineContent(t))&&(this._useLastEditRangeForCursorEndPosition=!0);let c=0,u=0;for(let p=t;p<=o;p++,c=u){u=0;let h=i.getLineContent(p),g=nm(h);if(this._opts.isUnshift&&(h.length===0||g===0)||!l&&!this._opts.isUnshift&&h.length===0)continue;if(g===-1&&(g=h.length),p>1&&fl.visibleColumnFromColumn(h,g+1,n)%r!==0&&i.tokenization.isCheapToTokenize(p-1)){let b=tj(this._opts.autoIndent,i,new z(p-1,i.getLineMaxColumn(p-1),p-1,i.getLineMaxColumn(p-1)),this._languageConfigurationService);if(b){if(u=c,b.appendText)for(let S=0,y=b.appendText.length;S<y&&u<r&&b.appendText.charCodeAt(S)===32;S++)u++;b.removeText&&(u=Math.max(0,u-b.removeText));for(let S=0;S<u&&!(g===0||h.charCodeAt(g-1)!==32);S++)g--}}if(this._opts.isUnshift&&g===0)continue;let f;this._opts.isUnshift?f=lb.unshiftIndent(h,g+1,n,r,s):f=lb.shiftIndent(h,g+1,n,r,s),this._addEditOperation(e,new z(p,1,p,g+1),f),p===t&&!this._selection.isEmpty()&&(this._selectionStartColumnStaysPut=this._selection.startColumn<=g+1)}}else{!this._opts.isUnshift&&this._selection.isEmpty()&&i.getLineLength(t)===0&&(this._useLastEditRangeForCursorEndPosition=!0);let c=s?Vae(" ",r):"	";for(let u=t;u<=o;u++){let p=i.getLineContent(u),h=nm(p);if(!(this._opts.isUnshift&&(p.length===0||h===0))&&!(!l&&!this._opts.isUnshift&&p.length===0)&&(h===-1&&(h=p.length),!(this._opts.isUnshift&&h===0)))if(this._opts.isUnshift){h=Math.min(h,r);for(let g=0;g<h;g++)if(p.charCodeAt(g)===9){h=g+1;break}this._addEditOperation(e,new z(u,1,u,h+1),"")}else this._addEditOperation(e,new z(u,1,u,1),c),u===t&&!this._selection.isEmpty()&&(this._selectionStartColumnStaysPut=this._selection.startColumn===1)}}this._selectionId=e.trackSelection(this._selection)}computeCursorState(i,e){if(this._useLastEditRangeForCursorEndPosition){let o=e.getInverseEditOperations()[0];return new ti(o.range.endLineNumber,o.range.endColumn,o.range.endLineNumber,o.range.endColumn)}let t=e.getTrackedSelection(this._selectionId);if(this._selectionStartColumnStaysPut){let o=this._selection.startColumn;return t.startColumn<=o?t:t.getDirection()===0?new ti(t.startLineNumber,o,t.endLineNumber,t.endColumn):new ti(t.endLineNumber,t.endColumn,t.startLineNumber,o)}return t}};lb=I([m(2,Rs)],lb);var Mft=class{constructor(i,e,t){this._range=i,this._charBeforeSelection=e,this._charAfterSelection=t}getEditOperations(i,e){e.addTrackedEditOperation(new z(this._range.startLineNumber,this._range.startColumn,this._range.startLineNumber,this._range.startColumn),this._charBeforeSelection),e.addTrackedEditOperation(new z(this._range.endLineNumber,this._range.endColumn,this._range.endLineNumber,this._range.endColumn),this._charAfterSelection||null)}computeCursorState(i,e){let t=e.getInverseEditOperations(),o=t[0].range,n=t[1].range;return new ti(o.endLineNumber,o.endColumn,n.endLineNumber,n.endColumn-this._charAfterSelection.length)}},Pft=class{constructor(i,e,t){this._position=i;this._text=e;this._charAfter=t}getEditOperations(i,e){e.addTrackedEditOperation(new z(this._position.lineNumber,this._position.column,this._position.lineNumber,this._position.column),this._text+this._charAfter)}computeCursorState(i,e){let o=e.getInverseEditOperations()[0].range;return new ti(o.endLineNumber,o.startColumn,o.endLineNumber,o.endColumn-this._charAfter.length)}};function B0o(a,i,e){let t=a.tokenization.getLanguageIdAtPosition(i,0);if(i>1){let o,n=-1;for(o=i-1;o>=1;o--){if(a.tokenization.getLanguageIdAtPosition(o,0)!==t)return n;let r=a.getLineContent(o);if(e.shouldIgnore(o)||/^\s+$/.test(r)||r===""){n=o;continue}return o}}return-1}function nye(a,i,e,t=!0,o){if(a<4)return null;let n=o.getLanguageConfiguration(i.tokenization.getLanguageId()).indentRulesSupport;if(!n)return null;let r=new Fae(i,n,o);if(e<=1)return{indentation:"",action:null};for(let l=e-1;l>0&&i.getLineContent(l)==="";l--)if(l===1)return{indentation:"",action:null};let s=B0o(i,e,r);if(s<0)return null;if(s<1)return{indentation:"",action:null};if(r.shouldIncrease(s)||r.shouldIndentNextLine(s)){let l=i.getLineContent(s);return{indentation:Ll(l),action:1,line:s}}else if(r.shouldDecrease(s)){let l=i.getLineContent(s);return{indentation:Ll(l),action:null,line:s}}else{if(s===1)return{indentation:Ll(i.getLineContent(s)),action:null,line:s};let l=s-1,c=n.getIndentMetadata(i.getLineContent(l));if(!(c&3)&&c&4){let u=0;for(let p=l-1;p>0;p--)if(!r.shouldIndentNextLine(p)){u=p;break}return{indentation:Ll(i.getLineContent(u+1)),action:null,line:u+1}}if(t)return{indentation:Ll(i.getLineContent(s)),action:null,line:s};for(let u=s;u>0;u--){if(r.shouldIncrease(u))return{indentation:Ll(i.getLineContent(u)),action:1,line:u};if(r.shouldIndentNextLine(u)){let p=0;for(let h=u-1;h>0;h--)if(!r.shouldIndentNextLine(u)){p=h;break}return{indentation:Ll(i.getLineContent(p+1)),action:null,line:p+1}}else if(r.shouldDecrease(u))return{indentation:Ll(i.getLineContent(u)),action:null,line:u}}return{indentation:Ll(i.getLineContent(1)),action:null,line:1}}}function Bae(a,i,e,t,o,n){if(a<4)return null;let r=n.getLanguageConfiguration(e);if(!r)return null;let s=n.getLanguageConfiguration(e).indentRulesSupport;if(!s)return null;let l=new Fae(i,s,n),c=nye(a,i,t,void 0,n);if(c){let u=c.line;if(u!==void 0){let p=!0;for(let h=u;h<t-1;h++)if(!/^\s*$/.test(i.getLineContent(h))){p=!1;break}if(p){let h=r.onEnter(a,"",i.getLineContent(u),"");if(h){let g=Ll(i.getLineContent(u));return h.removeText&&(g=g.substring(0,g.length-h.removeText)),h.indentAction===1||h.indentAction===2?g=o.shiftIndent(g):h.indentAction===3&&(g=o.unshiftIndent(g)),l.shouldDecrease(t)&&(g=o.unshiftIndent(g)),h.appendText&&(g+=h.appendText),Ll(g)}}}return l.shouldDecrease(t)?c.action===1?c.indentation:o.unshiftIndent(c.indentation):c.action===1?o.shiftIndent(c.indentation):c.indentation}return null}function lji(a,i,e,t,o){if(a<4)return null;let n=i.getLanguageIdAtPosition(e.startLineNumber,e.startColumn),r=o.getLanguageConfiguration(n).indentRulesSupport;if(!r)return null;i.tokenization.forceTokenization(e.startLineNumber);let l=new Wae(i,o).getProcessedTokenContextAroundRange(e),c=l.afterRangeProcessedTokens,u=l.beforeRangeProcessedTokens,p=Ll(u.getLineContent()),h=H0o(i,e.startLineNumber,u),g=Rft(i,e.getStartPosition()),f=i.getLineContent(e.startLineNumber),v=Ll(f),b=nye(a,h,e.startLineNumber+1,void 0,o);if(!b){let y=g?v:p;return{beforeEnter:y,afterEnter:y}}let S=g?v:b.indentation;return b.action===1&&(S=t.shiftIndent(S)),r.shouldDecrease(c.getLineContent())&&(S=t.unshiftIndent(S)),{beforeEnter:g?v:p,afterEnter:S}}function cji(a,i,e,t,o,n){let r=a.autoIndent;if(r<4||Rft(i,e.getStartPosition()))return null;let l=i.getLanguageIdAtPosition(e.startLineNumber,e.startColumn),c=n.getLanguageConfiguration(l).indentRulesSupport;if(!c)return null;let p=new Wae(i,n).getProcessedTokenContextAroundRange(e),h=p.beforeRangeProcessedTokens.getLineContent(),g=p.afterRangeProcessedTokens.getLineContent(),f=h+g,v=h+t+g;if(!c.shouldDecrease(f)&&c.shouldDecrease(v)){let S=nye(r,i,e.startLineNumber,!1,n);if(!S)return null;let y=S.indentation;return S.action!==1&&(y=o.unshiftIndent(y)),y}let b=e.startLineNumber-1;if(b>0){let S=i.getLineContent(b);if(c.shouldIndentNextLine(S)&&c.shouldIncrease(v)){let w=nye(r,i,e.startLineNumber,!1,n)?.indentation;if(w!==void 0){let k=i.getLineContent(e.startLineNumber),T=Ll(k),O=o.shiftIndent(w)===T,V=/^\s*$/.test(f),H=a.autoClosingPairs.autoClosingPairsOpenByEnd.get(t),$=H&&H.length>0&&V;if(O&&$)return w}}}return null}function Aft(a,i,e){let t=e.getLanguageConfiguration(a.getLanguageId()).indentRulesSupport;return!t||i<1||i>a.getLineCount()?null:t.getIndentMetadata(a.getLineContent(i))}function H0o(a,i,e){return{tokenization:{getLineTokens:o=>o===i?e:a.tokenization.getLineTokens(o),getLanguageId:()=>a.getLanguageId(),getLanguageIdAtPosition:(o,n)=>a.getLanguageIdAtPosition(o,n)},getLineContent:o=>o===i?e.getLineContent():a.getLineContent(o)}}var Nft=class{static getEdits(i,e,t,o,n){if(!n&&this._isAutoIndentType(i,e,t)){let r=[];for(let l of t){let c=this._findActualIndentationForSelection(i,e,l,o);if(c===null)return;r.push({selection:l,indentation:c})}let s=rye.getAutoClosingPairClose(i,e,t,o,!1);return this._getIndentationAndAutoClosingPairEdits(i,e,r,o,s)}}static _isAutoIndentType(i,e,t){if(i.autoIndent<4)return!1;for(let o=0,n=t.length;o<n;o++)if(!e.tokenization.isCheapToTokenize(t[o].getEndPosition().lineNumber))return!1;return!0}static _findActualIndentationForSelection(i,e,t,o){let n=cji(i,e,t,o,{shiftIndent:s=>hje(i,s),unshiftIndent:s=>aye(i,s)},i.languageConfigurationService);if(n===null)return null;let r=_ft(e,t.startLineNumber,t.startColumn);return n===i.normalizeIndentation(r)?null:n}static _getIndentationAndAutoClosingPairEdits(i,e,t,o,n){let r=t.map(({selection:l,indentation:c})=>{if(n!==null){let u=this._getEditFromIndentationAndSelection(i,e,c,l,o,!1);return new Lei(u,l,o,n)}else{let u=this._getEditFromIndentationAndSelection(i,e,c,l,o,!0);return Hae(u.range,u.text,!1)}}),s={shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!1};return new ab(4,r,s)}static _getEditFromIndentationAndSelection(i,e,t,o,n,r=!0){let s=o.startLineNumber,l=e.getLineFirstNonWhitespaceColumn(s),c=i.normalizeIndentation(t);if(l!==0){let p=e.getLineContent(s);c+=p.substring(l-1,o.startColumn-1)}return c+=r?n:"",{range:new z(s,1,o.endLineNumber,o.endColumn),text:c}}},Oft=class{static getEdits(i,e,t,o,n,r){if(pji(e,t,o,n,r))return this._runAutoClosingOvertype(i,o,r)}static _runAutoClosingOvertype(i,e,t){let o=[];for(let n=0,r=e.length;n<r;n++){let l=e[n].getPosition(),c=new z(l.lineNumber,l.column,l.lineNumber,l.column+1);o[n]=new qh(c,t)}return new ab(4,o,{shouldPushStackElementBefore:Gft(i,4),shouldPushStackElementAfter:!1})}},Fft=class{static getEdits(i,e,t,o,n){if(pji(i,e,t,o,n)){let r=t.map(s=>new qh(new z(s.positionLineNumber,s.positionColumn,s.positionLineNumber,s.positionColumn+1),"",!1));return new ab(4,r,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!1})}}},rye=class{static getEdits(i,e,t,o,n,r){if(!r){let s=this.getAutoClosingPairClose(i,e,t,o,n);if(s!==null)return this._runAutoClosingOpenCharType(t,o,n,s)}}static _runAutoClosingOpenCharType(i,e,t,o){let n=[];for(let r=0,s=i.length;r<s;r++){let l=i[r];n[r]=new Dei(l,e,!t,o)}return new ab(4,n,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!1})}static getAutoClosingPairClose(i,e,t,o,n){for(let f of t)if(!f.isEmpty())return null;let r=t.map(f=>{let v=f.getPosition();return n?{lineNumber:v.lineNumber,beforeColumn:v.column-o.length,afterColumn:v.column}:{lineNumber:v.lineNumber,beforeColumn:v.column,afterColumn:v.column}}),s=this._findAutoClosingPairOpen(i,e,r.map(f=>new ye(f.lineNumber,f.beforeColumn)),o);if(!s)return null;let l,c;if(DV(o)?(l=i.autoClosingQuotes,c=i.shouldAutoCloseBefore.quote):(i.blockCommentStartToken?s.open.includes(i.blockCommentStartToken):!1)?(l=i.autoClosingComments,c=i.shouldAutoCloseBefore.comment):(l=i.autoClosingBrackets,c=i.shouldAutoCloseBefore.bracket),l==="never")return null;let p=this._findContainedAutoClosingPair(i,s),h=p?p.close:"",g=!0;for(let f of r){let{lineNumber:v,beforeColumn:b,afterColumn:S}=f,y=e.getLineContent(v),w=y.substring(0,b-1),k=y.substring(S-1);if(k.startsWith(h)||(g=!1),k.length>0){let V=k.charAt(0);if(!this._isBeforeClosingBrace(i,k)&&!c(V))return null}if(s.open.length===1&&(o==="'"||o==='"')&&l!=="always"){let V=wC(i.wordSeparators,[]);if(w.length>0){let H=w.charCodeAt(w.length-1);if(V.get(H)===0)return null}}if(!e.tokenization.isCheapToTokenize(v))return null;e.tokenization.forceTokenization(v);let T=e.tokenization.getLineTokens(v),P=E1(T,b-1);if(!s.shouldAutoClose(P,b-P.firstCharOffset))return null;let O=s.findNeutralCharacter();if(O){let V=e.tokenization.getTokenTypeIfInsertingCharacter(v,b,O);if(!s.isOK(V))return null}}return g?s.close.substring(0,s.close.length-h.length):s.close}static _findContainedAutoClosingPair(i,e){if(e.open.length<=1)return null;let t=e.close.charAt(e.close.length-1),o=i.autoClosingPairs.autoClosingPairsCloseByEnd.get(t)||[],n=null;for(let r of o)r.open!==e.open&&e.open.includes(r.open)&&e.close.endsWith(r.close)&&(!n||r.open.length>n.open.length)&&(n=r);return n}static _findAutoClosingPairOpen(i,e,t,o){let n=i.autoClosingPairs.autoClosingPairsOpenByEnd.get(o);if(!n)return null;let r=null;for(let s of n)if(r===null||s.open.length>r.open.length){let l=!0;for(let c of t)if(e.getValueInRange(new z(c.lineNumber,c.column-s.open.length+1,c.lineNumber,c.column))+o!==s.open){l=!1;break}l&&(r=s)}return r}static _isBeforeClosingBrace(i,e){let t=e.charAt(0),o=i.autoClosingPairs.autoClosingPairsOpenByStart.get(t)||[],n=i.autoClosingPairs.autoClosingPairsCloseByStart.get(t)||[],r=o.some(l=>e.startsWith(l.open)),s=n.some(l=>e.startsWith(l.close));return!r&&s}},mje=class{static getEdits(i,e){if(!(i.inputMode==="overtype"))return null;let o=e.map(n=>new oft(n.insertedTextRange));return new ab(4,o,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!1})}},Wft=class{static getEdits(i,e,t,o,n){if(!n&&this._isSurroundSelectionType(i,e,t,o))return this._runSurroundSelectionType(i,t,o)}static _runSurroundSelectionType(i,e,t){let o=[];for(let n=0,r=e.length;n<r;n++){let s=e[n],l=i.surroundingPairs[t];o[n]=new Mft(s,t,l)}return new ab(0,o,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!0})}static _isSurroundSelectionType(i,e,t,o){if(!Mei(i,o)||!i.surroundingPairs.hasOwnProperty(o))return!1;let n=DV(o);for(let r of t){if(r.isEmpty())return!1;let s=!0;for(let l=r.startLineNumber;l<=r.endLineNumber;l++){let c=e.getLineContent(l),u=l===r.startLineNumber?r.startColumn-1:0,p=l===r.endLineNumber?r.endColumn-1:c.length,h=c.substring(u,p);if(/[^ \t]/.test(h)){s=!1;break}}if(s)return!1;if(n&&r.startLineNumber===r.endLineNumber&&r.startColumn+1===r.endColumn){let l=e.getValueInRange(r);if(DV(l))return!1}}return!0}},Vft=class{static getEdits(i,e,t,o,n,r){if(!r&&this._isTypeInterceptorElectricChar(e,t,o)){let s=this._typeInterceptorElectricChar(i,e,t,o[0],n);if(s)return s}}static _isTypeInterceptorElectricChar(i,e,t){return!!(t.length===1&&e.tokenization.isCheapToTokenize(t[0].getEndPosition().lineNumber))}static _typeInterceptorElectricChar(i,e,t,o,n){if(!e.electricChars.hasOwnProperty(n)||!o.isEmpty())return null;let r=o.getPosition();t.tokenization.forceTokenization(r.lineNumber);let s=t.tokenization.getLineTokens(r.lineNumber),l;try{l=e.onElectricCharacter(n,s,r.column)}catch(c){return mt(c),null}if(!l)return null;if(l.matchOpenBracket){let c=(s.getLineContent()+n).lastIndexOf(l.matchOpenBracket)+1,u=t.bracketPairs.findMatchingBracketUp(l.matchOpenBracket,{lineNumber:r.lineNumber,column:c},500);if(u){if(u.startLineNumber===r.lineNumber)return null;let p=t.getLineContent(u.startLineNumber),h=Ll(p),g=e.normalizeIndentation(h),f=t.getLineContent(r.lineNumber),v=t.getLineFirstNonWhitespaceColumn(r.lineNumber)||r.column,b=f.substring(v-1,r.column-1),S=g+b+n,y=new z(r.lineNumber,1,r.lineNumber,r.column),w=new qh(y,S);return new ab(Rei(S,i),[w],{shouldPushStackElementBefore:!1,shouldPushStackElementAfter:!0})}}return null}},Bft=class{static getEdits(i,e,t,o,n){let r=[];for(let l=0,c=t.length;l<c;l++){let u=i.inputMode==="overtype"&&!n?qIe:qh;r[l]=new u(t[l],o)}let s=Rei(o,e);return new ab(s,r,{shouldPushStackElementBefore:Gft(e,s),shouldPushStackElementAfter:!1})}},ij=class{static getEdits(i,e,t,o,n){if(!n&&o===`
`){let r=[];for(let s=0,l=t.length;s<l;s++)r[s]=this._enter(i,e,!1,t[s]);return new ab(4,r,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!1})}}static _enter(i,e,t,o){if(i.autoIndent===0)return Hae(o,`
`,t);if(!e.tokenization.isCheapToTokenize(o.getStartPosition().lineNumber)||i.autoIndent===1){let l=e.getLineContent(o.startLineNumber),c=Ll(l).substring(0,o.startColumn-1);return Hae(o,`
`+i.normalizeIndentation(c),t)}let n=tj(i.autoIndent,e,o,i.languageConfigurationService);if(n){if(n.indentAction===0)return Hae(o,`
`+i.normalizeIndentation(n.indentation+n.appendText),t);if(n.indentAction===1)return Hae(o,`
`+i.normalizeIndentation(n.indentation+n.appendText),t);if(n.indentAction===2){let l=i.normalizeIndentation(n.indentation),c=i.normalizeIndentation(n.indentation+n.appendText),u=`
`+c+`
`+l;return t?new Eae(o,u,!0):new Tae(o,u,-1,c.length-l.length,!0)}else if(n.indentAction===3){let l=aye(i,n.indentation);return Hae(o,`
`+i.normalizeIndentation(l+n.appendText),t)}}let r=e.getLineContent(o.startLineNumber),s=Ll(r).substring(0,o.startColumn-1);if(i.autoIndent>=4){let l=lji(i.autoIndent,e,o,{unshiftIndent:c=>aye(i,c),shiftIndent:c=>hje(i,c),normalizeIndentation:c=>i.normalizeIndentation(c)},i.languageConfigurationService);if(l){let c=i.visibleColumnFromColumn(e,o.getEndPosition()),u=o.endColumn,p=e.getLineContent(o.endLineNumber),h=nm(p);if(h>=0?o=o.setEndPosition(o.endLineNumber,Math.max(o.endColumn,h+1)):o=o.setEndPosition(o.endLineNumber,e.getLineMaxColumn(o.endLineNumber)),t)return new Eae(o,`
`+i.normalizeIndentation(l.afterEnter),!0);{let g=0;return u<=h+1&&(i.insertSpaces||(c=Math.ceil(c/i.indentSize)),g=Math.min(c+1-i.normalizeIndentation(l.afterEnter).length-1,0)),new Tae(o,`
`+i.normalizeIndentation(l.afterEnter),0,g,!0)}}}return Hae(o,`
`+i.normalizeIndentation(s),t)}static lineInsertBefore(i,e,t){if(e===null||t===null)return[];let o=[];for(let n=0,r=t.length;n<r;n++){let s=t[n].positionLineNumber;if(s===1)o[n]=new Eae(new z(1,1,1,1),`
`);else{s--;let l=e.getLineMaxColumn(s);o[n]=this._enter(i,e,!1,new z(s,l,s,l))}}return o}static lineInsertAfter(i,e,t){if(e===null||t===null)return[];let o=[];for(let n=0,r=t.length;n<r;n++){let s=t[n].positionLineNumber,l=e.getLineMaxColumn(s);o[n]=this._enter(i,e,!1,new z(s,l,s,l))}return o}static lineBreakInsert(i,e,t){let o=[];for(let n=0,r=t.length;n<r;n++)o[n]=this._enter(i,e,!0,t[n]);return o}},Hft=class{static getEdits(i,e,t,o,n,r){let s=this._distributePasteToCursors(i,t,o,n,r);return s?(t=t.sort(z.compareRangesUsingStarts),this._distributedPaste(i,e,t,s)):this._simplePaste(i,e,t,o,n)}static _distributePasteToCursors(i,e,t,o,n){if(e.length===1)return null;if(n&&n.length===e.length)return n;if(o)return null;if(i.multiCursorPaste==="spread"){t.charCodeAt(t.length-1)===10&&(t=t.substring(0,t.length-1)),t.charCodeAt(t.length-1)===13&&(t=t.substring(0,t.length-1));let r=yc(t);if(r.length===e.length)return r}return null}static _distributedPaste(i,e,t,o){let n=[];for(let r=0,s=t.length;r<s;r++){let c=i.overtypeOnPaste&&i.inputMode==="overtype"?qIe:qh;n[r]=new c(t[r],o[r])}return new ab(0,n,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!0})}static _simplePaste(i,e,t,o,n){let r=[];for(let s=0,l=t.length;s<l;s++){let c=t[s],u=c.getPosition();if(n&&!c.isEmpty()&&(n=!1),n&&o.indexOf(`
`)!==o.length-1&&(n=!1),n){let p=new z(u.lineNumber,1,u.lineNumber,1);r[s]=new l7(p,o,c,!0)}else{let h=i.overtypeOnPaste&&i.inputMode==="overtype"?qIe:qh;r[s]=new h(c,o)}}return new ab(0,r,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!0})}},Uft=class{static getEdits(i,e,t,o,n,r,s,l){let c=o.map(u=>this._compositionType(t,u,n,r,s,l));return new ab(4,c,{shouldPushStackElementBefore:Gft(i,4),shouldPushStackElementAfter:!1})}static _compositionType(i,e,t,o,n,r){if(!e.isEmpty())return null;let s=e.getPosition(),l=Math.max(1,s.column-o),c=Math.min(i.getLineMaxColumn(s.lineNumber),s.column+n),u=new z(s.lineNumber,l,s.lineNumber,c);return new Tae(u,t,0,r)}},zft=class{static getEdits(i,e,t){let o=[];for(let r=0,s=e.length;r<s;r++)o[r]=new qh(e[r],t);let n=Rei(t,i);return new ab(n,o,{shouldPushStackElementBefore:Gft(i,n),shouldPushStackElementAfter:!1})}},Kft=class{static getCommands(i,e,t){let o=[];for(let n=0,r=t.length;n<r;n++){let s=t[n];if(s.isEmpty()){let l=e.getLineContent(s.startLineNumber);if(/^\s*$/.test(l)&&e.tokenization.isCheapToTokenize(s.startLineNumber)){let c=this._goodIndentForLine(i,e,s.startLineNumber);c=c||"	";let u=i.normalizeIndentation(c);if(!l.startsWith(u)){o[n]=new qh(new z(s.startLineNumber,1,s.startLineNumber,l.length+1),u,!0);continue}}o[n]=this._replaceJumpToNextIndent(i,e,s,!0)}else{if(s.startLineNumber===s.endLineNumber){let l=e.getLineMaxColumn(s.startLineNumber);if(s.startColumn!==1||s.endColumn!==l){o[n]=this._replaceJumpToNextIndent(i,e,s,!1);continue}}o[n]=new lb(s,{isUnshift:!1,tabSize:i.tabSize,indentSize:i.indentSize,insertSpaces:i.insertSpaces,useTabStops:i.useTabStops,autoIndent:i.autoIndent},i.languageConfigurationService)}}return o}static _goodIndentForLine(i,e,t){let o=null,n="",r=nye(i.autoIndent,e,t,!1,i.languageConfigurationService);if(r)o=r.action,n=r.indentation;else if(t>1){let s;for(s=t-1;s>=1;s--){let u=e.getLineContent(s);if(hv(u)>=0)break}if(s<1)return null;let l=e.getLineMaxColumn(s),c=tj(i.autoIndent,e,new z(s,l,s,l),i.languageConfigurationService);c&&(n=c.indentation+c.appendText)}return o&&(o===1&&(n=hje(i,n)),o===3&&(n=aye(i,n)),n=i.normalizeIndentation(n)),n||null}static _replaceJumpToNextIndent(i,e,t,o){let n="",r=t.getStartPosition();if(i.insertSpaces){let s=i.visibleColumnFromColumn(e,r),l=i.indentSize,c=l-s%l;for(let u=0;u<c;u++)n+=" "}else n="	";return new qh(t,n,o)}},sye=class extends Tae{constructor(i,e,t,o,n,r){super(i,e,t,o),this._openCharacter=n,this._closeCharacter=r,this.closeCharacterRange=null,this.enclosingRange=null}_computeCursorStateWithRange(i,e,t){return this.closeCharacterRange=new z(e.startLineNumber,e.endColumn-this._closeCharacter.length,e.endLineNumber,e.endColumn),this.enclosingRange=new z(e.startLineNumber,e.endColumn-this._openCharacter.length-this._closeCharacter.length,e.endLineNumber,e.endColumn),super.computeCursorState(i,t)}},Dei=class extends sye{constructor(i,e,t,o){let n=(t?e:"")+o,r=0,s=-o.length;super(i,n,r,s,e,o)}computeCursorState(i,e){let o=e.getInverseEditOperations()[0].range;return this._computeCursorStateWithRange(i,o,e)}},Lei=class extends sye{constructor(i,e,t,o){let n=t+o,r=0,s=t.length;super(e,n,r,s,t,o),this._autoIndentationEdit=i,this._autoClosingEdit={range:e,text:n}}getEditOperations(i,e){e.addTrackedEditOperation(this._autoIndentationEdit.range,this._autoIndentationEdit.text),e.addTrackedEditOperation(this._autoClosingEdit.range,this._autoClosingEdit.text)}computeCursorState(i,e){let t=e.getInverseEditOperations();if(t.length!==2)throw new Error("There should be two inverse edit operations!");let o=t[0].range,n=t[1].range,r=o.plusRange(n);return this._computeCursorStateWithRange(i,r,e)}};function Rei(a,i){return a===" "?i===5||i===6?6:5:4}function Gft(a,i){return uji(a)&&!uji(i)?!0:a===5?!1:dji(a)!==dji(i)}function dji(a){return a===6||a===5?"space":a}function uji(a){return a===4||a===5||a===6}function pji(a,i,e,t,o){if(a.autoClosingOvertype==="never"||!a.autoClosingPairs.autoClosingPairsCloseSingleChar.has(o))return!1;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(!s.isEmpty())return!1;let l=s.getPosition(),c=i.getLineContent(l.lineNumber);if(c.charAt(l.column-1)!==o)return!1;let p=DV(o);if((l.column>2?c.charCodeAt(l.column-2):0)===92&&p)return!1;if(a.autoClosingOvertype==="auto"){let g=!1;for(let f=0,v=t.length;f<v;f++){let b=t[f];if(l.lineNumber===b.startLineNumber&&l.column===b.startColumn){g=!0;break}}if(!g)return!1}}return!0}function Hae(a,i,e){return e?new Eae(a,i,!0):new qh(a,i,!0)}function hje(a,i,e){return e=e||1,lb.shiftIndent(i,i.length+e,a.tabSize,a.indentSize,a.insertSpaces)}function aye(a,i,e){return e=e||1,lb.unshiftIndent(i,i.length+e,a.tabSize,a.indentSize,a.insertSpaces)}function Mei(a,i){return DV(i)?a.autoSurround==="quotes"||a.autoSurround==="languageDefined":a.autoSurround==="brackets"||a.autoSurround==="languageDefined"}var CP=class{static indent(i,e,t){if(e===null||t===null)return[];let o=[];for(let n=0,r=t.length;n<r;n++)o[n]=new lb(t[n],{isUnshift:!1,tabSize:i.tabSize,indentSize:i.indentSize,insertSpaces:i.insertSpaces,useTabStops:i.useTabStops,autoIndent:i.autoIndent},i.languageConfigurationService);return o}static outdent(i,e,t){let o=[];for(let n=0,r=t.length;n<r;n++)o[n]=new lb(t[n],{isUnshift:!0,tabSize:i.tabSize,indentSize:i.indentSize,insertSpaces:i.insertSpaces,useTabStops:i.useTabStops,autoIndent:i.autoIndent},i.languageConfigurationService);return o}static shiftIndent(i,e,t){return hje(i,e,t)}static unshiftIndent(i,e,t){return aye(i,e,t)}static paste(i,e,t,o,n,r){return Hft.getEdits(i,e,t,o,n,r)}static tab(i,e,t){return Kft.getCommands(i,e,t)}static compositionType(i,e,t,o,n,r,s,l){return Uft.getEdits(i,e,t,o,n,r,s,l)}static compositionEndWithInterceptors(i,e,t,o,n,r){if(!o)return null;let s=null;for(let h of o)if(s===null)s=h.insertedText;else if(s!==h.insertedText)return null;if(!s||s.length!==1)return mje.getEdits(e,o);let l=s,c=!1;for(let h of o)if(h.deletedText.length!==0){c=!0;break}if(c){if(!Mei(e,l)||!e.surroundingPairs.hasOwnProperty(l))return null;let h=DV(l);for(let v of o)if(v.deletedSelectionStart!==0||v.deletedSelectionEnd!==v.deletedText.length||/^[ \t]+$/.test(v.deletedText)||h&&DV(v.deletedText))return null;let g=[];for(let v of n){if(!v.isEmpty())return null;g.push(v.getPosition())}if(g.length!==o.length)return null;let f=[];for(let v=0,b=g.length;v<b;v++)f.push(new Pft(g[v],o[v].deletedText,e.surroundingPairs[l]));return new ab(4,f,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!1})}let u=Fft.getEdits(e,t,n,r,l);if(u!==void 0)return u;let p=rye.getEdits(e,t,n,l,!0,!1);return p!==void 0?p:mje.getEdits(e,o)}static typeWithInterceptors(i,e,t,o,n,r,s){let l=ij.getEdits(t,o,n,s,i);if(l!==void 0)return l;let c=Nft.getEdits(t,o,n,s,i);if(c!==void 0)return c;let u=Oft.getEdits(e,t,o,n,r,s);if(u!==void 0)return u;let p=rye.getEdits(t,o,n,s,!1,i);if(p!==void 0)return p;let h=Wft.getEdits(t,o,n,s,i);if(h!==void 0)return h;let g=Vft.getEdits(e,t,o,n,s,i);return g!==void 0?g:Bft.getEdits(t,e,n,s,i)}static typeWithoutInterceptors(i,e,t,o,n){return zft.getEdits(i,o,n)}},qft=class{constructor(i,e,t,o,n,r,s){this.deletedText=i;this.deletedSelectionStart=e;this.deletedSelectionEnd=t;this.insertedText=o;this.insertedSelectionStart=n;this.insertedSelectionEnd=r;this.insertedTextRange=s}};function lye(a){return!!a&&typeof a.id=="string"}var oj={ICodeEditor:"vs.editor.ICodeEditor",IDiffEditor:"vs.editor.IDiffEditor"};var pe;(Ir=>(Ir.editorSimpleInput=new Y("editorSimpleInput",!1,!0),Ir.editorTextFocus=new Y("editorTextFocus",!1,d(840,null)),Ir.focus=new Y("editorFocus",!1,d(813,null)),Ir.textInputFocus=new Y("textInputFocus",!1,d(851,null)),Ir.readOnly=new Y("editorReadonly",!1,d(837,null)),Ir.inDiffEditor=new Y("inDiffEditor",!1,d(842,null)),Ir.isEmbeddedDiffEditor=new Y("isEmbeddedDiffEditor",!1,d(845,null)),Ir.inMultiDiffEditor=new Y("inMultiDiffEditor",!1,d(843,null)),Ir.multiDiffEditorAllCollapsed=new Y("multiDiffEditorAllCollapsed",void 0,d(846,null)),Ir.hasChanges=new Y("diffEditorHasChanges",!1,d(805,null)),Ir.comparingMovedCode=new Y("comparingMovedCode",!1,d(804,null)),Ir.accessibleDiffViewerVisible=new Y("accessibleDiffViewerVisible",!1,d(803,null)),Ir.diffEditorRenderSideBySideInlineBreakpointReached=new Y("diffEditorRenderSideBySideInlineBreakpointReached",!1,d(811,null)),Ir.diffEditorInlineMode=new Y("diffEditorInlineMode",!1,d(806,null)),Ir.diffEditorOriginalWritable=new Y("diffEditorOriginalWritable",!1,d(810,null)),Ir.diffEditorModifiedWritable=new Y("diffEditorModifiedWritable",!1,d(808,null)),Ir.diffEditorOriginalUri=new Y("diffEditorOriginalUri","",d(809,null)),Ir.diffEditorModifiedUri=new Y("diffEditorModifiedUri","",d(807,null)),Ir.columnSelection=new Y("editorColumnSelection",!1,d(812,null)),Ir.writable=Ir.readOnly.toNegated(),Ir.hasNonEmptySelection=new Y("editorHasSelection",!1,d(831,null)),Ir.hasOnlyEmptySelection=Ir.hasNonEmptySelection.toNegated(),Ir.hasMultipleSelections=new Y("editorHasMultipleSelections",!1,d(828,null)),Ir.hasSingleSelection=Ir.hasMultipleSelections.toNegated(),Ir.tabMovesFocus=new Y("editorTabMovesFocus",!1,d(839,null)),Ir.tabDoesNotMoveFocus=Ir.tabMovesFocus.toNegated(),Ir.isInEmbeddedEditor=new Y("isInEmbeddedEditor",!1,!0),Ir.canUndo=new Y("canUndo",!1,!0),Ir.canRedo=new Y("canRedo",!1,!0),Ir.hoverVisible=new Y("editorHoverVisible",!1,d(835,null)),Ir.hoverFocused=new Y("editorHoverFocused",!1,d(834,null)),Ir.stickyScrollFocused=new Y("stickyScrollFocused",!1,d(849,null)),Ir.stickyScrollVisible=new Y("stickyScrollVisible",!1,d(850,null)),Ir.standaloneColorPickerVisible=new Y("standaloneColorPickerVisible",!1,d(848,null)),Ir.standaloneColorPickerFocused=new Y("standaloneColorPickerFocused",!1,d(847,null)),Ir.isComposing=new Y("isComposing",!1,d(844,null)),Ir.inCompositeEditor=new Y("inCompositeEditor",void 0,d(841,null)),Ir.notInCompositeEditor=Ir.inCompositeEditor.toNegated(),Ir.languageId=new Y("editorLangId","",d(836,null)),Ir.hasCompletionItemProvider=new Y("editorHasCompletionItemProvider",!1,d(816,null)),Ir.hasCodeActionsProvider=new Y("editorHasCodeActionsProvider",!1,d(814,null)),Ir.hasCodeLensProvider=new Y("editorHasCodeLensProvider",!1,d(815,null)),Ir.hasDefinitionProvider=new Y("editorHasDefinitionProvider",!1,d(818,null)),Ir.hasDeclarationProvider=new Y("editorHasDeclarationProvider",!1,d(817,null)),Ir.hasImplementationProvider=new Y("editorHasImplementationProvider",!1,d(824,null)),Ir.hasTypeDefinitionProvider=new Y("editorHasTypeDefinitionProvider",!1,d(833,null)),Ir.hasHoverProvider=new Y("editorHasHoverProvider",!1,d(823,null)),Ir.hasDocumentHighlightProvider=new Y("editorHasDocumentHighlightProvider",!1,d(820,null)),Ir.hasDocumentSymbolProvider=new Y("editorHasDocumentSymbolProvider",!1,d(822,null)),Ir.hasReferenceProvider=new Y("editorHasReferenceProvider",!1,d(829,null)),Ir.hasRenameProvider=new Y("editorHasRenameProvider",!1,d(830,null)),Ir.hasSignatureHelpProvider=new Y("editorHasSignatureHelpProvider",!1,d(832,null)),Ir.hasInlayHintsProvider=new Y("editorHasInlayHintsProvider",!1,d(825,null)),Ir.hasDocumentFormattingProvider=new Y("editorHasDocumentFormattingProvider",!1,d(819,null)),Ir.hasDocumentSelectionFormattingProvider=new Y("editorHasDocumentSelectionFormattingProvider",!1,d(821,null)),Ir.hasMultipleDocumentFormattingProvider=new Y("editorHasMultipleDocumentFormattingProvider",!1,d(826,null)),Ir.hasMultipleDocumentSelectionFormattingProvider=new Y("editorHasMultipleDocumentSelectionFormattingProvider",!1,d(827,null)),Ir.selectionHasDiagnostics=new Y("editorSelectionHasDiagnostics",!1,d(838,null))))(pe||={});var $ft=class{constructor(){this.type=0}},jft=class{constructor(){this.type=1}},Qft=class{constructor(i){this.type=2;this._source=i}hasChanged(i){return this._source.hasChanged(i)}},Yft=class{constructor(i,e,t){this.selections=i;this.modelSelections=e;this.reason=t;this.type=3}},M1=class{constructor(i){this.type=4;i?(this.affectsMinimap=i.affectsMinimap,this.affectsOverviewRuler=i.affectsOverviewRuler,this.affectsGlyphMargin=i.affectsGlyphMargin,this.affectsLineNumber=i.affectsLineNumber):(this.affectsMinimap=!0,this.affectsOverviewRuler=!0,this.affectsGlyphMargin=!0,this.affectsLineNumber=!0)}},Uae=class{constructor(){this.type=5}},Xft=class{constructor(i){this.type=6;this.isFocused=i}},Jft=class{constructor(){this.type=7}},zae=class{constructor(){this.type=8}},fje=class{constructor(i,e){this.fromLineNumber=i;this.count=e;this.type=9}},cye=class{constructor(i,e){this.type=10;this.fromLineNumber=i,this.toLineNumber=e}},dye=class{constructor(i,e){this.type=11;this.fromLineNumber=i,this.toLineNumber=e}};var nj=class{constructor(i,e,t,o,n,r,s){this.source=i;this.minimalReveal=e;this.range=t;this.selections=o;this.verticalType=n;this.revealHorizontal=r;this.scrollType=s;this.type=12}},Zft=class{constructor(i){this.type=13;this.scrollWidth=i.scrollWidth,this.scrollLeft=i.scrollLeft,this.scrollHeight=i.scrollHeight,this.scrollTop=i.scrollTop,this.scrollWidthChanged=i.scrollWidthChanged,this.scrollLeftChanged=i.scrollLeftChanged,this.scrollHeightChanged=i.scrollHeightChanged,this.scrollTopChanged=i.scrollTopChanged}},evt=class{constructor(i){this.theme=i;this.type=14}},tvt=class{constructor(i){this.type=15;this.ranges=i}},ivt=class{constructor(){this.type=16}},ovt=class{constructor(){this.type=17}};function Pei(a){let i=a;return typeof i?.resolve=="function"&&typeof i?.isResolved=="function"}function mji(a,i,e){return i?.documentVersion===e?.documentVersion&&a.extUri.isEqual(i?.original,e?.original)&&a.extUri.isEqual(i?.modified,e?.modified)&&$i(i?.changes,e?.changes,(t,o)=>t[0]===o[0]&&t[1]===o[1]&&t[2]===o[2]&&t[3]===o[3])}var tc=0,Tm=class extends Oc{runEditorCommand(i,e,t){let o=e._getViewModel();o&&this.runCoreEditorCommand(o,t||{})}},Jy;(s=>{let a=function(l){if(!xi(l))return!1;let c=l;return!(!Fe(c.to)||!gn(c.by)&&!Fe(c.by)||!gn(c.value)&&!Yo(c.value)||!gn(c.revealCursor)&&!Wa(c.revealCursor))};s.metadata={description:"Scroll editor in the given direction",args:[{name:"Editor scroll argument object",description:"Property-value pairs that can be passed through this argument:\n					* 'to': A mandatory direction value.\n						```\n						'up', 'down'\n						```\n					* 'by': Unit to move. Default is computed based on 'to' value.\n						```\n						'line', 'wrappedLine', 'page', 'halfPage', 'editor'\n						```\n					* 'value': Number of units to move. Default is '1'.\n					* 'revealCursor': If 'true' reveals the cursor if it is outside view port.\n				",constraint:a,schema:{type:"object",required:["to"],properties:{to:{type:"string",enum:["up","down"]},by:{type:"string",enum:["line","wrappedLine","page","halfPage","editor"]},value:{type:"number",default:1},revealCursor:{type:"boolean"}}}}]},s.RawDirection={Up:"up",Right:"right",Down:"down",Left:"left"},s.RawUnit={Line:"line",WrappedLine:"wrappedLine",Page:"page",HalfPage:"halfPage",Editor:"editor",Column:"column"};function o(l){let c;switch(l.to){case s.RawDirection.Up:c=1;break;case s.RawDirection.Right:c=2;break;case s.RawDirection.Down:c=3;break;case s.RawDirection.Left:c=4;break;default:return null}let u;switch(l.by){case s.RawUnit.Line:u=1;break;case s.RawUnit.WrappedLine:u=2;break;case s.RawUnit.Page:u=3;break;case s.RawUnit.HalfPage:u=4;break;case s.RawUnit.Editor:u=5;break;case s.RawUnit.Column:u=6;break;default:u=2}let p=Math.floor(l.value||1),h=!!l.revealCursor;return{direction:c,unit:u,value:p,revealCursor:h,select:!!l.select}}s.parse=o;let n;(h=>(h[h.Up=1]="Up",h[h.Right=2]="Right",h[h.Down=3]="Down",h[h.Left=4]="Left"))(n=s.Direction||={});let r;(f=>(f[f.Line=1]="Line",f[f.WrappedLine=2]="WrappedLine",f[f.Page=3]="Page",f[f.HalfPage=4]="HalfPage",f[f.Editor=5]="Editor",f[f.Column=6]="Column"))(r=s.Unit||={})})(Jy||={});var vje;(t=>{let a=function(o){if(!xi(o))return!1;let n=o;return!(!Yo(n.lineNumber)&&!Fe(n.lineNumber)||!gn(n.at)&&!Fe(n.at))};t.metadata={description:"Reveal the given line at the given logical position",args:[{name:"Reveal line argument object",description:"Property-value pairs that can be passed through this argument:\n					* 'lineNumber': A mandatory line number value.\n					* 'at': Logical position at which line has to be revealed.\n						```\n						'top', 'center', 'bottom'\n						```\n				",constraint:a,schema:{type:"object",required:["lineNumber"],properties:{lineNumber:{type:["number","string"]},at:{type:"string",enum:["top","center","bottom"]}}}}]},t.RawAtArgument={Top:"top",Center:"center",Bottom:"bottom"}})(vje||={});var bje=class{constructor(i){i.addImplementation(1e4,"code-editor",(e,t)=>{let o=e.get(qt).getFocusedCodeEditor();return o&&o.hasTextFocus()?this._runEditorCommand(e,o,t):!1}),i.addImplementation(1e3,"generic-dom-input-textarea",(e,t)=>{let o=Nn();return o&&Kh(o)?(this.runDOMCommand(o),!0):!1}),i.addImplementation(0,"generic-dom",(e,t)=>{let o=e.get(qt).getActiveCodeEditor();return o?(o.focus(),this._runEditorCommand(e,o,t)):!1})}_runEditorCommand(i,e,t){let o=this.runEditorCommand(i,e,t);return o||!0}};var af;(Co=>{class a extends Tm{constructor(Nt){super(Nt),this._inSelectionMode=Nt.inSelectionMode}runCoreEditorCommand(Nt,je){if(!je.position)return;Nt.model.pushStackElement(),Nt.setCursorStates(je.source,3,[sf.moveTo(Nt,Nt.getPrimaryCursorState(),this._inSelectionMode,je.position,je.viewPosition)])&&je.revealType!==2&&Nt.revealAllCursors(je.source,!0,!0)}}Co.MoveTo=Xi(new a({id:"_moveTo",inSelectionMode:!1,precondition:void 0})),Co.MoveToSelect=Xi(new a({id:"_moveToSelect",inSelectionMode:!0,precondition:void 0}));class t extends Tm{runCoreEditorCommand(Nt,je){Nt.model.pushStackElement();let we=this._getColumnSelectResult(Nt,Nt.getPrimaryCursorState(),Nt.getCursorColumnSelectData(),je);we!==null&&(Nt.setCursorStates(je.source,3,we.viewStates.map(Ke=>js.fromViewState(Ke))),Nt.setCursorColumnSelectData({isReal:!0,fromViewLineNumber:we.fromLineNumber,fromViewVisualColumn:we.fromVisualColumn,toViewLineNumber:we.toLineNumber,toViewVisualColumn:we.toVisualColumn}),we.reversed?Nt.revealTopMostCursor(je.source):Nt.revealBottomMostCursor(je.source))}}Co.ColumnSelect=Xi(new class extends t{constructor(){super({id:"columnSelect",precondition:void 0})}_getColumnSelectResult(on,Nt,je,we){if(typeof we.position>"u"||typeof we.viewPosition>"u"||typeof we.mouseColumn>"u")return null;let Ke=on.model.validatePosition(we.position),Lt=on.coordinatesConverter.validateViewPosition(new ye(we.viewPosition.lineNumber,we.viewPosition.column),Ke),Gt=we.doColumnSelect?je.fromViewLineNumber:Lt.lineNumber,Ro=we.doColumnSelect?je.fromViewVisualColumn:we.mouseColumn-1;return a7.columnSelect(on.cursorConfig,on,Gt,Ro,Lt.lineNumber,we.mouseColumn-1)}}),Co.CursorColumnSelectLeft=Xi(new class extends t{constructor(){super({id:"cursorColumnSelectLeft",precondition:void 0,kbOpts:{weight:tc,kbExpr:pe.textInputFocus,primary:3599,linux:{primary:0}}})}_getColumnSelectResult(on,Nt,je,we){return a7.columnSelectLeft(on.cursorConfig,on,je)}}),Co.CursorColumnSelectRight=Xi(new class extends t{constructor(){super({id:"cursorColumnSelectRight",precondition:void 0,kbOpts:{weight:tc,kbExpr:pe.textInputFocus,primary:3601,linux:{primary:0}}})}_getColumnSelectResult(on,Nt,je,we){return a7.columnSelectRight(on.cursorConfig,on,je)}});class s extends t{constructor(Nt){super(Nt),this._isPaged=Nt.isPaged}_getColumnSelectResult(Nt,je,we,Ke){return a7.columnSelectUp(Nt.cursorConfig,Nt,we,this._isPaged)}}Co.CursorColumnSelectUp=Xi(new s({isPaged:!1,id:"cursorColumnSelectUp",precondition:void 0,kbOpts:{weight:tc,kbExpr:pe.textInputFocus,primary:3600,linux:{primary:0}}})),Co.CursorColumnSelectPageUp=Xi(new s({isPaged:!0,id:"cursorColumnSelectPageUp",precondition:void 0,kbOpts:{weight:tc,kbExpr:pe.textInputFocus,primary:3595,linux:{primary:0}}}));class u extends t{constructor(Nt){super(Nt),this._isPaged=Nt.isPaged}_getColumnSelectResult(Nt,je,we,Ke){return a7.columnSelectDown(Nt.cursorConfig,Nt,we,this._isPaged)}}Co.CursorColumnSelectDown=Xi(new u({isPaged:!1,id:"cursorColumnSelectDown",precondition:void 0,kbOpts:{weight:tc,kbExpr:pe.textInputFocus,primary:3602,linux:{primary:0}}})),Co.CursorColumnSelectPageDown=Xi(new u({isPaged:!0,id:"cursorColumnSelectPageDown",precondition:void 0,kbOpts:{weight:tc,kbExpr:pe.textInputFocus,primary:3596,linux:{primary:0}}}));class g extends Tm{constructor(){super({id:"cursorMove",precondition:void 0,metadata:Ls.metadata})}runCoreEditorCommand(Nt,je){let we=Ls.parse(je);we&&this._runCursorMove(Nt,je.source,we)}_runCursorMove(Nt,je,we){let Ke=we.noHistory?"api":je;Nt.model.pushStackElement(),Nt.setCursorStates(Ke,3,g._move(Nt,Nt.getCursorStates(),we)),Nt.revealAllCursors(Ke,!0)}static _move(Nt,je,we){let Ke=we.select,Lt=we.value;switch(we.direction){case Ls.Direction.Left:case Ls.Direction.Right:case Ls.Direction.Up:case Ls.Direction.Down:case Ls.Direction.PrevBlankLine:case Ls.Direction.NextBlankLine:case Ls.Direction.WrappedLineStart:case Ls.Direction.WrappedLineFirstNonWhitespaceCharacter:case Ls.Direction.WrappedLineColumnCenter:case Ls.Direction.WrappedLineEnd:case Ls.Direction.WrappedLineLastNonWhitespaceCharacter:return sf.simpleMove(Nt,je,we.direction,Ke,Lt,we.unit);case Ls.Direction.ViewPortTop:case Ls.Direction.ViewPortBottom:case Ls.Direction.ViewPortCenter:case Ls.Direction.ViewPortIfOutside:return sf.viewportMove(Nt,je,we.direction,Ke,Lt);default:return null}}}Co.CursorMoveImpl=g,Co.CursorMove=Xi(new g);let v;(Nt=>Nt[Nt.PAGE_SIZE_MARKER=-1]="PAGE_SIZE_MARKER")(v||={});class b extends Tm{constructor(Nt){super(Nt),this._staticArgs=Nt.args}runCoreEditorCommand(Nt,je){let we=this._staticArgs;this._staticArgs.value===-1&&(we={direction:this._staticArgs.direction,unit:this._staticArgs.unit,select:this._staticArgs.select,value:je.pageSize||Nt.cursorConfig.pageSize}),Nt.model.pushStackElement(),Nt.setCursorStates(je.source,3,sf.simpleMove(Nt,Nt.getCursorStates(),we.direction,we.select,we.value,we.unit)),Nt.revealAllCursors(je.source,!0)}}Co.CursorLeft=Xi(new b({args:{direction:Ls.Direction.Left,unit:Ls.Unit.None,select:!1,value:1},id:"cursorLeft",precondition:void 0,kbOpts:{weight:tc,kbExpr:pe.textInputFocus,primary:15,mac:{primary:15,secondary:[288]}}})),Co.CursorLeftSelect=Xi(new b({args:{direction:Ls.Direction.Left,unit:Ls.Unit.None,select:!0,value:1},id:"cursorLeftSelect",precondition:void 0,kbOpts:{weight:tc,kbExpr:pe.textInputFocus,primary:1039}})),Co.CursorRight=Xi(new b({args:{direction:Ls.Direction.Right,unit:Ls.Unit.None,select:!1,value:1},id:"cursorRight",precondition:void 0,kbOpts:{weight:tc,kbExpr:pe.textInputFocus,primary:17,mac:{primary:17,secondary:[292]}}})),Co.CursorRightSelect=Xi(new b({args:{direction:Ls.Direction.Right,unit:Ls.Unit.None,select:!0,value:1},id:"cursorRightSelect",precondition:void 0,kbOpts:{weight:tc,kbExpr:pe.textInputFocus,primary:1041}})),Co.CursorUp=Xi(new b({args:{direction:Ls.Direction.Up,unit:Ls.Unit.WrappedLine,select:!1,value:1},id:"cursorUp",precondition:void 0,kbOpts:{weight:tc,kbExpr:pe.textInputFocus,primary:16,mac:{primary:16,secondary:[302]}}})),Co.CursorUpSelect=Xi(new b({args:{direction:Ls.Direction.Up,unit:Ls.Unit.WrappedLine,select:!0,value:1},id:"cursorUpSelect",precondition:void 0,kbOpts:{weight:tc,kbExpr:pe.textInputFocus,primary:1040,secondary:[3088],mac:{primary:1040},linux:{primary:1040}}})),Co.CursorPageUp=Xi(new b({args:{direction:Ls.Direction.Up,unit:Ls.Unit.WrappedLine,select:!1,value:-1},id:"cursorPageUp",precondition:void 0,kbOpts:{weight:tc,kbExpr:pe.textInputFocus,primary:11}})),Co.CursorPageUpSelect=Xi(new b({args:{direction:Ls.Direction.Up,unit:Ls.Unit.WrappedLine,select:!0,value:-1},id:"cursorPageUpSelect",precondition:void 0,kbOpts:{weight:tc,kbExpr:pe.textInputFocus,primary:1035}})),Co.CursorDown=Xi(new b({args:{direction:Ls.Direction.Down,unit:Ls.Unit.WrappedLine,select:!1,value:1},id:"cursorDown",precondition:void 0,kbOpts:{weight:tc,kbExpr:pe.textInputFocus,primary:18,mac:{primary:18,secondary:[300]}}})),Co.CursorDownSelect=Xi(new b({args:{direction:Ls.Direction.Down,unit:Ls.Unit.WrappedLine,select:!0,value:1},id:"cursorDownSelect",precondition:void 0,kbOpts:{weight:tc,kbExpr:pe.textInputFocus,primary:1042,secondary:[3090],mac:{primary:1042},linux:{primary:1042}}})),Co.CursorPageDown=Xi(new b({args:{direction:Ls.Direction.Down,unit:Ls.Unit.WrappedLine,select:!1,value:-1},id:"cursorPageDown",precondition:void 0,kbOpts:{weight:tc,kbExpr:pe.textInputFocus,primary:12}})),Co.CursorPageDownSelect=Xi(new b({args:{direction:Ls.Direction.Down,unit:Ls.Unit.WrappedLine,select:!0,value:-1},id:"cursorPageDownSelect",precondition:void 0,kbOpts:{weight:tc,kbExpr:pe.textInputFocus,primary:1036}})),Co.CreateCursor=Xi(new class extends Tm{constructor(){super({id:"createCursor",precondition:void 0})}runCoreEditorCommand(on,Nt){if(!Nt.position)return;let je;Nt.wholeLine?je=sf.line(on,on.getPrimaryCursorState(),!1,Nt.position,Nt.viewPosition):je=sf.moveTo(on,on.getPrimaryCursorState(),!1,Nt.position,Nt.viewPosition);let we=on.getCursorStates();if(we.length>1){let Ke=je.modelState?je.modelState.position:null,Lt=je.viewState?je.viewState.position:null;for(let Gt=0,Ro=we.length;Gt<Ro;Gt++){let so=we[Gt];if(!(Ke&&!so.modelState.selection.containsPosition(Ke))&&!(Lt&&!so.viewState.selection.containsPosition(Lt))){we.splice(Gt,1),on.model.pushStackElement(),on.setCursorStates(Nt.source,3,we);return}}}we.push(je),on.model.pushStackElement(),on.setCursorStates(Nt.source,3,we)}}),Co.LastCursorMoveToSelect=Xi(new class extends Tm{constructor(){super({id:"_lastCursorMoveToSelect",precondition:void 0})}runCoreEditorCommand(on,Nt){if(!Nt.position)return;let je=on.getLastAddedCursorIndex(),we=on.getCursorStates(),Ke=we.slice(0);Ke[je]=sf.moveTo(on,we[je],!0,Nt.position,Nt.viewPosition),on.model.pushStackElement(),on.setCursorStates(Nt.source,3,Ke)}});class oe extends Tm{constructor(Nt){super(Nt),this._inSelectionMode=Nt.inSelectionMode}runCoreEditorCommand(Nt,je){Nt.model.pushStackElement(),Nt.setCursorStates(je.source,3,sf.moveToBeginningOfLine(Nt,Nt.getCursorStates(),this._inSelectionMode)),Nt.revealAllCursors(je.source,!0)}}Co.CursorHome=Xi(new oe({inSelectionMode:!1,id:"cursorHome",precondition:void 0,kbOpts:{weight:tc,kbExpr:pe.textInputFocus,primary:14,mac:{primary:14,secondary:[2063]}}})),Co.CursorHomeSelect=Xi(new oe({inSelectionMode:!0,id:"cursorHomeSelect",precondition:void 0,kbOpts:{weight:tc,kbExpr:pe.textInputFocus,primary:1038,mac:{primary:1038,secondary:[3087]}}}));class xe extends Tm{constructor(Nt){super(Nt),this._inSelectionMode=Nt.inSelectionMode}runCoreEditorCommand(Nt,je){Nt.model.pushStackElement(),Nt.setCursorStates(je.source,3,this._exec(Nt.getCursorStates())),Nt.revealAllCursors(je.source,!0)}_exec(Nt){let je=[];for(let we=0,Ke=Nt.length;we<Ke;we++){let Lt=Nt[we],Gt=Lt.modelState.position.lineNumber;je[we]=js.fromModelState(Lt.modelState.move(this._inSelectionMode,Gt,1,0))}return je}}Co.CursorLineStart=Xi(new xe({inSelectionMode:!1,id:"cursorLineStart",precondition:void 0,kbOpts:{weight:tc,kbExpr:pe.textInputFocus,primary:0,mac:{primary:287}}})),Co.CursorLineStartSelect=Xi(new xe({inSelectionMode:!0,id:"cursorLineStartSelect",precondition:void 0,kbOpts:{weight:tc,kbExpr:pe.textInputFocus,primary:0,mac:{primary:1311}}}));class Oe extends Tm{constructor(Nt){super(Nt),this._inSelectionMode=Nt.inSelectionMode}runCoreEditorCommand(Nt,je){Nt.model.pushStackElement(),Nt.setCursorStates(je.source,3,sf.moveToEndOfLine(Nt,Nt.getCursorStates(),this._inSelectionMode,je.sticky||!1)),Nt.revealAllCursors(je.source,!0)}}Co.CursorEnd=Xi(new Oe({inSelectionMode:!1,id:"cursorEnd",precondition:void 0,kbOpts:{args:{sticky:!1},weight:tc,kbExpr:pe.textInputFocus,primary:13,mac:{primary:13,secondary:[2065]}},metadata:{description:"Go to End",args:[{name:"args",schema:{type:"object",properties:{sticky:{description:d(182,null),type:"boolean",default:!1}}}}]}})),Co.CursorEndSelect=Xi(new Oe({inSelectionMode:!0,id:"cursorEndSelect",precondition:void 0,kbOpts:{args:{sticky:!1},weight:tc,kbExpr:pe.textInputFocus,primary:1037,mac:{primary:1037,secondary:[3089]}},metadata:{description:"Select to End",args:[{name:"args",schema:{type:"object",properties:{sticky:{description:d(182,null),type:"boolean",default:!1}}}}]}}));class Ti extends Tm{constructor(Nt){super(Nt),this._inSelectionMode=Nt.inSelectionMode}runCoreEditorCommand(Nt,je){Nt.model.pushStackElement(),Nt.setCursorStates(je.source,3,this._exec(Nt,Nt.getCursorStates())),Nt.revealAllCursors(je.source,!0)}_exec(Nt,je){let we=[];for(let Ke=0,Lt=je.length;Ke<Lt;Ke++){let Gt=je[Ke],Ro=Gt.modelState.position.lineNumber,so=Nt.model.getLineMaxColumn(Ro);we[Ke]=js.fromModelState(Gt.modelState.move(this._inSelectionMode,Ro,so,0))}return we}}Co.CursorLineEnd=Xi(new Ti({inSelectionMode:!1,id:"cursorLineEnd",precondition:void 0,kbOpts:{weight:tc,kbExpr:pe.textInputFocus,primary:0,mac:{primary:291}}})),Co.CursorLineEndSelect=Xi(new Ti({inSelectionMode:!0,id:"cursorLineEndSelect",precondition:void 0,kbOpts:{weight:tc,kbExpr:pe.textInputFocus,primary:0,mac:{primary:1315}}}));class Vo extends Tm{constructor(Nt){super(Nt),this._inSelectionMode=Nt.inSelectionMode}runCoreEditorCommand(Nt,je){Nt.model.pushStackElement(),Nt.setCursorStates(je.source,3,sf.moveToBeginningOfBuffer(Nt,Nt.getCursorStates(),this._inSelectionMode)),Nt.revealAllCursors(je.source,!0)}}Co.CursorTop=Xi(new Vo({inSelectionMode:!1,id:"cursorTop",precondition:void 0,kbOpts:{weight:tc,kbExpr:pe.textInputFocus,primary:2062,mac:{primary:2064}}})),Co.CursorTopSelect=Xi(new Vo({inSelectionMode:!0,id:"cursorTopSelect",precondition:void 0,kbOpts:{weight:tc,kbExpr:pe.textInputFocus,primary:3086,mac:{primary:3088}}}));class mn extends Tm{constructor(Nt){super(Nt),this._inSelectionMode=Nt.inSelectionMode}runCoreEditorCommand(Nt,je){Nt.model.pushStackElement(),Nt.setCursorStates(je.source,3,sf.moveToEndOfBuffer(Nt,Nt.getCursorStates(),this._inSelectionMode)),Nt.revealAllCursors(je.source,!0)}}Co.CursorBottom=Xi(new mn({inSelectionMode:!1,id:"cursorBottom",precondition:void 0,kbOpts:{weight:tc,kbExpr:pe.textInputFocus,primary:2061,mac:{primary:2066}}})),Co.CursorBottomSelect=Xi(new mn({inSelectionMode:!0,id:"cursorBottomSelect",precondition:void 0,kbOpts:{weight:tc,kbExpr:pe.textInputFocus,primary:3085,mac:{primary:3090}}}));class Mr extends Tm{constructor(){super({id:"editorScroll",precondition:void 0,metadata:Jy.metadata})}determineScrollMethod(Nt){let je=[6],we=[1,2,3,4,5],Ke=[4,2],Lt=[1,3];return je.includes(Nt.unit)&&Ke.includes(Nt.direction)?this._runHorizontalEditorScroll.bind(this):we.includes(Nt.unit)&&Lt.includes(Nt.direction)?this._runVerticalEditorScroll.bind(this):null}runCoreEditorCommand(Nt,je){let we=Jy.parse(je);if(!we)return;let Ke=this.determineScrollMethod(we);Ke&&Ke(Nt,je.source,we)}_runVerticalEditorScroll(Nt,je,we){let Ke=this._computeDesiredScrollTop(Nt,we);if(we.revealCursor){let Lt=Nt.getCompletelyVisibleViewRangeAtScrollTop(Ke),Gt=Nt.getViewRangeWithCursorPadding(Lt);Nt.setCursorStates(je,3,[sf.findPositionInViewportIfOutside(Nt,Nt.getPrimaryCursorState(),Gt,we.select)])}Nt.viewLayout.setScrollPosition({scrollTop:Ke},0)}_computeDesiredScrollTop(Nt,je){if(je.unit===1){let Lt=Nt.viewLayout.getFutureViewport(),Gt=Nt.getCompletelyVisibleViewRangeAtScrollTop(Lt.top),Ro=Nt.coordinatesConverter.convertViewRangeToModelRange(Gt),so;je.direction===1?so=Math.max(1,Ro.startLineNumber-je.value):so=Math.min(Nt.model.getLineCount(),Ro.startLineNumber+je.value);let Pr=Nt.coordinatesConverter.convertModelPositionToViewPosition(new ye(so,1));return Nt.viewLayout.getVerticalOffsetForLineNumber(Pr.lineNumber)}if(je.unit===5){let Lt=0;return je.direction===3&&(Lt=Nt.model.getLineCount()-Nt.cursorConfig.pageSize),Nt.viewLayout.getVerticalOffsetForLineNumber(Lt)}let we;je.unit===3?we=Nt.cursorConfig.pageSize*je.value:je.unit===4?we=Math.round(Nt.cursorConfig.pageSize/2)*je.value:we=je.value;let Ke=(je.direction===1?-1:1)*we;return Nt.viewLayout.getCurrentScrollTop()+Ke*Nt.cursorConfig.lineHeight}_runHorizontalEditorScroll(Nt,je,we){let Ke=this._computeDesiredScrollLeft(Nt,we);Nt.viewLayout.setScrollPosition({scrollLeft:Ke},0)}_computeDesiredScrollLeft(Nt,je){let we=(je.direction===4?-1:1)*je.value;return Nt.viewLayout.getCurrentScrollLeft()+we*Nt.cursorConfig.typicalHalfwidthCharacterWidth}}Co.EditorScrollImpl=Mr,Co.EditorScroll=Xi(new Mr),Co.ScrollLineUp=Xi(new class extends Tm{constructor(){super({id:"scrollLineUp",precondition:void 0,kbOpts:{weight:tc,kbExpr:pe.textInputFocus,primary:2064,mac:{primary:267}}})}runCoreEditorCommand(on,Nt){Co.EditorScroll.runCoreEditorCommand(on,{to:Jy.RawDirection.Up,by:Jy.RawUnit.WrappedLine,value:1,revealCursor:!1,select:!1,source:Nt.source})}}),Co.ScrollPageUp=Xi(new class extends Tm{constructor(){super({id:"scrollPageUp",precondition:void 0,kbOpts:{weight:tc,kbExpr:pe.textInputFocus,primary:2059,win:{primary:523},linux:{primary:523}}})}runCoreEditorCommand(on,Nt){Co.EditorScroll.runCoreEditorCommand(on,{to:Jy.RawDirection.Up,by:Jy.RawUnit.Page,value:1,revealCursor:!1,select:!1,source:Nt.source})}}),Co.ScrollEditorTop=Xi(new class extends Tm{constructor(){super({id:"scrollEditorTop",precondition:void 0,kbOpts:{weight:tc,kbExpr:pe.textInputFocus}})}runCoreEditorCommand(on,Nt){Co.EditorScroll.runCoreEditorCommand(on,{to:Jy.RawDirection.Up,by:Jy.RawUnit.Editor,value:1,revealCursor:!1,select:!1,source:Nt.source})}}),Co.ScrollLineDown=Xi(new class extends Tm{constructor(){super({id:"scrollLineDown",precondition:void 0,kbOpts:{weight:tc,kbExpr:pe.textInputFocus,primary:2066,mac:{primary:268}}})}runCoreEditorCommand(on,Nt){Co.EditorScroll.runCoreEditorCommand(on,{to:Jy.RawDirection.Down,by:Jy.RawUnit.WrappedLine,value:1,revealCursor:!1,select:!1,source:Nt.source})}}),Co.ScrollPageDown=Xi(new class extends Tm{constructor(){super({id:"scrollPageDown",precondition:void 0,kbOpts:{weight:tc,kbExpr:pe.textInputFocus,primary:2060,win:{primary:524},linux:{primary:524}}})}runCoreEditorCommand(on,Nt){Co.EditorScroll.runCoreEditorCommand(on,{to:Jy.RawDirection.Down,by:Jy.RawUnit.Page,value:1,revealCursor:!1,select:!1,source:Nt.source})}}),Co.ScrollEditorBottom=Xi(new class extends Tm{constructor(){super({id:"scrollEditorBottom",precondition:void 0,kbOpts:{weight:tc,kbExpr:pe.textInputFocus}})}runCoreEditorCommand(on,Nt){Co.EditorScroll.runCoreEditorCommand(on,{to:Jy.RawDirection.Down,by:Jy.RawUnit.Editor,value:1,revealCursor:!1,select:!1,source:Nt.source})}}),Co.ScrollLeft=Xi(new class extends Tm{constructor(){super({id:"scrollLeft",precondition:void 0,kbOpts:{weight:tc,kbExpr:pe.textInputFocus}})}runCoreEditorCommand(on,Nt){Co.EditorScroll.runCoreEditorCommand(on,{to:Jy.RawDirection.Left,by:Jy.RawUnit.Column,value:2,revealCursor:!1,select:!1,source:Nt.source})}}),Co.ScrollRight=Xi(new class extends Tm{constructor(){super({id:"scrollRight",precondition:void 0,kbOpts:{weight:tc,kbExpr:pe.textInputFocus}})}runCoreEditorCommand(on,Nt){Co.EditorScroll.runCoreEditorCommand(on,{to:Jy.RawDirection.Right,by:Jy.RawUnit.Column,value:2,revealCursor:!1,select:!1,source:Nt.source})}});class Lx extends Tm{constructor(Nt){super(Nt),this._inSelectionMode=Nt.inSelectionMode}runCoreEditorCommand(Nt,je){je.position&&(Nt.model.pushStackElement(),Nt.setCursorStates(je.source,3,[sf.word(Nt,Nt.getPrimaryCursorState(),this._inSelectionMode,je.position)]),je.revealType!==2&&Nt.revealAllCursors(je.source,!0,!0))}}Co.WordSelect=Xi(new Lx({inSelectionMode:!1,id:"_wordSelect",precondition:void 0})),Co.WordSelectDrag=Xi(new Lx({inSelectionMode:!0,id:"_wordSelectDrag",precondition:void 0})),Co.LastCursorWordSelect=Xi(new class extends Tm{constructor(){super({id:"lastCursorWordSelect",precondition:void 0})}runCoreEditorCommand(on,Nt){if(!Nt.position)return;let je=on.getLastAddedCursorIndex(),we=on.getCursorStates(),Ke=we.slice(0),Lt=we[je];Ke[je]=sf.word(on,Lt,Lt.modelState.hasSelection(),Nt.position),on.model.pushStackElement(),on.setCursorStates(Nt.source,3,Ke)}});class Af extends Tm{constructor(Nt){super(Nt),this._inSelectionMode=Nt.inSelectionMode}runCoreEditorCommand(Nt,je){je.position&&(Nt.model.pushStackElement(),Nt.setCursorStates(je.source,3,[sf.line(Nt,Nt.getPrimaryCursorState(),this._inSelectionMode,je.position,je.viewPosition)]),je.revealType!==2&&Nt.revealAllCursors(je.source,!1,!0))}}Co.LineSelect=Xi(new Af({inSelectionMode:!1,id:"_lineSelect",precondition:void 0})),Co.LineSelectDrag=Xi(new Af({inSelectionMode:!0,id:"_lineSelectDrag",precondition:void 0}));class Rx extends Tm{constructor(Nt){super(Nt),this._inSelectionMode=Nt.inSelectionMode}runCoreEditorCommand(Nt,je){if(!je.position)return;let we=Nt.getLastAddedCursorIndex(),Ke=Nt.getCursorStates(),Lt=Ke.slice(0);Lt[we]=sf.line(Nt,Ke[we],this._inSelectionMode,je.position,je.viewPosition),Nt.model.pushStackElement(),Nt.setCursorStates(je.source,3,Lt)}}Co.LastCursorLineSelect=Xi(new Rx({inSelectionMode:!1,id:"lastCursorLineSelect",precondition:void 0})),Co.LastCursorLineSelectDrag=Xi(new Rx({inSelectionMode:!0,id:"lastCursorLineSelectDrag",precondition:void 0})),Co.CancelSelection=Xi(new class extends Tm{constructor(){super({id:"cancelSelection",precondition:pe.hasNonEmptySelection,kbOpts:{weight:tc,kbExpr:pe.textInputFocus,primary:9,secondary:[1033]}})}runCoreEditorCommand(on,Nt){on.model.pushStackElement(),on.setCursorStates(Nt.source,3,[sf.cancelSelection(on,on.getPrimaryCursorState())]),on.revealAllCursors(Nt.source,!0)}}),Co.RemoveSecondaryCursors=Xi(new class extends Tm{constructor(){super({id:"removeSecondaryCursors",precondition:pe.hasMultipleSelections,kbOpts:{weight:tc+1,kbExpr:pe.textInputFocus,primary:9,secondary:[1033]}})}runCoreEditorCommand(on,Nt){on.model.pushStackElement(),on.setCursorStates(Nt.source,3,[on.getPrimaryCursorState()]),on.revealAllCursors(Nt.source,!0),qr(d(181,null))}}),Co.RevealLine=Xi(new class extends Tm{constructor(){super({id:"revealLine",precondition:void 0,metadata:vje.metadata})}runCoreEditorCommand(on,Nt){let je=Nt,we=je.lineNumber||0,Ke=typeof we=="number"?we+1:parseInt(we)+1;Ke<1&&(Ke=1);let Lt=on.model.getLineCount();Ke>Lt&&(Ke=Lt);let Gt=new z(Ke,1,Ke,on.model.getLineMaxColumn(Ke)),Ro=0;if(je.at)switch(je.at){case vje.RawAtArgument.Top:Ro=3;break;case vje.RawAtArgument.Center:Ro=1;break;case vje.RawAtArgument.Bottom:Ro=4;break;default:break}let so=on.coordinatesConverter.convertModelRangeToViewRange(Gt);on.revealRange(Nt.source,!1,so,Ro,0)}}),Co.SelectAll=new class extends bje{constructor(){super(Qgt)}runDOMCommand(on){Ac&&(on.focus(),on.select()),on.ownerDocument.execCommand("selectAll")}runEditorCommand(on,Nt,je){let we=Nt._getViewModel();we&&this.runCoreEditorCommand(we,je)}runCoreEditorCommand(on,Nt){on.model.pushStackElement(),on.setCursorStates("keyboard",3,[sf.selectAll(on,on.getPrimaryCursorState())])}},Co.SetSelection=Xi(new class extends Tm{constructor(){super({id:"setSelection",precondition:void 0})}runCoreEditorCommand(on,Nt){Nt.selection&&(on.model.pushStackElement(),on.setCursorStates(Nt.source,3,[js.fromModelSelection(Nt.selection)]))}})})(af||={});var U0o=C.and(pe.textInputFocus,pe.columnSelection);function mye(a,i){Ct.registerKeybindingRule({id:a,primary:i,when:U0o,weight:tc+1})}mye(af.CursorColumnSelectLeft.id,1039);mye(af.CursorColumnSelectRight.id,1041);mye(af.CursorColumnSelectUp.id,1040);mye(af.CursorColumnSelectPageUp.id,1035);mye(af.CursorColumnSelectDown.id,1042);mye(af.CursorColumnSelectPageDown.id,1036);function hji(a){return a.register(),a}var zL;(l=>{class a extends Oc{runEditorCommand(u,p,h){let g=p._getViewModel();g&&this.runCoreEditingCommand(p,g,h||{})}}l.CoreEditingCommand=a,l.LineBreakInsert=Xi(new class extends a{constructor(){super({id:"lineBreakInsert",precondition:pe.writable,kbOpts:{weight:tc,kbExpr:pe.textInputFocus,primary:0,mac:{primary:301}}})}runCoreEditingCommand(c,u,p){c.pushUndoStop(),c.executeCommands(this.id,ij.lineBreakInsert(u.cursorConfig,u.model,u.getCursorStates().map(h=>h.modelState.selection)))}}),l.Outdent=Xi(new class extends a{constructor(){super({id:"outdent",precondition:pe.writable,kbOpts:{weight:tc,kbExpr:C.and(pe.editorTextFocus,pe.tabDoesNotMoveFocus),primary:1026}})}runCoreEditingCommand(c,u,p){c.pushUndoStop(),c.executeCommands(this.id,CP.outdent(u.cursorConfig,u.model,u.getCursorStates().map(h=>h.modelState.selection))),c.pushUndoStop()}}),l.Tab=Xi(new class extends a{constructor(){super({id:"tab",precondition:pe.writable,kbOpts:{weight:tc,kbExpr:C.and(pe.editorTextFocus,pe.tabDoesNotMoveFocus),primary:2}})}runCoreEditingCommand(c,u,p){c.pushUndoStop(),c.executeCommands(this.id,CP.tab(u.cursorConfig,u.model,u.getCursorStates().map(h=>h.modelState.selection))),c.pushUndoStop()}}),l.DeleteLeft=Xi(new class extends a{constructor(){super({id:"deleteLeft",precondition:void 0,kbOpts:{weight:tc,kbExpr:pe.textInputFocus,primary:1,secondary:[1025],mac:{primary:1,secondary:[1025,294,257]}}})}runCoreEditingCommand(c,u,p){let[h,g]=gO.deleteLeft(u.getPrevEditOperationType(),u.cursorConfig,u.model,u.getCursorStates().map(f=>f.modelState.selection),u.getCursorAutoClosedCharacters());h&&c.pushUndoStop(),c.executeCommands(this.id,g),u.setPrevEditOperationType(2)}}),l.DeleteRight=Xi(new class extends a{constructor(){super({id:"deleteRight",precondition:void 0,kbOpts:{weight:tc,kbExpr:pe.textInputFocus,primary:20,mac:{primary:20,secondary:[290,276]}}})}runCoreEditingCommand(c,u,p){let[h,g]=gO.deleteRight(u.getPrevEditOperationType(),u.cursorConfig,u.model,u.getCursorStates().map(f=>f.modelState.selection));h&&c.pushUndoStop(),c.executeCommands(this.id,g),u.setPrevEditOperationType(3)}}),l.Undo=new class extends bje{constructor(){super(S_)}runDOMCommand(c){c.ownerDocument.execCommand("undo")}runEditorCommand(c,u,p){if(!(!u.hasModel()||u.getOption(104)===!0))return u.getModel().undo()}},l.Redo=new class extends bje{constructor(){super(I_)}runDOMCommand(c){c.ownerDocument.execCommand("redo")}runEditorCommand(c,u,p){if(!(!u.hasModel()||u.getOption(104)===!0))return u.getModel().redo()}}})(zL||={});var nvt=class extends yae{constructor(i,e,t){super({id:i,precondition:void 0,metadata:t}),this._handlerId=e}runCommand(i,e){let t=i.get(qt).getFocusedCodeEditor();t&&t.trigger("keyboard",this._handlerId,e)}};function Kae(a,i){hji(new nvt("default:"+a,a)),hji(new nvt(a,a,i))}Kae("type",{description:"Type",args:[{name:"args",schema:{type:"object",required:["text"],properties:{text:{type:"string"}}}}]});Kae("replacePreviousChar");Kae("compositionType");Kae("compositionStart");Kae("compositionEnd");Kae("paste");Kae("cut");var Qs=le("editorWorkerService");var gji="default",z0o="$initialize",fji=!1;function avt(a){Wt&&(fji||(fji=!0,console.warn("Could not create web worker(s). Falling back to loading web worker code in main thread, which might cause UI freezes. Please see https://github.com/microsoft/monaco-editor#faq")),console.warn(a.message))}var Aei=class{constructor(i,e,t,o,n){this.vsWorker=i;this.req=e;this.channel=t;this.method=o;this.args=n;this.type=0}},rvt=class{constructor(i,e,t,o){this.vsWorker=i;this.seq=e;this.res=t;this.err=o;this.type=1}},Nei=class{constructor(i,e,t,o,n){this.vsWorker=i;this.req=e;this.channel=t;this.eventName=o;this.arg=n;this.type=2}},Oei=class{constructor(i,e,t){this.vsWorker=i;this.req=e;this.event=t;this.type=3}},Fei=class{constructor(i,e){this.vsWorker=i;this.req=e;this.type=4}},Wei=class{constructor(i){this._workerId=-1,this._handler=i,this._lastSentReq=0,this._pendingReplies=Object.create(null),this._pendingEmitters=new Map,this._pendingEvents=new Map}setWorkerId(i){this._workerId=i}async sendMessage(i,e,t){let o=String(++this._lastSentReq);return new Promise((n,r)=>{this._pendingReplies[o]={resolve:n,reject:r},this._send(new Aei(this._workerId,o,i,e,t))})}listen(i,e,t){let o=null,n=new E({onWillAddFirstListener:()=>{o=String(++this._lastSentReq),this._pendingEmitters.set(o,n),this._send(new Nei(this._workerId,o,i,e,t))},onDidRemoveLastListener:()=>{this._pendingEmitters.delete(o),this._send(new Fei(this._workerId,o)),o=null}});return n.event}handleMessage(i){!i||!i.vsWorker||this._workerId!==-1&&i.vsWorker!==this._workerId||this._handleMessage(i)}createProxyToRemoteChannel(i,e){let t={get:(o,n)=>(typeof n=="string"&&!o[n]&&(bji(n)?o[n]=r=>this.listen(i,n,r):vji(n)?o[n]=this.listen(i,n,void 0):n.charCodeAt(0)===36&&(o[n]=async(...r)=>(await e?.(),this.sendMessage(i,n,r)))),o[n])};return new Proxy(Object.create(null),t)}_handleMessage(i){switch(i.type){case 1:return this._handleReplyMessage(i);case 0:return this._handleRequestMessage(i);case 2:return this._handleSubscribeEventMessage(i);case 3:return this._handleEventMessage(i);case 4:return this._handleUnsubscribeEventMessage(i)}}_handleReplyMessage(i){if(!this._pendingReplies[i.seq]){console.warn("Got reply to unknown seq");return}let e=this._pendingReplies[i.seq];if(delete this._pendingReplies[i.seq],i.err){let t=i.err;if(i.err.$isError){let o=new Error;o.name=i.err.name,o.message=i.err.message,o.stack=i.err.stack,t=o}e.reject(t);return}e.resolve(i.res)}_handleRequestMessage(i){let e=i.req;this._handler.handleMessage(i.channel,i.method,i.args).then(o=>{this._send(new rvt(this._workerId,e,o,void 0))},o=>{o.detail instanceof Error&&(o.detail=S$(o.detail)),this._send(new rvt(this._workerId,e,void 0,S$(o)))})}_handleSubscribeEventMessage(i){let e=i.req,t=this._handler.handleEvent(i.channel,i.eventName,i.arg)(o=>{this._send(new Oei(this._workerId,e,o))});this._pendingEvents.set(e,t)}_handleEventMessage(i){let e=this._pendingEmitters.get(i.req);if(e===void 0){console.warn("Got event for unknown req");return}e.fire(i.event)}_handleUnsubscribeEventMessage(i){let e=this._pendingEvents.get(i.req);if(e===void 0){console.warn("Got unsubscribe for unknown req");return}e.dispose(),this._pendingEvents.delete(i.req)}_send(i){let e=[];if(i.type===0)for(let t=0;t<i.args.length;t++){let o=i.args[t];o instanceof ArrayBuffer&&e.push(o)}else i.type===1&&i.res instanceof ArrayBuffer&&e.push(i.res);this._handler.sendMessage(i,e)}},svt=class extends x{constructor(e){super();this._localChannels=new Map;this._remoteChannels=new Map;this._worker=this._register(e),this._register(this._worker.onMessage(t=>{this._protocol.handleMessage(t)})),this._register(this._worker.onError(t=>{avt(t),mt(t)})),this._protocol=new Wei({sendMessage:(t,o)=>{this._worker.postMessage(t,o)},handleMessage:(t,o,n)=>this._handleMessage(t,o,n),handleEvent:(t,o,n)=>this._handleEvent(t,o,n)}),this._protocol.setWorkerId(this._worker.getId()),this._onModuleLoaded=this._protocol.sendMessage(gji,z0o,[this._worker.getId()]).then(()=>{}),this.proxy=this._protocol.createProxyToRemoteChannel(gji,async()=>{await this._onModuleLoaded}),this._onModuleLoaded.catch(t=>{this._onError("Worker failed to load ",t)})}_handleMessage(e,t,o){let n=this._localChannels.get(e);if(!n)return Promise.reject(new Error(`Missing channel ${e} on main thread`));let r=n[t];if(typeof r!="function")return Promise.reject(new Error(`Missing method ${t} on main thread channel ${e}`));try{return Promise.resolve(r.apply(n,o))}catch(s){return Promise.reject(s)}}_handleEvent(e,t,o){let n=this._localChannels.get(e);if(!n)throw new Error(`Missing channel ${e} on main thread`);if(bji(t)){let r=n[t];if(typeof r!="function")throw new Error(`Missing dynamic event ${t} on main thread channel ${e}.`);let s=r.call(n,o);if(typeof s!="function")throw new Error(`Missing dynamic event ${t} on main thread channel ${e}.`);return s}if(vji(t)){let r=n[t];if(typeof r!="function")throw new Error(`Missing event ${t} on main thread channel ${e}.`);return r}throw new Error(`Malformed event name ${t}`)}setChannel(e,t){this._localChannels.set(e,t)}getChannel(e){let t=this._remoteChannels.get(e);return t===void 0&&(t=this._protocol.createProxyToRemoteChannel(e,async()=>{await this._onModuleLoaded}),this._remoteChannels.set(e,t)),t}_onError(e,t){console.error(e),console.info(t)}};function vji(a){return a[0]==="o"&&a[1]==="n"&&pE(a.charCodeAt(2))}function bji(a){return/^onDynamic/.test(a)&&pE(a.charCodeAt(9))}var Ux=class{constructor(i){this.esmModuleLocation=i.esmModuleLocation,this.esmModuleLocationBundler=i.esmModuleLocationBundler,this.label=i.label}};var Zy=le("IWebWorkerService");var Hn=class{static insert(i,e){return{range:new z(i.lineNumber,i.column,i.lineNumber,i.column),text:e,forceMoveMarkers:!0}}static delete(i){return{range:i,text:null}}static replace(i,e){return{range:i,text:e}}static replaceMove(i,e){return{range:i,text:e,forceMoveMarkers:!0}}};var lvt=class{constructor(){this._tokenizationSupports=new Map;this._factories=new Map;this._onDidChange=new E;this.onDidChange=this._onDidChange.event;this._colorMap=null}handleChange(i){this._onDidChange.fire({changedLanguages:i,changedColorMap:!1})}register(i,e){return this._tokenizationSupports.set(i,e),this.handleChange([i]),Z(()=>{this._tokenizationSupports.get(i)===e&&(this._tokenizationSupports.delete(i),this.handleChange([i]))})}get(i){return this._tokenizationSupports.get(i)||null}registerFactory(i,e){this._factories.get(i)?.dispose();let t=new Vei(this,i,e);return this._factories.set(i,t),Z(()=>{let o=this._factories.get(i);!o||o!==t||(this._factories.delete(i),o.dispose())})}async getOrCreate(i){let e=this.get(i);if(e)return e;let t=this._factories.get(i);return!t||t.isResolved?null:(await t.resolve(),this.get(i))}isResolved(i){if(this.get(i))return!0;let t=this._factories.get(i);return!!(!t||t.isResolved)}setColorMap(i){this._colorMap=i,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}},Vei=class extends x{constructor(e,t,o){super();this._registry=e;this._languageId=t;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 Ije=class{constructor(i,e,t){this.offset=i;this.type=e;this.language=t;this._tokenBrand=void 0}toString(){return"("+this.offset+", "+this.type+")"}};var Gae=class{constructor(i,e,t){this.tokens=i;this.fontInfo=e;this.endState=t;this._encodedTokenizationResultBrand=void 0}};var A1;(n=>{let a=new Map;a.set(0,R.symbolMethod),a.set(1,R.symbolFunction),a.set(2,R.symbolConstructor),a.set(3,R.symbolField),a.set(4,R.symbolVariable),a.set(5,R.symbolClass),a.set(6,R.symbolStruct),a.set(7,R.symbolInterface),a.set(8,R.symbolModule),a.set(9,R.symbolProperty),a.set(10,R.symbolEvent),a.set(11,R.symbolOperator),a.set(12,R.symbolUnit),a.set(13,R.symbolValue),a.set(15,R.symbolEnum),a.set(14,R.symbolConstant),a.set(15,R.symbolEnum),a.set(16,R.symbolEnumMember),a.set(17,R.symbolKeyword),a.set(28,R.symbolSnippet),a.set(18,R.symbolText),a.set(19,R.symbolColor),a.set(20,R.symbolFile),a.set(21,R.symbolReference),a.set(22,R.symbolCustomColor),a.set(23,R.symbolFolder),a.set(24,R.symbolTypeParameter),a.set(25,R.account),a.set(26,R.issues),a.set(27,R.tools);function i(r){let s=a.get(r);return s||(console.info("No codicon found for CompletionItemKind "+r),s=R.symbolProperty),s}n.toIcon=i;function e(r){switch(r){case 0:return d(891,null);case 1:return d(887,null);case 2:return d(879,null);case 3:return d(884,null);case 4:return d(904,null);case 5:return d(876,null);case 6:return d(897,null);case 7:return d(888,null);case 8:return d(892,null);case 9:return d(894,null);case 10:return d(883,null);case 11:return d(893,null);case 12:return d(901,null);case 13:return d(903,null);case 14:return d(878,null);case 15:return d(881,null);case 16:return d(882,null);case 17:return d(890,null);case 18:return d(898,null);case 19:return d(877,null);case 20:return d(885,null);case 21:return d(895,null);case 22:return d(880,null);case 23:return d(886,null);case 24:return d(900,null);case 25:return d(902,null);case 26:return d(889,null);case 27:return d(899,null);case 28:return d(896,null);default:return""}}n.toLabel=e;let t=new Map;t.set("method",0),t.set("function",1),t.set("constructor",2),t.set("field",3),t.set("variable",4),t.set("class",5),t.set("struct",6),t.set("interface",7),t.set("module",8),t.set("property",9),t.set("event",10),t.set("operator",11),t.set("unit",12),t.set("value",13),t.set("constant",14),t.set("enum",15),t.set("enum-member",16),t.set("enumMember",16),t.set("keyword",17),t.set("snippet",28),t.set("text",18),t.set("color",19),t.set("file",20),t.set("reference",21),t.set("customcolor",22),t.set("folder",23),t.set("type-parameter",24),t.set("typeParameter",24),t.set("account",25),t.set("issue",26),t.set("tool",27);function o(r,s){let l=t.get(r);return typeof l>"u"&&!s&&(l=9),l}n.fromString=o})(A1||={});var cvt=class{constructor(i,e,t,o){this.range=i;this.text=e;this.completionKind=t;this.isSnippetText=o}equals(i){return z.lift(this.range).equalsRange(i.range)&&this.text===i.text&&this.completionKind===i.completionKind&&this.isSnippetText===i.isSnippetText}};var P1=class a{constructor(i,e,t){this.extensionId=i;this.extensionVersion=e;this.providerId=t}static fromExtensionId(i){return new a(i,void 0,void 0)}toString(){let i="";return this.extensionId&&(i+=this.extensionId),this.extensionVersion&&(i+=`@${this.extensionVersion}`),this.providerId&&(i+=`:${this.providerId}`),i.length===0&&(i="unknown"),i}toStringWithoutVersion(){let i="";return this.extensionId&&(i+=this.extensionId),this.providerId&&(i+=`:${this.providerId}`),i}},dvt=class a{constructor(i,e){this.extensionId=i;this.version=e}static tryCreate(i,e){if(!(!i||!e))return new a(i,e)}toString(){return`${this.extensionId}@${this.version}`}};function Sji(a){return!!a&&A.isUri(a.uri)&&z.isIRange(a.range)&&(z.isIRange(a.originSelectionRange)||z.isIRange(a.targetSelectionRange))}function lf(a){return!!a&&A.isUri(a.uri)&&z.isIRange(a.range)}var Bei={17:d(852,null),16:d(853,null),4:d(854,null),13:d(855,null),8:d(856,null),9:d(857,null),21:d(858,null),23:d(859,null),7:d(860,null),0:d(861,null),11:d(862,null),10:d(863,null),19:d(864,null),5:d(865,null),1:d(866,null),2:d(867,null),20:d(868,null),15:d(869,null),18:d(870,null),24:d(871,null),3:d(872,null),6:d(873,null),14:d(874,null),22:d(875,null),25:d(906,null),12:d(907,null)};function pvt(a,i){return d(905,null,a,Bei[i])}var _m;(o=>{let a=new Map;a.set(0,R.symbolFile),a.set(1,R.symbolModule),a.set(2,R.symbolNamespace),a.set(3,R.symbolPackage),a.set(4,R.symbolClass),a.set(5,R.symbolMethod),a.set(6,R.symbolProperty),a.set(7,R.symbolField),a.set(8,R.symbolConstructor),a.set(9,R.symbolEnum),a.set(10,R.symbolInterface),a.set(11,R.symbolFunction),a.set(12,R.symbolVariable),a.set(13,R.symbolConstant),a.set(14,R.symbolString),a.set(15,R.symbolNumber),a.set(16,R.symbolBoolean),a.set(17,R.symbolArray),a.set(18,R.symbolObject),a.set(19,R.symbolKey),a.set(20,R.symbolNull),a.set(21,R.symbolEnumMember),a.set(22,R.symbolStruct),a.set(23,R.symbolEvent),a.set(24,R.symbolOperator),a.set(25,R.symbolTypeParameter);function i(n){let r=a.get(n);return r||(console.info("No codicon found for SymbolKind "+n),r=R.symbolProperty),r}o.toIcon=i;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 t(n){let r=e.get(n);return r===void 0&&(console.info("No completion kind found for SymbolKind "+n),r=20),r}o.toCompletionKind=t})(_m||={});var SE=class{static asEditOperation(i){let e=z.lift(i.range);return e.isEmpty()?Hn.insert(e.getStartPosition(),i.text):Hn.replace(e,i.text)}static isTextEdit(i){let e=i;return typeof e.text=="string"&&z.isIRange(e.range)}},IE=class a{constructor(i){this.value=i}static{this.Comment=new a("comment")}static{this.Imports=new a("imports")}static{this.Region=new a("region")}static fromValue(i){switch(i){case"comment":return a.Comment;case"imports":return a.Imports;case"region":return a.Region}return new a(i)}};var qae;(i=>{function a(e){return!e||typeof e!="object"?!1:typeof e.id=="string"&&typeof e.title=="string"}i.is=a})(qae||={});var uvt=class{constructor(i){this.createSupport=i;this._tokenizationSupport=null}dispose(){this._tokenizationSupport&&this._tokenizationSupport.then(i=>{i&&i.dispose()})}get tokenizationSupport(){return this._tokenizationSupport||(this._tokenizationSupport=this.createSupport()),this._tokenizationSupport}},ic=new lvt;var RV=class{constructor(i,e,t,o){this.originalStart=i,this.originalLength=e,this.modifiedStart=t,this.modifiedLength=o}getOriginalEnd(){return this.originalStart+this.originalLength}getModifiedEnd(){return this.modifiedStart+this.modifiedLength}};var $ae=class{constructor(i){this.source=i}getElements(){let i=this.source,e=new Int32Array(i.length);for(let t=0,o=i.length;t<o;t++)e[t]=i.charCodeAt(t);return e}};function Iji(a,i,e){return new xP(new $ae(a),new $ae(i)).ComputeDiff(e).changes}var m7=class{static Assert(i,e){if(!i)throw new Error(e)}},h7=class{static Copy(i,e,t,o,n){for(let r=0;r<n;r++)t[o+r]=i[e+r]}static Copy2(i,e,t,o,n){for(let r=0;r<n;r++)t[o+r]=i[e+r]}};var mvt=class{constructor(){this.m_changes=[],this.m_originalStart=1073741824,this.m_modifiedStart=1073741824,this.m_originalCount=0,this.m_modifiedCount=0}MarkNextChange(){(this.m_originalCount>0||this.m_modifiedCount>0)&&this.m_changes.push(new RV(this.m_originalStart,this.m_originalCount,this.m_modifiedStart,this.m_modifiedCount)),this.m_originalCount=0,this.m_modifiedCount=0,this.m_originalStart=1073741824,this.m_modifiedStart=1073741824}AddOriginalElement(i,e){this.m_originalStart=Math.min(this.m_originalStart,i),this.m_modifiedStart=Math.min(this.m_modifiedStart,e),this.m_originalCount++}AddModifiedElement(i,e){this.m_originalStart=Math.min(this.m_originalStart,i),this.m_modifiedStart=Math.min(this.m_modifiedStart,e),this.m_modifiedCount++}getChanges(){return(this.m_originalCount>0||this.m_modifiedCount>0)&&this.MarkNextChange(),this.m_changes}getReverseChanges(){return(this.m_originalCount>0||this.m_modifiedCount>0)&&this.MarkNextChange(),this.m_changes.reverse(),this.m_changes}},xP=class a{constructor(i,e,t=null){this.ContinueProcessingPredicate=t,this._originalSequence=i,this._modifiedSequence=e;let[o,n,r]=a._getElements(i),[s,l,c]=a._getElements(e);this._hasStrings=r&&c,this._originalStringElements=o,this._originalElementsOrHash=n,this._modifiedStringElements=s,this._modifiedElementsOrHash=l,this.m_forwardHistory=[],this.m_reverseHistory=[]}static _isStringArray(i){return i.length>0&&typeof i[0]=="string"}static _getElements(i){let e=i.getElements();if(a._isStringArray(e)){let t=new Int32Array(e.length);for(let o=0,n=e.length;o<n;o++)t[o]=CIe(e[o],0);return[e,t,!0]}return e instanceof Int32Array?[[],e,!1]:[[],new Int32Array(e),!1]}ElementsAreEqual(i,e){return this._originalElementsOrHash[i]!==this._modifiedElementsOrHash[e]?!1:this._hasStrings?this._originalStringElements[i]===this._modifiedStringElements[e]:!0}ElementsAreStrictEqual(i,e){if(!this.ElementsAreEqual(i,e))return!1;let t=a._getStrictElement(this._originalSequence,i),o=a._getStrictElement(this._modifiedSequence,e);return t===o}static _getStrictElement(i,e){return typeof i.getStrictElement=="function"?i.getStrictElement(e):null}OriginalElementsAreEqual(i,e){return this._originalElementsOrHash[i]!==this._originalElementsOrHash[e]?!1:this._hasStrings?this._originalStringElements[i]===this._originalStringElements[e]:!0}ModifiedElementsAreEqual(i,e){return this._modifiedElementsOrHash[i]!==this._modifiedElementsOrHash[e]?!1:this._hasStrings?this._modifiedStringElements[i]===this._modifiedStringElements[e]:!0}ComputeDiff(i){return this._ComputeDiff(0,this._originalElementsOrHash.length-1,0,this._modifiedElementsOrHash.length-1,i)}_ComputeDiff(i,e,t,o,n){let r=[!1],s=this.ComputeDiffRecursive(i,e,t,o,r);return n&&(s=this.PrettifyChanges(s)),{quitEarly:r[0],changes:s}}ComputeDiffRecursive(i,e,t,o,n){for(n[0]=!1;i<=e&&t<=o&&this.ElementsAreEqual(i,t);)i++,t++;for(;e>=i&&o>=t&&this.ElementsAreEqual(e,o);)e--,o--;if(i>e||t>o){let p;return t<=o?(m7.Assert(i===e+1,"originalStart should only be one more than originalEnd"),p=[new RV(i,0,t,o-t+1)]):i<=e?(m7.Assert(t===o+1,"modifiedStart should only be one more than modifiedEnd"),p=[new RV(i,e-i+1,t,0)]):(m7.Assert(i===e+1,"originalStart should only be one more than originalEnd"),m7.Assert(t===o+1,"modifiedStart should only be one more than modifiedEnd"),p=[]),p}let r=[0],s=[0],l=this.ComputeRecursionPoint(i,e,t,o,r,s,n),c=r[0],u=s[0];if(l!==null)return l;if(!n[0]){let p=this.ComputeDiffRecursive(i,c,t,u,n),h=[];return n[0]?h=[new RV(c+1,e-(c+1)+1,u+1,o-(u+1)+1)]:h=this.ComputeDiffRecursive(c+1,e,u+1,o,n),this.ConcatenateChanges(p,h)}return[new RV(i,e-i+1,t,o-t+1)]}WALKTRACE(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){let w=null,k=null,T=new mvt,P=e,O=t,V=g[0]-b[0]-o,H=-1073741824,G=this.m_forwardHistory.length-1;do{let $=V+i;$===P||$<O&&c[$-1]<c[$+1]?(p=c[$+1],f=p-V-o,p<H&&T.MarkNextChange(),H=p,T.AddModifiedElement(p+1,f),V=$+1-i):(p=c[$-1]+1,f=p-V-o,p<H&&T.MarkNextChange(),H=p-1,T.AddOriginalElement(p,f+1),V=$-1-i),G>=0&&(c=this.m_forwardHistory[G],i=c[0],P=1,O=c.length-1)}while(--G>=-1);if(w=T.getReverseChanges(),y[0]){let $=g[0]+1,J=b[0]+1;if(w!==null&&w.length>0){let ae=w[w.length-1];$=Math.max($,ae.getOriginalEnd()),J=Math.max(J,ae.getModifiedEnd())}k=[new RV($,h-$+1,J,v-J+1)]}else{T=new mvt,P=r,O=s,V=g[0]-b[0]-l,H=1073741824,G=S?this.m_reverseHistory.length-1:this.m_reverseHistory.length-2;do{let $=V+n;$===P||$<O&&u[$-1]>=u[$+1]?(p=u[$+1]-1,f=p-V-l,p>H&&T.MarkNextChange(),H=p+1,T.AddOriginalElement(p+1,f+1),V=$+1-n):(p=u[$-1],f=p-V-l,p>H&&T.MarkNextChange(),H=p,T.AddModifiedElement(p+1,f+1),V=$-1-n),G>=0&&(u=this.m_reverseHistory[G],n=u[0],P=1,O=u.length-1)}while(--G>=-1);k=T.getChanges()}return this.ConcatenateChanges(w,k)}ComputeRecursionPoint(i,e,t,o,n,r,s){let l=0,c=0,u=0,p=0,h=0,g=0;i--,t--,n[0]=0,r[0]=0,this.m_forwardHistory=[],this.m_reverseHistory=[];let f=e-i+(o-t),v=f+1,b=new Int32Array(v),S=new Int32Array(v),y=o-t,w=e-i,k=i-t,T=e-o,O=(w-y)%2===0;b[y]=i,S[w]=e,s[0]=!1;for(let V=1;V<=f/2+1;V++){let H=0,G=0;u=this.ClipDiagonalBound(y-V,V,y,v),p=this.ClipDiagonalBound(y+V,V,y,v);for(let J=u;J<=p;J+=2){J===u||J<p&&b[J-1]<b[J+1]?l=b[J+1]:l=b[J-1]+1,c=l-(J-y)-k;let ae=l;for(;l<e&&c<o&&this.ElementsAreEqual(l+1,c+1);)l++,c++;if(b[J]=l,l+c>H+G&&(H=l,G=c),!O&&Math.abs(J-w)<=V-1&&l>=S[J])return n[0]=l,r[0]=c,ae<=S[J]&&V<=1448?this.WALKTRACE(y,u,p,k,w,h,g,T,b,S,l,e,n,c,o,r,O,s):null}let $=(H-i+(G-t)-V)/2;if(this.ContinueProcessingPredicate!==null&&!this.ContinueProcessingPredicate(H,$))return s[0]=!0,n[0]=H,r[0]=G,$>0&&V<=1448?this.WALKTRACE(y,u,p,k,w,h,g,T,b,S,l,e,n,c,o,r,O,s):(i++,t++,[new RV(i,e-i+1,t,o-t+1)]);h=this.ClipDiagonalBound(w-V,V,w,v),g=this.ClipDiagonalBound(w+V,V,w,v);for(let J=h;J<=g;J+=2){J===h||J<g&&S[J-1]>=S[J+1]?l=S[J+1]-1:l=S[J-1],c=l-(J-w)-T;let ae=l;for(;l>i&&c>t&&this.ElementsAreEqual(l,c);)l--,c--;if(S[J]=l,O&&Math.abs(J-y)<=V&&l<=b[J])return n[0]=l,r[0]=c,ae>=b[J]&&V<=1448?this.WALKTRACE(y,u,p,k,w,h,g,T,b,S,l,e,n,c,o,r,O,s):null}if(V<=1447){let J=new Int32Array(p-u+2);J[0]=y-u+1,h7.Copy2(b,u,J,1,p-u+1),this.m_forwardHistory.push(J),J=new Int32Array(g-h+2),J[0]=w-h+1,h7.Copy2(S,h,J,1,g-h+1),this.m_reverseHistory.push(J)}}return this.WALKTRACE(y,u,p,k,w,h,g,T,b,S,l,e,n,c,o,r,O,s)}PrettifyChanges(i){for(let e=0;e<i.length;e++){let t=i[e],o=e<i.length-1?i[e+1].originalStart:this._originalElementsOrHash.length,n=e<i.length-1?i[e+1].modifiedStart:this._modifiedElementsOrHash.length,r=t.originalLength>0,s=t.modifiedLength>0;for(;t.originalStart+t.originalLength<o&&t.modifiedStart+t.modifiedLength<n&&(!r||this.OriginalElementsAreEqual(t.originalStart,t.originalStart+t.originalLength))&&(!s||this.ModifiedElementsAreEqual(t.modifiedStart,t.modifiedStart+t.modifiedLength));){let c=this.ElementsAreStrictEqual(t.originalStart,t.modifiedStart);if(this.ElementsAreStrictEqual(t.originalStart+t.originalLength,t.modifiedStart+t.modifiedLength)&&!c)break;t.originalStart++,t.modifiedStart++}let l=[null];if(e<i.length-1&&this.ChangesOverlap(i[e],i[e+1],l)){i[e]=l[0],i.splice(e+1,1),e--;continue}}for(let e=i.length-1;e>=0;e--){let t=i[e],o=0,n=0;if(e>0){let p=i[e-1];o=p.originalStart+p.originalLength,n=p.modifiedStart+p.modifiedLength}let r=t.originalLength>0,s=t.modifiedLength>0,l=0,c=this._boundaryScore(t.originalStart,t.originalLength,t.modifiedStart,t.modifiedLength);for(let p=1;;p++){let h=t.originalStart-p,g=t.modifiedStart-p;if(h<o||g<n||r&&!this.OriginalElementsAreEqual(h,h+t.originalLength)||s&&!this.ModifiedElementsAreEqual(g,g+t.modifiedLength))break;let v=(h===o&&g===n?5:0)+this._boundaryScore(h,t.originalLength,g,t.modifiedLength);v>c&&(c=v,l=p)}t.originalStart-=l,t.modifiedStart-=l;let u=[null];if(e>0&&this.ChangesOverlap(i[e-1],i[e],u)){i[e-1]=u[0],i.splice(e,1),e++;continue}}if(this._hasStrings)for(let e=1,t=i.length;e<t;e++){let o=i[e-1],n=i[e],r=n.originalStart-o.originalStart-o.originalLength,s=o.originalStart,l=n.originalStart+n.originalLength,c=l-s,u=o.modifiedStart,p=n.modifiedStart+n.modifiedLength,h=p-u;if(r<5&&c<20&&h<20){let g=this._findBetterContiguousSequence(s,c,u,h,r);if(g){let[f,v]=g;(f!==o.originalStart+o.originalLength||v!==o.modifiedStart+o.modifiedLength)&&(o.originalLength=f-o.originalStart,o.modifiedLength=v-o.modifiedStart,n.originalStart=f+r,n.modifiedStart=v+r,n.originalLength=l-n.originalStart,n.modifiedLength=p-n.modifiedStart)}}}return i}_findBetterContiguousSequence(i,e,t,o,n){if(e<n||o<n)return null;let r=i+e-n+1,s=t+o-n+1,l=0,c=0,u=0;for(let p=i;p<r;p++)for(let h=t;h<s;h++){let g=this._contiguousSequenceScore(p,h,n);g>0&&g>l&&(l=g,c=p,u=h)}return l>0?[c,u]:null}_contiguousSequenceScore(i,e,t){let o=0;for(let n=0;n<t;n++){if(!this.ElementsAreEqual(i+n,e+n))return 0;o+=this._originalStringElements[i+n].length}return o}_OriginalIsBoundary(i){return i<=0||i>=this._originalElementsOrHash.length-1?!0:this._hasStrings&&/^\s*$/.test(this._originalStringElements[i])}_OriginalRegionIsBoundary(i,e){if(this._OriginalIsBoundary(i)||this._OriginalIsBoundary(i-1))return!0;if(e>0){let t=i+e;if(this._OriginalIsBoundary(t-1)||this._OriginalIsBoundary(t))return!0}return!1}_ModifiedIsBoundary(i){return i<=0||i>=this._modifiedElementsOrHash.length-1?!0:this._hasStrings&&/^\s*$/.test(this._modifiedStringElements[i])}_ModifiedRegionIsBoundary(i,e){if(this._ModifiedIsBoundary(i)||this._ModifiedIsBoundary(i-1))return!0;if(e>0){let t=i+e;if(this._ModifiedIsBoundary(t-1)||this._ModifiedIsBoundary(t))return!0}return!1}_boundaryScore(i,e,t,o){let n=this._OriginalRegionIsBoundary(i,e)?1:0,r=this._ModifiedRegionIsBoundary(t,o)?1:0;return n+r}ConcatenateChanges(i,e){let t=[];if(i.length===0||e.length===0)return e.length>0?e:i;if(this.ChangesOverlap(i[i.length-1],e[0],t)){let o=new Array(i.length+e.length-1);return h7.Copy(i,0,o,0,i.length-1),o[i.length-1]=t[0],h7.Copy(e,1,o,i.length,e.length-1),o}else{let o=new Array(i.length+e.length);return h7.Copy(i,0,o,0,i.length),h7.Copy(e,0,o,i.length,e.length),o}}ChangesOverlap(i,e,t){if(m7.Assert(i.originalStart<=e.originalStart,"Left change is not less than or equal to right change"),m7.Assert(i.modifiedStart<=e.modifiedStart,"Left change is not less than or equal to right change"),i.originalStart+i.originalLength>=e.originalStart||i.modifiedStart+i.modifiedLength>=e.modifiedStart){let o=i.originalStart,n=i.originalLength,r=i.modifiedStart,s=i.modifiedLength;return i.originalStart+i.originalLength>=e.originalStart&&(n=e.originalStart+e.originalLength-i.originalStart),i.modifiedStart+i.modifiedLength>=e.modifiedStart&&(s=e.modifiedStart+e.modifiedLength-i.modifiedStart),t[0]=new RV(o,n,r,s),!0}else return t[0]=null,!1}ClipDiagonalBound(i,e,t,o){if(i>=0&&i<o)return i;let n=t,r=o-t-1,s=e%2===0;if(i<0){let l=n%2===0;return s===l?0:1}else{let l=r%2===0;return s===l?o-1:o-2}}},sj=new Uint32Array(65536),K0o=(a,i)=>{let e=a.length,t=i.length,o=1<<e-1,n=-1,r=0,s=e,l=e;for(;l--;)sj[a.charCodeAt(l)]|=1<<l;for(l=0;l<t;l++){let c=sj[i.charCodeAt(l)],u=c|r;c|=(c&n)+n^n,r|=~(c|n),n&=c,r&o&&s++,n&o&&s--,r=r<<1|1,n=n<<1|~(u|r),r&=u}for(l=e;l--;)sj[a.charCodeAt(l)]=0;return s};function G0o(a,i){let e=a.length,t=i.length,o=[],n=[],r=Math.ceil(e/32),s=Math.ceil(t/32);for(let f=0;f<r;f++)o[f]=-1,n[f]=0;let l=0;for(;l<s-1;l++){let f=0,v=-1,b=l*32,S=Math.min(32,t)+b;for(let y=b;y<S;y++)sj[i.charCodeAt(y)]|=1<<y;for(let y=0;y<e;y++){let w=sj[a.charCodeAt(y)],k=o[y/32|0]>>>y&1,T=n[y/32|0]>>>y&1,P=w|f,O=((w|T)&v)+v^v|w|T,V=f|~(O|v),H=v&O;V>>>31^k&&(o[y/32|0]^=1<<y),H>>>31^T&&(n[y/32|0]^=1<<y),V=V<<1|k,H=H<<1|T,v=H|~(P|V),f=V&P}for(let y=b;y<S;y++)sj[i.charCodeAt(y)]=0}let c=0,u=-1,p=l*32,h=Math.min(32,t-p)+p;for(let f=p;f<h;f++)sj[i.charCodeAt(f)]|=1<<f;let g=t;for(let f=0;f<e;f++){let v=sj[a.charCodeAt(f)],b=o[f/32|0]>>>f&1,S=n[f/32|0]>>>f&1,y=v|c,w=((v|S)&u)+u^u|v|S,k=c|~(w|u),T=u&w;g+=k>>>t-1&1,g-=T>>>t-1&1,k>>>31^b&&(o[f/32|0]^=1<<f),T>>>31^S&&(n[f/32|0]^=1<<f),k=k<<1|b,T=T<<1|S,u=T|~(y|k),c=k&y}for(let f=p;f<h;f++)sj[i.charCodeAt(f)]=0;return g}function yji(a,i){if(a.length<i.length){let e=i;i=a,a=e}return i.length===0?a.length:a.length<=32?K0o(a,i):G0o(a,i)}var Uei=class{constructor(i,e,t){let o=new Uint8Array(i*e);for(let n=0,r=i*e;n<r;n++)o[n]=t;this._data=o,this.rows=i,this.cols=e}get(i,e){return this._data[i*this.cols+e]}set(i,e,t){this._data[i*this.cols+e]=t}},zei=class{constructor(i){let e=0,t=0;for(let n=0,r=i.length;n<r;n++){let[s,l,c]=i[n];l>e&&(e=l),s>t&&(t=s),c>t&&(t=c)}e++,t++;let o=new Uei(t,e,0);for(let n=0,r=i.length;n<r;n++){let[s,l,c]=i[n];o.set(s,l,c)}this._states=o,this._maxCharCode=e}nextState(i,e){return e<0||e>=this._maxCharCode?0:this._states.get(i,e)}},Hei=null;function q0o(){return Hei===null&&(Hei=new zei([[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]])),Hei}var yje=null;function $0o(){if(yje===null){yje=new J$(0);let a=` 	<>'"\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<a.length;e++)yje.set(a.charCodeAt(e),1);let i=".,;:";for(let e=0;e<i.length;e++)yje.set(i.charCodeAt(e),2)}return yje}var wje=class a{static _createLink(i,e,t,o,n){let r=n-1;do{let s=e.charCodeAt(r);if(i.get(s)!==2)break;r--}while(r>o);if(o>0){let s=e.charCodeAt(o-1),l=e.charCodeAt(r);(s===40&&l===41||s===91&&l===93||s===123&&l===125)&&r--}return{range:{startLineNumber:t,startColumn:o+1,endLineNumber:t,endColumn:r+2},url:e.substring(o,r+1)}}static computeLinks(i,e=q0o()){let t=$0o(),o=[];for(let n=1,r=i.getLineCount();n<=r;n++){let s=i.getLineContent(n),l=s.length,c=0,u=0,p=0,h=1,g=!1,f=!1,v=!1,b=!1;for(;c<l;){let S=!1,y=s.charCodeAt(c);if(h===13){let w;switch(y){case 40:g=!0,w=0;break;case 41:w=g?0:1;break;case 91:v=!0,f=!0,w=0;break;case 93:v=!1,w=f?0:1;break;case 123:b=!0,w=0;break;case 125:w=b?0:1;break;case 39:case 34:case 96:p===y?w=1:p===39||p===34||p===96?w=0:w=1;break;case 42:w=p===42?1:0;break;case 32:w=v?0:1;break;default:w=t.get(y)}w===1&&(o.push(a._createLink(t,s,n,u,c)),S=!0)}else if(h===12){let w;y===91?(f=!0,w=0):w=t.get(y),w===1?S=!0:h=13}else h=e.nextState(h,y),h===0&&(S=!0);S&&(h=1,g=!1,f=!1,b=!1,u=c+1,p=y),c++}h===13&&o.push(a._createLink(t,s,n,u,l))}return o}};function wji(a){return!a||typeof a.getLineCount!="function"||typeof a.getLineContent!="function"?[]:wje.computeLinks(a)}var hvt=class a{constructor(){this._defaultValueSet=[["true","false"],["True","False"],["Private","Public","Friend","ReadOnly","Partial","Protected","WriteOnly"],["public","protected","private"]]}static{this.INSTANCE=new a}navigateValueSet(i,e,t,o,n){if(i&&e){let r=this.doNavigateValueSet(e,n);if(r)return{range:i,value:r}}if(t&&o){let r=this.doNavigateValueSet(o,n);if(r)return{range:t,value:r}}return null}doNavigateValueSet(i,e){let t=this.numberReplace(i,e);return t!==null?t:this.textReplace(i,e)}numberReplace(i,e){let t=Math.pow(10,i.length-(i.lastIndexOf(".")+1)),o=Number(i),n=parseFloat(i);return!isNaN(o)&&!isNaN(n)&&o===n?o===0&&!e?null:(o=Math.floor(o*t),o+=e?t:-t,String(o/t)):null}textReplace(i,e){return this.valueSetsReplace(this._defaultValueSet,i,e)}valueSetsReplace(i,e,t){let o=null;for(let n=0,r=i.length;o===null&&n<r;n++)o=this.valueSetReplace(i[n],e,t);return o}valueSetReplace(i,e,t){let o=i.indexOf(e);return o>=0?(o+=t?1:-1,o<0?o=i.length-1:o%=i.length,i[o]):null}};var Kei=(Mt=>(Mt[Mt.DependsOnKbLayout=-1]="DependsOnKbLayout",Mt[Mt.Unknown=0]="Unknown",Mt[Mt.Backspace=1]="Backspace",Mt[Mt.Tab=2]="Tab",Mt[Mt.Enter=3]="Enter",Mt[Mt.Shift=4]="Shift",Mt[Mt.Ctrl=5]="Ctrl",Mt[Mt.Alt=6]="Alt",Mt[Mt.PauseBreak=7]="PauseBreak",Mt[Mt.CapsLock=8]="CapsLock",Mt[Mt.Escape=9]="Escape",Mt[Mt.Space=10]="Space",Mt[Mt.PageUp=11]="PageUp",Mt[Mt.PageDown=12]="PageDown",Mt[Mt.End=13]="End",Mt[Mt.Home=14]="Home",Mt[Mt.LeftArrow=15]="LeftArrow",Mt[Mt.UpArrow=16]="UpArrow",Mt[Mt.RightArrow=17]="RightArrow",Mt[Mt.DownArrow=18]="DownArrow",Mt[Mt.Insert=19]="Insert",Mt[Mt.Delete=20]="Delete",Mt[Mt.Digit0=21]="Digit0",Mt[Mt.Digit1=22]="Digit1",Mt[Mt.Digit2=23]="Digit2",Mt[Mt.Digit3=24]="Digit3",Mt[Mt.Digit4=25]="Digit4",Mt[Mt.Digit5=26]="Digit5",Mt[Mt.Digit6=27]="Digit6",Mt[Mt.Digit7=28]="Digit7",Mt[Mt.Digit8=29]="Digit8",Mt[Mt.Digit9=30]="Digit9",Mt[Mt.KeyA=31]="KeyA",Mt[Mt.KeyB=32]="KeyB",Mt[Mt.KeyC=33]="KeyC",Mt[Mt.KeyD=34]="KeyD",Mt[Mt.KeyE=35]="KeyE",Mt[Mt.KeyF=36]="KeyF",Mt[Mt.KeyG=37]="KeyG",Mt[Mt.KeyH=38]="KeyH",Mt[Mt.KeyI=39]="KeyI",Mt[Mt.KeyJ=40]="KeyJ",Mt[Mt.KeyK=41]="KeyK",Mt[Mt.KeyL=42]="KeyL",Mt[Mt.KeyM=43]="KeyM",Mt[Mt.KeyN=44]="KeyN",Mt[Mt.KeyO=45]="KeyO",Mt[Mt.KeyP=46]="KeyP",Mt[Mt.KeyQ=47]="KeyQ",Mt[Mt.KeyR=48]="KeyR",Mt[Mt.KeyS=49]="KeyS",Mt[Mt.KeyT=50]="KeyT",Mt[Mt.KeyU=51]="KeyU",Mt[Mt.KeyV=52]="KeyV",Mt[Mt.KeyW=53]="KeyW",Mt[Mt.KeyX=54]="KeyX",Mt[Mt.KeyY=55]="KeyY",Mt[Mt.KeyZ=56]="KeyZ",Mt[Mt.Meta=57]="Meta",Mt[Mt.ContextMenu=58]="ContextMenu",Mt[Mt.F1=59]="F1",Mt[Mt.F2=60]="F2",Mt[Mt.F3=61]="F3",Mt[Mt.F4=62]="F4",Mt[Mt.F5=63]="F5",Mt[Mt.F6=64]="F6",Mt[Mt.F7=65]="F7",Mt[Mt.F8=66]="F8",Mt[Mt.F9=67]="F9",Mt[Mt.F10=68]="F10",Mt[Mt.F11=69]="F11",Mt[Mt.F12=70]="F12",Mt[Mt.F13=71]="F13",Mt[Mt.F14=72]="F14",Mt[Mt.F15=73]="F15",Mt[Mt.F16=74]="F16",Mt[Mt.F17=75]="F17",Mt[Mt.F18=76]="F18",Mt[Mt.F19=77]="F19",Mt[Mt.F20=78]="F20",Mt[Mt.F21=79]="F21",Mt[Mt.F22=80]="F22",Mt[Mt.F23=81]="F23",Mt[Mt.F24=82]="F24",Mt[Mt.NumLock=83]="NumLock",Mt[Mt.ScrollLock=84]="ScrollLock",Mt[Mt.Semicolon=85]="Semicolon",Mt[Mt.Equal=86]="Equal",Mt[Mt.Comma=87]="Comma",Mt[Mt.Minus=88]="Minus",Mt[Mt.Period=89]="Period",Mt[Mt.Slash=90]="Slash",Mt[Mt.Backquote=91]="Backquote",Mt[Mt.BracketLeft=92]="BracketLeft",Mt[Mt.Backslash=93]="Backslash",Mt[Mt.BracketRight=94]="BracketRight",Mt[Mt.Quote=95]="Quote",Mt[Mt.OEM_8=96]="OEM_8",Mt[Mt.IntlBackslash=97]="IntlBackslash",Mt[Mt.Numpad0=98]="Numpad0",Mt[Mt.Numpad1=99]="Numpad1",Mt[Mt.Numpad2=100]="Numpad2",Mt[Mt.Numpad3=101]="Numpad3",Mt[Mt.Numpad4=102]="Numpad4",Mt[Mt.Numpad5=103]="Numpad5",Mt[Mt.Numpad6=104]="Numpad6",Mt[Mt.Numpad7=105]="Numpad7",Mt[Mt.Numpad8=106]="Numpad8",Mt[Mt.Numpad9=107]="Numpad9",Mt[Mt.NumpadMultiply=108]="NumpadMultiply",Mt[Mt.NumpadAdd=109]="NumpadAdd",Mt[Mt.NUMPAD_SEPARATOR=110]="NUMPAD_SEPARATOR",Mt[Mt.NumpadSubtract=111]="NumpadSubtract",Mt[Mt.NumpadDecimal=112]="NumpadDecimal",Mt[Mt.NumpadDivide=113]="NumpadDivide",Mt[Mt.KEY_IN_COMPOSITION=114]="KEY_IN_COMPOSITION",Mt[Mt.ABNT_C1=115]="ABNT_C1",Mt[Mt.ABNT_C2=116]="ABNT_C2",Mt[Mt.AudioVolumeMute=117]="AudioVolumeMute",Mt[Mt.AudioVolumeUp=118]="AudioVolumeUp",Mt[Mt.AudioVolumeDown=119]="AudioVolumeDown",Mt[Mt.BrowserSearch=120]="BrowserSearch",Mt[Mt.BrowserHome=121]="BrowserHome",Mt[Mt.BrowserBack=122]="BrowserBack",Mt[Mt.BrowserForward=123]="BrowserForward",Mt[Mt.MediaTrackNext=124]="MediaTrackNext",Mt[Mt.MediaTrackPrevious=125]="MediaTrackPrevious",Mt[Mt.MediaStop=126]="MediaStop",Mt[Mt.MediaPlayPause=127]="MediaPlayPause",Mt[Mt.LaunchMediaPlayer=128]="LaunchMediaPlayer",Mt[Mt.LaunchMail=129]="LaunchMail",Mt[Mt.LaunchApp2=130]="LaunchApp2",Mt[Mt.Clear=131]="Clear",Mt[Mt.MAX_VALUE=132]="MAX_VALUE",Mt))(Kei||{}),Gei=(o=>(o[o.Hint=1]="Hint",o[o.Info=2]="Info",o[o.Warning=4]="Warning",o[o.Error=8]="Error",o))(Gei||{}),qei=(e=>(e[e.Unnecessary=1]="Unnecessary",e[e.Deprecated=2]="Deprecated",e))(qei||{});var $ei=(e=>(e[e.LTR=0]="LTR",e[e.RTL=1]="RTL",e))($ei||{});var jei=class{static{this.CtrlCmd=2048}static{this.Shift=1024}static{this.Alt=512}static{this.WinCtrl=256}static chord(i,e){return Vi(i,e)}};function Cji(){return{editor:void 0,languages:void 0,CancellationTokenSource:Ye,Emitter:E,KeyCode:Kei,KeyMod:jei,Position:ye,Range:z,Selection:ti,SelectionDirection:$ei,MarkerSeverity:Gei,MarkerTag:qei,Uri:A,Token:Ije}}var Q0o=999,tw=class{constructor(i,e,t,o){this.searchString=i,this.isRegex=e,this.matchCase=t,this.wordSeparators=o}parseSearchRequest(){if(this.searchString==="")return null;let i;this.isRegex?i=Cje(this.searchString):i=this.searchString.indexOf(`
`)>=0;let e=null;try{e=N$(this.searchString,this.isRegex,{matchCase:this.matchCase,wholeWord:!1,multiline:i,global:!0,unicode:!0})}catch{return null}if(!e)return null;let t=!this.isRegex&&!i;return t&&this.searchString.toLowerCase()!==this.searchString.toUpperCase()&&(t=this.matchCase),new nft(e,this.wordSeparators?wC(this.wordSeparators,[]):null,t?this.searchString:null)}};function Cje(a){if(!a||a.length===0)return!1;for(let i=0,e=a.length;i<e;i++){let t=a.charCodeAt(i);if(t===10)return!0;if(t===92){if(i++,i>=e)break;let o=a.charCodeAt(i);if(o===110||o===114||o===87)return!0}}return!1}function g7(a,i,e){if(!e)return new T1(a,null);let t=[];for(let o=0,n=i.length;o<n;o++)t[o]=i[o];return new T1(a,t)}var gvt=class{constructor(i){let e=[],t=0;for(let o=0,n=i.length;o<n;o++)i.charCodeAt(o)===10&&(e[t++]=o);this._lineFeedsOffsets=e}findLineFeedCountBeforeOffset(i){let e=this._lineFeedsOffsets,t=0,o=e.length-1;if(o===-1||i<=e[0])return 0;for(;t<o;){let n=t+((o-t)/2>>0);e[n]>=i?o=n-1:e[n+1]>=i?(t=n,o=n):t=n+1}return t+1}},jae=class{static findMatches(i,e,t,o,n){let r=e.parseSearchRequest();return r?r.regex.multiline?this._doFindMatchesMultiline(i,t,new N1(r.wordSeparators,r.regex),o,n):this._doFindMatchesLineByLine(i,t,r,o,n):[]}static _getMultilineMatchRange(i,e,t,o,n,r){let s,l=0;o?(l=o.findLineFeedCountBeforeOffset(n),s=e+n+l):s=e+n;let c;if(o){let g=o.findLineFeedCountBeforeOffset(n+r.length)-l;c=s+r.length+g}else c=s+r.length;let u=i.getPositionAt(s),p=i.getPositionAt(c);return new z(u.lineNumber,u.column,p.lineNumber,p.column)}static _doFindMatchesMultiline(i,e,t,o,n){let r=i.getOffsetAt(e.getStartPosition()),s=i.getValueInRange(e,1),l=i.getEOL()===`\r
`?new gvt(s):null,c=[],u=0,p;for(t.reset(0);p=t.next(s);)if(c[u++]=g7(this._getMultilineMatchRange(i,r,s,l,p.index,p[0]),p,o),u>=n)return c;return c}static _doFindMatchesLineByLine(i,e,t,o,n){let r=[],s=0;if(e.startLineNumber===e.endLineNumber){let c=i.getLineContent(e.startLineNumber).substring(e.startColumn-1,e.endColumn-1);return s=this._findMatchesInLine(t,c,e.startLineNumber,e.startColumn-1,s,r,o,n),r}let l=i.getLineContent(e.startLineNumber).substring(e.startColumn-1);s=this._findMatchesInLine(t,l,e.startLineNumber,e.startColumn-1,s,r,o,n);for(let c=e.startLineNumber+1;c<e.endLineNumber&&s<n;c++)s=this._findMatchesInLine(t,i.getLineContent(c),c,0,s,r,o,n);if(s<n){let c=i.getLineContent(e.endLineNumber).substring(0,e.endColumn-1);s=this._findMatchesInLine(t,c,e.endLineNumber,0,s,r,o,n)}return r}static _findMatchesInLine(i,e,t,o,n,r,s,l){let c=i.wordSeparators;if(!s&&i.simpleSearch){let h=i.simpleSearch,g=h.length,f=e.length,v=-g;for(;(v=e.indexOf(h,v+g))!==-1;)if((!c||fvt(c,e,f,v,g))&&(r[n++]=new T1(new z(t,v+1+o,t,v+1+g+o),null),n>=l))return n;return n}let u=new N1(i.wordSeparators,i.regex),p;u.reset(0);do if(p=u.next(e),p&&(r[n++]=g7(new z(t,p.index+1+o,t,p.index+1+p[0].length+o),p,s),n>=l))return n;while(p);return n}static findNextMatch(i,e,t,o){let n=e.parseSearchRequest();if(!n)return null;let r=new N1(n.wordSeparators,n.regex);return n.regex.multiline?this._doFindNextMatchMultiline(i,t,r,o):this._doFindNextMatchLineByLine(i,t,r,o)}static _doFindNextMatchMultiline(i,e,t,o){let n=new ye(e.lineNumber,1),r=i.getOffsetAt(n),s=i.getLineCount(),l=i.getValueInRange(new z(n.lineNumber,n.column,s,i.getLineMaxColumn(s)),1),c=i.getEOL()===`\r
`?new gvt(l):null;t.reset(e.column-1);let u=t.next(l);return u?g7(this._getMultilineMatchRange(i,r,l,c,u.index,u[0]),u,o):e.lineNumber!==1||e.column!==1?this._doFindNextMatchMultiline(i,new ye(1,1),t,o):null}static _doFindNextMatchLineByLine(i,e,t,o){let n=i.getLineCount(),r=e.lineNumber,s=i.getLineContent(r),l=this._findFirstMatchInLine(t,s,r,e.column,o);if(l)return l;for(let c=1;c<=n;c++){let u=(r+c-1)%n,p=i.getLineContent(u+1),h=this._findFirstMatchInLine(t,p,u+1,1,o);if(h)return h}return null}static _findFirstMatchInLine(i,e,t,o,n){i.reset(o-1);let r=i.next(e);return r?g7(new z(t,r.index+1,t,r.index+1+r[0].length),r,n):null}static findPreviousMatch(i,e,t,o){let n=e.parseSearchRequest();if(!n)return null;let r=new N1(n.wordSeparators,n.regex);return n.regex.multiline?this._doFindPreviousMatchMultiline(i,t,r,o):this._doFindPreviousMatchLineByLine(i,t,r,o)}static _doFindPreviousMatchMultiline(i,e,t,o){let n=this._doFindMatchesMultiline(i,new z(1,1,e.lineNumber,e.column),t,o,10*Q0o);if(n.length>0)return n[n.length-1];let r=i.getLineCount();return e.lineNumber!==r||e.column!==i.getLineMaxColumn(r)?this._doFindPreviousMatchMultiline(i,new ye(r,i.getLineMaxColumn(r)),t,o):null}static _doFindPreviousMatchLineByLine(i,e,t,o){let n=i.getLineCount(),r=e.lineNumber,s=i.getLineContent(r).substring(0,e.column-1),l=this._findLastMatchInLine(t,s,r,o);if(l)return l;for(let c=1;c<=n;c++){let u=(n+r-c-1)%n,p=i.getLineContent(u+1),h=this._findLastMatchInLine(t,p,u+1,o);if(h)return h}return null}static _findLastMatchInLine(i,e,t,o){let n=null,r;for(i.reset(0);r=i.next(e);)n=g7(new z(t,r.index+1,t,r.index+1+r[0].length),r,o);return n}};function Y0o(a,i,e,t,o){if(t===0)return!0;let n=i.charCodeAt(t-1);if(a.get(n)!==0||n===13||n===10)return!0;if(o>0){let r=i.charCodeAt(t);if(a.get(r)!==0)return!0}return!1}function X0o(a,i,e,t,o){if(t+o===e)return!0;let n=i.charCodeAt(t+o);if(a.get(n)!==0||n===13||n===10)return!0;if(o>0){let r=i.charCodeAt(t+o-1);if(a.get(r)!==0)return!0}return!1}function fvt(a,i,e,t,o){return Y0o(a,i,e,t,o)&&X0o(a,i,e,t,o)}var N1=class{constructor(i,e){this._wordSeparators=i,this._searchRegex=e,this._prevMatchStartIndex=-1,this._prevMatchLength=0}reset(i){this._searchRegex.lastIndex=i,this._prevMatchStartIndex=-1,this._prevMatchLength=0}next(i){let e=i.length,t;do{if(this._prevMatchStartIndex+this._prevMatchLength===e||(t=this._searchRegex.exec(i),!t))return null;let o=t.index,n=t[0].length;if(o===this._prevMatchStartIndex&&n===this._prevMatchLength){if(n===0){uIe(i,e,this._searchRegex.lastIndex)>65535?this._searchRegex.lastIndex+=2:this._searchRegex.lastIndex+=1;continue}return null}if(this._prevMatchStartIndex=o,this._prevMatchLength=n,!this._wordSeparators||fvt(this._wordSeparators,i,e,o,n))return t}while(t);return null}};var Qae=class{static computeUnicodeHighlights(i,e,t){let o=t?t.startLineNumber:1,n=t?t.endLineNumber:i.getLineCount(),r=new vvt(e),s=r.getCandidateCodePoints(),l;s==="allNonBasicAscii"?l=new RegExp("[^\\t\\n\\r\\x20-\\x7E]","g"):l=new RegExp(`${J0o(Array.from(s))}`,"g");let c=new N1(null,l),u=[],p=!1,h,g=0,f=0,v=0;e:for(let b=o,S=n;b<=S;b++){let y=i.getLineContent(b),w=y.length;c.reset(0);do if(h=c.next(y),h){let k=h.index,T=h.index+h[0].length;if(k>0){let H=y.charCodeAt(k-1);ju(H)&&k--}if(T+1<w){let H=y.charCodeAt(T-1);ju(H)&&T++}let P=y.substring(k,T),O=Wx(k+1,r7,y,0);O&&O.endColumn<=k+1&&(O=null);let V=r.shouldHighlightNonBasicASCII(P,O?O.word:null);if(V!==0){if(V===3?g++:V===2?f++:V===1?v++:os(V),u.length>=1e3){p=!0;break e}u.push(new z(b,k+1,b,T+1))}}while(h)}return{ranges:u,hasMore:p,ambiguousCharacterCount:g,invisibleCharacterCount:f,nonBasicAsciiCharacterCount:v}}static computeUnicodeHighlightReason(i,e){let t=new vvt(e);switch(t.shouldHighlightNonBasicASCII(i,null)){case 0:return null;case 2:return{kind:1};case 3:{let n=i.codePointAt(0),r=t.ambiguousCharacters.getPrimaryConfusable(n),s=O9.getLocales().filter(l=>!O9.getInstance(new Set([...e.allowedLocales,l])).isAmbiguous(n));return{kind:0,confusableWith:String.fromCodePoint(r),notAmbiguousInLocales:s}}case 1:return{kind:2}}}};function J0o(a,i){return`[${ns(a.map(t=>String.fromCodePoint(t)).join(""))}]`}var vvt=class{constructor(i){this.options=i;this.allowedCodePoints=new Set(i.allowedCodePoints),this.ambiguousCharacters=O9.getInstance(new Set(i.allowedLocales))}getCandidateCodePoints(){if(this.options.nonBasicASCII)return"allNonBasicAscii";let i=new Set;if(this.options.invisibleCharacters)for(let e of uV.codePoints)xji(String.fromCodePoint(e))||i.add(e);if(this.options.ambiguousCharacters)for(let e of this.ambiguousCharacters.getConfusableCodePoints())i.add(e);for(let e of this.allowedCodePoints)i.delete(e);return i}shouldHighlightNonBasicASCII(i,e){let t=i.codePointAt(0);if(this.allowedCodePoints.has(t))return 0;if(this.options.nonBasicASCII)return 1;let o=!1,n=!1;if(e)for(let r of e){let s=r.codePointAt(0),l=g1(r);o=o||l,!l&&!this.ambiguousCharacters.isAmbiguous(s)&&!uV.isInvisibleCharacter(s)&&(n=!0)}return!o&&n?0:this.options.invisibleCharacters&&!xji(i)&&uV.isInvisibleCharacter(t)?2:this.options.ambiguousCharacters&&this.ambiguousCharacters.isAmbiguous(t)?3:0}};function xji(a){return a===" "||a===`
`||a==="	"}var f7=class{constructor(i,e,t){this.changes=i;this.moves=e;this.hitTimeout=t}},hye=class a{constructor(i,e){this.lineRangeMapping=i,this.changes=e}flip(){return new a(this.lineRangeMapping.flip(),this.changes.map(i=>i.flip()))}};var uo=class a{static ofLength(i,e){return new a(i,i+e)}static fromRange(i){return new a(i.startLineNumber,i.endLineNumber)}static fromRangeInclusive(i){return new a(i.startLineNumber,i.endLineNumber+1)}static{this.compareByStart=cl(i=>i.startLineNumber,hu)}static subtract(i,e){return e?i.startLineNumber<e.startLineNumber&&e.endLineNumberExclusive<i.endLineNumberExclusive?[new a(i.startLineNumber,e.startLineNumber),new a(e.endLineNumberExclusive,i.endLineNumberExclusive)]:e.startLineNumber<=i.startLineNumber&&i.endLineNumberExclusive<=e.endLineNumberExclusive?[]:e.endLineNumberExclusive<i.endLineNumberExclusive?[new a(Math.max(e.endLineNumberExclusive,i.startLineNumber),i.endLineNumberExclusive)]:[new a(i.startLineNumber,Math.min(e.startLineNumber,i.endLineNumberExclusive))]:[i]}static joinMany(i){if(i.length===0)return[];let e=new kP(i[0].slice());for(let t=1;t<i.length;t++)e=e.getUnion(new kP(i[t].slice()));return e.ranges}static join(i){if(i.length===0)throw new li("lineRanges cannot be empty");let e=i[0].startLineNumber,t=i[0].endLineNumberExclusive;for(let o=1;o<i.length;o++)e=Math.min(e,i[o].startLineNumber),t=Math.max(t,i[o].endLineNumberExclusive);return new a(e,t)}static deserialize(i){return new a(i[0],i[1])}constructor(i,e){if(i>e)throw new li(`startLineNumber ${i} cannot be after endLineNumberExclusive ${e}`);this.startLineNumber=i,this.endLineNumberExclusive=e}contains(i){return this.startLineNumber<=i&&i<this.endLineNumberExclusive}containsRange(i){return this.startLineNumber<=i.startLineNumber&&i.endLineNumberExclusive<=this.endLineNumberExclusive}get isEmpty(){return this.startLineNumber===this.endLineNumberExclusive}delta(i){return new a(this.startLineNumber+i,this.endLineNumberExclusive+i)}deltaLength(i){return new a(this.startLineNumber,this.endLineNumberExclusive+i)}get length(){return this.endLineNumberExclusive-this.startLineNumber}join(i){return new a(Math.min(this.startLineNumber,i.startLineNumber),Math.max(this.endLineNumberExclusive,i.endLineNumberExclusive))}toString(){return`[${this.startLineNumber},${this.endLineNumberExclusive})`}intersect(i){let e=Math.max(this.startLineNumber,i.startLineNumber),t=Math.min(this.endLineNumberExclusive,i.endLineNumberExclusive);if(e<=t)return new a(e,t)}intersectsStrict(i){return this.startLineNumber<i.endLineNumberExclusive&&i.startLineNumber<this.endLineNumberExclusive}intersectsOrTouches(i){return this.startLineNumber<=i.endLineNumberExclusive&&i.startLineNumber<=this.endLineNumberExclusive}equals(i){return this.startLineNumber===i.startLineNumber&&this.endLineNumberExclusive===i.endLineNumberExclusive}toInclusiveRange(){return this.isEmpty?null:new z(this.startLineNumber,1,this.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER)}toExclusiveRange(){return new z(this.startLineNumber,1,this.endLineNumberExclusive,1)}mapToLineArray(i){let e=[];for(let t=this.startLineNumber;t<this.endLineNumberExclusive;t++)e.push(i(t));return e}forEach(i){for(let e=this.startLineNumber;e<this.endLineNumberExclusive;e++)i(e)}serialize(){return[this.startLineNumber,this.endLineNumberExclusive]}toOffsetRange(){return new pi(this.startLineNumber-1,this.endLineNumberExclusive-1)}distanceToRange(i){return this.endLineNumberExclusive<=i.startLineNumber?i.startLineNumber-this.endLineNumberExclusive:i.endLineNumberExclusive<=this.startLineNumber?this.startLineNumber-i.endLineNumberExclusive:0}distanceToLine(i){return this.contains(i)?0:i<this.startLineNumber?this.startLineNumber-i:i-this.endLineNumberExclusive}addMargin(i,e){return new a(this.startLineNumber-i,this.endLineNumberExclusive+e)}},kP=class a{constructor(i=[]){this._normalizedRanges=i}get ranges(){return this._normalizedRanges}addRange(i){if(i.length===0)return;let e=Ky(this._normalizedRanges,o=>o.endLineNumberExclusive>=i.startLineNumber),t=y$(this._normalizedRanges,o=>o.startLineNumber<=i.endLineNumberExclusive)+1;if(e===t)this._normalizedRanges.splice(e,0,i);else if(e===t-1){let o=this._normalizedRanges[e];this._normalizedRanges[e]=o.join(i)}else{let o=this._normalizedRanges[e].join(this._normalizedRanges[t-1]).join(i);this._normalizedRanges.splice(e,t-e,o)}}contains(i){let e=I$(this._normalizedRanges,t=>t.startLineNumber<=i);return!!e&&e.endLineNumberExclusive>i}intersects(i){let e=I$(this._normalizedRanges,t=>t.startLineNumber<i.endLineNumberExclusive);return!!e&&e.endLineNumberExclusive>i.startLineNumber}getUnion(i){if(this._normalizedRanges.length===0)return i;if(i._normalizedRanges.length===0)return this;let e=[],t=0,o=0,n=null;for(;t<this._normalizedRanges.length||o<i._normalizedRanges.length;){let r=null;if(t<this._normalizedRanges.length&&o<i._normalizedRanges.length){let s=this._normalizedRanges[t],l=i._normalizedRanges[o];s.startLineNumber<l.startLineNumber?(r=s,t++):(r=l,o++)}else t<this._normalizedRanges.length?(r=this._normalizedRanges[t],t++):(r=i._normalizedRanges[o],o++);n===null?n=r:n.endLineNumberExclusive>=r.startLineNumber?n=new uo(n.startLineNumber,Math.max(n.endLineNumberExclusive,r.endLineNumberExclusive)):(e.push(n),n=r)}return n!==null&&e.push(n),new a(e)}subtractFrom(i){let e=Ky(this._normalizedRanges,r=>r.endLineNumberExclusive>=i.startLineNumber),t=y$(this._normalizedRanges,r=>r.startLineNumber<=i.endLineNumberExclusive)+1;if(e===t)return new a([i]);let o=[],n=i.startLineNumber;for(let r=e;r<t;r++){let s=this._normalizedRanges[r];s.startLineNumber>n&&o.push(new uo(n,s.startLineNumber)),n=s.endLineNumberExclusive}return n<i.endLineNumberExclusive&&o.push(new uo(n,i.endLineNumberExclusive)),new a(o)}toString(){return this._normalizedRanges.map(i=>i.toString()).join(", ")}getIntersection(i){let e=[],t=0,o=0;for(;t<this._normalizedRanges.length&&o<i._normalizedRanges.length;){let n=this._normalizedRanges[t],r=i._normalizedRanges[o],s=n.intersect(r);s&&!s.isEmpty&&e.push(s),n.endLineNumberExclusive<r.endLineNumberExclusive?t++:o++}return new a(e)}getWithDelta(i){return new a(this._normalizedRanges.map(e=>e.delta(i)))}};var pc=class a{constructor(i,e){this.lineCount=i;this.columnCount=e}static{this.zero=new a(0,0)}static lengthDiffNonNegative(i,e){return e.isLessThan(i)?a.zero:i.lineCount===e.lineCount?new a(0,e.columnCount-i.columnCount):new a(e.lineCount-i.lineCount,e.columnCount)}static betweenPositions(i,e){return i.lineNumber===e.lineNumber?new a(0,e.column-i.column):new a(e.lineNumber-i.lineNumber,e.column-1)}static fromPosition(i){return new a(i.lineNumber-1,i.column-1)}static ofRange(i){return a.betweenPositions(i.getStartPosition(),i.getEndPosition())}static ofText(i){let e=0,t=0;for(let o of i)o===`
`?(e++,t=0):t++;return new a(e,t)}static ofSubstr(i,e){return a.ofText(e.substring(i))}static sum(i,e){return i.reduce((t,o)=>t.add(e(o)),a.zero)}isZero(){return this.lineCount===0&&this.columnCount===0}isLessThan(i){return this.lineCount!==i.lineCount?this.lineCount<i.lineCount:this.columnCount<i.columnCount}isGreaterThan(i){return this.lineCount!==i.lineCount?this.lineCount>i.lineCount:this.columnCount>i.columnCount}isGreaterThanOrEqualTo(i){return this.lineCount!==i.lineCount?this.lineCount>i.lineCount:this.columnCount>=i.columnCount}equals(i){return this.lineCount===i.lineCount&&this.columnCount===i.columnCount}compare(i){return this.lineCount!==i.lineCount?this.lineCount-i.lineCount:this.columnCount-i.columnCount}add(i){return i.lineCount===0?new a(this.lineCount,this.columnCount+i.columnCount):new a(this.lineCount+i.lineCount,i.columnCount)}createRange(i){return this.lineCount===0?new z(i.lineNumber,i.column,i.lineNumber,i.column+this.columnCount):new z(i.lineNumber,i.column,i.lineNumber+this.lineCount,this.columnCount+1)}toRange(){return new z(1,1,this.lineCount+1,this.columnCount+1)}toLineRange(){return uo.ofLength(1,this.lineCount+1)}addToPosition(i){return this.lineCount===0?new ye(i.lineNumber,i.column+this.columnCount):new ye(i.lineNumber+this.lineCount,this.columnCount+1)}addToRange(i){return z.fromPositions(this.addToPosition(i.getStartPosition()),this.addToPosition(i.getEndPosition()))}toString(){return`${this.lineCount},${this.columnCount}`}};var gye=class{getOffsetRange(i){return new pi(this.getOffset(i.getStartPosition()),this.getOffset(i.getEndPosition()))}getRange(i){return z.fromPositions(this.getPosition(i.start),this.getPosition(i.endExclusive))}getStringEdit(i){let e=i.replacements.map(t=>this.getStringReplacement(t));return new aj.deps.StringEdit(e)}getStringReplacement(i){return new aj.deps.StringReplacement(this.getOffsetRange(i.range),i.text)}getTextReplacement(i){return new aj.deps.TextReplacement(this.getRange(i.replaceRange),i.newText)}getTextEdit(i){let e=i.replacements.map(t=>this.getTextReplacement(t));return new aj.deps.TextEdit(e)}},aj=class{static{this._deps=void 0}static get deps(){if(!this._deps)throw new Error("Dependencies not set. Call _setDependencies first.");return this._deps}};function kji(a){aj._deps=a}var EP=class extends gye{constructor(e){super();this.text=e}get lineStartOffsetByLineIdx(){return this._lineStartOffsetByLineIdx||this._computeLineOffsets(),this._lineStartOffsetByLineIdx}get lineEndOffsetByLineIdx(){return this._lineEndOffsetByLineIdx||this._computeLineOffsets(),this._lineEndOffsetByLineIdx}_computeLineOffsets(){this._lineStartOffsetByLineIdx=[],this._lineEndOffsetByLineIdx=[],this._lineStartOffsetByLineIdx.push(0);for(let e=0;e<this.text.length;e++)this.text.charAt(e)===`
`&&(this._lineStartOffsetByLineIdx.push(e+1),e>0&&this.text.charAt(e-1)==="\r"?this._lineEndOffsetByLineIdx.push(e-1):this._lineEndOffsetByLineIdx.push(e));this._lineEndOffsetByLineIdx.push(this.text.length)}getOffset(e){let t=this._validatePosition(e);return this.lineStartOffsetByLineIdx[t.lineNumber-1]+t.column-1}_validatePosition(e){if(e.lineNumber<1)return new ye(1,1);let t=this.textLength.lineCount+1;if(e.lineNumber>t){let n=this.getLineLength(t);return new ye(t,n+1)}if(e.column<1)return new ye(e.lineNumber,1);let o=this.getLineLength(e.lineNumber);return e.column-1>o?new ye(e.lineNumber,o+1):e}getPosition(e){let t=y$(this.lineStartOffsetByLineIdx,r=>r<=e),o=t+1,n=e-this.lineStartOffsetByLineIdx[t]+1;return new ye(o,n)}getTextLength(e){return aj.deps.TextLength.ofRange(this.getRange(e))}get textLength(){let e=this.lineStartOffsetByLineIdx.length-1;return new aj.deps.TextLength(e,this.text.length-this.lineStartOffsetByLineIdx[e])}getLineLength(e){return this.lineEndOffsetByLineIdx[e-1]-this.lineStartOffsetByLineIdx[e-1]}};var v7=class{constructor(){this._transformer=void 0}get endPositionExclusive(){return this.length.addToPosition(new ye(1,1))}get lineRange(){return this.length.toLineRange()}getValue(){return this.getValueOfRange(this.length.toRange())}getValueOfOffsetRange(i){return this.getValueOfRange(this.getTransformer().getRange(i))}getLineLength(i){return this.getValueOfRange(new z(i,1,i,Number.MAX_SAFE_INTEGER)).length}getTransformer(){return this._transformer||(this._transformer=new EP(this.getValue())),this._transformer}getLineAt(i){return this.getValueOfRange(new z(i,1,i,Number.MAX_SAFE_INTEGER))}getLines(){let i=this.getValue();return yc(i)}getLinesOfRange(i){return i.mapToLineArray(e=>this.getLineAt(e))}equals(i){return this===i?!0:this.getValue()===i.getValue()}},Qei=class extends v7{constructor(e,t){qy(t>=1);super();this._getLineContent=e;this._lineCount=t}getValueOfRange(e){if(e.startLineNumber===e.endLineNumber)return this._getLineContent(e.startLineNumber).substring(e.startColumn-1,e.endColumn-1);let t=this._getLineContent(e.startLineNumber).substring(e.startColumn-1);for(let o=e.startLineNumber+1;o<e.endLineNumber;o++)t+=`
`+this._getLineContent(o);return t+=`
`+this._getLineContent(e.endLineNumber).substring(0,e.endColumn-1),t}getLineLength(e){return this._getLineContent(e).length}get length(){let e=this._getLineContent(this._lineCount);return new pc(this._lineCount-1,e.length)}},Yae=class extends Qei{constructor(i){super(e=>i[e-1],i.length)}},jS=class extends v7{constructor(e){super();this.value=e;this._t=new EP(this.value)}getValueOfRange(e){return this._t.getOffsetRange(e).substring(this.value)}get length(){return this._t.textLength}getTransformer(){return this._t}};var Vp=class a{constructor(i){this.replacements=i;lh(()=>$y(i,(e,t)=>e.range.getEndPosition().isBeforeOrEqual(t.range.getStartPosition())))}static fromStringEdit(i,e){let t=i.replacements.map(o=>ss.fromStringReplacement(o,e));return new a(t)}static replace(i,e){return new a([new ss(i,e)])}static delete(i){return new a([new ss(i,"")])}static insert(i,e){return new a([new ss(z.fromPositions(i,i),e)])}static fromParallelReplacementsUnsorted(i){let e=i.slice().sort(cl(t=>t.range,z.compareRangesUsingStarts));return new a(e)}normalize(){let i=[];for(let e of this.replacements)if(i.length>0&&i[i.length-1].range.getEndPosition().equals(e.range.getStartPosition())){let t=i[i.length-1];i[i.length-1]=new ss(t.range.plusRange(e.range),t.text+e.text)}else e.isEmpty||i.push(e);return new a(i)}mapPosition(i){let e=0,t=0,o=0;for(let n of this.replacements){let r=n.range.getStartPosition();if(i.isBeforeOrEqual(r))break;let s=n.range.getEndPosition(),l=pc.ofText(n.text);if(i.isBefore(s)){let c=new ye(r.lineNumber+e,r.column+(r.lineNumber+e===t?o:0)),u=l.addToPosition(c);return bvt(c,u)}r.lineNumber+e!==t&&(o=0),e+=l.lineCount-(n.range.endLineNumber-n.range.startLineNumber),l.lineCount===0?s.lineNumber!==r.lineNumber?o+=l.columnCount-(s.column-1):o+=l.columnCount-(s.column-r.column):o=l.columnCount,t=s.lineNumber+e}return new ye(i.lineNumber+e,i.column+(i.lineNumber+e===t?o:0))}mapRange(i){function e(r){return r instanceof ye?r:r.getStartPosition()}function t(r){return r instanceof ye?r:r.getEndPosition()}let o=e(this.mapPosition(i.getStartPosition())),n=t(this.mapPosition(i.getEndPosition()));return bvt(o,n)}inverseMapPosition(i,e){return this.inverse(e).mapPosition(i)}inverseMapRange(i,e){return this.inverse(e).mapRange(i)}apply(i){let e="",t=new ye(1,1);for(let n of this.replacements){let r=n.range,s=r.getStartPosition(),l=r.getEndPosition(),c=bvt(t,s);c.isEmpty()||(e+=i.getValueOfRange(c)),e+=n.text,t=l}let o=bvt(t,i.endPositionExclusive);return o.isEmpty()||(e+=i.getValueOfRange(o)),e}applyToString(i){let e=new jS(i);return this.apply(e)}inverse(i){let e=this.getNewRanges();return new a(this.replacements.map((t,o)=>new ss(e[o],i.getValueOfRange(t.range))))}getNewRanges(){let i=[],e=0,t=0,o=0;for(let n of this.replacements){let r=pc.ofText(n.text),s=ye.lift({lineNumber:n.range.startLineNumber+t,column:n.range.startColumn+(n.range.startLineNumber===e?o:0)}),l=r.createRange(s);i.push(l),t=l.endLineNumber-n.range.endLineNumber,o=l.endColumn-n.range.endColumn,e=n.range.endLineNumber}return i}toReplacement(i){if(this.replacements.length===0)throw new li;if(this.replacements.length===1)return this.replacements[0];let e=this.replacements[0].range.getStartPosition(),t=this.replacements[this.replacements.length-1].range.getEndPosition(),o="";for(let n=0;n<this.replacements.length;n++){let r=this.replacements[n];if(o+=r.text,n<this.replacements.length-1){let s=this.replacements[n+1],l=z.fromPositions(r.range.getEndPosition(),s.range.getStartPosition()),c=i.getValueOfRange(l);o+=c}}return new ss(z.fromPositions(e,t),o)}equals(i){return $i(this.replacements,i.replacements,(e,t)=>e.equals(t))}compose(i){let e=this.normalize(),t=i.normalize();if(e.replacements.length===0)return t;if(t.replacements.length===0)return e;let o=[],n=0,r=1,s=1,l=0,c=0,u=0,p=0,h=null,g=0,f=0,v=!1,b=!1,S=1,y=1;function w(){if(!v)if(n<e.replacements.length){let T=e.replacements[n],P=T.range.getStartPosition();if(!(r===P.lineNumber&&s===P.column))l=r,c=s,u=P.lineNumber,p=P.column,h=null,r===P.lineNumber?(g=0,f=P.column-s):(g=P.lineNumber-r,f=P.column-1),v=!0,r=P.lineNumber,s=P.column;else{let V=T.range.getEndPosition();l=P.lineNumber,c=P.column,u=V.lineNumber,p=V.column,h=T.text;let H=0,G=0,$=T.text;for(let J=0;J<$.length;J++)$.charCodeAt(J)===10?(H++,G=0):G++;g=H,f=G,v=!0,r=V.lineNumber,s=V.column,n++}}else b=!0,l=r,c=s,v=!0}function k(T,P,O){if(P===0&&O===0)return["",T];let V=0,H=0;for(;V<P;){let G=T.indexOf(`
`,H);if(G===-1)throw new li("Text length mismatch");H=G+1,V++}return H+=O,[T.substring(0,H),T.substring(H)]}for(let T of t.replacements){let P=T.range.getStartPosition(),O=T.range.getEndPosition();for(;!(S===P.lineNumber&&y===P.column);){if(w(),b){let oe,de;S===P.lineNumber?(oe=0,de=P.column-y):(oe=P.lineNumber-S,de=P.column-1),S=P.lineNumber,y=P.column,oe===0?c+=de:(l+=oe,c=de+1);break}let J,ae;g===0?(J=S,ae=y+f):(J=S+g,ae=f+1);let he=!1;if(P.lineNumber<J?he=!0:P.lineNumber===J&&(he=P.column<ae),he){let oe,de;S===P.lineNumber?(oe=0,de=P.column-y):(oe=P.lineNumber-S,de=P.column-1);let Ce,xe;if(oe===g?(Ce=0,xe=f-de):(Ce=g-oe,xe=f),h!==null){let[ze,De]=k(h,oe,de);o.push(new ss(new z(l,c,u,p),ze)),h=De,g=Ce,f=xe,l=u,c=p}else{let ze,De;oe===0?(ze=l,De=c+de):(ze=l+oe,De=de+1),l=ze,c=De,g=Ce,f=xe}S=P.lineNumber,y=P.column;break}h!==null&&o.push(new ss(new z(l,c,u,p),h)),S=J,y=ae,v=!1}let V=null,H=null,G=null,$=null;for(;!(S===O.lineNumber&&y===O.column);){if(w(),b){let oe,de;S===O.lineNumber?(oe=0,de=O.column-y):(oe=O.lineNumber-S,de=O.column-1);let Ce,xe;oe===0?(Ce=l,xe=c+de):(Ce=l+oe,xe=de+1),V===null&&(V=l,H=c),G=Ce,$=xe,S=O.lineNumber,y=O.column,l=Ce,c=xe;break}let J,ae;g===0?(J=S,ae=y+f):(J=S+g,ae=f+1);let he=!1;if(O.lineNumber<J?he=!0:O.lineNumber===J&&(he=O.column<ae),he){let oe,de;S===O.lineNumber?(oe=0,de=O.column-y):(oe=O.lineNumber-S,de=O.column-1);let Ce,xe;if(oe===g?(Ce=0,xe=f-de):(Ce=g-oe,xe=f),h!==null){V===null&&(V=l,H=c),G=u,$=p;let[,ze]=k(h,oe,de);h=ze,g=Ce,f=xe,l=u,c=p}else{let ze,De;oe===0?(ze=l,De=c+de):(ze=l+oe,De=de+1),V===null&&(V=l,H=c),G=ze,$=De,l=ze,c=De,g=Ce,f=xe}S=O.lineNumber,y=O.column;break}V===null&&(V=l,H=c),G=u,$=p,S=J,y=ae,v=!1}if(V!==null)o.push(new ss(new z(V,H,G,$),T.text));else{w();let J=l,ae=c;o.push(new ss(new z(J,ae,J,ae),T.text))}}for(;w(),!b;)h!==null&&o.push(new ss(new z(l,c,u,p),h)),v=!1;return new a(o).normalize()}toString(i){return i===void 0?this.replacements.map(e=>e.toString()).join(`
`):typeof i=="string"?this.toString(new jS(i)):this.replacements.length===0?"":this.replacements.map(e=>{let o=i.getValueOfRange(e.range),n=z.fromPositions(new ye(Math.max(1,e.range.startLineNumber-1),1),e.range.getStartPosition()),r=i.getValueOfRange(n);r.length>10&&(r="..."+r.substring(r.length-10));let s=z.fromPositions(e.range.getEndPosition(),new ye(e.range.endLineNumber+1,1)),l=i.getValueOfRange(s);l.length>10&&(l=l.substring(0,10)+"...");let c=o;if(c.length>10){let p=Math.floor(5);c=c.substring(0,p)+"..."+c.substring(c.length-p)}let u=e.text;if(u.length>10){let p=Math.floor(5);u=u.substring(0,p)+"..."+u.substring(u.length-p)}return c.length===0?`${r}\u2770${u}\u2771${l}`:`${r}\u2770${c}\u21A6${u}\u2771${l}`}).join(`
`)}},ss=class a{constructor(i,e){this.range=i;this.text=e}static joinReplacements(i,e){if(i.length===0)throw new li;if(i.length===1)return i[0];let t=i[0].range.getStartPosition(),o=i[i.length-1].range.getEndPosition(),n="";for(let r=0;r<i.length;r++){let s=i[r];if(n+=s.text,r<i.length-1){let l=i[r+1],c=z.fromPositions(s.range.getEndPosition(),l.range.getStartPosition()),u=e.getValueOfRange(c);n+=u}}return new a(z.fromPositions(t,o),n)}static fromStringReplacement(i,e){return new a(e.getTransformer().getRange(i.replaceRange),i.newText)}static delete(i){return new a(i,"")}get isEmpty(){return this.range.isEmpty()&&this.text.length===0}static equals(i,e){return i.range.equalsRange(e.range)&&i.text===e.text}toSingleEditOperation(){return{range:this.range,text:this.text}}toEdit(){return new Vp([this])}equals(i){return a.equals(this,i)}extendToCoverRange(i,e){if(this.range.containsRange(i))return this;let t=this.range.plusRange(i),o=e.getValueOfRange(z.fromPositions(t.getStartPosition(),this.range.getStartPosition())),n=e.getValueOfRange(z.fromPositions(this.range.getEndPosition(),t.getEndPosition())),r=o+this.text+n;return new a(t,r)}extendToFullLine(i){let e=new z(this.range.startLineNumber,1,this.range.endLineNumber,i.getTransformer().getLineLength(this.range.endLineNumber)+1);return this.extendToCoverRange(e,i)}removeCommonPrefixAndSuffix(i){return this.removeCommonPrefix(i).removeCommonSuffix(i)}removeCommonPrefix(i){let e=i.getValueOfRange(this.range).replaceAll(`\r
`,`
`),t=this.text.replaceAll(`\r
`,`
`),o=tf(e,t),n=pc.ofText(e.substring(0,o)).addToPosition(this.range.getStartPosition()),r=t.substring(o),s=z.fromPositions(n,this.range.getEndPosition());return new a(s,r)}removeCommonSuffix(i){let e=i.getValueOfRange(this.range).replaceAll(`\r
`,`
`),t=this.text.replaceAll(`\r
`,`
`),o=vC(e,t),n=pc.ofText(e.substring(0,e.length-o)).addToPosition(this.range.getStartPosition()),r=t.substring(0,t.length-o),s=z.fromPositions(this.range.getStartPosition(),n);return new a(s,r)}isEffectiveDeletion(i){let e=this.text.replaceAll(`\r
`,`
`),t=i.getValueOfRange(this.range).replaceAll(`\r
`,`
`),o=tf(e,t);e=e.substring(o),t=t.substring(o);let n=vC(e,t);return e=e.substring(0,e.length-n),t=t.substring(0,t.length-n),e===""}toString(){let i=this.range.getStartPosition(),e=this.range.getEndPosition();return`(${i.lineNumber},${i.column} -> ${e.lineNumber},${e.column}): "${this.text}"`}};function bvt(a,i){if(a.lineNumber===i.lineNumber&&a.column===Number.MAX_SAFE_INTEGER)return z.fromPositions(i,i);if(!a.isBeforeOrEqual(i))throw new li("start must be before end");return new z(a.lineNumber,a.column,i.lineNumber,i.column)}var jI=class a{static inverse(i,e,t){let o=[],n=1,r=1;for(let l of i){let c=new a(new uo(n,l.original.startLineNumber),new uo(r,l.modified.startLineNumber));c.modified.isEmpty||o.push(c),n=l.original.endLineNumberExclusive,r=l.modified.endLineNumberExclusive}let s=new a(new uo(n,e+1),new uo(r,t+1));return s.modified.isEmpty||o.push(s),o}static clip(i,e,t){let o=[];for(let n of i){let r=n.original.intersect(e),s=n.modified.intersect(t);r&&!r.isEmpty&&s&&!s.isEmpty&&o.push(new a(r,s))}return o}constructor(i,e){this.original=i,this.modified=e}toString(){return`{${this.original.toString()}->${this.modified.toString()}}`}flip(){return new a(this.modified,this.original)}join(i){return new a(this.original.join(i.original),this.modified.join(i.modified))}get changedLineCount(){return Math.max(this.original.length,this.modified.length)}toRangeMapping(){let i=this.original.toInclusiveRange(),e=this.modified.toInclusiveRange();if(i&&e)return new Eg(i,e);if(this.original.startLineNumber===1||this.modified.startLineNumber===1){if(!(this.modified.startLineNumber===1&&this.original.startLineNumber===1))throw new li("not a valid diff");return new Eg(new z(this.original.startLineNumber,1,this.original.endLineNumberExclusive,1),new z(this.modified.startLineNumber,1,this.modified.endLineNumberExclusive,1))}else return new Eg(new z(this.original.startLineNumber-1,Number.MAX_SAFE_INTEGER,this.original.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER),new z(this.modified.startLineNumber-1,Number.MAX_SAFE_INTEGER,this.modified.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER))}toRangeMapping2(i,e){if(Eji(this.original.endLineNumberExclusive,i)&&Eji(this.modified.endLineNumberExclusive,e))return new Eg(new z(this.original.startLineNumber,1,this.original.endLineNumberExclusive,1),new z(this.modified.startLineNumber,1,this.modified.endLineNumberExclusive,1));if(!this.original.isEmpty&&!this.modified.isEmpty)return new Eg(z.fromPositions(new ye(this.original.startLineNumber,1),fye(new ye(this.original.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER),i)),z.fromPositions(new ye(this.modified.startLineNumber,1),fye(new ye(this.modified.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER),e)));if(this.original.startLineNumber>1&&this.modified.startLineNumber>1)return new Eg(z.fromPositions(fye(new ye(this.original.startLineNumber-1,Number.MAX_SAFE_INTEGER),i),fye(new ye(this.original.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER),i)),z.fromPositions(fye(new ye(this.modified.startLineNumber-1,Number.MAX_SAFE_INTEGER),e),fye(new ye(this.modified.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER),e)));throw new li}};function fye(a,i){if(a.lineNumber<1)return new ye(1,1);if(a.lineNumber>i.length)return new ye(i.length,i[i.length-1].length+1);let e=i[a.lineNumber-1];return a.column>e.length+1?new ye(a.lineNumber,e.length+1):a}function Eji(a,i){return a>=1&&a<=i.length}var Uf=class a extends jI{static toTextEdit(i,e){let t=[];for(let o of i)for(let n of o.innerChanges??[]){let r=n.toTextEdit(e);t.push(r)}return new Vp(t)}static fromRangeMappings(i){let e=uo.join(i.map(o=>uo.fromRangeInclusive(o.originalRange))),t=uo.join(i.map(o=>uo.fromRangeInclusive(o.modifiedRange)));return new a(e,t,i)}constructor(i,e,t){super(i,e),this.innerChanges=t}flip(){return new a(this.modified,this.original,this.innerChanges?.map(i=>i.flip()))}withInnerChangesFromLineRanges(){return new a(this.original,this.modified,[this.toRangeMapping()])}},Eg=class a{static fromEdit(i){let e=i.getNewRanges();return i.replacements.map((o,n)=>new a(o.range,e[n]))}static fromEditJoin(i){let e=i.getNewRanges(),t=i.replacements.map((o,n)=>new a(o.range,e[n]));return a.join(t)}static join(i){if(i.length===0)throw new li("Cannot join an empty list of range mappings");let e=i[0];for(let t=1;t<i.length;t++)e=e.join(i[t]);return e}static assertSorted(i){for(let e=1;e<i.length;e++){let t=i[e-1],o=i[e];if(!(t.originalRange.getEndPosition().isBeforeOrEqual(o.originalRange.getStartPosition())&&t.modifiedRange.getEndPosition().isBeforeOrEqual(o.modifiedRange.getStartPosition())))throw new li("Range mappings must be sorted")}}constructor(i,e){this.originalRange=i,this.modifiedRange=e}toString(){return`{${this.originalRange.toString()}->${this.modifiedRange.toString()}}`}flip(){return new a(this.modifiedRange,this.originalRange)}toTextEdit(i){let e=i.getValueOfRange(this.modifiedRange);return new ss(this.originalRange,e)}join(i){return new a(this.originalRange.plusRange(i.originalRange),this.modifiedRange.plusRange(i.modifiedRange))}};function vye(a,i,e,t=!1){let o=[];for(let n of D9(a.map(r=>Z0o(r,i,e)),(r,s)=>r.original.intersectsOrTouches(s.original)||r.modified.intersectsOrTouches(s.modified))){let r=n[0],s=n[n.length-1];o.push(new Uf(r.original.join(s.original),r.modified.join(s.modified),n.map(l=>l.innerChanges[0])))}return lh(()=>!t&&o.length>0&&(o[0].modified.startLineNumber!==o[0].original.startLineNumber||e.length.lineCount-o[o.length-1].modified.endLineNumberExclusive!==i.length.lineCount-o[o.length-1].original.endLineNumberExclusive)?!1:$y(o,(n,r)=>r.original.startLineNumber-n.original.endLineNumberExclusive===r.modified.startLineNumber-n.modified.endLineNumberExclusive&&n.original.endLineNumberExclusive<r.original.startLineNumber&&n.modified.endLineNumberExclusive<r.modified.startLineNumber)),o}function Z0o(a,i,e){let t=0,o=0;a.modifiedRange.endColumn===1&&a.originalRange.endColumn===1&&a.originalRange.startLineNumber+t<=a.originalRange.endLineNumber&&a.modifiedRange.startLineNumber+t<=a.modifiedRange.endLineNumber&&(o=-1),a.modifiedRange.startColumn-1>=e.getLineLength(a.modifiedRange.startLineNumber)&&a.originalRange.startColumn-1>=i.getLineLength(a.originalRange.startLineNumber)&&a.originalRange.startLineNumber<=a.originalRange.endLineNumber+o&&a.modifiedRange.startLineNumber<=a.modifiedRange.endLineNumber+o&&(t=1);let n=new uo(a.originalRange.startLineNumber+t,a.originalRange.endLineNumber+1+o),r=new uo(a.modifiedRange.startLineNumber+t,a.modifiedRange.endLineNumber+1+o);return new Uf(n,r,[a])}var eWo=3,Svt=class{computeDiff(i,e,t){let n=new kje(i,e,{maxComputationTime:t.maxComputationTimeMs,shouldIgnoreTrimWhitespace:t.ignoreTrimWhitespace,shouldComputeCharChanges:!0,shouldMakePrettyDiff:!0,shouldPostProcessCharChanges:!0}).computeDiff(),r=[],s=null;for(let l of n.changes){let c;l.originalEndLineNumber===0?c=new uo(l.originalStartLineNumber+1,l.originalStartLineNumber+1):c=new uo(l.originalStartLineNumber,l.originalEndLineNumber+1);let u;l.modifiedEndLineNumber===0?u=new uo(l.modifiedStartLineNumber+1,l.modifiedStartLineNumber+1):u=new uo(l.modifiedStartLineNumber,l.modifiedEndLineNumber+1);let p=new Uf(c,u,l.charChanges?.map(h=>new Eg(new z(h.originalStartLineNumber,h.originalStartColumn,h.originalEndLineNumber,h.originalEndColumn),new z(h.modifiedStartLineNumber,h.modifiedStartColumn,h.modifiedEndLineNumber,h.modifiedEndColumn))));s&&(s.modified.endLineNumberExclusive===p.modified.startLineNumber||s.original.endLineNumberExclusive===p.original.startLineNumber)&&(p=new Uf(s.original.join(p.original),s.modified.join(p.modified),s.innerChanges&&p.innerChanges?s.innerChanges.concat(p.innerChanges):void 0),r.pop()),r.push(p),s=p}return lh(()=>$y(r,(l,c)=>c.original.startLineNumber-l.original.endLineNumberExclusive===c.modified.startLineNumber-l.modified.endLineNumberExclusive&&l.original.endLineNumberExclusive<c.original.startLineNumber&&l.modified.endLineNumberExclusive<c.modified.startLineNumber)),new f7(r,[],n.quitEarly)}};function _ji(a,i,e,t){return new xP(a,i,e).ComputeDiff(t)}var Ivt=class{constructor(i){let e=[],t=[];for(let o=0,n=i.length;o<n;o++)e[o]=Xei(i[o],1),t[o]=Jei(i[o],1);this.lines=i,this._startColumns=e,this._endColumns=t}getElements(){let i=[];for(let e=0,t=this.lines.length;e<t;e++)i[e]=this.lines[e].substring(this._startColumns[e]-1,this._endColumns[e]-1);return i}getStrictElement(i){return this.lines[i]}getStartLineNumber(i){return i+1}getEndLineNumber(i){return i+1}createCharSequence(i,e,t){let o=[],n=[],r=[],s=0;for(let l=e;l<=t;l++){let c=this.lines[l],u=i?this._startColumns[l]:1,p=i?this._endColumns[l]:c.length+1;for(let h=u;h<p;h++)o[s]=c.charCodeAt(h-1),n[s]=l+1,r[s]=h,s++;!i&&l<t&&(o[s]=10,n[s]=l+1,r[s]=c.length+1,s++)}return new Yei(o,n,r)}},Yei=class{constructor(i,e,t){this._charCodes=i,this._lineNumbers=e,this._columns=t}toString(){return"["+this._charCodes.map((i,e)=>(i===10?"\\n":String.fromCharCode(i))+`-(${this._lineNumbers[e]},${this._columns[e]})`).join(", ")+"]"}_assertIndex(i,e){if(i<0||i>=e.length)throw new Error("Illegal index")}getElements(){return this._charCodes}getStartLineNumber(i){return i>0&&i===this._lineNumbers.length?this.getEndLineNumber(i-1):(this._assertIndex(i,this._lineNumbers),this._lineNumbers[i])}getEndLineNumber(i){return i===-1?this.getStartLineNumber(i+1):(this._assertIndex(i,this._lineNumbers),this._charCodes[i]===10?this._lineNumbers[i]+1:this._lineNumbers[i])}getStartColumn(i){return i>0&&i===this._columns.length?this.getEndColumn(i-1):(this._assertIndex(i,this._columns),this._columns[i])}getEndColumn(i){return i===-1?this.getStartColumn(i+1):(this._assertIndex(i,this._columns),this._charCodes[i]===10?1:this._columns[i]+1)}},bye=class a{constructor(i,e,t,o,n,r,s,l){this.originalStartLineNumber=i,this.originalStartColumn=e,this.originalEndLineNumber=t,this.originalEndColumn=o,this.modifiedStartLineNumber=n,this.modifiedStartColumn=r,this.modifiedEndLineNumber=s,this.modifiedEndColumn=l}static createFromDiffChange(i,e,t){let o=e.getStartLineNumber(i.originalStart),n=e.getStartColumn(i.originalStart),r=e.getEndLineNumber(i.originalStart+i.originalLength-1),s=e.getEndColumn(i.originalStart+i.originalLength-1),l=t.getStartLineNumber(i.modifiedStart),c=t.getStartColumn(i.modifiedStart),u=t.getEndLineNumber(i.modifiedStart+i.modifiedLength-1),p=t.getEndColumn(i.modifiedStart+i.modifiedLength-1);return new a(o,n,r,s,l,c,u,p)}};function tWo(a){if(a.length<=1)return a;let i=[a[0]],e=i[0];for(let t=1,o=a.length;t<o;t++){let n=a[t],r=n.originalStart-(e.originalStart+e.originalLength),s=n.modifiedStart-(e.modifiedStart+e.modifiedLength);Math.min(r,s)<eWo?(e.originalLength=n.originalStart+n.originalLength-e.originalStart,e.modifiedLength=n.modifiedStart+n.modifiedLength-e.modifiedStart):(i.push(n),e=n)}return i}var xje=class a{constructor(i,e,t,o,n){this.originalStartLineNumber=i,this.originalEndLineNumber=e,this.modifiedStartLineNumber=t,this.modifiedEndLineNumber=o,this.charChanges=n}static createFromDiffResult(i,e,t,o,n,r,s){let l,c,u,p,h;if(e.originalLength===0?(l=t.getStartLineNumber(e.originalStart)-1,c=0):(l=t.getStartLineNumber(e.originalStart),c=t.getEndLineNumber(e.originalStart+e.originalLength-1)),e.modifiedLength===0?(u=o.getStartLineNumber(e.modifiedStart)-1,p=0):(u=o.getStartLineNumber(e.modifiedStart),p=o.getEndLineNumber(e.modifiedStart+e.modifiedLength-1)),r&&e.originalLength>0&&e.originalLength<20&&e.modifiedLength>0&&e.modifiedLength<20&&n()){let g=t.createCharSequence(i,e.originalStart,e.originalStart+e.originalLength-1),f=o.createCharSequence(i,e.modifiedStart,e.modifiedStart+e.modifiedLength-1);if(g.getElements().length>0&&f.getElements().length>0){let v=_ji(g,f,n,!0).changes;s&&(v=tWo(v)),h=[];for(let b=0,S=v.length;b<S;b++)h.push(bye.createFromDiffChange(v[b],g,f))}}return new a(l,c,u,p,h)}},kje=class{constructor(i,e,t){this.shouldComputeCharChanges=t.shouldComputeCharChanges,this.shouldPostProcessCharChanges=t.shouldPostProcessCharChanges,this.shouldIgnoreTrimWhitespace=t.shouldIgnoreTrimWhitespace,this.shouldMakePrettyDiff=t.shouldMakePrettyDiff,this.originalLines=i,this.modifiedLines=e,this.original=new Ivt(i),this.modified=new Ivt(e),this.continueLineDiff=Tji(t.maxComputationTime),this.continueCharDiff=Tji(t.maxComputationTime===0?0:Math.min(t.maxComputationTime,5e3))}computeDiff(){if(this.original.lines.length===1&&this.original.lines[0].length===0)return this.modified.lines.length===1&&this.modified.lines[0].length===0?{quitEarly:!1,changes:[]}:{quitEarly:!1,changes:[{originalStartLineNumber:1,originalEndLineNumber:1,modifiedStartLineNumber:1,modifiedEndLineNumber:this.modified.lines.length,charChanges:void 0}]};if(this.modified.lines.length===1&&this.modified.lines[0].length===0)return{quitEarly:!1,changes:[{originalStartLineNumber:1,originalEndLineNumber:this.original.lines.length,modifiedStartLineNumber:1,modifiedEndLineNumber:1,charChanges:void 0}]};let i=_ji(this.original,this.modified,this.continueLineDiff,this.shouldMakePrettyDiff),e=i.changes,t=i.quitEarly;if(this.shouldIgnoreTrimWhitespace){let s=[];for(let l=0,c=e.length;l<c;l++)s.push(xje.createFromDiffResult(this.shouldIgnoreTrimWhitespace,e[l],this.original,this.modified,this.continueCharDiff,this.shouldComputeCharChanges,this.shouldPostProcessCharChanges));return{quitEarly:t,changes:s}}let o=[],n=0,r=0;for(let s=-1,l=e.length;s<l;s++){let c=s+1<l?e[s+1]:null,u=c?c.originalStart:this.originalLines.length,p=c?c.modifiedStart:this.modifiedLines.length;for(;n<u&&r<p;){let h=this.originalLines[n],g=this.modifiedLines[r];if(h!==g){{let f=Xei(h,1),v=Xei(g,1);for(;f>1&&v>1;){let b=h.charCodeAt(f-2),S=g.charCodeAt(v-2);if(b!==S)break;f--,v--}(f>1||v>1)&&this._pushTrimWhitespaceCharChange(o,n+1,1,f,r+1,1,v)}{let f=Jei(h,1),v=Jei(g,1),b=h.length+1,S=g.length+1;for(;f<b&&v<S;){let y=h.charCodeAt(f-1),w=h.charCodeAt(v-1);if(y!==w)break;f++,v++}(f<b||v<S)&&this._pushTrimWhitespaceCharChange(o,n+1,f,b,r+1,v,S)}}n++,r++}c&&(o.push(xje.createFromDiffResult(this.shouldIgnoreTrimWhitespace,c,this.original,this.modified,this.continueCharDiff,this.shouldComputeCharChanges,this.shouldPostProcessCharChanges)),n+=c.originalLength,r+=c.modifiedLength)}return{quitEarly:t,changes:o}}_pushTrimWhitespaceCharChange(i,e,t,o,n,r,s){if(this._mergeTrimWhitespaceCharChange(i,e,t,o,n,r,s))return;let l;this.shouldComputeCharChanges&&(l=[new bye(e,t,e,o,n,r,n,s)]),i.push(new xje(e,e,n,n,l))}_mergeTrimWhitespaceCharChange(i,e,t,o,n,r,s){let l=i.length;if(l===0)return!1;let c=i[l-1];return c.originalEndLineNumber===0||c.modifiedEndLineNumber===0?!1:c.originalEndLineNumber===e&&c.modifiedEndLineNumber===n?(this.shouldComputeCharChanges&&c.charChanges&&c.charChanges.push(new bye(e,t,e,o,n,r,n,s)),!0):c.originalEndLineNumber+1===e&&c.modifiedEndLineNumber+1===n?(c.originalEndLineNumber=e,c.modifiedEndLineNumber=n,this.shouldComputeCharChanges&&c.charChanges&&c.charChanges.push(new bye(e,t,e,o,n,r,n,s)),!0):!1}};function Xei(a,i){let e=nm(a);return e===-1?i:e+1}function Jei(a,i){let e=hv(a);return e===-1?i:e+2}function Tji(a){if(a===0)return()=>!0;let i=Date.now();return()=>Date.now()-i<a}var F1=class a{constructor(i,e){this.diffs=i;this.hitTimeout=e}static trivial(i,e){return new a([new Tg(pi.ofLength(i.length),pi.ofLength(e.length))],!1)}static trivialTimedOut(i,e){return new a([new Tg(pi.ofLength(i.length),pi.ofLength(e.length))],!0)}},Tg=class a{constructor(i,e){this.seq1Range=i;this.seq2Range=e}static invert(i,e){let t=[];return aht(i,(o,n)=>{t.push(a.fromOffsetPairs(o?o.getEndExclusives():O1.zero,n?n.getStarts():new O1(e,(o?o.seq2Range.endExclusive-o.seq1Range.endExclusive:0)+e)))}),t}static fromOffsetPairs(i,e){return new a(new pi(i.offset1,e.offset1),new pi(i.offset2,e.offset2))}static assertSorted(i){let e;for(let t of i){if(e&&!(e.seq1Range.endExclusive<=t.seq1Range.start&&e.seq2Range.endExclusive<=t.seq2Range.start))throw new li("Sequence diffs must be sorted");e=t}}swap(){return new a(this.seq2Range,this.seq1Range)}toString(){return`${this.seq1Range} <-> ${this.seq2Range}`}join(i){return new a(this.seq1Range.join(i.seq1Range),this.seq2Range.join(i.seq2Range))}delta(i){return i===0?this:new a(this.seq1Range.delta(i),this.seq2Range.delta(i))}deltaStart(i){return i===0?this:new a(this.seq1Range.deltaStart(i),this.seq2Range.deltaStart(i))}deltaEnd(i){return i===0?this:new a(this.seq1Range.deltaEnd(i),this.seq2Range.deltaEnd(i))}intersectsOrTouches(i){return this.seq1Range.intersectsOrTouches(i.seq1Range)||this.seq2Range.intersectsOrTouches(i.seq2Range)}intersect(i){let e=this.seq1Range.intersect(i.seq1Range),t=this.seq2Range.intersect(i.seq2Range);if(!(!e||!t))return new a(e,t)}getStarts(){return new O1(this.seq1Range.start,this.seq2Range.start)}getEndExclusives(){return new O1(this.seq1Range.endExclusive,this.seq2Range.endExclusive)}},O1=class a{constructor(i,e){this.offset1=i;this.offset2=e}static{this.zero=new a(0,0)}static{this.max=new a(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER)}toString(){return`${this.offset1} <-> ${this.offset2}`}delta(i){return i===0?this:new a(this.offset1+i,this.offset2+i)}equals(i){return this.offset1===i.offset1&&this.offset2===i.offset2}},b7=class a{static{this.instance=new a}isValid(){return!0}},yvt=class{constructor(i){this.timeout=i;this.startTime=Date.now();this.valid=!0;if(i<=0)throw new li("timeout must be positive")}isValid(){return!(Date.now()-this.startTime<this.timeout)&&this.valid&&(this.valid=!1),this.valid}disable(){this.timeout=Number.MAX_SAFE_INTEGER,this.isValid=()=>!0,this.valid=!0}};var Sye=class{constructor(i,e){this.width=i;this.height=e;this.array=[];this.array=new Array(i*e)}get(i,e){return this.array[i+e*this.width]}set(i,e,t){this.array[i+e*this.width]=t}};function Tje(a){return a===32||a===9}var Eje=class a{constructor(i,e,t){this.range=i;this.lines=e;this.source=t;this.histogram=[];let o=0;for(let n=i.startLineNumber-1;n<i.endLineNumberExclusive-1;n++){let r=e[n];for(let l=0;l<r.length;l++){o++;let c=r[l],u=a.getKey(c);this.histogram[u]=(this.histogram[u]||0)+1}o++;let s=a.getKey(`
`);this.histogram[s]=(this.histogram[s]||0)+1}this.totalCount=o}static{this.chrKeys=new Map}static getKey(i){let e=this.chrKeys.get(i);return e===void 0&&(e=this.chrKeys.size,this.chrKeys.set(i,e)),e}computeSimilarity(i){let e=0,t=Math.max(this.histogram.length,i.histogram.length);for(let o=0;o<t;o++)e+=Math.abs((this.histogram[o]??0)-(i.histogram[o]??0));return 1-e/(this.totalCount+i.totalCount)}};var wvt=class{compute(i,e,t=b7.instance,o){if(i.length===0||e.length===0)return F1.trivial(i,e);let n=new Sye(i.length,e.length),r=new Sye(i.length,e.length),s=new Sye(i.length,e.length);for(let f=0;f<i.length;f++)for(let v=0;v<e.length;v++){if(!t.isValid())return F1.trivialTimedOut(i,e);let b=f===0?0:n.get(f-1,v),S=v===0?0:n.get(f,v-1),y;i.getElement(f)===e.getElement(v)?(f===0||v===0?y=0:y=n.get(f-1,v-1),f>0&&v>0&&r.get(f-1,v-1)===3&&(y+=s.get(f-1,v-1)),y+=o?o(f,v):1):y=-1;let w=Math.max(b,S,y);if(w===y){let k=f>0&&v>0?s.get(f-1,v-1):0;s.set(f,v,k+1),r.set(f,v,3)}else w===b?(s.set(f,v,0),r.set(f,v,1)):w===S&&(s.set(f,v,0),r.set(f,v,2));n.set(f,v,w)}let l=[],c=i.length,u=e.length;function p(f,v){(f+1!==c||v+1!==u)&&l.push(new Tg(new pi(f+1,c),new pi(v+1,u))),c=f,u=v}let h=i.length-1,g=e.length-1;for(;h>=0&&g>=0;)r.get(h,g)===3?(p(h,g),h--,g--):r.get(h,g)===1?h--:g--;return p(-1,-1),l.reverse(),new F1(l,!1)}};var Iye=class{compute(i,e,t=b7.instance){if(i.length===0||e.length===0)return F1.trivial(i,e);let o=i,n=e;function r(v,b){for(;v<o.length&&b<n.length&&o.getElement(v)===n.getElement(b);)v++,b++;return v}let s=0,l=new Zei;l.set(0,r(0,0));let c=new eti;c.set(0,l.get(0)===0?null:new Cvt(null,0,0,l.get(0)));let u=0;e:for(;;){if(s++,!t.isValid())return F1.trivialTimedOut(o,n);let v=-Math.min(s,n.length+s%2),b=Math.min(s,o.length+s%2);for(u=v;u<=b;u+=2){let S=0,y=u===b?-1:l.get(u+1),w=u===v?-1:l.get(u-1)+1;S++;let k=Math.min(Math.max(y,w),o.length),T=k-u;if(S++,k>o.length||T>n.length)continue;let P=r(k,T);l.set(u,P);let O=k===y?c.get(u+1):c.get(u-1);if(c.set(u,P!==k?new Cvt(O,k,T,P-k):O),l.get(u)===o.length&&l.get(u)-u===n.length)break e}}let p=c.get(u),h=[],g=o.length,f=n.length;for(;;){let v=p?p.x+p.length:0,b=p?p.y+p.length:0;if((v!==g||b!==f)&&h.push(new Tg(new pi(v,g),new pi(b,f))),!p)break;g=p.x,f=p.y,p=p.prev}return h.reverse(),new F1(h,!1)}},Cvt=class{constructor(i,e,t,o){this.prev=i;this.x=e;this.y=t;this.length=o}},Zei=class{constructor(){this.positiveArr=new Int32Array(10);this.negativeArr=new Int32Array(10)}get(i){return i<0?(i=-i-1,this.negativeArr[i]):this.positiveArr[i]}set(i,e){if(i<0){if(i=-i-1,i>=this.negativeArr.length){let t=this.negativeArr;this.negativeArr=new Int32Array(t.length*2),this.negativeArr.set(t)}this.negativeArr[i]=e}else{if(i>=this.positiveArr.length){let t=this.positiveArr;this.positiveArr=new Int32Array(t.length*2),this.positiveArr.set(t)}this.positiveArr[i]=e}}},eti=class{constructor(){this.positiveArr=[];this.negativeArr=[]}get(i){return i<0?(i=-i-1,this.negativeArr[i]):this.positiveArr[i]}set(i,e){i<0?(i=-i-1,this.negativeArr[i]=e):this.positiveArr[i]=e}};var S7=class{constructor(i,e,t){this.lines=i;this.range=e;this.considerWhitespaceChanges=t;this.elements=[];this.firstElementOffsetByLineIdx=[];this.lineStartOffsets=[];this.trimmedWsLengthsByLineIdx=[];this.firstElementOffsetByLineIdx.push(0);for(let o=this.range.startLineNumber;o<=this.range.endLineNumber;o++){let n=i[o-1],r=0;o===this.range.startLineNumber&&this.range.startColumn>1&&(r=this.range.startColumn-1,n=n.substring(r)),this.lineStartOffsets.push(r);let s=0;if(!t){let c=n.trimStart();s=n.length-c.length,n=c.trimEnd()}this.trimmedWsLengthsByLineIdx.push(s);let l=o===this.range.endLineNumber?Math.min(this.range.endColumn-1-r-s,n.length):n.length;for(let c=0;c<l;c++)this.elements.push(n.charCodeAt(c));o<this.range.endLineNumber&&(this.elements.push(10),this.firstElementOffsetByLineIdx.push(this.elements.length))}}toString(){return`Slice: "${this.text}"`}get text(){return this.getText(new pi(0,this.length))}getText(i){return this.elements.slice(i.start,i.endExclusive).map(e=>String.fromCharCode(e)).join("")}getElement(i){return this.elements[i]}get length(){return this.elements.length}getBoundaryScore(i){let e=Rji(i>0?this.elements[i-1]:-1),t=Rji(i<this.elements.length?this.elements[i]:-1);if(e===7&&t===8)return 0;if(e===8)return 150;let o=0;return e!==t&&(o+=10,e===0&&t===1&&(o+=1)),o+=Lji(e),o+=Lji(t),o}translateOffset(i,e="right"){let t=y$(this.firstElementOffsetByLineIdx,n=>n<=i),o=i-this.firstElementOffsetByLineIdx[t];return new ye(this.range.startLineNumber+t,1+this.lineStartOffsets[t]+o+(o===0&&e==="left"?0:this.trimmedWsLengthsByLineIdx[t]))}translateRange(i){let e=this.translateOffset(i.start,"right"),t=this.translateOffset(i.endExclusive,"left");return t.isBefore(e)?z.fromPositions(t,t):z.fromPositions(e,t)}findWordContaining(i){if(i<0||i>=this.elements.length||!yye(this.elements[i]))return;let e=i;for(;e>0&&yye(this.elements[e-1]);)e--;let t=i;for(;t<this.elements.length&&yye(this.elements[t]);)t++;return new pi(e,t)}findSubWordContaining(i){if(i<0||i>=this.elements.length||!yye(this.elements[i]))return;let e=i;for(;e>0&&yye(this.elements[e-1])&&!Dji(this.elements[e]);)e--;let t=i;for(;t<this.elements.length&&yye(this.elements[t])&&!Dji(this.elements[t]);)t++;return new pi(e,t)}countLinesIn(i){return this.translateOffset(i.endExclusive).lineNumber-this.translateOffset(i.start).lineNumber}isStronglyEqual(i,e){return this.elements[i]===this.elements[e]}extendToFullLines(i){let e=I$(this.firstElementOffsetByLineIdx,o=>o<=i.start)??0,t=y2i(this.firstElementOffsetByLineIdx,o=>i.endExclusive<=o)??this.elements.length;return new pi(e,t)}};function yye(a){return a>=97&&a<=122||a>=65&&a<=90||a>=48&&a<=57}function Dji(a){return a>=65&&a<=90}var iWo={0:0,1:0,2:0,3:10,4:2,5:30,6:3,7:10,8:10};function Lji(a){return iWo[a]}function Rji(a){return a===10?8:a===13?7:Tje(a)?6:a>=97&&a<=122?0:a>=65&&a<=90?1:a>=48&&a<=57?2:a===-1?3:a===44||a===59?5:4}function Pji(a,i,e,t,o,n){let{moves:r,excludedChanges:s}=nWo(a,i,e,n);if(!n.isValid())return[];let l=a.filter(u=>!s.has(u)),c=rWo(l,t,o,i,e,n);return x$(r,c),r=sWo(r),r=r.filter(u=>{let p=u.original.toOffsetRange().slice(i).map(g=>g.trim());return p.join(`
`).length>=15&&oWo(p,g=>g.length>=2)>=2}),r=aWo(a,r),r}function oWo(a,i){let e=0;for(let t of a)i(t)&&e++;return e}function nWo(a,i,e,t){let o=[],n=a.filter(l=>l.modified.isEmpty&&l.original.length>=3).map(l=>new Eje(l.original,i,l)),r=new Set(a.filter(l=>l.original.isEmpty&&l.modified.length>=3).map(l=>new Eje(l.modified,e,l))),s=new Set;for(let l of n){let c=-1,u;for(let p of r){let h=l.computeSimilarity(p);h>c&&(c=h,u=p)}if(c>.9&&u&&(r.delete(u),o.push(new jI(l.range,u.range)),s.add(l.source),s.add(u.source)),!t.isValid())return{moves:o,excludedChanges:s}}return{moves:o,excludedChanges:s}}function rWo(a,i,e,t,o,n){let r=[],s=new n1;for(let h of a)for(let g=h.original.startLineNumber;g<h.original.endLineNumberExclusive-2;g++){let f=`${i[g-1]}:${i[g+1-1]}:${i[g+2-1]}`;s.add(f,{range:new uo(g,g+3)})}let l=[];a.sort(cl(h=>h.modified.startLineNumber,hu));for(let h of a){let g=[];for(let f=h.modified.startLineNumber;f<h.modified.endLineNumberExclusive-2;f++){let v=`${e[f-1]}:${e[f+1-1]}:${e[f+2-1]}`,b=new uo(f,f+3),S=[];s.forEach(v,({range:y})=>{for(let k of g)if(k.originalLineRange.endLineNumberExclusive+1===y.endLineNumberExclusive&&k.modifiedLineRange.endLineNumberExclusive+1===b.endLineNumberExclusive){k.originalLineRange=new uo(k.originalLineRange.startLineNumber,y.endLineNumberExclusive),k.modifiedLineRange=new uo(k.modifiedLineRange.startLineNumber,b.endLineNumberExclusive),S.push(k);return}let w={modifiedLineRange:b,originalLineRange:y};l.push(w),S.push(w)}),g=S}if(!n.isValid())return[]}l.sort(Fse(cl(h=>h.modifiedLineRange.length,hu)));let c=new kP,u=new kP;for(let h of l){let g=h.modifiedLineRange.startLineNumber-h.originalLineRange.startLineNumber,f=c.subtractFrom(h.modifiedLineRange),v=u.subtractFrom(h.originalLineRange).getWithDelta(g),b=f.getIntersection(v);for(let S of b.ranges){if(S.length<3)continue;let y=S,w=S.delta(-g);r.push(new jI(w,y)),c.addRange(y),u.addRange(w)}}r.sort(cl(h=>h.original.startLineNumber,hu));let p=new o$e(a);for(let h=0;h<r.length;h++){let g=r[h],f=p.findLastMonotonous(P=>P.original.startLineNumber<=g.original.startLineNumber),v=I$(a,P=>P.modified.startLineNumber<=g.modified.startLineNumber),b=Math.max(g.original.startLineNumber-f.original.startLineNumber,g.modified.startLineNumber-v.modified.startLineNumber),S=p.findLastMonotonous(P=>P.original.startLineNumber<g.original.endLineNumberExclusive),y=I$(a,P=>P.modified.startLineNumber<g.modified.endLineNumberExclusive),w=Math.max(S.original.endLineNumberExclusive-g.original.endLineNumberExclusive,y.modified.endLineNumberExclusive-g.modified.endLineNumberExclusive),k;for(k=0;k<b;k++){let P=g.original.startLineNumber-k-1,O=g.modified.startLineNumber-k-1;if(P>t.length||O>o.length||c.contains(O)||u.contains(P)||!Mji(t[P-1],o[O-1],n))break}k>0&&(u.addRange(new uo(g.original.startLineNumber-k,g.original.startLineNumber)),c.addRange(new uo(g.modified.startLineNumber-k,g.modified.startLineNumber)));let T;for(T=0;T<w;T++){let P=g.original.endLineNumberExclusive+T,O=g.modified.endLineNumberExclusive+T;if(P>t.length||O>o.length||c.contains(O)||u.contains(P)||!Mji(t[P-1],o[O-1],n))break}T>0&&(u.addRange(new uo(g.original.endLineNumberExclusive,g.original.endLineNumberExclusive+T)),c.addRange(new uo(g.modified.endLineNumberExclusive,g.modified.endLineNumberExclusive+T))),(k>0||T>0)&&(r[h]=new jI(new uo(g.original.startLineNumber-k,g.original.endLineNumberExclusive+T),new uo(g.modified.startLineNumber-k,g.modified.endLineNumberExclusive+T)))}return r}function Mji(a,i,e){if(a.trim()===i.trim())return!0;if(a.length>300&&i.length>300)return!1;let o=new Iye().compute(new S7([a],new z(1,1,1,a.length),!1),new S7([i],new z(1,1,1,i.length),!1),e),n=0,r=Tg.invert(o.diffs,a.length);for(let u of r)u.seq1Range.forEach(p=>{Tje(a.charCodeAt(p))||n++});function s(u){let p=0;for(let h=0;h<a.length;h++)Tje(u.charCodeAt(h))||p++;return p}let l=s(a.length>i.length?a:i);return n/l>.6&&l>10}function sWo(a){if(a.length===0)return a;a.sort(cl(e=>e.original.startLineNumber,hu));let i=[a[0]];for(let e=1;e<a.length;e++){let t=i[i.length-1],o=a[e],n=o.original.startLineNumber-t.original.endLineNumberExclusive,r=o.modified.startLineNumber-t.modified.endLineNumberExclusive;if(n>=0&&r>=0&&n+r<=2){i[i.length-1]=t.join(o);continue}i.push(o)}return i}function aWo(a,i){let e=new o$e(a);return i=i.filter(t=>{let o=e.findLastMonotonous(s=>s.original.startLineNumber<t.original.endLineNumberExclusive)||new jI(new uo(1,1),new uo(1,1)),n=I$(a,s=>s.modified.startLineNumber<t.modified.endLineNumberExclusive);return o!==n}),i}function _je(a,i,e){let t=e;return t=Aji(a,i,t),t=Aji(a,i,t),t=lWo(a,i,t),t}function Aji(a,i,e){if(e.length===0)return e;let t=[];t.push(e[0]);for(let n=1;n<e.length;n++){let r=t[t.length-1],s=e[n];if(s.seq1Range.isEmpty||s.seq2Range.isEmpty){let l=s.seq1Range.start-r.seq1Range.endExclusive,c;for(c=1;c<=l&&!(a.getElement(s.seq1Range.start-c)!==a.getElement(s.seq1Range.endExclusive-c)||i.getElement(s.seq2Range.start-c)!==i.getElement(s.seq2Range.endExclusive-c));c++);if(c--,c===l){t[t.length-1]=new Tg(new pi(r.seq1Range.start,s.seq1Range.endExclusive-l),new pi(r.seq2Range.start,s.seq2Range.endExclusive-l));continue}s=s.delta(-c)}t.push(s)}let o=[];for(let n=0;n<t.length-1;n++){let r=t[n+1],s=t[n];if(s.seq1Range.isEmpty||s.seq2Range.isEmpty){let l=r.seq1Range.start-s.seq1Range.endExclusive,c;for(c=0;c<l&&!(!a.isStronglyEqual(s.seq1Range.start+c,s.seq1Range.endExclusive+c)||!i.isStronglyEqual(s.seq2Range.start+c,s.seq2Range.endExclusive+c));c++);if(c===l){t[n+1]=new Tg(new pi(s.seq1Range.start+l,r.seq1Range.endExclusive),new pi(s.seq2Range.start+l,r.seq2Range.endExclusive));continue}c>0&&(s=s.delta(c))}o.push(s)}return t.length>0&&o.push(t[t.length-1]),o}function lWo(a,i,e){if(!a.getBoundaryScore||!i.getBoundaryScore)return e;for(let t=0;t<e.length;t++){let o=t>0?e[t-1]:void 0,n=e[t],r=t+1<e.length?e[t+1]:void 0,s=new pi(o?o.seq1Range.endExclusive+1:0,r?r.seq1Range.start-1:a.length),l=new pi(o?o.seq2Range.endExclusive+1:0,r?r.seq2Range.start-1:i.length);n.seq1Range.isEmpty?e[t]=Nji(n,a,i,s,l):n.seq2Range.isEmpty&&(e[t]=Nji(n.swap(),i,a,l,s).swap())}return e}function Nji(a,i,e,t,o){let r=1;for(;a.seq1Range.start-r>=t.start&&a.seq2Range.start-r>=o.start&&e.isStronglyEqual(a.seq2Range.start-r,a.seq2Range.endExclusive-r)&&r<100;)r++;r--;let s=0;for(;a.seq1Range.start+s<t.endExclusive&&a.seq2Range.endExclusive+s<o.endExclusive&&e.isStronglyEqual(a.seq2Range.start+s,a.seq2Range.endExclusive+s)&&s<100;)s++;if(r===0&&s===0)return a;let l=0,c=-1;for(let u=-r;u<=s;u++){let p=a.seq2Range.start+u,h=a.seq2Range.endExclusive+u,g=a.seq1Range.start+u,f=i.getBoundaryScore(g)+e.getBoundaryScore(p)+e.getBoundaryScore(h);f>c&&(c=f,l=u)}return a.delta(l)}function Oji(a,i,e){let t=[];for(let o of e){let n=t[t.length-1];if(!n){t.push(o);continue}o.seq1Range.start-n.seq1Range.endExclusive<=2||o.seq2Range.start-n.seq2Range.endExclusive<=2?t[t.length-1]=new Tg(n.seq1Range.join(o.seq1Range),n.seq2Range.join(o.seq2Range)):t.push(o)}return t}function tti(a,i,e,t,o=!1){let n=Tg.invert(e,a.length),r=[],s=new O1(0,0);function l(u,p){if(u.offset1<s.offset1||u.offset2<s.offset2)return;let h=t(a,u.offset1),g=t(i,u.offset2);if(!h||!g)return;let f=new Tg(h,g),v=f.intersect(p),b=v.seq1Range.length,S=v.seq2Range.length;for(;n.length>0;){let y=n[0];if(!(y.seq1Range.intersects(f.seq1Range)||y.seq2Range.intersects(f.seq2Range)))break;let k=t(a,y.seq1Range.start),T=t(i,y.seq2Range.start),P=new Tg(k,T),O=P.intersect(y);if(b+=O.seq1Range.length,S+=O.seq2Range.length,f=f.join(P),f.seq1Range.endExclusive>=y.seq1Range.endExclusive)n.shift();else break}(o&&b+S<f.seq1Range.length+f.seq2Range.length||b+S<(f.seq1Range.length+f.seq2Range.length)*2/3)&&r.push(f),s=f.getEndExclusives()}for(;n.length>0;){let u=n.shift();u.seq1Range.isEmpty||(l(u.getStarts(),u),l(u.getEndExclusives().delta(-1),u))}return cWo(e,r)}function cWo(a,i){let e=[];for(;a.length>0||i.length>0;){let t=a[0],o=i[0],n;t&&(!o||t.seq1Range.start<o.seq1Range.start)?n=a.shift():n=i.shift(),e.length>0&&e[e.length-1].seq1Range.endExclusive>=n.seq1Range.start?e[e.length-1]=e[e.length-1].join(n):e.push(n)}return e}function Fji(a,i,e){let t=e;if(t.length===0)return t;let o=0,n;do{n=!1;let r=[t[0]];for(let s=1;s<t.length;s++){let u=function(h,g){let f=new pi(c.seq1Range.endExclusive,l.seq1Range.start);return a.getText(f).replace(/\s/g,"").length<=4&&(h.seq1Range.length+h.seq2Range.length>5||g.seq1Range.length+g.seq2Range.length>5)},l=t[s],c=r[r.length-1];u(c,l)?(n=!0,r[r.length-1]=r[r.length-1].join(l)):r.push(l)}t=r}while(o++<10&&n);return t}function Wji(a,i,e){let t=e;if(t.length===0)return t;let o=0,n;do{n=!1;let s=[t[0]];for(let l=1;l<t.length;l++){let p=function(g,f){let v=new pi(u.seq1Range.endExclusive,c.seq1Range.start);if(a.countLinesIn(v)>5||v.length>500)return!1;let S=a.getText(v).trim();if(S.length>20||S.split(/\r\n|\r|\n/).length>1)return!1;let y=a.countLinesIn(g.seq1Range),w=g.seq1Range.length,k=i.countLinesIn(g.seq2Range),T=g.seq2Range.length,P=a.countLinesIn(f.seq1Range),O=f.seq1Range.length,V=i.countLinesIn(f.seq2Range),H=f.seq2Range.length,G=130;function $(J){return Math.min(J,G)}return Math.pow(Math.pow($(y*40+w),1.5)+Math.pow($(k*40+T),1.5),1.5)+Math.pow(Math.pow($(P*40+O),1.5)+Math.pow($(V*40+H),1.5),1.5)>(G**1.5)**1.5*1.3},c=t[l],u=s[s.length-1];p(u,c)?(n=!0,s[s.length-1]=s[s.length-1].join(c)):s.push(c)}t=s}while(o++<10&&n);let r=[];return x2i(t,(s,l,c)=>{let u=l;function p(S){return S.length>0&&S.trim().length<=3&&l.seq1Range.length+l.seq2Range.length>100}let h=a.extendToFullLines(l.seq1Range),g=a.getText(new pi(h.start,l.seq1Range.start));p(g)&&(u=u.deltaStart(-g.length));let f=a.getText(new pi(l.seq1Range.endExclusive,h.endExclusive));p(f)&&(u=u.deltaEnd(f.length));let v=Tg.fromOffsetPairs(s?s.getEndExclusives():O1.zero,c?c.getStarts():O1.max),b=u.intersect(v);r.length>0&&b.getStarts().equals(r[r.length-1].getEndExclusives())?r[r.length-1]=r[r.length-1].join(b):r.push(b)}),r}var Dje=class{constructor(i,e){this.trimmedHash=i;this.lines=e}getElement(i){return this.trimmedHash[i]}get length(){return this.trimmedHash.length}getBoundaryScore(i){let e=i===0?0:Vji(this.lines[i-1]),t=i===this.lines.length?0:Vji(this.lines[i]);return 1e3-(e+t)}getText(i){return this.lines.slice(i.start,i.endExclusive).join(`
`)}isStronglyEqual(i,e){return this.lines[i]===this.lines[e]}};function Vji(a){let i=0;for(;i<a.length&&(a.charCodeAt(i)===32||a.charCodeAt(i)===9);)i++;return i}var wye=class{constructor(){this.dynamicProgrammingDiffing=new wvt;this.myersDiffingAlgorithm=new Iye}computeDiff(i,e,t){if(i.length<=1&&$i(i,e,(O,V)=>O===V))return new f7([],[],!1);if(i.length===1&&i[0].length===0||e.length===1&&e[0].length===0)return new f7([new Uf(new uo(1,i.length+1),new uo(1,e.length+1),[new Eg(new z(1,1,i.length,i[i.length-1].length+1),new z(1,1,e.length,e[e.length-1].length+1))])],[],!1);let o=t.maxComputationTimeMs===0?b7.instance:new yvt(t.maxComputationTimeMs),n=!t.ignoreTrimWhitespace,r=new Map;function s(O){let V=r.get(O);return V===void 0&&(V=r.size,r.set(O,V)),V}let l=i.map(O=>s(O.trim())),c=e.map(O=>s(O.trim())),u=new Dje(l,i),p=new Dje(c,e),h=u.length+p.length<1700?this.dynamicProgrammingDiffing.compute(u,p,o,(O,V)=>i[O]===e[V]?e[V].length===0?.1:1+Math.log(1+e[V].length):.99):this.myersDiffingAlgorithm.compute(u,p,o),g=h.diffs,f=h.hitTimeout;g=_je(u,p,g),g=Fji(u,p,g);let v=[],b=O=>{if(n)for(let V=0;V<O;V++){let H=S+V,G=y+V;if(i[H]!==e[G]){let $=this.refineDiff(i,e,new Tg(new pi(H,H+1),new pi(G,G+1)),o,n,t);for(let J of $.mappings)v.push(J);$.hitTimeout&&(f=!0)}}},S=0,y=0;for(let O of g){lh(()=>O.seq1Range.start-S===O.seq2Range.start-y);let V=O.seq1Range.start-S;b(V),S=O.seq1Range.endExclusive,y=O.seq2Range.endExclusive;let H=this.refineDiff(i,e,O,o,n,t);H.hitTimeout&&(f=!0);for(let G of H.mappings)v.push(G)}b(i.length-S);let w=new Yae(i),k=new Yae(e),T=vye(v,w,k),P=[];return t.computeMoves&&(P=this.computeMoves(T,i,e,l,c,o,n,t)),lh(()=>{function O(H,G){if(H.lineNumber<1||H.lineNumber>G.length)return!1;let $=G[H.lineNumber-1];return!(H.column<1||H.column>$.length+1)}function V(H,G){return!(H.startLineNumber<1||H.startLineNumber>G.length+1||H.endLineNumberExclusive<1||H.endLineNumberExclusive>G.length+1)}for(let H of T){if(!H.innerChanges)return!1;for(let G of H.innerChanges)if(!(O(G.modifiedRange.getStartPosition(),e)&&O(G.modifiedRange.getEndPosition(),e)&&O(G.originalRange.getStartPosition(),i)&&O(G.originalRange.getEndPosition(),i)))return!1;if(!V(H.modified,e)||!V(H.original,i))return!1}return!0}),new f7(T,P,f)}computeMoves(i,e,t,o,n,r,s,l){return Pji(i,e,t,o,n,r).map(p=>{let h=this.refineDiff(e,t,new Tg(p.original.toOffsetRange(),p.modified.toOffsetRange()),r,s,l),g=vye(h.mappings,new Yae(e),new Yae(t),!0);return new hye(p,g)})}refineDiff(i,e,t,o,n,r){let l=dWo(t).toRangeMapping2(i,e),c=new S7(i,l.originalRange,n),u=new S7(e,l.modifiedRange,n),p=c.length+u.length<500?this.dynamicProgrammingDiffing.compute(c,u,o):this.myersDiffingAlgorithm.compute(c,u,o),h=!1,g=p.diffs;h&&Tg.assertSorted(g),g=_je(c,u,g),h&&Tg.assertSorted(g),g=tti(c,u,g,(v,b)=>v.findWordContaining(b)),h&&Tg.assertSorted(g),r.extendToSubwords&&(g=tti(c,u,g,(v,b)=>v.findSubWordContaining(b),!0),h&&Tg.assertSorted(g)),g=Oji(c,u,g),h&&Tg.assertSorted(g),g=Wji(c,u,g),h&&Tg.assertSorted(g);let f=g.map(v=>new Eg(c.translateRange(v.seq1Range),u.translateRange(v.seq2Range)));return h&&Eg.assertSorted(f),{mappings:f,hitTimeout:p.hitTimeout}}};function dWo(a){return new jI(new uo(a.seq1Range.start+1,a.seq1Range.endExclusive+1),new uo(a.seq2Range.start+1,a.seq2Range.endExclusive+1))}var W1={getLegacy:()=>new Svt,getDefault:()=>new wye};function I7(a,i){let e=Math.pow(10,i);return Math.round(a*e)/e}var zt=class{constructor(i,e,t,o=1){this._rgbaBrand=void 0;this.r=Math.min(255,Math.max(0,i))|0,this.g=Math.min(255,Math.max(0,e))|0,this.b=Math.min(255,Math.max(0,t))|0,this.a=I7(Math.max(Math.min(1,o),0),3)}static equals(i,e){return i.r===e.r&&i.g===e.g&&i.b===e.b&&i.a===e.a}},V1=class a{constructor(i,e,t,o){this._hslaBrand=void 0;this.h=Math.max(Math.min(360,i),0)|0,this.s=I7(Math.max(Math.min(1,e),0),3),this.l=I7(Math.max(Math.min(1,t),0),3),this.a=I7(Math.max(Math.min(1,o),0),3)}static equals(i,e){return i.h===e.h&&i.s===e.s&&i.l===e.l&&i.a===e.a}static fromRGBA(i){let e=i.r/255,t=i.g/255,o=i.b/255,n=i.a,r=Math.max(e,t,o),s=Math.min(e,t,o),l=0,c=0,u=(s+r)/2,p=r-s;if(p>0){switch(c=Math.min(u<=.5?p/(2*u):p/(2-2*u),1),r){case e:l=(t-o)/p+(t<o?6:0);break;case t:l=(o-e)/p+2;break;case o:l=(e-t)/p+4;break}l*=60,l=Math.round(l)}return new a(l,c,u,n)}static _hue2rgb(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*(2/3-t)*6:i}static toRGBA(i){let e=i.h/360,{s:t,l:o,a:n}=i,r,s,l;if(t===0)r=s=l=o;else{let c=o<.5?o*(1+t):o+t-o*t,u=2*o-c;r=a._hue2rgb(u,c,e+1/3),s=a._hue2rgb(u,c,e),l=a._hue2rgb(u,c,e-1/3)}return new zt(Math.round(r*255),Math.round(s*255),Math.round(l*255),n)}},bO=class a{constructor(i,e,t,o){this._hsvaBrand=void 0;this.h=Math.max(Math.min(360,i),0)|0,this.s=I7(Math.max(Math.min(1,e),0),3),this.v=I7(Math.max(Math.min(1,t),0),3),this.a=I7(Math.max(Math.min(1,o),0),3)}static equals(i,e){return i.h===e.h&&i.s===e.s&&i.v===e.v&&i.a===e.a}static fromRGBA(i){let e=i.r/255,t=i.g/255,o=i.b/255,n=Math.max(e,t,o),r=Math.min(e,t,o),s=n-r,l=n===0?0:s/n,c;return s===0?c=0:n===e?c=((t-o)/s%6+6)%6:n===t?c=(o-e)/s+2:c=(e-t)/s+4,new a(Math.round(c*60),l,n,i.a)}static toRGBA(i){let{h:e,s:t,v:o,a:n}=i,r=o*t,s=r*(1-Math.abs(e/60%2-1)),l=o-r,[c,u,p]=[0,0,0];return e<60?(c=r,u=s):e<120?(c=s,u=r):e<180?(u=r,p=s):e<240?(u=s,p=r):e<300?(c=s,p=r):e<=360&&(c=r,p=s),c=Math.round((c+l)*255),u=Math.round((u+l)*255),p=Math.round((p+l)*255),new zt(c,u,p,n)}},We=class a{static fromHex(i){return a.Format.CSS.parseHex(i)||a.red}static equals(i,e){return!i&&!e?!0:!i||!e?!1:i.equals(e)}get hsla(){return this._hsla?this._hsla:V1.fromRGBA(this.rgba)}get hsva(){return this._hsva?this._hsva:bO.fromRGBA(this.rgba)}constructor(i){if(i)if(i instanceof zt)this.rgba=i;else if(i instanceof V1)this._hsla=i,this.rgba=V1.toRGBA(i);else if(i instanceof bO)this._hsva=i,this.rgba=bO.toRGBA(i);else throw new Error("Invalid color ctor argument");else throw new Error("Color needs a value")}equals(i){return!!i&&zt.equals(this.rgba,i.rgba)&&V1.equals(this.hsla,i.hsla)&&bO.equals(this.hsva,i.hsva)}getRelativeLuminance(){let i=a._relativeLuminanceForComponent(this.rgba.r),e=a._relativeLuminanceForComponent(this.rgba.g),t=a._relativeLuminanceForComponent(this.rgba.b),o=.2126*i+.7152*e+.0722*t;return I7(o,4)}reduceRelativeLuminace(i,e){let{r:t,g:o,b:n}=i.rgba,r=this.getContrastRatio(i);for(;r<e&&(t>0||o>0||n>0);)t-=Math.max(0,Math.ceil(t*.1)),o-=Math.max(0,Math.ceil(o*.1)),n-=Math.max(0,Math.ceil(n*.1)),r=this.getContrastRatio(new a(new zt(t,o,n)));return new a(new zt(t,o,n))}increaseRelativeLuminace(i,e){let{r:t,g:o,b:n}=i.rgba,r=this.getContrastRatio(i);for(;r<e&&(t<255||o<255||n<255);)t=Math.min(255,t+Math.ceil((255-t)*.1)),o=Math.min(255,o+Math.ceil((255-o)*.1)),n=Math.min(255,n+Math.ceil((255-n)*.1)),r=this.getContrastRatio(new a(new zt(t,o,n)));return new a(new zt(t,o,n))}static _relativeLuminanceForComponent(i){let e=i/255;return e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)}getContrastRatio(i){let e=this.getRelativeLuminance(),t=i.getRelativeLuminance();return e>t?(e+.05)/(t+.05):(t+.05)/(e+.05)}isDarker(){return(this.rgba.r*299+this.rgba.g*587+this.rgba.b*114)/1e3<128}isLighter(){return(this.rgba.r*299+this.rgba.g*587+this.rgba.b*114)/1e3>=128}isLighterThan(i){let e=this.getRelativeLuminance(),t=i.getRelativeLuminance();return e>t}isDarkerThan(i){let e=this.getRelativeLuminance(),t=i.getRelativeLuminance();return e<t}ensureConstrast(i,e){let t=this.getRelativeLuminance(),o=i.getRelativeLuminance();if(this.getContrastRatio(i)<e){if(o<t){let l=this.reduceRelativeLuminace(i,e),c=this.getContrastRatio(l);if(c<e){let u=this.increaseRelativeLuminace(i,e),p=this.getContrastRatio(u);return c>p?l:u}return l}let r=this.increaseRelativeLuminace(i,e),s=this.getContrastRatio(r);if(s<e){let l=this.reduceRelativeLuminace(i,e),c=this.getContrastRatio(l);return s>c?r:l}return r}return i}lighten(i){return new a(new V1(this.hsla.h,this.hsla.s,this.hsla.l+this.hsla.l*i,this.hsla.a))}darken(i){return new a(new V1(this.hsla.h,this.hsla.s,this.hsla.l-this.hsla.l*i,this.hsla.a))}transparent(i){let{r:e,g:t,b:o,a:n}=this.rgba;return new a(new zt(e,t,o,n*i))}isTransparent(){return this.rgba.a===0}isOpaque(){return this.rgba.a===1}opposite(){return new a(new zt(255-this.rgba.r,255-this.rgba.g,255-this.rgba.b,this.rgba.a))}blend(i){let e=i.rgba,t=this.rgba.a,o=e.a,n=t+o*(1-t);if(n<1e-6)return a.transparent;let r=this.rgba.r*t/n+e.r*o*(1-t)/n,s=this.rgba.g*t/n+e.g*o*(1-t)/n,l=this.rgba.b*t/n+e.b*o*(1-t)/n;return new a(new zt(r,s,l,n))}mix(i,e=.5){let t=Math.min(Math.max(e,0),1),o=this.rgba,n=i.rgba,r=o.r+(n.r-o.r)*t,s=o.g+(n.g-o.g)*t,l=o.b+(n.b-o.b)*t,c=o.a+(n.a-o.a)*t;return new a(new zt(r,s,l,c))}makeOpaque(i){if(this.isOpaque()||i.rgba.a!==1)return this;let{r:e,g:t,b:o,a:n}=this.rgba;return new a(new zt(i.rgba.r-n*(i.rgba.r-e),i.rgba.g-n*(i.rgba.g-t),i.rgba.b-n*(i.rgba.b-o),1))}flatten(...i){let e=i.reduceRight((t,o)=>a._flatten(o,t));return a._flatten(this,e)}static _flatten(i,e){let t=1-i.rgba.a;return new a(new zt(t*e.rgba.r+i.rgba.a*i.rgba.r,t*e.rgba.g+i.rgba.a*i.rgba.g,t*e.rgba.b+i.rgba.a*i.rgba.b))}toString(){return this._toString||(this._toString=a.Format.CSS.format(this)),this._toString}toNumber32Bit(){return this._toNumber32Bit||(this._toNumber32Bit=(this.rgba.r<<24|this.rgba.g<<16|this.rgba.b<<8|this.rgba.a*255<<0)>>>0),this._toNumber32Bit}static getLighterColor(i,e,t){if(i.isLighterThan(e))return i;t=t||.5;let o=i.getRelativeLuminance(),n=e.getRelativeLuminance();return t=t*(n-o)/n,i.lighten(t)}static getDarkerColor(i,e,t){if(i.isDarkerThan(e))return i;t=t||.5;let o=i.getRelativeLuminance(),n=e.getRelativeLuminance();return t=t*(o-n)/o,i.darken(t)}static{this.white=new a(new zt(255,255,255,1))}static{this.black=new a(new zt(0,0,0,1))}static{this.red=new a(new zt(255,0,0,1))}static{this.blue=new a(new zt(0,0,255,1))}static{this.green=new a(new zt(0,255,0,1))}static{this.cyan=new a(new zt(0,255,255,1))}static{this.lightgrey=new a(new zt(211,211,211,1))}static{this.transparent=new a(new zt(0,0,0,0))}};(i=>{let a;(t=>{let e;(b=>{function o(S){return S.rgba.a===1?`rgb(${S.rgba.r}, ${S.rgba.g}, ${S.rgba.b})`:i.Format.CSS.formatRGBA(S)}b.formatRGB=o;function n(S){return`rgba(${S.rgba.r}, ${S.rgba.g}, ${S.rgba.b}, ${+S.rgba.a.toFixed(2)})`}b.formatRGBA=n;function r(S){return S.hsla.a===1?`hsl(${S.hsla.h}, ${Math.round(S.hsla.s*100)}%, ${Math.round(S.hsla.l*100)}%)`:i.Format.CSS.formatHSLA(S)}b.formatHSL=r;function s(S){return`hsla(${S.hsla.h}, ${Math.round(S.hsla.s*100)}%, ${Math.round(S.hsla.l*100)}%, ${S.hsla.a.toFixed(2)})`}b.formatHSLA=s;function l(S){let y=S.toString(16);return y.length!==2?"0"+y:y}function c(S){return`#${l(S.rgba.r)}${l(S.rgba.g)}${l(S.rgba.b)}`}b.formatHex=c;function u(S,y=!1){return y&&S.rgba.a===1?i.Format.CSS.formatHex(S):`#${l(S.rgba.r)}${l(S.rgba.g)}${l(S.rgba.b)}${l(Math.round(S.rgba.a*255))}`}b.formatHexA=u;function p(S){return S.isOpaque()?i.Format.CSS.formatHex(S):i.Format.CSS.formatRGBA(S)}b.format=p;function h(S){if(S==="transparent")return i.transparent;if(S.startsWith("#"))return f(S);if(S.startsWith("rgba(")){let y=S.match(/rgba\((?<r>(?:\+|-)?\d+), *(?<g>(?:\+|-)?\d+), *(?<b>(?:\+|-)?\d+), *(?<a>(?:\+|-)?\d+(\.\d+)?)\)/);if(!y)throw new Error("Invalid color format "+S);let w=parseInt(y.groups?.r??"0"),k=parseInt(y.groups?.g??"0"),T=parseInt(y.groups?.b??"0"),P=parseFloat(y.groups?.a??"0");return new i(new zt(w,k,T,P))}if(S.startsWith("rgb(")){let y=S.match(/rgb\((?<r>(?:\+|-)?\d+), *(?<g>(?:\+|-)?\d+), *(?<b>(?:\+|-)?\d+)\)/);if(!y)throw new Error("Invalid color format "+S);let w=parseInt(y.groups?.r??"0"),k=parseInt(y.groups?.g??"0"),T=parseInt(y.groups?.b??"0");return new i(new zt(w,k,T))}return g(S)}b.parse=h;function g(S){switch(S){case"aliceblue":return new i(new zt(240,248,255,1));case"antiquewhite":return new i(new zt(250,235,215,1));case"aqua":return new i(new zt(0,255,255,1));case"aquamarine":return new i(new zt(127,255,212,1));case"azure":return new i(new zt(240,255,255,1));case"beige":return new i(new zt(245,245,220,1));case"bisque":return new i(new zt(255,228,196,1));case"black":return new i(new zt(0,0,0,1));case"blanchedalmond":return new i(new zt(255,235,205,1));case"blue":return new i(new zt(0,0,255,1));case"blueviolet":return new i(new zt(138,43,226,1));case"brown":return new i(new zt(165,42,42,1));case"burlywood":return new i(new zt(222,184,135,1));case"cadetblue":return new i(new zt(95,158,160,1));case"chartreuse":return new i(new zt(127,255,0,1));case"chocolate":return new i(new zt(210,105,30,1));case"coral":return new i(new zt(255,127,80,1));case"cornflowerblue":return new i(new zt(100,149,237,1));case"cornsilk":return new i(new zt(255,248,220,1));case"crimson":return new i(new zt(220,20,60,1));case"cyan":return new i(new zt(0,255,255,1));case"darkblue":return new i(new zt(0,0,139,1));case"darkcyan":return new i(new zt(0,139,139,1));case"darkgoldenrod":return new i(new zt(184,134,11,1));case"darkgray":return new i(new zt(169,169,169,1));case"darkgreen":return new i(new zt(0,100,0,1));case"darkgrey":return new i(new zt(169,169,169,1));case"darkkhaki":return new i(new zt(189,183,107,1));case"darkmagenta":return new i(new zt(139,0,139,1));case"darkolivegreen":return new i(new zt(85,107,47,1));case"darkorange":return new i(new zt(255,140,0,1));case"darkorchid":return new i(new zt(153,50,204,1));case"darkred":return new i(new zt(139,0,0,1));case"darksalmon":return new i(new zt(233,150,122,1));case"darkseagreen":return new i(new zt(143,188,143,1));case"darkslateblue":return new i(new zt(72,61,139,1));case"darkslategray":return new i(new zt(47,79,79,1));case"darkslategrey":return new i(new zt(47,79,79,1));case"darkturquoise":return new i(new zt(0,206,209,1));case"darkviolet":return new i(new zt(148,0,211,1));case"deeppink":return new i(new zt(255,20,147,1));case"deepskyblue":return new i(new zt(0,191,255,1));case"dimgray":return new i(new zt(105,105,105,1));case"dimgrey":return new i(new zt(105,105,105,1));case"dodgerblue":return new i(new zt(30,144,255,1));case"firebrick":return new i(new zt(178,34,34,1));case"floralwhite":return new i(new zt(255,250,240,1));case"forestgreen":return new i(new zt(34,139,34,1));case"fuchsia":return new i(new zt(255,0,255,1));case"gainsboro":return new i(new zt(220,220,220,1));case"ghostwhite":return new i(new zt(248,248,255,1));case"gold":return new i(new zt(255,215,0,1));case"goldenrod":return new i(new zt(218,165,32,1));case"gray":return new i(new zt(128,128,128,1));case"green":return new i(new zt(0,128,0,1));case"greenyellow":return new i(new zt(173,255,47,1));case"grey":return new i(new zt(128,128,128,1));case"honeydew":return new i(new zt(240,255,240,1));case"hotpink":return new i(new zt(255,105,180,1));case"indianred":return new i(new zt(205,92,92,1));case"indigo":return new i(new zt(75,0,130,1));case"ivory":return new i(new zt(255,255,240,1));case"khaki":return new i(new zt(240,230,140,1));case"lavender":return new i(new zt(230,230,250,1));case"lavenderblush":return new i(new zt(255,240,245,1));case"lawngreen":return new i(new zt(124,252,0,1));case"lemonchiffon":return new i(new zt(255,250,205,1));case"lightblue":return new i(new zt(173,216,230,1));case"lightcoral":return new i(new zt(240,128,128,1));case"lightcyan":return new i(new zt(224,255,255,1));case"lightgoldenrodyellow":return new i(new zt(250,250,210,1));case"lightgray":return new i(new zt(211,211,211,1));case"lightgreen":return new i(new zt(144,238,144,1));case"lightgrey":return new i(new zt(211,211,211,1));case"lightpink":return new i(new zt(255,182,193,1));case"lightsalmon":return new i(new zt(255,160,122,1));case"lightseagreen":return new i(new zt(32,178,170,1));case"lightskyblue":return new i(new zt(135,206,250,1));case"lightslategray":return new i(new zt(119,136,153,1));case"lightslategrey":return new i(new zt(119,136,153,1));case"lightsteelblue":return new i(new zt(176,196,222,1));case"lightyellow":return new i(new zt(255,255,224,1));case"lime":return new i(new zt(0,255,0,1));case"limegreen":return new i(new zt(50,205,50,1));case"linen":return new i(new zt(250,240,230,1));case"magenta":return new i(new zt(255,0,255,1));case"maroon":return new i(new zt(128,0,0,1));case"mediumaquamarine":return new i(new zt(102,205,170,1));case"mediumblue":return new i(new zt(0,0,205,1));case"mediumorchid":return new i(new zt(186,85,211,1));case"mediumpurple":return new i(new zt(147,112,219,1));case"mediumseagreen":return new i(new zt(60,179,113,1));case"mediumslateblue":return new i(new zt(123,104,238,1));case"mediumspringgreen":return new i(new zt(0,250,154,1));case"mediumturquoise":return new i(new zt(72,209,204,1));case"mediumvioletred":return new i(new zt(199,21,133,1));case"midnightblue":return new i(new zt(25,25,112,1));case"mintcream":return new i(new zt(245,255,250,1));case"mistyrose":return new i(new zt(255,228,225,1));case"moccasin":return new i(new zt(255,228,181,1));case"navajowhite":return new i(new zt(255,222,173,1));case"navy":return new i(new zt(0,0,128,1));case"oldlace":return new i(new zt(253,245,230,1));case"olive":return new i(new zt(128,128,0,1));case"olivedrab":return new i(new zt(107,142,35,1));case"orange":return new i(new zt(255,165,0,1));case"orangered":return new i(new zt(255,69,0,1));case"orchid":return new i(new zt(218,112,214,1));case"palegoldenrod":return new i(new zt(238,232,170,1));case"palegreen":return new i(new zt(152,251,152,1));case"paleturquoise":return new i(new zt(175,238,238,1));case"palevioletred":return new i(new zt(219,112,147,1));case"papayawhip":return new i(new zt(255,239,213,1));case"peachpuff":return new i(new zt(255,218,185,1));case"peru":return new i(new zt(205,133,63,1));case"pink":return new i(new zt(255,192,203,1));case"plum":return new i(new zt(221,160,221,1));case"powderblue":return new i(new zt(176,224,230,1));case"purple":return new i(new zt(128,0,128,1));case"rebeccapurple":return new i(new zt(102,51,153,1));case"red":return new i(new zt(255,0,0,1));case"rosybrown":return new i(new zt(188,143,143,1));case"royalblue":return new i(new zt(65,105,225,1));case"saddlebrown":return new i(new zt(139,69,19,1));case"salmon":return new i(new zt(250,128,114,1));case"sandybrown":return new i(new zt(244,164,96,1));case"seagreen":return new i(new zt(46,139,87,1));case"seashell":return new i(new zt(255,245,238,1));case"sienna":return new i(new zt(160,82,45,1));case"silver":return new i(new zt(192,192,192,1));case"skyblue":return new i(new zt(135,206,235,1));case"slateblue":return new i(new zt(106,90,205,1));case"slategray":return new i(new zt(112,128,144,1));case"slategrey":return new i(new zt(112,128,144,1));case"snow":return new i(new zt(255,250,250,1));case"springgreen":return new i(new zt(0,255,127,1));case"steelblue":return new i(new zt(70,130,180,1));case"tan":return new i(new zt(210,180,140,1));case"teal":return new i(new zt(0,128,128,1));case"thistle":return new i(new zt(216,191,216,1));case"tomato":return new i(new zt(255,99,71,1));case"turquoise":return new i(new zt(64,224,208,1));case"violet":return new i(new zt(238,130,238,1));case"wheat":return new i(new zt(245,222,179,1));case"white":return new i(new zt(255,255,255,1));case"whitesmoke":return new i(new zt(245,245,245,1));case"yellow":return new i(new zt(255,255,0,1));case"yellowgreen":return new i(new zt(154,205,50,1));default:return null}}function f(S){let y=S.length;if(y===0||S.charCodeAt(0)!==35)return null;if(y===7){let w=16*v(S.charCodeAt(1))+v(S.charCodeAt(2)),k=16*v(S.charCodeAt(3))+v(S.charCodeAt(4)),T=16*v(S.charCodeAt(5))+v(S.charCodeAt(6));return new i(new zt(w,k,T,1))}if(y===9){let w=16*v(S.charCodeAt(1))+v(S.charCodeAt(2)),k=16*v(S.charCodeAt(3))+v(S.charCodeAt(4)),T=16*v(S.charCodeAt(5))+v(S.charCodeAt(6)),P=16*v(S.charCodeAt(7))+v(S.charCodeAt(8));return new i(new zt(w,k,T,P/255))}if(y===4){let w=v(S.charCodeAt(1)),k=v(S.charCodeAt(2)),T=v(S.charCodeAt(3));return new i(new zt(16*w+w,16*k+k,16*T+T))}if(y===5){let w=v(S.charCodeAt(1)),k=v(S.charCodeAt(2)),T=v(S.charCodeAt(3)),P=v(S.charCodeAt(4));return new i(new zt(16*w+w,16*k+k,16*T+T,(16*P+P)/255))}return null}b.parseHex=f;function v(S){switch(S){case 48:return 0;case 49:return 1;case 50:return 2;case 51:return 3;case 52:return 4;case 53:return 5;case 54:return 6;case 55:return 7;case 56:return 8;case 57:return 9;case 97:return 10;case 65:return 10;case 98:return 11;case 66:return 11;case 99:return 12;case 67:return 12;case 100:return 13;case 68:return 13;case 101:return 14;case 69:return 14;case 102:return 15;case 70:return 15}return 0}})(e=t.CSS||={})})(a=i.Format||={})})(We||={});function Uji(a){let i=[];for(let e of a){let t=Number(e);(t||t===0&&e.replace(/\s/g,"")!=="")&&i.push(t)}return i}function iti(a,i,e,t){return{red:a/255,blue:e/255,green:i/255,alpha:t}}function Lje(a,i){let e=i.index,t=i[0].length;if(e===void 0)return;let o=a.positionAt(e);return{startLineNumber:o.lineNumber,startColumn:o.column,endLineNumber:o.lineNumber,endColumn:o.column+t}}function uWo(a,i){if(!a)return;let e=We.Format.CSS.parseHex(i);if(e)return{range:a,color:iti(e.rgba.r,e.rgba.g,e.rgba.b,e.rgba.a)}}function Bji(a,i,e){if(!a||i.length!==1)return;let o=i[0].values(),n=Uji(o);return{range:a,color:iti(n[0],n[1],n[2],e?n[3]:1)}}function Hji(a,i,e){if(!a||i.length!==1)return;let o=i[0].values(),n=Uji(o),r=new We(new V1(n[0],n[1]/100,n[2]/100,e?n[3]:1));return{range:a,color:iti(r.rgba.r,r.rgba.g,r.rgba.b,r.rgba.a)}}function Rje(a,i){return typeof a=="string"?[...a.matchAll(i)]:a.findMatches(i)}function pWo(a){let i=[],t=Rje(a,/\b(rgb|rgba|hsl|hsla)(\([0-9\s,.\%\/]*\))|^(#)([A-Fa-f0-9]{3})\b|^(#)([A-Fa-f0-9]{4})\b|^(#)([A-Fa-f0-9]{6})\b|^(#)([A-Fa-f0-9]{8})\b|(?<=['"\s])(#)([A-Fa-f0-9]{3})\b|(?<=['"\s])(#)([A-Fa-f0-9]{4})\b|(?<=['"\s])(#)([A-Fa-f0-9]{6})\b|(?<=['"\s])(#)([A-Fa-f0-9]{8})\b/gm);if(t.length>0)for(let o of t){let n=o.filter(c=>c!==void 0),r=n[1],s=n[2];if(!s)continue;let l;if(r==="rgb"){let c=/^\(\s*(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\s*[\s,]\s*(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\s*[\s,]\s*(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\s*\)$/gm;l=Bji(Lje(a,o),Rje(s,c),!1)}else if(r==="rgba"){let c=/^\(\s*(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\s*[\s,]\s*(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\s*[\s,]\s*(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\s*(?:[\s,]|[\s]*\/)\s*(0[.][0-9]+|[.][0-9]+|[01][.]|[01])\s*\)$/gm;l=Bji(Lje(a,o),Rje(s,c),!0)}else if(r==="hsl"){let c=/^\(\s*((?:360(?:\.0+)?|(?:36[0]|3[0-5][0-9]|[12][0-9][0-9]|[1-9]?[0-9])(?:\.\d+)?))\s*[\s,]\s*(100(?:\.0+)?|\d{1,2}[.]\d*|\d{1,2})%\s*[\s,]\s*(100(?:\.0+)?|\d{1,2}[.]\d*|\d{1,2})%\s*\)$/gm;l=Hji(Lje(a,o),Rje(s,c),!1)}else if(r==="hsla"){let c=/^\(\s*((?:360(?:\.0+)?|(?:36[0]|3[0-5][0-9]|[12][0-9][0-9]|[1-9]?[0-9])(?:\.\d+)?))\s*[\s,]\s*(100(?:\.0+)?|\d{1,2}[.]\d*|\d{1,2})%\s*[\s,]\s*(100(?:\.0+)?|\d{1,2}[.]\d*|\d{1,2})%\s*(?:[\s,]|[\s]*\/)\s*(0[.][0-9]+|[.][0-9]+|[01][.]0*|[01])\s*\)$/gm;l=Hji(Lje(a,o),Rje(s,c),!0)}else r==="#"&&(l=uWo(Lje(a,o),r+s));l&&i.push(l)}return i}function zji(a){return!a||typeof a.getValue!="function"||typeof a.positionAt!="function"?[]:pWo(a)}var mWo=/^-+|-+$/g,Kji=100,hWo=5;function Gji(a,i){let e=[];if(i.findRegionSectionHeaders&&i.foldingRules?.markers){let t=gWo(a,i);e=e.concat(t)}if(i.findMarkSectionHeaders){let t=fWo(a,i);e=e.concat(t)}return e}function gWo(a,i){let e=[],t=a.getLineCount();for(let o=1;o<=t;o++){let n=a.getLineContent(o),r=n.match(i.foldingRules.markers.start);if(r){let s={startLineNumber:o,startColumn:r[0].length+1,endLineNumber:o,endColumn:n.length+1};if(s.endColumn>s.startColumn){let l={range:s,...vWo(n.substring(r[0].length)),shouldBeInComments:!1};(l.text||l.hasSeparatorLine)&&e.push(l)}}}return e}function fWo(a,i){let e=[],t=a.getLineCount();if(!i.markSectionHeaderRegex||i.markSectionHeaderRegex.trim()==="")return e;let o=Cje(i.markSectionHeaderRegex),n=new RegExp(i.markSectionHeaderRegex,`gdm${o?"s":""}`);if(cIe(n))return e;for(let r=1;r<=t;r+=Kji-hWo){let s=Math.min(r+Kji-1,t),l=[];for(let p=r;p<=s;p++)l.push(a.getLineContent(p));let c=l.join(`
`);n.lastIndex=0;let u;for(;(u=n.exec(c))!==null;){let p=c.substring(0,u.index),h=(p.match(/\n/g)||[]).length,g=r+h,f=u[0].split(`
`),v=f.length,b=g+v-1,S=p.lastIndexOf(`
`)+1,y=u.index-S+1,w=f[f.length-1],k=v===1?y+u[0].length:w.length+1,T={startLineNumber:g,startColumn:y,endLineNumber:b,endColumn:k},P=(u.groups??{}).label??"",O=((u.groups??{}).separator??"")!=="",V={range:T,text:P,hasSeparatorLine:O,shouldBeInComments:!0};(V.text||V.hasSeparatorLine)&&(e.length===0||e[e.length-1].range.endLineNumber<V.range.startLineNumber)&&e.push(V),n.lastIndex=u.index+u[0].length}}return e}function vWo(a){a=a.trim();let i=a.startsWith("-");return a=a.replace(mWo,""),{text:a,hasSeparatorLine:i}}var C_=class{constructor(i){this.values=i,this.prefixSum=new Uint32Array(i.length),this.prefixSumValidIndex=new Int32Array(1),this.prefixSumValidIndex[0]=-1}getCount(){return this.values.length}insertValues(i,e){i=qse(i);let t=this.values,o=this.prefixSum,n=e.length;return n===0?!1:(this.values=new Uint32Array(t.length+n),this.values.set(t.subarray(0,i),0),this.values.set(t.subarray(i),i+n),this.values.set(e,i),i-1<this.prefixSumValidIndex[0]&&(this.prefixSumValidIndex[0]=i-1),this.prefixSum=new Uint32Array(this.values.length),this.prefixSumValidIndex[0]>=0&&this.prefixSum.set(o.subarray(0,this.prefixSumValidIndex[0]+1)),!0)}setValue(i,e){return i=qse(i),e=qse(e),this.values[i]===e?!1:(this.values[i]=e,i-1<this.prefixSumValidIndex[0]&&(this.prefixSumValidIndex[0]=i-1),!0)}removeValues(i,e){i=qse(i),e=qse(e);let t=this.values,o=this.prefixSum;if(i>=t.length)return!1;let n=t.length-i;return e>=n&&(e=n),e===0?!1:(this.values=new Uint32Array(t.length-e),this.values.set(t.subarray(0,i),0),this.values.set(t.subarray(i+e),i),this.prefixSum=new Uint32Array(this.values.length),i-1<this.prefixSumValidIndex[0]&&(this.prefixSumValidIndex[0]=i-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(i){return i<0?0:(i=qse(i),this._getPrefixSum(i))}_getPrefixSum(i){if(i<=this.prefixSumValidIndex[0])return this.prefixSum[i];let e=this.prefixSumValidIndex[0]+1;e===0&&(this.prefixSum[0]=this.values[0],e++),i>=this.values.length&&(i=this.values.length-1);for(let t=e;t<=i;t++)this.prefixSum[t]=this.prefixSum[t-1]+this.values[t];return this.prefixSumValidIndex[0]=Math.max(this.prefixSumValidIndex[0],i),this.prefixSum[i]}getIndexOf(i){i=Math.floor(i),this.getTotalSum();let e=0,t=this.values.length-1,o=0,n=0,r=0;for(;e<=t;)if(o=e+(t-e)/2|0,n=this.prefixSum[o],r=n-this.values[o],i<r)t=o-1;else if(i>=n)e=o+1;else break;return new Mje(o,i-r)}},Cye=class{constructor(i){this._values=i,this._isValid=!1,this._validEndIndex=-1,this._prefixSum=[],this._indexBySum=[]}getTotalSum(){return this._ensureValid(),this._indexBySum.length}getPrefixSum(i){return this._ensureValid(),i===0?0:this._prefixSum[i-1]}getIndexOf(i){this._ensureValid();let e=this._indexBySum[i];if(e===void 0){let o=Math.max(0,this._values.length-1),n=o>0?this._prefixSum[o-1]:0;return new Mje(o,i-n)}let t=e>0?this._prefixSum[e-1]:0;return new Mje(e,i-t)}removeValues(i,e){this._values.splice(i,e),this._invalidate(i)}insertValues(i,e){this._values=i1(this._values,i,e),this._invalidate(i)}_invalidate(i){this._isValid=!1,this._validEndIndex=Math.min(this._validEndIndex,i-1)}_ensureValid(){if(!this._isValid){for(let i=this._validEndIndex+1,e=this._values.length;i<e;i++){let t=this._values[i],o=i>0?this._prefixSum[i-1]:0;this._prefixSum[i]=o+t;for(let n=0;n<t;n++)this._indexBySum[o+n]=i}this._prefixSum.length=this._values.length,this._indexBySum.length=this._values.length>0?this._prefixSum[this._values.length-1]:0,this._isValid=!0,this._validEndIndex=this._values.length-1}}setValue(i,e){this._values[i]!==e&&(this._values[i]=e,this._invalidate(i))}},Mje=class{constructor(i,e){this.index=i;this.remainder=e;this._prefixSumIndexOfResultBrand=void 0;this.index=i,this.remainder=e}};var xvt=class{constructor(i,e,t,o){this._uri=i,this._lines=e,this._eol=t,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(i){i.eol&&i.eol!==this._eol&&(this._eol=i.eol,this._lineStarts=null);let e=i.changes;for(let t of e)this._acceptDeleteRange(t.range),this._acceptInsertText(new ye(t.range.startLineNumber,t.range.startColumn),t.text);this._versionId=i.versionId,this._cachedTextValue=null}_ensureLineStarts(){if(!this._lineStarts){let i=this._eol.length,e=this._lines.length,t=new Uint32Array(e);for(let o=0;o<e;o++)t[o]=this._lines[o].length+i;this._lineStarts=new C_(t)}}_setLineText(i,e){this._lines[i]=e,this._lineStarts&&this._lineStarts.setValue(i,this._lines[i].length+this._eol.length)}_acceptDeleteRange(i){if(i.startLineNumber===i.endLineNumber){if(i.startColumn===i.endColumn)return;this._setLineText(i.startLineNumber-1,this._lines[i.startLineNumber-1].substring(0,i.startColumn-1)+this._lines[i.startLineNumber-1].substring(i.endColumn-1));return}this._setLineText(i.startLineNumber-1,this._lines[i.startLineNumber-1].substring(0,i.startColumn-1)+this._lines[i.endLineNumber-1].substring(i.endColumn-1)),this._lines.splice(i.startLineNumber,i.endLineNumber-i.startLineNumber),this._lineStarts&&this._lineStarts.removeValues(i.startLineNumber,i.endLineNumber-i.startLineNumber)}_acceptInsertText(i,e){if(e.length===0)return;let t=yc(e);if(t.length===1){this._setLineText(i.lineNumber-1,this._lines[i.lineNumber-1].substring(0,i.column-1)+t[0]+this._lines[i.lineNumber-1].substring(i.column-1));return}t[t.length-1]+=this._lines[i.lineNumber-1].substring(i.column-1),this._setLineText(i.lineNumber-1,this._lines[i.lineNumber-1].substring(0,i.column-1)+t[0]);let o=new Uint32Array(t.length-1);for(let n=1;n<t.length;n++)this._lines.splice(i.lineNumber+n-1,0,t[n]),o[n-1]=t[n].length+this._eol.length;this._lineStarts&&this._lineStarts.insertValues(i.lineNumber,o)}};var qji=60*1e3,$ji="workerTextModelSync",y7=class a extends x{constructor(e,t,o=!1){super();this._syncedModels=Object.create(null);this._syncedModelsLastUsedTime=Object.create(null);if(this._proxy=e,this._modelService=t,!o){let n=new FI;n.cancelAndSet(()=>this._checkStopModelSync(),Math.round(qji/2)),this._register(n)}}static create(e,t){return new a(e.getChannel($ji),t)}dispose(){for(let e in this._syncedModels)Be(this._syncedModels[e]);this._syncedModels=Object.create(null),this._syncedModelsLastUsedTime=Object.create(null),super.dispose()}ensureSyncedResources(e,t=!1){for(let o of e){let n=o.toString();this._syncedModels[n]||this._beginModelSync(o,t),this._syncedModels[n]&&(this._syncedModelsLastUsedTime[n]=new Date().getTime())}}_checkStopModelSync(){let e=new Date().getTime(),t=[];for(let o in this._syncedModelsLastUsedTime)e-this._syncedModelsLastUsedTime[o]>qji&&t.push(o);for(let o of t)this._stopModelSync(o)}_beginModelSync(e,t){let o=this._modelService.getModel(e);if(!o||!t&&o.isTooLargeForSyncing())return;let n=e.toString();this._proxy.$acceptNewModel({url:o.uri.toString(),lines:o.getLinesContent(),EOL:o.getEOL(),versionId:o.getVersionId()});let r=new N;r.add(o.onDidChangeContent(s=>{this._proxy.$acceptModelChanged(n.toString(),s)})),r.add(o.onWillDispose(()=>{this._stopModelSync(n)})),r.add(Z(()=>{this._proxy.$acceptRemovedModel(n)})),this._syncedModels[n]=r}_stopModelSync(e){let t=this._syncedModels[e];delete this._syncedModels[e],delete this._syncedModelsLastUsedTime[e],Be(t)}},kvt=class{constructor(){this._models=Object.create(null)}bindToServer(i){i.setChannel($ji,this)}getModel(i){return this._models[i]}getModels(){let i=[];return Object.keys(this._models).forEach(e=>i.push(this._models[e])),i}$acceptNewModel(i){this._models[i.url]=new oti(A.parse(i.url),i.lines,i.EOL,i.versionId)}$acceptModelChanged(i,e){if(!this._models[i])return;this._models[i].onEvents(e)}$acceptRemovedModel(i){this._models[i]&&delete this._models[i]}},oti=class extends xvt{get uri(){return this._uri}get eol(){return this._eol}getValue(){return this.getText()}findMatches(i){let e=[];for(let t=0;t<this._lines.length;t++){let o=this._lines[t],n=this.offsetAt(new ye(t+1,1)),r=o.matchAll(i);for(let s of r)(s.index||s.index===0)&&(s.index=s.index+n),e.push(s)}return e}getLinesContent(){return this._lines.slice(0)}getLineCount(){return this._lines.length}getLineContent(i){return this._lines[i-1]}getWordAtPosition(i,e){let t=Wx(i.column,Q$(e),this._lines[i.lineNumber-1],0);return t?new z(i.lineNumber,t.startColumn,i.lineNumber,t.endColumn):null}getWordUntilPosition(i,e){let t=this.getWordAtPosition(i,e);return t?{word:this._lines[i.lineNumber-1].substring(t.startColumn-1,i.column-1),startColumn:t.startColumn,endColumn:i.column}:{word:"",startColumn:i.column,endColumn:i.column}}words(i){let e=this._lines,t=this._wordenize.bind(this),o=0,n="",r=0,s=[];return{*[Symbol.iterator](){for(;;)if(r<s.length){let l=n.substring(s[r].start,s[r].end);r+=1,yield l}else if(o<e.length)n=e[o],s=t(n,i),r=0,o+=1;else break}}}getLineWords(i,e){let t=this._lines[i-1],o=this._wordenize(t,e),n=[];for(let r of o)n.push({word:t.substring(r.start,r.end),startColumn:r.start+1,endColumn:r.end+1});return n}_wordenize(i,e){let t=[],o;for(e.lastIndex=0;(o=e.exec(i))&&o[0].length!==0;)t.push({start:o.index,end:o.index+o[0].length});return t}getValueInRange(i){if(i=this._validateRange(i),i.startLineNumber===i.endLineNumber)return this._lines[i.startLineNumber-1].substring(i.startColumn-1,i.endColumn-1);let e=this._eol,t=i.startLineNumber-1,o=i.endLineNumber-1,n=[];n.push(this._lines[t].substring(i.startColumn-1));for(let r=t+1;r<o;r++)n.push(this._lines[r]);return n.push(this._lines[o].substring(0,i.endColumn-1)),n.join(e)}offsetAt(i){return i=this._validatePosition(i),this._ensureLineStarts(),this._lineStarts.getPrefixSum(i.lineNumber-2)+(i.column-1)}positionAt(i){i=Math.floor(i),i=Math.max(0,i),this._ensureLineStarts();let e=this._lineStarts.getIndexOf(i),t=this._lines[e.index].length;return{lineNumber:1+e.index,column:1+Math.min(e.remainder,t)}}_validateRange(i){let e=this._validatePosition({lineNumber:i.startLineNumber,column:i.startColumn}),t=this._validatePosition({lineNumber:i.endLineNumber,column:i.endColumn});return e.lineNumber!==i.startLineNumber||e.column!==i.startColumn||t.lineNumber!==i.endLineNumber||t.column!==i.endColumn?{startLineNumber:e.lineNumber,startColumn:e.column,endLineNumber:t.lineNumber,endColumn:t.column}:i}_validatePosition(i){if(!ye.isIPosition(i))throw new Error("bad position");let{lineNumber:e,column:t}=i,o=!1;if(e<1)e=1,t=1,o=!0;else if(e>this._lines.length)e=this._lines.length,t=this._lines[e-1].length+1,o=!0;else{let n=this._lines[e-1].length+1;t<1?(t=1,o=!0):t>n&&(t=n,o=!0)}return o?{lineNumber:e,column:t}:i}};var Xae=class{constructor(i){this.replacements=i;let e=-1;for(let t of i){if(!(t.replaceRange.start>=e))throw new li(`Edits must be disjoint and sorted. Found ${t} after ${e}`);e=t.replaceRange.endExclusive}}equals(i){if(this.replacements.length!==i.replacements.length)return!1;for(let e=0;e<this.replacements.length;e++)if(!this.replacements[e].equals(i.replacements[e]))return!1;return!0}toString(){return`[${this.replacements.map(e=>e.toString()).join(", ")}]`}normalize(){let i=[],e;for(let t of this.replacements)if(!(t.getNewLength()===0&&t.replaceRange.length===0)){if(e&&e.replaceRange.endExclusive===t.replaceRange.start){let o=e.tryJoinTouching(t);if(o){e=o;continue}}e&&i.push(e),e=t}return e&&i.push(e),this._createNew(i)}compose(i){let e=this.normalize(),t=i.normalize();if(e.isEmpty())return t;if(t.isEmpty())return e;let o=[...e.replacements],n=[],r=0;for(let s of t.replacements){for(;;){let p=o[0];if(!p||p.replaceRange.start+r+p.getNewLength()>=s.replaceRange.start)break;o.shift(),n.push(p),r+=p.getNewLength()-p.replaceRange.length}let l=r,c,u;for(;;){let p=o[0];if(!p||p.replaceRange.start+r>s.replaceRange.endExclusive)break;c||(c=p),u=p,o.shift(),r+=p.getNewLength()-p.replaceRange.length}if(!c)n.push(s.delta(-r));else{let p=Math.min(c.replaceRange.start,s.replaceRange.start-l),h=s.replaceRange.start-(c.replaceRange.start+l);if(h>0){let b=c.slice(pi.emptyAt(p),new pi(0,h));n.push(b)}if(!u)throw new li("Invariant violation: lastIntersecting is undefined");let g=u.replaceRange.endExclusive+r-s.replaceRange.endExclusive;if(g>0){let b=u.slice(pi.ofStartAndLength(u.replaceRange.endExclusive,0),new pi(u.getNewLength()-g,u.getNewLength()));o.unshift(b),r-=b.getNewLength()-b.replaceRange.length}let f=new pi(p,s.replaceRange.endExclusive-r),v=s.slice(f,new pi(0,s.getNewLength()));n.push(v)}}for(;;){let s=o.shift();if(!s)break;n.push(s)}return this._createNew(n).normalize()}decomposeSplit(i){let e=[],t=[],o=0;for(let n of this.replacements)i(n)?(e.push(n),o+=n.getNewLength()-n.replaceRange.length):t.push(n.slice(n.replaceRange.delta(o),new pi(0,n.getNewLength())));return{e1:this._createNew(e),e2:this._createNew(t)}}getNewRanges(){let i=[],e=0;for(let t of this.replacements)i.push(pi.ofStartAndLength(t.replaceRange.start+e,t.getNewLength())),e+=t.getLengthDelta();return i}getJoinedReplaceRange(){if(this.replacements.length!==0)return this.replacements[0].replaceRange.join(this.replacements.at(-1).replaceRange)}isEmpty(){return this.replacements.length===0}getLengthDelta(){return Gy(this.replacements,i=>i.getLengthDelta())}getNewDataLength(i){return i+this.getLengthDelta()}applyToOffset(i){let e=0;for(let t of this.replacements)if(t.replaceRange.start<=i){if(i<t.replaceRange.endExclusive)return t.replaceRange.start+e;e+=t.getNewLength()-t.replaceRange.length}else break;return i+e}applyToOffsetRange(i){return new pi(this.applyToOffset(i.start),this.applyToOffset(i.endExclusive))}applyInverseToOffset(i){let e=0;for(let t of this.replacements){let o=t.getNewLength();if(t.replaceRange.start<=i-e){if(i-e<t.replaceRange.start+o)return t.replaceRange.start;e+=o-t.replaceRange.length}else break}return i-e}applyToOffsetOrUndefined(i){let e=0;for(let t of this.replacements)if(t.replaceRange.start<=i){if(i<t.replaceRange.endExclusive)return;e+=t.getNewLength()-t.replaceRange.length}else break;return i+e}applyToOffsetRangeOrUndefined(i){let e=this.applyToOffsetOrUndefined(i.start);if(e===void 0)return;let t=this.applyToOffsetOrUndefined(i.endExclusive);if(t!==void 0)return new pi(e,t)}},xye=class{constructor(i){this.replaceRange=i}delta(i){return this.slice(this.replaceRange.delta(i),new pi(0,this.getNewLength()))}getLengthDelta(){return this.getNewLength()-this.replaceRange.length}toString(){return`{ ${this.replaceRange.toString()} -> ${this.getNewLength()} }`}get isEmpty(){return this.getNewLength()===0&&this.replaceRange.length===0}getRangeAfterReplace(){return new pi(this.replaceRange.start,this.replaceRange.start+this.getNewLength())}},jji=class a extends Xae{static{this.empty=new a([])}static create(i){return new a(i)}static single(i){return new a([i])}_createNew(i){return new a(i)}};var Eye=class extends Xae{get TReplacement(){throw new Error("TReplacement is not defined for BaseStringEdit")}static composeOrUndefined(i){if(i.length===0)return;let e=i[0];for(let t=1;t<i.length;t++)e=e.compose(i[t]);return e}static trySwap(i,e){let t=i.inverseOnSlice((r,s)=>" ".repeat(s-r)),o=e.tryRebase(t);if(!o)return;let n=i.tryRebase(o);if(n)return{e1:o,e2:n}}apply(i){let e=[],t=0;for(let o of this.replacements)e.push(i.substring(t,o.replaceRange.start)),e.push(o.newText),t=o.replaceRange.endExclusive;return e.push(i.substring(t)),e.join("")}inverseOnSlice(i){let e=[],t=0;for(let o of this.replacements)e.push(ed.replace(pi.ofStartAndLength(o.replaceRange.start+t,o.newText.length),i(o.replaceRange.start,o.replaceRange.endExclusive))),t+=o.newText.length-o.replaceRange.length;return new ld(e)}inverse(i){return this.inverseOnSlice((e,t)=>i.substring(e,t))}rebaseSkipConflicting(i){return this._tryRebase(i,!1)}tryRebase(i){return this._tryRebase(i,!0)}_tryRebase(i,e){let t=[],o=0,n=0,r=0;for(;n<this.replacements.length||o<i.replacements.length;){let s=i.replacements.at(o),l=this.replacements.at(n);if(l)if(s)if(l.replaceRange.intersects(s.replaceRange)||bWo(l.replaceRange,s.replaceRange)||Qji(l.replaceRange,s.replaceRange)||Qji(s.replaceRange,l.replaceRange)){if(n++,e)return}else if(l.replaceRange.start<s.replaceRange.start||l.replaceRange.isEmpty&&l.replaceRange.start===s.replaceRange.start){let c=l.replaceRange.delta(r);t.push(new ed(c,l.newText)),n++}else o++,r+=s.newText.length-s.replaceRange.length;else{let c=l.replaceRange.delta(r);t.push(new ed(c,l.newText)),n++}else break}return new ld(t)}toJson(){return this.replacements.map(i=>i.toJson())}isNeutralOn(i){return this.replacements.every(e=>e.isNeutralOn(i))}removeCommonSuffixPrefix(i){let e=[];for(let t of this.replacements){let o=t.removeCommonSuffixPrefix(i);o.isEmpty||e.push(o)}return new ld(e)}normalizeEOL(i){return new ld(this.replacements.map(e=>e.normalizeEOL(i)))}normalizeOnSource(i){let e=this.apply(i),o=ed.replace(pi.ofLength(i.length),e).removeCommonSuffixAndPrefix(i);return o.isEmpty?ld.empty:o.toEdit()}removeCommonSuffixAndPrefix(i){return this._createNew(this.replacements.map(e=>e.removeCommonSuffixAndPrefix(i))).normalize()}applyOnText(i){return new jS(this.apply(i.value))}mapData(i){return new QI(this.replacements.map(e=>new kye(e.replaceRange,e.newText,i(e))))}},Evt=class extends xye{constructor(e,t){super(e);this.newText=t}getNewLength(){return this.newText.length}toString(){return`${this.replaceRange} -> ${JSON.stringify(this.newText)}`}replace(e){return e.substring(0,this.replaceRange.start)+this.newText+e.substring(this.replaceRange.endExclusive)}isNeutralOn(e){return this.newText===e.substring(this.replaceRange.start,this.replaceRange.endExclusive)}removeCommonSuffixPrefix(e){let t=e.substring(this.replaceRange.start,this.replaceRange.endExclusive),o=tf(t,this.newText),n=Math.min(t.length-o,this.newText.length-o,vC(t,this.newText)),r=new pi(this.replaceRange.start+o,this.replaceRange.endExclusive-n),s=this.newText.substring(o,this.newText.length-n);return new ed(r,s)}normalizeEOL(e){let t=this.newText.replace(/\r\n|\n/g,e);return new ed(this.replaceRange,t)}removeCommonSuffixAndPrefix(e){return this.removeCommonSuffix(e).removeCommonPrefix(e)}removeCommonPrefix(e){let t=this.replaceRange.substring(e),o=tf(t,this.newText);return o===0?this:this.slice(this.replaceRange.deltaStart(o),new pi(o,this.newText.length))}removeCommonSuffix(e){let t=this.replaceRange.substring(e),o=vC(t,this.newText);return o===0?this:this.slice(this.replaceRange.deltaEnd(-o),new pi(0,this.newText.length-o))}toEdit(){return new ld([this])}toJson(){return{txt:this.newText,pos:this.replaceRange.start,len:this.replaceRange.length}}},ld=class a extends Eye{static parse(i){let e=[],t=/\[(\d+),\s*(\d+)\)\s*->\s*"([^"]*)"/g,o;for(;(o=t.exec(i))!==null;){let n=parseInt(o[1],10),r=parseInt(o[2],10),s=o[3].replace(/\\n/g,`
`).replace(/\\r/g,"\r").replace(/\\\\/g,"\\");e.push(new ed(new pi(n,r),s))}return new a(e)}static{this.empty=new a([])}static create(i){return new a(i)}static single(i){return new a([i])}static replace(i,e){return new a([new ed(i,e)])}static insert(i,e){return new a([new ed(pi.emptyAt(i),e)])}static delete(i){return new a([new ed(i,"")])}static fromJson(i){return new a(i.map(ed.fromJson))}static compose(i){if(i.length===0)return a.empty;let e=i[0];for(let t=1;t<i.length;t++)e=e.compose(i[t]);return e}static composeSequentialReplacements(i){let e=a.empty,t=[];for(let o of i){let n=t.at(-1);!n||o.replaceRange.isBefore(n.replaceRange)?t.push(o):(e=e.compose(a.create(t.reverse())),t=[o])}return e=e.compose(a.create(t.reverse())),e}constructor(i){super(i)}_createNew(i){return new a(i)}},ed=class a extends Evt{static insert(i,e){return new a(pi.emptyAt(i),e)}static replace(i,e){return new a(i,e)}static delete(i){return new a(i,"")}static fromJson(i){return new a(pi.ofStartAndLength(i.pos,i.len),i.txt)}equals(i){return this.replaceRange.equals(i.replaceRange)&&this.newText===i.newText}tryJoinTouching(i){return new a(this.replaceRange.joinRightTouching(i.replaceRange),this.newText+i.newText)}slice(i,e){return new a(i,e?e.substring(this.newText):this.newText)}};function nti(a,i){a=a.slice();let e=[],t=0;for(let o of i.replacements){for(;;){let r=a[0];if(!r||r.endExclusive>=o.replaceRange.start)break;a.shift(),e.push(r.delta(t))}let n=[];for(;;){let r=a[0];if(!r||!r.intersectsOrTouches(o.replaceRange))break;a.shift(),n.push(r)}for(let r=n.length-1;r>=0;r--){let s=n[r],l=s.intersect(o.replaceRange).length;s=s.deltaEnd(-l+(r===0?o.newText.length:0));let c=s.start-o.replaceRange.start;c>0&&(s=s.delta(-c)),r!==0&&(s=s.delta(o.newText.length)),s=s.delta(-(o.newText.length-o.replaceRange.length)),a.unshift(s)}t+=o.newText.length-o.replaceRange.length}for(;;){let o=a[0];if(!o)break;a.shift(),e.push(o.delta(t))}return e}var QI=class a extends Eye{static{this.empty=new a([])}static create(i){return new a(i)}static single(i){return new a([i])}static replace(i,e,t){return new a([new kye(i,e,t)])}static insert(i,e,t){return new a([new kye(pi.emptyAt(i),e,t)])}static delete(i,e){return new a([new kye(i,"",e)])}static compose(i){if(i.length===0)return a.empty;let e=i[0];for(let t=1;t<i.length;t++)e=e.compose(i[t]);return e}constructor(i){super(i)}_createNew(i){return new a(i)}toStringEdit(i){let e=[];for(let t of this.replacements)(!i||i(t))&&e.push(new ed(t.replaceRange,t.newText));return new ld(e)}},kye=class a extends Evt{constructor(e,t,o){super(e,t);this.data=o}static insert(e,t,o){return new a(pi.emptyAt(e),t,o)}static replace(e,t,o){return new a(e,t,o)}static delete(e,t){return new a(e,"",t)}equals(e){return this.replaceRange.equals(e.replaceRange)&&this.newText===e.newText&&this.data===e.data}tryJoinTouching(e){let t=this.data.join(e.data);if(t!==void 0)return new a(this.replaceRange.joinRightTouching(e.replaceRange),this.newText+e.newText,t)}slice(e,t){return new a(e,t?t.substring(this.newText):this.newText,this.data)}};function bWo(a,i){return a.isEmpty&&i.isEmpty&&a.start===i.start}function Qji(a,i){return a.isEmpty&&i.start<a.start&&a.start<i.endExclusive}kji({StringEdit:ld,StringReplacement:ed,TextReplacement:ss,TextEdit:Vp,TextLength:pc});var Tvt=class a{constructor(i=null){this._foreignModule=i;this._requestHandlerBrand=void 0;this._workerTextModelSyncServer=new kvt}dispose(){}async $ping(){return"pong"}_getModel(i){return this._workerTextModelSyncServer.getModel(i)}getModels(){return this._workerTextModelSyncServer.getModels()}$acceptNewModel(i){this._workerTextModelSyncServer.$acceptNewModel(i)}$acceptModelChanged(i,e){this._workerTextModelSyncServer.$acceptModelChanged(i,e)}$acceptRemovedModel(i){this._workerTextModelSyncServer.$acceptRemovedModel(i)}async $computeUnicodeHighlights(i,e,t){let o=this._getModel(i);return o?Qae.computeUnicodeHighlights(o,e,t):{ranges:[],hasMore:!1,ambiguousCharacterCount:0,invisibleCharacterCount:0,nonBasicAsciiCharacterCount:0}}async $findSectionHeaders(i,e){let t=this._getModel(i);return t?Gji(t,e):[]}async $computeDiff(i,e,t,o){let n=this._getModel(i),r=this._getModel(e);return!n||!r?null:a.computeDiff(n,r,t,o)}static computeDiff(i,e,t,o){let n=o==="advanced"?W1.getDefault():W1.getLegacy(),r=i.getLinesContent(),s=e.getLinesContent(),l=n.computeDiff(r,s,t),c=l.changes.length>0?!1:this._modelsAreIdentical(i,e);function u(p){return p.map(h=>[h.original.startLineNumber,h.original.endLineNumberExclusive,h.modified.startLineNumber,h.modified.endLineNumberExclusive,h.innerChanges?.map(g=>[g.originalRange.startLineNumber,g.originalRange.startColumn,g.originalRange.endLineNumber,g.originalRange.endColumn,g.modifiedRange.startLineNumber,g.modifiedRange.startColumn,g.modifiedRange.endLineNumber,g.modifiedRange.endColumn])])}return{identical:c,quitEarly:l.hitTimeout,changes:u(l.changes),moves:l.moves.map(p=>[p.lineRangeMapping.original.startLineNumber,p.lineRangeMapping.original.endLineNumberExclusive,p.lineRangeMapping.modified.startLineNumber,p.lineRangeMapping.modified.endLineNumberExclusive,u(p.changes)])}}static _modelsAreIdentical(i,e){let t=i.getLineCount(),o=e.getLineCount();if(t!==o)return!1;for(let n=1;n<=t;n++){let r=i.getLineContent(n),s=e.getLineContent(n);if(r!==s)return!1}return!0}async $computeDirtyDiff(i,e,t){let o=this._getModel(i),n=this._getModel(e);if(!o||!n)return null;let r=o.getLinesContent(),s=n.getLinesContent();return new kje(r,s,{shouldComputeCharChanges:!1,shouldPostProcessCharChanges:!1,shouldIgnoreTrimWhitespace:t,shouldMakePrettyDiff:!0,maxComputationTime:1e3}).computeDiff().changes}$computeStringDiff(i,e,t,o){return SWo(i,e,t,o).toJson()}static{this._diffLimit=1e5}async $computeMoreMinimalEdits(i,e,t){let o=this._getModel(i);if(!o)return e;let n=[],r;e=e.slice(0).sort((l,c)=>{if(l.range&&c.range)return z.compareRangesUsingStarts(l.range,c.range);let u=l.range?0:1,p=c.range?0:1;return u-p});let s=0;for(let l=1;l<e.length;l++)z.getEndPosition(e[s].range).equals(z.getStartPosition(e[l].range))?(e[s].range=z.fromPositions(z.getStartPosition(e[s].range),z.getEndPosition(e[l].range)),e[s].text+=e[l].text):(s++,e[s]=e[l]);e.length=s+1;for(let{range:l,text:c,eol:u}of e){if(typeof u=="number"&&(r=u),z.isEmpty(l)&&!c)continue;let p=o.getValueInRange(l);if(c=c.replace(/\r\n|\n|\r/g,o.eol),p===c)continue;if(Math.max(c.length,p.length)>a._diffLimit){n.push({range:l,text:c});continue}let h=Iji(p,c,t),g=o.offsetAt(z.lift(l).getStartPosition());for(let f of h){let v=o.positionAt(g+f.originalStart),b=o.positionAt(g+f.originalStart+f.originalLength),S={text:c.substr(f.modifiedStart,f.modifiedLength),range:{startLineNumber:v.lineNumber,startColumn:v.column,endLineNumber:b.lineNumber,endColumn:b.column}};o.getValueInRange(S.range)!==S.text&&n.push(S)}}return typeof r=="number"&&n.push({eol:r,text:"",range:{startLineNumber:0,startColumn:0,endLineNumber:0,endColumn:0}}),n}$computeHumanReadableDiff(i,e,t){let o=this._getModel(i);if(!o)return e;let n=[],r;e=e.slice(0).sort((s,l)=>{if(s.range&&l.range)return z.compareRangesUsingStarts(s.range,l.range);let c=s.range?0:1,u=l.range?0:1;return c-u});for(let{range:s,text:l,eol:c}of e){let v=function(S,y){return new ye(S.lineNumber+y.lineNumber-1,y.lineNumber===1?S.column+y.column-1:y.column)},b=function(S,y){let w=[];for(let k=y.startLineNumber;k<=y.endLineNumber;k++){let T=S[k-1];k===y.startLineNumber&&k===y.endLineNumber?w.push(T.substring(y.startColumn-1,y.endColumn-1)):k===y.startLineNumber?w.push(T.substring(y.startColumn-1)):k===y.endLineNumber?w.push(T.substring(0,y.endColumn-1)):w.push(T)}return w};if(typeof c=="number"&&(r=c),z.isEmpty(s)&&!l)continue;let u=o.getValueInRange(s);if(l=l.replace(/\r\n|\n|\r/g,o.eol),u===l)continue;if(Math.max(l.length,u.length)>a._diffLimit){n.push({range:s,text:l});continue}let p=u.split(/\r\n|\n|\r/),h=l.split(/\r\n|\n|\r/),g=W1.getDefault().computeDiff(p,h,t),f=z.lift(s).getStartPosition();for(let S of g.changes)if(S.innerChanges)for(let y of S.innerChanges)n.push({range:z.fromPositions(v(f,y.originalRange.getStartPosition()),v(f,y.originalRange.getEndPosition())),text:b(h,y.modifiedRange).join(o.eol)});else throw new li("The experimental diff algorithm always produces inner changes")}return typeof r=="number"&&n.push({eol:r,text:"",range:{startLineNumber:0,startColumn:0,endLineNumber:0,endColumn:0}}),n}async $computeLinks(i){let e=this._getModel(i);return e?wji(e):null}async $computeDefaultDocumentColors(i){let e=this._getModel(i);return e?zji(e):null}static{this._suggestionsLimit=1e4}async $textualSuggest(i,e,t,o){let n=new Dn,r=new RegExp(t,o),s=new Set;e:for(let l of i){let c=this._getModel(l);if(c){for(let u of c.words(r))if(!(u===e||!isNaN(Number(u)))&&(s.add(u),s.size>a._suggestionsLimit))break e}}return{words:Array.from(s),duration:n.elapsed()}}async $computeWordRanges(i,e,t,o){let n=this._getModel(i);if(!n)return Object.create(null);let r=new RegExp(t,o),s=Object.create(null);for(let l=e.startLineNumber;l<e.endLineNumber;l++){let c=n.getLineWords(l,r);for(let u of c){if(!isNaN(Number(u.word)))continue;let p=s[u.word];p||(p=[],s[u.word]=p),p.push({startLineNumber:l,startColumn:u.startColumn,endLineNumber:l,endColumn:u.endColumn})}}return s}async $navigateValueSet(i,e,t,o,n){let r=this._getModel(i);if(!r)return null;let s=new RegExp(o,n);e.startColumn===e.endColumn&&(e={startLineNumber:e.startLineNumber,startColumn:e.startColumn,endLineNumber:e.endLineNumber,endColumn:e.endColumn+1});let l=r.getValueInRange(e),c=r.getWordAtPosition({lineNumber:e.startLineNumber,column:e.startColumn},s);if(!c)return null;let u=r.getValueInRange(c);return hvt.INSTANCE.navigateValueSet(e,l,c,u,t)}$fmr(i,e){if(!this._foreignModule||typeof this._foreignModule[i]!="function")return Promise.reject(new Error("Missing requestHandler or method: "+i));try{return Promise.resolve(this._foreignModule[i].apply(this._foreignModule,e))}catch(t){return Promise.reject(t)}}};typeof importScripts=="function"&&(globalThis.monaco=Cji());function SWo(a,i,e,t){let o=t==="advanced"?W1.getDefault():W1.getLegacy();let n=new jS(a),r=n.getLines(),s=new jS(i),l=s.getLines(),c=o.computeDiff(r,l,{ignoreTrimWhitespace:!1,maxComputationTimeMs:e.maxComputationTimeMs,computeMoves:!1,extendToSubwords:!1}),u=Uf.toTextEdit(c.changes,s);return n.getTransformer().getStringEdit(u)}var Fn=le("textResourceConfigurationService"),KL=le("textResourcePropertiesService");var Qt=le("ILanguageFeaturesService");var _vt=class a{static{this.CHANNEL_NAME="editorWorkerHost"}static getChannel(i){return i.getChannel(a.CHANNEL_NAME)}static setChannel(i,e){i.setChannel(a.CHANNEL_NAME,e)}};function Yji(){return ro.defaultChatAgent?.completionsEnablementSetting}function Tye(a,i="*"){let e=Yji();return e?Dvt(a.getValue(e),i):!1}function Xji(a,i,e="*"){let t=Yji();return t?Dvt(a.getValue(i,t),e):!1}function Dvt(a,i="*"){return xi(a)?typeof a[i]<"u"?!!a[i]:!!a["*"]:!1}var Jji=300*1e3;function B1(a,i){let e=a.getModel(i);return!(!e||e.isTooLargeForSyncing())}var w7=class extends x{constructor(e,t,o,n,r,s){super();this._languageConfigurationService=n;this._webWorkerService=s;this._modelService=e,this._workerManager=this._register(new Pje(w7.workerDescriptor,this._modelService,this._webWorkerService)),this._logService=o,this._register(r.linkProvider.register({language:"*",hasAccessToAllModels:!0},{provideLinks:async(l,c)=>{if(!B1(this._modelService,l.uri))return Promise.resolve({links:[]});let p=await(await this._workerWithResources([l.uri])).$computeLinks(l.uri.toString());return p&&{links:p}}})),this._register(r.completionProvider.register("*",new rti(this._workerManager,t,this._modelService,this._languageConfigurationService,this._logService,r)))}static{this.workerDescriptor=new Ux({esmModuleLocation:()=>vn.asBrowserUri("vs/editor/common/services/editorWebWorkerMain.js"),esmModuleLocationBundler:()=>new URL("../../common/services/editorWebWorkerMain.ts?esm",import.meta.url),label:"editorWorkerService"})}dispose(){super.dispose()}canComputeUnicodeHighlights(e){return B1(this._modelService,e)}async computedUnicodeHighlights(e,t,o){return(await this._workerWithResources([e])).$computeUnicodeHighlights(e.toString(),t,o)}async computeDiff(e,t,o,n){let s=await(await this._workerWithResources([e,t],!0)).$computeDiff(e.toString(),t.toString(),o,n);if(!s)return null;return{identical:s.identical,quitEarly:s.quitEarly,changes:c(s.changes),moves:s.moves.map(u=>new hye(new jI(new uo(u[0],u[1]),new uo(u[2],u[3])),c(u[4])))};function c(u){return u.map(p=>new Uf(new uo(p[0],p[1]),new uo(p[2],p[3]),p[4]?.map(h=>new Eg(new z(h[0],h[1],h[2],h[3]),new z(h[4],h[5],h[6],h[7])))))}}canComputeDirtyDiff(e,t){return B1(this._modelService,e)&&B1(this._modelService,t)}async computeDirtyDiff(e,t,o){return(await this._workerWithResources([e,t])).$computeDirtyDiff(e.toString(),t.toString(),o)}async computeMoreMinimalEdits(e,t,o=!1){if(yr(t)){if(!B1(this._modelService,e))return Promise.resolve(t);let n=Dn.create(),r=this._workerWithResources([e]).then(s=>s.$computeMoreMinimalEdits(e.toString(),t,o));return r.finally(()=>this._logService.trace("FORMAT#computeMoreMinimalEdits",e.toString(!0),n.elapsed())),Promise.race([r,Li(1e3).then(()=>t)])}else return Promise.resolve(void 0)}computeHumanReadableDiff(e,t){if(yr(t)){if(!B1(this._modelService,e))return Promise.resolve(t);let o=Dn.create(),n={ignoreTrimWhitespace:!1,maxComputationTimeMs:1e3,computeMoves:!1},r=this._workerWithResources([e]).then(s=>s.$computeHumanReadableDiff(e.toString(),t,n)).catch(s=>(mt(s),this.computeMoreMinimalEdits(e,t,!0)));return r.finally(()=>this._logService.trace("FORMAT#computeHumanReadableDiff",e.toString(!0),o.elapsed())),r}else return Promise.resolve(void 0)}async computeStringEditFromDiff(e,t,o,n){try{let s=await(await this._workerWithResources([])).$computeStringDiff(e,t,o,n);return ld.fromJson(s)}catch(r){return mt(r),ld.replace(pi.ofLength(e.length),t)}}canNavigateValueSet(e){return B1(this._modelService,e)}async navigateValueSet(e,t,o){let n=this._modelService.getModel(e);if(!n)return null;let r=this._languageConfigurationService.getLanguageConfiguration(n.getLanguageId()).getWordDefinition(),s=r.source,l=r.flags;return(await this._workerWithResources([e])).$navigateValueSet(e.toString(),t,o,s,l)}canComputeWordRanges(e){return B1(this._modelService,e)}async computeWordRanges(e,t){let o=this._modelService.getModel(e);if(!o)return Promise.resolve(null);let n=this._languageConfigurationService.getLanguageConfiguration(o.getLanguageId()).getWordDefinition(),r=n.source,s=n.flags;return(await this._workerWithResources([e])).$computeWordRanges(e.toString(),t,r,s)}async findSectionHeaders(e,t){return(await this._workerWithResources([e])).$findSectionHeaders(e.toString(),t)}async computeDefaultDocumentColors(e){return(await this._workerWithResources([e])).$computeDefaultDocumentColors(e.toString())}async _workerWithResources(e,t=!1){return await(await this._workerManager.withWorker()).workerWithSyncedResources(e,t)}};w7=I([m(0,Tt),m(1,Fn),m(2,se),m(3,Rs),m(4,Qt),m(5,Zy)],w7);var rti=class{constructor(i,e,t,o,n,r){this.languageConfigurationService=o;this.logService=n;this.languageFeaturesService=r;this._debugDisplayName="wordbasedCompletions";this._workerManager=i,this._configurationService=e,this._modelService=t}async provideCompletionItems(i,e){let t=this._configurationService.getValue(i.uri,e,"editor");if(t.wordBasedSuggestions==="off"||t.wordBasedSuggestions==="offWithInlineSuggestions"&&this.languageFeaturesService.inlineCompletionsProvider.has(i)&&Xji(this._configurationService,i.uri,i.getLanguageId()))return;let o=[];if(t.wordBasedSuggestions==="currentDocument")B1(this._modelService,i.uri)&&o.push(i.uri);else for(let p of this._modelService.getModels())B1(this._modelService,p.uri)&&(p===i?o.unshift(p.uri):(t.wordBasedSuggestions==="allDocuments"||p.getLanguageId()===i.getLanguageId())&&o.push(p.uri));if(o.length===0)return;let n=this.languageConfigurationService.getLanguageConfiguration(i.getLanguageId()).getWordDefinition(),r=i.getWordAtPosition(e),s=r?new z(e.lineNumber,r.startColumn,e.lineNumber,r.endColumn):z.fromPositions(e),l=s.setEndPosition(e.lineNumber,e.column);this.logService.trace("[WordBasedCompletionItemProvider]",`word: "${r?.word||""}", wordDef: "${n}", replace: [${s.toString()}], insert: [${l.toString()}]`);let u=await(await this._workerManager.withWorker()).textualSuggest(o,r?.word,n);if(u)return{duration:u.duration,suggestions:u.words.map(p=>({kind:18,label:p,insertText:p,range:{insert:l,replace:s}}))}}},Pje=class extends x{constructor(e,t,o){super();this._workerDescriptor=e;this._modelService=t,this._webWorkerService=o,this._editorWorkerClient=null,this._lastWorkerUsedTime=new Date().getTime(),this._register(new FL).cancelAndSet(()=>this._checkStopIdleWorker(),Math.round(Jji/2),ut),this._register(this._modelService.onModelRemoved(r=>this._checkStopEmptyWorker()))}dispose(){this._editorWorkerClient&&(this._editorWorkerClient.dispose(),this._editorWorkerClient=null),super.dispose()}_checkStopEmptyWorker(){if(!this._editorWorkerClient)return;this._modelService.getModels().length===0&&(this._editorWorkerClient.dispose(),this._editorWorkerClient=null)}_checkStopIdleWorker(){if(!this._editorWorkerClient)return;new Date().getTime()-this._lastWorkerUsedTime>Jji&&(this._editorWorkerClient.dispose(),this._editorWorkerClient=null)}withWorker(){return this._lastWorkerUsedTime=new Date().getTime(),this._editorWorkerClient||(this._editorWorkerClient=new Aje(this._workerDescriptor,!1,this._modelService,this._webWorkerService)),Promise.resolve(this._editorWorkerClient)}};Pje=I([m(1,Tt),m(2,Zy)],Pje);var sti=class{constructor(i){this._instance=i,this.proxy=this._instance}dispose(){this._instance.dispose()}setChannel(i,e){throw new Error("Not supported")}getChannel(i){throw new Error("Not supported")}},Aje=class extends x{constructor(e,t,o,n){super();this._workerDescriptorOrWorker=e;this._disposed=!1;this._modelService=o,this._webWorkerService=n,this._keepIdleModels=t,this._worker=null,this._modelManager=null}fhr(e,t){throw new Error("Not implemented!")}_getOrCreateWorker(){if(!this._worker)try{this._worker=this._register(this._webWorkerService.createWorkerClient(this._workerDescriptorOrWorker)),_vt.setChannel(this._worker,this._createEditorWorkerHost())}catch(e){avt(e),this._worker=this._createFallbackLocalWorker()}return this._worker}async _getProxy(){try{let e=this._getOrCreateWorker().proxy;return await e.$ping(),e}catch(e){return avt(e),this._worker=this._createFallbackLocalWorker(),this._worker.proxy}}_createFallbackLocalWorker(){return new sti(new Tvt(null))}_createEditorWorkerHost(){return{$fhr:(e,t)=>this.fhr(e,t)}}_getOrCreateModelManager(e){return this._modelManager||(this._modelManager=this._register(new y7(e,this._modelService,this._keepIdleModels))),this._modelManager}async workerWithSyncedResources(e,t=!1){if(this._disposed)return Promise.reject(PI());let o=await this._getProxy();return this._getOrCreateModelManager(o).ensureSyncedResources(e,t),o}async textualSuggest(e,t,o){let n=await this.workerWithSyncedResources(e),r=o.source,s=o.flags;return n.$textualSuggest(e.map(l=>l.toString()),t,r,s)}dispose(){super.dispose(),this._disposed=!0}};Aje=I([m(2,Tt),m(3,Zy)],Aje);var H1=le("markerDecorationsService");var Jae=class{static{this.ID="editor.contrib.markerDecorations"}constructor(i,e){}dispose(){}};Jae=I([m(1,H1)],Jae);Ee(Qs,w7,0);xo(Jae.ID,Jae,0);var cf=class{constructor(i){this.domNode=i;this._maxWidth="";this._width="";this._height="";this._top="";this._left="";this._bottom="";this._right="";this._paddingTop="";this._paddingLeft="";this._paddingBottom="";this._paddingRight="";this._fontFamily="";this._fontWeight="";this._fontSize="";this._fontStyle="";this._fontFeatureSettings="";this._fontVariationSettings="";this._textDecoration="";this._lineHeight="";this._letterSpacing="";this._className="";this._display="";this._position="";this._visibility="";this._color="";this._backgroundColor="";this._layerHint=!1;this._contain="none";this._boxShadow=""}focus(){this.domNode.focus()}setMaxWidth(i){let e=GL(i);this._maxWidth!==e&&(this._maxWidth=e,this.domNode.style.maxWidth=this._maxWidth)}setWidth(i){let e=GL(i);this._width!==e&&(this._width=e,this.domNode.style.width=this._width)}setHeight(i){let e=GL(i);this._height!==e&&(this._height=e,this.domNode.style.height=this._height)}setTop(i){let e=GL(i);this._top!==e&&(this._top=e,this.domNode.style.top=this._top)}setLeft(i){let e=GL(i);this._left!==e&&(this._left=e,this.domNode.style.left=this._left)}setBottom(i){let e=GL(i);this._bottom!==e&&(this._bottom=e,this.domNode.style.bottom=this._bottom)}setRight(i){let e=GL(i);this._right!==e&&(this._right=e,this.domNode.style.right=this._right)}setPaddingTop(i){let e=GL(i);this._paddingTop!==e&&(this._paddingTop=e,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(i){let e=GL(i);this._paddingLeft!==e&&(this._paddingLeft=e,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(i){let e=GL(i);this._paddingBottom!==e&&(this._paddingBottom=e,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(i){let e=GL(i);this._paddingRight!==e&&(this._paddingRight=e,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(i){this._fontFamily!==i&&(this._fontFamily=i,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(i){this._fontWeight!==i&&(this._fontWeight=i,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(i){let e=GL(i);this._fontSize!==e&&(this._fontSize=e,this.domNode.style.fontSize=this._fontSize)}setFontStyle(i){this._fontStyle!==i&&(this._fontStyle=i,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(i){this._fontFeatureSettings!==i&&(this._fontFeatureSettings=i,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(i){this._fontVariationSettings!==i&&(this._fontVariationSettings=i,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(i){this._textDecoration!==i&&(this._textDecoration=i,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(i){let e=GL(i);this._lineHeight!==e&&(this._lineHeight=e,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(i){let e=GL(i);this._letterSpacing!==e&&(this._letterSpacing=e,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(i){this._className!==i&&(this._className=i,this.domNode.className=this._className)}toggleClassName(i,e){this.domNode.classList.toggle(i,e),this._className=this.domNode.className}setDisplay(i){this._display!==i&&(this._display=i,this.domNode.style.display=this._display)}setPosition(i){this._position!==i&&(this._position=i,this.domNode.style.position=this._position)}setVisibility(i){this._visibility!==i&&(this._visibility=i,this.domNode.style.visibility=this._visibility)}setColor(i){this._color!==i&&(this._color=i,this.domNode.style.color=this._color)}setBackgroundColor(i){this._backgroundColor!==i&&(this._backgroundColor=i,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(i){this._layerHint!==i&&(this._layerHint=i,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(i){this._boxShadow!==i&&(this._boxShadow=i,this.domNode.style.boxShadow=i)}setContain(i){this._contain!==i&&(this._contain=i,this.domNode.style.contain=this._contain)}setAttribute(i,e){this.domNode.setAttribute(i,e)}removeAttribute(i){this.domNode.removeAttribute(i)}appendChild(i){this.domNode.appendChild(i.domNode)}removeChild(i){this.domNode.removeChild(i.domNode)}};function GL(a){return typeof a=="number"?`${a}px`:a}function ur(a){return new cf(a)}function Jd(a,i){a instanceof cf?(a.setFontFamily(i.getMassagedFontFamily()),a.setFontWeight(i.fontWeight),a.setFontSize(i.fontSize),a.setFontFeatureSettings(i.fontFeatureSettings),a.setFontVariationSettings(i.fontVariationSettings),a.setLineHeight(i.lineHeight),a.setLetterSpacing(i.letterSpacing)):(a.style.fontFamily=i.getMassagedFontFamily(),a.style.fontWeight=i.fontWeight,a.style.fontSize=i.fontSize+"px",a.style.fontFeatureSettings=i.fontFeatureSettings,a.style.fontVariationSettings=i.fontVariationSettings,a.style.lineHeight=i.lineHeight+"px",a.style.letterSpacing=i.letterSpacing+"px")}var C7=class extends x{constructor(e,t){super();this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._referenceDomElement=e,this._width=-1,this._height=-1,this._resizeObserver=null,this.measureReferenceDomElement(!1,t)}dispose(){this.stopObserving(),super.dispose()}getWidth(){return this._width}getHeight(){return this._height}startObserving(){if(!this._resizeObserver&&this._referenceDomElement){let e=null,t=()=>{e?this.observe({width:e.width,height:e.height}):this.observe()},o=!1,n=!1,r=()=>{if(o&&!n)try{o=!1,n=!0,t()}finally{Wr(Re(this._referenceDomElement),()=>{n=!1,r()})}};this._resizeObserver=new ResizeObserver(s=>{s&&s[0]&&s[0].contentRect?e={width:s[0].contentRect.width,height:s[0].contentRect.height}:e=null,o=!0,r()}),this._resizeObserver.observe(this._referenceDomElement)}}stopObserving(){this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null)}observe(e){this.measureReferenceDomElement(!0,e)}measureReferenceDomElement(e,t){let o=0,n=0;t?(o=t.width,n=t.height):this._referenceDomElement&&(o=this._referenceDomElement.clientWidth,n=this._referenceDomElement.clientHeight),o=Math.max(5,o),n=Math.max(5,n),(this._width!==o||this._height!==n)&&(this._width=o,this._height=n,e&&this._onDidChange.fire())}};var ati=class extends x{constructor(e){super();this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._listener=()=>this._handleChange(e,!0),this._mediaQueryList=null,this._handleChange(e,!1),this._register(Z(()=>this._mediaQueryList?.removeEventListener("change",this._listener)))}_handleChange(e,t){this._mediaQueryList?.removeEventListener("change",this._listener),this._mediaQueryList=e.matchMedia(`(resolution: ${e.devicePixelRatio}dppx)`),this._mediaQueryList.addEventListener("change",this._listener),t&&this._onDidChange.fire()}},lti=class extends x{constructor(e){super();this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._value=this._getPixelRatio(e);let t=this._register(new ati(e));this._register(t.onDidChange(()=>{this._value=this._getPixelRatio(e),this._onDidChange.fire(this._value)}))}get value(){return this._value}_getPixelRatio(e){let t=document.createElement("canvas").getContext("2d"),o=e.devicePixelRatio||1,n=t?.webkitBackingStorePixelRatio||t?.mozBackingStorePixelRatio||t?.msBackingStorePixelRatio||t?.oBackingStorePixelRatio||t?.backingStorePixelRatio||1;return o/n}},cti=class{constructor(){this.mapWindowIdToPixelRatioMonitor=new Map}_getOrCreatePixelRatioMonitor(i){let e=gv(i),t=this.mapWindowIdToPixelRatioMonitor.get(e);return t||(t=im(new lti(i)),this.mapWindowIdToPixelRatioMonitor.set(e,t),im(U.once(Wqi)(({vscodeWindowId:o})=>{o===e&&(t?.dispose(),this.mapWindowIdToPixelRatioMonitor.delete(e))}))),t}getInstance(i){return this._getOrCreatePixelRatioMonitor(i)}},bu=new cti;var Lvt=class{constructor(i,e){this.chr=i,this.type=e,this.width=0}fulfill(i){this.width=i}},dti=class a{constructor(i,e){this._bareFontInfo=i,this._requests=e,this._container=null,this._testElements=null}read(i){this._createDomElements(),i.document.body.appendChild(this._container),this._readFromDomElements(),this._container?.remove(),this._container=null,this._testElements=null}_createDomElements(){let i=document.createElement("div");i.style.position="absolute",i.style.top="-50000px",i.style.width="50000px";let e=document.createElement("div");Jd(e,this._bareFontInfo),i.appendChild(e);let t=document.createElement("div");Jd(t,this._bareFontInfo),t.style.fontWeight="bold",i.appendChild(t);let o=document.createElement("div");Jd(o,this._bareFontInfo),o.style.fontStyle="italic",i.appendChild(o);let n=[];for(let r of this._requests){let s;r.type===0&&(s=e),r.type===2&&(s=t),r.type===1&&(s=o),s.appendChild(document.createElement("br"));let l=document.createElement("span");a._render(l,r),s.appendChild(l),n.push(l)}this._container=i,this._testElements=n}static _render(i,e){if(e.chr===" "){let t="\xA0";for(let o=0;o<8;o++)t+=t;i.innerText=t}else{let t=e.chr;for(let o=0;o<8;o++)t+=t;i.textContent=t}}_readFromDomElements(){for(let i=0,e=this._requests.length;i<e;i++){let t=this._requests[i],o=this._testElements[i];t.fulfill(o.offsetWidth/256)}}};function Zji(a,i,e){new dti(i,e).read(a)}var uti=class extends x{constructor(){super(...arguments);this._cache=new Map;this._evictUntrustedReadingsTimeout=-1;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event}dispose(){this._evictUntrustedReadingsTimeout!==-1&&(clearTimeout(this._evictUntrustedReadingsTimeout),this._evictUntrustedReadingsTimeout=-1),super.dispose()}clearAllFontInfos(){this._cache.clear(),this._onDidChange.fire()}_ensureCache(e){let t=gv(e),o=this._cache.get(t);return o||(o=new pti,this._cache.set(t,o)),o}_writeToCache(e,t,o){this._ensureCache(e).put(t,o),!o.isTrusted&&this._evictUntrustedReadingsTimeout===-1&&(this._evictUntrustedReadingsTimeout=e.setTimeout(()=>{this._evictUntrustedReadingsTimeout=-1,this._evictUntrustedReadings(e)},5e3))}_evictUntrustedReadings(e){let t=this._ensureCache(e),o=t.getValues(),n=!1;for(let r of o)r.isTrusted||(n=!0,t.remove(r));n&&this._onDidChange.fire()}serializeFontInfo(e){return this._ensureCache(e).getValues().filter(o=>o.isTrusted)}restoreFontInfo(e,t){for(let o of t){if(o.version!==lZt)continue;let n=new n7(o,!1);this._writeToCache(e,n,n)}}readFontInfo(e,t){let o=this._ensureCache(e);if(!o.has(t)){let n=this._actualReadFontInfo(e,t);(n.typicalHalfwidthCharacterWidth<=2||n.typicalFullwidthCharacterWidth<=2||n.spaceWidth<=2||n.maxDigitWidth<=2)&&(n=new n7({pixelRatio:bu.getInstance(e).value,fontFamily:n.fontFamily,fontWeight:n.fontWeight,fontSize:n.fontSize,fontFeatureSettings:n.fontFeatureSettings,fontVariationSettings:n.fontVariationSettings,lineHeight:n.lineHeight,letterSpacing:n.letterSpacing,isMonospace:n.isMonospace,typicalHalfwidthCharacterWidth:Math.max(n.typicalHalfwidthCharacterWidth,5),typicalFullwidthCharacterWidth:Math.max(n.typicalFullwidthCharacterWidth,5),canUseHalfwidthRightwardsArrow:n.canUseHalfwidthRightwardsArrow,spaceWidth:Math.max(n.spaceWidth,5),middotWidth:Math.max(n.middotWidth,5),wsmiddotWidth:Math.max(n.wsmiddotWidth,5),maxDigitWidth:Math.max(n.maxDigitWidth,5)},!1)),this._writeToCache(e,t,n)}return o.get(t)}_createRequest(e,t,o,n){let r=new Lvt(e,t);return o.push(r),n?.push(r),r}_actualReadFontInfo(e,t){let o=[],n=[],r=this._createRequest("n",0,o,n),s=this._createRequest("\uFF4D",0,o,null),l=this._createRequest(" ",0,o,n),c=this._createRequest("0",0,o,n),u=this._createRequest("1",0,o,n),p=this._createRequest("2",0,o,n),h=this._createRequest("3",0,o,n),g=this._createRequest("4",0,o,n),f=this._createRequest("5",0,o,n),v=this._createRequest("6",0,o,n),b=this._createRequest("7",0,o,n),S=this._createRequest("8",0,o,n),y=this._createRequest("9",0,o,n),w=this._createRequest("\u2192",0,o,n),k=this._createRequest("\uFFEB",0,o,null),T=this._createRequest("\xB7",0,o,n),P=this._createRequest("\u2E31",0,o,null),O="|/-_ilm%";for(let J=0,ae=O.length;J<ae;J++)this._createRequest(O.charAt(J),0,o,n),this._createRequest(O.charAt(J),1,o,n),this._createRequest(O.charAt(J),2,o,n);Zji(e,t,o);let V=Math.max(c.width,u.width,p.width,h.width,g.width,f.width,v.width,b.width,S.width,y.width),H=t.fontFeatureSettings===Bx.OFF,G=n[0].width;for(let J=1,ae=n.length;H&&J<ae;J++){let he=G-n[J].width;if(he<-.001||he>.001){H=!1;break}}let $=!0;return H&&k.width!==G&&($=!1),k.width>w.width&&($=!1),new n7({pixelRatio:bu.getInstance(e).value,fontFamily:t.fontFamily,fontWeight:t.fontWeight,fontSize:t.fontSize,fontFeatureSettings:t.fontFeatureSettings,fontVariationSettings:t.fontVariationSettings,lineHeight:t.lineHeight,letterSpacing:t.letterSpacing,isMonospace:H,typicalHalfwidthCharacterWidth:r.width,typicalFullwidthCharacterWidth:s.width,canUseHalfwidthRightwardsArrow:$,spaceWidth:l.width,middotWidth:T.width,wsmiddotWidth:P.width,maxDigitWidth:V},!0)}},pti=class{constructor(){this._keys=Object.create(null),this._values=Object.create(null)}has(i){let e=i.getId();return!!this._values[e]}get(i){let e=i.getId();return this._values[e]}put(i,e){let t=i.getId();this._keys[t]=i,this._values[t]=e}remove(i){let e=i.getId();delete this._keys[e],delete this._values[e]}getValues(){return Object.keys(this._keys).map(i=>this._values[i])}},iw=new uti;var Zae=class a{constructor(i,e){this.key=i;this.migrate=e}static{this.items=[]}apply(i){let e=a._read(i,this.key),t=n=>a._read(i,n),o=(n,r)=>a._write(i,n,r);this.migrate(e,t,o)}static _read(i,e){if(typeof i>"u"||i===null)return;let t=e.indexOf(".");if(t>=0){let o=e.substring(0,t);return this._read(i[o],e.substring(t+1))}return i[e]}static _write(i,e,t){let o=e.indexOf(".");if(o>=0){let n=e.substring(0,o);i[n]=i[n]||{},this._write(i[n],e.substring(o+1),t);return}i[e]=t}};function qL(a,i){Zae.items.push(new Zae(a,i))}function zx(a,i){qL(a,(e,t,o)=>{if(typeof e<"u"){for(let[n,r]of i)if(e===n){o(a,r);return}}})}function e5i(a){Zae.items.forEach(i=>i.apply(a))}zx("wordWrap",[[!0,"on"],[!1,"off"]]);zx("lineNumbers",[[!0,"on"],[!1,"off"]]);zx("cursorBlinking",[["visible","solid"]]);zx("renderWhitespace",[[!0,"boundary"],[!1,"none"]]);zx("renderLineHighlight",[[!0,"line"],[!1,"none"]]);zx("acceptSuggestionOnEnter",[[!0,"on"],[!1,"off"]]);zx("tabCompletion",[[!1,"off"],[!0,"onlySnippets"]]);zx("hover",[[!0,{enabled:!0}],[!1,{enabled:!1}]]);zx("parameterHints",[[!0,{enabled:!0}],[!1,{enabled:!1}]]);zx("autoIndent",[[!1,"advanced"],[!0,"full"]]);zx("matchBrackets",[[!0,"always"],[!1,"never"]]);zx("renderFinalNewline",[[!0,"on"],[!1,"off"]]);zx("cursorSmoothCaretAnimation",[[!0,"on"],[!1,"off"]]);zx("occurrencesHighlight",[[!0,"singleFile"],[!1,"off"]]);zx("wordBasedSuggestions",[[!0,"matchingDocuments"],[!1,"off"]]);zx("defaultColorDecorators",[[!0,"auto"],[!1,"never"]]);zx("minimap.autohide",[[!0,"mouseover"],[!1,"none"]]);qL("autoClosingBrackets",(a,i,e)=>{a===!1&&(e("autoClosingBrackets","never"),typeof i("autoClosingQuotes")>"u"&&e("autoClosingQuotes","never"),typeof i("autoSurround")>"u"&&e("autoSurround","never"))});qL("renderIndentGuides",(a,i,e)=>{typeof a<"u"&&(e("renderIndentGuides",void 0),typeof i("guides.indentation")>"u"&&e("guides.indentation",!!a))});qL("highlightActiveIndentGuide",(a,i,e)=>{typeof a<"u"&&(e("highlightActiveIndentGuide",void 0),typeof i("guides.highlightActiveIndentation")>"u"&&e("guides.highlightActiveIndentation",!!a))});var yWo={method:"showMethods",function:"showFunctions",constructor:"showConstructors",deprecated:"showDeprecated",field:"showFields",variable:"showVariables",class:"showClasses",struct:"showStructs",interface:"showInterfaces",module:"showModules",property:"showProperties",event:"showEvents",operator:"showOperators",unit:"showUnits",value:"showValues",constant:"showConstants",enum:"showEnums",enumMember:"showEnumMembers",keyword:"showKeywords",text:"showWords",color:"showColors",file:"showFiles",reference:"showReferences",folder:"showFolders",typeParameter:"showTypeParameters",snippet:"showSnippets"};qL("suggest.filteredTypes",(a,i,e)=>{if(a&&typeof a=="object"){for(let t of Object.entries(yWo))a[t[0]]===!1&&typeof i(`suggest.${t[1]}`)>"u"&&e(`suggest.${t[1]}`,!1);e("suggest.filteredTypes",void 0)}});qL("quickSuggestions",(a,i,e)=>{if(typeof a=="boolean"){let t=a?"on":"off";e("quickSuggestions",{comments:t,strings:t,other:t})}});qL("experimental.stickyScroll.enabled",(a,i,e)=>{typeof a=="boolean"&&(e("experimental.stickyScroll.enabled",void 0),typeof i("stickyScroll.enabled")>"u"&&e("stickyScroll.enabled",a))});qL("experimental.stickyScroll.maxLineCount",(a,i,e)=>{typeof a=="number"&&(e("experimental.stickyScroll.maxLineCount",void 0),typeof i("stickyScroll.maxLineCount")>"u"&&e("stickyScroll.maxLineCount",a))});qL("editor.experimentalEditContextEnabled",(a,i,e)=>{typeof a=="boolean"&&(e("editor.experimentalEditContextEnabled",void 0),typeof i("editor.editContext")>"u"&&e("editor.editContext",a))});qL("codeActionsOnSave",(a,i,e)=>{if(a&&typeof a=="object"){let t=!1,o={};for(let n of Object.entries(a))typeof n[1]=="boolean"?(t=!0,o[n[0]]=n[1]?"explicit":"never"):o[n[0]]=n[1];t&&e("codeActionsOnSave",o)}});qL("codeActionWidget.includeNearbyQuickfixes",(a,i,e)=>{typeof a=="boolean"&&(e("codeActionWidget.includeNearbyQuickfixes",void 0),typeof i("codeActionWidget.includeNearbyQuickFixes")>"u"&&e("codeActionWidget.includeNearbyQuickFixes",a))});qL("lightbulb.enabled",(a,i,e)=>{typeof a=="boolean"&&e("lightbulb.enabled",a?void 0:"off")});qL("inlineSuggest.edits.codeShifting",(a,i,e)=>{typeof a=="boolean"&&(e("inlineSuggest.edits.codeShifting",void 0),e("inlineSuggest.edits.allowCodeShifting",a?"always":"never"))});qL("hover.enabled",(a,i,e)=>{typeof a=="boolean"&&e("hover.enabled",a?"on":"off")});var mti=class extends x{constructor(){super(...arguments);this._tabFocus=!1;this._onDidChangeTabFocus=this._register(new E);this.onDidChangeTabFocus=this._onDidChangeTabFocus.event}getTabFocusMode(){return this._tabFocus}setTabFocusMode(e){this._tabFocus=e,this._onDidChangeTabFocus.fire(this._tabFocus)}},x_=new mti;function t5i(a,i,e){let t=a.get(58),o=a.get(62),n=a.get(61),r=a.get(60),s=a.get(63),l=a.get(75),c=a.get(72);return UIe._create(t,o,n,r,s,l,c,i,e)}function QS(a,i,e=!1){let t=iS.fontFamily.validate(a.fontFamily),o=iS.fontWeight.validate(a.fontWeight),n=iS.fontSize.validate(a.fontSize),r=iS.fontLigatures2.validate(a.fontLigatures),s=iS.fontVariations.validate(a.fontVariations),l=iS.lineHeight.validate(a.lineHeight),c=iS.letterSpacing.validate(a.letterSpacing);return UIe._create(t,o,n,r,s,l,c,i,e)}var x7=class extends x{constructor(e,t,o,n,r){super();this._accessibilityService=r;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._onDidChangeFast=this._register(new E);this.onDidChangeFast=this._onDidChangeFast.event;this._isDominatedByLongLines=!1;this._viewLineCount=1;this._lineNumbersDigitCount=1;this._reservedHeight=0;this._glyphMarginDecorationLaneCount=1;this._computeOptionsMemory=new eje;this.isSimpleWidget=e,this.contextMenuId=t,this._containerObserver=this._register(new C7(n,o.dimension)),this._targetWindowId=Re(n).vscodeWindowId,this._rawOptions=i5i(o),this._validatedOptions=ele.validateOptions(this._rawOptions),this.options=this._computeOptions(),this.options.get(19)&&this._containerObserver.startObserving(),this._register(fE.onDidChangeZoomLevel(()=>this._recomputeOptions())),this._register(x_.onDidChangeTabFocus(()=>this._recomputeOptions())),this._register(this._containerObserver.onDidChange(()=>this._recomputeOptions())),this._register(iw.onDidChange(()=>this._recomputeOptions())),this._register(bu.getInstance(Re(n)).onDidChange(()=>this._recomputeOptions())),this._register(this._accessibilityService.onDidChangeScreenReaderOptimized(()=>this._recomputeOptions())),this._register(TV.onDidChangeInputMode(()=>this._recomputeOptions()))}_recomputeOptions(){let e=this._computeOptions(),t=ele.checkEquals(this.options,e);t!==null&&(this.options=e,this._onDidChangeFast.fire(t),this._onDidChange.fire(t))}_computeOptions(){let e=this._readEnvConfiguration(),t=t5i(this._validatedOptions,e.pixelRatio,this.isSimpleWidget),o=this._readFontInfo(t),n={memory:this._computeOptionsMemory,outerWidth:e.outerWidth,outerHeight:e.outerHeight-this._reservedHeight,fontInfo:o,extraEditorClassName:e.extraEditorClassName,isDominatedByLongLines:this._isDominatedByLongLines,viewLineCount:this._viewLineCount,lineNumbersDigitCount:this._lineNumbersDigitCount,emptySelectionClipboard:e.emptySelectionClipboard,pixelRatio:e.pixelRatio,tabFocusMode:this._validatedOptions.get(164)||x_.getTabFocusMode(),inputMode:TV.getInputMode(),accessibilitySupport:e.accessibilitySupport,glyphMarginDecorationLaneCount:this._glyphMarginDecorationLaneCount,editContextSupported:e.editContextSupported};return ele.computeOptions(this._validatedOptions,n)}_readEnvConfiguration(){return{extraEditorClassName:CWo(),outerWidth:this._containerObserver.getWidth(),outerHeight:this._containerObserver.getHeight(),emptySelectionClipboard:lV||Ac,pixelRatio:bu.getInstance(rb(this._targetWindowId,!0).window).value,editContextSupported:typeof globalThis.EditContext=="function",accessibilitySupport:this._accessibilityService.isScreenReaderOptimized()?2:this._accessibilityService.getAccessibilitySupport()}}_readFontInfo(e){return iw.readFontInfo(rb(this._targetWindowId,!0).window,e)}getRawOptions(){return this._rawOptions}updateOptions(e){let t=i5i(e);ele.applyUpdate(this._rawOptions,t)&&(this._validatedOptions=ele.validateOptions(this._rawOptions),this._recomputeOptions())}observeContainer(e){this._containerObserver.observe(e)}setIsDominatedByLongLines(e){this._isDominatedByLongLines!==e&&(this._isDominatedByLongLines=e,this._recomputeOptions())}setModelLineCount(e){let t=wWo(e);this._lineNumbersDigitCount!==t&&(this._lineNumbersDigitCount=t,this._recomputeOptions())}setViewLineCount(e){this._viewLineCount!==e&&(this._viewLineCount=e,this._recomputeOptions())}setReservedHeight(e){this._reservedHeight!==e&&(this._reservedHeight=e,this._recomputeOptions())}setGlyphMarginDecorationLaneCount(e){this._glyphMarginDecorationLaneCount!==e&&(this._glyphMarginDecorationLaneCount=e,this._recomputeOptions())}};x7=I([m(4,Oi)],x7);function wWo(a){let i=0;for(;a;)a=Math.floor(a/10),i++;return i||1}function CWo(){let a="";return Jb||uGi?(a+="no-minimap-shadow ",a+="enable-user-select "):a+="no-user-select ",Ze&&(a+="mac "),a}var hti=class{constructor(){this._values=[]}_read(i){return this._values[i]}get(i){return this._values[i]}_write(i,e){this._values[i]=e}},gti=class{constructor(){this._values=[]}_read(i){if(i>=this._values.length)throw new Error("Cannot read uninitialized value");return this._values[i]}get(i){return this._read(i)}_write(i,e){this._values[i]=e}},ele=class a{static validateOptions(i){let e=new hti;for(let t of k1){let o=t.name==="_never_"?void 0:i[t.name];e._write(t.id,t.validate(o))}return e}static computeOptions(i,e){let t=new gti;for(let o of k1)t._write(o.id,o.compute(e,t,i._read(o.id)));return t}static _deepEquals(i,e){if(typeof i!="object"||typeof e!="object"||!i||!e)return i===e;if(Array.isArray(i)||Array.isArray(e))return Array.isArray(i)&&Array.isArray(e)?$i(i,e):!1;if(Object.keys(i).length!==Object.keys(e).length)return!1;for(let t in i)if(!a._deepEquals(i[t],e[t]))return!1;return!0}static checkEquals(i,e){let t=[],o=!1;for(let n of k1){let r=!a._deepEquals(i._read(n.id),e._read(n.id));t[n.id]=r,r&&(o=!0)}return o?new Jgt(t):null}static applyUpdate(i,e){let t=!1;for(let o of k1)if(e.hasOwnProperty(o.name)){let n=o.applyUpdate(i[o.name],e[o.name]);i[o.name]=n.newValue,t=t||n.didChange}return t}};function i5i(a){let i=Ji(a);return e5i(i),i}var Kx;(O=>{let a={total:0,min:Number.MAX_VALUE,max:0},i={...a},e={...a},t={...a},o=0,n;($=>($[$.Before=0]="Before",$[$.InProgress=1]="InProgress",$[$.Finished=2]="Finished"))(n||={});let r={keydown:0,input:0,render:0};function s(){S(),performance.mark("inputlatency/start"),performance.mark("keydown/start"),r.keydown=1,queueMicrotask(l)}O.onKeyDown=s;function l(){r.keydown===1&&(performance.mark("keydown/end"),r.keydown=2)}function c(){performance.mark("input/start"),r.input=1,b()}O.onBeforeInput=c;function u(){r.input===0&&c(),queueMicrotask(p)}O.onInput=u;function p(){r.input===1&&(performance.mark("input/end"),r.input=2)}function h(){S()}O.onKeyUp=h;function g(){S()}O.onSelectionChange=g;function f(){r.keydown===2&&r.input===2&&r.render===0&&(performance.mark("render/start"),r.render=1,queueMicrotask(v),b())}O.onRenderStart=f;function v(){r.render===1&&(performance.mark("render/end"),r.render=2)}function b(){setTimeout(S)}function S(){r.keydown===2&&r.input===2&&r.render===2&&(performance.mark("inputlatency/end"),performance.measure("keydown","keydown/start","keydown/end"),performance.measure("input","input/start","input/end"),performance.measure("render","render/start","render/end"),performance.measure("inputlatency","inputlatency/start","inputlatency/end"),y("keydown",a),y("input",i),y("render",e),y("inputlatency",t),o++,w())}function y(V,H){let G=performance.getEntriesByName(V)[0].duration;H.total+=G,H.min=Math.min(H.min,G),H.max=Math.max(H.max,G)}function w(){performance.clearMarks("keydown/start"),performance.clearMarks("keydown/end"),performance.clearMarks("input/start"),performance.clearMarks("input/end"),performance.clearMarks("render/start"),performance.clearMarks("render/end"),performance.clearMarks("inputlatency/start"),performance.clearMarks("inputlatency/end"),performance.clearMeasures("keydown"),performance.clearMeasures("input"),performance.clearMeasures("render"),performance.clearMeasures("inputlatency"),r.keydown=0,r.input=0,r.render=0}function k(){if(o===0)return;let V={keydown:T(a),input:T(i),render:T(e),total:T(t),sampleCount:o};return P(a),P(i),P(e),P(t),o=0,V}O.getAndClearMeasurements=k;function T(V){return{average:V.total/o,max:V.max,min:V.min}}function P(V){V.total=0,V.min=Number.MAX_VALUE,V.max=0}})(Kx||={});function pn(a){return a&&typeof a.getEditorType=="function"?a.getEditorType()===oj.ICodeEditor:!1}function mc(a){return a&&typeof a.getEditorType=="function"?a.getEditorType()===oj.IDiffEditor:!1}function SO(a){return!!a&&typeof a=="object"&&typeof a.onDidChangeActiveEditor=="function"}function ha(a){return pn(a)?a:mc(a)?a.getModifiedEditor():SO(a)&&pn(a.activeCodeEditor)?a.activeCodeEditor:null}function o5i(a){return pn(a)||mc(a)?a:null}var _ye=new Map;function n5i(a){return _ye.has(a)}var vti=class extends x{constructor(){super(...arguments);this._currentCssStyle="";this._styleSheet=void 0}setStyle(e){e!==this._currentCssStyle&&(this._currentCssStyle=e,this._styleSheet?this._styleSheet.textContent=e:this._styleSheet=Cr(ut.document.head,t=>t.textContent=e,this._store))}dispose(){super.dispose(),this._styleSheet=void 0}};function Cr(a=ut.document.head,i,e){let t=document.createElement("style");if(t.type="text/css",t.media="screen",i?.(t),a.appendChild(t),e&&e.add(Z(()=>t.remove())),a===ut.document.head){let o=new Set;_ye.set(t,o),e&&e.add(Z(()=>_ye.delete(t)));for(let{window:n,disposables:r}of SC()){if(n===ut)continue;let s=r.add(s5i(t,o,n));e?.add(s)}}return t}function r5i(a){let i=new N;for(let[e,t]of _ye)i.add(s5i(e,t,a));return i}function s5i(a,i,e){let t=new N,o=a.cloneNode(!0);e.document.head.appendChild(o),t.add(Z(()=>o.remove()));for(let n of l5i(a))o.sheet?.insertRule(n.cssText,o.sheet?.cssRules.length);return t.add(F$e.observe(a,t,{childList:!0,subtree:Ac,characterData:Ac})(()=>{o.textContent=a.textContent})),i.add(o),t.add(Z(()=>i.delete(o))),t}var fti=null;function a5i(){return fti||(fti=Cr()),fti}function l5i(a){return a?.sheet?.rules?a.sheet.rules:a?.sheet?.cssRules?a.sheet.cssRules:[]}function $h(a,i,e=a5i()){if(!(!e||!i)){e.sheet?.insertRule(`${a} {${i}}`,0);for(let t of _ye.get(e)??[])$h(a,i,t)}}function IO(a,i=a5i()){if(!i)return;let e=l5i(i),t=[];for(let o=0;o<e.length;o++){let n=e[o];xWo(n)&&n.selectorText.indexOf(a)!==-1&&t.push(o)}for(let o=t.length-1;o>=0;o--)i.sheet?.deleteRule(t[o]);for(let o of _ye.get(i)??[])IO(a,o)}function xWo(a){return typeof a.selectorText=="string"}function c5i(a){let i=new N,e=i.add(new vti);return i.add(be(t=>{e.setStyle(a.read(t))})),i}var $L=class{constructor(){this._hooks=new N;this._pointerMoveCallback=null;this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(i,e){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let t=this._onStopCallback;this._onStopCallback=null,i&&t&&t(e)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(i,e,t,o,n){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=o,this._onStopCallback=n;let r=i;try{i.setPointerCapture(e),this._hooks.add(Z(()=>{try{i.releasePointerCapture(e)}catch{}}))}catch{r=Re(i)}this._hooks.add(j(r,re.POINTER_MOVE,s=>{if(s.buttons!==t){this.stopMonitoring(!0);return}s.preventDefault(),this._pointerMoveCallback(s)})),this._hooks.add(j(r,re.POINTER_UP,s=>this.stopMonitoring(!0)))}};function yO(a){return`--vscode-${a.replace(/\./g,"-")}`}function kt(a){return`var(${yO(a)})`}function tle(a,i){return`var(${yO(a)}, ${i})`}function kWo(a){return a!==null&&typeof a=="object"&&"light"in a&&"dark"in a}var ile={ColorContribution:"base.contributions.colors"},Nje="default",bti=class extends x{constructor(){super();this._onDidChangeSchema=this._register(new E);this.onDidChangeSchema=this._onDidChangeSchema.event;this.colorSchema={type:"object",properties:{}};this.colorReferenceSchema={type:"string",enum:[],enumDescriptions:[]};this.colorsById={}}notifyThemeUpdate(e){for(let t of Object.keys(this.colorsById)){let o=e.getColor(t);o&&(this.colorSchema.properties[t].oneOf[0].defaultSnippets[0].body=`\${1:${We.Format.CSS.formatHexA(o,!0)}}`)}this._onDidChangeSchema.fire()}registerColor(e,t,o,n=!1,r){let s={id:e,description:o,defaults:t,needsTransparency:n,deprecationMessage:r};this.colorsById[e]=s;let l={type:"string",format:"color-hex",defaultSnippets:[{body:"${1:#ff0000}"}]};return r&&(l.deprecationMessage=r),n&&(l.pattern="^#(?:(?<rgba>[0-9a-fA-f]{3}[0-9a-eA-E])|(?:[0-9a-fA-F]{6}(?:(?![fF]{2})(?:[0-9a-fA-F]{2}))))?$",l.patternErrorMessage=d(2662,null)),this.colorSchema.properties[e]={description:o,oneOf:[l,{type:"string",const:Nje,description:d(2663,null)}]},this.colorReferenceSchema.enum.push(e),this.colorReferenceSchema.enumDescriptions.push(o),this._onDidChangeSchema.fire(),e}updateDefaultColor(e,t){let o=this.colorsById[e];o&&(this.colorsById[e]={...o,defaults:t})}deregisterColor(e){delete this.colorsById[e],delete this.colorSchema.properties[e];let t=this.colorReferenceSchema.enum.indexOf(e);t!==-1&&(this.colorReferenceSchema.enum.splice(t,1),this.colorReferenceSchema.enumDescriptions.splice(t,1)),this._onDidChangeSchema.fire()}getColors(){return Object.keys(this.colorsById).map(e=>this.colorsById[e])}resolveDefaultColor(e,t){let o=this.colorsById[e];if(o?.defaults){let n=kWo(o.defaults)?o.defaults[t.type]:o.defaults;return k_(n,t)}}getColorSchema(){return this.colorSchema}getColorReferenceSchema(){return this.colorReferenceSchema}toString(){let e=(t,o)=>{let n=t.indexOf(".")===-1?0:1,r=o.indexOf(".")===-1?0:1;return n!==r?n-r:t.localeCompare(o)};return Object.keys(this.colorsById).sort(e).map(t=>`- \`${t}\`: ${this.colorsById[t].description}`).join(`
`)}},Oje=new bti;ne.add(ile.ColorContribution,Oje);function te(a,i,e,t,o){return Oje.registerColor(a,i,e,t,o)}function Dye(){return Oje}function EWo(a,i){switch(a.op){case 0:return k_(a.value,i)?.darken(a.factor);case 1:return k_(a.value,i)?.lighten(a.factor);case 2:return k_(a.value,i)?.transparent(a.factor);case 7:{let e=k_(a.color,i)||We.transparent,t=k_(a.with,i)||We.transparent;return e.mix(t,a.ratio)}case 3:{let e=k_(a.background,i);return e?k_(a.value,i)?.makeOpaque(e):k_(a.value,i)}case 4:for(let e of a.values){let t=k_(e,i);if(t)return t}return;case 6:return k_(i.defines(a.if)?a.then:a.else,i);case 5:{let e=k_(a.value,i);if(!e)return;let t=k_(a.background,i);return t?e.isDarkerThan(t)?We.getLighterColor(e,t,a.factor).transparent(a.transparency):We.getDarkerColor(e,t,a.factor).transparent(a.transparency):e.transparent(a.factor*a.transparency)}default:throw os(a)}}function ep(a,i){return{op:0,value:a,factor:i}}function cb(a,i){return{op:1,value:a,factor:i}}function ai(a,i){return{op:2,value:a,factor:i}}function lj(a,i){return{op:3,value:a,background:i}}function ole(...a){return{op:4,values:a}}function nle(a,i,e){return{op:6,if:a,then:i,else:e}}function Sti(a,i,e,t){return{op:5,value:a,background:i,factor:e,transparency:t}}function k_(a,i){if(a!==null){if(typeof a=="string")return a[0]==="#"?We.fromHex(a):i.getColor(a);if(a instanceof We)return a;if(typeof a=="object")return EWo(a,i)}}var rle="vscode://schemas/workbench-colors",u5i=ne.as(ma.JSONContribution);u5i.registerSchema(rle,Oje.getColorSchema());var d5i=new Dt(()=>u5i.notifySchemaChanged(rle),200);Oje.onDidChangeSchema(()=>{d5i.isScheduled()||d5i.schedule()});var To=te("foreground",{dark:"#CCCCCC",light:"#616161",hcDark:"#FFFFFF",hcLight:"#292929"},d(2418,null)),Iti=te("disabledForeground",{dark:"#CCCCCC80",light:"#61616180",hcDark:"#A5A5A5",hcLight:"#7F7F7F"},d(2415,null)),sle=te("errorForeground",{dark:"#F48771",light:"#A1260D",hcDark:"#F48771",hcLight:"#B5200D"},d(2416,null)),Fje=te("descriptionForeground",{light:"#717171",dark:ai(To,.7),hcDark:ai(To,.7),hcLight:ai(To,.7)},d(2414,null)),cj=te("icon.foreground",{dark:"#C5C5C5",light:"#424242",hcDark:"#FFFFFF",hcLight:"#292929"},d(2419,null)),Sd=te("focusBorder",{dark:"#007FD4",light:"#0090F1",hcDark:"#F38518",hcLight:"#006BBD"},d(2417,null)),bi=te("contrastBorder",{light:null,dark:null,hcDark:"#6FC3DF",hcLight:"#0F4A85"},d(2413,null)),Ys=te("contrastActiveBorder",{light:null,dark:null,hcDark:Sd,hcLight:Sd},d(2412,null)),Rvt=te("selection.background",null,d(2420,null)),nS=te("textLink.foreground",{light:"#006AB1",dark:"#3794FF",hcDark:"#21A6FF",hcLight:"#0F4A85"},d(2425,null)),Mvt=te("textLink.activeForeground",{light:"#006AB1",dark:"#3794FF",hcDark:"#21A6FF",hcLight:"#0F4A85"},d(2424,null)),N1n=te("textSeparator.foreground",{light:"#0000002e",dark:"#ffffff2e",hcDark:We.black,hcLight:"#292929"},d(2429,null)),O1n=te("textPreformat.foreground",{light:"#A31515",dark:"#D7BA7D",hcDark:"#FFFFFF",hcLight:"#FFFFFF"},d(2428,null)),F1n=te("textPreformat.background",{light:"#0000001A",dark:"#FFFFFF1A",hcDark:null,hcLight:"#09345f"},d(2426,null)),W1n=te("textPreformat.border",{light:null,dark:null,hcDark:bi,hcLight:null},d(2427,null)),V1n=te("textBlockQuote.background",{light:"#f2f2f2",dark:"#222222",hcDark:null,hcLight:"#F2F2F2"},d(2421,null)),B1n=te("textBlockQuote.border",{light:"#007acc80",dark:"#007acc80",hcDark:We.white,hcLight:"#292929"},d(2422,null)),H1n=te("textCodeBlock.background",{light:"#dcdcdc66",dark:"#0a0a0a66",hcDark:We.black,hcLight:"#F2F2F2"},d(2423,null));var q1n=te("sash.hoverBorder",Sd,d(2644,null)),bv=te("badge.background",{dark:"#4D4D4D",light:"#C4C4C4",hcDark:We.black,hcLight:"#0F4A85"},d(2638,null)),CC=te("badge.foreground",{dark:We.white,light:"#333",hcDark:We.white,hcLight:We.white},d(2639,null)),p5i=te("activityWarningBadge.foreground",{dark:We.white,light:We.white,hcDark:We.white,hcLight:We.white},d(2637,null)),m5i=te("activityWarningBadge.background",{dark:"#B27C00",light:"#B27C00",hcDark:null,hcLight:"#B27C00"},d(2636,null)),yti=te("activityErrorBadge.foreground",{dark:We.black.lighten(.2),light:We.white,hcDark:null,hcLight:We.black.lighten(.2)},d(2635,null)),wti=te("activityErrorBadge.background",{dark:"#F14C4C",light:"#E51400",hcDark:null,hcLight:"#F14C4C"},d(2634,null)),U1=te("scrollbar.shadow",{dark:"#000000",light:"#DDDDDD",hcDark:null,hcLight:null},d(2646,null)),k7=te("scrollbarSlider.background",{dark:We.fromHex("#797979").transparent(.4),light:We.fromHex("#646464").transparent(.4),hcDark:ai(bi,.6),hcLight:ai(bi,.4)},d(2648,null)),z1=te("scrollbarSlider.hoverBackground",{dark:We.fromHex("#646464").transparent(.7),light:We.fromHex("#646464").transparent(.7),hcDark:ai(bi,.8),hcLight:ai(bi,.8)},d(2649,null)),K1=te("scrollbarSlider.activeBackground",{dark:We.fromHex("#BFBFBF").transparent(.4),light:We.fromHex("#000000").transparent(.6),hcDark:bi,hcLight:bi},d(2647,null)),$1n=te("scrollbar.background",null,d(2645,null)),h5i=te("progressBar.background",{dark:We.fromHex("#0E70C0"),light:We.fromHex("#0E70C0"),hcDark:bi,hcLight:bi},d(2643,null)),g5i=te("chart.line",{dark:"#236B8E",light:"#236B8E",hcDark:"#236B8E",hcLight:"#236B8E"},d(2642,null)),Cti=te("chart.axis",{dark:We.fromHex("#BFBFBF").transparent(.4),light:We.fromHex("#000000").transparent(.6),hcDark:bi,hcLight:bi},d(2640,null)),f5i=te("chart.guide",{dark:We.fromHex("#BFBFBF").transparent(.2),light:We.fromHex("#000000").transparent(.2),hcDark:bi,hcLight:bi},d(2641,null));var Ho=te("editor.background",{light:"#ffffff",dark:"#1E1E1E",hcDark:We.black,hcLight:We.white},d(2458,null)),Id=te("editor.foreground",{light:"#333333",dark:"#BBBBBB",hcDark:We.white,hcLight:To},d(2465,null)),Z1n=te("editorStickyScroll.background",Ho,d(2483,null)),ezn=te("editorStickyScrollGutter.background",Ho,d(2485,null)),tzn=te("editorStickyScrollHover.background",{dark:"#2A2D2E",light:"#F0F0F0",hcDark:null,hcLight:We.fromHex("#0F4A85").transparent(.1)},d(2486,null)),izn=te("editorStickyScroll.border",{dark:null,light:null,hcDark:bi,hcLight:bi},d(2484,null)),ozn=te("editorStickyScroll.shadow",U1,d(2487,null)),Su=te("editorWidget.background",{dark:"#252526",light:"#F3F3F3",hcDark:"#0C141F",hcLight:We.white},d(2490,null)),jL=te("editorWidget.foreground",To,d(2492,null)),CO=te("editorWidget.border",{dark:"#454545",light:"#C8C8C8",hcDark:bi,hcLight:bi},d(2491,null)),nzn=te("editorWidget.resizeBorder",null,d(2493,null)),rzn=te("editorError.background",null,d(2460,null),!0),Iv=te("editorError.foreground",{dark:"#F14C4C",light:"#E51400",hcDark:"#F48771",hcLight:"#B5200D"},d(2461,null)),I5i=te("editorError.border",{dark:null,light:null,hcDark:We.fromHex("#E47777").transparent(.8),hcLight:"#B5200D"},d(2494,null)),y5i=te("editorWarning.background",null,d(2488,null),!0),jh=te("editorWarning.foreground",{dark:"#CCA700",light:"#BF8803",hcDark:"#FFD370",hcLight:"#895503"},d(2489,null)),E7=te("editorWarning.border",{dark:null,light:null,hcDark:We.fromHex("#FFCC00").transparent(.8),hcLight:We.fromHex("#FFCC00").transparent(.8)},d(2529,null)),szn=te("editorInfo.background",null,d(2468,null),!0),Dm=te("editorInfo.foreground",{dark:"#59a4f9",light:"#0063d3",hcDark:"#59a4f9",hcLight:"#0063d3"},d(2469,null)),T7=te("editorInfo.border",{dark:null,light:null,hcDark:We.fromHex("#59a4f9").transparent(.8),hcLight:"#292929"},d(2505,null)),w5i=te("editorHint.foreground",{dark:We.fromHex("#eeeeee").transparent(.7),light:"#6c6c6c",hcDark:null,hcLight:null},d(2466,null)),azn=te("editorHint.border",{dark:null,light:null,hcDark:We.fromHex("#eeeeee").transparent(.8),hcLight:"#292929"},d(2500,null)),C5i=te("editorLink.activeForeground",{dark:"#4E94CE",light:We.blue,hcDark:We.cyan,hcLight:"#292929"},d(2438,null)),Sv=te("editor.selectionBackground",{light:"#ADD6FF",dark:"#264F78",hcDark:"#f3f518",hcLight:"#0F4A85"},d(2479,null)),x5i=te("editor.selectionForeground",{light:null,dark:null,hcDark:"#000000",hcLight:We.white},d(2480,null)),k5i=te("editor.inactiveSelectionBackground",{light:ai(Sv,.5),dark:ai(Sv,.5),hcDark:ai(Sv,.7),hcLight:ai(Sv,.5)},d(2467,null),!0),Aye=te("editor.selectionHighlightBackground",{light:Sti(Sv,Ho,.3,.6),dark:Sti(Sv,Ho,.3,.6),hcDark:null,hcLight:null},d(2481,null),!0),lzn=te("editor.selectionHighlightBorder",{light:null,dark:null,hcDark:Ys,hcLight:Ys},d(2482,null)),czn=te("editor.compositionBorder",{light:"#000000",dark:"#ffffff",hcLight:"#000000",hcDark:"#ffffff"},d(2459,null)),lle=te("editor.findMatchBackground",{light:"#A8AC94",dark:"#515C6A",hcDark:null,hcLight:null},d(2462,null)),E5i=te("editor.findMatchForeground",null,d(2464,null)),rS=te("editor.findMatchHighlightBackground",{light:"#EA5C0055",dark:"#EA5C0055",hcDark:null,hcLight:null},d(2495,null),!0),T5i=te("editor.findMatchHighlightForeground",null,d(2497,null),!0),_5i=te("editor.findRangeHighlightBackground",{dark:"#3a3d4166",light:"#b4b4b44d",hcDark:null,hcLight:null},d(2498,null),!0),dzn=te("editor.findMatchBorder",{light:null,dark:null,hcDark:Ys,hcLight:Ys},d(2463,null)),xO=te("editor.findMatchHighlightBorder",{light:null,dark:null,hcDark:Ys,hcLight:Ys},d(2496,null)),D5i=te("editor.findRangeHighlightBorder",{dark:null,light:null,hcDark:ai(Ys,.4),hcLight:ai(Ys,.4)},d(2499,null),!0),Pvt=te("editor.hoverHighlightBackground",{light:"#ADD6FF26",dark:"#264f7840",hcDark:"#ADD6FF26",hcLight:null},d(2504,null),!0),wO=te("editorHoverWidget.background",Su,d(2501,null)),_7=te("editorHoverWidget.foreground",jL,d(2503,null)),G1=te("editorHoverWidget.border",CO,d(2502,null)),uzn=te("editorHoverWidget.statusBarBackground",{dark:cb(wO,.2),light:ep(wO,.05),hcDark:Su,hcLight:Su},d(2525,null)),Avt=te("editorInlayHint.foreground",{dark:"#969696",light:"#969696",hcDark:We.white,hcLight:We.black},d(2473,null)),Nvt=te("editorInlayHint.background",{dark:ai(bv,.1),light:ai(bv,.1),hcDark:ai(We.white,.1),hcLight:ai(bv,.1)},d(2470,null)),L5i=te("editorInlayHint.typeForeground",Avt,d(2475,null)),R5i=te("editorInlayHint.typeBackground",Nvt,d(2472,null)),M5i=te("editorInlayHint.parameterForeground",Avt,d(2474,null)),P5i=te("editorInlayHint.parameterBackground",Nvt,d(2471,null)),TWo=te("editorLightBulb.foreground",{dark:"#FFCC00",light:"#DDB100",hcDark:"#FFCC00",hcLight:"#007ACC"},d(2478,null)),pzn=te("editorLightBulbAutoFix.foreground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},d(2477,null)),mzn=te("editorLightBulbAi.foreground",TWo,d(2476,null)),hzn=te("editor.snippetTabstopHighlightBackground",{dark:new We(new zt(124,124,124,.3)),light:new We(new zt(10,50,100,.2)),hcDark:new We(new zt(124,124,124,.3)),hcLight:new We(new zt(10,50,100,.2))},d(2523,null)),gzn=te("editor.snippetTabstopHighlightBorder",null,d(2524,null)),fzn=te("editor.snippetFinalTabstopHighlightBackground",null,d(2521,null)),vzn=te("editor.snippetFinalTabstopHighlightBorder",{dark:"#525252",light:new We(new zt(10,50,100,.5)),hcDark:"#525252",hcLight:"#292929"},d(2522,null)),Lye=new We(new zt(155,185,85,.2)),Rye=new We(new zt(255,0,0,.2)),df=te("diffEditor.insertedTextBackground",{dark:"#9ccc2c33",light:"#9ccc2c40",hcDark:null,hcLight:null},d(2448,null),!0),zf=te("diffEditor.removedTextBackground",{dark:"#ff000033",light:"#ff000033",hcDark:null,hcLight:null},d(2454,null),!0),Bje=te("diffEditor.insertedLineBackground",{dark:Lye,light:Lye,hcDark:null,hcLight:null},d(2450,null),!0),bzn=te("diffEditor.removedLineBackground",{dark:Rye,light:Rye,hcDark:null,hcLight:null},d(2456,null),!0),Szn=te("diffEditorGutter.insertedLineBackground",null,d(2449,null)),Izn=te("diffEditorGutter.removedLineBackground",null,d(2455,null)),Ovt=te("diffEditorOverview.insertedForeground",null,d(2452,null)),Fvt=te("diffEditorOverview.removedForeground",null,d(2453,null)),yzn=te("diffEditor.insertedTextBorder",{dark:null,light:null,hcDark:"#33ff2eff",hcLight:"#374E06"},d(2451,null)),wzn=te("diffEditor.removedTextBorder",{dark:null,light:null,hcDark:"#FF008F",hcLight:"#AD0707"},d(2457,null)),Czn=te("diffEditor.border",{dark:null,light:null,hcDark:bi,hcLight:bi},d(2447,null)),A5i=te("diffEditor.diagonalFill",{dark:"#cccccc33",light:"#22222233",hcDark:null,hcLight:null},d(2443,null)),xzn=te("diffEditor.unchangedRegionBackground","sideBar.background",d(2445,null)),kzn=te("diffEditor.unchangedRegionForeground","foreground",d(2446,null)),Ezn=te("diffEditor.unchangedCodeBackground",{dark:"#74747429",light:"#b8b8b829",hcDark:null,hcLight:null},d(2444,null)),kO=te("widget.shadow",{dark:ai(We.black,.36),light:ai(We.black,.16),hcDark:null,hcLight:null},d(2531,null)),E_=te("widget.border",{dark:null,light:null,hcDark:bi,hcLight:bi},d(2530,null)),ale=te("toolbar.hoverBackground",{dark:"#5a5d5e50",light:"#b8b8b850",hcDark:null,hcLight:null},d(2527,null)),Tzn=te("toolbar.hoverOutline",{dark:null,light:null,hcDark:Ys,hcLight:Ys},d(2528,null)),_zn=te("toolbar.activeBackground",{dark:cb(ale,.1),light:ep(ale,.1),hcDark:null,hcLight:null},d(2526,null)),N5i=te("breadcrumb.foreground",ai(To,.8),d(2440,null)),O5i=te("breadcrumb.background",Ho,d(2439,null)),kti=te("breadcrumb.focusForeground",{light:ep(To,.2),dark:cb(To,.1),hcDark:cb(To,.1),hcLight:cb(To,.1)},d(2440,null)),F5i=te("breadcrumb.activeSelectionForeground",{light:ep(To,.2),dark:cb(To,.1),hcDark:cb(To,.1),hcLight:cb(To,.1)},d(2442,null)),Eti=te("breadcrumbPicker.background",Su,d(2441,null)),W5i=.5,v5i=We.fromHex("#40C8AE").transparent(W5i),b5i=We.fromHex("#40A6FF").transparent(W5i),S5i=We.fromHex("#606060").transparent(.4),Tti=.4,Mye=1,Wje=te("merge.currentHeaderBackground",{dark:v5i,light:v5i,hcDark:null,hcLight:null},d(2510,null),!0),Dzn=te("merge.currentContentBackground",ai(Wje,Tti),d(2509,null),!0),Vje=te("merge.incomingHeaderBackground",{dark:b5i,light:b5i,hcDark:null,hcLight:null},d(2512,null),!0),Lzn=te("merge.incomingContentBackground",ai(Vje,Tti),d(2511,null),!0),xti=te("merge.commonHeaderBackground",{dark:S5i,light:S5i,hcDark:null,hcLight:null},d(2508,null),!0),Rzn=te("merge.commonContentBackground",ai(xti,Tti),d(2507,null),!0),Pye=te("merge.border",{dark:null,light:null,hcDark:"#C3DF6F",hcLight:"#007ACC"},d(2506,null)),Mzn=te("editorOverviewRuler.currentContentForeground",{dark:ai(Wje,Mye),light:ai(Wje,Mye),hcDark:Pye,hcLight:Pye},d(2514,null)),Pzn=te("editorOverviewRuler.incomingContentForeground",{dark:ai(Vje,Mye),light:ai(Vje,Mye),hcDark:Pye,hcLight:Pye},d(2516,null)),Azn=te("editorOverviewRuler.commonContentForeground",{dark:ai(xti,Mye),light:ai(xti,Mye),hcDark:Pye,hcLight:Pye},d(2513,null)),EO=te("editorOverviewRuler.findMatchForeground",{dark:"#d186167e",light:"#d186167e",hcDark:"#AB5A00",hcLight:"#AB5A00"},d(2515,null),!0),Nye=te("editorOverviewRuler.selectionHighlightForeground","#A0A0A0CC",d(2517,null),!0),V5i=te("problemsErrorIcon.foreground",Iv,d(2518,null)),B5i=te("problemsWarningIcon.foreground",jh,d(2520,null)),H5i=te("problemsInfoIcon.foreground",Dm,d(2519,null));var D7=te("minimap.findMatchHighlight",rS,d(2625,null),!0),Hje=te("minimap.selectionOccurrenceHighlight",Aye,d(2629,null),!0),_ti=te("minimap.selectionHighlight",Sv,d(2628,null),!0),U5i=te("minimap.infoHighlight",{dark:Dm,light:Dm,hcDark:T7,hcLight:T7},d(2627,null)),z5i=te("minimap.warningHighlight",{dark:jh,light:jh,hcDark:E7,hcLight:E7},d(2633,null)),K5i=te("minimap.errorHighlight",{dark:new We(new zt(255,18,18,.7)),light:new We(new zt(255,18,18,.7)),hcDark:new We(new zt(255,50,50,1)),hcLight:"#B5200D"},d(2624,null)),G5i=te("minimap.background",null,d(2623,null)),q5i=te("minimap.foregroundOpacity",We.fromHex("#000f"),d(2626,null)),Bzn=te("minimapSlider.background",ai(k7,.5),d(2631,null)),Hzn=te("minimapSlider.hoverBackground",ai(z1,.5),d(2632,null)),Uzn=te("minimapSlider.activeBackground",ai(K1,.5),d(2630,null));var Oye=te("charts.foreground",To,d(2431,null)),Wvt=te("charts.lines",ai(To,.5),d(2433,null)),Uje=te("charts.red",Iv,d(2436,null)),zje=te("charts.blue",Dm,d(2430,null)),$5i=te("charts.yellow",jh,d(2437,null)),jzn=te("charts.orange",D7,d(2434,null)),cle=te("charts.green",{dark:"#89D185",light:"#388A34",hcDark:"#89D185",hcLight:"#374e06"},d(2432,null)),Vvt=te("charts.purple",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},d(2435,null));var R7=te("list.focusBackground",null,d(2600,null)),Fye=te("list.focusForeground",null,d(2601,null)),Kje=te("list.focusOutline",{dark:Sd,light:Sd,hcDark:Ys,hcLight:Ys},d(2603,null)),j5i=te("list.focusAndSelectionOutline",null,d(2599,null)),ow=te("list.activeSelectionBackground",{dark:"#04395E",light:"#0060C0",hcDark:null,hcLight:We.fromHex("#0F4A85").transparent(.1)},d(2586,null)),T_=te("list.activeSelectionForeground",{dark:We.white,light:We.white,hcDark:null,hcLight:null},d(2587,null)),Bvt=te("list.activeSelectionIconForeground",null,d(2588,null)),Kf=te("list.inactiveSelectionBackground",{dark:"#37373D",light:"#E4E6F1",hcDark:null,hcLight:We.fromHex("#0F4A85").transparent(.1)},d(2608,null)),Hvt=te("list.inactiveSelectionForeground",null,d(2609,null)),Q5i=te("list.inactiveSelectionIconForeground",null,d(2610,null)),Uvt=te("list.inactiveFocusBackground",null,d(2606,null)),Y5i=te("list.inactiveFocusOutline",null,d(2607,null)),yE=te("list.hoverBackground",{dark:"#2A2D2E",light:"#F0F0F0",hcDark:We.white.transparent(.1),hcLight:We.fromHex("#0F4A85").transparent(.1)},d(2604,null)),Wye=te("list.hoverForeground",null,d(2605,null)),zvt=te("list.dropBackground",{dark:"#062F4A",light:"#D6EBFF",hcDark:null,hcLight:null},d(2590,null)),X5i=te("list.dropBetweenBackground",{dark:cj,light:cj,hcDark:null,hcLight:null},d(2591,null)),L7=te("list.highlightForeground",{dark:"#2AAAFF",light:"#0066BF",hcDark:Sd,hcLight:Sd},d(2584,null)),J5i=te("list.focusHighlightForeground",{dark:L7,light:nle(ow,L7,"#BBE7FF"),hcDark:L7,hcLight:L7},d(2602,null)),Z5i=te("list.invalidItemForeground",{dark:"#B89500",light:"#B89500",hcDark:"#B89500",hcLight:"#B5200D"},d(2585,null)),Gx=te("list.errorForeground",{dark:"#F88070",light:"#B01011",hcDark:null,hcLight:null},d(2592,null)),q1=te("list.warningForeground",{dark:"#CCA700",light:"#855F00",hcDark:null,hcLight:null},d(2611,null)),e4i=te("listFilterWidget.background",{light:ep(Su,0),dark:cb(Su,0),hcDark:Su,hcLight:Su},d(2595,null)),t4i=te("listFilterWidget.outline",{dark:We.transparent,light:We.transparent,hcDark:"#f38518",hcLight:"#007ACC"},d(2597,null)),i4i=te("listFilterWidget.noMatchesOutline",{dark:"#BE1100",light:"#BE1100",hcDark:bi,hcLight:bi},d(2596,null)),o4i=te("listFilterWidget.shadow",kO,d(2598,null)),n4i=te("list.filterMatchBackground",{dark:rS,light:rS,hcDark:null,hcLight:null},d(2593,null)),r4i=te("list.filterMatchBorder",{dark:xO,light:xO,hcDark:bi,hcLight:Ys},d(2594,null)),Kvt=te("list.deemphasizedForeground",{dark:"#8C8C8C",light:"#8E8E90",hcDark:"#A7A8A9",hcLight:"#666666"},d(2589,null)),Vye=te("tree.indentGuidesStroke",{dark:"#585858",light:"#a9a9a9",hcDark:"#a9a9a9",hcLight:"#a5a5a5"},d(2615,null)),s4i=te("tree.inactiveIndentGuidesStroke",ai(Vye,.4),d(2614,null)),a4i=te("tree.tableColumnsBorder",{dark:"#CCCCCC20",light:"#61616120",hcDark:null,hcLight:null},d(2612,null)),Gje=te("tree.tableOddRowsBackground",{dark:ai(To,.04),light:ai(To,.04),hcDark:null,hcLight:null},d(2613,null)),eKn=te("editorActionList.background",Su,d(2580,null)),l4i=te("editorActionList.foreground",jL,d(2583,null)),tKn=te("editorActionList.focusForeground",T_,d(2582,null)),iKn=te("editorActionList.focusBackground",ow,d(2581,null));var yv=te("input.background",{dark:"#3C3C3C",light:We.white,hcDark:We.black,hcLight:We.white},d(2553,null)),QL=te("input.foreground",To,d(2555,null)),nw=te("input.border",{dark:null,light:null,hcDark:bi,hcLight:bi},d(2554,null)),MV=te("inputOption.activeBorder",{dark:"#007ACC",light:"#007ACC",hcDark:bi,hcLight:bi},d(2552,null)),_Wo=te("inputOption.hoverBackground",{dark:"#5a5d5e80",light:"#b8b8b850",hcDark:null,hcLight:null},d(2558,null)),PV=te("inputOption.activeBackground",{dark:ai(Sd,.4),light:ai(Sd,.2),hcDark:We.transparent,hcLight:We.transparent},d(2556,null)),dj=te("inputOption.activeForeground",{dark:We.white,light:We.black,hcDark:To,hcLight:To},d(2557,null)),Hye=te("input.placeholderForeground",{light:ai(To,.5),dark:ai(To,.5),hcDark:ai(To,.7),hcLight:ai(To,.7)},d(2559,null)),c4i=te("inputValidation.infoBackground",{dark:"#063B49",light:"#D6ECF2",hcDark:We.black,hcLight:We.white},d(2563,null)),d4i=te("inputValidation.infoForeground",{dark:null,light:null,hcDark:null,hcLight:To},d(2565,null)),qje=te("inputValidation.infoBorder",{dark:"#007acc",light:"#007acc",hcDark:bi,hcLight:bi},d(2564,null)),u4i=te("inputValidation.warningBackground",{dark:"#352A05",light:"#F6F5D2",hcDark:We.black,hcLight:We.white},d(2566,null)),p4i=te("inputValidation.warningForeground",{dark:null,light:null,hcDark:null,hcLight:To},d(2568,null)),$je=te("inputValidation.warningBorder",{dark:"#B89500",light:"#B89500",hcDark:bi,hcLight:bi},d(2567,null)),Gvt=te("inputValidation.errorBackground",{dark:"#5A1D1D",light:"#F2DEDE",hcDark:We.black,hcLight:We.white},d(2560,null)),qvt=te("inputValidation.errorForeground",{dark:null,light:null,hcDark:null,hcLight:To},d(2562,null)),dle=te("inputValidation.errorBorder",{dark:"#BE1100",light:"#BE1100",hcDark:bi,hcLight:bi},d(2561,null)),$1=te("dropdown.background",{dark:"#3C3C3C",light:We.white,hcDark:We.black,hcLight:We.white},d(2548,null)),m4i=te("dropdown.listBackground",{dark:null,light:null,hcDark:We.black,hcLight:We.white},d(2551,null)),ule=te("dropdown.foreground",{dark:"#F0F0F0",light:To,hcDark:We.white,hcLight:To},d(2550,null)),TO=te("dropdown.border",{dark:$1,light:"#CECECE",hcDark:bi,hcLight:bi},d(2549,null)),__=te("button.foreground",We.white,d(2534,null)),$vt=te("button.separator",ai(__,.4),d(2540,null)),xC=te("button.background",{dark:"#0E639C",light:"#007ACC",hcDark:We.black,hcLight:"#0F4A85"},d(2532,null)),uj=te("button.hoverBackground",{dark:cb(xC,.2),light:ep(xC,.2),hcDark:xC,hcLight:xC},d(2535,null)),Uye=te("button.border",bi,d(2533,null)),ple=te("button.secondaryForeground",{dark:To,light:To,hcDark:We.white,hcLight:To},d(2538,null)),pj=te("button.secondaryBackground",{dark:yE,light:yE,hcDark:null,hcLight:We.white},d(2536,null)),dKn=te("button.secondaryBorder",bi,d(2537,null)),mle=te("button.secondaryHoverBackground",{dark:cb(yE,.2),light:cb(yE,.2),hcDark:null,hcLight:null},d(2539,null)),Bye=te("radio.activeForeground",dj,d(2574,null)),h4i=te("radio.activeBackground",PV,d(2575,null)),g4i=te("radio.activeBorder",MV,d(2573,null)),f4i=te("radio.inactiveForeground",null,d(2579,null)),v4i=te("radio.inactiveBackground",null,d(2577,null)),b4i=te("radio.inactiveBorder",{light:ai(Bye,.2),dark:ai(Bye,.2),hcDark:ai(Bye,.4),hcLight:ai(Bye,.2)},d(2578,null)),S4i=te("radio.inactiveHoverBackground",_Wo,d(2576,null)),zye=te("checkbox.background",$1,d(2541,null)),uKn=te("checkbox.selectBackground",Su,d(2546,null)),Kye=te("checkbox.foreground",ule,d(2545,null)),jvt=te("checkbox.border",TO,d(2542,null)),pKn=te("checkbox.selectBorder",cj,d(2547,null)),I4i=te("checkbox.disabled.background",{op:7,color:zye,with:Kye,ratio:.33},d(2543,null)),y4i=te("checkbox.disabled.foreground",{op:7,color:Kye,with:zye,ratio:.33},d(2544,null)),w4i=te("keybindingLabel.background",{dark:new We(new zt(128,128,128,.17)),light:new We(new zt(221,221,221,.4)),hcDark:We.transparent,hcLight:We.transparent},d(2569,null)),C4i=te("keybindingLabel.foreground",{dark:We.fromHex("#CCCCCC"),light:We.fromHex("#555555"),hcDark:We.white,hcLight:To},d(2572,null)),x4i=te("keybindingLabel.border",{dark:new We(new zt(51,51,51,.6)),light:new We(new zt(204,204,204,.4)),hcDark:new We(new zt(111,195,223)),hcLight:bi},d(2570,null)),k4i=te("keybindingLabel.bottomBorder",{dark:new We(new zt(68,68,68,.6)),light:new We(new zt(187,187,187,.4)),hcDark:new We(new zt(111,195,223)),hcLight:To},d(2571,null));var E4i=te("menu.border",{dark:null,light:null,hcDark:bi,hcLight:bi},d(2617,null)),T4i=te("menu.foreground",ule,d(2618,null)),_4i=te("menu.background",$1,d(2616,null)),bKn=te("menu.selectionForeground",T_,d(2621,null)),SKn=te("menu.selectionBackground",ow,d(2619,null)),D4i=te("menu.selectionBorder",{dark:null,light:null,hcDark:Ys,hcLight:Ys},d(2620,null)),L4i=te("menu.separatorBackground",{dark:"#606060",light:"#D4D4D4",hcDark:bi,hcLight:bi},d(2622,null));var Gye=te("quickInput.background",Su,d(2650,null)),Qvt=te("quickInput.foreground",jL,d(2651,null)),M4i=te("quickInputTitle.background",{dark:new We(new zt(255,255,255,.105)),light:new We(new zt(0,0,0,.06)),hcDark:"#000000",hcLight:We.white},d(2654,null)),Yvt=te("pickerGroup.foreground",{dark:"#3794FF",light:"#0066BF",hcDark:We.white,hcLight:"#0F4A85"},d(2653,null)),P4i=te("pickerGroup.border",{dark:"#3F3F46",light:"#CCCEDB",hcDark:We.white,hcLight:"#0F4A85"},d(2652,null)),R4i=te("quickInput.list.focusBackground",null,"",void 0,d(2655,null)),j1=te("quickInputList.focusForeground",T_,d(2657,null)),qye=te("quickInputList.focusIconForeground",Bvt,d(2658,null)),Q1=te("quickInputList.focusBackground",{dark:ole(R4i,ow),light:ole(R4i,ow),hcDark:null,hcLight:null},d(2656,null));var DKn=te("search.resultsInfoForeground",{light:To,dark:ai(To,.65),hcDark:To,hcLight:To},d(2659,null)),LKn=te("searchEditor.findMatchBackground",{light:ai(rS,.66),dark:ai(rS,.66),hcDark:rS,hcLight:rS},d(2661,null)),RKn=te("searchEditor.findMatchBorder",{light:ai(xO,.66),dark:ai(xO,.66),hcDark:xO,hcLight:xO},d(2660,null));var mj=class{constructor(i,e){this.x=i;this.y=e;this._pageCoordinatesBrand=void 0}toClientCoordinates(i){return new jje(this.x-i.scrollX,this.y-i.scrollY)}},jje=class{constructor(i,e){this.clientX=i;this.clientY=e;this._clientCoordinatesBrand=void 0}toPageCoordinates(i){return new mj(this.clientX+i.scrollX,this.clientY+i.scrollY)}},Lti=class{constructor(i,e,t,o){this.x=i;this.y=e;this.width=t;this.height=o;this._editorPagePositionBrand=void 0}},Rti=class{constructor(i,e){this.x=i;this.y=e;this._positionRelativeToEditorBrand=void 0}};function $ye(a){let i=ir(a);return new Lti(i.left,i.top,i.width,i.height)}function jye(a,i,e){let t=i.width/a.offsetWidth,o=i.height/a.offsetHeight,n=(e.x-i.x)/t,r=(e.y-i.y)/o;return new Rti(n,r)}var YL=class extends Cn{constructor(e,t,o){super(Re(o),e);this._editorMouseEventBrand=void 0;this.isFromPointerCapture=t,this.pos=new mj(this.posx,this.posy),this.editorPos=$ye(o),this.relativePos=jye(o,this.editorPos,this.pos)}},Xvt=class{constructor(i){this._editorViewDomNode=i}_create(i){return new YL(i,!1,this._editorViewDomNode)}onContextMenu(i,e){return j(i,re.CONTEXT_MENU,t=>{e(this._create(t))})}onMouseUp(i,e){return j(i,re.MOUSE_UP,t=>{e(this._create(t))})}onMouseDown(i,e){return j(i,re.MOUSE_DOWN,t=>{e(this._create(t))})}onPointerDown(i,e){return j(i,re.POINTER_DOWN,t=>{e(this._create(t),t.pointerId)})}onMouseLeave(i,e){return j(i,re.MOUSE_LEAVE,t=>{e(this._create(t))})}onMouseMove(i,e){return j(i,re.MOUSE_MOVE,t=>e(this._create(t)))}},Jvt=class{constructor(i){this._editorViewDomNode=i}_create(i){return new YL(i,!1,this._editorViewDomNode)}onPointerUp(i,e){return j(i,"pointerup",t=>{e(this._create(t))})}onPointerDown(i,e){return j(i,re.POINTER_DOWN,t=>{e(this._create(t),t.pointerId)})}onPointerLeave(i,e){return j(i,re.POINTER_LEAVE,t=>{e(this._create(t))})}onPointerMove(i,e){return j(i,"pointermove",t=>e(this._create(t)))}},Zvt=class extends x{constructor(i){super(),this._editorViewDomNode=i,this._globalPointerMoveMonitor=this._register(new $L),this._keydownListener=null}startMonitoring(i,e,t,o,n){this._keydownListener=Jo(i.ownerDocument,"keydown",r=>{r.toKeyCodeChord().isModifierKey()||this._globalPointerMoveMonitor.stopMonitoring(!0,r.browserEvent)},!0),this._globalPointerMoveMonitor.startMonitoring(i,e,t,r=>{o(new YL(r,!0,this._editorViewDomNode))},r=>{this._keydownListener.dispose(),n(r)})}stopMonitoring(){this._globalPointerMoveMonitor.stopMonitoring(!0)}},M7=class a{constructor(i){this._editor=i;this._instanceId=++a._idPool;this._counter=0;this._rules=new Vt;this._garbageCollectionScheduler=new Dt(()=>this.garbageCollect(),1e3)}static{this._idPool=0}dispose(){this._rules.dispose(),this._garbageCollectionScheduler.dispose()}createClassNameRef(i){let e=this.getOrCreateRule(i);return e.increaseRefCount(),{className:e.className,dispose:()=>{e.decreaseRefCount(),this._garbageCollectionScheduler.schedule()}}}getOrCreateRule(i){let e=this.computeUniqueKey(i),t=this._rules.get(e);if(!t){let o=this._counter++;t=new Mti(e,`dyn-rule-${this._instanceId}-${o}`,$$(this._editor.getContainerDomNode())?this._editor.getContainerDomNode():void 0,i),this._rules.set(e,t)}return t}computeUniqueKey(i){return JSON.stringify(i)}garbageCollect(){for(let i of this._rules.values())i.hasReferences()||this._rules.deleteAndDispose(i.key)}},Mti=class{constructor(i,e,t,o){this.key=i;this.className=e;this.properties=o;this._referenceCount=0;this._styleElementDisposables=new N,this._styleElement=Cr(t,void 0,this._styleElementDisposables),this._styleElement.textContent=this.getCssText(this.className,this.properties)}getCssText(i,e){let t=`.${i} {`;for(let o in e){let n=e[o],r;typeof n=="object"?r=kt(n.id):r=n;let s=DWo(o);t+=`
	${s}: ${r};`}return t+=`
}`,t}dispose(){this._styleElementDisposables.dispose(),this._styleElement=void 0}increaseRefCount(){this._referenceCount++}decreaseRefCount(){this._referenceCount--}hasReferences(){return this._referenceCount>0}};function DWo(a){return a.replace(/(^[A-Z])/,([i])=>i.toLowerCase()).replace(/([A-Z])/g,([i])=>`-${i.toLowerCase()}`)}var wE=class extends x{constructor(){super(),this._shouldRender=!0}shouldRender(){return this._shouldRender}forceShouldRender(){this._shouldRender=!0}setShouldRender(){this._shouldRender=!0}onDidRender(){this._shouldRender=!1}onCompositionStart(i){return!1}onCompositionEnd(i){return!1}onConfigurationChanged(i){return!1}onCursorStateChanged(i){return!1}onDecorationsChanged(i){return!1}onFlushed(i){return!1}onFocusChanged(i){return!1}onLanguageConfigurationChanged(i){return!1}onLineMappingChanged(i){return!1}onLinesChanged(i){return!1}onLinesDeleted(i){return!1}onLinesInserted(i){return!1}onRevealRangeRequest(i){return!1}onScrollChanged(i){return!1}onThemeChanged(i){return!1}onTokensChanged(i){return!1}onTokensColorsChanged(i){return!1}onZonesChanged(i){return!1}handleEvents(i){let e=!1;for(let t=0,o=i.length;t<o;t++){let n=i[t];switch(n.type){case 0:this.onCompositionStart(n)&&(e=!0);break;case 1:this.onCompositionEnd(n)&&(e=!0);break;case 2:this.onConfigurationChanged(n)&&(e=!0);break;case 3:this.onCursorStateChanged(n)&&(e=!0);break;case 4:this.onDecorationsChanged(n)&&(e=!0);break;case 5:this.onFlushed(n)&&(e=!0);break;case 6:this.onFocusChanged(n)&&(e=!0);break;case 7:this.onLanguageConfigurationChanged(n)&&(e=!0);break;case 8:this.onLineMappingChanged(n)&&(e=!0);break;case 9:this.onLinesChanged(n)&&(e=!0);break;case 10:this.onLinesDeleted(n)&&(e=!0);break;case 11:this.onLinesInserted(n)&&(e=!0);break;case 12:this.onRevealRangeRequest(n)&&(e=!0);break;case 13:this.onScrollChanged(n)&&(e=!0);break;case 15:this.onTokensChanged(n)&&(e=!0);break;case 14:this.onThemeChanged(n)&&(e=!0);break;case 16:this.onTokensColorsChanged(n)&&(e=!0);break;case 17:this.onZonesChanged(n)&&(e=!0);break;default:console.info("View received unknown event: "),console.info(n)}}e&&(this._shouldRender=!0)}};var Pu=class extends wE{constructor(i){super(),this._context=i,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),super.dispose()}onBeforeRender(i){}};var YS=class{static write(i,e){i.setAttribute("data-mprt",String(e))}static read(i){let e=i.getAttribute("data-mprt");return e===null?0:parseInt(e,10)}static collect(i,e){let t=[],o=0;for(;i&&i!==i.ownerDocument.body&&i!==e;)i.nodeType===i.ELEMENT_NODE&&(t[o++]=this.read(i)),i=i.parentElement;let n=new Uint8Array(o);for(let r=0;r<o;r++)n[r]=t[o-r-1];return n}};var Pti=class{constructor(i,e){this._restrictedRenderingContextBrand=void 0;this._viewLayout=i,this.viewportData=e,this.scrollWidth=this._viewLayout.getScrollWidth(),this.scrollHeight=this._viewLayout.getScrollHeight(),this.visibleRange=this.viewportData.visibleRange,this.bigNumbersDelta=this.viewportData.bigNumbersDelta;let t=this._viewLayout.getCurrentViewport();this.scrollTop=t.top,this.scrollLeft=t.left,this.viewportWidth=t.width,this.viewportHeight=t.height}getScrolledTopFromAbsoluteTop(i){return i-this.scrollTop}getVerticalOffsetForLineNumber(i,e){return this._viewLayout.getVerticalOffsetForLineNumber(i,e)}getVerticalOffsetAfterLineNumber(i,e){return this._viewLayout.getVerticalOffsetAfterLineNumber(i,e)}getLineHeightForLineNumber(i){return this._viewLayout.getLineHeightForLineNumber(i)}getDecorationsInViewport(){return this.viewportData.getDecorationsInViewport()}},ebt=class extends Pti{constructor(e,t,o,n){super(e,t);this._renderingContextBrand=void 0;this._viewLines=o,this._viewLinesGpu=n}linesVisibleRangesForRange(e,t){let o=this._viewLines.linesVisibleRangesForRange(e,t);if(!this._viewLinesGpu)return o;let n=this._viewLinesGpu.linesVisibleRangesForRange(e,t);return o?n?o.concat(n).sort((r,s)=>r.lineNumber-s.lineNumber):o:n}visibleRangeForPosition(e){return this._viewLines.visibleRangeForPosition(e)??this._viewLinesGpu?.visibleRangeForPosition(e)??null}},Qye=class{constructor(i,e,t,o){this.outsideRenderedLine=i;this.lineNumber=e;this.ranges=t;this.continuesOnNextLine=o}static firstLine(i){if(!i)return null;let e=null;for(let t of i)(!e||t.lineNumber<e.lineNumber)&&(e=t);return e}static lastLine(i){if(!i)return null;let e=null;for(let t of i)(!e||t.lineNumber>e.lineNumber)&&(e=t);return e}},P7=class a{constructor(i,e){this._horizontalRangeBrand=void 0;this.left=Math.round(i),this.width=Math.round(e)}static from(i){let e=new Array(i.length);for(let t=0,o=i.length;t<o;t++){let n=i[t];e[t]=new a(n.left,n.width)}return e}toString(){return`[${this.left},${this.width}]`}},TP=class{constructor(i,e){this._floatHorizontalRangeBrand=void 0;this.left=i,this.width=e}toString(){return`[${this.left},${this.width}]`}static compare(i,e){return i.left-e.left}},Yye=class{constructor(i,e){this.outsideRenderedLine=i,this.originalLeft=e,this.left=Math.round(this.originalLeft)}},hle=class{constructor(i,e){this.outsideRenderedLine=i;this.ranges=e}};var gle=class{static _createRange(){return this._handyReadyRange||(this._handyReadyRange=document.createRange()),this._handyReadyRange}static _detachRange(i,e){i.selectNodeContents(e)}static _readClientRects(i,e,t,o,n){let r=this._createRange();try{return r.setStart(i,e),r.setEnd(t,o),r.getClientRects()}catch{return null}finally{this._detachRange(r,n)}}static _mergeAdjacentRanges(i){if(i.length===1)return i;i.sort(TP.compare);let e=[],t=0,o=i[0];for(let n=1,r=i.length;n<r;n++){let s=i[n];o.left+o.width+.9>=s.left?o.width=Math.max(o.width,s.left+s.width-o.left):(e[t++]=o,o=s)}return e[t++]=o,e}static _createHorizontalRangesFromClientRects(i,e,t){if(!i||i.length===0)return null;let o=[];for(let n=0,r=i.length;n<r;n++){let s=i[n];o[n]=new TP(Math.max(0,(s.left-e)/t),s.width/t)}return this._mergeAdjacentRanges(o)}static readHorizontalRanges(i,e,t,o,n,r){let l=i.children.length-1;if(0>l)return null;if(e=Math.min(l,Math.max(0,e)),o=Math.min(l,Math.max(0,o)),e===o&&t===n&&t===0&&!i.children[e].firstChild){let h=i.children[e].getClientRects();return r.markDidDomLayout(),this._createHorizontalRangesFromClientRects(h,r.clientRectDeltaLeft,r.clientRectScale)}e!==o&&o>0&&n===0&&(o--,n=1073741824);let c=i.children[e].firstChild,u=i.children[o].firstChild;if((!c||!u)&&(!c&&t===0&&e>0&&(c=i.children[e-1].firstChild,t=1073741824),!u&&n===0&&o>0&&(u=i.children[o-1].firstChild,n=1073741824)),!c||!u)return null;t=Math.min(c.textContent.length,Math.max(0,t)),n=Math.min(u.textContent.length,Math.max(0,n));let p=this._readClientRects(c,t,u,n,r.endNode);return r.markDidDomLayout(),this._createHorizontalRangesFromClientRects(p,r.clientRectDeltaLeft,r.clientRectScale)}};var Xye=class{constructor(i,e){this._viewModelDecorationBrand=void 0;this.range=i,this.options=e}};function Qje(a,i){return!(i.options.hideInCommentTokens&&tbt(a,i)||i.options.hideInStringTokens&&ibt(a,i))}function tbt(a,i){return A4i(a,i.range,e=>e===1)}function ibt(a,i){return A4i(a,i.range,e=>e===2)}function A4i(a,i,e){for(let t=i.startLineNumber;t<=i.endLineNumber;t++){let o=a.tokenization.getLineTokens(t),n=t===i.startLineNumber,r=t===i.endLineNumber,s=n?o.findTokenIndexAtOffset(i.startColumn-1):0;for(;s<o.getCount()&&!(r&&o.getStartOffset(s)>i.endColumn-1);){if(!e(o.getStandardTokenType(s)))return!1;s++}}return!0}var CE=class{constructor(i,e,t){this.range=i;this.inlineClassName=e;this.type=t}},obt=class{constructor(i,e,t){this.context=i;this.model=e;this.coordinatesConverter=t;this._decorationsCache=Object.create(null)}getInlineDecorations(i){let e=new z(i,1,i,this.model.getLineMaxColumn(i)),t=this.coordinatesConverter.convertModelRangeToViewRange(e);return this.getDecorations(t,!1,!1).inlineDecorations}getDecorations(i,e,t){let o=this.context.getModelDecorations(i,e,t),n=i.startLineNumber,r=i.endLineNumber,s=[],l=0,c=[],u=[];for(let p=n;p<=r;p++)c[p-n]=[],u[p-n]=!1;for(let p=0,h=o.length;p<h;p++){let g=o[p],f=g.options;if(!Qje(this.model,g))continue;let v=this._getOrCreateViewModelDecoration(g),b=v.range;if(s[l++]=v,f.inlineClassName){let S=new CE(b,f.inlineClassName,f.inlineClassNameAffectsLetterSpacing?3:0),y=Math.max(n,b.startLineNumber),w=Math.min(r,b.endLineNumber);for(let k=y;k<=w;k++)c[k-n].push(S),f.affectsFont&&(u[k-n]=!0)}if(f.beforeContentClassName&&n<=b.startLineNumber&&b.startLineNumber<=r){let S=new CE(new z(b.startLineNumber,b.startColumn,b.startLineNumber,b.startColumn),f.beforeContentClassName,1);c[b.startLineNumber-n].push(S),f.affectsFont&&(u[b.startLineNumber-n]=!0)}if(f.afterContentClassName&&n<=b.endLineNumber&&b.endLineNumber<=r){let S=new CE(new z(b.endLineNumber,b.endColumn,b.endLineNumber,b.endColumn),f.afterContentClassName,2);c[b.endLineNumber-n].push(S),f.affectsFont&&(u[b.endLineNumber-n]=!0)}}return{decorations:s,inlineDecorations:c,hasVariableFonts:u}}reset(){this._decorationsCache=Object.create(null)}onModelDecorationsChanged(){this.reset()}onLineMappingChanged(){this.reset()}_getOrCreateViewModelDecoration(i){let e=i.id,t=this._decorationsCache[e];if(!t){let o=i.range,n=i.options,r;if(n.isWholeLine){let s=this.coordinatesConverter.convertModelPositionToViewPosition(new ye(o.startLineNumber,1),0,!1,!0),l=this.coordinatesConverter.convertModelPositionToViewPosition(new ye(o.endLineNumber,this.model.getLineMaxColumn(o.endLineNumber)),1);r=new z(s.lineNumber,s.column,l.lineNumber,l.column)}else r=this.coordinatesConverter.convertModelRangeToViewRange(o,1);t=new Xye(r,n),this._decorationsCache[e]=t}return t}},nbt=class{constructor(i){this.context=i}getInlineDecorations(i){let e=this.context.getInjectionOffsets(i);if(!e)return[];let t=[],o=0,n=0,r=this.context.getInjectionOptions(i),s=this.context.getBreakOffsets(i);for(let l=0;l<s.length;l++){let c=new Array;t[l]=c;let u=l>0?s[l-1]:0,p=s[l];for(;n<e.length;){let h=r[n].content.length,g=e[n]+o,f=g+h;if(g>p)break;if(u<f){let v=r[n];if(v.inlineClassName){let b=this.context.getWrappedTextIndentLength(i),S=l>0?b:0,y=S+Math.max(g-u,0),w=S+Math.min(f-u,p-u);if(y!==w){let k=this.context.getBaseViewLineNumber(i)+l,T=new z(k,y+1,k,w+1),P=v.inlineClassNameAffectsLetterSpacing?3:0;c.push(new CE(T,v.inlineClassName,P))}}}if(f<=p)o+=h,n++;else break}}return t}};var _g=class{constructor(i,e,t,o){this.endIndex=i;this.type=e;this.metadata=t;this.containsRTL=o;this._linePartBrand=void 0}isWhitespace(){return!!(this.metadata&1)}isPseudoAfter(){return!!(this.metadata&4)}};var db=class a{constructor(i,e,t,o){this.startColumn=i;this.endColumn=e;this.className=t;this.type=o;this._lineDecorationBrand=void 0}static _equals(i,e){return i.startColumn===e.startColumn&&i.endColumn===e.endColumn&&i.className===e.className&&i.type===e.type}static equalsArr(i,e){let t=i.length,o=e.length;if(t!==o)return!1;for(let n=0;n<t;n++)if(!a._equals(i[n],e[n]))return!1;return!0}static extractWrapped(i,e,t){if(i.length===0)return i;let o=e+1,n=t+1,r=t-e,s=[],l=0;for(let c of i)c.endColumn<=o||c.startColumn>=n||(s[l++]=new a(Math.max(1,c.startColumn-o+1),Math.min(r+1,c.endColumn-o+1),c.className,c.type));return s}static filter(i,e,t,o){if(i.length===0)return[];let n=[],r=0;for(let s=0,l=i.length;s<l;s++){let c=i[s],u=c.range;if(u.endLineNumber<e||u.startLineNumber>e||u.isEmpty()&&(c.type===0||c.type===3))continue;let p=u.startLineNumber===e?u.startColumn:t,h=u.endLineNumber===e?u.endColumn:o;n[r++]=new a(p,h,c.inlineClassName,c.type)}return n}static _typeCompare(i,e){let t=[2,0,1,3];return t[i]-t[e]}static compare(i,e){if(i.startColumn!==e.startColumn)return i.startColumn-e.startColumn;if(i.endColumn!==e.endColumn)return i.endColumn-e.endColumn;let t=a._typeCompare(i.type,e.type);return t!==0?t:i.className!==e.className?i.className<e.className?-1:1:0}},rbt=class{constructor(i,e,t,o){this.startOffset=i,this.endOffset=e,this.className=t,this.metadata=o}},Ati=class a{constructor(){this.stopOffsets=[],this.classNames=[],this.metadata=[],this.count=0}static _metadata(i){let e=0;for(let t=0,o=i.length;t<o;t++)e|=i[t];return e}consumeLowerThan(i,e,t){for(;this.count>0&&this.stopOffsets[0]<i;){let o=0;for(;o+1<this.count&&this.stopOffsets[o]===this.stopOffsets[o+1];)o++;t.push(new rbt(e,this.stopOffsets[o],this.classNames.join(" "),a._metadata(this.metadata))),e=this.stopOffsets[o]+1,this.stopOffsets.splice(0,o+1),this.classNames.splice(0,o+1),this.metadata.splice(0,o+1),this.count-=o+1}return this.count>0&&e<i&&(t.push(new rbt(e,i-1,this.classNames.join(" "),a._metadata(this.metadata))),e=i),e}insert(i,e,t){if(this.count===0||this.stopOffsets[this.count-1]<=i)this.stopOffsets.push(i),this.classNames.push(e),this.metadata.push(t);else for(let o=0;o<this.count;o++)if(this.stopOffsets[o]>=i){this.stopOffsets.splice(o,0,i),this.classNames.splice(o,0,e),this.metadata.splice(o,0,t);break}this.count++}},sbt=class{static normalize(i,e){if(e.length===0)return[];let t=[],o=new Ati,n=0;for(let r=0,s=e.length;r<s;r++){let l=e[r],c=l.startColumn,u=l.endColumn,p=l.className,h=l.type===1?2:l.type===2?4:0;if(c>1){let v=i.charCodeAt(c-2);ju(v)&&c--}if(u>1){let v=i.charCodeAt(u-2);ju(v)&&u--}let g=c-1,f=u-2;n=o.consumeLowerThan(g,n,t),o.count===0&&(n=g),o.insert(f,p,h)}return o.consumeLowerThan(1073741824,n,t),t}};var XL=class{get isLTR(){return!this.containsRTL&&this.textDirection!==1}constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,P=!1){this.useMonospaceOptimizations=i,this.canUseHalfwidthRightwardsArrow=e,this.lineContent=t,this.continuesWithWrappedLine=o,this.isBasicASCII=n,this.containsRTL=r,this.fauxIndentLength=s,this.lineTokens=l,this.lineDecorations=c.sort(db.compare),this.tabSize=u,this.startVisibleColumn=p,this.spaceWidth=h,this.stopRenderingLineAfter=v,this.renderWhitespace=b==="all"?4:b==="boundary"?1:b==="selection"?2:b==="trailing"?3:0,this.renderControlCharacters=S,this.fontLigatures=y,this.selectionsOnLine=w&&w.sort((H,G)=>H.start<G.start?-1:1),this.renderNewLineWhenEmpty=P,this.textDirection=k,this.verticalScrollbarSize=T;let O=Math.abs(f-h),V=Math.abs(g-h);O<V?(this.renderSpaceWidth=f,this.renderSpaceCharCode=11825):(this.renderSpaceWidth=g,this.renderSpaceCharCode=183)}sameSelection(i){if(this.selectionsOnLine===null)return i===null;if(i===null||i.length!==this.selectionsOnLine.length)return!1;for(let e=0;e<this.selectionsOnLine.length;e++)if(!this.selectionsOnLine[e].equals(i[e]))return!1;return!0}equals(i){return this.useMonospaceOptimizations===i.useMonospaceOptimizations&&this.canUseHalfwidthRightwardsArrow===i.canUseHalfwidthRightwardsArrow&&this.lineContent===i.lineContent&&this.continuesWithWrappedLine===i.continuesWithWrappedLine&&this.isBasicASCII===i.isBasicASCII&&this.containsRTL===i.containsRTL&&this.fauxIndentLength===i.fauxIndentLength&&this.tabSize===i.tabSize&&this.startVisibleColumn===i.startVisibleColumn&&this.spaceWidth===i.spaceWidth&&this.renderSpaceWidth===i.renderSpaceWidth&&this.renderSpaceCharCode===i.renderSpaceCharCode&&this.stopRenderingLineAfter===i.stopRenderingLineAfter&&this.renderWhitespace===i.renderWhitespace&&this.renderControlCharacters===i.renderControlCharacters&&this.fontLigatures===i.fontLigatures&&db.equalsArr(this.lineDecorations,i.lineDecorations)&&this.lineTokens.equals(i.lineTokens)&&this.sameSelection(i.selectionsOnLine)&&this.textDirection===i.textDirection&&this.verticalScrollbarSize===i.verticalScrollbarSize&&this.renderNewLineWhenEmpty===i.renderNewLineWhenEmpty}};var Yje=class{constructor(i,e){this.partIndex=i;this.charIndex=e}},Xje=class a{static getPartIndex(i){return(i&4294901760)>>>16}static getCharIndex(i){return(i&65535)>>>0}constructor(i,e){this.length=i,this._data=new Uint32Array(this.length),this._horizontalOffset=new Uint32Array(this.length)}setColumnInfo(i,e,t,o){let n=(e<<16|t<<0)>>>0;this._data[i-1]=n,this._horizontalOffset[i-1]=o}getHorizontalOffset(i){return this._horizontalOffset.length===0?0:this._horizontalOffset[i-1]}charOffsetToPartData(i){return this.length===0?0:i<0?this._data[0]:i>=this.length?this._data[this.length-1]:this._data[i]}getDomPosition(i){let e=this.charOffsetToPartData(i-1),t=a.getPartIndex(e),o=a.getCharIndex(e);return new Yje(t,o)}getColumn(i,e){return this.partDataToCharOffset(i.partIndex,e,i.charIndex)+1}partDataToCharOffset(i,e,t){if(this.length===0)return 0;let o=(i<<16|t<<0)>>>0,n=0,r=this.length-1;for(;n+1<r;){let v=n+r>>>1,b=this._data[v];if(b===o)return v;b>o?r=v:n=v}if(n===r)return n;let s=this._data[n],l=this._data[r];if(s===o)return n;if(l===o)return r;let c=a.getPartIndex(s),u=a.getCharIndex(s),p=a.getPartIndex(l),h;c!==p?h=e:h=a.getCharIndex(l);let g=t-u,f=h-t;return g<=f?n:r}inflate(){let i=[];for(let e=0;e<this.length;e++){let t=this._data[e],o=a.getPartIndex(t),n=a.getCharIndex(t),r=this._horizontalOffset[e];i.push([o,n,r])}return i}};var fle=class{constructor(i,e){this._renderLineOutputBrand=void 0;this.characterMapping=i,this.containsForeignElements=e}};function AV(a,i){if(a.lineContent.length===0){if(a.lineDecorations.length>0){i.appendString("<span>");let e=0,t=0,o=0;for(let r of a.lineDecorations)(r.type===1||r.type===2)&&(i.appendString('<span class="'),i.appendString(r.className),i.appendString('"></span>'),r.type===1&&(o|=1,e++),r.type===2&&(o|=2,t++));i.appendString("</span>");let n=new Xje(1,e+t);return n.setColumnInfo(1,e,0,0),new fle(n,o)}return a.renderNewLineWhenEmpty?i.appendString(`<span><span>
</span></span>`):i.appendString("<span><span></span></span>"),new fle(new Xje(0,0),0)}return VWo(MWo(a),i)}var Nti=class{constructor(i,e,t){this.characterMapping=i;this.html=e;this.containsForeignElements=t}};function N4i(a){let i=new $S(1e4),e=AV(a,i);return new Nti(e.characterMapping,i.build(),e.containsForeignElements)}var Oti=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v){this.fontIsMonospace=i;this.canUseHalfwidthRightwardsArrow=e;this.lineContent=t;this.len=o;this.isOverflowing=n;this.overflowingCharCount=r;this.parts=s;this.containsForeignElements=l;this.fauxIndentLength=c;this.tabSize=u;this.startVisibleColumn=p;this.spaceWidth=h;this.renderSpaceCharCode=g;this.renderWhitespace=f;this.renderControlCharacters=v}};function MWo(a){let i=a.lineContent,e,t,o;a.stopRenderingLineAfter!==-1&&a.stopRenderingLineAfter<i.length?(e=!0,t=i.length-a.stopRenderingLineAfter,o=a.stopRenderingLineAfter):(e=!1,t=0,o=i.length);let n=PWo(i,a.containsRTL,a.lineTokens,a.fauxIndentLength,o);a.renderControlCharacters&&!a.isBasicASCII&&(n=OWo(i,n)),(a.renderWhitespace===4||a.renderWhitespace===1||a.renderWhitespace===2&&a.selectionsOnLine||a.renderWhitespace===3&&!a.continuesWithWrappedLine)&&(n=FWo(a,i,o,n));let r=0;if(a.lineDecorations.length>0){for(let s=0,l=a.lineDecorations.length;s<l;s++){let c=a.lineDecorations[s];c.type===3||c.type===1?r|=1:c.type===2&&(r|=2)}n=WWo(i,o,n,a.lineDecorations)}return a.containsRTL?n=NWo(i,n):n=AWo(i,n,!a.isBasicASCII||a.fontLigatures),new Oti(a.useMonospaceOptimizations,a.canUseHalfwidthRightwardsArrow,i,o,e,t,n,r,a.fauxIndentLength,a.tabSize,a.startVisibleColumn,a.spaceWidth,a.renderSpaceCharCode,a.renderWhitespace,a.renderControlCharacters)}function PWo(a,i,e,t,o){let n=[],r=0;t>0&&(n[r++]=new _g(t,"",0,!1));let s=t;for(let l=0,c=e.getCount();l<c;l++){let u=e.getEndOffset(l);if(u<=t)continue;let p=e.getClassName(l);if(u>=o){let g=i?uP(a.substring(s,o)):!1;n[r++]=new _g(o,p,0,g);break}let h=i?uP(a.substring(s,u)):!1;n[r++]=new _g(u,p,0,h),s=u}return n}function AWo(a,i,e){let t=0,o=[],n=0;if(e)for(let r=0,s=i.length;r<s;r++){let l=i[r],c=l.endIndex;if(t+50<c){let u=l.type,p=l.metadata,h=l.containsRTL,g=-1,f=t;for(let v=t;v<c;v++)a.charCodeAt(v)===32&&(g=v),g!==-1&&v-f>=50&&(o[n++]=new _g(g+1,u,p,h),f=g+1,g=-1);f!==c&&(o[n++]=new _g(c,u,p,h))}else o[n++]=l;t=c}else for(let r=0,s=i.length;r<s;r++){let l=i[r],c=l.endIndex,u=c-t;if(u>50){let p=l.type,h=l.metadata,g=l.containsRTL,f=Math.ceil(u/50);for(let v=1;v<f;v++){let b=t+v*50;o[n++]=new _g(b,p,h,g)}o[n++]=new _g(c,p,h,g)}else o[n++]=l;t=c}return o}function NWo(a,i){if(i.length===0)return i;let e=i[0];if(!e.containsRTL)return i;let t=e.endIndex,o=0;for(let r=0;r<t;r++){let s=a.charCodeAt(r);if(s!==32&&s!==9){o=r;break}}if(o===0)return i;let n=[];n.push(new _g(o,e.type,e.metadata,!1)),n.push(new _g(t,e.type,e.metadata,e.containsRTL));for(let r=1;r<i.length;r++)n.push(i[r]);return n}function O4i(a){return a<32?a!==9:a===127||a>=8234&&a<=8238||a>=8294&&a<=8297||a>=8206&&a<=8207||a===1564}function OWo(a,i){let e=[],t=new _g(0,"",0,!1),o=0;for(let n of i){let r=n.endIndex;for(;o<r;o++){let s=a.charCodeAt(o);O4i(s)&&(o>t.endIndex&&(t=new _g(o,n.type,n.metadata,n.containsRTL),e.push(t)),t=new _g(o+1,"mtkcontrol",n.metadata,!1),e.push(t))}o>t.endIndex&&(t=new _g(r,n.type,n.metadata,n.containsRTL),e.push(t))}return e}function FWo(a,i,e,t){let o=a.continuesWithWrappedLine,n=a.fauxIndentLength,r=a.tabSize,s=a.startVisibleColumn,l=a.useMonospaceOptimizations,c=a.selectionsOnLine,u=a.renderWhitespace===1,p=a.renderWhitespace===3,h=a.renderSpaceWidth!==a.spaceWidth,g=[],f=0,v=0,b=t[v].type,S=t[v].containsRTL,y=t[v].endIndex,w=t.length,k=!1,T=nm(i),P;T===-1?(k=!0,T=e,P=e):P=hv(i);let O=!1,V=0,H=c&&c[V],G=s%r;for(let J=n;J<e;J++){let ae=i.charCodeAt(J);H&&H.endExclusive<=J&&(V++,H=c&&c[V]);let he;if(J<T||J>P)he=!0;else if(ae===9)he=!0;else if(ae===32)if(u)if(O)he=!0;else{let oe=J+1<e?i.charCodeAt(J+1):0;he=oe===32||oe===9}else he=!0;else he=!1;if(he&&c&&(he=!!H&&H.start<=J&&J<H.endExclusive),he&&p&&(he=k||J>P),he&&S&&J>=T&&J<=P&&(he=!1),O){if(!he||!l&&G>=r){if(h){let oe=f>0?g[f-1].endIndex:n;for(let de=oe+1;de<=J;de++)g[f++]=new _g(de,"mtkw",1,!1)}else g[f++]=new _g(J,"mtkw",1,!1);G=G%r}}else(J===y||he&&J>n)&&(g[f++]=new _g(J,b,0,S),G=G%r);for(ae===9?G=r:h_(ae)?G+=2:G++,O=he;J===y&&(v++,v<w);)b=t[v].type,S=t[v].containsRTL,y=t[v].endIndex}let $=!1;if(O)if(o&&u){let J=e>0?i.charCodeAt(e-1):0,ae=e>1?i.charCodeAt(e-2):0;J===32&&ae!==32&&ae!==9||($=!0)}else $=!0;if($)if(h){let J=f>0?g[f-1].endIndex:n;for(let ae=J+1;ae<=e;ae++)g[f++]=new _g(ae,"mtkw",1,!1)}else g[f++]=new _g(e,"mtkw",1,!1);else g[f++]=new _g(e,b,0,S);return g}function WWo(a,i,e,t){t.sort(db.compare);let o=sbt.normalize(a,t),n=o.length,r=0,s=[],l=0,c=0;for(let p=0,h=e.length;p<h;p++){let g=e[p],f=g.endIndex,v=g.type,b=g.metadata,S=g.containsRTL;for(;r<n&&o[r].startOffset<f;){let y=o[r];if(y.startOffset>c&&(c=y.startOffset,s[l++]=new _g(c,v,b,S)),y.endOffset+1<=f)c=y.endOffset+1,s[l++]=new _g(c,v+" "+y.className,b|y.metadata,S),r++;else{c=f,s[l++]=new _g(c,v+" "+y.className,b|y.metadata,S);break}}f>c&&(c=f,s[l++]=new _g(c,v,b,S))}let u=e[e.length-1].endIndex;if(r<n&&o[r].startOffset===u)for(;r<n&&o[r].startOffset===u;){let p=o[r];s[l++]=new _g(c,p.className,p.metadata,!1),r++}return s}function VWo(a,i){let e=a.fontIsMonospace,t=a.canUseHalfwidthRightwardsArrow,o=a.containsForeignElements,n=a.lineContent,r=a.len,s=a.isOverflowing,l=a.overflowingCharCount,c=a.parts,u=a.fauxIndentLength,p=a.tabSize,h=a.startVisibleColumn,g=a.spaceWidth,f=a.renderSpaceCharCode,v=a.renderWhitespace,b=a.renderControlCharacters,S=new Xje(r+1,c.length),y=!1,w=0,k=h,T=0,P=0,O=0;i.appendString("<span>");for(let V=0,H=c.length;V<H;V++){let G=c[V],$=G.endIndex,J=G.type,ae=G.containsRTL,he=v!==0&&G.isWhitespace(),oe=he&&!e&&(J==="mtkw"||!o),de=w===$&&G.isPseudoAfter();if(T=0,i.appendString("<span "),ae&&i.appendString('style="unicode-bidi:isolate" '),i.appendString('class="'),i.appendString(oe?"mtkz":J),i.appendASCIICharCode(34),he){let Ce=0;{let xe=w,ze=k;for(;xe<$;xe++){let Oe=(n.charCodeAt(xe)===9?p-ze%p:1)|0;Ce+=Oe,xe>=u&&(ze+=Oe)}}for(oe&&(i.appendString(' style="width:'),i.appendString(String(g*Ce)),i.appendString('px"')),i.appendASCIICharCode(62);w<$;w++){S.setColumnInfo(w+1,V-O,T,P),O=0;let xe=n.charCodeAt(w),ze,De;if(xe===9){ze=p-k%p|0,De=ze,!t||De>1?i.appendCharCode(8594):i.appendCharCode(65515);for(let Oe=2;Oe<=De;Oe++)i.appendCharCode(160)}else ze=2,De=1,i.appendCharCode(f),i.appendCharCode(8204);T+=ze,P+=De,w>=u&&(k+=De)}}else for(i.appendASCIICharCode(62);w<$;w++){S.setColumnInfo(w+1,V-O,T,P),O=0;let Ce=n.charCodeAt(w),xe=1,ze=1;switch(Ce){case 9:xe=p-k%p,ze=xe;for(let De=1;De<=xe;De++)i.appendCharCode(160);break;case 32:i.appendCharCode(160);break;case 60:i.appendString("&lt;");break;case 62:i.appendString("&gt;");break;case 38:i.appendString("&amp;");break;case 0:b?i.appendCharCode(9216):i.appendString("&#00;");break;case 65279:case 8232:case 8233:case 133:i.appendCharCode(65533);break;default:h_(Ce)&&ze++,b&&Ce<32?i.appendCharCode(9216+Ce):b&&Ce===127?i.appendCharCode(9249):b&&O4i(Ce)?(i.appendString("[U+"),i.appendString(BWo(Ce)),i.appendString("]"),xe=8,ze=xe):i.appendCharCode(Ce)}T+=xe,P+=ze,w>=u&&(k+=ze)}de?O++:O=0,w>=r&&!y&&G.isPseudoAfter()&&(y=!0,S.setColumnInfo(w+1,V,T,P)),i.appendString("</span>")}return y||S.setColumnInfo(r+1,c.length-1,T,P),s&&(i.appendString('<span class="mtkoverflow">'),i.appendString(d(961,null,HWo(l))),i.appendString("</span>")),i.appendString("</span>"),new fle(S,o)}function BWo(a){return a.toString(16).toUpperCase().padStart(4,"0")}function HWo(a){return a<1024?d(960,null,a):a<1024*1024?`${(a/1024).toFixed(1)} KB`:`${(a/1024/1024).toFixed(1)} MB`}function uf(a){return a==="hcDark"||a==="hcLight"}function Bp(a){return a==="dark"||a==="hcDark"}var UWo=(function(){return Vr?!0:!(fn||Ac||Jb)})(),Zye=!0,NV=class a{constructor(i,e){this._viewGpuContext=i;this._options=e,this._isMaybeInvalid=!0,this._renderedViewLine=null}static{this.CLASS_NAME="view-line"}getDomNode(){return this._renderedViewLine&&this._renderedViewLine.domNode?this._renderedViewLine.domNode.domNode:null}setDomNode(i){if(this._renderedViewLine)this._renderedViewLine.domNode=ur(i);else throw new Error("I have no rendered view line to set the dom node to...")}onContentChanged(){this._isMaybeInvalid=!0}onTokensChanged(){this._isMaybeInvalid=!0}onDecorationsChanged(){this._isMaybeInvalid=!0}onOptionsChanged(i){this._isMaybeInvalid=!0,this._options=i}onSelectionChanged(){return uf(this._options.themeType)||this._renderedViewLine?.input.renderWhitespace===2?(this._isMaybeInvalid=!0,!0):!1}renderLine(i,e,t,o,n){if(this._options.useGpu&&this._viewGpuContext?.canRender(this._options,o,i))return this._renderedViewLine?.domNode?.domNode.remove(),this._renderedViewLine=null,!1;if(this._isMaybeInvalid===!1)return!1;this._isMaybeInvalid=!1;let r=o.getViewLineRenderingData(i),s=this._options,l=db.filter(r.inlineDecorations,i,r.minColumn,r.maxColumn),c=s.experimentalWhitespaceRendering==="off"?s.renderWhitespace:"none",u=!r.hasVariableFonts,p=null;if(uf(s.themeType)||c==="selection"){let v=o.selections;for(let b of v){if(b.endLineNumber<i||b.startLineNumber>i)continue;let S=b.startLineNumber===i?b.startColumn:r.minColumn,y=b.endLineNumber===i?b.endColumn:r.maxColumn;S<y&&(uf(s.themeType)&&l.push(new db(S,y,"inline-selected-text",0)),c==="selection"&&(p||(p=[]),p.push(new pi(S-1,y-1))))}}let h=new XL(s.useMonospaceOptimizations,s.canUseHalfwidthRightwardsArrow,r.content,r.continuesWithWrappedLine,r.isBasicASCII,r.containsRTL,r.minColumn-1,r.tokens,l,r.tabSize,r.startVisibleColumn,s.spaceWidth,s.middotWidth,s.wsmiddotWidth,s.stopRenderingLineAfter,c,s.renderControlCharacters,s.fontLigatures!==Bx.OFF,p,r.textDirection,s.verticalScrollbarSize);if(this._renderedViewLine&&this._renderedViewLine.input.equals(h))return!1;n.appendString("<div "),r.textDirection===1?n.appendString('dir="rtl" '):r.containsRTL&&n.appendString('dir="ltr" '),n.appendString('style="top:'),n.appendString(String(e)),n.appendString("px;height:"),n.appendString(String(t)),n.appendString("px;line-height:"),n.appendString(String(t)),r.textDirection===1&&(n.appendString("px;padding-right:"),n.appendString(String(s.verticalScrollbarSize))),n.appendString('px;" class="'),n.appendString(a.CLASS_NAME),n.appendString('">');let g=AV(h,n);n.appendString("</div>");let f=null;return u&&Zye&&UWo&&r.isBasicASCII&&h.isLTR&&s.useMonospaceOptimizations&&g.containsForeignElements===0&&(f=new Jye(this._renderedViewLine?this._renderedViewLine.domNode:null,h,g.characterMapping)),f||(f=F4i(this._renderedViewLine?this._renderedViewLine.domNode:null,h,g.characterMapping,g.containsForeignElements)),this._renderedViewLine=f,!0}layoutLine(i,e,t){this._renderedViewLine&&this._renderedViewLine.domNode&&(this._renderedViewLine.domNode.setTop(e),this._renderedViewLine.domNode.setHeight(t),this._renderedViewLine.domNode.setLineHeight(t))}isRenderedRTL(){return this._renderedViewLine?this._renderedViewLine.input.textDirection===1:!1}getWidth(i){return this._renderedViewLine?this._renderedViewLine.getWidth(i):0}getWidthIsFast(){return this._renderedViewLine?this._renderedViewLine.getWidthIsFast():!0}needsMonospaceFontCheck(){return this._renderedViewLine?this._renderedViewLine instanceof Jye:!1}monospaceAssumptionsAreValid(){return this._renderedViewLine&&this._renderedViewLine instanceof Jye?this._renderedViewLine.monospaceAssumptionsAreValid():Zye}onMonospaceAssumptionsInvalidated(){this._renderedViewLine&&this._renderedViewLine instanceof Jye&&(this._renderedViewLine=this._renderedViewLine.toSlowRenderedLine())}getVisibleRangesForRange(i,e,t,o){if(!this._renderedViewLine)return null;e=Math.min(this._renderedViewLine.input.lineContent.length+1,Math.max(1,e)),t=Math.min(this._renderedViewLine.input.lineContent.length+1,Math.max(1,t));let n=this._renderedViewLine.input.stopRenderingLineAfter;if(n!==-1&&e>n+1&&t>n+1)return new hle(!0,[new TP(this.getWidth(o),0)]);n!==-1&&e>n+1&&(e=n+1),n!==-1&&t>n+1&&(t=n+1);let r=this._renderedViewLine.getVisibleRangesForRange(i,e,t,o);return r&&r.length>0?new hle(!1,r):null}getColumnOfNodeOffset(i,e){return this._renderedViewLine?this._renderedViewLine.getColumnOfNodeOffset(i,e):1}resetCachedWidth(){this._renderedViewLine?.resetCachedWidth()}};var Jye=class{constructor(i,e,t){this._cachedWidth=-1;this.domNode=i,this.input=e;let o=Math.floor(e.lineContent.length/300);if(o>0){this._keyColumnPixelOffsetCache=new Float32Array(o);for(let n=0;n<o;n++)this._keyColumnPixelOffsetCache[n]=-1}else this._keyColumnPixelOffsetCache=null;this._characterMapping=t,this._charWidth=e.spaceWidth}getWidth(i){if(!this.domNode||this.input.lineContent.length<300){let e=this._characterMapping.getHorizontalOffset(this._characterMapping.length);return Math.round(this._charWidth*e)}return this._cachedWidth===-1&&(this._cachedWidth=this._getReadingTarget(this.domNode).offsetWidth,i?.markDidDomLayout()),this._cachedWidth}getWidthIsFast(){return this.input.lineContent.length<300||this._cachedWidth!==-1}resetCachedWidth(){this._cachedWidth=-1}monospaceAssumptionsAreValid(){if(!this.domNode)return Zye;if(this.input.lineContent.length<300){let i=this.getWidth(null),e=this.domNode.domNode.firstChild.offsetWidth;Math.abs(i-e)>=2&&(console.warn("monospace assumptions have been violated, therefore disabling monospace optimizations!"),Zye=!1)}return Zye}toSlowRenderedLine(){return F4i(this.domNode,this.input,this._characterMapping,0)}getVisibleRangesForRange(i,e,t,o){let n=this._getColumnPixelOffset(i,e,o),r=this._getColumnPixelOffset(i,t,o);return[new TP(n,r-n)]}_getColumnPixelOffset(i,e,t){if(e<=300){let c=this._characterMapping.getHorizontalOffset(e);return this._charWidth*c}let o=Math.floor((e-1)/300)-1,n=(o+1)*300+1,r=-1;if(this._keyColumnPixelOffsetCache&&(r=this._keyColumnPixelOffsetCache[o],r===-1&&(r=this._actualReadPixelOffset(i,n,t),this._keyColumnPixelOffsetCache[o]=r)),r===-1){let c=this._characterMapping.getHorizontalOffset(e);return this._charWidth*c}let s=this._characterMapping.getHorizontalOffset(n),l=this._characterMapping.getHorizontalOffset(e);return r+this._charWidth*(l-s)}_getReadingTarget(i){return i.domNode.firstChild}_actualReadPixelOffset(i,e,t){if(!this.domNode)return-1;let o=this._characterMapping.getDomPosition(e),n=gle.readHorizontalRanges(this._getReadingTarget(this.domNode),o.partIndex,o.charIndex,o.partIndex,o.charIndex,t);return!n||n.length===0?-1:n[0].left}getColumnOfNodeOffset(i,e){return gj(this._characterMapping,i,e)}},abt=class{constructor(i,e,t,o){if(this.domNode=i,this.input=e,this._characterMapping=t,this._isWhitespaceOnly=/^\s*$/.test(e.lineContent),this._containsForeignElements=o,this._cachedWidth=-1,this._pixelOffsetCache=null,e.isLTR){this._pixelOffsetCache=new Float32Array(Math.max(2,this._characterMapping.length+1));for(let n=0,r=this._characterMapping.length;n<=r;n++)this._pixelOffsetCache[n]=-1}}_getReadingTarget(i){return i.domNode.firstChild}getWidth(i){return this.domNode?(this._cachedWidth===-1&&(this._cachedWidth=this._getReadingTarget(this.domNode).offsetWidth,i?.markDidDomLayout()),this._cachedWidth):0}getWidthIsFast(){return this._cachedWidth!==-1}resetCachedWidth(){if(this._cachedWidth=-1,this._pixelOffsetCache!==null)for(let i=0,e=this._pixelOffsetCache.length;i<e;i++)this._pixelOffsetCache[i]=-1}getVisibleRangesForRange(i,e,t,o){if(!this.domNode)return null;if(this._pixelOffsetCache!==null){let n=this._readPixelOffset(this.domNode,i,e,o);if(n===-1)return null;let r=this._readPixelOffset(this.domNode,i,t,o);return r===-1?null:[new TP(n,r-n)]}return this._readVisibleRangesForRange(this.domNode,i,e,t,o)}_readVisibleRangesForRange(i,e,t,o,n){if(t===o){let r=this._readPixelOffset(i,e,t,n);return r===-1?null:[new TP(r,0)]}else return this._readRawVisibleRangesForRange(i,t,o,n)}_readPixelOffset(i,e,t,o){if(this.input.isLTR&&this._characterMapping.length===0){if(this._containsForeignElements===0||this._containsForeignElements===2)return 0;if(this._containsForeignElements===1)return this.getWidth(o);let n=this._getReadingTarget(i);return n.firstChild?(o.markDidDomLayout(),n.firstChild.offsetWidth):0}if(this._pixelOffsetCache!==null){let n=this._pixelOffsetCache[t];if(n!==-1)return n;let r=this._actualReadPixelOffset(i,e,t,o);return this._pixelOffsetCache[t]=r,r}return this._actualReadPixelOffset(i,e,t,o)}_actualReadPixelOffset(i,e,t,o){if(this._characterMapping.length===0){let l=gle.readHorizontalRanges(this._getReadingTarget(i),0,0,0,0,o);return!l||l.length===0?-1:l[0].left}if(this.input.isLTR&&t===this._characterMapping.length&&this._isWhitespaceOnly&&this._containsForeignElements===0)return this.getWidth(o);let n=this._characterMapping.getDomPosition(t),r=gle.readHorizontalRanges(this._getReadingTarget(i),n.partIndex,n.charIndex,n.partIndex,n.charIndex,o);if(!r||r.length===0)return-1;let s=r[0].left;if(this.input.isBasicASCII){let l=this._characterMapping.getHorizontalOffset(t),c=Math.round(this.input.spaceWidth*l);if(Math.abs(c-s)<=1)return c}return s}_readRawVisibleRangesForRange(i,e,t,o){if(this.input.isLTR&&e===1&&t===this._characterMapping.length)return[new TP(0,this.getWidth(o))];let n=this._characterMapping.getDomPosition(e),r=this._characterMapping.getDomPosition(t);return gle.readHorizontalRanges(this._getReadingTarget(i),n.partIndex,n.charIndex,r.partIndex,r.charIndex,o)}getColumnOfNodeOffset(i,e){return gj(this._characterMapping,i,e)}},Fti=class extends abt{_readVisibleRangesForRange(i,e,t,o,n){let r=super._readVisibleRangesForRange(i,e,t,o,n);if(!r||r.length===0||t===o||t===1&&o===this._characterMapping.length)return r;if(this.input.isLTR){let s=this._readPixelOffset(i,e,o,n);if(s!==-1){let l=r[r.length-1];l.left<s&&(l.width=s-l.left)}}return r}},F4i=(function(){return lV?zWo:KWo})();function zWo(a,i,e,t){return new Fti(a,i,e,t)}function KWo(a,i,e,t){return new abt(a,i,e,t)}function gj(a,i,e){let t=i.textContent.length,o=-1;for(;i;)i=i.previousSibling,o++;return a.getColumn(new Yje(o,e),t)}var Y1=class{constructor(i=null){this.hitTarget=i;this.type=0}},lbt=class{constructor(i,e,t){this.position=i;this.spanNode=e;this.injectedText=t;this.type=1}get hitTarget(){return this.spanNode}},ewe;(i=>{function a(e,t,o){let n=e.getPositionFromDOMInfo(t,o);return n?new lbt(n,t,null):new Y1(t)}i.createFromDOMInfo=a})(ewe||={});var cbt=class{constructor(i,e){this.lastViewCursorsRenderData=i;this.lastTextareaPosition=e}},wv=class{static _deduceRage(i,e=null){return!e&&i?new z(i.lineNumber,i.column,i.lineNumber,i.column):e??null}static createUnknown(i,e,t){return{type:0,element:i,mouseColumn:e,position:t,range:this._deduceRage(t)}}static createTextarea(i,e){return{type:1,element:i,mouseColumn:e,position:null,range:null}}static createMargin(i,e,t,o,n,r){return{type:i,element:e,mouseColumn:t,position:o,range:n,detail:r}}static createViewZone(i,e,t,o,n){return{type:i,element:e,mouseColumn:t,position:o,range:this._deduceRage(o),detail:n}}static createContentText(i,e,t,o,n){return{type:6,element:i,mouseColumn:e,position:t,range:this._deduceRage(t,o),detail:n}}static createContentEmpty(i,e,t,o){return{type:7,element:i,mouseColumn:e,position:t,range:this._deduceRage(t),detail:o}}static createContentWidget(i,e,t){return{type:9,element:i,mouseColumn:e,position:null,range:null,detail:t}}static createScrollbar(i,e,t){return{type:11,element:i,mouseColumn:e,position:t,range:this._deduceRage(t)}}static createOverlayWidget(i,e,t){return{type:12,element:i,mouseColumn:e,position:null,range:null,detail:t}}static createOutsideEditor(i,e,t,o){return{type:13,element:null,mouseColumn:i,position:e,range:this._deduceRage(e),outsidePosition:t,outsideDistance:o}}static _typeToString(i){return i===1?"TEXTAREA":i===2?"GUTTER_GLYPH_MARGIN":i===3?"GUTTER_LINE_NUMBERS":i===4?"GUTTER_LINE_DECORATIONS":i===5?"GUTTER_VIEW_ZONE":i===6?"CONTENT_TEXT":i===7?"CONTENT_EMPTY":i===8?"CONTENT_VIEW_ZONE":i===9?"CONTENT_WIDGET":i===10?"OVERVIEW_RULER":i===11?"SCROLLBAR":i===12?"OVERLAY_WIDGET":"UNKNOWN"}static toString(i){return this._typeToString(i.type)+": "+i.position+" - "+i.range+" - "+JSON.stringify(i.detail)}},rw=class{static isTextArea(i){return i.length===2&&i[0]===3&&i[1]===7}static isChildOfViewLines(i){return i.length>=4&&i[0]===3&&i[3]===8}static isStrictChildOfViewLines(i){return i.length>4&&i[0]===3&&i[3]===8}static isChildOfScrollableElement(i){return i.length>=2&&i[0]===3&&i[1]===6}static isChildOfMinimap(i){return i.length>=2&&i[0]===3&&i[1]===9}static isChildOfContentWidgets(i){return i.length>=4&&i[0]===3&&i[3]===1}static isChildOfOverflowGuard(i){return i.length>=1&&i[0]===3}static isChildOfOverflowingContentWidgets(i){return i.length>=1&&i[0]===2}static isChildOfOverlayWidgets(i){return i.length>=2&&i[0]===3&&i[1]===4}static isChildOfOverflowingOverlayWidgets(i){return i.length>=1&&i[0]===5}},twe=class a{constructor(i,e,t){this.viewModel=i.viewModel;let o=i.configuration.options;this.layoutInfo=o.get(165),this.viewDomNode=e.viewDomNode,this.viewLinesGpu=e.viewLinesGpu,this.lineHeight=o.get(75),this.stickyTabStops=o.get(132),this.typicalHalfwidthCharacterWidth=o.get(59).typicalHalfwidthCharacterWidth,this.lastRenderData=t,this._context=i,this._viewHelper=e}getZoneAtCoord(i){return a.getZoneAtCoord(this._context,i)}static getZoneAtCoord(i,e){let t=i.viewLayout.getWhitespaceAtVerticalOffset(e);if(t){let o=t.verticalOffset+t.height/2,n=i.viewModel.getLineCount(),r=null,s,l=null;return t.afterLineNumber!==n&&(l=new ye(t.afterLineNumber+1,1)),t.afterLineNumber>0&&(r=new ye(t.afterLineNumber,i.viewModel.getLineMaxColumn(t.afterLineNumber))),l===null?s=r:r===null?s=l:e<o?s=r:s=l,{viewZoneId:t.id,afterLineNumber:t.afterLineNumber,positionBefore:r,positionAfter:l,position:s}}return null}getFullLineRangeAtCoord(i){if(this._context.viewLayout.isAfterLines(i)){let o=this._context.viewModel.getLineCount(),n=this._context.viewModel.getLineMaxColumn(o);return{range:new z(o,n,o,n),isAfterLines:!0}}let e=this._context.viewLayout.getLineNumberAtVerticalOffset(i),t=this._context.viewModel.getLineMaxColumn(e);return{range:new z(e,1,e,t),isAfterLines:!1}}getLineNumberAtVerticalOffset(i){return this._context.viewLayout.getLineNumberAtVerticalOffset(i)}isAfterLines(i){return this._context.viewLayout.isAfterLines(i)}isInTopPadding(i){return this._context.viewLayout.isInTopPadding(i)}isInBottomPadding(i){return this._context.viewLayout.isInBottomPadding(i)}getVerticalOffsetForLineNumber(i){return this._context.viewLayout.getVerticalOffsetForLineNumber(i)}findAttribute(i,e){return a._findAttribute(i,e,this._viewHelper.viewDomNode)}static _findAttribute(i,e,t){for(;i&&i!==i.ownerDocument.body;){if(i.hasAttribute&&i.hasAttribute(e))return i.getAttribute(e);if(i===t)return null;i=i.parentNode}return null}getLineWidth(i){return this._viewHelper.getLineWidth(i)}isRtl(i){return this.viewModel.getTextDirection(i)===1}visibleRangeForPosition(i,e){return this._viewHelper.visibleRangeForPosition(i,e)}getPositionFromDOMInfo(i,e){return this._viewHelper.getPositionFromDOMInfo(i,e)}getCurrentScrollTop(){return this._context.viewLayout.getCurrentScrollTop()}getCurrentScrollLeft(){return this._context.viewLayout.getCurrentScrollLeft()}},Wti=class{constructor(i,e,t,o){this.editorPos=e,this.pos=t,this.relativePos=o,this.mouseVerticalOffset=Math.max(0,i.getCurrentScrollTop()+this.relativePos.y),this.mouseContentHorizontalOffset=i.getCurrentScrollLeft()+this.relativePos.x-i.layoutInfo.contentLeft,this.isInMarginArea=this.relativePos.x<i.layoutInfo.contentLeft&&this.relativePos.x>=i.layoutInfo.glyphMarginLeft,this.isInContentArea=!this.isInMarginArea,this.mouseColumn=Math.max(0,iwe._getMouseColumn(this.mouseContentHorizontalOffset,i.typicalHalfwidthCharacterWidth))}},Vti=class extends Wti{constructor(e,t,o,n,r){super(e,t,o,n);this.hitTestResult=new co(()=>iwe.doHitTest(this._ctx,this));this._targetPathCacheElement=null;this._targetPathCacheValue=new Uint8Array(0);this._ctx=e,this._eventTarget=r;let s=!!this._eventTarget;this._useHitTestTarget=!s}get target(){return this._useHitTestTarget?this.hitTestResult.value.hitTarget:this._eventTarget}get targetPath(){return this._targetPathCacheElement!==this.target&&(this._targetPathCacheElement=this.target,this._targetPathCacheValue=YS.collect(this.target,this._ctx.viewDomNode)),this._targetPathCacheValue}toString(){return`pos(${this.pos.x},${this.pos.y}), editorPos(${this.editorPos.x},${this.editorPos.y}), relativePos(${this.relativePos.x},${this.relativePos.y}), mouseVerticalOffset: ${this.mouseVerticalOffset}, mouseContentHorizontalOffset: ${this.mouseContentHorizontalOffset}
	target: ${this.target?this.target.outerHTML:null}`}get wouldBenefitFromHitTestTargetSwitch(){return!this._useHitTestTarget&&this.hitTestResult.value.hitTarget!==null&&this.target!==this.hitTestResult.value.hitTarget}switchToHitTestTarget(){this._useHitTestTarget=!0}_getMouseColumn(e=null){return e&&e.column<this._ctx.viewModel.getLineMaxColumn(e.lineNumber)?fl.visibleColumnFromColumn(this._ctx.viewModel.getLineContent(e.lineNumber),e.column,this._ctx.viewModel.model.getOptions().tabSize)+1:this.mouseColumn}fulfillUnknown(e=null){return wv.createUnknown(this.target,this._getMouseColumn(e),e)}fulfillTextarea(){return wv.createTextarea(this.target,this._getMouseColumn())}fulfillMargin(e,t,o,n){return wv.createMargin(e,this.target,this._getMouseColumn(t),t,o,n)}fulfillViewZone(e,t,o){return wv.createViewZone(e,this.target,this._getMouseColumn(),t,o)}fulfillContentText(e,t,o){return wv.createContentText(this.target,this._getMouseColumn(e),e,t,o)}fulfillContentEmpty(e,t){return wv.createContentEmpty(this.target,this._getMouseColumn(e),e,t)}fulfillContentWidget(e){return wv.createContentWidget(this.target,this._getMouseColumn(),e)}fulfillScrollbar(e){return wv.createScrollbar(this.target,this._getMouseColumn(e),e)}fulfillOverlayWidget(e){return wv.createOverlayWidget(this.target,this._getMouseColumn(),e)}},W4i={isAfterLines:!0};function vle(a){return{isAfterLines:!1,horizontalDistanceToText:a}}var iwe=class a{constructor(i,e){this._context=i,this._viewHelper=e}mouseTargetIsWidget(i){let e=i.target,t=YS.collect(e,this._viewHelper.viewDomNode);return!!(rw.isChildOfContentWidgets(t)||rw.isChildOfOverflowingContentWidgets(t)||rw.isChildOfOverlayWidgets(t)||rw.isChildOfOverflowingOverlayWidgets(t))}createMouseTarget(i,e,t,o,n){let r=new twe(this._context,this._viewHelper,i),s=new Vti(r,e,t,o,n);try{let l=a._createMouseTarget(r,s);if(l.type===6&&r.stickyTabStops&&l.position!==null){let c=a._snapToSoftTabBoundary(l.position,r.viewModel),u=z.fromPositions(c,c).plusRange(l.range);return s.fulfillContentText(c,u,l.detail)}return l}catch{return s.fulfillUnknown()}}static _createMouseTarget(i,e){if(e.target===null)return e.fulfillUnknown();let t=e,o=null;return!rw.isChildOfOverflowGuard(e.targetPath)&&!rw.isChildOfOverflowingContentWidgets(e.targetPath)&&!rw.isChildOfOverflowingOverlayWidgets(e.targetPath)&&(o=o||e.fulfillUnknown()),o=o||a._hitTestContentWidget(i,t),o=o||a._hitTestOverlayWidget(i,t),o=o||a._hitTestMinimap(i,t),o=o||a._hitTestScrollbarSlider(i,t),o=o||a._hitTestViewZone(i,t),o=o||a._hitTestMargin(i,t),o=o||a._hitTestViewCursor(i,t),o=o||a._hitTestTextArea(i,t),o=o||a._hitTestViewLines(i,t),o=o||a._hitTestScrollbar(i,t),o||e.fulfillUnknown()}static _hitTestContentWidget(i,e){if(rw.isChildOfContentWidgets(e.targetPath)||rw.isChildOfOverflowingContentWidgets(e.targetPath)){let t=i.findAttribute(e.target,"widgetId");return t?e.fulfillContentWidget(t):e.fulfillUnknown()}return null}static _hitTestOverlayWidget(i,e){if(rw.isChildOfOverlayWidgets(e.targetPath)||rw.isChildOfOverflowingOverlayWidgets(e.targetPath)){let t=i.findAttribute(e.target,"widgetId");return t?e.fulfillOverlayWidget(t):e.fulfillUnknown()}return null}static _hitTestViewCursor(i,e){if(e.target){let t=i.lastRenderData.lastViewCursorsRenderData;for(let o of t)if(e.target===o.domNode)return e.fulfillContentText(o.position,null,{mightBeForeignElement:!1,injectedText:null})}if(e.isInContentArea){let t=i.lastRenderData.lastViewCursorsRenderData,o=e.mouseContentHorizontalOffset,n=e.mouseVerticalOffset;for(let r of t){if(o<r.contentLeft||o>r.contentLeft+r.width)continue;let s=i.getVerticalOffsetForLineNumber(r.position.lineNumber);if(s<=n&&n<=s+r.height)return e.fulfillContentText(r.position,null,{mightBeForeignElement:!1,injectedText:null})}}return null}static _hitTestViewZone(i,e){let t=i.getZoneAtCoord(e.mouseVerticalOffset);if(t){let o=e.isInContentArea?8:5;return e.fulfillViewZone(o,t.position,t)}return null}static _hitTestTextArea(i,e){return rw.isTextArea(e.targetPath)?i.lastRenderData.lastTextareaPosition?e.fulfillContentText(i.lastRenderData.lastTextareaPosition,null,{mightBeForeignElement:!1,injectedText:null}):e.fulfillTextarea():null}static _hitTestMargin(i,e){if(e.isInMarginArea){let t=i.getFullLineRangeAtCoord(e.mouseVerticalOffset),o=t.range.getStartPosition(),n=Math.abs(e.relativePos.x),r={isAfterLines:t.isAfterLines,glyphMarginLeft:i.layoutInfo.glyphMarginLeft,glyphMarginWidth:i.layoutInfo.glyphMarginWidth,lineNumbersWidth:i.layoutInfo.lineNumbersWidth,offsetX:n};if(n-=i.layoutInfo.glyphMarginLeft,n<=i.layoutInfo.glyphMarginWidth){let s=i.viewModel.coordinatesConverter.convertViewPositionToModelPosition(t.range.getStartPosition()),l=i.viewModel.glyphLanes.getLanesAtLine(s.lineNumber);return r.glyphMarginLane=l[Math.floor(n/i.lineHeight)],e.fulfillMargin(2,o,t.range,r)}return n-=i.layoutInfo.glyphMarginWidth,n<=i.layoutInfo.lineNumbersWidth?e.fulfillMargin(3,o,t.range,r):(n-=i.layoutInfo.lineNumbersWidth,e.fulfillMargin(4,o,t.range,r))}return null}static _hitTestViewLines(i,e){if(!rw.isChildOfViewLines(e.targetPath))return null;if(i.isInTopPadding(e.mouseVerticalOffset))return e.fulfillContentEmpty(new ye(1,1),W4i);if(i.isAfterLines(e.mouseVerticalOffset)||i.isInBottomPadding(e.mouseVerticalOffset)){let o=i.viewModel.getLineCount(),n=i.viewModel.getLineMaxColumn(o);return e.fulfillContentEmpty(new ye(o,n),W4i)}if(rw.isStrictChildOfViewLines(e.targetPath)){let o=i.getLineNumberAtVerticalOffset(e.mouseVerticalOffset),n=i.viewModel.getLineLength(o),r=i.getLineWidth(o);if(n===0){let l=vle(e.mouseContentHorizontalOffset-r);return e.fulfillContentEmpty(new ye(o,1),l)}if(i.isRtl(o)){if(e.mouseContentHorizontalOffset+r<=i.layoutInfo.contentWidth-i.layoutInfo.verticalScrollbarWidth){let l=vle(e.mouseContentHorizontalOffset-r),c=new ye(o,i.viewModel.getLineMaxColumn(o));return e.fulfillContentEmpty(c,l)}}else if(e.mouseContentHorizontalOffset>=r){let l=vle(e.mouseContentHorizontalOffset-r),c=new ye(o,i.viewModel.getLineMaxColumn(o));return e.fulfillContentEmpty(c,l)}}else if(i.viewLinesGpu){let o=i.getLineNumberAtVerticalOffset(e.mouseVerticalOffset);if(i.viewModel.getLineLength(o)===0){let l=i.getLineWidth(o),c=vle(e.mouseContentHorizontalOffset-l);return e.fulfillContentEmpty(new ye(o,1),c)}let n=i.getLineWidth(o);if(i.isRtl(o)){if(e.mouseContentHorizontalOffset+n<=i.layoutInfo.contentWidth-i.layoutInfo.verticalScrollbarWidth){let l=vle(e.mouseContentHorizontalOffset-n),c=new ye(o,i.viewModel.getLineMaxColumn(o));return e.fulfillContentEmpty(c,l)}}else if(e.mouseContentHorizontalOffset>=n){let l=vle(e.mouseContentHorizontalOffset-n),c=new ye(o,i.viewModel.getLineMaxColumn(o));return e.fulfillContentEmpty(c,l)}let s=i.viewLinesGpu.getPositionAtCoordinate(o,e.mouseContentHorizontalOffset);if(s){let l={injectedText:null,mightBeForeignElement:!1};return e.fulfillContentText(s,z.fromPositions(s,s),l)}}let t=e.hitTestResult.value;return t.type===1?a.createMouseTargetFromHitTestPosition(i,e,t.spanNode,t.position,t.injectedText):e.wouldBenefitFromHitTestTargetSwitch?(e.switchToHitTestTarget(),this._createMouseTarget(i,e)):e.fulfillUnknown()}static _hitTestMinimap(i,e){if(rw.isChildOfMinimap(e.targetPath)){let t=i.getLineNumberAtVerticalOffset(e.mouseVerticalOffset),o=i.viewModel.getLineMaxColumn(t);return e.fulfillScrollbar(new ye(t,o))}return null}static _hitTestScrollbarSlider(i,e){if(rw.isChildOfScrollableElement(e.targetPath)&&e.target&&e.target.nodeType===1){let t=e.target.className;if(t&&/\b(slider|scrollbar)\b/.test(t)){let o=i.getLineNumberAtVerticalOffset(e.mouseVerticalOffset),n=i.viewModel.getLineMaxColumn(o);return e.fulfillScrollbar(new ye(o,n))}}return null}static _hitTestScrollbar(i,e){if(rw.isChildOfScrollableElement(e.targetPath)){let t=i.getLineNumberAtVerticalOffset(e.mouseVerticalOffset),o=i.viewModel.getLineMaxColumn(t);return e.fulfillScrollbar(new ye(t,o))}return null}getMouseColumn(i){let e=this._context.configuration.options,t=e.get(165),o=this._context.viewLayout.getCurrentScrollLeft()+i.x-t.contentLeft;return a._getMouseColumn(o,e.get(59).typicalHalfwidthCharacterWidth)}static _getMouseColumn(i,e){return i<0?1:Math.round(i/e)+1}static createMouseTargetFromHitTestPosition(i,e,t,o,n){let r=o.lineNumber,s=o.column,l=i.getLineWidth(r);if(e.mouseContentHorizontalOffset>l){let S=vle(e.mouseContentHorizontalOffset-l);return e.fulfillContentEmpty(o,S)}let c=i.visibleRangeForPosition(r,s);if(!c)return e.fulfillUnknown(o);let u=c.left;if(Math.abs(e.mouseContentHorizontalOffset-u)<1)return e.fulfillContentText(o,null,{mightBeForeignElement:!!n,injectedText:n});let p=[];if(p.push({offset:c.left,column:s}),s>1){let S=i.visibleRangeForPosition(r,s-1);S&&p.push({offset:S.left,column:s-1})}let h=i.viewModel.getLineMaxColumn(r);if(s<h){let S=i.visibleRangeForPosition(r,s+1);S&&p.push({offset:S.left,column:s+1})}p.sort((S,y)=>S.offset-y.offset);let g=e.pos.toClientCoordinates(Re(i.viewDomNode)),f=t.getBoundingClientRect(),v=f.left<=g.clientX&&g.clientX<=f.right,b=null;for(let S=1;S<p.length;S++){let y=p[S-1],w=p[S];if(y.offset<=e.mouseContentHorizontalOffset&&e.mouseContentHorizontalOffset<=w.offset){b=new z(r,y.column,r,w.column);let k=Math.abs(y.offset-e.mouseContentHorizontalOffset),T=Math.abs(w.offset-e.mouseContentHorizontalOffset);o=k<T?new ye(r,y.column):new ye(r,w.column);break}}return e.fulfillContentText(o,b,{mightBeForeignElement:!v||!!n,injectedText:n})}static _doHitTestWithCaretRangeFromPoint(i,e){let t=i.getLineNumberAtVerticalOffset(e.mouseVerticalOffset),o=i.getVerticalOffsetForLineNumber(t),n=o+i.lineHeight;if(!(t===i.viewModel.getLineCount()&&e.mouseVerticalOffset>n)){let s=Math.floor((o+n)/2),l=e.pos.y+(s-e.mouseVerticalOffset);l<=e.editorPos.y&&(l=e.editorPos.y+1),l>=e.editorPos.y+e.editorPos.height&&(l=e.editorPos.y+e.editorPos.height-1);let c=new mj(e.pos.x,l),u=this._actualDoHitTestWithCaretRangeFromPoint(i,c.toClientCoordinates(Re(i.viewDomNode)));if(u.type===1)return u}return this._actualDoHitTestWithCaretRangeFromPoint(i,e.pos.toClientCoordinates(Re(i.viewDomNode)))}static _actualDoHitTestWithCaretRangeFromPoint(i,e){let t=bP(i.viewDomNode),o;if(t?typeof t.caretRangeFromPoint>"u"?o=GWo(t,e.clientX,e.clientY):o=t.caretRangeFromPoint(e.clientX,e.clientY):o=i.viewDomNode.ownerDocument.caretRangeFromPoint(e.clientX,e.clientY),!o||!o.startContainer)return new Y1;let n=o.startContainer;if(n.nodeType===n.TEXT_NODE){let r=n.parentNode,s=r?r.parentNode:null,l=s?s.parentNode:null;return(l&&l.nodeType===l.ELEMENT_NODE?l.className:null)===NV.CLASS_NAME?ewe.createFromDOMInfo(i,r,o.startOffset):new Y1(n.parentNode)}else if(n.nodeType===n.ELEMENT_NODE){let r=n.parentNode,s=r?r.parentNode:null;return(s&&s.nodeType===s.ELEMENT_NODE?s.className:null)===NV.CLASS_NAME?ewe.createFromDOMInfo(i,n,n.textContent.length):new Y1(n)}return new Y1}static _doHitTestWithCaretPositionFromPoint(i,e){let t=i.viewDomNode.ownerDocument.caretPositionFromPoint(e.clientX,e.clientY);if(t.offsetNode.nodeType===t.offsetNode.TEXT_NODE){let o=t.offsetNode.parentNode,n=o?o.parentNode:null,r=n?n.parentNode:null;return(r&&r.nodeType===r.ELEMENT_NODE?r.className:null)===NV.CLASS_NAME?ewe.createFromDOMInfo(i,t.offsetNode.parentNode,t.offset):new Y1(t.offsetNode.parentNode)}if(t.offsetNode.nodeType===t.offsetNode.ELEMENT_NODE){let o=t.offsetNode.parentNode,n=o&&o.nodeType===o.ELEMENT_NODE?o.className:null,r=o?o.parentNode:null,s=r&&r.nodeType===r.ELEMENT_NODE?r.className:null;if(n===NV.CLASS_NAME){let l=t.offsetNode.childNodes[Math.min(t.offset,t.offsetNode.childNodes.length-1)];if(l)return ewe.createFromDOMInfo(i,l,0)}else if(s===NV.CLASS_NAME)return ewe.createFromDOMInfo(i,t.offsetNode,0)}return new Y1(t.offsetNode)}static _snapToSoftTabBoundary(i,e){let t=e.getLineContent(i.lineNumber),{tabSize:o}=e.model.getOptions(),n=_ae.atomicPosition(t,i.column-1,o,2);return n!==-1?new ye(i.lineNumber,n+1):i}static doHitTest(i,e){let t=new Y1;if(typeof i.viewDomNode.ownerDocument.caretRangeFromPoint=="function"?t=this._doHitTestWithCaretRangeFromPoint(i,e):i.viewDomNode.ownerDocument.caretPositionFromPoint&&(t=this._doHitTestWithCaretPositionFromPoint(i,e.pos.toClientCoordinates(Re(i.viewDomNode)))),t.type===1){let o=i.viewModel.getInjectedTextAt(t.position),n=i.viewModel.normalizePosition(t.position,2);(o||!n.equals(t.position))&&(t=new lbt(n,t.spanNode,o))}return t}};function GWo(a,i,e){let t=document.createRange(),o=a.elementFromPoint(i,e);if(o?.hasChildNodes()){for(;o&&o.firstChild&&o.firstChild.nodeType!==o.firstChild.TEXT_NODE&&o.lastChild&&o.lastChild.firstChild;)o=o.lastChild;let n=o.getBoundingClientRect(),r=Re(o),s=r.getComputedStyle(o,null).getPropertyValue("font-style"),l=r.getComputedStyle(o,null).getPropertyValue("font-variant"),c=r.getComputedStyle(o,null).getPropertyValue("font-weight"),u=r.getComputedStyle(o,null).getPropertyValue("font-size"),p=r.getComputedStyle(o,null).getPropertyValue("line-height"),h=r.getComputedStyle(o,null).getPropertyValue("font-family"),g=`${s} ${l} ${c} ${u}/${p} ${h}`,f=o.innerText,v=n.left,b=0,S;if(i>n.left+n.width)b=f.length;else{let y=Bti.getInstance();for(let w=0;w<f.length+1;w++){if(S=y.getCharWidth(f.charAt(w),g)/2,v+=S,i<v){b=w;break}v+=S}}t.setStart(o.firstChild,b),t.setEnd(o.firstChild,b)}return t}var Bti=class a{static{this._INSTANCE=null}static getInstance(){return a._INSTANCE||(a._INSTANCE=new a),a._INSTANCE}constructor(){this._cache={},this._canvas=document.createElement("canvas")}getCharWidth(i,e){let t=i+e;if(this._cache[t])return this._cache[t];let o=this._canvas.getContext("2d");o.font=e;let r=o.measureText(i).width;return this._cache[t]=r,r}};function V4i(a){return(i,e,t)=>{let o=null,n=null;if(typeof t.value=="function"?(o="value",n=t.value):typeof t.get=="function"&&(o="get",n=t.get),!n||typeof e=="symbol")throw new Error("not supported");t[o]=a(n,e)}}function hi(a,i,e){let t=null,o=null;if(typeof e.value=="function"?(t="value",o=e.value,o.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof e.get=="function"&&(t="get",o=e.get),!o)throw new Error("not supported");let n=`$memoize$${i}`;e[t]=function(...r){return this.hasOwnProperty(n)||Object.defineProperty(this,n,{configurable:!1,enumerable:!1,writable:!1,value:o.apply(this,r)}),this[n]}}function Zd(a,i,e){return V4i((t,o)=>{let n=`$debounce$${o}`,r=`$debounce$result$${o}`;return function(...s){this[r]||(this[r]=e?e():void 0),clearTimeout(this[n]),i&&(this[r]=i(this[r],...s),s=[this[r]]),this[n]=setTimeout(()=>{t.apply(this,s),this[r]=e?e():void 0},a)}})}function _P(a,i,e){return V4i((t,o)=>{let n=`$throttle$timer$${o}`,r=`$throttle$result$${o}`,s=`$throttle$lastRun$${o}`,l=`$throttle$pending$${o}`;return function(...c){if(this[r]||(this[r]=e?e():void 0),(this[s]===null||this[s]===void 0)&&(this[s]=-Number.MAX_VALUE),i&&(this[r]=i(this[r],...c)),this[l])return;let u=this[s]+a;u<=Date.now()?(this[s]=Date.now(),t.apply(this,[this[r]]),this[r]=e?e():void 0):(this[l]=!0,this[n]=setTimeout(()=>{this[l]=!1,this[s]=Date.now(),t.apply(this,[this[r]]),this[r]=e?e():void 0},u-Date.now()))}})}var Kn;(n=>(n.Tap="-monaco-gesturetap",n.Change="-monaco-gesturechange",n.Start="-monaco-gesturestart",n.End="-monaco-gesturesend",n.Contextmenu="-monaco-gesturecontextmenu"))(Kn||={});var sw=class sw extends x{constructor(){super();this.dispatched=!1;this.targets=new qs;this.ignoreTargets=new qs;this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(U.runAndSubscribe(nf,({window:e,disposables:t})=>{t.add(j(e.document,"touchstart",o=>this.onTouchStart(o),{passive:!1})),t.add(j(e.document,"touchend",o=>this.onTouchEnd(e,o))),t.add(j(e.document,"touchmove",o=>this.onTouchMove(o),{passive:!1}))},{window:ut,disposables:this._store}))}static{this.SCROLL_FRICTION=-.005}static{this.HOLD_DELAY=700}static{this.CLEAR_TAP_COUNT_TIME=400}static addTarget(e){if(!sw.isTouchDevice())return x.None;sw.INSTANCE||(sw.INSTANCE=im(new sw));let t=sw.INSTANCE.targets.push(e);return Z(t)}static ignoreTarget(e){if(!sw.isTouchDevice())return x.None;sw.INSTANCE||(sw.INSTANCE=im(new sw));let t=sw.INSTANCE.ignoreTargets.push(e);return Z(t)}static isTouchDevice(){return"ontouchstart"in ut||navigator.maxTouchPoints>0}static isHoverDevice(){return ut.matchMedia("(hover: hover)").matches}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(e){let t=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let o=0,n=e.targetTouches.length;o<n;o++){let r=e.targetTouches.item(o);this.activeTouches[r.identifier]={id:r.identifier,initialTarget:r.target,initialTimeStamp:t,initialPageX:r.pageX,initialPageY:r.pageY,rollingTimestamps:[t],rollingPageX:[r.pageX],rollingPageY:[r.pageY]};let s=this.newGestureEvent(Kn.Start,r.target);s.pageX=r.pageX,s.pageY=r.pageY,this.dispatchEvent(s)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}onTouchEnd(e,t){let o=Date.now(),n=Object.keys(this.activeTouches).length;for(let r=0,s=t.changedTouches.length;r<s;r++){let l=t.changedTouches.item(r);if(!this.activeTouches.hasOwnProperty(String(l.identifier))){console.warn("move of an UNKNOWN touch",l);continue}let c=this.activeTouches[l.identifier],u=Date.now()-c.initialTimeStamp;if(u<sw.HOLD_DELAY&&Math.abs(c.initialPageX-c.rollingPageX.at(-1))<30&&Math.abs(c.initialPageY-c.rollingPageY.at(-1))<30){let p=this.newGestureEvent(Kn.Tap,c.initialTarget);p.pageX=c.rollingPageX.at(-1),p.pageY=c.rollingPageY.at(-1),this.dispatchEvent(p)}else if(u>=sw.HOLD_DELAY&&Math.abs(c.initialPageX-c.rollingPageX.at(-1))<30&&Math.abs(c.initialPageY-c.rollingPageY.at(-1))<30){let p=this.newGestureEvent(Kn.Contextmenu,c.initialTarget);p.pageX=c.rollingPageX.at(-1),p.pageY=c.rollingPageY.at(-1),this.dispatchEvent(p)}else if(n===1){let p=c.rollingPageX.at(-1),h=c.rollingPageY.at(-1),g=c.rollingTimestamps.at(-1)-c.rollingTimestamps[0],f=p-c.rollingPageX[0],v=h-c.rollingPageY[0],b=[...this.targets].filter(S=>c.initialTarget instanceof Node&&S.contains(c.initialTarget));this.inertia(e,b,o,Math.abs(f)/g,f>0?1:-1,p,Math.abs(v)/g,v>0?1:-1,h)}this.dispatchEvent(this.newGestureEvent(Kn.End,c.initialTarget)),delete this.activeTouches[l.identifier]}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}newGestureEvent(e,t){let o=document.createEvent("CustomEvent");return o.initEvent(e,!1,!0),o.initialTarget=t,o.tapCount=0,o}dispatchEvent(e){if(e.type===Kn.Tap){let t=new Date().getTime(),o=0;t-this._lastSetTapCountTime>sw.CLEAR_TAP_COUNT_TIME?o=1:o=2,this._lastSetTapCountTime=t,e.tapCount=o}else(e.type===Kn.Change||e.type===Kn.Contextmenu)&&(this._lastSetTapCountTime=0);if(e.initialTarget instanceof Node){for(let o of this.ignoreTargets)if(o.contains(e.initialTarget))return;let t=[];for(let o of this.targets)if(o.contains(e.initialTarget)){let n=0,r=e.initialTarget;for(;r&&r!==o;)n++,r=r.parentElement;t.push([n,o])}t.sort((o,n)=>o[0]-n[0]);for(let[o,n]of t)n.dispatchEvent(e),this.dispatched=!0}}inertia(e,t,o,n,r,s,l,c,u){this.handle=Wr(e,()=>{let p=Date.now(),h=p-o,g=0,f=0,v=!0;n+=sw.SCROLL_FRICTION*h,l+=sw.SCROLL_FRICTION*h,n>0&&(v=!1,g=r*n*h),l>0&&(v=!1,f=c*l*h);let b=this.newGestureEvent(Kn.Change);b.translationX=g,b.translationY=f,t.forEach(S=>S.dispatchEvent(b)),v||this.inertia(e,t,p,n,r,s+g,l,c,u+f)})}onTouchMove(e){let t=Date.now();for(let o=0,n=e.changedTouches.length;o<n;o++){let r=e.changedTouches.item(o);if(!this.activeTouches.hasOwnProperty(String(r.identifier))){console.warn("end of an UNKNOWN touch",r);continue}let s=this.activeTouches[r.identifier],l=this.newGestureEvent(Kn.Change,s.initialTarget);l.translationX=r.pageX-s.rollingPageX.at(-1),l.translationY=r.pageY-s.rollingPageY.at(-1),l.pageX=r.pageX,l.pageY=r.pageY,this.dispatchEvent(l),s.rollingPageX.length>3&&(s.rollingPageX.shift(),s.rollingPageY.shift(),s.rollingTimestamps.shift()),s.rollingPageX.push(r.pageX),s.rollingPageY.push(r.pageY),s.rollingTimestamps.push(t)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}};I([hi],sw,"isTouchDevice",1),I([hi],sw,"isHoverDevice",1);var Ms=sw;var ja=class extends x{onclick(i,e){this._register(j(i,re.CLICK,t=>e(new Cn(Re(i),t))))}onmousedown(i,e){this._register(j(i,re.MOUSE_DOWN,t=>e(new Cn(Re(i),t))))}onmouseover(i,e){this._register(j(i,re.MOUSE_OVER,t=>e(new Cn(Re(i),t))))}onmouseleave(i,e){this._register(j(i,re.MOUSE_LEAVE,t=>e(new Cn(Re(i),t))))}onkeydown(i,e){this._register(j(i,re.KEY_DOWN,t=>e(new gi(t))))}onkeyup(i,e){this._register(j(i,re.KEY_UP,t=>e(new gi(t))))}oninput(i,e){this._register(j(i,re.INPUT,e))}onblur(i,e){this._register(j(i,re.BLUR,e))}onfocus(i,e){this._register(j(i,re.FOCUS,e))}onchange(i,e){this._register(j(i,re.CHANGE,e))}ignoreGesture(i){return Ms.ignoreTarget(i)}};var A7=11,dbt=class extends ja{constructor(i){super(),this._onActivate=i.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=i.bgWidth+"px",this.bgDomNode.style.height=i.bgHeight+"px",typeof i.top<"u"&&(this.bgDomNode.style.top="0px"),typeof i.left<"u"&&(this.bgDomNode.style.left="0px"),typeof i.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof i.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=i.className,this.domNode.classList.add(...q.asClassNameArray(i.icon)),this.domNode.style.position="absolute",this.domNode.style.width=A7+"px",this.domNode.style.height=A7+"px",typeof i.top<"u"&&(this.domNode.style.top=i.top+"px"),typeof i.left<"u"&&(this.domNode.style.left=i.left+"px"),typeof i.bottom<"u"&&(this.domNode.style.bottom=i.bottom+"px"),typeof i.right<"u"&&(this.domNode.style.right=i.right+"px"),this._pointerMoveMonitor=this._register(new $L),this._register(Jo(this.bgDomNode,re.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(Jo(this.domNode,re.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new FL),this._pointerdownScheduleRepeatTimer=this._register(new Ul)}_arrowPointerDown(i){if(!i.target||!(i.target instanceof Element))return;let e=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Re(i))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(e,200),this._pointerMoveMonitor.startMonitoring(i.target,i.pointerId,i.buttons,t=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),i.preventDefault()}};var ubt=class extends x{constructor(i,e,t){super(),this._visibility=i,this._visibleClassName=e,this._invisibleClassName=t,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new Ul)}setVisibility(i){this._visibility!==i&&(this._visibility=i,this._updateShouldBeVisible())}setShouldBeVisible(i){this._rawShouldBeVisible=i,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let i=this._applyVisibilitySetting();this._shouldBeVisible!==i&&(this._shouldBeVisible=i,this.ensureVisibility())}setIsNeeded(i){this._isNeeded!==i&&(this._isNeeded=i,this.ensureVisibility())}setDomNode(i){this._domNode=i,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(i){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(i?" fade":"")))}};var qWo=140,owe=class extends ja{constructor(i){super(),this._lazyRender=i.lazyRender,this._host=i.host,this._scrollable=i.scrollable,this._scrollByPage=i.scrollByPage,this._scrollbarState=i.scrollbarState,this._visibilityController=this._register(new ubt(i.visibility,"visible scrollbar "+i.extraScrollbarClassName,"invisible scrollbar "+i.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new $L),this._shouldRender=!0,this.domNode=ur(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(j(this.domNode.domNode,re.POINTER_DOWN,e=>this._domNodePointerDown(e)))}_createArrow(i){let e=this._register(new dbt(i));this.domNode.domNode.appendChild(e.bgDomNode),this.domNode.domNode.appendChild(e.domNode)}_createSlider(i,e,t,o){this.slider=ur(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(i),this.slider.setLeft(e),typeof t=="number"&&this.slider.setWidth(t),typeof o=="number"&&this.slider.setHeight(o),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(j(this.slider.domNode,re.POINTER_DOWN,n=>{n.button===0&&(n.preventDefault(),this._sliderPointerDown(n))})),this.onclick(this.slider.domNode,n=>{n.leftButton&&n.stopPropagation()})}_onElementSize(i){return this._scrollbarState.setVisibleSize(i)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(i){return this._scrollbarState.setScrollSize(i)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(i){return this._scrollbarState.setScrollPosition(i)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(i){i.target===this.domNode.domNode&&this._onPointerDown(i)}delegatePointerDown(i){let e=this.domNode.domNode.getClientRects()[0].top,t=e+this._scrollbarState.getSliderPosition(),o=e+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),n=this._sliderPointerPosition(i);t<=n&&n<=o?i.button===0&&(i.preventDefault(),this._sliderPointerDown(i)):this._onPointerDown(i)}_onPointerDown(i){let e,t;if(i.target===this.domNode.domNode&&typeof i.offsetX=="number"&&typeof i.offsetY=="number")e=i.offsetX,t=i.offsetY;else{let r=ir(this.domNode.domNode);e=i.pageX-r.left,t=i.pageY-r.top}let o=i.pointerType==="mouse",n=i.button===0;if(n||!o){let r=this._pointerDownRelativePosition(e,t);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r))}n&&(i.preventDefault(),this._sliderPointerDown(i))}_sliderPointerDown(i){if(!i.target||!(i.target instanceof Element))return;let e=this._sliderPointerPosition(i),t=this._sliderOrthogonalPointerPosition(i),o=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(i.target,i.pointerId,i.buttons,n=>{let r=this._sliderOrthogonalPointerPosition(n),s=Math.abs(r-t);if(ei&&s>qWo){this._setDesiredScrollPositionNow(o.getScrollPosition());return}let c=this._sliderPointerPosition(n)-e;this._setDesiredScrollPositionNow(o.getDesiredScrollPositionFromDelta(c))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(i){let e={};this.writeScrollPosition(e,i),this._scrollable.setScrollPositionNow(e)}updateScrollbarSize(i){this._updateScrollbarSize(i),this._scrollbarState.setScrollbarSize(i),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}};var N7=class a{constructor(i,e,t,o,n,r){this._scrollbarSize=Math.round(e),this._oppositeScrollbarSize=Math.round(t),this._arrowSize=Math.round(i),this._visibleSize=o,this._scrollSize=n,this._scrollPosition=r,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new a(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(i){let e=Math.round(i);return this._visibleSize!==e?(this._visibleSize=e,this._refreshComputedValues(),!0):!1}setScrollSize(i){let e=Math.round(i);return this._scrollSize!==e?(this._scrollSize=e,this._refreshComputedValues(),!0):!1}setScrollPosition(i){let e=Math.round(i);return this._scrollPosition!==e?(this._scrollPosition=e,this._refreshComputedValues(),!0):!1}setScrollbarSize(i){this._scrollbarSize=Math.round(i)}setOppositeScrollbarSize(i){this._oppositeScrollbarSize=Math.round(i)}static _computeValues(i,e,t,o,n){let r=Math.max(0,t-i),s=Math.max(0,r-2*e),l=o>0&&o>t;if(!l)return{computedAvailableSize:Math.round(r),computedIsNeeded:l,computedSliderSize:Math.round(s),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(t*s/o))),u=(s-c)/(o-t),p=n*u;return{computedAvailableSize:Math.round(r),computedIsNeeded:l,computedSliderSize:Math.round(c),computedSliderRatio:u,computedSliderPosition:Math.round(p)}}_refreshComputedValues(){let i=a._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=i.computedAvailableSize,this._computedIsNeeded=i.computedIsNeeded,this._computedSliderSize=i.computedSliderSize,this._computedSliderRatio=i.computedSliderRatio,this._computedSliderPosition=i.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(i){if(!this._computedIsNeeded)return 0;let e=i-this._arrowSize-this._computedSliderSize/2;return Math.round(e/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(i){if(!this._computedIsNeeded)return 0;let e=i-this._arrowSize,t=this._scrollPosition;return e<this._computedSliderPosition?t-=this._visibleSize:t+=this._visibleSize,t}getDesiredScrollPositionFromDelta(i){if(!this._computedIsNeeded)return 0;let e=this._computedSliderPosition+i;return Math.round(e/this._computedSliderRatio)}};var pbt=class extends owe{constructor(i,e,t){let o=i.getScrollDimensions(),n=i.getCurrentScrollPosition();if(super({lazyRender:e.lazyRender,host:t,scrollbarState:new N7(e.horizontalHasArrows?e.arrowSize:0,e.horizontal===2?0:e.horizontalScrollbarSize,e.vertical===2?0:e.verticalScrollbarSize,o.width,o.scrollWidth,n.scrollLeft),visibility:e.horizontal,extraScrollbarClassName:"horizontal",scrollable:i,scrollByPage:e.scrollByPage}),e.horizontalHasArrows){let r=(e.arrowSize-A7)/2,s=(e.horizontalScrollbarSize-A7)/2;this._createArrow({className:"scra",icon:R.scrollbarButtonLeft,top:s,left:r,bottom:void 0,right:void 0,bgWidth:e.arrowSize,bgHeight:e.horizontalScrollbarSize,onActivate:()=>this._host.onMouseWheel(new p_(null,1,0))}),this._createArrow({className:"scra",icon:R.scrollbarButtonRight,top:s,left:void 0,bottom:void 0,right:r,bgWidth:e.arrowSize,bgHeight:e.horizontalScrollbarSize,onActivate:()=>this._host.onMouseWheel(new p_(null,-1,0))})}this._createSlider(Math.floor((e.horizontalScrollbarSize-e.horizontalSliderSize)/2),0,void 0,e.horizontalSliderSize)}_updateSlider(i,e){this.slider.setWidth(i),this.slider.setLeft(e)}_renderDomNode(i,e){this.domNode.setWidth(i),this.domNode.setHeight(e),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(i){return this._shouldRender=this._onElementScrollSize(i.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(i.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(i.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(i,e){return i}_sliderPointerPosition(i){return i.pageX}_sliderOrthogonalPointerPosition(i){return i.pageY}_updateScrollbarSize(i){this.slider.setHeight(i)}writeScrollPosition(i,e){i.scrollLeft=e}updateOptions(i){this.updateScrollbarSize(i.horizontal===2?0:i.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(i.vertical===2?0:i.verticalScrollbarSize),this._visibilityController.setVisibility(i.horizontal),this._scrollByPage=i.scrollByPage}};var mbt=class extends owe{constructor(i,e,t){let o=i.getScrollDimensions(),n=i.getCurrentScrollPosition();if(super({lazyRender:e.lazyRender,host:t,scrollbarState:new N7(e.verticalHasArrows?e.arrowSize:0,e.vertical===2?0:e.verticalScrollbarSize,0,o.height,o.scrollHeight,n.scrollTop),visibility:e.vertical,extraScrollbarClassName:"vertical",scrollable:i,scrollByPage:e.scrollByPage}),e.verticalHasArrows){let r=(e.arrowSize-A7)/2,s=(e.verticalScrollbarSize-A7)/2;this._createArrow({className:"scra",icon:R.scrollbarButtonUp,top:r,left:s,bottom:void 0,right:void 0,bgWidth:e.verticalScrollbarSize,bgHeight:e.arrowSize,onActivate:()=>this._host.onMouseWheel(new p_(null,0,1))}),this._createArrow({className:"scra",icon:R.scrollbarButtonDown,top:void 0,left:s,bottom:r,right:void 0,bgWidth:e.verticalScrollbarSize,bgHeight:e.arrowSize,onActivate:()=>this._host.onMouseWheel(new p_(null,0,-1))})}this._createSlider(0,Math.floor((e.verticalScrollbarSize-e.verticalSliderSize)/2),e.verticalSliderSize,void 0)}_updateSlider(i,e){this.slider.setHeight(i),this.slider.setTop(e)}_renderDomNode(i,e){this.domNode.setWidth(e),this.domNode.setHeight(i),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(i){return this._shouldRender=this._onElementScrollSize(i.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(i.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(i.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(i,e){return e}_sliderPointerPosition(i){return i.pageY}_sliderOrthogonalPointerPosition(i){return i.pageX}_updateScrollbarSize(i){this.slider.setWidth(i)}writeScrollPosition(i,e){i.scrollTop=e}updateOptions(i){this.updateScrollbarSize(i.vertical===2?0:i.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(i.vertical),this._scrollByPage=i.scrollByPage}};var $Wo=500,B4i=50,H4i=!0,Hti=class{constructor(i,e,t){this.timestamp=i,this.deltaX=e,this.deltaY=t,this.score=0}},X1=class a{static{this.INSTANCE=new a}constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let i=1,e=0,t=1,o=this._rear;do{let n=o===this._front?i:Math.pow(2,-t);if(i-=n,e+=this._memory[o].score*n,o===this._front)break;o=(this._capacity+o-1)%this._capacity,t++}while(!0);return e<=.5}acceptStandardWheelEvent(i){if(p1){let e=Re(i.browserEvent),t=Zv(e);this.accept(Date.now(),i.deltaX*t,i.deltaY*t)}else this.accept(Date.now(),i.deltaX,i.deltaY)}accept(i,e,t){let o=null,n=new Hti(i,e,t);this._front===-1&&this._rear===-1?(this._memory[0]=n,this._front=0,this._rear=0):(o=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=n),n.score=this._computeScore(n,o)}_computeScore(i,e){if(Math.abs(i.deltaX)>0&&Math.abs(i.deltaY)>0)return 1;let t=.5;if((!this._isAlmostInt(i.deltaX)||!this._isAlmostInt(i.deltaY))&&(t+=.25),e){let o=Math.abs(i.deltaX),n=Math.abs(i.deltaY),r=Math.abs(e.deltaX),s=Math.abs(e.deltaY),l=Math.max(Math.min(o,r),1),c=Math.max(Math.min(n,s),1),u=Math.max(o,r),p=Math.max(n,s);u%l===0&&p%c===0&&(t-=.5)}return Math.min(Math.max(t,0),1)}_isAlmostInt(i){let e=Number.EPSILON*100;return Math.abs(Math.round(i)-i)<.01+e}},Jje=class extends ja{constructor(e,t,o){super();this._inertialTimeout=null;this._inertialSpeed={X:0,Y:0};this._onScroll=this._register(new E);this._onWillScroll=this._register(new E);e.style.overflow="hidden",this._options=jWo(t),this._scrollable=o,this._register(this._scrollable.onScroll(r=>{this._onWillScroll.fire(r),this._onDidScroll(r),this._onScroll.fire(r)}));let n={onMouseWheel:r=>this._onMouseWheel(r),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new mbt(this._scrollable,this._options,n)),this._horizontalScrollbar=this._register(new pbt(this._scrollable,this._options,n)),this._domNode=document.createElement("div"),this._domNode.className="monaco-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.style.overflow="hidden",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=ur(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=ur(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=ur(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,r=>this._onMouseOver(r)),this.onmouseleave(this._listenOnDomNode,r=>this._onMouseLeave(r)),this._hideTimeout=this._register(new Ul),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get onScroll(){return this._onScroll.event}get onWillScroll(){return this._onWillScroll.event}get options(){return this._options}dispose(){this._mouseWheelToDispose=Be(this._mouseWheelToDispose),this._inertialTimeout&&(this._inertialTimeout.dispose(),this._inertialTimeout=null),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,Ze&&(this._options.className+=" mac"),this._domNode.className="monaco-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new p_(e))}async _periodicSync(){let e=!1;(this._inertialSpeed.X!==0||this._inertialSpeed.Y!==0)&&(this._scrollable.setScrollPositionNow({scrollTop:this._scrollable.getCurrentScrollPosition().scrollTop-this._inertialSpeed.Y*100,scrollLeft:this._scrollable.getCurrentScrollPosition().scrollLeft-this._inertialSpeed.X*100}),this._inertialSpeed.X*=.9,this._inertialSpeed.Y*=.9,Math.abs(this._inertialSpeed.X)<.01&&(this._inertialSpeed.X=0),Math.abs(this._inertialSpeed.Y)<.01&&(this._inertialSpeed.Y=0),e=this._inertialSpeed.X!==0||this._inertialSpeed.Y!==0),e?(this._inertialTimeout||(this._inertialTimeout=new Ul),this._inertialTimeout.cancelAndSet(()=>this._periodicSync(),1e3/60)):(this._inertialTimeout?.dispose(),this._inertialTimeout=null)}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Be(this._mouseWheelToDispose),e)){let o=n=>{this._onMouseWheel(new p_(n))};this._mouseWheelToDispose.push(j(this._listenOnDomNode,re.MOUSE_WHEEL,o,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=X1.INSTANCE;H4i&&t.acceptStandardWheelEvent(e);let o=!1;if(e.deltaY||e.deltaX){let r=e.deltaY*this._options.mouseWheelScrollSensitivity,s=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&s+r===0?s=r=0:Math.abs(r)>=Math.abs(s)?s=0:r=0),this._options.flipAxes&&([r,s]=[s,r]);let l=!Ze&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||l)&&!s&&(s=r,r=0),e.browserEvent&&e.browserEvent.altKey&&(s=s*this._options.fastScrollSensitivity,r=r*this._options.fastScrollSensitivity);let c=this._scrollable.getFutureScrollPosition(),u={};if(r){let p=B4i*r,h=c.scrollTop-(p<0?Math.floor(p):Math.ceil(p));this._verticalScrollbar.writeScrollPosition(u,h)}if(s){let p=B4i*s,h=c.scrollLeft-(p<0?Math.floor(p):Math.ceil(p));this._horizontalScrollbar.writeScrollPosition(u,h)}if(u=this._scrollable.validateScrollPosition(u),this._options.inertialScroll&&(s||r)&&!t.isPhysicalMouseWheel()){let p=!1;this._inertialSpeed.X===0&&this._inertialSpeed.Y===0&&(p=!0),this._inertialSpeed.Y=(r<0?-1:1)*Math.abs(r)**1.02,this._inertialSpeed.X=(s<0?-1:1)*Math.abs(s)**1.02,p&&this._periodicSync()}(c.scrollLeft!==u.scrollLeft||c.scrollTop!==u.scrollTop)&&(H4i&&this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(u):this._scrollable.setScrollPositionNow(u),o=!0)}let n=o;!n&&this._options.alwaysConsumeMouseWheel&&(n=!0),!n&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(n=!0),n&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,o=e.scrollLeft>0,n=o?" left":"",r=t?" top":"",s=o||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${n}`),this._topShadowDomNode.setClassName(`shadow${r}`),this._topLeftShadowDomNode.setClassName(`shadow${s}${r}${n}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),$Wo)}},O7=class extends Jje{constructor(i,e){e=e||{},e.mouseWheelSmoothScroll=!1;let t=new y_({forceIntegerValues:!0,smoothScrollDuration:0,scheduleAtNextAnimationFrame:o=>Wr(Re(i),o)});super(i,e,t),this._register(t)}setScrollPosition(i){this._scrollable.setScrollPositionNow(i)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}},_O=class extends Jje{constructor(i,e,t){super(i,e,t)}setScrollPosition(i){i.reuseAnimation?this._scrollable.setScrollPositionSmooth(i,i.reuseAnimation):this._scrollable.setScrollPositionNow(i)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}},ms=class extends Jje{constructor(i,e){e=e||{},e.mouseWheelSmoothScroll=!1;let t=new y_({forceIntegerValues:!1,smoothScrollDuration:0,scheduleAtNextAnimationFrame:o=>Wr(Re(i),o)});super(i,e,t),this._register(t),this._element=i,this._register(this.onScroll(o=>{o.scrollTopChanged&&(this._element.scrollTop=o.scrollTop),o.scrollLeftChanged&&(this._element.scrollLeft=o.scrollLeft)})),this.scanDomNode()}setScrollPosition(i){this._scrollable.setScrollPositionNow(i)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}scanDomNode(){this.setScrollDimensions({width:this._element.clientWidth,scrollWidth:this._element.scrollWidth,height:this._element.clientHeight,scrollHeight:this._element.scrollHeight}),this.setScrollPosition({scrollLeft:this._element.scrollLeft,scrollTop:this._element.scrollTop})}};function jWo(a){let i={lazyRender:typeof a.lazyRender<"u"?a.lazyRender:!1,className:typeof a.className<"u"?a.className:"",useShadows:typeof a.useShadows<"u"?a.useShadows:!0,handleMouseWheel:typeof a.handleMouseWheel<"u"?a.handleMouseWheel:!0,flipAxes:typeof a.flipAxes<"u"?a.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof a.consumeMouseWheelIfScrollbarIsNeeded<"u"?a.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof a.alwaysConsumeMouseWheel<"u"?a.alwaysConsumeMouseWheel:!1,scrollYToX:typeof a.scrollYToX<"u"?a.scrollYToX:!1,mouseWheelScrollSensitivity:typeof a.mouseWheelScrollSensitivity<"u"?a.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof a.fastScrollSensitivity<"u"?a.fastScrollSensitivity:5,scrollPredominantAxis:typeof a.scrollPredominantAxis<"u"?a.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof a.mouseWheelSmoothScroll<"u"?a.mouseWheelSmoothScroll:!0,inertialScroll:typeof a.inertialScroll<"u"?a.inertialScroll:!1,arrowSize:typeof a.arrowSize<"u"?a.arrowSize:11,listenOnDomNode:typeof a.listenOnDomNode<"u"?a.listenOnDomNode:null,horizontal:typeof a.horizontal<"u"?a.horizontal:1,horizontalScrollbarSize:typeof a.horizontalScrollbarSize<"u"?a.horizontalScrollbarSize:10,horizontalSliderSize:typeof a.horizontalSliderSize<"u"?a.horizontalSliderSize:0,horizontalHasArrows:typeof a.horizontalHasArrows<"u"?a.horizontalHasArrows:!1,vertical:typeof a.vertical<"u"?a.vertical:1,verticalScrollbarSize:typeof a.verticalScrollbarSize<"u"?a.verticalScrollbarSize:10,verticalHasArrows:typeof a.verticalHasArrows<"u"?a.verticalHasArrows:!1,verticalSliderSize:typeof a.verticalSliderSize<"u"?a.verticalSliderSize:0,scrollByPage:typeof a.scrollByPage<"u"?a.scrollByPage:!1};return i.horizontalSliderSize=typeof a.horizontalSliderSize<"u"?a.horizontalSliderSize:i.horizontalScrollbarSize,i.verticalSliderSize=typeof a.verticalSliderSize<"u"?a.verticalSliderSize:i.verticalScrollbarSize,Ze&&(i.className+=" mac"),i}var hbt=class extends x{constructor(e,t,o,n){super();this._context=e;this._viewHelper=t;this._mouseTargetFactory=o;this._dispatchMouse=n;this._operation=null}dispose(){super.dispose(),this.stop()}start(e,t){this._operation?this._operation.setPosition(e,t):this._operation=this._createDragScrollingOperation(e,t)}stop(){this._operation&&(this._operation.dispose(),this._operation=null)}},gbt=class extends x{constructor(e,t,o,n,r,s){super();this._context=e;this._viewHelper=t;this._mouseTargetFactory=o;this._dispatchMouse=n;this._position=r,this._mouseEvent=s,this._lastTime=Date.now(),this._animationFrameDisposable=Wr(Re(s.browserEvent),()=>this._execute())}dispose(){this._animationFrameDisposable.dispose(),super.dispose()}setPosition(e,t){this._position=e,this._mouseEvent=t}_tick(){let e=Date.now(),t=e-this._lastTime;return this._lastTime=e,t}},fbt=class extends hbt{_createDragScrollingOperation(i,e){return new Uti(this._context,this._viewHelper,this._mouseTargetFactory,this._dispatchMouse,i,e)}},Uti=class extends gbt{_getScrollSpeed(){let i=this._context.configuration.options.get(75),e=this._context.configuration.options.get(165).height/i,t=this._position.outsideDistance/i;return t<=1.5?Math.max(30,e*(1+t)):t<=3?Math.max(60,e*(2+t)):Math.max(200,e*(7+t))}_execute(){let i=this._context.configuration.options.get(75),e=this._getScrollSpeed(),t=this._tick(),o=e*(t/1e3)*i,n=this._position.outsidePosition==="above"?-o:o;this._context.viewModel.viewLayout.deltaScrollNow(0,n),this._viewHelper.renderNow();let r=this._context.viewLayout.getLinesViewportData(),s=this._position.outsidePosition==="above"?r.startLineNumber:r.endLineNumber,l=this._position.outsidePosition==="above"?r.startLineNumber===1:r.endLineNumber===this._context.viewModel.getLineCount(),c;{let u=$ye(this._viewHelper.viewDomNode),p=this._context.configuration.options.get(165).horizontalScrollbarHeight,h=new mj(this._mouseEvent.pos.x,u.y+u.height-p-.1),g=jye(this._viewHelper.viewDomNode,u,h);c=this._mouseTargetFactory.createMouseTarget(this._viewHelper.getLastRenderData(),u,h,g,null)}(!c.position||c.position.lineNumber!==s||l)&&(this._position.outsidePosition==="above"?c=wv.createOutsideEditor(this._position.mouseColumn,new ye(s,1),"above",this._position.outsideDistance):c=wv.createOutsideEditor(this._position.mouseColumn,new ye(s,this._context.viewModel.getLineMaxColumn(s)),"below",this._position.outsideDistance)),this._dispatchMouse(c,!0,2),this._animationFrameDisposable=Wr(Re(c.element),()=>this._execute())}},vbt=class extends hbt{_createDragScrollingOperation(i,e){return new zti(this._context,this._viewHelper,this._mouseTargetFactory,this._dispatchMouse,i,e)}},zti=class extends gbt{_getScrollSpeed(){let i=this._context.configuration.options.get(59).typicalFullwidthCharacterWidth,e=this._context.configuration.options.get(165).contentWidth/i,t=this._position.outsideDistance/i;return t<=1.5?Math.max(30,e*(1+t)):t<=3?Math.max(60,e*(2+t)):Math.max(200,e*(7+t))}_execute(){let i=this._context.configuration.options.get(59).typicalFullwidthCharacterWidth,e=this._getScrollSpeed(),t=this._tick(),o=e*(t/1e3)*i*.5,n=this._position.outsidePosition==="left"?-o:o;if(this._context.viewModel.viewLayout.deltaScrollNow(n,0),this._viewHelper.renderNow(),!this._position.position)return;let r=this._position.position.lineNumber,s;{let l=$ye(this._viewHelper.viewDomNode),c=this._context.configuration.options.get(165).horizontalScrollbarHeight,u=new mj(this._mouseEvent.pos.x,l.y+l.height-c-.1),p=jye(this._viewHelper.viewDomNode,l,u);s=this._mouseTargetFactory.createMouseTarget(this._viewHelper.getLastRenderData(),l,u,p,null)}this._position.outsidePosition==="left"?s=wv.createOutsideEditor(s.mouseColumn,new ye(r,s.mouseColumn),"left",this._position.outsideDistance):s=wv.createOutsideEditor(s.mouseColumn,new ye(r,s.mouseColumn),"right",this._position.outsideDistance),this._dispatchMouse(s,!0,2),this._animationFrameDisposable=Wr(Re(s.element),()=>this._execute())}};var nwe=class extends wE{constructor(e,t,o){super();this._mouseLeaveMonitor=null;this._context=e,this.viewController=t,this.viewHelper=o,this.mouseTargetFactory=new iwe(this._context,o),this._mouseDownOperation=this._register(new Kti(this._context,this.viewController,this.viewHelper,this.mouseTargetFactory,(s,l)=>this._createMouseTarget(s,l),s=>this._getMouseColumn(s))),this.lastMouseLeaveTime=-1,this._height=this._context.configuration.options.get(165).height;let n=new Xvt(this.viewHelper.viewDomNode);this._register(n.onContextMenu(this.viewHelper.viewDomNode,s=>this._onContextMenu(s,!0))),this._register(n.onMouseMove(this.viewHelper.viewDomNode,s=>{this._onMouseMove(s),this._mouseLeaveMonitor||(this._mouseLeaveMonitor=j(this.viewHelper.viewDomNode.ownerDocument,"mousemove",l=>{this.viewHelper.viewDomNode.contains(l.target)||this._onMouseLeave(new YL(l,!1,this.viewHelper.viewDomNode))}))})),this._register(n.onMouseUp(this.viewHelper.viewDomNode,s=>this._onMouseUp(s))),this._register(n.onMouseLeave(this.viewHelper.viewDomNode,s=>this._onMouseLeave(s)));let r=0;this._register(n.onPointerDown(this.viewHelper.viewDomNode,(s,l)=>{r=l})),this._register(j(this.viewHelper.viewDomNode,re.POINTER_UP,s=>{this._mouseDownOperation.onPointerUp()})),this._register(n.onMouseDown(this.viewHelper.viewDomNode,s=>this._onMouseDown(s,r))),this._setupMouseWheelZoomListener(),this._context.addEventHandler(this)}_setupMouseWheelZoomListener(){let e=X1.INSTANCE,t=0,o=fE.getZoomLevel(),n=!1,r=0,s=c=>{if(this.viewController.emitMouseWheel(c),!this._context.configuration.options.get(84))return;let u=new p_(c);if(e.acceptStandardWheelEvent(u),e.isPhysicalMouseWheel()){if(l(c)){let p=fE.getZoomLevel(),h=u.deltaY>0?1:-1;fE.setZoomLevel(p+h),u.preventDefault(),u.stopPropagation()}}else Date.now()-t>50&&(o=fE.getZoomLevel(),n=l(c),r=0),t=Date.now(),r+=u.deltaY,n&&(fE.setZoomLevel(o+r/5),u.preventDefault(),u.stopPropagation())};this._register(j(this.viewHelper.viewDomNode,re.MOUSE_WHEEL,s,{capture:!0,passive:!1}));function l(c){return Ze?(c.metaKey||c.ctrlKey)&&!c.shiftKey&&!c.altKey:c.ctrlKey&&!c.metaKey&&!c.shiftKey&&!c.altKey}}dispose(){this._context.removeEventHandler(this),this._mouseLeaveMonitor&&(this._mouseLeaveMonitor.dispose(),this._mouseLeaveMonitor=null),super.dispose()}onConfigurationChanged(e){if(e.hasChanged(165)){let t=this._context.configuration.options.get(165).height;this._height!==t&&(this._height=t,this._mouseDownOperation.onHeightChanged())}return!1}onCursorStateChanged(e){return this._mouseDownOperation.onCursorStateChanged(e),!1}onFocusChanged(e){return!1}getTargetAtClientPoint(e,t){let n=new jje(e,t).toPageCoordinates(Re(this.viewHelper.viewDomNode)),r=$ye(this.viewHelper.viewDomNode);if(n.y<r.y||n.y>r.y+r.height||n.x<r.x||n.x>r.x+r.width)return null;let s=jye(this.viewHelper.viewDomNode,r,n);return this.mouseTargetFactory.createMouseTarget(this.viewHelper.getLastRenderData(),r,n,s,null)}_createMouseTarget(e,t){let o=e.target;if(!this.viewHelper.viewDomNode.contains(o)){let n=bP(this.viewHelper.viewDomNode);n&&(o=n.elementsFromPoint(e.posx,e.posy).find(s=>this.viewHelper.viewDomNode.contains(s))??null)}return this.mouseTargetFactory.createMouseTarget(this.viewHelper.getLastRenderData(),e.editorPos,e.pos,e.relativePos,t?o:null)}_getMouseColumn(e){return this.mouseTargetFactory.getMouseColumn(e.relativePos)}_onContextMenu(e,t){this.viewController.emitContextMenu({event:e,target:this._createMouseTarget(e,t)})}_onMouseMove(e){this.mouseTargetFactory.mouseTargetIsWidget(e)||e.preventDefault(),!(this._mouseDownOperation.isActive()||e.timestamp<this.lastMouseLeaveTime)&&this.viewController.emitMouseMove({event:e,target:this._createMouseTarget(e,!0)})}_onMouseLeave(e){this._mouseLeaveMonitor&&(this._mouseLeaveMonitor.dispose(),this._mouseLeaveMonitor=null),this.lastMouseLeaveTime=new Date().getTime(),this.viewController.emitMouseLeave({event:e,target:null})}_onMouseUp(e){this.viewController.emitMouseUp({event:e,target:this._createMouseTarget(e,!0)})}_onMouseDown(e,t){let o=this._createMouseTarget(e,!0),n=o.type===6||o.type===7,r=o.type===2||o.type===3||o.type===4,s=o.type===3,l=this._context.configuration.options.get(125),c=o.type===8||o.type===5,u=o.type===9,p=e.leftButton||e.middleButton;Ze&&e.leftButton&&e.ctrlKey&&(p=!1);let h=()=>{e.preventDefault(),this.viewHelper.focusTextArea()};if(p&&(n||s&&l))h(),this._mouseDownOperation.start(o.type,e,t);else if(r)e.preventDefault();else if(c){let g=o.detail;p&&this.viewHelper.shouldSuppressMouseDownOnViewZone(g.viewZoneId)&&(h(),this._mouseDownOperation.start(o.type,e,t),e.preventDefault())}else u&&this.viewHelper.shouldSuppressMouseDownOnWidget(o.detail)&&(h(),e.preventDefault());this.viewController.emitMouseDown({event:e,target:o})}_onMouseWheel(e){this.viewController.emitMouseWheel(e)}},Kti=class extends x{constructor(e,t,o,n,r,s){super();this._context=e;this._viewController=t;this._viewHelper=o;this._mouseTargetFactory=n;this._createMouseTarget=r,this._getMouseColumn=s,this._mouseMoveMonitor=this._register(new Zvt(this._viewHelper.viewDomNode)),this._topBottomDragScrolling=this._register(new fbt(this._context,this._viewHelper,this._mouseTargetFactory,(l,c,u)=>this._dispatchMouse(l,c,u))),this._leftRightDragScrolling=this._register(new vbt(this._context,this._viewHelper,this._mouseTargetFactory,(l,c,u)=>this._dispatchMouse(l,c,u))),this._mouseState=new Gti,this._currentSelection=new ti(1,1,1,1),this._isActive=!1,this._lastMouseEvent=null}dispose(){super.dispose()}isActive(){return this._isActive}_onMouseDownThenMove(e){this._lastMouseEvent=e,this._mouseState.setModifiers(e);let t=this._findMousePosition(e,!1);t&&(this._mouseState.isDragAndDrop?this._viewController.emitMouseDrag({event:e,target:t}):t.type===13?t.outsidePosition==="above"||t.outsidePosition==="below"?(this._topBottomDragScrolling.start(t,e),this._leftRightDragScrolling.stop()):(this._leftRightDragScrolling.start(t,e),this._topBottomDragScrolling.stop()):(this._topBottomDragScrolling.stop(),this._leftRightDragScrolling.stop(),this._dispatchMouse(t,!0,1)))}start(e,t,o){this._lastMouseEvent=t,this._mouseState.setStartedOnLineNumbers(e===3),this._mouseState.setStartButtons(t),this._mouseState.setModifiers(t);let n=this._findMousePosition(t,!0);if(!n||!n.position)return;this._mouseState.trySetCount(t.detail,n.position),t.detail=this._mouseState.count;let r=this._context.configuration.options;if(!r.get(104)&&r.get(42)&&!r.get(28)&&!this._mouseState.altKey&&t.detail<2&&!this._isActive&&!this._currentSelection.isEmpty()&&n.type===6&&n.position&&this._currentSelection.containsPosition(n.position)){this._mouseState.isDragAndDrop=!0,this._isActive=!0,this._mouseMoveMonitor.startMonitoring(this._viewHelper.viewLinesDomNode,o,t.buttons,s=>this._onMouseDownThenMove(s),s=>{let l=this._findMousePosition(this._lastMouseEvent,!1);xg(s)?this._viewController.emitMouseDropCanceled():this._viewController.emitMouseDrop({event:this._lastMouseEvent,target:l?this._createMouseTarget(this._lastMouseEvent,!0):null}),this._stop()});return}this._mouseState.isDragAndDrop=!1,this._dispatchMouse(n,t.shiftKey,1),this._isActive||(this._isActive=!0,this._mouseMoveMonitor.startMonitoring(this._viewHelper.viewLinesDomNode,o,t.buttons,s=>this._onMouseDownThenMove(s),()=>this._stop()))}_stop(){this._isActive=!1,this._topBottomDragScrolling.stop(),this._leftRightDragScrolling.stop()}onHeightChanged(){this._mouseMoveMonitor.stopMonitoring()}onPointerUp(){this._mouseMoveMonitor.stopMonitoring()}onCursorStateChanged(e){this._currentSelection=e.selections[0]}_getPositionOutsideEditor(e){let t=e.editorPos,o=this._context.viewModel,n=this._context.viewLayout,r=this._getMouseColumn(e);if(e.posy<t.y){let h=t.y-e.posy,g=Math.max(n.getCurrentScrollTop()-h,0),f=twe.getZoneAtCoord(this._context,g);if(f){let b=this._helpPositionJumpOverViewZone(f);if(b)return wv.createOutsideEditor(r,b,"above",h)}let v=n.getLineNumberAtVerticalOffset(g);return wv.createOutsideEditor(r,new ye(v,1),"above",h)}if(e.posy>t.y+t.height){let h=e.posy-t.y-t.height,g=n.getCurrentScrollTop()+e.relativePos.y,f=twe.getZoneAtCoord(this._context,g);if(f){let b=this._helpPositionJumpOverViewZone(f);if(b)return wv.createOutsideEditor(r,b,"below",h)}let v=n.getLineNumberAtVerticalOffset(g);return wv.createOutsideEditor(r,new ye(v,o.getLineMaxColumn(v)),"below",h)}let s=n.getLineNumberAtVerticalOffset(n.getCurrentScrollTop()+e.relativePos.y),l=this._context.configuration.options.get(165),c=l.contentLeft;if(e.relativePos.x<=c){let h=c-e.relativePos.x,g=o.getTextDirection(s)===1;return wv.createOutsideEditor(r,new ye(s,g?o.getLineMaxColumn(s):1),"left",h)}let p=l.minimap.minimapLeft===0?l.width-l.verticalScrollbarWidth:l.minimap.minimapLeft;if(e.relativePos.x>=p){let h=e.relativePos.x-p,g=o.getTextDirection(s)===1;return wv.createOutsideEditor(r,new ye(s,g?1:o.getLineMaxColumn(s)),"right",h)}return null}_findMousePosition(e,t){let o=this._getPositionOutsideEditor(e);if(o)return o;let n=this._createMouseTarget(e,t);if(!n.position)return null;if(n.type===8||n.type===5){let s=this._helpPositionJumpOverViewZone(n.detail);if(s)return wv.createViewZone(n.type,n.element,n.mouseColumn,s,n.detail)}return n}_helpPositionJumpOverViewZone(e){let t=new ye(this._currentSelection.selectionStartLineNumber,this._currentSelection.selectionStartColumn),o=e.positionBefore,n=e.positionAfter;return o&&n?o.isBefore(t)?o:n:null}_dispatchMouse(e,t,o){e.position&&this._viewController.dispatchMouse({position:e.position,mouseColumn:e.mouseColumn,startedOnLineNumbers:this._mouseState.startedOnLineNumbers,revealType:o,inSelectionMode:t,mouseDownCount:this._mouseState.count,altKey:this._mouseState.altKey,ctrlKey:this._mouseState.ctrlKey,metaKey:this._mouseState.metaKey,shiftKey:this._mouseState.shiftKey,leftButton:this._mouseState.leftButton,middleButton:this._mouseState.middleButton,onInjectedText:e.type===6&&e.detail.injectedText!==null})}},Gti=class a{static{this.CLEAR_MOUSE_DOWN_COUNT_TIME=400}get altKey(){return this._altKey}get ctrlKey(){return this._ctrlKey}get metaKey(){return this._metaKey}get shiftKey(){return this._shiftKey}get leftButton(){return this._leftButton}get middleButton(){return this._middleButton}get startedOnLineNumbers(){return this._startedOnLineNumbers}constructor(){this._altKey=!1,this._ctrlKey=!1,this._metaKey=!1,this._shiftKey=!1,this._leftButton=!1,this._middleButton=!1,this._startedOnLineNumbers=!1,this._lastMouseDownPosition=null,this._lastMouseDownPositionEqualCount=0,this._lastMouseDownCount=0,this._lastSetMouseDownCountTime=0,this.isDragAndDrop=!1}get count(){return this._lastMouseDownCount}setModifiers(i){this._altKey=i.altKey,this._ctrlKey=i.ctrlKey,this._metaKey=i.metaKey,this._shiftKey=i.shiftKey}setStartButtons(i){this._leftButton=i.leftButton,this._middleButton=i.middleButton}setStartedOnLineNumbers(i){this._startedOnLineNumbers=i}trySetCount(i,e){let t=new Date().getTime();t-this._lastSetMouseDownCountTime>a.CLEAR_MOUSE_DOWN_COUNT_TIME&&(i=1),this._lastSetMouseDownCountTime=t,i>this._lastMouseDownCount+1&&(i=this._lastMouseDownCount+1),this._lastMouseDownPosition&&this._lastMouseDownPosition.equals(e)?this._lastMouseDownPositionEqualCount++:this._lastMouseDownPositionEqualCount=1,this._lastMouseDownPosition=e,this._lastMouseDownCount=Math.min(i,this._lastMouseDownPositionEqualCount)}};var Gn=class{get event(){return this.emitter.event}constructor(i,e,t){let o=n=>this.emitter.fire(n);this.emitter=new E({onWillAddFirstListener:()=>i.addEventListener(e,o,t),onDidRemoveLastListener:()=>i.removeEventListener(e,o,t)})}dispose(){this.emitter.dispose()}};var QWo=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function bbt(a){return QWo.test(a)}var xt=(function(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID.bind(crypto);let a=new Uint8Array(16),i=[];for(let e=0;e<256;e++)i.push(e.toString(16).padStart(2,"0"));return function(){crypto.getRandomValues(a),a[6]=a[6]&15|64,a[8]=a[8]&63|128;let t=0,o="";return o+=i[a[t++]],o+=i[a[t++]],o+=i[a[t++]],o+=i[a[t++]],o+="-",o+=i[a[t++]],o+=i[a[t++]],o+="-",o+=i[a[t++]],o+=i[a[t++]],o+="-",o+=i[a[t++]],o+=i[a[t++]],o+="-",o+=i[a[t++]],o+=i[a[t++]],o+=i[a[t++]],o+=i[a[t++]],o+=i[a[t++]],o+=i[a[t++]],o}})();function Sbt(a){return`${a}-${xt()}`}var rwe=class extends x{constructor(e,t){super();this.timeout=void 0;this._register(j(e,"dragover",o=>{o.preventDefault(),this.timeout||(this.timeout=setTimeout(()=>{t(),this.timeout=void 0},800))})),["dragleave","drop","dragend"].forEach(o=>{this._register(j(e,o,()=>{this.clearDragTimeout()}))})}clearDragTimeout(){this.timeout&&(clearTimeout(this.timeout),this.timeout=void 0)}dispose(){super.dispose(),this.clearDragTimeout()}},yl={RESOURCES:"ResourceURLs",DOWNLOAD_URL:"DownloadURL",FILES:"Files",TEXT:tr.text,INTERNAL_URI_LIST:"application/vnd.code.uri-list"};function DO(a,i){return{id:i,asString:async()=>a,asFile:()=>{},value:typeof a=="string"?a:void 0}}function z4i(a,i,e,t){let o={id:xt(),name:a,uri:i,data:e};return{id:t,asString:async()=>"",asFile:()=>o,value:void 0}}var qx=class{constructor(){this._entries=new Map}get size(){let i=0;for(let e of this._entries)i++;return i}has(i){return this._entries.has(this.toKey(i))}matches(i){let e=[...this._entries.keys()];return vt.some(this,([t,o])=>o.asFile())&&e.push("files"),K4i(Ibt(i),e)}get(i){return this._entries.get(this.toKey(i))?.[0]}append(i,e){let t=this._entries.get(i);t?t.push(e):this._entries.set(this.toKey(i),[e])}replace(i,e){this._entries.set(this.toKey(i),[e])}delete(i){this._entries.delete(this.toKey(i))}*[Symbol.iterator](){for(let[i,e]of this._entries)for(let t of e)yield[i,t]}toKey(i){return Ibt(i)}};function Ibt(a){return a.toLowerCase()}function Zje(a,i){return K4i(Ibt(a),i.map(Ibt))}function K4i(a,i){if(a==="*/*")return i.length>0;if(i.includes(a))return!0;let e=a.match(/^([a-z]+)\/([a-z]+|\*)$/i);if(!e)return!1;let[t,o,n]=e;return n==="*"?i.some(r=>r.startsWith(o+"/")):!1}var aw=Object.freeze({create:a=>zo(a.map(i=>i.toString())).join(`\r
`),split:a=>a.split(`\r
`),parse:a=>aw.split(a).filter(i=>!i.startsWith("#"))});function swe(a){return JSON.stringify(a,YWo)}function am(a){let i=JSON.parse(a);return i=$n(i),i}function YWo(a,i){return i instanceof RegExp?{$mid:2,source:i.source,flags:i.flags}:i}function $n(a,i=0){if(!a||i>200)return a;if(typeof a=="object"){switch(a.$mid){case 1:return A.revive(a);case 2:return new RegExp(a.source,a.flags);case 17:return new Date(a.source)}if(a instanceof qe||a instanceof Uint8Array)return a;if(Array.isArray(a))for(let e=0;e<a.length;++e)a[e]=$n(a[e],i+1);else for(let e in a)Object.hasOwnProperty.call(a,e)&&(a[e]=$n(a[e],i+1))}return a}var ybt=(o=>(o[o.Ignore=0]="Ignore",o[o.Info=1]="Info",o[o.Warning=2]="Warning",o[o.Error=3]="Error",o))(ybt||{});(s=>{let a="error",i="warning",e="warn",t="info",o="ignore";function n(l){return l?vr(a,l)?3:vr(i,l)||vr(e,l)?2:vr(t,l)?1:0:0}s.fromValue=n;function r(l){switch(l){case 3:return a;case 2:return i;case 1:return t;default:return o}}s.toString=r})(ybt||={});var bt=ybt;function $4i(a,i){let{os:e,tildify:t,relative:o}=i;if(o){let s=XWo(a,o,e);if(typeof s=="string")return s}let n=a.fsPath;if(e===1&&!ei?n=n.replace(/\//g,"\\"):e!==1&&ei&&(n=n.replace(/\\/g,"/")),e!==1&&t?.userHome){let s=t.userHome.fsPath,l;a.scheme!==t.userHome.scheme&&a.path[0]===Oo.sep&&a.path[1]!==Oo.sep?l=t.userHome.with({path:a.path}).fsPath:l=n,n=i5e(l,s,e)}return(e===1?$s:Oo).normalize(Hp(n,e===1))}function XWo(a,i,e){let t=e===1?$s:Oo,o=e===3?ar:Ax,n=i.getWorkspace(),r=n.folders.at(0);if(!r)return;a.scheme!==r.uri.scheme&&a.path[0]===Oo.sep&&a.path[1]!==Oo.sep&&(a=r.uri.with({path:a.path}));let s=i.getWorkspaceFolder(a);if(!s)return;let l;if(o.isEqual(s.uri,a)?l="":l=o.relativePath(s.uri,a)??"",l&&(l=t.normalize(l)),n.folders.length>1&&!i.noPrefix){let c=s.name?s.name:o.basenameOrAuthority(s.uri);l=l?`${c} \u2022 ${l}`:c}return l}function Hp(a,i=ei){return V9(a,i)?a.charAt(0).toUpperCase()+a.slice(1):a}var qti=Object.create(null);function i5e(a,i,e=Po){if(e===1||!a||!i)return a;let t=qti.original===i?qti.normalized:void 0;t||(t=i,ei&&(t=f1(t)),t=`${dh(t,Oo.sep)}${Oo.sep}`,qti={original:i,normalized:t});let o=a;return ei&&(o=f1(o)),(e===3?o.startsWith(t):mE(o,t))?`~/${o.substr(t.length)}`:a}function F7(a,i){return a.replace(/^~($|\/|\\)/,`${i}$1`)}var G4i="\u2026",e5e="\\\\",t5e="~";function awe(a,i=Qd){let e=new Array(a.length),t=!1;for(let o=0;o<a.length;o++){let n=a[o];if(n===""){e[o]=`.${i}`;continue}if(!n){e[o]=n;continue}t=!0;let r="",s=n;s.indexOf(e5e)===0?(r=s.substr(0,s.indexOf(e5e)+e5e.length),s=s.substr(s.indexOf(e5e)+e5e.length)):s.indexOf(i)===0?(r=s.substr(0,s.indexOf(i)+i.length),s=s.substr(s.indexOf(i)+i.length)):s.indexOf(t5e)===0&&(r=s.substr(0,s.indexOf(t5e)+t5e.length),s=s.substr(s.indexOf(t5e)+t5e.length));let l=s.split(i);for(let c=1;t&&c<=l.length;c++)for(let u=l.length-c;t&&u>=0;u--){t=!1;let p=l.slice(u,u+c).join(i);for(let h=0;!t&&h<a.length;h++)if(h!==o&&a[h]&&a[h].indexOf(p)>-1){let g=u+c===l.length,f=u>0&&a[h].indexOf(i)>-1?i+p:p,v=a[h].endsWith(f);t=!g||v}if(!t){let h="";(l[0].endsWith(":")||r!=="")&&(u===1&&(u=0,c++,p=l[0]+i+p),u>0&&(h=l[0]+i),h=r+h),u>0&&(h=h+G4i+i),h=h+p,u+c<l.length&&(h=h+i+G4i),e[o]=h}}t&&(e[o]=n)}return e}function wbt(a,i=Object.create(null)){let e=[],t=!1,o="";for(let n of a)if(n==="$"||t&&n==="{")o&&e.push({value:o,type:0}),o="",t=!0;else if(n==="}"&&t){let r=i[o];if(typeof r=="string")r.length&&e.push({value:r,type:1});else if(r){let s=e[e.length-1];(!s||s.type!==2)&&e.push({value:r.label,type:2})}o="",t=!1}else o+=n;return o&&!t&&e.push({value:o,type:0}),e.filter((n,r)=>{if(n.type===2){let s=e[r-1],l=e[r+1];return[s,l].every(c=>c&&(c.type===1||c.type===0)&&c.value.length>0)}return!0}).map(n=>n.value).join("")}function fj(a,i){return Ze||i?a.replace(/\(&&\w\)|&&/g,"").replace(/&/g,Ze?"&":"&&"):a.replace(/&&|&/g,e=>e==="&"?"&&":"&")}function vj(a,i){let e=a.replace(/\(&&\w\)|&&/g,"");if(i)return e;if(Ze)return{withMnemonic:e,withoutMnemonic:e};let t;return ei?t=a.replace(/&&|&/g,o=>o==="&"?"&&":"&"):t=a.replace(/&&/g,"_"),{withMnemonic:t,withoutMnemonic:e}}function o5e(a){return a.replace(/&/g,"&&")}function Cbt(a){if(a.endsWith("]")){let i=a.lastIndexOf(" [",a.length-2);if(i!==-1){let e=q4i(a.substring(0,i)),t=a.substring(i);return{name:e.name+t,parentPath:e.parentPath}}}return q4i(a)}function q4i(a){let i=a.indexOf("/")!==-1?Oo:$s,e=i.basename(a),t=i.dirname(a);return e.length?{name:e,parentPath:t}:{name:t,parentPath:""}}var at=le("dialogService");var lwe=class{getConfirmationButtons(i){return this.getButtons(i,1)}getPromptButtons(i){return this.getButtons(i,2)}getInputButtons(i){return this.getButtons(i,3)}getButtons(i,e){let t=[];switch(e){case 1:{let o=i;o.primaryButton?t.push(o.primaryButton):t.push(d(1938,null)),o.cancelButton?t.push(o.cancelButton):t.push(d(1934,null));break}case 2:{let o=i;Array.isArray(o.buttons)&&o.buttons.length>0&&t.push(...o.buttons.map(n=>n.label)),o.cancelButton&&(o.cancelButton===!0?t.push(d(1934,null)):typeof o.cancelButton=="string"?t.push(o.cancelButton):o.cancelButton.label?t.push(o.cancelButton.label):t.push(d(1934,null))),t.length===0&&t.push(d(1937,null));break}case 3:{let o=i;o.primaryButton?t.push(o.primaryButton):t.push(d(1937,null)),o.cancelButton?t.push(o.cancelButton):t.push(d(1934,null));break}}return t}getDialogType(i){if(typeof i=="string")return i;if(typeof i=="number")return i===bt.Info?"info":i===bt.Error?"error":i===bt.Warning?"warning":"none"}getPromptResult(i,e,t){let o=[...i.buttons??[]];i.cancelButton&&typeof i.cancelButton!="string"&&typeof i.cancelButton!="boolean"&&o.push(i.cancelButton);let n=o[e]?.run({checkboxChecked:t});return n instanceof Promise||(n=Promise.resolve(n)),{result:n,checkboxChecked:t}}},rn=le("fileDialogService");var xbt=10;function kC(a){let i=[];return i.push(...a.slice(0,xbt).map(e=>typeof e=="string"?e:He(e))),a.length>xbt&&(a.length-xbt===1?i.push(d(1935,null)):i.push(d(1936,null,a.length-xbt))),i.push(""),i.join(`
`)}var $ti=class{constructor(){this._value="";this._pos=0}reset(i){return this._value=i,this._pos=0,this}next(){return this._pos+=1,this}hasNext(){return this._pos<this._value.length-1}cmp(i){let e=i.charCodeAt(0),t=this._value.charCodeAt(this._pos);return e-t}value(){return this._value[this._pos]}},jti=class{constructor(i=!0){this._caseSensitive=i}reset(i){return this._value=i,this._from=0,this._to=0,this.next()}hasNext(){return this._to<this._value.length}next(){this._from=this._to;let i=!0;for(;this._to<this._value.length;this._to++)if(this._value.charCodeAt(this._to)===46)if(i)this._from++;else break;else i=!1;return this}cmp(i){return this._caseSensitive?dIe(i,this._value,0,i.length,this._from,this._to):jse(i,this._value,0,i.length,this._from,this._to)}value(){return this._value.substring(this._from,this._to)}},W7=class{constructor(i=!0,e=!0){this._splitOnBackslash=i;this._caseSensitive=e}reset(i){this._from=0,this._to=0,this._value=i,this._valueLen=i.length;for(let e=i.length-1;e>=0;e--,this._valueLen--){let t=this._value.charCodeAt(e);if(!(t===47||this._splitOnBackslash&&t===92))break}return this.next()}hasNext(){return this._to<this._valueLen}next(){this._from=this._to;let i=!0;for(;this._to<this._valueLen;this._to++){let e=this._value.charCodeAt(this._to);if(e===47||this._splitOnBackslash&&e===92)if(i)this._from++;else break;else i=!1}return this}cmp(i){return this._caseSensitive?dIe(i,this._value,0,i.length,this._from,this._to):jse(i,this._value,0,i.length,this._from,this._to)}value(){return this._value.substring(this._from,this._to)}};var Qti=class{constructor(i,e){this._ignorePathCasing=i;this._ignoreQueryAndFragment=e;this._states=[];this._stateIdx=0}reset(i){return this._value=i,this._states=[],this._value.scheme&&this._states.push(1),this._value.authority&&this._states.push(2),this._value.path&&(this._pathIterator=new W7(!1,!this._ignorePathCasing(i)),this._pathIterator.reset(i.path),this._pathIterator.value()&&this._states.push(3)),this._ignoreQueryAndFragment(i)||(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(i){if(this._states[this._stateIdx]===1)return OI(i,this._value.scheme);if(this._states[this._stateIdx]===2)return OI(i,this._value.authority);if(this._states[this._stateIdx]===3)return this._pathIterator.cmp(i);if(this._states[this._stateIdx]===4)return Hl(i,this._value.query);if(this._states[this._stateIdx]===5)return Hl(i,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}},bj=class a{static{this.Val=Symbol("undefined_placeholder")}static wrap(i){return i===void 0?a.Val:i}static unwrap(i){return i===a.Val?void 0:i}},cwe=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 i=this.right;return this.right=i.left,i.left=this,this.updateHeight(),i.updateHeight(),i}rotateRight(){let i=this.left;return this.left=i.right,i.right=this,this.updateHeight(),i.updateHeight(),i}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 Sp=class a{static forUris(i=()=>!1,e=()=>!1){return new a(new Qti(i,e))}static forPaths(i=!1){return new a(new W7(void 0,!i))}static forStrings(){return new a(new $ti)}static forConfigKeys(){return new a(new jti)}constructor(i){this._iter=i}clear(){this._root=void 0}fill(i,e){if(e){let t=e.slice(0);R9(t);for(let o of t)this.set(o,i)}else{let t=i.slice(0);R9(t);for(let o of t)this.set(o[0],o[1])}}set(i,e){let t=this._iter.reset(i),o;this._root||(this._root=new cwe,this._root.segment=t.value());let n=[];for(o=this._root;;){let s=t.cmp(o.segment);if(s>0)o.left||(o.left=new cwe,o.left.segment=t.value()),n.push([-1,o]),o=o.left;else if(s<0)o.right||(o.right=new cwe,o.right.segment=t.value()),n.push([1,o]),o=o.right;else if(t.hasNext())t.next(),o.mid||(o.mid=new cwe,o.mid.segment=t.value()),n.push([0,o]),o=o.mid;else break}let r=bj.unwrap(o.value);o.value=bj.wrap(e),o.key=i;for(let s=n.length-1;s>=0;s--){let l=n[s][1];l.updateHeight();let c=l.balanceFactor();if(c<-1||c>1){let u=n[s][0],p=n[s+1][0];if(u===1&&p===1)n[s][1]=l.rotateLeft();else if(u===-1&&p===-1)n[s][1]=l.rotateRight();else if(u===1&&p===-1)l.right=n[s+1][1]=n[s+1][1].rotateRight(),n[s][1]=l.rotateLeft();else if(u===-1&&p===1)l.left=n[s+1][1]=n[s+1][1].rotateLeft(),n[s][1]=l.rotateRight();else throw new Error;if(s>0)switch(n[s-1][0]){case-1:n[s-1][1].left=n[s][1];break;case 1:n[s-1][1].right=n[s][1];break;case 0:n[s-1][1].mid=n[s][1];break}else this._root=n[0][1]}}return r}get(i){return bj.unwrap(this._getNode(i)?.value)}_getNode(i){let e=this._iter.reset(i),t=this._root;for(;t;){let o=e.cmp(t.segment);if(o>0)t=t.left;else if(o<0)t=t.right;else if(e.hasNext())e.next(),t=t.mid;else break}return t}has(i){let e=this._getNode(i);return!(e?.value===void 0&&e?.mid===void 0)}delete(i){return this._delete(i,!1)}deleteSuperstr(i){return this._delete(i,!0)}_delete(i,e){let t=this._iter.reset(i),o=[],n=this._root;for(;n;){let r=t.cmp(n.segment);if(r>0)o.push([-1,n]),n=n.left;else if(r<0)o.push([1,n]),n=n.right;else if(t.hasNext())t.next(),o.push([0,n]),n=n.mid;else break}if(n){if(e?(n.left=void 0,n.mid=void 0,n.right=void 0,n.height=1):(n.key=void 0,n.value=void 0),!n.mid&&!n.value)if(n.left&&n.right){let r=[[1,n]],s=this._min(n.right,r);if(s.key){n.key=s.key,n.value=s.value,n.segment=s.segment;let l=s.right;if(r.length>1){let[u,p]=r[r.length-1];switch(u){case-1:p.left=l;break;case 0:qy(!1);case 1:qy(!1)}}else n.right=l;let c=this._balanceByStack(r);if(o.length>0){let[u,p]=o[o.length-1];switch(u){case-1:p.left=c;break;case 0:p.mid=c;break;case 1:p.right=c;break}}else this._root=c}}else{let r=n.left??n.right;if(o.length>0){let[s,l]=o[o.length-1];switch(s){case-1:l.left=r;break;case 0:l.mid=r;break;case 1:l.right=r;break}}else this._root=r}this._root=this._balanceByStack(o)??this._root}}_min(i,e){for(;i.left;)e.push([-1,i]),i=i.left;return i}_balanceByStack(i){for(let e=i.length-1;e>=0;e--){let t=i[e][1];t.updateHeight();let o=t.balanceFactor();if(o>1?(t.right.balanceFactor()>=0||(t.right=t.right.rotateRight()),i[e][1]=t.rotateLeft()):o<-1&&(t.left.balanceFactor()<=0||(t.left=t.left.rotateLeft()),i[e][1]=t.rotateRight()),e>0)switch(i[e-1][0]){case-1:i[e-1][1].left=i[e][1];break;case 1:i[e-1][1].right=i[e][1];break;case 0:i[e-1][1].mid=i[e][1];break}else return i[0][1]}}findSubstr(i){let e=this._iter.reset(i),t=this._root,o;for(;t;){let n=e.cmp(t.segment);if(n>0)t=t.left;else if(n<0)t=t.right;else if(e.hasNext())e.next(),o=bj.unwrap(t.value)||o,t=t.mid;else break}return t&&bj.unwrap(t.value)||o}findSuperstr(i){return this._findSuperstrOrElement(i,!1)}_findSuperstrOrElement(i,e){let t=this._iter.reset(i),o=this._root;for(;o;){let n=t.cmp(o.segment);if(n>0)o=o.left;else if(n<0)o=o.right;else if(t.hasNext())t.next(),o=o.mid;else return o.mid?this._entries(o.mid):e?bj.unwrap(o.value):void 0}}hasElementOrSubtree(i){return this._findSuperstrOrElement(i,!0)!==void 0}forEach(i){for(let[e,t]of this)i(t,e)}*[Symbol.iterator](){yield*this._entries(this._root)}_entries(i){let e=[];return this._dfsEntries(i,e),e[Symbol.iterator]()}_dfsEntries(i,e){i&&(i.left&&this._dfsEntries(i.left,e),i.value!==void 0&&e.push([i.key,bj.unwrap(i.value)]),i.mid&&this._dfsEntries(i.mid,e),i.right&&this._dfsEntries(i.right,e))}_isBalanced(){let i=e=>{if(!e)return!0;let t=e.balanceFactor();return t<-1||t>1?!1:i(e.left)&&i(e.right)};return i(this._root)}};var fe=le("fileService");function j4i(a){return a.create===!0}function D_(a){return!!(a.capabilities&2)}function Q4i(a){return!!(a.capabilities&524288)}function n5e(a){return!!(a.capabilities&8)}function kbt(a){return!!(a.capabilities&131072)}function Y4i(a){return!!(a.capabilities&262144)}function Sj(a){return!!(a.capabilities&4)}function Ebt(a){return!!(a.capabilities&16)}function Tbt(a){return D_(a)?!!(a.capabilities&16384):!1}function Yti(a){return D_(a)?!!(a.capabilities&32768):!1}function X4i(a){return!!(a.capabilities&65536)}function J4i(a){return!!(a.capabilities&2048)}var dwe=class a extends Error{constructor(e,t){super(e);this.code=t}static create(e,t){let o=new a(e.toString(),t);return Xti(o,t),o}};function Ps(a,i){return dwe.create(a,i)}function Ij(a){return a||Ps(d(2130,null),"Unknown")}function Xti(a,i){return a.name=i?`${i} (FileSystemError)`:"FileSystemError",a}function Ile(a){if(!a)return"Unknown";if(a instanceof dwe)return a.code;let i=/^(.+) \(FileSystemError\)$/.exec(a.name);if(!i)return"Unknown";switch(i[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 Au(a){if(a instanceof ta)return a.fileOperationResult;switch(Ile(a)){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 LO=class{constructor(i,e,t){this.resource=i;this.operation=e;this.target=t}isOperation(i){return this.operation===i}};var RO=class a{constructor(i,e){this.ignorePathCasing=e;this.correlationId=void 0;this.added=new co(()=>{let i=Sp.forUris(()=>this.ignorePathCasing);return i.fill(this.rawAdded.map(e=>[e,!0])),i});this.updated=new co(()=>{let i=Sp.forUris(()=>this.ignorePathCasing);return i.fill(this.rawUpdated.map(e=>[e,!0])),i});this.deleted=new co(()=>{let i=Sp.forUris(()=>this.ignorePathCasing);return i.fill(this.rawDeleted.map(e=>[e,!0])),i});this.rawAdded=[];this.rawUpdated=[];this.rawDeleted=[];for(let t of i){switch(t.type){case 1:this.rawAdded.push(t.resource);break;case 0:this.rawUpdated.push(t.resource);break;case 2:this.rawDeleted.push(t.resource);break}this.correlationId!==a.MIXED_CORRELATION&&(typeof t.cId=="number"?this.correlationId===void 0?this.correlationId=t.cId:this.correlationId!==t.cId&&(this.correlationId=a.MIXED_CORRELATION):this.correlationId!==void 0&&(this.correlationId=a.MIXED_CORRELATION))}}static{this.MIXED_CORRELATION=null}contains(i,...e){return this.doContains(i,{includeChildren:!1},...e)}affects(i,...e){return this.doContains(i,{includeChildren:!0},...e)}doContains(i,e,...t){if(!i)return!1;let o=t.length>0;return!!((!o||t.includes(1))&&(this.added.value.get(i)||e.includeChildren&&this.added.value.findSuperstr(i))||(!o||t.includes(0))&&(this.updated.value.get(i)||e.includeChildren&&this.updated.value.findSuperstr(i))||(!o||t.includes(2))&&(this.deleted.value.findSubstr(i)||e.includeChildren&&this.deleted.value.findSuperstr(i)))}gotAdded(){return this.rawAdded.length>0}gotDeleted(){return this.rawDeleted.length>0}gotUpdated(){return this.rawUpdated.length>0}correlates(i){return this.correlationId===i}hasCorrelation(){return typeof this.correlationId=="number"}};var ta=class extends Error{constructor(e,t,o){super(e);this.fileOperationResult=t;this.options=o}},MO=class extends ta{constructor(e,t,o,n){super(e,t,n);this.fileOperationResult=t;this.size=o}},J1=class extends ta{constructor(e,t,o){super(e,2,o);this.stat=t}};var Cv={OFF:"off",AFTER_DELAY:"afterDelay",ON_FOCUS_CHANGE:"onFocusChange",ON_WINDOW_CHANGE:"onWindowChange"},XS={OFF:"off",ON_EXIT:"onExit",ON_EXIT_AND_WINDOW_CLOSE:"onExitAndWindowClose"},yj="files.associations",_bt="files.exclude",Dbt="files.readonlyInclude",Lbt="files.readonlyExclude",Z4i="files.readonlyFromPermissions",Iu=(t=>(t[t.FILE=0]="FILE",t[t.FOLDER=1]="FOLDER",t[t.ROOT_FOLDER=2]="ROOT_FOLDER",t))(Iu||{}),JL="";function Jti(a){if(!(typeof a.size!="number"||typeof a.mtime!="number"))return a.mtime.toString(29)+a.size.toString(31)}async function Zti(a,i){if(!i.hasProvider(A.from({scheme:a.scheme})))return new Promise(e=>{let t=i.onDidChangeFileSystemProviderRegistrations(o=>{o.scheme===a.scheme&&o.added&&(t.dispose(),e())})})}var vl=class a{static{this.KB=1024}static{this.MB=a.KB*a.KB}static{this.GB=a.MB*a.KB}static{this.TB=a.GB*a.KB}static formatSize(i){return Yo(i)||(i=0),i<a.KB?d(2125,null,i.toFixed(0)):i<a.MB?d(2127,null,(i/a.KB).toFixed(2)):i<a.GB?d(2128,null,(i/a.MB).toFixed(2)):i<a.TB?d(2126,null,(i/a.GB).toFixed(2)):d(2129,null,(i/a.TB).toFixed(2))}};function Rbt(a){let i=typeof a=="string"||a?.scheme===Q.vscodeRemote;return typeof a!="string"&&a?.scheme===Q.file?1024*vl.MB:i?10*vl.MB:Wt?50*vl.MB:1024*vl.MB}var $x;(o=>{function a(n){return typeof n?.showDirectoryPicker=="function"}o.supported=a;function i(n){let r=n;return r?typeof r.kind=="string"&&typeof r.queryPermission=="function"&&typeof r.requestPermission=="function":!1}o.isFileSystemHandle=i;function e(n){return n.kind==="file"}o.isFileSystemFileHandle=e;function t(n){return n.kind==="directory"}o.isFileSystemDirectoryHandle=t})($x||={});var eii;(i=>{function a(e){return typeof e?.FileSystemObserver=="function"}i.supported=a})(eii||={});var Mbt=class extends x{constructor(e,t,o){super();this.indexedDB=e;this.store=t;this.logService=o;this.onDidChangeCapabilities=U.None;this.extUri=fn?ar:Ax;this._onDidChangeFileEmitter=this._register(new E);this.onDidChangeFile=this._onDidChangeFileEmitter.event;this._files=new Map;this._directories=new Map}get capabilities(){return this._capabilities||(this._capabilities=18,fn&&(this._capabilities|=1024)),this._capabilities}async stat(e){try{let t=await this.getHandle(e);if(!t)throw this.createFileSystemProviderError(e,"No such file or directory, stat","EntryNotFound");if($x.isFileSystemFileHandle(t)){let o=await t.getFile();return{type:1,mtime:o.lastModified,ctime:0,size:o.size}}return{type:2,mtime:0,ctime:0,size:0}}catch(t){throw this.toFileSystemProviderError(t)}}async readdir(e){try{let t=await this.getDirectoryHandle(e);if(!t)throw this.createFileSystemProviderError(e,"No such file or directory, readdir","EntryNotFound");let o=[];for await(let[n,r]of t)o.push([n,$x.isFileSystemFileHandle(r)?1:2]);return o}catch(t){throw this.toFileSystemProviderError(t)}}readFileStream(e,t,o){let n=VI(r=>qe.concat(r.map(s=>qe.wrap(s))).buffer,{highWaterMark:10});return(async()=>{try{let r=await this.getFileHandle(e);if(!r)throw this.createFileSystemProviderError(e,"No such file or directory, readFile","EntryNotFound");let s=await r.getFile();if(typeof t.length=="number"||typeof t.position=="number"){let l=new Uint8Array(await s.arrayBuffer());typeof t?.position=="number"&&(l=l.slice(t.position)),typeof t?.length=="number"&&(l=l.slice(0,t.length)),n.end(l)}else{let l=s.stream().getReader(),c=await l.read();for(;!c.done&&!(o.isCancellationRequested||(await n.write(c.value),o.isCancellationRequested));)c=await l.read();n.end(void 0)}}catch(r){n.error(this.toFileSystemProviderError(r)),n.end()}})(),n}async readFile(e){try{let t=await this.getFileHandle(e);if(!t)throw this.createFileSystemProviderError(e,"No such file or directory, readFile","EntryNotFound");let o=await t.getFile();return new Uint8Array(await o.arrayBuffer())}catch(t){throw this.toFileSystemProviderError(t)}}async writeFile(e,t,o){try{let n=await this.getFileHandle(e);if(!o.create||!o.overwrite){if(n){if(!o.overwrite)throw this.createFileSystemProviderError(e,"File already exists, writeFile","EntryExists")}else if(!o.create)throw this.createFileSystemProviderError(e,"No such file, writeFile","EntryNotFound")}if(!n){let s=await this.getDirectoryHandle(this.extUri.dirname(e));if(!s)throw this.createFileSystemProviderError(e,"No such parent directory, writeFile","EntryNotFound");if(n=await s.getFileHandle(this.extUri.basename(e),{create:!0}),!n)throw this.createFileSystemProviderError(e,"Unable to create file , writeFile","Unknown")}let r=await n.createWritable();await r.write(t),await r.close()}catch(n){throw this.toFileSystemProviderError(n)}}async mkdir(e){try{let t=await this.getDirectoryHandle(this.extUri.dirname(e));if(!t)throw this.createFileSystemProviderError(e,"No such parent directory, mkdir","EntryNotFound");await t.getDirectoryHandle(this.extUri.basename(e),{create:!0})}catch(t){throw this.toFileSystemProviderError(t)}}async delete(e,t){try{let o=await this.getDirectoryHandle(this.extUri.dirname(e));if(!o)throw this.createFileSystemProviderError(e,"No such parent directory, delete","EntryNotFound");return o.removeEntry(this.extUri.basename(e),{recursive:t.recursive})}catch(o){throw this.toFileSystemProviderError(o)}}async rename(e,t,o){try{if(this.extUri.isEqual(e,t))return;let n=await this.getFileHandle(e);if(n){let r=await n.getFile(),s=new Uint8Array(await r.arrayBuffer());await this.writeFile(t,s,{create:!0,overwrite:o.overwrite,unlock:!1,atomic:!1}),await this.delete(e,{recursive:!1,useTrash:!1,atomic:!1})}else throw this.createFileSystemProviderError(e,d(2124,null),"Unavailable")}catch(n){throw this.toFileSystemProviderError(n)}}watch(e,t){let o=new N;return this.doWatch(e,t,o).catch(n=>this.logService.error(`[File Watcher ('FileSystemObserver')] Error: ${n} (${e})`)),o}async doWatch(e,t,o){if(!eii.supported(globalThis))return;let n=await this.getHandle(e);if(!n||o.isDisposed)return;let r=new globalThis.FileSystemObserver(s=>{if(o.isDisposed)return;let l=[];for(let c of s)switch(this.logService.getLevel()===1&&this.logService.trace(`[File Watcher ('FileSystemObserver')] [${c.type}] ${Ge(e,...c.relativePathComponents)}`),c.type){case"appeared":l.push({resource:Ge(e,...c.relativePathComponents),type:1});break;case"disappeared":l.push({resource:Ge(e,...c.relativePathComponents),type:2});break;case"modified":l.push({resource:Ge(e,...c.relativePathComponents),type:0});break;case"errored":this.logService.trace(`[File Watcher ('FileSystemObserver')] errored, disposing observer (${e})`),o.dispose()}l.length&&this._onDidChangeFileEmitter.fire(l)});try{await r.observe(n,t.recursive?{recursive:!0}:void 0)}finally{o.isDisposed?r.disconnect():o.add(Z(()=>r.disconnect()))}}registerFileHandle(e){return this.registerHandle(e,this._files)}registerDirectoryHandle(e){return this.registerHandle(e,this._directories)}get directories(){return this._directories.values()}async registerHandle(e,t){let o=`/${e.name}`;if(t.has(o)&&!await t.get(o)?.isSameEntry(e)){let n=qm(e.name),r=jo(e.name,n),s=1;do o=`/${r}-${s++}${n}`;while(t.has(o)&&!await t.get(o)?.isSameEntry(e))}t.set(o,e);try{await this.indexedDB?.runInTransaction(this.store,"readwrite",n=>n.put(e,o))}catch(n){this.logService.error(n)}return A.from({scheme:Q.file,path:o})}async getHandle(e){let t=await this.doGetHandle(e);if(!t){let o=await this.getDirectoryHandle(this.extUri.dirname(e));if(o){let n=ar.basename(e);try{t=await o.getFileHandle(n)}catch{try{t=await o.getDirectoryHandle(n)}catch{}}}}return t}async getFileHandle(e){let t=await this.doGetHandle(e);if(t instanceof FileSystemFileHandle)return t;let o=await this.getDirectoryHandle(this.extUri.dirname(e));try{return await o?.getFileHandle(ar.basename(e))}catch{return}}async getDirectoryHandle(e){let t=await this.doGetHandle(e);if(t instanceof FileSystemDirectoryHandle)return t;let o=this.extUri.dirname(e);if(this.extUri.isEqual(o,e))return;let n=await this.getDirectoryHandle(o);try{return await n?.getDirectoryHandle(ar.basename(e))}catch{return}}async doGetHandle(e){if(this.extUri.dirname(e).path!=="/")return;let t=e.path.replace(/\/$/,""),o=this._files.get(t)??this._directories.get(t);if(o)return o;let n=await this.indexedDB?.runInTransaction(this.store,"readonly",r=>r.get(t));if($x.isFileSystemHandle(n)){let r=await n.queryPermission()==="granted";try{r||(r=await n.requestPermission()==="granted")}catch(s){this.logService.error(s)}if(r)return $x.isFileSystemFileHandle(n)?this._files.set(t,n):$x.isFileSystemDirectoryHandle(n)&&this._directories.set(t,n),n}throw this.createFileSystemProviderError(e,"No file system handle registered","Unavailable")}toFileSystemProviderError(e){if(e instanceof dwe)return e;let t="Unknown";return e.name==="NotAllowedError"&&(e=new Error(d(2123,null)),t="Unavailable"),Ps(e,t)}createFileSystemProviderError(e,t,o){return Ps(new Error(`${t} (${ch(e.path)})`),o)}};var Je=le("openerService");function ZL(a,i){return a.with({fragment:`${i.startLineNumber},${i.startColumn}${i.endLineNumber?`-${i.endLineNumber}${i.endColumn?`,${i.endColumn}`:""}`:""}`})}function uwe(a){let i,e=/^L?(\d+)(?:,(\d+))?(-L?(\d+)(?:,(\d+))?)?/.exec(a.fragment);return e&&(i={startLineNumber:parseInt(e[1]),startColumn:e[2]?parseInt(e[2]):1,endLineNumber:e[4]?parseInt(e[4]):void 0,endColumn:e[4]?e[5]?parseInt(e[5]):1:void 0},a=a.with({fragment:""})),{selection:i,uri:a}}var hc={EDITORS:"CodeEditors",FILES:"CodeFiles",SYMBOLS:"application/vnd.code.symbols",MARKERS:"application/vnd.code.diagnostics",NOTEBOOK_CELL_OUTPUT:"notebook-cell-output",SCM_HISTORY_ITEM:"scm-history-item"};function iii(a){let i=[];if(a.dataTransfer&&a.dataTransfer.types.length>0){let o=a.dataTransfer.getData(hc.EDITORS);if(o)try{i.push(...am(o))}catch{}else try{let s=a.dataTransfer.getData(yl.RESOURCES);i.push(...oii(s))}catch{}if(a.dataTransfer?.files)for(let s=0;s<a.dataTransfer.files.length;s++){let l=a.dataTransfer.files[s];if(l&&L_(l))try{i.push({resource:A.file(L_(l)),isExternal:!0,allowWorkspaceOpen:!0})}catch{}}let n=a.dataTransfer.getData(hc.FILES);if(n)try{let s=JSON.parse(n);for(let l of s)i.push({resource:A.file(l),isExternal:!0,allowWorkspaceOpen:!0})}catch{}let r=ne.as(OV.DragAndDropContribution).getAll();for(let s of r){let l=a.dataTransfer.getData(s.dataFormatKey);if(l)try{i.push(...s.getEditorInputs(l))}catch{}}}let e=[],t=new gt;for(let o of i)o.resource?t.has(o.resource)||(e.push(o),t.set(o.resource,!0)):e.push(o);return e}async function pwe(a,i){let e=iii(i);if(i.dataTransfer&&Wt&&Ip(i,yl.FILES)&&i.dataTransfer.items){let n=await a.get(F).invokeFunction(r=>JWo(r,i));for(let r of n)e.push({resource:r.resource,contents:r.contents?.toString(),isExternal:!0,allowWorkspaceOpen:r.isDirectory})}return e}function oii(a){let i=[];if(a){let e=JSON.parse(a);for(let t of e)if(t.indexOf(":")>0){let{selection:o,uri:n}=uwe(A.parse(t));i.push({resource:n,options:{selection:o}})}}return i}async function JWo(a,i){if($x.supported(ut)){let t=i.dataTransfer?.items;if(t)return ZWo(a,t)}let e=i.dataTransfer?.files;return e?eVo(a,e):[]}async function ZWo(a,i){let e=a.get(fe).getProvider(Q.file);if(!(e instanceof Mbt))return[];let t=[];for(let o=0;o<i.length;o++){let n=i[o];if(n){let r=new Ko;t.push(r),(async()=>{try{let s=await n.getAsFileSystemHandle();if(!s){r.complete(void 0);return}$x.isFileSystemFileHandle(s)?r.complete({resource:await e.registerFileHandle(s),isDirectory:!1}):$x.isFileSystemDirectoryHandle(s)?r.complete({resource:await e.registerDirectoryHandle(s),isDirectory:!0}):r.complete(void 0)}catch{r.complete(void 0)}})()}}return di(await Promise.all(t.map(o=>o.p)))}async function eVo(a,i){let e=a.get(at),t=[];for(let o=0;o<i.length;o++){let n=i.item(o);if(n){if(n.size>100*vl.MB){e.warn(d(1946,null));continue}let r=new Ko;t.push(r);let s=new FileReader;s.onerror=()=>r.complete(void 0),s.onabort=()=>r.complete(void 0),s.onload=async l=>{let c=n.name,u=l.target?.result??void 0;if(typeof c!="string"||typeof u>"u"){r.complete(void 0);return}r.complete({resource:A.from({scheme:Q.untitled,path:c}),contents:typeof u=="string"?qe.fromString(u):qe.wrap(new Uint8Array(u))})},s.readAsArrayBuffer(n)}}return di(await Promise.all(t.map(o=>o.p)))}function Ip(a,...i){if(!a.dataTransfer)return!1;let e=a.dataTransfer.types,t=[];for(let o=0;o<e.length;o++)t.push(e[o].toLowerCase());for(let o of i)if(t.indexOf(o.toLowerCase())>=0)return!0;return!1}var tii=class{constructor(){this._contributions=new Map;this._dropHandlers=new Set}register(i){if(this._contributions.has(i.dataFormatKey))throw new Error(`A drag and drop contributiont with key '${i.dataFormatKey}' was already registered.`);this._contributions.set(i.dataFormatKey,i)}getAll(){return this._contributions.values()}registerDropHandler(i){return this._dropHandlers.add(i),Z(()=>this._dropHandlers.delete(i))}async handleResourceDrop(i,e){for(let t of this._dropHandlers)if(await t.handleDrop(i,e))return!0;return!1}},OV={DragAndDropContribution:"workbench.contributions.dragAndDrop"};ne.add(OV.DragAndDropContribution,new tii);var JI=class a{static{this.INSTANCE=new a}constructor(){}static getInstance(){return a.INSTANCE}hasData(i){return i&&i===this.proto}clearData(i){this.hasData(i)&&(this.proto=void 0,this.data=void 0)}getData(i){if(this.hasData(i))return this.data}setData(i,e){e&&(this.data=i,this.proto=e)}};function e3i(a,i,e){a.dataTransfer?.setData(i,JSON.stringify(e))}function nii(a,i,e){let t=a.dataTransfer?.getData(i);if(t)try{return JSON.parse(t)}catch{}return e}function t3i(a){return nii(a,hc.SYMBOLS,[])}function mwe(a,i){e3i(i,hc.SYMBOLS,a)}function i3i(a){return nii(a,hc.MARKERS,void 0)}function o3i(a,i){e3i(i,hc.MARKERS,a)}function n3i(a){return nii(a,hc.NOTEBOOK_CELL_OUTPUT,void 0)}function L_(a){if(Vr&&typeof globalThis.vscode?.webUtils?.getPathForFile=="function")return globalThis.vscode?.webUtils?.getPathForFile(a)}function tVo(a){let i=new qx;for(let e of a.items){let t=e.type;if(e.kind==="string"){let o=new Promise(n=>e.getAsString(n));i.append(t,DO(o))}else if(e.kind==="file"){let o=e.getAsFile();o&&i.append(t,iVo(o))}}return i}function iVo(a){let i=L_(a),e=i?A.parse(i):void 0;return z4i(a.name,e,async()=>new Uint8Array(await a.arrayBuffer()))}var oVo=Object.freeze([hc.EDITORS,hc.FILES,yl.RESOURCES,yl.INTERNAL_URI_LIST]);function yle(a,i=!1){let e=tVo(a),t=e.get(yl.INTERNAL_URI_LIST);if(t)e.replace(tr.uriList,t);else if(i||!e.has(tr.uriList)){let o=[];for(let n of a.items){let r=n.getAsFile();if(r){let s=L_(r);try{s?o.push(A.file(s).toString()):o.push(A.parse(r.name,!0).toString())}catch{}}}o.length&&e.replace(tr.uriList,DO(aw.create(o)))}for(let o of oVo)e.delete(o);return e}function r3i(a,i,e){let{dataToCopy:t,metadata:o}=a3i(a);return s3i(t.text,o,e),{dataToCopy:t,metadata:o}}function s3i(a,i,e){V7.INSTANCE.set(e?a.replace(/\r\n/g,`
`):a,i)}function a3i(a){let i=a.getEditorOption(45),e=a.getEditorOption(31),t=a.getCursorStates().map(r=>r.modelState.selection),o=nVo(a,t,i,e),n={version:1,id:xt(),isFromEmptySelection:o.isFromEmptySelection,multicursorText:o.multicursorText,mode:o.mode};return{dataToCopy:o,metadata:n}}function nVo(a,i,e,t){let{sourceRanges:o,sourceText:n}=a.getPlainTextToCopy(i,e,ei),r=a.model.getEOL(),s=e&&i.length===1&&i[0].isEmpty(),l=Array.isArray(n)?n:null,c=Array.isArray(n)?n.join(r):n,u,p=null;if(Z1.forceCopyWithSyntaxHighlighting||t&&n.length<65536){let g=a.getRichTextToCopy(i,e);g&&(u=g.html,p=g.mode)}return{isFromEmptySelection:s,sourceRanges:o,multicursorText:l,text:c,html:u,mode:p}}var V7=class a{static{this.INSTANCE=new a}constructor(){this._lastState=null}set(i,e){this._lastState={lastCopiedValue:i,data:e}}get(i){return this._lastState&&this._lastState.lastCopiedValue===i?this._lastState.data:(this._lastState=null,null)}},Z1={forceCopyWithSyntaxHighlighting:!1,electronBugWorkaroundCopyEventHasFired:!1},l3i={getTextData(a){let i=a.getData(tr.text),e=null,t=a.getData("vscode-editor-data");if(typeof t=="string")try{e=JSON.parse(t),e.version!==1&&(e=null)}catch{}return i.length===0&&e===null&&a.files.length>0?[Array.prototype.slice.call(a.files,0).map(n=>n.name).join(`
`),null]:[i,e]},setTextData(a,i,e,t){a.setData(tr.text,i),typeof e=="string"&&a.setData("text/html",e),a.setData("vscode-editor-data",JSON.stringify(t))}};function hwe(a,i,e,t,o){let{dataToCopy:n,metadata:r}=a3i(e.viewModel),s=!1;return{isCut:i,clipboardData:{setData:(l,c)=>{a.clipboardData?.setData(l,c)}},dataToCopy:n,ensureClipboardGetsEditorData:()=>{a.preventDefault(),a.clipboardData&&l3i.setTextData(a.clipboardData,n.text,n.html,r),s3i(n.text,r,o),t.trace("ensureClipboardGetsEditorSelection with id : ",r.id," with text.length: ",n.text.length)},setHandled:()=>{s=!0,a.preventDefault(),a.stopImmediatePropagation()},get isHandled(){return s}}}function Pbt(a){let i=!1,[e,t]=a.clipboardData?l3i.getTextData(a.clipboardData):["",null];return t=t||V7.INSTANCE.get(e),{clipboardData:rVo(a.clipboardData),metadata:t,text:e,toExternalVSDataTransfer:()=>a.clipboardData?yle(a.clipboardData):void 0,browserEvent:a,setHandled:()=>{i=!0,a.preventDefault(),a.stopImmediatePropagation()},get isHandled(){return i}}}function rVo(a){return{types:Array.from(a?.types??[]),files:Array.prototype.slice.call(a?.files??[],0),getData:i=>a?.getData(i)??""}}var R_=!1,JS=class a{constructor(i,e,t,o,n){this.value=i;this.selectionStart=e;this.selectionEnd=t;this.selection=o;this.newlineCountBeforeSelection=n}static{this.EMPTY=new a("",0,0,null,void 0)}toString(){return`[ <${this.value}>, selectionStart: ${this.selectionStart}, selectionEnd: ${this.selectionEnd}]`}static readFromTextArea(i,e){let t=i.getValue(),o=i.getSelectionStart(),n=i.getSelectionEnd(),r;if(e){let s=t.substring(0,o),l=e.value.substring(0,e.selectionStart);s===l&&(r=e.newlineCountBeforeSelection)}return new a(t,o,n,null,r)}collapseSelection(){return this.selectionStart===this.value.length?this:new a(this.value,this.value.length,this.value.length,null,void 0)}isWrittenToTextArea(i,e){let t=this.value===i.getValue();return e?this.selectionStart===i.getSelectionStart()&&this.selectionEnd===i.getSelectionEnd()&&t:t}writeToTextArea(i,e,t){R_&&console.log(`writeToTextArea ${i}: ${this.toString()}`),e.setValue(i,this.value),t&&e.setSelectionRange(i,this.selectionStart,this.selectionEnd)}deduceEditorPosition(i){if(i<=this.selectionStart){let o=this.value.substring(i,this.selectionStart);return this._finishDeduceEditorPosition(this.selection?.getStartPosition()??null,o,-1)}if(i>=this.selectionEnd){let o=this.value.substring(this.selectionEnd,i);return this._finishDeduceEditorPosition(this.selection?.getEndPosition()??null,o,1)}let e=this.value.substring(this.selectionStart,i);if(e.indexOf("\u2026")===-1)return this._finishDeduceEditorPosition(this.selection?.getStartPosition()??null,e,1);let t=this.value.substring(i,this.selectionEnd);return this._finishDeduceEditorPosition(this.selection?.getEndPosition()??null,t,-1)}_finishDeduceEditorPosition(i,e,t){let o=0,n=-1;for(;(n=e.indexOf(`
`,n+1))!==-1;)o++;return[i,t*e.length,o]}static deduceInput(i,e,t){if(!i)return{text:"",replacePrevCharCnt:0,replaceNextCharCnt:0,positionDelta:0};R_&&(console.log("------------------------deduceInput"),console.log(`PREVIOUS STATE: ${i.toString()}`),console.log(`CURRENT STATE: ${e.toString()}`));let o=Math.min(tf(i.value,e.value),i.selectionStart,e.selectionStart),n=Math.min(vC(i.value,e.value),i.value.length-i.selectionEnd,e.value.length-e.selectionEnd),r=i.value.substring(o,i.value.length-n),s=e.value.substring(o,e.value.length-n),l=i.selectionStart-o,c=i.selectionEnd-o,u=e.selectionStart-o,p=e.selectionEnd-o;if(R_&&(console.log(`AFTER DIFFING PREVIOUS STATE: <${r}>, selectionStart: ${l}, selectionEnd: ${c}`),console.log(`AFTER DIFFING CURRENT STATE: <${s}>, selectionStart: ${u}, selectionEnd: ${p}`)),u===p){let g=i.selectionStart-o;return R_&&console.log(`REMOVE PREVIOUS: ${g} chars`),{text:s,replacePrevCharCnt:g,replaceNextCharCnt:0,positionDelta:0}}let h=c-l;return{text:s,replacePrevCharCnt:h,replaceNextCharCnt:0,positionDelta:0}}static deduceAndroidCompositionInput(i,e){if(!i)return{text:"",replacePrevCharCnt:0,replaceNextCharCnt:0,positionDelta:0};if(R_&&(console.log("------------------------deduceAndroidCompositionInput"),console.log(`PREVIOUS STATE: ${i.toString()}`),console.log(`CURRENT STATE: ${e.toString()}`)),i.value===e.value)return{text:"",replacePrevCharCnt:0,replaceNextCharCnt:0,positionDelta:e.selectionEnd-i.selectionEnd};let t=Math.min(tf(i.value,e.value),i.selectionEnd),o=Math.min(vC(i.value,e.value),i.value.length-i.selectionEnd),n=i.value.substring(t,i.value.length-o),r=e.value.substring(t,e.value.length-o),s=i.selectionStart-t,l=i.selectionEnd-t,c=e.selectionStart-t,u=e.selectionEnd-t;return R_&&(console.log(`AFTER DIFFING PREVIOUS STATE: <${n}>, selectionStart: ${s}, selectionEnd: ${l}`),console.log(`AFTER DIFFING CURRENT STATE: <${r}>, selectionStart: ${c}, selectionEnd: ${u}`)),{text:r,replacePrevCharCnt:l,replaceNextCharCnt:n.length-l,positionDelta:u-r.length}}static fromScreenReaderContentState(i){let e,t;switch(i.selection.getDirection()){case 0:e=i.selectionStart,t=i.selectionEnd;break;case 1:e=i.selectionEnd,t=i.selectionStart;break}return new a(i.value,e,t,i.selection,i.newlineCountBeforeSelection)}};var Nbt;(i=>i.Tap="-monaco-textarea-synthetic-tap")(Nbt||={});var rii=class{constructor(){this._lastTypeTextLength=0}handleCompositionUpdate(i){i=i||"";let e={text:i,replacePrevCharCnt:this._lastTypeTextLength,replaceNextCharCnt:0,positionDelta:0};return this._lastTypeTextLength=i.length,e}},gwe=class extends x{constructor(e,t,o,n,r,s){super();this._host=e;this._textArea=t;this._OS=o;this._browser=n;this._accessibilityService=r;this._logService=s;this._onFocus=this._register(new E);this.onFocus=this._onFocus.event;this._onBlur=this._register(new E);this.onBlur=this._onBlur.event;this._onKeyDown=this._register(new E);this.onKeyDown=this._onKeyDown.event;this._onKeyUp=this._register(new E);this.onKeyUp=this._onKeyUp.event;this._onCut=this._register(new E);this.onCut=this._onCut.event;this._onPaste=this._register(new E);this.onPaste=this._onPaste.event;this._onWillCopy=this._register(new E);this.onWillCopy=this._onWillCopy.event;this._onWillCut=this._register(new E);this.onWillCut=this._onWillCut.event;this._onWillPaste=this._register(new E);this.onWillPaste=this._onWillPaste.event;this._onType=this._register(new E);this.onType=this._onType.event;this._onCompositionStart=this._register(new E);this.onCompositionStart=this._onCompositionStart.event;this._onCompositionUpdate=this._register(new E);this.onCompositionUpdate=this._onCompositionUpdate.event;this._onCompositionEnd=this._register(new E);this.onCompositionEnd=this._onCompositionEnd.event;this._onSelectionChangeRequest=this._register(new E);this.onSelectionChangeRequest=this._onSelectionChangeRequest.event;this._asyncFocusGainWriteScreenReaderContent=this._register(new me);this._asyncTriggerCut=this._register(new Dt(()=>this._onCut.fire(),0)),this._textAreaState=JS.EMPTY,this._selectionChangeListener=null,this._accessibilityService.isScreenReaderOptimized()&&this.writeNativeTextAreaContent("ctor"),this._register(U.runAndSubscribe(this._accessibilityService.onDidChangeScreenReaderOptimized,()=>{this._accessibilityService.isScreenReaderOptimized()&&!this._asyncFocusGainWriteScreenReaderContent.value?this._asyncFocusGainWriteScreenReaderContent.value=new Dt(()=>this.writeNativeTextAreaContent("asyncFocusGain"),0):this._asyncFocusGainWriteScreenReaderContent.clear()})),this._hasFocus=!1,this._currentComposition=null;let l=null;this._register(this._textArea.onKeyDown(c=>{let u=new gi(c);(u.keyCode===114||this._currentComposition&&u.keyCode===1)&&u.stopPropagation(),u.equals(9)&&u.preventDefault(),l=u,this._onKeyDown.fire(u)})),this._register(this._textArea.onKeyUp(c=>{let u=new gi(c);this._onKeyUp.fire(u)})),this._register(this._textArea.onCompositionStart(c=>{R_&&console.log("[compositionstart]",c);let u=new rii;if(this._currentComposition){this._currentComposition=u;return}if(this._currentComposition=u,this._OS===2&&l&&l.equals(114)&&this._textAreaState.selectionStart===this._textAreaState.selectionEnd&&this._textAreaState.selectionStart>0&&this._textAreaState.value.substr(this._textAreaState.selectionStart-1,1)===c.data&&(l.code==="ArrowRight"||l.code==="ArrowLeft")){R_&&console.log("[compositionstart] Handling long press case on macOS + arrow key",c),u.handleCompositionUpdate("x"),this._onCompositionStart.fire({data:c.data});return}if(this._browser.isAndroid){this._onCompositionStart.fire({data:c.data});return}this._onCompositionStart.fire({data:c.data})})),this._register(this._textArea.onCompositionUpdate(c=>{R_&&console.log("[compositionupdate]",c);let u=this._currentComposition;if(!u)return;if(this._browser.isAndroid){let h=JS.readFromTextArea(this._textArea,this._textAreaState),g=JS.deduceAndroidCompositionInput(this._textAreaState,h);this._textAreaState=h,this._onType.fire(g),this._onCompositionUpdate.fire(c);return}let p=u.handleCompositionUpdate(c.data);this._textAreaState=JS.readFromTextArea(this._textArea,this._textAreaState),this._onType.fire(p),this._onCompositionUpdate.fire(c)})),this._register(this._textArea.onCompositionEnd(c=>{R_&&console.log("[compositionend]",c);let u=this._currentComposition;if(!u)return;if(this._currentComposition=null,this._browser.isAndroid){let h=JS.readFromTextArea(this._textArea,this._textAreaState),g=JS.deduceAndroidCompositionInput(this._textAreaState,h);this._textAreaState=h,this._onType.fire(g),this._onCompositionEnd.fire();return}let p=u.handleCompositionUpdate(c.data);this._textAreaState=JS.readFromTextArea(this._textArea,this._textAreaState),this._onType.fire(p),this._onCompositionEnd.fire()})),this._register(this._textArea.onInput(c=>{if(R_&&console.log("[input]",c),this._textArea.setIgnoreSelectionChangeTime("received input event"),this._currentComposition)return;let u=JS.readFromTextArea(this._textArea,this._textAreaState),p=JS.deduceInput(this._textAreaState,u,this._OS===2);p.replacePrevCharCnt===0&&p.text.length===1&&(ju(p.text.charCodeAt(0))||p.text.charCodeAt(0)===127)||(this._textAreaState=u,(p.text!==""||p.replacePrevCharCnt!==0||p.replaceNextCharCnt!==0||p.positionDelta!==0)&&(c.inputType==="insertFromPaste"?this._onPaste.fire({text:p.text,metadata:V7.INSTANCE.get(p.text)}):this._onType.fire(p)))})),this._register(this._textArea.onCut(c=>{this._logService.trace("TextAreaInput#onCut",c);let u=hwe(c,!0,this._host.context,this._logService,this._browser.isFirefox);this._onWillCut.fire(u),!u.isHandled&&(this._textArea.setIgnoreSelectionChangeTime("received cut event"),u.ensureClipboardGetsEditorData(),this._asyncTriggerCut.schedule())})),this._register(this._textArea.onCopy(c=>{this._logService.trace("TextAreaInput#onCopy",c),Z1.electronBugWorkaroundCopyEventHasFired=!0;let u=hwe(c,!1,this._host.context,this._logService,this._browser.isFirefox);this._onWillCopy.fire(u),!u.isHandled&&u.ensureClipboardGetsEditorData()})),this._register(this._textArea.onPaste(c=>{this._logService.trace("TextAreaInput#onPaste",c);let u=Pbt(c);this._onWillPaste.fire(u),!u.isHandled&&(this._textArea.setIgnoreSelectionChangeTime("received paste event"),c.preventDefault(),this._logService.trace("TextAreaInput#onPaste with id : ",u.metadata?.id," with text.length: ",u.text.length),u.text&&(this._logService.trace("TextAreaInput#onPaste (before onPaste)"),this._onPaste.fire({text:u.text,metadata:u.metadata})))})),this._register(this._textArea.onFocus(()=>{let c=this._hasFocus;this._setHasFocus(!0),this._accessibilityService.isScreenReaderOptimized()&&this._browser.isSafari&&!c&&this._hasFocus&&(this._asyncFocusGainWriteScreenReaderContent.value||(this._asyncFocusGainWriteScreenReaderContent.value=new Dt(()=>this.writeNativeTextAreaContent("asyncFocusGain"),0)),this._asyncFocusGainWriteScreenReaderContent.value.schedule())})),this._register(this._textArea.onBlur(()=>{this._currentComposition&&(this._currentComposition=null,this.writeNativeTextAreaContent("blurWithoutCompositionEnd"),this._onCompositionEnd.fire()),this._setHasFocus(!1)})),this._register(this._textArea.onSyntheticTap(()=>{this._browser.isAndroid&&this._currentComposition&&(this._currentComposition=null,this.writeNativeTextAreaContent("tapWithoutCompositionEnd"),this._onCompositionEnd.fire())}))}get textAreaState(){return this._textAreaState}_initializeFromTest(){this._hasFocus=!0,this._textAreaState=JS.readFromTextArea(this._textArea,null)}_installSelectionChangeListener(){let e=0;return j(this._textArea.ownerDocument,"selectionchange",t=>{if(Kx.onSelectionChange(),!this._hasFocus||this._currentComposition||!this._browser.isChrome)return;let o=Date.now(),n=o-e;if(e=o,n<5)return;let r=o-this._textArea.getIgnoreSelectionChangeTime();if(this._textArea.resetSelectionChangeTime(),r<100||!this._textAreaState.selection)return;let s=this._textArea.getValue();if(this._textAreaState.value!==s)return;let l=this._textArea.getSelectionStart(),c=this._textArea.getSelectionEnd();if(this._textAreaState.selectionStart===l&&this._textAreaState.selectionEnd===c)return;let u=this._textAreaState.deduceEditorPosition(l),p=this._host.deduceModelPosition(u[0],u[1],u[2]),h=this._textAreaState.deduceEditorPosition(c),g=this._host.deduceModelPosition(h[0],h[1],h[2]),f=new ti(p.lineNumber,p.column,g.lineNumber,g.column);this._onSelectionChangeRequest.fire(f)})}dispose(){super.dispose(),this._selectionChangeListener&&(this._selectionChangeListener.dispose(),this._selectionChangeListener=null)}focusTextArea(){this._setHasFocus(!0),this.refreshFocusState()}isFocused(){return this._hasFocus}refreshFocusState(){this._setHasFocus(this._textArea.hasFocus())}_setHasFocus(e){this._hasFocus!==e&&(this._hasFocus=e,this._selectionChangeListener&&(this._selectionChangeListener.dispose(),this._selectionChangeListener=null),this._hasFocus&&(this._selectionChangeListener=this._installSelectionChangeListener()),this._hasFocus&&this.writeNativeTextAreaContent("focusgain"),this._hasFocus?this._onFocus.fire():this._onBlur.fire())}_setAndWriteTextAreaState(e,t){this._hasFocus||(t=t.collapseSelection()),t.isWrittenToTextArea(this._textArea,this._hasFocus)||this._logService.trace(`writeTextAreaState(reason: ${e})`),t.writeToTextArea(e,this._textArea,this._hasFocus),this._textAreaState=t}writeNativeTextAreaContent(e){!this._accessibilityService.isScreenReaderOptimized()&&e==="render"||this._currentComposition||this._setAndWriteTextAreaState(e,this._host.getScreenReaderContent())}};gwe=I([m(4,Oi),m(5,se)],gwe);var Abt=class extends x{constructor(e){super();this._actual=e;this._onSyntheticTap=this._register(new E);this.onSyntheticTap=this._onSyntheticTap.event;this._ignoreSelectionChangeTime=0,this.onKeyDown=this._register(new Gn(this._actual,"keydown")).event,this.onKeyPress=this._register(new Gn(this._actual,"keypress")).event,this.onKeyUp=this._register(new Gn(this._actual,"keyup")).event,this.onCompositionStart=this._register(new Gn(this._actual,"compositionstart")).event,this.onCompositionUpdate=this._register(new Gn(this._actual,"compositionupdate")).event,this.onCompositionEnd=this._register(new Gn(this._actual,"compositionend")).event,this.onBeforeInput=this._register(new Gn(this._actual,"beforeinput")).event,this.onInput=this._register(new Gn(this._actual,"input")).event,this.onCut=this._register(new Gn(this._actual,"cut")).event,this.onCopy=this._register(new Gn(this._actual,"copy")).event,this.onPaste=this._register(new Gn(this._actual,"paste")).event,this.onFocus=this._register(new Gn(this._actual,"focus")).event,this.onBlur=this._register(new Gn(this._actual,"blur")).event,this._register(this.onKeyDown(()=>Kx.onKeyDown())),this._register(this.onBeforeInput(()=>Kx.onBeforeInput())),this._register(this.onInput(()=>Kx.onInput())),this._register(this.onKeyUp(()=>Kx.onKeyUp())),this._register(j(this._actual,Nbt.Tap,()=>this._onSyntheticTap.fire()))}get ownerDocument(){return this._actual.ownerDocument}hasFocus(){let e=bP(this._actual);return e?e.activeElement===this._actual:this._actual.isConnected?Nn()===this._actual:!1}setIgnoreSelectionChangeTime(e){this._ignoreSelectionChangeTime=Date.now()}getIgnoreSelectionChangeTime(){return this._ignoreSelectionChangeTime}resetSelectionChangeTime(){this._ignoreSelectionChangeTime=0}getValue(){return this._actual.value}setValue(e,t){let o=this._actual;o.value!==t&&(this.setIgnoreSelectionChangeTime("setValue"),o.value=t)}getSelectionStart(){return this._actual.selectionDirection==="backward"?this._actual.selectionEnd:this._actual.selectionStart}getSelectionEnd(){return this._actual.selectionDirection==="backward"?this._actual.selectionStart:this._actual.selectionEnd}setSelectionRange(e,t,o){let n=this._actual,r=null,s=bP(n);s?r=s.activeElement:r=Nn();let l=Re(r),c=r===n,u=n.selectionStart,p=n.selectionEnd;if(c&&u===t&&p===o){Ac&&l.parent!==l&&n.focus();return}if(c){this.setIgnoreSelectionChangeTime("setSelectionRange"),n.setSelectionRange(t,o),Ac&&l.parent!==l&&n.focus();return}try{let h=jqi(n);this.setIgnoreSelectionChangeTime("setSelectionRange"),n.focus(),n.setSelectionRange(t,o),Qqi(n,h)}catch{}}};var sii=class extends nwe{constructor(i,e,t){super(i,e,t),this._register(Ms.addTarget(this.viewHelper.linesContentDomNode)),this._register(j(this.viewHelper.linesContentDomNode,Kn.Tap,n=>this.onTap(n))),this._register(j(this.viewHelper.linesContentDomNode,Kn.Change,n=>this.onChange(n))),this._register(j(this.viewHelper.linesContentDomNode,Kn.Contextmenu,n=>this._onContextMenu(new YL(n,!1,this.viewHelper.viewDomNode),!1))),this._lastPointerType="mouse",this._register(j(this.viewHelper.linesContentDomNode,"pointerdown",n=>{let r=n.pointerType;if(r==="mouse"){this._lastPointerType="mouse";return}else r==="touch"?this._lastPointerType="touch":this._lastPointerType="pen"}));let o=new Jvt(this.viewHelper.viewDomNode);this._register(o.onPointerMove(this.viewHelper.viewDomNode,n=>this._onMouseMove(n))),this._register(o.onPointerUp(this.viewHelper.viewDomNode,n=>this._onMouseUp(n))),this._register(o.onPointerLeave(this.viewHelper.viewDomNode,n=>this._onMouseLeave(n))),this._register(o.onPointerDown(this.viewHelper.viewDomNode,(n,r)=>this._onMouseDown(n,r)))}onTap(i){!i.initialTarget||!this.viewHelper.linesContentDomNode.contains(i.initialTarget)||(i.preventDefault(),this.viewHelper.focusTextArea(),this._dispatchGesture(i,!1))}onChange(i){this._lastPointerType==="touch"&&this._context.viewModel.viewLayout.deltaScrollNow(-i.translationX,-i.translationY),this._lastPointerType==="pen"&&this._dispatchGesture(i,!0)}_dispatchGesture(i,e){let t=this._createMouseTarget(new YL(i,!1,this.viewHelper.viewDomNode),!1);t.position&&this.viewController.dispatchMouse({position:t.position,mouseColumn:t.position.column,startedOnLineNumbers:!1,revealType:1,mouseDownCount:i.tapCount,inSelectionMode:e,altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1,leftButton:!1,middleButton:!1,onInjectedText:t.type===6&&t.detail.injectedText!==null})}_onMouseDown(i,e){i.browserEvent.pointerType!=="touch"&&super._onMouseDown(i,e)}},aii=class extends nwe{constructor(i,e,t){super(i,e,t),this._register(Ms.addTarget(this.viewHelper.linesContentDomNode)),this._register(j(this.viewHelper.linesContentDomNode,Kn.Tap,o=>this.onTap(o))),this._register(j(this.viewHelper.linesContentDomNode,Kn.Change,o=>this.onChange(o))),this._register(j(this.viewHelper.linesContentDomNode,Kn.Contextmenu,o=>this._onContextMenu(new YL(o,!1,this.viewHelper.viewDomNode),!1)))}onTap(i){i.preventDefault(),this.viewHelper.focusTextArea();let e=this._createMouseTarget(new YL(i,!1,this.viewHelper.viewDomNode),!1);if(e.position){let t=document.createEvent("CustomEvent");t.initEvent(Nbt.Tap,!1,!0),this.viewHelper.dispatchTextAreaEvent(t),this.viewController.moveTo(e.position,1)}}onChange(i){this._context.viewModel.viewLayout.deltaScrollNow(-i.translationX,-i.translationY)}},Obt=class extends x{constructor(i,e,t){super(),(dc||xht&&KSe)&&yg.pointerEvents?this.handler=this._register(new sii(i,e,t)):ut.TouchEvent?this.handler=this._register(new aii(i,e,t)):this.handler=this._register(new nwe(i,e,t))}getTargetAtClientPoint(i,e){return this.handler.getTargetAtClientPoint(i,e)}};var Fbt=class a{constructor(i,e,t,o){this.configuration=i,this.viewModel=e,this.userInputEvents=t,this.commandDelegate=o}paste(i,e,t,o){this.commandDelegate.paste(i,e,t,o)}type(i){this.commandDelegate.type(i)}compositionType(i,e,t,o){this.commandDelegate.compositionType(i,e,t,o)}compositionStart(){this.commandDelegate.startComposition()}compositionEnd(){this.commandDelegate.endComposition()}cut(){this.commandDelegate.cut()}setSelection(i){af.SetSelection.runCoreEditorCommand(this.viewModel,{source:"keyboard",selection:i})}_validateViewColumn(i){let e=this.viewModel.getLineMinColumn(i.lineNumber);return i.column<e?new ye(i.lineNumber,e):i}_hasMulticursorModifier(i){switch(this.configuration.options.get(86)){case"altKey":return i.altKey;case"ctrlKey":return i.ctrlKey;case"metaKey":return i.metaKey;default:return!1}}_hasNonMulticursorModifier(i){switch(this.configuration.options.get(86)){case"altKey":return i.ctrlKey||i.metaKey;case"ctrlKey":return i.altKey||i.metaKey;case"metaKey":return i.ctrlKey||i.altKey;default:return!1}}static _trySelectBracketContent(i,e){if(e.column>1){let t=i.bracketPairs.matchBracket(e.with(void 0,e.column-1));if(t&&t[0].getEndPosition().equals(e))return ti.fromPositions(t[0].getEndPosition(),t[1].getStartPosition())}if(e.column<=i.getLineMaxColumn(e.lineNumber)){let t=i.bracketPairs.matchBracket(e);if(t&&t[1].getStartPosition().equals(e))return ti.fromPositions(t[0].getEndPosition(),t[1].getStartPosition())}}static _trySelectStringContent(i,e){let{lineNumber:t,column:o}=e,{tokenization:n}=i;if(!n.hasAccurateTokensForLine(t))if(n.isCheapToTokenize(t))n.forceTokenization(t);else return;let r=n.getLineTokens(t),s=r.findTokenIndexAtOffset(o-1),l=s;for(;s>0&&r.getStandardTokenType(s-1)===2;)s--;for(;l+1<r.getCount()&&r.getStandardTokenType(l+1)===2;)l++;let c=r.getStartOffset(s),u=r.getEndOffset(l);if(o!==c+2&&o!==u)return;let p=i.getLineContent(t),h=p.charAt(c);if(h!=='"'&&h!=="'"&&h!=="`"||p.charAt(u-1)!==h)return;let g=p.substring(c+1,u-1);if(!uP(g))return new ti(t,c+2,t,u)}dispatchMouse(i){let e=this.configuration.options,t=fn&&e.get(121),o=e.get(28),n=e.get(171);if(i.middleButton&&!t)n||this._columnSelect(i.position,i.mouseColumn,i.inSelectionMode);else if(i.startedOnLineNumbers)this._hasMulticursorModifier(i)?i.inSelectionMode?this._lastCursorLineSelect(i.position,i.revealType):this._createCursor(i.position,!0):i.inSelectionMode?this._lineSelectDrag(i.position,i.revealType):this._lineSelect(i.position,i.revealType);else if(i.mouseDownCount>=4)this._selectAll();else if(i.mouseDownCount===3)this._hasMulticursorModifier(i)?i.inSelectionMode?this._lastCursorLineSelectDrag(i.position,i.revealType):this._lastCursorLineSelect(i.position,i.revealType):i.inSelectionMode?this._lineSelectDrag(i.position,i.revealType):this._lineSelect(i.position,i.revealType);else if(i.mouseDownCount===2){if(!i.onInjectedText)if(this._hasMulticursorModifier(i))this._lastCursorWordSelect(i.position,i.revealType);else if(i.inSelectionMode)this._wordSelectDrag(i.position,i.revealType);else{let r;if(e.get(173)){let s=this.viewModel.model,l=this._convertViewToModelPosition(i.position);r=a._trySelectBracketContent(s,l)||a._trySelectStringContent(s,l)}r?this._select(r):this._wordSelect(i.position,i.revealType)}}else this._hasMulticursorModifier(i)?this._hasNonMulticursorModifier(i)||(i.shiftKey?this._columnSelect(i.position,i.mouseColumn,!0):i.inSelectionMode?this._lastCursorMoveToSelect(i.position,i.revealType):this._createCursor(i.position,!1)):i.inSelectionMode?i.altKey?this._columnSelect(i.position,i.mouseColumn,!0):o?this._columnSelect(i.position,i.mouseColumn,!0):this._moveToSelect(i.position,i.revealType):this.moveTo(i.position,i.revealType)}_usualArgs(i,e){return i=this._validateViewColumn(i),{source:"mouse",position:this._convertViewToModelPosition(i),viewPosition:i,revealType:e}}moveTo(i,e){af.MoveTo.runCoreEditorCommand(this.viewModel,this._usualArgs(i,e))}_moveToSelect(i,e){af.MoveToSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(i,e))}_columnSelect(i,e,t){i=this._validateViewColumn(i),af.ColumnSelect.runCoreEditorCommand(this.viewModel,{source:"mouse",position:this._convertViewToModelPosition(i),viewPosition:i,mouseColumn:e,doColumnSelect:t})}_createCursor(i,e){i=this._validateViewColumn(i),af.CreateCursor.runCoreEditorCommand(this.viewModel,{source:"mouse",position:this._convertViewToModelPosition(i),viewPosition:i,wholeLine:e})}_lastCursorMoveToSelect(i,e){af.LastCursorMoveToSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(i,e))}_wordSelect(i,e){af.WordSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(i,e))}_wordSelectDrag(i,e){af.WordSelectDrag.runCoreEditorCommand(this.viewModel,this._usualArgs(i,e))}_lastCursorWordSelect(i,e){af.LastCursorWordSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(i,e))}_lineSelect(i,e){af.LineSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(i,e))}_lineSelectDrag(i,e){af.LineSelectDrag.runCoreEditorCommand(this.viewModel,this._usualArgs(i,e))}_lastCursorLineSelect(i,e){af.LastCursorLineSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(i,e))}_lastCursorLineSelectDrag(i,e){af.LastCursorLineSelectDrag.runCoreEditorCommand(this.viewModel,this._usualArgs(i,e))}_select(i){af.SetSelection.runCoreEditorCommand(this.viewModel,{source:"mouse",selection:i})}_selectAll(){af.SelectAll.runCoreEditorCommand(this.viewModel,{source:"mouse"})}_convertViewToModelPosition(i){return this.viewModel.coordinatesConverter.convertViewPositionToModelPosition(i)}emitKeyDown(i){this.userInputEvents.emitKeyDown(i)}emitKeyUp(i){this.userInputEvents.emitKeyUp(i)}emitContextMenu(i){this.userInputEvents.emitContextMenu(i)}emitMouseMove(i){this.userInputEvents.emitMouseMove(i)}emitMouseLeave(i){this.userInputEvents.emitMouseLeave(i)}emitMouseUp(i){this.userInputEvents.emitMouseUp(i)}emitMouseDown(i){this.userInputEvents.emitMouseDown(i)}emitMouseDrag(i){this.userInputEvents.emitMouseDrag(i)}emitMouseDrop(i){this.userInputEvents.emitMouseDrop(i)}emitMouseDropCanceled(){this.userInputEvents.emitMouseDropCanceled()}emitMouseWheel(i){this.userInputEvents.emitMouseWheel(i)}};function pf(a,i){let e=mGi();if(e?.createTrustedTypesPolicy)try{return e.createTrustedTypesPolicy(a,i)}catch(t){mt(t);return}try{return globalThis.trustedTypes?.createPolicy(a,i)}catch(t){mt(t);return}}var r5e=class{constructor(i){this._lineFactory=i;this._set(1,[])}flush(){this._set(1,[])}_set(i,e){this._lines=e,this._rendLineNumberStart=i}_get(){return{rendLineNumberStart:this._rendLineNumberStart,lines:this._lines}}getStartLineNumber(){return this._rendLineNumberStart}getEndLineNumber(){return this._rendLineNumberStart+this._lines.length-1}getCount(){return this._lines.length}getLine(i){let e=i-this._rendLineNumberStart;if(e<0||e>=this._lines.length)throw new li("Illegal value for lineNumber");return this._lines[e]}onLinesDeleted(i,e){if(this.getCount()===0)return null;let t=this.getStartLineNumber(),o=this.getEndLineNumber();if(e<t){let l=e-i+1;return this._rendLineNumberStart-=l,null}if(i>o)return null;let n=0,r=0;for(let l=t;l<=o;l++){let c=l-this._rendLineNumberStart;i<=l&&l<=e&&(r===0?(n=c,r=1):r++)}if(i<t){let l=0;e<t?l=e-i+1:l=t-i,this._rendLineNumberStart-=l}return this._lines.splice(n,r)}onLinesChanged(i,e){let t=i+e-1;if(this.getCount()===0)return!1;let o=this.getStartLineNumber(),n=this.getEndLineNumber(),r=!1;for(let s=i;s<=t;s++)s>=o&&s<=n&&(this._lines[s-this._rendLineNumberStart].onContentChanged(),r=!0);return r}onLinesInserted(i,e){if(this.getCount()===0)return null;let t=e-i+1,o=this.getStartLineNumber(),n=this.getEndLineNumber();if(i<=o)return this._rendLineNumberStart+=t,null;if(i>n)return null;if(t+i>n)return this._lines.splice(i-this._rendLineNumberStart,n-i+1);let r=[];for(let p=0;p<t;p++)r[p]=this._lineFactory.createLine();let s=i-this._rendLineNumberStart,l=this._lines.slice(0,s),c=this._lines.slice(s,this._lines.length-t),u=this._lines.slice(this._lines.length-t,this._lines.length);return this._lines=l.concat(r).concat(c),u}onTokensChanged(i){if(this.getCount()===0)return!1;let e=this.getStartLineNumber(),t=this.getEndLineNumber(),o=!1;for(let n=0,r=i.length;n<r;n++){let s=i[n];if(s.toLineNumber<e||s.fromLineNumber>t)continue;let l=Math.max(e,s.fromLineNumber),c=Math.min(t,s.toLineNumber);for(let u=l;u<=c;u++){let p=u-this._rendLineNumberStart;this._lines[p].onTokensChanged(),o=!0}}return o}},fwe=class{constructor(i,e){this._viewContext=i;this._lineFactory=e;this.domNode=this._createDomNode(),this._linesCollection=new r5e(this._lineFactory)}_createDomNode(){let i=ur(document.createElement("div"));return i.setClassName("view-layer"),i.setPosition("absolute"),i.domNode.setAttribute("role","presentation"),i.domNode.setAttribute("aria-hidden","true"),i}onConfigurationChanged(i){return!!i.hasChanged(165)}onFlushed(i,e){if(e){let t=this._linesCollection.getStartLineNumber(),o=this._linesCollection.getEndLineNumber();for(let n=t;n<=o;n++)this._linesCollection.getLine(n).getDomNode()?.remove()}return this._linesCollection.flush(),!0}onLinesChanged(i){return this._linesCollection.onLinesChanged(i.fromLineNumber,i.count)}onLinesDeleted(i){let e=this._linesCollection.onLinesDeleted(i.fromLineNumber,i.toLineNumber);if(e)for(let t=0,o=e.length;t<o;t++)e[t].getDomNode()?.remove();return!0}onLinesInserted(i){let e=this._linesCollection.onLinesInserted(i.fromLineNumber,i.toLineNumber);if(e)for(let t=0,o=e.length;t<o;t++)e[t].getDomNode()?.remove();return!0}onScrollChanged(i){return i.scrollTopChanged}onTokensChanged(i){return this._linesCollection.onTokensChanged(i.ranges)}onZonesChanged(i){return!0}getStartLineNumber(){return this._linesCollection.getStartLineNumber()}getEndLineNumber(){return this._linesCollection.getEndLineNumber()}getVisibleLine(i){return this._linesCollection.getLine(i)}renderLines(i){let e=this._linesCollection._get(),t=new lii(this.domNode.domNode,this._lineFactory,i,this._viewContext),o={rendLineNumberStart:e.rendLineNumberStart,lines:e.lines,linesLength:e.lines.length},n=t.render(o,i.startLineNumber,i.endLineNumber,i.relativeVerticalOffset);this._linesCollection._set(n.rendLineNumberStart,n.lines)}},lii=class a{constructor(i,e,t,o){this._domNode=i;this._lineFactory=e;this._viewportData=t;this._viewContext=o}static{this._ttPolicy=pf("editorViewLayer",{createHTML:i=>i})}render(i,e,t,o){let n={rendLineNumberStart:i.rendLineNumberStart,lines:i.lines.slice(0),linesLength:i.linesLength};if(n.rendLineNumberStart+n.linesLength-1<e||t<n.rendLineNumberStart){n.rendLineNumberStart=e,n.linesLength=t-e+1,n.lines=[];for(let r=e;r<=t;r++)n.lines[r-e]=this._lineFactory.createLine();return this._finishRendering(n,!0,o),n}if(this._renderUntouchedLines(n,Math.max(e-n.rendLineNumberStart,0),Math.min(t-n.rendLineNumberStart,n.linesLength-1),o,e),n.rendLineNumberStart>e){let r=e,s=Math.min(t,n.rendLineNumberStart-1);r<=s&&(this._insertLinesBefore(n,r,s,o,e),n.linesLength+=s-r+1)}else if(n.rendLineNumberStart<e){let r=Math.min(n.linesLength,e-n.rendLineNumberStart);r>0&&(this._removeLinesBefore(n,r),n.linesLength-=r)}if(n.rendLineNumberStart=e,n.rendLineNumberStart+n.linesLength-1<t){let r=n.rendLineNumberStart+n.linesLength,s=t;r<=s&&(this._insertLinesAfter(n,r,s,o,e),n.linesLength+=s-r+1)}else if(n.rendLineNumberStart+n.linesLength-1>t){let r=Math.max(0,t-n.rendLineNumberStart+1),l=n.linesLength-1-r+1;l>0&&(this._removeLinesAfter(n,l),n.linesLength-=l)}return this._finishRendering(n,!1,o),n}_renderUntouchedLines(i,e,t,o,n){let r=i.rendLineNumberStart,s=i.lines;for(let l=e;l<=t;l++){let c=r+l;s[l].layoutLine(c,o[c-n],this._lineHeightForLineNumber(c))}}_insertLinesBefore(i,e,t,o,n){let r=[],s=0;for(let l=e;l<=t;l++)r[s++]=this._lineFactory.createLine();i.lines=r.concat(i.lines)}_removeLinesBefore(i,e){for(let t=0;t<e;t++)i.lines[t].getDomNode()?.remove();i.lines.splice(0,e)}_insertLinesAfter(i,e,t,o,n){let r=[],s=0;for(let l=e;l<=t;l++)r[s++]=this._lineFactory.createLine();i.lines=i.lines.concat(r)}_removeLinesAfter(i,e){let t=i.linesLength-e;for(let o=0;o<e;o++)i.lines[t+o].getDomNode()?.remove();i.lines.splice(t,e)}_finishRenderingNewLines(i,e,t,o){a._ttPolicy&&(t=a._ttPolicy.createHTML(t));let n=this._domNode.lastChild;e||!n?this._domNode.innerHTML=t:n.insertAdjacentHTML("afterend",t);let r=this._domNode.lastChild;for(let s=i.linesLength-1;s>=0;s--){let l=i.lines[s];o[s]&&(l.setDomNode(r),r=r.previousSibling)}}_finishRenderingInvalidLines(i,e,t){let o=document.createElement("div");a._ttPolicy&&(e=a._ttPolicy.createHTML(e)),o.innerHTML=e;for(let n=0;n<i.linesLength;n++){let r=i.lines[n];if(t[n]){let s=o.firstChild;r.getDomNode().replaceWith(s),r.setDomNode(s)}}}static{this._sb=new $S(1e5)}_finishRendering(i,e,t){let o=a._sb,n=i.linesLength,r=i.lines,s=i.rendLineNumberStart,l=[];{o.reset();let c=!1;for(let u=0;u<n;u++){let p=r[u];if(l[u]=!1,p.getDomNode())continue;let g=u+s;p.renderLine(g,t[u],this._lineHeightForLineNumber(g),this._viewportData,o)&&(l[u]=!0,c=!0)}c&&this._finishRenderingNewLines(i,e,o.build(),l)}{o.reset();let c=!1,u=[];for(let p=0;p<n;p++){let h=r[p];if(u[p]=!1,l[p])continue;let g=p+s;h.renderLine(g,t[p],this._lineHeightForLineNumber(g),this._viewportData,o)&&(u[p]=!0,c=!0)}c&&this._finishRenderingInvalidLines(i,o.build(),u)}}_lineHeightForLineNumber(i){return this._viewContext.viewLayout.getLineHeightForLineNumber(i)}};var Wbt=class extends Pu{constructor(e){super(e);this._dynamicOverlays=[];this._isFocused=!1;this._visibleLines=new fwe(this._context,{createLine:()=>new cii(this._dynamicOverlays)}),this.domNode=this._visibleLines.domNode;let o=this._context.configuration.options.get(59);Jd(this.domNode,o),this.domNode.setClassName("view-overlays")}shouldRender(){if(super.shouldRender())return!0;for(let e=0,t=this._dynamicOverlays.length;e<t;e++)if(this._dynamicOverlays[e].shouldRender())return!0;return!1}dispose(){super.dispose();for(let e=0,t=this._dynamicOverlays.length;e<t;e++)this._dynamicOverlays[e].dispose();this._dynamicOverlays=[]}getDomNode(){return this.domNode}addDynamicOverlay(e){this._dynamicOverlays.push(e)}onConfigurationChanged(e){this._visibleLines.onConfigurationChanged(e);let o=this._context.configuration.options.get(59);return Jd(this.domNode,o),!0}onFlushed(e){return this._visibleLines.onFlushed(e)}onFocusChanged(e){return this._isFocused=e.isFocused,!0}onLinesChanged(e){return this._visibleLines.onLinesChanged(e)}onLinesDeleted(e){return this._visibleLines.onLinesDeleted(e)}onLinesInserted(e){return this._visibleLines.onLinesInserted(e)}onScrollChanged(e){return this._visibleLines.onScrollChanged(e)||!0}onTokensChanged(e){return this._visibleLines.onTokensChanged(e)}onZonesChanged(e){return this._visibleLines.onZonesChanged(e)}prepareRender(e){let t=this._dynamicOverlays.filter(o=>o.shouldRender());for(let o=0,n=t.length;o<n;o++){let r=t[o];r.prepareRender(e),r.onDidRender()}}render(e){this._viewOverlaysRender(e),this.domNode.toggleClassName("focused",this._isFocused)}_viewOverlaysRender(e){this._visibleLines.renderLines(e.viewportData)}},cii=class{constructor(i){this._dynamicOverlays=i,this._domNode=null,this._renderedContent=null}getDomNode(){return this._domNode?this._domNode.domNode:null}setDomNode(i){this._domNode=ur(i)}onContentChanged(){}onTokensChanged(){}renderLine(i,e,t,o,n){let r="";for(let s=0,l=this._dynamicOverlays.length;s<l;s++){let c=this._dynamicOverlays[s];r+=c.render(o.startLineNumber,i)}return this._renderedContent===r?!1:(this._renderedContent=r,n.appendString('<div style="top:'),n.appendString(String(e)),n.appendString("px;height:"),n.appendString(String(t)),n.appendString("px;line-height:"),n.appendString(String(t)),n.appendString('px;">'),n.appendString(r),n.appendString("</div>"),!0)}layoutLine(i,e,t){this._domNode&&(this._domNode.setTop(e),this._domNode.setHeight(t),this._domNode.setLineHeight(t))}},Vbt=class extends Wbt{constructor(i){super(i);let t=this._context.configuration.options.get(165);this._contentWidth=t.contentWidth,this.domNode.setHeight(0)}onConfigurationChanged(i){let t=this._context.configuration.options.get(165);return this._contentWidth=t.contentWidth,super.onConfigurationChanged(i)||!0}onScrollChanged(i){return super.onScrollChanged(i)||i.scrollWidthChanged}_viewOverlaysRender(i){super._viewOverlaysRender(i),this.domNode.setWidth(Math.max(i.scrollWidth,this._contentWidth))}},Bbt=class extends Wbt{constructor(i){super(i);let e=this._context.configuration.options,t=e.get(165);this._contentLeft=t.contentLeft,this.domNode.setClassName("margin-view-overlays"),this.domNode.setWidth(1),Jd(this.domNode,e.get(59))}onConfigurationChanged(i){let e=this._context.configuration.options;Jd(this.domNode,e.get(59));let t=e.get(165);return this._contentLeft=t.contentLeft,super.onConfigurationChanged(i)||!0}onScrollChanged(i){return super.onScrollChanged(i)||i.scrollHeightChanged}_viewOverlaysRender(i){super._viewOverlaysRender(i);let e=Math.min(i.scrollHeight,1e6);this.domNode.setHeight(e),this.domNode.setWidth(this._contentLeft)}};var vwe=class a{constructor(i){this.onKeyDown=null;this.onKeyUp=null;this.onContextMenu=null;this.onMouseMove=null;this.onMouseLeave=null;this.onMouseDown=null;this.onMouseUp=null;this.onMouseDrag=null;this.onMouseDrop=null;this.onMouseDropCanceled=null;this.onMouseWheel=null;this._coordinatesConverter=i}emitKeyDown(i){this.onKeyDown?.(i)}emitKeyUp(i){this.onKeyUp?.(i)}emitContextMenu(i){this.onContextMenu?.(this._convertViewToModelMouseEvent(i))}emitMouseMove(i){this.onMouseMove?.(this._convertViewToModelMouseEvent(i))}emitMouseLeave(i){this.onMouseLeave?.(this._convertViewToModelMouseEvent(i))}emitMouseDown(i){this.onMouseDown?.(this._convertViewToModelMouseEvent(i))}emitMouseUp(i){this.onMouseUp?.(this._convertViewToModelMouseEvent(i))}emitMouseDrag(i){this.onMouseDrag?.(this._convertViewToModelMouseEvent(i))}emitMouseDrop(i){this.onMouseDrop?.(this._convertViewToModelMouseEvent(i))}emitMouseDropCanceled(){this.onMouseDropCanceled?.()}emitMouseWheel(i){this.onMouseWheel?.(i)}_convertViewToModelMouseEvent(i){return i.target?{event:i.event,target:this._convertViewToModelMouseTarget(i.target)}:i}_convertViewToModelMouseTarget(i){return a.convertViewToModelMouseTarget(i,this._coordinatesConverter)}static convertViewToModelMouseTarget(i,e){let t={...i};return t.position&&(t.position=e.convertViewPositionToModelPosition(t.position)),t.range&&(t.range=e.convertViewRangeToModelRange(t.range)),(t.type===5||t.type===8)&&(t.detail=this.convertViewToModelViewZoneData(t.detail,e)),t}static convertViewToModelViewZoneData(i,e){return{viewZoneId:i.viewZoneId,positionBefore:i.positionBefore?e.convertViewPositionToModelPosition(i.positionBefore):i.positionBefore,positionAfter:i.positionAfter?e.convertViewPositionToModelPosition(i.positionAfter):i.positionAfter,position:e.convertViewPositionToModelPosition(i.position),afterLineNumber:e.convertViewPositionToModelPosition(new ye(i.afterLineNumber,1)).lineNumber}}};var Hbt=class extends Pu{constructor(e){super(e);this.blocks=[];this.contentWidth=-1;this.contentLeft=0;this.domNode=ur(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this.domNode.setClassName("blockDecorations-container"),this.update()}update(){let e=!1,o=this._context.configuration.options.get(165),n=o.contentWidth-o.verticalScrollbarWidth;this.contentWidth!==n&&(this.contentWidth=n,e=!0);let r=o.contentLeft;return this.contentLeft!==r&&(this.contentLeft=r,e=!0),e}dispose(){super.dispose()}onConfigurationChanged(e){return this.update()}onScrollChanged(e){return e.scrollTopChanged||e.scrollLeftChanged}onDecorationsChanged(e){return!0}onZonesChanged(e){return!0}prepareRender(e){}render(e){let t=0,o=e.getDecorationsInViewport();for(let n of o){if(!n.options.blockClassName)continue;let r=this.blocks[t];r||(r=this.blocks[t]=ur(document.createElement("div")),this.domNode.appendChild(r));let s,l;n.options.blockIsAfterEnd?(s=e.getVerticalOffsetAfterLineNumber(n.range.endLineNumber,!1),l=e.getVerticalOffsetAfterLineNumber(n.range.endLineNumber,!0)):(s=e.getVerticalOffsetForLineNumber(n.range.startLineNumber,!0),l=n.range.isEmpty()&&!n.options.blockDoesNotCollapse?e.getVerticalOffsetForLineNumber(n.range.startLineNumber,!1):e.getVerticalOffsetAfterLineNumber(n.range.endLineNumber,!0));let[c,u,p,h]=n.options.blockPadding??[0,0,0,0];r.setClassName("blockDecorations-block "+n.options.blockClassName),r.setLeft(this.contentLeft-h),r.setWidth(this.contentWidth+h+u),r.setTop(s-e.scrollTop-c),r.setHeight(l-s+c+p),t++}for(let n=t;n<this.blocks.length;n++)this.blocks[n].domNode.remove();this.blocks.length=t}};var Ubt=class extends Pu{constructor(i,e){super(i),this._viewDomNode=e,this._widgets={},this.domNode=ur(document.createElement("div")),YS.write(this.domNode,1),this.domNode.setClassName("contentWidgets"),this.domNode.setPosition("absolute"),this.domNode.setTop(0),this.overflowingContentWidgetsDomNode=ur(document.createElement("div")),YS.write(this.overflowingContentWidgetsDomNode,2),this.overflowingContentWidgetsDomNode.setClassName("overflowingContentWidgets")}dispose(){super.dispose(),this._widgets={}}onConfigurationChanged(i){let e=Object.keys(this._widgets);for(let t of e)this._widgets[t].onConfigurationChanged(i);return!0}onDecorationsChanged(i){return!0}onFlushed(i){return!0}onLineMappingChanged(i){return this._updateAnchorsViewPositions(),!0}onLinesChanged(i){return this._updateAnchorsViewPositions(),!0}onLinesDeleted(i){return this._updateAnchorsViewPositions(),!0}onLinesInserted(i){return this._updateAnchorsViewPositions(),!0}onScrollChanged(i){return!0}onZonesChanged(i){return!0}_updateAnchorsViewPositions(){let i=Object.keys(this._widgets);for(let e of i)this._widgets[e].updateAnchorViewPosition()}addWidget(i){let e=new uii(this._context,this._viewDomNode,i);this._widgets[e.id]=e,e.allowEditorOverflow?this.overflowingContentWidgetsDomNode.appendChild(e.domNode):this.domNode.appendChild(e.domNode),this.setShouldRender()}setWidgetPosition(i,e,t,o,n){let r=this._widgets[i.getId()];r.setPosition(e,t,o,n),r.useDisplayNone||this.setShouldRender()}removeWidget(i){let e=i.getId();if(this._widgets.hasOwnProperty(e)){let t=this._widgets[e];delete this._widgets[e];let o=t.domNode.domNode;o.remove(),o.removeAttribute("monaco-visible-content-widget"),this.setShouldRender()}}shouldSuppressMouseDownOnWidget(i){return this._widgets.hasOwnProperty(i)?this._widgets[i].suppressMouseDown:!1}onBeforeRender(i){let e=Object.keys(this._widgets);for(let t of e)this._widgets[t].onBeforeRender(i)}prepareRender(i){let e=Object.keys(this._widgets);for(let t of e)this._widgets[t].prepareRender(i)}render(i){let e=Object.keys(this._widgets);for(let t of e)this._widgets[t].render(i)}},uii=class{constructor(i,e,t){this._primaryAnchor=new wle(null,null);this._secondaryAnchor=new wle(null,null);this._context=i,this._viewDomNode=e,this._actual=t;let o=this._context.configuration.options,n=o.get(165),r=o.get(4);this.domNode=ur(this._actual.getDomNode()),this.id=this._actual.getId(),this.allowEditorOverflow=(this._actual.allowEditorOverflow||!1)&&r,this.suppressMouseDown=this._actual.suppressMouseDown||!1,this.useDisplayNone=this._actual.useDisplayNone||!1,this._fixedOverflowWidgets=o.get(51),this._contentWidth=n.contentWidth,this._contentLeft=n.contentLeft,this._affinity=null,this._preference=[],this._cachedDomNodeOffsetWidth=-1,this._cachedDomNodeOffsetHeight=-1,this._maxWidth=this._getMaxWidth(),this._isVisible=!1,this._renderData=null,this.domNode.setPosition(this._fixedOverflowWidgets&&this.allowEditorOverflow?"fixed":"absolute"),this.domNode.setDisplay("none"),this.domNode.setVisibility("hidden"),this.domNode.setAttribute("widgetId",this.id),this.domNode.setMaxWidth(this._maxWidth)}onConfigurationChanged(i){let e=this._context.configuration.options;if(i.hasChanged(165)){let t=e.get(165);this._contentLeft=t.contentLeft,this._contentWidth=t.contentWidth,this._maxWidth=this._getMaxWidth()}}updateAnchorViewPosition(){this._setPosition(this._affinity,this._primaryAnchor.modelPosition,this._secondaryAnchor.modelPosition)}_setPosition(i,e,t){this._affinity=i,this._primaryAnchor=o(e,this._context.viewModel,this._affinity),this._secondaryAnchor=o(t,this._context.viewModel,this._affinity);function o(n,r,s){if(!n)return new wle(null,null);let l=r.model.validatePosition(n);if(r.coordinatesConverter.modelPositionIsVisible(l)){let c=r.coordinatesConverter.convertModelPositionToViewPosition(l,s??void 0);return new wle(n,c)}return new wle(n,null)}}_getMaxWidth(){let i=this.domNode.domNode.ownerDocument,e=i.defaultView;return this.allowEditorOverflow?e?.innerWidth||i.documentElement.offsetWidth||i.body.offsetWidth:this._contentWidth}setPosition(i,e,t,o){this._setPosition(o,i,e),this._preference=t,!this.useDisplayNone&&this._primaryAnchor.viewPosition&&this._preference&&this._preference.length>0?this.domNode.setDisplay("block"):this.domNode.setDisplay("none"),this._cachedDomNodeOffsetWidth=-1,this._cachedDomNodeOffsetHeight=-1}_layoutBoxInViewport(i,e,t,o){let n=i.top,r=n,s=i.top+i.height,l=o.viewportHeight-s,c=n-t,u=r>=t,p=s,h=l>=t,g=i.left;return g+e>o.scrollLeft+o.viewportWidth&&(g=o.scrollLeft+o.viewportWidth-e),g<o.scrollLeft&&(g=o.scrollLeft),{fitsAbove:u,aboveTop:c,fitsBelow:h,belowTop:p,left:g}}_layoutHorizontalSegmentInPage(i,e,t,o){let s=Math.max(15,e.left-o),l=Math.min(e.left+e.width+o,i.width-15),u=this._viewDomNode.domNode.ownerDocument.defaultView,p=e.left+t-(u?.scrollX??0);if(p+o>l){let h=p-(l-o);p-=h,t-=h}if(p<s){let h=p-s;p-=h,t-=h}return[t,p]}_layoutBoxInPage(i,e,t,o){let n=i.top-t,r=i.top+i.height,s=ir(this._viewDomNode.domNode),l=this._viewDomNode.domNode.ownerDocument,c=l.defaultView,u=s.top+n-(c?.scrollY??0),p=s.top+r-(c?.scrollY??0),h=$m(l.body),[g,f]=this._layoutHorizontalSegmentInPage(h,s,i.left-o.scrollLeft+this._contentLeft,e),v=22,b=22,S=u>=v,y=p+t<=h.height-b;return this._fixedOverflowWidgets?{fitsAbove:S,aboveTop:Math.max(u,v),fitsBelow:y,belowTop:p,left:f}:{fitsAbove:S,aboveTop:n,fitsBelow:y,belowTop:r,left:g}}_prepareRenderWidgetAtExactPositionOverflowing(i){return new Cle(i.top,i.left+this._contentLeft)}_getAnchorsCoordinates(i){let e=n(this._primaryAnchor.viewPosition,this._affinity),t=this._secondaryAnchor.viewPosition?.lineNumber===this._primaryAnchor.viewPosition?.lineNumber?this._secondaryAnchor.viewPosition:null,o=n(t,this._affinity);return{primary:e,secondary:o};function n(r,s){if(!r)return null;let l=i.visibleRangeForPosition(r);if(!l)return null;let c=r.column===1&&s===3?0:l.left,u=i.getVerticalOffsetForLineNumber(r.lineNumber)-i.scrollTop,p=i.getLineHeightForLineNumber(r.lineNumber);return new zbt(u,c,p)}}_reduceAnchorCoordinates(i,e,t){if(!e)return i;let o=this._context.configuration.options.get(59),n=e.left;return n<i.left?n=Math.max(n,i.left-t+o.typicalFullwidthCharacterWidth):n=Math.min(n,i.left+t-o.typicalFullwidthCharacterWidth),new zbt(i.top,n,i.height)}_prepareRenderWidget(i){if(!this._preference||this._preference.length===0)return null;let{primary:e,secondary:t}=this._getAnchorsCoordinates(i);if(!e)return{kind:"offViewport",preserveFocus:this.domNode.domNode.contains(this.domNode.domNode.ownerDocument.activeElement)};if(this._cachedDomNodeOffsetWidth===-1||this._cachedDomNodeOffsetHeight===-1){let r=null;if(typeof this._actual.beforeRender=="function"&&(r=dii(this._actual.beforeRender,this._actual)),r)this._cachedDomNodeOffsetWidth=r.width,this._cachedDomNodeOffsetHeight=r.height;else{let l=this.domNode.domNode.getBoundingClientRect();this._cachedDomNodeOffsetWidth=Math.round(l.width),this._cachedDomNodeOffsetHeight=Math.round(l.height)}}let o=this._reduceAnchorCoordinates(e,t,this._cachedDomNodeOffsetWidth),n;this.allowEditorOverflow?n=this._layoutBoxInPage(o,this._cachedDomNodeOffsetWidth,this._cachedDomNodeOffsetHeight,i):n=this._layoutBoxInViewport(o,this._cachedDomNodeOffsetWidth,this._cachedDomNodeOffsetHeight,i);for(let r=1;r<=2;r++)for(let s of this._preference)if(s===1){if(!n)return null;if(r===2||n.fitsAbove)return{kind:"inViewport",coordinate:new Cle(n.aboveTop,n.left),position:1}}else if(s===2){if(!n)return null;if(r===2||n.fitsBelow)return{kind:"inViewport",coordinate:new Cle(n.belowTop,n.left),position:2}}else return this.allowEditorOverflow?{kind:"inViewport",coordinate:this._prepareRenderWidgetAtExactPositionOverflowing(new Cle(o.top,o.left)),position:0}:{kind:"inViewport",coordinate:new Cle(o.top,o.left),position:0};return null}onBeforeRender(i){!this._primaryAnchor.viewPosition||!this._preference||this._primaryAnchor.viewPosition.lineNumber<i.startLineNumber||this._primaryAnchor.viewPosition.lineNumber>i.endLineNumber||this.domNode.setMaxWidth(this._maxWidth)}prepareRender(i){this._renderData=this._prepareRenderWidget(i)}render(i){if(!this._renderData||this._renderData.kind==="offViewport"){this._isVisible&&(this.domNode.removeAttribute("monaco-visible-content-widget"),this._isVisible=!1,this._renderData?.kind==="offViewport"&&this._renderData.preserveFocus?this.domNode.setTop(-1e3):this.domNode.setVisibility("hidden")),typeof this._actual.afterRender=="function"&&dii(this._actual.afterRender,this._actual,null,null);return}this.allowEditorOverflow?(this.domNode.setTop(this._renderData.coordinate.top),this.domNode.setLeft(this._renderData.coordinate.left)):(this.domNode.setTop(this._renderData.coordinate.top+i.scrollTop-i.bigNumbersDelta),this.domNode.setLeft(this._renderData.coordinate.left)),this._isVisible||(this.domNode.setVisibility("inherit"),this.domNode.setAttribute("monaco-visible-content-widget","true"),this._isVisible=!0),typeof this._actual.afterRender=="function"&&dii(this._actual.afterRender,this._actual,this._renderData.position,this._renderData.coordinate)}},wle=class{constructor(i,e){this.modelPosition=i;this.viewPosition=e}},Cle=class{constructor(i,e){this.top=i;this.left=e;this._coordinateBrand=void 0}},zbt=class{constructor(i,e,t){this.top=i;this.left=e;this.height=t;this._anchorCoordinateBrand=void 0}};function dii(a,i,...e){try{return a.call(i,...e)}catch{return null}}var EC=class extends wE{};var Le=le("themeService");function Xs(a){return{id:a}}var c3i=R.file,wj=R.folder;function Cj(a){switch(a){case"dark":return"vs-dark";case"hcDark":return"hc-black";case"hcLight":return"hc-light";default:return"vs"}}var hii={ThemingContribution:"base.contributions.theming"},pii=class extends x{constructor(){super();this.themingParticipants=[];this.themingParticipants=[],this.onThemingParticipantAddedEmitter=this._register(new E)}onColorThemeChange(e){return this.themingParticipants.push(e),this.onThemingParticipantAddedEmitter.fire(e),Z(()=>{let t=this.themingParticipants.indexOf(e);this.themingParticipants.splice(t,1)})}get onThemingParticipantAdded(){return this.onThemingParticipantAddedEmitter.event}getThemingParticipants(){return this.themingParticipants}},d3i=new pii;ne.add(hii.ThemingContribution,d3i);function is(a){return d3i.onColorThemeChange(a)}var yu=class extends x{constructor(e){super();this.themeService=e;this.theme=e.getColorTheme(),this._register(this.themeService.onDidColorThemeChange(t=>this.onThemeChange(t)))}onThemeChange(e){this.theme=e,this.updateStyles()}updateStyles(){}getColor(e,t){let o=this.theme.getColor(e);return o&&t&&(o=t(o,this.theme)),o?o.toString():null}};var bwe=te("editor.lineHighlightBackground",null,d(791,null)),u3i=te("editor.inactiveLineHighlightBackground",bwe,d(790,null)),gii=te("editor.lineHighlightBorder",{dark:"#282828",light:"#eeeeee",hcDark:"#f38518",hcLight:bi},d(792,null)),p3i=te("editor.rangeHighlightBackground",{dark:"#ffffff0b",light:"#fdff0033",hcDark:null,hcLight:null},d(797,null),!0),A3n=te("editor.rangeHighlightBorder",{dark:null,light:null,hcDark:Ys,hcLight:Ys},d(798,null)),N3n=te("editor.symbolHighlightBackground",{dark:rS,light:rS,hcDark:null,hcLight:null},d(799,null),!0),O3n=te("editor.symbolHighlightBorder",{dark:null,light:null,hcDark:Ys,hcLight:Ys},d(800,null)),B7=te("editorCursor.foreground",{dark:"#AEAFAD",light:We.black,hcDark:We.white,hcLight:"#0F4A85"},d(731,null)),Kbt=te("editorCursor.background",null,d(766,null)),Gbt=te("editorMultiCursor.primary.foreground",B7,d(781,null)),m3i=te("editorMultiCursor.primary.background",Kbt,d(780,null)),qbt=te("editorMultiCursor.secondary.foreground",B7,d(783,null)),h3i=te("editorMultiCursor.secondary.background",Kbt,d(782,null)),Swe=te("editorWhitespace.foreground",{dark:"#e3e4e229",light:"#33333333",hcDark:"#e3e4e229",hcLight:"#CCCCCC"},d(789,null)),g3i=te("editorLineNumber.foreground",{dark:"#858585",light:"#237893",hcDark:We.white,hcLight:"#292929"},d(779,null)),sVo=te("editorIndentGuide.background",Swe,d(772,null),!1,d(734,null)),aVo=te("editorIndentGuide.activeBackground",Swe,d(735,null),!1,d(732,null)),$bt=te("editorIndentGuide.background1",sVo,d(773,null)),f3i=te("editorIndentGuide.background2","#00000000",d(774,null)),v3i=te("editorIndentGuide.background3","#00000000",d(775,null)),b3i=te("editorIndentGuide.background4","#00000000",d(776,null)),S3i=te("editorIndentGuide.background5","#00000000",d(777,null)),I3i=te("editorIndentGuide.background6","#00000000",d(778,null)),jbt=te("editorIndentGuide.activeBackground1",aVo,d(736,null)),y3i=te("editorIndentGuide.activeBackground2","#00000000",d(737,null)),w3i=te("editorIndentGuide.activeBackground3","#00000000",d(738,null)),C3i=te("editorIndentGuide.activeBackground4","#00000000",d(739,null)),x3i=te("editorIndentGuide.activeBackground5","#00000000",d(740,null)),k3i=te("editorIndentGuide.activeBackground6","#00000000",d(741,null)),lVo=te("editorActiveLineNumber.foreground",{dark:"#c6c6c6",light:"#0B216F",hcDark:Ys,hcLight:Ys},d(742,null),!1,d(733,null)),F3n=te("editorLineNumber.activeForeground",lVo,d(742,null)),E3i=te("editorLineNumber.dimmedForeground",null,d(767,null)),T3i=te("editorRuler.foreground",{dark:"#5A5A5A",light:We.lightgrey,hcDark:We.white,hcLight:"#292929"},d(786,null)),W3n=te("editorCodeLens.foreground",{dark:"#999999",light:"#919191",hcDark:"#999999",hcLight:"#292929"},d(765,null)),V3n=te("editorBracketMatch.background",{dark:"#0064001a",light:"#0064001a",hcDark:"#0064001a",hcLight:"#0000"},d(750,null)),B3n=te("editorBracketMatch.border",{dark:"#888",light:"#B9B9B9",hcDark:bi,hcLight:bi},d(751,null)),_3i=te("editorBracketMatch.foreground",null,d(752,null)),Qbt=te("editorOverviewRuler.border",{dark:"#7f7f7f4d",light:"#7f7f7f4d",hcDark:"#7f7f7f4d",hcLight:"#666666"},d(785,null)),D3i=te("editorOverviewRuler.background",null,d(784,null)),H3n=te("editorGutter.background",Ho,d(771,null)),U3n=te("editorUnnecessaryCode.border",{dark:null,light:null,hcDark:We.fromHex("#fff").transparent(.8),hcLight:bi},d(801,null)),L3i=te("editorUnnecessaryCode.opacity",{dark:We.fromHex("#000a"),light:We.fromHex("#0007"),hcDark:null,hcLight:null},d(802,null)),z3n=te("editorGhostText.border",{dark:null,light:null,hcDark:We.fromHex("#fff").transparent(.8),hcLight:We.fromHex("#292929").transparent(.8)},d(769,null)),R3i=te("editorGhostText.foreground",{dark:We.fromHex("#ffffff56"),light:We.fromHex("#0007"),hcDark:null,hcLight:null},d(770,null)),K3n=te("editorGhostText.background",null,d(768,null)),cVo=new We(new zt(0,122,204,.6)),Iwe=te("editorOverviewRuler.rangeHighlightForeground",cVo,d(795,null),!0),ywe=te("editorOverviewRuler.errorForeground",{dark:new We(new zt(255,18,18,.7)),light:new We(new zt(255,18,18,.7)),hcDark:new We(new zt(255,50,50,1)),hcLight:"#B5200D"},d(793,null)),M3i=te("editorOverviewRuler.warningForeground",{dark:jh,light:jh,hcDark:E7,hcLight:E7},d(796,null)),wwe=te("editorOverviewRuler.infoForeground",{dark:Dm,light:Dm,hcDark:T7,hcLight:T7},d(794,null)),Ybt=te("editorBracketHighlight.foreground1",{dark:"#FFD700",light:"#0431FAFF",hcDark:"#FFD700",hcLight:"#0431FAFF"},d(743,null)),Xbt=te("editorBracketHighlight.foreground2",{dark:"#DA70D6",light:"#319331FF",hcDark:"#DA70D6",hcLight:"#319331FF"},d(744,null)),Jbt=te("editorBracketHighlight.foreground3",{dark:"#179FFF",light:"#7B3814FF",hcDark:"#87CEFA",hcLight:"#7B3814FF"},d(745,null)),Zbt=te("editorBracketHighlight.foreground4","#00000000",d(746,null)),eSt=te("editorBracketHighlight.foreground5","#00000000",d(747,null)),tSt=te("editorBracketHighlight.foreground6","#00000000",d(748,null)),P3i=te("editorBracketHighlight.unexpectedBracket.foreground",{dark:new We(new zt(255,18,18,.8)),light:new We(new zt(255,18,18,.8)),hcDark:new We(new zt(255,50,50,1)),hcLight:"#B5200D"},d(749,null)),A3i=te("editorBracketPairGuide.background1","#00000000",d(759,null)),N3i=te("editorBracketPairGuide.background2","#00000000",d(760,null)),O3i=te("editorBracketPairGuide.background3","#00000000",d(761,null)),F3i=te("editorBracketPairGuide.background4","#00000000",d(762,null)),W3i=te("editorBracketPairGuide.background5","#00000000",d(763,null)),V3i=te("editorBracketPairGuide.background6","#00000000",d(764,null)),B3i=te("editorBracketPairGuide.activeBackground1","#00000000",d(753,null)),H3i=te("editorBracketPairGuide.activeBackground2","#00000000",d(754,null)),U3i=te("editorBracketPairGuide.activeBackground3","#00000000",d(755,null)),z3i=te("editorBracketPairGuide.activeBackground4","#00000000",d(756,null)),K3i=te("editorBracketPairGuide.activeBackground5","#00000000",d(757,null)),G3i=te("editorBracketPairGuide.activeBackground6","#00000000",d(758,null)),G3n=te("editorUnicodeHighlight.border",jh,d(788,null)),q3n=te("editorUnicodeHighlight.background",y5i,d(787,null));is((a,i)=>{let e=a.getColor(Ho),t=a.getColor(bwe),o=t&&!t.isTransparent()?t:e;o&&i.addRule(`.monaco-editor .inputarea.ime-input { background-color: ${o}; }`)});var iSt=class extends EC{constructor(i){super(),this._context=i;let e=this._context.configuration.options,t=e.get(165);this._renderLineHighlight=e.get(110),this._renderLineHighlightOnlyWhenFocus=e.get(111),this._wordWrap=t.isViewportWrapping,this._contentLeft=t.contentLeft,this._contentWidth=t.contentWidth,this._selectionIsEmpty=!0,this._focused=!1,this._cursorLineNumbers=[1],this._selections=[new ti(1,1,1,1)],this._renderData=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),super.dispose()}_readFromSelections(){let i=!1,e=new Set;for(let n of this._selections)e.add(n.positionLineNumber);let t=Array.from(e);t.sort((n,r)=>n-r),$i(this._cursorLineNumbers,t)||(this._cursorLineNumbers=t,i=!0);let o=this._selections.every(n=>n.isEmpty());return this._selectionIsEmpty!==o&&(this._selectionIsEmpty=o,i=!0),i}onThemeChanged(i){return this._readFromSelections()}onConfigurationChanged(i){let e=this._context.configuration.options,t=e.get(165);return this._renderLineHighlight=e.get(110),this._renderLineHighlightOnlyWhenFocus=e.get(111),this._wordWrap=t.isViewportWrapping,this._contentLeft=t.contentLeft,this._contentWidth=t.contentWidth,!0}onCursorStateChanged(i){return this._selections=i.selections,this._readFromSelections()}onFlushed(i){return!0}onLinesDeleted(i){return!0}onLinesInserted(i){return!0}onScrollChanged(i){return i.scrollWidthChanged||i.scrollTopChanged}onZonesChanged(i){return!0}onFocusChanged(i){return this._renderLineHighlightOnlyWhenFocus?(this._focused=i.isFocused,!0):!1}prepareRender(i){if(!this._shouldRenderThis()){this._renderData=null;return}let e=i.visibleRange.startLineNumber,t=i.visibleRange.endLineNumber,o=[];for(let r=e;r<=t;r++){let s=r-e;o[s]=""}if(this._wordWrap){let r=this._renderOne(i,!1);for(let s of this._cursorLineNumbers){let l=this._context.viewModel.coordinatesConverter,c=l.convertViewPositionToModelPosition(new ye(s,1)).lineNumber,u=l.convertModelPositionToViewPosition(new ye(c,1)).lineNumber,p=l.convertModelPositionToViewPosition(new ye(c,this._context.viewModel.model.getLineMaxColumn(c))).lineNumber,h=Math.max(u,e),g=Math.min(p,t);for(let f=h;f<=g;f++){let v=f-e;o[v]=r}}}let n=this._renderOne(i,!0);for(let r of this._cursorLineNumbers){if(r<e||r>t)continue;let s=r-e;o[s]=n}this._renderData=o}render(i,e){if(!this._renderData)return"";let t=e-i;return t>=this._renderData.length?"":this._renderData[t]}_shouldRenderInMargin(){return(this._renderLineHighlight==="gutter"||this._renderLineHighlight==="all")&&(!this._renderLineHighlightOnlyWhenFocus||this._focused)}_shouldRenderInContent(){return(this._renderLineHighlight==="line"||this._renderLineHighlight==="all")&&this._selectionIsEmpty&&(!this._renderLineHighlightOnlyWhenFocus||this._focused)}},oSt=class extends iSt{_renderOne(i,e){return`<div class="${"current-line"+(this._shouldRenderInMargin()?" current-line-both":"")+(e?" current-line-exact":"")}" style="width:${Math.max(i.scrollWidth,this._contentWidth)}px;"></div>`}_shouldRenderThis(){return this._shouldRenderInContent()}_shouldRenderOther(){return this._shouldRenderInMargin()}},nSt=class extends iSt{_renderOne(i,e){return`<div class="${"current-line"+(this._shouldRenderInMargin()?" current-line-margin":"")+(this._shouldRenderOther()?" current-line-margin-both":"")+(this._shouldRenderInMargin()&&e?" current-line-exact-margin":"")}" style="width:${this._contentLeft}px"></div>`}_shouldRenderThis(){return!0}_shouldRenderOther(){return this._shouldRenderInContent()}};is((a,i)=>{let e=a.getColor(bwe),t=a.getColor(u3i);if(e&&(i.addRule(`.monaco-editor.focused .view-overlays .current-line { background-color: ${e}; }`),i.addRule(`.monaco-editor.focused .margin-view-overlays .current-line-margin { background-color: ${e}; border: none; }`)),t&&(i.addRule(`.monaco-editor .view-overlays .current-line { background-color: ${t}; }`),i.addRule(`.monaco-editor .margin-view-overlays .current-line-margin { background-color: ${t}; border: none; }`)),!e||e.isTransparent()||a.defines(gii)){let o=a.getColor(gii);o&&(i.addRule(`.monaco-editor .view-overlays .current-line-exact { border: 2px solid ${o}; }`),i.addRule(`.monaco-editor .margin-view-overlays .current-line-exact-margin { border: 2px solid ${o}; }`),uf(a.type)&&(i.addRule(".monaco-editor .view-overlays .current-line-exact { border-width: 1px; }"),i.addRule(".monaco-editor .margin-view-overlays .current-line-exact-margin { border-width: 1px; }")))}});var rSt=class extends EC{constructor(i){super(),this._context=i;let e=this._context.configuration.options;this._typicalHalfwidthCharacterWidth=e.get(59).typicalHalfwidthCharacterWidth,this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(i){let e=this._context.configuration.options;return this._typicalHalfwidthCharacterWidth=e.get(59).typicalHalfwidthCharacterWidth,!0}onDecorationsChanged(i){return!0}onFlushed(i){return!0}onLinesChanged(i){return!0}onLinesDeleted(i){return!0}onLinesInserted(i){return!0}onScrollChanged(i){return i.scrollTopChanged||i.scrollWidthChanged}onZonesChanged(i){return!0}prepareRender(i){let e=i.getDecorationsInViewport(),t=[],o=0;for(let l=0,c=e.length;l<c;l++){let u=e[l];u.options.className&&(t[o++]=u)}t=t.sort((l,c)=>{if(l.options.zIndex<c.options.zIndex)return-1;if(l.options.zIndex>c.options.zIndex)return 1;let u=l.options.className,p=c.options.className;return u<p?-1:u>p?1:z.compareRangesUsingStarts(l.range,c.range)});let n=i.visibleRange.startLineNumber,r=i.visibleRange.endLineNumber,s=[];for(let l=n;l<=r;l++){let c=l-n;s[c]=""}this._renderWholeLineDecorations(i,t,s),this._renderNormalDecorations(i,t,s),this._renderResult=s}_renderWholeLineDecorations(i,e,t){let o=i.visibleRange.startLineNumber,n=i.visibleRange.endLineNumber;for(let r=0,s=e.length;r<s;r++){let l=e[r];if(!l.options.isWholeLine)continue;let c='<div class="cdr '+l.options.className+'" style="left:0;width:100%;"></div>',u=Math.max(l.range.startLineNumber,o),p=Math.min(l.range.endLineNumber,n);for(let h=u;h<=p;h++){let g=h-o;t[g]+=c}}}_renderNormalDecorations(i,e,t){let o=i.visibleRange.startLineNumber,n=null,r=!1,s=null,l=!1;for(let c=0,u=e.length;c<u;c++){let p=e[c];if(p.options.isWholeLine)continue;let h=p.options.className,g=!!p.options.showIfCollapsed,f=p.range;if(g&&f.endColumn===1&&f.endLineNumber!==f.startLineNumber&&(f=new z(f.startLineNumber,f.startColumn,f.endLineNumber-1,this._context.viewModel.getLineMaxColumn(f.endLineNumber-1))),n===h&&r===g&&z.areIntersectingOrTouching(s,f)){s=z.plusRange(s,f);continue}n!==null&&this._renderNormalDecoration(i,s,n,l,r,o,t),n=h,r=g,s=f,l=p.options.shouldFillLineOnLineBreak??!1}n!==null&&this._renderNormalDecoration(i,s,n,l,r,o,t)}_renderNormalDecoration(i,e,t,o,n,r,s){let l=i.linesVisibleRangesForRange(e,t==="findMatch");if(l)for(let c=0,u=l.length;c<u;c++){let p=l[c];if(p.outsideRenderedLine)continue;let h=p.lineNumber-r;if(n&&p.ranges.length===1){let g=p.ranges[0];if(g.width<this._typicalHalfwidthCharacterWidth){let f=Math.round(g.left+g.width/2),v=Math.max(0,Math.round(f-this._typicalHalfwidthCharacterWidth/2));p.ranges[0]=new P7(v,this._typicalHalfwidthCharacterWidth)}}for(let g=0,f=p.ranges.length;g<f;g++){let v=o&&p.continuesOnNextLine&&f===1,b=p.ranges[g],S='<div class="cdr '+t+'" style="left:'+String(b.left)+"px;width:"+(v?"100%;":String(b.width)+"px;")+'"></div>';s[h]+=S}}}render(i,e){if(!this._renderResult)return"";let t=e-i;return t<0||t>=this._renderResult.length?"":this._renderResult[t]}};var sSt=class extends Pu{constructor(i,e,t,o){super(i);let n=this._context.configuration.options,r=n.get(117),s=n.get(83),l=n.get(49),c=n.get(120),u=n.get(158),p={listenOnDomNode:t.domNode,className:"editor-scrollable "+Cj(i.theme.type),useShadows:!1,lazyRender:!0,vertical:r.vertical,horizontal:r.horizontal,verticalHasArrows:r.verticalHasArrows,horizontalHasArrows:r.horizontalHasArrows,verticalScrollbarSize:r.verticalScrollbarSize,verticalSliderSize:r.verticalSliderSize,horizontalScrollbarSize:r.horizontalScrollbarSize,horizontalSliderSize:r.horizontalSliderSize,handleMouseWheel:r.handleMouseWheel,alwaysConsumeMouseWheel:r.alwaysConsumeMouseWheel,arrowSize:r.arrowSize,mouseWheelScrollSensitivity:s,fastScrollSensitivity:l,scrollPredominantAxis:c,scrollByPage:r.scrollByPage,inertialScroll:u};this.scrollbar=this._register(new _O(e.domNode,p,this._context.viewLayout.getScrollable())),YS.write(this.scrollbar.getDomNode(),6),this.scrollbarDomNode=ur(this.scrollbar.getDomNode()),this.scrollbarDomNode.setPosition("absolute"),this._setLayout();let h=(g,f,v)=>{let b={};if(f){let S=g.scrollTop;S&&(b.scrollTop=this._context.viewLayout.getCurrentScrollTop()+S,g.scrollTop=0)}if(v){let S=g.scrollLeft;S&&(b.scrollLeft=this._context.viewLayout.getCurrentScrollLeft()+S,g.scrollLeft=0)}this._context.viewModel.viewLayout.setScrollPosition(b,1)};this._register(j(t.domNode,"scroll",g=>h(t.domNode,!0,!0))),this._register(j(e.domNode,"scroll",g=>h(e.domNode,!0,!1))),this._register(j(o.domNode,"scroll",g=>h(o.domNode,!0,!1))),this._register(j(this.scrollbarDomNode.domNode,"scroll",g=>h(this.scrollbarDomNode.domNode,!0,!1)))}dispose(){super.dispose()}_setLayout(){let i=this._context.configuration.options,e=i.get(165);this.scrollbarDomNode.setLeft(e.contentLeft),i.get(81).side==="right"?this.scrollbarDomNode.setWidth(e.contentWidth+e.minimap.minimapWidth):this.scrollbarDomNode.setWidth(e.contentWidth),this.scrollbarDomNode.setHeight(e.height)}getOverviewRulerLayoutInfo(){return this.scrollbar.getOverviewRulerLayoutInfo()}getDomNode(){return this.scrollbarDomNode}delegateVerticalScrollbarPointerDown(i){this.scrollbar.delegateVerticalScrollbarPointerDown(i)}delegateScrollFromMouseWheelEvent(i){this.scrollbar.delegateScrollFromMouseWheelEvent(i)}onConfigurationChanged(i){if(i.hasChanged(117)||i.hasChanged(83)||i.hasChanged(49)){let e=this._context.configuration.options,t=e.get(117),o=e.get(83),n=e.get(49),r=e.get(120),s={vertical:t.vertical,horizontal:t.horizontal,verticalScrollbarSize:t.verticalScrollbarSize,horizontalScrollbarSize:t.horizontalScrollbarSize,scrollByPage:t.scrollByPage,handleMouseWheel:t.handleMouseWheel,mouseWheelScrollSensitivity:o,fastScrollSensitivity:n,scrollPredominantAxis:r};this.scrollbar.updateOptions(s)}return i.hasChanged(165)&&this._setLayout(),!0}onScrollChanged(i){return!0}onThemeChanged(i){return this.scrollbar.updateClassName("editor-scrollable "+Cj(this._context.theme.type)),!0}prepareRender(i){}render(i){this.scrollbar.renderNow()}};var kle=class{constructor(i,e,t,o,n){this.startLineNumber=i;this.endLineNumber=e;this.className=t;this.tooltip=o;this._decorationToRenderBrand=void 0;this.zIndex=n??0}},fii=class{constructor(i,e,t){this.className=i;this.zIndex=e;this.tooltip=t}},vii=class{constructor(){this.decorations=[]}add(i){this.decorations.push(i)}getDecorations(){return this.decorations}},Cwe=class extends EC{_render(i,e,t){let o=[];for(let s=i;s<=e;s++){let l=s-i;o[l]=new vii}if(t.length===0)return o;t.sort((s,l)=>s.className===l.className?s.startLineNumber===l.startLineNumber?s.endLineNumber-l.endLineNumber:s.startLineNumber-l.startLineNumber:s.className<l.className?-1:1);let n=null,r=0;for(let s of t){let l=s.className,c=s.zIndex,u=Math.max(s.startLineNumber,i)-i,p=Math.min(s.endLineNumber,e)-i;n===l?(u=Math.max(r+1,u),r=Math.max(r,p)):(n=l,r=p);for(let h=u;h<=r;h++)o[h].add(new fii(l,c,s.tooltip))}return o}},aSt=class extends Pu{constructor(e){super(e);this._widgets={};this._context=e;let t=this._context.configuration.options,o=t.get(165);this.domNode=ur(document.createElement("div")),this.domNode.setClassName("glyph-margin-widgets"),this.domNode.setPosition("absolute"),this.domNode.setTop(0),this._lineHeight=t.get(75),this._glyphMargin=t.get(66),this._glyphMarginLeft=o.glyphMarginLeft,this._glyphMarginWidth=o.glyphMarginWidth,this._glyphMarginDecorationLaneCount=o.glyphMarginDecorationLaneCount,this._managedDomNodes=[],this._decorationGlyphsToRender=[]}dispose(){this._managedDomNodes=[],this._decorationGlyphsToRender=[],this._widgets={},super.dispose()}getWidgets(){return Object.values(this._widgets)}onConfigurationChanged(e){let t=this._context.configuration.options,o=t.get(165);return this._lineHeight=t.get(75),this._glyphMargin=t.get(66),this._glyphMarginLeft=o.glyphMarginLeft,this._glyphMarginWidth=o.glyphMarginWidth,this._glyphMarginDecorationLaneCount=o.glyphMarginDecorationLaneCount,!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollTopChanged}onZonesChanged(e){return!0}addWidget(e){let t=ur(e.getDomNode());this._widgets[e.getId()]={widget:e,preference:e.getPosition(),domNode:t,renderInfo:null},t.setPosition("absolute"),t.setDisplay("none"),t.setAttribute("widgetId",e.getId()),this.domNode.appendChild(t),this.setShouldRender()}setWidgetPosition(e,t){let o=this._widgets[e.getId()];return o.preference.lane===t.lane&&o.preference.zIndex===t.zIndex&&z.equalsRange(o.preference.range,t.range)?!1:(o.preference=t,this.setShouldRender(),!0)}removeWidget(e){let t=e.getId();if(this._widgets[t]){let n=this._widgets[t].domNode.domNode;delete this._widgets[t],n.remove(),this.setShouldRender()}}_collectDecorationBasedGlyphRenderRequest(e,t){let o=e.visibleRange.startLineNumber,n=e.visibleRange.endLineNumber,r=e.getDecorationsInViewport();for(let s of r){let l=s.options.glyphMarginClassName;if(!l)continue;let c=Math.max(s.range.startLineNumber,o),u=Math.min(s.range.endLineNumber,n),p=s.options.glyphMargin?.position??2,h=s.options.zIndex??0;for(let g=c;g<=u;g++){let f=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new ye(g,0)),v=this._context.viewModel.glyphLanes.getLanesAtLine(f.lineNumber).indexOf(p);t.push(new bii(g,v,h,l))}}}_collectWidgetBasedGlyphRenderRequest(e,t){let o=e.visibleRange.startLineNumber,n=e.visibleRange.endLineNumber;for(let r of Object.values(this._widgets)){let s=r.preference.range,{startLineNumber:l,endLineNumber:c}=this._context.viewModel.coordinatesConverter.convertModelRangeToViewRange(z.lift(s));if(!l||!c||c<o||l>n)continue;let u=Math.max(l,o),p=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new ye(u,0)),h=this._context.viewModel.glyphLanes.getLanesAtLine(p.lineNumber).indexOf(r.preference.lane);t.push(new Sii(u,h,r.preference.zIndex,r))}}_collectSortedGlyphRenderRequests(e){let t=[];return this._collectDecorationBasedGlyphRenderRequest(e,t),this._collectWidgetBasedGlyphRenderRequest(e,t),t.sort((o,n)=>o.lineNumber===n.lineNumber?o.laneIndex===n.laneIndex?o.zIndex===n.zIndex?n.type===o.type?o.type===0&&n.type===0?o.className<n.className?-1:1:0:n.type-o.type:n.zIndex-o.zIndex:o.laneIndex-n.laneIndex:o.lineNumber-n.lineNumber),t}prepareRender(e){if(!this._glyphMargin){this._decorationGlyphsToRender=[];return}for(let n of Object.values(this._widgets))n.renderInfo=null;let t=new uE(this._collectSortedGlyphRenderRequests(e)),o=[];for(;t.length>0;){let n=t.peek();if(!n)break;let r=t.takeWhile(l=>l.lineNumber===n.lineNumber&&l.laneIndex===n.laneIndex);if(!r||r.length===0)break;let s=r[0];if(s.type===0){let l=[];for(let c of r){if(c.zIndex!==s.zIndex||c.type!==s.type)break;(l.length===0||l[l.length-1]!==c.className)&&l.push(c.className)}o.push(s.accept(l.join(" ")))}else s.widget.renderInfo={lineNumber:s.lineNumber,laneIndex:s.laneIndex}}this._decorationGlyphsToRender=o}render(e){if(!this._glyphMargin){for(let o of Object.values(this._widgets))o.domNode.setDisplay("none");for(;this._managedDomNodes.length>0;)this._managedDomNodes.pop()?.domNode.remove();return}let t=Math.round(this._glyphMarginWidth/this._glyphMarginDecorationLaneCount);for(let o of Object.values(this._widgets))if(!o.renderInfo)o.domNode.setDisplay("none");else{let n=e.viewportData.relativeVerticalOffset[o.renderInfo.lineNumber-e.viewportData.startLineNumber],r=this._glyphMarginLeft+o.renderInfo.laneIndex*this._lineHeight;o.domNode.setDisplay("block"),o.domNode.setTop(n),o.domNode.setLeft(r),o.domNode.setWidth(t),o.domNode.setHeight(this._lineHeight)}for(let o=0;o<this._decorationGlyphsToRender.length;o++){let n=this._decorationGlyphsToRender[o],r=n.lineNumber,s=e.viewportData.relativeVerticalOffset[r-e.viewportData.startLineNumber],l=this._glyphMarginLeft+n.laneIndex*this._lineHeight,c;o<this._managedDomNodes.length?c=this._managedDomNodes[o]:(c=ur(document.createElement("div")),this._managedDomNodes.push(c),this.domNode.appendChild(c));let u=this._context.viewLayout.getLineHeightForLineNumber(r);c.setClassName("cgmr codicon "+n.combinedClassName),c.setPosition("absolute"),c.setTop(s),c.setLeft(l),c.setWidth(t),c.setHeight(u)}for(;this._managedDomNodes.length>this._decorationGlyphsToRender.length;)this._managedDomNodes.pop()?.domNode.remove()}};var bii=class{constructor(i,e,t,o){this.lineNumber=i;this.laneIndex=e;this.zIndex=t;this.className=o;this.type=0}accept(i){return new Iii(this.lineNumber,this.laneIndex,i)}},Sii=class{constructor(i,e,t,o){this.lineNumber=i;this.laneIndex=e;this.zIndex=t;this.widget=o;this.type=1}},Iii=class{constructor(i,e,t){this.lineNumber=i;this.laneIndex=e;this.combinedClassName=t}};var xwe=class extends x{constructor(){super(...arguments);this._isDisposed=!1}dispose(){super.dispose(),this._isDisposed=!0}assertNotDisposed(){if(this._isDisposed)throw new Error("TextModelPart is disposed!")}};function kj(a,i){let e=0,t=0,o=a.length;for(;t<o;){let n=a.charCodeAt(t);if(n===32)e++;else if(n===9)e=e-e%i+i;else break;t++}return t===o?-1:e}var PO=class{constructor(i,e,t,o,n,r){this.visibleColumn=i;this.column=e;this.className=t;this.horizontalLine=o;this.forWrappedLinesAfterColumn=n;this.forWrappedLinesBeforeOrAtColumn=r;if(i!==-1==(e!==-1))throw new Error}},Ej=class{constructor(i,e){this.top=i;this.endColumn=e}};var lSt=class extends xwe{constructor(e,t){super();this.textModel=e;this.languageConfigurationService=t}getLanguageConfiguration(e){return this.languageConfigurationService.getLanguageConfiguration(e)}_computeIndentLevel(e){return kj(this.textModel.getLineContent(e+1),this.textModel.getOptions().tabSize)}getActiveIndentGuide(e,t,o){this.assertNotDisposed();let n=this.textModel.getLineCount();if(e<1||e>n)throw new li("Illegal value for lineNumber");let r=this.getLanguageConfiguration(this.textModel.getLanguageId()).foldingRules,s=!!(r&&r.offSide),l=-2,c=-1,u=-2,p=-1,h=V=>{if(l!==-1&&(l===-2||l>V-1)){l=-1,c=-1;for(let H=V-2;H>=0;H--){let G=this._computeIndentLevel(H);if(G>=0){l=H,c=G;break}}}if(u===-2){u=-1,p=-1;for(let H=V;H<n;H++){let G=this._computeIndentLevel(H);if(G>=0){u=H,p=G;break}}}},g=-2,f=-1,v=-2,b=-1,S=V=>{if(g===-2){g=-1,f=-1;for(let H=V-2;H>=0;H--){let G=this._computeIndentLevel(H);if(G>=0){g=H,f=G;break}}}if(v!==-1&&(v===-2||v<V-1)){v=-1,b=-1;for(let H=V;H<n;H++){let G=this._computeIndentLevel(H);if(G>=0){v=H,b=G;break}}}},y=0,w=!0,k=0,T=!0,P=0,O=0;for(let V=0;w||T;V++){let H=e-V,G=e+V;V>1&&(H<1||H<t)&&(w=!1),V>1&&(G>n||G>o)&&(T=!1),V>5e4&&(w=!1,T=!1);let $=-1;if(w&&H>=1){let ae=this._computeIndentLevel(H-1);ae>=0?(u=H-1,p=ae,$=Math.ceil(ae/this.textModel.getOptions().indentSize)):(h(H),$=this._getIndentLevelForWhitespaceLine(s,c,p))}let J=-1;if(T&&G<=n){let ae=this._computeIndentLevel(G-1);ae>=0?(g=G-1,f=ae,J=Math.ceil(ae/this.textModel.getOptions().indentSize)):(S(G),J=this._getIndentLevelForWhitespaceLine(s,f,b))}if(V===0){O=$;continue}if(V===1){if(G<=n&&J>=0&&O+1===J){w=!1,y=G,k=G,P=J;continue}if(H>=1&&$>=0&&$-1===O){T=!1,y=H,k=H,P=$;continue}if(y=e,k=e,P=O,P===0)return{startLineNumber:y,endLineNumber:k,indent:P}}w&&($>=P?y=H:w=!1),T&&(J>=P?k=G:T=!1)}return{startLineNumber:y,endLineNumber:k,indent:P}}getLinesBracketGuides(e,t,o,n){let r=[];for(let h=e;h<=t;h++)r.push([]);let s=!0,l=this.textModel.bracketPairs.getBracketPairsInRangeWithMinIndentation(new z(e,1,t,this.textModel.getLineMaxColumn(t))).toArray(),c;if(o&&l.length>0){let h=(e<=o.lineNumber&&o.lineNumber<=t?l:this.textModel.bracketPairs.getBracketPairsInRange(z.fromPositions(o)).toArray()).filter(g=>z.strictContainsPosition(g.range,o));c=fd(h,g=>s||g.range.startLineNumber!==g.range.endLineNumber)?.range}let u=this.textModel.getOptions().bracketPairColorizationOptions.independentColorPoolPerBracketType,p=new s5e;for(let h of l){if(!h.closingBracketRange)continue;let g=c&&h.range.equalsRange(c);if(!g&&!n.includeInactive)continue;let f=p.getInlineClassName(h.nestingLevel,h.nestingLevelOfEqualBracketType,u)+(n.highlightActive&&g?" "+p.activeClassName:""),v=h.openingBracketRange.getStartPosition(),b=h.closingBracketRange.getStartPosition(),S=n.horizontalGuides===2||n.horizontalGuides===1&&g;if(h.range.startLineNumber===h.range.endLineNumber){s&&S&&r[h.range.startLineNumber-e].push(new PO(-1,h.openingBracketRange.getEndPosition().column,f,new Ej(!1,b.column),-1,-1));continue}let y=this.getVisibleColumnFromPosition(b),w=this.getVisibleColumnFromPosition(h.openingBracketRange.getStartPosition()),k=Math.min(w,y,h.minVisibleColumnIndentation+1),T=!1;nm(this.textModel.getLineContent(h.closingBracketRange.startLineNumber))<h.closingBracketRange.startColumn-1&&(T=!0);let V=Math.max(v.lineNumber,e),H=Math.min(b.lineNumber,t),G=T?1:0;for(let $=V;$<H+G;$++)r[$-e].push(new PO(k,-1,f,null,$===v.lineNumber?v.column:-1,$===b.lineNumber?b.column:-1));S&&(v.lineNumber>=e&&w>k&&r[v.lineNumber-e].push(new PO(k,-1,f,new Ej(!1,v.column),-1,-1)),b.lineNumber<=t&&y>k&&r[b.lineNumber-e].push(new PO(k,-1,f,new Ej(!T,b.column),-1,-1)))}for(let h of r)h.sort((g,f)=>g.visibleColumn-f.visibleColumn);return r}getVisibleColumnFromPosition(e){return fl.visibleColumnFromColumn(this.textModel.getLineContent(e.lineNumber),e.column,this.textModel.getOptions().tabSize)+1}getLinesIndentGuides(e,t){this.assertNotDisposed();let o=this.textModel.getLineCount();if(e<1||e>o)throw new Error("Illegal value for startLineNumber");if(t<1||t>o)throw new Error("Illegal value for endLineNumber");let n=this.textModel.getOptions(),r=this.getLanguageConfiguration(this.textModel.getLanguageId()).foldingRules,s=!!(r&&r.offSide),l=new Array(t-e+1),c=-2,u=-1,p=-2,h=-1;for(let g=e;g<=t;g++){let f=g-e,v=this._computeIndentLevel(g-1);if(v>=0){c=g-1,u=v,l[f]=Math.ceil(v/n.indentSize);continue}if(c===-2){c=-1,u=-1;for(let b=g-2;b>=0;b--){let S=this._computeIndentLevel(b);if(S>=0){c=b,u=S;break}}}if(p!==-1&&(p===-2||p<g-1)){p=-1,h=-1;for(let b=g;b<o;b++){let S=this._computeIndentLevel(b);if(S>=0){p=b,h=S;break}}}l[f]=this._getIndentLevelForWhitespaceLine(s,u,h)}return l}_getIndentLevelForWhitespaceLine(e,t,o){let n=this.textModel.getOptions();return t===-1||o===-1?0:t<o?1+Math.floor(t/n.indentSize):t===o||e?Math.ceil(o/n.indentSize):1+Math.floor(o/n.indentSize)}},s5e=class{constructor(){this.activeClassName="indent-active"}getInlineClassName(i,e,t){return this.getInlineClassNameOfLevel(t?e:i)}getInlineClassNameOfLevel(i){return`bracket-indent-guide lvl-${i%30}`}};var cSt=class extends EC{constructor(i){super(),this._context=i,this._primaryPosition=null;let e=this._context.configuration.options,t=e.get(166),o=e.get(59);this._spaceWidth=o.spaceWidth,this._maxIndentLeft=t.wrappingColumn===-1?-1:t.wrappingColumn*o.typicalHalfwidthCharacterWidth,this._bracketPairGuideOptions=e.get(22),this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(i){let e=this._context.configuration.options,t=e.get(166),o=e.get(59);return this._spaceWidth=o.spaceWidth,this._maxIndentLeft=t.wrappingColumn===-1?-1:t.wrappingColumn*o.typicalHalfwidthCharacterWidth,this._bracketPairGuideOptions=e.get(22),!0}onCursorStateChanged(i){let t=i.selections[0].getPosition();return this._primaryPosition?.equals(t)?!1:(this._primaryPosition=t,!0)}onDecorationsChanged(i){return!0}onFlushed(i){return!0}onLinesChanged(i){return!0}onLinesDeleted(i){return!0}onLinesInserted(i){return!0}onScrollChanged(i){return i.scrollTopChanged}onZonesChanged(i){return!0}onLanguageConfigurationChanged(i){return!0}prepareRender(i){if(!this._bracketPairGuideOptions.indentation&&this._bracketPairGuideOptions.bracketPairs===!1){this._renderResult=null;return}let e=i.visibleRange.startLineNumber,t=i.visibleRange.endLineNumber,o=i.scrollWidth,n=this._primaryPosition,r=this.getGuidesByLine(e,Math.min(t+1,this._context.viewModel.getLineCount()),n),s=[];for(let l=e;l<=t;l++){let c=l-e,u=r[c],p="",h=i.visibleRangeForPosition(new ye(l,1))?.left??0;for(let g of u){let f=g.column===-1?h+(g.visibleColumn-1)*this._spaceWidth:i.visibleRangeForPosition(new ye(l,g.column)).left;if(f>o||this._maxIndentLeft>0&&f>this._maxIndentLeft)break;let v=g.horizontalLine?g.horizontalLine.top?"horizontal-top":"horizontal-bottom":"vertical",b=g.horizontalLine?(i.visibleRangeForPosition(new ye(l,g.horizontalLine.endColumn))?.left??f+this._spaceWidth)-f:this._spaceWidth;p+=`<div class="core-guide ${g.className} ${v}" style="left:${f}px;width:${b}px"></div>`}s[c]=p}this._renderResult=s}getGuidesByLine(i,e,t){let o=this._bracketPairGuideOptions.bracketPairs!==!1?this._context.viewModel.getBracketGuidesInRangeByLine(i,e,t,{highlightActive:this._bracketPairGuideOptions.highlightActiveBracketPair,horizontalGuides:this._bracketPairGuideOptions.bracketPairsHorizontal===!0?2:this._bracketPairGuideOptions.bracketPairsHorizontal==="active"?1:0,includeInactive:this._bracketPairGuideOptions.bracketPairs===!0}):null,n=this._bracketPairGuideOptions.indentation?this._context.viewModel.getLinesIndentGuides(i,e):null,r=0,s=0,l=0;if(this._bracketPairGuideOptions.highlightActiveIndentation!==!1&&t){let p=this._context.viewModel.getActiveIndentGuide(t.lineNumber,i,e);r=p.startLineNumber,s=p.endLineNumber,l=p.indent}let{indentSize:c}=this._context.viewModel.model.getOptions(),u=[];for(let p=i;p<=e;p++){let h=new Array;u.push(h);let g=o?o[p-i]:[],f=new uE(g),v=n?n[p-i]:0;for(let b=1;b<=v;b++){let S=(b-1)*c+1,y=(this._bracketPairGuideOptions.highlightActiveIndentation==="always"||g.length===0)&&r<=p&&p<=s&&b===l;h.push(...f.takeWhile(k=>k.visibleColumn<S)||[]);let w=f.peek();(!w||w.visibleColumn!==S||w.horizontalLine)&&h.push(new PO(S,-1,`core-guide-indent lvl-${(b-1)%30}`+(y?" indent-active":""),null,-1,-1))}h.push(...f.takeWhile(b=>!0)||[])}return u}render(i,e){if(!this._renderResult)return"";let t=e-i;return t<0||t>=this._renderResult.length?"":this._renderResult[t]}};function kwe(a){if(!(a&&a.isTransparent()))return a}is((a,i)=>{let e=[{bracketColor:Ybt,guideColor:A3i,guideColorActive:B3i},{bracketColor:Xbt,guideColor:N3i,guideColorActive:H3i},{bracketColor:Jbt,guideColor:O3i,guideColorActive:U3i},{bracketColor:Zbt,guideColor:F3i,guideColorActive:z3i},{bracketColor:eSt,guideColor:W3i,guideColorActive:K3i},{bracketColor:tSt,guideColor:V3i,guideColorActive:G3i}],t=new s5e,o=[{indentColor:$bt,indentColorActive:jbt},{indentColor:f3i,indentColorActive:y3i},{indentColor:v3i,indentColorActive:w3i},{indentColor:b3i,indentColorActive:C3i},{indentColor:S3i,indentColorActive:x3i},{indentColor:I3i,indentColorActive:k3i}],n=e.map(s=>{let l=a.getColor(s.bracketColor),c=a.getColor(s.guideColor),u=a.getColor(s.guideColorActive),p=kwe(kwe(c)??l?.transparent(.3)),h=kwe(kwe(u)??l);if(!(!p||!h))return{guideColor:p,guideColorActive:h}}).filter(lo),r=o.map(s=>{let l=a.getColor(s.indentColor),c=a.getColor(s.indentColorActive),u=kwe(l),p=kwe(c);if(!(!u||!p))return{indentColor:u,indentColorActive:p}}).filter(lo);if(n.length>0){for(let s=0;s<30;s++){let l=n[s%n.length];i.addRule(`.monaco-editor .${t.getInlineClassNameOfLevel(s).replace(/ /g,".")} { --guide-color: ${l.guideColor}; --guide-color-active: ${l.guideColorActive}; }`)}i.addRule(".monaco-editor .vertical { box-shadow: 1px 0 0 0 var(--guide-color) inset; }"),i.addRule(".monaco-editor .horizontal-top { border-top: 1px solid var(--guide-color); }"),i.addRule(".monaco-editor .horizontal-bottom { border-bottom: 1px solid var(--guide-color); }"),i.addRule(`.monaco-editor .vertical.${t.activeClassName} { box-shadow: 1px 0 0 0 var(--guide-color-active) inset; }`),i.addRule(`.monaco-editor .horizontal-top.${t.activeClassName} { border-top: 1px solid var(--guide-color-active); }`),i.addRule(`.monaco-editor .horizontal-bottom.${t.activeClassName} { border-bottom: 1px solid var(--guide-color-active); }`)}if(r.length>0){for(let s=0;s<30;s++){let l=r[s%r.length];i.addRule(`.monaco-editor .lines-content .core-guide-indent.lvl-${s} { --indent-color: ${l.indentColor}; --indent-color-active: ${l.indentColorActive}; }`)}i.addRule(".monaco-editor .lines-content .core-guide-indent { box-shadow: 1px 0 0 0 var(--indent-color) inset; }"),i.addRule(".monaco-editor .lines-content .core-guide-indent.indent-active { box-shadow: 1px 0 0 0 var(--indent-color-active) inset; }")}});var Ewe=class a extends EC{static{this.CLASS_NAME="line-numbers"}constructor(i){super(),this._context=i,this._readConfig(),this._lastCursorModelPosition=new ye(1,1),this._renderResult=null,this._activeModelLineNumber=1,this._context.addEventHandler(this)}_readConfig(){let i=this._context.configuration.options;this._lineHeight=i.get(75);let e=i.get(76);this._renderLineNumbers=e.renderType,this._renderCustomLineNumbers=e.renderFn,this._renderFinalNewline=i.get(109);let t=i.get(165);this._lineNumbersLeft=t.lineNumbersLeft,this._lineNumbersWidth=t.lineNumbersWidth}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(i){return this._readConfig(),!0}onCursorStateChanged(i){let e=i.selections[0].getPosition();this._lastCursorModelPosition=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(e);let t=!1;return this._activeModelLineNumber!==this._lastCursorModelPosition.lineNumber&&(this._activeModelLineNumber=this._lastCursorModelPosition.lineNumber,t=!0),(this._renderLineNumbers===2||this._renderLineNumbers===3)&&(t=!0),t}onFlushed(i){return!0}onLinesChanged(i){return!0}onLinesDeleted(i){return!0}onLinesInserted(i){return!0}onScrollChanged(i){return i.scrollTopChanged}onZonesChanged(i){return!0}onDecorationsChanged(i){return i.affectsLineNumber}_getLineRenderLineNumber(i){let e=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new ye(i,1));if(e.column!==1)return"";let t=e.lineNumber;if(this._renderCustomLineNumbers)return this._renderCustomLineNumbers(t);if(this._renderLineNumbers===2){let o=Math.abs(this._lastCursorModelPosition.lineNumber-t);return o===0?'<span class="relative-current-line-number">'+t+"</span>":String(o)}if(this._renderLineNumbers===3){if(this._lastCursorModelPosition.lineNumber===t||t%10===0)return String(t);let o=this._context.viewModel.getLineCount();return t===o?String(t):""}return String(t)}prepareRender(i){if(this._renderLineNumbers===0){this._renderResult=null;return}let e=fn?this._lineHeight%2===0?" lh-even":" lh-odd":"",t=i.visibleRange.startLineNumber,o=i.visibleRange.endLineNumber,n=this._context.viewModel.getDecorationsInViewport(i.visibleRange).filter(c=>!!c.options.lineNumberClassName);n.sort((c,u)=>z.compareRangesUsingEnds(c.range,u.range));let r=0,s=this._context.viewModel.getLineCount(),l=[];for(let c=t;c<=o;c++){let u=c-t,p=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new ye(c,1)).lineNumber,h=this._getLineRenderLineNumber(c),g="";for(;r<n.length&&n[r].range.endLineNumber<c;)r++;for(let f=r;f<n.length;f++){let{range:v,options:b}=n[f];v.startLineNumber<=c&&(g+=" "+b.lineNumberClassName)}if(!h&&!g){l[u]="";continue}c===s&&this._context.viewModel.getLineLength(c)===0&&(this._renderFinalNewline==="off"&&(h=""),this._renderFinalNewline==="dimmed"&&(g+=" dimmed-line-number")),p===this._activeModelLineNumber&&(g+=" active-line-number"),l[u]=`<div class="${a.CLASS_NAME}${e}${g}" style="left:${this._lineNumbersLeft}px;width:${this._lineNumbersWidth}px;">${h}</div>`}this._renderResult=l}render(i,e){if(!this._renderResult)return"";let t=e-i;return t<0||t>=this._renderResult.length?"":this._renderResult[t]}};is((a,i)=>{let e=a.getColor(g3i),t=a.getColor(E3i);t?i.addRule(`.monaco-editor .line-numbers.dimmed-line-number { color: ${t}; }`):e&&i.addRule(`.monaco-editor .line-numbers.dimmed-line-number { color: ${e.transparent(.4)}; }`)});var kE="monaco-mouse-cursor-text";var Twe=class{constructor(i,e){this._domNode=i;this.endNode=e;this._didDomLayout=!1;this._clientRectDeltaLeft=0;this._clientRectScale=1;this._clientRectRead=!1}get didDomLayout(){return this._didDomLayout}readClientRect(){if(!this._clientRectRead){this._clientRectRead=!0;let i=this._domNode.getBoundingClientRect();this.markDidDomLayout(),this._clientRectDeltaLeft=i.left;let e=this._domNode.offsetWidth;this._clientRectScale=e>0?i.width/e:1}}get clientRectDeltaLeft(){return this._clientRectRead||this.readClientRect(),this._clientRectDeltaLeft}get clientRectScale(){return this._clientRectRead||this.readClientRect(),this._clientRectScale}markDidDomLayout(){this._didDomLayout=!0}};var Tj=class{constructor(i,e){this.themeType=e;let t=i.options,o=t.get(59);this.renderWhitespace=t.get(113),this.experimentalWhitespaceRendering=t.get(47),this.renderControlCharacters=t.get(108),this.spaceWidth=o.spaceWidth,this.middotWidth=o.middotWidth,this.wsmiddotWidth=o.wsmiddotWidth,this.useMonospaceOptimizations=o.isMonospace&&!t.get(40),this.canUseHalfwidthRightwardsArrow=o.canUseHalfwidthRightwardsArrow,this.lineHeight=t.get(75),this.stopRenderingLineAfter=t.get(133),this.fontLigatures=t.get(60),this.verticalScrollbarSize=t.get(117).verticalScrollbarSize,this.useGpu=t.get(46)==="on"}equals(i){return this.themeType===i.themeType&&this.renderWhitespace===i.renderWhitespace&&this.experimentalWhitespaceRendering===i.experimentalWhitespaceRendering&&this.renderControlCharacters===i.renderControlCharacters&&this.spaceWidth===i.spaceWidth&&this.middotWidth===i.middotWidth&&this.wsmiddotWidth===i.wsmiddotWidth&&this.useMonospaceOptimizations===i.useMonospaceOptimizations&&this.canUseHalfwidthRightwardsArrow===i.canUseHalfwidthRightwardsArrow&&this.lineHeight===i.lineHeight&&this.stopRenderingLineAfter===i.stopRenderingLineAfter&&this.fontLigatures===i.fontLigatures&&this.verticalScrollbarSize===i.verticalScrollbarSize&&this.useGpu===i.useGpu}};var yii=class{constructor(){this._currentVisibleRange=new z(1,1,1,1)}getCurrentVisibleRange(){return this._currentVisibleRange}setCurrentVisibleRange(i){this._currentVisibleRange=i}},wii=class{constructor(i,e,t,o,n,r,s){this.minimalReveal=i;this.lineNumber=e;this.startColumn=t;this.endColumn=o;this.startScrollTop=n;this.stopScrollTop=r;this.scrollType=s;this.type="range";this.minLineNumber=e,this.maxLineNumber=e}},Cii=class{constructor(i,e,t,o,n){this.minimalReveal=i;this.selections=e;this.startScrollTop=t;this.stopScrollTop=o;this.scrollType=n;this.type="selections";let r=e[0].startLineNumber,s=e[0].endLineNumber;for(let l=1,c=e.length;l<c;l++){let u=e[l];r=Math.min(r,u.startLineNumber),s=Math.max(s,u.endLineNumber)}this.minLineNumber=r,this.maxLineNumber=s}},dSt=class a extends Pu{static{this.HORIZONTAL_EXTRA_PX=30}constructor(i,e,t){super(i);let o=this._context.configuration,n=this._context.configuration.options,r=n.get(59),s=n.get(166);this._lineHeight=n.get(75),this._typicalHalfwidthCharacterWidth=r.typicalHalfwidthCharacterWidth,this._isViewportWrapping=s.isViewportWrapping,this._revealHorizontalRightPadding=n.get(114),this._cursorSurroundingLines=n.get(35),this._cursorSurroundingLinesStyle=n.get(36),this._canUseLayerHinting=!n.get(39),this._viewLineOptions=new Tj(o,this._context.theme.type),this._linesContent=t,this._textRangeRestingSpot=document.createElement("div"),this._visibleLines=new fwe(this._context,{createLine:()=>new NV(e,this._viewLineOptions)}),this.domNode=this._visibleLines.domNode,YS.write(this.domNode,8),this.domNode.setClassName(`view-lines ${kE}`),Jd(this.domNode,r),this._maxLineWidth=0,this._asyncUpdateLineWidths=new Dt(()=>{this._updateLineWidthsSlow()},200),this._asyncCheckMonospaceFontAssumptions=new Dt(()=>{this._checkMonospaceFontAssumptions()},2e3),this._lastRenderedData=new yii,this._horizontalRevealRequest=null,this._stickyScrollEnabled=n.get(131).enabled,this._maxNumberStickyLines=n.get(131).maxLineCount}dispose(){this._asyncUpdateLineWidths.dispose(),this._asyncCheckMonospaceFontAssumptions.dispose(),super.dispose()}getDomNode(){return this.domNode}onConfigurationChanged(i){this._visibleLines.onConfigurationChanged(i),i.hasChanged(166)&&(this._maxLineWidth=0);let e=this._context.configuration.options,t=e.get(59),o=e.get(166);return this._lineHeight=e.get(75),this._typicalHalfwidthCharacterWidth=t.typicalHalfwidthCharacterWidth,this._isViewportWrapping=o.isViewportWrapping,this._revealHorizontalRightPadding=e.get(114),this._cursorSurroundingLines=e.get(35),this._cursorSurroundingLinesStyle=e.get(36),this._canUseLayerHinting=!e.get(39),this._stickyScrollEnabled=e.get(131).enabled,this._maxNumberStickyLines=e.get(131).maxLineCount,Jd(this.domNode,t),this._onOptionsMaybeChanged(),i.hasChanged(165)&&(this._maxLineWidth=0),!0}_onOptionsMaybeChanged(){let i=this._context.configuration,e=new Tj(i,this._context.theme.type);if(!this._viewLineOptions.equals(e)){this._viewLineOptions=e;let t=this._visibleLines.getStartLineNumber(),o=this._visibleLines.getEndLineNumber();for(let n=t;n<=o;n++)this._visibleLines.getVisibleLine(n).onOptionsChanged(this._viewLineOptions);return!0}return!1}onCursorStateChanged(i){let e=this._visibleLines.getStartLineNumber(),t=this._visibleLines.getEndLineNumber(),o=!1;for(let n=e;n<=t;n++)o=this._visibleLines.getVisibleLine(n).onSelectionChanged()||o;return o}onDecorationsChanged(i){let e=this._visibleLines.getStartLineNumber(),t=this._visibleLines.getEndLineNumber();for(let o=e;o<=t;o++)this._visibleLines.getVisibleLine(o).onDecorationsChanged();return!0}onFlushed(i){let e=this._visibleLines.onFlushed(i,this._viewLineOptions.useGpu);return this._maxLineWidth=0,e}onLinesChanged(i){return this._visibleLines.onLinesChanged(i)}onLinesDeleted(i){return this._visibleLines.onLinesDeleted(i)}onLinesInserted(i){return this._visibleLines.onLinesInserted(i)}onRevealRangeRequest(i){let e=this._computeScrollTopToRevealRange(this._context.viewLayout.getFutureViewport(),i.source,i.minimalReveal,i.range,i.selections,i.verticalType);if(e===-1)return!1;let t=this._context.viewLayout.validateScrollPosition({scrollTop:e});i.revealHorizontal?i.range&&i.range.startLineNumber!==i.range.endLineNumber?t={scrollTop:t.scrollTop,scrollLeft:0}:i.range?this._horizontalRevealRequest=new wii(i.minimalReveal,i.range.startLineNumber,i.range.startColumn,i.range.endColumn,this._context.viewLayout.getCurrentScrollTop(),t.scrollTop,i.scrollType):i.selections&&i.selections.length>0&&(this._horizontalRevealRequest=new Cii(i.minimalReveal,i.selections,this._context.viewLayout.getCurrentScrollTop(),t.scrollTop,i.scrollType)):this._horizontalRevealRequest=null;let n=Math.abs(this._context.viewLayout.getCurrentScrollTop()-t.scrollTop)<=this._lineHeight?1:i.scrollType;return this._context.viewModel.viewLayout.setScrollPosition(t,n),!0}onScrollChanged(i){if(this._horizontalRevealRequest&&i.scrollLeftChanged&&(this._horizontalRevealRequest=null),this._horizontalRevealRequest&&i.scrollTopChanged){let e=Math.min(this._horizontalRevealRequest.startScrollTop,this._horizontalRevealRequest.stopScrollTop),t=Math.max(this._horizontalRevealRequest.startScrollTop,this._horizontalRevealRequest.stopScrollTop);(i.scrollTop<e||i.scrollTop>t)&&(this._horizontalRevealRequest=null)}return this.domNode.setWidth(i.scrollWidth),this._visibleLines.onScrollChanged(i)||i.scrollTopChanged||i.scrollLeftChanged}onTokensChanged(i){return this._visibleLines.onTokensChanged(i)}onZonesChanged(i){return this._context.viewModel.viewLayout.setMaxLineWidth(this._maxLineWidth),this._visibleLines.onZonesChanged(i)}onThemeChanged(i){return this._onOptionsMaybeChanged()}getPositionFromDOMInfo(i,e){let t=this._getViewLineDomNode(i);if(t===null)return null;let o=this._getLineNumberFor(t);if(o===-1||o<1||o>this._context.viewModel.getLineCount())return null;if(this._context.viewModel.getLineMaxColumn(o)===1)return new ye(o,1);let n=this._visibleLines.getStartLineNumber(),r=this._visibleLines.getEndLineNumber();if(o<n||o>r)return null;let s=this._visibleLines.getVisibleLine(o).getColumnOfNodeOffset(i,e),l=this._context.viewModel.getLineMinColumn(o);return s<l&&(s=l),new ye(o,s)}_getViewLineDomNode(i){for(;i&&i.nodeType===1;){if(i.className===NV.CLASS_NAME)return i;i=i.parentElement}return null}_getLineNumberFor(i){let e=this._visibleLines.getStartLineNumber(),t=this._visibleLines.getEndLineNumber();for(let o=e;o<=t;o++){let n=this._visibleLines.getVisibleLine(o);if(i===n.getDomNode())return o}return-1}getLineWidth(i){let e=this._visibleLines.getStartLineNumber(),t=this._visibleLines.getEndLineNumber();if(i<e||i>t)return-1;let o=new Twe(this.domNode.domNode,this._textRangeRestingSpot),n=this._visibleLines.getVisibleLine(i).getWidth(o);return this._updateLineWidthsSlowIfDomDidLayout(o),n}resetLineWidthCaches(){let i=this._visibleLines.getStartLineNumber(),e=this._visibleLines.getEndLineNumber();for(let t=i;t<=e;t++)this._visibleLines.getVisibleLine(t).resetCachedWidth()}linesVisibleRangesForRange(i,e){let t=i.endLineNumber,o=z.intersectRanges(i,this._lastRenderedData.getCurrentVisibleRange());if(!o)return null;let n=[],r=0,s=new Twe(this.domNode.domNode,this._textRangeRestingSpot),l=0;e&&(l=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new ye(o.startLineNumber,1)).lineNumber);let c=this._visibleLines.getStartLineNumber(),u=this._visibleLines.getEndLineNumber();for(let p=o.startLineNumber;p<=o.endLineNumber;p++){if(p<c||p>u)continue;let h=p===o.startLineNumber?o.startColumn:1,g=p!==t,f=g?this._context.viewModel.getLineMaxColumn(p):o.endColumn,b=this._visibleLines.getVisibleLine(p).getVisibleRangesForRange(p,h,f,s);if(b){if(e&&p<t){let S=l;if(l=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new ye(p+1,1)).lineNumber,S!==l){let y=b.ranges[b.ranges.length-1];y.width+=this._typicalHalfwidthCharacterWidth,this._context.viewModel.getTextDirection(S)===1&&(y.left-=this._typicalHalfwidthCharacterWidth)}}n[r++]=new Qye(b.outsideRenderedLine,p,P7.from(b.ranges),g)}}return this._updateLineWidthsSlowIfDomDidLayout(s),r===0?null:n}_visibleRangesForLineRange(i,e,t){if(i<this._visibleLines.getStartLineNumber()||i>this._visibleLines.getEndLineNumber())return null;let o=new Twe(this.domNode.domNode,this._textRangeRestingSpot),n=this._visibleLines.getVisibleLine(i).getVisibleRangesForRange(i,e,t,o);return this._updateLineWidthsSlowIfDomDidLayout(o),n}_lineIsRenderedRTL(i){return i<this._visibleLines.getStartLineNumber()||i>this._visibleLines.getEndLineNumber()?!1:this._visibleLines.getVisibleLine(i).isRenderedRTL()}visibleRangeForPosition(i){let e=this._visibleRangesForLineRange(i.lineNumber,i.column,i.column);return e?new Yye(e.outsideRenderedLine,e.ranges[0].left):null}updateLineWidths(){this._updateLineWidths(!1)}_updateLineWidthsFast(){return this._updateLineWidths(!0)}_updateLineWidthsSlow(){this._updateLineWidths(!1)}_updateLineWidthsSlowIfDomDidLayout(i){i.didDomLayout&&this._asyncUpdateLineWidths.isScheduled()&&(this._asyncUpdateLineWidths.cancel(),this._updateLineWidthsSlow())}_updateLineWidths(i){let e=this._visibleLines.getStartLineNumber(),t=this._visibleLines.getEndLineNumber(),o=1,n=!0;for(let r=e;r<=t;r++){let s=this._visibleLines.getVisibleLine(r);if(i&&!s.getWidthIsFast()){n=!1;continue}o=Math.max(o,s.getWidth(null))}return n&&e===1&&t===this._context.viewModel.getLineCount()&&(this._maxLineWidth=0),this._ensureMaxLineWidth(o),n}_checkMonospaceFontAssumptions(){let i=-1,e=-1,t=this._visibleLines.getStartLineNumber(),o=this._visibleLines.getEndLineNumber();for(let n=t;n<=o;n++){let r=this._visibleLines.getVisibleLine(n);if(r.needsMonospaceFontCheck()){let s=r.getWidth(null);s>e&&(e=s,i=n)}}if(i!==-1&&!this._visibleLines.getVisibleLine(i).monospaceAssumptionsAreValid())for(let n=t;n<=o;n++)this._visibleLines.getVisibleLine(n).onMonospaceAssumptionsInvalidated()}prepareRender(){throw new Error("Not supported")}render(){throw new Error("Not supported")}renderText(i){if(this._visibleLines.renderLines(i),this._lastRenderedData.setCurrentVisibleRange(i.visibleRange),this.domNode.setWidth(this._context.viewLayout.getScrollWidth()),this.domNode.setHeight(Math.min(this._context.viewLayout.getScrollHeight(),1e6)),this._horizontalRevealRequest){let t=this._horizontalRevealRequest;if(i.startLineNumber<=t.minLineNumber&&t.maxLineNumber<=i.endLineNumber){this._horizontalRevealRequest=null,this.onDidRender();let o=this._computeScrollLeftToReveal(t);o&&(!this._isViewportWrapping&&!o.hasRTL&&this._ensureMaxLineWidth(o.maxHorizontalOffset),this._context.viewModel.viewLayout.setScrollPosition({scrollLeft:o.scrollLeft},t.scrollType))}}if(this._updateLineWidthsFast()?this._asyncUpdateLineWidths.cancel():this._asyncUpdateLineWidths.schedule(),fn&&!this._asyncCheckMonospaceFontAssumptions.isScheduled()){let t=this._visibleLines.getStartLineNumber(),o=this._visibleLines.getEndLineNumber();for(let n=t;n<=o;n++)if(this._visibleLines.getVisibleLine(n).needsMonospaceFontCheck()){this._asyncCheckMonospaceFontAssumptions.schedule();break}}this._linesContent.setLayerHinting(this._canUseLayerHinting),this._linesContent.setContain("strict");let e=this._context.viewLayout.getCurrentScrollTop()-i.bigNumbersDelta;this._linesContent.setTop(-e),this._linesContent.setLeft(-this._context.viewLayout.getCurrentScrollLeft())}_ensureMaxLineWidth(i){if(this._viewLineOptions.useGpu)return;let e=Math.ceil(i);this._maxLineWidth<e&&(this._maxLineWidth=e,this._context.viewModel.viewLayout.setMaxLineWidth(this._maxLineWidth))}_computeScrollTopToRevealRange(i,e,t,o,n,r){let s=i.top,l=i.height,c=s+l,u,p,h;if(n&&n.length>0){let S=n[0].startLineNumber,y=n[0].endLineNumber;for(let w=1,k=n.length;w<k;w++){let T=n[w];S=Math.min(S,T.startLineNumber),y=Math.max(y,T.endLineNumber)}u=!1,p=this._context.viewLayout.getVerticalOffsetForLineNumber(S),h=this._context.viewLayout.getVerticalOffsetForLineNumber(y)+this._lineHeight}else if(o)u=!0,p=this._context.viewLayout.getVerticalOffsetForLineNumber(o.startLineNumber),h=this._context.viewLayout.getVerticalOffsetForLineNumber(o.endLineNumber)+this._lineHeight;else return-1;let g=(e==="mouse"||t)&&this._cursorSurroundingLinesStyle==="default",f=0,v=0;if(g)t||(f=this._lineHeight);else{let S=l/this._lineHeight,y=Math.max(this._cursorSurroundingLines,this._stickyScrollEnabled?this._maxNumberStickyLines:0),w=Math.min(S/2,y);f=w*this._lineHeight,v=Math.max(0,w-1)*this._lineHeight}t||(r===0||r===4)&&(v+=this._lineHeight),p-=f,h+=v;let b;if(h-p>l){if(!u)return-1;b=p}else if(r===5||r===6)if(r===6&&s<=p&&h<=c)b=s;else{let S=Math.max(5*this._lineHeight,l*.2),y=p-S,w=h-l;b=Math.max(w,y)}else if(r===1||r===2)if(r===2&&s<=p&&h<=c)b=s;else{let S=(p+h)/2;b=Math.max(0,S-l/2)}else b=this._computeMinimumScrolling(s,c,p,h,r===3,r===4);return b}_computeScrollLeftToReveal(i){let e=this._context.viewLayout.getCurrentViewport(),t=this._context.configuration.options.get(165),o=e.left,n=o+e.width-t.verticalScrollbarWidth,r=1073741824,s=0,l=!1;if(i.type==="range"){l=this._lineIsRenderedRTL(i.lineNumber);let u=this._visibleRangesForLineRange(i.lineNumber,i.startColumn,i.endColumn);if(!u)return null;for(let p of u.ranges)r=Math.min(r,Math.round(p.left)),s=Math.max(s,Math.round(p.left+p.width))}else for(let u of i.selections){if(u.startLineNumber!==u.endLineNumber)return null;let p=this._visibleRangesForLineRange(u.startLineNumber,u.startColumn,u.endColumn);if(l||=this._lineIsRenderedRTL(u.startLineNumber),!p)return null;for(let h of p.ranges)r=Math.min(r,Math.round(h.left)),s=Math.max(s,Math.round(h.left+h.width))}return i.minimalReveal||(r=Math.max(0,r-a.HORIZONTAL_EXTRA_PX),s+=this._revealHorizontalRightPadding),i.type==="selections"&&s-r>e.width?null:{scrollLeft:this._computeMinimumScrolling(o,n,r,s),maxHorizontalOffset:s,hasRTL:l}}_computeMinimumScrolling(i,e,t,o,n,r){i=i|0,e=e|0,t=t|0,o=o|0,n=!!n,r=!!r;let s=e-i;if(o-t<s){if(n)return t;if(r)return Math.max(0,o-s);if(t<i)return t;if(o>e)return Math.max(0,o-s)}else return t;return i}};var uSt=class extends Cwe{constructor(i){super(),this._context=i;let t=this._context.configuration.options.get(165);this._decorationsLeft=t.decorationsLeft,this._decorationsWidth=t.decorationsWidth,this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(i){let t=this._context.configuration.options.get(165);return this._decorationsLeft=t.decorationsLeft,this._decorationsWidth=t.decorationsWidth,!0}onDecorationsChanged(i){return!0}onFlushed(i){return!0}onLinesChanged(i){return!0}onLinesDeleted(i){return!0}onLinesInserted(i){return!0}onScrollChanged(i){return i.scrollTopChanged}onZonesChanged(i){return!0}_getDecorations(i){let e=i.getDecorationsInViewport(),t=[],o=0;for(let n=0,r=e.length;n<r;n++){let s=e[n],l=s.options.linesDecorationsClassName,c=s.options.zIndex;l&&(t[o++]=new kle(s.range.startLineNumber,s.range.endLineNumber,l,s.options.linesDecorationsTooltip??null,c));let u=s.options.firstLineDecorationClassName;u&&(t[o++]=new kle(s.range.startLineNumber,s.range.startLineNumber,u,s.options.linesDecorationsTooltip??null,c))}return t}prepareRender(i){let e=i.visibleRange.startLineNumber,t=i.visibleRange.endLineNumber,o=this._render(e,t,this._getDecorations(i)),n=this._decorationsLeft.toString(),r=this._decorationsWidth.toString(),s='" style="left:'+n+"px;width:"+r+'px;"></div>',l=[];for(let c=e;c<=t;c++){let u=c-e,p=o[u].getDecorations(),h="";for(let g of p){let f='<div class="cldr '+g.className;g.tooltip!==null&&(f+='" title="'+g.tooltip),f+=s,h+=f}l[u]=h}this._renderResult=l}render(i,e){return this._renderResult?this._renderResult[e-i]:""}};var _we=class a extends Pu{static{this.CLASS_NAME="glyph-margin"}static{this.OUTER_CLASS_NAME="margin"}constructor(i){super(i);let e=this._context.configuration.options,t=e.get(165);this._canUseLayerHinting=!e.get(39),this._contentLeft=t.contentLeft,this._glyphMarginLeft=t.glyphMarginLeft,this._glyphMarginWidth=t.glyphMarginWidth,this._domNode=ur(document.createElement("div")),this._domNode.setClassName(a.OUTER_CLASS_NAME),this._domNode.setPosition("absolute"),this._domNode.setAttribute("role","presentation"),this._domNode.setAttribute("aria-hidden","true"),this._glyphMarginBackgroundDomNode=ur(document.createElement("div")),this._glyphMarginBackgroundDomNode.setClassName(a.CLASS_NAME),this._domNode.appendChild(this._glyphMarginBackgroundDomNode)}dispose(){super.dispose()}getDomNode(){return this._domNode}onConfigurationChanged(i){let e=this._context.configuration.options,t=e.get(165);return this._canUseLayerHinting=!e.get(39),this._contentLeft=t.contentLeft,this._glyphMarginLeft=t.glyphMarginLeft,this._glyphMarginWidth=t.glyphMarginWidth,!0}onScrollChanged(i){return super.onScrollChanged(i)||i.scrollTopChanged}prepareRender(i){}render(i){this._domNode.setLayerHinting(this._canUseLayerHinting),this._domNode.setContain("strict");let e=i.scrollTop-i.bigNumbersDelta;this._domNode.setTop(-e);let t=Math.min(i.scrollHeight,1e6);this._domNode.setHeight(t),this._domNode.setWidth(this._contentLeft),this._glyphMarginBackgroundDomNode.setLeft(this._glyphMarginLeft),this._glyphMarginBackgroundDomNode.setWidth(this._glyphMarginWidth),this._glyphMarginBackgroundDomNode.setHeight(t)}};var pSt=class extends Cwe{constructor(i){super(),this._context=i,this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(i){return!0}onDecorationsChanged(i){return!0}onFlushed(i){return!0}onLinesChanged(i){return!0}onLinesDeleted(i){return!0}onLinesInserted(i){return!0}onScrollChanged(i){return i.scrollTopChanged}onZonesChanged(i){return!0}_getDecorations(i){let e=i.getDecorationsInViewport(),t=[],o=0;for(let n=0,r=e.length;n<r;n++){let s=e[n],l=s.options.marginClassName,c=s.options.zIndex;l&&(t[o++]=new kle(s.range.startLineNumber,s.range.endLineNumber,l,null,c))}return t}prepareRender(i){let e=i.visibleRange.startLineNumber,t=i.visibleRange.endLineNumber,o=this._render(e,t,this._getDecorations(i)),n=[];for(let r=e;r<=t;r++){let s=r-e,l=o[s].getDecorations(),c="";for(let u of l)c+='<div class="cmdr '+u.className+'" style=""></div>';n[s]=c}this._renderResult=n}render(i,e){return this._renderResult?this._renderResult[e-i]:""}};var AO=class a{constructor(i,e,t,o){this._rgba8Brand=void 0;this.r=a._clamp(i),this.g=a._clamp(e),this.b=a._clamp(t),this.a=a._clamp(o)}static{this.Empty=new a(0,0,0,0)}equals(i){return this.r===i.r&&this.g===i.g&&this.b===i.b&&this.a===i.a}static _clamp(i){return i<0?0:i>255?255:i|0}};var q3i=(()=>{let a=[];for(let i=32;i<=126;i++)a.push(i);return a.push(65533),a})(),$3i=(a,i)=>(a-=32,a<0||a>96?i<=2?(a+96)%96:95:a);var Dwe=class a extends x{constructor(){super();this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._updateColorMap(),this._register(ic.onDidChange(e=>{e.changedColorMap&&this._updateColorMap()}))}static{this._INSTANCE=null}static getInstance(){return this._INSTANCE||(this._INSTANCE=im(new a)),this._INSTANCE}_updateColorMap(){let e=ic.getColorMap();if(!e){this._colors=[];for(let o=0;o<=2;o++)this._colors[o]=AO.Empty;this._backgroundIsLight=!0;return}this._colors=[AO.Empty];for(let o=1;o<e.length;o++){let n=e[o].rgba;this._colors[o]=new AO(n.r,n.g,n.b,Math.round(n.a*255))}let t=e[2].getRelativeLuminance();this._backgroundIsLight=t>=.5,this._onDidChange.fire(void 0)}getColor(e){(e<1||e>=this._colors.length)&&(e=2);let t=this._colors[e];return t||(mt(new li(`Missing color for colorId ${e}`)),t=AO.Empty),t}backgroundIsLight(){return this._backgroundIsLight}};var a5e=class a{constructor(i,e){this.scale=e;this._minimapCharRendererBrand=void 0;this.charDataNormal=a.soften(i,12/15),this.charDataLight=a.soften(i,50/60)}static soften(i,e){let t=new Uint8ClampedArray(i.length);for(let o=0,n=i.length;o<n;o++)t[o]=Gse(i[o]*e);return t}renderChar(i,e,t,o,n,r,s,l,c,u,p){let h=1*this.scale,g=2*this.scale,f=p?1:g;if(e+h>i.width||t+f>i.height){console.warn("bad render request outside image data");return}let v=u?this.charDataLight:this.charDataNormal,b=$3i(o,c),S=i.width*4,y=s.r,w=s.g,k=s.b,T=n.r-y,P=n.g-w,O=n.b-k,V=Math.max(r,l),H=i.data,G=b*h*g,$=t*S+e*4;for(let J=0;J<f;J++){let ae=$;for(let he=0;he<h;he++){let oe=v[G++]/255*(r/255);H[ae++]=y+T*oe,H[ae++]=w+P*oe,H[ae++]=k+O*oe,H[ae++]=V}$+=S}}blockRenderChar(i,e,t,o,n,r,s,l){let c=1*this.scale,u=2*this.scale,p=l?1:u;if(e+c>i.width||t+p>i.height){console.warn("bad render request outside image data");return}let h=i.width*4,g=.5*(n/255),f=r.r,v=r.g,b=r.b,S=o.r-f,y=o.g-v,w=o.b-b,k=f+S*g,T=v+y*g,P=b+w*g,O=Math.max(n,s),V=i.data,H=t*h+e*4;for(let G=0;G<p;G++){let $=H;for(let J=0;J<c;J++)V[$++]=k,V[$++]=T,V[$++]=P,V[$++]=O;H+=h}}};var Q3i={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15},Y3i=a=>{let i=new Uint8ClampedArray(a.length/2);for(let e=0;e<a.length;e+=2)i[e>>1]=Q3i[a[e]]<<4|Q3i[a[e+1]]&15;return i},xii={1:$c(()=>Y3i("0000511D6300CF609C709645A78432005642574171487021003C451900274D35D762755E8B629C5BA856AF57BA649530C167D1512A272A3F6038604460398526BCA2A968DB6F8957C768BE5FBE2FB467CF5D8D5B795DC7625B5DFF50DE64C466DB2FC47CD860A65E9A2EB96CB54CE06DA763AB2EA26860524D3763536601005116008177A8705E53AB738E6A982F88BAA35B5F5B626D9C636B449B737E5B7B678598869A662F6B5B8542706C704C80736A607578685B70594A49715A4522E792")),2:$c(()=>Y3i("000000000000000055394F383D2800008B8B1F210002000081B1CBCBCC820000847AAF6B9AAF2119BE08B8881AD60000A44FD07DCCF107015338130C00000000385972265F390B406E2437634B4B48031B12B8A0847000001E15B29A402F0000000000004B33460B00007A752C2A0000000000004D3900000084394B82013400ABA5CFC7AD9C0302A45A3E5A98AB000089A43382D97900008BA54AA087A70A0248A6A7AE6DBE0000BF6F94987EA40A01A06DCFA7A7A9030496C32F77891D0000A99FB1A0AFA80603B29AB9CA75930D010C0948354D3900000C0948354F37460D0028BE673D8400000000AF9D7B6E00002B007AA8933400007AA642675C2700007984CFB9C3985B768772A8A6B7B20000CAAECAAFC4B700009F94A6009F840009D09F9BA4CA9C0000CC8FC76DC87F0000C991C472A2000000A894A48CA7B501079BA2C9C69BA20000B19A5D3FA89000005CA6009DA2960901B0A7F0669FB200009D009E00B7890000DAD0F5D092820000D294D4C48BD10000B5A7A4A3B1A50402CAB6CBA6A2000000B5A7A4A3B1A8044FCDADD19D9CB00000B7778F7B8AAE0803C9AB5D3F5D3F00009EA09EA0BAB006039EA0989A8C7900009B9EF4D6B7C00000A9A7816CACA80000ABAC84705D3F000096DA635CDC8C00006F486F266F263D4784006124097B00374F6D2D6D2D6D4A3A95872322000000030000000000008D8939130000000000002E22A5C9CBC70600AB25C0B5C9B400061A2DB04CA67001082AA6BEBEBFC606002321DACBC19E03087AA08B6768380000282FBAC0B8CA7A88AD25BBA5A29900004C396C5894A6000040485A6E356E9442A32CD17EADA70000B4237923628600003E2DE9C1D7B500002F25BBA5A2990000231DB6AFB4A804023025C0B5CAB588062B2CBDBEC0C706882435A75CA20000002326BD6A82A908048B4B9A5A668000002423A09CB4BB060025259C9D8A7900001C1FCAB2C7C700002A2A9387ABA200002626A4A47D6E9D14333163A0C87500004B6F9C2D643A257049364936493647358A34438355497F1A0000A24C1D590000D38DFFBDD4CD3126"))};var mSt=class a{static create(i,e){if(this.lastCreated&&i===this.lastCreated.scale&&e===this.lastFontFamily)return this.lastCreated;let t;return xii[i]?t=new a5e(xii[i](),i):t=a.createFromSampleData(a.createSampleData(e).data,i),this.lastFontFamily=e,this.lastCreated=t,t}static createSampleData(i){let e=document.createElement("canvas"),t=e.getContext("2d");e.style.height="16px",e.height=16,e.width=960,e.style.width=960+"px",t.fillStyle="#ffffff",t.font=`bold 16px ${i}`,t.textBaseline="middle";let o=0;for(let n of q3i)t.fillText(String.fromCharCode(n),o,16/2),o+=10;return t.getImageData(0,0,960,16)}static createFromSampleData(i,e){let t=640*96;if(i.length!==t)throw new Error("Unexpected source in MinimapCharRenderer");let o=a._downsample(i,e);return new a5e(o,e)}static _downsampleChar(i,e,t,o,n){let r=1*n,s=2*n,l=o,c=0;for(let u=0;u<s;u++){let p=u/s*16,h=(u+1)/s*16;for(let g=0;g<r;g++){let f=g/r*10,v=(g+1)/r*10,b=0,S=0;for(let w=p;w<h;w++){let k=e+Math.floor(w)*3840,T=1-(w-Math.floor(w));for(let P=f;P<v;P++){let O=1-(P-Math.floor(P)),V=k+Math.floor(P)*4,H=O*T;S+=H,b+=i[V]*i[V+3]/255*H}}let y=b/S;c=Math.max(c,y),t[l++]=Gse(y)}}return c}static _downsample(i,e){let t=2*e*1*e,o=t*96,n=new Uint8ClampedArray(o),r=0,s=0,l=0;for(let c=0;c<96;c++)l=Math.max(l,this._downsampleChar(i,s,n,r,e)),r+=t,s+=40;if(l>0){let c=255/l;for(let u=0;u<o;u++)n[u]*=c}return n}};var NO=ei?'"Segoe WPC", "Segoe UI", sans-serif':Ze?"-apple-system, BlinkMacSystemFont, sans-serif":'system-ui, "Ubuntu", "Droid Sans", sans-serif',pVo=async()=>{try{return[...await ut.queryLocalFonts()].map(t=>t.family)}catch(a){return console.error(`Failed to query fonts: ${a}`),[]}},hSt=async()=>Cht?(await pVo()).map(e=>({body:`${e}`})):[];var gVo=140,fVo=2,gSt=class a{constructor(i,e,t){let o=i.options,n=o.get(163),r=o.get(165),s=r.minimap,l=o.get(59),c=o.get(81);this.renderMinimap=s.renderMinimap,this.size=c.size,this.minimapHeightIsEditorHeight=s.minimapHeightIsEditorHeight,this.scrollBeyondLastLine=o.get(119),this.paddingTop=o.get(96).top,this.paddingBottom=o.get(96).bottom,this.showSlider=c.showSlider,this.autohide=c.autohide,this.pixelRatio=n,this.typicalHalfwidthCharacterWidth=l.typicalHalfwidthCharacterWidth,this.lineHeight=o.get(75),this.minimapLeft=s.minimapLeft,this.minimapWidth=s.minimapWidth,this.minimapHeight=r.height,this.canvasInnerWidth=s.minimapCanvasInnerWidth,this.canvasInnerHeight=s.minimapCanvasInnerHeight,this.canvasOuterWidth=s.minimapCanvasOuterWidth,this.canvasOuterHeight=s.minimapCanvasOuterHeight,this.isSampling=s.minimapIsSampling,this.editorHeight=r.height,this.fontScale=s.minimapScale,this.minimapLineHeight=s.minimapLineHeight,this.minimapCharWidth=1*this.fontScale,this.sectionHeaderFontFamily=NO,this.sectionHeaderFontSize=c.sectionHeaderFontSize*n,this.sectionHeaderLetterSpacing=c.sectionHeaderLetterSpacing,this.sectionHeaderFontColor=a._getSectionHeaderColor(e,t.getColor(1)),this.charRenderer=$c(()=>mSt.create(this.fontScale,l.fontFamily)),this.defaultBackgroundColor=t.getColor(2),this.backgroundColor=a._getMinimapBackground(e,this.defaultBackgroundColor),this.foregroundAlpha=a._getMinimapForegroundOpacity(e)}static _getMinimapBackground(i,e){let t=i.getColor(G5i);return t?new AO(t.rgba.r,t.rgba.g,t.rgba.b,Math.round(255*t.rgba.a)):e}static _getMinimapForegroundOpacity(i){let e=i.getColor(q5i);return e?AO._clamp(Math.round(255*e.rgba.a)):255}static _getSectionHeaderColor(i,e){let t=i.getColor(Id);return t?new AO(t.rgba.r,t.rgba.g,t.rgba.b,Math.round(255*t.rgba.a)):e}equals(i){return this.renderMinimap===i.renderMinimap&&this.size===i.size&&this.minimapHeightIsEditorHeight===i.minimapHeightIsEditorHeight&&this.scrollBeyondLastLine===i.scrollBeyondLastLine&&this.paddingTop===i.paddingTop&&this.paddingBottom===i.paddingBottom&&this.showSlider===i.showSlider&&this.autohide===i.autohide&&this.pixelRatio===i.pixelRatio&&this.typicalHalfwidthCharacterWidth===i.typicalHalfwidthCharacterWidth&&this.lineHeight===i.lineHeight&&this.minimapLeft===i.minimapLeft&&this.minimapWidth===i.minimapWidth&&this.minimapHeight===i.minimapHeight&&this.canvasInnerWidth===i.canvasInnerWidth&&this.canvasInnerHeight===i.canvasInnerHeight&&this.canvasOuterWidth===i.canvasOuterWidth&&this.canvasOuterHeight===i.canvasOuterHeight&&this.isSampling===i.isSampling&&this.editorHeight===i.editorHeight&&this.fontScale===i.fontScale&&this.minimapLineHeight===i.minimapLineHeight&&this.minimapCharWidth===i.minimapCharWidth&&this.sectionHeaderFontSize===i.sectionHeaderFontSize&&this.sectionHeaderLetterSpacing===i.sectionHeaderLetterSpacing&&this.defaultBackgroundColor&&this.defaultBackgroundColor.equals(i.defaultBackgroundColor)&&this.backgroundColor&&this.backgroundColor.equals(i.backgroundColor)&&this.foregroundAlpha===i.foregroundAlpha}},kii=class a{constructor(i,e,t,o,n,r,s,l,c){this.scrollTop=i;this.scrollHeight=e;this.sliderNeeded=t;this._computedSliderRatio=o;this.sliderTop=n;this.sliderHeight=r;this.topPaddingLineCount=s;this.startLineNumber=l;this.endLineNumber=c}getDesiredScrollTopFromDelta(i){return Math.round(this.scrollTop+i/this._computedSliderRatio)}getDesiredScrollTopFromTouchLocation(i){return Math.round((i-this.sliderHeight/2)/this._computedSliderRatio)}intersectWithViewport(i){let e=Math.max(this.startLineNumber,i.startLineNumber),t=Math.min(this.endLineNumber,i.endLineNumber);return e>t?null:[e,t]}getYForLineNumber(i,e){return+(i-this.startLineNumber+this.topPaddingLineCount)*e}static create(i,e,t,o,n,r,s,l,c,u,p){let h=i.pixelRatio,g=i.minimapLineHeight,f=Math.floor(i.canvasInnerHeight/g),v=i.lineHeight;if(i.minimapHeightIsEditorHeight){let P=l*i.lineHeight+i.paddingTop+i.paddingBottom;i.scrollBeyondLastLine&&(P+=Math.max(0,n-i.lineHeight-i.paddingBottom));let O=Math.max(1,Math.floor(n*n/P)),V=Math.max(0,i.minimapHeight-O),H=V/(u-n),G=c*H,$=V>0,J=Math.floor(i.canvasInnerHeight/i.minimapLineHeight),ae=Math.floor(i.paddingTop/i.lineHeight);return new a(c,u,$,H,G,O,ae,1,Math.min(s,J))}let b;if(r&&t!==s){let P=t-e+1;b=Math.floor(P*g/h)}else{let P=n/v;b=Math.floor(P*g/h)}let S=Math.floor(i.paddingTop/v),y=Math.floor(i.paddingBottom/v);if(i.scrollBeyondLastLine){let P=n/v;y=Math.max(y,P-1)}let w;if(y>0){let P=n/v;w=(S+s+y-P-1)*g/h}else w=Math.max(0,(S+s)*g/h-b);w=Math.min(i.minimapHeight-b,w);let k=w/(u-n),T=c*k;if(f>=S+s+y){let P=w>0;return new a(c,u,P,k,T,b,S,1,s)}else{let P;e>1?P=e+S:P=Math.max(1,c/v);let O,V=Math.max(1,Math.floor(P-T*h/g));V<S?(O=S-V+1,V=1):(O=0,V=Math.max(1,V-S)),p&&p.scrollHeight===u&&(p.scrollTop>c&&(V=Math.min(V,p.startLineNumber),O=Math.max(O,p.topPaddingLineCount)),p.scrollTop<c&&(V=Math.max(V,p.startLineNumber),O=Math.min(O,p.topPaddingLineCount)));let H=Math.min(s,V-O+f-1),G=(c-o)/v,$;return c>=i.paddingTop?$=(e-V+O+G)*g/h:$=c/i.paddingTop*(O+G)*g/h,new a(c,u,!0,k,$,b,O,V,H)}}},fSt=class a{static{this.INVALID=new a(-1)}constructor(i){this.dy=i}onContentChanged(){this.dy=-1}onTokensChanged(){this.dy=-1}},vSt=class{constructor(i,e,t){this.renderedLayout=i,this._imageData=e,this._renderedLines=new r5e({createLine:()=>fSt.INVALID}),this._renderedLines._set(i.startLineNumber,t)}linesEquals(i){if(!this.scrollEquals(i))return!1;let t=this._renderedLines._get().lines;for(let o=0,n=t.length;o<n;o++)if(t[o].dy===-1)return!1;return!0}scrollEquals(i){return this.renderedLayout.startLineNumber===i.startLineNumber&&this.renderedLayout.endLineNumber===i.endLineNumber}_get(){let i=this._renderedLines._get();return{imageData:this._imageData,rendLineNumberStart:i.rendLineNumberStart,lines:i.lines}}onLinesChanged(i,e){return this._renderedLines.onLinesChanged(i,e)}onLinesDeleted(i,e){this._renderedLines.onLinesDeleted(i,e)}onLinesInserted(i,e){this._renderedLines.onLinesInserted(i,e)}onTokensChanged(i){return this._renderedLines.onTokensChanged(i)}},Eii=class a{constructor(i,e,t,o){this._backgroundFillData=a._createBackgroundFillData(e,t,o),this._buffers=[i.createImageData(e,t),i.createImageData(e,t)],this._lastUsedBuffer=0}getBuffer(){this._lastUsedBuffer=1-this._lastUsedBuffer;let i=this._buffers[this._lastUsedBuffer];return i.data.set(this._backgroundFillData),i}static _createBackgroundFillData(i,e,t){let o=t.r,n=t.g,r=t.b,s=t.a,l=new Uint8ClampedArray(i*e*4),c=0;for(let u=0;u<e;u++)for(let p=0;p<i;p++)l[c]=o,l[c+1]=n,l[c+2]=r,l[c+3]=s,c+=4;return l}},bSt=class a{constructor(i,e){this.samplingRatio=i;this.minimapLines=e}static compute(i,e,t){if(i.renderMinimap===0||!i.isSampling)return[null,[]];let{minimapLineCount:o}=tje.computeContainedMinimapLineCount({viewLineCount:e,scrollBeyondLastLine:i.scrollBeyondLastLine,paddingTop:i.paddingTop,paddingBottom:i.paddingBottom,height:i.editorHeight,lineHeight:i.lineHeight,pixelRatio:i.pixelRatio}),n=e/o,r=n/2;if(!t||t.minimapLines.length===0){let b=[];if(b[0]=1,o>1){for(let S=0,y=o-1;S<y;S++)b[S]=Math.round(S*n+r);b[o-1]=e}return[new a(n,b),[]]}let s=t.minimapLines,l=s.length,c=[],u=0,p=0,h=1,g=10,f=[],v=null;for(let b=0;b<o;b++){let S=Math.max(h,Math.round(b*n)),y=Math.max(S,Math.round((b+1)*n));for(;u<l&&s[u]<S;){if(f.length<g){let k=u+1+p;v&&v.type==="deleted"&&v._oldIndex===u-1?v.deleteToLineNumber++:(v={type:"deleted",_oldIndex:u,deleteFromLineNumber:k,deleteToLineNumber:k},f.push(v)),p--}u++}let w;if(u<l&&s[u]<=y)w=s[u],u++;else if(b===0?w=1:b+1===o?w=e:w=Math.round(b*n+r),f.length<g){let k=u+1+p;v&&v.type==="inserted"&&v._i===b-1?v.insertToLineNumber++:(v={type:"inserted",_i:b,insertFromLineNumber:k,insertToLineNumber:k},f.push(v)),p++}c[b]=w,h=w}if(f.length<g)for(;u<l;){let b=u+1+p;v&&v.type==="deleted"&&v._oldIndex===u-1?v.deleteToLineNumber++:(v={type:"deleted",_oldIndex:u,deleteFromLineNumber:b,deleteToLineNumber:b},f.push(v)),p--,u++}else f=[{type:"flush"}];return[new a(n,c),f]}modelLineToMinimapLine(i){return Math.min(this.minimapLines.length,Math.max(1,Math.round(i/this.samplingRatio)))}modelLineRangeToMinimapLineRange(i,e){let t=this.modelLineToMinimapLine(i)-1;for(;t>0&&this.minimapLines[t-1]>=i;)t--;let o=this.modelLineToMinimapLine(e)-1;for(;o+1<this.minimapLines.length&&this.minimapLines[o+1]<=e;)o++;if(t===o){let n=this.minimapLines[t];if(n<i||n>e)return null}return[t+1,o+1]}decorationLineRangeToMinimapLineRange(i,e){let t=this.modelLineToMinimapLine(i),o=this.modelLineToMinimapLine(e);return i!==e&&o===t&&(o===this.minimapLines.length?t>1&&t--:o++),[t,o]}onLinesDeleted(i){let e=i.toLineNumber-i.fromLineNumber+1,t=this.minimapLines.length,o=0;for(let n=this.minimapLines.length-1;n>=0&&!(this.minimapLines[n]<i.fromLineNumber);n--)this.minimapLines[n]<=i.toLineNumber?(this.minimapLines[n]=Math.max(1,i.fromLineNumber-1),t=Math.min(t,n),o=Math.max(o,n)):this.minimapLines[n]-=e;return[t,o]}onLinesInserted(i){let e=i.toLineNumber-i.fromLineNumber+1;for(let t=this.minimapLines.length-1;t>=0&&!(this.minimapLines[t]<i.fromLineNumber);t--)this.minimapLines[t]+=e}},SSt=class extends Pu{constructor(e){super(e);this._sectionHeaderCache=new dl(10,1.5);this.tokensColorTracker=Dwe.getInstance(),this._selections=[],this._minimapSelections=null,this.options=new gSt(this._context.configuration,this._context.theme,this.tokensColorTracker);let[t]=bSt.compute(this.options,this._context.viewModel.getLineCount(),null);this._samplingState=t,this._shouldCheckSampling=!1,this._actual=new Tii(e.theme,this)}dispose(){this._actual.dispose(),super.dispose()}getDomNode(){return this._actual.getDomNode()}_onOptionsMaybeChanged(){let e=new gSt(this._context.configuration,this._context.theme,this.tokensColorTracker);return this.options.equals(e)?!1:(this.options=e,this._recreateLineSampling(),this._actual.onDidChangeOptions(),!0)}onConfigurationChanged(e){return this._onOptionsMaybeChanged()}onCursorStateChanged(e){return this._selections=e.selections,this._minimapSelections=null,this._actual.onSelectionChanged()}onDecorationsChanged(e){return e.affectsMinimap?this._actual.onDecorationsChanged():!1}onFlushed(e){return this._samplingState&&(this._shouldCheckSampling=!0),this._actual.onFlushed()}onLinesChanged(e){if(this._samplingState){let t=this._samplingState.modelLineRangeToMinimapLineRange(e.fromLineNumber,e.fromLineNumber+e.count-1);return t?this._actual.onLinesChanged(t[0],t[1]-t[0]+1):!1}else return this._actual.onLinesChanged(e.fromLineNumber,e.count)}onLinesDeleted(e){if(this._samplingState){let[t,o]=this._samplingState.onLinesDeleted(e);return t<=o&&this._actual.onLinesChanged(t+1,o-t+1),this._shouldCheckSampling=!0,!0}else return this._actual.onLinesDeleted(e.fromLineNumber,e.toLineNumber)}onLinesInserted(e){return this._samplingState?(this._samplingState.onLinesInserted(e),this._shouldCheckSampling=!0,!0):this._actual.onLinesInserted(e.fromLineNumber,e.toLineNumber)}onScrollChanged(e){return this._actual.onScrollChanged(e)}onThemeChanged(e){return this._actual.onThemeChanged(),this._onOptionsMaybeChanged(),!0}onTokensChanged(e){if(this._samplingState){let t=[];for(let o of e.ranges){let n=this._samplingState.modelLineRangeToMinimapLineRange(o.fromLineNumber,o.toLineNumber);n&&t.push({fromLineNumber:n[0],toLineNumber:n[1]})}return t.length?this._actual.onTokensChanged(t):!1}else return this._actual.onTokensChanged(e.ranges)}onTokensColorsChanged(e){return this._onOptionsMaybeChanged(),this._actual.onTokensColorsChanged()}onZonesChanged(e){return this._actual.onZonesChanged()}prepareRender(e){this._shouldCheckSampling&&(this._shouldCheckSampling=!1,this._recreateLineSampling())}render(e){let t=e.visibleRange.startLineNumber,o=e.visibleRange.endLineNumber;this._samplingState&&(t=this._samplingState.modelLineToMinimapLine(t),o=this._samplingState.modelLineToMinimapLine(o));let n={viewportContainsWhitespaceGaps:e.viewportData.whitespaceViewportData.length>0,scrollWidth:e.scrollWidth,scrollHeight:e.scrollHeight,viewportStartLineNumber:t,viewportEndLineNumber:o,viewportStartLineNumberVerticalOffset:e.getVerticalOffsetForLineNumber(t),scrollTop:e.scrollTop,scrollLeft:e.scrollLeft,viewportWidth:e.viewportWidth,viewportHeight:e.viewportHeight};this._actual.render(n)}_recreateLineSampling(){this._minimapSelections=null;let e=!!this._samplingState,[t,o]=bSt.compute(this.options,this._context.viewModel.getLineCount(),this._samplingState);if(this._samplingState=t,e&&this._samplingState)for(let n of o)switch(n.type){case"deleted":this._actual.onLinesDeleted(n.deleteFromLineNumber,n.deleteToLineNumber);break;case"inserted":this._actual.onLinesInserted(n.insertFromLineNumber,n.insertToLineNumber);break;case"flush":this._actual.onFlushed();break}}getLineCount(){return this._samplingState?this._samplingState.minimapLines.length:this._context.viewModel.getLineCount()}getRealLineCount(){return this._context.viewModel.getLineCount()}getLineContent(e){return this._samplingState?this._context.viewModel.getLineContent(this._samplingState.minimapLines[e-1]):this._context.viewModel.getLineContent(e)}getLineMaxColumn(e){return this._samplingState?this._context.viewModel.getLineMaxColumn(this._samplingState.minimapLines[e-1]):this._context.viewModel.getLineMaxColumn(e)}getMinimapLinesRenderingData(e,t,o){if(this._samplingState){let n=[];for(let r=0,s=t-e+1;r<s;r++)o[r]?n[r]=this._context.viewModel.getViewLineData(this._samplingState.minimapLines[e+r-1]):n[r]=null;return n}return this._context.viewModel.getMinimapLinesRenderingData(e,t,o).data}getSelections(){if(this._minimapSelections===null)if(this._samplingState){this._minimapSelections=[];for(let e of this._selections){let[t,o]=this._samplingState.decorationLineRangeToMinimapLineRange(e.startLineNumber,e.endLineNumber);this._minimapSelections.push(new ti(t,e.startColumn,o,e.endColumn))}}else this._minimapSelections=this._selections;return this._minimapSelections}getMinimapDecorationsInViewport(e,t){return this._getMinimapDecorationsInViewport(e,t).filter(o=>!o.options.minimap?.sectionHeaderStyle)}getSectionHeaderDecorationsInViewport(e,t){let o=this.options.sectionHeaderFontSize/this.options.minimapLineHeight;return e=Math.floor(Math.max(1,e-o)),this._getMinimapDecorationsInViewport(e,t).filter(n=>!!n.options.minimap?.sectionHeaderStyle)}_getMinimapDecorationsInViewport(e,t){let o;if(this._samplingState){let r=this._samplingState.minimapLines[e-1],s=this._samplingState.minimapLines[t-1];o=new z(r,1,s,this._context.viewModel.getLineMaxColumn(s))}else o=new z(e,1,t,this._context.viewModel.getLineMaxColumn(t));let n=this._context.viewModel.getMinimapDecorationsInRange(o);if(this._samplingState){let r=[];for(let s of n){if(!s.options.minimap)continue;let l=s.range,c=this._samplingState.modelLineToMinimapLine(l.startLineNumber),u=this._samplingState.modelLineToMinimapLine(l.endLineNumber);r.push(new Xye(new z(c,l.startColumn,u,l.endColumn),s.options))}return r}return n}getSectionHeaderText(e,t){let o=e.options.minimap?.sectionHeaderText;if(!o)return null;let n=this._sectionHeaderCache.get(o);if(n)return n;let r=t(o);return this._sectionHeaderCache.set(o,r),r}getOptions(){return this._context.viewModel.model.getOptions()}revealLineNumber(e){this._samplingState&&(e=this._samplingState.minimapLines[e-1]),this._context.viewModel.revealRange("mouse",!1,new z(e,1,e,1),1,0)}setScrollTop(e){this._context.viewModel.viewLayout.setScrollPosition({scrollTop:e},1)}},Tii=class a extends x{constructor(e,t){super();this._renderDecorations=!1;this._gestureInProgress=!1;this._isMouseOverMinimap=!1;this._theme=e,this._model=t,this._lastRenderData=null,this._buffers=null,this._selectionColor=this._theme.getColor(_ti),this._domNode=ur(document.createElement("div")),YS.write(this._domNode,9),this._domNode.setClassName(this._getMinimapDomNodeClassName()),this._domNode.setPosition("absolute"),this._domNode.setAttribute("role","presentation"),this._domNode.setAttribute("aria-hidden","true"),this._shadow=ur(document.createElement("div")),this._shadow.setClassName("minimap-shadow-hidden"),this._domNode.appendChild(this._shadow),this._canvas=ur(document.createElement("canvas")),this._canvas.setPosition("absolute"),this._canvas.setLeft(0),this._domNode.appendChild(this._canvas),this._decorationsCanvas=ur(document.createElement("canvas")),this._decorationsCanvas.setPosition("absolute"),this._decorationsCanvas.setClassName("minimap-decorations-layer"),this._decorationsCanvas.setLeft(0),this._domNode.appendChild(this._decorationsCanvas),this._slider=ur(document.createElement("div")),this._slider.setPosition("absolute"),this._slider.setClassName("minimap-slider"),this._slider.setLayerHinting(!0),this._slider.setContain("strict"),this._domNode.appendChild(this._slider),this._sliderHorizontal=ur(document.createElement("div")),this._sliderHorizontal.setPosition("absolute"),this._sliderHorizontal.setClassName("minimap-slider-horizontal"),this._slider.appendChild(this._sliderHorizontal),this._applyLayout(),this._hideDelayedScheduler=this._register(new Dt(()=>this._hideImmediatelyIfMouseIsOutside(),500)),this._register(Jo(this._domNode.domNode,re.MOUSE_OVER,()=>{this._isMouseOverMinimap=!0})),this._register(Jo(this._domNode.domNode,re.MOUSE_LEAVE,()=>{this._isMouseOverMinimap=!1})),this._pointerDownListener=Jo(this._domNode.domNode,re.POINTER_DOWN,o=>{o.preventDefault();let n=o.pointerType==="mouse",r=o.button===0;if(this._model.options.renderMinimap!==0&&this._lastRenderData){if(this._model.options.size!=="proportional"){if(r&&this._lastRenderData){let l=ir(this._slider.domNode),c=l.top+l.height/2;this._startSliderDragging(o,c,this._lastRenderData.renderedLayout)}return}if(r||!n){let l=this._model.options.minimapLineHeight,c=this._model.options.canvasInnerHeight/this._model.options.canvasOuterHeight*o.offsetY,p=Math.floor(c/l)+this._lastRenderData.renderedLayout.startLineNumber-this._lastRenderData.renderedLayout.topPaddingLineCount;p=Math.min(p,this._model.getLineCount()),this._model.revealLineNumber(p)}}}),this._sliderPointerMoveMonitor=new $L,this._sliderPointerDownListener=Jo(this._slider.domNode,re.POINTER_DOWN,o=>{o.preventDefault(),o.stopPropagation(),o.button===0&&this._lastRenderData&&this._startSliderDragging(o,o.pageY,this._lastRenderData.renderedLayout)}),this._gestureDisposable=Ms.addTarget(this._domNode.domNode),this._sliderTouchStartListener=j(this._domNode.domNode,Kn.Start,o=>{o.preventDefault(),o.stopPropagation(),this._lastRenderData&&(this._slider.toggleClassName("active",!0),this._gestureInProgress=!0,this.scrollDueToTouchEvent(o))},{passive:!1}),this._sliderTouchMoveListener=j(this._domNode.domNode,Kn.Change,o=>{o.preventDefault(),o.stopPropagation(),this._lastRenderData&&this._gestureInProgress&&this.scrollDueToTouchEvent(o)},{passive:!1}),this._sliderTouchEndListener=Jo(this._domNode.domNode,Kn.End,o=>{o.preventDefault(),o.stopPropagation(),this._gestureInProgress=!1,this._slider.toggleClassName("active",!1)})}_hideSoon(){this._hideDelayedScheduler.cancel(),this._hideDelayedScheduler.schedule()}_hideImmediatelyIfMouseIsOutside(){if(this._isMouseOverMinimap){this._hideSoon();return}this._domNode.toggleClassName("active",!1)}_startSliderDragging(e,t,o){if(!e.target||!(e.target instanceof Element))return;let n=e.pageX;this._slider.toggleClassName("active",!0);let r=(s,l)=>{let c=ir(this._domNode.domNode),u=Math.min(Math.abs(l-n),Math.abs(l-c.left),Math.abs(l-c.left-c.width));if(ei&&u>gVo){this._model.setScrollTop(o.scrollTop);return}let p=s-t;this._model.setScrollTop(o.getDesiredScrollTopFromDelta(p))};e.pageY!==t&&r(e.pageY,n),this._sliderPointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,s=>r(s.pageY,s.pageX),()=>{this._slider.toggleClassName("active",!1)})}scrollDueToTouchEvent(e){let t=this._domNode.domNode.getBoundingClientRect().top,o=this._lastRenderData.renderedLayout.getDesiredScrollTopFromTouchLocation(e.pageY-t);this._model.setScrollTop(o)}dispose(){this._pointerDownListener.dispose(),this._sliderPointerMoveMonitor.dispose(),this._sliderPointerDownListener.dispose(),this._gestureDisposable.dispose(),this._sliderTouchStartListener.dispose(),this._sliderTouchMoveListener.dispose(),this._sliderTouchEndListener.dispose(),super.dispose()}_getMinimapDomNodeClassName(){let e=["minimap"];return this._model.options.showSlider==="always"?e.push("slider-always"):e.push("slider-mouseover"),this._model.options.autohide==="mouseover"?e.push("minimap-autohide-mouseover"):this._model.options.autohide==="scroll"&&e.push("minimap-autohide-scroll"),e.join(" ")}getDomNode(){return this._domNode}_applyLayout(){this._domNode.setLeft(this._model.options.minimapLeft),this._domNode.setWidth(this._model.options.minimapWidth),this._domNode.setHeight(this._model.options.minimapHeight),this._shadow.setHeight(this._model.options.minimapHeight),this._canvas.setWidth(this._model.options.canvasOuterWidth),this._canvas.setHeight(this._model.options.canvasOuterHeight),this._canvas.domNode.width=this._model.options.canvasInnerWidth,this._canvas.domNode.height=this._model.options.canvasInnerHeight,this._decorationsCanvas.setWidth(this._model.options.canvasOuterWidth),this._decorationsCanvas.setHeight(this._model.options.canvasOuterHeight),this._decorationsCanvas.domNode.width=this._model.options.canvasInnerWidth,this._decorationsCanvas.domNode.height=this._model.options.canvasInnerHeight,this._slider.setWidth(this._model.options.minimapWidth)}_getBuffer(){return this._buffers||this._model.options.canvasInnerWidth>0&&this._model.options.canvasInnerHeight>0&&(this._buffers=new Eii(this._canvas.domNode.getContext("2d"),this._model.options.canvasInnerWidth,this._model.options.canvasInnerHeight,this._model.options.backgroundColor)),this._buffers?this._buffers.getBuffer():null}onDidChangeOptions(){this._lastRenderData=null,this._buffers=null,this._applyLayout(),this._domNode.setClassName(this._getMinimapDomNodeClassName())}onSelectionChanged(){return this._renderDecorations=!0,!0}onDecorationsChanged(){return this._renderDecorations=!0,!0}onFlushed(){return this._lastRenderData=null,!0}onLinesChanged(e,t){return this._lastRenderData?this._lastRenderData.onLinesChanged(e,t):!1}onLinesDeleted(e,t){return this._lastRenderData?.onLinesDeleted(e,t),!0}onLinesInserted(e,t){return this._lastRenderData?.onLinesInserted(e,t),!0}onScrollChanged(e){return this._model.options.autohide==="scroll"&&(e.scrollTopChanged||e.scrollHeightChanged)&&(this._domNode.toggleClassName("active",!0),this._hideSoon()),this._renderDecorations=!0,!0}onThemeChanged(){return this._selectionColor=this._theme.getColor(_ti),this._renderDecorations=!0,!0}onTokensChanged(e){return this._lastRenderData?this._lastRenderData.onTokensChanged(e):!1}onTokensColorsChanged(){return this._lastRenderData=null,this._buffers=null,!0}onZonesChanged(){return this._lastRenderData=null,!0}render(e){if(this._model.options.renderMinimap===0){this._shadow.setClassName("minimap-shadow-hidden"),this._sliderHorizontal.setWidth(0),this._sliderHorizontal.setHeight(0);return}e.scrollLeft+e.viewportWidth>=e.scrollWidth?this._shadow.setClassName("minimap-shadow-hidden"):this._shadow.setClassName("minimap-shadow-visible");let o=kii.create(this._model.options,e.viewportStartLineNumber,e.viewportEndLineNumber,e.viewportStartLineNumberVerticalOffset,e.viewportHeight,e.viewportContainsWhitespaceGaps,this._model.getLineCount(),this._model.getRealLineCount(),e.scrollTop,e.scrollHeight,this._lastRenderData?this._lastRenderData.renderedLayout:null);this._slider.setDisplay(o.sliderNeeded?"block":"none"),this._slider.setTop(o.sliderTop),this._slider.setHeight(o.sliderHeight),this._sliderHorizontal.setLeft(0),this._sliderHorizontal.setWidth(this._model.options.minimapWidth),this._sliderHorizontal.setTop(0),this._sliderHorizontal.setHeight(o.sliderHeight),this.renderDecorations(o),this._lastRenderData=this.renderLines(o)}renderDecorations(e){if(this._renderDecorations){this._renderDecorations=!1;let t=this._model.getSelections();t.sort(z.compareRangesUsingStarts);let o=this._model.getMinimapDecorationsInViewport(e.startLineNumber,e.endLineNumber);o.sort((g,f)=>(g.options.zIndex||0)-(f.options.zIndex||0));let{canvasInnerWidth:n,canvasInnerHeight:r}=this._model.options,s=this._model.options.minimapLineHeight,l=this._model.options.minimapCharWidth,c=this._model.getOptions().tabSize,u=this._decorationsCanvas.domNode.getContext("2d");u.clearRect(0,0,n,r);let p=new ISt(e.startLineNumber,e.endLineNumber,!1);this._renderSelectionLineHighlights(u,t,p,e,s),this._renderDecorationsLineHighlights(u,o,p,e,s);let h=new ISt(e.startLineNumber,e.endLineNumber,null);this._renderSelectionsHighlights(u,t,h,e,s,c,l,n),this._renderDecorationsHighlights(u,o,h,e,s,c,l,n),this._renderSectionHeaders(e)}}_renderSelectionLineHighlights(e,t,o,n,r){if(!this._selectionColor||this._selectionColor.isTransparent())return;e.fillStyle=this._selectionColor.transparent(.5).toString();let s=0,l=0;for(let c of t){let u=n.intersectWithViewport(c);if(!u)continue;let[p,h]=u;for(let v=p;v<=h;v++)o.set(v,!0);let g=n.getYForLineNumber(p,r),f=n.getYForLineNumber(h,r);l>=g||(l>s&&e.fillRect(kV,s,e.canvas.width,l-s),s=g),l=f}l>s&&e.fillRect(kV,s,e.canvas.width,l-s)}_renderDecorationsLineHighlights(e,t,o,n,r){let s=new Map;for(let l=t.length-1;l>=0;l--){let c=t[l],u=c.options.minimap;if(!u||u.position!==1)continue;let p=n.intersectWithViewport(c.range);if(!p)continue;let[h,g]=p,f=u.getColor(this._theme.value);if(!f||f.isTransparent())continue;let v=s.get(f.toString());v||(v=f.transparent(.5).toString(),s.set(f.toString(),v)),e.fillStyle=v;for(let b=h;b<=g;b++){if(o.has(b))continue;o.set(b,!0);let S=n.getYForLineNumber(b,r);e.fillRect(kV,S,e.canvas.width,r)}}}_renderSelectionsHighlights(e,t,o,n,r,s,l,c){if(!(!this._selectionColor||this._selectionColor.isTransparent()))for(let u of t){let p=n.intersectWithViewport(u);if(!p)continue;let[h,g]=p;for(let f=h;f<=g;f++)this.renderDecorationOnLine(e,o,u,this._selectionColor,n,f,r,r,s,l,c)}}_renderDecorationsHighlights(e,t,o,n,r,s,l,c){for(let u of t){let p=u.options.minimap;if(!p)continue;let h=n.intersectWithViewport(u.range);if(!h)continue;let[g,f]=h,v=p.getColor(this._theme.value);if(!(!v||v.isTransparent()))for(let b=g;b<=f;b++)switch(p.position){case 1:this.renderDecorationOnLine(e,o,u.range,v,n,b,r,r,s,l,c);continue;case 2:{let S=n.getYForLineNumber(b,r);this.renderDecoration(e,v,2,S,fVo,r);continue}}}}renderDecorationOnLine(e,t,o,n,r,s,l,c,u,p,h){let g=r.getYForLineNumber(s,c);if(g+l<0||g>this._model.options.canvasInnerHeight)return;let{startLineNumber:f,endLineNumber:v}=o,b=f===s?o.startColumn:1,S=v===s?o.endColumn:this._model.getLineMaxColumn(s),y=this.getXOffsetForPosition(t,s,b,u,p,h),w=this.getXOffsetForPosition(t,s,S,u,p,h);this.renderDecoration(e,n,y,g,w-y,l)}getXOffsetForPosition(e,t,o,n,r,s){if(o===1)return kV;if((o-1)*r>=s)return s;let c=e.get(t);if(!c){let u=this._model.getLineContent(t);c=[kV];let p=kV;for(let h=1;h<u.length+1;h++){let g=u.charCodeAt(h-1),f=g===9?n*r:h_(g)?2*r:r,v=p+f;if(v>=s){c[h]=s;break}c[h]=v,p=v}e.set(t,c)}return o-1<c.length?c[o-1]:s}renderDecoration(e,t,o,n,r,s){e.fillStyle=t&&t.toString()||"",e.fillRect(o,n,r,s)}_renderSectionHeaders(e){let t=this._model.options.minimapLineHeight,o=this._model.options.sectionHeaderFontSize,n=this._model.options.sectionHeaderLetterSpacing,r=o*1.5,{canvasInnerWidth:s}=this._model.options,l=this._model.options.backgroundColor,c=`rgb(${l.r} ${l.g} ${l.b} / .7)`,u=this._model.options.sectionHeaderFontColor,p=`rgb(${u.r} ${u.g} ${u.b})`,h=p,g=this._decorationsCanvas.domNode.getContext("2d");g.letterSpacing=n+"px",g.font="500 "+o+"px "+this._model.options.sectionHeaderFontFamily,g.strokeStyle=h,g.lineWidth=.4;let f=this._model.getSectionHeaderDecorationsInViewport(e.startLineNumber,e.endLineNumber);f.sort((b,S)=>b.range.startLineNumber-S.range.startLineNumber);let v=a._fitSectionHeader.bind(null,g,s-kV);for(let b of f){let S=e.getYForLineNumber(b.range.startLineNumber,t)+o,y=S-o,w=y+2,k=this._model.getSectionHeaderText(b,v);a._renderSectionLabel(g,k,b.options.minimap?.sectionHeaderStyle===2,c,p,s,y,r,S,w)}}static _fitSectionHeader(e,t,o){if(!o)return o;let n="\u2026",r=e.measureText(o).width,s=e.measureText(n).width;if(r<=t||r<=s)return o;let l=o.length,c=r/o.length,u=Math.floor((t-s)/c)-1,p=Math.ceil(u/2);for(;p>0&&/\s/.test(o[p-1]);)--p;return o.substring(0,p)+n+o.substring(l-(u-p))}static _renderSectionLabel(e,t,o,n,r,s,l,c,u,p){t&&(e.fillStyle=n,e.fillRect(0,l,s,c),e.fillStyle=r,e.fillText(t,kV,u)),o&&(e.beginPath(),e.moveTo(0,p),e.lineTo(s,p),e.closePath(),e.stroke())}renderLines(e){let t=e.startLineNumber,o=e.endLineNumber,n=this._model.options.minimapLineHeight;if(this._lastRenderData&&this._lastRenderData.linesEquals(e)){let de=this._lastRenderData._get();return new vSt(e,de.imageData,de.lines)}let r=this._getBuffer();if(!r)return null;let[s,l,c]=a._renderUntouchedLines(r,e.topPaddingLineCount,t,o,n,this._lastRenderData),u=this._model.getMinimapLinesRenderingData(t,o,c),p=this._model.getOptions().tabSize,h=this._model.options.defaultBackgroundColor,g=this._model.options.backgroundColor,f=this._model.options.foregroundAlpha,v=this._model.tokensColorTracker,b=v.backgroundIsLight(),S=this._model.options.renderMinimap,y=this._model.options.charRenderer(),w=this._model.options.fontScale,k=this._model.options.minimapCharWidth,P=(S===1?2:3)*w,O=n>P?Math.floor((n-P)/2):0,V=g.a/255,H=new AO(Math.round((g.r-h.r)*V+h.r),Math.round((g.g-h.g)*V+h.g),Math.round((g.b-h.b)*V+h.b),255),G=e.topPaddingLineCount*n,$=[];for(let de=0,Ce=o-t+1;de<Ce;de++)c[de]&&a._renderLine(r,H,g.a,b,S,k,v,f,y,G,O,p,u[de],w,n),$[de]=new fSt(G),G+=n;let J=s===-1?0:s,he=(l===-1?r.height:l)-J;return this._canvas.domNode.getContext("2d").putImageData(r,0,0,0,J,r.width,he),new vSt(e,r,$)}static _renderUntouchedLines(e,t,o,n,r,s){let l=[];if(!s){for(let G=0,$=n-o+1;G<$;G++)l[G]=!0;return[-1,-1,l]}let c=s._get(),u=c.imageData.data,p=c.rendLineNumberStart,h=c.lines,g=h.length,f=e.width,v=e.data,b=(n-o+1)*r*f*4,S=-1,y=-1,w=-1,k=-1,T=-1,P=-1,O=t*r;for(let G=o;G<=n;G++){let $=G-o,J=G-p,ae=J>=0&&J<g?h[J].dy:-1;if(ae===-1){l[$]=!0,O+=r;continue}let he=ae*f*4,oe=(ae+r)*f*4,de=O*f*4,Ce=(O+r)*f*4;k===he&&P===de?(k=oe,P=Ce):(w!==-1&&(v.set(u.subarray(w,k),T),S===-1&&w===0&&w===T&&(S=k),y===-1&&k===b&&w===T&&(y=w)),w=he,k=oe,T=de,P=Ce),l[$]=!1,O+=r}w!==-1&&(v.set(u.subarray(w,k),T),S===-1&&w===0&&w===T&&(S=k),y===-1&&k===b&&w===T&&(y=w));let V=S===-1?-1:S/(f*4),H=y===-1?-1:y/(f*4);return[V,H,l]}static _renderLine(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){let S=f.content,y=f.tokens,w=e.width-s,k=b===1,T=kV,P=0,O=0;for(let V=0,H=y.getCount();V<H;V++){let G=y.getEndOffset(V),$=y.getForeground(V),J=l.getColor($);for(;P<G;P++){if(T>w)return;let ae=S.charCodeAt(P);if(ae===9){let he=g-(P+O)%g;O+=he-1,T+=he*s}else if(ae===32)T+=s;else{let he=h_(ae)?2:1;for(let oe=0;oe<he;oe++)if(r===2?u.blockRenderChar(e,T,p+h,J,c,t,o,k):u.renderChar(e,T,p+h,ae,J,c,t,o,v,n,k),T+=s,T>w)return}}}}},ISt=class{constructor(i,e,t){this._startLineNumber=i,this._endLineNumber=e,this._defaultValue=t,this._values=[];for(let o=0,n=this._endLineNumber-this._startLineNumber+1;o<n;o++)this._values[o]=t}has(i){return this.get(i)!==this._defaultValue}set(i,e){i<this._startLineNumber||i>this._endLineNumber||(this._values[i-this._startLineNumber]=e)}get(i){return i<this._startLineNumber||i>this._endLineNumber?this._defaultValue:this._values[i-this._startLineNumber]}};var ySt=class extends Pu{constructor(i,e){super(i),this._viewDomNode=e;let o=this._context.configuration.options.get(165);this._widgets={},this._verticalScrollbarWidth=o.verticalScrollbarWidth,this._minimapWidth=o.minimap.minimapWidth,this._horizontalScrollbarHeight=o.horizontalScrollbarHeight,this._editorHeight=o.height,this._editorWidth=o.width,this._viewDomNodeRect={top:0,left:0,width:0,height:0},this._domNode=ur(document.createElement("div")),YS.write(this._domNode,4),this._domNode.setClassName("overlayWidgets"),this.overflowingOverlayWidgetsDomNode=ur(document.createElement("div")),YS.write(this.overflowingOverlayWidgetsDomNode,5),this.overflowingOverlayWidgetsDomNode.setClassName("overflowingOverlayWidgets")}dispose(){super.dispose(),this._widgets={}}getDomNode(){return this._domNode}onConfigurationChanged(i){let t=this._context.configuration.options.get(165);return this._verticalScrollbarWidth=t.verticalScrollbarWidth,this._minimapWidth=t.minimap.minimapWidth,this._horizontalScrollbarHeight=t.horizontalScrollbarHeight,this._editorHeight=t.height,this._editorWidth=t.width,!0}_widgetCanOverflow(i){let t=this._context.configuration.options.get(4);return(i.allowEditorOverflow||!1)&&t}addWidget(i){let e=ur(i.getDomNode());this._widgets[i.getId()]={widget:i,preference:null,domNode:e},e.setPosition("absolute"),e.setAttribute("widgetId",i.getId()),this._widgetCanOverflow(i)?this.overflowingOverlayWidgetsDomNode.appendChild(e):this._domNode.appendChild(e),this.setShouldRender(),this._updateMaxMinWidth()}setWidgetPosition(i,e){let t=this._widgets[i.getId()],o=e?e.preference:null,n=e?.stackOrdinal;return t.preference===o&&t.stack===n?(this._updateMaxMinWidth(),!1):(t.preference=o,t.stack=n,this.setShouldRender(),this._updateMaxMinWidth(),!0)}removeWidget(i){let e=i.getId();if(this._widgets.hasOwnProperty(e)){let o=this._widgets[e].domNode.domNode;delete this._widgets[e],o.remove(),this.setShouldRender(),this._updateMaxMinWidth()}}_updateMaxMinWidth(){let i=0,e=Object.keys(this._widgets);for(let t=0,o=e.length;t<o;t++){let n=e[t],s=this._widgets[n].widget.getMinContentWidthInPx?.();typeof s<"u"&&(i=Math.max(i,s))}this._context.viewLayout.setOverlayWidgetsMinWidth(i)}_renderWidget(i,e){let t=i.domNode;if(i.preference===null){t.setTop("");return}let o=2*this._verticalScrollbarWidth+this._minimapWidth;if(i.preference===0||i.preference===1){if(i.preference===1){let n=t.domNode.clientHeight;t.setTop(this._editorHeight-n-2*this._horizontalScrollbarHeight)}else t.setTop(0);i.stack!==void 0?(t.setTop(e[i.preference]),e[i.preference]+=t.domNode.clientWidth):t.setRight(o)}else if(i.preference===2)t.domNode.style.right="50%",i.stack!==void 0?(t.setTop(e[2]),e[2]+=t.domNode.clientHeight):t.setTop(0);else{let{top:n,left:r}=i.preference;if(this._context.configuration.options.get(51)&&this._widgetCanOverflow(i.widget)){let l=this._viewDomNodeRect;t.setTop(n+l.top),t.setLeft(r+l.left),t.setPosition("fixed")}else t.setTop(n),t.setLeft(r),t.setPosition("absolute")}}prepareRender(i){this._viewDomNodeRect=ir(this._viewDomNode.domNode)}render(i){this._domNode.setWidth(this._editorWidth);let e=Object.keys(this._widgets),t=Array.from({length:3},()=>0);e.sort((o,n)=>(this._widgets[o].stack||0)-(this._widgets[n].stack||0));for(let o=0,n=e.length;o<n;o++){let r=e[o];this._renderWidget(this._widgets[r],t)}}};var l5e=class{constructor(i,e,t,o){this._viewportBrand=void 0;this.top=i|0,this.left=e|0,this.width=t|0,this.height=o|0}},wSt=class{constructor(i,e){this.tabSize=i,this.data=e}},_le=class{constructor(i,e,t,o,n,r,s){this._viewLineDataBrand=void 0;this.content=i,this.continuesWithWrappedLine=e,this.minColumn=t,this.maxColumn=o,this.startVisibleColumn=n,this.tokens=r,this.inlineDecorations=s}},ez=class a{constructor(i,e,t,o,n,r,s,l,c,u,p,h){this.minColumn=i,this.maxColumn=e,this.content=t,this.continuesWithWrappedLine=o,this.isBasicASCII=a.isBasicASCII(t,r),this.containsRTL=a.containsRTL(t,this.isBasicASCII,n),this.tokens=s,this.inlineDecorations=l,this.tabSize=c,this.startVisibleColumn=u,this.textDirection=p,this.hasVariableFonts=h}static isBasicASCII(i,e){return e?g1(i):!0}static containsRTL(i,e,t){return!e&&t?uP(i):!1}};var Dle=class a{constructor(i,e,t){this.color=i;this.zIndex=e;this.data=t}static compareByRenderingProps(i,e){return i.zIndex===e.zIndex?i.color<e.color?-1:i.color>e.color?1:0:i.zIndex-e.zIndex}static equals(i,e){return i.color===e.color&&i.zIndex===e.zIndex&&$i(i.data,e.data)}static equalsArr(i,e){return $i(i,e,a.equals)}};var _ii=class{constructor(i,e){let t=i.options;this.lineHeight=t.get(75),this.pixelRatio=t.get(163),this.overviewRulerLanes=t.get(95),this.renderBorder=t.get(94);let o=e.getColor(Qbt);this.borderColor=o?o.toString():null,this.hideCursor=t.get(68);let n=e.getColor(B7);this.cursorColorSingle=n?n.transparent(.7).toString():null;let r=e.getColor(Gbt);this.cursorColorPrimary=r?r.transparent(.7).toString():null;let s=e.getColor(qbt);this.cursorColorSecondary=s?s.transparent(.7).toString():null,this.themeType=e.type;let l=t.get(81),c=l.enabled,u=l.side,p=e.getColor(D3i),h=ic.getDefaultBackground();p?this.backgroundColor=p:c&&u==="right"?this.backgroundColor=h:this.backgroundColor=null;let f=t.get(165).overviewRuler;this.top=f.top,this.right=f.right,this.domWidth=f.width,this.domHeight=f.height,this.overviewRulerLanes===0?(this.canvasWidth=0,this.canvasHeight=0):(this.canvasWidth=this.domWidth*this.pixelRatio|0,this.canvasHeight=this.domHeight*this.pixelRatio|0);let[v,b]=this._initLanes(1,this.canvasWidth,this.overviewRulerLanes);this.x=v,this.w=b}_initLanes(i,e,t){let o=e-i;if(t>=3){let n=Math.floor(o/3),r=Math.floor(o/3),s=o-n-r,l=i,c=l+n,u=l+n+s;return[[0,l,c,l,u,l,c,l],[0,n,s,n+s,r,n+s+r,s+r,n+s+r]]}else if(t===2){let n=Math.floor(o/2),r=o-n,s=i,l=s+n;return[[0,s,s,s,l,s,s,s],[0,n,n,n,r,n+r,n+r,n+r]]}else{let n=i,r=o;return[[0,n,n,n,n,n,n,n],[0,r,r,r,r,r,r,r]]}}equals(i){return this.lineHeight===i.lineHeight&&this.pixelRatio===i.pixelRatio&&this.overviewRulerLanes===i.overviewRulerLanes&&this.renderBorder===i.renderBorder&&this.borderColor===i.borderColor&&this.hideCursor===i.hideCursor&&this.cursorColorSingle===i.cursorColorSingle&&this.cursorColorPrimary===i.cursorColorPrimary&&this.cursorColorSecondary===i.cursorColorSecondary&&this.themeType===i.themeType&&We.equals(this.backgroundColor,i.backgroundColor)&&this.top===i.top&&this.right===i.right&&this.domWidth===i.domWidth&&this.domHeight===i.domHeight&&this.canvasWidth===i.canvasWidth&&this.canvasHeight===i.canvasHeight}};var CSt=class extends Pu{constructor(e){super(e);this._actualShouldRender=0;this._renderedDecorations=[];this._renderedCursorPositions=[];this._domNode=ur(document.createElement("canvas")),this._domNode.setClassName("decorationsOverviewRuler"),this._domNode.setPosition("absolute"),this._domNode.setLayerHinting(!0),this._domNode.setContain("strict"),this._domNode.setAttribute("aria-hidden","true"),this._updateSettings(!1),this._tokensColorTrackerListener=ic.onDidChange(t=>{t.changedColorMap&&this._updateSettings(!0)}),this._cursorPositions=[{position:new ye(1,1),color:this._settings.cursorColorSingle}]}dispose(){super.dispose(),this._tokensColorTrackerListener.dispose()}_updateSettings(e){let t=new _ii(this._context.configuration,this._context.theme);return this._settings&&this._settings.equals(t)?!1:(this._settings=t,this._domNode.setTop(this._settings.top),this._domNode.setRight(this._settings.right),this._domNode.setWidth(this._settings.domWidth),this._domNode.setHeight(this._settings.domHeight),this._domNode.domNode.width=this._settings.canvasWidth,this._domNode.domNode.height=this._settings.canvasHeight,e&&this._render(),!0)}_markRenderingIsNeeded(){return this._actualShouldRender=2,!0}_markRenderingIsMaybeNeeded(){return this._actualShouldRender=1,!0}onConfigurationChanged(e){return this._updateSettings(!1)?this._markRenderingIsNeeded():!1}onCursorStateChanged(e){this._cursorPositions=[];for(let t=0,o=e.selections.length;t<o;t++){let n=this._settings.cursorColorSingle;o>1&&(n=t===0?this._settings.cursorColorPrimary:this._settings.cursorColorSecondary),this._cursorPositions.push({position:e.selections[t].getPosition(),color:n})}return this._cursorPositions.sort((t,o)=>ye.compare(t.position,o.position)),this._markRenderingIsMaybeNeeded()}onDecorationsChanged(e){return e.affectsOverviewRuler?this._markRenderingIsMaybeNeeded():!1}onFlushed(e){return this._markRenderingIsNeeded()}onScrollChanged(e){return e.scrollHeightChanged?this._markRenderingIsNeeded():!1}onZonesChanged(e){return this._markRenderingIsNeeded()}onThemeChanged(e){return this._updateSettings(!1)?this._markRenderingIsNeeded():!1}getDomNode(){return this._domNode.domNode}prepareRender(e){}render(e){this._render(),this._actualShouldRender=0}_render(){let e=this._settings.backgroundColor;if(this._settings.overviewRulerLanes===0){this._domNode.setBackgroundColor(e?We.Format.CSS.formatHexA(e):""),this._domNode.setDisplay("none");return}let t=this._context.viewModel.getAllOverviewRulerDecorations(this._context.theme);if(t.sort(Dle.compareByRenderingProps),this._actualShouldRender===1&&!Dle.equalsArr(this._renderedDecorations,t)&&(this._actualShouldRender=2),this._actualShouldRender===1&&!$i(this._renderedCursorPositions,this._cursorPositions,(v,b)=>v.position.lineNumber===b.position.lineNumber&&v.color===b.color)&&(this._actualShouldRender=2),this._actualShouldRender===1)return;this._renderedDecorations=t,this._renderedCursorPositions=this._cursorPositions,this._domNode.setDisplay("block");let o=this._settings.canvasWidth,n=this._settings.canvasHeight,r=this._settings.lineHeight,s=this._context.viewLayout,l=this._context.viewLayout.getScrollHeight(),c=n/l,u=6*this._settings.pixelRatio|0,p=u/2|0,h=this._domNode.domNode.getContext("2d");e?e.isOpaque()?(h.fillStyle=We.Format.CSS.formatHexA(e),h.fillRect(0,0,o,n)):(h.clearRect(0,0,o,n),h.fillStyle=We.Format.CSS.formatHexA(e),h.fillRect(0,0,o,n)):h.clearRect(0,0,o,n);let g=this._settings.x,f=this._settings.w;for(let v of t){let b=v.color,S=v.data;h.fillStyle=b;let y=0,w=0,k=0;for(let T=0,P=S.length/3;T<P;T++){let O=S[3*T],V=S[3*T+1],H=S[3*T+2],G=s.getVerticalOffsetForLineNumber(V)*c|0,$=(s.getVerticalOffsetForLineNumber(H)+r)*c|0;if($-G<u){let ae=(G+$)/2|0;ae<p?ae=p:ae+p>n&&(ae=n-p),G=ae-p,$=ae+p}G>k+1||O!==y?(T!==0&&h.fillRect(g[y],w,f[y],k-w),y=O,w=G,k=$):$>k&&(k=$)}h.fillRect(g[y],w,f[y],k-w)}if(!this._settings.hideCursor){let v=2*this._settings.pixelRatio|0,b=v/2|0,S=this._settings.x[7],y=this._settings.w[7],w=-100,k=-100,T=null;for(let P=0,O=this._cursorPositions.length;P<O;P++){let V=this._cursorPositions[P].color;if(!V)continue;let H=this._cursorPositions[P].position,G=s.getVerticalOffsetForLineNumber(H.lineNumber)*c|0;G<b?G=b:G+b>n&&(G=n-b);let $=G-b,J=$+v;$>k+1||V!==T?(P!==0&&T&&h.fillRect(S,w,y,k-w),w=$,k=J):J>k&&(k=J),T=V,h.fillStyle=V}T&&h.fillRect(S,w,y,k-w)}this._settings.renderBorder&&this._settings.borderColor&&this._settings.overviewRulerLanes>0&&(h.beginPath(),h.lineWidth=1,h.strokeStyle=this._settings.borderColor,h.moveTo(0,0),h.lineTo(0,n),h.moveTo(1,0),h.lineTo(o,0),h.stroke())}};var xSt=class{constructor(i,e,t){this._colorZoneBrand=void 0;this.from=i|0,this.to=e|0,this.colorId=t|0}static compare(i,e){return i.colorId===e.colorId?i.from===e.from?i.to-e.to:i.from-e.from:i.colorId-e.colorId}},c5e=class{constructor(i,e,t,o){this._overviewRulerZoneBrand=void 0;this.startLineNumber=i,this.endLineNumber=e,this.heightInLines=t,this.color=o,this._colorZone=null}static compare(i,e){return i.color===e.color?i.startLineNumber===e.startLineNumber?i.heightInLines===e.heightInLines?i.endLineNumber-e.endLineNumber:i.heightInLines-e.heightInLines:i.startLineNumber-e.startLineNumber:i.color<e.color?-1:1}setColorZone(i){this._colorZone=i}getColorZones(){return this._colorZone}},kSt=class{constructor(i){this._getVerticalOffsetForLine=i,this._zones=[],this._colorZonesInvalid=!1,this._lineHeight=0,this._domWidth=0,this._domHeight=0,this._outerHeight=0,this._pixelRatio=1,this._lastAssignedId=0,this._color2Id=Object.create(null),this._id2Color=[]}getId2Color(){return this._id2Color}setZones(i){this._zones=i,this._zones.sort(c5e.compare)}setLineHeight(i){return this._lineHeight===i?!1:(this._lineHeight=i,this._colorZonesInvalid=!0,!0)}setPixelRatio(i){this._pixelRatio=i,this._colorZonesInvalid=!0}getDOMWidth(){return this._domWidth}getCanvasWidth(){return this._domWidth*this._pixelRatio}setDOMWidth(i){return this._domWidth===i?!1:(this._domWidth=i,this._colorZonesInvalid=!0,!0)}getDOMHeight(){return this._domHeight}getCanvasHeight(){return this._domHeight*this._pixelRatio}setDOMHeight(i){return this._domHeight===i?!1:(this._domHeight=i,this._colorZonesInvalid=!0,!0)}getOuterHeight(){return this._outerHeight}setOuterHeight(i){return this._outerHeight===i?!1:(this._outerHeight=i,this._colorZonesInvalid=!0,!0)}resolveColorZones(){let i=this._colorZonesInvalid,e=Math.floor(this._lineHeight),t=Math.floor(this.getCanvasHeight()),o=Math.floor(this._outerHeight),n=t/o,r=Math.floor(4*this._pixelRatio/2),s=[];for(let l=0,c=this._zones.length;l<c;l++){let u=this._zones[l];if(!i){let k=u.getColorZones();if(k){s.push(k);continue}}let p=this._getVerticalOffsetForLine(u.startLineNumber),h=u.heightInLines===0?this._getVerticalOffsetForLine(u.endLineNumber)+e:p+u.heightInLines*e,g=Math.floor(n*p),f=Math.floor(n*h),v=Math.floor((g+f)/2),b=f-v;b<r&&(b=r),v-b<0&&(v=b),v+b>t&&(v=t-b);let S=u.color,y=this._color2Id[S];y||(y=++this._lastAssignedId,this._color2Id[S]=y,this._id2Color[y]=S);let w=new xSt(v-b,v+b,y);u.setColorZone(w),s.push(w)}return this._colorZonesInvalid=!1,s.sort(xSt.compare),s}};var ESt=class extends wE{constructor(i,e){super(),this._context=i;let t=this._context.configuration.options;this._domNode=ur(document.createElement("canvas")),this._domNode.setClassName(e),this._domNode.setPosition("absolute"),this._domNode.setLayerHinting(!0),this._domNode.setContain("strict"),this._zoneManager=new kSt(o=>this._context.viewLayout.getVerticalOffsetForLineNumber(o)),this._zoneManager.setDOMWidth(0),this._zoneManager.setDOMHeight(0),this._zoneManager.setOuterHeight(this._context.viewLayout.getScrollHeight()),this._zoneManager.setLineHeight(t.get(75)),this._zoneManager.setPixelRatio(t.get(163)),this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),super.dispose()}onConfigurationChanged(i){let e=this._context.configuration.options;return i.hasChanged(75)&&(this._zoneManager.setLineHeight(e.get(75)),this._render()),i.hasChanged(163)&&(this._zoneManager.setPixelRatio(e.get(163)),this._domNode.setWidth(this._zoneManager.getDOMWidth()),this._domNode.setHeight(this._zoneManager.getDOMHeight()),this._domNode.domNode.width=this._zoneManager.getCanvasWidth(),this._domNode.domNode.height=this._zoneManager.getCanvasHeight(),this._render()),!0}onFlushed(i){return this._render(),!0}onScrollChanged(i){return i.scrollHeightChanged&&(this._zoneManager.setOuterHeight(i.scrollHeight),this._render()),!0}onZonesChanged(i){return this._render(),!0}getDomNode(){return this._domNode.domNode}setLayout(i){this._domNode.setTop(i.top),this._domNode.setRight(i.right);let e=!1;e=this._zoneManager.setDOMWidth(i.width)||e,e=this._zoneManager.setDOMHeight(i.height)||e,e&&(this._domNode.setWidth(this._zoneManager.getDOMWidth()),this._domNode.setHeight(this._zoneManager.getDOMHeight()),this._domNode.domNode.width=this._zoneManager.getCanvasWidth(),this._domNode.domNode.height=this._zoneManager.getCanvasHeight(),this._render())}setZones(i){this._zoneManager.setZones(i),this._render()}_render(){if(this._zoneManager.getOuterHeight()===0)return!1;let i=this._zoneManager.getCanvasWidth(),e=this._zoneManager.getCanvasHeight(),t=this._zoneManager.resolveColorZones(),o=this._zoneManager.getId2Color(),n=this._domNode.domNode.getContext("2d");return n.clearRect(0,0,i,e),t.length>0&&this._renderOneLane(n,t,o,i),!0}_renderOneLane(i,e,t,o){let n=0,r=0,s=0;for(let l of e){let c=l.colorId,u=l.from,p=l.to;c!==n?(n!==0&&i.fillRect(0,r,o,s-r),n=c,i.fillStyle=t[n],r=u,s=p):s>=u?s=Math.max(s,p):(i.fillRect(0,r,o,s-r),r=u,s=p)}i.fillRect(0,r,o,s-r)}};var TSt=class extends Pu{constructor(i){super(i),this.domNode=ur(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this.domNode.setClassName("view-rulers"),this._renderedRulers=[];let e=this._context.configuration.options;this._rulers=e.get(116),this._typicalHalfwidthCharacterWidth=e.get(59).typicalHalfwidthCharacterWidth}dispose(){super.dispose()}onConfigurationChanged(i){let e=this._context.configuration.options;return this._rulers=e.get(116),this._typicalHalfwidthCharacterWidth=e.get(59).typicalHalfwidthCharacterWidth,!0}onScrollChanged(i){return i.scrollHeightChanged}prepareRender(i){}_ensureRulersCount(){let i=this._renderedRulers.length,e=this._rulers.length;if(i===e)return;if(i<e){let o=e-i;for(;o>0;){let n=ur(document.createElement("div"));n.setClassName("view-ruler"),n.setWidth("1ch"),this.domNode.appendChild(n),this._renderedRulers.push(n),o--}return}let t=i-e;for(;t>0;){let o=this._renderedRulers.pop();this.domNode.removeChild(o),t--}}render(i){this._ensureRulersCount();for(let e=0,t=this._rulers.length;e<t;e++){let o=this._renderedRulers[e],n=this._rulers[e];o.setBoxShadow(n.color?`1px 0 0 0 ${n.color} inset`:""),o.setHeight(Math.min(i.scrollHeight,1e6)),o.setLeft(n.column*this._typicalHalfwidthCharacterWidth)}}};var _St=class extends Pu{constructor(i){super(i),this._scrollTop=0,this._width=0,this._updateWidth(),this._shouldShow=!1;let t=this._context.configuration.options.get(117);this._useShadows=t.useShadows,this._domNode=ur(document.createElement("div")),this._domNode.setAttribute("role","presentation"),this._domNode.setAttribute("aria-hidden","true")}dispose(){super.dispose()}_updateShouldShow(){let i=this._useShadows&&this._scrollTop>0;return this._shouldShow!==i?(this._shouldShow=i,!0):!1}getDomNode(){return this._domNode}_updateWidth(){let e=this._context.configuration.options.get(165);e.minimap.renderMinimap===0||e.minimap.minimapWidth>0&&e.minimap.minimapLeft===0?this._width=e.width:this._width=e.width-e.verticalScrollbarWidth}onConfigurationChanged(i){let t=this._context.configuration.options.get(117);return this._useShadows=t.useShadows,this._updateWidth(),this._updateShouldShow(),!0}onScrollChanged(i){return this._scrollTop=i.scrollTop,this._updateShouldShow()}prepareRender(i){}render(i){this._domNode.setWidth(this._width),this._domNode.setClassName(this._shouldShow?"scroll-decoration":"")}};var Dii=class{constructor(i){this.left=i.left,this.width=i.width,this.startStyle=null,this.endStyle=null}},Lii=class{constructor(i,e){this.lineNumber=i,this.ranges=e}};function vVo(a){return new Dii(a)}function bVo(a){return new Lii(a.lineNumber,a.ranges.map(vVo))}var LSt=class a extends EC{constructor(e){super();this._previousFrameVisibleRangesWithStyle=[];this._context=e;let t=this._context.configuration.options;this._roundedSelection=t.get(115),this._typicalHalfwidthCharacterWidth=t.get(59).typicalHalfwidthCharacterWidth,this._selections=[],this._renderResult=null,this._context.addEventHandler(this)}static{this.SELECTION_CLASS_NAME="selected-text"}static{this.SELECTION_TOP_LEFT="top-left-radius"}static{this.SELECTION_BOTTOM_LEFT="bottom-left-radius"}static{this.SELECTION_TOP_RIGHT="top-right-radius"}static{this.SELECTION_BOTTOM_RIGHT="bottom-right-radius"}static{this.EDITOR_BACKGROUND_CLASS_NAME="monaco-editor-background"}static{this.ROUNDED_PIECE_WIDTH=10}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(e){let t=this._context.configuration.options;return this._roundedSelection=t.get(115),this._typicalHalfwidthCharacterWidth=t.get(59).typicalHalfwidthCharacterWidth,!0}onCursorStateChanged(e){return this._selections=e.selections.slice(0),!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollTopChanged}onZonesChanged(e){return!0}_visibleRangesHaveGaps(e){for(let t=0,o=e.length;t<o;t++)if(e[t].ranges.length>1)return!0;return!1}_enrichVisibleRangesWithStyle(e,t,o){let n=this._typicalHalfwidthCharacterWidth/4,r=null,s=null;if(o&&o.length>0&&t.length>0){let l=t[0].lineNumber;if(l===e.startLineNumber)for(let u=0;!r&&u<o.length;u++)o[u].lineNumber===l&&(r=o[u].ranges[0]);let c=t[t.length-1].lineNumber;if(c===e.endLineNumber)for(let u=o.length-1;!s&&u>=0;u--)o[u].lineNumber===c&&(s=o[u].ranges[0]);r&&!r.startStyle&&(r=null),s&&!s.startStyle&&(s=null)}for(let l=0,c=t.length;l<c;l++){let u=t[l].ranges[0],p=u.left,h=u.left+u.width,g={top:0,bottom:0},f={top:0,bottom:0};if(l>0){let v=t[l-1].ranges[0].left,b=t[l-1].ranges[0].left+t[l-1].ranges[0].width;DSt(p-v)<n?g.top=2:p>v&&(g.top=1),DSt(h-b)<n?f.top=2:v<h&&h<b&&(f.top=1)}else r&&(g.top=r.startStyle.top,f.top=r.endStyle.top);if(l+1<c){let v=t[l+1].ranges[0].left,b=t[l+1].ranges[0].left+t[l+1].ranges[0].width;DSt(p-v)<n?g.bottom=2:v<p&&p<b&&(g.bottom=1),DSt(h-b)<n?f.bottom=2:h<b&&(f.bottom=1)}else s&&(g.bottom=s.startStyle.bottom,f.bottom=s.endStyle.bottom);u.startStyle=g,u.endStyle=f}}_getVisibleRangesWithStyle(e,t,o){let r=(t.linesVisibleRangesForRange(e,!0)||[]).map(bVo);return!this._visibleRangesHaveGaps(r)&&this._roundedSelection&&this._enrichVisibleRangesWithStyle(t.visibleRange,r,o),r}_createSelectionPiece(e,t,o,n,r){return'<div class="cslr '+o+'" style="top:'+e.toString()+"px;bottom:"+t.toString()+"px;left:"+n.toString()+"px;width:"+r.toString()+'px;"></div>'}_actualRenderOneSelection(e,t,o,n){if(n.length===0)return;let r=!!n[0].ranges[0].startStyle,s=n[0].lineNumber,l=n[n.length-1].lineNumber;for(let c=0,u=n.length;c<u;c++){let p=n[c],h=p.lineNumber,g=h-t,f=o&&h===s?1:0,v=o&&h!==s&&h===l?1:0,b="",S="";for(let y=0,w=p.ranges.length;y<w;y++){let k=p.ranges[y];if(r){let P=k.startStyle,O=k.endStyle;if(P.top===1||P.bottom===1){b+=this._createSelectionPiece(f,v,a.SELECTION_CLASS_NAME,k.left-a.ROUNDED_PIECE_WIDTH,a.ROUNDED_PIECE_WIDTH);let V=a.EDITOR_BACKGROUND_CLASS_NAME;P.top===1&&(V+=" "+a.SELECTION_TOP_RIGHT),P.bottom===1&&(V+=" "+a.SELECTION_BOTTOM_RIGHT),b+=this._createSelectionPiece(f,v,V,k.left-a.ROUNDED_PIECE_WIDTH,a.ROUNDED_PIECE_WIDTH)}if(O.top===1||O.bottom===1){b+=this._createSelectionPiece(f,v,a.SELECTION_CLASS_NAME,k.left+k.width,a.ROUNDED_PIECE_WIDTH);let V=a.EDITOR_BACKGROUND_CLASS_NAME;O.top===1&&(V+=" "+a.SELECTION_TOP_LEFT),O.bottom===1&&(V+=" "+a.SELECTION_BOTTOM_LEFT),b+=this._createSelectionPiece(f,v,V,k.left+k.width,a.ROUNDED_PIECE_WIDTH)}}let T=a.SELECTION_CLASS_NAME;if(r){let P=k.startStyle,O=k.endStyle;P.top===0&&(T+=" "+a.SELECTION_TOP_LEFT),P.bottom===0&&(T+=" "+a.SELECTION_BOTTOM_LEFT),O.top===0&&(T+=" "+a.SELECTION_TOP_RIGHT),O.bottom===0&&(T+=" "+a.SELECTION_BOTTOM_RIGHT)}S+=this._createSelectionPiece(f,v,T,k.left,k.width)}e[g][0]+=b,e[g][1]+=S}}prepareRender(e){let t=[],o=e.visibleRange.startLineNumber,n=e.visibleRange.endLineNumber;for(let s=o;s<=n;s++){let l=s-o;t[l]=["",""]}let r=[];for(let s=0,l=this._selections.length;s<l;s++){let c=this._selections[s];if(c.isEmpty()){r[s]=null;continue}let u=this._getVisibleRangesWithStyle(c,e,this._previousFrameVisibleRangesWithStyle[s]);r[s]=u,this._actualRenderOneSelection(t,o,this._selections.length>1,u)}this._previousFrameVisibleRangesWithStyle=r,this._renderResult=t.map(([s,l])=>s+l)}render(e,t){if(!this._renderResult)return"";let o=t-e;return o<0||o>=this._renderResult.length?"":this._renderResult[o]}};is((a,i)=>{let e=a.getColor(x5i);e&&!e.isTransparent()&&i.addRule(`.monaco-editor .view-line span.inline-selected-text { color: ${e}; }`)});function DSt(a){return a<0?-a:a}var RSt=class{constructor(i,e,t,o,n,r,s){this.top=i;this.left=e;this.paddingLeft=t;this.width=o;this.height=n;this.textContent=r;this.textContentClassName=s}};var d5e=class{constructor(i,e){this._context=i;let t=this._context.configuration.options,o=t.get(59);this._cursorStyle=t.get(161),this._typicalHalfwidthCharacterWidth=o.typicalHalfwidthCharacterWidth,this._lineCursorWidth=Math.min(t.get(37),this._typicalHalfwidthCharacterWidth),this._lineCursorHeight=t.get(38),this._isVisible=!0,this._domNode=ur(document.createElement("div")),this._domNode.setClassName(`cursor ${kE}`),this._domNode.setHeight(this._context.viewLayout.getLineHeightForLineNumber(1)),this._domNode.setTop(0),this._domNode.setLeft(0),Jd(this._domNode,o),this._domNode.setDisplay("none"),this._position=new ye(1,1),this._pluralityClass="",this.setPlurality(e),this._lastRenderedContent="",this._renderData=null}getDomNode(){return this._domNode}getPosition(){return this._position}setPlurality(i){switch(i){default:case 0:this._pluralityClass="";break;case 1:this._pluralityClass="cursor-primary";break;case 2:this._pluralityClass="cursor-secondary";break}}show(){this._isVisible||(this._domNode.setVisibility("inherit"),this._isVisible=!0)}hide(){this._isVisible&&(this._domNode.setVisibility("hidden"),this._isVisible=!1)}onConfigurationChanged(i){let e=this._context.configuration.options,t=e.get(59);return this._cursorStyle=e.get(161),this._typicalHalfwidthCharacterWidth=t.typicalHalfwidthCharacterWidth,this._lineCursorWidth=Math.min(e.get(37),this._typicalHalfwidthCharacterWidth),this._lineCursorHeight=e.get(38),Jd(this._domNode,t),!0}onCursorPositionChanged(i,e){return e?this._domNode.domNode.style.transitionProperty="none":this._domNode.domNode.style.transitionProperty="",this._position=i,!0}_getGraphemeAwarePosition(){let{lineNumber:i,column:e}=this._position,t=this._context.viewModel.getLineContent(i),[o,n]=zht(t,e-1);return[new ye(i,o+1),t.substring(o,n)]}_prepareRender(i){let e="",t="",[o,n]=this._getGraphemeAwarePosition(),r=this._context.viewLayout.getLineHeightForLineNumber(o.lineNumber),s=this._lineCursorHeight===0?r:Math.min(r,this._lineCursorHeight),l=(r-s)/2;if(this._cursorStyle===1||this._cursorStyle===4){let v=i.visibleRangeForPosition(o);if(!v||v.outsideRenderedLine)return null;let b=Re(this._domNode.domNode),S;this._cursorStyle===1?(S=NIe(b,this._lineCursorWidth>0?this._lineCursorWidth:2),S>2&&(e=n,t=this._getTokenClassName(o))):S=NIe(b,1);let y=v.left,w=0;S>=2&&y>=1&&(w=1,y-=w);let k=i.getVerticalOffsetForLineNumber(o.lineNumber)-i.bigNumbersDelta+l;return new RSt(k,y,w,S,s,e,t)}let c=i.linesVisibleRangesForRange(new z(o.lineNumber,o.column,o.lineNumber,o.column+n.length),!1);if(!c||c.length===0)return null;let u=c[0];if(u.outsideRenderedLine||u.ranges.length===0)return null;let p=u.ranges[0],h=n==="	"?this._typicalHalfwidthCharacterWidth:p.width<1?this._typicalHalfwidthCharacterWidth:p.width;this._cursorStyle===2&&(e=n,t=this._getTokenClassName(o));let g=i.getVerticalOffsetForLineNumber(o.lineNumber)-i.bigNumbersDelta,f=r;return(this._cursorStyle===3||this._cursorStyle===6)&&(g+=r-2,f=2),new RSt(g,p.left,0,h,f,e,t)}_getTokenClassName(i){let e=this._context.viewModel.getViewLineData(i.lineNumber),t=e.tokens.findTokenIndexAtOffset(i.column-1);return e.tokens.getClassName(t)}prepareRender(i){this._renderData=this._prepareRender(i)}render(i){return this._renderData?(this._lastRenderedContent!==this._renderData.textContent&&(this._lastRenderedContent=this._renderData.textContent,this._domNode.domNode.textContent=this._lastRenderedContent),this._domNode.setClassName(`cursor ${this._pluralityClass} ${kE} ${this._renderData.textContentClassName}`),this._domNode.setDisplay("block"),this._domNode.setTop(this._renderData.top),this._domNode.setLeft(this._renderData.left),this._domNode.setPaddingLeft(this._renderData.paddingLeft),this._domNode.setWidth(this._renderData.width),this._domNode.setLineHeight(this._renderData.height),this._domNode.setHeight(this._renderData.height),{domNode:this._domNode.domNode,position:this._position,contentLeft:this._renderData.left,height:this._renderData.height,width:2}):(this._domNode.setDisplay("none"),null)}};var MSt=class a extends Pu{static{this.BLINK_INTERVAL=500}constructor(i){super(i);let e=this._context.configuration.options;this._readOnly=e.get(104),this._cursorBlinking=e.get(32),this._cursorStyle=e.get(161),this._cursorSmoothCaretAnimation=e.get(33),this._editContextEnabled=e.get(170),this._selectionIsEmpty=!0,this._isComposingInput=!1,this._isVisible=!1,this._primaryCursor=new d5e(this._context,0),this._secondaryCursors=[],this._renderData=[],this._domNode=ur(document.createElement("div")),this._domNode.setAttribute("role","presentation"),this._domNode.setAttribute("aria-hidden","true"),this._updateDomClassName(),this._domNode.appendChild(this._primaryCursor.getDomNode()),this._startCursorBlinkAnimation=new Ul,this._cursorFlatBlinkInterval=new FL,this._blinkingEnabled=!1,this._editorHasFocus=!1,this._updateBlinking()}dispose(){super.dispose(),this._startCursorBlinkAnimation.dispose(),this._cursorFlatBlinkInterval.dispose()}getDomNode(){return this._domNode}onCompositionStart(i){return this._isComposingInput=!0,this._updateBlinking(),!0}onCompositionEnd(i){return this._isComposingInput=!1,this._updateBlinking(),!0}onConfigurationChanged(i){let e=this._context.configuration.options;this._readOnly=e.get(104),this._cursorBlinking=e.get(32),this._cursorStyle=e.get(161),this._cursorSmoothCaretAnimation=e.get(33),this._editContextEnabled=e.get(170),this._updateBlinking(),this._updateDomClassName(),this._primaryCursor.onConfigurationChanged(i);for(let t=0,o=this._secondaryCursors.length;t<o;t++)this._secondaryCursors[t].onConfigurationChanged(i);return!0}_onCursorPositionChanged(i,e,t){let o=this._secondaryCursors.length!==e.length||this._cursorSmoothCaretAnimation==="explicit"&&t!==3;if(this._primaryCursor.setPlurality(e.length?1:0),this._primaryCursor.onCursorPositionChanged(i,o),this._updateBlinking(),this._secondaryCursors.length<e.length){let n=e.length-this._secondaryCursors.length;for(let r=0;r<n;r++){let s=new d5e(this._context,2);this._domNode.domNode.insertBefore(s.getDomNode().domNode,this._primaryCursor.getDomNode().domNode.nextSibling),this._secondaryCursors.push(s)}}else if(this._secondaryCursors.length>e.length){let n=this._secondaryCursors.length-e.length;for(let r=0;r<n;r++)this._domNode.removeChild(this._secondaryCursors[0].getDomNode()),this._secondaryCursors.splice(0,1)}for(let n=0;n<e.length;n++)this._secondaryCursors[n].onCursorPositionChanged(e[n],o)}onCursorStateChanged(i){let e=[];for(let o=0,n=i.selections.length;o<n;o++)e[o]=i.selections[o].getPosition();this._onCursorPositionChanged(e[0],e.slice(1),i.reason);let t=i.selections[0].isEmpty();return this._selectionIsEmpty!==t&&(this._selectionIsEmpty=t,this._updateDomClassName()),!0}onDecorationsChanged(i){return!0}onFlushed(i){return!0}onFocusChanged(i){return this._editorHasFocus=i.isFocused,this._updateBlinking(),!1}onLinesChanged(i){return!0}onLinesDeleted(i){return!0}onLinesInserted(i){return!0}onScrollChanged(i){return!0}onTokensChanged(i){let e=t=>{for(let o=0,n=i.ranges.length;o<n;o++)if(i.ranges[o].fromLineNumber<=t.lineNumber&&t.lineNumber<=i.ranges[o].toLineNumber)return!0;return!1};if(e(this._primaryCursor.getPosition()))return!0;for(let t of this._secondaryCursors)if(e(t.getPosition()))return!0;return!1}onZonesChanged(i){return!0}_getCursorBlinking(){return this._isComposingInput&&!this._editContextEnabled?0:this._editorHasFocus?this._readOnly?5:this._cursorBlinking:0}_updateBlinking(){this._startCursorBlinkAnimation.cancel(),this._cursorFlatBlinkInterval.cancel();let i=this._getCursorBlinking(),e=i===0,t=i===5;e?this._hide():this._show(),this._blinkingEnabled=!1,this._updateDomClassName(),!e&&!t&&(i===1?this._cursorFlatBlinkInterval.cancelAndSet(()=>{this._isVisible?this._hide():this._show()},a.BLINK_INTERVAL,Re(this._domNode.domNode)):this._startCursorBlinkAnimation.setIfNotSet(()=>{this._blinkingEnabled=!0,this._updateDomClassName()},a.BLINK_INTERVAL))}_updateDomClassName(){this._domNode.setClassName(this._getClassName())}_getClassName(){let i="cursors-layer";switch(this._selectionIsEmpty||(i+=" has-selection"),this._cursorStyle){case 1:i+=" cursor-line-style";break;case 2:i+=" cursor-block-style";break;case 3:i+=" cursor-underline-style";break;case 4:i+=" cursor-line-thin-style";break;case 5:i+=" cursor-block-outline-style";break;case 6:i+=" cursor-underline-thin-style";break;default:i+=" cursor-line-style"}if(this._blinkingEnabled)switch(this._getCursorBlinking()){case 1:i+=" cursor-blink";break;case 2:i+=" cursor-smooth";break;case 3:i+=" cursor-phase";break;case 4:i+=" cursor-expand";break;case 5:i+=" cursor-solid";break;default:i+=" cursor-solid"}else i+=" cursor-solid";return(this._cursorSmoothCaretAnimation==="on"||this._cursorSmoothCaretAnimation==="explicit")&&(i+=" cursor-smooth-caret-animation"),i}_show(){this._primaryCursor.show();for(let i=0,e=this._secondaryCursors.length;i<e;i++)this._secondaryCursors[i].show();this._isVisible=!0}_hide(){this._primaryCursor.hide();for(let i=0,e=this._secondaryCursors.length;i<e;i++)this._secondaryCursors[i].hide();this._isVisible=!1}prepareRender(i){this._primaryCursor.prepareRender(i);for(let e=0,t=this._secondaryCursors.length;e<t;e++)this._secondaryCursors[e].prepareRender(i)}render(i){let e=[],t=0,o=this._primaryCursor.render(i);o&&(e[t++]=o);for(let n=0,r=this._secondaryCursors.length;n<r;n++){let s=this._secondaryCursors[n].render(i);s&&(e[t++]=s)}this._renderData=e}getLastRenderData(){return this._renderData}};is((a,i)=>{let e=[{class:".cursor",foreground:B7,background:Kbt},{class:".cursor-primary",foreground:Gbt,background:m3i},{class:".cursor-secondary",foreground:qbt,background:h3i}];for(let t of e){let o=a.getColor(t.foreground);if(o){let n=a.getColor(t.background);n||(n=o.opposite()),i.addRule(`.monaco-editor .cursors-layer ${t.class} { background-color: ${o}; border-color: ${o}; color: ${n}; }`),uf(a.type)&&i.addRule(`.monaco-editor .cursors-layer.has-selection ${t.class} { border-left: 1px solid ${n}; border-right: 1px solid ${n}; }`)}}});var Mii=()=>{throw new Error("Invalid change accessor")},PSt=class extends Pu{constructor(i){super(i);let e=this._context.configuration.options,t=e.get(165);this._lineHeight=e.get(75),this._contentWidth=t.contentWidth,this._contentLeft=t.contentLeft,this.domNode=ur(document.createElement("div")),this.domNode.setClassName("view-zones"),this.domNode.setPosition("absolute"),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this.marginDomNode=ur(document.createElement("div")),this.marginDomNode.setClassName("margin-view-zones"),this.marginDomNode.setPosition("absolute"),this.marginDomNode.setAttribute("role","presentation"),this.marginDomNode.setAttribute("aria-hidden","true"),this._zones={}}dispose(){super.dispose(),this._zones={}}_recomputeWhitespacesProps(){let i=this._context.viewLayout.getWhitespaces(),e=new Map;for(let o of i)e.set(o.id,o);let t=!1;return this._context.viewModel.changeWhitespace(o=>{let n=Object.keys(this._zones);for(let r=0,s=n.length;r<s;r++){let l=n[r],c=this._zones[l],u=this._computeWhitespaceProps(c.delegate);c.isInHiddenArea=u.isInHiddenArea;let p=e.get(l);p&&(p.afterLineNumber!==u.afterViewLineNumber||p.height!==u.heightInPx)&&(o.changeOneWhitespace(l,u.afterViewLineNumber,u.heightInPx),this._safeCallOnComputedHeight(c.delegate,u.heightInPx),t=!0)}}),t}onConfigurationChanged(i){let e=this._context.configuration.options,t=e.get(165);return this._lineHeight=e.get(75),this._contentWidth=t.contentWidth,this._contentLeft=t.contentLeft,i.hasChanged(75)&&this._recomputeWhitespacesProps(),!0}onLineMappingChanged(i){return this._recomputeWhitespacesProps()}onLinesDeleted(i){return!0}onScrollChanged(i){return i.scrollTopChanged||i.scrollWidthChanged}onZonesChanged(i){return!0}onLinesInserted(i){return!0}_getZoneOrdinal(i){return i.ordinal??i.afterColumn??1e4}_computeWhitespaceProps(i){if(i.afterLineNumber===0)return{isInHiddenArea:!1,afterViewLineNumber:0,heightInPx:this._heightInPixels(i),minWidthInPx:this._minWidthInPixels(i)};let e;if(typeof i.afterColumn<"u")e=this._context.viewModel.model.validatePosition({lineNumber:i.afterLineNumber,column:i.afterColumn});else{let r=this._context.viewModel.model.validatePosition({lineNumber:i.afterLineNumber,column:1}).lineNumber;e=new ye(r,this._context.viewModel.model.getLineMaxColumn(r))}let t;e.column===this._context.viewModel.model.getLineMaxColumn(e.lineNumber)?t=this._context.viewModel.model.validatePosition({lineNumber:e.lineNumber+1,column:1}):t=this._context.viewModel.model.validatePosition({lineNumber:e.lineNumber,column:e.column+1});let o=this._context.viewModel.coordinatesConverter.convertModelPositionToViewPosition(e,i.afterColumnAffinity,!0),n=i.showInHiddenAreas||this._context.viewModel.coordinatesConverter.modelPositionIsVisible(t);return{isInHiddenArea:!n,afterViewLineNumber:o.lineNumber,heightInPx:n?this._heightInPixels(i):0,minWidthInPx:this._minWidthInPixels(i)}}changeViewZones(i){let e=!1;return this._context.viewModel.changeWhitespace(t=>{let o={addZone:n=>(e=!0,this._addZone(t,n)),removeZone:n=>{n&&(e=this._removeZone(t,n)||e)},layoutZone:n=>{n&&(e=this._layoutZone(t,n)||e)}};IVo(i,o),o.addZone=Mii,o.removeZone=Mii,o.layoutZone=Mii}),e}_addZone(i,e){let t=this._computeWhitespaceProps(e),n={whitespaceId:i.insertWhitespace(t.afterViewLineNumber,this._getZoneOrdinal(e),t.heightInPx,t.minWidthInPx),delegate:e,isInHiddenArea:t.isInHiddenArea,isVisible:!1,domNode:ur(e.domNode),marginDomNode:e.marginDomNode?ur(e.marginDomNode):null};return this._safeCallOnComputedHeight(n.delegate,t.heightInPx),n.domNode.setPosition("absolute"),n.domNode.domNode.style.width="100%",n.domNode.setDisplay("none"),n.domNode.setAttribute("monaco-view-zone",n.whitespaceId),this.domNode.appendChild(n.domNode),n.marginDomNode&&(n.marginDomNode.setPosition("absolute"),n.marginDomNode.domNode.style.width="100%",n.marginDomNode.setDisplay("none"),n.marginDomNode.setAttribute("monaco-view-zone",n.whitespaceId),this.marginDomNode.appendChild(n.marginDomNode)),this._zones[n.whitespaceId]=n,this.setShouldRender(),n.whitespaceId}_removeZone(i,e){if(this._zones.hasOwnProperty(e)){let t=this._zones[e];return delete this._zones[e],i.removeWhitespace(t.whitespaceId),t.domNode.removeAttribute("monaco-visible-view-zone"),t.domNode.removeAttribute("monaco-view-zone"),t.domNode.domNode.remove(),t.marginDomNode&&(t.marginDomNode.removeAttribute("monaco-visible-view-zone"),t.marginDomNode.removeAttribute("monaco-view-zone"),t.marginDomNode.domNode.remove()),this.setShouldRender(),!0}return!1}_layoutZone(i,e){if(this._zones.hasOwnProperty(e)){let t=this._zones[e],o=this._computeWhitespaceProps(t.delegate);return t.isInHiddenArea=o.isInHiddenArea,i.changeOneWhitespace(t.whitespaceId,o.afterViewLineNumber,o.heightInPx),this._safeCallOnComputedHeight(t.delegate,o.heightInPx),this.setShouldRender(),!0}return!1}shouldSuppressMouseDownOnViewZone(i){return this._zones.hasOwnProperty(i)?!!this._zones[i].delegate.suppressMouseDown:!1}_heightInPixels(i){return typeof i.heightInPx=="number"?i.heightInPx:typeof i.heightInLines=="number"?this._lineHeight*i.heightInLines:this._lineHeight}_minWidthInPixels(i){return typeof i.minWidthInPx=="number"?i.minWidthInPx:0}_safeCallOnComputedHeight(i,e){if(typeof i.onComputedHeight=="function")try{i.onComputedHeight(e)}catch(t){mt(t)}}_safeCallOnDomNodeTop(i,e){if(typeof i.onDomNodeTop=="function")try{i.onDomNodeTop(e)}catch(t){mt(t)}}prepareRender(i){}render(i){let e=i.viewportData.whitespaceViewportData,t={},o=!1;for(let r of e)this._zones[r.id].isInHiddenArea||(t[r.id]=r,o=!0);let n=Object.keys(this._zones);for(let r=0,s=n.length;r<s;r++){let l=n[r],c=this._zones[l],u=0,p=0,h="none";t.hasOwnProperty(l)?(u=t[l].verticalOffset-i.bigNumbersDelta,p=t[l].height,h="block",c.isVisible||(c.domNode.setAttribute("monaco-visible-view-zone","true"),c.isVisible=!0),this._safeCallOnDomNodeTop(c.delegate,i.getScrolledTopFromAbsoluteTop(t[l].verticalOffset))):(c.isVisible&&(c.domNode.removeAttribute("monaco-visible-view-zone"),c.isVisible=!1),this._safeCallOnDomNodeTop(c.delegate,i.getScrolledTopFromAbsoluteTop(-1e6))),c.domNode.setTop(u),c.domNode.setHeight(p),c.domNode.setDisplay(h),c.marginDomNode&&(c.marginDomNode.setTop(u),c.marginDomNode.setHeight(p),c.marginDomNode.setDisplay(h))}o&&(this.domNode.setWidth(Math.max(i.scrollWidth,this._contentWidth)),this.marginDomNode.setWidth(this._contentLeft))}};function IVo(a,i){try{return a(i)}catch(e){mt(e);return}}var ASt=class extends EC{constructor(i){super(),this._context=i,this._options=new NSt(this._context.configuration),this._selection=[],this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(i){let e=new NSt(this._context.configuration);return this._options.equals(e)?i.hasChanged(165):(this._options=e,!0)}onCursorStateChanged(i){return this._selection=i.selections,this._options.renderWhitespace==="selection"}onDecorationsChanged(i){return!0}onFlushed(i){return!0}onLinesChanged(i){return!0}onLinesDeleted(i){return!0}onLinesInserted(i){return!0}onScrollChanged(i){return i.scrollTopChanged}onZonesChanged(i){return!0}prepareRender(i){if(this._options.renderWhitespace==="none"){this._renderResult=null;return}this._renderResult=[];for(let e=i.viewportData.startLineNumber;e<=i.viewportData.endLineNumber;e++){let t=e-i.viewportData.startLineNumber,o=this._context.viewModel.getViewLineRenderingData(e),n=null;if(this._options.renderWhitespace==="selection"){let r=this._selection;for(let s of r){if(s.endLineNumber<e||s.startLineNumber>e)continue;let l=s.startLineNumber===e?s.startColumn:o.minColumn,c=s.endLineNumber===e?s.endColumn:o.maxColumn;l<c&&(n||(n=[]),n.push(new pi(l-1,c-1)))}}this._renderResult[t]=this._applyRenderWhitespace(i,e,n,o)}}_applyRenderWhitespace(i,e,t,o){if(this._options.renderWhitespace==="selection"&&!t||this._options.renderWhitespace==="trailing"&&o.continuesWithWrappedLine)return"";let n=this._context.theme.getColor(Swe),r=this._options.renderWithSVG,s=o.content,l=this._options.stopRenderingLineAfter===-1?s.length:Math.min(this._options.stopRenderingLineAfter,s.length),c=o.continuesWithWrappedLine,u=o.minColumn-1,p=this._options.renderWhitespace==="boundary",h=this._options.renderWhitespace==="trailing",g=i.getLineHeightForLineNumber(e),f=this._options.middotWidth,v=this._options.wsmiddotWidth,b=this._options.spaceWidth,S=Math.abs(v-b),y=Math.abs(f-b),w=S<y?11825:183,k=this._options.canUseHalfwidthRightwardsArrow,T="",P=!1,O=nm(s),V;O===-1?(P=!0,O=l,V=l):V=hv(s);let H=0,G=t&&t[H],$=0;for(let J=u;J<l;J++){let ae=s.charCodeAt(J);if(G&&G.endExclusive<=J&&(H++,G=t&&t[H]),ae!==9&&ae!==32||h&&!P&&J<=V)continue;if(p&&J>=O&&J<=V&&ae===32){let oe=J-1>=0?s.charCodeAt(J-1):0,de=J+1<l?s.charCodeAt(J+1):0;if(oe!==32&&de!==32)continue}if(p&&c&&J===l-1){let oe=J-1>=0?s.charCodeAt(J-1):0;if(ae===32&&oe!==32&&oe!==9)continue}if(t&&!(G&&G.start<=J&&J<G.endExclusive))continue;let he=i.visibleRangeForPosition(new ye(e,J+1));he&&(r?($=Math.max($,he.left),ae===9?T+=this._renderArrow(g,b,he.left):T+=`<circle cx="${(he.left+b/2).toFixed(2)}" cy="${(g/2).toFixed(2)}" r="${(b/7).toFixed(2)}" />`):ae===9?T+=`<div class="mwh" style="left:${he.left}px;height:${g}px;">${k?"\uFFEB":"\u2192"}</div>`:T+=`<div class="mwh" style="left:${he.left}px;height:${g}px;">${String.fromCharCode(w)}</div>`)}return r?($=Math.round($+b),`<svg style="bottom:0;position:absolute;width:${$}px;height:${g}px" viewBox="0 0 ${$} ${g}" xmlns="http://www.w3.org/2000/svg" fill="${n}">`+T+"</svg>"):T}_renderArrow(i,e,t){let o=e/7,n=e,r=i/2,s=t,l={x:0,y:o/2},c={x:100/125*n,y:l.y},u={x:c.x-.2*c.x,y:c.y+.2*c.x},p={x:u.x+.1*c.x,y:u.y+.1*c.x},h={x:p.x+.35*c.x,y:p.y-.35*c.x},g={x:h.x,y:-h.y},f={x:p.x,y:-p.y},v={x:u.x,y:-u.y},b={x:c.x,y:-c.y},S={x:l.x,y:-l.y};return`<path d="M ${[l,c,u,p,h,g,f,v,b,S].map(k=>`${(s+k.x).toFixed(2)} ${(r+k.y).toFixed(2)}`).join(" L ")}" />`}render(i,e){if(!this._renderResult)return"";let t=e-i;return t<0||t>=this._renderResult.length?"":this._renderResult[t]}},NSt=class{constructor(i){let e=i.options,t=e.get(59),o=e.get(47);o==="off"?(this.renderWhitespace="none",this.renderWithSVG=!1):o==="svg"?(this.renderWhitespace=e.get(113),this.renderWithSVG=!0):(this.renderWhitespace=e.get(113),this.renderWithSVG=!1),this.spaceWidth=t.spaceWidth,this.middotWidth=t.middotWidth,this.wsmiddotWidth=t.wsmiddotWidth,this.canUseHalfwidthRightwardsArrow=t.canUseHalfwidthRightwardsArrow,this.lineHeight=e.get(75),this.stopRenderingLineAfter=e.get(133)}equals(i){return this.renderWhitespace===i.renderWhitespace&&this.renderWithSVG===i.renderWithSVG&&this.spaceWidth===i.spaceWidth&&this.middotWidth===i.middotWidth&&this.wsmiddotWidth===i.wsmiddotWidth&&this.canUseHalfwidthRightwardsArrow===i.canUseHalfwidthRightwardsArrow&&this.lineHeight===i.lineHeight&&this.stopRenderingLineAfter===i.stopRenderingLineAfter}};var OSt=class{constructor(i,e,t,o){this.selections=i,this.startLineNumber=e.startLineNumber|0,this.endLineNumber=e.endLineNumber|0,this.relativeVerticalOffset=e.relativeVerticalOffset,this.bigNumbersDelta=e.bigNumbersDelta|0,this.lineHeight=e.lineHeight|0,this.whitespaceViewportData=t,this._model=o,this.visibleRange=new z(e.startLineNumber,this._model.getLineMinColumn(e.startLineNumber),e.endLineNumber,this._model.getLineMaxColumn(e.endLineNumber))}getViewLineRenderingData(i){return this._model.getViewportViewLineRenderingData(this.visibleRange,i)}getDecorationsInViewport(){return this._model.getDecorationsInViewport(this.visibleRange)}};var FSt=class{get type(){return this._theme.type}get value(){return this._theme}constructor(i){this._theme=i}update(i){this._theme=i}getColor(i){return this._theme.getColor(i)}};var WSt=class{constructor(i,e,t){this.configuration=i,this.theme=new FSt(e),this.viewModel=t,this.viewLayout=t.viewLayout}addEventHandler(i){this.viewModel.addViewEventHandler(i)}removeEventHandler(i){this.viewModel.removeViewEventHandler(i)}};var FV=new Float32Array([1,0,1,1,0,1,0,0,0,1,1,0]);function OO(a){if(!a)throw new Error(`Value "${a}" cannot be null`);return a}function VSt(a,i,e){let t=new i.ResizeObserver(o=>{let n=o.find(l=>l.target===a);if(!n)return;if(!("devicePixelContentBoxSize"in n)){t?.disconnect(),t=void 0;return}let r=n.devicePixelContentBoxSize[0].inlineSize,s=n.devicePixelContentBoxSize[0].blockSize;r>0&&s>0&&e(r,s)});try{t.observe(a,{box:["device-pixel-content-box"]})}catch{throw t.disconnect(),t=void 0,new li("Could not observe device pixel dimensions")}return Z(()=>t?.disconnect())}var yVo=0,tz=class extends x{constructor(e,t,o,n){super();this.fontSize=e;this.fontFamily=t;this.devicePixelRatio=o;this._decorationStyleCache=n;this.id=yVo++;this._workGlyph={source:null,boundingBox:{left:0,bottom:0,right:0,top:0},originOffset:{x:0,y:0},fontBoundingBoxAscent:0,fontBoundingBoxDescent:0};this._workGlyphConfig={chars:void 0,tokenMetadata:0,decorationStyleSetId:0};this._antiAliasing=Ze?"greyscale":"subpixel";let r=Math.ceil(this.fontSize*o);this._canvas=new OffscreenCanvas(r*3,r*3),this._ctx=OO(this._canvas.getContext("2d",{willReadFrequently:!0,alpha:this._antiAliasing==="greyscale"})),this._ctx.textBaseline="top",this._ctx.fillStyle="#FFFFFF",this._ctx.font=`${r}px ${this.fontFamily}`,this._textMetrics=this._ctx.measureText("A")}get cacheKey(){return`${this.fontFamily}_${this.fontSize}px`}rasterizeGlyph(e,t,o,n){return e===""?{source:this._canvas,boundingBox:{top:0,left:0,bottom:-1,right:-1},originOffset:{x:0,y:0},fontBoundingBoxAscent:0,fontBoundingBoxDescent:0}:this._workGlyphConfig.chars===e&&this._workGlyphConfig.tokenMetadata===t&&this._workGlyphConfig.decorationStyleSetId===o?this._workGlyph:(this._workGlyphConfig.chars=e,this._workGlyphConfig.tokenMetadata=t,this._workGlyphConfig.decorationStyleSetId=o,this._rasterizeGlyph(e,t,o,n))}_rasterizeGlyph(e,t,o,n){let r=Math.ceil(this.fontSize*this.devicePixelRatio),s=r*3;this._canvas.width!==s&&(this._canvas.width=s,this._canvas.height=s),this._ctx.save();let l=(t&15)/10,c=bp.getBackground(t),u=n[c]??n[2],p=this._decorationStyleCache.getStyleSet(o);this._antiAliasing==="subpixel"?(this._ctx.fillStyle=u,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height)):this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height);let h=new $S(200),g=bp.getFontStyle(t);g&1&&h.appendString("italic "),p?.bold!==void 0?p.bold&&h.appendString("bold "):g&2&&h.appendString("bold "),h.appendString(`${r}px ${this.fontFamily}`),this._ctx.font=h.build();let f=r,v=r;if(p?.color!==void 0?this._ctx.fillStyle=`#${p.color.toString(16).padStart(8,"0")}`:this._ctx.fillStyle=n[bp.getForeground(t)],p?.opacity!==void 0&&(this._ctx.globalAlpha=p.opacity),this._ctx.textBaseline="top",this._ctx.fillText(e,f+l,v),p?.strikethrough){let S=Math.round(v-this._textMetrics.alphabeticBaseline*.65),y=p?.strikethroughThickness!==void 0?Math.round(p.strikethroughThickness*this.devicePixelRatio):Math.max(1,Math.floor(r/10));p?.strikethroughColor!==void 0&&(this._ctx.fillStyle=`#${p.strikethroughColor.toString(16).padStart(8,"0")}`),this._ctx.fillRect(f,S-Math.floor(y/2),Math.ceil(this._textMetrics.width),y)}this._ctx.restore();let b=this._ctx.getImageData(0,0,this._canvas.width,this._canvas.height);if(this._antiAliasing==="subpixel"){let S=parseInt(u.substring(1,3),16),y=parseInt(u.substring(3,5),16),w=parseInt(u.substring(5,7),16);this._clearColor(b,S,y,w),this._ctx.putImageData(b,0,0)}return this._findGlyphBoundingBox(b,this._workGlyph.boundingBox),this._workGlyph.source=this._canvas,this._workGlyph.originOffset.x=this._workGlyph.boundingBox.left-f,this._workGlyph.originOffset.y=this._workGlyph.boundingBox.top-v,this._workGlyph.fontBoundingBoxAscent=this._textMetrics.fontBoundingBoxAscent,this._workGlyph.fontBoundingBoxDescent=this._textMetrics.fontBoundingBoxDescent,this._workGlyph}_clearColor(e,t,o,n){for(let r=0;r<e.data.length;r+=4)e.data[r]===t&&e.data[r+1]===o&&e.data[r+2]===n&&(e.data[r+3]=0)}_findGlyphBoundingBox(e,t){let o=this._canvas.height,n=this._canvas.width,r=!1;for(let s=0;s<o;s++){for(let l=0;l<n;l++){let c=s*n*4+l*4+3;if(e.data[c]!==0){t.top=s,r=!0;break}}if(r)break}t.left=0,r=!1;for(let s=0;s<n;s++){for(let l=0;l<o;l++){let c=l*n*4+s*4+3;if(e.data[c]!==0){t.left=s,r=!0;break}}if(r)break}t.right=n,r=!1;for(let s=n-1;s>=t.left;s--){for(let l=0;l<o;l++){let c=l*n*4+s*4+3;if(e.data[c]!==0){t.right=s,r=!0;break}}if(r)break}t.bottom=t.top,r=!1;for(let s=o-1;s>=0;s--){for(let l=0;l<n;l++){let c=s*n*4+l*4+3;if(e.data[c]!==0){t.bottom=s,r=!0;break}}if(r)break}}getTextMetrics(e){return this._ctx.measureText(e)}};I([hi],tz.prototype,"cacheKey",1);var Lwe=class extends x{constructor(e){super();this._logService=e;this._tasks=[];this._i=0;this._register(Z(()=>this.clear()))}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,o=0,n=e.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(t=Date.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,Date.now()-t),o=Math.max(t,o),r=e.timeRemaining(),o*1.5>r){n-t<-20&&this._logService.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(n-t))}ms`),this._start();return}n=r}this.clear()}};Lwe=I([m(0,se)],Lwe);var Pii=class extends Lwe{_requestCallback(i){return Ki().setTimeout(()=>i(this._createDeadline(16)))}_cancelCallback(i){Ki().clearTimeout(i)}_createDeadline(i){let e=Date.now()+i;return{timeRemaining:()=>Math.max(0,e-Date.now())}}},Aii=class extends Lwe{_requestCallback(i){return Ki().requestIdleCallback(i)}_cancelCallback(i){Ki().cancelIdleCallback(i)}},Nii="requestIdleCallback"in Ki()?Aii:Pii,BSt=class{constructor(i){this._queue=i.createInstance(Nii)}set(i){this._queue.clear(),this._queue.enqueue(i)}flush(){this._queue.flush()}};BSt=I([m(0,F)],BSt);var HSt=class{constructor(i,e){this._canvas=i;this._textureIndex=e;this._currentRow={x:0,y:0,h:0};this._allocatedGlyphs=new Set;this._nextIndex=0;this._ctx=OO(this._canvas.getContext("2d",{willReadFrequently:!0}))}allocate(i){let e=i.boundingBox.right-i.boundingBox.left+1,t=i.boundingBox.bottom-i.boundingBox.top+1;if(e>this._canvas.width||t>this._canvas.height)throw new li("Glyph is too large for the atlas page");if(i.boundingBox.right-i.boundingBox.left+1>this._canvas.width-this._currentRow.x&&(this._currentRow.x=0,this._currentRow.y+=this._currentRow.h,this._currentRow.h=1),this._currentRow.y+i.boundingBox.bottom-i.boundingBox.top+1>this._canvas.height)return;this._ctx.drawImage(i.source,i.boundingBox.left,i.boundingBox.top,e,t,this._currentRow.x,this._currentRow.y,e,t);let o={pageIndex:this._textureIndex,glyphIndex:this._nextIndex++,x:this._currentRow.x,y:this._currentRow.y,w:e,h:t,originOffsetX:i.originOffset.x,originOffsetY:i.originOffset.y,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent};return this._currentRow.x+=e,this._currentRow.h=Math.max(this._currentRow.h,t),this._allocatedGlyphs.add(o),o}getUsagePreview(){let i=this._canvas.width,e=this._canvas.height,t=new OffscreenCanvas(i,e),o=OO(t.getContext("2d"));o.fillStyle="#808080",o.fillRect(0,0,i,e);let n=new Map,r=new Map;for(let s of this._allocatedGlyphs)n.set(s.y,Math.max(n.get(s.y)??0,s.h)),r.set(s.y,Math.max(r.get(s.y)??0,s.x+s.w));for(let s of this._allocatedGlyphs)o.fillStyle="#4040FF",o.fillRect(s.x,s.y,s.w,s.h),o.fillStyle="#FF0000",o.fillRect(s.x,s.y+s.h,s.w,n.get(s.y)-s.h);for(let[s,l]of r.entries())s!==this._currentRow.y&&(o.fillStyle="#FF0000",o.fillRect(l,s,i-l,n.get(s)));return t.convertToBlob()}getStats(){let i=this._canvas.width,e=this._canvas.height,t=0,o=0,n=i*e,r=new Map,s=new Map;for(let l of this._allocatedGlyphs)r.set(l.y,Math.max(r.get(l.y)??0,l.h)),s.set(l.y,Math.max(s.get(l.y)??0,l.x+l.w));for(let l of this._allocatedGlyphs)t+=l.w*l.h,o+=l.w*(r.get(l.y)-l.h);for(let[l,c]of s.entries())l!==this._currentRow.y&&(o+=(i-c)*r.get(l));return[`page${this._textureIndex}:`,`     Total: ${n} (${i}x${e})`,`      Used: ${t} (${(t/n*100).toPrecision(2)}%)`,`    Wasted: ${o} (${(o/n*100).toPrecision(2)}%)`,`Efficiency: ${(t/(t+o)*100).toPrecision(2)}%`].join(`
`)}};var USt=class{constructor(i,e,t){this._canvas=i;this._textureIndex=e;this._slabs=[];this._activeSlabsByDims=new r1;this._unusedRects=[];this._openRegionsByHeight=new Map;this._openRegionsByWidth=new Map;this._allocatedGlyphs=new Set;this._nextIndex=0;this._ctx=OO(this._canvas.getContext("2d",{willReadFrequently:!0})),this._slabW=Math.min(t?.slabW??64<<Math.max(Math.floor(Ki().devicePixelRatio)-1,0),this._canvas.width),this._slabH=Math.min(t?.slabH??this._slabW,this._canvas.height),this._slabsPerRow=Math.floor(this._canvas.width/this._slabW),this._slabsPerColumn=Math.floor(this._canvas.height/this._slabH)}allocate(i){let e=i.boundingBox.right-i.boundingBox.left+1,t=i.boundingBox.bottom-i.boundingBox.top+1;if(e>this._canvas.width||t>this._canvas.height)throw new li("Glyph is too large for the atlas page");if(e>this._slabW||t>this._slabH){if(this._allocatedGlyphs.size>0)return;let c=this._canvas.width;for(;e<c/2&&t<c/2;)c/=2;this._slabW=c,this._slabH=c,this._slabsPerRow=Math.floor(this._canvas.width/this._slabW),this._slabsPerColumn=Math.floor(this._canvas.height/this._slabH)}let o={w:e,h:t},n=this._activeSlabsByDims.get(o.w,o.h);if(n){let c=Math.floor(this._slabW/n.entryW)*Math.floor(this._slabH/n.entryH);n.count>=c&&(n=void 0)}let r,s;if(!n)if(e<t){let c=this._openRegionsByWidth.get(e);if(c?.length)for(let u=c.length-1;u>=0;u--){let p=c[u];if(p.w>=e&&p.h>=t){r=p.x,s=p.y,e<p.w&&this._unusedRects.push({x:p.x+e,y:p.y,w:p.w-e,h:t}),p.y+=t,p.h-=t,p.h===0&&(u===c.length-1?c.pop():this._unusedRects.splice(u,1));break}}}else{let c=this._openRegionsByHeight.get(t);if(c?.length)for(let u=c.length-1;u>=0;u--){let p=c[u];if(p.w>=e&&p.h>=t){r=p.x,s=p.y,t<p.h&&this._unusedRects.push({x:p.x,y:p.y+t,w:e,h:p.h-t}),p.x+=e,p.w-=e,p.h===0&&(u===c.length-1?c.pop():this._unusedRects.splice(u,1));break}}}if(r===void 0||s===void 0){if(!n){if(this._slabs.length>=this._slabsPerRow*this._slabsPerColumn)return;n={x:Math.floor(this._slabs.length%this._slabsPerRow)*this._slabW,y:Math.floor(this._slabs.length/this._slabsPerRow)*this._slabH,entryW:o.w,entryH:o.h,count:0};let u=this._slabW%n.entryW,p=this._slabH%n.entryH;u&&X3i(this._openRegionsByWidth,u,{x:n.x+this._slabW-u,w:u,y:n.y,h:this._slabH-(p??0)}),p&&X3i(this._openRegionsByHeight,p,{x:n.x,w:this._slabW,y:n.y+this._slabH-p,h:p}),this._slabs.push(n),this._activeSlabsByDims.set(n,o.w,o.h)}let c=Math.floor(this._slabW/n.entryW);r=n.x+Math.floor(n.count%c)*n.entryW,s=n.y+Math.floor(n.count/c)*n.entryH,n.count++}this._ctx.drawImage(i.source,i.boundingBox.left,i.boundingBox.top,e,t,r,s,e,t);let l={pageIndex:this._textureIndex,glyphIndex:this._nextIndex++,x:r,y:s,w:e,h:t,originOffsetX:i.originOffset.x,originOffsetY:i.originOffset.y,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent};return this._allocatedGlyphs.add(l),l}getUsagePreview(){let i=this._canvas.width,e=this._canvas.height,t=new OffscreenCanvas(i,e),o=OO(t.getContext("2d"));o.fillStyle="#808080",o.fillRect(0,0,i,e);let n=0,r=0,s=0,l=0,c=64<<Math.floor(Ki().devicePixelRatio)-1,u=c;for(let h of this._slabs){let g=0,f=0;for(let y=0;y<h.count;y++)g+h.entryW>c&&(g=0,f+=h.entryH),o.fillStyle="#FF0000",o.fillRect(h.x+g,h.y+f,h.entryW,h.entryH),n+=h.entryW*h.entryH,g+=h.entryW;let v=Math.floor(c/h.entryW),b=Math.floor(u/h.entryH),S=h.entryW*v*h.entryH*b;s+=c*u-S}for(let h of this._allocatedGlyphs)r+=h.w*h.h,o.fillStyle="#4040FF",o.fillRect(h.x,h.y,h.w,h.h);let p=Array.from(this._openRegionsByWidth.values()).flat().concat(Array.from(this._openRegionsByHeight.values()).flat());for(let h of p)o.fillStyle="#FF000088",o.fillRect(h.x,h.y,h.w,h.h),l+=h.w*h.h;return o.globalAlpha=.5,o.drawImage(this._canvas,0,0),o.globalAlpha=1,t.convertToBlob()}getStats(){let i=this._canvas.width,e=this._canvas.height,t=0,o=0,n=0,r=0,s=0,l=i*e,c=64<<Math.floor(Ki().devicePixelRatio)-1,u=c;for(let f of this._slabs){let v=0,b=0;for(let k=0;k<f.count;k++)v+f.entryW>c&&(v=0,b+=f.entryH),t+=f.entryW*f.entryH,v+=f.entryW;let S=Math.floor(c/f.entryW),y=Math.floor(u/f.entryH),w=f.entryW*S*f.entryH*y;n+=c*u-w}for(let f of this._allocatedGlyphs)o+=f.w*f.h;let p=Array.from(this._openRegionsByWidth.values()).flat().concat(Array.from(this._openRegionsByHeight.values()).flat());for(let f of p)s+=f.w*f.h;let h=n-s;r=t-(o-h);let g=o/(o+r+s);return[`page[${this._textureIndex}]:`,`     Total: ${l}px (${i}x${e})`,`      Used: ${o}px (${(o/l*100).toFixed(2)}%)`,`    Wasted: ${r}px (${(r/l*100).toFixed(2)}%)`,`Restricted: ${s}px (${(s/l*100).toFixed(2)}%) (hard to allocate)`,`Efficiency: ${g===1?"100":(g*100).toFixed(2)}%`,`     Slabs: ${this._slabs.length} of ${Math.floor(this._canvas.width/c)*Math.floor(this._canvas.height/u)}`].join(`
`)}};function X3i(a,i,e){let t=a.get(i);t||(t=[],a.set(i,t)),t.push(e)}var TC=class extends x{constructor(e,t,o,n,r){super();this._logService=n;this._version=0;this._usedArea={left:0,top:0,right:0,bottom:0};this._glyphMap=new r1;this._glyphInOrderSet=new Set;switch(this._canvas=new OffscreenCanvas(t,t),this._colorMap=r.getColorTheme().tokenColorMap,o){case"shelf":this._allocator=new HSt(this._canvas,e);break;case"slab":this._allocator=new USt(this._canvas,e);break;default:this._allocator=o(this._canvas,e);break}this._register(Z(()=>{this._canvas.width=1,this._canvas.height=1}))}get version(){return this._version}static{this.maximumGlyphCount=5e3}get usedArea(){return this._usedArea}get source(){return this._canvas}get glyphs(){return this._glyphInOrderSet.values()}getGlyph(e,t,o,n){return this._glyphMap.get(t,o,n,e.cacheKey)??this._createGlyph(e,t,o,n)}_createGlyph(e,t,o,n){if(this._glyphInOrderSet.size>=TC.maximumGlyphCount)return;let r=e.rasterizeGlyph(t,o,n,this._colorMap),s=this._allocator.allocate(r);if(s!==void 0)return this._glyphMap.set(s,t,o,n,e.cacheKey),this._glyphInOrderSet.add(s),this._version++,this._usedArea.right=Math.max(this._usedArea.right,s.x+s.w-1),this._usedArea.bottom=Math.max(this._usedArea.bottom,s.y+s.h-1),this._logService.getLevel()===1&&this._logService.trace("New glyph",{chars:t,tokenMetadata:o,decorationStyleSetId:n,rasterizedGlyph:r,glyph:s}),s}getUsagePreview(){return this._allocator.getUsagePreview()}getStats(){return this._allocator.getStats()}};TC=I([m(3,se),m(4,Le)],TC);var EE=class extends x{constructor(e,t,o,n,r){super();this._maxTextureSize=e;this._decorationStyleCache=o;this._themeService=n;this._instantiationService=r;this._warmUpTask=this._register(new me);this._warmedUpRasterizers=new Set;this._pages=[];this._glyphPageIndex=new r1;this._onDidDeleteGlyphs=this._register(new E);this.onDidDeleteGlyphs=this._onDidDeleteGlyphs.event;this._allocatorType=t?.allocatorType??"slab",this._register(U.runAndSubscribe(this._themeService.onDidColorThemeChange,()=>{this._colorMap&&this.clear(),this._colorMap=this._themeService.getColorTheme().tokenColorMap}));let s=Math.max(1,Math.floor(Ki().devicePixelRatio));this.pageSize=Math.min(1024*s,this._maxTextureSize),this._initFirstPage(),this._register(Z(()=>Be(this._pages)))}static{this.maximumPageCount=16}get pages(){return this._pages}_initFirstPage(){let e=this._instantiationService.createInstance(TC,0,this.pageSize,this._allocatorType);this._pages.push(e);let t=new tz(1,"",1,this._decorationStyleCache);e.getGlyph(t,"",0,0),t.dispose()}clear(){for(let e of this._pages)e.dispose();this._pages.length=0,this._glyphPageIndex.clear(),this._warmedUpRasterizers.clear(),this._warmUpTask.clear(),this._initFirstPage(),this._onDidDeleteGlyphs.fire()}getGlyph(e,t,o,n,r){return o&=-2048,o|=Math.floor(r%1*10),this._warmedUpRasterizers.has(e.id)||(this._warmUpAtlas(e),this._warmedUpRasterizers.add(e.id)),this._tryGetGlyph(this._glyphPageIndex.get(t,o,n,e.cacheKey)??0,e,t,o,n)}_tryGetGlyph(e,t,o,n,r){return this._glyphPageIndex.set(e,o,n,r,t.cacheKey),this._pages[e].getGlyph(t,o,n,r)??(e+1<this._pages.length?this._tryGetGlyph(e+1,t,o,n,r):void 0)??this._getGlyphFromNewPage(t,o,n,r)}_getGlyphFromNewPage(e,t,o,n){if(this._pages.length>=EE.maximumPageCount)throw new Error(`Attempt to create a texture atlas page past the limit ${EE.maximumPageCount}`);return this._pages.push(this._instantiationService.createInstance(TC,this._pages.length,this.pageSize,this._allocatorType)),this._glyphPageIndex.set(this._pages.length-1,t,o,n,e.cacheKey),this._pages[this._pages.length-1].getGlyph(e,t,o,n)}getUsagePreview(){return Promise.all(this._pages.map(e=>e.getUsagePreview()))}getStats(){return this._pages.map(e=>e.getStats())}_warmUpAtlas(e){let t=this._colorMap;if(!t)throw new li("Cannot warm atlas without color map");this._warmUpTask.value?.clear();let o=this._warmUpTask.value=this._instantiationService.createInstance(Nii);for(let n=65;n<=90;n++)for(let r of t.keys())o.enqueue(()=>{for(let s=0;s<1;s+=.1)this.getGlyph(e,String.fromCharCode(n),r<<15&16744448,0,s)});for(let n=97;n<=122;n++)for(let r of t.keys())o.enqueue(()=>{for(let s=0;s<1;s+=.1)this.getGlyph(e,String.fromCharCode(n),r<<15&16744448,0,s)});for(let n=33;n<=126;n++)for(let r of t.keys())o.enqueue(()=>{for(let s=0;s<1;s+=.1)this.getGlyph(e,String.fromCharCode(n),r<<15&16744448,0,s)})}};EE=I([m(3,Le),m(4,F)],EE);var ft=bt,Ne=le("notificationService");function H7(a){if(a){let i=a;return typeof i.id=="string"&&typeof i.label=="string"}return!1}var Lle=class{constructor(){this.progress=new Oii;this.onDidClose=U.None;this.onDidChangeVisibility=U.None}updateSeverity(i){}updateMessage(i){}updateActions(i){}close(){}},Oii=class{infinite(){}done(){}total(i){}worked(i){}};function U7(a,i){return i===ft.Error?d(2283,null,a):i===ft.Warning?d(2285,null,a):d(2284,null,a)}var ZI;(t=>{async function a(o){try{if(!navigator.gpu)throw new Error("This browser does not support WebGPU");let n=await navigator.gpu.requestAdapter();if(!n)throw new Error("This browser supports WebGPU but it appears to be disabled");return Fii(await n.requestDevice())}catch(n){throw o&&o(n.message),n}}t.requestDevice=a;function i(o,n,r){let s=o.createBuffer(n);return r&&o.queue.writeBuffer(s,0,xL(r)?r():r),Fii(s)}t.createBuffer=i;function e(o,n){return Fii(o.createTexture(n))}t.createTexture=e})(ZI||={});function Fii(a){return{object:a,dispose:()=>a.destroy()}}var zSt=class{get dataOffset(){return this._startIndex}get dirtySize(){if(!(this._startIndex===void 0||this._endIndex===void 0))return this._endIndex-this._startIndex+1}get isDirty(){return this._startIndex!==void 0}flag(i,e=1){return this._flag(i),e>1&&this._flag(i+e-1),i}_flag(i){(this._startIndex===void 0||i<this._startIndex)&&(this._startIndex=i),(this._endIndex===void 0||i>this._endIndex)&&(this._endIndex=i)}clear(){this._startIndex=void 0,this._endIndex=void 0}};function J3i(a,i){return new Wii(a,i)}var Wii=class extends x{constructor(e,t){super();this.propertySpecs=e;this.capacity=t;this._dirtyTracker=new zSt;this._propertySpecsMap=new Map;this._entries=new qs;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._onDidChangeBuffer=this._register(new E);this.onDidChangeBuffer=this._onDidChangeBuffer.event;this.view=new Float32Array(t*e.length),this.buffer=this.view.buffer,this._entrySize=e.length;for(let o=0;o<e.length;o++){let n={offset:o,...e[o]};this._propertySpecsMap.set(n.name,n)}this._register(Z(()=>Be(this._entries)))}get bufferUsedSize(){return this.viewUsedSize*Float32Array.BYTES_PER_ELEMENT}get viewUsedSize(){return this._entries.size*this._entrySize}get entryCount(){return this._entries.size}get dirtyTracker(){return this._dirtyTracker}createEntry(e){this._entries.size===this.capacity&&(this._expandBuffer(),this._onDidChangeBuffer.fire());let t=new Vii(this.view,this._propertySpecsMap,this._dirtyTracker,this._entries.size,e),o=this._entries.push(t),n=[];return n.push(U.forward(t.onDidChange,this._onDidChange)),n.push(t.onWillDispose(()=>{let r=t.i;o(),this.view.set(this.view.subarray(r*this._entrySize+2,this._entries.size*this._entrySize+2),r*this._entrySize);for(let s of this._entries)s.i>r&&s.i--;this._dirtyTracker.flag(r,(this._entries.size-r)*this._entrySize),Be(n)})),t}_expandBuffer(){this.capacity*=2;let e=new Float32Array(this.capacity*this._entrySize);e.set(this.view),this.view=e,this.buffer=this.view.buffer}},Vii=class extends x{constructor(e,t,o,n,r){super();this._view=e;this._propertySpecsMap=t;this._dirtyTracker=o;this.i=n;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._onWillDispose=this._register(new E);this.onWillDispose=this._onWillDispose.event;for(let s of this._propertySpecsMap.values())this._view[this.i*this._propertySpecsMap.size+s.offset]=r[s.name];this._dirtyTracker.flag(this.i*this._propertySpecsMap.size,this._propertySpecsMap.size)}dispose(){this._onWillDispose.fire(),super.dispose()}set(e,t){let o=this.i*this._propertySpecsMap.size+this._propertySpecsMap.get(e).offset;this._view[this._dirtyTracker.flag(o)]=t,this._onDidChange.fire()}get(e){return this._view[this.i*this._propertySpecsMap.size+this._propertySpecsMap.get(e).offset]}setRaw(e){if(e.length!==this._propertySpecsMap.size)throw new Error(`Data length ${e.length} does not match the number of properties in the collection (${this._propertySpecsMap.size})`);this._view.set(e,this.i*this._propertySpecsMap.size),this._dirtyTracker.flag(this.i*this._propertySpecsMap.size,this._propertySpecsMap.size)}};var Z3i=`

struct Vertex {
	@location(0) position: vec2f,
};

struct LayoutInfo {
	canvasDims: vec2f,
	viewportOffset: vec2f,
	viewportDims: vec2f,
}

struct ScrollOffset {
	offset: vec2f,
}

struct Shape {
	position: vec2f,
	size: vec2f,
	color: vec4f,
};

struct VSOutput {
	@builtin(position) position: vec4f,
	@location(1)       color:    vec4f,
};

// Uniforms
@group(0) @binding(1) var<uniform>       layoutInfo:      LayoutInfo;

// Storage buffers
@group(0) @binding(0)            var<storage, read> shapes:          array<Shape>;
@group(0) @binding(2)      var<uniform>       scrollOffset:    ScrollOffset;

@vertex fn vs(
	vert: Vertex,
	@builtin(instance_index) instanceIndex: u32,
	@builtin(vertex_index) vertexIndex : u32
) -> VSOutput {
	let shape = shapes[instanceIndex];

	var vsOut: VSOutput;
	vsOut.position = vec4f(
		(
			// Top left corner
			vec2f(-1,  1) +
			// Convert pixel position to clipspace
			vec2f( 2, -2) / layoutInfo.canvasDims *
			// Shape position and size
			(layoutInfo.viewportOffset - scrollOffset.offset + shape.position + vert.position * shape.size)
		),
		0.0,
		1.0
	);
	vsOut.color = shape.color;
	return vsOut;
}

@fragment fn fs(vsOut: VSOutput) -> @location(0) vec4f {
	return vsOut.color;
}
`;var KSt=class extends wE{constructor(e,t,o,n,r,s){super();this._context=e;this._contentLeft=t;this._devicePixelRatio=o;this._canvas=n;this._ctx=r;this._shapeBindBuffer=this._register(new me);this._initialized=!1;this._shapeCollection=this._register(J3i([{name:"x"},{name:"y"},{name:"width"},{name:"height"},{name:"red"},{name:"green"},{name:"blue"},{name:"alpha"}],32));this._context.addEventHandler(this),this._initWebgpu(s)}async _initWebgpu(e){if(this._device=await e,this._store.isDisposed)return;let t=navigator.gpu.getPreferredCanvasFormat();this._ctx.configure({device:this._device,format:t,alphaMode:"premultiplied"}),this._renderPassColorAttachment={view:null,loadOp:"load",storeOp:"store"},this._renderPassDescriptor={label:"Monaco rectangle renderer render pass",colorAttachments:[this._renderPassColorAttachment]};let o;{let l;(w=>(w[w.FloatsPerEntry=6]="FloatsPerEntry",w[w.BytesPerEntry=24]="BytesPerEntry",w[w.Offset_CanvasWidth____=0]="Offset_CanvasWidth____",w[w.Offset_CanvasHeight___=1]="Offset_CanvasHeight___",w[w.Offset_ViewportOffsetX=2]="Offset_ViewportOffsetX",w[w.Offset_ViewportOffsetY=3]="Offset_ViewportOffsetY",w[w.Offset_ViewportWidth__=4]="Offset_ViewportWidth__",w[w.Offset_ViewportHeight_=5]="Offset_ViewportHeight_"))(l||={});let c=new Float32Array(6),u=(p=this._canvas.width,h=this._canvas.height)=>(c[0]=p,c[1]=h,c[2]=Math.ceil(this._context.configuration.options.get(165).contentLeft*Ki().devicePixelRatio),c[3]=0,c[4]=c[0]-c[2],c[5]=c[1]-c[3],c);o=this._register(ZI.createBuffer(this._device,{label:"Monaco rectangle renderer uniform buffer",size:24,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST},()=>u())).object,this._register(VSt(this._canvas,Ki(),(p,h)=>{this._device.queue.writeBuffer(o,0,u(p,h))}))}let n=2;this._scrollOffsetBindBuffer=this._register(ZI.createBuffer(this._device,{label:"Monaco rectangle renderer scroll offset buffer",size:n*Float32Array.BYTES_PER_ELEMENT,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST})).object,this._scrollOffsetValueBuffer=new Float32Array(n);let r=()=>ZI.createBuffer(this._device,{label:"Monaco rectangle renderer shape buffer",size:this._shapeCollection.buffer.byteLength,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST});this._shapeBindBuffer.value=r(),this._register(U.runAndSubscribe(this._shapeCollection.onDidChangeBuffer,()=>{this._shapeBindBuffer.value=r(),this._pipeline&&this._updateBindGroup(this._pipeline,o)})),this._vertexBuffer=this._register(ZI.createBuffer(this._device,{label:"Monaco rectangle renderer vertex buffer",size:FV.byteLength,usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST},FV)).object;let s=this._device.createShaderModule({label:"Monaco rectangle renderer shader module",code:Z3i});this._pipeline=this._device.createRenderPipeline({label:"Monaco rectangle renderer render pipeline",layout:"auto",vertex:{module:s,buffers:[{arrayStride:2*Float32Array.BYTES_PER_ELEMENT,attributes:[{shaderLocation:0,offset:0,format:"float32x2"}]}]},fragment:{module:s,targets:[{format:t,blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"}}}]}}),this._updateBindGroup(this._pipeline,o),this._initialized=!0}_updateBindGroup(e,t){this._bindGroup=this._device.createBindGroup({label:"Monaco rectangle renderer bind group",layout:e.getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:this._shapeBindBuffer.value.object}},{binding:1,resource:{buffer:t}},{binding:2,resource:{buffer:this._scrollOffsetBindBuffer}}]})}register(e,t,o,n,r,s,l,c){return this._shapeCollection.createEntry({x:e,y:t,width:o,height:n,red:r,green:s,blue:l,alpha:c})}onScrollChanged(e){if(this._device){let t=Ki().devicePixelRatio;this._scrollOffsetValueBuffer[0]=this._context.viewLayout.getCurrentScrollLeft()*t,this._scrollOffsetValueBuffer[1]=this._context.viewLayout.getCurrentScrollTop()*t,this._device.queue.writeBuffer(this._scrollOffsetBindBuffer,0,this._scrollOffsetValueBuffer)}return!0}_update(){if(!this._device)return;let e=this._shapeCollection;e.dirtyTracker.isDirty&&(this._device.queue.writeBuffer(this._shapeBindBuffer.value.object,0,e.buffer,e.dirtyTracker.dataOffset,e.dirtyTracker.dirtySize*e.view.BYTES_PER_ELEMENT),e.dirtyTracker.clear())}draw(e){if(!this._initialized)return;this._update();let t=this._device.createCommandEncoder({label:"Monaco rectangle renderer command encoder"});this._renderPassColorAttachment.view=this._ctx.getCurrentTexture().createView();let o=t.beginRenderPass(this._renderPassDescriptor);o.setPipeline(this._pipeline),o.setVertexBuffer(0,this._vertexBuffer),o.setBindGroup(0,this._bindGroup);let n=Math.ceil(this._contentLeft.get()*this._devicePixelRatio.get());o.setScissorRect(n,0,this._canvas.width-n,this._canvas.height),o.draw(FV.length/2,this._shapeCollection.entryCount),o.end();let r=t.finish();this._device.queue.submit([r])}};var GSt=class extends x{constructor(){super();this._ruleCache=new Map;this._cssVariableCache=new Map;this._container=_("div.monaco-decoration-css-rule-extractor"),this._dummyElement=_("span"),this._container.appendChild(this._dummyElement),this._register(Z(()=>this._container.remove()))}getStyleRules(e,t){let o=this._ruleCache.get(t);if(o)return o;this._dummyElement.className=t,e.appendChild(this._container);let n=this._getStyleRules(t);return this._ruleCache.set(t,n),e.removeChild(this._container),n}_getStyleRules(e){let t=[],n=[...sm().styleSheets],r=e.split(" ").filter(s=>s.length>0);for(let s=0;s<n.length;s++){let l=n[s];this._collectMatchingRules(l.cssRules,r,t)}return t}_collectMatchingRules(e,t,o){for(let n of e)if(n instanceof CSSImportRule)n.styleSheet&&this._collectMatchingRules(n.styleSheet.cssRules,t,o);else if(n instanceof CSSStyleRule){for(let r of t){let s=`.${r}`,l=n.selectorText.indexOf(s);if(l!==-1){let c=l+s.length;if(n.selectorText.length===c||n.selectorText.substring(c,c+1).match(/[ :.]/)){o.push(n);break}}}n.cssRules?.length&&this._collectMatchingRules(n.cssRules,t,o)}}resolveCssVariable(e,t){let o=this._cssVariableCache.get(t);return o===void 0&&(e.appendChild(this._container),o=Ki().getComputedStyle(this._container).getPropertyValue(t).trim(),e.removeChild(this._container),this._cssVariableCache.set(t,o)),o}clear(){this._ruleCache.clear(),this._cssVariableCache.clear()}};var qSt=class{constructor(){this._nextId=1;this._cacheById=new Map;this._cacheByStyle=new r1}getOrCreateEntry(i,e,t,o,n,r){if(i===void 0&&e===void 0&&t===void 0&&o===void 0&&n===void 0&&r===void 0)return 0;let s=this._cacheByStyle.get(i??0,e?1:0,t===void 0?"":t.toFixed(2),o?1:0,n===void 0?"":n.toFixed(2),r??0);if(s)return s.id;let l=this._nextId++,c={id:l,color:i,bold:e,opacity:t,strikethrough:o,strikethroughThickness:n,strikethroughColor:r};return this._cacheById.set(l,c),this._cacheByStyle.set(c,i??0,e?1:0,t===void 0?"":t.toFixed(2),o?1:0,n===void 0?"":n.toFixed(2),r??0),l}getStyleSet(i){if(i!==0)return this._cacheById.get(i)}};var gc=class extends x{constructor(e,t,o,n,r){super();this._instantiationService=t;this._notificationService=o;this.configurationService=n;this._themeService=r;this.maxGpuCols=2e3;this.canvas=ur(document.createElement("canvas")),this.canvas.setClassName("editorCanvas"),this._register(U.runAndSubscribe(n.onDidChangeConfiguration,u=>{if(!u||u.affectsConfiguration("editor.scrollbar.verticalScrollbarSize")){let p=n.getValue("editor").scrollbar?.verticalScrollbarSize??14;this.canvas.domNode.style.boxSizing="border-box",this.canvas.domNode.style.paddingRight=`${p}px`}})),this.ctx=OO(this.canvas.domNode.getContext("webgpu")),gc.device||(gc.device=ZI.requestDevice(u=>{let p=[{label:d(189,null),run:()=>this.configurationService.updateValue("editor.experimentalGpuAcceleration","off")}];this._notificationService.prompt(ft.Warning,u,p)}).then(u=>(gc.deviceSync=u.object,gc._atlas||(gc._atlas=this._instantiationService.createInstance(EE,u.object.limits.maxTextureDimension2D,void 0,gc.decorationStyleCache)),u.object)));let s=Me(this,Ki().devicePixelRatio);this._register(j(Ki(),"resize",()=>{s.set(Ki().devicePixelRatio,void 0)})),this.devicePixelRatio=s,this._register(Vs(this.devicePixelRatio,()=>gc.atlas?.clear())),this._register(this._themeService.onDidColorThemeChange(()=>{gc.decorationCssRuleExtractor.clear(),gc.atlas?.clear()}));let l=Me(this,{width:this.canvas.domNode.width,height:this.canvas.domNode.height});this._register(VSt(this.canvas.domNode,Ki(),(u,p)=>{this.canvas.domNode.width=u,this.canvas.domNode.height=p,l.set({width:u,height:p},void 0)})),this.canvasDevicePixelDimensions=l;let c=Me(this,0);this._register(this.configurationService.onDidChangeConfiguration(u=>{c.set(e.configuration.options.get(165).contentLeft,void 0)})),this.contentLeft=c,this.rectangleRenderer=this._register(this._instantiationService.createInstance(KSt,e,this.contentLeft,this.devicePixelRatio,this.canvas.domNode,this.ctx,gc.device))}static{this._decorationCssRuleExtractor=new GSt}static get decorationCssRuleExtractor(){return gc._decorationCssRuleExtractor}static{this._decorationStyleCache=new qSt}static get decorationStyleCache(){return gc._decorationStyleCache}static get atlas(){if(!gc._atlas)throw new li("Cannot call ViewGpuContext.textureAtlas before device is resolved");return gc._atlas}get atlas(){return gc.atlas}canRender(e,t,o){let n=t.getViewLineRenderingData(o);if(n.containsRTL||n.maxColumn>this.maxGpuCols)return!1;if(n.inlineDecorations.length>0){let r=!0;for(let s of n.inlineDecorations){if(s.type!==0){r=!1;break}let l=gc._decorationCssRuleExtractor.getStyleRules(this.canvas.domNode,s.inlineClassName);if(r&&=l.every(c=>{if(c.selectorText.includes(":"))return!1;for(let u of c.style)if(!e8i(u,c.style))return!1;return!0}),!r)break}return r}return!0}canRenderDetailed(e,t,o){let n=t.getViewLineRenderingData(o),r=[];if(n.containsRTL&&r.push("containsRTL"),n.maxColumn>this.maxGpuCols&&r.push("maxColumn > maxGpuCols"),n.inlineDecorations.length>0){let s=!0,l=[],c=[],u=[];for(let p of n.inlineDecorations){if(p.type!==0){l.push(p.type),s=!1;continue}let h=gc._decorationCssRuleExtractor.getStyleRules(this.canvas.domNode,p.inlineClassName);s&&=h.every(g=>{if(g.selectorText.includes(":"))return c.push(g.selectorText),!1;for(let f of g.style)if(!e8i(f,g.style))return u.push(`${f}: ${g.style[f]}`),!1;return!0})}l.length>0&&r.push(`inlineDecorations with unsupported types (${l.map(p=>`\`${p}\``).join(", ")})`),u.length>0&&r.push(`inlineDecorations with unsupported CSS rules (${u.map(p=>`\`${p}\``).join(", ")})`),c.length>0&&r.push(`inlineDecorations with unsupported CSS selectors (${c.map(p=>`\`${p}\``).join(", ")})`)}return r}};gc=I([m(1,F),m(2,Ne),m(3,B),m(4,Le)],gc);var CVo=["color","font-weight","opacity","text-decoration","text-decoration-color","text-decoration-line","text-decoration-style","text-decoration-thickness"];function e8i(a,i){if(!CVo.includes(a))return!1;switch(a){case"text-decoration":case"text-decoration-line":return i.getPropertyValue(a)==="line-through";case"text-decoration-color":{let e=i.getPropertyValue(a);return/^var\(--[^,]+,\s*(?:initial|inherit)\)$/.test(e)?!0:We.Format.CSS.parse(e)!==null}case"text-decoration-style":return i.getPropertyValue(a)==="initial";case"text-decoration-thickness":{let e=i.getPropertyValue(a);return e==="initial"||/^\d+(\.\d+)?px$/.test(e)}default:return!0}}function z7(a,i){return a.isBasicASCII&&i.useMonospaceOptimizations?new Bii(a):new Hii(a)}var Bii=class{constructor(i){this._content=i.content}getSegmentAtIndex(i){return this._content[i]}getSegmentData(i){}},Hii=class{constructor(i){this._segments=[];let e=i.content,t=Jc.Segmenter(void 0,{granularity:"grapheme"}).value,o=Array.from(t.segment(e)),n=0;for(let r=0;r<e.length;r++){let s=o[n];if(!s)break;if(s.index!==r){this._segments.push(void 0);continue}n++,this._segments.push(s)}}getSegmentAtIndex(i){return this._segments[i]?.segment}getSegmentData(i){return this._segments[i]}};var Rwe=class extends wE{constructor(e,t,o,n){super();this._context=e;this._viewGpuContext=t;this._device=o;this._glyphRasterizer=n;this._context.addEventHandler(this)}get glyphRasterizer(){return this._glyphRasterizer.value}};var $St=`
struct GlyphInfo {
	position: vec2f,
	size: vec2f,
	origin: vec2f,
};

struct Vertex {
	@location(0) position: vec2f,
};

struct Cell {
	position: vec2f,
	unused1: vec2f,
	glyphIndex: f32,
	textureIndex: f32
};

struct LayoutInfo {
	canvasDims: vec2f,
	viewportOffset: vec2f,
	viewportDims: vec2f,
}

struct ScrollOffset {
	offset: vec2f
}

struct VSOutput {
	@builtin(position) position:   vec4f,
	@location(1)       layerIndex: f32,
	@location(0)       texcoord:   vec2f,
};

// Uniforms
@group(0) @binding(4)       var<uniform>       layoutInfo:      LayoutInfo;
@group(0) @binding(5)  var<uniform>       atlasDims:       vec2f;
@group(0) @binding(6)            var<uniform>       scrollOffset:    ScrollOffset;

// Storage buffers
@group(0) @binding(0)               var<storage, read> glyphInfo:       array<array<GlyphInfo, ${TC.maximumGlyphCount}>, ${EE.maximumPageCount}>;
@group(0) @binding(1)                   var<storage, read> cells:           array<Cell>;

@vertex fn vs(
	vert: Vertex,
	@builtin(instance_index) instanceIndex: u32,
	@builtin(vertex_index) vertexIndex : u32
) -> VSOutput {
	let cell = cells[instanceIndex];
	var glyph = glyphInfo[u32(cell.textureIndex)][u32(cell.glyphIndex)];

	var vsOut: VSOutput;
	// Multiple vert.position by 2,-2 to get it into clipspace which ranged from -1 to 1
	vsOut.position = vec4f(
		// Make everything relative to top left instead of center
		vec2f(-1, 1) +
		((vert.position * vec2f(2, -2)) / layoutInfo.canvasDims) * glyph.size +
		((cell.position * vec2f(2, -2)) / layoutInfo.canvasDims) +
		((glyph.origin * vec2f(2, -2)) / layoutInfo.canvasDims) +
		(((layoutInfo.viewportOffset - scrollOffset.offset * vec2(1, -1)) * 2) / layoutInfo.canvasDims),
		0.0,
		1.0
	);

	vsOut.layerIndex = cell.textureIndex;
	// Textures are flipped from natural direction on the y-axis, so flip it back
	vsOut.texcoord = vert.position;
	vsOut.texcoord = (
		// Glyph offset (0-1)
		(glyph.position / atlasDims) +
		// Glyph coordinate (0-1)
		(vsOut.texcoord * (glyph.size / atlasDims))
	);

	return vsOut;
}

@group(0) @binding(2) var ourSampler: sampler;
@group(0) @binding(3)        var ourTexture: texture_2d_array<f32>;

@fragment fn fs(vsOut: VSOutput) -> @location(0) vec4f {
	return textureSample(ourTexture, ourSampler, vsOut.texcoord, u32(vsOut.layerIndex));
}
`;var jSt=class a extends Rwe{constructor(e,t,o,n){super(e,t,o,n);this.type="viewport";this.wgsl=$St;this._cellBindBufferLineCapacity=63;this._activeDoubleBufferIndex=0;this._visibleObjectCount=0;this._lastViewportLineCount=0;this._scrollInitialized=!1;this._onDidChangeBindGroupEntries=this._register(new E);this.onDidChangeBindGroupEntries=this._onDidChangeBindGroupEntries.event;this._rebuildCellBuffer(this._cellBindBufferLineCapacity);let r=2;this._scrollOffsetBindBuffer=this._register(ZI.createBuffer(this._device,{label:"Monaco scroll offset buffer",size:r*Float32Array.BYTES_PER_ELEMENT,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST})).object,this._scrollOffsetValueBuffer=new Float32Array(r)}static{this.maxSupportedColumns=2e3}get bindGroupEntries(){return[{binding:1,resource:{buffer:this._cellBindBuffer}},{binding:6,resource:{buffer:this._scrollOffsetBindBuffer}}]}_rebuildCellBuffer(e){this._cellBindBuffer?.destroy();let t=(Math.floor(e/32)+1)*32,o=t*a.maxSupportedColumns*6*Float32Array.BYTES_PER_ELEMENT;this._cellBindBuffer=this._register(ZI.createBuffer(this._device,{label:"Monaco full file cell buffer",size:o,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST})).object,this._cellValueBuffers=[new ArrayBuffer(o),new ArrayBuffer(o)],this._cellBindBufferLineCapacity=t,this._lastViewportLineCount=0,this._onDidChangeBindGroupEntries.fire()}onConfigurationChanged(e){return!0}onDecorationsChanged(e){return!0}onTokensChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onLinesChanged(e){return!0}onScrollChanged(e){if(this._store.isDisposed)return!1;let t=Ki().devicePixelRatio;return this._scrollOffsetValueBuffer[0]=(e?.scrollLeft??this._context.viewLayout.getCurrentScrollLeft())*t,this._scrollOffsetValueBuffer[1]=(e?.scrollTop??this._context.viewLayout.getCurrentScrollTop())*t,this._device.queue.writeBuffer(this._scrollOffsetBindBuffer,0,this._scrollOffsetValueBuffer),!0}onThemeChanged(e){return!0}onLineMappingChanged(e){return!0}onZonesChanged(e){return!0}reset(){for(let e of[0,1]){let t=new Float32Array(this._cellValueBuffers[e]);t.fill(0,0,t.length),this._device.queue.writeBuffer(this._cellBindBuffer,0,t.buffer,0,t.byteLength)}this._lastViewportLineCount=0}update(e,t){let o="",n,r=0,s=0,l=0,c=0,u=0,p=0,h,g=0,f=0,v=0,b=0,S,y,w,k,T,P,O,V,H=0,G=0,$,J=Ki().devicePixelRatio,ae;this._scrollInitialized||(this.onScrollChanged(),this._scrollInitialized=!0),this._cellBindBufferLineCapacity<e.endLineNumber-e.startLineNumber+1&&this._rebuildCellBuffer(e.endLineNumber-e.startLineNumber+1);let he=new Float32Array(this._cellValueBuffers[this._activeDoubleBufferIndex]);he.fill(0);let oe=a.maxSupportedColumns*6;for(s=e.startLineNumber;s<=e.endLineNumber;s++)if(this._viewGpuContext.canRender(t,e,s)){O=e.getViewLineRenderingData(s),p=0,ae=z7(O,t),r=t.spaceWidth*J,c=(O.minColumn-1)*r,$=O.tokens,f=O.minColumn-1,v=0;for(let xe=0,ze=$.getCount();xe<ze;xe++)if(v=$.getEndOffset(xe),!(v<=f)){for(b=$.getMetadata(xe),l=f;l<v&&!(l>a.maxSupportedColumns);l++){if(n=ae.getSegmentAtIndex(l),n===void 0)continue;o=n,O.isBasicASCII&&t.useMonospaceOptimizations||(r=this.glyphRasterizer.getTextMetrics(o).width),y=void 0,S=void 0,w=void 0,k=void 0,T=void 0,P=void 0;for(V of O.inlineDecorations){if(s<V.range.startLineNumber||s>V.range.endLineNumber||s===V.range.startLineNumber&&l<V.range.startColumn-1||s===V.range.endLineNumber&&l>=V.range.endColumn-1)continue;let Oe=gc.decorationCssRuleExtractor.getStyleRules(this._viewGpuContext.canvas.domNode,V.inlineClassName);for(let pt of Oe)for(let et of pt.style){let Ti=pt.styleMap.get(et)?.toString()??"";switch(et){case"color":{let Ht=We.Format.CSS.parse(Ti);if(!Ht)throw new li("Invalid color format "+Ti);y=Ht.toNumber32Bit();break}case"font-weight":{xVo(Ti)>=400?S=!0:S=!1;break}case"opacity":{w=kVo(Ti);break}case"text-decoration":case"text-decoration-line":{Ti==="line-through"&&(k=!0);break}case"text-decoration-thickness":{let Ht=Ti.match(/^(\d+(?:\.\d+)?)px$/);Ht&&(T=parseFloat(Ht[1]));break}case"text-decoration-color":{let Ht=Ti,zi=Ti.match(/^var\((--[^,]+),\s*(?:initial|inherit)\)$/);zi&&(Ht=gc.decorationCssRuleExtractor.resolveCssVariable(this._viewGpuContext.canvas.domNode,zi[1]));let Vo=We.Format.CSS.parse(Ht);Vo&&(P=Vo.toNumber32Bit());break}case"text-decoration-style":break;default:throw new li("Unexpected inline decoration style")}}}if(o===" "||o==="	"){if(g=((s-1)*a.maxSupportedColumns+l)*6,he.fill(0,g,g+6),o==="	"){let Oe=l+p;p=fl.nextRenderTabStop(l+p,O.tabSize),c+=r*(p-Oe),p-=l+1}else c+=r;continue}let De=gc.decorationStyleCache.getOrCreateEntry(y,S,w,k,T,P);h=this._viewGpuContext.atlas.getGlyph(this.glyphRasterizer,o,b,De,c),u=Math.round(e.relativeVerticalOffset[s-e.startLineNumber]*J+Math.floor((e.lineHeight*J-(h.fontBoundingBoxAscent+h.fontBoundingBoxDescent))/2)+h.fontBoundingBoxAscent),g=((s-e.startLineNumber)*a.maxSupportedColumns+l)*6,he[g+0]=Math.floor(c),he[g+1]=u,he[g+4]=h.glyphIndex,he[g+5]=h.pageIndex,c+=r}f=v}H=((s-e.startLineNumber)*a.maxSupportedColumns+v)*6,G=(s-e.startLineNumber)*a.maxSupportedColumns*6,he.fill(0,H,G)}let de=(e.endLineNumber-e.startLineNumber+1)*oe,Ce=e.endLineNumber-e.startLineNumber+1;if(this._device.queue.writeBuffer(this._cellBindBuffer,0,he.buffer,0,de*Float32Array.BYTES_PER_ELEMENT),Ce<this._lastViewportLineCount){let xe=this._lastViewportLineCount-Ce,ze=de*Float32Array.BYTES_PER_ELEMENT,De=xe*oe*Float32Array.BYTES_PER_ELEMENT;this._device.queue.writeBuffer(this._cellBindBuffer,ze,he.buffer,de*Float32Array.BYTES_PER_ELEMENT,De)}return this._lastViewportLineCount=Ce,this._activeDoubleBufferIndex=this._activeDoubleBufferIndex?0:1,this._visibleObjectCount=de,de}draw(e,t){if(this._visibleObjectCount<=0)throw new li("Attempt to draw 0 objects");e.draw(FV.length/2,this._visibleObjectCount)}};function xVo(a){switch(a){case"lighter":case"normal":return 400;case"bolder":case"bold":return 700}return parseInt(a)}function kVo(a){return a.endsWith("%")?parseFloat(a.substring(0,a.length-1))/100:a.match(/^\d+(?:\.\d*)/)?parseFloat(a):1}var K7=class a extends Rwe{constructor(e,t,o,n){super(e,t,o,n);this.type="fullfile";this.wgsl=$St;this._activeDoubleBufferIndex=0;this._upToDateLines=[new Set,new Set];this._visibleObjectCount=0;this._finalRenderedLine=0;this._scrollInitialized=!1;this._queuedBufferUpdates=[[],[]];let r=a.maxSupportedLines*a.maxSupportedColumns*6*Float32Array.BYTES_PER_ELEMENT;this._cellBindBuffer=this._register(ZI.createBuffer(this._device,{label:"Monaco full file cell buffer",size:r,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST})).object,this._cellValueBuffers=[new ArrayBuffer(r),new ArrayBuffer(r)];let s=2;this._scrollOffsetBindBuffer=this._register(ZI.createBuffer(this._device,{label:"Monaco scroll offset buffer",size:s*Float32Array.BYTES_PER_ELEMENT,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST})).object,this._scrollOffsetValueBuffer=new Float32Array(s)}static{this.maxSupportedLines=3e3}static{this.maxSupportedColumns=200}get bindGroupEntries(){return[{binding:1,resource:{buffer:this._cellBindBuffer}},{binding:6,resource:{buffer:this._scrollOffsetBindBuffer}}]}onConfigurationChanged(e){return this._invalidateAllLines(),this._queueBufferUpdate(e),!0}onDecorationsChanged(e){return this._invalidateAllLines(),!0}onTokensChanged(e){for(let t of e.ranges)this._invalidateLineRange(t.fromLineNumber,t.toLineNumber);return!0}onLinesDeleted(e){return this._invalidateLinesFrom(e.fromLineNumber),this._queueBufferUpdate(e),!0}onLinesInserted(e){return this._invalidateLinesFrom(e.fromLineNumber),!0}onLinesChanged(e){return this._invalidateLineRange(e.fromLineNumber,e.fromLineNumber+e.count),!0}onScrollChanged(e){if(this._store.isDisposed)return!1;let t=Ki().devicePixelRatio;return this._scrollOffsetValueBuffer[0]=(e?.scrollLeft??this._context.viewLayout.getCurrentScrollLeft())*t,this._scrollOffsetValueBuffer[1]=(e?.scrollTop??this._context.viewLayout.getCurrentScrollTop())*t,this._device.queue.writeBuffer(this._scrollOffsetBindBuffer,0,this._scrollOffsetValueBuffer),!0}onThemeChanged(e){return this._invalidateAllLines(),!0}onLineMappingChanged(e){return this._invalidateAllLines(),this._queueBufferUpdate(e),!0}onZonesChanged(e){return this._invalidateAllLines(),this._queueBufferUpdate(e),!0}_invalidateAllLines(){this._upToDateLines[0].clear(),this._upToDateLines[1].clear()}_invalidateLinesFrom(e){for(let t of[0,1]){let o=this._upToDateLines[t];for(let n of o)n>=e&&o.delete(n)}}_invalidateLineRange(e,t){for(let o=e;o<=t;o++)this._upToDateLines[0].delete(o),this._upToDateLines[1].delete(o)}reset(){this._invalidateAllLines();for(let e of[0,1]){let t=new Float32Array(this._cellValueBuffers[e]);t.fill(0,0,t.length),this._device.queue.writeBuffer(this._cellBindBuffer,0,t.buffer,0,t.byteLength)}this._finalRenderedLine=0}update(e,t){let o="",n,r=0,s=0,l=0,c=0,u=0,p=0,h,g=0,f=0,v=0,b=0,S,y,w,k,T,P,O,V,H=0,G=0,$,J=Ki().devicePixelRatio,ae;this._scrollInitialized||(this.onScrollChanged(),this._scrollInitialized=!0);let he=new Float32Array(this._cellValueBuffers[this._activeDoubleBufferIndex]),oe=a.maxSupportedColumns*6,de=this._upToDateLines[this._activeDoubleBufferIndex],Ce=3e3,xe=0,ze=this._queuedBufferUpdates[this._activeDoubleBufferIndex];for(;ze.length;){let Oe=ze.shift();switch(Oe.type){case 2:case 8:case 17:{he.fill(0),Ce=1,xe=Math.max(xe,this._finalRenderedLine),this._finalRenderedLine=0;break}case 10:{let pt=(Oe.fromLineNumber-1)*a.maxSupportedColumns*6,et=Oe.toLineNumber*a.maxSupportedColumns*6,Ti=(this._finalRenderedLine-(Oe.toLineNumber-Oe.fromLineNumber+1))*a.maxSupportedColumns*6;he.set(he.subarray(et),pt),he.fill(0,Ti),Ce=Math.min(Ce,Oe.fromLineNumber),xe=Math.max(xe,this._finalRenderedLine),this._finalRenderedLine-=Oe.toLineNumber-Oe.fromLineNumber+1;break}}}for(s=e.startLineNumber;s<=e.endLineNumber;s++){if(!this._viewGpuContext.canRender(t,e,s)){H=(s-1)*a.maxSupportedColumns*6,G=s*a.maxSupportedColumns*6,he.fill(0,H,G),Ce=Math.min(Ce,s),xe=Math.max(xe,s);continue}if(!de.has(s)){Ce=Math.min(Ce,s),xe=Math.max(xe,s),O=e.getViewLineRenderingData(s),p=0,ae=z7(O,t),r=t.spaceWidth*J,c=(O.minColumn-1)*r,$=O.tokens,f=O.minColumn-1,v=0;for(let Oe=0,pt=$.getCount();Oe<pt;Oe++)if(v=$.getEndOffset(Oe),!(v<=f)){for(b=$.getMetadata(Oe),l=f;l<v&&!(l>a.maxSupportedColumns);l++){if(n=ae.getSegmentAtIndex(l),n===void 0)continue;o=n,O.isBasicASCII&&t.useMonospaceOptimizations||(r=this.glyphRasterizer.getTextMetrics(o).width),y=void 0,S=void 0,w=void 0,k=void 0,T=void 0,P=void 0;for(V of O.inlineDecorations){if(s<V.range.startLineNumber||s>V.range.endLineNumber||s===V.range.startLineNumber&&l<V.range.startColumn-1||s===V.range.endLineNumber&&l>=V.range.endColumn-1)continue;let Ti=gc.decorationCssRuleExtractor.getStyleRules(this._viewGpuContext.canvas.domNode,V.inlineClassName);for(let Ht of Ti)for(let zi of Ht.style){let Vo=Ht.styleMap.get(zi)?.toString()??"";switch(zi){case"color":{let sn=We.Format.CSS.parse(Vo);if(!sn)throw new li("Invalid color format "+Vo);y=sn.toNumber32Bit();break}case"font-weight":{EVo(Vo)>=400?S=!0:S=!1;break}case"opacity":{w=TVo(Vo);break}case"text-decoration":case"text-decoration-line":{Vo==="line-through"&&(k=!0);break}case"text-decoration-thickness":{let sn=Vo.match(/^(\d+(?:\.\d+)?)px$/);sn&&(T=parseFloat(sn[1]));break}case"text-decoration-color":{let sn=Vo,_n=Vo.match(/^var\((--[^,]+),\s*(?:initial|inherit)\)$/);_n&&(sn=gc.decorationCssRuleExtractor.resolveCssVariable(this._viewGpuContext.canvas.domNode,_n[1]));let mn=We.Format.CSS.parse(sn);mn&&(P=mn.toNumber32Bit());break}case"text-decoration-style":break;default:throw new li("Unexpected inline decoration style")}}}if(o===" "||o==="	"){if(g=((s-1)*a.maxSupportedColumns+l)*6,he.fill(0,g,g+6),o==="	"){let Ti=l+p;p=fl.nextRenderTabStop(l+p,O.tabSize),c+=r*(p-Ti),p-=l+1}else c+=r;continue}let et=gc.decorationStyleCache.getOrCreateEntry(y,S,w,k,T,P);h=this._viewGpuContext.atlas.getGlyph(this.glyphRasterizer,o,b,et,c),u=Math.round(e.relativeVerticalOffset[s-e.startLineNumber]*J+Math.floor((e.lineHeight*J-(h.fontBoundingBoxAscent+h.fontBoundingBoxDescent))/2)+h.fontBoundingBoxAscent),g=((s-1)*a.maxSupportedColumns+l)*6,he[g+0]=Math.floor(c),he[g+1]=u,he[g+4]=h.glyphIndex,he[g+5]=h.pageIndex,c+=r}f=v}H=((s-1)*a.maxSupportedColumns+v)*6,G=s*a.maxSupportedColumns*6,he.fill(0,H,G),de.add(s)}}let De=(e.endLineNumber-e.startLineNumber+1)*oe;return Ce=Math.min(Ce,a.maxSupportedLines),xe=Math.min(xe,a.maxSupportedLines),Ce<=xe&&this._device.queue.writeBuffer(this._cellBindBuffer,(Ce-1)*oe*Float32Array.BYTES_PER_ELEMENT,he.buffer,(Ce-1)*oe*Float32Array.BYTES_PER_ELEMENT,(xe-Ce+1)*oe*Float32Array.BYTES_PER_ELEMENT),this._finalRenderedLine=Math.max(this._finalRenderedLine,xe),this._activeDoubleBufferIndex=this._activeDoubleBufferIndex?0:1,this._visibleObjectCount=De,De}draw(e,t){if(this._visibleObjectCount<=0)throw new li("Attempt to draw 0 objects");e.draw(FV.length/2,this._visibleObjectCount,void 0,(t.startLineNumber-1)*a.maxSupportedColumns)}_queueBufferUpdate(e){this._queuedBufferUpdates[0].push(e),this._queuedBufferUpdates[1].push(e)}};function EVo(a){switch(a){case"lighter":case"normal":return 400;case"bolder":case"bold":return 700}return parseInt(a)}function TVo(a){return a.endsWith("%")?parseFloat(a.substring(0,a.length-1))/100:a.match(/^\d+(?:\.\d*)/)?parseFloat(a):1}var Mwe=class extends Pu{constructor(e,t,o,n){super(e);this._viewGpuContext=t;this._instantiationService=o;this._logService=n;this._maxLineWidth=0;this._atlasGpuTextureVersions=[];this._initialized=!1;this._glyphRasterizer=this._register(new me);this._renderStrategy=this._register(new me);this.canvas=this._viewGpuContext.canvas.domNode,this._register(be(r=>{this._viewGpuContext.canvasDevicePixelDimensions.read(r);let s=this._lastViewportData;s&&setTimeout(()=>{s===this._lastViewportData&&this.renderText(s)})})),this.initWebgpu()}async initWebgpu(){if(this._device=gc.deviceSync||await gc.device,this._store.isDisposed)return;let e=gc.atlas;this._register(e.onDidDeleteGlyphs(()=>{this._atlasGpuTextureVersions.length=0,this._atlasGpuTextureVersions[0]=0,this._atlasGpuTextureVersions[1]=0,this._renderStrategy.value.reset()}));let t=navigator.gpu.getPreferredCanvasFormat();this._viewGpuContext.ctx.configure({device:this._device,format:t,alphaMode:"premultiplied"}),this._renderPassColorAttachment={view:null,loadOp:"load",storeOp:"store"},this._renderPassDescriptor={label:"Monaco render pass",colorAttachments:[this._renderPassColorAttachment]};let o;{let c;(k=>(k[k.FloatsPerEntry=6]="FloatsPerEntry",k[k.BytesPerEntry=24]="BytesPerEntry",k[k.Offset_CanvasWidth____=0]="Offset_CanvasWidth____",k[k.Offset_CanvasHeight___=1]="Offset_CanvasHeight___",k[k.Offset_ViewportOffsetX=2]="Offset_ViewportOffsetX",k[k.Offset_ViewportOffsetY=3]="Offset_ViewportOffsetY",k[k.Offset_ViewportWidth__=4]="Offset_ViewportWidth__",k[k.Offset_ViewportHeight_=5]="Offset_ViewportHeight_"))(c||={});let u=new Float32Array(6),p=(h=this.canvas.width,g=this.canvas.height)=>(u[0]=h,u[1]=g,u[2]=Math.ceil(this._context.configuration.options.get(165).contentLeft*Ki().devicePixelRatio),u[3]=0,u[4]=u[0]-u[2],u[5]=u[1]-u[3],u);o=this._register(ZI.createBuffer(this._device,{label:"Monaco uniform buffer",size:24,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST},()=>p())).object,this._register(Vs(this._viewGpuContext.canvasDevicePixelDimensions,({width:h,height:g})=>{this._device.queue.writeBuffer(o,0,p(h,g))})),this._register(Vs(this._viewGpuContext.contentLeft,()=>{this._device.queue.writeBuffer(o,0,p())}))}let n;{let c;(f=>(f[f.FloatsPerEntry=2]="FloatsPerEntry",f[f.BytesPerEntry=8]="BytesPerEntry",f[f.Offset_Width_=0]="Offset_Width_",f[f.Offset_Height=1]="Offset_Height"))(c||={}),n=this._register(ZI.createBuffer(this._device,{label:"Monaco atlas info uniform buffer",size:8,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST},()=>{let u=new Float32Array(2);return u[0]=e.pageSize,u[1]=e.pageSize,u})).object}let r=this._context.configuration.options.get(58),s=this._context.configuration.options.get(61);this._glyphRasterizer.value=this._register(new tz(s,r,this._viewGpuContext.devicePixelRatio.get(),gc.decorationStyleCache)),this._register(Vs(this._viewGpuContext.devicePixelRatio,()=>{this._refreshGlyphRasterizer()})),this._renderStrategy.value=this._instantiationService.createInstance(K7,this._context,this._viewGpuContext,this._device,this._glyphRasterizer),this._glyphStorageBuffer=this._register(ZI.createBuffer(this._device,{label:"Monaco glyph storage buffer",size:EE.maximumPageCount*(TC.maximumGlyphCount*24),usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST})).object,this._atlasGpuTextureVersions[0]=0,this._atlasGpuTextureVersions[1]=0,this._atlasGpuTexture=this._register(ZI.createTexture(this._device,{label:"Monaco atlas texture",format:"rgba8unorm",size:{width:e.pageSize,height:e.pageSize,depthOrArrayLayers:EE.maximumPageCount},dimension:"2d",usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT})).object,this._updateAtlasStorageBufferAndTexture(),this._vertexBuffer=this._register(ZI.createBuffer(this._device,{label:"Monaco vertex buffer",size:FV.byteLength,usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST},FV)).object;let l=this._device.createShaderModule({label:"Monaco shader module",code:this._renderStrategy.value.wgsl});if(this._pipeline=this._device.createRenderPipeline({label:"Monaco render pipeline",layout:"auto",vertex:{module:l,buffers:[{arrayStride:2*Float32Array.BYTES_PER_ELEMENT,attributes:[{shaderLocation:0,offset:0,format:"float32x2"}]}]},fragment:{module:l,targets:[{format:t,blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"}}}]}}),this._rebuildBindGroup=()=>{this._bindGroup=this._device.createBindGroup({label:"Monaco bind group",layout:this._pipeline.getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:this._glyphStorageBuffer}},{binding:2,resource:this._device.createSampler({label:"Monaco atlas sampler",magFilter:"nearest",minFilter:"nearest"})},{binding:3,resource:this._atlasGpuTexture.createView()},{binding:4,resource:{buffer:o}},{binding:5,resource:{buffer:n}},...this._renderStrategy.value.bindGroupEntries]})},this._rebuildBindGroup(),this._initialized=!0,this._initViewportData){for(let c of this._initViewportData)this.renderText(c);this._initViewportData=void 0}}_refreshRenderStrategy(e){if(this._renderStrategy.value?.type==="viewport"||e.endLineNumber<K7.maxSupportedLines&&this._viewportMaxColumn(e)<K7.maxSupportedColumns)return;this._logService.trace(`File is larger than ${K7.maxSupportedLines} lines or ${K7.maxSupportedColumns} columns, switching to viewport render strategy`);let t=this._instantiationService.createInstance(jSt,this._context,this._viewGpuContext,this._device,this._glyphRasterizer);this._renderStrategy.value=t,this._register(t.onDidChangeBindGroupEntries(()=>this._rebuildBindGroup?.())),this._rebuildBindGroup?.()}_viewportMaxColumn(e){let t=0,o;for(let n=e.startLineNumber;n<=e.endLineNumber;n++)o=e.getViewLineRenderingData(n),t=Math.max(t,o.maxColumn);return t}_updateAtlasStorageBufferAndTexture(){for(let[e,t]of gc.atlas.pages.entries()){if(e>=EE.maximumPageCount){console.log(`Attempt to upload atlas page [${e}], only ${EE.maximumPageCount} are supported currently`);continue}if(t.version===this._atlasGpuTextureVersions[e])continue;this._logService.trace("Updating atlas page[",e,"] from version ",this._atlasGpuTextureVersions[e]," to version ",t.version);let o=6*TC.maximumGlyphCount,n=new Float32Array(o),r=0;for(let s of t.glyphs)n[r+0]=s.x,n[r+0+1]=s.y,n[r+2]=s.w,n[r+2+1]=s.h,n[r+4]=s.originOffsetX,n[r+4+1]=s.originOffsetY,r+=6;if(r/6>TC.maximumGlyphCount)throw new Error(`Attempting to write more glyphs (${r/6}) than the GPUBuffer can hold (${TC.maximumGlyphCount})`);this._device.queue.writeBuffer(this._glyphStorageBuffer,e*6*TC.maximumGlyphCount*Float32Array.BYTES_PER_ELEMENT,n,0,6*TC.maximumGlyphCount),t.usedArea.right-t.usedArea.left>0&&t.usedArea.bottom-t.usedArea.top>0&&this._device.queue.copyExternalImageToTexture({source:t.source},{texture:this._atlasGpuTexture,origin:{x:t.usedArea.left,y:t.usedArea.top,z:e}},{width:t.usedArea.right-t.usedArea.left+1,height:t.usedArea.bottom-t.usedArea.top+1}),this._atlasGpuTextureVersions[e]=t.version}}prepareRender(e){throw new li("Should not be called")}render(e){throw new li("Should not be called")}onConfigurationChanged(e){return this._refreshGlyphRasterizer(),this._maxLineWidth=0,!0}onCursorStateChanged(e){return!0}onDecorationsChanged(e){return!0}onFlushed(e){return this._maxLineWidth=0,!0}onLinesChanged(e){return!0}onLinesDeleted(e){return this._maxLineWidth=0,!0}onLinesInserted(e){return!0}onLineMappingChanged(e){return!0}onRevealRangeRequest(e){return!0}onScrollChanged(e){return!0}onThemeChanged(e){return!0}onZonesChanged(e){return!0}_refreshGlyphRasterizer(){let e=this._glyphRasterizer.value;if(!e)return;let t=this._context.configuration.options.get(58),o=this._context.configuration.options.get(61),n=this._viewGpuContext.devicePixelRatio.get();(e.fontFamily!==t||e.fontSize!==o||e.devicePixelRatio!==n)&&(this._glyphRasterizer.value=new tz(o,t,n,gc.decorationStyleCache))}renderText(e){if(this._initialized)return this._refreshRenderStrategy(e),this._renderText(e);this._initViewportData=this._initViewportData??[],this._initViewportData.push(e)}_renderText(e){this._viewGpuContext.rectangleRenderer.draw(e);let t=new Tj(this._context.configuration,this._context.theme.type);this._renderStrategy.value.update(e,t),this._updateAtlasStorageBufferAndTexture();let o=this._device.createCommandEncoder({label:"Monaco command encoder"});this._renderPassColorAttachment.view=this._viewGpuContext.ctx.getCurrentTexture().createView({label:"Monaco canvas texture view"});let n=o.beginRenderPass(this._renderPassDescriptor);n.setPipeline(this._pipeline),n.setVertexBuffer(0,this._vertexBuffer);let r=Math.ceil(this._viewGpuContext.contentLeft.get()*this._viewGpuContext.devicePixelRatio.get());n.setScissorRect(r,0,this.canvas.width-r,this.canvas.height),n.setBindGroup(0,this._bindGroup),this._renderStrategy.value.draw(n,e),n.end();let s=o.finish();this._device.queue.submit([s]),this._lastViewportData=e,this._lastViewLineOptions=t,this._updateMaxLineWidth(e,t)}_updateMaxLineWidth(e,t){let o=Ki().devicePixelRatio,n=0;for(let s=e.startLineNumber;s<=e.endLineNumber;s++){if(!this._viewGpuContext.canRender(t,e,s))continue;let l=e.getViewLineRenderingData(s),c=this._computeLineWidth(l,t,o);n=Math.max(n,c)}let r=Math.ceil(n);r>this._maxLineWidth&&(this._maxLineWidth=r,this._context.viewModel.viewLayout.setMaxLineWidth(this._maxLineWidth))}_computeLineWidth(e,t,o){let n=e.content,r;e.isBasicASCII&&t.useMonospaceOptimizations||(r=z7(e,t));let s=0,l=0;for(let c=0;c<n.length;c++){let u;if(e.isBasicASCII&&t.useMonospaceOptimizations)u=n.charAt(c);else{let p=r.getSegmentAtIndex(c);if(p===void 0)continue;u=p}if(u==="	"){let p=c+l;l=fl.nextRenderTabStop(c+l,e.tabSize),s+=t.spaceWidth*(l-p),l-=c+1}else e.isBasicASCII&&t.useMonospaceOptimizations?s+=t.spaceWidth:s+=this._renderStrategy.value.glyphRasterizer.getTextMetrics(u).width/o}return s}linesVisibleRangesForRange(e,t){if(!this._lastViewportData)return null;let o=e.endLineNumber,n=z.intersectRanges(e,this._lastViewportData.visibleRange);if(!n)return null;let r=this._lastViewportData.startLineNumber,s=this._lastViewportData.endLineNumber,l=this._lastViewportData,c=this._lastViewLineOptions;if(!l||!c)return null;let u=[],p=0;t&&(p=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new ye(n.startLineNumber,1)).lineNumber);for(let h=n.startLineNumber;h<=n.endLineNumber;h++){if(h<r||h>s)continue;let g=h===n.startLineNumber?n.startColumn:1,f=h!==o,v=f?this._context.viewModel.getLineMaxColumn(h):n.endColumn,b=this._visibleRangesForLineRange(h,g,v);if(b){if(t&&h<o){let S=p;p=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new ye(h+1,1)).lineNumber,S!==p&&(b.ranges[b.ranges.length-1].width+=c.spaceWidth)}u.push(new Qye(b.outsideRenderedLine,h,P7.from(b.ranges),f))}}return u.length===0?null:u}_visibleRangesForLineRange(e,t,o){if(this.shouldRender())return null;let n=this._lastViewportData,r=this._lastViewLineOptions;if(!n||!r||e<n.startLineNumber||e>n.endLineNumber)return null;let s=n.getViewLineRenderingData(e),l=s.content,c;s.isBasicASCII&&r.useMonospaceOptimizations||(c=z7(s,r));let u="",p=0,h=0;for(let b=0;b<t-1;b++){if(s.isBasicASCII&&r.useMonospaceOptimizations)u=l.charAt(b);else{if(u=c.getSegmentAtIndex(b),u===void 0)continue;h+=this._renderStrategy.value.glyphRasterizer.getTextMetrics(u).width/Ki().devicePixelRatio-r.spaceWidth}u==="	"?p=fl.nextRenderTabStop(p,s.tabSize):p++}let g=p,f=0;for(let b=t-1;b<o-1;b++){if(s.isBasicASCII&&r.useMonospaceOptimizations)u=l.charAt(b);else{if(u=c.getSegmentAtIndex(b),u===void 0)continue;f+=this._renderStrategy.value.glyphRasterizer.getTextMetrics(u).width/Ki().devicePixelRatio-r.spaceWidth}u==="	"?g=fl.nextRenderTabStop(g,s.tabSize):g++}return new hle(!1,[new TP(p*r.spaceWidth+h,(g-p)*r.spaceWidth+f)])}visibleRangeForPosition(e){let t=this._visibleRangesForLineRange(e.lineNumber,e.column,e.column);return t?new Yye(t.outsideRenderedLine,t.ranges[0].left):null}getLineWidth(e){if(!this._lastViewportData||!this._lastViewLineOptions||!this._viewGpuContext.canRender(this._lastViewLineOptions,this._lastViewportData,e))return;let t=this._lastViewportData.getViewLineRenderingData(e),n=this._visibleRangesForLineRange(e,1,t.maxColumn)?.ranges.at(-1);if(n)return n.left+n.width}getPositionAtCoordinate(e,t){if(!this._lastViewportData||!this._lastViewLineOptions||!this._viewGpuContext.canRender(this._lastViewLineOptions,this._lastViewportData,e))return;let o=this._lastViewportData.getViewLineRenderingData(e),n=o.content,r=Ki().devicePixelRatio,s=t*r,l=this._lastViewLineOptions.spaceWidth*r,c=z7(o,this._lastViewLineOptions),u=0,p=0,h=0,g=0;for(let f=0;f<n.length;f++){let v=c.getSegmentAtIndex(f);if(v===void 0){g++;continue}if(v==="	"){let b=f+h;h=fl.nextRenderTabStop(f+h,o.tabSize),p=l*(h-b),h-=f+1}else o.isBasicASCII&&this._lastViewLineOptions.useMonospaceOptimizations?p=l:p=this._renderStrategy.value.glyphRasterizer.getTextMetrics(v).width;if(s<u+p/2)break;u+=p,g++}return new ye(e,g+1)}};Mwe=I([m(2,F),m(3,se)],Mwe);var zii=class{constructor(){this._onDidChange=new E;this.onDidChange=this._onDidChange.event;this._enabled=!0}get enabled(){return this._enabled}enable(){this._enabled=!0,this._onDidChange.fire()}disable(){this._enabled=!1,this._onDidChange.fire()}},M_=new zii;var _e=le("keybindingService");var Pwe=class extends Pu{constructor(){super(...arguments);this._onWillCopy=this._register(new E);this.onWillCopy=this._onWillCopy.event;this._onWillCut=this._register(new E);this.onWillCut=this._onWillCut.event;this._onWillPaste=this._register(new E);this.onWillPaste=this._onWillPaste.event}};var Awe=class{_getPageOfLine(i,e){return Math.floor((i-1)/e)}_getRangeForPage(i,e){let t=i*e,o=t+1,n=t+e;return new z(o,1,n+1,1)}fromEditorSelection(i,e,t,o){let r=this._getPageOfLine(e.startLineNumber,t),s=this._getRangeForPage(r,t),l=this._getPageOfLine(e.endLineNumber,t),c=this._getRangeForPage(l,t),u=s.intersectRanges(new z(1,1,e.startLineNumber,e.startColumn));if(o&&i.getValueLengthInRange(u,1)>500){let w=i.modifyPosition(u.getEndPosition(),-500);u=z.fromPositions(w,u.getEndPosition())}let p=i.getValueInRange(u,1),h=i.getLineCount(),g=i.getLineMaxColumn(h),f=c.intersectRanges(new z(e.endLineNumber,e.endColumn,h,g));if(o&&i.getValueLengthInRange(f,1)>500){let w=i.modifyPosition(f.getStartPosition(),500);f=z.fromPositions(f.getStartPosition(),w)}let v=i.getValueInRange(f,1),b;if(r===l||r+1===l)b=i.getValueInRange(e,1);else{let w=s.intersectRanges(e),k=c.intersectRanges(e);b=i.getValueInRange(w,1)+"\u2026"+i.getValueInRange(k,1)}o&&b.length>2*500&&(b=b.substring(0,500)+"\u2026"+b.substring(b.length-500,b.length));let S,y;return e.getDirection()===0?(S=p.length,y=p.length+b.length):(y=p.length,S=p.length+b.length),{value:p+b+v,selection:e,selectionStart:S,selectionEnd:y,startPositionWithinEditor:u.getStartPosition(),newlineCountBeforeSelection:u.endLineNumber-u.startLineNumber}}};function u5e(a,i){if(a.get(2)===1){let t=i.lookupKeybinding("editor.action.toggleScreenReaderAccessibilityMode")?.getAriaLabel(),o=i.lookupKeybinding("workbench.action.showCommands")?.getAriaLabel(),n=i.lookupKeybinding("workbench.action.openGlobalKeybindings")?.getAriaLabel(),r=d(176,null);return t?d(177,null,r,t):o?d(178,null,r,o):n?d(179,null,r,n):r}return a.get(8)}function Kii(a){let i=0,e=-1;do{if(e=a.indexOf(`
`,e+1),e===-1)break;i++}while(!0);return i}var Gii=class{constructor(){this._textAreaEditContextMapping=new Map}register(i,e){return this._textAreaEditContextMapping.set(i,e),{dispose:()=>{this._textAreaEditContextMapping.delete(i)}}}get(i){return this._textAreaEditContextMapping.get(i)}},QSt=new Gii;var $ii=class{constructor(i,e,t,o,n){this._context=i;this.modelLineNumber=e;this.distanceToModelLineStart=t;this.widthOfHiddenLineTextBefore=o;this.distanceToModelLineEnd=n;this._visibleTextAreaBrand=void 0;this.startPosition=null;this.endPosition=null;this.visibleTextareaStart=null;this.visibleTextareaEnd=null;this._previousPresentation=null}prepareRender(i){let e=new ye(this.modelLineNumber,this.distanceToModelLineStart+1),t=new ye(this.modelLineNumber,this._context.viewModel.model.getLineMaxColumn(this.modelLineNumber)-this.distanceToModelLineEnd);this.startPosition=this._context.viewModel.coordinatesConverter.convertModelPositionToViewPosition(e),this.endPosition=this._context.viewModel.coordinatesConverter.convertModelPositionToViewPosition(t),this.startPosition.lineNumber===this.endPosition.lineNumber?(this.visibleTextareaStart=i.visibleRangeForPosition(this.startPosition),this.visibleTextareaEnd=i.visibleRangeForPosition(this.endPosition)):(this.visibleTextareaStart=null,this.visibleTextareaEnd=null)}definePresentation(i){return this._previousPresentation||(i?this._previousPresentation=i:this._previousPresentation={foreground:1,italic:!1,bold:!1,underline:!1,strikethrough:!1}),this._previousPresentation}},qii=Ac,Nwe=class extends Pwe{constructor(e,t,o,n,r,s,l){super(t);this._keybindingService=s;this._instantiationService=l;this._primaryCursorPosition=new ye(1,1);this._primaryCursorVisibleRange=null;this._viewController=n,this._visibleRangeProvider=r,this._scrollLeft=0,this._scrollTop=0;let c=this._context.configuration.options,u=c.get(165);this._setAccessibilityOptions(c),this._contentLeft=u.contentLeft,this._contentWidth=u.contentWidth,this._contentHeight=u.height,this._fontInfo=c.get(59),this._emptySelectionClipboard=c.get(45),this._visibleTextArea=null,this._selections=[new ti(1,1,1,1)],this._modelSelections=[new ti(1,1,1,1)],this._lastRenderPosition=null,this.textArea=ur(document.createElement("textarea")),YS.write(this.textArea,7),this.textArea.setClassName(`inputarea ${kE}`),this.textArea.setAttribute("wrap",this._textAreaWrapping&&!this._visibleTextArea?"on":"off");let{tabSize:p}=this._context.viewModel.model.getOptions();this.textArea.domNode.style.tabSize=`${p*this._fontInfo.spaceWidth}px`,this.textArea.setAttribute("autocorrect","off"),this.textArea.setAttribute("autocapitalize","off"),this.textArea.setAttribute("autocomplete","off"),this.textArea.setAttribute("spellcheck","false"),this.textArea.setAttribute("aria-label",u5e(c,this._keybindingService)),this.textArea.setAttribute("aria-required",c.get(9)?"true":"false"),this.textArea.setAttribute("tabindex",String(c.get(140))),this.textArea.setAttribute("role","textbox"),this.textArea.setAttribute("aria-roledescription",d(180,null)),this.textArea.setAttribute("aria-multiline","true"),this.textArea.setAttribute("aria-autocomplete",c.get(104)?"none":"both"),this._ensureReadOnlyAttribute(),this.textAreaCover=ur(document.createElement("div")),this.textAreaCover.setPosition("absolute"),o.appendChild(this.textArea),o.appendChild(this.textAreaCover);let h=new Awe,g={context:this._context,getScreenReaderContent:()=>{if(this._accessibilitySupport===1){let b=this._selections[0];if(Ze&&b.isEmpty()){let y=b.getStartPosition(),w=this._getWordBeforePosition(y);if(w.length===0&&(w=this._getCharacterBeforePosition(y)),w.length>0)return new JS(w,w.length,w.length,z.fromPositions(y),0)}if(Ze&&!b.isEmpty()&&this._context.viewModel.getValueLengthInRange(b,0)<500){let y=this._context.viewModel.getValueInRange(b,0);return new JS(y,0,y.length,b,0)}if(Jb&&!b.isEmpty()){let y="vscode-placeholder";return new JS(y,0,y.length,null,void 0)}return JS.EMPTY}if(NXt){let b=this._selections[0];if(b.isEmpty()){let S=b.getStartPosition(),[y,w]=this._getAndroidWordAtPosition(S);if(y.length>0)return new JS(y,w,w,z.fromPositions(S),0)}return JS.EMPTY}let v=h.fromEditorSelection(this._context.viewModel,this._selections[0],this._accessibilityPageSize,this._accessibilitySupport===0);return JS.fromScreenReaderContentState(v)},deduceModelPosition:(v,b,S)=>this._context.viewModel.deduceModelPositionRelativeToViewPosition(v,b,S)},f=this._register(new Abt(this.textArea.domNode));this._textAreaInput=this._register(this._instantiationService.createInstance(gwe,g,f,Po,{isAndroid:NXt,isChrome:p1,isFirefox:Ac,isSafari:Jb})),this._register(this._textAreaInput.onWillCopy(v=>this._onWillCopy.fire(v))),this._register(this._textAreaInput.onWillCut(v=>this._onWillCut.fire(v))),this._register(this._textAreaInput.onWillPaste(v=>this._onWillPaste.fire(v))),this._register(this._textAreaInput.onKeyDown(v=>{this._viewController.emitKeyDown(v)})),this._register(this._textAreaInput.onKeyUp(v=>{this._viewController.emitKeyUp(v)})),this._register(this._textAreaInput.onPaste(v=>{let b=!1,S=null,y=null;v.metadata&&(b=this._emptySelectionClipboard&&!!v.metadata.isFromEmptySelection,S=typeof v.metadata.multicursorText<"u"?v.metadata.multicursorText:null,y=v.metadata.mode),this._viewController.paste(v.text,b,S,y)})),this._register(this._textAreaInput.onCut(()=>{this._viewController.cut()})),this._register(this._textAreaInput.onType(v=>{v.replacePrevCharCnt||v.replaceNextCharCnt||v.positionDelta?(R_&&console.log(` => compositionType: <<${v.text}>>, ${v.replacePrevCharCnt}, ${v.replaceNextCharCnt}, ${v.positionDelta}`),this._viewController.compositionType(v.text,v.replacePrevCharCnt,v.replaceNextCharCnt,v.positionDelta)):(R_&&console.log(` => type: <<${v.text}>>`),this._viewController.type(v.text))})),this._register(this._textAreaInput.onSelectionChangeRequest(v=>{this._viewController.setSelection(v)})),this._register(this._textAreaInput.onCompositionStart(v=>{let b=this.textArea.domNode,S=this._modelSelections[0],{distanceToModelLineStart:y,widthOfHiddenTextBefore:w}=(()=>{let T=b.value.substring(0,Math.min(b.selectionStart,b.selectionEnd)),P=T.lastIndexOf(`
`),O=T.substring(P+1),V=O.lastIndexOf("	"),H=O.length-V-1,G=S.getStartPosition(),$=Math.min(G.column-1,H),J=G.column-1-$,ae=O.substring(0,O.length-$),{tabSize:he}=this._context.viewModel.model.getOptions(),oe=_Vo(this.textArea.domNode.ownerDocument,ae,this._fontInfo,he);return{distanceToModelLineStart:J,widthOfHiddenTextBefore:oe}})(),{distanceToModelLineEnd:k}=(()=>{let T=b.value.substring(Math.max(b.selectionStart,b.selectionEnd)),P=T.indexOf(`
`),O=P===-1?T:T.substring(0,P),V=O.indexOf("	"),H=V===-1?O.length:O.length-V-1,G=S.getEndPosition(),$=Math.min(this._context.viewModel.model.getLineMaxColumn(G.lineNumber)-G.column,H);return{distanceToModelLineEnd:this._context.viewModel.model.getLineMaxColumn(G.lineNumber)-G.column-$}})();this._context.viewModel.revealRange("keyboard",!0,z.fromPositions(this._selections[0].getStartPosition()),0,1),this._visibleTextArea=new $ii(this._context,S.startLineNumber,y,w,k),this.textArea.setAttribute("wrap",this._textAreaWrapping&&!this._visibleTextArea?"on":"off"),this._visibleTextArea.prepareRender(this._visibleRangeProvider),this._render(),this.textArea.setClassName(`inputarea ${kE} ime-input`),this._viewController.compositionStart(),this._context.viewModel.onCompositionStart()})),this._register(this._textAreaInput.onCompositionUpdate(v=>{this._visibleTextArea&&(this._visibleTextArea.prepareRender(this._visibleRangeProvider),this._render())})),this._register(this._textAreaInput.onCompositionEnd(()=>{this._visibleTextArea=null,this.textArea.setAttribute("wrap",this._textAreaWrapping&&!this._visibleTextArea?"on":"off"),this._render(),this.textArea.setClassName(`inputarea ${kE}`),this._viewController.compositionEnd(),this._context.viewModel.onCompositionEnd()})),this._register(this._textAreaInput.onFocus(()=>{this._context.viewModel.setHasFocus(!0)})),this._register(this._textAreaInput.onBlur(()=>{this._context.viewModel.setHasFocus(!1)})),this._register(M_.onDidChange(()=>{this._ensureReadOnlyAttribute()})),this._register(QSt.register(e,this))}get domNode(){return this.textArea}writeScreenReaderContent(e){this._textAreaInput.writeNativeTextAreaContent(e)}getTextAreaDomNode(){return this.textArea.domNode}dispose(){super.dispose(),this.textArea.domNode.remove(),this.textAreaCover.domNode.remove()}_getAndroidWordAtPosition(e){let t='`~!@#$%^&*()-=+[{]}\\|;:",.<>/?',o=this._context.viewModel.getLineContent(e.lineNumber),n=wC(t,[]),r=!0,s=e.column,l=!0,c=e.column,u=0;for(;u<50&&(r||l);){if(r&&s<=1&&(r=!1),r){let p=o.charCodeAt(s-2);n.get(p)!==0?r=!1:s--}if(l&&c>o.length&&(l=!1),l){let p=o.charCodeAt(c-1);n.get(p)!==0?l=!1:c++}u++}return[o.substring(s-1,c-1),e.column-s]}_getWordBeforePosition(e){let t=this._context.viewModel.getLineContent(e.lineNumber),o=wC(this._context.configuration.options.get(148),[]),n=e.column,r=0;for(;n>1;){let s=t.charCodeAt(n-2);if(o.get(s)!==0||r>50)return t.substring(n-1,e.column-1);r++,n--}return t.substring(0,e.column-1)}_getCharacterBeforePosition(e){if(e.column>1){let o=this._context.viewModel.getLineContent(e.lineNumber).charAt(e.column-2);if(!ju(o.charCodeAt(0)))return o}return""}_setAccessibilityOptions(e){this._accessibilitySupport=e.get(2);let t=e.get(3);this._accessibilitySupport===2&&t===iS.accessibilityPageSize.defaultValue?this._accessibilityPageSize=500:this._accessibilityPageSize=t;let n=e.get(165).wrappingColumn;if(n!==-1&&this._accessibilitySupport!==1){let r=e.get(59);this._textAreaWrapping=!0,this._textAreaWidth=Math.round(n*r.typicalHalfwidthCharacterWidth)}else this._textAreaWrapping=!1,this._textAreaWidth=qii?0:1}onConfigurationChanged(e){let t=this._context.configuration.options,o=t.get(165);this._setAccessibilityOptions(t),this._contentLeft=o.contentLeft,this._contentWidth=o.contentWidth,this._contentHeight=o.height,this._fontInfo=t.get(59),this._emptySelectionClipboard=t.get(45),this.textArea.setAttribute("wrap",this._textAreaWrapping&&!this._visibleTextArea?"on":"off");let{tabSize:n}=this._context.viewModel.model.getOptions();return this.textArea.domNode.style.tabSize=`${n*this._fontInfo.spaceWidth}px`,this.textArea.setAttribute("aria-label",u5e(t,this._keybindingService)),this.textArea.setAttribute("aria-required",t.get(9)?"true":"false"),this.textArea.setAttribute("tabindex",String(t.get(140))),(e.hasChanged(41)||e.hasChanged(104))&&this._ensureReadOnlyAttribute(),e.hasChanged(2)&&this._textAreaInput.writeNativeTextAreaContent("strategy changed"),!0}onCursorStateChanged(e){return this._selections=e.selections.slice(0),this._modelSelections=e.modelSelections.slice(0),this._textAreaInput.writeNativeTextAreaContent("selection changed"),!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return this._scrollLeft=e.scrollLeft,this._scrollTop=e.scrollTop,!0}onZonesChanged(e){return!0}isFocused(){return this._textAreaInput.isFocused()}focus(){this._textAreaInput.focusTextArea()}refreshFocusState(){this._textAreaInput.refreshFocusState()}getLastRenderData(){return this._lastRenderPosition}setAriaOptions(e){e.activeDescendant?(this.textArea.setAttribute("aria-haspopup","true"),this.textArea.setAttribute("aria-autocomplete","list"),this.textArea.setAttribute("aria-activedescendant",e.activeDescendant)):(this.textArea.setAttribute("aria-haspopup","false"),this.textArea.setAttribute("aria-autocomplete","both"),this.textArea.removeAttribute("aria-activedescendant")),e.role&&this.textArea.setAttribute("role",e.role)}_ensureReadOnlyAttribute(){let e=this._context.configuration.options;!M_.enabled||e.get(41)&&e.get(104)?this.textArea.setAttribute("readonly","true"):this.textArea.removeAttribute("readonly")}prepareRender(e){this._primaryCursorPosition=new ye(this._selections[0].positionLineNumber,this._selections[0].positionColumn),this._primaryCursorVisibleRange=e.visibleRangeForPosition(this._primaryCursorPosition),this._visibleTextArea?.prepareRender(e)}render(e){this._textAreaInput.writeNativeTextAreaContent("render"),this._render()}_render(){if(this._visibleTextArea){let o=this._visibleTextArea.visibleTextareaStart,n=this._visibleTextArea.visibleTextareaEnd,r=this._visibleTextArea.startPosition,s=this._visibleTextArea.endPosition;if(r&&s&&o&&n&&n.left>=this._scrollLeft&&o.left<=this._scrollLeft+this._contentWidth){let l=this._context.viewLayout.getVerticalOffsetForLineNumber(this._primaryCursorPosition.lineNumber)-this._scrollTop,c=Kii(this.textArea.domNode.value.substr(0,this.textArea.domNode.selectionStart)),u=this._visibleTextArea.widthOfHiddenLineTextBefore,p=this._contentLeft+o.left-this._scrollLeft,h=n.left-o.left+1;if(p<this._contentLeft){let k=this._contentLeft-p;p+=k,u+=k,h-=k}h>this._contentWidth&&(h=this._contentWidth);let g=this._context.viewLayout.getLineHeightForLineNumber(r.lineNumber),f=this._context.viewModel.getFontSizeAtPosition(this._primaryCursorPosition),v=this._context.viewModel.getViewLineData(r.lineNumber),b=v.tokens.findTokenIndexAtOffset(r.column-1),S=v.tokens.findTokenIndexAtOffset(s.column-1),y=b===S,w=this._visibleTextArea.definePresentation(y?v.tokens.getPresentation(b):null);this.textArea.domNode.scrollTop=c*g,this.textArea.domNode.scrollLeft=u,this._doRender({lastRenderPosition:null,top:l,left:p,width:h,height:g,useCover:!1,color:(ic.getColorMap()||[])[w.foreground],italic:w.italic,bold:w.bold,underline:w.underline,strikethrough:w.strikethrough,fontSize:f})}return}if(!this._primaryCursorVisibleRange){this._renderAtTopLeft();return}let e=this._contentLeft+this._primaryCursorVisibleRange.left-this._scrollLeft;if(e<this._contentLeft||e>this._contentLeft+this._contentWidth){this._renderAtTopLeft();return}let t=this._context.viewLayout.getVerticalOffsetForLineNumber(this._selections[0].positionLineNumber)-this._scrollTop;if(t<0||t>this._contentHeight){this._renderAtTopLeft();return}if(Ze||this._accessibilitySupport===2){let o=this._primaryCursorPosition.lineNumber,n=this._context.viewLayout.getLineHeightForLineNumber(o);this._doRender({lastRenderPosition:this._primaryCursorPosition,top:t,left:this._textAreaWrapping?this._contentLeft:e,width:this._textAreaWidth,height:n,useCover:!1}),this.textArea.domNode.scrollLeft=this._primaryCursorVisibleRange.left;let r=this._textAreaInput.textAreaState.newlineCountBeforeSelection??Kii(this.textArea.domNode.value.substring(0,this.textArea.domNode.selectionStart));this.textArea.domNode.scrollTop=r*n;return}this._doRender({lastRenderPosition:this._primaryCursorPosition,top:t,left:this._textAreaWrapping?this._contentLeft:e,width:this._textAreaWidth,height:qii?0:1,useCover:!1})}_renderAtTopLeft(){this._doRender({lastRenderPosition:null,top:0,left:0,width:this._textAreaWidth,height:qii?0:1,useCover:!0})}_doRender(e){this._lastRenderPosition=e.lastRenderPosition;let t=this.textArea,o=this.textAreaCover;Jd(t,this._fontInfo),t.setTop(e.top),t.setLeft(e.left),t.setWidth(e.width),t.setHeight(e.height),t.setLineHeight(e.height),t.setFontSize(e.fontSize??this._fontInfo.fontSize),t.setColor(e.color?We.Format.CSS.formatHex(e.color):""),t.setFontStyle(e.italic?"italic":""),e.bold&&t.setFontWeight("bold"),t.setTextDecoration(`${e.underline?" underline":""}${e.strikethrough?" line-through":""}`),o.setTop(e.useCover?e.top:0),o.setLeft(e.useCover?e.left:0),o.setWidth(e.useCover?e.width:0),o.setHeight(e.useCover?e.height:0);let n=this._context.configuration.options;n.get(66)?o.setClassName("monaco-editor-background textAreaCover "+_we.OUTER_CLASS_NAME):n.get(76).renderType!==0?o.setClassName("monaco-editor-background textAreaCover "+Ewe.CLASS_NAME):o.setClassName("monaco-editor-background textAreaCover")}};Nwe=I([m(5,_e),m(6,F)],Nwe);function _Vo(a,i,e,t){if(i.length===0)return 0;let o=a.createElement("div");o.style.position="absolute",o.style.top="-50000px",o.style.width="50000px";let n=a.createElement("span");Jd(n,e),n.style.whiteSpace="pre",n.style.tabSize=`${t*e.spaceWidth}px`,n.append(i),o.appendChild(n),a.body.appendChild(o);let r=n.offsetWidth;return o.remove(),r}var Owe=class extends x{constructor(e,t,o){super();this._domNode=t;this._onFocusChange=o;this._isFocused=!1;this._isPaused=!1;this._register(j(this._domNode,"focus",()=>{e.trace("NativeEditContext.focus"),!this._isPaused&&this.refreshFocusState()})),this._register(j(this._domNode,"blur",()=>{e.trace("NativeEditContext.blur"),!this._isPaused&&this._handleFocusedChanged(!1)}))}pause(){this._isPaused=!0}resume(){this._isPaused=!1,this.refreshFocusState()}_handleFocusedChanged(e){this._isFocused!==e&&(this._isFocused=e,this._onFocusChange(this._isFocused))}focus(){this._domNode.focus(),this.refreshFocusState()}refreshFocusState(){let e=bP(this._domNode),t=e?e.activeElement:Nn(),o=this._domNode===t;this._handleFocusedChanged(o)}get isFocused(){return this._isFocused}};Owe=I([m(0,se)],Owe);function Fwe(a,i,e,t){return a.addEventListener(i,e,t),{dispose(){a.removeEventListener(i,e)}}}var DVo=pf("richScreenReaderContent",{createHTML:a=>a}),jii="data-line-number",Wwe=class extends x{constructor(e,t,o,n){super();this._domNode=e;this._context=t;this._viewController=o;this._accessibilityService=n;this._selectionChangeListener=this._register(new me);this._accessibilityPageSize=1;this._ignoreSelectionChangeTime=0;this._state=p5e.NULL;this._strategy=new Xii;this._renderedLines=new Map;this._renderedSelection=new ti(1,1,1,1);this.onConfigurationChanged(this._context.configuration.options)}updateScreenReaderContent(e){let t=Ki().document.activeElement;if(!t||t!==this._domNode.domNode)return;if(this._accessibilityService.isScreenReaderOptimized()){let n=this._getScreenReaderContentLineIntervals(e);this._state.equals(n)||(this._state=n,this._renderedLines=this._renderScreenReaderContent(n)),this._renderedSelection.equalsSelection(e)||(this._renderedSelection=e,this._setSelectionOnScreenReaderContent(this._context,this._renderedLines,e))}else this._state=p5e.NULL,this._setIgnoreSelectionChangeTime("setValue"),this._domNode.domNode.textContent=""}updateScrollTop(e){let t=this._state.intervals;if(!t.length)return;let o=this._context.viewModel.viewLayout,n=t[0].startLine,r=o.getVerticalOffsetForLineNumber(n),s=o.getVerticalOffsetForLineNumber(e.positionLineNumber);this._domNode.domNode.scrollTop=s-r}onFocusChange(e){e?this._selectionChangeListener.value=this._setSelectionChangeListener():this._selectionChangeListener.value=void 0}onConfigurationChanged(e){this._accessibilityPageSize=e.get(3)}onWillCut(){this._setIgnoreSelectionChangeTime("onCut")}onWillPaste(){this._setIgnoreSelectionChangeTime("onWillPaste")}_setIgnoreSelectionChangeTime(e){this._ignoreSelectionChangeTime=Date.now()}_setSelectionChangeListener(){let e=0;return j(this._domNode.domNode.ownerDocument,"selectionchange",()=>{if(!(Ki().document.activeElement===this._domNode.domNode)||!this._accessibilityService.isScreenReaderOptimized()||!M_.enabled)return;let r=Date.now(),s=r-e;if(e=r,s<5)return;let l=r-this._ignoreSelectionChangeTime;if(this._ignoreSelectionChangeTime=0,l<100)return;let c=this._getEditorSelectionFromDomRange();c&&this._viewController.setSelection(c)})}_renderScreenReaderContent(e){let t=[],o=new Map;for(let n of e.intervals)for(let r=n.startLine;r<=n.endLine;r++){let s=this._renderLine(r);o.set(r,s),t.push(s.domNode)}return this._setIgnoreSelectionChangeTime("setValue"),this._domNode.domNode.replaceChildren(...t),o}_renderLine(e){let t=this._context.viewModel,o=t.getViewLineRenderingData(e),n=this._context.configuration.options,r=n.get(59),s=n.get(133),l=n.get(108),c=n.get(60),u=n.get(40),p=db.filter(o.inlineDecorations,e,o.minColumn,o.maxColumn),h=r.isMonospace&&!u,g=c!==Bx.OFF,f;n.get(47)==="off"?f=n.get(113):f="none";let b=new XL(h,r.canUseHalfwidthRightwardsArrow,o.content,o.continuesWithWrappedLine,o.isBasicASCII,o.containsRTL,o.minColumn-1,o.tokens,p,o.tabSize,o.startVisibleColumn,r.spaceWidth,r.middotWidth,r.wsmiddotWidth,s,f,l,g,null,null,0,!0),S=new $S(1e4),y=AV(b,S),w=S.build(),k=DVo?.createHTML(w)??w,T=t.viewLayout.getLineHeightForLineNumber(e)+"px",P=document.createElement("div");return P.innerHTML=k,P.style.lineHeight=T,P.style.height=T,P.setAttribute(jii,e.toString()),new Qii(P,y.characterMapping)}_setSelectionOnScreenReaderContent(e,t,o){let r=Ki().document.getSelection();if(!r)return;let s=o.startLineNumber,l=o.endLineNumber,c=t.get(s),u=t.get(l);if(!c||!u)return;let p=e.viewModel,h=p.model,g=p.coordinatesConverter,f=new z(s,1,s,o.selectionStartColumn),v=g.convertViewRangeToModelRange(f),b=h.getCharacterCountInRange(v),S=new z(l,1,l,o.positionColumn),y=g.convertViewRangeToModelRange(S),w=h.getCharacterCountInRange(y),k=c.characterMapping.getDomPosition(b),T=u.characterMapping.getDomPosition(w),P=c.domNode.firstChild,O=u.domNode.firstChild,V=P.childNodes,H=O.childNodes,G=V.item(k.partIndex),$=H.item(T.partIndex);!G.firstChild||!$.firstChild||(this._setIgnoreSelectionChangeTime("setRange"),r.setBaseAndExtent(G.firstChild,o.startColumn===1?0:k.charIndex+1,$.firstChild,o.endColumn===1?0:T.charIndex+1))}_getScreenReaderContentLineIntervals(e){return this._strategy.fromEditorSelection(this._context.viewModel,e,this._accessibilityPageSize)}_getEditorSelectionFromDomRange(){if(!this._renderedLines)return;let e=Ki().document.getSelection();if(!e||e.rangeCount===0)return;let o=e.getRangeAt(0),n=o.startContainer,r=o.endContainer,s=n.parentElement,l=r.parentElement;if(!s||!Do(s)||!l||!Do(l))return;let c=s.parentElement?.parentElement,u=l.parentElement?.parentElement;if(!c||!u)return;let p=c.getAttribute(jii),h=u.getAttribute(jii);if(!p||!h)return;let g=parseInt(p),f=parseInt(h),v=this._renderedLines.get(g)?.characterMapping,b=this._renderedLines.get(f)?.characterMapping;if(!v||!b)return;let S=gj(v,s,o.startOffset),y=gj(b,l,o.endOffset);return e.direction==="forward"?new ti(g,S,f,y):new ti(f,y,g,S)}};Wwe=I([m(3,Oi)],Wwe);var Qii=class{constructor(i,e){this.domNode=i;this.characterMapping=e}},Yii=class{constructor(i,e){this.startLine=i;this.endLine=e}},p5e=class a{constructor(i,e){this.intervals=e;let t="";for(let o of e)for(let n=o.startLine;n<=o.endLine;n++)t+=i.getLineContent(n)+`
`;this.value=t}equals(i){return this.value===i.value}static get NULL(){let i={getLineContent:()=>"",getLineCount:()=>1,getLineMaxColumn:()=>1,getValueInRange:()=>"",getValueLengthInRange:()=>0,modifyPosition:(e,t)=>e};return new a(i,[])}},Xii=class{constructor(){}_getPageOfLine(i,e){return Math.floor((i-1)/e)}_getRangeForPage(i,e,t){let o=e*t,n=o+1,r=Math.min(o+t,i.getLineCount());return new Yii(n,r)}fromEditorSelection(i,e,t){let o=this._getPageOfLine(e.startLineNumber,t),n=this._getRangeForPage(i,o,t),r=this._getPageOfLine(e.endLineNumber,t),s=this._getRangeForPage(i,r,t),l=[{startLine:n.startLine,endLine:n.endLine}];return o+1<r&&l.push({startLine:s.startLine,endLine:s.endLine}),new p5e(i,l)}};var Vwe=class extends x{constructor(e,t,o,n){super();this._domNode=e;this._context=t;this._viewController=o;this._accessibilityService=n;this._selectionChangeListener=this._register(new me);this._accessibilityPageSize=1;this._ignoreSelectionChangeTime=0;this._strategy=new Awe;this.onConfigurationChanged(this._context.configuration.options)}updateScreenReaderContent(e){let t=this._domNode.domNode,o=Ki().document.activeElement;if(!o||o!==t)return;if(this._accessibilityService.isScreenReaderOptimized()){this._state=this._getScreenReaderContentState(e),t.textContent!==this._state.value&&(this._setIgnoreSelectionChangeTime("setValue"),t.textContent=this._state.value);let r=Ki().document.getSelection();if(!r)return;let s=this._getScreenReaderRange(this._state.selectionStart,this._state.selectionEnd);if(!s)return;this._setIgnoreSelectionChangeTime("setRange"),r.setBaseAndExtent(s.anchorNode,s.anchorOffset,s.focusNode,s.focusOffset)}else this._state=void 0,this._setIgnoreSelectionChangeTime("setValue"),this._domNode.domNode.textContent=""}updateScrollTop(e){if(!this._state)return;let t=this._context.viewModel.viewLayout,o=this._state.startPositionWithinEditor.lineNumber,n=t.getVerticalOffsetForLineNumber(o),r=t.getVerticalOffsetForLineNumber(e.positionLineNumber);this._domNode.domNode.scrollTop=r-n}onFocusChange(e){e?this._selectionChangeListener.value=this._setSelectionChangeListener():this._selectionChangeListener.value=void 0}onConfigurationChanged(e){this._accessibilityPageSize=e.get(3)}onWillCut(){this._setIgnoreSelectionChangeTime("onCut")}onWillPaste(){this._setIgnoreSelectionChangeTime("onWillPaste")}_setIgnoreSelectionChangeTime(e){this._ignoreSelectionChangeTime=Date.now()}_setSelectionChangeListener(){let e=0;return j(this._domNode.domNode.ownerDocument,"selectionchange",()=>{let t=this._accessibilityService.isScreenReaderOptimized();if(!this._state||!t||!M_.enabled||!(Ki().document.activeElement===this._domNode.domNode))return;let r=Ki().document.getSelection();if(!r||r.rangeCount===0)return;let l=r.getRangeAt(0),c=Date.now(),u=c-e;if(e=c,u<5)return;let p=c-this._ignoreSelectionChangeTime;this._ignoreSelectionChangeTime=0,!(p<100)&&this._viewController.setSelection(this._getEditorSelectionFromDomRange(this._context,this._state,r.direction,l))})}_getScreenReaderContentState(e){let t=this._strategy.fromEditorSelection(this._context.viewModel,e,this._accessibilityPageSize,this._accessibilityService.getAccessibilitySupport()===0),o=this._context.viewModel.model.getPositionAt(1/0),n=t.value;return o.column===1&&e.getEndPosition().equals(o)&&(n+=`
`),t.value=n,t}_getScreenReaderRange(e,t){let o=this._domNode.domNode.firstChild;if(!o)return;let n=new globalThis.Range;return n.setStart(o,e),n.setEnd(o,t),{anchorNode:o,anchorOffset:e,focusNode:o,focusOffset:t}}_getEditorSelectionFromDomRange(e,t,o,n){let r=e.viewModel,s=r.model,c=r.coordinatesConverter.convertViewPositionToModelPosition(t.startPositionWithinEditor),u=s.getOffsetAt(c),p=n.startOffset+u,h=n.endOffset+u;if(s.getEndOfLineSequence()===1){let y=t.value,w=new EP(y),k=w.getPosition(n.startOffset),T=w.getPosition(n.endOffset);p+=k.lineNumber-1,h+=T.lineNumber-1}let f=s.getPositionAt(p),v=s.getPositionAt(h),b=o==="forward"?f:v,S=o==="forward"?v:f;return ti.fromPositions(b,S)}};Vwe=I([m(3,Oi)],Vwe);var Hwe=class extends x{constructor(e,t,o,n,r){super();this._domNode=e;this._context=t;this._viewController=o;this._keybindingService=n;this._accessibilityService=r;this._contentLeft=1;this._contentWidth=1;this._contentHeight=1;this._divWidth=1;this._primarySelection=new ti(1,1,1,1);this._primaryCursorVisibleRange=null;this._state=this._register(new me),this._instantiateScreenReaderContent(),this._updateConfigurationSettings(),this._updateDomAttributes()}onWillPaste(){this._state.value?.onWillPaste()}onWillCut(){this._state.value?.onWillCut()}handleFocusChange(e){this._state.value?.onFocusChange(e),this.writeScreenReaderContent()}onConfigurationChanged(e){this._instantiateScreenReaderContent(),this._updateConfigurationSettings(),this._updateDomAttributes(),e.hasChanged(2)&&this.writeScreenReaderContent()}_instantiateScreenReaderContent(){let e=this._context.configuration.options.get(107);this._renderRichContent!==e&&(this._renderRichContent=e,this._state.value=this._createScreenReaderContent(e))}_createScreenReaderContent(e){return e?new Wwe(this._domNode,this._context,this._viewController,this._accessibilityService):new Vwe(this._domNode,this._context,this._viewController,this._accessibilityService)}_updateConfigurationSettings(){let e=this._context.configuration.options,t=e.get(165),o=t.wrappingColumn;this._contentLeft=t.contentLeft,this._contentWidth=t.contentWidth,this._contentHeight=t.height,this._fontInfo=e.get(59),this._divWidth=Math.round(o*this._fontInfo.typicalHalfwidthCharacterWidth),this._state.value?.onConfigurationChanged(e)}_updateDomAttributes(){let e=this._context.configuration.options;this._domNode.domNode.setAttribute("role","textbox"),this._domNode.domNode.setAttribute("aria-required",e.get(9)?"true":"false"),this._domNode.domNode.setAttribute("aria-multiline","true"),this._domNode.domNode.setAttribute("aria-autocomplete",e.get(104)?"none":"both"),this._domNode.domNode.setAttribute("aria-roledescription",d(175,null)),this._domNode.domNode.setAttribute("aria-label",u5e(e,this._keybindingService));let t=this._context.viewModel.model.getOptions().tabSize,o=e.get(59).spaceWidth;this._domNode.domNode.style.tabSize=`${t*o}px`;let n=e.get(154),r=n==="inherit"?e.get(153):n,s=r==="inherit"?e.get(149):r;this._domNode.domNode.style.textWrap=s==="off"?"nowrap":"wrap"}onCursorStateChanged(e){this._primarySelection=e.selections[0]??new ti(1,1,1,1)}prepareRender(e){this.writeScreenReaderContent(),this._primaryCursorVisibleRange=e.visibleRangeForPosition(this._primarySelection.getPosition())}render(e){if(!this._primaryCursorVisibleRange){this._renderAtTopLeft();return}let t=this._context.viewLayout.getCurrentScrollLeft(),o=this._contentLeft+this._primaryCursorVisibleRange.left-t;if(o<this._contentLeft||o>this._contentLeft+this._contentWidth){this._renderAtTopLeft();return}let n=this._context.viewLayout.getCurrentScrollTop(),r=this._primarySelection.positionLineNumber,s=this._context.viewLayout.getVerticalOffsetForLineNumber(r)-n;if(s<0||s>this._contentHeight){this._renderAtTopLeft();return}let l=this._context.viewLayout.getLineHeightForLineNumber(r);this._doRender(s,this._contentLeft,this._divWidth,l),this._state.value?.updateScrollTop(this._primarySelection)}_renderAtTopLeft(){this._doRender(0,0,this._contentWidth,1)}_doRender(e,t,o,n){Jd(this._domNode,this._fontInfo),this._domNode.setTop(e),this._domNode.setLeft(t),this._domNode.setWidth(o),this._domNode.setHeight(n),this._domNode.setLineHeight(n)}setAriaOptions(e){e.activeDescendant?(this._domNode.setAttribute("aria-haspopup","true"),this._domNode.setAttribute("aria-autocomplete","list"),this._domNode.setAttribute("aria-activedescendant",e.activeDescendant)):(this._domNode.setAttribute("aria-haspopup","false"),this._domNode.setAttribute("aria-autocomplete","both"),this._domNode.removeAttribute("aria-activedescendant")),e.role&&this._domNode.setAttribute("role",e.role)}writeScreenReaderContent(){this._state.value?.updateScreenReaderContent(this._primarySelection)}};Hwe=I([m(3,_e),m(4,Oi)],Hwe);var Jii;(i=>{function a(e,t){return new e.EditContext(t)}i.create=a})(Jii||={});var Zii=class{constructor(){this._nativeEditContextMapping=new Map}register(i,e){return this._nativeEditContextMapping.set(i,e),{dispose:()=>{this._nativeEditContextMapping.delete(i)}}}get(i){return this._nativeEditContextMapping.get(i)}},Rle=new Zii;var Mle=class extends Pwe{constructor(e,t,o,n,r,s,l){super(t);this._viewController=n;this._visibleRangeProvider=r;this.logService=l;this._previousEditContextSelection=new pi(0,0);this._previousEditContextText="";this._editContextPrimarySelection=new ti(1,1,1,1);this._parentBounds=null;this._decorations=[];this._primarySelection=new ti(1,1,1,1);this._targetWindowId=-1;this._scrollTop=0;this._scrollLeft=0;this._linesVisibleRanges=null;this.domNode=new cf(document.createElement("div")),this.domNode.setClassName("native-edit-context"),this._imeTextArea=new cf(document.createElement("textarea")),this._imeTextArea.setClassName("ime-text-area"),this._imeTextArea.setAttribute("readonly","true"),this._imeTextArea.setAttribute("tabindex","-1"),this._imeTextArea.setAttribute("aria-hidden","true"),this.domNode.setAttribute("autocorrect","off"),this.domNode.setAttribute("autocapitalize","off"),this.domNode.setAttribute("autocomplete","off"),this.domNode.setAttribute("spellcheck","false"),this._updateDomAttributes(),o.appendChild(this.domNode),o.appendChild(this._imeTextArea),this._parent=o.domNode,this._focusTracker=this._register(new Owe(l,this.domNode.domNode,h=>{l.trace("NativeEditContext#handleFocusChange : ",h),this._screenReaderSupport.handleFocusChange(h),this._context.viewModel.setHasFocus(h)}));let c=Re(this.domNode.domNode);this._editContext=Jii.create(c),this.setEditContextOnDomNode(),this._screenReaderSupport=this._register(s.createInstance(Hwe,this.domNode,t,this._viewController)),this._register(j(this.domNode.domNode,"copy",h=>{this.logService.trace("NativeEditContext#copy"),Z1.electronBugWorkaroundCopyEventHasFired=!0;let g=hwe(h,!1,this._context,this.logService,Ac);this._onWillCopy.fire(g),!g.isHandled&&g.ensureClipboardGetsEditorData()})),this._register(j(this.domNode.domNode,"cut",h=>{this.logService.trace("NativeEditContext#cut");let g=hwe(h,!0,this._context,this.logService,Ac);this._onWillCut.fire(g),!g.isHandled&&(this._screenReaderSupport.onWillCut(),g.ensureClipboardGetsEditorData(),this.logService.trace("NativeEditContext#cut (before viewController.cut)"),this._viewController.cut())})),this._register(j(this.domNode.domNode,"selectionchange",()=>{Kx.onSelectionChange()})),this._register(j(this.domNode.domNode,"keyup",h=>this._onKeyUp(h))),this._register(j(this.domNode.domNode,"keydown",async h=>this._onKeyDown(h))),this._register(j(this._imeTextArea.domNode,"keyup",h=>this._onKeyUp(h))),this._register(j(this._imeTextArea.domNode,"keydown",async h=>this._onKeyDown(h))),this._register(j(this.domNode.domNode,"beforeinput",async h=>{Kx.onBeforeInput(),(h.inputType==="insertParagraph"||h.inputType==="insertLineBreak")&&this._onType(this._viewController,{text:`
`,replacePrevCharCnt:0,replaceNextCharCnt:0,positionDelta:0})})),this._register(j(this.domNode.domNode,"paste",h=>{this.logService.trace("NativeEditContext#paste");let g=Pbt(h);if(this._onWillPaste.fire(g),g.isHandled){h.preventDefault();return}if(h.preventDefault(),!h.clipboardData||(this.logService.trace("NativeEditContext#paste with id : ",g.metadata?.id," with text.length: ",g.text.length),!g.text))return;let f=!1,v=null,b=null;g.metadata&&(f=this._context.configuration.options.get(45)&&!!g.metadata.isFromEmptySelection,v=typeof g.metadata.multicursorText<"u"?g.metadata.multicursorText:null,b=g.metadata.mode),this.logService.trace("NativeEditContext#paste (before viewController.paste)"),this._viewController.paste(g.text,f,v,b)})),this._register(Fwe(this._editContext,"textformatupdate",h=>this._handleTextFormatUpdate(h))),this._register(Fwe(this._editContext,"characterboundsupdate",h=>this._updateCharacterBounds(h)));let u;this._register(Fwe(this._editContext,"textupdate",h=>{Kx.onInput();let g=h.text;if(g.length===1){let f=g.charCodeAt(0);if(ju(f)){u=g;return}if(ZN(f)&&u){let v={text:u+g,selectionEnd:h.selectionEnd,selectionStart:h.selectionStart,updateRangeStart:h.updateRangeStart-1,updateRangeEnd:h.updateRangeEnd-1};u=void 0,this._emitTypeEvent(this._viewController,v);return}}this._emitTypeEvent(this._viewController,h)})),this._register(Fwe(this._editContext,"compositionstart",h=>{this._updateEditContext(),this._viewController.compositionStart(),this._context.viewModel.onCompositionStart()})),this._register(Fwe(this._editContext,"compositionend",h=>{this._updateEditContext(),this._viewController.compositionEnd(),this._context.viewModel.onCompositionEnd()}));let p=!1;this._register(M_.onDidChange(()=>{M_.enabled&&p&&(this._focusTracker.resume(),this.domNode.focus(),p=!1),!M_.enabled&&this.isFocused()&&(this._focusTracker.pause(),this._imeTextArea.focus(),p=!0)})),this._register(Rle.register(e,this)),this._register(t.viewModel.model.onDidChangeContent(h=>{let g=!1;for(let f of h.changes)if(f.range.startLineNumber<=this._editContextPrimarySelection.endLineNumber&&f.range.endLineNumber>=this._editContextPrimarySelection.startLineNumber){g=!0;break}g&&this._updateEditContext()}))}dispose(){this.domNode.domNode.editContext=void 0,this.domNode.domNode.blur(),this.domNode.domNode.remove(),this._imeTextArea.domNode.remove(),super.dispose()}setAriaOptions(e){this._screenReaderSupport.setAriaOptions(e)}getLastRenderData(){return this._primarySelection.getPosition()}onBeforeRender(e){this._parentBounds=this._parent.getBoundingClientRect()}prepareRender(e){this._screenReaderSupport.prepareRender(e),this._updateSelectionAndControlBoundsData(e)}render(e){this._screenReaderSupport.render(e),this._updateSelectionAndControlBounds()}onCursorStateChanged(e){return this._primarySelection=e.modelSelections[0]??new ti(1,1,1,1),this._screenReaderSupport.onCursorStateChanged(e),this._updateEditContext(),!0}onConfigurationChanged(e){return this._screenReaderSupport.onConfigurationChanged(e),this._updateDomAttributes(),!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return this._scrollLeft=e.scrollLeft,this._scrollTop=e.scrollTop,!0}onZonesChanged(e){return!0}handleWillPaste(){this.logService.trace("NativeEditContext#handleWillPaste"),this._prepareScreenReaderForPaste()}_prepareScreenReaderForPaste(){this._screenReaderSupport.onWillPaste()}handleWillCopy(){this.logService.trace("NativeEditContext#handleWillCopy"),this.logService.trace("NativeEditContext#isFocused : ",this.domNode.domNode===Nn())}writeScreenReaderContent(){this._screenReaderSupport.writeScreenReaderContent()}isFocused(){return this._focusTracker.isFocused}focus(){this._focusTracker.focus(),this.refreshFocusState()}refreshFocusState(){this._focusTracker.refreshFocusState()}setEditContextOnDomNode(){let e=Re(this.domNode.domNode),t=gv(e);this._targetWindowId!==t&&(this.domNode.domNode.editContext=this._editContext,this._targetWindowId=t)}_onKeyUp(e){Kx.onKeyUp(),this._viewController.emitKeyUp(new gi(e))}_onKeyDown(e){Kx.onKeyDown();let t=new gi(e);t.keyCode===114&&t.stopPropagation(),this._viewController.emitKeyDown(t)}_updateDomAttributes(){let e=this._context.configuration.options;this.domNode.domNode.setAttribute("tabindex",String(e.get(140)))}_updateEditContext(){let e=this._getNewEditContextState();if(!e)return;let t=e.text??" ";t!==this._previousEditContextText&&(this._editContext.updateText(0,this._previousEditContextText.length,t),this._previousEditContextText=t),(e.selectionStartOffset!==this._previousEditContextSelection.start||e.selectionEndOffset!==this._previousEditContextSelection.endExclusive)&&this._editContext.updateSelection(e.selectionStartOffset,e.selectionEndOffset),this._editContextPrimarySelection=e.editContextPrimarySelection,this._previousEditContextSelection=new pi(e.selectionStartOffset,e.selectionEndOffset)}_emitTypeEvent(e,t){if(!this._editContext)return;let o=this._previousEditContextSelection.endExclusive,n=this._previousEditContextSelection.start;this._previousEditContextSelection=new pi(t.selectionStart,t.selectionEnd);let r=0,s=0;t.updateRangeEnd>o&&(r=t.updateRangeEnd-o),t.updateRangeStart<n&&(s=n-t.updateRangeStart);let l="";n<t.updateRangeStart&&(l+=this._editContext.text.substring(n,t.updateRangeStart)),l+=t.text,o>t.updateRangeEnd&&(l+=this._editContext.text.substring(t.updateRangeEnd,o));let c=0;t.selectionStart===t.selectionEnd&&n===o&&(c=t.selectionStart-(t.updateRangeStart+t.text.length));let u={text:l,replacePrevCharCnt:s,replaceNextCharCnt:r,positionDelta:c};this._onType(e,u)}_onType(e,t){t.replacePrevCharCnt||t.replaceNextCharCnt||t.positionDelta?e.compositionType(t.text,t.replacePrevCharCnt,t.replaceNextCharCnt,t.positionDelta):e.type(t.text)}_getNewEditContextState(){let e=this._primarySelection,t=this._context.viewModel.model;if(!t.isValidRange(e))return;let o=e.startLineNumber,n=e.endLineNumber,r=t.getLineMaxColumn(n),s=new z(o,1,n,r),l=t.getValueInRange(s,0),c=e.startColumn-1,u=l.length+e.endColumn-r;return{text:l,selectionStartOffset:c,selectionEndOffset:u,editContextPrimarySelection:e}}_editContextStartPosition(){return new ye(this._editContextPrimarySelection.startLineNumber,1)}_handleTextFormatUpdate(e){if(!this._editContext)return;let t=e.getTextFormats(),o=this._editContextStartPosition(),n=[];t.forEach(r=>{let s=this._context.viewModel.model,l=s.getOffsetAt(o),c=s.getPositionAt(l+r.rangeStart),u=s.getPositionAt(l+r.rangeEnd),p=z.fromPositions(c,u),h=r.underlineThickness.toLowerCase(),g="edit-context-composition-none";switch(h){case"thin":g="edit-context-composition-secondary";break;case"thick":g="edit-context-composition-primary";break}n.push({range:p,options:{description:"textFormatDecoration",inlineClassName:g}})}),this._decorations=this._context.viewModel.model.deltaDecorations(this._decorations,n)}_updateSelectionAndControlBoundsData(e){let t=this._context.viewModel.coordinatesConverter.convertModelRangeToViewRange(this._primarySelection);if(this._primarySelection.isEmpty()){let o=e.visibleRangeForPosition(t.getStartPosition());this._linesVisibleRanges=o}else this._linesVisibleRanges=null}_updateSelectionAndControlBounds(){let t=this._context.configuration.options.get(165).contentLeft,o=this._context.viewModel.coordinatesConverter.convertModelRangeToViewRange(this._primarySelection),n=this._context.viewLayout.getVerticalOffsetForLineNumber(o.startLineNumber),r=this._context.viewLayout.getVerticalOffsetAfterLineNumber(o.endLineNumber),s=this._parentBounds,l=s.top+n-this._scrollTop,c=r-n,u=s.left+t-this._scrollLeft,p;this._primarySelection.isEmpty()?(this._linesVisibleRanges&&(u+=this._linesVisibleRanges.left),p=0):p=s.width-t;let h=new DOMRect(u,l,p,c);this._editContext.updateSelectionBounds(h),this._editContext.updateControlBounds(h)}_updateCharacterBounds(e){let t=this._context.configuration.options,o=t.get(59).typicalHalfwidthCharacterWidth,n=t.get(165).contentLeft,r=this._parentBounds,s=[],l=new EP(this._editContext.text);for(let c=e.rangeStart;c<e.rangeEnd;c++){let u=l.getPosition(c),p=this._editContextPrimarySelection.startLineNumber-1,h=new ye(p+u.lineNumber,u.column),g=h.delta(0,1),f=z.fromPositions(h,g),v=this._context.viewModel.coordinatesConverter.convertModelRangeToViewRange(f),b=this._visibleRangeProvider.linesVisibleRangesForRange(v,!0)??[],S=v.startLineNumber,y=this._context.viewLayout.getVerticalOffsetForLineNumber(S),w=r.top+y-this._scrollTop,k=0,T=o;if(b.length>0)for(let O of b[0].ranges){k=O.left,T=O.width;break}let P=this._context.viewLayout.getLineHeightForLineNumber(S);s.push(new DOMRect(r.left+n+k-this._scrollLeft,w,T,P))}this._editContext.updateCharacterBounds(e.rangeStart,s)}};Mle=I([m(5,F),m(6,se)],Mle);var YSt=class extends Pu{constructor(e,t){super(e);this._viewGpuContext=t;this._gpuShapes=[];this._register(be(o=>this._updateEntries(o)))}onConfigurationChanged(e){return this._updateEntries(void 0),!0}prepareRender(e){}render(e){}_updateEntries(e){let t=this._context.configuration.options,o=t.get(116),n=t.get(59).typicalHalfwidthCharacterWidth,r=this._viewGpuContext.devicePixelRatio.read(e);for(let s=0,l=o.length;s<l;s++){let c=o[s],u=this._gpuShapes[s],p=c.color?We.fromHex(c.color):this._context.theme.getColor(T3i)??We.white,h=[c.column*n*r,0,Math.max(1,Math.ceil(r)),Number.MAX_SAFE_INTEGER,p.rgba.r/255,p.rgba.g/255,p.rgba.b/255,p.rgba.a];u?u.setRaw(h):this._gpuShapes[s]=this._viewGpuContext.rectangleRenderer.register(...h)}for(;this._gpuShapes.length>o.length;)this._gpuShapes.splice(-1,1)[0].dispose()}};var XSt=class a extends EC{constructor(e,t){super();this._viewGpuContext=t;this._context=e,this._renderResult=null,this._context.addEventHandler(this)}static{this.CLASS_NAME="gpu-mark"}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(e){return!0}onCursorStateChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollTopChanged}onZonesChanged(e){return!0}onDecorationsChanged(e){return!0}prepareRender(e){let t=e.visibleRange.startLineNumber,o=e.visibleRange.endLineNumber,n=e.viewportData,r=new Tj(this._context.configuration,this._context.theme.type),s=[];for(let l=t;l<=o;l++){let c=l-t,u=this._viewGpuContext.canRenderDetailed(r,n,l);s[c]=u.length?`<div class="${a.CLASS_NAME}" title="Cannot render on GPU: ${u.join(", ")}"></div>`:""}this._renderResult=s}render(e,t){if(!this._renderResult)return"";let o=t-e;return o<0||o>=this._renderResult.length?"":this._renderResult[o]}};var _C=le("userInteractionService");var Uwe=class extends wE{constructor(e,t,o,n,r,s,l,c,u,p){super();this._instantiationService=u;this._userInteractionService=p;this._editContextClipboardListeners=new N;this._onWillCopy=this._register(new E);this.onWillCopy=this._onWillCopy.event;this._onWillCut=this._register(new E);this.onWillCut=this._onWillCut.event;this._onWillPaste=this._register(new E);this.onWillPaste=this._onWillPaste.event;this._shouldRecomputeGlyphMarginLanes=!1;this._ownerID=t,this._widgetFocusTracker=this._register(new toi(e,c,this._userInteractionService)),this._register(this._widgetFocusTracker.onChange(()=>{this._context.viewModel.setHasWidgetFocus(this._widgetFocusTracker.hasFocus())})),this._selections=[new ti(1,1,1,1)],this._renderAnimationFrame=null,this._overflowGuardContainer=ur(document.createElement("div")),YS.write(this._overflowGuardContainer,3),this._overflowGuardContainer.setClassName("overflow-guard"),this._viewController=new Fbt(n,s,l,o),this._context=new WSt(n,r,s),this._context.addEventHandler(this),this._viewParts=[],this._editContextEnabled=this._context.configuration.options.get(170),this._accessibilitySupport=this._context.configuration.options.get(2),this._editContext=this._instantiateEditContext(),this._connectEditContextClipboardEvents(),this._viewParts.push(this._editContext),this._linesContent=ur(document.createElement("div")),this._linesContent.setClassName("lines-content monaco-editor-background"),this._linesContent.setPosition("absolute"),this.domNode=ur(document.createElement("div")),this.domNode.setClassName(this._getEditorClassName()),this.domNode.setAttribute("role","code"),this._context.configuration.options.get(46)==="on"&&(this._viewGpuContext=this._instantiationService.createInstance(gc,this._context)),this._scrollbar=new sSt(this._context,this._linesContent,this.domNode,this._overflowGuardContainer),this._viewParts.push(this._scrollbar),this._viewLines=new dSt(this._context,this._viewGpuContext,this._linesContent),this._viewGpuContext&&(this._viewLinesGpu=this._instantiationService.createInstance(Mwe,this._context,this._viewGpuContext)),this._viewZones=new PSt(this._context),this._viewParts.push(this._viewZones);let h=new CSt(this._context);this._viewParts.push(h);let g=new _St(this._context);this._viewParts.push(g);let f=new Vbt(this._context);this._viewParts.push(f),f.addDynamicOverlay(new oSt(this._context)),f.addDynamicOverlay(new LSt(this._context)),f.addDynamicOverlay(new cSt(this._context)),f.addDynamicOverlay(new rSt(this._context)),f.addDynamicOverlay(new ASt(this._context));let v=new Bbt(this._context);this._viewParts.push(v),v.addDynamicOverlay(new nSt(this._context)),v.addDynamicOverlay(new pSt(this._context)),v.addDynamicOverlay(new uSt(this._context)),v.addDynamicOverlay(new Ewe(this._context)),this._viewGpuContext&&v.addDynamicOverlay(new XSt(this._context,this._viewGpuContext)),this._glyphMarginWidgets=new aSt(this._context),this._viewParts.push(this._glyphMarginWidgets);let b=new _we(this._context);b.getDomNode().appendChild(this._viewZones.marginDomNode),b.getDomNode().appendChild(v.getDomNode()),b.getDomNode().appendChild(this._glyphMarginWidgets.domNode),this._viewParts.push(b),this._contentWidgets=new Ubt(this._context,this.domNode),this._viewParts.push(this._contentWidgets),this._viewCursors=new MSt(this._context),this._viewParts.push(this._viewCursors),this._overlayWidgets=new ySt(this._context,this.domNode),this._viewParts.push(this._overlayWidgets);let S=this._viewGpuContext?new YSt(this._context,this._viewGpuContext):new TSt(this._context);this._viewParts.push(S);let y=new Hbt(this._context);this._viewParts.push(y);let w=new SSt(this._context);if(this._viewParts.push(w),h){let k=this._scrollbar.getOverviewRulerLayoutInfo();k.parent.insertBefore(h.getDomNode(),k.insertBefore)}this._linesContent.appendChild(f.getDomNode()),"domNode"in S&&this._linesContent.appendChild(S.domNode),this._linesContent.appendChild(this._viewZones.domNode),this._linesContent.appendChild(this._viewLines.getDomNode()),this._linesContent.appendChild(this._contentWidgets.domNode),this._linesContent.appendChild(this._viewCursors.getDomNode()),this._overflowGuardContainer.appendChild(b.getDomNode()),this._overflowGuardContainer.appendChild(this._scrollbar.getDomNode()),this._viewGpuContext&&this._overflowGuardContainer.appendChild(this._viewGpuContext.canvas),this._overflowGuardContainer.appendChild(g.getDomNode()),this._overflowGuardContainer.appendChild(this._overlayWidgets.getDomNode()),this._overflowGuardContainer.appendChild(w.getDomNode()),this._overflowGuardContainer.appendChild(y.domNode),this.domNode.appendChild(this._overflowGuardContainer),c?(c.appendChild(this._contentWidgets.overflowingContentWidgetsDomNode.domNode),c.appendChild(this._overlayWidgets.overflowingOverlayWidgetsDomNode.domNode)):(this.domNode.appendChild(this._contentWidgets.overflowingContentWidgetsDomNode),this.domNode.appendChild(this._overlayWidgets.overflowingOverlayWidgetsDomNode)),this._applyLayout(),this._pointerHandler=this._register(new Obt(this._context,this._viewController,this._createPointerHandlerHelper()))}_instantiateEditContext(){return this._context.configuration.options.get(170)?this._instantiationService.createInstance(Mle,this._ownerID,this._context,this._overflowGuardContainer,this._viewController,this._createTextAreaHandlerHelper()):this._instantiationService.createInstance(Nwe,this._ownerID,this._context,this._overflowGuardContainer,this._viewController,this._createTextAreaHandlerHelper())}_updateEditContext(){let e=this._context.configuration.options.get(170),t=this._context.configuration.options.get(2);if(this._editContextEnabled===e&&this._accessibilitySupport===t)return;this._editContextEnabled=e,this._accessibilitySupport=t;let o=this._editContext.isFocused(),n=this._viewParts.indexOf(this._editContext);this._editContext.dispose(),this._editContext=this._instantiateEditContext(),this._connectEditContextClipboardEvents(),o&&this._editContext.focus(),n!==-1&&this._viewParts.splice(n,1,this._editContext)}_connectEditContextClipboardEvents(){this._editContextClipboardListeners.clear(),this._editContextClipboardListeners.add(this._editContext.onWillCopy(e=>this._onWillCopy.fire(e))),this._editContextClipboardListeners.add(this._editContext.onWillCut(e=>this._onWillCut.fire(e))),this._editContextClipboardListeners.add(this._editContext.onWillPaste(e=>this._onWillPaste.fire(e)))}_computeGlyphMarginLanes(){let e=this._context.viewModel.model,t=this._context.viewModel.glyphLanes,o=[],n=0;o=o.concat(e.getAllMarginDecorations().map(r=>{let s=r.options.glyphMargin?.position??2;return n=Math.max(n,r.range.endLineNumber),{range:r.range,lane:s,persist:r.options.glyphMargin?.persistLane}})),o=o.concat(this._glyphMarginWidgets.getWidgets().map(r=>{let s=e.validateRange(r.preference.range);return n=Math.max(n,s.endLineNumber),{range:s,lane:r.preference.lane}})),o.sort((r,s)=>z.compareRangesUsingStarts(r.range,s.range)),t.reset(n);for(let r of o)t.push(r.lane,r.range,r.persist);return t}_createPointerHandlerHelper(){return{viewDomNode:this.domNode.domNode,linesContentDomNode:this._linesContent.domNode,viewLinesDomNode:this._viewLines.getDomNode().domNode,viewLinesGpu:this._viewLinesGpu,focusTextArea:()=>{this.focus()},dispatchTextAreaEvent:e=>{this._editContext.domNode.domNode.dispatchEvent(e)},getLastRenderData:()=>{let e=this._viewCursors.getLastRenderData()||[],t=this._editContext.getLastRenderData();return new cbt(e,t)},renderNow:()=>{this.render(!0,!1)},shouldSuppressMouseDownOnViewZone:e=>this._viewZones.shouldSuppressMouseDownOnViewZone(e),shouldSuppressMouseDownOnWidget:e=>this._contentWidgets.shouldSuppressMouseDownOnWidget(e),getPositionFromDOMInfo:(e,t)=>(this._flushAccumulatedAndRenderNow(),this._viewLines.getPositionFromDOMInfo(e,t)),visibleRangeForPosition:(e,t)=>{this._flushAccumulatedAndRenderNow();let o=new ye(e,t);return this._viewLines.visibleRangeForPosition(o)??this._viewLinesGpu?.visibleRangeForPosition(o)??null},getLineWidth:e=>{if(this._flushAccumulatedAndRenderNow(),this._viewLinesGpu){let t=this._viewLinesGpu.getLineWidth(e);if(t!==void 0)return t}return this._viewLines.getLineWidth(e)}}}_createTextAreaHandlerHelper(){return{visibleRangeForPosition:e=>(this._flushAccumulatedAndRenderNow(),this._viewLines.visibleRangeForPosition(e)),linesVisibleRangesForRange:(e,t)=>(this._flushAccumulatedAndRenderNow(),this._viewLines.linesVisibleRangesForRange(e,t))}}_applyLayout(){let t=this._context.configuration.options.get(165);this.domNode.setWidth(t.width),this.domNode.setHeight(t.height),this._overflowGuardContainer.setWidth(t.width),this._overflowGuardContainer.setHeight(t.height),this._linesContent.setWidth(16777216),this._linesContent.setHeight(16777216)}_getEditorClassName(){let e=this._editContext.isFocused()?" focused":"";return this._context.configuration.options.get(162)+" "+Cj(this._context.theme.type)+e}handleEvents(e){super.handleEvents(e),this._scheduleRender()}onConfigurationChanged(e){return this.domNode.setClassName(this._getEditorClassName()),this._updateEditContext(),this._applyLayout(),!1}onCursorStateChanged(e){return this._selections=e.selections,!1}onDecorationsChanged(e){return e.affectsGlyphMargin&&(this._shouldRecomputeGlyphMarginLanes=!0),!1}onFocusChanged(e){return this.domNode.setClassName(this._getEditorClassName()),!1}onThemeChanged(e){return this._context.theme.update(e.theme),this.domNode.setClassName(this._getEditorClassName()),!1}dispose(){this._renderAnimationFrame!==null&&(this._renderAnimationFrame.dispose(),this._renderAnimationFrame=null),this._editContextClipboardListeners.dispose(),this._contentWidgets.overflowingContentWidgetsDomNode.domNode.remove(),this._overlayWidgets.overflowingOverlayWidgetsDomNode.domNode.remove(),this._context.removeEventHandler(this),this._viewGpuContext?.dispose(),this._viewLines.dispose(),this._viewLinesGpu?.dispose();for(let e of this._viewParts)e.dispose();super.dispose()}_scheduleRender(){if(this._store.isDisposed)throw new li;if(this._renderAnimationFrame===null){this._editContext instanceof Mle&&this._editContext.setEditContextOnDomNode();let e=this._createCoordinatedRendering();this._renderAnimationFrame=eoi.INSTANCE.scheduleCoordinatedRendering({window:Re(this.domNode?.domNode),prepareRenderText:()=>{if(this._store.isDisposed)throw new li;try{return e.prepareRenderText()}finally{this._renderAnimationFrame=null}},renderText:t=>{if(this._store.isDisposed)throw new li;return e.renderText(t)},prepareRender:(t,o)=>{if(this._store.isDisposed)throw new li;return e.prepareRender(t,o)},render:(t,o)=>{if(this._store.isDisposed)throw new li;return e.render(t,o)}})}}_flushAccumulatedAndRenderNow(){let e=this._createCoordinatedRendering(),t=G7(()=>e.prepareRenderText());if(!t)return;let o=G7(()=>e.renderText(t));if(!o)return;let[n,r]=o;G7(()=>e.prepareRender(n,r)),G7(()=>e.render(n,r))}_getViewPartsToRender(){let e=[],t=0;for(let o of this._viewParts)o.shouldRender()&&(e[t++]=o);return e}_createCoordinatedRendering(){return{prepareRenderText:()=>{if(this._shouldRecomputeGlyphMarginLanes){this._shouldRecomputeGlyphMarginLanes=!1;let n=this._computeGlyphMarginLanes();this._context.configuration.setGlyphMarginDecorationLaneCount(n.requiredLanes)}if(Kx.onRenderStart(),!this.domNode.domNode.isConnected)return null;let e=this._getViewPartsToRender();if(!this._viewLines.shouldRender()&&e.length===0)return null;let t=this._context.viewLayout.getLinesViewportData();this._context.viewModel.setViewport(t.startLineNumber,t.endLineNumber,t.centeredLineNumber);let o=new OSt(this._selections,t,this._context.viewLayout.getWhitespaceViewportData(),this._context.viewModel);for(let n of this._viewParts)n.shouldRender()&&n.onBeforeRender(o);return o},renderText:e=>(this._viewLines.shouldRender()&&(this._viewLines.renderText(e),this._viewLines.onDidRender()),this._viewLinesGpu?.shouldRender()&&(this._viewLinesGpu.renderText(e),this._viewLinesGpu.onDidRender()),[this._getViewPartsToRender(),new ebt(this._context.viewLayout,e,this._viewLines,this._viewLinesGpu)]),prepareRender:(e,t)=>{for(let o of e)o.prepareRender(t)},render:(e,t)=>{for(let o of e)o.render(t),o.onDidRender()}}}delegateVerticalScrollbarPointerDown(e){this._scrollbar.delegateVerticalScrollbarPointerDown(e)}delegateScrollFromMouseWheelEvent(e){this._scrollbar.delegateScrollFromMouseWheelEvent(e)}restoreState(e){this._context.viewModel.viewLayout.setScrollPosition({scrollTop:e.scrollTop,scrollLeft:e.scrollLeft},1),this._context.viewModel.visibleLinesStabilized()}getOffsetForColumn(e,t){let o=this._context.viewModel.model.validatePosition({lineNumber:e,column:t}),n=this._context.viewModel.coordinatesConverter.convertModelPositionToViewPosition(o);this._flushAccumulatedAndRenderNow();let r=this._viewLines.visibleRangeForPosition(new ye(n.lineNumber,n.column));return r?r.left:-1}getLineWidth(e){let t=this._context.viewModel.model,o=this._context.viewModel.coordinatesConverter.convertModelPositionToViewPosition(new ye(e,t.getLineMaxColumn(e))).lineNumber;return this._flushAccumulatedAndRenderNow(),this._viewLines.getLineWidth(o)}resetLineWidthCaches(){this._viewLines.resetLineWidthCaches()}getTargetAtClientPoint(e,t){let o=this._pointerHandler.getTargetAtClientPoint(e,t);return o?vwe.convertViewToModelMouseTarget(o,this._context.viewModel.coordinatesConverter):null}createOverviewRuler(e){return new ESt(this._context,e)}change(e){this._viewZones.changeViewZones(e),this._scheduleRender()}render(e,t){if(t){this._viewLines.forceShouldRender();for(let o of this._viewParts)o.forceShouldRender()}e?this._flushAccumulatedAndRenderNow():this._scheduleRender()}writeScreenReaderContent(e){this._editContext.writeScreenReaderContent(e)}focus(){this._editContext.focus()}isFocused(){return this._editContext.isFocused()}isWidgetFocused(){return this._widgetFocusTracker.hasFocus()}refreshFocusState(){this._editContext.refreshFocusState(),this._widgetFocusTracker.refreshState()}setAriaOptions(e){this._editContext.setAriaOptions(e)}addContentWidget(e){this._contentWidgets.addWidget(e.widget),this.layoutContentWidget(e),this._scheduleRender()}layoutContentWidget(e){this._contentWidgets.setWidgetPosition(e.widget,e.position?.position??null,e.position?.secondaryPosition??null,e.position?.preference??null,e.position?.positionAffinity??null),this._contentWidgets.shouldRender()&&this._scheduleRender()}removeContentWidget(e){this._contentWidgets.removeWidget(e.widget),this._scheduleRender()}addOverlayWidget(e){this._overlayWidgets.addWidget(e.widget),this.layoutOverlayWidget(e),this._scheduleRender()}layoutOverlayWidget(e){this._overlayWidgets.setWidgetPosition(e.widget,e.position)&&this._scheduleRender()}removeOverlayWidget(e){this._overlayWidgets.removeWidget(e.widget),this._scheduleRender()}addGlyphMarginWidget(e){this._glyphMarginWidgets.addWidget(e.widget),this._shouldRecomputeGlyphMarginLanes=!0,this._scheduleRender()}layoutGlyphMarginWidget(e){let t=e.position;this._glyphMarginWidgets.setWidgetPosition(e.widget,t)&&(this._shouldRecomputeGlyphMarginLanes=!0,this._scheduleRender())}removeGlyphMarginWidget(e){this._glyphMarginWidgets.removeWidget(e.widget),this._shouldRecomputeGlyphMarginLanes=!0,this._scheduleRender()}};Uwe=I([m(8,F),m(9,_C)],Uwe);function G7(a){try{return a()}catch(i){return mt(i),null}}var eoi=class a{constructor(){this._coordinatedRenderings=[];this._animationFrameRunners=new Map}static{this.INSTANCE=new a}scheduleCoordinatedRendering(i){return this._coordinatedRenderings.push(i),this._scheduleRender(i.window),{dispose:()=>{let e=this._coordinatedRenderings.indexOf(i);if(e!==-1&&(this._coordinatedRenderings.splice(e,1),this._coordinatedRenderings.length===0)){for(let[t,o]of this._animationFrameRunners)o.dispose();this._animationFrameRunners.clear()}}}}_scheduleRender(i){if(!this._animationFrameRunners.has(i)){let e=()=>{this._animationFrameRunners.delete(i),this._onRenderScheduled()};this._animationFrameRunners.set(i,zh(i,e,100))}}_onRenderScheduled(){let i=this._coordinatedRenderings.slice(0);this._coordinatedRenderings=[];let e=[];for(let o=0,n=i.length;o<n;o++){let r=i[o];e[o]=G7(()=>r.prepareRenderText())}let t=[];for(let o=0,n=i.length;o<n;o++){let r=i[o],s=e[o];if(!s){t[o]=null;continue}t[o]=G7(()=>r.renderText(s))}for(let o=0,n=i.length;o<n;o++){let r=i[o],s=t[o];if(!s)continue;let[l,c]=s;G7(()=>r.prepareRender(l,c))}for(let o=0,n=i.length;o<n;o++){let r=i[o],s=t[o];if(!s)continue;let[l,c]=s;G7(()=>r.render(l,c))}}},toi=class extends x{constructor(e,t,o){super();this._onChange=this._register(new E);this.onChange=this._onChange.event;this._hadFocus=void 0;this._hasDomElementFocus=!1,this._domFocusTracker=this._register(o.createDomFocusTracker(e)),this._overflowWidgetsDomNodeHasFocus=!1,this._register(this._domFocusTracker.onDidFocus(()=>{this._hasDomElementFocus=!0,this._update()})),this._register(this._domFocusTracker.onDidBlur(()=>{this._hasDomElementFocus=!1,this._update()})),t&&(this._overflowWidgetsDomNode=this._register(o.createDomFocusTracker(t)),this._register(this._overflowWidgetsDomNode.onDidFocus(()=>{this._overflowWidgetsDomNodeHasFocus=!0,this._update()})),this._register(this._overflowWidgetsDomNode.onDidBlur(()=>{this._overflowWidgetsDomNodeHasFocus=!1,this._update()})))}_update(){let e=this._hasDomElementFocus||this._overflowWidgetsDomNodeHasFocus;this._hadFocus!==e&&(this._hadFocus=e,this._onChange.fire(void 0))}hasFocus(){return this._hadFocus??!1}refreshState(){this._domFocusTracker.refreshState(),this._overflowWidgetsDomNode?.refreshState?.()}};var _j=class{constructor(i,e,t,o,n){this.injectionOffsets=i;this.injectionOptions=e;this.breakOffsets=t;this.breakOffsetsVisibleColumn=o;this.wrappedTextIndentLength=n}getOutputLineCount(){return this.breakOffsets.length}getMinOutputOffset(i){return i>0?this.wrappedTextIndentLength:0}getLineLength(i){let e=i>0?this.breakOffsets[i-1]:0,o=this.breakOffsets[i]-e;return i>0&&(o+=this.wrappedTextIndentLength),o}getMaxOutputOffset(i){return this.getLineLength(i)}translateToInputOffset(i,e){i>0&&(e=Math.max(0,e-this.wrappedTextIndentLength));let o=i===0?e:this.breakOffsets[i-1]+e;if(this.injectionOffsets!==null)for(let n=0;n<this.injectionOffsets.length&&o>this.injectionOffsets[n];n++)o<this.injectionOffsets[n]+this.injectionOptions[n].content.length?o=this.injectionOffsets[n]:o-=this.injectionOptions[n].content.length;return o}translateToOutputPosition(i,e=2){let t=i;if(this.injectionOffsets!==null)for(let o=0;o<this.injectionOffsets.length&&!(i<this.injectionOffsets[o]||e!==1&&i===this.injectionOffsets[o]);o++)t+=this.injectionOptions[o].content.length;return this.offsetInInputWithInjectionsToOutputPosition(t,e)}offsetInInputWithInjectionsToOutputPosition(i,e=2){let t=0,o=this.breakOffsets.length-1,n=0,r=0;for(;t<=o;){n=t+(o-t)/2|0;let l=this.breakOffsets[n];if(r=n>0?this.breakOffsets[n-1]:0,e===0)if(i<=r)o=n-1;else if(i>l)t=n+1;else break;else if(i<r)o=n-1;else if(i>=l)t=n+1;else break}let s=i-r;return n>0&&(s+=this.wrappedTextIndentLength),new zwe(n,s)}normalizeOutputPosition(i,e,t){if(this.injectionOffsets!==null){let o=this.outputPositionToOffsetInInputWithInjections(i,e),n=this.normalizeOffsetInInputWithInjectionsAroundInjections(o,t);if(n!==o)return this.offsetInInputWithInjectionsToOutputPosition(n,t)}if(t===0){if(i>0&&e===this.getMinOutputOffset(i))return new zwe(i-1,this.getMaxOutputOffset(i-1))}else if(t===1){let o=this.getOutputLineCount()-1;if(i<o&&e===this.getMaxOutputOffset(i))return new zwe(i+1,this.getMinOutputOffset(i+1))}return new zwe(i,e)}outputPositionToOffsetInInputWithInjections(i,e){return i>0&&(e=Math.max(0,e-this.wrappedTextIndentLength)),(i>0?this.breakOffsets[i-1]:0)+e}normalizeOffsetInInputWithInjectionsAroundInjections(i,e){let t=this.getInjectedTextAtOffset(i);if(!t)return i;if(e===2){if(i===t.offsetInInputWithInjections+t.length&&t8i(this.injectionOptions[t.injectedTextIndex].cursorStops))return t.offsetInInputWithInjections+t.length;{let o=t.offsetInInputWithInjections;if(i8i(this.injectionOptions[t.injectedTextIndex].cursorStops))return o;let n=t.injectedTextIndex-1;for(;n>=0&&this.injectionOffsets[n]===this.injectionOffsets[t.injectedTextIndex]&&!(t8i(this.injectionOptions[n].cursorStops)||(o-=this.injectionOptions[n].content.length,i8i(this.injectionOptions[n].cursorStops)));)n--;return o}}else if(e===1||e===4){let o=t.offsetInInputWithInjections+t.length,n=t.injectedTextIndex;for(;n+1<this.injectionOffsets.length&&this.injectionOffsets[n+1]===this.injectionOffsets[n];)o+=this.injectionOptions[n+1].content.length,n++;return o}else if(e===0||e===3){let o=t.offsetInInputWithInjections,n=t.injectedTextIndex;for(;n-1>=0&&this.injectionOffsets[n-1]===this.injectionOffsets[n];)o-=this.injectionOptions[n-1].content.length,n--;return o}os(e)}getInjectedText(i,e){let t=this.outputPositionToOffsetInInputWithInjections(i,e),o=this.getInjectedTextAtOffset(t);return o?{options:this.injectionOptions[o.injectedTextIndex]}:null}getInjectedTextAtOffset(i){let e=this.injectionOffsets,t=this.injectionOptions;if(e!==null){let o=0;for(let n=0;n<e.length;n++){let r=t[n].content.length,s=e[n]+o,l=e[n]+o+r;if(s>i)break;if(i<=l)return{injectedTextIndex:n,offsetInInputWithInjections:s,length:r};o+=r}}}};function t8i(a){return a==null?!0:a===1||a===0}function i8i(a){return a==null?!0:a===2||a===0}var zwe=class{constructor(i,e){this.outputLineIndex=i,this.outputOffset=e}toString(){return`${this.outputLineIndex}:${this.outputOffset}`}toPosition(i){return new ye(i+this.outputLineIndex,this.outputOffset+1)}};function o8i(){return a=>({fontFamily:a.fontFamily?String(a.fontFamily):void 0,fontSizeMultiplier:a.fontSizeMultiplier?Number(a.fontSizeMultiplier):void 0,lineHeightMultiplier:a.lineHeightMultiplier?Number(a.lineHeightMultiplier):void 0})}var JSt=class{constructor(){this.changeType=1}},FO=class a{constructor(i,e,t,o,n){this.ownerId=i;this.lineNumber=e;this.column=t;this.options=o;this.order=n}static applyInjectedText(i,e){if(!e||e.length===0)return i;let t="",o=0;for(let n of e)t+=i.substring(o,n.column-1),o=n.column-1,t+=n.options.content;return t+=i.substring(o),t}static fromDecorations(i){let e=[];for(let t of i)t.options.before&&t.options.before.content.length>0&&e.push(new a(t.ownerId,t.range.startLineNumber,t.range.startColumn,t.options.before,0)),t.options.after&&t.options.after.content.length>0&&e.push(new a(t.ownerId,t.range.endLineNumber,t.range.endColumn,t.options.after,1));return e.sort((t,o)=>t.lineNumber===o.lineNumber?t.column===o.column?t.order-o.order:t.column-o.column:t.lineNumber-o.lineNumber),e}withText(i){return new a(this.ownerId,this.lineNumber,this.column,{...this.options,content:i},this.order)}},h5e=class{constructor(i,e){this.changeType=2;this.lineNumber=i,this.lineNumberPostEdit=e}},ZSt=class{constructor(i,e,t,o){this.ownerId=i,this.decorationId=e,this.lineNumber=t,this.lineHeightMultiplier=o}},eIt=class{constructor(i,e){this.ownerId=i,this.lineNumber=e}},tIt=class{constructor(i,e,t){this.changeType=3;this.fromLineNumber=i,this.toLineNumber=e,this.lastUntouchedLinePostEdit=t}},iIt=class{constructor(i,e,t){this.changeType=4;this.fromLineNumber=i,this.fromLineNumberPostEdit=e,this.count=t}get toLineNumber(){return this.fromLineNumber+this.count-1}get toLineNumberPostEdit(){return this.fromLineNumberPostEdit+this.count-1}},oIt=class{constructor(){this.changeType=5}},Ple=class a{constructor(i,e,t,o){this.changes=i,this.versionId=e,this.isUndoing=t,this.isRedoing=o,this.resultingSelection=null}containsEvent(i){for(let e=0,t=this.changes.length;e<t;e++)if(this.changes[e].changeType===i)return!0;return!1}static merge(i,e){let t=[].concat(i.changes).concat(e.changes),o=e.versionId,n=i.isUndoing||e.isUndoing,r=i.isRedoing||e.isRedoing;return new a(t,o,n,r)}},Kwe=class{constructor(i){this.changes=i}},Gwe=class{constructor(i){this.changes=i}affects(i){if(z.isIRange(i)){for(let e of this.changes)if(e.lineNumber>=i.startLineNumber&&e.lineNumber<=i.endLineNumber)return!0;return!1}else{for(let e of this.changes)if(e.lineNumber===i.lineNumber)return!0;return!1}}},qwe=class{constructor(i){this.changes=i}},q7=class a{constructor(i,e){this.rawContentChangedEvent=i;this.contentChangedEvent=e}merge(i){let e=Ple.merge(this.rawContentChangedEvent,i.rawContentChangedEvent),t=a._mergeChangeEvents(this.contentChangedEvent,i.contentChangedEvent);return new a(e,t)}static _mergeChangeEvents(i,e){let t=[].concat(i.changes).concat(e.changes),o=e.eol,n=e.versionId,r=i.isUndoing||e.isUndoing,s=i.isRedoing||e.isRedoing,l=i.isFlush||e.isFlush,c=i.isEolChange&&e.isEolChange;return{changes:t,eol:o,isEolChange:c,versionId:n,isUndoing:r,isRedoing:s,isFlush:l,detailedReasons:i.detailedReasons.concat(e.detailedReasons),detailedReasonsChangeLengths:i.detailedReasonsChangeLengths.concat(e.detailedReasonsChangeLengths)}}};var MVo=pf("domLineBreaksComputer",{createHTML:a=>a}),nIt=class a{constructor(i){this.targetWindow=i}static create(i){return new a(new WeakRef(i))}createLineBreaksComputer(i,e,t,o,n,r,s){let l=[];return{addRequest:(c,u)=>{l.push(c)},finalize:()=>PVo(Ci(this.targetWindow.deref()),i,l,e,t,o,n,r)}}};function PVo(a,i,e,t,o,n,r,s){function l(H){let G=i.getLineInjectedText(H);if(G){let $=i.getLineContent(H),J=FO.applyInjectedText($,G),ae=G.map(oe=>oe.options),he=G.map(oe=>oe.column-1);return new _j(he,ae,[J.length],[],0)}else return null}if(n===-1){let H=[];for(let G=0,$=e.length;G<$;G++)H[G]=l(e[G]);return H}let c=Math.round(n*t.typicalHalfwidthCharacterWidth),u=r===3?2:r===2?1:0,p=Math.round(o*u),h=Math.ceil(t.spaceWidth*p),g=document.createElement("div");Jd(g,t);let f=new $S(1e4),v=[],b=[],S=[],y=[],w=[];for(let H=0;H<e.length;H++){let G=e[H],$=FO.applyInjectedText(i.getLineContent(G),i.getLineInjectedText(G)),J=0,ae=0,he=c;if(r!==0)if(J=nm($),J===-1)J=0;else{for(let xe=0;xe<J;xe++){let ze=$.charCodeAt(xe)===9?o-ae%o:1;ae+=ze}let Ce=Math.ceil(t.spaceWidth*ae);Ce+t.typicalFullwidthCharacterWidth>c?(J=0,ae=0):he=c-Ce}let oe=$.substr(J),de=AVo(oe,ae,o,he,f,h);v[H]=J,b[H]=ae,S[H]=oe,y[H]=de[0],w[H]=de[1]}let k=f.build(),T=MVo?.createHTML(k)??k;g.innerHTML=T,g.style.position="absolute",g.style.top="10000px",s==="keepAll"?(g.style.wordBreak="keep-all",g.style.overflowWrap="anywhere"):(g.style.wordBreak="inherit",g.style.overflowWrap="break-word"),a.document.body.appendChild(g);let P=document.createRange(),O=Array.prototype.slice.call(g.children,0),V=[];for(let H=0;H<e.length;H++){let G=e[H],$=O[H],J=NVo(P,$,S[H],y[H]);if(J===null){V[H]=l(G);continue}let ae=v[H],he=b[H]+p,oe=w[H],de=[];for(let De=0,Oe=J.length;De<Oe;De++)de[De]=oe[J[De]];if(ae!==0)for(let De=0,Oe=J.length;De<Oe;De++)J[De]+=ae;let Ce,xe,ze=i.getLineInjectedText(G);ze?(Ce=ze.map(De=>De.options),xe=ze.map(De=>De.column-1)):(Ce=null,xe=null),V[H]=new _j(xe,Ce,J,de,he)}return g.remove(),V}function AVo(a,i,e,t,o,n){if(n!==0){let h=String(n);o.appendString('<div style="text-indent: -'),o.appendString(h),o.appendString("px; padding-left: "),o.appendString(h),o.appendString("px; box-sizing: border-box; width:")}else o.appendString('<div style="width:');o.appendString(String(t)),o.appendString('px;">');let r=a.length,s=i,l=0,c=[],u=[],p=0<r?a.charCodeAt(0):0;o.appendString("<span>");for(let h=0;h<r;h++){h!==0&&h%16384===0&&o.appendString("</span><span>"),c[h]=l,u[h]=s;let g=p;p=h+1<r?a.charCodeAt(h+1):0;let f=1,v=1;switch(g){case 9:f=e-s%e,v=f;for(let b=1;b<=f;b++)b<f?o.appendCharCode(160):o.appendASCIICharCode(32);break;case 32:p===32?o.appendCharCode(160):o.appendASCIICharCode(32);break;case 60:o.appendString("&lt;");break;case 62:o.appendString("&gt;");break;case 38:o.appendString("&amp;");break;case 0:o.appendString("&#00;");break;case 65279:case 8232:case 8233:case 133:o.appendCharCode(65533);break;default:h_(g)&&v++,g<32?o.appendCharCode(9216+g):o.appendCharCode(g)}l+=f,s+=v}return o.appendString("</span>"),c[a.length]=l,u[a.length]=s,o.appendString("</div>"),[c,u]}function NVo(a,i,e,t){if(e.length<=1)return null;let o=Array.prototype.slice.call(i.children,0),n=[];try{ooi(a,o,t,0,null,e.length-1,null,n)}catch(r){return console.error(r),null}return n.length===0?null:(n.push(e.length),n)}function ooi(a,i,e,t,o,n,r,s){if(t===n||(o=o||ioi(a,i,e[t],e[t+1]),r=r||ioi(a,i,e[n],e[n+1]),Math.abs(o[0].top-r[0].top)<=.1))return;if(t+1===n){s.push(n);return}let l=t+(n-t)/2|0,c=ioi(a,i,e[l],e[l+1]);ooi(a,i,e,t,o,l,c,s),ooi(a,i,e,l,c,n,r,s)}function ioi(a,i,e,t){return a.setStart(i[e/16384|0].firstChild,e%16384),a.setEnd(i[t/16384|0].firstChild,t%16384),a.getClientRects()}var rIt=class extends x{constructor(){super();this._editor=null;this._instantiationService=null;this._instances=this._register(new Vt);this._pending=new Map;this._finishedInstantiation=[];this._finishedInstantiation[0]=!1,this._finishedInstantiation[1]=!1,this._finishedInstantiation[2]=!1,this._finishedInstantiation[3]=!1}initialize(e,t,o){this._editor=e,this._instantiationService=o;for(let n of t){if(this._pending.has(n.id)){mt(new Error(`Cannot have two contributions with the same id ${n.id}`));continue}this._pending.set(n.id,n)}this._instantiateSome(0),this._register(rf(Re(this._editor.getDomNode()),()=>{this._instantiateSome(1)})),this._register(rf(Re(this._editor.getDomNode()),()=>{this._instantiateSome(2)})),this._register(rf(Re(this._editor.getDomNode()),()=>{this._instantiateSome(3)},5e3))}saveViewState(){let e={};for(let[t,o]of this._instances)typeof o.saveViewState=="function"&&(e[t]=o.saveViewState());return e}restoreViewState(e){for(let[t,o]of this._instances)typeof o.restoreViewState=="function"&&o.restoreViewState(e[t])}get(e){return this._instantiateById(e),this._instances.get(e)||null}set(e,t){this._instances.set(e,t)}onBeforeInteractionEvent(){this._instantiateSome(2)}onAfterModelAttached(){return rf(Re(this._editor?.getDomNode()),()=>{this._instantiateSome(1)},50)}_instantiateSome(e){if(this._finishedInstantiation[e])return;this._finishedInstantiation[e]=!0;let t=this._findPendingContributionsByInstantiation(e);for(let o of t)this._instantiateById(o.id)}_findPendingContributionsByInstantiation(e){let t=[];for(let[,o]of this._pending)o.instantiation===e&&t.push(o);return t}_instantiateById(e){let t=this._pending.get(e);if(t){if(this._pending.delete(e),!this._instantiationService||!this._editor)throw new Error("Cannot instantiate contributions before being initialized!");try{let o=this._instantiationService.createInstance(t.ctor,this._editor);this._instances.set(t.id,o),typeof o.restoreViewState=="function"&&t.instantiation!==0&&console.warn(`Editor contribution '${t.id}' should be eager instantiated because it uses saveViewState / restoreViewState.`)}catch(o){mt(o)}}}};var sIt=class{constructor(i,e,t,o,n,r,s){this.id=i;this.label=e;this.alias=t;this.metadata=o;this._precondition=n;this._run=r;this._contextKeyService=s}isSupported(){return this._contextKeyService.contextMatchesRules(this._precondition)}run(i){return this.isSupported()?this._run(i):Promise.resolve(void 0)}};function TE(a){return(a.metadata&1)>>>0}function yp(a,i){a.metadata=a.metadata&254|i<<0}function ey(a){return(a.metadata&2)>>>1===1}function tp(a,i){a.metadata=a.metadata&253|(i?1:0)<<1}function p8i(a){return(a.metadata&4)>>>2===1}function n8i(a,i){a.metadata=a.metadata&251|(i?1:0)<<2}function m8i(a){return(a.metadata&64)>>>6===1}function r8i(a,i){a.metadata=a.metadata&191|(i?1:0)<<6}function h8i(a){return(a.metadata&128)>>>7===1}function s8i(a,i){a.metadata=a.metadata&127|(i?1:0)<<7}function OVo(a){return(a.metadata&24)>>>3}function a8i(a,i){a.metadata=a.metadata&231|i<<3}function FVo(a){return(a.metadata&32)>>>5===1}function l8i(a,i){a.metadata=a.metadata&223|(i?1:0)<<5}var Ale=class{constructor(i,e,t){this.metadata=0,this.parent=this,this.left=this,this.right=this,yp(this,1),this.start=e,this.end=t,this.delta=0,this.maxEnd=t,this.id=i,this.ownerId=0,this.options=null,n8i(this,!1),r8i(this,!1),a8i(this,1),l8i(this,!1),s8i(this,!1),this.cachedVersionId=0,this.cachedAbsoluteStart=e,this.cachedAbsoluteEnd=t,this.range=null,tp(this,!1)}reset(i,e,t,o){this.start=e,this.end=t,this.maxEnd=t,this.cachedVersionId=i,this.cachedAbsoluteStart=e,this.cachedAbsoluteEnd=t,this.range=o}setOptions(i){this.options=i;let e=this.options.className;n8i(this,e==="squiggly-error"||e==="squiggly-warning"||e==="squiggly-info"),r8i(this,this.options.glyphMarginClassName!==null),a8i(this,this.options.stickiness),l8i(this,this.options.collapseOnReplaceEdit),s8i(this,this.options.affectsFont??!1)}setCachedOffsets(i,e,t){this.cachedVersionId!==t&&(this.range=null),this.cachedVersionId=t,this.cachedAbsoluteStart=i,this.cachedAbsoluteEnd=e}detach(){this.parent=null,this.left=null,this.right=null}},Ca=new Ale(null,0,0);Ca.parent=Ca;Ca.left=Ca;Ca.right=Ca;yp(Ca,0);var j7=class{constructor(){this.root=Ca,this.requestNormalizeDelta=!1}intervalSearch(i,e,t,o,n,r,s){return this.root===Ca?[]:KVo(this,i,e,t,o,n,r,s)}search(i,e,t,o,n){return this.root===Ca?[]:c8i(this,i,e,t,o,n)}collectNodesFromOwner(i){return UVo(this,i)}collectNodesPostOrder(){return zVo(this)}insert(i){d8i(this,i),this._normalizeDeltaIfNecessary()}delete(i){u8i(this,i),this._normalizeDeltaIfNecessary()}resolveNode(i,e){let t=i,o=0;for(;i!==this.root;)i===i.parent.right&&(o+=i.parent.delta),i=i.parent;let n=t.start+o,r=t.end+o;t.setCachedOffsets(n,r,e)}acceptReplace(i,e,t,o){let n=BVo(this,i,i+e);for(let r=0,s=n.length;r<s;r++){let l=n[r];u8i(this,l)}this._normalizeDeltaIfNecessary(),HVo(this,i,i+e,t),this._normalizeDeltaIfNecessary();for(let r=0,s=n.length;r<s;r++){let l=n[r];l.start=l.cachedAbsoluteStart,l.end=l.cachedAbsoluteEnd,VVo(l,i,i+e,t,o),l.maxEnd=l.end,d8i(this,l)}this._normalizeDeltaIfNecessary()}getAllInOrder(){return c8i(this,0,!1,!1,0,!1)}_normalizeDeltaIfNecessary(){this.requestNormalizeDelta&&(this.requestNormalizeDelta=!1,WVo(this))}};function WVo(a){let i=a.root,e=0;for(;i!==Ca;){if(i.left!==Ca&&!ey(i.left)){i=i.left;continue}if(i.right!==Ca&&!ey(i.right)){e+=i.delta,i=i.right;continue}i.start=e+i.start,i.end=e+i.end,i.delta=0,Dj(i),tp(i,!0),tp(i.left,!1),tp(i.right,!1),i===i.parent.right&&(e-=i.parent.delta),i=i.parent}tp(a.root,!1)}function $we(a,i,e,t){return a<e?!0:a>e||t===1?!1:t===2?!0:i}function VVo(a,i,e,t,o){let n=OVo(a),r=n===0||n===2,s=n===1||n===2,l=e-i,c=t,u=Math.min(l,c),p=a.start,h=!1,g=a.end,f=!1;i<=p&&g<=e&&FVo(a)&&(a.start=i,h=!0,a.end=i,f=!0);{let b=o?1:l>0?2:0;!h&&$we(p,r,i,b)&&(h=!0),!f&&$we(g,s,i,b)&&(f=!0)}if(u>0&&!o){let b=l>c?2:0;!h&&$we(p,r,i+u,b)&&(h=!0),!f&&$we(g,s,i+u,b)&&(f=!0)}{let b=o?1:0;!h&&$we(p,r,e,b)&&(a.start=i+c,h=!0),!f&&$we(g,s,e,b)&&(a.end=i+c,f=!0)}let v=c-l;h||(a.start=Math.max(0,p+v)),f||(a.end=Math.max(0,g+v)),a.start>a.end&&(a.end=a.start)}function BVo(a,i,e){let t=a.root,o=0,n=0,r=0,s=0,l=[],c=0;for(;t!==Ca;){if(ey(t)){tp(t.left,!1),tp(t.right,!1),t===t.parent.right&&(o-=t.parent.delta),t=t.parent;continue}if(!ey(t.left)){if(n=o+t.maxEnd,n<i){tp(t,!0);continue}if(t.left!==Ca){t=t.left;continue}}if(r=o+t.start,r>e){tp(t,!0);continue}if(s=o+t.end,s>=i&&(t.setCachedOffsets(r,s,0),l[c++]=t),tp(t,!0),t.right!==Ca&&!ey(t.right)){o+=t.delta,t=t.right;continue}}return tp(a.root,!1),l}function HVo(a,i,e,t){let o=a.root,n=0,r=0,s=0,l=t-(e-i);for(;o!==Ca;){if(ey(o)){tp(o.left,!1),tp(o.right,!1),o===o.parent.right&&(n-=o.parent.delta),Dj(o),o=o.parent;continue}if(!ey(o.left)){if(r=n+o.maxEnd,r<i){tp(o,!0);continue}if(o.left!==Ca){o=o.left;continue}}if(s=n+o.start,s>e){o.start+=l,o.end+=l,o.delta+=l,(o.delta<-1073741824||o.delta>1073741824)&&(a.requestNormalizeDelta=!0),tp(o,!0);continue}if(tp(o,!0),o.right!==Ca&&!ey(o.right)){n+=o.delta,o=o.right;continue}}tp(a.root,!1)}function UVo(a,i){let e=a.root,t=[],o=0;for(;e!==Ca;){if(ey(e)){tp(e.left,!1),tp(e.right,!1),e=e.parent;continue}if(e.left!==Ca&&!ey(e.left)){e=e.left;continue}if(e.ownerId===i&&(t[o++]=e),tp(e,!0),e.right!==Ca&&!ey(e.right)){e=e.right;continue}}return tp(a.root,!1),t}function zVo(a){let i=a.root,e=[],t=0;for(;i!==Ca;){if(ey(i)){tp(i.left,!1),tp(i.right,!1),i=i.parent;continue}if(i.left!==Ca&&!ey(i.left)){i=i.left;continue}if(i.right!==Ca&&!ey(i.right)){i=i.right;continue}e[t++]=i,tp(i,!0)}return tp(a.root,!1),e}function c8i(a,i,e,t,o,n){let r=a.root,s=0,l=0,c=0,u=[],p=0;for(;r!==Ca;){if(ey(r)){tp(r.left,!1),tp(r.right,!1),r===r.parent.right&&(s-=r.parent.delta),r=r.parent;continue}if(r.left!==Ca&&!ey(r.left)){r=r.left;continue}l=s+r.start,c=s+r.end,r.setCachedOffsets(l,c,o);let h=!0;if(i&&r.ownerId&&r.ownerId!==i&&(h=!1),e&&p8i(r)&&(h=!1),t&&h8i(r)&&(h=!1),n&&!m8i(r)&&(h=!1),h&&(u[p++]=r),tp(r,!0),r.right!==Ca&&!ey(r.right)){s+=r.delta,r=r.right;continue}}return tp(a.root,!1),u}function KVo(a,i,e,t,o,n,r,s){let l=a.root,c=0,u=0,p=0,h=0,g=[],f=0;for(;l!==Ca;){if(ey(l)){tp(l.left,!1),tp(l.right,!1),l===l.parent.right&&(c-=l.parent.delta),l=l.parent;continue}if(!ey(l.left)){if(u=c+l.maxEnd,u<i){tp(l,!0);continue}if(l.left!==Ca){l=l.left;continue}}if(p=c+l.start,p>e){tp(l,!0);continue}if(h=c+l.end,h>=i){l.setCachedOffsets(p,h,r);let v=!0;t&&l.ownerId&&l.ownerId!==t&&(v=!1),o&&p8i(l)&&(v=!1),n&&h8i(l)&&(v=!1),s&&!m8i(l)&&(v=!1),v&&(g[f++]=l)}if(tp(l,!0),l.right!==Ca&&!ey(l.right)){c+=l.delta,l=l.right;continue}}return tp(a.root,!1),g}function d8i(a,i){if(a.root===Ca)return i.parent=Ca,i.left=Ca,i.right=Ca,yp(i,0),a.root=i,a.root;GVo(a,i),$7(i.parent);let e=i;for(;e!==a.root&&TE(e.parent)===1;)if(e.parent===e.parent.parent.left){let t=e.parent.parent.right;TE(t)===1?(yp(e.parent,0),yp(t,0),yp(e.parent.parent,1),e=e.parent.parent):(e===e.parent.right&&(e=e.parent,g5e(a,e)),yp(e.parent,0),yp(e.parent.parent,1),f5e(a,e.parent.parent))}else{let t=e.parent.parent.left;TE(t)===1?(yp(e.parent,0),yp(t,0),yp(e.parent.parent,1),e=e.parent.parent):(e===e.parent.left&&(e=e.parent,f5e(a,e)),yp(e.parent,0),yp(e.parent.parent,1),g5e(a,e.parent.parent))}return yp(a.root,0),i}function GVo(a,i){let e=0,t=a.root,o=i.start,n=i.end;for(;;)if($Vo(o,n,t.start+e,t.end+e)<0)if(t.left===Ca){i.start-=e,i.end-=e,i.maxEnd-=e,t.left=i;break}else t=t.left;else if(t.right===Ca){i.start-=e+t.delta,i.end-=e+t.delta,i.maxEnd-=e+t.delta,t.right=i;break}else e+=t.delta,t=t.right;i.parent=t,i.left=Ca,i.right=Ca,yp(i,1)}function u8i(a,i){let e,t;if(i.left===Ca?(e=i.right,t=i,e.delta+=i.delta,(e.delta<-1073741824||e.delta>1073741824)&&(a.requestNormalizeDelta=!0),e.start+=i.delta,e.end+=i.delta):i.right===Ca?(e=i.left,t=i):(t=qVo(i.right),e=t.right,e.start+=t.delta,e.end+=t.delta,e.delta+=t.delta,(e.delta<-1073741824||e.delta>1073741824)&&(a.requestNormalizeDelta=!0),t.start+=i.delta,t.end+=i.delta,t.delta=i.delta,(t.delta<-1073741824||t.delta>1073741824)&&(a.requestNormalizeDelta=!0)),t===a.root){a.root=e,yp(e,0),i.detach(),noi(),Dj(e),a.root.parent=Ca;return}let o=TE(t)===1;if(t===t.parent.left?t.parent.left=e:t.parent.right=e,t===i?e.parent=t.parent:(t.parent===i?e.parent=t:e.parent=t.parent,t.left=i.left,t.right=i.right,t.parent=i.parent,yp(t,TE(i)),i===a.root?a.root=t:i===i.parent.left?i.parent.left=t:i.parent.right=t,t.left!==Ca&&(t.left.parent=t),t.right!==Ca&&(t.right.parent=t)),i.detach(),o){$7(e.parent),t!==i&&($7(t),$7(t.parent)),noi();return}$7(e),$7(e.parent),t!==i&&($7(t),$7(t.parent));let n;for(;e!==a.root&&TE(e)===0;)e===e.parent.left?(n=e.parent.right,TE(n)===1&&(yp(n,0),yp(e.parent,1),g5e(a,e.parent),n=e.parent.right),TE(n.left)===0&&TE(n.right)===0?(yp(n,1),e=e.parent):(TE(n.right)===0&&(yp(n.left,0),yp(n,1),f5e(a,n),n=e.parent.right),yp(n,TE(e.parent)),yp(e.parent,0),yp(n.right,0),g5e(a,e.parent),e=a.root)):(n=e.parent.left,TE(n)===1&&(yp(n,0),yp(e.parent,1),f5e(a,e.parent),n=e.parent.left),TE(n.left)===0&&TE(n.right)===0?(yp(n,1),e=e.parent):(TE(n.left)===0&&(yp(n.right,0),yp(n,1),g5e(a,n),n=e.parent.left),yp(n,TE(e.parent)),yp(e.parent,0),yp(n.left,0),f5e(a,e.parent),e=a.root));yp(e,0),noi()}function qVo(a){for(;a.left!==Ca;)a=a.left;return a}function noi(){Ca.parent=Ca,Ca.delta=0,Ca.start=0,Ca.end=0}function g5e(a,i){let e=i.right;e.delta+=i.delta,(e.delta<-1073741824||e.delta>1073741824)&&(a.requestNormalizeDelta=!0),e.start+=i.delta,e.end+=i.delta,i.right=e.left,e.left!==Ca&&(e.left.parent=i),e.parent=i.parent,i.parent===Ca?a.root=e:i===i.parent.left?i.parent.left=e:i.parent.right=e,e.left=i,i.parent=e,Dj(i),Dj(e)}function f5e(a,i){let e=i.left;i.delta-=e.delta,(i.delta<-1073741824||i.delta>1073741824)&&(a.requestNormalizeDelta=!0),i.start-=e.delta,i.end-=e.delta,i.left=e.right,e.right!==Ca&&(e.right.parent=i),e.parent=i.parent,i.parent===Ca?a.root=e:i===i.parent.right?i.parent.right=e:i.parent.left=e,e.right=i,i.parent=e,Dj(i),Dj(e)}function g8i(a){let i=a.end;if(a.left!==Ca){let e=a.left.maxEnd;e>i&&(i=e)}if(a.right!==Ca){let e=a.right.maxEnd+a.delta;e>i&&(i=e)}return i}function Dj(a){a.maxEnd=g8i(a)}function $7(a){for(;a!==Ca;){let i=g8i(a);if(a.maxEnd===i)return;a.maxEnd=i,a=a.parent}}function $Vo(a,i,e,t){return a===e?i-t:a-e}var Ml=le("undoRedoService");var v5e=class{constructor(i,e){this.resource=i;this.elements=e}},Q7=class a{static{this._ID=0}constructor(){this.id=a._ID++,this.order=1}nextOrder(){return this.id===0?0:this.order++}static{this.None=new a}},iz=class a{static{this._ID=0}constructor(){this.id=a._ID++,this.order=1}nextOrder(){return this.id===0?0:this.order++}static{this.None=new a}};function ZS(a){let i=0,e=0,t=0,o=0;for(let n=0,r=a.length;n<r;n++){let s=a.charCodeAt(n);s===13?(i===0&&(e=n),i++,n+1<r&&a.charCodeAt(n+1)===10?(o|=2,n++):o|=3,t=n+1):s===10&&(o|=1,i===0&&(e=n),i++,t=n+1)}return i===0&&(e=a.length),[i,e,a.length-t,o]}var Lj=class a{constructor(i){this.replacements=i;qy($y(i,(e,t)=>e.lineRange.endLineNumberExclusive<=t.lineRange.startLineNumber))}static{this.empty=new a([])}static deserialize(i){return new a(i.map(e=>oz.deserialize(e)))}static fromStringEdit(i,e){let t=Vp.fromStringEdit(i,e);return a.fromTextEdit(t,e)}static fromTextEdit(i,e){let t=i.replacements,o=[],n=[];for(let r=0;r<t.length;r++){let s=t[r],l=r+1<t.length?t[r+1]:void 0;if(n.push(s),l&&l.range.startLineNumber===s.range.endLineNumber)continue;let c=ss.joinReplacements(n,e);n.length=0;let u=oz.fromSingleTextEdit(c,e);o.push(u)}return new a(o)}static createFromUnsorted(i){let e=i.slice();return e.sort(cl(t=>t.lineRange.startLineNumber,hu)),new a(e)}isEmpty(){return this.replacements.length===0}toEdit(i){let e=[];for(let t of this.replacements){let o=t.toSingleEdit(i);e.push(o)}return new ld(e)}toString(){return this.replacements.map(i=>i.toString()).join(",")}serialize(){return this.replacements.map(i=>i.serialize())}getNewLineRanges(){let i=[],e=0;for(let t of this.replacements)i.push(uo.ofLength(t.lineRange.startLineNumber+e,t.newLines.length)),e+=t.newLines.length-t.lineRange.length;return i}mapLineNumber(i){let e=0;for(let t of this.replacements){if(t.lineRange.endLineNumberExclusive>i)break;e+=t.newLines.length-t.lineRange.length}return i+e}mapLineRange(i){return new uo(this.mapLineNumber(i.startLineNumber),this.mapLineNumber(i.endLineNumberExclusive))}mapBackLineRange(i,e){return this.inverse(e).mapLineRange(i)}touches(i){return this.replacements.some(e=>i.replacements.some(t=>e.lineRange.intersect(t.lineRange)))}rebase(i){return new a(this.replacements.map(e=>new oz(i.mapLineRange(e.lineRange),e.newLines)))}humanReadablePatch(i){let e=[];function t(s,l,c,u){let p=c==="unmodified"?" ":c==="deleted"?"-":"+";u===void 0&&(u="[[[[[ WARNING: LINE DOES NOT EXIST ]]]]]");let h=s===-1?"   ":s.toString().padStart(3," "),g=l===-1?"   ":l.toString().padStart(3," ");e.push(`${p} ${h} ${g} ${u}`)}function o(){e.push("---")}let n=0,r=!0;for(let s of D9(this.replacements,(l,c)=>l.lineRange.distanceToRange(c.lineRange)<=5)){r?r=!1:o();let l=s[0].lineRange.startLineNumber-2;for(let c of s){for(let h=Math.max(1,l);h<c.lineRange.startLineNumber;h++)t(h,h+n,"unmodified",i[h-1]);let u=c.lineRange,p=c.newLines;for(let h of u.mapToLineArray(g=>g)){let g=i[h-1];t(h,-1,"deleted",g)}for(let h=0;h<p.length;h++){let g=p[h];t(-1,u.startLineNumber+n+h,"added",g)}l=u.endLineNumberExclusive,n+=c.newLines.length-c.lineRange.length}for(let c=l;c<=Math.min(l+2,i.length);c++)t(c,c+n,"unmodified",i[c-1])}return e.join(`
`)}apply(i){let e=[],t=0;for(let o of this.replacements){for(;t<o.lineRange.startLineNumber-1;)e.push(i[t]),t++;for(let n of o.newLines)e.push(n);t=o.lineRange.endLineNumberExclusive-1}for(;t<i.length;)e.push(i[t]),t++;return e}inverse(i){let e=this.getNewLineRanges();return new a(this.replacements.map((t,o)=>new oz(e[o],i.slice(t.lineRange.startLineNumber-1,t.lineRange.endLineNumberExclusive-1))))}},oz=class a{constructor(i,e){this.lineRange=i;this.newLines=e}static deserialize(i){return new a(uo.ofLength(i[0],i[1]-i[0]),i[2])}static fromSingleTextEdit(i,e){let t=yc(i.text),o=i.range.startLineNumber,n=e.getValueOfRange(z.fromPositions(new ye(i.range.startLineNumber,1),i.range.getStartPosition()));t[0]=n+t[0];let r=i.range.endLineNumber+1,s=e.getTransformer().getLineLength(i.range.endLineNumber)+1,l=e.getValueOfRange(z.fromPositions(i.range.getEndPosition(),new ye(i.range.endLineNumber,s)));t[t.length-1]=t[t.length-1]+l;let c=i.range.startColumn===e.getTransformer().getLineLength(i.range.startLineNumber)+1,u=i.range.endColumn===1;return c&&t[0].length===n.length&&(o++,t.shift()),t.length>0&&o<r&&u&&t[t.length-1].length===l.length&&(r--,t.pop()),new a(new uo(o,r),t)}toSingleTextEdit(i){if(this.newLines.length===0){let e=i.getTransformer().textLength;if(this.lineRange.endLineNumberExclusive===e.lineCount+2){let t;if(this.lineRange.startLineNumber>1){let n=this.lineRange.startLineNumber-1,r=i.getTransformer().getLineLength(n)+1;t=new ye(n,r)}else t=new ye(1,1);let o=e.addToPosition(new ye(1,1));return new ss(z.fromPositions(t,o),"")}else return new ss(new z(this.lineRange.startLineNumber,1,this.lineRange.endLineNumberExclusive,1),"")}else if(this.lineRange.isEmpty){let e,t,o,n=this.lineRange.startLineNumber;return n===i.getTransformer().textLength.lineCount+2?(e=n-1,t=i.getTransformer().getLineLength(e)+1,o=this.newLines.map(r=>`
`+r).join("")):(e=n,t=1,o=this.newLines.map(r=>r+`
`).join("")),new ss(z.fromPositions(new ye(e,t)),o)}else{let e=this.lineRange.endLineNumberExclusive-1,t=i.getTransformer().getLineLength(e)+1,o=new z(this.lineRange.startLineNumber,1,e,t),n=this.newLines.join(`
`);return new ss(o,n)}}toSingleEdit(i){let e=this.toSingleTextEdit(i),t=i.getTransformer().getOffsetRange(e.range);return new ed(t,e.text)}toString(){return`${this.lineRange}->${JSON.stringify(this.newLines)}`}serialize(){return[this.lineRange.startLineNumber,this.lineRange.endLineNumberExclusive,this.newLines]}removeCommonSuffixPrefixLines(i){let e=this.lineRange.startLineNumber,t=this.lineRange.endLineNumberExclusive,o=0;for(;e<t&&o<this.newLines.length&&this.newLines[o]===i.getLineAt(e);)e++,o++;let n=0;for(;e<t&&n+o<this.newLines.length&&this.newLines[this.newLines.length-1-n]===i.getLineAt(t-1);)t--,n++;return o===0&&n===0?this:new a(new uo(e,t),this.newLines.slice(o,this.newLines.length-n))}toLineEdit(){return new Lj([this])}},jVo;(i=>{function a(e){return Array.isArray(e)&&e.length===3&&typeof e[0]=="number"&&typeof e[1]=="number"&&Array.isArray(e[2])&&e[2].every(t=>typeof t=="string")}i.is=a})(jVo||={});var QVo=Symbol("TextModelEditSource"),b5e=class{constructor(i,e){this.metadata=i}toString(){return`${this.metadata.source}`}getType(){let i=this.metadata;switch(i.source){case"cursor":return i.kind;case"inlineCompletionAccept":return i.source+(i.$nes?":nes":"");case"unknown":return i.name||"unknown";default:return i.source}}toKey(i,e={}){let t=this.metadata;return Object.entries(t).filter(([n,r])=>{let s=e[n];return s!==void 0?s:(n.match(/\$/g)||[]).length<=i&&r!==void 0&&r!==null&&r!==""}).map(([n,r])=>`${n}:${r}`).join("-")}get props(){return this.metadata}};function _E(a){return new b5e(a,QVo)}function v8i(a){switch(a.metadata.source){case"inlineCompletionAccept":case"inlineCompletionPartialAccept":case"inlineChat.applyEdits":case"Chat.applyEdits":return!0}return!1}function b8i(a){return a.metadata.source==="cursor"?a.metadata.kind==="type":!1}var Wc={unknown(a){return _E({source:"unknown",name:a.name})},rename:(a,i)=>_E({source:"rename",$$$oldName:a,$$$newName:i}),chatApplyEdits(a){return _E({source:"Chat.applyEdits",$modelId:f8i(a.modelId),$extensionId:a.extensionId?.extensionId,$extensionVersion:a.extensionId?.version,$$languageId:a.languageId,$$sessionId:a.sessionId,$$requestId:a.requestId,$$mode:a.mode,$$codeBlockSuggestionId:a.codeBlockSuggestionId})},chatUndoEdits:()=>_E({source:"Chat.undoEdits"}),chatReset:()=>_E({source:"Chat.reset"}),inlineCompletionAccept(a){return _E({source:"inlineCompletionAccept",$nes:a.nes,...aIt(a.providerId),$$correlationId:a.correlationId,$$requestUuid:a.requestUuid,$$languageId:a.languageId})},inlineCompletionPartialAccept(a){return _E({source:"inlineCompletionPartialAccept",type:a.type,$nes:a.nes,...aIt(a.providerId),$$correlationId:a.correlationId,$$requestUuid:a.requestUuid,$$languageId:a.languageId})},inlineChatApplyEdit(a){return _E({source:"inlineChat.applyEdits",$modelId:f8i(a.modelId),$extensionId:a.extensionId?.extensionId,$extensionVersion:a.extensionId?.version,$$sessionId:a.sessionId,$$requestId:a.requestId,$$languageId:a.languageId})},reloadFromDisk:()=>_E({source:"reloadFromDisk"}),cursor(a){return _E({source:"cursor",kind:a.kind,detailedSource:a.detailedSource})},setValue:()=>_E({source:"setValue"}),eolChange:()=>_E({source:"eolChange"}),applyEdits:()=>_E({source:"applyEdits"}),snippet:()=>_E({source:"snippet"}),suggest:a=>_E({source:"suggest",...aIt(a.providerId)}),codeAction:a=>_E({source:"codeAction",$kind:a.kind,...aIt(a.providerId)})};function aIt(a){return a?{$extensionId:a.extensionId,$extensionVersion:a.extensionVersion,$providerId:a.providerId}:{}}function f8i(a){if(a!==void 0)return a.replaceAll("/","|")}var lw=class a{constructor(i,e,t,o){this.linesAdded=i;this.linesRemoved=e;this.charsAdded=t;this.charsRemoved=o}static fromText(i){let e=pc.ofText(i).lineCount,t=i.length;return new a(e,0,t,0)}static fromEdit(i,e){let t=Lj.fromStringEdit(i,e),o=Gy(t.replacements,l=>l.newLines.length),n=Gy(t.replacements,l=>l.lineRange.length),r=Gy(i.replacements,l=>l.getNewLength()),s=Gy(i.replacements,l=>l.replaceRange.length);return new a(o,n,r,s)}static tryCreate(i,e,t,o){if(!(i===void 0||e===void 0||t===void 0||o===void 0))return new a(i,e,t,o)}},roi;(i=>{function a(e){let t=e?e("sgt"):Sbt("sgt");return t}i.newId=a})(roi||={});var S5e=class{constructor(i,e,t,o){this.range=i;this.nestingLevel=e;this.nestingLevelOfEqualBracketType=t;this.isInvalid=o}},soi=class{constructor(i,e,t,o,n,r){this.range=i;this.openingBracketRange=e;this.closingBracketRange=t;this.nestingLevel=o;this.nestingLevelOfEqualBracketType=n;this.bracketPairNode=r}get openingBracketInfo(){return this.bracketPairNode.openingBracket.bracketInfo}get closingBracketInfo(){return this.bracketPairNode.closingBracket?.bracketInfo}},lIt=class extends soi{constructor(e,t,o,n,r,s,l){super(e,t,o,n,r,s);this.minVisibleColumnIndentation=l}};function S8i(a,i,e,t){return a!==e?Rm(e-a,t):Rm(0,t-i)}var mb=0;function jwe(a){return a===0}var eR=2**26;function Rm(a,i){return a*eR+i}function jx(a){let i=a,e=Math.floor(i/eR),t=i-e*eR;return new pc(e,t)}function I8i(a){return Math.floor(a/eR)}function eu(a,i){let e=a+i;return i>=eR&&(e=e-a%eR),e}function y8i(a,i){return a.reduce((e,t)=>eu(e,i(t)),mb)}function aoi(a,i){return a===i}function Nle(a,i){let e=a,t=i;if(t-e<=0)return mb;let n=Math.floor(e/eR),r=Math.floor(t/eR),s=t-r*eR;if(n===r){let l=e-n*eR;return Rm(0,s-l)}else return Rm(r-n,s)}function Rj(a,i){return a<i}function Y7(a,i){return a<=i}function Qwe(a,i){return a>=i}function X7(a){return Rm(a.lineNumber-1,a.column-1)}function J7(a,i){let e=a,t=Math.floor(e/eR),o=e-t*eR,n=i,r=Math.floor(n/eR),s=n-r*eR;return new z(t+1,o+1,r+1,s+1)}function w8i(a){let i=yc(a);return Rm(i.length-1,i[i.length-1].length)}var cIt=[],cw=class a{constructor(i,e){this.items=i;this.additionalItems=e}static{this.cache=new Array(129)}static create(i,e){if(i<=128&&e.length===0){let t=a.cache[i];return t||(t=new a(i,e),a.cache[i]=t),t}return new a(i,e)}static{this.empty=a.create(0,cIt)}static getEmpty(){return this.empty}add(i,e){let t=e.getKey(i),o=t>>5;if(o===0){let r=1<<t|this.items;return r===this.items?this:a.create(r,this.additionalItems)}o--;let n=this.additionalItems.slice(0);for(;n.length<o;)n.push(0);return n[o]|=1<<(t&31),a.create(this.items,n)}has(i,e){let t=e.getKey(i),o=t>>5;return o===0?(this.items&1<<t)!==0:(o--,((this.additionalItems[o]||0)&1<<(t&31))!==0)}merge(i){let e=this.items|i.items;if(this.additionalItems===cIt&&i.additionalItems===cIt)return e===this.items?this:e===i.items?i:a.create(e,cIt);let t=[];for(let o=0;o<Math.max(this.additionalItems.length,i.additionalItems.length);o++){let n=this.additionalItems[o]||0,r=i.additionalItems[o]||0;t.push(n|r)}return a.create(e,t)}intersects(i){if((this.items&i.items)!==0)return!0;for(let e=0;e<Math.min(this.additionalItems.length,i.additionalItems.length);e++)if((this.additionalItems[e]&i.additionalItems[e])!==0)return!0;return!1}equals(i){if(this.items!==i.items||this.additionalItems.length!==i.additionalItems.length)return!1;for(let e=0;e<this.additionalItems.length;e++)if(this.additionalItems[e]!==i.additionalItems[e])return!1;return!0}},loi={getKey(a){return a}},Ywe=class{constructor(){this.items=new Map}getKey(i){let e=this.items.get(i);return e===void 0&&(e=this.items.size,this.items.set(i,e)),e}reverseLookup(i){return[...this.items].find(([e,t])=>t===i)?.[0]}reverseLookupSet(i){let e=[];for(let[t]of this.items)i.has(t,this)&&e.push(t);return e}keys(){return this.items.keys()}};var I5e=class{get length(){return this._length}constructor(i){this._length=i}},y5e=class a extends I5e{constructor(e,t,o,n,r){super(e);this.openingBracket=t;this.child=o;this.closingBracket=n;this.missingOpeningBracketIds=r}static create(e,t,o){let n=e.length;return t&&(n=eu(n,t.length)),o&&(n=eu(n,o.length)),new a(n,e,t,o,t?t.missingOpeningBracketIds:cw.getEmpty())}get kind(){return 2}get listHeight(){return 0}get childrenLength(){return 3}getChild(e){switch(e){case 0:return this.openingBracket;case 1:return this.child;case 2:return this.closingBracket}throw new Error("Invalid child index")}get children(){let e=[];return e.push(this.openingBracket),this.child&&e.push(this.child),this.closingBracket&&e.push(this.closingBracket),e}canBeReused(e){return!(this.closingBracket===null||e.intersects(this.missingOpeningBracketIds))}flattenLists(){return a.create(this.openingBracket.flattenLists(),this.child&&this.child.flattenLists(),this.closingBracket&&this.closingBracket.flattenLists())}deepClone(){return new a(this.length,this.openingBracket.deepClone(),this.child&&this.child.deepClone(),this.closingBracket&&this.closingBracket.deepClone(),this.missingOpeningBracketIds)}computeMinIndentation(e,t){return this.child?this.child.computeMinIndentation(eu(e,this.openingBracket.length),t):Number.MAX_SAFE_INTEGER}},tR=class a extends I5e{constructor(e,t,o){super(e);this.listHeight=t;this._missingOpeningBracketIds=o;this.cachedMinIndentation=-1}static create23(e,t,o,n=!1){let r=e.length,s=e.missingOpeningBracketIds;if(e.listHeight!==t.listHeight)throw new Error("Invalid list heights");if(r=eu(r,t.length),s=s.merge(t.missingOpeningBracketIds),o){if(e.listHeight!==o.listHeight)throw new Error("Invalid list heights");r=eu(r,o.length),s=s.merge(o.missingOpeningBracketIds)}return n?new coi(r,e.listHeight+1,e,t,o,s):new w5e(r,e.listHeight+1,e,t,o,s)}static create(e,t=!1){if(e.length===0)return this.getEmpty();{let o=e[0].length,n=e[0].missingOpeningBracketIds;for(let r=1;r<e.length;r++)o=eu(o,e[r].length),n=n.merge(e[r].missingOpeningBracketIds);return t?new dIt(o,e[0].listHeight+1,e,n):new C5e(o,e[0].listHeight+1,e,n)}}static getEmpty(){return new dIt(mb,0,[],cw.getEmpty())}get kind(){return 4}get missingOpeningBracketIds(){return this._missingOpeningBracketIds}throwIfImmutable(){}makeLastElementMutable(){this.throwIfImmutable();let e=this.childrenLength;if(e===0)return;let t=this.getChild(e-1),o=t.kind===4?t.toMutable():t;return t!==o&&this.setChild(e-1,o),o}makeFirstElementMutable(){if(this.throwIfImmutable(),this.childrenLength===0)return;let t=this.getChild(0),o=t.kind===4?t.toMutable():t;return t!==o&&this.setChild(0,o),o}canBeReused(e){if(e.intersects(this.missingOpeningBracketIds)||this.childrenLength===0)return!1;let t=this;for(;t.kind===4;){let o=t.childrenLength;if(o===0)throw new li;t=t.getChild(o-1)}return t.canBeReused(e)}handleChildrenChanged(){this.throwIfImmutable();let e=this.childrenLength,t=this.getChild(0).length,o=this.getChild(0).missingOpeningBracketIds;for(let n=1;n<e;n++){let r=this.getChild(n);t=eu(t,r.length),o=o.merge(r.missingOpeningBracketIds)}this._length=t,this._missingOpeningBracketIds=o,this.cachedMinIndentation=-1}flattenLists(){let e=[];for(let t of this.children){let o=t.flattenLists();o.kind===4?e.push(...o.children):e.push(o)}return a.create(e)}computeMinIndentation(e,t){if(this.cachedMinIndentation!==-1)return this.cachedMinIndentation;let o=Number.MAX_SAFE_INTEGER,n=e;for(let r=0;r<this.childrenLength;r++){let s=this.getChild(r);s&&(o=Math.min(o,s.computeMinIndentation(n,t)),n=eu(n,s.length))}return this.cachedMinIndentation=o,o}},w5e=class a extends tR{constructor(e,t,o,n,r,s){super(e,t,s);this._item1=o;this._item2=n;this._item3=r}get childrenLength(){return this._item3!==null?3:2}getChild(e){switch(e){case 0:return this._item1;case 1:return this._item2;case 2:return this._item3}throw new Error("Invalid child index")}setChild(e,t){switch(e){case 0:this._item1=t;return;case 1:this._item2=t;return;case 2:this._item3=t;return}throw new Error("Invalid child index")}get children(){return this._item3?[this._item1,this._item2,this._item3]:[this._item1,this._item2]}get item1(){return this._item1}get item2(){return this._item2}get item3(){return this._item3}deepClone(){return new a(this.length,this.listHeight,this._item1.deepClone(),this._item2.deepClone(),this._item3?this._item3.deepClone():null,this.missingOpeningBracketIds)}appendChildOfSameHeight(e){if(this._item3)throw new Error("Cannot append to a full (2,3) tree node");this.throwIfImmutable(),this._item3=e,this.handleChildrenChanged()}unappendChild(){if(!this._item3)throw new Error("Cannot remove from a non-full (2,3) tree node");this.throwIfImmutable();let e=this._item3;return this._item3=null,this.handleChildrenChanged(),e}prependChildOfSameHeight(e){if(this._item3)throw new Error("Cannot prepend to a full (2,3) tree node");this.throwIfImmutable(),this._item3=this._item2,this._item2=this._item1,this._item1=e,this.handleChildrenChanged()}unprependChild(){if(!this._item3)throw new Error("Cannot remove from a non-full (2,3) tree node");this.throwIfImmutable();let e=this._item1;return this._item1=this._item2,this._item2=this._item3,this._item3=null,this.handleChildrenChanged(),e}toMutable(){return this}},coi=class extends w5e{toMutable(){return new w5e(this.length,this.listHeight,this.item1,this.item2,this.item3,this.missingOpeningBracketIds)}throwIfImmutable(){throw new Error("this instance is immutable")}},C5e=class a extends tR{constructor(e,t,o,n){super(e,t,n);this._children=o}get childrenLength(){return this._children.length}getChild(e){return this._children[e]}setChild(e,t){this._children[e]=t}get children(){return this._children}deepClone(){let e=new Array(this._children.length);for(let t=0;t<this._children.length;t++)e[t]=this._children[t].deepClone();return new a(this.length,this.listHeight,e,this.missingOpeningBracketIds)}appendChildOfSameHeight(e){this.throwIfImmutable(),this._children.push(e),this.handleChildrenChanged()}unappendChild(){this.throwIfImmutable();let e=this._children.pop();return this.handleChildrenChanged(),e}prependChildOfSameHeight(e){this.throwIfImmutable(),this._children.unshift(e),this.handleChildrenChanged()}unprependChild(){this.throwIfImmutable();let e=this._children.shift();return this.handleChildrenChanged(),e}toMutable(){return this}},dIt=class extends C5e{toMutable(){return new C5e(this.length,this.listHeight,[...this.children],this.missingOpeningBracketIds)}throwIfImmutable(){throw new Error("this instance is immutable")}},YVo=[],x5e=class extends I5e{get listHeight(){return 0}get childrenLength(){return 0}getChild(i){return null}get children(){return YVo}flattenLists(){return this}deepClone(){return this}},WV=class extends x5e{get kind(){return 0}get missingOpeningBracketIds(){return cw.getEmpty()}canBeReused(i){return!0}computeMinIndentation(i,e){let t=jx(i),o=(t.columnCount===0?t.lineCount:t.lineCount+1)+1,n=I8i(eu(i,this.length))+1,r=Number.MAX_SAFE_INTEGER;for(let s=o;s<=n;s++){let l=e.getLineFirstNonWhitespaceColumn(s),c=e.getLineContent(s);if(l===0)continue;let u=fl.visibleColumnFromColumn(c,l,e.getOptions().tabSize);r=Math.min(r,u)}return r}},k5e=class a extends x5e{constructor(e,t,o){super(e);this.bracketInfo=t;this.bracketIds=o}static create(e,t,o){return new a(e,t,o)}get kind(){return 1}get missingOpeningBracketIds(){return cw.getEmpty()}get text(){return this.bracketInfo.bracketText}get languageId(){return this.bracketInfo.languageId}canBeReused(e){return!1}computeMinIndentation(e,t){return Number.MAX_SAFE_INTEGER}},uIt=class extends x5e{get kind(){return 3}constructor(i,e){super(e),this.missingOpeningBracketIds=i}canBeReused(i){return!i.intersects(this.missingOpeningBracketIds)}computeMinIndentation(i,e){return Number.MAX_SAFE_INTEGER}};var WO=class a{constructor(i,e,t){this.startOffset=i;this.endOffset=e;this.newLength=t}static fromModelContentChanges(i){return i.map(t=>{let o=z.lift(t.range);return new a(X7(o.getStartPosition()),X7(o.getEndPosition()),w8i(t.text))}).reverse()}toString(){return`[${jx(this.startOffset)}...${jx(this.endOffset)}) -> ${jx(this.newLength)}`}},pIt=class{constructor(i){this.nextEditIdx=0;this.deltaOldToNewLineCount=0;this.deltaOldToNewColumnCount=0;this.deltaLineIdxInOld=-1;this.edits=i.map(e=>doi.from(e))}getOffsetBeforeChange(i){return this.adjustNextEdit(i),this.translateCurToOld(i)}getDistanceToNextChange(i){this.adjustNextEdit(i);let e=this.edits[this.nextEditIdx],t=e?this.translateOldToCur(e.offsetObj):null;return t===null?null:Nle(i,t)}translateOldToCur(i){return i.lineCount===this.deltaLineIdxInOld?Rm(i.lineCount+this.deltaOldToNewLineCount,i.columnCount+this.deltaOldToNewColumnCount):Rm(i.lineCount+this.deltaOldToNewLineCount,i.columnCount)}translateCurToOld(i){let e=jx(i);return e.lineCount-this.deltaOldToNewLineCount===this.deltaLineIdxInOld?Rm(e.lineCount-this.deltaOldToNewLineCount,e.columnCount-this.deltaOldToNewColumnCount):Rm(e.lineCount-this.deltaOldToNewLineCount,e.columnCount)}adjustNextEdit(i){for(;this.nextEditIdx<this.edits.length;){let e=this.edits[this.nextEditIdx],t=this.translateOldToCur(e.endOffsetAfterObj);if(Y7(t,i)){this.nextEditIdx++;let o=jx(t),n=jx(this.translateOldToCur(e.endOffsetBeforeObj)),r=o.lineCount-n.lineCount;this.deltaOldToNewLineCount+=r;let s=this.deltaLineIdxInOld===e.endOffsetBeforeObj.lineCount?this.deltaOldToNewColumnCount:0,l=o.columnCount-n.columnCount;this.deltaOldToNewColumnCount=s+l,this.deltaLineIdxInOld=e.endOffsetBeforeObj.lineCount}else break}}},doi=class a{static from(i){return new a(i.startOffset,i.endOffset,i.newLength)}constructor(i,e,t){this.endOffsetBeforeObj=jx(e),this.endOffsetAfterObj=jx(eu(i,t)),this.offsetObj=jx(i)}};var VV=class{constructor(i,e,t,o,n){this.length=i;this.kind=e;this.bracketId=t;this.bracketIds=o;this.astNode=n}},Xwe=class{constructor(i,e){this.textModel=i;this.bracketTokens=e;this.reader=new uoi(this.textModel,this.bracketTokens),this._offset=mb,this.didPeek=!1,this.peeked=null,this.textBufferLineCount=i.getLineCount(),this.textBufferLastLineLength=i.getLineLength(this.textBufferLineCount)}get offset(){return this._offset}get length(){return Rm(this.textBufferLineCount-1,this.textBufferLastLineLength)}getText(){return this.textModel.getValue()}skip(i){this.didPeek=!1,this._offset=eu(this._offset,i);let e=jx(this._offset);this.reader.setPosition(e.lineCount,e.columnCount)}read(){let i;return this.peeked?(this.didPeek=!1,i=this.peeked):i=this.reader.read(),i&&(this._offset=eu(this._offset,i.length)),i}peek(){return this.didPeek||(this.peeked=this.reader.read(),this.didPeek=!0),this.peeked}},uoi=class{constructor(i,e){this.textModel=i;this.bracketTokens=e;this.lineIdx=0;this.line=null;this.lineCharOffset=0;this.lineTokens=null;this.lineTokenOffset=0;this.peekedToken=null;this.textBufferLineCount=i.getLineCount(),this.textBufferLastLineLength=i.getLineLength(this.textBufferLineCount)}setPosition(i,e){i===this.lineIdx?(this.lineCharOffset=e,this.line!==null&&(this.lineTokenOffset=this.lineCharOffset===0?0:this.lineTokens.findTokenIndexAtOffset(this.lineCharOffset))):(this.lineIdx=i,this.lineCharOffset=e,this.line=null),this.peekedToken=null}read(){if(this.peekedToken){let n=this.peekedToken;return this.peekedToken=null,this.lineCharOffset+=n.length,n}if(this.lineIdx>this.textBufferLineCount-1||this.lineIdx===this.textBufferLineCount-1&&this.lineCharOffset>=this.textBufferLastLineLength)return null;this.line===null&&(this.lineTokens=this.textModel.tokenization.getLineTokens(this.lineIdx+1),this.line=this.lineTokens.getLineContent(),this.lineTokenOffset=this.lineCharOffset===0?0:this.lineTokens.findTokenIndexAtOffset(this.lineCharOffset));let i=this.lineIdx,e=this.lineCharOffset,t=0;for(;;){let n=this.lineTokens,r=n.getCount(),s=null;if(this.lineTokenOffset<r){let l=n.getMetadata(this.lineTokenOffset);for(;this.lineTokenOffset+1<r&&l===n.getMetadata(this.lineTokenOffset+1);)this.lineTokenOffset++;let c=bp.getTokenType(l)===0,u=bp.containsBalancedBrackets(l),p=n.getEndOffset(this.lineTokenOffset);if(u&&c&&this.lineCharOffset<p){let h=n.getLanguageId(this.lineTokenOffset),g=this.line.substring(this.lineCharOffset,p),f=this.bracketTokens.getSingleLanguageBracketTokens(h),v=f.regExpGlobal;if(v){v.lastIndex=0;let b=v.exec(g);b&&(s=f.getToken(b[0]),s&&(this.lineCharOffset+=b.index))}}if(t+=p-this.lineCharOffset,s)if(i!==this.lineIdx||e!==this.lineCharOffset){this.peekedToken=s;break}else return this.lineCharOffset+=s.length,s;else this.lineTokenOffset++,this.lineCharOffset=p}else if(this.lineIdx===this.textBufferLineCount-1||(this.lineIdx++,this.lineTokens=this.textModel.tokenization.getLineTokens(this.lineIdx+1),this.lineTokenOffset=0,this.line=this.lineTokens.getLineContent(),this.lineCharOffset=0,t+=33,t>1e3))break;if(t>1500)break}let o=S8i(i,e,this.lineIdx,this.lineCharOffset);return new VV(o,0,-1,cw.getEmpty(),new WV(o))}},mIt=class{constructor(i,e){this.text=i;this._offset=mb;this.idx=0;let t=e.getRegExpStr(),o=t?new RegExp(t+`|
`,"gi"):null,n=[],r,s=0,l=0,c=0,u=0,p=[];for(let f=0;f<60;f++)p.push(new VV(Rm(0,f),0,-1,cw.getEmpty(),new WV(Rm(0,f))));let h=[];for(let f=0;f<60;f++)h.push(new VV(Rm(1,f),0,-1,cw.getEmpty(),new WV(Rm(1,f))));if(o)for(o.lastIndex=0;(r=o.exec(i))!==null;){let f=r.index,v=r[0];if(v===`
`)s++,l=f+1;else{if(c!==f){let b;if(u===s){let S=f-c;if(S<p.length)b=p[S];else{let y=Rm(0,S);b=new VV(y,0,-1,cw.getEmpty(),new WV(y))}}else{let S=s-u,y=f-l;if(S===1&&y<h.length)b=h[y];else{let w=Rm(S,y);b=new VV(w,0,-1,cw.getEmpty(),new WV(w))}}n.push(b)}n.push(e.getToken(v)),c=f+v.length,u=s}}let g=i.length;if(c!==g){let f=u===s?Rm(0,g-c):Rm(s-u,g-l);n.push(new VV(f,0,-1,cw.getEmpty(),new WV(f)))}this.length=Rm(s,g-l),this.tokens=n}get offset(){return this._offset}read(){return this.tokens[this.idx++]||null}peek(){return this.tokens[this.idx]||null}skip(i){throw new b$}getText(){return this.text}};var poi=class a{constructor(i){this.map=i;this.hasRegExp=!1;this._regExpGlobal=null}static createFromLanguage(i,e){function t(n){return e.getKey(`${n.languageId}:::${n.bracketText}`)}let o=new Map;for(let n of i.bracketsNew.openingBrackets){let r=Rm(0,n.bracketText.length),s=t(n),l=cw.getEmpty().add(s,loi);o.set(n.bracketText,new VV(r,1,s,l,k5e.create(r,n,l)))}for(let n of i.bracketsNew.closingBrackets){let r=Rm(0,n.bracketText.length),s=cw.getEmpty(),l=n.getOpeningBrackets();for(let c of l)s=s.add(t(c),loi);o.set(n.bracketText,new VV(r,2,t(l[0]),s,k5e.create(r,n,s)))}return new a(o)}getRegExpStr(){if(this.isEmpty)return null;{let i=[...this.map.keys()];return i.sort(),i.reverse(),i.map(e=>ZVo(e)).join("|")}}get regExpGlobal(){if(!this.hasRegExp){let i=this.getRegExpStr();this._regExpGlobal=i?new RegExp(i,"gi"):null,this.hasRegExp=!0}return this._regExpGlobal}getToken(i){return this.map.get(i.toLowerCase())}findClosingTokenText(i){for(let[e,t]of this.map)if(t.kind===2&&t.bracketIds.intersects(i))return e}get isEmpty(){return this.map.size===0}};function ZVo(a){let i=ns(a);return/^[\w ]+/.test(a)&&(i=`\\b${i}`),/[\w ]+$/.test(a)&&(i=`${i}\\b`),i}var Jwe=class{constructor(i,e){this.denseKeyProvider=i;this.getLanguageConfiguration=e;this.languageIdToBracketTokens=new Map}didLanguageChange(i){return this.languageIdToBracketTokens.has(i)}getSingleLanguageBracketTokens(i){let e=this.languageIdToBracketTokens.get(i);return e||(e=poi.createFromLanguage(this.getLanguageConfiguration(i),this.denseKeyProvider),this.languageIdToBracketTokens.set(i,e)),e}getToken(i,e){return this.getSingleLanguageBracketTokens(e).getToken(i)}};function x8i(a){if(a.length===0)return null;if(a.length===1)return a[0];let i=0;function e(){if(i>=a.length)return null;let r=i,s=a[r].listHeight;for(i++;i<a.length&&a[i].listHeight===s;)i++;return i-r>=2?goi(r===0&&i===a.length?a:a.slice(r,i),!1):a[r]}let t=e(),o=e();if(!o)return t;for(let r=e();r;r=e())C8i(t,o)<=C8i(o,r)?(t=moi(t,o),o=r):o=moi(o,r);return moi(t,o)}function goi(a,i=!1){if(a.length===0)return null;if(a.length===1)return a[0];let e=a.length;for(;e>3;){let t=e>>1;for(let o=0;o<t;o++){let n=o<<1;a[o]=tR.create23(a[n],a[n+1],n+3===e?a[n+2]:null,i)}e=t}return tR.create23(a[0],a[1],e>=3?a[2]:null,i)}function C8i(a,i){return Math.abs(a.listHeight-i.listHeight)}function moi(a,i){return a.listHeight===i.listHeight?tR.create23(a,i,null,!1):a.listHeight>i.listHeight?eBo(a,i):tBo(i,a)}function eBo(a,i){a=a.toMutable();let e=a,t=[],o;for(;;){if(i.listHeight===e.listHeight){o=i;break}if(e.kind!==4)throw new Error("unexpected");t.push(e),e=e.makeLastElementMutable()}for(let n=t.length-1;n>=0;n--){let r=t[n];o?r.childrenLength>=3?o=tR.create23(r.unappendChild(),o,null,!1):(r.appendChildOfSameHeight(o),o=void 0):r.handleChildrenChanged()}return o?tR.create23(a,o,null,!1):a}function tBo(a,i){a=a.toMutable();let e=a,t=[];for(;i.listHeight!==e.listHeight;){if(e.kind!==4)throw new Error("unexpected");t.push(e),e=e.makeFirstElementMutable()}let o=i;for(let n=t.length-1;n>=0;n--){let r=t[n];o?r.childrenLength>=3?o=tR.create23(o,r.unprependChild(),null,!1):(r.prependChildOfSameHeight(o),o=void 0):r.handleChildrenChanged()}return o?tR.create23(o,a,null,!1):a}var hIt=class{constructor(i){this.lastOffset=mb;this.nextNodes=[i],this.offsets=[mb],this.idxs=[]}readLongestNodeAt(i,e){if(Rj(i,this.lastOffset))throw new Error("Invalid offset");for(this.lastOffset=i;;){let t=E5e(this.nextNodes);if(!t)return;let o=E5e(this.offsets);if(Rj(i,o))return;if(Rj(o,i))if(eu(o,t.length)<=i)this.nextNodeAfterCurrent();else{let n=foi(t);n!==-1?(this.nextNodes.push(t.getChild(n)),this.offsets.push(o),this.idxs.push(n)):this.nextNodeAfterCurrent()}else{if(e(t))return this.nextNodeAfterCurrent(),t;{let n=foi(t);if(n===-1){this.nextNodeAfterCurrent();return}else this.nextNodes.push(t.getChild(n)),this.offsets.push(o),this.idxs.push(n)}}}}nextNodeAfterCurrent(){for(;;){let i=E5e(this.offsets),e=E5e(this.nextNodes);if(this.nextNodes.pop(),this.offsets.pop(),this.idxs.length===0)break;let t=E5e(this.nextNodes),o=foi(t,this.idxs[this.idxs.length-1]);if(o!==-1){this.nextNodes.push(t.getChild(o)),this.offsets.push(eu(i,e.length)),this.idxs[this.idxs.length-1]=o;break}else this.idxs.pop()}}};function foi(a,i=-1){for(;;){if(i++,i>=a.childrenLength)return-1;if(a.getChild(i))return i}}function E5e(a){return a.length>0?a[a.length-1]:void 0}function T5e(a,i,e,t){return new voi(a,i,e,t).parseDocument()}var voi=class{constructor(i,e,t,o){this.tokenizer=i;this.createImmutableLists=o;this._itemsConstructed=0;this._itemsFromCache=0;if(t&&o)throw new Error("Not supported");this.oldNodeReader=t?new hIt(t):void 0,this.positionMapper=new pIt(e)}get nodesConstructed(){return this._itemsConstructed}get nodesReused(){return this._itemsFromCache}parseDocument(){this._itemsConstructed=0,this._itemsFromCache=0;let i=this.parseList(cw.getEmpty(),0);return i||(i=tR.getEmpty()),i}parseList(i,e){let t=[];for(;;){let n=this.tryReadChildFromCache(i);if(!n){let r=this.tokenizer.peek();if(!r||r.kind===2&&r.bracketIds.intersects(i))break;n=this.parseChild(i,e+1)}n.kind===4&&n.childrenLength===0||t.push(n)}return this.oldNodeReader?x8i(t):goi(t,this.createImmutableLists)}tryReadChildFromCache(i){if(this.oldNodeReader){let e=this.positionMapper.getDistanceToNextChange(this.tokenizer.offset);if(e===null||!jwe(e)){let t=this.oldNodeReader.readLongestNodeAt(this.positionMapper.getOffsetBeforeChange(this.tokenizer.offset),o=>e!==null&&!Rj(o.length,e)?!1:o.canBeReused(i));if(t)return this._itemsFromCache++,this.tokenizer.skip(t.length),t}}}parseChild(i,e){this._itemsConstructed++;let t=this.tokenizer.read();switch(t.kind){case 2:return new uIt(t.bracketIds,t.length);case 0:return t.astNode;case 1:{if(e>300)return new WV(t.length);let o=i.merge(t.bracketIds),n=this.parseList(o,e+1),r=this.tokenizer.peek();return r&&r.kind===2&&(r.bracketId===t.bracketId||r.bracketIds.intersects(t.bracketIds))?(this.tokenizer.read(),y5e.create(t.astNode,n,r.astNode)):y5e.create(t.astNode,n,null)}default:throw new Error("unexpected")}}};function Zwe(a,i){if(a.length===0)return i;if(i.length===0)return a;let e=new uE(k8i(a)),t=k8i(i);t.push({modified:!1,lengthBefore:void 0,lengthAfter:void 0});let o=e.dequeue();function n(c){if(c===void 0){let p=e.takeWhile(h=>!0)||[];return o&&p.unshift(o),p}let u=[];for(;o&&!jwe(c);){let[p,h]=o.splitAt(c);u.push(p),c=Nle(p.lengthAfter,c),o=h??e.dequeue()}return jwe(c)||u.push(new _5e(!1,c,c)),u}let r=[];function s(c,u,p){if(r.length>0&&aoi(r[r.length-1].endOffset,c)){let h=r[r.length-1];r[r.length-1]=new WO(h.startOffset,u,eu(h.newLength,p))}else r.push({startOffset:c,endOffset:u,newLength:p})}let l=mb;for(let c of t){let u=n(c.lengthBefore);if(c.modified){let p=y8i(u,g=>g.lengthBefore),h=eu(l,p);s(l,h,c.lengthAfter),l=h}else for(let p of u){let h=l;l=eu(l,p.lengthBefore),p.modified&&s(h,l,p.lengthAfter)}}return r}var _5e=class a{constructor(i,e,t){this.modified=i;this.lengthBefore=e;this.lengthAfter=t}splitAt(i){let e=Nle(i,this.lengthAfter);return aoi(e,mb)?[this,void 0]:this.modified?[new a(this.modified,this.lengthBefore,i),new a(this.modified,mb,e)]:[new a(this.modified,i,i),new a(this.modified,e,e)]}toString(){return`${this.modified?"M":"U"}:${jx(this.lengthBefore)} -> ${jx(this.lengthAfter)}`}};function k8i(a){let i=[],e=mb;for(let t of a){let o=Nle(e,t.startOffset);jwe(o)||i.push(new _5e(!1,o,o));let n=Nle(t.startOffset,t.endOffset);i.push(new _5e(!0,n,t.newLength)),e=t.endOffset}return i}var gIt=class extends x{constructor(e,t){super();this.textModel=e;this.getLanguageConfiguration=t;if(this.didChangeEmitter=this._register(new E),this.denseKeyProvider=new Ywe,this.brackets=new Jwe(this.denseKeyProvider,this.getLanguageConfiguration),this.onDidChange=this.didChangeEmitter.event,this.queuedTextEditsForInitialAstWithoutTokens=[],this.queuedTextEdits=[],e.tokenization.hasTokens)e.tokenization.backgroundTokenizationState===2?(this.initialAstWithoutTokens=void 0,this.astWithTokens=this.parseDocumentFromTextBuffer([],void 0,!1)):(this.initialAstWithoutTokens=this.parseDocumentFromTextBuffer([],void 0,!0),this.astWithTokens=this.initialAstWithoutTokens);else{let o=this.brackets.getSingleLanguageBracketTokens(this.textModel.getLanguageId()),n=new mIt(this.textModel.getValue(),o);this.initialAstWithoutTokens=T5e(n,[],void 0,!0),this.astWithTokens=this.initialAstWithoutTokens}}didLanguageChange(e){return this.brackets.didLanguageChange(e)}handleDidChangeBackgroundTokenizationState(){if(this.textModel.tokenization.backgroundTokenizationState===2){let e=this.initialAstWithoutTokens===void 0;this.initialAstWithoutTokens=void 0,e||this.didChangeEmitter.fire()}}handleDidChangeTokens({ranges:e}){let t=e.map(o=>new WO(Rm(o.fromLineNumber-1,0),Rm(o.toLineNumber,0),Rm(o.toLineNumber-o.fromLineNumber+1,0)));this.handleEdits(t,!0),this.initialAstWithoutTokens||this.didChangeEmitter.fire()}handleContentChanged(e){let t=WO.fromModelContentChanges(e.changes);this.handleEdits(t,!1)}handleEdits(e,t){let o=Zwe(this.queuedTextEdits,e);this.queuedTextEdits=o,this.initialAstWithoutTokens&&!t&&(this.queuedTextEditsForInitialAstWithoutTokens=Zwe(this.queuedTextEditsForInitialAstWithoutTokens,e))}flushQueue(){this.queuedTextEdits.length>0&&(this.astWithTokens=this.parseDocumentFromTextBuffer(this.queuedTextEdits,this.astWithTokens,!1),this.queuedTextEdits=[]),this.queuedTextEditsForInitialAstWithoutTokens.length>0&&(this.initialAstWithoutTokens&&(this.initialAstWithoutTokens=this.parseDocumentFromTextBuffer(this.queuedTextEditsForInitialAstWithoutTokens,this.initialAstWithoutTokens,!1)),this.queuedTextEditsForInitialAstWithoutTokens=[])}parseDocumentFromTextBuffer(e,t,o){let r=t,s=new Xwe(this.textModel,this.brackets);return T5e(s,e,r,o)}getBracketsInRange(e,t){this.flushQueue();let o=Rm(e.startLineNumber-1,e.startColumn-1),n=Rm(e.endLineNumber-1,e.endColumn-1);return new w$(r=>{let s=this.initialAstWithoutTokens||this.astWithTokens;boi(s,mb,s.length,o,n,r,0,0,new Map,t)})}getBracketPairsInRange(e,t){this.flushQueue();let o=X7(e.getStartPosition()),n=X7(e.getEndPosition());return new w$(r=>{let s=this.initialAstWithoutTokens||this.astWithTokens,l=new Soi(r,t,this.textModel);Ioi(s,mb,s.length,o,n,l,0,new Map)})}getFirstBracketAfter(e){this.flushQueue();let t=this.initialAstWithoutTokens||this.astWithTokens;return T8i(t,mb,t.length,X7(e))}getFirstBracketBefore(e){this.flushQueue();let t=this.initialAstWithoutTokens||this.astWithTokens;return E8i(t,mb,t.length,X7(e))}};function E8i(a,i,e,t){if(a.kind===4||a.kind===2){let o=[];for(let n of a.children)e=eu(i,n.length),o.push({nodeOffsetStart:i,nodeOffsetEnd:e}),i=e;for(let n=o.length-1;n>=0;n--){let{nodeOffsetStart:r,nodeOffsetEnd:s}=o[n];if(Rj(r,t)){let l=E8i(a.children[n],r,s,t);if(l)return l}}return null}else{if(a.kind===3)return null;if(a.kind===1){let o=J7(i,e);return{bracketInfo:a.bracketInfo,range:o}}}return null}function T8i(a,i,e,t){if(a.kind===4||a.kind===2){for(let o of a.children){if(e=eu(i,o.length),Rj(t,e)){let n=T8i(o,i,e,t);if(n)return n}i=e}return null}else{if(a.kind===3)return null;if(a.kind===1){let o=J7(i,e);return{bracketInfo:a.bracketInfo,range:o}}}return null}function boi(a,i,e,t,o,n,r,s,l,c,u=!1){if(r>200)return!0;e:for(;;)switch(a.kind){case 4:{let p=a.childrenLength;for(let h=0;h<p;h++){let g=a.getChild(h);if(g){if(e=eu(i,g.length),Y7(i,o)&&Qwe(e,t)){if(Qwe(e,o)){a=g;continue e}if(!boi(g,i,e,t,o,n,r,0,l,c))return!1}i=e}}return!0}case 2:{let p=!c||!a.closingBracket||a.closingBracket.bracketInfo.closesColorized(a.openingBracket.bracketInfo),h=0;if(l){let f=l.get(a.openingBracket.text);f===void 0&&(f=0),h=f,p&&(f++,l.set(a.openingBracket.text,f))}let g=a.childrenLength;for(let f=0;f<g;f++){let v=a.getChild(f);if(v){if(e=eu(i,v.length),Y7(i,o)&&Qwe(e,t)){if(Qwe(e,o)&&v.kind!==1){a=v,p?(r++,s=h+1):s=h;continue e}if((p||v.kind!==1||!a.closingBracket)&&!boi(v,i,e,t,o,n,p?r+1:r,p?h+1:h,l,c,!a.closingBracket))return!1}i=e}}return l?.set(a.openingBracket.text,h),!0}case 3:{let p=J7(i,e);return n(new S5e(p,r-1,0,!0))}case 1:{let p=J7(i,e);return n(new S5e(p,r-1,s-1,u))}case 0:return!0}}var Soi=class{constructor(i,e,t){this.push=i;this.includeMinIndentation=e;this.textModel=t}};function Ioi(a,i,e,t,o,n,r,s){if(r>200)return!0;let l=!0;if(a.kind===2){let c=0;if(s){let h=s.get(a.openingBracket.text);h===void 0&&(h=0),c=h,h++,s.set(a.openingBracket.text,h)}let u=eu(i,a.openingBracket.length),p=-1;if(n.includeMinIndentation&&(p=a.computeMinIndentation(i,n.textModel)),l=n.push(new lIt(J7(i,e),J7(i,u),a.closingBracket?J7(eu(u,a.child?.length||mb),e):void 0,r,c,a,p)),i=u,l&&a.child){let h=a.child;if(e=eu(i,h.length),Y7(i,o)&&Qwe(e,t)&&(l=Ioi(h,i,e,t,o,n,r+1,s),!l))return!1}s?.set(a.openingBracket.text,c)}else{let c=i;for(let u of a.children){let p=c;if(c=eu(c,u.length),Y7(p,o)&&Y7(t,c)&&(l=Ioi(u,p,c,t,o,n,r,s),!l))return!1}}return l}var vIt=class extends x{constructor(e,t){super();this.textModel=e;this.languageConfigurationService=t;this.bracketPairsTree=this._register(new me);this.onDidChangeEmitter=this._register(new E);this.onDidChange=this.onDidChangeEmitter.event;this.bracketsRequested=!1}get canBuildAST(){return this.textModel.getValueLength()<=5e6}handleLanguageConfigurationServiceChange(e){(!e.languageId||this.bracketPairsTree.value?.object.didLanguageChange(e.languageId))&&(this.bracketPairsTree.clear(),this.updateBracketPairsTree())}handleDidChangeOptions(e){this.bracketPairsTree.clear(),this.updateBracketPairsTree()}handleDidChangeLanguage(e){this.bracketPairsTree.clear(),this.updateBracketPairsTree()}handleDidChangeContent(e){this.bracketPairsTree.value?.object.handleContentChanged(e)}handleDidChangeBackgroundTokenizationState(){this.bracketPairsTree.value?.object.handleDidChangeBackgroundTokenizationState()}handleDidChangeTokens(e){this.bracketPairsTree.value?.object.handleDidChangeTokens(e)}updateBracketPairsTree(){if(this.bracketsRequested&&this.canBuildAST){if(!this.bracketPairsTree.value){let e=new N;this.bracketPairsTree.value=iBo(e.add(new gIt(this.textModel,t=>this.languageConfigurationService.getLanguageConfiguration(t))),e),e.add(this.bracketPairsTree.value.object.onDidChange(t=>this.onDidChangeEmitter.fire(t))),this.onDidChangeEmitter.fire()}}else this.bracketPairsTree.value&&(this.bracketPairsTree.clear(),this.onDidChangeEmitter.fire())}getBracketPairsInRange(e){return this.bracketsRequested=!0,this.updateBracketPairsTree(),this.bracketPairsTree.value?.object.getBracketPairsInRange(e,!1)||w$.empty}getBracketPairsInRangeWithMinIndentation(e){return this.bracketsRequested=!0,this.updateBracketPairsTree(),this.bracketPairsTree.value?.object.getBracketPairsInRange(e,!0)||w$.empty}getBracketsInRange(e,t=!1){return this.bracketsRequested=!0,this.updateBracketPairsTree(),this.bracketPairsTree.value?.object.getBracketsInRange(e,t)||w$.empty}findMatchingBracketUp(e,t,o){let n=this.textModel.validatePosition(t),r=this.textModel.getLanguageIdAtPosition(n.lineNumber,n.column);if(this.canBuildAST){let s=this.languageConfigurationService.getLanguageConfiguration(r).bracketsNew.getClosingBracketInfo(e);if(!s)return null;let l=this.getBracketPairsInRange(z.fromPositions(t,t)).findLast(c=>s.closes(c.openingBracketInfo));return l?l.openingBracketRange:null}else{let s=e.toLowerCase(),l=this.languageConfigurationService.getLanguageConfiguration(r).brackets;if(!l)return null;let c=l.textIsBracket[s];return c?fIt(this._findMatchingBracketUp(c,n,woi(o))):null}}matchBracket(e,t){if(this.canBuildAST){let o=this.getBracketPairsInRange(z.fromPositions(e,e)).filter(n=>n.closingBracketRange!==void 0&&(n.openingBracketRange.containsPosition(e)||n.closingBracketRange.containsPosition(e))).findLastMaxBy(cl(n=>n.openingBracketRange.containsPosition(e)?n.openingBracketRange:n.closingBracketRange,z.compareRangesUsingStarts));return o?[o.openingBracketRange,o.closingBracketRange]:null}else{let o=woi(t);return this._matchBracket(this.textModel.validatePosition(e),o)}}_establishBracketSearchOffsets(e,t,o,n){let r=t.getCount(),s=t.getLanguageId(n),l=Math.max(0,e.column-1-o.maxBracketLength);for(let u=n-1;u>=0;u--){let p=t.getEndOffset(u);if(p<=l)break;if(mO(t.getStandardTokenType(u))||t.getLanguageId(u)!==s){l=p;break}}let c=Math.min(t.getLineContent().length,e.column-1+o.maxBracketLength);for(let u=n+1;u<r;u++){let p=t.getStartOffset(u);if(p>=c)break;if(mO(t.getStandardTokenType(u))||t.getLanguageId(u)!==s){c=p;break}}return{searchStartOffset:l,searchEndOffset:c}}_matchBracket(e,t){let o=e.lineNumber,n=this.textModel.tokenization.getLineTokens(o),r=this.textModel.getLineContent(o),s=n.findTokenIndexAtOffset(e.column-1);if(s<0)return null;let l=this.languageConfigurationService.getLanguageConfiguration(n.getLanguageId(s)).brackets;if(l&&!mO(n.getStandardTokenType(s))){let{searchStartOffset:c,searchEndOffset:u}=this._establishBracketSearchOffsets(e,n,l,s),p=null;for(;;){let h=bE.findNextBracketInRange(l.forwardRegex,o,r,c,u);if(!h)break;if(h.startColumn<=e.column&&e.column<=h.endColumn){let g=r.substring(h.startColumn-1,h.endColumn-1).toLowerCase(),f=this._matchFoundBracket(h,l.textIsBracket[g],l.textIsOpenBracket[g],t);if(f){if(f instanceof Mj)return null;p=f}}c=h.endColumn-1}if(p)return p}if(s>0&&n.getStartOffset(s)===e.column-1){let c=s-1,u=this.languageConfigurationService.getLanguageConfiguration(n.getLanguageId(c)).brackets;if(u&&!mO(n.getStandardTokenType(c))){let{searchStartOffset:p,searchEndOffset:h}=this._establishBracketSearchOffsets(e,n,u,c),g=bE.findPrevBracketInRange(u.reversedRegex,o,r,p,h);if(g&&g.startColumn<=e.column&&e.column<=g.endColumn){let f=r.substring(g.startColumn-1,g.endColumn-1).toLowerCase(),v=this._matchFoundBracket(g,u.textIsBracket[f],u.textIsOpenBracket[f],t);if(v)return v instanceof Mj?null:v}}}return null}_matchFoundBracket(e,t,o,n){if(!t)return null;let r=o?this._findMatchingBracketDown(t,e.getEndPosition(),n):this._findMatchingBracketUp(t,e.getStartPosition(),n);return r?r instanceof Mj?r:[e,r]:null}_findMatchingBracketUp(e,t,o){let n=e.languageId,r=e.reversedRegex,s=-1,l=0,c=(u,p,h,g)=>{for(;;){if(o&&++l%100===0&&!o())return Mj.INSTANCE;let f=bE.findPrevBracketInRange(r,u,p,h,g);if(!f)break;let v=p.substring(f.startColumn-1,f.endColumn-1).toLowerCase();if(e.isOpen(v)?s++:e.isClose(v)&&s--,s===0)return f;g=f.startColumn-1}return null};for(let u=t.lineNumber;u>=1;u--){let p=this.textModel.tokenization.getLineTokens(u),h=p.getCount(),g=this.textModel.getLineContent(u),f=h-1,v=g.length,b=g.length;u===t.lineNumber&&(f=p.findTokenIndexAtOffset(t.column-1),v=t.column-1,b=t.column-1);let S=!0;for(;f>=0;f--){let y=p.getLanguageId(f)===n&&!mO(p.getStandardTokenType(f));if(y)S?v=p.getStartOffset(f):(v=p.getStartOffset(f),b=p.getEndOffset(f));else if(S&&v!==b){let w=c(u,g,v,b);if(w)return w}S=y}if(S&&v!==b){let y=c(u,g,v,b);if(y)return y}}return null}_findMatchingBracketDown(e,t,o){let n=e.languageId,r=e.forwardRegex,s=1,l=0,c=(p,h,g,f)=>{for(;;){if(o&&++l%100===0&&!o())return Mj.INSTANCE;let v=bE.findNextBracketInRange(r,p,h,g,f);if(!v)break;let b=h.substring(v.startColumn-1,v.endColumn-1).toLowerCase();if(e.isOpen(b)?s++:e.isClose(b)&&s--,s===0)return v;g=v.endColumn-1}return null},u=this.textModel.getLineCount();for(let p=t.lineNumber;p<=u;p++){let h=this.textModel.tokenization.getLineTokens(p),g=h.getCount(),f=this.textModel.getLineContent(p),v=0,b=0,S=0;p===t.lineNumber&&(v=h.findTokenIndexAtOffset(t.column-1),b=t.column-1,S=t.column-1);let y=!0;for(;v<g;v++){let w=h.getLanguageId(v)===n&&!mO(h.getStandardTokenType(v));if(w)y||(b=h.getStartOffset(v)),S=h.getEndOffset(v);else if(y&&b!==S){let k=c(p,f,b,S);if(k)return k}y=w}if(y&&b!==S){let w=c(p,f,b,S);if(w)return w}}return null}findPrevBracket(e){let t=this.textModel.validatePosition(e);if(this.canBuildAST)return this.bracketsRequested=!0,this.updateBracketPairsTree(),this.bracketPairsTree.value?.object.getFirstBracketBefore(t)||null;let o=null,n=null,r=null;for(let s=t.lineNumber;s>=1;s--){let l=this.textModel.tokenization.getLineTokens(s),c=l.getCount(),u=this.textModel.getLineContent(s),p=c-1,h=u.length,g=u.length;if(s===t.lineNumber){p=l.findTokenIndexAtOffset(t.column-1),h=t.column-1,g=t.column-1;let v=l.getLanguageId(p);o!==v&&(o=v,n=this.languageConfigurationService.getLanguageConfiguration(o).brackets,r=this.languageConfigurationService.getLanguageConfiguration(o).bracketsNew)}let f=!0;for(;p>=0;p--){let v=l.getLanguageId(p);if(o!==v){if(n&&r&&f&&h!==g){let S=bE.findPrevBracketInRange(n.reversedRegex,s,u,h,g);if(S)return this._toFoundBracket(r,S);f=!1}o=v,n=this.languageConfigurationService.getLanguageConfiguration(o).brackets,r=this.languageConfigurationService.getLanguageConfiguration(o).bracketsNew}let b=!!n&&!mO(l.getStandardTokenType(p));if(b)f?h=l.getStartOffset(p):(h=l.getStartOffset(p),g=l.getEndOffset(p));else if(r&&n&&f&&h!==g){let S=bE.findPrevBracketInRange(n.reversedRegex,s,u,h,g);if(S)return this._toFoundBracket(r,S)}f=b}if(r&&n&&f&&h!==g){let v=bE.findPrevBracketInRange(n.reversedRegex,s,u,h,g);if(v)return this._toFoundBracket(r,v)}}return null}findNextBracket(e){let t=this.textModel.validatePosition(e);if(this.canBuildAST)return this.bracketsRequested=!0,this.updateBracketPairsTree(),this.bracketPairsTree.value?.object.getFirstBracketAfter(t)||null;let o=this.textModel.getLineCount(),n=null,r=null,s=null;for(let l=t.lineNumber;l<=o;l++){let c=this.textModel.tokenization.getLineTokens(l),u=c.getCount(),p=this.textModel.getLineContent(l),h=0,g=0,f=0;if(l===t.lineNumber){h=c.findTokenIndexAtOffset(t.column-1),g=t.column-1,f=t.column-1;let b=c.getLanguageId(h);n!==b&&(n=b,r=this.languageConfigurationService.getLanguageConfiguration(n).brackets,s=this.languageConfigurationService.getLanguageConfiguration(n).bracketsNew)}let v=!0;for(;h<u;h++){let b=c.getLanguageId(h);if(n!==b){if(s&&r&&v&&g!==f){let y=bE.findNextBracketInRange(r.forwardRegex,l,p,g,f);if(y)return this._toFoundBracket(s,y);v=!1}n=b,r=this.languageConfigurationService.getLanguageConfiguration(n).brackets,s=this.languageConfigurationService.getLanguageConfiguration(n).bracketsNew}let S=!!r&&!mO(c.getStandardTokenType(h));if(S)v||(g=c.getStartOffset(h)),f=c.getEndOffset(h);else if(s&&r&&v&&g!==f){let y=bE.findNextBracketInRange(r.forwardRegex,l,p,g,f);if(y)return this._toFoundBracket(s,y)}v=S}if(s&&r&&v&&g!==f){let b=bE.findNextBracketInRange(r.forwardRegex,l,p,g,f);if(b)return this._toFoundBracket(s,b)}}return null}findEnclosingBrackets(e,t){let o=this.textModel.validatePosition(e);if(this.canBuildAST){let f=z.fromPositions(o),v=this.getBracketPairsInRange(z.fromPositions(o,o)).findLast(b=>b.closingBracketRange!==void 0&&b.range.strictContainsRange(f));return v?[v.openingBracketRange,v.closingBracketRange]:null}let n=woi(t),r=this.textModel.getLineCount(),s=new Map,l=[],c=(f,v)=>{if(!s.has(f)){let b=[];for(let S=0,y=v?v.brackets.length:0;S<y;S++)b[S]=0;s.set(f,b)}l=s.get(f)},u=0,p=(f,v,b,S,y)=>{for(;;){if(n&&++u%100===0&&!n())return Mj.INSTANCE;let w=bE.findNextBracketInRange(f.forwardRegex,v,b,S,y);if(!w)break;let k=b.substring(w.startColumn-1,w.endColumn-1).toLowerCase(),T=f.textIsBracket[k];if(T&&(T.isOpen(k)?l[T.index]++:T.isClose(k)&&l[T.index]--,l[T.index]===-1))return this._matchFoundBracket(w,T,!1,n);S=w.endColumn-1}return null},h=null,g=null;for(let f=o.lineNumber;f<=r;f++){let v=this.textModel.tokenization.getLineTokens(f),b=v.getCount(),S=this.textModel.getLineContent(f),y=0,w=0,k=0;if(f===o.lineNumber){y=v.findTokenIndexAtOffset(o.column-1),w=o.column-1,k=o.column-1;let P=v.getLanguageId(y);h!==P&&(h=P,g=this.languageConfigurationService.getLanguageConfiguration(h).brackets,c(h,g))}let T=!0;for(;y<b;y++){let P=v.getLanguageId(y);if(h!==P){if(g&&T&&w!==k){let V=p(g,f,S,w,k);if(V)return fIt(V);T=!1}h=P,g=this.languageConfigurationService.getLanguageConfiguration(h).brackets,c(h,g)}let O=!!g&&!mO(v.getStandardTokenType(y));if(O)T||(w=v.getStartOffset(y)),k=v.getEndOffset(y);else if(g&&T&&w!==k){let V=p(g,f,S,w,k);if(V)return fIt(V)}T=O}if(g&&T&&w!==k){let P=p(g,f,S,w,k);if(P)return fIt(P)}}return null}_toFoundBracket(e,t){if(!t)return null;let o=this.textModel.getValueInRange(t);o=o.toLowerCase();let n=e.getBracketInfo(o);return n?{range:t,bracketInfo:n}:null}};function iBo(a,i){return{object:a,dispose:()=>i?.dispose()}}function woi(a){if(typeof a>"u")return()=>!0;{let i=Date.now();return()=>Date.now()-i<=a}}var Mj=class a{constructor(){this._searchCanceledBrand=void 0}static{this.INSTANCE=new a}};function fIt(a){return a instanceof Mj?null:a}var bIt=class extends x{constructor(e){super();this.textModel=e;this.colorProvider=new SIt;this.onDidChangeEmitter=this._register(new E);this.onDidChange=this.onDidChangeEmitter.event;this.colorizationOptions=e.getOptions().bracketPairColorizationOptions,this._register(e.bracketPairs.onDidChange(t=>{this.onDidChangeEmitter.fire()}))}handleDidChangeOptions(e){this.colorizationOptions=this.textModel.getOptions().bracketPairColorizationOptions}getDecorationsInRange(e,t,o,n,r){return r?[]:t===void 0?[]:this.colorizationOptions.enabled?this.textModel.bracketPairs.getBracketsInRange(e,!0).map(l=>({id:`bracket${l.range.toString()}-${l.nestingLevel}`,options:{description:"BracketPairColorization",inlineClassName:this.colorProvider.getInlineClassName(l,this.colorizationOptions.independentColorPoolPerBracketType)},ownerId:0,range:l.range})).toArray():[]}getAllDecorations(e,t,o){return e===void 0?[]:this.colorizationOptions.enabled?this.getDecorationsInRange(new z(1,1,this.textModel.getLineCount(),1),e,t,o):[]}},SIt=class{constructor(){this.unexpectedClosingBracketClassName="unexpected-closing-bracket"}getInlineClassName(i,e){return i.isInvalid?this.unexpectedClosingBracketClassName:this.getInlineClassNameOfLevel(e?i.nestingLevelOfEqualBracketType:i.nestingLevel)}getInlineClassNameOfLevel(i){return`bracket-highlighting-${i%30}`}};is((a,i)=>{let e=[Ybt,Xbt,Jbt,Zbt,eSt,tSt],t=new SIt;i.addRule(`.monaco-editor .${t.unexpectedClosingBracketClassName} { color: ${a.getColor(P3i)}; }`);let o=e.map(n=>a.getColor(n)).filter(n=>!!n).filter(n=>!n.isTransparent());for(let n=0;n<30;n++){let r=o[n%o.length];i.addRule(`.monaco-editor .${t.getInlineClassNameOfLevel(n)} { color: ${r}; }`)}});function IIt(a){return a.replace(/\n/g,"\\n").replace(/\r/g,"\\r")}var iR=class a{constructor(i,e,t,o){this.oldPosition=i;this.oldText=e;this.newPosition=t;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} "${IIt(this.newText)}")`:this.newText.length===0?`(delete@${this.oldPosition} "${IIt(this.oldText)}")`:`(replace@${this.oldPosition} "${IIt(this.oldText)}" with "${IIt(this.newText)}")`}static _writeStringSize(i){return 4+2*i.length}static _writeString(i,e,t){let o=e.length;HI(i,o,t),t+=4;for(let n=0;n<o;n++)aqi(i,e.charCodeAt(n),t),t+=2;return t}static _readString(i,e){let t=BI(i,e);return e+=4,z$i(i,e,t)}writeSize(){return 8+a._writeStringSize(this.oldText)+a._writeStringSize(this.newText)}write(i,e){return HI(i,this.oldPosition,e),e+=4,HI(i,this.newPosition,e),e+=4,e=a._writeString(i,this.oldText,e),e=a._writeString(i,this.newText,e),e}static read(i,e,t){let o=BI(i,e);e+=4;let n=BI(i,e);e+=4;let r=a._readString(i,e);e+=a._writeStringSize(r);let s=a._readString(i,e);return e+=a._writeStringSize(s),t.push(new a(o,r,n,s)),e}};function _8i(a,i){return a===null||a.length===0?i:new Coi(a,i).compress()}var Coi=class a{constructor(i,e){this._prevEdits=i,this._currEdits=e,this._result=[],this._resultLen=0,this._prevLen=this._prevEdits.length,this._prevDeltaOffset=0,this._currLen=this._currEdits.length,this._currDeltaOffset=0}compress(){let i=0,e=0,t=this._getPrev(i),o=this._getCurr(e);for(;i<this._prevLen||e<this._currLen;){if(t===null){this._acceptCurr(o),o=this._getCurr(++e);continue}if(o===null){this._acceptPrev(t),t=this._getPrev(++i);continue}if(o.oldEnd<=t.newPosition){this._acceptCurr(o),o=this._getCurr(++e);continue}if(t.newEnd<=o.oldPosition){this._acceptPrev(t),t=this._getPrev(++i);continue}if(o.oldPosition<t.newPosition){let[c,u]=a._splitCurr(o,t.newPosition-o.oldPosition);this._acceptCurr(c),o=u;continue}if(t.newPosition<o.oldPosition){let[c,u]=a._splitPrev(t,o.oldPosition-t.newPosition);this._acceptPrev(c),t=u;continue}let s,l;if(o.oldEnd===t.newEnd)s=t,l=o,t=this._getPrev(++i),o=this._getCurr(++e);else if(o.oldEnd<t.newEnd){let[c,u]=a._splitPrev(t,o.oldLength);s=c,l=o,t=u,o=this._getCurr(++e)}else{let[c,u]=a._splitCurr(o,t.newLength);s=t,l=c,t=this._getPrev(++i),o=u}this._result[this._resultLen++]=new iR(s.oldPosition,s.oldText,l.newPosition,l.newText),this._prevDeltaOffset+=s.newLength-s.oldLength,this._currDeltaOffset+=l.newLength-l.oldLength}let n=a._merge(this._result);return a._removeNoOps(n)}_acceptCurr(i){this._result[this._resultLen++]=a._rebaseCurr(this._prevDeltaOffset,i),this._currDeltaOffset+=i.newLength-i.oldLength}_getCurr(i){return i<this._currLen?this._currEdits[i]:null}_acceptPrev(i){this._result[this._resultLen++]=a._rebasePrev(this._currDeltaOffset,i),this._prevDeltaOffset+=i.newLength-i.oldLength}_getPrev(i){return i<this._prevLen?this._prevEdits[i]:null}static _rebaseCurr(i,e){return new iR(e.oldPosition-i,e.oldText,e.newPosition,e.newText)}static _rebasePrev(i,e){return new iR(e.oldPosition,e.oldText,e.newPosition+i,e.newText)}static _splitPrev(i,e){let t=i.newText.substr(0,e),o=i.newText.substr(e);return[new iR(i.oldPosition,i.oldText,i.newPosition,t),new iR(i.oldEnd,"",i.newPosition+e,o)]}static _splitCurr(i,e){let t=i.oldText.substr(0,e),o=i.oldText.substr(e);return[new iR(i.oldPosition,t,i.newPosition,i.newText),new iR(i.oldPosition+e,o,i.newEnd,"")]}static _merge(i){if(i.length===0)return i;let e=[],t=0,o=i[0];for(let n=1;n<i.length;n++){let r=i[n];o.oldEnd===r.oldPosition?o=new iR(o.oldPosition,o.oldText+r.oldText,o.newPosition,o.newText+r.newText):(e[t++]=o,o=r)}return e[t++]=o,e}static _removeNoOps(i){if(i.length===0)return i;let e=[],t=0;for(let o=0;o<i.length;o++){let n=i[o];n.oldText!==n.newText&&(e[t++]=n)}return e}};function eCe(a){return a.toString()}var P_=class a{constructor(i,e,t,o,n,r,s){this.beforeVersionId=i;this.afterVersionId=e;this.beforeEOL=t;this.afterEOL=o;this.beforeCursorState=n;this.afterCursorState=r;this.changes=s}static create(i,e){let t=i.getAlternativeVersionId(),o=xoi(i);return new a(t,t,o,o,e,e,[])}append(i,e,t,o,n){e.length>0&&(this.changes=_8i(this.changes,e)),this.afterEOL=t,this.afterVersionId=o,this.afterCursorState=n}static _writeSelectionsSize(i){return 4+16*(i?i.length:0)}static _writeSelections(i,e,t){if(HI(i,e?e.length:0,t),t+=4,e)for(let o of e)HI(i,o.selectionStartLineNumber,t),t+=4,HI(i,o.selectionStartColumn,t),t+=4,HI(i,o.positionLineNumber,t),t+=4,HI(i,o.positionColumn,t),t+=4;return t}static _readSelections(i,e,t){let o=BI(i,e);e+=4;for(let n=0;n<o;n++){let r=BI(i,e);e+=4;let s=BI(i,e);e+=4;let l=BI(i,e);e+=4;let c=BI(i,e);e+=4,t.push(new ti(r,s,l,c))}return e}serialize(){let i=10+a._writeSelectionsSize(this.beforeCursorState)+a._writeSelectionsSize(this.afterCursorState)+4;for(let o of this.changes)i+=o.writeSize();let e=new Uint8Array(i),t=0;HI(e,this.beforeVersionId,t),t+=4,HI(e,this.afterVersionId,t),t+=4,ogt(e,this.beforeEOL,t),t+=1,ogt(e,this.afterEOL,t),t+=1,t=a._writeSelections(e,this.beforeCursorState,t),t=a._writeSelections(e,this.afterCursorState,t),HI(e,this.changes.length,t),t+=4;for(let o of this.changes)t=o.write(e,t);return e.buffer}static deserialize(i){let e=new Uint8Array(i),t=0,o=BI(e,t);t+=4;let n=BI(e,t);t+=4;let r=igt(e,t);t+=1;let s=igt(e,t);t+=1;let l=[];t=a._readSelections(e,t,l);let c=[];t=a._readSelections(e,t,c);let u=BI(e,t);t+=4;let p=[];for(let h=0;h<u;h++)t=iR.read(e,t,p);return new a(o,n,r,s,l,c,p)}},oR=class{constructor(i,e,t,o){this.label=i;this.code=e;this.model=t,this._data=P_.create(t,o)}get type(){return 0}get resource(){return A.isUri(this.model)?this.model:this.model.uri}toString(){return(this._data instanceof P_?this._data:P_.deserialize(this._data)).changes.map(e=>e.toString()).join(", ")}matchesResource(i){return(A.isUri(this.model)?this.model:this.model.uri).toString()===i.toString()}setModel(i){this.model=i}canAppend(i){return this.model===i&&this._data instanceof P_}append(i,e,t,o,n){this._data instanceof P_&&this._data.append(i,e,t,o,n)}close(){this._data instanceof P_&&(this._data=this._data.serialize())}open(){this._data instanceof P_||(this._data=P_.deserialize(this._data))}undo(){if(A.isUri(this.model))throw new Error("Invalid SingleModelEditStackElement");this._data instanceof P_&&(this._data=this._data.serialize());let i=P_.deserialize(this._data);this.model._applyUndo(i.changes,i.beforeEOL,i.beforeVersionId,i.beforeCursorState)}redo(){if(A.isUri(this.model))throw new Error("Invalid SingleModelEditStackElement");this._data instanceof P_&&(this._data=this._data.serialize());let i=P_.deserialize(this._data);this.model._applyRedo(i.changes,i.afterEOL,i.afterVersionId,i.afterCursorState)}heapSize(){return this._data instanceof P_&&(this._data=this._data.serialize()),this._data.byteLength+168}},BV=class{constructor(i,e,t){this.label=i;this.code=e;this.type=1;this._isOpen=!0,this._editStackElementsArr=t.slice(0),this._editStackElementsMap=new Map;for(let o of this._editStackElementsArr){let n=eCe(o.resource);this._editStackElementsMap.set(n,o)}this._delegate=null}get resources(){return this._editStackElementsArr.map(i=>i.resource)}setDelegate(i){this._delegate=i}prepareUndoRedo(){if(this._delegate)return this._delegate.prepareUndoRedo(this)}getMissingModels(){let i=[];for(let e of this._editStackElementsArr)A.isUri(e.model)&&i.push(e.model);return i}matchesResource(i){let e=eCe(i);return this._editStackElementsMap.has(e)}setModel(i){let e=eCe(A.isUri(i)?i:i.uri);this._editStackElementsMap.has(e)&&this._editStackElementsMap.get(e).setModel(i)}canAppend(i){if(!this._isOpen)return!1;let e=eCe(i.uri);return this._editStackElementsMap.has(e)?this._editStackElementsMap.get(e).canAppend(i):!1}append(i,e,t,o,n){let r=eCe(i.uri);this._editStackElementsMap.get(r).append(i,e,t,o,n)}close(){this._isOpen=!1}open(){}undo(){this._isOpen=!1;for(let i of this._editStackElementsArr)i.undo()}redo(){for(let i of this._editStackElementsArr)i.redo()}heapSize(i){let e=eCe(i);return this._editStackElementsMap.has(e)?this._editStackElementsMap.get(e).heapSize():0}split(){return this._editStackElementsArr}toString(){let i=[];for(let e of this._editStackElementsArr)i.push(`${He(e.resource)}: ${e}`);return`{${i.join(", ")}}`}};function xoi(a){return a.getEOL()===`
`?0:1}function nz(a){return a?a instanceof oR||a instanceof BV:!1}var yIt=class a{constructor(i,e){this._model=i,this._undoRedoService=e}pushStackElement(){let i=this._undoRedoService.getLastElement(this._model.uri);nz(i)&&i.close()}popStackElement(){let i=this._undoRedoService.getLastElement(this._model.uri);nz(i)&&i.open()}clear(){this._undoRedoService.removeElements(this._model.uri)}_getOrCreateEditStackElement(i,e){let t=this._undoRedoService.getLastElement(this._model.uri);if(nz(t)&&t.canAppend(this._model))return t;let o=new oR(d(909,null),"undoredo.textBufferEdit",this._model,i);return this._undoRedoService.pushElement(o,e),o}pushEOL(i){let e=this._getOrCreateEditStackElement(null,void 0);this._model.setEOL(i),e.append(this._model,[],xoi(this._model),this._model.getAlternativeVersionId(),null)}pushEditOperation(i,e,t,o,n=Wc.unknown({name:"pushEditOperation"})){let r=this._getOrCreateEditStackElement(i,o),s=this._model.applyEdits(e,!0,n),l=a._computeCursorState(t,s),c=s.map((u,p)=>({index:p,textChange:u.textChange}));return c.sort((u,p)=>u.textChange.oldPosition===p.textChange.oldPosition?u.index-p.index:u.textChange.oldPosition-p.textChange.oldPosition),r.append(this._model,c.map(u=>u.textChange),xoi(this._model),this._model.getAlternativeVersionId(),l),l}static _computeCursorState(i,e){try{return i?i(e):null}catch(t){return mt(t),null}}};var koi=class{constructor(){this.spacesDiff=0;this.looksLikeAlignment=!1}};function oBo(a,i,e,t,o){o.spacesDiff=0,o.looksLikeAlignment=!1;let n;for(n=0;n<i&&n<t;n++){let h=a.charCodeAt(n),g=e.charCodeAt(n);if(h!==g)break}let r=0,s=0;for(let h=n;h<i;h++)a.charCodeAt(h)===32?r++:s++;let l=0,c=0;for(let h=n;h<t;h++)e.charCodeAt(h)===32?l++:c++;if(r>0&&s>0||l>0&&c>0)return;let u=Math.abs(s-c),p=Math.abs(r-l);if(u===0){o.spacesDiff=p,p>0&&0<=l-1&&l-1<a.length&&l<e.length&&e.charCodeAt(l)!==32&&a.charCodeAt(l-1)===32&&a.charCodeAt(a.length-1)===44&&(o.looksLikeAlignment=!0);return}if(p%u===0){o.spacesDiff=p/u;return}}function Eoi(a,i,e){let t=Math.min(a.getLineCount(),1e4),o=0,n=0,r="",s=0,l=[2,4,6,8,3,5,7],c=8,u=[0,0,0,0,0,0,0,0,0],p=new koi;for(let f=1;f<=t;f++){let v=a.getLineLength(f),b=a.getLineContent(f),S=v<=65536,y=!1,w=0,k=0,T=0;for(let O=0,V=v;O<V;O++){let H=S?b.charCodeAt(O):a.getLineCharCode(f,O);if(H===9)T++;else if(H===32)k++;else{y=!0,w=O;break}}if(!y||(T>0?o++:k>1&&n++,oBo(r,s,b,w,p),p.looksLikeAlignment&&!(e&&i===p.spacesDiff)))continue;let P=p.spacesDiff;P<=c&&u[P]++,r=b,s=w}let h=e;o!==n&&(h=o<n);let g=i;if(h){let f=0;l.forEach(v=>{let b=u[v];b>f&&(f=b,g=v)}),g===4&&u[4]>0&&u[2]>0&&u[2]>=u[4]*2/3&&(g=2)}return{insertSpaces:h,tabSize:g}}var tCe=class{constructor(i,e){this.piece=i,this.color=e,this.size_left=0,this.lf_left=0,this.parent=this,this.left=this,this.right=this}next(){if(this.right!==as)return wIt(this.right);let i=this;for(;i.parent!==as&&i.parent.left!==i;)i=i.parent;return i.parent===as?as:i.parent}prev(){if(this.left!==as)return _oi(this.left);let i=this;for(;i.parent!==as&&i.parent.right!==i;)i=i.parent;return i.parent===as?as:i.parent}detach(){this.parent=null,this.left=null,this.right=null}};var as=new tCe(null,0);as.parent=as;as.left=as;as.right=as;as.color=0;function wIt(a){for(;a.left!==as;)a=a.left;return a}function _oi(a){for(;a.right!==as;)a=a.right;return a}function Doi(a){return a===as?0:a.size_left+a.piece.length+Doi(a.right)}function Loi(a){return a===as?0:a.lf_left+a.piece.lineFeedCnt+Loi(a.right)}function Toi(){as.parent=as}function L5e(a,i){let e=i.right;e.size_left+=i.size_left+(i.piece?i.piece.length:0),e.lf_left+=i.lf_left+(i.piece?i.piece.lineFeedCnt:0),i.right=e.left,e.left!==as&&(e.left.parent=i),e.parent=i.parent,i.parent===as?a.root=e:i.parent.left===i?i.parent.left=e:i.parent.right=e,e.left=i,i.parent=e}function R5e(a,i){let e=i.left;i.left=e.right,e.right!==as&&(e.right.parent=i),e.parent=i.parent,i.size_left-=e.size_left+(e.piece?e.piece.length:0),i.lf_left-=e.lf_left+(e.piece?e.piece.lineFeedCnt:0),i.parent===as?a.root=e:i===i.parent.right?i.parent.right=e:i.parent.left=e,e.right=i,i.parent=e}function M5e(a,i){let e,t;if(i.left===as?(t=i,e=t.right):i.right===as?(t=i,e=t.left):(t=wIt(i.right),e=t.right),t===a.root){a.root=e,e.color=0,i.detach(),Toi(),a.root.parent=as;return}let o=t.color===1;if(t===t.parent.left?t.parent.left=e:t.parent.right=e,t===i?(e.parent=t.parent,D5e(a,e)):(t.parent===i?e.parent=t:e.parent=t.parent,D5e(a,e),t.left=i.left,t.right=i.right,t.parent=i.parent,t.color=i.color,i===a.root?a.root=t:i===i.parent.left?i.parent.left=t:i.parent.right=t,t.left!==as&&(t.left.parent=t),t.right!==as&&(t.right.parent=t),t.size_left=i.size_left,t.lf_left=i.lf_left,D5e(a,t)),i.detach(),e.parent.left===e){let r=Doi(e),s=Loi(e);if(r!==e.parent.size_left||s!==e.parent.lf_left){let l=r-e.parent.size_left,c=s-e.parent.lf_left;e.parent.size_left=r,e.parent.lf_left=s,sz(a,e.parent,l,c)}}if(D5e(a,e.parent),o){Toi();return}let n;for(;e!==a.root&&e.color===0;)e===e.parent.left?(n=e.parent.right,n.color===1&&(n.color=0,e.parent.color=1,L5e(a,e.parent),n=e.parent.right),n.left.color===0&&n.right.color===0?(n.color=1,e=e.parent):(n.right.color===0&&(n.left.color=0,n.color=1,R5e(a,n),n=e.parent.right),n.color=e.parent.color,e.parent.color=0,n.right.color=0,L5e(a,e.parent),e=a.root)):(n=e.parent.left,n.color===1&&(n.color=0,e.parent.color=1,R5e(a,e.parent),n=e.parent.left),n.left.color===0&&n.right.color===0?(n.color=1,e=e.parent):(n.left.color===0&&(n.right.color=0,n.color=1,L5e(a,n),n=e.parent.left),n.color=e.parent.color,e.parent.color=0,n.left.color=0,R5e(a,e.parent),e=a.root));e.color=0,Toi()}function Roi(a,i){for(D5e(a,i);i!==a.root&&i.parent.color===1;)if(i.parent===i.parent.parent.left){let e=i.parent.parent.right;e.color===1?(i.parent.color=0,e.color=0,i.parent.parent.color=1,i=i.parent.parent):(i===i.parent.right&&(i=i.parent,L5e(a,i)),i.parent.color=0,i.parent.parent.color=1,R5e(a,i.parent.parent))}else{let e=i.parent.parent.left;e.color===1?(i.parent.color=0,e.color=0,i.parent.parent.color=1,i=i.parent.parent):(i===i.parent.left&&(i=i.parent,R5e(a,i)),i.parent.color=0,i.parent.parent.color=1,L5e(a,i.parent.parent))}a.root.color=0}function sz(a,i,e,t){for(;i!==a.root&&i!==as;)i.parent.left===i&&(i.parent.size_left+=e,i.parent.lf_left+=t),i=i.parent}function D5e(a,i){let e=0,t=0;if(i!==a.root){for(;i!==a.root&&i===i.parent.right;)i=i.parent;if(i!==a.root)for(i=i.parent,e=Doi(i.left)-i.size_left,t=Loi(i.left)-i.lf_left,i.size_left+=e,i.lf_left+=t;i!==a.root&&(e!==0||t!==0);)i.parent.left===i&&(i.parent.size_left+=e,i.parent.lf_left+=t),i=i.parent}}var Pj=65535;function D8i(a){let i;return a[a.length-1]<65536?i=new Uint16Array(a.length):i=new Uint32Array(a.length),i.set(a,0),i}var Moi=class{constructor(i,e,t,o,n){this.lineStarts=i;this.cr=e;this.lf=t;this.crlf=o;this.isBasicASCII=n}};function az(a,i=!0){let e=[0],t=1;for(let o=0,n=a.length;o<n;o++){let r=a.charCodeAt(o);r===13?o+1<n&&a.charCodeAt(o+1)===10?(e[t++]=o+2,o++):e[t++]=o+1:r===10&&(e[t++]=o+1)}return i?D8i(e):e}function L8i(a,i){a.length=0,a[0]=0;let e=1,t=0,o=0,n=0,r=!0;for(let l=0,c=i.length;l<c;l++){let u=i.charCodeAt(l);u===13?l+1<c&&i.charCodeAt(l+1)===10?(n++,a[e++]=l+2,l++):(t++,a[e++]=l+1):u===10?(o++,a[e++]=l+1):r&&u!==9&&(u<32||u>126)&&(r=!1)}let s=new Moi(D8i(a),t,o,n,r);return a.length=0,s}var Qx=class{constructor(i,e,t,o,n){this.bufferIndex=i,this.start=e,this.end=t,this.lineFeedCnt=o,this.length=n}},lz=class{constructor(i,e){this.buffer=i,this.lineStarts=e}},Poi=class{constructor(i,e){this._pieces=[],this._tree=i,this._BOM=e,this._index=0,i.root!==as&&i.iterate(i.root,t=>(t!==as&&this._pieces.push(t.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++])}},Aoi=class{constructor(i){this._limit=i,this._cache=[]}get(i){for(let e=this._cache.length-1;e>=0;e--){let t=this._cache[e];if(t.nodeStartOffset<=i&&t.nodeStartOffset+t.node.piece.length>=i)return t}return null}get2(i){for(let e=this._cache.length-1;e>=0;e--){let t=this._cache[e];if(t.nodeStartLineNumber&&t.nodeStartLineNumber<i&&t.nodeStartLineNumber+t.node.piece.lineFeedCnt>=i)return t}return null}set(i){this._cache.length>=this._limit&&this._cache.shift(),this._cache.push(i)}validate(i){let e=!1,t=this._cache;for(let o=0;o<t.length;o++){let n=t[o];if(n.node.parent===null||n.nodeStartOffset>=i){t[o]=null,e=!0;continue}}if(e){let o=[];for(let n of t)n!==null&&o.push(n);this._cache=o}}},CIt=class{constructor(i,e,t){this.create(i,e,t)}create(i,e,t){this._buffers=[new lz("",[0])],this._lastChangeBufferPos={line:0,column:0},this.root=as,this._lineCnt=1,this._length=0,this._EOL=e,this._EOLLength=e.length,this._EOLNormalized=t;let o=null;for(let n=0,r=i.length;n<r;n++)if(i[n].buffer.length>0){i[n].lineStarts||(i[n].lineStarts=az(i[n].buffer));let s=new Qx(n+1,{line:0,column:0},{line:i[n].lineStarts.length-1,column:i[n].buffer.length-i[n].lineStarts[i[n].lineStarts.length-1]},i[n].lineStarts.length-1,i[n].buffer.length);this._buffers.push(i[n]),o=this.rbInsertRight(o,s)}this._searchCache=new Aoi(1),this._lastVisitedLine={lineNumber:0,value:""},this.computeBufferMetadata()}normalizeEOL(i){let e=Pj,t=e-Math.floor(e/3),o=t*2,n="",r=0,s=[];if(this.iterate(this.root,l=>{let c=this.getNodeContent(l),u=c.length;if(r<=t||r+u<o)return n+=c,r+=u,!0;let p=n.replace(/\r\n|\r|\n/g,i);return s.push(new lz(p,az(p))),n=c,r=u,!0}),r>0){let l=n.replace(/\r\n|\r|\n/g,i);s.push(new lz(l,az(l)))}this.create(s,i,!0)}getEOL(){return this._EOL}setEOL(i){this._EOL=i,this._EOLLength=this._EOL.length,this.normalizeEOL(i)}createSnapshot(i){return new Poi(this,i)}equal(i){if(this.getLength()!==i.getLength()||this.getLineCount()!==i.getLineCount())return!1;let e=0;return this.iterate(this.root,o=>{if(o===as)return!0;let n=this.getNodeContent(o),r=n.length,s=i.nodeAt(e),l=i.nodeAt(e+r),c=i.getValueInRange2(s,l);return e+=r,n===c})}getOffsetAt(i,e){let t=0,o=this.root;for(;o!==as;)if(o.left!==as&&o.lf_left+1>=i)o=o.left;else if(o.lf_left+o.piece.lineFeedCnt+1>=i){t+=o.size_left;let n=this.getAccumulatedValue(o,i-o.lf_left-2);return t+=n+e-1}else i-=o.lf_left+o.piece.lineFeedCnt,t+=o.size_left+o.piece.length,o=o.right;return t}getPositionAt(i){i=Math.floor(i),i=Math.max(0,i);let e=this.root,t=0,o=i;for(;e!==as;)if(e.size_left!==0&&e.size_left>=i)e=e.left;else if(e.size_left+e.piece.length>=i){let n=this.getIndexOf(e,i-e.size_left);if(t+=e.lf_left+n.index,n.index===0){let r=this.getOffsetAt(t+1,1),s=o-r;return new ye(t+1,s+1)}return new ye(t+1,n.remainder+1)}else if(i-=e.size_left+e.piece.length,t+=e.lf_left+e.piece.lineFeedCnt,e.right===as){let n=this.getOffsetAt(t+1,1),r=o-i-n;return new ye(t+1,r+1)}else e=e.right;return new ye(1,1)}getValueInRange(i,e){if(i.startLineNumber===i.endLineNumber&&i.startColumn===i.endColumn)return"";let t=this.nodeAt2(i.startLineNumber,i.startColumn),o=this.nodeAt2(i.endLineNumber,i.endColumn),n=this.getValueInRange2(t,o);return e?e!==this._EOL||!this._EOLNormalized?n.replace(/\r\n|\r|\n/g,e):e===this.getEOL()&&this._EOLNormalized?n:n.replace(/\r\n|\r|\n/g,e):n}getValueInRange2(i,e){if(i.node===e.node){let s=i.node,l=this._buffers[s.piece.bufferIndex].buffer,c=this.offsetInBuffer(s.piece.bufferIndex,s.piece.start);return l.substring(c+i.remainder,c+e.remainder)}let t=i.node,o=this._buffers[t.piece.bufferIndex].buffer,n=this.offsetInBuffer(t.piece.bufferIndex,t.piece.start),r=o.substring(n+i.remainder,n+t.piece.length);for(t=t.next();t!==as;){let s=this._buffers[t.piece.bufferIndex].buffer,l=this.offsetInBuffer(t.piece.bufferIndex,t.piece.start);if(t===e.node){r+=s.substring(l,l+e.remainder);break}else r+=s.substr(l,t.piece.length);t=t.next()}return r}getLinesContent(){let i=[],e=0,t="",o=!1;return this.iterate(this.root,n=>{if(n===as)return!0;let r=n.piece,s=r.length;if(s===0)return!0;let l=this._buffers[r.bufferIndex].buffer,c=this._buffers[r.bufferIndex].lineStarts,u=r.start.line,p=r.end.line,h=c[u]+r.start.column;if(o&&(l.charCodeAt(h)===10&&(h++,s--),i[e++]=t,t="",o=!1,s===0))return!0;if(u===p)return!this._EOLNormalized&&l.charCodeAt(h+s-1)===13?(o=!0,t+=l.substr(h,s-1)):t+=l.substr(h,s),!0;t+=this._EOLNormalized?l.substring(h,Math.max(h,c[u+1]-this._EOLLength)):l.substring(h,c[u+1]).replace(/(\r\n|\r|\n)$/,""),i[e++]=t;for(let g=u+1;g<p;g++)t=this._EOLNormalized?l.substring(c[g],c[g+1]-this._EOLLength):l.substring(c[g],c[g+1]).replace(/(\r\n|\r|\n)$/,""),i[e++]=t;return!this._EOLNormalized&&l.charCodeAt(c[p]+r.end.column-1)===13?(o=!0,r.end.column===0?e--:t=l.substr(c[p],r.end.column-1)):t=l.substr(c[p],r.end.column),!0}),o&&(i[e++]=t,t=""),i[e++]=t,i}getLength(){return this._length}getLineCount(){return this._lineCnt}getLineContent(i){return this._lastVisitedLine.lineNumber===i?this._lastVisitedLine.value:(this._lastVisitedLine.lineNumber=i,i===this._lineCnt?this._lastVisitedLine.value=this.getLineRawContent(i):this._EOLNormalized?this._lastVisitedLine.value=this.getLineRawContent(i,this._EOLLength):this._lastVisitedLine.value=this.getLineRawContent(i).replace(/(\r\n|\r|\n)$/,""),this._lastVisitedLine.value)}_getCharCode(i){if(i.remainder===i.node.piece.length){let e=i.node.next();if(!e)return 0;let t=this._buffers[e.piece.bufferIndex],o=this.offsetInBuffer(e.piece.bufferIndex,e.piece.start);return t.buffer.charCodeAt(o)}else{let e=this._buffers[i.node.piece.bufferIndex],o=this.offsetInBuffer(i.node.piece.bufferIndex,i.node.piece.start)+i.remainder;return e.buffer.charCodeAt(o)}}getLineCharCode(i,e){let t=this.nodeAt2(i,e+1);return this._getCharCode(t)}getLineLength(i){if(i===this.getLineCount()){let e=this.getOffsetAt(i,1);return this.getLength()-e}return this.getOffsetAt(i+1,1)-this.getOffsetAt(i,1)-this._EOLLength}getCharCode(i){let e=this.nodeAt(i);return this._getCharCode(e)}getNearestChunk(i){let e=this.nodeAt(i);if(e.remainder===e.node.piece.length){let t=e.node.next();if(!t||t===as)return"";let o=this._buffers[t.piece.bufferIndex],n=this.offsetInBuffer(t.piece.bufferIndex,t.piece.start);return o.buffer.substring(n,n+t.piece.length)}else{let t=this._buffers[e.node.piece.bufferIndex],o=this.offsetInBuffer(e.node.piece.bufferIndex,e.node.piece.start),n=o+e.remainder,r=o+e.node.piece.length;return t.buffer.substring(n,r)}}findMatchesInNode(i,e,t,o,n,r,s,l,c,u,p){let h=this._buffers[i.piece.bufferIndex],g=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start),f=this.offsetInBuffer(i.piece.bufferIndex,n),v=this.offsetInBuffer(i.piece.bufferIndex,r),b,S={line:0,column:0},y,w;e._wordSeparators?(y=h.buffer.substring(f,v),w=k=>k+f,e.reset(0)):(y=h.buffer,w=k=>k,e.reset(f));do if(b=e.next(y),b){if(w(b.index)>=v)return u;this.positionInBuffer(i,w(b.index)-g,S);let k=this.getLineFeedCnt(i.piece.bufferIndex,n,S),T=S.line===n.line?S.column-n.column+o:S.column+1,P=T+b[0].length;if(p[u++]=g7(new z(t+k,T,t+k,P),b,l),w(b.index)+b[0].length>=v||u>=c)return u}while(b);return u}findMatchesLineByLine(i,e,t,o){let n=[],r=0,s=new N1(e.wordSeparators,e.regex),l=this.nodeAt2(i.startLineNumber,i.startColumn);if(l===null)return[];let c=this.nodeAt2(i.endLineNumber,i.endColumn);if(c===null)return[];let u=this.positionInBuffer(l.node,l.remainder),p=this.positionInBuffer(c.node,c.remainder);if(l.node===c.node)return this.findMatchesInNode(l.node,s,i.startLineNumber,i.startColumn,u,p,e,t,o,r,n),n;let h=i.startLineNumber,g=l.node;for(;g!==c.node;){let v=this.getLineFeedCnt(g.piece.bufferIndex,u,g.piece.end);if(v>=1){let S=this._buffers[g.piece.bufferIndex].lineStarts,y=this.offsetInBuffer(g.piece.bufferIndex,g.piece.start),w=S[u.line+v],k=h===i.startLineNumber?i.startColumn:1;if(r=this.findMatchesInNode(g,s,h,k,u,this.positionInBuffer(g,w-y),e,t,o,r,n),r>=o)return n;h+=v}let b=h===i.startLineNumber?i.startColumn-1:0;if(h===i.endLineNumber){let S=this.getLineContent(h).substring(b,i.endColumn-1);return r=this._findMatchesInLine(e,s,S,i.endLineNumber,b,r,n,t,o),n}if(r=this._findMatchesInLine(e,s,this.getLineContent(h).substr(b),h,b,r,n,t,o),r>=o)return n;h++,l=this.nodeAt2(h,1),g=l.node,u=this.positionInBuffer(l.node,l.remainder)}if(h===i.endLineNumber){let v=h===i.startLineNumber?i.startColumn-1:0,b=this.getLineContent(h).substring(v,i.endColumn-1);return r=this._findMatchesInLine(e,s,b,i.endLineNumber,v,r,n,t,o),n}let f=h===i.startLineNumber?i.startColumn:1;return r=this.findMatchesInNode(c.node,s,h,f,u,p,e,t,o,r,n),n}_findMatchesInLine(i,e,t,o,n,r,s,l,c){let u=i.wordSeparators;if(!l&&i.simpleSearch){let h=i.simpleSearch,g=h.length,f=t.length,v=-g;for(;(v=t.indexOf(h,v+g))!==-1;)if((!u||fvt(u,t,f,v,g))&&(s[r++]=new T1(new z(o,v+1+n,o,v+1+g+n),null),r>=c))return r;return r}let p;e.reset(0);do if(p=e.next(t),p&&(s[r++]=g7(new z(o,p.index+1+n,o,p.index+1+p[0].length+n),p,l),r>=c))return r;while(p);return r}insert(i,e,t=!1){if(this._EOLNormalized=this._EOLNormalized&&t,this._lastVisitedLine.lineNumber=0,this._lastVisitedLine.value="",this.root!==as){let{node:o,remainder:n,nodeStartOffset:r}=this.nodeAt(i),s=o.piece,l=s.bufferIndex,c=this.positionInBuffer(o,n);if(o.piece.bufferIndex===0&&s.end.line===this._lastChangeBufferPos.line&&s.end.column===this._lastChangeBufferPos.column&&r+s.length===i&&e.length<Pj){this.appendToNode(o,e),this.computeBufferMetadata();return}if(r===i)this.insertContentToNodeLeft(e,o),this._searchCache.validate(i);else if(r+o.piece.length>i){let u=[],p=new Qx(s.bufferIndex,c,s.end,this.getLineFeedCnt(s.bufferIndex,c,s.end),this.offsetInBuffer(l,s.end)-this.offsetInBuffer(l,c));if(this.shouldCheckCRLF()&&this.endWithCR(e)&&this.nodeCharCodeAt(o,n)===10){let v={line:p.start.line+1,column:0};p=new Qx(p.bufferIndex,v,p.end,this.getLineFeedCnt(p.bufferIndex,v,p.end),p.length-1),e+=`
`}if(this.shouldCheckCRLF()&&this.startWithLF(e))if(this.nodeCharCodeAt(o,n-1)===13){let v=this.positionInBuffer(o,n-1);this.deleteNodeTail(o,v),e="\r"+e,o.piece.length===0&&u.push(o)}else this.deleteNodeTail(o,c);else this.deleteNodeTail(o,c);let h=this.createNewPieces(e);p.length>0&&this.rbInsertRight(o,p);let g=o;for(let f=0;f<h.length;f++)g=this.rbInsertRight(g,h[f]);this.deleteNodes(u)}else this.insertContentToNodeRight(e,o)}else{let o=this.createNewPieces(e),n=this.rbInsertLeft(null,o[0]);for(let r=1;r<o.length;r++)n=this.rbInsertRight(n,o[r])}this.computeBufferMetadata()}delete(i,e){if(this._lastVisitedLine.lineNumber=0,this._lastVisitedLine.value="",e<=0||this.root===as)return;let t=this.nodeAt(i),o=this.nodeAt(i+e),n=t.node,r=o.node;if(n===r){let h=this.positionInBuffer(n,t.remainder),g=this.positionInBuffer(n,o.remainder);if(t.nodeStartOffset===i){if(e===n.piece.length){let f=n.next();M5e(this,n),this.validateCRLFWithPrevNode(f),this.computeBufferMetadata();return}this.deleteNodeHead(n,g),this._searchCache.validate(i),this.validateCRLFWithPrevNode(n),this.computeBufferMetadata();return}if(t.nodeStartOffset+n.piece.length===i+e){this.deleteNodeTail(n,h),this.validateCRLFWithNextNode(n),this.computeBufferMetadata();return}this.shrinkNode(n,h,g),this.computeBufferMetadata();return}let s=[],l=this.positionInBuffer(n,t.remainder);this.deleteNodeTail(n,l),this._searchCache.validate(i),n.piece.length===0&&s.push(n);let c=this.positionInBuffer(r,o.remainder);this.deleteNodeHead(r,c),r.piece.length===0&&s.push(r);let u=n.next();for(let h=u;h!==as&&h!==r;h=h.next())s.push(h);let p=n.piece.length===0?n.prev():n;this.deleteNodes(s),this.validateCRLFWithNextNode(p),this.computeBufferMetadata()}insertContentToNodeLeft(i,e){let t=[];if(this.shouldCheckCRLF()&&this.endWithCR(i)&&this.startWithLF(e)){let r=e.piece,s={line:r.start.line+1,column:0},l=new Qx(r.bufferIndex,s,r.end,this.getLineFeedCnt(r.bufferIndex,s,r.end),r.length-1);e.piece=l,i+=`
`,sz(this,e,-1,-1),e.piece.length===0&&t.push(e)}let o=this.createNewPieces(i),n=this.rbInsertLeft(e,o[o.length-1]);for(let r=o.length-2;r>=0;r--)n=this.rbInsertLeft(n,o[r]);this.validateCRLFWithPrevNode(n),this.deleteNodes(t)}insertContentToNodeRight(i,e){this.adjustCarriageReturnFromNext(i,e)&&(i+=`
`);let t=this.createNewPieces(i),o=this.rbInsertRight(e,t[0]),n=o;for(let r=1;r<t.length;r++)n=this.rbInsertRight(n,t[r]);this.validateCRLFWithPrevNode(o)}positionInBuffer(i,e,t){let o=i.piece,n=i.piece.bufferIndex,r=this._buffers[n].lineStarts,l=r[o.start.line]+o.start.column+e,c=o.start.line,u=o.end.line,p=0,h=0,g=0;for(;c<=u&&(p=c+(u-c)/2|0,g=r[p],p!==u);)if(h=r[p+1],l<g)u=p-1;else if(l>=h)c=p+1;else break;return t?(t.line=p,t.column=l-g,null):{line:p,column:l-g}}getLineFeedCnt(i,e,t){if(t.column===0)return t.line-e.line;let o=this._buffers[i].lineStarts;if(t.line===o.length-1)return t.line-e.line;let n=o[t.line+1],r=o[t.line]+t.column;if(n>r+1)return t.line-e.line;let s=r-1;return this._buffers[i].buffer.charCodeAt(s)===13?t.line-e.line+1:t.line-e.line}offsetInBuffer(i,e){return this._buffers[i].lineStarts[e.line]+e.column}deleteNodes(i){for(let e=0;e<i.length;e++)M5e(this,i[e])}createNewPieces(i){if(i.length>Pj){let u=[];for(;i.length>Pj;){let h=i.charCodeAt(Pj-1),g;h===13||h>=55296&&h<=56319?(g=i.substring(0,Pj-1),i=i.substring(Pj-1)):(g=i.substring(0,Pj),i=i.substring(Pj));let f=az(g);u.push(new Qx(this._buffers.length,{line:0,column:0},{line:f.length-1,column:g.length-f[f.length-1]},f.length-1,g.length)),this._buffers.push(new lz(g,f))}let p=az(i);return u.push(new Qx(this._buffers.length,{line:0,column:0},{line:p.length-1,column:i.length-p[p.length-1]},p.length-1,i.length)),this._buffers.push(new lz(i,p)),u}let e=this._buffers[0].buffer.length,t=az(i,!1),o=this._lastChangeBufferPos;if(this._buffers[0].lineStarts[this._buffers[0].lineStarts.length-1]===e&&e!==0&&this.startWithLF(i)&&this.endWithCR(this._buffers[0].buffer)){this._lastChangeBufferPos={line:this._lastChangeBufferPos.line,column:this._lastChangeBufferPos.column+1},o=this._lastChangeBufferPos;for(let u=0;u<t.length;u++)t[u]+=e+1;this._buffers[0].lineStarts=this._buffers[0].lineStarts.concat(t.slice(1)),this._buffers[0].buffer+="_"+i,e+=1}else{if(e!==0)for(let u=0;u<t.length;u++)t[u]+=e;this._buffers[0].lineStarts=this._buffers[0].lineStarts.concat(t.slice(1)),this._buffers[0].buffer+=i}let n=this._buffers[0].buffer.length,r=this._buffers[0].lineStarts.length-1,s=n-this._buffers[0].lineStarts[r],l={line:r,column:s},c=new Qx(0,o,l,this.getLineFeedCnt(0,o,l),n-e);return this._lastChangeBufferPos=l,[c]}getLinesRawContent(){return this.getContentOfSubTree(this.root)}getLineRawContent(i,e=0){let t=this.root,o="",n=this._searchCache.get2(i);if(n){t=n.node;let r=this.getAccumulatedValue(t,i-n.nodeStartLineNumber-1),s=this._buffers[t.piece.bufferIndex].buffer,l=this.offsetInBuffer(t.piece.bufferIndex,t.piece.start);if(n.nodeStartLineNumber+t.piece.lineFeedCnt===i)o=s.substring(l+r,l+t.piece.length);else{let c=this.getAccumulatedValue(t,i-n.nodeStartLineNumber);return s.substring(l+r,l+c-e)}}else{let r=0,s=i;for(;t!==as;)if(t.left!==as&&t.lf_left>=i-1)t=t.left;else if(t.lf_left+t.piece.lineFeedCnt>i-1){let l=this.getAccumulatedValue(t,i-t.lf_left-2),c=this.getAccumulatedValue(t,i-t.lf_left-1),u=this._buffers[t.piece.bufferIndex].buffer,p=this.offsetInBuffer(t.piece.bufferIndex,t.piece.start);return r+=t.size_left,this._searchCache.set({node:t,nodeStartOffset:r,nodeStartLineNumber:s-(i-1-t.lf_left)}),u.substring(p+l,p+c-e)}else if(t.lf_left+t.piece.lineFeedCnt===i-1){let l=this.getAccumulatedValue(t,i-t.lf_left-2),c=this._buffers[t.piece.bufferIndex].buffer,u=this.offsetInBuffer(t.piece.bufferIndex,t.piece.start);o=c.substring(u+l,u+t.piece.length);break}else i-=t.lf_left+t.piece.lineFeedCnt,r+=t.size_left+t.piece.length,t=t.right}for(t=t.next();t!==as;){let r=this._buffers[t.piece.bufferIndex].buffer;if(t.piece.lineFeedCnt>0){let s=this.getAccumulatedValue(t,0),l=this.offsetInBuffer(t.piece.bufferIndex,t.piece.start);return o+=r.substring(l,l+s-e),o}else{let s=this.offsetInBuffer(t.piece.bufferIndex,t.piece.start);o+=r.substr(s,t.piece.length)}t=t.next()}return o}computeBufferMetadata(){let i=this.root,e=1,t=0;for(;i!==as;)e+=i.lf_left+i.piece.lineFeedCnt,t+=i.size_left+i.piece.length,i=i.right;this._lineCnt=e,this._length=t,this._searchCache.validate(this._length)}getIndexOf(i,e){let t=i.piece,o=this.positionInBuffer(i,e),n=o.line-t.start.line;if(this.offsetInBuffer(t.bufferIndex,t.end)-this.offsetInBuffer(t.bufferIndex,t.start)===e){let r=this.getLineFeedCnt(i.piece.bufferIndex,t.start,o);if(r!==n)return{index:r,remainder:0}}return{index:n,remainder:o.column}}getAccumulatedValue(i,e){if(e<0)return 0;let t=i.piece,o=this._buffers[t.bufferIndex].lineStarts,n=t.start.line+e+1;return n>t.end.line?o[t.end.line]+t.end.column-o[t.start.line]-t.start.column:o[n]-o[t.start.line]-t.start.column}deleteNodeTail(i,e){let t=i.piece,o=t.lineFeedCnt,n=this.offsetInBuffer(t.bufferIndex,t.end),r=e,s=this.offsetInBuffer(t.bufferIndex,r),l=this.getLineFeedCnt(t.bufferIndex,t.start,r),c=l-o,u=s-n,p=t.length+u;i.piece=new Qx(t.bufferIndex,t.start,r,l,p),sz(this,i,u,c)}deleteNodeHead(i,e){let t=i.piece,o=t.lineFeedCnt,n=this.offsetInBuffer(t.bufferIndex,t.start),r=e,s=this.getLineFeedCnt(t.bufferIndex,r,t.end),l=this.offsetInBuffer(t.bufferIndex,r),c=s-o,u=n-l,p=t.length+u;i.piece=new Qx(t.bufferIndex,r,t.end,s,p),sz(this,i,u,c)}shrinkNode(i,e,t){let o=i.piece,n=o.start,r=o.end,s=o.length,l=o.lineFeedCnt,c=e,u=this.getLineFeedCnt(o.bufferIndex,o.start,c),p=this.offsetInBuffer(o.bufferIndex,e)-this.offsetInBuffer(o.bufferIndex,n);i.piece=new Qx(o.bufferIndex,o.start,c,u,p),sz(this,i,p-s,u-l);let h=new Qx(o.bufferIndex,t,r,this.getLineFeedCnt(o.bufferIndex,t,r),this.offsetInBuffer(o.bufferIndex,r)-this.offsetInBuffer(o.bufferIndex,t)),g=this.rbInsertRight(i,h);this.validateCRLFWithPrevNode(g)}appendToNode(i,e){this.adjustCarriageReturnFromNext(e,i)&&(e+=`
`);let t=this.shouldCheckCRLF()&&this.startWithLF(e)&&this.endWithCR(i),o=this._buffers[0].buffer.length;this._buffers[0].buffer+=e;let n=az(e,!1);for(let g=0;g<n.length;g++)n[g]+=o;if(t){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(n.slice(1));let r=this._buffers[0].lineStarts.length-1,s=this._buffers[0].buffer.length-this._buffers[0].lineStarts[r],l={line:r,column:s},c=i.piece.length+e.length,u=i.piece.lineFeedCnt,p=this.getLineFeedCnt(0,i.piece.start,l),h=p-u;i.piece=new Qx(i.piece.bufferIndex,i.piece.start,l,p,c),this._lastChangeBufferPos=l,sz(this,i,e.length,h)}nodeAt(i){let e=this.root,t=this._searchCache.get(i);if(t)return{node:t.node,nodeStartOffset:t.nodeStartOffset,remainder:i-t.nodeStartOffset};let o=0;for(;e!==as;)if(e.size_left>i)e=e.left;else if(e.size_left+e.piece.length>=i){o+=e.size_left;let n={node:e,remainder:i-e.size_left,nodeStartOffset:o};return this._searchCache.set(n),n}else i-=e.size_left+e.piece.length,o+=e.size_left+e.piece.length,e=e.right;return null}nodeAt2(i,e){let t=this.root,o=0;for(;t!==as;)if(t.left!==as&&t.lf_left>=i-1)t=t.left;else if(t.lf_left+t.piece.lineFeedCnt>i-1){let n=this.getAccumulatedValue(t,i-t.lf_left-2),r=this.getAccumulatedValue(t,i-t.lf_left-1);return o+=t.size_left,{node:t,remainder:Math.min(n+e-1,r),nodeStartOffset:o}}else if(t.lf_left+t.piece.lineFeedCnt===i-1){let n=this.getAccumulatedValue(t,i-t.lf_left-2);if(n+e-1<=t.piece.length)return{node:t,remainder:n+e-1,nodeStartOffset:o};e-=t.piece.length-n;break}else i-=t.lf_left+t.piece.lineFeedCnt,o+=t.size_left+t.piece.length,t=t.right;for(t=t.next();t!==as;){if(t.piece.lineFeedCnt>0){let n=this.getAccumulatedValue(t,0),r=this.offsetOfNode(t);return{node:t,remainder:Math.min(e-1,n),nodeStartOffset:r}}else if(t.piece.length>=e-1){let n=this.offsetOfNode(t);return{node:t,remainder:e-1,nodeStartOffset:n}}else e-=t.piece.length;t=t.next()}return null}nodeCharCodeAt(i,e){if(i.piece.lineFeedCnt<1)return-1;let t=this._buffers[i.piece.bufferIndex],o=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start)+e;return t.buffer.charCodeAt(o)}offsetOfNode(i){if(!i)return 0;let e=i.size_left;for(;i!==this.root;)i.parent.right===i&&(e+=i.parent.size_left+i.parent.piece.length),i=i.parent;return e}shouldCheckCRLF(){return!(this._EOLNormalized&&this._EOL===`
`)}startWithLF(i){if(typeof i=="string")return i.charCodeAt(0)===10;if(i===as||i.piece.lineFeedCnt===0)return!1;let e=i.piece,t=this._buffers[e.bufferIndex].lineStarts,o=e.start.line,n=t[o]+e.start.column;return o===t.length-1||t[o+1]>n+1?!1:this._buffers[e.bufferIndex].buffer.charCodeAt(n)===10}endWithCR(i){return typeof i=="string"?i.charCodeAt(i.length-1)===13:i===as||i.piece.lineFeedCnt===0?!1:this.nodeCharCodeAt(i,i.piece.length-1)===13}validateCRLFWithPrevNode(i){if(this.shouldCheckCRLF()&&this.startWithLF(i)){let e=i.prev();this.endWithCR(e)&&this.fixCRLF(e,i)}}validateCRLFWithNextNode(i){if(this.shouldCheckCRLF()&&this.endWithCR(i)){let e=i.next();this.startWithLF(e)&&this.fixCRLF(i,e)}}fixCRLF(i,e){let t=[],o=this._buffers[i.piece.bufferIndex].lineStarts,n;i.piece.end.column===0?n={line:i.piece.end.line-1,column:o[i.piece.end.line]-o[i.piece.end.line-1]-1}:n={line:i.piece.end.line,column:i.piece.end.column-1};let r=i.piece.length-1,s=i.piece.lineFeedCnt-1;i.piece=new Qx(i.piece.bufferIndex,i.piece.start,n,s,r),sz(this,i,-1,-1),i.piece.length===0&&t.push(i);let l={line:e.piece.start.line+1,column:0},c=e.piece.length-1,u=this.getLineFeedCnt(e.piece.bufferIndex,l,e.piece.end);e.piece=new Qx(e.piece.bufferIndex,l,e.piece.end,u,c),sz(this,e,-1,-1),e.piece.length===0&&t.push(e);let p=this.createNewPieces(`\r
`);this.rbInsertRight(i,p[0]);for(let h=0;h<t.length;h++)M5e(this,t[h])}adjustCarriageReturnFromNext(i,e){if(this.shouldCheckCRLF()&&this.endWithCR(i)){let t=e.next();if(this.startWithLF(t)){if(i+=`
`,t.piece.length===1)M5e(this,t);else{let o=t.piece,n={line:o.start.line+1,column:0},r=o.length-1,s=this.getLineFeedCnt(o.bufferIndex,n,o.end);t.piece=new Qx(o.bufferIndex,n,o.end,s,r),sz(this,t,-1,-1)}return!0}}return!1}iterate(i,e){if(i===as)return e(as);let t=this.iterate(i.left,e);return t&&e(i)&&this.iterate(i.right,e)}getNodeContent(i){if(i===as)return"";let e=this._buffers[i.piece.bufferIndex],t=i.piece,o=this.offsetInBuffer(t.bufferIndex,t.start),n=this.offsetInBuffer(t.bufferIndex,t.end);return e.buffer.substring(o,n)}getPieceContent(i){let e=this._buffers[i.bufferIndex],t=this.offsetInBuffer(i.bufferIndex,i.start),o=this.offsetInBuffer(i.bufferIndex,i.end);return e.buffer.substring(t,o)}rbInsertRight(i,e){let t=new tCe(e,1);if(t.left=as,t.right=as,t.parent=as,t.size_left=0,t.lf_left=0,this.root===as)this.root=t,t.color=0;else if(i.right===as)i.right=t,t.parent=i;else{let n=wIt(i.right);n.left=t,t.parent=n}return Roi(this,t),t}rbInsertLeft(i,e){let t=new tCe(e,1);if(t.left=as,t.right=as,t.parent=as,t.size_left=0,t.lf_left=0,this.root===as)this.root=t,t.color=0;else if(i.left===as)i.left=t,t.parent=i;else{let o=_oi(i.left);o.right=t,t.parent=o}return Roi(this,t),t}getContentOfSubTree(i){let e="";return this.iterate(i,t=>(e+=this.getNodeContent(t),!0)),e}};var Z7=class a extends x{constructor(e,t,o,n,r,s,l){super();this._onDidChangeContent=this._register(new E);this._BOM=t,this._mightContainNonBasicASCII=!s,this._mightContainRTL=n,this._mightContainUnusualLineTerminators=r,this._pieceTree=new CIt(e,o,l)}get onDidChangeContent(){return this._onDidChangeContent.event}equals(e){return!(e instanceof a)||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,t){return this._pieceTree.getOffsetAt(e,t)}getPositionAt(e){return this._pieceTree.getPositionAt(e)}getRangeAt(e,t){let o=e+t,n=this.getPositionAt(e),r=this.getPositionAt(o);return new z(n.lineNumber,n.column,r.lineNumber,r.column)}getValueInRange(e,t=0){if(e.isEmpty())return"";let o=this._getEndOfLine(t);return this._pieceTree.getValueInRange(e,o)}getValueLengthInRange(e,t=0){if(e.isEmpty())return 0;if(e.startLineNumber===e.endLineNumber)return e.endColumn-e.startColumn;let o=this.getOffsetAt(e.startLineNumber,e.startColumn),n=this.getOffsetAt(e.endLineNumber,e.endColumn),r=0,s=this._getEndOfLine(t),l=this.getEOL();if(s.length!==l.length){let c=s.length-l.length,u=e.endLineNumber-e.startLineNumber;r=c*u}return n-o+r}getCharacterCountInRange(e,t=0){if(this._mightContainNonBasicASCII){let o=0,n=e.startLineNumber,r=e.endLineNumber;for(let s=n;s<=r;s++){let l=this.getLineContent(s),c=s===n?e.startColumn-1:0,u=s===r?e.endColumn-1:l.length;for(let p=c;p<u;p++)ju(l.charCodeAt(p))?(o=o+1,p=p+1):o=o+1}return o+=this._getEndOfLine(t).length*(r-n),o}return this.getValueLengthInRange(e,t)}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,t){return this._pieceTree.getLineCharCode(e,t)}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 t=nm(this.getLineContent(e));return t===-1?0:t+1}getLineLastNonWhitespaceColumn(e){let t=hv(this.getLineContent(e));return t===-1?0:t+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,t,o){let n=this._mightContainRTL,r=this._mightContainUnusualLineTerminators,s=this._mightContainNonBasicASCII,l=!0,c=[];for(let b=0;b<e.length;b++){let S=e[b];l&&S._isTracked&&(l=!1);let y=S.range;if(S.text){let O=!0;s||(O=!g1(S.text),s=O),!n&&O&&(n=uP(S.text)),!r&&O&&(r=Kht(S.text))}let w="",k=0,T=0,P=0;if(S.text){let O;[k,T,P,O]=ZS(S.text);let V=this.getEOL(),H=V===`\r
`?2:1;O===0||O===H?w=S.text:w=S.text.replace(/\r\n|\r|\n/g,V)}c[b]={sortIndex:b,identifier:S.identifier||null,range:y,rangeOffset:this.getOffsetAt(y.startLineNumber,y.startColumn),rangeLength:this.getValueLengthInRange(y),text:w,eolCount:k,firstLineLength:T,lastLineLength:P,forceMoveMarkers:!!S.forceMoveMarkers,isAutoWhitespaceEdit:S.isAutoWhitespaceEdit||!1}}c.sort(a._sortOpsAscending);let u=!1;for(let b=0,S=c.length-1;b<S;b++){let y=c[b].range.getEndPosition(),w=c[b+1].range.getStartPosition();if(w.isBeforeOrEqual(y)){if(w.isBefore(y))throw new Error("Overlapping ranges are not allowed!");u=!0}}l&&(c=this._reduceOperations(c));let p=o||t?a._getInverseEditRanges(c):[],h=[];if(t)for(let b=0;b<c.length;b++){let S=c[b],y=p[b];if(S.isAutoWhitespaceEdit&&S.range.isEmpty())for(let w=y.startLineNumber;w<=y.endLineNumber;w++){let k="";w===y.startLineNumber&&(k=this.getLineContent(S.range.startLineNumber),nm(k)!==-1)||h.push({lineNumber:w,oldContent:k})}}let g=null;if(o){let b=0;g=[];for(let S=0;S<c.length;S++){let y=c[S],w=p[S],k=this.getValueInRange(y.range),T=y.rangeOffset+b;b+=y.text.length-k.length,g[S]={sortIndex:y.sortIndex,identifier:y.identifier,range:w,text:k,textChange:new iR(y.rangeOffset,k,T,y.text)}}u||g.sort((S,y)=>S.sortIndex-y.sortIndex)}this._mightContainRTL=n,this._mightContainUnusualLineTerminators=r,this._mightContainNonBasicASCII=s;let f=this._doApplyEdits(c),v=null;if(t&&h.length>0){h.sort((b,S)=>S.lineNumber-b.lineNumber),v=[];for(let b=0,S=h.length;b<S;b++){let y=h[b].lineNumber;if(b>0&&h[b-1].lineNumber===y)continue;let w=h[b].oldContent,k=this.getLineContent(y);k.length===0||k===w||nm(k)!==-1||v.push(y)}}return this._onDidChangeContent.fire(),new rft(g,f,v)}_reduceOperations(e){return e.length<1e3?e:[this._toSingleEditOperation(e)]}_toSingleEditOperation(e){let t=!1,o=e[0].range,n=e[e.length-1].range,r=new z(o.startLineNumber,o.startColumn,n.endLineNumber,n.endColumn),s=o.startLineNumber,l=o.startColumn,c=[];for(let f=0,v=e.length;f<v;f++){let b=e[f],S=b.range;t=t||b.forceMoveMarkers,c.push(this.getValueInRange(new z(s,l,S.startLineNumber,S.startColumn))),b.text.length>0&&c.push(b.text),s=S.endLineNumber,l=S.endColumn}let u=c.join(""),[p,h,g]=ZS(u);return{sortIndex:0,identifier:e[0].identifier,range:r,rangeOffset:this.getOffsetAt(r.startLineNumber,r.startColumn),rangeLength:this.getValueLengthInRange(r,0),text:u,eolCount:p,firstLineLength:h,lastLineLength:g,forceMoveMarkers:t,isAutoWhitespaceEdit:!1}}_doApplyEdits(e){e.sort(a._sortOpsDescending);let t=[];for(let o=0;o<e.length;o++){let n=e[o],r=n.range.startLineNumber,s=n.range.startColumn,l=n.range.endLineNumber,c=n.range.endColumn;if(r===l&&s===c&&n.text.length===0)continue;n.text?(this._pieceTree.delete(n.rangeOffset,n.rangeLength),this._pieceTree.insert(n.rangeOffset,n.text,!0)):this._pieceTree.delete(n.rangeOffset,n.rangeLength);let u=new z(r,s,l,c);t.push({range:u,rangeLength:n.rangeLength,text:n.text,rangeOffset:n.rangeOffset,forceMoveMarkers:n.forceMoveMarkers})}return t}findMatchesLineByLine(e,t,o,n){return this._pieceTree.findMatchesLineByLine(e,t,o,n)}getPieceTree(){return this._pieceTree}static _getInverseEditRange(e,t){let o=e.startLineNumber,n=e.startColumn,[r,s,l]=ZS(t),c;if(t.length>0){let u=r+1;u===1?c=new z(o,n,o,n+s):c=new z(o,n,o+u-1,l+1)}else c=new z(o,n,o,n);return c}static _getInverseEditRanges(e){let t=[],o=0,n=0,r=null;for(let s=0,l=e.length;s<l;s++){let c=e[s],u,p;r?r.range.endLineNumber===c.range.startLineNumber?(u=o,p=n+(c.range.startColumn-r.range.endColumn)):(u=o+(c.range.startLineNumber-r.range.endLineNumber),p=c.range.startColumn):(u=c.range.startLineNumber,p=c.range.startColumn);let h;if(c.text.length>0){let g=c.eolCount+1;g===1?h=new z(u,p,u,p+c.firstLineLength):h=new z(u,p,u+g-1,c.lastLineLength+1)}else h=new z(u,p,u,p);o=h.endLineNumber,n=h.endColumn,t.push(h),r=c}return t}static _sortOpsAscending(e,t){let o=z.compareRangesUsingEnds(e.range,t.range);return o===0?e.sortIndex-t.sortIndex:o}static _sortOpsDescending(e,t){let o=z.compareRangesUsingEnds(e.range,t.range);return o===0?t.sortIndex-e.sortIndex:-o}};var Noi=class{constructor(i,e,t,o,n,r,s,l,c){this._chunks=i;this._bom=e;this._cr=t;this._lf=o;this._crlf=n;this._containsRTL=r;this._containsUnusualLineTerminators=s;this._isBasicASCII=l;this._normalizeEOL=c}_getEOL(i){let e=this._cr+this._lf+this._crlf,t=this._cr+this._crlf;return e===0?i===1?`
`:`\r
`:t>e/2?`\r
`:`
`}create(i){let e=this._getEOL(i),t=this._chunks;if(this._normalizeEOL&&(e===`\r
`&&(this._cr>0||this._lf>0)||e===`
`&&(this._cr>0||this._crlf>0)))for(let n=0,r=t.length;n<r;n++){let s=t[n].buffer.replace(/\r\n|\r|\n/g,e),l=az(s);t[n]=new lz(s,l)}let o=new Z7(t,this._bom,e,this._containsRTL,this._containsUnusualLineTerminators,this._isBasicASCII,this._normalizeEOL);return{textBuffer:o,disposable:o}}getFirstLineText(i){return this._chunks[0].buffer.substr(0,i).split(/\r\n|\r|\n/)[0]}},Aj=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(i){if(i.length===0)return;this.chunks.length===0&&Ght(i)&&(this.BOM=RGi,i=i.substr(1));let e=i.charCodeAt(i.length-1);e===13||e>=55296&&e<=56319?(this._acceptChunk1(i.substr(0,i.length-1),!1),this._hasPreviousChar=!0,this._previousChar=e):(this._acceptChunk1(i,!1),this._hasPreviousChar=!1,this._previousChar=e)}_acceptChunk1(i,e){!e&&i.length===0||(this._hasPreviousChar?this._acceptChunk2(String.fromCharCode(this._previousChar)+i):this._acceptChunk2(i))}_acceptChunk2(i){let e=L8i(this._tmpLineStarts,i);this.chunks.push(new lz(i,e.lineStarts)),this.cr+=e.cr,this.lf+=e.lf,this.crlf+=e.crlf,e.isBasicASCII||(this.isBasicASCII=!1,this.containsRTL||(this.containsRTL=uP(i)),this.containsUnusualLineTerminators||(this.containsUnusualLineTerminators=Kht(i)))}finish(i=!0){return this._finish(),new Noi(this.chunks,this.BOM,this.cr,this.lf,this.crlf,this.containsRTL,this.containsUnusualLineTerminators,this.isBasicASCII,i)}_finish(){if(this.chunks.length===0&&this._acceptChunk1("",!0),this._hasPreviousChar){this._hasPreviousChar=!1;let i=this.chunks[this.chunks.length-1];i.buffer+=String.fromCharCode(this._previousChar);let e=az(i.buffer);i.lineStarts=e,this._previousChar===13&&this.cr++}}};var xIt=class{constructor(){this._onDidChangeVisibleRanges=new E;this.onDidChangeVisibleRanges=this._onDidChangeVisibleRanges.event;this._views=new Set;this._viewsChanged=wc(this);this.visibleLineRanges=Os({owner:this,equalsFn:iO(G9())},i=>(this._viewsChanged.read(i),uo.joinMany([...this._views].map(t=>t.state.read(i)?.visibleLineRanges??[]))))}attachView(){let i=new Foi(e=>{this._onDidChangeVisibleRanges.fire({view:i,state:e})});return this._views.add(i),this._viewsChanged.trigger(void 0),i}detachView(i){this._views.delete(i),this._onDidChangeVisibleRanges.fire({view:i,state:void 0}),this._viewsChanged.trigger(void 0)}dispose(){this._onDidChangeVisibleRanges.dispose()}},Ooi=class{constructor(i,e){this.visibleLineRanges=i;this.stabilized=e}equals(i){return this===i?!0:!(!$i(this.visibleLineRanges,i.visibleLineRanges,(e,t)=>e.equals(t))||this.stabilized!==i.stabilized)}},Foi=class{constructor(i){this.handleStateChange=i;this._state=ph({owner:this,equalsFn:S1((e,t)=>e.equals(t))},void 0)}get state(){return this._state}setVisibleLines(i,e){let t=i.map(n=>new uo(n.startLineNumber,n.endLineNumber+1)),o=new Ooi(t,e);this._state.set(o,void 0,void 0),this.handleStateChange(o)}},kIt=class extends x{constructor(e){super();this._refreshTokens=e;this.runner=this._register(new Dt(()=>this.update(),50));this._computedLineRanges=[];this._lineRanges=[]}get lineRanges(){return this._lineRanges}update(){$i(this._computedLineRanges,this._lineRanges,(e,t)=>e.equals(t))||(this._computedLineRanges=this._lineRanges,this._refreshTokens())}handleStateChange(e){this._lineRanges=e.visibleLineRanges,e.stabilized?(this.runner.cancel(),this.update()):this.runner.schedule()}},oCe=class extends x{constructor(e,t){super();this._languageIdCodec=e;this._textModel=t;this._onDidChangeTokens=this._register(new E);this.onDidChangeTokens=this._onDidChangeTokens.event;this._onDidChangeFontTokens=this._register(new E);this.onDidChangeFontTokens=this._onDidChangeFontTokens.event}get backgroundTokenizationState(){return this._backgroundTokenizationState}tokenizeIfCheap(e){this.isCheapToTokenize(e)&&this.forceTokenization(e)}};var Nj=class{constructor(i,e,t,o){this.ownerId=i;this.decorationId=e;this.lineNumber=t;this.lineHeight=o}static toKey(i){return`${i.ownerId};${i.decorationId};${i.lineNumber}`}},Oj=class{constructor(i,e,t){this.ownerId=i;this.decorationId=e;this.lineNumber=t}static toKey(i){return`${i.ownerId};${i.decorationId};${i.lineNumber}`}};var nBo=/\b(comment|string|regex|regexp)\b/;function R8i(a){let i=a.match(nBo);if(!i)return 0;switch(i[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"regexp":return 3}throw new Error("Unexpected match for standard token type!")}function A_(a){let i=[];for(let e=1,t=a.length;e<t;e++){let o=a[e];i[e]=`.mtk${e} { color: ${o}; }`}return i.push(".mtki { font-style: italic; }"),i.push(".mtkb { font-weight: bold; }"),i.push(".mtku { text-decoration: underline; text-underline-position: under; }"),i.push(".mtks { text-decoration: line-through; }"),i.push(".mtks.mtku { text-decoration: underline line-through; text-underline-position: under; }"),i.join(`
`)}function M8i(a){let i=[],e=new Set;for(let t=1,o=a.length;t<o;t++){let n=a[t];if(!n.fontFamily&&!n.fontSizeMultiplier)continue;let r=Woi(n.fontFamily??"",n.fontSizeMultiplier??0);if(e.has(r))continue;e.add(r);let s=`.${r} {`;n.fontFamily&&(s+=`font-family: ${n.fontFamily};`),n.fontSizeMultiplier&&(s+=`font-size: calc(var(--editor-font-size)*${n.fontSizeMultiplier});`),s+="}",i.push(s)}return i.join(`
`)}function Woi(a,i){let e=rBo(a);return P8i(`font-decoration-${e}-${i}`)}function rBo(a){let i=a.toLowerCase().trim();return i?P8i(i):"default"}function P8i(a){return a.replace(/[^a-z0-9_-]/gi,"-")}var P5e=class a{constructor(i=[]){this._annotations=[];this._annotations=i}setAnnotations(i){for(let e of i.annotations){let t=this._getStartIndexOfIntersectingAnnotation(e.range.start),o=this._getEndIndexOfIntersectingAnnotation(e.range.endExclusive);e.annotation!==void 0?this._annotations.splice(t,o-t,{range:e.range,annotation:e.annotation}):this._annotations.splice(t,o-t)}}getAnnotationsIntersecting(i){let e=this._getStartIndexOfIntersectingAnnotation(i.start),t=this._getEndIndexOfIntersectingAnnotation(i.endExclusive);return this._annotations.slice(e,t)}_getStartIndexOfIntersectingAnnotation(i){let e=aP(this._annotations.length,o=>this._annotations[o].range.start-i),t;if(e>=0){t=e;let o=this._annotations[t]?.range;o&&o.endExclusive===i&&t--}else{let o=this._annotations[-(e+2)]?.range;o&&i>=o.start&&i<o.endExclusive?t=-(e+2):t=-(e+1)}return t}_getEndIndexOfIntersectingAnnotation(i){let e=aP(this._annotations.length,o=>this._annotations[o].range.endExclusive-i),t;if(e>=0){t=e+1;let o=this._annotations[t]?.range;o&&o.start===i&&t++}else{let o=this._annotations[-(e+1)]?.range;o&&i>=o.start&&i<=o.endExclusive?t=-e:t=-(e+1)}return t}getAllAnnotations(){return this._annotations.slice()}applyEdit(i){let e=this._annotations.slice(),t=[],o=[],n=0;for(let r of i.replacements){for(;;){let l=e[0];if(!l)break;let c=l.range;if(c.endExclusive>=r.replaceRange.start)break;e.shift();let u={range:c.delta(n),annotation:l.annotation};u.range.isEmpty?o.push(u):t.push(u)}let s=[];for(;;){let l=e[0];if(!l||!l.range.intersectsOrTouches(r.replaceRange))break;e.shift(),s.push(l)}for(let l=s.length-1;l>=0;l--){let c=s[l],u=c.range,p=l===0&&r.replaceRange.endExclusive>u.start&&r.replaceRange.start<u.endExclusive,h=u.intersect(r.replaceRange).length;u=u.deltaEnd(-h+(p?r.newText.length:0));let g=u.start-r.replaceRange.start;g>0&&(u=u.delta(-g)),!p&&g>=0&&(u=u.delta(r.newText.length)),u=u.delta(-(r.newText.length-r.replaceRange.length)),e.unshift({annotation:c.annotation,range:u})}n+=r.newText.length-r.replaceRange.length}for(;;){let r=e[0];if(!r)break;e.shift();let s={annotation:r.annotation,range:r.range.delta(n)};s.range.isEmpty?o.push(s):t.push(s)}return this._annotations=t,o}clone(){return new a(this._annotations.slice())}},nCe=class a{static create(i){return new a(i)}constructor(i){this._annotations=i}get annotations(){return this._annotations}rebase(i){let e=new P5e(this._annotations);e.applyEdit(i),this._annotations=e.getAllAnnotations()}serialize(i){return this._annotations.map(e=>{let t={start:e.range.start,endExclusive:e.range.endExclusive};return e.annotation?{range:t,annotation:i(e.annotation)}:{range:t,annotation:void 0}})}static deserialize(i,e){let t=i.map(o=>{let n=new pi(o.range.start,o.range.endExclusive);return o.annotation?{range:n,annotation:e(o.annotation)}:{range:n,annotation:void 0}});return new a(t)}};var A5e=class a extends Xae{static{this.empty=new a([])}static fromEdit(i){return new a(i.replacements.map(e=>new Ole(e.replaceRange,e.getNewLength())))}static create(i){return new a(i)}static single(i){return new a([i])}static replace(i,e){return new a([new Ole(i,e)])}static insert(i,e){return new a([new Ole(pi.emptyAt(i),e)])}static delete(i){return new a([new Ole(i,0)])}static compose(i){let e=a.empty;for(let t of i)e=e.compose(t);return e}inverse(){let i=[],e=0;for(let t of this.replacements)i.push(new Ole(pi.ofStartAndLength(t.replaceRange.start+e,t.newLength),t.replaceRange.length)),e+=t.newLength-t.replaceRange.length;return new a(i)}_createNew(i){return new a(i)}applyArray(i,e){let t=new Array(this.getNewDataLength(i.length)),o=0,n=0;for(let r of this.replacements){for(let s=o;s<r.replaceRange.start;s++)t[n++]=i[s];o=r.replaceRange.endExclusive;for(let s=0;s<r.newLength;s++)t[n++]=e}for(;o<i.length;)t[n++]=i[o++];return t}},Ole=class a extends xye{constructor(e,t){super(e);this.newLength=t}static create(e,t,o){return new a(new pi(e,t),o)}equals(e){return this.replaceRange.equals(e.replaceRange)&&this.newLength===e.newLength}getNewLength(){return this.newLength}tryJoinTouching(e){return new a(this.replaceRange.joinRightTouching(e.replaceRange),this.newLength+e.newLength)}slice(e,t){return new a(e,t.length)}toString(){return`[${this.replaceRange.start}, +${this.replaceRange.length}) -> +${this.newLength}}`}};function A8i(a,i){let e=[];for(let t of a.replacements){let o=z.fromPositions(i.getPositionAt(t.replaceRange.start),i.getPositionAt(t.replaceRange.start+t.replaceRange.length));e.push(Hn.replace(o,t.newText))}return e}function eY(a){let i=a.map(t=>new ed(pi.ofStartAndLength(t.rangeOffset,t.rangeLength),t.text));return i.reverse(),new ld(i)}function N8i(a,i,e){let t=[];for(let o of e)for(let n of o.innerChanges??[]){let r=i.getValueInRange(n.modifiedRange),s=a.getOffsetAt(n.originalRange.getStartPosition()),l=a.getOffsetAt(n.originalRange.getEndPosition()),c=new pi(s,l);t.push(new ed(c,r))}return new ld(t)}function Voi(a){let e=a.slice().reverse().map(o=>A5e.replace(new pi(o.range.startLineNumber-1,o.range.endLineNumber),ZS(o.text)[0]+1));return A5e.compose(e)}var EIt=class a extends x{constructor(e,t){super();this.textModel=e;this.tokenizationTextModelPart=t;this._onDidChangeLineHeight=this._register(new E);this.onDidChangeLineHeight=this._onDidChangeLineHeight.event;this._onDidChangeFont=this._register(new E);this.onDidChangeFont=this._onDidChangeFont.event;this._fontAnnotatedString=new P5e;this._register(this.tokenizationTextModelPart.onDidChangeFontTokens(o=>{let n=new Set,r=[],s=new Set,l=new Set;for(let c of o.changes.annotations){let p=this.textModel.getPositionAt(c.range.start).lineNumber,h;if(c.annotation===void 0)h={range:c.range,annotation:void 0};else{let g=`tokenization-font-decoration-${a.DECORATION_COUNT}`,f={fontToken:c.annotation,decorationId:g};h={range:c.range,annotation:f},a.DECORATION_COUNT++,c.annotation.lineHeightMultiplier&&s.add(new Nj(0,g,p,c.annotation.lineHeightMultiplier)),l.add(new Oj(0,g,p))}if(r.push(h),!n.has(p)){let g=this.textModel.getOffsetAt(new ye(p,1)),f=this.textModel.getOffsetAt(new ye(p,this.textModel.getLineMaxColumn(p))),v=new pi(g,f),b=this._fontAnnotatedString.getAnnotationsIntersecting(v);for(let S of b){let y=S.annotation.decorationId;s.add(new Nj(0,y,p,null)),l.add(new Oj(0,y,p))}n.add(p)}}this._fontAnnotatedString.setAnnotations(nCe.create(r)),this._onDidChangeLineHeight.fire(s),this._onDidChangeFont.fire(l)}))}static{this.DECORATION_COUNT=0}handleDidChangeContent(e){let t=eY(e.changes),o=this._fontAnnotatedString.applyEdit(t);if(o.length===0)return;let n=new Set,r=new Set;for(let s of o){let c=this.textModel.getPositionAt(s.range.start).lineNumber,u=s.annotation.decorationId;n.add(new Nj(0,u,c,null)),r.add(new Oj(0,u,c))}this._onDidChangeLineHeight.fire(n),this._onDidChangeFont.fire(r)}getDecorationsInRange(e,t,o,n,r){let s=this.textModel.getOffsetAt(e.getStartPosition()),l=this.textModel.getOffsetAt(e.getEndPosition()),c=this._fontAnnotatedString.getAnnotationsIntersecting(new pi(s,l)),u=[];for(let p of c){let h=p.annotation,g=!!(h.fontToken.fontFamily||h.fontToken.fontSizeMultiplier);if(!(g&&n)){let f=this.textModel.getPositionAt(p.range.start),v=this.textModel.getPositionAt(p.range.endExclusive),b=z.fromPositions(f,v),S=p.annotation,y=Woi(S.fontToken.fontFamily??"",S.fontToken.fontSizeMultiplier??0),w=S.decorationId;u.push({id:w,options:{description:"FontOptionDecoration",inlineClassName:y,lineHeight:S.fontToken.lineHeightMultiplier,affectsFont:g},ownerId:0,range:b})}}return u}getAllDecorations(e,t){return this.getDecorationsInRange(new z(1,1,this.textModel.getLineCount(),this.textModel.getLineMaxColumn(this.textModel.getLineCount())),e,t)}};function sBo(a,i){let e=a.gotoNextSibling(),t=i.gotoNextSibling();if(e!==t)throw new Error("Trees are out of sync");return e&&t}function Boi(a,i){let e=a.gotoParent(),t=i.gotoParent();if(e!==t)throw new Error("Trees are out of sync");return e&&t}function O8i(a,i,e){let t=a.gotoFirstChild(),o=i.gotoFirstChild();if(t!==o)throw new Error("Trees are out of sync");if(e===0)return t&&o;for(let n=1;n<=e;n++){let r=a.gotoNextSibling(),s=i.gotoNextSibling();if(r!==s)throw new Error("Trees are out of sync");if(!r||!s)return!1}return t&&o}function Hoi(a,i){do{if(a.currentNode.nextSibling)return sBo(a,i);a.currentNode.parent&&Boi(a,i)}while(a.currentNode.nextSibling||a.currentNode.parent);return!1}function F8i(a,i){let e=i.walk();e.resetTo(a);let t=a.currentNode;do if(e.currentNode.previousSibling&&e.currentNode.endIndex-e.currentNode.startIndex!==0)e.gotoPreviousSibling();else{for(;!e.currentNode.previousSibling&&e.currentNode.parent;)e.gotoParent();e.gotoPreviousSibling()}while(e.currentNode.endIndex>t.startIndex&&(e.currentNode.parent||e.currentNode.previousSibling)&&e.currentNode.id!==t.id);if(e.currentNode.id!==t.id&&e.currentNode.endIndex<=t.startIndex)return e.currentNode}var rCe=class extends x{constructor(e,t,o,n,r,s,l){super();this.languageId=e;this._ranges=t;this._parser=o;this._parserClass=n;this.textModel=r;this._logService=s;this._telemetryService=l;this._tree=Me(this,void 0);this.tree=this._tree;this._treeLastParsedVersion=Me(this,-1);this.treeLastParsedVersion=this._treeLastParsedVersion;this._onDidChangeContentQueue=new vIe;this._tree=Me(this,void 0),this.tree=this._tree,this._register(Z(()=>{this._tree.get()?.delete(),this._lastFullyParsed?.delete(),this._lastFullyParsedWithEdits?.delete(),this._parser.delete()})),this.handleContentChange(void 0,this._ranges)}handleContentChange(e,t){let o=this.textModel.getVersionId(),n=[];t&&(n=this._setRanges(t)),e&&this._applyEdits(e.changes),this._onDidChangeContentQueue.clearPending(),this._onDidChangeContentQueue.schedule(async()=>{if(this._store.isDisposed)return;let r=this._lastFullyParsed,s;this._lastFullyParsedWithEdits&&this._lastFullyParsed&&(s=this._findChangedNodes(this._lastFullyParsedWithEdits,this._lastFullyParsed));let l=await this._parseAndUpdateTree(o);if(l){let c;s?r&&s&&(c=this._findTreeChanges(l,s,n)):this._ranges&&(c=this._ranges.map(p=>({newRange:new z(p.startPosition.row+1,p.startPosition.column+1,p.endPosition.row+1,p.endPosition.column+1),oldRangeLength:p.endIndex-p.startIndex,newRangeStartOffset:p.startIndex,newRangeEndOffset:p.endIndex}))),c||(c=[{newRange:this.textModel.getFullModelRange(),newRangeStartOffset:0,newRangeEndOffset:this.textModel.getValueLength()}]);let u=this._tree.get();Gi(p=>{this._tree.set(l,p,{ranges:c,versionId:o}),this._treeLastParsedVersion.set(o,p)}),u?.delete()}})}get ranges(){return this._ranges}getInjectionTrees(e,t){}_applyEdits(e){for(let t of e){let o=pc.ofRange(z.lift(t.range)),n=pc.ofText(t.text),r=t.text.length===0?n:o.add(n),s={startIndex:t.rangeOffset,oldEndIndex:t.rangeOffset+t.rangeLength,newEndIndex:t.rangeOffset+t.text.length,startPosition:{row:t.range.startLineNumber-1,column:t.range.startColumn-1},oldEndPosition:{row:t.range.endLineNumber-1,column:t.range.endColumn-1},newEndPosition:{row:t.range.startLineNumber+r.lineCount-1,column:r.lineCount?r.columnCount:t.range.endColumn+r.columnCount}};this._tree.get()?.edit(s),this._lastFullyParsedWithEdits?.edit(s)}}_findChangedNodes(e,t){if(this._ranges&&this._ranges.every(l=>l.startPosition.row!==e.rootNode.startPosition.row)||e.rootNode.startPosition.row!==0)return[];let o=e.walk(),n=t.walk(),r=[],s=!0;do if(o.currentNode.hasChanges){let l=o.currentNode.children,c=[],u=l.filter((p,h)=>p?.hasChanges||n.currentNode.children.length<=h?(c.push(h),!0):!1);if(u.length===0||o.currentNode.hasError!==n.currentNode.hasError){for(;o.currentNode.parent&&s&&!o.currentNode.isNamed;)s=Boi(o,n);let p=o.currentNode,h=F8i(o,e)??p;r.push({startIndex:h.startIndex,endIndex:p.endIndex,startPosition:h.startPosition,endPosition:p.endPosition}),s=Hoi(o,n)}else u.length>=1&&(s=O8i(o,n,c[0]))}else s=Hoi(o,n);while(s);return o.delete(),n.delete(),r}_findTreeChanges(e,t,o){let n=0,r=[];for(let s=0;s<t.length;s++){let l=t[s];if(r.length>0&&l.startIndex>=r[r.length-1].newRangeStartOffset&&l.endIndex<=r[r.length-1].newRangeEndOffset)continue;let c=e.walk(),u=()=>c.startIndex<l.startIndex&&c.endIndex>l.endIndex;for(;u();){let b=c.gotoFirstChild(),S=!1;for(;b;)if(u()&&c.currentNode.isNamed){S=!0;break}else b=c.gotoNextSibling();if(!S){c.gotoParent();break}if(c.currentNode.childCount===0)break}let p=c.currentNode.startPosition,h=c.currentNode.endPosition,g=c.currentNode.startIndex,f=c.currentNode.endIndex,v={newRange:new z(p.row+1,p.column+1,h.row+1,h.column+1),newRangeStartOffset:g,newRangeEndOffset:f};n<o.length&&W8i(o[n],{startIndex:g,endIndex:f,startPosition:p,endPosition:h})?(o[n].startIndex<v.newRangeStartOffset&&(v.newRange=v.newRange.setStartPosition(o[n].startPosition.row+1,o[n].startPosition.column+1),v.newRangeStartOffset=o[n].startIndex),o[n].endIndex>v.newRangeEndOffset&&(v.newRange=v.newRange.setEndPosition(o[n].endPosition.row+1,o[n].endPosition.column+1),v.newRangeEndOffset=o[n].endIndex),n++):n<o.length&&o[n].endIndex<v.newRangeStartOffset&&r.push({newRange:new z(o[n].startPosition.row+1,o[n].startPosition.column+1,o[n].endPosition.row+1,o[n].endPosition.column+1),newRangeStartOffset:o[n].startIndex,newRangeEndOffset:o[n].endIndex}),r.length>0&&r[r.length-1].newRangeEndOffset>=v.newRangeStartOffset?(r[r.length-1].newRange=z.fromPositions(r[r.length-1].newRange.getStartPosition(),v.newRange.getEndPosition()),r[r.length-1].newRangeEndOffset=v.newRangeEndOffset):r.push(v)}return this._constrainRanges(r)}_constrainRanges(e){if(!this._ranges)return e;let t=[],o=0,n=0;for(;o<e.length&&n<this._ranges.length;){let r=e[o],s=this._ranges[n];if(r.newRangeEndOffset<s.startIndex)o++;else if(r.newRangeStartOffset>s.endIndex)n++;else{let l=Math.max(r.newRangeStartOffset,s.startIndex),c=Math.min(r.newRangeEndOffset,s.endIndex),u=r.newRange.intersectRanges(new z(s.startPosition.row+1,s.startPosition.column+1,s.endPosition.row+1,s.endPosition.column+1));t.push({newRange:u,newRangeEndOffset:c,newRangeStartOffset:l}),c<r.newRangeEndOffset?(r.newRange=z.fromPositions(u.getEndPosition(),r.newRange.getEndPosition()),r.newRangeStartOffset=c+1):o++}}return t}async _parseAndUpdateTree(e){let t=await this._parse();if(t)return this._lastFullyParsed?.delete(),this._lastFullyParsed=t.copy(),this._lastFullyParsedWithEdits?.delete(),this._lastFullyParsedWithEdits=t.copy(),t;this._tree.get()||this._parser.reset()}_parse(){let e="fullParse";return this._tree.get()&&(e="incrementalParse"),this._parseAndYield(e)}async _parseAndYield(e){let t=0,o=0,n=this.textModel.getVersionId(),r,s=aBo();do{let l=performance.now();r=this._parser.parse((c,u)=>this._parseCallback(c),this._tree.get(),{progressCallback:s,includedRanges:this._ranges}),t+=performance.now()-l,o++,await new Promise(c=>pC(c))}while(!this._store.isDisposed&&!r&&n===this.textModel.getVersionId());return this._sendParseTimeTelemetry(e,t,o),r&&n===this.textModel.getVersionId()?r:void 0}_parseCallback(e){try{return this.textModel.getTextBuffer().getNearestChunk(e)}catch(t){this._logService.debug("Error getting chunk for tree-sitter parsing",t)}}_setRanges(e){let t=[];if(this._ranges)for(let o of e){let n=!1;for(let r=0;r<this._ranges.length;r++){let s=this._ranges[r];if(lBo(s,o)||W8i(s,o)){n=!0;break}}n||t.push(o)}else t.push(...e);return this._ranges=e,t}_sendParseTimeTelemetry(e,t,o){this._logService.debug(`Tree parsing (${e}) took ${t} ms and ${o} passes.`),e==="fullParse"?this._telemetryService.publicLog2("treeSitter.fullParse",{languageId:this.languageId,time:t,passes:o}):this._telemetryService.publicLog2("treeSitter.incrementalParse",{languageId:this.languageId,time:t,passes:o})}createParsedTreeSync(e){let t=new this._parserClass;t.setLanguage(this._parser.language);let o=t.parse(e);return t.delete(),o??void 0}};rCe=I([m(5,se),m(6,Te)],rCe);function aBo(){let a=performance.now();return function(e){let t=performance.now();return t-a>50?(a=t,!0):!1}}function lBo(a,i){return a.startPosition.row===i.startPosition.row&&a.startPosition.column===i.startPosition.column&&a.endPosition.row===i.endPosition.row&&a.endPosition.column===i.endPosition.column&&a.startIndex===i.startIndex&&a.endIndex===i.endIndex}function W8i(a,i){return a.startIndex<=i.startIndex&&a.endIndex>=i.startIndex||i.startIndex<=a.startIndex&&i.endIndex>=a.startIndex}var Uoi=new class{clone(){return this}equals(a){return this===a}};function sCe(a,i){let e=new Uint32Array(2);return e[0]=0,e[1]=(a<<0|0|0|32768|2<<24)>>>0,new Gae(e,[],i===null?Uoi:i)}var TIt=class{constructor(i){this._default=i;this._store=[]}get(i){return i<this._store.length?this._store[i]:this._default}set(i,e){for(;i>=this._store.length;)this._store[this._store.length]=this._default;this._store[i]=e}replace(i,e,t){if(i>=this._store.length)return;if(e===0){this.insert(i,t);return}else if(t===0){this.delete(i,e);return}let o=this._store.slice(0,i),n=this._store.slice(i+e),r=cBo(t,this._default);this._store=o.concat(r,n)}delete(i,e){e===0||i>=this._store.length||this._store.splice(i,e)}insert(i,e){if(e===0||i>=this._store.length)return;let t=[];for(let o=0;o<e;o++)t[o]=this._default;this._store=i1(this._store,i,t)}};function cBo(a,i){let e=[];for(let t=0;t<a;t++)e[t]=i;return e}var cz=new Uint32Array(0).buffer,ty=class a{static deleteBeginning(i,e){return i===null||i===cz?i:a.delete(i,0,e)}static deleteEnding(i,e){if(i===null||i===cz)return i;let t=dz(i),o=t[t.length-2];return a.delete(i,e,o)}static delete(i,e,t){if(i===null||i===cz||e===t)return i;let o=dz(i),n=o.length>>>1;if(e===0&&o[o.length-2]===t)return cz;let r=Zc.findIndexInTokensArray(o,e),s=r>0?o[r-1<<1]:0,l=o[r<<1];if(t<l){let g=t-e;for(let f=r;f<n;f++)o[f<<1]-=g;return i}let c,u;s!==e?(o[r<<1]=e,c=r+1<<1,u=e):(c=r<<1,u=s);let p=t-e;for(let g=r+1;g<n;g++){let f=o[g<<1]-p;f>u&&(o[c++]=f,o[c++]=o[(g<<1)+1],u=f)}if(c===o.length)return i;let h=new Uint32Array(c);return h.set(o.subarray(0,c),0),h.buffer}static append(i,e){if(e===cz)return i;if(i===cz)return e;if(i===null)return i;if(e===null)return null;let t=dz(i),o=dz(e),n=o.length>>>1,r=new Uint32Array(t.length+o.length);r.set(t,0);let s=t.length,l=t[t.length-2];for(let c=0;c<n;c++)r[s++]=o[c<<1]+l,r[s++]=o[(c<<1)+1];return r.buffer}static insert(i,e,t){if(i===null||i===cz)return i;let o=dz(i),n=o.length>>>1,r=Zc.findIndexInTokensArray(o,e);r>0&&o[r-1<<1]===e&&r--;for(let s=r;s<n;s++)o[s<<1]+=t;return i}};function dz(a){return a instanceof Uint32Array?a:new Uint32Array(a)}var N5e=class a{static deserialize(i,e,t){let o=new Uint32Array(i.buffer),n=BI(i,e);e+=4;let r=BI(i,e);e+=4;let s=[];for(let l=0;l<r;l++){let c=BI(i,e);e+=4,s.push(o.subarray(e/4,e/4+c/4)),e+=c}return t.push(new a(n,s)),e}get startLineNumber(){return this._startLineNumber}get endLineNumber(){return this._startLineNumber+this._tokens.length-1}constructor(i,e){this._startLineNumber=i,this._tokens=e}getLineRange(){return new uo(this._startLineNumber,this._startLineNumber+this._tokens.length)}getLineTokens(i){return this._tokens[i-this._startLineNumber]}appendLineTokens(i){this._tokens.push(i)}serializeSize(){let i=0;i+=4,i+=4;for(let e=0;e<this._tokens.length;e++){let t=this._tokens[e];if(!(t instanceof Uint32Array))throw new Error("Not supported!");i+=4,i+=t.byteLength}return i}serialize(i,e){HI(i,this._startLineNumber,e),e+=4,HI(i,this._tokens.length,e),e+=4;for(let t=0;t<this._tokens.length;t++){let o=this._tokens[t];if(!(o instanceof Uint32Array))throw new Error("Not supported!");HI(i,o.byteLength,e),e+=4,i.set(new Uint8Array(o.buffer),e),e+=o.byteLength}return e}applyEdit(i,e){let[t,o]=ZS(e);this._acceptDeleteRange(i),this._acceptInsertText(new ye(i.startLineNumber,i.startColumn),t,o)}_acceptDeleteRange(i){if(i.startLineNumber===i.endLineNumber&&i.startColumn===i.endColumn)return;let e=i.startLineNumber-this._startLineNumber,t=i.endLineNumber-this._startLineNumber;if(t<0){let o=t-e;this._startLineNumber-=o;return}if(!(e>=this._tokens.length)){if(e<0&&t>=this._tokens.length){this._startLineNumber=0,this._tokens=[];return}if(e===t){this._tokens[e]=ty.delete(this._tokens[e],i.startColumn-1,i.endColumn-1);return}if(e>=0)if(this._tokens[e]=ty.deleteEnding(this._tokens[e],i.startColumn-1),t<this._tokens.length){let o=ty.deleteBeginning(this._tokens[t],i.endColumn-1);this._tokens[e]=ty.append(this._tokens[e],o),this._tokens.splice(e+1,t-e)}else this._tokens[e]=ty.append(this._tokens[e],null),this._tokens=this._tokens.slice(0,e+1);else{let o=-e;this._startLineNumber-=o,this._tokens[t]=ty.deleteBeginning(this._tokens[t],i.endColumn-1),this._tokens=this._tokens.slice(t)}}}_acceptInsertText(i,e,t){if(e===0&&t===0)return;let o=i.lineNumber-this._startLineNumber;if(o<0){this._startLineNumber+=e;return}if(!(o>=this._tokens.length)){if(e===0){this._tokens[o]=ty.insert(this._tokens[o],i.column-1,t);return}this._tokens[o]=ty.deleteEnding(this._tokens[o],i.column-1),this._tokens[o]=ty.insert(this._tokens[o],i.column-1,t),this._insertLines(i.lineNumber,e)}}_insertLines(i,e){if(e===0)return;let t=[];for(let o=0;o<e;o++)t[o]=null;this._tokens=i1(this._tokens,i,t)}};var uz=class{static deserialize(i){let e=0,t=BI(i,e);e+=4;let o=[];for(let n=0;n<t;n++)e=N5e.deserialize(i,e,o);return o}constructor(){this._tokens=[]}add(i,e){if(this._tokens.length>0){let t=this._tokens[this._tokens.length-1];if(t.endLineNumber+1===i){t.appendLineTokens(e);return}}this._tokens.push(new N5e(i,[e]))}finalize(){return this._tokens}serialize(){let i=this._serializeSize(),e=new Uint8Array(i);return this._serialize(e),e}_serializeSize(){let i=0;i+=4;for(let e=0;e<this._tokens.length;e++)i+=this._tokens[e].serializeSize();return i}_serialize(i){let e=0;HI(i,this._tokens.length,e),e+=4;for(let t=0;t<this._tokens.length;t++)e=this._tokens[t].serialize(i,e)}};var zoi=class{constructor(i,e){this.tokenizationSupport=e;this.initialState=this.tokenizationSupport.getInitialState(),this.store=new aCe(i)}getStartState(i){return this.store.getStartState(i,this.initialState)}getFirstInvalidLine(){return this.store.getFirstInvalidLine(this.initialState)}},_It=class extends zoi{constructor(e,t,o,n){super(e,t);this._textModel=o;this._languageIdCodec=n}updateTokensUntilLine(e,t){let o=this._textModel.getLanguageId();for(;;){let n=this.getFirstInvalidLine();if(!n||n.lineNumber>t)break;let r=this._textModel.getLineContent(n.lineNumber),s=O5e(this._languageIdCodec,o,this.tokenizationSupport,r,!0,n.startState);e.add(n.lineNumber,s.tokens),this.store.setEndState(n.lineNumber,s.endState)}}getTokenTypeIfInsertingCharacter(e,t){let o=this.getStartState(e.lineNumber);if(!o)return 0;let n=this._textModel.getLanguageId(),r=this._textModel.getLineContent(e.lineNumber),s=r.substring(0,e.column-1)+t+r.substring(e.column-1),l=O5e(this._languageIdCodec,n,this.tokenizationSupport,s,!0,o),c=new Zc(l.tokens,s,this._languageIdCodec);if(c.getCount()===0)return 0;let u=c.findTokenIndexAtOffset(e.column-1);return c.getStandardTokenType(u)}tokenizeLinesAt(e,t){let o=this.getStartState(e);if(!o)return null;let n=this._textModel.getLanguageId(),r=[],s=o;for(let l of t){let c=O5e(this._languageIdCodec,n,this.tokenizationSupport,l,!0,s);r.push(new Zc(c.tokens,l,this._languageIdCodec)),s=c.endState}return r}hasAccurateTokensForLine(e){let t=this.store.getFirstInvalidEndStateLineNumberOrMax();return e<t}isCheapToTokenize(e){let t=this.store.getFirstInvalidEndStateLineNumberOrMax();return e<t||e===t&&this._textModel.getLineLength(e)<2048}tokenizeHeuristically(e,t,o){if(o<=this.store.getFirstInvalidEndStateLineNumberOrMax())return{heuristicTokens:!1};if(t<=this.store.getFirstInvalidEndStateLineNumberOrMax())return this.updateTokensUntilLine(e,o),{heuristicTokens:!1};let n=this.guessStartState(t),r=this._textModel.getLanguageId();for(let s=t;s<=o;s++){let l=this._textModel.getLineContent(s),c=O5e(this._languageIdCodec,r,this.tokenizationSupport,l,!0,n);e.add(s,c.tokens),n=c.endState}return{heuristicTokens:!0}}guessStartState(e){let{likelyRelevantLines:t,initialState:o}=Goi(this._textModel,e,this);o||(o=this.tokenizationSupport.getInitialState());let n=this._textModel.getLanguageId(),r=o;for(let s of t)r=O5e(this._languageIdCodec,n,this.tokenizationSupport,s,!1,r).endState;return r}};function Goi(a,i,e){let t=a.getLineFirstNonWhitespaceColumn(i),o=[],n=null;for(let r=i-1;t>1&&r>=1;r--){let s=a.getLineFirstNonWhitespaceColumn(r);if(s!==0&&s<t&&(o.push(a.getLineContent(r)),t=s,n=e?.getStartState(r),n))break}return o.reverse(),{likelyRelevantLines:o,initialState:n??void 0}}var aCe=class{constructor(i){this.lineCount=i;this._tokenizationStateStore=new F5e;this._invalidEndStatesLineNumbers=new Koi;this._invalidEndStatesLineNumbers.addRange(new pi(1,i+1))}getEndState(i){return this._tokenizationStateStore.getEndState(i)}setEndState(i,e){if(!e)throw new li("Cannot set null/undefined state");this._invalidEndStatesLineNumbers.delete(i);let t=this._tokenizationStateStore.setEndState(i,e);return t&&i<this.lineCount&&this._invalidEndStatesLineNumbers.addRange(new pi(i+1,i+2)),t}acceptChange(i,e){this.lineCount+=e-i.length,this._tokenizationStateStore.acceptChange(i,e),this._invalidEndStatesLineNumbers.addRangeAndResize(new pi(i.startLineNumber,i.endLineNumberExclusive),e)}acceptChanges(i){for(let e of i){let[t]=ZS(e.text);this.acceptChange(new uo(e.range.startLineNumber,e.range.endLineNumber+1),t+1)}}invalidateEndStateRange(i){this._invalidEndStatesLineNumbers.addRange(new pi(i.startLineNumber,i.endLineNumberExclusive))}getFirstInvalidEndStateLineNumber(){return this._invalidEndStatesLineNumbers.min}getFirstInvalidEndStateLineNumberOrMax(){return this.getFirstInvalidEndStateLineNumber()||Number.MAX_SAFE_INTEGER}allStatesValid(){return this._invalidEndStatesLineNumbers.min===null}getStartState(i,e){return i===1?e:this.getEndState(i-1)}getFirstInvalidLine(i){let e=this.getFirstInvalidEndStateLineNumber();if(e===null)return null;let t=this.getStartState(e,i);if(!t)throw new li("Start state must be defined");return{lineNumber:e,startState:t}}},F5e=class{constructor(){this._lineEndStates=new TIt(null)}getEndState(i){return this._lineEndStates.get(i)}setEndState(i,e){let t=this._lineEndStates.get(i);return t&&t.equals(e)?!1:(this._lineEndStates.set(i,e),!0)}acceptChange(i,e){let t=i.length;e>0&&t>0&&(t--,e--),this._lineEndStates.replace(i.startLineNumber,t,e)}acceptChanges(i){for(let e of i){let[t]=ZS(e.text);this.acceptChange(new uo(e.range.startLineNumber,e.range.endLineNumber+1),t+1)}}},Koi=class{constructor(){this._ranges=[]}getRanges(){return this._ranges}get min(){return this._ranges.length===0?null:this._ranges[0].start}removeMin(){if(this._ranges.length===0)return null;let i=this._ranges[0];return i.start+1===i.endExclusive?this._ranges.shift():this._ranges[0]=new pi(i.start+1,i.endExclusive),i.start}delete(i){let e=this._ranges.findIndex(t=>t.contains(i));if(e!==-1){let t=this._ranges[e];t.start===i?t.endExclusive===i+1?this._ranges.splice(e,1):this._ranges[e]=new pi(i+1,t.endExclusive):t.endExclusive===i+1?this._ranges[e]=new pi(t.start,i):this._ranges.splice(e,1,new pi(t.start,i),new pi(i+1,t.endExclusive))}}addRange(i){pi.addRange(i,this._ranges)}addRangeAndResize(i,e){let t=0;for(;!(t>=this._ranges.length||i.start<=this._ranges[t].endExclusive);)t++;let o=t;for(;!(o>=this._ranges.length||i.endExclusive<this._ranges[o].start);)o++;let n=e-i.length;for(let r=o;r<this._ranges.length;r++)this._ranges[r]=this._ranges[r].delta(n);if(t===o){let r=new pi(i.start,i.start+e);r.isEmpty||this._ranges.splice(t,0,r)}else{let r=Math.min(i.start,this._ranges[t].start),s=Math.max(i.endExclusive,this._ranges[o-1].endExclusive),l=new pi(r,s+n);l.isEmpty?this._ranges.splice(t,o-t):this._ranges.splice(t,o-t,l)}}toString(){return this._ranges.map(i=>i.toString()).join(" + ")}};function O5e(a,i,e,t,o,n){let r=null;if(e)try{r=e.tokenizeEncoded(t,o,n.clone())}catch(s){mt(s)}return r||(r=sCe(a.encodeLanguageId(i),n)),Zc.convertToEndOffset(r.tokens,t.length),r}var DIt=class{constructor(i,e){this._tokenizerWithStateStore=i;this._backgroundTokenStore=e;this._isDisposed=!1;this._isScheduled=!1}dispose(){this._isDisposed=!0}handleChanges(){this._beginBackgroundTokenization()}_beginBackgroundTokenization(){this._isScheduled||!this._tokenizerWithStateStore._textModel.isAttachedToEditor()||!this._hasLinesToTokenize()||(this._isScheduled=!0,PL(i=>{this._isScheduled=!1,this._backgroundTokenizeWithDeadline(i)}))}_backgroundTokenizeWithDeadline(i){let e=Date.now()+i.timeRemaining(),t=()=>{this._isDisposed||!this._tokenizerWithStateStore._textModel.isAttachedToEditor()||!this._hasLinesToTokenize()||(this._backgroundTokenizeForAtLeast1ms(),Date.now()<e?pC(t):this._beginBackgroundTokenization())};t()}_backgroundTokenizeForAtLeast1ms(){let i=this._tokenizerWithStateStore._textModel.getLineCount(),e=new uz,t=Dn.create(!1);do if(t.elapsed()>1||this._tokenizeOneInvalidLine(e)>=i)break;while(this._hasLinesToTokenize());this._backgroundTokenStore.setTokens(e.finalize()),this.checkFinished()}_hasLinesToTokenize(){return this._tokenizerWithStateStore?!this._tokenizerWithStateStore.store.allStatesValid():!1}_tokenizeOneInvalidLine(i){let e=this._tokenizerWithStateStore?.getFirstInvalidLine();return e?(this._tokenizerWithStateStore.updateTokensUntilLine(i,e.lineNumber),e.lineNumber):this._tokenizerWithStateStore._textModel.getLineCount()+1}checkFinished(){this._isDisposed||this._tokenizerWithStateStore.store.allStatesValid()&&this._backgroundTokenStore.backgroundTokenizationFinished()}requestTokens(i,e){this._tokenizerWithStateStore.store.invalidateEndStateRange(new uo(i,e))}};var Fj=class a{constructor(i){this.height=i;this._children=[];this._length=0}get children(){return this._children}get length(){return this._length}static create(i,e){let t=new a(i.height+1);return t.appendChild(i),t.appendChild(e),t}canAppendChild(){return this._children.length<3}appendChild(i){if(!this.canAppendChild())throw new Error("Cannot insert more than 3 children in a ListNode");this._children.push(i),this._length+=i.length,this._updateParentLength(i.length),eI(i)||(i.parent=this)}_updateParentLength(i){let e=this.parent;for(;e;)e._length+=i,e=e.parent}unappendChild(){let i=this._children.pop();return this._length-=i.length,this._updateParentLength(-i.length),i}prependChild(i){if(this._children.length>=3)throw new Error("Cannot prepend more than 3 children in a ListNode");this._children.unshift(i),this._length+=i.length,this._updateParentLength(i.length),eI(i)||(i.parent=this)}unprependChild(){let i=this._children.shift();return this._length-=i.length,this._updateParentLength(-i.length),i}lastChild(){return this._children[this._children.length-1]}dispose(){this._children.splice(0,this._children.length)}};function eI(a){return a.token!==void 0}function V8i(a,i){let e=a,t=[],o;for(;;){if(i.height===e.height){o=i;break}if(eI(e))throw new Error("unexpected");t.push(e),e=e.lastChild()}for(let n=t.length-1;n>=0;n--){let r=t[n];o&&(r.children.length>=3?o=Fj.create(r.unappendChild(),o):(r.appendChild(o),o=void 0))}if(o){let n=new Fj(o.height+1);return n.appendChild(a),n.appendChild(o),n}else return a}function dBo(a,i){let e=a,t=[];for(;i.height!==e.height;){if(eI(e))throw new Error("unexpected");t.push(e),e=e.children[0]}let o=i;for(let n=t.length-1;n>=0;n--){let r=t[n];o&&(r.children.length>=3?o=Fj.create(o,r.unprependChild()):(r.prependChild(o),o=void 0))}return o?Fj.create(o,a):a}function uBo(a,i){return a.height===i.height?Fj.create(a,i):a.height>i.height?V8i(a,i):dBo(i,a)}var LIt=class a{constructor(i){this._textModel=i;this._root=this.createEmptyRoot()}get root(){return this._root}createEmptyRoot(){return{length:this._textModel.getValueLength(),token:0,height:0,tokenQuality:0}}buildStore(i,e){this._root=this.createFromUpdates(i,e)}createFromUpdates(i,e){if(i.length===0)return this.createEmptyRoot();let t={length:i[0].length,token:i[0].token,height:0,tokenQuality:e};for(let o=1;o<i.length;o++)t=V8i(t,{length:i[o].length,token:i[o].token,height:0,tokenQuality:e});return t}update(i,e,t){e.length!==0&&this.replace(i,e[0].startOffsetInclusive,e,t)}delete(i,e){this.replace(i,e,[],2)}replace(i,e,t,o){let n=e+i,r=[],s=[],l=[{node:this._root,offset:0}];for(;l.length>0;){let p=l.pop(),h=p.offset;if(h<e&&h+p.node.length<=e){eI(p.node)||(p.node.parent=void 0),r.push(p.node);continue}else eI(p.node)&&h<e&&r.push({length:e-h,token:p.node.token,height:0,tokenQuality:p.node.tokenQuality});if(!(e<=h&&h+p.node.length<=n)){if(h>=n){eI(p.node)||(p.node.parent=void 0),s.push(p.node);continue}else if(eI(p.node)&&h+p.node.length>n){s.push({length:h+p.node.length-n,token:p.node.token,height:0,tokenQuality:p.node.tokenQuality});continue}if(!eI(p.node)){let g=h+p.node.length;for(let f=p.node.children.length-1;f>=0;f--)g-=p.node.children[f].length,l.push({node:p.node.children[f],offset:g})}}}let c;t.length>0?c=r.concat(this.createFromUpdates(t,o),s):c=r.concat(s);let u=c[0];for(let p=1;p<c.length;p++)u=uBo(u,c[p]);this._root=u??this.createEmptyRoot()}traverseInOrderInRange(i,e,t){let o=[{node:this._root,offset:0}];for(;o.length>0;){let{node:n,offset:r}=o.pop();if(!(r+n.length<=i||r>=e)){if(t(n,r))return;if(!eI(n)){let l=r+n.length;for(let c=n.children.length-1;c>=0;c--)l-=n.children[c].length,o.push({node:n.children[c],offset:l})}}}}getTokenAt(i){let e;return this.traverseInOrderInRange(i,this._root.length,(t,o)=>eI(t)?(e={token:t.token,startOffsetInclusive:o,length:t.length},!0):!1),e}getTokensInRange(i,e){let t=[];return this.traverseInOrderInRange(i,e,(o,n)=>{if(eI(o)){let r=o.length,s=n;n<i&&n+o.length>e?(s=i,r=e-i):n<i?(r-=i-n,s=i):n+o.length>e&&(r-=n+o.length-e),t.push({token:o.token,startOffsetInclusive:s,length:r})}return!1}),t}markForRefresh(i,e){this.traverseInOrderInRange(i,e,t=>(eI(t)&&(t.tokenQuality=0),!1))}rangeHasTokens(i,e,t){let o=!0;return this.traverseInOrderInRange(i,e,n=>(eI(n)&&n.tokenQuality<t&&(o=!1),!1)),o}rangeNeedsRefresh(i,e){let t=!1;return this.traverseInOrderInRange(i,e,o=>(eI(o)&&o.tokenQuality!==3&&(t=!0),!1)),t}getNeedsRefresh(){let i=[];return this.traverseInOrderInRange(0,this._textModel.getValueLength(),(e,t)=>(eI(e)&&e.tokenQuality!==3&&(i.length>0&&i[i.length-1].endOffset===t?i[i.length-1].endOffset+=e.length:i.push({startOffset:t,endOffset:t+e.length})),!1)),i}deepCopy(){let i=new a(this._textModel);return i._root=this._copyNodeIterative(this._root),i}_copyNodeIterative(i){let e=eI(i)?{length:i.length,token:i.token,tokenQuality:i.tokenQuality,height:i.height}:new Fj(i.height),t=[[i,e]];for(;t.length>0;){let[o,n]=t.pop();if(!eI(o))for(let r of o.children){let s=eI(r)?{length:r.length,token:r.token,tokenQuality:r.tokenQuality,height:r.height}:new Fj(r.height);n.appendChild(s),t.push([r,s])}}return e}printTree(i=this._root){let e=[],t=[[i,0]];for(;t.length>0;){let[o,n]=t.pop(),r="  ".repeat(n);if(eI(o))e.push(`${r}Leaf(length: ${o.length}, token: ${o.token}, refresh: ${o.tokenQuality})
`);else{e.push(`${r}List(length: ${o.length})
`);for(let s=o.children.length-1;s>=0;s--)t.push([o.children[s],n+1])}}return e.join("")}dispose(){let i=[[this._root,!1]];for(;i.length>0;){let[e,t]=i.pop();if(!eI(e))if(t)e.dispose(),e.parent=void 0;else{i.push([e,!0]);for(let o=e.children.length-1;o>=0;o--)i.push([e.children[o],!1])}}this._root=void 0}};var RIt=le("treeSitterThemeService");var lCe=class extends x{constructor(e,t,o,n,r){super();this._tree=e;this._highlightingQueries=t;this._languageIdCodec=o;this._visibleLineRanges=n;this._treeSitterThemeService=r;this._onDidChangeTokens=this._register(new E);this.onDidChangeTokens=this._onDidChangeTokens.event;this._onDidCompleteBackgroundTokenization=this._register(new E);this.onDidChangeBackgroundTokenization=this._onDidCompleteBackgroundTokenization.event;this._encodedLanguageId=this._languageIdCodec.encodeLanguageId(this._tree.languageId),this._register(Vs(this._treeSitterThemeService.onChange,()=>{this._updateTheme()})),this._tokenStore=this._register(new LIt(this._textModel)),this._accurateVersion=this._textModel.getVersionId(),this._guessVersion=this._textModel.getVersionId(),this._tokenStore.buildStore(this._createEmptyTokens(),0),this._register(be(s=>{let l=this._visibleLineRanges.read(s);this._parseAndTokenizeViewPort(l)})),this._register(hP({owner:this,changeTracker:TJt({tree:this._tree.tree})},(s,l)=>{let c=l.changes.at(0)?.change;if(l.changes.length>1)throw new li("The tree changed twice in one transaction. This is currently not supported and should not happen.");if(!c)l.tree&&this._firstTreeUpdate(this._tree.treeLastParsedVersion.read(s));else{if(this.hasTokens())for(let u of c.ranges)this._markForRefresh(u.newRange);this.hasTokens()?this._handleTreeUpdate(c.ranges,c.versionId):this._firstTreeUpdate(c.versionId)}}))}get _textModel(){return this._tree.textModel}handleContentChanged(e){this._guessVersion=e.versionId;for(let t of e.changes)if(t.text.length>t.rangeLength){let o=t.rangeOffset>0?t.rangeOffset-1:t.rangeOffset,n=this._tokenStore.getTokenAt(o),r;n?(r={startOffsetInclusive:n.startOffsetInclusive,length:n.length+t.text.length-t.rangeLength,token:n.token},this._tokenStore.markForRefresh(o,t.rangeOffset+(t.text.length>t.rangeLength?t.text.length:t.rangeLength))):r={startOffsetInclusive:o,length:t.text.length,token:0},this._tokenStore.update(n?.length??0,[r],2)}else if(t.text.length<t.rangeLength){let o=t.rangeLength-t.text.length;this._tokenStore.delete(o,t.rangeOffset)}}getLineTokens(e){let t=this._textModel.getLineContent(e),o=this.getTokens(e);return new Zc(o,t,this._languageIdCodec)}_createEmptyTokens(){let e=this._emptyToken(),t=this._textModel.getValueLength();return[this._emptyTokensForOffsetAndLength(0,t,e)]}_emptyToken(){return this._treeSitterThemeService.findMetadata([],this._encodedLanguageId,!1,void 0)}_emptyTokensForOffsetAndLength(e,t,o){return{token:o,length:e+t,startOffsetInclusive:0}}hasAccurateTokensForLine(e){return this.hasTokens(new z(e,1,e,this._textModel.getLineMaxColumn(e)))}tokenizeLinesAt(e,t){let o=this._guessTokensForLinesContent(e,t),n=[];if(!o)return null;for(let r=0;r<o.length;r++)n.push(new Zc(o[r],t[r],this._languageIdCodec));return n}_rangeHasTokens(e,t){return this._tokenStore.rangeHasTokens(this._textModel.getOffsetAt(e.getStartPosition()),this._textModel.getOffsetAt(e.getEndPosition()),t)}hasTokens(e){return!e||this._guessVersion===this._accurateVersion?!0:!this._tokenStore.rangeNeedsRefresh(this._textModel.getOffsetAt(e.getStartPosition()),this._textModel.getOffsetAt(e.getEndPosition()))}getTokens(e){let t=this._textModel.getOffsetAt({lineNumber:e,column:1}),o=this._textModel.getOffsetAt({lineNumber:e,column:this._textModel.getLineLength(e)+1}),n=this._tokenStore.getTokensInRange(t,o),r=new Uint32Array(n.length*2);for(let s=0;s<n.length;s++)r[s*2]=n[s].startOffsetInclusive-t+n[s].length,r[s*2+1]=n[s].token;return r}getTokensInRange(e,t,o,n){let r=n?this._tokenizeCapturesWithMetadata(n,t,o):this._tokenize(e,t,o);if(r?.endOffsetsAndMetadata)return this._rangeTokensAsUpdates(t,r.endOffsetsAndMetadata)}_updateTokensInStore(e,t,o){this._accurateVersion=e;for(let n of t){let r=n.newTokens.length>0?n.newTokens[n.newTokens.length-1]:void 0,s;r&&this._guessVersion>=e?s=r.startOffsetInclusive+r.length-n.newTokens[0].startOffsetInclusive:n.oldRangeLength?s=n.oldRangeLength:s=0,this._tokenStore.update(s,n.newTokens,o)}}_markForRefresh(e){this._tokenStore.markForRefresh(this._textModel.getOffsetAt(e.getStartPosition()),this._textModel.getOffsetAt(e.getEndPosition()))}_getNeedsRefresh(){let e=this._tokenStore.getNeedsRefresh();return e?e.map(t=>({range:z.fromPositions(this._textModel.getPositionAt(t.startOffset),this._textModel.getPositionAt(t.endOffset)),startOffset:t.startOffset,endOffset:t.endOffset})):[]}_parseAndTokenizeViewPort(e){let t=e.map(o=>o.toInclusiveRange()).filter(lo);for(let o of t){let n=this._textModel.getOffsetAt(o.getStartPosition()),r=this._textModel.getOffsetAt(o.getEndPosition()),s=this._textModel.getVersionId();if(this._rangeHasTokens(o,1))continue;let l=this._textModel.getValueInRange(o),c=this._forceParseAndTokenizeContent(o,n,r,l,!0);if(!c||this._rangeHasTokens(o,1)||c.length===0)continue;let u=c[c.length-1],p=u.startOffsetInclusive+u.length-c[0].startOffsetInclusive;this._updateTokensInStore(s,[{newTokens:c,oldRangeLength:p}],1),this._onDidChangeTokens.fire({changes:{semanticTokensApplied:!1,ranges:[{fromLineNumber:o.startLineNumber,toLineNumber:o.endLineNumber}]}})}}_guessTokensForLinesContent(e,t){if(t.length===0)return;let o=t.join(this._textModel.getEOL()),n=new z(1,1,e+t.length,t[t.length-1].length+1),r=this._textModel.getOffsetAt({lineNumber:e,column:1}),s=this._forceParseAndTokenizeContent(n,r,r+o.length,o,!1);if(!s)return;let l=new Array(t.length),c=0,u=0,p=0;for(let h=0;h<t.length;h++){let g=[],f=!1;for(let v=c;!f&&v<s.length;v++){let b=s[v],S=b.endOffset-p,y=u-p;if(S<=t[h].length)g.push({endOffset:S,metadata:b.metadata}),c++;else if(y<t[h].length){let w={endOffset:t[h].length,metadata:b.metadata};g.push(w),f=!0}else f=!0;u=b.endOffset}l[h]=this._endOffsetTokensToUint32Array(g),p+=t[h].length+this._textModel.getEOL().length}return l}_forceParseAndTokenizeContent(e,t,o,n,r){let s=Goi(this._textModel,e.startLineNumber).likelyRelevantLines,l=s.join(this._textModel.getEOL()),c=this._tree.createParsedTreeSync(`${l}${n}`);if(!c)return;let u=new z(1,1,e.endLineNumber-e.startLineNumber+1+s.length,e.endColumn),p=this.captureAtRange(u),h=this._tokenizeCapturesWithMetadata(p,l.length,o-t+l.length);if(c.delete(),!!h)return r?this._rangeTokensAsUpdates(t,h.endOffsetsAndMetadata,l.length):h.endOffsetsAndMetadata}_firstTreeUpdate(e){return this._setViewPortTokens(e)}_setViewPortTokens(e){let t=this._visibleLineRanges.get().map(o=>{let n=o.toInclusiveRange();if(!n)return;let r=this._textModel.getOffsetAt(n.getStartPosition()),s=this._textModel.getOffsetAt(n.getEndPosition());return{newRange:n,newRangeEndOffset:s,newRangeStartOffset:r}}).filter(lo);return this._handleTreeUpdate(t,e)}_handleTreeUpdate(e,t){let o=[];for(let s=0;s<e.length;s++)if(e[s].newRange.endLineNumber-e[s].newRange.startLineNumber>1e3){let c=e[s].newRange.endLineNumber,u=e[s].newRange.startLineNumber,p=e[s].newRange.startColumn,h=u+1e3;do{let g=new ye(u,p),f=h===e[s].newRange.endLineNumber?e[s].newRange.endColumn:this._textModel.getLineMaxColumn(h),v=new ye(h,f),b=z.fromPositions(g,v);o.push({range:b,startOffset:this._textModel.getOffsetAt(b.getStartPosition()),endOffset:this._textModel.getOffsetAt(b.getEndPosition())}),u=h+1,p=1,h<c&&h+1e3>c?h=c:h=h+1e3}while(h<=c)}else if(s===0||o[s-1].endOffset<e[s].newRangeStartOffset)o.push({range:e[s].newRange,startOffset:e[s].newRangeStartOffset,endOffset:e[s].newRangeEndOffset});else if(o[s-1].endOffset<e[s].newRangeEndOffset){let c=this._textModel.getPositionAt(o[s-1].endOffset+1),u=new z(c.lineNumber,c.column,e[s].newRange.endLineNumber,e[s].newRange.endColumn);o.push({range:u,startOffset:o[s-1].endOffset+1,endOffset:e[s].newRangeEndOffset})}let r=o.map(s=>this._getCaptures(s.range));return this._updateTreeForRanges(o,t,r).then(()=>{!this._textModel.isDisposed()&&this._tree.treeLastParsedVersion.get()===this._textModel.getVersionId()&&this._refreshNeedsRefresh(t)})}async _updateTreeForRanges(e,t,o){let n;for(let r=0;r<e.length&&!(!this._textModel.isDisposed()&&t!==this._textModel.getVersionId());r++){let s=o[r],l=e[r],c=this.getTokensInRange(l.range,l.startOffset,l.endOffset,s);c?n={newTokens:c}:n={newTokens:[]},this._updateTokensInStore(t,[n],3),this._onDidChangeTokens.fire({changes:{semanticTokensApplied:!1,ranges:[{fromLineNumber:l.range.getStartPosition().lineNumber,toLineNumber:l.range.getEndPosition().lineNumber}]}}),await new Promise(u=>pC(u))}this._onDidCompleteBackgroundTokenization.fire()}_refreshNeedsRefresh(e){let t=this._getNeedsRefresh();if(t.length===0)return;let o=new Array(t.length);for(let n=0;n<t.length;n++){let r=t[n];o[n]={newRange:r.range,newRangeStartOffset:r.startOffset,newRangeEndOffset:r.endOffset}}this._handleTreeUpdate(o,e)}_rangeTokensAsUpdates(e,t,o){let n=[],r=0;for(let s of t){if(s.endOffset<=r||o&&s.endOffset<o)continue;let l;o&&r<o?l={startOffsetInclusive:e+o,length:s.endOffset-o,token:s.metadata}:l={startOffsetInclusive:e+r,length:s.endOffset-r,token:s.metadata},n.push(l),r=s.endOffset}return n}_updateTheme(){let e=this._textModel.getFullModelRange();this._markForRefresh(e),this._parseAndTokenizeViewPort(this._visibleLineRanges.get())}captureAtPosition(e,t){return this.captureAtRangeWithInjections(new z(e,t,e,t+1))}captureAtRangeTree(e){return this.captureAtRangeWithInjections(e)}captureAtRange(e){let t=this._tree.tree.get();return t?this._highlightingQueries.captures(t.rootNode,{startPosition:{row:e.startLineNumber-1,column:e.startColumn-1},endPosition:{row:e.endLineNumber-1,column:e.endColumn-1}}).map(o=>({name:o.name,text:o.node.text,node:{startIndex:o.node.startIndex,endIndex:o.node.endIndex,startPosition:{lineNumber:o.node.startPosition.row+1,column:o.node.startPosition.column+1},endPosition:{lineNumber:o.node.endPosition.row+1,column:o.node.endPosition.column+1}},encodedLanguageId:this._encodedLanguageId})):[]}captureAtRangeWithInjections(e){let t=this.captureAtRange(e);for(let o=0;o<t.length;o++){let n=t[o],r=n.node.startPosition.lineNumber,s=n.node.endPosition.lineNumber,l=n.node.startPosition.column,c=n.node.endPosition.column,u=r>e.startLineNumber&&r<e.endLineNumber?r:e.startLineNumber,p=s>e.startLineNumber&&s<e.endLineNumber?s:e.endLineNumber,h=r===e.startLineNumber?l<e.startColumn?e.startColumn:l:r<e.startLineNumber?e.startColumn:l,g=s===e.endLineNumber?c>e.endColumn?e.endColumn:c:s>e.endLineNumber?e.endColumn:c,f=new z(u,h,p,g),v=this._getInjectionCaptures(n,f);v&&v.length>0&&(t.splice(o+1,0,...v),o+=v.length)}return t}tokenizeEncoded(e){let t=this._tokenizeEncoded(e);if(!t)return;let o=this._rangeTokensAsUpdates(this._textModel.getOffsetAt({lineNumber:e,column:1}),t.result);t.versionId===this._textModel.getVersionId()&&this._updateTokensInStore(t.versionId,[{newTokens:o,oldRangeLength:this._textModel.getLineLength(e)}],3)}tokenizeEncodedInstrumented(e){let t=this._tokenizeEncoded(e);if(t)return{result:this._endOffsetTokensToUint32Array(t.result),captureTime:t.captureTime,metadataTime:t.metadataTime}}_getCaptures(e){return this.captureAtRangeWithInjections(e)}_tokenize(e,t,o){let n=this._getCaptures(e),r=this._tokenizeCapturesWithMetadata(n,t,o);if(r)return{...r,versionId:this._tree.treeLastParsedVersion.get()}}_createTokensFromCaptures(e,t,o){let n=this._tree.tree.get(),r=Dn.create(),s=o-t,l=this._languageIdCodec.encodeLanguageId(this._tree.languageId),c=pBo[this._tree.languageId]||"source";if(e.length===0)return n?(r.stop(),{endOffsets:[{endOffset:s,scopes:[],encodedLanguageId:l}],captureTime:r.elapsed()}):void 0;let u=Array(e.length);u.fill({endOffset:0,scopes:[c],encodedLanguageId:l});let p=0,h=()=>{u.push({endOffset:0,scopes:[c],encodedLanguageId:l})},g=(b,S)=>b.name.includes("punctuation")&&b.text?Array.from(b.text.matchAll(mBo)).map(y=>S+y.index):void 0,f=(b,S,y,w)=>{if(w!==void 0){let k=u[w].scopes,T=u[w].bracket;if((w>0?u[w-1].endOffset:0)!==S){let O;if(T&&T.length>0){O=[];let V=[];for(let H=0;H<T.length;H++){let G=T[H];G<S?O.push(G):G>y&&V.push(G)}O.length===0&&(O=void 0),V.length===0?T=void 0:T=V}u.splice(w,0,{endOffset:S,scopes:[...k],bracket:O,encodedLanguageId:b.encodedLanguageId}),w++,h(),p++}u.splice(w,0,{endOffset:y,scopes:[...k,b.name],bracket:g(b,S),encodedLanguageId:b.encodedLanguageId}),u[p].bracket=T}else u[p]={endOffset:y,scopes:[c,b.name],bracket:g(b,S),encodedLanguageId:b.encodedLanguageId};p++};for(let b=0;b<e.length;b++){let S=e[b],y=S.node.endIndex<o?S.node.endIndex<t?t:S.node.endIndex:o,w=S.node.startIndex<t?t:S.node.startIndex,k=y-t,T,P=y-w;b>0?T=u[p-1].endOffset:T=w-t-1;let O=k-P;if(T>=0&&T<O&&(u[p]={endOffset:O,scopes:[c],encodedLanguageId:this._encodedLanguageId},p++,h()),!(P<0))if(T>=k){let V=p-1,H=u[V].endOffset,G=V>=2?u[V-1].endOffset:0;do{if(G+P===H){if(G===O){u[V].scopes.push(S.name);let $=u[V].bracket;u[V].bracket=$&&$.length>0?$:g(S,O)}}else if(G<=O){f(S,O,k,V);break}V--,G=V>=1?u[V-1].endOffset:0,H=V>=0?u[V].endOffset:0}while(H>O)}else f(S,O,k)}u[p-1].endOffset<s&&s-u[p-1].endOffset>0&&(h(),u[p]={endOffset:s,scopes:u[p].scopes,encodedLanguageId:this._encodedLanguageId},p++);for(let b=0;b<u.length;b++)if(u[b].endOffset===0&&b!==0){u.splice(b,u.length-b);break}let v=r.elapsed();return{endOffsets:u,captureTime:v}}_getInjectionCaptures(e,t){return[]}_tokenizeCapturesWithMetadata(e,t,o){let n=Dn.create(),r=this._createTokensFromCaptures(e,t,o);if(!r)return;let s=r.endOffsets;for(let c=0;c<s.length;c++){let u=s[c];u.metadata=this._treeSitterThemeService.findMetadata(u.scopes,u.encodedLanguageId,!!u.bracket&&u.bracket.length>0,void 0)}let l=n.elapsed();return{endOffsetsAndMetadata:s,captureTime:r.captureTime,metadataTime:l}}_tokenizeEncoded(e){let t=this._textModel.getOffsetAt({lineNumber:e,column:1}),o=this._textModel.getLineCount(),n=e+1<=o?this._textModel.getOffsetAt({lineNumber:e+1,column:1}):this._textModel.getValueLength(),r=n-t,s=this._tokenize(new z(e,1,e,r+1),t,n);if(s)return{result:s.endOffsetsAndMetadata,captureTime:s.captureTime,metadataTime:s.metadataTime,versionId:s.versionId}}_endOffsetTokensToUint32Array(e){let t=new Uint32Array(e.length*2);for(let o=0;o<e.length;o++)t[o*2]=e[o].endOffset,t[o*2+1]=e[o].metadata;return t}};lCe=I([m(4,RIt)],lCe);var pBo={css:"source.css",typescript:"source.ts",ini:"source.ini",regex:"source.regex"},mBo=/[\{\}\[\]\<\>\(\)]/g;var tY=le("treeSitterLibraryService");var pz=class extends oCe{constructor(e,t,o,n,r,s){super(t,o);this._languageIdObs=e;this._treeSitterLibraryService=r;this._instantiationService=s;this._backgroundTokenizationState=1;this._onDidChangeBackgroundTokenizationState=this._register(new E);this.onDidChangeBackgroundTokenizationState=this._onDidChangeBackgroundTokenizationState.event;let l=new bd(this._treeSitterLibraryService.getParserClass()),c=ke(this,u=>l.promiseResult?.read(u)?.getDataOrThrow());this._tree=ke(this,u=>{let p=c.read(u);if(!p)return;let h=this._languageIdObs.read(u),g=this._treeSitterLibraryService.getLanguage(h,!1,u);if(!g)return;let f=new p;if(u.store.add(Z(()=>{f.delete()})),f.setLanguage(g),this._treeSitterLibraryService.getInjectionQueries(h,u)!==void 0)return u.store.add(this._instantiationService.createInstance(rCe,h,void 0,f,p,this._textModel))}),this._tokenizationImpl=ke(this,u=>{let p=this._tree.read(u);if(!p)return;let h=this._treeSitterLibraryService.getHighlightingQueries(p.languageId,u);if(h)return u.store.add(this._instantiationService.createInstance(lCe,p,h,this._languageIdCodec,n))}),this._register(be(u=>{let p=this._tokenizationImpl.read(u);p&&(u.store.add(p.onDidChangeTokens(h=>{this._onDidChangeTokens.fire(h.changes)})),u.store.add(p.onDidChangeBackgroundTokenization(h=>{this._backgroundTokenizationState=2,this._onDidChangeBackgroundTokenizationState.fire()})))}))}get tree(){return this._tree}get tokenizationImpl(){return this._tokenizationImpl}getLineTokens(e){let t=this._tokenizationImpl.get();if(!t){let o=this._textModel.getLineContent(e);return Zc.createEmpty(o,this._languageIdCodec)}return t.getLineTokens(e)}todo_resetTokenization(e=!0){e&&this._onDidChangeTokens.fire({semanticTokensApplied:!1,ranges:[{fromLineNumber:1,toLineNumber:this._textModel.getLineCount()}]})}handleDidChangeAttached(){}handleDidChangeContent(e){e.isFlush?this.todo_resetTokenization(!1):this._tokenizationImpl.get()?.handleContentChanged(e),this._tree.get()?.handleContentChange(e)}forceTokenization(e){let t=this._tokenizationImpl.get();t&&(t.hasAccurateTokensForLine(e)||t.tokenizeEncoded(e))}hasAccurateTokensForLine(e){let t=this._tokenizationImpl.get();return t?t.hasAccurateTokensForLine(e):!1}isCheapToTokenize(e){return!0}getTokenTypeIfInsertingCharacter(e,t,o){return 0}tokenizeLinesAt(e,t){let o=this._tokenizationImpl.get();return o?o.tokenizeLinesAt(e,t):null}get hasTokens(){let e=this._tokenizationImpl.get();return e?e.hasTokens():!1}};pz=I([m(4,tY),m(5,F)],pz);var MIt=class a{constructor(i){this._pieces=[],this._isComplete=!1,this._languageIdCodec=i}flush(){this._pieces=[],this._isComplete=!1}isEmpty(){return this._pieces.length===0}set(i,e,t=void 0){if(this._pieces=i||[],this._isComplete=e,t)for(let o of this._pieces)o.reportIfInvalid(t)}setPartial(i,e){let t=i;if(e.length>0){let n=e[0].getRange(),r=e[e.length-1].getRange();if(!n||!r)return i;t=i.plusRange(n).plusRange(r)}let o=null;for(let n=0,r=this._pieces.length;n<r;n++){let s=this._pieces[n];if(s.endLineNumber<t.startLineNumber)continue;if(s.startLineNumber>t.endLineNumber){o=o||{index:n};break}if(s.removeTokens(t),s.isEmpty()){this._pieces.splice(n,1),n--,r--;continue}if(s.endLineNumber<t.startLineNumber)continue;if(s.startLineNumber>t.endLineNumber){o=o||{index:n};continue}let[l,c]=s.split(t);if(l.isEmpty()){o=o||{index:n};continue}c.isEmpty()||(this._pieces.splice(n,1,l,c),n++,r++,o=o||{index:n})}return o=o||{index:this._pieces.length},e.length>0&&(this._pieces=i1(this._pieces,o.index,e)),t}isComplete(){return this._isComplete}addSparseTokens(i,e){if(e.getTextLength()===0)return e;let t=this._pieces;if(t.length===0)return e;let o=a._findFirstPieceWithLine(t,i),n=t[o].getLineTokens(i);if(!n)return e;let r=e.getCount(),s=n.getCount(),l=0,c=[],u=0,p=0,h=(g,f)=>{g!==p&&(p=g,c[u++]=g,c[u++]=f)};for(let g=0;g<s;g++){let f=Math.min(n.getStartCharacter(g),e.getTextLength()),v=Math.min(n.getEndCharacter(g),e.getTextLength()),b=n.getMetadata(g),S=((b&1?2048:0)|(b&2?4096:0)|(b&4?8192:0)|(b&8?16384:0)|(b&16?16744448:0)|(b&32?4278190080:0))>>>0,y=~S>>>0;for(;l<r&&e.getEndOffset(l)<=f;)h(e.getEndOffset(l),e.getMetadata(l)),l++;for(l<r&&e.getStartOffset(l)<f&&h(f,e.getMetadata(l));l<r&&e.getEndOffset(l)<v;)h(e.getEndOffset(l),e.getMetadata(l)&y|b&S),l++;if(l<r)h(v,e.getMetadata(l)&y|b&S),e.getEndOffset(l)===v&&l++;else{let w=Math.min(Math.max(0,l-1),r-1);h(v,e.getMetadata(w)&y|b&S)}}for(;l<r;)h(e.getEndOffset(l),e.getMetadata(l)),l++;return new Zc(new Uint32Array(c),e.getLineContent(),this._languageIdCodec)}static _findFirstPieceWithLine(i,e){let t=0,o=i.length-1;for(;t<o;){let n=t+Math.floor((o-t)/2);if(i[n].endLineNumber<e)t=n+1;else if(i[n].startLineNumber>e)o=n-1;else{for(;n>t&&i[n-1].startLineNumber<=e&&e<=i[n-1].endLineNumber;)n--;return n}}return t}acceptEdit(i,e,t,o,n){for(let r=0;r<this._pieces.length;r++){let s=this._pieces[r];s.acceptEdit(i,e,t,o,n),s.isEmpty()&&(this._pieces.splice(r,1),r--)}}};var W5e=class a{constructor(i){this._lineTokens=[],this._len=0,this._languageIdCodec=i}flush(){this._lineTokens=[],this._len=0}get hasTokens(){return this._lineTokens.length>0}getTokens(i,e,t){let o=null;if(e<this._len&&(o=this._lineTokens[e]),o!==null&&o!==cz)return new Zc(dz(o),t,this._languageIdCodec);let n=new Uint32Array(2);return n[0]=t.length,n[1]=B8i(this._languageIdCodec.encodeLanguageId(i)),new Zc(n,t,this._languageIdCodec)}static _massageTokens(i,e,t){let o=t?dz(t):null;if(e===0){let n=!1;if(o&&o.length>1&&(n=bp.getLanguageId(o[1])!==i),!n)return cz}if(!o||o.length===0){let n=new Uint32Array(2);return n[0]=e,n[1]=B8i(i),n.buffer}return o[o.length-2]=e,o.byteOffset===0&&o.byteLength===o.buffer.byteLength?o.buffer:o}_ensureLine(i){for(;i>=this._len;)this._lineTokens[this._len]=null,this._len++}_deleteLines(i,e){e!==0&&(i+e>this._len&&(e=this._len-i),this._lineTokens.splice(i,e),this._len-=e)}_insertLines(i,e){if(e===0)return;let t=[];for(let o=0;o<e;o++)t[o]=null;this._lineTokens=i1(this._lineTokens,i,t),this._len+=e}setTokens(i,e,t,o,n){let r=a._massageTokens(this._languageIdCodec.encodeLanguageId(i),t,o);this._ensureLine(e);let s=this._lineTokens[e];return this._lineTokens[e]=r,n?!a._equals(s,r):!1}static _equals(i,e){if(!i||!e)return!i&&!e;let t=dz(i),o=dz(e);if(t.length!==o.length)return!1;for(let n=0,r=t.length;n<r;n++)if(t[n]!==o[n])return!1;return!0}acceptEdit(i,e,t){this._acceptDeleteRange(i),this._acceptInsertText(new ye(i.startLineNumber,i.startColumn),e,t)}_acceptDeleteRange(i){let e=i.startLineNumber-1;if(e>=this._len)return;if(i.startLineNumber===i.endLineNumber){if(i.startColumn===i.endColumn)return;this._lineTokens[e]=ty.delete(this._lineTokens[e],i.startColumn-1,i.endColumn-1);return}this._lineTokens[e]=ty.deleteEnding(this._lineTokens[e],i.startColumn-1);let t=i.endLineNumber-1,o=null;t<this._len&&(o=ty.deleteBeginning(this._lineTokens[t],i.endColumn-1)),this._lineTokens[e]=ty.append(this._lineTokens[e],o),this._deleteLines(i.startLineNumber,i.endLineNumber-i.startLineNumber)}_acceptInsertText(i,e,t){if(e===0&&t===0)return;let o=i.lineNumber-1;if(!(o>=this._len)){if(e===0){this._lineTokens[o]=ty.insert(this._lineTokens[o],i.column-1,t);return}this._lineTokens[o]=ty.deleteEnding(this._lineTokens[o],i.column-1),this._lineTokens[o]=ty.insert(this._lineTokens[o],i.column-1,t),this._insertLines(i.lineNumber,e)}}setMultilineTokens(i,e){if(i.length===0)return{changes:[]};let t=[];for(let o=0,n=i.length;o<n;o++){let r=i[o],s=0,l=0,c=!1;for(let u=r.startLineNumber;u<=r.endLineNumber;u++)c?(this.setTokens(e.getLanguageId(),u-1,e.getLineLength(u),r.getLineTokens(u),!1),l=u):this.setTokens(e.getLanguageId(),u-1,e.getLineLength(u),r.getLineTokens(u),!0)&&(c=!0,s=u,l=u);c&&t.push({fromLineNumber:s,toLineNumber:l})}return{changes:t}}};function B8i(a){return(a<<0|0|0|32768|2<<24|1024)>>>0}var PIt=class extends oCe{constructor(e,t,o,n){super(e,t);this.getLanguageId=o;this._tokenizer=null;this._backgroundTokenizationState=1;this._onDidChangeBackgroundTokenizationState=this._register(new E);this.onDidChangeBackgroundTokenizationState=this._onDidChangeBackgroundTokenizationState.event;this._defaultBackgroundTokenizer=null;this._backgroundTokenizer=this._register(new me);this._tokens=new W5e(this._languageIdCodec);this._debugBackgroundTokenizer=this._register(new me);this._attachedViewStates=this._register(new Vt);this._register(ic.onDidChange(r=>{let s=this.getLanguageId();r.changedLanguages.indexOf(s)!==-1&&this.todo_resetTokenization()})),this.todo_resetTokenization(),this._register(n.onDidChangeVisibleRanges(({view:r,state:s})=>{if(s){let l=this._attachedViewStates.get(r);l||(l=new kIt(()=>this.refreshRanges(l.lineRanges)),this._attachedViewStates.set(r,l)),l.handleStateChange(s)}else this._attachedViewStates.deleteAndDispose(r)}))}todo_resetTokenization(e=!0){this._tokens.flush(),this._debugBackgroundTokens?.flush(),this._debugBackgroundStates&&(this._debugBackgroundStates=new aCe(this._textModel.getLineCount())),e&&this._onDidChangeTokens.fire({semanticTokensApplied:!1,ranges:[{fromLineNumber:1,toLineNumber:this._textModel.getLineCount()}]});let t=()=>{if(this._textModel.isTooLargeForTokenization())return[null,null];let r=ic.get(this.getLanguageId());if(!r)return[null,null];let s;try{s=r.getInitialState()}catch(l){return mt(l),[null,null]}return[r,s]},[o,n]=t();if(o&&n?this._tokenizer=new _It(this._textModel.getLineCount(),o,this._textModel,this._languageIdCodec):this._tokenizer=null,this._backgroundTokenizer.clear(),this._defaultBackgroundTokenizer=null,this._tokenizer){let r={setTokens:s=>{this.setTokens(s)},setFontInfo:s=>{this.setFontInfo(s)},backgroundTokenizationFinished:()=>{if(this._backgroundTokenizationState===2)return;let s=2;this._backgroundTokenizationState=s,this._onDidChangeBackgroundTokenizationState.fire()},setEndState:(s,l)=>{if(!this._tokenizer)return;let c=this._tokenizer.store.getFirstInvalidEndStateLineNumber();c!==null&&s>=c&&this._tokenizer?.store.setEndState(s,l)}};o&&o.createBackgroundTokenizer&&!o.backgroundTokenizerShouldOnlyVerifyTokens&&(this._backgroundTokenizer.value=o.createBackgroundTokenizer(this._textModel,r)),!this._backgroundTokenizer.value&&!this._textModel.isTooLargeForTokenization()&&(this._backgroundTokenizer.value=this._defaultBackgroundTokenizer=new DIt(this._tokenizer,r),this._defaultBackgroundTokenizer.handleChanges()),o?.backgroundTokenizerShouldOnlyVerifyTokens&&o.createBackgroundTokenizer?(this._debugBackgroundTokens=new W5e(this._languageIdCodec),this._debugBackgroundStates=new aCe(this._textModel.getLineCount()),this._debugBackgroundTokenizer.clear(),this._debugBackgroundTokenizer.value=o.createBackgroundTokenizer(this._textModel,{setTokens:s=>{this._debugBackgroundTokens?.setMultilineTokens(s,this._textModel)},setFontInfo:s=>{this.setFontInfo(s)},backgroundTokenizationFinished(){},setEndState:(s,l)=>{this._debugBackgroundStates?.setEndState(s,l)}})):(this._debugBackgroundTokens=void 0,this._debugBackgroundStates=void 0,this._debugBackgroundTokenizer.value=void 0)}this.refreshAllVisibleLineTokens()}handleDidChangeAttached(){this._defaultBackgroundTokenizer?.handleChanges()}handleDidChangeContent(e){if(e.isFlush)this.todo_resetTokenization(!1);else if(!e.isEolChange){for(let t of e.changes){let[o,n]=ZS(t.text);this._tokens.acceptEdit(t.range,o,n),this._debugBackgroundTokens?.acceptEdit(t.range,o,n)}this._debugBackgroundStates?.acceptChanges(e.changes),this._tokenizer&&this._tokenizer.store.acceptChanges(e.changes),this._defaultBackgroundTokenizer?.handleChanges()}}setTokens(e){let{changes:t}=this._tokens.setMultilineTokens(e,this._textModel);return t.length>0&&this._onDidChangeTokens.fire({semanticTokensApplied:!1,ranges:t}),{changes:t}}setFontInfo(e){this._onDidChangeFontTokens.fire({changes:e})}refreshAllVisibleLineTokens(){let e=uo.joinMany([...this._attachedViewStates].map(([t,o])=>o.lineRanges));this.refreshRanges(e)}refreshRanges(e){for(let t of e)this.refreshRange(t.startLineNumber,t.endLineNumberExclusive-1)}refreshRange(e,t){if(!this._tokenizer)return;e=Math.max(1,Math.min(this._textModel.getLineCount(),e)),t=Math.min(this._textModel.getLineCount(),t);let o=new uz,{heuristicTokens:n}=this._tokenizer.tokenizeHeuristically(o,e,t),r=this.setTokens(o.finalize());if(n)for(let s of r.changes)this._backgroundTokenizer.value?.requestTokens(s.fromLineNumber,s.toLineNumber+1);this._defaultBackgroundTokenizer?.checkFinished()}forceTokenization(e){let t=new uz;this._tokenizer?.updateTokensUntilLine(t,e),this.setTokens(t.finalize()),this._defaultBackgroundTokenizer?.checkFinished()}hasAccurateTokensForLine(e){return this._tokenizer?this._tokenizer.hasAccurateTokensForLine(e):!0}isCheapToTokenize(e){return this._tokenizer?this._tokenizer.isCheapToTokenize(e):!0}getLineTokens(e){let t=this._textModel.getLineContent(e),o=this._tokens.getTokens(this._textModel.getLanguageId(),e-1,t);if(this._debugBackgroundTokens&&this._debugBackgroundStates&&this._tokenizer&&this._debugBackgroundStates.getFirstInvalidEndStateLineNumberOrMax()>e&&this._tokenizer.store.getFirstInvalidEndStateLineNumberOrMax()>e){let n=this._debugBackgroundTokens.getTokens(this._textModel.getLanguageId(),e-1,t);!o.equals(n)&&this._debugBackgroundTokenizer.value?.reportMismatchingTokens&&this._debugBackgroundTokenizer.value.reportMismatchingTokens(e)}return o}getTokenTypeIfInsertingCharacter(e,t,o){if(!this._tokenizer)return 0;let n=this._textModel.validatePosition(new ye(e,t));return this.forceTokenization(n.lineNumber),this._tokenizer.getTokenTypeIfInsertingCharacter(n,o)}tokenizeLinesAt(e,t){return this._tokenizer?(this.forceTokenization(e),this._tokenizer.tokenizeLinesAt(e,t)):null}get hasTokens(){return this._tokens.hasTokens}};var Wj=class extends xwe{constructor(e,t,o,n,r,s,l,c){super();this._textModel=e;this._bracketPairsTextModelPart=t;this._languageId=o;this._attachedViews=n;this._languageService=r;this._languageConfigurationService=s;this._instantiationService=l;this._treeSitterLibraryService=c;this._onDidChangeFontTokens=this._register(new E);this.onDidChangeFontTokens=this._onDidChangeFontTokens.event;this._languageIdObs=Me(this,this._languageId),this._useTreeSitter=ke(this,p=>{let h=this._languageIdObs.read(p);return this._treeSitterLibraryService.supportsLanguage(h,p)}),this.tokens=ke(this,p=>{let h;return this._useTreeSitter.read(p)?h=p.store.add(this._instantiationService.createInstance(pz,this._languageIdObs,this._languageService.languageIdCodec,this._textModel,this._attachedViews.visibleLineRanges)):h=p.store.add(new PIt(this._languageService.languageIdCodec,this._textModel,()=>this._languageId,this._attachedViews)),p.store.add(h.onDidChangeTokens(g=>{this._emitModelTokensChangedEvent(g)})),p.store.add(h.onDidChangeFontTokens(g=>{this._textModel._isDisposing()||this._onDidChangeFontTokens.fire(g)})),p.store.add(h.onDidChangeBackgroundTokenizationState(g=>{this._bracketPairsTextModelPart.handleDidChangeBackgroundTokenizationState()})),h});let u=!1;this.tokens.recomputeInitiallyAndOnChange(this._store,p=>{u&&p.todo_resetTokenization(),u=!0}),this._semanticTokens=new MIt(this._languageService.languageIdCodec),this._onDidChangeLanguage=this._register(new E),this.onDidChangeLanguage=this._onDidChangeLanguage.event,this._onDidChangeLanguageConfiguration=this._register(new E),this.onDidChangeLanguageConfiguration=this._onDidChangeLanguageConfiguration.event,this._onDidChangeTokens=this._register(new E),this.onDidChangeTokens=this._onDidChangeTokens.event,this._onDidChangeFontTokens=this._register(new E),this.onDidChangeFontTokens=this._onDidChangeFontTokens.event}_hasListeners(){return this._onDidChangeLanguage.hasListeners()||this._onDidChangeLanguageConfiguration.hasListeners()||this._onDidChangeTokens.hasListeners()}handleLanguageConfigurationServiceChange(e){e.affects(this._languageId)&&this._onDidChangeLanguageConfiguration.fire({})}handleDidChangeContent(e){if(e.isFlush)this._semanticTokens.flush();else if(!e.isEolChange)for(let t of e.changes){let[o,n,r]=ZS(t.text);this._semanticTokens.acceptEdit(t.range,o,n,r,t.text.length>0?t.text.charCodeAt(0):0)}this.tokens.get().handleDidChangeContent(e)}handleDidChangeAttached(){this.tokens.get().handleDidChangeAttached()}getLineTokens(e){this.validateLineNumber(e);let t=this.tokens.get().getLineTokens(e);return this._semanticTokens.addSparseTokens(e,t)}_emitModelTokensChangedEvent(e){this._textModel._isDisposing()||(this._bracketPairsTextModelPart.handleDidChangeTokens(e),this._onDidChangeTokens.fire(e))}validateLineNumber(e){if(e<1||e>this._textModel.getLineCount())throw new li("Illegal value for lineNumber")}get hasTokens(){return this.tokens.get().hasTokens}resetTokenization(){this.tokens.get().todo_resetTokenization()}get backgroundTokenizationState(){return this.tokens.get().backgroundTokenizationState}forceTokenization(e){this.validateLineNumber(e),this.tokens.get().forceTokenization(e)}hasAccurateTokensForLine(e){return this.validateLineNumber(e),this.tokens.get().hasAccurateTokensForLine(e)}isCheapToTokenize(e){return this.validateLineNumber(e),this.tokens.get().isCheapToTokenize(e)}tokenizeIfCheap(e){this.validateLineNumber(e),this.tokens.get().tokenizeIfCheap(e)}getTokenTypeIfInsertingCharacter(e,t,o){return this.tokens.get().getTokenTypeIfInsertingCharacter(e,t,o)}tokenizeLinesAt(e,t){return this.tokens.get().tokenizeLinesAt(e,t)}setSemanticTokens(e,t){this._semanticTokens.set(e,t,this._textModel),this._emitModelTokensChangedEvent({semanticTokensApplied:e!==null,ranges:[{fromLineNumber:1,toLineNumber:this._textModel.getLineCount()}]})}hasCompleteSemanticTokens(){return this._semanticTokens.isComplete()}hasSomeSemanticTokens(){return!this._semanticTokens.isEmpty()}setPartialSemanticTokens(e,t){if(this.hasCompleteSemanticTokens())return;let o=this._textModel.validateRange(this._semanticTokens.setPartial(e,t));this._emitModelTokensChangedEvent({semanticTokensApplied:!0,ranges:[{fromLineNumber:o.startLineNumber,toLineNumber:o.endLineNumber}]})}getWordAtPosition(e){this.assertNotDisposed();let t=this._textModel.validatePosition(e),o=this._textModel.getLineContent(t.lineNumber),n=this.getLineTokens(t.lineNumber),r=n.findTokenIndexAtOffset(t.column-1),[s,l]=Wj._findLanguageBoundaries(n,r),c=Wx(t.column,this.getLanguageConfiguration(n.getLanguageId(r)).getWordDefinition(),o.substring(s,l),s);if(c&&c.startColumn<=e.column&&e.column<=c.endColumn)return c;if(r>0&&s===t.column-1){let[u,p]=Wj._findLanguageBoundaries(n,r-1),h=Wx(t.column,this.getLanguageConfiguration(n.getLanguageId(r-1)).getWordDefinition(),o.substring(u,p),u);if(h&&h.startColumn<=e.column&&e.column<=h.endColumn)return h}return null}getLanguageConfiguration(e){return this._languageConfigurationService.getLanguageConfiguration(e)}static _findLanguageBoundaries(e,t){let o=e.getLanguageId(t),n=0;for(let s=t;s>=0&&e.getLanguageId(s)===o;s--)n=e.getStartOffset(s);let r=e.getLineContent().length;for(let s=t,l=e.getCount();s<l&&e.getLanguageId(s)===o;s++)r=e.getEndOffset(s);return[n,r]}getWordUntilPosition(e){let t=this.getWordAtPosition(e);return t?{word:t.word.substr(0,e.column-t.startColumn),startColumn:t.startColumn,endColumn:e.column}:{word:"",startColumn:e.column,endColumn:e.column}}getLanguageId(){return this._languageId}getLanguageIdAtPosition(e,t){let o=this._textModel.validatePosition(new ye(e,t)),n=this.getLineTokens(o.lineNumber);return n.getLanguageId(n.findTokenIndexAtOffset(o.column-1))}setLanguageId(e,t="api"){if(this._languageId===e)return;let o={oldLanguage:this._languageId,newLanguage:e,source:t};this._languageId=e,this._languageIdObs.set(e,void 0),this._bracketPairsTextModelPart.handleDidChangeLanguage(o),this._onDidChangeLanguage.fire(o),this._onDidChangeLanguageConfiguration.fire({})}};Wj=I([m(4,_t),m(5,Rs),m(6,F),m(7,tY)],Wj);function Vj(a){let i=new Aj;return i.acceptChunk(a),i.finish()}function iY(a){return new Promise((i,e)=>{let t=new Aj,o=!1;fV(a,{onData:n=>{t.acceptChunk(typeof n=="string"?n:n.toString())},onError:n=>{o||(o=!0,e(n))},onEnd:()=>{o||(o=!0,i(t.finish()))}})})}function Yx(a){let i=new Aj,e;for(;typeof(e=a.read())=="string";)i.acceptChunk(e);return i.finish()}function hz(a,i){let e;return typeof a=="string"?e=Vj(a):O$i(a)?e=Yx(a):e=a,e.create(i)}var AIt=0,hBo=999,gBo=1e4,fBo=300,$oi=class{constructor(i){this._source=i,this._eos=!1}read(){if(this._eos)return null;let i=[],e=0,t=0;do{let o=this._source.read();if(o===null)return this._eos=!0,e===0?null:i.join("");if(o.length>0&&(i[e++]=o,t+=o.length),t>=64*1024)return i.join("")}while(!0)}},V5e=()=>{throw new Error("Invalid change accessor")};var ip=class extends x{constructor(e,t,o,n=null,r,s,l,c){super();this._undoRedoService=r;this._languageService=s;this._languageConfigurationService=l;this.instantiationService=c;this._onWillDispose=this._register(new E);this.onWillDispose=this._onWillDispose.event;this._onDidChangeDecorations=this._register(new Xoi((e,t,o)=>this.handleBeforeFireDecorationsChangedEvent(e,t,o)));this.onDidChangeDecorations=this._onDidChangeDecorations.event;this._onDidChangeOptions=this._register(new E);this._onDidChangeAttached=this._register(new E);this._onDidChangeLineHeight=this._register(new E);this._onDidChangeFont=this._register(new E);this._eventEmitter=this._register(new Joi);this._languageSelectionListener=this._register(new me);this._deltaDecorationCallCnt=0;this._attachedViews=this._register(new xIt);this._viewModels=new Set;AIt++,this.id="$model"+AIt,this.isForSimpleWidget=o.isForSimpleWidget,typeof n>"u"||n===null?this._associatedResource=A.parse("inmemory://model/"+AIt):this._associatedResource=n,this._attachedEditorCount=0;let{textBuffer:u,disposable:p}=hz(e,o.defaultEOL);this._buffer=u,this._bufferDisposable=p;let h=this._buffer.getLineCount(),g=this._buffer.getValueLengthInRange(new z(1,1,h,this._buffer.getLineLength(h)+1),0);o.largeFileOptimizations?(this._isTooLargeForTokenization=g>ip.LARGE_FILE_SIZE_THRESHOLD||h>ip.LARGE_FILE_LINE_COUNT_THRESHOLD,this._isTooLargeForHeapOperation=g>ip.LARGE_FILE_HEAP_OPERATION_THRESHOLD):(this._isTooLargeForTokenization=!1,this._isTooLargeForHeapOperation=!1),this._options=ip.resolveOptions(this._buffer,o);let f=typeof t=="string"?t:t.languageId;typeof t!="string"&&(this._languageSelectionListener.value=t.onDidChange(()=>this._setLanguage(t.languageId))),this._bracketPairs=this._register(new vIt(this,this._languageConfigurationService)),this._guidesTextModelPart=this._register(new lSt(this,this._languageConfigurationService)),this._decorationProvider=this._register(new bIt(this)),this._tokenizationTextModelPart=this.instantiationService.createInstance(Wj,this,this._bracketPairs,f,this._attachedViews),this._fontTokenDecorationsProvider=this._register(new EIt(this,this._tokenizationTextModelPart)),this._isTooLargeForSyncing=g>ip._MODEL_SYNC_LIMIT,this._versionId=1,this._alternativeVersionId=1,this._initialUndoRedoSnapshot=null,this._isDisposed=!1,this.__isDisposing=!1,this._instanceId=mIe(AIt),this._lastDecorationId=0,this._decorations=Object.create(null),this._decorationsTree=new OIt,this._commandManager=new yIt(this,this._undoRedoService),this._isUndoing=!1,this._isRedoing=!1,this._trimAutoWhitespaceLines=null,this._register(this._decorationProvider.onDidChange(()=>{this._onDidChangeDecorations.beginDeferredEmit(),this._onDidChangeDecorations.fire(),this._onDidChangeDecorations.endDeferredEmit()})),this._register(this._fontTokenDecorationsProvider.onDidChangeLineHeight(v=>{this._onDidChangeDecorations.beginDeferredEmit(),this._onDidChangeDecorations.fire(),this._fireOnDidChangeLineHeight(v),this._onDidChangeDecorations.endDeferredEmit()})),this._register(this._fontTokenDecorationsProvider.onDidChangeFont(v=>{this._onDidChangeDecorations.beginDeferredEmit(),this._onDidChangeDecorations.fire(),this._fireOnDidChangeFont(v),this._onDidChangeDecorations.endDeferredEmit()})),this._languageService.requestRichLanguageFeatures(f),this._register(this._languageConfigurationService.onDidChange(v=>{this._bracketPairs.handleLanguageConfigurationServiceChange(v),this._tokenizationTextModelPart.handleLanguageConfigurationServiceChange(v)}))}static{this._MODEL_SYNC_LIMIT=50*1024*1024}static{this.LARGE_FILE_SIZE_THRESHOLD=20*1024*1024}static{this.LARGE_FILE_LINE_COUNT_THRESHOLD=300*1e3}static{this.LARGE_FILE_HEAP_OPERATION_THRESHOLD=256*1024*1024}static{this.DEFAULT_CREATION_OPTIONS={isForSimpleWidget:!1,tabSize:fv.tabSize,indentSize:fv.indentSize,insertSpaces:fv.insertSpaces,detectIndentation:!1,defaultEOL:1,trimAutoWhitespace:fv.trimAutoWhitespace,largeFileOptimizations:fv.largeFileOptimizations,bracketPairColorizationOptions:fv.bracketPairColorizationOptions}}static resolveOptions(e,t){if(t.detectIndentation){let o=Eoi(e,t.tabSize,t.insertSpaces);return new $Ie({tabSize:o.tabSize,indentSize:"tabSize",insertSpaces:o.insertSpaces,trimAutoWhitespace:t.trimAutoWhitespace,defaultEOL:t.defaultEOL,bracketPairColorizationOptions:t.bracketPairColorizationOptions})}return new $Ie(t)}get onDidChangeLanguage(){return this._tokenizationTextModelPart.onDidChangeLanguage}get onDidChangeLanguageConfiguration(){return this._tokenizationTextModelPart.onDidChangeLanguageConfiguration}get onDidChangeTokens(){return this._tokenizationTextModelPart.onDidChangeTokens}get onDidChangeOptions(){return this._onDidChangeOptions.event}get onDidChangeAttached(){return this._onDidChangeAttached.event}get onDidChangeLineHeight(){return this._onDidChangeLineHeight.event}get onDidChangeFont(){return this._onDidChangeFont.event}onDidChangeContent(e){return this._eventEmitter.event(t=>e(t.contentChangedEvent))}_isDisposing(){return this.__isDisposing}get tokenization(){return this._tokenizationTextModelPart}get bracketPairs(){return this._bracketPairs}get guides(){return this._guidesTextModelPart}dispose(){this.__isDisposing=!0,this._onWillDispose.fire(),this._tokenizationTextModelPart.dispose(),this._isDisposed=!0,super.dispose(),this._bufferDisposable.dispose(),this.__isDisposing=!1;let e=new Z7([],"",`
`,!1,!1,!0,!0);e.dispose(),this._buffer=e,this._bufferDisposable=x.None}_hasListeners(){return this._onWillDispose.hasListeners()||this._onDidChangeDecorations.hasListeners()||this._tokenizationTextModelPart._hasListeners()||this._onDidChangeOptions.hasListeners()||this._onDidChangeAttached.hasListeners()||this._onDidChangeLineHeight.hasListeners()||this._onDidChangeFont.hasListeners()||this._eventEmitter.hasListeners()}_assertNotDisposed(){if(this._isDisposed)throw new li("Model is disposed!")}registerViewModel(e){this._viewModels.add(e)}unregisterViewModel(e){this._viewModels.delete(e)}equalsTextBuffer(e){return this._assertNotDisposed(),this._buffer.equals(e)}getTextBuffer(){return this._assertNotDisposed(),this._buffer}_emitContentChangedEvent(e,t,o=null){if(this.__isDisposing)return;this._tokenizationTextModelPart.handleDidChangeContent(t),this._bracketPairs.handleDidChangeContent(t),this._fontTokenDecorationsProvider.handleDidChangeContent(t);let n=new q7(e,t);o&&(n.rawContentChangedEvent.resultingSelection=o),this._onDidChangeContentOrInjectedText(n),this._eventEmitter.fire(n)}setValue(e,t=Wc.setValue()){if(this._assertNotDisposed(),e==null)throw Yr();let{textBuffer:o,disposable:n}=hz(e,this._options.defaultEOL);this._setValueFromTextBuffer(o,n,t)}_createContentChanged2(e,t,o,n,r,s,l,c,u,p){return{changes:[{range:e,rangeOffset:t,rangeLength:o,text:r}],eol:this._buffer.getEOL(),isEolChange:u,versionId:this.getVersionId(),isUndoing:s,isRedoing:l,isFlush:c,detailedReasons:[p],detailedReasonsChangeLengths:[1]}}_setValueFromTextBuffer(e,t,o){this._assertNotDisposed();let n=this.getFullModelRange(),r=this.getValueLengthInRange(n),s=this.getLineCount(),l=this.getLineMaxColumn(s);this._buffer=e,this._bufferDisposable.dispose(),this._bufferDisposable=t,this._increaseVersionId(),this._decorations=Object.create(null),this._decorationsTree=new OIt,this._commandManager.clear(),this._trimAutoWhitespaceLines=null,this._emitContentChangedEvent(new Ple([new JSt],this._versionId,!1,!1),this._createContentChanged2(new z(1,1,s,l),0,r,new ye(s,l),this.getValue(),!1,!1,!0,!1,o))}setEOL(e){this._assertNotDisposed();let t=e===1?`\r
`:`
`;if(this._buffer.getEOL()===t)return;let o=this.getFullModelRange(),n=this.getValueLengthInRange(o),r=this.getLineCount(),s=this.getLineMaxColumn(r);this._onBeforeEOLChange(),this._buffer.setEOL(t),this._increaseVersionId(),this._onAfterEOLChange(),this._emitContentChangedEvent(new Ple([new oIt],this._versionId,!1,!1),this._createContentChanged2(new z(1,1,r,s),0,n,new ye(r,s),this.getValue(),!1,!1,!1,!0,Wc.eolChange()))}_onBeforeEOLChange(){this._decorationsTree.ensureAllNodesHaveRanges(this)}_onAfterEOLChange(){let e=this.getVersionId(),t=this._decorationsTree.collectNodesPostOrder();for(let o=0,n=t.length;o<n;o++){let r=t[o],s=r.range,l=r.cachedAbsoluteStart-r.start,c=this._buffer.getOffsetAt(s.startLineNumber,s.startColumn),u=this._buffer.getOffsetAt(s.endLineNumber,s.endColumn);r.cachedAbsoluteStart=c,r.cachedAbsoluteEnd=u,r.cachedVersionId=e,r.start=c-l,r.end=u-l,Dj(r)}}onBeforeAttached(){return this._attachedEditorCount++,this._attachedEditorCount===1&&(this._tokenizationTextModelPart.handleDidChangeAttached(),this._onDidChangeAttached.fire(void 0)),this._attachedViews.attachView()}onBeforeDetached(e){this._attachedEditorCount--,this._attachedEditorCount===0&&(this._tokenizationTextModelPart.handleDidChangeAttached(),this._onDidChangeAttached.fire(void 0)),this._attachedViews.detachView(e)}isAttachedToEditor(){return this._attachedEditorCount>0}getAttachedEditorCount(){return this._attachedEditorCount}isTooLargeForSyncing(){return this._isTooLargeForSyncing}isTooLargeForTokenization(){return this._isTooLargeForTokenization}isTooLargeForHeapOperation(){return this._isTooLargeForHeapOperation}isDisposed(){return this._isDisposed}isDominatedByLongLines(){if(this._assertNotDisposed(),this.isTooLargeForTokenization())return!1;let e=0,t=0,o=this._buffer.getLineCount();for(let n=1;n<=o;n++){let r=this._buffer.getLineLength(n);r>=gBo?t+=r:e+=r}return t>e}get uri(){return this._associatedResource}getOptions(){return this._assertNotDisposed(),this._options}getFormattingOptions(){return{tabSize:this._options.indentSize,insertSpaces:this._options.insertSpaces}}updateOptions(e){this._assertNotDisposed();let t=typeof e.tabSize<"u"?e.tabSize:this._options.tabSize,o=typeof e.indentSize<"u"?e.indentSize:this._options.originalIndentSize,n=typeof e.insertSpaces<"u"?e.insertSpaces:this._options.insertSpaces,r=typeof e.trimAutoWhitespace<"u"?e.trimAutoWhitespace:this._options.trimAutoWhitespace,s=typeof e.bracketColorizationOptions<"u"?e.bracketColorizationOptions:this._options.bracketPairColorizationOptions,l=new $Ie({tabSize:t,indentSize:o,insertSpaces:n,defaultEOL:this._options.defaultEOL,trimAutoWhitespace:r,bracketPairColorizationOptions:s});if(this._options.equals(l))return;let c=this._options.createChangeEvent(l);this._options=l,this._bracketPairs.handleDidChangeOptions(c),this._decorationProvider.handleDidChangeOptions(c),this._onDidChangeOptions.fire(c)}detectIndentation(e,t){this._assertNotDisposed();let o=Eoi(this._buffer,t,e);this.updateOptions({insertSpaces:o.insertSpaces,tabSize:o.tabSize,indentSize:o.tabSize})}normalizeIndentation(e){return this._assertNotDisposed(),GIe(e,this._options.indentSize,this._options.insertSpaces)}getVersionId(){return this._assertNotDisposed(),this._versionId}mightContainRTL(){return this._buffer.mightContainRTL()}mightContainUnusualLineTerminators(){return this._buffer.mightContainUnusualLineTerminators()}removeUnusualLineTerminators(e=null){let t=this.findMatches(KXt.source,!1,!0,!1,null,!1,1073741824);this._buffer.resetMightContainUnusualLineTerminators(),this.pushEditOperations(e,t.map(o=>({range:o.range,text:null})),()=>null)}mightContainNonBasicASCII(){return this._buffer.mightContainNonBasicASCII()}getAlternativeVersionId(){return this._assertNotDisposed(),this._alternativeVersionId}getInitialUndoRedoSnapshot(){return this._assertNotDisposed(),this._initialUndoRedoSnapshot}getOffsetAt(e){this._assertNotDisposed();let t=this._validatePosition(e.lineNumber,e.column,0);return this._buffer.getOffsetAt(t.lineNumber,t.column)}getPositionAt(e){this._assertNotDisposed();let t=Math.min(this._buffer.getLength(),Math.max(0,e));return this._buffer.getPositionAt(t)}_increaseVersionId(){this._versionId=this._versionId+1,this._alternativeVersionId=this._versionId}_overwriteVersionId(e){this._versionId=e}_overwriteAlternativeVersionId(e){this._alternativeVersionId=e}_overwriteInitialUndoRedoSnapshot(e){this._initialUndoRedoSnapshot=e}getValue(e,t=!1){if(this._assertNotDisposed(),this.isTooLargeForHeapOperation())throw new li("Operation would exceed heap memory limits");let o=this.getFullModelRange(),n=this.getValueInRange(o,e);return t?this._buffer.getBOM()+n:n}createSnapshot(e=!1){return new $oi(this._buffer.createSnapshot(e))}getValueLength(e,t=!1){this._assertNotDisposed();let o=this.getFullModelRange(),n=this.getValueLengthInRange(o,e);return t?this._buffer.getBOM().length+n:n}getValueInRange(e,t=0){return this._assertNotDisposed(),this._buffer.getValueInRange(this.validateRange(e),t)}getValueLengthInRange(e,t=0){return this._assertNotDisposed(),this._buffer.getValueLengthInRange(this.validateRange(e),t)}getCharacterCountInRange(e,t=0){return this._assertNotDisposed(),this._buffer.getCharacterCountInRange(this.validateRange(e),t)}getLineCount(){return this._assertNotDisposed(),this._buffer.getLineCount()}getLineContent(e){if(this._assertNotDisposed(),e<1||e>this.getLineCount())throw new li("Illegal value for lineNumber");return this._buffer.getLineContent(e)}getLineLength(e){if(this._assertNotDisposed(),e<1||e>this.getLineCount())throw new li("Illegal value for lineNumber");return this._buffer.getLineLength(e)}getLinesContent(){if(this._assertNotDisposed(),this.isTooLargeForHeapOperation())throw new li("Operation would exceed heap memory limits");return this._buffer.getLinesContent()}getEOL(){return this._assertNotDisposed(),this._buffer.getEOL()}getEndOfLineSequence(){return this._assertNotDisposed(),this._buffer.getEOL()===`
`?0:1}getLineMinColumn(e){return this._assertNotDisposed(),1}getLineMaxColumn(e){if(this._assertNotDisposed(),e<1||e>this.getLineCount())throw new li("Illegal value for lineNumber");return this._buffer.getLineLength(e)+1}getLineFirstNonWhitespaceColumn(e){if(this._assertNotDisposed(),e<1||e>this.getLineCount())throw new li("Illegal value for lineNumber");return this._buffer.getLineFirstNonWhitespaceColumn(e)}getLineLastNonWhitespaceColumn(e){if(this._assertNotDisposed(),e<1||e>this.getLineCount())throw new li("Illegal value for lineNumber");return this._buffer.getLineLastNonWhitespaceColumn(e)}_validateRangeRelaxedNoAllocations(e){let t=this._buffer.getLineCount(),o=e.startLineNumber,n=e.startColumn,r=Math.floor(typeof o=="number"&&!isNaN(o)?o:1),s=Math.floor(typeof n=="number"&&!isNaN(n)?n:1);if(r<1)r=1,s=1;else if(r>t)r=t,s=this.getLineMaxColumn(r);else if(s<=1)s=1;else{let h=this.getLineMaxColumn(r);s>=h&&(s=h)}let l=e.endLineNumber,c=e.endColumn,u=Math.floor(typeof l=="number"&&!isNaN(l)?l:1),p=Math.floor(typeof c=="number"&&!isNaN(c)?c:1);if(u<1)u=1,p=1;else if(u>t)u=t,p=this.getLineMaxColumn(u);else if(p<=1)p=1;else{let h=this.getLineMaxColumn(u);p>=h&&(p=h)}return o===r&&n===s&&l===u&&c===p&&e instanceof z&&!(e instanceof ti)?e:new z(r,s,u,p)}_isValidPosition(e,t,o){if(typeof e!="number"||typeof t!="number"||isNaN(e)||isNaN(t)||e<1||t<1||(e|0)!==e||(t|0)!==t)return!1;let n=this._buffer.getLineCount();if(e>n)return!1;if(t===1)return!0;let r=this.getLineMaxColumn(e);if(t>r)return!1;if(o===1){let s=this._buffer.getLineCharCode(e,t-2);if(ju(s))return!1}return!0}_validatePosition(e,t,o){let n=Math.floor(typeof e=="number"&&!isNaN(e)?e:1),r=Math.floor(typeof t=="number"&&!isNaN(t)?t:1),s=this._buffer.getLineCount();if(n<1)return new ye(1,1);if(n>s)return new ye(s,this.getLineMaxColumn(s));if(r<=1)return new ye(n,1);let l=this.getLineMaxColumn(n);if(r>=l)return new ye(n,l);if(o===1){let c=this._buffer.getLineCharCode(n,r-2);if(ju(c))return new ye(n,r-1)}return new ye(n,r)}validatePosition(e){let t=1;return this._assertNotDisposed(),e instanceof ye&&this._isValidPosition(e.lineNumber,e.column,t)?e:this._validatePosition(e.lineNumber,e.column,t)}isValidRange(e){return this._isValidRange(e,1)}_isValidRange(e,t){let o=e.startLineNumber,n=e.startColumn,r=e.endLineNumber,s=e.endColumn;if(!this._isValidPosition(o,n,0)||!this._isValidPosition(r,s,0))return!1;if(t===1){let l=n>1?this._buffer.getLineCharCode(o,n-2):0,c=s>1&&s<=this._buffer.getLineLength(r)?this._buffer.getLineCharCode(r,s-2):0,u=ju(l),p=ju(c);return!u&&!p}return!0}validateRange(e){let t=1;if(this._assertNotDisposed(),e instanceof z&&!(e instanceof ti)&&this._isValidRange(e,t))return e;let o=this._validatePosition(e.startLineNumber,e.startColumn,0),n=this._validatePosition(e.endLineNumber,e.endColumn,0),r=o.lineNumber,s=o.column,l=n.lineNumber,c=n.column;if(t===1){let u=s>1?this._buffer.getLineCharCode(r,s-2):0,p=c>1&&c<=this._buffer.getLineLength(l)?this._buffer.getLineCharCode(l,c-2):0,h=ju(u),g=ju(p);return!h&&!g?new z(r,s,l,c):r===l&&s===c?new z(r,s-1,l,c-1):h&&g?new z(r,s-1,l,c+1):h?new z(r,s-1,l,c):new z(r,s,l,c+1)}return new z(r,s,l,c)}modifyPosition(e,t){this._assertNotDisposed();let o=this.getOffsetAt(e)+t;return this.getPositionAt(Math.min(this._buffer.getLength(),Math.max(0,o)))}getFullModelRange(){this._assertNotDisposed();let e=this.getLineCount();return new z(1,1,e,this.getLineMaxColumn(e))}findMatchesLineByLine(e,t,o,n){return this._buffer.findMatchesLineByLine(e,t,o,n)}findMatches(e,t,o,n,r,s,l=hBo){this._assertNotDisposed();let c=null;t!==null&&typeof t!="boolean"&&(Array.isArray(t)||(t=[t]),t.every(h=>z.isIRange(h))&&(c=t.map(h=>this.validateRange(h)))),c===null&&(c=[this.getFullModelRange()]),c=c.sort((h,g)=>h.startLineNumber-g.startLineNumber||h.startColumn-g.startColumn);let u=[];u.push(c.reduce((h,g)=>z.areIntersecting(h,g)?h.plusRange(g):(u.push(h),g)));let p;if(!o&&e.indexOf(`
`)<0){let g=new tw(e,o,n,r).parseSearchRequest();if(!g)return[];p=f=>this.findMatchesLineByLine(f,g,s,l)}else p=h=>jae.findMatches(this,new tw(e,o,n,r),h,s,l);return u.map(p).reduce((h,g)=>h.concat(g),[])}findNextMatch(e,t,o,n,r,s){this._assertNotDisposed();let l=this.validatePosition(t);if(!o&&e.indexOf(`
`)<0){let u=new tw(e,o,n,r).parseSearchRequest();if(!u)return null;let p=this.getLineCount(),h=new z(l.lineNumber,l.column,p,this.getLineMaxColumn(p)),g=this.findMatchesLineByLine(h,u,s,1);return jae.findNextMatch(this,new tw(e,o,n,r),l,s),g.length>0||(h=new z(1,1,l.lineNumber,this.getLineMaxColumn(l.lineNumber)),g=this.findMatchesLineByLine(h,u,s,1),g.length>0)?g[0]:null}return jae.findNextMatch(this,new tw(e,o,n,r),l,s)}findPreviousMatch(e,t,o,n,r,s){this._assertNotDisposed();let l=this.validatePosition(t);return jae.findPreviousMatch(this,new tw(e,o,n,r),l,s)}pushStackElement(){this._commandManager.pushStackElement()}popStackElement(){this._commandManager.popStackElement()}pushEOL(e){if((this.getEOL()===`
`?0:1)!==e)try{this._onDidChangeDecorations.beginDeferredEmit(),this._eventEmitter.beginDeferredEmit(),this._initialUndoRedoSnapshot===null&&(this._initialUndoRedoSnapshot=this._undoRedoService.createSnapshot(this.uri)),this._commandManager.pushEOL(e)}finally{this._eventEmitter.endDeferredEmit(),this._onDidChangeDecorations.endDeferredEmit()}}_validateEditOperation(e){if(e instanceof c7)return e;let t=this.validateRange(e.range),o=e.text;if(o){let n=o.length>0&&o.charCodeAt(o.length-1)===13;this.getEOL()===`\r
`&&n&&t.endColumn===this.getLineMaxColumn(t.endLineNumber)&&(o=o.substring(0,o.length-1))}return new c7(e.identifier||null,t,o,e.forceMoveMarkers||!1,e.isAutoWhitespaceEdit||!1,e._isTracked||!1)}_validateEditOperations(e){let t=[];for(let o=0,n=e.length;o<n;o++)t[o]=this._validateEditOperation(e[o]);return t}edit(e,t){this.pushEditOperations(null,e.replacements.map(o=>({range:o.range,text:o.text})),null)}pushEditOperations(e,t,o,n,r){try{return this._onDidChangeDecorations.beginDeferredEmit(),this._eventEmitter.beginDeferredEmit(),this._pushEditOperations(e,this._validateEditOperations(t),o,n,r)}finally{this._eventEmitter.endDeferredEmit(),this._onDidChangeDecorations.endDeferredEmit()}}_pushEditOperations(e,t,o,n,r){if(this._options.trimAutoWhitespace&&this._trimAutoWhitespaceLines){let s=t.map(c=>({range:this.validateRange(c.range),text:c.text})),l=!0;if(e)for(let c=0,u=e.length;c<u;c++){let p=e[c],h=!1;for(let g=0,f=s.length;g<f;g++){let v=s[g].range,b=v.startLineNumber>p.endLineNumber,S=p.startLineNumber>v.endLineNumber;if(!b&&!S){h=!0;break}}if(!h){l=!1;break}}if(l)for(let c=0,u=this._trimAutoWhitespaceLines.length;c<u;c++){let p=this._trimAutoWhitespaceLines[c],h=this.getLineMaxColumn(p),g=!0;for(let f=0,v=s.length;f<v;f++){let b=s[f].range,S=s[f].text;if(!(p<b.startLineNumber||p>b.endLineNumber)&&!(p===b.startLineNumber&&b.startColumn===h&&b.isEmpty()&&S&&S.length>0&&S.charAt(0)===`
`)&&!(p===b.startLineNumber&&b.startColumn===1&&b.isEmpty()&&S&&S.length>0&&S.charAt(S.length-1)===`
`)){g=!1;break}}if(g){let f=new z(p,1,p,h);t.push(new c7(null,f,null,!1,!1,!1))}}this._trimAutoWhitespaceLines=null}return this._initialUndoRedoSnapshot===null&&(this._initialUndoRedoSnapshot=this._undoRedoService.createSnapshot(this.uri)),this._commandManager.pushEditOperation(e,t,o,n,r)}_applyUndo(e,t,o,n){let r=e.map(s=>{let l=this.getPositionAt(s.newPosition),c=this.getPositionAt(s.newEnd);return{range:new z(l.lineNumber,l.column,c.lineNumber,c.column),text:s.oldText}});this._applyUndoRedoEdits(r,t,!0,!1,o,n)}_applyRedo(e,t,o,n){let r=e.map(s=>{let l=this.getPositionAt(s.oldPosition),c=this.getPositionAt(s.oldEnd);return{range:new z(l.lineNumber,l.column,c.lineNumber,c.column),text:s.newText}});this._applyUndoRedoEdits(r,t,!1,!0,o,n)}_applyUndoRedoEdits(e,t,o,n,r,s){try{this._onDidChangeDecorations.beginDeferredEmit(),this._eventEmitter.beginDeferredEmit(),this._isUndoing=o,this._isRedoing=n;let l=this._validateEditOperations(e);this._doApplyEdits(l,!1,Wc.applyEdits(),s),this.setEOL(t),this._overwriteAlternativeVersionId(r)}finally{this._isUndoing=!1,this._isRedoing=!1,this._eventEmitter.endDeferredEmit(s),this._onDidChangeDecorations.endDeferredEmit()}}applyEdits(e,t,o){try{this._onDidChangeDecorations.beginDeferredEmit(),this._eventEmitter.beginDeferredEmit();let n=this._validateEditOperations(e);return this._doApplyEdits(n,t??!1,o??Wc.applyEdits())}finally{this._eventEmitter.endDeferredEmit(),this._onDidChangeDecorations.endDeferredEmit()}}_doApplyEdits(e,t,o,n=null){let r=this._buffer.getLineCount(),s=this._buffer.applyEdits(e,this._options.trimAutoWhitespace,t),l=this._buffer.getLineCount(),c=s.changes;if(this._trimAutoWhitespaceLines=s.trimAutoWhitespaceLineNumbers,c.length!==0){for(let h=0,g=c.length;h<g;h++){let f=c[h];this._decorationsTree.acceptReplace(f.rangeOffset,f.rangeLength,f.text.length,f.forceMoveMarkers)}let u=[];this._increaseVersionId();let p=r;for(let h=0,g=c.length;h<g;h++){let f=c[h],[v]=ZS(f.text);this._onDidChangeDecorations.fire();let b=f.range.startLineNumber,S=f.range.endLineNumber,y=S-b,w=v,k=Math.min(y,w),T=w-y,P=l-p-T+b;for(let O=k;O>=0;O--){let V=b+O,H=P+O;u.push(new h5e(V,H))}if(k<y){let O=b+k,V=w-y,H=l-p-V+O;u.push(new tIt(O+1,S,H))}if(k<w){let O=b+k,V=w-k,H=l-p-V+O+1;u.push(new iIt(O+1,H,V))}p+=T}this._emitContentChangedEvent(new Ple(u,this.getVersionId(),this._isUndoing,this._isRedoing),{changes:c,eol:this._buffer.getEOL(),isEolChange:!1,versionId:this.getVersionId(),isUndoing:this._isUndoing,isRedoing:this._isRedoing,isFlush:!1,detailedReasons:[o],detailedReasonsChangeLengths:[c.length]},n)}return s.reverseEdits===null?void 0:s.reverseEdits}undo(){return this._undoRedoService.undo(this.uri)}canUndo(){return this._undoRedoService.canUndo(this.uri)}redo(){return this._undoRedoService.redo(this.uri)}canRedo(){return this._undoRedoService.canRedo(this.uri)}handleBeforeFireDecorationsChangedEvent(e,t,o){if(e&&e.size>0){let r=Array.from(e).map(s=>new h5e(s,s));this._onDidChangeContentOrInjectedText(new Kwe(r))}this._fireOnDidChangeLineHeight(t),this._fireOnDidChangeFont(o)}_fireOnDidChangeLineHeight(e){if(e&&e.size>0){let o=Array.from(e).map(n=>new ZSt(n.ownerId,n.decorationId,n.lineNumber,n.lineHeight));this._onDidChangeLineHeight.fire(new Gwe(o))}}_fireOnDidChangeFont(e){if(e&&e.size>0){let o=Array.from(e).map(n=>new eIt(n.ownerId,n.lineNumber));this._onDidChangeFont.fire(new qwe(o))}}_onDidChangeContentOrInjectedText(e){for(let t of this._viewModels)try{t.onDidChangeContentOrInjectedText(e)}catch(o){mt(o)}for(let t of this._viewModels)try{t.emitContentChangeEvent(e)}catch(o){mt(o)}}changeDecorations(e,t=0){this._assertNotDisposed();try{return this._onDidChangeDecorations.beginDeferredEmit(),this._changeDecorations(t,e)}finally{this._onDidChangeDecorations.endDeferredEmit()}}_changeDecorations(e,t){let o={addDecoration:(r,s)=>this._deltaDecorationsImpl(e,[],[{range:r,options:s}])[0],changeDecoration:(r,s)=>{this._changeDecorationImpl(e,r,s)},changeDecorationOptions:(r,s)=>{this._changeDecorationOptionsImpl(e,r,U8i(s))},removeDecoration:r=>{this._deltaDecorationsImpl(e,[r],[])},deltaDecorations:(r,s)=>r.length===0&&s.length===0?[]:this._deltaDecorationsImpl(e,r,s)},n=null;try{n=t(o)}catch(r){mt(r)}return o.addDecoration=V5e,o.changeDecoration=V5e,o.changeDecorationOptions=V5e,o.removeDecoration=V5e,o.deltaDecorations=V5e,n}deltaDecorations(e,t,o=0){if(this._assertNotDisposed(),e||(e=[]),e.length===0&&t.length===0)return[];try{return this._deltaDecorationCallCnt++,this._deltaDecorationCallCnt>1&&(console.warn("Invoking deltaDecorations recursively could lead to leaking decorations."),mt(new Error("Invoking deltaDecorations recursively could lead to leaking decorations."))),this._onDidChangeDecorations.beginDeferredEmit(),this._deltaDecorationsImpl(o,e,t)}finally{this._onDidChangeDecorations.endDeferredEmit(),this._deltaDecorationCallCnt--}}_getTrackedRange(e){return this.getDecorationRange(e)}_setTrackedRange(e,t,o){let n=e?this._decorations[e]:null;if(!n)return t?this._deltaDecorationsImpl(0,[],[{range:t,options:H8i[o]}],!0)[0]:null;if(!t)return this._decorationsTree.delete(n),delete this._decorations[n.id],null;let r=this._validateRangeRelaxedNoAllocations(t),s=this._buffer.getOffsetAt(r.startLineNumber,r.startColumn),l=this._buffer.getOffsetAt(r.endLineNumber,r.endColumn);return this._decorationsTree.delete(n),n.reset(this.getVersionId(),s,l,r),n.setOptions(H8i[o]),this._decorationsTree.insert(n),n.id}removeAllDecorationsWithOwnerId(e){if(this._isDisposed)return;let t=this._decorationsTree.collectNodesFromOwner(e);for(let o=0,n=t.length;o<n;o++){let r=t[o];this._decorationsTree.delete(r),delete this._decorations[r.id]}}getDecorationOptions(e){let t=this._decorations[e];return t?t.options:null}getDecorationRange(e){let t=this._decorations[e];return t?this._decorationsTree.getNodeRange(this,t):null}getLineDecorations(e,t=0,o=!1,n=!1){return e<1||e>this.getLineCount()?[]:this.getLinesDecorations(e,e,t,o,n)}getLinesDecorations(e,t,o=0,n=!1,r=!1,s=!1){let l=this.getLineCount(),c=Math.min(l,Math.max(1,e)),u=Math.min(l,Math.max(1,t)),p=this.getLineMaxColumn(u),h=new z(c,1,u,p),g=this._getDecorationsInRange(h,o,n,r,s);return x$(g,this._decorationProvider.getDecorationsInRange(h,o,n,r)),x$(g,this._fontTokenDecorationsProvider.getDecorationsInRange(h,o,n,r)),g}getDecorationsInRange(e,t=0,o=!1,n=!1,r=!1,s=!1){let l=this.validateRange(e),c=this._getDecorationsInRange(l,t,o,n,s);return x$(c,this._decorationProvider.getDecorationsInRange(l,t,o,n,r)),x$(c,this._fontTokenDecorationsProvider.getDecorationsInRange(l,t,o,n,r)),c}getOverviewRulerDecorations(e=0,t=!1,o=!1){return this._decorationsTree.getAll(this,e,t,o,!0,!1)}getInjectedTextDecorations(e=0){return this._decorationsTree.getAllInjectedText(this,e)}getCustomLineHeightsDecorations(e=0){let t=this._decorationsTree.getAllCustomLineHeights(this,e);return x$(t,this._fontTokenDecorationsProvider.getAllDecorations(e)),t}getCustomLineHeightsDecorationsInRange(e,t=0){let o=this._decorationsTree.getCustomLineHeightsInInterval(this,this.getOffsetAt(e.getStartPosition()),this.getOffsetAt(e.getEndPosition()),t);return x$(o,this._fontTokenDecorationsProvider.getDecorationsInRange(e,t)),o}getLineInjectedText(e,t=0){let o=this._buffer.getOffsetAt(e,1),n=o+this._buffer.getLineLength(e),r=this._decorationsTree.getInjectedTextInInterval(this,o,n,t);return FO.fromDecorations(r).filter(s=>s.lineNumber===e)}getFontDecorationsInRange(e,t=0){let o=this._buffer.getOffsetAt(e.startLineNumber,e.startColumn),n=this._buffer.getOffsetAt(e.endLineNumber,e.endColumn);return this._decorationsTree.getFontDecorationsInInterval(this,o,n,t)}getAllDecorations(e=0,t=!1,o=!1){let n=this._decorationsTree.getAll(this,e,t,o,!1,!1);return n=n.concat(this._decorationProvider.getAllDecorations(e,t)),n=n.concat(this._fontTokenDecorationsProvider.getAllDecorations(e,t)),n}getAllMarginDecorations(e=0){return this._decorationsTree.getAll(this,e,!1,!1,!1,!0)}_getDecorationsInRange(e,t,o,n,r){let s=this._buffer.getOffsetAt(e.startLineNumber,e.startColumn),l=this._buffer.getOffsetAt(e.endLineNumber,e.endColumn);return this._decorationsTree.getAllInInterval(this,s,l,t,o,n,r)}getRangeAt(e,t){return this._buffer.getRangeAt(e,t-e)}_changeDecorationImpl(e,t,o){let n=this._decorations[t];if(!n)return;if(n.options.after){let c=this.getDecorationRange(t);this._onDidChangeDecorations.recordLineAffectedByInjectedText(c.endLineNumber)}if(n.options.before){let c=this.getDecorationRange(t);this._onDidChangeDecorations.recordLineAffectedByInjectedText(c.startLineNumber)}if(n.options.lineHeight!==null){let c=this.getDecorationRange(t);this._onDidChangeDecorations.recordLineAffectedByLineHeightChange(e,t,c.startLineNumber,null)}if(n.options.affectsFont){let c=this.getDecorationRange(t);this._onDidChangeDecorations.recordLineAffectedByFontChange(e,n.id,c.startLineNumber)}let r=this._validateRangeRelaxedNoAllocations(o),s=this._buffer.getOffsetAt(r.startLineNumber,r.startColumn),l=this._buffer.getOffsetAt(r.endLineNumber,r.endColumn);this._decorationsTree.delete(n),n.reset(this.getVersionId(),s,l,r),this._decorationsTree.insert(n),this._onDidChangeDecorations.checkAffectedAndFire(n.options),n.options.after&&this._onDidChangeDecorations.recordLineAffectedByInjectedText(r.endLineNumber),n.options.before&&this._onDidChangeDecorations.recordLineAffectedByInjectedText(r.startLineNumber),n.options.lineHeight!==null&&this._onDidChangeDecorations.recordLineAffectedByLineHeightChange(e,t,r.startLineNumber,n.options.lineHeight),n.options.affectsFont&&this._onDidChangeDecorations.recordLineAffectedByFontChange(e,n.id,r.startLineNumber)}_changeDecorationOptionsImpl(e,t,o){let n=this._decorations[t];if(!n)return;let r=!!(n.options.overviewRuler&&n.options.overviewRuler.color),s=!!(o.overviewRuler&&o.overviewRuler.color);if(this._onDidChangeDecorations.checkAffectedAndFire(n.options),this._onDidChangeDecorations.checkAffectedAndFire(o),n.options.after||o.after){let u=this._decorationsTree.getNodeRange(this,n);this._onDidChangeDecorations.recordLineAffectedByInjectedText(u.endLineNumber)}if(n.options.before||o.before){let u=this._decorationsTree.getNodeRange(this,n);this._onDidChangeDecorations.recordLineAffectedByInjectedText(u.startLineNumber)}if(n.options.lineHeight!==null||o.lineHeight!==null){let u=this._decorationsTree.getNodeRange(this,n);this._onDidChangeDecorations.recordLineAffectedByLineHeightChange(e,t,u.startLineNumber,o.lineHeight)}if(n.options.affectsFont||o.affectsFont){let u=this._decorationsTree.getNodeRange(this,n);this._onDidChangeDecorations.recordLineAffectedByFontChange(e,t,u.startLineNumber)}let l=r!==s,c=vBo(o)!==NIt(n);l||c?(this._decorationsTree.delete(n),n.setOptions(o),this._decorationsTree.insert(n)):n.setOptions(o)}_deltaDecorationsImpl(e,t,o,n=!1){let r=this.getVersionId(),s=t.length,l=0,c=o.length,u=0;this._onDidChangeDecorations.beginDeferredEmit();try{let p=new Array(c);for(;l<s||u<c;){let h=null;if(l<s){let g;do g=t[l++],h=this._decorations[g];while(!h&&l<s);if(h){if(h.options.after){let f=this._decorationsTree.getNodeRange(this,h);this._onDidChangeDecorations.recordLineAffectedByInjectedText(f.endLineNumber)}if(h.options.before){let f=this._decorationsTree.getNodeRange(this,h);this._onDidChangeDecorations.recordLineAffectedByInjectedText(f.startLineNumber)}if(h.options.lineHeight!==null){let f=this._decorationsTree.getNodeRange(this,h);this._onDidChangeDecorations.recordLineAffectedByLineHeightChange(e,g,f.startLineNumber,null)}if(h.options.affectsFont){let f=this._decorationsTree.getNodeRange(this,h);this._onDidChangeDecorations.recordLineAffectedByFontChange(e,g,f.startLineNumber)}this._decorationsTree.delete(h),n||this._onDidChangeDecorations.checkAffectedAndFire(h.options)}}if(u<c){if(!h){let y=++this._lastDecorationId,w=`${this._instanceId};${y}`;h=new Ale(w,0,0),this._decorations[w]=h}let g=o[u],f=this._validateRangeRelaxedNoAllocations(g.range),v=U8i(g.options),b=this._buffer.getOffsetAt(f.startLineNumber,f.startColumn),S=this._buffer.getOffsetAt(f.endLineNumber,f.endColumn);h.ownerId=e,h.reset(r,b,S,f),h.setOptions(v),h.options.after&&this._onDidChangeDecorations.recordLineAffectedByInjectedText(f.endLineNumber),h.options.before&&this._onDidChangeDecorations.recordLineAffectedByInjectedText(f.startLineNumber),h.options.lineHeight!==null&&this._onDidChangeDecorations.recordLineAffectedByLineHeightChange(e,h.id,f.startLineNumber,h.options.lineHeight),h.options.affectsFont&&this._onDidChangeDecorations.recordLineAffectedByFontChange(e,h.id,f.startLineNumber),n||this._onDidChangeDecorations.checkAffectedAndFire(v),this._decorationsTree.insert(h),p[u]=h.id,u++}else h&&delete this._decorations[h.id]}return p}finally{this._onDidChangeDecorations.endDeferredEmit()}}getLanguageId(){return this.tokenization.getLanguageId()}setLanguage(e,t){typeof e=="string"?(this._languageSelectionListener.clear(),this._setLanguage(e,t)):(this._languageSelectionListener.value=e.onDidChange(()=>this._setLanguage(e.languageId,t)),this._setLanguage(e.languageId,t))}_setLanguage(e,t){this.tokenization.setLanguageId(e,t),this._languageService.requestRichLanguageFeatures(e)}getLanguageIdAtPosition(e,t){return this.tokenization.getLanguageIdAtPosition(e,t)}getWordAtPosition(e){return this._tokenizationTextModelPart.getWordAtPosition(e)}getWordUntilPosition(e){return this._tokenizationTextModelPart.getWordUntilPosition(e)}normalizePosition(e,t){return e}getLineIndentColumn(e){return cCe(this.getLineContent(e))+1}toString(){return`TextModel(${this.uri.toString()})`}};ip=I([m(4,Ml),m(5,_t),m(6,Rs),m(7,F)],ip);function z8i(a,i,e){let t;if(e){let o=[];for(let n=0;n<e.length;n++){let r=e[n],s=i[n].tokens;s?s.forEach((l,c)=>{o.push({offset:r,text:l.substring(i[n].content),tokenMetadata:c.metadata})}):o.push({offset:r,text:i[n].content,tokenMetadata:Zc.defaultTokenMetadata})}t=a.withInserted(o)}else t=a;return t}function cCe(a){let i=0;for(let e of a)if(e===" "||e==="	")i++;else break;return i}function qoi(a){return!!(a.options.overviewRuler&&a.options.overviewRuler.color)}function vBo(a){return!!a.after||!!a.before}function NIt(a){return!!a.options.after||!!a.options.before}var OIt=class{constructor(){this._decorationsTree0=new j7,this._decorationsTree1=new j7,this._injectedTextDecorationsTree=new j7}ensureAllNodesHaveRanges(i){this.getAll(i,0,!1,!1,!1,!1)}_ensureNodesHaveRanges(i,e){for(let t of e)t.range===null&&(t.range=i.getRangeAt(t.cachedAbsoluteStart,t.cachedAbsoluteEnd));return e}getAllInInterval(i,e,t,o,n,r,s){let l=i.getVersionId(),c=this._intervalSearch(e,t,o,n,r,l,s);return this._ensureNodesHaveRanges(i,c)}_intervalSearch(i,e,t,o,n,r,s){let l=this._decorationsTree0.intervalSearch(i,e,t,o,n,r,s),c=this._decorationsTree1.intervalSearch(i,e,t,o,n,r,s),u=this._injectedTextDecorationsTree.intervalSearch(i,e,t,o,n,r,s);return l.concat(c).concat(u)}getInjectedTextInInterval(i,e,t,o){let n=i.getVersionId(),r=this._injectedTextDecorationsTree.intervalSearch(e,t,o,!1,!1,n,!1);return this._ensureNodesHaveRanges(i,r).filter(s=>s.options.showIfCollapsed||!s.range.isEmpty())}getFontDecorationsInInterval(i,e,t,o){let n=i.getVersionId(),r=this._decorationsTree0.intervalSearch(e,t,o,!1,!1,n,!1);return this._ensureNodesHaveRanges(i,r).filter(s=>s.options.affectsFont)}getAllInjectedText(i,e){let t=i.getVersionId(),o=this._injectedTextDecorationsTree.search(e,!1,!1,t,!1);return this._ensureNodesHaveRanges(i,o).filter(n=>n.options.showIfCollapsed||!n.range.isEmpty())}getAllCustomLineHeights(i,e){let t=i.getVersionId(),o=this._search(e,!1,!1,!1,t,!1);return this._ensureNodesHaveRanges(i,o).filter(n=>typeof n.options.lineHeight=="number")}getCustomLineHeightsInInterval(i,e,t,o){let n=i.getVersionId(),r=this._intervalSearch(e,t,o,!1,!1,n,!1);return this._ensureNodesHaveRanges(i,r).filter(s=>typeof s.options.lineHeight=="number")}getAll(i,e,t,o,n,r){let s=i.getVersionId(),l=this._search(e,t,o,n,s,r);return this._ensureNodesHaveRanges(i,l)}_search(i,e,t,o,n,r){if(o)return this._decorationsTree1.search(i,e,t,n,r);{let s=this._decorationsTree0.search(i,e,t,n,r),l=this._decorationsTree1.search(i,e,t,n,r),c=this._injectedTextDecorationsTree.search(i,e,t,n,r);return s.concat(l).concat(c)}}collectNodesFromOwner(i){let e=this._decorationsTree0.collectNodesFromOwner(i),t=this._decorationsTree1.collectNodesFromOwner(i),o=this._injectedTextDecorationsTree.collectNodesFromOwner(i);return e.concat(t).concat(o)}collectNodesPostOrder(){let i=this._decorationsTree0.collectNodesPostOrder(),e=this._decorationsTree1.collectNodesPostOrder(),t=this._injectedTextDecorationsTree.collectNodesPostOrder();return i.concat(e).concat(t)}insert(i){NIt(i)?this._injectedTextDecorationsTree.insert(i):qoi(i)?this._decorationsTree1.insert(i):this._decorationsTree0.insert(i)}delete(i){NIt(i)?this._injectedTextDecorationsTree.delete(i):qoi(i)?this._decorationsTree1.delete(i):this._decorationsTree0.delete(i)}getNodeRange(i,e){let t=i.getVersionId();return e.cachedVersionId!==t&&this._resolveNode(e,t),e.range===null&&(e.range=i.getRangeAt(e.cachedAbsoluteStart,e.cachedAbsoluteEnd)),e.range}_resolveNode(i,e){NIt(i)?this._injectedTextDecorationsTree.resolveNode(i,e):qoi(i)?this._decorationsTree1.resolveNode(i,e):this._decorationsTree0.resolveNode(i,e)}acceptReplace(i,e,t,o){this._decorationsTree0.acceptReplace(i,e,t,o),this._decorationsTree1.acceptReplace(i,e,t,o),this._injectedTextDecorationsTree.acceptReplace(i,e,t,o)}};function mz(a){return a.replace(/[^a-z0-9\-_]/gi," ")}var FIt=class{constructor(i){this.color=i.color||"",this.darkColor=i.darkColor||""}},joi=class extends FIt{constructor(i){super(i),this._resolvedColor=null,this.position=typeof i.position=="number"?i.position:2}getColor(i){return this._resolvedColor||(Bp(i.type)&&this.darkColor?this._resolvedColor=this._resolveColor(this.darkColor,i):this._resolvedColor=this._resolveColor(this.color,i)),this._resolvedColor}invalidateCachedColor(){this._resolvedColor=null}_resolveColor(i,e){if(typeof i=="string")return i;let t=i?e.getColor(i.id):null;return t?t.toString():""}},Qoi=class{constructor(i){this.position=i?.position??2,this.persistLane=i?.persistLane}},Yoi=class extends FIt{constructor(i){super(i),this.position=i.position,this.sectionHeaderStyle=i.sectionHeaderStyle??null,this.sectionHeaderText=i.sectionHeaderText??null}getColor(i){return this._resolvedColor||(Bp(i.type)&&this.darkColor?this._resolvedColor=this._resolveColor(this.darkColor,i):this._resolvedColor=this._resolveColor(this.color,i)),this._resolvedColor}invalidateCachedColor(){this._resolvedColor=void 0}_resolveColor(i,e){return typeof i=="string"?We.fromHex(i):e.getColor(i.id)}},gz=class a{static from(i){return i instanceof a?i:new a(i)}constructor(i){this.content=i.content||"",this.tokens=i.tokens??null,this.inlineClassName=i.inlineClassName||null,this.inlineClassNameAffectsLetterSpacing=i.inlineClassNameAffectsLetterSpacing||!1,this.attachedData=i.attachedData||null,this.cursorStops=i.cursorStops||null}},mo=class a{static register(i){return new a(i)}static createDynamic(i){return new a(i)}constructor(i){this.description=i.description,this.blockClassName=i.blockClassName?mz(i.blockClassName):null,this.blockDoesNotCollapse=i.blockDoesNotCollapse??null,this.blockIsAfterEnd=i.blockIsAfterEnd??null,this.blockPadding=i.blockPadding??null,this.stickiness=i.stickiness||0,this.zIndex=i.zIndex||0,this.className=i.className?mz(i.className):null,this.shouldFillLineOnLineBreak=i.shouldFillLineOnLineBreak??null,this.hoverMessage=i.hoverMessage||null,this.glyphMarginHoverMessage=i.glyphMarginHoverMessage||null,this.lineNumberHoverMessage=i.lineNumberHoverMessage||null,this.isWholeLine=i.isWholeLine||!1,this.lineHeight=i.lineHeight?Math.min(i.lineHeight,fBo):null,this.fontSize=i.fontSize||null,this.affectsFont=!!i.fontSize||!!i.fontFamily||!!i.fontWeight||!!i.fontStyle,this.showIfCollapsed=i.showIfCollapsed||!1,this.collapseOnReplaceEdit=i.collapseOnReplaceEdit||!1,this.overviewRuler=i.overviewRuler?new joi(i.overviewRuler):null,this.minimap=i.minimap?new Yoi(i.minimap):null,this.glyphMargin=i.glyphMarginClassName?new Qoi(i.glyphMargin):null,this.glyphMarginClassName=i.glyphMarginClassName?mz(i.glyphMarginClassName):null,this.linesDecorationsClassName=i.linesDecorationsClassName?mz(i.linesDecorationsClassName):null,this.lineNumberClassName=i.lineNumberClassName?mz(i.lineNumberClassName):null,this.linesDecorationsTooltip=i.linesDecorationsTooltip?Bht(i.linesDecorationsTooltip):null,this.firstLineDecorationClassName=i.firstLineDecorationClassName?mz(i.firstLineDecorationClassName):null,this.marginClassName=i.marginClassName?mz(i.marginClassName):null,this.inlineClassName=i.inlineClassName?mz(i.inlineClassName):null,this.inlineClassNameAffectsLetterSpacing=i.inlineClassNameAffectsLetterSpacing||!1,this.beforeContentClassName=i.beforeContentClassName?mz(i.beforeContentClassName):null,this.afterContentClassName=i.afterContentClassName?mz(i.afterContentClassName):null,this.after=i.after?gz.from(i.after):null,this.before=i.before?gz.from(i.before):null,this.hideInCommentTokens=i.hideInCommentTokens??!1,this.hideInStringTokens=i.hideInStringTokens??!1,this.textDirection=i.textDirection??null}};mo.EMPTY=mo.register({description:"empty"});var H8i=[mo.register({description:"tracked-range-always-grows-when-typing-at-edges",stickiness:0}),mo.register({description:"tracked-range-never-grows-when-typing-at-edges",stickiness:1}),mo.register({description:"tracked-range-grows-only-when-typing-before",stickiness:2}),mo.register({description:"tracked-range-grows-only-when-typing-after",stickiness:3})];function U8i(a){return a instanceof mo?a:mo.createDynamic(a)}var Xoi=class extends x{constructor(e){super();this.handleBeforeFire=e;this._actual=this._register(new E);this.event=this._actual.event;this._affectedInjectedTextLines=null;this._affectedLineHeights=null;this._affectedFontLines=null;this._deferredCnt=0,this._shouldFireDeferred=!1,this._affectsMinimap=!1,this._affectsOverviewRuler=!1,this._affectsGlyphMargin=!1,this._affectsLineNumber=!1}hasListeners(){return this._actual.hasListeners()}beginDeferredEmit(){this._deferredCnt++}endDeferredEmit(){this._deferredCnt--,this._deferredCnt===0&&(this._shouldFireDeferred&&this.doFire(),this._affectedInjectedTextLines?.clear(),this._affectedInjectedTextLines=null,this._affectedLineHeights?.clear(),this._affectedLineHeights=null,this._affectedFontLines?.clear(),this._affectedFontLines=null)}recordLineAffectedByInjectedText(e){this._affectedInjectedTextLines||(this._affectedInjectedTextLines=new Set),this._affectedInjectedTextLines.add(e)}recordLineAffectedByLineHeightChange(e,t,o,n){this._affectedLineHeights||(this._affectedLineHeights=new Ase([],Nj.toKey)),this._affectedLineHeights.add(new Nj(e,t,o,n))}recordLineAffectedByFontChange(e,t,o){this._affectedFontLines||(this._affectedFontLines=new Ase([],Oj.toKey)),this._affectedFontLines.add(new Oj(e,t,o))}checkAffectedAndFire(e){this._affectsMinimap||=!!e.minimap?.position,this._affectsOverviewRuler||=!!e.overviewRuler?.color,this._affectsGlyphMargin||=!!e.glyphMarginClassName,this._affectsLineNumber||=!!e.lineNumberClassName,this.tryFire()}fire(){this._affectsMinimap=!0,this._affectsOverviewRuler=!0,this._affectsGlyphMargin=!0,this.tryFire()}tryFire(){this._deferredCnt===0?this.doFire():this._shouldFireDeferred=!0}doFire(){this.handleBeforeFire(this._affectedInjectedTextLines,this._affectedLineHeights,this._affectedFontLines);let e={affectsMinimap:this._affectsMinimap,affectsOverviewRuler:this._affectsOverviewRuler,affectsGlyphMargin:this._affectsGlyphMargin,affectsLineNumber:this._affectsLineNumber};this._shouldFireDeferred=!1,this._affectsMinimap=!1,this._affectsOverviewRuler=!1,this._affectsGlyphMargin=!1,this._actual.fire(e)}},Joi=class extends x{constructor(){super();this._emitter=this._register(new E);this.event=this._emitter.event;this._deferredCnt=0,this._deferredEvent=null}hasListeners(){return this._emitter.hasListeners()}beginDeferredEmit(){this._deferredCnt++}endDeferredEmit(e=null){if(this._deferredCnt--,this._deferredCnt===0&&this._deferredEvent!==null){this._deferredEvent.rawContentChangedEvent.resultingSelection=e;let t=this._deferredEvent;this._deferredEvent=null,this._emitter.fire(t)}}fire(e){if(this._deferredCnt>0){this._deferredEvent?this._deferredEvent=this._deferredEvent.merge(e):this._deferredEvent=e;return}this._emitter.fire(e)}};var WIt=class a{static create(i){return new a(i.get(151),i.get(150))}constructor(i,e){this.classifier=new Zoi(i,e)}createLineBreaksComputer(i,e,t,o,n,r,s){let l=[],c=[];return{addRequest:(u,p)=>{l.push(u),c.push(p)},finalize:()=>{let u=e.typicalFullwidthCharacterWidth/e.typicalHalfwidthCharacterWidth,p=[];for(let h=0,g=l.length;h<g;h++){let f=l[h],v=i.getLineInjectedText(f),b=i.getLineContent(f),S=c[h],y=s&&b.includes('"')&&b.includes("\\n");S&&!S.injectionOptions&&!v&&!y?p[h]=bBo(this.classifier,S,b,t,o,u,n,r):p[h]=SBo(this.classifier,b,v,t,o,u,n,r,y)}return eni.length=0,tni.length=0,p}}}};var Zoi=class extends J${constructor(i,e){super(0);for(let t=0;t<i.length;t++)this.set(i.charCodeAt(t),1);for(let t=0;t<e.length;t++)this.set(e.charCodeAt(t),2)}get(i){return i>=0&&i<256?this._asciiMap[i]:i>=12352&&i<=12543||i>=13312&&i<=19903||i>=19968&&i<=40959?3:this._map.get(i)||this._defaultValue}},eni=[],tni=[];function bBo(a,i,e,t,o,n,r,s){if(o===-1)return null;let l=e.length;if(l<=1)return null;let c=s==="keepAll",u=i.breakOffsets,p=i.breakOffsetsVisibleColumn,h=G8i(e,t,o,n,r),g=o-h,f=eni,v=tni,b=0,S=0,y=0,w=o,k=u.length,T=0;if(T>=0){let P=Math.abs(p[T]-w);for(;T+1<k;){let O=Math.abs(p[T+1]-w);if(O>=P)break;P=O,T++}}for(;T<k;){let P=T<0?0:u[T],O=T<0?0:p[T];S>P&&(P=S,O=y);let V=0,H=0,G=0,$=0;if(O<=w){let ae=O,he=P===0?0:e.charCodeAt(P-1),oe=P===0?0:a.get(he),de=!0;for(let Ce=P;Ce<l;Ce++){let xe=Ce,ze=e.charCodeAt(Ce),De,Oe;if(ju(ze)?(Ce++,De=0,Oe=2):(De=a.get(ze),Oe=B5e(ze,ae,t,n)),xe>S&&ini(he,oe,ze,De,c)&&(V=xe,H=ae),ae+=Oe,ae>w){xe>S?(G=xe,$=ae-Oe):(G=Ce+1,$=ae),ae-H>g&&(V=0),de=!1;break}he=ze,oe=De}if(de){b>0&&(f[b]=u[u.length-1],v[b]=p[u.length-1],b++);break}}if(V===0){let ae=O,he=e.charCodeAt(P),oe=a.get(he),de=!1;for(let Ce=P-1;Ce>=S;Ce--){let xe=Ce+1,ze=e.charCodeAt(Ce);if(ze===9){de=!0;break}let De,Oe;if(ZN(ze)?(Ce--,De=0,Oe=2):(De=a.get(ze),Oe=h_(ze)?n:1),ae<=w){if(G===0&&(G=xe,$=ae),ae<=w-g)break;if(ini(ze,De,he,oe,c)){V=xe,H=ae;break}}ae-=Oe,he=ze,oe=De}if(V!==0){let Ce=g-($-H);if(Ce<=t){let xe=e.charCodeAt(G),ze;ju(xe)?ze=2:ze=B5e(xe,$,t,n),Ce-ze<0&&(V=0)}}if(de){T--;continue}}if(V===0&&(V=G,H=$),V<=S){let ae=e.charCodeAt(S);ju(ae)?(V=S+2,H=y+2):(V=S+1,H=y+B5e(ae,y,t,n))}for(S=V,f[b]=V,y=H,v[b]=H,b++,w=H+g;T<0||T<k&&p[T]<H;)T++;let J=Math.abs(p[T]-w);for(;T+1<k;){let ae=Math.abs(p[T+1]-w);if(ae>=J)break;J=ae,T++}}return b===0?null:(f.length=b,v.length=b,eni=i.breakOffsets,tni=i.breakOffsetsVisibleColumn,i.breakOffsets=f,i.breakOffsetsVisibleColumn=v,i.wrappedTextIndentLength=h,i)}function SBo(a,i,e,t,o,n,r,s,l){let c=FO.applyInjectedText(i,e),u,p;if(e&&e.length>0?(u=e.map(G=>G.options),p=e.map(G=>G.column-1)):(u=null,p=null),o===-1)return u?new _j(p,u,[c.length],[],0):null;let h=c.length;if(h<=1)return u?new _j(p,u,[c.length],[],0):null;let g=s==="keepAll",f=G8i(c,t,o,n,r),v=o-f,b=[],S=[],y=0,w=0,k=0,T=o,P=c.charCodeAt(0),O=a.get(P),V=B5e(P,0,t,n),H=1;ju(P)&&(V+=1,P=c.charCodeAt(1),O=a.get(P),H++);for(let G=H;G<h;G++){let $=G,J=c.charCodeAt(G),ae,he,oe=!1;ju(J)?(G++,ae=0,he=2):(ae=a.get(J),he=B5e(J,V,t,n)),l&&IBo(c,G)?(w=$,k=V,oe=!0):ini(P,O,J,ae,g)&&(w=$,k=V),V+=he,(V>T||oe)&&((w===0||V-k>v)&&(w=$,k=V-he),b[y]=w,S[y]=k,y++,T=k+v,w=0),P=J,O=ae}return y===0&&(!e||e.length===0)?null:(b[y]=h,S[y]=V,new _j(p,u,b,S,f))}function B5e(a,i,e,t){return a===9?e-i%e:h_(a)||a<32?t:1}function K8i(a,i){return i-a%i}function IBo(a,i){if(i>=2&&a.charAt(i-1)==="n"){let e=0;for(let t=i-2;t>=0;t--)if(a.charAt(t)==="\\")e++;else return e%2===1}return!1}function ini(a,i,e,t,o){return e!==32&&(i===2&&t!==2||i!==1&&t===1||!o&&i===3&&t!==2||!o&&t===3&&i!==1)}function G8i(a,i,e,t,o){let n=0;if(o!==0){let r=nm(a);if(r!==-1){for(let l=0;l<r;l++){let c=a.charCodeAt(l)===9?K8i(n,i):1;n+=c}let s=o===3?2:o===2?1:0;for(let l=0;l<s;l++){let c=K8i(n,i);n+=c}n+t>e&&(n=0)}}return n}var H5e=class a{constructor(i){this._selTrackedRange=null,this._trackSelection=!0,this._setState(i,new vv(new z(1,1,1,1),0,0,new ye(1,1),0),new vv(new z(1,1,1,1),0,0,new ye(1,1),0))}dispose(i){this._removeTrackedRange(i)}startTrackingSelection(i){this._trackSelection=!0,this._updateTrackedRange(i)}stopTrackingSelection(i){this._trackSelection=!1,this._removeTrackedRange(i)}_updateTrackedRange(i){this._trackSelection&&(this._selTrackedRange=i.model._setTrackedRange(this._selTrackedRange,this.modelState.selection,0))}_removeTrackedRange(i){this._selTrackedRange=i.model._setTrackedRange(this._selTrackedRange,null,0)}asCursorState(){return new js(this.modelState,this.viewState)}readSelectionFromMarkers(i){let e=i.model._getTrackedRange(this._selTrackedRange);return this.modelState.selection.isEmpty()&&!e.isEmpty()?ti.fromRange(e.collapseToEnd(),this.modelState.selection.getDirection()):ti.fromRange(e,this.modelState.selection.getDirection())}ensureValidState(i){this._setState(i,this.modelState,this.viewState)}setState(i,e,t){this._setState(i,e,t)}static _validatePositionWithCache(i,e,t,o){return e.equals(t)?o:i.normalizePosition(e,2)}static _validateViewState(i,e){let t=e.position,o=e.selectionStart.getStartPosition(),n=e.selectionStart.getEndPosition(),r=i.normalizePosition(t,2),s=this._validatePositionWithCache(i,o,t,r),l=this._validatePositionWithCache(i,n,o,s);return t.equals(r)&&o.equals(s)&&n.equals(l)?e:new vv(z.fromPositions(s,l),e.selectionStartKind,e.selectionStartLeftoverVisibleColumns+o.column-s.column,r,e.leftoverVisibleColumns+t.column-r.column)}_setState(i,e,t){if(t&&(t=a._validateViewState(i.viewModel,t)),e){let o=i.model.validateRange(e.selectionStart),n=e.selectionStart.equalsRange(o)?e.selectionStartLeftoverVisibleColumns:0,r=i.model.validatePosition(e.position),s=e.position.equals(r)?e.leftoverVisibleColumns:0;e=new vv(o,e.selectionStartKind,n,r,s)}else{if(!t)return;let o=i.model.validateRange(i.coordinatesConverter.convertViewRangeToModelRange(t.selectionStart)),n=i.model.validatePosition(i.coordinatesConverter.convertViewPositionToModelPosition(t.position));e=new vv(o,t.selectionStartKind,t.selectionStartLeftoverVisibleColumns,n,t.leftoverVisibleColumns)}if(t){let o=i.coordinatesConverter.validateViewRange(t.selectionStart,e.selectionStart),n=i.coordinatesConverter.validateViewPosition(t.position,e.position);t=new vv(o,e.selectionStartKind,e.selectionStartLeftoverVisibleColumns,n,e.leftoverVisibleColumns)}else{let o=i.coordinatesConverter.convertModelPositionToViewPosition(new ye(e.selectionStart.startLineNumber,e.selectionStart.startColumn)),n=i.coordinatesConverter.convertModelPositionToViewPosition(new ye(e.selectionStart.endLineNumber,e.selectionStart.endColumn)),r=new z(o.lineNumber,o.column,n.lineNumber,n.column),s=i.coordinatesConverter.convertModelPositionToViewPosition(e.position);t=new vv(r,e.selectionStartKind,e.selectionStartLeftoverVisibleColumns,s,e.leftoverVisibleColumns)}this.modelState=e,this.viewState=t,this._updateTrackedRange(i)}};var U5e=class{constructor(i){this.context=i,this.cursors=[new H5e(i)],this.lastAddedCursorIndex=0}dispose(){for(let i of this.cursors)i.dispose(this.context)}startTrackingSelections(){for(let i of this.cursors)i.startTrackingSelection(this.context)}stopTrackingSelections(){for(let i of this.cursors)i.stopTrackingSelection(this.context)}updateContext(i){this.context=i}ensureValidState(){for(let i of this.cursors)i.ensureValidState(this.context)}readSelectionFromMarkers(){return this.cursors.map(i=>i.readSelectionFromMarkers(this.context))}getAll(){return this.cursors.map(i=>i.asCursorState())}getViewPositions(){return this.cursors.map(i=>i.viewState.position)}getTopMostViewPosition(){return rht(this.cursors,cl(i=>i.viewState.position,ye.compare)).viewState.position}getBottomMostViewPosition(){return nht(this.cursors,cl(i=>i.viewState.position,ye.compare)).viewState.position}getSelections(){return this.cursors.map(i=>i.modelState.selection)}getViewSelections(){return this.cursors.map(i=>i.viewState.selection)}setSelections(i){this.setStates(js.fromModelSelections(i))}getPrimaryCursor(){return this.cursors[0].asCursorState()}setStates(i){i!==null&&(this.cursors[0].setState(this.context,i[0].modelState,i[0].viewState),this._setSecondaryStates(i.slice(1)))}_setSecondaryStates(i){let e=this.cursors.length-1,t=i.length;if(e<t){let o=t-e;for(let n=0;n<o;n++)this._addSecondaryCursor()}else if(e>t){let o=e-t;for(let n=0;n<o;n++)this._removeSecondaryCursor(this.cursors.length-2)}for(let o=0;o<t;o++)this.cursors[o+1].setState(this.context,i[o].modelState,i[o].viewState)}killSecondaryCursors(){this._setSecondaryStates([])}_addSecondaryCursor(){this.cursors.push(new H5e(this.context)),this.lastAddedCursorIndex=this.cursors.length-1}getLastAddedCursorIndex(){return this.cursors.length===1||this.lastAddedCursorIndex===0?0:this.lastAddedCursorIndex}_removeSecondaryCursor(i){this.lastAddedCursorIndex>=i+1&&this.lastAddedCursorIndex--,this.cursors[i+1].dispose(this.context),this.cursors.splice(i+1,1)}normalize(){if(this.cursors.length===1)return;let i=this.cursors.slice(0),e=[];for(let t=0,o=i.length;t<o;t++)e.push({index:t,selection:i[t].modelState.selection});e.sort(cl(t=>t.selection,z.compareRangesUsingStarts));for(let t=0;t<e.length-1;t++){let o=e[t],n=e[t+1],r=o.selection,s=n.selection;if(!this.context.cursorConfig.multiCursorMergeOverlapping)continue;let l;if(s.isEmpty()||r.isEmpty()?l=s.getStartPosition().isBeforeOrEqual(r.getEndPosition()):l=s.getStartPosition().isBefore(r.getEndPosition()),l){let c=o.index<n.index?t:t+1,u=o.index<n.index?t+1:t,p=e[u].index,h=e[c].index,g=e[u].selection,f=e[c].selection;if(!g.equalsSelection(f)){let v=g.plusRange(f),b=g.selectionStartLineNumber===g.startLineNumber&&g.selectionStartColumn===g.startColumn,S=f.selectionStartLineNumber===f.startLineNumber&&f.selectionStartColumn===f.startColumn,y;p===this.lastAddedCursorIndex?(y=b,this.lastAddedCursorIndex=h):y=S;let w;y?w=new ti(v.startLineNumber,v.startColumn,v.endLineNumber,v.endColumn):w=new ti(v.endLineNumber,v.endColumn,v.startLineNumber,v.startColumn),e[c].selection=w;let k=js.fromModelSelection(w);i[h].setState(this.context,k.modelState,k.viewState)}for(let v of e)v.index>p&&v.index--;i.splice(p,1),e.splice(u,1),this._removeSecondaryCursor(p-1),t--}}}};var z5e=class{constructor(i,e,t,o){this._cursorContextBrand=void 0;this.model=i,this.viewModel=e,this.coordinatesConverter=t,this.cursorConfig=o}};var VIt=class extends x{constructor(){super();this._onEvent=this._register(new E);this.onEvent=this._onEvent.event;this._eventHandlers=[],this._viewEventQueue=null,this._isConsumingViewEventQueue=!1,this._collector=null,this._collectorCnt=0,this._outgoingEvents=[]}emitOutgoingEvent(e){this._addOutgoingEvent(e),this._emitOutgoingEvents()}_addOutgoingEvent(e){for(let t=0,o=this._outgoingEvents.length;t<o;t++){let n=this._outgoingEvents[t].kind===e.kind?this._outgoingEvents[t].attemptToMerge(e):null;if(n){this._outgoingEvents[t]=n;return}}this._outgoingEvents.push(e)}_emitOutgoingEvents(){for(;this._outgoingEvents.length>0;){if(this._collector||this._isConsumingViewEventQueue)return;let e=this._outgoingEvents.shift();e.isNoOp()||this._onEvent.fire(e)}}addViewEventHandler(e){for(let t=0,o=this._eventHandlers.length;t<o;t++)this._eventHandlers[t]===e&&console.warn("Detected duplicate listener in ViewEventDispatcher",e);this._eventHandlers.push(e)}removeViewEventHandler(e){for(let t=0;t<this._eventHandlers.length;t++)if(this._eventHandlers[t]===e){this._eventHandlers.splice(t,1);break}}beginEmitViewEvents(){return this._collectorCnt++,this._collectorCnt===1&&(this._collector=new RP),this._collector}endEmitViewEvents(){if(this._collectorCnt--,this._collectorCnt===0){let e=this._collector.outgoingEvents,t=this._collector.viewEvents;this._collector=null;for(let o of e)this._addOutgoingEvent(o);t.length>0&&this._emitMany(t)}this._emitOutgoingEvents()}emitSingleViewEvent(e){try{this.beginEmitViewEvents().emitViewEvent(e)}finally{this.endEmitViewEvents()}}_emitMany(e){this._viewEventQueue?this._viewEventQueue=this._viewEventQueue.concat(e):this._viewEventQueue=e,this._isConsumingViewEventQueue||this._consumeViewEventQueue()}_consumeViewEventQueue(){try{this._isConsumingViewEventQueue=!0,this._doConsumeQueue()}finally{this._isConsumingViewEventQueue=!1}}_doConsumeQueue(){for(;this._viewEventQueue;){let e=this._viewEventQueue;this._viewEventQueue=null;let t=this._eventHandlers.slice(0);for(let o of t)o.handleEvents(e)}}},RP=class{constructor(){this.viewEvents=[],this.outgoingEvents=[]}emitViewEvent(i){this.viewEvents.push(i)}emitOutgoingEvent(i){this.outgoingEvents.push(i)}};var BIt=class a{constructor(i,e,t,o){this.kind=0;this._oldContentWidth=i,this._oldContentHeight=e,this.contentWidth=t,this.contentHeight=o,this.contentWidthChanged=this._oldContentWidth!==this.contentWidth,this.contentHeightChanged=this._oldContentHeight!==this.contentHeight}isNoOp(){return!this.contentWidthChanged&&!this.contentHeightChanged}attemptToMerge(i){return i.kind!==this.kind?null:new a(this._oldContentWidth,this._oldContentHeight,i.contentWidth,i.contentHeight)}},K5e=class a{constructor(i,e){this.kind=1;this.oldHasFocus=i,this.hasFocus=e}isNoOp(){return this.oldHasFocus===this.hasFocus}attemptToMerge(i){return i.kind!==this.kind?null:new a(this.oldHasFocus,i.hasFocus)}},HIt=class{constructor(i,e){this.kind=2;this.oldHasFocus=i,this.hasFocus=e}isNoOp(){return this.oldHasFocus===this.hasFocus}attemptToMerge(i){return i.kind!==this.kind?null:new K5e(this.oldHasFocus,i.hasFocus)}},UIt=class a{constructor(i,e,t,o,n,r,s,l){this.kind=3;this._oldScrollWidth=i,this._oldScrollLeft=e,this._oldScrollHeight=t,this._oldScrollTop=o,this.scrollWidth=n,this.scrollLeft=r,this.scrollHeight=s,this.scrollTop=l,this.scrollWidthChanged=this._oldScrollWidth!==this.scrollWidth,this.scrollLeftChanged=this._oldScrollLeft!==this.scrollLeft,this.scrollHeightChanged=this._oldScrollHeight!==this.scrollHeight,this.scrollTopChanged=this._oldScrollTop!==this.scrollTop}isNoOp(){return!this.scrollWidthChanged&&!this.scrollLeftChanged&&!this.scrollHeightChanged&&!this.scrollTopChanged}attemptToMerge(i){return i.kind!==this.kind?null:new a(this._oldScrollWidth,this._oldScrollLeft,this._oldScrollHeight,this._oldScrollTop,i.scrollWidth,i.scrollLeft,i.scrollHeight,i.scrollTop)}},zIt=class{constructor(){this.kind=4}isNoOp(){return!1}attemptToMerge(i){return i.kind!==this.kind?null:this}},KIt=class{constructor(){this.kind=5}isNoOp(){return!1}attemptToMerge(i){return i.kind!==this.kind?null:this}},GIt=class a{constructor(i,e,t,o,n,r,s){this.kind=7;this.oldSelections=i,this.selections=e,this.oldModelVersionId=t,this.modelVersionId=o,this.source=n,this.reason=r,this.reachedMaxCursorCount=s}static _selectionsAreEqual(i,e){if(!i&&!e)return!0;if(!i||!e)return!1;let t=i.length,o=e.length;if(t!==o)return!1;for(let n=0;n<t;n++)if(!i[n].equalsSelection(e[n]))return!1;return!0}isNoOp(){return a._selectionsAreEqual(this.oldSelections,this.selections)&&this.oldModelVersionId===this.modelVersionId}attemptToMerge(i){return i.kind!==this.kind?null:new a(this.oldSelections,i.selections,this.oldModelVersionId,i.modelVersionId,i.source,i.reason,this.reachedMaxCursorCount||i.reachedMaxCursorCount)}},qIt=class{constructor(){this.kind=6}isNoOp(){return!1}attemptToMerge(i){return i.kind!==this.kind?null:this}},$It=class{constructor(i){this.event=i;this.kind=8}isNoOp(){return!1}attemptToMerge(i){return null}},jIt=class{constructor(i){this.event=i;this.kind=9}isNoOp(){return!1}attemptToMerge(i){return null}},QIt=class{constructor(i){this.event=i;this.kind=10}isNoOp(){return!1}attemptToMerge(i){return null}},YIt=class{constructor(i){this.event=i;this.kind=11}isNoOp(){return!1}attemptToMerge(i){return null}},XIt=class{constructor(i){this.event=i;this.kind=12}isNoOp(){return!1}attemptToMerge(i){return null}},JIt=class{constructor(i){this.event=i;this.kind=13}isNoOp(){return!1}attemptToMerge(i){return null}},ZIt=class{constructor(i){this.event=i;this.kind=14}isNoOp(){return!1}attemptToMerge(i){return null}},eyt=class{constructor(i){this.event=i;this.kind=15}isNoOp(){return!1}attemptToMerge(i){return null}};var dCe=class extends x{constructor(i,e,t,o){super(),this._model=i,this._knownModelVersionId=this._model.getVersionId(),this._viewModel=e,this._coordinatesConverter=t,this.context=new z5e(this._model,this._viewModel,this._coordinatesConverter,o),this._cursors=new U5e(this.context),this._hasFocus=!1,this._isHandling=!1,this._compositionState=null,this._columnSelectData=null,this._autoClosedActions=[],this._prevEditOperationType=0}dispose(){this._cursors.dispose(),this._autoClosedActions=Be(this._autoClosedActions),super.dispose()}updateConfiguration(i){this.context=new z5e(this._model,this._viewModel,this._coordinatesConverter,i),this._cursors.updateContext(this.context)}onLineMappingChanged(i){this._knownModelVersionId===this._model.getVersionId()&&this.setStates(i,"viewModel",0,this.getCursorStates())}setHasFocus(i){this._hasFocus=i}_validateAutoClosedActions(){if(this._autoClosedActions.length>0){let i=this._cursors.getSelections();for(let e=0;e<this._autoClosedActions.length;e++){let t=this._autoClosedActions[e];t.isValid(i)||(t.dispose(),this._autoClosedActions.splice(e,1),e--)}}}getPrimaryCursorState(){return this._cursors.getPrimaryCursor()}getLastAddedCursorIndex(){return this._cursors.getLastAddedCursorIndex()}getCursorStates(){return this._cursors.getAll()}setStates(i,e,t,o){let n=!1,r=this.context.cursorConfig.multiCursorLimit;o!==null&&o.length>r&&(o=o.slice(0,r),n=!0);let s=G5e.from(this._model,this);return this._cursors.setStates(o),this._cursors.normalize(),this._columnSelectData=null,this._validateAutoClosedActions(),this._emitStateChangedIfNecessary(i,e,t,s,n)}setCursorColumnSelectData(i){this._columnSelectData=i}revealAll(i,e,t,o,n,r){let s=this._cursors.getViewPositions(),l=null,c=null;s.length>1?c=this._cursors.getViewSelections():l=z.fromPositions(s[0],s[0]),i.emitViewEvent(new nj(e,t,l,c,o,n,r))}revealPrimary(i,e,t,o,n,r){let l=[this._cursors.getPrimaryCursor().viewState.selection];i.emitViewEvent(new nj(e,t,null,l,o,n,r))}saveState(){let i=[],e=this._cursors.getSelections();for(let t=0,o=e.length;t<o;t++){let n=e[t];i.push({inSelectionMode:!n.isEmpty(),selectionStart:{lineNumber:n.selectionStartLineNumber,column:n.selectionStartColumn},position:{lineNumber:n.positionLineNumber,column:n.positionColumn}})}return i}restoreState(i,e){let t=[];for(let o=0,n=e.length;o<n;o++){let r=e[o],s=1,l=1;r.position&&r.position.lineNumber&&(s=r.position.lineNumber),r.position&&r.position.column&&(l=r.position.column);let c=s,u=l;r.selectionStart&&r.selectionStart.lineNumber&&(c=r.selectionStart.lineNumber),r.selectionStart&&r.selectionStart.column&&(u=r.selectionStart.column),t.push({selectionStartLineNumber:c,selectionStartColumn:u,positionLineNumber:s,positionColumn:l})}this.setStates(i,"restoreState",0,js.fromModelSelections(t)),this.revealAll(i,"restoreState",!1,0,!0,1)}onModelContentChanged(i,e){if(e instanceof Kwe){if(this._isHandling)return;this._isHandling=!0;try{this.setStates(i,"modelChange",0,this.getCursorStates())}finally{this._isHandling=!1}}else{let t=e.rawContentChangedEvent;if(this._knownModelVersionId=t.versionId,this._isHandling)return;let o=t.containsEvent(1);if(this._prevEditOperationType=0,o)this._cursors.dispose(),this._cursors=new U5e(this.context),this._validateAutoClosedActions(),this._emitStateChangedIfNecessary(i,"model",1,null,!1);else if(this._hasFocus&&t.resultingSelection&&t.resultingSelection.length>0){let n=js.fromModelSelections(t.resultingSelection);this.setStates(i,"modelChange",t.isUndoing?5:t.isRedoing?6:2,n)&&this.revealAll(i,"modelChange",!1,0,!0,0)}else{let n=this._cursors.readSelectionFromMarkers();this.setStates(i,"modelChange",2,js.fromModelSelections(n))}}}getSelection(){return this._cursors.getPrimaryCursor().modelState.selection}getTopMostViewPosition(){return this._cursors.getTopMostViewPosition()}getBottomMostViewPosition(){return this._cursors.getBottomMostViewPosition()}getCursorColumnSelectData(){if(this._columnSelectData)return this._columnSelectData;let i=this._cursors.getPrimaryCursor(),e=i.viewState.selectionStart.getStartPosition(),t=i.viewState.position;return{isReal:!1,fromViewLineNumber:e.lineNumber,fromViewVisualColumn:this.context.cursorConfig.visibleColumnFromColumn(this._viewModel,e),toViewLineNumber:t.lineNumber,toViewVisualColumn:this.context.cursorConfig.visibleColumnFromColumn(this._viewModel,t)}}getSelections(){return this._cursors.getSelections()}getPosition(){return this._cursors.getPrimaryCursor().modelState.position}setSelections(i,e,t,o){this.setStates(i,e,o,js.fromModelSelections(t))}getPrevEditOperationType(){return this._prevEditOperationType}setPrevEditOperationType(i){this._prevEditOperationType=i}_pushAutoClosedAction(i,e){let t=[],o=[];for(let s=0,l=i.length;s<l;s++)t.push({range:i[s],options:{description:"auto-closed-character",inlineClassName:"auto-closed-character",stickiness:1}}),o.push({range:e[s],options:{description:"auto-closed-enclosing",stickiness:1}});let n=this._model.deltaDecorations([],t),r=this._model.deltaDecorations([],o);this._autoClosedActions.push(new tyt(this._model,n,r))}_executeEditOperation(i,e){if(!i)return;i.shouldPushStackElementBefore&&this._model.pushStackElement();let t=oY.executeCommands(this._model,this._cursors.getSelections(),i.commands,e);if(t){this._interpretCommandResult(t);let o=[],n=[];for(let r=0;r<i.commands.length;r++){let s=i.commands[r];s instanceof sye&&s.enclosingRange&&s.closeCharacterRange&&(o.push(s.closeCharacterRange),n.push(s.enclosingRange))}o.length>0&&this._pushAutoClosedAction(o,n),this._prevEditOperationType=i.type}i.shouldPushStackElementAfter&&this._model.pushStackElement()}_interpretCommandResult(i){(!i||i.length===0)&&(i=this._cursors.readSelectionFromMarkers()),this._columnSelectData=null,this._cursors.setSelections(i),this._cursors.normalize()}_emitStateChangedIfNecessary(i,e,t,o,n){let r=G5e.from(this._model,this);if(r.equals(o))return!1;let s=this._cursors.getSelections(),l=this._cursors.getViewSelections();if(i.emitViewEvent(new Yft(l,s,t)),!o||o.cursorState.length!==r.cursorState.length||r.cursorState.some((c,u)=>!c.modelState.equals(o.cursorState[u].modelState))){let c=o?o.cursorState.map(p=>p.modelState.selection):null,u=o?o.modelVersionId:0;i.emitOutgoingEvent(new GIt(c,s,u,r.modelVersionId,e||"keyboard",t,n))}return!0}_findAutoClosingPairs(i){if(!i.length)return null;let e=[];for(let t=0,o=i.length;t<o;t++){let n=i[t];if(!n.text||n.text.indexOf(`
`)>=0)return null;let r=n.text.match(/([)\]}>'"`])([^)\]}>'"`]*)$/);if(!r)return null;let s=r[1],l=this.context.cursorConfig.autoClosingPairs.autoClosingPairsCloseSingleChar.get(s);if(!l||l.length!==1)return null;let c=l[0].open,u=n.text.length-r[2].length-1,p=n.text.lastIndexOf(c,u-1);if(p===-1)return null;e.push([p,u])}return e}executeEdits(i,e,t,o,n){let r=null;e==="snippet"&&(r=this._findAutoClosingPairs(t)),r&&(t[0]._isTracked=!0);let s=[],l=[],c=this._model.pushEditOperations(this.getSelections(),t,u=>{if(r)for(let h=0,g=r.length;h<g;h++){let[f,v]=r[h],b=u[h],S=b.range.startLineNumber,y=b.range.startColumn-1+f,w=b.range.startColumn-1+v;s.push(new z(S,w+1,S,w+2)),l.push(new z(S,y+1,S,w+2))}let p=o(u);return p&&(this._isHandling=!0),p},void 0,n);c&&(this._isHandling=!1,this.setSelections(i,e,c,0)),s.length>0&&this._pushAutoClosedAction(s,l)}_executeEdit(i,e,t,o=0){if(this.context.cursorConfig.readOnly)return;let n=G5e.from(this._model,this);this._cursors.stopTrackingSelections(),this._isHandling=!0;try{this._cursors.ensureValidState(),i()}catch(r){mt(r)}this._isHandling=!1,this._cursors.startTrackingSelections(),this._validateAutoClosedActions(),this._emitStateChangedIfNecessary(e,t,o,n,!1)&&this.revealAll(e,t,!1,0,!0,0)}getAutoClosedCharacters(){return tyt.getAllAutoClosedCharacters(this._autoClosedActions)}startComposition(i){this._compositionState=new nni(this._model,this.getSelections())}endComposition(i,e){let t=Wc.cursor({kind:"compositionEnd",detailedSource:e}),o=this._compositionState?this._compositionState.deduceOutcome(this._model,this.getSelections()):null;this._compositionState=null,this._executeEdit(()=>{e==="keyboard"&&this._executeEditOperation(CP.compositionEndWithInterceptors(this._prevEditOperationType,this.context.cursorConfig,this._model,o,this.getSelections(),this.getAutoClosedCharacters()),t)},i,e)}type(i,e,t){let o=Wc.cursor({kind:"type",detailedSource:t});this._executeEdit(()=>{if(t==="keyboard"){let n=e.length,r=0;for(;r<n;){let s=pIe(e,r),l=e.substr(r,s);this._executeEditOperation(CP.typeWithInterceptors(!!this._compositionState,this._prevEditOperationType,this.context.cursorConfig,this._model,this.getSelections(),this.getAutoClosedCharacters(),l),o),r+=s}}else this._executeEditOperation(CP.typeWithoutInterceptors(this._prevEditOperationType,this.context.cursorConfig,this._model,this.getSelections(),e),o)},i,t)}compositionType(i,e,t,o,n,r){let s=Wc.cursor({kind:"compositionType",detailedSource:r});if(e.length===0&&t===0&&o===0){if(n!==0){let l=this.getSelections().map(c=>{let u=c.getPosition();return new ti(u.lineNumber,u.column+n,u.lineNumber,u.column+n)});this.setSelections(i,r,l,0)}return}this._executeEdit(()=>{this._executeEditOperation(CP.compositionType(this._prevEditOperationType,this.context.cursorConfig,this._model,this.getSelections(),e,t,o,n),s)},i,r)}paste(i,e,t,o,n){let r=Wc.cursor({kind:"paste",detailedSource:n});this._executeEdit(()=>{this._executeEditOperation(CP.paste(this.context.cursorConfig,this._model,this.getSelections(),e,t,o||[]),r)},i,n,4)}cut(i,e){let t=Wc.cursor({kind:"cut",detailedSource:e});this._executeEdit(()=>{this._executeEditOperation(gO.cut(this.context.cursorConfig,this._model,this.getSelections()),t)},i,e)}executeCommand(i,e,t){let o=Wc.cursor({kind:"executeCommand",detailedSource:t});this._executeEdit(()=>{this._cursors.killSecondaryCursors(),this._executeEditOperation(new ab(0,[e],{shouldPushStackElementBefore:!1,shouldPushStackElementAfter:!1}),o)},i,t)}executeCommands(i,e,t){let o=Wc.cursor({kind:"executeCommands",detailedSource:t});this._executeEdit(()=>{this._executeEditOperation(new ab(0,e,{shouldPushStackElementBefore:!1,shouldPushStackElementAfter:!1}),o)},i,t)}},G5e=class a{constructor(i,e){this.modelVersionId=i;this.cursorState=e}static from(i,e){return new a(i.getVersionId(),e.getCursorStates())}equals(i){if(!i||this.modelVersionId!==i.modelVersionId||this.cursorState.length!==i.cursorState.length)return!1;for(let e=0,t=this.cursorState.length;e<t;e++)if(!this.cursorState[e].equals(i.cursorState[e]))return!1;return!0}},tyt=class{static getAllAutoClosedCharacters(i){let e=[];for(let t of i)e=e.concat(t.getAutoClosedCharactersRanges());return e}constructor(i,e,t){this._model=i,this._autoClosedCharactersDecorations=e,this._autoClosedEnclosingDecorations=t}dispose(){this._autoClosedCharactersDecorations=this._model.deltaDecorations(this._autoClosedCharactersDecorations,[]),this._autoClosedEnclosingDecorations=this._model.deltaDecorations(this._autoClosedEnclosingDecorations,[])}getAutoClosedCharactersRanges(){let i=[];for(let e=0;e<this._autoClosedCharactersDecorations.length;e++){let t=this._model.getDecorationRange(this._autoClosedCharactersDecorations[e]);t&&i.push(t)}return i}isValid(i){let e=[];for(let t=0;t<this._autoClosedEnclosingDecorations.length;t++){let o=this._model.getDecorationRange(this._autoClosedEnclosingDecorations[t]);if(o&&(e.push(o),o.startLineNumber!==o.endLineNumber))return!1}e.sort(z.compareRangesUsingStarts),i.sort(z.compareRangesUsingStarts);for(let t=0;t<i.length;t++)if(t>=e.length||!e[t].strictContainsRange(i[t]))return!1;return!0}},oY=class{static executeCommands(i,e,t,o=Wc.unknown({name:"executeCommands"})){let n={model:i,selectionsBefore:e,trackedRanges:[],trackedRangesDirection:[]},r=this._innerExecuteCommands(n,t,o);for(let s=0,l=n.trackedRanges.length;s<l;s++)n.model._setTrackedRange(n.trackedRanges[s],null,0);return r}static _innerExecuteCommands(i,e,t){if(this._arrayIsEmpty(e))return null;let o=this._getEditOperations(i,e);if(o.operations.length===0)return null;let n=o.operations,r=this._getLoserCursorMap(n);if(r.hasOwnProperty("0"))return console.warn("Ignoring commands"),null;let s=[];for(let u=0,p=n.length;u<p;u++)r.hasOwnProperty(n[u].identifier.major.toString())||s.push(n[u]);o.hadTrackedEditOperation&&s.length>0&&(s[0]._isTracked=!0);let l=i.model.pushEditOperations(i.selectionsBefore,s,u=>{let p=[];for(let f=0;f<i.selectionsBefore.length;f++)p[f]=[];for(let f of u)f.identifier&&p[f.identifier.major].push(f);let h=(f,v)=>f.identifier.minor-v.identifier.minor,g=[];for(let f=0;f<i.selectionsBefore.length;f++)p[f].length>0?(p[f].sort(h),g[f]=e[f].computeCursorState(i.model,{getInverseEditOperations:()=>p[f],getTrackedSelection:v=>{let b=parseInt(v,10),S=i.model._getTrackedRange(i.trackedRanges[b]);return i.trackedRangesDirection[b]===0?new ti(S.startLineNumber,S.startColumn,S.endLineNumber,S.endColumn):new ti(S.endLineNumber,S.endColumn,S.startLineNumber,S.startColumn)}})):g[f]=i.selectionsBefore[f];return g},void 0,t);l||(l=i.selectionsBefore);let c=[];for(let u in r)r.hasOwnProperty(u)&&c.push(parseInt(u,10));c.sort((u,p)=>p-u);for(let u of c)l.splice(u,1);return l}static _arrayIsEmpty(i){for(let e=0,t=i.length;e<t;e++)if(i[e])return!1;return!0}static _getEditOperations(i,e){let t=[],o=!1;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s){let l=this._getEditOperationsFromCommand(i,n,s);t=t.concat(l.operations),o=o||l.hadTrackedEditOperation}}return{operations:t,hadTrackedEditOperation:o}}static _getEditOperationsFromCommand(i,e,t){let o=[],n=0,r=(p,h,g=!1)=>{z.isEmpty(p)&&h===""||o.push({identifier:{major:e,minor:n++},range:p,text:h,forceMoveMarkers:g,isAutoWhitespaceEdit:t.insertsAutoWhitespace})},s=!1,u={addEditOperation:r,addTrackedEditOperation:(p,h,g)=>{s=!0,r(p,h,g)},trackSelection:(p,h)=>{let g=ti.liftSelection(p),f;if(g.isEmpty())if(typeof h=="boolean")h?f=2:f=3;else{let S=i.model.getLineMaxColumn(g.startLineNumber);g.startColumn===S?f=2:f=3}else f=1;let v=i.trackedRanges.length,b=i.model._setTrackedRange(null,g,f);return i.trackedRanges[v]=b,i.trackedRangesDirection[v]=g.getDirection(),v.toString()}};try{t.getEditOperations(i.model,u)}catch(p){return mt(p),{operations:[],hadTrackedEditOperation:!1}}return{operations:o,hadTrackedEditOperation:s}}static _getLoserCursorMap(i){i=i.slice(0),i.sort((t,o)=>-z.compareRangesUsingEnds(t.range,o.range));let e={};for(let t=1;t<i.length;t++){let o=i[t-1],n=i[t];if(z.getStartPosition(o.range).isBefore(z.getEndPosition(n.range))){let r;o.identifier.major>n.identifier.major?r=o.identifier.major:r=n.identifier.major,e[r.toString()]=!0;for(let s=0;s<i.length;s++)i[s].identifier.major===r&&(i.splice(s,1),s<t&&t--,s--);t>0&&t--}}return e}},oni=class{constructor(i,e,t,o){this.text=i;this.lineNumber=e;this.startSelectionOffset=t;this.endSelectionOffset=o}},nni=class a{static _capture(i,e){let t=[];for(let o of e){if(o.startLineNumber!==o.endLineNumber)return null;let n=o.startLineNumber;t.push(new oni(i.getLineContent(n),n,o.startColumn-1,o.endColumn-1))}return t}constructor(i,e){this._original=a._capture(i,e)}deduceOutcome(i,e){if(!this._original)return null;let t=a._capture(i,e);if(!t||this._original.length!==t.length)return null;let o=[];for(let n=0,r=this._original.length;n<r;n++)o.push(a._deduceOutcome(this._original[n],t[n]));return o}static _deduceOutcome(i,e){let t=Math.min(i.startSelectionOffset,e.startSelectionOffset,tf(i.text,e.text)),o=Math.min(i.text.length-i.endSelectionOffset,e.text.length-e.endSelectionOffset,vC(i.text,e.text)),n=i.text.substring(t,i.text.length-o),r=t,s=e.text.length-o,l=e.text.substring(r,s),c=new z(e.lineNumber,r+1,e.lineNumber,s+1);return new qft(n,i.startSelectionOffset-t,i.endSelectionOffset-t,l,e.startSelectionOffset-t,e.endSelectionOffset-t,c)}};var rni={getInitialState:()=>Uoi,tokenizeEncoded:(a,i,e)=>sCe(0,e)};function iyt(a,i,e){return sni(i,a.languageIdCodec,ic.get(e)||rni)}async function fz(a,i,e){if(!e)return sni(i,a.languageIdCodec,rni);let t=await ic.getOrCreate(e);return sni(i,a.languageIdCodec,t||rni)}function oyt(a,i,e,t,o,n,r){let s="<div>",l=0,c=0,u=!0;for(let p=0,h=i.getCount();p<h;p++){let g=i.getEndOffset(p),f="";for(;l<g&&l<o;l++){let v=a.charCodeAt(l),b=v===9;if(c+=h_(v)?2:b?0:1,l<t){if(b){let S=c%n;c+=S===0?n:n-S}continue}switch(v){case 9:{let S=c%n,y=S===0?n:n-S;c+=y;let w=y;for(;w>0;)r&&u?(f+="&#160;",u=!1):(f+=" ",u=!0),w--;break}case 60:f+="&lt;",u=!1;break;case 62:f+="&gt;",u=!1;break;case 38:f+="&amp;",u=!1;break;case 0:f+="&#00;",u=!1;break;case 65279:case 8232:case 8233:case 133:f+="\uFFFD",u=!1;break;case 13:f+="&#8203",u=!1;break;case 32:r&&u?(f+="&#160;",u=!1):(f+=" ",u=!0);break;default:f+=String.fromCharCode(v),u=!1}}if(!(g<=t)&&(s+=`<span style="${i.getInlineStyle(p,e)}">${f}</span>`,g>o||l>=o||t>=o))break}return s+="</div>",s}function sni(a,i,e){let t='<div class="monaco-tokenized-source">',o=yc(a),n=e.getInitialState();for(let r=0,s=o.length;r<s;r++){let l=o[r];r>0&&(t+="<br/>");let c=e.tokenizeEncoded(l,!0,n);Zc.convertToEndOffset(c.tokens,l.length);let p=new Zc(c.tokens,l,i).inflate(),h=0;for(let g=0,f=p.getCount();g<f;g++){let v=p.getClassName(g),b=p.getEndOffset(g);t+=`<span class="${v}">${mr(l.substring(h,b))}</span>`,h=b}n=c.endState}return t+="</div>",t}var ani=class{constructor(i,e,t,o,n){this.decorationId=i,this.index=e,this.lineNumber=t,this.specialHeight=o,this.prefixSum=n,this.maximumSpecialHeight=o,this.deleted=!1}},q5e=class{constructor(i,e){this._decorationIDToCustomLine=new uCe;this._orderedCustomLines=[];this._pendingChanges=[];this._invalidIndex=1/0;this._hasPending=!1;this._defaultLineHeight=i;for(let t of e)this.insertOrChangeCustomLineHeight(t.decorationId,t.startLineNumber,t.endLineNumber,t.lineHeight)}set defaultLineHeight(i){this._defaultLineHeight=i}get defaultLineHeight(){return this._defaultLineHeight}removeCustomLineHeight(i){this._pendingChanges.push({kind:1,decorationId:i}),this._hasPending=!0}insertOrChangeCustomLineHeight(i,e,t,o){this._pendingChanges.push({kind:0,decorationId:i,startLineNumber:e,endLineNumber:t,lineHeight:o}),this._hasPending=!0}heightForLineNumber(i){this._commit();let e=this._binarySearchOverOrderedCustomLinesArray(i);return e>=0?this._orderedCustomLines[e].maximumSpecialHeight:this._defaultLineHeight}getAccumulatedLineHeightsIncludingLineNumber(i){this._commit();let e=this._binarySearchOverOrderedCustomLinesArray(i);if(e>=0)return this._orderedCustomLines[e].prefixSum+this._orderedCustomLines[e].maximumSpecialHeight;if(e===-1)return this._defaultLineHeight*i;let t=-(e+1),o=this._orderedCustomLines[t-1];return o.prefixSum+o.maximumSpecialHeight+this._defaultLineHeight*(i-o.lineNumber)}onLinesDeleted(i,e){this._pendingChanges.push({kind:2,fromLineNumber:i,toLineNumber:e}),this._hasPending=!0}onLinesInserted(i,e){this._pendingChanges.push({kind:3,fromLineNumber:i,toLineNumber:e}),this._hasPending=!0}_commit(){if(!this._hasPending)return;let i=this._pendingChanges;this._pendingChanges=[],this._hasPending=!1;let e=[],t=new uCe;for(let o of i)switch(o.kind){case 1:this._doRemoveCustomLineHeight(o.decorationId,t);break;case 0:this._doInsertOrChangeCustomLineHeight(o.decorationId,o.startLineNumber,o.endLineNumber,o.lineHeight,e,t);break;case 2:this._flushStagedDecorationChanges(e,t),this._doLinesDeleted(o.fromLineNumber,o.toLineNumber);break;case 3:this._flushStagedDecorationChanges(e,t),this._doLinesInserted(o.fromLineNumber,o.toLineNumber,e,t);break}this._flushStagedDecorationChanges(e,t)}_doRemoveCustomLineHeight(i,e){let t=this._decorationIDToCustomLine.get(i);if(t){this._decorationIDToCustomLine.delete(i);for(let n of t)n.deleted=!0,this._invalidIndex=Math.min(this._invalidIndex,n.index)}let o=e.get(i);if(o){e.delete(i);for(let n of o)n.deleted=!0}}_doInsertOrChangeCustomLineHeight(i,e,t,o,n,r){this._doRemoveCustomLineHeight(i,r);for(let s=e;s<=t;s++){let l=new ani(i,-1,s,o,0);n.push(l),r.add(i,l)}}_flushStagedDecorationChanges(i,e){if(i.length===0&&this._invalidIndex===1/0)return;for(let s of i){if(s.deleted)continue;let l=this._binarySearchOverOrderedCustomLinesArray(s.lineNumber),c=l>=0?l:-(l+1);this._orderedCustomLines.splice(c,0,s),this._invalidIndex=Math.min(this._invalidIndex,c)}if(i.length=0,e.clear(),this._invalidIndex===1/0)return;let t=new uCe,o=[];for(let s=0;s<this._invalidIndex;s++){let l=this._orderedCustomLines[s];o.push(l),t.add(l.decorationId,l)}let n=0,r=this._invalidIndex>0?o[this._invalidIndex-1]:void 0;for(let s=this._invalidIndex;s<this._orderedCustomLines.length;s++){let l=this._orderedCustomLines[s];if(l.deleted){n++;continue}if(l.index=s-n,r&&r.lineNumber===l.lineNumber)l.maximumSpecialHeight=r.maximumSpecialHeight,l.prefixSum=r.prefixSum;else{let c=l.specialHeight;for(let p=s;p<this._orderedCustomLines.length;p++){let h=this._orderedCustomLines[p];if(!h.deleted){if(h.lineNumber!==l.lineNumber)break;c=Math.max(c,h.specialHeight)}}l.maximumSpecialHeight=c;let u;r?u=r.prefixSum+r.maximumSpecialHeight+this._defaultLineHeight*(l.lineNumber-r.lineNumber-1):u=this._defaultLineHeight*(l.lineNumber-1),l.prefixSum=u}r=l,o.push(l),t.add(l.decorationId,l)}this._orderedCustomLines=o,this._decorationIDToCustomLine=t,this._invalidIndex=1/0}_doLinesDeleted(i,e){let t=e-i+1,o=this._orderedCustomLines.length,n=this._binarySearchOverOrderedCustomLinesArray(i),r;if(n>=0){r=n;for(let p=n-1;p>=0&&this._orderedCustomLines[p].lineNumber===i;p--)r--}else r=n===-(o+1)&&n!==-1?o-1:-(n+1);let s=this._binarySearchOverOrderedCustomLinesArray(e),l;if(s>=0){l=s;for(let p=s+1;p<o&&this._orderedCustomLines[p].lineNumber===e;p++)l++}else l=s===-(o+1)&&s!==-1?o-1:-(s+1);let c=l>r,u=l===r&&this._orderedCustomLines[r]&&this._orderedCustomLines[r].lineNumber>=i&&this._orderedCustomLines[r].lineNumber<=e;if(c||u){let p=0;for(let P=r;P<=l;P++)p=Math.max(p,this._orderedCustomLines[P].maximumSpecialHeight);let h=0;if(r>0){let P=this._orderedCustomLines[r-1];h=P.prefixSum+P.maximumSpecialHeight+this._defaultLineHeight*(i-P.lineNumber-1)}else h=i>0?(i-1)*this._defaultLineHeight:0;let g=this._orderedCustomLines[r],f=this._orderedCustomLines[l],v=this._orderedCustomLines[l+1],b=v&&v.lineNumber===e+1?v.maximumSpecialHeight:this._defaultLineHeight,S=f.prefixSum+f.maximumSpecialHeight-g.prefixSum+this._defaultLineHeight*(e-f.lineNumber)+this._defaultLineHeight*(g.lineNumber-i)+b-p,y=new Set,w=[],k=new uCe,T=0;for(let P=0;P<this._orderedCustomLines.length;P++){let O=this._orderedCustomLines[P];if(P<r)w.push(O),k.add(O.decorationId,O);else if(P>=r&&P<=l){let V=O.decorationId;y.has(V)?T++:(O.index-=T,O.lineNumber=i,O.prefixSum=h,O.maximumSpecialHeight=p,w.push(O),k.add(O.decorationId,O))}else P>l&&(O.index-=T,O.lineNumber-=t,O.prefixSum-=S,w.push(O),k.add(O.decorationId,O));y.add(O.decorationId)}this._orderedCustomLines=w,this._decorationIDToCustomLine=k}else{let p=t*this._defaultLineHeight;for(let h=l;h<this._orderedCustomLines.length;h++){let g=this._orderedCustomLines[h];g.lineNumber>e&&(g.lineNumber-=t,g.prefixSum-=p)}}}_doLinesInserted(i,e,t,o){let n=e-i+1,r=this._binarySearchOverOrderedCustomLinesArray(i),s;if(r>=0){s=r;for(let g=r-1;g>=0&&this._orderedCustomLines[g].lineNumber===i;g--)s--}else s=-(r+1);let l=[],c=new Set;for(let g=s;g<this._orderedCustomLines.length;g++)this._orderedCustomLines[g].lineNumber===i&&c.add(this._orderedCustomLines[g].decorationId);let u=new Set;for(let g=s-1;g>=0;g--)this._orderedCustomLines[g].lineNumber===i-1&&u.add(this._orderedCustomLines[g].decorationId);let p=tht(u,c),h=n*this._defaultLineHeight;for(let g=s;g<this._orderedCustomLines.length;g++)this._orderedCustomLines[g].lineNumber+=n,this._orderedCustomLines[g].prefixSum+=h;if(p.size>0){for(let g of p){let f=this._decorationIDToCustomLine.get(g);if(f){let v=f.reduce((y,w)=>Math.min(y,w.lineNumber),i),b=f.reduce((y,w)=>Math.max(y,w.lineNumber),i),S=f.reduce((y,w)=>Math.max(y,w.specialHeight),0);l.push({decorationId:g,startLineNumber:v,endLineNumber:b,lineHeight:S})}}for(let g of l)this._doInsertOrChangeCustomLineHeight(g.decorationId,g.startLineNumber,g.endLineNumber,g.lineHeight,t,o)}}_binarySearchOverOrderedCustomLinesArray(i){return aP(this._orderedCustomLines.length,e=>{let t=this._orderedCustomLines[e];return t.lineNumber===i?0:t.lineNumber<i?-1:1})}},$5e=class a{constructor(i,e,t,o){this.decorationId=i;this.startLineNumber=e;this.endLineNumber=t;this.lineHeight=o}static fromDecorations(i,e,t){let o=t.options.get(75);return i.map(n=>{let r=e.convertModelRangeToViewRange(n.range);return new a(n.id,r.startLineNumber,r.endLineNumber,n.options.lineHeight?n.options.lineHeight*o:0)})}},uCe=class{constructor(){this._map=new Map}add(i,e){let t=this._map.get(i);t?t.push(e):this._map.set(i,[e])}get(i){return this._map.get(i)}delete(i){this._map.delete(i)}clear(){this._map.clear()}};var lni=class{constructor(){this._hasPending=!1,this._inserts=[],this._changes=[],this._removes=[]}insert(i){this._hasPending=!0,this._inserts.push(i)}change(i){this._hasPending=!0,this._changes.push(i)}remove(i){this._hasPending=!0,this._removes.push(i)}commit(i){if(!this._hasPending)return;let e=this._inserts,t=this._changes,o=this._removes;this._hasPending=!1,this._inserts=[],this._changes=[],this._removes=[],i._commitPendingChanges(e,t,o)}},cni=class{constructor(i,e,t,o,n){this.id=i,this.afterLineNumber=e,this.ordinal=t,this.height=o,this.minWidth=n,this.prefixSum=0}},nyt=class a{static{this.INSTANCE_COUNT=0}constructor(i,e,t,o,n){this._instanceId=mIe(++a.INSTANCE_COUNT),this._pendingChanges=new lni,this._lastWhitespaceId=0,this._arr=[],this._prefixSumValidIndex=-1,this._minWidth=-1,this._lineCount=i,this._paddingTop=t,this._paddingBottom=o,this._lineHeightsManager=new q5e(e,n)}static findInsertionIndex(i,e,t){let o=0,n=i.length;for(;o<n;){let r=o+n>>>1;e===i[r].afterLineNumber?t<i[r].ordinal?n=r:o=r+1:e<i[r].afterLineNumber?n=r:o=r+1}return o}setDefaultLineHeight(i){this._lineHeightsManager.defaultLineHeight=i}setPadding(i,e){this._paddingTop=i,this._paddingBottom=e}onFlushed(i,e){this._lineCount=i,this._lineHeightsManager=new q5e(this._lineHeightsManager.defaultLineHeight,e)}changeLineHeights(i){let e=!1;return i({insertOrChangeCustomLineHeight:(o,n,r,s)=>{e=!0,this._lineHeightsManager.insertOrChangeCustomLineHeight(o,n,r,s)},removeCustomLineHeight:o=>{e=!0,this._lineHeightsManager.removeCustomLineHeight(o)}}),e}changeWhitespace(i){let e=!1;try{i({insertWhitespace:(o,n,r,s)=>{e=!0,o=o|0,n=n|0,r=r|0,s=s|0;let l=this._instanceId+ ++this._lastWhitespaceId;return this._pendingChanges.insert(new cni(l,o,n,r,s)),l},changeOneWhitespace:(o,n,r)=>{e=!0,n=n|0,r=r|0,this._pendingChanges.change({id:o,newAfterLineNumber:n,newHeight:r})},removeWhitespace:o=>{e=!0,this._pendingChanges.remove({id:o})}})}finally{this._pendingChanges.commit(this)}return e}_commitPendingChanges(i,e,t){if((i.length>0||t.length>0)&&(this._minWidth=-1),i.length+e.length+t.length<=1){for(let l of i)this._insertWhitespace(l);for(let l of e)this._changeOneWhitespace(l.id,l.newAfterLineNumber,l.newHeight);for(let l of t){let c=this._findWhitespaceIndex(l.id);c!==-1&&this._removeWhitespace(c)}return}let o=new Set;for(let l of t)o.add(l.id);let n=new Map;for(let l of e)n.set(l.id,l);let r=l=>{let c=[];for(let u of l)if(!o.has(u.id)){if(n.has(u.id)){let p=n.get(u.id);u.afterLineNumber=p.newAfterLineNumber,u.height=p.newHeight}c.push(u)}return c},s=r(this._arr).concat(r(i));s.sort((l,c)=>l.afterLineNumber===c.afterLineNumber?l.ordinal-c.ordinal:l.afterLineNumber-c.afterLineNumber),this._arr=s,this._prefixSumValidIndex=-1}_insertWhitespace(i){let e=a.findInsertionIndex(this._arr,i.afterLineNumber,i.ordinal);this._arr.splice(e,0,i),this._prefixSumValidIndex=Math.min(this._prefixSumValidIndex,e-1)}_findWhitespaceIndex(i){let e=this._arr;for(let t=0,o=e.length;t<o;t++)if(e[t].id===i)return t;return-1}_changeOneWhitespace(i,e,t){let o=this._findWhitespaceIndex(i);if(o!==-1&&(this._arr[o].height!==t&&(this._arr[o].height=t,this._prefixSumValidIndex=Math.min(this._prefixSumValidIndex,o-1)),this._arr[o].afterLineNumber!==e)){let n=this._arr[o];this._removeWhitespace(o),n.afterLineNumber=e,this._insertWhitespace(n)}}_removeWhitespace(i){this._arr.splice(i,1),this._prefixSumValidIndex=Math.min(this._prefixSumValidIndex,i-1)}onLinesDeleted(i,e){i=i|0,e=e|0,this._lineCount-=e-i+1;for(let t=0,o=this._arr.length;t<o;t++){let n=this._arr[t].afterLineNumber;i<=n&&n<=e?this._arr[t].afterLineNumber=i-1:n>e&&(this._arr[t].afterLineNumber-=e-i+1)}this._lineHeightsManager.onLinesDeleted(i,e)}onLinesInserted(i,e){i=i|0,e=e|0,this._lineCount+=e-i+1;for(let t=0,o=this._arr.length;t<o;t++){let n=this._arr[t].afterLineNumber;i<=n&&(this._arr[t].afterLineNumber+=e-i+1)}this._lineHeightsManager.onLinesInserted(i,e)}getWhitespacesTotalHeight(){return this._arr.length===0?0:this.getWhitespacesAccumulatedHeight(this._arr.length-1)}getWhitespacesAccumulatedHeight(i){i=i|0;let e=Math.max(0,this._prefixSumValidIndex+1);e===0&&(this._arr[0].prefixSum=this._arr[0].height,e++);for(let t=e;t<=i;t++)this._arr[t].prefixSum=this._arr[t-1].prefixSum+this._arr[t].height;return this._prefixSumValidIndex=Math.max(this._prefixSumValidIndex,i),this._arr[i].prefixSum}getLinesTotalHeight(){let i=this._lineHeightsManager.getAccumulatedLineHeightsIncludingLineNumber(this._lineCount),e=this.getWhitespacesTotalHeight();return i+e+this._paddingTop+this._paddingBottom}getWhitespaceAccumulatedHeightBeforeLineNumber(i){i=i|0;let e=this._findLastWhitespaceBeforeLineNumber(i);return e===-1?0:this.getWhitespacesAccumulatedHeight(e)}_findLastWhitespaceBeforeLineNumber(i){i=i|0;let e=this._arr,t=0,o=e.length-1;for(;t<=o;){let r=(o-t|0)/2|0,s=t+r|0;if(e[s].afterLineNumber<i){if(s+1>=e.length||e[s+1].afterLineNumber>=i)return s;t=s+1|0}else o=s-1|0}return-1}_findFirstWhitespaceAfterLineNumber(i){i=i|0;let t=this._findLastWhitespaceBeforeLineNumber(i)+1;return t<this._arr.length?t:-1}getFirstWhitespaceIndexAfterLineNumber(i){return i=i|0,this._findFirstWhitespaceAfterLineNumber(i)}getVerticalOffsetForLineNumber(i,e=!1){i=i|0;let t;i>1?t=this._lineHeightsManager.getAccumulatedLineHeightsIncludingLineNumber(i-1):t=0;let o=this.getWhitespaceAccumulatedHeightBeforeLineNumber(i-(e?1:0));return t+o+this._paddingTop}getLineHeightForLineNumber(i){return this._lineHeightsManager.heightForLineNumber(i)}getVerticalOffsetAfterLineNumber(i,e=!1){i=i|0;let t=this._lineHeightsManager.getAccumulatedLineHeightsIncludingLineNumber(i),o=this.getWhitespaceAccumulatedHeightBeforeLineNumber(i+(e?1:0));return t+o+this._paddingTop}hasWhitespace(){return this.getWhitespacesCount()>0}getWhitespaceMinWidth(){if(this._minWidth===-1){let i=0;for(let e=0,t=this._arr.length;e<t;e++)i=Math.max(i,this._arr[e].minWidth);this._minWidth=i}return this._minWidth}isAfterLines(i){let e=this.getLinesTotalHeight();return i>e}isInTopPadding(i){return this._paddingTop===0?!1:i<this._paddingTop}isInBottomPadding(i){if(this._paddingBottom===0)return!1;let e=this.getLinesTotalHeight();return i>=e-this._paddingBottom}getLineNumberAtOrAfterVerticalOffset(i){if(i=i|0,i<0)return 1;let e=this._lineCount|0,t=1,o=e;for(;t<o;){let n=(t+o)/2|0,r=this.getLineHeightForLineNumber(n),s=this.getVerticalOffsetForLineNumber(n)|0;if(i>=s+r)t=n+1;else{if(i>=s)return n;o=n}}return t>e?e:t}getLinesViewportData(i,e){i=i|0,e=e|0;let t=this.getLineNumberAtOrAfterVerticalOffset(i)|0,o=this.getVerticalOffsetForLineNumber(t)|0,n=this._lineCount|0,r=this.getFirstWhitespaceIndexAfterLineNumber(t)|0,s=this.getWhitespacesCount()|0,l,c;r===-1?(r=s,c=n+1,l=0):(c=this.getAfterLineNumberForWhitespaceIndex(r)|0,l=this.getHeightForWhitespaceIndex(r)|0);let u=o,p=u,h=5e5,g=0;o>=h&&(g=Math.floor(o/h)*h,g=Math.floor(g/this._lineHeightsManager.defaultLineHeight)*this._lineHeightsManager.defaultLineHeight,p-=g);let f=[],v=i+(e-i)/2,b=-1;for(let k=t;k<=n;k++){let T=this.getLineHeightForLineNumber(k);if(b===-1){let P=u,O=u+T;(P<=v&&v<O||P>v)&&(b=k)}for(u+=T,f[k-t]=p,p+=T;c===k;)p+=l,u+=l,r++,r>=s?c=n+1:(c=this.getAfterLineNumberForWhitespaceIndex(r)|0,l=this.getHeightForWhitespaceIndex(r)|0);if(u>=e){n=k;break}}b===-1&&(b=n);let S=this.getVerticalOffsetForLineNumber(n)|0,y=t,w=n;if(y<w&&o<i&&y++,y<w){let k=this.getLineHeightForLineNumber(n);S+k>e&&w--}return{bigNumbersDelta:g,startLineNumber:t,endLineNumber:n,relativeVerticalOffset:f,centeredLineNumber:b,completelyVisibleStartLineNumber:y,completelyVisibleEndLineNumber:w,lineHeight:this._lineHeightsManager.defaultLineHeight}}getVerticalOffsetForWhitespaceIndex(i){i=i|0;let e=this.getAfterLineNumberForWhitespaceIndex(i),t;e>=1?t=this._lineHeightsManager.getAccumulatedLineHeightsIncludingLineNumber(e):t=0;let o;return i>0?o=this.getWhitespacesAccumulatedHeight(i-1):o=0,t+o+this._paddingTop}getWhitespaceIndexAtOrAfterVerticallOffset(i){i=i|0;let e=0,t=this.getWhitespacesCount()-1;if(t<0)return-1;let o=this.getVerticalOffsetForWhitespaceIndex(t),n=this.getHeightForWhitespaceIndex(t);if(i>=o+n)return-1;for(;e<t;){let r=Math.floor((e+t)/2),s=this.getVerticalOffsetForWhitespaceIndex(r),l=this.getHeightForWhitespaceIndex(r);if(i>=s+l)e=r+1;else{if(i>=s)return r;t=r}}return e}getWhitespaceAtVerticalOffset(i){i=i|0;let e=this.getWhitespaceIndexAtOrAfterVerticallOffset(i);if(e<0||e>=this.getWhitespacesCount())return null;let t=this.getVerticalOffsetForWhitespaceIndex(e);if(t>i)return null;let o=this.getHeightForWhitespaceIndex(e),n=this.getIdForWhitespaceIndex(e),r=this.getAfterLineNumberForWhitespaceIndex(e);return{id:n,afterLineNumber:r,verticalOffset:t,height:o}}getWhitespaceViewportData(i,e){i=i|0,e=e|0;let t=this.getWhitespaceIndexAtOrAfterVerticallOffset(i),o=this.getWhitespacesCount()-1;if(t<0)return[];let n=[];for(let r=t;r<=o;r++){let s=this.getVerticalOffsetForWhitespaceIndex(r),l=this.getHeightForWhitespaceIndex(r);if(s>=e)break;n.push({id:this.getIdForWhitespaceIndex(r),afterLineNumber:this.getAfterLineNumberForWhitespaceIndex(r),verticalOffset:s,height:l})}return n}getWhitespaces(){return this._arr.slice(0)}getWhitespacesCount(){return this._arr.length}getIdForWhitespaceIndex(i){return i=i|0,this._arr[i].id}getAfterLineNumberForWhitespaceIndex(i){return i=i|0,this._arr[i].afterLineNumber}getHeightForWhitespaceIndex(i){return i=i|0,this._arr[i].height}};var CBo=125,Fle=class{constructor(i,e,t,o){i=i|0,e=e|0,t=t|0,o=o|0,i<0&&(i=0),e<0&&(e=0),t<0&&(t=0),o<0&&(o=0),this.width=i,this.contentWidth=e,this.scrollWidth=Math.max(i,e),this.height=t,this.contentHeight=o,this.scrollHeight=Math.max(t,o)}equals(i){return this.width===i.width&&this.contentWidth===i.contentWidth&&this.height===i.height&&this.contentHeight===i.contentHeight}},dni=class extends x{constructor(e,t){super();this._onDidContentSizeChange=this._register(new E);this.onDidContentSizeChange=this._onDidContentSizeChange.event;this._dimensions=new Fle(0,0,0,0),this._scrollable=this._register(new y_({forceIntegerValues:!0,smoothScrollDuration:e,scheduleAtNextAnimationFrame:t})),this.onDidScroll=this._scrollable.onScroll}getScrollable(){return this._scrollable}setSmoothScrollDuration(e){this._scrollable.setSmoothScrollDuration(e)}validateScrollPosition(e){return this._scrollable.validateScrollPosition(e)}getScrollDimensions(){return this._dimensions}setScrollDimensions(e){if(this._dimensions.equals(e))return;let t=this._dimensions;this._dimensions=e,this._scrollable.setScrollDimensions({width:e.width,scrollWidth:e.scrollWidth,height:e.height,scrollHeight:e.scrollHeight},!0);let o=t.contentWidth!==e.contentWidth,n=t.contentHeight!==e.contentHeight;(o||n)&&this._onDidContentSizeChange.fire(new BIt(t.contentWidth,t.contentHeight,e.contentWidth,e.contentHeight))}getFutureScrollPosition(){return this._scrollable.getFutureScrollPosition()}getCurrentScrollPosition(){return this._scrollable.getCurrentScrollPosition()}setScrollPositionNow(e){this._scrollable.setScrollPositionNow(e)}setScrollPositionSmooth(e){this._scrollable.setScrollPositionSmooth(e)}hasPendingScrollAnimation(){return this._scrollable.hasPendingScrollAnimation()}},ryt=class extends x{constructor(i,e,t,o){super(),this._configuration=i;let n=this._configuration.options,r=n.get(165),s=n.get(96);this._linesLayout=new nyt(e,n.get(75),s.top,s.bottom,t),this._maxLineWidth=0,this._overlayWidgetsMinWidth=0,this._scrollable=this._register(new dni(0,o)),this._configureSmoothScrollDuration(),this._scrollable.setScrollDimensions(new Fle(r.contentWidth,0,r.height,0)),this.onDidScroll=this._scrollable.onDidScroll,this.onDidContentSizeChange=this._scrollable.onDidContentSizeChange,this._updateHeight()}dispose(){super.dispose()}getScrollable(){return this._scrollable.getScrollable()}onHeightMaybeChanged(){this._updateHeight()}_configureSmoothScrollDuration(){this._scrollable.setSmoothScrollDuration(this._configuration.options.get(130)?CBo:0)}onConfigurationChanged(i){let e=this._configuration.options;if(i.hasChanged(75)&&this._linesLayout.setDefaultLineHeight(e.get(75)),i.hasChanged(96)){let t=e.get(96);this._linesLayout.setPadding(t.top,t.bottom)}if(i.hasChanged(165)){let t=e.get(165),o=t.contentWidth,n=t.height,r=this._scrollable.getScrollDimensions(),s=r.contentWidth;this._scrollable.setScrollDimensions(new Fle(o,r.contentWidth,n,this._getContentHeight(o,n,s)))}else this._updateHeight();i.hasChanged(130)&&this._configureSmoothScrollDuration()}onFlushed(i,e){this._linesLayout.onFlushed(i,e)}onLinesDeleted(i,e){this._linesLayout.onLinesDeleted(i,e)}onLinesInserted(i,e){this._linesLayout.onLinesInserted(i,e)}_getHorizontalScrollbarHeight(i,e){let o=this._configuration.options.get(117);return o.horizontal===2||i>=e?0:o.horizontalScrollbarSize}_getContentHeight(i,e,t){let o=this._configuration.options,n=this._linesLayout.getLinesTotalHeight();return o.get(119)?n+=Math.max(0,e-o.get(75)-o.get(96).bottom):o.get(117).ignoreHorizontalScrollbarInContentHeight||(n+=this._getHorizontalScrollbarHeight(i,t)),n}_updateHeight(){let i=this._scrollable.getScrollDimensions(),e=i.width,t=i.height,o=i.contentWidth;this._scrollable.setScrollDimensions(new Fle(e,i.contentWidth,t,this._getContentHeight(e,t,o)))}getCurrentViewport(){let i=this._scrollable.getScrollDimensions(),e=this._scrollable.getCurrentScrollPosition();return new l5e(e.scrollTop,e.scrollLeft,i.width,i.height)}getFutureViewport(){let i=this._scrollable.getScrollDimensions(),e=this._scrollable.getFutureScrollPosition();return new l5e(e.scrollTop,e.scrollLeft,i.width,i.height)}_computeContentWidth(){let i=this._configuration.options,e=this._maxLineWidth,t=i.get(166),o=i.get(59),n=i.get(165);if(t.isViewportWrapping){let r=i.get(81);return e>n.contentWidth+o.typicalHalfwidthCharacterWidth&&r.enabled&&r.side==="right"?e+n.verticalScrollbarWidth:e}else{let r=i.get(118)*o.typicalHalfwidthCharacterWidth,s=this._linesLayout.getWhitespaceMinWidth();return Math.max(e+r+n.verticalScrollbarWidth,s,this._overlayWidgetsMinWidth)}}setMaxLineWidth(i){this._maxLineWidth=i,this._updateContentWidth()}setOverlayWidgetsMinWidth(i){this._overlayWidgetsMinWidth=i,this._updateContentWidth()}_updateContentWidth(){let i=this._scrollable.getScrollDimensions();this._scrollable.setScrollDimensions(new Fle(i.width,this._computeContentWidth(),i.height,i.contentHeight)),this._updateHeight()}saveState(){let i=this._scrollable.getFutureScrollPosition(),e=i.scrollTop,t=this._linesLayout.getLineNumberAtOrAfterVerticalOffset(e),o=this._linesLayout.getWhitespaceAccumulatedHeightBeforeLineNumber(t);return{scrollTop:e,scrollTopWithoutViewZones:e-o,scrollLeft:i.scrollLeft}}changeWhitespace(i){let e=this._linesLayout.changeWhitespace(i);return e&&this.onHeightMaybeChanged(),e}changeSpecialLineHeights(i){let e=this._linesLayout.changeLineHeights(i);return e&&this.onHeightMaybeChanged(),e}getVerticalOffsetForLineNumber(i,e=!1){return this._linesLayout.getVerticalOffsetForLineNumber(i,e)}getVerticalOffsetAfterLineNumber(i,e=!1){return this._linesLayout.getVerticalOffsetAfterLineNumber(i,e)}getLineHeightForLineNumber(i){return this._linesLayout.getLineHeightForLineNumber(i)}isAfterLines(i){return this._linesLayout.isAfterLines(i)}isInTopPadding(i){return this._linesLayout.isInTopPadding(i)}isInBottomPadding(i){return this._linesLayout.isInBottomPadding(i)}getLineNumberAtVerticalOffset(i){return this._linesLayout.getLineNumberAtOrAfterVerticalOffset(i)}getWhitespaceAtVerticalOffset(i){return this._linesLayout.getWhitespaceAtVerticalOffset(i)}getLinesViewportData(){let i=this.getCurrentViewport();return this._linesLayout.getLinesViewportData(i.top,i.top+i.height)}getLinesViewportDataAtScrollTop(i){let e=this._scrollable.getScrollDimensions();return i+e.height>e.scrollHeight&&(i=e.scrollHeight-e.height),i<0&&(i=0),this._linesLayout.getLinesViewportData(i,i+e.height)}getWhitespaceViewportData(){let i=this.getCurrentViewport();return this._linesLayout.getWhitespaceViewportData(i.top,i.top+i.height)}getWhitespaces(){return this._linesLayout.getWhitespaces()}getContentWidth(){return this._scrollable.getScrollDimensions().contentWidth}getScrollWidth(){return this._scrollable.getScrollDimensions().scrollWidth}getContentHeight(){return this._scrollable.getScrollDimensions().contentHeight}getScrollHeight(){return this._scrollable.getScrollDimensions().scrollHeight}getCurrentScrollLeft(){return this._scrollable.getCurrentScrollPosition().scrollLeft}getCurrentScrollTop(){return this._scrollable.getCurrentScrollPosition().scrollTop}validateScrollPosition(i){return this._scrollable.validateScrollPosition(i)}setScrollPosition(i,e){e===1?this._scrollable.setScrollPositionNow(i):this._scrollable.setScrollPositionSmooth(i)}hasPendingScrollAnimation(){return this._scrollable.hasPendingScrollAnimation()}deltaScrollNow(i,e){let t=this._scrollable.getCurrentScrollPosition();this._scrollable.setScrollPositionNow({scrollLeft:t.scrollLeft+i,scrollTop:t.scrollTop+e})}};var syt=class{constructor(i,e,t,o,n){this.editorId=i,this.configuration=t,this._linesCollection=o;let r={getModelDecorations:(s,l,c)=>this._linesCollection.getDecorationsInRange(s,this.editorId,xae(this.configuration.options),kae(this.configuration.options),l,c)};this._inlineDecorationsComputer=new obt(r,e,n),this._cachedModelDecorationsResolver=null,this._cachedModelDecorationsResolverViewRange=null}_clearCachedModelDecorationsResolver(){this._cachedModelDecorationsResolver=null,this._cachedModelDecorationsResolverViewRange=null}dispose(){this._inlineDecorationsComputer.reset(),this._clearCachedModelDecorationsResolver()}reset(){this._inlineDecorationsComputer.reset(),this._clearCachedModelDecorationsResolver()}onModelDecorationsChanged(){this._inlineDecorationsComputer.onModelDecorationsChanged(),this._clearCachedModelDecorationsResolver()}onLineMappingChanged(){this._inlineDecorationsComputer.onLineMappingChanged(),this._clearCachedModelDecorationsResolver()}getMinimapDecorationsInRange(i){return this._inlineDecorationsComputer.getDecorations(i,!0,!1).decorations}getDecorationsViewportData(i){let e=this._cachedModelDecorationsResolver!==null;return e=e&&i.equalsRange(this._cachedModelDecorationsResolverViewRange),e||(this._cachedModelDecorationsResolver=this._inlineDecorationsComputer.getDecorations(i,!1,!1),this._cachedModelDecorationsResolverViewRange=i),this._cachedModelDecorationsResolver}getDecorationsOnLine(i,e=!1,t=!1){let o=new z(i,this._linesCollection.getViewLineMinColumn(i),i,this._linesCollection.getViewLineMaxColumn(i));return this._inlineDecorationsComputer.getDecorations(o,e,t)}};function cyt(a,i){return a===null?i?ayt.INSTANCE:lyt.INSTANCE:new pni(a,i)}var pni=class{constructor(i,e){this._projectionData=i,this._isVisible=e}isVisible(){return this._isVisible}setVisible(i){return this._isVisible=i,this}getProjectionData(){return this._projectionData}getViewLineCount(){return this._isVisible?this._projectionData.getOutputLineCount():0}getViewLineContent(i,e,t){this._assertVisible();let o=t>0?this._projectionData.breakOffsets[t-1]:0,n=this._projectionData.breakOffsets[t],r;if(this._projectionData.injectionOffsets!==null){let s=this._projectionData.injectionOffsets.map((c,u)=>new FO(0,0,c+1,this._projectionData.injectionOptions[u],0));r=FO.applyInjectedText(i.getLineContent(e),s).substring(o,n)}else r=i.getValueInRange({startLineNumber:e,startColumn:o+1,endLineNumber:e,endColumn:n+1});return t>0&&(r=q8i(this._projectionData.wrappedTextIndentLength)+r),r}getViewLineLength(i,e,t){return this._assertVisible(),this._projectionData.getLineLength(t)}getViewLineMinColumn(i,e,t){return this._assertVisible(),this._projectionData.getMinOutputOffset(t)+1}getViewLineMaxColumn(i,e,t){return this._assertVisible(),this._projectionData.getMaxOutputOffset(t)+1}getViewLineData(i,e,t,o){let n=new Array;return this.getViewLinesData(i,e,t,1,o,0,[!0],n),n[0]}getViewLinesData(i,e,t,o,n,r,s,l){this._assertVisible();let c=this._projectionData,u=c.injectionOffsets,p=c.injectionOptions,h={getInjectionOptions:()=>p,getInjectionOffsets:()=>u,getBreakOffsets:()=>c.breakOffsets,getWrappedTextIndentLength:()=>c.wrappedTextIndentLength,getBaseViewLineNumber:()=>n},f=new nbt(h).getInlineDecorations(e),v=i.tokenization.getLineTokens(e),b=z8i(v,p,u);for(let S=t;S<t+o;S++){let y=r+S-t;if(!s[y]){l[y]=null;continue}l[y]=this._getViewLineData(b,f?f[S]:null,S)}}_getViewLineData(i,e,t){this._assertVisible();let o=this._projectionData,n=t>0?o.wrappedTextIndentLength:0,r=t>0?o.breakOffsets[t-1]:0,s=o.breakOffsets[t],l=i.sliceAndInflate(r,s,n),c=l.getLineContent();t>0&&(c=q8i(o.wrappedTextIndentLength)+c);let u=this._projectionData.getMinOutputOffset(t)+1,p=c.length+1,h=t+1<this.getViewLineCount(),g=t===0?0:o.breakOffsetsVisibleColumn[t-1];return new _le(c,h,u,p,g,l,e)}getModelColumnOfViewPosition(i,e){return this._assertVisible(),this._projectionData.translateToInputOffset(i,e-1)+1}getViewPositionOfModelPosition(i,e,t=2){return this._assertVisible(),this._projectionData.translateToOutputPosition(e-1,t).toPosition(i)}getViewLineNumberOfModelPosition(i,e){this._assertVisible();let t=this._projectionData.translateToOutputPosition(e-1);return i+t.outputLineIndex}normalizePosition(i,e,t){let o=e.lineNumber-i;return this._projectionData.normalizeOutputPosition(i,e.column-1,t).toPosition(o)}getInjectedTextAt(i,e){return this._projectionData.getInjectedText(i,e-1)}_assertVisible(){if(!this._isVisible)throw new Error("Not supported")}},ayt=class a{static{this.INSTANCE=new a}constructor(){}isVisible(){return!0}setVisible(i){return i?this:lyt.INSTANCE}getProjectionData(){return null}getViewLineCount(){return 1}getViewLineContent(i,e,t){return i.getLineContent(e)}getViewLineLength(i,e,t){return i.getLineLength(e)}getViewLineMinColumn(i,e,t){return i.getLineMinColumn(e)}getViewLineMaxColumn(i,e,t){return i.getLineMaxColumn(e)}getViewLineData(i,e,t,o){let n=i.tokenization.getLineTokens(e),r=n.getLineContent();return new _le(r,!1,1,r.length+1,0,n.inflate(),null)}getViewLinesData(i,e,t,o,n,r,s,l){if(!s[r]){l[r]=null;return}l[r]=this.getViewLineData(i,e,0,n)}getModelColumnOfViewPosition(i,e){return e}getViewPositionOfModelPosition(i,e){return new ye(i,e)}getViewLineNumberOfModelPosition(i,e){return i}normalizePosition(i,e,t){return e}getInjectedTextAt(i,e){return null}},lyt=class a{static{this.INSTANCE=new a}constructor(){}isVisible(){return!1}setVisible(i){return i?ayt.INSTANCE:this}getProjectionData(){return null}getViewLineCount(){return 0}getViewLineContent(i,e,t){throw new Error("Not supported")}getViewLineLength(i,e,t){throw new Error("Not supported")}getViewLineMinColumn(i,e,t){throw new Error("Not supported")}getViewLineMaxColumn(i,e,t){throw new Error("Not supported")}getViewLineData(i,e,t,o){throw new Error("Not supported")}getViewLinesData(i,e,t,o,n,r,s,l){throw new Error("Not supported")}getModelColumnOfViewPosition(i,e){throw new Error("Not supported")}getViewPositionOfModelPosition(i,e){throw new Error("Not supported")}getViewLineNumberOfModelPosition(i,e){throw new Error("Not supported")}normalizePosition(i,e,t){throw new Error("Not supported")}getInjectedTextAt(i,e){throw new Error("Not supported")}},uni=[""];function q8i(a){if(a>=uni.length)for(let i=1;i<=a;i++)uni[i]=xBo(i);return uni[a]}function xBo(a){return new Array(a+1).join(" ")}var dyt=class{constructor(i){this._model=i}_validPosition(i){return this._model.validatePosition(i)}_validRange(i){return this._model.validateRange(i)}convertViewPositionToModelPosition(i){return this._validPosition(i)}convertViewRangeToModelRange(i){return this._validRange(i)}validateViewPosition(i,e){return this._validPosition(e)}validateViewRange(i,e){return this._validRange(e)}convertModelPositionToViewPosition(i){return this._validPosition(i)}convertModelRangeToViewRange(i){return this._validRange(i)}modelPositionIsVisible(i){let e=this._model.getLineCount();return!(i.lineNumber<1||i.lineNumber>e)}modelRangeIsVisible(i){let e=this._model.getLineCount();return!(i.startLineNumber<1||i.startLineNumber>e||i.endLineNumber<1||i.endLineNumber>e)}getModelLineViewLineCount(i){return 1}getViewLineNumberOfModelPosition(i,e){return i}};var uyt=class{constructor(i,e,t,o,n,r,s,l,c,u,p){this._editorId=i,this.model=e,this._validModelVersionId=-1,this._domLineBreaksComputerFactory=t,this._monospaceLineBreaksComputerFactory=o,this.fontInfo=n,this.tabSize=r,this.wrappingStrategy=s,this.wrappingColumn=l,this.wrappingIndent=c,this.wordBreak=u,this.wrapOnEscapedLineFeeds=p,this._constructLines(!0,null)}dispose(){this.hiddenAreasDecorationIds=this.model.deltaDecorations(this.hiddenAreasDecorationIds,[])}createCoordinatesConverter(){return new mni(this)}_constructLines(i,e){this.modelLineProjections=[],i&&(this.hiddenAreasDecorationIds=this.model.deltaDecorations(this.hiddenAreasDecorationIds,[]));let o=this.model.getLinesContent().length,n=this.createLineBreaksComputer();for(let g=0;g<o;g++)n.addRequest(g+1,e?e[g]:null);let r=n.finalize(),s=[],l=this.hiddenAreasDecorationIds.map(g=>this.model.getDecorationRange(g)).sort(z.compareRangesUsingStarts),c=1,u=0,p=-1,h=p+1<l.length?u+1:o+2;for(let g=0;g<o;g++){let f=g+1;f===h&&(p++,c=l[p].startLineNumber,u=l[p].endLineNumber,h=p+1<l.length?u+1:o+2);let v=f>=c&&f<=u,b=cyt(r[g],!v);s[g]=b.getViewLineCount(),this.modelLineProjections[g]=b}this._validModelVersionId=this.model.getVersionId(),this.projectedModelLineLineCounts=new Cye(s),this._ensureAtLeastOneVisibleLine()}getHiddenAreas(){return this.hiddenAreasDecorationIds.map(i=>this.model.getDecorationRange(i))}setHiddenAreas(i){let e=i.map(h=>this.model.validateRange(h)),t=kBo(e),o=this.hiddenAreasDecorationIds.map(h=>this.model.getDecorationRange(h)).sort(z.compareRangesUsingStarts);if(t.length===o.length){let h=!1;for(let g=0;g<t.length;g++)if(!t[g].equalsRange(o[g])){h=!0;break}if(!h)return!1}let n=t.map(h=>({range:h,options:mo.EMPTY}));this.hiddenAreasDecorationIds=this.model.deltaDecorations(this.hiddenAreasDecorationIds,n);let r=t,s=1,l=0,c=-1,u=c+1<r.length?l+1:this.modelLineProjections.length+2,p=!1;for(let h=0;h<this.modelLineProjections.length;h++){let g=h+1;g===u&&(c++,s=r[c].startLineNumber,l=r[c].endLineNumber,u=c+1<r.length?l+1:this.modelLineProjections.length+2);let f=!1;if(g>=s&&g<=l?this.modelLineProjections[h].isVisible()&&(this.modelLineProjections[h]=this.modelLineProjections[h].setVisible(!1),f=!0):(p=!0,this.modelLineProjections[h].isVisible()||(this.modelLineProjections[h]=this.modelLineProjections[h].setVisible(!0),f=!0)),f){let v=this.modelLineProjections[h].getViewLineCount();this.projectedModelLineLineCounts.setValue(h,v)}}return p||this.setHiddenAreas([]),!0}modelPositionIsVisible(i,e){return i<1||i>this.modelLineProjections.length?!1:this.modelLineProjections[i-1].isVisible()}getModelLineViewLineCount(i){return i<1||i>this.modelLineProjections.length?1:this.modelLineProjections[i-1].getViewLineCount()}setTabSize(i){return this.tabSize===i?!1:(this.tabSize=i,this._constructLines(!1,null),!0)}setWrappingSettings(i,e,t,o,n){let r=this.fontInfo.equals(i),s=this.wrappingStrategy===e,l=this.wrappingColumn===t,c=this.wrappingIndent===o,u=this.wordBreak===n;if(r&&s&&l&&c&&u)return!1;let p=r&&s&&!l&&c&&u;this.fontInfo=i,this.wrappingStrategy=e,this.wrappingColumn=t,this.wrappingIndent=o,this.wordBreak=n;let h=null;if(p){h=[];for(let g=0,f=this.modelLineProjections.length;g<f;g++)h[g]=this.modelLineProjections[g].getProjectionData()}return this._constructLines(!1,h),!0}createLineBreaksComputer(i){let e=this.wrappingStrategy==="advanced"?this._domLineBreaksComputerFactory:this._monospaceLineBreaksComputerFactory,t=i??{getLineContent:o=>this.model.getLineContent(o),getLineInjectedText:o=>this.model.getLineInjectedText(o,this._editorId)};return e.createLineBreaksComputer(t,this.fontInfo,this.tabSize,this.wrappingColumn,this.wrappingIndent,this.wordBreak,this.wrapOnEscapedLineFeeds)}onModelFlushed(){this._constructLines(!0,null)}onModelLinesDeleted(i,e,t){if(!i||i<=this._validModelVersionId)return null;let o=e===1?1:this.projectedModelLineLineCounts.getPrefixSum(e-1)+1,n=this.projectedModelLineLineCounts.getPrefixSum(t);return this.modelLineProjections.splice(e-1,t-e+1),this.projectedModelLineLineCounts.removeValues(e-1,t-e+1),new cye(o,n)}onModelLinesInserted(i,e,t,o){if(!i||i<=this._validModelVersionId)return null;let n=e>2&&!this.modelLineProjections[e-2].isVisible(),r=e===1?1:this.projectedModelLineLineCounts.getPrefixSum(e-1)+1,s=0,l=[],c=[];for(let u=0,p=o.length;u<p;u++){let h=cyt(o[u],!n);l.push(h);let g=h.getViewLineCount();s+=g,c[u]=g}return this.modelLineProjections=this.modelLineProjections.slice(0,e-1).concat(l).concat(this.modelLineProjections.slice(e-1)),this.projectedModelLineLineCounts.insertValues(e-1,c),new dye(r,r+s-1)}onModelLineChanged(i,e,t){if(i!==null&&i<=this._validModelVersionId)return[!1,null,null,null];let o=e-1,n=this.modelLineProjections[o].getViewLineCount(),r=this.modelLineProjections[o].isVisible(),s=cyt(t,r);this.modelLineProjections[o]=s;let l=this.modelLineProjections[o].getViewLineCount(),c=!1,u=0,p=-1,h=0,g=-1,f=0,v=-1;n>l?(u=this.projectedModelLineLineCounts.getPrefixSum(e-1)+1,p=u+l-1,f=p+1,v=f+(n-l)-1,c=!0):n<l?(u=this.projectedModelLineLineCounts.getPrefixSum(e-1)+1,p=u+n-1,h=p+1,g=h+(l-n)-1,c=!0):(u=this.projectedModelLineLineCounts.getPrefixSum(e-1)+1,p=u+l-1),this.projectedModelLineLineCounts.setValue(o,l);let b=u<=p?new fje(u,p-u+1):null,S=h<=g?new dye(h,g):null,y=f<=v?new cye(f,v):null;return[c,b,S,y]}acceptVersionId(i){this._validModelVersionId=i,this._ensureAtLeastOneVisibleLine()}_ensureAtLeastOneVisibleLine(){this.getViewLineCount()===0&&this.modelLineProjections.length>0&&(this.modelLineProjections[0]=this.modelLineProjections[0].setVisible(!0),this.projectedModelLineLineCounts.setValue(0,this.modelLineProjections[0].getViewLineCount()))}getViewLineCount(){return this.projectedModelLineLineCounts.getTotalSum()}_toValidViewLineNumber(i){if(i<1)return 1;let e=this.getViewLineCount();return i>e?e:i|0}getActiveIndentGuide(i,e,t){i=this._toValidViewLineNumber(i),e=this._toValidViewLineNumber(e),t=this._toValidViewLineNumber(t);let o=this.convertViewPositionToModelPosition(i,this.getViewLineMinColumn(i)),n=this.convertViewPositionToModelPosition(e,this.getViewLineMinColumn(e)),r=this.convertViewPositionToModelPosition(t,this.getViewLineMinColumn(t)),s=this.model.guides.getActiveIndentGuide(o.lineNumber,n.lineNumber,r.lineNumber),l=this.convertModelPositionToViewPosition(s.startLineNumber,1),c=this.convertModelPositionToViewPosition(s.endLineNumber,this.model.getLineMaxColumn(s.endLineNumber));return{startLineNumber:l.lineNumber,endLineNumber:c.lineNumber,indent:s.indent}}getViewLineInfo(i){i=this._toValidViewLineNumber(i);let e=this.projectedModelLineLineCounts.getIndexOf(i-1),t=e.index,o=e.remainder;return new pyt(t+1,o)}getMinColumnOfViewLine(i){return this.modelLineProjections[i.modelLineNumber-1].getViewLineMinColumn(this.model,i.modelLineNumber,i.modelLineWrappedLineIdx)}getMaxColumnOfViewLine(i){return this.modelLineProjections[i.modelLineNumber-1].getViewLineMaxColumn(this.model,i.modelLineNumber,i.modelLineWrappedLineIdx)}getModelStartPositionOfViewLine(i){let e=this.modelLineProjections[i.modelLineNumber-1],t=e.getViewLineMinColumn(this.model,i.modelLineNumber,i.modelLineWrappedLineIdx),o=e.getModelColumnOfViewPosition(i.modelLineWrappedLineIdx,t);return new ye(i.modelLineNumber,o)}getModelEndPositionOfViewLine(i){let e=this.modelLineProjections[i.modelLineNumber-1],t=e.getViewLineMaxColumn(this.model,i.modelLineNumber,i.modelLineWrappedLineIdx),o=e.getModelColumnOfViewPosition(i.modelLineWrappedLineIdx,t);return new ye(i.modelLineNumber,o)}getViewLineInfosGroupedByModelRanges(i,e){let t=this.getViewLineInfo(i),o=this.getViewLineInfo(e),n=new Array,r=this.getModelStartPositionOfViewLine(t),s=new Array;for(let l=t.modelLineNumber;l<=o.modelLineNumber;l++){let c=this.modelLineProjections[l-1];if(c.isVisible()){let u=l===t.modelLineNumber?t.modelLineWrappedLineIdx:0,p=l===o.modelLineNumber?o.modelLineWrappedLineIdx+1:c.getViewLineCount();for(let h=u;h<p;h++)s.push(new pyt(l,h))}if(!c.isVisible()&&r){let u=new ye(l-1,this.model.getLineMaxColumn(l-1)+1),p=z.fromPositions(r,u);n.push(new myt(p,s)),s=[],r=null}else c.isVisible()&&!r&&(r=new ye(l,1))}if(r){let l=z.fromPositions(r,this.getModelEndPositionOfViewLine(o));n.push(new myt(l,s))}return n}getViewLinesBracketGuides(i,e,t,o){let n=t?this.convertViewPositionToModelPosition(t.lineNumber,t.column):null,r=[];for(let s of this.getViewLineInfosGroupedByModelRanges(i,e)){let l=s.modelRange.startLineNumber,c=this.model.guides.getLinesBracketGuides(l,s.modelRange.endLineNumber,n,o);for(let u of s.viewLines){let h=c[u.modelLineNumber-l].map(g=>{if(g.forWrappedLinesAfterColumn!==-1&&this.modelLineProjections[u.modelLineNumber-1].getViewPositionOfModelPosition(0,g.forWrappedLinesAfterColumn).lineNumber>=u.modelLineWrappedLineIdx||g.forWrappedLinesBeforeOrAtColumn!==-1&&this.modelLineProjections[u.modelLineNumber-1].getViewPositionOfModelPosition(0,g.forWrappedLinesBeforeOrAtColumn).lineNumber<u.modelLineWrappedLineIdx)return;if(!g.horizontalLine)return g;let f=-1;if(g.column!==-1){let S=this.modelLineProjections[u.modelLineNumber-1].getViewPositionOfModelPosition(0,g.column);if(S.lineNumber===u.modelLineWrappedLineIdx)f=S.column;else if(S.lineNumber<u.modelLineWrappedLineIdx)f=this.getMinColumnOfViewLine(u);else if(S.lineNumber>u.modelLineWrappedLineIdx)return}let v=this.convertModelPositionToViewPosition(u.modelLineNumber,g.horizontalLine.endColumn),b=this.modelLineProjections[u.modelLineNumber-1].getViewPositionOfModelPosition(0,g.horizontalLine.endColumn);return b.lineNumber===u.modelLineWrappedLineIdx?new PO(g.visibleColumn,f,g.className,new Ej(g.horizontalLine.top,v.column),-1,-1):b.lineNumber<u.modelLineWrappedLineIdx||g.visibleColumn!==-1?void 0:new PO(g.visibleColumn,f,g.className,new Ej(g.horizontalLine.top,this.getMaxColumnOfViewLine(u)),-1,-1)});r.push(h.filter(g=>!!g))}}return r}getViewLinesIndentGuides(i,e){i=this._toValidViewLineNumber(i),e=this._toValidViewLineNumber(e);let t=this.convertViewPositionToModelPosition(i,this.getViewLineMinColumn(i)),o=this.convertViewPositionToModelPosition(e,this.getViewLineMaxColumn(e)),n=[],r=[],s=[],l=t.lineNumber-1,c=o.lineNumber-1,u=null;for(let f=l;f<=c;f++){let v=this.modelLineProjections[f];if(v.isVisible()){let b=v.getViewLineNumberOfModelPosition(0,f===l?t.column:1),S=v.getViewLineNumberOfModelPosition(0,this.model.getLineMaxColumn(f+1)),y=S-b+1,w=0;y>1&&v.getViewLineMinColumn(this.model,f+1,S)===1&&(w=b===0?1:2),r.push(y),s.push(w),u===null&&(u=new ye(f+1,0))}else u!==null&&(n=n.concat(this.model.guides.getLinesIndentGuides(u.lineNumber,f)),u=null)}u!==null&&(n=n.concat(this.model.guides.getLinesIndentGuides(u.lineNumber,o.lineNumber)),u=null);let p=e-i+1,h=new Array(p),g=0;for(let f=0,v=n.length;f<v;f++){let b=n[f],S=Math.min(p-g,r[f]),y=s[f],w;y===2?w=0:y===1?w=1:w=S;for(let k=0;k<S;k++)k===w&&(b=0),h[g++]=b}return h}getViewLineContent(i){let e=this.getViewLineInfo(i);return this.modelLineProjections[e.modelLineNumber-1].getViewLineContent(this.model,e.modelLineNumber,e.modelLineWrappedLineIdx)}getViewLineLength(i){let e=this.getViewLineInfo(i);return this.modelLineProjections[e.modelLineNumber-1].getViewLineLength(this.model,e.modelLineNumber,e.modelLineWrappedLineIdx)}getViewLineMinColumn(i){let e=this.getViewLineInfo(i);return this.modelLineProjections[e.modelLineNumber-1].getViewLineMinColumn(this.model,e.modelLineNumber,e.modelLineWrappedLineIdx)}getViewLineMaxColumn(i){let e=this.getViewLineInfo(i);return this.modelLineProjections[e.modelLineNumber-1].getViewLineMaxColumn(this.model,e.modelLineNumber,e.modelLineWrappedLineIdx)}getViewLineData(i){let e=this.getViewLineInfo(i),t=this.projectedModelLineLineCounts.getPrefixSum(e.modelLineNumber-1)+1;return this.modelLineProjections[e.modelLineNumber-1].getViewLineData(this.model,e.modelLineNumber,e.modelLineWrappedLineIdx,t)}getViewLinesData(i,e,t){i=this._toValidViewLineNumber(i),e=this._toValidViewLineNumber(e);let o=this.projectedModelLineLineCounts.getIndexOf(i-1),n=i,r=o.index,s=o.remainder,l=[];for(let c=r,u=this.model.getLineCount();c<u;c++){let p=this.modelLineProjections[c];if(!p.isVisible())continue;let h=c===r?s:0,g=p.getViewLineCount()-h,f=!1;n+g>e&&(f=!0,g=e-n+1);let v=this.projectedModelLineLineCounts.getPrefixSum(c)+1;if(p.getViewLinesData(this.model,c+1,h,g,v,n-i,t,l),n+=g,f)break}return l}validateViewPosition(i,e,t){i=this._toValidViewLineNumber(i);let o=this.projectedModelLineLineCounts.getIndexOf(i-1),n=o.index,r=o.remainder,s=this.modelLineProjections[n],l=s.getViewLineMinColumn(this.model,n+1,r),c=s.getViewLineMaxColumn(this.model,n+1,r);e<l&&(e=l),e>c&&(e=c);let u=s.getModelColumnOfViewPosition(r,e);return this.model.validatePosition(new ye(n+1,u)).equals(t)?new ye(i,e):this.convertModelPositionToViewPosition(t.lineNumber,t.column)}validateViewRange(i,e){let t=this.validateViewPosition(i.startLineNumber,i.startColumn,e.getStartPosition()),o=this.validateViewPosition(i.endLineNumber,i.endColumn,e.getEndPosition());return new z(t.lineNumber,t.column,o.lineNumber,o.column)}convertViewPositionToModelPosition(i,e){let t=this.getViewLineInfo(i),o=this.modelLineProjections[t.modelLineNumber-1].getModelColumnOfViewPosition(t.modelLineWrappedLineIdx,e);return this.model.validatePosition(new ye(t.modelLineNumber,o))}convertViewRangeToModelRange(i){let e=this.convertViewPositionToModelPosition(i.startLineNumber,i.startColumn),t=this.convertViewPositionToModelPosition(i.endLineNumber,i.endColumn);return new z(e.lineNumber,e.column,t.lineNumber,t.column)}convertModelPositionToViewPosition(i,e,t=2,o=!1,n=!1){let r=this.model.validatePosition(new ye(i,e)),s=r.lineNumber,l=r.column,c=s-1,u=!1;if(n)for(;c<this.modelLineProjections.length&&!this.modelLineProjections[c].isVisible();)c++,u=!0;else for(;c>0&&!this.modelLineProjections[c].isVisible();)c--,u=!0;if(c===0&&!this.modelLineProjections[c].isVisible())return new ye(o?0:1,1);let p=1+this.projectedModelLineLineCounts.getPrefixSum(c),h;return u?n?h=this.modelLineProjections[c].getViewPositionOfModelPosition(p,1,t):h=this.modelLineProjections[c].getViewPositionOfModelPosition(p,this.model.getLineMaxColumn(c+1),t):h=this.modelLineProjections[s-1].getViewPositionOfModelPosition(p,l,t),h}convertModelRangeToViewRange(i,e=0){if(i.isEmpty()){let t=this.convertModelPositionToViewPosition(i.startLineNumber,i.startColumn,e);return z.fromPositions(t)}else{let t=this.convertModelPositionToViewPosition(i.startLineNumber,i.startColumn,1),o=this.convertModelPositionToViewPosition(i.endLineNumber,i.endColumn,0);return new z(t.lineNumber,t.column,o.lineNumber,o.column)}}getViewLineNumberOfModelPosition(i,e){let t=i-1;if(this.modelLineProjections[t].isVisible()){let n=1+this.projectedModelLineLineCounts.getPrefixSum(t);return this.modelLineProjections[t].getViewLineNumberOfModelPosition(n,e)}for(;t>0&&!this.modelLineProjections[t].isVisible();)t--;if(t===0&&!this.modelLineProjections[t].isVisible())return 1;let o=1+this.projectedModelLineLineCounts.getPrefixSum(t);return this.modelLineProjections[t].getViewLineNumberOfModelPosition(o,this.model.getLineMaxColumn(t+1))}getDecorationsInRange(i,e,t,o,n,r){let s=this.convertViewPositionToModelPosition(i.startLineNumber,i.startColumn),l=this.convertViewPositionToModelPosition(i.endLineNumber,i.endColumn);if(l.lineNumber-s.lineNumber<=i.endLineNumber-i.startLineNumber)return this.model.getDecorationsInRange(new z(s.lineNumber,1,l.lineNumber,l.column),e,t,o,n,r);let c=[],u=s.lineNumber-1,p=l.lineNumber-1,h=null;for(let b=u;b<=p;b++)if(this.modelLineProjections[b].isVisible())h===null&&(h=new ye(b+1,b===u?s.column:1));else if(h!==null){let y=this.model.getLineMaxColumn(b);c=c.concat(this.model.getDecorationsInRange(new z(h.lineNumber,h.column,b,y),e,t,o,n)),h=null}h!==null&&(c=c.concat(this.model.getDecorationsInRange(new z(h.lineNumber,h.column,l.lineNumber,l.column),e,t,o,n)),h=null),c.sort((b,S)=>{let y=z.compareRangesUsingStarts(b.range,S.range);return y===0?b.id<S.id?-1:b.id>S.id?1:0:y});let g=[],f=0,v=null;for(let b of c){let S=b.id;v!==S&&(v=S,g[f++]=b)}return g}getInjectedTextAt(i){let e=this.getViewLineInfo(i.lineNumber);return this.modelLineProjections[e.modelLineNumber-1].getInjectedTextAt(e.modelLineWrappedLineIdx,i.column)}normalizePosition(i,e){let t=this.getViewLineInfo(i.lineNumber);return this.modelLineProjections[t.modelLineNumber-1].normalizePosition(t.modelLineWrappedLineIdx,i,e)}getLineIndentColumn(i){let e=this.getViewLineInfo(i);return e.modelLineWrappedLineIdx===0?this.model.getLineIndentColumn(e.modelLineNumber):0}};function kBo(a){if(a.length===0)return[];let i=a.slice();i.sort(z.compareRangesUsingStarts);let e=[],t=i[0].startLineNumber,o=i[0].endLineNumber;for(let n=1,r=i.length;n<r;n++){let s=i[n];s.startLineNumber>o+1?(e.push(new z(t,1,o,1)),t=s.startLineNumber,o=s.endLineNumber):s.endLineNumber>o&&(o=s.endLineNumber)}return e.push(new z(t,1,o,1)),e}var pyt=class{constructor(i,e){this.modelLineNumber=i;this.modelLineWrappedLineIdx=e}get isWrappedLineContinuation(){return this.modelLineWrappedLineIdx>0}},myt=class{constructor(i,e){this.modelRange=i;this.viewLines=e}},mni=class{constructor(i){this._lines=i}convertViewPositionToModelPosition(i){return this._lines.convertViewPositionToModelPosition(i.lineNumber,i.column)}convertViewRangeToModelRange(i){return this._lines.convertViewRangeToModelRange(i)}validateViewPosition(i,e){return this._lines.validateViewPosition(i.lineNumber,i.column,e)}validateViewRange(i,e){return this._lines.validateViewRange(i,e)}convertModelPositionToViewPosition(i,e,t,o){return this._lines.convertModelPositionToViewPosition(i.lineNumber,i.column,e,t,o)}convertModelRangeToViewRange(i,e){return this._lines.convertModelRangeToViewRange(i,e)}modelPositionIsVisible(i){return this._lines.modelPositionIsVisible(i.lineNumber,i.column)}getModelLineViewLineCount(i){return this._lines.getModelLineViewLineCount(i)}getViewLineNumberOfModelPosition(i,e){return this._lines.getViewLineNumberOfModelPosition(i,e)}};var hyt=class{constructor(i){this.model=i}dispose(){}createCoordinatesConverter(){return new dyt(this.model)}getHiddenAreas(){return[]}setHiddenAreas(i){return!1}setTabSize(i){return!1}setWrappingSettings(i,e,t,o){return!1}createLineBreaksComputer(){let i=[];return{addRequest:(e,t)=>{i.push(null)},finalize:()=>i}}onModelFlushed(){}onModelLinesDeleted(i,e,t){return new cye(e,t)}onModelLinesInserted(i,e,t,o){return new dye(e,t)}onModelLineChanged(i,e,t){return[!1,new fje(e,1),null,null]}acceptVersionId(i){}getViewLineCount(){return this.model.getLineCount()}getActiveIndentGuide(i,e,t){return{startLineNumber:i,endLineNumber:i,indent:0}}getViewLinesBracketGuides(i,e,t){return new Array(e-i+1).fill([])}getViewLinesIndentGuides(i,e){let t=e-i+1,o=new Array(t);for(let n=0;n<t;n++)o[n]=0;return o}getViewLineContent(i){return this.model.getLineContent(i)}getViewLineLength(i){return this.model.getLineLength(i)}getViewLineMinColumn(i){return this.model.getLineMinColumn(i)}getViewLineMaxColumn(i){return this.model.getLineMaxColumn(i)}getViewLineData(i){let e=this.model.tokenization.getLineTokens(i),t=e.getLineContent();return new _le(t,!1,1,t.length+1,0,e.inflate(),null)}getViewLinesData(i,e,t){let o=this.model.getLineCount();i=Math.min(Math.max(1,i),o),e=Math.min(Math.max(1,e),o);let n=[];for(let r=i;r<=e;r++){let s=r-i;n[s]=t[s]?this.getViewLineData(r):null}return n}getDecorationsInRange(i,e,t,o,n,r){return this.model.getDecorationsInRange(i,e,t,o,n,r)}normalizePosition(i,e){return this.model.normalizePosition(i,e)}getLineIndentColumn(i){return this.model.getLineIndentColumn(i)}getInjectedTextAt(i){return null}};var Wle=3,gyt=class{constructor(i){this.persist=0;this._requiredLanes=1;this.lanes=new Uint8Array(Math.ceil((i+1)*Wle/8))}reset(i){let e=Math.ceil((i+1)*Wle/8);this.lanes.length<e?this.lanes=new Uint8Array(e):this.lanes.fill(0),this._requiredLanes=1}get requiredLanes(){return this._requiredLanes}push(i,e,t){t&&(this.persist|=1<<i-1);for(let o=e.startLineNumber;o<=e.endLineNumber;o++){let n=Wle*o+(i-1);this.lanes[n>>>3]|=1<<n%8,this._requiredLanes=Math.max(this._requiredLanes,this.countAtLine(o))}}getLanesAtLine(i){let e=[],t=Wle*i;for(let o=0;o<Wle;o++)(this.persist&1<<o||this.lanes[t>>>3]&1<<t%8)&&e.push(o+1),t++;return e.length?e:[2]}countAtLine(i){let e=Wle*i,t=0;for(let o=0;o<Wle;o++)(this.persist&1<<o||this.lanes[e>>>3]&1<<e%8)&&t++,e++;return t}};var EBo=!0,fyt=class extends x{constructor(e,t,o,n,r,s,l,c,u,p){super();this.languageConfigurationService=l;this._themeService=c;this._attachedView=u;this._transactionalTarget=p;this.hiddenAreasModel=new fni;this.previousHiddenAreas=[];if(this._editorId=e,this._configuration=t,this.model=o,this._eventDispatcher=new VIt,this.onEvent=this._eventDispatcher.onEvent,this.cursorConfig=new _V(this.model.getLanguageId(),this.model.getOptions(),this._configuration,this.languageConfigurationService),this._updateConfigurationViewLineCount=this._register(new Dt(()=>this._updateConfigurationViewLineCountNow(),0)),this._hasFocus=!1,this._viewportStart=hni.create(this.model),this.glyphLanes=new gyt(0),EBo&&this.model.isTooLargeForTokenization())this._lines=new hyt(this.model);else{let h=this._configuration.options,g=h.get(59),f=h.get(156),v=h.get(166),b=h.get(155),S=h.get(146),y=h.get(160);this._lines=new uyt(this._editorId,this.model,n,r,g,this.model.getOptions().tabSize,f,v.wrappingColumn,b,S,y)}this.coordinatesConverter=this._lines.createCoordinatesConverter(),this._cursor=this._register(new dCe(o,this,this.coordinatesConverter,this.cursorConfig)),this.viewLayout=this._register(new ryt(this._configuration,this.getLineCount(),this._getCustomLineHeights(),s)),this._register(this.viewLayout.onDidScroll(h=>{h.scrollTopChanged&&this._handleVisibleLinesChanged(),h.scrollTopChanged&&this._viewportStart.invalidate(),this._eventDispatcher.emitSingleViewEvent(new Zft(h)),this._eventDispatcher.emitOutgoingEvent(new UIt(h.oldScrollWidth,h.oldScrollLeft,h.oldScrollHeight,h.oldScrollTop,h.scrollWidth,h.scrollLeft,h.scrollHeight,h.scrollTop))})),this._register(this.viewLayout.onDidContentSizeChange(h=>{this._eventDispatcher.emitOutgoingEvent(h)})),this._decorations=new syt(this._editorId,this.model,this._configuration,this._lines,this.coordinatesConverter),this._registerModelEvents(),this._register(this._configuration.onDidChangeFast(h=>{try{let g=this._eventDispatcher.beginEmitViewEvents();this._onConfigurationChanged(g,h)}finally{this._eventDispatcher.endEmitViewEvents()}})),this._register(Dwe.getInstance().onDidChange(()=>{this._eventDispatcher.emitSingleViewEvent(new ivt)})),this._register(this._themeService.onDidColorThemeChange(h=>{this._invalidateDecorationsColorCache(),this._eventDispatcher.emitSingleViewEvent(new evt(h))})),this._updateConfigurationViewLineCountNow(),this.model.registerViewModel(this)}dispose(){super.dispose(),this._decorations.dispose(),this._lines.dispose(),this._viewportStart.dispose(),this._eventDispatcher.dispose(),this.model.unregisterViewModel(this)}getEditorOption(e){return this._configuration.options.get(e)}createLineBreaksComputer(e){return this._lines.createLineBreaksComputer(e)}addViewEventHandler(e){this._eventDispatcher.addViewEventHandler(e)}removeViewEventHandler(e){this._eventDispatcher.removeViewEventHandler(e)}_getCustomLineHeights(){if(!this._configuration.options.get(5))return[];let t=this.model.getCustomLineHeightsDecorations(this._editorId);return $5e.fromDecorations(t,this.coordinatesConverter,this._configuration)}_getCustomLineHeightsForLines(e,t){if(!this._configuration.options.get(5))return[];let n=new z(e,1,t,this.model.getLineMaxColumn(t)),r=this.model.getCustomLineHeightsDecorationsInRange(n,this._editorId);return $5e.fromDecorations(r,this.coordinatesConverter,this._configuration)}_updateConfigurationViewLineCountNow(){this._configuration.setViewLineCount(this._lines.getViewLineCount())}getModelVisibleRanges(){let e=this.viewLayout.getLinesViewportData(),t=new z(e.startLineNumber,this.getLineMinColumn(e.startLineNumber),e.endLineNumber,this.getLineMaxColumn(e.endLineNumber));return this._toModelVisibleRanges(t)}visibleLinesStabilized(){let e=this.getModelVisibleRanges();this._attachedView.setVisibleLines(e,!0)}_handleVisibleLinesChanged(){let e=this.getModelVisibleRanges();this._attachedView.setVisibleLines(e,!1)}setHasFocus(e){this._hasFocus=e,this._cursor.setHasFocus(e),this._eventDispatcher.emitSingleViewEvent(new Xft(e)),this._eventDispatcher.emitOutgoingEvent(new K5e(!e,e))}setHasWidgetFocus(e){this._eventDispatcher.emitOutgoingEvent(new HIt(!e,e))}onCompositionStart(){this._eventDispatcher.emitSingleViewEvent(new $ft)}onCompositionEnd(){this._eventDispatcher.emitSingleViewEvent(new jft)}_captureStableViewport(){if(this._viewportStart.isValid&&this.viewLayout.getCurrentScrollTop()>0){let e=new ye(this._viewportStart.viewLineNumber,this.getLineMinColumn(this._viewportStart.viewLineNumber)),t=this.coordinatesConverter.convertViewPositionToModelPosition(e);return new vyt(t,this._viewportStart.startLineDelta)}return new vyt(null,0)}_onConfigurationChanged(e,t){let o=this._captureStableViewport(),n=this._configuration.options,r=n.get(59),s=n.get(156),l=n.get(166),c=n.get(155),u=n.get(146);this._lines.setWrappingSettings(r,s,l.wrappingColumn,c,u)&&(e.emitViewEvent(new Uae),e.emitViewEvent(new zae),e.emitViewEvent(new M1(null)),this._cursor.onLineMappingChanged(e),this._decorations.onLineMappingChanged(),this.viewLayout.onFlushed(this.getLineCount(),this._getCustomLineHeights()),this._updateConfigurationViewLineCount.schedule()),t.hasChanged(104)&&(this._decorations.reset(),e.emitViewEvent(new M1(null))),t.hasChanged(112)&&(this._decorations.reset(),e.emitViewEvent(new M1(null))),e.emitViewEvent(new Qft(t)),this.viewLayout.onConfigurationChanged(t),o.recoverViewportStart(this.coordinatesConverter,this.viewLayout),_V.shouldRecreate(t)&&(this.cursorConfig=new _V(this.model.getLanguageId(),this.model.getOptions(),this._configuration,this.languageConfigurationService),this._cursor.updateConfiguration(this.cursorConfig))}onDidChangeContentOrInjectedText(e){try{let o=this._eventDispatcher.beginEmitViewEvents(),n=!1,r=!1,s=e instanceof q7?e.rawContentChangedEvent.changes:e.changes,l=e instanceof q7?e.rawContentChangedEvent.versionId:null,c=this._lines.createLineBreaksComputer();for(let g of s)switch(g.changeType){case 4:{for(let f=0;f<g.count;f++)c.addRequest(g.fromLineNumberPostEdit+f,null);break}case 2:{c.addRequest(g.lineNumberPostEdit,null);break}}let u=c.finalize(),p=new uE(u),h=[];for(let g of s)switch(g.changeType){case 1:{this._lines.onModelFlushed(),o.emitViewEvent(new Uae),this._decorations.reset(),this.viewLayout.onFlushed(this.getLineCount(),this._getCustomLineHeights()),n=!0;break}case 3:{let f=this._lines.onModelLinesDeleted(l,g.fromLineNumber,g.toLineNumber);f!==null&&(o.emitViewEvent(f),this.viewLayout.onLinesDeleted(f.fromLineNumber,f.toLineNumber),h.push({fromLineNumber:g.lastUntouchedLinePostEdit,toLineNumber:g.lastUntouchedLinePostEdit})),n=!0;break}case 4:{let f=p.takeCount(g.count),v=this._lines.onModelLinesInserted(l,g.fromLineNumber,g.toLineNumber,f);v!==null&&(o.emitViewEvent(v),this.viewLayout.onLinesInserted(v.fromLineNumber,v.toLineNumber),h.push({fromLineNumber:g.fromLineNumberPostEdit,toLineNumber:g.toLineNumberPostEdit})),n=!0;break}case 2:{let f=p.dequeue(),[v,b,S,y]=this._lines.onModelLineChanged(l,g.lineNumber,f);r=v,b&&o.emitViewEvent(b),S&&(o.emitViewEvent(S),this.viewLayout.onLinesInserted(S.fromLineNumber,S.toLineNumber),h.push({fromLineNumber:g.lineNumberPostEdit,toLineNumber:g.lineNumberPostEdit})),y&&(o.emitViewEvent(y),this.viewLayout.onLinesDeleted(y.fromLineNumber,y.toLineNumber),h.push({fromLineNumber:g.lineNumberPostEdit,toLineNumber:g.lineNumberPostEdit}));break}case 5:break}l!==null&&this._lines.acceptVersionId(l),h.length>0&&this.viewLayout.changeSpecialLineHeights(g=>{for(let f of h){let v=this._getCustomLineHeightsForLines(f.fromLineNumber,f.toLineNumber);for(let b of v)g.insertOrChangeCustomLineHeight(b.decorationId,b.startLineNumber,b.endLineNumber,b.lineHeight)}}),this.viewLayout.onHeightMaybeChanged(),!n&&r&&(o.emitViewEvent(new zae),o.emitViewEvent(new M1(null)),this._cursor.onLineMappingChanged(o),this._decorations.onLineMappingChanged())}finally{this._eventDispatcher.endEmitViewEvents()}let t=this._viewportStart.isValid;if(this._viewportStart.invalidate(),this._configuration.setModelLineCount(this.model.getLineCount()),this._updateConfigurationViewLineCountNow(),!this._hasFocus&&this.model.getAttachedEditorCount()>=2&&t){let o=this.model._getTrackedRange(this._viewportStart.modelTrackedRange);if(o){let n=this.coordinatesConverter.convertModelPositionToViewPosition(o.getStartPosition()),r=this.viewLayout.getVerticalOffsetForLineNumber(n.lineNumber);this.viewLayout.setScrollPosition({scrollTop:r+this._viewportStart.startLineDelta},1)}}this._handleVisibleLinesChanged()}emitContentChangeEvent(e){this._emitViewEvent(t=>{e instanceof q7&&t.emitOutgoingEvent(new YIt(e.contentChangedEvent)),this._cursor.onModelContentChanged(t,e)})}_registerModelEvents(){this._configuration.options.get(5)&&this._register(this.model.onDidChangeLineHeight(o=>{let n=o.changes.filter(r=>r.ownerId===this._editorId||r.ownerId===0);if(this.viewLayout.changeSpecialLineHeights(r=>{for(let s of n){let{decorationId:l,lineNumber:c,lineHeightMultiplier:u}=s,p=this.coordinatesConverter.convertModelRangeToViewRange(new z(c,1,c,this.model.getLineMaxColumn(c)));u!==null?r.insertOrChangeCustomLineHeight(l,p.startLineNumber,p.endLineNumber,u*this._configuration.options.get(75)):r.removeCustomLineHeight(l)}}),n.length>0){let r=new Gwe(n);this._eventDispatcher.emitOutgoingEvent(new ZIt(r))}})),this._configuration.options.get(172)&&this._register(this.model.onDidChangeFont(o=>{let n=o.changes.filter(r=>r.ownerId===this._editorId||r.ownerId===0);if(n.length>0){let r=new qwe(n);this._eventDispatcher.emitOutgoingEvent(new eyt(r))}})),this._register(this.model.onDidChangeTokens(o=>{let n=[];for(let r=0,s=o.ranges.length;r<s;r++){let l=o.ranges[r],c=this.coordinatesConverter.convertModelPositionToViewPosition(new ye(l.fromLineNumber,1)).lineNumber,u=this.coordinatesConverter.convertModelPositionToViewPosition(new ye(l.toLineNumber,this.model.getLineMaxColumn(l.toLineNumber))).lineNumber;n[r]={fromLineNumber:c,toLineNumber:u}}this._eventDispatcher.emitSingleViewEvent(new tvt(n)),this._eventDispatcher.emitOutgoingEvent(new JIt(o))})),this._register(this.model.onDidChangeLanguageConfiguration(o=>{this._eventDispatcher.emitSingleViewEvent(new Jft),this.cursorConfig=new _V(this.model.getLanguageId(),this.model.getOptions(),this._configuration,this.languageConfigurationService),this._cursor.updateConfiguration(this.cursorConfig),this._eventDispatcher.emitOutgoingEvent(new QIt(o))})),this._register(this.model.onDidChangeLanguage(o=>{this.cursorConfig=new _V(this.model.getLanguageId(),this.model.getOptions(),this._configuration,this.languageConfigurationService),this._cursor.updateConfiguration(this.cursorConfig),this._eventDispatcher.emitOutgoingEvent(new jIt(o))})),this._register(this.model.onDidChangeOptions(o=>{if(this._lines.setTabSize(this.model.getOptions().tabSize)){try{let n=this._eventDispatcher.beginEmitViewEvents();n.emitViewEvent(new Uae),n.emitViewEvent(new zae),n.emitViewEvent(new M1(null)),this._cursor.onLineMappingChanged(n),this._decorations.onLineMappingChanged(),this.viewLayout.onFlushed(this.getLineCount(),this._getCustomLineHeights())}finally{this._eventDispatcher.endEmitViewEvents()}this._updateConfigurationViewLineCount.schedule()}this.cursorConfig=new _V(this.model.getLanguageId(),this.model.getOptions(),this._configuration,this.languageConfigurationService),this._cursor.updateConfiguration(this.cursorConfig),this._eventDispatcher.emitOutgoingEvent(new XIt(o))})),this._register(this.model.onDidChangeDecorations(o=>{this._decorations.onModelDecorationsChanged(),this._eventDispatcher.emitSingleViewEvent(new M1(o)),this._eventDispatcher.emitOutgoingEvent(new $It(o))}))}getFontSizeAtPosition(e){if(!this._configuration.options.get(172))return null;let o=this.model.getFontDecorationsInRange(z.fromPositions(e),this._editorId),n=this._configuration.options.get(59).fontSize+"px";for(let r of o)if(r.options.fontSize){n=r.options.fontSize;break}return n}setHiddenAreas(e,t,o){this.hiddenAreasModel.setHiddenAreas(t,e);let n=this.hiddenAreasModel.getMergedRanges();if(n===this.previousHiddenAreas&&!o)return;this.previousHiddenAreas=n;let r=this._captureStableViewport(),s=!1;try{let l=this._eventDispatcher.beginEmitViewEvents();s=this._lines.setHiddenAreas(n),s&&(l.emitViewEvent(new Uae),l.emitViewEvent(new zae),l.emitViewEvent(new M1(null)),this._cursor.onLineMappingChanged(l),this._decorations.onLineMappingChanged(),this.viewLayout.onFlushed(this.getLineCount(),this._getCustomLineHeights()),this.viewLayout.onHeightMaybeChanged());let c=r.viewportStartModelPosition?.lineNumber;c&&n.some(p=>p.startLineNumber<=c&&c<=p.endLineNumber)||r.recoverViewportStart(this.coordinatesConverter,this.viewLayout)}finally{this._eventDispatcher.endEmitViewEvents()}this._updateConfigurationViewLineCount.schedule(),s&&this._eventDispatcher.emitOutgoingEvent(new KIt)}getVisibleRangesPlusViewportAboveBelow(){let e=this._configuration.options.get(165),t=this._configuration.options.get(75),o=Math.max(20,Math.round(e.height/t)),n=this.viewLayout.getLinesViewportData(),r=Math.max(1,n.completelyVisibleStartLineNumber-o),s=Math.min(this.getLineCount(),n.completelyVisibleEndLineNumber+o);return this._toModelVisibleRanges(new z(r,this.getLineMinColumn(r),s,this.getLineMaxColumn(s)))}getVisibleRanges(){let e=this.getCompletelyVisibleViewRange();return this._toModelVisibleRanges(e)}getHiddenAreas(){return this._lines.getHiddenAreas()}_toModelVisibleRanges(e){let t=this.coordinatesConverter.convertViewRangeToModelRange(e),o=this._lines.getHiddenAreas();if(o.length===0)return[t];let n=[],r=0,s=t.startLineNumber,l=t.startColumn,c=t.endLineNumber,u=t.endColumn;for(let p=0,h=o.length;p<h;p++){let g=o[p].startLineNumber,f=o[p].endLineNumber;f<s||g>c||(s<g&&(n[r++]=new z(s,l,g-1,this.model.getLineMaxColumn(g-1))),s=f+1,l=1)}return(s<c||s===c&&l<u)&&(n[r++]=new z(s,l,c,u)),n}getCompletelyVisibleViewRange(){let e=this.viewLayout.getLinesViewportData(),t=e.completelyVisibleStartLineNumber,o=e.completelyVisibleEndLineNumber;return new z(t,this.getLineMinColumn(t),o,this.getLineMaxColumn(o))}getCompletelyVisibleViewRangeAtScrollTop(e){let t=this.viewLayout.getLinesViewportDataAtScrollTop(e),o=t.completelyVisibleStartLineNumber,n=t.completelyVisibleEndLineNumber;return new z(o,this.getLineMinColumn(o),n,this.getLineMaxColumn(n))}getViewRangeWithCursorPadding(e){let t=this._configuration.options,o=t.get(35),n=t.get(131),{startLineNumber:r,endLineNumber:s}=e,l=Math.min(Math.max(o,n.enabled?n.maxLineCount:0),Math.floor((s-r+1)/2));return r+=l,s-=Math.max(0,l-1),l===0||r>s?e:new z(r,this.getLineMinColumn(r),s,this.getLineMaxColumn(s))}saveState(){let e=this.viewLayout.saveState(),t=e.scrollTop,o=this.viewLayout.getLineNumberAtVerticalOffset(t),n=this.coordinatesConverter.convertViewPositionToModelPosition(new ye(o,this.getLineMinColumn(o))),r=this.viewLayout.getVerticalOffsetForLineNumber(o)-t;return{scrollLeft:e.scrollLeft,firstPosition:n,firstPositionDeltaTop:r}}reduceRestoreState(e){if(typeof e.firstPosition>"u")return this._reduceRestoreStateCompatibility(e);let t=this.model.validatePosition(e.firstPosition),o=this.coordinatesConverter.convertModelPositionToViewPosition(t),n=this.viewLayout.getVerticalOffsetForLineNumber(o.lineNumber)-e.firstPositionDeltaTop;return{scrollLeft:e.scrollLeft,scrollTop:n}}_reduceRestoreStateCompatibility(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTopWithoutViewZones}}getTabSize(){return this.model.getOptions().tabSize}getLineCount(){return this._lines.getViewLineCount()}setViewport(e,t,o){this._viewportStart.update(this,e)}getActiveIndentGuide(e,t,o){return this._lines.getActiveIndentGuide(e,t,o)}getLinesIndentGuides(e,t){return this._lines.getViewLinesIndentGuides(e,t)}getBracketGuidesInRangeByLine(e,t,o,n){return this._lines.getViewLinesBracketGuides(e,t,o,n)}getLineContent(e){return this._lines.getViewLineContent(e)}getLineLength(e){return this._lines.getViewLineLength(e)}getLineMinColumn(e){return this._lines.getViewLineMinColumn(e)}getLineMaxColumn(e){return this._lines.getViewLineMaxColumn(e)}getLineFirstNonWhitespaceColumn(e){let t=nm(this.getLineContent(e));return t===-1?0:t+1}getLineLastNonWhitespaceColumn(e){let t=hv(this.getLineContent(e));return t===-1?0:t+2}getMinimapDecorationsInRange(e){return this._decorations.getMinimapDecorationsInRange(e)}getDecorationsInViewport(e){return this._decorations.getDecorationsViewportData(e).decorations}getInjectedTextAt(e){return this._lines.getInjectedTextAt(e)}_getTextDirection(e,t){let o=0;for(let n of t){let r=n.range;if(r.startLineNumber>e||r.endLineNumber<e)continue;let s=n.options.textDirection;s===1?o++:s===0&&o--}return o>0?1:0}getTextDirection(e){let t=this._decorations.getDecorationsOnLine(e);return this._getTextDirection(e,t.decorations)}getViewportViewLineRenderingData(e,t){let o=this._decorations.getDecorationsViewportData(e),n=t-e.startLineNumber,r=o.inlineDecorations[n],s=o.hasVariableFonts[n];return this._getViewLineRenderingData(t,r,s,o.decorations)}getViewLineRenderingData(e){let t=this._decorations.getDecorationsOnLine(e);return this._getViewLineRenderingData(e,t.inlineDecorations[0],t.hasVariableFonts[0],t.decorations)}_getViewLineRenderingData(e,t,o,n){let r=this.model.mightContainRTL(),s=this.model.mightContainNonBasicASCII(),l=this.getTabSize(),c=this._lines.getViewLineData(e);return c.inlineDecorations&&(t=[...t,...c.inlineDecorations]),new ez(c.minColumn,c.maxColumn,c.content,c.continuesWithWrappedLine,r,s,c.tokens,t,l,c.startVisibleColumn,this._getTextDirection(e,n),o)}getViewLineData(e){return this._lines.getViewLineData(e)}getMinimapLinesRenderingData(e,t,o){let n=this._lines.getViewLinesData(e,t,o);return new wSt(this.getTabSize(),n)}getAllOverviewRulerDecorations(e){let t=this.model.getOverviewRulerDecorations(this._editorId,xae(this._configuration.options),kae(this._configuration.options)),o=new gni;for(let n of t){let r=n.options,s=r.overviewRuler;if(!s)continue;let l=s.position;if(l===0)continue;let c=s.getColor(e.value),u=this.coordinatesConverter.getViewLineNumberOfModelPosition(n.range.startLineNumber,n.range.startColumn),p=this.coordinatesConverter.getViewLineNumberOfModelPosition(n.range.endLineNumber,n.range.endColumn);o.accept(c,r.zIndex,u,p,l)}return o.asArray}_invalidateDecorationsColorCache(){let e=this.model.getOverviewRulerDecorations();for(let t of e)t.options.overviewRuler?.invalidateCachedColor(),t.options.minimap?.invalidateCachedColor()}getValueInRange(e,t){let o=this.coordinatesConverter.convertViewRangeToModelRange(e);return this.model.getValueInRange(o,t)}getValueLengthInRange(e,t){let o=this.coordinatesConverter.convertViewRangeToModelRange(e);return this.model.getValueLengthInRange(o,t)}modifyPosition(e,t){let o=this.coordinatesConverter.convertViewPositionToModelPosition(e),n=this.model.modifyPosition(o,t);return this.coordinatesConverter.convertModelPositionToViewPosition(n)}deduceModelPositionRelativeToViewPosition(e,t,o){let n=this.coordinatesConverter.convertViewPositionToModelPosition(e);this.model.getEOL().length===2&&(t<0?t-=o:t+=o);let s=this.model.getOffsetAt(n)+t;return this.model.getPositionAt(s)}getPlainTextToCopy(e,t,o){let n=o?`\r
`:this.model.getEOL();e=e.slice(0),e.sort(z.compareRangesUsingStarts);let r=!1,s=!1;for(let p of e)p.isEmpty()?r=!0:s=!0;if(!s&&!t)return{sourceRanges:[],sourceText:""};let l=[],c=[],u=(p,h="")=>{l.push(p),c.push(this.model.getValueInRange(p,o?2:0)+h)};if(r&&t){let p=0;for(let h of e){let g=h.startLineNumber;h.isEmpty()?g!==p&&u(new z(g,this.model.getLineMinColumn(g),g,this.model.getLineMaxColumn(g)),n):u(h),p=g}}else for(let p of e)p.isEmpty()||u(p);return{sourceRanges:l,sourceText:c.length===1?c[0]:c}}getRichTextToCopy(e,t){let o=this.model.getLanguageId();if(o===$r||e.length!==1)return null;let n=e[0];if(n.isEmpty()){if(!t)return null;let p=n.startLineNumber;n=new z(p,this.model.getLineMinColumn(p),p,this.model.getLineMaxColumn(p))}let r=this._configuration.options.get(59),s=this._getColorMap(),c=/[:;\\\/<>]/.test(r.fontFamily)||r.fontFamily===fu.fontFamily,u;return c?u=fu.fontFamily:(u=r.fontFamily,u=u.replace(/"/g,"'"),/[,']/.test(u)||/[+ ]/.test(u)&&(u=`'${u}'`),u=`${u}, ${fu.fontFamily}`),{mode:o,html:`<div style="color: ${s[1]};background-color: ${s[2]};font-family: ${u};font-weight: ${r.fontWeight};font-size: ${r.fontSize}px;line-height: ${r.lineHeight}px;white-space: pre;">`+this._getHTMLToCopy(n,s)+"</div>"}}_getHTMLToCopy(e,t){let o=e.startLineNumber,n=e.startColumn,r=e.endLineNumber,s=e.endColumn,l=this.getTabSize(),c="";for(let u=o;u<=r;u++){let p=this.model.tokenization.getLineTokens(u),h=p.getLineContent(),g=u===o?n-1:0,f=u===r?s-1:h.length;h===""?c+="<br>":c+=oyt(h,p.inflate(),t,g,f,l,ei)}return c}_getColorMap(){let e=ic.getColorMap(),t=["#000000"];if(e)for(let o=1,n=e.length;o<n;o++)t[o]=We.Format.CSS.formatHex(e[o]);return t}getPrimaryCursorState(){return this._cursor.getPrimaryCursorState()}getLastAddedCursorIndex(){return this._cursor.getLastAddedCursorIndex()}getCursorStates(){return this._cursor.getCursorStates()}setCursorStates(e,t,o){return this._withViewEventsCollector(n=>this._cursor.setStates(n,e,t,o))}getCursorColumnSelectData(){return this._cursor.getCursorColumnSelectData()}getCursorAutoClosedCharacters(){return this._cursor.getAutoClosedCharacters()}setCursorColumnSelectData(e){this._cursor.setCursorColumnSelectData(e)}getPrevEditOperationType(){return this._cursor.getPrevEditOperationType()}setPrevEditOperationType(e){this._cursor.setPrevEditOperationType(e)}getSelection(){return this._cursor.getSelection()}getSelections(){return this._cursor.getSelections()}getPosition(){return this._cursor.getPrimaryCursorState().modelState.position}setSelections(e,t,o=0){this._withViewEventsCollector(n=>this._cursor.setSelections(n,e,t,o))}saveCursorState(){return this._cursor.saveState()}restoreCursorState(e){this._withViewEventsCollector(t=>this._cursor.restoreState(t,e))}_executeCursorEdit(e){if(this._cursor.context.cursorConfig.readOnly){this._eventDispatcher.emitOutgoingEvent(new qIt);return}this._withViewEventsCollector(e)}executeEdits(e,t,o,n){this._executeCursorEdit(r=>this._cursor.executeEdits(r,e,t,o,n))}startComposition(){this._executeCursorEdit(e=>this._cursor.startComposition(e))}endComposition(e){this._executeCursorEdit(t=>this._cursor.endComposition(t,e))}type(e,t){this._executeCursorEdit(o=>this._cursor.type(o,e,t))}compositionType(e,t,o,n,r){this._executeCursorEdit(s=>this._cursor.compositionType(s,e,t,o,n,r))}paste(e,t,o,n){this._executeCursorEdit(r=>this._cursor.paste(r,e,t,o,n))}cut(e){this._executeCursorEdit(t=>this._cursor.cut(t,e))}executeCommand(e,t){this._executeCursorEdit(o=>this._cursor.executeCommand(o,e,t))}executeCommands(e,t){this._executeCursorEdit(o=>this._cursor.executeCommands(o,e,t))}revealAllCursors(e,t,o=!1){this._withViewEventsCollector(n=>this._cursor.revealAll(n,e,o,0,t,0))}revealPrimaryCursor(e,t,o=!1){this._withViewEventsCollector(n=>this._cursor.revealPrimary(n,e,o,0,t,0))}revealTopMostCursor(e){let t=this._cursor.getTopMostViewPosition(),o=new z(t.lineNumber,t.column,t.lineNumber,t.column);this._withViewEventsCollector(n=>n.emitViewEvent(new nj(e,!1,o,null,0,!0,0)))}revealBottomMostCursor(e){let t=this._cursor.getBottomMostViewPosition(),o=new z(t.lineNumber,t.column,t.lineNumber,t.column);this._withViewEventsCollector(n=>n.emitViewEvent(new nj(e,!1,o,null,0,!0,0)))}revealRange(e,t,o,n,r){this._withViewEventsCollector(s=>s.emitViewEvent(new nj(e,!1,o,null,n,t,r)))}changeWhitespace(e){this.viewLayout.changeWhitespace(e)&&(this._eventDispatcher.emitSingleViewEvent(new ovt),this._eventDispatcher.emitOutgoingEvent(new zIt))}_withViewEventsCollector(e){return this._transactionalTarget.batchChanges(()=>this._emitViewEvent(e))}_emitViewEvent(e){try{let t=this._eventDispatcher.beginEmitViewEvents();return e(t)}finally{this._eventDispatcher.endEmitViewEvents()}}batchEvents(e){this._withViewEventsCollector(()=>{e()})}normalizePosition(e,t){return this._lines.normalizePosition(e,t)}getLineIndentColumn(e){return this._lines.getLineIndentColumn(e)}},hni=class a{constructor(i,e,t,o,n){this._model=i;this._viewLineNumber=e;this._isValid=t;this._modelTrackedRange=o;this._startLineDelta=n}static create(i){let e=i._setTrackedRange(null,new z(1,1,1,1),1);return new a(i,1,!1,e,0)}get viewLineNumber(){return this._viewLineNumber}get isValid(){return this._isValid}get modelTrackedRange(){return this._modelTrackedRange}get startLineDelta(){return this._startLineDelta}dispose(){this._model._setTrackedRange(this._modelTrackedRange,null,1)}update(i,e){let t=i.coordinatesConverter.convertViewPositionToModelPosition(new ye(e,i.getLineMinColumn(e))),o=i.model._setTrackedRange(this._modelTrackedRange,new z(t.lineNumber,t.column,t.lineNumber,t.column),1),n=i.viewLayout.getVerticalOffsetForLineNumber(e),r=i.viewLayout.getCurrentScrollTop();this._viewLineNumber=e,this._isValid=!0,this._modelTrackedRange=o,this._startLineDelta=r-n}invalidate(){this._isValid=!1}},gni=class{constructor(){this._asMap=Object.create(null);this.asArray=[]}accept(i,e,t,o,n){let r=this._asMap[i];if(r){let s=r.data,l=s[s.length-3],c=s[s.length-1];if(l===n&&c+1>=t){o>c&&(s[s.length-1]=o);return}s.push(n,t,o)}else{let s=new Dle(i,e,[n,t,o]);this._asMap[i]=s,this.asArray.push(s)}}},fni=class{constructor(){this.hiddenAreas=new Map;this.shouldRecompute=!1;this.ranges=[]}setHiddenAreas(i,e){let t=this.hiddenAreas.get(i);t&&$8i(t,e)||(this.hiddenAreas.set(i,e),this.shouldRecompute=!0)}getMergedRanges(){if(!this.shouldRecompute)return this.ranges;this.shouldRecompute=!1;let i=Array.from(this.hiddenAreas.values()).reduce((e,t)=>TBo(e,t),[]);return $8i(this.ranges,i)?this.ranges:(this.ranges=i,this.ranges)}};function TBo(a,i){let e=[],t=0,o=0;for(;t<a.length&&o<i.length;){let n=a[t],r=i[o];if(n.endLineNumber<r.startLineNumber-1)e.push(a[t++]);else if(r.endLineNumber<n.startLineNumber-1)e.push(i[o++]);else{let s=Math.min(n.startLineNumber,r.startLineNumber),l=Math.max(n.endLineNumber,r.endLineNumber);e.push(new z(s,1,l,1)),t++,o++}}for(;t<a.length;)e.push(a[t++]);for(;o<i.length;)e.push(i[o++]);return e}function $8i(a,i){if(a.length!==i.length)return!1;for(let e=0;e<a.length;e++)if(!a[e].equalsRange(i[e]))return!1;return!0}var vyt=class{constructor(i,e){this.viewportStartModelPosition=i;this.startLineDelta=e}recoverViewportStart(i,e){if(!this.viewportStartModelPosition)return;let t=i.convertModelPositionToViewPosition(this.viewportStartModelPosition),o=e.getVerticalOffsetForLineNumber(t.lineNumber);e.setScrollPosition({scrollTop:o+this.startLineDelta},1)}};var _o=class{constructor(...i){this._entries=new Map;for(let[e,t]of i)this.set(e,t)}set(i,e){let t=this._entries.get(i);return this._entries.set(i,e),t}has(i){return this._entries.has(i)}get(i){return this._entries.get(i)}};var Xr=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.languageConfigurationService=h;this._deliveryQueue=sGi();this._contributions=this._register(new rIt);this._onDidDispose=this._register(new E);this.onDidDispose=this._onDidDispose.event;this._onDidChangeModelContent=this._register(new E({deliveryQueue:this._deliveryQueue}));this.onDidChangeModelContent=this._onDidChangeModelContent.event;this._onDidChangeModelLanguage=this._register(new E({deliveryQueue:this._deliveryQueue}));this.onDidChangeModelLanguage=this._onDidChangeModelLanguage.event;this._onDidChangeModelLanguageConfiguration=this._register(new E({deliveryQueue:this._deliveryQueue}));this.onDidChangeModelLanguageConfiguration=this._onDidChangeModelLanguageConfiguration.event;this._onDidChangeModelOptions=this._register(new E({deliveryQueue:this._deliveryQueue}));this.onDidChangeModelOptions=this._onDidChangeModelOptions.event;this._onDidChangeModelDecorations=this._register(new E({deliveryQueue:this._deliveryQueue}));this.onDidChangeModelDecorations=this._onDidChangeModelDecorations.event;this._onDidChangeLineHeight=this._register(new E({deliveryQueue:this._deliveryQueue}));this.onDidChangeLineHeight=this._onDidChangeLineHeight.event;this._onDidChangeFont=this._register(new E({deliveryQueue:this._deliveryQueue}));this.onDidChangeFont=this._onDidChangeFont.event;this._onDidChangeModelTokens=this._register(new E({deliveryQueue:this._deliveryQueue}));this.onDidChangeModelTokens=this._onDidChangeModelTokens.event;this._onDidChangeConfiguration=this._register(new E({deliveryQueue:this._deliveryQueue}));this.onDidChangeConfiguration=this._onDidChangeConfiguration.event;this._onWillChangeModel=this._register(new E({deliveryQueue:this._deliveryQueue}));this.onWillChangeModel=this._onWillChangeModel.event;this._onDidChangeModel=this._register(new E({deliveryQueue:this._deliveryQueue}));this.onDidChangeModel=this._onDidChangeModel.event;this._onDidChangeCursorPosition=this._register(new E({deliveryQueue:this._deliveryQueue}));this.onDidChangeCursorPosition=this._onDidChangeCursorPosition.event;this._onDidChangeCursorSelection=this._register(new E({deliveryQueue:this._deliveryQueue}));this.onDidChangeCursorSelection=this._onDidChangeCursorSelection.event;this._onDidAttemptReadOnlyEdit=this._register(new hb(this._contributions,this._deliveryQueue));this.onDidAttemptReadOnlyEdit=this._onDidAttemptReadOnlyEdit.event;this._onDidLayoutChange=this._register(new E({deliveryQueue:this._deliveryQueue}));this.onDidLayoutChange=this._onDidLayoutChange.event;this._editorTextFocus=this._register(new byt({deliveryQueue:this._deliveryQueue}));this.onDidFocusEditorText=this._editorTextFocus.onDidChangeToTrue;this.onDidBlurEditorText=this._editorTextFocus.onDidChangeToFalse;this._editorWidgetFocus=this._register(new byt({deliveryQueue:this._deliveryQueue}));this.onDidFocusEditorWidget=this._editorWidgetFocus.onDidChangeToTrue;this.onDidBlurEditorWidget=this._editorWidgetFocus.onDidChangeToFalse;this._onWillType=this._register(new hb(this._contributions,this._deliveryQueue));this.onWillType=this._onWillType.event;this._onDidType=this._register(new hb(this._contributions,this._deliveryQueue));this.onDidType=this._onDidType.event;this._onDidCompositionStart=this._register(new hb(this._contributions,this._deliveryQueue));this.onDidCompositionStart=this._onDidCompositionStart.event;this._onDidCompositionEnd=this._register(new hb(this._contributions,this._deliveryQueue));this.onDidCompositionEnd=this._onDidCompositionEnd.event;this._onDidPaste=this._register(new hb(this._contributions,this._deliveryQueue));this.onDidPaste=this._onDidPaste.event;this._onWillCopy=this._register(new hb(this._contributions,this._deliveryQueue));this.onWillCopy=this._onWillCopy.event;this._onWillCut=this._register(new hb(this._contributions,this._deliveryQueue));this.onWillCut=this._onWillCut.event;this._onWillPaste=this._register(new hb(this._contributions,this._deliveryQueue));this.onWillPaste=this._onWillPaste.event;this._onMouseUp=this._register(new hb(this._contributions,this._deliveryQueue));this.onMouseUp=this._onMouseUp.event;this._onMouseDown=this._register(new hb(this._contributions,this._deliveryQueue));this.onMouseDown=this._onMouseDown.event;this._onMouseDrag=this._register(new hb(this._contributions,this._deliveryQueue));this.onMouseDrag=this._onMouseDrag.event;this._onMouseDrop=this._register(new hb(this._contributions,this._deliveryQueue));this.onMouseDrop=this._onMouseDrop.event;this._onMouseDropCanceled=this._register(new hb(this._contributions,this._deliveryQueue));this.onMouseDropCanceled=this._onMouseDropCanceled.event;this._onDropIntoEditor=this._register(new hb(this._contributions,this._deliveryQueue));this.onDropIntoEditor=this._onDropIntoEditor.event;this._onContextMenu=this._register(new hb(this._contributions,this._deliveryQueue));this.onContextMenu=this._onContextMenu.event;this._onMouseMove=this._register(new hb(this._contributions,this._deliveryQueue));this.onMouseMove=this._onMouseMove.event;this._onMouseLeave=this._register(new hb(this._contributions,this._deliveryQueue));this.onMouseLeave=this._onMouseLeave.event;this._onMouseWheel=this._register(new hb(this._contributions,this._deliveryQueue));this.onMouseWheel=this._onMouseWheel.event;this._onKeyUp=this._register(new hb(this._contributions,this._deliveryQueue));this.onKeyUp=this._onKeyUp.event;this._onKeyDown=this._register(new hb(this._contributions,this._deliveryQueue));this.onKeyDown=this._onKeyDown.event;this._onDidContentSizeChange=this._register(new E({deliveryQueue:this._deliveryQueue}));this.onDidContentSizeChange=this._onDidContentSizeChange.event;this._onDidScrollChange=this._register(new E({deliveryQueue:this._deliveryQueue}));this.onDidScrollChange=this._onDidScrollChange.event;this._onDidChangeViewZones=this._register(new E({deliveryQueue:this._deliveryQueue}));this.onDidChangeViewZones=this._onDidChangeViewZones.event;this._onDidChangeHiddenAreas=this._register(new E({deliveryQueue:this._deliveryQueue}));this.onDidChangeHiddenAreas=this._onDidChangeHiddenAreas.event;this._updateCounter=0;this._onWillTriggerEditorOperationEvent=this._register(new E);this.onWillTriggerEditorOperationEvent=this._onWillTriggerEditorOperationEvent.event;this._onBeginUpdate=this._register(new E);this.onBeginUpdate=this._onBeginUpdate.event;this._onEndUpdate=this._register(new E);this.onEndUpdate=this._onEndUpdate.event;this._onBeforeExecuteEdit=this._register(new E);this.onBeforeExecuteEdit=this._onBeforeExecuteEdit.event;this._actions=new Map;this._bannerDomNode=null;this._dropIntoEditorDecorations=this.createDecorationsCollection();this.inComposition=!1;r.willCreateCodeEditor();let v={...t};if(this._domElement=e,this._userInteractionService=f,this._overflowWidgetsDomNode=v.overflowWidgetsDomNode,delete v.overflowWidgetsDomNode,this._id=++DBo,this._decorationTypeKeysToIds={},this._decorationTypeSubtypes={},this._telemetryData=o.telemetryData,this._configuration=this._register(this._createConfiguration(o.isSimpleWidget||!1,o.contextMenuId??(o.isSimpleWidget?D.SimpleEditorContext:D.EditorContext),v,p)),this._domElement.style?.setProperty("--editor-font-size",this._configuration.options.get(61)+"px"),this._register(this._configuration.onDidChange(y=>{this._onDidChangeConfiguration.fire(y);let w=this._configuration.options;if(y.hasChanged(165)){let k=w.get(165);this._onDidLayoutChange.fire(k)}y.hasChanged(61)&&this._domElement.style.setProperty("--editor-font-size",w.get(61)+"px")})),this._contextKeyService=this._register(l.createScoped(this._domElement)),o.contextKeyValues)for(let[y,w]of Object.entries(o.contextKeyValues))this._contextKeyService.createKey(y,w);this._notificationService=u,this._codeEditorService=r,this._commandService=s,this._themeService=c,this._register(new bni(this,this._contextKeyService)),this._register(new Sni(this,this._contextKeyService,g)),this._instantiationService=this._register(n.createChild(new _o([X,this._contextKeyService]))),this._modelData=null,this._contentWidgets={},this._overlayWidgets={},this._glyphMarginWidgets={};let b;Array.isArray(o.contributions)?b=o.contributions:b=Ba.getEditorContributions(),this._contributions.initialize(this,b,this._instantiationService);for(let y of Ba.getEditorActions()){if(this._actions.has(y.id)){mt(new Error(`Cannot have two actions with the same id ${y.id}`));continue}let w=new sIt(y.id,y.label,y.alias,y.metadata,y.precondition??void 0,k=>this._instantiationService.invokeFunction(T=>Promise.resolve(y.runEditorCommand(T,this,k))),this._contextKeyService);this._actions.set(w.id,w)}let S=()=>!this._configuration.options.get(104)&&this._configuration.options.get(43).enabled;this._register(new Uh(this._domElement,{onDragOver:y=>{if(!S())return;let w=this.getTargetAtClientPoint(y.clientX,y.clientY);w?.position&&this.showDropIndicatorAt(w.position)},onDrop:async y=>{if(!S()||(this.removeDropIndicator(),!y.dataTransfer))return;let w=this.getTargetAtClientPoint(y.clientX,y.clientY);w?.position&&this._onDropIntoEditor.fire({position:w.position,event:y})},onDragLeave:()=>{this.removeDropIndicator()},onDragEnd:()=>{this.removeDropIndicator()}})),this._codeEditorService.addCodeEditor(this)}static{this.dropIntoEditorDecorationOptions=mo.register({description:"workbench-dnd-target",className:"dnd-target"})}get isSimpleWidget(){return this._configuration.isSimpleWidget}get contextMenuId(){return this._configuration.contextMenuId}get contextKeyService(){return this._contextKeyService}writeScreenReaderContent(e){this._modelData?.view.writeScreenReaderContent(e)}_createConfiguration(e,t,o,n){return new x7(e,t,o,this._domElement,n)}getId(){return this.getEditorType()+":"+this._id}getEditorType(){return oj.ICodeEditor}dispose(){this._codeEditorService.removeCodeEditor(this),this._actions.clear(),this._contentWidgets={},this._overlayWidgets={},this._removeDecorationTypes(),this._postDetachModelCleanup(this._detachModel()),this._onDidDispose.fire(),super.dispose()}invokeWithinContext(e){return this._instantiationService.invokeFunction(e)}updateOptions(e){this._configuration.updateOptions(e||{})}getOptions(){return this._configuration.options}getOption(e){return this._configuration.options.get(e)}getRawOptions(){return this._configuration.getRawOptions()}getOverflowWidgetsDomNode(){return this._overflowWidgetsDomNode}getConfiguredWordAtPosition(e){return this._modelData?Hf.getWordAtPosition(this._modelData.model,this._configuration.options.get(148),this._configuration.options.get(147),e):null}getValue(e=null){if(!this._modelData)return"";let t=!!(e&&e.preserveBOM),o=0;return e&&e.lineEnding&&e.lineEnding===`
`?o=1:e&&e.lineEnding&&e.lineEnding===`\r
`&&(o=2),this._modelData.model.getValue(o,t)}setValue(e){try{if(this._beginUpdate(),!this._modelData)return;this._modelData.model.setValue(e)}finally{this._endUpdate()}}getModel(){return this._modelData?this._modelData.model:null}setModel(e=null){try{this._beginUpdate();let t=e;if(this._modelData===null&&t===null||this._modelData&&this._modelData.model===t)return;let o={oldModelUrl:this._modelData?.model.uri||null,newModelUrl:t?.uri||null};this._onWillChangeModel.fire(o);let n=this.hasTextFocus(),r=this._detachModel();this._attachModel(t),this.hasModel()?n&&this.focus():(this._editorTextFocus.setValue(!1),this._editorWidgetFocus.setValue(!1)),this._removeDecorationTypes(),this._onDidChangeModel.fire(o),this._postDetachModelCleanup(r),this._contributionsDisposable=this._contributions.onAfterModelAttached()}finally{this._endUpdate()}}_removeDecorationTypes(){if(this._decorationTypeKeysToIds={},this._decorationTypeSubtypes){for(let e in this._decorationTypeSubtypes){let t=this._decorationTypeSubtypes[e];for(let o in t)this._removeDecorationType(e+"-"+o)}this._decorationTypeSubtypes={}}}getVisibleRanges(){return this._modelData?this._modelData.viewModel.getVisibleRanges():[]}getVisibleRangesPlusViewportAboveBelow(){return this._modelData?this._modelData.viewModel.getVisibleRangesPlusViewportAboveBelow():[]}getWhitespaces(){return this._modelData?this._modelData.viewModel.viewLayout.getWhitespaces():[]}static _getVerticalOffsetAfterPosition(e,t,o,n){let r=e.model.validatePosition({lineNumber:t,column:o}),s=e.viewModel.coordinatesConverter.convertModelPositionToViewPosition(r);return e.viewModel.viewLayout.getVerticalOffsetAfterLineNumber(s.lineNumber,n)}getTopForLineNumber(e,t=!1){return this._modelData?Xr._getVerticalOffsetForPosition(this._modelData,e,1,t):-1}getTopForPosition(e,t){return this._modelData?Xr._getVerticalOffsetForPosition(this._modelData,e,t,!1):-1}static _getVerticalOffsetForPosition(e,t,o,n=!1){let r=e.model.validatePosition({lineNumber:t,column:o}),s=e.viewModel.coordinatesConverter.convertModelPositionToViewPosition(r);return e.viewModel.viewLayout.getVerticalOffsetForLineNumber(s.lineNumber,n)}getBottomForLineNumber(e,t=!1){return this._modelData?Xr._getVerticalOffsetAfterPosition(this._modelData,e,Number.MAX_SAFE_INTEGER,t):-1}getLineHeightForPosition(e){if(!this._modelData)return-1;let t=this._modelData.viewModel,o=t.coordinatesConverter,n=ye.lift(e);if(o.modelPositionIsVisible(n)){let r=o.convertModelPositionToViewPosition(n);return t.viewLayout.getLineHeightForLineNumber(r.lineNumber)}return 0}setHiddenAreas(e,t,o){this._modelData?.viewModel.setHiddenAreas(e.map(n=>z.lift(n)),t,o)}getVisibleColumnFromPosition(e){if(!this._modelData)return e.column;let t=this._modelData.model.validatePosition(e),o=this._modelData.model.getOptions().tabSize;return fl.visibleColumnFromColumn(this._modelData.model.getLineContent(t.lineNumber),t.column,o)+1}getStatusbarColumn(e){if(!this._modelData)return e.column;let t=this._modelData.model.validatePosition(e),o=this._modelData.model.getOptions().tabSize;return fl.toStatusbarColumn(this._modelData.model.getLineContent(t.lineNumber),t.column,o)}getPosition(){return this._modelData?this._modelData.viewModel.getPosition():null}setPosition(e,t="api"){if(this._modelData){if(!ye.isIPosition(e))throw new Error("Invalid arguments");this._modelData.viewModel.setSelections(t,[{selectionStartLineNumber:e.lineNumber,selectionStartColumn:e.column,positionLineNumber:e.lineNumber,positionColumn:e.column}])}}_sendRevealRange(e,t,o,n){if(!this._modelData)return;if(!z.isIRange(e))throw new Error("Invalid arguments");let r=this._modelData.model.validateRange(e),s=this._modelData.viewModel.coordinatesConverter.convertModelRangeToViewRange(r);this._modelData.viewModel.revealRange("api",o,s,t,n)}revealAllCursors(e,t){this._modelData&&this._modelData.viewModel.revealAllCursors("api",e,t)}revealLine(e,t=0){this._revealLine(e,0,t)}revealLineInCenter(e,t=0){this._revealLine(e,1,t)}revealLineInCenterIfOutsideViewport(e,t=0){this._revealLine(e,2,t)}revealLineNearTop(e,t=0){this._revealLine(e,5,t)}_revealLine(e,t,o){if(typeof e!="number")throw new Error("Invalid arguments");this._sendRevealRange(new z(e,1,e,1),t,!1,o)}revealPosition(e,t=0){this._revealPosition(e,0,!0,t)}revealPositionInCenter(e,t=0){this._revealPosition(e,1,!0,t)}revealPositionInCenterIfOutsideViewport(e,t=0){this._revealPosition(e,2,!0,t)}revealPositionNearTop(e,t=0){this._revealPosition(e,5,!0,t)}_revealPosition(e,t,o,n){if(!ye.isIPosition(e))throw new Error("Invalid arguments");this._sendRevealRange(new z(e.lineNumber,e.column,e.lineNumber,e.column),t,o,n)}getSelection(){return this._modelData?this._modelData.viewModel.getSelection():null}getSelections(){return this._modelData?this._modelData.viewModel.getSelections():null}setSelection(e,t="api"){let o=ti.isISelection(e),n=z.isIRange(e);if(!o&&!n)throw new Error("Invalid arguments");if(o)this._setSelectionImpl(e,t);else if(n){let r={selectionStartLineNumber:e.startLineNumber,selectionStartColumn:e.startColumn,positionLineNumber:e.endLineNumber,positionColumn:e.endColumn};this._setSelectionImpl(r,t)}}_setSelectionImpl(e,t){if(!this._modelData)return;let o=new ti(e.selectionStartLineNumber,e.selectionStartColumn,e.positionLineNumber,e.positionColumn);this._modelData.viewModel.setSelections(t,[o])}revealLines(e,t,o=0){this._revealLines(e,t,0,o)}revealLinesInCenter(e,t,o=0){this._revealLines(e,t,1,o)}revealLinesInCenterIfOutsideViewport(e,t,o=0){this._revealLines(e,t,2,o)}revealLinesNearTop(e,t,o=0){this._revealLines(e,t,5,o)}_revealLines(e,t,o,n){if(typeof e!="number"||typeof t!="number")throw new Error("Invalid arguments");this._sendRevealRange(new z(e,1,t,1),o,!1,n)}revealRange(e,t=0,o=!1,n=!0){this._revealRange(e,o?1:0,n,t)}revealRangeInCenter(e,t=0){this._revealRange(e,1,!0,t)}revealRangeInCenterIfOutsideViewport(e,t=0){this._revealRange(e,2,!0,t)}revealRangeNearTop(e,t=0){this._revealRange(e,5,!0,t)}revealRangeNearTopIfOutsideViewport(e,t=0){this._revealRange(e,6,!0,t)}revealRangeAtTop(e,t=0){this._revealRange(e,3,!0,t)}_revealRange(e,t,o,n){if(!z.isIRange(e))throw new Error("Invalid arguments");this._sendRevealRange(z.lift(e),t,o,n)}setSelections(e,t="api",o=0){if(this._modelData){if(!e||e.length===0)throw new Error("Invalid arguments");for(let n=0,r=e.length;n<r;n++)if(!ti.isISelection(e[n]))throw new Error("Invalid arguments");this._modelData.viewModel.setSelections(t,e,o)}}getContentWidth(){return this._modelData?this._modelData.viewModel.viewLayout.getContentWidth():-1}getScrollWidth(){return this._modelData?this._modelData.viewModel.viewLayout.getScrollWidth():-1}getScrollLeft(){return this._modelData?this._modelData.viewModel.viewLayout.getCurrentScrollLeft():-1}getContentHeight(){return this._modelData?this._modelData.viewModel.viewLayout.getContentHeight():-1}getScrollHeight(){return this._modelData?this._modelData.viewModel.viewLayout.getScrollHeight():-1}getScrollTop(){return this._modelData?this._modelData.viewModel.viewLayout.getCurrentScrollTop():-1}setScrollLeft(e,t=1){if(this._modelData){if(typeof e!="number")throw new Error("Invalid arguments");this._modelData.viewModel.viewLayout.setScrollPosition({scrollLeft:e},t)}}setScrollTop(e,t=1){if(this._modelData){if(typeof e!="number")throw new Error("Invalid arguments");this._modelData.viewModel.viewLayout.setScrollPosition({scrollTop:e},t)}}setScrollPosition(e,t=1){this._modelData&&this._modelData.viewModel.viewLayout.setScrollPosition(e,t)}hasPendingScrollAnimation(){return this._modelData?this._modelData.viewModel.viewLayout.hasPendingScrollAnimation():!1}saveViewState(){if(!this._modelData)return null;let e=this._contributions.saveViewState(),t=this._modelData.viewModel.saveCursorState(),o=this._modelData.viewModel.saveState();return{cursorState:t,viewState:o,contributionsState:e}}restoreViewState(e){if(!this._modelData||!this._modelData.hasRealView)return;let t=e;if(t&&t.cursorState&&t.viewState){let o=t.cursorState;Array.isArray(o)?o.length>0&&this._modelData.viewModel.restoreCursorState(o):this._modelData.viewModel.restoreCursorState([o]),this._contributions.restoreViewState(t.contributionsState||{});let n=this._modelData.viewModel.reduceRestoreState(t.viewState);this._modelData.view.restoreState(n)}}handleInitialized(){this._getViewModel()?.visibleLinesStabilized()}onVisible(){this._modelData?.view.refreshFocusState()}onHide(){this._modelData?.view.refreshFocusState()}getContribution(e){return this._contributions.get(e)}getActions(){return Array.from(this._actions.values())}getSupportedActions(){let e=this.getActions();return e=e.filter(t=>t.isSupported()),e}getAction(e){return this._actions.get(e)||null}trigger(e,t,o){o=o||{};try{switch(this._onWillTriggerEditorOperationEvent.fire({source:e,handlerId:t,payload:o}),this._beginUpdate(),t){case"compositionStart":this._startComposition();return;case"compositionEnd":this._endComposition(e);return;case"type":{let r=o;this._type(e,r.text||"");return}case"replacePreviousChar":{let r=o;this._compositionType(e,r.text||"",r.replaceCharCnt||0,0,0);return}case"compositionType":{let r=o;this._compositionType(e,r.text||"",r.replacePrevCharCnt||0,r.replaceNextCharCnt||0,r.positionDelta||0);return}case"paste":{let r=o;this._paste(e,r.text||"",r.pasteOnNewLine||!1,r.multicursorText||null,r.mode||null,r.clipboardEvent);return}case"cut":this._cut(e);return}let n=this.getAction(t);if(n){Promise.resolve(n.run(o)).then(void 0,mt);return}if(!this._modelData||this._triggerEditorCommand(e,t,o))return;this._triggerCommand(t,o)}finally{this._endUpdate()}}_triggerCommand(e,t){this._commandService.executeCommand(e,t)}_startComposition(){this._modelData&&(this.inComposition=!0,this._modelData.viewModel.startComposition(),this._onDidCompositionStart.fire())}_endComposition(e){this._modelData&&(this.inComposition=!1,this._modelData.viewModel.endComposition(e),this._onDidCompositionEnd.fire())}_type(e,t){!this._modelData||t.length===0||(e==="keyboard"&&this._onWillType.fire(t),this._modelData.viewModel.type(t,e),e==="keyboard"&&this._onDidType.fire(t))}_compositionType(e,t,o,n,r){this._modelData&&this._modelData.viewModel.compositionType(t,o,n,r,e)}_paste(e,t,o,n,r,s){if(!this._modelData)return;let l=this._modelData.viewModel,c=l.getSelection().getStartPosition();l.paste(t,o,n,e);let u=l.getSelection().getStartPosition();e==="keyboard"&&this._onDidPaste.fire({clipboardEvent:s,range:new z(c.lineNumber,c.column,u.lineNumber,u.column),languageId:r})}_cut(e){this._modelData&&this._modelData.viewModel.cut(e)}_triggerEditorCommand(e,t,o){let n=Ba.getEditorCommand(t);return n?(o=o||{},xi(o)&&(o.source=e),this._instantiationService.invokeFunction(r=>{Promise.resolve(n.runEditorCommand(r,this,o)).then(void 0,mt)}),!0):!1}_getViewModel(){return this._modelData?this._modelData.viewModel:null}pushUndoStop(){return!this._modelData||this._configuration.options.get(104)?!1:(this._modelData.model.pushStackElement(),!0)}popUndoStop(){return!this._modelData||this._configuration.options.get(104)?!1:(this._modelData.model.popStackElement(),!0)}edit(e,t){return this.executeEdits(t,e.replacements.map(o=>({range:o.range,text:o.text})),void 0)}executeEdits(e,t,o){if(!this._modelData||this._configuration.options.get(104))return!1;let n;o?Array.isArray(o)?n=()=>o:n=o:n=()=>null;let r,s;return e instanceof b5e?(s=e,r=e.metadata.source):(s=Wc.unknown({name:e}),r=e),this._onBeforeExecuteEdit.fire({source:r??void 0}),this._modelData.viewModel.executeEdits(r,t,n,s),!0}executeCommand(e,t){this._modelData&&this._modelData.viewModel.executeCommand(t,e)}executeCommands(e,t){this._modelData&&this._modelData.viewModel.executeCommands(t,e)}createDecorationsCollection(e){return new Ini(this,e)}changeDecorations(e){return this._modelData?this._modelData.model.changeDecorations(e,this._id):null}getLineDecorations(e){if(!this._modelData)return null;let t=this._configuration.options;return this._modelData.model.getLineDecorations(e,this._id,xae(t),kae(t))}getDecorationsInRange(e){if(!this._modelData)return null;let t=this._configuration.options;return this._modelData.model.getDecorationsInRange(e,this._id,xae(t),kae(t))}getFontSizeAtPosition(e){return this._modelData?this._modelData.viewModel.getFontSizeAtPosition(e):null}deltaDecorations(e,t){return this._modelData?e.length===0&&t.length===0?e:this._modelData.model.deltaDecorations(e,t,this._id):[]}removeDecorations(e){!this._modelData||e.length===0||this._modelData.model.changeDecorations(t=>{t.deltaDecorations(e,[])})}setDecorationsByType(e,t,o){let n={},r=this._decorationTypeSubtypes[t]||{};this._decorationTypeSubtypes[t]=n;let s=[];for(let c of o){let u=t;if(c.renderOptions){let h=_r(c.renderOptions).toString(16);u=t+"-"+h,!r[h]&&!n[h]&&this._registerDecorationType(e,u,c.renderOptions,t),n[h]=!0}let p=this._resolveDecorationOptions(u,!!c.hoverMessage);c.hoverMessage&&(p.hoverMessage=c.hoverMessage),s.push({range:c.range,options:p})}for(let c in r)n[c]||this._removeDecorationType(t+"-"+c);let l=this._decorationTypeKeysToIds[t]||[];return this.changeDecorations(c=>this._decorationTypeKeysToIds[t]=c.deltaDecorations(l,s)),this._decorationTypeKeysToIds[t]||[]}setDecorationsByTypeFast(e,t){let o=this._decorationTypeSubtypes[e]||{};for(let l in o)this._removeDecorationType(e+"-"+l);this._decorationTypeSubtypes[e]={};let n=mo.createDynamic(this._resolveDecorationOptions(e,!1)),r=new Array(t.length);for(let l=0,c=t.length;l<c;l++)r[l]={range:t[l],options:n};let s=this._decorationTypeKeysToIds[e]||[];this.changeDecorations(l=>this._decorationTypeKeysToIds[e]=l.deltaDecorations(s,r))}removeDecorationsByType(e){let t=this._decorationTypeKeysToIds[e];if(t&&this.changeDecorations(o=>o.deltaDecorations(t,[])),this._decorationTypeKeysToIds.hasOwnProperty(e)&&delete this._decorationTypeKeysToIds[e],this._decorationTypeSubtypes.hasOwnProperty(e)){let o=this._decorationTypeSubtypes[e];for(let n of Object.keys(o))this._removeDecorationType(e+"-"+n);delete this._decorationTypeSubtypes[e]}}getLayoutInfo(){return this._configuration.options.get(165)}createOverviewRuler(e){return!this._modelData||!this._modelData.hasRealView?null:this._modelData.view.createOverviewRuler(e)}getContainerDomNode(){return this._domElement}getDomNode(){return!this._modelData||!this._modelData.hasRealView?null:this._modelData.view.domNode.domNode}delegateVerticalScrollbarPointerDown(e){!this._modelData||!this._modelData.hasRealView||this._modelData.view.delegateVerticalScrollbarPointerDown(e)}delegateScrollFromMouseWheelEvent(e){!this._modelData||!this._modelData.hasRealView||this._modelData.view.delegateScrollFromMouseWheelEvent(e)}layout(e,t=!1){this._configuration.observeContainer(e),t||this.render()}focus(){!this._modelData||!this._modelData.hasRealView||this._modelData.view.focus()}hasTextFocus(){return!this._modelData||!this._modelData.hasRealView?!1:this._modelData.view.isFocused()}hasWidgetFocus(){return!this._modelData||!this._modelData.hasRealView?!1:this._modelData.view.isWidgetFocused()}addContentWidget(e){let t={widget:e,position:e.getPosition()};this._contentWidgets.hasOwnProperty(e.getId())&&console.warn("Overwriting a content widget with the same id:"+e.getId()),this._contentWidgets[e.getId()]=t,this._modelData&&this._modelData.hasRealView&&this._modelData.view.addContentWidget(t)}layoutContentWidget(e){let t=e.getId();if(this._contentWidgets.hasOwnProperty(t)){let o=this._contentWidgets[t];o.position=e.getPosition(),this._modelData&&this._modelData.hasRealView&&this._modelData.view.layoutContentWidget(o)}}removeContentWidget(e){let t=e.getId();if(this._contentWidgets.hasOwnProperty(t)){let o=this._contentWidgets[t];delete this._contentWidgets[t],this._modelData&&this._modelData.hasRealView&&this._modelData.view.removeContentWidget(o)}}addOverlayWidget(e){let t={widget:e,position:e.getPosition()};this._overlayWidgets.hasOwnProperty(e.getId())&&console.warn("Overwriting an overlay widget with the same id."),this._overlayWidgets[e.getId()]=t,this._modelData&&this._modelData.hasRealView&&this._modelData.view.addOverlayWidget(t)}layoutOverlayWidget(e){let t=e.getId();if(this._overlayWidgets.hasOwnProperty(t)){let o=this._overlayWidgets[t];o.position=e.getPosition(),this._modelData&&this._modelData.hasRealView&&this._modelData.view.layoutOverlayWidget(o)}}removeOverlayWidget(e){let t=e.getId();if(this._overlayWidgets.hasOwnProperty(t)){let o=this._overlayWidgets[t];delete this._overlayWidgets[t],this._modelData&&this._modelData.hasRealView&&this._modelData.view.removeOverlayWidget(o)}}addGlyphMarginWidget(e){let t={widget:e,position:e.getPosition()};this._glyphMarginWidgets.hasOwnProperty(e.getId())&&console.warn("Overwriting a glyph margin widget with the same id."),this._glyphMarginWidgets[e.getId()]=t,this._modelData&&this._modelData.hasRealView&&this._modelData.view.addGlyphMarginWidget(t)}layoutGlyphMarginWidget(e){let t=e.getId();if(this._glyphMarginWidgets.hasOwnProperty(t)){let o=this._glyphMarginWidgets[t];o.position=e.getPosition(),this._modelData&&this._modelData.hasRealView&&this._modelData.view.layoutGlyphMarginWidget(o)}}removeGlyphMarginWidget(e){let t=e.getId();if(this._glyphMarginWidgets.hasOwnProperty(t)){let o=this._glyphMarginWidgets[t];delete this._glyphMarginWidgets[t],this._modelData&&this._modelData.hasRealView&&this._modelData.view.removeGlyphMarginWidget(o)}}changeViewZones(e){!this._modelData||!this._modelData.hasRealView||this._modelData.view.change(e)}getTargetAtClientPoint(e,t){return!this._modelData||!this._modelData.hasRealView?null:this._modelData.view.getTargetAtClientPoint(e,t)}getScrolledVisiblePosition(e){if(!this._modelData||!this._modelData.hasRealView)return null;let t=this._modelData.model.validatePosition(e),n=this._configuration.options.get(165),r=Xr._getVerticalOffsetForPosition(this._modelData,t.lineNumber,t.column)-this.getScrollTop(),s=this._modelData.view.getOffsetForColumn(t.lineNumber,t.column)+n.glyphMarginWidth+n.lineNumbersWidth+n.decorationsWidth-this.getScrollLeft(),l=this.getLineHeightForPosition(t);return{top:r,left:s,height:l}}getOffsetForColumn(e,t){return!this._modelData||!this._modelData.hasRealView?-1:this._modelData.view.getOffsetForColumn(e,t)}getWidthOfLine(e){return!this._modelData||!this._modelData.hasRealView?-1:this._modelData.view.getLineWidth(e)}resetLineWidthCaches(){!this._modelData||!this._modelData.hasRealView||this._modelData.view.resetLineWidthCaches()}render(e=!1){!this._modelData||!this._modelData.hasRealView||this._modelData.viewModel.batchEvents(()=>{this._modelData.view.render(!0,e)})}renderAsync(e=!1){!this._modelData||!this._modelData.hasRealView||this._modelData.viewModel.batchEvents(()=>{this._modelData.view.render(!1,e)})}setAriaOptions(e){!this._modelData||!this._modelData.hasRealView||this._modelData.view.setAriaOptions(e)}applyFontInfo(e){Jd(e,this._configuration.options.get(59))}setBanner(e,t){this._bannerDomNode&&this._domElement.contains(this._bannerDomNode)&&this._bannerDomNode.remove(),this._bannerDomNode=e,this._configuration.setReservedHeight(e?t:0),this._bannerDomNode&&this._domElement.prepend(this._bannerDomNode)}_attachModel(e){if(!e){this._modelData=null;return}let t=[];this._domElement.setAttribute("data-mode-id",e.getLanguageId()),this._configuration.setIsDominatedByLongLines(e.isDominatedByLongLines()),this._configuration.setModelLineCount(e.getLineCount());let o=e.onBeforeAttached(),n=new fyt(this._id,this._configuration,e,nIt.create(Re(this._domElement)),WIt.create(this._configuration.options),l=>Wr(Re(this._domElement),l),this.languageConfigurationService,this._themeService,o,{batchChanges:l=>{try{return this._beginUpdate(),l()}finally{this._endUpdate()}}});t.push(e.onWillDispose(()=>this.setModel(null))),t.push(n.onEvent(l=>{switch(l.kind){case 0:this._onDidContentSizeChange.fire(l);break;case 1:this._editorTextFocus.setValue(l.hasFocus);break;case 2:this._editorWidgetFocus.setValue(l.hasFocus);break;case 3:this._onDidScrollChange.fire(l);break;case 4:this._onDidChangeViewZones.fire();break;case 5:this._onDidChangeHiddenAreas.fire();break;case 6:this._onDidAttemptReadOnlyEdit.fire();break;case 7:{if(l.reachedMaxCursorCount){let h=this.getOption(89),g=d(194,null,h);this._notificationService.prompt(ft.Warning,g,[{label:"Find and Replace",run:()=>{this._commandService.executeCommand("editor.action.startFindReplaceAction")}},{label:d(195,null),run:()=>{this._commandService.executeCommand("workbench.action.openSettings2",{query:"editor.multiCursorLimit"})}}])}let c=[];for(let h=0,g=l.selections.length;h<g;h++)c[h]=l.selections[h].getPosition();let u={position:c[0],secondaryPositions:c.slice(1),reason:l.reason,source:l.source};this._onDidChangeCursorPosition.fire(u);let p={selection:l.selections[0],secondarySelections:l.selections.slice(1),modelVersionId:l.modelVersionId,oldSelections:l.oldSelections,oldModelVersionId:l.oldModelVersionId,source:l.source,reason:l.reason};this._onDidChangeCursorSelection.fire(p);break}case 8:this._onDidChangeModelDecorations.fire(l.event);break;case 9:this._domElement.setAttribute("data-mode-id",e.getLanguageId()),this._onDidChangeModelLanguage.fire(l.event);break;case 10:this._onDidChangeModelLanguageConfiguration.fire(l.event);break;case 11:this._onDidChangeModelContent.fire(l.event);break;case 12:this._onDidChangeModelOptions.fire(l.event);break;case 13:this._onDidChangeModelTokens.fire(l.event);break;case 14:this._onDidChangeLineHeight.fire(l.event);break;case 15:this._onDidChangeFont.fire(l.event);break}}));let[r,s]=this._createView(n);if(s){this._domElement.appendChild(r.domNode.domNode);let l=Object.keys(this._contentWidgets);for(let c=0,u=l.length;c<u;c++){let p=l[c];r.addContentWidget(this._contentWidgets[p])}l=Object.keys(this._overlayWidgets);for(let c=0,u=l.length;c<u;c++){let p=l[c];r.addOverlayWidget(this._overlayWidgets[p])}l=Object.keys(this._glyphMarginWidgets);for(let c=0,u=l.length;c<u;c++){let p=l[c];r.addGlyphMarginWidget(this._glyphMarginWidgets[p])}r.render(!1,!0),r.domNode.domNode.setAttribute("data-uri",e.uri.toString()),t.push(r.onWillCopy(c=>this._onWillCopy.fire(c))),t.push(r.onWillCut(c=>this._onWillCut.fire(c))),t.push(r.onWillPaste(c=>this._onWillPaste.fire(c)))}this._modelData=new vni(e,n,r,s,t,o)}_createView(e){let t;this.isSimpleWidget?t={paste:(r,s,l,c)=>{this._paste("keyboard",r,s,l,c)},type:r=>{this._type("keyboard",r)},compositionType:(r,s,l,c)=>{this._compositionType("keyboard",r,s,l,c)},startComposition:()=>{this._startComposition()},endComposition:()=>{this._endComposition("keyboard")},cut:()=>{this._cut("keyboard")}}:t={paste:(r,s,l,c)=>{let u={text:r,pasteOnNewLine:s,multicursorText:l,mode:c};this._commandService.executeCommand("paste",u)},type:r=>{let s={text:r};this._commandService.executeCommand("type",s)},compositionType:(r,s,l,c)=>{if(l||c){let u={text:r,replacePrevCharCnt:s,replaceNextCharCnt:l,positionDelta:c};this._commandService.executeCommand("compositionType",u)}else{let u={text:r,replaceCharCnt:s};this._commandService.executeCommand("replacePreviousChar",u)}},startComposition:()=>{this._commandService.executeCommand("compositionStart",{})},endComposition:()=>{this._commandService.executeCommand("compositionEnd",{})},cut:()=>{this._commandService.executeCommand("cut",{})}};let o=new vwe(e.coordinatesConverter);return o.onKeyDown=r=>this._onKeyDown.fire(r),o.onKeyUp=r=>this._onKeyUp.fire(r),o.onContextMenu=r=>this._onContextMenu.fire(r),o.onMouseMove=r=>this._onMouseMove.fire(r),o.onMouseLeave=r=>this._onMouseLeave.fire(r),o.onMouseDown=r=>this._onMouseDown.fire(r),o.onMouseUp=r=>this._onMouseUp.fire(r),o.onMouseDrag=r=>this._onMouseDrag.fire(r),o.onMouseDrop=r=>this._onMouseDrop.fire(r),o.onMouseDropCanceled=r=>this._onMouseDropCanceled.fire(r),o.onMouseWheel=r=>this._onMouseWheel.fire(r),[new Uwe(this._domElement,this.getId(),t,this._configuration,this._themeService.getColorTheme(),e,o,this._overflowWidgetsDomNode,this._instantiationService,this._userInteractionService),!0]}_postDetachModelCleanup(e){e?.removeAllDecorationsWithOwnerId(this._id)}_detachModel(){if(this._contributionsDisposable?.dispose(),this._contributionsDisposable=void 0,!this._modelData)return null;let e=this._modelData.model,t=this._modelData.hasRealView?this._modelData.view.domNode.domNode:null;return this._modelData.dispose(),this._modelData=null,this._domElement.removeAttribute("data-mode-id"),t&&this._domElement.contains(t)&&t.remove(),this._bannerDomNode&&this._domElement.contains(this._bannerDomNode)&&this._bannerDomNode.remove(),e}_registerDecorationType(e,t,o,n){this._codeEditorService.registerDecorationType(e,t,o,n,this)}_removeDecorationType(e){this._codeEditorService.removeDecorationType(e)}_resolveDecorationOptions(e,t){return this._codeEditorService.resolveDecorationOptions(e,t)}getTelemetryData(){return this._telemetryData}hasModel(){return this._modelData!==null}showDropIndicatorAt(e){let t=[{range:new z(e.lineNumber,e.column,e.lineNumber,e.column),options:Xr.dropIntoEditorDecorationOptions}];this._dropIntoEditorDecorations.set(t),this.revealPosition(e,1)}removeDropIndicator(){this._dropIntoEditorDecorations.clear()}setContextValue(e,t){this._contextKeyService.createKey(e,t)}_beginUpdate(){this._updateCounter++,this._updateCounter===1&&this._onBeginUpdate.fire()}_endUpdate(){this._updateCounter--,this._updateCounter===0&&this._onEndUpdate.fire()}};Xr=I([m(3,F),m(4,qt),m(5,ge),m(6,X),m(7,Le),m(8,Ne),m(9,Oi),m(10,Rs),m(11,Qt),m(12,_C)],Xr);var DBo=0,vni=class{constructor(i,e,t,o,n,r){this.model=i;this.viewModel=e;this.view=t;this.hasRealView=o;this.listenersToRemove=n;this.attachedView=r}dispose(){Be(this.listenersToRemove),this.model.onBeforeDetached(this.attachedView),this.hasRealView&&this.view.dispose(),this.viewModel.dispose()}};var byt=class extends x{constructor(e){super();this._emitterOptions=e;this._onDidChangeToTrue=this._register(new E(this._emitterOptions)),this.onDidChangeToTrue=this._onDidChangeToTrue.event,this._onDidChangeToFalse=this._register(new E(this._emitterOptions)),this.onDidChangeToFalse=this._onDidChangeToFalse.event,this._value=0}setValue(e){let t=e?2:1;this._value!==t&&(this._value=t,this._value===2?this._onDidChangeToTrue.fire():this._value===1&&this._onDidChangeToFalse.fire())}},hb=class extends E{constructor(e,t){super({deliveryQueue:t});this._contributions=e}fire(e){this._contributions.onBeforeInteractionEvent(),super.fire(e)}},bni=class extends x{constructor(i,e){super(),this._editor=i,e.createKey("editorId",i.getId()),this._editorSimpleInput=pe.editorSimpleInput.bindTo(e),this._editorFocus=pe.focus.bindTo(e),this._textInputFocus=pe.textInputFocus.bindTo(e),this._editorTextFocus=pe.editorTextFocus.bindTo(e),this._tabMovesFocus=pe.tabMovesFocus.bindTo(e),this._editorReadonly=pe.readOnly.bindTo(e),this._inDiffEditor=pe.inDiffEditor.bindTo(e),this._editorColumnSelection=pe.columnSelection.bindTo(e),this._hasMultipleSelections=pe.hasMultipleSelections.bindTo(e),this._hasNonEmptySelection=pe.hasNonEmptySelection.bindTo(e),this._canUndo=pe.canUndo.bindTo(e),this._canRedo=pe.canRedo.bindTo(e),this._register(this._editor.onDidChangeConfiguration(()=>this._updateFromConfig())),this._register(this._editor.onDidChangeCursorSelection(()=>this._updateFromSelection())),this._register(this._editor.onDidFocusEditorWidget(()=>this._updateFromFocus())),this._register(this._editor.onDidBlurEditorWidget(()=>this._updateFromFocus())),this._register(this._editor.onDidFocusEditorText(()=>this._updateFromFocus())),this._register(this._editor.onDidBlurEditorText(()=>this._updateFromFocus())),this._register(this._editor.onDidChangeModel(()=>this._updateFromModel())),this._register(this._editor.onDidChangeConfiguration(()=>this._updateFromModel())),this._register(x_.onDidChangeTabFocus(t=>this._tabMovesFocus.set(t))),this._updateFromConfig(),this._updateFromSelection(),this._updateFromFocus(),this._updateFromModel(),this._editorSimpleInput.set(this._editor.isSimpleWidget)}_updateFromConfig(){let i=this._editor.getOptions();this._tabMovesFocus.set(i.get(164)||x_.getTabFocusMode()),this._editorReadonly.set(i.get(104)),this._inDiffEditor.set(i.get(70)),this._editorColumnSelection.set(i.get(28))}_updateFromSelection(){let i=this._editor.getSelections();i?(this._hasMultipleSelections.set(i.length>1),this._hasNonEmptySelection.set(i.some(e=>!e.isEmpty()))):(this._hasMultipleSelections.reset(),this._hasNonEmptySelection.reset())}_updateFromFocus(){this._editorFocus.set(this._editor.hasWidgetFocus()&&!this._editor.isSimpleWidget),this._editorTextFocus.set(this._editor.hasTextFocus()&&!this._editor.isSimpleWidget),this._textInputFocus.set(this._editor.hasTextFocus())}_updateFromModel(){let i=this._editor.getModel();this._canUndo.set(!!(i&&i.canUndo())),this._canRedo.set(!!(i&&i.canRedo()))}},Sni=class extends x{constructor(e,t,o){super();this._editor=e;this._contextKeyService=t;this._languageFeaturesService=o;this._langId=pe.languageId.bindTo(t),this._hasCompletionItemProvider=pe.hasCompletionItemProvider.bindTo(t),this._hasCodeActionsProvider=pe.hasCodeActionsProvider.bindTo(t),this._hasCodeLensProvider=pe.hasCodeLensProvider.bindTo(t),this._hasDefinitionProvider=pe.hasDefinitionProvider.bindTo(t),this._hasDeclarationProvider=pe.hasDeclarationProvider.bindTo(t),this._hasImplementationProvider=pe.hasImplementationProvider.bindTo(t),this._hasTypeDefinitionProvider=pe.hasTypeDefinitionProvider.bindTo(t),this._hasHoverProvider=pe.hasHoverProvider.bindTo(t),this._hasDocumentHighlightProvider=pe.hasDocumentHighlightProvider.bindTo(t),this._hasDocumentSymbolProvider=pe.hasDocumentSymbolProvider.bindTo(t),this._hasReferenceProvider=pe.hasReferenceProvider.bindTo(t),this._hasRenameProvider=pe.hasRenameProvider.bindTo(t),this._hasSignatureHelpProvider=pe.hasSignatureHelpProvider.bindTo(t),this._hasInlayHintsProvider=pe.hasInlayHintsProvider.bindTo(t),this._hasDocumentFormattingProvider=pe.hasDocumentFormattingProvider.bindTo(t),this._hasDocumentSelectionFormattingProvider=pe.hasDocumentSelectionFormattingProvider.bindTo(t),this._hasMultipleDocumentFormattingProvider=pe.hasMultipleDocumentFormattingProvider.bindTo(t),this._hasMultipleDocumentSelectionFormattingProvider=pe.hasMultipleDocumentSelectionFormattingProvider.bindTo(t),this._isInEmbeddedEditor=pe.isInEmbeddedEditor.bindTo(t);let n=()=>this._update();this._register(e.onDidChangeModel(n)),this._register(e.onDidChangeModelLanguage(n)),this._register(o.completionProvider.onDidChange(n)),this._register(o.codeActionProvider.onDidChange(n)),this._register(o.codeLensProvider.onDidChange(n)),this._register(o.definitionProvider.onDidChange(n)),this._register(o.declarationProvider.onDidChange(n)),this._register(o.implementationProvider.onDidChange(n)),this._register(o.typeDefinitionProvider.onDidChange(n)),this._register(o.hoverProvider.onDidChange(n)),this._register(o.documentHighlightProvider.onDidChange(n)),this._register(o.documentSymbolProvider.onDidChange(n)),this._register(o.referenceProvider.onDidChange(n)),this._register(o.renameProvider.onDidChange(n)),this._register(o.documentFormattingEditProvider.onDidChange(n)),this._register(o.documentRangeFormattingEditProvider.onDidChange(n)),this._register(o.signatureHelpProvider.onDidChange(n)),this._register(o.inlayHintsProvider.onDidChange(n)),n()}dispose(){super.dispose()}reset(){this._contextKeyService.bufferChangeEvents(()=>{this._langId.reset(),this._hasCompletionItemProvider.reset(),this._hasCodeActionsProvider.reset(),this._hasCodeLensProvider.reset(),this._hasDefinitionProvider.reset(),this._hasDeclarationProvider.reset(),this._hasImplementationProvider.reset(),this._hasTypeDefinitionProvider.reset(),this._hasHoverProvider.reset(),this._hasDocumentHighlightProvider.reset(),this._hasDocumentSymbolProvider.reset(),this._hasReferenceProvider.reset(),this._hasRenameProvider.reset(),this._hasDocumentFormattingProvider.reset(),this._hasDocumentSelectionFormattingProvider.reset(),this._hasSignatureHelpProvider.reset(),this._isInEmbeddedEditor.reset()})}_update(){let e=this._editor.getModel();if(!e){this.reset();return}this._contextKeyService.bufferChangeEvents(()=>{this._langId.set(e.getLanguageId()),this._hasCompletionItemProvider.set(this._languageFeaturesService.completionProvider.has(e)),this._hasCodeActionsProvider.set(this._languageFeaturesService.codeActionProvider.has(e)),this._hasCodeLensProvider.set(this._languageFeaturesService.codeLensProvider.has(e)),this._hasDefinitionProvider.set(this._languageFeaturesService.definitionProvider.has(e)),this._hasDeclarationProvider.set(this._languageFeaturesService.declarationProvider.has(e)),this._hasImplementationProvider.set(this._languageFeaturesService.implementationProvider.has(e)),this._hasTypeDefinitionProvider.set(this._languageFeaturesService.typeDefinitionProvider.has(e)),this._hasHoverProvider.set(this._languageFeaturesService.hoverProvider.has(e)),this._hasDocumentHighlightProvider.set(this._languageFeaturesService.documentHighlightProvider.has(e)),this._hasDocumentSymbolProvider.set(this._languageFeaturesService.documentSymbolProvider.has(e)),this._hasReferenceProvider.set(this._languageFeaturesService.referenceProvider.has(e)),this._hasRenameProvider.set(this._languageFeaturesService.renameProvider.has(e)),this._hasSignatureHelpProvider.set(this._languageFeaturesService.signatureHelpProvider.has(e)),this._hasInlayHintsProvider.set(this._languageFeaturesService.inlayHintsProvider.has(e)),this._hasDocumentFormattingProvider.set(this._languageFeaturesService.documentFormattingEditProvider.has(e)||this._languageFeaturesService.documentRangeFormattingEditProvider.has(e)),this._hasDocumentSelectionFormattingProvider.set(this._languageFeaturesService.documentRangeFormattingEditProvider.has(e)),this._hasMultipleDocumentFormattingProvider.set(this._languageFeaturesService.documentFormattingEditProvider.all(e).length+this._languageFeaturesService.documentRangeFormattingEditProvider.all(e).length>1),this._hasMultipleDocumentSelectionFormattingProvider.set(this._languageFeaturesService.documentRangeFormattingEditProvider.all(e).length>1),this._isInEmbeddedEditor.set(e.uri.scheme===Q.walkThroughSnippet||e.uri.scheme===Q.vscodeChatCodeBlock)})}},Ini=class{constructor(i,e){this._editor=i;this._decorationIds=[];this._isChangingDecorations=!1;Array.isArray(e)&&e.length>0&&this.set(e)}get length(){return this._decorationIds.length}onDidChange(i,e,t){return this._editor.onDidChangeModelDecorations(o=>{this._isChangingDecorations||i.call(e,o)},t)}getRange(i){return!this._editor.hasModel()||i>=this._decorationIds.length?null:this._editor.getModel().getDecorationRange(this._decorationIds[i])}getRanges(){if(!this._editor.hasModel())return[];let i=this._editor.getModel(),e=[];for(let t of this._decorationIds){let o=i.getDecorationRange(t);o&&e.push(o)}return e}has(i){return this._decorationIds.includes(i.id)}clear(){this._decorationIds.length!==0&&this.set([])}set(i){try{this._isChangingDecorations=!0,this._editor.changeDecorations(e=>{this._decorationIds=e.deltaDecorations(this._decorationIds,i)})}finally{this._isChangingDecorations=!1}return this._decorationIds}append(i){let e=[];try{this._isChangingDecorations=!0,this._editor.changeDecorations(t=>{e=t.deltaDecorations([],i),this._decorationIds=this._decorationIds.concat(e)})}finally{this._isChangingDecorations=!1}return e}},LBo=encodeURIComponent("<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 6 3' enable-background='new 0 0 6 3' height='3' width='6'><g fill='"),RBo=encodeURIComponent("'><polygon points='5.5,0 2.5,3 1.1,3 4.1,0'/><polygon points='4,0 6,2 6,0.6 5.4,0'/><polygon points='0,2 1,3 2.4,3 0,0.6'/></g></svg>");function pCe(a){return LBo+encodeURIComponent(a.toString())+RBo}var MBo=encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" height="3" width="12"><g fill="'),PBo=encodeURIComponent('"><circle cx="1" cy="1" r="1"/><circle cx="5" cy="1" r="1"/><circle cx="9" cy="1" r="1"/></g></svg>');function j8i(a){return MBo+encodeURIComponent(a.toString())+PBo}is((a,i)=>{let e=a.getColor(Iv);e&&(i.addRule(`.monaco-editor .squiggly-error { background: url("data:image/svg+xml,${pCe(e)}") repeat-x bottom left; }`),i.addRule(`:root { --monaco-editor-error-decoration: url("data:image/svg+xml,${pCe(e)}"); }`));let t=a.getColor(jh);t&&(i.addRule(`.monaco-editor .squiggly-warning { background: url("data:image/svg+xml,${pCe(t)}") repeat-x bottom left; }`),i.addRule(`:root { --monaco-editor-warning-decoration: url("data:image/svg+xml,${pCe(t)}"); }`));let o=a.getColor(Dm);o&&(i.addRule(`.monaco-editor .squiggly-info { background: url("data:image/svg+xml,${pCe(o)}") repeat-x bottom left; }`),i.addRule(`:root { --monaco-editor-info-decoration: url("data:image/svg+xml,${pCe(o)}"); }`));let n=a.getColor(w5i);n&&(i.addRule(`.monaco-editor .squiggly-hint { background: url("data:image/svg+xml,${j8i(n)}") no-repeat bottom left; }`),i.addRule(`:root { --monaco-editor-hint-decoration: url("data:image/svg+xml,${j8i(n)}"); }`));let r=a.getColor(L3i);r&&(i.addRule(`.monaco-editor.showUnused .squiggly-inline-unnecessary { opacity: ${r.rgba.a}; }`),i.addRule(`:root { --monaco-editor-unnecessary-decoration-opacity: ${r.rgba.a}; }`))});var ABo=!1;function DE(){return ABo}function yni(a){if(DE()){let i=NBo();return i.add(a),{dispose(){i.delete(a)}}}else return{dispose(){}}}function NBo(){Syt||(Syt=new Set);let a=globalThis;return a.$hotReload_applyNewExports||(a.$hotReload_applyNewExports=i=>{let e={config:{mode:void 0},...i},t=[];for(let o of Syt){let n=o(e);n&&t.push(n)}if(t.length>0)return o=>{let n=!1;for(let r of t)r(o)&&(n=!0);return n}}),Syt}var Syt;DE()&&yni(({oldExports:a,newSrc:i,config:e})=>{if(e.mode==="patch-prototype")return t=>{for(let o in t){let n=t[o];if(console.log(`[hot-reload] Patching prototype methods of '${o}'`,{exportedItem:n}),typeof n=="function"&&n.prototype){let r=a[o];if(r){for(let s of Object.getOwnPropertyNames(n.prototype)){let l=Object.getOwnPropertyDescriptor(n.prototype,s),c=Object.getOwnPropertyDescriptor(r.prototype,s);l?.value?.toString()!==c?.value?.toString()&&console.log(`[hot-reload] Patching prototype method '${o}.${s}'`),Object.defineProperty(r.prototype,s,l)}t[o]=r}}}return!0}});function Xx(a,i){return OBo([a],i),a}function OBo(a,i){DE()&&Fr("reload",t=>yni(({oldExports:o})=>{if([...Object.values(o)].some(n=>a.includes(n)))return n=>(t(void 0),!0)})).read(i)}var Q8i=new Map;function vz(a){if(!DE())return So(a);let i=a.name,e=Q8i.get(i);return e?setTimeout(()=>{e.set(a,void 0)},0):(e=Me(i,a),Q8i.set(i,e)),e}function hr(a,i,e,t=Rl.ofCaller()){return Vf({debugName:()=>`Configuration Key "${a}"`},o=>e.onDidChangeConfiguration(n=>{n.affectsConfiguration(a)&&o(n)}),()=>e.getValue(a)??i,t)}function Vd(a,i,e,t=Rl.ofCaller()){let o=a.bindTo(i),n=new N;return Os({debugName:()=>`Set Context Key "${a.key}"`},r=>{let s=e(r);return o.set(s),s},t).recomputeInitiallyAndOnChange(n),n}function Y8i(a,i,e=Rl.ofCaller()){return ui(void 0,i.onDidChangeContext,()=>i.getContextKeyValue(a),e)}var lr=le("accessibilitySignalService"),J8i=Symbol("AcknowledgeDocCommentsToken"),mCe=class extends x{constructor(e,t,o){super();this.configurationService=e;this.accessibilityService=t;this.telemetryService=o;this.sounds=new Map,this.screenReaderAttached=ui(this,this.accessibilityService.onDidChangeScreenReaderOptimized,()=>this.accessibilityService.isScreenReaderOptimized()),this.sentTelemetry=new Set,this.playingSounds=new Set,this._signalConfigValue=new NI(n=>hr(n.settingsKey,{sound:"off",announcement:"off"},this.configurationService)),this._signalEnabledState=new NI({getCacheKey:fqi},n=>ke(r=>{let s=this._signalConfigValue.get(n.signal).read(r);return!!((n.modality==="sound"||n.modality===void 0)&&(n.signal.managesOwnEnablement||X8i(s.sound,()=>this.screenReaderAttached.read(r),n.userGesture))||(n.modality==="announcement"||n.modality===void 0)&&X8i(s.announcement,()=>this.screenReaderAttached.read(r),n.userGesture))}).recomputeInitiallyAndOnChange(this._store))}getEnabledState(e,t,o){return new sO(this._signalEnabledState.get({signal:e,userGesture:t,modality:o}))}async playSignal(e,t={}){let o=t.modality==="announcement"||t.modality===void 0,n=t.customAlertMessage??e.announcementMessage;o&&this.isAnnouncementEnabled(e,t.userGesture)&&n&&this.accessibilityService.status(n),(t.modality==="sound"||t.modality===void 0)&&this.isSoundEnabled(e,t.userGesture)&&(this.sendSignalTelemetry(e,t.source),await this.playSound(e.sound.getSound(),t.allowManyInParallel))}async playSignals(e){for(let r of e)this.sendSignalTelemetry("signal"in r?r.signal:r,"source"in r?r.source:void 0);let t=e.map(r=>"signal"in r?r.signal:r),o=t.filter(r=>this.isAnnouncementEnabled(r)).map(r=>r.announcementMessage);o.length&&this.accessibilityService.status(o.join(", "));let n=new Set(t.filter(r=>this.isSoundEnabled(r)).map(r=>r.sound.getSound()));await Promise.all(Array.from(n).map(r=>this.playSound(r,!0)))}sendSignalTelemetry(e,t){let o=this.accessibilityService.isScreenReaderOptimized(),n=e.name+(t?`::${t}`:"")+(o?"{screenReaderOptimized}":"");this.sentTelemetry.has(n)||this.getVolumeInPercent()===0||(this.sentTelemetry.add(n),this.telemetryService.publicLog2("signal.played",{signal:e.name,source:t??"",isScreenReaderOptimized:o}))}getVolumeInPercent(){let e=this.configurationService.getValue("accessibility.signalOptions.volume");return typeof e!="number"?50:Math.max(Math.min(e,100),0)}async playSound(e,t=!1){if(!t&&this.playingSounds.has(e))return;this.playingSounds.add(e);let o=vn.asBrowserUri(`vs/platform/accessibilitySignal/browser/media/${e.fileName}`).toString(!0);try{let n=this.sounds.get(o);if(n)n.volume=this.getVolumeInPercent()/100,n.currentTime=0,await n.play();else{let r=await FBo(o,this.getVolumeInPercent()/100);this.sounds.set(o,r)}}catch(n){n.message.includes("play() can only be initiated by a user gesture")||console.error("Error while playing sound",n)}finally{this.playingSounds.delete(e)}}playSignalLoop(e,t){let o=!0,n=()=>{o&&this.playSignal(e,{allowManyInParallel:!0}).finally(()=>{setTimeout(()=>{o&&n()},t)})};return n(),Z(()=>o=!1)}isAnnouncementEnabled(e,t){return e.announcementMessage?this._signalEnabledState.get({signal:e,userGesture:!!t,modality:"announcement"}).get():!1}isSoundEnabled(e,t){return this._signalEnabledState.get({signal:e,userGesture:!!t,modality:"sound"}).get()}onSoundEnabledChanged(e){return this.getEnabledState(e,!1).onDidChange}getDelayMs(e,t,o){if(!this.configurationService.getValue("accessibility.signalOptions.debouncePositionChanges"))return 0;let n;return e.name===$o.errorAtPosition.name&&o==="positional"?n=this.configurationService.getValue("accessibility.signalOptions.experimental.delays.errorAtPosition"):e.name===$o.warningAtPosition.name&&o==="positional"?n=this.configurationService.getValue("accessibility.signalOptions.experimental.delays.warningAtPosition"):n=this.configurationService.getValue("accessibility.signalOptions.experimental.delays.general"),t==="sound"?n.sound:n.announcement}};mCe=I([m(0,B),m(1,Oi),m(2,Te)],mCe);function X8i(a,i,e){return a==="on"||a==="always"||a==="auto"&&i()||a==="userGesture"&&e}async function FBo(a,i){let e=new N;try{return await WBo(a,i,e)}finally{e.dispose()}}function WBo(a,i,e){return new Promise((t,o)=>{let n=new Audio(a);n.volume=i,e.add(j(n,"ended",()=>{t(n)})),e.add(j(n,"error",r=>{o(r.error)})),n.play().catch(r=>{o(r)})})}var yd=class a{constructor(i){this.fileName=i}static register(i){return new a(i.fileName)}static{this.error=a.register({fileName:"error.mp3"})}static{this.warning=a.register({fileName:"warning.mp3"})}static{this.success=a.register({fileName:"success.mp3"})}static{this.foldedArea=a.register({fileName:"foldedAreas.mp3"})}static{this.break=a.register({fileName:"break.mp3"})}static{this.quickFixes=a.register({fileName:"quickFixes.mp3"})}static{this.taskCompleted=a.register({fileName:"taskCompleted.mp3"})}static{this.taskFailed=a.register({fileName:"taskFailed.mp3"})}static{this.terminalBell=a.register({fileName:"terminalBell.mp3"})}static{this.diffLineInserted=a.register({fileName:"diffLineInserted.mp3"})}static{this.diffLineDeleted=a.register({fileName:"diffLineDeleted.mp3"})}static{this.diffLineModified=a.register({fileName:"diffLineModified.mp3"})}static{this.requestSent=a.register({fileName:"requestSent.mp3"})}static{this.responseReceived1=a.register({fileName:"responseReceived1.mp3"})}static{this.responseReceived2=a.register({fileName:"responseReceived2.mp3"})}static{this.responseReceived3=a.register({fileName:"responseReceived3.mp3"})}static{this.responseReceived4=a.register({fileName:"responseReceived4.mp3"})}static{this.clear=a.register({fileName:"clear.mp3"})}static{this.save=a.register({fileName:"save.mp3"})}static{this.format=a.register({fileName:"format.mp3"})}static{this.voiceRecordingStarted=a.register({fileName:"voiceRecordingStarted.mp3"})}static{this.voiceRecordingStopped=a.register({fileName:"voiceRecordingStopped.mp3"})}static{this.progress=a.register({fileName:"progress.mp3"})}static{this.chatEditModifiedFile=a.register({fileName:"chatEditModifiedFile.mp3"})}static{this.editsKept=a.register({fileName:"editsKept.mp3"})}static{this.editsUndone=a.register({fileName:"editsUndone.mp3"})}static{this.nextEditSuggestion=a.register({fileName:"nextEditSuggestion.mp3"})}static{this.terminalCommandSucceeded=a.register({fileName:"terminalCommandSucceeded.mp3"})}static{this.chatUserActionRequired=a.register({fileName:"chatUserActionRequired.mp3"})}static{this.codeActionTriggered=a.register({fileName:"codeActionTriggered.mp3"})}static{this.codeActionApplied=a.register({fileName:"codeActionApplied.mp3"})}},wni=class{constructor(i){this.randomOneOf=i}getSound(i=!1){if(i||this.randomOneOf.length===1)return this.randomOneOf[0];{let e=Math.floor(Math.random()*this.randomOneOf.length);return this.randomOneOf[e]}}},$o=class a{constructor(i,e,t,o,n,r,s=!1){this.sound=i;this.name=e;this.legacySoundSettingsKey=t;this.settingsKey=o;this.legacyAnnouncementSettingsKey=n;this.announcementMessage=r;this.managesOwnEnablement=s}static{this._signals=new Set}static register(i){let e=new wni("randomOneOf"in i.sound?i.sound.randomOneOf:[i.sound]),t=new a(e,i.name,i.legacySoundSettingsKey,i.settingsKey,i.legacyAnnouncementSettingsKey,i.announcementMessage,i.managesOwnEnablement);return a._signals.add(t),t}static get allAccessibilitySignals(){return[...this._signals]}static{this.errorAtPosition=a.register({name:d(1790,null),sound:yd.error,announcementMessage:d(1757,null),settingsKey:"accessibility.signals.positionHasError",delaySettingsKey:"accessibility.signalOptions.delays.errorAtPosition"})}static{this.warningAtPosition=a.register({name:d(1791,null),sound:yd.warning,announcementMessage:d(1758,null),settingsKey:"accessibility.signals.positionHasWarning",delaySettingsKey:"accessibility.signalOptions.delays.warningAtPosition"})}static{this.errorOnLine=a.register({name:d(1781,null),sound:yd.error,legacySoundSettingsKey:"audioCues.lineHasError",legacyAnnouncementSettingsKey:"accessibility.alert.error",announcementMessage:d(1749,null),settingsKey:"accessibility.signals.lineHasError"})}static{this.warningOnLine=a.register({name:d(1784,null),sound:yd.warning,legacySoundSettingsKey:"audioCues.lineHasWarning",legacyAnnouncementSettingsKey:"accessibility.alert.warning",announcementMessage:d(1751,null),settingsKey:"accessibility.signals.lineHasWarning"})}static{this.foldedArea=a.register({name:d(1782,null),sound:yd.foldedArea,legacySoundSettingsKey:"audioCues.lineHasFoldedArea",legacyAnnouncementSettingsKey:"accessibility.alert.foldedArea",announcementMessage:d(1750,null),settingsKey:"accessibility.signals.lineHasFoldedArea"})}static{this.break=a.register({name:d(1780,null),sound:yd.break,legacySoundSettingsKey:"audioCues.lineHasBreakpoint",legacyAnnouncementSettingsKey:"accessibility.alert.breakpoint",announcementMessage:d(1748,null),settingsKey:"accessibility.signals.lineHasBreakpoint"})}static{this.inlineSuggestion=a.register({name:d(1783,null),sound:yd.quickFixes,legacySoundSettingsKey:"audioCues.lineHasInlineSuggestion",settingsKey:"accessibility.signals.lineHasInlineSuggestion"})}static{this.nextEditSuggestion=a.register({name:d(1785,null),sound:yd.nextEditSuggestion,legacySoundSettingsKey:"audioCues.nextEditSuggestion",settingsKey:"accessibility.signals.nextEditSuggestion",announcementMessage:d(1752,null)})}static{this.terminalQuickFix=a.register({name:d(1799,null),sound:yd.quickFixes,legacySoundSettingsKey:"audioCues.terminalQuickFix",legacyAnnouncementSettingsKey:"accessibility.alert.terminalQuickFix",announcementMessage:d(1766,null),settingsKey:"accessibility.signals.terminalQuickFix"})}static{this.onDebugBreak=a.register({name:d(1789,null),sound:yd.break,legacySoundSettingsKey:"audioCues.onDebugBreak",legacyAnnouncementSettingsKey:"accessibility.alert.onDebugBreak",announcementMessage:d(1756,null),settingsKey:"accessibility.signals.onDebugBreak"})}static{this.noInlayHints=a.register({name:d(1786,null),sound:yd.error,legacySoundSettingsKey:"audioCues.noInlayHints",legacyAnnouncementSettingsKey:"accessibility.alert.noInlayHints",announcementMessage:d(1753,null),settingsKey:"accessibility.signals.noInlayHints"})}static{this.taskCompleted=a.register({name:d(1794,null),sound:yd.taskCompleted,legacySoundSettingsKey:"audioCues.taskCompleted",legacyAnnouncementSettingsKey:"accessibility.alert.taskCompleted",announcementMessage:d(1761,null),settingsKey:"accessibility.signals.taskCompleted"})}static{this.taskFailed=a.register({name:d(1795,null),sound:yd.taskFailed,legacySoundSettingsKey:"audioCues.taskFailed",legacyAnnouncementSettingsKey:"accessibility.alert.taskFailed",announcementMessage:d(1762,null),settingsKey:"accessibility.signals.taskFailed"})}static{this.terminalCommandFailed=a.register({name:d(1797,null),sound:yd.error,legacySoundSettingsKey:"audioCues.terminalCommandFailed",legacyAnnouncementSettingsKey:"accessibility.alert.terminalCommandFailed",announcementMessage:d(1764,null),settingsKey:"accessibility.signals.terminalCommandFailed"})}static{this.terminalCommandSucceeded=a.register({name:d(1798,null),sound:yd.terminalCommandSucceeded,announcementMessage:d(1765,null),settingsKey:"accessibility.signals.terminalCommandSucceeded"})}static{this.terminalBell=a.register({name:d(1796,null),sound:yd.terminalBell,legacySoundSettingsKey:"audioCues.terminalBell",legacyAnnouncementSettingsKey:"accessibility.alert.terminalBell",announcementMessage:d(1763,null),settingsKey:"accessibility.signals.terminalBell"})}static{this.notebookCellCompleted=a.register({name:d(1787,null),sound:yd.taskCompleted,legacySoundSettingsKey:"audioCues.notebookCellCompleted",legacyAnnouncementSettingsKey:"accessibility.alert.notebookCellCompleted",announcementMessage:d(1754,null),settingsKey:"accessibility.signals.notebookCellCompleted"})}static{this.notebookCellFailed=a.register({name:d(1788,null),sound:yd.taskFailed,legacySoundSettingsKey:"audioCues.notebookCellFailed",legacyAnnouncementSettingsKey:"accessibility.alert.notebookCellFailed",announcementMessage:d(1755,null),settingsKey:"accessibility.signals.notebookCellFailed"})}static{this.diffLineInserted=a.register({name:d(1775,null),sound:yd.diffLineInserted,legacySoundSettingsKey:"audioCues.diffLineInserted",settingsKey:"accessibility.signals.diffLineInserted"})}static{this.diffLineDeleted=a.register({name:d(1774,null),sound:yd.diffLineDeleted,legacySoundSettingsKey:"audioCues.diffLineDeleted",settingsKey:"accessibility.signals.diffLineDeleted"})}static{this.diffLineModified=a.register({name:d(1776,null),sound:yd.diffLineModified,legacySoundSettingsKey:"audioCues.diffLineModified",settingsKey:"accessibility.signals.diffLineModified"})}static{this.chatEditModifiedFile=a.register({name:d(1767,null),sound:yd.chatEditModifiedFile,announcementMessage:d(1740,null),settingsKey:"accessibility.signals.chatEditModifiedFile"})}static{this.chatRequestSent=a.register({name:d(1768,null),sound:yd.requestSent,legacySoundSettingsKey:"audioCues.chatRequestSent",legacyAnnouncementSettingsKey:"accessibility.alert.chatRequestSent",announcementMessage:d(1741,null),settingsKey:"accessibility.signals.chatRequestSent"})}static{this.chatResponseReceived=a.register({name:d(1769,null),legacySoundSettingsKey:"audioCues.chatResponseReceived",sound:{randomOneOf:[yd.responseReceived1,yd.responseReceived2,yd.responseReceived3,yd.responseReceived4]},settingsKey:"accessibility.signals.chatResponseReceived"})}static{this.codeActionTriggered=a.register({name:d(1773,null),sound:yd.codeActionTriggered,legacySoundSettingsKey:"audioCues.codeActionRequestTriggered",legacyAnnouncementSettingsKey:"accessibility.alert.codeActionRequestTriggered",announcementMessage:d(1744,null),settingsKey:"accessibility.signals.codeActionTriggered"})}static{this.codeActionApplied=a.register({name:d(1772,null),legacySoundSettingsKey:"audioCues.codeActionApplied",sound:yd.codeActionApplied,settingsKey:"accessibility.signals.codeActionApplied"})}static{this.progress=a.register({name:d(1792,null),sound:yd.progress,legacySoundSettingsKey:"audioCues.chatResponsePending",legacyAnnouncementSettingsKey:"accessibility.alert.progress",announcementMessage:d(1759,null),settingsKey:"accessibility.signals.progress"})}static{this.clear=a.register({name:d(1771,null),sound:yd.clear,legacySoundSettingsKey:"audioCues.clear",legacyAnnouncementSettingsKey:"accessibility.alert.clear",announcementMessage:d(1743,null),settingsKey:"accessibility.signals.clear"})}static{this.save=a.register({name:d(1793,null),sound:yd.save,legacySoundSettingsKey:"audioCues.save",legacyAnnouncementSettingsKey:"accessibility.alert.save",announcementMessage:d(1760,null),settingsKey:"accessibility.signals.save"})}static{this.format=a.register({name:d(1779,null),sound:yd.format,legacySoundSettingsKey:"audioCues.format",legacyAnnouncementSettingsKey:"accessibility.alert.format",announcementMessage:d(1747,null),settingsKey:"accessibility.signals.format"})}static{this.voiceRecordingStarted=a.register({name:d(1800,null),sound:yd.voiceRecordingStarted,legacySoundSettingsKey:"audioCues.voiceRecordingStarted",settingsKey:"accessibility.signals.voiceRecordingStarted"})}static{this.voiceRecordingStopped=a.register({name:d(1801,null),sound:yd.voiceRecordingStopped,legacySoundSettingsKey:"audioCues.voiceRecordingStopped",settingsKey:"accessibility.signals.voiceRecordingStopped"})}static{this.editsKept=a.register({name:d(1777,null),sound:yd.editsKept,announcementMessage:d(1745,null),settingsKey:"accessibility.signals.editsKept"})}static{this.editsUndone=a.register({name:d(1778,null),sound:yd.editsUndone,announcementMessage:d(1746,null),settingsKey:"accessibility.signals.editsUndone"})}static{this.chatUserActionRequired=a.register({name:d(1770,null),sound:yd.chatUserActionRequired,announcementMessage:d(1742,null),settingsKey:"accessibility.signals.chatUserActionRequired"})}};var Fo=le("progressService");var Iyt=Object.freeze({total(){},worked(){},done(){}}),Mm=class{constructor(i){this.callback=i}static{this.None=Object.freeze({report(){}})}get value(){return this._value}report(i){this._value=i,this.callback(this._value)}},hCe=class extends x{constructor(e,t){super();this.deferred=new Ko;t.withProgress(e,o=>(this.reporter=o,this.lastStep&&o.report(this.lastStep),this.deferred.p)),this._register(Z(()=>this.deferred.complete()))}report(e){this.reporter?this.reporter.report(e):this.lastStep=e}};hCe=I([m(1,Fo)],hCe);var gCe=class extends x{constructor(e){super();this.progressIndicator=e;this.currentOperationId=0;this.currentOperationDisposables=this._register(new N);this.currentProgressTimeout=void 0}start(e){this.stop();let t=++this.currentOperationId,o=new Ye;return this.currentProgressTimeout=setTimeout(()=>{t===this.currentOperationId&&(this.currentProgressRunner=this.progressIndicator.show(!0))},e),this.currentOperationDisposables.add(Z(()=>clearTimeout(this.currentProgressTimeout))),this.currentOperationDisposables.add(Z(()=>o.cancel())),this.currentOperationDisposables.add(Z(()=>this.currentProgressRunner?this.currentProgressRunner.done():void 0)),{id:t,token:o.token,stop:()=>this.doStop(t),isCurrent:()=>this.currentOperationId===t}}stop(){this.doStop(this.currentOperationId)}doStop(e){this.currentOperationId===e&&this.currentOperationDisposables.clear()}},wd=le("editorProgressService");var DC=class a{constructor(i,e,t,o,n){this._initialScrollTop=i;this._initialContentHeight=e;this._visiblePosition=t;this._visiblePositionScrollDelta=o;this._cursorPosition=n}static capture(i){if(i.getScrollTop()===0||i.hasPendingScrollAnimation())return new a(i.getScrollTop(),i.getContentHeight(),null,0,null);let e=null,t=0,o=i.getVisibleRanges();if(o.length>0){e=o[0].getStartPosition();let n=i.getTopForPosition(e.lineNumber,e.column);t=i.getScrollTop()-n}return new a(i.getScrollTop(),i.getContentHeight(),e,t,i.getPosition())}restore(i){if(!(this._initialContentHeight===i.getContentHeight()&&this._initialScrollTop===i.getScrollTop())&&this._visiblePosition){let e=i.getTopForPosition(this._visiblePosition.lineNumber,this._visiblePosition.column);i.setScrollTop(e+this._visiblePositionScrollDelta)}}restoreRelativeVerticalPositionOfCursor(i){if(this._initialContentHeight===i.getContentHeight()&&this._initialScrollTop===i.getScrollTop())return;let e=i.getPosition();if(!this._cursorPosition||!e)return;let t=i.getTopForLineNumber(e.lineNumber)-i.getTopForLineNumber(this._cursorPosition.lineNumber);i.setScrollTop(i.getScrollTop()+t,1)}},j5e=class a{constructor(i,e,t,o){this._initialScrollTop=i;this._initialContentHeight=e;this._visiblePosition=t;this._visiblePositionScrollDelta=o}static capture(i){if(i.hasPendingScrollAnimation())return new a(i.getScrollTop(),i.getContentHeight(),null,0);let e=null,t=0,o=i.getVisibleRanges();return o.length>0&&(e=o.at(-1).getEndPosition(),t=i.getBottomForLineNumber(e.lineNumber)-i.getScrollTop()),new a(i.getScrollTop(),i.getContentHeight(),e,t)}restore(i){if(!(this._initialContentHeight===i.getContentHeight()&&this._initialScrollTop===i.getScrollTop())&&this._visiblePosition){let e=i.getBottomForLineNumber(this._visiblePosition.lineNumber);i.setScrollTop(e-this._visiblePositionScrollDelta,1)}}};var VBo=()=>({get delay(){return-1},dispose:()=>{},showHover:()=>{}}),yyt=VBo,BBo=new co(()=>yyt("mouse",!1)),HBo=new co(()=>yyt("element",!1));function Z8i(a){yyt=a}function Ri(a){return a==="element"?HBo.value:BBo.value}function Qh(){return yyt("element",!0)}function O_(a,i){if(a!==void 0){let e=a.match(/^\s*var\((.+)\)$/);if(e){let t=e[1].split(",",2);return t.length===2&&(i=O_(t[1].trim(),i)),`var(${t[0]}, ${i})`}return a}return i}function Cni(a){let i=a.replaceAll(/[^\w.%+-]/gi,"");return i!==a&&console.warn(`CSS size ${a} modified to ${i} to be safe for CSS`),i}function eQi(a){let i=a.replaceAll(/[^[0-9a-fA-F#]]/gi,"");return i!==a&&console.warn(`CSS hex color ${a} modified to ${i} to be safe for CSS`),i}function fCe(a){let i=a.replaceAll(/[^_\-a-z0-9]/gi,"");return i!==a&&console.warn(`CSS ident value ${a} modified to ${i} to be safe for CSS`),i}function tI(a){return`'${a.replaceAll(/'/g,"\\000027")}'`}function Qa(a){return a?ia`url('${CSS.escape(vn.uriToBrowserUri(a).toString(!0))}')`:"url('')"}function bz(a,i=!1){let e=CSS.escape(a);return!i&&e!==a&&console.warn(`CSS class name ${a} modified to ${e} to be safe for CSS`),e}function ia(a,...i){return a.reduce((e,t,o)=>{let n=i[o]||"";return e+t+n},"")}var N_=class{constructor(){this._parts=[]}push(...i){this._parts.push(...i)}join(i=`
`){return this._parts.join(i)}};var wyt=class{constructor(i){this.spliceables=i}splice(i,e,t){this.spliceables.forEach(o=>o.splice(i,e,t))}};function tQi(a){let i=UBo(a);if(i&&i.length>0)return new Uint32Array(i)}var nR=0,nY=new Uint32Array(10);function UBo(a){if(nR=0,Sz(a,xni,4352),nR>0||(Sz(a,kni,4449),nR>0)||(Sz(a,Eni,4520),nR>0)||(Sz(a,Vle,12593),nR))return nY.subarray(0,nR);if(a>=44032&&a<=55203){let i=a-44032,e=i%588,t=Math.floor(i/588),o=Math.floor(e/28),n=e%28-1;if(t<xni.length?Sz(t,xni,0):4352+t-12593<Vle.length&&Sz(4352+t,Vle,12593),o<kni.length?Sz(o,kni,0):4449+o-12593<Vle.length&&Sz(4449+o-12593,Vle,12593),n>=0&&(n<Eni.length?Sz(n,Eni,0):4520+n-12593<Vle.length&&Sz(4520+n-12593,Vle,12593)),nR>0)return nY.subarray(0,nR)}}function Sz(a,i,e){a>=e&&a<e+i.length&&zBo(i[a-e])}function zBo(a){a!==0&&(nY[nR++]=a&255,a>>8&&(nY[nR++]=a>>8&255),a>>16&&(nY[nR++]=a>>16&255))}var xni=new Uint8Array([114,82,115,101,69,102,97,113,81,116,84,100,119,87,99,122,120,118,103]),kni=new Uint16Array([107,111,105,79,106,112,117,80,104,27496,28520,27752,121,110,27246,28782,27758,98,109,27757,108]),Eni=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]),Vle=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]);var xvr=new dl(1e4);var KBo=new dl(1e4);function GBo(a){return $Bo(a,"NFD",KBo)}var qBo=/[^\u0000-\u0080]/;function $Bo(a,i,e){if(!a)return a;let t=e.get(a);if(t)return t;let o;return qBo.test(a)?o=a.normalize(i):o=a,e.set(a,o),o}var Q5e=(function(){let a=new dl(1e4),i=/[\u0300-\u036f]/g;return function(e){let t=a.get(e);if(t)return t;let o=GBo(e).replace(i,""),n=(o.length===e.length?o:e).toLowerCase();return a.set(e,n),n}})();function VO(...a){return function(i,e){for(let t=0,o=a.length;t<o;t++){let n=a[t](i,e);if(n)return n}return null}}var Lvr=sQi.bind(void 0,!1),Ble=sQi.bind(void 0,!0);function sQi(a,i,e){if(!e||e.length<i.length)return null;let t;return a?t=mE(e,i):t=e.indexOf(i)===0,t?i.length>0?[{start:0,end:i.length}]:[]:null}function BO(a,i){if(a.length>i.length)return null;let e=i.toLowerCase().indexOf(a.toLowerCase());return e===-1?null:[{start:e,end:e+a.length}]}function aY(a,i){if(a.length>i.length)return null;a=Q5e(a),i=Q5e(i);let e=i.indexOf(a);return e===-1?null:[{start:e,end:e+a.length}]}function X5e(a,i){return a.length>i.length?null:Dni(a.toLowerCase(),i.toLowerCase(),0,0)}function Dni(a,i,e,t){if(e===a.length)return[];if(t===i.length)return null;if(a[e]===i[t]){let o=null;return(o=Dni(a,i,e+1,t+1))?Nni({start:t,end:t+1},o):null}return Dni(a,i,e,t+1)}function Pni(a){return 97<=a&&a<=122}function vCe(a){return 65<=a&&a<=90}function Ani(a){return 48<=a&&a<=57}function aQi(a){return a===32||a===9||a===10||a===13}var lQi=new Set;"()[]{}<>`'\"-/;:,.?!".split("").forEach(a=>lQi.add(a.charCodeAt(0)));function kyt(a){return aQi(a)||lQi.has(a)}function iQi(a,i){return a===i||kyt(a)&&kyt(i)}var Tni=new Map;function oQi(a){if(Tni.has(a))return Tni.get(a);let i,e=tQi(a);return e&&(i=e),Tni.set(a,i),i}function cQi(a){return Pni(a)||vCe(a)||Ani(a)}function Nni(a,i){return i.length===0?i=[a]:a.end===i[0].start?i[0].start=a.start:i.unshift(a),i}function dQi(a,i){for(let e=i;e<a.length;e++){let t=a.charCodeAt(e);if(vCe(t)||Ani(t)||e>0&&!cQi(a.charCodeAt(e-1)))return e}return a.length}function Lni(a,i,e,t){if(e===a.length)return[];if(t===i.length)return null;if(a[e]!==i[t].toLowerCase())return null;{let o=null,n=t+1;for(o=Lni(a,i,e+1,t+1);!o&&(n=dQi(i,n))<i.length;)o=Lni(a,i,e+1,n),n++;return o===null?null:Nni({start:t,end:t+1},o)}}function jBo(a){let i=0,e=0,t=0,o=0,n=0;for(let u=0;u<a.length;u++)n=a.charCodeAt(u),vCe(n)&&i++,Pni(n)&&e++,cQi(n)&&t++,Ani(n)&&o++;let r=i/a.length,s=e/a.length,l=t/a.length,c=o/a.length;return{upperPercent:r,lowerPercent:s,alphaPercent:l,numericPercent:c}}function QBo(a){let{upperPercent:i,lowerPercent:e}=a;return e===0&&i>.6}function YBo(a){let{upperPercent:i,lowerPercent:e,alphaPercent:t,numericPercent:o}=a;return e>.2&&i<.8&&t>.6&&o<.2}function XBo(a){let i=0,e=0,t=0,o=0;for(let n=0;n<a.length;n++)t=a.charCodeAt(n),vCe(t)&&i++,Pni(t)&&e++,aQi(t)&&o++;return(i===0||e===0)&&o===0?a.length<=30:i<=5}function lY(a,i){if(!i||(i=i.trim(),i.length===0)||!XBo(a))return null;i.length>60&&(i=i.substring(0,60));let e=jBo(i);if(!YBo(e)){if(!QBo(e))return null;i=i.toLowerCase()}let t=null,o=0;for(a=a.toLowerCase();o<i.length&&(t=Lni(a,i,0,o))===null;)o=dQi(i,o+1);return t}function dw(a,i,e=!1){if(!i||i.length===0)return null;let t=null,o=0;for(a=Q5e(a),i=Q5e(i);o<i.length&&(t=Rni(a,i,0,o,e),t===null);)o=uQi(i,o+1);return t}function Rni(a,i,e,t,o){let n=0;if(e===a.length)return[];if(t===i.length)return null;if(!iQi(a.charCodeAt(e),i.charCodeAt(t))){let l=oQi(a.charCodeAt(e));if(!l)return null;for(let c=0;c<l.length;c++)if(!iQi(l[c],i.charCodeAt(t+c)))return null;n+=l.length-1}let r=null,s=t+n+1;if(r=Rni(a,i,e+1,s,o),!o)for(;!r&&(s=uQi(i,s))<i.length;)r=Rni(a,i,e+1,s,o),s++;if(!r)return null;if(a.charCodeAt(e)!==i.charCodeAt(t)){let l=oQi(a.charCodeAt(e));if(!l)return r;for(let c=0;c<l.length;c++)if(l[c]!==i.charCodeAt(t+c))return r}return Nni({start:t,end:t+n+1},r)}function uQi(a,i){for(let e=i;e<a.length;e++)if(kyt(a.charCodeAt(e))||e>0&&kyt(a.charCodeAt(e-1)))return e;return a.length}var JBo=VO(Ble,lY,BO),ZBo=VO(Ble,lY,X5e),nQi=new dl(1e4);function lm(a,i,e=!1){if(typeof a!="string"||typeof i!="string")return null;let t=nQi.get(a);t||(t=new RegExp(CGi(a),"i"),nQi.set(a,t));let o=t.exec(i);return o?[{start:o.index,end:o.index+o[0].length}]:e?ZBo(a,i):JBo(a,i)}function bCe(a,i){let e=rR(a,a.toLowerCase(),0,i,i.toLowerCase(),0,{firstMatchCanBeWeak:!0,boostFullMatch:!0});return e?xa(e):null}function pQi(a,i,e,t,o,n){let r=Math.min(13,a.length);for(;e<r;e++){let s=rR(a,i,e,t,o,n,{firstMatchCanBeWeak:!0,boostFullMatch:!0});if(s)return s}return[0,n]}function xa(a){if(typeof a>"u")return[];let i=[],e=a[1];for(let t=a.length-1;t>1;t--){let o=a[t]+e,n=i[i.length-1];n&&n.end===o?n.end=o+1:i.push({start:o,end:o+1})}return i}var sY=128;function Oni(){let a=[],i=[];for(let e=0;e<=sY;e++)i[e]=0;for(let e=0;e<=sY;e++)a.push(i.slice(0));return a}function mQi(a){let i=[];for(let e=0;e<=a;e++)i[e]=0;return i}var hQi=mQi(2*sY),Mni=mQi(2*sY),Iz=Oni(),rY=Oni(),Y5e=Oni(),eHo=!1;function _ni(a,i,e,t,o){function n(s,l,c=" "){for(;s.length<l;)s=c+s;return s}let r=` |   |${t.split("").map(s=>n(s,3)).join("|")}
`;for(let s=0;s<=e;s++)s===0?r+=" |":r+=`${i[s-1]}|`,r+=a[s].slice(0,o+1).map(l=>n(l.toString(),3)).join("|")+`
`;return r}function tHo(a,i,e,t){a=a.substr(i),e=e.substr(t),console.log(_ni(rY,a,a.length,e,e.length)),console.log(_ni(Y5e,a,a.length,e,e.length)),console.log(_ni(Iz,a,a.length,e,e.length))}function Cyt(a,i){if(i<0||i>=a.length)return!1;let e=a.codePointAt(i);switch(e){case 95:case 45:case 46:case 32:case 47:case 92:case 39:case 34:case 58:case 36:case 60:case 62:case 40:case 41:case 91:case 93:case 123:case 125:return!0;case void 0:return!1;default:return!!b$e(e)}}function rQi(a,i){if(i<0||i>=a.length)return!1;switch(a.charCodeAt(i)){case 32:case 9:return!0;default:return!1}}function xyt(a,i,e){return i[a]!==e[a]}function SCe(a,i,e,t,o,n,r=!1){for(;i<e&&o<n;)a[i]===t[o]&&(r&&(hQi[i]=o),i+=1),o+=1;return i===e}var kv;(e=>{e.Default=[-100,0];function i(t){return!t||t.length===2&&t[0]===-100&&t[1]===0}e.isDefault=i})(kv||={});var Bj=class{constructor(i,e){this.firstMatchCanBeWeak=i;this.boostFullMatch=e}static{this.default={boostFullMatch:!0,firstMatchCanBeWeak:!1}}};function rR(a,i,e,t,o,n,r=Bj.default){let s=a.length>sY?sY:a.length,l=t.length>sY?sY:t.length;if(e>=s||n>=l||s-e>l-n||!SCe(i,e,s,o,n,l,!0))return;iHo(s,l,e,n,i,o);let c=1,u=1,p=e,h=n,g=[!1];for(c=1,p=e;p<s;c++,p++){let y=hQi[p],w=Mni[p],k=p+1<s?Mni[p+1]:l;for(u=y-n+1,h=y;h<k;u++,h++){let T=Number.MIN_SAFE_INTEGER,P=!1;h<=w&&(T=oHo(a,i,p,e,t,o,h,l,n,Iz[c-1][u-1]===0,g));let O=0;T!==Number.MIN_SAFE_INTEGER&&(P=!0,O=T+rY[c-1][u-1]);let V=h>y,H=V?rY[c][u-1]+(Iz[c][u-1]>0?-5:0):0,G=h>y+1&&Iz[c][u-1]>0,$=G?rY[c][u-2]+(Iz[c][u-2]>0?-5:0):0;if(G&&(!V||$>=H)&&(!P||$>=O))rY[c][u]=$,Y5e[c][u]=3,Iz[c][u]=0;else if(V&&(!P||H>=O))rY[c][u]=H,Y5e[c][u]=2,Iz[c][u]=0;else if(P)rY[c][u]=O,Y5e[c][u]=1,Iz[c][u]=Iz[c-1][u-1]+1;else throw new Error("not possible")}}if(eHo&&tHo(a,e,t,n),!g[0]&&!r.firstMatchCanBeWeak)return;c--,u--;let f=[rY[c][u],n],v=0,b=0;for(;c>=1;){let y=u;do{let w=Y5e[c][y];if(w===3)y=y-2;else if(w===2)y=y-1;else break}while(y>=1);v>1&&i[e+c-1]===o[n+u-1]&&!xyt(y+n-1,t,o)&&v+1>Iz[c][y]&&(y=u),y===u?v++:v=1,b||(b=y),c--,u=y-1,f.push(u)}l-n===s&&r.boostFullMatch&&(f[0]+=2);let S=b-s;return f[0]-=S,f}function iHo(a,i,e,t,o,n){let r=a-1,s=i-1;for(;r>=e&&s>=t;)o[r]===n[s]&&(Mni[r]=s,r--),s--}function oHo(a,i,e,t,o,n,r,s,l,c,u){if(i[e]!==n[r])return Number.MIN_SAFE_INTEGER;let p=1,h=!1;return r===e-t?p=a[e]===o[r]?7:5:xyt(r,o,n)&&(r===0||!xyt(r-1,o,n))?(p=a[e]===o[r]?7:5,h=!0):Cyt(n,r)&&(r===0||!Cyt(n,r-1))?p=5:(Cyt(n,r-1)||rQi(n,r-1))&&(p=5,h=!0),p>1&&e===t&&(u[0]=!0),h||(h=xyt(r,o,n)||Cyt(n,r-1)||rQi(n,r-1)),e===t?r>l&&(p-=h?3:5):c?p+=h?2:0:p+=h?0:1,r+1===s&&(p-=h?3:5),p}function Eyt(a,i,e,t,o,n,r){return nHo(a,i,e,t,o,n,!0,r)}function nHo(a,i,e,t,o,n,r,s){let l=rR(a,i,e,t,o,n,s);if(l&&!r)return l;if(a.length>=3){let c=Math.min(7,a.length-1);for(let u=e+1;u<c;u++){let p=rHo(a,u);if(p){let h=rR(p,p.toLowerCase(),e,t,o,n,s);h&&(h[0]-=3,(!l||h[0]>l[0])&&(l=h))}}}return l}function rHo(a,i){if(i+1>=a.length)return;let e=a[i],t=a[i+1];if(e!==t)return a.slice(0,i)+t+e+a.slice(i+2)}var Hle="notSelectable";var sR=class extends Error{constructor(i,e){super(`ListError [${i}] ${e}`)}},yz=class{constructor(){this.cache=new WeakMap}getHeight(i){return this.cache.get(i)??this.estimateHeight(i)}setDynamicHeight(i,e){e>0&&this.cache.set(i,e)}};var lS;(o=>{function a(n,r){if(n.start>=r.end||r.start>=n.end)return{start:0,end:0};let s=Math.max(n.start,r.start),l=Math.min(n.end,r.end);return l-s<=0?{start:0,end:0}:{start:s,end:l}}o.intersect=a;function i(n){return n.end-n.start<=0}o.isEmpty=i;function e(n,r){return!i(a(n,r))}o.intersects=e;function t(n,r){let s=[],l={start:n.start,end:Math.min(r.start,n.end)},c={start:Math.max(r.end,n.start),end:n.end};return i(l)||s.push(l),i(c)||s.push(c),s}o.relativeComplement=t})(lS||={});function gQi(a,i){let e=[];for(let t of i){if(a.start>=t.range.end)continue;if(a.end<t.range.start)break;let o=lS.intersect(a,t.range);lS.isEmpty(o)||e.push({range:o,size:t.size})}return e}function _yt({start:a,end:i},e){return{start:a+e,end:i+e}}function sHo(a){let i=[],e=null;for(let t of a){let o=t.range.start,n=t.range.end,r=t.size;if(e&&r===e.size){e.range.end=n;continue}e={range:{start:o,end:n},size:r},i.push(e)}return i}function aHo(...a){return sHo(a.reduce((i,e)=>i.concat(e),[]))}var Tyt=class{constructor(i){this.groups=[];this._size=0;this._paddingTop=0;this._paddingTop=i??0,this._size=this._paddingTop}get paddingTop(){return this._paddingTop}set paddingTop(i){this._size=this._size+i-this._paddingTop,this._paddingTop=i}splice(i,e,t=[]){let o=t.length-e,n=gQi({start:0,end:i},this.groups),r=gQi({start:i+e,end:Number.POSITIVE_INFINITY},this.groups).map(l=>({range:_yt(l.range,o),size:l.size})),s=t.map((l,c)=>({range:{start:i+c,end:i+c+1},size:l.size}));this.groups=aHo(n,s,r),this._size=this._paddingTop+this.groups.reduce((l,c)=>l+c.size*(c.range.end-c.range.start),0)}get count(){let i=this.groups.length;return i?this.groups[i-1].range.end:0}get size(){return this._size}indexAt(i){if(i<0)return-1;if(i<this._paddingTop)return 0;let e=0,t=this._paddingTop;for(let o of this.groups){let n=o.range.end-o.range.start,r=t+n*o.size;if(i<r)return e+Math.floor((i-t)/o.size);e+=n,t=r}return e}indexAfter(i){return Math.min(this.indexAt(i)+1,this.count)}positionAt(i){if(i<0)return-1;let e=0,t=0;for(let o of this.groups){let n=o.range.end-o.range.start,r=t+n;if(i<r)return this._paddingTop+e+(i-t)*o.size;e+=n*o.size,t=r}return-1}};var Dyt=class{constructor(i){this.renderers=i;this.cache=new Map;this.transactionNodesPendingRemoval=new Set;this.inTransaction=!1}alloc(i){let e=this.getTemplateCache(i).pop(),t=!1;if(e)t=this.transactionNodesPendingRemoval.delete(e.domNode);else{let o=_(".monaco-list-row"),r=this.getRenderer(i).renderTemplate(o);e={domNode:o,templateId:i,templateData:r}}return{row:e,isReusingConnectedDomNode:t}}release(i){i&&this.releaseRow(i)}transact(i){if(this.inTransaction)throw new Error("Already in transaction");this.inTransaction=!0;try{i()}finally{for(let e of this.transactionNodesPendingRemoval)this.doRemoveNode(e);this.transactionNodesPendingRemoval.clear(),this.inTransaction=!1}}releaseRow(i){let{domNode:e,templateId:t}=i;e&&(this.inTransaction?this.transactionNodesPendingRemoval.add(e):this.doRemoveNode(e)),this.getTemplateCache(t).push(i)}doRemoveNode(i){i.classList.remove("scrolling"),i.remove()}getTemplateCache(i){let e=this.cache.get(i);return e||(e=[],this.cache.set(i,e)),e}dispose(){this.cache.forEach((i,e)=>{for(let t of i)this.getRenderer(e).disposeTemplate(t.templateData),t.templateData=null}),this.cache.clear(),this.transactionNodesPendingRemoval.clear()}getRenderer(i){let e=this.renderers.get(i);if(!e)throw new Error(`No renderer found for ${i}`);return e}};function MP(a,i,e,t=[]){if(!a.dataTransfer)return;let o=_(".monaco-drag-image");o.textContent=e,o.classList.add(...t),(s=>{for(;s&&!s.classList.contains("monaco-workbench");)s=s.parentElement;return s||i.ownerDocument.body})(i).appendChild(o),a.dataTransfer.setDragImage(o,-10,-10),setTimeout(()=>o.remove(),0)}var Ule={CurrentDragAndDropData:void 0};var wz={useShadows:!0,verticalScrollMode:1,setRowLineHeight:!0,setRowHeight:!0,supportDynamicHeights:!1,dnd:{getDragElements(a){return[a]},getDragURI(){return null},onDragStart(){},onDragOver(){return!1},drop(){},dispose(){}},horizontalScrolling:!1,transformOptimization:!0,alwaysConsumeMouseWheel:!0},uw=class{get context(){return this._context}set context(i){this._context=i}constructor(i){this.elements=i}update(){}getData(){return this.elements}},J5e=class{constructor(i){this.elements=i}update(){}getData(){return this.elements}},Cz=class{constructor(){this.types=[],this.files=[]}update(i){if(i.types&&this.types.splice(0,this.types.length,...i.types),i.files){this.files.splice(0,this.files.length);for(let e=0;e<i.files.length;e++){let t=i.files.item(e);t&&(t.size||t.type)&&this.files.push(t)}}}getData(){return{types:this.types,files:this.files}}};function lHo(a,i){return Array.isArray(a)&&Array.isArray(i)?$i(a,i):a===i}var Fni=class{constructor(i){i?.getSetSize?this.getSetSize=i.getSetSize.bind(i):this.getSetSize=(e,t,o)=>o,i?.getPosInSet?this.getPosInSet=i.getPosInSet.bind(i):this.getPosInSet=(e,t)=>t+1,i?.getRole?this.getRole=i.getRole.bind(i):this.getRole=e=>"listitem",i?.isChecked?this.isChecked=i.isChecked.bind(i):this.isChecked=e=>{}}},aR=class aR{constructor(i,e,t,o=wz){this.virtualDelegate=e;this.domId=`list_id_${++aR.InstanceCount}`;this.renderers=new Map;this.renderWidth=0;this._scrollHeight=0;this.scrollableElementUpdateDisposable=null;this.scrollableElementWidthDelayer=new Xo(50);this.splicing=!1;this.dragOverAnimationStopDisposable=x.None;this.dragOverMouseY=0;this.canDrop=!1;this.currentDragFeedbackDisposable=x.None;this.onDragLeaveTimeout=x.None;this.currentSelectionDisposable=x.None;this.disposables=new N;this._onDidChangeContentHeight=this.disposables.add(new E);this._onDidChangeContentWidth=this.disposables.add(new E);this.onDidChangeContentHeight=U.latch(this._onDidChangeContentHeight.event,void 0,this.disposables);this.onDidChangeContentWidth=U.latch(this._onDidChangeContentWidth.event,void 0,this.disposables);this._horizontalScrolling=!1;if(o.horizontalScrolling&&o.supportDynamicHeights)throw new Error("Horizontal scrolling and dynamic heights not supported simultaneously");this.items=[],this.itemId=0,this.rangeMap=this.createRangeMap(o.paddingTop??0);for(let r of t)this.renderers.set(r.templateId,r);if(this.cache=this.disposables.add(new Dyt(this.renderers)),this.lastRenderTop=0,this.lastRenderHeight=0,this.domNode=document.createElement("div"),this.domNode.className="monaco-list",this.domNode.classList.add(this.domId),this.domNode.tabIndex=0,this.domNode.classList.toggle("mouse-support",typeof o.mouseSupport=="boolean"?o.mouseSupport:!0),this._horizontalScrolling=o.horizontalScrolling??wz.horizontalScrolling,this.domNode.classList.toggle("horizontal-scrolling",this._horizontalScrolling),this.paddingBottom=typeof o.paddingBottom>"u"?0:o.paddingBottom,this.accessibilityProvider=new Fni(o.accessibilityProvider),this.rowsContainer=document.createElement("div"),this.rowsContainer.className="monaco-list-rows",(o.transformOptimization??wz.transformOptimization)&&(this.rowsContainer.style.transform="translate3d(0px, 0px, 0px)",this.rowsContainer.style.overflow="hidden",this.rowsContainer.style.contain="strict"),this.disposables.add(Ms.addTarget(this.rowsContainer)),this.scrollable=this.disposables.add(new y_({forceIntegerValues:!0,smoothScrollDuration:o.smoothScrolling??!1?125:0,scheduleAtNextAnimationFrame:r=>Wr(Re(this.domNode),r)})),this.scrollableElement=this.disposables.add(new _O(this.rowsContainer,{alwaysConsumeMouseWheel:o.alwaysConsumeMouseWheel??wz.alwaysConsumeMouseWheel,horizontal:1,vertical:o.verticalScrollMode??wz.verticalScrollMode,useShadows:o.useShadows??wz.useShadows,mouseWheelScrollSensitivity:o.mouseWheelScrollSensitivity,fastScrollSensitivity:o.fastScrollSensitivity,scrollByPage:o.scrollByPage},this.scrollable)),this.domNode.appendChild(this.scrollableElement.getDomNode()),i.appendChild(this.domNode),this.scrollableElement.onScroll(this.onScroll,this,this.disposables),this.disposables.add(j(this.rowsContainer,Kn.Change,r=>this.onTouchChange(r))),this.disposables.add(j(this.scrollableElement.getDomNode(),"scroll",r=>{let s=r.target,l=s.scrollTop;s.scrollTop=0,o.scrollToActiveElement&&this.setScrollTop(this.scrollTop+l)})),this.disposables.add(j(this.domNode,"dragover",r=>this.onDragOver(this.toDragEvent(r)))),this.disposables.add(j(this.domNode,"drop",r=>this.onDrop(this.toDragEvent(r)))),this.disposables.add(j(this.domNode,"dragleave",r=>this.onDragLeave(this.toDragEvent(r)))),this.disposables.add(j(this.domNode,"dragend",r=>this.onDragEnd(r))),o.userSelection){if(o.dnd)throw new Error("DND and user selection cannot be used simultaneously");this.disposables.add(j(this.domNode,"mousedown",r=>this.onPotentialSelectionStart(r)))}this.setRowLineHeight=o.setRowLineHeight??wz.setRowLineHeight,this.setRowHeight=o.setRowHeight??wz.setRowHeight,this.supportDynamicHeights=o.supportDynamicHeights??wz.supportDynamicHeights,this.dnd=o.dnd??this.disposables.add(wz.dnd),this.layout(o.initialSize?.height,o.initialSize?.width),o.scrollToActiveElement&&this._setupFocusObserver(i)}static{this.InstanceCount=0}get contentHeight(){return this.rangeMap.size}get contentWidth(){return this.scrollWidth??0}get onDidScroll(){return this.scrollableElement.onScroll}get onWillScroll(){return this.scrollableElement.onWillScroll}get containerDomNode(){return this.rowsContainer}get scrollableElementDomNode(){return this.scrollableElement.getDomNode()}get horizontalScrolling(){return this._horizontalScrolling}set horizontalScrolling(i){if(i!==this._horizontalScrolling){if(i&&this.supportDynamicHeights)throw new Error("Horizontal scrolling and dynamic heights not supported simultaneously");if(this._horizontalScrolling=i,this.domNode.classList.toggle("horizontal-scrolling",this._horizontalScrolling),this._horizontalScrolling){for(let e of this.items)this.measureItemWidth(e);this.updateScrollWidth(),this.scrollableElement.setScrollDimensions({width:X9(this.domNode)}),this.rowsContainer.style.width=`${Math.max(this.scrollWidth||0,this.renderWidth)}px`}else this.scrollableElementWidthDelayer.cancel(),this.scrollableElement.setScrollDimensions({width:this.renderWidth,scrollWidth:this.renderWidth}),this.rowsContainer.style.width="",this.domNode.style.removeProperty("--list-scroll-right-offset")}}_setupFocusObserver(i){this.disposables.add(j(i,"focus",()=>{let e=Nn();this.activeElement!==e&&e!==null&&(this.activeElement=e,this._scrollToActiveElement(this.activeElement,i))},!0))}_scrollToActiveElement(i,e){let t=e.getBoundingClientRect(),n=i.getBoundingClientRect().top-t.top;n<0&&this.setScrollTop(this.scrollTop+n)}updateOptions(i){i.paddingBottom!==void 0&&(this.paddingBottom=i.paddingBottom,this.scrollableElement.setScrollDimensions({scrollHeight:this.scrollHeight})),i.smoothScrolling!==void 0&&this.scrollable.setSmoothScrollDuration(i.smoothScrolling?125:0),i.horizontalScrolling!==void 0&&(this.horizontalScrolling=i.horizontalScrolling);let e;if(i.scrollByPage!==void 0&&(e={...e??{},scrollByPage:i.scrollByPage}),i.mouseWheelScrollSensitivity!==void 0&&(e={...e??{},mouseWheelScrollSensitivity:i.mouseWheelScrollSensitivity}),i.fastScrollSensitivity!==void 0&&(e={...e??{},fastScrollSensitivity:i.fastScrollSensitivity}),e&&this.scrollableElement.updateOptions(e),i.paddingTop!==void 0&&i.paddingTop!==this.rangeMap.paddingTop){let t=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight),o=i.paddingTop-this.rangeMap.paddingTop;this.rangeMap.paddingTop=i.paddingTop,this.render(t,Math.max(0,this.lastRenderTop+o),this.lastRenderHeight,void 0,void 0,!0),this.setScrollTop(this.lastRenderTop),this.eventuallyUpdateScrollDimensions(),this.supportDynamicHeights&&this._rerender(this.lastRenderTop,this.lastRenderHeight)}}delegateScrollFromMouseWheelEvent(i){this.scrollableElement.delegateScrollFromMouseWheelEvent(i)}delegateVerticalScrollbarPointerDown(i){this.scrollableElement.delegateVerticalScrollbarPointerDown(i)}updateElementHeight(i,e,t){if(i<0||i>=this.items.length)return;let o=this.items[i].size;if(typeof e>"u"){if(!this.supportDynamicHeights){console.warn("Dynamic heights not supported",new Error().stack);return}this.items[i].lastDynamicHeightWidth=void 0,e=o+this.probeDynamicHeight(i)}if(o===e)return;let n=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight),r=0;i<n.start||t!==null&&t>i&&t<n.end?r=e-o:r=0,this.rangeMap.splice(i,1,[{size:e}]),this.items[i].size=e,this.render(n,Math.max(0,this.lastRenderTop+r),this.lastRenderHeight,void 0,void 0,!0),this.setScrollTop(this.lastRenderTop),this.eventuallyUpdateScrollDimensions(),this.supportDynamicHeights?this._rerender(this.lastRenderTop,this.lastRenderHeight):this._onDidChangeContentHeight.fire(this.contentHeight)}createRangeMap(i){return new Tyt(i)}splice(i,e,t=[]){if(this.splicing)throw new Error("Can't run recursive splices.");this.splicing=!0;try{return this._splice(i,e,t)}finally{this.splicing=!1,this._onDidChangeContentHeight.fire(this.contentHeight)}}_splice(i,e,t=[]){let o=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight),n={start:i,end:i+e},r=lS.intersect(o,n),s=new Map;for(let T=r.end-1;T>=r.start;T--){let P=this.items[T];if(P.dragStartDisposable.dispose(),P.checkedDisposable.dispose(),P.row){let O=s.get(P.templateId);O||(O=[],s.set(P.templateId,O));let V=this.renderers.get(P.templateId);V&&V.disposeElement&&V.disposeElement(P.element,T,P.row.templateData,{height:P.size}),O.unshift(P.row)}P.row=null,P.stale=!0}let l={start:i+e,end:this.items.length},c=lS.intersect(l,o),u=lS.relativeComplement(l,o),p=t.map(T=>({id:String(this.itemId++),element:T,templateId:this.virtualDelegate.getTemplateId(T),size:this.virtualDelegate.getHeight(T),width:void 0,hasDynamicHeight:!!this.virtualDelegate.hasDynamicHeight&&this.virtualDelegate.hasDynamicHeight(T),lastDynamicHeightWidth:void 0,row:null,uri:void 0,dropTarget:!1,dragStartDisposable:x.None,checkedDisposable:x.None,stale:!1})),h;i===0&&e>=this.items.length?(this.rangeMap=this.createRangeMap(this.rangeMap.paddingTop),this.rangeMap.splice(0,0,p),h=this.items,this.items=p):(this.rangeMap.splice(i,e,p),h=Ose(this.items,i,e,p));let g=t.length-e,f=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight),v=_yt(c,g),b=lS.intersect(f,v);for(let T=b.start;T<b.end;T++)this.updateItemInDOM(this.items[T],T);let S=lS.relativeComplement(v,f);for(let T of S)for(let P=T.start;P<T.end;P++)this.removeItemFromDOM(P);let y=u.map(T=>_yt(T,g)),k=[{start:i,end:i+t.length},...y].map(T=>lS.intersect(f,T)).reverse();for(let T of k)for(let P=T.end-1;P>=T.start;P--){let O=this.items[P],H=s.get(O.templateId)?.pop();this.insertItemInDOM(P,H)}for(let T of s.values())for(let P of T)this.cache.release(P);return this.eventuallyUpdateScrollDimensions(),this.supportDynamicHeights&&this._rerender(this.scrollTop,this.renderHeight),h.map(T=>T.element)}eventuallyUpdateScrollDimensions(){this._scrollHeight=this.contentHeight,this.rowsContainer.style.height=`${this._scrollHeight}px`,this.scrollableElementUpdateDisposable||(this.scrollableElementUpdateDisposable=Wr(Re(this.domNode),()=>{this.scrollableElement.setScrollDimensions({scrollHeight:this.scrollHeight}),this.updateScrollWidth(),this.scrollableElementUpdateDisposable=null}))}eventuallyUpdateScrollWidth(){if(!this.horizontalScrolling){this.scrollableElementWidthDelayer.cancel();return}this.scrollableElementWidthDelayer.trigger(()=>this.updateScrollWidth())}updateScrollWidth(){if(!this.horizontalScrolling)return;let i=0;for(let e of this.items)typeof e.width<"u"&&(i=Math.max(i,e.width));this.scrollWidth=i,this.scrollableElement.setScrollDimensions({scrollWidth:i===0?0:i+10}),this._onDidChangeContentWidth.fire(this.scrollWidth)}updateWidth(i){if(!this.horizontalScrolling||typeof this.scrollWidth>"u")return;let e=this.items[i];this.measureItemWidth(e),typeof e.width<"u"&&e.width>this.scrollWidth&&(this.scrollWidth=e.width,this.scrollableElement.setScrollDimensions({scrollWidth:this.scrollWidth+10}),this._onDidChangeContentWidth.fire(this.scrollWidth))}rerender(){if(this.supportDynamicHeights){for(let i of this.items)i.lastDynamicHeightWidth=void 0;this._rerender(this.lastRenderTop,this.lastRenderHeight)}}get length(){return this.items.length}get renderHeight(){return this.scrollableElement.getScrollDimensions().height}get firstVisibleIndex(){return this.getVisibleRange(this.lastRenderTop,this.lastRenderHeight).start}get firstMostlyVisibleIndex(){let i=this.firstVisibleIndex,e=this.rangeMap.positionAt(i),t=this.rangeMap.positionAt(i+1);return t!==-1&&(t-e)/2+e<this.scrollTop?i+1:i}get lastVisibleIndex(){return this.getRenderRange(this.lastRenderTop,this.lastRenderHeight).end-1}element(i){return this.items[i].element}indexOf(i){return this.items.findIndex(e=>e.element===i)}domElement(i){let e=this.items[i].row;return e&&e.domNode}elementHeight(i){return this.items[i].size}elementTop(i){return this.rangeMap.positionAt(i)}indexAt(i){return this.rangeMap.indexAt(i)}indexAfter(i){return this.rangeMap.indexAfter(i)}layout(i,e){let t={height:typeof i=="number"?i:RIe(this.domNode)};if(this.scrollableElementUpdateDisposable&&(this.scrollableElementUpdateDisposable.dispose(),this.scrollableElementUpdateDisposable=null,t.scrollHeight=this.scrollHeight),this.scrollableElement.setScrollDimensions(t),typeof e<"u"&&(this.renderWidth=e,this.supportDynamicHeights&&this._rerender(this.scrollTop,this.renderHeight)),this.horizontalScrolling){this.scrollableElement.setScrollDimensions({width:typeof e=="number"?e:X9(this.domNode)});let o=this.scrollableElement.getScrollPosition(),n=this.scrollableElement.getScrollDimensions(),r=Math.max(0,n.scrollWidth-o.scrollLeft-this.renderWidth);this.domNode.style.setProperty("--list-scroll-right-offset",`${Math.max(r-12,0)}px`)}}render(i,e,t,o,n,r=!1,s=!1){let l=this.getRenderRange(e,t),c=lS.relativeComplement(l,i).reverse(),u=lS.relativeComplement(i,l);if(r){let p=lS.intersect(i,l);for(let h=p.start;h<p.end;h++)this.updateItemInDOM(this.items[h],h)}if(this.cache.transact(()=>{for(let p of u)for(let h=p.start;h<p.end;h++)this.removeItemFromDOM(h,s);for(let p of c)for(let h=p.end-1;h>=p.start;h--)this.insertItemInDOM(h)}),o!==void 0&&(this.rowsContainer.style.left=`-${o}px`),this.rowsContainer.style.top=`-${e}px`,this.horizontalScrolling&&n!==void 0){this.rowsContainer.style.width=`${Math.max(n,this.renderWidth)}px`;let p=Math.max(0,n-(o??0)-this.renderWidth);this.domNode.style.setProperty("--list-scroll-right-offset",`${Math.max(p-12,0)}px`)}this.lastRenderTop=e,this.lastRenderHeight=t}insertItemInDOM(i,e){let t=this.items[i];if(!t.row)if(e)t.row=e,t.stale=!0;else{let c=this.cache.alloc(t.templateId);t.row=c.row,t.stale||=c.isReusingConnectedDomNode}let o=this.accessibilityProvider.getRole(t.element)||"listitem";t.row.domNode.setAttribute("role",o);let n=this.accessibilityProvider.isChecked(t.element),r=c=>c==="mixed"?"mixed":String(!!c);if(typeof n=="boolean"||n==="mixed")t.row.domNode.setAttribute("aria-checked",r(n));else if(n){let c=u=>t.row.domNode.setAttribute("aria-checked",r(u));c(n.value),t.checkedDisposable=n.onDidChange(()=>c(n.value))}if(t.stale||!t.row.domNode.parentElement){let c=this.items.at(i+1)?.row?.domNode??null;(t.row.domNode.parentElement!==this.rowsContainer||t.row.domNode.nextElementSibling!==c)&&this.rowsContainer.insertBefore(t.row.domNode,c),t.stale=!1}this.updateItemInDOM(t,i);let s=this.renderers.get(t.templateId);if(!s)throw new Error(`No renderer found for template id ${t.templateId}`);s?.renderElement(t.element,i,t.row.templateData,{height:t.size});let l=this.dnd.getDragURI(t.element);t.dragStartDisposable.dispose(),t.row.domNode.draggable=!!l,l&&(t.dragStartDisposable=j(t.row.domNode,"dragstart",c=>this.onDragStart(t.element,l,c))),this.horizontalScrolling&&(this.measureItemWidth(t),this.eventuallyUpdateScrollWidth())}measureItemWidth(i){if(!i.row||!i.row.domNode)return;i.row.domNode.style.width="fit-content",i.width=X9(i.row.domNode);let e=Re(i.row.domNode).getComputedStyle(i.row.domNode);e.paddingLeft&&(i.width+=parseFloat(e.paddingLeft)),e.paddingRight&&(i.width+=parseFloat(e.paddingRight)),i.row.domNode.style.width=""}updateItemInDOM(i,e){i.row.domNode.style.top=`${this.elementTop(e)}px`,this.setRowHeight&&(i.row.domNode.style.height=`${i.size}px`),this.setRowLineHeight&&(i.row.domNode.style.lineHeight=`${i.size}px`),i.row.domNode.setAttribute("data-index",`${e}`),i.row.domNode.setAttribute("data-last-element",e===this.length-1?"true":"false"),i.row.domNode.setAttribute("data-parity",e%2===0?"even":"odd"),i.row.domNode.setAttribute("aria-setsize",String(this.accessibilityProvider.getSetSize(i.element,e,this.length))),i.row.domNode.setAttribute("aria-posinset",String(this.accessibilityProvider.getPosInSet(i.element,e))),i.row.domNode.setAttribute("id",this.getElementDomId(e)),i.row.domNode.classList.toggle("drop-target",i.dropTarget)}removeItemFromDOM(i,e){let t=this.items[i];if(t.dragStartDisposable.dispose(),t.checkedDisposable.dispose(),t.row){let o=this.renderers.get(t.templateId);o&&o.disposeElement&&o.disposeElement(t.element,i,t.row.templateData,{height:t.size,onScroll:e}),this.cache.release(t.row),t.row=null}this.horizontalScrolling&&this.eventuallyUpdateScrollWidth()}getScrollTop(){return this.scrollableElement.getScrollPosition().scrollTop}setScrollTop(i,e){this.scrollableElementUpdateDisposable&&(this.scrollableElementUpdateDisposable.dispose(),this.scrollableElementUpdateDisposable=null,this.scrollableElement.setScrollDimensions({scrollHeight:this.scrollHeight})),this.scrollableElement.setScrollPosition({scrollTop:i,reuseAnimation:e})}getScrollLeft(){return this.scrollableElement.getScrollPosition().scrollLeft}setScrollLeft(i){this.scrollableElementUpdateDisposable&&(this.scrollableElementUpdateDisposable.dispose(),this.scrollableElementUpdateDisposable=null,this.scrollableElement.setScrollDimensions({scrollWidth:this.scrollWidth})),this.scrollableElement.setScrollPosition({scrollLeft:i})}get scrollTop(){return this.getScrollTop()}set scrollTop(i){this.setScrollTop(i)}get scrollHeight(){return this._scrollHeight+(this.horizontalScrolling?10:0)+this.paddingBottom}get onMouseClick(){return U.map(this.disposables.add(new Gn(this.domNode,"click")).event,i=>this.toMouseEvent(i),this.disposables)}get onMouseDblClick(){return U.map(this.disposables.add(new Gn(this.domNode,"dblclick")).event,i=>this.toMouseEvent(i),this.disposables)}get onMouseMiddleClick(){return U.filter(U.map(this.disposables.add(new Gn(this.domNode,"auxclick")).event,i=>this.toMouseEvent(i),this.disposables),i=>i.browserEvent.button===1,this.disposables)}get onMouseUp(){return U.map(this.disposables.add(new Gn(this.domNode,"mouseup")).event,i=>this.toMouseEvent(i),this.disposables)}get onMouseDown(){return U.map(this.disposables.add(new Gn(this.domNode,"mousedown")).event,i=>this.toMouseEvent(i),this.disposables)}get onMouseOver(){return U.map(this.disposables.add(new Gn(this.domNode,"mouseover")).event,i=>this.toMouseEvent(i),this.disposables)}get onMouseMove(){return U.map(this.disposables.add(new Gn(this.domNode,"mousemove")).event,i=>this.toMouseEvent(i),this.disposables)}get onMouseOut(){return U.map(this.disposables.add(new Gn(this.domNode,"mouseout")).event,i=>this.toMouseEvent(i),this.disposables)}get onContextMenu(){return U.any(U.map(this.disposables.add(new Gn(this.domNode,"contextmenu")).event,i=>this.toMouseEvent(i),this.disposables),U.map(this.disposables.add(new Gn(this.domNode,Kn.Contextmenu)).event,i=>this.toGestureEvent(i),this.disposables))}get onTouchStart(){return U.map(this.disposables.add(new Gn(this.domNode,"touchstart")).event,i=>this.toTouchEvent(i),this.disposables)}get onTap(){return U.map(this.disposables.add(new Gn(this.rowsContainer,Kn.Tap)).event,i=>this.toGestureEvent(i),this.disposables)}toMouseEvent(i){let e=this.getItemIndexFromEventTarget(i.target||null),t=typeof e>"u"?void 0:this.items[e],o=t&&t.element;return{browserEvent:i,index:e,element:o}}toTouchEvent(i){let e=this.getItemIndexFromEventTarget(i.target||null),t=typeof e>"u"?void 0:this.items[e],o=t&&t.element;return{browserEvent:i,index:e,element:o}}toGestureEvent(i){let e=this.getItemIndexFromEventTarget(i.initialTarget||null),t=typeof e>"u"?void 0:this.items[e],o=t&&t.element;return{browserEvent:i,index:e,element:o}}toDragEvent(i){let e=this.getItemIndexFromEventTarget(i.target||null),t=typeof e>"u"?void 0:this.items[e],o=t&&t.element,n=this.getTargetSector(i,e);return{browserEvent:i,index:e,element:o,sector:n}}onScroll(i){try{let e=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight);this.render(e,i.scrollTop,i.height,i.scrollLeft,i.scrollWidth,void 0,!0),this.supportDynamicHeights&&this._rerender(i.scrollTop,i.height,i.inSmoothScrolling)}catch(e){throw console.error("Got bad scroll event:",i),e}}onTouchChange(i){i.preventDefault(),i.stopPropagation(),this.scrollTop-=i.translationY}onDragStart(i,e,t){if(!t.dataTransfer)return;let o=this.dnd.getDragElements(i);t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setData(yl.TEXT,e);let n;this.dnd.getDragLabel&&(n=this.dnd.getDragLabel(o,t)),typeof n>"u"&&(n=String(o.length)),MP(t,this.domNode,n,[this.domId]),this.domNode.classList.add("dragging"),this.currentDragData=new uw(o),Ule.CurrentDragAndDropData=new J5e(o),this.dnd.onDragStart?.(this.currentDragData,t)}onPotentialSelectionStart(i){this.currentSelectionDisposable.dispose();let e=uae(this.domNode),t=this.currentSelectionDisposable=new N,o=t.add(new N);o.add(j(this.domNode,"selectstart",()=>{o.add(j(e,"mousemove",n=>{e.getSelection()?.isCollapsed===!1&&this.setupDragAndDropScrollTopAnimation(n)})),t.add(Z(()=>{let n=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight);this.currentSelectionBounds=void 0,this.render(n,this.lastRenderTop,this.lastRenderHeight,void 0,void 0)})),t.add(j(e,"selectionchange",()=>{let n=e.getSelection();if(!n||n.isCollapsed){o.isDisposed&&t.dispose();return}let r=this.getIndexOfListElement(n.anchorNode),s=this.getIndexOfListElement(n.focusNode);r!==void 0&&s!==void 0&&(s<r&&([r,s]=[s,r]),this.currentSelectionBounds={start:r,end:s})}))})),o.add(j(e,"mouseup",()=>{o.dispose(),this.teardownDragAndDropScrollTopAnimation(),e.getSelection()?.isCollapsed!==!1&&t.dispose()}))}getIndexOfListElement(i){if(!(!i||!this.domNode.contains(i)))for(;i&&i!==this.domNode;){if(i.dataset?.index)return Number(i.dataset.index);i=i.parentElement}}onDragOver(i){if(i.browserEvent.preventDefault(),this.onDragLeaveTimeout.dispose(),Ule.CurrentDragAndDropData&&Ule.CurrentDragAndDropData.getData()==="vscode-ui"||(this.setupDragAndDropScrollTopAnimation(i.browserEvent),!i.browserEvent.dataTransfer))return!1;if(!this.currentDragData)if(Ule.CurrentDragAndDropData)this.currentDragData=Ule.CurrentDragAndDropData;else{if(!i.browserEvent.dataTransfer.types)return!1;this.currentDragData=new Cz}let e=this.dnd.onDragOver(this.currentDragData,i.element,i.index,i.sector,i.browserEvent);if(this.canDrop=typeof e=="boolean"?e:e.accept,!this.canDrop)return this.currentDragFeedback=void 0,this.currentDragFeedbackDisposable.dispose(),!1;i.browserEvent.dataTransfer.dropEffect=typeof e!="boolean"&&e.effect?.type===0?"copy":"move";let t;typeof e!="boolean"&&e.feedback?t=e.feedback:typeof i.index>"u"?t=[-1]:t=[i.index],t=zo(t).filter(n=>n>=-1&&n<this.length).sort((n,r)=>n-r),t=t[0]===-1?[-1]:t;let o=typeof e!="boolean"&&e.effect&&e.effect.position?e.effect.position:"drop-target";if(lHo(this.currentDragFeedback,t)&&this.currentDragFeedbackPosition===o)return!0;if(this.currentDragFeedback=t,this.currentDragFeedbackPosition=o,this.currentDragFeedbackDisposable.dispose(),t[0]===-1)this.domNode.classList.add(o),this.rowsContainer.classList.add(o),this.currentDragFeedbackDisposable=Z(()=>{this.domNode.classList.remove(o),this.rowsContainer.classList.remove(o)});else{if(t.length>1&&o!=="drop-target")throw new Error("Can't use multiple feedbacks with position different than 'over'");o==="drop-target-after"&&t[0]<this.length-1&&(t[0]+=1,o="drop-target-before");for(let n of t){let r=this.items[n];r.dropTarget=!0,r.row?.domNode.classList.add(o)}this.currentDragFeedbackDisposable=Z(()=>{for(let n of t){let r=this.items[n];r.dropTarget=!1,r.row?.domNode.classList.remove(o)}})}return!0}onDragLeave(i){this.onDragLeaveTimeout.dispose(),this.onDragLeaveTimeout=tn(()=>this.clearDragOverFeedback(),100,this.disposables),this.currentDragData&&this.dnd.onDragLeave?.(this.currentDragData,i.element,i.index,i.browserEvent)}onDrop(i){if(!this.canDrop)return;let e=this.currentDragData;this.teardownDragAndDropScrollTopAnimation(),this.clearDragOverFeedback(),this.domNode.classList.remove("dragging"),this.currentDragData=void 0,Ule.CurrentDragAndDropData=void 0,!(!e||!i.browserEvent.dataTransfer)&&(i.browserEvent.preventDefault(),e.update(i.browserEvent.dataTransfer),this.dnd.drop(e,i.element,i.index,i.sector,i.browserEvent))}onDragEnd(i){this.canDrop=!1,this.teardownDragAndDropScrollTopAnimation(),this.clearDragOverFeedback(),this.domNode.classList.remove("dragging"),this.currentDragData=void 0,Ule.CurrentDragAndDropData=void 0,this.dnd.onDragEnd?.(i)}clearDragOverFeedback(){this.currentDragFeedback=void 0,this.currentDragFeedbackPosition=void 0,this.currentDragFeedbackDisposable.dispose(),this.currentDragFeedbackDisposable=x.None}setupDragAndDropScrollTopAnimation(i){if(!this.dragOverAnimationDisposable){let e=cO(this.domNode).top;this.dragOverAnimationDisposable=Zqi(Re(this.domNode),this.animateDragAndDropScrollTop.bind(this,e))}this.dragOverAnimationStopDisposable.dispose(),this.dragOverAnimationStopDisposable=tn(()=>{this.dragOverAnimationDisposable&&(this.dragOverAnimationDisposable.dispose(),this.dragOverAnimationDisposable=void 0)},1e3,this.disposables),this.dragOverMouseY=i.pageY}animateDragAndDropScrollTop(i){if(this.dragOverMouseY===void 0)return;let e=this.dragOverMouseY-i,t=this.renderHeight-35;e<35?this.scrollTop+=Math.max(-14,Math.floor(.3*(e-35))):e>t&&(this.scrollTop+=Math.min(14,Math.floor(.3*(e-t))))}teardownDragAndDropScrollTopAnimation(){this.dragOverAnimationStopDisposable.dispose(),this.dragOverAnimationDisposable&&(this.dragOverAnimationDisposable.dispose(),this.dragOverAnimationDisposable=void 0)}getTargetSector(i,e){if(e===void 0)return;let t=i.offsetY/this.items[e].size,o=Math.floor(t/.25);return Bn(o,0,3)}getItemIndexFromEventTarget(i){let e=this.scrollableElement.getDomNode(),t=i;for(;(Do(t)||KJt(t))&&t!==this.rowsContainer&&e.contains(t);){let o=t.getAttribute("data-index");if(o){let n=Number(o);if(!isNaN(n))return n}t=t.parentElement}}getVisibleRange(i,e){return{start:this.rangeMap.indexAt(i),end:this.rangeMap.indexAfter(i+e-1)}}getRenderRange(i,e){let t=this.getVisibleRange(i,e);if(this.currentSelectionBounds){let o=this.rangeMap.count;t.start=Math.min(t.start,this.currentSelectionBounds.start,o),t.end=Math.min(Math.max(t.end,this.currentSelectionBounds.end+1),o)}return t}_rerender(i,e,t){let o=this.getRenderRange(i,e),n,r;i===this.elementTop(o.start)?(n=o.start,r=0):o.end-o.start>1&&(n=o.start+1,r=this.elementTop(n)-i);let s=0;for(;;){let l=this.getRenderRange(i,e),c=!1;for(let u=l.start;u<l.end;u++){let p=this.probeDynamicHeight(u);p!==0&&this.rangeMap.splice(u,1,[this.items[u]]),s+=p,c=c||p!==0}if(!c){s!==0&&this.eventuallyUpdateScrollDimensions();let u=lS.relativeComplement(o,l);for(let h of u)for(let g=h.start;g<h.end;g++)this.items[g].row&&this.removeItemFromDOM(g);let p=lS.relativeComplement(l,o).reverse();for(let h of p)for(let g=h.end-1;g>=h.start;g--)this.insertItemInDOM(g);for(let h=l.start;h<l.end;h++)this.items[h].row&&this.updateItemInDOM(this.items[h],h);if(typeof n=="number"){let h=this.scrollable.getFutureScrollPosition().scrollTop-i,g=this.elementTop(n)-r+h;this.setScrollTop(g,t)}this._onDidChangeContentHeight.fire(this.contentHeight);return}}}probeDynamicHeight(i){let e=this.items[i],t=this.probeDynamicHeightForItem(e,i);return t>0&&this.virtualDelegate.setDynamicHeight?.(e.element,e.size),t}probeDynamicHeightForItem(i,e){if(this.virtualDelegate.getDynamicHeight){let r=this.virtualDelegate.getDynamicHeight(i.element);if(r!==null){let s=i.size;return i.size=r,i.lastDynamicHeightWidth=this.renderWidth,r-s}}if(!i.hasDynamicHeight||i.lastDynamicHeightWidth===this.renderWidth||this.virtualDelegate.hasDynamicHeight&&!this.virtualDelegate.hasDynamicHeight(i.element))return 0;let t=i.size;if(i.row)return i.row.domNode.style.height="",i.size=i.row.domNode.offsetHeight,i.size===0&&(ts(i.row.domNode,Re(i.row.domNode).document.body)?console.warn("Measured item node at 0px- ensure that ListView is not display:none before measuring row height!",new Error().stack):console.warn("Measuring item node that is not in DOM! Add ListView to the DOM before measuring row height!",new Error().stack)),i.lastDynamicHeightWidth=this.renderWidth,i.size-t;let{row:o}=this.cache.alloc(i.templateId);o.domNode.style.height="",this.rowsContainer.appendChild(o.domNode);let n=this.renderers.get(i.templateId);if(!n)throw new li("Missing renderer for templateId: "+i.templateId);return n.renderElement(i.element,e,o.templateData),i.size=o.domNode.offsetHeight,n.disposeElement?.(i.element,e,o.templateData),i.lastDynamicHeightWidth=this.renderWidth,o.domNode.remove(),this.cache.release(o),i.size-t}getElementDomId(i){return`${this.domId}_${i}`}dispose(){for(let i of this.items)if(i.dragStartDisposable.dispose(),i.checkedDisposable.dispose(),i.row){let e=this.renderers.get(i.row.templateId);e&&(e.disposeElement?.(i.element,-1,i.row.templateData,void 0),e.disposeTemplate(i.row.templateData))}this.items=[],this.domNode?.remove(),this.dragOverAnimationDisposable?.dispose(),this.disposables.dispose()}};I([hi],aR.prototype,"onMouseClick",1),I([hi],aR.prototype,"onMouseDblClick",1),I([hi],aR.prototype,"onMouseMiddleClick",1),I([hi],aR.prototype,"onMouseUp",1),I([hi],aR.prototype,"onMouseDown",1),I([hi],aR.prototype,"onMouseOver",1),I([hi],aR.prototype,"onMouseMove",1),I([hi],aR.prototype,"onMouseOut",1),I([hi],aR.prototype,"onContextMenu",1),I([hi],aR.prototype,"onTouchStart",1),I([hi],aR.prototype,"onTap",1);var ICe=aR;var Wni=class{constructor(i){this.trait=i;this.renderedElements=[]}get templateId(){return`template:${this.trait.name}`}renderTemplate(i){return i}renderElement(i,e,t){let o=this.renderedElements.findIndex(n=>n.templateData===t);if(o>=0){let n=this.renderedElements[o];this.trait.unrender(t),n.index=e}else{let n={index:e,templateData:t};this.renderedElements.push(n)}this.trait.renderIndex(e,t)}splice(i,e,t){let o=[];for(let n of this.renderedElements)n.index<i?o.push(n):n.index>=i+e&&o.push({index:n.index+t-e,templateData:n.templateData});this.renderedElements=o}renderIndexes(i){for(let{index:e,templateData:t}of this.renderedElements)i.indexOf(e)>-1&&this.trait.renderIndex(e,t)}disposeTemplate(i){let e=this.renderedElements.findIndex(t=>t.templateData===i);e<0||this.renderedElements.splice(e,1)}},yCe=class{constructor(i){this._trait=i;this.indexes=[];this.sortedIndexes=[];this._onChange=new E}get onChange(){return this._onChange.event}get name(){return this._trait}get renderer(){return new Wni(this)}splice(i,e,t){let o=t.length-e,n=i+e,r=[],s=0;for(;s<this.sortedIndexes.length&&this.sortedIndexes[s]<i;)r.push(this.sortedIndexes[s++]);for(let l=0;l<t.length;l++)t[l]&&r.push(l+i);for(;s<this.sortedIndexes.length&&this.sortedIndexes[s]>=n;)r.push(this.sortedIndexes[s++]+o);this.renderer.splice(i,e,t.length),this._set(r,r)}renderIndex(i,e){e.classList.toggle(this._trait,this.contains(i))}unrender(i){i.classList.remove(this._trait)}set(i,e){return this._set(i,[...i].sort(vQi),e)}_set(i,e,t){let o=this.indexes,n=this.sortedIndexes;this.indexes=i,this.sortedIndexes=e;let r=Uni(n,i);return this.renderer.renderIndexes(r),this._onChange.fire({indexes:i,browserEvent:t}),o}get(){return this.indexes}contains(i){return Px(this.sortedIndexes,i,vQi)>=0}dispose(){Be(this._onChange)}};I([hi],yCe.prototype,"renderer",1);var Vni=class extends yCe{constructor(e){super("selected");this.setAriaSelected=e}renderIndex(e,t){super.renderIndex(e,t),this.setAriaSelected&&(this.contains(e)?t.setAttribute("aria-selected","true"):t.setAttribute("aria-selected","false"))}},t4e=class{constructor(i,e,t){this.trait=i;this.view=e;this.identityProvider=t}splice(i,e,t){if(!this.identityProvider)return this.trait.splice(i,e,new Array(t.length).fill(!1));let o=this.trait.get().map(s=>this.identityProvider.getId(this.view.element(s)).toString());if(o.length===0)return this.trait.splice(i,e,new Array(t.length).fill(!1));let n=new Set(o),r=t.map(s=>n.has(this.identityProvider.getId(s).toString()));this.trait.splice(i,e,r)}};function i4e(a,i){return a.classList.contains(i)?!0:a.classList.contains("monaco-list")||!a.parentElement?!1:i4e(a.parentElement,i)}function cY(a){return i4e(a,"monaco-editor")}function bQi(a){return i4e(a,"monaco-custom-toggle")}function SQi(a){return i4e(a,"action-item")}function wCe(a){return i4e(a,"monaco-tree-sticky-row")}function CCe(a){return a.classList.contains("monaco-tree-sticky-container")}function qni(a){return a.tagName==="A"&&a.classList.contains("monaco-button")||a.tagName==="DIV"&&a.classList.contains("monaco-button-dropdown")?!0:a.classList.contains("monaco-list")||!a.parentElement?!1:qni(a.parentElement)}var Lyt=class{constructor(i,e,t){this.list=i;this.view=e;this.disposables=new N;this.multipleSelectionDisposables=new N;this.multipleSelectionSupport=t.multipleSelectionSupport,this.disposables.add(this.onKeyDown(o=>{switch(o.keyCode){case 3:return this.onEnter(o);case 16:return this.onUpArrow(o);case 18:return this.onDownArrow(o);case 11:return this.onPageUpArrow(o);case 12:return this.onPageDownArrow(o);case 9:return this.onEscape(o);case 31:this.multipleSelectionSupport&&(Ze?o.metaKey:o.ctrlKey)&&this.onCtrlA(o)}}))}get onKeyDown(){return U.chain(this.disposables.add(new Gn(this.view.domNode,"keydown")).event,i=>i.filter(e=>!Kh(e.target)).map(e=>new gi(e)))}updateOptions(i){i.multipleSelectionSupport!==void 0&&(this.multipleSelectionSupport=i.multipleSelectionSupport)}onEnter(i){i.preventDefault(),i.stopPropagation(),this.list.setSelection(this.list.getFocus(),i.browserEvent)}onUpArrow(i){i.preventDefault(),i.stopPropagation(),this.list.focusPrevious(1,!1,i.browserEvent);let e=this.list.getFocus()[0];this.list.setAnchor(e),this.list.reveal(e),this.view.domNode.focus()}onDownArrow(i){i.preventDefault(),i.stopPropagation(),this.list.focusNext(1,!1,i.browserEvent);let e=this.list.getFocus()[0];this.list.setAnchor(e),this.list.reveal(e),this.view.domNode.focus()}onPageUpArrow(i){i.preventDefault(),i.stopPropagation(),this.list.focusPreviousPage(i.browserEvent);let e=this.list.getFocus()[0];this.list.setAnchor(e),this.list.reveal(e),this.view.domNode.focus()}onPageDownArrow(i){i.preventDefault(),i.stopPropagation(),this.list.focusNextPage(i.browserEvent);let e=this.list.getFocus()[0];this.list.setAnchor(e),this.list.reveal(e),this.view.domNode.focus()}onCtrlA(i){i.preventDefault(),i.stopPropagation();let e=Ig(this.list.length),t=this.list.getFocus(),o=t.length>0?this.list.getElementGroupId(t[0]):void 0;o!==void 0&&(e=this.list.filterIndicesByGroup(e,o)),this.list.setSelection(e,i.browserEvent),this.list.setAnchor(void 0),this.view.domNode.focus()}onEscape(i){this.list.getSelection().length&&(i.preventDefault(),i.stopPropagation(),this.list.setSelection([],i.browserEvent),this.list.setAnchor(void 0),this.view.domNode.focus())}dispose(){this.disposables.dispose(),this.multipleSelectionDisposables.dispose()}};I([hi],Lyt.prototype,"onKeyDown",1);var $ni=new class{mightProducePrintableCharacter(a){return a.ctrlKey||a.metaKey||a.altKey?!1:a.keyCode>=31&&a.keyCode<=56||a.keyCode>=21&&a.keyCode<=30||a.keyCode>=98&&a.keyCode<=107||a.keyCode>=85&&a.keyCode<=95}},Bni=class{constructor(i,e,t,o,n){this.list=i;this.view=e;this.keyboardNavigationLabelProvider=t;this.keyboardNavigationEventFilter=o;this.delegate=n;this.enabled=!1;this.state=0;this.mode=0;this.triggered=!1;this.previouslyFocused=-1;this.enabledDisposables=new N;this.disposables=new N;this.updateOptions(i.options)}updateOptions(i){i.typeNavigationEnabled??!0?this.enable():this.disable(),this.mode=i.typeNavigationMode??0}trigger(){this.triggered=!this.triggered}enable(){if(this.enabled)return;let i=!1,e=U.chain(this.enabledDisposables.add(new Gn(this.view.domNode,"keydown")).event,n=>n.filter(r=>!Kh(r.target)).filter(()=>this.mode===0||this.triggered).map(r=>new gi(r)).filter(r=>i||this.keyboardNavigationEventFilter(r)).filter(r=>this.delegate.mightProducePrintableCharacter(r)).forEach(r=>Xt.stop(r,!0)).map(r=>r.browserEvent.key)),t=U.debounce(e,()=>null,800,void 0,void 0,void 0,this.enabledDisposables);U.reduce(U.any(e,t),(n,r)=>r===null?null:(n||"")+r,void 0,this.enabledDisposables)(this.onInput,this,this.enabledDisposables),t(this.onClear,this,this.enabledDisposables),e(()=>i=!0,void 0,this.enabledDisposables),t(()=>i=!1,void 0,this.enabledDisposables),this.enabled=!0,this.triggered=!1}disable(){this.enabled&&(this.enabledDisposables.clear(),this.enabled=!1,this.triggered=!1)}onClear(){let i=this.list.getFocus();if(i.length>0&&i[0]===this.previouslyFocused){let e=this.list.options.accessibilityProvider?.getAriaLabel(this.list.element(i[0]));typeof e=="string"?en(e):e&&en(e.get())}this.previouslyFocused=-1}onInput(i){if(!i){this.state=0,this.triggered=!1;return}let e=this.list.getFocus(),t=e.length>0?e[0]:0,o=this.state===0?1:0;this.state=1;for(let n=0;n<this.list.length;n++){let r=(t+n+o)%this.list.length,s=this.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(this.view.element(r)),l=s&&s.toString();if(this.list.options.typeNavigationEnabled){if(typeof l<"u"){if(Ble(i,l)){this.previouslyFocused=t,this.list.setFocus([r]),this.list.reveal(r);return}let c=bCe(i,l);if(c&&c[0].end-c[0].start>1&&c.length===1){this.previouslyFocused=t,this.list.setFocus([r]),this.list.reveal(r);return}}}else if(typeof l>"u"||Ble(i,l)){this.previouslyFocused=t,this.list.setFocus([r]),this.list.reveal(r);return}}}dispose(){this.disable(),this.enabledDisposables.dispose(),this.disposables.dispose()}},Hni=class{constructor(i,e){this.list=i;this.view=e;this.disposables=new N;let t=U.chain(this.disposables.add(new Gn(e.domNode,"keydown")).event,n=>n.filter(r=>!Kh(r.target)).map(r=>new gi(r)));U.chain(t,n=>n.filter(r=>r.keyCode===2&&!r.ctrlKey&&!r.metaKey&&!r.shiftKey&&!r.altKey))(this.onTab,this,this.disposables)}onTab(i){if(i.target!==this.view.domNode)return;let e=this.list.getFocus();if(e.length===0)return;let t=this.view.domElement(e[0]);if(!t)return;let o=t.querySelector("[tabIndex]");if(!o||!Do(o)||o.tabIndex===-1)return;let n=Re(o).getComputedStyle(o);n.visibility==="hidden"||n.display==="none"||(i.preventDefault(),i.stopPropagation(),o.focus())}dispose(){this.disposables.dispose()}};function jni(a){return Ze?a.browserEvent.metaKey:a.browserEvent.ctrlKey}function Qni(a){return a.browserEvent.shiftKey}function cHo(a){return Ru(a)&&a.button===2}var fQi={isSelectionSingleChangeEvent:jni,isSelectionRangeChangeEvent:Qni},zle=class{constructor(i){this.list=i;this.disposables=new N;this._onPointer=this.disposables.add(new E);i.options.multipleSelectionSupport!==!1&&(this.multipleSelectionController=this.list.options.multipleSelectionController||fQi),this.mouseSupport=typeof i.options.mouseSupport>"u"||!!i.options.mouseSupport,this.mouseSupport&&(i.onMouseDown(this.onMouseDown,this,this.disposables),i.onContextMenu(this.onContextMenu,this,this.disposables),i.onMouseDblClick(this.onDoubleClick,this,this.disposables),i.onTouchStart(this.onMouseDown,this,this.disposables),this.disposables.add(Ms.addTarget(i.getHTMLElement()))),U.any(i.onMouseClick,i.onMouseMiddleClick,i.onTap)(this.onViewPointer,this,this.disposables)}get onPointer(){return this._onPointer.event}updateOptions(i){i.multipleSelectionSupport!==void 0&&(this.multipleSelectionController=void 0,i.multipleSelectionSupport&&(this.multipleSelectionController=this.list.options.multipleSelectionController||fQi))}isSelectionSingleChangeEvent(i){return this.multipleSelectionController?this.multipleSelectionController.isSelectionSingleChangeEvent(i):!1}isSelectionRangeChangeEvent(i){return this.multipleSelectionController?this.multipleSelectionController.isSelectionRangeChangeEvent(i):!1}isSelectionChangeEvent(i){return this.isSelectionSingleChangeEvent(i)||this.isSelectionRangeChangeEvent(i)}onMouseDown(i){cY(i.browserEvent.target)||Nn()!==i.browserEvent.target&&this.list.domFocus()}onContextMenu(i){if(Kh(i.browserEvent.target)||cY(i.browserEvent.target))return;let e=typeof i.index>"u"?[]:[i.index];this.list.setFocus(e,i.browserEvent)}onViewPointer(i){if(!this.mouseSupport||Kh(i.browserEvent.target)||cY(i.browserEvent.target)||i.browserEvent.isHandledByList)return;i.browserEvent.isHandledByList=!0;let e=i.index;if(typeof e>"u"){this.list.setFocus([],i.browserEvent),this.list.setSelection([],i.browserEvent),this.list.setAnchor(void 0);return}if(this.isSelectionChangeEvent(i))return this.changeSelection(i);this.list.setFocus([e],i.browserEvent),this.list.setAnchor(e),cHo(i.browserEvent)||this.list.getElementGroupId(e)!==Hle&&this.list.setSelection([e],i.browserEvent),this._onPointer.fire(i)}onDoubleClick(i){if(Kh(i.browserEvent.target)||cY(i.browserEvent.target)||this.isSelectionChangeEvent(i)||i.browserEvent.isHandledByList)return;i.browserEvent.isHandledByList=!0;let e=this.list.getFocus();this.list.setSelection(e,i.browserEvent)}changeSelection(i){let e=i.index,t=this.list.getAnchor();if(this.isSelectionRangeChangeEvent(i)){typeof t>"u"&&(t=this.list.getFocus()[0]??e,this.list.setAnchor(t));let o=Math.min(t,e),n=Math.max(t,e),r=Ig(o,n+1),s=this.list.getSelection()[0];if(s!==void 0){let p=this.list.getElementGroupId(s);p!==void 0&&(r=this.list.filterIndicesByGroup(r,p))}let l=this.list.getSelection(),c=uHo(Uni(l,[t]),t);if(c.length===0)return;let u=Uni(r,pHo(l,c));this.list.setSelection(u,i.browserEvent),this.list.setFocus([e],i.browserEvent)}else if(this.isSelectionSingleChangeEvent(i)){let o=this.list.getSelection(),n=o.filter(s=>s!==e);this.list.setFocus([e]),this.list.setAnchor(e);let r=this.list.getElementGroupId(e);if(r===Hle)return;if(o.length===n.length){let s=r!==void 0?this.list.filterIndicesByGroup([...n,e],r):[...n,e];this.list.setSelection(s,i.browserEvent)}else this.list.setSelection(n,i.browserEvent)}}dispose(){this.disposables.dispose()}},Kle=class{constructor(i,e){this.styleElement=i;this.selectorSuffix=e}style(i){let e=this.selectorSuffix&&`.${this.selectorSuffix}`,t=[];i.listBackground&&t.push(`.monaco-list${e} .monaco-list-rows { background: ${i.listBackground}; }`),i.listFocusBackground&&(t.push(`.monaco-list${e}:focus .monaco-list-row.focused { background-color: ${i.listFocusBackground}; }`),t.push(`.monaco-list${e}:focus .monaco-list-row.focused:hover { background-color: ${i.listFocusBackground}; }`)),i.listFocusForeground&&t.push(`.monaco-list${e}:focus .monaco-list-row.focused { color: ${i.listFocusForeground}; }`),i.listActiveSelectionBackground&&(t.push(`.monaco-list${e}:focus .monaco-list-row.selected { background-color: ${i.listActiveSelectionBackground}; }`),t.push(`.monaco-list${e}:focus .monaco-list-row.selected:hover { background-color: ${i.listActiveSelectionBackground}; }`)),i.listActiveSelectionForeground&&t.push(`.monaco-list${e}:focus .monaco-list-row.selected { color: ${i.listActiveSelectionForeground}; }`),i.listActiveSelectionIconForeground&&t.push(`.monaco-list${e}:focus .monaco-list-row.selected .codicon { color: ${i.listActiveSelectionIconForeground}; }`),i.listFocusAndSelectionBackground&&t.push(`
				.monaco-drag-image${e},
				.monaco-list${e}:focus .monaco-list-row.selected.focused { background-color: ${i.listFocusAndSelectionBackground}; }
			`),i.listFocusAndSelectionForeground&&t.push(`
				.monaco-drag-image${e},
				.monaco-list${e}:focus .monaco-list-row.selected.focused { color: ${i.listFocusAndSelectionForeground}; }
			`),i.listInactiveFocusForeground&&(t.push(`.monaco-list${e} .monaco-list-row.focused { color:  ${i.listInactiveFocusForeground}; }`),t.push(`.monaco-list${e} .monaco-list-row.focused:hover { color:  ${i.listInactiveFocusForeground}; }`)),i.listInactiveSelectionIconForeground&&t.push(`.monaco-list${e} .monaco-list-row.focused .codicon { color:  ${i.listInactiveSelectionIconForeground}; }`),i.listInactiveFocusBackground&&(t.push(`.monaco-list${e} .monaco-list-row.focused { background-color:  ${i.listInactiveFocusBackground}; }`),t.push(`.monaco-list${e} .monaco-list-row.focused:hover { background-color:  ${i.listInactiveFocusBackground}; }`)),i.listInactiveSelectionBackground&&(t.push(`.monaco-list${e} .monaco-list-row.selected { background-color:  ${i.listInactiveSelectionBackground}; }`),t.push(`.monaco-list${e} .monaco-list-row.selected:hover { background-color:  ${i.listInactiveSelectionBackground}; }`)),i.listInactiveSelectionForeground&&t.push(`.monaco-list${e} .monaco-list-row.selected { color: ${i.listInactiveSelectionForeground}; }`),i.listHoverBackground&&t.push(`.monaco-list${e}:not(.drop-target):not(.dragging) .monaco-list-row:hover:not(.selected):not(.focused) { background-color: ${i.listHoverBackground}; }`),i.listHoverForeground&&t.push(`.monaco-list${e}:not(.drop-target):not(.dragging) .monaco-list-row:hover:not(.selected):not(.focused) { color:  ${i.listHoverForeground}; }`);let o=O_(i.listFocusAndSelectionOutline,O_(i.listSelectionOutline,i.listFocusOutline??""));o&&t.push(`.monaco-list${e}:focus .monaco-list-row.focused.selected { outline: 1px solid ${o}; outline-offset: -1px;}`),i.listFocusOutline&&t.push(`
				.monaco-drag-image${e},
				.monaco-list${e}:focus .monaco-list-row.focused,
				.context-menu-visible .monaco-list${e}.last-focused .monaco-list-row.focused { outline: 1px solid ${i.listFocusOutline}; outline-offset: -1px; }
			`);let n=O_(i.listSelectionOutline,i.listInactiveFocusOutline??"");n&&t.push(`.monaco-list${e} .monaco-list-row.focused.selected { outline: 1px dotted ${n}; outline-offset: -1px; }`),i.listSelectionOutline&&t.push(`.monaco-list${e} .monaco-list-row.selected { outline: 1px dotted ${i.listSelectionOutline}; outline-offset: -1px; }`),i.listInactiveFocusOutline&&t.push(`.monaco-list${e} .monaco-list-row.focused { outline: 1px dotted ${i.listInactiveFocusOutline}; outline-offset: -1px; }`),i.listHoverOutline&&t.push(`.monaco-list${e} .monaco-list-row:hover { outline: 1px dashed ${i.listHoverOutline}; outline-offset: -1px; }`),i.listDropOverBackground&&t.push(`
				.monaco-list${e}.drop-target,
				.monaco-list${e} .monaco-list-rows.drop-target,
				.monaco-list${e} .monaco-list-row.drop-target { background-color: ${i.listDropOverBackground} !important; color: inherit !important; }
			`),i.listDropBetweenBackground&&(t.push(`
			.monaco-list${e} .monaco-list-rows.drop-target-before .monaco-list-row:first-child::before,
			.monaco-list${e} .monaco-list-row.drop-target-before::before {
				content: ""; position: absolute; top: 0px; left: 0px; width: 100%; height: 1px;
				background-color: ${i.listDropBetweenBackground};
			}`),t.push(`
			.monaco-list${e} .monaco-list-rows.drop-target-after .monaco-list-row:last-child::after,
			.monaco-list${e} .monaco-list-row.drop-target-after::after {
				content: ""; position: absolute; bottom: 0px; left: 0px; width: 100%; height: 1px;
				background-color: ${i.listDropBetweenBackground};
			}`)),i.tableColumnsBorder&&t.push(`
				.monaco-table > .monaco-split-view2,
				.monaco-table > .monaco-split-view2 .monaco-sash.vertical::before,
				.monaco-enable-motion .monaco-table:hover > .monaco-split-view2,
				.monaco-enable-motion .monaco-table:hover > .monaco-split-view2 .monaco-sash.vertical::before {
					border-color: ${i.tableColumnsBorder};
				}

				.monaco-enable-motion .monaco-table > .monaco-split-view2,
				.monaco-enable-motion .monaco-table > .monaco-split-view2 .monaco-sash.vertical::before {
					border-color: transparent;
				}
			`),i.tableOddRowsBackgroundColor&&t.push(`
				.monaco-table .monaco-list-row[data-parity=odd]:not(.focused):not(.selected):not(:hover) .monaco-table-tr,
				.monaco-table .monaco-list:not(:focus) .monaco-list-row[data-parity=odd].focused:not(.selected):not(:hover) .monaco-table-tr,
				.monaco-table .monaco-list:not(.focused) .monaco-list-row[data-parity=odd].focused:not(.selected):not(:hover) .monaco-table-tr {
					background-color: ${i.tableOddRowsBackgroundColor};
				}
			`),this.styleElement.textContent=t.join(`
`)}},Ryt={listFocusBackground:"#7FB0D0",listActiveSelectionBackground:"#0E639C",listActiveSelectionForeground:"#FFFFFF",listActiveSelectionIconForeground:"#FFFFFF",listFocusAndSelectionOutline:"#90C2F9",listFocusAndSelectionBackground:"#094771",listFocusAndSelectionForeground:"#FFFFFF",listInactiveSelectionBackground:"#3F3F46",listInactiveSelectionIconForeground:"#FFFFFF",listHoverBackground:"#2A2D2E",listDropOverBackground:"#383B3D",listDropBetweenBackground:"#EEEEEE",treeIndentGuidesStroke:"#a9a9a9",treeInactiveIndentGuidesStroke:We.fromHex("#a9a9a9").transparent(.4).toString(),tableColumnsBorder:We.fromHex("#cccccc").transparent(.2).toString(),tableOddRowsBackgroundColor:We.fromHex("#cccccc").transparent(.04).toString(),listBackground:void 0,listFocusForeground:void 0,listInactiveSelectionForeground:void 0,listInactiveFocusForeground:void 0,listInactiveFocusBackground:void 0,listHoverForeground:void 0,listFocusOutline:void 0,listInactiveFocusOutline:void 0,listSelectionOutline:void 0,listHoverOutline:void 0,treeStickyScrollBackground:void 0,treeStickyScrollBorder:void 0,treeStickyScrollShadow:void 0},dHo={keyboardSupport:!0,mouseSupport:!0,multipleSelectionSupport:!0,dnd:{getDragURI(){return null},onDragStart(){},onDragOver(){return!1},drop(){},dispose(){}}};function uHo(a,i){let e=a.indexOf(i);if(e===-1)return[];let t=[],o=e-1;for(;o>=0&&a[o]===i-(e-o);)t.push(a[o--]);for(t.reverse(),o=e;o<a.length&&a[o]===i+(o-e);)t.push(a[o++]);return t}function Uni(a,i){let e=[],t=0,o=0;for(;t<a.length||o<i.length;)if(t>=a.length)e.push(i[o++]);else if(o>=i.length)e.push(a[t++]);else if(a[t]===i[o]){e.push(a[t]),t++,o++;continue}else a[t]<i[o]?e.push(a[t++]):e.push(i[o++]);return e}function pHo(a,i){let e=[],t=0,o=0;for(;t<a.length||o<i.length;)if(t>=a.length)e.push(i[o++]);else if(o>=i.length)e.push(a[t++]);else if(a[t]===i[o]){t++,o++;continue}else a[t]<i[o]?e.push(a[t++]):o++;return e}var vQi=(a,i)=>a-i,zni=class{constructor(i,e){this._templateId=i;this.renderers=e}get templateId(){return this._templateId}renderTemplate(i){return this.renderers.map(e=>e.renderTemplate(i))}renderElement(i,e,t,o){let n=0;for(let r of this.renderers)r.renderElement(i,e,t[n++],o)}disposeElement(i,e,t,o){let n=0;for(let r of this.renderers)r.disposeElement?.(i,e,t[n],o),n+=1}disposeTemplate(i){let e=0;for(let t of this.renderers)t.disposeTemplate(i[e++])}},Kni=class{constructor(i){this.accessibilityProvider=i;this.templateId="a18n"}renderTemplate(i){return{container:i,disposables:new N}}renderElement(i,e,t){let o=this.accessibilityProvider.getAriaLabel(i),n=o&&typeof o!="string"?o:So(o);t.disposables.add(be(s=>{this.setAriaLabel(s.readObservable(n),t.container)}));let r=this.accessibilityProvider.getAriaLevel&&this.accessibilityProvider.getAriaLevel(i);typeof r=="number"?t.container.setAttribute("aria-level",`${r}`):t.container.removeAttribute("aria-level")}setAriaLabel(i,e){i?e.setAttribute("aria-label",i):e.removeAttribute("aria-label")}disposeElement(i,e,t){t.disposables.clear()}disposeTemplate(i){i.disposables.dispose()}},Gni=class{constructor(i,e){this.list=i;this.dnd=e}getDragElements(i){let e=this.list.getSelectedElements();return e.indexOf(i)>-1?e:[i]}getDragURI(i){return this.dnd.getDragURI(i)}getDragLabel(i,e){if(this.dnd.getDragLabel)return this.dnd.getDragLabel(i,e)}onDragStart(i,e){this.dnd.onDragStart?.(i,e)}onDragOver(i,e,t,o,n){return this.dnd.onDragOver(i,e,t,o,n)}onDragLeave(i,e,t,o){this.dnd.onDragLeave?.(i,e,t,o)}onDragEnd(i){this.dnd.onDragEnd?.(i)}drop(i,e,t,o,n){this.dnd.drop(i,e,t,o,n)}dispose(){this.dnd.dispose()}},Cc=class{constructor(i,e,t,o,n=dHo){this.user=i;this._options=n;this.focus=new yCe("focused");this.anchor=new yCe("anchor");this.eventBufferer=new QN;this._ariaLabel="";this.disposables=new N;this._onDidDispose=new E;this.onDidDispose=this._onDidDispose.event;let r=this._options.accessibilityProvider&&this._options.accessibilityProvider.getWidgetRole?this._options.accessibilityProvider?.getWidgetRole():"list";this.selection=new Vni(r!=="listbox");let s=[this.focus.renderer,this.selection.renderer];this.accessibilityProvider=n.accessibilityProvider,this.accessibilityProvider&&(s.push(new Kni(this.accessibilityProvider)),this.accessibilityProvider.onDidChangeActiveDescendant?.(this.onDidChangeActiveDescendant,this,this.disposables)),o=o.map(c=>new zni(c.templateId,[...s,c]));let l={...n,dnd:n.dnd&&new Gni(this,n.dnd)};if(this.view=this.createListView(e,t,o,l),this.view.domNode.setAttribute("role",r),n.styleController)this.styleController=n.styleController(this.view.domId);else{let c=Cr(this.view.domNode);this.styleController=new Kle(c,this.view.domId)}if(this.spliceable=new wyt([new t4e(this.focus,this.view,n.identityProvider),new t4e(this.selection,this.view,n.identityProvider),new t4e(this.anchor,this.view,n.identityProvider),this.view]),this.disposables.add(this.focus),this.disposables.add(this.selection),this.disposables.add(this.anchor),this.disposables.add(this.view),this.disposables.add(this._onDidDispose),this.disposables.add(new Hni(this,this.view)),(typeof n.keyboardSupport!="boolean"||n.keyboardSupport)&&(this.keyboardController=new Lyt(this,this.view,n),this.disposables.add(this.keyboardController)),n.keyboardNavigationLabelProvider){let c=n.keyboardNavigationDelegate||$ni;this.typeNavigationController=new Bni(this,this.view,n.keyboardNavigationLabelProvider,n.keyboardNavigationEventFilter??(()=>!0),c),this.disposables.add(this.typeNavigationController)}if(this.mouseController=this.createMouseController(n),this.disposables.add(this.mouseController),this.onDidChangeFocus(this._onFocusChange,this,this.disposables),this.onDidChangeSelection(this._onSelectionChange,this,this.disposables),this.accessibilityProvider){let c=this.accessibilityProvider.getWidgetAriaLabel(),u=c&&typeof c!="string"?c:So(c);this.disposables.add(be(p=>{this.ariaLabel=p.readObservable(u)}))}this._options.multipleSelectionSupport!==!1&&this.view.domNode.setAttribute("aria-multiselectable","true")}get onDidChangeFocus(){return U.map(this.eventBufferer.wrapEvent(this.focus.onChange),i=>this.toListEvent(i),this.disposables)}get onDidChangeSelection(){return U.map(this.eventBufferer.wrapEvent(this.selection.onChange),i=>this.toListEvent(i),this.disposables)}get domId(){return this.view.domId}get onDidScroll(){return this.view.onDidScroll}get onMouseClick(){return this.view.onMouseClick}get onMouseDblClick(){return this.view.onMouseDblClick}get onMouseMiddleClick(){return this.view.onMouseMiddleClick}get onPointer(){return this.mouseController.onPointer}get onMouseUp(){return this.view.onMouseUp}get onMouseDown(){return this.view.onMouseDown}get onMouseOver(){return this.view.onMouseOver}get onMouseMove(){return this.view.onMouseMove}get onMouseOut(){return this.view.onMouseOut}get onTouchStart(){return this.view.onTouchStart}get onTap(){return this.view.onTap}get onContextMenu(){let i=!1,e=U.chain(this.disposables.add(new Gn(this.view.domNode,"keydown")).event,n=>n.map(r=>new gi(r)).filter(r=>i=r.keyCode===58||r.shiftKey&&r.keyCode===68).map(r=>Xt.stop(r,!0)).filter(()=>!1)),t=U.chain(this.disposables.add(new Gn(this.view.domNode,"keyup")).event,n=>n.forEach(()=>i=!1).map(r=>new gi(r)).filter(r=>r.keyCode===58||r.shiftKey&&r.keyCode===68).map(r=>Xt.stop(r,!0)).map(({browserEvent:r})=>{let s=this.getFocus(),l=s.length?s[0]:void 0,c=typeof l<"u"?this.view.element(l):void 0,u=typeof l<"u"?this.view.domElement(l):this.view.domNode;return{index:l,element:c,anchor:u,browserEvent:r}})),o=U.chain(this.view.onContextMenu,n=>n.filter(r=>!i).map(({element:r,index:s,browserEvent:l})=>({element:r,index:s,anchor:new Cn(Re(this.view.domNode),l),browserEvent:l})));return U.any(e,t,o)}get onKeyDown(){return this.disposables.add(new Gn(this.view.domNode,"keydown")).event}get onKeyUp(){return this.disposables.add(new Gn(this.view.domNode,"keyup")).event}get onKeyPress(){return this.disposables.add(new Gn(this.view.domNode,"keypress")).event}get onDidFocus(){return U.signal(this.disposables.add(new Gn(this.view.domNode,"focus",!0)).event)}get onDidBlur(){return U.signal(this.disposables.add(new Gn(this.view.domNode,"blur",!0)).event)}createListView(i,e,t,o){return new ICe(i,e,t,o)}createMouseController(i){return new zle(this)}updateOptions(i={}){this._options={...this._options,...i},this.typeNavigationController?.updateOptions(this._options),this._options.multipleSelectionController!==void 0&&(this._options.multipleSelectionSupport?this.view.domNode.setAttribute("aria-multiselectable","true"):this.view.domNode.removeAttribute("aria-multiselectable")),this.mouseController.updateOptions(i),this.keyboardController?.updateOptions(i),this.view.updateOptions(i)}get options(){return this._options}splice(i,e,t=[]){if(i<0||i>this.view.length)throw new sR(this.user,`Invalid start index: ${i}`);if(e<0)throw new sR(this.user,`Invalid delete count: ${e}`);e===0&&t.length===0||this.eventBufferer.bufferEvents(()=>this.spliceable.splice(i,e,t))}updateWidth(i){this.view.updateWidth(i)}updateElementHeight(i,e){this.view.updateElementHeight(i,e,null)}rerender(){this.view.rerender()}element(i){return this.view.element(i)}indexOf(i){return this.view.indexOf(i)}indexAt(i){return this.view.indexAt(i)}get length(){return this.view.length}get contentHeight(){return this.view.contentHeight}get contentWidth(){return this.view.contentWidth}get onDidChangeContentHeight(){return this.view.onDidChangeContentHeight}get onDidChangeContentWidth(){return this.view.onDidChangeContentWidth}get scrollTop(){return this.view.getScrollTop()}set scrollTop(i){this.view.setScrollTop(i)}get scrollLeft(){return this.view.getScrollLeft()}set scrollLeft(i){this.view.setScrollLeft(i)}get scrollHeight(){return this.view.scrollHeight}get renderHeight(){return this.view.renderHeight}get firstVisibleIndex(){return this.view.firstVisibleIndex}get firstMostlyVisibleIndex(){return this.view.firstMostlyVisibleIndex}get lastVisibleIndex(){return this.view.lastVisibleIndex}get ariaLabel(){return this._ariaLabel}set ariaLabel(i){this._ariaLabel=i,this.view.domNode.setAttribute("aria-label",i)}domFocus(){this.view.domNode.focus({preventScroll:!0})}layout(i,e){this.view.layout(i,e)}triggerTypeNavigation(){this.typeNavigationController?.trigger()}setSelection(i,e){for(let t of i)if(t<0||t>=this.length)throw new sR(this.user,`Invalid index ${t}`);i=i.filter(t=>this.getElementGroupId(t)!==Hle),this.selection.set(i,e)}getSelection(){return this.selection.get()}getSelectedElements(){return this.getSelection().map(i=>this.view.element(i))}setAnchor(i){if(typeof i>"u"){this.anchor.set([]);return}if(i<0||i>=this.length)throw new sR(this.user,`Invalid index ${i}`);this.anchor.set([i])}getAnchor(){return this.anchor.get().at(0)}getAnchorElement(){let i=this.getAnchor();return typeof i>"u"?void 0:this.element(i)}getElementGroupId(i){let e=this.options.identityProvider;if(!e?.getGroupId)return;let t=this.element(i);return e.getGroupId(t)}filterIndicesByGroup(i,e){let t=this.options.identityProvider;return t?.getGroupId?e===Hle?[]:i.filter(o=>{let n=this.element(o);return t.getGroupId(n)===e}):i}setFocus(i,e){for(let t of i)if(t<0||t>=this.length)throw new sR(this.user,`Invalid index ${t}`);this.focus.set(i,e)}focusNext(i=1,e=!1,t,o){if(this.length===0)return;let n=this.focus.get(),r=this.findNextIndex(n.length>0?n[0]+i:0,e,o);r>-1&&this.setFocus([r],t)}focusPrevious(i=1,e=!1,t,o){if(this.length===0)return;let n=this.focus.get(),r=this.findPreviousIndex(n.length>0?n[0]-i:0,e,o);r>-1&&this.setFocus([r],t)}async focusNextPage(i,e){let t=this.view.indexAt(this.view.getScrollTop()+this.view.renderHeight);t=t===0?0:t-1;let o=this.getFocus()[0];if(o!==t&&(o===void 0||t>o)){let n=this.findPreviousIndex(t,!1,e);n>-1&&o!==n?this.setFocus([n],i):this.setFocus([t],i)}else{let n=this.view.getScrollTop(),r=n+this.view.renderHeight;t>o&&(r-=this.view.elementHeight(t)),this.view.setScrollTop(r),this.view.getScrollTop()!==n&&(this.setFocus([]),await Li(0),await this.focusNextPage(i,e))}}async focusPreviousPage(i,e,t=()=>0){let o,n=t(),r=this.view.getScrollTop()+n;r===0?o=this.view.indexAt(r):o=this.view.indexAfter(r-1);let s=this.getFocus()[0];if(s!==o&&(s===void 0||s>=o)){let l=this.findNextIndex(o,!1,e);l>-1&&s!==l?this.setFocus([l],i):this.setFocus([o],i)}else{let l=r;this.view.setScrollTop(r-this.view.renderHeight-n),this.view.getScrollTop()+t()!==l&&(this.setFocus([]),await Li(0),await this.focusPreviousPage(i,e,t))}}focusLast(i,e){if(this.length===0)return;let t=this.findPreviousIndex(this.length-1,!1,e);t>-1&&this.setFocus([t],i)}focusFirst(i,e){this.focusNth(0,i,e)}focusNth(i,e,t){if(this.length===0)return;let o=this.findNextIndex(i,!1,t);o>-1&&this.setFocus([o],e)}findNextIndex(i,e=!1,t){for(let o=0;o<this.length;o++){if(i>=this.length&&!e)return-1;if(i=i%this.length,!t||t(this.element(i)))return i;i++}return-1}findPreviousIndex(i,e=!1,t){for(let o=0;o<this.length;o++){if(i<0&&!e)return-1;if(i=(this.length+i%this.length)%this.length,!t||t(this.element(i)))return i;i--}return-1}getFocus(){return this.focus.get()}getFocusedElements(){return this.getFocus().map(i=>this.view.element(i))}reveal(i,e,t=0){if(i<0||i>=this.length)throw new sR(this.user,`Invalid index ${i}`);let o=this.view.getScrollTop(),n=this.view.elementTop(i),r=this.view.elementHeight(i);if(Yo(e)){let s=r-this.view.renderHeight+t;this.view.setScrollTop(s*Bn(e,0,1)+n-t)}else{let s=n+r,l=o+this.view.renderHeight;n<o+t&&s>=l||(n<o+t||s>=l&&r>=this.view.renderHeight?this.view.setScrollTop(n-t):s>=l&&this.view.setScrollTop(s-this.view.renderHeight))}}getRelativeTop(i,e=0){if(i<0||i>=this.length)throw new sR(this.user,`Invalid index ${i}`);let t=this.view.getScrollTop(),o=this.view.elementTop(i),n=this.view.elementHeight(i);if(o<t+e||o+n>t+this.view.renderHeight)return null;let r=n-this.view.renderHeight+e;return Math.abs((t+e-o)/r)}isDOMFocused(){return wa(this.view.domNode)}getHTMLElement(){return this.view.domNode}getScrollableElement(){return this.view.scrollableElementDomNode}getElementID(i){return this.view.getElementDomId(i)}getElementTop(i){return this.view.elementTop(i)}style(i){this.styleController.style(i)}delegateScrollFromMouseWheelEvent(i){this.view.delegateScrollFromMouseWheelEvent(i)}toListEvent({indexes:i,browserEvent:e}){return{indexes:i,elements:i.map(t=>this.view.element(t)),browserEvent:e}}_onFocusChange(){let i=this.focus.get();this.view.domNode.classList.toggle("element-focused",i.length>0),this.onDidChangeActiveDescendant()}onDidChangeActiveDescendant(){let i=this.focus.get();if(i.length>0){let e;this.accessibilityProvider?.getActiveDescendantId&&(e=this.accessibilityProvider.getActiveDescendantId(this.view.element(i[0]))),this.view.domNode.setAttribute("aria-activedescendant",e||this.view.getElementDomId(i[0]))}else this.view.domNode.removeAttribute("aria-activedescendant")}_onSelectionChange(){let i=this.selection.get();this.view.domNode.classList.toggle("selection-none",i.length===0),this.view.domNode.classList.toggle("selection-single",i.length===1),this.view.domNode.classList.toggle("selection-multiple",i.length>1)}dispose(){this._onDidDispose.fire(),this.disposables.dispose(),this._onDidDispose.dispose()}};I([hi],Cc.prototype,"onDidChangeFocus",1),I([hi],Cc.prototype,"onDidChangeSelection",1),I([hi],Cc.prototype,"onContextMenu",1),I([hi],Cc.prototype,"onKeyDown",1),I([hi],Cc.prototype,"onKeyUp",1),I([hi],Cc.prototype,"onKeyPress",1),I([hi],Cc.prototype,"onDidFocus",1),I([hi],Cc.prototype,"onDidBlur",1);var mHo="$(",Xni=new RegExp(`\\$\\(${q.iconNameExpression}(?:${q.iconModifierExpression})?\\)`,"g"),hHo=new RegExp(`(\\\\)?${Xni.source}`,"g");function IQi(a){return a.replace(hHo,(i,e)=>e?i:`\\${i}`)}var gHo=new RegExp(`\\\\${Xni.source}`,"g");function yQi(a){return a.replace(gHo,i=>`\\${i}`)}var fHo=new RegExp(`(\\s)?(\\\\)?${Xni.source}(\\s)?`,"g");function Nu(a){return a.indexOf(mHo)===-1?a:a.replace(fHo,(i,e,t,o)=>t?i:e||o||"")}function xz(a){return a?a.replace(/\$\((.*?)\)/g,(i,e)=>` ${e} `).trim():""}var Yni=new RegExp(`\\$\\(${q.iconNameCharacter}+\\)`,"g");function HV(a){Yni.lastIndex=0;let i="",e=[],t=0;for(;;){let o=Yni.lastIndex,n=Yni.exec(a),r=a.substring(o,n?.index);if(r.length>0){i+=r;for(let s=0;s<r.length;s++)e.push(t)}if(!n)break;t+=n[0].length}return{text:i,iconOffsets:e}}function Hj(a,i,e=!1){let{text:t,iconOffsets:o}=i;if(!o||o.length===0)return lm(a,t,e);let n=fC(t," "),r=t.length-n.length,s=lm(a,n,e);if(s)for(let l of s){let c=o[l.start+r]+r;l.start+=c,l.end+=c}return s}var Ie=class a{static lift(i){let e=new a(i.value,i);return e.uris=i.uris,e.baseUri=i.baseUri?A.revive(i.baseUri):void 0,e}constructor(i="",e=!1){if(this.value=i,typeof this.value!="string")throw Yr("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(i,e=0){return this.value+=PP(this.supportThemeIcons?IQi(i):i).replace(/([ \t]+)/g,(t,o)=>"&nbsp;".repeat(o.length)).replace(/\>/gm,"\\>").replace(/\n/g,e===1?`\\
`:`

`),this}appendMarkdown(i){return this.value+=i,this}appendCodeblock(i,e){return this.value+=`
${vHo(e,i)}
`,this}appendLink(i,e,t){return this.value+="[",this.value+=this._escape(e,"]"),this.value+="](",this.value+=this._escape(String(i),")"),t&&(this.value+=` "${this._escape(this._escape(t,'"'),")")}"`),this.value+=")",this}_escape(i,e){let t=new RegExp(ns(e),"g");return i.replace(t,(o,n)=>i.charAt(n-1)!=="\\"?`\\${o}`:o)}};function UV(a){return Ar(a)?!a.value:Array.isArray(a)?a.every(UV):!0}function Ar(a){return a instanceof Ie?!0:a&&typeof a=="object"?typeof a.value=="string"&&(typeof a.isTrusted=="boolean"||typeof a.isTrusted=="object"||a.isTrusted===void 0)&&(typeof a.supportThemeIcons=="boolean"||a.supportThemeIcons===void 0)&&(typeof a.supportAlertSyntax=="boolean"||a.supportAlertSyntax===void 0):!1}function Gle(a,i){return a===i?!0:!a||!i?!1:a.value===i.value&&a.isTrusted===i.isTrusted&&a.supportThemeIcons===i.supportThemeIcons&&a.supportHtml===i.supportHtml&&a.supportAlertSyntax===i.supportAlertSyntax&&(a.baseUri===i.baseUri||!!a.baseUri&&!!i.baseUri&&Qe(A.from(a.baseUri),A.from(i.baseUri)))}function PP(a){return a.replace(/[\\`*_{}[\]()#+\-!~]/g,"\\$&")}function vHo(a,i){let e=a.match(/^`+/gm)?.reduce((o,n)=>o.length>n.length?o:n).length??0,t=e>=3?e+1:3;return[`${"`".repeat(t)}${i}`,a,`${"`".repeat(t)}`].join(`
`)}function xCe(a){return a.replace(/"/g,"&quot;")}function Myt(a){return a&&a.replace(/\\([\\`*_{}[\]()#+\-.!~])/g,"$1")}function Pyt(a){let i=[],e=a.split("|").map(o=>o.trim());a=e[0];let t=e[1];if(t){let o=/height=(\d+)/.exec(t),n=/width=(\d+)/.exec(t),r=o?o[1]:"",s=n?n[1]:"",l=isFinite(parseInt(s)),c=isFinite(parseInt(r));l&&i.push(`width="${s}"`),c&&i.push(`height="${r}"`)}return{href:a,dimensions:i}}function Ayt(a,i,e,t=!0){return`[${t?PP(a):a}](${i}${e?` "${PP(e)}"`:""})`}function pw(a,i=!0){let e=fc(a.id,...a.arguments||[]).toString();return Ayt(a.text,e,a.tooltip,i)}function fc(a,...i){return A.from({scheme:Q.command,path:a,query:i.length?encodeURIComponent(JSON.stringify(i)):void 0})}var qle=class{constructor(i){this._prefix=i,this._lastId=0}nextId(){return this._prefix+ ++this._lastId}},Uj=new qle("id#");function Zni(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var jle=Zni();function TQi(a){jle=a}var _Qi=/[&<>"']/,SHo=new RegExp(_Qi.source,"g"),DQi=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,IHo=new RegExp(DQi.source,"g"),yHo={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},wQi=a=>yHo[a];function AP(a,i){if(i){if(_Qi.test(a))return a.replace(SHo,wQi)}else if(DQi.test(a))return a.replace(IHo,wQi);return a}var wHo=/(^|[^\[])\^/g;function Yh(a,i){let e=typeof a=="string"?a:a.source;i=i||"";let t={replace:(o,n)=>{let r=typeof n=="string"?n:n.source;return r=r.replace(wHo,"$1"),e=e.replace(o,r),t},getRegex:()=>new RegExp(e,i)};return t}function CQi(a){try{a=encodeURI(a).replace(/%25/g,"%")}catch{return null}return a}var r4e={exec:()=>null};function xQi(a,i){let e=a.replace(/\|/g,(n,r,s)=>{let l=!1,c=r;for(;--c>=0&&s[c]==="\\";)l=!l;return l?"|":" |"}),t=e.split(/ \|/),o=0;if(t[0].trim()||t.shift(),t.length>0&&!t[t.length-1].trim()&&t.pop(),i)if(t.length>i)t.splice(i);else for(;t.length<i;)t.push("");for(;o<t.length;o++)t[o]=t[o].trim().replace(/\\\|/g,"|");return t}function o4e(a,i,e){let t=a.length;if(t===0)return"";let o=0;for(;o<t;){let n=a.charAt(t-o-1);if(n===i&&!e)o++;else if(n!==i&&e)o++;else break}return a.slice(0,t-o)}function CHo(a,i){if(a.indexOf(i[1])===-1)return-1;let e=0;for(let t=0;t<a.length;t++)if(a[t]==="\\")t++;else if(a[t]===i[0])e++;else if(a[t]===i[1]&&(e--,e<0))return t;return-1}function kQi(a,i,e,t){let o=i.href,n=i.title?AP(i.title):null,r=a[1].replace(/\\([\[\]])/g,"$1");if(a[0].charAt(0)!=="!"){t.state.inLink=!0;let s={type:"link",raw:e,href:o,title:n,text:r,tokens:t.inlineTokens(r)};return t.state.inLink=!1,s}return{type:"image",raw:e,href:o,title:n,text:AP(r)}}function xHo(a,i){let e=a.match(/^(\s+)(?:```)/);if(e===null)return i;let t=e[1];return i.split(`
`).map(o=>{let n=o.match(/^\s+/);if(n===null)return o;let[r]=n;return r.length>=t.length?o.slice(t.length):o}).join(`
`)}var ECe=class{options;rules;lexer;constructor(i){this.options=i||jle}space(i){let e=this.rules.block.newline.exec(i);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(i){let e=this.rules.block.code.exec(i);if(e){let t=e[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:o4e(t,`
`)}}}fences(i){let e=this.rules.block.fences.exec(i);if(e){let t=e[0],o=xHo(t,e[3]||"");return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:o}}}heading(i){let e=this.rules.block.heading.exec(i);if(e){let t=e[2].trim();if(/#$/.test(t)){let o=o4e(t,"#");(this.options.pedantic||!o||/ $/.test(o))&&(t=o.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(i){let e=this.rules.block.hr.exec(i);if(e)return{type:"hr",raw:o4e(e[0],`
`)}}blockquote(i){let e=this.rules.block.blockquote.exec(i);if(e){let t=o4e(e[0],`
`).split(`
`),o="",n="",r=[];for(;t.length>0;){let s=!1,l=[],c;for(c=0;c<t.length;c++)if(/^ {0,3}>/.test(t[c]))l.push(t[c]),s=!0;else if(!s)l.push(t[c]);else break;t=t.slice(c);let u=l.join(`
`),p=u.replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,`
    $1`).replace(/^ {0,3}>[ \t]?/gm,"");o=o?`${o}
${u}`:u,n=n?`${n}
${p}`:p;let h=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(p,r,!0),this.lexer.state.top=h,t.length===0)break;let g=r[r.length-1];if(g?.type==="code")break;if(g?.type==="blockquote"){let f=g,v=f.raw+`
`+t.join(`
`),b=this.blockquote(v);r[r.length-1]=b,o=o.substring(0,o.length-f.raw.length)+b.raw,n=n.substring(0,n.length-f.text.length)+b.text;break}else if(g?.type==="list"){let f=g,v=f.raw+`
`+t.join(`
`),b=this.list(v);r[r.length-1]=b,o=o.substring(0,o.length-g.raw.length)+b.raw,n=n.substring(0,n.length-f.raw.length)+b.raw,t=v.substring(r[r.length-1].raw.length).split(`
`);continue}}return{type:"blockquote",raw:o,tokens:r,text:n}}}list(i){let e=this.rules.block.list.exec(i);if(e){let t=e[1].trim(),o=t.length>1,n={type:"list",raw:"",ordered:o,start:o?+t.slice(0,-1):"",loose:!1,items:[]};t=o?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=o?t:"[*+-]");let r=new RegExp(`^( {0,3}${t})((?:[	 ][^\\n]*)?(?:\\n|$))`),s=!1;for(;i;){let l=!1,c="",u="";if(!(e=r.exec(i))||this.rules.block.hr.test(i))break;c=e[0],i=i.substring(c.length);let p=e[2].split(`
`,1)[0].replace(/^\t+/,S=>" ".repeat(3*S.length)),h=i.split(`
`,1)[0],g=!p.trim(),f=0;if(this.options.pedantic?(f=2,u=p.trimStart()):g?f=e[1].length+1:(f=e[2].search(/[^ ]/),f=f>4?1:f,u=p.slice(f),f+=e[1].length),g&&/^ *$/.test(h)&&(c+=h+`
`,i=i.substring(h.length+1),l=!0),!l){let S=new RegExp(`^ {0,${Math.min(3,f-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ 	][^\\n]*)?(?:\\n|$))`),y=new RegExp(`^ {0,${Math.min(3,f-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),w=new RegExp(`^ {0,${Math.min(3,f-1)}}(?:\`\`\`|~~~)`),k=new RegExp(`^ {0,${Math.min(3,f-1)}}#`);for(;i;){let T=i.split(`
`,1)[0];if(h=T,this.options.pedantic&&(h=h.replace(/^ {1,4}(?=( {4})*[^ ])/g,"  ")),w.test(h)||k.test(h)||S.test(h)||y.test(i))break;if(h.search(/[^ ]/)>=f||!h.trim())u+=`
`+h.slice(f);else{if(g||p.search(/[^ ]/)>=4||w.test(p)||k.test(p)||y.test(p))break;u+=`
`+h}!g&&!h.trim()&&(g=!0),c+=T+`
`,i=i.substring(T.length+1),p=h.slice(f)}}n.loose||(s?n.loose=!0:/\n *\n *$/.test(c)&&(s=!0));let v=null,b;this.options.gfm&&(v=/^\[[ xX]\] /.exec(u),v&&(b=v[0]!=="[ ] ",u=u.replace(/^\[[ xX]\] +/,""))),n.items.push({type:"list_item",raw:c,task:!!v,checked:b,loose:!1,text:u,tokens:[]}),n.raw+=c}n.items[n.items.length-1].raw=n.items[n.items.length-1].raw.trimEnd(),n.items[n.items.length-1].text=n.items[n.items.length-1].text.trimEnd(),n.raw=n.raw.trimEnd();for(let l=0;l<n.items.length;l++)if(this.lexer.state.top=!1,n.items[l].tokens=this.lexer.blockTokens(n.items[l].text,[]),!n.loose){let c=n.items[l].tokens.filter(p=>p.type==="space"),u=c.length>0&&c.some(p=>/\n.*\n/.test(p.raw));n.loose=u}if(n.loose)for(let l=0;l<n.items.length;l++)n.items[l].loose=!0;return n}}html(i){let e=this.rules.block.html.exec(i);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(i){let e=this.rules.block.def.exec(i);if(e){let t=e[1].toLowerCase().replace(/\s+/g," "),o=e[2]?e[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",n=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:e[0],href:o,title:n}}}table(i){let e=this.rules.block.table.exec(i);if(!e||!/[:|]/.test(e[2]))return;let t=xQi(e[1]),o=e[2].replace(/^\||\| *$/g,"").split("|"),n=e[3]&&e[3].trim()?e[3].replace(/\n[ \t]*$/,"").split(`
`):[],r={type:"table",raw:e[0],header:[],align:[],rows:[]};if(t.length===o.length){for(let s of o)/^ *-+: *$/.test(s)?r.align.push("right"):/^ *:-+: *$/.test(s)?r.align.push("center"):/^ *:-+ *$/.test(s)?r.align.push("left"):r.align.push(null);for(let s=0;s<t.length;s++)r.header.push({text:t[s],tokens:this.lexer.inline(t[s]),header:!0,align:r.align[s]});for(let s of n)r.rows.push(xQi(s,r.header.length).map((l,c)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:r.align[c]})));return r}}lheading(i){let e=this.rules.block.lheading.exec(i);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(i){let e=this.rules.block.paragraph.exec(i);if(e){let t=e[1].charAt(e[1].length-1)===`
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(i){let e=this.rules.block.text.exec(i);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(i){let e=this.rules.inline.escape.exec(i);if(e)return{type:"escape",raw:e[0],text:AP(e[1])}}tag(i){let e=this.rules.inline.tag.exec(i);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(i){let e=this.rules.inline.link.exec(i);if(e){let t=e[2].trim();if(!this.options.pedantic&&/^</.test(t)){if(!/>$/.test(t))return;let r=o4e(t.slice(0,-1),"\\");if((t.length-r.length)%2===0)return}else{let r=CHo(e[2],"()");if(r>-1){let l=(e[0].indexOf("!")===0?5:4)+e[1].length+r;e[2]=e[2].substring(0,r),e[0]=e[0].substring(0,l).trim(),e[3]=""}}let o=e[2],n="";if(this.options.pedantic){let r=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(o);r&&(o=r[1],n=r[3])}else n=e[3]?e[3].slice(1,-1):"";return o=o.trim(),/^</.test(o)&&(this.options.pedantic&&!/>$/.test(t)?o=o.slice(1):o=o.slice(1,-1)),kQi(e,{href:o&&o.replace(this.rules.inline.anyPunctuation,"$1"),title:n&&n.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer)}}reflink(i,e){let t;if((t=this.rules.inline.reflink.exec(i))||(t=this.rules.inline.nolink.exec(i))){let o=(t[2]||t[1]).replace(/\s+/g," "),n=e[o.toLowerCase()];if(!n){let r=t[0].charAt(0);return{type:"text",raw:r,text:r}}return kQi(t,n,t[0],this.lexer)}}emStrong(i,e,t=""){let o=this.rules.inline.emStrongLDelim.exec(i);if(!o||o[3]&&t.match(/[\p{L}\p{N}]/u))return;if(!(o[1]||o[2]||"")||!t||this.rules.inline.punctuation.exec(t)){let r=[...o[0]].length-1,s,l,c=r,u=0,p=o[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(p.lastIndex=0,e=e.slice(-1*i.length+r);(o=p.exec(e))!=null;){if(s=o[1]||o[2]||o[3]||o[4]||o[5]||o[6],!s)continue;if(l=[...s].length,o[3]||o[4]){c+=l;continue}else if((o[5]||o[6])&&r%3&&!((r+l)%3)){u+=l;continue}if(c-=l,c>0)continue;l=Math.min(l,l+c+u);let h=[...o[0]][0].length,g=i.slice(0,r+o.index+h+l);if(Math.min(r,l)%2){let v=g.slice(1,-1);return{type:"em",raw:g,text:v,tokens:this.lexer.inlineTokens(v)}}let f=g.slice(2,-2);return{type:"strong",raw:g,text:f,tokens:this.lexer.inlineTokens(f)}}}}codespan(i){let e=this.rules.inline.code.exec(i);if(e){let t=e[2].replace(/\n/g," "),o=/[^ ]/.test(t),n=/^ /.test(t)&&/ $/.test(t);return o&&n&&(t=t.substring(1,t.length-1)),t=AP(t,!0),{type:"codespan",raw:e[0],text:t}}}br(i){let e=this.rules.inline.br.exec(i);if(e)return{type:"br",raw:e[0]}}del(i){let e=this.rules.inline.del.exec(i);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(i){let e=this.rules.inline.autolink.exec(i);if(e){let t,o;return e[2]==="@"?(t=AP(e[1]),o="mailto:"+t):(t=AP(e[1]),o=t),{type:"link",raw:e[0],text:t,href:o,tokens:[{type:"text",raw:t,text:t}]}}}url(i){let e;if(e=this.rules.inline.url.exec(i)){let t,o;if(e[2]==="@")t=AP(e[0]),o="mailto:"+t;else{let n;do n=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(n!==e[0]);t=AP(e[0]),e[1]==="www."?o="http://"+e[0]:o=e[0]}return{type:"link",raw:e[0],text:t,href:o,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(i){let e=this.rules.inline.text.exec(i);if(e){let t;return this.lexer.state.inRawBlock?t=e[0]:t=AP(e[0]),{type:"text",raw:e[0],text:t}}}},kHo=/^(?: *(?:\n|$))+/,EHo=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,THo=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,a4e=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,_Ho=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,LQi=/(?:[*+-]|\d{1,9}[.)])/,RQi=Yh(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,LQi).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(),eri=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,DHo=/^[^\n]+/,tri=/(?!\s*\])(?:\\.|[^\[\]\\])+/,LHo=Yh(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",tri).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),RHo=Yh(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,LQi).getRegex(),Fyt="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",iri=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,MHo=Yh("^ {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",iri).replace("tag",Fyt).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),MQi=Yh(eri).replace("hr",a4e).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",Fyt).getRegex(),PHo=Yh(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",MQi).getRegex(),ori={blockquote:PHo,code:EHo,def:LHo,fences:THo,heading:_Ho,hr:a4e,html:MHo,lheading:RQi,list:RHo,newline:kHo,paragraph:MQi,table:r4e,text:DHo},EQi=Yh("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",a4e).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",Fyt).getRegex(),AHo={...ori,table:EQi,paragraph:Yh(eri).replace("hr",a4e).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",EQi).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",Fyt).getRegex()},NHo={...ori,html:Yh(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",iri).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:r4e,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Yh(eri).replace("hr",a4e).replace("heading",` *#{1,6} *[^
]`).replace("lheading",RQi).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},PQi=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,OHo=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,AQi=/^( {2,}|\\)\n(?!\s*$)/,FHo=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,l4e="\\p{P}\\p{S}",WHo=Yh(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,l4e).getRegex(),VHo=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,BHo=Yh(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,l4e).getRegex(),HHo=Yh("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,l4e).getRegex(),UHo=Yh("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,l4e).getRegex(),zHo=Yh(/\\([punct])/,"gu").replace(/punct/g,l4e).getRegex(),KHo=Yh(/^<(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(),GHo=Yh(iri).replace("(?:-->|$)","-->").getRegex(),qHo=Yh("^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",GHo).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Oyt=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,$Ho=Yh(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",Oyt).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),NQi=Yh(/^!?\[(label)\]\[(ref)\]/).replace("label",Oyt).replace("ref",tri).getRegex(),OQi=Yh(/^!?\[(ref)\](?:\[\])?/).replace("ref",tri).getRegex(),jHo=Yh("reflink|nolink(?!\\()","g").replace("reflink",NQi).replace("nolink",OQi).getRegex(),nri={_backpedal:r4e,anyPunctuation:zHo,autolink:KHo,blockSkip:VHo,br:AQi,code:OHo,del:r4e,emStrongLDelim:BHo,emStrongRDelimAst:HHo,emStrongRDelimUnd:UHo,escape:PQi,link:$Ho,nolink:OQi,punctuation:WHo,reflink:NQi,reflinkSearch:jHo,tag:qHo,text:FHo,url:r4e},QHo={...nri,link:Yh(/^!?\[(label)\]\((.*?)\)/).replace("label",Oyt).getRegex(),reflink:Yh(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Oyt).getRegex()},Jni={...nri,escape:Yh(PQi).replace("])","~|])").getRegex(),url:Yh(/^((?: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.!#$%&'*+\/=?_`{\|}~-]+@)))/},YHo={...Jni,br:Yh(AQi).replace("{2,}","*").getRegex(),text:Yh(Jni.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Nyt={normal:ori,gfm:AHo,pedantic:NHo},n4e={normal:nri,gfm:Jni,breaks:YHo,pedantic:QHo},zj=class a{tokens;options;state;tokenizer;inlineQueue;constructor(i){this.tokens=[],this.tokens.links=Object.create(null),this.options=i||jle,this.options.tokenizer=this.options.tokenizer||new ECe,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:Nyt.normal,inline:n4e.normal};this.options.pedantic?(e.block=Nyt.pedantic,e.inline=n4e.pedantic):this.options.gfm&&(e.block=Nyt.gfm,this.options.breaks?e.inline=n4e.breaks:e.inline=n4e.gfm),this.tokenizer.rules=e}static get rules(){return{block:Nyt,inline:n4e}}static lex(i,e){return new a(e).lex(i)}static lexInline(i,e){return new a(e).inlineTokens(i)}lex(i){i=i.replace(/\r\n|\r/g,`
`),this.blockTokens(i,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(i,e=[],t=!1){this.options.pedantic?i=i.replace(/\t/g,"    ").replace(/^ +$/gm,""):i=i.replace(/^( *)(\t+)/gm,(s,l,c)=>l+"    ".repeat(c.length));let o,n,r;for(;i;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(s=>(o=s.call({lexer:this},i,e))?(i=i.substring(o.raw.length),e.push(o),!0):!1))){if(o=this.tokenizer.space(i)){i=i.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(i)){i=i.substring(o.raw.length),n=e[e.length-1],n&&(n.type==="paragraph"||n.type==="text")?(n.raw+=`
`+o.raw,n.text+=`
`+o.text,this.inlineQueue[this.inlineQueue.length-1].src=n.text):e.push(o);continue}if(o=this.tokenizer.fences(i)){i=i.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.heading(i)){i=i.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.hr(i)){i=i.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.blockquote(i)){i=i.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.list(i)){i=i.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.html(i)){i=i.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.def(i)){i=i.substring(o.raw.length),n=e[e.length-1],n&&(n.type==="paragraph"||n.type==="text")?(n.raw+=`
`+o.raw,n.text+=`
`+o.raw,this.inlineQueue[this.inlineQueue.length-1].src=n.text):this.tokens.links[o.tag]||(this.tokens.links[o.tag]={href:o.href,title:o.title});continue}if(o=this.tokenizer.table(i)){i=i.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.lheading(i)){i=i.substring(o.raw.length),e.push(o);continue}if(r=i,this.options.extensions&&this.options.extensions.startBlock){let s=1/0,l=i.slice(1),c;this.options.extensions.startBlock.forEach(u=>{c=u.call({lexer:this},l),typeof c=="number"&&c>=0&&(s=Math.min(s,c))}),s<1/0&&s>=0&&(r=i.substring(0,s+1))}if(this.state.top&&(o=this.tokenizer.paragraph(r))){n=e[e.length-1],t&&n?.type==="paragraph"?(n.raw+=`
`+o.raw,n.text+=`
`+o.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=n.text):e.push(o),t=r.length!==i.length,i=i.substring(o.raw.length);continue}if(o=this.tokenizer.text(i)){i=i.substring(o.raw.length),n=e[e.length-1],n&&n.type==="text"?(n.raw+=`
`+o.raw,n.text+=`
`+o.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=n.text):e.push(o);continue}if(i){let s="Infinite loop on byte: "+i.charCodeAt(0);if(this.options.silent){console.error(s);break}else throw new Error(s)}}return this.state.top=!0,e}inline(i,e=[]){return this.inlineQueue.push({src:i,tokens:e}),e}inlineTokens(i,e=[]){let t,o,n,r=i,s,l,c;if(this.tokens.links){let u=Object.keys(this.tokens.links);if(u.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)u.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)r=r.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,s.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;i;)if(l||(c=""),l=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(u=>(t=u.call({lexer:this},i,e))?(i=i.substring(t.raw.length),e.push(t),!0):!1))){if(t=this.tokenizer.escape(i)){i=i.substring(t.raw.length),e.push(t);continue}if(t=this.tokenizer.tag(i)){i=i.substring(t.raw.length),o=e[e.length-1],o&&t.type==="text"&&o.type==="text"?(o.raw+=t.raw,o.text+=t.text):e.push(t);continue}if(t=this.tokenizer.link(i)){i=i.substring(t.raw.length),e.push(t);continue}if(t=this.tokenizer.reflink(i,this.tokens.links)){i=i.substring(t.raw.length),o=e[e.length-1],o&&t.type==="text"&&o.type==="text"?(o.raw+=t.raw,o.text+=t.text):e.push(t);continue}if(t=this.tokenizer.emStrong(i,r,c)){i=i.substring(t.raw.length),e.push(t);continue}if(t=this.tokenizer.codespan(i)){i=i.substring(t.raw.length),e.push(t);continue}if(t=this.tokenizer.br(i)){i=i.substring(t.raw.length),e.push(t);continue}if(t=this.tokenizer.del(i)){i=i.substring(t.raw.length),e.push(t);continue}if(t=this.tokenizer.autolink(i)){i=i.substring(t.raw.length),e.push(t);continue}if(!this.state.inLink&&(t=this.tokenizer.url(i))){i=i.substring(t.raw.length),e.push(t);continue}if(n=i,this.options.extensions&&this.options.extensions.startInline){let u=1/0,p=i.slice(1),h;this.options.extensions.startInline.forEach(g=>{h=g.call({lexer:this},p),typeof h=="number"&&h>=0&&(u=Math.min(u,h))}),u<1/0&&u>=0&&(n=i.substring(0,u+1))}if(t=this.tokenizer.inlineText(n)){i=i.substring(t.raw.length),t.raw.slice(-1)!=="_"&&(c=t.raw.slice(-1)),l=!0,o=e[e.length-1],o&&o.type==="text"?(o.raw+=t.raw,o.text+=t.text):e.push(t);continue}if(i){let u="Infinite loop on byte: "+i.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return e}},dY=class{options;parser;constructor(i){this.options=i||jle}space(i){return""}code({text:i,lang:e,escaped:t}){let o=(e||"").match(/^\S*/)?.[0],n=i.replace(/\n$/,"")+`
`;return o?'<pre><code class="language-'+AP(o)+'">'+(t?n:AP(n,!0))+`</code></pre>
`:"<pre><code>"+(t?n:AP(n,!0))+`</code></pre>
`}blockquote({tokens:i}){return`<blockquote>
${this.parser.parse(i)}</blockquote>
`}html({text:i}){return i}heading({tokens:i,depth:e}){return`<h${e}>${this.parser.parseInline(i)}</h${e}>
`}hr(i){return`<hr>
`}list(i){let e=i.ordered,t=i.start,o="";for(let s=0;s<i.items.length;s++){let l=i.items[s];o+=this.listitem(l)}let n=e?"ol":"ul",r=e&&t!==1?' start="'+t+'"':"";return"<"+n+r+`>
`+o+"</"+n+`>
`}listitem(i){let e="";if(i.task){let t=this.checkbox({checked:!!i.checked});i.loose?i.tokens.length>0&&i.tokens[0].type==="paragraph"?(i.tokens[0].text=t+" "+i.tokens[0].text,i.tokens[0].tokens&&i.tokens[0].tokens.length>0&&i.tokens[0].tokens[0].type==="text"&&(i.tokens[0].tokens[0].text=t+" "+i.tokens[0].tokens[0].text)):i.tokens.unshift({type:"text",raw:t+" ",text:t+" "}):e+=t+" "}return e+=this.parser.parse(i.tokens,!!i.loose),`<li>${e}</li>
`}checkbox({checked:i}){return"<input "+(i?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:i}){return`<p>${this.parser.parseInline(i)}</p>
`}table(i){let e="",t="";for(let n=0;n<i.header.length;n++)t+=this.tablecell(i.header[n]);e+=this.tablerow({text:t});let o="";for(let n=0;n<i.rows.length;n++){let r=i.rows[n];t="";for(let s=0;s<r.length;s++)t+=this.tablecell(r[s]);o+=this.tablerow({text:t})}return o&&(o=`<tbody>${o}</tbody>`),`<table>
<thead>
`+e+`</thead>
`+o+`</table>
`}tablerow({text:i}){return`<tr>
${i}</tr>
`}tablecell(i){let e=this.parser.parseInline(i.tokens),t=i.header?"th":"td";return(i.align?`<${t} align="${i.align}">`:`<${t}>`)+e+`</${t}>
`}strong({tokens:i}){return`<strong>${this.parser.parseInline(i)}</strong>`}em({tokens:i}){return`<em>${this.parser.parseInline(i)}</em>`}codespan({text:i}){return`<code>${i}</code>`}br(i){return"<br>"}del({tokens:i}){return`<del>${this.parser.parseInline(i)}</del>`}link({href:i,title:e,tokens:t}){let o=this.parser.parseInline(t),n=CQi(i);if(n===null)return o;i=n;let r='<a href="'+i+'"';return e&&(r+=' title="'+e+'"'),r+=">"+o+"</a>",r}image({href:i,title:e,text:t}){let o=CQi(i);if(o===null)return t;i=o;let n=`<img src="${i}" alt="${t}"`;return e&&(n+=` title="${e}"`),n+=">",n}text(i){return"tokens"in i&&i.tokens?this.parser.parseInline(i.tokens):i.text}},s4e=class{strong({text:i}){return i}em({text:i}){return i}codespan({text:i}){return i}del({text:i}){return i}html({text:i}){return i}text({text:i}){return i}link({text:i}){return""+i}image({text:i}){return""+i}br(){return""}},Kj=class a{options;renderer;textRenderer;constructor(i){this.options=i||jle,this.options.renderer=this.options.renderer||new dY,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new s4e}static parse(i,e){return new a(e).parse(i)}static parseInline(i,e){return new a(e).parseInline(i)}parse(i,e=!0){let t="";for(let o=0;o<i.length;o++){let n=i[o];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[n.type]){let s=n,l=this.options.extensions.renderers[s.type].call({parser:this},s);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(s.type)){t+=l||"";continue}}let r=n;switch(r.type){case"space":{t+=this.renderer.space(r);continue}case"hr":{t+=this.renderer.hr(r);continue}case"heading":{t+=this.renderer.heading(r);continue}case"code":{t+=this.renderer.code(r);continue}case"table":{t+=this.renderer.table(r);continue}case"blockquote":{t+=this.renderer.blockquote(r);continue}case"list":{t+=this.renderer.list(r);continue}case"html":{t+=this.renderer.html(r);continue}case"paragraph":{t+=this.renderer.paragraph(r);continue}case"text":{let s=r,l=this.renderer.text(s);for(;o+1<i.length&&i[o+1].type==="text";)s=i[++o],l+=`
`+this.renderer.text(s);e?t+=this.renderer.paragraph({type:"paragraph",raw:l,text:l,tokens:[{type:"text",raw:l,text:l}]}):t+=l;continue}default:{let s='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(s),"";throw new Error(s)}}}return t}parseInline(i,e){e=e||this.renderer;let t="";for(let o=0;o<i.length;o++){let n=i[o];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[n.type]){let s=this.options.extensions.renderers[n.type].call({parser:this},n);if(s!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(n.type)){t+=s||"";continue}}let r=n;switch(r.type){case"escape":{t+=e.text(r);break}case"html":{t+=e.html(r);break}case"link":{t+=e.link(r);break}case"image":{t+=e.image(r);break}case"strong":{t+=e.strong(r);break}case"em":{t+=e.em(r);break}case"codespan":{t+=e.codespan(r);break}case"br":{t+=e.br(r);break}case"del":{t+=e.del(r);break}case"text":{t+=e.text(r);break}default:{let s='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(s),"";throw new Error(s)}}}return t}},kCe=class{options;constructor(i){this.options=i||jle}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(i){return i}postprocess(i){return i}processAllTokens(i){return i}},Gj=class{defaults=Zni();options=this.setOptions;parse=this.parseMarkdown(zj.lex,Kj.parse);parseInline=this.parseMarkdown(zj.lexInline,Kj.parseInline);Parser=Kj;Renderer=dY;TextRenderer=s4e;Lexer=zj;Tokenizer=ECe;Hooks=kCe;constructor(...i){this.use(...i)}walkTokens(i,e){let t=[];for(let o of i)switch(t=t.concat(e.call(this,o)),o.type){case"table":{let n=o;for(let r of n.header)t=t.concat(this.walkTokens(r.tokens,e));for(let r of n.rows)for(let s of r)t=t.concat(this.walkTokens(s.tokens,e));break}case"list":{let n=o;t=t.concat(this.walkTokens(n.items,e));break}default:{let n=o;this.defaults.extensions?.childTokens?.[n.type]?this.defaults.extensions.childTokens[n.type].forEach(r=>{let s=n[r].flat(1/0);t=t.concat(this.walkTokens(s,e))}):n.tokens&&(t=t.concat(this.walkTokens(n.tokens,e)))}}return t}use(...i){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return i.forEach(t=>{let o={...t};if(o.async=this.defaults.async||o.async||!1,t.extensions&&(t.extensions.forEach(n=>{if(!n.name)throw new Error("extension name required");if("renderer"in n){let r=e.renderers[n.name];r?e.renderers[n.name]=function(...s){let l=n.renderer.apply(this,s);return l===!1&&(l=r.apply(this,s)),l}:e.renderers[n.name]=n.renderer}if("tokenizer"in n){if(!n.level||n.level!=="block"&&n.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let r=e[n.level];r?r.unshift(n.tokenizer):e[n.level]=[n.tokenizer],n.start&&(n.level==="block"?e.startBlock?e.startBlock.push(n.start):e.startBlock=[n.start]:n.level==="inline"&&(e.startInline?e.startInline.push(n.start):e.startInline=[n.start]))}"childTokens"in n&&n.childTokens&&(e.childTokens[n.name]=n.childTokens)}),o.extensions=e),t.renderer){let n=this.defaults.renderer||new dY(this.defaults);for(let r in t.renderer){if(!(r in n))throw new Error(`renderer '${r}' does not exist`);if(["options","parser"].includes(r))continue;let s=r,l=t.renderer[s],c=n[s];n[s]=(...u)=>{let p=l.apply(n,u);return p===!1&&(p=c.apply(n,u)),p||""}}o.renderer=n}if(t.tokenizer){let n=this.defaults.tokenizer||new ECe(this.defaults);for(let r in t.tokenizer){if(!(r in n))throw new Error(`tokenizer '${r}' does not exist`);if(["options","rules","lexer"].includes(r))continue;let s=r,l=t.tokenizer[s],c=n[s];n[s]=(...u)=>{let p=l.apply(n,u);return p===!1&&(p=c.apply(n,u)),p}}o.tokenizer=n}if(t.hooks){let n=this.defaults.hooks||new kCe;for(let r in t.hooks){if(!(r in n))throw new Error(`hook '${r}' does not exist`);if(r==="options")continue;let s=r,l=t.hooks[s],c=n[s];kCe.passThroughHooks.has(r)?n[s]=u=>{if(this.defaults.async)return Promise.resolve(l.call(n,u)).then(h=>c.call(n,h));let p=l.call(n,u);return c.call(n,p)}:n[s]=(...u)=>{let p=l.apply(n,u);return p===!1&&(p=c.apply(n,u)),p}}o.hooks=n}if(t.walkTokens){let n=this.defaults.walkTokens,r=t.walkTokens;o.walkTokens=function(s){let l=[];return l.push(r.call(this,s)),n&&(l=l.concat(n.call(this,s))),l}}this.defaults={...this.defaults,...o}}),this}setOptions(i){return this.defaults={...this.defaults,...i},this}lexer(i,e){return zj.lex(i,e??this.defaults)}parser(i,e){return Kj.parse(i,e??this.defaults)}parseMarkdown(i,e){return(o,n)=>{let r={...n},s={...this.defaults,...r},l=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&r.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(s.hooks&&(s.hooks.options=s),s.async)return Promise.resolve(s.hooks?s.hooks.preprocess(o):o).then(c=>i(c,s)).then(c=>s.hooks?s.hooks.processAllTokens(c):c).then(c=>s.walkTokens?Promise.all(this.walkTokens(c,s.walkTokens)).then(()=>c):c).then(c=>e(c,s)).then(c=>s.hooks?s.hooks.postprocess(c):c).catch(l);try{s.hooks&&(o=s.hooks.preprocess(o));let c=i(o,s);s.hooks&&(c=s.hooks.processAllTokens(c)),s.walkTokens&&this.walkTokens(c,s.walkTokens);let u=e(c,s);return s.hooks&&(u=s.hooks.postprocess(u)),u}catch(c){return l(c)}}}onError(i,e){return t=>{if(t.message+=`
Please report this to https://github.com/markedjs/marked.`,i){let o="<p>An error occurred:</p><pre>"+AP(t.message+"",!0)+"</pre>";return e?Promise.resolve(o):o}if(e)return Promise.reject(t);throw t}}},$le=new Gj;function oc(a,i){return $le.parse(a,i)}oc.options=oc.setOptions=function(a){return $le.setOptions(a),oc.defaults=$le.defaults,TQi(oc.defaults),oc};oc.getDefaults=Zni;oc.defaults=jle;oc.use=function(...a){return $le.use(...a),oc.defaults=$le.defaults,TQi(oc.defaults),oc};oc.walkTokens=function(a,i){return $le.walkTokens(a,i)};oc.parseInline=$le.parseInline;oc.Parser=Kj;oc.parser=Kj.parse;oc.Renderer=dY;oc.TextRenderer=s4e;oc.Lexer=zj;oc.lexer=zj.lex;oc.Tokenizer=ECe;oc.Hooks=kCe;oc.parse=oc;var USr=oc.options,zSr=oc.setOptions,KSr=oc.use,FQi=oc.walkTokens,GSr=oc.parseInline,WQi=oc,qSr=Kj.parse,uY=zj.lex;var{entries:$Qi,setPrototypeOf:VQi,isFrozen:XHo,getPrototypeOf:JHo,getOwnPropertyDescriptor:ZHo}=Object,{freeze:W_,seal:HO,create:jQi}=Object,{apply:uri,construct:pri}=typeof Reflect<"u"&&Reflect;W_||(W_=function(i){return i});HO||(HO=function(i){return i});uri||(uri=function(i,e){for(var t=arguments.length,o=new Array(t>2?t-2:0),n=2;n<t;n++)o[n-2]=arguments[n];return i.apply(e,o)});pri||(pri=function(i){for(var e=arguments.length,t=new Array(e>1?e-1:0),o=1;o<e;o++)t[o-1]=arguments[o];return new i(...t)});var Wyt=V_(Array.prototype.forEach),eUo=V_(Array.prototype.lastIndexOf),BQi=V_(Array.prototype.pop),c4e=V_(Array.prototype.push),tUo=V_(Array.prototype.splice),Byt=V_(String.prototype.toLowerCase),rri=V_(String.prototype.toString),sri=V_(String.prototype.match),d4e=V_(String.prototype.replace),iUo=V_(String.prototype.indexOf),oUo=V_(String.prototype.trim),zV=V_(Object.prototype.hasOwnProperty),F_=V_(RegExp.prototype.test),u4e=nUo(TypeError);function V_(a){return function(i){i instanceof RegExp&&(i.lastIndex=0);for(var e=arguments.length,t=new Array(e>1?e-1:0),o=1;o<e;o++)t[o-1]=arguments[o];return uri(a,i,t)}}function nUo(a){return function(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];return pri(a,e)}}function wu(a,i){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Byt;VQi&&VQi(a,null);let t=i.length;for(;t--;){let o=i[t];if(typeof o=="string"){let n=e(o);n!==o&&(XHo(i)||(i[t]=n),o=n)}a[o]=!0}return a}function rUo(a){for(let i=0;i<a.length;i++)zV(a,i)||(a[i]=null);return a}function qj(a){let i=jQi(null);for(let[e,t]of $Qi(a))zV(a,e)&&(Array.isArray(t)?i[e]=rUo(t):t&&typeof t=="object"&&t.constructor===Object?i[e]=qj(t):i[e]=t);return i}function p4e(a,i){for(;a!==null;){let t=ZHo(a,i);if(t){if(t.get)return V_(t.get);if(typeof t.value=="function")return V_(t.value)}a=JHo(a)}function e(){return null}return e}var HQi=W_(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),ari=W_(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","slot","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),lri=W_(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),sUo=W_(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),cri=W_(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),aUo=W_(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),UQi=W_(["#text"]),zQi=W_(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),dri=W_(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),KQi=W_(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Vyt=W_(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),lUo=HO(/\{\{[\w\W]*|[\w\W]*\}\}/gm),cUo=HO(/<%[\w\W]*|[\w\W]*%>/gm),dUo=HO(/\$\{[\w\W]*/gm),uUo=HO(/^data-[\-\w.\u00B7-\uFFFF]+$/),pUo=HO(/^aria-[\-\w]+$/),QQi=HO(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),mUo=HO(/^(?:\w+script|data):/i),hUo=HO(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),YQi=HO(/^html$/i),gUo=HO(/^[a-z][.\w]*(-[.\w]+)+$/i),GQi=Object.freeze({__proto__:null,ARIA_ATTR:pUo,ATTR_WHITESPACE:hUo,CUSTOM_ELEMENT:gUo,DATA_ATTR:uUo,DOCTYPE_NAME:YQi,ERB_EXPR:cUo,IS_ALLOWED_URI:QQi,IS_SCRIPT_OR_DATA:mUo,MUSTACHE_EXPR:lUo,TMPLIT_EXPR:dUo}),m4e={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},fUo=function(){return typeof window>"u"?null:window},vUo=function(i,e){if(typeof i!="object"||typeof i.createPolicy!="function")return null;let t=null,o="data-tt-policy-suffix";e&&e.hasAttribute(o)&&(t=e.getAttribute(o));let n="dompurify"+(t?"#"+t:"");try{return i.createPolicy(n,{createHTML(r){return r},createScriptURL(r){return r}})}catch{return console.warn("TrustedTypes policy "+n+" could not be created."),null}},qQi=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function XQi(){let a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:fUo(),i=Fa=>XQi(Fa);if(i.version="3.2.7",i.removed=[],!a||!a.document||a.document.nodeType!==m4e.document||!a.Element)return i.isSupported=!1,i;let{document:e}=a,t=e,o=t.currentScript,{DocumentFragment:n,HTMLTemplateElement:r,Node:s,Element:l,NodeFilter:c,NamedNodeMap:u=a.NamedNodeMap||a.MozNamedAttrMap,HTMLFormElement:p,DOMParser:h,trustedTypes:g}=a,f=l.prototype,v=p4e(f,"cloneNode"),b=p4e(f,"remove"),S=p4e(f,"nextSibling"),y=p4e(f,"childNodes"),w=p4e(f,"parentNode");if(typeof r=="function"){let Fa=e.createElement("template");Fa.content&&Fa.content.ownerDocument&&(e=Fa.content.ownerDocument)}let k,T="",{implementation:P,createNodeIterator:O,createDocumentFragment:V,getElementsByTagName:H}=e,{importNode:G}=t,$=qQi();i.isSupported=typeof $Qi=="function"&&typeof w=="function"&&P&&P.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:J,ERB_EXPR:ae,TMPLIT_EXPR:he,DATA_ATTR:oe,ARIA_ATTR:de,IS_SCRIPT_OR_DATA:Ce,ATTR_WHITESPACE:xe,CUSTOM_ELEMENT:ze}=GQi,{IS_ALLOWED_URI:De}=GQi,Oe=null,pt=wu({},[...HQi,...ari,...lri,...cri,...UQi]),et=null,Ti=wu({},[...zQi,...dri,...KQi,...Vyt]),Ht=Object.seal(jQi(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),zi=null,Vo=null,sn=!0,_n=!0,mn=!1,hn=!0,yo=!1,Mr=!0,cn=!1,er=!1,Ns=!1,ua=!1,xm=!1,tm=!1,Lu=!0,jg=!1,Ir="user-content-",Lx=!0,Qg=!1,lC={},Op=null,Af=wu({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),h$=null,C9=wu({},["audio","video","img","source","image","track"]),Rx=null,LI=wu({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),jt="http://www.w3.org/1998/Math/MathML",Mi="http://www.w3.org/2000/svg",no="http://www.w3.org/1999/xhtml",Kr=no,Ia=!1,Yg=null,Co=wu({},[jt,Mi,no],rri),on=wu({},["mi","mo","mn","ms","mtext"]),Nt=wu({},["annotation-xml"]),je=wu({},["title","style","font","a","script"]),we=null,Ke=["application/xhtml+xml","text/html"],Lt="text/html",Gt=null,Ro=null,so=e.createElement("form"),Pr=function(fi){return fi instanceof RegExp||fi instanceof Function},Is=function(){let fi=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Ro&&Ro===fi)){if((!fi||typeof fi!="object")&&(fi={}),fi=qj(fi),we=Ke.indexOf(fi.PARSER_MEDIA_TYPE)===-1?Lt:fi.PARSER_MEDIA_TYPE,Gt=we==="application/xhtml+xml"?rri:Byt,Oe=zV(fi,"ALLOWED_TAGS")?wu({},fi.ALLOWED_TAGS,Gt):pt,et=zV(fi,"ALLOWED_ATTR")?wu({},fi.ALLOWED_ATTR,Gt):Ti,Yg=zV(fi,"ALLOWED_NAMESPACES")?wu({},fi.ALLOWED_NAMESPACES,rri):Co,Rx=zV(fi,"ADD_URI_SAFE_ATTR")?wu(qj(LI),fi.ADD_URI_SAFE_ATTR,Gt):LI,h$=zV(fi,"ADD_DATA_URI_TAGS")?wu(qj(C9),fi.ADD_DATA_URI_TAGS,Gt):C9,Op=zV(fi,"FORBID_CONTENTS")?wu({},fi.FORBID_CONTENTS,Gt):Af,zi=zV(fi,"FORBID_TAGS")?wu({},fi.FORBID_TAGS,Gt):qj({}),Vo=zV(fi,"FORBID_ATTR")?wu({},fi.FORBID_ATTR,Gt):qj({}),lC=zV(fi,"USE_PROFILES")?fi.USE_PROFILES:!1,sn=fi.ALLOW_ARIA_ATTR!==!1,_n=fi.ALLOW_DATA_ATTR!==!1,mn=fi.ALLOW_UNKNOWN_PROTOCOLS||!1,hn=fi.ALLOW_SELF_CLOSE_IN_ATTR!==!1,yo=fi.SAFE_FOR_TEMPLATES||!1,Mr=fi.SAFE_FOR_XML!==!1,cn=fi.WHOLE_DOCUMENT||!1,ua=fi.RETURN_DOM||!1,xm=fi.RETURN_DOM_FRAGMENT||!1,tm=fi.RETURN_TRUSTED_TYPE||!1,Ns=fi.FORCE_BODY||!1,Lu=fi.SANITIZE_DOM!==!1,jg=fi.SANITIZE_NAMED_PROPS||!1,Lx=fi.KEEP_CONTENT!==!1,Qg=fi.IN_PLACE||!1,De=fi.ALLOWED_URI_REGEXP||QQi,Kr=fi.NAMESPACE||no,on=fi.MATHML_TEXT_INTEGRATION_POINTS||on,Nt=fi.HTML_INTEGRATION_POINTS||Nt,Ht=fi.CUSTOM_ELEMENT_HANDLING||{},fi.CUSTOM_ELEMENT_HANDLING&&Pr(fi.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Ht.tagNameCheck=fi.CUSTOM_ELEMENT_HANDLING.tagNameCheck),fi.CUSTOM_ELEMENT_HANDLING&&Pr(fi.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Ht.attributeNameCheck=fi.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),fi.CUSTOM_ELEMENT_HANDLING&&typeof fi.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Ht.allowCustomizedBuiltInElements=fi.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),yo&&(_n=!1),xm&&(ua=!0),lC&&(Oe=wu({},UQi),et=[],lC.html===!0&&(wu(Oe,HQi),wu(et,zQi)),lC.svg===!0&&(wu(Oe,ari),wu(et,dri),wu(et,Vyt)),lC.svgFilters===!0&&(wu(Oe,lri),wu(et,dri),wu(et,Vyt)),lC.mathMl===!0&&(wu(Oe,cri),wu(et,KQi),wu(et,Vyt))),fi.ADD_TAGS&&(Oe===pt&&(Oe=qj(Oe)),wu(Oe,fi.ADD_TAGS,Gt)),fi.ADD_ATTR&&(et===Ti&&(et=qj(et)),wu(et,fi.ADD_ATTR,Gt)),fi.ADD_URI_SAFE_ATTR&&wu(Rx,fi.ADD_URI_SAFE_ATTR,Gt),fi.FORBID_CONTENTS&&(Op===Af&&(Op=qj(Op)),wu(Op,fi.FORBID_CONTENTS,Gt)),Lx&&(Oe["#text"]=!0),cn&&wu(Oe,["html","head","body"]),Oe.table&&(wu(Oe,["tbody"]),delete zi.tbody),fi.TRUSTED_TYPES_POLICY){if(typeof fi.TRUSTED_TYPES_POLICY.createHTML!="function")throw u4e('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof fi.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw u4e('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');k=fi.TRUSTED_TYPES_POLICY,T=k.createHTML("")}else k===void 0&&(k=vUo(g,o)),k!==null&&typeof T=="string"&&(T=k.createHTML(""));W_&&W_(fi),Ro=fi}},Qr=wu({},[...ari,...lri,...sUo]),Ta=wu({},[...cri,...aUo]),Hr=function(fi){let Qn=w(fi);(!Qn||!Qn.tagName)&&(Qn={namespaceURI:Kr,tagName:"template"});let ra=Byt(fi.tagName),pv=Byt(Qn.tagName);return Yg[fi.namespaceURI]?fi.namespaceURI===Mi?Qn.namespaceURI===no?ra==="svg":Qn.namespaceURI===jt?ra==="svg"&&(pv==="annotation-xml"||on[pv]):!!Qr[ra]:fi.namespaceURI===jt?Qn.namespaceURI===no?ra==="math":Qn.namespaceURI===Mi?ra==="math"&&Nt[pv]:!!Ta[ra]:fi.namespaceURI===no?Qn.namespaceURI===Mi&&!Nt[pv]||Qn.namespaceURI===jt&&!on[pv]?!1:!Ta[ra]&&(je[ra]||!Qr[ra]):!!(we==="application/xhtml+xml"&&Yg[fi.namespaceURI]):!1},ll=function(fi){c4e(i.removed,{element:fi});try{w(fi).removeChild(fi)}catch{b(fi)}},Ao=function(fi,Qn){try{c4e(i.removed,{attribute:Qn.getAttributeNode(fi),from:Qn})}catch{c4e(i.removed,{attribute:null,from:Qn})}if(Qn.removeAttribute(fi),fi==="is")if(ua||xm)try{ll(Qn)}catch{}else try{Qn.setAttribute(fi,"")}catch{}},cC=function(fi){let Qn=null,ra=null;if(Ns)fi="<remove></remove>"+fi;else{let RI=sri(fi,/^[\r\n\t ]+/);ra=RI&&RI[0]}we==="application/xhtml+xml"&&Kr===no&&(fi='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+fi+"</body></html>");let pv=k?k.createHTML(fi):fi;if(Kr===no)try{Qn=new h().parseFromString(pv,we)}catch{}if(!Qn||!Qn.documentElement){Qn=P.createDocument(Kr,"template",null);try{Qn.documentElement.innerHTML=Ia?T:pv}catch{}}let dE=Qn.body||Qn.documentElement;return fi&&ra&&dE.insertBefore(e.createTextNode(ra),dE.childNodes[0]||null),Kr===no?H.call(Qn,cn?"html":"body")[0]:cn?Qn.documentElement:dE},Mse=function(fi){return O.call(fi.ownerDocument||fi,fi,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},g$=function(fi){return fi instanceof p&&(typeof fi.nodeName!="string"||typeof fi.textContent!="string"||typeof fi.removeChild!="function"||!(fi.attributes instanceof u)||typeof fi.removeAttribute!="function"||typeof fi.setAttribute!="function"||typeof fi.namespaceURI!="string"||typeof fi.insertBefore!="function"||typeof fi.hasChildNodes!="function")},MSe=function(fi){return typeof s=="function"&&fi instanceof s};function f$(Fa,fi,Qn){Wyt(Fa,ra=>{ra.call(i,fi,Qn,Ro)})}let c2i=function(fi){let Qn=null;if(f$($.beforeSanitizeElements,fi,null),g$(fi))return ll(fi),!0;let ra=Gt(fi.nodeName);if(f$($.uponSanitizeElement,fi,{tagName:ra,allowedTags:Oe}),Mr&&fi.hasChildNodes()&&!MSe(fi.firstElementChild)&&F_(/<[/\w!]/g,fi.innerHTML)&&F_(/<[/\w!]/g,fi.textContent)||fi.nodeType===m4e.progressingInstruction||Mr&&fi.nodeType===m4e.comment&&F_(/<[/\w]/g,fi.data))return ll(fi),!0;if(!Oe[ra]||zi[ra]){if(!zi[ra]&&u2i(ra)&&(Ht.tagNameCheck instanceof RegExp&&F_(Ht.tagNameCheck,ra)||Ht.tagNameCheck instanceof Function&&Ht.tagNameCheck(ra)))return!1;if(Lx&&!Op[ra]){let pv=w(fi)||fi.parentNode,dE=y(fi)||fi.childNodes;if(dE&&pv){let RI=dE.length;for(let CL=RI-1;CL>=0;--CL){let v$=v(dE[CL],!0);v$.__removalCount=(fi.__removalCount||0)+1,pv.insertBefore(v$,S(fi))}}}return ll(fi),!0}return fi instanceof l&&!Hr(fi)||(ra==="noscript"||ra==="noembed"||ra==="noframes")&&F_(/<\/no(script|embed|frames)/i,fi.innerHTML)?(ll(fi),!0):(yo&&fi.nodeType===m4e.text&&(Qn=fi.textContent,Wyt([J,ae,he],pv=>{Qn=d4e(Qn,pv," ")}),fi.textContent!==Qn&&(c4e(i.removed,{element:fi.cloneNode()}),fi.textContent=Qn)),f$($.afterSanitizeElements,fi,null),!1)},d2i=function(fi,Qn,ra){if(Lu&&(Qn==="id"||Qn==="name")&&(ra in e||ra in so))return!1;if(!(_n&&!Vo[Qn]&&F_(oe,Qn))){if(!(sn&&F_(de,Qn))){if(!et[Qn]||Vo[Qn]){if(!(u2i(fi)&&(Ht.tagNameCheck instanceof RegExp&&F_(Ht.tagNameCheck,fi)||Ht.tagNameCheck instanceof Function&&Ht.tagNameCheck(fi))&&(Ht.attributeNameCheck instanceof RegExp&&F_(Ht.attributeNameCheck,Qn)||Ht.attributeNameCheck instanceof Function&&Ht.attributeNameCheck(Qn,fi))||Qn==="is"&&Ht.allowCustomizedBuiltInElements&&(Ht.tagNameCheck instanceof RegExp&&F_(Ht.tagNameCheck,ra)||Ht.tagNameCheck instanceof Function&&Ht.tagNameCheck(ra))))return!1}else if(!Rx[Qn]){if(!F_(De,d4e(ra,xe,""))){if(!((Qn==="src"||Qn==="xlink:href"||Qn==="href")&&fi!=="script"&&iUo(ra,"data:")===0&&h$[fi])){if(!(mn&&!F_(Ce,d4e(ra,xe,"")))){if(ra)return!1}}}}}}return!0},u2i=function(fi){return fi!=="annotation-xml"&&sri(fi,ze)},p2i=function(fi){f$($.beforeSanitizeAttributes,fi,null);let{attributes:Qn}=fi;if(!Qn||g$(fi))return;let ra={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:et,forceKeepAttr:void 0},pv=Qn.length;for(;pv--;){let dE=Qn[pv],{name:RI,namespaceURI:CL,value:v$}=dE,PSe=Gt(RI),vXt=v$,Mx=RI==="value"?vXt:oUo(vXt);if(ra.attrName=PSe,ra.attrValue=Mx,ra.keepAttr=!0,ra.forceKeepAttr=void 0,f$($.uponSanitizeAttribute,fi,ra),Mx=ra.attrValue,jg&&(PSe==="id"||PSe==="name")&&(Ao(RI,fi),Mx=Ir+Mx),Mr&&F_(/((--!?|])>)|<\/(style|title|textarea)/i,Mx)){Ao(RI,fi);continue}if(PSe==="attributename"&&sri(Mx,"href")){Ao(RI,fi);continue}if(ra.forceKeepAttr)continue;if(!ra.keepAttr){Ao(RI,fi);continue}if(!hn&&F_(/\/>/i,Mx)){Ao(RI,fi);continue}yo&&Wyt([J,ae,he],h2i=>{Mx=d4e(Mx,h2i," ")});let m2i=Gt(fi.nodeName);if(!d2i(m2i,PSe,Mx)){Ao(RI,fi);continue}if(k&&typeof g=="object"&&typeof g.getAttributeType=="function"&&!CL)switch(g.getAttributeType(m2i,PSe)){case"TrustedHTML":{Mx=k.createHTML(Mx);break}case"TrustedScriptURL":{Mx=k.createScriptURL(Mx);break}}if(Mx!==vXt)try{CL?fi.setAttributeNS(CL,RI,Mx):fi.setAttribute(RI,Mx),g$(fi)?ll(fi):BQi(i.removed)}catch{Ao(RI,fi)}}f$($.afterSanitizeAttributes,fi,null)},QNo=function Fa(fi){let Qn=null,ra=Mse(fi);for(f$($.beforeSanitizeShadowDOM,fi,null);Qn=ra.nextNode();)f$($.uponSanitizeShadowNode,Qn,null),c2i(Qn),p2i(Qn),Qn.content instanceof n&&Fa(Qn.content);f$($.afterSanitizeShadowDOM,fi,null)};return i.sanitize=function(Fa){let fi=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Qn=null,ra=null,pv=null,dE=null;if(Ia=!Fa,Ia&&(Fa="<!-->"),typeof Fa!="string"&&!MSe(Fa))if(typeof Fa.toString=="function"){if(Fa=Fa.toString(),typeof Fa!="string")throw u4e("dirty is not a string, aborting")}else throw u4e("toString is not a function");if(!i.isSupported)return Fa;if(er||Is(fi),i.removed=[],typeof Fa=="string"&&(Qg=!1),Qg){if(Fa.nodeName){let v$=Gt(Fa.nodeName);if(!Oe[v$]||zi[v$])throw u4e("root node is forbidden and cannot be sanitized in-place")}}else if(Fa instanceof s)Qn=cC("<!---->"),ra=Qn.ownerDocument.importNode(Fa,!0),ra.nodeType===m4e.element&&ra.nodeName==="BODY"||ra.nodeName==="HTML"?Qn=ra:Qn.appendChild(ra);else{if(!ua&&!yo&&!cn&&Fa.indexOf("<")===-1)return k&&tm?k.createHTML(Fa):Fa;if(Qn=cC(Fa),!Qn)return ua?null:tm?T:""}Qn&&Ns&&ll(Qn.firstChild);let RI=Mse(Qg?Fa:Qn);for(;pv=RI.nextNode();)c2i(pv),p2i(pv),pv.content instanceof n&&QNo(pv.content);if(Qg)return Fa;if(ua){if(xm)for(dE=V.call(Qn.ownerDocument);Qn.firstChild;)dE.appendChild(Qn.firstChild);else dE=Qn;return(et.shadowroot||et.shadowrootmode)&&(dE=G.call(t,dE,!0)),dE}let CL=cn?Qn.outerHTML:Qn.innerHTML;return cn&&Oe["!doctype"]&&Qn.ownerDocument&&Qn.ownerDocument.doctype&&Qn.ownerDocument.doctype.name&&F_(YQi,Qn.ownerDocument.doctype.name)&&(CL="<!DOCTYPE "+Qn.ownerDocument.doctype.name+`>
`+CL),yo&&Wyt([J,ae,he],v$=>{CL=d4e(CL,v$," ")}),k&&tm?k.createHTML(CL):CL},i.setConfig=function(){let Fa=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Is(Fa),er=!0},i.clearConfig=function(){Ro=null,er=!1},i.isValidAttribute=function(Fa,fi,Qn){Ro||Is({});let ra=Gt(Fa),pv=Gt(fi);return d2i(ra,pv,Qn)},i.addHook=function(Fa,fi){typeof fi=="function"&&c4e($[Fa],fi)},i.removeHook=function(Fa,fi){if(fi!==void 0){let Qn=eUo($[Fa],fi);return Qn===-1?void 0:tUo($[Fa],Qn,1)[0]}return BQi($[Fa])},i.removeHooks=function(Fa){$[Fa]=[]},i.removeAllHooks=function(){$=qQi()},i}var Yle=XQi();var hri=Object.freeze(["a","abbr","b","bdo","blockquote","br","caption","cite","code","col","colgroup","dd","del","details","dfn","div","dl","dt","em","figcaption","figure","h1","h2","h3","h4","h5","h6","hr","i","img","ins","kbd","label","li","mark","ol","p","pre","q","rp","rt","ruby","s","samp","small","small","source","span","strike","strong","sub","summary","sup","table","tbody","td","tfoot","th","thead","time","tr","tt","u","ul","var","video","wbr"]),ZQi=Object.freeze(["href","target","src","alt","title","for","name","role","tabindex","x-dispatch","required","checked","placeholder","type","start","width","height","align"]),mri="vscode-relative-path";function JQi(a,i){if(i.override==="*")return!0;try{let e=new URL(a,mri+"://");return!!(i.override.includes(e.protocol.replace(/:$/,""))||i.allowRelativePaths&&e.protocol===mri+":"&&!a.trim().toLowerCase().startsWith(mri))}catch{return!1}}function bUo(a,i){Yle.addHook("afterSanitizeAttributes",e=>{for(let t of["href","src"])if(e.hasAttribute(t)){let o=e.getAttribute(t);t==="href"?!o.startsWith("#")&&!JQi(o,a)&&e.removeAttribute(t):JQi(o,i)||e.removeAttribute(t)}})}var SUo=Object.freeze({ALLOWED_TAGS:[...hri],ALLOWED_ATTR:[...ZQi],ALLOW_UNKNOWN_PROTOCOLS:!0});function Hyt(a,i){return e6i(a,i,"trusted")}function e6i(a,i,e){try{let t={...SUo};i?.allowedTags&&(i.allowedTags.override&&(t.ALLOWED_TAGS=[...i.allowedTags.override]),i.allowedTags.augment&&(t.ALLOWED_TAGS=[...t.ALLOWED_TAGS??[],...i.allowedTags.augment]));let o=[...ZQi];i?.allowedAttributes&&(i.allowedAttributes.override&&(o=[...i.allowedAttributes.override]),i.allowedAttributes.augment&&(o=[...o,...i.allowedAttributes.augment])),o=o.map(s=>typeof s=="string"?s.toLowerCase():{attributeName:s.attributeName.toLowerCase(),shouldKeep:s.shouldKeep});let n=new Set(o.map(s=>typeof s=="string"?s:s.attributeName)),r=new Map;for(let s of o)typeof s=="string"?r.delete(s):r.set(s.attributeName,s);return t.ALLOWED_ATTR=Array.from(n),bUo({override:i?.allowedLinkProtocols?.override??[Q.http,Q.https],allowRelativePaths:i?.allowRelativeLinkPaths??!1},{override:i?.allowedMediaProtocols?.override??[Q.http,Q.https],allowRelativePaths:i?.allowRelativeMediaPaths??!1}),i?.replaceWithPlaintext&&Yle.addHook("uponSanitizeElement",yUo),r.size&&Yle.addHook("uponSanitizeAttribute",(s,l)=>{let c=r.get(l.attrName);if(c){let u=c.shouldKeep(s,l);typeof u=="string"?(l.keepAttr=!0,l.attrValue=u):l.keepAttr=u}else l.keepAttr=n.has(l.attrName)}),e==="dom"?Yle.sanitize(a,{...t,RETURN_DOM_FRAGMENT:!0}):Yle.sanitize(a,{...t,RETURN_TRUSTED_TYPE:!0})}finally{Yle.removeAllHooks()}}var IUo=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],yUo=(a,i,e)=>{if(!i.allowedTags[i.tagName]&&i.tagName!=="body"){let t=gri(a);t&&(a.nodeType===Node.COMMENT_NODE?a.parentElement?.insertBefore(t,a):a.parentElement?.replaceChild(t,a))}};function gri(a){if(!a.ownerDocument)return;let i,e;if(a.nodeType===Node.COMMENT_NODE)i=`<!--${a.textContent}-->`;else if(a instanceof Element){let r=a.tagName.toLowerCase(),s=IUo.includes(r),l=a.attributes.length?" "+Array.from(a.attributes).map(c=>`${c.name}="${c.value}"`).join(" "):"";i=`<${r}${l}>`,s||(e=`</${r}>`)}else return;let t=document.createDocumentFragment(),o=a.ownerDocument.createTextNode(i);for(t.appendChild(o);a.firstChild;)t.appendChild(a.firstChild);let n=e?a.ownerDocument.createTextNode(e):void 0;return n&&t.appendChild(n),t}function NP(a,i,e){let t=e6i(i,e,"dom");vi(a,t)}var wUo=new RegExp(`(\\\\)?\\$\\((${q.iconNameExpression}(?:${q.iconModifierExpression})?)\\)`,"g");function Un(a){let i=new Array,e,t=0,o=0;for(;(e=wUo.exec(a))!==null;){o=e.index||0,t<o&&i.push(a.substring(t,o)),t=(e.index||0)+e[0].length;let[,n,r]=e;i.push(n?`$(${r})`:Sn({id:r}))}return t<a.length&&i.push(a.substring(t)),i}function Sn(a){let i=_("span");return i.classList.add(...q.asClassNameArray(a)),i}function CUo(a){try{let i=A.parse(a);if(i.scheme===Q.file){let e=i.fsPath,t=i.fragment;return xCe(t?`${e}#${t}`:e)}}catch{}return""}var vri=Object.freeze({image:({href:a,title:i,text:e})=>{let t=[],o=[];return a&&({href:a,dimensions:t}=Pyt(a),o.push(`src="${xCe(a)}"`)),e&&o.push(`alt="${xCe(e)}"`),i&&o.push(`title="${xCe(i)}"`),t.length&&(o=o.concat(t)),"<img "+o.join(" ")+">"},paragraph({tokens:a}){return`<p>${this.parser.parseInline(a)}</p>`},link({href:a,title:i,tokens:e}){let t=this.parser.parseInline(e);return typeof a!="string"?"":(a===t&&(t=Myt(t)),i=typeof i=="string"?xCe(Myt(i)):"",a=Myt(a),!i&&a.startsWith(`${Q.file}:`)&&(i=CUo(a)),a=a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;"),`<a href="${a}" title="${i||a}" draggable="false">${t}</a>`)}});function xUo(a){return function(i){let{tokens:e}=i,t=e[0];if(t?.type!=="paragraph")return a.call(this,i);let o=t.tokens;if(!o||o.length===0)return a.call(this,i);let n=o[0];if(n?.type!=="text")return a.call(this,i);let r=/^\s*\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]\s*?\n*/i,s=n.raw.match(r);if(!s)return a.call(this,i);n.raw=n.raw.replace(r,""),n.text=n.text.replace(r,"");let l={note:"info",tip:"light-bulb",important:"comment",warning:"alert",caution:"stop"},c=s[1],u=c.charAt(0).toUpperCase()+c.slice(1).toLowerCase(),p=c.toLowerCase(),h=Sn({id:l[p]}).outerHTML,g=this.parser.parse(e);return`<blockquote data-severity="${p}"><p><span>${h}${u}</span>${g.substring(3)}</blockquote>
`}}function Gf(a,i={},e){let t=new N,o=!1,n=new Gj(...i.markedExtensions??[]),{renderer:r,codeBlocks:s,syncCodeBlocks:l}=EUo(n,i,a),c=TUo(a),u;if(i.fillInIncompleteTokens){let f={...n.defaults,...i.markedOptions,renderer:r},v=n.lexer(c,f),b=VUo(v);u=n.parser(b,f)}else u=n.parse(c,{...i?.markedOptions,renderer:r,async:!1});a.supportThemeIcons&&(u=Un(u).map(v=>typeof v=="string"?v:v.outerHTML).join(""));let p=document.createElement("div"),h=n6i(a,i.sanitizerConfig??{});NP(p,u,h),kUo(a,i,p);let g;if(e?(g=e,vi(e,...p.childNodes)):g=p,s.length>0)Promise.all(s).then(f=>{if(o)return;let v=new Map(f),b=g.querySelectorAll("div[data-code]");for(let S of b){let y=v.get(S.dataset.code??"");y&&vi(S,y)}i.asyncRenderCallback?.()});else if(l.length>0){let f=new Map(l),v=g.querySelectorAll("div[data-code]");for(let b of v){let S=f.get(b.dataset.code??"");S&&vi(b,S)}}if(i.asyncRenderCallback)for(let f of g.getElementsByTagName("img")){let v=t.add(j(f,"load",()=>{v.dispose(),i.asyncRenderCallback()}))}if(i.actionHandler){let f=v=>{let b=new Cn(Re(g),v);!b.leftButton&&!b.middleButton||t6i(a,i,b)};t.add(j(g,"click",f)),t.add(j(g,"auxclick",f)),t.add(j(g,"keydown",v=>{let b=new gi(v);!b.equals(10)&&!b.equals(3)||t6i(a,i,b)}))}for(let f of[...g.getElementsByTagName("input")])if(f.attributes.getNamedItem("type")?.value==="checkbox")f.setAttribute("disabled","");else if(i.sanitizerConfig?.replaceWithPlaintext){let v=gri(f);v?f.parentElement?.replaceChild(v,f):f.remove()}else f.remove();return{element:g,dispose:()=>{o=!0,t.dispose()}}}function kUo(a,i,e){for(let t of e.querySelectorAll("img, audio, video, source")){let o=t.getAttribute("src");if(o){let n=o;try{a.baseUri&&(n=bri(A.from(a.baseUri),n))}catch{}if(t.setAttribute("src",i6i(a,n,!0)),i.sanitizerConfig?.remoteImageIsAllowed){let r=A.parse(n);r.scheme!==Q.file&&r.scheme!==Q.data&&!i.sanitizerConfig.remoteImageIsAllowed(r)&&t.replaceWith(_("",void 0,t.outerHTML))}}}for(let t of e.querySelectorAll("a")){let o=t.getAttribute("href");if(t.setAttribute("href",""),!o||/^data:|javascript:/i.test(o)||/^command:/i.test(o)&&!a.isTrusted||/^command:(\/\/\/)?_workbench\.downloadResource/i.test(o))t.replaceWith(...t.childNodes);else{let n=i6i(a,o,!1);a.baseUri&&(n=bri(A.from(a.baseUri),o)),t.dataset.href=n}}}function EUo(a,i,e){let t=new a.Renderer(i.markedOptions);t.image=vri.image,t.link=vri.link,t.paragraph=vri.paragraph,e.supportAlertSyntax&&(t.blockquote=xUo(t.blockquote));let o=[],n=[];return i.codeBlockRendererSync?t.code=({text:r,lang:s,raw:l})=>{let c=Uj.nextId(),u=i.codeBlockRendererSync(o6i(s),r,l);return n.push([c,u]),`<div class="code" data-code="${c}">${mr(r)}</div>`}:i.codeBlockRenderer&&(t.code=({text:r,lang:s})=>{let l=Uj.nextId(),c=i.codeBlockRenderer(o6i(s),r);return o.push(c.then(u=>[l,u])),`<div class="code" data-code="${l}">${mr(r)}</div>`}),e.supportHtml||(t.html=({text:r})=>i.sanitizerConfig?.replaceWithPlaintext?mr(r):(e.isTrusted?r.match(/^(<span[^>]+>)|(<\/\s*span>)$/):void 0)?r:""),{renderer:t,codeBlocks:o,syncCodeBlocks:n}}function TUo(a){let i=a.value;return i.length>1e5&&(i=`${i.substr(0,1e5)}\u2026`),a.supportThemeIcons&&(i=yQi(i)),i}function t6i(a,i,e){let t=e.target.closest("a[data-href]");if(Do(t))try{let o=t.dataset.href;o&&(a.baseUri&&(o=bri(A.from(a.baseUri),o)),i.actionHandler?.(o,a))}catch(o){mt(o)}finally{e.preventDefault(),e.stopPropagation()}}function _Uo(a,i){let e;try{e=am(decodeURIComponent(i))}catch{}return e?(e=Fx(e,t=>{if(a.uris&&a.uris[t])return A.revive(a.uris[t])}),encodeURIComponent(JSON.stringify(e))):i}function i6i(a,i,e){let t=a.uris&&a.uris[i],o=A.revive(t);return e?i.startsWith(Q.data+":")?i:(o||(o=A.parse(i)),vn.uriToBrowserUri(o).toString(!0)):!o||A.parse(i).toString()===o.toString()?i:(o.query&&(o=o.with({query:_Uo(a,o.query)})),o.toString())}function o6i(a){if(!a)return"";let i=a.split(/[\s+|:|,|\{|\?]/,1);return i.length?i[0]:a}function bri(a,i){return/^\w[\w\d+.-]*:/.test(i)?i:a.path.endsWith("/")?JXt(a,i).toString():JXt(ci(a),i).toString()}function DUo(a,i,e={}){let t=n6i(i,e);return Hyt(a,t)}var Sri=Object.freeze([...hri,"input"]),g4e=Object.freeze(["align","autoplay","alt","colspan","controls","draggable","height","href","loop","muted","playsinline","poster","rowspan","src","target","title","type","width","start","checked","disabled","value","data-code","data-href","data-severity",{attributeName:"style",shouldKeep:(a,i)=>a.tagName==="SPAN"&&i.attrName==="style"?/^(color\:(#[0-9a-fA-F]+|var\(--vscode(-[a-zA-Z0-9]+)+\));)?(background-color\:(#[0-9a-fA-F]+|var\(--vscode(-[a-zA-Z0-9]+)+\));)?(border-radius:[0-9]+px;)?$/.test(i.attrValue):!1},{attributeName:"class",shouldKeep:(a,i)=>a.tagName==="SPAN"&&i.attrName==="class"?/^codicon codicon-[a-z\-]+( codicon-modifier-[a-z\-]+)?$/.test(i.attrValue):!1}]);function n6i(a,i){let e=a.isTrusted??!1,t=[Q.http,Q.https,Q.mailto,Q.file,Q.vscodeFileResource,Q.vscodeRemote,Q.vscodeRemoteResource,Q.vscodeNotebookCell,Q.internal];return e&&t.push(Q.command),i.allowedLinkSchemes?.augment&&t.push(...i.allowedLinkSchemes.augment),{allowedTags:{override:i.allowedTags?.override??Sri},allowedAttributes:{override:i.allowedAttributes?.override??g4e},allowedLinkProtocols:{override:t},allowRelativeLinkPaths:!!a.baseUri,allowedMediaProtocols:{override:[Q.http,Q.https,Q.data,Q.file,Q.vscodeFileResource,Q.vscodeRemote,Q.vscodeRemoteResource]},allowRelativeMediaPaths:!!a.baseUri,replaceWithPlaintext:i.replaceWithPlaintext}}function Da(a,i){if(typeof a=="string")return a;let e=a.value??"";e.length>1e5&&(e=`${e.substr(0,1e5)}\u2026`);let t=RUo();i?.includeCodeBlocksFences&&(t.code=MUo),i?.useLinkFormatter&&(t.link=PUo);let o=WQi(e,{async:!1,renderer:t});return DUo(o,{isTrusted:!1},{}).toString().replace(/&(#\d+|[a-zA-Z]+);/g,n=>LUo.get(n)??n).trim()}var LUo=new Map([["&quot;",'"'],["&nbsp;"," "],["&amp;","&"],["&#39;","'"],["&lt;","<"],["&gt;",">"]]);function RUo(){let a=new dY;return a.code=({text:i})=>mr(i),a.blockquote=({text:i})=>i+`
`,a.html=i=>"",a.heading=function({tokens:i}){return this.parser.parseInline(i)+`
`},a.hr=()=>"",a.list=function({items:i}){return i.map(e=>this.listitem(e)).join(`
`)+`
`},a.listitem=({text:i})=>i+`
`,a.paragraph=function({tokens:i}){return this.parser.parseInline(i)+`
`},a.table=function({header:i,rows:e}){return i.map(t=>this.tablecell(t)).join(" ")+`
`+e.map(t=>t.map(o=>this.tablecell(o)).join(" ")).join(`
`)+`
`},a.tablerow=({text:i})=>i,a.tablecell=function({tokens:i}){return this.parser.parseInline(i)},a.strong=({text:i})=>i,a.em=({text:i})=>i,a.codespan=({text:i})=>mr(i),a.br=i=>`
`,a.del=({text:i})=>i,a.image=i=>"",a.text=({text:i})=>i,a.link=({text:i})=>i,a}var MUo=({text:a})=>`
\`\`\`
${mr(a)}
\`\`\`
`,PUo=({text:a,href:i})=>{try{if(i){let e=A.parse(i);return a.trim()||He(e)}}catch{return a.trim()||jo(i)}return a};function h4e(a){let i="";return a.forEach(e=>{i+=e.raw}),i}function r6i(a){if(a.tokens)for(let i=a.tokens.length-1;i>=0;i--){let e=a.tokens[i];if(e.type==="text"){let t=e.raw.split(`
`),o=t[t.length-1];if(o.includes("`"))return HUo(a);if(o.includes("**"))return $Uo(a);if(o.match(/\*\w/))return UUo(a);if(o.match(/(^|\s)__\w/))return jUo(a);if(o.match(/(^|\s)_\w/))return zUo(a);if(AUo(o)||NUo(o)&&a.tokens.slice(0,i).some(n=>n.type==="text"&&n.raw.match(/\[[^\]]*$/))){let n=a.tokens.slice(i+1);return n[0]?.type==="link"&&n[1]?.type==="text"&&n[1].raw.match(/^ *"[^"]*$/)||o.match(/^[^"]* +"[^"]*$/)?GUo(a):KUo(a)}else if(o.match(/(^|\s)\[\w*[^\]]*$/))return qUo(a)}}}function AUo(a){return!!a.match(/(^|\s)\[.*\]\(\w*/)}function NUo(a){return!!a.match(/^[^\[]*\]\([^\)]*$/)}function OUo(a){let i=a.items[a.items.length-1],e=i.tokens?i.tokens[i.tokens.length-1]:void 0,t=c=>{let p=c.items.at(-1)?.tokens.at(-1);return p?.type==="heading"||p?.type==="list"&&t(p)},o;if(e?.type==="text"&&!("inRawBlock"in i))o=r6i(e);else if(t(a)){let c=uY(a.raw.trim()+" &nbsp;")[0];return c.type!=="list"?void 0:c}if(!o||o.type!=="paragraph")return;let n=h4e(a.items.slice(0,-1)),r=i.raw.match(/^(\s*(-|\d+\.|\*) +)/)?.[0];if(!r)return;let s=r+h4e(i.tokens.slice(0,-1))+o.raw,l=uY(n+s)[0];if(l.type==="list")return l}function FUo(a,i){if(a.raw.match(/-\s*$/))return uY(i+" &nbsp;")}var WUo=3;function VUo(a){for(let i=0;i<WUo;i++){let e=BUo(a);if(e)a=e;else break}return a}function BUo(a){let i,e;for(i=0;i<a.length;i++){let o=a[i];if(o.type==="paragraph"&&o.raw.match(/(\n|^)\|/)){e=QUo(a.slice(i));break}}let t=a.at(-1);if(!e&&t?.type==="list"){let o=OUo(t);o&&(e=[o],i=a.length-1)}if(!e&&t?.type==="paragraph"){let o=r6i(t);o&&(e=[o],i=a.length-1)}if(e){let o=[...a.slice(0,i),...e];return o.links=a.links,o}if(t?.type==="heading"){let o=FUo(t,h4e(a));if(o)return o}return null}function HUo(a){return pY(a,"`")}function UUo(a){return pY(a,"*")}function zUo(a){return pY(a,"_")}function KUo(a){return pY(a,")",!1)}function GUo(a){return pY(a,'")',!1)}function qUo(a){return pY(a,"](https://microsoft.com)",!1)}function $Uo(a){return pY(a,"**")}function jUo(a){return pY(a,"__")}function pY(a,i,e=!0){let t=h4e(Array.isArray(a)?a:[a]),o=e?t.trimEnd():t;return uY(o+i)[0]}function QUo(a){let i=h4e(a),e=i.split(`
`),t,o=!1;for(let n=0;n<e.length;n++){let r=e[n].trim();if(typeof t>"u"&&r.match(/^\s*\|/)){let s=r.match(/(\|[^\|]+)(?=\||$)/g);s&&(t=s.length)}else if(typeof t=="number")if(r.match(/^\s*\|/)){if(n!==e.length-1)return;o=!0}else return}if(typeof t=="number"&&t>0){let n=o?e.slice(0,-1).join(`
`):i,r=!!n.match(/\|\s*$/),s=n+(r?"":"|")+`
|${" --- |".repeat(t)}`;return uY(s)}}function Xle(a,i,e){let t=e.mode===1?e.offset:e.offset+e.size,o=e.mode===1?e.offset+e.size:e.offset;return e.position===0?i<=a-t?{position:t,result:"ok"}:i<=o?{position:o-i,result:"flipped"}:{position:Math.max(a-i,0),result:"overlap"}:i<=o?{position:o-i,result:"ok"}:i<=a-t&&o<i/2?{position:t,result:"flipped"}:{position:0,result:"overlap"}}function Uyt(a,i,e,t){let o=t?.anchorAlignment??0,n=t?.anchorPosition??0,r=t?.anchorAxisAlignment??0,s,l;if(r===0){let p={offset:e.top-a.top,size:e.height,position:n===0?0:1},h={offset:e.left,size:e.width,position:o===0?0:1,mode:1},g=Xle(a.height,i.height,p);s=g.position+a.top,g.result==="flipped"&&(n=n===0?1:0),lS.intersects({start:s,end:s+i.height},{start:p.offset,end:p.offset+p.size})&&(h.mode=0);let f=Xle(a.width,i.width,h);l=f.position,f.result==="flipped"&&(o=o===0?1:0)}else{let p={offset:e.left,size:e.width,position:o===0?0:1},h={offset:e.top,size:e.height,position:n===0?0:1,mode:1},g=Xle(a.width,i.width,p);l=g.position,g.result==="flipped"&&(o=o===0?1:0),lS.intersects({start:l,end:l+i.width},{start:p.offset,end:p.offset+p.size})&&(h.mode=0);let f=Xle(a.height,i.height,h);s=f.position+a.top,f.result==="flipped"&&(n=n===0?1:0)}let c=a.width-(l+i.width),u=a.height-(s+i.height);return{top:s,left:l,bottom:u,right:c,anchorAlignment:o,anchorPosition:n}}function Iri(a){let i=a;return!!i&&typeof i.x=="number"&&typeof i.y=="number"}function v4e(a){if(Do(a)){let i=ir(a),e=Y9(a);return{top:i.top*e,left:i.left*e,width:i.width*e,height:i.height*e}}else return Iri(a)?{top:a.y,left:a.x,width:a.width||1,height:a.height||2}:{top:a.posy,left:a.posx,width:2,height:2}}var TCe=class a extends x{constructor(e,t){super();this.container=null;this.useFixedPosition=!1;this.useShadowDOM=!1;this.delegate=null;this.toDisposeOnClean=x.None;this.toDisposeOnSetContainer=x.None;this.shadowRoot=null;this.shadowRootHostElement=null;this.view=_(".context-view"),vo(this.view),this.setContainer(e,t),this._register(Z(()=>this.setContainer(null,1)))}static{this.BUBBLE_UP_EVENTS=["click","keydown","focus","blur"]}static{this.BUBBLE_DOWN_EVENTS=["click"]}setContainer(e,t){this.useFixedPosition=t!==1;let o=this.useShadowDOM;if(this.useShadowDOM=t===3,!(e===this.container&&o===this.useShadowDOM)&&(this.container&&(this.toDisposeOnSetContainer.dispose(),this.view.remove(),this.shadowRoot&&(this.shadowRoot=null,this.shadowRootHostElement?.remove(),this.shadowRootHostElement=null),this.container=null),e)){if(this.container=e,this.useShadowDOM){this.shadowRootHostElement=_(".shadow-root-host"),this.container.appendChild(this.shadowRootHostElement),this.shadowRoot=this.shadowRootHostElement.attachShadow({mode:"open"});let r=document.createElement("style");r.textContent=YUo,this.shadowRoot.appendChild(r),this.shadowRoot.appendChild(this.view),this.shadowRoot.appendChild(_("slot"))}else this.container.appendChild(this.view);let n=new N;a.BUBBLE_UP_EVENTS.forEach(r=>{n.add(Jo(this.container,r,s=>{this.onDOMEvent(s,!1)}))}),a.BUBBLE_DOWN_EVENTS.forEach(r=>{n.add(Jo(this.container,r,s=>{this.onDOMEvent(s,!0)},!0))}),this.toDisposeOnSetContainer=n}}show(e){this.isVisible()&&this.hide(),Rt(this.view),this.view.className="context-view monaco-component",this.view.style.top="0px",this.view.style.left="0px",this.view.style.zIndex=`${2575+(e.layer??0)}`,this.view.style.position=this.useFixedPosition?"fixed":"absolute",un(this.view),this.toDisposeOnClean=e.render(this.view)||x.None,this.delegate=e,this.doLayout(),this.delegate.focus?.()}getViewElement(){return this.view}layout(){if(this.isVisible()){if(this.delegate.canRelayout===!1&&!(dc&&yg.pointerEvents)){this.hide();return}this.delegate?.layout?.(),this.doLayout()}}doLayout(){if(!this.isVisible())return;let e=v4e(this.delegate.getAnchor()),t=this.container?Re(this.container):Ki(),o={top:t.pageYOffset,left:t.pageXOffset,width:t.innerWidth,height:t.innerHeight},n={width:zl(this.view),height:mh(this.view)},r=this.delegate.anchorPosition,s=this.delegate.anchorAlignment,l=this.delegate.anchorAxisAlignment,{top:c,left:u}=Uyt(o,n,e,{anchorAlignment:s,anchorPosition:r,anchorAxisAlignment:l});this.view.classList.remove("top","bottom","left","right"),this.view.classList.add(r===0?"bottom":"top"),this.view.classList.add(s===0?"left":"right"),this.view.classList.toggle("fixed",this.useFixedPosition);let p=ir(this.container),h=this.container.scrollTop||0,g=this.container.scrollLeft||0;this.view.style.top=`${c-(this.useFixedPosition?ir(this.view).top:p.top)+h}px`,this.view.style.left=`${u-(this.useFixedPosition?ir(this.view).left:p.left)+g}px`,this.view.style.width="initial"}hide(e){let t=this.delegate;this.delegate=null,t?.onHide&&t.onHide(e),this.toDisposeOnClean.dispose(),vo(this.view)}isVisible(){return!!this.delegate}onDOMEvent(e,t){this.delegate&&(this.delegate.onDOMEvent?this.delegate.onDOMEvent(e,Re(e).document.activeElement):t&&!ts(e.target,this.container)&&this.hide())}dispose(){this.hide(),super.dispose()}},YUo=`
	:host {
		all: initial; /* 1st rule so subsequent properties are reset. */
	}

	.codicon[class*='codicon-'] {
		font: normal normal normal 16px/1 codicon;
		display: inline-block;
		text-decoration: none;
		text-rendering: auto;
		text-align: center;
		-webkit-font-smoothing: antialiased;
		-moz-osx-font-smoothing: grayscale;
		user-select: none;
		-webkit-user-select: none;
		-ms-user-select: none;
	}

	:host {
		font-family: -apple-system, BlinkMacSystemFont, "Segoe WPC", "Segoe UI", "HelveticaNeue-Light", system-ui, "Ubuntu", "Droid Sans", sans-serif;
	}

	:host-context(.mac) { font-family: -apple-system, BlinkMacSystemFont, sans-serif; }
	:host-context(.mac:lang(zh-Hans)) { font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", sans-serif; }
	:host-context(.mac:lang(zh-Hant)) { font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", sans-serif; }
	:host-context(.mac:lang(ja)) { font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic Pro", sans-serif; }
	:host-context(.mac:lang(ko)) { font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Nanum Gothic", "AppleGothic", sans-serif; }

	:host-context(.windows) { font-family: "Segoe WPC", "Segoe UI", sans-serif; }
	:host-context(.windows:lang(zh-Hans)) { font-family: "Segoe WPC", "Segoe UI", "Microsoft YaHei", sans-serif; }
	:host-context(.windows:lang(zh-Hant)) { font-family: "Segoe WPC", "Segoe UI", "Microsoft Jhenghei", sans-serif; }
	:host-context(.windows:lang(ja)) { font-family: "Segoe WPC", "Segoe UI", "Yu Gothic UI", "Meiryo UI", sans-serif; }
	:host-context(.windows:lang(ko)) { font-family: "Segoe WPC", "Segoe UI", "Malgun Gothic", "Dotom", sans-serif; }

	:host-context(.linux) { font-family: system-ui, "Ubuntu", "Droid Sans", sans-serif; }
	:host-context(.linux:lang(zh-Hans)) { font-family: system-ui, "Ubuntu", "Droid Sans", "Source Han Sans SC", "Source Han Sans CN", "Source Han Sans", sans-serif; }
	:host-context(.linux:lang(zh-Hant)) { font-family: system-ui, "Ubuntu", "Droid Sans", "Source Han Sans TC", "Source Han Sans TW", "Source Han Sans", sans-serif; }
	:host-context(.linux:lang(ja)) { font-family: system-ui, "Ubuntu", "Droid Sans", "Source Han Sans J", "Source Han Sans JP", "Source Han Sans", sans-serif; }
	:host-context(.linux:lang(ko)) { font-family: system-ui, "Ubuntu", "Droid Sans", "Source Han Sans K", "Source Han Sans JR", "Source Han Sans", "UnDotum", "FBaekmuk Gulim", sans-serif; }
`;var a6i={showInstantHover:()=>{},showDelayedHover:()=>{},setupDelayedHover:()=>x.None,setupDelayedHoverAtMouse:()=>x.None,hideHover:()=>{},showAndFocusLastHover:()=>{},setupManagedHover:()=>({dispose:()=>{},show:()=>{},hide:()=>{},update:()=>{}}),showManagedHover:()=>{}};function l6i(a){a6i=a}function Up(){return a6i}var Jle=_,c6i="selectOption.entry.template",yri=class{get templateId(){return c6i}renderTemplate(i){let e=Object.create(null);return e.root=i,e.text=M(i,Jle(".option-text")),e.detail=M(i,Jle(".option-detail")),e.decoratorRight=M(i,Jle(".option-decorator-right")),e}renderElement(i,e,t){let o=t,n=i.text,r=i.detail,s=i.decoratorRight,l=i.isDisabled;o.text.textContent=n,o.detail.textContent=r||"",o.decoratorRight.textContent=s||"",l?o.root.classList.add("option-disabled"):o.root.classList.remove("option-disabled"),i.isSeparator?(o.root.classList.add("option-separator"),o.root.classList.add("option-disabled")):o.root.classList.remove("option-separator")}disposeTemplate(i){}},zyt=class a extends x{constructor(e,t,o,n,r){super();this.options=[];this._currentSelection=0;this._hasDetails=!1;this._selectionDetailsDisposables=this._register(new N);this._skipLayout=!1;this._sticky=!1;this._isVisible=!1,this.styles=n,this.selectBoxOptions=r||Object.create(null),typeof this.selectBoxOptions.minBottomMargin!="number"?this.selectBoxOptions.minBottomMargin=a.DEFAULT_DROPDOWN_MINIMUM_BOTTOM_MARGIN:this.selectBoxOptions.minBottomMargin<0&&(this.selectBoxOptions.minBottomMargin=0),this.selectElement=document.createElement("select"),this.selectElement.className="monaco-select-box",typeof this.selectBoxOptions.ariaLabel=="string"&&this.selectElement.setAttribute("aria-label",this.selectBoxOptions.ariaLabel),typeof this.selectBoxOptions.ariaDescription=="string"&&this.selectElement.setAttribute("aria-description",this.selectBoxOptions.ariaDescription),this._onDidSelect=new E,this._register(this._onDidSelect),this.registerListeners(),this.constructSelectDropDown(o),this.selected=t||0,e&&this.setOptions(e,t),this.initStyleSheet()}static{this.DEFAULT_DROPDOWN_MINIMUM_BOTTOM_MARGIN=32}static{this.DEFAULT_DROPDOWN_MINIMUM_TOP_MARGIN=2}static{this.DEFAULT_MINIMUM_VISIBLE_OPTIONS=3}setTitle(e){!this._hover&&e?this._hover=this._register(Up().setupManagedHover(Ri("mouse"),this.selectElement,e)):this._hover&&this._hover.update(e)}getHeight(){return 22}getTemplateId(){return c6i}constructSelectDropDown(e){this.contextViewProvider=e,this.selectDropDownContainer=_(".monaco-select-box-dropdown-container"),this.selectionDetailsPane=M(this.selectDropDownContainer,Jle(".select-box-details-pane"));let t=M(this.selectDropDownContainer,Jle(".select-box-dropdown-container-width-control")),o=M(t,Jle(".width-control-div"));this.widthControlElement=document.createElement("span"),this.widthControlElement.className="option-text-width-control",M(o,this.widthControlElement),this._dropDownPosition=0,this.styleElement=Cr(this.selectDropDownContainer),this.selectDropDownContainer.setAttribute("draggable","true"),this._register(j(this.selectDropDownContainer,re.DRAG_START,n=>{Xt.stop(n,!0)}))}registerListeners(){this._register(Jo(this.selectElement,"change",t=>{this.selected=t.target.selectedIndex,this._onDidSelect.fire({index:t.target.selectedIndex,selected:t.target.value}),this.options[this.selected]&&this.options[this.selected].text&&this.setTitle(this.options[this.selected].text)})),this._register(j(this.selectElement,re.CLICK,t=>{Xt.stop(t),this._isVisible?this.hideSelectDropDown(!0):this.showSelectDropDown()})),this._register(j(this.selectElement,re.MOUSE_DOWN,t=>{Xt.stop(t)}));let e;this._register(j(this.selectElement,"touchstart",t=>{e=this._isVisible})),this._register(j(this.selectElement,"touchend",t=>{Xt.stop(t),e?this.hideSelectDropDown(!0):this.showSelectDropDown()})),this._register(j(this.selectElement,re.KEY_DOWN,t=>{let o=new gi(t),n=!1;Ze?(o.keyCode===18||o.keyCode===16||o.keyCode===10||o.keyCode===3)&&(n=!0):(o.keyCode===18&&o.altKey||o.keyCode===16&&o.altKey||o.keyCode===10||o.keyCode===3)&&(n=!0),n&&(this.showSelectDropDown(),Xt.stop(t,!0))}))}get onDidSelect(){return this._onDidSelect.event}setOptions(e,t){$i(this.options,e)||(this.options=e,this.selectElement.options.length=0,this._hasDetails=!1,this._cachedMaxDetailsHeight=void 0,this.options.forEach((o,n)=>{this.selectElement.add(this.createOption(o.text,n,o.isDisabled)),typeof o.description=="string"&&(this._hasDetails=!0)})),t!==void 0&&(this.select(t),this._currentSelection=this.selected)}setEnabled(e){this.selectElement.disabled=!e}setOptionsList(){this.selectList?.splice(0,this.selectList.length,this.options)}select(e){e>=0&&e<this.options.length?this.selected=e:e>this.options.length-1?this.select(this.options.length-1):this.selected<0&&(this.selected=0),this.selectElement.selectedIndex=this.selected,this.options[this.selected]&&this.options[this.selected].text&&this.setTitle(this.options[this.selected].text)}setAriaLabel(e){this.selectBoxOptions.ariaLabel=e,this.selectElement.setAttribute("aria-label",this.selectBoxOptions.ariaLabel)}focus(){this.selectElement&&(this.selectElement.tabIndex=0,this.selectElement.focus())}blur(){this.selectElement&&(this.selectElement.tabIndex=-1,this.selectElement.blur())}setFocusable(e){this.selectElement.tabIndex=e?0:-1}render(e){this.container=e,e.classList.add("select-container"),e.appendChild(this.selectElement),this.styleSelectElement()}initStyleSheet(){let e=[];this.styles.listFocusBackground&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.focused { background-color: ${this.styles.listFocusBackground} !important; }`),this.styles.listFocusForeground&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.focused { color: ${this.styles.listFocusForeground} !important; }`),this.styles.decoratorRightForeground&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row:not(.focused) .option-decorator-right { color: ${this.styles.decoratorRightForeground}; }`),this.styles.selectBackground&&this.styles.selectBorder&&this.styles.selectBorder!==this.styles.selectBackground?(e.push(`.monaco-select-box-dropdown-container { border: 1px solid ${this.styles.selectBorder} } `),e.push(`.monaco-select-box-dropdown-container > .select-box-details-pane.border-top { border-top: 1px solid ${this.styles.selectBorder} } `),e.push(`.monaco-select-box-dropdown-container > .select-box-details-pane.border-bottom { border-bottom: 1px solid ${this.styles.selectBorder} } `)):this.styles.selectListBorder&&(e.push(`.monaco-select-box-dropdown-container > .select-box-details-pane.border-top { border-top: 1px solid ${this.styles.selectListBorder} } `),e.push(`.monaco-select-box-dropdown-container > .select-box-details-pane.border-bottom { border-bottom: 1px solid ${this.styles.selectListBorder} } `)),this.styles.listHoverForeground&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row:not(.option-disabled):not(.focused):hover { color: ${this.styles.listHoverForeground} !important; }`),this.styles.listHoverBackground&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row:not(.option-disabled):not(.focused):hover { background-color: ${this.styles.listHoverBackground} !important; }`),this.styles.listFocusOutline&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.focused { outline: 1px solid ${this.styles.listFocusOutline} !important; outline-offset: -1px !important; }`),this.styles.listHoverOutline&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row:not(.option-disabled):not(.focused):hover { outline: 1px solid ${this.styles.listHoverOutline} !important; outline-offset: -1px !important; }`),e.push(".monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.option-disabled.focused { background-color: transparent !important; color: inherit !important; outline: none !important; }"),e.push(".monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.option-disabled:hover { background-color: transparent !important; color: inherit !important; outline: none !important; }"),this.styleElement.textContent=e.join(`
`)}styleSelectElement(){let e=this.styles.selectBackground??"",t=this.styles.selectForeground??"",o=this.styles.selectBorder??"";this.selectElement.style.backgroundColor=e,this.selectElement.style.color=t,this.selectElement.style.borderColor=o}styleList(){let e=this.styles.selectBackground??"",t=O_(this.styles.selectListBackground,e);this.selectDropDownContainer.style.backgroundColor=t,this.selectDropDownListContainer.style.backgroundColor=t,this.selectionDetailsPane.style.backgroundColor=t,this.selectList.style(this.styles)}createOption(e,t,o){let n=document.createElement("option");return n.value=e,n.text=e,n.disabled=!!o,n}showSelectDropDown(){this.selectionDetailsPane.textContent="",!(!this.contextViewProvider||this._isVisible)&&(this.createSelectList(this.selectDropDownContainer),this.setOptionsList(),this.contextViewProvider.showContextView({getAnchor:()=>this.selectElement,render:e=>this.renderSelectDropDown(e,!0),layout:()=>{this.layoutSelectDropDown()},onHide:()=>{this.selectDropDownContainer.classList.remove("visible")},anchorPosition:this._dropDownPosition},this.selectBoxOptions.optionsAsChildren?this.container:void 0),this._isVisible=!0,this.hideSelectDropDown(!1),this.contextViewProvider.showContextView({getAnchor:()=>this.selectElement,render:e=>this.renderSelectDropDown(e),layout:()=>this.layoutSelectDropDown(),onHide:()=>{this.selectDropDownContainer.classList.remove("visible")},anchorPosition:this._dropDownPosition},this.selectBoxOptions.optionsAsChildren?this.container:void 0),this._currentSelection=this.selected,this._isVisible=!0,this.selectElement.setAttribute("aria-expanded","true"))}hideSelectDropDown(e){!this.contextViewProvider||!this._isVisible||(this._isVisible=!1,this.selectElement.setAttribute("aria-expanded","false"),e&&this.selectElement.focus(),this.contextViewProvider.hideContextView())}renderSelectDropDown(e,t){e.appendChild(this.selectDropDownContainer);let o=Re(this.selectElement).getComputedStyle(this.selectElement).fontSize;return o&&(this.selectDropDownContainer.style.fontSize=o),this.layoutSelectDropDown(t),{dispose:()=>{this.selectDropDownContainer.remove()}}}measureMaxDetailsHeight(){let e=0;return this.options.forEach((t,o)=>{this.updateDetail(o),this.selectionDetailsPane.offsetHeight>e&&(e=this.selectionDetailsPane.offsetHeight)}),e}layoutSelectDropDown(e){if(this._skipLayout)return!1;if(this.selectList){this.selectDropDownContainer.classList.add("visible");let t=Re(this.selectElement),o=ir(this.selectElement),n=t.innerHeight-o.top-o.height-(this.selectBoxOptions.minBottomMargin||0),r=o.top-a.DEFAULT_DROPDOWN_MINIMUM_TOP_MARGIN,s=this.selectElement.offsetWidth,l=this.setWidthControlElement(this.widthControlElement),c=`${Math.max(l,Math.round(s))}px`;this.selectDropDownContainer.style.width=c,this.selectList.getHTMLElement().style.height="",this.selectList.layout();let u=this.selectList.contentHeight;this._hasDetails&&this._cachedMaxDetailsHeight===void 0&&(this._cachedMaxDetailsHeight=this.measureMaxDetailsHeight());let p=this._hasDetails?this._cachedMaxDetailsHeight:0,h=u+p,g=Math.floor((n-p)/this.getHeight()),f=Math.floor((r-p)/this.getHeight());if(e)return o.top+o.height>t.innerHeight-22||o.top<a.DEFAULT_DROPDOWN_MINIMUM_TOP_MARGIN||g<1&&f<1?!1:(g<a.DEFAULT_MINIMUM_VISIBLE_OPTIONS&&f>g&&this.options.length>g?(this._dropDownPosition=1,this.selectDropDownListContainer.remove(),this.selectionDetailsPane.remove(),this.selectDropDownContainer.appendChild(this.selectionDetailsPane),this.selectDropDownContainer.appendChild(this.selectDropDownListContainer),this.selectionDetailsPane.classList.remove("border-top"),this.selectionDetailsPane.classList.add("border-bottom")):(this._dropDownPosition=0,this.selectDropDownListContainer.remove(),this.selectionDetailsPane.remove(),this.selectDropDownContainer.appendChild(this.selectDropDownListContainer),this.selectDropDownContainer.appendChild(this.selectionDetailsPane),this.selectionDetailsPane.classList.remove("border-bottom"),this.selectionDetailsPane.classList.add("border-top")),!0);if(o.top+o.height>t.innerHeight-22||o.top<a.DEFAULT_DROPDOWN_MINIMUM_TOP_MARGIN||this._dropDownPosition===0&&g<1||this._dropDownPosition===1&&f<1)return this.hideSelectDropDown(!0),!1;if(this._dropDownPosition===0){if(this._isVisible&&g+f<1)return this.hideSelectDropDown(!0),!1;h>n&&(u=g*this.getHeight())}else h>r&&(u=f*this.getHeight());return this.selectList.layout(u),this.selectList.domFocus(),this.selectList.length>0&&(this.selectList.setFocus([this.selected||0]),this.selectList.reveal(this.selectList.getFocus()[0]||0)),this._hasDetails?(this.selectList.getHTMLElement().style.height=`${u}px`,this.selectDropDownContainer.style.height=""):this.selectDropDownContainer.style.height=`${u}px`,this.updateDetail(this.selected),this.selectDropDownContainer.style.width=c,this.selectDropDownListContainer.setAttribute("tabindex","0"),!0}else return!1}setWidthControlElement(e){let t=0;if(e){let o=0,n=0;this.options.forEach((r,s)=>{let l=r.detail?r.detail.length:0,c=r.decoratorRight?r.decoratorRight.length:0,u=r.text.length+l+c;u>n&&(o=s,n=u)}),e.textContent=this.options[o].text+(this.options[o].decoratorRight?`${this.options[o].decoratorRight} `:""),t=zl(e)}return t}createSelectList(e){if(this.selectList)return;this.selectDropDownListContainer=M(e,Jle(".select-box-dropdown-list-container")),this.listRenderer=new yri,this.selectList=this._register(new Cc("SelectBoxCustom",this.selectDropDownListContainer,this,[this.listRenderer],{useShadows:!1,verticalScrollMode:3,keyboardSupport:!1,mouseSupport:!1,accessibilityProvider:{getAriaLabel:n=>{if(n.isSeparator)return d(30,null);let r=n.text;return n.detail&&(r+=`. ${n.detail}`),n.decoratorRight&&(r+=`. ${n.decoratorRight}`),n.description&&(r+=`. ${n.description}`),r},getWidgetAriaLabel:()=>d(29,null),getRole:()=>Ze?"":"option",getWidgetRole:()=>"listbox"}})),this.selectBoxOptions.ariaLabel&&(this.selectList.ariaLabel=this.selectBoxOptions.ariaLabel);let t=this._register(new Gn(this.selectDropDownListContainer,"keydown")),o=U.chain(t.event,n=>n.filter(()=>this.selectList.length>0).map(r=>new gi(r)));this._register(U.chain(o,n=>n.filter(r=>r.keyCode===3))(this.onEnter,this)),this._register(U.chain(o,n=>n.filter(r=>r.keyCode===2))(this.onEnter,this)),this._register(U.chain(o,n=>n.filter(r=>r.keyCode===9))(this.onEscape,this)),this._register(U.chain(o,n=>n.filter(r=>r.keyCode===16))(this.onUpArrow,this)),this._register(U.chain(o,n=>n.filter(r=>r.keyCode===18))(this.onDownArrow,this)),this._register(U.chain(o,n=>n.filter(r=>r.keyCode===12))(this.onPageDown,this)),this._register(U.chain(o,n=>n.filter(r=>r.keyCode===11))(this.onPageUp,this)),this._register(U.chain(o,n=>n.filter(r=>r.keyCode===14))(this.onHome,this)),this._register(U.chain(o,n=>n.filter(r=>r.keyCode===13))(this.onEnd,this)),this._register(U.chain(o,n=>n.filter(r=>r.keyCode>=21&&r.keyCode<=56||r.keyCode>=85&&r.keyCode<=113))(this.onCharacter,this)),this._register(j(this.selectList.getHTMLElement(),re.POINTER_UP,n=>this.onPointerUp(n))),this._register(this.selectList.onMouseOver(n=>typeof n.index<"u"&&!this.options[n.index]?.isDisabled&&this.selectList.setFocus([n.index]))),this._register(this.selectList.onDidChangeFocus(n=>this.onListFocus(n))),this._register(j(this.selectDropDownContainer,re.FOCUS_OUT,n=>{!this._isVisible||ts(n.relatedTarget,this.selectDropDownContainer)||this.onListBlur()})),this.selectList.getHTMLElement().setAttribute("aria-label",this.selectBoxOptions.ariaLabel||""),this.selectList.getHTMLElement().setAttribute("aria-expanded","true"),this.styleList()}onPointerUp(e){if(!this.selectList.length)return;Xt.stop(e);let t=e.target;if(!t||t.classList.contains("slider"))return;let o=t.closest(".monaco-list-row");if(!o)return;let n=Number(o.getAttribute("data-index")),r=o.classList.contains("option-disabled");n>=0&&n<this.options.length&&!r&&(this.selected=n,this.select(this.selected),this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selectList.getFocus()[0]),this.selected!==this._currentSelection&&(this._currentSelection=this.selected,this._onDidSelect.fire({index:this.selectElement.selectedIndex,selected:this.options[this.selected].text}),this.options[this.selected]&&this.options[this.selected].text&&this.setTitle(this.options[this.selected].text)),this.hideSelectDropDown(!0))}onListBlur(){this._sticky||(this.selected!==this._currentSelection&&this.select(this._currentSelection),this.hideSelectDropDown(!1))}renderDescriptionMarkdown(e,t){let o=r=>{for(let s=0;s<r.childNodes.length;s++){let l=r.childNodes.item(s);(l.tagName&&l.tagName.toLowerCase())==="img"?l.remove():o(l)}},n=Gf({value:e,supportThemeIcons:!0},{actionHandler:t});return n.element.classList.add("select-box-description-markdown"),o(n.element),n}onListFocus(e){!this._isVisible||!this._hasDetails||this.updateDetail(e.indexes[0])}updateDetail(e){this._selectionDetailsDisposables.clear(),this.selectionDetailsPane.textContent="";let t=this.options[e],o=t?.description??"",n=t?.descriptionIsMarkdown??!1;if(o){if(n){let r=t.descriptionMarkdownActionHandler,s=this._selectionDetailsDisposables.add(this.renderDescriptionMarkdown(o,r));this.selectionDetailsPane.appendChild(s.element)}else this.selectionDetailsPane.textContent=o;this.selectionDetailsPane.style.display="block"}else this.selectionDetailsPane.style.display="none";this._skipLayout=!0,this.contextViewProvider.layout(),this._skipLayout=!1}onEscape(e){Xt.stop(e),this.select(this._currentSelection),this.hideSelectDropDown(!0)}onEnter(e){if(Xt.stop(e),this.options[this.selected]?.isDisabled){this.hideSelectDropDown(!0);return}this.selected!==this._currentSelection&&(this._currentSelection=this.selected,this._onDidSelect.fire({index:this.selectElement.selectedIndex,selected:this.options[this.selected].text}),this.options[this.selected]&&this.options[this.selected].text&&this.setTitle(this.options[this.selected].text)),this.hideSelectDropDown(!0)}onDownArrow(e){if(this.selected<this.options.length-1){Xt.stop(e,!0);let t=this.selected+1;for(;t<this.options.length&&this.options[t].isDisabled;)t++;if(t>=this.options.length)return;this.selected=t,this.select(this.selected),this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selectList.getFocus()[0])}}onUpArrow(e){if(this.selected>0){Xt.stop(e,!0);let t=this.selected-1;for(;t>=0&&this.options[t].isDisabled;)t--;if(t<0)return;this.selected=t,this.select(this.selected),this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selectList.getFocus()[0])}}onPageUp(e){Xt.stop(e),this.selectList.focusPreviousPage(),setTimeout(()=>{let t=this.selectList.getFocus()[0];for(;t>0&&this.options[t].isDisabled;)t--;this.options[t].isDisabled||(this.selected=t,this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selected),this.select(this.selected))},1)}onPageDown(e){Xt.stop(e),this.selectList.focusNextPage(),setTimeout(()=>{let t=this.selectList.getFocus()[0];for(;t<this.options.length-1&&this.options[t].isDisabled;)t++;this.options[t].isDisabled||(this.selected=t,this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selected),this.select(this.selected))},1)}onHome(e){if(Xt.stop(e),this.options.length<2)return;let t=0;for(;t<this.options.length-1&&this.options[t].isDisabled;)t++;this.options[t].isDisabled||(this.selected=t,this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selected),this.select(this.selected))}onEnd(e){if(Xt.stop(e),this.options.length<2)return;let t=this.options.length-1;for(;t>0&&this.options[t].isDisabled;)t--;this.options[t].isDisabled||(this.selected=t,this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selected),this.select(this.selected))}onCharacter(e){let t=Fp.toString(e.keyCode),o=-1;for(let n=0;n<this.options.length-1;n++)if(o=(n+this.selected+1)%this.options.length,this.options[o].text.charAt(0).toUpperCase()===t&&!this.options[o].isDisabled){this.select(o),this.selectList.setFocus([o]),this.selectList.reveal(this.selectList.getFocus()[0]),Xt.stop(e);break}}dispose(){this.hideSelectDropDown(!1),super.dispose()}};var Kyt=class extends x{constructor(e,t,o,n){super();this.selected=0;this.selectBoxOptions=n||Object.create(null),this.options=[],this.selectElement=document.createElement("select"),this.selectElement.className="monaco-select-box",typeof this.selectBoxOptions.ariaLabel=="string"&&this.selectElement.setAttribute("aria-label",this.selectBoxOptions.ariaLabel),typeof this.selectBoxOptions.ariaDescription=="string"&&this.selectElement.setAttribute("aria-description",this.selectBoxOptions.ariaDescription),this._onDidSelect=this._register(new E),this.styles=o,this.registerListeners(),this.setOptions(e,t)}registerListeners(){this._register(Ms.addTarget(this.selectElement)),[Kn.Tap].forEach(e=>{this._register(j(this.selectElement,e,t=>{this.selectElement.focus()}))}),this._register(Jo(this.selectElement,"click",e=>{Xt.stop(e,!0)})),this._register(Jo(this.selectElement,"change",e=>{this.selectElement.title=e.target.value,this._onDidSelect.fire({index:e.target.selectedIndex,selected:e.target.value})})),this._register(Jo(this.selectElement,"keydown",e=>{let t=!1;Ze?(e.keyCode===18||e.keyCode===16||e.keyCode===10)&&(t=!0):(e.keyCode===18&&e.altKey||e.keyCode===10||e.keyCode===3)&&(t=!0),t&&e.stopPropagation()}))}get onDidSelect(){return this._onDidSelect.event}setOptions(e,t){(!this.options||!$i(this.options,e))&&(this.options=e,this.selectElement.options.length=0,this.options.forEach((o,n)=>{this.selectElement.add(this.createOption(o.text,n,o.isDisabled,o.isSeparator))})),t!==void 0&&this.select(t)}select(e){this.options.length===0?this.selected=0:e>=0&&e<this.options.length?this.selected=e:e>this.options.length-1?this.select(this.options.length-1):this.selected<0&&(this.selected=0),this.selectElement.selectedIndex=this.selected,this.selected<this.options.length&&typeof this.options[this.selected].text=="string"?this.selectElement.title=this.options[this.selected].text:this.selectElement.title=""}setAriaLabel(e){this.selectBoxOptions.ariaLabel=e,this.selectElement.setAttribute("aria-label",e)}focus(){this.selectElement&&(this.selectElement.tabIndex=0,this.selectElement.focus())}blur(){this.selectElement&&(this.selectElement.tabIndex=-1,this.selectElement.blur())}setEnabled(e){this.selectElement.disabled=!e}setFocusable(e){this.selectElement.tabIndex=e?0:-1}render(e){e.classList.add("select-container"),e.appendChild(this.selectElement),this.setOptions(this.options,this.selected),this.applyStyles()}style(e){this.styles=e,this.applyStyles()}applyStyles(){this.selectElement&&(this.selectElement.style.backgroundColor=this.styles.selectBackground??"",this.selectElement.style.color=this.styles.selectForeground??"",this.selectElement.style.borderColor=this.styles.selectBorder??"")}createOption(e,t,o,n){let r=document.createElement("option");return r.value=e,r.text=e,r.disabled=!!o||!!n,n&&r.setAttribute("role","separator"),r}};var UO=Object.freeze({text:"\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500",isDisabled:!0,isSeparator:!0}),vyr={...Ryt,selectBackground:"#3C3C3C",selectForeground:"#F0F0F0",selectBorder:"#3C3C3C",decoratorRightForeground:void 0,selectListBackground:void 0,selectListBorder:void 0,focusBorder:void 0},ME=class extends ja{constructor(i,e,t,o,n){super(),Ze&&!n?.useCustomDrawn?this.selectBoxDelegate=new Kyt(i,e,o,n):this.selectBoxDelegate=new zyt(i,e,t,o,n),this._register(this.selectBoxDelegate)}get onDidSelect(){return this.selectBoxDelegate.onDidSelect}setOptions(i,e){this.selectBoxDelegate.setOptions(i,e)}select(i){this.selectBoxDelegate.select(i)}setAriaLabel(i){this.selectBoxDelegate.setAriaLabel(i)}focus(){this.selectBoxDelegate.focus()}blur(){this.selectBoxDelegate.blur()}setFocusable(i){this.selectBoxDelegate.setFocusable(i)}setEnabled(i){this.selectBoxDelegate.setEnabled(i)}render(i){this.selectBoxDelegate.render(i)}};var wl=class extends x{constructor(e,t,o={}){super();this.options=o;this._context=e||this,this._action=t,t instanceof it&&this._register(t.onDidChange(n=>{this.element&&this.handleActionChangeEvent(n)}))}get action(){return this._action}handleActionChangeEvent(e){e.enabled!==void 0&&this.updateEnabled(),e.checked!==void 0&&this.updateChecked(),e.class!==void 0&&this.updateClass(),e.label!==void 0&&(this.updateLabel(),this.updateTooltip()),e.tooltip!==void 0&&this.updateTooltip()}get actionRunner(){return this._actionRunner||(this._actionRunner=this._register(new rs)),this._actionRunner}set actionRunner(e){this._actionRunner=e}isEnabled(){return this._action.enabled}setActionContext(e){this._context=e}render(e){let t=this.element=e;this._register(Ms.addTarget(e));let o=this.options&&this.options.draggable;o&&(e.draggable=!0,Ac&&this._register(j(e,re.DRAG_START,n=>n.dataTransfer?.setData(yl.TEXT,this._action.label)))),this._register(j(t,Kn.Tap,n=>this.onClick(n,!0))),this._register(j(t,re.MOUSE_DOWN,n=>{o||Xt.stop(n,!0),this._action.enabled&&n.button===0&&t.classList.add("active")})),Ze&&this._register(j(t,re.CONTEXT_MENU,n=>{n.button===0&&n.ctrlKey===!0&&this.onClick(n)})),this._register(j(t,re.CLICK,n=>{Xt.stop(n,!0),this.options&&this.options.isMenu||this.onClick(n)})),this._register(j(t,re.DBLCLICK,n=>{Xt.stop(n,!0)})),[re.MOUSE_UP,re.MOUSE_OUT].forEach(n=>{this._register(j(t,n,r=>{Xt.stop(r),t.classList.remove("active")}))})}onClick(e,t=!1){Xt.stop(e,!0);let o=nr(this._context)?this.options?.useEventAsContext?e:{preserveFocus:t}:this._context;this.actionRunner.run(this._action,o)}focus(){this.element&&(this.element.tabIndex=0,this.element.focus(),this.element.classList.add("focused"))}isFocused(){return!!this.element?.classList.contains("focused")}blur(){this.element&&(this.element.blur(),this.element.tabIndex=-1,this.element.classList.remove("focused"))}setFocusable(e){this.element&&(this.element.tabIndex=e?0:-1)}get trapsArrowNavigation(){return!1}updateEnabled(){}updateLabel(){}getClass(){return this.action.class}getTooltip(){return this.action.tooltip}getHoverContents(){return this.getTooltip()}updateTooltip(){if(!this.element)return;let e=this.getHoverContents()??"";if(this.updateAriaLabel(),!this.customHover&&e!==""){let t=this.options.hoverDelegate??Ri("element");this.customHover=this._store.add(Up().setupManagedHover(t,this.element,e))}else this.customHover&&this.customHover.update(e)}updateAriaLabel(){if(this.element){let e=this.getTooltip()??"";this.element.setAttribute("aria-label",e)}}updateClass(){}updateChecked(){}dispose(){this.element&&(this.element.remove(),this.element=void 0),this._context=void 0,super.dispose()}},hs=class extends wl{constructor(i,e,t){t={...t,icon:t.icon!==void 0?t.icon:!1,label:t.label!==void 0?t.label:!0},super(i,e,t),this.options=t,this.cssClass=""}render(i){super.render(i),wo(this.element);let e=document.createElement("a");if(e.classList.add("action-label"),e.setAttribute("role",this.getDefaultAriaRole()),this.label=e,this.element.appendChild(e),this.options.label&&this.options.keybinding&&!this.options.keybindingNotRenderedWithLabel){let t=document.createElement("span");t.classList.add("keybinding"),t.textContent=this.options.keybinding,this.element.appendChild(t)}this.updateClass(),this.updateLabel(),this.updateTooltip(),this.updateEnabled(),this.updateChecked()}getDefaultAriaRole(){return this._action.id===ri.ID?"presentation":this.options.isMenu?"menuitem":this.options.isTabList?"tab":"button"}focus(){this.label&&(this.label.tabIndex=0,this.label.focus())}isFocused(){return!!this.label&&this.label?.tabIndex===0}blur(){this.label&&(this.label.tabIndex=-1)}setFocusable(i){this.label&&(this.label.tabIndex=i?0:-1)}updateLabel(){this.options.label&&this.label&&(this.label.textContent=this.action.label)}getTooltip(){let i=null;return this.action.tooltip?i=this.action.tooltip:this.action.label&&(i=this.action.label,this.options.keybinding&&(i=d(0,null,i,this.options.keybinding))),i??void 0}updateClass(){this.cssClass&&this.label&&this.label.classList.remove(...this.cssClass.split(" ")),this.action.id===ri.ID&&this.action.class?this.label?.classList.add(this.action.class):this.options.icon?(this.cssClass=this.getClass(),this.label&&(this.label.classList.add("codicon"),this.cssClass&&this.label.classList.add(...this.cssClass.split(" "))),this.updateEnabled()):this.label?.classList.remove("codicon")}updateEnabled(){this.action.enabled?(this.label&&(this.label.removeAttribute("aria-disabled"),this.label.classList.remove("disabled")),this.element?.classList.remove("disabled")):(this.label&&(this.label.setAttribute("aria-disabled","true"),this.label.classList.add("disabled")),this.element?.classList.add("disabled"))}updateAriaLabel(){if(this.label){let i=this.getTooltip()??"";this.label.setAttribute("aria-label",i)}}updateChecked(){this.label&&(this.action.checked!==void 0?(this.label.classList.toggle("checked",this.action.checked),this.options.isTabList?this.label.setAttribute("aria-selected",this.action.checked?"true":"false"):(this.label.setAttribute("aria-pressed",this.action.checked?"true":"false"),this.label.setAttribute("role","button"))):(this.label.classList.remove("checked"),this.label.removeAttribute(this.options.isTabList?"aria-selected":"aria-pressed"),this.label.setAttribute("role",this.getDefaultAriaRole())))}},kz=class extends wl{constructor(i,e,t,o,n,r,s){super(i,e),this.selectBox=new ME(t,o,n,r,s),this.selectBox.setFocusable(!1),this._register(this.selectBox),this.registerListeners()}setOptions(i,e){this.selectBox.setOptions(i,e)}select(i){this.selectBox.select(i)}registerListeners(){this._register(this.selectBox.onDidSelect(i=>this.runAction(i.selected,i.index)))}runAction(i,e){this.actionRunner.run(this._action,this.getActionContext(i,e))}getActionContext(i,e){return i}setFocusable(i){this.selectBox.setFocusable(i)}focus(){this.selectBox?.focus()}blur(){this.selectBox?.blur()}render(i){this.selectBox.render(i)}};var Zi=class extends x{constructor(e,t={}){super();this._actionRunnerDisposables=this._register(new N);this.viewItemDisposables=this._register(new Vt);this.triggerKeyDown=!1;this.focusable=!0;this._onDidBlur=this._register(new E);this._onDidCancel=this._register(new E({onWillAddFirstListener:()=>this.cancelHasListener=!0}));this.cancelHasListener=!1;this._onDidRun=this._register(new E);this._onWillRun=this._register(new E);this.options=t,this._context=t.context??null,this._orientation=this.options.orientation??0,this._triggerKeys={keyDown:this.options.triggerKeys?.keyDown??!1,keys:this.options.triggerKeys?.keys??[3,10]},this._hoverDelegate=t.hoverDelegate??this._register(Qh()),this.options.actionRunner?this._actionRunner=this.options.actionRunner:(this._actionRunner=new rs,this._actionRunnerDisposables.add(this._actionRunner)),this._actionRunnerDisposables.add(this._actionRunner.onDidRun(r=>this._onDidRun.fire(r))),this._actionRunnerDisposables.add(this._actionRunner.onWillRun(r=>this._onWillRun.fire(r))),this.viewItems=[],this.focusedItem=void 0,this.domNode=document.createElement("div"),this.domNode.className="monaco-action-bar";let o,n;switch(this._orientation){case 0:o=[15],n=[17];break;case 1:o=[16],n=[18],this.domNode.className+=" vertical";break}this._register(j(this.domNode,re.KEY_DOWN,r=>{let s=new gi(r),l=!0,c=typeof this.focusedItem=="number"?this.viewItems[this.focusedItem]:void 0;o&&(s.equals(o[0])||s.equals(o[1]))?l=this.focusPrevious():n&&(s.equals(n[0])||s.equals(n[1]))?l=this.focusNext():s.equals(9)&&this.cancelHasListener?this._onDidCancel.fire():s.equals(14)?l=this.focusFirst():s.equals(13)?l=this.focusLast():s.equals(2)&&c instanceof wl&&c.trapsArrowNavigation?l=this.focusNext(void 0,!0):this.isTriggerKeyEvent(s)?this._triggerKeys.keyDown?this.doTrigger(s):this.triggerKeyDown=!0:l=!1,l&&(s.preventDefault(),s.stopPropagation())})),this._register(j(this.domNode,re.KEY_UP,r=>{let s=new gi(r);this.isTriggerKeyEvent(s)?(!this._triggerKeys.keyDown&&this.triggerKeyDown&&(this.triggerKeyDown=!1,this.doTrigger(s)),s.preventDefault(),s.stopPropagation()):(s.equals(2)||s.equals(1026)||s.equals(16)||s.equals(18)||s.equals(15)||s.equals(17))&&this.updateFocusedItem()})),this.focusTracker=this._register(qn(this.domNode)),this._register(this.focusTracker.onDidBlur(()=>{(Nn()===this.domNode||!ts(Nn(),this.domNode))&&(this._onDidBlur.fire(),this.previouslyFocusedItem=this.focusedItem,this.focusedItem=void 0,this.triggerKeyDown=!1)})),this._register(this.focusTracker.onDidFocus(()=>this.updateFocusedItem())),this.actionsList=document.createElement("ul"),this.actionsList.className="actions-container",this.options.highlightToggledItems&&this.actionsList.classList.add("highlight-toggled"),this.actionsList.setAttribute("role",this.options.ariaRole||"toolbar"),this.options.ariaLabel&&this.actionsList.setAttribute("aria-label",this.options.ariaLabel),this.domNode.appendChild(this.actionsList),e.appendChild(this.domNode)}get onDidBlur(){return this._onDidBlur.event}get onDidCancel(){return this._onDidCancel.event}get onDidRun(){return this._onDidRun.event}get onWillRun(){return this._onWillRun.event}refreshRole(){this.length()>=1?this.actionsList.setAttribute("role",this.options.ariaRole||"toolbar"):this.actionsList.setAttribute("role","presentation")}setAriaLabel(e){e?this.actionsList.setAttribute("aria-label",e):this.actionsList.removeAttribute("aria-label")}setFocusable(e){if(this.focusable=e,this.focusable){let t=this.viewItems.find(o=>o instanceof wl&&o.isEnabled());t instanceof wl&&t.setFocusable(!0)}else this.viewItems.forEach(t=>{t instanceof wl&&t.setFocusable(!1)})}isTriggerKeyEvent(e){let t=!1;return this._triggerKeys.keys.forEach(o=>{t=t||e.equals(o)}),t}updateFocusedItem(){for(let e=0;e<this.actionsList.children.length;e++){let t=this.actionsList.children[e];if(ts(Nn(),t)){this.focusedItem=e,this.viewItems[this.focusedItem]?.showHover?.();break}}}get context(){return this._context}set context(e){this._context=e,this.viewItems.forEach(t=>t.setActionContext(e))}get actionRunner(){return this._actionRunner}set actionRunner(e){this._actionRunner=e,this._actionRunnerDisposables.clear(),this._actionRunnerDisposables.add(this._actionRunner.onDidRun(t=>this._onDidRun.fire(t))),this._actionRunnerDisposables.add(this._actionRunner.onWillRun(t=>this._onWillRun.fire(t))),this.viewItems.forEach(t=>t.actionRunner=e)}getContainer(){return this.domNode}hasAction(e){return this.viewItems.findIndex(t=>t.action.id===e.id)!==-1}getAction(e){if(typeof e=="number")return this.viewItems[e]?.action;if(Do(e)){for(;e.parentElement!==this.actionsList;){if(!e.parentElement)return;e=e.parentElement}for(let t=0;t<this.actionsList.childNodes.length;t++)if(this.actionsList.childNodes[t]===e)return this.viewItems[t].action}}push(e,t={}){let o=Array.isArray(e)?e:[e],n=Yo(t.index)?t.index:null;if(o.forEach(r=>{let s=document.createElement("li");s.className="action-item",s.setAttribute("role","presentation");let l,c={hoverDelegate:this._hoverDelegate,...t,isTabList:this.options.ariaRole==="tablist"};this.options.actionViewItemProvider&&(l=this.options.actionViewItemProvider(r,c)),l||(l=new hs(this.context,r,c)),this.options.allowContextMenu||this.viewItemDisposables.set(l,j(s,re.CONTEXT_MENU,u=>{Xt.stop(u,!0)})),l.actionRunner=this._actionRunner,l.setActionContext(this.context),l.render(s),n===null||n<0||n>=this.actionsList.children.length?(this.actionsList.appendChild(s),this.viewItems.push(l)):(this.actionsList.insertBefore(s,this.actionsList.children[n]),this.viewItems.splice(n,0,l),n++)}),this.focusable){let r=!1;for(let s of this.viewItems){if(!(s instanceof wl))continue;let l;r||s.action.id===ri.ID||!s.isEnabled()&&this.options.focusOnlyEnabledItems?l=!1:l=!0,l?(s.setFocusable(!0),r=!0):s.setFocusable(!1)}}typeof this.focusedItem=="number"&&this.focus(this.focusedItem),this.refreshRole()}getWidth(e){if(e>=0&&e<this.actionsList.children.length){let t=this.actionsList.children.item(e);if(t)return t.clientWidth}return 0}getHeight(e){if(e>=0&&e<this.actionsList.children.length){let t=this.actionsList.children.item(e);if(t)return t.clientHeight}return 0}pull(e){e>=0&&e<this.viewItems.length&&(this.actionsList.childNodes[e].remove(),this.viewItemDisposables.deleteAndDispose(this.viewItems[e]),Be(this.viewItems.splice(e,1)),this.refreshRole())}clear(){this.isEmpty()||(this.viewItems=Be(this.viewItems),this.viewItemDisposables.clearAndDisposeAll(),Rt(this.actionsList),this.refreshRole())}length(){return this.viewItems.length}isEmpty(){return this.viewItems.length===0}isFocused(e){return e===void 0?ts(Nn(),this.domNode):ts(Nn(),this.actionsList.children[e])}focus(e){let t=!1,o;if(e===void 0?t=!0:typeof e=="number"?o=e:typeof e=="boolean"&&(t=e),t&&typeof this.focusedItem>"u"){let n=this.viewItems.findIndex(r=>r.isEnabled());this.focusedItem=n===-1?void 0:n,this.updateFocus(void 0,void 0,!0)}else o!==void 0&&(this.focusedItem=o),this.updateFocus(void 0,void 0,!0)}focusFirst(){return this.focusedItem=this.length()-1,this.focusNext(!0)}focusLast(){return this.focusedItem=0,this.focusPrevious(!0)}focusNext(e,t){if(typeof this.focusedItem>"u")this.focusedItem=this.viewItems.length-1;else if(this.viewItems.length<=1)return!1;let o=this.focusedItem,n;do{if(!e&&this.options.preventLoopNavigation&&this.focusedItem+1>=this.viewItems.length)return this.focusedItem=o,!1;this.focusedItem=(this.focusedItem+1)%this.viewItems.length,n=this.viewItems[this.focusedItem]}while(this.focusedItem!==o&&(this.options.focusOnlyEnabledItems&&!n.isEnabled()||n.action.id===ri.ID));return this.updateFocus(void 0,void 0,t),!0}focusPrevious(e){if(typeof this.focusedItem>"u")this.focusedItem=0;else if(this.viewItems.length<=1)return!1;let t=this.focusedItem,o;do{if(this.focusedItem=this.focusedItem-1,this.focusedItem<0){if(!e&&this.options.preventLoopNavigation)return this.focusedItem=t,!1;this.focusedItem=this.viewItems.length-1}o=this.viewItems[this.focusedItem]}while(this.focusedItem!==t&&(this.options.focusOnlyEnabledItems&&!o.isEnabled()||o.action.id===ri.ID));return this.updateFocus(!0),!0}updateFocus(e,t,o=!1){typeof this.focusedItem>"u"&&this.actionsList.focus({preventScroll:t}),this.previouslyFocusedItem!==void 0&&this.previouslyFocusedItem!==this.focusedItem&&this.viewItems[this.previouslyFocusedItem]?.blur();let n=this.focusedItem!==void 0?this.viewItems[this.focusedItem]:void 0;if(n){let r=!0;xL(n.focus)||(r=!1),this.options.focusOnlyEnabledItems&&xL(n.isEnabled)&&!n.isEnabled()&&(r=!1),n.action.id===ri.ID&&(r=!1),r?(o||this.previouslyFocusedItem!==this.focusedItem)&&(n.focus(e),this.previouslyFocusedItem=this.focusedItem):(this.actionsList.focus({preventScroll:t}),this.previouslyFocusedItem=void 0),r&&n.showHover?.()}}doTrigger(e){if(typeof this.focusedItem>"u")return;let t=this.viewItems[this.focusedItem];if(t instanceof wl){let o=t._context===null||t._context===void 0?e:t._context;this.run(t._action,o)}}async run(e,t){await this._actionRunner.run(e,t)}dispose(){this._context=void 0,this.viewItems=Be(this.viewItems),this.getContainer().remove(),super.dispose()}};function B_(a){if(!a.length)return a;let i=-1;for(let t=0;t<a.length;t++)if(a[t].id!==ri.ID){i=t;break}if(i===-1)return[];a=a.slice(i);for(let t=a.length-1;t>=0&&a[t].id===ri.ID;t--)a.splice(t,1);let e=!1;for(let t=a.length-1;t>=0;t--){let o=a[t].id===ri.ID;o&&!e?a.splice(t,1):o?o&&(e=!1):e=!0}return a}function d6i(a,i,e,t){if(a.length===0)return i;if(i.length===0)return a;let o=[],n=0,r=0;for(;n<a.length&&r<i.length;){let s=a[n],l=i[r],c=e(s),u=e(l);c<u?(o.push(s),n++):c>u?(o.push(l),r++):(o.push(t(s,l)),n++,r++)}for(;n<a.length;)o.push(a[n]),n++;for(;r<i.length;)o.push(i[r]),r++;return o}function DCe(a,i){let e=new N,t=a.createDecorationsCollection();return e.add(NL({debugName:()=>`Apply decorations from ${i.debugName}`},o=>{let n=i.read(o);t.set(n)})),e.add({dispose:()=>{t.clear()}}),e}function $j(a,i){return a.appendChild(i),Z(()=>{i.remove()})}function u6i(a,i){return a.prepend(i),Z(()=>{i.remove()})}var _Ce=class extends x{constructor(e,t){super();this._automaticLayout=!1;this.elementSizeObserver=this._register(new C7(e,t)),this._width=Me(this,this.elementSizeObserver.getWidth()),this._height=Me(this,this.elementSizeObserver.getHeight()),this._register(this.elementSizeObserver.onDidChange(o=>Gi(n=>{this._width.set(this.elementSizeObserver.getWidth(),n),this._height.set(this.elementSizeObserver.getHeight(),n)})))}get width(){return this._width}get height(){return this._height}get automaticLayout(){return this._automaticLayout}observe(e){this.elementSizeObserver.observe(e)}setAutomaticLayout(e){this._automaticLayout=e,e?this.elementSizeObserver.startObserving():this.elementSizeObserver.stopObserving()}};function xri(a,i,e){let t=i.get(),o=t,n=t,r=Me("animatedValue",t),s=-1,l=300,c;e.add(hP({changeTracker:{createChangeSummary:()=>({animate:!1}),handleChange:(p,h)=>(p.didChange(i)&&(h.animate=h.animate||p.change),!0)}},(p,h)=>{c!==void 0&&(a.cancelAnimationFrame(c),c=void 0),o=n,t=i.read(p),s=Date.now()-(h.animate?0:l),u()}));function u(){let p=Date.now()-s;n=Math.floor(XUo(p,o,t-o,l)),p<l?c=a.requestAnimationFrame(u):n=t,r.set(n,void 0)}return r}function XUo(a,i,e,t){return a===t?i+e:e*(-Math.pow(2,-10*a/t)+1)+i}var Zle=class extends x{constructor(i,e,t){super(),this._register(new wri(i,t)),this._register(OP(t,{height:e.actualHeight,top:e.actualTop}))}},Ez=class{constructor(i,e){this._afterLineNumber=i;this.heightInPx=e;this.domNode=document.createElement("div"),this._actualTop=Me(this,void 0),this._actualHeight=Me(this,void 0),this.actualTop=this._actualTop,this.actualHeight=this._actualHeight,this.showInHiddenAreas=!0,this.onChange=this._afterLineNumber,this.onDomNodeTop=t=>{this._actualTop.set(t,void 0)},this.onComputedHeight=t=>{this._actualHeight.set(t,void 0)}}get afterLineNumber(){return this._afterLineNumber.get()}},wri=class a{constructor(i,e){this._editor=i;this._domElement=e;this._overlayWidgetId=`managedOverlayWidget-${a._counter++}`;this._overlayWidget={getId:()=>this._overlayWidgetId,getDomNode:()=>this._domElement,getPosition:()=>null};this._editor.addOverlayWidget(this._overlayWidget)}static{this._counter=0}dispose(){this._editor.removeOverlayWidget(this._overlayWidget)}};function OP(a,i){return be(e=>{for(let[t,o]of Object.entries(i))o&&typeof o=="object"&&"read"in o&&(o=o.read(e)),typeof o=="number"&&(o=`${o}px`),t=t.replace(/[A-Z]/g,n=>"-"+n.toLowerCase()),a.style[t]=o})}function LCe(a,i,e,t){let o=new N,n=[];return o.add(il((r,s)=>{let l=i.read(r),c=new Map,u=new Map;e&&e(!0),a.changeViewZones(p=>{for(let h of n)p.removeZone(h),t?.delete(h);n.length=0;for(let h of l){let g=p.addZone(h);h.setZoneId&&h.setZoneId(g),n.push(g),t?.add(g),c.set(h,g)}}),e&&e(!1),s.add(hP({changeTracker:{createChangeSummary(){return{zoneIds:[]}},handleChange(p,h){let g=u.get(p.changedObservable);return g!==void 0&&h.zoneIds.push(g),!0}}},(p,h)=>{for(let g of l)g.onChange&&(u.set(g.onChange,c.get(g)),g.onChange.read(p));e&&e(!0),a.changeViewZones(g=>{for(let f of h.zoneIds)g.layoutZone(f)}),e&&e(!1)}))})),o.add({dispose(){e&&e(!0),a.changeViewZones(r=>{for(let s of n)r.removeZone(s)}),t?.clear(),e&&e(!1)}}),o}var Gyt=class extends Ye{dispose(){super.dispose(!0)}};function kri(a,i){let e=fd(i,o=>o.original.startLineNumber<=a.lineNumber);if(!e)return z.fromPositions(a);if(e.original.endLineNumberExclusive<=a.lineNumber){let o=a.lineNumber-e.original.endLineNumberExclusive+e.modified.endLineNumberExclusive;return z.fromPositions(new ye(o,a.column))}if(!e.innerChanges)return z.fromPositions(new ye(e.modified.startLineNumber,1));let t=fd(e.innerChanges,o=>o.originalRange.getStartPosition().isBeforeOrEqual(a));if(!t){let o=a.lineNumber-e.original.startLineNumber+e.modified.startLineNumber;return z.fromPositions(new ye(o,a.column))}if(t.originalRange.containsPosition(a))return t.modifiedRange;{let o=JUo(t.originalRange.getEndPosition(),a);return z.fromPositions(o.addToPosition(t.modifiedRange.getEndPosition()))}}function JUo(a,i){return a.lineNumber===i.lineNumber?new pc(0,i.column-a.column):new pc(i.lineNumber-a.lineNumber,i.column-1)}function p6i(a,i){let e;return a.filter(t=>{let o=i(t,e);return e=t,o})}var KV=class{static create(i,e=void 0){return new b4e(i,i,e)}static createWithDisposable(i,e,t=void 0){let o=new N;return o.add(e),o.add(i),new b4e(i,o,t)}static createOfNonDisposable(i,e,t=void 0){return new b4e(i,e,t)}},b4e=class extends KV{constructor(e,t,o){super();this.object=e;this._disposable=t;this._debugOwner=o;this._refCount=1;this._isDisposed=!1;this._owners=[];o&&this._addOwner(o)}_addOwner(e){e&&this._owners.push(e)}createNewRef(e){return this._refCount++,e&&this._addOwner(e),new Cri(this,e)}dispose(){this._isDisposed||(this._isDisposed=!0,this._decreaseRefCount(this._debugOwner))}_decreaseRefCount(e){if(this._refCount--,this._refCount===0&&this._disposable.dispose(),e){let t=this._owners.indexOf(e);t!==-1&&this._owners.splice(t,1)}}},Cri=class extends KV{constructor(e,t){super();this._base=e;this._debugOwner=t;this._isDisposed=!1}get object(){return this._base.object}createNewRef(e){return this._base.createNewRef(e)}dispose(){this._isDisposed||(this._isDisposed=!0,this._base._decreaseRefCount(this._debugOwner))}};var Tri={IconContribution:"base.contributions.icons"},ZUo;(i=>{function a(e,t){let o=e.defaults;for(;q.isThemeIcon(o);){let n=ece.getIcon(o.id);if(!n)return;o=n.defaults}return o}i.getDefinition=a})(ZUo||={});var qyt;(e=>{function a(t){return{weight:t.weight,style:t.style,src:t.src.map(o=>({format:o.format,location:o.location.toString()}))}}e.toJSONObject=a;function i(t){let o=n=>Fe(n)?n:void 0;if(t&&Array.isArray(t.src)&&t.src.every(n=>Fe(n.format)&&Fe(n.location)))return{weight:o(t.weight),style:o(t.style),src:t.src.map(n=>({format:n.format,location:A.parse(n.location)}))}}e.fromJSONObject=i})(qyt||={});var mY=/^([\w_-]+)$/,RCe=/^(normal|italic|(oblique[ \w\s-]+))$/,MCe=/^(normal|bold|lighter|bolder|(\d{0-1000}))$/,S4e=/^([\w_.%+-]+)$/,h6i=/^woff|woff2|truetype|opentype|embedded-opentype|svg$/,$yt=/^#[0-9a-fA-F]{0,6}$/,PCe=d(2668,null),Eri=class extends x{constructor(){super();this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this.iconSchema={definitions:{icons:{type:"object",properties:{fontId:{type:"string",description:d(2665,null),pattern:mY.source,patternErrorMessage:PCe},fontCharacter:{type:"string",description:d(2664,null)}},additionalProperties:!1,defaultSnippets:[{body:{fontCharacter:"\\\\e030"}}]}},type:"object",properties:{}};this.iconReferenceSchema={type:"string",pattern:`^${q.iconNameExpression}$`,enum:[],enumDescriptions:[]};this.iconsById={},this.iconFontsById={}}registerIcon(e,t,o,n){let r=this.iconsById[e];if(r){if(o&&!r.description){r.description=o,this.iconSchema.properties[e].markdownDescription=`${o} $(${e})`;let c=this.iconReferenceSchema.enum.indexOf(e);c!==-1&&(this.iconReferenceSchema.enumDescriptions[c]=o),this._onDidChange.fire()}return r}let s={id:e,description:o,defaults:t,deprecationMessage:n};this.iconsById[e]=s;let l={$ref:"#/definitions/icons"};return n&&(l.deprecationMessage=n),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 t=this.iconReferenceSchema.enum.indexOf(e);t!==-1&&(this.iconReferenceSchema.enum.splice(t,1),this.iconReferenceSchema.enumDescriptions.splice(t,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,t){let o=this.iconFontsById[e];return o||(this.iconFontsById[e]=t,this._onDidChange.fire(),t)}deregisterIconFont(e){delete this.iconFontsById[e]}getIconFont(e){return this.iconFontsById[e]}toString(){let e=(r,s)=>r.id.localeCompare(s.id),t=r=>{for(;q.isThemeIcon(r.defaults);)r=this.iconsById[r.defaults.id];return`codicon codicon-${r?r.id:""}`},o=[];o.push("| preview     | identifier                        | default codicon ID                | description"),o.push("| ----------- | --------------------------------- | --------------------------------- | --------------------------------- |");let n=Object.keys(this.iconsById).map(r=>this.iconsById[r]);for(let r of n.filter(s=>!!s.description).sort(e))o.push(`|<i class="${t(r)}"></i>|${r.id}|${q.isThemeIcon(r.defaults)?r.defaults.id:r.id}|${r.description||""}|`);o.push("| preview     | identifier                        "),o.push("| ----------- | --------------------------------- |");for(let r of n.filter(s=>!q.isThemeIcon(s.defaults)).sort(e))o.push(`|<i class="${t(r)}"></i>|${r.id}|`);return o.join(`
`)}},ece=new Eri;ne.add(Tri.IconContribution,ece);function Ae(a,i,e,t){return ece.registerIcon(a,i,e,t)}function mw(){return ece}function e1o(){let a=Agt();for(let i in a){let e="\\"+a[i].toString(16);ece.registerIcon(i,{fontCharacter:e})}}e1o();var jyt="vscode://schemas/icons",g6i=ne.as(ma.JSONContribution);g6i.registerSchema(jyt,ece.getIconSchema());var m6i=new Dt(()=>g6i.notifySchemaChanged(jyt),200);ece.onDidChange(()=>{m6i.isScheduled()||m6i.schedule()});var PE=Ae("widget-close",R.close,d(2669,null)),f6i=Ae("goto-previous-location",R.arrowUp,d(2667,null)),v6i=Ae("goto-next-location",R.arrowDown,d(2666,null)),I4e=q.modify(R.sync,"spin"),AE=q.modify(R.loading,"spin");var t1o=Ae("diff-review-insert",R.add,d(209,null)),i1o=Ae("diff-review-remove",R.remove,d(210,null)),o1o=Ae("diff-review-close",R.close,d(208,null)),zO=class extends x{constructor(e,t,o,n,r,s,l,c,u){super();this._parentNode=e;this._visible=t;this._setVisible=o;this._canClose=n;this._width=r;this._height=s;this._diffs=l;this._models=c;this._instantiationService=u;this._state=ke(this,e=>{let t=this._visible.read(e);if(this._parentNode.style.visibility=t?"visible":"hidden",!t)return null;let o=e.store.add(this._instantiationService.createInstance(w4e,this._diffs,this._models,this._setVisible,this._canClose)),n=e.store.add(this._instantiationService.createInstance(C4e,this._parentNode,o,this._width,this._height,this._models));return{model:o,view:n}}).recomputeInitiallyAndOnChange(this._store)}static{this._ttPolicy=pf("diffReview",{createHTML:e=>e})}next(){Gi(e=>{let t=this._visible.get();this._setVisible(!0,e),t&&this._state.get().model.nextGroup(e)})}prev(){Gi(e=>{this._setVisible(!0,e),this._state.get().model.previousGroup(e)})}close(){Gi(e=>{this._setVisible(!1,e)})}};zO=I([m(8,F)],zO);var w4e=class extends x{constructor(e,t,o,n,r){super();this._diffs=e;this._models=t;this._setVisible=o;this.canClose=n;this._accessibilitySignalService=r;this._groups=Me(this,[]);this._currentGroupIdx=Me(this,0);this._currentElementIdx=Me(this,0);this.groups=this._groups;this.currentGroup=this._currentGroupIdx.map((e,t)=>this._groups.read(t)[e]);this.currentGroupIndex=this._currentGroupIdx;this.currentElement=this._currentElementIdx.map((e,t)=>this.currentGroup.read(t)?.lines[e]);this._register(be(s=>{let l=this._diffs.read(s);if(!l){this._groups.set([],void 0);return}let c=n1o(l,this._models.getOriginalModel().getLineCount(),this._models.getModifiedModel().getLineCount());Gi(u=>{let p=this._models.getModifiedPosition();if(p){let h=c.findIndex(g=>p?.lineNumber<g.range.modified.endLineNumberExclusive);h!==-1&&this._currentGroupIdx.set(h,u)}this._groups.set(c,u)})})),this._register(be(s=>{let l=this.currentElement.read(s);l?.type===2?this._accessibilitySignalService.playSignal($o.diffLineDeleted,{source:"accessibleDiffViewer.currentElementChanged"}):l?.type===3&&this._accessibilitySignalService.playSignal($o.diffLineInserted,{source:"accessibleDiffViewer.currentElementChanged"})})),this._register(be(s=>{let l=this.currentElement.read(s);if(l&&l.type!==0){let c=l.modifiedLineNumber??l.diff.modified.startLineNumber;this._models.modifiedSetSelection(z.fromPositions(new ye(c,1)))}}))}_goToGroupDelta(e,t){let o=this.groups.get();!o||o.length<=1||nO(t,n=>{this._currentGroupIdx.set(pi.ofLength(o.length).clipCyclic(this._currentGroupIdx.get()+e),n),this._currentElementIdx.set(0,n)})}nextGroup(e){this._goToGroupDelta(1,e)}previousGroup(e){this._goToGroupDelta(-1,e)}_goToLineDelta(e){let t=this.currentGroup.get();!t||t.lines.length<=1||Gi(o=>{this._currentElementIdx.set(pi.ofLength(t.lines.length).clip(this._currentElementIdx.get()+e),o)})}goToNextLine(){this._goToLineDelta(1)}goToPreviousLine(){this._goToLineDelta(-1)}goToLine(e){let t=this.currentGroup.get();if(!t)return;let o=t.lines.indexOf(e);o!==-1&&Gi(n=>{this._currentElementIdx.set(o,n)})}revealCurrentElementInEditor(){if(!this.canClose.get())return;this._setVisible(!1,void 0);let e=this.currentElement.get();e&&(e.type===2?this._models.originalReveal(z.fromPositions(new ye(e.originalLineNumber,1))):this._models.modifiedReveal(e.type!==0?z.fromPositions(new ye(e.modifiedLineNumber,1)):void 0))}close(){this.canClose.get()&&(this._setVisible(!1,void 0),this._models.modifiedFocus())}};w4e=I([m(4,lr)],w4e);var y4e=3;function n1o(a,i,e){let t=[];for(let o of D9(a,(n,r)=>r.modified.startLineNumber-n.modified.endLineNumberExclusive<2*y4e)){let n=[];n.push(new Dri);let r=new uo(Math.max(1,o[0].original.startLineNumber-y4e),Math.min(o[o.length-1].original.endLineNumberExclusive+y4e,i+1)),s=new uo(Math.max(1,o[0].modified.startLineNumber-y4e),Math.min(o[o.length-1].modified.endLineNumberExclusive+y4e,e+1));aht(o,(u,p)=>{let h=new uo(u?u.original.endLineNumberExclusive:r.startLineNumber,p?p.original.startLineNumber:r.endLineNumberExclusive),g=new uo(u?u.modified.endLineNumberExclusive:s.startLineNumber,p?p.modified.startLineNumber:s.endLineNumberExclusive);h.forEach(f=>{n.push(new Mri(f,g.startLineNumber+(f-h.startLineNumber)))}),p&&(p.original.forEach(f=>{n.push(new Lri(p,f))}),p.modified.forEach(f=>{n.push(new Rri(p,f))}))});let l=o[0].modified.join(o[o.length-1].modified),c=o[0].original.join(o[o.length-1].original);t.push(new _ri(new jI(l,c),n))}return t}var _ri=class{constructor(i,e){this.range=i;this.lines=e}},Dri=class{constructor(){this.type=0}},Lri=class{constructor(i,e){this.diff=i;this.originalLineNumber=e;this.type=2;this.modifiedLineNumber=void 0}},Rri=class{constructor(i,e){this.diff=i;this.modifiedLineNumber=e;this.type=3;this.originalLineNumber=void 0}},Mri=class{constructor(i,e){this.originalLineNumber=i;this.modifiedLineNumber=e;this.type=1}},C4e=class extends x{constructor(e,t,o,n,r,s){super();this._element=e;this._model=t;this._width=o;this._height=n;this._models=r;this._languageService=s;this.domNode=this._element,this.domNode.className="monaco-component diff-review monaco-editor-background";let l=document.createElement("div");l.className="diff-review-actions",this._actionBar=this._register(new Zi(l)),this._register(be(c=>{this._actionBar.clear(),this._model.canClose.read(c)&&this._actionBar.push(ii({id:"diffreview.close",label:d(217,null),class:"close-diff-review "+q.asClassName(o1o),enabled:!0,run:async()=>t.close()}),{label:!1,icon:!0})})),this._content=document.createElement("div"),this._content.className="diff-review-content",this._content.setAttribute("role","code"),this._scrollbar=this._register(new ms(this._content,{})),vi(this.domNode,this._scrollbar.getDomNode(),l),this._register(be(c=>{this._height.read(c),this._width.read(c),this._scrollbar.scanDomNode()})),this._register(Z(()=>{vi(this.domNode)})),this._register(OP(this.domNode,{width:this._width,height:this._height})),this._register(OP(this._content,{width:this._width,height:this._height})),this._register(il((c,u)=>{this._model.currentGroup.read(c),this._render(u)})),this._register(Jo(this.domNode,"keydown",c=>{(c.equals(18)||c.equals(2066)||c.equals(530))&&(c.preventDefault(),this._model.goToNextLine()),(c.equals(16)||c.equals(2064)||c.equals(528))&&(c.preventDefault(),this._model.goToPreviousLine()),(c.equals(9)||c.equals(2057)||c.equals(521)||c.equals(1033))&&(c.preventDefault(),this._model.close()),(c.equals(10)||c.equals(3))&&(c.preventDefault(),this._model.revealCurrentElementInEditor())}))}_render(e){let t=this._models.getOriginalOptions(),o=this._models.getModifiedOptions(),n=document.createElement("div");n.className="diff-review-table",n.setAttribute("role","list"),n.setAttribute("aria-label",d(211,null)),Jd(n,o.get(59)),vi(this._content,n);let r=this._models.getOriginalModel(),s=this._models.getModifiedModel();if(!r||!s)return;let l=r.getOptions(),c=s.getOptions(),u=o.get(75),p=this._model.currentGroup.get();for(let h of p?.lines||[]){if(!p)break;let g;if(h.type===0){let v=document.createElement("div");v.className="diff-review-row",v.setAttribute("role","listitem");let b=p.range,S=this._model.currentGroupIndex.get(),y=this._model.groups.get().length,w=O=>O===0?d(219,null):O===1?d(220,null):d(218,null,O),k=w(b.original.length),T=w(b.modified.length);v.setAttribute("aria-label",d(215,null,S+1,y,b.original.startLineNumber,k,b.modified.startLineNumber,T));let P=document.createElement("div");P.className="diff-review-cell diff-review-summary",P.appendChild(document.createTextNode(`${S+1}/${y}: @@ -${b.original.startLineNumber},${b.original.length} +${b.modified.startLineNumber},${b.modified.length} @@`)),v.appendChild(P),g=v}else g=this._createRow(h,u,this._width.get(),t,r,l,o,s,c);n.appendChild(g);let f=ke(v=>this._model.currentElement.read(v)===h);e.add(be(v=>{let b=f.read(v);g.tabIndex=b?0:-1,b&&g.focus()})),e.add(j(g,"focus",()=>{this._model.goToLine(h)}))}this._scrollbar.scanDomNode()}_createRow(e,t,o,n,r,s,l,c,u){let p=n.get(165),h=p.glyphMarginWidth+p.lineNumbersWidth,g=l.get(165),f=10+g.glyphMarginWidth+g.lineNumbersWidth,v="diff-review-row",b="",S="diff-review-spacer",y=null;switch(e.type){case 3:v="diff-review-row line-insert",b=" char-insert",y=t1o;break;case 2:v="diff-review-row line-delete",b=" char-delete",y=i1o;break}let w=document.createElement("div");w.style.minWidth=o+"px",w.className=v,w.setAttribute("role","listitem"),w.ariaLevel="";let k=document.createElement("div");k.className="diff-review-cell",k.style.height=`${t}px`,w.appendChild(k);let T=document.createElement("span");T.style.width=h+"px",T.style.minWidth=h+"px",T.className="diff-review-line-number"+b,e.originalLineNumber!==void 0?T.appendChild(document.createTextNode(String(e.originalLineNumber))):T.innerText="\xA0",k.appendChild(T);let P=document.createElement("span");P.style.width=f+"px",P.style.minWidth=f+"px",P.style.paddingRight="10px",P.className="diff-review-line-number"+b,e.modifiedLineNumber!==void 0?P.appendChild(document.createTextNode(String(e.modifiedLineNumber))):P.innerText="\xA0",k.appendChild(P);let O=document.createElement("span");if(O.className=S,y){let G=document.createElement("span");G.className=q.asClassName(y),G.innerText="\xA0\xA0",O.appendChild(G)}else O.innerText="\xA0\xA0";k.appendChild(O);let V;if(e.modifiedLineNumber!==void 0){let G=this._getLineHtml(c,l,u.tabSize,e.modifiedLineNumber,this._languageService.languageIdCodec);zO._ttPolicy&&(G=zO._ttPolicy.createHTML(G)),k.insertAdjacentHTML("beforeend",G),V=c.getLineContent(e.modifiedLineNumber)}else{let G=this._getLineHtml(r,n,s.tabSize,e.originalLineNumber,this._languageService.languageIdCodec);zO._ttPolicy&&(G=zO._ttPolicy.createHTML(G)),k.insertAdjacentHTML("beforeend",G),V=r.getLineContent(e.originalLineNumber)}V.length===0&&(V=d(212,null));let H="";switch(e.type){case 1:e.originalLineNumber===e.modifiedLineNumber?H=d(221,null,V,e.originalLineNumber):H=d(214,null,V,e.originalLineNumber,e.modifiedLineNumber);break;case 3:H=d(216,null,V,e.modifiedLineNumber);break;case 2:H=d(213,null,V,e.originalLineNumber);break}return w.setAttribute("aria-label",H),w}_getLineHtml(e,t,o,n,r){let s=e.getLineContent(n),l=t.get(59),c=t.get(117).verticalScrollbarSize,u=Zc.createEmpty(s,r),p=ez.isBasicASCII(s,e.mightContainNonBasicASCII()),h=ez.containsRTL(s,p,e.mightContainRTL());return N4i(new XL(l.isMonospace&&!t.get(40),l.canUseHalfwidthRightwardsArrow,s,!1,p,h,0,u,[],o,0,l.spaceWidth,l.middotWidth,l.wsmiddotWidth,t.get(133),t.get(113),t.get(108),t.get(60)!==Bx.OFF,null,null,c)).html}};C4e=I([m(5,_t)],C4e);var Qyt=class{constructor(i){this.editors=i}getOriginalModel(){return this.editors.original.getModel()}getOriginalOptions(){return this.editors.original.getOptions()}originalReveal(i){this.editors.original.revealRange(i),this.editors.original.setSelection(i),this.editors.original.focus()}getModifiedModel(){return this.editors.modified.getModel()}getModifiedOptions(){return this.editors.modified.getOptions()}modifiedReveal(i){i&&(this.editors.modified.revealRange(i),this.editors.modified.setSelection(i)),this.editors.modified.focus()}modifiedSetSelection(i){this.editors.modified.setSelection(i)}modifiedFocus(){this.editors.modified.focus()}getModifiedPosition(){return this.editors.modified.getPosition()??void 0}};var fCr=te("diffEditor.move.border","#8b8b8b9c",d(247,null)),vCr=te("diffEditor.moveActive.border","#FFA500",d(248,null)),bCr=te("diffEditor.unchangedRegionShadow",{dark:"#000000",light:"#737373BF",hcDark:"#000000",hcLight:"#737373BF"},d(249,null)),r1o=Ae("diff-insert",R.add,d(250,null)),Pri=Ae("diff-remove",R.remove,d(251,null)),Ari=mo.register({className:"line-insert",description:"line-insert",isWholeLine:!0,linesDecorationsClassName:"insert-sign "+q.asClassName(r1o),marginClassName:"gutter-insert"}),Nri=mo.register({className:"line-delete",description:"line-delete",isWholeLine:!0,linesDecorationsClassName:"delete-sign "+q.asClassName(Pri),marginClassName:"gutter-delete"}),Ori=mo.register({className:"line-insert",description:"line-insert",isWholeLine:!0,marginClassName:"gutter-insert"}),Fri=mo.register({className:"line-delete",description:"line-delete",isWholeLine:!0,marginClassName:"gutter-delete"}),tce=mo.register({className:"char-insert",description:"char-insert",shouldFillLineOnLineBreak:!0}),ACe=mo.register({className:"char-insert",description:"char-insert",isWholeLine:!0}),b6i=mo.register({className:"char-insert diff-range-empty",description:"char-insert diff-range-empty"}),jj=mo.register({className:"char-delete",description:"char-delete",shouldFillLineOnLineBreak:!0}),S6i=mo.register({className:"char-delete",description:"char-delete",isWholeLine:!0}),I6i=mo.register({className:"char-delete diff-range-empty",description:"char-delete diff-range-empty"});var Wri=le("diffProviderFactoryService"),x4e=class{constructor(i){this.instantiationService=i}createDiffProvider(i){return this.instantiationService.createInstance(GV,i)}};x4e=I([m(0,F)],x4e);Ee(Wri,x4e,1);var GV=class{constructor(i,e,t){this.editorWorkerService=e;this.telemetryService=t;this.onDidChangeEventEmitter=new E;this.onDidChange=this.onDidChangeEventEmitter.event;this.diffAlgorithm="advanced";this.diffAlgorithmOnDidChangeSubscription=void 0;this.setOptions(i)}static{this.diffCache=new Map}dispose(){this.diffAlgorithmOnDidChangeSubscription?.dispose(),this.onDidChangeEventEmitter.dispose()}async computeDiff(i,e,t,o){if(typeof this.diffAlgorithm!="string")return this.diffAlgorithm.computeDiff(i,e,t,o);if(i.isDisposed()||e.isDisposed())return{changes:[],identical:!0,quitEarly:!1,moves:[]};if(i.getLineCount()===1&&i.getLineMaxColumn(1)===1)return e.getLineCount()===1&&e.getLineMaxColumn(1)===1?{changes:[],identical:!0,quitEarly:!1,moves:[]}:{changes:[new Uf(new uo(1,2),new uo(1,e.getLineCount()+1),[new Eg(i.getFullModelRange(),e.getFullModelRange())])],identical:!1,quitEarly:!1,moves:[]};let n=JSON.stringify([i.uri.toString(),e.uri.toString()]),r=JSON.stringify([i.id,e.id,i.getAlternativeVersionId(),e.getAlternativeVersionId(),JSON.stringify(t)]),s=GV.diffCache.get(n);if(s&&s.context===r)return s.result;let l=Dn.create(),c=await this.editorWorkerService.computeDiff(i.uri,e.uri,t,this.diffAlgorithm),u=l.elapsed();if(this.telemetryService.publicLog2("diffEditor.computeDiff",{timeMs:u,timedOut:c?.quitEarly??!0,detectedMoves:t.computeMoves?c?.moves.length??0:-1}),o.isCancellationRequested)return{changes:[],identical:!1,quitEarly:!0,moves:[]};if(!c)throw new Error("no diff result available");return GV.diffCache.size>10&&GV.diffCache.delete(GV.diffCache.keys().next().value),GV.diffCache.set(n,{result:c,context:r}),c}setOptions(i){let e=!1;i.diffAlgorithm&&this.diffAlgorithm!==i.diffAlgorithm&&(this.diffAlgorithmOnDidChangeSubscription?.dispose(),this.diffAlgorithmOnDidChangeSubscription=void 0,this.diffAlgorithm=i.diffAlgorithm,typeof i.diffAlgorithm!="string"&&(this.diffAlgorithmOnDidChangeSubscription=i.diffAlgorithm.onDidChange(()=>this.onDidChangeEventEmitter.fire())),e=!0),e&&this.onDidChangeEventEmitter.fire()}};GV=I([m(1,Qs),m(2,Te)],GV);var hY=class extends x{constructor(e,t,o){super();this.model=e;this._options=t;this._diffProviderFactoryService=o;this._isDiffUpToDate=Me(this,!1);this.isDiffUpToDate=this._isDiffUpToDate;this._diff=Me(this,void 0);this.diff=this._diff;this._unchangedRegions=Me(this,void 0);this.unchangedRegions=ke(this,e=>this._options.hideUnchangedRegions.read(e)?this._unchangedRegions.read(e)?.regions??[]:(Gi(t=>{for(let o of this._unchangedRegions.read(void 0)?.regions||[])o.collapseAll(t)}),[]));this.movedTextToCompare=Me(this,void 0);this._activeMovedText=Me(this,void 0);this._hoveredMovedText=Me(this,void 0);this.activeMovedText=ke(this,e=>this.movedTextToCompare.read(e)??this._hoveredMovedText.read(e)??this._activeMovedText.read(e));this._cancellationTokenSource=new Ye;this._diffProvider=ke(this,e=>{let t=this._diffProviderFactoryService.createDiffProvider({diffAlgorithm:this._options.diffAlgorithm.read(e)}),o=Fr("onDidChange",t.onDidChange);return{diffProvider:t,onChangeSignal:o}});this._register(Z(()=>this._cancellationTokenSource.cancel()));let n=wc("contentChangedSignal"),r=this._register(new Dt(()=>n.trigger(void 0),200));this._register(be(l=>{let c=this._unchangedRegions.read(l);if(!c||c.regions.some(v=>v.isDragged.read(l)))return;let u=c.originalDecorationIds.map(v=>e.original.getDecorationRange(v)).map(v=>v?uo.fromRangeInclusive(v):void 0),p=c.modifiedDecorationIds.map(v=>e.modified.getDecorationRange(v)).map(v=>v?uo.fromRangeInclusive(v):void 0),h=c.regions.map((v,b)=>!u[b]||!p[b]?void 0:new gY(u[b].startLineNumber,p[b].startLineNumber,u[b].length,v.visibleLineCountTop.read(l),v.visibleLineCountBottom.read(l))).filter(lo),g=[],f=!1;for(let v of D9(h,(b,S)=>b.getHiddenModifiedRange(l).endLineNumberExclusive===S.getHiddenModifiedRange(l).startLineNumber))if(v.length>1){f=!0;let b=v.reduce((y,w)=>y+w.lineCount,0),S=new gY(v[0].originalLineNumber,v[0].modifiedLineNumber,b,v[0].visibleLineCountTop.read(void 0),v[v.length-1].visibleLineCountBottom.read(void 0));g.push(S)}else g.push(v[0]);if(f){let v=e.original.deltaDecorations(c.originalDecorationIds,g.map(S=>({range:S.originalUnchangedRange.toInclusiveRange(),options:{description:"unchanged"}}))),b=e.modified.deltaDecorations(c.modifiedDecorationIds,g.map(S=>({range:S.modifiedUnchangedRange.toInclusiveRange(),options:{description:"unchanged"}})));Gi(S=>{this._unchangedRegions.set({regions:g,originalDecorationIds:v,modifiedDecorationIds:b},S)})}}));let s=(l,c,u)=>{let p=gY.fromDiffs(l.changes,e.original.getLineCount(),e.modified.getLineCount(),this._options.hideUnchangedRegionsMinimumLineCount.read(u),this._options.hideUnchangedRegionsContextLineCount.read(u)),h,g=this._unchangedRegions.get();if(g){let S=g.originalDecorationIds.map(T=>e.original.getDecorationRange(T)).map(T=>T?uo.fromRangeInclusive(T):void 0),y=g.modifiedDecorationIds.map(T=>e.modified.getDecorationRange(T)).map(T=>T?uo.fromRangeInclusive(T):void 0),k=p6i(g.regions.map((T,P)=>{if(!S[P]||!y[P])return;let O=S[P].length;return new gY(S[P].startLineNumber,y[P].startLineNumber,O,Math.min(T.visibleLineCountTop.get(),O),Math.min(T.visibleLineCountBottom.get(),O-T.visibleLineCountTop.get()))}).filter(lo),(T,P)=>!P||T.modifiedLineNumber>=P.modifiedLineNumber+P.lineCount&&T.originalLineNumber>=P.originalLineNumber+P.lineCount).map(T=>new jI(T.getHiddenOriginalRange(u),T.getHiddenModifiedRange(u)));k=jI.clip(k,uo.ofLength(1,e.original.getLineCount()),uo.ofLength(1,e.modified.getLineCount())),h=jI.inverse(k,e.original.getLineCount(),e.modified.getLineCount())}let f=[];if(h)for(let S of p){let y=h.filter(w=>w.original.intersectsStrict(S.originalUnchangedRange)&&w.modified.intersectsStrict(S.modifiedUnchangedRange));f.push(...S.setVisibleRanges(y,c))}else f.push(...p);let v=e.original.deltaDecorations(g?.originalDecorationIds||[],f.map(S=>({range:S.originalUnchangedRange.toInclusiveRange(),options:{description:"unchanged"}}))),b=e.modified.deltaDecorations(g?.modifiedDecorationIds||[],f.map(S=>({range:S.modifiedUnchangedRange.toInclusiveRange(),options:{description:"unchanged"}})));this._unchangedRegions.set({regions:f,originalDecorationIds:v,modifiedDecorationIds:b},c)};this._register(e.modified.onDidChangeContent(l=>{if(this._diff.get()){let u=WO.fromModelContentChanges(l.changes),p=(this._lastDiff,e.original,e.modified,void 0);p&&(this._lastDiff=p,Gi(h=>{this._diff.set(ice.fromDiffResult(this._lastDiff),h),s(p,h);let g=this.movedTextToCompare.get();this.movedTextToCompare.set(g?this._lastDiff.moves.find(f=>f.lineRangeMapping.modified.intersect(g.lineRangeMapping.modified)):void 0,h)}))}this._isDiffUpToDate.set(!1,void 0),r.schedule()})),this._register(e.original.onDidChangeContent(l=>{if(this._diff.get()){let u=WO.fromModelContentChanges(l.changes),p=(this._lastDiff,e.original,e.modified,void 0);p&&(this._lastDiff=p,Gi(h=>{this._diff.set(ice.fromDiffResult(this._lastDiff),h),s(p,h);let g=this.movedTextToCompare.get();this.movedTextToCompare.set(g?this._lastDiff.moves.find(f=>f.lineRangeMapping.modified.intersect(g.lineRangeMapping.modified)):void 0,h)}))}this._isDiffUpToDate.set(!1,void 0),r.schedule()})),this._register(il(async(l,c)=>{this._options.hideUnchangedRegionsMinimumLineCount.read(l),this._options.hideUnchangedRegionsContextLineCount.read(l),r.cancel(),n.read(l);let u=this._diffProvider.read(l);u.onChangeSignal.read(l),Xx(wye,l),Xx(_je,l),this._isDiffUpToDate.set(!1,void 0);let p=[];c.add(e.original.onDidChangeContent(f=>{let v=WO.fromModelContentChanges(f.changes);p=Zwe(p,v)}));let h=[];c.add(e.modified.onDidChangeContent(f=>{let v=WO.fromModelContentChanges(f.changes);h=Zwe(h,v)}));let g=await u.diffProvider.computeDiff(e.original,e.modified,{ignoreTrimWhitespace:this._options.ignoreTrimWhitespace.read(l),maxComputationTimeMs:this._options.maxComputationTimeMs.read(l),computeMoves:this._options.showMoves.read(l)},this._cancellationTokenSource.token);this._cancellationTokenSource.token.isCancellationRequested||e.original.isDisposed()||e.modified.isDisposed()||(g=s1o(g,e.original,e.modified),g=(e.original,e.modified,void 0)??g,g=(e.original,e.modified,void 0)??g,Gi(f=>{s(g,f),this._lastDiff=g;let v=ice.fromDiffResult(g);this._diff.set(v,f),this._isDiffUpToDate.set(!0,f);let b=this.movedTextToCompare.read(void 0);this.movedTextToCompare.set(b?this._lastDiff.moves.find(S=>S.lineRangeMapping.modified.intersect(b.lineRangeMapping.modified)):void 0,f)}))}))}setActiveMovedText(e){this._activeMovedText.set(e,void 0)}setHoveredMovedText(e){this._hoveredMovedText.set(e,void 0)}ensureModifiedLineIsVisible(e,t,o){if(this.diff.get()?.mappings.length===0)return;let n=this._unchangedRegions.get()?.regions||[];for(let r of n)if(r.getHiddenModifiedRange(void 0).contains(e)){r.showModifiedLine(e,t,o);return}}ensureOriginalLineIsVisible(e,t,o){if(this.diff.get()?.mappings.length===0)return;let n=this._unchangedRegions.get()?.regions||[];for(let r of n)if(r.getHiddenOriginalRange(void 0).contains(e)){r.showOriginalLine(e,t,o);return}}async waitForDiff(){await Wf(this.isDiffUpToDate,e=>e)}serializeState(){return{collapsedRegions:this._unchangedRegions.get()?.regions.map(t=>({range:t.getHiddenModifiedRange(void 0).serialize()}))}}restoreSerializedState(e){let t=e.collapsedRegions?.map(n=>uo.deserialize(n.range)),o=this._unchangedRegions.get();!o||!t||Gi(n=>{for(let r of o.regions)for(let s of t)if(r.modifiedUnchangedRange.intersect(s)){r.setHiddenModifiedRange(s,n);break}})}};hY=I([m(2,Wri)],hY);function s1o(a,i,e){return{changes:a.changes.map(t=>new Uf(t.original,t.modified,t.innerChanges?t.innerChanges.map(o=>a1o(o,i,e)):void 0)),moves:a.moves,identical:a.identical,quitEarly:a.quitEarly}}function a1o(a,i,e){let t=a.originalRange,o=a.modifiedRange;return t.startColumn===1&&o.startColumn===1&&(t.endColumn!==1||o.endColumn!==1)&&t.endColumn===i.getLineMaxColumn(t.endLineNumber)&&o.endColumn===e.getLineMaxColumn(o.endLineNumber)&&t.endLineNumber<i.getLineCount()&&o.endLineNumber<e.getLineCount()&&(t=t.setEndPosition(t.endLineNumber+1,1),o=o.setEndPosition(o.endLineNumber+1,1)),new Eg(t,o)}var ice=class a{constructor(i,e,t,o){this.mappings=i;this.movedTexts=e;this.identical=t;this.quitEarly=o}static fromDiffResult(i){return new a(i.changes.map(e=>new k4e(e)),i.moves||[],i.identical,i.quitEarly)}},k4e=class{constructor(i){this.lineRangeMapping=i}},gY=class a{constructor(i,e,t,o,n){this.originalLineNumber=i;this.modifiedLineNumber=e;this.lineCount=t;this._visibleLineCountTop=Me(this,0);this.visibleLineCountTop=this._visibleLineCountTop;this._visibleLineCountBottom=Me(this,0);this.visibleLineCountBottom=this._visibleLineCountBottom;this._shouldHideControls=ke(this,i=>this.visibleLineCountTop.read(i)+this.visibleLineCountBottom.read(i)===this.lineCount&&!this.isDragged.read(i));this.isDragged=Me(this,void 0);let r=Math.max(Math.min(o,this.lineCount),0),s=Math.max(Math.min(n,this.lineCount-o),0);yXt(o===r),yXt(n===s),this._visibleLineCountTop.set(r,void 0),this._visibleLineCountBottom.set(s,void 0)}static fromDiffs(i,e,t,o,n){let r=Uf.inverse(i,e,t),s=[];for(let l of r){let c=l.original.startLineNumber,u=l.modified.startLineNumber,p=l.original.length,h=c===1&&u===1,g=c+p===e+1&&u+p===t+1;(h||g)&&p>=n+o?(h&&!g&&(p-=n),g&&!h&&(c+=n,u+=n,p-=n),s.push(new a(c,u,p,0,0))):p>=n*2+o&&(c+=n,u+=n,p-=n*2,s.push(new a(c,u,p,0,0)))}return s}get originalUnchangedRange(){return uo.ofLength(this.originalLineNumber,this.lineCount)}get modifiedUnchangedRange(){return uo.ofLength(this.modifiedLineNumber,this.lineCount)}setVisibleRanges(i,e){let t=[],o=new kP(i.map(l=>l.modified)).subtractFrom(this.modifiedUnchangedRange),n=this.originalLineNumber,r=this.modifiedLineNumber,s=this.modifiedLineNumber+this.lineCount;if(o.ranges.length===0)this.showAll(e),t.push(this);else{let l=0;for(let c of o.ranges){let u=l===o.ranges.length-1;l++;let p=(u?s:c.endLineNumberExclusive)-r,h=new a(n,r,p,0,0);h.setHiddenModifiedRange(c,e),t.push(h),n=h.originalUnchangedRange.endLineNumberExclusive,r=h.modifiedUnchangedRange.endLineNumberExclusive}}return t}shouldHideControls(i){return this._shouldHideControls.read(i)}getHiddenOriginalRange(i){return uo.ofLength(this.originalLineNumber+this._visibleLineCountTop.read(i),this.lineCount-this._visibleLineCountTop.read(i)-this._visibleLineCountBottom.read(i))}getHiddenModifiedRange(i){return uo.ofLength(this.modifiedLineNumber+this._visibleLineCountTop.read(i),this.lineCount-this._visibleLineCountTop.read(i)-this._visibleLineCountBottom.read(i))}setHiddenModifiedRange(i,e){let t=i.startLineNumber-this.modifiedLineNumber,o=this.modifiedLineNumber+this.lineCount-i.endLineNumberExclusive;this.setState(t,o,e)}getMaxVisibleLineCountTop(){return this.lineCount-this._visibleLineCountBottom.get()}getMaxVisibleLineCountBottom(){return this.lineCount-this._visibleLineCountTop.get()}showMoreAbove(i=10,e){let t=this.getMaxVisibleLineCountTop();this._visibleLineCountTop.set(Math.min(this._visibleLineCountTop.get()+i,t),e)}showMoreBelow(i=10,e){let t=this.lineCount-this._visibleLineCountTop.get();this._visibleLineCountBottom.set(Math.min(this._visibleLineCountBottom.get()+i,t),e)}showAll(i){this._visibleLineCountBottom.set(this.lineCount-this._visibleLineCountTop.get(),i)}showModifiedLine(i,e,t){let o=i+1-(this.modifiedLineNumber+this._visibleLineCountTop.get()),n=this.modifiedLineNumber-this._visibleLineCountBottom.get()+this.lineCount-i;e===0&&o<n||e===1?this._visibleLineCountTop.set(this._visibleLineCountTop.get()+o,t):this._visibleLineCountBottom.set(this._visibleLineCountBottom.get()+n,t)}showOriginalLine(i,e,t){let o=i-this.originalLineNumber,n=this.originalLineNumber+this.lineCount-i;e===0&&o<n||e===1?this._visibleLineCountTop.set(Math.min(this._visibleLineCountTop.get()+n-o,this.getMaxVisibleLineCountTop()),t):this._visibleLineCountBottom.set(Math.min(this._visibleLineCountBottom.get()+o-n,this.getMaxVisibleLineCountBottom()),t)}collapseAll(i){this._visibleLineCountTop.set(0,i),this._visibleLineCountBottom.set(0,i)}setState(i,e,t){i=Math.max(Math.min(i,this.lineCount),0),e=Math.max(Math.min(e,this.lineCount-i),0),this._visibleLineCountTop.set(i,t),this._visibleLineCountBottom.set(e,t)}};function y6i(a){let{domNode:i,renderLinesResult:e,diffEntry:t,originalModel:o,clipboardService:n}=a,r=new N;return r.add(j(i,"copy",s=>{s.preventDefault();let l=i.ownerDocument.getSelection();if(!l||l.rangeCount===0)return;let c=l.getRangeAt(0);if(!c||c.collapsed)return;let u=c.startContainer.nodeType===Node.TEXT_NODE?c.startContainer.parentElement:c.startContainer,p=c.endContainer.nodeType===Node.TEXT_NODE?c.endContainer.parentElement:c.endContainer;if(!u||!p)return;let h=e.getModelPositionAt(u,c.startOffset),g=e.getModelPositionAt(p,c.endOffset);if(!h||!g)return;let f=h.delta(t.original.startLineNumber-1),v=g.delta(t.original.startLineNumber-1),b=v.isBefore(f)?z.fromPositions(v,f):z.fromPositions(f,v),S=o.getValueInRange(b);n.writeText(S)})),r}var Yyt=class extends x{constructor(e,t,o,n,r,s,l,c,u,p){super();this._getViewZoneId=e;this._marginDomNode=t;this._deletedCodeDomNode=o;this._modifiedEditor=n;this._diff=r;this._editor=s;this._renderLinesResult=l;this._originalTextModel=c;this._contextMenuService=u;this._clipboardService=p;this._visibility=!1;this._marginDomNode.style.zIndex="10",this._diffActions=document.createElement("div"),this._diffActions.className=q.asClassName(R.lightBulb)+" lightbulb-glyph",this._diffActions.style.position="absolute";let h=this._modifiedEditor.getOption(75);this._diffActions.style.right="0px",this._diffActions.style.visibility="hidden",this._diffActions.style.height=`${h}px`,this._diffActions.style.lineHeight=`${h}px`,this._marginDomNode.appendChild(this._diffActions);let g=0,f=n.getOption(144)&&!dc,v=(b,S,y)=>{this._contextMenuService.showContextMenu({domForShadowRoot:f?n.getDomNode()??void 0:void 0,getAnchor:()=>b,onHide:y,getActions:()=>{let w=S??[],k=r.modified.isEmpty;return w.push(new it("diff.clipboard.copyDeletedContent",k?r.original.length>1?d(227,null):d(228,null):r.original.length>1?d(224,null):d(225,null),void 0,!0,async()=>{let P=this._originalTextModel.getValueInRange(r.original.toExclusiveRange());await this._clipboardService.writeText(P)})),r.original.length>1&&w.push(new it("diff.clipboard.copyDeletedLineContent",k?d(226,null,r.original.startLineNumber+g):d(223,null,r.original.startLineNumber+g),void 0,!0,async()=>{let P=this._originalTextModel.getLineContent(r.original.startLineNumber+g);P===""&&(P=this._originalTextModel.getEndOfLineSequence()===0?`
`:`\r
`),await this._clipboardService.writeText(P)})),n.getOption(104)||w.push(new it("diff.inline.revertChange",d(229,null),void 0,!0,async()=>{this._editor.revert(this._diff)})),w},autoSelectFirstItem:!0})};this._register(Jo(this._diffActions,"mousedown",b=>{if(!b.leftButton)return;let{top:S,height:y}=ir(this._diffActions),w=Math.floor(h/3);b.preventDefault(),v({x:b.posx,y:S+y+w})})),this._register(n.onMouseMove(b=>{(b.target.type===8||b.target.type===5)&&b.target.detail.viewZoneId===this._getViewZoneId()?(g=this._updateLightBulbPosition(this._marginDomNode,b.event.browserEvent.y,h),this.visibility=!0):this.visibility=!1})),this._register(y6i({domNode:this._deletedCodeDomNode,diffEntry:r,originalModel:this._originalTextModel,renderLinesResult:this._renderLinesResult,clipboardService:p}))}get visibility(){return this._visibility}set visibility(e){this._visibility!==e&&(this._visibility=e,this._diffActions.style.visibility=e?"visible":"hidden")}_updateLightBulbPosition(e,t,o){let{top:n}=ir(e),r=t-n,s=Math.floor(r/o),l=s*o;if(this._diffActions.style.top=`${l}px`,this._renderLinesResult.viewLineCounts){let c=0;for(let u=0;u<this._renderLinesResult.viewLineCounts.length;u++)if(c+=this._renderLinesResult.viewLineCounts[u],s<c)return u}return s}};var w6i=pf("diffEditorWidget",{createHTML:a=>a});function lR(a,i,e,t,o=!1){Jd(t,i.fontInfo);let n=e.length>0,r=new $S(1e4),s=0,l=0,c=[],u=[];for(let f=0;f<a.lineTokens.length;f++){let v=f+1,b=a.lineTokens[f],S=a.lineBreakData[f],y=db.filter(e,v,1,Number.MAX_SAFE_INTEGER);if(S){let w=0;for(let k of S.breakOffsets){let T=b.sliceAndInflate(w,k,0),P=C6i(l,T,db.extractWrapped(y,w,k),n,a.mightContainNonBasicASCII,a.mightContainRTL,i,r,o);s=Math.max(s,P.maxCharWidth),u.push(new Xyt(P.output.characterMapping,P.output.containsForeignElements,w)),l++,w=k}c.push(S.breakOffsets.length)}else{c.push(1);let w=C6i(l,b,y,n,a.mightContainNonBasicASCII,a.mightContainRTL,i,r,o);s=Math.max(s,w.maxCharWidth),u.push(new Xyt(w.output.characterMapping,w.output.containsForeignElements,0)),l++}}s+=i.scrollBeyondLastColumn;let p=r.build(),h=w6i?w6i.createHTML(p):p;t.innerHTML=h;let g=s*i.typicalHalfwidthCharacterWidth;return new Vri(l,g,c,u,a)}var NE=class{constructor(i,e=i.map(n=>null),t=!0,o=!0){this.lineTokens=i;this.lineBreakData=e;this.mightContainNonBasicASCII=t;this.mightContainRTL=o}},OE=class a{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g=!0){this.tabSize=i;this.fontInfo=e;this.disableMonospaceOptimizations=t;this.typicalHalfwidthCharacterWidth=o;this.scrollBeyondLastColumn=n;this.lineHeight=r;this.lineDecorationsWidth=s;this.stopRenderingLineAfter=l;this.renderWhitespace=c;this.renderControlCharacters=u;this.fontLigatures=p;this.verticalScrollbarSize=h;this.setWidth=g}static fromEditor(i){let e=i.getOptions(),t=e.get(59),o=e.get(165);return new a(i.getModel()?.getOptions().tabSize||0,t,e.get(40),t.typicalHalfwidthCharacterWidth,e.get(118),e.get(75),o.decorationsWidth,e.get(133),e.get(113),e.get(108),e.get(60),e.get(117).verticalScrollbarSize)}withSetWidth(i){return new a(this.tabSize,this.fontInfo,this.disableMonospaceOptimizations,this.typicalHalfwidthCharacterWidth,this.scrollBeyondLastColumn,this.lineHeight,this.lineDecorationsWidth,this.stopRenderingLineAfter,this.renderWhitespace,this.renderControlCharacters,this.fontLigatures,this.verticalScrollbarSize,i)}withScrollBeyondLastColumn(i){return new a(this.tabSize,this.fontInfo,this.disableMonospaceOptimizations,this.typicalHalfwidthCharacterWidth,i,this.lineHeight,this.lineDecorationsWidth,this.stopRenderingLineAfter,this.renderWhitespace,this.renderControlCharacters,this.fontLigatures,this.verticalScrollbarSize,this.setWidth)}},Vri=class{constructor(i,e,t,o,n){this.heightInLines=i;this.minWidthInPx=e;this.viewLineCounts=t;this._renderOutputs=o;this._source=n}getModelPositionAt(i,e){let t=i;for(;t&&!t.classList.contains("view-line");)t=t.parentElement;if(!t)return;let o=t.parentElement;if(!o)return;let n=o.querySelectorAll(".view-line"),r=-1;for(let p=0;p<n.length;p++)if(n[p]===t){r=p;break}if(r===-1||r>=this._renderOutputs.length)return;let s=1,l=r;for(let p=0;p<this.viewLineCounts.length;p++){if(l<this.viewLineCounts[p]){s=p+1;break}l-=this.viewLineCounts[p]}if(s>this._source.lineTokens.length)return;let c=this._renderOutputs[r];if(!c)return;let u=gj(c.characterMapping,i,e)+c.offset;return new ye(s,u)}},Xyt=class extends fle{constructor(e,t,o){super(e,t);this.offset=o}};function C6i(a,i,e,t,o,n,r,s,l){s.appendString('<div class="view-line'),!l&&!t&&s.appendString(" char-delete"),s.appendString('" style="top:'),s.appendString(String(a*r.lineHeight)),r.setWidth?s.appendString('px;width:1000000px;">'):s.appendString('px;">');let c=i.getLineContent(),u=ez.isBasicASCII(c,o),p=ez.containsRTL(c,u,n),h=AV(new XL(r.fontInfo.isMonospace&&!r.disableMonospaceOptimizations,r.fontInfo.canUseHalfwidthRightwardsArrow,c,!1,u,p,0,i,e,r.tabSize,0,r.fontInfo.spaceWidth,r.fontInfo.middotWidth,r.fontInfo.wsmiddotWidth,r.stopRenderingLineAfter,r.renderWhitespace,r.renderControlCharacters,r.fontLigatures!==Bx.OFF,null,null,r.verticalScrollbarSize),s);s.appendString("</div>");let g=h.characterMapping.getHorizontalOffset(h.characterMapping.length);return{output:h,maxCharWidth:g}}var Fi=le("clipboardService");var Wn=le("contextViewService"),Xe=le("contextMenuService");var NCe=class extends x{constructor(e,t,o,n,r,s,l,c,u,p){super();this._targetWindow=e;this._editors=t;this._diffModel=o;this._options=n;this._diffEditorWidget=r;this._canIgnoreViewZoneUpdateEvent=s;this._origViewZonesToIgnore=l;this._modViewZonesToIgnore=c;this._clipboardService=u;this._contextMenuService=p;this._originalTopPadding=Me(this,0),this._originalScrollOffset=Me(this,0),this._originalScrollOffsetAnimated=xri(this._targetWindow,this._originalScrollOffset,this._store),this._modifiedTopPadding=Me(this,0),this._modifiedScrollOffset=Me(this,0),this._modifiedScrollOffsetAnimated=xri(this._targetWindow,this._modifiedScrollOffset,this._store);let h=Me("invalidateAlignmentsState",0),g=this._register(new Dt(()=>{h.set(h.get()+1,void 0)},0));this._register(this._editors.original.onDidChangeViewZones(k=>{this._canIgnoreViewZoneUpdateEvent()||g.schedule()})),this._register(this._editors.modified.onDidChangeViewZones(k=>{this._canIgnoreViewZoneUpdateEvent()||g.schedule()})),this._register(this._editors.original.onDidChangeConfiguration(k=>{(k.hasChanged(166)||k.hasChanged(75))&&g.schedule()})),this._register(this._editors.modified.onDidChangeConfiguration(k=>{(k.hasChanged(166)||k.hasChanged(75))&&g.schedule()}));let f=this._diffModel.map(k=>k?ui(this,k.model.original.onDidChangeTokens,()=>k.model.original.tokenization.backgroundTokenizationState===2):void 0).map((k,T)=>k?.read(T)),v=ke(k=>{let T=this._diffModel.read(k),P=T?.diff.read(k);if(!T||!P)return null;h.read(k);let V=this._options.renderSideBySide.read(k);return x6i(this._editors.original,this._editors.modified,P.mappings,this._origViewZonesToIgnore,this._modViewZonesToIgnore,V)}),b=ke(k=>{let T=this._diffModel.read(k)?.movedTextToCompare.read(k);if(!T)return null;h.read(k);let P=T.changes.map(O=>new k4e(O));return x6i(this._editors.original,this._editors.modified,P,this._origViewZonesToIgnore,this._modViewZonesToIgnore,!0)});function S(){let k=document.createElement("div");return k.className="diagonal-fill",k}let y=this._register(new N);this.viewZones=ke(this,k=>{y.clear();let T=v.read(k)||[],P=[],O=[],V=this._modifiedTopPadding.read(k);V>0&&O.push({afterLineNumber:0,domNode:document.createElement("div"),heightInPx:V,showInHiddenAreas:!0,suppressMouseDown:!0});let H=this._originalTopPadding.read(k);H>0&&P.push({afterLineNumber:0,domNode:document.createElement("div"),heightInPx:H,showInHiddenAreas:!0,suppressMouseDown:!0});let G=this._options.renderSideBySide.read(k),$={getLineContent:De=>this._editors.original.getModel().getLineContent(De),getLineInjectedText:De=>null},J=G?void 0:this._editors.modified._getViewModel()?.createLineBreaksComputer($);if(J){let De=this._editors.original.getModel();for(let Oe of T)if(Oe.diff)for(let pt=Oe.originalRange.startLineNumber;pt<Oe.originalRange.endLineNumberExclusive;pt++){if(pt>De.getLineCount())return{orig:P,mod:O};J?.addRequest(pt,null)}}let ae=J?.finalize()??[],he=0,oe=this._editors.modified.getOption(75),de=this._diffModel.read(k)?.movedTextToCompare.read(k),Ce=this._editors.original.getModel()?.mightContainNonBasicASCII()??!1,xe=this._editors.original.getModel()?.mightContainRTL()??!1,ze=OE.fromEditor(this._editors.modified);for(let De of T)if(De.diff&&!G&&(!this._options.useTrueInlineDiffRendering.read(k)||!T4e(De.diff))){if(!De.originalRange.isEmpty){f.read(k);let pt=document.createElement("div");pt.classList.add("view-lines","line-delete","line-delete-selectable","monaco-mouse-cursor-text");let et=this._editors.original.getModel();if(De.originalRange.endLineNumberExclusive-1>et.getLineCount())return{orig:P,mod:O};let Ti=new NE(De.originalRange.mapToLineArray(_n=>et.tokenization.getLineTokens(_n)),De.originalRange.mapToLineArray(_n=>ae[he++]),Ce,xe),Ht=[];for(let _n of De.diff.innerChanges||[])Ht.push(new CE(_n.originalRange.delta(-(De.diff.original.startLineNumber-1)),jj.className,0));let zi=lR(Ti,ze,Ht,pt),Vo=document.createElement("div");if(Vo.className="inline-deleted-margin-view-zone",Jd(Vo,ze.fontInfo),this._options.renderIndicators.read(k))for(let _n=0;_n<zi.heightInLines;_n++){let mn=document.createElement("div");mn.className=`delete-sign ${q.asClassName(Pri)}`,mn.setAttribute("style",`position:absolute;top:${_n*oe}px;width:${ze.lineDecorationsWidth}px;height:${oe}px;right:0;`),Vo.appendChild(mn)}let sn;y.add(new Yyt(()=>Ci(sn),Vo,pt,this._editors.modified,De.diff,this._diffEditorWidget,zi,this._editors.original.getModel(),this._contextMenuService,this._clipboardService));for(let _n=0;_n<zi.viewLineCounts.length;_n++){let mn=zi.viewLineCounts[_n];mn>1&&P.push({afterLineNumber:De.originalRange.startLineNumber+_n,domNode:S(),heightInPx:(mn-1)*oe,showInHiddenAreas:!0,suppressMouseDown:!0})}O.push({afterLineNumber:De.modifiedRange.startLineNumber-1,domNode:pt,heightInPx:zi.heightInLines*oe,minWidthInPx:zi.minWidthInPx,marginDomNode:Vo,setZoneId(_n){sn=_n},showInHiddenAreas:!0,suppressMouseDown:!1})}let Oe=document.createElement("div");Oe.className="gutter-delete",P.push({afterLineNumber:De.originalRange.endLineNumberExclusive-1,domNode:S(),heightInPx:De.modifiedHeightInPx,marginDomNode:Oe,showInHiddenAreas:!0,suppressMouseDown:!0})}else{let Oe=De.modifiedHeightInPx-De.originalHeightInPx;if(Oe>0){if(de?.lineRangeMapping.original.delta(-1).deltaLength(2).contains(De.originalRange.endLineNumberExclusive-1))continue;P.push({afterLineNumber:De.originalRange.endLineNumberExclusive-1,domNode:S(),heightInPx:Oe,showInHiddenAreas:!0,suppressMouseDown:!0})}else{let pt=function(){let Ti=document.createElement("div");return Ti.className="arrow-revert-change "+q.asClassName(R.arrowRight),k.store.add(j(Ti,"mousedown",Ht=>Ht.stopPropagation())),k.store.add(j(Ti,"click",Ht=>{Ht.stopPropagation(),r.revert(De.diff)})),_("div",{},Ti)};if(de?.lineRangeMapping.modified.delta(-1).deltaLength(2).contains(De.modifiedRange.endLineNumberExclusive-1))continue;let et;De.diff&&De.diff.modified.isEmpty&&this._options.shouldRenderOldRevertArrows.read(k)&&(et=pt()),O.push({afterLineNumber:De.modifiedRange.endLineNumberExclusive-1,domNode:S(),heightInPx:-Oe,marginDomNode:et,showInHiddenAreas:!0,suppressMouseDown:!0})}}for(let De of b.read(k)??[]){if(!de?.lineRangeMapping.original.intersect(De.originalRange)||!de?.lineRangeMapping.modified.intersect(De.modifiedRange))continue;let Oe=De.modifiedHeightInPx-De.originalHeightInPx;Oe>0?P.push({afterLineNumber:De.originalRange.endLineNumberExclusive-1,domNode:S(),heightInPx:Oe,showInHiddenAreas:!0,suppressMouseDown:!0}):O.push({afterLineNumber:De.modifiedRange.endLineNumberExclusive-1,domNode:S(),heightInPx:-Oe,showInHiddenAreas:!0,suppressMouseDown:!0})}return{orig:P,mod:O}});let w=!1;this._register(this._editors.original.onDidScrollChange(k=>{k.scrollLeftChanged&&!w&&(w=!0,this._editors.modified.setScrollLeft(k.scrollLeft),w=!1)})),this._register(this._editors.modified.onDidScrollChange(k=>{k.scrollLeftChanged&&!w&&(w=!0,this._editors.original.setScrollLeft(k.scrollLeft),w=!1)})),this._originalScrollTop=ui(this._editors.original.onDidScrollChange,()=>this._editors.original.getScrollTop()),this._modifiedScrollTop=ui(this._editors.modified.onDidScrollChange,()=>this._editors.modified.getScrollTop()),this._register(be(k=>{let T=this._originalScrollTop.read(k)-(this._originalScrollOffsetAnimated.read(void 0)-this._modifiedScrollOffsetAnimated.read(k))-(this._originalTopPadding.read(void 0)-this._modifiedTopPadding.read(k));T!==this._editors.modified.getScrollTop()&&this._editors.modified.setScrollTop(T,1)})),this._register(be(k=>{let T=this._modifiedScrollTop.read(k)-(this._modifiedScrollOffsetAnimated.read(void 0)-this._originalScrollOffsetAnimated.read(k))-(this._modifiedTopPadding.read(void 0)-this._originalTopPadding.read(k));T!==this._editors.original.getScrollTop()&&this._editors.original.setScrollTop(T,1)})),this._register(be(k=>{let T=this._diffModel.read(k)?.movedTextToCompare.read(k),P=0;if(T){let O=this._editors.original.getTopForLineNumber(T.lineRangeMapping.original.startLineNumber,!0)-this._originalTopPadding.read(void 0);P=this._editors.modified.getTopForLineNumber(T.lineRangeMapping.modified.startLineNumber,!0)-this._modifiedTopPadding.read(void 0)-O}P>0?(this._modifiedTopPadding.set(0,void 0),this._originalTopPadding.set(P,void 0)):P<0?(this._modifiedTopPadding.set(-P,void 0),this._originalTopPadding.set(0,void 0)):setTimeout(()=>{this._modifiedTopPadding.set(0,void 0),this._originalTopPadding.set(0,void 0)},400),this._editors.modified.hasTextFocus()?this._originalScrollOffset.set(this._modifiedScrollOffset.read(void 0)-P,void 0,!0):this._modifiedScrollOffset.set(this._originalScrollOffset.read(void 0)+P,void 0,!0)}))}};NCe=I([m(8,Fi),m(9,Xe)],NCe);function x6i(a,i,e,t,o,n){let r=new uE(k6i(a,t)),s=new uE(k6i(i,o)),l=a.getOption(75),c=i.getOption(75),u=[],p=0,h=0;function g(f,v){for(;;){let b=r.peek(),S=s.peek();if(b&&b.lineNumber>=f&&(b=void 0),S&&S.lineNumber>=v&&(S=void 0),!b&&!S)break;let y=b?b.lineNumber-p:Number.MAX_VALUE,w=S?S.lineNumber-h:Number.MAX_VALUE;y<w?(r.dequeue(),S={lineNumber:b.lineNumber-p+h,heightInPx:0}):y>w?(s.dequeue(),b={lineNumber:S.lineNumber-h+p,heightInPx:0}):(r.dequeue(),s.dequeue()),u.push({originalRange:uo.ofLength(b.lineNumber,1),modifiedRange:uo.ofLength(S.lineNumber,1),originalHeightInPx:l+b.heightInPx,modifiedHeightInPx:c+S.heightInPx,diff:void 0})}}for(let f of e){let w=function(k,T,P=!1){if(k<y||T<S)return;if(b)b=!1;else if(!P&&(k===y||T===S))return;let O=new uo(y,k),V=new uo(S,T);if(O.isEmpty&&V.isEmpty)return;let H=r.takeWhile($=>$.lineNumber<k)?.reduce(($,J)=>$+J.heightInPx,0)??0,G=s.takeWhile($=>$.lineNumber<T)?.reduce(($,J)=>$+J.heightInPx,0)??0;u.push({originalRange:O,modifiedRange:V,originalHeightInPx:O.length*l+H,modifiedHeightInPx:V.length*c+G,diff:f.lineRangeMapping}),y=k,S=T},v=f.lineRangeMapping;g(v.original.startLineNumber,v.modified.startLineNumber);let b=!0,S=v.modified.startLineNumber,y=v.original.startLineNumber;if(n)for(let k of v.innerChanges||[]){k.originalRange.startColumn>1&&k.modifiedRange.startColumn>1&&w(k.originalRange.startLineNumber,k.modifiedRange.startLineNumber);let T=a.getModel(),P=k.originalRange.endLineNumber<=T.getLineCount()?T.getLineMaxColumn(k.originalRange.endLineNumber):Number.MAX_SAFE_INTEGER;k.originalRange.endColumn<P&&w(k.originalRange.endLineNumber,k.modifiedRange.endLineNumber)}w(v.original.endLineNumberExclusive,v.modified.endLineNumberExclusive,!0),p=v.original.endLineNumberExclusive,h=v.modified.endLineNumberExclusive}return g(Number.MAX_VALUE,Number.MAX_VALUE),u}function k6i(a,i){let e=[],t=[],o=a.getOption(166).wrappingColumn!==-1,n=a._getViewModel().coordinatesConverter,r=a.getOption(75);if(o)for(let l=1;l<=a.getModel().getLineCount();l++){let c=n.getModelLineViewLineCount(l);c>1&&t.push({lineNumber:l,heightInPx:r*(c-1)})}for(let l of a.getWhitespaces()){if(i.has(l.id))continue;let c=l.afterLineNumber===0?0:n.convertViewPositionToModelPosition(new ye(l.afterLineNumber,1)).lineNumber;e.push({lineNumber:c,heightInPx:l.height})}return d6i(e,t,l=>l.lineNumber,(l,c)=>({lineNumber:l.lineNumber,heightInPx:l.heightInPx+c.heightInPx}))}function T4e(a){return a.innerChanges?a.innerChanges.every(i=>E4e(i.modifiedRange)&&E4e(i.originalRange)||i.originalRange.equalsRange(new z(1,1,1,1))):!1}function E4e(a){return a.startLineNumber===a.endLineNumber}var fY=class a extends x{constructor(e,t,o,n,r){super();this._rootElement=e;this._diffModel=t;this._originalEditorLayoutInfo=o;this._modifiedEditorLayoutInfo=n;this._editors=r;this._originalScrollTop=ui(this,this._editors.original.onDidScrollChange,()=>this._editors.original.getScrollTop()),this._modifiedScrollTop=ui(this,this._editors.modified.onDidScrollChange,()=>this._editors.modified.getScrollTop()),this._viewZonesChanged=Fr("onDidChangeViewZones",this._editors.modified.onDidChangeViewZones),this.width=Me(this,0),this._modifiedViewZonesChangedSignal=Fr("modified.onDidChangeViewZones",this._editors.modified.onDidChangeViewZones),this._originalViewZonesChangedSignal=Fr("original.onDidChangeViewZones",this._editors.original.onDidChangeViewZones),this._state=ke(this,p=>{this._element.replaceChildren();let h=this._diffModel.read(p),g=h?.diff.read(p)?.movedTexts;if(!g||g.length===0){this.width.set(0,void 0);return}this._viewZonesChanged.read(p);let f=this._originalEditorLayoutInfo.read(p),v=this._modifiedEditorLayoutInfo.read(p);if(!f||!v){this.width.set(0,void 0);return}this._modifiedViewZonesChangedSignal.read(p),this._originalViewZonesChangedSignal.read(p);let b=g.map(O=>{function V(Ce,xe){let ze=xe.getTopForLineNumber(Ce.startLineNumber,!0),De=xe.getTopForLineNumber(Ce.endLineNumberExclusive,!0);return(ze+De)/2}let H=V(O.lineRangeMapping.original,this._editors.original),G=this._originalScrollTop.read(p),$=V(O.lineRangeMapping.modified,this._editors.modified),J=this._modifiedScrollTop.read(p),ae=H-G,he=$-J,oe=Math.min(H,$),de=Math.max(H,$);return{range:new pi(oe,de),from:ae,to:he,fromWithoutScroll:H,toWithoutScroll:$,move:O}});b.sort(dht(cl(O=>O.fromWithoutScroll>O.toWithoutScroll,uht),cl(O=>O.fromWithoutScroll>O.toWithoutScroll?O.fromWithoutScroll:-O.toWithoutScroll,hu)));let S=Bri.compute(b.map(O=>O.range)),y=10,w=f.verticalScrollbarWidth,k=(S.getTrackCount()-1)*10+y*2,T=w+k+(v.contentLeft-a.movedCodeBlockPadding),P=0;for(let O of b){let V=S.getTrack(P),H=w+y+V*10,G=15,$=15,J=T,ae=v.glyphMarginWidth+v.lineNumbersWidth,he=18,oe=document.createElementNS("http://www.w3.org/2000/svg","rect");oe.classList.add("arrow-rectangle"),oe.setAttribute("x",`${J-ae}`),oe.setAttribute("y",`${O.to-he/2}`),oe.setAttribute("width",`${ae}`),oe.setAttribute("height",`${he}`),this._element.appendChild(oe);let de=document.createElementNS("http://www.w3.org/2000/svg","g"),Ce=document.createElementNS("http://www.w3.org/2000/svg","path");Ce.setAttribute("d",`M 0 ${O.from} L ${H} ${O.from} L ${H} ${O.to} L ${J-$} ${O.to}`),Ce.setAttribute("fill","none"),de.appendChild(Ce);let xe=document.createElementNS("http://www.w3.org/2000/svg","polygon");xe.classList.add("arrow"),p.store.add(be(ze=>{Ce.classList.toggle("currentMove",O.move===h.activeMovedText.read(ze)),xe.classList.toggle("currentMove",O.move===h.activeMovedText.read(ze))})),xe.setAttribute("points",`${J-$},${O.to-G/2} ${J},${O.to} ${J-$},${O.to+G/2}`),de.appendChild(xe),this._element.appendChild(de),P++}this.width.set(k,void 0)}),this._element=document.createElementNS("http://www.w3.org/2000/svg","svg"),this._element.setAttribute("class","moved-blocks-lines"),this._rootElement.appendChild(this._element),this._register(Z(()=>this._element.remove())),this._register(be(p=>{let h=this._originalEditorLayoutInfo.read(p),g=this._modifiedEditorLayoutInfo.read(p);!h||!g||(this._element.style.left=`${h.width-h.verticalScrollbarWidth}px`,this._element.style.height=`${h.height}px`,this._element.style.width=`${h.verticalScrollbarWidth+h.contentLeft-a.movedCodeBlockPadding+this.width.read(p)}px`)})),this._register(fP(this._state));let s=ke(p=>{let g=this._diffModel.read(p)?.diff.read(p);return g?g.movedTexts.map(f=>({move:f,original:new Ez(So(f.lineRangeMapping.original.startLineNumber-1),18),modified:new Ez(So(f.lineRangeMapping.modified.startLineNumber-1),18)})):[]});this._register(LCe(this._editors.original,s.map(p=>p.map(h=>h.original)))),this._register(LCe(this._editors.modified,s.map(p=>p.map(h=>h.modified)))),this._register(il((p,h)=>{let g=s.read(p);for(let f of g)h.add(new Jyt(this._editors.original,f.original,f.move,"original",this._diffModel.get())),h.add(new Jyt(this._editors.modified,f.modified,f.move,"modified",this._diffModel.get()))}));let l=Fr("original.onDidFocusEditorWidget",p=>this._editors.original.onDidFocusEditorWidget(()=>setTimeout(()=>p(void 0),0))),c=Fr("modified.onDidFocusEditorWidget",p=>this._editors.modified.onDidFocusEditorWidget(()=>setTimeout(()=>p(void 0),0))),u="modified";this._register(hP({changeTracker:{createChangeSummary:()=>{},handleChange:(p,h)=>(p.didChange(l)&&(u="original"),p.didChange(c)&&(u="modified"),!0)}},p=>{l.read(p),c.read(p);let h=this._diffModel.read(p);if(!h)return;let g=h.diff.read(p),f;if(g&&u==="original"){let v=this._editors.originalCursor.read(p);v&&(f=g.movedTexts.find(b=>b.lineRangeMapping.original.contains(v.lineNumber)))}if(g&&u==="modified"){let v=this._editors.modifiedCursor.read(p);v&&(f=g.movedTexts.find(b=>b.lineRangeMapping.modified.contains(v.lineNumber)))}f!==h.movedTextToCompare.read(void 0)&&h.movedTextToCompare.set(void 0,void 0),h.setActiveMovedText(f)}))}static{this.movedCodeBlockPadding=4}},Bri=class a{constructor(i,e){this._trackCount=i;this.trackPerLineIdx=e}static compute(i){let e=[],t=[];for(let o of i){let n=e.findIndex(r=>!r.intersectsStrict(o));n===-1&&(e.length>=6?n=w2i(e,cl(s=>s.intersectWithRangeLength(o),hu)):(n=e.length,e.push(new Dft))),e[n].addRange(o),t.push(n)}return new a(e.length,t)}getTrack(i){return this.trackPerLineIdx[i]}getTrackCount(){return this._trackCount}},Jyt=class extends Zle{constructor(e,t,o,n,r){let s=ct("div.diff-hidden-lines-widget");super(e,t,s.root);this._editor=e;this._move=o;this._kind=n;this._diffModel=r;this._nodes=ct("div.diff-moved-code-block",{style:{marginRight:"4px"}},[ct("div.text-content@textContent"),ct("div.action-bar@actionBar")]);s.root.appendChild(this._nodes.root);let l=ui(this._editor.onDidLayoutChange,()=>this._editor.getLayoutInfo());this._register(OP(this._nodes.root,{paddingRight:l.map(g=>g.verticalScrollbarWidth)}));let c;o.changes.length>0?c=this._kind==="original"?d(244,null,this._move.lineRangeMapping.modified.startLineNumber,this._move.lineRangeMapping.modified.endLineNumberExclusive-1):d(242,null,this._move.lineRangeMapping.original.startLineNumber,this._move.lineRangeMapping.original.endLineNumberExclusive-1):c=this._kind==="original"?d(243,null,this._move.lineRangeMapping.modified.startLineNumber,this._move.lineRangeMapping.modified.endLineNumberExclusive-1):d(241,null,this._move.lineRangeMapping.original.startLineNumber,this._move.lineRangeMapping.original.endLineNumberExclusive-1);let u=this._register(new Zi(this._nodes.actionBar,{highlightToggledItems:!0})),p=new it("",c,"",!1);u.push(p,{icon:!1,label:!0});let h=new it("","Compare",q.asClassName(R.compareChanges),!0,()=>{this._editor.focus(),this._diffModel.movedTextToCompare.set(this._diffModel.movedTextToCompare.get()===o?void 0:this._move,void 0)});this._register(be(g=>{let f=this._diffModel.movedTextToCompare.read(g)===o;h.checked=f})),u.push(h,{icon:!1,label:!0})}};var Zyt=class extends x{constructor(e,t,o,n){super();this._editors=e;this._diffModel=t;this._options=o;this._decorations=ke(this,e=>{let t=this._diffModel.read(e),o=t?.diff.read(e);if(!o)return null;let n=this._diffModel.read(e).movedTextToCompare.read(e),r=this._options.renderIndicators.read(e),s=this._options.showEmptyDecorations.read(e),l=[],c=[];if(!n)for(let p of o.mappings)if(p.lineRangeMapping.original.isEmpty||l.push({range:p.lineRangeMapping.original.toInclusiveRange(),options:r?Nri:Fri}),p.lineRangeMapping.modified.isEmpty||c.push({range:p.lineRangeMapping.modified.toInclusiveRange(),options:r?Ari:Ori}),p.lineRangeMapping.modified.isEmpty||p.lineRangeMapping.original.isEmpty)p.lineRangeMapping.original.isEmpty||l.push({range:p.lineRangeMapping.original.toInclusiveRange(),options:S6i}),p.lineRangeMapping.modified.isEmpty||c.push({range:p.lineRangeMapping.modified.toInclusiveRange(),options:ACe});else{let h=this._options.useTrueInlineDiffRendering.read(e)&&T4e(p.lineRangeMapping);for(let g of p.lineRangeMapping.innerChanges||[])if(p.lineRangeMapping.original.contains(g.originalRange.startLineNumber)&&l.push({range:g.originalRange,options:g.originalRange.isEmpty()&&s?I6i:jj}),p.lineRangeMapping.modified.contains(g.modifiedRange.startLineNumber)&&c.push({range:g.modifiedRange,options:g.modifiedRange.isEmpty()&&s&&!h?b6i:tce}),h){let f=t.model.original.getValueInRange(g.originalRange);c.push({range:g.modifiedRange,options:{description:"deleted-text",before:{content:f,inlineClassName:"inline-deleted-text"},zIndex:1e5,showIfCollapsed:!0}})}}if(n)for(let p of n.changes){let h=p.original.toInclusiveRange();h&&l.push({range:h,options:r?Nri:Fri});let g=p.modified.toInclusiveRange();g&&c.push({range:g,options:r?Ari:Ori});for(let f of p.innerChanges||[])l.push({range:f.originalRange,options:jj}),c.push({range:f.modifiedRange,options:tce})}let u=this._diffModel.read(e).activeMovedText.read(e);for(let p of o.movedTexts)l.push({range:p.lineRangeMapping.original.toInclusiveRange(),options:{description:"moved",blockClassName:"movedOriginal"+(p===u?" currentMove":""),blockPadding:[fY.movedCodeBlockPadding,0,fY.movedCodeBlockPadding,fY.movedCodeBlockPadding]}}),c.push({range:p.lineRangeMapping.modified.toInclusiveRange(),options:{description:"moved",blockClassName:"movedModified"+(p===u?" currentMove":""),blockPadding:[4,0,4,4]}});return{originalDecorations:l,modifiedDecorations:c}});this._register(DCe(this._editors.original,this._decorations.map(r=>r?.originalDecorations||[]))),this._register(DCe(this._editors.modified,this._decorations.map(r=>r?.modifiedDecorations||[])))}};var Xh=class a{constructor(i,e){this.x=i;this.y=e}static equals(i,e){return i.x===e.x&&i.y===e.y}add(i){return new a(this.x+i.x,this.y+i.y)}deltaX(i){return new a(this.x+i,this.y)}deltaY(i){return new a(this.x,this.y+i)}toString(){return`(${this.x},${this.y})`}subtract(i){return new a(this.x-i.x,this.y-i.y)}scale(i){return new a(this.x*i,this.y*i)}mapComponents(i){return new a(i(this.x),i(this.y))}isZero(){return this.x===0&&this.y===0}withThreshold(i){return this.mapComponents(e=>e>i?e-i:e<-i?e+i:0)}};function gs(a){return Hri.get(a)}var Hri=class a extends x{constructor(e){super();this.editor=e;this._sawZeroLineWidth=!1;this._onDidContainerResize=Vf({owner:this,getTransaction:()=>this._currentTransaction},e=>{let t=this.editor.getContainerDomNode(),o=new ResizeObserver(()=>{this._sawZeroLineWidth&&(this._sawZeroLineWidth=!1,this.editor.resetLineWidthCaches()),e(void 0)});return o.observe(t),{dispose:()=>o.disconnect()}},()=>({}));this._updateCounter=0,this._currentTransaction=void 0,this._model=Me(this,this.editor.getModel()),this.model=this._model,this.isReadonly=Vf({owner:this,getTransaction:()=>this._currentTransaction},this.editor.onDidChangeConfiguration,()=>this.editor.getOption(104)),this._versionId=ph({owner:this,lazy:!0},this.editor.getModel()?.getVersionId()??null),this.versionId=this._versionId,this._selections=ph({owner:this,equalsFn:S1(iO(ti.selectionsEqual)),lazy:!0},this.editor.getSelections()??null),this.selections=this._selections,this.positions=Os({owner:this,equalsFn:S1(iO(ye.equals))},t=>this.selections.read(t)?.map(o=>o.getStartPosition())??null),this.isFocused=Vf({owner:this,getTransaction:()=>this._currentTransaction},t=>{let o=this.editor.onDidFocusEditorWidget(t),n=this.editor.onDidBlurEditorWidget(t);return{dispose(){o.dispose(),n.dispose()}}},()=>this.editor.hasWidgetFocus()),this.isTextFocused=Vf({owner:this,getTransaction:()=>this._currentTransaction},t=>{let o=this.editor.onDidFocusEditorText(t),n=this.editor.onDidBlurEditorText(t);return{dispose(){o.dispose(),n.dispose()}}},()=>this.editor.hasTextFocus()),this.inComposition=Vf({owner:this,getTransaction:()=>this._currentTransaction},t=>{let o=this.editor.onDidCompositionStart(()=>{t(void 0)}),n=this.editor.onDidCompositionEnd(()=>{t(void 0)});return{dispose(){o.dispose(),n.dispose()}}},()=>this.editor.inComposition),this.value=K$(this,t=>(this.versionId.read(t),this.model.read(t)?.getValue()??""),(t,o)=>{let n=this.model.get();n!==null&&t!==n.getValue()&&n.setValue(t)}),this.valueIsEmpty=ke(this,t=>(this.versionId.read(t),this.editor.getModel()?.getValueLength()===0)),this.cursorSelection=Os({owner:this,equalsFn:S1(ti.selectionsEqual)},t=>this.selections.read(t)?.[0]??null),this.cursorPosition=Os({owner:this,equalsFn:ye.equals},t=>this.selections.read(t)?.[0]?.getPosition()??null),this.cursorLineNumber=ke(this,t=>this.cursorPosition.read(t)?.lineNumber??null),this.onDidType=wc(this),this.onDidPaste=wc(this),this.scrollTop=Vf({owner:this,getTransaction:()=>this._currentTransaction},this.editor.onDidScrollChange,()=>this.editor.getScrollTop()),this.scrollLeft=Vf({owner:this,getTransaction:()=>this._currentTransaction},this.editor.onDidScrollChange,()=>this.editor.getScrollLeft()),this.layoutInfo=Vf({owner:this,getTransaction:()=>this._currentTransaction},this.editor.onDidLayoutChange,()=>this.editor.getLayoutInfo()),this.layoutInfoContentLeft=this.layoutInfo.map(t=>t.contentLeft),this.layoutInfoDecorationsLeft=this.layoutInfo.map(t=>t.decorationsLeft),this.layoutInfoWidth=this.layoutInfo.map(t=>t.width),this.layoutInfoHeight=this.layoutInfo.map(t=>t.height),this.layoutInfoMinimap=this.layoutInfo.map(t=>t.minimap),this.layoutInfoVerticalScrollbarWidth=this.layoutInfo.map(t=>t.verticalScrollbarWidth),this.contentWidth=Vf({owner:this,getTransaction:()=>this._currentTransaction},this.editor.onDidContentSizeChange,()=>this.editor.getContentWidth()),this.contentHeight=Vf({owner:this,getTransaction:()=>this._currentTransaction},this.editor.onDidContentSizeChange,()=>this.editor.getContentHeight()),this._onDidChangeViewZones=Fr(this,this.editor.onDidChangeViewZones),this._onDidHiddenAreasChanged=Fr(this,this.editor.onDidChangeHiddenAreas),this._onDidLineHeightChanged=Fr(this,this.editor.onDidChangeLineHeight),this._widgetCounter=0,this.openedPeekWidgets=Me(this,0),this._register(this.editor.onBeginUpdate(()=>this._beginUpdate())),this._register(this.editor.onEndUpdate(()=>this._endUpdate())),this._register(this.editor.onDidChangeModel(()=>{this._beginUpdate();try{this._model.set(this.editor.getModel(),this._currentTransaction),this._forceUpdate()}finally{this._endUpdate()}})),this._register(this.editor.onDidType(t=>{this._beginUpdate();try{this._forceUpdate(),this.onDidType.trigger(this._currentTransaction,t)}finally{this._endUpdate()}})),this._register(this.editor.onDidPaste(t=>{this._beginUpdate();try{this._forceUpdate(),this.onDidPaste.trigger(this._currentTransaction,t)}finally{this._endUpdate()}})),this._register(this.editor.onDidChangeModelContent(t=>{this._beginUpdate();try{this._versionId.set(this.editor.getModel()?.getVersionId()??null,this._currentTransaction,t),this._forceUpdate()}finally{this._endUpdate()}})),this._register(this.editor.onDidChangeCursorSelection(t=>{this._beginUpdate();try{this._selections.set(this.editor.getSelections(),this._currentTransaction,t),this._forceUpdate()}finally{this._endUpdate()}})),this.domNode=ke(t=>(this.model.read(t),this.editor.getDomNode()))}static{this._map=new Map}static get(e){let t=a._map.get(e);if(!t){t=new a(e),a._map.set(e,t);let o=e.onDidDispose(()=>{let n=a._map.get(e);n&&(a._map.delete(e),n.dispose(),o.dispose())})}return t}_beginUpdate(){this._updateCounter++,this._updateCounter===1&&(this._currentTransaction=new oO(()=>{}))}_endUpdate(){if(this._updateCounter--,this._updateCounter===0){let e=this._currentTransaction;this._currentTransaction=void 0,e.finish()}}transaction(e){this._beginUpdate();try{return e(this._currentTransaction)}finally{this._endUpdate()}}forceUpdate(e){this._beginUpdate();try{return this._forceUpdate(),e?e(this._currentTransaction):void 0}finally{this._endUpdate()}}_forceUpdate(){this._beginUpdate();try{this._model.set(this.editor.getModel(),this._currentTransaction),this._versionId.set(this.editor.getModel()?.getVersionId()??null,this._currentTransaction,void 0),this._selections.set(this.editor.getSelections(),this._currentTransaction,void 0)}finally{this._endUpdate()}}getOption(e,t=Rl.ofCaller()){return ui(this,o=>this.editor.onDidChangeConfiguration(n=>{n.hasChanged(e)&&o(void 0)}),()=>this.editor.getOption(e),t)}setDecorations(e){let t=new N,o=this.editor.createDecorationsCollection();return t.add(NL({owner:this,debugName:()=>`Apply decorations from ${e.debugName}`},n=>{let r=e.read(n);o.set(r)})),t.add({dispose:()=>{o.clear()}}),t}createOverlayWidget(e){let t="observableOverlayWidget"+this._widgetCounter++,o={getDomNode:()=>e.domNode,getPosition:()=>e.position.get(),getId:()=>t,allowEditorOverflow:e.allowEditorOverflow,getMinContentWidthInPx:()=>e.minContentWidthInPx.get()};this.editor.addOverlayWidget(o);let n=be(r=>{e.position.read(r),e.minContentWidthInPx.read(r),this.editor.layoutOverlayWidget(o)});return Z(()=>{n.dispose(),this.editor.removeOverlayWidget(o)})}createContentWidget(e){let t="observableContentWidget"+this._widgetCounter++,o={getDomNode:()=>e.domNode,getPosition:()=>e.position.get(),getId:()=>t,allowEditorOverflow:e.allowEditorOverflow};this.editor.addContentWidget(o);let n=be(r=>{e.position.read(r),this.editor.layoutContentWidget(o)});return Z(()=>{n.dispose(),this.editor.removeContentWidget(o)})}observeLineOffsetRange(e,t){let o=this.observePosition(e.map(r=>new ye(r.startLineNumber,1)),t),n=this.observePosition(e.map(r=>new ye(r.endLineNumberExclusive+1,1)),t);return ke(r=>{o.read(r),n.read(r);let s=e.read(r),l=this.model.read(r)?.getLineCount(),c=(typeof l<"u"&&s.startLineNumber>l?this.editor.getBottomForLineNumber(l):this.editor.getTopForLineNumber(s.startLineNumber))-this.scrollTop.read(r),u=s.isEmpty?c:this.editor.getBottomForLineNumber(s.endLineNumberExclusive-1)-this.scrollTop.read(r);return new pi(c,u)})}getLeftOfPosition(e,t){this.layoutInfo.read(t),this.value.read(t);let o=this.editor.getOffsetForColumn(e.lineNumber,e.column);if(o===-1){let n=this.editor.getOption(59).typicalHalfwidthCharacterWidth;o=e.column*n}return o}observePosition(e,t){let o=e.get(),n=ph({owner:this,debugName:()=>`topLeftOfPosition${o?.toString()}`,equalsFn:S1(Xh.equals)},new Xh(0,0)),r="observablePositionWidget"+this._widgetCounter++,s=document.createElement("div"),l={getDomNode:()=>s,getPosition:()=>o?{preference:[0],position:e.get()}:null,getId:()=>r,allowEditorOverflow:!1,useDisplayNone:!0,afterRender:(c,u)=>{let p=this._model.get();p&&o&&o.lineNumber>p.getLineCount()?n.set(new Xh(0,this.editor.getBottomForLineNumber(p.getLineCount())-this.scrollTop.get()),void 0):n.set(u?new Xh(u.left,u.top):null,void 0)}};return this.editor.addContentWidget(l),t.add(be(c=>{o=e.read(c),this.editor.layoutContentWidget(l)})),t.add(Z(()=>{this.editor.removeContentWidget(l)})),n}isTargetHovered(e,t){let o=Me("isInjectedTextHovered",!1);return t.add(this.editor.onMouseMove(n=>{let r=e(n);o.set(r,void 0)})),t.add(this.editor.onMouseLeave(n=>{o.set(!1,void 0)})),o}observeLineHeightForPosition(e){return ke(t=>{let o=e instanceof ye?e:e.read(t);return o===null?null:(this.getOption(75).read(t),this.editor.getLineHeightForPosition(o))})}observeLineHeightForLine(e){return typeof e=="number"?this.observeLineHeightForPosition(new ye(e,1)):ke(t=>{let o=e.read(t);return o===null?null:this.observeLineHeightForPosition(new ye(o,1)).read(t)})}observeLineHeightsForLineRange(e){return ke(t=>{let o=e instanceof uo?e:e.read(t),n=[];for(let r=o.startLineNumber;r<o.endLineNumberExclusive;r++)n.push(this.observeLineHeightForLine(r).read(t));return n})}getWidthOfLine(e,t){this.layoutInfo.read(t),this.value.read(t),this.scrollTop.read(t);let o=this.editor.getWidthOfLine(e);return this._onDidContainerResize.read(t),o===0&&(this._sawZeroLineWidth=!0),o}observeTopForLineNumber(e){return ke(t=>(this.layoutInfo.read(t),this._onDidChangeViewZones.read(t),this._onDidHiddenAreasChanged.read(t),this._onDidLineHeightChanged.read(t),this._versionId.read(t),this.editor.getTopForLineNumber(e)))}observeBottomForLineNumber(e){return ke(t=>(this.layoutInfo.read(t),this._onDidChangeViewZones.read(t),this._onDidHiddenAreasChanged.read(t),this._onDidLineHeightChanged.read(t),this._versionId.read(t),this.editor.getBottomForLineNumber(e)))}};var iy=class extends x{constructor(e,t,o,n,r,s,l){super();this._editors=e;this._rootElement=t;this._diffModel=o;this._rootWidth=n;this._rootHeight=r;this._modifiedEditorLayoutInfo=s;this._themeService=l;this.width=iy.ENTIRE_DIFF_OVERVIEW_WIDTH;let c=ui(this._themeService.onDidColorThemeChange,()=>this._themeService.getColorTheme()),u=ke(g=>{let f=c.read(g),v=f.getColor(Ovt)||(f.getColor(df)||Lye).transparent(2),b=f.getColor(Fvt)||(f.getColor(zf)||Rye).transparent(2);return{insertColor:v,removeColor:b}}),p=ur(document.createElement("div"));p.setClassName("diffViewport"),p.setPosition("absolute");let h=ct("div.diffOverview",{style:{position:"absolute",top:"0px",width:iy.ENTIRE_DIFF_OVERVIEW_WIDTH+"px"}}).root;this._register($j(h,p.domNode)),this._register(Jo(h,re.POINTER_DOWN,g=>{this._editors.modified.delegateVerticalScrollbarPointerDown(g)})),this._register(j(h,re.MOUSE_WHEEL,g=>{this._editors.modified.delegateScrollFromMouseWheelEvent(g)},{passive:!1})),this._register($j(this._rootElement,h)),this._register(il((g,f)=>{let v=this._diffModel.read(g),b=this._editors.original.createOverviewRuler("original diffOverviewRuler");b&&(f.add(b),f.add($j(h,b.getDomNode())));let S=this._editors.modified.createOverviewRuler("modified diffOverviewRuler");if(S&&(f.add(S),f.add($j(h,S.getDomNode()))),!b||!S)return;let y=Fr("viewZoneChanged",this._editors.original.onDidChangeViewZones),w=Fr("viewZoneChanged",this._editors.modified.onDidChangeViewZones),k=Fr("hiddenRangesChanged",this._editors.original.onDidChangeHiddenAreas),T=Fr("hiddenRangesChanged",this._editors.modified.onDidChangeHiddenAreas);f.add(be(P=>{y.read(P),w.read(P),k.read(P),T.read(P);let O=u.read(P),V=v?.diff.read(P)?.mappings;function H(J,ae,he){let oe=he._getViewModel();return oe?J.filter(de=>de.length>0).map(de=>{let Ce=oe.coordinatesConverter.convertModelPositionToViewPosition(new ye(de.startLineNumber,1)),xe=oe.coordinatesConverter.convertModelPositionToViewPosition(new ye(de.endLineNumberExclusive,1)),ze=xe.lineNumber-Ce.lineNumber;return new c5e(Ce.lineNumber,xe.lineNumber,ze,ae.toString())}):[]}let G=H((V||[]).map(J=>J.lineRangeMapping.original),O.removeColor,this._editors.original),$=H((V||[]).map(J=>J.lineRangeMapping.modified),O.insertColor,this._editors.modified);b?.setZones(G),S?.setZones($)})),f.add(be(P=>{let O=this._rootHeight.read(P),V=this._rootWidth.read(P),H=this._modifiedEditorLayoutInfo.read(P);if(H){let G=iy.ENTIRE_DIFF_OVERVIEW_WIDTH-2*iy.ONE_OVERVIEW_WIDTH;b.setLayout({top:0,height:O,right:G+iy.ONE_OVERVIEW_WIDTH,width:iy.ONE_OVERVIEW_WIDTH}),S.setLayout({top:0,height:O,right:0,width:iy.ONE_OVERVIEW_WIDTH});let $=this._editors.modifiedScrollTop.read(P),J=this._editors.modifiedScrollHeight.read(P),ae=this._editors.modified.getOption(117),he=new N7(ae.verticalHasArrows?ae.arrowSize:0,ae.verticalScrollbarSize,0,H.height,J,$);p.setTop(he.getSliderPosition()),p.setHeight(he.getSliderSize())}else p.setTop(0),p.setHeight(0);h.style.height=O+"px",h.style.left=V-iy.ENTIRE_DIFF_OVERVIEW_WIDTH+"px",p.setWidth(iy.ENTIRE_DIFF_OVERVIEW_WIDTH)}))}))}static{this.ONE_OVERVIEW_WIDTH=15}static{this.ENTIRE_DIFF_OVERVIEW_WIDTH=this.ONE_OVERVIEW_WIDTH*2}};iy=I([m(6,Le)],iy);var OCe=class extends x{constructor(e,t,o,n,r,s,l,c){super();this.originalEditorElement=e;this.modifiedEditorElement=t;this._options=o;this._argCodeEditorWidgetOptions=n;this._createInnerEditor=r;this._contextKeyService=s;this._instantiationService=l;this._keybindingService=c;this.original=this._register(this._createLeftHandSideEditor(this._options.editorOptions.get(),this._argCodeEditorWidgetOptions.originalEditor||{})),this.modified=this._register(this._createRightHandSideEditor(this._options.editorOptions.get(),this._argCodeEditorWidgetOptions.modifiedEditor||{})),this._onDidContentSizeChange=this._register(new E),this.modifiedScrollTop=ui(this,this.modified.onDidScrollChange,()=>this.modified.getScrollTop()),this.modifiedScrollHeight=ui(this,this.modified.onDidScrollChange,()=>this.modified.getScrollHeight()),this.modifiedObs=gs(this.modified),this.originalObs=gs(this.original),this.modifiedModel=this.modifiedObs.model,this.modifiedSelections=ui(this,this.modified.onDidChangeCursorSelection,()=>this.modified.getSelections()??[]),this.modifiedCursor=Os({owner:this,equalsFn:ye.equals},u=>this.modifiedSelections.read(u)[0]?.getPosition()??new ye(1,1)),this.originalCursor=ui(this,this.original.onDidChangeCursorPosition,()=>this.original.getPosition()??new ye(1,1)),this.isOriginalFocused=gs(this.original).isFocused,this.isModifiedFocused=gs(this.modified).isFocused,this.isFocused=ke(this,u=>this.isOriginalFocused.read(u)||this.isModifiedFocused.read(u)),this._argCodeEditorWidgetOptions=null,this._register(hP({changeTracker:{createChangeSummary:()=>({}),handleChange:(u,p)=>(u.didChange(o.editorOptions)&&Object.assign(p,u.change.changedOptions),!0)}},(u,p)=>{o.editorOptions.read(u),this._options.renderSideBySide.read(u),this.modified.updateOptions(this._adjustOptionsForRightHandSide(u,p)),this.original.updateOptions(this._adjustOptionsForLeftHandSide(u,p))}))}get onDidContentSizeChange(){return this._onDidContentSizeChange.event}_createLeftHandSideEditor(e,t){let o=this._adjustOptionsForLeftHandSide(void 0,e),n=this._constructInnerEditor(this._instantiationService,this.originalEditorElement,o,t),r=this._contextKeyService.createKey("isInDiffLeftEditor",n.hasWidgetFocus());return this._register(n.onDidFocusEditorWidget(()=>r.set(!0))),this._register(n.onDidBlurEditorWidget(()=>r.set(!1))),n}_createRightHandSideEditor(e,t){let o=this._adjustOptionsForRightHandSide(void 0,e),n=this._constructInnerEditor(this._instantiationService,this.modifiedEditorElement,o,t),r=this._contextKeyService.createKey("isInDiffRightEditor",n.hasWidgetFocus());return this._register(n.onDidFocusEditorWidget(()=>r.set(!0))),this._register(n.onDidBlurEditorWidget(()=>r.set(!1))),n}_constructInnerEditor(e,t,o,n){let r=this._createInnerEditor(e,t,o,n);return this._register(r.onDidContentSizeChange(s=>{let l=this.original.getContentWidth()+this.modified.getContentWidth()+iy.ENTIRE_DIFF_OVERVIEW_WIDTH,c=Math.max(this.modified.getContentHeight(),this.original.getContentHeight());this._onDidContentSizeChange.fire({contentHeight:c,contentWidth:l,contentHeightChanged:s.contentHeightChanged,contentWidthChanged:s.contentWidthChanged})})),r}_adjustOptionsForLeftHandSide(e,t){let o=this._adjustOptionsForSubEditor(t);return this._options.renderSideBySide.get()?(o.unicodeHighlight=this._options.editorOptions.get().unicodeHighlight||{},o.wordWrapOverride1=this._options.diffWordWrap.get()):(o.wordWrapOverride1="off",o.wordWrapOverride2="off",o.stickyScroll={enabled:!1},o.unicodeHighlight={nonBasicASCII:!1,ambiguousCharacters:!1,invisibleCharacters:!1}),o.glyphMargin=this._options.renderSideBySide.get(),t.originalAriaLabel&&(o.ariaLabel=t.originalAriaLabel),o.ariaLabel=this._updateAriaLabel(o.ariaLabel),o.readOnly=!this._options.originalEditable.get(),o.dropIntoEditor={enabled:!o.readOnly},o.extraEditorClassName="original-in-monaco-diff-editor",o}_adjustOptionsForRightHandSide(e,t){let o=this._adjustOptionsForSubEditor(t);return t.modifiedAriaLabel&&(o.ariaLabel=t.modifiedAriaLabel),o.ariaLabel=this._updateAriaLabel(o.ariaLabel),o.wordWrapOverride1=this._options.diffWordWrap.get(),o.revealHorizontalRightPadding=iS.revealHorizontalRightPadding.defaultValue+iy.ENTIRE_DIFF_OVERVIEW_WIDTH,o.scrollbar.verticalHasArrows=!1,o.extraEditorClassName="modified-in-monaco-diff-editor",o}_adjustOptionsForSubEditor(e){let t={...e,dimension:{height:0,width:0}};return t.inDiffEditor=!0,t.automaticLayout=!1,t.allowVariableLineHeights=!1,t.allowVariableFonts=!1,t.allowVariableFontsInAccessibilityMode=!1,t.scrollbar={...t.scrollbar||{}},t.folding=!1,t.codeLens=this._options.diffCodeLens.get(),t.fixedOverflowWidgets=!0,t.minimap={...t.minimap||{}},t.minimap.enabled=!1,this._options.hideUnchangedRegions.get()?t.stickyScroll={enabled:!1}:t.stickyScroll=this._options.editorOptions.get().stickyScroll,t}_updateAriaLabel(e){e||(e="");let t=d(222,null,this._keybindingService.lookupKeybinding("editor.action.accessibilityHelp")?.getAriaLabel());return this._options.accessibilityVerbose.get()?e+t:e?e.replaceAll(t,""):""}};OCe=I([m(5,X),m(6,F),m(7,_e)],OCe);var l1o=!1;var T6i=4,_6i=new E;function D6i(a){T6i=a,_6i.fire(a)}var L6i=300,R6i=new E;function M6i(a){L6i=a,R6i.fire(a)}var _4e=class{constructor(i){this.el=i;this.disposables=new N}get onPointerMove(){return this.disposables.add(new Gn(Re(this.el),"mousemove")).event}get onPointerUp(){return this.disposables.add(new Gn(Re(this.el),"mouseup")).event}dispose(){this.disposables.dispose()}};I([hi],_4e.prototype,"onPointerMove",1),I([hi],_4e.prototype,"onPointerUp",1);var D4e=class{constructor(i){this.el=i;this.disposables=new N}get onPointerMove(){return this.disposables.add(new Gn(this.el,Kn.Change)).event}get onPointerUp(){return this.disposables.add(new Gn(this.el,Kn.End)).event}dispose(){this.disposables.dispose()}};I([hi],D4e.prototype,"onPointerMove",1),I([hi],D4e.prototype,"onPointerUp",1);var FCe=class{constructor(i){this.factory=i}get onPointerMove(){return this.factory.onPointerMove}get onPointerUp(){return this.factory.onPointerUp}dispose(){}};I([hi],FCe.prototype,"onPointerMove",1),I([hi],FCe.prototype,"onPointerUp",1);var E6i="pointer-events-disabled",Jh=class a extends x{constructor(e,t,o){super();this.hoverDelay=L6i;this.hoverDelayer=this._register(new Xo(this.hoverDelay));this._state=3;this.onDidEnablementChange=this._register(new E);this._onDidStart=this._register(new E);this._onDidChange=this._register(new E);this._onDidReset=this._register(new E);this._onDidEnd=this._register(new E);this.orthogonalStartSashDisposables=this._register(new N);this.orthogonalStartDragHandleDisposables=this._register(new N);this.orthogonalEndSashDisposables=this._register(new N);this.orthogonalEndDragHandleDisposables=this._register(new N);this.linkedSash=void 0;this.el=M(e,_(".monaco-sash")),o.orthogonalEdge&&this.el.classList.add(`orthogonal-edge-${o.orthogonalEdge}`),Ze&&this.el.classList.add("mac"),this._register(j(this.el,"mousedown",r=>this.onPointerStart(r,new _4e(e)))),this._register(j(this.el,"dblclick",r=>this.onPointerDoublePress(r))),this._register(j(this.el,"mouseenter",()=>a.onMouseEnter(this))),this._register(j(this.el,"mouseleave",()=>a.onMouseLeave(this))),this._register(Ms.addTarget(this.el)),this._register(j(this.el,Kn.Start,r=>this.onPointerStart(r,new D4e(this.el))));let n;this._register(j(this.el,Kn.Tap,r=>{if(n){clearTimeout(n),n=void 0,this.onPointerDoublePress(r);return}clearTimeout(n),n=setTimeout(()=>n=void 0,250)})),typeof o.size=="number"?(this.size=o.size,o.orientation===0?this.el.style.width=`${this.size}px`:this.el.style.height=`${this.size}px`):(this.size=T6i,this._register(_6i.event(r=>{this.size=r,this.layout()}))),this._register(R6i.event(r=>this.hoverDelay=r)),this.layoutProvider=t,this.orthogonalStartSash=o.orthogonalStartSash,this.orthogonalEndSash=o.orthogonalEndSash,this.orientation=o.orientation||0,this.orientation===1?(this.el.classList.add("horizontal"),this.el.classList.remove("vertical")):(this.el.classList.remove("horizontal"),this.el.classList.add("vertical")),this.el.classList.toggle("debug",l1o),this.layout()}get state(){return this._state}get orthogonalStartSash(){return this._orthogonalStartSash}get orthogonalEndSash(){return this._orthogonalEndSash}set state(e){this._state!==e&&(this.el.classList.toggle("disabled",e===0),this.el.classList.toggle("minimum",e===1),this.el.classList.toggle("maximum",e===2),this._state=e,this.onDidEnablementChange.fire(e))}get onDidStart(){return this._onDidStart.event}get onDidChange(){return this._onDidChange.event}get onDidReset(){return this._onDidReset.event}get onDidEnd(){return this._onDidEnd.event}set orthogonalStartSash(e){if(this._orthogonalStartSash!==e){if(this.orthogonalStartDragHandleDisposables.clear(),this.orthogonalStartSashDisposables.clear(),e){let t=o=>{this.orthogonalStartDragHandleDisposables.clear(),o!==0&&(this._orthogonalStartDragHandle=M(this.el,_(".orthogonal-drag-handle.start")),this.orthogonalStartDragHandleDisposables.add(Z(()=>this._orthogonalStartDragHandle.remove())),this.orthogonalStartDragHandleDisposables.add(j(this._orthogonalStartDragHandle,"mouseenter",()=>a.onMouseEnter(e))),this.orthogonalStartDragHandleDisposables.add(j(this._orthogonalStartDragHandle,"mouseleave",()=>a.onMouseLeave(e))))};this.orthogonalStartSashDisposables.add(e.onDidEnablementChange.event(t,this)),t(e.state)}this._orthogonalStartSash=e}}set orthogonalEndSash(e){if(this._orthogonalEndSash!==e){if(this.orthogonalEndDragHandleDisposables.clear(),this.orthogonalEndSashDisposables.clear(),e){let t=o=>{this.orthogonalEndDragHandleDisposables.clear(),o!==0&&(this._orthogonalEndDragHandle=M(this.el,_(".orthogonal-drag-handle.end")),this.orthogonalEndDragHandleDisposables.add(Z(()=>this._orthogonalEndDragHandle.remove())),this.orthogonalEndDragHandleDisposables.add(j(this._orthogonalEndDragHandle,"mouseenter",()=>a.onMouseEnter(e))),this.orthogonalEndDragHandleDisposables.add(j(this._orthogonalEndDragHandle,"mouseleave",()=>a.onMouseLeave(e))))};this.orthogonalEndSashDisposables.add(e.onDidEnablementChange.event(t,this)),t(e.state)}this._orthogonalEndSash=e}}onPointerStart(e,t){Xt.stop(e);let o=!1;if(!e.__orthogonalSashEvent){let v=this.getOrthogonalSash(e);v&&(o=!0,e.__orthogonalSashEvent=!0,v.onPointerStart(e,new FCe(t)))}if(this.linkedSash&&!e.__linkedSashEvent&&(e.__linkedSashEvent=!0,this.linkedSash.onPointerStart(e,new FCe(t))),!this.state)return;let n=this.el.ownerDocument.getElementsByTagName("iframe");for(let v of n)v.classList.add(E6i);let r=e.pageX,s=e.pageY,l=e.altKey,c={startX:r,currentX:r,startY:s,currentY:s,altKey:l};this.el.classList.add("active"),this._onDidStart.fire(c);let u=Cr(this.el),p=()=>{let v="";o?v="all-scroll":this.orientation===1?this.state===1?v="s-resize":this.state===2?v="n-resize":v=Ze?"row-resize":"ns-resize":this.state===1?v="e-resize":this.state===2?v="w-resize":v=Ze?"col-resize":"ew-resize",u.textContent=`* { cursor: ${v} !important; }`},h=new N;p(),o||this.onDidEnablementChange.event(p,null,h);let g=v=>{Xt.stop(v,!1);let b={startX:r,currentX:v.pageX,startY:s,currentY:v.pageY,altKey:l};this._onDidChange.fire(b)},f=v=>{Xt.stop(v,!1),u.remove(),this.el.classList.remove("active"),this._onDidEnd.fire(),h.dispose();for(let b of n)b.classList.remove(E6i)};t.onPointerMove(g,null,h),t.onPointerUp(f,null,h),h.add(t)}onPointerDoublePress(e){let t=this.getOrthogonalSash(e);t&&t._onDidReset.fire(),this.linkedSash&&this.linkedSash._onDidReset.fire(),this._onDidReset.fire()}static onMouseEnter(e,t=!1){e.el.classList.contains("active")?(e.hoverDelayer.cancel(),e.el.classList.add("hover")):e.hoverDelayer.trigger(()=>e.el.classList.add("hover"),e.hoverDelay).then(void 0,()=>{}),!t&&e.linkedSash&&a.onMouseEnter(e.linkedSash,!0)}static onMouseLeave(e,t=!1){e.hoverDelayer.cancel(),e.el.classList.remove("hover"),!t&&e.linkedSash&&a.onMouseLeave(e.linkedSash,!0)}clearSashHoverState(){a.onMouseLeave(this)}layout(){if(this.orientation===0){let e=this.layoutProvider;this.el.style.left=e.getVerticalSashLeft(this)-this.size/2+"px",e.getVerticalSashTop&&(this.el.style.top=e.getVerticalSashTop(this)+"px"),e.getVerticalSashHeight&&(this.el.style.height=e.getVerticalSashHeight(this)+"px")}else{let e=this.layoutProvider;this.el.style.top=e.getHorizontalSashTop(this)-this.size/2+"px",e.getHorizontalSashLeft&&(this.el.style.left=e.getHorizontalSashLeft(this)+"px"),e.getHorizontalSashWidth&&(this.el.style.width=e.getHorizontalSashWidth(this)+"px")}}getOrthogonalSash(e){let t=e.initialTarget??e.target;if(!(!t||!Do(t))&&t.classList.contains("orthogonal-drag-handle"))return t.classList.contains("start")?this.orthogonalStartSash:this.orthogonalEndSash}dispose(){super.dispose(),this.el.remove()}};var ewt=class{constructor(i,e){this._options=i;this.dimensions=e;this.sashLeft=K$(this,i=>{let e=this._sashRatio.read(i)??this._options.splitViewDefaultRatio.read(i);return this._computeSashLeft(e,i)},(i,e)=>{let t=this.dimensions.width.get();this._sashRatio.set(i/t,e)});this._sashRatio=Me(this,void 0)}resetSash(){this._sashRatio.set(void 0,void 0)}_computeSashLeft(i,e){let t=this.dimensions.width.read(e),o=Math.floor(this._options.splitViewDefaultRatio.read(e)*t),n=this._options.enableSplitViewResizing.read(e)?Math.floor(i*t):o,r=100;return t<=r*2?o:n<r?r:n>t-r?t-r:n}},WCe=class extends x{constructor(e,t,o,n,r,s){super();this._domNode=e;this._dimensions=t;this._enabled=o;this._boundarySashes=n;this.sashLeft=r;this._resetSash=s;this._sash=this._register(new Jh(this._domNode,{getVerticalSashTop:l=>0,getVerticalSashLeft:l=>this.sashLeft.get(),getVerticalSashHeight:l=>this._dimensions.height.get()},{orientation:0})),this._startSashPosition=void 0,this._register(this._sash.onDidStart(()=>{this._startSashPosition=this.sashLeft.get()})),this._register(this._sash.onDidChange(l=>{this.sashLeft.set(this._startSashPosition+(l.currentX-l.startX),void 0)})),this._register(this._sash.onDidEnd(()=>this._sash.layout())),this._register(this._sash.onDidReset(()=>this._resetSash())),this._register(be(l=>{let c=this._boundarySashes.read(l);c&&(this._sash.orthogonalEndSash=c.bottom)})),this._register(be(l=>{let c=this._enabled.read(l);this._sash.state=c?3:0,this.sashLeft.read(l),this._dimensions.height.read(l),this._sash.layout()}))}};var iwt=class a extends x{constructor(){super(...arguments);this._id=++a.idCounter;this._onDidDispose=this._register(new E);this.onDidDispose=this._onDidDispose.event}static{this.idCounter=0}getId(){return this.getEditorType()+":v2:"+this._id}getVisibleColumnFromPosition(e){return this._targetEditor.getVisibleColumnFromPosition(e)}getStatusbarColumn(e){return this._targetEditor.getStatusbarColumn(e)}getPosition(){return this._targetEditor.getPosition()}setPosition(e,t="api"){this._targetEditor.setPosition(e,t)}revealLine(e,t=0){this._targetEditor.revealLine(e,t)}revealLineInCenter(e,t=0){this._targetEditor.revealLineInCenter(e,t)}revealLineInCenterIfOutsideViewport(e,t=0){this._targetEditor.revealLineInCenterIfOutsideViewport(e,t)}revealLineNearTop(e,t=0){this._targetEditor.revealLineNearTop(e,t)}revealPosition(e,t=0){this._targetEditor.revealPosition(e,t)}revealPositionInCenter(e,t=0){this._targetEditor.revealPositionInCenter(e,t)}revealPositionInCenterIfOutsideViewport(e,t=0){this._targetEditor.revealPositionInCenterIfOutsideViewport(e,t)}revealPositionNearTop(e,t=0){this._targetEditor.revealPositionNearTop(e,t)}getSelection(){return this._targetEditor.getSelection()}getSelections(){return this._targetEditor.getSelections()}setSelection(e,t="api"){this._targetEditor.setSelection(e,t)}setSelections(e,t="api"){this._targetEditor.setSelections(e,t)}revealLines(e,t,o=0){this._targetEditor.revealLines(e,t,o)}revealLinesInCenter(e,t,o=0){this._targetEditor.revealLinesInCenter(e,t,o)}revealLinesInCenterIfOutsideViewport(e,t,o=0){this._targetEditor.revealLinesInCenterIfOutsideViewport(e,t,o)}revealLinesNearTop(e,t,o=0){this._targetEditor.revealLinesNearTop(e,t,o)}revealRange(e,t=0,o=!1,n=!0){this._targetEditor.revealRange(e,t,o,n)}revealRangeInCenter(e,t=0){this._targetEditor.revealRangeInCenter(e,t)}revealRangeInCenterIfOutsideViewport(e,t=0){this._targetEditor.revealRangeInCenterIfOutsideViewport(e,t)}revealRangeNearTop(e,t=0){this._targetEditor.revealRangeNearTop(e,t)}revealRangeNearTopIfOutsideViewport(e,t=0){this._targetEditor.revealRangeNearTopIfOutsideViewport(e,t)}revealRangeAtTop(e,t=0){this._targetEditor.revealRangeAtTop(e,t)}getSupportedActions(){return this._targetEditor.getSupportedActions()}focus(){this._targetEditor.focus()}trigger(e,t,o){this._targetEditor.trigger(e,t,o)}createDecorationsCollection(e){return this._targetEditor.createDecorationsCollection(e)}changeDecorations(e){return this._targetEditor.changeDecorations(e)}};var cS={enableSplitViewResizing:!0,splitViewDefaultRatio:.5,renderSideBySide:!0,renderMarginRevertIcon:!0,renderGutterMenu:!0,maxComputationTime:5e3,maxFileSize:50,ignoreTrimWhitespace:!0,renderIndicators:!0,originalEditable:!1,diffCodeLens:!1,renderOverviewRuler:!0,diffWordWrap:"inherit",diffAlgorithm:"advanced",accessibilityVerbose:!1,experimental:{showMoves:!1,showEmptyDecorations:!0,useTrueInlineView:!1},hideUnchangedRegions:{enabled:!1,contextLineCount:3,minimumLineCount:3,revealLineCount:20},isInEmbeddedEditor:!1,onlyShowAccessibleDiffViewer:!1,renderSideBySideInlineBreakpoint:900,useInlineViewWhenSpaceIsLimited:!0,compactMode:!1};var vY=class{constructor(i,e){this._accessibilityService=e;this._diffEditorWidth=Me(this,0),this._screenReaderMode=ui(this,this._accessibilityService.onDidChangeScreenReaderOptimized,()=>this._accessibilityService.isScreenReaderOptimized()),this.couldShowInlineViewBecauseOfSize=ke(this,o=>this._options.read(o).renderSideBySide&&this._diffEditorWidth.read(o)<=this._options.read(o).renderSideBySideInlineBreakpoint),this.renderOverviewRuler=ke(this,o=>this._options.read(o).renderOverviewRuler),this.renderSideBySide=ke(this,o=>this.compactMode.read(o)&&this.shouldRenderInlineViewInSmartMode.read(o)?!1:this._options.read(o).renderSideBySide&&!(this._options.read(o).useInlineViewWhenSpaceIsLimited&&this.couldShowInlineViewBecauseOfSize.read(o)&&!this._screenReaderMode.read(o))),this.readOnly=ke(this,o=>this._options.read(o).readOnly),this.shouldRenderOldRevertArrows=ke(this,o=>!(!this._options.read(o).renderMarginRevertIcon||!this.renderSideBySide.read(o)||this.readOnly.read(o)||this.shouldRenderGutterMenu.read(o))),this.shouldRenderGutterMenu=ke(this,o=>this._options.read(o).renderGutterMenu),this.renderIndicators=ke(this,o=>this._options.read(o).renderIndicators),this.enableSplitViewResizing=ke(this,o=>this._options.read(o).enableSplitViewResizing),this.splitViewDefaultRatio=ke(this,o=>this._options.read(o).splitViewDefaultRatio),this.ignoreTrimWhitespace=ke(this,o=>this._options.read(o).ignoreTrimWhitespace),this.maxComputationTimeMs=ke(this,o=>this._options.read(o).maxComputationTime),this.showMoves=ke(this,o=>this._options.read(o).experimental.showMoves&&this.renderSideBySide.read(o)),this.isInEmbeddedEditor=ke(this,o=>this._options.read(o).isInEmbeddedEditor),this.diffWordWrap=ke(this,o=>this._options.read(o).diffWordWrap),this.originalEditable=ke(this,o=>this._options.read(o).originalEditable),this.diffCodeLens=ke(this,o=>this._options.read(o).diffCodeLens),this.accessibilityVerbose=ke(this,o=>this._options.read(o).accessibilityVerbose),this.diffAlgorithm=ke(this,o=>this._options.read(o).diffAlgorithm),this.showEmptyDecorations=ke(this,o=>this._options.read(o).experimental.showEmptyDecorations),this.onlyShowAccessibleDiffViewer=ke(this,o=>this._options.read(o).onlyShowAccessibleDiffViewer),this.compactMode=ke(this,o=>this._options.read(o).compactMode),this.trueInlineDiffRenderingEnabled=ke(this,o=>this._options.read(o).experimental.useTrueInlineView),this.useTrueInlineDiffRendering=ke(this,o=>!this.renderSideBySide.read(o)&&this.trueInlineDiffRenderingEnabled.read(o)),this.hideUnchangedRegions=ke(this,o=>this._options.read(o).hideUnchangedRegions.enabled),this.hideUnchangedRegionsRevealLineCount=ke(this,o=>this._options.read(o).hideUnchangedRegions.revealLineCount),this.hideUnchangedRegionsContextLineCount=ke(this,o=>this._options.read(o).hideUnchangedRegions.contextLineCount),this.hideUnchangedRegionsMinimumLineCount=ke(this,o=>this._options.read(o).hideUnchangedRegions.minimumLineCount),this._model=Me(this,void 0),this.shouldRenderInlineViewInSmartMode=this._model.map(this,o=>MJt(this,n=>{let r=o?.diff.read(n);return r?c1o(r,this.trueInlineDiffRenderingEnabled.read(n)):void 0})).flatten().map(this,o=>!!o),this.inlineViewHideOriginalLineNumbers=this.compactMode;let t={...i,...P6i(i,cS)};this._options=Me(this,t)}get editorOptions(){return this._options}updateOptions(i){let e=P6i(i,this._options.get()),t={...this._options.get(),...i,...e};this._options.set(t,void 0,{changedOptions:i})}setWidth(i){this._diffEditorWidth.set(i,void 0)}setModel(i){this._model.set(i,void 0)}};vY=I([m(1,Oi)],vY);function c1o(a,i){return a.mappings.every(e=>d1o(e.lineRangeMapping)||u1o(e.lineRangeMapping)||i&&T4e(e.lineRangeMapping))}function d1o(a){return a.original.length===0}function u1o(a){return a.modified.length===0}function P6i(a,i){return{enableSplitViewResizing:yn(a.enableSplitViewResizing,i.enableSplitViewResizing),splitViewDefaultRatio:M$i(a.splitViewDefaultRatio,.5,.1,.9),renderSideBySide:yn(a.renderSideBySide,i.renderSideBySide),renderMarginRevertIcon:yn(a.renderMarginRevertIcon,i.renderMarginRevertIcon),maxComputationTime:EV(a.maxComputationTime,i.maxComputationTime,0,1073741824),maxFileSize:EV(a.maxFileSize,i.maxFileSize,0,1073741824),ignoreTrimWhitespace:yn(a.ignoreTrimWhitespace,i.ignoreTrimWhitespace),renderIndicators:yn(a.renderIndicators,i.renderIndicators),originalEditable:yn(a.originalEditable,i.originalEditable),diffCodeLens:yn(a.diffCodeLens,i.diffCodeLens),renderOverviewRuler:yn(a.renderOverviewRuler,i.renderOverviewRuler),diffWordWrap:Xd(a.diffWordWrap,i.diffWordWrap,["off","on","inherit"]),diffAlgorithm:Xd(a.diffAlgorithm,i.diffAlgorithm,["legacy","advanced"],{smart:"legacy",experimental:"advanced"}),accessibilityVerbose:yn(a.accessibilityVerbose,i.accessibilityVerbose),experimental:{showMoves:yn(a.experimental?.showMoves,i.experimental.showMoves),showEmptyDecorations:yn(a.experimental?.showEmptyDecorations,i.experimental.showEmptyDecorations),useTrueInlineView:yn(a.experimental?.useTrueInlineView,i.experimental.useTrueInlineView)},hideUnchangedRegions:{enabled:yn(a.hideUnchangedRegions?.enabled??a.experimental?.collapseUnchangedRegions,i.hideUnchangedRegions.enabled),contextLineCount:EV(a.hideUnchangedRegions?.contextLineCount,i.hideUnchangedRegions.contextLineCount,0,1073741824),minimumLineCount:EV(a.hideUnchangedRegions?.minimumLineCount,i.hideUnchangedRegions.minimumLineCount,0,1073741824),revealLineCount:EV(a.hideUnchangedRegions?.revealLineCount,i.hideUnchangedRegions.revealLineCount,0,1073741824)},isInEmbeddedEditor:yn(a.isInEmbeddedEditor,i.isInEmbeddedEditor),onlyShowAccessibleDiffViewer:yn(a.onlyShowAccessibleDiffViewer,i.onlyShowAccessibleDiffViewer),renderSideBySideInlineBreakpoint:EV(a.renderSideBySideInlineBreakpoint,i.renderSideBySideInlineBreakpoint,0,1073741824),useInlineViewWhenSpaceIsLimited:yn(a.useInlineViewWhenSpaceIsLimited,i.useInlineViewWhenSpaceIsLimited),renderGutterMenu:yn(a.renderGutterMenu,i.renderGutterMenu),compactMode:yn(a.compactMode,i.compactMode)}}var owt=_;var bY=class extends x{constructor(i){super(),this.containerDomNode=document.createElement("div"),this.containerDomNode.className="monaco-hover",this.containerDomNode.classList.toggle("fade-in",!!i),this.containerDomNode.tabIndex=0,this.containerDomNode.setAttribute("role","tooltip"),this.contentsDomNode=document.createElement("div"),this.contentsDomNode.className="monaco-hover-content",this.scrollbar=this._register(new ms(this.contentsDomNode,{consumeMouseWheelIfScrollbarIsNeeded:!0})),this.containerDomNode.appendChild(this.scrollbar.getDomNode())}onContentsChanged(){this.scrollbar.scanDomNode()}},SY=class a extends x{static render(i,e,t){return new a(i,e,t)}constructor(i,e,t){super(),this.actionLabel=e.label,this.actionKeybindingLabel=t,this.actionContainer=M(i,owt("div.action-container")),this.actionContainer.setAttribute("tabindex","0"),this.action=M(this.actionContainer,owt("a.action")),this.action.setAttribute("role","button"),e.iconClass&&M(this.action,owt("span.icon")).classList.add(...e.iconClass.split(" ")),this.actionRenderedLabel=t?`${e.label} (${t})`:e.label;let o=M(this.action,owt("span"));o.textContent=this.actionRenderedLabel,this._store.add(new L4e(this.actionContainer,e.run)),this._store.add(new R4e(this.actionContainer,e.run,[3,10])),this.setEnabled(!0)}setEnabled(i){i?(this.actionContainer.classList.remove("disabled"),this.actionContainer.removeAttribute("aria-disabled")):(this.actionContainer.classList.add("disabled"),this.actionContainer.setAttribute("aria-disabled","true"))}};function nwt(a,i){return a&&i?d(15,null,i):a?d(16,null):""}var L4e=class extends x{constructor(i,e){super(),this._register(j(i,re.CLICK,t=>{t.stopPropagation(),t.preventDefault(),e(i)}))}},R4e=class extends x{constructor(i,e,t){super(),this._register(j(i,re.KEY_DOWN,o=>{let n=new gi(o);t.some(r=>n.equals(r))&&(o.stopPropagation(),o.preventDefault(),e(i))}))}};var M4e=class extends rs{constructor(e,t){super();this._onDidChangeVisibility=this._register(new E);this.onDidChangeVisibility=this._onDidChangeVisibility.event;this._element=M(e,_(".monaco-dropdown")),this._label=M(this._element,_(".dropdown-label"));let o=t.labelRenderer;o||(o=r=>(r.textContent=t.label||"",null));for(let r of[re.CLICK,re.MOUSE_DOWN,Kn.Tap])this._register(j(this.element,r,s=>Xt.stop(s,!0)));for(let r of[re.MOUSE_DOWN,Kn.Tap])this._register(j(this._label,r,s=>{Ru(s)&&s.button!==0||(this.visible?this.hide():this.show())}));this._register(j(this._label,re.KEY_DOWN,r=>{let s=new gi(r);(s.equals(3)||s.equals(10))&&(Xt.stop(r,!0),this.visible?this.hide():this.show())}));let n=o(this._label);n&&this._register(n),this._register(Ms.addTarget(this._label))}get element(){return this._element}get label(){return this._label}set tooltip(e){this._label&&(!this.hover&&e!==""?this.hover=this._register(Up().setupManagedHover(Ri("mouse"),this._label,e)):this.hover&&this.hover.update(e))}show(){this.visible||(this.visible=!0,this._onDidChangeVisibility.fire(!0))}hide(){this.visible&&(this.visible=!1,this._onDidChangeVisibility.fire(!1))}isVisible(){return!!this.visible}onEvent(e,t){this.hide()}dispose(){super.dispose(),this.hide(),this.boxContainer&&(this.boxContainer.remove(),this.boxContainer=void 0),this.contents&&(this.contents.remove(),this.contents=void 0),this._label&&(this._label.remove(),this._label=void 0)}};function A6i(a){return typeof a?.getActions=="function"}var rwt=class extends M4e{constructor(e,t){super(e,t);this._options=t;this._actions=[];this.actions=t.actions||[]}set menuOptions(e){this._menuOptions=e}get menuOptions(){return this._menuOptions}get actions(){return this._options.actionProvider?this._options.actionProvider.getActions():this._actions}set actions(e){this._actions=e}show(){super.show(),this.element.classList.add("active"),this._options.contextMenuProvider.showContextMenu({getAnchor:()=>this.element,getActions:()=>this.actions,getActionsContext:()=>this.menuOptions?this.menuOptions.context:null,getActionViewItem:(e,t)=>this.menuOptions&&this.menuOptions.actionViewItemProvider?this.menuOptions.actionViewItemProvider(e,t):void 0,getKeyBinding:e=>this.menuOptions&&this.menuOptions.getKeyBinding?this.menuOptions.getKeyBinding(e):void 0,getMenuClassName:()=>this._options.menuClassName||"",onHide:()=>this.onHide(),actionRunner:this.menuOptions?this.menuOptions.actionRunner:void 0,anchorAlignment:this.menuOptions?this.menuOptions.anchorAlignment:0,domForShadowRoot:this._options.menuAsChild?this.element:void 0,skipTelemetry:this._options.skipTelemetry})}hide(){super.hide()}onHide(){this.hide(),this.element.classList.remove("active")}};var Pm=class extends wl{constructor(e,t,o,n=Object.create(null)){super(null,e,n);this.actionItem=null;this._onDidChangeVisibility=this._register(new E);this.menuActionsOrProvider=t,this.contextMenuProvider=o,this.options=n,this.options.actionRunner&&(this.actionRunner=this.options.actionRunner)}get onDidChangeVisibility(){return this._onDidChangeVisibility.event}render(e){this.actionItem=e;let t=r=>(this.element=M(r,_("a.action-label")),this.setAriaLabelAttributes(this.element),this.renderLabel(this.element)),o=Array.isArray(this.menuActionsOrProvider),n={contextMenuProvider:this.contextMenuProvider,labelRenderer:t,menuAsChild:this.options.menuAsChild,actions:o?this.menuActionsOrProvider:void 0,actionProvider:o?void 0:this.menuActionsOrProvider,skipTelemetry:this.options.skipTelemetry};if(this.dropdownMenu=this._register(new rwt(e,n)),this._register(this.dropdownMenu.onDidChangeVisibility(r=>{this.element?.setAttribute("aria-expanded",`${r}`),this._onDidChangeVisibility.fire(r)})),this.dropdownMenu.menuOptions={actionViewItemProvider:this.options.actionViewItemProvider,actionRunner:this.actionRunner,getKeyBinding:this.options.keybindingProvider,context:this._context},this.options.anchorAlignmentProvider){let r=this;this.dropdownMenu.menuOptions={...this.dropdownMenu.menuOptions,get anchorAlignment(){return r.options.anchorAlignmentProvider()}}}this.updateTooltip(),this.updateEnabled()}renderLabel(e){let t=[];return typeof this.options.classNames=="string"?t=this.options.classNames.split(/\s+/g).filter(o=>!!o):this.options.classNames&&(t=this.options.classNames),t.find(o=>o==="icon")||t.push("codicon"),e.classList.add(...t),this._action.label&&this._register(Up().setupManagedHover(this.options.hoverDelegate??Ri("mouse"),e,this._action.label)),null}setAriaLabelAttributes(e){e.setAttribute("role","button"),e.setAttribute("aria-haspopup","true"),e.setAttribute("aria-expanded","false"),e.ariaLabel=this._action.label||""}getTooltip(){let e=null;return this.action.tooltip?e=this.action.tooltip:this.action.label&&(e=this.action.label),e??void 0}setActionContext(e){super.setActionContext(e),this.dropdownMenu&&(this.dropdownMenu.menuOptions?this.dropdownMenu.menuOptions.context=e:this.dropdownMenu.menuOptions={context:e})}show(){this.dropdownMenu?.show()}updateEnabled(){let e=!this.action.enabled;this.actionItem?.classList.toggle("disabled",e),this.element?.classList.toggle("disabled",e)}},IY=class extends hs{constructor(e,t,o,n){super(e,t,o);this.contextMenuProvider=n}render(e){if(super.render(e),this.element){this.element.classList.add("action-dropdown-item");let t={getActions:()=>{let r=this.options.menuActionsOrProvider;return Array.isArray(r)?r:r.getActions()}},o=this.options.menuActionClassNames||[],n=ct("div.action-dropdown-item-separator",[ct("div",{})]).root;n.classList.toggle("prominent",o.includes("prominent")),M(this.element,n),this.dropdownMenuActionViewItem=this._register(new Pm(this._register(new it("dropdownAction",d(8,null))),t,this.contextMenuProvider,{classNames:["dropdown",...q.asClassNameArray(R.dropDownButton),...o],hoverDelegate:this.options.hoverDelegate})),this.dropdownMenuActionViewItem.render(this.element),this._register(j(this.element,re.KEY_DOWN,r=>{if(t.getActions().length===0)return;let s=new gi(r),l=!1;this.dropdownMenuActionViewItem?.isFocused()&&s.equals(15)?(l=!0,this.dropdownMenuActionViewItem?.blur(),this.focus()):this.isFocused()&&s.equals(17)&&(l=!0,this.blur(),this.dropdownMenuActionViewItem?.focus()),l&&(s.preventDefault(),s.stopPropagation())}))}}blur(){super.blur(),this.dropdownMenuActionViewItem?.blur()}setFocusable(e){super.setFocusable(e),this.dropdownMenuActionViewItem?.setFocusable(e)}};var VCe=20,BCe=4,Uri="--vscode-toolbar-action-min-width",wp=class extends x{constructor(e,t,o={orientation:0}){super();this.container=e;this.submenuActionViewItems=[];this.hasSecondaryActions=!1;this._onDidChangeDropdownVisibility=this._register(new AI);this.originalPrimaryActions=[];this.originalSecondaryActions=[];this.hiddenActions=[];this.disposables=this._register(new N);if(o.hoverDelegate=o.hoverDelegate??this._register(Qh()),this.options=o,this.toggleMenuAction=this._register(new oce(()=>this.toggleMenuActionViewItem?.show(),o.toggleMenuTitle)),this.element=document.createElement("div"),this.element.className="monaco-toolbar",e.appendChild(this.element),this.actionBar=this._register(new Zi(this.element,{orientation:o.orientation,ariaLabel:o.ariaLabel,actionRunner:o.actionRunner,allowContextMenu:o.allowContextMenu,highlightToggledItems:o.highlightToggledItems,hoverDelegate:o.hoverDelegate,actionViewItemProvider:(n,r)=>{if(n.id===oce.ID)return this.toggleMenuActionViewItem=new Pm(n,{getActions:()=>this.toggleMenuAction.menuActions},t,{actionViewItemProvider:this.options.actionViewItemProvider,actionRunner:this.actionRunner,keybindingProvider:this.options.getKeyBinding,classNames:q.asClassNameArray(o.moreIcon??R.toolBarMore),anchorAlignmentProvider:this.options.anchorAlignmentProvider,menuAsChild:!!this.options.renderDropdownAsChildElement,skipTelemetry:this.options.skipTelemetry,isMenu:!0,hoverDelegate:this.options.hoverDelegate}),this.toggleMenuActionViewItem.setActionContext(this.actionBar.context),this.disposables.add(this._onDidChangeDropdownVisibility.add(this.toggleMenuActionViewItem.onDidChangeVisibility)),this.toggleMenuActionViewItem;if(o.actionViewItemProvider){let s=o.actionViewItemProvider(n,r);if(s)return s}if(n instanceof Fs){let s=new Pm(n,n.actions,t,{actionViewItemProvider:this.options.actionViewItemProvider,actionRunner:this.actionRunner,keybindingProvider:this.options.getKeyBinding,classNames:n.class,anchorAlignmentProvider:this.options.anchorAlignmentProvider,menuAsChild:!!this.options.renderDropdownAsChildElement,skipTelemetry:this.options.skipTelemetry,hoverDelegate:this.options.hoverDelegate});return s.setActionContext(this.actionBar.context),this.submenuActionViewItems.push(s),this.disposables.add(this._onDidChangeDropdownVisibility.add(s.onDidChangeVisibility)),s}}})),this.options.responsiveBehavior?.enabled){this.element.classList.toggle("responsive",!0),this.element.classList.toggle("responsive-all",this.options.responsiveBehavior.kind==="all"),this.element.classList.toggle("responsive-last",this.options.responsiveBehavior.kind==="last"),this.element.style.setProperty(Uri,`${this.getConfiguredActionMinWidth()}px`);let n=new ResizeObserver(()=>{this.updateActions(this.element.getBoundingClientRect().width)});n.observe(this.element),this._store.add(Z(()=>n.disconnect()))}}get onDidChangeDropdownVisibility(){return this._onDidChangeDropdownVisibility.event}set actionRunner(e){this.actionBar.actionRunner=e}get actionRunner(){return this.actionBar.actionRunner}set context(e){this.actionBar.context=e,this.toggleMenuActionViewItem?.setActionContext(e);for(let t of this.submenuActionViewItems)t.setActionContext(e)}getElement(){return this.element}focus(){this.actionBar.focus()}getItemsWidth(){let e=0;for(let t=0;t<this.actionBar.length();t++)e+=this.actionBar.getWidth(t);return e}getItemAction(e){return this.actionBar.getAction(e)}getItemWidth(e){return this.actionBar.getWidth(e)}getItemsLength(){return this.actionBar.length()}setAriaLabel(e){this.actionBar.setAriaLabel(e)}relayout(){if(this.options.responsiveBehavior?.enabled){let e=this.element.getBoundingClientRect().width;this.updateActions(e)}}setActions(e,t){this.clear(),this.originalPrimaryActions=e?e.slice(0):[],this.originalSecondaryActions=t?t.slice(0):[];let o=e?e.slice(0):[];if(this.hasSecondaryActions=!!(t&&t.length>0),this.hasSecondaryActions&&t&&(this.toggleMenuAction.menuActions=t.slice(0),o.push(this.toggleMenuAction)),o.length>0&&this.options.trailingSeparator&&o.push(new ri),o.forEach(n=>{this.actionBar.push(n,{icon:this.options.icon??!0,label:this.options.label??!1,keybinding:this.getKeybindingLabel(n)})}),this.updateOverflowClassName(),this.applyResponsiveActionMinWidths(),this.options.responsiveBehavior?.enabled){if(this.hiddenActions.length=0,this.options.responsiveBehavior?.minItems!==void 0){let n=this.options.responsiveBehavior.minItems,r=this.originalPrimaryActions.slice(0,n).reduce((l,c)=>l+this.getActionMinWidth(c),0),s=0;(this.originalSecondaryActions.length>0||n<this.originalPrimaryActions.length)&&(s=VCe+BCe),this.container.style.minWidth=`${r+s}px`,this.element.style.minWidth=`${r+s}px`}else{let n=this.originalPrimaryActions.length>0?this.getActionMinWidth(this.originalPrimaryActions[0]):VCe+BCe;this.container.style.minWidth=`${n}px`,this.element.style.minWidth=`${n}px`}this.updateActions(this.element.getBoundingClientRect().width)}}isEmpty(){return this.actionBar.isEmpty()}getKeybindingLabel(e){return this.options.getKeyBinding?.(e)?.getLabel()??void 0}getConfiguredActionMinWidth(e){return e?.id===oce.ID?VCe:this.options.responsiveBehavior?.getActionMinWidth?.(e??this.toggleMenuAction)??this.options.responsiveBehavior?.actionMinWidth??VCe}getActionMinWidth(e){return this.getConfiguredActionMinWidth(e)+BCe}applyResponsiveActionMinWidths(){if(!this.options.responsiveBehavior?.enabled)return;if(this.options.responsiveBehavior.kind==="last"){let o=this.actionBar.hasAction(this.toggleMenuAction)?this.actionBar.length()-2:this.actionBar.length()-1,n=o>=0?this.actionBar.getAction(o):void 0,r=`${this.getConfiguredActionMinWidth(n)}px`;this.element.style.getPropertyValue(Uri)!==r&&this.element.style.setProperty(Uri,r);return}let e=this.actionBar.getContainer().firstElementChild;if(Do(e))for(let t=0;t<e.children.length;t++){let o=e.children.item(t);if(!Do(o))continue;let n=this.actionBar.getAction(t),r=`${this.getConfiguredActionMinWidth(n)}px`;o.style.minWidth!==r&&(o.style.minWidth=r)}}updateActions(e){if(this.actionBar.isEmpty())return;this.applyResponsiveActionMinWidths();let t=parseInt(this.element.style.minWidth);e=Math.max(e,Number.isNaN(t)?0:t);let o=s=>{if(this.options.responsiveBehavior?.kind==="last"){let l=this.actionBar.hasAction(this.toggleMenuAction),c=l?this.actionBar.length()-1:this.actionBar.length();if(c===0)return l?VCe+BCe:0;let u=0;for(let h=0;h<c-1;h++)u+=this.actionBar.getWidth(h)+BCe;let p=this.actionBar.getAction(c-1);return u+=s?this.actionBar.getWidth(c-1):this.getActionMinWidth(p),u+=l?VCe+BCe:0,u}else{let l=0;for(let c=0;c<this.actionBar.length();c++)l+=s?this.actionBar.getWidth(c):this.getActionMinWidth(this.actionBar.getAction(c));return l}},n=o(!1);if(n<=e&&this.hiddenActions.length===0)return;if(n>e){if(this.options.responsiveBehavior?.minItems!==void 0&&(this.actionBar.hasAction(this.toggleMenuAction)?this.actionBar.length()-1:this.actionBar.length())<=this.options.responsiveBehavior.minItems)return;for(;o(!1)>e&&this.actionBar.length()>0;){let s=this.originalPrimaryActions.length-this.hiddenActions.length-1;if(s<0)break;let l=this.originalPrimaryActions[s],c=Math.min(this.getActionMinWidth(l),this.getItemWidth(s));this.hiddenActions.unshift({action:l,size:c}),this.actionBar.pull(s),this.originalSecondaryActions.length===0&&this.hiddenActions.length===1&&(this.actionBar.push(this.toggleMenuAction,{icon:this.options.icon??!0,label:this.options.label??!1,keybinding:this.getKeybindingLabel(this.toggleMenuAction)}),this.updateOverflowClassName()),this.applyResponsiveActionMinWidths()}}else for(;this.hiddenActions.length>0;){let s=this.hiddenActions.shift();if(o(!0)+s.size>e){this.hiddenActions.unshift(s);break}this.actionBar.push(s.action,{icon:this.options.icon??!0,label:this.options.label??!1,keybinding:this.getKeybindingLabel(s.action),index:this.originalPrimaryActions.length-this.hiddenActions.length-1}),this.originalSecondaryActions.length===0&&this.hiddenActions.length===0&&(this.toggleMenuAction.menuActions=[],this.actionBar.pull(this.actionBar.length()-1),this.updateOverflowClassName()),this.applyResponsiveActionMinWidths()}let r=this.hiddenActions.map(s=>s.action);if(this.originalSecondaryActions.length>0||r.length>0){let s=this.originalSecondaryActions.slice(0);this.toggleMenuAction.menuActions=ri.join(r,s)}this.updateOverflowClassName(),this.applyResponsiveActionMinWidths()}updateOverflowClassName(){this.actionBar.domNode.classList.toggle("has-overflow",this.actionBar.hasAction(this.toggleMenuAction))}clear(){this.submenuActionViewItems=[],this.disposables.clear(),this.actionBar.clear()}dispose(){this.clear(),this.disposables.dispose(),this.element.remove(),super.dispose()}},oce=class a extends it{static{this.ID="toolbar.toggle.more"}constructor(i,e){e=e||d(32,null),super(a.ID,e,void 0,!0),this._menuActions=[],this.toggleDropdownMenu=i}async run(){this.toggleDropdownMenu()}get menuActions(){return this._menuActions}set menuActions(i){this._menuActions=i}};var HCe=class{constructor(i,e,t=e){this.modifierLabels=[null],this.modifierLabels[2]=i,this.modifierLabels[1]=e,this.modifierLabels[3]=t}toLabel(i,e,t){if(e.length===0)return null;let o=[];for(let n=0,r=e.length;n<r;n++){let s=e[n],l=t(s);if(l===null)return null;o[n]=p1o(s,l,this.modifierLabels[i])}return o.join(" ")}},cR=new HCe({ctrlKey:"\u2303",shiftKey:"\u21E7",altKey:"\u2325",metaKey:"\u2318",separator:""},{ctrlKey:d(129,null),shiftKey:d(132,null),altKey:d(126,null),metaKey:d(136,null),separator:"+"},{ctrlKey:d(129,null),shiftKey:d(132,null),altKey:d(126,null),metaKey:d(134,null),separator:"+"}),swt=new HCe({ctrlKey:d(130,null),shiftKey:d(133,null),altKey:d(131,null),metaKey:d(128,null),separator:"+"},{ctrlKey:d(130,null),shiftKey:d(133,null),altKey:d(127,null),metaKey:d(137,null),separator:"+"},{ctrlKey:d(130,null),shiftKey:d(133,null),altKey:d(127,null),metaKey:d(135,null),separator:"+"}),N6i=new HCe({ctrlKey:"Ctrl",shiftKey:"Shift",altKey:"Alt",metaKey:"Cmd",separator:"+"},{ctrlKey:"Ctrl",shiftKey:"Shift",altKey:"Alt",metaKey:"Super",separator:"+"}),UCe=new HCe({ctrlKey:"ctrl",shiftKey:"shift",altKey:"alt",metaKey:"cmd",separator:"+"},{ctrlKey:"ctrl",shiftKey:"shift",altKey:"alt",metaKey:"win",separator:"+"},{ctrlKey:"ctrl",shiftKey:"shift",altKey:"alt",metaKey:"meta",separator:"+"});function p1o(a,i,e){if(i===null)return"";let t=[];return a.ctrlKey&&t.push(e.ctrlKey),a.shiftKey&&t.push(e.shiftKey),a.altKey&&t.push(e.altKey),a.metaKey&&t.push(e.metaKey),i!==""&&t.push(i),t.join(e.separator)}function Qj(a){return!!a&&typeof a=="object"&&typeof a.original=="string"&&typeof a.value=="string"}function zCe(a){return a?a.condition!==void 0:!1}function zri(a){let i=[];typeof a=="number"&&i.push("code/timeOrigin",a);function e(n,r){i.push(n,r?.startTime??Date.now())}function t(){let n=[];for(let r=0;r<i.length;r+=2)n.push({name:i[r],startTime:i[r+1]});return n}function o(n){for(let r=i.length-2;r>=0;r-=2)typeof i[r]=="string"&&i[r].startsWith(n)&&i.splice(r,2)}return{mark:e,getMarks:t,clearMarks:o}}function m1o(){if(typeof performance=="object"&&typeof performance.mark=="function"&&!performance.nodeTiming)return typeof performance.timeOrigin!="number"&&!performance.timing?zri():{mark(a,i){performance.mark(a,i)},clearMarks(a){let i=new Set;for(let e of performance.getEntriesByType("mark"))e.name.startsWith(a)&&i.add(e.name);for(let e of i)performance.clearMarks(e)},getMarks(){let a=performance.timeOrigin;typeof a!="number"&&(a=(performance.timing.navigationStart||performance.timing.redirectStart||performance.timing.fetchStart)??0);let i=[{name:"code/timeOrigin",startTime:Math.round(a)}];for(let e of performance.getEntriesByType("mark"))i.push({name:e.name,startTime:Math.round(a+e.startTime)});return i}};if(typeof process=="object"){let a=performance?.timeOrigin;return zri(a)}else return console.trace("perf-util loaded in UNKNOWN environment"),zri()}function h1o(a){return a.MonacoPerformanceMarks||(a.MonacoPerformanceMarks=m1o()),a.MonacoPerformanceMarks}var Kri=h1o(globalThis),Mo=Kri.mark,O6i=Kri.clearMarks,F6i=Kri.getMarks;var KO=class a extends x{constructor(e,t=Object.create(null)){super();this.database=e;this.options=t;this._onDidChangeStorage=this._register(new Gm);this.onDidChangeStorage=this._onDidChangeStorage.event;this.state=0;this.cache=new Map;this.flushDelayer=this._register(new ya(a.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((t,o)=>this.acceptExternal(o,t)),e.deleted?.forEach(t=>this.acceptExternal(t,void 0))}finally{this._onDidChangeStorage.resume()}}acceptExternal(e,t){if(this.state===2)return;let o=!1;nr(t)?o=this.cache.delete(e):this.cache.get(e)!==t&&(this.cache.set(e,t),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,t){let o=this.cache.get(e);return nr(o)?t:o}getBoolean(e,t){let o=this.get(e);return nr(o)?t:o==="true"}getNumber(e,t){let o=this.get(e);return nr(o)?t:parseInt(o,10)}getObject(e,t){let o=this.get(e);return nr(o)?t:am(o)}async set(e,t,o=!1){if(this.state===2)return;if(nr(t))return this.delete(e,o);let n=xi(t)||Array.isArray(t)?swe(t):String(t);if(this.cache.get(e)!==n)return this.cache.set(e,n),this.pendingInserts.set(e,n),this.pendingDeletes.delete(e),this._onDidChangeStorage.fire({key:e,external:o}),this.doFlush()}async delete(e,t=!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:t}),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}},GCe=class{constructor(){this.onDidChangeItemsExternal=U.None;this.items=new Map}async getItems(){return this.items}async updateItems(i){i.insert?.forEach((e,t)=>this.items.set(t,e)),i.delete?.forEach(e=>this.items.delete(e))}async optimize(){}async close(){}};var Eo=le("environmentService"),oy=Eo;var Pe=le("contextService");function Zh(a){let i=a;return typeof i?.id=="string"&&A.isUri(i.uri)}function Yj(a){return typeof a?.id=="string"&&!Zh(a)&&!ny(a)}var g1o={id:"ext-dev"},qCe={id:"empty-window"};function Dg(a,i){if(typeof a=="string"||typeof a>"u")return typeof a=="string"?{id:jo(a)}:i?g1o:qCe;let e=a;return e.configuration?{id:e.id,configPath:e.configuration}:e.folders.length===1?{id:e.id,uri:e.folders[0].uri}:{id:e.id}}function ny(a){let i=a;return typeof i?.id=="string"&&A.isUri(i.configPath)}function W6i(a){let i=a;if(i?.uri)return{id:i.id,uri:A.revive(i.uri)};let e=a;if(e?.configPath)return{id:e.id,configPath:A.revive(e.configPath)};if(a?.id)return{id:a.id}}function Xj(a){let i=a;return!!(i&&typeof i=="object"&&typeof i.id=="string"&&Array.isArray(i.folders))}function hw(a){let i=a;return!!(i&&typeof i=="object"&&A.isUri(i.uri)&&typeof i.name=="string"&&typeof i.toResource=="function")}var awt=class{constructor(i,e,t,o,n){this._id=i;this._transient=t;this._configuration=o;this.ignorePathCasing=n;this.foldersMap=Sp.forUris(this.ignorePathCasing,()=>!0),this.folders=e}get folders(){return this._folders}set folders(i){this._folders=i,this.updateFoldersMap()}update(i){this._id=i.id,this._configuration=i.configuration,this._transient=i.transient,this.ignorePathCasing=i.ignorePathCasing,this.folders=i.folders}get id(){return this._id}get transient(){return this._transient}get configuration(){return this._configuration}set configuration(i){this._configuration=i}getFolder(i){return i&&this.foldersMap.findSubstr(i)||null}updateFoldersMap(){this.foldersMap=Sp.forUris(this.ignorePathCasing,()=>!0);for(let i of this.folders)this.foldersMap.set(i.uri,i)}toJSON(){return{id:this.id,folders:this.folders,transient:this.transient,configuration:this.configuration}}},nce=class{constructor(i,e){this.raw=e;this.uri=i.uri,this.index=i.index,this.name=i.name}toResource(i){return Ge(this.uri,i)}toJSON(){return{uri:this.uri,name:this.name,index:this.index}}};function wY(a){return new nce({uri:a,index:0,name:Ga(a)},{uri:a.toString()})}var FE="code-workspace",P4e=`.${FE}`,V6i=[{name:d(2801,null),extensions:[FE]}],B6i="workspace.json";function dR(a,i){return tae.isEqualOrParent(a,i.untitledWorkspacesHome)}function gw(a){let i;return A.isUri(a)?i=a:i=a.configuration,i?.scheme===Q.tmp}var f1o="4064f6ec-cb38-4ad0-af64-ee6467e63c82";function H6i(a){return a.id===f1o}function rce(a,i){return!dR(a,i)&&!gw(a)}function GO(a){return(typeof a=="string"?qm(a):es(a))===P4e}var ht=le("IUriIdentityService");function qO(a){let i=a;return!!(i&&typeof i=="object"&&typeof i.id=="string"&&typeof i.isDefault=="boolean"&&typeof i.name=="string"&&A.isUri(i.location)&&A.isUri(i.globalStorageHome)&&A.isUri(i.settingsResource)&&A.isUri(i.keybindingsResource)&&A.isUri(i.tasksResource)&&A.isUri(i.snippetsHome)&&A.isUri(i.promptsHome)&&A.isUri(i.extensionsResource)&&A.isUri(i.mcpResource))}var an=le("IUserDataProfilesService");function fw(a,i){return{id:a.id,isDefault:a.isDefault,name:a.name,icon:a.icon,location:A.revive(a.location).with({scheme:i}),globalStorageHome:A.revive(a.globalStorageHome).with({scheme:i}),settingsResource:A.revive(a.settingsResource).with({scheme:i}),keybindingsResource:A.revive(a.keybindingsResource).with({scheme:i}),tasksResource:A.revive(a.tasksResource).with({scheme:i}),snippetsHome:A.revive(a.snippetsHome).with({scheme:i}),promptsHome:A.revive(a.promptsHome).with({scheme:i}),extensionsResource:A.revive(a.extensionsResource).with({scheme:i}),mcpResource:A.revive(a.mcpResource).with({scheme:i}),cacheHome:A.revive(a.cacheHome).with({scheme:i}),useDefaultFlags:a.useDefaultFlags,isTransient:a.isTransient,workspaces:a.workspaces?.map(e=>A.revive(e))}}function sce(a,i,e,t,o,n){return{id:a,name:i,location:e,isDefault:!1,icon:o?.icon,globalStorageHome:n&&o?.useDefaultFlags?.globalState?n.globalStorageHome:Ge(e,"globalStorage"),settingsResource:n&&o?.useDefaultFlags?.settings?n.settingsResource:Ge(e,"settings.json"),keybindingsResource:n&&o?.useDefaultFlags?.keybindings?n.keybindingsResource:Ge(e,"keybindings.json"),tasksResource:n&&o?.useDefaultFlags?.tasks?n.tasksResource:Ge(e,"tasks.json"),snippetsHome:n&&o?.useDefaultFlags?.snippets?n.snippetsHome:Ge(e,"snippets"),promptsHome:n&&o?.useDefaultFlags?.prompts?n.promptsHome:Ge(e,"prompts"),extensionsResource:n&&o?.useDefaultFlags?.extensions?n.extensionsResource:Ge(e,"extensions.json"),mcpResource:n&&o?.useDefaultFlags?.mcp?n.mcpResource:Ge(e,"mcp.json"),cacheHome:Ge(t,a),useDefaultFlags:o?.useDefaultFlags,isTransient:o?.transient,workspaces:o?.workspaces}}var lwt=class extends x{constructor(e,t,o,n){super();this.environmentService=e;this.fileService=t;this.uriIdentityService=o;this.logService=n;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=Ge(this.environmentService.userRoamingDataHome,"profiles"),this.profilesCacheHome=Ge(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(),t=[e];try{for(let n of this.getStoredProfiles()){if(this.isInvalidProfile(n)){this.logService.warn("Skipping the invalid stored profile",n.location||n.name);continue}let r=He(n.location);t.push(sce(r,n.name,n.location,this.profilesCacheHome,{icon:n.icon,useDefaultFlags:n.useDefaultFlags},e))}}catch(n){this.logService.error(n)}let o=new Map;if(t.length)try{let n=this.getStoredProfileAssociations();if(n.workspaces)for(let[r,s]of Object.entries(n.workspaces)){let l=A.parse(r),c=t.find(u=>u.id===s);if(c){let u=c.workspaces?c.workspaces.slice(0):[];u.push(l),c.workspaces=u}}if(n.emptyWindows)for(let[r,s]of Object.entries(n.emptyWindows)){let l=t.find(c=>c.id===s);l&&o.set(r,l)}}catch(n){this.logService.error(n)}this._profilesObject={profiles:t,emptyWindows:o}}return this._profilesObject}isInvalidProfile(e){return!!(!e.name||!Fe(e.name)||!e.location||e.isSystem||this.uriIdentityService.extUri.basename(this.uriIdentityService.extUri.dirname(e.location))==="builtin")}createDefaultProfile(){let e=sce("__default__profile__",d(2760,null),this.environmentService.userRoamingDataHome,this.profilesCacheHome);return{...e,extensionsResource:this.getDefaultProfileExtensionsLocation()??e.extensionsResource,isDefault:!0}}async createTransientProfile(e){let t="Temp",o=new RegExp(`${ns(t)}\\s(\\d+)`),n=0;for(let s of this.profiles){let l=o.exec(s.name),c=l?parseInt(l[1]):0;n=c>n?c:n}let r=`${t} ${n+1}`;return this.createProfile(_r(xt()).toString(16),r,{transient:!0},e)}async createNamedProfile(e,t,o){return this.createProfile(_r(xt()).toString(16),e,t,o)}async createProfile(e,t,o,n){return await this.doCreateProfile(e,t,o,n)}async doCreateProfile(e,t,o,n){if(!Fe(t)||!t)throw new Error("Name of the profile is mandatory and must be of type `string`");let r=this.profileCreationPromises.get(t);return r||(r=(async()=>{try{if(this.profiles.find(p=>p.id===e||!p.isTransient&&!o?.transient&&p.name===t))throw new Error(`Profile with ${t} name already exists`);let l=n?this.getWorkspace(n):void 0;A.isUri(l)&&(o={...o,workspaces:[l]});let c=sce(e,t,this.uriIdentityService.extUri.joinPath(this.profilesHome,e),this.profilesCacheHome,o,this.defaultProfile);await this.fileService.createFolder(c.location);let u=[];return this._onWillCreateProfile.fire({profile:c,join(p){u.push(p)}}),await dn.settled(u),l&&!A.isUri(l)&&this.updateEmptyWindowAssociation(l,c,!!c.isTransient),this.updateProfiles([c],[],[]),c}finally{this.profileCreationPromises.delete(t)}})(),this.profileCreationPromises.set(t,r)),r}async updateProfile(e,t){let o=[];for(let r of this.profiles){let s;if(e.id===r.id)r.isDefault?t.workspaces&&(s=r,s.workspaces=t.workspaces):s=sce(r.id,t.name??r.name,r.location,this.profilesCacheHome,{icon:t.icon===null?void 0:t.icon??r.icon,transient:t.transient??r.isTransient,useDefaultFlags:t.useDefaultFlags??r.useDefaultFlags,workspaces:t.workspaces??r.workspaces},this.defaultProfile);else if(t.workspaces){let l=r.workspaces?.filter(c=>!t.workspaces?.some(u=>this.uriIdentityService.extUri.isEqual(c,u)));r.workspaces?.length!==l?.length&&(s=r,s.workspaces=l)}s&&o.push(s)}if(!o.length)throw e.isDefault?new Error("Cannot update default profile"):new Error(`Profile '${e.name}' does not exist`);this.updateProfiles([],[],o);let n=this.profiles.find(r=>r.id===e.id);if(!n)throw new Error(`Profile '${e.name}' was not updated`);return n}async removeProfile(e){if(e.isDefault)throw new Error("Cannot remove default profile");let t=this.profiles.find(n=>n.id===e.id);if(!t)throw new Error(`Profile '${e.name}' does not exist`);let o=[];this._onWillRemoveProfile.fire({profile:t,join(n){o.push(n)}});try{await Promise.allSettled(o)}catch(n){this.logService.error(n)}this.updateProfiles([],[t],[]);try{await this.fileService.del(t.cacheHome,{recursive:!0})}catch(n){Au(n)!==1&&this.logService.error(n)}}async setProfileForWorkspace(e,t){let o=this.profiles.find(r=>r.id===t.id);if(!o)throw new Error(`Profile '${t.name}' does not exist`);let n=this.getWorkspace(e);if(A.isUri(n)){let r=o.workspaces?[...o.workspaces]:[];r.some(s=>this.uriIdentityService.extUri.isEqual(s,n))||(r.push(n),await this.updateProfile(o,{workspaces:r}))}else this.updateEmptyWindowAssociation(n,o,!1),this.updateStoredProfiles(this.profiles)}unsetWorkspace(e,t=!1){let o=this.getWorkspace(e);if(A.isUri(o)){let n=this.getProfileForWorkspace(e);n&&this.updateProfile(n,{workspaces:n.workspaces?.filter(r=>!this.uriIdentityService.extUri.isEqual(r,o))})}else this.updateEmptyWindowAssociation(o,void 0,t),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 t=await this.fileService.resolve(this.profilesHome);await Promise.all((t.children||[]).filter(o=>o.isDirectory&&this.profiles.every(n=>!this.uriIdentityService.extUri.isEqual(n.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(),t=[];for(let o of this.getStoredProfiles())this.isInvalidProfile(o)?this.logService.warn(`Invalid user data profile found: ${o.name}`):t.push(o);e.length!==t.length&&this.saveStoredProfiles(t)}catch(e){this.logService.error("Error removing invalid stored profiles",e)}}async cleanUpTransientProfiles(){let e=this.transientProfilesObject.profiles.filter(t=>!this.isProfileAssociatedToWorkspace(t));await Promise.allSettled(e.map(t=>this.removeProfile(t)))}getProfileForWorkspace(e){let t=this.getWorkspace(e);return A.isUri(t)?this.profiles.find(o=>o.workspaces?.some(n=>this.uriIdentityService.extUri.isEqual(n,t))):this.profilesObject.emptyWindows.get(t)??this.transientProfilesObject.emptyWindows.get(t)}getWorkspace(e){return Zh(e)?e.uri:ny(e)?e.configPath:e.id}isProfileAssociatedToWorkspace(e){return!!(e.workspaces?.length||[...this.profilesObject.emptyWindows.values()].some(t=>this.uriIdentityService.extUri.isEqual(t.location,e.location))||[...this.transientProfilesObject.emptyWindows.values()].some(t=>this.uriIdentityService.extUri.isEqual(t.location,e.location)))}updateProfiles(e,t,o,n=!1){let r=[...this.profiles,...e],s=this.transientProfilesObject.profiles;this.transientProfilesObject.profiles=[];let l=[];for(let c of r){if(t.some(u=>c.id===u.id)){for(let u of[...this.profilesObject.emptyWindows.keys()])c.id===this.profilesObject.emptyWindows.get(u)?.id&&this.profilesObject.emptyWindows.delete(u);continue}if(!c.isDefault){c=o.find(p=>c.id===p.id)??c;let u=s.find(p=>c.id===p.id);if(c.isTransient)this.transientProfilesObject.profiles.push(c);else if(u){for(let[p,h]of this.transientProfilesObject.emptyWindows.entries())if(c.id===h.id){this.transientProfilesObject.emptyWindows.delete(p),this.profilesObject.emptyWindows.set(p,c);break}}}c.workspaces?.length===0&&(c.workspaces=void 0),l.push(c)}this.updateStoredProfiles(l),n||this.triggerProfilesChanges(e,t,o)}triggerProfilesChanges(e,t,o){this._onDidChangeProfiles.fire({added:e,removed:t,updated:o,all:this.profiles})}updateEmptyWindowAssociation(e,t,o){o=t?.isTransient?!0:o,o?t?this.transientProfilesObject.emptyWindows.set(e,t):this.transientProfilesObject.emptyWindows.delete(e):(this.transientProfilesObject.emptyWindows.delete(e),t?this.profilesObject.emptyWindows.set(e,t):this.profilesObject.emptyWindows.delete(e))}updateStoredProfiles(e){let t=[],o={},n={};for(let r of e)if(!r.isTransient&&(r.isDefault||t.push({location:r.location,name:r.name,icon:r.icon,useDefaultFlags:r.useDefaultFlags}),r.workspaces))for(let s of r.workspaces)o[s.toString()]=r.id;for(let[r,s]of this.profilesObject.emptyWindows.entries())n[r.toString()]=s.id;this.saveStoredProfileAssociations({workspaces:o,emptyWindows:n}),this.saveStoredProfiles(t),this._profilesObject=void 0}getStoredProfiles(){return[]}saveStoredProfiles(e){throw new Error("not implemented")}getStoredProfileAssociations(){return{}}saveStoredProfileAssociations(e){throw new Error("not implemented")}getDefaultProfileExtensionsLocation(){}};lwt=I([m(0,Eo),m(1,fe),m(2,ht),m(3,se)],lwt);var Gri="__$__isNewStorageMarker",cwt="__$__targetStorageMarker",ce=le("storageService");function v1o(a){let i=a.get(cwt);if(i)try{return JSON.parse(i)}catch{}return Object.create(null)}var ace=class a extends x{constructor(e={flushInterval:a.DEFAULT_FLUSH_INTERVAL}){super();this._onDidChangeValue=this._register(new Gm);this._onDidChangeTarget=this._register(new Gm);this.onDidChangeTarget=this._onDidChangeTarget.event;this._onWillSaveState=this._register(new E);this.onWillSaveState=this._onWillSaveState.event;this.runFlushWhenIdle=this._register(new me);this._workspaceKeyTargets=void 0;this._profileKeyTargets=void 0;this._applicationKeyTargets=void 0;this.flushWhenIdleScheduler=this._register(new Dt(()=>this.doFlushWhenIdle(),e.flushInterval))}static{this.DEFAULT_FLUSH_INTERVAL=60*1e3}onDidChangeValue(e,t,o){return U.filter(this._onDidChangeValue.event,n=>n.scope===e&&(t===void 0||n.key===t),o)}doFlushWhenIdle(){this.runFlushWhenIdle.value=PL(()=>{this.shouldFlushWhenIdle()&&this.flush(),this.flushWhenIdleScheduler.schedule()})}shouldFlushWhenIdle(){return!0}stopFlushWhenIdle(){Be([this.runFlushWhenIdle,this.flushWhenIdleScheduler])}initialize(){return this.initializationPromise||(this.initializationPromise=(async()=>{Mo("code/willInitStorage");try{await this.doInitialize()}finally{Mo("code/didInitStorage")}this.flushWhenIdleScheduler.schedule()})()),this.initializationPromise}emitDidChangeValue(e,t){let{key:o,external:n}=t;if(o===cwt){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:n})}emitWillSaveState(e){this._onWillSaveState.fire({reason:e})}get(e,t,o){return this.getStorage(t)?.get(e,o)}getBoolean(e,t,o){return this.getStorage(t)?.getBoolean(e,o)}getNumber(e,t,o){return this.getStorage(t)?.getNumber(e,o)}getObject(e,t,o){return this.getStorage(t)?.getObject(e,o)}storeAll(e,t){this.withPausedEmitters(()=>{for(let o of e)this.store(o.key,o.value,o.scope,o.target,t)})}store(e,t,o,n,r=!1){if(nr(t)){this.remove(e,o,r);return}this.withPausedEmitters(()=>{this.updateKeyTarget(e,o,n),this.getStorage(o)?.set(e,t,r)})}remove(e,t,o=!1){this.withPausedEmitters(()=>{this.updateKeyTarget(e,t,void 0),this.getStorage(t)?.delete(e,o)})}withPausedEmitters(e){this._onDidChangeValue.pause(),this._onDidChangeTarget.pause();try{e()}finally{this._onDidChangeValue.resume(),this._onDidChangeTarget.resume()}}keys(e,t){let o=[],n=this.getKeyTargets(e);for(let r of Object.keys(n))n[r]===t&&o.push(r);return o}updateKeyTarget(e,t,o,n=!1){let r=this.getKeyTargets(t);typeof o=="number"?r[e]!==o&&(r[e]=o,this.getStorage(t)?.set(cwt,JSON.stringify(r),n)):typeof r[e]=="number"&&(delete r[e],this.getStorage(t)?.set(cwt,JSON.stringify(r),n))}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 t=this.getStorage(e);return t?v1o(t):Object.create(null)}isNew(e){return this.getBoolean(Gri,e)===!0}async flush(e=0){this._onWillSaveState.fire({reason:e});let t=this.getStorage(-1),o=this.getStorage(0),n=this.getStorage(1);switch(e){case 0:await dn.settled([t?.whenFlushed()??Promise.resolve(),o?.whenFlushed()??Promise.resolve(),n?.whenFlushed()??Promise.resolve()]);break;case 1:await dn.settled([t?.flush(0)??Promise.resolve(),o?.flush(0)??Promise.resolve(),n?.flush(0)??Promise.resolve()]);break}}async log(){let e=this.getStorage(-1)?.items??new Map,t=this.getStorage(0)?.items??new Map,o=this.getStorage(1)?.items??new Map;return b1o(e,t,o,this.getLogDetails(-1)??"",this.getLogDetails(0)??"",this.getLogDetails(1)??"")}async optimize(e){return await this.flush(),this.getStorage(e)?.optimize()}async switch(e,t){return this.emitWillSaveState(0),qO(e)?this.switchToProfile(e,t):this.switchToWorkspace(e,t)}canSwitchProfile(e,t){return!(e.id===t.id||$Ce(t)&&$Ce(e))}switchData(e,t,o){this.withPausedEmitters(()=>{let n=new Set;for(let[r,s]of e)n.add(r),t.get(r)!==s&&this.emitDidChangeValue(o,{key:r,external:!0});for(let[r]of t.items)n.has(r)||this.emitDidChangeValue(o,{key:r,external:!0})})}};function $Ce(a){return a.isDefault||!!a.useDefaultFlags?.globalState}var dwt=class extends ace{constructor(){super();this.applicationStorage=this._register(new KO(new GCe,{hint:1}));this.profileStorage=this._register(new KO(new GCe,{hint:1}));this.workspaceStorage=this._register(new KO(new GCe,{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 b1o(a,i,e,t,o,n){let r=v=>{try{return JSON.parse(v)}catch{return v}},s=new Map,l=new Map;a.forEach((v,b)=>{s.set(b,v),l.set(b,r(v))});let c=new Map,u=new Map;i.forEach((v,b)=>{c.set(b,v),u.set(b,r(v))});let p=new Map,h=new Map;e.forEach((v,b)=>{p.set(b,v),h.set(b,r(v))}),console.group(t!==o?`Storage: Application (path: ${t})`:`Storage: Application & Profile (path: ${t}, default profile)`);let g=[];if(s.forEach((v,b)=>{g.push({key:b,value:v})}),console.table(g),console.groupEnd(),console.log(l),t!==o){console.group(`Storage: Profile (path: ${o}, profile specific)`);let v=[];c.forEach((b,S)=>{v.push({key:S,value:b})}),console.table(v),console.groupEnd(),console.log(u)}console.group(`Storage: Workspace (path: ${n})`);let f=[];p.forEach((v,b)=>{f.push({key:b,value:v})}),console.table(f),console.groupEnd(),console.log(h)}function uwt(a,i){let e={...i};for(let t in a){let o=a[t];e[t]=o!==void 0?kt(o):void 0}return e}var Jx={keybindingLabelBackground:kt(w4i),keybindingLabelForeground:kt(C4i),keybindingLabelBorder:kt(x4i),keybindingLabelBottomBorder:kt(k4i),keybindingLabelShadow:kt(kO)};var Qo={buttonForeground:kt(__),buttonSeparator:kt($vt),buttonBackground:kt(xC),buttonHoverBackground:kt(uj),buttonSecondaryForeground:kt(ple),buttonSecondaryBackground:kt(pj),buttonSecondaryHoverBackground:kt(mle),buttonSecondaryBorder:kt(Uye),buttonBorder:kt(Uye)};var vw={progressBarBackground:kt(h5i)};var gh={inputActiveOptionBorder:kt(MV),inputActiveOptionForeground:kt(dj),inputActiveOptionBackground:kt(PV)},zDr={activeForeground:kt(Bye),activeBackground:kt(h4i),activeBorder:kt(g4i),inactiveForeground:kt(f4i),inactiveBackground:kt(v4i),inactiveBorder:kt(b4i),inactiveHoverBackground:kt(S4i)};function U6i(a){return uwt(a,gh)}var qf={checkboxBackground:kt(zye),checkboxBorder:kt(jvt),checkboxForeground:kt(Kye),checkboxDisabledBackground:kt(I4i),checkboxDisabledForeground:kt(y4i)},z6i={dialogBackground:kt(Su),dialogForeground:kt(jL),dialogShadow:kt(kO),dialogBorder:kt(E_),errorIconForeground:kt(V5i),warningIconForeground:kt(B5i),infoIconForeground:kt(H5i),textLinkForeground:kt(nS)};var Cl={inputBackground:kt(yv),inputForeground:kt(QL),inputBorder:kt(nw),inputValidationInfoBorder:kt(qje),inputValidationInfoBackground:kt(c4i),inputValidationInfoForeground:kt(d4i),inputValidationWarningBorder:kt($je),inputValidationWarningBackground:kt(u4i),inputValidationWarningForeground:kt(p4i),inputValidationErrorBorder:kt(dle),inputValidationErrorBackground:kt(Gvt),inputValidationErrorForeground:kt(qvt)};function H_(a){return uwt(a,Cl)}var K6i={listFilterWidgetBackground:kt(e4i),listFilterWidgetOutline:kt(t4i),listFilterWidgetNoMatchesOutline:kt(i4i),listFilterWidgetShadow:kt(o4i),inputBoxStyles:Cl,toggleStyles:gh},iI={badgeBackground:kt(bv),badgeForeground:kt(CC),badgeBorder:kt(bi)};var Tz={breadcrumbsBackground:kt(O5i),breadcrumbsForeground:kt(N5i),breadcrumbsHoverForeground:kt(kti),breadcrumbsFocusForeground:kt(kti),breadcrumbsFocusAndSelectionForeground:kt(F5i)};var CY={listBackground:void 0,listInactiveFocusForeground:void 0,listFocusBackground:kt(R7),listFocusForeground:kt(Fye),listFocusOutline:kt(Kje),listActiveSelectionBackground:kt(ow),listActiveSelectionForeground:kt(T_),listActiveSelectionIconForeground:kt(Bvt),listFocusAndSelectionOutline:kt(j5i),listFocusAndSelectionBackground:kt(ow),listFocusAndSelectionForeground:kt(T_),listInactiveSelectionBackground:kt(Kf),listInactiveSelectionIconForeground:kt(Q5i),listInactiveSelectionForeground:kt(Hvt),listInactiveFocusBackground:kt(Uvt),listInactiveFocusOutline:kt(Y5i),listHoverBackground:kt(yE),listHoverForeground:kt(Wye),listDropOverBackground:kt(zvt),listDropBetweenBackground:kt(X5i),listSelectionOutline:kt(Ys),listHoverOutline:kt(Ys),treeIndentGuidesStroke:kt(Vye),treeInactiveIndentGuidesStroke:kt(s4i),treeStickyScrollBackground:void 0,treeStickyScrollBorder:void 0,treeStickyScrollShadow:kt(U1),tableColumnsBorder:kt(a4i),tableOddRowsBackgroundColor:kt(Gje)};function uS(a){return uwt(a,CY)}var WE={selectBackground:kt($1),selectListBackground:kt(m4i),selectForeground:kt(ule),decoratorRightForeground:kt(Yvt),selectBorder:kt(TO),focusBorder:kt(Sd),listFocusBackground:kt(Q1),listInactiveSelectionIconForeground:kt(qye),listFocusForeground:kt(j1),listFocusOutline:tle(Ys,We.transparent.toString()),listHoverBackground:kt(yE),listHoverForeground:kt(Wye),listHoverOutline:kt(Ys),selectListBorder:kt(CO),listBackground:void 0,listActiveSelectionBackground:void 0,listActiveSelectionForeground:void 0,listActiveSelectionIconForeground:void 0,listFocusAndSelectionBackground:void 0,listDropOverBackground:void 0,listDropBetweenBackground:void 0,listInactiveSelectionBackground:void 0,listInactiveSelectionForeground:void 0,listInactiveFocusBackground:void 0,listInactiveFocusOutline:void 0,listSelectionOutline:void 0,listFocusAndSelectionForeground:void 0,listFocusAndSelectionOutline:void 0,listInactiveFocusForeground:void 0,tableColumnsBorder:void 0,tableOddRowsBackgroundColor:void 0,treeIndentGuidesStroke:void 0,treeInactiveIndentGuidesStroke:void 0,treeStickyScrollBackground:void 0,treeStickyScrollBorder:void 0,treeStickyScrollShadow:void 0};function pwt(a){return uwt(a,WE)}var mwt={shadowColor:kt(kO),borderColor:kt(E4i),foregroundColor:kt(T4i),backgroundColor:kt(_4i),selectionForegroundColor:kt(Wye),selectionBackgroundColor:kt(yE),selectionBorderColor:kt(D4i),separatorColor:kt(L4i),scrollbarShadow:kt(U1),scrollbarSliderBackground:kt(k7),scrollbarSliderHoverBackground:kt(z1),scrollbarSliderActiveBackground:kt(K1)};var G6i=["#007acc","#005a9e","#0098ff","#4fc3f7","#64b5f6","#42a5f5"],A4e;function hwt(a){if(A4e)return;let i=a.getBoundingClientRect(),e=Re(a).document,t=_(".animation-overlay");return t.style.position="fixed",t.style.left=`${i.left}px`,t.style.top=`${i.top}px`,t.style.width=`${i.width}px`,t.style.height=`${i.height}px`,t.style.pointerEvents="none",t.style.overflow="visible",t.style.zIndex="10000",e.body.appendChild(t),A4e=t,{overlay:t,cx:i.width/2,cy:i.height/2}}function gwt(a){setTimeout(()=>{A4e&&(A4e.remove(),A4e=void 0)},a)}function fwt(a,i){let e=[],t=Math.max(i.scale?.length??0,i.rotate?.length??0,i.translateY?.length??0);if(t!==0){for(let o=0;o<t;o++){let n={offset:t===1?1:o/(t-1)},r="",s=i.scale?.[o];s!==void 0&&(r+=`scale(${s})`);let l=i.rotate?.[o];l!==void 0&&(r+=` rotate(${l}deg)`);let c=i.translateY?.[o];c!==void 0&&(r+=` translateY(${c}px)`),r&&(n.transform=r.trim()),e.push(n)}a.animate(e,{duration:i.duration??350,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"forwards"})}}function S1o(a){let i=hwt(a);if(!i)return;let{overlay:e,cx:t,cy:o}=i,n=a.getBoundingClientRect();fwt(a,{scale:[1,1.3,1],rotate:[0,-10,10,0],duration:350});let r=10;for(let l=0;l<r;l++){let c=3+l%3*1.5,u=l*36*Math.PI/180,p=35,h=.6+l%4*.1,g=_(".animation-particle");g.style.position="absolute",g.style.width=`${c}px`,g.style.height=`${c}px`,g.style.borderRadius="50%",g.style.backgroundColor=G6i[l%G6i.length],g.style.left=`${t-c/2}px`,g.style.top=`${o-c/2}px`,e.appendChild(g);let f=Math.cos(u)*p,v=Math.sin(u)*p;g.animate([{opacity:0,transform:"scale(0) translate(0, 0)"},{opacity:h,transform:`scale(1) translate(${f*.5}px, ${v*.5}px)`,offset:.3},{opacity:h,transform:`scale(1) translate(${f}px, ${v}px)`,offset:.7},{opacity:0,transform:`scale(0) translate(${f}px, ${v}px)`}],{duration:1100,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"forwards"})}let s=_(".animation-particle");s.style.position="absolute",s.style.left="0",s.style.top="0",s.style.width=`${n.width}px`,s.style.height=`${n.height}px`,s.style.borderRadius="50%",s.style.border="2px solid var(--vscode-focusBorder, #007acc)",s.style.boxSizing="border-box",e.appendChild(s),s.animate([{transform:"scale(1)",opacity:1},{transform:"scale(2)",opacity:0}],{duration:800,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"forwards"}),gwt(2e3)}function I1o(a,i){let e=hwt(a);if(!e)return;let{overlay:t,cx:o,cy:n}=e,r=a.getBoundingClientRect();fwt(a,{translateY:[0,-6,0],duration:350});let s=6;for(let c=0;c<s;c++){let u=12+c%3*2,p=_(".animation-particle");p.style.position="absolute",p.style.left=`${o}px`,p.style.top=`${n}px`,p.style.fontSize=`${u}px`,p.style.lineHeight="1",p.style.color="var(--vscode-focusBorder, #007acc)",p.classList.add(...q.asClassNameArray(i)),t.appendChild(p);let h=(Math.random()-.5)*50,g=-50-c%3*10,f=(Math.random()-.5)*20,v=(Math.random()-.5)*40;p.animate([{opacity:0,transform:`translate(-50%, -50%) scale(0) rotate(${f}deg)`},{opacity:1,transform:`translate(calc(-50% + ${h*.3}px), calc(-50% + ${g*.3}px)) scale(1) rotate(${(f+v)*.3}deg)`,offset:.3},{opacity:1,transform:`translate(calc(-50% + ${h*.7}px), calc(-50% + ${g*.7}px)) scale(1) rotate(${(f+v)*.7}deg)`,offset:.7},{opacity:0,transform:`translate(calc(-50% + ${h}px), calc(-50% + ${g}px)) scale(0.8) rotate(${v}deg)`}],{duration:800+c%3*200,delay:c*80,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"forwards"})}let l=_(".animation-particle");l.style.position="absolute",l.style.left="0",l.style.top="0",l.style.width=`${r.width}px`,l.style.height=`${r.height}px`,l.style.borderRadius="50%",l.style.border="2px solid var(--vscode-focusBorder, #007acc)",l.style.boxSizing="border-box",t.appendChild(l),l.animate([{transform:"scale(1)",opacity:1},{transform:"scale(2)",opacity:0}],{duration:500,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"forwards"}),gwt(2e3)}function y1o(a){let i=hwt(a);if(!i)return;let{overlay:e,cx:t,cy:o}=i,n=a.getBoundingClientRect();fwt(a,{scale:[1,1.1,1],rotate:[0,-12,0],duration:400});for(let s=0;s<2;s++){let l=_(".animation-particle");l.style.position="absolute",l.style.left="0",l.style.top="0",l.style.width=`${n.width}px`,l.style.height=`${n.height}px`,l.style.borderRadius="50%",l.style.border="2px solid var(--vscode-focusBorder, #007acc)",l.style.boxSizing="border-box",e.appendChild(l),l.animate([{transform:"scale(0.8)",opacity:0},{transform:"scale(0.8)",opacity:.6,offset:.01},{transform:"scale(2.5)",opacity:0}],{duration:800,delay:s*150,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"forwards"})}for(let s=0;s<6;s++){let l=s*60*Math.PI/180,c=30+s%2*10,u=3.5,p=_(".animation-particle");p.style.position="absolute",p.style.width=`${u}px`,p.style.height=`${u}px`,p.style.borderRadius="50%",p.style.backgroundColor="#0098ff",p.style.left=`${t-u/2}px`,p.style.top=`${o-u/2}px`,e.appendChild(p);let h=Math.cos(l)*c,g=Math.sin(l)*c;p.animate([{opacity:0,transform:"scale(0) translate(0, 0)"},{opacity:1,transform:`scale(1) translate(${h}px, ${g}px)`,offset:.5},{opacity:0,transform:`scale(0) translate(${h}px, ${g}px)`}],{duration:600,delay:100+s*50,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"forwards"})}let r=_(".animation-particle");r.style.position="absolute",r.style.left="0",r.style.top="0",r.style.width=`${n.width}px`,r.style.height=`${n.height}px`,r.style.borderRadius="50%",r.style.backgroundColor="var(--vscode-focusBorder, #007acc)",e.appendChild(r),r.animate([{transform:"scale(0.9)",opacity:0},{transform:"scale(0.9)",opacity:.5,offset:.01},{transform:"scale(1.5)",opacity:0}],{duration:500,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"forwards"}),gwt(2e3)}function w1o(a){let i=hwt(a);if(!i)return;let{overlay:e,cx:t,cy:o}=i;fwt(a,{scale:[1,1.15,1],duration:350});for(let n=0;n<8;n++){let l=(n*45+22.5)*Math.PI/180,c=14,u=30,p=_(".animation-particle");p.style.position="absolute",p.style.width="3px",p.style.height="3px",p.style.borderRadius="50%",p.style.backgroundColor="var(--vscode-editor-foreground, #ffffff)",p.style.left=`${t-3/2}px`,p.style.top=`${o-3/2}px`,e.appendChild(p);let h=Math.cos(l)*c,g=Math.sin(l)*c,f=Math.cos(l)*u,v=Math.sin(l)*u;p.animate([{opacity:0,transform:`scale(0) translate(${h}px, ${g}px)`},{opacity:.7,transform:`scale(1.2) translate(${(h+f)/2}px, ${(g+v)/2}px)`,offset:.25},{opacity:.7,transform:`scale(1) translate(${f*.8}px, ${v*.8}px)`,offset:.5},{opacity:.7*.5,transform:`scale(1) translate(${f}px, ${v}px)`,offset:.75},{opacity:0,transform:`scale(0.5) translate(${f}px, ${v}px)`}],{duration:1100,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"forwards"})}for(let n=0;n<8;n++){let r=n*45,s=_(".animation-particle");s.style.position="absolute",s.style.left=`${t}px`,s.style.top=`${o}px`,s.style.width="0",s.style.height="0",s.style.transform=`rotate(${r}deg)`,e.appendChild(s);let l=_(".animation-particle");l.style.position="absolute",l.style.width="2px",l.style.height="10px",l.style.backgroundColor="var(--vscode-focusBorder, #007acc)",l.style.left="-1px",l.style.top="-22px",l.style.transformOrigin="bottom center",s.appendChild(l),l.animate([{transform:"scale(1, 0)",opacity:.6},{transform:"scale(1, 1)",opacity:.6,offset:.2},{transform:"scale(1, 1)",opacity:.6,offset:.6},{transform:"scale(1, 1)",opacity:.6,offset:.8},{transform:"scale(0, 0.3)",opacity:0}],{duration:1200,delay:150,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"forwards"})}gwt(2e3)}function q6i(a,i,e){switch(i){case 1:S1o(a);break;case 2:e&&I1o(a,e);break;case 3:y1o(a);break;case 4:w1o(a);break}}var jCe={WIDTH:400,WIDTH_WITH_VERTICAL_PANEL:600,HEIGHT:270};function $6i(a){return typeof a.parentId=="number"}function QCe(a){return!!a.workspaceUri}function j6i(a){return!!a.folderUri}function Q6i(a){return!!a.fileUri}function oI(a,i){if(Wt)return!1;let e=LC(a,i),t=a.getValue("window");return t?.menuStyle==="native"?!(!Ze&&!e):t?.menuStyle==="custom"?!1:e}function $O(a,i){return Wt?!1:Ze?!0:oI(a,i)}function uR(a){let i=a.getValue("window.menuBarVisibility");return i==="default"||i==="compact"&&$O(a)||Ze&&Vr?"classic":i}function jO(a,i){return!0}function LC(a,i){return i||(i=xY(a)),i==="native"}function xY(a){if(Wt)return"custom";let i=a.getValue("window");if(i){if(Ze&&i.nativeTabs===!0||Ze&&i.nativeFullScreen===!1)return"native";let o=i.titleBarStyle;if(o==="native"||o==="custom")return o}return"custom"}function N4e(a){if(Wt||Ze||xY(a)==="native")return"native";let e=a.getValue("window")?.controlsStyle;return e==="custom"||e==="hidden"?e:"native"}var kY=35;function YCe(a){if(Wt||LC(a))return!1;if(!Ze){let i=N4e(a);if(i==="custom"||i==="hidden")return!1}return!0}function lce(a=0){return 1.2**a}var qri={width:1200,height:800},$ri={width:1440,height:900},vwt={width:1024,height:768};function zp(a,i){let e={primary:[],secondary:[]};return Y6i(a,e,i),e}function tu(a,i){let e=[];return Y6i(a,e,i),e}function Y6i(a,i,e){let t=nb.getInstance(),o=t.keyStatus.altKey||(ei||fn)&&t.keyStatus.shiftKey;X6i(a,i,o,e?n=>n===e:n=>n==="navigation")}function ml(a,i,e,t){let o={primary:[],secondary:[]};return _z(a,o,i,e,t),o}function jm(a,i,e,t){let o=[];return _z(a,o,i,e,t),o}function _z(a,i,e,t,o){X6i(a,i,!1,typeof e=="string"?r=>r===e:e,t,o)}function X6i(a,i,e,t=r=>r==="navigation",o=()=>!1,n=!1){let r,s;Array.isArray(i)?(r=i,s=i):(r=i.primary,s=i.secondary);let l=new Set;for(let[c,u]of a){let p;t(c)?(p=r,p.length>0&&n&&p.push(new ri)):(p=s,p.length>0&&p.push(new ri));for(let h of u){e&&(h=h instanceof Lo&&h.alt?h.alt:h);let g=p.push(h);h instanceof Fs&&l.add({group:c,action:h,index:g-1})}}for(let{group:c,action:u,index:p}of l){let h=t(c)?r:s,g=u.actions;o(u,c,h.length)&&h.splice(p,1,...g)}}var xl=class extends hs{constructor(e,t,o,n,r,s,l,c){super(void 0,e,{icon:!!(e.class||e.item.icon),label:!e.class&&!e.item.icon,draggable:t?.draggable,keybinding:t?.keybinding,hoverDelegate:t?.hoverDelegate,keybindingNotRenderedWithLabel:t?.keybindingNotRenderedWithLabel});this._options=t;this._keybindingService=o;this._notificationService=n;this._contextKeyService=r;this._themeService=s;this._contextMenuService=l;this._accessibilityService=c;this._wantsAltCommand=!1;this._itemClassDispose=this._register(new me);this._altKey=nb.getInstance()}get _menuItemAction(){return this._action}get _commandAction(){return this._wantsAltCommand&&this._menuItemAction.alt||this._menuItemAction}async onClick(e){if(e.preventDefault(),e.stopPropagation(),this._options?.onClickAnimation&&this.element&&!this._accessibilityService.isMotionReduced()){let t=this._menuItemAction.item.icon;q6i(this.element,this._options.onClickAnimation,q.isThemeIcon(t)?t:void 0)}try{await this.actionRunner.run(this._commandAction,this._context)}catch(t){this._notificationService.error(t)}}render(e){if(super.render(e),e.classList.add("menu-entry"),this.options.icon&&this._updateItemClass(this._menuItemAction.item),this._menuItemAction.alt){let t=!1,o=()=>{let n=!!this._menuItemAction.alt?.enabled&&(!this._accessibilityService.isMotionReduced()||t)&&(this._altKey.keyStatus.altKey||this._altKey.keyStatus.shiftKey&&t);n!==this._wantsAltCommand&&(this._wantsAltCommand=n,this.updateLabel(),this.updateTooltip(),this.updateClass())};this._register(this._altKey.event(o)),this._register(j(e,"mouseleave",n=>{t=!1,o()})),this._register(j(e,"mouseenter",n=>{t=!0,o()})),o()}}updateLabel(){this.options.label&&this.label&&(this.label.textContent=this._commandAction.label)}getTooltip(){let e=this._commandAction.tooltip||this._commandAction.label,t=this._keybindingService.appendKeybinding(e,this._commandAction.id,this._contextKeyService);if(!this._wantsAltCommand&&this._menuItemAction.alt?.enabled){let o=this._menuItemAction.alt.tooltip||this._menuItemAction.alt.label,n=this._keybindingService.appendKeybinding(o,this._menuItemAction.alt.id,this._contextKeyService);t=d(1811,null,t,cR.modifierLabels[Po].altKey,n)}return t}updateClass(){this.options.icon&&(this._commandAction!==this._menuItemAction?this._menuItemAction.alt&&this._updateItemClass(this._menuItemAction.alt.item):this._updateItemClass(this._menuItemAction.item))}_updateItemClass(e){this._itemClassDispose.value=void 0;let{element:t,label:o}=this;if(!t||!o)return;let n=this._commandAction.checked&&zCe(e.toggled)&&e.toggled.icon?e.toggled.icon:e.icon;if(n)if(q.isThemeIcon(n)){let r=q.asClassNameArray(n);o.classList.add(...r),this._itemClassDispose.value=Z(()=>{o.classList.remove(...r)})}else o.style.backgroundImage=Bp(this._themeService.getColorTheme().type)?Qa(n.dark):Qa(n.light),o.classList.add("icon"),this._itemClassDispose.value=wn(Z(()=>{o.style.backgroundImage="",o.classList.remove("icon")}),this._themeService.onDidColorThemeChange(()=>{this.updateClass()}))}};xl=I([m(2,_e),m(3,Ne),m(4,X),m(5,Le),m(6,Xe),m(7,Oi)],xl);var bwt=class a extends xl{render(i){this.options.label=!0,this.options.icon=!1,super.render(i),i.classList.add("text-only"),i.classList.toggle("use-comma",this._options?.useComma??!1)}updateLabel(){let i=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService);if(!i)return super.updateLabel();if(this.label){let e=a._symbolPrintEnter(i);this._options?.conversational?this.label.textContent=d(1810,null,this._action.label,e):this.label.textContent=d(1809,null,this._action.label,e)}}static _symbolPrintEnter(i){return i.getLabel()?.replace(/\benter\b/gi,"\u23CE").replace(/\bEscape\b/gi,"Esc")}},VE=class extends Pm{constructor(e,t,o,n,r){let s={...t,menuAsChild:t?.menuAsChild??!1,classNames:t?.classNames??(q.isThemeIcon(e.item.icon)?q.asClassName(e.item.icon):void 0),keybindingProvider:t?.keybindingProvider??(l=>o.lookupKeybinding(l.id))};super(e,{getActions:()=>e.actions},n,s);this._keybindingService=o;this._contextMenuService=n;this._themeService=r}render(e){super.render(e),wo(this.element),e.classList.add("menu-entry");let t=this._action,{icon:o}=t.item;if(o&&!q.isThemeIcon(o)){this.element.classList.add("icon");let n=()=>{this.element&&(this.element.style.backgroundImage=Bp(this._themeService.getColorTheme().type)?Qa(o.dark):Qa(o.light))};n(),this._register(this._themeService.onDidColorThemeChange(()=>{n()}))}}};VE=I([m(2,_e),m(3,Xe),m(4,Le)],VE);var O4e=class extends wl{constructor(e,t,o,n,r,s,l,c){super(null,e);this._keybindingService=o;this._notificationService=n;this._contextMenuService=r;this._menuService=s;this._instaService=l;this._storageService=c;this._defaultActionDisposables=this._register(new N);this._container=null;this._primaryActionListener=this._register(new me);this._options=t,this._storageKey=`${e.item.submenu.id}_lastActionId`;let u,p=t?.togglePrimaryAction?c.get(this._storageKey,1):void 0;p&&(u=e.actions.find(g=>p===g.id)),u||(u=e.actions[0]),this._defaultAction=this._defaultActionDisposables.add(this._instaService.createInstance(xl,u,{keybinding:this._getDefaultActionKeybindingLabel(u)}));let h={keybindingProvider:g=>this._keybindingService.lookupKeybinding(g.id),...t,menuAsChild:t?.menuAsChild??!0,classNames:t?.classNames??["codicon","codicon-chevron-down"],actionRunner:t?.actionRunner??this._register(new rs)};this._dropdown=this._register(new Pm(e,e.actions,this._contextMenuService,h)),t?.togglePrimaryAction&&this.registerTogglePrimaryActionListener()}get onDidChangeDropdownVisibility(){return this._dropdown.onDidChangeVisibility}registerTogglePrimaryActionListener(){this._primaryActionListener.value=this._dropdown.actionRunner.onDidRun(e=>{e.action instanceof Lo&&this.update(e.action)})}update(e){this._options?.togglePrimaryAction&&this._storageService.store(this._storageKey,e.id,1,1),this._defaultActionDisposables.clear(),this._defaultAction=this._defaultActionDisposables.add(this._instaService.createInstance(xl,e,{keybinding:this._getDefaultActionKeybindingLabel(e)})),this._defaultAction.actionRunner=this._defaultActionDisposables.add(new class extends rs{async runAction(t,o){await t.run(void 0)}}),this._container&&this._defaultAction.render(KS(this._container,_(".action-container")))}_getDefaultActionKeybindingLabel(e){let t;if(this._options?.renderKeybindingWithDefaultActionLabel){let o=this._keybindingService.lookupKeybinding(e.id);o&&(t=`(${o.getLabel()})`)}return t}setActionContext(e){super.setActionContext(e),this._defaultAction.setActionContext(e),this._dropdown.setActionContext(e)}set actionRunner(e){super.actionRunner=e,this._defaultAction.actionRunner=e,this._options?.togglePrimaryAction||(this._dropdown.actionRunner=e),this._primaryActionListener.value&&this.registerTogglePrimaryActionListener()}get actionRunner(){return super.actionRunner}render(e){this._container=e,super.render(this._container),this._container.classList.add("monaco-dropdown-with-default");let t=_(".action-container");this._defaultAction.render(M(this._container,t)),this._register(j(t,re.KEY_DOWN,n=>{let r=new gi(n);r.equals(17)&&(this._defaultAction.element.tabIndex=-1,this._dropdown.focus(),r.stopPropagation())}));let o=_(".dropdown-action-container");this._dropdown.render(M(this._container,o)),this._register(j(o,re.KEY_DOWN,n=>{let r=new gi(n);r.equals(15)&&(this._defaultAction.element.tabIndex=0,this._dropdown.setFocusable(!1),this._defaultAction.element?.focus(),r.stopPropagation())}))}focus(e){e?this._dropdown.focus():(this._defaultAction.element.tabIndex=0,this._defaultAction.element.focus())}blur(){this._defaultAction.element.tabIndex=-1,this._dropdown.blur(),this._container.blur()}setFocusable(e){e?this._defaultAction.element.tabIndex=0:(this._defaultAction.element.tabIndex=-1,this._dropdown.setFocusable(!1))}};O4e=I([m(2,_e),m(3,Ne),m(4,Xe),m(5,Kt),m(6,F),m(7,ce)],O4e);var F4e=class extends kz{constructor(i,e,t){super(null,i,i.actions.map(o=>o.id===ri.ID?UO:{text:o.label,isDisabled:!o.enabled}),0,e,WE,{ariaLabel:i.tooltip||i.label,optionsAsChildren:!0,useCustomDrawn:!oI(t)}),this.select(Math.max(0,i.actions.findIndex(o=>o.checked)))}render(i){super.render(i),i.style.borderColor=kt(TO)}runAction(i,e){let t=this.action.actions[e];t&&this.actionRunner.run(t)}};F4e=I([m(1,Wn),m(2,B)],F4e);function Bs(a,i,e){return i instanceof Lo?a.createInstance(xl,i,e):i instanceof Nc?i.item.isSelection?a.createInstance(F4e,i):i.item.isSplitButton?a.createInstance(O4e,i,{...e,togglePrimaryAction:typeof i.item.isSplitButton!="boolean"?i.item.isSplitButton.togglePrimaryAction:!1}):a.createInstance(VE,i,e):void 0}var XCe=class{constructor(i,e,t){this._commandService=i;this._keybindingService=e;this._hiddenStates=new Dz(t)}createMenu(i,e,t){return new JCe(i,this._hiddenStates,{emitEventsForSubmenuChanges:!1,eventDebounceDelay:50,...t},this._commandService,this._keybindingService,e)}getMenuActions(i,e,t){let o=new JCe(i,this._hiddenStates,{emitEventsForSubmenuChanges:!1,eventDebounceDelay:50,...t},this._commandService,this._keybindingService,e),n=o.getActions(t);return o.dispose(),n}getMenuContexts(i){let e=new Swt(i,!1);return new Set([...e.structureContextKeys,...e.preconditionContextKeys,...e.toggledContextKeys])}resetHiddenStates(i){this._hiddenStates.reset(i)}};XCe=I([m(0,ge),m(1,_e),m(2,ce)],XCe);var Dz=class{constructor(i){this._storageService=i;this._disposables=new N;this._onDidChange=new E;this.onDidChange=this._onDidChange.event;this._ignoreChangeEvent=!1;this._hiddenByDefaultCache=new Map;try{let e=i.get(Dz._key,0,"{}");this._data=JSON.parse(e)}catch{this._data=Object.create(null)}this._disposables.add(i.onDidChangeValue(0,Dz._key,this._disposables)(()=>{if(!this._ignoreChangeEvent)try{let e=i.get(Dz._key,0,"{}");this._data=JSON.parse(e)}catch(e){console.log("FAILED to read storage after UPDATE",e)}this._onDidChange.fire()}))}static{this._key="menu.hiddenCommands"}dispose(){this._onDidChange.dispose(),this._disposables.dispose()}_isHiddenByDefault(i,e){return this._hiddenByDefaultCache.get(`${i.id}/${e}`)??!1}setDefaultState(i,e,t){this._hiddenByDefaultCache.set(`${i.id}/${e}`,t)}isHidden(i,e){let t=this._isHiddenByDefault(i,e),o=this._data[i.id]?.includes(e)??!1;return t?!o:o}updateHidden(i,e,t){this._isHiddenByDefault(i,e)&&(t=!t);let n=this._data[i.id];if(t)n?n.indexOf(e)<0&&n.push(e):this._data[i.id]=[e];else if(n){let r=n.indexOf(e);r>=0&&C2i(n,r),n.length===0&&delete this._data[i.id]}this._persist()}reset(i){if(i===void 0)this._data=Object.create(null),this._persist();else{for(let{id:e}of i)this._data[e]&&delete this._data[e];this._persist()}}_persist(){try{this._ignoreChangeEvent=!0;let i=JSON.stringify(this._data);this._storageService.store(Dz._key,i,0,0)}finally{this._ignoreChangeEvent=!1}}};Dz=I([m(0,ce)],Dz);var Swt=class a{constructor(i,e){this._id=i;this._collectContextKeysForSubmenus=e;this._menuGroups=[];this._allMenuIds=new Set;this._structureContextKeys=new Set;this._preconditionContextKeys=new Set;this._toggledContextKeys=new Set;this.refresh()}get allMenuIds(){return this._allMenuIds}get structureContextKeys(){return this._structureContextKeys}get preconditionContextKeys(){return this._preconditionContextKeys}get toggledContextKeys(){return this._toggledContextKeys}refresh(){this._menuGroups.length=0,this._allMenuIds.clear(),this._structureContextKeys.clear(),this._preconditionContextKeys.clear(),this._toggledContextKeys.clear();let i=this._sort(ve.getMenuItems(this._id)),e;for(let t of i){let o=t.group||"";(!e||e[0]!==o)&&(e=[o,[]],this._menuGroups.push(e)),e[1].push(t),this._collectContextKeysAndSubmenuIds(t)}this._allMenuIds.add(this._id)}_sort(i){return i}_collectContextKeysAndSubmenuIds(i){if(a._fillInKbExprKeys(i.when,this._structureContextKeys),gE(i)){if(i.command.precondition&&a._fillInKbExprKeys(i.command.precondition,this._preconditionContextKeys),i.command.toggled){let e=i.command.toggled.condition||i.command.toggled;a._fillInKbExprKeys(e,this._toggledContextKeys)}}else this._collectContextKeysForSubmenus&&(ve.getMenuItems(i.submenu).forEach(this._collectContextKeysAndSubmenuIds,this),this._allMenuIds.add(i.submenu))}static _fillInKbExprKeys(i,e){if(i)for(let t of i.keys())e.add(t)}},Jj=class extends Swt{constructor(e,t,o,n,r,s){super(e,o);this._hiddenStates=t;this._commandService=n;this._keybindingService=r;this._contextKeyService=s;this.refresh()}createActionGroups(e){let t=[];for(let o of this._menuGroups){let[n,r]=o,s;for(let l of r)if(this._contextKeyService.contextMatchesRules(l.when)){let c=gE(l);c&&this._hiddenStates.setDefaultState(this._id,l.command.id,!!l.isHiddenByDefault);let u=C1o(this._id,c?l.command:l,this._hiddenStates);if(c){let p=W4e(this._commandService,this._keybindingService,l.command.id,l.when);(s??=[]).push(new Lo(l.command,l.alt,e,u,p,this._contextKeyService,this._commandService))}else{let p=new Jj(l.submenu,this._hiddenStates,this._collectContextKeysForSubmenus,this._commandService,this._keybindingService,this._contextKeyService).createActionGroups(e),h=ri.join(...p.map(g=>g[1]));h.length>0&&(s??=[]).push(new Nc(l,u,h))}}s&&s.length>0&&t.push([n,s])}return t}_sort(e){return e.sort(Jj._compareMenuItems)}static _compareMenuItems(e,t){let o=e.group,n=t.group;if(o!==n){if(o){if(!n)return-1}else return 1;if(o==="navigation")return-1;if(n==="navigation")return 1;let l=o.localeCompare(n);if(l!==0)return l}let r=e.order||0,s=t.order||0;return r<s?-1:r>s?1:Jj._compareTitles(gE(e)?e.command.title:e.title,gE(t)?t.command.title:t.title)}static _compareTitles(e,t){let o=typeof e=="string"?e:e.original,n=typeof t=="string"?t:t.original;return o.localeCompare(n)}};Jj=I([m(3,ge),m(4,_e),m(5,X)],Jj);var JCe=class{constructor(i,e,t,o,n,r){this._disposables=new N;this._menuInfo=new Jj(i,e,t.emitEventsForSubmenuChanges,o,n,r);let s=new Dt(()=>{this._menuInfo.refresh(),this._onDidChange.fire({menu:this,isStructuralChange:!0,isEnablementChange:!0,isToggleChange:!0})},t.eventDebounceDelay);this._disposables.add(s),this._disposables.add(ve.onDidChangeMenu(p=>{for(let h of this._menuInfo.allMenuIds)if(p.has(h)){s.schedule();break}}));let l=this._disposables.add(new N),c=p=>{let h=!1,g=!1,f=!1;for(let v of p)if(h=h||v.isStructuralChange,g=g||v.isEnablementChange,f=f||v.isToggleChange,h&&g&&f)break;return{menu:this,isStructuralChange:h,isEnablementChange:g,isToggleChange:f}},u=()=>{l.add(r.onDidChangeContext(p=>{let h=p.affectsSome(this._menuInfo.structureContextKeys),g=p.affectsSome(this._menuInfo.preconditionContextKeys),f=p.affectsSome(this._menuInfo.toggledContextKeys);(h||g||f)&&this._onDidChange.fire({menu:this,isStructuralChange:h,isEnablementChange:g,isToggleChange:f})})),l.add(e.onDidChange(p=>{this._onDidChange.fire({menu:this,isStructuralChange:!0,isEnablementChange:!1,isToggleChange:!1})}))};this._onDidChange=new ZSe({onWillAddFirstListener:u,onDidRemoveLastListener:l.clear.bind(l),delay:t.eventDebounceDelay,merge:c}),this.onDidChange=this._onDidChange.event}getActions(i){return this._menuInfo.createActionGroups(i)}dispose(){this._disposables.dispose(),this._onDidChange.dispose()}};JCe=I([m(3,ge),m(4,_e),m(5,X)],JCe);function C1o(a,i,e){let t=S$i(i)?i.submenu.id:i.id,o=typeof i.title=="string"?i.title:i.title.value,n=ii({id:`hide/${a.id}/${t}`,label:d(1816,null,o),run(){e.updateHidden(a,t,!0)}}),r=ii({id:`toggle/${a.id}/${t}`,label:o,get checked(){return!e.isHidden(a,t)},run(){e.updateHidden(a,t,!!this.checked)}});return{hide:n,toggle:r,get isHidden(){return!r.checked}}}function W4e(a,i,e,t=void 0,o=!0){return ii({id:`configureKeybinding/${e}`,label:d(1815,null),enabled:o,run(){let r=!!!i.lookupKeybinding(e)&&t?t.serialize():void 0;a.executeCommand("workbench.action.openGlobalKeybindings",`@command:${e}`+(r?` +when:${r}`:""))}})}var Zx=le("IActionViewItemService");var jri=class{constructor(){this._providers=new Map;this._onDidChange=new E;this.onDidChange=this._onDidChange.event}dispose(){this._onDidChange.dispose()}register(i,e,t,o){let n=this._makeKey(i,e);if(this._providers.has(n))throw new Error(`A provider for the command ${e} and menu ${i} is already registered.`);this._providers.set(n,t);let r=o?.(()=>{this._onDidChange.fire(i)});return Z(()=>{r?.dispose(),this._providers.delete(n)})}lookUp(i,e){return this._providers.get(this._makeKey(i,e))}_makeKey(i,e){return`${i.id}/${e instanceof D?e.id:e}`}};Ee(Zx,jri,1);var ol=class extends wp{constructor(e,t,o,n,r,s,l,c){super(e,r,{getKeyBinding:p=>s.lookupKeybinding(p.id)??void 0,...t,allowContextMenu:!0,skipTelemetry:typeof t?.telemetrySource=="string"});this._options=t;this._menuService=o;this._contextKeyService=n;this._contextMenuService=r;this._keybindingService=s;this._commandService=l;this._sessionDisposables=this._store.add(new N);let u=t?.telemetrySource;u&&this._store.add(this.actionBar.onDidRun(p=>c.publicLog2("workbenchActionExecuted",{id:p.action.id,from:u})))}setActions(e,t=[],o){this._sessionDisposables.clear();let n=e.slice(),r=t.slice(),s=[],l=0,c=[],u=!1;if(this._options?.hiddenItemStrategy!==-1)for(let p=0;p<n.length;p++){let h=n[p];!(h instanceof Lo)&&!(h instanceof Nc)||h.hideActions&&(s.push(h.hideActions.toggle),h.hideActions.toggle.checked&&l++,h.hideActions.isHidden&&(u=!0,n[p]=void 0,this._options?.hiddenItemStrategy!==0&&(c[p]=h)))}if(this._options?.overflowBehavior!==void 0){let p=tht(new Set(this._options.overflowBehavior.exempted),vt.map(n,f=>f?.id)),h=this._options.overflowBehavior.maxItems-p.size,g=0;for(let f=0;f<n.length;f++){let v=n[f];v&&(g++,!p.has(v.id)&&g>=h&&(n[f]=void 0,c[f]=v))}}C$(n),C$(c),super.setActions(ri.clean(n),ri.join(c,r)),(s.length>0||n.length>0)&&this._sessionDisposables.add(j(this.getElement(),"contextmenu",p=>{let h=new Cn(Re(this.getElement()),p),g=this.getItemAction(h.target);if(!g)return;h.preventDefault(),h.stopPropagation();let f=[];if(g instanceof Lo&&g.menuKeybinding)f.push(g.menuKeybinding);else if(!(g instanceof Nc||g instanceof oce)){let b=!!this._keybindingService.lookupKeybinding(g.id);f.push(W4e(this._commandService,this._keybindingService,g.id,void 0,b))}if(s.length>0){let b=!1;if(l===1&&this._options?.hiddenItemStrategy===0){b=!0;for(let S=0;S<s.length;S++)if(s[S].checked){s[S]=ii({id:g.id,label:g.label,checked:!0,enabled:!1,run(){}});break}}if(!b&&(g instanceof Lo||g instanceof Nc)){if(!g.hideActions)return;f.push(g.hideActions.hide)}else f.push(ii({id:"label",label:d(1812,null),enabled:!1,run(){}}))}let v=ri.join(f,s);this._options?.resetMenu&&!o&&(o=[this._options.resetMenu]),u&&o&&(v.push(new ri),v.push(ii({id:"resetThisMenu",label:d(1813,null),run:()=>this._menuService.resetHiddenStates(o)}))),v.length!==0&&this._contextMenuService.showContextMenu({getAnchor:()=>h,getActions:()=>v,menuId:this._options?.contextMenu,menuActionOptions:{renderShortTitle:!0,...this._options?.menuOptions},skipTelemetry:typeof this._options?.telemetrySource=="string",contextKeyService:this._contextKeyService})}))}};ol=I([m(2,Kt),m(3,X),m(4,Xe),m(5,_e),m(6,ge),m(7,Te)],ol);var or=class extends ol{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,{resetMenu:t,...o,actionViewItemProvider:(g,f)=>{let v=p.lookUp(t,g instanceof Nc?g.item.submenu.id:g.id);v||(v=o?.actionViewItemProvider);let b=v?.(g,f,h,Re(e).vscodeWindowId);return b||Bs(h,g,f)}},n,r,s,l,c,u);this._onDidChangeMenuItems=this._store.add(new E);this._container=e,this._menuOptions=o?.menuOptions,this._toolbarOptions=o?.toolbarOptions,this._menu=this._store.add(n.createMenu(t,r,{emitEventsForSubmenuChanges:!0,eventDebounceDelay:o?.eventDebounceDelay})),this._store.add(this._menu.onDidChange(()=>{this._updateToolbar(),this._onDidChangeMenuItems.fire(this)})),this._store.add(p.onDidChange(g=>{g===t&&this._updateToolbar()})),this._updateToolbar()}get onDidChangeMenuItems(){return this._onDidChangeMenuItems.event}_updateToolbar(){let{primary:e,secondary:t}=ml(this._menu.getActions(this._menuOptions),this._toolbarOptions?.primaryGroup,this._toolbarOptions?.shouldInlineSubmenu,this._toolbarOptions?.useSeparatorsInPrimaryActions);this._container.classList.toggle("has-no-actions",e.length===0&&t.length===0),super.setActions(e,t)}refresh(){this._updateToolbar()}setActions(){throw new li("This toolbar is populated from a menu.")}};or=I([m(3,Kt),m(4,X),m(5,Xe),m(6,_e),m(7,ge),m(8,Te),m(9,Zx),m(10,F)],or);var nt=le("hoverService"),mf=class extends x{constructor(e,t,o={},n,r){super();this.placement=e;this.hoverOptions=t;this.overrideOptions=o;this.configurationService=n;this.hoverService=r;this.lastHoverHideTime=0;this.timeLimit=200;this.hoverDisposables=this._register(new N);this._delay=this.configurationService.getValue("workbench.hover.delay"),this._register(this.configurationService.onDidChangeConfiguration(s=>{s.affectsConfiguration("workbench.hover.delay")&&(this._delay=this.configurationService.getValue("workbench.hover.delay"))}))}get delay(){return this.isInstantlyHovering()?0:this.hoverOptions?.dynamicDelay?e=>this.hoverOptions?.dynamicDelay?.(e)??this._delay:this._delay}showHover(e,t){let o=typeof this.overrideOptions=="function"?this.overrideOptions(e,t):this.overrideOptions;this.hoverDisposables.clear();let n=Do(e.target)?[e.target]:e.target.targetElements;for(let s of n)this.hoverDisposables.add(Jo(s,"keydown",l=>{l.equals(9)&&this.hoverService.hideHover()}));let r=Do(e.content)?void 0:typeof e.content=="string"?e.content.toString():e.content.value;return this.hoverService.showInstantHover({...e,...o,persistence:{hideOnKeyDown:!0,...o.persistence},id:r,appearance:{...e.appearance,compact:!0,skipFadeInAnimation:this.isInstantlyHovering(),...o.appearance}},t)}isInstantlyHovering(){return!!this.hoverOptions?.instantHover&&Date.now()-this.lastHoverHideTime<this.timeLimit}setInstantHoverTimeLimit(e){if(!this.hoverOptions?.instantHover)throw new Error("Instant hover is not enabled");this.timeLimit=e}onDidHideHover(){this.hoverDisposables.clear(),this.hoverOptions?.instantHover&&(this.lastHoverHideTime=Date.now())}};mf=I([m(3,B),m(4,nt)],mf);var nI={showHover:function(){throw new Error("Native hover function not implemented.")},delay:0,showNativeHover:!0};var pR=class extends v7{constructor(e){super();this._textModel=e}getValueOfRange(e){return this._textModel.getValueInRange(e)}getLineLength(e){return this._textModel.getLineLength(e)}get length(){let e=this._textModel.getLineCount(),t=this._textModel.getLineLength(e);return new pc(e-1,t)}};var ZCe=class extends rs{constructor(e){super();this._getContext=e}runAction(e,t){let o=this._getContext();return super.runAction(e,o)}};var Iwt=class extends x{constructor(e,t,o){super();this._editor=e;this._domNode=t;this.itemProvider=o;this.scrollTop=ui(this,this._editor.onDidScrollChange,s=>this._editor.getScrollTop()),this.isScrollTopZero=this.scrollTop.map(s=>s===0),this.modelAttached=ui(this,this._editor.onDidChangeModel,s=>this._editor.hasModel()),this.editorOnDidChangeViewZones=Fr("onDidChangeViewZones",this._editor.onDidChangeViewZones),this.editorOnDidContentSizeChange=Fr("onDidContentSizeChange",this._editor.onDidContentSizeChange),this.domNodeSizeChanged=wc("domNodeSizeChanged"),this.views=this._register(new Vt),this._domNode.className="gutter monaco-editor";let n=this._domNode.appendChild(ct("div.scroll-decoration",{role:"presentation",ariaHidden:"true",style:{width:"100%"}}).root),r=new ResizeObserver(()=>{Gi(s=>{this.domNodeSizeChanged.trigger(s)})});r.observe(this._domNode),this._register(Z(()=>r.disconnect())),this._register(be(s=>{n.className=this.isScrollTopZero.read(s)?"":"scroll-decoration"})),this._register(be(s=>this.render(s)))}dispose(){super.dispose(),vi(this._domNode)}render(e){if(!this.modelAttached.read(e))return;this.domNodeSizeChanged.read(e),this.editorOnDidChangeViewZones.read(e),this.editorOnDidContentSizeChange.read(e);let t=this.scrollTop.read(e),o=this._editor.getVisibleRanges(),n=new Set(this.views.keys()),r=pi.ofStartAndLength(0,this._domNode.clientHeight);if(!r.isEmpty)for(let s of o){let l=new uo(s.startLineNumber,s.endLineNumber+1),c=this.itemProvider.getIntersectingGutterItems(l,e);Gi(u=>{for(let p of c){if(!p.range.intersect(l))continue;n.delete(p.id);let h=this.views.get(p.id);if(h)h.item.set(p,u);else{let b=document.createElement("div");this._domNode.appendChild(b);let S=Me("item",p),y=this.itemProvider.createView(S,b);h=new Qri(S,y,b),this.views.set(p.id,h)}let g=p.range.startLineNumber<=this._editor.getModel().getLineCount()?this._editor.getTopForLineNumber(p.range.startLineNumber,!0)-t:p.range.startLineNumber>1?this._editor.getBottomForLineNumber(p.range.startLineNumber-1,!1)-t:0,v=(p.range.endLineNumberExclusive===1?Math.max(g,this._editor.getTopForLineNumber(p.range.startLineNumber,!1)-t):Math.max(g,this._editor.getBottomForLineNumber(p.range.endLineNumberExclusive-1,!0)-t))-g;h.domNode.style.top=`${g}px`,h.domNode.style.height=`${v}px`,h.gutterItemView.layout(pi.ofStartAndLength(g,v),r)}})}for(let s of n)this.views.deleteAndDispose(s)}},Qri=class{constructor(i,e,t){this.item=i;this.gutterItemView=e;this.domNode=t}dispose(){this.gutterItemView.dispose(),this.domNode.remove()}};var Yri=[],ywt=35,exe=class extends x{constructor(e,t,o,n,r,s,l,c,u){super();this._diffModel=t;this._editors=o;this._options=n;this._sashLayout=r;this._boundarySashes=s;this._instantiationService=l;this._contextKeyService=c;this._menuService=u;this._menu=this._register(this._menuService.createMenu(D.DiffEditorHunkToolbar,this._contextKeyService)),this._actions=ui(this,this._menu.onDidChange,()=>this._menu.getActions()),this._hasActions=this._actions.map(h=>h.length>0),this._showSash=ke(this,h=>this._options.renderSideBySide.read(h)&&this._hasActions.read(h)),this.width=ke(this,h=>this._hasActions.read(h)?ywt:0),this.elements=ct("div.gutter@gutter",{style:{position:"absolute",height:"100%",width:ywt+"px"}},[]),this._currentDiff=ke(this,h=>{let g=this._diffModel.read(h);if(!g)return;let f=g.diff.read(h)?.mappings,v=this._editors.modifiedCursor.read(h);if(v)return f?.find(b=>b.lineRangeMapping.modified.contains(v.lineNumber))}),this._selectedDiffs=ke(this,h=>{let f=this._diffModel.read(h)?.diff.read(h);if(!f)return Yri;let v=this._editors.modifiedSelections.read(h);if(v.every(w=>w.isEmpty()))return Yri;let b=new kP(v.map(w=>uo.fromRangeInclusive(w))),y=f.mappings.filter(w=>w.lineRangeMapping.innerChanges&&b.intersects(w.lineRangeMapping.modified)).map(w=>({mapping:w,rangeMappings:w.lineRangeMapping.innerChanges.filter(k=>v.some(T=>z.areIntersecting(k.modifiedRange,T)))}));return y.length===0||y.every(w=>w.rangeMappings.length===0)?Yri:y}),this._register(u6i(e,this.elements.root)),this._register(j(this.elements.root,"click",()=>{this._editors.modified.focus()})),this._register(OP(this.elements.root,{display:this._hasActions.map(h=>h?"block":"none")})),UI(this,h=>this._showSash.read(h)?new WCe(e,this._sashLayout.dimensions,this._options.enableSplitViewResizing,this._boundarySashes,K$(this,f=>this._sashLayout.sashLeft.read(f)-ywt,(f,v)=>this._sashLayout.sashLeft.set(f+ywt,v)),()=>this._sashLayout.resetSash()):void 0).recomputeInitiallyAndOnChange(this._store);let p=ke(this,h=>{let g=this._diffModel.read(h);if(!g)return[];let f=g.diff.read(h);if(!f)return[];let v=this._selectedDiffs.read(h);if(v.length>0){let S=Uf.fromRangeMappings(v.flatMap(y=>y.rangeMappings));return[new wwt(S,!0,D.DiffEditorSelectionToolbar,void 0,g.model.original.uri,g.model.modified.uri)]}let b=this._currentDiff.read(h);return f.mappings.map(S=>new wwt(S.lineRangeMapping.withInnerChangesFromLineRanges(),S.lineRangeMapping===b?.lineRangeMapping,D.DiffEditorHunkToolbar,void 0,g.model.original.uri,g.model.modified.uri))});this._register(new Iwt(this._editors.modified,this.elements.root,{getIntersectingGutterItems:(h,g)=>p.read(g),createView:(h,g)=>this._instantiationService.createInstance(V4e,h,g,this)})),this._register(j(this.elements.gutter,re.MOUSE_WHEEL,h=>{this._editors.modified.getOption(117).handleMouseWheel&&this._editors.modified.delegateScrollFromMouseWheelEvent(h)},{passive:!1}))}computeStagedValue(e){let t=e.innerChanges??[],o=new pR(this._editors.modifiedModel.get()),n=new pR(this._editors.original.getModel());return new Vp(t.map(l=>l.toTextEdit(o))).apply(n)}layout(e){this.elements.gutter.style.left=e+"px"}};exe=I([m(6,F),m(7,X),m(8,Kt)],exe);var wwt=class{constructor(i,e,t,o,n,r){this.mapping=i;this.showAlways=e;this.menuId=t;this.rangeOverride=o;this.originalUri=n;this.modifiedUri=r}get id(){return this.mapping.modified.toString()}get range(){return this.rangeOverride??this.mapping.modified}},V4e=class extends x{constructor(e,t,o,n){super();this._item=e;this._elements=ct("div.gutterItem",{style:{height:"20px",width:"34px"}},[ct("div.background@background",{},[]),ct("div.buttons@buttons",{},[])]),this._showAlways=this._item.map(this,s=>s.showAlways),this._menuId=this._item.map(this,s=>s.menuId),this._isSmall=Me(this,!1),this._lastItemRange=void 0,this._lastViewRange=void 0;let r=this._register(n.createInstance(mf,"element",{instantHover:!0},{position:{hoverPosition:1}}));this._register($j(t,this._elements.root)),this._register(be(s=>{let l=this._showAlways.read(s);this._elements.root.classList.toggle("noTransition",!0),this._elements.root.classList.toggle("showAlways",l),setTimeout(()=>{this._elements.root.classList.toggle("noTransition",!1)},0)})),this._register(il((s,l)=>{this._elements.buttons.replaceChildren();let c=l.add(n.createInstance(or,this._elements.buttons,this._menuId.read(s),{orientation:1,hoverDelegate:r,toolbarOptions:{primaryGroup:u=>u.startsWith("primary")},overflowBehavior:{maxItems:this._isSmall.read(s)?1:3},hiddenItemStrategy:0,actionRunner:l.add(new ZCe(()=>{let u=this._item.read(void 0),p=u.mapping;return{mapping:p,originalWithModifiedChanges:o.computeStagedValue(p),originalUri:u.originalUri,modifiedUri:u.modifiedUri}})),menuOptions:{shouldForwardArgs:!0}}));l.add(c.onDidChangeMenuItems(()=>{this._lastItemRange&&this.layout(this._lastItemRange,this._lastViewRange)}))}))}layout(e,t){this._lastItemRange=e,this._lastViewRange=t;let o=this._elements.buttons.clientHeight;this._isSmall.set(this._item.get().mapping.original.startLineNumber===1&&e.length<30,void 0),o=this._elements.buttons.clientHeight;let n=e.length/2-o/2,r=o,s=e.start+n,l=pi.tryCreate(r,t.endExclusive-r-o),c=pi.tryCreate(e.start+r,e.endExclusive-o-r);c&&l&&c.start<c.endExclusive&&(s=l.clip(s),s=c.clip(s)),this._elements.buttons.style.top=`${s-e.start}px`}};V4e=I([m(3,F)],V4e);var QO=class extends x{constructor(e,t,o,n){super();this._editors=e;this._diffModel=t;this._options=o;this._instantiationService=n;this._modifiedOutlineSource=UI(this,e=>{let t=this._editors.modifiedModel.read(e),o=QO._breadcrumbsSourceFactory.read(e);return!t||!o?void 0:o(t,this._instantiationService)});this._isUpdatingHiddenAreas=!1;this._register(this._editors.original.onDidChangeCursorPosition(c=>{if(c.reason===1)return;let u=this._diffModel.get();Gi(p=>{for(let h of this._editors.original.getSelections()||[])u?.ensureOriginalLineIsVisible(h.getStartPosition().lineNumber,0,p),u?.ensureOriginalLineIsVisible(h.getEndPosition().lineNumber,0,p)})})),this._register(this._editors.modified.onDidChangeCursorPosition(c=>{if(c.reason===1)return;let u=this._diffModel.get();Gi(p=>{for(let h of this._editors.modified.getSelections()||[])u?.ensureModifiedLineIsVisible(h.getStartPosition().lineNumber,0,p),u?.ensureModifiedLineIsVisible(h.getEndPosition().lineNumber,0,p)})}));let r=this._diffModel.map((c,u)=>{let p=c?.unchangedRegions.read(u)??[];return p.length===1&&p[0].modifiedLineNumber===1&&p[0].lineCount===this._editors.modifiedModel.read(u)?.getLineCount()?[]:p});this.viewZones=ke(this,c=>{let u=this._modifiedOutlineSource.read(c);if(!u)return{origViewZones:[],modViewZones:[]};let p=[],h=[],g=this._options.renderSideBySide.read(c),f=this._options.compactMode.read(c),v=r.read(c);for(let b=0;b<v.length;b++){let S=v[b];if(!S.shouldHideControls(c)&&!(f&&(b===0||b===v.length-1)))if(f){{let y=ke(this,k=>S.getHiddenOriginalRange(k).startLineNumber-1),w=new Ez(y,12);p.push(w),c.store.add(new Cwt(this._editors.original,w,S,!g))}{let y=ke(this,k=>S.getHiddenModifiedRange(k).startLineNumber-1),w=new Ez(y,12);h.push(w),c.store.add(new Cwt(this._editors.modified,w,S))}}else{{let y=ke(this,k=>S.getHiddenOriginalRange(k).startLineNumber-1),w=new Ez(y,24);p.push(w),c.store.add(new xwt(this._editors.original,w,S,S.originalUnchangedRange,!g,u,k=>this._diffModel.get().ensureModifiedLineIsVisible(k,2,void 0),this._options))}{let y=ke(this,k=>S.getHiddenModifiedRange(k).startLineNumber-1),w=new Ez(y,24);h.push(w),c.store.add(new xwt(this._editors.modified,w,S,S.modifiedUnchangedRange,!1,u,k=>this._diffModel.get().ensureModifiedLineIsVisible(k,2,void 0),this._options))}}}return{origViewZones:p,modViewZones:h}});let s={description:"unchanged lines",className:"diff-unchanged-lines",isWholeLine:!0},l={description:"Fold Unchanged",glyphMarginHoverMessage:new Ie(void 0,{isTrusted:!0,supportThemeIcons:!0}).appendMarkdown(d(238,null)),glyphMarginClassName:"fold-unchanged "+q.asClassName(R.fold),zIndex:10001};this._register(DCe(this._editors.original,ke(this,c=>{let u=r.read(c),p=u.map(h=>({range:h.originalUnchangedRange.toInclusiveRange(),options:s}));for(let h of u)h.shouldHideControls(c)&&p.push({range:z.fromPositions(new ye(h.originalLineNumber,1)),options:l});return p}))),this._register(DCe(this._editors.modified,ke(this,c=>{let u=r.read(c),p=u.map(h=>({range:h.modifiedUnchangedRange.toInclusiveRange(),options:s}));for(let h of u)h.shouldHideControls(c)&&p.push({range:uo.ofLength(h.modifiedLineNumber,1).toInclusiveRange(),options:l});return p}))),this._register(be(c=>{let u=r.read(c);this._isUpdatingHiddenAreas=!0;try{this._editors.original.setHiddenAreas(u.map(p=>p.getHiddenOriginalRange(c).toInclusiveRange()).filter(lo)),this._editors.modified.setHiddenAreas(u.map(p=>p.getHiddenModifiedRange(c).toInclusiveRange()).filter(lo))}finally{this._isUpdatingHiddenAreas=!1}})),this._register(this._editors.modified.onMouseUp(c=>{if(!c.event.rightButton&&c.target.position&&c.target.element?.className.includes("fold-unchanged")){let u=c.target.position.lineNumber,p=this._diffModel.get();if(!p)return;let h=p.unchangedRegions.get().find(g=>g.modifiedUnchangedRange.contains(u));if(!h)return;h.collapseAll(void 0),c.event.stopPropagation(),c.event.preventDefault()}})),this._register(this._editors.original.onMouseUp(c=>{if(!c.event.rightButton&&c.target.position&&c.target.element?.className.includes("fold-unchanged")){let u=c.target.position.lineNumber,p=this._diffModel.get();if(!p)return;let h=p.unchangedRegions.get().find(g=>g.originalUnchangedRange.contains(u));if(!h)return;h.collapseAll(void 0),c.event.stopPropagation(),c.event.preventDefault()}}))}static{this._breadcrumbsSourceFactory=Me(this,()=>({dispose(){},getBreadcrumbItems(e,t){return[]},getAt:()=>[]}))}static setBreadcrumbsSourceFactory(e){this._breadcrumbsSourceFactory.set(e,void 0)}get isUpdatingHiddenAreas(){return this._isUpdatingHiddenAreas}};QO=I([m(3,F)],QO);var Cwt=class extends Zle{constructor(e,t,o,n=!1){let r=ct("div.diff-hidden-lines-widget");super(e,t,r.root);this._unchangedRegion=o;this._hide=n;this._nodes=ct("div.diff-hidden-lines-compact",[ct("div.line-left",[]),ct("div.text@text",[]),ct("div.line-right",[])]);r.root.appendChild(this._nodes.root),this._hide&&this._nodes.root.replaceChildren(),this._register(be(s=>{if(!this._hide){let l=this._unchangedRegion.getHiddenModifiedRange(s).length,c=d(239,null,l);this._nodes.text.innerText=c}}))}},xwt=class extends Zle{constructor(e,t,o,n,r,s,l,c){let u=ct("div.diff-hidden-lines-widget");super(e,t,u.root);this._editor=e;this._unchangedRegion=o;this._unchangedRegionRange=n;this._hide=r;this._modifiedOutlineSource=s;this._revealModifiedHiddenLine=l;this._options=c;this._nodes=ct("div.diff-hidden-lines",[ct("div.top@top",{title:d(237,null)}),ct("div.center@content",{style:{display:"flex"}},[ct("div@first",{style:{display:"flex",justifyContent:"center",alignItems:"center",flexShrink:"0"}},[_("a",{title:d(240,null),role:"button",onclick:()=>{this._unchangedRegion.showAll(void 0)}},...Un("$(unfold)"))]),ct("div@others",{style:{display:"flex",justifyContent:"center",alignItems:"center"}})]),ct("div.bottom@bottom",{title:d(235,null),role:"button"})]);u.root.appendChild(this._nodes.root),this._hide?vi(this._nodes.first):this._register(OP(this._nodes.first,{width:gs(this._editor).layoutInfoContentLeft})),this._register(be(h=>{let g=this._unchangedRegion.visibleLineCountTop.read(h)+this._unchangedRegion.visibleLineCountBottom.read(h)===this._unchangedRegion.lineCount;this._nodes.bottom.classList.toggle("canMoveTop",!g),this._nodes.bottom.classList.toggle("canMoveBottom",this._unchangedRegion.visibleLineCountBottom.read(h)>0),this._nodes.top.classList.toggle("canMoveTop",this._unchangedRegion.visibleLineCountTop.read(h)>0),this._nodes.top.classList.toggle("canMoveBottom",!g);let f=this._unchangedRegion.isDragged.read(h),v=this._editor.getDomNode();v&&(v.classList.toggle("draggingUnchangedRegion",!!f),f==="top"?(v.classList.toggle("canMoveTop",this._unchangedRegion.visibleLineCountTop.read(h)>0),v.classList.toggle("canMoveBottom",!g)):f==="bottom"?(v.classList.toggle("canMoveTop",!g),v.classList.toggle("canMoveBottom",this._unchangedRegion.visibleLineCountBottom.read(h)>0)):(v.classList.toggle("canMoveTop",!1),v.classList.toggle("canMoveBottom",!1)))}));let p=this._editor;this._register(j(this._nodes.top,"mousedown",h=>{if(h.button!==0)return;this._nodes.top.classList.toggle("dragging",!0),this._nodes.root.classList.toggle("dragging",!0),h.preventDefault();let g=h.clientY,f=!1,v=this._unchangedRegion.visibleLineCountTop.get();this._unchangedRegion.isDragged.set("top",void 0);let b=Re(this._nodes.top),S=j(b,"mousemove",w=>{let T=w.clientY-g;f=f||Math.abs(T)>2;let P=Math.round(T/p.getOption(75)),O=Math.max(0,Math.min(v+P,this._unchangedRegion.getMaxVisibleLineCountTop()));this._unchangedRegion.visibleLineCountTop.set(O,void 0)}),y=j(b,"mouseup",w=>{f||this._unchangedRegion.showMoreAbove(this._options.hideUnchangedRegionsRevealLineCount.get(),void 0),this._nodes.top.classList.toggle("dragging",!1),this._nodes.root.classList.toggle("dragging",!1),this._unchangedRegion.isDragged.set(void 0,void 0),S.dispose(),y.dispose()})})),this._register(j(this._nodes.bottom,"mousedown",h=>{if(h.button!==0)return;this._nodes.bottom.classList.toggle("dragging",!0),this._nodes.root.classList.toggle("dragging",!0),h.preventDefault();let g=h.clientY,f=!1,v=this._unchangedRegion.visibleLineCountBottom.get();this._unchangedRegion.isDragged.set("bottom",void 0);let b=Re(this._nodes.bottom),S=j(b,"mousemove",w=>{let T=w.clientY-g;f=f||Math.abs(T)>2;let P=Math.round(T/p.getOption(75)),O=Math.max(0,Math.min(v-P,this._unchangedRegion.getMaxVisibleLineCountBottom())),V=this._unchangedRegionRange.endLineNumberExclusive>p.getModel().getLineCount()?p.getContentHeight():p.getTopForLineNumber(this._unchangedRegionRange.endLineNumberExclusive);this._unchangedRegion.visibleLineCountBottom.set(O,void 0);let H=this._unchangedRegionRange.endLineNumberExclusive>p.getModel().getLineCount()?p.getContentHeight():p.getTopForLineNumber(this._unchangedRegionRange.endLineNumberExclusive);p.setScrollTop(p.getScrollTop()+(H-V))}),y=j(b,"mouseup",w=>{if(this._unchangedRegion.isDragged.set(void 0,void 0),!f){let k=p.getTopForLineNumber(this._unchangedRegionRange.endLineNumberExclusive);this._unchangedRegion.showMoreBelow(this._options.hideUnchangedRegionsRevealLineCount.get(),void 0);let T=p.getTopForLineNumber(this._unchangedRegionRange.endLineNumberExclusive);p.setScrollTop(p.getScrollTop()+(T-k))}this._nodes.bottom.classList.toggle("dragging",!1),this._nodes.root.classList.toggle("dragging",!1),S.dispose(),y.dispose()})})),this._register(be(h=>{let g=[];if(!this._hide){let f=o.getHiddenModifiedRange(h).length,v=d(239,null,f),b=_("span",{title:d(236,null)},v);b.addEventListener("dblclick",w=>{w.button===0&&(w.preventDefault(),this._unchangedRegion.showAll(void 0))}),g.push(b);let S=this._unchangedRegion.getHiddenModifiedRange(h),y=this._modifiedOutlineSource.getBreadcrumbItems(S,h);if(y.length>0){g.push(_("span",void 0,"\xA0\xA0|\xA0\xA0"));for(let w=0;w<y.length;w++){let k=y[w],T=_m.toIcon(k.kind),P=ct("div.breadcrumb-item",{style:{display:"flex",alignItems:"center"}},[Sn(T),"\xA0",k.name,...w===y.length-1?[]:[Sn(R.chevronRight)]]).root;g.push(P),P.onclick=()=>{this._revealModifiedHiddenLine(k.startLineNumber)}}}}vi(this._nodes.others,...g)}))}};var Xri=[],kwt=class extends x{constructor(e,t,o,n){super();this._editors=e;this._diffModel=t;this._options=o;this._widget=n;this._selectedDiffs=ke(this,e=>{let o=this._diffModel.read(e)?.diff.read(e);if(!o)return Xri;let n=this._editors.modifiedSelections.read(e);if(n.every(c=>c.isEmpty()))return Xri;let r=new kP(n.map(c=>uo.fromRangeInclusive(c))),l=o.mappings.filter(c=>c.lineRangeMapping.innerChanges&&r.intersects(c.lineRangeMapping.modified)).map(c=>({mapping:c,rangeMappings:c.lineRangeMapping.innerChanges.filter(u=>n.some(p=>z.areIntersecting(u.modifiedRange,p)))}));return l.length===0||l.every(c=>c.rangeMappings.length===0)?Xri:l});this._register(il((r,s)=>{if(!this._options.shouldRenderOldRevertArrows.read(r))return;let l=this._diffModel.read(r),c=l?.diff.read(r);if(!l||!c||l.movedTextToCompare.read(r))return;let u=[],p=this._selectedDiffs.read(r),h=new Set(p.map(g=>g.mapping));if(p.length>0){let g=this._editors.modifiedSelections.read(r),f=s.add(new Ewt(g[g.length-1].positionLineNumber,this._widget,p.flatMap(v=>v.rangeMappings),!0));this._editors.modified.addGlyphMarginWidget(f),u.push(f)}for(let g of c.mappings)if(!h.has(g)&&!g.lineRangeMapping.modified.isEmpty&&g.lineRangeMapping.innerChanges){let f=s.add(new Ewt(g.lineRangeMapping.modified.startLineNumber,this._widget,g.lineRangeMapping,!1));this._editors.modified.addGlyphMarginWidget(f),u.push(f)}s.add(Z(()=>{for(let g of u)this._editors.modified.removeGlyphMarginWidget(g)}))}))}},Ewt=class a extends x{constructor(e,t,o,n){super();this._lineNumber=e;this._widget=t;this._diffs=o;this._revertSelection=n;this._id=`revertButton${a.counter++}`,this._domNode=ct("div.revertButton",{title:this._revertSelection?d(246,null):d(245,null)},[Sn(R.arrowRight)]).root,this._register(j(this._domNode,re.MOUSE_DOWN,r=>{r.button!==2&&(r.stopPropagation(),r.preventDefault())})),this._register(j(this._domNode,re.MOUSE_UP,r=>{r.stopPropagation(),r.preventDefault()})),this._register(j(this._domNode,re.CLICK,r=>{this._diffs instanceof jI?this._widget.revert(this._diffs):this._widget.revertRangeMappings(this._diffs),r.stopPropagation(),r.preventDefault()}))}static{this.counter=0}getId(){return this._id}getDomNode(){return this._domNode}getPosition(){return{lane:3,range:{startColumn:1,startLineNumber:this._lineNumber,endColumn:1,endLineNumber:this._lineNumber},zIndex:10001}}};var op=class extends iwt{constructor(e,t,o,n,r,s,l,c){super();this._domElement=e;this._parentContextKeyService=n;this._parentInstantiationService=r;this._codeEditorService=s;this._accessibilitySignalService=l;this._editorProgressService=c;this.elements=ct("div.monaco-diff-editor.side-by-side",{style:{position:"relative",height:"100%"}},[ct("div.editor.original@original",{style:{position:"absolute",height:"100%"}}),ct("div.editor.modified@modified",{style:{position:"absolute",height:"100%"}}),ct("div.accessibleDiffViewer@accessibleDiffViewer",{style:{position:"absolute",height:"100%"}})]),this._diffModelSrc=this._register(SV(this,void 0)),this._diffModel=ke(this,T=>this._diffModelSrc.read(T)?.object),this.onDidChangeModel=U.fromObservableLight(this._diffModel),this._contextKeyService=this._register(this._parentContextKeyService.createScoped(this._domElement)),this._instantiationService=this._register(this._parentInstantiationService.createChild(new _o([X,this._contextKeyService]))),this._boundarySashes=Me(this,void 0),this._accessibleDiffViewerShouldBeVisible=Me(this,!1),this._accessibleDiffViewerVisible=ke(this,T=>this._options.onlyShowAccessibleDiffViewer.read(T)?!0:this._accessibleDiffViewerShouldBeVisible.read(T)),this._movedBlocksLinesPart=Me(this,void 0),this._layoutInfo=ke(this,T=>{let P=this._rootSizeObserver.width.read(T),O=this._rootSizeObserver.height.read(T);this._rootSizeObserver.automaticLayout?this.elements.root.style.height="100%":this.elements.root.style.height=O+"px";let V=this._sash.read(T),H=this._gutter.read(T),G=H?.width.read(T)??0,$=this._overviewRulerPart.read(T)?.width??0,J,ae,he,oe,de;if(!!V){let xe=V.sashLeft.read(T),ze=this._movedBlocksLinesPart.read(T)?.width.read(T)??0;J=0,ae=xe-G-ze,de=xe-G,he=xe,oe=P-he-$}else{de=0;let xe=this._options.inlineViewHideOriginalLineNumbers.read(T);J=G,xe?ae=0:ae=Math.max(5,this._editors.originalObs.layoutInfoDecorationsLeft.read(T)),he=G+ae,oe=P-he-$}return this.elements.original.style.left=J+"px",this.elements.original.style.width=ae+"px",this._editors.original.layout({width:ae,height:O},!0),H?.layout(de),this.elements.modified.style.left=he+"px",this.elements.modified.style.width=oe+"px",this._editors.modified.layout({width:oe,height:O},!0),{modifiedEditor:this._editors.modified.getLayoutInfo(),originalEditor:this._editors.original.getLayoutInfo()}}),this._diffValue=this._diffModel.map((T,P)=>T?.diff.read(P)),this.onDidUpdateDiff=U.fromObservableLight(this._diffValue),this._codeEditorService.willCreateDiffEditor(),this._contextKeyService.createKey("isInDiffEditor",!0),this._domElement.appendChild(this.elements.root),this._register(Z(()=>this.elements.root.remove())),this._rootSizeObserver=this._register(new _Ce(this.elements.root,t.dimension)),this._rootSizeObserver.setAutomaticLayout(t.automaticLayout??!1),this._options=this._instantiationService.createInstance(vY,t),this._register(be(T=>{this._options.setWidth(this._rootSizeObserver.width.read(T))})),this._contextKeyService.createKey(pe.isEmbeddedDiffEditor.key,!1),this._register(Vd(pe.isEmbeddedDiffEditor,this._contextKeyService,T=>this._options.isInEmbeddedEditor.read(T))),this._register(Vd(pe.comparingMovedCode,this._contextKeyService,T=>!!this._diffModel.read(T)?.movedTextToCompare.read(T))),this._register(Vd(pe.diffEditorRenderSideBySideInlineBreakpointReached,this._contextKeyService,T=>this._options.couldShowInlineViewBecauseOfSize.read(T))),this._register(Vd(pe.diffEditorInlineMode,this._contextKeyService,T=>!this._options.renderSideBySide.read(T))),this._register(Vd(pe.hasChanges,this._contextKeyService,T=>(this._diffModel.read(T)?.diff.read(T)?.mappings.length??0)>0)),this._editors=this._register(this._instantiationService.createInstance(OCe,this.elements.original,this.elements.modified,this._options,o,(T,P,O,V)=>this._createInnerEditor(T,P,O,V))),this._register(Vd(pe.diffEditorOriginalWritable,this._contextKeyService,T=>this._options.originalEditable.read(T))),this._register(Vd(pe.diffEditorModifiedWritable,this._contextKeyService,T=>!this._options.readOnly.read(T))),this._register(Vd(pe.diffEditorOriginalUri,this._contextKeyService,T=>this._diffModel.read(T)?.model.original.uri.toString()??"")),this._register(Vd(pe.diffEditorModifiedUri,this._contextKeyService,T=>this._diffModel.read(T)?.model.modified.uri.toString()??"")),this._overviewRulerPart=UI(this,T=>this._options.renderOverviewRuler.read(T)?this._instantiationService.createInstance(Xx(iy,T),this._editors,this.elements.root,this._diffModel,this._rootSizeObserver.width,this._rootSizeObserver.height,this._layoutInfo.map(P=>P.modifiedEditor)):void 0).recomputeInitiallyAndOnChange(this._store);let u={height:this._rootSizeObserver.height,width:this._rootSizeObserver.width.map((T,P)=>T-(this._overviewRulerPart.read(P)?.width??0))};this._sashLayout=new ewt(this._options,u),this._sash=UI(this,T=>{let P=this._options.renderSideBySide.read(T);return this.elements.root.classList.toggle("side-by-side",P),P?new WCe(this.elements.root,u,this._options.enableSplitViewResizing,this._boundarySashes,this._sashLayout.sashLeft,()=>this._sashLayout.resetSash()):void 0}).recomputeInitiallyAndOnChange(this._store);let p=UI(this,T=>this._instantiationService.createInstance(Xx(QO,T),this._editors,this._diffModel,this._options)).recomputeInitiallyAndOnChange(this._store);UI(this,T=>this._instantiationService.createInstance(Xx(Zyt,T),this._editors,this._diffModel,this._options,this)).recomputeInitiallyAndOnChange(this._store);let h=new Set,g=new Set,f=!1,v=UI(this,T=>this._instantiationService.createInstance(Xx(NCe,T),Re(this._domElement),this._editors,this._diffModel,this._options,this,()=>f||p.read(void 0).isUpdatingHiddenAreas,h,g)).recomputeInitiallyAndOnChange(this._store),b=ke(this,T=>{let P=v.read(T).viewZones.read(T).orig,O=p.read(T).viewZones.read(T).origViewZones;return P.concat(O)}),S=ke(this,T=>{let P=v.read(T).viewZones.read(T).mod,O=p.read(T).viewZones.read(T).modViewZones;return P.concat(O)});this._register(LCe(this._editors.original,b,T=>{f=T},h));let y;this._register(LCe(this._editors.modified,S,T=>{f=T,f?y=DC.capture(this._editors.modified):(y?.restore(this._editors.modified),y=void 0)},g)),this._accessibleDiffViewer=UI(this,T=>this._instantiationService.createInstance(Xx(zO,T),this.elements.accessibleDiffViewer,this._accessibleDiffViewerVisible,(P,O)=>this._accessibleDiffViewerShouldBeVisible.set(P,O),this._options.onlyShowAccessibleDiffViewer.map(P=>!P),this._rootSizeObserver.width,this._rootSizeObserver.height,this._diffModel.map((P,O)=>P?.diff.read(O)?.mappings.map(V=>V.lineRangeMapping)),new Qyt(this._editors))).recomputeInitiallyAndOnChange(this._store);let w=this._accessibleDiffViewerVisible.map(T=>T?"hidden":"visible");this._register(OP(this.elements.modified,{visibility:w})),this._register(OP(this.elements.original,{visibility:w})),this._createDiffEditorContributions(),this._codeEditorService.addDiffEditor(this),this._register(Z(()=>{this._codeEditorService.removeDiffEditor(this)})),this._gutter=UI(this,T=>this._options.shouldRenderGutterMenu.read(T)?this._instantiationService.createInstance(Xx(exe,T),this.elements.root,this._diffModel,this._editors,this._options,this._sashLayout,this._boundarySashes):void 0),this._register(fP(this._layoutInfo)),UI(this,T=>new(Xx(fY,T))(this.elements.root,this._diffModel,this._layoutInfo.map(P=>P.originalEditor),this._layoutInfo.map(P=>P.modifiedEditor),this._editors)).recomputeInitiallyAndOnChange(this._store,T=>{this._movedBlocksLinesPart.set(T,void 0)}),this._register(U.runAndSubscribe(this._editors.modified.onDidChangeCursorPosition,T=>this._handleCursorPositionChange(T,!0))),this._register(U.runAndSubscribe(this._editors.original.onDidChangeCursorPosition,T=>this._handleCursorPositionChange(T,!1)));let k=this._diffModel.map(this,(T,P)=>{if(T)return T.diff.read(P)===void 0&&!T.isDiffUpToDate.read(P)});this._register(il((T,P)=>{if(k.read(T)===!0){let O=this._editorProgressService.show(!0,1e3);P.add(Z(()=>O.done()))}})),this._register(il((T,P)=>{P.add(new(Xx(kwt,T))(this._editors,this._diffModel,this._options,this))})),this._register(il((T,P)=>{let O=this._diffModel.read(T);if(O)for(let V of[O.model.original,O.model.modified])P.add(V.onWillDispose(H=>{mt(new li("TextModel got disposed before DiffEditorWidget model got reset")),this.setModel(null)}))})),this._register(be(T=>{this._options.setModel(this._diffModel.read(T))}))}static{this.ENTIRE_DIFF_OVERVIEW_WIDTH=iy.ENTIRE_DIFF_OVERVIEW_WIDTH}get onDidContentSizeChange(){return this._editors.onDidContentSizeChange}get collapseUnchangedRegions(){return this._options.hideUnchangedRegions.get()}getViewWidth(){return this._rootSizeObserver.width.get()}getContentHeight(){return this._editors.modified.getContentHeight()}_createInnerEditor(e,t,o,n){return e.createInstance(Xr,t,o,n)}_createDiffEditorContributions(){let e=Ba.getDiffEditorContributions();for(let t of e)try{this._register(this._instantiationService.createInstance(t.ctor,this))}catch(o){mt(o)}}get _targetEditor(){return this._editors.modified}getEditorType(){return oj.IDiffEditor}onVisible(){this._editors.original.onVisible(),this._editors.modified.onVisible()}onHide(){this._editors.original.onHide(),this._editors.modified.onHide()}layout(e){this._rootSizeObserver.observe(e)}hasTextFocus(){return this._editors.original.hasTextFocus()||this._editors.modified.hasTextFocus()}saveViewState(){let e=this._editors.original.saveViewState(),t=this._editors.modified.saveViewState();return{original:e,modified:t,modelState:this._diffModel.get()?.serializeState()}}restoreViewState(e){if(e&&e.original&&e.modified){let t=e;this._editors.original.restoreViewState(t.original),this._editors.modified.restoreViewState(t.modified),t.modelState&&this._diffModel.get()?.restoreSerializedState(t.modelState)}}handleInitialized(){this._editors.original.handleInitialized(),this._editors.modified.handleInitialized()}createViewModel(e){return this._instantiationService.createInstance(hY,e,this._options)}getModel(){return this._diffModel.get()?.model??null}setModel(e){let t=e?"model"in e?KV.create(e).createNewRef(this):KV.create(this.createViewModel(e),this):null;this.setDiffModel(t)}setDiffModel(e,t){let o=this._diffModel.get();!e&&o&&this._accessibleDiffViewer.get().close(),this._diffModel.get()!==e?.object&&nO(t,n=>{let r=e?.object;ui.batchEventsGlobally(n,()=>{this._editors.original.setModel(r?r.model.original:null),this._editors.modified.setModel(r?r.model.modified:null)});let s=this._diffModelSrc.get()?.createNewRef(this);this._diffModelSrc.set(e?.createNewRef(this),n),setTimeout(()=>{s?.dispose()},0)})}updateOptions(e){this._options.updateOptions(e)}getDomNode(){return this.elements.root}getContainerDomNode(){return this._domElement}getOriginalEditor(){return this._editors.original}getModifiedEditor(){return this._editors.modified}setBoundarySashes(e){this._boundarySashes.set(e,void 0)}get ignoreTrimWhitespace(){return this._options.ignoreTrimWhitespace.get()}get maxComputationTime(){return this._options.maxComputationTimeMs.get()}get renderSideBySide(){return this._options.renderSideBySide.get()}getLineChanges(){let e=this._diffModel.get()?.diff.get();return e?Jri(e):null}getDiffComputationResult(){let e=this._diffModel.get()?.diff.get();return e?{changes:this.getLineChanges(),changes2:e.mappings.map(t=>t.lineRangeMapping),identical:e.identical,quitEarly:e.quitEarly}:null}revert(e){let t=this._diffModel.get();!t||!t.isDiffUpToDate.get()||(this._editors.modified.pushUndoStop(),this._editors.modified.executeEdits("diffEditor",[{range:e.modified.toExclusiveRange(),text:t.model.original.getValueInRange(e.original.toExclusiveRange())}]),this._editors.modified.pushUndoStop())}revertRangeMappings(e){let t=this._diffModel.get();if(!t||!t.isDiffUpToDate.get())return;let o=e.map(n=>({range:n.modifiedRange,text:t.model.original.getValueInRange(n.originalRange)}));this._editors.modified.pushUndoStop(),this._editors.modified.executeEdits("diffEditor",o),this._editors.modified.pushUndoStop()}revertFocusedRangeMappings(){let e=this._diffModel.get();if(!e||!e.isDiffUpToDate.get())return;let t=this._diffModel.get()?.diff.get()?.mappings;if(!t||t.length===0)return;let o=this._editors.modified;if(!o.hasTextFocus())return;let n=o.getPosition().lineNumber,r=o.getSelection(),s=uo.fromRange(r||new z(n,0,n,0)),l=t.filter(c=>c.lineRangeMapping.modified.intersect(s));o.pushUndoStop(),o.executeEdits("diffEditor",l.map(c=>({range:c.lineRangeMapping.modified.toExclusiveRange(),text:e.model.original.getValueInRange(c.lineRangeMapping.original.toExclusiveRange())}))),o.pushUndoStop()}_goTo(e){this._editors.modified.setPosition(new ye(e.lineRangeMapping.modified.startLineNumber,1)),this._editors.modified.revealRangeInCenter(e.lineRangeMapping.modified.toExclusiveRange())}goToDiff(e){let t=this._diffModel.get()?.diff.get()?.mappings;if(!t||t.length===0)return;let o=this._editors.modified.getPosition().lineNumber,n;e==="next"?this._editors.modified.getModel().getLineCount()===o?n=t[0]:n=t.find(s=>s.lineRangeMapping.modified.startLineNumber>o)??t[0]:n=fd(t,r=>r.lineRangeMapping.modified.startLineNumber<o)??t[t.length-1],this._goTo(n),n.lineRangeMapping.modified.isEmpty?this._accessibilitySignalService.playSignal($o.diffLineDeleted,{source:"diffEditor.goToDiff"}):n.lineRangeMapping.original.isEmpty?this._accessibilitySignalService.playSignal($o.diffLineInserted,{source:"diffEditor.goToDiff"}):n&&this._accessibilitySignalService.playSignal($o.diffLineModified,{source:"diffEditor.goToDiff"})}revealFirstDiff(){let e=this._diffModel.get();e&&this.waitForDiff().then(()=>{let t=e.diff.get()?.mappings;!t||t.length===0||this._goTo(t[0])})}accessibleDiffViewerNext(){this._accessibleDiffViewer.get().next()}accessibleDiffViewerPrev(){this._accessibleDiffViewer.get().prev()}async waitForDiff(){let e=this._diffModel.get();e&&await e.waitForDiff()}mapToOtherSide(){let e=this._editors.modified.hasWidgetFocus(),t=e?this._editors.modified:this._editors.original,o=e?this._editors.original:this._editors.modified,n,r=t.getSelection();if(r){let s=this._diffModel.get()?.diff.get()?.mappings.map(l=>e?l.lineRangeMapping.flip():l.lineRangeMapping);if(s){let l=kri(r.getStartPosition(),s),c=kri(r.getEndPosition(),s);n=z.plusRange(l,c)}}return{destination:o,destinationSelection:n}}switchSide(){let{destination:e,destinationSelection:t}=this.mapToOtherSide();e.focus(),t&&e.setSelection(t)}exitCompareMove(){let e=this._diffModel.get();e&&e.movedTextToCompare.set(void 0,void 0)}collapseAllUnchangedRegions(){let e=this._diffModel.get()?.unchangedRegions.get();e&&Gi(t=>{for(let o of e)o.collapseAll(t)})}showAllUnchangedRegions(){let e=this._diffModel.get()?.unchangedRegions.get();e&&Gi(t=>{for(let o of e)o.showAll(t)})}_handleCursorPositionChange(e,t){if(e?.reason===3){let o=this._diffModel.get()?.diff.get()?.mappings.find(n=>t?n.lineRangeMapping.modified.contains(e.position.lineNumber):n.lineRangeMapping.original.contains(e.position.lineNumber));o?.lineRangeMapping.modified.isEmpty?this._accessibilitySignalService.playSignal($o.diffLineDeleted,{source:"diffEditor.cursorPositionChanged"}):o?.lineRangeMapping.original.isEmpty?this._accessibilitySignalService.playSignal($o.diffLineInserted,{source:"diffEditor.cursorPositionChanged"}):o&&this._accessibilitySignalService.playSignal($o.diffLineModified,{source:"diffEditor.cursorPositionChanged"})}}};op=I([m(3,X),m(4,F),m(5,qt),m(6,lr),m(7,wd)],op);function Jri(a){return a.mappings.map(i=>{let e=i.lineRangeMapping,t,o,n,r,s=e.innerChanges;return e.original.isEmpty?(t=e.original.startLineNumber-1,o=0,s=void 0):(t=e.original.startLineNumber,o=e.original.endLineNumberExclusive-1),e.modified.isEmpty?(n=e.modified.startLineNumber-1,r=0,s=void 0):(n=e.modified.startLineNumber,r=e.modified.endLineNumberExclusive-1),{originalStartLineNumber:t,originalEndLineNumber:o,modifiedStartLineNumber:n,modifiedEndLineNumber:r,charChanges:s?.map(l=>({originalStartLineNumber:l.originalRange.startLineNumber,originalStartColumn:l.originalRange.startColumn,originalEndLineNumber:l.originalRange.endLineNumber,originalEndColumn:l.originalRange.endColumn,modifiedStartLineNumber:l.modifiedRange.startLineNumber,modifiedStartColumn:l.modifiedRange.startColumn,modifiedEndLineNumber:l.modifiedRange.endLineNumber,modifiedEndColumn:l.modifiedRange.endColumn}))}})}var Twt=class extends K{constructor(){super({id:"diffEditor.toggleCollapseUnchangedRegions",title:L(205,"Toggle Collapse Unchanged Regions"),icon:R.map,toggled:C.has("config.diffEditor.hideUnchangedRegions.enabled"),precondition:C.has("isInDiffEditor"),menu:{when:C.has("isInDiffEditor"),id:D.EditorTitle,order:22,group:"navigation"}})}run(i,...e){let t=i.get(B),o=!t.getValue("diffEditor.hideUnchangedRegions.enabled");t.updateValue("diffEditor.hideUnchangedRegions.enabled",o)}},B4e=class extends K{constructor(){super({id:"diffEditor.toggleShowMovedCodeBlocks",title:L(206,"Toggle Show Moved Code Blocks"),precondition:C.has("isInDiffEditor")})}run(i,...e){let t=i.get(B),o=!t.getValue("diffEditor.experimental.showMoves");t.updateValue("diffEditor.experimental.showMoves",o)}},H4e=class extends K{constructor(){super({id:"diffEditor.toggleUseInlineViewWhenSpaceIsLimited",title:L(207,"Toggle Use Inline View When Space Is Limited"),precondition:C.has("isInDiffEditor")})}run(i,...e){let t=i.get(B),o=!t.getValue("diffEditor.useInlineViewWhenSpaceIsLimited");t.updateValue("diffEditor.useInlineViewWhenSpaceIsLimited",o)}},U4e=L(198,"Diff Editor"),_wt=class extends pl{constructor(){super({id:"diffEditor.switchSide",title:L(204,"Switch Side"),icon:R.arrowSwap,precondition:C.has("isInDiffEditor"),f1:!0,category:U4e})}runEditorCommand(i,e,t){let o=dce(i);if(o instanceof op){if(t&&t.dryRun)return{destinationSelection:o.mapToOtherSide().destinationSelection};o.switchSide()}}},Dwt=class extends pl{constructor(){super({id:"diffEditor.exitCompareMove",title:L(201,"Exit Compare Move"),icon:R.close,precondition:pe.comparingMovedCode,f1:!1,category:U4e,keybinding:{weight:1e4,primary:9}})}runEditorCommand(i,e,...t){let o=dce(i);o instanceof op&&o.exitCompareMove()}},Lwt=class extends pl{constructor(){super({id:"diffEditor.collapseAllUnchangedRegions",title:L(197,"Collapse All Unchanged Regions"),icon:R.fold,precondition:C.has("isInDiffEditor"),f1:!0,category:U4e})}runEditorCommand(i,e,...t){let o=dce(i);o instanceof op&&o.collapseAllUnchangedRegions()}},Rwt=class extends pl{constructor(){super({id:"diffEditor.showAllUnchangedRegions",title:L(203,"Show All Unchanged Regions"),icon:R.unfold,precondition:C.has("isInDiffEditor"),f1:!0,category:U4e})}runEditorCommand(i,e,...t){let o=dce(i);o instanceof op&&o.showAllUnchangedRegions()}},txe=class extends K{constructor(){super({id:"diffEditor.revert",title:L(202,"Revert"),f1:!0,category:U4e,precondition:C.has("isInDiffEditor")})}run(i,e){return e?this.runViaToolbarContext(i,e):this.runViaCursorOrSelection(i)}runViaCursorOrSelection(i){let e=dce(i);e instanceof op&&e.revertFocusedRangeMappings()}runViaToolbarContext(i,e){let t=x1o(i,e.originalUri,e.modifiedUri);t instanceof op&&t.revertRangeMappings(e.mapping.innerChanges??[])}},J6i=L(196,"Accessible Diff Viewer"),Lz=class a extends K{static{this.id="editor.action.accessibleDiffViewer.next"}constructor(){super({id:a.id,title:L(199,"Go to Next Difference"),category:J6i,precondition:C.has("isInDiffEditor"),keybinding:{primary:65,weight:100},f1:!0})}run(i){dce(i)?.accessibleDiffViewerNext()}},cce=class a extends K{static{this.id="editor.action.accessibleDiffViewer.prev"}constructor(){super({id:a.id,title:L(200,"Go to Previous Difference"),category:J6i,precondition:C.has("isInDiffEditor"),keybinding:{primary:1089,weight:100},f1:!0})}run(i){dce(i)?.accessibleDiffViewerPrev()}};function x1o(a,i,e){return a.get(qt).listDiffEditors().find(n=>{let r=n.getModifiedEditor(),s=n.getOriginalEditor();return r&&r.getModel()?.uri.toString()===e.toString()&&s&&s.getModel()?.uri.toString()===i.toString()})||null}function dce(a){let e=a.get(qt).listDiffEditors(),t=Nn();if(t){for(let o of e)if(o.getContainerDomNode().contains(t))return o}return null}function Mwt(a,i){if(!i.getOption(70))return null;let e=a.get(qt);for(let t of e.listDiffEditors()){let o=t.getOriginalEditor(),n=t.getModifiedEditor();if(o===i||n===i)return t}return null}W(Twt);W(B4e);W(H4e);ve.appendMenuItem(D.EditorTitle,{command:{id:new H4e().desc.id,title:d(234,null),toggled:C.has("config.diffEditor.useInlineViewWhenSpaceIsLimited"),precondition:C.has("isInDiffEditor")},order:11,group:"1_diff",when:C.and(pe.diffEditorRenderSideBySideInlineBreakpointReached,C.has("isInDiffEditor"))});ve.appendMenuItem(D.EditorTitle,{command:{id:new B4e().desc.id,title:d(233,null),icon:R.move,toggled:wV.create("config.diffEditor.experimental.showMoves",!0),precondition:C.has("isInDiffEditor")},order:10,group:"1_diff",when:C.has("isInDiffEditor")});W(txe);for(let a of[{icon:R.arrowRight,key:pe.diffEditorInlineMode.toNegated()},{icon:R.discard,key:pe.diffEditorInlineMode}])ve.appendMenuItem(D.DiffEditorHunkToolbar,{command:{id:new txe().desc.id,title:d(231,null),icon:a.icon},when:C.and(pe.diffEditorModifiedWritable,a.key),order:5,group:"primary"}),ve.appendMenuItem(D.DiffEditorSelectionToolbar,{command:{id:new txe().desc.id,title:d(232,null),icon:a.icon},when:C.and(pe.diffEditorModifiedWritable,a.key),order:5,group:"primary"});W(_wt);W(Dwt);W(Lwt);W(Rwt);ve.appendMenuItem(D.EditorTitle,{command:{id:Lz.id,title:d(230,null),precondition:C.has("isInDiffEditor")},order:10,group:"2_diff",when:C.and(pe.accessibleDiffViewerVisible.negate(),C.has("isInDiffEditor"))});$e.registerCommandAlias("editor.action.diffReview.next",Lz.id);W(Lz);$e.registerCommandAlias("editor.action.diffReview.prev",cce.id);W(cce);var Pwt=new Y("selectionAnchorSet",!1),YO=class{constructor(i,e){this.editor=i;this.selectionAnchorSetContextKey=Pwt.bindTo(e),this.modelChangeListener=i.onDidChangeModel(()=>this.selectionAnchorSetContextKey.reset())}static{this.ID="editor.contrib.selectionAnchorController"}static get(i){return i.getContribution(YO.ID)}setSelectionAnchor(){if(this.editor.hasModel()){let i=this.editor.getPosition();this.editor.changeDecorations(e=>{this.decorationId&&e.removeDecoration(this.decorationId),this.decorationId=e.addDecoration(ti.fromPositions(i,i),{description:"selection-anchor",stickiness:1,hoverMessage:new Ie().appendText(d(966,null)),className:"selection-anchor"})}),this.selectionAnchorSetContextKey.set(!!this.decorationId),en(d(962,null,i.lineNumber,i.column))}}goToSelectionAnchor(){if(this.editor.hasModel()&&this.decorationId){let i=this.editor.getModel().getDecorationRange(this.decorationId);i&&this.editor.setPosition(i.getStartPosition())}}selectFromAnchorToCursor(){if(this.editor.hasModel()&&this.decorationId){let i=this.editor.getModel().getDecorationRange(this.decorationId);if(i){let e=this.editor.getPosition();this.editor.setSelection(ti.fromPositions(i.getStartPosition(),e)),this.cancelSelectionAnchor()}}}cancelSelectionAnchor(){if(this.decorationId){let i=this.decorationId;this.editor.changeDecorations(e=>{e.removeDecoration(i),this.decorationId=void 0}),this.selectionAnchorSetContextKey.set(!1)}}dispose(){this.cancelSelectionAnchor(),this.modelChangeListener.dispose()}};YO=I([m(1,X)],YO);var Zri=class extends Di{constructor(){super({id:"editor.action.setSelectionAnchor",label:L(967,"Set Selection Anchor"),precondition:void 0,kbOpts:{kbExpr:pe.editorTextFocus,primary:Vi(2089,2080),weight:100}})}async run(i,e){YO.get(e)?.setSelectionAnchor()}},esi=class extends Di{constructor(){super({id:"editor.action.goToSelectionAnchor",label:L(964,"Go to Selection Anchor"),precondition:Pwt})}async run(i,e){YO.get(e)?.goToSelectionAnchor()}},tsi=class extends Di{constructor(){super({id:"editor.action.selectFromAnchorToCursor",label:L(965,"Select from Anchor to Cursor"),precondition:Pwt,kbOpts:{kbExpr:pe.editorTextFocus,primary:Vi(2089,2089),weight:100}})}async run(i,e){YO.get(e)?.selectFromAnchorToCursor()}},isi=class extends Di{constructor(){super({id:"editor.action.cancelSelectionAnchor",label:L(963,"Cancel Selection Anchor"),precondition:Pwt,kbOpts:{kbExpr:pe.editorTextFocus,primary:9,weight:100}})}async run(i,e){YO.get(e)?.cancelSelectionAnchor()}};xo(YO.ID,YO,4);ni(Zri);ni(esi);ni(tsi);ni(isi);var k1o=te("editorOverviewRuler.bracketMatchForeground","#A0A0A0",d(969,null)),osi=class extends Di{constructor(){super({id:"editor.action.jumpToBracket",label:L(970,"Go to Bracket"),precondition:void 0,kbOpts:{kbExpr:pe.editorTextFocus,primary:3165,weight:100}})}run(i,e){Rz.get(e)?.jumpToBracket()}},nsi=class extends Di{constructor(){super({id:"editor.action.selectToBracket",label:L(972,"Select to Bracket"),precondition:void 0,metadata:{description:L(973,"Select the text inside and including the brackets or curly braces"),args:[{name:"args",schema:{type:"object",properties:{selectBrackets:{type:"boolean",default:!0}}}}]}})}run(i,e,t){let o=!0;t&&t.selectBrackets===!1&&(o=!1),Rz.get(e)?.selectToBracket(o)}},rsi=class extends Di{constructor(){super({id:"editor.action.removeBrackets",label:L(971,"Remove Brackets"),precondition:void 0,kbOpts:{kbExpr:pe.editorTextFocus,primary:2561,weight:100},canTriggerInlineEdits:!0})}run(i,e){Rz.get(e)?.removeBrackets(this.id)}},ssi=class{constructor(i,e,t){this.position=i,this.brackets=e,this.options=t}},Rz=class a extends x{static{this.ID="editor.contrib.bracketMatchingController"}static get(i){return i.getContribution(a.ID)}constructor(i){super(),this._editor=i,this._lastBracketsData=[],this._lastVersionId=0,this._decorations=this._editor.createDecorationsCollection(),this._updateBracketsSoon=this._register(new Dt(()=>this._updateBrackets(),50)),this._matchBrackets=this._editor.getOption(80),this._updateBracketsSoon.schedule(),this._register(i.onDidChangeCursorPosition(e=>{this._matchBrackets!=="never"&&this._updateBracketsSoon.schedule()})),this._register(i.onDidChangeModelContent(e=>{this._updateBracketsSoon.schedule()})),this._register(i.onDidChangeModel(e=>{this._lastBracketsData=[],this._updateBracketsSoon.schedule()})),this._register(i.onDidChangeModelLanguageConfiguration(e=>{this._lastBracketsData=[],this._updateBracketsSoon.schedule()})),this._register(i.onDidChangeConfiguration(e=>{e.hasChanged(80)&&(this._matchBrackets=this._editor.getOption(80),this._decorations.clear(),this._lastBracketsData=[],this._lastVersionId=0,this._updateBracketsSoon.schedule())})),this._register(i.onDidBlurEditorWidget(()=>{this._updateBracketsSoon.schedule()})),this._register(i.onDidFocusEditorWidget(()=>{this._updateBracketsSoon.schedule()}))}jumpToBracket(){if(!this._editor.hasModel())return;let i=this._editor.getModel(),e=this._editor.getSelections().map(t=>{let o=t.getStartPosition(),n=i.bracketPairs.matchBracket(o),r=null;if(n)n[0].containsPosition(o)&&!n[1].containsPosition(o)?r=n[1].getStartPosition():n[1].containsPosition(o)&&(r=n[0].getStartPosition());else{let s=i.bracketPairs.findEnclosingBrackets(o);if(s)r=s[1].getStartPosition();else{let l=i.bracketPairs.findNextBracket(o);l&&l.range&&(r=l.range.getStartPosition())}}return r?new ti(r.lineNumber,r.column,r.lineNumber,r.column):new ti(o.lineNumber,o.column,o.lineNumber,o.column)});this._editor.setSelections(e),this._editor.revealRange(e[0])}selectToBracket(i){if(!this._editor.hasModel())return;let e=this._editor.getModel(),t=[];this._editor.getSelections().forEach(o=>{let n=o.getStartPosition(),r=e.bracketPairs.matchBracket(n);if(!r&&(r=e.bracketPairs.findEnclosingBrackets(n),!r)){let c=e.bracketPairs.findNextBracket(n);c&&c.range&&(r=e.bracketPairs.matchBracket(c.range.getStartPosition()))}let s=null,l=null;if(r){r.sort(z.compareRangesUsingStarts);let[c,u]=r;if(s=i?c.getStartPosition():c.getEndPosition(),l=i?u.getEndPosition():u.getStartPosition(),u.containsPosition(n)){let p=s;s=l,l=p}}s&&l&&t.push(new ti(s.lineNumber,s.column,l.lineNumber,l.column))}),t.length>0&&(this._editor.setSelections(t),this._editor.revealRange(t[0]))}removeBrackets(i){if(!this._editor.hasModel())return;let e=this._editor.getModel();this._editor.getSelections().forEach(t=>{let o=t.getPosition(),n=e.bracketPairs.matchBracket(o);n||(n=e.bracketPairs.findEnclosingBrackets(o)),n&&(this._editor.pushUndoStop(),this._editor.executeEdits(i,[{range:n[0],text:""},{range:n[1],text:""}]),this._editor.pushUndoStop())})}static{this._DECORATION_OPTIONS_WITH_OVERVIEW_RULER=mo.register({description:"bracket-match-overview",stickiness:1,className:"bracket-match",inlineClassName:"bracket-match-inline",overviewRuler:{color:Xs(k1o),position:2}})}static{this._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER=mo.register({description:"bracket-match-no-overview",stickiness:1,className:"bracket-match",inlineClassName:"bracket-match-inline"})}_updateBrackets(){if(this._matchBrackets==="never")return;this._recomputeBrackets();let i=[],e=0;for(let t of this._lastBracketsData){let o=t.brackets;o&&(i[e++]={range:o[0],options:t.options},i[e++]={range:o[1],options:t.options})}this._decorations.set(i)}_recomputeBrackets(){if(!this._editor.hasModel()||!this._editor.hasWidgetFocus()){this._lastBracketsData=[],this._lastVersionId=0;return}let i=this._editor.getSelections();if(i.length>100){this._lastBracketsData=[],this._lastVersionId=0;return}let e=this._editor.getModel(),t=e.getVersionId(),o=[];this._lastVersionId===t&&(o=this._lastBracketsData);let n=[],r=0;for(let p=0,h=i.length;p<h;p++){let g=i[p];g.isEmpty()&&(n[r++]=g.getStartPosition())}n.length>1&&n.sort(ye.compare);let s=[],l=0,c=0,u=o.length;for(let p=0,h=n.length;p<h;p++){let g=n[p];for(;c<u&&o[c].position.isBefore(g);)c++;if(c<u&&o[c].position.equals(g))s[l++]=o[c];else{let f=e.bracketPairs.matchBracket(g,20),v=a._DECORATION_OPTIONS_WITH_OVERVIEW_RULER;!f&&this._matchBrackets==="always"&&(f=e.bracketPairs.findEnclosingBrackets(g,20),v=a._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER),s[l++]=new ssi(g,f,v)}}this._lastBracketsData=s,this._lastVersionId=t}};xo(Rz.ID,Rz,1);ni(nsi);ni(osi);ni(rsi);ve.appendMenuItem(D.MenubarGoMenu,{group:"5_infile_nav",command:{id:"editor.action.jumpToBracket",title:d(968,null)},order:2});is((a,i)=>{let e=a.getColor(_3i);e&&i.addRule(`.monaco-editor .bracket-match-inline { color: ${e} !important; }`)});var Awt=class{constructor(i,e){this._selection=i,this._isMovingLeft=e}getEditOperations(i,e){if(this._selection.startLineNumber!==this._selection.endLineNumber||this._selection.isEmpty())return;let t=this._selection.startLineNumber,o=this._selection.startColumn,n=this._selection.endColumn;if(!(this._isMovingLeft&&o===1)&&!(!this._isMovingLeft&&n===i.getLineMaxColumn(t)))if(this._isMovingLeft){let r=new z(t,o-1,t,o),s=i.getValueInRange(r);e.addEditOperation(r,null),e.addEditOperation(new z(t,n,t,n),s)}else{let r=new z(t,n,t,n+1),s=i.getValueInRange(r);e.addEditOperation(r,null),e.addEditOperation(new z(t,o,t,o),s)}}computeCursorState(i,e){return this._isMovingLeft?new ti(this._selection.startLineNumber,this._selection.startColumn-1,this._selection.endLineNumber,this._selection.endColumn-1):new ti(this._selection.startLineNumber,this._selection.startColumn+1,this._selection.endLineNumber,this._selection.endColumn+1)}};var Nwt=class extends Di{constructor(i,e){super(e),this.left=i}run(i,e){if(!e.hasModel())return;let t=[],o=e.getSelections();for(let n of o)t.push(new Awt(n,this.left));e.pushUndoStop(),e.executeCommands(this.id,t),e.pushUndoStop()}},asi=class extends Nwt{constructor(){super(!0,{id:"editor.action.moveCarretLeftAction",label:L(974,"Move Selected Text Left"),precondition:pe.writable})}},lsi=class extends Nwt{constructor(){super(!1,{id:"editor.action.moveCarretRightAction",label:L(975,"Move Selected Text Right"),precondition:pe.writable})}};ni(asi);ni(lsi);var csi=class extends Di{constructor(){super({id:"editor.action.transposeLetters",label:L(976,"Transpose Letters"),precondition:pe.writable,kbOpts:{kbExpr:pe.textInputFocus,primary:0,mac:{primary:306},weight:100}})}run(i,e){if(!e.hasModel())return;let t=e.getModel(),o=[],n=e.getSelections();for(let r of n){if(!r.isEmpty())continue;let s=r.startLineNumber,l=r.startColumn,c=t.getLineMaxColumn(s);if(s===1&&(l===1||l===2&&c===2))continue;let u=l===c?r.getPosition():Mu.rightPosition(t,r.getPosition().lineNumber,r.getPosition().column),p=Mu.leftPosition(t,u),h=Mu.leftPosition(t,p),g=t.getValueInRange(z.fromPositions(h,p)),f=t.getValueInRange(z.fromPositions(p,u)),v=z.fromPositions(h,u);o.push(new qh(v,f+g))}o.length>0&&(e.pushUndoStop(),e.executeCommands(this.id,o),e.pushUndoStop())}};ni(csi);var fs=class a{constructor(i){this.value=i}static{this.sep="."}static{this.None=new a("@@none@@")}static{this.Empty=new a("")}equals(i){return this.value===i.value}contains(i){return this.equals(i)||this.value===""||i.value.startsWith(this.value+a.sep)}intersects(i){return this.contains(i)||i.contains(this)}append(...i){return new a((this.value?[this.value,...i]:i).join(a.sep))}};function Z6i(a){return a.ctrlCmd||a.alt||a.shift}var e9i={ctrlCmd:!1,alt:!1,shift:!1};var z4e=class{constructor(i){this.options=i}getItemLabel(i){return i.label}getItemDescription(i){if(!this.options?.skipDescription)return i.description}getItemPath(i){if(!this.options?.skipPath)return i.resource?.scheme===Q.file?i.resource.fsPath:i.resource?.path}},EY=new z4e,Ue=le("quickInputService");var La=le("IWorkspaceEditService"),TY=class{constructor(i){this.metadata=i}static convert(i){return i.edits.map(e=>{if(nl.is(e))return nl.lift(e);if(Cu.is(e))return Cu.lift(e);throw new Error("Unsupported edit")})}},nl=class a extends TY{constructor(e,t,o=void 0,n){super(n);this.resource=e;this.textEdit=t;this.versionId=o}static is(e){return e instanceof a?!0:xi(e)&&A.isUri(e.resource)&&xi(e.textEdit)}static lift(e){return e instanceof a?e:new a(e.resource,e.textEdit,e.versionId,e.metadata)}},Cu=class a extends TY{constructor(e,t,o={},n){super(n);this.oldResource=e;this.newResource=t;this.options=o}static is(e){return e instanceof a?!0:xi(e)&&(!!e.newResource||!!e.oldResource)}static lift(e){return e instanceof a?e:new a(e.oldResource,e.newResource,e.options,e.metadata)}};var dsi=le("IEditorCancelService"),t9i=new Y("cancellableOperation",!1,d(1098,null));Ee(dsi,class{constructor(){this._tokens=new WeakMap}add(a,i){let e=this._tokens.get(a);e||(e=a.invokeWithinContext(o=>{let n=t9i.bindTo(o.get(X)),r=new qs;return{key:n,tokens:r}}),this._tokens.set(a,e));let t;return e.key.set(!0),t=e.tokens.push(i),()=>{t&&(t(),e.key.set(!e.tokens.isEmpty()),t=void 0)}}cancel(a){let i=this._tokens.get(a);if(!i)return;let e=i.tokens.pop();e&&(e.cancel(),i.key.set(!i.tokens.isEmpty()))}},1);var Owt=class extends Ye{constructor(e,t){super(t);this.editor=e;this._unregister=e.invokeWithinContext(o=>o.get(dsi).add(e,this))}dispose(){this._unregister(),super.dispose()}};Xi(new class extends Oc{constructor(){super({id:"editor.cancelOperation",kbOpts:{weight:100,primary:9},precondition:t9i})}runEditorCommand(a,i){a.get(dsi).cancel(i)}});var Mz=class a{constructor(i,e){if(this.flags=e,(this.flags&1)!==0){let t=i.getModel();this.modelVersionId=t?vd("{0}#{1}",t.uri.toString(),t.getVersionId()):null}else this.modelVersionId=null;(this.flags&4)!==0?this.position=i.getPosition():this.position=null,(this.flags&2)!==0?this.selection=i.getSelection():this.selection=null,(this.flags&8)!==0?(this.scrollLeft=i.getScrollLeft(),this.scrollTop=i.getScrollTop()):(this.scrollLeft=-1,this.scrollTop=-1)}_equals(i){if(!(i instanceof a))return!1;let e=i;return!(this.modelVersionId!==e.modelVersionId||this.scrollLeft!==e.scrollLeft||this.scrollTop!==e.scrollTop||!this.position&&e.position||this.position&&!e.position||this.position&&e.position&&!this.position.equals(e.position)||!this.selection&&e.selection||this.selection&&!e.selection||this.selection&&e.selection&&!this.selection.equalsRange(e.selection))}validate(i){return this._equals(new a(i,this.flags))}},ek=class extends Owt{constructor(e,t,o,n){super(e,n);this._listener=new N;t&4&&this._listener.add(e.onDidChangeCursorPosition(r=>{(!o||!z.containsPosition(o,r.position))&&this.cancel()})),t&2&&this._listener.add(e.onDidChangeCursorSelection(r=>{(!o||!z.containsRange(o,r.selection))&&this.cancel()})),t&8&&this._listener.add(e.onDidScrollChange(r=>this.cancel())),t&1&&(this._listener.add(e.onDidChangeModel(r=>this.cancel())),this._listener.add(e.onDidChangeModelContent(r=>this.cancel())))}dispose(){this._listener.dispose(),super.dispose()}},uce=class extends Ye{constructor(i,e){super(e),this._listener=i.onDidChangeContent(()=>this.cancel())}dispose(){this._listener.dispose(),super.dispose()}};var E1o=mo.register({description:"inline-progress-widget",stickiness:1,showIfCollapsed:!0,after:{content:eO,inlineClassName:"inline-editor-progress-decoration",inlineClassNameAffectsLetterSpacing:!0}}),usi=class a extends x{constructor(e,t,o,n,r){super();this.typeId=e;this.editor=t;this.range=o;this.delegate=r;this.allowEditorOverflow=!1;this.suppressMouseDown=!0;this.create(n),this.editor.addContentWidget(this),this.editor.layoutContentWidget(this)}static{this.baseId="editor.widget.inlineProgressWidget"}create(e){this.domNode=_(".inline-progress-widget"),this.domNode.role="button",this.domNode.title=e;let t=_("span.icon");this.domNode.append(t),t.classList.add(...q.asClassNameArray(R.loading),"codicon-modifier-spin");let o=()=>{let n=this.editor.getOption(75);this.domNode.style.height=`${n}px`,this.domNode.style.width=`${Math.ceil(.8*n)}px`};o(),this._register(this.editor.onDidChangeConfiguration(n=>{(n.hasChanged(61)||n.hasChanged(75))&&o()})),this._register(j(this.domNode,re.CLICK,n=>{this.delegate.cancel()}))}getId(){return a.baseId+"."+this.typeId}getDomNode(){return this.domNode}getPosition(){return{position:{lineNumber:this.range.startLineNumber,column:this.range.startColumn},preference:[0]}}dispose(){super.dispose(),this.editor.removeContentWidget(this)}},_Y=class extends x{constructor(e,t,o){super();this.id=e;this._editor=t;this._instantiationService=o;this._showDelay=500;this._showPromise=this._register(new me);this._currentWidget=this._register(new me);this._operationIdPool=0;this._currentDecorations=t.createDecorationsCollection()}dispose(){super.dispose(),this._currentDecorations.clear()}async showWhile(e,t,o,n,r){let s=this._operationIdPool++;this._currentOperation=s,this.clear(),this._showPromise.value=tn(()=>{let l=z.fromPositions(e);this._currentDecorations.set([{range:l,options:E1o}]).length>0&&(this._currentWidget.value=this._instantiationService.createInstance(usi,this.id,this._editor,l,t,n))},r??this._showDelay);try{return await o}finally{this._currentOperation===s&&(this.clear(),this._currentOperation=void 0)}}clear(){this._showPromise.clear(),this._currentDecorations.clear(),this._currentWidget.clear()}};_Y=I([m(2,F)],_Y);var On=le("markdownRendererService"),K4e=class{constructor(i){this._openerService=i}render(i,e,t){let o={...e};o.actionHandler||(o.actionHandler=(r,s)=>U_(this._openerService,r,s.isTrusted)),o.codeBlockRenderer||(o.codeBlockRenderer=(r,s)=>this._defaultCodeBlockRenderer?.renderCodeBlock(r,s,o??{})??Promise.resolve(document.createElement("span")));let n=Gf(i,o,t);return n.element.classList.add("rendered-markdown"),n}setDefaultCodeBlockRenderer(i){this._defaultCodeBlockRenderer=i}};K4e=I([m(0,Je)],K4e);async function U_(a,i,e,t){try{return await a.open(i,{fromUserGesture:!0,allowContributedOpeners:!0,allowCommands:T1o(e),skipValidation:t})}catch(o){return mt(o),!1}}function T1o(a){return a===!0?!0:a&&Array.isArray(a.enabledCommands)?a.enabledCommands:!1}Ee(On,K4e,1);var xu=class{constructor(i,e,t){this._openerService=t;this._messageWidget=new me;this._messageListeners=new N;this._mouseOverMessage=!1;this._editor=i,this._visible=xu.MESSAGE_VISIBLE.bindTo(e)}static{this.ID="editor.contrib.messageController"}static{this.MESSAGE_VISIBLE=new Y("messageVisible",!1,d(1450,null))}static get(i){return i.getContribution(xu.ID)}dispose(){this._messageListeners.dispose(),this._messageWidget.dispose(),this._visible.reset()}isVisible(){return this._visible.get()}showMessage(i,e){if(en(Ar(i)?i.value:i),this._visible.set(!0),this._messageWidget.clear(),this._messageListeners.clear(),Ar(i)){let o=this._messageListeners.add(Gf(i,{actionHandler:(n,r)=>{this.closeMessage(),U_(this._openerService,n,r.isTrusted)}}));this._messageWidget.value=new G4e(this._editor,e,o.element)}else this._messageWidget.value=new G4e(this._editor,e,i);this._messageListeners.add(U.debounce(this._editor.onDidBlurEditorText,(o,n)=>n,0)(()=>{this._mouseOverMessage||this._messageWidget.value&&ts(Nn(),this._messageWidget.value.getDomNode())||this.closeMessage()})),this._messageListeners.add(this._editor.onDidChangeCursorPosition(()=>this.closeMessage())),this._messageListeners.add(this._editor.onDidDispose(()=>this.closeMessage())),this._messageListeners.add(this._editor.onDidChangeModel(()=>this.closeMessage())),this._messageListeners.add(j(this._messageWidget.value.getDomNode(),re.MOUSE_ENTER,()=>this._mouseOverMessage=!0,!0)),this._messageListeners.add(j(this._messageWidget.value.getDomNode(),re.MOUSE_LEAVE,()=>this._mouseOverMessage=!1,!0));let t;this._messageListeners.add(this._editor.onMouseMove(o=>{o.target.position&&(t?t.containsPosition(o.target.position)||this.closeMessage():t=new z(e.lineNumber-3,1,o.target.position.lineNumber+3,1))}))}closeMessage(){this._visible.reset(),this._messageListeners.clear(),this._messageWidget.value&&this._messageListeners.add(G4e.fadeOut(this._messageWidget.value))}};xu=I([m(1,X),m(2,Je)],xu);var _1o=Oc.bindToContribution(xu.get);Xi(new _1o({id:"leaveEditorMessage",precondition:xu.MESSAGE_VISIBLE,handler:a=>a.closeMessage(),kbOpts:{weight:130,primary:9}}));var G4e=class{constructor(i,{lineNumber:e,column:t},o){this.allowEditorOverflow=!0;this.suppressMouseDown=!1;this._editor=i,this._editor.revealLinesInCenterIfOutsideViewport(e,e,0),this._position={lineNumber:e,column:t},this._domNode=document.createElement("div"),this._domNode.classList.add("monaco-editor-overlaymessage"),this._domNode.style.marginLeft="-6px";let n=document.createElement("div");n.classList.add("anchor","top"),this._domNode.appendChild(n);let r=document.createElement("div");typeof o=="string"?(r.classList.add("message"),r.textContent=o):(o.classList.add("message"),r.appendChild(o)),this._domNode.appendChild(r);let s=document.createElement("div");s.classList.add("anchor","below"),this._domNode.appendChild(s),this._editor.addContentWidget(this),this._domNode.classList.add("fadeIn")}static fadeOut(i){let e=()=>{i.dispose(),clearTimeout(t),i.getDomNode().removeEventListener("animationend",e)},t=setTimeout(e,110);return i.getDomNode().addEventListener("animationend",e),i.getDomNode().classList.add("fadeOut"),{dispose:e}}dispose(){this._editor.removeContentWidget(this)}getId(){return"messageoverlay"}getDomNode(){return this._domNode}getPosition(){return{position:this._position,preference:[1,2],positionAffinity:1}}afterRender(i){this._domNode.classList.toggle("below",i===2)}};xo(xu.ID,xu,4);var q4e=class{constructor(i){this.copyMimeTypes=[];this.kind=i,this.providedDropEditKinds=[this.kind],this.providedPasteEditKinds=[this.kind]}async provideDocumentPasteEdits(i,e,t,o,n){let r=await this.getEdit(t,n);if(r)return{edits:[{insertText:r.insertText,title:r.title,kind:r.kind,handledMimeType:r.handledMimeType,yieldTo:r.yieldTo}],dispose(){}}}async provideDocumentDropEdits(i,e,t,o){let n=await this.getEdit(t,o);if(n)return{edits:[{insertText:n.insertText,title:n.title,kind:n.kind,handledMimeType:n.handledMimeType,yieldTo:n.yieldTo}],dispose(){}}}},Zj=class a extends q4e{constructor(){super(fs.Empty.append("text","plain"));this.id=a.id;this.dropMimeTypes=[tr.text];this.pasteMimeTypes=[tr.text]}static{this.id="text"}async getEdit(e,t){let o=e.get(tr.text);if(!o||e.has(tr.uriList))return;let n=await o.asString();return{handledMimeType:tr.text,title:d(1092,null),insertText:n,kind:this.kind}}},Fwt=class extends q4e{constructor(){super(fs.Empty.append("uri","path","absolute"));this.dropMimeTypes=[tr.uriList];this.pasteMimeTypes=[tr.uriList]}async getEdit(e,t){let o=await i9i(e);if(!o.length||t.isCancellationRequested)return;let n=0,r=o.map(({uri:l,originalText:c})=>l.scheme===Q.file?l.fsPath:(n++,c)).join(" "),s;return n>0?s=o.length>1?d(1090,null):d(1089,null):s=o.length>1?d(1086,null):d(1085,null),{handledMimeType:tr.uriList,insertText:r,title:s,kind:this.kind}}},ixe=class extends q4e{constructor(e){super(fs.Empty.append("uri","path","relative"));this._workspaceContextService=e;this.dropMimeTypes=[tr.uriList];this.pasteMimeTypes=[tr.uriList]}async getEdit(e,t){let o=await i9i(e);if(!o.length||t.isCancellationRequested)return;let n=di(o.map(({uri:r})=>{let s=this._workspaceContextService.getWorkspaceFolder(r);return s?Wd(s.uri,r):void 0}));if(n.length)return{handledMimeType:tr.uriList,insertText:n.join(" "),title:o.length>1?d(1088,null):d(1087,null),kind:this.kind}}};ixe=I([m(0,Pe)],ixe);var psi=class{constructor(){this.kind=new fs("html");this.providedPasteEditKinds=[this.kind];this.copyMimeTypes=[];this.pasteMimeTypes=["text/html"];this._yieldTo=[{mimeType:tr.text}]}async provideDocumentPasteEdits(i,e,t,o,n){if(o.triggerKind!==1&&!o.only?.contains(this.kind))return;let s=await t.get("text/html")?.asString();if(!(!s||n.isCancellationRequested))return{dispose(){},edits:[{insertText:s,yieldTo:this._yieldTo,title:d(1091,null),kind:this.kind}]}}};async function i9i(a){let i=a.get(tr.uriList);if(!i)return[];let e=await i.asString(),t=[];for(let o of aw.parse(e))try{t.push({uri:A.parse(o),originalText:o})}catch{}return t}var pce={scheme:"*",hasAccessToAllModels:!0},oxe=class extends x{constructor(i,e){super(),this._register(i.documentDropEditProvider.register(pce,new Zj)),this._register(i.documentDropEditProvider.register(pce,new Fwt)),this._register(i.documentDropEditProvider.register(pce,new ixe(e)))}};oxe=I([m(0,Qt),m(1,Pe)],oxe);var nxe=class extends x{constructor(i,e){super(),this._register(i.documentPasteEditProvider.register(pce,new Zj)),this._register(i.documentPasteEditProvider.register(pce,new Fwt)),this._register(i.documentPasteEditProvider.register(pce,new ixe(e))),this._register(i.documentPasteEditProvider.register(pce,new psi))}};nxe=I([m(0,Qt),m(1,Pe)],nxe);var msi=class a{constructor(){this.value="";this.pos=0}static{this._table={36:0,58:1,44:2,123:3,125:4,92:5,47:6,124:7,43:11,45:12,63:13}}static isDigitCharacter(i){return i>=48&&i<=57}static isVariableCharacter(i){return i===95||i>=97&&i<=122||i>=65&&i<=90}text(i){this.value=i,this.pos=0}tokenText(i){return this.value.substr(i.pos,i.len)}next(){if(this.pos>=this.value.length)return{type:14,pos:this.pos,len:0};let i=this.pos,e=0,t=this.value.charCodeAt(i),o;if(o=a._table[t],typeof o=="number")return this.pos+=1,{type:o,pos:i,len:1};if(a.isDigitCharacter(t)){o=8;do e+=1,t=this.value.charCodeAt(i+e);while(a.isDigitCharacter(t));return this.pos+=e,{type:o,pos:i,len:e}}if(a.isVariableCharacter(t)){o=9;do t=this.value.charCodeAt(i+ ++e);while(a.isVariableCharacter(t)||a.isDigitCharacter(t));return this.pos+=e,{type:o,pos:i,len:e}}o=10;do e+=1,t=this.value.charCodeAt(i+e);while(!isNaN(t)&&typeof a._table[t]>"u"&&!a.isDigitCharacter(t)&&!a.isVariableCharacter(t));return this.pos+=e,{type:o,pos:i,len:e}}},DY=class{constructor(){this._children=[]}appendChild(i){return i instanceof pS&&this._children[this._children.length-1]instanceof pS?this._children[this._children.length-1].value+=i.value:(i.parent=this,this._children.push(i)),this}replace(i,e){let{parent:t}=i,o=t.children.indexOf(i),n=t.children.slice(0);n.splice(o,1,...e),t._children=n,(function r(s,l){for(let c of s)c.parent=l,r(c.children,c)})(e,t)}get children(){return this._children}get rightMostDescendant(){return this._children.length>0?this._children[this._children.length-1].rightMostDescendant:this}get snippet(){let i=this;for(;;){if(!i)return;if(i instanceof rxe)return i;i=i.parent}}toString(){return this.children.reduce((i,e)=>i+e.toString(),"")}len(){return 0}},pS=class a extends DY{constructor(e){super();this.value=e}static escape(e){return e.replace(/\$|}|\\/g,"\\$&")}toString(){return this.value}toTextmateString(){return a.escape(this.value)}len(){return this.value.length}clone(){return new a(this.value)}},Wwt=class extends DY{},tk=class a extends Wwt{constructor(e){super();this.index=e}static compareByIndex(e,t){return e.index===t.index?0:e.isFinalTabstop?1:t.isFinalTabstop||e.index<t.index?-1:e.index>t.index?1:0}get isFinalTabstop(){return this.index===0}get choice(){return this._children.length===1&&this._children[0]instanceof mce?this._children[0]:void 0}toTextmateString(){let e="";return this.transform&&(e=this.transform.toTextmateString()),this.children.length===0&&!this.transform?`$${this.index}`:this.children.length===0?`\${${this.index}${e}}`:this.choice?`\${${this.index}|${this.choice.toTextmateString()}|${e}}`:`\${${this.index}:${this.children.map(t=>t.toTextmateString()).join("")}${e}}`}clone(){let e=new a(this.index);return this.transform&&(e.transform=this.transform.clone()),e._children=this.children.map(t=>t.clone()),e}},mce=class a extends DY{constructor(){super(...arguments);this.options=[]}appendChild(e){return e instanceof pS&&(e.parent=this,this.options.push(e)),this}toString(){return this.options[0].value}toTextmateString(){return this.options.map(e=>e.value.replace(/\||,|\\/g,"\\$&")).join(",")}len(){return this.options[0].len()}clone(){let e=new a;return this.options.forEach(e.appendChild,e),e}},hsi=class a extends DY{constructor(){super(...arguments);this.regexp=new RegExp("")}resolve(e){let t=this,o=!1,n=e.replace(this.regexp,function(){return o=!0,t._replace(Array.prototype.slice.call(arguments,0,-2))});return!o&&this._children.some(r=>r instanceof qV&&!!r.elseValue)&&(n=this._replace([])),n}_replace(e){let t="";for(let o of this._children)if(o instanceof qV){let n=e[o.index]||"";n=o.resolve(n),t+=n}else t+=o.toString();return t}toString(){return""}toTextmateString(){return`/${this.regexp.source}/${this.children.map(e=>e.toTextmateString())}/${(this.regexp.ignoreCase?"i":"")+(this.regexp.global?"g":"")}`}clone(){let e=new a;return e.regexp=new RegExp(this.regexp.source,(this.regexp.ignoreCase?"i":"")+(this.regexp.global?"g":"")),e._children=this.children.map(t=>t.clone()),e}},qV=class a extends DY{constructor(e,t,o,n){super();this.index=e;this.shorthandName=t;this.ifValue=o;this.elseValue=n}resolve(e){return this.shorthandName==="upcase"?e?e.toLocaleUpperCase():"":this.shorthandName==="downcase"?e?e.toLocaleLowerCase():"":this.shorthandName==="capitalize"?e?e[0].toLocaleUpperCase()+e.substr(1):"":this.shorthandName==="pascalcase"?e?this._toPascalCase(e):"":this.shorthandName==="camelcase"?e?this._toCamelCase(e):"":this.shorthandName==="kebabcase"?e?this._toKebabCase(e):"":this.shorthandName==="snakecase"?e?this._toSnakeCase(e):"":e&&typeof this.ifValue=="string"?this.ifValue:!e&&typeof this.elseValue=="string"?this.elseValue:e||""}_toKebabCase(e){if(!e.match(/[\p{L}0-9]+/gu))return e;if(!e.match(/[\p{L}0-9]/u))return e.trim().toLowerCase().replace(/^_+|_+$/g,"").replace(/[\s_]+/g,"-");let o=e.trim().replace(/^_+|_+$/g,""),n=o.match(/\p{Lu}{2,}(?=\p{Lu}\p{Ll}+[0-9]*|[\s_-]|$)|\p{Lu}?\p{Ll}+[0-9]*|\p{Lu}(?=\p{Lu}\p{Ll})|\p{Lu}(?=[\s_-]|$)|[0-9]+/gu);return n?n.map(r=>r.toLowerCase()).join("-"):o.split(/[\s_-]+/).filter(r=>r.length>0).map(r=>r.toLowerCase()).join("-")}_toPascalCase(e){let t=e.match(/[\p{L}0-9]+/gu);return t?t.map(o=>o.charAt(0).toUpperCase()+o.substr(1)).join(""):e}_toCamelCase(e){let t=e.match(/[\p{L}0-9]+/gu);return t?t.map((o,n)=>n===0?o.charAt(0).toLowerCase()+o.substr(1):o.charAt(0).toUpperCase()+o.substr(1)).join(""):e}_toSnakeCase(e){return e.replace(/(\p{Ll})(\p{Lu})/gu,"$1_$2").replace(/[\s\-]+/g,"_").toLowerCase()}toTextmateString(){let e="${";return e+=this.index,this.shorthandName?e+=`:/${this.shorthandName}`:this.ifValue&&this.elseValue?e+=`:?${this.ifValue}:${this.elseValue}`:this.ifValue?e+=`:+${this.ifValue}`:this.elseValue&&(e+=`:-${this.elseValue}`),e+="}",e}clone(){return new a(this.index,this.shorthandName,this.ifValue,this.elseValue)}},hce=class a extends Wwt{constructor(e){super();this.name=e}resolve(e){let t=e.resolve(this);return this.transform&&(t=this.transform.resolve(t||"")),t!==void 0?(this._children=[new pS(t)],!0):!1}toTextmateString(){let e="";return this.transform&&(e=this.transform.toTextmateString()),this.children.length===0?`\${${this.name}${e}}`:`\${${this.name}:${this.children.map(t=>t.toTextmateString()).join("")}${e}}`}clone(){let e=new a(this.name);return this.transform&&(e.transform=this.transform.clone()),e._children=this.children.map(t=>t.clone()),e}};function o9i(a,i){let e=[...a];for(;e.length>0;){let t=e.shift();if(!i(t))break;e.unshift(...t.children)}}var rxe=class a extends DY{get placeholderInfo(){if(!this._placeholders){let i=[],e;this.walk(function(t){return t instanceof tk&&(i.push(t),e=!e||e.index<t.index?t:e),!0}),this._placeholders={all:i,last:e}}return this._placeholders}get placeholders(){let{all:i}=this.placeholderInfo;return i}offset(i){let e=0,t=!1;return this.walk(o=>o===i?(t=!0,!1):(e+=o.len(),!0)),t?e:-1}fullLen(i){let e=0;return o9i([i],t=>(e+=t.len(),!0)),e}enclosingPlaceholders(i){let e=[],{parent:t}=i;for(;t;)t instanceof tk&&e.push(t),t=t.parent;return e}resolveVariables(i){return this.walk(e=>(e instanceof hce&&e.resolve(i)&&(this._placeholders=void 0),!0)),this}appendChild(i){return this._placeholders=void 0,super.appendChild(i)}replace(i,e){return this._placeholders=void 0,super.replace(i,e)}toTextmateString(){return this.children.reduce((i,e)=>i+e.toTextmateString(),"")}clone(){let i=new a;return this._children=this.children.map(e=>e.clone()),i}walk(i){o9i(this.children,i)}},eg=class a{constructor(){this._scanner=new msi;this._token={type:14,pos:0,len:0}}static escape(i){return i.replace(/\$|}|\\/g,"\\$&")}static asInsertText(i){return new a().parse(i).toString()}static guessNeedsClipboard(i){return/\${?CLIPBOARD/.test(i)}parse(i,e,t){let o=new rxe;return this.parseFragment(i,o),this.ensureFinalTabstop(o,t??!1,e??!1),o}parseFragment(i,e){let t=e.children.length;for(this._scanner.text(i),this._token=this._scanner.next();this._parse(e););let o=new Map,n=[];e.walk(l=>(l instanceof tk&&(l.isFinalTabstop?o.set(0,void 0):!o.has(l.index)&&l.children.length>0?o.set(l.index,l.children):n.push(l)),!0));let r=(l,c)=>{let u=o.get(l.index);if(!u)return;let p=new tk(l.index);p.transform=l.transform;for(let h of u){let g=h.clone();p.appendChild(g),g instanceof tk&&o.has(g.index)&&!c.has(g.index)&&(c.add(g.index),r(g,c),c.delete(g.index))}e.replace(l,[p])},s=new Set;for(let l of n)r(l,s);return e.children.slice(t)}ensureFinalTabstop(i,e,t){(e||t&&i.placeholders.length>0)&&(i.placeholders.find(n=>n.index===0)||i.appendChild(new tk(0)))}_accept(i,e){if(i===void 0||this._token.type===i){let t=e?this._scanner.tokenText(this._token):!0;return this._token=this._scanner.next(),t}return!1}_backTo(i){return this._scanner.pos=i.pos+i.len,this._token=i,!1}_until(i){let e=this._token;for(;this._token.type!==i;){if(this._token.type===14)return!1;if(this._token.type===5){let o=this._scanner.next();if(o.type!==0&&o.type!==4&&o.type!==5)return!1}this._token=this._scanner.next()}let t=this._scanner.value.substring(e.pos,this._token.pos).replace(/\\(\$|}|\\)/g,"$1");return this._token=this._scanner.next(),t}_parse(i){return this._parseEscaped(i)||this._parseTabstopOrVariableName(i)||this._parseComplexPlaceholder(i)||this._parseComplexVariable(i)||this._parseAnything(i)}_parseEscaped(i){let e;return(e=this._accept(5,!0))?(e=this._accept(0,!0)||this._accept(4,!0)||this._accept(5,!0)||e,i.appendChild(new pS(e)),!0):!1}_parseTabstopOrVariableName(i){let e,t=this._token;return this._accept(0)&&(e=this._accept(9,!0)||this._accept(8,!0))?(i.appendChild(/^\d+$/.test(e)?new tk(Number(e)):new hce(e)),!0):this._backTo(t)}_parseComplexPlaceholder(i){let e,t=this._token;if(!(this._accept(0)&&this._accept(3)&&(e=this._accept(8,!0))))return this._backTo(t);let n=new tk(Number(e));if(this._accept(1))for(;;){if(this._accept(4))return i.appendChild(n),!0;if(!this._parse(n))return i.appendChild(new pS("${"+e+":")),n.children.forEach(i.appendChild,i),!0}else if(n.index>0&&this._accept(7)){let r=new mce;for(;;){if(this._parseChoiceElement(r)){if(this._accept(2))continue;if(this._accept(7)&&(n.appendChild(r),this._accept(4)))return i.appendChild(n),!0}return this._backTo(t),!1}}else return this._accept(6)?this._parseTransform(n)?(i.appendChild(n),!0):(this._backTo(t),!1):this._accept(4)?(i.appendChild(n),!0):this._backTo(t)}_parseChoiceElement(i){let e=this._token,t=[];for(;!(this._token.type===2||this._token.type===7);){let o;if((o=this._accept(5,!0))?o=this._accept(2,!0)||this._accept(7,!0)||this._accept(5,!0)||o:o=this._accept(void 0,!0),!o)return this._backTo(e),!1;t.push(o)}return t.length===0?(this._backTo(e),!1):(i.appendChild(new pS(t.join(""))),!0)}_parseComplexVariable(i){let e,t=this._token;if(!(this._accept(0)&&this._accept(3)&&(e=this._accept(9,!0))))return this._backTo(t);let n=new hce(e);if(this._accept(1))for(;;){if(this._accept(4))return i.appendChild(n),!0;if(!this._parse(n))return i.appendChild(new pS("${"+e+":")),n.children.forEach(i.appendChild,i),!0}else return this._accept(6)?this._parseTransform(n)?(i.appendChild(n),!0):(this._backTo(t),!1):this._accept(4)?(i.appendChild(n),!0):this._backTo(t)}_parseTransform(i){let e=new hsi,t="",o="";for(;!this._accept(6);){let n;if(n=this._accept(5,!0)){n=this._accept(6,!0)||n,t+=n;continue}if(this._token.type!==14){t+=this._accept(void 0,!0);continue}return!1}for(;!this._accept(6);){let n;if(n=this._accept(5,!0)){n=this._accept(5,!0)||this._accept(6,!0)||n,e.appendChild(new pS(n));continue}if(!(this._parseFormatString(e)||this._parseAnything(e)))return!1}for(;!this._accept(4);){if(this._token.type!==14){o+=this._accept(void 0,!0);continue}return!1}try{e.regexp=new RegExp(t,o)}catch{return!1}return i.transform=e,!0}_parseFormatString(i){let e=this._token;if(!this._accept(0))return!1;let t=!1;this._accept(3)&&(t=!0);let o=this._accept(8,!0);if(o)if(t){if(this._accept(4))return i.appendChild(new qV(Number(o))),!0;if(!this._accept(1))return this._backTo(e),!1}else return i.appendChild(new qV(Number(o))),!0;else return this._backTo(e),!1;if(this._accept(6)){let n=this._accept(9,!0);return!n||!this._accept(4)?(this._backTo(e),!1):(i.appendChild(new qV(Number(o),n)),!0)}else if(this._accept(11)){let n=this._until(4);if(n)return i.appendChild(new qV(Number(o),void 0,n,void 0)),!0}else if(this._accept(12)){let n=this._until(4);if(n)return i.appendChild(new qV(Number(o),void 0,void 0,n)),!0}else if(this._accept(13)){let n=this._until(1);if(n){let r=this._until(4);if(r)return i.appendChild(new qV(Number(o),void 0,n,r)),!0}}else{let n=this._until(4);if(n)return i.appendChild(new qV(Number(o),void 0,void 0,n)),!0}return this._backTo(e),!1}_parseAnything(i){return this._token.type!==14?(i.appendChild(new pS(this._scanner.tokenText(this._token))),this._accept(void 0),!0):!1}};function Vwt(a,i,e){return(typeof e.insertText=="string"?e.insertText==="":e.insertText.snippet==="")?{edits:e.additionalEdit?.edits??[]}:{edits:[...i.map(t=>new nl(a,{range:t,text:typeof e.insertText=="string"?eg.escape(e.insertText)+"$0":e.insertText.snippet,insertAsSnippet:!0})),...e.additionalEdit?.edits??[]]}}function Bwt(a){function i(r,s){return"mimeType"in r?r.mimeType===s.handledMimeType:!!s.kind&&r.kind.contains(s.kind)}let e=new Map;for(let r of a)for(let s of r.yieldTo??[])for(let l of a)if(l!==r&&i(s,l)){let c=e.get(r);c||(c=[],e.set(r,c)),c.push(l)}if(!e.size)return Array.from(a);let t=new Set,o=[];function n(r){if(!r.length)return[];let s=r[0];if(o.includes(s))return console.warn("Yield to cycle detected",s),r;if(t.has(s))return n(r.slice(1));let l=[],c=e.get(s);return c&&(o.push(s),l=n(c),o.pop()),t.add(s),[...l,s,...n(r.slice(1))]}return n(Array.from(a))}var sxe={buttonBackground:"#0E639C",buttonHoverBackground:"#006BB3",buttonSeparator:We.white.toString(),buttonForeground:We.white.toString(),buttonBorder:void 0,buttonSecondaryBackground:void 0,buttonSecondaryForeground:void 0,buttonSecondaryHoverBackground:void 0,buttonSecondaryBorder:void 0},n9i=Object.freeze({allowedTags:{override:["b","i","u","code","span"]},allowedAttributes:{override:["class"]}}),r9i=Object.freeze({sanitizerConfig:{allowedAttributes:{override:["class"]}}}),Wi=class extends x{constructor(e,t){super();this._label="";this._onDidClick=this._register(new E);this._onDidEscape=this._register(new E);this.options=t,this._element=document.createElement("a"),this._element.classList.add("monaco-button"),this._element.tabIndex=0,this._element.setAttribute("role","button"),this._element.classList.toggle("secondary",!!t.secondary),this._element.classList.toggle("small",!!t.small);let o=t.secondary?t.buttonSecondaryBackground:t.buttonBackground,n=t.secondary?t.buttonSecondaryForeground:t.buttonForeground,r=t.secondary?t.buttonSecondaryBorder:t.buttonBorder;this._element.style.color=n||"",this._element.style.backgroundColor=o||"",r&&(this._element.style.border=`1px solid ${r}`),t.supportShortLabel&&(this._labelShortElement=document.createElement("div"),this._labelShortElement.classList.add("monaco-button-label-short"),this._element.appendChild(this._labelShortElement),this._labelElement=document.createElement("div"),this._labelElement.classList.add("monaco-button-label"),this._element.appendChild(this._labelElement),this._element.classList.add("monaco-text-button-with-short-label")),typeof t.title=="string"&&this.setTitle(t.title),typeof t.ariaLabel=="string"&&this._element.setAttribute("aria-label",t.ariaLabel),e.appendChild(this._element),this.enabled=!t.disabled,this._register(Ms.addTarget(this._element)),[re.CLICK,Kn.Tap].forEach(s=>{this._register(j(this._element,s,l=>{if(!this.enabled){Xt.stop(l);return}this._onDidClick.fire(l)}))}),this._register(j(this._element,re.KEY_DOWN,s=>{let l=new gi(s),c=!1;this.enabled&&(l.equals(3)||l.equals(10))?(this._onDidClick.fire(s),c=!0):l.equals(9)&&(this._onDidEscape.fire(s),this._element.blur(),c=!0),c&&Xt.stop(l,!0)})),this._register(j(this._element,re.MOUSE_OVER,s=>{this._element.classList.contains("disabled")||this.updateStyles(!0)})),this._register(j(this._element,re.MOUSE_OUT,s=>{this.updateStyles(!1)})),this.focusTracker=this._register(qn(this._element)),this._register(this.focusTracker.onDidFocus(()=>{this.enabled&&this.updateStyles(!0)})),this._register(this.focusTracker.onDidBlur(()=>{this.enabled&&this.updateStyles(!1)}))}get onDidClick(){return this._onDidClick.event}get onDidEscape(){return this._onDidEscape.event}dispose(){super.dispose(),this._element.remove()}getContentElements(e){let t=[];for(let o of Un(e))if(typeof o=="string"){if(o=o.trim(),o==="")continue;let n=document.createElement("span");n.textContent=o,t.push(n)}else t.push(o);return t}updateStyles(e){let t,o,n;this.options.secondary?(t=e?this.options.buttonSecondaryHoverBackground:this.options.buttonSecondaryBackground,o=this.options.buttonSecondaryForeground,n=this.options.buttonSecondaryBorder):(t=e?this.options.buttonHoverBackground:this.options.buttonBackground,o=this.options.buttonForeground,n=this.options.buttonBorder),this._element.style.backgroundColor=t||"",this._element.style.color=o||"",this._element.style.border=n?`1px solid ${n}`:""}get element(){return this._element}set label(e){if(this._label===e||Ar(this._label)&&Ar(e)&&Gle(this._label,e))return;this._element.classList.add("monaco-text-button");let t=this.options.supportShortLabel?this._labelElement:this._element;if(Ar(e)){let n=Gf(e,r9i,document.createElement("span"));n.dispose();let r=n.element.querySelector("p")?.innerHTML;r?NP(t,r,n9i):vi(t)}else this.options.supportIcons?vi(t,...this.getContentElements(e)):t.textContent=e;let o="";typeof this.options.title=="string"?o=this.options.title:this.options.title&&(o=Da(e)),this.setTitle(o),this._setAriaLabel(),this._label=e}get label(){return this._label}set labelShort(e){!this.options.supportShortLabel||!this._labelShortElement||(this.options.supportIcons?vi(this._labelShortElement,...this.getContentElements(e)):this._labelShortElement.textContent=e)}_setAriaLabel(){typeof this.options.ariaLabel=="string"?this._element.setAttribute("aria-label",this.options.ariaLabel):typeof this.options.title=="string"&&this._element.setAttribute("aria-label",this.options.title)}set icon(e){this._setAriaLabel();let t=Array.from(this._element.classList).filter(o=>o.startsWith("codicon-"));this._element.classList.remove(...t),this._element.classList.add(...q.asClassNameArray(e))}set enabled(e){e?(this._element.classList.remove("disabled"),this._element.setAttribute("aria-disabled",String(!1)),this._element.tabIndex=0):(this._element.classList.add("disabled"),this._element.setAttribute("aria-disabled",String(!0)))}get enabled(){return!this._element.classList.contains("disabled")}set secondary(e){this._element.classList.toggle("secondary",e),this.options.secondary=e,this.updateStyles(!1)}set checked(e){e?(this._element.classList.add("checked"),this._element.setAttribute("aria-pressed","true")):(this._element.classList.remove("checked"),this._element.setAttribute("aria-pressed","false"))}get checked(){return this._element.classList.contains("checked")}setTitle(e){!this._hover&&e!==""?this._hover=this._register(Up().setupManagedHover(this.options.hoverDelegate??Ri("element"),this._element,e)):this._hover&&this._hover.update(e)}focus(){this._element.focus()}hasFocus(){return wa(this._element)}},ry=class extends x{constructor(e,t){super();this._onDidClick=this._register(new E);this.onDidClick=this._onDidClick.event;this.element=document.createElement("div"),this.element.classList.add("monaco-button-dropdown"),e.appendChild(this.element),t.hoverDelegate||(t={...t,hoverDelegate:this._register(Qh())}),this.primaryButton=this._register(new Wi(this.element,t)),this._register(this.primaryButton.onDidClick(r=>this._onDidClick.fire(r))),this.action=ii({id:"primaryAction",label:Da(this.primaryButton.label),run:async()=>this._onDidClick.fire(void 0)}),this.separatorContainer=document.createElement("div"),this.separatorContainer.classList.add("monaco-button-dropdown-separator"),this.separator=document.createElement("div"),this.separatorContainer.appendChild(this.separator),this.element.appendChild(this.separatorContainer);let o=t.buttonBorder;o&&(this.separatorContainer.style.borderTop="1px solid "+o,this.separatorContainer.style.borderBottom="1px solid "+o);let n=t.secondary?t.buttonSecondaryBackground:t.buttonBackground;this.separatorContainer.style.backgroundColor=n??"",this.separator.style.backgroundColor=t.buttonSeparator??"",this.dropdownButton=this._register(new Wi(this.element,{...t,title:d(1,null),supportIcons:!0})),this.dropdownButton.element.setAttribute("aria-haspopup","true"),this.dropdownButton.element.setAttribute("aria-expanded","false"),this.dropdownButton.element.classList.add("monaco-dropdown-button"),this.dropdownButton.icon=R.dropDownButton,this._register(this.dropdownButton.onDidClick(r=>{let s=Array.isArray(t.actions)?t.actions:t.actions.getActions();t.contextMenuProvider.showContextMenu({getAnchor:()=>this.dropdownButton.element,getActions:()=>t.addPrimaryActionToDropdown===!1?[...s]:[this.action,...s],actionRunner:t.actionRunner,onHide:()=>this.dropdownButton.element.setAttribute("aria-expanded","false"),layer:t.dropdownLayer}),this.dropdownButton.element.setAttribute("aria-expanded","true")}))}dispose(){super.dispose(),this.element.remove()}set label(e){this.primaryButton.label=e,this.action.label=e}set icon(e){this.primaryButton.icon=e}set enabled(e){this.primaryButton.enabled=e,this.dropdownButton.enabled=e,this.element.classList.toggle("disabled",!e)}get enabled(){return this.primaryButton.enabled}set checked(e){this.primaryButton.checked=e}get checked(){return this.primaryButton.checked}focus(){this.primaryButton.focus()}hasFocus(){return this.primaryButton.hasFocus()||this.dropdownButton.hasFocus()}},$4e=class{constructor(i,e){this.options=e;this._element=document.createElement("div"),this._element.classList.add("monaco-description-button"),this._button=new Wi(this._element,e),this._descriptionElement=document.createElement("div"),this._descriptionElement.classList.add("monaco-button-description"),this._element.appendChild(this._descriptionElement),i.appendChild(this._element)}get onDidClick(){return this._button.onDidClick}get element(){return this._element}set label(i){this._button.label=i}set icon(i){this._button.icon=i}get enabled(){return this._button.enabled}set enabled(i){this._button.enabled=i}set checked(i){this._button.checked=i}get checked(){return this._button.checked}focus(){this._button.focus()}hasFocus(){return this._button.hasFocus()}dispose(){this._button.dispose()}set description(i){this.options.supportIcons?vi(this._descriptionElement,...Un(i)):this._descriptionElement.textContent=i}};var Sw=class{constructor(i,e){this.container=i;this.options=e;this._buttons=[];this._buttonStore=new N}dispose(){this._buttonStore.dispose()}get buttons(){return this._buttons}clear(){this._buttonStore.clear(),this._buttons.length=0}addButton(i){let e=this._buttonStore.add(new Wi(this.container,i));return this.pushButton(e),e}addButtonWithDescription(i){let e=this._buttonStore.add(new $4e(this.container,i));return this.pushButton(e),e}addButtonWithDropdown(i){let e=this._buttonStore.add(new ry(this.container,i));return this.pushButton(e),e}pushButton(i){this._buttons.push(i);let e=this._buttons.length-1;this._buttonStore.add(j(i.element,re.KEY_DOWN,t=>{let o=new gi(t),n=!0,r;o.equals(this.options?.alignment===1?16:15)?r=e>0?e-1:this._buttons.length-1:o.equals(this.options?.alignment===1?18:17)?r=e===this._buttons.length-1?0:e+1:n=!1,n&&typeof r=="number"&&(this._buttons[r].focus(),Xt.stop(t,!0))}))}},mR=class extends Wi{get labelElement(){return this._mdlabelElement}get iconElement(){return this._iconElement}constructor(i,e){if(super(i,e),e.supportShortLabel)throw new Error("ButtonWithIcon does not support short labels");this._element.classList.add("monaco-icon-button"),this._iconElement=_(""),this._mdlabelElement=_(".monaco-button-mdlabel"),this._element.append(this._iconElement,this._mdlabelElement)}get label(){return super.label}set label(i){if(this._label===i||Ar(this._label)&&Ar(i)&&Gle(this._label,i))return;if(this._element.classList.add("monaco-text-button"),Ar(i)){let t=Gf(i,r9i,document.createElement("span"));t.dispose();let o=t.element.querySelector("p")?.innerHTML;o?NP(this._mdlabelElement,o,n9i):vi(this._mdlabelElement)}else this.options.supportIcons?vi(this._mdlabelElement,...this.getContentElements(i)):this._mdlabelElement.textContent=i;let e="";typeof this.options.title=="string"?e=this.options.title:this.options.title&&(e=Da(i)),this.setTitle(e),this._setAriaLabel(),this._label=i}get icon(){return super.icon}set icon(i){this._iconElement.classList.value="",this._iconElement.classList.add(...q.asClassNameArray(i)),this._setAriaLabel()}};var Hwt=_,j4e={keybindingLabelBackground:void 0,keybindingLabelForeground:void 0,keybindingLabelBorder:void 0,keybindingLabelBottomBorder:void 0,keybindingLabelShadow:void 0},Am=class a extends x{constructor(e,t,o){super();this.os=t;this.keyElements=new Set;this.options=o||Object.create(null);let n=this.options.keybindingLabelForeground;this.domNode=M(e,Hwt(".monaco-keybinding")),n&&(this.domNode.style.color=n),this.hover=this._register(Up().setupManagedHover(Ri("mouse"),this.domNode,"")),this.didEverRender=!1,e.appendChild(this.domNode)}get element(){return this.domNode}set(e,t){this.didEverRender&&this.keybinding===e&&a.areSame(this.matches,t)||(this.keybinding=e,this.matches=t,this.render())}render(){if(this.clear(),this.keybinding){let e=this.keybinding.getChords();e[0]&&this.renderChord(this.domNode,e[0],this.matches?this.matches.firstPart:null);for(let o=1;o<e.length;o++)M(this.domNode,Hwt("span.monaco-keybinding-key-chord-separator",void 0," ")),this.renderChord(this.domNode,e[o],this.matches?this.matches.chordPart:null);let t=this.options.disableTitle??!1?void 0:this.keybinding.getAriaLabel()||void 0;this.hover.update(t),this.domNode.setAttribute("aria-label",t||"")}else this.options&&this.options.renderUnboundKeybindings&&this.renderUnbound(this.domNode);this.didEverRender=!0}clear(){Rt(this.domNode),this.keyElements.clear()}renderChord(e,t,o){let n=cR.modifierLabels[this.os];t.ctrlKey&&this.renderKey(e,n.ctrlKey,!!o?.ctrlKey,n.separator),t.shiftKey&&this.renderKey(e,n.shiftKey,!!o?.shiftKey,n.separator),t.altKey&&this.renderKey(e,n.altKey,!!o?.altKey,n.separator),t.metaKey&&this.renderKey(e,n.metaKey,!!o?.metaKey,n.separator);let r=t.keyLabel;r&&this.renderKey(e,r,!!o?.keyCode,"")}renderKey(e,t,o,n){M(e,this.createKeyElement(t,o?".highlight":"")),n&&M(e,Hwt("span.monaco-keybinding-key-separator",void 0,n))}renderUnbound(e){M(e,this.createKeyElement(d(25,null)))}createKeyElement(e,t=""){let o=Hwt("span.monaco-keybinding-key"+t,void 0,e);return this.keyElements.add(o),this.options.keybindingLabelBackground&&(o.style.backgroundColor=this.options.keybindingLabelBackground),this.options.keybindingLabelBorder&&(o.style.borderColor=this.options.keybindingLabelBorder),this.options.keybindingLabelBottomBorder&&(o.style.borderBottomColor=this.options.keybindingLabelBottomBorder),this.options.keybindingLabelShadow&&(o.style.boxShadow=`inset 0 -1px 0 ${this.options.keybindingLabelShadow}`),o}static areSame(e,t){return e===t||!e&&!t?!0:!!e&&!!t&&eo(e.firstPart,t.firstPart)&&eo(e.chordPart,t.chordPart)}};var Kl=le("layoutService");var bsi="acceptSelectedCodeAction",Ssi="previewSelectedCodeAction";var gsi=class{get templateId(){return"header"}renderTemplate(i){i.classList.add("group-header");let e=document.createElement("span");return i.append(e),{container:i,text:e}}renderElement(i,e,t){t.text.textContent=i.group?.title??i.label??""}disposeTemplate(i){}},fsi=class{get templateId(){return"separator"}renderTemplate(i){i.classList.add("separator");let e=document.createElement("span");return i.append(e),{container:i,text:e}}renderElement(i,e,t){t.text.textContent=i.label??""}disposeTemplate(i){}},Q4e=class{constructor(i,e,t,o,n,r,s){this._supportsPreview=i;this._onRemoveItem=e;this._onShowSubmenu=t;this._hasAnySubmenuActions=o;this._linkHandler=n;this._keybindingService=r;this._openerService=s}get templateId(){return"action"}renderTemplate(i){i.classList.add(this.templateId);let e=document.createElement("div");e.className="icon",i.append(e);let t=document.createElement("span");t.className="title",i.append(t);let o=document.createElement("span");o.className="action-item-badge",i.append(o);let n=document.createElement("span");n.className="description",i.append(n);let r=new Am(i,Po),s=document.createElement("div");s.className="action-list-item-toolbar",i.append(s);let l=document.createElement("div");l.className="action-list-submenu-indicator",i.append(l);let c=new N;return{container:i,icon:e,text:t,badge:o,description:n,keybinding:r,toolbar:s,submenuIndicator:l,elementDisposables:c}}renderElement(i,e,t){if(t.elementDisposables.clear(),i.group?.icon?(t.icon.className=q.asClassName(i.group.icon),i.group.icon.color&&(t.icon.style.color=kt(i.group.icon.color.id))):(t.icon.className=q.asClassName(R.lightBulb),t.icon.style.color="var(--vscode-editorLightBulb-foreground)"),!i.item||!i.label)return;if(hh(!i.hideIcon,t.icon),i.isSectionToggle){let s=i.group?.icon===R.chevronDown;t.container.setAttribute("aria-expanded",String(s))}else t.container.removeAttribute("aria-expanded");if(t.previousClassName&&t.container.classList.remove(t.previousClassName),t.container.classList.toggle("action-list-custom",!!i.className),i.className&&t.container.classList.add(i.className),t.previousClassName=i.className,t.text.textContent=zwt(i.label),i.badge?(t.badge.textContent=i.badge,t.badge.style.display=""):(t.badge.textContent="",t.badge.style.display="none"),i.keybinding)t.description.textContent=i.keybinding.getLabel(),t.description.style.display="inline",t.description.style.letterSpacing="0.5px";else if(i.description){if(Rt(t.description),typeof i.description=="string")t.description.textContent=zwt(i.description);else{let s=Gf(i.description,{actionHandler:l=>{let c=A.parse(l);this._linkHandler?this._linkHandler(c,i):this._openerService.open(c,{allowCommands:!0})}});t.elementDisposables.add(s),t.description.appendChild(s.element)}t.description.style.display="inline"}else t.description.textContent="",t.description.style.display="none";let o=this._keybindingService.lookupKeybinding(bsi)?.getLabel(),n=this._keybindingService.lookupKeybinding(Ssi)?.getLabel();t.container.classList.toggle("option-disabled",!!i.disabled),i.hover!==void 0?t.container.title="":i.tooltip?t.container.title=i.tooltip:i.disabled?t.container.title=i.label:o&&n?this._supportsPreview&&i.canPreview?t.container.title=d(1823,null,o,n):t.container.title=d(1822,null,o):t.container.title="",Rt(t.toolbar);let r=[...i.toolbarActions??[]];if(i.onRemove&&r.push(ii({id:"actionList.remove",label:d(1819,null),class:q.asClassName(R.close),run:()=>{i.onRemove(),this._onRemoveItem?.(i)}})),t.container.classList.toggle("has-toolbar",r.length>0),r.length>0){let s=new Zi(t.toolbar);t.elementDisposables.add(s),s.push(r,{icon:!0,label:!1})}i.submenuActions?.length?(t.submenuIndicator.className="action-list-submenu-indicator has-submenu "+q.asClassName(R.chevronRight),t.submenuIndicator.style.display="",t.submenuIndicator.style.visibility="",t.elementDisposables.add(j(t.submenuIndicator,re.CLICK,s=>{s.stopPropagation(),this._onShowSubmenu?.(i)}))):this._hasAnySubmenuActions?(t.submenuIndicator.className="action-list-submenu-indicator",t.submenuIndicator.style.display="",t.submenuIndicator.style.visibility="hidden"):(t.submenuIndicator.className="action-list-submenu-indicator",t.submenuIndicator.style.display="none")}disposeTemplate(i){i.keybinding.dispose(),i.elementDisposables.dispose()}};Q4e=I([m(5,_e),m(6,Je)],Q4e);var vsi=class extends UIEvent{constructor(){super("acceptSelectedAction")}},Uwt=class extends UIEvent{constructor(){super("previewSelectedAction")}};function L1o(a){if(a.kind==="action")return a.label}var gce=class extends x{constructor(e,t,o,n,r,s,l,c,u,p){super();this._delegate=n;this._options=s;this._keybindingService=l;this._hoverService=c;this._openerService=u;this._instantiationService=p;this._baseLineHeight=24;this._headerLineHeight=24;this._separatorLineHeight=8;this.cts=this._register(new Ye);this._hover=this._register(new me);this._submenuDisposables=this._register(new N);this._collapsedSections=new Set;this._filterText="";this._suppressHover=!1;this._hasLaidOut=!1;this._onDidRequestLayout=this._register(new E);this.onDidRequestLayout=this._onDidRequestLayout.event;if(this.domNode=document.createElement("div"),this.domNode.classList.add("actionList"),this._options?.descriptionBelow&&this.domNode.classList.add("description-below"),this._actionLineHeight=this._options?.descriptionBelow?48:24,this._submenuContainer=document.createElement("div"),this._submenuContainer.className="action-list-submenu-panel action-widget",this._submenuContainer.style.display="none",this.domNode.append(this._submenuContainer),this._register(j(this._submenuContainer,"mouseenter",()=>{this._cancelSubmenuHide()})),this._register(j(this._submenuContainer,"mouseleave",()=>{this._scheduleSubmenuHide()})),this._register(Z(()=>{this._cancelSubmenuHide(),this._cancelSubmenuShow()})),this._options?.collapsedByDefault)for(let v of this._options.collapsedByDefault)this._collapsedSections.add(v);let h={getHeight:v=>this._getItemHeight(v),getTemplateId:v=>v.kind},f=(this._options?.reserveSubmenuSpace??!0)&&o.some(v=>!!v.submenuActions?.length);if(this._list=this._register(new Cc(e,this.domNode,h,[new Q4e(t,v=>this._removeItem(v),v=>this._showSubmenuForItem(v),f,this._options?.linkHandler,this._keybindingService,this._openerService),new gsi,new fsi],{keyboardSupport:!1,typeNavigationEnabled:!this._options?.showFilter,keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:L1o},accessibilityProvider:{getAriaLabel:v=>{if(v.kind==="action"){let b=v.label?zwt(v?.label):"";if(v.description){let S=typeof v.description=="string"?v.description:v.description.value;b=b+", "+zwt(S)}return v.disabled&&(b=d(1821,null,b,v.disabled)),b}return null},getWidgetAriaLabel:()=>d(1820,null),getRole:v=>{switch(v.kind){case"action":return"option";case"separator":return"separator";default:return"separator"}},getWidgetRole:()=>"listbox",...r}})),this._list.style(CY),this._register(this._list.onMouseClick(v=>this.onListClick(v))),this._register(this._list.onMouseOver(v=>this.onListHover(v))),this._register(this._list.onDidChangeFocus(()=>this.onFocus())),this._register(this._list.onDidChangeSelection(v=>this.onListSelection(v))),this._allMenuItems=[...o],this._options?.showFilter){this._filterContainer=document.createElement("div"),this._filterContainer.className="action-list-filter";let v=M(this._filterContainer,_(".action-list-filter-row"));this._filterInput=document.createElement("input"),this._filterInput.type="text",this._filterInput.className="action-list-filter-input",this._filterInput.placeholder=this._options?.filterPlaceholder??d(1818,null),this._filterInput.setAttribute("aria-label",d(1817,null)),v.appendChild(this._filterInput);let b=this._options?.filterActions??[];if(b.length>0){let S=M(v,_(".action-list-filter-actions"));this._register(new Zi(S)).push(b,{icon:!0,label:!1})}this._register(j(this._filterInput,"input",()=>{this._filterText=this._filterInput.value,this._applyFilter()}))}this._applyFilter(),this._list.length&&this._focusCheckedOrFirst(),this._register(j(this.domNode,"keydown",v=>{if(v.key==="ArrowRight"){let b=this._list.getFocus();if(b.length>0){let S=this._list.element(b[0]);if(S?.submenuActions?.length){Xt.stop(v,!0);let y=this._getRowElement(b[0]);y&&(this._showSubmenuForElement(S,y),this._currentSubmenuWidget?.focus())}}}})),this._filterInput&&this._register(j(this.domNode,"keydown",v=>{this._filterInput&&!wa(this._filterInput)&&v.key.length===1&&v.key!==" "&&!v.ctrlKey&&!v.metaKey&&!v.altKey&&(this._filterInput.focus(),this._filterInput.value=v.key,this._filterText=v.key,this._applyFilter(),v.preventDefault(),v.stopPropagation())}))}_toggleSection(e){this._collapsedSections.has(e)?this._collapsedSections.delete(e):this._collapsedSections.add(e),this._options?.onDidToggleSection?.(e,this._collapsedSections.has(e)),this._applyFilter()}_applyFilter(){let e=this._filterText.toLowerCase(),t=e.length>0,o=[],n=this._list.getFocus(),r;n.length>0&&(r=this._list.element(n[0]));for(let l of this._allMenuItems){if(l.kind==="header"){if(t)continue;o.push(l);continue}if(l.kind==="separator"){if(t||l.section&&this._collapsedSections.has(l.section))continue;o.push(l);continue}if(t){if(l.showAlways){o.push(l);continue}if(l.isSectionToggle)continue;let c=(l.label??"").toLowerCase(),p=(typeof l.description=="string"?l.description:l.description?.value??"").toLowerCase();(c.includes(e)||p.includes(e))&&o.push(l)}else{if(l.isSectionToggle&&l.section){let c=this._collapsedSections.has(l.section);o.push({...l,group:{...l.group,icon:c?R.chevronRight:R.chevronDown}});continue}if(l.section&&this._collapsedSections.has(l.section))continue;o.push(l)}}let s=this._filterInput&&wa(this._filterInput);if(this._list.splice(0,this._list.length,o),this._onDidRequestLayout.fire(),s)this._filterInput?.focus(),this._focusCheckedOrFirst();else if(this._hasLaidOut&&r){let l=r.item?.id;if(l){for(let c=0;c<this._list.length;c++)if(this._list.element(c).item?.id===l){this._list.setFocus([c]),this._list.reveal(c);break}}}}get filterContainer(){return this._filterContainer}get filterInput(){return this._filterInput}focusCondition(e){return!e.disabled&&e.kind==="action"}focus(){if(this._filterInput&&this._options?.focusFilterOnOpen){this._filterInput.focus(),this._focusCheckedOrFirst();return}this._list.domFocus(),this._focusCheckedOrFirst()}getFocusedElement(){let e=this._list.getFocus();if(e.length>0)return this._list.element(e[0])}_focusCheckedOrFirst(){this._suppressHover=!0;try{for(let t=0;t<this._list.length;t++){let o=this._list.element(t);if(o.kind==="action"&&o.item?.checked){this._list.setFocus([t]),this._list.reveal(t);return}}this._list.focusFirst(void 0,this.focusCondition);let e=this._list.getFocus();e.length>0&&this._list.reveal(e[0])}finally{this._suppressHover=!1}}hide(e){this._delegate.onHide(e),this.cts.cancel(),this._hover.clear(),this._hideSubmenu()}clearFilter(){return this._filterInput&&this._filterText?(this._filterInput.value="",this._filterText="",this._applyFilter(),!0):!1}get hasDynamicHeight(){return this._options?.showFilter?!0:this._allMenuItems.some(e=>e.isSectionToggle)}get lineHeight(){return this._actionLineHeight}_getItemHeight(e){switch(e.kind){case"header":return this._headerLineHeight;case"separator":return this._separatorLineHeight;default:return this._options?.descriptionBelow&&!e.description?this._baseLineHeight:this._actionLineHeight}}computeFullHeight(){let e=0;for(let t of this._allMenuItems)e+=this._getItemHeight(t);return e}computeListHeight(){let e=this._list.length,t=0;for(let o=0;o<e;o++){let n=this._list.element(o);t+=this._getItemHeight(n)}return t}layout(e,t){this._hasLaidOut=!0,this._list.layout(e,t),this.domNode.style.height=`${e}px`,this._filterContainer&&this._filterContainer.parentElement&&this._filterContainer.parentElement.insertBefore(this._filterContainer,this.domNode)}computeMaxWidth(e){let t=this._list.length,o=Math.max(e,this._options?.minWidth??0),n=o,r=this._allMenuItems.length;if(r>=50)return Math.max(380,o);if(r>t){let l=[];for(let h=0;h<t;h++)l.push(this._list.element(h));let c=[...this._allMenuItems];this._list.splice(0,t,c);let u=0;for(let h of c)u+=this._getItemHeight(h);this._list.layout(u);let p=[];for(let h=0;h<c.length;h++){let g=this._getRowElement(h);if(g){g.style.width="auto";let f=g.getBoundingClientRect().width;g.style.width="",p.push(f+this._computeToolbarWidth(c[h]))}}return n=Math.max(...p,o),this._list.splice(0,c.length,l),n}let s=[];for(let l=0;l<t;l++){let c=this._getRowElement(l);if(c){c.style.width="auto";let u=c.getBoundingClientRect().width;c.style.width="",s.push(u+this._computeToolbarWidth(this._list.element(l)))}}return Math.max(...s,o)}focusPrevious(){if(this._filterInput&&wa(this._filterInput)){this._list.domFocus();let o=this._list.getFocus();if(o.length>0){this._list.focusPrevious(1,!1,void 0,this.focusCondition);let n=this._list.getFocus();n.length>0&&n[0]>=o[0]?this._filterInput.focus():n.length>0&&this._list.reveal(n[0])}else{this._list.focusLast(void 0,this.focusCondition);let n=this._list.getFocus();n.length>0&&this._list.reveal(n[0])}return}let e=this._list.getFocus();this._list.focusPrevious(1,!0,void 0,this.focusCondition);let t=this._list.getFocus();if(t.length>0){if(this._filterInput&&e.length>0&&t[0]>e[0]){this._list.setFocus([]),this._filterInput.focus();return}this._list.reveal(t[0])}}focusNext(){if(this._filterInput&&wa(this._filterInput)){if(this._list.domFocus(),this._list.getFocus().length>0){this._list.focusNext(1,!1,void 0,this.focusCondition);let n=this._list.getFocus();n.length>0&&this._list.reveal(n[0])}else{this._list.focusFirst(void 0,this.focusCondition);let n=this._list.getFocus();n.length>0&&this._list.reveal(n[0])}return}let e=this._list.getFocus();this._list.focusNext(1,!0,void 0,this.focusCondition);let t=this._list.getFocus();if(t.length>0){if(this._filterInput&&e.length>0&&t[0]<e[0]){this._list.setFocus([]),this._filterInput.focus();return}this._list.reveal(t[0])}}collapseFocusedSection(){let e=this._getFocusedSection();e&&!this._collapsedSections.has(e)&&this._toggleSection(e)}expandFocusedSection(){let e=this._getFocusedSection();e&&this._collapsedSections.has(e)&&this._toggleSection(e)}toggleFocusedSection(){let e=this._list.getFocus();if(e.length===0)return!1;let t=this._list.element(e[0]);return t.isSectionToggle&&t.section?(this._toggleSection(t.section),!0):!1}_getFocusedSection(){let e=this._list.getFocus();if(e.length===0)return;let t=this._list.element(e[0]);return t.isSectionToggle&&t.section,t.section}acceptSelected(e){let t=this._list.getFocus();if(t.length===0)return;let o=t[0],n=this._list.element(o);if(!this.focusCondition(n))return;let r=e?new Uwt:new vsi;this._list.setSelection([o],r)}onListSelection(e){if(!e.elements.length)return;let t=e.elements[0];if(t.isSectionToggle&&t.section){this._list.setSelection([]);let o=t.section;queueMicrotask(()=>{this._toggleSection(o)});return}if(Ru(e.browserEvent)){let o=e.browserEvent.target;if(Do(o)&&(o.closest(".action-list-item-toolbar")||o.closest(".action-list-submenu-indicator"))){this._list.setSelection([]);return}}t.item&&this.focusCondition(t)?this._delegate.onSelect(t.item,e.browserEvent instanceof Uwt):this._list.setSelection([])}onFocus(){let e=this._list.getFocus();if(e.length===0)return;let t=e[0],o=this._list.element(t);this._delegate.onFocus?.(o.item),this._suppressHover||this._showHoverForElement(o,t)}_removeItem(e){let t=this._allMenuItems.indexOf(e);t>=0&&(this._allMenuItems.splice(t,1),this._applyFilter())}_computeToolbarWidth(e){let t=e.toolbarActions?.length??0;return e.onRemove&&t++,t===0?0:t*22+6}_getRowElement(e){return this.domNode.ownerDocument.getElementById(this._list.getElementID(e))}_showHoverForElement(e,t){if(this._currentSubmenuElement===e||e.submenuActions?.length)return;this._submenuDisposables.clear();let o=this._getRowElement(t);if(!o){this._hover.clear();return}if(!!!e.hover?.content){this._hover.clear();return}let r=typeof e.hover.content=="string"?new Ie(e.hover.content):e.hover.content,s=this._options?.linkHandler;this._hover.value=this._hoverService.showDelayedHover({content:r??"",target:o,additionalClasses:["action-widget-hover"],linkHandler:s?l=>{s(A.parse(l),e)}:void 0,position:{hoverPosition:0,forcePosition:!1,...e.hover.position},appearance:{showPointer:!0}},{groupId:"actionListHover"})}_showSubmenuForItem(e){let t=this._list.indexOf(e);if(t>=0){let o=this._getRowElement(t);o&&this._showSubmenuForElement(e,o)}}_showSubmenuForElement(e,t){this._submenuDisposables.clear(),this._hover.clear(),this._currentSubmenuElement=e,Rt(this._submenuContainer);let o=[],r=e.submenuActions.filter(w=>w instanceof Fs).filter(w=>w.actions.length>0);for(let w=0;w<r.length;w++){let k=r[w];k.label&&o.push({kind:"header",group:{title:k.label},label:k.label});for(let T=0;T<k.actions.length;T++){let P=k.actions[T];o.push({item:P,kind:"action",label:P.label,description:P.tooltip||void 0,group:{title:"",icon:q.fromId(P.checked?R.check.id:R.blank.id)},hideIcon:!1,hover:{}})}w<r.length-1&&o.push({kind:"separator",label:""})}for(let w of e.submenuActions)w instanceof Fs||o.push({item:w,kind:"action",label:w.label,description:w.tooltip||void 0,group:{title:""},hideIcon:!1,hover:{}});let s={onHide:()=>{},onSelect:w=>{w.run();let k=this._currentSubmenuElement?.item;this._hideSubmenu(),k&&this._delegate.onSelect(k),this.hide()}};this._submenuContainer.style.display="",this._submenuContainer.style.position="absolute";let l=t.getBoundingClientRect(),c=this.domNode.getBoundingClientRect(),u=this._submenuDisposables.add(this._instantiationService.createInstance(gce,"submenu",!1,o,s,void 0,void 0));this._submenuContainer.appendChild(u.domNode),this._currentSubmenuWidget=u;let p=u.computeListHeight();u.layout(p);let h=u.computeMaxWidth(0);u.layout(p,h),u.domNode.style.width=`${h}px`;let v=Re(this.domNode).innerWidth-l.right,b=c.left,S=h+10,y=4;v>=S||v>=b?this._submenuContainer.style.left=`${c.right-c.left+y}px`:this._submenuContainer.style.left=`${-S-y}px`,this._submenuContainer.style.top=`${l.top-c.top-4}px`,this._submenuDisposables.add(j(u.domNode,"keydown",w=>{if(w.key==="ArrowLeft"||w.key==="Escape")Xt.stop(w,!0),this._hideSubmenu(),this._list.domFocus();else if(w.key==="Enter"){Xt.stop(w,!0);let k=u.getFocusedElement();if(k?.item){k.item.run();let T=this._currentSubmenuElement?.item;this._hideSubmenu(),T&&this._delegate.onSelect(T),this.hide()}}else w.key==="ArrowDown"?(Xt.stop(w,!0),u.focusNext()):w.key==="ArrowUp"&&(Xt.stop(w,!0),u.focusPrevious())}))}_hideSubmenu(){this._cancelSubmenuHide(),this._cancelSubmenuShow(),this._submenuDisposables.clear(),this._currentSubmenuWidget=void 0,this._currentSubmenuElement=void 0,Rt(this._submenuContainer),this._submenuContainer.style.display="none"}_scheduleSubmenuHide(){this._cancelSubmenuHide(),this._submenuHideTimeout=setTimeout(()=>{this._hideSubmenu()},300)}_cancelSubmenuHide(){this._submenuHideTimeout!==void 0&&(clearTimeout(this._submenuHideTimeout),this._submenuHideTimeout=void 0)}_scheduleSubmenuShow(e,t){this._cancelSubmenuShow(),this._submenuShowTimeout=setTimeout(()=>{this._submenuShowTimeout=void 0;let o=typeof t=="number"?this._getRowElement(t):null;o&&this._showSubmenuForElement(e,o)},300)}_cancelSubmenuShow(){this._submenuShowTimeout!==void 0&&(clearTimeout(this._submenuShowTimeout),this._submenuShowTimeout=void 0)}async onListHover(e){let t=e.element;if(t&&t.item&&this.focusCondition(t)){if(Do(e.browserEvent.target)&&e.browserEvent.target.closest(".action-list-item-toolbar")!==null){t.submenuActions?.length||this._cancelSubmenuShow(),this._list.setFocus([]);return}if(this._list.setFocus(typeof e.index=="number"?[e.index]:[]),t.submenuActions?.length){this._currentSubmenuElement===t?(this._cancelSubmenuHide(),this._cancelSubmenuShow()):this._scheduleSubmenuShow(t,e.index);return}if(this._currentSubmenuElement===t?this._cancelSubmenuHide():(this._cancelSubmenuShow(),this._hideSubmenu()),this._delegate.onHover&&!t.disabled&&t.kind==="action"&&this._currentSubmenuElement!==t){let n=await this._delegate.onHover(t.item,this.cts.token),r=n?n.canPreview:void 0;r!==t.canPreview&&(t.canPreview=r,typeof e.index=="number"&&(this._list.splice(e.index,1,[t]),this._list.setFocus([e.index])))}}else t&&t.hover?.content&&typeof e.index=="number"&&this._showHoverForElement(t,e.index)}onListClick(e){e.element&&this.focusCondition(e.element)&&this._list.setFocus([])}};gce=I([m(6,_e),m(7,nt),m(8,Je),m(9,F)],gce);var axe=class extends x{constructor(e,t,o,n,r,s,l,c,u,p){super();this._contextViewService=c;this._layoutService=u;this._lastMinWidth=0;this._hasLaidOut=!1;this._anchor=l,this._widget=this._register(p.createInstance(gce,e,t,o,n,r,s)),this._register(this._widget.onDidRequestLayout(()=>{this._hasLaidOut&&(this.layout(this._lastMinWidth),this._contextViewService.layout())}))}get domNode(){return this._widget.domNode}get filterContainer(){return this._widget.filterContainer}get filterInput(){return this._widget.filterInput}get anchorPosition(){if(this._showAbove!==void 0)return this._showAbove?1:0}focus(){this._widget.focus()}hide(e){this._widget.hide(e),this._contextViewService.hideContextView()}clearFilter(){return this._widget.clearFilter()}focusPrevious(){this._widget.focusPrevious()}focusNext(){this._widget.focusNext()}collapseFocusedSection(){this._widget.collapseFocusedSection()}expandFocusedSection(){this._widget.expandFocusedSection()}toggleFocusedSection(){return this._widget.toggleFocusedSection()}acceptSelected(e){this._widget.acceptSelected(e)}hasDynamicHeight(){return this._widget.hasDynamicHeight}computeHeight(){let e=this._widget.computeListHeight(),t=this._widget.filterContainer?36:0,o=10,n=Re(this.domNode),r;if(this.hasDynamicHeight()){let p=n.innerHeight,h=v4e(this._anchor),g=h.top-n.pageYOffset,f=p-g-h.height-o,v=g-o;if(this._showAbove===void 0){let b=t+this._widget.computeFullHeight();this._showAbove=b>f&&v>f}r=this._showAbove?v:f}else{let p=this._layoutService.getContainer(n).clientHeight,h=this.domNode.getBoundingClientRect().top;r=h>0?p-h-o:p*.7}let s=Math.floor(n.innerHeight*.6),l=this._widget.lineHeight,c=Math.min(Math.max(r,l*3+t),s);return Math.min(e+t,c)-t}layout(e){this._hasLaidOut=!0,this._lastMinWidth=e;let t=this.computeHeight();return this._widget.layout(t),this._cachedMaxWidth=this._widget.computeMaxWidth(e),this._widget.layout(t,this._cachedMaxWidth),this._cachedMaxWidth}};axe=I([m(7,Wn),m(8,Kl),m(9,F)],axe);function zwt(a){return a.replace(/\r\n|\r|\n/g," ")}te("actionBar.toggledBackground",PV,d(1825,null));var BE={Visible:new Y("codeActionMenuVisible",!1,d(1828,null)),FilterFocused:new Y("codeActionMenuFilterFocused",!1,d(1827,null))},td=le("actionWidgetService"),FP=class extends x{constructor(e,t,o){super();this._contextViewService=e;this._contextKeyService=t;this._instantiationService=o;this._list=this._register(new me)}get isVisible(){return BE.Visible.getValue(this._contextKeyService)||!1}show(e,t,o,n,r,s,l,c,u){let p=BE.Visible.bindTo(this._contextKeyService),h=this._instantiationService.createInstance(axe,e,t,o,n,c,u,r);this._contextViewService.showContextView({getAnchor:()=>r,render:g=>(p.set(!0),this._renderWidget(g,h,l??[])),onHide:g=>{p.reset(),this._onWidgetClosed(g)},get anchorPosition(){return h.anchorPosition}},s,!1)}acceptSelected(e){this._list.value?.acceptSelected(e)}focusPrevious(){this._list?.value?.focusPrevious()}focusNext(){this._list?.value?.focusNext()}collapseSection(){this._list?.value?.collapseFocusedSection()}expandSection(){this._list?.value?.expandFocusedSection()}toggleSection(){return this._list?.value?.toggleFocusedSection()??!1}clearFilter(){return this._list?.value?.clearFilter()??!1}hide(e){this._list.value?.hide(e),this._list.clear()}clear(){this._list.clear()}_renderWidget(e,t,o){let n=document.createElement("div");if(n.classList.add("action-widget"),e.appendChild(n),this._list.value=t,this._list.value)this._list.value.filterContainer&&n.appendChild(this._list.value.filterContainer),n.appendChild(this._list.value.domNode);else throw new Error("List has no value");let r=new N,s=document.createElement("div"),l=e.appendChild(s);l.classList.add("context-view-block"),r.add(j(l,re.MOUSE_DOWN,v=>v.stopPropagation()));let c=document.createElement("div"),u=e.appendChild(c);u.classList.add("context-view-pointerBlock"),r.add(j(u,re.POINTER_MOVE,()=>u.remove())),r.add(j(u,re.MOUSE_DOWN,()=>u.remove()));let p=0;if(o.length){let v=this._createActionBar(".action-widget-action-bar",o);v&&(n.appendChild(v.getContainer().parentElement),r.add(v),p=v.getContainer().offsetWidth)}let h=this._list.value?.layout(p);n.style.width=`${h}px`,this._list.value?.focus();let g=BE.FilterFocused.bindTo(this._contextKeyService);if(r.add({dispose:()=>g.reset()}),this._list.value?.filterInput){let v=this._list.value.filterInput;r.add(j(v,"focus",()=>g.set(!0))),r.add(j(v,"blur",()=>g.set(!1)))}let f=r.add(qn(e));return r.add(f.onDidBlur(()=>{let v=Nn();v?.closest(".action-widget-hover")||v?.closest(".action-list-submenu-panel")||this.hide(!0)})),r}_createActionBar(e,t){if(!t.length)return;let o=_(e),n=new Zi(o);return n.push(t,{icon:!1,label:!0}),n}_onWidgetClosed(e){this._list.value?.hide(e)}};FP=I([m(0,Wn),m(1,X),m(2,F)],FP);Ee(td,FP,1);var e5=1100;W(class extends K{constructor(){super({id:"hideCodeActionWidget",title:L(1831,"Hide action widget"),precondition:BE.Visible,keybinding:{weight:e5,primary:9,secondary:[1033]}})}run(a){a.get(td).hide(!0)}});W(class extends K{constructor(){super({id:"clearFilterCodeActionWidget",title:L(1826,"Clear action widget filter"),precondition:C.and(BE.Visible,BE.FilterFocused),keybinding:{weight:e5+1,primary:9}})}run(a){let i=a.get(td);i instanceof FP&&(i.clearFilter()||i.hide(!0))}});W(class extends K{constructor(){super({id:"selectPrevCodeAction",title:L(1834,"Select previous action"),precondition:BE.Visible,keybinding:{weight:e5,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}})}run(a){let i=a.get(td);i instanceof FP&&i.focusPrevious()}});W(class extends K{constructor(){super({id:"selectNextCodeAction",title:L(1833,"Select next action"),precondition:BE.Visible,keybinding:{weight:e5,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}})}run(a){let i=a.get(td);i instanceof FP&&i.focusNext()}});W(class extends K{constructor(){super({id:"collapseSectionCodeAction",title:L(1829,"Collapse section"),precondition:C.and(BE.Visible,BE.FilterFocused.negate()),keybinding:{weight:e5,primary:15}})}run(a){let i=a.get(td);i instanceof FP&&i.collapseSection()}});W(class extends K{constructor(){super({id:"expandSectionCodeAction",title:L(1830,"Expand section"),precondition:C.and(BE.Visible,BE.FilterFocused.negate()),keybinding:{weight:e5,primary:17}})}run(a){let i=a.get(td);i instanceof FP&&i.expandSection()}});W(class extends K{constructor(){super({id:"toggleSectionCodeAction",title:L(1835,"Toggle section"),precondition:C.and(BE.Visible,BE.FilterFocused.negate()),keybinding:{weight:e5,primary:10}})}run(a){let i=a.get(td);i instanceof FP&&(i.toggleSection()||i.acceptSelected())}});W(class extends K{constructor(){super({id:bsi,title:L(1824,"Accept selected action"),precondition:BE.Visible,keybinding:{weight:e5,primary:3,secondary:[2137]}})}run(a){let i=a.get(td);i instanceof FP&&i.acceptSelected()}});W(class extends K{constructor(){super({id:Ssi,title:L(1832,"Preview selected action"),precondition:BE.Visible,keybinding:{weight:e5,primary:2051}})}run(a){let i=a.get(td);i instanceof FP&&i.acceptSelected(!0)}});var fce=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this.typeId=e;this.editor=t;this.showCommand=n;this.range=r;this.edits=s;this.onSelectNewEdit=l;this.additionalActions=c;this._keybindingService=p;this._actionWidgetService=h;this.allowEditorOverflow=!0;this.suppressMouseDown=!0;this.create(),this.visibleContext=o.bindTo(u),this.visibleContext.set(!0),this._register(Z(()=>this.visibleContext.reset())),this.editor.addContentWidget(this),this.editor.layoutContentWidget(this),this._register(Z((()=>this.editor.removeContentWidget(this)))),this._register(this.editor.onDidChangeCursorPosition(g=>{this.dispose()})),this._register(U.runAndSubscribe(p.onDidUpdateKeybindings,()=>{this._updateButtonTitle()}))}static{this.baseId="editor.widget.postEditWidget"}_updateButtonTitle(){this.button.element.title=this._keybindingService.appendKeybinding(this.showCommand.label,this.showCommand.id)}create(){this.domNode=_(".post-edit-widget"),this.button=this._register(new Wi(this.domNode,{supportIcons:!0})),this.button.label="$(insert)",this._register(j(this.domNode,re.CLICK,()=>this.showSelector()))}getId(){return fce.baseId+"."+this.typeId}getDomNode(){return this.domNode}getPosition(){return{position:this.range.getEndPosition(),preference:[2]}}showSelector(){let e=ir(this.button.element),t={x:e.left+e.width,y:e.top+e.height};this._actionWidgetService.show("postEditWidget",!1,this.edits.allEdits.map((o,n)=>({kind:"action",item:o,label:o.title,disabled:!1,canPreview:!1,group:{title:"",icon:q.fromId(n===this.edits.activeEditIndex?R.check.id:R.blank.id)}})),{onHide:()=>{this.editor.focus()},onSelect:o=>{this._actionWidgetService.hide(!1);let n=this.edits.allEdits.findIndex(r=>r===o);if(n!==this.edits.activeEditIndex)return this.onSelectNewEdit(n)}},t,this.editor.getDomNode()??void 0,this.additionalActions)}};fce=I([m(8,X),m(9,_e),m(10,td)],fce);var LY=class extends x{constructor(e,t,o,n,r,s,l,c){super();this._id=e;this._editor=t;this._visibleContext=o;this._showCommand=n;this._getAdditionalActions=r;this._instantiationService=s;this._bulkEditService=l;this._notificationService=c;this._currentWidget=this._register(new me);this._register(U.any(t.onDidChangeModel,t.onDidChangeModelContent)(()=>this.clear()))}async applyEditAndShowIfNeeded(e,t,o,n,r){if(!e.length||!this._editor.hasModel())return;let s=this._editor.getModel(),l=t.allEdits.at(t.activeEditIndex);if(!l)return;let c=async y=>{let w=this._editor.getModel();w&&(await w.undo(),this.applyEditAndShowIfNeeded(e,{activeEditIndex:y,allEdits:t.allEdits},o,n,r))},u=(y,w)=>{ao(y)||(this._notificationService.error(w),o&&this.show(e[0],t,c))},p=new ek(this._editor,3,void 0,r),h;try{h=await Wp(n(l,p.token),p.token)}catch(y){return u(y,d(1097,null,l.title,xn(y)))}finally{p.dispose()}if(r.isCancellationRequested)return;let g=Vwt(s.uri,e,h),f=e[0],v=s.deltaDecorations([],[{range:f,options:{description:"paste-line-suffix",stickiness:0}}]);this._editor.focus();let b,S;try{b=await this._bulkEditService.apply(g,{editor:this._editor,token:r}),S=s.getDecorationRange(v[0])}catch(y){return u(y,d(1096,null,l.title,xn(y)))}finally{s.deltaDecorations(v,[])}r.isCancellationRequested||o&&b.isApplied&&t.allEdits.length>1&&this.show(S??f,t,c)}show(e,t,o){this.clear(),this._editor.hasModel()&&(this._currentWidget.value=this._instantiationService.createInstance(fce,this._id,this._editor,this._visibleContext,this._showCommand,e,t,o,this._getAdditionalActions()))}clear(){this._currentWidget.clear()}tryShowSelector(){this._currentWidget.value?.showSelector()}};LY=I([m(5,F),m(6,La),m(7,Ne)],LY);var ysi="editor.changePasteType",Y4e="editor.pasteAs.preferences",Gwt=new Y("pasteWidgetVisible",!1,d(1082,null)),Isi="application/vnd.code.copymetadata",ku=class extends x{constructor(e,t,o,n,r,s,l,c,u,p){super();this._logService=o;this._bulkEditService=n;this._clipboardService=r;this._commandService=s;this._configService=l;this._languageFeaturesService=c;this._quickInputService=u;this._progressService=p;this._editor=e,this._register(e.onWillCopy(h=>this.handleCopy(h))),this._register(e.onWillCut(h=>this.handleCopy(h))),this._register(e.onWillPaste(h=>this.handlePaste(h))),this._pasteProgressManager=this._register(new _Y("pasteIntoEditor",e,t)),this._postPasteWidgetManager=this._register(t.createInstance(LY,"pasteIntoEditor",e,Gwt,{id:ysi,label:d(1083,null)},()=>ku._configureDefaultAction?[ku._configureDefaultAction]:[]))}static{this.ID="editor.contrib.copyPasteActionController"}static get(e){return e.getContribution(ku.ID)}static setConfigureDefaultAction(e){ku._configureDefaultAction=e}changePasteType(){this._postPasteWidgetManager.tryShowSelector()}async pasteAs(e){this._logService.trace("CopyPasteController.pasteAs"),this._editor.focus();try{this._logService.trace("Before calling editor.action.clipboardPasteAction"),this._pasteAsActionContext={preferred:e},await this._commandService.executeCommand("editor.action.clipboardPasteAction")}finally{this._pasteAsActionContext=void 0}}clearWidgets(){this._postPasteWidgetManager.clear()}isPasteAsEnabled(){return this._editor.getOption(97).enabled}async finishedPaste(){await this._currentPasteOperation}handleCopy(e){if(this._logService.trace("CopyPasteController#handleCopy"),!this._editor.hasTextFocus()||(this._clipboardService.clearInternalState?.(),!this.isPasteAsEnabled()))return;let t=this._editor.getModel(),o=this._editor._getViewModel(),n=this._editor.getSelections();if(!t||!o||!n?.length)return;let r={multicursorText:e.dataToCopy.multicursorText??null,pasteOnNewLine:e.dataToCopy.isFromEmptySelection,mode:null},s=this._languageFeaturesService.documentPasteEditProvider.ordered(t).filter(h=>!!h.prepareDocumentPaste);if(!s.length){this.setCopyMetadata(e.clipboardData,{defaultPastePayload:r});return}let l=new qx,c=s.flatMap(h=>h.copyMimeTypes??[]),u=xt();this.setCopyMetadata(e.clipboardData,{id:u,providerCopyMimeTypes:c,defaultPastePayload:r});let p=s.map(h=>({providerMimeTypes:h.copyMimeTypes,operation:Ln(g=>h.prepareDocumentPaste(t,e.dataToCopy.sourceRanges,l,g).catch(f=>{console.error(f)}))}));ku._currentCopyOperation?.operations.forEach(h=>h.operation.cancel()),ku._currentCopyOperation={handle:u,operations:p}}async handlePaste(e){if(this._logService.trace("CopyPasteController#handlePaste for id : ",e.metadata?.id),!this._editor.hasTextFocus())return;let t=e.toExternalVSDataTransfer();if(!t)return;t.delete(Isi),xu.get(this._editor)?.closeMessage(),this._currentPasteOperation?.cancel(),this._currentPasteOperation=void 0;let o=this._editor.getModel(),n=this._editor.getSelections();if(!n?.length||!o||this._editor.getOption(104)||!this.isPasteAsEnabled()&&!this._pasteAsActionContext)return;let r=this.fetchCopyMetadata(e);this._logService.trace("CopyPasteController#handlePaste with metadata : ",r?.id," and text.length : ",e.clipboardData.getData("text/plain").length);let s=Array.from(e.clipboardData.files).map(u=>u.type),l=[...e.clipboardData.types,...s,...r?.providerCopyMimeTypes??[],tr.uriList],c=this._languageFeaturesService.documentPasteEditProvider.ordered(o).filter(u=>{let p=this._pasteAsActionContext?.preferred;return p&&!this.providerMatchesPreference(u,p)?!1:u.pasteMimeTypes?.some(h=>Zje(h,l))});if(!c.length){this._pasteAsActionContext?.preferred&&(this.showPasteAsNoEditMessage(n,this._pasteAsActionContext.preferred),e.setHandled());return}e.setHandled(),this._pasteAsActionContext?this.showPasteAsPick(this._pasteAsActionContext.preferred,c,n,t,r):this.doPasteInline(c,n,t,r,e.browserEvent)}showPasteAsNoEditMessage(e,t){let o="only"in t?t.only.value:"preferences"in t?t.preferences.length?t.preferences.map(n=>n.value).join(", "):d(1076,null):t.providerId;xu.get(this._editor)?.showMessage(d(1078,null,o),e[0].getStartPosition())}doPasteInline(e,t,o,n,r){this._logService.trace("CopyPasteController#doPasteInline");let s=this._editor;if(!s.hasModel())return;let l=new ek(s,3,void 0),c=Ln(async u=>{let p=this._editor;if(!p.hasModel())return;let h=p.getModel(),g=new N,f=g.add(new Ye(u));g.add(l.token.onCancellationRequested(()=>f.cancel()));let v=f.token;try{if(await this.mergeInDataFromCopy(e,o,n,v),v.isCancellationRequested)return;let b=e.filter(w=>this.isSupportedPasteProvider(w,o));if(!b.length||b.length===1&&b[0]instanceof Zj)return this.applyDefaultPasteHandler(o,n,v,r);let S={triggerKind:0},y=await this.getPasteEdits(b,o,h,t,S,v);if(g.add(y),v.isCancellationRequested)return;if(y.edits.length===1&&y.edits[0].provider instanceof Zj)return this.applyDefaultPasteHandler(o,n,v,r);if(y.edits.length){let w=p.getOption(97).showPasteSelector==="afterPaste";return this._postPasteWidgetManager.applyEditAndShowIfNeeded(t,{activeEditIndex:this.getInitialActiveEditIndex(h,y.edits),allEdits:y.edits},w,async(k,T)=>{if(!k.provider.resolveDocumentPasteEdit)return k;let P=k.provider.resolveDocumentPasteEdit(k,T),O=new Ko,V=await this._pasteProgressManager.showWhile(t[0].getEndPosition(),d(1084,null,k.title),Va(Promise.race([O.p,P]),T),{cancel:()=>O.cancel()},0);return V&&(k.insertText=V.insertText,k.additionalEdit=V.additionalEdit),k},v)}await this.applyDefaultPasteHandler(o,n,v,r)}finally{g.dispose(),this._currentPasteOperation===c&&(this._currentPasteOperation=void 0)}});this._pasteProgressManager.showWhile(t[0].getEndPosition(),d(1081,null),c,{cancel:async()=>{c.cancel(),!l.token.isCancellationRequested&&await this.applyDefaultPasteHandler(o,n,l.token,r)}}).finally(()=>{l.dispose()}),this._currentPasteOperation=c}showPasteAsPick(e,t,o,n,r){this._logService.trace("CopyPasteController#showPasteAsPick");let s=Ln(async l=>{let c=this._editor;if(!c.hasModel())return;let u=c.getModel(),p=new N,h=p.add(new ek(c,3,void 0,l));try{if(await this.mergeInDataFromCopy(t,n,r,h.token),h.token.isCancellationRequested)return;let g=t.filter(y=>this.isSupportedPasteProvider(y,n,e));e&&(g=g.filter(y=>this.providerMatchesPreference(y,e)));let f={triggerKind:1,only:e&&"only"in e?e.only:void 0},v=p.add(await this.getPasteEdits(g,n,u,o,f,h.token));if(h.token.isCancellationRequested)return;if(e&&(v={edits:v.edits.filter(y=>"only"in e?e.only.contains(y.kind):"preferences"in e?e.preferences.some(w=>w.contains(y.kind)):e.providerId===y.provider.id),dispose:v.dispose}),!v.edits.length){e&&this.showPasteAsNoEditMessage(o,e);return}let b;if(e)b=v.edits.at(0);else{let y={id:"editor.pasteAs.default",label:d(1077,null),edit:void 0},w=await this._quickInputService.pick([...v.edits.map(k=>({label:k.title,description:k.kind?.value,edit:k})),...ku._configureDefaultAction?[{type:"separator"},{label:ku._configureDefaultAction.label,edit:void 0}]:[]],{placeHolder:d(1079,null)});if(w===y){ku._configureDefaultAction?.run();return}b=w?.edit}if(!b)return;let S=Vwt(u.uri,o,b);await this._bulkEditService.apply(S,{editor:this._editor})}finally{p.dispose(),this._currentPasteOperation===s&&(this._currentPasteOperation=void 0)}});this._progressService.withProgress({location:10,title:d(1080,null)},()=>s)}setCopyMetadata(e,t){this._logService.trace("CopyPasteController#setCopyMetadata new id : ",t.id),e.setData(Isi,JSON.stringify(t))}fetchCopyMetadata(e){this._logService.trace("CopyPasteController#fetchCopyMetadata");let t=e.clipboardData.getData(Isi);if(t)try{return JSON.parse(t)}catch{return}if(e.metadata)return{defaultPastePayload:{mode:e.metadata.mode,multicursorText:e.metadata.multicursorText??null,pasteOnNewLine:!!e.metadata.isFromEmptySelection}}}async mergeInDataFromCopy(e,t,o,n){if(this._logService.trace("CopyPasteController#mergeInDataFromCopy with metadata : ",o?.id),o?.id&&ku._currentCopyOperation?.handle===o.id){let r=ku._currentCopyOperation.operations.filter(l=>e.some(c=>c.pasteMimeTypes.some(u=>Zje(u,l.providerMimeTypes)))).map(l=>l.operation),s=await Promise.all(r);if(n.isCancellationRequested)return;for(let l of s.reverse())if(l)for(let[c,u]of l)t.replace(c,u)}if(!t.has(tr.uriList)){let r=await this._clipboardService.readResources();if(n.isCancellationRequested)return;r.length&&t.append(tr.uriList,DO(aw.create(r)))}}async getPasteEdits(e,t,o,n,r,s){let l=new N,c=await Va(Promise.all(e.map(async p=>{try{let h=await p.provideDocumentPasteEdits?.(o,n,t,r,s);return h&&l.add(h),h?.edits?.map(g=>({...g,provider:p}))}catch(h){ao(h)||console.error(h);return}})),s),u=di(c??[]).flat().filter(p=>!r.only||r.only.contains(p.kind));return{edits:Bwt(u),dispose:()=>l.dispose()}}async applyDefaultPasteHandler(e,t,o,n){let s=await(e.get(tr.text)??e.get("text"))?.asString()??"";if(o.isCancellationRequested)return;let l={clipboardEvent:n,text:s,pasteOnNewLine:t?.defaultPastePayload.pasteOnNewLine??!1,multicursorText:t?.defaultPastePayload.multicursorText??null,mode:null};this._logService.trace("CopyPasteController#applyDefaultPasteHandler for id : ",t?.id),this._editor.trigger("keyboard","paste",l)}isSupportedPasteProvider(e,t,o){return e.pasteMimeTypes?.some(n=>t.matches(n))?!o||this.providerMatchesPreference(e,o):!1}providerMatchesPreference(e,t){return"only"in t?e.providedPasteEditKinds.some(o=>t.only.contains(o)):"preferences"in t?e.providedPasteEditKinds.some(o=>t.preferences.some(n=>n.contains(o))):e.id===t.providerId}getInitialActiveEditIndex(e,t){let o=this._configService.getValue(Y4e,{resource:e.uri});for(let n of Array.isArray(o)?o:[]){let r=new fs(n),s=t.findIndex(l=>r.contains(l.kind));if(s>=0)return s}return 0}};ku=I([m(1,F),m(2,se),m(3,La),m(4,Fi),m(5,ge),m(6,B),m(7,Qt),m(8,Ue),m(9,Fo)],ku);var vce="9_cutcopypaste",M1o=Vr||document.queryCommandSupported("cut"),a9i=Vr||document.queryCommandSupported("copy"),P1o=typeof navigator.clipboard>"u"||Ac?document.queryCommandSupported("paste"):!0;function xsi(a){return a.register(),a}var $V=M1o?xsi(new pO({id:"editor.action.clipboardCutAction",precondition:void 0,kbOpts:Vr?{primary:2102,win:{primary:2102,secondary:[1044]},weight:100}:void 0,menuOpts:[{menuId:D.MenubarEditMenu,group:"2_ccp",title:d(983,null),order:1},{menuId:D.EditorContext,group:vce,title:d(979,null),when:pe.writable,order:1},{menuId:D.CommandPalette,group:"",title:d(979,null),order:1},{menuId:D.SimpleEditorContext,group:vce,title:d(979,null),when:pe.writable,order:1}]})):void 0,VP=a9i?xsi(new pO({id:"editor.action.clipboardCopyAction",precondition:void 0,kbOpts:Vr?{primary:2081,win:{primary:2081,secondary:[2067]},weight:100}:void 0,menuOpts:[{menuId:D.MenubarEditMenu,group:"2_ccp",title:d(982,null),order:2},{menuId:D.EditorContext,group:vce,title:d(977,null),order:2},{menuId:D.CommandPalette,group:"",title:d(977,null),order:1},{menuId:D.SimpleEditorContext,group:vce,title:d(977,null),order:2}]})):void 0;ve.appendMenuItem(D.MenubarEditMenu,{submenu:D.MenubarCopy,title:L(981,"Copy As"),group:"2_ccp",order:3});ve.appendMenuItem(D.EditorContext,{submenu:D.EditorContextCopy,title:L(981,"Copy As"),group:vce,order:3});ve.appendMenuItem(D.EditorContext,{submenu:D.EditorContextShare,title:L(985,"Share"),group:"11_share",order:-1,when:C.and(C.notEquals("resourceScheme","output"),pe.editorTextFocus)});ve.appendMenuItem(D.ExplorerContext,{submenu:D.ExplorerContextShare,title:L(985,"Share"),group:"11_share",order:-1});var WP=P1o?xsi(new pO({id:"editor.action.clipboardPasteAction",precondition:void 0,kbOpts:Vr?{primary:2100,win:{primary:2100,secondary:[1043]},linux:{primary:2100,secondary:[1043]},weight:100}:void 0,menuOpts:[{menuId:D.MenubarEditMenu,group:"2_ccp",title:d(984,null),order:4},{menuId:D.EditorContext,group:vce,title:d(980,null),when:pe.writable,order:4},{menuId:D.CommandPalette,group:"",title:d(980,null),order:1},{menuId:D.SimpleEditorContext,group:vce,title:d(980,null),when:pe.writable,order:4}]})):void 0,wsi=class extends Di{constructor(){super({id:"editor.action.clipboardCopyWithSyntaxHighlightingAction",label:L(978,"Copy with Syntax Highlighting"),precondition:void 0,kbOpts:{kbExpr:pe.textInputFocus,primary:0,weight:100}})}run(i,e){let t=i.get(se),o=i.get(Fi);t.trace("ExecCommandCopyWithSyntaxHighlightingAction#run"),!(!e.hasModel()||!e.getOption(45)&&e.getSelection().isEmpty())&&(Z1.forceCopyWithSyntaxHighlighting=!0,e.focus(),t.trace("ExecCommandCopyWithSyntaxHighlightingAction (before execCommand copy)"),Csi(e,o),t.trace("ExecCommandCopyWithSyntaxHighlightingAction (after execCommand copy)"),Z1.forceCopyWithSyntaxHighlighting=!1)}};function Csi(a,i){if(Z1.electronBugWorkaroundCopyEventHasFired=!1,a.getContainerDomNode().ownerDocument.execCommand("copy"),Vr&&Z1.electronBugWorkaroundCopyEventHasFired===!1){let{dataToCopy:e}=r3i(a._getViewModel(),void 0,Ac);i.writeText(e.text)}}function l9i(a,i){a&&(a.addImplementation(1e4,"code-editor",(e,t)=>{let o=e.get(se),n=e.get(Fi);o.trace("registerExecCommandImpl (addImplementation code-editor for : ",i,")");let r=e.get(qt).getFocusedCodeEditor();if(r&&r.hasTextFocus()&&r.hasModel()){let s=r.getOption(45),l=r.getSelection();return l&&l.isEmpty()&&!s||(r.getOption(170)&&i==="cut"?(s9i(r),o.trace("registerExecCommandImpl (before execCommand copy)"),Csi(r,n),r.trigger(void 0,"cut",void 0),o.trace("registerExecCommandImpl (after execCommand copy)")):(s9i(r),o.trace("registerExecCommandImpl (before execCommand "+i+")"),i==="copy"?Csi(r,n):r.getContainerDomNode().ownerDocument.execCommand(i),o.trace("registerExecCommandImpl (after execCommand "+i+")"))),!0}return!1}),a.addImplementation(0,"generic-dom",(e,t)=>{let o=e.get(se);return o.trace("registerExecCommandImpl (addImplementation generic-dom for : ",i,")"),o.trace("registerExecCommandImpl (before execCommand "+i+")"),sm().execCommand(i),o.trace("registerExecCommandImpl (after execCommand "+i+")"),!0}))}function s9i(a){if(a.getOption(170)){let e=Rle.get(a.getId());e&&e.handleWillCopy()}}l9i($V,"cut");l9i(VP,"copy");WP&&(WP.addImplementation(1e4,"code-editor",(a,i)=>{let e=a.get(se);e.trace("registerExecCommandImpl (addImplementation code-editor for : paste)");let t=a.get(qt),o=a.get(Fi),n=t.getFocusedCodeEditor();if(n&&n.hasModel()&&n.hasTextFocus()){if(n.getOption(170)){let l=Rle.get(n.getId());l&&l.handleWillPaste()}e.trace("registerExecCommandImpl (before triggerPaste)");let s=o.triggerPaste(Ki().vscodeWindowId);return s?(e.trace("registerExecCommandImpl (triggerPaste defined)"),s.then(async()=>(e.trace("registerExecCommandImpl (after triggerPaste)"),ku.get(n)?.finishedPaste()??Promise.resolve()))):(e.trace("registerExecCommandImpl (triggerPaste undefined)"),Wt?(e.trace("registerExecCommandImpl (Paste handling on web)"),(async()=>{let l=await o.readText();if(l!==""){let c=V7.INSTANCE.get(l),u=!1,p=null,h=null;c&&(u=n.getOption(45)&&!!c.isFromEmptySelection,p=typeof c.multicursorText<"u"?c.multicursorText:null,h=c.mode),e.trace("registerExecCommandImpl (clipboardText.length : ",l.length," id : ",c?.id,")"),n.trigger("keyboard","paste",{text:l,pasteOnNewLine:u,multicursorText:p,mode:h})}})()):!0)}return!1}),WP.addImplementation(0,"generic-dom",(a,i)=>(a.get(se).trace("registerExecCommandImpl (addImplementation generic-dom for : paste)"),a.get(Fi).triggerPaste(Ki().vscodeWindowId)??!1)));a9i&&ni(wsi);var RC=Object.freeze({id:"editor",order:5,type:"object",title:d(269,null),scope:6}),lxe={...RC,properties:{"editor.tabSize":{type:"number",default:fv.tabSize,minimum:1,maximum:100,markdownDescription:d(297,null,"`#editor.detectIndentation#`")},"editor.indentSize":{anyOf:[{type:"string",enum:["tabSize"]},{type:"number",minimum:1}],default:"tabSize",markdownDescription:d(275,null)},"editor.insertSpaces":{type:"boolean",default:fv.insertSpaces,markdownDescription:d(276,null,"`#editor.detectIndentation#`")},"editor.detectIndentation":{type:"boolean",default:fv.detectIndentation,markdownDescription:d(258,null,"`#editor.tabSize#`","`#editor.insertSpaces#`")},"editor.trimAutoWhitespace":{type:"boolean",default:fv.trimAutoWhitespace,description:d(298,null)},"editor.largeFileOptimizations":{type:"boolean",default:fv.largeFileOptimizations,description:d(277,null)},"editor.wordBasedSuggestions":{enum:["off","offWithInlineSuggestions","currentDocument","matchingDocuments","allDocuments"],default:"offWithInlineSuggestions",enumDescriptions:[d(305,null),d(306,null),d(303,null),d(304,null),d(302,null)],description:d(301,null),experiment:{mode:"auto"}},"editor.semanticHighlighting.enabled":{enum:[!0,!1,"configuredByTheme"],enumDescriptions:[d(292,null),d(291,null),d(289,null)],default:"configuredByTheme",description:d(290,null)},"editor.stablePeek":{type:"boolean",default:!1,markdownDescription:d(296,null)},"editor.maxTokenizationLineLength":{type:"integer",default:2e4,description:d(280,null)},"editor.experimental.asyncTokenization":{type:"boolean",default:!0,description:d(261,null),tags:["experimental"]},"editor.experimental.asyncTokenizationLogging":{type:"boolean",default:!1,description:d(262,null)},"editor.experimental.asyncTokenizationVerification":{type:"boolean",default:!1,description:d(263,null),tags:["experimental"]},"editor.experimental.treeSitterTelemetry":{type:"boolean",default:!1,markdownDescription:d(268,null),tags:["experimental"],experiment:{mode:"auto"}},"editor.experimental.preferTreeSitter.css":{type:"boolean",default:!1,markdownDescription:d(264,null),tags:["experimental"],experiment:{mode:"auto"}},"editor.experimental.preferTreeSitter.typescript":{type:"boolean",default:!1,markdownDescription:d(267,null),tags:["experimental"],experiment:{mode:"auto"}},"editor.experimental.preferTreeSitter.ini":{type:"boolean",default:!1,markdownDescription:d(265,null),tags:["experimental"],experiment:{mode:"auto"}},"editor.experimental.preferTreeSitter.regex":{type:"boolean",default:!1,markdownDescription:d(266,null),tags:["experimental"],experiment:{mode:"auto"}},"editor.language.brackets":{type:["array","null"],default:null,description:d(285,null),items:{type:"array",items:[{type:"string",description:d(288,null)},{type:"string",description:d(286,null)}]}},"editor.language.colorizedBracketPairs":{type:["array","null"],default:null,description:d(287,null),items:{type:"array",items:[{type:"string",description:d(288,null)},{type:"string",description:d(286,null)}]}},"diffEditor.maxComputationTime":{type:"number",default:cS.maxComputationTime,description:d(278,null)},"diffEditor.maxFileSize":{type:"number",default:cS.maxFileSize,description:d(279,null)},"diffEditor.renderSideBySide":{type:"boolean",default:cS.renderSideBySide,description:d(295,null)},"diffEditor.renderSideBySideInlineBreakpoint":{type:"number",default:cS.renderSideBySideInlineBreakpoint,description:d(284,null)},"diffEditor.useInlineViewWhenSpaceIsLimited":{type:"boolean",default:cS.useInlineViewWhenSpaceIsLimited,description:d(299,null)},"diffEditor.renderMarginRevertIcon":{type:"boolean",default:cS.renderMarginRevertIcon,description:d(283,null)},"diffEditor.renderGutterMenu":{type:"boolean",default:cS.renderGutterMenu,description:d(281,null)},"diffEditor.ignoreTrimWhitespace":{type:"boolean",default:cS.ignoreTrimWhitespace,description:d(274,null)},"diffEditor.renderIndicators":{type:"boolean",default:cS.renderIndicators,description:d(282,null)},"diffEditor.codeLens":{type:"boolean",default:cS.diffCodeLens,description:d(257,null)},"diffEditor.wordWrap":{type:"string",enum:["off","on","inherit"],default:cS.diffWordWrap,markdownEnumDescriptions:[d(308,null),d(309,null),d(307,null,"`#editor.wordWrap#`")]},"diffEditor.diffAlgorithm":{type:"string",enum:["legacy","advanced"],default:cS.diffAlgorithm,markdownEnumDescriptions:[d(260,null),d(259,null)]},"diffEditor.hideUnchangedRegions.enabled":{type:"boolean",default:cS.hideUnchangedRegions.enabled,markdownDescription:d(271,null)},"diffEditor.hideUnchangedRegions.revealLineCount":{type:"integer",default:cS.hideUnchangedRegions.revealLineCount,markdownDescription:d(273,null),minimum:1},"diffEditor.hideUnchangedRegions.minimumLineCount":{type:"integer",default:cS.hideUnchangedRegions.minimumLineCount,markdownDescription:d(272,null),minimum:1},"diffEditor.hideUnchangedRegions.contextLineCount":{type:"integer",default:cS.hideUnchangedRegions.contextLineCount,markdownDescription:d(270,null),minimum:1},"diffEditor.experimental.showMoves":{type:"boolean",default:cS.experimental.showMoves,markdownDescription:d(294,null)},"diffEditor.experimental.showEmptyDecorations":{type:"boolean",default:cS.experimental.showEmptyDecorations,description:d(293,null)},"diffEditor.experimental.useTrueInlineView":{type:"boolean",default:cS.experimental.useTrueInlineView,description:d(300,null)}}};function A1o(a){return typeof a.type<"u"||typeof a.anyOf<"u"}for(let a of k1){let i=a.schema;if(typeof i<"u")if(A1o(i))lxe.properties[`editor.${a.name}`]=i;else for(let e in i)Object.hasOwnProperty.call(i,e)&&(lxe.properties[e]=i[e])}var N1o=ne.as(Jt.Configuration);N1o.registerConfiguration(lxe);async function c9i(a){let i=["editor.fontFamily"],e=await a();for(let t of i)lxe.properties&&lxe.properties[t]&&(lxe.properties[t].defaultSnippets=e)}var xr=new class{constructor(){this.QuickFix=new fs("quickfix");this.Refactor=new fs("refactor");this.RefactorExtract=this.Refactor.append("extract");this.RefactorInline=this.Refactor.append("inline");this.RefactorMove=this.Refactor.append("move");this.RefactorRewrite=this.Refactor.append("rewrite");this.Notebook=new fs("notebook");this.Source=new fs("source");this.SourceOrganizeImports=this.Source.append("organizeImports");this.SourceFixAll=this.Source.append("fixAll");this.SurroundWith=this.Refactor.append("surround")}};function d9i(a,i){return!(a.include&&!a.include.intersects(i)||a.excludes&&a.excludes.some(e=>p9i(i,e,a.include))||!a.includeSourceActions&&xr.Source.contains(i))}function u9i(a,i){let e=i.kind?new fs(i.kind):void 0;return!(a.include&&(!e||!a.include.contains(e))||a.excludes&&e&&a.excludes.some(t=>p9i(e,t,a.include))||!a.includeSourceActions&&e&&xr.Source.contains(e)||a.onlyIncludePreferredActions&&!i.isPreferred)}function p9i(a,i,e){return!(!i.contains(a)||e&&i.contains(e))}var RY=class a{constructor(i,e,t){this.kind=i;this.apply=e;this.preferred=t}static fromUser(i,e){return!i||typeof i!="object"?new a(e.kind,e.apply,!1):new a(a.getKindFromUser(i,e.kind),a.getApplyFromUser(i,e.apply),a.getPreferredUser(i))}static getApplyFromUser(i,e){switch(typeof i.apply=="string"?i.apply.toLowerCase():""){case"first":return"first";case"never":return"never";case"ifsingle":return"ifSingle";default:return e}}static getKindFromUser(i,e){return typeof i.kind=="string"?new fs(i.kind):e}static getPreferredUser(i){return typeof i.preferred=="boolean"?i.preferred:!1}},qwt=class{constructor(i,e,t){this.action=i;this.provider=e;this.highlightRange=t}async resolve(i){if(this.provider?.resolveCodeAction&&!this.action.edit){let e;try{e=await this.provider.resolveCodeAction(this.action,i)}catch(t){ys(t)}e&&(this.action.edit=e.edit)}return this}};var cxe="editor.action.codeAction",Pz="editor.action.quickFix",dxe="editor.action.autoFix",uxe="editor.action.refactor";var pxe="editor.action.sourceAction",X4e="editor.action.organizeImports",J4e="editor.action.fixAll",O1o=1e3,ksi=class a extends x{constructor(e,t,o){super();this.documentation=t;this._register(o),this.allActions=[...e].sort(a.codeActionsComparator),this.validActions=this.allActions.filter(({action:n})=>!n.disabled)}static codeActionsPreferredComparator(e,t){return e.isPreferred&&!t.isPreferred?-1:!e.isPreferred&&t.isPreferred?1:0}static codeActionsComparator({action:e},{action:t}){return e.isAI&&!t.isAI?1:!e.isAI&&t.isAI?-1:yr(e.diagnostics)?yr(t.diagnostics)?a.codeActionsPreferredComparator(e,t):-1:yr(t.diagnostics)?1:a.codeActionsPreferredComparator(e,t)}get hasAutoFix(){return this.validActions.some(({action:e})=>!!e.kind&&xr.QuickFix.contains(new fs(e.kind))&&!!e.isPreferred)}get hasAIFix(){return this.validActions.some(({action:e})=>!!e.isAI)}get allAIFixes(){return this.validActions.every(({action:e})=>!!e.isAI)}},m9i={actions:[],documentation:void 0};async function hR(a,i,e,t,o,n){let r=t.filter||{},s={...r,excludes:[...r.excludes||[],xr.Notebook]},l={only:r.include?.value,trigger:t.type},c=new uce(i,n),u=t.type===2,p=F1o(a,i,u?s:r),h=new N,g=p.map(async v=>{let b=setTimeout(()=>o.report(v),1250);try{let S=await v.provideCodeActions(i,e,l,c.token);if(c.token.isCancellationRequested)return S?.dispose(),m9i;S&&h.add(S);let y=(S?.actions||[]).filter(k=>k&&u9i(r,k)),w=V1o(v,y,r.include);return{actions:y.map(k=>new qwt(k,v)),documentation:w}}catch(S){if(ao(S))throw S;return ys(S),m9i}finally{clearTimeout(b)}}),f=a.onDidChange(()=>{let v=a.all(i);$i(v,p)||c.cancel()});try{let v=await Promise.all(g),b=v.map(w=>w.actions).flat(),S=[...di(v.map(w=>w.documentation)),...W1o(a,i,t,b)],y=new ksi(b,S,h);return h.add(y),y}catch(v){throw h.dispose(),v}finally{f.dispose(),c.dispose()}}function F1o(a,i,e){return a.all(i).filter(t=>t.providedCodeActionKinds?t.providedCodeActionKinds.some(o=>d9i(e,new fs(o))):!0)}function*W1o(a,i,e,t){if(i&&t.length)for(let o of a.all(i))o._getAdditionalMenuItems&&(yield*o._getAdditionalMenuItems?.({trigger:e.type,only:e.filter?.include?.value},t.map(n=>n.action)))}function V1o(a,i,e){if(!a.documentation)return;let t=a.documentation.map(o=>({kind:new fs(o.kind),command:o.command}));if(e){let o;for(let n of t)n.kind.contains(e)&&(o?o.kind.contains(n.kind)&&(o=n):o=n);if(o)return o?.command}for(let o of i)if(o.kind){for(let n of t)if(n.kind.contains(new fs(o.kind)))return n.command}}async function i5(a,i,e,t,o=Se.None){let n=a.get(La),r=a.get(ge),s=a.get(Te),l=a.get(Ne),c=a.get(lr);if(s.publicLog2("codeAction.applyCodeAction",{codeActionTitle:i.action.title,codeActionKind:i.action.kind,codeActionIsPreferred:!!i.action.isPreferred,reason:e}),c.playSignal($o.codeActionTriggered),await i.resolve(o),!o.isCancellationRequested&&!(i.action.edit?.edits.length&&!(await n.apply(i.action.edit,{editor:t?.editor,label:i.action.title,quotableLabel:i.action.title,code:"undoredo.codeAction",respectAutoSaveConfig:e!=="onSave",showPreview:t?.preview,reason:Wc.codeAction({kind:i.action.kind,providerId:P1.fromExtensionId(i.provider?.extensionId)})})).isApplied)){if(i.action.command)try{await r.executeCommand(i.action.command.id,...i.action.command.arguments||[])}catch(u){let p=B1o(u);l.error(typeof p=="string"?p:d(986,null))}setTimeout(()=>c.playSignal($o.codeActionApplied),O1o)}}function B1o(a){return typeof a=="string"?a:a instanceof Error&&typeof a.message=="string"?a.message:void 0}$e.registerCommand("_executeCodeActionProvider",async function(a,i,e,t,o){if(!(i instanceof A))throw Yr();let{codeActionProvider:n}=a.get(Qt),r=a.get(Tt).getModel(i);if(!r)throw Yr();let s=ti.isISelection(e)?ti.liftSelection(e):z.isIRange(e)?r.validateRange(e):void 0;if(!s)throw Yr();let l=typeof t=="string"?new fs(t):void 0,c=await hR(n,r,s,{type:1,triggerAction:"other (default)",filter:{includeSourceActions:!0,include:l}},Mm.None,Se.None),u=[],p=Math.min(c.validActions.length,typeof o=="number"?o:0);for(let h=0;h<p;h++)u.push(c.validActions[h].resolve(Se.None));try{return await Promise.all(u),c.validActions.map(h=>h.action)}finally{setTimeout(()=>c.dispose(),100)}});var bl=(o=>(o[o.Hint=1]="Hint",o[o.Info=2]="Info",o[o.Warning=4]="Warning",o[o.Error=8]="Error",o))(bl||{});(s=>{function a(l,c){return c-l}s.compare=a;let i=Object.create(null);i[8]=d(2215,null),i[4]=d(2219,null),i[2]=d(2217,null);function e(l){return i[l]||""}s.toString=e;let t=Object.create(null);t[8]=d(2216,null),t[4]=d(2220,null),t[2]=d(2218,null);function o(l){return t[l]||""}s.toStringPlural=o;function n(l){switch(l){case bt.Error:return 8;case bt.Warning:return 4;case bt.Info:return 2;case bt.Ignore:return 1}}s.fromSeverity=n;function r(l){switch(l){case 8:return bt.Error;case 4:return bt.Warning;case 2:return bt.Info;case 1:return bt.Ignore}}s.toSeverity=r})(bl||={});var jV;(t=>{function i(o){return e(o,!0)}t.makeKey=i;function e(o,n){let r=[""];return o.source?r.push(o.source.replace("\xA6","\\\xA6")):r.push(""),o.code?typeof o.code=="string"?r.push(o.code.replace("\xA6","\\\xA6")):r.push(o.code.value.replace("\xA6","\\\xA6")):r.push(""),o.severity!==void 0&&o.severity!==null?r.push(bl.toString(o.severity)):r.push(""),o.message&&n?r.push(o.message.replace("\xA6","\\\xA6")):r.push(""),o.startLineNumber!==void 0&&o.startLineNumber!==null?r.push(o.startLineNumber.toString()):r.push(""),o.startColumn!==void 0&&o.startColumn!==null?r.push(o.startColumn.toString()):r.push(""),o.endLineNumber!==void 0&&o.endLineNumber!==null?r.push(o.endLineNumber.toString()):r.push(""),o.endColumn!==void 0&&o.endColumn!==null?r.push(o.endColumn.toString()):r.push(""),r.push(""),r.join("\xA6")}t.makeKeyOptionalMessage=e})(jV||={});var oa=le("markerService");var PY=class{constructor(i){this.keybindingService=i}static{this.codeActionCommands=[uxe,cxe,pxe,X4e,J4e]}getResolver(){let i=new co(()=>this.keybindingService.getKeybindings().filter(e=>PY.codeActionCommands.indexOf(e.command)>=0).filter(e=>e.resolvedKeybinding).map(e=>{let t=e.commandArgs;return e.command===X4e?t={kind:xr.SourceOrganizeImports.value}:e.command===J4e&&(t={kind:xr.SourceFixAll.value}),{resolvedKeybinding:e.resolvedKeybinding,...RY.fromUser(t,{kind:fs.None,apply:"never"})}}));return e=>{if(e.kind)return this.bestKeybindingForCodeAction(e,i.value)?.resolvedKeybinding}}bestKeybindingForCodeAction(i,e){if(!i.kind)return;let t=new fs(i.kind);return e.filter(o=>o.kind.contains(t)).filter(o=>o.preferred?i.isPreferred:!0).reduceRight((o,n)=>o?o.kind.contains(n.kind)?n:o:n,void 0)}};PY=I([m(0,_e)],PY);var UHr=te("symbolIcon.arrayForeground",To,d(1657,null)),zHr=te("symbolIcon.booleanForeground",To,d(1658,null)),KHr=te("symbolIcon.classForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},d(1659,null)),GHr=te("symbolIcon.colorForeground",To,d(1660,null)),qHr=te("symbolIcon.constantForeground",To,d(1661,null)),$Hr=te("symbolIcon.constructorForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},d(1662,null)),Esi=te("symbolIcon.enumeratorForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},d(1663,null)),g9i=te("symbolIcon.enumeratorMemberForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},d(1664,null)),jHr=te("symbolIcon.eventForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},d(1665,null)),QHr=te("symbolIcon.fieldForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},d(1666,null)),QV=te("symbolIcon.fileForeground",To,d(1667,null)),Tsi=te("symbolIcon.folderForeground",To,d(1668,null)),YHr=te("symbolIcon.functionForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},d(1669,null)),XHr=te("symbolIcon.interfaceForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},d(1670,null)),JHr=te("symbolIcon.keyForeground",To,d(1671,null)),ZHr=te("symbolIcon.keywordForeground",To,d(1672,null)),_si=te("symbolIcon.methodForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},d(1673,null)),eUr=te("symbolIcon.moduleForeground",To,d(1674,null)),tUr=te("symbolIcon.namespaceForeground",To,d(1675,null)),iUr=te("symbolIcon.nullForeground",To,d(1676,null)),oUr=te("symbolIcon.numberForeground",To,d(1677,null)),nUr=te("symbolIcon.objectForeground",To,d(1678,null)),rUr=te("symbolIcon.operatorForeground",To,d(1679,null)),sUr=te("symbolIcon.packageForeground",To,d(1680,null)),aUr=te("symbolIcon.propertyForeground",To,d(1681,null)),lUr=te("symbolIcon.referenceForeground",To,d(1682,null)),cUr=te("symbolIcon.snippetForeground",To,d(1683,null)),dUr=te("symbolIcon.stringForeground",To,d(1684,null)),uUr=te("symbolIcon.structForeground",To,d(1685,null)),pUr=te("symbolIcon.textForeground",To,d(1686,null)),mUr=te("symbolIcon.typeParameterForeground",To,d(1687,null)),hUr=te("symbolIcon.unitForeground",To,d(1688,null)),f9i=te("symbolIcon.variableForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},d(1689,null));var v9i=Object.freeze({kind:fs.Empty,title:d(1025,null)}),H1o=Object.freeze([{kind:xr.QuickFix,title:d(1027,null)},{kind:xr.RefactorExtract,title:d(1023,null),icon:R.wrench},{kind:xr.RefactorInline,title:d(1024,null),icon:R.wrench},{kind:xr.RefactorRewrite,title:d(1022,null),icon:R.wrench},{kind:xr.RefactorMove,title:d(1026,null),icon:R.wrench},{kind:xr.SurroundWith,title:d(1029,null),icon:R.surroundWith},{kind:xr.Source,title:d(1028,null),icon:R.symbolFile},v9i]);function b9i(a,i,e){if(!i)return a.map(n=>({kind:"action",item:n,group:v9i,disabled:!!n.action.disabled,label:n.action.disabled||n.action.title,canPreview:!!n.action.edit?.edits.length}));let t=H1o.map(n=>({group:n,actions:[]}));for(let n of a){let r=n.action.kind?new fs(n.action.kind):fs.None;for(let s of t)if(s.group.kind.contains(r)){s.actions.push(n);break}}let o=[];for(let n of t)if(n.actions.length){o.push({kind:"header",group:n.group});for(let r of n.actions){let s=n.group;o.push({kind:"action",item:r,group:r.action.isAI?{title:s.title,kind:s.kind,icon:R.sparkle}:s,label:r.action.title,disabled:!!r.action.disabled,keybinding:e(r.action)})}}return o}var Rsi=new Y("supportedCodeAction",""),S9i="_typescript.applyFixAllCodeAction",Dsi=class extends x{constructor(e,t,o,n=250){super();this._editor=e;this._markerService=t;this._signalChange=o;this._delay=n;this._autoTriggerTimer=this._register(new Ul);this.ignoreLightbulbOff=!1;this._register(this._markerService.onMarkerChanged(r=>this._onMarkerChanges(r))),this._register(this._editor.onDidChangeCursorPosition(()=>this._tryAutoTrigger()))}trigger(e){let t=this._getRangeOfSelectionUnlessWhitespaceEnclosed(e);this._signalChange(t?{trigger:e,selection:t}:void 0)}_onMarkerChanges(e){let t=this._editor.getModel();t&&e.some(o=>Qe(o,t.uri))&&this._tryAutoTrigger()}_tryAutoTrigger(){this._autoTriggerTimer.cancelAndSet(()=>{this.trigger({type:2,triggerAction:"other (default)"})},this._delay)}_getRangeOfSelectionUnlessWhitespaceEnclosed(e){if(!this._editor.hasModel())return;let t=this._editor.getSelection();if(e.type===1)return t;let o=this._editor.getOption(73).enabled;if(!(o==="off"&&!this.ignoreLightbulbOff)){{if(o==="off"||o==="on")return t;if(o==="onCode"){if(!t.isEmpty())return t;let r=this._editor.getModel(),{lineNumber:s,column:l}=t.getPosition(),c=r.getLineContent(s);if(c.length===0)return;if(l===1){if(/\s/.test(c[0]))return}else if(l===r.getLineMaxColumn(s)){if(/\s/.test(c[c.length-1]))return}else if(/\s/.test(c[l-2])&&/\s/.test(c[l-1]))return}}return t}}},AY;(t=>{let a;(r=>(r[r.Empty=0]="Empty",r[r.Triggered=1]="Triggered"))(a=t.Type||={}),t.Empty={type:0};class e{constructor(n,r,s){this.trigger=n;this.position=r;this._cancellablePromise=s;this.type=1;this.actions=s.catch(l=>{if(ao(l))return Lsi;throw l})}cancel(){this._cancellablePromise.cancel()}}t.Triggered=e})(AY||={});var Lsi=Object.freeze({allActions:[],validActions:[],dispose:()=>{},documentation:[],hasAutoFix:!1,hasAIFix:!1,allAIFixes:!1}),$wt=class extends x{constructor(e,t,o,n,r,s){super();this._editor=e;this._registry=t;this._markerService=o;this._progressService=r;this._configurationService=s;this._codeActionOracle=this._register(new me);this._state=AY.Empty;this._onDidChangeState=this._register(new E);this.onDidChangeState=this._onDidChangeState.event;this.codeActionsDisposable=this._register(new me);this._disposed=!1;this._ignoreLightbulbOff=!1;this._supportedCodeActions=Rsi.bindTo(n),this._register(this._editor.onDidChangeModel(()=>this._update())),this._register(this._editor.onDidChangeModelLanguage(()=>this._update())),this._register(this._registry.onDidChange(()=>this._update())),this._register(this._editor.onDidChangeConfiguration(l=>{l.hasChanged(73)&&this._update()})),this._update()}set ignoreLightbulbOff(e){if(this._ignoreLightbulbOff===e)return;this._ignoreLightbulbOff=e;let t=this._codeActionOracle.value;t&&(t.ignoreLightbulbOff=e,e&&t.trigger({type:2,triggerAction:"other (default)"}))}dispose(){this._disposed||(this._disposed=!0,super.dispose(),this.setState(AY.Empty,!0))}_settingEnabledNearbyQuickfixes(){let e=this._editor?.getModel();return this._configurationService?this._configurationService.getValue("editor.codeActionWidget.includeNearbyQuickFixes",{resource:e?.uri}):!1}_update(){if(this._disposed)return;this._codeActionOracle.value=void 0,this.setState(AY.Empty);let e=this._editor.getModel();if(e&&this._registry.has(e)&&!this._editor.getOption(104)){let t=this._registry.all(e).flatMap(n=>n.providedCodeActionKinds??[]);this._supportedCodeActions.set(t.join(" "));let o=new Dsi(this._editor,this._markerService,n=>{if(!n){this.setState(AY.Empty);return}let r=n.selection.getStartPosition(),s=Ln(async u=>{if(this._settingEnabledNearbyQuickfixes()&&n.trigger.type===1&&(n.trigger.triggerAction==="quick fix action"||n.trigger.filter?.include?.contains(xr.QuickFix))){let h=await hR(this._registry,e,n.selection,n.trigger,Mm.None,u);this.codeActionsDisposable.value=h;let g=[...h.allActions];if(u.isCancellationRequested)return h.dispose(),Lsi;let f=h.validActions?.some(b=>b.action.kind&&xr.QuickFix.contains(new fs(b.action.kind))&&!b.action.isAI),v=this._markerService.read({resource:e.uri});if(f){for(let b of h.validActions)b.action.command?.arguments?.some(S=>typeof S=="string"&&S.includes(S9i))&&(b.action.diagnostics=[...v.filter(S=>S.relatedInformation)]);return{validActions:h.validActions,allActions:g,documentation:h.documentation,hasAutoFix:h.hasAutoFix,hasAIFix:h.hasAIFix,allAIFixes:h.allAIFixes,dispose:()=>{this.codeActionsDisposable.value=h}}}else if(!f&&v.length>0){let b=n.selection.getPosition(),S=b,y=Number.MAX_VALUE,w=[...h.validActions];for(let T of v){let P=T.endColumn,O=T.endLineNumber,V=T.startLineNumber;if(O===b.lineNumber||V===b.lineNumber){S=new ye(O,P);let H={type:n.trigger.type,triggerAction:n.trigger.triggerAction,filter:{include:n.trigger.filter?.include?n.trigger.filter?.include:xr.QuickFix},autoApply:n.trigger.autoApply,context:{notAvailableMessage:n.trigger.context?.notAvailableMessage||"",position:S}},G=new ti(S.lineNumber,S.column,S.lineNumber,S.column),$=await hR(this._registry,e,G,H,Mm.None,u);if(u.isCancellationRequested)return $.dispose(),Lsi;if($.validActions.length!==0){for(let J of $.validActions)J.action.command?.arguments?.some(ae=>typeof ae=="string"&&ae.includes(S9i))&&(J.action.diagnostics=[...v.filter(ae=>ae.relatedInformation)]);h.allActions.length===0&&g.push(...$.allActions),Math.abs(b.column-P)<y?w.unshift(...$.validActions):w.push(...$.validActions)}y=Math.abs(b.column-P)}}let k=w.filter((T,P,O)=>O.findIndex(V=>V.action.title===T.action.title)===P);return k.sort((T,P)=>T.action.isPreferred&&!P.action.isPreferred?-1:!T.action.isPreferred&&P.action.isPreferred||T.action.isAI&&!P.action.isAI?1:!T.action.isAI&&P.action.isAI?-1:0),{validActions:k,allActions:g,documentation:h.documentation,hasAutoFix:h.hasAutoFix,hasAIFix:h.hasAIFix,allAIFixes:h.allAIFixes,dispose:()=>{this.codeActionsDisposable.value=h}}}}if(n.trigger.type===1){let h=await hR(this._registry,e,n.selection,n.trigger,Mm.None,u);return this.codeActionsDisposable.value=h,h}let p=await hR(this._registry,e,n.selection,n.trigger,Mm.None,u);return this.codeActionsDisposable.value=p,p});n.trigger.type===1&&this._progressService?.showWhile(s,250);let l=new AY.Triggered(n.trigger,r,s),c=!1;this._state.type===1&&(c=this._state.trigger.type===1&&l.type===1&&l.trigger.type===2&&this._state.position!==l.position),c?setTimeout(()=>{this.setState(l)},500):this.setState(l)},void 0);o.ignoreLightbulbOff=this._ignoreLightbulbOff,this._codeActionOracle.value=o,this._codeActionOracle.value.trigger({type:2,triggerAction:"other (default)"})}else this._supportedCodeActions.reset()}trigger(e){this._codeActionOracle.value?.trigger(e),this.codeActionsDisposable.dispose()}setState(e,t){e!==this._state&&(this._state.type===1&&this._state.cancel(),this._state=e,!t&&!this._disposed&&this._onDidChangeState.fire(e))}};var I9i=Ae("gutter-lightbulb",R.lightBulb,d(1037,null)),y9i=Ae("gutter-lightbulb-auto-fix",R.lightbulbAutofix,d(1035,null)),w9i=Ae("gutter-lightbulb-sparkle",R.lightbulbSparkle,d(1034,null)),C9i=Ae("gutter-lightbulb-aifix-auto-fix",R.lightbulbSparkleAutofix,d(1033,null)),x9i=Ae("gutter-lightbulb-sparkle-filled",R.sparkleFilled,d(1036,null)),Az;(t=>{let a;(r=>(r[r.Hidden=0]="Hidden",r[r.Showing=1]="Showing"))(a=t.Type||={}),t.Hidden={type:0};class e{constructor(n,r,s,l){this.actions=n;this.trigger=r;this.editorPosition=s;this.widgetPosition=l;this.type=1}}t.Showing=e})(Az||={});function Msi(a,i,e,t,o=!1){if(a.validActions.length<=0)return;let n,r=!1;a.allAIFixes?(n=o?x9i:R.sparkleFilled,a.validActions.length===1&&(r=!0)):a.hasAutoFix?a.hasAIFix?n=o?C9i:R.lightbulbSparkleAutofix:n=o?y9i:R.lightbulbAutofix:a.hasAIFix?n=o?w9i:R.lightbulbSparkle:n=o?I9i:R.lightBulb;let s;return r?s=d(1031,null,a.validActions[0].action.title):a.hasAutoFix&&e?s=d(1038,null,e):!a.hasAutoFix&&t?s=d(1032,null,t):s=d(1030,null),{actions:a,trigger:i,icon:n,autoRun:r,title:s,isGutter:o}}var HE=class extends x{constructor(e,t){super();this._editor=e;this._keybindingService=t;this.onlyWithEmptySelection=!1;this._onClick=this._register(new E);this.onClick=this._onClick.event;this._state=Me(this,Az.Hidden);this._gutterState=Me(this,Az.Hidden);this._combinedInfo=ke(this,e=>{let t=this._gutterState.read(e);if(t.type===1)return HE._computeLightBulbInfo(t,!0,this._preferredKbLabel.read(e),this._quickFixKbLabel.read(e));let o=this._state.read(e);if(o.type===1)return HE._computeLightBulbInfo(o,!1,this._preferredKbLabel.read(e),this._quickFixKbLabel.read(e))});this.lightBulbInfo=this._combinedInfo;this._iconClasses=[];this.lightbulbClasses=["codicon-"+I9i.id,"codicon-"+C9i.id,"codicon-"+y9i.id,"codicon-"+w9i.id,"codicon-"+x9i.id];this._preferredKbLabel=Me(this,void 0);this._quickFixKbLabel=Me(this,void 0);this.gutterDecoration=HE.GUTTER_DECORATION;this._domNode=_("div.lightBulbWidget"),this._domNode.role="listbox",this._register(Ms.ignoreTarget(this._domNode)),this._editor.addContentWidget(this),this._register(this._editor.onDidChangeModelContent(o=>{let n=this._editor.getModel(),r=this._state.get();(r.type!==1||!n||r.editorPosition.lineNumber>=n.getLineCount())&&this.hide();let s=this._gutterState.get();(s.type!==1||!n||s.editorPosition.lineNumber>=n.getLineCount())&&this.gutterHide()})),this._register(DIe(this._domNode,o=>{let n=this._state.get();if(n.type!==1)return;this._editor.focus(),o.preventDefault();let{top:r,height:s}=ir(this._domNode),l=this._editor.getOption(75),c=Math.floor(l/3);n.widgetPosition.position!==null&&n.widgetPosition.position.lineNumber<n.editorPosition.lineNumber&&(c+=l),this._onClick.fire({x:o.posx,y:r+s+c,actions:n.actions,trigger:n.trigger})})),this._register(j(this._domNode,"mouseenter",o=>{(o.buttons&1)===1&&this.hide()})),this._register(U.runAndSubscribe(this._keybindingService.onDidUpdateKeybindings,()=>{this._preferredKbLabel.set(this._keybindingService.lookupKeybinding(dxe)?.getLabel()??void 0,void 0),this._quickFixKbLabel.set(this._keybindingService.lookupKeybinding(Pz)?.getLabel()??void 0,void 0)})),this._register(be(o=>{let n=this._combinedInfo.read(o);this._updateLightBulbTitleAndIcon(n),this._updateGutterDecorationOptions(n)})),this._register(this._editor.onMouseDown(async o=>{if(!o.target.element||!this.lightbulbClasses.some(u=>o.target.element&&o.target.element.classList.contains(u)))return;let n=this._gutterState.get();if(n.type!==1)return;this._editor.focus();let{top:r,height:s}=ir(o.target.element),l=this._editor.getOption(75),c=Math.floor(l/3);n.widgetPosition.position!==null&&n.widgetPosition.position.lineNumber<n.editorPosition.lineNumber&&(c+=l),this._onClick.fire({x:o.event.posx,y:r+s+c,actions:n.actions,trigger:n.trigger})}))}static{this.GUTTER_DECORATION=mo.register({description:"codicon-gutter-lightbulb-decoration",glyphMarginClassName:q.asClassName(R.lightBulb),glyphMargin:{position:1},stickiness:1})}static{this.ID="editor.contrib.lightbulbWidget"}static{this._posPref=[0]}static _computeLightBulbInfo(e,t,o,n){if(e.type===1)return Msi(e.actions,e.trigger,o,n,t)}dispose(){super.dispose(),this._editor.removeContentWidget(this),this._gutterDecorationID&&this._removeGutterDecoration(this._gutterDecorationID)}getId(){return"LightBulbWidget"}getDomNode(){return this._domNode}getPosition(){let e=this._state.get();return e.type===1?e.widgetPosition:null}update(e,t,o){if(e.validActions.length<=0)return this.gutterHide(),this.hide();if(this.onlyWithEmptySelection&&!this._editor.getSelection()?.isEmpty())return this.gutterHide(),this.hide();if(!this._editor.hasTextFocus())return this.gutterHide(),this.hide();if(this._editor.getOptions().get(73).enabled==="off")return this.gutterHide(),this.hide();let s=this._editor.getModel();if(!s)return this.gutterHide(),this.hide();let{lineNumber:l,column:c}=s.validatePosition(o),u=s.getOptions().tabSize,p=this._editor.getOptions().get(59),h=s.getLineContent(l),g=kj(h,u),f=p.spaceWidth*g>22,v=P=>P>2&&this._editor.getTopForLineNumber(P)===this._editor.getTopForLineNumber(P-1),b=this._editor.getLineDecorations(l),S=!1;if(b)for(let P of b){let O=P.options.glyphMarginClassName;if(O&&!this.lightbulbClasses.some(V=>O.includes(V))){S=!0;break}}let y=l,w=1;if(!f){let P=O=>{let V=s.getLineContent(O);return/^\s*$|^\s+/.test(V)||V.length<=w};if(l>1&&!v(l-1)){let O=s.getLineCount(),V=l===O,H=l>1&&P(l-1),G=!V&&P(l+1),$=P(l),J=!G&&!H;if(!G&&!H&&!S)return this._gutterState.set(new Az.Showing(e,t,o,{position:{lineNumber:y,column:w},preference:HE._posPref}),void 0),this.renderGutterLightbub(),this.hide();H||V||H&&!$?y-=1:(G||J&&$)&&(y+=1)}else if(l===1&&(l===s.getLineCount()||!P(l+1)&&!P(l)))if(this._gutterState.set(new Az.Showing(e,t,o,{position:{lineNumber:y,column:w},preference:HE._posPref}),void 0),S)this.gutterHide();else return this.renderGutterLightbub(),this.hide();else if(l<s.getLineCount()&&!v(l+1))y+=1;else if(c*p.spaceWidth<22)return this.hide();w=/^\S\s*$/.test(s.getLineContent(y))?2:1}this._state.set(new Az.Showing(e,t,o,{position:{lineNumber:y,column:w},preference:HE._posPref}),void 0),this._gutterDecorationID&&(this._removeGutterDecoration(this._gutterDecorationID),this.gutterHide());let k=e.validActions,T=e.validActions[0].action.kind;if(k.length!==1||!T){this._editor.layoutContentWidget(this);return}this._editor.layoutContentWidget(this)}hide(){this._state.get()!==Az.Hidden&&(this._state.set(Az.Hidden,void 0),this._editor.layoutContentWidget(this))}gutterHide(){this._gutterState.get()!==Az.Hidden&&(this._gutterDecorationID&&this._removeGutterDecoration(this._gutterDecorationID),this._gutterState.set(Az.Hidden,void 0))}_updateLightBulbTitleAndIcon(e){this._domNode.classList.remove(...this._iconClasses),this._iconClasses=[],!(!e||e.isGutter)&&(this._domNode.title=e.title,this._iconClasses=q.asClassNameArray(e.icon),this._domNode.classList.add(...this._iconClasses))}_updateGutterDecorationOptions(e){!e||!e.isGutter||(this.gutterDecoration=mo.register({description:"codicon-gutter-lightbulb-decoration",glyphMarginClassName:q.asClassName(e.icon),glyphMargin:{position:1},stickiness:1}))}renderGutterLightbub(){let e=this._editor.getSelection();e&&(this._gutterDecorationID===void 0?this._addGutterDecoration(e.startLineNumber):this._updateGutterDecoration(this._gutterDecorationID,e.startLineNumber))}_addGutterDecoration(e){this._editor.changeDecorations(t=>{this._gutterDecorationID=t.addDecoration(new z(e,0,e,0),this.gutterDecoration)})}_removeGutterDecoration(e){this._editor.changeDecorations(t=>{t.removeDecoration(e),this._gutterDecorationID=void 0})}_updateGutterDecoration(e,t){this._editor.changeDecorations(o=>{o.changeDecoration(e,new z(t,0,t,0)),o.changeDecorationOptions(e,this.gutterDecoration)})}};HE=I([m(1,_e)],HE);var z1o="quickfix-edit-highlight",Cp=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this._commandService=l;this._configurationService=c;this._actionWidgetService=u;this._instantiationService=p;this._progressService=h;this._keybindingService=g;this._activeCodeActions=this._register(new me);this._showDisabled=!1;this._disposed=!1;this._onlyLightBulbWithEmptySelection=!1;this._lightBulbInfoObs=Me(this,void 0);this._preferredKbLabel=Me(this,void 0);this._quickFixKbLabel=Me(this,void 0);this._hasLightBulbStateObservers=!1;this.lightBulbState=Os({owner:this,onLastObserverRemoved:()=>{this._hasLightBulbStateObservers=!1,this._model.ignoreLightbulbOff=!1}},e=>(this._hasLightBulbStateObservers||(this._hasLightBulbStateObservers=!0,this._model.ignoreLightbulbOff=!0),this._lightBulbInfoObs.read(e)));this._editor=e,this._model=this._register(new $wt(this._editor,r.codeActionProvider,t,o,s,c)),this._register(this._model.onDidChangeState(f=>this.update(f))),this._register(U.runAndSubscribe(this._keybindingService.onDidUpdateKeybindings,()=>{this._preferredKbLabel.set(this._keybindingService.lookupKeybinding(dxe)?.getLabel()??void 0,void 0),this._quickFixKbLabel.set(this._keybindingService.lookupKeybinding(Pz)?.getLabel()??void 0,void 0)})),this._lightBulbWidget=new co(()=>{let f=this._editor.getContribution(HE.ID);return f&&(this._register(f.onClick(v=>this.showCodeActionsFromLightbulb(v.actions,v))),f.onlyWithEmptySelection=this._onlyLightBulbWithEmptySelection),f}),this._resolver=n.createInstance(PY),this._register(this._editor.onDidLayoutChange(()=>this._actionWidgetService.hide()))}static{this.ID="editor.contrib.codeActionController"}static get(e){return e.getContribution(Cp.ID)}set onlyLightBulbWithEmptySelection(e){let t=this._lightBulbWidget.rawValue;t&&(t.onlyWithEmptySelection=e),this._onlyLightBulbWithEmptySelection=e}dispose(){this._disposed=!0,super.dispose()}async showCodeActionsFromLightbulb(e,t){if(e.allAIFixes&&e.validActions.length===1){let o=e.validActions[0],n=o.action.command;n&&n.id==="inlineChat.start"&&n.arguments&&n.arguments.length>=1&&n.arguments[0]&&(n.arguments[0]={...n.arguments[0],autoSend:!1}),await this.applyCodeAction(o,!1,!1,"fromAILightbulb");return}await this.showCodeActionList(e,t,{includeDisabledActions:!1,fromLightbulb:!0})}showCodeActions(e,t,o){return this.showCodeActionList(t,o,{includeDisabledActions:!1,fromLightbulb:!1})}hideCodeActions(){this._actionWidgetService.hide()}manualTriggerAtCurrentPosition(e,t,o,n){if(!this._editor.hasModel())return;xu.get(this._editor)?.closeMessage();let r=this._editor.getPosition();this._trigger({type:1,triggerAction:t,filter:o,autoApply:n,context:{notAvailableMessage:e,position:r}})}_trigger(e){return this._model.trigger(e)}async applyCodeAction(e,t,o,n){let r=this._progressService.show(!0,500);try{await this._instantiationService.invokeFunction(i5,e,n,{preview:o,editor:this._editor})}finally{t&&this._trigger({type:2,triggerAction:"quick fix action",filter:{}}),r.done()}}hideLightBulbWidget(){this._lightBulbWidget.rawValue?.hide(),this._lightBulbWidget.rawValue?.gutterHide()}async update(e){if(e.type!==AY.Type.Triggered){this.hideLightBulbWidget(),this._lightBulbInfoObs.set(void 0,void 0);return}let t;try{t=await e.actions}catch(n){mt(n);return}if(!(this._disposed||this._editor.getSelection()?.startLineNumber!==e.position.lineNumber))if(this._lightBulbWidget.value?.update(t,e.trigger,e.position),this._lightBulbInfoObs.set(Msi(t,e.trigger,this._preferredKbLabel.get(),this._quickFixKbLabel.get()),void 0),e.trigger.type===1){if(e.trigger.filter?.include){let r=this.tryGetValidActionToApply(e.trigger,t);if(r){try{this.hideLightBulbWidget(),await this.applyCodeAction(r,!1,!1,"fromCodeActions")}finally{t.dispose()}return}if(e.trigger.context){let s=this.getInvalidActionThatWouldHaveBeenApplied(e.trigger,t);if(s&&s.action.disabled){xu.get(this._editor)?.showMessage(s.action.disabled,e.trigger.context.position),t.dispose();return}}}let n=!!e.trigger.filter?.include;if(e.trigger.context&&(!t.allActions.length||!n&&!t.validActions.length)){xu.get(this._editor)?.showMessage(e.trigger.context.notAvailableMessage,e.trigger.context.position),this._activeCodeActions.value=t,t.dispose();return}this._activeCodeActions.value=t,this.showCodeActionList(t,this.toCoords(e.position),{includeDisabledActions:n,fromLightbulb:!1})}else this._actionWidgetService.isVisible?t.dispose():this._activeCodeActions.value=t}getInvalidActionThatWouldHaveBeenApplied(e,t){if(t.allActions.length&&(e.autoApply==="first"&&t.validActions.length===0||e.autoApply==="ifSingle"&&t.allActions.length===1))return t.allActions.find(({action:o})=>o.disabled)}tryGetValidActionToApply(e,t){if(t.validActions.length&&(e.autoApply==="first"&&t.validActions.length>0||e.autoApply==="ifSingle"&&t.validActions.length===1))return t.validActions[0]}static{this.DECORATION=mo.register({description:"quickfix-highlight",className:z1o})}async showCodeActionList(e,t,o){let n=this._editor.createDecorationsCollection(),r=this._editor.getDomNode();if(!r)return;let s=o.includeDisabledActions&&(this._showDisabled||e.validActions.length===0)?e.allActions:e.validActions;if(!s.length)return;let l=ye.isIPosition(t)?this.toCoords(t):t,c={onSelect:async(u,p)=>{this.applyCodeAction(u,!0,!!p,o.fromLightbulb?"fromAILightbulb":"fromCodeActions"),this._actionWidgetService.hide(!1),n.clear()},onHide:u=>{this._editor?.focus(),n.clear()},onHover:async(u,p)=>{if(p.isCancellationRequested)return;let h=!1,g=u.action.kind;if(g){let f=new fs(g);h=[xr.RefactorExtract,xr.RefactorInline,xr.RefactorRewrite,xr.RefactorMove,xr.Source].some(b=>b.contains(f))}return{canPreview:h||!!u.action.edit?.edits.length}},onFocus:u=>{if(u&&u.action){let p=u.action.ranges,h=u.action.diagnostics;if(n.clear(),p&&p.length>0){let g=h&&h?.length>1?h.map(f=>({range:f,options:Cp.DECORATION})):p.map(f=>({range:f,options:Cp.DECORATION}));n.set(g)}else if(h&&h.length>0){let g=h.map(v=>({range:v,options:Cp.DECORATION}));n.set(g);let f=h[0];if(f.startLineNumber&&f.startColumn){let v=this._editor.getModel()?.getWordAtPosition({lineNumber:f.startLineNumber,column:f.startColumn})?.word;qr(d(1019,null,v,f.startLineNumber,f.startColumn))}}}else n.clear()}};this._actionWidgetService.show("codeActionWidget",!0,b9i(s,this._shouldShowHeaders(),this._resolver.getResolver()),c,l,r,this._getActionBarActions(e,t,o))}toCoords(e){if(!this._editor.hasModel())return{x:0,y:0};this._editor.revealPosition(e,1),this._editor.render();let t=this._editor.getScrolledVisiblePosition(e),o=ir(this._editor.getDomNode()),n=o.left+t.left,r=o.top+t.top+t.height;return{x:n,y:r}}_shouldShowHeaders(){let e=this._editor?.getModel();return this._configurationService.getValue("editor.codeActionWidget.showHeaders",{resource:e?.uri})}_getActionBarActions(e,t,o){if(o.fromLightbulb)return[];let n=e.documentation.map(r=>({id:r.id,label:r.title,tooltip:r.tooltip??"",class:void 0,enabled:!0,run:()=>this._commandService.executeCommand(r.id,...r.arguments??[])}));return o.includeDisabledActions&&e.validActions.length>0&&e.allActions.length!==e.validActions.length&&n.push(this._showDisabled?{id:"hideMoreActions",label:d(1020,null),enabled:!0,tooltip:"",class:void 0,run:()=>(this._showDisabled=!1,this.showCodeActionList(e,t,o))}:{id:"showMoreActions",label:d(1021,null),enabled:!0,tooltip:"",class:void 0,run:()=>(this._showDisabled=!0,this.showCodeActionList(e,t,o))}),n}};Cp=I([m(1,oa),m(2,X),m(3,F),m(4,Qt),m(5,wd),m(6,ge),m(7,B),m(8,td),m(9,F),m(10,wd),m(11,_e)],Cp);is((a,i)=>{((o,n)=>{n&&i.addRule(`.monaco-editor ${o} { background-color: ${n}; }`)})(".quickfix-edit-highlight",a.getColor(rS));let t=a.getColor(xO);t&&i.addRule(`.monaco-editor .quickfix-edit-highlight { border: 1px ${uf(a.type)?"dotted":"solid"} ${t}; box-sizing: border-box; }`)});function Z4e(a){return C.regex(Rsi.keys()[0],new RegExp("(\\s|^)"+ns(a.value)+"\\b"))}var Psi={type:"object",defaultSnippets:[{body:{kind:""}}],properties:{kind:{type:"string",description:d(991,null)},apply:{type:"string",description:d(987,null),default:"ifSingle",enum:["first","ifSingle","never"],enumDescriptions:[d(988,null),d(989,null),d(990,null)]},preferred:{type:"boolean",default:!1,description:d(992,null)}}};function Sce(a,i,e,t,o="other (default)"){a.hasModel()&&Cp.get(a)?.manualTriggerAtCurrentPosition(i,o,e,t)}var Qwt=class extends pl{constructor(){super({id:Pz,title:L(1013,"Quick Fix..."),precondition:C.and(pe.writable,pe.hasCodeActionsProvider),icon:R.lightBulb,f1:!0,keybinding:{when:pe.textInputFocus,primary:2137,weight:100},menu:{id:D.InlineChatEditorAffordance,group:"1_quickfix",order:0,when:C.and(pe.writable,pe.hasCodeActionsProvider)}})}runEditorCommand(i,e){return Sce(e,d(1000,null),void 0,void 0,"quick fix action")}},Ywt=class extends Oc{constructor(){super({id:cxe,precondition:C.and(pe.writable,pe.hasCodeActionsProvider),metadata:{description:"Trigger a code action",args:[{name:"args",schema:Psi}]}})}runEditorCommand(i,e,t){let o=RY.fromUser(t,{kind:fs.Empty,apply:"ifSingle"});return Sce(e,typeof t?.kind=="string"?o.preferred?d(998,null,t.kind):d(996,null,t.kind):o.preferred?d(997,null):d(995,null),{include:o.kind,includeSourceActions:!0,onlyIncludePreferredActions:o.preferred},o.apply)}},Xwt=class extends Di{constructor(){super({id:uxe,label:L(1014,"Refactor..."),precondition:C.and(pe.writable,pe.hasCodeActionsProvider),kbOpts:{kbExpr:pe.textInputFocus,primary:3120,mac:{primary:1328},weight:100},contextMenuOpts:{group:"1_modification",order:2,when:C.and(pe.writable,Z4e(xr.Refactor))},metadata:{description:"Refactor...",args:[{name:"args",schema:Psi}]}})}run(i,e,t){let o=RY.fromUser(t,{kind:xr.Refactor,apply:"never"});return Sce(e,typeof t?.kind=="string"?o.preferred?d(1004,null,t.kind):d(1002,null,t.kind):o.preferred?d(1003,null):d(1001,null),{include:xr.Refactor.contains(o.kind)?o.kind:fs.None,onlyIncludePreferredActions:o.preferred},o.apply,"refactor")}},Jwt=class extends Di{constructor(){super({id:pxe,label:L(1015,"Source Action..."),precondition:C.and(pe.writable,pe.hasCodeActionsProvider),contextMenuOpts:{group:"1_modification",order:2.1,when:C.and(pe.writable,Z4e(xr.Source))},metadata:{description:"Source Action...",args:[{name:"args",schema:Psi}]}})}run(i,e,t){let o=RY.fromUser(t,{kind:xr.Source,apply:"never"});return Sce(e,typeof t?.kind=="string"?o.preferred?d(1008,null,t.kind):d(1006,null,t.kind):o.preferred?d(1007,null):d(1005,null),{include:xr.Source.contains(o.kind)?o.kind:fs.None,includeSourceActions:!0,onlyIncludePreferredActions:o.preferred},o.apply,"source action")}},Zwt=class extends Di{constructor(){super({id:X4e,label:L(1012,"Organize Imports"),precondition:C.and(pe.writable,Z4e(xr.SourceOrganizeImports)),kbOpts:{kbExpr:pe.textInputFocus,primary:1581,weight:100},metadata:{description:L(1011,"Organize imports in the current file. Also called 'Optimize Imports' by some tools")}})}run(i,e){return Sce(e,d(999,null),{include:xr.SourceOrganizeImports,includeSourceActions:!0},"ifSingle","organize imports")}},eCt=class extends Di{constructor(){super({id:J4e,label:L(1009,"Fix All"),precondition:C.and(pe.writable,Z4e(xr.SourceFixAll))})}run(i,e){return Sce(e,d(1010,null),{include:xr.SourceFixAll,includeSourceActions:!0},"ifSingle","fix all")}},tCt=class extends Di{constructor(){super({id:dxe,label:L(993,"Auto Fix..."),precondition:C.and(pe.writable,Z4e(xr.QuickFix)),kbOpts:{kbExpr:pe.textInputFocus,primary:1625,mac:{primary:2649},weight:100}})}run(i,e){return Sce(e,d(994,null),{include:xr.QuickFix,onlyIncludePreferredActions:!0},"ifSingle","auto fix")}};xo(Cp.ID,Cp,3);xo(HE.ID,HE,4);W(Qwt);ni(Xwt);ni(Jwt);ni(Zwt);ni(tCt);ni(eCt);Xi(new Ywt);ne.as(Jt.Configuration).registerConfiguration({...RC,properties:{"editor.codeActionWidget.showHeaders":{type:"boolean",scope:6,description:d(1017,null),default:!0}}});ne.as(Jt.Configuration).registerConfiguration({...RC,properties:{"editor.codeActionWidget.includeNearbyQuickFixes":{type:"boolean",scope:6,description:d(1016,null),default:!0}}});ne.as(Jt.Configuration).registerConfiguration({...RC,properties:{"editor.codeActions.triggerOnFocusChange":{type:"boolean",scope:6,markdownDescription:d(1018,null,"`#editor.codeActionsOnSave#`","`#files.autoSave#`","`afterDelay`","`always`"),default:!1}}});var Ice=class a{constructor(){this.lenses=[]}static{this.Empty=new a}dispose(){this._store?.dispose()}get isDisposed(){return this._store?.isDisposed??!1}add(i,e){jc(i)&&(this._store??=new N,this._store.add(i));for(let t of i.lenses)this.lenses.push({symbol:t,provider:e})}};async function Asi(a,i,e){let t=a.ordered(i),o=new Map,n=new Ice,r=t.map(async(s,l)=>{o.set(s,l);try{let c=await Promise.resolve(s.provideCodeLenses(i,e));c&&n.add(c,s)}catch(c){ys(c)}});return await Promise.all(r),e.isCancellationRequested?(n.dispose(),Ice.Empty):(n.lenses=n.lenses.sort((s,l)=>s.symbol.range.startLineNumber<l.symbol.range.startLineNumber?-1:s.symbol.range.startLineNumber>l.symbol.range.startLineNumber?1:o.get(s.provider)<o.get(l.provider)?-1:o.get(s.provider)>o.get(l.provider)?1:s.symbol.range.startColumn<l.symbol.range.startColumn?-1:s.symbol.range.startColumn>l.symbol.range.startColumn?1:0),n)}$e.registerCommand("_executeCodeLensProvider",function(a,...i){let[e,t]=i;wo(A.isUri(e)),wo(typeof t=="number"||!t);let{codeLensProvider:o}=a.get(Qt),n=a.get(Tt).getModel(e);if(!n)throw Yr();let r=[],s=new N;return Asi(o,n,Se.None).then(l=>{s.add(l);let c=[];for(let u of l.lenses)t==null||u.symbol.command?r.push(u.symbol):t-- >0&&u.provider.resolveCodeLens&&c.push(Promise.resolve(u.provider.resolveCodeLens(n,u.symbol,Se.None)).then(p=>r.push(p||u.symbol)));return Promise.all(c)}).then(()=>r).finally(()=>{setTimeout(()=>s.dispose(),100)})});var Nsi=le("ICodeLensCache"),iCt=class{constructor(i,e){this.lineCount=i;this.data=e}},e3e=class{constructor(i){this._fakeProvider=new class{provideCodeLenses(){throw new Error("not supported")}};this._cache=new dl(20,.75);let e="codelens/cache";rf(ut,()=>i.remove(e,1));let t="codelens/cache2",o=i.get(t,1,"{}");this._deserialize(o);let n=U.filter(i.onWillSaveState,r=>r.reason===1);U.once(n)(r=>{i.store(t,this._serialize(),1,1)})}put(i,e){let t=e.lenses.map(r=>({range:r.symbol.range,command:r.symbol.command&&{id:"",title:r.symbol.command?.title}})),o=new Ice;o.add({lenses:t},this._fakeProvider);let n=new iCt(i.getLineCount(),o);this._cache.set(i.uri.toString(),n)}get(i){let e=this._cache.get(i.uri.toString());return e&&e.lineCount===i.getLineCount()?e.data:void 0}delete(i){this._cache.delete(i.uri.toString())}_serialize(){let i=Object.create(null);for(let[e,t]of this._cache){let o=new Set;for(let n of t.data.lenses)o.add(n.symbol.range.startLineNumber);i[e]={lineCount:t.lineCount,lines:[...o.values()]}}return JSON.stringify(i)}_deserialize(i){try{let e=JSON.parse(i);for(let t in e){let o=e[t],n=[];for(let s of o.lines)n.push({range:new z(s,1,s,11)});let r=new Ice;r.add({lenses:n},this._fakeProvider),this._cache.set(t,new iCt(o.lineCount,r))}}catch{}}};e3e=I([m(0,ce)],e3e);Ee(Nsi,e3e,1);var Osi=class{constructor(i,e,t){this.afterColumn=1073741824;this.afterLineNumber=i,this.heightInPx=e,this._onHeight=t,this.suppressMouseDown=!0,this.domNode=document.createElement("div")}onComputedHeight(i){this._lastHeight===void 0?this._lastHeight=i:this._lastHeight!==i&&(this._lastHeight=i,this._onHeight())}isVisible(){return this._lastHeight!==0&&this.domNode.hasAttribute("monaco-visible-view-zone")}},Fsi=class a{constructor(i,e){this.allowEditorOverflow=!1;this.suppressMouseDown=!0;this._commands=new Map;this._isEmpty=!0;this._editor=i,this._id=`codelens.widget-${a._idPool++}`,this.updatePosition(e),this._domNode=document.createElement("span"),this._domNode.className="codelens-decoration"}static{this._idPool=0}withCommands(i,e){this._commands.clear();let t=[],o=!1;for(let n=0;n<i.length;n++){let r=i[n];if(r&&(o=!0,r.command)){let s=Un(r.command.title.trim());if(r.command.id){let l=`c${a._idPool++}`;t.push(_("a",{id:l,title:r.command.tooltip,role:"button"},...s)),this._commands.set(l,r.command)}else t.push(_("span",{title:r.command.tooltip},...s));n+1<i.length&&t.push(_("span",void 0,"\xA0|\xA0"))}}o?(vi(this._domNode,...t),this._isEmpty&&e&&this._domNode.classList.add("fadein"),this._isEmpty=!1):vi(this._domNode,_("span",void 0,"no commands"))}getCommand(i){return i.parentElement===this._domNode?this._commands.get(i.id):void 0}getId(){return this._id}getDomNode(){return this._domNode}updatePosition(i){let e=this._editor.getModel().getLineFirstNonWhitespaceColumn(i);this._widgetPosition={position:{lineNumber:i,column:e},preference:[1]}}getPosition(){return this._widgetPosition||null}},mxe=class{constructor(){this._removeDecorations=[],this._addDecorations=[],this._addDecorationsCallbacks=[]}addDecoration(i,e){this._addDecorations.push(i),this._addDecorationsCallbacks.push(e)}removeDecoration(i){this._removeDecorations.push(i)}commit(i){let e=i.deltaDecorations(this._removeDecorations,this._addDecorations);for(let t=0,o=e.length;t<o;t++)this._addDecorationsCallbacks[t](e[t])}},k9i=mo.register({collapseOnReplaceEdit:!0,description:"codelens"}),t3e=class{constructor(i,e,t,o,n,r){this._isDisposed=!1;this._editor=e,this._data=i,this._decorationIds=[];let s,l=[];this._data.forEach((c,u)=>{c.symbol.command&&l.push(c.symbol),t.addDecoration({range:c.symbol.range,options:k9i},p=>this._decorationIds[u]=p),s?s=z.plusRange(s,c.symbol.range):s=z.lift(c.symbol.range)}),this._viewZone=new Osi(s.startLineNumber-1,n,r),this._viewZoneId=o.addZone(this._viewZone),l.length>0&&(this._createContentWidgetIfNecessary(),this._contentWidget.withCommands(l,!1))}_createContentWidgetIfNecessary(){this._contentWidget?this._editor.layoutContentWidget(this._contentWidget):(this._contentWidget=new Fsi(this._editor,this._viewZone.afterLineNumber+1),this._editor.addContentWidget(this._contentWidget))}dispose(i,e){this._decorationIds.forEach(i.removeDecoration,i),this._decorationIds=[],e?.removeZone(this._viewZoneId),this._contentWidget&&(this._editor.removeContentWidget(this._contentWidget),this._contentWidget=void 0),this._isDisposed=!0}isDisposed(){return this._isDisposed}isValid(){return this._decorationIds.some((i,e)=>{let t=this._editor.getModel().getDecorationRange(i),o=this._data[e].symbol;return!!(t&&z.isEmpty(o.range)===t.isEmpty())})}updateCodeLensSymbols(i,e){this._decorationIds.forEach(e.removeDecoration,e),this._decorationIds=[],this._data=i,this._data.forEach((t,o)=>{e.addDecoration({range:t.symbol.range,options:k9i},n=>this._decorationIds[o]=n)})}updateHeight(i,e){this._viewZone.heightInPx=i,e.layoutZone(this._viewZoneId),this._contentWidget&&this._editor.layoutContentWidget(this._contentWidget)}computeIfNecessary(i){if(!this._viewZone.isVisible())return null;for(let e=0;e<this._decorationIds.length;e++){let t=i.getDecorationRange(this._decorationIds[e]);t&&(this._data[e].symbol.range=t)}return this._data}updateCommands(i){this._createContentWidgetIfNecessary(),this._contentWidget.withCommands(i,!0);for(let e=0;e<this._data.length;e++){let t=i[e];if(t){let{symbol:o}=this._data[e];o.command=t.command||o.command}}}getCommand(i){return this._contentWidget?.getCommand(i)}getLineNumber(){let i=this._editor.getModel().getDecorationRange(this._decorationIds[0]);return i?i.startLineNumber:-1}update(i){if(this.isValid()){let e=this._editor.getModel().getDecorationRange(this._decorationIds[0]);e&&(this._viewZone.afterLineNumber=e.startLineNumber-1,i.layoutZone(this._viewZoneId),this._contentWidget&&(this._contentWidget.updatePosition(e.startLineNumber),this._editor.layoutContentWidget(this._contentWidget)))}}getItems(){return this._data}};var hf=le("ILanguageFeatureDebounceService"),Bsi;(t=>{let a=new WeakMap,i=0;function e(o){let n=a.get(o);return n===void 0&&(n=++i,a.set(o,n)),n}t.of=e})(Bsi||={});var Wsi=class{constructor(i){this._default=i}get(i){return this._default}update(i,e){return this._default}default(){return this._default}},Vsi=class{constructor(i,e,t,o,n,r){this._logService=i;this._name=e;this._registry=t;this._default=o;this._min=n;this._max=r;this._cache=new dl(50,.7)}_key(i){return i.id+this._registry.all(i).reduce((e,t)=>x$e(Bsi.of(t),e),0)}get(i){let e=this._key(i),t=this._cache.get(e);return t?Bn(t.value,this._min,this._max):this.default()}update(i,e){let t=this._key(i),o=this._cache.get(t);o||(o=new rgt(6),this._cache.set(t,o));let n=Bn(o.update(e),this._min,this._max);return ec(i.uri,"output")||this._logService.trace(`[DEBOUNCE: ${this._name}] for ${i.uri.toString()} is ${n}ms`),n}_overall(){let i=new k$e;for(let[,e]of this._cache)i.update(e.value);return i.value}default(){let i=this._overall()|0||this._default;return Bn(i,this._min,this._max)}},i3e=class{constructor(i,e){this._logService=i;this._data=new Map;this._isDev=e.isExtensionDevelopment||!e.isBuilt}for(i,e,t){let o=t?.min??50,n=t?.max??o**2,r=t?.key??void 0,s=`${Bsi.of(i)},${o}${r?","+r:""}`,l=this._data.get(s);return l||(this._isDev?(this._logService.debug(`[DEBOUNCE: ${e}] is disabled in developed mode`),l=new Wsi(o*1.5)):l=new Vsi(this._logService,e,i,this._overallAverage()|0||o*1.5,o,n),this._data.set(s,l)),l}_overallAverage(){let i=new k$e;for(let e of this._data.values())i.update(e.default());return i.value}};i3e=I([m(0,se),m(1,Eo)],i3e);Ee(hf,i3e,1);var n5=class{constructor(i,e,t,o,n,r){this._editor=i;this._languageFeaturesService=e;this._commandService=o;this._notificationService=n;this._codeLensCache=r;this._disposables=new N;this._localToDispose=new N;this._lenses=[];this._oldCodeLensModels=new N;this._provideCodeLensDebounce=t.for(e.codeLensProvider,"CodeLensProvide",{min:250}),this._resolveCodeLensesDebounce=t.for(e.codeLensProvider,"CodeLensResolve",{min:250,salt:"resolve"}),this._resolveCodeLensesScheduler=new Dt(()=>this._resolveCodeLensesInViewport(),this._resolveCodeLensesDebounce.default()),this._disposables.add(this._editor.onDidChangeModel(()=>this._onModelChange())),this._disposables.add(this._editor.onDidChangeModelLanguage(()=>this._onModelChange())),this._disposables.add(this._editor.onDidChangeConfiguration(s=>{(s.hasChanged(59)||s.hasChanged(25)||s.hasChanged(24))&&this._updateLensStyle(),s.hasChanged(23)&&this._onModelChange()})),this._disposables.add(e.codeLensProvider.onDidChange(this._onModelChange,this)),this._onModelChange(),this._updateLensStyle()}static{this.ID="css.editor.codeLens"}dispose(){this._localDispose(),this._localToDispose.dispose(),this._disposables.dispose(),this._resolveCodeLensesScheduler.dispose(),this._oldCodeLensModels.dispose(),this._currentCodeLensModel?.dispose()}_getLayoutInfo(){let i=Math.max(1.3,this._editor.getOption(75)/this._editor.getOption(61)),e=this._editor.getOption(25);return(!e||e<5)&&(e=this._editor.getOption(61)*.9|0),{fontSize:e,codeLensHeight:e*i|0}}_updateLensStyle(){let{codeLensHeight:i,fontSize:e}=this._getLayoutInfo(),t=this._editor.getOption(24),o=this._editor.getOption(59),{style:n}=this._editor.getContainerDomNode();n.setProperty("--vscode-editorCodeLens-lineHeight",`${i}px`),n.setProperty("--vscode-editorCodeLens-fontSize",`${e}px`),n.setProperty("--vscode-editorCodeLens-fontFeatureSettings",o.fontFeatureSettings),t&&(n.setProperty("--vscode-editorCodeLens-fontFamily",t),n.setProperty("--vscode-editorCodeLens-fontFamilyDefault",fu.fontFamily)),this._editor.changeViewZones(r=>{for(let s of this._lenses)s.updateHeight(i,r)})}_localDispose(){this._getCodeLensModelPromise?.cancel(),this._getCodeLensModelPromise=void 0,this._resolveCodeLensesPromise?.cancel(),this._resolveCodeLensesPromise=void 0,this._localToDispose.clear(),this._oldCodeLensModels.clear(),this._currentCodeLensModel?.dispose()}_onModelChange(){this._localDispose();let i=this._editor.getModel();if(!i||!this._editor.getOption(23)||i.isTooLargeForTokenization())return;let e=this._codeLensCache.get(i);if(e&&this._renderCodeLensSymbols(e),!this._languageFeaturesService.codeLensProvider.has(i)){e&&tn(()=>{let o=this._codeLensCache.get(i);e===o&&(this._codeLensCache.delete(i),this._onModelChange())},30*1e3,this._localToDispose);return}for(let o of this._languageFeaturesService.codeLensProvider.all(i))if(typeof o.onDidChange=="function"){let n=o.onDidChange(()=>t.schedule());this._localToDispose.add(n)}let t=new Dt(()=>{let o=Date.now();this._getCodeLensModelPromise?.cancel(),this._getCodeLensModelPromise=Ln(n=>Asi(this._languageFeaturesService.codeLensProvider,i,n)),this._getCodeLensModelPromise.then(n=>{this._currentCodeLensModel&&this._oldCodeLensModels.add(this._currentCodeLensModel),this._currentCodeLensModel=n,this._codeLensCache.put(i,n);let r=this._provideCodeLensDebounce.update(i,Date.now()-o);t.delay=r,this._renderCodeLensSymbols(n),this._resolveCodeLensesInViewportSoon()},mt)},this._provideCodeLensDebounce.get(i));this._localToDispose.add(t),this._localToDispose.add(Z(()=>this._resolveCodeLensesScheduler.cancel())),this._localToDispose.add(this._editor.onDidChangeModelContent(()=>{this._editor.changeDecorations(o=>{this._editor.changeViewZones(n=>{let r=[],s=-1;this._lenses.forEach(c=>{!c.isValid()||s===c.getLineNumber()?r.push(c):(c.update(n),s=c.getLineNumber())});let l=new mxe;r.forEach(c=>{c.dispose(l,n),this._lenses.splice(this._lenses.indexOf(c),1)}),l.commit(o)})}),t.schedule(),this._resolveCodeLensesScheduler.cancel(),this._resolveCodeLensesPromise?.cancel(),this._resolveCodeLensesPromise=void 0})),this._localToDispose.add(this._editor.onDidFocusEditorText(()=>{t.schedule()})),this._localToDispose.add(this._editor.onDidBlurEditorText(()=>{t.cancel()})),this._localToDispose.add(this._editor.onDidScrollChange(o=>{o.scrollTopChanged&&this._lenses.length>0&&this._resolveCodeLensesInViewportSoon()})),this._localToDispose.add(this._editor.onDidLayoutChange(()=>{this._resolveCodeLensesInViewportSoon()})),this._localToDispose.add(Z(()=>{if(this._editor.getModel()){let o=DC.capture(this._editor);this._editor.changeDecorations(n=>{this._editor.changeViewZones(r=>{this._disposeAllLenses(n,r)})}),o.restore(this._editor)}else this._disposeAllLenses(void 0,void 0)})),this._localToDispose.add(this._editor.onMouseDown(o=>{if(o.target.type!==9)return;let n=o.target.element;if(n?.tagName==="SPAN"&&(n=n.parentElement),n?.tagName==="A")for(let r of this._lenses){let s=r.getCommand(n);if(s){this._commandService.executeCommand(s.id,...s.arguments||[]).catch(l=>this._notificationService.error(l));break}}})),t.schedule()}_disposeAllLenses(i,e){let t=new mxe;for(let o of this._lenses)o.dispose(t,e);i&&t.commit(i),this._lenses.length=0}_renderCodeLensSymbols(i){if(!this._editor.hasModel())return;let e=this._editor.getModel().getLineCount(),t=[],o;for(let s of i.lenses){let l=s.symbol.range.startLineNumber;l<1||l>e||(o&&o[o.length-1].symbol.range.startLineNumber===l?o.push(s):(o=[s],t.push(o)))}if(!t.length&&!this._lenses.length)return;let n=DC.capture(this._editor),r=this._getLayoutInfo();this._editor.changeDecorations(s=>{this._editor.changeViewZones(l=>{let c=new mxe,u=0,p=0;for(;p<t.length&&u<this._lenses.length;){let h=t[p][0].symbol.range.startLineNumber,g=this._lenses[u].getLineNumber();g<h?(this._lenses[u].dispose(c,l),this._lenses.splice(u,1)):g===h?(this._lenses[u].updateCodeLensSymbols(t[p],c),p++,u++):(this._lenses.splice(u,0,new t3e(t[p],this._editor,c,l,r.codeLensHeight,()=>this._resolveCodeLensesInViewportSoon())),u++,p++)}for(;u<this._lenses.length;)this._lenses[u].dispose(c,l),this._lenses.splice(u,1);for(;p<t.length;)this._lenses.push(new t3e(t[p],this._editor,c,l,r.codeLensHeight,()=>this._resolveCodeLensesInViewportSoon())),p++;c.commit(s)})}),n.restore(this._editor)}_resolveCodeLensesInViewportSoon(){this._editor.getModel()&&this._resolveCodeLensesScheduler.schedule()}_resolveCodeLensesInViewport(){this._resolveCodeLensesPromise?.cancel(),this._resolveCodeLensesPromise=void 0;let i=this._editor.getModel();if(!i)return;let e=[],t=[];if(this._lenses.forEach(r=>{let s=r.computeIfNecessary(i);s&&(e.push(s),t.push(r))}),e.length===0){this._oldCodeLensModels.clear();return}let o=Date.now(),n=Ln(r=>{let s=e.map((l,c)=>{let u=new Array(l.length),p=l.map((h,g)=>!h.symbol.command&&typeof h.provider.resolveCodeLens=="function"?Promise.resolve(h.provider.resolveCodeLens(i,h.symbol,r)).then(f=>{u[g]=f},ys):(u[g]=h.symbol,Promise.resolve(void 0)));return Promise.all(p).then(()=>{!r.isCancellationRequested&&!t[c].isDisposed()&&t[c].updateCommands(u)})});return Promise.all(s)});this._resolveCodeLensesPromise=n,this._resolveCodeLensesPromise.then(()=>{let r=this._resolveCodeLensesDebounce.update(i,Date.now()-o);this._resolveCodeLensesScheduler.delay=r,this._currentCodeLensModel&&this._codeLensCache.put(i,this._currentCodeLensModel),this._oldCodeLensModels.clear(),n===this._resolveCodeLensesPromise&&(this._resolveCodeLensesPromise=void 0)},r=>{mt(r),n===this._resolveCodeLensesPromise&&(this._resolveCodeLensesPromise=void 0)})}async getModel(){return await this._getCodeLensModelPromise,await this._resolveCodeLensesPromise,this._currentCodeLensModel?.isDisposed?void 0:this._currentCodeLensModel}};n5=I([m(1,Qt),m(2,hf),m(3,ge),m(4,Ne),m(5,Nsi)],n5);xo(n5.ID,n5,1);ni(class extends Di{constructor(){super({id:"codelens.showLensesInCurrentLine",precondition:pe.hasCodeLensProvider,label:L(1040,"Show CodeLens Commands for Current Line")})}async run(i,e){if(!e.hasModel())return;let t=i.get(Ue),o=i.get(ge),n=i.get(Ne),r=e.getSelection().positionLineNumber,s=e.getContribution(n5.ID);if(!s)return;let l=await s.getModel();if(!l)return;let c=[];for(let h of l.lenses)h.symbol.command&&h.symbol.range.startLineNumber===r&&c.push({label:h.symbol.command.title,command:h.symbol.command});if(c.length===0)return;let u=await t.pick(c,{canPickMany:!1,placeHolder:d(1039,null)});if(!u)return;let p=u.command;if(l.isDisposed){let g=(await s.getModel())?.lenses.find(f=>f.symbol.range.startLineNumber===r&&f.symbol.command?.title===p.title);if(!g||!g.symbol.command)return;p=g.symbol.command}try{await o.executeCommand(p.id,...p.arguments||[])}catch(h){n.error(h)}}});var E9i=[];function ik(a){E9i.push(a)}function T9i(){return E9i.slice(0)}var hxe=class{constructor(i,e,t,o){this.priority=i;this.range=e;this.initialMousePosX=t;this.initialMousePosY=o;this.type=1}equals(i){return i.type===1&&this.range.equalsRange(i.range)}canAdoptVisibleHover(i,e){return i.type===1&&e.lineNumber===this.range.startLineNumber}},r5=class{constructor(i,e,t,o,n,r){this.priority=i;this.owner=e;this.range=t;this.initialMousePosX=o;this.initialMousePosY=n;this.supportsMarkerHover=r;this.type=2}equals(i){return i.type===2&&this.owner===i.owner}canAdoptVisibleHover(i,e){return i.type===2&&this.owner===i.owner}},ok=class{constructor(i,e){this.renderedHoverParts=i;this.disposables=e}dispose(){for(let i of this.renderedHoverParts)i.dispose();this.disposables?.dispose()}},z_=new class{constructor(){this._participants=[]}register(i){this._participants.push(i)}getAll(){return this._participants}};var s5=class{constructor(i){this._editorWorkerService=i}async provideDocumentColors(i,e){return this._editorWorkerService.computeDefaultDocumentColors(i.uri)}provideColorPresentations(i,e,t){let o=e.range,n=e.color,r=new We(new zt(Math.round(255*n.red),Math.round(255*n.green),Math.round(255*n.blue),n.alpha)),s=We.Format.CSS.formatRGB(r),l=We.Format.CSS.formatHSL(r),c=We.Format.CSS.formatHexA(r,!0),u=[];return u.push({label:s,textEdit:{range:o,text:s}}),u.push({label:l,textEdit:{range:o,text:l}}),u.push({label:c,textEdit:{range:o,text:c}}),u}};s5=I([m(0,Qs)],s5);var gxe=class extends x{constructor(i,e){super(),this._register(i.colorProvider.register("*",new s5(e)))}};gxe=I([m(0,Qt),m(1,Qs)],gxe);async function rCt(a,i,e,t="auto"){return sCt(new Hsi,a,i,e,t)}function Usi(a,i,e,t){return Promise.resolve(e.provideColorPresentations(a,i,t))}var Hsi=class{constructor(){}async compute(i,e,t,o){let n=await i.provideDocumentColors(e,t);if(Array.isArray(n))for(let r of n)o.push({colorInfo:r,provider:i});return Array.isArray(n)}},oCt=class{constructor(){}async compute(i,e,t,o){let n=await i.provideDocumentColors(e,t);if(Array.isArray(n))for(let r of n)o.push({range:r.range,color:[r.color.red,r.color.green,r.color.blue,r.color.alpha]});return Array.isArray(n)}},nCt=class{constructor(i){this.colorInfo=i}async compute(i,e,t,o){let n=await i.provideColorPresentations(e,this.colorInfo,Se.None);return Array.isArray(n)&&o.push(...n),Array.isArray(n)}};async function sCt(a,i,e,t,o){let n=!1,r,s=[],l=i.ordered(e);for(let c=l.length-1;c>=0;c--){let u=l[c];if(o!=="always"&&u instanceof s5)r=u;else try{await a.compute(u,e,t,s)&&(n=!0)}catch(p){ys(p)}}return n?s:r&&o!=="never"?(await a.compute(r,e,t,s),s):[]}function zsi(a,i){let{colorProvider:e}=a.get(Qt),t=a.get(Tt).getModel(i);if(!t)throw Yr();let o=a.get(B).getValue("editor.defaultColorDecorators",{resource:i});return{model:t,colorProviderRegistry:e,defaultColorDecoratorsEnablement:o}}var Gsi=Object.create({}),Iw=class extends x{constructor(e,t,o,n){super();this._editor=e;this._configurationService=t;this._languageFeaturesService=o;this._localToDispose=this._register(new N);this._decorationsIds=[];this._colorDatas=new Map;this._decoratorLimitReporter=this._register(new Ksi);this._colorDecorationClassRefs=this._register(new N);this._colorDecoratorIds=this._editor.createDecorationsCollection(),this._ruleFactory=this._register(new M7(this._editor)),this._debounceInformation=n.for(o.colorProvider,"Document Colors",{min:Iw.RECOMPUTE_TIME}),this._register(e.onDidChangeModel(()=>{this._isColorDecoratorsEnabled=this.isEnabled(),this.updateColors()})),this._register(e.onDidChangeModelLanguage(()=>this.updateColors())),this._register(o.colorProvider.onDidChange(()=>this.updateColors())),this._register(e.onDidChangeConfiguration(r=>{let s=this._isColorDecoratorsEnabled;this._isColorDecoratorsEnabled=this.isEnabled(),this._defaultColorDecoratorsEnablement=this._editor.getOption(167);let l=s!==this._isColorDecoratorsEnabled||r.hasChanged(27),c=r.hasChanged(167);(l||c)&&(this._isColorDecoratorsEnabled?this.updateColors():this.removeAllDecorations())})),this._timeoutTimer=null,this._computePromise=null,this._isColorDecoratorsEnabled=this.isEnabled(),this._defaultColorDecoratorsEnablement=this._editor.getOption(167),this.updateColors()}static{this.ID="editor.contrib.colorDetector"}static{this.RECOMPUTE_TIME=1e3}isEnabled(){let e=this._editor.getModel();if(!e)return!1;let t=e.getLanguageId(),o=this._configurationService.getValue(t);if(o&&typeof o=="object"){let n=o.colorDecorators;if(n&&n.enable!==void 0&&!n.enable)return n.enable}return this._editor.getOption(26)}get limitReporter(){return this._decoratorLimitReporter}static get(e){return e.getContribution(this.ID)}dispose(){this.stop(),this.removeAllDecorations(),super.dispose()}updateColors(){if(this.stop(),!this._isColorDecoratorsEnabled)return;let e=this._editor.getModel();!e||!this._languageFeaturesService.colorProvider.has(e)||(this._localToDispose.add(this._editor.onDidChangeModelContent(()=>{this._timeoutTimer||(this._timeoutTimer=new Ul,this._timeoutTimer.cancelAndSet(()=>{this._timeoutTimer=null,this.beginCompute()},this._debounceInformation.get(e)))})),this.beginCompute())}async beginCompute(){this._computePromise=Ln(async e=>{let t=this._editor.getModel();if(!t)return[];let o=new Dn(!1),n=await rCt(this._languageFeaturesService.colorProvider,t,e,this._defaultColorDecoratorsEnablement);return this._debounceInformation.update(t,o.elapsed()),n});try{let e=await this._computePromise;this.updateDecorations(e),this.updateColorDecorators(e),this._computePromise=null}catch(e){mt(e)}}stop(){this._timeoutTimer&&(this._timeoutTimer.cancel(),this._timeoutTimer=null),this._computePromise&&(this._computePromise.cancel(),this._computePromise=null),this._localToDispose.clear()}updateDecorations(e){let t=e.map(o=>({range:{startLineNumber:o.colorInfo.range.startLineNumber,startColumn:o.colorInfo.range.startColumn,endLineNumber:o.colorInfo.range.endLineNumber,endColumn:o.colorInfo.range.endColumn},options:mo.EMPTY}));this._editor.changeDecorations(o=>{this._decorationsIds=o.deltaDecorations(this._decorationsIds,t),this._colorDatas=new Map,this._decorationsIds.forEach((n,r)=>this._colorDatas.set(n,e[r]))})}updateColorDecorators(e){this._colorDecorationClassRefs.clear();let t=[],o=this._editor.getOption(27);for(let r=0;r<e.length&&t.length<o;r++){let{red:s,green:l,blue:c,alpha:u}=e[r].colorInfo.color,p=new zt(Math.round(s*255),Math.round(l*255),Math.round(c*255),u),h=`rgba(${p.r}, ${p.g}, ${p.b}, ${p.a})`,g=this._colorDecorationClassRefs.add(this._ruleFactory.createClassNameRef({backgroundColor:h}));t.push({range:{startLineNumber:e[r].colorInfo.range.startLineNumber,startColumn:e[r].colorInfo.range.startColumn,endLineNumber:e[r].colorInfo.range.endLineNumber,endColumn:e[r].colorInfo.range.endColumn},options:{description:"colorDetector",before:{content:eO,inlineClassName:`${g.className} colorpicker-color-decoration`,inlineClassNameAffectsLetterSpacing:!0,attachedData:Gsi}}})}let n=o<e.length?o:!1;this._decoratorLimitReporter.update(e.length,n),this._colorDecoratorIds.set(t)}removeAllDecorations(){this._editor.removeDecorations(this._decorationsIds),this._decorationsIds=[],this._colorDecoratorIds.clear(),this._colorDecorationClassRefs.clear()}getColorData(e){let t=this._editor.getModel();if(!t)return null;let o=t.getDecorationsInRange(z.fromPositions(e,e)).filter(n=>this._colorDatas.has(n.id));return o.length===0?null:this._colorDatas.get(o[0].id)}isColorDecoration(e){return this._colorDecoratorIds.has(e)}};Iw=I([m(1,B),m(2,Qt),m(3,hf)],Iw);var Ksi=class extends x{constructor(){super(...arguments);this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._computed=0;this._limited=!1}get computed(){return this._computed}get limited(){return this._limited}update(e,t){(e!==this._computed||t!==this._limited)&&(this._computed=e,this._limited=t,this._onDidChange.fire())}};var aCt="editor.action.showHover",_9i="editor.action.showDefinitionPreviewHover",D9i="editor.action.hideHover",L9i="editor.action.scrollUpHover",R9i="editor.action.scrollDownHover",M9i="editor.action.scrollLeftHover",P9i="editor.action.scrollRightHover",A9i="editor.action.pageUpHover",N9i="editor.action.pageDownHover",O9i="editor.action.goToTopHover",F9i="editor.action.goToBottomHover",Nz="editor.action.increaseHoverVerbosityLevel",W9i="editor.action.increaseHoverVerbosityLevelFromAccessibleView",V9i=d(1266,null),Oz="editor.action.decreaseHoverVerbosityLevel",B9i="editor.action.decreaseHoverVerbosityLevelFromAccessibleView",H9i=d(1265,null),o3e="editor.action.hideLongLineWarningHover";var Fz="editor.action.inlineSuggest.commit",yce="editor.action.inlineSuggest.commitAlternativeAction",lCt="editor.action.inlineSuggest.showPrevious",cCt="editor.action.inlineSuggest.showNext",dCt="editor.action.inlineSuggest.jump",uCt="editor.action.inlineSuggest.hide",n3e="editor.action.inlineSuggest.toggleShowCollapsed",qsi="editor.action.inlineSuggest.renameSymbol";var fxe=class extends x{constructor(e,t,o){super();this.editor=e;this.model=t;this.instantiationService=o;this.alwaysShowToolbar=ui(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(71).showToolbar==="always"),this.sessionPosition=void 0,this.position=ke(this,n=>{let r=this.model.read(n)?.primaryGhostText.read(n);if(!this.alwaysShowToolbar.read(n)||!r||r.parts.length===0)return this.sessionPosition=void 0,null;let s=r.parts[0].column;this.sessionPosition&&this.sessionPosition.lineNumber!==r.lineNumber&&(this.sessionPosition=void 0);let l=new ye(r.lineNumber,Math.min(s,this.sessionPosition?.column??Number.MAX_SAFE_INTEGER));return this.sessionPosition=l,l}),this._register(il((n,r)=>{let s=this.model.read(n);if(!s||!this.alwaysShowToolbar.read(n))return;let l=ke(u=>{let p=u.store.add(this.instantiationService.createInstance(gR.hot.read(u),this.editor,!0,this.position,s.selectedInlineCompletionIndex,s.inlineCompletionsCount,s.activeCommands,s.warning,()=>{}));return e.addContentWidget(p),u.store.add(Z(()=>e.removeContentWidget(p))),u.store.add(be(h=>{this.position.read(h)&&s.lastTriggerKind.read(h)!==1&&s.triggerExplicitly()})),p}),c=Bf(this,(u,p)=>!!this.position.read(u)||!!p);r.add(be(u=>{c.read(u)&&l.read(u)}))}))}};fxe=I([m(2,F)],fxe);var K1o=Ae("inline-suggestion-hints-next",R.chevronRight,d(1369,null)),G1o=Ae("inline-suggestion-hints-previous",R.chevronLeft,d(1370,null)),gR=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.editor=e;this.withBorder=t;this._position=o;this._currentSuggestionIdx=n;this._suggestionCount=r;this._extraCommands=s;this._warning=l;this._relayout=c;this._commandService=u;this.keybindingService=h;this._contextKeyService=g;this._menuService=f;this.id=`InlineSuggestionHintsContentWidget${gR.id++}`,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._warningMessageContentNode=ke(v=>{let b=this._warning.read(v);return b?typeof b.message=="string"?b.message:v.store.add(Gf(b.message)).element:void 0}),this._warningMessageNode=Bo.div({class:"warningMessage",style:{maxWidth:400,margin:4,marginBottom:4,display:ke(v=>this._warning.read(v)?"block":"none")}},[this._warningMessageContentNode]).keepUpdated(this._store),this.nodes=ct("div.inlineSuggestionsHints",{className:this.withBorder?"monaco-hover monaco-hover-content":""},[this._warningMessageNode.element,ct("div@toolBar")]),this.previousAction=this._register(this.createCommandAction(lCt,d(1371,null),q.asClassName(G1o))),this.availableSuggestionCountAction=this._register(new it("inlineSuggestionHints.availableSuggestionCount","",void 0,!1)),this.nextAction=this._register(this.createCommandAction(cCt,d(1368,null),q.asClassName(K1o))),this.inlineCompletionsActionsMenus=this._register(this._menuService.createMenu(D.InlineCompletionsActions,this._contextKeyService)),this.clearAvailableSuggestionCountLabelDebounced=this._register(new Dt(()=>{this.availableSuggestionCountAction.label=""},100)),this.disableButtonsDebounced=this._register(new Dt(()=>{this.previousAction.enabled=this.nextAction.enabled=!1},100)),this._register(be(v=>{this._warningMessageContentNode.read(v),this._warningMessageNode.readEffect(v),this._relayout()})),this.toolBar=this._register(p.createInstance(r3e,this.nodes.toolBar,D.InlineSuggestionToolbar,{menuOptions:{renderShortTitle:!0},toolbarOptions:{primaryGroup:v=>v.startsWith("primary")},actionViewItemProvider:(v,b)=>{if(v instanceof Lo)return p.createInstance(jsi,v,void 0);if(v===this.availableSuggestionCountAction){let S=new $si(void 0,v,{label:!0,icon:!1});return S.setClass("availableSuggestionCount"),S}},telemetrySource:"InlineSuggestionToolbar"})),this.toolBar.setPrependedPrimaryActions([this.previousAction,this.availableSuggestionCountAction,this.nextAction]),this._register(this.toolBar.onDidChangeDropdownVisibility(v=>{gR._dropDownVisible=v})),this._register(be(v=>{this._position.read(v),this.editor.layoutContentWidget(this)})),this._register(be(v=>{let b=this._suggestionCount.read(v),S=this._currentSuggestionIdx.read(v);b!==void 0?(this.clearAvailableSuggestionCountLabelDebounced.cancel(),this.availableSuggestionCountAction.label=`${S+1}/${b}`):this.clearAvailableSuggestionCountLabelDebounced.schedule(),b!==void 0&&b>1?(this.disableButtonsDebounced.cancel(),this.previousAction.enabled=this.nextAction.enabled=!0):this.disableButtonsDebounced.schedule()})),this._register(be(v=>{let S=this._extraCommands.read(v).map(y=>({class:void 0,id:y.command.id,enabled:!0,tooltip:y.command.tooltip||"",label:y.command.title,run:w=>this._commandService.executeCommand(y.command.id)}));for(let[y,w]of this.inlineCompletionsActionsMenus.getActions())for(let k of w)k instanceof Lo&&S.push(k);S.length>0&&S.unshift(new ri),this.toolBar.setAdditionalSecondaryActions(S)}))}static{this.hot=vz(this)}static{this._dropDownVisible=!1}static get dropDownVisible(){return this._dropDownVisible}static{this.id=0}createCommandAction(e,t,o){let n=new it(e,t,o,!0,()=>this._commandService.executeCommand(e));return n.tooltip=this.keybindingService.appendKeybinding(t,e,this._contextKeyService),n}getId(){return this.id}getDomNode(){return this.nodes.root}getPosition(){return{position:this._position.get(),preference:[1,2],positionAffinity:3}}};gR=I([m(8,ge),m(9,F),m(10,_e),m(11,X),m(12,Kt)],gR);var $si=class extends hs{constructor(){super(...arguments);this._className=void 0}setClass(e){this._className=e}render(e){super.render(e),this._className&&e.classList.add(this._className)}updateTooltip(){}},jsi=class extends xl{updateLabel(){let i=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService,!0);if(!i)return super.updateLabel();if(this.label){let e=ct("div.keybinding").root;this._register(new Am(e,Po,{disableTitle:!0,...j4e})).set(i),this.label.textContent=this._action.label,this.label.appendChild(e),this.label.classList.add("inlineSuggestionStatusBarItemLabel")}}updateTooltip(){}},r3e=class extends ol{constructor(e,t,o,n,r,s,l,c,u){super(e,{resetMenu:t,...o},n,r,s,l,c,u);this.menuId=t;this.options2=o;this.menuService=n;this.contextKeyService=r;this.menu=this._store.add(this.menuService.createMenu(this.menuId,this.contextKeyService,{emitEventsForSubmenuChanges:!0})),this.additionalActions=[],this.prependedPrimaryActions=[],this.additionalPrimaryActions=[],this._store.add(this.menu.onDidChange(()=>this.updateToolbar())),this.updateToolbar()}updateToolbar(){let{primary:e,secondary:t}=ml(this.menu.getActions(this.options2?.menuOptions),this.options2?.toolbarOptions?.primaryGroup,this.options2?.toolbarOptions?.shouldInlineSubmenu,this.options2?.toolbarOptions?.useSeparatorsInPrimaryActions);t.push(...this.additionalActions),e.unshift(...this.prependedPrimaryActions),e.push(...this.additionalPrimaryActions),this.setActions(e,t)}setPrependedPrimaryActions(e){$i(this.prependedPrimaryActions,e,(t,o)=>t===o)||(this.prependedPrimaryActions=e,this.updateToolbar())}setAdditionalPrimaryActions(e){$i(this.additionalPrimaryActions,e,(t,o)=>t===o)||(this.additionalPrimaryActions=e,this.updateToolbar())}setAdditionalSecondaryActions(e){$i(this.additionalActions,e,(t,o)=>t===o)||(this.additionalActions=e,this.updateToolbar())}};r3e=I([m(3,Kt),m(4,X),m(5,Xe),m(6,_e),m(7,ge),m(8,Te)],r3e);var s3e={kind:0},q1o={kind:1};function $1o(a,i,e){return{kind:2,commandId:a,commandArgs:i,isBubble:e}}var vxe=class a{constructor(i,e,t){this._log=t,this._defaultKeybindings=i,this._defaultBoundCommands=new Map;for(let o of i){let n=o.command;n&&n.charAt(0)!=="-"&&this._defaultBoundCommands.set(n,!0)}this._map=new Map,this._lookupMap=new Map,this._keybindings=a.handleRemovals([].concat(i).concat(e));for(let o=0,n=this._keybindings.length;o<n;o++){let r=this._keybindings[o];if(r.chords.length===0)continue;let s=r.when?.substituteConstants();s&&s.type===0||this._addKeyPress(r.chords[0],r)}}static _isTargetedForRemoval(i,e,t){if(e){for(let o=0;o<e.length;o++)if(e[o]!==i.chords[o])return!1}return!(t&&t.type!==1&&(!i.when||!g$i(t,i.when)))}static handleRemovals(i){let e=new Map;for(let o=0,n=i.length;o<n;o++){let r=i[o];if(r.command&&r.command.charAt(0)==="-"){let s=r.command.substring(1);e.has(s)?e.get(s).push(r):e.set(s,[r])}}if(e.size===0)return i;let t=[];for(let o=0,n=i.length;o<n;o++){let r=i[o];if(!r.command||r.command.length===0){t.push(r);continue}if(r.command.charAt(0)==="-")continue;let s=e.get(r.command);if(!s||!r.isDefault){t.push(r);continue}let l=!1;for(let c of s){let u=c.when;if(this._isTargetedForRemoval(r,c.chords,u)){l=!0;break}}if(!l){t.push(r);continue}}return t}_addKeyPress(i,e){let t=this._map.get(i);if(typeof t>"u"){this._map.set(i,[e]),this._addToLookupMap(e);return}for(let o=t.length-1;o>=0;o--){let n=t[o];if(n.command===e.command)continue;let r=!0;for(let s=1;s<n.chords.length&&s<e.chords.length;s++)if(n.chords[s]!==e.chords[s]){r=!1;break}r&&a.whenIsEntirelyIncluded(n.when,e.when)&&this._removeFromLookupMap(n)}t.push(e),this._addToLookupMap(e)}_addToLookupMap(i){if(!i.command)return;let e=this._lookupMap.get(i.command);typeof e>"u"?(e=[i],this._lookupMap.set(i.command,e)):e.push(i)}_removeFromLookupMap(i){if(!i.command)return;let e=this._lookupMap.get(i.command);if(!(typeof e>"u")){for(let t=0,o=e.length;t<o;t++)if(e[t]===i){e.splice(t,1);return}}}static whenIsEntirelyIncluded(i,e){return!e||e.type===1?!0:!i||i.type===1?!1:Wgt(i,e)}getDefaultBoundCommands(){return this._defaultBoundCommands}getDefaultKeybindings(){return this._defaultKeybindings}getKeybindings(){return this._keybindings}lookupKeybindings(i){let e=this._lookupMap.get(i);if(typeof e>"u"||e.length===0)return[];let t=[],o=0;for(let n=e.length-1;n>=0;n--)t[o++]=e[n];return t}lookupPrimaryKeybinding(i,e,t=!1){let o=this._lookupMap.get(i);if(typeof o>"u"||o.length===0)return null;if(o.length===1&&!t)return o[0];for(let n=o.length-1;n>=0;n--){let r=o[n];if(e.contextMatchesRules(r.when))return r}return t?null:o[o.length-1]}resolve(i,e,t){let o=[...e,t];this._log(`| Resolving ${o}`);let n=this._map.get(o[0]);if(n===void 0)return this._log("\\ No keybinding entries."),s3e;let r=null;if(o.length<2)r=n;else{r=[];for(let l=0,c=n.length;l<c;l++){let u=n[l];if(o.length>u.chords.length)continue;let p=!0;for(let h=1;h<o.length;h++)if(u.chords[h]!==o[h]){p=!1;break}p&&r.push(u)}}let s=this._findCommand(i,r);return s?o.length<s.chords.length?(this._log(`\\ From ${r.length} keybinding entries, awaiting ${s.chords.length-o.length} more chord(s), when: ${U9i(s.when)}, source: ${z9i(s)}.`),q1o):(this._log(`\\ From ${r.length} keybinding entries, matched ${s.command}, when: ${U9i(s.when)}, source: ${z9i(s)}.`),$1o(s.command,s.commandArgs,s.bubble)):(this._log(`\\ From ${r.length} keybinding entries, no when clauses matched the context.`),s3e)}_findCommand(i,e){for(let t=e.length-1;t>=0;t--){let o=e[t];if(a._contextMatchesRules(i,o.when))return o}return null}static _contextMatchesRules(i,e){return e?e.evaluate(i):!0}};function U9i(a){return a?`${a.serialize()}`:"no when condition"}function z9i(a){return a.extensionId?a.isBuiltinExtension?`built-in extension ${a.extensionId}`:`user extension ${a.extensionId}`:a.isDefault?"built-in":"user"}function NY(a,i,e){let t=ir(a);return!(i<t.left+3||i>t.left+t.width-3||e<t.top+3||e>t.top+t.height-3)}function mCt(a,i,e){return a==="on"?!0:a==="off"?!1:a3e(i,e.event)}function a3e(a,i){return a==="altKey"?i.ctrlKey||i.metaKey:i.altKey}var Qsi=class{constructor(i,e,t,o){this.value=i;this.isComplete=e;this.hasLoadingMessage=t;this.options=o}},bxe=class extends x{constructor(e,t){super();this._editor=e;this._computer=t;this._onResult=this._register(new E);this.onResult=this._onResult.event;this._asyncComputationScheduler=this._register(new l3e(e=>this._triggerAsyncComputation(e),0));this._syncComputationScheduler=this._register(new l3e(e=>this._triggerSyncComputation(e),0));this._loadingMessageScheduler=this._register(new l3e(e=>this._triggerLoadingMessage(e),0));this._state=0;this._asyncIterable=null;this._asyncIterableDone=!1;this._result=[]}dispose(){this._asyncIterable&&(this._asyncIterable.cancel(),this._asyncIterable=null),this._options=void 0,super.dispose()}get _hoverTime(){return this._editor.getOption(69).delay}get _firstWaitTime(){return this._hoverTime/2}get _secondWaitTime(){return this._hoverTime-this._firstWaitTime}get _loadingMessageTime(){return 3*this._hoverTime}_setState(e,t){this._options=t,this._state=e,this._fireResult(t)}_triggerAsyncComputation(e){this._setState(2,e),this._syncComputationScheduler.schedule(e,this._secondWaitTime),this._computer.computeAsync?(this._asyncIterableDone=!1,this._asyncIterable=YGi(t=>this._computer.computeAsync(e,t)),(async()=>{try{for await(let t of this._asyncIterable)t&&(this._result.push(t),this._fireResult(e));this._asyncIterableDone=!0,(this._state===3||this._state===4)&&this._setState(0,e)}catch(t){mt(t)}})()):this._asyncIterableDone=!0}_triggerSyncComputation(e){this._computer.computeSync&&(this._result=this._result.concat(this._computer.computeSync(e))),this._setState(this._asyncIterableDone?0:3,e)}_triggerLoadingMessage(e){this._state===3&&this._setState(4,e)}_fireResult(e){if(this._state===1||this._state===2)return;let t=this._state===0,o=this._state===4;this._onResult.fire(new Qsi(this._result.slice(0),t,o,e))}start(e,t){if(e===0)this._state===0&&(this._setState(1,t),this._asyncComputationScheduler.schedule(t,this._firstWaitTime),this._loadingMessageScheduler.schedule(t,this._loadingMessageTime));else switch(this._state){case 0:this._triggerAsyncComputation(t),this._syncComputationScheduler.cancel(),this._triggerSyncComputation(t);break;case 2:this._syncComputationScheduler.cancel(),this._triggerSyncComputation(t);break}}cancel(){this._asyncComputationScheduler.cancel(),this._syncComputationScheduler.cancel(),this._loadingMessageScheduler.cancel(),this._asyncIterable&&(this._asyncIterable.cancel(),this._asyncIterable=null),this._result=[],this._options=void 0,this._state=0}get options(){return this._options}},l3e=class extends x{constructor(i,e){super(),this._scheduler=this._register(new Dt(()=>i(this._options),e))}schedule(i,e){this._options=i,this._scheduler.schedule(e)}cancel(){this._scheduler.cancel()}};var fR=class{constructor(){this._onDidWillResize=new E;this._onDidResize=new E;this._sashListener=new N;this._size=new si(0,0);this._minSize=new si(0,0);this._maxSize=new si(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER);this.domNode=document.createElement("div"),this._eastSash=new Jh(this.domNode,{getVerticalSashLeft:()=>this._size.width},{orientation:0}),this._westSash=new Jh(this.domNode,{getVerticalSashLeft:()=>0},{orientation:0}),this._northSash=new Jh(this.domNode,{getHorizontalSashTop:()=>0},{orientation:1,orthogonalEdge:"north"}),this._southSash=new Jh(this.domNode,{getHorizontalSashTop:()=>this._size.height},{orientation:1,orthogonalEdge:"south"}),this._northSash.orthogonalStartSash=this._westSash,this._northSash.orthogonalEndSash=this._eastSash,this._southSash.orthogonalStartSash=this._westSash,this._southSash.orthogonalEndSash=this._eastSash;let i,e=0,t=0;this._sashListener.add(U.any(this._northSash.onDidStart,this._eastSash.onDidStart,this._southSash.onDidStart,this._westSash.onDidStart)(()=>{i===void 0&&(this._onDidWillResize.fire(),i=this._size,e=0,t=0)})),this._sashListener.add(U.any(this._northSash.onDidEnd,this._eastSash.onDidEnd,this._southSash.onDidEnd,this._westSash.onDidEnd)(()=>{i!==void 0&&(i=void 0,e=0,t=0,this._onDidResize.fire({dimension:this._size,done:!0}))})),this._sashListener.add(this._eastSash.onDidChange(o=>{i&&(t=o.currentX-o.startX,this.layout(i.height+e,i.width+t),this._onDidResize.fire({dimension:this._size,done:!1,east:!0}))})),this._sashListener.add(this._westSash.onDidChange(o=>{i&&(t=-(o.currentX-o.startX),this.layout(i.height+e,i.width+t),this._onDidResize.fire({dimension:this._size,done:!1,west:!0}))})),this._sashListener.add(this._northSash.onDidChange(o=>{i&&(e=-(o.currentY-o.startY),this.layout(i.height+e,i.width+t),this._onDidResize.fire({dimension:this._size,done:!1,north:!0}))})),this._sashListener.add(this._southSash.onDidChange(o=>{i&&(e=o.currentY-o.startY,this.layout(i.height+e,i.width+t),this._onDidResize.fire({dimension:this._size,done:!1,south:!0}))})),this._sashListener.add(U.any(this._eastSash.onDidReset,this._westSash.onDidReset)(o=>{this._preferredSize&&(this.layout(this._size.height,this._preferredSize.width),this._onDidResize.fire({dimension:this._size,done:!0}))})),this._sashListener.add(U.any(this._northSash.onDidReset,this._southSash.onDidReset)(o=>{this._preferredSize&&(this.layout(this._preferredSize.height,this._size.width),this._onDidResize.fire({dimension:this._size,done:!0}))}))}get onDidWillResize(){return this._onDidWillResize.event}get onDidResize(){return this._onDidResize.event}dispose(){this._northSash.dispose(),this._southSash.dispose(),this._eastSash.dispose(),this._westSash.dispose(),this._sashListener.dispose(),this._onDidResize.dispose(),this._onDidWillResize.dispose(),this.domNode.remove()}enableSashes(i,e,t,o){this._northSash.state=i?3:0,this._eastSash.state=e?3:0,this._southSash.state=t?3:0,this._westSash.state=o?3:0}layout(i=this.size.height,e=this.size.width){let{height:t,width:o}=this._minSize,{height:n,width:r}=this._maxSize;i=Math.max(t,Math.min(n,i)),e=Math.max(o,Math.min(r,e));let s=new si(e,i);si.equals(s,this._size)||(this.domNode.style.height=i+"px",this.domNode.style.width=e+"px",this._size=s,this._northSash.layout(),this._eastSash.layout(),this._southSash.layout(),this._westSash.layout())}clearSashHoverState(){this._eastSash.clearSashHoverState(),this._westSash.clearSashHoverState(),this._northSash.clearSashHoverState(),this._southSash.clearSashHoverState()}get size(){return this._size}set maxSize(i){this._maxSize=i}get maxSize(){return this._maxSize}set minSize(i){this._minSize=i}get minSize(){return this._minSize}set preferredSize(i){this._preferredSize=i}get preferredSize(){return this._preferredSize}};var j1o=30,Q1o=24,hCt=class extends x{constructor(e,t=new si(10,10)){super();this._editor=e;this.allowEditorOverflow=!0;this.suppressMouseDown=!1;this._resizableNode=this._register(new fR);this._contentPosition=null;this._isResizing=!1;this._resizableNode.domNode.style.position="absolute",this._resizableNode.minSize=si.lift(t),this._resizableNode.layout(t.height,t.width),this._resizableNode.enableSashes(!0,!0,!0,!0),this._register(this._resizableNode.onDidResize(o=>{this._resize(new si(o.dimension.width,o.dimension.height)),o.done&&(this._isResizing=!1)})),this._register(this._resizableNode.onDidWillResize(()=>{this._isResizing=!0}))}get isResizing(){return this._isResizing}getDomNode(){return this._resizableNode.domNode}getPosition(){return this._contentPosition}get position(){return this._contentPosition?.position?ye.lift(this._contentPosition.position):void 0}_availableVerticalSpaceAbove(e){let t=this._editor.getDomNode(),o=this._editor.getScrolledVisiblePosition(e);return!t||!o?void 0:ir(t).top+o.top-j1o}_availableVerticalSpaceBelow(e){let t=this._editor.getDomNode(),o=this._editor.getScrolledVisiblePosition(e);if(!t||!o)return;let n=ir(t),r=$m(t.ownerDocument.body),s=n.top+o.top+o.height;return r.height-s-Q1o}_findPositionPreference(e,t){let o=Math.min(this._availableVerticalSpaceBelow(t)??1/0,e),n=Math.min(this._availableVerticalSpaceAbove(t)??1/0,e),r=Math.min(Math.max(n,o),e),s=Math.min(e,r),l;return this._editor.getOption(69).above?l=s<=n?1:2:l=s<=o?2:1,l===1?this._resizableNode.enableSashes(!0,!0,!1,!1):this._resizableNode.enableSashes(!1,!0,!0,!1),l}_resize(e){this._resizableNode.layout(e.height,e.width)}};var K9i=30,nk=class extends hCt{constructor(e,t,o,n,r){let s=e.getOption(75)+8,l=150,c=new si(l,s);super(e,c);this._configurationService=o;this._accessibilityService=n;this._keybindingService=r;this._hover=this._register(new bY(!0));this._onDidResize=this._register(new E);this.onDidResize=this._onDidResize.event;this._onDidScroll=this._register(new E);this.onDidScroll=this._onDidScroll.event;this._onContentsChanged=this._register(new E);this.onContentsChanged=this._onContentsChanged.event;this._minimumSize=c,this._hoverVisibleKey=pe.hoverVisible.bindTo(t),this._hoverFocusedKey=pe.hoverFocused.bindTo(t),M(this._resizableNode.domNode,this._hover.containerDomNode),this._resizableNode.domNode.style.zIndex="50",this._resizableNode.domNode.className="monaco-resizable-hover",this._register(this._editor.onDidLayoutChange(()=>{this.isVisible&&this._updateMaxDimensions()})),this._register(this._editor.onDidChangeConfiguration(p=>{p.hasChanged(59)&&this._updateFont()}));let u=this._register(qn(this._resizableNode.domNode));this._register(u.onDidFocus(()=>{this._hoverFocusedKey.set(!0)})),this._register(u.onDidBlur(()=>{this._hoverFocusedKey.set(!1)})),this._register(this._hover.scrollbar.onScroll(p=>{this._onDidScroll.fire(p)})),this._setRenderedHover(void 0),this._editor.addContentWidget(this)}static{this.ID="editor.contrib.resizableContentHoverWidget"}static{this._lastDimensions=new si(0,0)}get isVisibleFromKeyboard(){return this._renderedHover?.source===2}get isVisible(){return this._hoverVisibleKey.get()??!1}get isFocused(){return this._hoverFocusedKey.get()??!1}dispose(){super.dispose(),this._renderedHover?.dispose(),this._editor.removeContentWidget(this)}getId(){return nk.ID}static _applyDimensions(e,t,o){let n=typeof t=="number"?`${t}px`:t,r=typeof o=="number"?`${o}px`:o;e.style.width=n,e.style.height=r}_setContentsDomNodeDimensions(e,t){let o=this._hover.contentsDomNode;return nk._applyDimensions(o,e,t)}_setContainerDomNodeDimensions(e,t){let o=this._hover.containerDomNode;return nk._applyDimensions(o,e,t)}_setScrollableElementDimensions(e,t){let o=this._hover.scrollbar.getDomNode();return nk._applyDimensions(o,e,t)}_setHoverWidgetDimensions(e,t){this._setContainerDomNodeDimensions(e,t),this._setScrollableElementDimensions(e,t),this._setContentsDomNodeDimensions(e,t),this._layoutContentWidget()}static _applyMaxDimensions(e,t,o){let n=typeof t=="number"?`${t}px`:t,r=typeof o=="number"?`${o}px`:o;e.style.maxWidth=n,e.style.maxHeight=r}_setHoverWidgetMaxDimensions(e,t){nk._applyMaxDimensions(this._hover.contentsDomNode,e,t),nk._applyMaxDimensions(this._hover.scrollbar.getDomNode(),e,t),nk._applyMaxDimensions(this._hover.containerDomNode,e,t),this._hover.containerDomNode.style.setProperty("--vscode-hover-maxWidth",typeof e=="number"?`${e}px`:e),this._layoutContentWidget()}_setAdjustedHoverWidgetDimensions(e){this._setHoverWidgetMaxDimensions("none","none"),this._setHoverWidgetDimensions(e.width,e.height)}_updateResizableNodeMaxDimensions(){let e=this._findMaximumRenderingWidth()??1/0,t=this._findMaximumRenderingHeight()??1/0;this._resizableNode.maxSize=new si(e,t),this._setHoverWidgetMaxDimensions(e,t)}_resize(e){nk._lastDimensions=new si(e.width,e.height),this._setAdjustedHoverWidgetDimensions(e),this._resizableNode.layout(e.height,e.width),this._updateResizableNodeMaxDimensions(),this._hover.scrollbar.scanDomNode(),this._editor.layoutContentWidget(this),this._onDidResize.fire()}_findAvailableSpaceVertically(){let e=this._renderedHover?.showAtPosition;if(e)return this._positionPreference===1?this._availableVerticalSpaceAbove(e):this._availableVerticalSpaceBelow(e)}_findMaximumRenderingHeight(){let e=this._findAvailableSpaceVertically();if(!e)return;let o=this._hover.contentsDomNode.children.length-1;return Array.from(this._hover.contentsDomNode.children).forEach(n=>{o+=n.clientHeight}),Math.min(e,o)}_isHoverTextOverflowing(){this._hover.containerDomNode.style.setProperty("--vscode-hover-whiteSpace","nowrap"),this._hover.containerDomNode.style.setProperty("--vscode-hover-sourceWhiteSpace","nowrap");let e=Array.from(this._hover.contentsDomNode.children).some(t=>t.scrollWidth>t.clientWidth);return this._hover.containerDomNode.style.removeProperty("--vscode-hover-whiteSpace"),this._hover.containerDomNode.style.removeProperty("--vscode-hover-sourceWhiteSpace"),e}_findMaximumRenderingWidth(){if(!this._editor||!this._editor.hasModel())return;let e=this._isHoverTextOverflowing(),t=typeof this._contentWidth>"u"?0:this._contentWidth;return e||this._hover.containerDomNode.clientWidth<t?$m(this._hover.containerDomNode.ownerDocument.body).width-14:this._hover.containerDomNode.clientWidth}isMouseGettingCloser(e,t){if(!this._renderedHover)return!1;if(this._renderedHover.initialMousePosX===void 0||this._renderedHover.initialMousePosY===void 0)return this._renderedHover.initialMousePosX=e,this._renderedHover.initialMousePosY=t,!1;let o=ir(this.getDomNode());this._renderedHover.closestMouseDistance===void 0&&(this._renderedHover.closestMouseDistance=G9i(this._renderedHover.initialMousePosX,this._renderedHover.initialMousePosY,o.left,o.top,o.width,o.height));let n=G9i(e,t,o.left,o.top,o.width,o.height);return n>this._renderedHover.closestMouseDistance+4?!1:(this._renderedHover.closestMouseDistance=Math.min(this._renderedHover.closestMouseDistance,n),!0)}_setRenderedHover(e){this._renderedHover?.dispose(),this._renderedHover=e,this._hoverVisibleKey.set(!!e),this._hover.containerDomNode.classList.toggle("hidden",!e)}_updateFont(){let{fontSize:e,lineHeight:t}=this._editor.getOption(59),o=this._hover.contentsDomNode;o.style.fontSize=`${e}px`,o.style.lineHeight=`${t/e}`,Array.prototype.slice.call(this._hover.contentsDomNode.getElementsByClassName("code")).forEach(r=>this._editor.applyFontInfo(r))}_updateContent(e){let t=this._hover.contentsDomNode;t.style.paddingBottom="",t.textContent="",t.appendChild(e)}_layoutContentWidget(){this._editor.layoutContentWidget(this),this._hover.onContentsChanged()}_updateMaxDimensions(){let e=Math.max(this._editor.getLayoutInfo().height/4,250,nk._lastDimensions.height),t=Math.max(this._editor.getLayoutInfo().width*.66,750,nk._lastDimensions.width);this._resizableNode.maxSize=new si(t,e),this._setHoverWidgetMaxDimensions(t,e)}_render(e){this._setRenderedHover(e),this._updateFont(),this._updateContent(e.domNode),this.handleContentsChanged(),this._editor.render()}getPosition(){return this._renderedHover?{position:this._renderedHover.showAtPosition,secondaryPosition:this._renderedHover.showAtSecondaryPosition,positionAffinity:this._renderedHover.shouldAppearBeforeContent?3:void 0,preference:[this._positionPreference??1]}:null}show(e){if(!this._editor||!this._editor.hasModel())return;this._render(e);let t=mh(this._hover.containerDomNode),o=e.showAtPosition;this._positionPreference=this._findPositionPreference(t,o)??1,this.handleContentsChanged(),e.shouldFocus&&this._hover.containerDomNode.focus(),this._onDidResize.fire();let r=this._hover.containerDomNode.ownerDocument.activeElement===this._hover.containerDomNode&&nwt(this._configurationService.getValue("accessibility.verbosity.hover")===!0&&this._accessibilityService.isScreenReaderOptimized(),this._keybindingService.lookupKeybinding("editor.action.accessibleView")?.getAriaLabel()??"");r&&(this._hover.contentsDomNode.ariaLabel=this._hover.contentsDomNode.textContent+", "+r)}hide(){if(!this._renderedHover)return;let e=this._renderedHover.shouldFocus||this._hoverFocusedKey.get();this._setRenderedHover(void 0),this._resizableNode.maxSize=new si(1/0,1/0),this._resizableNode.clearSashHoverState(),this._hoverFocusedKey.set(!1),this._editor.layoutContentWidget(this),e&&this._editor.focus()}_removeConstraintsRenderNormally(){let e=this._editor.getLayoutInfo();this._resizableNode.layout(e.height,e.width),this._setHoverWidgetDimensions("auto","auto"),this._updateMaxDimensions()}setMinimumDimensions(e){this._minimumSize=new si(Math.max(this._minimumSize.width,e.width),Math.max(this._minimumSize.height,e.height)),this._updateMinimumWidth()}_updateMinimumWidth(){let e=typeof this._contentWidth>"u"?this._minimumSize.width:Math.min(this._contentWidth,this._minimumSize.width);this._resizableNode.minSize=new si(e,this._minimumSize.height)}handleContentsChanged(){this._removeConstraintsRenderNormally();let e=this._hover.contentsDomNode,t=mh(e),o=zl(e)+2;if(this._resizableNode.layout(t,o),this._setHoverWidgetDimensions(o,t),t=mh(e),o=zl(e),this._contentWidth=o,this._updateMinimumWidth(),this._resizableNode.layout(t,o),this._renderedHover?.showAtPosition){let n=mh(this._hover.containerDomNode);this._positionPreference=this._findPositionPreference(n,this._renderedHover.showAtPosition)}this._layoutContentWidget(),this._onContentsChanged.fire()}focus(){this._hover.containerDomNode.focus()}scrollUp(){let e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._editor.getOption(59);this._hover.scrollbar.setScrollPosition({scrollTop:e-t.lineHeight})}scrollDown(){let e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._editor.getOption(59);this._hover.scrollbar.setScrollPosition({scrollTop:e+t.lineHeight})}scrollLeft(){let e=this._hover.scrollbar.getScrollPosition().scrollLeft;this._hover.scrollbar.setScrollPosition({scrollLeft:e-K9i})}scrollRight(){let e=this._hover.scrollbar.getScrollPosition().scrollLeft;this._hover.scrollbar.setScrollPosition({scrollLeft:e+K9i})}pageUp(){let e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._hover.scrollbar.getScrollDimensions().height;this._hover.scrollbar.setScrollPosition({scrollTop:e-t})}pageDown(){let e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._hover.scrollbar.getScrollDimensions().height;this._hover.scrollbar.setScrollPosition({scrollTop:e+t})}goToTop(){this._hover.scrollbar.setScrollPosition({scrollTop:0})}goToBottom(){this._hover.scrollbar.setScrollPosition({scrollTop:this._hover.scrollbar.getScrollDimensions().scrollHeight})}};nk=I([m(1,X),m(2,B),m(3,Oi),m(4,_e)],nk);function G9i(a,i,e,t,o,n){let r=e+o/2,s=t+n/2,l=Math.max(Math.abs(a-r)-o/2,0),c=Math.max(Math.abs(i-s)-n/2,0);return Math.sqrt(l*l+c*c)}var gCt=class a{constructor(i,e){this._editor=i;this._participants=e}static _getLineDecorations(i,e){if(e.type!==1&&!e.supportsMarkerHover)return[];let t=i.getModel(),o=e.range.startLineNumber;if(o>t.getLineCount())return[];let n=t.getLineMaxColumn(o);return i.getLineDecorations(o).filter(r=>{if(r.options.isWholeLine)return!0;let s=r.range.startLineNumber===o?r.range.startColumn:1,l=r.range.endLineNumber===o?r.range.endColumn:n;if(r.options.showIfCollapsed){if(s>e.range.startColumn+1||e.range.endColumn-1>l)return!1}else if(s>e.range.startColumn||e.range.endColumn>l)return!1;return!0})}computeAsync(i,e){let t=i.anchor;if(!this._editor.hasModel()||!t)return fp.EMPTY;let o=a._getLineDecorations(this._editor,t);return fp.merge(this._participants.map(n=>n.computeAsync?n.computeAsync(t,o,i.source,e):fp.EMPTY))}computeSync(i){if(!this._editor.hasModel())return[];let e=i.anchor,t=a._getLineDecorations(this._editor,e),o=[];for(let n of this._participants)o=o.concat(n.computeSync(e,t,i.source));return di(o)}};var d3e=class{constructor(i,e,t){this.hoverParts=i;this.isComplete=e;this.options=t}filter(i){let e=this.hoverParts.filter(t=>t.isValidForHoverAnchor(i));return e.length===this.hoverParts.length?this:new Ysi(this,e,this.isComplete,this.options)}},Ysi=class extends d3e{constructor(e,t,o,n){super(t,o,n);this.original=e}filter(e){return this.original.filter(e)}};var q9i=_,OY=class extends x{constructor(e,t){super();this._keybindingService=e;this._hoverService=t;this.actions=[];this._hasContent=!1;this.hoverElement=q9i("div.hover-row.status-bar"),this.hoverElement.tabIndex=0,this.actionsElement=M(this.hoverElement,q9i("div.actions"))}get hasContent(){return this._hasContent}addAction(e){let t=this._keybindingService.lookupKeybinding(e.commandId),o=t?t.getLabel():null;this._hasContent=!0;let n=this._register(SY.render(this.actionsElement,e,o));return this._register(this._hoverService.setupManagedHover(Ri("element"),n.actionContainer,n.actionRenderedLabel)),this.actions.push(n),n}append(e){let t=M(this.actionsElement,e);return this._hasContent=!0,t}};OY=I([m(0,_e),m(1,nt)],OY);function Ixe(a){let i=a;return typeof i=="object"&&"markdown"in i&&"markdownNotSupportedFallback"in i}function $9i(a){let i=a;return typeof i=="object"&&"element"in i}var WY={inputActiveOptionBorder:"#007ACC00",inputActiveOptionForeground:"#FFFFFF",inputActiveOptionBackground:"#0E639C50"},wce=class extends wl{constructor(i,e,t){super(i,e,t);let o=this.options.keybinding?`${this._action.label} (${this.options.keybinding})`:this._action.label;this.toggle=this._register(new cm({actionClassName:this._action.class,isChecked:!!this._action.checked,title:o,notFocusable:!0,inputActiveOptionBackground:t.toggleStyles?.inputActiveOptionBackground,inputActiveOptionBorder:t.toggleStyles?.inputActiveOptionBorder,inputActiveOptionForeground:t.toggleStyles?.inputActiveOptionForeground})),this._register(this.toggle.onChange(()=>{this._action.checked=!!this.toggle&&this.toggle.checked}))}render(i){this.element=i,this.element.appendChild(this.toggle.domNode),this.updateChecked(),this.updateEnabled()}updateEnabled(){this.toggle&&(this.isEnabled()?(this.toggle.enable(),this.element?.classList.remove("disabled")):(this.toggle.disable(),this.element?.classList.add("disabled")))}updateChecked(){this.toggle.checked=!!this._action.checked}updateLabel(){let i=this.options.keybinding?`${this._action.label} (${this.options.keybinding})`:this._action.label;this.toggle.setTitle(i)}focus(){this.toggle.domNode.tabIndex=0,this.toggle.focus()}blur(){this.toggle.domNode.tabIndex=-1,this.toggle.domNode.blur()}setFocusable(i){this.toggle.domNode.tabIndex=i?0:-1}},cm=class extends ja{constructor(e){super();this._onChange=this._register(new E);this._onKeyDown=this._register(new E);this._opts=e,this._title=this._opts.title,this._checked=this._opts.isChecked;let t=["monaco-custom-toggle"];this._opts.icon&&(this._icon=this._opts.icon,t.push(...q.asClassNameArray(this._icon))),this._opts.actionClassName&&t.push(...this._opts.actionClassName.split(" ")),this._checked&&t.push("checked"),this.domNode=document.createElement("div"),this._register(Up().setupDelayedHover(this.domNode,()=>({content:!Ar(this._title)&&!Do(this._title)?Nu(this._title):this._title,style:1}),this._opts.hoverLifecycleOptions)),this.domNode.classList.add(...t),this._opts.notFocusable||(this.domNode.tabIndex=0),this.domNode.setAttribute("role","checkbox"),this.domNode.setAttribute("aria-checked",String(this._checked)),this.setTitle(this._opts.title),this.applyStyles(),this.onclick(this.domNode,o=>{this.enabled&&(this.checked=!this._checked,this._onChange.fire(!1),o.preventDefault(),o.stopPropagation())}),this._register(this.ignoreGesture(this.domNode)),this.onkeydown(this.domNode,o=>{if(this.enabled){if(o.keyCode===10||o.keyCode===3){this.checked=!this._checked,this._onChange.fire(!0),o.preventDefault(),o.stopPropagation();return}this._onKeyDown.fire(o)}})}get onChange(){return this._onChange.event}get onKeyDown(){return this._onKeyDown.event}get enabled(){return this.domNode.getAttribute("aria-disabled")!=="true"}focus(){this.domNode.focus()}get checked(){return this._checked}set checked(e){this._checked=e,this.domNode.setAttribute("aria-checked",String(this._checked)),this.domNode.classList.toggle("checked",this._checked),this.applyStyles()}setIcon(e){this._icon&&this.domNode.classList.remove(...q.asClassNameArray(this._icon)),this._icon=e,this._icon&&this.domNode.classList.add(...q.asClassNameArray(this._icon))}width(){return 22}applyStyles(){this.domNode&&(this.domNode.style.borderColor=this._checked&&this._opts.inputActiveOptionBorder||"",this.domNode.style.color=this._checked&&this._opts.inputActiveOptionForeground||"inherit",this.domNode.style.backgroundColor=this._checked&&this._opts.inputActiveOptionBackground||"")}enable(){this.domNode.setAttribute("aria-disabled",String(!1)),this.domNode.classList.remove("disabled")}disable(){this.domNode.setAttribute("aria-disabled",String(!0)),this.domNode.classList.add("disabled")}setTitle(e){this._title=e;let t=typeof e=="string"?e:Ar(e)?e.value:e.textContent;this.domNode.setAttribute("aria-label",xz(t))}set visible(e){this.domNode.style.display=e?"":"none"}get visible(){return this.domNode.style.display!=="none"}},u3e=class extends ja{constructor(e,t,o){super();this.checkbox=e;this.domNode=t;this.styles=o;this._onChange=this._register(new E);this.onChange=this._onChange.event;this.applyStyles()}static{this.CLASS_NAME="monaco-checkbox"}get enabled(){return this.checkbox.enabled}focus(){this.domNode.focus()}hasFocus(){return wa(this.domNode)}enable(){this.checkbox.enable(),this.applyStyles(!0)}disable(){this.checkbox.disable(),this.applyStyles(!1)}setTitle(e){this.checkbox.setTitle(e)}applyStyles(e=this.enabled){this.domNode.style.color=(e?this.styles.checkboxForeground:this.styles.checkboxDisabledForeground)||"",this.domNode.style.backgroundColor=(e?this.styles.checkboxBackground:this.styles.checkboxDisabledBackground)||"",this.domNode.style.borderColor=(e?this.styles.checkboxBorder:this.styles.checkboxDisabledBackground)||"";let t=this.styles.size||18;this.domNode.style.width=this.domNode.style.height=this.domNode.style.fontSize=`${t}px`,this.domNode.style.fontSize=`${t-2}px`}},Ev=class extends u3e{constructor(i,e,t){let o=new cm({title:i,isChecked:e,icon:R.check,actionClassName:u3e.CLASS_NAME,hoverLifecycleOptions:t.hoverLifecycleOptions,...WY});super(o,o.domNode,t),this._register(o),this._register(this.checkbox.onChange(n=>{this.applyStyles(),this._onChange.fire(n)}))}get checked(){return this.checkbox.checked}set checked(i){this.checkbox.checked=i,this.applyStyles()}applyStyles(i){this.checkbox.checked?this.checkbox.setIcon(R.check):this.checkbox.setIcon(void 0),super.applyStyles(i)}},FY=class extends u3e{constructor(e,t,o){let n;switch(t){case!0:n=R.check;break;case"mixed":n=R.dash;break;case!1:n=void 0;break}let r=new cm({title:e,isChecked:t===!0,icon:n,actionClassName:Ev.CLASS_NAME,hoverLifecycleOptions:o.hoverLifecycleOptions,...WY});super(r,r.domNode,o);this._state=t;this._register(r),this._register(this.checkbox.onChange(s=>{this._state=this.checkbox.checked,this.applyStyles(),this._onChange.fire(s)}))}get checked(){return this._state}set checked(e){this._state!==e&&(this._state=e,this.checkbox.checked=e===!0,this.applyStyles())}applyStyles(e){switch(this._state){case!0:this.checkbox.setIcon(R.check);break;case"mixed":this.checkbox.setIcon(R.dash);break;case!1:this.checkbox.setIcon(void 0);break}super.applyStyles(e)}},fCt=class extends wl{constructor(i,e,t){super(i,e,t),this.toggle=this._register(new Ev(this._action.label,!!this._action.checked,t.checkboxStyles)),this._register(this.toggle.onChange(()=>this.onChange()))}render(i){if(this.element=i,this.element.classList.add("checkbox-action-item"),this.element.appendChild(this.toggle.domNode),this.options.label&&this._action.label){let e=this.element.appendChild(_("span.checkbox-label",void 0,this._action.label));this._register(j(e,re.CLICK,t=>{this.toggle.checked=!this.toggle.checked,t.stopPropagation(),t.preventDefault(),this.onChange()}))}this.updateEnabled(),this.updateClass(),this.updateChecked()}onChange(){this._action.checked=!!this.toggle&&this.toggle.checked,this.actionRunner.run(this._action,this._context)}updateEnabled(){this.isEnabled()?this.toggle.enable():this.toggle.disable(),this.action.enabled?this.element?.classList.remove("disabled"):this.element?.classList.add("disabled")}updateChecked(){this.toggle.checked=!!this._action.checked}updateClass(){this.cssClass&&this.toggle.domNode.classList.remove(...this.cssClass.split(" ")),this.cssClass=this.getClass(),this.cssClass&&this.toggle.domNode.classList.add(...this.cssClass.split(" "))}focus(){this.toggle.domNode.tabIndex=0,this.toggle.focus()}blur(){this.toggle.domNode.tabIndex=-1,this.toggle.domNode.blur()}setFocusable(i){this.toggle.domNode.tabIndex=i?0:-1}};function Wz(a){return(i,e)=>{if(i.checked!==void 0)return new wce(null,i,{...e,toggleStyles:a})}}var a5=class a{constructor(i){this._editor=i,this._decorations=[],this._overviewRulerApproximateDecorations=[],this._findScopeDecorationIds=[],this._rangeHighlightDecorationId=null,this._highlightedDecorationId=null,this._startPosition=this._editor.getPosition()}dispose(){this._editor.removeDecorations(this._allDecorations()),this._decorations=[],this._overviewRulerApproximateDecorations=[],this._findScopeDecorationIds=[],this._rangeHighlightDecorationId=null,this._highlightedDecorationId=null}reset(){this._decorations=[],this._overviewRulerApproximateDecorations=[],this._findScopeDecorationIds=[],this._rangeHighlightDecorationId=null,this._highlightedDecorationId=null}getCount(){return this._decorations.length}getFindScope(){return this._findScopeDecorationIds[0]?this._editor.getModel().getDecorationRange(this._findScopeDecorationIds[0]):null}getFindScopes(){if(this._findScopeDecorationIds.length){let i=this._findScopeDecorationIds.map(e=>this._editor.getModel().getDecorationRange(e)).filter(e=>!!e);if(i.length)return i}return null}getStartPosition(){return this._startPosition}setStartPosition(i){this._startPosition=i,this.setCurrentFindMatch(null)}_getDecorationIndex(i){let e=this._decorations.indexOf(i);return e>=0?e+1:1}getDecorationRangeAt(i){let e=i<this._decorations.length?this._decorations[i]:null;return e?this._editor.getModel().getDecorationRange(e):null}getCurrentMatchesPosition(i){let e=this._editor.getModel().getDecorationsInRange(i);for(let t of e){let o=t.options;if(o===a._FIND_MATCH_DECORATION||o===a._FIND_MATCH_NO_OVERVIEW_DECORATION||o===a._CURRENT_FIND_MATCH_DECORATION)return this._getDecorationIndex(t.id)}return 0}setCurrentFindMatch(i){let e=null,t=0;if(i)for(let o=0,n=this._decorations.length;o<n;o++){let r=this._editor.getModel().getDecorationRange(this._decorations[o]);if(i.equalsRange(r)){e=this._decorations[o],t=o+1;break}}return(this._highlightedDecorationId!==null||e!==null)&&this._editor.changeDecorations(o=>{if(this._highlightedDecorationId!==null&&(o.changeDecorationOptions(this._highlightedDecorationId,a._FIND_MATCH_DECORATION),this._highlightedDecorationId=null),e!==null&&(this._highlightedDecorationId=e,o.changeDecorationOptions(this._highlightedDecorationId,a._CURRENT_FIND_MATCH_DECORATION)),this._rangeHighlightDecorationId!==null&&(o.removeDecoration(this._rangeHighlightDecorationId),this._rangeHighlightDecorationId=null),e!==null){let n=this._editor.getModel().getDecorationRange(e);if(n.startLineNumber!==n.endLineNumber&&n.endColumn===1){let r=n.endLineNumber-1,s=this._editor.getModel().getLineMaxColumn(r);n=new z(n.startLineNumber,n.startColumn,r,s)}this._rangeHighlightDecorationId=o.addDecoration(n,a._RANGE_HIGHLIGHT_DECORATION)}}),t}set(i,e){this._editor.changeDecorations(t=>{let o=a._FIND_MATCH_DECORATION,n=[];if(i.length>1e3){o=a._FIND_MATCH_NO_OVERVIEW_DECORATION;let s=this._editor.getModel().getLineCount(),c=this._editor.getLayoutInfo().height/s,u=Math.max(2,Math.ceil(3/c)),p=i[0].range.startLineNumber,h=i[0].range.endLineNumber;for(let g=1,f=i.length;g<f;g++){let v=i[g].range;h+u>=v.startLineNumber?v.endLineNumber>h&&(h=v.endLineNumber):(n.push({range:new z(p,1,h,1),options:a._FIND_MATCH_ONLY_OVERVIEW_DECORATION}),p=v.startLineNumber,h=v.endLineNumber)}n.push({range:new z(p,1,h,1),options:a._FIND_MATCH_ONLY_OVERVIEW_DECORATION})}let r=new Array(i.length);for(let s=0,l=i.length;s<l;s++)r[s]={range:i[s].range,options:o};this._decorations=t.deltaDecorations(this._decorations,r),this._overviewRulerApproximateDecorations=t.deltaDecorations(this._overviewRulerApproximateDecorations,n),this._rangeHighlightDecorationId&&(t.removeDecoration(this._rangeHighlightDecorationId),this._rangeHighlightDecorationId=null),this._findScopeDecorationIds.length&&(this._findScopeDecorationIds.forEach(s=>t.removeDecoration(s)),this._findScopeDecorationIds=[]),e?.length&&(this._findScopeDecorationIds=e.map(s=>t.addDecoration(s,a._FIND_SCOPE_DECORATION)))})}matchBeforePosition(i){if(this._decorations.length===0)return null;for(let e=this._decorations.length-1;e>=0;e--){let t=this._decorations[e],o=this._editor.getModel().getDecorationRange(t);if(!(!o||o.endLineNumber>i.lineNumber)){if(o.endLineNumber<i.lineNumber)return o;if(!(o.endColumn>i.column))return o}}return this._editor.getModel().getDecorationRange(this._decorations[this._decorations.length-1])}matchAfterPosition(i){if(this._decorations.length===0)return null;for(let e=0,t=this._decorations.length;e<t;e++){let o=this._decorations[e],n=this._editor.getModel().getDecorationRange(o);if(!(!n||n.startLineNumber<i.lineNumber)){if(n.startLineNumber>i.lineNumber)return n;if(!(n.startColumn<i.column))return n}}return this._editor.getModel().getDecorationRange(this._decorations[0])}_allDecorations(){let i=[];return i=i.concat(this._decorations),i=i.concat(this._overviewRulerApproximateDecorations),this._findScopeDecorationIds.length&&i.push(...this._findScopeDecorationIds),this._rangeHighlightDecorationId&&i.push(this._rangeHighlightDecorationId),i}static{this._CURRENT_FIND_MATCH_DECORATION=mo.register({description:"current-find-match",stickiness:1,zIndex:13,className:"currentFindMatch",inlineClassName:"currentFindMatchInline",showIfCollapsed:!0,overviewRuler:{color:Xs(EO),position:2},minimap:{color:Xs(D7),position:1}})}static{this._FIND_MATCH_DECORATION=mo.register({description:"find-match",stickiness:1,zIndex:10,className:"findMatch",inlineClassName:"findMatchInline",showIfCollapsed:!0,overviewRuler:{color:Xs(EO),position:2},minimap:{color:Xs(D7),position:1}})}static{this._FIND_MATCH_NO_OVERVIEW_DECORATION=mo.register({description:"find-match-no-overview",stickiness:1,className:"findMatch",showIfCollapsed:!0})}static{this._FIND_MATCH_ONLY_OVERVIEW_DECORATION=mo.register({description:"find-match-only-overview",stickiness:1,overviewRuler:{color:Xs(EO),position:2}})}static{this._RANGE_HIGHLIGHT_DECORATION=mo.register({description:"find-range-highlight",stickiness:1,className:"rangeHighlight",isWholeLine:!0})}static{this._FIND_SCOPE_DECORATION=mo.register({description:"find-scope",className:"findScope",isWholeLine:!0})}};var vCt=class{constructor(i,e,t){this._editorSelection=i,this._ranges=e,this._replaceStrings=t,this._trackedEditorSelectionId=null}getEditOperations(i,e){if(this._ranges.length>0){let t=[];for(let r=0;r<this._ranges.length;r++)t.push({range:this._ranges[r],text:this._replaceStrings[r]});t.sort((r,s)=>z.compareRangesUsingStarts(r.range,s.range));let o=[],n=t[0];for(let r=1;r<t.length;r++)n.range.endLineNumber===t[r].range.startLineNumber&&n.range.endColumn===t[r].range.startColumn?(n.range=n.range.plusRange(t[r].range),n.text=n.text+t[r].text):(o.push(n),n=t[r]);o.push(n);for(let r of o)e.addEditOperation(r.range,r.text)}this._trackedEditorSelectionId=e.trackSelection(this._editorSelection)}computeCursorState(i,e){return e.getTrackedSelection(this._trackedEditorSelectionId)}};function p3e(a,i){if(a&&a[0]!==""){let e=j9i(a,i,"-"),t=j9i(a,i,"_");return e&&!t?Q9i(a,i,"-"):!e&&t?Q9i(a,i,"_"):a[0].toUpperCase()===a[0]?i.toUpperCase():a[0].toLowerCase()===a[0]?i.toLowerCase():I$e(a[0][0])&&i.length>0?i[0].toUpperCase()+i.substr(1):a[0][0].toUpperCase()!==a[0][0]&&i.length>0?i[0].toLowerCase()+i.substr(1):i}else return i}function j9i(a,i,e){return a[0].indexOf(e)!==-1&&i.indexOf(e)!==-1&&a[0].split(e).length===i.split(e).length}function Q9i(a,i,e){let t=i.split(e),o=a[0].split(e),n="";return t.forEach((r,s)=>{n+=p3e([o[s]],r)+e}),n.slice(0,-1)}var bCt=class{constructor(i){this.staticValue=i;this.kind=0}},Xsi=class{constructor(i){this.pieces=i;this.kind=1}},VY=class a{static fromStaticValue(i){return new a([yxe.staticValue(i)])}get hasReplacementPatterns(){return this._state.kind===1}constructor(i){!i||i.length===0?this._state=new bCt(""):i.length===1&&i[0].staticValue!==null?this._state=new bCt(i[0].staticValue):this._state=new Xsi(i)}buildReplaceString(i,e){if(this._state.kind===0)return e?p3e(i,this._state.staticValue):this._state.staticValue;let t="";for(let o=0,n=this._state.pieces.length;o<n;o++){let r=this._state.pieces[o];if(r.staticValue!==null){t+=r.staticValue;continue}let s=a._substitute(r.matchIndex,i);if(r.caseOps!==null&&r.caseOps.length>0){let l=[],c=r.caseOps.length,u=0;for(let p=0,h=s.length;p<h;p++){if(u>=c){l.push(s.slice(p));break}switch(r.caseOps[u]){case"U":l.push(s[p].toUpperCase());break;case"u":l.push(s[p].toUpperCase()),u++;break;case"L":l.push(s[p].toLowerCase());break;case"l":l.push(s[p].toLowerCase()),u++;break;default:l.push(s[p])}}s=l.join("")}t+=s}return t}static _substitute(i,e){if(e===null)return"";if(i===0)return e[0];let t="";for(;i>0;){if(i<e.length)return(e[i]||"")+t;t=String(i%10)+t,i=Math.floor(i/10)}return"$"+t}},yxe=class a{static staticValue(i){return new a(i,-1,null)}static matchIndex(i){return new a(null,i,null)}static caseOps(i,e){return new a(null,i,e)}constructor(i,e,t){this.staticValue=i,this.matchIndex=e,!t||t.length===0?this.caseOps=null:this.caseOps=t.slice(0)}},Jsi=class{constructor(i){this._source=i,this._lastCharIndex=0,this._result=[],this._resultLen=0,this._currentStaticPiece=""}emitUnchanged(i){this._emitStatic(this._source.substring(this._lastCharIndex,i)),this._lastCharIndex=i}emitStatic(i,e){this._emitStatic(i),this._lastCharIndex=e}_emitStatic(i){i.length!==0&&(this._currentStaticPiece+=i)}emitMatchIndex(i,e,t){this._currentStaticPiece.length!==0&&(this._result[this._resultLen++]=yxe.staticValue(this._currentStaticPiece),this._currentStaticPiece=""),this._result[this._resultLen++]=yxe.caseOps(i,t),this._lastCharIndex=e}finalize(){return this.emitUnchanged(this._source.length),this._currentStaticPiece.length!==0&&(this._result[this._resultLen++]=yxe.staticValue(this._currentStaticPiece),this._currentStaticPiece=""),new VY(this._result)}};function SCt(a){if(!a||a.length===0)return new VY(null);let i=[],e=new Jsi(a);for(let t=0,o=a.length;t<o;t++){let n=a.charCodeAt(t);if(n===92){if(t++,t>=o)break;let r=a.charCodeAt(t);switch(r){case 92:e.emitUnchanged(t-1),e.emitStatic("\\",t+1);break;case 110:e.emitUnchanged(t-1),e.emitStatic(`
`,t+1);break;case 116:e.emitUnchanged(t-1),e.emitStatic("	",t+1);break;case 117:case 85:case 108:case 76:e.emitUnchanged(t-1),e.emitStatic("",t+1),i.push(String.fromCharCode(r));break}continue}if(n===36){if(t++,t>=o)break;let r=a.charCodeAt(t);if(r===36){e.emitUnchanged(t-1),e.emitStatic("$",t+1);continue}if(r===48||r===38){e.emitUnchanged(t-1),e.emitMatchIndex(0,t+1,i),i.length=0;continue}if(49<=r&&r<=57){let s=r-48;if(t+1<o){let l=a.charCodeAt(t+1);if(48<=l&&l<=57){t++,s=s*10+(l-48),e.emitUnchanged(t-2),e.emitMatchIndex(s,t+1,i),i.length=0;continue}}e.emitUnchanged(t-1),e.emitMatchIndex(s,t+1,i),i.length=0;continue}}}return e.finalize()}var UE=new Y("findWidgetVisible",!1),Y9i=UE.toNegated(),wxe=new Y("findInputFocussed",!1),m3e=new Y("replaceInputFocussed",!1),yCt=new Y("findWidgetFocused",!1),l5={primary:545,mac:{primary:2593}},c5={primary:565,mac:{primary:2613}},d5={primary:560,mac:{primary:2608}},h3e={primary:554,mac:{primary:2602}},Cce={primary:558,mac:{primary:2606}},xd={StartFindAction:"actions.find",StartFindWithSelection:"actions.findWithSelection",StartFindWithArgs:"editor.actions.findWithArgs",NextMatchFindAction:"editor.action.nextMatchFindAction",PreviousMatchFindAction:"editor.action.previousMatchFindAction",GoToMatchFindAction:"editor.action.goToMatchFindAction",NextSelectionMatchFindAction:"editor.action.nextSelectionMatchFindAction",PreviousSelectionMatchFindAction:"editor.action.previousSelectionMatchFindAction",StartFindReplaceAction:"editor.action.startFindReplaceAction",CloseFindWidgetCommand:"closeFindWidget",ToggleCaseSensitiveCommand:"toggleFindCaseSensitive",ToggleWholeWordCommand:"toggleFindWholeWord",ToggleRegexCommand:"toggleFindRegex",ToggleSearchScopeCommand:"toggleFindInSelection",TogglePreserveCaseCommand:"togglePreserveCase",ReplaceOneAction:"editor.action.replaceOne",ReplaceAllAction:"editor.action.replaceAll",SelectAllMatchesAction:"editor.action.selectAllMatches"},XO=19999,Y1o=240,ICt=class a{constructor(i,e){this._toDispose=new N;this._editor=i,this._state=e,this._isDisposed=!1,this._startSearchingTimer=new Ul,this._decorations=new a5(i),this._toDispose.add(this._decorations),this._updateDecorationsScheduler=new Dt(()=>{if(this._editor.hasModel())return this.research(!1)},100),this._toDispose.add(this._updateDecorationsScheduler),this._toDispose.add(this._editor.onDidChangeCursorPosition(t=>{(t.reason===3||t.reason===5||t.reason===6)&&this._decorations.setStartPosition(this._editor.getPosition())})),this._ignoreModelContentChanged=!1,this._toDispose.add(this._editor.onDidChangeModelContent(t=>{this._ignoreModelContentChanged||(t.isFlush&&this._decorations.reset(),this._decorations.setStartPosition(this._editor.getPosition()),this._updateDecorationsScheduler.schedule())})),this._toDispose.add(this._state.onFindReplaceStateChange(t=>this._onStateChanged(t))),this.research(!1,this._state.searchScope)}dispose(){this._isDisposed=!0,Be(this._startSearchingTimer),this._toDispose.dispose()}_onStateChanged(i){this._isDisposed||this._editor.hasModel()&&(i.searchString||i.isReplaceRevealed||i.isRegex||i.wholeWord||i.matchCase||i.searchScope)&&(this._editor.getModel().isTooLargeForSyncing()?(this._startSearchingTimer.cancel(),this._startSearchingTimer.setIfNotSet(()=>{i.searchScope?this.research(i.moveCursor,this._state.searchScope):this.research(i.moveCursor)},Y1o)):i.searchScope?this.research(i.moveCursor,this._state.searchScope):this.research(i.moveCursor))}static _getSearchRange(i,e){return e||i.getFullModelRange()}research(i,e){let t=null;typeof e<"u"?e!==null&&(Array.isArray(e)?t=e:t=[e]):t=this._decorations.getFindScopes(),t!==null&&(t=t.map(s=>{if(s.startLineNumber!==s.endLineNumber){let l=s.endLineNumber;return s.endColumn===1&&(l=l-1),new z(s.startLineNumber,1,l,this._editor.getModel().getLineMaxColumn(l))}return s}));let o=this._findMatches(t,!1,XO);this._decorations.set(o,t);let n=this._editor.getSelection(),r=this._decorations.getCurrentMatchesPosition(n);if(r===0&&o.length>0){let s=Ky(o.map(l=>l.range),l=>z.compareRangesUsingStarts(l,n)>=0);r=s>0?s-1+1:r}this._state.changeMatchInfo(r,this._decorations.getCount(),void 0),i&&this._editor.getOption(50).cursorMoveOnType&&this._moveToNextMatch(this._decorations.getStartPosition())}_hasMatches(){return this._state.matchesCount>0}_cannotFind(){if(!this._hasMatches()){let i=this._decorations.getFindScope();return i&&this._editor.revealRangeInCenterIfOutsideViewport(i,0),!0}return!1}_setCurrentFindMatch(i){let e=this._decorations.setCurrentFindMatch(i);this._state.changeMatchInfo(e,this._decorations.getCount(),i),this._editor.setSelection(i),this._editor.revealRangeInCenterIfOutsideViewport(i,0)}_prevSearchPosition(i){let e=this._state.isRegex&&(this._state.searchString.indexOf("^")>=0||this._state.searchString.indexOf("$")>=0),{lineNumber:t,column:o}=i,n=this._editor.getModel();return e||o===1?(t===1?t=n.getLineCount():t--,o=n.getLineMaxColumn(t)):o--,new ye(t,o)}_moveToPrevMatch(i,e=!1){if(!this._state.canNavigateBack()){let u=this._decorations.matchAfterPosition(i);u&&this._setCurrentFindMatch(u);return}if(this._decorations.getCount()<XO){let u=this._decorations.matchBeforePosition(i);u&&u.isEmpty()&&u.getStartPosition().equals(i)&&(i=this._prevSearchPosition(i),u=this._decorations.matchBeforePosition(i)),u&&this._setCurrentFindMatch(u);return}if(this._cannotFind())return;let t=this._decorations.getFindScope(),o=a._getSearchRange(this._editor.getModel(),t);o.getEndPosition().isBefore(i)&&(i=o.getEndPosition()),i.isBefore(o.getStartPosition())&&(i=o.getEndPosition());let{lineNumber:n,column:r}=i,s=this._editor.getModel(),l=new ye(n,r),c=s.findPreviousMatch(this._state.searchString,l,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(148):null,!1);if(c&&c.range.isEmpty()&&c.range.getStartPosition().equals(l)&&(l=this._prevSearchPosition(l),c=s.findPreviousMatch(this._state.searchString,l,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(148):null,!1)),!!c){if(!e&&!o.containsRange(c.range))return this._moveToPrevMatch(c.range.getStartPosition(),!0);this._setCurrentFindMatch(c.range)}}moveToPrevMatch(){this._moveToPrevMatch(this._editor.getSelection().getStartPosition())}_nextSearchPosition(i){let e=this._state.isRegex&&(this._state.searchString.indexOf("^")>=0||this._state.searchString.indexOf("$")>=0),{lineNumber:t,column:o}=i,n=this._editor.getModel();return e||o===n.getLineMaxColumn(t)?(t===n.getLineCount()?t=1:t++,o=1):o++,new ye(t,o)}_moveToNextMatch(i){if(!this._state.canNavigateForward()){let t=this._decorations.matchBeforePosition(i);t&&this._setCurrentFindMatch(t);return}if(this._decorations.getCount()<XO){let t=this._decorations.matchAfterPosition(i);t&&t.isEmpty()&&t.getStartPosition().equals(i)&&(i=this._nextSearchPosition(i),t=this._decorations.matchAfterPosition(i)),t&&this._setCurrentFindMatch(t);return}let e=this._getNextMatch(i,!1,!0);e&&this._setCurrentFindMatch(e.range)}_getNextMatch(i,e,t,o=!1){if(this._cannotFind())return null;let n=this._decorations.getFindScope(),r=a._getSearchRange(this._editor.getModel(),n);r.getEndPosition().isBefore(i)&&(i=r.getStartPosition()),i.isBefore(r.getStartPosition())&&(i=r.getStartPosition());let{lineNumber:s,column:l}=i,c=this._editor.getModel(),u=new ye(s,l),p=c.findNextMatch(this._state.searchString,u,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(148):null,e);return t&&p&&p.range.isEmpty()&&p.range.getStartPosition().equals(u)&&(u=this._nextSearchPosition(u),p=c.findNextMatch(this._state.searchString,u,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(148):null,e)),p?!o&&!r.containsRange(p.range)?this._getNextMatch(p.range.getEndPosition(),e,t,!0):p:null}moveToNextMatch(){this._moveToNextMatch(this._editor.getSelection().getEndPosition())}_moveToMatch(i){let e=this._decorations.getDecorationRangeAt(i);e&&this._setCurrentFindMatch(e)}moveToMatch(i){this._moveToMatch(i)}_getReplacePattern(){return this._state.isRegex?SCt(this._state.replaceString):VY.fromStaticValue(this._state.replaceString)}replace(){if(!this._hasMatches())return;let i=this._getReplacePattern(),e=this._editor.getSelection(),t=this._getNextMatch(e.getStartPosition(),!0,!1);if(t)if(e.equalsRange(t.range)){let o=i.buildReplaceString(t.matches,this._state.preserveCase),n=new qh(e,o);this._executeEditorCommand("replace",n),this._decorations.setStartPosition(new ye(e.startLineNumber,e.startColumn+o.length)),this.research(!0)}else this._decorations.setStartPosition(this._editor.getPosition()),this._setCurrentFindMatch(t.range)}_findMatches(i,e,t){let o=(i||[null]).map(n=>a._getSearchRange(this._editor.getModel(),n));return this._editor.getModel().findMatches(this._state.searchString,o,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(148):null,e,t)}replaceAll(){if(!this._hasMatches())return;let i=this._decorations.getFindScopes();i===null&&this._state.matchesCount>=XO?this._largeReplaceAll():this._regularReplaceAll(i),this.research(!1)}_largeReplaceAll(){let e=new tw(this._state.searchString,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(148):null).parseSearchRequest();if(!e)return;let t=e.regex;if(!t.multiline){let p="mu";t.ignoreCase&&(p+="i"),t.global&&(p+="g"),t=new RegExp(t.source,p)}let o=this._editor.getModel(),n=o.getValue(1),r=o.getFullModelRange(),s=this._getReplacePattern(),l,c=this._state.preserveCase;s.hasReplacementPatterns||c?l=n.replace(t,function(){return s.buildReplaceString(arguments,c)}):l=n.replace(t,s.buildReplaceString(null,c));let u=new l7(r,l,this._editor.getSelection());this._executeEditorCommand("replaceAll",u)}_regularReplaceAll(i){let e=this._getReplacePattern(),t=this._findMatches(i,e.hasReplacementPatterns||this._state.preserveCase,1073741824),o=[];for(let r=0,s=t.length;r<s;r++)o[r]=e.buildReplaceString(t[r].matches,this._state.preserveCase);let n=new vCt(this._editor.getSelection(),t.map(r=>r.range),o);this._executeEditorCommand("replaceAll",n)}selectAllMatches(){if(!this._hasMatches())return;let i=this._decorations.getFindScopes(),t=this._findMatches(i,!1,1073741824).map(n=>new ti(n.range.startLineNumber,n.range.startColumn,n.range.endLineNumber,n.range.endColumn)),o=this._editor.getSelection();for(let n=0,r=t.length;n<r;n++)if(t[n].equalsRange(o)){t=[o].concat(t.slice(0,n)).concat(t.slice(n+1));break}this._editor.setSelections(t)}_executeEditorCommand(i,e){try{this._ignoreModelContentChanged=!0,this._editor.pushUndoStop(),this._editor.executeCommand(i,e),this._editor.pushUndoStop()}finally{this._ignoreModelContentChanged=!1}}};var X1o=d(10,null),J1o=d(12,null),Z1o=d(11,null),Cxe=class extends cm{constructor(i){super({icon:R.caseSensitive,title:X1o+i.appendTitle,isChecked:i.isChecked,hoverLifecycleOptions:i.hoverLifecycleOptions,inputActiveOptionBorder:i.inputActiveOptionBorder,inputActiveOptionForeground:i.inputActiveOptionForeground,inputActiveOptionBackground:i.inputActiveOptionBackground})}},xxe=class extends cm{constructor(i){super({icon:R.wholeWord,title:J1o+i.appendTitle,isChecked:i.isChecked,hoverLifecycleOptions:i.hoverLifecycleOptions,inputActiveOptionBorder:i.inputActiveOptionBorder,inputActiveOptionForeground:i.inputActiveOptionForeground,inputActiveOptionBackground:i.inputActiveOptionBackground})}},kxe=class extends cm{constructor(i){super({icon:R.regex,title:Z1o+i.appendTitle,isChecked:i.isChecked,hoverLifecycleOptions:i.hoverLifecycleOptions,inputActiveOptionBorder:i.inputActiveOptionBorder,inputActiveOptionForeground:i.inputActiveOptionForeground,inputActiveOptionBackground:i.inputActiveOptionBackground})}};function X9i(a,i,e){let t=e??document.createElement("div");return t.textContent=a,t}function zE(a,i,e){let t=e??document.createElement("div");return t.textContent="",J9i(t,ezo(a,!!i?.renderCodeSegments),i?.actionHandler,i?.renderCodeSegments),t}var Zsi=class{constructor(i){this.source=i,this.index=0}eos(){return this.index>=this.source.length}next(){let i=this.peek();return this.advance(),i}peek(){return this.source[this.index]}advance(){this.index++}};function J9i(a,i,e,t){let o;if(i.type===2)o=document.createTextNode(i.content||"");else if(i.type===3)o=document.createElement("b");else if(i.type===4)o=document.createElement("i");else if(i.type===7&&t)o=document.createElement("code");else if(i.type===5&&e){let n=document.createElement("a");e.disposables.add(Jo(n,"click",r=>{e.callback(String(i.index),r)})),o=n}else i.type===8?o=document.createElement("br"):i.type===1&&(o=a);o&&a!==o&&a.appendChild(o),o&&Array.isArray(i.children)&&i.children.forEach(n=>{J9i(o,n,e,t)})}function ezo(a,i){let e={type:1,children:[]},t=0,o=e,n=[],r=new Zsi(a);for(;!r.eos();){let s=r.next(),l=s==="\\"&&eai(r.peek(),i)!==0;if(l&&(s=r.next()),!l&&tzo(s,i)&&s===r.peek()){r.advance(),o.type===2&&(o=n.pop());let c=eai(s,i);if(o.type===c||o.type===5&&c===6)o=n.pop();else{let u={type:c,children:[]};c===5&&(u.index=t,t++),o.children.push(u),n.push(o),o=u}}else if(s===`
`)o.type===2&&(o=n.pop()),o.children.push({type:8});else if(o.type!==2){let c={type:2,content:s};o.children.push(c),n.push(o),o=c}else o.content+=s}return o.type===2&&(o=n.pop()),n.length,e}function tzo(a,i){return eai(a,i)!==0}function eai(a,i){switch(a){case"*":return 3;case"_":return 4;case"[":return 5;case"]":return 6;case"`":return i?7:0;default:return 0}}var wCt=class{constructor(i,e=0,t=i.length,o=e-1){this.items=i;this.start=e;this.end=t;this.index=o}current(){return this.index===this.start-1||this.index===this.end?null:this.items[this.index]}next(){return this.index=Math.min(this.index+1,this.end),this.current()}previous(){return this.index=Math.max(this.index-1,this.start-1),this.current()}first(){return this.index=this.start,this.current()}last(){return this.index=this.end-1,this.current()}};var BY=class{constructor(i=new Set,e=10){this._history=i;this._limit=e,this._onChange(),this._history.onDidChange&&(this._disposable=this._history.onDidChange(()=>this._onChange()))}getHistory(){return this._elements}add(i){this._history.delete(i),this._history.add(i),this._onChange()}next(){return this._navigator.next()}previous(){return this._currentPosition()!==0?this._navigator.previous():null}current(){return this._navigator.current()}first(){return this._navigator.first()}last(){return this._navigator.last()}isFirst(){return this._currentPosition()===0}isLast(){return this._currentPosition()>=this._elements.length-1}isNowhere(){return this._navigator.current()===null}has(i){return this._history.has(i)}clear(){this._history.clear(),this._onChange()}_onChange(){this._reduceToLimit();let i=this._elements;this._navigator=new wCt(i,0,i.length,i.length)}_reduceToLimit(){let i=this._elements;if(i.length>this._limit){let e=i.slice(i.length-this._limit);this._history.replace?this._history.replace(e):this._history=new Set(e)}}_currentPosition(){let i=this._navigator.current();return i?this._elements.indexOf(i):-1}get _elements(){let i=[];return this._history.forEach(e=>i.push(e)),i}dispose(){this._disposable&&(this._disposable.dispose(),this._disposable=void 0)}},YV=class{constructor(i,e=10,t=o=>o){this.capacity=e;this.identityFn=t;if(i.length<1)throw new Error("not supported");this._size=1,this.head=this.tail=this.cursor={value:i[0],previous:void 0,next:void 0},this.valueSet=new Ase([i[0]],t);for(let o=1;o<i.length;o++)this.add(i[o])}get size(){return this._size}add(i){let e={value:i,previous:this.tail,next:void 0};for(this.tail.next=e,this.tail=e,this.cursor=this.tail,this._size++,this.valueSet.has(i)?this._deleteFromList(i):this.valueSet.add(i);this._size>this.capacity;)this.valueSet.delete(this.head.value),this.head=this.head.next,this.head.previous=void 0,this._size--}replaceLast(i){if(this.identityFn(this.tail.value)===this.identityFn(i))return i;let e=this.tail.value;return this.valueSet.delete(e),this.tail.value=i,this.valueSet.has(i)?this._deleteFromList(i):this.valueSet.add(i),e}prepend(i){if(this._size===this.capacity||this.valueSet.has(i))return;let e={value:i,previous:void 0,next:this.head};this.head.previous=e,this.head=e,this._size++,this.valueSet.add(i)}isAtEnd(){return this.cursor===this.tail}current(){return this.cursor.value}previous(){return this.cursor.previous&&(this.cursor=this.cursor.previous),this.cursor.value}next(){return this.cursor.next&&(this.cursor=this.cursor.next),this.cursor.value}has(i){return this.valueSet.has(i)}resetCursor(){return this.cursor=this.tail,this.cursor.value}*[Symbol.iterator](){let i=this.head;for(;i;)yield i.value,i=i.next}_deleteFromList(i){let e=this.head,t=this.identityFn(i);for(;e!==this.tail;)this.identityFn(e.value)===t&&(e===this.head?(this.head=this.head.next,this.head.previous=void 0):(e.previous.next=e.next,e.next.previous=e.previous),this._size--),e=e.next}};var Exe=_;var Z9i={inputBackground:"#3C3C3C",inputForeground:"#CCCCCC",inputValidationInfoBorder:"#55AAFF",inputValidationInfoBackground:"#063B49",inputValidationWarningBorder:"#B89500",inputValidationWarningBackground:"#352A05",inputValidationErrorBorder:"#BE1100",inputValidationErrorBackground:"#5A1D1D",inputBorder:void 0,inputValidationErrorForeground:void 0,inputValidationInfoForeground:void 0,inputValidationWarningForeground:void 0},Vc=class extends ja{constructor(e,t,o){super();this.state="idle";this.maxHeight=Number.POSITIVE_INFINITY;this.hover=this._register(new me);this._onDidChange=this._register(new E);this._onDidHeightChange=this._register(new E);this.contextViewProvider=t,this.options=o,this.message=null,this.placeholder=this.options.placeholder||"",this.tooltip=this.options.tooltip??(this.placeholder||""),this.ariaLabel=this.options.ariaLabel||"",this.options.validationOptions&&(this.validation=this.options.validationOptions.validation),this.element=M(e,Exe(".monaco-inputbox.idle"));let n=this.options.flexibleHeight?"textarea":"input",r=M(this.element,Exe(".ibwrapper"));if(this.input=M(r,Exe(n+".input.empty")),this.input.setAttribute("autocorrect","off"),this.input.setAttribute("autocapitalize","off"),this.input.setAttribute("spellcheck","false"),this.onfocus(this.input,()=>this.element.classList.add("synthetic-focus")),this.onblur(this.input,()=>this.element.classList.remove("synthetic-focus")),this.options.flexibleHeight){this.maxHeight=typeof this.options.flexibleMaxHeight=="number"?this.options.flexibleMaxHeight:Number.POSITIVE_INFINITY,this.mirror=M(r,Exe("div.mirror")),this.mirror.innerText="\xA0",this.scrollableElement=new O7(this.element,{vertical:1}),this.options.flexibleWidth&&(this.input.setAttribute("wrap","off"),this.mirror.style.whiteSpace="pre",this.mirror.style.wordWrap="initial"),M(e,this.scrollableElement.getDomNode()),this._register(this.scrollableElement),this._register(this.scrollableElement.onScroll(c=>this.input.scrollTop=c.scrollTop));let s=this._register(new Gn(e.ownerDocument,"selectionchange")),l=U.filter(s.event,()=>e.ownerDocument.getSelection()?.anchorNode===r);this._register(l(this.updateScrollDimensions,this)),this._register(this.onDidHeightChange(this.updateScrollDimensions,this))}else this.input.type=this.options.type||"text",this.input.setAttribute("wrap","off");this.ariaLabel&&this.input.setAttribute("aria-label",this.ariaLabel),this.placeholder&&!this.options.showPlaceholderOnFocus&&this.setPlaceHolder(this.placeholder),this.tooltip&&this.setTooltip(this.tooltip),this.oninput(this.input,()=>this.onValueChange()),this.onblur(this.input,()=>this.onBlur()),this.onfocus(this.input,()=>this.onFocus()),this._register(this.ignoreGesture(this.input)),setTimeout(()=>this.updateMirror(),0),this.options.actions&&(this.actionbar=this._register(new Zi(this.element,{actionViewItemProvider:this.options.actionViewItemProvider})),this.actionbar.push(this.options.actions,{icon:!0,label:!1})),this.applyStyles()}get onDidChange(){return this._onDidChange.event}get onDidHeightChange(){return this._onDidHeightChange.event}setActions(e,t){this.actionbar?(this.actionbar.clear(),e&&this.actionbar.push(e,{icon:!0,label:!1})):e&&(this.actionbar=this._register(new Zi(this.element,{actionViewItemProvider:t??this.options.actionViewItemProvider})),this.actionbar.push(e,{icon:!0,label:!1}))}onBlur(){this._hideMessage(),this.options.showPlaceholderOnFocus&&this.input.setAttribute("placeholder","")}onFocus(){this._showMessage(),this.options.showPlaceholderOnFocus&&this.input.setAttribute("placeholder",this.placeholder||"")}setPlaceHolder(e){this.placeholder=e,this.input.setAttribute("placeholder",e)}setTooltip(e){this.tooltip=e,this.hover.value||(this.hover.value=this._register(Up().setupDelayedHoverAtMouse(this.input,()=>({content:this.tooltip,appearance:{compact:!0}}))))}setAriaLabel(e){this.ariaLabel=e,e?this.input.setAttribute("aria-label",this.ariaLabel):this.input.removeAttribute("aria-label")}getAriaLabel(){return this.ariaLabel}get mirrorElement(){return this.mirror}get inputElement(){return this.input}get value(){return this.input.value}set value(e){this.input.value!==e&&(this.input.value=e,this.onValueChange())}get step(){return this.input.step}set step(e){this.input.step=e}get height(){return typeof this.cachedHeight=="number"?this.cachedHeight:mh(this.element)}focus(){this.input.focus()}blur(){this.input.blur()}hasFocus(){return wa(this.input)}select(e=null){this.input.select(),e&&(this.input.setSelectionRange(e.start,e.end),e.end===this.input.value.length&&(this.input.scrollLeft=this.input.scrollWidth))}isSelectionAtEnd(){return this.input.selectionEnd===this.input.value.length&&this.input.selectionStart===this.input.selectionEnd}getSelection(){let e=this.input.selectionStart;if(e===null)return null;let t=this.input.selectionEnd??e;return{start:e,end:t}}enable(){this.input.removeAttribute("disabled")}disable(){this.blur(),this.input.disabled=!0,this._hideMessage()}setEnabled(e){e?this.enable():this.disable()}get width(){return zl(this.input)}set width(e){if(this.options.flexibleHeight&&this.options.flexibleWidth){let t=0;if(this.mirror){let o=parseFloat(this.mirror.style.paddingLeft||"")||0,n=parseFloat(this.mirror.style.paddingRight||"")||0;t=o+n}this.input.style.width=e-t+"px"}else this.input.style.width=e+"px";this.mirror&&(this.mirror.style.width=e+"px")}set paddingRight(e){this.input.style.width=`calc(100% - ${e}px)`,this.mirror&&(this.mirror.style.paddingRight=e+"px")}updateScrollDimensions(){if(typeof this.cachedContentHeight!="number"||typeof this.cachedHeight!="number"||!this.scrollableElement)return;let e=this.cachedContentHeight,t=this.cachedHeight,o=this.input.scrollTop;this.scrollableElement.setScrollDimensions({scrollHeight:e,height:t}),this.scrollableElement.setScrollPosition({scrollTop:o})}showMessage(e,t){if(this.state==="open"&&eo(this.message,e))return;this.message=e,this.element.classList.remove("idle"),this.element.classList.remove("info"),this.element.classList.remove("warning"),this.element.classList.remove("error"),this.element.classList.add(this.classForType(e.type));let o=this.stylesForType(this.message.type);this.element.style.border=`1px solid ${O_(o.border,"transparent")}`,this.message.content&&(this.hasFocus()||t)&&this._showMessage()}hideMessage(){this.message=null,this.element.classList.remove("info"),this.element.classList.remove("warning"),this.element.classList.remove("error"),this.element.classList.add("idle"),this._hideMessage(),this.applyStyles()}isInputValid(){return!!this.validation&&!this.validation(this.value)}validate(){let e=null;return this.validation&&(e=this.validation(this.value),e?(this.inputElement.setAttribute("aria-invalid","true"),this.showMessage(e)):this.inputElement.hasAttribute("aria-invalid")&&(this.inputElement.removeAttribute("aria-invalid"),this.hideMessage())),e?.type}stylesForType(e){let t=this.options.inputBoxStyles;switch(e){case 1:return{border:t.inputValidationInfoBorder,background:t.inputValidationInfoBackground,foreground:t.inputValidationInfoForeground};case 2:return{border:t.inputValidationWarningBorder,background:t.inputValidationWarningBackground,foreground:t.inputValidationWarningForeground};default:return{border:t.inputValidationErrorBorder,background:t.inputValidationErrorBackground,foreground:t.inputValidationErrorForeground}}}classForType(e){switch(e){case 1:return"info";case 2:return"warning";default:return"error"}}_showMessage(){if(!this.contextViewProvider||!this.message)return;let e,t=()=>e.style.width=zl(this.element)+"px";this.contextViewProvider.showContextView({getAnchor:()=>this.element,anchorAlignment:1,render:n=>{if(!this.message)return null;e=M(n,Exe(".monaco-inputbox-container")),t();let r=Exe("span.monaco-inputbox-message");this.message.formatContent?zE(this.message.content,void 0,r):X9i(this.message.content,void 0,r),r.classList.add(this.classForType(this.message.type));let s=this.stylesForType(this.message.type);return r.style.backgroundColor=s.background??"",r.style.color=s.foreground??"",r.style.border=s.border?`1px solid ${s.border}`:"",M(e,r),null},onHide:()=>{this.state="closed"},layout:t});let o;this.message.type===3?o=d(19,null,this.message.content):this.message.type===2?o=d(21,null,this.message.content):o=d(20,null,this.message.content),en(o),this.state="open"}_hideMessage(){this.contextViewProvider&&(this.state==="open"&&this.contextViewProvider.hideContextView(),this.state="idle")}layoutMessage(){this.state==="open"&&this.contextViewProvider&&this.contextViewProvider.layout()}onValueChange(){this._onDidChange.fire(this.value),this.validate(),this.updateMirror(),this.input.classList.toggle("empty",!this.value),this.state==="open"&&this.contextViewProvider&&this.contextViewProvider.layout(),this.options.hideHoverOnValueChange&&Up().hideHover()}updateMirror(){if(!this.mirror)return;let e=this.value,o=e.charCodeAt(e.length-1)===10?" ":"";(e+o).replace(/\u000c/g,"")?this.mirror.textContent=e+o:this.mirror.innerText="\xA0",this.layout()}applyStyles(){let e=this.options.inputBoxStyles,t=e.inputBackground??"",o=e.inputForeground??"",n=e.inputBorder??"";this.element.style.backgroundColor=t,this.element.style.color=o,this.input.style.backgroundColor="inherit",this.input.style.color=o,this.element.style.border=`1px solid ${O_(n,"transparent")}`}layout(){if(!this.mirror){this.layoutMessage();return}let e=this.cachedContentHeight;this.cachedContentHeight=mh(this.mirror),e!==this.cachedContentHeight&&(this.cachedHeight=Math.min(this.cachedContentHeight,this.maxHeight),this.input.style.height=this.cachedHeight+"px",this._onDidHeightChange.fire(this.cachedContentHeight)),this.layoutMessage()}insertAtCursor(e){let t=this.inputElement,o=t.selectionStart,n=t.selectionEnd,r=t.value;o!==null&&n!==null&&(this.value=r.substr(0,o)+e+r.substr(n),t.setSelectionRange(o+1,o+1),this.layout())}dispose(){this._hideMessage(),this.message=null,this.actionbar?.dispose(),super.dispose()}},HY=class extends Vc{constructor(e,t,o){let n=d(24,null,"\u21C5"),r=d(23,null,"\u21C5");super(e,t,o);this._onDidFocus=this._register(new E);this.onDidFocus=this._onDidFocus.event;this._onDidBlur=this._register(new E);this.onDidBlur=this._onDidBlur.event;this.history=this._register(new BY(o.history,100));let s=()=>{if(o.showHistoryHint&&o.showHistoryHint()&&!this.placeholder.endsWith(n)&&!this.placeholder.endsWith(r)&&this.history.getHistory().length){let l=this.placeholder.endsWith(")")?n:r,c=this.placeholder+l;o.showPlaceholderOnFocus&&!wa(this.input)?this.placeholder=c:this.setPlaceHolder(c)}};this.observer=new MutationObserver((l,c)=>{l.forEach(u=>{u.target.textContent||s()})}),this.observer.observe(this.input,{attributeFilter:["class"]}),this.onfocus(this.input,()=>s()),this.onblur(this.input,()=>{let l=c=>{if(this.placeholder.endsWith(c)){let u=this.placeholder.slice(0,this.placeholder.length-c.length);return o.showPlaceholderOnFocus?this.placeholder=u:this.setPlaceHolder(u),!0}else return!1};l(r)||l(n)})}dispose(){super.dispose(),this.observer&&(this.observer.disconnect(),this.observer=void 0)}addToHistory(e){this.value&&(e||this.value!==this.getCurrentValue())&&this.history.add(this.value)}prependHistory(e){let t=this.getHistory();this.clearHistory(),e.forEach(o=>{this.history.add(o)}),t.forEach(o=>{this.history.add(o)})}getHistory(){return this.history.getHistory()}isAtFirstInHistory(){return this.history.isFirst()}isAtLastInHistory(){return this.history.isLast()}isNowhereInHistory(){return this.history.isNowhere()}showNextValue(){this.history.has(this.value)||this.addToHistory();let e=this.getNextValue();e&&(e=e===this.value?this.getNextValue():e),this.value=e??"",qr(this.value?this.value:d(22,null))}showPreviousValue(){this.history.has(this.value)||this.addToHistory();let e=this.getPreviousValue();e&&(e=e===this.value?this.getPreviousValue():e),e&&(this.value=e,qr(this.value))}clearHistory(){this.history.clear()}setPlaceHolder(e){super.setPlaceHolder(e),this.setTooltip(e)}onBlur(){super.onBlur(),this._onDidBlur.fire()}onFocus(){super.onFocus(),this._onDidFocus.fire()}getCurrentValue(){let e=this.history.current();return e||(e=this.history.last(),this.history.next()),e}getPreviousValue(){return this.history.previous()||this.history.first()}getNextValue(){return this.history.next()}};var izo=d(9,null),Vz=class extends ja{constructor(e,t,o){super();this.fixFocusOnOptionClickEnabled=!0;this.imeSessionInProgress=!1;this.additionalTogglesDisposables=this._register(new me);this.additionalToggles=[];this._onDidOptionChange=this._register(new E);this._onKeyDown=this._register(new E);this._onMouseDown=this._register(new E);this._onInput=this._register(new E);this._onKeyUp=this._register(new E);this._onCaseSensitiveKeyDown=this._register(new E);this._onRegexKeyDown=this._register(new E);this._lastHighlightFindOptions=0;this.placeholder=o.placeholder||"",this.validation=o.validation,this.label=o.label||izo,this.showCommonFindToggles=!!o.showCommonFindToggles;let n=o.appendCaseSensitiveLabel||"",r=o.appendWholeWordsLabel||"",s=o.appendRegexLabel||"",l=!!o.flexibleHeight,c=!!o.flexibleWidth,u=o.flexibleMaxHeight;if(this.domNode=document.createElement("div"),this.domNode.classList.add("monaco-findInput"),this.inputBox=this._register(new HY(this.domNode,t,{placeholder:this.placeholder||"",ariaLabel:this.label||"",validationOptions:{validation:this.validation},showHistoryHint:o.showHistoryHint,flexibleHeight:l,flexibleWidth:c,flexibleMaxHeight:u,inputBoxStyles:o.inputBoxStyles,history:o.history,actions:o.actions,actionViewItemProvider:o.actionViewItemProvider,hideHoverOnValueChange:o.hideHoverOnValueChange})),this.showCommonFindToggles){let p=o?.hoverLifecycleOptions||{groupId:"find-input"};this.regex=this._register(new kxe({appendTitle:s,isChecked:!1,hoverLifecycleOptions:p,...o.toggleStyles})),this._register(this.regex.onChange(g=>{this._onDidOptionChange.fire(g),!g&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus(),this.validate()})),this._register(this.regex.onKeyDown(g=>{this._onRegexKeyDown.fire(g)})),this.wholeWords=this._register(new xxe({appendTitle:r,isChecked:!1,hoverLifecycleOptions:p,...o.toggleStyles})),this._register(this.wholeWords.onChange(g=>{this._onDidOptionChange.fire(g),!g&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus(),this.validate()})),this.caseSensitive=this._register(new Cxe({appendTitle:n,isChecked:!1,hoverLifecycleOptions:p,...o.toggleStyles})),this._register(this.caseSensitive.onChange(g=>{this._onDidOptionChange.fire(g),!g&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus(),this.validate()})),this._register(this.caseSensitive.onKeyDown(g=>{this._onCaseSensitiveKeyDown.fire(g)}));let h=[this.caseSensitive.domNode,this.wholeWords.domNode,this.regex.domNode];this.onkeydown(this.domNode,g=>{if(g.equals(15)||g.equals(17)||g.equals(9)){let f=h.indexOf(this.domNode.ownerDocument.activeElement);if(f>=0){let v=-1;g.equals(17)?v=(f+1)%h.length:g.equals(15)&&(f===0?v=h.length-1:v=f-1),g.equals(9)?(h[f].blur(),this.inputBox.focus()):v>=0&&h[v].focus(),Xt.stop(g,!0)}}})}this.controls=document.createElement("div"),this.controls.className="controls",this.controls.style.display=this.showCommonFindToggles?"":"none",this.caseSensitive&&this.controls.append(this.caseSensitive.domNode),this.wholeWords&&this.controls.appendChild(this.wholeWords.domNode),this.regex&&this.controls.appendChild(this.regex.domNode),this.setAdditionalToggles(o?.additionalToggles),this.controls&&this.domNode.appendChild(this.controls),e?.appendChild(this.domNode),this._register(j(this.inputBox.inputElement,"compositionstart",p=>{this.imeSessionInProgress=!0})),this._register(j(this.inputBox.inputElement,"compositionend",p=>{this.imeSessionInProgress=!1,this._onInput.fire()})),this.onkeydown(this.inputBox.inputElement,p=>this._onKeyDown.fire(p)),this.onkeyup(this.inputBox.inputElement,p=>this._onKeyUp.fire(p)),this.oninput(this.inputBox.inputElement,p=>this._onInput.fire()),this.onmousedown(this.inputBox.inputElement,p=>this._onMouseDown.fire(p))}static{this.OPTION_CHANGE="optionChange"}get onDidOptionChange(){return this._onDidOptionChange.event}get onKeyDown(){return this._onKeyDown.event}get onMouseDown(){return this._onMouseDown.event}get onInput(){return this._onInput.event}get onKeyUp(){return this._onKeyUp.event}get onCaseSensitiveKeyDown(){return this._onCaseSensitiveKeyDown.event}get onRegexKeyDown(){return this._onRegexKeyDown.event}get isImeSessionInProgress(){return this.imeSessionInProgress}get onDidChange(){return this.inputBox.onDidChange}layout(e){this.inputBox.layout(),this.updateInputBoxPadding(e.collapsedFindWidget)}enable(){this.domNode.classList.remove("disabled"),this.inputBox.enable(),this.regex?.enable(),this.wholeWords?.enable(),this.caseSensitive?.enable();for(let e of this.additionalToggles)e.enable()}disable(){this.domNode.classList.add("disabled"),this.inputBox.disable(),this.regex?.disable(),this.wholeWords?.disable(),this.caseSensitive?.disable();for(let e of this.additionalToggles)e.disable()}setFocusInputOnOptionClick(e){this.fixFocusOnOptionClickEnabled=e}setEnabled(e){e?this.enable():this.disable()}setAdditionalToggles(e){for(let t of this.additionalToggles)t.domNode.remove();this.additionalToggles=[],this.additionalTogglesDisposables.value=new N;for(let t of e??[])this.additionalTogglesDisposables.value.add(t),this.controls.appendChild(t.domNode),this.additionalTogglesDisposables.value.add(t.onChange(o=>{this._onDidOptionChange.fire(o),!o&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus()})),this.additionalToggles.push(t);this.additionalToggles.length>0&&(this.controls.style.display=""),this.updateInputBoxPadding()}setActions(e,t){this.inputBox.setActions(e,t)}updateInputBoxPadding(e=!1){e?this.inputBox.paddingRight=0:this.inputBox.paddingRight=(this.caseSensitive?.width()??0)+(this.wholeWords?.width()??0)+(this.regex?.width()??0)+this.additionalToggles.reduce((t,o)=>t+o.width(),0)}clear(){this.clearValidation(),this.setValue(""),this.focus()}getValue(){return this.inputBox.value}setValue(e){this.inputBox.value!==e&&(this.inputBox.value=e)}onSearchSubmit(){this.inputBox.addToHistory()}select(){this.inputBox.select()}focus(){this.inputBox.focus()}getCaseSensitive(){return this.caseSensitive?.checked??!1}setCaseSensitive(e){this.caseSensitive&&(this.caseSensitive.checked=e)}getWholeWords(){return this.wholeWords?.checked??!1}setWholeWords(e){this.wholeWords&&(this.wholeWords.checked=e)}getRegex(){return this.regex?.checked??!1}setRegex(e){this.regex&&(this.regex.checked=e,this.validate())}focusOnCaseSensitive(){this.caseSensitive?.focus()}focusOnRegex(){this.regex?.focus()}highlightFindOptions(){this.domNode.classList.remove("highlight-"+this._lastHighlightFindOptions),this._lastHighlightFindOptions=1-this._lastHighlightFindOptions,this.domNode.classList.add("highlight-"+this._lastHighlightFindOptions)}validate(){this.inputBox.validate()}showMessage(e){this.inputBox.showMessage(e)}clearMessage(){this.inputBox.hideMessage()}clearValidation(){this.inputBox.hideMessage()}};var ozo=d(13,null),nzo=d(14,null),tai=class extends cm{constructor(i){super({icon:R.preserveCase,title:nzo+i.appendTitle,isChecked:i.isChecked,hoverLifecycleOptions:i.hoverLifecycleOptions,inputActiveOptionBorder:i.inputActiveOptionBorder,inputActiveOptionForeground:i.inputActiveOptionForeground,inputActiveOptionBackground:i.inputActiveOptionBackground})}},CCt=class extends ja{constructor(e,t,o,n){super();this._showOptionButtons=o;this.fixFocusOnOptionClickEnabled=!0;this.cachedOptionsWidth=0;this._onDidOptionChange=this._register(new E);this._onKeyDown=this._register(new E);this._onMouseDown=this._register(new E);this._onInput=this._register(new E);this._onKeyUp=this._register(new E);this._onPreserveCaseKeyDown=this._register(new E);this._lastHighlightFindOptions=0;this.contextViewProvider=t,this.placeholder=n.placeholder||"",this.validation=n.validation,this.label=n.label||ozo;let r=n.appendPreserveCaseLabel||"",s=n.history||new Set([]),l=!!n.flexibleHeight,c=!!n.flexibleWidth,u=n.flexibleMaxHeight;this.domNode=document.createElement("div"),this.domNode.classList.add("monaco-findInput"),this.inputBox=this._register(new HY(this.domNode,this.contextViewProvider,{ariaLabel:this.label||"",placeholder:this.placeholder||"",validationOptions:{validation:this.validation},history:s,showHistoryHint:n.showHistoryHint,flexibleHeight:l,flexibleWidth:c,flexibleMaxHeight:u,inputBoxStyles:n.inputBoxStyles})),this.preserveCase=this._register(new tai({appendTitle:r,isChecked:!1,hoverLifecycleOptions:n.hoverLifecycleOptions,...n.toggleStyles})),this._register(this.preserveCase.onChange(g=>{this._onDidOptionChange.fire(g),!g&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus(),this.validate()})),this._register(this.preserveCase.onKeyDown(g=>{this._onPreserveCaseKeyDown.fire(g)})),this._showOptionButtons?this.cachedOptionsWidth=this.preserveCase.width():this.cachedOptionsWidth=0;let p=[this.preserveCase.domNode];this.onkeydown(this.domNode,g=>{if(g.equals(15)||g.equals(17)||g.equals(9)){let f=p.indexOf(this.domNode.ownerDocument.activeElement);if(f>=0){let v=-1;g.equals(17)?v=(f+1)%p.length:g.equals(15)&&(f===0?v=p.length-1:v=f-1),g.equals(9)?(p[f].blur(),this.inputBox.focus()):v>=0&&p[v].focus(),Xt.stop(g,!0)}}});let h=document.createElement("div");h.className="controls",h.style.display=this._showOptionButtons?"block":"none",h.appendChild(this.preserveCase.domNode),this.domNode.appendChild(h),e?.appendChild(this.domNode),this.onkeydown(this.inputBox.inputElement,g=>this._onKeyDown.fire(g)),this.onkeyup(this.inputBox.inputElement,g=>this._onKeyUp.fire(g)),this.oninput(this.inputBox.inputElement,g=>this._onInput.fire()),this.onmousedown(this.inputBox.inputElement,g=>this._onMouseDown.fire(g))}static{this.OPTION_CHANGE="optionChange"}get onDidOptionChange(){return this._onDidOptionChange.event}get onKeyDown(){return this._onKeyDown.event}get onMouseDown(){return this._onMouseDown.event}get onInput(){return this._onInput.event}get onKeyUp(){return this._onKeyUp.event}get onPreserveCaseKeyDown(){return this._onPreserveCaseKeyDown.event}enable(){this.domNode.classList.remove("disabled"),this.inputBox.enable(),this.preserveCase.enable()}disable(){this.domNode.classList.add("disabled"),this.inputBox.disable(),this.preserveCase.disable()}setFocusInputOnOptionClick(e){this.fixFocusOnOptionClickEnabled=e}setEnabled(e){e?this.enable():this.disable()}clear(){this.clearValidation(),this.setValue(""),this.focus()}getValue(){return this.inputBox.value}setValue(e){this.inputBox.value!==e&&(this.inputBox.value=e)}onSearchSubmit(){this.inputBox.addToHistory()}applyStyles(){}select(){this.inputBox.select()}focus(){this.inputBox.focus()}getPreserveCase(){return this.preserveCase.checked}setPreserveCase(e){this.preserveCase.checked=e}focusOnPreserve(){this.preserveCase.focus()}highlightFindOptions(){this.domNode.classList.remove("highlight-"+this._lastHighlightFindOptions),this._lastHighlightFindOptions=1-this._lastHighlightFindOptions,this.domNode.classList.add("highlight-"+this._lastHighlightFindOptions)}validate(){this.inputBox?.validate()}showMessage(e){this.inputBox?.showMessage(e)}clearMessage(){this.inputBox?.hideMessage()}clearValidation(){this.inputBox?.hideMessage()}set width(e){this.inputBox.paddingRight=this.cachedOptionsWidth,this.domNode.style.width=e+"px"}dispose(){super.dispose()}};var kCt=new Y("suggestWidgetVisible",!1,d(2168,null)),iai="historyNavigationWidgetFocus",e7i="historyNavigationForwardsEnabled",t7i="historyNavigationBackwardsEnabled",g3e,xCt=[];function XV(a,i){if(xCt.includes(i))throw new Error("Cannot register the same widget multiple times");xCt.push(i);let e=new N,t=new Y(iai,!1).bindTo(a),o=new Y(e7i,!0).bindTo(a),n=new Y(t7i,!0).bindTo(a),r=()=>{t.set(!0),g3e=i},s=()=>{t.set(!1),g3e===i&&(g3e=void 0)};return wa(i.element)&&r(),e.add(i.onDidFocus(()=>r())),e.add(i.onDidBlur(()=>s())),e.add(Z(()=>{xCt.splice(xCt.indexOf(i),1),s()})),{historyNavigationForwardsEnablement:o,historyNavigationBackwardsEnablement:n,dispose(){e.dispose()}}}var Bz=class extends HY{constructor(i,e,t,o){super(i,e,t);let n=this._register(o.createScoped(this.element));this._register(XV(n,this))}};Bz=I([m(3,X)],Bz);var Hz=class extends Vz{constructor(i,e,t,o){super(i,e,t);let n=this._register(o.createScoped(this.inputBox.element));this._register(XV(n,this.inputBox))}};Hz=I([m(3,X)],Hz);var Uz=class extends CCt{constructor(i,e,t,o,n=!1){super(i,e,n,t);let r=this._register(o.createScoped(this.inputBox.element));this._register(XV(r,this.inputBox))}};Uz=I([m(3,X)],Uz);Ct.registerCommandAndKeybindingRule({id:"history.showPrevious",weight:200,when:C.and(C.has(iai),C.equals(t7i,!0),C.not("isComposing"),kCt.isEqualTo(!1)),primary:16,secondary:[528],handler:a=>{g3e?.showPreviousValue()}});Ct.registerCommandAndKeybindingRule({id:"history.showNext",weight:200,when:C.and(C.has(iai),C.equals(e7i,!0),C.not("isComposing"),kCt.isEqualTo(!1)),primary:18,secondary:[530],handler:a=>{g3e?.showNextValue()}});function bR(a){return a.lookupKeybinding("history.showPrevious")?.getElectronAccelerator()==="Up"&&a.lookupKeybinding("history.showNext")?.getElectronAccelerator()==="Down"}var i7i=Ae("find-collapsed",R.chevronRight,d(1120,null)),o7i=Ae("find-expanded",R.chevronDown,d(1121,null)),rai=Ae("find-selection",R.selection,d(1127,null)),sai=Ae("find-replace",R.replace,d(1126,null)),aai=Ae("find-replace-all",R.replaceAll,d(1125,null)),b3e=Ae("find-previous-match",R.arrowUp,d(1124,null)),S3e=Ae("find-next-match",R.arrowDown,d(1123,null)),rzo=d(1130,null),oai=d(1129,null),szo=d(1140,null),azo=d(1134,null),lzo=d(1132,null),czo=d(1139,null),dzo=d(1128,null),nai=d(1135,null),uzo=d(1141,null),pzo=d(1137,null),mzo=d(1136,null),hzo=d(1138,null),gzo=d(1143,null,XO),I3e=d(1131,null),Kz=d(1133,null),zz=419,fzo=275,vzo=fzo-54,f3e=69,bzo=33,n7i=Ze?256:2048,v3e=class{constructor(i){this.afterLineNumber=i,this.heightInPx=bzo,this.suppressMouseDown=!1,this.domNode=document.createElement("div"),this.domNode.className="dock-find-viewzone"}};function r7i(a,i,e){let t=!!i.match(/\n/);if(e&&t&&e.selectionStart>0){a.stopPropagation();return}}function s7i(a,i,e){let t=!!i.match(/\n/);if(e&&t&&e.selectionEnd<e.value.length){a.stopPropagation();return}}var ECt=class a extends ja{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this._hoverService=l;this._findWidgetSearchHistory=c;this._replaceWidgetHistory=u;this._configurationService=p;this._accessibilityService=h;this._cachedHeight=null;this._lastFocusedInputWasReplace=!1;this._lastFocusedElement=null;this._revealTimeouts=[];this._codeEditor=e,this._controller=t,this._state=o,this._contextViewProvider=n,this._keybindingService=r,this._contextKeyService=s,this._isVisible=!1,this._isReplaceVisible=!1,this._ignoreChangeEvent=!1,this._accessibilityHelpHintAnnounced=!1,this._updateHistoryDelayer=new Xo(500),this._register(Z(()=>this._updateHistoryDelayer.cancel())),this._register(this._state.onFindReplaceStateChange(g=>this._onStateChanged(g))),this._buildDomNode(),this._updateButtons(),this._tryUpdateWidgetWidth(),this._findInput.inputBox.layout(),this._register(this._codeEditor.onDidChangeConfiguration(g=>{if(g.hasChanged(104)&&(this._codeEditor.getOption(104)&&this._state.change({isReplaceRevealed:!1},!1),this._updateButtons()),g.hasChanged(165)&&this._tryUpdateWidgetWidth(),g.hasChanged(2)&&this.updateAccessibilitySupport(),g.hasChanged(50)){let f=this._codeEditor.getOption(50).loop;this._state.change({loop:f},!1);let v=this._codeEditor.getOption(50).addExtraSpaceOnTop;v&&!this._viewZone&&(this._viewZone=new v3e(0),this._showViewZone()),!v&&this._viewZone&&this._removeViewZone()}})),this.updateAccessibilitySupport(),this._register(this._codeEditor.onDidChangeCursorSelection(()=>{this._isVisible&&this._updateToggleSelectionFindButton()})),this._register(this._codeEditor.onDidFocusEditorWidget(async()=>{if(this._isVisible){let g=await this._controller.getGlobalBufferTerm();g&&g!==this._state.searchString&&(this._state.change({searchString:g},!1),this._findInput.select())}})),this._findInputFocused=wxe.bindTo(s),this._findFocusTracker=this._register(qn(this._findInput.inputBox.inputElement)),this._register(this._findFocusTracker.onDidFocus(()=>{this._findInputFocused.set(!0),this._lastFocusedInputWasReplace=!1,this._updateSearchScope()})),this._register(this._findFocusTracker.onDidBlur(()=>{this._findInputFocused.set(!1)})),this._replaceInputFocused=m3e.bindTo(s),this._replaceFocusTracker=this._register(qn(this._replaceInput.inputBox.inputElement)),this._register(this._replaceFocusTracker.onDidFocus(()=>{this._replaceInputFocused.set(!0),this._lastFocusedInputWasReplace=!0,this._updateSearchScope()})),this._register(this._replaceFocusTracker.onDidBlur(()=>{this._replaceInputFocused.set(!1)})),this._findWidgetFocused=yCt.bindTo(s),this._widgetFocusTracker=this._register(qn(this._domNode)),this._register(this._widgetFocusTracker.onDidFocus(()=>{this._findWidgetFocused.set(!0)})),this._register(this._widgetFocusTracker.onDidBlur(()=>{this._findWidgetFocused.set(!1)})),this._register(j(this._domNode,"focusin",g=>{Do(g.target)&&(this._lastFocusedElement=g.target)})),this._codeEditor.addOverlayWidget(this),this._codeEditor.getOption(50).addExtraSpaceOnTop&&(this._viewZone=new v3e(0)),this._register(this._codeEditor.onDidChangeModel(()=>{this._isVisible&&(this._viewZoneId=void 0)})),this._register(this._codeEditor.onDidScrollChange(g=>{if(g.scrollTopChanged){this._layoutViewZone();return}setTimeout(()=>{this._layoutViewZone()},0)}))}static{this.ID="editor.contrib.findWidget"}getId(){return a.ID}getDomNode(){return this._domNode}get lastFocusedInputWasReplace(){return this._lastFocusedInputWasReplace}get lastFocusedElement(){return this._lastFocusedElement}focusLastElement(){this._isVisible&&(this._lastFocusedElement&&this._domNode.contains(this._lastFocusedElement)&&Re(this._lastFocusedElement).document.body.contains(this._lastFocusedElement)?this._lastFocusedElement.focus():this._lastFocusedInputWasReplace?this.focusReplaceInput():this.focusFindInput())}getPosition(){return this._isVisible?{preference:0}:null}_onStateChanged(e){if(e.searchString){try{this._ignoreChangeEvent=!0,this._findInput.setValue(this._state.searchString)}finally{this._ignoreChangeEvent=!1}this._updateButtons()}if(e.replaceString&&(this._replaceInput.inputBox.value=this._state.replaceString),e.isRevealed&&(this._state.isRevealed?this._reveal():this._hide(!0)),e.isReplaceRevealed&&(this._state.isReplaceRevealed?!this._codeEditor.getOption(104)&&!this._isReplaceVisible&&(this._isReplaceVisible=!0,this._replaceInput.width=zl(this._findInput.domNode),this._updateButtons(),this._replaceInput.inputBox.layout()):this._isReplaceVisible&&(this._isReplaceVisible=!1,this._updateButtons())),(e.isRevealed||e.isReplaceRevealed)&&(this._state.isRevealed||this._state.isReplaceRevealed)&&this._tryUpdateHeight()&&this._showViewZone(),e.isRegex&&this._findInput.setRegex(this._state.isRegex),e.wholeWord&&this._findInput.setWholeWords(this._state.wholeWord),e.matchCase&&this._findInput.setCaseSensitive(this._state.matchCase),e.preserveCase&&this._replaceInput.setPreserveCase(this._state.preserveCase),e.searchScope&&(this._state.searchScope?this._toggleSelectionFind.checked=!0:this._toggleSelectionFind.checked=!1,this._updateToggleSelectionFindButton()),e.searchString||e.matchesCount||e.matchesPosition){let t=this._state.searchString.length>0&&this._state.matchesCount===0;this._domNode.classList.toggle("no-results",t),this._updateMatchesCount(),this._updateButtons()}(e.searchString||e.currentMatch)&&this._layoutViewZone(),e.updateHistory&&this._delayedUpdateHistory(),e.loop&&this._updateButtons()}_delayedUpdateHistory(){this._updateHistoryDelayer.trigger(this._updateHistory.bind(this)).then(void 0,mt)}_updateHistory(){this._state.searchString&&this._findInput.inputBox.addToHistory(),this._state.replaceString&&this._replaceInput.inputBox.addToHistory()}_updateMatchesCount(){this._matchesCount.style.minWidth=f3e+"px",this._state.matchesCount>=XO?this._matchesCount.title=gzo:this._matchesCount.title="",this._matchesCount.firstChild?.remove();let e;if(this._state.matchesCount>0){let t=String(this._state.matchesCount);this._state.matchesCount>=XO&&(t+="+");let o=String(this._state.matchesPosition);o==="0"&&(o="?"),e=vd(I3e,o,t)}else e=Kz;this._matchesCount.appendChild(document.createTextNode(e)),en(this._getAriaLabel(e,this._state.currentMatch,this._state.searchString)),f3e=Math.max(f3e,this._matchesCount.clientWidth)}_getAriaLabel(e,t,o){let n;if(e===Kz)n=o===""?d(1117,null,e):d(1116,null,e,o);else if(t){let r=d(1118,null,e,o,t.startLineNumber+":"+t.startColumn),s=this._codeEditor.getModel();s&&t.startLineNumber<=s.getLineCount()&&t.startLineNumber>=1?n=`${s.getLineContent(t.startLineNumber)}, ${r}`:n=r}else n=d(1119,null,e,o);return n}_updateToggleSelectionFindButton(){let e=this._codeEditor.getSelection(),t=e?e.startLineNumber!==e.endLineNumber||e.startColumn!==e.endColumn:!1,o=this._toggleSelectionFind.checked;this._isVisible&&(o||t)?this._toggleSelectionFind.enable():this._toggleSelectionFind.disable()}_updateButtons(){this._findInput.setEnabled(this._isVisible),this._replaceInput.setEnabled(this._isVisible&&this._isReplaceVisible),this._updateToggleSelectionFindButton(),this._closeBtn.setEnabled(this._isVisible);let e=this._state.searchString.length>0,t=!!this._state.matchesCount;this._prevBtn.setEnabled(this._isVisible&&e&&t&&this._state.canNavigateBack()),this._nextBtn.setEnabled(this._isVisible&&e&&t&&this._state.canNavigateForward()),this._replaceBtn.setEnabled(this._isVisible&&this._isReplaceVisible&&e),this._replaceAllBtn.setEnabled(this._isVisible&&this._isReplaceVisible&&e),this._domNode.classList.toggle("replaceToggled",this._isReplaceVisible),this._toggleReplaceBtn.setExpanded(this._isReplaceVisible);let o=!this._codeEditor.getOption(104);this._toggleReplaceBtn.setEnabled(this._isVisible&&o)}_reveal(){if(this._revealTimeouts.forEach(e=>{clearTimeout(e)}),this._revealTimeouts=[],!this._isVisible){this._isVisible=!0;let e=this._codeEditor.getSelection();switch(this._codeEditor.getOption(50).autoFindInSelection){case"always":this._toggleSelectionFind.checked=!0;break;case"never":this._toggleSelectionFind.checked=!1;break;case"multiline":{let o=!!e&&e.startLineNumber!==e.endLineNumber;this._toggleSelectionFind.checked=o;break}default:break}this._tryUpdateWidgetWidth(),this._updateButtons(),this._revealTimeouts.push(setTimeout(()=>{this._domNode.classList.add("visible"),this._domNode.setAttribute("aria-hidden","false"),this._updateFindInputAriaLabel()},0)),this._revealTimeouts.push(setTimeout(()=>{this._findInput.validate()},200)),this._codeEditor.layoutOverlayWidget(this);let t=!0;if(this._codeEditor.getOption(50).seedSearchStringFromSelection&&e){let o=this._codeEditor.getDomNode();if(o){let n=ir(o),r=this._codeEditor.getScrolledVisiblePosition(e.getStartPosition()),s=n.left+(r?r.left:0),l=r?r.top:0;if(this._viewZone&&l<this._viewZone.heightInPx){e.endLineNumber>e.startLineNumber&&(t=!1);let c=cO(this._domNode).left;s>c&&(t=!1);let u=this._codeEditor.getScrolledVisiblePosition(e.getEndPosition());n.left+(u?u.left:0)>c&&(t=!1)}}}this._showViewZone(t)}}_hide(e){this._revealTimeouts.forEach(t=>{clearTimeout(t)}),this._revealTimeouts=[],this._isVisible&&(this._isVisible=!1,this._accessibilityHelpHintAnnounced=!1,this._updateButtons(),this._domNode.classList.remove("visible"),this._domNode.setAttribute("aria-hidden","true"),this._findInput.clearMessage(),e&&this._codeEditor.focus(),this._codeEditor.layoutOverlayWidget(this),this._removeViewZone())}_layoutViewZone(e){if(!this._codeEditor.getOption(50).addExtraSpaceOnTop){this._removeViewZone();return}if(!this._isVisible)return;let o=this._viewZone;this._viewZoneId!==void 0||!o||this._codeEditor.changeViewZones(n=>{o.heightInPx=this._getHeight(),this._viewZoneId=n.addZone(o),this._codeEditor.setScrollTop(e||this._codeEditor.getScrollTop()+o.heightInPx)})}_showViewZone(e=!0){if(!this._isVisible||!this._codeEditor.getOption(50).addExtraSpaceOnTop)return;this._viewZone===void 0&&(this._viewZone=new v3e(0));let o=this._viewZone;this._codeEditor.changeViewZones(n=>{if(this._viewZoneId!==void 0){let r=this._getHeight();if(r===o.heightInPx)return;let s=r-o.heightInPx;o.heightInPx=r,n.layoutZone(this._viewZoneId),e&&this._codeEditor.setScrollTop(this._codeEditor.getScrollTop()+s);return}else{let r=this._getHeight();if(r-=this._codeEditor.getOption(96).top,r<=0)return;o.heightInPx=r,this._viewZoneId=n.addZone(o),e&&this._codeEditor.setScrollTop(this._codeEditor.getScrollTop()+r)}})}_removeViewZone(){this._codeEditor.changeViewZones(e=>{this._viewZoneId!==void 0&&(e.removeZone(this._viewZoneId),this._viewZoneId=void 0,this._viewZone&&(this._codeEditor.setScrollTop(this._codeEditor.getScrollTop()-this._viewZone.heightInPx),this._viewZone=void 0))})}_tryUpdateWidgetWidth(){if(!this._isVisible||!this._domNode.isConnected)return;let e=this._codeEditor.getLayoutInfo();if(e.contentWidth<=0){this._domNode.classList.add("hiddenEditor");return}else this._domNode.classList.contains("hiddenEditor")&&this._domNode.classList.remove("hiddenEditor");let o=e.width,n=e.minimap.minimapWidth,r=!1,s=!1,l=!1;if(this._resized&&zl(this._domNode)>zz){this._domNode.style.maxWidth=`${o-28-n-15}px`,this._replaceInput.width=zl(this._findInput.domNode);return}if(zz+28+n>=o&&(s=!0),zz+28+n-f3e>=o&&(l=!0),zz+28+n-f3e>=o+50&&(r=!0),this._domNode.classList.toggle("collapsed-find-widget",r),this._domNode.classList.toggle("narrow-find-widget",l),this._domNode.classList.toggle("reduced-find-widget",s),!l&&!r&&(this._domNode.style.maxWidth=`${o-28-n-15}px`),this._findInput.layout({collapsedFindWidget:r,narrowFindWidget:l,reducedFindWidget:s}),this._resized){let c=this._findInput.inputBox.element.clientWidth;c>0&&(this._replaceInput.width=c)}else this._isReplaceVisible&&(this._replaceInput.width=zl(this._findInput.domNode))}_getHeight(){let e=0;return e+=4,e+=this._findInput.inputBox.height+2,this._isReplaceVisible&&(e+=4,e+=this._replaceInput.inputBox.height+2),e+=4,e}_tryUpdateHeight(){let e=this._getHeight();return this._cachedHeight!==null&&this._cachedHeight===e?!1:(this._cachedHeight=e,this._domNode.style.height=`${e}px`,!0)}focusFindInput(){this._findInput.select(),this._findInput.focus()}focusReplaceInput(){this._replaceInput.select(),this._replaceInput.focus()}highlightFindOptions(){this._findInput.highlightFindOptions()}_updateSearchScope(){if(this._codeEditor.hasModel()&&this._toggleSelectionFind.checked){let e=this._codeEditor.getSelections();e.map(t=>{t.endColumn===1&&t.endLineNumber>t.startLineNumber&&(t=t.setEndPosition(t.endLineNumber-1,this._codeEditor.getModel().getLineMaxColumn(t.endLineNumber-1)));let o=this._state.currentMatch;return t.startLineNumber!==t.endLineNumber&&!z.equalsRange(t,o)?t:null}).filter(t=>!!t),e.length&&this._state.change({searchScope:e},!0)}}_onFindInputMouseDown(e){e.middleButton&&e.stopPropagation()}_onFindInputKeyDown(e){if(e.equals(n7i|3))if(this._keybindingService.dispatchEvent(e,e.target)){e.preventDefault();return}else{this._findInput.inputBox.insertAtCursor(`
`),e.preventDefault();return}if(e.equals(2)){this._isReplaceVisible?this._replaceInput.focus():this._findInput.focusOnCaseSensitive(),e.preventDefault();return}if(e.equals(2066)){this._codeEditor.focus(),e.preventDefault();return}if(e.equals(16))return r7i(e,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea"));if(e.equals(18))return s7i(e,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea"))}_onReplaceInputKeyDown(e){if(e.equals(n7i|3))if(this._keybindingService.dispatchEvent(e,e.target)){e.preventDefault();return}else{this._replaceInput.inputBox.insertAtCursor(`
`),e.preventDefault();return}if(e.equals(2)){this._findInput.focusOnCaseSensitive(),e.preventDefault();return}if(e.equals(1026)){this._findInput.focus(),e.preventDefault();return}if(e.equals(2066)){this._codeEditor.focus(),e.preventDefault();return}if(e.equals(16))return r7i(e,this._replaceInput.inputBox.value,this._replaceInput.inputBox.element.querySelector("textarea"));if(e.equals(18))return s7i(e,this._replaceInput.inputBox.value,this._replaceInput.inputBox.element.querySelector("textarea"))}getVerticalSashLeft(e){return 0}_keybindingLabelFor(e){return this._keybindingService.appendKeybinding("",e)}_buildDomNode(){let o=this._codeEditor.getOption(50).history,n=this._codeEditor.getOption(50).replaceHistory;this._findInput=this._register(new Hz(null,this._contextViewProvider,{width:vzo,label:oai,placeholder:szo,appendCaseSensitiveLabel:this._keybindingLabelFor(xd.ToggleCaseSensitiveCommand),appendWholeWordsLabel:this._keybindingLabelFor(xd.ToggleWholeWordCommand),appendRegexLabel:this._keybindingLabelFor(xd.ToggleRegexCommand),validation:h=>{if(h.length===0||!this._findInput.getRegex())return null;try{return new RegExp(h,"gu"),null}catch(g){return{content:g.message}}},flexibleHeight:!0,flexibleWidth:!0,flexibleMaxHeight:118,showCommonFindToggles:!0,showHistoryHint:()=>bR(this._keybindingService),inputBoxStyles:Cl,toggleStyles:gh,history:o==="workspace"?this._findWidgetSearchHistory:new Set([])},this._contextKeyService)),this._findInput.setRegex(!!this._state.isRegex),this._findInput.setCaseSensitive(!!this._state.matchCase),this._findInput.setWholeWords(!!this._state.wholeWord),this._register(this._findInput.onKeyDown(h=>{h.equals(3)&&!this._codeEditor.getOption(50).findOnType&&this._state.change({searchString:this._findInput.getValue()},!0),this._onFindInputKeyDown(h)})),this._register(this._findInput.inputBox.onDidChange(()=>{this._ignoreChangeEvent||!this._codeEditor.getOption(50).findOnType||this._state.change({searchString:this._findInput.getValue()},!0)})),this._register(this._findInput.onDidOptionChange(()=>{this._state.change({isRegex:this._findInput.getRegex(),wholeWord:this._findInput.getWholeWords(),matchCase:this._findInput.getCaseSensitive()},!0)})),this._register(this._findInput.onCaseSensitiveKeyDown(h=>{h.equals(1026)&&this._isReplaceVisible&&(this._replaceInput.focus(),h.preventDefault())})),this._register(this._findInput.onRegexKeyDown(h=>{h.equals(2)&&this._isReplaceVisible&&(this._replaceInput.focusOnPreserve(),h.preventDefault())})),this._register(this._findInput.inputBox.onDidHeightChange(h=>{this._tryUpdateHeight()&&this._showViewZone()})),fn&&this._register(this._findInput.onMouseDown(h=>this._onFindInputMouseDown(h))),this._matchesCount=document.createElement("div"),this._matchesCount.className="matchesCount",this._updateMatchesCount();let r={groupId:"find-widget"};this._prevBtn=this._register(new rI({label:azo+this._keybindingLabelFor(xd.PreviousMatchFindAction),icon:b3e,hoverLifecycleOptions:r,onTrigger:()=>{Ci(this._codeEditor.getAction(xd.PreviousMatchFindAction)).run().then(void 0,mt)}},this._hoverService)),this._nextBtn=this._register(new rI({label:lzo+this._keybindingLabelFor(xd.NextMatchFindAction),icon:S3e,hoverLifecycleOptions:r,onTrigger:()=>{Ci(this._codeEditor.getAction(xd.NextMatchFindAction)).run().then(void 0,mt)}},this._hoverService));let s=document.createElement("div");s.className="find-part",s.appendChild(this._findInput.domNode);let l=document.createElement("div");l.className="find-actions",s.appendChild(l),l.appendChild(this._matchesCount),l.appendChild(this._prevBtn.domNode),l.appendChild(this._nextBtn.domNode),this._toggleSelectionFind=this._register(new cm({icon:rai,title:czo+this._keybindingLabelFor(xd.ToggleSearchScopeCommand),isChecked:!1,hoverLifecycleOptions:r,inputActiveOptionBackground:kt(PV),inputActiveOptionBorder:kt(MV),inputActiveOptionForeground:kt(dj)})),this._register(this._toggleSelectionFind.onChange(()=>{if(this._toggleSelectionFind.checked){if(this._codeEditor.hasModel()){let h=this._codeEditor.getSelections();h=h.map(g=>(g.endColumn===1&&g.endLineNumber>g.startLineNumber&&(g=g.setEndPosition(g.endLineNumber-1,this._codeEditor.getModel().getLineMaxColumn(g.endLineNumber-1))),g.isEmpty()?null:g)).filter(g=>!!g),h.length&&this._state.change({searchScope:h},!0)}}else this._state.change({searchScope:null},!0)})),l.appendChild(this._toggleSelectionFind.domNode),this._closeBtn=this._register(new rI({label:dzo+this._keybindingLabelFor(xd.CloseFindWidgetCommand),icon:PE,hoverLifecycleOptions:r,onTrigger:()=>{this._state.change({isRevealed:!1,searchScope:null},!1)},onKeyDown:h=>{h.equals(2)&&this._isReplaceVisible&&(this._replaceBtn.isEnabled()?this._replaceBtn.focus():this._codeEditor.focus(),h.preventDefault())}},this._hoverService)),this._replaceInput=this._register(new Uz(null,void 0,{label:nai,placeholder:uzo,appendPreserveCaseLabel:this._keybindingLabelFor(xd.TogglePreserveCaseCommand),history:n==="workspace"?this._replaceWidgetHistory:new Set([]),flexibleHeight:!0,flexibleWidth:!0,flexibleMaxHeight:118,showHistoryHint:()=>bR(this._keybindingService),inputBoxStyles:Cl,toggleStyles:gh,hoverLifecycleOptions:r},this._contextKeyService,!0)),this._replaceInput.setPreserveCase(!!this._state.preserveCase),this._register(this._replaceInput.onKeyDown(h=>this._onReplaceInputKeyDown(h))),this._register(this._replaceInput.inputBox.onDidChange(()=>{this._state.change({replaceString:this._replaceInput.inputBox.value},!1)})),this._register(this._replaceInput.inputBox.onDidHeightChange(h=>{this._isReplaceVisible&&this._tryUpdateHeight()&&this._showViewZone()})),this._register(this._replaceInput.onDidOptionChange(()=>{this._state.change({preserveCase:this._replaceInput.getPreserveCase()},!0)})),this._register(this._replaceInput.onPreserveCaseKeyDown(h=>{h.equals(2)&&(this._prevBtn.isEnabled()?this._prevBtn.focus():this._nextBtn.isEnabled()?this._nextBtn.focus():this._toggleSelectionFind.enabled?this._toggleSelectionFind.focus():this._closeBtn.isEnabled()&&this._closeBtn.focus(),h.preventDefault())})),this._replaceBtn=this._register(new rI({label:pzo+this._keybindingLabelFor(xd.ReplaceOneAction),icon:sai,hoverLifecycleOptions:r,onTrigger:()=>{this._controller.replace()},onKeyDown:h=>{h.equals(1026)&&(this._closeBtn.focus(),h.preventDefault())}},this._hoverService)),this._replaceAllBtn=this._register(new rI({label:mzo+this._keybindingLabelFor(xd.ReplaceAllAction),icon:aai,hoverLifecycleOptions:r,onTrigger:()=>{this._controller.replaceAll()}},this._hoverService));let c=document.createElement("div");c.className="replace-part",c.appendChild(this._replaceInput.domNode);let u=document.createElement("div");u.className="replace-actions",c.appendChild(u),u.appendChild(this._replaceBtn.domNode),u.appendChild(this._replaceAllBtn.domNode),this._toggleReplaceBtn=this._register(new rI({label:hzo,className:"codicon toggle left",onTrigger:()=>{this._state.change({isReplaceRevealed:!this._isReplaceVisible},!1),this._isReplaceVisible&&(this._replaceInput.width=zl(this._findInput.domNode),this._replaceInput.inputBox.layout()),this._showViewZone()}},this._hoverService)),this._toggleReplaceBtn.setExpanded(this._isReplaceVisible),this._domNode=document.createElement("div"),this._domNode.className="editor-widget find-widget",this._domNode.setAttribute("aria-hidden","true"),this._domNode.ariaLabel=rzo,this._domNode.role="dialog",this._domNode.style.width=`${zz}px`,this._domNode.appendChild(this._toggleReplaceBtn.domNode),this._domNode.appendChild(s),this._domNode.appendChild(this._closeBtn.domNode),this._domNode.appendChild(c),this._resizeSash=this._register(new Jh(this._domNode,this,{orientation:0,size:2})),this._resized=!1;let p=zz;this._register(this._resizeSash.onDidStart(()=>{p=zl(this._domNode)})),this._register(this._resizeSash.onDidChange(h=>{this._resized=!0;let g=p+h.startX-h.currentX;if(g<zz)return;let f=parseFloat(y1(this._domNode).maxWidth)||0;g>f||(this._domNode.style.width=`${g}px`,this._isReplaceVisible&&(this._replaceInput.width=zl(this._findInput.domNode)),this._findInput.inputBox.layout(),this._tryUpdateHeight())})),this._register(this._resizeSash.onDidReset(()=>{let h=zl(this._domNode);if(h<zz)return;let g=zz;if(!this._resized||h===zz){let f=this._codeEditor.getLayoutInfo();g=f.width-28-f.minimap.minimapWidth-15,this._resized=!0}this._domNode.style.width=`${g}px`,this._isReplaceVisible&&(this._replaceInput.width=zl(this._findInput.domNode)),this._findInput.inputBox.layout()}))}updateAccessibilitySupport(){let e=this._codeEditor.getOption(2);this._findInput.setFocusInputOnOptionClick(e!==2),this._updateFindInputAriaLabel()}_updateFindInputAriaLabel(){let e=oai,t=nai;if(!this._accessibilityHelpHintAnnounced&&this._configurationService.getValue("accessibility.verbosity.find")&&this._accessibilityService.isScreenReaderOptimized()){let o=this._keybindingService.lookupKeybinding("editor.action.accessibilityHelp")?.getAriaLabel();if(o){let n=d(1115,null,o);e=d(1122,null,e,n),t=d(1142,null,t,n)}this._accessibilityHelpHintAnnounced=!0,this._labelResetTimeout?.dispose(),this._labelResetTimeout=tn(()=>{this._isVisible&&(this._findInput.inputBox.setAriaLabel(oai),this._replaceInput.inputBox.setAriaLabel(nai))},1e3)}this._findInput.inputBox.setAriaLabel(e),this._replaceInput.inputBox.setAriaLabel(t)}getViewState(){let e=!1;return this._viewZone&&this._viewZoneId&&(e=this._viewZone.heightInPx>this._codeEditor.getScrollTop()),{widgetViewZoneVisible:e,scrollTop:this._codeEditor.getScrollTop()}}setViewState(e){e&&e.widgetViewZoneVisible&&this._layoutViewZone(e.scrollTop)}},rI=class extends ja{constructor(i,e){super(),this._opts=i;let t="button";this._opts.className&&(t=t+" "+this._opts.className),this._opts.icon&&(t=t+" "+q.asClassName(this._opts.icon)),this._domNode=document.createElement("div"),this._domNode.tabIndex=0,this._domNode.className=t,this._domNode.setAttribute("role","button"),this._domNode.setAttribute("aria-label",this._opts.label),this._register(e.setupDelayedHover(this._domNode,{content:this._opts.label,style:1},i.hoverLifecycleOptions)),this.onclick(this._domNode,o=>{this._opts.onTrigger(),o.preventDefault()}),this.onkeydown(this._domNode,o=>{if(o.equals(10)||o.equals(3)){this._opts.onTrigger(),o.preventDefault();return}this._opts.onKeyDown?.(o)})}get domNode(){return this._domNode}isEnabled(){return this._domNode.tabIndex>=0}focus(){this._domNode.focus()}setEnabled(i){this._domNode.classList.toggle("disabled",!i),this._domNode.setAttribute("aria-disabled",String(!i)),this._domNode.tabIndex=i?0:-1}setExpanded(i){this._domNode.setAttribute("aria-expanded",String(!!i)),i?(this._domNode.classList.remove(...q.asClassNameArray(i7i)),this._domNode.classList.add(...q.asClassNameArray(o7i))):(this._domNode.classList.remove(...q.asClassNameArray(o7i)),this._domNode.classList.add(...q.asClassNameArray(i7i)))}};is((a,i)=>{let e=a.getColor(xO);e&&i.addRule(`.monaco-editor .findMatch { border: 1px ${uf(a.type)?"dotted":"solid"} ${e}; box-sizing: border-box; }`);let t=a.getColor(D5i);t&&i.addRule(`.monaco-editor .findScope { border: 1px ${uf(a.type)?"dashed":"solid"} ${t}; }`);let o=a.getColor(bi);o&&i.addRule(`.monaco-editor .find-widget { border: 1px solid ${o}; }`);let n=a.getColor(E5i);n&&i.addRule(`.monaco-editor .findMatchInline { color: ${n}; }`);let r=a.getColor(T5i);r&&i.addRule(`.monaco-editor .currentFindMatchInline { color: ${r}; }`)});var Txe=class extends x{constructor(e,t,o,n){super();this._container=e;this._getContent=t;this._clipboardService=o;this._hoverService=n;this._container.classList.add("hover-row-with-copy"),this._button=this._register(new rI({label:d(1292,null),icon:R.copy,onTrigger:()=>this._copyContent(),className:"hover-copy-button"},this._hoverService)),this._container.appendChild(this._button.domNode)}async _copyContent(){let e=this._getContent();e&&(await this._clipboardService.writeText(e),qr(d(1291,null)))}};Txe=I([m(2,Fi),m(3,nt)],Txe);var lai=class{constructor(i,e,t){this.provider=i;this.hover=e;this.ordinal=t}};async function Szo(a,i,e,t,o){let n=await Promise.resolve(a.provideHover(e,t,o)).catch(ys);if(!(!n||!Izo(n)))return new lai(a,n,i)}function y3e(a,i,e,t,o=!1){let r=a.ordered(i,o).map((s,l)=>Szo(s,l,i,e,t));return fp.fromPromisesResolveOrder(r).coalesce()}async function a7i(a,i,e,t,o=!1){let n=[];for await(let r of y3e(a,i,e,t,o))n.push(r.hover);return n}qS("_executeHoverProvider",(a,i,e)=>{let t=a.get(Qt);return a7i(t.hoverProvider,i,e,Se.None)});qS("_executeHoverProvider_recursive",(a,i,e)=>{let t=a.get(Qt);return a7i(t.hoverProvider,i,e,Se.None,!0)});function Izo(a){let i=typeof a.range<"u",e=typeof a.contents<"u"&&a.contents&&a.contents.length>0;return i&&e}var xce=_,yzo=Ae("hover-increase-verbosity",R.addSmall,d(1295,null)),wzo=Ae("hover-decrease-verbosity",R.removeSmall,d(1293,null)),KE=class{constructor(i,e,t,o,n,r=void 0){this.owner=i;this.range=e;this.contents=t;this.isBeforeContent=o;this.ordinal=n;this.source=r}isValidForHoverAnchor(i){return i.type===1&&this.range.startColumn<=i.range.startColumn&&this.range.endColumn>=i.range.endColumn}},TCt=class{constructor(i,e,t){this.hover=i;this.hoverProvider=e;this.hoverPosition=t}supportsVerbosityAction(i){switch(i){case 0:return this.hover.canIncreaseVerbosity??!1;case 1:return this.hover.canDecreaseVerbosity??!1}}},Gz=class{constructor(i,e,t,o,n,r,s){this._editor=i;this._markdownRendererService=e;this._configurationService=t;this._languageFeaturesService=o;this._keybindingService=n;this._hoverService=r;this._commandService=s;this.hoverOrdinal=3}createLoadingMessage(i){return new KE(this,i.range,[new Ie().appendText(d(1297,null))],!1,2e3)}computeSync(i,e){if(!this._editor.hasModel()||i.type!==1)return[];let t=this._editor.getModel(),o=i.range.startLineNumber,n=t.getLineMaxColumn(o),r=[],s=1e3,l=t.getLineLength(o),c=t.getLanguageIdAtPosition(i.range.startLineNumber,i.range.startColumn),u=this._editor.getOption(133),p=this._configurationService.getValue("editor.maxTokenizationLineLength",{overrideIdentifier:c}),h=this._editor.getOption(69).showLongLineWarning,g=!1;u>=0&&l>u&&i.range.startColumn>=u&&(g=!0,h&&r.push(new KE(this,i.range,[{value:d(1298,null,o3e),isTrusted:!0}],!1,s++))),!g&&typeof p=="number"&&l>=p&&h&&r.push(new KE(this,i.range,[{value:d(1299,null,o3e),isTrusted:!0}],!1,s++));let f=!1;for(let v of e){let b=v.range.startLineNumber===o?v.range.startColumn:1,S=v.range.endLineNumber===o?v.range.endColumn:n,y=v.options.hoverMessage;if(!y||UV(y))continue;v.options.beforeContentClassName&&(f=!0);let w=new z(i.range.startLineNumber,b,i.range.startLineNumber,S);r.push(new KE(this,w,cc(y),f,s++))}return r}computeAsync(i,e,t,o){if(!this._editor.hasModel()||i.type!==1)return fp.EMPTY;let n=this._editor.getModel(),r=this._languageFeaturesService.hoverProvider;return r.has(n)?this._getMarkdownHovers(r,n,i,o):fp.EMPTY}async*_getMarkdownHovers(i,e,t,o){let n=t.range.getStartPosition(),r=y3e(i,e,n,o);for await(let s of r)if(!UV(s.hover.contents)){let l=s.hover.range?z.lift(s.hover.range):t.range,c=new TCt(s.hover,s.provider,n);yield new KE(this,l,s.hover.contents,!1,s.ordinal,c)}}renderHoverParts(i,e){return this._renderedHoverParts=new cai(e,i.fragment,this,this._editor,this._commandService,this._keybindingService,this._hoverService,this._configurationService,this._markdownRendererService,i.onContentsChanged),this._renderedHoverParts}handleScroll(i){this._renderedHoverParts?.handleScroll(i)}getAccessibleContent(i){return this._renderedHoverParts?.getAccessibleContent(i)??""}doesMarkdownHoverAtIndexSupportVerbosityAction(i,e){return this._renderedHoverParts?.doesMarkdownHoverAtIndexSupportVerbosityAction(i,e)??!1}updateMarkdownHoverVerbosityLevel(i,e){return Promise.resolve(this._renderedHoverParts?.updateMarkdownHoverPartVerbosityLevel(i,e))}};Gz=I([m(1,On),m(2,B),m(3,Qt),m(4,_e),m(5,nt),m(6,ge)],Gz);var _xe=class{constructor(i,e,t,o){this.hoverPart=i;this.hoverElement=e;this.disposables=t;this.actionsContainer=o}get hoverAccessibleContent(){return this.hoverElement.innerText.trim()}dispose(){this.disposables.dispose()}},cai=class{constructor(i,e,t,o,n,r,s,l,c,u){this._hoverParticipant=t;this._editor=o;this._commandService=n;this._keybindingService=r;this._hoverService=s;this._configurationService=l;this._markdownRendererService=c;this._onFinishedRendering=u;this._ongoingHoverOperations=new Map;this._disposables=new N;this.renderedHoverParts=this._renderHoverParts(i,e,this._onFinishedRendering),this._disposables.add(Z(()=>{this.renderedHoverParts.forEach(p=>{p.dispose()}),this._ongoingHoverOperations.forEach(p=>{p.tokenSource.dispose(!0)})}))}_renderHoverParts(i,e,t){return i.sort(cl(o=>o.ordinal,hu)),i.map(o=>{let n=this._renderHoverPart(o,t);return e.appendChild(n.hoverElement),n})}_renderHoverPart(i,e){let t=this._renderMarkdownHover(i,e),o=t.hoverElement,n=i.source,r=new N;if(r.add(t),!n)return new _xe(i,o,r);let s=n.supportsVerbosityAction(0),l=n.supportsVerbosityAction(1);if(!s&&!l)return new _xe(i,o,r);let c=xce("div.verbosity-actions");o.prepend(c);let u=xce("div.verbosity-actions-inner");return c.append(u),r.add(this._renderHoverExpansionAction(u,0,s)),r.add(this._renderHoverExpansionAction(u,1,l)),new _xe(i,o,r,u)}_renderMarkdownHover(i,e){return d7i(this._editor,i,this._markdownRendererService,e)}_renderHoverExpansionAction(i,e,t){let o=new N,n=e===0,r=M(i,xce(q.asCSSSelector(n?yzo:wzo)));r.tabIndex=0;let s=o.add(new mf("mouse",void 0,{target:i,position:{hoverPosition:0}},this._configurationService,this._hoverService));if(o.add(this._hoverService.setupManagedHover(s,r,dai(this._keybindingService,e))),!t)return r.classList.add("disabled"),o;r.classList.add("enabled");let l=()=>this._commandService.executeCommand(e===0?Nz:Oz,{focus:!0});return o.add(new L4e(r,l)),o.add(new R4e(r,l,[3,10])),o}handleScroll(i){this.renderedHoverParts.forEach(e=>{let t=e.actionsContainer;if(!t)return;let o=e.hoverElement,r=i.scrollTop+i.height,s=o.offsetTop,l=o.clientHeight,c=s+l,u=22,p;c<=r||s>=r?p=l-u:p=r-s-u,t.style.top=`${p}px`})}async updateMarkdownHoverPartVerbosityLevel(i,e){let t=this._editor.getModel();if(!t)return;let o=this._getRenderedHoverPartAtIndex(e),n=o?.hoverPart.source;if(!o||!n?.supportsVerbosityAction(i))return;let r=await this._fetchHover(n,t,i);if(!r)return;let s=new TCt(r,n.hoverProvider,n.hoverPosition),l=o.hoverPart,c=new KE(this._hoverParticipant,l.range,r.contents,l.isBeforeContent,l.ordinal,s),u=this._updateRenderedHoverPart(e,c);if(u)return{hoverPart:c,hoverElement:u.hoverElement}}getAccessibleContent(i){let e=this.renderedHoverParts.findIndex(r=>r.hoverPart===i);if(e===-1)return;let t=this._getRenderedHoverPartAtIndex(e);return t?t.hoverElement.innerText.replace(/[^\S\n\r]+/gu," "):void 0}doesMarkdownHoverAtIndexSupportVerbosityAction(i,e){let t=this._getRenderedHoverPartAtIndex(i),o=t?.hoverPart.source;return!(!t||!o?.supportsVerbosityAction(e))}async _fetchHover(i,e,t){let o=t===0?1:-1,n=i.hoverProvider,r=this._ongoingHoverOperations.get(n);r&&(r.tokenSource.cancel(),o+=r.verbosityDelta);let s=new Ye;this._ongoingHoverOperations.set(n,{verbosityDelta:o,tokenSource:s});let l={verbosityRequest:{verbosityDelta:o,previousHover:i.hover}},c;try{c=await Promise.resolve(n.provideHover(e,i.hoverPosition,s.token,l))}catch(u){ys(u)}return s.dispose(),this._ongoingHoverOperations.delete(n),c}_updateRenderedHoverPart(i,e){if(i>=this.renderedHoverParts.length||i<0)return;let t=this._renderHoverPart(e,this._onFinishedRendering),o=this.renderedHoverParts[i],n=o.hoverElement,r=t.hoverElement,s=Array.from(r.children);n.replaceChildren(...s);let l=new _xe(e,n,t.disposables,t.actionsContainer);return o.dispose(),this.renderedHoverParts[i]=l,l}_getRenderedHoverPartAtIndex(i){return this.renderedHoverParts[i]}dispose(){this._disposables.dispose()}};function c7i(a,i,e,t){i.sort(cl(n=>n.ordinal,hu));let o=[];for(let n of i){let r=d7i(e,n,t,a.onContentsChanged);a.fragment.appendChild(r.hoverElement),o.push(r)}return new ok(o)}function d7i(a,i,e,t){let o=new N,n=xce("div.hover-row"),r=xce("div.hover-row-contents");n.appendChild(r);let s=i.contents;for(let c of s){if(UV(c))continue;let u=xce("div.markdown-hover"),p=M(u,xce("div.hover-contents")),h=o.add(e.render(c,{context:a,asyncRenderCallback:()=>{p.className="hover-contents code-hover-contents",t()}}));p.appendChild(h.element),r.appendChild(u)}return{hoverPart:i,hoverElement:n,dispose(){o.dispose()}}}function dai(a,i){switch(i){case 0:return a.appendKeybinding(d(1296,null),Nz);case 1:return a.appendKeybinding(d(1294,null),Oz)}}var u7i=_,_Ct=class extends x{constructor(e,t,o){super();this.model=t;this.pixelRatio=o;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._onColorFlushed=this._register(new E);this.onColorFlushed=this._onColorFlushed.event;this._domNode=u7i(".saturation-wrap"),M(e,this._domNode),this._canvas=document.createElement("canvas"),this._canvas.className="saturation-box",M(this._domNode,this._canvas),this.selection=u7i(".saturation-selection"),M(this._domNode,this.selection),this.layout(),this._register(j(this._domNode,re.POINTER_DOWN,n=>this.onPointerDown(n))),this._register(this.model.onDidChangeColor(this.onDidChangeColor,this)),this.monitor=null}get domNode(){return this._domNode}onPointerDown(e){if(!e.target||!(e.target instanceof Element))return;this.monitor=this._register(new $L);let t=ir(this._domNode);e.target!==this.selection&&this.onDidChangePosition(e.offsetX,e.offsetY),this.monitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>this.onDidChangePosition(n.pageX-t.left,n.pageY-t.top),()=>null);let o=j(e.target.ownerDocument,re.POINTER_UP,()=>{this._onColorFlushed.fire(),o.dispose(),this.monitor&&(this.monitor.stopMonitoring(!0),this.monitor=null)},!0)}onDidChangePosition(e,t){let o=Math.max(0,Math.min(1,e/this.width)),n=Math.max(0,Math.min(1,1-t/this.height));this.paintSelection(o,n),this._onDidChange.fire({s:o,v:n})}layout(){this.width=this._domNode.offsetWidth,this.height=this._domNode.offsetHeight,this._canvas.width=this.width*this.pixelRatio,this._canvas.height=this.height*this.pixelRatio,this.paint();let e=this.model.color.hsva;this.paintSelection(e.s,e.v)}paint(){let e=this.model.color.hsva,t=new We(new bO(e.h,1,1,1)),o=this._canvas.getContext("2d"),n=o.createLinearGradient(0,0,this._canvas.width,0);n.addColorStop(0,"rgba(255, 255, 255, 1)"),n.addColorStop(.5,"rgba(255, 255, 255, 0.5)"),n.addColorStop(1,"rgba(255, 255, 255, 0)");let r=o.createLinearGradient(0,0,0,this._canvas.height);r.addColorStop(0,"rgba(0, 0, 0, 0)"),r.addColorStop(1,"rgba(0, 0, 0, 1)"),o.rect(0,0,this._canvas.width,this._canvas.height),o.fillStyle=We.Format.CSS.format(t),o.fill(),o.fillStyle=n,o.fill(),o.fillStyle=r,o.fill()}paintSelection(e,t){this.selection.style.left=`${e*this.width}px`,this.selection.style.top=`${this.height-t*this.height}px`}onDidChangeColor(e){if(this.monitor&&this.monitor.isMonitoring())return;this.paint();let t=e.hsva;this.paintSelection(t.s,t.v)}};var DCt=class extends x{constructor(e){super();this._onClicked=this._register(new E);this.onClicked=this._onClicked.event;this._button=M(e,document.createElement("button")),this._button.classList.add("insert-button"),this._button.textContent="Insert",this._register(j(this._button,re.CLICK,()=>{this._onClicked.fire()}))}get button(){return this._button}};var LCt=class extends x{constructor(e,t,o){super();this.presentationIndex=o;this._onColorFlushed=this._register(new E);this.onColorFlushed=this._onColorFlushed.event;this._onDidChangeColor=this._register(new E);this.onDidChangeColor=this._onDidChangeColor.event;this._onDidChangePresentation=this._register(new E);this.onDidChangePresentation=this._onDidChangePresentation.event;this.originalColor=e,this._color=e,this._colorPresentations=t}get color(){return this._color}set color(e){this._color.equals(e)||(this._color=e,this._onDidChangeColor.fire(e))}get presentation(){return this.colorPresentations[this.presentationIndex]}get colorPresentations(){return this._colorPresentations}set colorPresentations(e){this._colorPresentations=e,this.presentationIndex>e.length-1&&(this.presentationIndex=0),this._onDidChangePresentation.fire(this.presentation)}selectNextColorPresentation(){this.presentationIndex=(this.presentationIndex+1)%this.colorPresentations.length,this.flushColor(),this._onDidChangePresentation.fire(this.presentation)}guessColorPresentation(e,t){let o=-1;for(let n=0;n<this.colorPresentations.length;n++)if(t.toLowerCase()===this.colorPresentations[n].label){o=n;break}if(o===-1){let n=t.split("(")[0].toLowerCase();for(let r=0;r<this.colorPresentations.length;r++)if(this.colorPresentations[r].label.toLowerCase().startsWith(n)){o=r;break}}o!==-1&&o!==this.presentationIndex&&(this.presentationIndex=o,this._onDidChangePresentation.fire(this.presentation))}flushColor(){this._onColorFlushed.fire(this._color)}};async function RCt(a,i,e){let t=a.getValueInRange(i.range),{red:o,green:n,blue:r,alpha:s}=i.color,l=new zt(Math.round(o*255),Math.round(n*255),Math.round(r*255),s),c=new We(l),u=await Usi(a,i,e,Se.None),p=new LCt(c,[],0);return p.colorPresentations=u||[],p.guessColorPresentation(c,t),{range:z.lift(i.range),model:p,provider:e}}function MCt(a,i,e){let t=[],o=e.presentation.textEdit??{range:i,text:e.presentation.label,forceMoveMarkers:!1};t.push(o),e.presentation.additionalTextEdits&&t.push(...e.presentation.additionalTextEdits);let n=z.lift(o.range),r=a.getModel()._setTrackedRange(null,n,3);return a.executeEdits("colorpicker",t),a.pushUndoStop(),a.getModel()._getTrackedRange(r)??n}async function kce(a,i,e,t,o){let n=await Usi(a,{range:t,color:{red:e.rgba.r/255,green:e.rgba.g/255,blue:e.rgba.b/255,alpha:e.rgba.a}},o.provider,Se.None);i.colorPresentations=n||[]}var w3e=_,PCt=class extends x{constructor(e,t,o){super();this.model=t;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._onColorFlushed=this._register(new E);this.onColorFlushed=this._onColorFlushed.event;o==="standalone"?(this.domNode=M(e,w3e(".standalone-strip")),this.overlay=M(this.domNode,w3e(".standalone-overlay"))):(this.domNode=M(e,w3e(".strip")),this.overlay=M(this.domNode,w3e(".overlay"))),this.slider=M(this.domNode,w3e(".slider")),this.slider.style.top="0px",this._register(j(this.domNode,re.POINTER_DOWN,n=>this.onPointerDown(n))),this._register(t.onDidChangeColor(this.onDidChangeColor,this)),this.layout()}layout(){this.height=this.domNode.offsetHeight-this.slider.offsetHeight;let e=this.getValue(this.model.color);this.updateSliderPosition(e)}onDidChangeColor(e){let t=this.getValue(e);this.updateSliderPosition(t)}onPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._register(new $L),o=ir(this.domNode);this.domNode.classList.add("grabbing"),e.target!==this.slider&&this.onDidChangeTop(e.offsetY),t.startMonitoring(e.target,e.pointerId,e.buttons,r=>this.onDidChangeTop(r.pageY-o.top),()=>null);let n=j(e.target.ownerDocument,re.POINTER_UP,()=>{this._onColorFlushed.fire(),n.dispose(),t.stopMonitoring(!0),this.domNode.classList.remove("grabbing")},!0)}onDidChangeTop(e){let t=Math.max(0,Math.min(1,1-e/this.height));this.updateSliderPosition(t),this._onDidChange.fire(t)}updateSliderPosition(e){this.slider.style.top=`${(1-e)*this.height}px`}},ACt=class extends PCt{constructor(i,e,t){super(i,e,t),this.domNode.classList.add("opacity-strip"),this.onDidChangeColor(this.model.color)}onDidChangeColor(i){super.onDidChangeColor(i);let{r:e,g:t,b:o}=i.rgba,n=new We(new zt(e,t,o,1)),r=new We(new zt(e,t,o,0));this.overlay.style.background=`linear-gradient(to bottom, ${n} 0%, ${r} 100%)`}getValue(i){return i.hsva.a}},NCt=class extends PCt{constructor(i,e,t){super(i,e,t),this.domNode.classList.add("hue-strip")}getValue(i){return 1-i.hsva.h/360}};var Czo=_,FCt=class extends x{constructor(e,t,o,n){super();this.model=t;this.pixelRatio=o;this._insertButton=null;this._domNode=Czo(".colorpicker-body"),M(e,this._domNode),this._saturationBox=new _Ct(this._domNode,this.model,this.pixelRatio),this._register(this._saturationBox),this._register(this._saturationBox.onDidChange(this.onDidSaturationValueChange,this)),this._register(this._saturationBox.onColorFlushed(this.flushColor,this)),this._opacityStrip=new ACt(this._domNode,this.model,n),this._register(this._opacityStrip),this._register(this._opacityStrip.onDidChange(this.onDidOpacityChange,this)),this._register(this._opacityStrip.onColorFlushed(this.flushColor,this)),this._hueStrip=new NCt(this._domNode,this.model,n),this._register(this._hueStrip),this._register(this._hueStrip.onDidChange(this.onDidHueChange,this)),this._register(this._hueStrip.onColorFlushed(this.flushColor,this)),n==="standalone"&&(this._insertButton=this._register(new DCt(this._domNode)),this._domNode.classList.add("standalone-colorpicker"))}flushColor(){this.model.flushColor()}onDidSaturationValueChange({s:e,v:t}){let o=this.model.color.hsva;this.model.color=new We(new bO(o.h,e,t,o.a))}onDidOpacityChange(e){let t=this.model.color.hsva;this.model.color=new We(new bO(t.h,t.s,t.v,e))}onDidHueChange(e){let t=this.model.color.hsva,o=(1-e)*360;this.model.color=new We(new bO(o===360?0:o,t.s,t.v,t.a))}get domNode(){return this._domNode}get saturationBox(){return this._saturationBox}get opacityStrip(){return this._opacityStrip}get hueStrip(){return this._hueStrip}get enterButton(){return this._insertButton}layout(){this._saturationBox.layout(),this._opacityStrip.layout(),this._hueStrip.layout()}};var xzo=_,WCt=class extends x{constructor(e){super();this._onClicked=this._register(new E);this.onClicked=this._onClicked.event;this._button=document.createElement("div"),this._button.classList.add("close-button"),M(e,this._button);let t=document.createElement("div");t.classList.add("close-button-inner-div"),M(this._button,t),M(t,xzo(".button"+q.asCSSSelector(Ae("color-picker-close",R.close,d(1041,null))))).classList.add("close-icon"),this._register(j(this._button,re.CLICK,()=>{this._onClicked.fire()}))}};var VCt=_,BCt=class extends x{constructor(e,t,o,n){super();this.model=t;this.type=n;this._closeButton=null;this._domNode=VCt(".colorpicker-header"),M(e,this._domNode),this._pickedColorNode=M(this._domNode,VCt(".picked-color")),M(this._pickedColorNode,VCt("span.codicon.codicon-color-mode")),this._pickedColorPresentation=M(this._pickedColorNode,document.createElement("span")),this._pickedColorPresentation.classList.add("picked-color-presentation");let r=d(1042,null);this._pickedColorNode.setAttribute("title",r),this._originalColorNode=M(this._domNode,VCt(".original-color")),this._originalColorNode.style.backgroundColor=We.Format.CSS.format(this.model.originalColor)||"",this.backgroundColor=o.getColorTheme().getColor(wO)||We.white,this._register(o.onDidColorThemeChange(s=>{this.backgroundColor=s.getColor(wO)||We.white})),this._register(j(this._pickedColorNode,re.CLICK,()=>this.model.selectNextColorPresentation())),this._register(j(this._originalColorNode,re.CLICK,()=>{this.model.color=this.model.originalColor,this.model.flushColor()})),this._register(t.onDidChangeColor(this.onDidChangeColor,this)),this._register(t.onDidChangePresentation(this.onDidChangePresentation,this)),this._pickedColorNode.style.backgroundColor=We.Format.CSS.format(t.color)||"",this._pickedColorNode.classList.toggle("light",t.color.rgba.a<.5?this.backgroundColor.isLighter():t.color.isLighter()),this.onDidChangeColor(this.model.color),this.type==="standalone"&&(this._domNode.classList.add("standalone-colorpicker"),this._closeButton=this._register(new WCt(this._domNode)))}get domNode(){return this._domNode}get closeButton(){return this._closeButton}get pickedColorNode(){return this._pickedColorNode}get originalColorNode(){return this._originalColorNode}onDidChangeColor(e){this._pickedColorNode.style.backgroundColor=We.Format.CSS.format(e)||"",this._pickedColorNode.classList.toggle("light",e.rgba.a<.5?this.backgroundColor.isLighter():e.isLighter()),this.onDidChangePresentation()}onDidChangePresentation(){this._pickedColorPresentation.textContent=this.model.presentation?this.model.presentation.label:""}};var kzo=_,Dxe=class a extends ja{constructor(e,t,o,n,r){super();this.model=t;this.pixelRatio=o;this._register(bu.getInstance(Re(e)).onDidChange(()=>this.layout())),this._domNode=kzo(".colorpicker-widget"),e.appendChild(this._domNode),this.header=this._register(new BCt(this._domNode,this.model,n,r)),this.body=this._register(new FCt(this._domNode,this.model,this.pixelRatio,r))}static{this.ID="editor.contrib.colorPickerWidget"}getId(){return a.ID}layout(){this.body.layout()}get domNode(){return this._domNode}};var HCt=class a{constructor(i,e,t,o){this.owner=i;this.range=e;this.model=t;this.provider=o;this.forceShowAtRange=!0}isValidForHoverAnchor(i){return i.type===1&&this.range.startColumn<=i.range.startColumn&&this.range.endColumn>=i.range.endColumn}static fromBaseColor(i,e){return new a(i,e.range,e.model,e.provider)}},UY=class{constructor(i,e){this._editor=i;this._themeService=e;this.hoverOrdinal=2}computeSync(i,e,t){return[]}computeAsync(i,e,t,o){return fp.fromPromise(this._computeAsync(i,e,t))}async _computeAsync(i,e,t){if(!this._editor.hasModel())return[];if(!this._isValidRequest(t))return[];let o=Iw.get(this._editor);if(!o)return[];for(let n of e){if(!o.isColorDecoration(n))continue;let r=o.getColorData(n.range.getStartPosition());if(r)return[HCt.fromBaseColor(this,await RCt(this._editor.getModel(),r.colorInfo,r.provider))]}return[]}_isValidRequest(i){let e=this._editor.getOption(168);switch(i){case 0:return e==="hover"||e==="clickAndHover";case 1:return e==="click"||e==="clickAndHover";case 2:return!0}}renderHoverParts(i,e){let t=this._editor;if(e.length===0||!t.hasModel())return new ok([]);let o=t.getOption(75)+8;i.setMinimumDimensions(new si(302,o));let n=new N,r=e[0],s=t.getModel(),l=r.model;this._colorPicker=n.add(new Dxe(i.fragment,l,t.getOption(163),this._themeService,"hover"));let c=!1,u=new z(r.range.startLineNumber,r.range.startColumn,r.range.endLineNumber,r.range.endColumn);n.add(l.onColorFlushed(async h=>{await kce(s,l,h,u,r),c=!0,u=MCt(t,u,l)})),n.add(l.onDidChangeColor(h=>{kce(s,l,h,u,r)})),n.add(t.onDidChangeModelContent(h=>{c?c=!1:(i.hide(),t.focus())}));let p={hoverPart:HCt.fromBaseColor(this,r),hoverElement:this._colorPicker.domNode,dispose(){n.dispose()}};return new ok([p])}getAccessibleContent(i){return d(1043,null)}handleResize(){this._colorPicker?.layout()}handleContentsChanged(){this._colorPicker?.layout()}handleHide(){this._colorPicker?.dispose(),this._colorPicker=void 0}isColorPickerVisible(){return!!this._colorPicker}};UY=I([m(1,Le)],UY);function uai(a,i){return!!a[i]}var C3e=class{constructor(i,e){this.target=i.target,this.isLeftClick=i.event.leftButton,this.isMiddleClick=i.event.middleButton,this.isRightClick=i.event.rightButton,this.mouseMiddleClickAction=e.mouseMiddleClickAction,this.hasTriggerModifier=uai(i.event,e.triggerModifier),this.isMiddleClick&&e.mouseMiddleClickAction==="ctrlLeftClick"&&(this.isMiddleClick=!1,this.isLeftClick=!0,this.hasTriggerModifier=!0),this.hasSideBySideModifier=uai(i.event,e.triggerSideBySideModifier),this.isNoneOrSingleMouseDown=i.event.detail<=1}},UCt=class{constructor(i,e){this.keyCodeIsTriggerKey=i.keyCode===e.triggerKey,this.keyCodeIsSideBySideKey=i.keyCode===e.triggerSideBySideKey,this.hasTriggerModifier=uai(i,e.triggerModifier)}},Lxe=class{constructor(i,e,t,o,n){this.mouseMiddleClickAction=n;this.triggerKey=i,this.triggerModifier=e,this.triggerSideBySideKey=t,this.triggerSideBySideModifier=o}equals(i){return this.triggerKey===i.triggerKey&&this.triggerModifier===i.triggerModifier&&this.triggerSideBySideKey===i.triggerSideBySideKey&&this.triggerSideBySideModifier===i.triggerSideBySideModifier&&this.mouseMiddleClickAction===i.mouseMiddleClickAction}};function p7i(a,i){return a==="altKey"?Ze?new Lxe(57,"metaKey",6,"altKey",i):new Lxe(5,"ctrlKey",6,"altKey",i):Ze?new Lxe(6,"altKey",57,"metaKey",i):new Lxe(6,"altKey",5,"ctrlKey",i)}var JO=class extends x{constructor(e,t){super();this._onMouseMoveOrRelevantKeyDown=this._register(new E);this.onMouseMoveOrRelevantKeyDown=this._onMouseMoveOrRelevantKeyDown.event;this._onExecute=this._register(new E);this.onExecute=this._onExecute.event;this._onCancel=this._register(new E);this.onCancel=this._onCancel.event;this._editor=e,this._extractLineNumberFromMouseEvent=t?.extractLineNumberFromMouseEvent??(o=>o.target.position?o.target.position.lineNumber:0),this._opts=p7i(this._editor.getOption(86),this._editor.getOption(87)),this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._lineNumberOnMouseDown=0,this._register(this._editor.onDidChangeConfiguration(o=>{if(o.hasChanged(86)||o.hasChanged(87)){let n=p7i(this._editor.getOption(86),this._editor.getOption(87));if(this._opts.equals(n))return;this._opts=n,this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._lineNumberOnMouseDown=0,this._onCancel.fire()}})),this._register(this._editor.onMouseMove(o=>this._onEditorMouseMove(new C3e(o,this._opts)))),this._register(this._editor.onMouseDown(o=>this._onEditorMouseDown(new C3e(o,this._opts)))),this._register(this._editor.onMouseUp(o=>this._onEditorMouseUp(new C3e(o,this._opts)))),this._register(this._editor.onKeyDown(o=>this._onEditorKeyDown(new UCt(o,this._opts)))),this._register(this._editor.onKeyUp(o=>this._onEditorKeyUp(new UCt(o,this._opts)))),this._register(this._editor.onMouseDrag(()=>this._resetHandler())),this._register(this._editor.onDidChangeCursorSelection(o=>this._onDidChangeCursorSelection(o))),this._register(this._editor.onDidChangeModel(o=>this._resetHandler())),this._register(this._editor.onDidChangeModelContent(()=>this._resetHandler())),this._register(this._editor.onDidScrollChange(o=>{(o.scrollTopChanged||o.scrollLeftChanged)&&this._resetHandler()}))}_onDidChangeCursorSelection(e){e.selection&&e.selection.startColumn!==e.selection.endColumn&&this._resetHandler()}_onEditorMouseMove(e){this._lastMouseMoveEvent=e,this._onMouseMoveOrRelevantKeyDown.fire([e,null])}_onEditorMouseDown(e){this._hasTriggerKeyOnMouseDown=e.hasTriggerModifier,this._lineNumberOnMouseDown=this._extractLineNumberFromMouseEvent(e)}_onEditorMouseUp(e){let t=this._extractLineNumberFromMouseEvent(e);this._lineNumberOnMouseDown&&this._lineNumberOnMouseDown===t&&(this._hasTriggerKeyOnMouseDown||e.isMiddleClick&&e.mouseMiddleClickAction==="openLink")&&this._onExecute.fire(e)}_onEditorKeyDown(e){this._lastMouseMoveEvent&&(e.keyCodeIsTriggerKey||e.keyCodeIsSideBySideKey&&e.hasTriggerModifier)?this._onMouseMoveOrRelevantKeyDown.fire([this._lastMouseMoveEvent,e]):e.hasTriggerModifier&&this._onCancel.fire()}_onEditorKeyUp(e){e.keyCodeIsTriggerKey&&this._onCancel.fire()}_resetHandler(){this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._onCancel.fire()}};var x3e=class{constructor(i,e){this.range=i;this.direction=e}},pai=class a{constructor(i,e,t){this.hint=i;this.anchor=e;this.provider=t;this._isResolved=!1}with(i){let e=new a(this.hint,i.anchor,this.provider);return e._isResolved=this._isResolved,e._currentResolve=this._currentResolve,e}async resolve(i){if(typeof this.provider.resolveInlayHint=="function"){if(this._currentResolve)return await this._currentResolve,i.isCancellationRequested?void 0:this.resolve(i);this._isResolved||(this._currentResolve=this._doResolve(i).finally(()=>this._currentResolve=void 0)),await this._currentResolve}}async _doResolve(i){try{let e=await Promise.resolve(this.provider.resolveInlayHint(this.hint,i));this.hint.tooltip=e?.tooltip??this.hint.tooltip,this.hint.label=e?.label??this.hint.label,this.hint.textEdits=e?.textEdits??this.hint.textEdits,this._isResolved=!0}catch(e){ys(e),this._isResolved=!1}}},k3e=class a{constructor(i,e,t){this._disposables=new N;this.ranges=i,this.provider=new Set;let o=[];for(let[n,r]of e){this._disposables.add(n),this.provider.add(r);for(let s of n.hints){let l=t.validatePosition(s.position),c="before",u=a._getRangeAtPosition(t,l),p;u.getStartPosition().isBefore(l)?(p=z.fromPositions(u.getStartPosition(),l),c="after"):(p=z.fromPositions(l,u.getEndPosition()),c="before"),o.push(new pai(s,new x3e(p,c),r))}}this.items=o.sort((n,r)=>ye.compare(n.hint.position,r.hint.position))}static{this._emptyInlayHintList=Object.freeze({dispose(){},hints:[]})}static async create(i,e,t,o){let n=[],r=i.ordered(e).reverse().map(s=>t.map(async l=>{try{let c=await s.provideInlayHints(e,l,o);(c?.hints.length||s.onDidChangeInlayHints)&&n.push([c??a._emptyInlayHintList,s])}catch(c){ys(c)}}));if(await Promise.all(r.flat()),o.isCancellationRequested||e.isDisposed())throw new go;return new a(t,n,e)}dispose(){this._disposables.dispose()}static _getRangeAtPosition(i,e){let t=e.lineNumber,o=i.getWordAtPosition(e);if(o)return new z(t,o.startColumn,t,o.endColumn);i.tokenization.tokenizeIfCheap(t);let n=i.tokenization.getLineTokens(t),r=e.column-1,s=n.findTokenIndexAtOffset(r),l=n.getStartOffset(s),c=n.getEndOffset(s);return c-l===1&&(l===r&&s>1?(l=n.getStartOffset(s-1),c=n.getEndOffset(s-1)):c===r&&s<n.getCount()-1&&(l=n.getStartOffset(s+1),c=n.getEndOffset(s+1))),new z(t,l+1,t,c+1)}};function zCt(a){return fc(a.id,...a.arguments??[]).toString()}var id=class extends Xr{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f){super(i,{...o.getRawOptions(),overflowWidgetsDomNode:o.getOverflowWidgetsDomNode()},t,n,r,s,l,c,u,p,h,g,f),this._parentEditor=o,this._overwriteOptions=e,super.updateOptions(this._overwriteOptions),this._register(o.onDidChangeConfiguration(v=>this._onParentConfigurationChanged(v)))}getParentEditor(){return this._parentEditor}_onParentConfigurationChanged(i){super.updateOptions(this._parentEditor.getRawOptions()),super.updateOptions(this._overwriteOptions)}updateOptions(i){Xu(this._overwriteOptions,i,!0),super.updateOptions(this._overwriteOptions)}};id=I([m(4,F),m(5,qt),m(6,ge),m(7,X),m(8,Le),m(9,Ne),m(10,Oi),m(11,Rs),m(12,Qt),m(13,_C)],id);function Rxe(a){let i=a.get(qt).getFocusedCodeEditor();return i instanceof id?i.getParentEditor():i}var m7i=new We(new zt(0,122,204)),Ezo={showArrow:!0,showFrame:!0,className:"",frameColor:m7i,arrowColor:m7i,keepEditorSelection:!1},Tzo="vs.editor.contrib.zoneWidget",mai=class{constructor(i,e,t,o,n,r,s,l){this.id="";this.domNode=i,this.afterLineNumber=e,this.afterColumn=t,this.heightInLines=o,this.showInHiddenAreas=s,this.ordinal=l,this._onDomNodeTop=n,this._onComputedHeight=r}onDomNodeTop(i){this._onDomNodeTop(i)}onComputedHeight(i){this._onComputedHeight(i)}},hai=class{constructor(i,e){this._id=i,this._domNode=e}getId(){return this._id}getDomNode(){return this._domNode}getPosition(){return null}},gai=class a{constructor(i){this._editor=i;this._ruleName=a._IdGenerator.nextId();this._color=null;this._height=-1;this._decorations=this._editor.createDecorationsCollection()}static{this._IdGenerator=new qle(".arrow-decoration-")}dispose(){this.hide(),IO(this._ruleName)}set color(i){this._color!==i&&(this._color=i,this._updateStyle())}set height(i){this._height!==i&&(this._height=i,this._updateStyle())}_updateStyle(){IO(this._ruleName),$h(`.monaco-editor ${this._ruleName}`,`border-style: solid; border-color: transparent; border-bottom-color: ${this._color}; border-width: ${this._height}px; bottom: -${this._height}px !important; margin-left: -${this._height}px; `)}show(i){i.column===1&&(i={lineNumber:i.lineNumber,column:2}),this._decorations.set([{range:z.fromPositions(i),options:{description:"zone-widget-arrow",className:this._ruleName,stickiness:1}}])}hide(){this._decorations.clear()}},ZO=class{constructor(i,e={}){this._arrow=null;this._overlayWidget=null;this._resizeSash=null;this._isSashResizeHeight=!1;this._viewZone=null;this._disposables=new N;this.container=null;this._isShowing=!1;this.editor=i,this._positionMarkerId=this.editor.createDecorationsCollection(),this.options=Ji(e),Xu(this.options,Ezo,!1),this.domNode=document.createElement("div"),this.options.isAccessible||(this.domNode.setAttribute("aria-hidden","true"),this.domNode.setAttribute("role","presentation")),this._disposables.add(this.editor.onDidLayoutChange(t=>{let o=this._getWidth(t);this.domNode.style.width=o+"px",this.domNode.style.left=this._getLeft(t)+"px",this._onWidth(o)}))}dispose(){this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),this._viewZone&&this.editor.changeViewZones(i=>{this._viewZone&&i.removeZone(this._viewZone.id),this._viewZone=null}),this._positionMarkerId.clear(),this._disposables.dispose()}create(){this.domNode.classList.add("zone-widget"),this.options.className&&this.domNode.classList.add(this.options.className),this.container=document.createElement("div"),this.container.classList.add("zone-widget-container"),this.domNode.appendChild(this.container),this.options.showArrow&&(this._arrow=new gai(this.editor),this._disposables.add(this._arrow)),this._fillContainer(this.container),this._initSash(),this._applyStyles()}style(i){i.frameColor&&(this.options.frameColor=i.frameColor),i.arrowColor&&(this.options.arrowColor=i.arrowColor),this._applyStyles()}_applyStyles(){if(this.container&&this.options.frameColor){let i=this.options.frameColor.toString();this.container.style.borderTopColor=i,this.container.style.borderBottomColor=i}if(this._arrow&&this.options.arrowColor){let i=this.options.arrowColor.toString();this._arrow.color=i}}_getWidth(i){return i.width-i.minimap.minimapWidth-i.verticalScrollbarWidth}_getLeft(i){return i.minimap.minimapWidth>0&&i.minimap.minimapLeft===0?i.minimap.minimapWidth:0}_onViewZoneTop(i){this.domNode.style.top=i+"px"}_onViewZoneHeight(i){if(this.domNode.style.height=`${i}px`,this.container){let e=i-this._decoratingElementsHeight();this.container.style.height=`${e}px`;let t=this.editor.getLayoutInfo();this._doLayout(e,this._getWidth(t))}this._resizeSash?.layout()}get position(){let i=this._positionMarkerId.getRange(0);if(i)return i.getStartPosition()}hasFocus(){return this.domNode.contains(Nn())}show(i,e){let t=z.isIRange(i)?z.lift(i):z.fromPositions(i);this._isShowing=!0,this._showImpl(t,e),this._isShowing=!1,this._positionMarkerId.set([{range:t,options:mo.EMPTY}])}updatePositionAndHeight(i,e){this._viewZone&&(i=z.isIRange(i)?z.getStartPosition(i):i,this._viewZone.afterLineNumber=i.lineNumber,this._viewZone.afterColumn=i.column,this._viewZone.heightInLines=e??this._viewZone.heightInLines,this.editor.changeViewZones(t=>{t.layoutZone(this._viewZone.id)}),this._positionMarkerId.set([{range:z.isIRange(i)?i:z.fromPositions(i),options:mo.EMPTY}]),this._updateSashEnablement())}hide(){this._viewZone&&(this.editor.changeViewZones(i=>{this._viewZone&&i.removeZone(this._viewZone.id)}),this._viewZone=null),this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),this._arrow?.hide(),this._positionMarkerId.clear(),this._isSashResizeHeight=!1}_decoratingElementsHeight(){let i=this.editor.getOption(75),e=0;if(this.options.showArrow){let t=Math.round(i/3);e+=2*t}if(this.options.showFrame){let t=this.options.frameWidth??Math.round(i/9);e+=2*t}return e}_getMaximumHeightInLines(){return Math.max(12,this.editor.getLayoutInfo().height/this.editor.getOption(75)*.8)}_showImpl(i,e){let t=i.getStartPosition(),o=this.editor.getLayoutInfo(),n=this._getWidth(o);this.domNode.style.width=`${n}px`,this.domNode.style.left=this._getLeft(o)+"px";let r=document.createElement("div");r.style.overflow="hidden";let s=this.editor.getOption(75),l=this._getMaximumHeightInLines();l!==void 0&&(e=Math.min(e,l));let c=0,u=0;if(this._arrow&&this.options.showArrow&&(c=Math.round(s/3),this._arrow.height=c,this._arrow.show(t)),this.options.showFrame&&(u=Math.round(s/9)),this.editor.changeViewZones(g=>{this._viewZone&&g.removeZone(this._viewZone.id),this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),this.domNode.style.top="-1000px",this._viewZone=new mai(r,t.lineNumber,t.column,e,f=>this._onViewZoneTop(f),f=>this._onViewZoneHeight(f),this.options.showInHiddenAreas,this.options.ordinal),this._viewZone.id=g.addZone(this._viewZone),this._overlayWidget=new hai(Tzo+this._viewZone.id,this.domNode),this.editor.addOverlayWidget(this._overlayWidget)}),this._updateSashEnablement(),this.container&&this.options.showFrame){let g=this.options.frameWidth?this.options.frameWidth:u;this.container.style.borderTopWidth=g+"px",this.container.style.borderBottomWidth=g+"px"}let p=e*s-this._decoratingElementsHeight();this.container&&(this.container.style.top=c+"px",this.container.style.height=p+"px",this.container.style.overflow="hidden"),this._doLayout(p,n),this.options.keepEditorSelection||this.editor.setSelection(i);let h=this.editor.getModel();if(h){let g=h.validateRange(new z(i.startLineNumber,1,i.endLineNumber+1,1));this.revealRange(g,g.startLineNumber===h.getLineCount())}}revealRange(i,e){e?this.editor.revealLineNearTop(i.endLineNumber,0):this.editor.revealRange(i,0)}setCssClass(i,e){this.container&&(e&&this.container.classList.remove(e),this.container.classList.add(i))}_onWidth(i){}_doLayout(i,e){}_relayout(i,e){let t=this._getMaximumHeightInLines(),o=e&&t!==void 0?Math.min(t,i):i;this._viewZone&&this._viewZone.heightInLines!==o&&(this.editor.changeViewZones(n=>{this._viewZone&&(this._viewZone.heightInLines=o,n.layoutZone(this._viewZone.id))}),this._updateSashEnablement())}_initSash(){if(this._resizeSash)return;this._resizeSash=this._disposables.add(new Jh(this.domNode,this,{orientation:1})),this.options.isResizeable||(this._resizeSash.state=0);let i;this._disposables.add(this._resizeSash.onDidStart(e=>{this._viewZone&&(i={startY:e.startY,heightInLines:this._viewZone.heightInLines,...this._getResizeBounds()})})),this._disposables.add(this._resizeSash.onDidEnd(()=>{i=void 0})),this._disposables.add(this._resizeSash.onDidChange(e=>{if(i){let t=(e.currentY-i.startY)/this.editor.getOption(75),o=t<0?Math.ceil(t):Math.floor(t),n=i.heightInLines+o;n>i.minLines&&n<i.maxLines&&(this._isSashResizeHeight=!0,this._relayout(n))}}))}_updateSashEnablement(){if(this._resizeSash){let{minLines:i,maxLines:e}=this._getResizeBounds();this._resizeSash.state=i===e?0:3}}get _usesResizeHeight(){return this._isSashResizeHeight}_getResizeBounds(){return{minLines:5,maxLines:35}}getHorizontalSashLeft(){return 0}getHorizontalSashTop(){return(this.domNode.style.height===null?0:parseInt(this.domNode.style.height))-this._decoratingElementsHeight()/2}getHorizontalSashWidth(){let i=this.editor.getLayoutInfo();return i.width-i.minimap.minimapWidth}};var u5=le("IPeekViewService");Ee(u5,class{constructor(){this._widgets=new Map}addExclusiveWidget(a,i){let e=this._widgets.get(a);e&&(e.listener.dispose(),e.widget.dispose());let t=()=>{let o=this._widgets.get(a);o&&o.widget===i&&(o.listener.dispose(),this._widgets.delete(a))};this._widgets.set(a,{widget:i,listener:i.onDidClose(t)})}},1);var tg;(e=>(e.inPeekEditor=new Y("inReferenceSearchEditor",!0,d(1479,null)),e.notInPeekEditor=e.inPeekEditor.toNegated()))(tg||={});var Mxe=class{static{this.ID="editor.contrib.referenceController"}constructor(i,e){i instanceof id&&tg.inPeekEditor.bindTo(e)}dispose(){}};Mxe=I([m(1,X)],Mxe);xo(Mxe.ID,Mxe,0);var _zo={headerBackgroundColor:We.white,primaryHeadingColor:We.fromHex("#333333"),secondaryHeadingColor:We.fromHex("#6c6c6cb3")},GE=class extends ZO{constructor(e,t,o){super(e,t);this.instantiationService=o;this._onDidClose=new E;this.onDidClose=this._onDidClose.event;Xu(this.options,_zo,!1);let n=gs(this.editor);n.openedPeekWidgets.set(n.openedPeekWidgets.get()+1,void 0)}dispose(){if(!this.disposed){this.disposed=!0,super.dispose(),this._onDidClose.fire(this),this._onDidClose.dispose();let e=gs(this.editor);e.openedPeekWidgets.set(e.openedPeekWidgets.get()-1,void 0)}}style(e){let t=this.options;e.headerBackgroundColor&&(t.headerBackgroundColor=e.headerBackgroundColor),e.primaryHeadingColor&&(t.primaryHeadingColor=e.primaryHeadingColor),e.secondaryHeadingColor&&(t.secondaryHeadingColor=e.secondaryHeadingColor),super.style(e)}_applyStyles(){super._applyStyles();let e=this.options;this._headElement&&e.headerBackgroundColor&&(this._headElement.style.backgroundColor=e.headerBackgroundColor.toString()),this._primaryHeading&&e.primaryHeadingColor&&(this._primaryHeading.style.color=e.primaryHeadingColor.toString()),this._secondaryHeading&&e.secondaryHeadingColor&&(this._secondaryHeading.style.color=e.secondaryHeadingColor.toString()),this._bodyElement&&e.frameColor&&(this._bodyElement.style.borderColor=e.frameColor.toString())}_fillContainer(e){this.setCssClass("peekview-widget"),this._headElement=_(".head"),this._bodyElement=_(".body"),this._fillHead(this._headElement),this._fillBody(this._bodyElement),e.appendChild(this._headElement),e.appendChild(this._bodyElement)}_fillHead(e,t){this._titleElement=_(".peekview-title"),this.options.supportOnTitleClick&&(this._titleElement.classList.add("clickable"),Jo(this._titleElement,"click",r=>this._onTitleClick(r))),M(this._headElement,this._titleElement),this._fillTitleIcon(this._titleElement),this._primaryHeading=_("span.filename"),this._secondaryHeading=_("span.dirname"),this._metaHeading=_("span.meta"),M(this._titleElement,this._primaryHeading,this._secondaryHeading,this._metaHeading);let o=_(".peekview-actions");M(this._headElement,o);let n=this._getActionBarOptions();this._actionbarWidget=new Zi(o,n),this._disposables.add(this._actionbarWidget),t||this._actionbarWidget.push(this._disposables.add(new it("peekview.close",d(1480,null),q.asClassName(R.close),!0,()=>(this.dispose(),Promise.resolve()))),{label:!1,icon:!0})}_fillTitleIcon(e){}_getActionBarOptions(){return{actionViewItemProvider:Bs.bind(void 0,this.instantiationService),orientation:0}}_onTitleClick(e){}setTitle(e,t){this._primaryHeading&&this._secondaryHeading&&(this._primaryHeading.innerText=e,this._primaryHeading.setAttribute("title",e),t?this._secondaryHeading.innerText=t:Rt(this._secondaryHeading))}setMetaTitle(e){this._metaHeading&&(e?(this._metaHeading.innerText=e,un(this._metaHeading)):vo(this._metaHeading))}_doLayout(e,t){if(!this._isShowing&&e<0){this.dispose();return}let o=Math.ceil(this.editor.getOption(75)*1.2),n=Math.round(e-(o+1));this._doLayoutHead(o,t),this._doLayoutBody(n,t)}_doLayoutHead(e,t){this._headElement&&(this._headElement.style.height=`${e}px`,this._headElement.style.lineHeight=this._headElement.style.height)}_doLayoutBody(e,t){this._bodyElement&&(this._bodyElement.style.height=`${e}px`)}};GE=I([m(2,F)],GE);var JV=te("peekViewTitle.background",{dark:"#252526",light:"#F3F3F3",hcDark:We.black,hcLight:We.white},d(1494,null)),eF=te("peekViewTitleLabel.foreground",{dark:We.white,light:We.black,hcDark:We.white,hcLight:Id},d(1495,null)),tF=te("peekViewTitleDescription.foreground",{dark:"#ccccccb3",light:"#616161",hcDark:"#FFFFFF99",hcLight:"#292929"},d(1496,null)),K_=te("peekView.border",{dark:Dm,light:Dm,hcDark:bi,hcLight:bi},d(1481,null)),zY=te("peekViewResult.background",{dark:"#252526",light:"#F3F3F3",hcDark:We.black,hcLight:We.white},d(1488,null)),RQr=te("peekViewResult.lineForeground",{dark:"#bbbbbb",light:"#646465",hcDark:We.white,hcLight:Id},d(1490,null)),MQr=te("peekViewResult.fileForeground",{dark:We.white,light:"#1E1E1E",hcDark:We.white,hcLight:Id},d(1489,null)),PQr=te("peekViewResult.selectionBackground",{dark:"#3399ff33",light:"#3399ff33",hcDark:null,hcLight:null},d(1492,null)),AQr=te("peekViewResult.selectionForeground",{dark:We.white,light:"#6C6C6C",hcDark:We.white,hcLight:Id},d(1493,null)),fai=te("peekViewEditor.background",{dark:"#001F33",light:"#F2F8FC",hcDark:We.black,hcLight:We.white},d(1482,null)),NQr=te("peekViewEditorGutter.background",fai,d(1483,null)),OQr=te("peekViewEditorStickyScroll.background",fai,d(1486,null)),FQr=te("peekViewEditorStickyScrollGutter.background",fai,d(1487,null)),WQr=te("peekViewResult.matchHighlightBackground",{dark:"#ea5c004d",light:"#ea5c004d",hcDark:null,hcLight:null},d(1491,null)),KCt=te("peekViewEditor.matchHighlightBackground",{dark:"#ff8f0099",light:"#f5d802de",hcDark:null,hcLight:null},d(1484,null)),VQr=te("peekViewEditor.matchHighlightBorder",{dark:null,light:null,hcDark:Ys,hcLight:Ys},d(1485,null));var bai=class{constructor(i,e){this.renderer=i;this.modelProvider=e}get templateId(){return this.renderer.templateId}renderTemplate(i){return{data:this.renderer.renderTemplate(i),disposable:x.None}}renderElement(i,e,t,o){if(t.disposable?.dispose(),!t.data)return;let n=this.modelProvider();if(n.isResolved(i))return this.renderer.renderElement(n.get(i),i,t.data,o);let r=new Ye,s=n.resolve(i,r.token);t.disposable={dispose:()=>r.cancel()},this.renderer.renderPlaceholder(i,t.data),s.then(l=>this.renderer.renderElement(l,i,t.data,o))}disposeTemplate(i){i.disposable&&(i.disposable.dispose(),i.disposable=void 0),i.data&&(this.renderer.disposeTemplate(i.data),i.data=void 0)}},Sai=class{constructor(i,e){this.modelProvider=i;this.accessibilityProvider=e}getWidgetAriaLabel(){return this.accessibilityProvider.getWidgetAriaLabel()}getAriaLabel(i){let e=this.modelProvider();return e.isResolved(i)?this.accessibilityProvider.getAriaLabel(e.get(i)):null}};function Dzo(a,i){return{...i,accessibilityProvider:i.accessibilityProvider&&new Sai(a,i.accessibilityProvider)}}var qz=class{constructor(i,e,t,o,n={}){this.modelDisposables=new N;let r=()=>this.model,s=o.map(l=>new bai(l,r));this.list=new Cc(i,e,t,s,Dzo(r,n))}updateOptions(i){this.list.updateOptions(i)}getHTMLElement(){return this.list.getHTMLElement()}isDOMFocused(){return wa(this.getHTMLElement())}domFocus(){this.list.domFocus()}get onDidFocus(){return this.list.onDidFocus}get onDidBlur(){return this.list.onDidBlur}get widget(){return this.list}get onDidDispose(){return this.list.onDidDispose}get onMouseClick(){return U.map(this.list.onMouseClick,({element:i,index:e,browserEvent:t})=>({element:i===void 0?void 0:this._model.get(i),index:e,browserEvent:t}))}get onMouseDblClick(){return U.map(this.list.onMouseDblClick,({element:i,index:e,browserEvent:t})=>({element:i===void 0?void 0:this._model.get(i),index:e,browserEvent:t}))}get onTap(){return U.map(this.list.onTap,({element:i,index:e,browserEvent:t})=>({element:i===void 0?void 0:this._model.get(i),index:e,browserEvent:t}))}get onPointer(){return U.map(this.list.onPointer,({element:i,index:e,browserEvent:t})=>({element:i===void 0?void 0:this._model.get(i),index:e,browserEvent:t}))}get onDidChangeFocus(){return U.map(this.list.onDidChangeFocus,({elements:i,indexes:e,browserEvent:t})=>({elements:i.map(o=>this._model.get(o)),indexes:e,browserEvent:t}))}get onDidChangeSelection(){return U.map(this.list.onDidChangeSelection,({elements:i,indexes:e,browserEvent:t})=>({elements:i.map(o=>this._model.get(o)),indexes:e,browserEvent:t}))}get onContextMenu(){return U.map(this.list.onContextMenu,({element:i,index:e,anchor:t,browserEvent:o})=>typeof i>"u"?{element:i,index:e,anchor:t,browserEvent:o}:{element:this._model.get(i),index:e,anchor:t,browserEvent:o})}get model(){return this._model}set model(i){this.modelDisposables.clear(),this._model=i,this.list.splice(0,this.list.length,Ig(i.length)),this.modelDisposables.add(i.onDidIncrementLength(e=>this.list.splice(this.list.length,0,Ig(this.list.length,e))))}get length(){return this.list.length}get scrollTop(){return this.list.scrollTop}set scrollTop(i){this.list.scrollTop=i}get scrollLeft(){return this.list.scrollLeft}set scrollLeft(i){this.list.scrollLeft=i}setAnchor(i){this.list.setAnchor(i)}getAnchor(){return this.list.getAnchor()}setFocus(i){this.list.setFocus(i)}focusNext(i,e){this.list.focusNext(i,e)}focusPrevious(i,e){this.list.focusPrevious(i,e)}focusNextPage(){return this.list.focusNextPage()}focusPreviousPage(){return this.list.focusPreviousPage()}focusLast(){this.list.focusLast()}focusFirst(){this.list.focusFirst()}getFocus(){return this.list.getFocus()}setSelection(i,e){this.list.setSelection(i,e)}getSelection(){return this.list.getSelection()}getSelectedElements(){return this.getSelection().map(i=>this.model.get(i))}layout(i,e){this.list.layout(i,e)}triggerTypeNavigation(){this.list.triggerTypeNavigation()}reveal(i,e){this.list.reveal(i,e)}style(i){this.list.style(i)}dispose(){this.list.dispose(),this.modelDisposables.dispose()}};var Lzo={separatorBorder:We.transparent};var GCt=class{constructor(i,e,t,o){this.container=i;this.view=e;this.disposable=o;this._cachedVisibleSize=void 0;typeof t=="number"?(this._size=t,this._cachedVisibleSize=void 0,i.classList.add("visible")):(this._size=0,this._cachedVisibleSize=t.cachedVisibleSize)}set size(i){this._size=i}get size(){return this._size}get cachedVisibleSize(){return this._cachedVisibleSize}get visible(){return typeof this._cachedVisibleSize>"u"}setVisible(i,e){if(i!==this.visible){i?(this.size=Bn(this._cachedVisibleSize,this.viewMinimumSize,this.viewMaximumSize),this._cachedVisibleSize=void 0):(this._cachedVisibleSize=typeof e=="number"?e:this.size,this.size=0),this.container.classList.toggle("visible",i);try{this.view.setVisible?.(i)}catch(t){console.error("Splitview: Failed to set visible view"),console.error(t)}}}get minimumSize(){return this.visible?this.view.minimumSize:0}get viewMinimumSize(){return this.view.minimumSize}get maximumSize(){return this.visible?this.view.maximumSize:0}get viewMaximumSize(){return this.view.maximumSize}get priority(){return this.view.priority}get proportionalLayout(){return this.view.proportionalLayout??!0}get snap(){return!!this.view.snap}set enabled(i){this.container.style.pointerEvents=i?"":"none"}layout(i,e){this.layoutContainer(i);try{this.view.layout(this.size,i,e)}catch(t){console.error("Splitview: Failed to layout view"),console.error(t)}}dispose(){this.disposable.dispose()}},Iai=class extends GCt{layoutContainer(i){this.container.style.top=`${i}px`,this.container.style.height=`${this.size}px`}},yai=class extends GCt{layoutContainer(i){this.container.style.left=`${i}px`,this.container.style.width=`${this.size}px`}};var Gl;(o=>{o.Distribute={type:"distribute"};function i(n){return{type:"split",index:n}}o.Split=i;function e(n){return{type:"auto",index:n}}o.Auto=e;function t(n){return{type:"invisible",cachedVisibleSize:n}}o.Invisible=t})(Gl||={});var Ou=class extends x{constructor(e,t={}){super();this.size=0;this._contentSize=0;this.proportions=void 0;this.viewItems=[];this.sashItems=[];this.state=0;this._onDidSashChange=this._register(new E);this._onDidSashReset=this._register(new E);this._startSnappingEnabled=!0;this._endSnappingEnabled=!0;this.onDidSashChange=this._onDidSashChange.event;this.onDidSashReset=this._onDidSashReset.event;this.orientation=t.orientation??0,this.inverseAltBehavior=t.inverseAltBehavior??!1,this.proportionalLayout=t.proportionalLayout??!0,this.getSashOrthogonalSize=t.getSashOrthogonalSize,this.el=document.createElement("div"),this.el.classList.add("monaco-split-view2"),this.el.classList.add(this.orientation===0?"vertical":"horizontal"),e.appendChild(this.el),this.sashContainer=M(this.el,_(".sash-container")),this.viewContainer=_(".split-view-container"),this.scrollable=this._register(new y_({forceIntegerValues:!0,smoothScrollDuration:125,scheduleAtNextAnimationFrame:n=>Wr(Re(this.el),n)})),this.scrollableElement=this._register(new _O(this.viewContainer,{vertical:this.orientation===0?t.scrollbarVisibility??1:2,horizontal:this.orientation===1?t.scrollbarVisibility??1:2},this.scrollable));let o=this._register(new Gn(this.viewContainer,"scroll")).event;this._register(o(n=>{let r=this.scrollableElement.getScrollPosition(),s=Math.abs(this.viewContainer.scrollLeft-r.scrollLeft)<=1?void 0:this.viewContainer.scrollLeft,l=Math.abs(this.viewContainer.scrollTop-r.scrollTop)<=1?void 0:this.viewContainer.scrollTop;(s!==void 0||l!==void 0)&&this.scrollableElement.setScrollPosition({scrollLeft:s,scrollTop:l})})),this.onDidScroll=this.scrollableElement.onScroll,this._register(this.onDidScroll(n=>{n.scrollTopChanged&&(this.viewContainer.scrollTop=n.scrollTop),n.scrollLeftChanged&&(this.viewContainer.scrollLeft=n.scrollLeft)})),M(this.el,this.scrollableElement.getDomNode()),this.style(t.styles||Lzo),t.descriptor&&(this.size=t.descriptor.size,t.descriptor.views.forEach((n,r)=>{let s=gn(n.visible)||n.visible?n.size:{type:"invisible",cachedVisibleSize:n.size},l=n.view;this.doAddView(l,s,r,!0)}),this._contentSize=this.viewItems.reduce((n,r)=>n+r.size,0),this.saveProportions())}get contentSize(){return this._contentSize}get length(){return this.viewItems.length}get minimumSize(){return this.viewItems.reduce((e,t)=>e+t.minimumSize,0)}get maximumSize(){return this.length===0?Number.POSITIVE_INFINITY:this.viewItems.reduce((e,t)=>e+t.maximumSize,0)}get orthogonalStartSash(){return this._orthogonalStartSash}get orthogonalEndSash(){return this._orthogonalEndSash}get startSnappingEnabled(){return this._startSnappingEnabled}get endSnappingEnabled(){return this._endSnappingEnabled}set orthogonalStartSash(e){for(let t of this.sashItems)t.sash.orthogonalStartSash=e;this._orthogonalStartSash=e}set orthogonalEndSash(e){for(let t of this.sashItems)t.sash.orthogonalEndSash=e;this._orthogonalEndSash=e}get sashes(){return this.sashItems.map(e=>e.sash)}set startSnappingEnabled(e){this._startSnappingEnabled!==e&&(this._startSnappingEnabled=e,this.updateSashEnablement())}set endSnappingEnabled(e){this._endSnappingEnabled!==e&&(this._endSnappingEnabled=e,this.updateSashEnablement())}style(e){e.separatorBorder.isTransparent()?(this.el.classList.remove("separator-border"),this.el.style.removeProperty("--separator-border")):(this.el.classList.add("separator-border"),this.el.style.setProperty("--separator-border",e.separatorBorder.toString()))}addView(e,t,o=this.viewItems.length,n){this.doAddView(e,t,o,n)}removeView(e,t){if(e<0||e>=this.viewItems.length)throw new Error("Index out of bounds");if(this.state!==0)throw new Error("Cant modify splitview");this.state=1;try{t?.type==="auto"&&(this.areViewsDistributed()?t={type:"distribute"}:t={type:"split",index:t.index});let o=t?.type==="split"?this.viewItems[t.index]:void 0,n=this.viewItems.splice(e,1)[0];if(o&&(o.size+=n.size),this.viewItems.length>=1){let s=Math.max(e-1,0);this.sashItems.splice(s,1)[0].disposable.dispose()}this.relayout(),t?.type==="distribute"&&this.distributeViewSizes();let r=n.view;return n.dispose(),r}finally{this.state=0}}removeAllViews(){if(this.state!==0)throw new Error("Cant modify splitview");this.state=1;try{let e=this.viewItems.splice(0,this.viewItems.length);for(let o of e)o.dispose();let t=this.sashItems.splice(0,this.sashItems.length);for(let o of t)o.disposable.dispose();return this.relayout(),e.map(o=>o.view)}finally{this.state=0}}moveView(e,t){if(this.state!==0)throw new Error("Cant modify splitview");let o=this.getViewCachedVisibleSize(e),n=typeof o>"u"?this.getViewSize(e):Gl.Invisible(o),r=this.removeView(e);this.addView(r,n,t)}swapViews(e,t){if(this.state!==0)throw new Error("Cant modify splitview");if(e>t)return this.swapViews(t,e);let o=this.getViewSize(e),n=this.getViewSize(t),r=this.removeView(t),s=this.removeView(e);this.addView(r,o,e),this.addView(s,n,t)}isViewVisible(e){if(e<0||e>=this.viewItems.length)throw new Error("Index out of bounds");return this.viewItems[e].visible}setViewVisible(e,t){if(e<0||e>=this.viewItems.length)throw new Error("Index out of bounds");this.viewItems[e].setVisible(t),this.distributeEmptySpace(e),this.layoutViews(),this.saveProportions()}getViewCachedVisibleSize(e){if(e<0||e>=this.viewItems.length)throw new Error("Index out of bounds");return this.viewItems[e].cachedVisibleSize}layout(e,t){let o=Math.max(this.size,this._contentSize);if(this.size=e,this.layoutContext=t,this.proportions){let n=0;for(let r=0;r<this.viewItems.length;r++){let s=this.viewItems[r],l=this.proportions[r];typeof l=="number"?n+=l:e-=s.size}for(let r=0;r<this.viewItems.length;r++){let s=this.viewItems[r],l=this.proportions[r];typeof l=="number"&&n>0&&(s.size=Bn(Math.round(l*e/n),s.minimumSize,s.maximumSize))}}else{let n=Ig(this.viewItems.length),r=n.filter(l=>this.viewItems[l].priority===1),s=n.filter(l=>this.viewItems[l].priority===2);this.resize(this.viewItems.length-1,e-o,void 0,r,s)}this.distributeEmptySpace(),this.layoutViews()}saveProportions(){this.proportionalLayout&&this._contentSize>0&&(this.proportions=this.viewItems.map(e=>e.proportionalLayout&&e.visible?e.size/this._contentSize:void 0))}onSashStart({sash:e,start:t,alt:o}){for(let l of this.viewItems)l.enabled=!1;let n=this.sashItems.findIndex(l=>l.sash===e),r=wn(j(this.el.ownerDocument.body,"keydown",l=>s(this.sashDragState.current,l.altKey)),j(this.el.ownerDocument.body,"keyup",()=>s(this.sashDragState.current,!1))),s=(l,c)=>{let u=this.viewItems.map(v=>v.size),p=Number.NEGATIVE_INFINITY,h=Number.POSITIVE_INFINITY;if(this.inverseAltBehavior&&(c=!c),c)if(n===this.sashItems.length-1){let b=this.viewItems[n];p=(b.minimumSize-b.size)/2,h=(b.maximumSize-b.size)/2}else{let b=this.viewItems[n+1];p=(b.size-b.maximumSize)/2,h=(b.size-b.minimumSize)/2}let g,f;if(!c){let v=Ig(n,-1),b=Ig(n+1,this.viewItems.length),S=v.reduce((H,G)=>H+(this.viewItems[G].minimumSize-u[G]),0),y=v.reduce((H,G)=>H+(this.viewItems[G].viewMaximumSize-u[G]),0),w=b.length===0?Number.POSITIVE_INFINITY:b.reduce((H,G)=>H+(u[G]-this.viewItems[G].minimumSize),0),k=b.length===0?Number.NEGATIVE_INFINITY:b.reduce((H,G)=>H+(u[G]-this.viewItems[G].viewMaximumSize),0),T=Math.max(S,k),P=Math.min(w,y),O=this.findFirstSnapIndex(v),V=this.findFirstSnapIndex(b);if(typeof O=="number"){let H=this.viewItems[O],G=Math.floor(H.viewMinimumSize/2);g={index:O,limitDelta:H.visible?T-G:T+G,size:H.size}}if(typeof V=="number"){let H=this.viewItems[V],G=Math.floor(H.viewMinimumSize/2);f={index:V,limitDelta:H.visible?P+G:P-G,size:H.size}}}this.sashDragState={start:l,current:l,index:n,sizes:u,minDelta:p,maxDelta:h,alt:c,snapBefore:g,snapAfter:f,disposable:r}};s(t,o)}onSashChange({current:e}){let{index:t,start:o,sizes:n,alt:r,minDelta:s,maxDelta:l,snapBefore:c,snapAfter:u}=this.sashDragState;this.sashDragState.current=e;let p=e-o,h=this.resize(t,p,n,void 0,void 0,s,l,c,u);if(r){let g=t===this.sashItems.length-1,f=this.viewItems.map(k=>k.size),v=g?t:t+1,b=this.viewItems[v],S=b.size-b.maximumSize,y=b.size-b.minimumSize,w=g?t-1:t+1;this.resize(w,-h,f,void 0,void 0,S,y)}this.distributeEmptySpace(),this.layoutViews()}onSashEnd(e){this._onDidSashChange.fire(e),this.sashDragState.disposable.dispose(),this.saveProportions();for(let t of this.viewItems)t.enabled=!0}onViewChange(e,t){let o=this.viewItems.indexOf(e);o<0||o>=this.viewItems.length||(t=typeof t=="number"?t:e.size,t=Bn(t,e.minimumSize,e.maximumSize),this.inverseAltBehavior&&o>0?(this.resize(o-1,Math.floor((e.size-t)/2)),this.distributeEmptySpace(),this.layoutViews()):(e.size=t,this.relayout([o],void 0)))}resizeView(e,t){if(!(e<0||e>=this.viewItems.length)){if(this.state!==0)throw new Error("Cant modify splitview");this.state=1;try{let o=Ig(this.viewItems.length).filter(l=>l!==e),n=[...o.filter(l=>this.viewItems[l].priority===1),e],r=o.filter(l=>this.viewItems[l].priority===2),s=this.viewItems[e];t=Math.round(t),t=Bn(t,s.minimumSize,Math.min(s.maximumSize,this.size)),s.size=t,this.relayout(n,r)}finally{this.state=0}}}isViewExpanded(e){if(e<0||e>=this.viewItems.length)return!1;for(let t of this.viewItems)if(t!==this.viewItems[e]&&t.size>t.minimumSize)return!1;return!0}distributeViewSizes(){let e=[],t=0;for(let l of this.viewItems)l.maximumSize-l.minimumSize>0&&(e.push(l),t+=l.size);let o=Math.floor(t/e.length);for(let l of e)l.size=Bn(o,l.minimumSize,l.maximumSize);let n=Ig(this.viewItems.length),r=n.filter(l=>this.viewItems[l].priority===1),s=n.filter(l=>this.viewItems[l].priority===2);this.relayout(r,s)}getViewSize(e){return e<0||e>=this.viewItems.length?-1:this.viewItems[e].size}doAddView(e,t,o=this.viewItems.length,n){if(this.state!==0)throw new Error("Cant modify splitview");this.state=1;try{let r=_(".split-view-view");o===this.viewItems.length?this.viewContainer.appendChild(r):this.viewContainer.insertBefore(r,this.viewContainer.children.item(o));let s=e.onDidChange(g=>this.onViewChange(p,g)),l=Z(()=>r.remove()),c=wn(s,l),u;typeof t=="number"?u=t:(t.type==="auto"&&(this.areViewsDistributed()?t={type:"distribute"}:t={type:"split",index:t.index}),t.type==="split"?u=this.getViewSize(t.index)/2:t.type==="invisible"?u={cachedVisibleSize:t.cachedVisibleSize}:u=e.minimumSize);let p=this.orientation===0?new Iai(r,e,u,c):new yai(r,e,u,c);if(this.viewItems.splice(o,0,p),this.viewItems.length>1){let g={orthogonalStartSash:this.orthogonalStartSash,orthogonalEndSash:this.orthogonalEndSash},f=this.orientation===0?new Jh(this.sashContainer,{getHorizontalSashTop:H=>this.getSashPosition(H),getHorizontalSashWidth:this.getSashOrthogonalSize},{...g,orientation:1}):new Jh(this.sashContainer,{getVerticalSashLeft:H=>this.getSashPosition(H),getVerticalSashHeight:this.getSashOrthogonalSize},{...g,orientation:0}),v=this.orientation===0?H=>({sash:f,start:H.startY,current:H.currentY,alt:H.altKey}):H=>({sash:f,start:H.startX,current:H.currentX,alt:H.altKey}),S=U.map(f.onDidStart,v)(this.onSashStart,this),w=U.map(f.onDidChange,v)(this.onSashChange,this),T=U.map(f.onDidEnd,()=>this.sashItems.findIndex(H=>H.sash===f))(this.onSashEnd,this),P=f.onDidReset(()=>{let H=this.sashItems.findIndex(he=>he.sash===f),G=Ig(H,-1),$=Ig(H+1,this.viewItems.length),J=this.findFirstSnapIndex(G),ae=this.findFirstSnapIndex($);typeof J=="number"&&!this.viewItems[J].visible||typeof ae=="number"&&!this.viewItems[ae].visible||this._onDidSashReset.fire(H)}),O=wn(S,w,T,P,f),V={sash:f,disposable:O};this.sashItems.splice(o-1,0,V)}r.appendChild(e.element);let h;typeof t!="number"&&t.type==="split"&&(h=[t.index]),n||this.relayout([o],h),!n&&typeof t!="number"&&t.type==="distribute"&&this.distributeViewSizes()}finally{this.state=0}}relayout(e,t){let o=this.viewItems.reduce((n,r)=>n+r.size,0);this.resize(this.viewItems.length-1,this.size-o,void 0,e,t),this.distributeEmptySpace(),this.layoutViews(),this.saveProportions()}resize(e,t,o=this.viewItems.map(p=>p.size),n,r,s=Number.NEGATIVE_INFINITY,l=Number.POSITIVE_INFINITY,c,u){if(e<0||e>=this.viewItems.length)return 0;let p=Ig(e,-1),h=Ig(e+1,this.viewItems.length);if(r)for(let V of r)cht(p,V),cht(h,V);if(n)for(let V of n)a$e(p,V),a$e(h,V);let g=p.map(V=>this.viewItems[V]),f=p.map(V=>o[V]),v=h.map(V=>this.viewItems[V]),b=h.map(V=>o[V]),S=p.reduce((V,H)=>V+(this.viewItems[H].minimumSize-o[H]),0),y=p.reduce((V,H)=>V+(this.viewItems[H].maximumSize-o[H]),0),w=h.length===0?Number.POSITIVE_INFINITY:h.reduce((V,H)=>V+(o[H]-this.viewItems[H].minimumSize),0),k=h.length===0?Number.NEGATIVE_INFINITY:h.reduce((V,H)=>V+(o[H]-this.viewItems[H].maximumSize),0),T=Math.max(S,k,s),P=Math.min(w,y,l),O=!1;if(c){let V=this.viewItems[c.index],H=t>=c.limitDelta;O=H!==V.visible,V.setVisible(H,c.size)}if(!O&&u){let V=this.viewItems[u.index],H=t<u.limitDelta;O=H!==V.visible,V.setVisible(H,u.size)}if(O)return this.resize(e,t,o,n,r,s,l);t=Bn(t,T,P);for(let V=0,H=t;V<g.length;V++){let G=g[V],$=Bn(f[V]+H,G.minimumSize,G.maximumSize),J=$-f[V];H-=J,G.size=$}for(let V=0,H=t;V<v.length;V++){let G=v[V],$=Bn(b[V]-H,G.minimumSize,G.maximumSize),J=$-b[V];H+=J,G.size=$}return t}distributeEmptySpace(e){let t=this.viewItems.reduce((l,c)=>l+c.size,0),o=this.size-t,n=Ig(this.viewItems.length-1,-1),r=n.filter(l=>this.viewItems[l].priority===1),s=n.filter(l=>this.viewItems[l].priority===2);for(let l of s)cht(n,l);for(let l of r)a$e(n,l);typeof e=="number"&&a$e(n,e);for(let l=0;o!==0&&l<n.length;l++){let c=this.viewItems[n[l]],u=Bn(c.size+o,c.minimumSize,c.maximumSize),p=u-c.size;o-=p,c.size=u}}layoutViews(){this._contentSize=this.viewItems.reduce((t,o)=>t+o.size,0);let e=0;for(let t of this.viewItems)t.layout(e,this.layoutContext),e+=t.size;this.sashItems.forEach(t=>t.sash.layout()),this.updateSashEnablement(),this.updateScrollableElement()}updateScrollableElement(){this.orientation===0?this.scrollableElement.setScrollDimensions({height:this.size,scrollHeight:this._contentSize}):this.scrollableElement.setScrollDimensions({width:this.size,scrollWidth:this._contentSize})}updateSashEnablement(){let e=!1,t=this.viewItems.map(c=>e=c.size-c.minimumSize>0||e);e=!1;let o=this.viewItems.map(c=>e=c.maximumSize-c.size>0||e),n=[...this.viewItems].reverse();e=!1;let r=n.map(c=>e=c.size-c.minimumSize>0||e).reverse();e=!1;let s=n.map(c=>e=c.maximumSize-c.size>0||e).reverse(),l=0;for(let c=0;c<this.sashItems.length;c++){let{sash:u}=this.sashItems[c],p=this.viewItems[c];l+=p.size;let h=!(t[c]&&s[c+1]),g=!(o[c]&&r[c+1]);if(h&&g){let f=Ig(c,-1),v=Ig(c+1,this.viewItems.length),b=this.findFirstSnapIndex(f),S=this.findFirstSnapIndex(v),y=typeof b=="number"&&!this.viewItems[b].visible,w=typeof S=="number"&&!this.viewItems[S].visible;y&&r[c]&&(l>0||this.startSnappingEnabled)?u.state=1:w&&t[c]&&(l<this._contentSize||this.endSnappingEnabled)?u.state=2:u.state=0}else h&&!g?u.state=1:!h&&g?u.state=2:u.state=3}}getSashPosition(e){let t=0;for(let o=0;o<this.sashItems.length;o++)if(t+=this.viewItems[o].size,this.sashItems[o].sash===e)return t;return 0}findFirstSnapIndex(e){for(let t of e){let o=this.viewItems[t];if(o.visible&&o.snap)return t}for(let t of e){let o=this.viewItems[t];if(o.visible&&o.maximumSize-o.minimumSize>0)return;if(!o.visible&&o.snap)return t}}areViewsDistributed(){let e,t;for(let o of this.viewItems)if(e=e===void 0?o.size:Math.min(e,o.size),t=t===void 0?o.size:Math.max(t,o.size),t-e>2)return!1;return!0}dispose(){this.sashDragState?.disposable.dispose(),Be(this.viewItems),this.viewItems=[],this.sashItems.forEach(e=>e.disposable.dispose()),this.sashItems=[],super.dispose()}};var qCt=class a{constructor(i,e,t){this.columns=i;this.getColumnSize=t;this.templateId=a.TemplateId;this.renderedTemplates=new Set;let o=new Map(e.map(n=>[n.templateId,n]));this.renderers=[];for(let n of i){let r=o.get(n.templateId);if(!r)throw new Error(`Table cell renderer for template id ${n.templateId} not found.`);this.renderers.push(r)}}static{this.TemplateId="row"}renderTemplate(i){let e=M(i,_(".monaco-table-tr")),t=[],o=[];for(let r=0;r<this.columns.length;r++){let s=this.renderers[r],l=M(e,_(".monaco-table-td",{"data-col-index":r}));l.style.width=`${this.getColumnSize(r)}px`,t.push(l),o.push(s.renderTemplate(l))}let n={container:i,cellContainers:t,cellTemplateData:o};return this.renderedTemplates.add(n),n}renderElement(i,e,t,o){for(let n=0;n<this.columns.length;n++){let s=this.columns[n].project(i);this.renderers[n].renderElement(s,e,t.cellTemplateData[n],o)}}disposeElement(i,e,t,o){for(let n=0;n<this.columns.length;n++){let r=this.renderers[n];if(r.disposeElement){let l=this.columns[n].project(i);r.disposeElement(l,e,t.cellTemplateData[n],o)}}}disposeTemplate(i){for(let e=0;e<this.columns.length;e++)this.renderers[e].disposeTemplate(i.cellTemplateData[e]);Rt(i.container),this.renderedTemplates.delete(i)}layoutColumn(i,e){for(let{cellContainers:t}of this.renderedTemplates)t[i].style.width=`${e}px`}};function Rzo(a){return{getHeight(i){return a.getHeight(i)},getTemplateId(){return qCt.TemplateId}}}var wai=class extends x{constructor(e,t){super();this.column=e;this.index=t;this._onDidLayout=this._register(new E);this.onDidLayout=this._onDidLayout.event;this.element=_(".monaco-table-th",{"data-col-index":t},e.label),e.tooltip&&this._register(Up().setupManagedHover(Ri("mouse"),this.element,e.tooltip))}get minimumSize(){return this.column.minimumWidth??120}get maximumSize(){return this.column.maximumWidth??Number.POSITIVE_INFINITY}get onDidChange(){return this.column.onDidChangeWidthConstraints??U.None}layout(e){this._onDidLayout.fire([this.index,e])}},iF=class a{constructor(i,e,t,o,n,r){this.virtualDelegate=t;this.columns=o;this.domId=`table_id_${++a.InstanceCount}`;this.disposables=new N;this.cachedWidth=0;this.cachedHeight=0;this.domNode=M(e,_(`.monaco-table.${this.domId}`));let s=o.map((u,p)=>this.disposables.add(new wai(u,p))),l={size:s.reduce((u,p)=>u+p.column.weight,0),views:s.map(u=>({size:u.column.weight,view:u}))};this.splitview=this.disposables.add(new Ou(this.domNode,{orientation:1,scrollbarVisibility:2,getSashOrthogonalSize:()=>this.cachedHeight,descriptor:l})),this.splitview.el.style.height=`${t.headerRowHeight}px`,this.splitview.el.style.lineHeight=`${t.headerRowHeight}px`;let c=new qCt(o,n,u=>this.splitview.getViewSize(u));this.list=this.disposables.add(new Cc(i,this.domNode,Rzo(t),[c],r)),U.any(...s.map(u=>u.onDidLayout))(([u,p])=>c.layoutColumn(u,p),null,this.disposables),this.splitview.onDidSashReset(u=>{let p=o.reduce((g,f)=>g+f.weight,0),h=o[u].weight/p*this.cachedWidth;this.splitview.resizeView(u,h)},null,this.disposables),this.styleElement=Cr(this.domNode),this.style(Ryt)}static{this.InstanceCount=0}get onDidChangeFocus(){return this.list.onDidChangeFocus}get onDidChangeSelection(){return this.list.onDidChangeSelection}get onDidScroll(){return this.list.onDidScroll}get onMouseClick(){return this.list.onMouseClick}get onMouseDblClick(){return this.list.onMouseDblClick}get onMouseMiddleClick(){return this.list.onMouseMiddleClick}get onPointer(){return this.list.onPointer}get onMouseUp(){return this.list.onMouseUp}get onMouseDown(){return this.list.onMouseDown}get onMouseOver(){return this.list.onMouseOver}get onMouseMove(){return this.list.onMouseMove}get onMouseOut(){return this.list.onMouseOut}get onTouchStart(){return this.list.onTouchStart}get onTap(){return this.list.onTap}get onContextMenu(){return this.list.onContextMenu}get onDidFocus(){return this.list.onDidFocus}get onDidBlur(){return this.list.onDidBlur}get scrollTop(){return this.list.scrollTop}set scrollTop(i){this.list.scrollTop=i}get scrollLeft(){return this.list.scrollLeft}set scrollLeft(i){this.list.scrollLeft=i}get scrollHeight(){return this.list.scrollHeight}get renderHeight(){return this.list.renderHeight}get onDidDispose(){return this.list.onDidDispose}getColumnLabels(){return this.columns.map(i=>i.label)}resizeColumn(i,e){let t=Math.round(e/100*this.cachedWidth);this.splitview.resizeView(i,t)}updateOptions(i){this.list.updateOptions(i)}splice(i,e,t=[]){this.list.splice(i,e,t)}rerender(){this.list.rerender()}row(i){return this.list.element(i)}indexOf(i){return this.list.indexOf(i)}get length(){return this.list.length}getHTMLElement(){return this.domNode}layout(i,e){i=i??RIe(this.domNode),e=e??X9(this.domNode),this.cachedWidth=e,this.cachedHeight=i,this.splitview.layout(e);let t=i-this.virtualDelegate.headerRowHeight;this.list.getHTMLElement().style.height=`${t}px`,this.list.layout(t,e)}triggerTypeNavigation(){this.list.triggerTypeNavigation()}style(i){let e=[];e.push(`.monaco-table.${this.domId} > .monaco-split-view2 .monaco-sash.vertical::before {
			top: ${this.virtualDelegate.headerRowHeight+1}px;
			height: calc(100% - ${this.virtualDelegate.headerRowHeight}px);
		}`),this.styleElement.textContent=e.join(`
`),this.list.style(i)}domFocus(){this.list.domFocus()}setAnchor(i){this.list.setAnchor(i)}getAnchor(){return this.list.getAnchor()}getSelectedElements(){return this.list.getSelectedElements()}setSelection(i,e){this.list.setSelection(i,e)}getSelection(){return this.list.getSelection()}setFocus(i,e){this.list.setFocus(i,e)}focusNext(i=1,e=!1,t){this.list.focusNext(i,e,t)}focusPrevious(i=1,e=!1,t){this.list.focusPrevious(i,e,t)}focusNextPage(i){return this.list.focusNextPage(i)}focusPreviousPage(i){return this.list.focusPreviousPage(i)}focusFirst(i){this.list.focusFirst(i)}focusLast(i){this.list.focusLast(i)}getFocus(){return this.list.getFocus()}getFocusedElements(){return this.list.getFocusedElements()}getRelativeTop(i){return this.list.getRelativeTop(i)}reveal(i,e){this.list.reveal(i,e)}dispose(){this.disposables.dispose()}};var Lg=class extends Error{constructor(i,e){super(`TreeError [${i}] ${e}`)}},Ece=class{constructor(i){this.fn=i;this._map=new WeakMap}map(i){let e=this._map.get(i);return e||(e=this.fn(i),this._map.set(i,e)),e}};function KY(a){return!!a&&a.visibility!==void 0}function $z(a){switch(a){case!0:return 1;case!1:return 0;default:return a}}function Cai(a){return"collapsible"in a}var $Ct=class{constructor(i,e,t={}){this.user=i;this.rootRef=[];this.eventBufferer=new QN;this._onDidSpliceModel=new E;this.onDidSpliceModel=this._onDidSpliceModel.event;this._onDidSpliceRenderedNodes=new E;this.onDidSpliceRenderedNodes=this._onDidSpliceRenderedNodes.event;this._onDidChangeCollapseState=new E;this.onDidChangeCollapseState=this.eventBufferer.wrapEvent(this._onDidChangeCollapseState.event);this._onDidChangeRenderNodeCount=new E;this.onDidChangeRenderNodeCount=this.eventBufferer.wrapEvent(this._onDidChangeRenderNodeCount.event);this.refilterDelayer=new Xo(ML);this.collapseByDefault=typeof t.collapseByDefault>"u"?!1:t.collapseByDefault,this.allowNonCollapsibleParents=t.allowNonCollapsibleParents??!1,this.filter=t.filter,this.autoExpandSingleChildren=typeof t.autoExpandSingleChildren>"u"?!1:t.autoExpandSingleChildren,this.root={parent:void 0,element:e,children:[],depth:0,visibleChildrenCount:0,visibleChildIndex:-1,collapsible:!1,collapsed:!1,renderNodeCount:0,visibility:1,visible:!0,filterData:void 0}}splice(i,e,t=vt.empty(),o={}){if(i.length===0)throw new Lg(this.user,"Invalid tree location");o.diffIdentityProvider?this.spliceSmart(o.diffIdentityProvider,i,e,t,o):this.spliceSimple(i,e,t,o)}spliceSmart(i,e,t,o=vt.empty(),n,r=n.diffDepth??0){let{parentNode:s}=this.getParentNodeWithListIndex(e);if(!s.lastDiffIds)return this.spliceSimple(e,t,o,n);let l=[...o],c=e[e.length-1],u=new xP({getElements:()=>s.lastDiffIds},{getElements:()=>[...s.children.slice(0,c),...l,...s.children.slice(c+t)].map(v=>i.getId(v.element).toString())}).ComputeDiff(!1);if(u.quitEarly)return s.lastDiffIds=void 0,this.spliceSimple(e,t,l,n);let p=e.slice(0,-1),h=(v,b,S)=>{if(r>0)for(let y=0;y<S;y++)v--,b--,this.spliceSmart(i,[...p,v,0],Number.MAX_SAFE_INTEGER,l[b].children,n,r-1)},g=Math.min(s.children.length,c+t),f=l.length;for(let v of u.changes.sort((b,S)=>S.originalStart-b.originalStart))h(g,f,g-(v.originalStart+v.originalLength)),g=v.originalStart,f=v.modifiedStart-c,this.spliceSimple([...p,g],v.originalLength,vt.slice(l,f,f+v.modifiedLength),n);h(g,f,g)}spliceSimple(i,e,t=vt.empty(),{onDidCreateNode:o,onDidDeleteNode:n,diffIdentityProvider:r}){let{parentNode:s,listIndex:l,revealed:c,visible:u}=this.getParentNodeWithListIndex(i),p=[],h=vt.map(t,T=>this.createTreeNode(T,s,s.visible?1:0,c,p,o)),g=i[i.length-1],f=0;for(let T=g;T>=0&&T<s.children.length;T--){let P=s.children[T];if(P.visible){f=P.visibleChildIndex;break}}let v=[],b=0,S=0;for(let T of h)v.push(T),S+=T.renderNodeCount,T.visible&&(T.visibleChildIndex=f+b++);let y=Ose(s.children,g,e,v);r?s.lastDiffIds?Ose(s.lastDiffIds,g,e,v.map(T=>r.getId(T.element).toString())):s.lastDiffIds=s.children.map(T=>r.getId(T.element).toString()):s.lastDiffIds=void 0;let w=0;for(let T of y)T.visible&&w++;if(w!==0)for(let T=g+v.length;T<s.children.length;T++){let P=s.children[T];P.visible&&(P.visibleChildIndex-=w)}if(s.visibleChildrenCount+=b-w,y.length>0&&n){let T=P=>{n(P),P.children.forEach(T)};y.forEach(T)}if(c&&u){let T=y.reduce((P,O)=>P+(O.visible?O.renderNodeCount:0),0);this._updateAncestorsRenderNodeCount(s,S-T),this._onDidSpliceRenderedNodes.fire({start:l,deleteCount:T,elements:p})}this._onDidSpliceModel.fire({insertedNodes:v,deletedNodes:y});let k=s;for(;k;){if(k.visibility===2){this.refilterDelayer.trigger(()=>this.refilter());break}k=k.parent}}rerender(i){if(i.length===0)throw new Lg(this.user,"Invalid tree location");let{node:e,listIndex:t,revealed:o}=this.getTreeNodeWithListIndex(i);e.visible&&o&&this._onDidSpliceRenderedNodes.fire({start:t,deleteCount:1,elements:[e]})}has(i){return this.hasTreeNode(i)}getListIndex(i){let{listIndex:e,visible:t,revealed:o}=this.getTreeNodeWithListIndex(i);return t&&o?e:-1}getListRenderCount(i){return this.getTreeNode(i).renderNodeCount}isCollapsible(i){return this.getTreeNode(i).collapsible}setCollapsible(i,e){let t=this.getTreeNode(i);typeof e>"u"&&(e=!t.collapsible);let o={collapsible:e};return this.eventBufferer.bufferEvents(()=>this._setCollapseState(i,o))}isCollapsed(i){return this.getTreeNode(i).collapsed}setCollapsed(i,e,t){let o=this.getTreeNode(i);typeof e>"u"&&(e=!o.collapsed);let n={collapsed:e,recursive:t||!1};return this.eventBufferer.bufferEvents(()=>this._setCollapseState(i,n))}_setCollapseState(i,e){let{node:t,listIndex:o,revealed:n}=this.getTreeNodeWithListIndex(i),r=this._setListNodeCollapseState(t,o,n,e);if(t!==this.root&&this.autoExpandSingleChildren&&r&&!Cai(e)&&t.collapsible&&!t.collapsed&&!e.recursive){let s=-1;for(let l=0;l<t.children.length;l++)if(t.children[l].visible)if(s>-1){s=-1;break}else s=l;s>-1&&this._setCollapseState([...i,s],e)}return r}_setListNodeCollapseState(i,e,t,o){let n=this._setNodeCollapseState(i,o,!1);if(!t||!i.visible||!n)return n;let r=i.renderNodeCount,s=this.updateNodeAfterCollapseChange(i),l=r-(e===-1?0:1);return this._onDidSpliceRenderedNodes.fire({start:e+1,deleteCount:l,elements:s.slice(1)}),n}_setNodeCollapseState(i,e,t){let o;if(i===this.root?o=!1:(Cai(e)?(o=i.collapsible!==e.collapsible,i.collapsible=e.collapsible):i.collapsible?(o=i.collapsed!==e.collapsed,i.collapsed=e.collapsed):o=!1,o&&this._onDidChangeCollapseState.fire({node:i,deep:t})),!Cai(e)&&e.recursive)for(let n of i.children)o=this._setNodeCollapseState(n,e,!0)||o;return o}expandTo(i){this.eventBufferer.bufferEvents(()=>{let e=this.getTreeNode(i);for(;e.parent;)e=e.parent,i=i.slice(0,i.length-1),e.collapsed&&this._setCollapseState(i,{collapsed:!1,recursive:!1})})}refilter(){let i=this.root.renderNodeCount,e=this.updateNodeAfterFilterChange(this.root);this._onDidSpliceRenderedNodes.fire({start:0,deleteCount:i,elements:e}),this.refilterDelayer.cancel()}createTreeNode(i,e,t,o,n,r){let s={parent:e,element:i.element,children:[],depth:e.depth+1,visibleChildrenCount:0,visibleChildIndex:-1,collapsible:typeof i.collapsible=="boolean"?i.collapsible:typeof i.collapsed<"u",collapsed:typeof i.collapsed>"u"?this.collapseByDefault:i.collapsed,renderNodeCount:1,visibility:1,visible:!0,filterData:void 0},l=this._filterNode(s,t);s.visibility=l,o&&n.push(s);let c=i.children||vt.empty(),u=o&&l!==0&&!s.collapsed,p=0,h=1;for(let g of c){let f=this.createTreeNode(g,s,l,u,n,r);s.children.push(f),h+=f.renderNodeCount,f.visible&&(f.visibleChildIndex=p++)}return this.allowNonCollapsibleParents||(s.collapsible=s.collapsible||s.children.length>0),s.visibleChildrenCount=p,s.visible=l===2?p>0:l===1,s.visible?s.collapsed||(s.renderNodeCount=h):(s.renderNodeCount=0,o&&n.pop()),r?.(s),s}updateNodeAfterCollapseChange(i){let e=i.renderNodeCount,t=[];return this._updateNodeAfterCollapseChange(i,t),this._updateAncestorsRenderNodeCount(i.parent,t.length-e),t}_updateNodeAfterCollapseChange(i,e){if(i.visible===!1)return 0;if(e.push(i),i.renderNodeCount=1,!i.collapsed)for(let t of i.children)i.renderNodeCount+=this._updateNodeAfterCollapseChange(t,e);return this._onDidChangeRenderNodeCount.fire(i),i.renderNodeCount}updateNodeAfterFilterChange(i){let e=i.renderNodeCount,t=[];return this._updateNodeAfterFilterChange(i,i.visible?1:0,t),this._updateAncestorsRenderNodeCount(i.parent,t.length-e),t}_updateNodeAfterFilterChange(i,e,t,o=!0){let n;if(i!==this.root){if(n=this._filterNode(i,e),n===0)return i.visible=!1,i.renderNodeCount=0,!1;o&&t.push(i)}let r=t.length;i.renderNodeCount=i===this.root?0:1;let s=!1;if(!i.collapsed||n!==0){let l=0;for(let c of i.children)s=this._updateNodeAfterFilterChange(c,n,t,o&&!i.collapsed)||s,c.visible&&(c.visibleChildIndex=l++);i.visibleChildrenCount=l}else i.visibleChildrenCount=0;return i!==this.root&&(i.visible=n===2?s:n===1,i.visibility=n),i.visible?i.collapsed||(i.renderNodeCount+=t.length-r):(i.renderNodeCount=0,o&&t.pop()),this._onDidChangeRenderNodeCount.fire(i),i.visible}_updateAncestorsRenderNodeCount(i,e){if(e!==0)for(;i;)i.renderNodeCount+=e,this._onDidChangeRenderNodeCount.fire(i),i=i.parent}_filterNode(i,e){let t=this.filter?this.filter.filter(i.element,e):1;return typeof t=="boolean"?(i.filterData=void 0,t?1:0):KY(t)?(i.filterData=t.data,$z(t.visibility)):(i.filterData=void 0,$z(t))}hasTreeNode(i,e=this.root){if(!i||i.length===0)return!0;let[t,...o]=i;return t<0||t>e.children.length?!1:this.hasTreeNode(o,e.children[t])}getTreeNode(i,e=this.root){if(!i||i.length===0)return e;let[t,...o]=i;if(t<0||t>e.children.length)throw new Lg(this.user,"Invalid tree location");return this.getTreeNode(o,e.children[t])}getTreeNodeWithListIndex(i){if(i.length===0)return{node:this.root,listIndex:-1,revealed:!0,visible:!1};let{parentNode:e,listIndex:t,revealed:o,visible:n}=this.getParentNodeWithListIndex(i),r=i[i.length-1];if(r<0||r>e.children.length)throw new Lg(this.user,"Invalid tree location");let s=e.children[r];return{node:s,listIndex:t,revealed:o,visible:n&&s.visible}}getParentNodeWithListIndex(i,e=this.root,t=0,o=!0,n=!0){let[r,...s]=i;if(r<0||r>e.children.length)throw new Lg(this.user,"Invalid tree location");for(let l=0;l<r;l++)t+=e.children[l].renderNodeCount;return o=o&&!e.collapsed,n=n&&e.visible,s.length===0?{parentNode:e,listIndex:t,revealed:o,visible:n}:this.getParentNodeWithListIndex(s,e.children[r],t+1,o,n)}getNode(i=[]){return this.getTreeNode(i)}getNodeLocation(i){let e=[],t=i;for(;t.parent;)e.push(t.parent.children.indexOf(t)),t=t.parent;return e.reverse()}getParentNodeLocation(i){if(i.length!==0)return i.length===1?[]:Xg(i)[0]}getFirstElementChild(i){let e=this.getTreeNode(i);if(e.children.length!==0)return e.children[0].element}getLastElementAncestor(i=[]){let e=this.getTreeNode(i);if(e.children.length!==0)return this._getLastElementAncestor(e)}_getLastElementAncestor(i){return i.children.length===0?i.element:this._getLastElementAncestor(i.children[i.children.length-1])}};var kai=class extends uw{constructor(e){super(e.elements.map(t=>t.element));this.data=e}set context(e){this.data.context=e}get context(){return this.data.context}};function xai(a){return a instanceof uw?new kai(a):a}var Eai=class{constructor(i,e){this.modelProvider=i;this.dnd=e;this.autoExpandDisposable=x.None;this.disposables=new N}getDragURI(i){return this.dnd.getDragURI(i.element)}getDragLabel(i,e){if(this.dnd.getDragLabel)return this.dnd.getDragLabel(i.map(t=>t.element),e)}onDragStart(i,e){this.dnd.onDragStart?.(xai(i),e)}onDragOver(i,e,t,o,n,r=!0){let s=this.dnd.onDragOver(xai(i),e&&e.element,t,o,n),l=this.autoExpandNode!==e;if(l&&(this.autoExpandDisposable.dispose(),this.autoExpandNode=e),typeof e>"u")return s;if(l&&typeof s!="boolean"&&s.autoExpand&&(this.autoExpandDisposable=tn(()=>{let g=this.modelProvider(),f=g.getNodeLocation(e);g.isCollapsed(f)&&g.setCollapsed(f,!1),this.autoExpandNode=void 0},500,this.disposables)),typeof s=="boolean"||!s.accept||typeof s.bubble>"u"||s.feedback){if(!r){let g=typeof s=="boolean"?s:s.accept,f=typeof s=="boolean"?void 0:s.effect;return{accept:g,effect:f,feedback:[t]}}return s}if(s.bubble===1){let g=this.modelProvider(),f=g.getNodeLocation(e),v=g.getParentNodeLocation(f),b=g.getNode(v),S=v&&g.getListIndex(v);return this.onDragOver(i,b,S,o,n,!1)}let c=this.modelProvider(),u=c.getNodeLocation(e),p=c.getListIndex(u),h=c.getListRenderCount(u);return{...s,feedback:Ig(p,p+h)}}drop(i,e,t,o,n){this.autoExpandDisposable.dispose(),this.autoExpandNode=void 0,this.dnd.drop(xai(i),e&&e.element,t,o,n)}onDragEnd(i){this.dnd.onDragEnd?.(i)}dispose(){this.disposables.dispose(),this.dnd.dispose()}};function Mzo(a,i,e){return e&&{...e,identityProvider:e.identityProvider&&{getId(t){return e.identityProvider.getId(t.element)},getGroupId:e.identityProvider.getGroupId?t=>e.identityProvider.getGroupId(t.element):void 0},dnd:e.dnd&&i.add(new Eai(a,e.dnd)),multipleSelectionController:e.multipleSelectionController&&{isSelectionSingleChangeEvent(t){return e.multipleSelectionController.isSelectionSingleChangeEvent({...t,element:t.element})},isSelectionRangeChangeEvent(t){return e.multipleSelectionController.isSelectionRangeChangeEvent({...t,element:t.element})}},accessibilityProvider:e.accessibilityProvider&&{...e.accessibilityProvider,getSetSize(t){let o=a(),n=o.getNodeLocation(t),r=o.getParentNodeLocation(n);return o.getNode(r).visibleChildrenCount},getPosInSet(t){return t.visibleChildIndex+1},isChecked:e.accessibilityProvider&&e.accessibilityProvider.isChecked?t=>e.accessibilityProvider.isChecked(t.element):void 0,getRole:e.accessibilityProvider&&e.accessibilityProvider.getRole?t=>e.accessibilityProvider.getRole(t.element):()=>"treeitem",getAriaLabel(t){return e.accessibilityProvider.getAriaLabel(t.element)},getWidgetAriaLabel(){return e.accessibilityProvider.getWidgetAriaLabel()},getWidgetRole:e.accessibilityProvider&&e.accessibilityProvider.getWidgetRole?()=>e.accessibilityProvider.getWidgetRole():()=>"tree",getAriaLevel:e.accessibilityProvider&&e.accessibilityProvider.getAriaLevel?t=>e.accessibilityProvider.getAriaLevel(t.element):t=>t.depth,getActiveDescendantId:e.accessibilityProvider.getActiveDescendantId&&(t=>e.accessibilityProvider.getActiveDescendantId(t.element))},keyboardNavigationLabelProvider:e.keyboardNavigationLabelProvider&&{...e.keyboardNavigationLabelProvider,getKeyboardNavigationLabel(t){return e.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(t.element)}}}}var Pxe=class{constructor(i){this.delegate=i}getHeight(i){return this.delegate.getHeight(i.element)}getTemplateId(i){return this.delegate.getTemplateId(i.element)}hasDynamicHeight(i){return!!this.delegate.hasDynamicHeight&&this.delegate.hasDynamicHeight(i.element)}setDynamicHeight(i,e){this.delegate.setDynamicHeight?.(i.element,e)}},T3e=class a{static lift(i){return i instanceof a?i:new a(i)}static empty(i=0){return new a({focus:[],selection:[],expanded:Object.create(null),scrollTop:i})}constructor(i){if(this.focus=new Set(i.focus),this.selection=new Set(i.selection),i.expanded instanceof Array){this.expanded=Object.create(null);for(let e of i.expanded)this.expanded[e]=1}else this.expanded=i.expanded;this.expanded=i.expanded,this.scrollTop=i.scrollTop}toJSON(){return{focus:Array.from(this.focus),selection:Array.from(this.selection),expanded:this.expanded,scrollTop:this.scrollTop}}};var Tai=class{constructor(i,e=[]){this._elements=e;this.disposables=new N;this.onDidChange=U.forEach(i,t=>this._elements=t,this.disposables)}get elements(){return this._elements}dispose(){this.disposables.dispose()}},_ai=class a{constructor(i,e,t,o,n,r={}){this.renderer=i;this.model=e;this.activeNodes=o;this.renderedIndentGuides=n;this.renderedElements=new Map;this.renderedNodes=new Map;this.indent=a.DefaultIndent;this.defaultIndent=a.DefaultIndent;this.hideTwistiesOfChildlessElements=!1;this.shouldRenderIndentGuides=!1;this.activeIndentNodes=new Set;this.indentGuidesDisposable=x.None;this.disposables=new N;this.templateId=i.templateId,this.updateOptions(r),U.map(t,s=>s.node)(this.onDidChangeNodeTwistieState,this,this.disposables),i.onDidChangeTwistieState?.(this.onDidChangeTwistieState,this,this.disposables)}static{this.DefaultIndent=8}updateOptions(i={}){if(typeof i.defaultIndent<"u"&&(this.defaultIndent=i.defaultIndent),typeof i.indent<"u"||typeof i.defaultIndent<"u"){let e=typeof i.indent<"u"?Bn(i.indent,0,40):this.indent;if(e!==this.indent||typeof i.defaultIndent<"u"){this.indent=e;for(let[o,n]of this.renderedNodes)n.indentSize=this.defaultIndent+(o.depth-1)*this.indent,this.renderTreeElement(o,n)}}if(typeof i.renderIndentGuides<"u"){let e=i.renderIndentGuides!=="none";if(e!==this.shouldRenderIndentGuides){this.shouldRenderIndentGuides=e;for(let[t,o]of this.renderedNodes)this._renderIndentGuides(t,o);if(this.indentGuidesDisposable.dispose(),e){let t=new N;this.activeNodes.onDidChange(this._onDidChangeActiveNodes,this,t),this.indentGuidesDisposable=t,this._onDidChangeActiveNodes(this.activeNodes.elements)}}}typeof i.hideTwistiesOfChildlessElements<"u"&&(this.hideTwistiesOfChildlessElements=i.hideTwistiesOfChildlessElements),typeof i.twistieAdditionalCssClass<"u"&&(this.twistieAdditionalCssClass=i.twistieAdditionalCssClass)}renderTemplate(i){let e=M(i,_(".monaco-tl-row")),t=M(e,_(".monaco-tl-indent")),o=M(e,_(".monaco-tl-twistie")),n=M(e,_(".monaco-tl-contents")),r=this.renderer.renderTemplate(n);return{container:i,indent:t,twistie:o,indentGuidesDisposable:x.None,indentSize:0,templateData:r}}renderElement(i,e,t,o){t.indentSize=this.defaultIndent+(i.depth-1)*this.indent,this.renderedNodes.set(i,t),this.renderedElements.set(i.element,i),this.renderTreeElement(i,t),this.renderer.renderElement(i,e,t.templateData,{...o,indent:t.indentSize})}disposeElement(i,e,t,o){t.indentGuidesDisposable.dispose(),this.renderer.disposeElement?.(i,e,t.templateData,{...o,indent:t.indentSize}),typeof o?.height=="number"&&(this.renderedNodes.delete(i),this.renderedElements.delete(i.element))}disposeTemplate(i){this.renderer.disposeTemplate(i.templateData)}onDidChangeTwistieState(i){let e=this.renderedElements.get(i);e&&this.onDidChangeNodeTwistieState(e)}onDidChangeNodeTwistieState(i){let e=this.renderedNodes.get(i);e&&(this._onDidChangeActiveNodes(this.activeNodes.elements),this.renderTreeElement(i,e))}renderTreeElement(i,e){e.twistie.className=e.twistie.classList.item(0),e.twistie.style.paddingLeft=`${e.indentSize}px`,e.indent.style.width=`${e.indentSize+this.indent-16}px`,i.collapsible?e.container.setAttribute("aria-expanded",String(!i.collapsed)):e.container.removeAttribute("aria-expanded"),e.twistie.classList.remove(...q.asClassNameArray(R.treeItemExpanded));let t=!1;if(this.renderer.renderTwistie&&(t=this.renderer.renderTwistie(i.element,e.twistie)),i.collapsible&&(!this.hideTwistiesOfChildlessElements||i.visibleChildrenCount>0)?(t||e.twistie.classList.add(...q.asClassNameArray(R.treeItemExpanded)),e.twistie.classList.add("collapsible"),e.twistie.classList.toggle("collapsed",i.collapsed)):e.twistie.classList.remove("collapsible","collapsed"),this.twistieAdditionalCssClass){let o=this.twistieAdditionalCssClass(i.element);o&&e.twistie.classList.add(o)}this._renderIndentGuides(i,e)}_renderIndentGuides(i,e){if(Rt(e.indent),e.indentGuidesDisposable.dispose(),!this.shouldRenderIndentGuides)return;let t=new N;for(;;){let o=this.model.getNodeLocation(i),n=this.model.getParentNodeLocation(o);if(!n)break;let r=this.model.getNode(n),s=_(".indent-guide",{style:`width: ${this.indent}px`});this.activeIndentNodes.has(r)&&s.classList.add("active"),e.indent.childElementCount===0?e.indent.appendChild(s):e.indent.insertBefore(s,e.indent.firstElementChild),this.renderedIndentGuides.add(r,s),t.add(Z(()=>this.renderedIndentGuides.delete(r,s))),i=r}e.indentGuidesDisposable=t}_onDidChangeActiveNodes(i){if(!this.shouldRenderIndentGuides)return;let e=new Set;i.forEach(t=>{let o=this.model.getNodeLocation(t);try{let n=this.model.getParentNodeLocation(o);t.collapsible&&t.children.length>0&&!t.collapsed?e.add(t):n&&e.add(this.model.getNode(n))}catch{}}),this.activeIndentNodes.forEach(t=>{e.has(t)||this.renderedIndentGuides.forEach(t,o=>o.classList.remove("active"))}),e.forEach(t=>{this.activeIndentNodes.has(t)||this.renderedIndentGuides.forEach(t,o=>o.classList.add("active"))}),this.activeIndentNodes=e}dispose(){this.renderedNodes.clear(),this.renderedElements.clear(),this.indentGuidesDisposable.dispose(),Be(this.disposables)}};function Pzo(a,i){let e=i.toLowerCase().indexOf(a),t;if(e>-1){t=[Number.MAX_SAFE_INTEGER,0];for(let o=a.length;o>0;o--)t.push(e+o-1)}return t}var _3e=class{constructor(i,e,t){this._keyboardNavigationLabelProvider=i;this._filter=e;this._defaultFindVisibility=t;this._totalCount=0;this._matchCount=0;this._findMatchType=0;this._findMode=0;this._pattern="";this._lowercasePattern="";this.disposables=new N}get totalCount(){return this._totalCount}get matchCount(){return this._matchCount}set findMatchType(i){this._findMatchType=i}get findMatchType(){return this._findMatchType}set findMode(i){this._findMode=i}get findMode(){return this._findMode}set pattern(i){this._pattern=i,this._lowercasePattern=i.toLowerCase()}filter(i,e){let t=1;if(this._filter){let r=this._filter.filter(i,e);if(typeof r=="boolean"?t=r?1:0:KY(r)?t=$z(r.visibility):t=r,t===0)return!1}if(this._totalCount++,!this._pattern)return this._matchCount++,{data:kv.Default,visibility:t};let o=this._keyboardNavigationLabelProvider.getKeyboardNavigationLabel(i),n=Array.isArray(o)?o:[o];for(let r of n){let s=r&&r.toString();if(typeof s>"u")return{data:kv.Default,visibility:t};let l;if(this._findMatchType===1?l=Pzo(this._lowercasePattern,s.toLowerCase()):l=rR(this._pattern,this._lowercasePattern,0,s,s.toLowerCase(),0,{firstMatchCanBeWeak:!0,boostFullMatch:!0}),l)return this._matchCount++,n.length===1?{data:l,visibility:t}:{data:{label:s,score:l},visibility:t}}return this._findMode===1?typeof this._defaultFindVisibility=="number"?this._defaultFindVisibility:this._defaultFindVisibility?this._defaultFindVisibility(i):2:{data:kv.Default,visibility:t}}reset(){this._totalCount=0,this._matchCount=0}dispose(){Be(this.disposables)}},Dai=class extends cm{constructor(i,e,t){super({icon:i.icon,title:i.title,isChecked:i.isChecked,inputActiveOptionBorder:e.inputActiveOptionBorder,inputActiveOptionForeground:e.inputActiveOptionForeground,inputActiveOptionBackground:e.inputActiveOptionBackground,hoverLifecycleOptions:t}),this.id=i.id}},Lai=class{constructor(i){this.stateMap=new Map(i.map(e=>[e.id,{...e}]))}states(){return Array.from(this.stateMap.values())}get(i){let e=this.stateMap.get(i);if(e===void 0)throw new Error(`No state found for toggle id ${i}`);return e.isChecked}set(i,e){let t=this.stateMap.get(i);if(t===void 0)throw new Error(`No state found for toggle id ${i}`);return t.isChecked===e?!1:(t.isChecked=e,!0)}},Azo={inputBoxStyles:Z9i,toggleStyles:WY,listFilterWidgetBackground:void 0,listFilterWidgetNoMatchesOutline:void 0,listFilterWidgetOutline:void 0,listFilterWidgetShadow:void 0};var Rai=class extends x{constructor(e,t,o,n,r=[],s){super();this.tree=t;this.elements=ct(".monaco-tree-type-filter",[ct(".monaco-tree-type-filter-input@findInput"),ct(".monaco-tree-type-filter-actionbar@actionbar")]);this.toggles=[];this._onDidDisable=this._register(new E);this.onDidDisable=this._onDidDisable.event;e.appendChild(this.elements.root),this._register(Z(()=>this.elements.root.remove()));let l=s?.styles??Azo;l.listFilterWidgetBackground&&(this.elements.root.style.backgroundColor=l.listFilterWidgetBackground),l.listFilterWidgetShadow&&(this.elements.root.style.boxShadow=`0 0 8px 2px ${l.listFilterWidgetShadow}`);let c={groupId:"abstract-tree"};this.toggles=r.map(f=>this._register(new Dai(f,l.toggleStyles,c))),this.onDidToggleChange=U.any(...this.toggles.map(f=>U.map(f.onChange,()=>({id:f.id,isChecked:f.checked}))));let u=s?.history||[];this.findInput=this._register(new Vz(this.elements.findInput,o,{label:d(42,null),placeholder:n,additionalToggles:this.toggles,showCommonFindToggles:!1,inputBoxStyles:l.inputBoxStyles,toggleStyles:l.toggleStyles,history:new Set(u),hoverLifecycleOptions:c})),this.actionbar=this._register(new Zi(this.elements.actionbar));let p=this._register(new Gn(this.findInput.inputBox.inputElement,"keydown")),h=U.chain(p.event,f=>f.map(v=>new gi(v)));this._register(h(f=>{if(f.equals(3)){f.preventDefault(),f.stopPropagation(),this.findInput.inputBox.addToHistory(),this.tree.domFocus();return}if(f.equals(18)){f.preventDefault(),f.stopPropagation(),this.findInput.inputBox.isAtLastInHistory()||this.findInput.inputBox.isNowhereInHistory()?(this.findInput.inputBox.addToHistory(),this.tree.domFocus()):this.findInput.inputBox.showNextValue();return}if(f.equals(16)){f.preventDefault(),f.stopPropagation(),this.findInput.inputBox.showPreviousValue();return}}));let g=this._register(new it("close",d(33,null),"codicon codicon-close",!0,()=>this.dispose()));this.actionbar.push(g,{icon:!0,label:!1}),this.onDidChangeValue=this.findInput.onDidChange}get value(){return this.findInput.inputBox.value}set value(e){this.findInput.inputBox.value=e}setToggleState(e,t){let o=this.toggles.find(n=>n.id===e);o&&(o.checked=t)}setPlaceHolder(e){this.findInput.inputBox.setPlaceHolder(e)}getHistory(){return this.findInput.inputBox.getHistory()}focus(){this.findInput.focus()}select(){this.findInput.select(),this.findInput.inputBox.addToHistory(!0)}showMessage(e){this.findInput.showMessage(e)}clearMessage(){this.findInput.clearMessage()}async dispose(){this._onDidDisable.fire(),this.elements.root.classList.add("disabled"),await Li(300),super.dispose()}};var Mai=class{constructor(i,e,t,o={}){this.tree=i;this.filter=e;this.contextViewProvider=t;this.options=o;this._pattern="";this.previousPattern="";this._onDidChangePattern=new E;this.onDidChangePattern=this._onDidChangePattern.event;this._onDidChangeOpenState=new E;this.onDidChangeOpenState=this._onDidChangeOpenState.event;this.enabledDisposables=new N;this.disposables=new N;this.toggles=new Lai(o.toggles??[]),this._placeholder=o.placeholder??d(42,null)}get pattern(){return this._pattern}get placeholder(){return this._placeholder}set placeholder(i){this._placeholder=i,this.widget?.setPlaceHolder(i)}isOpened(){return!!this.widget}open(){if(this.widget){this.widget.focus(),this.widget.select();return}this.tree.updateOptions({paddingTop:30}),this.widget=new Rai(this.tree.getHTMLElement(),this.tree,this.contextViewProvider,this.placeholder,this.toggles.states(),{...this.options,history:this._history}),this.enabledDisposables.add(this.widget),this.widget.onDidChangeValue(this.onDidChangeValue,this,this.enabledDisposables),this.widget.onDidDisable(this.close,this,this.enabledDisposables),this.widget.onDidToggleChange(this.onDidToggleChange,this,this.enabledDisposables),this.widget.focus(),this.widget.value=this.previousPattern,this.widget.select(),this._onDidChangeOpenState.fire(!0)}close(){this.widget&&(this.tree.updateOptions({paddingTop:0}),this._history=this.widget.getHistory(),this.widget=void 0,this.enabledDisposables.clear(),this.previousPattern=this.pattern,this.onDidChangeValue(""),this.tree.domFocus(),this._onDidChangeOpenState.fire(!1))}onDidChangeValue(i){this._pattern=i,this._onDidChangePattern.fire(i),this.filter.pattern=i,this.applyPattern(i)}onDidToggleChange(i){this.toggles.set(i.id,i.isChecked)}updateToggleState(i,e){this.toggles.set(i,e),this.widget?.setToggleState(i,e)}renderMessage(i,e){i?this.tree.options.showNotFoundMessage??!0?this.widget?.showMessage({type:2,content:e??d(37,null)}):this.widget?.showMessage({type:2}):this.widget?.clearMessage()}alertResults(i){i?en(d(35,null,i)):en(d(38,null))}dispose(){this._history=void 0,this._onDidChangePattern.dispose(),this.enabledDisposables.dispose(),this.disposables.dispose()}},D3e=class extends Mai{constructor(e,t,o,n={}){let r=n.defaultFindMode??0,s=n.defaultFindMatchType??0,l=[{id:"mode",icon:R.listFilter,title:d(34,null),isChecked:r===1},{id:"matchType",icon:R.searchFuzzy,title:d(36,null),isChecked:s===0}];t.findMatchType=s,t.findMode=r;super(e,t,o,{...n,toggles:l});this.filter=t;this._onDidChangeMode=new E;this.onDidChangeMode=this._onDidChangeMode.event;this._onDidChangeMatchType=new E;this.onDidChangeMatchType=this._onDidChangeMatchType.event;this.disposables.add(this.tree.onDidChangeModel(()=>{this.isOpened()&&(this.pattern.length!==0&&this.tree.refilter(),this.render())})),this.disposables.add(this.tree.onWillRefilter(()=>this.filter.reset()))}get mode(){return this.toggles.get("mode")?1:0}set mode(e){if(e===this.mode)return;let t=e===1;this.updateToggleState("mode",t),this.placeholder=t?d(41,null):d(42,null),this.filter.findMode=e,this.tree.refilter(),this.render(),this._onDidChangeMode.fire(e)}get matchType(){return this.toggles.get("matchType")?0:1}set matchType(e){e!==this.matchType&&(this.updateToggleState("matchType",e===0),this.filter.findMatchType=e,this.tree.refilter(),this.render(),this._onDidChangeMatchType.fire(e))}updateOptions(e={}){e.defaultFindMode!==void 0&&(this.mode=e.defaultFindMode),e.defaultFindMatchType!==void 0&&(this.matchType=e.defaultFindMatchType)}applyPattern(e){this.tree.refilter(),e&&this.tree.focusNext(0,!0,void 0,o=>!kv.isDefault(o.filterData));let t=this.tree.getFocus();if(t.length>0){let o=t[0];this.tree.getRelativeTop(o)===null&&this.tree.reveal(o,.5)}this.render()}shouldAllowFocus(e){return!this.isOpened()||!this.pattern||this.filter.totalCount>0&&this.filter.matchCount<=1?!0:!kv.isDefault(e.filterData)}onDidToggleChange(e){e.id==="mode"?this.mode=e.isChecked?1:0:e.id==="matchType"&&(this.matchType=e.isChecked?0:1)}render(){let t=this.filter.matchCount===0&&this.filter.totalCount>0&&this.pattern.length>0;this.renderMessage(t),this.pattern.length&&this.alertResults(this.filter.matchCount)}};function Nzo(a,i){return a.position===i.position&&f7i(a,i)}function f7i(a,i){return a.node.element===i.node.element&&a.startIndex===i.startIndex&&a.height===i.height&&a.endIndex===i.endIndex}var Pai=class{constructor(i=[]){this.stickyNodes=i}get count(){return this.stickyNodes.length}equal(i){return $i(this.stickyNodes,i.stickyNodes,Nzo)}contains(i){return this.stickyNodes.some(e=>e.node.element===i.element)}lastNodePartiallyVisible(){if(this.count===0)return!1;let i=this.stickyNodes[this.count-1];if(this.count===1)return i.position!==0;let e=this.stickyNodes[this.count-2];return e.position+e.height!==i.position}animationStateChanged(i){if(!$i(this.stickyNodes,i.stickyNodes,f7i)||this.count===0)return!1;let e=this.stickyNodes[this.count-1],t=i.stickyNodes[i.count-1];return e.position!==t.position}},Aai=class{constrainStickyScrollNodes(i,e,t){for(let o=0;o<i.length;o++){let n=i[o];if(n.position+n.height>t||o>=e)return i.slice(0,o)}return i}},QCt=class extends x{constructor(e,t,o,n,r,s={}){super();this.tree=e;this.model=t;this.view=o;this.treeDelegate=r;this.maxWidgetViewRatio=.4;let l=this.validateStickySettings(s);this.stickyScrollMaxItemCount=l.stickyScrollMaxItemCount,this.stickyScrollDelegate=s.stickyScrollDelegate??new Aai,this.paddingTop=s.paddingTop??0,this._widget=this._register(new Nai(o.getScrollableElement(),o,e,n,r,s.accessibilityProvider)),this.onDidChangeHasFocus=this._widget.onDidChangeHasFocus,this.onContextMenu=this._widget.onContextMenu,this._register(o.onDidScroll(()=>this.update())),this._register(o.onDidChangeContentHeight(()=>this.update())),this._register(e.onDidChangeCollapseState(()=>this.update())),this._register(t.onDidSpliceRenderedNodes(c=>{let u=this._widget.state;if(!u)return;if(c.deleteCount>0&&u.stickyNodes.some(g=>!this.model.has(this.model.getNodeLocation(g.node)))){this.update();return}u.stickyNodes.some(g=>{let f=this.model.getListIndex(this.model.getNodeLocation(g.node));return f>=c.start&&f<c.start+c.deleteCount&&u.contains(g.node)})&&this._widget.rerender()})),this.update()}get height(){return this._widget.height}get count(){return this._widget.count}getNode(e){return this._widget.getNode(e)}getNodeAtHeight(e){let t;if(e===0?t=this.view.firstVisibleIndex:t=this.view.indexAt(e+this.view.scrollTop),!(t<0||t>=this.view.length))return this.view.element(t)}update(){let e=this.getNodeAtHeight(this.paddingTop);if(!e||this.tree.scrollTop<=this.paddingTop||this.view.renderHeight===0){this._widget.setState(void 0);return}let t=this.findStickyState(e);this._widget.setState(t)}findStickyState(e){let t=[],o=e,n=0,r=this.getNextStickyNode(o,void 0,n);for(;r&&(t.push(r),n+=r.height,!(t.length<=this.stickyScrollMaxItemCount&&(o=this.getNextVisibleNode(r),!o)));)r=this.getNextStickyNode(o,r.node,n);let s=this.constrainStickyNodes(t);return s.length?new Pai(s):void 0}getNextVisibleNode(e){return this.getNodeAtHeight(e.position+e.height)}getNextStickyNode(e,t,o){let n=this.getAncestorUnderPrevious(e,t);if(n&&!(n===e&&(!this.nodeIsUncollapsedParent(e)||this.nodeTopAlignsWithStickyNodesBottom(e,o))))return this.createStickyScrollNode(n,o)}nodeTopAlignsWithStickyNodesBottom(e,t){let o=this.getNodeIndex(e),n=this.view.getElementTop(o),r=t;return this.view.scrollTop===n-r}createStickyScrollNode(e,t){let o=this.treeDelegate.getHeight(e),{startIndex:n,endIndex:r}=this.getNodeRange(e),s=this.calculateStickyNodePosition(r,t,o);return{node:e,position:s,height:o,startIndex:n,endIndex:r}}getAncestorUnderPrevious(e,t=void 0){let o=e,n=this.getParentNode(o);for(;n;){if(n===t)return o;o=n,n=this.getParentNode(o)}if(t===void 0)return o}calculateStickyNodePosition(e,t,o){let n=this.view.getRelativeTop(e);if(n===null&&this.view.firstVisibleIndex===e&&e+1<this.view.length){let u=this.treeDelegate.getHeight(this.view.element(e)),p=this.view.getRelativeTop(e+1);n=p?p-u/this.view.renderHeight:null}if(n===null)return t;let r=this.view.element(e),s=this.treeDelegate.getHeight(r),c=n*this.view.renderHeight+s;return t+o>c&&t<=c?c-o:t}constrainStickyNodes(e){if(e.length===0)return[];let t=this.view.renderHeight*this.maxWidgetViewRatio,o=e[e.length-1];if(e.length<=this.stickyScrollMaxItemCount&&o.position+o.height<=t)return e;let n=this.stickyScrollDelegate.constrainStickyScrollNodes(e,this.stickyScrollMaxItemCount,t);if(!n.length)return[];let r=n[n.length-1];if(n.length>this.stickyScrollMaxItemCount||r.position+r.height>t)throw new Error("stickyScrollDelegate violates constraints");return n}getParentNode(e){let t=this.model.getNodeLocation(e),o=this.model.getParentNodeLocation(t);return o?this.model.getNode(o):void 0}nodeIsUncollapsedParent(e){let t=this.model.getNodeLocation(e);return this.model.getListRenderCount(t)>1}getNodeIndex(e){let t=this.model.getNodeLocation(e);return this.model.getListIndex(t)}getNodeRange(e){let t=this.model.getNodeLocation(e),o=this.model.getListIndex(t);if(o<0)throw new Error("Node not found in tree");let n=this.model.getListRenderCount(t),r=o+n-1;return{startIndex:o,endIndex:r}}nodePositionTopBelowWidget(e){let t=[],o=this.getParentNode(e);for(;o;)t.push(o),o=this.getParentNode(o);let n=0;for(let r=0;r<t.length&&r<this.stickyScrollMaxItemCount;r++)n+=this.treeDelegate.getHeight(t[r]);return n}getFocus(){return this._widget.getFocus()}domFocus(){this._widget.domFocus()}focusedLast(){return this._widget.focusedLast()}updateOptions(e={}){if(e.paddingTop!==void 0&&(this.paddingTop=e.paddingTop),e.stickyScrollMaxItemCount!==void 0){let t=this.validateStickySettings(e);this.stickyScrollMaxItemCount!==t.stickyScrollMaxItemCount&&(this.stickyScrollMaxItemCount=t.stickyScrollMaxItemCount,this.update())}}validateStickySettings(e){let t=7;return typeof e.stickyScrollMaxItemCount=="number"&&(t=Math.max(e.stickyScrollMaxItemCount,1)),{stickyScrollMaxItemCount:t}}},Nai=class{constructor(i,e,t,o,n,r){this.view=e;this.tree=t;this.treeRenderers=o;this.treeDelegate=n;this.accessibilityProvider=r;this._previousElements=[];this._previousStateDisposables=new N;this._rootDomNode=_(".monaco-tree-sticky-container.empty"),i.appendChild(this._rootDomNode);let s=_(".monaco-tree-sticky-container-shadow");this._rootDomNode.appendChild(s),this.stickyScrollFocus=new Oai(this._rootDomNode,e),this.onDidChangeHasFocus=this.stickyScrollFocus.onDidChangeHasFocus,this.onContextMenu=this.stickyScrollFocus.onContextMenu}get state(){return this._previousState}get height(){if(!this._previousState)return 0;let i=this._previousState.stickyNodes[this._previousState.count-1];return i.position+i.height}get count(){return this._previousState?.count??0}getNode(i){return this._previousState?.stickyNodes.find(e=>e.node===i)}setState(i){let e=!!this._previousState&&this._previousState.count>0,t=!!i&&i.count>0;if(!e&&!t||e&&t&&this._previousState.equal(i))return;if(e!==t&&this.setVisible(t),!t){this._previousState=void 0,this._previousElements=[],this._previousStateDisposables.clear();return}let o=i.stickyNodes[i.count-1];this._previousState&&i.animationStateChanged(this._previousState)?this._previousElements[this._previousState.count-1].style.top=`${o.position}px`:this.renderState(i),this._previousState=i,this._rootDomNode.style.height=`${o.position+o.height}px`}renderState(i){this._previousStateDisposables.clear();let e=Array(i.count);for(let t=i.count-1;t>=0;t--){let o=i.stickyNodes[t],{element:n,disposable:r}=this.createElement(o,t,i.count);e[t]=n,this._rootDomNode.appendChild(n),this._previousStateDisposables.add(r)}this.stickyScrollFocus.updateElements(e,i),this._previousElements=e}rerender(){this._previousState&&this.renderState(this._previousState)}createElement(i,e,t){let o=i.startIndex,n=document.createElement("div");n.style.top=`${i.position}px`,this.tree.options.setRowHeight!==!1&&(n.style.height=`${i.height}px`),this.tree.options.setRowLineHeight!==!1&&(n.style.lineHeight=`${i.height}px`),n.classList.add("monaco-tree-sticky-row"),n.classList.add("monaco-list-row"),n.setAttribute("data-index",`${o}`),n.setAttribute("data-parity",o%2===0?"even":"odd"),n.setAttribute("id",this.view.getElementID(o));let r=this.setAccessibilityAttributes(n,i.node.element,e,t),s=this.treeDelegate.getTemplateId(i.node),l=this.treeRenderers.find(h=>h.templateId===s);if(!l)throw new Error(`No renderer found for template id ${s}`);let c=i.node;c===this.tree.getNode(this.tree.getNodeLocation(i.node))&&(c=new Proxy(i.node,{}));let u=l.renderTemplate(n);l.renderElement(c,i.startIndex,u,{height:i.height});let p=Z(()=>{r.dispose(),l.disposeElement(c,i.startIndex,u,{height:i.height}),l.disposeTemplate(u),n.remove()});return{element:n,disposable:p}}setAccessibilityAttributes(i,e,t,o){if(!this.accessibilityProvider)return x.None;this.accessibilityProvider.getSetSize&&i.setAttribute("aria-setsize",String(this.accessibilityProvider.getSetSize(e,t,o))),this.accessibilityProvider.getPosInSet&&i.setAttribute("aria-posinset",String(this.accessibilityProvider.getPosInSet(e,t))),this.accessibilityProvider.getRole&&i.setAttribute("role",this.accessibilityProvider.getRole(e)??"treeitem");let n=this.accessibilityProvider.getAriaLabel(e),r=n&&typeof n!="string"?n:So(n),s=be(c=>{let u=c.readObservable(r);u?i.setAttribute("aria-label",u):i.removeAttribute("aria-label")});typeof n=="string"||n&&i.setAttribute("aria-label",n.get());let l=this.accessibilityProvider.getAriaLevel&&this.accessibilityProvider.getAriaLevel(e);return typeof l=="number"&&i.setAttribute("aria-level",`${l}`),i.setAttribute("aria-selected",String(!1)),s}setVisible(i){this._rootDomNode.classList.toggle("empty",!i),i||this.stickyScrollFocus.updateElements([],void 0)}getFocus(){return this.stickyScrollFocus.getFocus()}domFocus(){this.stickyScrollFocus.domFocus()}focusedLast(){return this.stickyScrollFocus.focusedLast()}dispose(){this.stickyScrollFocus.dispose(),this._previousStateDisposables.dispose(),this._rootDomNode.remove()}},Oai=class extends x{constructor(e,t){super();this.container=e;this.view=t;this.focusedIndex=-1;this.elements=[];this._onDidChangeHasFocus=this._register(new E);this.onDidChangeHasFocus=this._onDidChangeHasFocus.event;this._onContextMenu=this._register(new E);this.onContextMenu=this._onContextMenu.event;this._domHasFocus=!1;this._register(j(this.container,"focus",()=>this.onFocus())),this._register(j(this.container,"blur",()=>this.onBlur())),this._register(this.view.onDidFocus(()=>this.toggleStickyScrollFocused(!1))),this._register(this.view.onKeyDown(o=>this.onKeyDown(o))),this._register(this.view.onMouseDown(o=>this.onMouseDown(o))),this._register(this.view.onContextMenu(o=>this.handleContextMenu(o)))}get domHasFocus(){return this._domHasFocus}set domHasFocus(e){e!==this._domHasFocus&&(this._onDidChangeHasFocus.fire(e),this._domHasFocus=e)}handleContextMenu(e){let t=e.browserEvent.target;if(!CCe(t)&&!wCe(t)){this.focusedLast()&&this.view.domFocus();return}if(!xg(e.browserEvent)){if(!this.state)throw new Error("Context menu should not be triggered when state is undefined");let s=this.state.stickyNodes.findIndex(l=>l.node.element===e.element?.element);if(s===-1)throw new Error("Context menu should not be triggered when element is not in sticky scroll widget");this.container.focus(),this.setFocus(s);return}if(!this.state||this.focusedIndex<0)throw new Error("Context menu key should not be triggered when focus is not in sticky scroll widget");let n=this.state.stickyNodes[this.focusedIndex].node.element,r=this.elements[this.focusedIndex];this._onContextMenu.fire({element:n,anchor:r,browserEvent:e.browserEvent,isStickyScroll:!0})}onKeyDown(e){if(this.domHasFocus&&this.state){if(e.key==="ArrowUp")this.setFocusedElement(Math.max(0,this.focusedIndex-1)),e.preventDefault(),e.stopPropagation();else if(e.key==="ArrowDown"||e.key==="ArrowRight"){if(this.focusedIndex>=this.state.count-1){let t=this.state.stickyNodes[this.state.count-1].startIndex+1;this.view.domFocus(),this.view.setFocus([t]),this.scrollNodeUnderWidget(t,this.state)}else this.setFocusedElement(this.focusedIndex+1);e.preventDefault(),e.stopPropagation()}}}onMouseDown(e){let t=e.browserEvent.target;!CCe(t)&&!wCe(t)||(e.browserEvent.preventDefault(),e.browserEvent.stopPropagation())}updateElements(e,t){if(t&&t.count===0)throw new Error("Sticky scroll state must be undefined when there are no sticky nodes");if(t&&t.count!==e.length)throw new Error("Sticky scroll focus received illigel state");let o=this.focusedIndex;if(this.removeFocus(),this.elements=e,this.state=t,t){let n=Bn(o,0,t.count-1);this.setFocus(n)}else this.domHasFocus&&this.view.domFocus();this.container.tabIndex=t?0:-1}setFocusedElement(e){let t=this.state;if(!t)throw new Error("Cannot set focus when state is undefined");if(this.setFocus(e),!(e<t.count-1)&&t.lastNodePartiallyVisible()){let o=t.stickyNodes[e];this.scrollNodeUnderWidget(o.endIndex+1,t)}}scrollNodeUnderWidget(e,t){let o=t.stickyNodes[t.count-1],n=t.count>1?t.stickyNodes[t.count-2]:void 0,r=this.view.getElementTop(e),s=n?n.position+n.height+o.height:o.height;this.view.scrollTop=r-s}getFocus(){if(!(!this.state||this.focusedIndex===-1))return this.state.stickyNodes[this.focusedIndex].node.element}domFocus(){if(!this.state)throw new Error("Cannot focus when state is undefined");this.container.focus()}focusedLast(){return this.state?this.view.getHTMLElement().classList.contains("sticky-scroll-focused"):!1}removeFocus(){this.focusedIndex!==-1&&(this.toggleElementFocus(this.elements[this.focusedIndex],!1),this.focusedIndex=-1)}setFocus(e){if(0>e)throw new Error("addFocus() can not remove focus");if(!this.state&&e>=0)throw new Error("Cannot set focus index when state is undefined");if(this.state&&e>=this.state.count)throw new Error("Cannot set focus index to an index that does not exist");let t=this.focusedIndex;t>=0&&this.toggleElementFocus(this.elements[t],!1),e>=0&&this.toggleElementFocus(this.elements[e],!0),this.focusedIndex=e}toggleElementFocus(e,t){this.toggleElementActiveFocus(e,t&&this.domHasFocus),this.toggleElementPassiveFocus(e,t)}toggleCurrentElementActiveFocus(e){this.focusedIndex!==-1&&this.toggleElementActiveFocus(this.elements[this.focusedIndex],e)}toggleElementActiveFocus(e,t){e.classList.toggle("focused",t)}toggleElementPassiveFocus(e,t){e.classList.toggle("passive-focused",t)}toggleStickyScrollFocused(e){this.view.getHTMLElement().classList.toggle("sticky-scroll-focused",e)}onFocus(){if(!this.state||this.elements.length===0)throw new Error("Cannot focus when state is undefined or elements are empty");this.domHasFocus=!0,this.toggleStickyScrollFocused(!0),this.toggleCurrentElementActiveFocus(!0),this.focusedIndex===-1&&this.setFocus(0)}onBlur(){this.domHasFocus=!1,this.toggleCurrentElementActiveFocus(!1)}dispose(){this.toggleStickyScrollFocused(!1),this._onDidChangeHasFocus.fire(!1),super.dispose()}};function Tce(a){let i=0;return PIe(a.browserEvent.target,"monaco-tl-twistie","monaco-tl-row")?i=1:PIe(a.browserEvent.target,"monaco-tl-contents","monaco-tl-row")?i=2:PIe(a.browserEvent.target,"monaco-tree-type-filter","monaco-list")&&(i=3),{browserEvent:a.browserEvent,element:a.element?a.element.element:null,target:i}}function Ozo(a){let i=CCe(a.browserEvent.target);return{element:a.element?a.element.element:null,browserEvent:a.browserEvent,anchor:a.anchor,isStickyScroll:i}}function jCt(a,i){i(a),a.children.forEach(e=>jCt(e,i))}var E3e=class{constructor(i,e){this.getFirstViewElementWithTrait=i;this.identityProvider=e;this.nodes=[];this._onDidChange=new E;this.onDidChange=this._onDidChange.event}get nodeSet(){return this._nodeSet||(this._nodeSet=this.createNodeSet()),this._nodeSet}set(i,e){!e?.__forceEvent&&$i(this.nodes,i)||this._set(i,!1,e)}_set(i,e,t){if(this.nodes=[...i],this.elements=void 0,this._nodeSet=void 0,!e){let o=this;this._onDidChange.fire({get elements(){return o.get()},browserEvent:t})}}get(){return this.elements||(this.elements=this.nodes.map(i=>i.element)),[...this.elements]}getNodes(){return this.nodes}has(i){return this.nodeSet.has(i)}onDidModelSplice({insertedNodes:i,deletedNodes:e}){if(!this.identityProvider){let l=this.createNodeSet(),c=u=>l.delete(u);e.forEach(u=>jCt(u,c)),this.set([...l.values()]);return}let t=new Set,o=l=>t.add(this.identityProvider.getId(l.element).toString());e.forEach(l=>jCt(l,o));let n=new Map,r=l=>n.set(this.identityProvider.getId(l.element).toString(),l);i.forEach(l=>jCt(l,r));let s=[];for(let l of this.nodes){let c=this.identityProvider.getId(l.element).toString();if(!t.has(c))s.push(l);else{let p=n.get(c);p&&p.visible&&s.push(p)}}if(this.nodes.length>0&&s.length===0){let l=this.getFirstViewElementWithTrait();l&&s.push(l)}this._set(s,!0)}createNodeSet(){let i=new Set;for(let e of this.nodes)i.add(e);return i}},Fai=class extends zle{constructor(e,t,o){super(e);this.tree=t;this.stickyScrollProvider=o}onViewPointer(e){if(qni(e.browserEvent.target)||Kh(e.browserEvent.target)||cY(e.browserEvent.target)||e.browserEvent.isHandledByList)return;let t=e.element;if(!t)return super.onViewPointer(e);if(this.isSelectionRangeChangeEvent(e)||this.isSelectionSingleChangeEvent(e))return super.onViewPointer(e);let o=e.browserEvent.target,n=o.classList.contains("monaco-tl-twistie")||o.classList.contains("monaco-icon-label")&&o.classList.contains("folder-icon")&&e.browserEvent.offsetX<16,r=wCe(e.browserEvent.target),s=!1;if(r?s=!0:typeof this.tree.expandOnlyOnTwistieClick=="function"?s=this.tree.expandOnlyOnTwistieClick(t.element):s=!!this.tree.expandOnlyOnTwistieClick,r)this.handleStickyScrollMouseEvent(e,t);else{if(s&&!n&&e.browserEvent.detail!==2)return super.onViewPointer(e);if(!this.tree.expandOnDoubleClick&&e.browserEvent.detail===2)return super.onViewPointer(e)}if(t.collapsible&&(!r||n)){let l=this.tree.getNodeLocation(t),c=e.browserEvent.altKey;if(this.tree.setFocus([l]),this.tree.toggleCollapsed(l,c),n){e.browserEvent.isHandledByList=!0;return}}r||super.onViewPointer(e)}handleStickyScrollMouseEvent(e,t){if(bQi(e.browserEvent.target)||SQi(e.browserEvent.target))return;let o=this.stickyScrollProvider();if(!o)throw new Error("Sticky scroll controller not found");let n=this.list.indexOf(t),r=this.list.getElementTop(n),s=o.nodePositionTopBelowWidget(t);this.tree.scrollTop=r-s,this.list.domFocus(),this.list.setFocus([n]),this.list.setSelection([n])}onDoubleClick(e){e.browserEvent.target.classList.contains("monaco-tl-twistie")||!this.tree.expandOnDoubleClick||e.browserEvent.isHandledByList||super.onDoubleClick(e)}onMouseDown(e){let t=e.browserEvent.target;if(!CCe(t)&&!wCe(t)){super.onMouseDown(e);return}}onContextMenu(e){let t=e.browserEvent.target;if(!CCe(t)&&!wCe(t)){super.onContextMenu(e);return}}},Wai=class extends Cc{constructor(e,t,o,n,r,s,l,c){super(e,t,o,n,c);this.focusTrait=r;this.selectionTrait=s;this.anchorTrait=l}createMouseController(e){return new Fai(this,e.tree,e.stickyScrollProvider)}splice(e,t,o=[]){if(super.splice(e,t,o),o.length===0)return;let n=[],r=[],s;o.forEach((l,c)=>{this.focusTrait.has(l)&&n.push(e+c),this.selectionTrait.has(l)&&r.push(e+c),this.anchorTrait.has(l)&&(s=e+c)}),n.length>0&&super.setFocus(zo([...super.getFocus(),...n])),r.length>0&&super.setSelection(zo([...super.getSelection(),...r])),typeof s=="number"&&super.setAnchor(s)}setFocus(e,t,o=!1){super.setFocus(e,t),o||this.focusTrait.set(e.map(n=>this.element(n)),t)}setSelection(e,t,o=!1){super.setSelection(e,t),o||this.selectionTrait.set(e.map(n=>this.element(n)),t)}setAnchor(e,t=!1){super.setAnchor(e),t||(typeof e>"u"?this.anchorTrait.set([]):this.anchorTrait.set([this.element(e)]))}};var ZV=class{constructor(i,e,t,o,n={}){this._user=i;this._options=n;this.eventBufferer=new QN;this.onDidChangeFindOpenState=U.None;this.onDidChangeStickyScrollFocused=U.None;this.disposables=new N;this.onDidSwapModel=this.disposables.add(new E);this.onDidChangeModelRelay=this.disposables.add(new Bh);this.onDidSpliceModelRelay=this.disposables.add(new Bh);this.onDidChangeCollapseStateRelay=this.disposables.add(new Bh);this.onDidChangeRenderNodeCountRelay=this.disposables.add(new Bh);this.onDidChangeActiveNodesRelay=this.disposables.add(new Bh);this._onWillRefilter=new E;this.onWillRefilter=this._onWillRefilter.event;this._onDidUpdateOptions=new E;this.onDidUpdateOptions=this._onDidUpdateOptions.event;this.modelDisposables=new N;n.keyboardNavigationLabelProvider&&(n.findWidgetEnabled??!0)&&(this.findFilter=new _3e(n.keyboardNavigationLabelProvider,n.filter,n.defaultFindVisibility),n={...n,filter:this.findFilter},this.disposables.add(this.findFilter)),this.model=this.createModel(i,n),this.treeDelegate=new Pxe(t);let r=this.disposables.add(new Tai(this.onDidChangeActiveNodesRelay.event)),s=new n1;this.renderers=o.map(l=>new _ai(l,this.model,this.onDidChangeCollapseStateRelay.event,r,s,n));for(let l of this.renderers)this.disposables.add(l);if(this.focus=new E3e(()=>this.view.getFocusedElements()[0],n.identityProvider),this.selection=new E3e(()=>this.view.getSelectedElements()[0],n.identityProvider),this.anchor=new E3e(()=>this.view.getAnchorElement(),n.identityProvider),this.view=new Wai(i,e,this.treeDelegate,this.renderers,this.focus,this.selection,this.anchor,{...Mzo(()=>this.model,this.disposables,n),tree:this,stickyScrollProvider:()=>this.stickyScrollController}),this.setupModel(this.model),n.keyboardSupport!==!1){let l=U.chain(this.view.onKeyDown,c=>c.filter(u=>!Kh(u.target)).map(u=>new gi(u)));U.chain(l,c=>c.filter(u=>u.keyCode===15))(this.onLeftArrow,this,this.disposables),U.chain(l,c=>c.filter(u=>u.keyCode===17))(this.onRightArrow,this,this.disposables),U.chain(l,c=>c.filter(u=>u.keyCode===10))(this.onSpace,this,this.disposables)}if((n.findWidgetEnabled??!0)&&n.keyboardNavigationLabelProvider&&n.contextViewProvider){let l={styles:n.findWidgetStyles,defaultFindMode:n.defaultFindMode,defaultFindMatchType:n.defaultFindMatchType,showNotFoundMessage:n.showNotFoundMessage};this.findController=this.disposables.add(new D3e(this,this.findFilter,n.contextViewProvider,l)),this.focusNavigationFilter=c=>this.findController.shouldAllowFocus(c),this.onDidChangeFindOpenState=this.findController.onDidChangeOpenState,this.onDidChangeFindMode=this.findController.onDidChangeMode,this.onDidChangeFindMatchType=this.findController.onDidChangeMatchType}else this.onDidChangeFindMode=U.None,this.onDidChangeFindMatchType=U.None;n.enableStickyScroll&&(this.stickyScrollController=new QCt(this,this.model,this.view,this.renderers,this.treeDelegate,n),this.onDidChangeStickyScrollFocused=this.stickyScrollController.onDidChangeHasFocus),this.styleElement=Cr(this.view.getHTMLElement()),this.getHTMLElement().classList.toggle("always",this._options.renderIndentGuides==="always")}get onDidScroll(){return this.view.onDidScroll}get onDidChangeFocus(){return this.eventBufferer.wrapEvent(this.focus.onDidChange)}get onDidChangeSelection(){return this.eventBufferer.wrapEvent(this.selection.onDidChange)}get onMouseClick(){return U.map(this.view.onMouseClick,Tce)}get onMouseDblClick(){return U.filter(U.map(this.view.onMouseDblClick,Tce),i=>i.target!==3)}get onMouseMiddleClick(){return U.filter(U.map(this.view.onMouseMiddleClick,Tce),i=>i.target!==3)}get onMouseOver(){return U.map(this.view.onMouseOver,Tce)}get onMouseOut(){return U.map(this.view.onMouseOut,Tce)}get onContextMenu(){return U.any(U.filter(U.map(this.view.onContextMenu,Ozo),i=>!i.isStickyScroll),this.stickyScrollController?.onContextMenu??U.None)}get onTap(){return U.map(this.view.onTap,Tce)}get onPointer(){return U.map(this.view.onPointer,Tce)}get onKeyDown(){return this.view.onKeyDown}get onKeyUp(){return this.view.onKeyUp}get onKeyPress(){return this.view.onKeyPress}get onDidFocus(){return this.view.onDidFocus}get onDidBlur(){return this.view.onDidBlur}get onDidChangeModel(){return U.any(this.onDidChangeModelRelay.event,this.onDidSwapModel.event)}get onDidChangeCollapseState(){return this.onDidChangeCollapseStateRelay.event}get onDidChangeRenderNodeCount(){return this.onDidChangeRenderNodeCountRelay.event}get findMode(){return this.findController?.mode??0}set findMode(i){this.findController&&(this.findController.mode=i)}get findMatchType(){return this.findController?.matchType??0}set findMatchType(i){this.findController&&(this.findController.matchType=i)}get onDidChangeFindPattern(){return this.findController?this.findController.onDidChangePattern:U.None}get expandOnDoubleClick(){return typeof this._options.expandOnDoubleClick>"u"?!0:this._options.expandOnDoubleClick}get expandOnlyOnTwistieClick(){return typeof this._options.expandOnlyOnTwistieClick>"u"?!0:this._options.expandOnlyOnTwistieClick}get onDidDispose(){return this.view.onDidDispose}updateOptions(i={}){this._options={...this._options,...i};for(let e of this.renderers)e.updateOptions(i);this.view.updateOptions(i),this.findController?.updateOptions(i),this.updateStickyScroll(i),this._onDidUpdateOptions.fire(this._options),this.getHTMLElement().classList.toggle("always",this._options.renderIndentGuides==="always")}get options(){return this._options}updateStickyScroll(i){!this.stickyScrollController&&this._options.enableStickyScroll?(this.stickyScrollController=new QCt(this,this.model,this.view,this.renderers,this.treeDelegate,this._options),this.onDidChangeStickyScrollFocused=this.stickyScrollController.onDidChangeHasFocus):this.stickyScrollController&&!this._options.enableStickyScroll&&(this.onDidChangeStickyScrollFocused=U.None,this.stickyScrollController.dispose(),this.stickyScrollController=void 0),this.stickyScrollController?.updateOptions(i)}updateWidth(i){let e=this.model.getListIndex(i);e!==-1&&this.view.updateWidth(e)}getHTMLElement(){return this.view.getHTMLElement()}get contentHeight(){return this.view.contentHeight}get contentWidth(){return this.view.contentWidth}get onDidChangeContentHeight(){return this.view.onDidChangeContentHeight}get onDidChangeContentWidth(){return this.view.onDidChangeContentWidth}get scrollTop(){return this.view.scrollTop}set scrollTop(i){this.view.scrollTop=i}get scrollLeft(){return this.view.scrollLeft}set scrollLeft(i){this.view.scrollLeft=i}get scrollHeight(){return this.view.scrollHeight}get renderHeight(){return this.view.renderHeight}get firstVisibleElement(){let i=this.view.firstVisibleIndex;return this.stickyScrollController&&(i+=this.stickyScrollController.count),i<0||i>=this.view.length?void 0:this.view.element(i).element}get lastVisibleElement(){let i=this.view.lastVisibleIndex;return this.view.element(i).element}get ariaLabel(){return this.view.ariaLabel}set ariaLabel(i){this.view.ariaLabel=i}get selectionSize(){return this.selection.getNodes().length}domFocus(){this.stickyScrollController?.focusedLast()?this.stickyScrollController.domFocus():this.view.domFocus()}isDOMFocused(){return wa(this.getHTMLElement())}layout(i,e){this.view.layout(i,e)}style(i){let e=`.${this.view.domId}`,t=[];i.treeIndentGuidesStroke&&(t.push(`.monaco-list${e}:hover .monaco-tl-indent > .indent-guide, .monaco-list${e}.always .monaco-tl-indent > .indent-guide  { opacity: 1; border-color: ${i.treeInactiveIndentGuidesStroke}; }`),t.push(`.monaco-list${e} .monaco-tl-indent > .indent-guide.active { opacity: 1; border-color: ${i.treeIndentGuidesStroke}; }`));let o=i.treeStickyScrollBackground??i.listBackground;o&&(t.push(`.monaco-list${e} .monaco-scrollable-element .monaco-tree-sticky-container { background-color: ${o}; }`),t.push(`.monaco-list${e} .monaco-scrollable-element .monaco-tree-sticky-container .monaco-tree-sticky-row { background-color: ${o}; }`)),i.treeStickyScrollBorder&&t.push(`.monaco-list${e} .monaco-scrollable-element .monaco-tree-sticky-container { border-bottom: 1px solid ${i.treeStickyScrollBorder}; }`),i.treeStickyScrollShadow&&t.push(`.monaco-list${e} .monaco-scrollable-element .monaco-tree-sticky-container .monaco-tree-sticky-container-shadow { box-shadow: ${i.treeStickyScrollShadow} 0 6px 6px -6px inset; height: 3px; }`),i.listFocusForeground&&(t.push(`.monaco-list${e}.sticky-scroll-focused .monaco-scrollable-element .monaco-tree-sticky-container:focus .monaco-list-row.focused { color: ${i.listFocusForeground}; }`),t.push(`.monaco-list${e}:not(.sticky-scroll-focused) .monaco-scrollable-element .monaco-tree-sticky-container .monaco-list-row.focused { color: inherit; }`));let n=O_(i.listFocusAndSelectionOutline,O_(i.listSelectionOutline,i.listFocusOutline??""));n&&(t.push(`.monaco-list${e}.sticky-scroll-focused .monaco-scrollable-element .monaco-tree-sticky-container:focus .monaco-list-row.focused.selected { outline: 1px solid ${n}; outline-offset: -1px;}`),t.push(`.monaco-list${e}:not(.sticky-scroll-focused) .monaco-scrollable-element .monaco-tree-sticky-container .monaco-list-row.focused.selected { outline: inherit;}`)),i.listFocusOutline&&(t.push(`.monaco-list${e}.sticky-scroll-focused .monaco-scrollable-element .monaco-tree-sticky-container:focus .monaco-list-row.focused { outline: 1px solid ${i.listFocusOutline}; outline-offset: -1px; }`),t.push(`.monaco-list${e}:not(.sticky-scroll-focused) .monaco-scrollable-element .monaco-tree-sticky-container .monaco-list-row.focused { outline: inherit; }`),t.push(`.context-menu-visible .monaco-list${e}.last-focused.sticky-scroll-focused .monaco-scrollable-element .monaco-tree-sticky-container .monaco-list-row.passive-focused { outline: 1px solid ${i.listFocusOutline}; outline-offset: -1px; }`),t.push(`.context-menu-visible .monaco-list${e}.last-focused.sticky-scroll-focused .monaco-list-rows .monaco-list-row.focused { outline: inherit; }`),t.push(`.context-menu-visible .monaco-list${e}.last-focused:not(.sticky-scroll-focused) .monaco-tree-sticky-container .monaco-list-rows .monaco-list-row.focused { outline: inherit; }`)),this.styleElement.textContent=t.join(`
`),this.view.style(i)}getParentElement(i){let e=this.model.getParentNodeLocation(i);return this.model.getNode(e).element}getFirstElementChild(i){return this.model.getFirstElementChild(i)}getNode(i){return this.model.getNode(i)}getNodeLocation(i){return this.model.getNodeLocation(i)}collapse(i,e=!1){return this.model.setCollapsed(i,!0,e)}expand(i,e=!1){return this.model.setCollapsed(i,!1,e)}toggleCollapsed(i,e=!1){return this.model.setCollapsed(i,void 0,e)}expandAll(){this.model.setCollapsed(this.model.rootRef,!1,!0)}collapseAll(){this.model.setCollapsed(this.model.rootRef,!0,!0)}isCollapsible(i){return this.model.isCollapsible(i)}setCollapsible(i,e){return this.model.setCollapsible(i,e)}isCollapsed(i){return this.model.isCollapsed(i)}expandTo(i){this.model.expandTo(i)}triggerTypeNavigation(){this.view.triggerTypeNavigation()}openFind(){this.findController?.open()}closeFind(){this.findController?.close()}refilter(){this._onWillRefilter.fire(void 0),this.model.refilter()}setAnchor(i){if(typeof i>"u")return this.view.setAnchor(void 0);this.eventBufferer.bufferEvents(()=>{let e=this.model.getNode(i);this.anchor.set([e]);let t=this.model.getListIndex(i);t>-1&&this.view.setAnchor(t,!0)})}getAnchor(){return this.anchor.get().at(0)}setSelection(i,e){this.eventBufferer.bufferEvents(()=>{let t=i.map(n=>this.model.getNode(n));this.selection.set(t,e);let o=i.map(n=>this.model.getListIndex(n)).filter(n=>n>-1);this.view.setSelection(o,e,!0)})}getSelection(){return this.selection.get()}setFocus(i,e){this.eventBufferer.bufferEvents(()=>{let t=i.map(n=>this.model.getNode(n));this.focus.set(t,e);let o=i.map(n=>this.model.getListIndex(n)).filter(n=>n>-1);this.view.setFocus(o,e,!0)})}focusNext(i=1,e=!1,t,o=xg(t)&&t.altKey?void 0:this.focusNavigationFilter){this.view.focusNext(i,e,t,o)}focusPrevious(i=1,e=!1,t,o=xg(t)&&t.altKey?void 0:this.focusNavigationFilter){this.view.focusPrevious(i,e,t,o)}focusNextPage(i,e=xg(i)&&i.altKey?void 0:this.focusNavigationFilter){return this.view.focusNextPage(i,e)}focusPreviousPage(i,e=xg(i)&&i.altKey?void 0:this.focusNavigationFilter){return this.view.focusPreviousPage(i,e,()=>this.stickyScrollController?.height??0)}focusLast(i,e=xg(i)&&i.altKey?void 0:this.focusNavigationFilter){this.view.focusLast(i,e)}focusFirst(i,e=xg(i)&&i.altKey?void 0:this.focusNavigationFilter){this.view.focusFirst(i,e)}getFocus(){return this.focus.get()}getStickyScrollFocus(){let i=this.stickyScrollController?.getFocus();return i!==void 0?[i]:[]}getFocusedPart(){return this.stickyScrollController?.focusedLast()?1:0}reveal(i,e){this.model.expandTo(i);let t=this.model.getListIndex(i);if(t!==-1)if(!this.stickyScrollController)this.view.reveal(t,e);else{let o=this.stickyScrollController.nodePositionTopBelowWidget(this.getNode(i));this.view.reveal(t,e,o)}}getRelativeTop(i){let e=this.model.getListIndex(i);if(e===-1)return null;let t=this.stickyScrollController?.getNode(this.getNode(i));return this.view.getRelativeTop(e,t?.position??this.stickyScrollController?.height)}getViewState(i=this.options.identityProvider){if(!i)throw new Lg(this._user,"Can't get tree view state without an identity provider");let e=r=>i.getId(r).toString(),t=T3e.empty(this.scrollTop);for(let r of this.getFocus())t.focus.add(e(r));for(let r of this.getSelection())t.selection.add(e(r));let o=this.model.getNode(),n=[o];for(;n.length>0;){let r=n.pop();r!==o&&r.collapsible&&(t.expanded[e(r.element)]=r.collapsed?0:1),Nse(n,n.length,r.children)}return t}onLeftArrow(i){i.preventDefault(),i.stopPropagation();let e=this.view.getFocusedElements();if(e.length===0)return;let t=e[0],o=this.model.getNodeLocation(t);if(!this.model.setCollapsed(o,!0)){let r=this.model.getParentNodeLocation(o);if(!r)return;let s=this.model.getListIndex(r);this.view.reveal(s),this.view.setFocus([s])}}onRightArrow(i){i.preventDefault(),i.stopPropagation();let e=this.view.getFocusedElements();if(e.length===0)return;let t=e[0],o=this.model.getNodeLocation(t);if(!this.model.setCollapsed(o,!1)){if(!t.children.some(l=>l.visible))return;let[r]=this.view.getFocus(),s=r+1;this.view.reveal(s),this.view.setFocus([s])}}onSpace(i){i.preventDefault(),i.stopPropagation();let e=this.view.getFocusedElements();if(e.length===0)return;let t=e[0],o=this.model.getNodeLocation(t),n=i.browserEvent.altKey;this.model.setCollapsed(o,void 0,n)}setupModel(i){this.modelDisposables.clear(),this.modelDisposables.add(i.onDidSpliceRenderedNodes(({start:n,deleteCount:r,elements:s})=>this.view.splice(n,r,s)));let e=U.forEach(i.onDidSpliceModel,n=>{this.eventBufferer.bufferEvents(()=>{this.focus.onDidModelSplice(n),this.selection.onDidModelSplice(n)})},this.modelDisposables);e(()=>null,null,this.modelDisposables);let t=this.modelDisposables.add(new E),o=this.modelDisposables.add(new Xo(0));this.modelDisposables.add(U.any(e,this.focus.onDidChange,this.selection.onDidChange)(()=>{o.trigger(()=>{let n=new Set;for(let r of this.focus.getNodes())n.add(r);for(let r of this.selection.getNodes())n.add(r);t.fire([...n.values()])})})),this.onDidChangeActiveNodesRelay.input=t.event,this.onDidChangeModelRelay.input=U.signal(i.onDidSpliceModel),this.onDidChangeCollapseStateRelay.input=i.onDidChangeCollapseState,this.onDidChangeRenderNodeCountRelay.input=i.onDidChangeRenderNodeCount,this.onDidSpliceModelRelay.input=i.onDidSpliceModel,Ze&&this.modelDisposables.add(i.onDidChangeCollapseState(n=>{let{node:r,deep:s}=n;r.collapsible&&!s&&this.isDOMFocused()&&en(r.collapsed?d(39,null):d(40,null))}))}navigate(i){return new Vai(this.view,this.model,i)}delegateScrollFromMouseWheelEvent(i){this.view.delegateScrollFromMouseWheelEvent(i)}dispose(){Be(this.disposables),this.stickyScrollController?.dispose(),this.view.dispose(),this.modelDisposables.dispose()}},Vai=class{constructor(i,e,t){this.view=i;this.model=e;t?this.index=this.model.getListIndex(t):this.index=-1}current(){return this.index<0||this.index>=this.view.length?null:this.view.element(this.index).element}previous(){return this.index--,this.current()}next(){return this.index++,this.current()}first(){return this.index=0,this.current()}last(){return this.index=this.view.length-1,this.current()}};var jz=class{constructor(i,e={}){this.user=i;this.rootRef=null;this.nodes=new Map;this.nodesByIdentity=new Map;this.model=new $Ct(i,null,e),this.onDidSpliceModel=this.model.onDidSpliceModel,this.onDidSpliceRenderedNodes=this.model.onDidSpliceRenderedNodes,this.onDidChangeCollapseState=this.model.onDidChangeCollapseState,this.onDidChangeRenderNodeCount=this.model.onDidChangeRenderNodeCount,e.sorter&&(this.sorter={compare(t,o){return e.sorter.compare(t.element,o.element)}}),this.identityProvider=e.identityProvider}get size(){return this.nodes.size}setChildren(i,e=vt.empty(),t={}){let o=this.getElementLocation(i);this._setChildren(o,this.preserveCollapseState(e),t)}_setChildren(i,e=vt.empty(),t){let o=new Set,n=new Set,r=l=>{if(l.element===null)return;let c=l;if(o.add(c.element),this.nodes.set(c.element,c),this.identityProvider){let u=this.identityProvider.getId(c.element).toString();n.add(u),this.nodesByIdentity.set(u,c)}t.onDidCreateNode?.(c)},s=l=>{if(l.element===null)return;let c=l;if(o.has(c.element)||this.nodes.delete(c.element),this.identityProvider){let u=this.identityProvider.getId(c.element).toString();n.has(u)||this.nodesByIdentity.delete(u)}t.onDidDeleteNode?.(c)};this.model.splice([...i,0],Number.MAX_VALUE,e,{...t,onDidCreateNode:r,onDidDeleteNode:s})}preserveCollapseState(i=vt.empty()){return this.sorter&&(i=[...i].sort(this.sorter.compare.bind(this.sorter))),vt.map(i,e=>{let t=this.nodes.get(e.element);if(!t&&this.identityProvider){let r=this.identityProvider.getId(e.element).toString();t=this.nodesByIdentity.get(r)}if(!t){let r;return typeof e.collapsed>"u"?r=void 0:e.collapsed===1||e.collapsed===3?r=!0:e.collapsed===0||e.collapsed===2?r=!1:r=!!e.collapsed,{...e,children:this.preserveCollapseState(e.children),collapsed:r}}let o=typeof e.collapsible=="boolean"?e.collapsible:t.collapsible,n;return typeof e.collapsed>"u"||e.collapsed===3||e.collapsed===2?n=t.collapsed:e.collapsed===1?n=!0:e.collapsed===0?n=!1:n=!!e.collapsed,{...e,collapsible:o,collapsed:n,children:this.preserveCollapseState(e.children)}})}rerender(i){let e=this.getElementLocation(i);this.model.rerender(e)}resort(i=null,e=!0){if(!this.sorter)return;let t=this.getElementLocation(i),o=this.model.getNode(t);this._setChildren(t,this.resortChildren(o,e),{})}resortChildren(i,e,t=!0){let o=[...i.children];return(e||t)&&(o=o.sort(this.sorter.compare.bind(this.sorter))),vt.map(o,n=>({element:n.element,collapsible:n.collapsible,collapsed:n.collapsed,children:this.resortChildren(n,e,!1)}))}getFirstElementChild(i=null){let e=this.getElementLocation(i);return this.model.getFirstElementChild(e)}getLastElementAncestor(i=null){let e=this.getElementLocation(i);return this.model.getLastElementAncestor(e)}has(i){return this.nodes.has(i)}getListIndex(i){let e=this.getElementLocation(i);return this.model.getListIndex(e)}getListRenderCount(i){let e=this.getElementLocation(i);return this.model.getListRenderCount(e)}isCollapsible(i){let e=this.getElementLocation(i);return this.model.isCollapsible(e)}setCollapsible(i,e){let t=this.getElementLocation(i);return this.model.setCollapsible(t,e)}isCollapsed(i){let e=this.getElementLocation(i);return this.model.isCollapsed(e)}setCollapsed(i,e,t){let o=this.getElementLocation(i);return this.model.setCollapsed(o,e,t)}expandTo(i){let e=this.getElementLocation(i);this.model.expandTo(e)}refilter(){this.model.refilter()}getNode(i=null){if(i===null)return this.model.getNode(this.model.rootRef);let e=this.nodes.get(i);if(!e)throw new Lg(this.user,`Tree element not found: ${i}`);return e}getNodeLocation(i){return i.element}getParentNodeLocation(i){if(i===null)throw new Lg(this.user,"Invalid getParentNodeLocation call");let e=this.nodes.get(i);if(!e)throw new Lg(this.user,`Tree element not found: ${i}`);let t=this.model.getNodeLocation(e),o=this.model.getParentNodeLocation(t);return this.model.getNode(o).element}getElementLocation(i){if(i===null)return[];let e=this.nodes.get(i);if(!e)throw new Lg(this.user,`Tree element not found: ${i}`);return this.model.getNodeLocation(e)}};function XCt(a){let i=[a.element],e=a.incompressible||!1;return{element:{elements:i,incompressible:e},children:vt.map(vt.from(a.children),XCt),collapsible:a.collapsible,collapsed:a.collapsed}}function JCt(a){let i=[a.element],e=a.incompressible||!1,t,o;for(;[o,t]=vt.consume(vt.from(a.children),2),!(o.length!==1||o[0].incompressible);)a=o[0],i.push(a.element);return{element:{elements:i,incompressible:e},children:vt.map(vt.concat(o,t),JCt),collapsible:a.collapsible,collapsed:a.collapsed}}function Bai(a,i=0){let e;return i<a.element.elements.length-1?e=[Bai(a,i+1)]:e=vt.map(vt.from(a.children),t=>Bai(t,0)),i===0&&a.element.incompressible?{element:a.element.elements[i],children:e,incompressible:!0,collapsible:a.collapsible,collapsed:a.collapsed}:{element:a.element.elements[i],children:e,collapsible:a.collapsible,collapsed:a.collapsed}}function v7i(a){return Bai(a,0)}function b7i(a,i,e){return a.element===i?{...a,children:e}:{...a,children:vt.map(vt.from(a.children),t=>b7i(t,i,e))}}var Fzo=a=>({getId(i){return i.elements.map(e=>a.getId(e).toString()).join("\0")},getGroupId:a.getGroupId?i=>a.getGroupId(i.elements[i.elements.length-1]):void 0}),Hai=class{constructor(i,e={}){this.user=i;this.rootRef=null;this.nodes=new Map;this.model=new jz(i,e),this.enabled=typeof e.compressionEnabled>"u"?!0:e.compressionEnabled,this.identityProvider=e.identityProvider}get onDidSpliceRenderedNodes(){return this.model.onDidSpliceRenderedNodes}get onDidSpliceModel(){return this.model.onDidSpliceModel}get onDidChangeCollapseState(){return this.model.onDidChangeCollapseState}get onDidChangeRenderNodeCount(){return this.model.onDidChangeRenderNodeCount}get size(){return this.nodes.size}setChildren(i,e=vt.empty(),t){let o=t.diffIdentityProvider&&Fzo(t.diffIdentityProvider);if(i===null){let f=vt.map(e,this.enabled?JCt:XCt);this._setChildren(null,f,{diffIdentityProvider:o,diffDepth:1/0});return}let n=this.nodes.get(i);if(!n)throw new Lg(this.user,"Unknown compressed tree node");let r=this.model.getNode(n),s=this.model.getParentNodeLocation(n),l=this.model.getNode(s),c=v7i(r),u=b7i(c,i,e),p=(this.enabled?JCt:XCt)(u),h=t.diffIdentityProvider?((f,v)=>t.diffIdentityProvider.getId(f)===t.diffIdentityProvider.getId(v)):void 0;if($i(p.element.elements,r.element.elements,h)){this._setChildren(n,p.children||vt.empty(),{diffIdentityProvider:o,diffDepth:1});return}let g=l.children.map(f=>f===r?p:f);this._setChildren(l.element,g,{diffIdentityProvider:o,diffDepth:r.depth-l.depth})}isCompressionEnabled(){return this.enabled}setCompressionEnabled(i){if(i===this.enabled)return;this.enabled=i;let t=this.model.getNode().children,o=vt.map(t,v7i),n=vt.map(o,i?JCt:XCt);this._setChildren(null,n,{diffIdentityProvider:this.identityProvider,diffDepth:1/0})}_setChildren(i,e,t){let o=new Set,n=s=>{for(let l of s.element.elements)o.add(l),this.nodes.set(l,s.element)},r=s=>{for(let l of s.element.elements)o.has(l)||this.nodes.delete(l)};this.model.setChildren(i,e,{...t,onDidCreateNode:n,onDidDeleteNode:r})}has(i){return this.nodes.has(i)}getListIndex(i){let e=this.getCompressedNode(i);return this.model.getListIndex(e)}getListRenderCount(i){let e=this.getCompressedNode(i);return this.model.getListRenderCount(e)}getNode(i){if(typeof i>"u")return this.model.getNode();let e=this.getCompressedNode(i);return this.model.getNode(e)}getNodeLocation(i){let e=this.model.getNodeLocation(i);return e===null?null:e.elements[e.elements.length-1]}getParentNodeLocation(i){let e=this.getCompressedNode(i),t=this.model.getParentNodeLocation(e);return t===null?null:t.elements[t.elements.length-1]}getFirstElementChild(i){let e=this.getCompressedNode(i);return this.model.getFirstElementChild(e)}getLastElementAncestor(i){let e=typeof i>"u"?void 0:this.getCompressedNode(i);return this.model.getLastElementAncestor(e)}isCollapsible(i){let e=this.getCompressedNode(i);return this.model.isCollapsible(e)}setCollapsible(i,e){let t=this.getCompressedNode(i);return this.model.setCollapsible(t,e)}isCollapsed(i){let e=this.getCompressedNode(i);return this.model.isCollapsed(e)}setCollapsed(i,e,t){let o=this.getCompressedNode(i);return this.model.setCollapsed(o,e,t)}expandTo(i){let e=this.getCompressedNode(i);this.model.expandTo(e)}rerender(i){let e=this.getCompressedNode(i);this.model.rerender(e)}refilter(){this.model.refilter()}resort(i=null,e=!0){let t=this.getCompressedNode(i);this.model.resort(t,e)}getCompressedNode(i){if(i===null)return null;let e=this.nodes.get(i);if(!e)throw new Lg(this.user,`Tree element not found: ${i}`);return e}},Wzo=a=>a[a.length-1],Uai=class a{constructor(i,e){this.unwrapper=i;this.node=e}get element(){return this.node.element===null?null:this.unwrapper(this.node.element)}get children(){return this.node.children.map(i=>new a(this.unwrapper,i))}get depth(){return this.node.depth}get visibleChildrenCount(){return this.node.visibleChildrenCount}get visibleChildIndex(){return this.node.visibleChildIndex}get collapsible(){return this.node.collapsible}get collapsed(){return this.node.collapsed}get visible(){return this.node.visible}get filterData(){return this.node.filterData}};function Vzo(a,i){return{...i,identityProvider:i.identityProvider&&{getId(e){return i.identityProvider.getId(a(e))},getGroupId:i.identityProvider.getGroupId?e=>i.identityProvider.getGroupId(a(e)):void 0},sorter:i.sorter&&{compare(e,t){return i.sorter.compare(e.elements[0],t.elements[0])}},filter:i.filter&&{filter(e,t){let o=e.elements;for(let n=0;n<o.length-1;n++){let r=i.filter.filter(o[n],t);t=$z(KY(r)?r.visibility:r)}return i.filter.filter(o[o.length-1],t)}}}}var ZCt=class{constructor(i,e={}){this.rootRef=null;this.elementMapper=e.elementMapper||Wzo;let t=o=>this.elementMapper(o.elements);this.nodeMapper=new Ece(o=>new Uai(t,o)),this.model=new Hai(i,Vzo(t,e))}get onDidSpliceModel(){return U.map(this.model.onDidSpliceModel,({insertedNodes:i,deletedNodes:e})=>({insertedNodes:i.map(t=>this.nodeMapper.map(t)),deletedNodes:e.map(t=>this.nodeMapper.map(t))}))}get onDidSpliceRenderedNodes(){return U.map(this.model.onDidSpliceRenderedNodes,({start:i,deleteCount:e,elements:t})=>({start:i,deleteCount:e,elements:t.map(o=>this.nodeMapper.map(o))}))}get onDidChangeCollapseState(){return U.map(this.model.onDidChangeCollapseState,({node:i,deep:e})=>({node:this.nodeMapper.map(i),deep:e}))}get onDidChangeRenderNodeCount(){return U.map(this.model.onDidChangeRenderNodeCount,i=>this.nodeMapper.map(i))}setChildren(i,e=vt.empty(),t={}){this.model.setChildren(i,e,t)}isCompressionEnabled(){return this.model.isCompressionEnabled()}setCompressionEnabled(i){this.model.setCompressionEnabled(i)}has(i){return this.model.has(i)}getListIndex(i){return this.model.getListIndex(i)}getListRenderCount(i){return this.model.getListRenderCount(i)}getNode(i){return this.nodeMapper.map(this.model.getNode(i))}getNodeLocation(i){return i.element}getParentNodeLocation(i){return this.model.getParentNodeLocation(i)}getFirstElementChild(i){let e=this.model.getFirstElementChild(i);return e===null||typeof e>"u"?e:this.elementMapper(e.elements)}getLastElementAncestor(i){let e=this.model.getLastElementAncestor(i);return e===null||typeof e>"u"?e:this.elementMapper(e.elements)}isCollapsible(i){return this.model.isCollapsible(i)}setCollapsible(i,e){return this.model.setCollapsible(i,e)}isCollapsed(i){return this.model.isCollapsed(i)}setCollapsed(i,e,t){return this.model.setCollapsed(i,e,t)}expandTo(i){return this.model.expandTo(i)}rerender(i){return this.model.rerender(i)}refilter(){return this.model.refilter()}resort(i=null,e=!0){return this.model.resort(i,e)}getCompressedTreeNode(i=null){return this.model.getNode(i)}};var yw=class extends ZV{constructor(e,t,o,n,r={}){super(e,t,o,n,r);this.user=e}get onDidChangeCollapseState(){return this.model.onDidChangeCollapseState}setChildren(e,t=vt.empty(),o){this.model.setChildren(e,t,o)}rerender(e){if(e===void 0){this.view.rerender();return}this.model.rerender(e)}updateElementHeight(e,t){let o=this.model.getListIndex(e);o!==-1&&this.view.updateElementHeight(o,t)}resort(e,t=!0){this.model.resort(e,t)}hasElement(e){return this.model.has(e)}createModel(e,t){return new jz(e,t)}},ext=class{constructor(i,e,t){this._compressedTreeNodeProvider=i;this.stickyScrollDelegate=e;this.renderer=t;this.templateId=t.templateId,t.onDidChangeTwistieState&&(this.onDidChangeTwistieState=t.onDidChangeTwistieState)}get compressedTreeNodeProvider(){return this._compressedTreeNodeProvider()}renderTemplate(i){return{compressedTreeNode:void 0,data:this.renderer.renderTemplate(i)}}renderElement(i,e,t,o){let n=this.stickyScrollDelegate.getCompressedNode(i);n||(n=this.compressedTreeNodeProvider.getCompressedTreeNode(i.element)),n.element.elements.length===1?(t.compressedTreeNode=void 0,this.renderer.renderElement(i,e,t.data,o)):(t.compressedTreeNode=n,this.renderer.renderCompressedElements(n,e,t.data,o))}disposeElement(i,e,t,o){t.compressedTreeNode?this.renderer.disposeCompressedElements?.(t.compressedTreeNode,e,t.data,o):this.renderer.disposeElement?.(i,e,t.data,o)}disposeTemplate(i){this.renderer.disposeTemplate(i.data)}renderTwistie(i,e){return this.renderer.renderTwistie?.(i,e)??!1}};I([hi],ext.prototype,"compressedTreeNodeProvider",1);var zai=class{constructor(i){this.modelProvider=i;this.compressedStickyNodes=new Map}getCompressedNode(i){return this.compressedStickyNodes.get(i)}constrainStickyScrollNodes(i,e,t){if(this.compressedStickyNodes.clear(),i.length===0)return[];for(let o=0;o<i.length;o++){let n=i[o],r=n.position+n.height;if(o+1<i.length&&r+i[o+1].height>t||o>=e-1&&e<i.length){let l=i.slice(0,o),c=i.slice(o),u=this.compressStickyNodes(c);return[...l,u]}}return i}compressStickyNodes(i){if(i.length===0)throw new Error("Can't compress empty sticky nodes");let e=this.modelProvider();if(!e.isCompressionEnabled())return i[0];let t=[];for(let c=0;c<i.length;c++){let u=i[c],p=e.getCompressedTreeNode(u.node.element);if(p.element){if(c!==0&&p.element.incompressible)break;t.push(...p.element.elements)}}if(t.length<2)return i[0];let o=i[i.length-1],n={elements:t,incompressible:!1},r={...o.node,children:[],element:n},s=new Proxy(i[0].node,{}),l={node:s,startIndex:i[0].startIndex,endIndex:o.endIndex,position:i[0].position,height:i[0].height};return this.compressedStickyNodes.set(s,r),l}};function Bzo(a,i){return i&&{...i,keyboardNavigationLabelProvider:i.keyboardNavigationLabelProvider&&{getKeyboardNavigationLabel(e){let t;try{t=a().getCompressedTreeNode(e)}catch{return i.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(e)}return t.element.elements.length===1?i.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(e):i.keyboardNavigationLabelProvider.getCompressedNodeKeyboardNavigationLabel(t.element.elements)}}}}var Axe=class extends yw{constructor(i,e,t,o,n={}){let r=()=>this,s=new zai(()=>this.model),l=o.map(c=>new ext(r,s,c));super(i,e,t,l,{...Bzo(r,n),stickyScrollDelegate:s})}setChildren(i,e=vt.empty(),t){this.model.setChildren(i,e,t)}createModel(i,e){return new ZCt(i,e)}updateOptions(i={}){super.updateOptions(i),typeof i.compressionEnabled<"u"&&this.model.setCompressionEnabled(i.compressionEnabled)}getCompressedTreeNode(i=null){return this.model.getCompressedTreeNode(i)}};function Kai(a){return{...a,children:[],refreshPromise:void 0,stale:!0,slow:!1,forceExpanded:!1}}function qai(a,i){return i.parent?i.parent===a?!0:qai(a,i.parent):!1}function Hzo(a,i){return a===i||qai(a,i)||qai(i,a)}var $ai=class a{constructor(i){this.node=i}get element(){return this.node.element.element}get children(){return this.node.children.map(i=>new a(i))}get depth(){return this.node.depth}get visibleChildrenCount(){return this.node.visibleChildrenCount}get visibleChildIndex(){return this.node.visibleChildIndex}get collapsible(){return this.node.collapsible}get collapsed(){return this.node.collapsed}get visible(){return this.node.visible}get filterData(){return this.node.filterData}},jai=class{constructor(i,e,t){this.renderer=i;this.nodeMapper=e;this.onDidChangeTwistieState=t;this.renderedNodes=new Map;this.templateId=i.templateId}renderTemplate(i){return{templateData:this.renderer.renderTemplate(i)}}renderElement(i,e,t,o){this.renderer.renderElement(this.nodeMapper.map(i),e,t.templateData,o)}renderTwistie(i,e){return i.slow?(e.classList.add(...q.asClassNameArray(R.treeItemLoading)),!0):(e.classList.remove(...q.asClassNameArray(R.treeItemLoading)),!1)}disposeElement(i,e,t,o){this.renderer.disposeElement?.(this.nodeMapper.map(i),e,t.templateData,o)}disposeTemplate(i){this.renderer.disposeTemplate(i.templateData)}dispose(){this.renderedNodes.clear()}};function S7i(a){return{browserEvent:a.browserEvent,elements:a.elements.map(i=>i.element)}}function txt(a){return{browserEvent:a.browserEvent,element:a.element&&a.element.element,target:a.target}}function Uzo(a){return{browserEvent:a.browserEvent,element:a.element&&a.element.element,anchor:a.anchor,isStickyScroll:a.isStickyScroll}}var Qai=class extends uw{constructor(e){super(e.elements.map(t=>t.element));this.data=e}set context(e){this.data.context=e}get context(){return this.data.context}};function Gai(a){return a instanceof uw?new Qai(a):a}var Yai=class{constructor(i){this.dnd=i}getDragURI(i){return this.dnd.getDragURI(i.element)}getDragLabel(i,e){if(this.dnd.getDragLabel)return this.dnd.getDragLabel(i.map(t=>t.element),e)}onDragStart(i,e){this.dnd.onDragStart?.(Gai(i),e)}onDragOver(i,e,t,o,n,r=!0){return this.dnd.onDragOver(Gai(i),e&&e.element,t,o,n)}drop(i,e,t,o,n){this.dnd.drop(Gai(i),e&&e.element,t,o,n)}onDragEnd(i){this.dnd.onDragEnd?.(i)}dispose(){this.dnd.dispose()}},Xai=class extends _3e{constructor(e,t,o){super(t,o);this.findProvider=e;this.isFindSessionActive=!1}filter(e,t){let o=super.filter(e,t);if(!this.isFindSessionActive||this.findMode===0||!this.findProvider.isVisible)return o;let n=KY(o)?o.visibility:o;return $z(n)===0?0:this.findProvider.isVisible(e)?o:0}},Jai=class extends D3e{constructor(e,t,o,n,r){super(e,o,n,r);this.findProvider=t;this.filter=o;this.activeSession=!1;this.asyncWorkInProgress=!1;this.taskQueue=new ya(250);this.disposables.add(Z(async()=>{this.activeSession&&await this.findProvider.endSession?.()}))}applyPattern(e){this.renderMessage(!1),this.activeTokenSource?.cancel(),this.activeTokenSource=new Ye,this.taskQueue.trigger(()=>this.applyPatternAsync())}async applyPatternAsync(){let e=this.activeTokenSource?.token;if(!e||e.isCancellationRequested)return;let t=this.pattern;if(t===""){this.activeSession&&(this.asyncWorkInProgress=!0,await this.deactivateFindSession(),this.asyncWorkInProgress=!1,e.isCancellationRequested||(this.filter.reset(),super.applyPattern("")));return}this.activeSession||this.activateFindSession(),this.asyncWorkInProgress=!0,this.activeFindMetadata=void 0;let o=await this.findProvider.find(t,{matchType:this.matchType,findMode:this.mode},e);e.isCancellationRequested||o===void 0||(this.asyncWorkInProgress=!1,this.activeFindMetadata=o,this.filter.reset(),super.applyPattern(t),o.warningMessage&&this.renderMessage(!0,o.warningMessage))}activateFindSession(){this.activeSession=!0,this.filter.isFindSessionActive=!0,this.findProvider.startSession?.()}async deactivateFindSession(){this.activeSession=!1,this.filter.isFindSessionActive=!1,await this.findProvider.endSession?.()}render(){if(this.asyncWorkInProgress||!this.activeFindMetadata)return;let e=this.activeFindMetadata.matchCount===0&&this.pattern.length>0;this.renderMessage(e),this.pattern.length&&this.alertResults(this.activeFindMetadata.matchCount)}onDidToggleChange(e){this.toggles.set(e.id,e.isChecked),this.filter.findMode=this.mode,this.filter.findMatchType=this.matchType,this.placeholder=this.mode===1?d(43,null):d(44,null),this.applyPattern(this.pattern)}shouldAllowFocus(e){return this.shouldFocusWhenNavigating(e)}shouldFocusWhenNavigating(e){if(!this.activeSession||!this.activeFindMetadata)return!0;let t=e.element?.element;return t&&this.activeFindMetadata.isMatch(t)?!0:!kv.isDefault(e.filterData)}};function I7i(a){return a&&{...a,collapseByDefault:!0,identityProvider:a.identityProvider&&{getId(i){return a.identityProvider.getId(i.element)},getGroupId:a.identityProvider.getGroupId?i=>a.identityProvider.getGroupId(i.element):void 0},dnd:a.dnd&&new Yai(a.dnd),multipleSelectionController:a.multipleSelectionController&&{isSelectionSingleChangeEvent(i){return a.multipleSelectionController.isSelectionSingleChangeEvent({...i,element:i.element})},isSelectionRangeChangeEvent(i){return a.multipleSelectionController.isSelectionRangeChangeEvent({...i,element:i.element})}},accessibilityProvider:a.accessibilityProvider&&{...a.accessibilityProvider,getPosInSet:void 0,getSetSize:void 0,getRole:a.accessibilityProvider.getRole?i=>a.accessibilityProvider.getRole(i.element):()=>"treeitem",isChecked:a.accessibilityProvider.isChecked?i=>!!a.accessibilityProvider?.isChecked(i.element):void 0,getAriaLabel(i){return a.accessibilityProvider.getAriaLabel(i.element)},getWidgetAriaLabel(){return a.accessibilityProvider.getWidgetAriaLabel()},getWidgetRole:a.accessibilityProvider.getWidgetRole?()=>a.accessibilityProvider.getWidgetRole():()=>"tree",getAriaLevel:a.accessibilityProvider.getAriaLevel&&(i=>a.accessibilityProvider.getAriaLevel(i.element)),getActiveDescendantId:a.accessibilityProvider.getActiveDescendantId&&(i=>a.accessibilityProvider.getActiveDescendantId(i.element))},filter:a.filter&&{filter(i,e){return a.filter.filter(i.element,e)}},keyboardNavigationLabelProvider:a.keyboardNavigationLabelProvider&&{...a.keyboardNavigationLabelProvider,getKeyboardNavigationLabel(i){return a.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(i.element)}},sorter:void 0,expandOnlyOnTwistieClick:typeof a.expandOnlyOnTwistieClick>"u"?void 0:typeof a.expandOnlyOnTwistieClick!="function"?a.expandOnlyOnTwistieClick:(i=>a.expandOnlyOnTwistieClick(i.element)),twistieAdditionalCssClass:typeof a.twistieAdditionalCssClass>"u"?void 0:(i=>a.twistieAdditionalCssClass(i.element)),defaultFindVisibility:i=>i.hasChildren&&i.stale?1:typeof a.defaultFindVisibility=="number"?a.defaultFindVisibility:typeof a.defaultFindVisibility>"u"?2:a.defaultFindVisibility(i.element),stickyScrollDelegate:a.stickyScrollDelegate}}function Zai(a,i){i(a),a.children.forEach(e=>Zai(e,i))}var Tv=class{constructor(i,e,t,o,n,r={}){this.user=i;this.dataSource=n;this.nodes=new Map;this.subTreeRefreshPromises=new Map;this.refreshPromises=new Map;this._onDidRender=new E;this._onDidChangeNodeSlowState=new E;this.nodeMapper=new Ece(i=>new $ai(i));this.disposables=new N;this.identityProvider=r.identityProvider,this.autoExpandSingleChildren=typeof r.autoExpandSingleChildren>"u"?!1:r.autoExpandSingleChildren,this.sorter=r.sorter,this.getDefaultCollapseState=c=>r.collapseByDefault?r.collapseByDefault(c)?3:2:void 0;let s=!1,l;if(r.findProvider&&(r.findWidgetEnabled??!0)&&r.keyboardNavigationLabelProvider&&r.contextViewProvider&&(s=!0,l=new Xai(r.findProvider,r.keyboardNavigationLabelProvider,r.filter)),this.tree=this.createTree(i,e,t,o,{...r,findWidgetEnabled:!s,filter:l??r.filter}),this.root=Kai({element:void 0,parent:null,hasChildren:!0,defaultCollapseState:void 0}),this.identityProvider&&(this.root={...this.root,id:null}),this.nodes.set(null,this.root),this.tree.onDidChangeCollapseState(this._onDidChangeCollapseState,this,this.disposables),s){let c={styles:r.findWidgetStyles,showNotFoundMessage:r.showNotFoundMessage,defaultFindMatchType:r.defaultFindMatchType,defaultFindMode:r.defaultFindMode};this.findController=this.disposables.add(new Jai(this.tree,r.findProvider,l,this.tree.options.contextViewProvider,c)),this.focusNavigationFilter=u=>this.findController.shouldFocusWhenNavigating(u),this.onDidChangeFindOpenState=this.findController.onDidChangeOpenState,this.onDidChangeFindMode=this.findController.onDidChangeMode,this.onDidChangeFindMatchType=this.findController.onDidChangeMatchType}else this.onDidChangeFindOpenState=this.tree.onDidChangeFindOpenState,this.onDidChangeFindMode=this.tree.onDidChangeFindMode,this.onDidChangeFindMatchType=this.tree.onDidChangeFindMatchType}get onDidScroll(){return this.tree.onDidScroll}get onDidChangeFocus(){return U.map(this.tree.onDidChangeFocus,S7i)}get onDidChangeSelection(){return U.map(this.tree.onDidChangeSelection,S7i)}get onKeyDown(){return this.tree.onKeyDown}get onMouseClick(){return U.map(this.tree.onMouseClick,txt)}get onMouseDblClick(){return U.map(this.tree.onMouseDblClick,txt)}get onContextMenu(){return U.map(this.tree.onContextMenu,Uzo)}get onTap(){return U.map(this.tree.onTap,txt)}get onPointer(){return U.map(this.tree.onPointer,txt)}get onDidFocus(){return this.tree.onDidFocus}get onDidBlur(){return this.tree.onDidBlur}get onDidChangeModel(){return this.tree.onDidChangeModel}get onDidChangeCollapseState(){return this.tree.onDidChangeCollapseState}get onDidUpdateOptions(){return this.tree.onDidUpdateOptions}get onDidChangeStickyScrollFocused(){return this.tree.onDidChangeStickyScrollFocused}get findMode(){return this.findController?this.findController.mode:this.tree.findMode}set findMode(i){this.findController?this.findController.mode=i:this.tree.findMode=i}get findMatchType(){return this.findController?this.findController.matchType:this.tree.findMatchType}set findMatchType(i){this.findController?this.findController.matchType=i:this.tree.findMatchType=i}get expandOnlyOnTwistieClick(){if(typeof this.tree.expandOnlyOnTwistieClick=="boolean")return this.tree.expandOnlyOnTwistieClick;let i=this.tree.expandOnlyOnTwistieClick;return e=>i(this.nodes.get(e===this.root.element?null:e)||null)}get onDidDispose(){return this.tree.onDidDispose}createTree(i,e,t,o,n){let r=new Pxe(t),s=o.map(c=>new jai(c,this.nodeMapper,this._onDidChangeNodeSlowState.event)),l=I7i(n)||{};return new yw(i,e,r,s,l)}updateOptions(i={}){this.findController&&(i.defaultFindMode!==void 0&&(this.findController.mode=i.defaultFindMode),i.defaultFindMatchType!==void 0&&(this.findController.matchType=i.defaultFindMatchType)),this.tree.updateOptions(i)}get options(){return this.tree.options}getHTMLElement(){return this.tree.getHTMLElement()}get contentHeight(){return this.tree.contentHeight}get contentWidth(){return this.tree.contentWidth}get onDidChangeContentHeight(){return this.tree.onDidChangeContentHeight}get onDidChangeContentWidth(){return this.tree.onDidChangeContentWidth}get scrollTop(){return this.tree.scrollTop}set scrollTop(i){this.tree.scrollTop=i}get scrollLeft(){return this.tree.scrollLeft}set scrollLeft(i){this.tree.scrollLeft=i}get scrollHeight(){return this.tree.scrollHeight}get renderHeight(){return this.tree.renderHeight}get lastVisibleElement(){return this.tree.lastVisibleElement.element}get ariaLabel(){return this.tree.ariaLabel}set ariaLabel(i){this.tree.ariaLabel=i}domFocus(){this.tree.domFocus()}isDOMFocused(){return this.tree.isDOMFocused()}navigate(i){let e;return i&&(e=this.getDataNode(i)),new ili(this.tree.navigate(e))}layout(i,e){this.tree.layout(i,e)}style(i){this.tree.style(i)}getInput(){return this.root.element}async setInput(i,e){this.cancelAllRefreshPromises(),this.root.element=i;let t=e&&{viewState:e,focus:[],selection:[]};await this._updateChildren(i,!0,!1,t),t&&(this.tree.setFocus(t.focus),this.tree.setSelection(t.selection)),e&&typeof e.scrollTop=="number"&&(this.scrollTop=e.scrollTop)}async updateChildren(i=this.root.element,e=!0,t=!1,o){await this._updateChildren(i,e,t,void 0,o)}cancelAllRefreshPromises(i=!1){this.refreshPromises.forEach(e=>e.cancel()),this.refreshPromises.clear(),i&&(this.subTreeRefreshPromises.forEach(e=>e.cancel()),this.subTreeRefreshPromises.clear())}async _updateChildren(i=this.root.element,e=!0,t=!1,o,n){if(typeof this.root.element>"u")throw new Lg(this.user,"Tree input not set");this.root.refreshPromise&&(await this.root.refreshPromise,await U.toPromise(this._onDidRender.event));let r=this.getDataNode(i);if(await this.refreshAndRenderNode(r,e,o,n),t)try{this.tree.rerender(r)}catch{}}resort(i=this.root.element,e=!0){this.tree.resort(this.getDataNode(i),e)}hasNode(i){return i===this.root.element||this.nodes.has(i)}rerender(i){if(i===void 0||i===this.root.element){this.tree.rerender();return}let e=this.getDataNode(i);this.tree.rerender(e)}updateElementHeight(i,e){let t=this.getDataNode(i);this.tree.updateElementHeight(t,e)}updateWidth(i){let e=this.getDataNode(i);this.tree.updateWidth(e)}getNode(i=this.root.element){let e=this.getDataNode(i),t=this.tree.getNode(e===this.root?null:e);return this.nodeMapper.map(t)}collapse(i,e=!1){let t=this.getDataNode(i);return this.tree.collapse(t===this.root?null:t,e)}async expand(i,e=!1){if(typeof this.root.element>"u")throw new Lg(this.user,"Tree input not set");this.root.refreshPromise&&(await this.root.refreshPromise,await U.toPromise(this._onDidRender.event));let t=this.getDataNode(i);if(this.tree.hasElement(t)&&!this.tree.isCollapsible(t)||(t.refreshPromise&&(await t.refreshPromise,await U.toPromise(this._onDidRender.event)),t!==this.root&&!t.refreshPromise&&!this.tree.isCollapsed(t)))return!1;let o=this.tree.expand(t===this.root?null:t,e);return t.refreshPromise&&(await t.refreshPromise,await U.toPromise(this._onDidRender.event)),o}toggleCollapsed(i,e=!1){return this.tree.toggleCollapsed(this.getDataNode(i),e)}expandAll(){this.tree.expandAll()}async expandTo(i){if(!this.dataSource.getParent)throw new Error("Can't expand to element without getParent method");let e=[];for(;!this.hasNode(i);)i=this.dataSource.getParent(i),i!==this.root.element&&e.push(i);for(let t of vt.reverse(e))await this.expand(t);this.tree.expandTo(this.getDataNode(i))}collapseAll(){this.tree.collapseAll()}isCollapsible(i){return this.tree.isCollapsible(this.getDataNode(i))}isCollapsed(i){return this.tree.isCollapsed(this.getDataNode(i))}triggerTypeNavigation(){this.tree.triggerTypeNavigation()}openFind(){this.findController?this.findController.open():this.tree.openFind()}closeFind(){this.findController?this.findController.close():this.tree.closeFind()}refilter(){this.tree.refilter()}setAnchor(i){this.tree.setAnchor(typeof i>"u"?void 0:this.getDataNode(i))}getAnchor(){return this.tree.getAnchor()?.element}setSelection(i,e){let t=i.map(o=>this.getDataNode(o));this.tree.setSelection(t,e)}getSelection(){return this.tree.getSelection().map(e=>e.element)}setFocus(i,e){let t=i.map(o=>this.getDataNode(o));this.tree.setFocus(t,e)}focusNext(i=1,e=!1,t){this.tree.focusNext(i,e,t,this.focusNavigationFilter)}focusPrevious(i=1,e=!1,t){this.tree.focusPrevious(i,e,t,this.focusNavigationFilter)}focusNextPage(i){return this.tree.focusNextPage(i,this.focusNavigationFilter)}focusPreviousPage(i){return this.tree.focusPreviousPage(i,this.focusNavigationFilter)}focusLast(i){this.tree.focusLast(i,this.focusNavigationFilter)}focusFirst(i){this.tree.focusFirst(i,this.focusNavigationFilter)}getFocus(){return this.tree.getFocus().map(e=>e.element)}getStickyScrollFocus(){return this.tree.getStickyScrollFocus().map(e=>e.element)}getFocusedPart(){return this.tree.getFocusedPart()}reveal(i,e){this.tree.reveal(this.getDataNode(i),e)}getRelativeTop(i){return this.tree.getRelativeTop(this.getDataNode(i))}getParentElement(i){let e=this.tree.getParentElement(this.getDataNode(i));return e&&e.element}getFirstElementChild(i=this.root.element){let e=this.getDataNode(i),t=this.tree.getFirstElementChild(e===this.root?null:e);return t&&t.element}getDataNode(i){let e=this.nodes.get(i===this.root.element?null:i);if(!e){let t=this.identityProvider?.getId(i).toString();throw new Lg(this.user,`Data tree node not found${t?`: ${t}`:""}`)}return e}async refreshAndRenderNode(i,e,t,o){this.disposables.isDisposed||(await this.refreshNode(i,e,t),!this.disposables.isDisposed&&this.render(i,t,o))}async refreshNode(i,e,t){let o;if(this.subTreeRefreshPromises.forEach((n,r)=>{!o&&Hzo(r,i)&&(o=n.then(()=>this.refreshNode(i,e,t)))}),o)return o;if(i!==this.root&&this.tree.getNode(i).collapsed){i.hasChildren=!!this.dataSource.hasChildren(i.element),i.stale=!0,this.setChildren(i,[],e,t);return}return this.doRefreshSubTree(i,e,t)}async doRefreshSubTree(i,e,t){let o=Ln(async()=>{let n=await this.doRefreshNode(i,e,t);i.stale=!1,await dn.settled(n.map(r=>this.doRefreshSubTree(r,e,t)))});return i.refreshPromise=o,this.subTreeRefreshPromises.set(i,o),o.finally(()=>{i.refreshPromise=void 0,this.subTreeRefreshPromises.delete(i)}),o}async doRefreshNode(i,e,t){i.hasChildren=!!this.dataSource.hasChildren(i.element);let o;if(!i.hasChildren)o=Promise.resolve(vt.empty());else{let n=this.doGetChildren(i);if(l$e(n))o=Promise.resolve(n);else{let r=Li(800);r.then(()=>{i.slow=!0,this._onDidChangeNodeSlowState.fire(i)},s=>null),o=n.finally(()=>r.cancel())}}try{let n=await o;return this.setChildren(i,n,e,t)}catch(n){if(i!==this.root&&this.tree.hasElement(i)&&this.tree.collapse(i),ao(n))return[];throw n}finally{i.slow&&(i.slow=!1,this._onDidChangeNodeSlowState.fire(i))}}doGetChildren(i){let e=this.refreshPromises.get(i);if(e)return e;let t=this.dataSource.getChildren(i.element);return l$e(t)?this.processChildren(t):(e=Ln(async()=>this.processChildren(await t)),this.refreshPromises.set(i,e),e.finally(()=>{this.refreshPromises.delete(i)}))}_onDidChangeCollapseState({node:i,deep:e}){i.element!==null&&!i.collapsed&&i.element.stale&&(e?this.collapse(i.element.element):this.refreshAndRenderNode(i.element,!1).catch(mt))}setChildren(i,e,t,o){let n=[...e];if(i.children.length===0&&n.length===0)return[];let r=new Map,s=new Map;for(let u of i.children)r.set(u.element,u),this.identityProvider&&s.set(u.id,{node:u,collapsed:this.tree.hasElement(u)&&this.tree.isCollapsed(u)});let l=[],c=n.map(u=>{let p=!!this.dataSource.hasChildren(u);if(!this.identityProvider){let v=Kai({element:u,parent:i,hasChildren:p,defaultCollapseState:this.getDefaultCollapseState(u)});return p&&v.defaultCollapseState===2&&l.push(v),v}let h=this.identityProvider.getId(u).toString(),g=s.get(h);if(g){let v=g.node;return r.delete(v.element),this.nodes.delete(v.element),this.nodes.set(u,v),v.element=u,v.hasChildren=p,t?g.collapsed?(v.children.forEach(b=>Zai(b,S=>this.nodes.delete(S.element))),v.children.splice(0,v.children.length),v.stale=!0):l.push(v):p&&!g.collapsed&&l.push(v),v}let f=Kai({element:u,parent:i,id:h,hasChildren:p,defaultCollapseState:this.getDefaultCollapseState(u)});return o&&o.viewState.focus&&o.viewState.focus.indexOf(h)>-1&&o.focus.push(f),o&&o.viewState.selection&&o.viewState.selection.indexOf(h)>-1&&o.selection.push(f),(o&&o.viewState.expanded&&o.viewState.expanded.indexOf(h)>-1||p&&f.defaultCollapseState===2)&&l.push(f),f});for(let u of r.values())Zai(u,p=>this.nodes.delete(p.element));for(let u of c)this.nodes.set(u.element,u);return Ose(i.children,0,i.children.length,c),i!==this.root&&this.autoExpandSingleChildren&&c.length===1&&l.length===0&&(c[0].forceExpanded=!0,l.push(c[0])),l}render(i,e,t){let o=i.children.map(r=>this.asTreeElement(r,e)),n=t&&{...t,diffIdentityProvider:t.diffIdentityProvider&&{getId(r){return t.diffIdentityProvider.getId(r.element)},getGroupId:t.diffIdentityProvider.getGroupId?r=>t.diffIdentityProvider.getGroupId(r.element):void 0}};this.tree.setChildren(i===this.root?null:i,o,n),i!==this.root&&this.tree.setCollapsible(i,i.hasChildren),this._onDidRender.fire()}asTreeElement(i,e){if(i.stale)return{element:i,collapsible:i.hasChildren,collapsed:!0};let t;return e&&e.viewState.expanded&&i.id&&e.viewState.expanded.indexOf(i.id)>-1?t=!1:i.forceExpanded?(t=!1,i.forceExpanded=!1):t=i.defaultCollapseState,{element:i,children:i.hasChildren?vt.map(i.children,o=>this.asTreeElement(o,e)):[],collapsible:i.hasChildren,collapsed:t}}processChildren(i){return this.sorter&&(i=[...i].sort(this.sorter.compare.bind(this.sorter))),i}getViewState(){if(!this.identityProvider)throw new Lg(this.user,"Can't get tree view state without an identity provider");let i=s=>this.identityProvider.getId(s).toString(),e=this.getFocus().map(i),t=this.getSelection().map(i),o=[],n=this.tree.getNode(),r=[n];for(;r.length>0;){let s=r.pop();s!==n&&s.collapsible&&!s.collapsed&&o.push(i(s.element.element)),Nse(r,r.length,s.children)}return{focus:e,selection:t,expanded:o,scrollTop:this.scrollTop}}dispose(){this._onDidRender.dispose(),this._onDidChangeNodeSlowState.dispose(),this.disposables.dispose(),this.tree.dispose()}},eli=class a{constructor(i){this.node=i}get element(){return{elements:this.node.element.elements.map(i=>i.element),incompressible:this.node.element.incompressible}}get children(){return this.node.children.map(i=>new a(i))}get depth(){return this.node.depth}get visibleChildrenCount(){return this.node.visibleChildrenCount}get visibleChildIndex(){return this.node.visibleChildIndex}get collapsible(){return this.node.collapsible}get collapsed(){return this.node.collapsed}get visible(){return this.node.visible}get filterData(){return this.node.filterData}},tli=class{constructor(i,e,t,o){this.renderer=i;this.nodeMapper=e;this.compressibleNodeMapperProvider=t;this.onDidChangeTwistieState=o;this.renderedNodes=new Map;this.disposables=[];this.templateId=i.templateId}renderTemplate(i){return{templateData:this.renderer.renderTemplate(i)}}renderElement(i,e,t,o){this.renderer.renderElement(this.nodeMapper.map(i),e,t.templateData,o)}renderCompressedElements(i,e,t,o){this.renderer.renderCompressedElements(this.compressibleNodeMapperProvider().map(i),e,t.templateData,o)}renderTwistie(i,e){return i.slow?(e.classList.add(...q.asClassNameArray(R.treeItemLoading)),!0):(e.classList.remove(...q.asClassNameArray(R.treeItemLoading)),!1)}disposeElement(i,e,t,o){this.renderer.disposeElement?.(this.nodeMapper.map(i),e,t.templateData,o)}disposeCompressedElements(i,e,t,o){this.renderer.disposeCompressedElements?.(this.compressibleNodeMapperProvider().map(i),e,t.templateData,o)}disposeTemplate(i){this.renderer.disposeTemplate(i.templateData)}dispose(){this.renderedNodes.clear(),this.disposables=Be(this.disposables)}};function zzo(a){let i=a&&I7i(a);return i&&{...i,keyboardNavigationLabelProvider:i.keyboardNavigationLabelProvider&&{...i.keyboardNavigationLabelProvider,getCompressedNodeKeyboardNavigationLabel(e){return a.keyboardNavigationLabelProvider.getCompressedNodeKeyboardNavigationLabel(e.map(t=>t.element))}},stickyScrollDelegate:i.stickyScrollDelegate}}var ixt=class extends Tv{constructor(e,t,o,n,r,s,l={}){super(e,t,o,r,s,l);this.compressionDelegate=n;this.compressibleNodeMapper=new Ece(e=>new eli(e));this.filter=l.filter}getCompressedTreeNode(e){let t=this.getDataNode(e);return this.tree.getCompressedTreeNode(t).element}createTree(e,t,o,n,r){let s=new Pxe(o),l=n.map(u=>new tli(u,this.nodeMapper,()=>this.compressibleNodeMapper,this._onDidChangeNodeSlowState.event)),c=zzo(r)||{};return new Axe(e,t,s,l,c)}asTreeElement(e,t){return{incompressible:this.compressionDelegate.isIncompressible(e.element),...super.asTreeElement(e,t)}}getViewState(){if(!this.identityProvider)throw new Lg(this.user,"Can't get tree view state without an identity provider");let e=l=>this.identityProvider.getId(l).toString(),t=this.getFocus().map(e),o=this.getSelection().map(e),n=[],r=this.tree.getCompressedTreeNode(),s=[r];for(;s.length>0;){let l=s.pop();if(l!==r&&l.collapsible&&!l.collapsed)for(let c of l.element.elements)n.push(e(c.element));s.push(...l.children)}return{focus:t,selection:o,expanded:n,scrollTop:this.scrollTop}}render(e,t,o){if(!this.identityProvider)return super.render(e,t);let n=f=>this.identityProvider.getId(f).toString(),r=f=>{let v=new Set;for(let b of f){let S=this.tree.getCompressedTreeNode(b===this.root?null:b);if(S.element)for(let y of S.element.elements)v.add(n(y.element))}return v},s=r(this.tree.getSelection()),l=r(this.tree.getFocus());super.render(e,t,o);let c=this.getSelection(),u=!1,p=this.getFocus(),h=!1,g=f=>{let v=f.element;if(v)for(let b=0;b<v.elements.length;b++){let S=n(v.elements[b].element),y=v.elements[v.elements.length-1].element;s.has(S)&&c.indexOf(y)===-1&&(c.push(y),u=!0),l.has(S)&&p.indexOf(y)===-1&&(p.push(y),h=!0)}f.children.forEach(g)};g(this.tree.getCompressedTreeNode(e===this.root?null:e)),u&&this.setSelection(c),h&&this.setFocus(p)}processChildren(e){return this.filter&&(e=vt.filter(e,t=>{let o=this.filter.filter(t,1),n=Kzo(o);if(n===2)throw new Error("Recursive tree visibility not supported in async data compressed trees");return n===1})),super.processChildren(e)}navigate(e){return super.navigate(e)}};function Kzo(a){return typeof a=="boolean"?a?1:0:KY(a)?$z(a.visibility):$z(a)}var ili=class{constructor(i){this.navigator=i}current(){let i=this.navigator.current();return i===null?null:i.element}previous(){return this.navigator.previous(),this.current()}first(){return this.navigator.first(),this.current()}last(){return this.navigator.last(),this.current()}next(){return this.navigator.next(),this.current()}};var qE=class extends ZV{constructor(e,t,o,n,r,s={}){super(e,t,o,n,s);this.user=e;this.dataSource=r;this.nodesByIdentity=new Map;this.identityProvider=s.identityProvider}getInput(){return this.input}setInput(e,t){if(t&&!this.identityProvider)throw new Lg(this.user,"Can't restore tree view state without an identity provider");if(this.input=e,!e){this.nodesByIdentity.clear(),this.model.setChildren(null,vt.empty());return}if(!t){this._refresh(e);return}let o=[],n=[],r=l=>{let c=this.identityProvider.getId(l).toString();return!t.expanded[c]},s=l=>{let c=this.identityProvider.getId(l.element).toString();t.focus.has(c)&&o.push(l.element),t.selection.has(c)&&n.push(l.element)};this._refresh(e,r,s),this.setFocus(o),this.setSelection(n),t&&typeof t.scrollTop=="number"&&(this.scrollTop=t.scrollTop)}updateChildren(e=this.input){if(typeof this.input>"u")throw new Lg(this.user,"Tree input not set");let t;this.identityProvider&&(t=o=>{let n=this.identityProvider.getId(o).toString(),r=this.nodesByIdentity.get(n);if(r)return r.collapsed}),this._refresh(e,t)}resort(e=this.input,t=!0){this.model.resort(e===this.input?null:e,t)}refresh(e){if(e===void 0){this.view.rerender();return}this.model.rerender(e)}_refresh(e,t,o){let n;if(this.identityProvider){let r=new Set,s=o;o=l=>{let c=this.identityProvider.getId(l.element).toString();r.add(c),this.nodesByIdentity.set(c,l),s?.(l)},n=l=>{let c=this.identityProvider.getId(l.element).toString();r.has(c)||this.nodesByIdentity.delete(c)}}this.model.setChildren(e===this.input?null:e,this.iterate(e,t).elements,{onDidCreateNode:o,onDidDeleteNode:n})}iterate(e,t){let o=[...this.dataSource.getChildren(e)];return{elements:vt.map(o,r=>{let{elements:s,size:l}=this.iterate(r,t),c=this.dataSource.hasChildren?this.dataSource.hasChildren(r):void 0,u=l===0?void 0:t&&t(r);return{element:r,children:s,collapsible:c,collapsed:u}}),size:o.length}}createModel(e,t){return new jz(e,t)}};var oxt=new Y("isMac",Ze,d(1923,null)),Dce=new Y("isLinux",fn,d(1922,null)),ww=new Y("isWindows",ei,d(1927,null)),Fu=new Y("isWeb",Wt,d(1926,null)),rk=new Y("isMacNative",Ze&&!Wt,d(1924,null)),nxt=new Y("isIOS",dc,d(1921,null)),y7i=new Y("isMobile",KSe,d(1925,null)),p5=new Y("isDevelopment",!1,!0),eB=new Y("productQualityType","",d(1928,null)),np="inputFocus",ig=new Y(np,!1,d(1920,null));var Io=le("listService"),sxt=class{constructor(){this.disposables=new N;this.lists=[];this._lastFocusedWidget=void 0}get lastFocusedList(){return this._lastFocusedWidget}setLastFocusedList(i){i!==this._lastFocusedWidget&&(this._lastFocusedWidget?.getHTMLElement().classList.remove("last-focused"),this._lastFocusedWidget=i,this._lastFocusedWidget?.getHTMLElement().classList.add("last-focused"))}register(i,e){if(this.lists.some(o=>o.widget===i))throw new Error("Cannot register the same widget multiple times");let t={widget:i,extraContextKeys:e};return this.lists.push(t),wa(i.getHTMLElement())&&this.setLastFocusedList(i),wn(i.onDidFocus(()=>this.setLastFocusedList(i)),Z(()=>this.lists.splice(this.lists.indexOf(t),1)),i.onDidDispose(()=>{this.lists=this.lists.filter(o=>o!==t),this._lastFocusedWidget===i&&this.setLastFocusedList(void 0)}))}dispose(){this.disposables.dispose()}},L3e=new Y("listScrollAtBoundary","none"),mxt=C.or(L3e.isEqualTo("top"),L3e.isEqualTo("both")),hxt=C.or(L3e.isEqualTo("bottom"),L3e.isEqualTo("both")),P3e=new Y("listFocus",!0),Oxe=new Y("treestickyScrollFocused",!1),GY=new Y("listSupportsMultiselect",!0),vc=C.and(P3e,C.not(np),Oxe.negate()),A3e=new Y("listHasSelectionOrFocus",!1),oB=new Y("listDoubleSelection",!1),sli=new Y("listMultiSelection",!1),Lce=new Y("listSelectionNavigation",!1),ali=new Y("listSupportsFind",!0),Fxe=new Y("treeElementCanCollapse",!1),lli=new Y("treeElementHasParent",!1),Wxe=new Y("treeElementCanExpand",!1),cli=new Y("treeElementHasChild",!1),dli=new Y("treeFindOpen",!1),C7i="listTypeNavigationMode",x7i="listAutomaticKeyboardNavigation";function gxt(a,i){let e=a.createScoped(i.getHTMLElement());return P3e.bindTo(e),e}function fxt(a,i){let e=L3e.bindTo(a),t=()=>{let o=i.scrollTop===0,n=i.scrollHeight-i.renderHeight-i.scrollTop<1;o&&n?e.set("both"):o?e.set("top"):n?e.set("bottom"):e.set("none")};return t(),i.onDidScroll(t)}var Rce="workbench.list.multiSelectModifier",rxt="workbench.list.openMode",BP="workbench.list.horizontalScrolling",uli="workbench.list.defaultFindMode",pli="workbench.list.typeNavigationMode",axt="workbench.list.keyboardNavigation",tB="workbench.list.scrollByPage",mli="workbench.list.defaultFindMatchType",R3e="workbench.tree.indent",lxt="workbench.tree.renderIndentGuides",iB="workbench.list.smoothScrolling",Yz="workbench.list.mouseWheelScrollSensitivity",Xz="workbench.list.fastScrollSensitivity",cxt="workbench.tree.expandMode",dxt="workbench.tree.enableStickyScroll",uxt="workbench.tree.stickyScrollMaxItemCount";function Jz(a){return a.getValue(Rce)==="alt"}var oli=class extends x{constructor(e){super();this.configurationService=e;this.useAltAsMultipleSelectionModifier=Jz(e),this.registerListeners()}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration(Rce)&&(this.useAltAsMultipleSelectionModifier=Jz(this.configurationService))}))}isSelectionSingleChangeEvent(e){return this.useAltAsMultipleSelectionModifier?e.browserEvent.altKey:jni(e)}isSelectionRangeChangeEvent(e){return Qni(e)}};function vxt(a,i){let e=a.get(B),t=a.get(_e),o=new N;return[{...i,keyboardNavigationDelegate:{mightProducePrintableCharacter(r){return t.mightProducePrintableCharacter(r)}},smoothScrolling:!!e.getValue(iB),mouseWheelScrollSensitivity:e.getValue(Yz),fastScrollSensitivity:e.getValue(Xz),multipleSelectionController:i.multipleSelectionController??o.add(new oli(e)),keyboardNavigationEventFilter:Gzo(t),scrollByPage:!!e.getValue(tB)},o]}var Vl=class extends Cc{get onDidOpen(){return this.navigator.onDidOpen}constructor(i,e,t,o,n,r,s,l,c){let u=typeof n.horizontalScrolling<"u"?n.horizontalScrolling:!!l.getValue(BP),[p,h]=c.invokeFunction(vxt,n);super(i,e,t,o,{keyboardSupport:!1,...p,horizontalScrolling:u}),this.disposables.add(h),this.contextKeyService=gxt(r,this),this.disposables.add(fxt(this.contextKeyService,this)),this.listSupportsMultiSelect=GY.bindTo(this.contextKeyService),this.listSupportsMultiSelect.set(n.multipleSelectionSupport!==!1),Lce.bindTo(this.contextKeyService).set(!!n.selectionNavigation),this.listHasSelectionOrFocus=A3e.bindTo(this.contextKeyService),this.listDoubleSelection=oB.bindTo(this.contextKeyService),this.listMultiSelection=sli.bindTo(this.contextKeyService),this.horizontalScrolling=n.horizontalScrolling,this._useAltAsMultipleSelectionModifier=Jz(l),this.disposables.add(this.contextKeyService),this.disposables.add(s.register(this)),this.updateStyles(n.overrideStyles),this.disposables.add(this.onDidChangeSelection(()=>{let f=this.getSelection(),v=this.getFocus();this.contextKeyService.bufferChangeEvents(()=>{this.listHasSelectionOrFocus.set(f.length>0||v.length>0),this.listMultiSelection.set(f.length>1),this.listDoubleSelection.set(f.length===2)})})),this.disposables.add(this.onDidChangeFocus(()=>{let f=this.getSelection(),v=this.getFocus();this.listHasSelectionOrFocus.set(f.length>0||v.length>0)})),this.disposables.add(l.onDidChangeConfiguration(f=>{f.affectsConfiguration(Rce)&&(this._useAltAsMultipleSelectionModifier=Jz(l));let v={};if(f.affectsConfiguration(BP)&&this.horizontalScrolling===void 0){let b=!!l.getValue(BP);v={...v,horizontalScrolling:b}}if(f.affectsConfiguration(tB)){let b=!!l.getValue(tB);v={...v,scrollByPage:b}}if(f.affectsConfiguration(iB)){let b=!!l.getValue(iB);v={...v,smoothScrolling:b}}if(f.affectsConfiguration(Yz)){let b=l.getValue(Yz);v={...v,mouseWheelScrollSensitivity:b}}if(f.affectsConfiguration(Xz)){let b=l.getValue(Xz);v={...v,fastScrollSensitivity:b}}Object.keys(v).length>0&&this.updateOptions(v)})),this.navigator=new pxt(this,{configurationService:l,...n}),this.disposables.add(this.navigator)}updateOptions(i){super.updateOptions(i),i.overrideStyles!==void 0&&this.updateStyles(i.overrideStyles),i.multipleSelectionSupport!==void 0&&this.listSupportsMultiSelect.set(!!i.multipleSelectionSupport)}updateStyles(i){this.style(i?uS(i):CY)}get useAltAsMultipleSelectionModifier(){return this._useAltAsMultipleSelectionModifier}};Vl=I([m(5,X),m(6,Io),m(7,B),m(8,F)],Vl);var Qz=class extends qz{get onDidOpen(){return this.navigator.onDidOpen}constructor(i,e,t,o,n,r,s,l,c){let u=typeof n.horizontalScrolling<"u"?n.horizontalScrolling:!!l.getValue(BP),[p,h]=c.invokeFunction(vxt,n);super(i,e,t,o,{keyboardSupport:!1,...p,horizontalScrolling:u}),this.disposables=new N,this.disposables.add(h),this.contextKeyService=gxt(r,this),this.disposables.add(fxt(this.contextKeyService,this.widget)),this.horizontalScrolling=n.horizontalScrolling,this.listSupportsMultiSelect=GY.bindTo(this.contextKeyService),this.listSupportsMultiSelect.set(n.multipleSelectionSupport!==!1),Lce.bindTo(this.contextKeyService).set(!!n.selectionNavigation),this._useAltAsMultipleSelectionModifier=Jz(l),this.disposables.add(this.contextKeyService),this.disposables.add(s.register(this)),this.updateStyles(n.overrideStyles),this.disposables.add(l.onDidChangeConfiguration(f=>{f.affectsConfiguration(Rce)&&(this._useAltAsMultipleSelectionModifier=Jz(l));let v={};if(f.affectsConfiguration(BP)&&this.horizontalScrolling===void 0){let b=!!l.getValue(BP);v={...v,horizontalScrolling:b}}if(f.affectsConfiguration(tB)){let b=!!l.getValue(tB);v={...v,scrollByPage:b}}if(f.affectsConfiguration(iB)){let b=!!l.getValue(iB);v={...v,smoothScrolling:b}}if(f.affectsConfiguration(Yz)){let b=l.getValue(Yz);v={...v,mouseWheelScrollSensitivity:b}}if(f.affectsConfiguration(Xz)){let b=l.getValue(Xz);v={...v,fastScrollSensitivity:b}}Object.keys(v).length>0&&this.updateOptions(v)})),this.navigator=new pxt(this,{configurationService:l,...n}),this.disposables.add(this.navigator)}updateOptions(i){super.updateOptions(i),i.overrideStyles!==void 0&&this.updateStyles(i.overrideStyles),i.multipleSelectionSupport!==void 0&&this.listSupportsMultiSelect.set(!!i.multipleSelectionSupport)}updateStyles(i){this.style(i?uS(i):CY)}get useAltAsMultipleSelectionModifier(){return this._useAltAsMultipleSelectionModifier}dispose(){this.disposables.dispose(),super.dispose()}};Qz=I([m(5,X),m(6,Io),m(7,B),m(8,F)],Qz);var MC=class extends iF{get onDidOpen(){return this.navigator.onDidOpen}constructor(i,e,t,o,n,r,s,l,c,u){let p=typeof r.horizontalScrolling<"u"?r.horizontalScrolling:!!c.getValue(BP),[h,g]=u.invokeFunction(vxt,r);super(i,e,t,o,n,{keyboardSupport:!1,...h,horizontalScrolling:p}),this.disposables.add(g),this.contextKeyService=gxt(s,this),this.disposables.add(fxt(this.contextKeyService,this)),this.listSupportsMultiSelect=GY.bindTo(this.contextKeyService),this.listSupportsMultiSelect.set(r.multipleSelectionSupport!==!1),Lce.bindTo(this.contextKeyService).set(!!r.selectionNavigation),this.listHasSelectionOrFocus=A3e.bindTo(this.contextKeyService),this.listDoubleSelection=oB.bindTo(this.contextKeyService),this.listMultiSelection=sli.bindTo(this.contextKeyService),this.horizontalScrolling=r.horizontalScrolling,this._useAltAsMultipleSelectionModifier=Jz(c),this.disposables.add(this.contextKeyService),this.disposables.add(l.register(this)),this.updateStyles(r.overrideStyles),this.disposables.add(this.onDidChangeSelection(()=>{let v=this.getSelection(),b=this.getFocus();this.contextKeyService.bufferChangeEvents(()=>{this.listHasSelectionOrFocus.set(v.length>0||b.length>0),this.listMultiSelection.set(v.length>1),this.listDoubleSelection.set(v.length===2)})})),this.disposables.add(this.onDidChangeFocus(()=>{let v=this.getSelection(),b=this.getFocus();this.listHasSelectionOrFocus.set(v.length>0||b.length>0)})),this.disposables.add(c.onDidChangeConfiguration(v=>{v.affectsConfiguration(Rce)&&(this._useAltAsMultipleSelectionModifier=Jz(c));let b={};if(v.affectsConfiguration(BP)&&this.horizontalScrolling===void 0){let S=!!c.getValue(BP);b={...b,horizontalScrolling:S}}if(v.affectsConfiguration(tB)){let S=!!c.getValue(tB);b={...b,scrollByPage:S}}if(v.affectsConfiguration(iB)){let S=!!c.getValue(iB);b={...b,smoothScrolling:S}}if(v.affectsConfiguration(Yz)){let S=c.getValue(Yz);b={...b,mouseWheelScrollSensitivity:S}}if(v.affectsConfiguration(Xz)){let S=c.getValue(Xz);b={...b,fastScrollSensitivity:S}}Object.keys(b).length>0&&this.updateOptions(b)})),this.navigator=new nli(this,{configurationService:c,...r}),this.disposables.add(this.navigator)}updateOptions(i){super.updateOptions(i),i.overrideStyles!==void 0&&this.updateStyles(i.overrideStyles),i.multipleSelectionSupport!==void 0&&this.listSupportsMultiSelect.set(!!i.multipleSelectionSupport)}updateStyles(i){this.style(i?uS(i):CY)}get useAltAsMultipleSelectionModifier(){return this._useAltAsMultipleSelectionModifier}dispose(){this.disposables.dispose(),super.dispose()}};MC=I([m(6,X),m(7,Io),m(8,B),m(9,F)],MC);function $E(a="keydown",i,e){let t=new KeyboardEvent(a);return t.preserveFocus=i,t.pinned=e,t.__forceEvent=!0,t}var M3e=class extends x{constructor(e,t){super();this.widget=e;this._onDidOpen=this._register(new E);this.onDidOpen=this._onDidOpen.event;this._register(U.filter(this.widget.onDidChangeSelection,o=>xg(o.browserEvent))(o=>this.onSelectionFromKeyboard(o))),this._register(this.widget.onPointer(o=>this.onPointer(o.element,o.browserEvent))),this._register(this.widget.onMouseDblClick(o=>this.onMouseDblClick(o.element,o.browserEvent))),typeof t?.openOnSingleClick!="boolean"&&t?.configurationService?(this.openOnSingleClick=t?.configurationService.getValue(rxt)!=="doubleClick",this._register(t?.configurationService.onDidChangeConfiguration(o=>{o.affectsConfiguration(rxt)&&(this.openOnSingleClick=t?.configurationService.getValue(rxt)!=="doubleClick")}))):this.openOnSingleClick=t?.openOnSingleClick??!0}onSelectionFromKeyboard(e){if(e.elements.length!==1)return;let t=e.browserEvent,o=typeof t.preserveFocus=="boolean"?t.preserveFocus:!0,n=typeof t.pinned=="boolean"?t.pinned:!o;this._open(this.getSelectedElement(),o,n,!1,e.browserEvent)}onPointer(e,t){if(!this.openOnSingleClick||t.detail===2)return;let n=t.button===1,r=!0,s=n,l=t.ctrlKey||t.metaKey||t.altKey;this._open(e,r,s,l,t)}onMouseDblClick(e,t){if(!t)return;let o=t.target;if(o.classList.contains("monaco-tl-twistie")||o.classList.contains("monaco-icon-label")&&o.classList.contains("folder-icon")&&t.offsetX<16)return;let r=!1,s=!0,l=t.ctrlKey||t.metaKey||t.altKey;this._open(e,r,s,l,t)}_open(e,t,o,n,r){e&&this._onDidOpen.fire({editorOptions:{preserveFocus:t,pinned:o,revealIfVisible:!0},sideBySide:n,element:e,browserEvent:r})}},pxt=class extends M3e{constructor(i,e){super(i,e),this.widget=i}getSelectedElement(){return this.widget.getSelectedElements()[0]}},nli=class extends M3e{constructor(i,e){super(i,e)}getSelectedElement(){return this.widget.getSelectedElements()[0]}},rli=class extends M3e{constructor(i,e){super(i,e)}getSelectedElement(){return this.widget.getSelection()[0]??void 0}};function Gzo(a){let i=!1;return e=>{if(e.toKeyCodeChord().isModifierKey())return!1;if(i)return i=!1,!1;let t=a.softDispatch(e,e.target);return t.kind===1?(i=!0,!1):(i=!1,t.kind===0)}}var Rg=class extends yw{get contextKeyService(){return this.internals.contextKeyService}get useAltAsMultipleSelectionModifier(){return this.internals.useAltAsMultipleSelectionModifier}get onDidOpen(){return this.internals.onDidOpen}constructor(i,e,t,o,n,r,s,l,c){let{options:u,getTypeNavigationMode:p,disposable:h}=r.invokeFunction(N3e,n);super(i,e,t,o,u),this.disposables.add(h),this.internals=new m5(this,n,p,n.overrideStyles,s,l,c),this.disposables.add(this.internals)}updateOptions(i){super.updateOptions(i),this.internals.updateOptions(i)}};Rg=I([m(5,F),m(6,X),m(7,Io),m(8,B)],Rg);var nF=class extends Axe{get contextKeyService(){return this.internals.contextKeyService}get useAltAsMultipleSelectionModifier(){return this.internals.useAltAsMultipleSelectionModifier}get onDidOpen(){return this.internals.onDidOpen}constructor(i,e,t,o,n,r,s,l,c){let{options:u,getTypeNavigationMode:p,disposable:h}=r.invokeFunction(N3e,n);super(i,e,t,o,u),this.disposables.add(h),this.internals=new m5(this,n,p,n.overrideStyles,s,l,c),this.disposables.add(this.internals)}updateOptions(i={}){super.updateOptions(i),i.overrideStyles&&this.internals.updateStyleOverrides(i.overrideStyles),this.internals.updateOptions(i)}};nF=I([m(5,F),m(6,X),m(7,Io),m(8,B)],nF);var rF=class extends qE{get contextKeyService(){return this.internals.contextKeyService}get useAltAsMultipleSelectionModifier(){return this.internals.useAltAsMultipleSelectionModifier}get onDidOpen(){return this.internals.onDidOpen}constructor(i,e,t,o,n,r,s,l,c,u){let{options:p,getTypeNavigationMode:h,disposable:g}=s.invokeFunction(N3e,r);super(i,e,t,o,n,p),this.disposables.add(g),this.internals=new m5(this,r,h,r.overrideStyles,l,c,u),this.disposables.add(this.internals)}updateOptions(i={}){super.updateOptions(i),i.overrideStyles!==void 0&&this.internals.updateStyleOverrides(i.overrideStyles),this.internals.updateOptions(i)}};rF=I([m(6,F),m(7,X),m(8,Io),m(9,B)],rF);var rp=class extends Tv{get contextKeyService(){return this.internals.contextKeyService}get useAltAsMultipleSelectionModifier(){return this.internals.useAltAsMultipleSelectionModifier}get onDidOpen(){return this.internals.onDidOpen}constructor(i,e,t,o,n,r,s,l,c,u){let{options:p,getTypeNavigationMode:h,disposable:g}=s.invokeFunction(N3e,r);super(i,e,t,o,n,p),this.disposables.add(g),this.internals=new m5(this,r,h,r.overrideStyles,l,c,u),this.disposables.add(this.internals)}updateOptions(i={}){super.updateOptions(i),i.overrideStyles&&this.internals.updateStyleOverrides(i.overrideStyles),this.internals.updateOptions(i)}};rp=I([m(6,F),m(7,X),m(8,Io),m(9,B)],rp);var sy=class extends ixt{get contextKeyService(){return this.internals.contextKeyService}get useAltAsMultipleSelectionModifier(){return this.internals.useAltAsMultipleSelectionModifier}get onDidOpen(){return this.internals.onDidOpen}constructor(i,e,t,o,n,r,s,l,c,u,p){let{options:h,getTypeNavigationMode:g,disposable:f}=l.invokeFunction(N3e,s);super(i,e,t,o,n,r,h),this.disposables.add(f),this.internals=new m5(this,s,g,s.overrideStyles,c,u,p),this.disposables.add(this.internals)}updateOptions(i){super.updateOptions(i),this.internals.updateOptions(i)}};sy=I([m(7,F),m(8,X),m(9,Io),m(10,B)],sy);function k7i(a){let i=a.getValue(uli);if(i==="highlight")return 0;if(i==="filter")return 1;let e=a.getValue(axt);if(e==="simple"||e==="highlight")return 0;if(e==="filter")return 1}function E7i(a){let i=a.getValue(mli);if(i==="fuzzy")return 0;if(i==="contiguous")return 1}function N3e(a,i){let e=a.get(B),t=a.get(Wn),o=a.get(X),n=a.get(F),r=()=>{let h=o.getContextKeyValue(C7i);if(h==="automatic")return 0;if(h==="trigger")return 1;if(o.getContextKeyValue(x7i)===!1)return 1;let f=e.getValue(pli);if(f==="automatic")return 0;if(f==="trigger")return 1},s=i.horizontalScrolling!==void 0?i.horizontalScrolling:!!e.getValue(BP),[l,c]=n.invokeFunction(vxt,i),u=i.paddingBottom,p=i.renderIndentGuides!==void 0?i.renderIndentGuides:e.getValue(lxt);return{getTypeNavigationMode:r,disposable:c,options:{keyboardSupport:!1,...l,indent:typeof e.getValue(R3e)=="number"?e.getValue(R3e):void 0,renderIndentGuides:p,smoothScrolling:!!e.getValue(iB),defaultFindMode:i.defaultFindMode??k7i(e),defaultFindMatchType:i.defaultFindMatchType??E7i(e),horizontalScrolling:s,scrollByPage:!!e.getValue(tB),paddingBottom:u,hideTwistiesOfChildlessElements:i.hideTwistiesOfChildlessElements,expandOnlyOnTwistieClick:i.expandOnlyOnTwistieClick??e.getValue(cxt)==="doubleClick",contextViewProvider:t,findWidgetStyles:K6i,enableStickyScroll:!!e.getValue(dxt),stickyScrollMaxItemCount:Number(e.getValue(uxt))}}}var m5=class{constructor(i,e,t,o,n,r,s){this.tree=i;this.disposables=[];this.contextKeyService=gxt(n,i),this.disposables.push(fxt(this.contextKeyService,i)),this.listSupportsMultiSelect=GY.bindTo(this.contextKeyService),this.listSupportsMultiSelect.set(e.multipleSelectionSupport!==!1),Lce.bindTo(this.contextKeyService).set(!!e.selectionNavigation),this.listSupportFindWidget=ali.bindTo(this.contextKeyService),this.listSupportFindWidget.set(e.findWidgetEnabled??!0),this.hasSelectionOrFocus=A3e.bindTo(this.contextKeyService),this.hasDoubleSelection=oB.bindTo(this.contextKeyService),this.hasMultiSelection=sli.bindTo(this.contextKeyService),this.treeElementCanCollapse=Fxe.bindTo(this.contextKeyService),this.treeElementHasParent=lli.bindTo(this.contextKeyService),this.treeElementCanExpand=Wxe.bindTo(this.contextKeyService),this.treeElementHasChild=cli.bindTo(this.contextKeyService),this.treeFindOpen=dli.bindTo(this.contextKeyService),this.treeStickyScrollFocused=Oxe.bindTo(this.contextKeyService),this._useAltAsMultipleSelectionModifier=Jz(s),this.updateStyleOverrides(o);let c=()=>{let p=i.getFocus()[0];if(!p)return;let h=i.getNode(p);this.treeElementCanCollapse.set(h.collapsible&&!h.collapsed),this.treeElementHasParent.set(!!i.getParentElement(p)),this.treeElementCanExpand.set(h.collapsible&&h.collapsed),this.treeElementHasChild.set(!!i.getFirstElementChild(p))},u=new Set;u.add(C7i),u.add(x7i),this.disposables.push(this.contextKeyService,r.register(i),i.onDidChangeSelection(()=>{let p=i.getSelection(),h=i.getFocus();this.contextKeyService.bufferChangeEvents(()=>{this.hasSelectionOrFocus.set(p.length>0||h.length>0),this.hasMultiSelection.set(p.length>1),this.hasDoubleSelection.set(p.length===2)})}),i.onDidChangeFocus(()=>{let p=i.getSelection(),h=i.getFocus();this.hasSelectionOrFocus.set(p.length>0||h.length>0),c()}),i.onDidChangeCollapseState(c),i.onDidChangeModel(c),i.onDidChangeFindOpenState(p=>this.treeFindOpen.set(p)),i.onDidChangeStickyScrollFocused(p=>this.treeStickyScrollFocused.set(p)),s.onDidChangeConfiguration(p=>{let h={};if(p.affectsConfiguration(Rce)&&(this._useAltAsMultipleSelectionModifier=Jz(s)),p.affectsConfiguration(R3e)){let g=s.getValue(R3e);h={...h,indent:g}}if(p.affectsConfiguration(lxt)&&e.renderIndentGuides===void 0){let g=s.getValue(lxt);h={...h,renderIndentGuides:g}}if(p.affectsConfiguration(iB)){let g=!!s.getValue(iB);h={...h,smoothScrolling:g}}if(p.affectsConfiguration(uli)||p.affectsConfiguration(axt)){let g=k7i(s);h={...h,defaultFindMode:g}}if(p.affectsConfiguration(pli)||p.affectsConfiguration(axt)){let g=t();h={...h,typeNavigationMode:g}}if(p.affectsConfiguration(mli)){let g=E7i(s);h={...h,defaultFindMatchType:g}}if(p.affectsConfiguration(BP)&&e.horizontalScrolling===void 0){let g=!!s.getValue(BP);h={...h,horizontalScrolling:g}}if(p.affectsConfiguration(tB)){let g=!!s.getValue(tB);h={...h,scrollByPage:g}}if(p.affectsConfiguration(cxt)&&e.expandOnlyOnTwistieClick===void 0&&(h={...h,expandOnlyOnTwistieClick:s.getValue(cxt)==="doubleClick"}),p.affectsConfiguration(dxt)){let g=s.getValue(dxt);h={...h,enableStickyScroll:g}}if(p.affectsConfiguration(uxt)){let g=Math.max(1,s.getValue(uxt));h={...h,stickyScrollMaxItemCount:g}}if(p.affectsConfiguration(Yz)){let g=s.getValue(Yz);h={...h,mouseWheelScrollSensitivity:g}}if(p.affectsConfiguration(Xz)){let g=s.getValue(Xz);h={...h,fastScrollSensitivity:g}}Object.keys(h).length>0&&i.updateOptions(h)}),this.contextKeyService.onDidChangeContext(p=>{p.affectsSome(u)&&i.updateOptions({typeNavigationMode:t()})})),this.navigator=new rli(i,{configurationService:s,...e}),this.disposables.push(this.navigator)}get onDidOpen(){return this.navigator.onDidOpen}get useAltAsMultipleSelectionModifier(){return this._useAltAsMultipleSelectionModifier}updateOptions(i){i.multipleSelectionSupport!==void 0&&this.listSupportsMultiSelect.set(!!i.multipleSelectionSupport)}updateStyleOverrides(i){this.tree.style(i?uS(i):CY)}dispose(){this.disposables=Be(this.disposables)}};m5=I([m(4,X),m(5,Io),m(6,B)],m5);var qzo=ne.as(Jt.Configuration);qzo.registerConfiguration({id:"workbench",order:7,title:d(2208,null),type:"object",properties:{[Rce]:{type:"string",enum:["ctrlCmd","alt"],markdownEnumDescriptions:[d(2201,null),d(2200,null)],default:"ctrlCmd",description:d(2199,null)},[rxt]:{type:"string",enum:["singleClick","doubleClick"],default:"singleClick",description:d(2202,null)},[BP]:{type:"boolean",default:!1,description:d(2190,null)},[tB]:{type:"boolean",default:!1,description:d(2197,null)},[R3e]:{type:"number",default:8,minimum:4,maximum:40,description:d(2206,null)},[lxt]:{type:"string",enum:["none","onHover","always"],default:"onHover",description:d(2203,null)},[iB]:{type:"boolean",default:!1,description:d(2196,null)},[Yz]:{type:"number",default:1,markdownDescription:d(2198,null)},[Xz]:{type:"number",default:5,markdownDescription:d(2189,null)},[uli]:{type:"string",enum:["highlight","filter"],enumDescriptions:[d(2187,null),d(2186,null)],default:"highlight",description:d(2185,null)},[axt]:{type:"string",enum:["simple","highlight","filter"],enumDescriptions:[d(2194,null),d(2193,null),d(2192,null)],default:"highlight",description:d(2191,null),deprecated:!0,deprecationMessage:d(2195,null)},[mli]:{type:"string",enum:["fuzzy","contiguous"],enumDescriptions:[d(2184,null),d(2183,null)],default:"fuzzy",description:d(2182,null)},[cxt]:{type:"string",enum:["singleClick","doubleClick"],default:"singleClick",description:d(2188,null)},[dxt]:{type:"boolean",default:!0,description:d(2204,null)},[uxt]:{type:"number",minimum:1,default:7,markdownDescription:d(2205,null,"`#workbench.tree.enableStickyScroll#`")},[pli]:{type:"string",enum:["automatic","trigger"],default:"automatic",markdownDescription:d(2207,null)}}});var SR=class{constructor(i,e,t,o){this.isProviderFirst=i;this.parent=e;this.link=t;this._rangeCallback=o;this.id=Uj.nextId()}get uri(){return this.link.uri}get range(){return this._range??this.link.targetSelectionRange??this.link.range}set range(i){this._range=i,this._rangeCallback(this)}get ariaMessage(){let i=this.parent.getPreview(this)?.preview(this.range);return i?d(1248,null,i.value,He(this.uri),this.range.startLineNumber,this.range.startColumn):d(1247,null,He(this.uri),this.range.startLineNumber,this.range.startColumn)}},hli=class{constructor(i){this._modelReference=i}dispose(){this._modelReference.dispose()}preview(i,e=8){let t=this._modelReference.object.textEditorModel;if(!t)return;let{startLineNumber:o,startColumn:n,endLineNumber:r,endColumn:s}=i,l=t.getWordUntilPosition({lineNumber:o,column:n-e}),c=new z(o,l.startColumn,o,n),u=new z(r,s,r,1073741824),p=t.getValueInRange(c).replace(/^\s+/,""),h=t.getValueInRange(i),g=t.getValueInRange(u).replace(/\s+$/,"");return{value:p+h+g,highlight:{start:p.length,end:p.length+h.length}}}},Zz=class{constructor(i,e){this.parent=i;this.uri=e;this.children=[];this._previews=new gt}dispose(){Be(this._previews.values()),this._previews.clear()}getPreview(i){return this._previews.get(i.uri)}get ariaMessage(){let i=this.children.length;return i===1?d(1245,null,He(this.uri),this.uri.fsPath):d(1246,null,i,He(this.uri),this.uri.fsPath)}async resolve(i){if(this._previews.size!==0)return this;for(let e of this.children)if(!this._previews.has(e.uri))try{let t=await i.createModelReference(e.uri);this._previews.set(e.uri,new hli(t))}catch(t){mt(t)}return this}},Cw=class a{constructor(i,e){this.groups=[];this.references=[];this._onDidChangeReferenceRange=new E;this.onDidChangeReferenceRange=this._onDidChangeReferenceRange.event;this._links=i,this._title=e;let[t]=i;i.sort(a._compareReferences);let o;for(let n of i)if((!o||!ar.isEqual(o.uri,n.uri,!0))&&(o=new Zz(this,n.uri),this.groups.push(o)),o.children.length===0||a._compareReferences(n,o.children[o.children.length-1])!==0){let r=new SR(t===n,o,n,s=>this._onDidChangeReferenceRange.fire(s));this.references.push(r),o.children.push(r)}}dispose(){Be(this.groups),this._onDidChangeReferenceRange.dispose(),this.groups.length=0}clone(){return new a(this._links,this._title)}get title(){return this._title}get isEmpty(){return this.groups.length===0}get ariaMessage(){return this.isEmpty?d(1249,null):this.references.length===1?d(1250,null,this.references[0].uri.fsPath):this.groups.length===1?d(1251,null,this.references.length,this.groups[0].uri.fsPath):d(1252,null,this.references.length,this.groups.length)}nextOrPreviousReference(i,e){let{parent:t}=i,o=t.children.indexOf(i),n=t.children.length,r=t.parent.groups.length;return r===1||e&&o+1<n||!e&&o>0?(e?o=(o+1)%n:o=(o+n-1)%n,t.children[o]):(o=t.parent.groups.indexOf(t),e?(o=(o+1)%r,t.parent.groups[o].children[0]):(o=(o+r-1)%r,t.parent.groups[o].children[t.parent.groups[o].children.length-1]))}nearestReference(i,e){let t=this.references.map((o,n)=>({idx:n,prefixLen:tf(o.uri.toString(),i.toString()),offsetDist:Math.abs(o.range.startLineNumber-e.lineNumber)*100+Math.abs(o.range.startColumn-e.column)})).sort((o,n)=>o.prefixLen>n.prefixLen?-1:o.prefixLen<n.prefixLen?1:o.offsetDist<n.offsetDist?-1:o.offsetDist>n.offsetDist?1:0)[0];if(t)return this.references[t.idx]}referenceAt(i,e){for(let t of this.references)if(t.uri.toString()===i.toString()&&z.containsPosition(t.range,e))return t}firstReference(){for(let i of this.references)if(i.isProviderFirst)return i;return this.references[0]}static _compareReferences(i,e){return ar.compare(i.uri,e.uri)||z.compareRangesUsingStarts(i.range,e.range)}};var _v=class extends x{constructor(e,t,o){super();this.options=t;this.styles=o;this.count=0;this.hover=this._register(new me);this.element=M(e,_(".monaco-count-badge")),this._register(Z(()=>e.removeChild(this.element))),this.countFormat=this.options.countFormat||"{0}",this.titleFormat=this.options.titleFormat||"",this.setCount(this.options.count||0),this.updateHover()}setCount(e){this.count=e,this.render()}setCountFormat(e){this.countFormat=e,this.render()}setTitleFormat(e){this.titleFormat=e,this.updateHover(),this.render()}updateHover(){this.titleFormat!==""&&!this.hover.value?this.hover.value=Up().setupDelayedHoverAtMouse(this.element,()=>({content:vd(this.titleFormat,this.count),appearance:{compact:!0}})):this.titleFormat===""&&this.hover.value&&(this.hover.value=void 0)}render(){this.element.textContent=vd(this.countFormat,this.count),this.element.style.backgroundColor=this.styles.badgeBackground??"",this.element.style.color=this.styles.badgeForeground??"",this.styles.badgeBorder&&(this.element.style.border=`1px solid ${this.styles.badgeBorder}`)}};var Ya=class a extends x{constructor(e,t){super();this.options=t;this.text="";this.title="";this.highlights=[];this.didEverRender=!1;this.domNode=M(e,_("span.monaco-highlighted-label"))}get element(){return this.domNode}set(e,t=[],o="",n,r){e||(e=""),n&&(e=a.escapeNewLines(e,t)),!(this.didEverRender&&this.text===e&&this.title===o&&eo(this.highlights,t))&&(this.text=e,this.title=o,this.highlights=t,this.render(r))}render(e){let t=[],o=0;for(let n of this.highlights){if(n.end===n.start)continue;if(o<n.start){let l=this.text.substring(o,n.start);e?t.push(...Un(l)):t.push(l),o=n.start}let r=this.text.substring(o,n.end),s=_("span.highlight",void 0,...e?Un(r):[r]);n.extraClasses&&s.classList.add(...n.extraClasses),t.push(s),o=n.end}if(o<this.text.length){let n=this.text.substring(o);e?t.push(...Un(n)):t.push(n)}if(vi(this.domNode,...t),!this.customHover&&this.title!==""){let n=this.options?.hoverDelegate??Ri("mouse");this.customHover=this._register(Up().setupManagedHover(n,this.domNode,this.title))}else this.customHover&&this.customHover.update(this.title);this.didEverRender=!0}static escapeNewLines(e,t){let o=0,n=0;return e.replace(/\r\n|\r|\n/g,(r,s)=>{n=r===`\r
`?-1:0,s+=o;for(let l of t)l.end<=s||(l.start>=s&&(l.start+=n),l.end>=s&&(l.end+=n));return o+=n,"\u23CE"})}};var Mce=class{constructor(i){this._element=i}get element(){return this._element}set textContent(i){this.disposed||i===this._textContent||(this._textContent=i,this._element.textContent=i)}set classNames(i){this.disposed||eo(i,this._classNames)||(this._classNames=i,this._element.classList.value="",this._element.classList.add(...i))}set empty(i){this.disposed||i===this._empty||(this._empty=i,this._element.style.marginLeft=i?"0":"")}dispose(){this.disposed=!0}},Bc=class extends x{constructor(e,t){super();this.customHovers=new Map;this.creationOptions=t,this.domNode=this._register(new Mce(M(e,_(".monaco-icon-label")))),this.labelContainer=M(this.domNode.element,_(".monaco-icon-label-container")),this.nameContainer=M(this.labelContainer,_("span.monaco-icon-name-container")),t?.supportHighlights||t?.supportIcons?this.nameNode=this._register(new fli(this.nameContainer,!!t.supportIcons)):this.nameNode=new gli(this.nameContainer),this.hoverDelegate=t?.hoverDelegate??Ri("mouse")}get element(){return this.domNode.element}setLabel(e,t,o){let n=["monaco-icon-label"],r=["monaco-icon-label-container"],s="";o&&(o.extraClasses&&n.push(...o.extraClasses),o.bold&&n.push("bold"),o.italic&&n.push("italic"),o.strikethrough&&n.push("strikethrough"),o.disabledCommand&&r.push("disabled"),o.title&&(typeof o.title=="string"?s+=o.title:s+=e));let l=this.domNode.element.querySelector(".monaco-icon-label-iconpath");if(o?.iconPath){let c;if(!l||!Do(l)?(c=_(".monaco-icon-label-iconpath"),this.domNode.element.prepend(c)):c=l,q.isThemeIcon(o.iconPath)){let u=q.asClassName(o.iconPath);c.className=`monaco-icon-label-iconpath ${u}`,c.style.backgroundImage=""}else c.style.backgroundImage=Qa(o?.iconPath);c.style.backgroundRepeat="no-repeat",c.style.backgroundPosition="center",c.style.backgroundSize="contain"}else l&&l.remove();if(this.domNode.classNames=n,this.domNode.element.setAttribute("aria-label",s),this.labelContainer.classList.value="",this.labelContainer.classList.add(...r),this.setupHover(o?.descriptionTitle?this.labelContainer:this.element,o?.title),this.nameNode.setLabel(e,o),t||this.descriptionNode){let c=this.getOrCreateDescriptionNode();if(c instanceof Ya){let u=o?.supportIcons??this.creationOptions?.supportIcons;c.set(t||"",o?o.descriptionMatches:void 0,void 0,o?.labelEscapeNewLines,u),this.setupHover(c.element,o?.descriptionTitle)}else c.textContent=t&&o?.labelEscapeNewLines?Ya.escapeNewLines(t,[]):t||"",this.setupHover(c.element,o?.descriptionTitle||""),c.empty=!t}if(o?.suffix||this.suffixNode){let c=this.getOrCreateSuffixNode();c.textContent=o?.suffix??""}}setupHover(e,t){let o=this.customHovers.get(e);if(o&&(o.dispose(),this.customHovers.delete(e)),!t){e.removeAttribute("title");return}let n=e;if(this.creationOptions?.hoverTargetOverride){if(!ts(e,this.creationOptions.hoverTargetOverride))throw new Error("hoverTargetOverrride must be an ancestor of the htmlElement");n=this.creationOptions.hoverTargetOverride}let r=Up().setupManagedHover(this.hoverDelegate,n,t);r&&this.customHovers.set(e,r)}dispose(){super.dispose();for(let e of this.customHovers.values())e.dispose();this.customHovers.clear()}getOrCreateSuffixNode(){if(!this.suffixNode){let e=this._register(new Mce(Tgt(this.nameContainer,_("span.monaco-icon-suffix-container"))));this.suffixNode=this._register(new Mce(M(e.element,_("span.label-suffix"))))}return this.suffixNode}getOrCreateDescriptionNode(){if(!this.descriptionNode){let e=this._register(new Mce(M(this.labelContainer,_("span.monaco-icon-description-container"))));this.creationOptions?.supportDescriptionHighlights?this.descriptionNode=this._register(new Ya(M(e.element,_("span.label-description")))):this.descriptionNode=this._register(new Mce(M(e.element,_("span.label-description"))))}return this.descriptionNode}},gli=class{constructor(i){this.container=i;this.label=void 0;this.singleLabel=void 0}setLabel(i,e){if(!(this.label===i&&eo(this.options,e)))if(this.label=i,this.options=e,typeof i=="string")this.singleLabel||(this.container.textContent="",this.container.classList.remove("multiple"),this.singleLabel=M(this.container,_("a.label-name",{id:e?.domId}))),this.singleLabel.textContent=i;else{this.container.textContent="",this.container.classList.add("multiple"),this.singleLabel=void 0;for(let t=0;t<i.length;t++){let o=i[t],n=e?.domId&&`${e?.domId}_${t}`;M(this.container,_("a.label-name",{id:n,"data-icon-label-count":i.length,"data-icon-label-index":t,role:"treeitem"},o)),t<i.length-1&&M(this.container,_("span.label-separator",void 0,e?.separator||"/"))}}}};function $zo(a,i,e){if(!e)return;let t=0;return a.map(o=>{let n={start:t,end:t+o.length},r=e.map(s=>lS.intersect(n,s)).filter(s=>!lS.isEmpty(s)).map(({start:s,end:l})=>({start:s-t,end:l-t}));return t=n.end+i.length,r})}var fli=class extends x{constructor(e,t){super();this.container=e;this.supportIcons=t;this.label=void 0;this.singleLabel=void 0;this._labelDisposables=this._register(new N)}setLabel(e,t){if(this.label===e&&eo(this.options,t))return;this.label=e,this.options=t;let o=t?.supportIcons??this.supportIcons;if(typeof e=="string")this.singleLabel||(this._labelDisposables.clear(),this.container.textContent="",this.container.classList.remove("multiple"),this.singleLabel=this._labelDisposables.add(new Ya(M(this.container,_("a.label-name",{id:t?.domId}))))),this.singleLabel.set(e,t?.matches,void 0,t?.labelEscapeNewLines,o);else{this._labelDisposables.clear(),this.container.textContent="",this.container.classList.add("multiple"),this.singleLabel=void 0;let n=t?.separator||"/",r=$zo(e,n,t?.matches);for(let s=0;s<e.length;s++){let l=e[s],c=r?r[s]:void 0,u=t?.domId&&`${t?.domId}_${s}`,p=_("a.label-name",{id:u,"data-icon-label-count":e.length,"data-icon-label-index":s,role:"treeitem"});this._labelDisposables.add(new Ya(M(this.container,p))).set(l,c,void 0,t?.labelEscapeNewLines,o),s<e.length-1&&M(p,_("span.label-separator",void 0,n))}}}};var rt=le("labelService");var Vxe=class{constructor(i){this._resolverService=i}hasChildren(i){return i instanceof Cw||i instanceof Zz}getChildren(i){if(i instanceof Cw)return i.groups;if(i instanceof Zz)return i.resolve(this._resolverService).then(e=>e.children);throw new Error("bad tree")}};Vxe=I([m(0,Bt)],Vxe);var bxt=class{getHeight(){return 23}getTemplateId(i){return i instanceof Zz?g5.id:F3e.id}},Bxe=class{constructor(i){this._keybindingService=i}getKeyboardNavigationLabel(i){if(i instanceof SR){let e=i.parent.getPreview(i)?.preview(i.range);if(e)return e.value}return He(i.uri)}mightProducePrintableCharacter(i){return this._keybindingService.mightProducePrintableCharacter(i)}};Bxe=I([m(0,_e)],Bxe);var Sxt=class{getId(i){return i instanceof SR?i.id:i.uri}},O3e=class extends x{constructor(e,t){super();this._labelService=t;let o=document.createElement("div");o.classList.add("reference-file"),this.file=this._register(new Bc(o,{supportHighlights:!0})),this.badge=this._register(new _v(M(o,_(".count")),{},iI)),e.appendChild(o)}set(e,t){let o=ci(e.uri);this.file.setLabel(this._labelService.getUriBasenameLabel(e.uri),this._labelService.getUriLabel(o,{relative:!0}),{title:this._labelService.getUriLabel(e.uri),matches:t});let n=e.children.length;this.badge.setCount(n),n>1?this.badge.setTitleFormat(d(1240,null,n)):this.badge.setTitleFormat(d(1239,null,n))}};O3e=I([m(1,rt)],O3e);var g5=class{constructor(i){this._instantiationService=i;this.templateId=g5.id}static{this.id="FileReferencesRenderer"}renderTemplate(i){return this._instantiationService.createInstance(O3e,i)}renderElement(i,e,t){t.set(i.element,xa(i.filterData))}disposeTemplate(i){i.dispose()}};g5=I([m(0,F)],g5);var vli=class extends x{constructor(i){super(),this.label=this._register(new Ya(i))}set(i,e){let t=i.parent.getPreview(i)?.preview(i.range);if(!t||!t.value)this.label.set(`${He(i.uri)}:${i.range.startLineNumber+1}:${i.range.startColumn+1}`);else{let{value:o,highlight:n}=t;e&&!kv.isDefault(e)?(this.label.element.classList.toggle("referenceMatch",!1),this.label.set(o,xa(e))):(this.label.element.classList.toggle("referenceMatch",!0),this.label.set(o,[n]))}}},F3e=class a{constructor(){this.templateId=a.id}static{this.id="OneReferenceRenderer"}renderTemplate(i){return new vli(i)}renderElement(i,e,t){t.set(i.element,i.filterData)}disposeTemplate(i){i.dispose()}},Ixt=class{getWidgetAriaLabel(){return d(1241,null)}getAriaLabel(i){return i.ariaMessage}};var bli=class a{constructor(i,e){this._editor=i;this._model=e;this._decorations=new Map;this._decorationIgnoreSet=new Set;this._callOnDispose=new N;this._callOnModelChange=new N;this._callOnDispose.add(this._editor.onDidChangeModel(()=>this._onModelChanged())),this._onModelChanged()}static{this.DecorationOptions=mo.register({description:"reference-decoration",stickiness:1,className:"reference-decoration"})}dispose(){this._callOnModelChange.dispose(),this._callOnDispose.dispose(),this.removeDecorations()}_onModelChanged(){this._callOnModelChange.clear();let i=this._editor.getModel();if(i){for(let e of this._model.references)if(e.uri.toString()===i.uri.toString()){this._addDecorations(e.parent);return}}}_addDecorations(i){if(!this._editor.hasModel())return;this._callOnModelChange.add(this._editor.getModel().onDidChangeDecorations(()=>this._onDecorationChanged()));let e=[],t=[];for(let o=0,n=i.children.length;o<n;o++){let r=i.children[o];this._decorationIgnoreSet.has(r.id)||r.uri.toString()===this._editor.getModel().uri.toString()&&(e.push({range:r.range,options:a.DecorationOptions}),t.push(o))}this._editor.changeDecorations(o=>{let n=o.deltaDecorations([],e);for(let r=0;r<n.length;r++)this._decorations.set(n[r],i.children[t[r]])})}_onDecorationChanged(){let i=[],e=this._editor.getModel();if(e){for(let[t,o]of this._decorations){let n=e.getDecorationRange(t);if(!n)continue;let r=!1;if(!z.equalsRange(n,o.range)){if(z.spansMultipleLines(n))r=!0;else{let s=o.range.endColumn-o.range.startColumn,l=n.endColumn-n.startColumn;s!==l&&(r=!0)}r?(this._decorationIgnoreSet.add(o.id),i.push(t)):o.range=n}}for(let t=0,o=i.length;t<o;t++)this._decorations.delete(i[t]);this._editor.removeDecorations(i)}}removeDecorations(){this._editor.removeDecorations([...this._decorations.keys()]),this._decorations.clear()}},yxt=class{constructor(){this.ratio=.7;this.heightInLines=18}static fromJSON(i){let e,t;try{let o=JSON.parse(i);e=o.ratio,t=o.heightInLines}catch{}return{ratio:e||.7,heightInLines:t||18}}},Sli=class extends rp{},W3e=class{constructor(i){this.labelService=i;this.disposables=new N}getDragURI(i){return i instanceof Zz?i.uri.toString():i instanceof SR?ZL(i.uri,i.range).toString():null}getDragLabel(i){return i.length===0?void 0:i.map(t=>this.labelService.getUriBasenameLabel(t.uri)).join(", ")}onDragStart(i,e){if(!e.dataTransfer)return;let o=i.elements.map(n=>this.getDragURI(n)).filter(Boolean);o.length&&(e.dataTransfer.setData(yl.RESOURCES,JSON.stringify(o)),e.dataTransfer.setData(yl.TEXT,o.join(`
`)))}onDragOver(){return!1}drop(){}dispose(){this.disposables.dispose()}};W3e=I([m(0,rt)],W3e);var Hxe=class extends GE{constructor(e,t,o,n,r,s,l,c,u){super(e,{showFrame:!1,showArrow:!0,isResizeable:!0,isAccessible:!0,supportOnTitleClick:!0},s);this._defaultTreeKeyboardSupport=t;this.layoutData=o;this._textModelResolverService=r;this._instantiationService=s;this._peekViewService=l;this._uriLabel=c;this._keybindingService=u;this._disposeOnNewModel=new N;this._callOnDispose=new N;this._onDidSelectReference=this._callOnDispose.add(new E);this.onDidSelectReference=this._onDidSelectReference.event;this._dim=new si(0,0);this._isClosing=!1;this._applyTheme(n.getColorTheme()),this._callOnDispose.add(n.onDidColorThemeChange(this._applyTheme.bind(this))),this._peekViewService.addExclusiveWidget(e,this),this.create()}get isClosing(){return this._isClosing}dispose(){this._isClosing=!0,this.setModel(void 0),this._callOnDispose.dispose(),this._disposeOnNewModel.dispose(),Be(this._preview),Be(this._previewNotAvailableMessage),Be(this._tree),Be(this._previewModelReference),this._splitView.dispose(),super.dispose()}_applyTheme(e){let t=e.getColor(K_)||We.transparent;this.style({arrowColor:t,frameColor:t,headerBackgroundColor:e.getColor(JV)||We.transparent,primaryHeadingColor:e.getColor(eF),secondaryHeadingColor:e.getColor(tF)})}show(e){super.show(e,this.layoutData.heightInLines||18)}focusOnReferenceTree(){this._tree.domFocus()}focusOnPreviewEditor(){this._preview.focus()}isPreviewEditorFocused(){return this._preview.hasTextFocus()}_onTitleClick(e){this._preview&&this._preview.getModel()&&this._onDidSelectReference.fire({element:this._getFocusedReference(),kind:e.ctrlKey||e.metaKey||e.altKey?"side":"open",source:"title"})}_fillBody(e){this.setCssClass("reference-zone-widget"),this._messageContainer=M(e,_("div.messages")),vo(this._messageContainer),this._splitView=new Ou(e,{orientation:1}),this._previewContainer=M(e,_("div.preview.inline"));let t={scrollBeyondLastLine:!1,scrollbar:{verticalScrollbarSize:14,horizontal:"auto",useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,alwaysConsumeMouseWheel:!0},overviewRulerLanes:2,fixedOverflowWidgets:!0,minimap:{enabled:!1}};this._preview=this._instantiationService.createInstance(id,this._previewContainer,t,{},this.editor),vo(this._previewContainer),this._previewNotAvailableMessage=this._instantiationService.createInstance(ip,d(1242,null),$r,ip.DEFAULT_CREATION_OPTIONS,null),this._treeContainer=M(e,_("div.ref-tree.inline"));let o={keyboardSupport:this._defaultTreeKeyboardSupport,accessibilityProvider:new Ixt,keyboardNavigationLabelProvider:this._instantiationService.createInstance(Bxe),identityProvider:new Sxt,openOnSingleClick:!0,selectionNavigation:!0,overrideStyles:{listBackground:zY},dnd:this._instantiationService.createInstance(W3e)};this._defaultTreeKeyboardSupport&&this._callOnDispose.add(Jo(this._treeContainer,"keydown",r=>{r.equals(9)&&(this._keybindingService.dispatchEvent(r,r.target),r.stopPropagation())},!0)),this._tree=this._instantiationService.createInstance(Sli,"ReferencesWidget",this._treeContainer,new bxt,[this._instantiationService.createInstance(g5),this._instantiationService.createInstance(F3e)],this._instantiationService.createInstance(Vxe),o),this._splitView.addView({onDidChange:U.None,element:this._previewContainer,minimumSize:200,maximumSize:Number.MAX_VALUE,layout:r=>{this._preview.layout({height:this._dim.height,width:r})}},Gl.Distribute),this._splitView.addView({onDidChange:U.None,element:this._treeContainer,minimumSize:100,maximumSize:Number.MAX_VALUE,layout:r=>{this._treeContainer.style.height=`${this._dim.height}px`,this._treeContainer.style.width=`${r}px`,this._tree.layout(this._dim.height,r)}},Gl.Distribute),this._disposables.add(this._splitView.onDidSashChange(()=>{this._dim.width&&(this.layoutData.ratio=this._splitView.getViewSize(0)/this._dim.width)},void 0));let n=(r,s)=>{r instanceof SR&&(s==="show"&&this._revealReference(r,!1),this._onDidSelectReference.fire({element:r,kind:s,source:"tree"}))};this._disposables.add(this._tree.onDidOpen(r=>{r.sideBySide?n(r.element,"side"):r.editorOptions.pinned?n(r.element,"goto"):n(r.element,"show")})),vo(this._treeContainer)}_onWidth(e){this._dim&&this._doLayoutBody(this._dim.height,e)}_doLayoutBody(e,t){super._doLayoutBody(e,t),this._dim=new si(t,e),this.layoutData.heightInLines=this._viewZone?this._viewZone.heightInLines:this.layoutData.heightInLines,this._splitView.layout(t),this._splitView.resizeView(0,t*this.layoutData.ratio)}setSelection(e){return this._revealReference(e,!0).then(()=>{this._model&&(this._tree.setSelection([e]),this._tree.setFocus([e]))})}setModel(e){return this._disposeOnNewModel.clear(),this._model=e,this._model?this._onNewModel():Promise.resolve()}_onNewModel(){return this._model?this._model.isEmpty?(this.setTitle(""),this._messageContainer.innerText=d(1243,null),un(this._messageContainer),Promise.resolve(void 0)):(vo(this._messageContainer),this._decorationsManager=new bli(this._preview,this._model),this._disposeOnNewModel.add(this._decorationsManager),this._disposeOnNewModel.add(this._model.onDidChangeReferenceRange(e=>this._tree.rerender(e))),this._disposeOnNewModel.add(this._preview.onMouseDown(e=>{let{event:t,target:o}=e;if(t.detail!==2)return;let n=this._getFocusedReference();n&&this._onDidSelectReference.fire({element:{uri:n.uri,range:o.range},kind:t.ctrlKey||t.metaKey||t.altKey?"side":"open",source:"editor"})})),this.container.classList.add("results-loaded"),un(this._treeContainer),un(this._previewContainer),this._splitView.layout(this._dim.width),this.focusOnReferenceTree(),this._tree.setInput(this._model.groups.length===1?this._model.groups[0]:this._model)):Promise.resolve(void 0)}_getFocusedReference(){let[e]=this._tree.getFocus();if(e instanceof SR)return e;if(e instanceof Zz&&e.children.length>0)return e.children[0]}async revealReference(e){await this._revealReference(e,!1),this._onDidSelectReference.fire({element:e,kind:"goto",source:"tree"})}async _revealReference(e,t){if(this._revealedReference===e)return;this._revealedReference=e,e.uri.scheme!==Q.inMemory?this.setTitle(Ga(e.uri),this._uriLabel.getUriLabel(ci(e.uri))):this.setTitle(d(1244,null));let o=this._textModelResolverService.createModelReference(e.uri);this._tree.getInput()===e.parent?this._tree.reveal(e):(t&&this._tree.reveal(e.parent),await this._tree.expand(e.parent),this._tree.reveal(e));let n=await o;if(!this._model){n.dispose();return}Be(this._previewModelReference);let r=n.object;if(r){let s=this._preview.getModel()===r.textEditorModel?0:1,l=z.lift(e.range).collapseToStart();this._previewModelReference=n,this._preview.setModel(r.textEditorModel),this._preview.setSelection(l),this._preview.revealRangeInCenter(l,s)}else this._preview.setModel(this._previewNotAvailableMessage),n.dispose()}};Hxe=I([m(3,Le),m(4,Bt),m(5,F),m(6,u5),m(7,rt),m(8,_e)],Hxe);var Pce=new Y("referenceSearchVisible",!1,d(1238,null)),jE=class{constructor(i,e,t,o,n,r,s,l){this._defaultTreeKeyboardSupport=i;this._editor=e;this._editorService=o;this._notificationService=n;this._instantiationService=r;this._storageService=s;this._configurationService=l;this._disposables=new N;this._requestIdPool=0;this._ignoreModelChangeEvent=!1;this._referenceSearchVisible=Pce.bindTo(t)}static{this.ID="editor.contrib.referencesController"}static get(i){return i.getContribution(jE.ID)}dispose(){this._referenceSearchVisible.reset(),this._disposables.dispose(),this._widget?.dispose(),this._model?.dispose(),this._widget=void 0,this._model=void 0}toggleWidget(i,e,t){let o;if(this._widget&&(o=this._widget.position),this.closeWidget(),o&&i.containsPosition(o))return;this._peekMode=t,this._referenceSearchVisible.set(!0),this._disposables.add(this._editor.onDidChangeModelLanguage(()=>{this.closeWidget()})),this._disposables.add(this._editor.onDidChangeModel(()=>{this._ignoreModelChangeEvent||this.closeWidget()}));let n="peekViewLayout",r=yxt.fromJSON(this._storageService.get(n,0,"{}"));this._widget=this._instantiationService.createInstance(Hxe,this._editor,this._defaultTreeKeyboardSupport,r),this._widget.setTitle(d(1236,null)),this._widget.show(i),this._disposables.add(this._widget.onDidClose(()=>{e.cancel(),this._widget?(this._storageService.store(n,JSON.stringify(this._widget.layoutData),0,1),this._widget.isClosing||this.closeWidget(),this._widget=void 0):this.closeWidget()})),this._disposables.add(this._widget.onDidSelectReference(l=>{let{element:c,kind:u}=l;if(c)switch(u){case"open":(l.source!=="editor"||!this._configurationService.getValue("editor.stablePeek"))&&this.openReference(c,!1,!1);break;case"side":this.openReference(c,!0,!1);break;case"goto":t?this._gotoReference(c,!0):this.openReference(c,!1,!0);break}}));let s=++this._requestIdPool;e.then(l=>{if(s!==this._requestIdPool||!this._widget){l.dispose();return}return this._model?.dispose(),this._model=l,this._widget.setModel(this._model).then(()=>{if(this._widget&&this._model&&this._editor.hasModel()){this._model.isEmpty?this._widget.setMetaTitle(""):this._widget.setMetaTitle(d(1237,null,this._model.title,this._model.references.length));let c=this._editor.getModel().uri,u=new ye(i.startLineNumber,i.startColumn),p=this._model.nearestReference(c,u);if(p)return this._widget.setSelection(p).then(()=>{this._widget&&this._editor.getOption(99)==="editor"&&this._widget.focusOnPreviewEditor()})}})},l=>{this._notificationService.error(l)})}changeFocusBetweenPreviewAndReferences(){this._widget&&(this._widget.isPreviewEditorFocused()?this._widget.focusOnReferenceTree():this._widget.focusOnPreviewEditor())}async goToNextOrPreviousReference(i){if(!this._editor.hasModel()||!this._model||!this._widget)return;let e=this._widget.position;if(!e)return;let t=this._model.nearestReference(this._editor.getModel().uri,e);if(!t)return;let o=this._model.nextOrPreviousReference(t,i),n=this._editor.hasTextFocus(),r=this._widget.isPreviewEditorFocused();await this._widget.setSelection(o),await this._gotoReference(o,!1),n?this._editor.focus():this._widget&&r&&this._widget.focusOnPreviewEditor()}async revealReference(i){!this._editor.hasModel()||!this._model||!this._widget||await this._widget.revealReference(i)}closeWidget(i=!0){this._widget?.dispose(),this._model?.dispose(),this._referenceSearchVisible.reset(),this._disposables.clear(),this._widget=void 0,this._model=void 0,i&&this._editor.focus(),this._requestIdPool+=1}_gotoReference(i,e){this._widget?.hide(),this._ignoreModelChangeEvent=!0;let t=z.lift(i.range).collapseToStart();return this._editorService.openCodeEditor({resource:i.uri,options:{selection:t,selectionSource:"code.jump",pinned:e}},this._editor).then(o=>{if(this._ignoreModelChangeEvent=!1,!o||!this._widget){this.closeWidget();return}if(this._editor===o)this._widget.show(t),this._widget.focusOnReferenceTree();else{let n=jE.get(o),r=this._model.clone();this.closeWidget(),o.focus(),n?.toggleWidget(t,Ln(s=>Promise.resolve(r)),this._peekMode??!1)}},o=>{this._ignoreModelChangeEvent=!1,mt(o)})}openReference(i,e,t){e||this.closeWidget();let{uri:o,range:n}=i;this._editorService.openCodeEditor({resource:o,options:{selection:n,selectionSource:"code.jump",pinned:t}},this._editor,e)}};jE=I([m(2,X),m(3,qt),m(4,Ne),m(5,F),m(6,ce),m(7,B)],jE);function Ace(a,i){let e=Rxe(a);if(!e)return;let t=jE.get(e);t&&i(t)}Ct.registerCommandAndKeybindingRule({id:"togglePeekWidgetFocus",weight:100,primary:Vi(2089,60),when:C.or(Pce,tg.inPeekEditor),handler(a){Ace(a,i=>{i.changeFocusBetweenPreviewAndReferences()})}});Ct.registerCommandAndKeybindingRule({id:"goToNextReference",weight:90,primary:62,secondary:[70],when:C.or(Pce,tg.inPeekEditor),handler(a){Ace(a,i=>{i.goToNextOrPreviousReference(!0)})}});Ct.registerCommandAndKeybindingRule({id:"goToPreviousReference",weight:90,primary:1086,secondary:[1094],when:C.or(Pce,tg.inPeekEditor),handler(a){Ace(a,i=>{i.goToNextOrPreviousReference(!1)})}});$e.registerCommandAlias("goToNextReferenceFromEmbeddedEditor","goToNextReference");$e.registerCommandAlias("goToPreviousReferenceFromEmbeddedEditor","goToPreviousReference");$e.registerCommandAlias("closeReferenceSearchEditor","closeReferenceSearch");$e.registerCommand("closeReferenceSearch",a=>Ace(a,i=>i.closeWidget()));Ct.registerKeybindingRule({id:"closeReferenceSearch",weight:-1,primary:9,secondary:[1033],when:C.and(tg.inPeekEditor,C.not("config.editor.stablePeek"))});Ct.registerKeybindingRule({id:"closeReferenceSearch",weight:250,primary:9,secondary:[1033],when:C.and(Pce,C.not("config.editor.stablePeek"),C.or(pe.editorTextFocus,ig.negate()))});Ct.registerCommandAndKeybindingRule({id:"revealReference",weight:200,primary:3,mac:{primary:3,secondary:[2066]},when:C.and(Pce,vc,Fxe.negate(),Wxe.negate()),handler(a){let e=a.get(Io).lastFocusedList?.getFocus();Array.isArray(e)&&e[0]instanceof SR&&Ace(a,t=>t.revealReference(e[0]))}});Ct.registerCommandAndKeybindingRule({id:"openReferenceToSide",weight:100,primary:2051,mac:{primary:259},when:C.and(Pce,vc,Fxe.negate(),Wxe.negate()),handler(a){let e=a.get(Io).lastFocusedList?.getFocus();Array.isArray(e)&&e[0]instanceof SR&&Ace(a,t=>t.openReference(e[0],!0,!0))}});$e.registerCommand("openReference",a=>{let e=a.get(Io).lastFocusedList?.getFocus();Array.isArray(e)&&e[0]instanceof SR&&Ace(a,t=>t.openReference(e[0],!1,!0))});var Ili=new Y("hasSymbols",!1,d(1253,null)),H3e=le("ISymbolNavigationService"),V3e=class{constructor(i,e,t,o){this._editorService=e;this._notificationService=t;this._keybindingService=o;this._currentModel=void 0;this._currentIdx=-1;this._ignoreEditorChange=!1;this._ctxHasSymbols=Ili.bindTo(i)}reset(){this._ctxHasSymbols.reset(),this._currentState?.dispose(),this._currentMessage?.close(),this._currentModel=void 0,this._currentIdx=-1}put(i){let e=i.parent.parent;if(e.references.length<=1){this.reset();return}this._currentModel=e,this._currentIdx=e.references.indexOf(i),this._ctxHasSymbols.set(!0),this._showMessage();let t=new B3e(this._editorService),o=t.onDidChange(n=>{if(this._ignoreEditorChange)return;let r=this._editorService.getActiveCodeEditor();if(!r)return;let s=r.getModel(),l=r.getPosition();if(!s||!l)return;let c=!1,u=!1;for(let p of e.references)if(Qe(p.uri,s.uri))c=!0,u=u||z.containsPosition(p.range,l);else if(c)break;(!c||!u)&&this.reset()});this._currentState=wn(t,o)}revealNext(i){if(!this._currentModel)return Promise.resolve();this._currentIdx+=1,this._currentIdx%=this._currentModel.references.length;let e=this._currentModel.references[this._currentIdx];return this._showMessage(),this._ignoreEditorChange=!0,this._editorService.openCodeEditor({resource:e.uri,options:{selection:z.collapseToStart(e.range),selectionRevealType:3}},i).finally(()=>{this._ignoreEditorChange=!1})}_showMessage(){this._currentMessage?.close();let i=this._keybindingService.lookupKeybinding("editor.gotoNextSymbolFromResult"),e=i?d(1255,null,this._currentIdx+1,this._currentModel.references.length,i.getLabel()):d(1254,null,this._currentIdx+1,this._currentModel.references.length);this._currentMessage=this._notificationService.status(e)}};V3e=I([m(0,X),m(1,qt),m(2,Ne),m(3,_e)],V3e);Ee(H3e,V3e,1);Xi(new class extends Oc{constructor(){super({id:"editor.gotoNextSymbolFromResult",precondition:Ili,kbOpts:{weight:100,primary:70}})}runEditorCommand(a,i){return a.get(H3e).revealNext(i)}});Ct.registerCommandAndKeybindingRule({id:"editor.gotoNextSymbolFromResult.cancel",weight:100,when:Ili,primary:9,handler(a){a.get(H3e).reset()}});var B3e=class{constructor(i){this._listener=new Map;this._disposables=new N;this._onDidChange=new E;this.onDidChange=this._onDidChange.event;this._disposables.add(i.onCodeEditorRemove(this._onDidRemoveEditor,this)),this._disposables.add(i.onCodeEditorAdd(this._onDidAddEditor,this)),i.listCodeEditors().forEach(this._onDidAddEditor,this)}dispose(){this._disposables.dispose(),this._onDidChange.dispose(),Be(this._listener.values())}_onDidAddEditor(i){this._listener.set(i,wn(i.onDidChangeCursorPosition(e=>this._onDidChange.fire({editor:i})),i.onDidChangeModelContent(e=>this._onDidChange.fire({editor:i}))))}_onDidRemoveEditor(i){this._listener.get(i)?.dispose(),this._listener.delete(i)}};B3e=I([m(0,qt)],B3e);function yli(a,i){return i.uri.scheme===a.uri.scheme?!0:!mV(i.uri,Q.walkThroughSnippet,Q.vscodeChatCodeBlock,Q.vscodeChatCodeCompareBlock)}async function U3e(a,i,e,t,o){let r=e.ordered(a,t).map(l=>Promise.resolve(o(l,a,i)).then(void 0,c=>{ys(c)})),s=await Promise.all(r);return di(s.flat()).filter(l=>yli(a,l))}function sF(a,i,e,t,o){return U3e(i,e,a,t,(n,r,s)=>n.provideDefinition(r,s,o))}function wxt(a,i,e,t,o){return U3e(i,e,a,t,(n,r,s)=>n.provideDeclaration(r,s,o))}function Uxe(a,i,e,t,o){return U3e(i,e,a,t,(n,r,s)=>n.provideImplementation(r,s,o))}function Cxt(a,i,e,t,o){return U3e(i,e,a,t,(n,r,s)=>n.provideTypeDefinition(r,s,o))}function qY(a,i,e,t,o,n){return U3e(i,e,a,o,async(r,s,l)=>{let c=(await r.provideReferences(s,l,{includeDeclaration:!0},n))?.filter(p=>yli(s,p));if(!t||!c||c.length!==2)return c;let u=(await r.provideReferences(s,l,{includeDeclaration:!1},n))?.filter(p=>yli(s,p));return u&&u.length===1?u:c})}async function eK(a){let i=await a(),e=new Cw(i,""),t=e.references.map(o=>o.link);return e.dispose(),t}qS("_executeDefinitionProvider",(a,i,e)=>{let t=a.get(Qt),o=sF(t.definitionProvider,i,e,!1,Se.None);return eK(()=>o)});qS("_executeDefinitionProvider_recursive",(a,i,e)=>{let t=a.get(Qt),o=sF(t.definitionProvider,i,e,!0,Se.None);return eK(()=>o)});qS("_executeTypeDefinitionProvider",(a,i,e)=>{let t=a.get(Qt),o=Cxt(t.typeDefinitionProvider,i,e,!1,Se.None);return eK(()=>o)});qS("_executeTypeDefinitionProvider_recursive",(a,i,e)=>{let t=a.get(Qt),o=Cxt(t.typeDefinitionProvider,i,e,!0,Se.None);return eK(()=>o)});qS("_executeDeclarationProvider",(a,i,e)=>{let t=a.get(Qt),o=wxt(t.declarationProvider,i,e,!1,Se.None);return eK(()=>o)});qS("_executeDeclarationProvider_recursive",(a,i,e)=>{let t=a.get(Qt),o=wxt(t.declarationProvider,i,e,!0,Se.None);return eK(()=>o)});qS("_executeReferenceProvider",(a,i,e)=>{let t=a.get(Qt),o=qY(t.referenceProvider,i,e,!1,!1,Se.None);return eK(()=>o)});qS("_executeReferenceProvider_recursive",(a,i,e)=>{let t=a.get(Qt),o=qY(t.referenceProvider,i,e,!1,!0,Se.None);return eK(()=>o)});qS("_executeImplementationProvider",(a,i,e)=>{let t=a.get(Qt),o=Uxe(t.implementationProvider,i,e,!1,Se.None);return eK(()=>o)});qS("_executeImplementationProvider_recursive",(a,i,e)=>{let t=a.get(Qt),o=Uxe(t.implementationProvider,i,e,!0,Se.None);return eK(()=>o)});ve.appendMenuItem(D.EditorContext,{submenu:D.EditorContextPeek,title:d(1229,null),group:"navigation",order:100});var Nce=class a{constructor(i,e){this.model=i;this.position=e}static is(i){return!i||typeof i!="object"?!1:!!(i instanceof a||ye.isIPosition(i.position)&&i.model)}},aF=class a extends pl{static{this._allSymbolNavigationCommands=new Map}static{this._activeAlternativeCommands=new Set}static all(){return a._allSymbolNavigationCommands.values()}static _patchConfig(i){let e={...i,f1:!0};if(e.menu)for(let t of vt.wrap(e.menu))(t.id===D.EditorContext||t.id===D.EditorContextPeek)&&(t.when=C.and(i.precondition,t.when));return e}constructor(i,e){super(a._patchConfig(e)),this.configuration=i,a._allSymbolNavigationCommands.set(e.id,this)}runEditorCommand(i,e,t,o){if(!e.hasModel())return Promise.resolve(void 0);let n=i.get(Ne),r=i.get(qt),s=i.get(wd),l=i.get(H3e),c=i.get(Qt),u=i.get(F),p=e.getModel(),h=e.getPosition(),g=Nce.is(t)?t:new Nce(p,h),f=new ek(e,5),v=Va(this._getLocationModel(c,g.model,g.position,f.token),f.token).then(async b=>{if(!b||f.token.isCancellationRequested)return;en(b.ariaMessage);let S;if(b.referenceAt(p.uri,h)){let w=this._getAlternativeCommand(e);w!==void 0&&!a._activeAlternativeCommands.has(w)&&a._allSymbolNavigationCommands.has(w)&&(S=a._allSymbolNavigationCommands.get(w))}let y=b.references.length;if(y===0){if(!this.configuration.muteMessage){let w=p.getWordAtPosition(h);xu.get(e)?.showMessage(this._getNoResultFoundMessage(w),h)}}else if(y===1&&S)a._activeAlternativeCommands.add(this.desc.id),u.invokeFunction(w=>S.runEditorCommand(w,e,t,o).finally(()=>{a._activeAlternativeCommands.delete(this.desc.id)}));else return this._onResult(r,l,e,b,o)},b=>{n.error(b)}).finally(()=>{f.dispose()});return s.showWhile(v,250),v}async _onResult(i,e,t,o,n){let r=this._getGoToPreference(t);if(!(t instanceof id)&&(this.configuration.openInPeek||r==="peek"&&o.references.length>1))this._openInPeek(t,o,n);else{let s=o.firstReference(),l=o.references.length>1&&r==="gotoAndPeek",c=await this._openReference(t,i,s,this.configuration.openToSide,!l);l&&c?this._openInPeek(c,o,n):o.dispose(),r==="goto"&&e.put(s)}}async _openReference(i,e,t,o,n){let r;if(Sji(t)&&(r=t.targetSelectionRange),r||(r=t.range),!r)return;let s=await e.openCodeEditor({resource:t.uri,options:{selection:z.collapseToStart(r),selectionRevealType:3,selectionSource:"code.jump"}},i,o);if(s){if(n){let l=s.getModel(),c=s.createDecorationsCollection([{range:r,options:{description:"symbol-navigate-action-highlight",className:"symbolHighlight"}}]);setTimeout(()=>{s.getModel()===l&&c.clear()},350)}return s}}_openInPeek(i,e,t){let o=jE.get(i);o&&i.hasModel()?o.toggleWidget(t??i.getSelection(),Ln(n=>Promise.resolve(e)),this.configuration.openInPeek):e.dispose()}},nB=class extends aF{async _getLocationModel(i,e,t,o){return new Cw(await sF(i.definitionProvider,e,t,!1,o),d(1212,null))}_getNoResultFoundMessage(i){return i&&i.word?d(1228,null,i.word):d(1214,null)}_getAlternativeCommand(i){return i.getOption(67).alternativeDefinitionCommand}_getGoToPreference(i){return i.getOption(67).multipleDefinitions}};W(class wli extends nB{static{this.id="editor.action.revealDefinition"}constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:wli.id,title:{...L(1200,"Go to Definition"),mnemonicTitle:d(1224,null)},precondition:pe.hasDefinitionProvider,keybinding:[{when:pe.editorTextFocus,primary:70,weight:100},{when:C.and(pe.editorTextFocus,Fu),primary:2118,weight:100}],menu:[{id:D.EditorContext,group:"navigation",order:1.1},{id:D.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:2}]}),$e.registerCommandAlias("editor.action.goToDeclaration",wli.id)}});W(class Cli extends nB{static{this.id="editor.action.revealDefinitionAside"}constructor(){super({openToSide:!0,openInPeek:!1,muteMessage:!1},{id:Cli.id,title:L(1202,"Open Definition to the Side"),precondition:C.and(pe.hasDefinitionProvider,pe.isInEmbeddedEditor.toNegated()),keybinding:[{when:pe.editorTextFocus,primary:Vi(2089,70),weight:100},{when:C.and(pe.editorTextFocus,Fu),primary:Vi(2089,2118),weight:100}]}),$e.registerCommandAlias("editor.action.openDeclarationToTheSide",Cli.id)}});W(class xli extends nB{static{this.id="editor.action.peekDefinition"}constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:xli.id,title:L(1208,"Peek Definition"),precondition:C.and(pe.hasDefinitionProvider,tg.notInPeekEditor,pe.isInEmbeddedEditor.toNegated()),keybinding:{when:pe.editorTextFocus,primary:582,linux:{primary:3140},weight:100},menu:{id:D.EditorContextPeek,group:"peek",order:2}}),$e.registerCommandAlias("editor.action.previewDeclaration",xli.id)}});var xxt=class extends aF{async _getLocationModel(i,e,t,o){return new Cw(await wxt(i.declarationProvider,e,t,!1,o),d(1211,null))}_getNoResultFoundMessage(i){return i&&i.word?d(1210,null,i.word):d(1209,null)}_getAlternativeCommand(i){return i.getOption(67).alternativeDeclarationCommand}_getGoToPreference(i){return i.getOption(67).multipleDeclarations}};W(class T7i extends xxt{static{this.id="editor.action.revealDeclaration"}constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:T7i.id,title:{...L(1201,"Go to Declaration"),mnemonicTitle:d(1223,null)},precondition:C.and(pe.hasDeclarationProvider,pe.isInEmbeddedEditor.toNegated()),menu:[{id:D.EditorContext,group:"navigation",order:1.3},{id:D.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:3}]})}_getNoResultFoundMessage(i){return i&&i.word?d(1210,null,i.word):d(1209,null)}});W(class extends xxt{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.peekDeclaration",title:L(1205,"Peek Declaration"),precondition:C.and(pe.hasDeclarationProvider,tg.notInPeekEditor,pe.isInEmbeddedEditor.toNegated()),menu:{id:D.EditorContextPeek,group:"peek",order:3}})}});var kxt=class extends aF{async _getLocationModel(i,e,t,o){return new Cw(await Cxt(i.typeDefinitionProvider,e,t,!1,o),d(1234,null))}_getNoResultFoundMessage(i){return i&&i.word?d(1220,null,i.word):d(1219,null)}_getAlternativeCommand(i){return i.getOption(67).alternativeTypeDefinitionCommand}_getGoToPreference(i){return i.getOption(67).multipleTypeDefinitions}};W(class _7i extends kxt{static{this.ID="editor.action.goToTypeDefinition"}constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:_7i.ID,title:{...L(1204,"Go to Type Definition"),mnemonicTitle:d(1227,null)},precondition:pe.hasTypeDefinitionProvider,keybinding:{when:pe.editorTextFocus,primary:0,weight:100},menu:[{id:D.EditorContext,group:"navigation",order:1.4},{id:D.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:3}]})}});W(class D7i extends kxt{static{this.ID="editor.action.peekTypeDefinition"}constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:D7i.ID,title:L(1207,"Peek Type Definition"),precondition:C.and(pe.hasTypeDefinitionProvider,tg.notInPeekEditor,pe.isInEmbeddedEditor.toNegated()),menu:{id:D.EditorContextPeek,group:"peek",order:4}})}});var Ext=class extends aF{async _getLocationModel(i,e,t,o){return new Cw(await Uxe(i.implementationProvider,e,t,!1,o),d(1221,null))}_getNoResultFoundMessage(i){return i&&i.word?d(1217,null,i.word):d(1216,null)}_getAlternativeCommand(i){return i.getOption(67).alternativeImplementationCommand}_getGoToPreference(i){return i.getOption(67).multipleImplementations}};W(class L7i extends Ext{static{this.ID="editor.action.goToImplementation"}constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:L7i.ID,title:{...L(1203,"Go to Implementations"),mnemonicTitle:d(1225,null)},precondition:pe.hasImplementationProvider,keybinding:{when:pe.editorTextFocus,primary:2118,weight:100},menu:[{id:D.EditorContext,group:"navigation",order:1.45},{id:D.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:4}]})}});W(class R7i extends Ext{static{this.ID="editor.action.peekImplementation"}constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:R7i.ID,title:L(1206,"Peek Implementations"),precondition:C.and(pe.hasImplementationProvider,tg.notInPeekEditor,pe.isInEmbeddedEditor.toNegated()),keybinding:{when:pe.editorTextFocus,primary:3142,weight:100},menu:{id:D.EditorContextPeek,group:"peek",order:5}})}});var Txt=class extends aF{_getNoResultFoundMessage(i){return i?d(1232,null,i.word):d(1233,null)}_getAlternativeCommand(i){return i.getOption(67).alternativeReferenceCommand}_getGoToPreference(i){return i.getOption(67).multipleReferences}};W(class extends Txt{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:"editor.action.goToReferences",title:{...L(1218,"Go to References"),mnemonicTitle:d(1226,null)},precondition:C.and(pe.hasReferenceProvider,tg.notInPeekEditor,pe.isInEmbeddedEditor.toNegated()),keybinding:{when:pe.editorTextFocus,primary:1094,weight:100},menu:[{id:D.EditorContext,group:"navigation",order:1.45},{id:D.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:5}]})}async _getLocationModel(i,e,t,o){return new Cw(await qY(i.referenceProvider,e,t,!0,!1,o),d(1230,null))}});W(class extends Txt{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.referenceSearch.trigger",title:L(1231,"Peek References"),precondition:C.and(pe.hasReferenceProvider,tg.notInPeekEditor,pe.isInEmbeddedEditor.toNegated()),menu:{id:D.EditorContextPeek,group:"peek",order:6}})}async _getLocationModel(i,e,t,o){return new Cw(await qY(i.referenceProvider,e,t,!1,!1,o),d(1230,null))}});var kli=class extends aF{constructor(e,t,o){super(e,{id:"editor.action.goToLocation",title:L(1222,"Go to Any Symbol"),precondition:C.and(tg.notInPeekEditor,pe.isInEmbeddedEditor.toNegated())});this._references=t;this._gotoMultipleBehaviour=o}async _getLocationModel(e,t,o,n){return new Cw(this._references,d(1215,null))}_getNoResultFoundMessage(e){return e&&d(1213,null,e.word)||""}_getGoToPreference(e){return this._gotoMultipleBehaviour??e.getOption(67).multipleReferences}_getAlternativeCommand(){}};$e.registerCommand({id:"editor.action.goToLocations",metadata:{description:"Go to locations from a position in a file",args:[{name:"uri",description:"The text document in which to start",constraint:A},{name:"position",description:"The position at which to start",constraint:ye.isIPosition},{name:"locations",description:"An array of locations.",constraint:Array},{name:"multiple",description:"Define what to do when having multiple results, either `peek`, `gotoAndPeek`, or `goto`"},{name:"noResultsMessage",description:"Human readable message that shows when locations is empty."}]},handler:async(a,i,e,t,o,n,r)=>{wo(A.isUri(i)),wo(ye.isIPosition(e)),wo(Array.isArray(t)),wo(typeof o>"u"||typeof o=="string"),wo(typeof r>"u"||typeof r=="boolean");let s=a.get(qt),l=await s.openCodeEditor({resource:i},s.getFocusedCodeEditor());if(pn(l))return l.setPosition(e),l.revealPositionInCenterIfOutsideViewport(e,0),l.invokeWithinContext(c=>{let u=new class extends kli{_getNoResultFoundMessage(p){return n||super._getNoResultFoundMessage(p)}}({muteMessage:!n,openInPeek:!!r,openToSide:!1},t,o);c.get(F).invokeFunction(u.run.bind(u),l)})}});$e.registerCommand({id:"editor.action.peekLocations",metadata:{description:"Peek locations from a position in a file",args:[{name:"uri",description:"The text document in which to start",constraint:A},{name:"position",description:"The position at which to start",constraint:ye.isIPosition},{name:"locations",description:"An array of locations.",constraint:Array},{name:"multiple",description:"Define what to do when having multiple results, either `peek`, `gotoAndPeek`, or `goto`"}]},handler:async(a,i,e,t,o)=>{a.get(ge).executeCommand("editor.action.goToLocations",i,e,t,o,void 0,!0)}});$e.registerCommand({id:"editor.action.findReferences",handler:(a,i,e)=>{wo(A.isUri(i)),wo(ye.isIPosition(e));let t=a.get(Qt),o=a.get(qt);return o.openCodeEditor({resource:i},o.getFocusedCodeEditor()).then(n=>{if(!pn(n)||!n.hasModel())return;let r=jE.get(n);if(!r)return;let s=Ln(c=>qY(t.referenceProvider,n.getModel(),ye.lift(e),!1,!1,c).then(u=>new Cw(u,d(1230,null)))),l=new z(e.lineNumber,e.column,e.lineNumber,e.column);return Promise.resolve(r.toggleWidget(l,s,!1))})}});$e.registerCommandAlias("editor.action.showReferences","editor.action.peekLocations");async function M7i(a,i,e,t){let o=a.get(Bt),n=a.get(Xe),r=a.get(ge),s=a.get(F),l=a.get(Ne);if(await t.item.resolve(Se.None),!t.part.location)return;let c=t.part.location,u=[],p=new Set(ve.getMenuItems(D.EditorContext).map(g=>gE(g)?g.command.id:xt()));for(let g of aF.all())p.has(g.desc.id)&&u.push(new it(g.desc.id,Lo.label(g.desc,{renderShortTitle:!0}),void 0,!0,async()=>{let f=await o.createModelReference(c.uri);try{let v=new Nce(f.object.textEditorModel,z.getStartPosition(c.range)),b=t.item.anchor.range;await s.invokeFunction(g.runEditorCommand.bind(g),i,v,b)}finally{f.dispose()}}));if(t.part.command){let{command:g}=t.part;u.push(new ri),u.push(new it(g.id,g.title,void 0,!0,async()=>{try{await r.executeCommand(g.id,...g.arguments??[])}catch(f){l.notify({severity:ft.Error,source:t.item.provider.displayName,message:f})}}))}let h=i.getOption(144);n.showContextMenu({domForShadowRoot:h?i.getDomNode()??void 0:void 0,getAnchor:()=>{let g=ir(e);return{x:g.left,y:g.top+g.height+8}},getActions:()=>u,onHide:()=>{i.focus()},autoSelectFirstItem:!0})}async function _xt(a,i,e,t){let n=await a.get(Bt).createModelReference(t.uri);await e.invokeWithinContext(async r=>{let s=i.hasSideBySideModifier,l=r.get(X),c=tg.inPeekEditor.getValue(l),u=!s&&e.getOption(101)&&!c;return new nB({openToSide:s,openInPeek:u,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(r,new Nce(n.object.textEditorModel,z.getStartPosition(t.range)),z.lift(t.range))}),n.dispose()}var Eli=class a{constructor(){this._entries=new dl(50)}get(i){let e=a._key(i);return this._entries.get(e)}set(i,e){let t=a._key(i);this._entries.set(t,e)}static _key(i){return`${i.uri.toString()}/${i.getVersionId()}`}},P7i=le("IInlayHintsCache");Ee(P7i,Eli,1);var zxe=class{constructor(i,e){this.item=i;this.index=e}get part(){let i=this.item.hint.label;return typeof i=="string"?{label:i}:i[this.index]}},Tli=class{constructor(i,e){this.part=i;this.hasTriggerModifier=e}};var _li=class{constructor(){this._store=new me;this._tokenSource=new Ye}dispose(){this._store.dispose(),this._tokenSource.dispose(!0)}reset(){return this._tokenSource.dispose(!0),this._tokenSource=new Ye,this._store.value=new N,{store:this._store.value,token:this._tokenSource.token}}},QE=class{constructor(i,e,t,o,n,r,s){this._editor=i;this._languageFeaturesService=e;this._inlayHintsCache=o;this._commandService=n;this._notificationService=r;this._instaService=s;this._disposables=new N;this._sessionDisposables=new N;this._decorationsMetadata=new Map;this._activeRenderMode=0;this._ruleFactory=this._disposables.add(new M7(this._editor)),this._debounceInfo=t.for(e.inlayHintsProvider,"InlayHint",{min:25}),this._disposables.add(e.inlayHintsProvider.onDidChange(()=>this._update())),this._disposables.add(i.onDidChangeModel(()=>this._update())),this._disposables.add(i.onDidChangeModelLanguage(()=>this._update())),this._disposables.add(i.onDidChangeConfiguration(l=>{l.hasChanged(159)&&this._update()})),this._update()}static{this.ID="editor.contrib.InlayHints"}static{this._MAX_DECORATORS=1500}static{this._whitespaceData={}}static get(i){return i.getContribution(QE.ID)??void 0}dispose(){this._sessionDisposables.dispose(),this._removeAllDecorations(),this._disposables.dispose()}_update(){this._sessionDisposables.clear(),this._removeAllDecorations();let i=this._editor.getOption(159);if(i.enabled==="off")return;let e=this._editor.getModel();if(!e||!this._languageFeaturesService.inlayHintsProvider.has(e))return;if(i.enabled==="on")this._activeRenderMode=0;else{let c,u;i.enabled==="onUnlessPressed"?(c=0,u=1):(c=1,u=0),this._activeRenderMode=c,this._sessionDisposables.add(nb.getInstance().event(p=>{if(!this._editor.hasModel())return;let h=p.altKey&&p.ctrlKey&&!(p.shiftKey||p.metaKey)?u:c;if(h!==this._activeRenderMode){this._activeRenderMode=h;let g=this._editor.getModel(),f=this._copyInlayHintsWithCurrentAnchor(g);this._updateHintsDecorators([g.getFullModelRange()],f),s.schedule(0)}}))}let t=this._inlayHintsCache.get(e);t&&this._updateHintsDecorators([e.getFullModelRange()],t),this._sessionDisposables.add(Z(()=>{e.isDisposed()||this._cacheHintsForFastRestore(e)}));let o,n=new Set;this._sessionDisposables.add(e.onWillDispose(()=>o?.cancel()));let r=this._sessionDisposables.add(new _li),s=new Dt(async()=>{let c=Date.now(),{store:u,token:p}=r.reset();try{let h=await k3e.create(this._languageFeaturesService.inlayHintsProvider,e,this._getHintsRanges(),p);if(s.delay=this._debounceInfo.update(e,Date.now()-c),p.isCancellationRequested){h.dispose();return}for(let g of h.provider)typeof g.onDidChangeInlayHints=="function"&&!n.has(g)&&(n.add(g),u.add(g.onDidChangeInlayHints(()=>{s.isScheduled()||s.schedule()})));u.add(h),u.add(Z(()=>n.clear())),this._updateHintsDecorators(h.ranges,h.items),this._cacheHintsForFastRestore(e)}catch(h){mt(h)}},this._debounceInfo.get(e));this._sessionDisposables.add(s),s.schedule(0),this._sessionDisposables.add(this._editor.onDidScrollChange(c=>{(c.scrollTopChanged||!s.isScheduled())&&s.schedule()}));let l=this._sessionDisposables.add(new me);this._sessionDisposables.add(this._editor.onDidChangeModelContent(c=>{o?.cancel();let u=Math.max(s.delay,800);this._cursorInfo={position:this._editor.getPosition(),notEarlierThan:Date.now()+u},l.value=tn(()=>s.schedule(0),u),s.schedule()})),this._sessionDisposables.add(this._editor.onDidChangeConfiguration(c=>{c.hasChanged(159)&&s.schedule()})),this._sessionDisposables.add(this._installDblClickGesture(()=>s.schedule(0))),this._sessionDisposables.add(this._installLinkGesture()),this._sessionDisposables.add(this._installContextMenu())}_installLinkGesture(){let i=new N,e=i.add(new JO(this._editor)),t=new N;return i.add(t),i.add(e.onMouseMoveOrRelevantKeyDown(o=>{let[n]=o,r=this._getInlayHintLabelPart(n),s=this._editor.getModel();if(!r||!s){t.clear();return}let l=new Ye;t.add(Z(()=>l.dispose(!0))),r.item.resolve(l.token),this._activeInlayHintPart=r.part.command||r.part.location?new Tli(r,n.hasTriggerModifier):void 0;let c=s.validatePosition(r.item.hint.position).lineNumber,u=new z(c,1,c,s.getLineMaxColumn(c)),p=this._getInlineHintsForRange(u);this._updateHintsDecorators([u],p),t.add(Z(()=>{this._activeInlayHintPart=void 0,this._updateHintsDecorators([u],p)}))})),i.add(e.onCancel(()=>t.clear())),i.add(e.onExecute(async o=>{let n=this._getInlayHintLabelPart(o);if(n){let r=n.part;r.location?this._instaService.invokeFunction(_xt,o,this._editor,r.location):qae.is(r.command)&&await this._invokeCommand(r.command,n.item)}})),i}_getInlineHintsForRange(i){let e=new Set;for(let t of this._decorationsMetadata.values())i.containsRange(t.item.anchor.range)&&e.add(t.item);return Array.from(e)}_installDblClickGesture(i){return this._editor.onMouseUp(async e=>{if(e.event.detail!==2)return;let t=this._getInlayHintLabelPart(e);if(t&&(e.event.preventDefault(),await t.item.resolve(Se.None),yr(t.item.hint.textEdits))){let o=t.item.hint.textEdits.map(n=>Hn.replace(z.lift(n.range),n.text));this._editor.executeEdits("inlayHint.default",o),i()}})}_installContextMenu(){return this._editor.onContextMenu(async i=>{if(!Do(i.event.target))return;let e=this._getInlayHintLabelPart(i);e&&await this._instaService.invokeFunction(M7i,this._editor,i.event.target,e)})}_getInlayHintLabelPart(i){if(i.target.type!==6)return;let e=i.target.detail.injectedText?.options;if(e instanceof gz&&e?.attachedData instanceof zxe)return e.attachedData}async _invokeCommand(i,e){try{await this._commandService.executeCommand(i.id,...i.arguments??[])}catch(t){this._notificationService.notify({severity:ft.Error,source:e.provider.displayName,message:t})}}_cacheHintsForFastRestore(i){let e=this._copyInlayHintsWithCurrentAnchor(i);this._inlayHintsCache.set(i,e)}_copyInlayHintsWithCurrentAnchor(i){let e=new Map;for(let[t,o]of this._decorationsMetadata){if(e.has(o.item))continue;let n=i.getDecorationRange(t);if(n){let r=new x3e(n,o.item.anchor.direction),s=o.item.with({anchor:r});e.set(o.item,s)}}return Array.from(e.values())}_getHintsRanges(){let e=this._editor.getModel(),t=this._editor.getVisibleRangesPlusViewportAboveBelow(),o=[];for(let n of t.sort(z.compareRangesUsingStarts)){let r=e.validateRange(new z(n.startLineNumber-30,n.startColumn,n.endLineNumber+30,n.endColumn));o.length===0||!z.areIntersectingOrTouching(o[o.length-1],r)?o.push(r):o[o.length-1]=z.plusRange(o[o.length-1],r)}return o}_updateHintsDecorators(i,e){let t=new Map;if(this._cursorInfo&&this._cursorInfo.notEarlierThan>Date.now()&&i.some(b=>b.containsPosition(this._cursorInfo.position))){let{position:b}=this._cursorInfo;this._cursorInfo=void 0;let S=new Map;for(let T of this._editor.getLineDecorations(b.lineNumber)??[]){let P=this._decorationsMetadata.get(T.id);if(T.range.startColumn>b.column)continue;let O=P?.decoration.options[P.item.anchor.direction];if(O&&O.attachedData!==QE._whitespaceData){let V=S.get(P.item)??0;S.set(P.item,V+O.content.length)}}let y=e.filter(T=>T.anchor.range.startLineNumber===b.lineNumber&&T.anchor.range.endColumn<=b.column),w=Array.from(S.values()),k;for(;;){let T=y.shift(),P=w.shift();if(!P&&!T)break;if(T)t.set(T,P??0),k=T;else if(k&&P){let O=t.get(k);O+=P,O+=w.reduce((V,H)=>V+H,0),w.length=0;break}}}let o=[],n=(b,S,y,w,k)=>{let T={content:y,inlineClassNameAffectsLetterSpacing:!0,inlineClassName:S.className,cursorStops:w,attachedData:k};o.push({item:b,classNameRef:S,decoration:{range:b.anchor.range,options:{description:"InlayHint",showIfCollapsed:b.anchor.range.isEmpty(),collapseOnReplaceEdit:!b.anchor.range.isEmpty(),stickiness:0,[b.anchor.direction]:this._activeRenderMode===0?T:void 0}}})},r=(b,S)=>{let y=this._ruleFactory.createClassNameRef({width:`${s/3|0}px`,display:"inline-block"});n(b,y,"\u200A",S?1:3,QE._whitespaceData)},{fontSize:s,fontFamily:l,padding:c,isUniform:u}=this._getLayoutInfo(),p=this._editor.getOption(159).maximumLength,h="--code-editorInlayHintsFontFamily";this._editor.getContainerDomNode().style.setProperty(h,l);let g={line:0,totalLen:0};for(let b=0;b<e.length;b++){let S=e[b];if(g.line!==S.anchor.range.startLineNumber&&(g={line:S.anchor.range.startLineNumber,totalLen:0}),p&&g.totalLen>p)continue;S.hint.paddingLeft&&r(S,!1);let y=typeof S.hint.label=="string"?[{label:S.hint.label}]:S.hint.label,w=t.get(S),k=0;for(let T=0;T<y.length;T++){let P=y[T],O=T===0,V=T===y.length-1,H={fontSize:`${s}px`,fontFamily:`var(${h}), ${fu.fontFamily}`,verticalAlign:u?"baseline":"middle",unicodeBidi:"isolate"};yr(S.hint.textEdits)&&(H.cursor="default"),this._fillInColors(H,S.hint),(P.command||P.location)&&this._activeInlayHintPart?.part.item===S&&this._activeInlayHintPart.part.index===T&&(H.textDecoration="underline",this._activeInlayHintPart.hasTriggerModifier&&(H.color=Xs(C5i),H.cursor="pointer"));let G=P.label;g.totalLen+=G.length;let $=!1,J=p!==0?g.totalLen-p:0;if(J>0&&(G=G.slice(0,-J)+"\u2026",$=!0),k+=G.length,w!==void 0){let ae=k-w;ae>=0&&(k-=ae,G=G.slice(0,-(1+ae))+"\u2026",$=!0)}if(c&&(O&&(V||$)?(H.padding=`1px ${Math.max(1,s/4)|0}px`,H.borderRadius=`${s/4|0}px`):O?(H.padding=`1px 0 1px ${Math.max(1,s/4)|0}px`,H.borderRadius=`${s/4|0}px 0 0 ${s/4|0}px`):V||$?(H.padding=`1px ${Math.max(1,s/4)|0}px 1px 0`,H.borderRadius=`0 ${s/4|0}px ${s/4|0}px 0`):H.padding="1px 0 1px 0"),n(S,this._ruleFactory.createClassNameRef(H),jzo(G),V&&!S.hint.paddingRight?1:3,new zxe(S,T)),$)break}if(w!==void 0&&k<w){let T=w-k;n(S,this._ruleFactory.createClassNameRef({}),"\u200A".repeat(T),3)}if(S.hint.paddingRight&&r(S,!0),o.length>QE._MAX_DECORATORS)break}let f=[];for(let[b,S]of this._decorationsMetadata){let y=this._editor.getModel()?.getDecorationRange(b);y&&i.some(w=>w.containsRange(y))&&(f.push(b),S.classNameRef.dispose(),this._decorationsMetadata.delete(b))}let v=DC.capture(this._editor);this._editor.changeDecorations(b=>{let S=b.deltaDecorations(f,o.map(y=>y.decoration));for(let y=0;y<S.length;y++){let w=o[y];this._decorationsMetadata.set(S[y],w)}}),v.restore(this._editor)}_fillInColors(i,e){e.kind===2?(i.backgroundColor=Xs(P5i),i.color=Xs(M5i)):e.kind===1?(i.backgroundColor=Xs(R5i),i.color=Xs(L5i)):(i.backgroundColor=Xs(Nvt),i.color=Xs(Avt))}_getLayoutInfo(){let i=this._editor.getOption(159),e=i.padding,t=this._editor.getOption(61),o=this._editor.getOption(58),n=i.fontSize;(!n||n<5||n>t)&&(n=t);let r=i.fontFamily||o;return{fontSize:n,fontFamily:r,padding:e,isUniform:!e&&r===o&&n===t}}_removeAllDecorations(){this._editor.removeDecorations(Array.from(this._decorationsMetadata.keys()));for(let i of this._decorationsMetadata.values())i.classNameRef.dispose();this._decorationsMetadata.clear()}getInlayHintsForLine(i){if(!this._editor.hasModel())return[];let e=new Set,t=[];for(let o of this._editor.getLineDecorations(i)){let n=this._decorationsMetadata.get(o.id);n&&!e.has(n.item.hint)&&(e.add(n.item.hint),t.push(n.item))}return t}};QE=I([m(1,Qt),m(2,hf),m(3,P7i),m(4,ge),m(5,Ne),m(6,F)],QE);function jzo(a){return a.replace(/[ \t]/g,"\xA0")}$e.registerCommand("_executeInlayHintProvider",async(a,...i)=>{let[e,t]=i;wo(A.isUri(e)),wo(z.isIRange(t));let{inlayHintsProvider:o}=a.get(Qt),n=await a.get(Bt).createModelReference(e);try{let r=await k3e.create(o,n.object.textEditorModel,[z.lift(t)],Se.None),s=r.items.map(l=>l.hint);return setTimeout(()=>r.dispose(),0),s}finally{n.dispose()}});var Dxt=class extends r5{constructor(e,t,o,n){super(10,t,e.item.anchor.range,o,n,!0);this.part=e}},$Y=class extends Gz{constructor(e,t,o,n,r,s,l,c){super(e,t,r,l,o,n,c);this._resolverService=s;this.hoverOrdinal=6}suggestHoverAnchor(e){if(!QE.get(this._editor)||e.target.type!==6)return null;let o=e.target.detail.injectedText?.options;return o instanceof gz&&o.attachedData instanceof zxe?new Dxt(o.attachedData,this,e.event.posx,e.event.posy):null}computeSync(){return[]}computeAsync(e,t,o,n){return e instanceof Dxt?new fp(async r=>{let{part:s}=e;if(await s.item.resolve(n),n.isCancellationRequested)return;let l;typeof s.item.hint.tooltip=="string"?l=new Ie().appendText(s.item.hint.tooltip):s.item.hint.tooltip&&(l=s.item.hint.tooltip),l&&r.emitOne(new KE(this,e.range,[l],!1,0)),yr(s.item.hint.textEdits)&&r.emitOne(new KE(this,e.range,[new Ie().appendText(d(1325,null))],!1,10001));let c;if(typeof s.part.tooltip=="string"?c=new Ie().appendText(s.part.tooltip):s.part.tooltip&&(c=s.part.tooltip),c&&r.emitOne(new KE(this,e.range,[c],!1,1)),s.part.location||s.part.command){let p,g=this._editor.getOption(86)==="altKey"?Ze?d(1331,null):d(1330,null):Ze?d(1329,null):d(1328,null);s.part.location&&s.part.command?p=new Ie().appendText(d(1327,null,g)):s.part.location?p=new Ie().appendText(d(1326,null,g)):s.part.command&&(p=new Ie(`[${d(1324,null)}](${zCt(s.part.command)} "${s.part.command.title}") (${g})`,{isTrusted:!0})),p&&r.emitOne(new KE(this,e.range,[p],!1,1e4))}let u=this._resolveInlayHintLabelPartHover(s,n);for await(let p of u)r.emitOne(p)}):fp.EMPTY}async*_resolveInlayHintLabelPartHover(e,t){if(!e.part.location)return;let{uri:o,range:n}=e.part.location,r=await this._resolverService.createModelReference(o);try{let s=r.object.textEditorModel;if(!this._languageFeaturesService.hoverProvider.has(s))return;for await(let l of y3e(this._languageFeaturesService.hoverProvider,s,new ye(n.startLineNumber,n.startColumn),t))UV(l.hover.contents)||(yield new KE(this,e.item.anchor.range,l.hover.contents,!1,2+l.ordinal))}finally{r.dispose()}}};$Y=I([m(1,On),m(2,_e),m(3,nt),m(4,B),m(5,Bt),m(6,Qt),m(7,ge)],$Y);var Lxt=class{constructor(i,e,t){this.marker=i;this.index=e;this.total=t}},Oce=class{constructor(i,e,t){this._markerService=e;this._configService=t;this._onDidChange=new E;this.onDidChange=this._onDidChange.event;this._dispoables=new N;this._markers=[];this._nextIdx=-1;A.isUri(i)?this._resourceFilter=s=>s.toString()===i.toString():i&&(this._resourceFilter=i);let o=this._configService.getValue("problems.sortOrder"),n=(s,l)=>{let c=Hl(s.resource.toString(),l.resource.toString());return c===0&&(o==="position"?c=z.compareRangesUsingStarts(s,l)||bl.compare(s.severity,l.severity):c=bl.compare(s.severity,l.severity)||z.compareRangesUsingStarts(s,l)),c},r=()=>{let s=this._markerService.read({resource:A.isUri(i)?i:void 0,severities:14});return typeof i=="function"&&(s=s.filter(l=>this._resourceFilter(l.resource))),s.sort(n),$i(s,this._markers,(l,c)=>l.resource.toString()===c.resource.toString()&&l.startLineNumber===c.startLineNumber&&l.startColumn===c.startColumn&&l.endLineNumber===c.endLineNumber&&l.endColumn===c.endColumn&&l.severity===c.severity&&l.message===c.message)?!1:(this._markers=s,!0)};r(),this._dispoables.add(e.onMarkerChanged(s=>{(!this._resourceFilter||s.some(l=>this._resourceFilter(l)))&&r()&&(this._nextIdx=-1,this._onDidChange.fire())}))}dispose(){this._dispoables.dispose(),this._onDidChange.dispose()}matches(i){return!this._resourceFilter&&!i?!0:!this._resourceFilter||!i?!1:this._resourceFilter(i)}get selected(){let i=this._markers[this._nextIdx];return i&&new Lxt(i,this._nextIdx+1,this._markers.length)}_initIdx(i,e,t){let o=this._markers.findIndex(n=>Qe(n.resource,i.uri));if(o<0)o=aP(this._markers.length,n=>Hl(this._markers[n].resource.toString(),i.uri.toString())),o<0&&(o=~o),t?this._nextIdx=o:this._nextIdx=(this._markers.length+o-1)%this._markers.length;else{let n=!1,r=!1;for(let s=o;s<this._markers.length;s++){let l=z.lift(this._markers[s]);if(l.isEmpty()){let c=i.getWordAtPosition(l.getStartPosition());c&&(l=new z(l.startLineNumber,c.startColumn,l.startLineNumber,c.endColumn))}if(e&&(l.containsPosition(e)||e.isBeforeOrEqual(l.getStartPosition()))){this._nextIdx=s,n=!0,r=!l.containsPosition(e);break}if(this._markers[s].resource.toString()!==i.uri.toString())break}n?r&&!t&&(this._nextIdx-=1):this._nextIdx=t?0:this._markers.length-1}this._nextIdx<0&&(this._nextIdx=this._markers.length-1)}resetIndex(){this._nextIdx=-1}move(i,e,t){if(this._markers.length===0)return!1;let o=this._nextIdx;return this._nextIdx===-1?this._initIdx(e,t,i):i?this._nextIdx=(this._nextIdx+1)%this._markers.length:i||(this._nextIdx=(this._nextIdx-1+this._markers.length)%this._markers.length),o!==this._nextIdx}find(i,e){let t=this._markers.findIndex(o=>o.resource.toString()===i.toString());if(!(t<0)){for(;t<this._markers.length;t++)if(z.containsPosition(this._markers[t],e))return new Lxt(this._markers[t],t+1,this._markers.length)}}};Oce=I([m(1,oa),m(2,B)],Oce);var K3e=le("IMarkerNavigationService"),z3e=class{constructor(i,e){this._markerService=i;this._configService=e;this._provider=new qs}registerProvider(i){let e=this._provider.unshift(i);return Z(()=>e())}getMarkerList(i){for(let e of this._provider){let t=e.getMarkerList(i);if(t)return t}return new Oce(i,this._markerService,this._configService)}};z3e=I([m(0,oa),m(1,B)],z3e);Ee(K3e,z3e,1);var sk;(i=>{function a(e){switch(e){case bt.Ignore:return"severity-ignore "+q.asClassName(R.info);case bt.Info:return q.asClassName(R.info);case bt.Warning:return q.asClassName(R.warning);case bt.Error:return q.asClassName(R.error);default:return""}}i.className=a})(sk||={});var Dli=class{constructor(i,e,t,o,n){this._openerService=o;this._labelService=n;this._lines=0;this._longestLineLength=0;this._relatedDiagnostics=new WeakMap;this._disposables=new N;this._editor=e;let r=document.createElement("div");r.className="descriptioncontainer",this._messageBlock=document.createElement("div"),this._messageBlock.classList.add("message"),this._messageBlock.setAttribute("aria-live","assertive"),this._messageBlock.setAttribute("role","alert"),r.appendChild(this._messageBlock),this._relatedBlock=document.createElement("div"),r.appendChild(this._relatedBlock),this._disposables.add(Jo(this._relatedBlock,"click",s=>{s.preventDefault();let l=this._relatedDiagnostics.get(s.target);l&&t(l)})),this._scrollable=new O7(r,{horizontal:1,vertical:1,useShadows:!1,horizontalScrollbarSize:6,verticalScrollbarSize:6}),i.appendChild(this._scrollable.getDomNode()),this._disposables.add(this._scrollable.onScroll(s=>{r.style.left=`-${s.scrollLeft}px`,r.style.top=`-${s.scrollTop}px`})),this._disposables.add(this._scrollable)}dispose(){Be(this._disposables)}update(i){let{source:e,message:t,relatedInformation:o,code:n}=i,r=(e?.length||0)+2;n&&(typeof n=="string"?r+=n.length:r+=n.value.length);let s=yc(t);this._lines=s.length,this._longestLineLength=0;for(let h of s)this._longestLineLength=Math.max(h.length+r,this._longestLineLength);Rt(this._messageBlock),this._messageBlock.setAttribute("aria-label",this.getAriaLabel(i)),this._editor.applyFontInfo(this._messageBlock);let l=this._messageBlock;for(let h of s)l=document.createElement("div"),l.innerText=h,h===""&&(l.style.height=this._messageBlock.style.lineHeight),this._messageBlock.appendChild(l);if(e||n){let h=document.createElement("span");if(h.classList.add("details"),l.appendChild(h),e){let g=document.createElement("span");g.innerText=e,g.classList.add("source"),h.appendChild(g)}if(n)if(typeof n=="string"){let g=document.createElement("span");g.innerText=`(${n})`,g.classList.add("code"),h.appendChild(g)}else{this._codeLink=_("a.code-link"),this._codeLink.setAttribute("href",`${n.target.toString()}`),this._codeLink.onclick=f=>{this._openerService.open(n.target,{allowCommands:!0}),f.preventDefault(),f.stopPropagation()};let g=M(this._codeLink,_("span"));g.innerText=n.value,h.appendChild(this._codeLink)}}if(Rt(this._relatedBlock),this._editor.applyFontInfo(this._relatedBlock),yr(o)){let h=this._relatedBlock.appendChild(document.createElement("div"));h.style.paddingTop=`${Math.floor(this._editor.getOption(75)*.66)}px`,this._lines+=1;for(let g of o){let f=document.createElement("div"),v=document.createElement("a");v.classList.add("filename"),v.innerText=`${this._labelService.getUriBasenameLabel(g.resource)}(${g.startLineNumber}, ${g.startColumn}): `,v.title=this._labelService.getUriLabel(g.resource),this._relatedDiagnostics.set(v,g);let b=document.createElement("span");b.innerText=g.message,f.appendChild(v),f.appendChild(b),this._lines+=1,h.appendChild(f)}}let c=this._editor.getOption(59),u=Math.ceil(c.typicalFullwidthCharacterWidth*this._longestLineLength*.75),p=c.lineHeight*this._lines;this._scrollable.setScrollDimensions({scrollWidth:u,scrollHeight:p})}layout(i,e){this._scrollable.getDomNode().style.height=`${i}px`,this._scrollable.getDomNode().style.width=`${e}px`,this._scrollable.setScrollDimensions({width:e,height:i})}getHeightInLines(){return Math.min(17,this._lines)}getAriaLabel(i){let e="";switch(i.severity){case 8:e=d(1194,null);break;case 4:e=d(1199,null);break;case 2:e=d(1196,null);break;case 1:e=d(1195,null);break}let t=d(1197,null,e,i.startLineNumber+":"+i.startColumn),o=this._editor.getModel();return o&&i.startLineNumber<=o.getLineCount()&&i.startLineNumber>=1&&(t=`${o.getLineContent(i.startLineNumber)}, ${t}`),t}},tK=class extends GE{constructor(e,t,o,n,r,s,l){super(e,{showArrow:!0,showFrame:!0,isAccessible:!0,frameWidth:1},r);this._themeService=t;this._openerService=o;this._menuService=n;this._contextKeyService=s;this._labelService=l;this._callOnDispose=new N;this._onDidSelectRelatedInformation=new E;this.onDidSelectRelatedInformation=this._onDidSelectRelatedInformation.event;this._severity=4,this._backgroundColor=We.white,this._applyTheme(t.getColorTheme()),this._callOnDispose.add(t.onDidColorThemeChange(this._applyTheme.bind(this))),this.create()}static{this.TitleMenu=new D("gotoErrorTitleMenu")}_applyTheme(e){this._backgroundColor=e.getColor(Jzo);let t=Lli,o=Qzo;this._severity===4?(t=Rxt,o=Yzo):this._severity===2&&(t=Rli,o=Xzo);let n=e.getColor(t),r=e.getColor(o);this.style({arrowColor:n,frameColor:n,headerBackgroundColor:r,primaryHeadingColor:e.getColor(eF),secondaryHeadingColor:e.getColor(tF)})}_applyStyles(){this._parentContainer&&(this._parentContainer.style.backgroundColor=this._backgroundColor?this._backgroundColor.toString():""),super._applyStyles()}dispose(){this._callOnDispose.dispose(),this._onDidSelectRelatedInformation.dispose(),super.dispose()}focus(){this._parentContainer.focus()}_fillHead(e){super._fillHead(e),this._disposables.add(this._actionbarWidget.actionRunner.onWillRun(n=>this.editor.focus()));let t=this._menuService.getMenuActions(tK.TitleMenu,this._contextKeyService),o=jm(t);this._actionbarWidget.push(o,{label:!1,icon:!0,index:0})}_fillTitleIcon(e){this._icon=M(e,_(""))}_fillBody(e){this._parentContainer=e,e.classList.add("marker-widget"),this._parentContainer.tabIndex=0,this._parentContainer.setAttribute("role","tooltip"),this._container=document.createElement("div"),e.appendChild(this._container),this._message=new Dli(this._container,this.editor,t=>this._onDidSelectRelatedInformation.fire(t),this._openerService,this._labelService),this._disposables.add(this._message)}show(){throw new Error("call showAtMarker")}showAtMarker(e,t,o){this._container.classList.remove("stale"),this._message.update(e),this._severity=e.severity,this._applyTheme(this._themeService.getColorTheme());let n=z.lift(e),r=this.editor.getPosition(),s=r&&n.containsPosition(r)?r:n.getStartPosition();super.show(s,this.computeRequiredHeight());let l=this.editor.getModel();if(l){let c=o>1?d(1198,null,t,o):d(1186,null,t,o);this.setTitle(He(l.uri),c)}this._icon.className=`codicon ${sk.className(bl.toSeverity(this._severity))}`,this.editor.revealPositionInCenterIfOutsideViewport(s,0),this.editor.focus()}updateMarker(e){this._container.classList.remove("stale"),this._message.update(e)}showStale(){this._container.classList.add("stale"),this._relayout()}_doLayoutBody(e,t){super._doLayoutBody(e,t),this._heightInPixel=e,this._message.layout(e,t),this._container.style.height=`${e}px`}_onWidth(e){this._message.layout(this._heightInPixel,e)}_relayout(){super._relayout(this.computeRequiredHeight())}computeRequiredHeight(){return 3+this._message.getHeightInLines()}};tK=I([m(1,Le),m(2,Je),m(3,Kt),m(4,F),m(5,X),m(6,rt)],tK);var A7i=ole(Iv,I5i),N7i=ole(jh,E7),O7i=ole(Dm,T7),Lli=te("editorMarkerNavigationError.background",{dark:A7i,light:A7i,hcDark:bi,hcLight:bi},d(1188,null)),Qzo=te("editorMarkerNavigationError.headerBackground",{dark:ai(Lli,.1),light:ai(Lli,.1),hcDark:null,hcLight:null},d(1189,null)),Rxt=te("editorMarkerNavigationWarning.background",{dark:N7i,light:N7i,hcDark:bi,hcLight:bi},d(1192,null)),Yzo=te("editorMarkerNavigationWarning.headerBackground",{dark:ai(Rxt,.1),light:ai(Rxt,.1),hcDark:"#0C141F",hcLight:ai(Rxt,.2)},d(1193,null)),Rli=te("editorMarkerNavigationInfo.background",{dark:O7i,light:O7i,hcDark:bi,hcLight:bi},d(1190,null)),Xzo=te("editorMarkerNavigationInfo.headerBackground",{dark:ai(Rli,.1),light:ai(Rli,.1),hcDark:null,hcLight:null},d(1191,null)),Jzo=te("editorMarkerNavigation.background",Ho,d(1187,null));var xw=class{constructor(i,e,t,o,n){this._markerNavigationService=e;this._contextKeyService=t;this._editorService=o;this._instantiationService=n;this._sessionDispoables=new N;this._editor=i,this._widgetVisible=F7i.bindTo(this._contextKeyService)}static{this.ID="editor.contrib.markerController"}static get(i){return i.getContribution(xw.ID)}dispose(){this._cleanUp(),this._sessionDispoables.dispose()}_cleanUp(){this._widgetVisible.reset(),this._sessionDispoables.clear(),this._widget=void 0,this._model=void 0}_getOrCreateModel(i){if(this._model&&this._model.matches(i))return this._model;let e=!1;return this._model&&(e=!0,this._cleanUp()),this._model=this._markerNavigationService.getMarkerList(i),e&&this._model.move(!0,this._editor.getModel(),this._editor.getPosition()),this._widget=this._instantiationService.createInstance(tK,this._editor),this._widget.onDidClose(()=>this.close(),this,this._sessionDispoables),this._widgetVisible.set(!0),this._sessionDispoables.add(this._model),this._sessionDispoables.add(this._widget),this._sessionDispoables.add(this._editor.onDidChangeCursorPosition(t=>{(!this._model?.selected||!z.containsPosition(this._model?.selected.marker,t.position))&&this._model?.resetIndex()})),this._sessionDispoables.add(this._model.onDidChange(()=>{if(!this._widget||!this._widget.position||!this._model)return;let t=this._model.find(this._editor.getModel().uri,this._widget.position);t?this._widget.updateMarker(t.marker):this._widget.showStale()})),this._sessionDispoables.add(this._widget.onDidSelectRelatedInformation(t=>{this._editorService.openCodeEditor({resource:t.resource,options:{pinned:!0,revealIfOpened:!0,selection:z.lift(t).collapseToStart()}},this._editor),this.close(!1)})),this._sessionDispoables.add(this._editor.onDidChangeModel(()=>this._cleanUp())),this._model}close(i=!0){this._cleanUp(),i&&this._editor.focus()}showAtMarker(i){if(!this._editor.hasModel())return;let e=this._editor.getModel(),t=this._getOrCreateModel(e.uri);t.resetIndex(),t.move(!0,e,new ye(i.startLineNumber,i.startColumn)),t.selected&&this._widget.showAtMarker(t.selected.marker,t.selected.index,t.selected.total)}async navigate(i,e){if(!this._editor.hasModel())return;let t=this._editor.getModel(),o=this._getOrCreateModel(e?void 0:t.uri);if(o.move(i,t,this._editor.getPosition()),!!o.selected)if(o.selected.marker.resource.toString()!==t.uri.toString()){this._cleanUp();let n=await this._editorService.openCodeEditor({resource:o.selected.marker.resource,options:{pinned:!1,revealIfOpened:!0,selectionRevealType:2,selection:o.selected.marker}},this._editor);n&&(xw.get(n)?.close(),xw.get(n)?.navigate(i,e))}else this._widget.showAtMarker(o.selected.marker,o.selected.index,o.selected.total)}};xw=I([m(1,K3e),m(2,X),m(3,qt),m(4,F)],xw);var Kxe=class extends Di{constructor(e,t,o){super(o);this._next=e;this._multiFile=t}async run(e,t){t.hasModel()&&await xw.get(t)?.navigate(this._next,this._multiFile)}},Fce=class a extends Kxe{static{this.ID="editor.action.marker.next"}static{this.LABEL=L(1178,"Go to Next Problem (Error, Warning, Info)")}constructor(){super(!0,!1,{id:a.ID,label:a.LABEL,precondition:void 0,kbOpts:{kbExpr:pe.focus,primary:578,weight:100},menuOpts:{menuId:tK.TitleMenu,title:a.LABEL.value,icon:Ae("marker-navigation-next",R.arrowDown,d(1184,null)),group:"navigation",order:1}})}},G3e=class a extends Kxe{static{this.ID="editor.action.marker.prev"}static{this.LABEL=L(1180,"Go to Previous Problem (Error, Warning, Info)")}constructor(){super(!1,!1,{id:a.ID,label:a.LABEL,precondition:void 0,kbOpts:{kbExpr:pe.focus,primary:1602,weight:100},menuOpts:{menuId:tK.TitleMenu,title:a.LABEL.value,icon:Ae("marker-navigation-previous",R.arrowUp,d(1185,null)),group:"navigation",order:2}})}},q3e=class a extends Kxe{static{this.ID="editor.action.marker.nextInFiles"}constructor(){super(!0,!0,{id:a.ID,label:L(1179,"Go to Next Problem in Files (Error, Warning, Info)"),precondition:void 0,kbOpts:{kbExpr:pe.focus,primary:66,weight:100},menuOpts:{menuId:D.MenubarGoMenu,title:d(1182,null),group:"6_problem_nav",order:1}})}},$3e=class a extends Kxe{static{this.ID="editor.action.marker.prevInFiles"}constructor(){super(!1,!0,{id:a.ID,label:L(1181,"Go to Previous Problem in Files (Error, Warning, Info)"),precondition:void 0,kbOpts:{kbExpr:pe.focus,primary:1090,weight:100},menuOpts:{menuId:D.MenubarGoMenu,title:d(1183,null),group:"6_problem_nav",order:2}})}};xo(xw.ID,xw,4);ni(Fce);ni(G3e);ni(q3e);ni($3e);var F7i=new Y("markersNavigationVisible",!1),Zzo=Oc.bindToContribution(xw.get);Xi(new Zzo({id:"closeMarkersNavigation",precondition:F7i,handler:a=>a.close(),kbOpts:{weight:150,kbExpr:pe.focus,primary:9,secondary:[1033]}}));var lF=_,j3e=class{constructor(i,e,t){this.owner=i;this.range=e;this.marker=t}isValidForHoverAnchor(i){return i.type===1&&this.range.startColumn<=i.range.startColumn&&this.range.endColumn>=i.range.endColumn}},W7i={type:1,filter:{include:xr.QuickFix},triggerAction:"quick fix hover window"},Gxe=class{constructor(i,e,t,o,n,r){this._editor=i;this._markerDecorationsService=e;this._openerService=t;this._languageFeaturesService=o;this._menuService=n;this._contextKeyService=r;this.hoverOrdinal=1;this.recentMarkerCodeActionsInfo=void 0}computeSync(i,e){if(!this._editor.hasModel()||i.type!==1&&!i.supportsMarkerHover)return[];let t=this._editor.getModel(),o=i.range;if(!t.isValidRange(i.range))return[];let n=o.startLineNumber,r=t.getLineMaxColumn(n),s=[];for(let l of e){let c=l.range.startLineNumber===n?l.range.startColumn:1,u=l.range.endLineNumber===n?l.range.endColumn:r,p=this._markerDecorationsService.getMarker(t.uri,l);if(!p)continue;let h=new z(i.range.startLineNumber,c,i.range.startLineNumber,u);s.push(new j3e(this,h,p))}return s}renderHoverParts(i,e){if(!e.length)return new ok([]);let t=[];e.forEach(r=>{let s=this._renderMarkerHover(r);i.fragment.appendChild(s.hoverElement),t.push(s)});let o=e.length===1?e[0]:e.sort((r,s)=>bl.compare(r.marker.severity,s.marker.severity))[0],n=this._renderMarkerStatusbar(i,o);return new ok(t,n)}getAccessibleContent(i){return i.marker.message}_renderMarkerHover(i){let e=new N,t=lF("div.hover-row"),o=M(t,lF("div.marker.hover-contents")),{source:n,message:r,code:s,relatedInformation:l}=i.marker;this._editor.applyFontInfo(o);let c=M(o,lF("span"));if(c.style.whiteSpace="pre-wrap",c.innerText=r,n||s)if(s&&typeof s!="string"){let p=lF("span");if(n){let v=M(p,lF("span"));v.innerText=n}let h=M(p,lF("a.code-link"));h.setAttribute("href",s.target.toString(!0)),e.add(j(h,"click",v=>{this._openerService.open(s.target,{allowCommands:!0}),v.preventDefault(),v.stopPropagation()}));let g=M(h,lF("span"));g.innerText=s.value;let f=M(o,p);f.style.opacity="0.6",f.style.paddingLeft="6px"}else{let p=M(o,lF("span"));p.style.opacity="0.6",p.style.paddingLeft="6px",p.innerText=n&&s?`${n}(${s})`:n||`(${s})`}if(yr(l))for(let{message:p,resource:h,startLineNumber:g,startColumn:f}of l){let v=M(o,lF("div"));v.style.marginTop="8px";let b=M(v,lF("a"));b.innerText=`${He(h)}(${g}, ${f}): `,b.style.cursor="pointer",e.add(j(b,"click",y=>{if(y.stopPropagation(),y.preventDefault(),this._openerService){let w={selection:{startLineNumber:g,startColumn:f}};this._openerService.open(h,{fromUserGesture:!0,editorOptions:w}).catch(mt)}}));let S=M(v,lF("span"));S.innerText=p,this._editor.applyFontInfo(S)}return{hoverPart:i,hoverElement:t,dispose:()=>e.dispose()}}_renderMarkerStatusbar(i,e){let t=new N;if(e.marker.severity===8||e.marker.severity===4||e.marker.severity===2){let r=xw.get(this._editor);r&&i.statusBar.addAction({label:d(1303,null),commandId:Fce.ID,run:()=>{i.hide(),r.showAtMarker(e.marker),this._editor.focus()}})}let o=[];for(let[,r]of this._menuService.getMenuActions(D.MarkerHoverStatusBar,this._contextKeyService))for(let s of r)s instanceof Lo&&s.enabled&&o.push(s);let n=()=>{for(let r of o)i.statusBar.addAction({label:r.label,commandId:r.id,iconClass:r.class,run:()=>{i.hide(),this._editor.setSelection(z.lift(e.range)),r.run()}})};if(this._editor.getOption(104))n();else{let r=i.statusBar.append(lF("div"));this.recentMarkerCodeActionsInfo&&(jV.makeKey(this.recentMarkerCodeActionsInfo.marker)===jV.makeKey(e.marker)?this.recentMarkerCodeActionsInfo.hasCodeActions||o.length===0&&(r.textContent=d(1301,null)):this.recentMarkerCodeActionsInfo=void 0);let s=this.recentMarkerCodeActionsInfo&&!this.recentMarkerCodeActionsInfo.hasCodeActions?x.None:tn(()=>r.textContent=d(1300,null),200,t);r.textContent||(r.textContent="\xA0");let l=this.getCodeActions(e.marker);t.add(Z(()=>l.cancel())),l.then(c=>{if(s.dispose(),this.recentMarkerCodeActionsInfo={marker:e.marker,hasCodeActions:c.validActions.length>0},!this.recentMarkerCodeActionsInfo.hasCodeActions){c.dispose(),o.length===0?r.textContent=d(1301,null):r.style.display="none",n();return}r.style.display="none";let u=!1;t.add(Z(()=>{u||c.dispose()})),i.statusBar.addAction({label:d(1302,null),commandId:Pz,run:h=>{u=!0;let g=Cp.get(this._editor),f=ir(h);i.hide(),g?.showCodeActions(W7i,c,{x:f.left,y:f.top,width:f.width,height:f.height})}});let p=c.validActions.find(h=>h.action.isAI);p&&i.statusBar.addAction({label:p.action.title,commandId:p.action.command?.id??"",iconClass:q.asClassName(R.sparkle),run:()=>{Cp.get(this._editor)?.applyCodeAction(p,!1,!1,"fromProblemsHover")}}),n(),i.onContentsChanged()},mt)}return t}getCodeActions(i){return Ln(e=>hR(this._languageFeaturesService.codeActionProvider,this._editor.getModel(),new z(i.startLineNumber,i.startColumn,i.endLineNumber,i.endColumn),W7i,Mm.None,e))}};Gxe=I([m(1,H1),m(2,Je),m(3,Qt),m(4,Kt),m(5,X)],Gxe);var jY=class extends x{constructor(i,e,t,o,n,r,s){super();let l=e.hoverParts;this._renderedHoverParts=this._register(new Wce(i,t,l,o,n,r,s));let c=e.options,u=c.anchor,{showAtPosition:p,showAtSecondaryPosition:h}=jY.computeHoverPositions(i,u.range,l);this.shouldAppearBeforeContent=l.some(g=>g.isBeforeContent),this.showAtPosition=p,this.showAtSecondaryPosition=h,this.initialMousePosX=u.initialMousePosX,this.initialMousePosY=u.initialMousePosY,this.shouldFocus=c.shouldFocus,this.source=c.source}get domNode(){return this._renderedHoverParts.domNode}get domNodeHasChildren(){return this._renderedHoverParts.domNodeHasChildren}get focusedHoverPartIndex(){return this._renderedHoverParts.focusedHoverPartIndex}get hoverPartsCount(){return this._renderedHoverParts.hoverPartsCount}focusHoverPartWithIndex(i){this._renderedHoverParts.focusHoverPartWithIndex(i)}getAccessibleWidgetContent(){return this._renderedHoverParts.getAccessibleContent()}getAccessibleWidgetContentAtIndex(i){return this._renderedHoverParts.getAccessibleHoverContentAtIndex(i)}async updateHoverVerbosityLevel(i,e,t){this._renderedHoverParts.updateHoverVerbosityLevel(i,e,t)}doesHoverAtIndexSupportVerbosityAction(i,e){return this._renderedHoverParts.doesHoverAtIndexSupportVerbosityAction(i,e)}isColorPickerVisible(){return this._renderedHoverParts.isColorPickerVisible()}static computeHoverPositions(i,e,t){let o=1;if(i.hasModel()){let u=i._getViewModel(),p=u.coordinatesConverter,h=p.convertModelRangeToViewRange(e),g=u.getLineMinColumn(h.startLineNumber),f=new ye(h.startLineNumber,g);o=p.convertViewPositionToModelPosition(f).column}let n=e.startLineNumber,r=e.startColumn,s;for(let u of t){let p=u.range,h=p.startLineNumber===n,g=p.endLineNumber===n;if(h&&g){let v=p.startColumn,b=Math.min(r,v);r=Math.max(b,o)}u.forceShowAtRange&&(s=p)}let l,c;if(s){let u=s.getStartPosition();l=u,c=u}else l=e.getStartPosition(),c=new ye(n,r);return{showAtPosition:l,showAtSecondaryPosition:c}}};jY=I([m(4,_e),m(5,nt),m(6,Fi)],jY);var Mli=class{constructor(i,e){this._statusBar=e;i.appendChild(this._statusBar.hoverElement)}get hoverElement(){return this._statusBar.hoverElement}get actions(){return this._statusBar.actions}dispose(){this._statusBar.dispose()}},Wce=class extends x{constructor(e,t,o,n,r,s,l){super();this._hoverService=s;this._clipboardService=l;this._renderedParts=[];this._focusedHoverPartIndex=-1;this._context=n,this._fragment=document.createDocumentFragment(),this._register(this._renderParts(t,o,n,r,this._hoverService)),this._register(this._registerListenersOnRenderedParts()),this._register(this._createEditorDecorations(e,o)),this._updateMarkdownAndColorParticipantInfo(t)}static{this._DECORATION_OPTIONS=mo.register({description:"content-hover-highlight",className:"hoverHighlight"})}_createEditorDecorations(e,t){if(t.length===0)return x.None;let o=t[0].range;for(let r of t){let s=r.range;o=z.plusRange(o,s)}let n=e.createDecorationsCollection();return n.set([{range:o,options:Wce._DECORATION_OPTIONS}]),Z(()=>{n.clear()})}_renderParts(e,t,o,n,r){let s=new OY(n,r),l={fragment:this._fragment,statusBar:s,...o},c=new N;c.add(s);for(let p of e){let h=this._renderHoverPartsForParticipant(t,p,l);c.add(h);for(let g of h.renderedHoverParts)this._renderedParts.push({type:"hoverPart",participant:p,hoverPart:g.hoverPart,hoverElement:g.hoverElement})}let u=this._renderStatusBar(this._fragment,s);return u&&(c.add(u),this._renderedParts.push({type:"statusBar",hoverElement:u.hoverElement,actions:u.actions})),c}_renderHoverPartsForParticipant(e,t,o){let n=e.filter(s=>s.owner===t);return n.length>0?t.renderHoverParts(o,n):new ok([])}_renderStatusBar(e,t){if(t.hasContent)return new Mli(e,t)}_registerListenersOnRenderedParts(){let e=new N;return this._renderedParts.forEach((t,o)=>{let n=t.hoverElement;n.tabIndex=0,e.add(j(n,re.FOCUS_IN,r=>{r.stopPropagation(),this._focusedHoverPartIndex=o})),e.add(j(n,re.FOCUS_OUT,r=>{r.stopPropagation(),this._focusedHoverPartIndex=-1})),t.type==="hoverPart"&&t.hoverPart instanceof j3e&&e.add(new Txe(n,()=>t.participant.getAccessibleContent(t.hoverPart),this._clipboardService,this._hoverService))}),e}_updateMarkdownAndColorParticipantInfo(e){let t=e.find(o=>o instanceof Gz&&!(o instanceof $Y));t&&(this._markdownHoverParticipant=t),this._colorHoverParticipant=e.find(o=>o instanceof UY)}focusHoverPartWithIndex(e){e<0||e>=this._renderedParts.length||this._renderedParts[e].hoverElement.focus()}getAccessibleContent(){let e=[];for(let t=0;t<this._renderedParts.length;t++)e.push(this.getAccessibleHoverContentAtIndex(t));return e.join(`

`)}getAccessibleHoverContentAtIndex(e){let t=this._renderedParts[e];if(!t)return"";if(t.type==="statusBar"){let o=[d(1260,null)];for(let n of t.actions){let r=n.actionKeybindingLabel;r?o.push(d(1261,null,n.actionLabel,r)):o.push(d(1262,null,n.actionLabel))}return o.join(`
`)}return t.participant.getAccessibleContent(t.hoverPart)}async updateHoverVerbosityLevel(e,t,o){if(!this._markdownHoverParticipant)return;let n;t>=0?n={start:t,endExclusive:t+1}:n=this._findRangeOfMarkdownHoverParts(this._markdownHoverParticipant);for(let r=n.start;r<n.endExclusive;r++){let s=this._normalizedIndexToMarkdownHoverIndexRange(this._markdownHoverParticipant,r);if(s===void 0)continue;let l=await this._markdownHoverParticipant.updateMarkdownHoverVerbosityLevel(e,s);l&&(this._renderedParts[r]={type:"hoverPart",participant:this._markdownHoverParticipant,hoverPart:l.hoverPart,hoverElement:l.hoverElement})}o&&(t>=0?this.focusHoverPartWithIndex(t):this._context.focus()),this._context.onContentsChanged()}doesHoverAtIndexSupportVerbosityAction(e,t){if(!this._markdownHoverParticipant)return!1;let o=this._normalizedIndexToMarkdownHoverIndexRange(this._markdownHoverParticipant,e);return o===void 0?!1:this._markdownHoverParticipant.doesMarkdownHoverAtIndexSupportVerbosityAction(o,t)}isColorPickerVisible(){return this._colorHoverParticipant?.isColorPickerVisible()??!1}_normalizedIndexToMarkdownHoverIndexRange(e,t){let o=this._renderedParts[t];if(!o||o.type!=="hoverPart"||!(o.participant===e))return;let r=this._renderedParts.findIndex(s=>s.type==="hoverPart"&&s.participant===e);if(r===-1)throw new li;return t-r}_findRangeOfMarkdownHoverParts(e){let t=this._renderedParts.slice(),o=t.findIndex(s=>s.type==="hoverPart"&&s.participant===e),n=t.reverse().findIndex(s=>s.type==="hoverPart"&&s.participant===e),r=n>=0?t.length-n:n;return{start:o,endExclusive:r+1}}get domNode(){return this._fragment}get domNodeHasChildren(){return this._fragment.hasChildNodes()}get focusedHoverPartIndex(){return this._focusedHoverPartIndex}get hoverPartsCount(){return this._renderedParts.length}};Wce=I([m(4,_e),m(5,nt),m(6,Fi)],Wce);var qxe=class extends x{constructor(e,t,o,n,r){super();this._editor=e;this._instantiationService=t;this._keybindingService=o;this._hoverService=n;this._clipboardService=r;this._currentResult=null;this._renderedContentHover=this._register(new me);this._onContentsChanged=this._register(new E);this.onContentsChanged=this._onContentsChanged.event;this._contentHoverWidget=this._register(this._instantiationService.createInstance(nk,this._editor)),this._participants=this._initializeHoverParticipants(),this._hoverOperation=this._register(new bxe(this._editor,new gCt(this._editor,this._participants))),this._registerListeners()}_initializeHoverParticipants(){let e=[];for(let t of z_.getAll()){let o=this._instantiationService.createInstance(t,this._editor);e.push(o)}return e.sort((t,o)=>t.hoverOrdinal-o.hoverOrdinal),this._register(this._contentHoverWidget.onDidResize(()=>{this._participants.forEach(t=>t.handleResize?.())})),this._register(this._contentHoverWidget.onDidScroll(t=>{this._participants.forEach(o=>o.handleScroll?.(t))})),this._register(this._contentHoverWidget.onContentsChanged(()=>{this._participants.forEach(t=>t.handleContentsChanged?.())})),e}_registerListeners(){this._register(this._hoverOperation.onResult(t=>{let o=t.hasLoadingMessage?this._addLoadingMessage(t):t.value;this._withResult(new d3e(o,t.isComplete,t.options))}));let e=this._contentHoverWidget.getDomNode();this._register(Jo(e,"keydown",t=>{t.equals(9)&&this.hide()})),this._register(Jo(e,"mouseleave",t=>{this._onMouseLeave(t)})),this._register(ic.onDidChange(()=>{this._contentHoverWidget.position&&this._currentResult&&this._setCurrentResult(this._currentResult)})),this._register(this._contentHoverWidget.onContentsChanged(()=>{this._onContentsChanged.fire()}))}_startShowingOrUpdateHover(e,t,o,n,r){if(!(this._contentHoverWidget.position&&this._currentResult))return e?(this._startHoverOperationIfNecessary(e,t,o,n,!1),!0):!1;let l=this._editor.getOption(69).sticky,c=r&&this._contentHoverWidget.isMouseGettingCloser(r.event.posx,r.event.posy);return l&&c?(e&&this._startHoverOperationIfNecessary(e,t,o,n,!0),!0):e?this._currentResult&&this._currentResult.options.anchor.equals(e)?!0:this._currentResult&&e.canAdoptVisibleHover(this._currentResult.options.anchor,this._contentHoverWidget.position)?(this._currentResult&&this._setCurrentResult(this._currentResult.filter(e)),this._startHoverOperationIfNecessary(e,t,o,n,!1),!0):(this._setCurrentResult(null),this._startHoverOperationIfNecessary(e,t,o,n,!1),!0):(this._setCurrentResult(null),!1)}_startHoverOperationIfNecessary(e,t,o,n,r){if(this._hoverOperation.options&&this._hoverOperation.options.anchor.equals(e))return;this._hoverOperation.cancel();let l={anchor:e,source:o,shouldFocus:n,insistOnKeepingHoverVisible:r};this._hoverOperation.start(t,l)}_setCurrentResult(e){let t=e;if(this._currentResult===t)return;t&&t.hoverParts.length===0&&(t=null),this._currentResult=t,this._currentResult?this._showHover(this._currentResult):this._hideHover()}_addLoadingMessage(e){for(let t of this._participants){if(!t.createLoadingMessage)continue;let o=t.createLoadingMessage(e.options.anchor);if(o)return e.value.slice(0).concat([o])}return e.value}_withResult(e){if(this._contentHoverWidget.position&&this._currentResult&&this._currentResult.isComplete||this._setCurrentResult(e),!e.isComplete)return;let n=e.hoverParts.length===0,r=e.options.insistOnKeepingHoverVisible;n&&r||this._setCurrentResult(e)}_showHover(e){let t=this._getHoverContext();this._renderedContentHover.value=new jY(this._editor,e,this._participants,t,this._keybindingService,this._hoverService,this._clipboardService),this._renderedContentHover.value.domNodeHasChildren?this._contentHoverWidget.show(this._renderedContentHover.value):this._renderedContentHover.clear()}_hideHover(){this._contentHoverWidget.hide(),this._participants.forEach(e=>e.handleHide?.())}_getHoverContext(){return{hide:()=>{this.hide()},onContentsChanged:()=>{this._contentHoverWidget.handleContentsChanged()},setMinimumDimensions:r=>{this._contentHoverWidget.setMinimumDimensions(r)},focus:()=>this.focus()}}showsOrWillShow(e){if(this._contentHoverWidget.isResizing)return!0;let o=this._findHoverAnchorCandidates(e);if(!(o.length>0))return this._startShowingOrUpdateHover(null,0,0,!1,e);let r=o[0];return this._startShowingOrUpdateHover(r,0,0,!1,e)}_findHoverAnchorCandidates(e){let t=[];for(let n of this._participants){if(!n.suggestHoverAnchor)continue;let r=n.suggestHoverAnchor(e);r&&t.push(r)}let o=e.target;switch(o.type){case 6:{t.push(new hxe(0,o.range,e.event.posx,e.event.posy));break}case 7:{let n=this._editor.getOption(59).typicalHalfwidthCharacterWidth/2;if(!(!o.detail.isAfterLines&&typeof o.detail.horizontalDistanceToText=="number"&&o.detail.horizontalDistanceToText<n))break;t.push(new hxe(0,o.range,e.event.posx,e.event.posy));break}}return t.sort((n,r)=>r.priority-n.priority),t}_onMouseLeave(e){let t=this._editor.getDomNode();(!t||!NY(t,e.x,e.y))&&this.hide()}startShowingAtRange(e,t,o,n){this._startShowingOrUpdateHover(new hxe(0,e,void 0,void 0),t,o,n,null)}getWidgetContent(){let e=this._contentHoverWidget.getDomNode();if(e.textContent)return e.textContent}async updateHoverVerbosityLevel(e,t,o){this._renderedContentHover.value?.updateHoverVerbosityLevel(e,t,o)}doesHoverAtIndexSupportVerbosityAction(e,t){return this._renderedContentHover.value?.doesHoverAtIndexSupportVerbosityAction(e,t)??!1}getAccessibleWidgetContent(){return this._renderedContentHover.value?.getAccessibleWidgetContent()}getAccessibleWidgetContentAtIndex(e){return this._renderedContentHover.value?.getAccessibleWidgetContentAtIndex(e)}focusedHoverPartIndex(){return this._renderedContentHover.value?.focusedHoverPartIndex??-1}containsNode(e){return e?this._contentHoverWidget.getDomNode().contains(e):!1}focus(){if(this._renderedContentHover.value?.hoverPartsCount===1){this.focusHoverPartWithIndex(0);return}this._contentHoverWidget.focus()}focusHoverPartWithIndex(e){this._renderedContentHover.value?.focusHoverPartWithIndex(e)}scrollUp(){this._contentHoverWidget.scrollUp()}scrollDown(){this._contentHoverWidget.scrollDown()}scrollLeft(){this._contentHoverWidget.scrollLeft()}scrollRight(){this._contentHoverWidget.scrollRight()}pageUp(){this._contentHoverWidget.pageUp()}pageDown(){this._contentHoverWidget.pageDown()}goToTop(){this._contentHoverWidget.goToTop()}goToBottom(){this._contentHoverWidget.goToBottom()}hide(){this._hoverOperation.cancel(),this._setCurrentResult(null)}getDomNode(){return this._contentHoverWidget.getDomNode()}get isColorPickerVisible(){return this._renderedContentHover.value?.isColorPickerVisible()??!1}get isVisibleFromKeyboard(){return this._contentHoverWidget.isVisibleFromKeyboard}get isVisible(){return this._contentHoverWidget.isVisible}get isFocused(){return this._contentHoverWidget.isFocused}get isResizing(){return this._contentHoverWidget.isResizing}get widget(){return this._contentHoverWidget}};qxe=I([m(1,F),m(2,_e),m(3,nt),m(4,Fi)],qxe);function Pxt(a){let i=a.target;return!!i&&i.type===6&&i.detail.injectedText?.options.attachedData===Gsi}var Pli=!1,Pl=class extends x{constructor(e,t,o,n){super();this._editor=e;this._instantiationService=o;this._keybindingService=n;this._onHoverContentsChanged=this._register(new E);this.onHoverContentsChanged=this._onHoverContentsChanged.event;this.shouldKeepOpenOnEditorMouseMoveOrLeave=!1;this._listenersStore=new N;this._isMouseDown=!1;this._ignoreMouseEvents=!1;this._reactToEditorMouseMoveRunner=this._register(new Dt(()=>{this._mouseMoveEvent&&this._reactToEditorMouseMove(this._mouseMoveEvent)},0)),this._register(t.onDidShowContextMenu(()=>{this.hideContentHover(),this._ignoreMouseEvents=!0})),this._register(t.onDidHideContextMenu(()=>{this._ignoreMouseEvents=!1})),this._hookListeners(),this._register(this._editor.onDidChangeConfiguration(r=>{r.hasChanged(69)&&(this._unhookListeners(),this._hookListeners())}))}static{this.ID="editor.contrib.contentHover"}static get(e){return e.getContribution(Pl.ID)}_hookListeners(){let e=this._editor.getOption(69);this._hoverSettings={enabled:e.enabled,sticky:e.sticky,hidingDelay:e.hidingDelay},e.enabled==="off"&&this._cancelSchedulerAndHide(),this._listenersStore.add(this._editor.onMouseDown(t=>this._onEditorMouseDown(t))),this._listenersStore.add(this._editor.onMouseUp(()=>this._onEditorMouseUp())),this._listenersStore.add(this._editor.onMouseMove(t=>this._onEditorMouseMove(t))),this._listenersStore.add(this._editor.onKeyDown(t=>this._onKeyDown(t))),this._listenersStore.add(this._editor.onMouseLeave(t=>this._onEditorMouseLeave(t))),this._listenersStore.add(this._editor.onDidChangeModel(()=>this._cancelSchedulerAndHide())),this._listenersStore.add(this._editor.onDidChangeModelContent(()=>this._cancelScheduler())),this._listenersStore.add(this._editor.onDidScrollChange(t=>this._onEditorScrollChanged(t)))}_unhookListeners(){this._listenersStore.clear()}_cancelSchedulerAndHide(){this._cancelScheduler(),this.hideContentHover()}_cancelScheduler(){this._mouseMoveEvent=void 0,this._reactToEditorMouseMoveRunner.cancel()}_onEditorScrollChanged(e){this._ignoreMouseEvents||(e.scrollTopChanged||e.scrollLeftChanged)&&this.hideContentHover()}_onEditorMouseDown(e){this._ignoreMouseEvents||(this._isMouseDown=!0,this._shouldKeepHoverWidgetVisible(e))||this.hideContentHover()}_shouldKeepHoverWidgetVisible(e){return this._isMouseOnContentHoverWidget(e)||this._isContentWidgetResizing()||Pxt(e)}_isMouseOnContentHoverWidget(e){return this._contentWidget?NY(this._contentWidget.getDomNode(),e.event.posx,e.event.posy):!1}_onEditorMouseUp(){this._ignoreMouseEvents||(this._isMouseDown=!1)}_onEditorMouseLeave(e){this._ignoreMouseEvents||this.shouldKeepOpenOnEditorMouseMoveOrLeave||(this._cancelScheduler(),this._shouldKeepHoverWidgetVisible(e))||Pli||this.hideContentHover()}_shouldKeepCurrentHover(e){let t=this._contentWidget;if(!t)return!1;let o=this._hoverSettings.sticky,n=(p,h)=>{let g=this._isMouseOnContentHoverWidget(p);return h&&g},r=p=>{let h=t.isColorPickerVisible,g=this._isMouseOnContentHoverWidget(p),f=h&&g,v=h&&this._isMouseDown;return f||v},s=(p,h)=>{let g=p.event.browserEvent.view;return g?h&&t.containsNode(g.document.activeElement)&&!g.getSelection()?.isCollapsed:!1},l=t.isFocused,c=t.isResizing,u=this._hoverSettings.sticky&&t.isVisibleFromKeyboard;return this.shouldKeepOpenOnEditorMouseMoveOrLeave||l||c||u||n(e,o)||r(e)||s(e,o)}_onEditorMouseMove(e){if(this._ignoreMouseEvents)return;if(this._mouseMoveEvent=e,this._shouldKeepCurrentHover(e)){this._reactToEditorMouseMoveRunner.cancel();return}if(this._shouldRescheduleHoverComputation()){this._reactToEditorMouseMoveRunner.isScheduled()||this._reactToEditorMouseMoveRunner.schedule(this._hoverSettings.hidingDelay);return}this._reactToEditorMouseMove(e)}_shouldRescheduleHoverComputation(){let e=this._hoverSettings.hidingDelay;return(this._contentWidget?.isVisible??!1)&&this._hoverSettings.sticky&&e>0}_reactToEditorMouseMove(e){mCt(this._hoverSettings.enabled,this._editor.getOption(86),e)&&this._getOrCreateContentWidget().showsOrWillShow(e)||Pli||this.hideContentHover()}_onKeyDown(e){if(this._ignoreMouseEvents||!this._contentWidget)return;if(this._hoverSettings.enabled==="onKeyboardModifier"&&a3e(this._editor.getOption(86),e)&&this._mouseMoveEvent){this._contentWidget.isVisible||this._contentWidget.showsOrWillShow(this._mouseMoveEvent);return}let t=this._isPotentialKeyboardShortcut(e),o=XN(e.keyCode);t||o||this._contentWidget.isFocused&&e.keyCode===2||this.hideContentHover()}_isPotentialKeyboardShortcut(e){if(!this._editor.hasModel()||!this._contentWidget)return!1;let t=this._keybindingService.softDispatch(e,this._editor.getDomNode()),o=t.kind===1,n=t.kind===2&&(t.commandId===aCt||t.commandId===Nz||t.commandId===Oz)&&this._contentWidget.isVisible;return o||n}hideContentHover(){Pli||gR.dropDownVisible||this._contentWidget?.hide()}_getOrCreateContentWidget(){return this._contentWidget||(this._contentWidget=this._instantiationService.createInstance(qxe,this._editor),this._listenersStore.add(this._contentWidget.onContentsChanged(()=>this._onHoverContentsChanged.fire()))),this._contentWidget}showContentHover(e,t,o,n){this._getOrCreateContentWidget().startShowingAtRange(e,t,o,n)}_isContentWidgetResizing(){return this._contentWidget?.widget.isResizing||!1}focusedHoverPartIndex(){return this._getOrCreateContentWidget().focusedHoverPartIndex()}doesHoverAtIndexSupportVerbosityAction(e,t){return this._getOrCreateContentWidget().doesHoverAtIndexSupportVerbosityAction(e,t)}updateHoverVerbosityLevel(e,t,o){this._getOrCreateContentWidget().updateHoverVerbosityLevel(e,t,o)}focus(){this._contentWidget?.focus()}focusHoverPartWithIndex(e){this._contentWidget?.focusHoverPartWithIndex(e)}scrollUp(){this._contentWidget?.scrollUp()}scrollDown(){this._contentWidget?.scrollDown()}scrollLeft(){this._contentWidget?.scrollLeft()}scrollRight(){this._contentWidget?.scrollRight()}pageUp(){this._contentWidget?.pageUp()}pageDown(){this._contentWidget?.pageDown()}goToTop(){this._contentWidget?.goToTop()}goToBottom(){this._contentWidget?.goToBottom()}getWidgetContent(){return this._contentWidget?.getWidgetContent()}getAccessibleWidgetContent(){return this._contentWidget?.getAccessibleWidgetContent()}getAccessibleWidgetContentAtIndex(e){return this._contentWidget?.getAccessibleWidgetContentAtIndex(e)}get isColorPickerVisible(){return this._contentWidget?.isColorPickerVisible}get isHoverVisible(){return this._contentWidget?.isVisible}dispose(){super.dispose(),this._unhookListeners(),this._listenersStore.dispose(),this._contentWidget?.dispose()}};Pl=I([m(1,Xe),m(2,F),m(3,_e)],Pl);var Q3e=class extends x{constructor(e){super();this._editor=e;this._register(e.onMouseDown(t=>this.onMouseDown(t)))}static{this.ID="editor.contrib.colorContribution"}static{this.RECOMPUTE_TIME=1e3}dispose(){super.dispose()}onMouseDown(e){let t=this._editor.getOption(168);if(t!=="click"&&t!=="clickAndHover"||!Pxt(e))return;let o=this._editor.getContribution(Pl.ID);if(!o||o.isColorPickerVisible)return;let n=e.target.range;if(!n)return;let r=new z(n.startLineNumber,n.startColumn+1,n.endLineNumber,n.endColumn+1);o.showContentHover(r,1,1,!1)}};var Ali=class a{constructor(i,e,t,o){this.owner=i;this.range=e;this.model=t;this.provider=o}static fromBaseColor(i,e){return new a(i,e.range,e.model,e.provider)}},Nli=class extends x{constructor(i,e,t,o){super();let n=i.getModel(),r=t.model;this.color=t.model.color,this.colorPicker=this._register(new Dxe(e.fragment,r,i.getOption(163),o,"standalone")),this._register(r.onColorFlushed(l=>{this.color=l})),this._register(r.onDidChangeColor(l=>{kce(n,r,l,t.range,t)}));let s=!1;this._register(i.onDidChangeModelContent(l=>{s?s=!1:(e.hide(),i.focus())})),kce(n,r,this.color,t.range,t)}},$xe=class{constructor(i,e){this._editor=i;this._themeService=e;this.hoverOrdinal=2}async createColorHover(i,e,t){if(!this._editor.hasModel()||!Iw.get(this._editor))return null;let n=await rCt(t,this._editor.getModel(),Se.None),r=null,s=null;for(let h of n){let g=h.colorInfo;z.containsRange(g.range,i.range)&&(r=g,s=h.provider)}let l=r??i,c=s??e,u=!!r;return{colorHover:Ali.fromBaseColor(this,await RCt(this._editor.getModel(),l,c)),foundInEditor:u}}async updateEditorModel(i){if(!this._editor.hasModel())return;let e=i.model,t=new z(i.range.startLineNumber,i.range.startColumn,i.range.endLineNumber,i.range.endColumn);this._color&&(await kce(this._editor.getModel(),e,this._color,t,i),t=MCt(this._editor,t,e))}renderHoverParts(i,e){if(!(e.length===0||!this._editor.hasModel()))return this._setMinimumDimensions(i),this._renderedParts=new Nli(this._editor,i,e[0],this._themeService),this._renderedParts}_setMinimumDimensions(i){let e=this._editor.getOption(75)+8;i.setMinimumDimensions(new si(302,e))}get _color(){return this._renderedParts?.color}};$xe=I([m(1,Le)],$xe);var Oli=class{constructor(i,e){this.value=i;this.foundInEditor=e}},V7i=8,eKo=22,QY=class extends x{constructor(e,t,o,n,r,s,l,c){super();this._editor=e;this._standaloneColorPickerVisible=t;this._standaloneColorPickerFocused=o;this._keybindingService=r;this._languageFeaturesService=s;this._editorWorkerService=l;this._hoverService=c;this.allowEditorOverflow=!0;this._position=void 0;this._body=document.createElement("div");this._colorHover=null;this._selectionSetInEditor=!1;this._onResult=this._register(new E);this.onResult=this._onResult.event;this._renderedHoverParts=this._register(new me);this._renderedStatusBar=this._register(new me);this._standaloneColorPickerVisible.set(!0),this._standaloneColorPickerParticipant=n.createInstance($xe,this._editor),this._position=this._editor._getViewModel()?.getPrimaryCursorState().modelState.position;let u=this._editor.getSelection(),p=u?{startLineNumber:u.startLineNumber,startColumn:u.startColumn,endLineNumber:u.endLineNumber,endColumn:u.endColumn}:{startLineNumber:0,endLineNumber:0,endColumn:0,startColumn:0},h=this._register(qn(this._body));this._register(h.onDidBlur(g=>{this.hide()})),this._register(h.onDidFocus(g=>{this.focus()})),this._register(this._editor.onDidChangeCursorPosition(()=>{this._selectionSetInEditor?this._selectionSetInEditor=!1:this.hide()})),this._register(this._editor.onMouseMove(g=>{let f=g.target.element?.classList;f&&f.contains("colorpicker-color-decoration")&&this.hide()})),this._register(this.onResult(g=>{this._render(g.value,g.foundInEditor)})),this._start(p),this._body.style.zIndex="50",this._editor.addContentWidget(this)}static{this.ID="editor.contrib.standaloneColorPickerWidget"}updateEditor(){this._colorHover&&this._standaloneColorPickerParticipant.updateEditorModel(this._colorHover)}getId(){return QY.ID}getDomNode(){return this._body}getPosition(){if(!this._position)return null;let e=this._editor.getOption(69).above;return{position:this._position,secondaryPosition:this._position,preference:e?[1,2]:[2,1],positionAffinity:2}}hide(){this.dispose(),this._standaloneColorPickerVisible.set(!1),this._standaloneColorPickerFocused.set(!1),this._editor.removeContentWidget(this),this._editor.focus()}focus(){this._standaloneColorPickerFocused.set(!0),this._body.focus()}async _start(e){let t=await this._computeAsync(e);t&&this._onResult.fire(new Oli(t.result,t.foundInEditor))}async _computeAsync(e){if(!this._editor.hasModel())return null;let t={range:e,color:{red:0,green:0,blue:0,alpha:1}},o=await this._standaloneColorPickerParticipant.createColorHover(t,new s5(this._editorWorkerService),this._languageFeaturesService.colorProvider);return o?{result:o.colorHover,foundInEditor:o.foundInEditor}:null}_render(e,t){let o=document.createDocumentFragment();this._renderedStatusBar.value=this._register(new OY(this._keybindingService,this._hoverService));let n={fragment:o,statusBar:this._renderedStatusBar.value,onContentsChanged:()=>{},setMinimumDimensions:()=>{},hide:()=>this.hide(),focus:()=>this.focus()};if(this._colorHover=e,this._renderedHoverParts.value=this._standaloneColorPickerParticipant.renderHoverParts(n,[e]),!this._renderedHoverParts.value){this._renderedStatusBar.clear(),this._renderedHoverParts.clear();return}let r=this._renderedHoverParts.value.colorPicker;this._body.classList.add("standalone-colorpicker-body"),this._body.style.maxHeight=Math.max(this._editor.getLayoutInfo().height/4,250)+"px",this._body.style.maxWidth=Math.max(this._editor.getLayoutInfo().width*.66,500)+"px",this._body.tabIndex=0,this._body.appendChild(o),r.layout();let s=r.body,l=s.saturationBox.domNode.clientWidth,c=s.domNode.clientWidth-l-eKo-V7i,u=r.body.enterButton;u?.onClicked(()=>{this.updateEditor(),this.hide()});let p=r.header,h=p.pickedColorNode;h.style.width=l+V7i+"px";let g=p.originalColorNode;g.style.width=c+"px",r.header.closeButton?.onClicked(()=>{this.hide()}),t&&(u&&(u.button.textContent="Replace"),this._selectionSetInEditor=!0,this._editor.setSelection(e.range)),this._editor.layoutContentWidget(this)}};QY=I([m(3,F),m(4,_e),m(5,Qt),m(6,Qs),m(7,nt)],QY);var HP=class extends x{constructor(e,t,o){super();this._editor=e;this._instantiationService=o;this._standaloneColorPickerWidget=null;this._standaloneColorPickerVisible=pe.standaloneColorPickerVisible.bindTo(t),this._standaloneColorPickerFocused=pe.standaloneColorPickerFocused.bindTo(t)}static{this.ID="editor.contrib.standaloneColorPickerController"}showOrFocus(){this._editor.hasModel()&&(this._standaloneColorPickerVisible.get()?this._standaloneColorPickerFocused.get()||this._standaloneColorPickerWidget?.focus():this._standaloneColorPickerWidget=this._instantiationService.createInstance(QY,this._editor,this._standaloneColorPickerVisible,this._standaloneColorPickerFocused))}hide(){this._standaloneColorPickerFocused.set(!1),this._standaloneColorPickerVisible.set(!1),this._standaloneColorPickerWidget?.hide(),this._editor.focus()}insertColor(){this._standaloneColorPickerWidget?.updateEditor(),this.hide()}static get(e){return e.getContribution(HP.ID)}};HP=I([m(1,X),m(2,F)],HP);var Axt=class extends pl{constructor(){super({id:"editor.action.showOrFocusStandaloneColorPicker",title:{...L(1049,"Show or Focus Standalone Color Picker"),mnemonicTitle:d(1048,null)},precondition:void 0,menu:[{id:D.CommandPalette}],metadata:{description:L(1050,"Show or focus a standalone color picker which uses the default color provider. It displays hex/rgb/hsl colors.")}})}runEditorCommand(i,e){HP.get(e)?.showOrFocus()}},Nxt=class extends Di{constructor(){super({id:"editor.action.hideColorPicker",label:L(1044,"Hide the Color Picker"),precondition:pe.standaloneColorPickerVisible.isEqualTo(!0),kbOpts:{primary:9,weight:100},metadata:{description:L(1045,"Hide the standalone color picker.")}})}run(i,e){HP.get(e)?.hide()}},Oxt=class extends Di{constructor(){super({id:"editor.action.insertColorWithStandaloneColorPicker",label:L(1046,"Insert Color with Standalone Color Picker"),precondition:pe.standaloneColorPickerFocused.isEqualTo(!0),kbOpts:{primary:3,weight:100},metadata:{description:L(1047,"Insert hex/rgb/hsl colors with the focused standalone color picker.")}})}run(i,e){HP.get(e)?.insertColor()}};ni(Nxt);ni(Oxt);W(Axt);xo(Q3e.ID,Q3e,2);xo(HP.ID,HP,1);xo(Iw.ID,Iw,1);ik(gxe);z_.register(UY);$e.registerCommand("_executeDocumentColorProvider",function(a,...i){let[e]=i;if(!(e instanceof A))throw Yr();let{model:t,colorProviderRegistry:o,defaultColorDecoratorsEnablement:n}=zsi(a,e);return sCt(new oCt,o,t,Se.None,n)});$e.registerCommand("_executeColorPresentationProvider",function(a,...i){let[e,t]=i;if(!t)return;let{uri:o,range:n}=t;if(!(o instanceof A)||!Array.isArray(e)||e.length!==4||!z.isIRange(n))throw Yr();let{model:r,colorProviderRegistry:s,defaultColorDecoratorsEnablement:l}=zsi(a,o),[c,u,p,h]=e;return sCt(new nCt({range:n,color:{red:c,green:u,blue:p,alpha:h}}),s,r,Se.None,l)});var f5=class a{constructor(i,e,t){this.languageConfigurationService=t;this._selection=i,this._insertSpace=e,this._usedEndToken=null}static _haystackHasNeedleAtOffset(i,e,t){if(t<0)return!1;let o=e.length,n=i.length;if(t+o>n)return!1;for(let r=0;r<o;r++){let s=i.charCodeAt(t+r),l=e.charCodeAt(r);if(s!==l&&!(s>=65&&s<=90&&s+32===l)&&!(l>=65&&l<=90&&l+32===s))return!1}return!0}_createOperationsForBlockComment(i,e,t,o,n,r){let s=i.startLineNumber,l=i.startColumn,c=i.endLineNumber,u=i.endColumn,p=n.getLineContent(s),h=n.getLineContent(c),g=p.lastIndexOf(e,l-1+e.length),f=h.indexOf(t,u-1-t.length);if(g!==-1&&f!==-1)if(s===c)p.substring(g+e.length,f).indexOf(t)>=0&&(g=-1,f=-1);else{let b=p.substring(g+e.length),S=h.substring(0,f);(b.indexOf(t)>=0||S.indexOf(t)>=0)&&(g=-1,f=-1)}let v;g!==-1&&f!==-1?(o&&g+e.length<p.length&&p.charCodeAt(g+e.length)===32&&(e=e+" "),o&&f>0&&h.charCodeAt(f-1)===32&&(t=" "+t,f-=1),v=a._createRemoveBlockCommentOperations(new z(s,g+e.length+1,c,f+1),e,t)):(v=a._createAddBlockCommentOperations(i,e,t,this._insertSpace),this._usedEndToken=v.length===1?t:null);for(let b of v)r.addTrackedEditOperation(b.range,b.text)}static _createRemoveBlockCommentOperations(i,e,t){let o=[];return z.isEmpty(i)?o.push(Hn.delete(new z(i.startLineNumber,i.startColumn-e.length,i.endLineNumber,i.endColumn+t.length))):(o.push(Hn.delete(new z(i.startLineNumber,i.startColumn-e.length,i.startLineNumber,i.startColumn))),o.push(Hn.delete(new z(i.endLineNumber,i.endColumn,i.endLineNumber,i.endColumn+t.length)))),o}static _createAddBlockCommentOperations(i,e,t,o){let n=[];return z.isEmpty(i)?n.push(Hn.replace(new z(i.startLineNumber,i.startColumn,i.endLineNumber,i.endColumn),e+"  "+t)):(n.push(Hn.insert(new ye(i.startLineNumber,i.startColumn),e+(o?" ":""))),n.push(Hn.insert(new ye(i.endLineNumber,i.endColumn),(o?" ":"")+t))),n}getEditOperations(i,e){let t=this._selection.startLineNumber,o=this._selection.startColumn;i.tokenization.tokenizeIfCheap(t);let n=i.getLanguageIdAtPosition(t,o),r=this.languageConfigurationService.getLanguageConfiguration(n).comments;!r||!r.blockCommentStartToken||!r.blockCommentEndToken||this._createOperationsForBlockComment(this._selection,r.blockCommentStartToken,r.blockCommentEndToken,this._insertSpace,i,e)}computeCursorState(i,e){let t=e.getInverseEditOperations();if(t.length===2){let o=t[0],n=t[1];return new ti(o.range.endLineNumber,o.range.endColumn,n.range.startLineNumber,n.range.startColumn)}else{let o=t[0].range,n=this._usedEndToken?-this._usedEndToken.length-1:0;return new ti(o.endLineNumber,o.endColumn+n,o.endLineNumber,o.endColumn+n)}}};var jxe=class a{constructor(i,e,t,o,n,r,s){this.languageConfigurationService=i;this._selection=e,this._indentSize=t,this._type=o,this._insertSpace=n,this._selectionId=null,this._deltaColumn=0,this._moveEndPositionDown=!1,this._ignoreEmptyLines=r,this._ignoreFirstLine=s||!1}static _gatherPreflightCommentStrings(i,e,t,o){i.tokenization.tokenizeIfCheap(e);let n=i.getLanguageIdAtPosition(e,1),r=o.getLanguageConfiguration(n).comments,s=r?r.lineCommentToken:null;if(!s)return null;let l=[];for(let c=0,u=t-e+1;c<u;c++)l[c]={ignore:!1,commentStr:s,commentStrOffset:0,commentStrLength:s.length};return l}static _analyzeLines(i,e,t,o,n,r,s,l,c){let u=!0,h=l.getLanguageConfiguration(c).comments?.lineCommentNoIndent??!1,g;i===0?g=!0:i===1?g=!1:g=!0;for(let f=0,v=o.length;f<v;f++){let b=o[f],S=n+f;if(S===n&&s){b.ignore=!0;continue}let y=t.getLineContent(S),w=nm(y);if(w===-1){b.ignore=r,b.commentStrOffset=h?0:y.length;continue}u=!1;let k=h?0:w;if(b.ignore=!1,b.commentStrOffset=k,g&&!f5._haystackHasNeedleAtOffset(y,b.commentStr,k)&&(i===0?g=!1:i===1||(b.ignore=!0)),g&&e){let T=w+b.commentStrLength;T<y.length&&y.charCodeAt(T)===32&&(b.commentStrLength+=1)}}if(i===0&&u){g=!1;for(let f=0,v=o.length;f<v;f++)o[f].ignore=!1}return{supported:!0,shouldRemoveComments:g,lines:o}}static _gatherPreflightData(i,e,t,o,n,r,s,l){let c=a._gatherPreflightCommentStrings(t,o,n,l),u=t.getLanguageIdAtPosition(o,1);return c===null?{supported:!1}:a._analyzeLines(i,e,t,c,o,r,s,l,u)}_executeLineComments(i,e,t,o){let n;t.shouldRemoveComments?n=a._createRemoveLineCommentsOperations(t.lines,o.startLineNumber):(a._normalizeInsertionPoint(i,t.lines,o.startLineNumber,this._indentSize),n=this._createAddLineCommentsOperations(t.lines,o.startLineNumber));let r=new ye(o.positionLineNumber,o.positionColumn);for(let s=0,l=n.length;s<l;s++)e.addEditOperation(n[s].range,n[s].text),z.isEmpty(n[s].range)&&z.getStartPosition(n[s].range).equals(r)&&i.getLineContent(r.lineNumber).length+1===r.column&&(this._deltaColumn=(n[s].text||"").length);this._selectionId=e.trackSelection(o)}_attemptRemoveBlockComment(i,e,t,o){let n=e.startLineNumber,r=e.endLineNumber,s=o.length+Math.max(i.getLineFirstNonWhitespaceColumn(e.startLineNumber),e.startColumn),l=i.getLineContent(n).lastIndexOf(t,s-1),c=i.getLineContent(r).indexOf(o,e.endColumn-1-t.length);return l!==-1&&c===-1&&(c=i.getLineContent(n).indexOf(o,l+t.length),r=n),l===-1&&c!==-1&&(l=i.getLineContent(r).lastIndexOf(t,c),n=r),e.isEmpty()&&(l===-1||c===-1)&&(l=i.getLineContent(n).indexOf(t),l!==-1&&(c=i.getLineContent(n).indexOf(o,l+t.length))),l!==-1&&i.getLineContent(n).charCodeAt(l+t.length)===32&&(t+=" "),c!==-1&&i.getLineContent(r).charCodeAt(c-1)===32&&(o=" "+o,c-=1),l!==-1&&c!==-1?f5._createRemoveBlockCommentOperations(new z(n,l+t.length+1,r,c+1),t,o):null}_executeBlockComment(i,e,t){i.tokenization.tokenizeIfCheap(t.startLineNumber);let o=i.getLanguageIdAtPosition(t.startLineNumber,1),n=this.languageConfigurationService.getLanguageConfiguration(o).comments;if(!n||!n.blockCommentStartToken||!n.blockCommentEndToken)return;let r=n.blockCommentStartToken,s=n.blockCommentEndToken,l=this._attemptRemoveBlockComment(i,t,r,s);if(!l){if(t.isEmpty()){let c=i.getLineContent(t.startLineNumber),u=nm(c);u===-1&&(u=c.length),l=f5._createAddBlockCommentOperations(new z(t.startLineNumber,u+1,t.startLineNumber,c.length+1),r,s,this._insertSpace)}else l=f5._createAddBlockCommentOperations(new z(t.startLineNumber,i.getLineFirstNonWhitespaceColumn(t.startLineNumber),t.endLineNumber,i.getLineMaxColumn(t.endLineNumber)),r,s,this._insertSpace);l.length===1&&(this._deltaColumn=r.length+1)}this._selectionId=e.trackSelection(t);for(let c of l)e.addEditOperation(c.range,c.text)}getEditOperations(i,e){let t=this._selection;if(this._moveEndPositionDown=!1,t.startLineNumber===t.endLineNumber&&this._ignoreFirstLine){e.addEditOperation(new z(t.startLineNumber,i.getLineMaxColumn(t.startLineNumber),t.startLineNumber+1,1),t.startLineNumber===i.getLineCount()?"":`
`),this._selectionId=e.trackSelection(t);return}t.startLineNumber<t.endLineNumber&&t.endColumn===1&&(this._moveEndPositionDown=!0,t=t.setEndPosition(t.endLineNumber-1,i.getLineMaxColumn(t.endLineNumber-1)));let o=a._gatherPreflightData(this._type,this._insertSpace,i,t.startLineNumber,t.endLineNumber,this._ignoreEmptyLines,this._ignoreFirstLine,this.languageConfigurationService);return o.supported?this._executeLineComments(i,e,o,t):this._executeBlockComment(i,e,t)}computeCursorState(i,e){let t=e.getTrackedSelection(this._selectionId);return this._moveEndPositionDown&&(t=t.setEndPosition(t.endLineNumber+1,1)),new ti(t.selectionStartLineNumber,t.selectionStartColumn+this._deltaColumn,t.positionLineNumber,t.positionColumn+this._deltaColumn)}static _createRemoveLineCommentsOperations(i,e){let t=[];for(let o=0,n=i.length;o<n;o++){let r=i[o];r.ignore||t.push(Hn.delete(new z(e+o,r.commentStrOffset+1,e+o,r.commentStrOffset+r.commentStrLength+1)))}return t}_createAddLineCommentsOperations(i,e){let t=[],o=this._insertSpace?" ":"";for(let n=0,r=i.length;n<r;n++){let s=i[n];s.ignore||t.push(Hn.insert(new ye(e+n,s.commentStrOffset+1),s.commentStr+o))}return t}static nextVisibleColumn(i,e,t,o){return t?i+(e-i%e):i+o}static _normalizeInsertionPoint(i,e,t,o){let n=1073741824,r,s;for(let l=0,c=e.length;l<c;l++){if(e[l].ignore)continue;let u=i.getLineContent(t+l),p=0;for(let h=0,g=e[l].commentStrOffset;p<n&&h<g;h++)p=a.nextVisibleColumn(p,o,u.charCodeAt(h)===9,1);p<n&&(n=p)}n=Math.floor(n/o)*o;for(let l=0,c=e.length;l<c;l++){if(e[l].ignore)continue;let u=i.getLineContent(t+l),p=0;for(r=0,s=e[l].commentStrOffset;p<n&&r<s;r++)p=a.nextVisibleColumn(p,o,u.charCodeAt(r)===9,1);p>n?e[l].commentStrOffset=r-1:e[l].commentStrOffset=r}}};var Y3e=class extends Di{constructor(i,e){super(e),this._type=i}run(i,e){let t=i.get(Rs);if(!e.hasModel())return;let o=e.getModel(),n=[],r=o.getOptions(),s=e.getOption(29),l=e.getSelections().map((u,p)=>({selection:u,index:p,ignoreFirstLine:!1}));l.sort((u,p)=>z.compareRangesUsingStarts(u.selection,p.selection));let c=l[0];for(let u=1;u<l.length;u++){let p=l[u];c.selection.endLineNumber===p.selection.startLineNumber&&(c.index<p.index?p.ignoreFirstLine=!0:(c.ignoreFirstLine=!0,c=p))}for(let u of l)n.push(new jxe(t,u.selection,r.indentSize,this._type,s.insertSpace,s.ignoreEmptyLines,u.ignoreFirstLine));e.pushUndoStop(),e.executeCommands(this.id,n),e.pushUndoStop()}},Fli=class extends Y3e{constructor(){super(0,{id:"editor.action.commentLine",label:L(1052,"Toggle Line Comment"),precondition:pe.writable,kbOpts:{kbExpr:pe.editorTextFocus,primary:2138,weight:100},menuOpts:{menuId:D.MenubarEditMenu,group:"5_insert",title:d(1056,null),order:1},canTriggerInlineEdits:!0})}},Wli=class extends Y3e{constructor(){super(1,{id:"editor.action.addCommentLine",label:L(1053,"Add Line Comment"),precondition:pe.writable,kbOpts:{kbExpr:pe.editorTextFocus,primary:Vi(2089,2081),weight:100},canTriggerInlineEdits:!0})}},Vli=class extends Y3e{constructor(){super(2,{id:"editor.action.removeCommentLine",label:L(1054,"Remove Line Comment"),precondition:pe.writable,kbOpts:{kbExpr:pe.editorTextFocus,primary:Vi(2089,2099),weight:100},canTriggerInlineEdits:!0})}},Bli=class extends Di{constructor(){super({id:"editor.action.blockComment",label:L(1051,"Toggle Block Comment"),precondition:pe.writable,kbOpts:{kbExpr:pe.editorTextFocus,primary:1567,linux:{primary:3103},weight:100},menuOpts:{menuId:D.MenubarEditMenu,group:"5_insert",title:d(1055,null),order:2},canTriggerInlineEdits:!0})}run(i,e){let t=i.get(Rs);if(!e.hasModel())return;let o=e.getOption(29),n=[],r=e.getSelections();for(let s of r)n.push(new f5(s,o.insertSpace,t));e.pushUndoStop(),e.executeCommands(this.id,n),e.pushUndoStop()}};ni(Fli);ni(Wli);ni(Vli);ni(Bli);var og=class{constructor(i,e,t,o,n,r,s,l){this._contextMenuService=e;this._contextViewService=t;this._contextKeyService=o;this._keybindingService=n;this._menuService=r;this._configurationService=s;this._workspaceContextService=l;this._toDispose=new N;this._contextMenuIsBeingShownCount=0;this._editor=i,this._toDispose.add(this._editor.onContextMenu(c=>this._onContextMenu(c))),this._toDispose.add(this._editor.onMouseWheel(c=>{if(this._contextMenuIsBeingShownCount>0){let u=this._contextViewService.getContextViewElement(),p=c.srcElement;p.shadowRoot&&bP(u)===p.shadowRoot||this._contextViewService.hideContextView()}})),this._toDispose.add(this._editor.onKeyDown(c=>{this._editor.getOption(30)&&c.keyCode===58&&(c.preventDefault(),c.stopPropagation(),this.showContextMenu())}))}static{this.ID="editor.contrib.contextmenu"}static get(i){return i.getContribution(og.ID)}_onContextMenu(i){if(!this._editor.hasModel())return;if(!this._editor.getOption(30)){this._editor.focus(),i.target.position&&!this._editor.getSelection().containsPosition(i.target.position)&&this._editor.setPosition(i.target.position);return}if(i.target.type===12||i.target.type===6&&i.target.detail.injectedText)return;if(i.event.preventDefault(),i.event.stopPropagation(),i.target.type===11)return this._showScrollbarContextMenu(i.event);if(i.target.type!==6&&i.target.type!==7&&i.target.type!==1)return;if(this._editor.focus(),i.target.position){let t=!1;for(let o of this._editor.getSelections())if(o.containsPosition(i.target.position)){t=!0;break}t||this._editor.setPosition(i.target.position)}let e=null;i.target.type!==1&&(e=i.event),this.showContextMenu(e)}showContextMenu(i){if(!this._editor.getOption(30)||!this._editor.hasModel())return;let e=this._getMenuActions(this._editor.getModel(),this._editor.contextMenuId);e.length>0&&this._doShowContextMenu(e,i)}_getMenuActions(i,e){let t=[],o=this._menuService.getMenuActions(e,this._contextKeyService,{arg:i.uri});for(let n of o){let[,r]=n,s=0;for(let l of r)if(l instanceof Nc){let c=this._getMenuActions(i,l.item.submenu);c.length>0&&(t.push(new Fs(l.id,l.label,c)),s++)}else t.push(l),s++;s&&t.push(new ri)}return t.length&&t.pop(),t}_doShowContextMenu(i,e=null){if(!this._editor.hasModel())return;let t=e;if(!t){this._editor.revealPosition(this._editor.getPosition(),1),this._editor.render();let n=this._editor.getScrolledVisiblePosition(this._editor.getPosition()),r=ir(this._editor.getDomNode()),s=r.left+n.left,l=r.top+n.top+n.height;t={x:s,y:l}}let o=this._editor.getOption(144)&&!dc;this._contextMenuIsBeingShownCount++,this._contextMenuService.showContextMenu({domForShadowRoot:o?this._editor.getOverflowWidgetsDomNode()??this._editor.getDomNode():void 0,getAnchor:()=>t,getActions:()=>i,getActionViewItem:n=>{let r=this._keybindingFor(n);if(r)return new hs(n,n,{label:!0,keybinding:r.getLabel(),isMenu:!0});let s=n;return typeof s.getActionViewItem=="function"?s.getActionViewItem():new hs(n,n,{icon:!0,label:!0,isMenu:!0})},getKeyBinding:n=>this._keybindingFor(n),onHide:n=>{this._contextMenuIsBeingShownCount--}})}_showScrollbarContextMenu(i){if(!this._editor.hasModel()||H6i(this._workspaceContextService.getWorkspace()))return;let e=this._editor.getOption(81),t=0,o=c=>({id:`menu-action-${++t}`,label:c.label,tooltip:"",class:void 0,enabled:typeof c.enabled>"u"?!0:c.enabled,checked:c.checked,run:c.run}),n=(c,u)=>new Fs(`menu-action-${++t}`,c,u,void 0),r=(c,u,p,h,g)=>{if(!u)return o({label:c,enabled:u,run:()=>{}});let f=b=>()=>{this._configurationService.updateValue(p,b)},v=[];for(let b of g)v.push(o({label:b.label,checked:h===b.value,run:f(b.value)}));return n(c,v)},s=[];s.push(o({label:d(1058,null),checked:e.enabled,run:()=>{this._configurationService.updateValue("editor.minimap.enabled",!e.enabled)}})),s.push(new ri),s.push(o({label:d(1059,null),enabled:e.enabled,checked:e.renderCharacters,run:()=>{this._configurationService.updateValue("editor.minimap.renderCharacters",!e.renderCharacters)}})),s.push(r(d(1063,null),e.enabled,"editor.minimap.size",e.size,[{label:d(1066,null),value:"proportional"},{label:d(1064,null),value:"fill"},{label:d(1065,null),value:"fit"}])),s.push(r(d(1067,null),e.enabled,"editor.minimap.showSlider",e.showSlider,[{label:d(1069,null),value:"mouseover"},{label:d(1068,null),value:"always"}])),s.push(r(d(1060,null),e.enabled,"editor.minimap.side",e.side,[{label:d(1062,null),value:"right"},{label:d(1061,null),value:"left"}]));let l=this._editor.getOption(144)&&!dc;this._contextMenuIsBeingShownCount++,this._contextMenuService.showContextMenu({domForShadowRoot:l?this._editor.getDomNode():void 0,getAnchor:()=>i,getActions:()=>s,onHide:c=>{this._contextMenuIsBeingShownCount--,this._editor.focus()}})}_keybindingFor(i){return this._keybindingService.lookupKeybinding(i.id)}dispose(){this._contextMenuIsBeingShownCount>0&&this._contextViewService.hideContextView(),this._toDispose.dispose()}};og=I([m(1,Xe),m(2,Wn),m(3,X),m(4,_e),m(5,Kt),m(6,B),m(7,Pe)],og);var Hli=class extends Di{constructor(){super({id:"editor.action.showContextMenu",label:L(1057,"Show Editor Context Menu"),precondition:void 0,kbOpts:{kbExpr:pe.textInputFocus,primary:1092,weight:100}})}run(i,e){og.get(e)?.showContextMenu()}};xo(og.ID,og,2);ni(Hli);var X3e=class{constructor(i){this.selections=i}equals(i){let e=this.selections.length,t=i.selections.length;if(e!==t)return!1;for(let o=0;o<e;o++)if(!this.selections[o].equalsSelection(i.selections[o]))return!1;return!0}},J3e=class{constructor(i,e,t){this.cursorState=i;this.scrollTop=e;this.scrollLeft=t}},Qxe=class a extends x{static{this.ID="editor.contrib.cursorUndoRedoController"}static get(i){return i.getContribution(a.ID)}constructor(i){super(),this._editor=i,this._isCursorUndoRedo=!1,this._undoStack=[],this._redoStack=[],this._register(i.onDidChangeModel(e=>{this._undoStack=[],this._redoStack=[]})),this._register(i.onDidChangeModelContent(e=>{this._undoStack=[],this._redoStack=[]})),this._register(i.onDidChangeCursorSelection(e=>{if(this._isCursorUndoRedo||!e.oldSelections||e.oldModelVersionId!==e.modelVersionId)return;let t=new X3e(e.oldSelections);this._undoStack.length>0&&this._undoStack[this._undoStack.length-1].cursorState.equals(t)||(this._undoStack.push(new J3e(t,i.getScrollTop(),i.getScrollLeft())),this._redoStack=[],this._undoStack.length>50&&this._undoStack.shift())}))}cursorUndo(){!this._editor.hasModel()||this._undoStack.length===0||(this._redoStack.push(new J3e(new X3e(this._editor.getSelections()),this._editor.getScrollTop(),this._editor.getScrollLeft())),this._applyState(this._undoStack.pop()))}cursorRedo(){!this._editor.hasModel()||this._redoStack.length===0||(this._undoStack.push(new J3e(new X3e(this._editor.getSelections()),this._editor.getScrollTop(),this._editor.getScrollLeft())),this._applyState(this._redoStack.pop()))}_applyState(i){this._isCursorUndoRedo=!0,this._editor.setSelections(i.cursorState.selections),this._editor.setScrollPosition({scrollTop:i.scrollTop,scrollLeft:i.scrollLeft}),this._isCursorUndoRedo=!1}},Uli=class extends Di{constructor(){super({id:"cursorUndo",label:L(1071,"Cursor Undo"),precondition:void 0,kbOpts:{kbExpr:pe.textInputFocus,primary:2099,weight:100}})}run(i,e,t){Qxe.get(e)?.cursorUndo()}},zli=class extends Di{constructor(){super({id:"cursorRedo",label:L(1070,"Cursor Redo"),precondition:void 0})}run(i,e,t){Qxe.get(e)?.cursorRedo()}};xo(Qxe.ID,Qxe,0);ni(Uli);ni(zli);var Fxt=class{constructor(i,e,t){this.selection=i,this.targetPosition=e,this.copy=t,this.targetSelection=null}getEditOperations(i,e){let t=i.getValueInRange(this.selection);if(this.copy||e.addEditOperation(this.selection,null),e.addEditOperation(new z(this.targetPosition.lineNumber,this.targetPosition.column,this.targetPosition.lineNumber,this.targetPosition.column),t),this.selection.containsPosition(this.targetPosition)&&!(this.copy&&(this.selection.getEndPosition().equals(this.targetPosition)||this.selection.getStartPosition().equals(this.targetPosition)))){this.targetSelection=this.selection;return}if(this.copy){this.targetSelection=new ti(this.targetPosition.lineNumber,this.targetPosition.column,this.selection.endLineNumber-this.selection.startLineNumber+this.targetPosition.lineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column+this.selection.endColumn-this.selection.startColumn:this.selection.endColumn);return}if(this.targetPosition.lineNumber>this.selection.endLineNumber){this.targetSelection=new ti(this.targetPosition.lineNumber-this.selection.endLineNumber+this.selection.startLineNumber,this.targetPosition.column,this.targetPosition.lineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column+this.selection.endColumn-this.selection.startColumn:this.selection.endColumn);return}if(this.targetPosition.lineNumber<this.selection.endLineNumber){this.targetSelection=new ti(this.targetPosition.lineNumber,this.targetPosition.column,this.targetPosition.lineNumber+this.selection.endLineNumber-this.selection.startLineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column+this.selection.endColumn-this.selection.startColumn:this.selection.endColumn);return}this.selection.endColumn<=this.targetPosition.column?this.targetSelection=new ti(this.targetPosition.lineNumber-this.selection.endLineNumber+this.selection.startLineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column-this.selection.endColumn+this.selection.startColumn:this.targetPosition.column-this.selection.endColumn+this.selection.startColumn,this.targetPosition.lineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column:this.selection.endColumn):this.targetSelection=new ti(this.targetPosition.lineNumber-this.selection.endLineNumber+this.selection.startLineNumber,this.targetPosition.column,this.targetPosition.lineNumber,this.targetPosition.column+this.selection.endColumn-this.selection.startColumn)}computeCursorState(i,e){return this.targetSelection}};function Yxe(a){return Ze?a.altKey:a.ctrlKey}var Xxe=class a extends x{static{this.ID="editor.contrib.dragAndDrop"}static{this.TRIGGER_KEY_VALUE=Ze?6:5}static get(i){return i.getContribution(a.ID)}constructor(i){super(),this._editor=i,this._dndDecorationIds=this._editor.createDecorationsCollection(),this._register(this._editor.onMouseDown(e=>this._onEditorMouseDown(e))),this._register(this._editor.onMouseUp(e=>this._onEditorMouseUp(e))),this._register(this._editor.onMouseDrag(e=>this._onEditorMouseDrag(e))),this._register(this._editor.onMouseDrop(e=>this._onEditorMouseDrop(e))),this._register(this._editor.onMouseDropCanceled(()=>this._onEditorMouseDropCanceled())),this._register(this._editor.onKeyDown(e=>this.onEditorKeyDown(e))),this._register(this._editor.onKeyUp(e=>this.onEditorKeyUp(e))),this._register(this._editor.onDidBlurEditorWidget(()=>this.onEditorBlur())),this._register(this._editor.onDidBlurEditorText(()=>this.onEditorBlur())),this._mouseDown=!1,this._modifierPressed=!1,this._dragSelection=null}onEditorBlur(){this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1,this._modifierPressed=!1}onEditorKeyDown(i){!this._editor.getOption(42)||this._editor.getOption(28)||(Yxe(i)&&(this._modifierPressed=!0),this._mouseDown&&Yxe(i)&&this._editor.updateOptions({mouseStyle:"copy"}))}onEditorKeyUp(i){!this._editor.getOption(42)||this._editor.getOption(28)||(Yxe(i)&&(this._modifierPressed=!1),this._mouseDown&&i.keyCode===a.TRIGGER_KEY_VALUE&&this._editor.updateOptions({mouseStyle:"default"}))}_onEditorMouseDown(i){this._mouseDown=!0}_onEditorMouseUp(i){this._mouseDown=!1,this._editor.updateOptions({mouseStyle:"text"})}_onEditorMouseDrag(i){let e=i.target;if(this._dragSelection===null){let o=(this._editor.getSelections()||[]).filter(n=>e.position&&n.containsPosition(e.position));if(o.length===1)this._dragSelection=o[0];else return}Yxe(i.event)?this._editor.updateOptions({mouseStyle:"copy"}):this._editor.updateOptions({mouseStyle:"default"}),e.position&&(this._dragSelection.containsPosition(e.position)?this._removeDecoration():this.showAt(e.position))}_onEditorMouseDropCanceled(){this._editor.updateOptions({mouseStyle:"text"}),this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1}_onEditorMouseDrop(i){if(i.target&&(this._hitContent(i.target)||this._hitMargin(i.target))&&i.target.position){let e=new ye(i.target.position.lineNumber,i.target.position.column);if(this._dragSelection===null){let t=null;if(i.event.shiftKey){let o=this._editor.getSelection();if(o){let{selectionStartLineNumber:n,selectionStartColumn:r}=o;t=[new ti(n,r,e.lineNumber,e.column)]}}else t=(this._editor.getSelections()||[]).map(o=>o.containsPosition(e)?new ti(e.lineNumber,e.column,e.lineNumber,e.column):o);this._editor.setSelections(t||[],"mouse",3)}else(!this._dragSelection.containsPosition(e)||(Yxe(i.event)||this._modifierPressed)&&(this._dragSelection.getEndPosition().equals(e)||this._dragSelection.getStartPosition().equals(e)))&&(this._editor.pushUndoStop(),this._editor.executeCommand(a.ID,new Fxt(this._dragSelection,e,Yxe(i.event)||this._modifierPressed)),this._editor.pushUndoStop())}this._editor.updateOptions({mouseStyle:"text"}),this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1}static{this._DECORATION_OPTIONS=mo.register({description:"dnd-target",className:"dnd-target"})}showAt(i){this._dndDecorationIds.set([{range:new z(i.lineNumber,i.column,i.lineNumber,i.column),options:a._DECORATION_OPTIONS}]),this._editor.revealPosition(i,1)}_removeDecoration(){this._dndDecorationIds.clear()}_hitContent(i){return i.type===6||i.type===7}_hitMargin(i){return i.type===2||i.type===3||i.type===4}dispose(){this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1,this._modifierPressed=!1,super.dispose()}};xo(Xxe.ID,Xxe,2);var Kli="editor.action.pasteAs";xo(ku.ID,ku,0);ik(nxe);Xi(new class extends Oc{constructor(){super({id:ysi,precondition:Gwt,kbOpts:{weight:100,primary:2137}})}runEditorCommand(a,i){return ku.get(i)?.changePasteType()}});Xi(new class extends Oc{constructor(){super({id:"editor.hidePasteWidget",precondition:Gwt,kbOpts:{weight:100,primary:9}})}runEditorCommand(a,i){ku.get(i)?.clearWidgets()}});ni(class B7i extends Di{static{this.argsSchema={oneOf:[{type:"object",required:["kind"],properties:{kind:{type:"string",description:d(1073,null)}}},{type:"object",required:["preferences"],properties:{preferences:{type:"array",description:d(1074,null),items:{type:"string"}}}}]}}constructor(){super({id:Kli,label:L(1072,"Paste As..."),precondition:pe.writable,metadata:{description:"Paste as",args:[{name:"args",schema:B7i.argsSchema}]},canTriggerInlineEdits:!0})}run(i,e,t){let o;return t&&("kind"in t?o={only:new fs(t.kind)}:"preferences"in t&&(o={preferences:t.preferences.map(n=>new fs(n))})),ku.get(e)?.pasteAs(o)}});ni(class extends Di{constructor(){super({id:"editor.action.pasteAsText",label:L(1075,"Paste as Text"),precondition:pe.writable,canTriggerInlineEdits:!0})}run(a,i){return ku.get(i)?.pasteAs({providerId:Zj.id})}});var Wxt=class{constructor(){this._dragOperations=new Map}removeDragOperationTransfer(i){if(i&&this._dragOperations.has(i)){let e=this._dragOperations.get(i);return this._dragOperations.delete(i),e}}addDragOperationTransfer(i,e){this._dragOperations.set(i,e)}},PC=class{constructor(i){this.identifier=i}};var v5=le("treeViewsDndService");Ee(v5,Wxt,1);var Z3e="editor.dropIntoEditor.preferences",Gli="editor.changeDropType",Vxt=new Y("dropWidgetVisible",!1,d(1094,null)),fh=class extends x{constructor(e,t,o,n,r){super();this._configService=o;this._languageFeaturesService=n;this._treeViewsDragAndDropService=r;this.treeItemsTransfer=JI.getInstance();this._dropProgressManager=this._register(t.createInstance(_Y,"dropIntoEditor",e)),this._postDropWidgetManager=this._register(t.createInstance(LY,"dropIntoEditor",e,Vxt,{id:Gli,label:d(1095,null)},()=>fh._configureDefaultAction?[fh._configureDefaultAction]:[])),this._register(e.onDropIntoEditor(s=>this.onDropIntoEditor(e,s.position,s.event)))}static{this.ID="editor.contrib.dropIntoEditorController"}static get(e){return e.getContribution(fh.ID)}static setConfigureDefaultAction(e){this._configureDefaultAction=e}clearWidgets(){this._postDropWidgetManager.clear()}changeDropType(){this._postDropWidgetManager.tryShowSelector()}async onDropIntoEditor(e,t,o){if(!o.dataTransfer||!e.hasModel())return;fh._currentDropOperation?.cancel(),e.focus(),e.setPosition(t);let n=Ln(async r=>{let s=new N,l=s.add(new ek(e,1,void 0,r));try{let c=await this.extractDataTransferData(o);if(c.size===0||l.token.isCancellationRequested)return;let u=e.getModel();if(!u)return;let p=this._languageFeaturesService.documentDropEditProvider.ordered(u).filter(g=>g.dropMimeTypes?g.dropMimeTypes.some(f=>c.matches(f)):!0),h=s.add(await this.getDropEdits(p,u,t,c,l.token));if(l.token.isCancellationRequested)return;if(h.edits.length){let g=this.getInitialActiveEditIndex(u,h.edits),f=e.getOption(43).showDropSelector==="afterDrop";await this._postDropWidgetManager.applyEditAndShowIfNeeded([z.fromPositions(t)],{activeEditIndex:g,allEdits:h.edits},f,async v=>v,r)}}finally{s.dispose(),fh._currentDropOperation===n&&(fh._currentDropOperation=void 0)}});this._dropProgressManager.showWhile(t,d(1093,null),n,{cancel:()=>n.cancel()}),fh._currentDropOperation=n}async getDropEdits(e,t,o,n,r){let s=new N,l=await Va(Promise.all(e.map(async u=>{try{let p=await u.provideDocumentDropEdits(t,o,n,r);return p&&s.add(p),p?.edits.map(h=>({...h,providerId:u.id}))}catch(p){ao(p)||console.error(p),console.error(p)}})),r),c=di(l??[]).flat();return{edits:Bwt(c),dispose:()=>s.dispose()}}getInitialActiveEditIndex(e,t){let o=this._configService.getValue(Z3e,{resource:e.uri});for(let n of Array.isArray(o)?o:[]){let r=new fs(n),s=t.findIndex(l=>l.kind&&r.contains(l.kind));if(s>=0)return s}return 0}async extractDataTransferData(e){if(!e.dataTransfer)return new qx;let t=yle(e.dataTransfer);if(this.treeItemsTransfer.hasData(PC.prototype)){let o=this.treeItemsTransfer.getData(PC.prototype);if(Array.isArray(o))for(let n of o){let r=await this._treeViewsDragAndDropService.removeDragOperationTransfer(n.identifier);if(r)for(let[s,l]of r)t.replace(s,l)}}return t}};fh=I([m(1,F),m(2,B),m(3,Qt),m(4,v5)],fh);xo(fh.ID,fh,2);ik(oxe);Xi(new class extends Oc{constructor(){super({id:Gli,precondition:Vxt,kbOpts:{weight:100,primary:2137}})}runEditorCommand(a,i,e){fh.get(i)?.changeDropType()}});Xi(new class extends Oc{constructor(){super({id:"editor.hideDropWidget",precondition:Vxt,kbOpts:{weight:100,primary:9}})}runEditorCommand(a,i,e){fh.get(i)?.clearWidgets()}});var Bxt=class a extends ja{constructor(e,t,o){super();this._hideSoon=this._register(new Dt(()=>this._hide(),2e3));this._isVisible=!1;this._editor=e,this._state=t,this._keybindingService=o,this._domNode=document.createElement("div"),this._domNode.className="findOptionsWidget",this._domNode.style.display="none",this._domNode.style.top="10px",this._domNode.style.zIndex="12",this._domNode.setAttribute("role","presentation"),this._domNode.setAttribute("aria-hidden","true");let n={inputActiveOptionBorder:kt(MV),inputActiveOptionForeground:kt(dj),inputActiveOptionBackground:kt(PV)},r={groupId:"find-options-widget"};this.caseSensitive=this._register(new Cxe({appendTitle:this._keybindingLabelFor(xd.ToggleCaseSensitiveCommand),isChecked:this._state.matchCase,hoverLifecycleOptions:r,...n})),this._domNode.appendChild(this.caseSensitive.domNode),this._register(this.caseSensitive.onChange(()=>{this._state.change({matchCase:this.caseSensitive.checked},!1)})),this.wholeWords=this._register(new xxe({appendTitle:this._keybindingLabelFor(xd.ToggleWholeWordCommand),isChecked:this._state.wholeWord,hoverLifecycleOptions:r,...n})),this._domNode.appendChild(this.wholeWords.domNode),this._register(this.wholeWords.onChange(()=>{this._state.change({wholeWord:this.wholeWords.checked},!1)})),this.regex=this._register(new kxe({appendTitle:this._keybindingLabelFor(xd.ToggleRegexCommand),isChecked:this._state.isRegex,hoverLifecycleOptions:r,...n})),this._domNode.appendChild(this.regex.domNode),this._register(this.regex.onChange(()=>{this._state.change({isRegex:this.regex.checked},!1)})),this._editor.addOverlayWidget(this),this._register(this._state.onFindReplaceStateChange(s=>{let l=!1;s.isRegex&&(this.regex.checked=this._state.isRegex,l=!0),s.wholeWord&&(this.wholeWords.checked=this._state.wholeWord,l=!0),s.matchCase&&(this.caseSensitive.checked=this._state.matchCase,l=!0),!this._state.isRevealed&&l&&this._revealTemporarily()})),this._register(j(this._domNode,re.MOUSE_LEAVE,s=>this._onMouseLeave())),this._register(j(this._domNode,"mouseover",s=>this._onMouseOver()))}static{this.ID="editor.contrib.findOptionsWidget"}_keybindingLabelFor(e){return this._keybindingService.appendKeybinding("",e)}dispose(){this._editor.removeOverlayWidget(this),super.dispose()}getId(){return a.ID}getDomNode(){return this._domNode}getPosition(){return{preference:0}}highlightFindOptions(){this._revealTemporarily()}_revealTemporarily(){this._show(),this._hideSoon.schedule()}_onMouseLeave(){this._hideSoon.schedule()}_onMouseOver(){this._hideSoon.cancel()}_show(){this._isVisible||(this._isVisible=!0,this._domNode.style.display="block")}_hide(){this._isVisible&&(this._isVisible=!1,this._domNode.style.display="none")}};function Hxt(a,i){return a===1?!0:a===2?!1:i}var iK=class extends x{constructor(){super();this._onFindReplaceStateChange=this._register(new E);this.onFindReplaceStateChange=this._onFindReplaceStateChange.event;this._searchString="",this._replaceString="",this._isRevealed=!1,this._isReplaceRevealed=!1,this._isRegex=!1,this._isRegexOverride=0,this._wholeWord=!1,this._wholeWordOverride=0,this._matchCase=!1,this._matchCaseOverride=0,this._preserveCase=!1,this._preserveCaseOverride=0,this._searchScope=null,this._matchesPosition=0,this._matchesCount=0,this._currentMatch=null,this._loop=!0,this._isSearching=!1,this._filters=null}get searchString(){return this._searchString}get replaceString(){return this._replaceString}get isRevealed(){return this._isRevealed}get isReplaceRevealed(){return this._isReplaceRevealed}get isRegex(){return Hxt(this._isRegexOverride,this._isRegex)}get wholeWord(){return Hxt(this._wholeWordOverride,this._wholeWord)}get matchCase(){return Hxt(this._matchCaseOverride,this._matchCase)}get preserveCase(){return Hxt(this._preserveCaseOverride,this._preserveCase)}get actualIsRegex(){return this._isRegex}get actualWholeWord(){return this._wholeWord}get actualMatchCase(){return this._matchCase}get actualPreserveCase(){return this._preserveCase}get searchScope(){return this._searchScope}get matchesPosition(){return this._matchesPosition}get matchesCount(){return this._matchesCount}get currentMatch(){return this._currentMatch}get isSearching(){return this._isSearching}get filters(){return this._filters}changeMatchInfo(e,t,o){let n={moveCursor:!1,updateHistory:!1,searchString:!1,replaceString:!1,isRevealed:!1,isReplaceRevealed:!1,isRegex:!1,wholeWord:!1,matchCase:!1,preserveCase:!1,searchScope:!1,matchesPosition:!1,matchesCount:!1,currentMatch:!1,loop:!1,isSearching:!1,filters:!1},r=!1;t===0&&(e=0),e>t&&(e=t),this._matchesPosition!==e&&(this._matchesPosition=e,n.matchesPosition=!0,r=!0),this._matchesCount!==t&&(this._matchesCount=t,n.matchesCount=!0,r=!0),typeof o<"u"&&(z.equalsRange(this._currentMatch,o)||(this._currentMatch=o,n.currentMatch=!0,r=!0)),r&&this._onFindReplaceStateChange.fire(n)}change(e,t,o=!0){let n={moveCursor:t,updateHistory:o,searchString:!1,replaceString:!1,isRevealed:!1,isReplaceRevealed:!1,isRegex:!1,wholeWord:!1,matchCase:!1,preserveCase:!1,searchScope:!1,matchesPosition:!1,matchesCount:!1,currentMatch:!1,loop:!1,isSearching:!1,filters:!1},r=!1,s=this.isRegex,l=this.wholeWord,c=this.matchCase,u=this.preserveCase;typeof e.searchString<"u"&&this._searchString!==e.searchString&&(this._searchString=e.searchString,n.searchString=!0,r=!0),typeof e.replaceString<"u"&&this._replaceString!==e.replaceString&&(this._replaceString=e.replaceString,n.replaceString=!0,r=!0),typeof e.isRevealed<"u"&&this._isRevealed!==e.isRevealed&&(this._isRevealed=e.isRevealed,n.isRevealed=!0,r=!0),typeof e.isReplaceRevealed<"u"&&this._isReplaceRevealed!==e.isReplaceRevealed&&(this._isReplaceRevealed=e.isReplaceRevealed,n.isReplaceRevealed=!0,r=!0),typeof e.isRegex<"u"&&(this._isRegex=e.isRegex),typeof e.wholeWord<"u"&&(this._wholeWord=e.wholeWord),typeof e.matchCase<"u"&&(this._matchCase=e.matchCase),typeof e.preserveCase<"u"&&(this._preserveCase=e.preserveCase),typeof e.searchScope<"u"&&(e.searchScope?.every(p=>this._searchScope?.some(h=>!z.equalsRange(h,p)))||(this._searchScope=e.searchScope,n.searchScope=!0,r=!0)),typeof e.loop<"u"&&this._loop!==e.loop&&(this._loop=e.loop,n.loop=!0,r=!0),typeof e.isSearching<"u"&&this._isSearching!==e.isSearching&&(this._isSearching=e.isSearching,n.isSearching=!0,r=!0),typeof e.filters<"u"&&(this._filters?this._filters.update(e.filters):this._filters=e.filters,n.filters=!0,r=!0),this._isRegexOverride=typeof e.isRegexOverride<"u"?e.isRegexOverride:0,this._wholeWordOverride=typeof e.wholeWordOverride<"u"?e.wholeWordOverride:0,this._matchCaseOverride=typeof e.matchCaseOverride<"u"?e.matchCaseOverride:0,this._preserveCaseOverride=typeof e.preserveCaseOverride<"u"?e.preserveCaseOverride:0,s!==this.isRegex&&(r=!0,n.isRegex=!0),l!==this.wholeWord&&(r=!0,n.wholeWord=!0),c!==this.matchCase&&(r=!0,n.matchCase=!0),u!==this.preserveCase&&(r=!0,n.preserveCase=!0),r&&this._onFindReplaceStateChange.fire(n)}canNavigateBack(){return this.canNavigateInLoop()||this.matchesPosition!==1}canNavigateForward(){return this.canNavigateInLoop()||this.matchesPosition<this.matchesCount}canNavigateInLoop(){return this._loop||this.matchesCount>=XO}};var q_=class{constructor(i){this.storageService=i;this.inMemoryValues=new Set;this._onDidChangeEmitter=new E,this.onDidChange=this._onDidChangeEmitter.event,this.load()}static{this.FIND_HISTORY_KEY="workbench.find.history"}static{this._instance=null}static getOrCreate(i){return q_._instance||(q_._instance=new q_(i)),q_._instance}delete(i){let e=this.inMemoryValues.delete(i);return this.save(),e}add(i){return this.inMemoryValues.add(i),this.save(),this}has(i){return this.inMemoryValues.has(i)}clear(){this.inMemoryValues.clear(),this.save()}forEach(i,e){return this.load(),this.inMemoryValues.forEach(i)}replace(i){this.inMemoryValues=new Set(i),this.save()}load(){let i,e=this.storageService.get(q_.FIND_HISTORY_KEY,1);if(e)try{i=JSON.parse(e)}catch{}this.inMemoryValues=new Set(i||[])}save(){let i=[];return this.inMemoryValues.forEach(e=>i.push(e)),new Promise(e=>{this.storageService.store(q_.FIND_HISTORY_KEY,JSON.stringify(i),1,0),this._onDidChangeEmitter.fire(i),e()})}};q_=I([m(0,ce)],q_);var $_=class{constructor(i){this.storageService=i;this.inMemoryValues=new Set;this._onDidChangeEmitter=new E,this.onDidChange=this._onDidChangeEmitter.event,this.load()}static{this.FIND_HISTORY_KEY="workbench.replace.history"}static{this._instance=null}static getOrCreate(i){return $_._instance||($_._instance=new $_(i)),$_._instance}delete(i){let e=this.inMemoryValues.delete(i);return this.save(),e}add(i){return this.inMemoryValues.add(i),this.save(),this}has(i){return this.inMemoryValues.has(i)}clear(){this.inMemoryValues.clear(),this.save()}forEach(i,e){return this.load(),this.inMemoryValues.forEach(i)}replace(i){this.inMemoryValues=new Set(i),this.save()}load(){let i,e=this.storageService.get($_.FIND_HISTORY_KEY,1);if(e)try{i=JSON.parse(e)}catch{}this.inMemoryValues=new Set(i||[])}save(){let i=[];return this.inMemoryValues.forEach(e=>i.push(e)),new Promise(e=>{this.storageService.store($_.FIND_HISTORY_KEY,JSON.stringify(i),1,0),this._onDidChangeEmitter.fire(i),e()})}};$_=I([m(0,ce)],$_);var iKo=524288;function YY(a,i="single",e=!1){if(!a.hasModel())return null;let t=a.getSelection();if(i==="single"&&t.startLineNumber===t.endLineNumber||i==="multiple"){if(t.isEmpty()){let o=a.getConfiguredWordAtPosition(t.getStartPosition());if(o&&e===!1)return o.word}else if(a.getModel().getValueLengthInRange(t)<iKo)return a.getModel().getValueInRange(t)}return null}var $f=class extends x{static{this.ID="editor.contrib.findController"}get editor(){return this._editor}static get(i){return i.getContribution($f.ID)}constructor(i,e,t,o,n,r){super(),this._editor=i,this._findWidgetVisible=UE.bindTo(e),this._contextKeyService=e,this._storageService=t,this._clipboardService=o,this._notificationService=n,this._hoverService=r,this._updateHistoryDelayer=this._register(new Xo(500)),this._state=this._register(new iK),this.loadQueryState(),this._register(this._state.onFindReplaceStateChange(s=>this._onStateChanged(s))),this._model=null,this._register(this._editor.onDidChangeModel(()=>{let s=this._editor.getModel()&&this._state.isRevealed;this.disposeModel(),this._state.change({searchScope:null,matchCase:this._storageService.getBoolean("editor.matchCase",1,!1),wholeWord:this._storageService.getBoolean("editor.wholeWord",1,!1),isRegex:this._storageService.getBoolean("editor.isRegex",1,!1),preserveCase:this._storageService.getBoolean("editor.preserveCase",1,!1)},!1),s&&this._start({forceRevealReplace:!1,seedSearchStringFromSelection:"none",seedSearchStringFromNonEmptySelection:!1,seedSearchStringFromGlobalClipboard:!1,shouldFocus:0,shouldAnimate:!1,updateSearchScope:!1,loop:this._editor.getOption(50).loop})}))}dispose(){this.disposeModel(),super.dispose()}disposeModel(){this._model&&(this._model.dispose(),this._model=null)}_onStateChanged(i){this.saveQueryState(i),i.isRevealed&&(this._state.isRevealed?this._findWidgetVisible.set(!0):(this._findWidgetVisible.reset(),this.disposeModel())),i.searchString&&this.setGlobalBufferTerm(this._state.searchString)}saveQueryState(i){i.isRegex&&this._storageService.store("editor.isRegex",this._state.actualIsRegex,1,1),i.wholeWord&&this._storageService.store("editor.wholeWord",this._state.actualWholeWord,1,1),i.matchCase&&this._storageService.store("editor.matchCase",this._state.actualMatchCase,1,1),i.preserveCase&&this._storageService.store("editor.preserveCase",this._state.actualPreserveCase,1,1)}loadQueryState(){this._state.change({matchCase:this._storageService.getBoolean("editor.matchCase",1,this._state.matchCase),wholeWord:this._storageService.getBoolean("editor.wholeWord",1,this._state.wholeWord),isRegex:this._storageService.getBoolean("editor.isRegex",1,this._state.isRegex),preserveCase:this._storageService.getBoolean("editor.preserveCase",1,this._state.preserveCase)},!1)}isFindInputFocused(){return!!wxe.getValue(this._contextKeyService)}wasReplaceInputLastFocused(){return!1}focusLastElement(){}getState(){return this._state}closeFindWidget(){this._state.change({isRevealed:!1,searchScope:null},!1),this._editor.focus()}toggleCaseSensitive(){this._state.change({matchCase:!this._state.matchCase},!1),this._state.isRevealed||this.highlightFindOptions()}toggleWholeWords(){this._state.change({wholeWord:!this._state.wholeWord},!1),this._state.isRevealed||this.highlightFindOptions()}toggleRegex(){this._state.change({isRegex:!this._state.isRegex},!1),this._state.isRevealed||this.highlightFindOptions()}togglePreserveCase(){this._state.change({preserveCase:!this._state.preserveCase},!1),this._state.isRevealed||this.highlightFindOptions()}toggleSearchScope(){if(this._state.searchScope)this._state.change({searchScope:null},!0);else if(this._editor.hasModel()){let i=this._editor.getSelections();i=i.map(e=>(e.endColumn===1&&e.endLineNumber>e.startLineNumber&&(e=e.setEndPosition(e.endLineNumber-1,this._editor.getModel().getLineMaxColumn(e.endLineNumber-1))),e.isEmpty()?null:e)).filter(e=>!!e),i.length&&this._state.change({searchScope:i},!0)}}setSearchString(i){this._state.isRegex&&(i=ns(i)),this._state.change({searchString:i},!1)}highlightFindOptions(i=!1){}async _start(i,e){if(this.disposeModel(),!this._editor.hasModel())return;let t={...e,isRevealed:!0};if(i.seedSearchStringFromSelection==="single"){let o=YY(this._editor,i.seedSearchStringFromSelection,i.seedSearchStringFromNonEmptySelection);o&&(this._state.isRegex?t.searchString=ns(o):t.searchString=o)}else if(i.seedSearchStringFromSelection==="multiple"&&!i.updateSearchScope){let o=YY(this._editor,i.seedSearchStringFromSelection);o&&(t.searchString=o)}if(!t.searchString&&i.seedSearchStringFromGlobalClipboard){let o=await this.getGlobalBufferTerm();if(!this._editor.hasModel())return;o&&(t.searchString=o)}if(i.forceRevealReplace||t.isReplaceRevealed?t.isReplaceRevealed=!0:this._findWidgetVisible.get()||(t.isReplaceRevealed=!1),i.updateSearchScope){let o=this._editor.getSelections();o.some(n=>!n.isEmpty())&&(t.searchScope=o)}t.loop=i.loop,this._state.change(t,!1),this._model||(this._model=new ICt(this._editor,this._state))}start(i,e){return this._start(i,e)}moveToNextMatch(){return this._model?(this._model.moveToNextMatch(),!0):!1}moveToPrevMatch(){return this._model?(this._model.moveToPrevMatch(),!0):!1}goToMatch(i){return this._model?(this._model.moveToMatch(i),!0):!1}replace(){return this._model?(this._model.replace(),!0):!1}replaceAll(){return this._model?this._editor.getModel()?.isTooLargeForHeapOperation()?(this._notificationService.warn(d(1114,null)),!1):(this._model.replaceAll(),!0):!1}selectAllMatches(){return this._model?(this._model.selectAllMatches(),this._editor.focus(),!0):!1}async getGlobalBufferTerm(){return this._editor.getOption(50).globalFindClipboard&&this._editor.hasModel()&&!this._editor.getModel().isTooLargeForSyncing()?this._clipboardService.readFindText():""}setGlobalBufferTerm(i){this._editor.getOption(50).globalFindClipboard&&this._editor.hasModel()&&!this._editor.getModel().isTooLargeForSyncing()&&this._clipboardService.writeFindText(i)}};$f=I([m(1,X),m(2,ce),m(3,Fi),m(4,Ne),m(5,nt)],$f);var e8e=class extends $f{constructor(e,t,o,n,r,s,l,c,u,p){super(e,o,s,l,r,c);this._contextViewService=t;this._keybindingService=n;this._configurationService=u;this._accessibilityService=p;this._widget=null,this._findOptionsWidget=null,this._findWidgetSearchHistory=q_.getOrCreate(s),this._replaceWidgetHistory=$_.getOrCreate(s)}async _start(e,t){this._widget||this._createFindWidget();let o=this._editor.getSelection(),n=!1;switch(this._editor.getOption(50).autoFindInSelection){case"always":n=!0;break;case"never":n=!1;break;case"multiline":{n=!!o&&o.startLineNumber!==o.endLineNumber;break}default:break}e.updateSearchScope=e.updateSearchScope||n,await super._start(e,t),this._widget&&(e.shouldFocus===2?this._widget.focusReplaceInput():e.shouldFocus===1&&this._widget.focusFindInput())}highlightFindOptions(e=!1){this._widget||this._createFindWidget(),this._state.isRevealed&&!e?this._widget.highlightFindOptions():this._findOptionsWidget.highlightFindOptions()}_createFindWidget(){this._widget=this._register(new ECt(this._editor,this,this._state,this._contextViewService,this._keybindingService,this._contextKeyService,this._hoverService,this._findWidgetSearchHistory,this._replaceWidgetHistory,this._configurationService,this._accessibilityService)),this._findOptionsWidget=this._register(new Bxt(this._editor,this._state,this._keybindingService))}wasReplaceInputLastFocused(){return this._widget?.lastFocusedInputWasReplace??!1}focusLastElement(){this._widget?.focusLastElement()}saveViewState(){return this._widget?.getViewState()}restoreViewState(e){this._widget?.setViewState(e)}};e8e=I([m(1,Wn),m(2,X),m(3,_e),m(4,Ne),m(5,ce),m(6,Fi),m(7,nt),m(8,B),m(9,Oi)],e8e);var Xli=Y$e(new wae({id:xd.StartFindAction,label:L(1110,"Find"),precondition:C.or(pe.focus,C.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2084,weight:100},menuOpts:{menuId:D.MenubarEditMenu,group:"3_find",title:d(1106,null),order:1}}));Xli.addImplementation(0,(a,i,e)=>{let t=$f.get(i);return t?t.start({forceRevealReplace:!1,seedSearchStringFromSelection:i.getOption(50).seedSearchStringFromSelection!=="never"?"single":"none",seedSearchStringFromNonEmptySelection:i.getOption(50).seedSearchStringFromSelection==="selection",seedSearchStringFromGlobalClipboard:i.getOption(50).globalFindClipboard,shouldFocus:1,shouldAnimate:!0,updateSearchScope:!1,loop:i.getOption(50).loop}):!1});var oKo={description:"Open a new In-Editor Find Widget.",args:[{name:"Open a new In-Editor Find Widget args",schema:{properties:{searchString:{type:"string"},replaceString:{type:"string"},isRegex:{type:"boolean"},matchWholeWord:{type:"boolean"},isCaseSensitive:{type:"boolean"},preserveCase:{type:"boolean"},findInSelection:{type:"boolean"}}}}]},qli=class extends Di{constructor(){super({id:xd.StartFindWithArgs,label:L(1111,"Find with Arguments"),precondition:void 0,kbOpts:{kbExpr:null,primary:0,weight:100},metadata:oKo})}async run(i,e,t){let o=$f.get(e);if(o){let n=t?{searchString:t.searchString,replaceString:t.replaceString,isReplaceRevealed:t.replaceString!==void 0,isRegex:t.isRegex,wholeWord:t.matchWholeWord,matchCase:t.isCaseSensitive,preserveCase:t.preserveCase}:{};await o.start({forceRevealReplace:!1,seedSearchStringFromSelection:o.getState().searchString.length===0&&e.getOption(50).seedSearchStringFromSelection!=="never"?"single":"none",seedSearchStringFromNonEmptySelection:e.getOption(50).seedSearchStringFromSelection==="selection",seedSearchStringFromGlobalClipboard:!0,shouldFocus:1,shouldAnimate:!0,updateSearchScope:t?.findInSelection||!1,loop:e.getOption(50).loop},n),o.setGlobalBufferTerm(o.getState().searchString)}}},$li=class extends Di{constructor(){super({id:xd.StartFindWithSelection,label:L(1112,"Find with Selection"),precondition:void 0,kbOpts:{kbExpr:null,primary:0,mac:{primary:2083},weight:100}})}async run(i,e){let t=$f.get(e);t&&(await t.start({forceRevealReplace:!1,seedSearchStringFromSelection:"multiple",seedSearchStringFromNonEmptySelection:!1,seedSearchStringFromGlobalClipboard:!1,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:e.getOption(50).loop}),t.setGlobalBufferTerm(t.getState().searchString))}};async function H7i(a,i){let e=$f.get(a);if(!e)return;let t=a.getOption(50).closeOnResult,o=e.getState().isRevealed,n=()=>{let r=e.editor.getSelection(),s=i?e.moveToNextMatch():e.moveToPrevMatch(),l=!1;if(s){let c=e.editor.getSelection();(!r&&c||r&&c&&!r.equalsSelection(c))&&(l=!0)}return l?(e.editor.pushUndoStop(),t&&o&&e.isFindInputFocused()&&e.closeFindWidget(),!0):!1};if(!n()&&(await e.start({forceRevealReplace:!1,seedSearchStringFromSelection:e.getState().searchString.length===0&&a.getOption(50).seedSearchStringFromSelection!=="never"?"single":"none",seedSearchStringFromNonEmptySelection:a.getOption(50).seedSearchStringFromSelection==="selection",seedSearchStringFromGlobalClipboard:!0,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:a.getOption(50).loop}),!n())){let r=e.getState();o&&r.matchesCount===0&&r.searchString&&en(d(1099,null,Kz,r.searchString))}}var Jli=Y$e(new wae({id:xd.NextMatchFindAction,label:L(1104,"Find Next"),precondition:void 0,kbOpts:[{kbExpr:pe.focus,primary:61,mac:{primary:2085,secondary:[61]},weight:100},{kbExpr:C.and(pe.focus,wxe),primary:3,weight:100}]}));Jli.addImplementation(0,async(a,i,e)=>H7i(i,!0));var Zli=Y$e(new wae({id:xd.PreviousMatchFindAction,label:L(1105,"Find Previous"),precondition:void 0,kbOpts:[{kbExpr:pe.focus,primary:1085,mac:{primary:3109,secondary:[1085]},weight:100},{kbExpr:C.and(pe.focus,wxe),primary:1027,weight:100}]}));Zli.addImplementation(0,async(a,i,e)=>H7i(i,!1));var jli=class extends Di{constructor(){super({id:xd.GoToMatchFindAction,label:L(1100,"Go to Match..."),precondition:UE});this._highlightDecorations=[]}run(e,t){let o=$f.get(t);if(!o)return;let n=o.getState().matchesCount;if(n<1){e.get(Ne).notify({severity:ft.Warning,message:d(1103,null)});return}let r=e.get(Ue),s=new N,l=s.add(r.createInputBox());l.placeholder=d(1101,null,n);let c=p=>{let h=parseInt(p);if(isNaN(h))return;let g=o.getState().matchesCount;if(h>0&&h<=g)return h-1;if(h<0&&h>=-g)return g+h},u=p=>{let h=c(p);if(typeof h=="number"){l.validationMessage=void 0,o.goToMatch(h);let g=o.getState().currentMatch;g&&this.addDecorations(t,g)}else l.validationMessage=d(1102,null,o.getState().matchesCount),this.clearDecorations(t)};s.add(l.onDidChangeValue(p=>{u(p)})),s.add(l.onDidAccept(()=>{let p=c(l.value);typeof p=="number"?(o.goToMatch(p),l.hide()):l.validationMessage=d(1102,null,o.getState().matchesCount)})),s.add(l.onDidHide(()=>{this.clearDecorations(t),s.dispose()})),l.show()}clearDecorations(e){e.changeDecorations(t=>{this._highlightDecorations=t.deltaDecorations(this._highlightDecorations,[])})}addDecorations(e,t){e.changeDecorations(o=>{this._highlightDecorations=o.deltaDecorations(this._highlightDecorations,[{range:t,options:{description:"find-match-quick-access-range-highlight",className:"rangeHighlight",isWholeLine:!0}},{range:t,options:{description:"find-match-quick-access-range-highlight-overview",overviewRuler:{color:Xs(Iwe),position:7}}}])})}},Uxt=class extends Di{async run(i,e){let t=$f.get(e);if(!t)return;let o=YY(e,"single",!1);o&&t.setSearchString(o),this._run(t)||(await t.start({forceRevealReplace:!1,seedSearchStringFromSelection:"none",seedSearchStringFromNonEmptySelection:!1,seedSearchStringFromGlobalClipboard:!1,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:e.getOption(50).loop}),this._run(t))}},Qli=class extends Uxt{constructor(){super({id:xd.NextSelectionMatchFindAction,label:L(1108,"Find Next Selection"),precondition:void 0,kbOpts:{kbExpr:pe.focus,primary:2109,weight:100}})}_run(i){return i.moveToNextMatch()}},Yli=class extends Uxt{constructor(){super({id:xd.PreviousSelectionMatchFindAction,label:L(1109,"Find Previous Selection"),precondition:void 0,kbOpts:{kbExpr:pe.focus,primary:3133,weight:100}})}_run(i){return i.moveToPrevMatch()}},eci=Y$e(new wae({id:xd.StartFindReplaceAction,label:L(1113,"Replace"),precondition:C.or(pe.focus,C.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2086,mac:{primary:2596},weight:100},menuOpts:{menuId:D.MenubarEditMenu,group:"3_find",title:d(1107,null),order:2}}));eci.addImplementation(0,(a,i,e)=>{if(!i.hasModel()||i.getOption(104))return!1;let t=$f.get(i);if(!t)return!1;let o=i.getSelection(),n=t.isFindInputFocused(),r=!o.isEmpty()&&o.startLineNumber===o.endLineNumber&&i.getOption(50).seedSearchStringFromSelection!=="never"&&!n,s=n||r?2:1;return t.start({forceRevealReplace:!0,seedSearchStringFromSelection:r?"single":"none",seedSearchStringFromNonEmptySelection:i.getOption(50).seedSearchStringFromSelection==="selection",seedSearchStringFromGlobalClipboard:i.getOption(50).seedSearchStringFromSelection!=="never",shouldFocus:s,shouldAnimate:!0,updateSearchScope:!1,loop:i.getOption(50).loop})});xo($f.ID,e8e,0);ni(qli);ni($li);ni(jli);ni(Qli);ni(Yli);var rB=Oc.bindToContribution($f.get);Xi(new rB({id:xd.CloseFindWidgetCommand,precondition:UE,handler:a=>a.closeFindWidget(),kbOpts:{weight:105,kbExpr:C.and(pe.focus,C.not("isComposing")),primary:9,secondary:[1033]}}));Xi(new rB({id:xd.ToggleCaseSensitiveCommand,precondition:void 0,handler:a=>a.toggleCaseSensitive(),kbOpts:{weight:105,kbExpr:pe.focus,primary:l5.primary,mac:l5.mac,win:l5.win,linux:l5.linux}}));Xi(new rB({id:xd.ToggleWholeWordCommand,precondition:void 0,handler:a=>a.toggleWholeWords(),kbOpts:{weight:105,kbExpr:pe.focus,primary:c5.primary,mac:c5.mac,win:c5.win,linux:c5.linux}}));Xi(new rB({id:xd.ToggleRegexCommand,precondition:void 0,handler:a=>a.toggleRegex(),kbOpts:{weight:105,kbExpr:pe.focus,primary:d5.primary,mac:d5.mac,win:d5.win,linux:d5.linux}}));Xi(new rB({id:xd.ToggleSearchScopeCommand,precondition:void 0,handler:a=>a.toggleSearchScope(),kbOpts:{weight:105,kbExpr:pe.focus,primary:h3e.primary,mac:h3e.mac,win:h3e.win,linux:h3e.linux}}));Xi(new rB({id:xd.TogglePreserveCaseCommand,precondition:void 0,handler:a=>a.togglePreserveCase(),kbOpts:{weight:105,kbExpr:pe.focus,primary:Cce.primary,mac:Cce.mac,win:Cce.win,linux:Cce.linux}}));Xi(new rB({id:xd.ReplaceOneAction,precondition:UE,handler:a=>a.replace(),kbOpts:{weight:105,kbExpr:pe.focus,primary:3094}}));Xi(new rB({id:xd.ReplaceOneAction,precondition:UE,handler:a=>a.replace(),kbOpts:{weight:105,kbExpr:C.and(pe.focus,m3e,pe.isComposing.negate()),primary:3}}));Xi(new rB({id:xd.ReplaceAllAction,precondition:UE,handler:a=>a.replaceAll(),kbOpts:{weight:105,kbExpr:pe.focus,primary:2563}}));Xi(new rB({id:xd.ReplaceAllAction,precondition:UE,handler:a=>a.replaceAll(),kbOpts:{weight:105,kbExpr:C.and(pe.focus,m3e),primary:void 0,mac:{primary:2051}}}));Xi(new rB({id:xd.SelectAllMatchesAction,precondition:UE,handler:a=>a.selectAllMatches(),kbOpts:{weight:105,kbExpr:pe.focus,primary:515}}));var nKo={0:" ",1:"u",2:"r"},U7i=65535,UP=16777215,z7i=4278190080,t8e=class{constructor(i){let e=Math.ceil(i/32);this._states=new Uint32Array(e)}get(i){let e=i/32|0,t=i%32;return(this._states[e]&1<<t)!==0}set(i,e){let t=i/32|0,o=i%32,n=this._states[t];e?this._states[t]=n|1<<o:this._states[t]=n&~(1<<o)}},ay=class a{constructor(i,e,t){if(i.length!==e.length||i.length>U7i)throw new Error("invalid startIndexes or endIndexes size");this._startIndexes=i,this._endIndexes=e,this._collapseStates=new t8e(i.length),this._userDefinedStates=new t8e(i.length),this._recoveredStates=new t8e(i.length),this._types=t,this._parentsComputed=!1}ensureParentIndices(){if(!this._parentsComputed){this._parentsComputed=!0;let i=[],e=(t,o)=>{let n=i[i.length-1];return this.getStartLineNumber(n)<=t&&this.getEndLineNumber(n)>=o};for(let t=0,o=this._startIndexes.length;t<o;t++){let n=this._startIndexes[t],r=this._endIndexes[t];if(n>UP||r>UP)throw new Error("startLineNumber or endLineNumber must not exceed "+UP);for(;i.length>0&&!e(n,r);)i.pop();let s=i.length>0?i[i.length-1]:-1;i.push(t),this._startIndexes[t]=n+((s&255)<<24),this._endIndexes[t]=r+((s&65280)<<16)}}}get length(){return this._startIndexes.length}getStartLineNumber(i){return this._startIndexes[i]&UP}getEndLineNumber(i){return this._endIndexes[i]&UP}getType(i){return this._types?this._types[i]:void 0}hasTypes(){return!!this._types}isCollapsed(i){return this._collapseStates.get(i)}setCollapsed(i,e){this._collapseStates.set(i,e)}isUserDefined(i){return this._userDefinedStates.get(i)}setUserDefined(i,e){return this._userDefinedStates.set(i,e)}isRecovered(i){return this._recoveredStates.get(i)}setRecovered(i,e){return this._recoveredStates.set(i,e)}getSource(i){return this.isUserDefined(i)?1:this.isRecovered(i)?2:0}setSource(i,e){e===1?(this.setUserDefined(i,!0),this.setRecovered(i,!1)):e===2?(this.setUserDefined(i,!1),this.setRecovered(i,!0)):(this.setUserDefined(i,!1),this.setRecovered(i,!1))}setCollapsedAllOfType(i,e){let t=!1;if(this._types)for(let o=0;o<this._types.length;o++)this._types[o]===i&&(this.setCollapsed(o,e),t=!0);return t}toRegion(i){return new tci(this,i)}getParentIndex(i){this.ensureParentIndices();let e=((this._startIndexes[i]&z7i)>>>24)+((this._endIndexes[i]&z7i)>>>16);return e===U7i?-1:e}contains(i,e){return this.getStartLineNumber(i)<=e&&this.getEndLineNumber(i)>=e}findIndex(i){let e=0,t=this._startIndexes.length;if(t===0)return-1;for(;e<t;){let o=Math.floor((e+t)/2);i<this.getStartLineNumber(o)?t=o:e=o+1}return e-1}findRange(i){let e=this.findIndex(i);if(e>=0){if(this.getEndLineNumber(e)>=i)return e;for(e=this.getParentIndex(e);e!==-1;){if(this.contains(e,i))return e;e=this.getParentIndex(e)}}return-1}toString(){let i=[];for(let e=0;e<this.length;e++)i[e]=`[${nKo[this.getSource(e)]}${this.isCollapsed(e)?"+":"-"}] ${this.getStartLineNumber(e)}/${this.getEndLineNumber(e)}`;return i.join(", ")}toFoldRange(i){return{startLineNumber:this._startIndexes[i]&UP,endLineNumber:this._endIndexes[i]&UP,type:this._types?this._types[i]:void 0,isCollapsed:this.isCollapsed(i),source:this.getSource(i)}}static fromFoldRanges(i){let e=i.length,t=new Uint32Array(e),o=new Uint32Array(e),n=[],r=!1;for(let l=0;l<e;l++){let c=i[l];t[l]=c.startLineNumber,o[l]=c.endLineNumber,n.push(c.type),c.type&&(r=!0)}r||(n=void 0);let s=new a(t,o,n);for(let l=0;l<e;l++)i[l].isCollapsed&&s.setCollapsed(l,!0),s.setSource(l,i[l].source);return s}static sanitizeAndMerge(i,e,t,o){t=t??Number.MAX_VALUE;let n=(b,S)=>Array.isArray(b)?(y=>y<S?b[y]:void 0):(y=>y<S?b.toFoldRange(y):void 0),r=n(i,i.length),s=n(e,e.length),l=0,c=0,u=r(0),p=s(0),h=[],g,f=0,v=[];for(;u||p;){let b;if(p&&(!u||u.startLineNumber>=p.startLineNumber))u&&u.startLineNumber===p.startLineNumber?(p.source===1?b=p:(b=u,b.isCollapsed=p.isCollapsed&&(u.endLineNumber===p.endLineNumber||!o?.startsInside(u.startLineNumber+1,u.endLineNumber+1)),b.source=0),u=r(++l)):(b=p,p.isCollapsed&&p.source===0&&(b.source=2)),p=s(++c);else{let S=c,y=p;for(;;){if(!y||y.startLineNumber>u.endLineNumber){b=u;break}if(y.source===1&&y.endLineNumber>u.endLineNumber)break;y=s(++S)}u=r(++l)}if(b){for(;g&&g.endLineNumber<b.startLineNumber;)g=h.pop();b.endLineNumber>b.startLineNumber&&b.startLineNumber>f&&b.endLineNumber<=t&&(!g||g.endLineNumber>=b.endLineNumber)&&(v.push(b),f=b.startLineNumber,g&&h.push(g),g=b)}}return v}},tci=class{constructor(i,e){this.ranges=i;this.index=e}get startLineNumber(){return this.ranges.getStartLineNumber(this.index)}get endLineNumber(){return this.ranges.getEndLineNumber(this.index)}get regionIndex(){return this.index}get parentIndex(){return this.ranges.getParentIndex(this.index)}get isCollapsed(){return this.ranges.isCollapsed(this.index)}containedBy(i){return i.startLineNumber<=this.startLineNumber&&i.endLineNumber>=this.endLineNumber}containsLine(i){return this.startLineNumber<=i&&i<=this.endLineNumber}hidesLine(i){return this.startLineNumber<i&&i<=this.endLineNumber}};var zxt=class{constructor(i,e){this._updateEventEmitter=new E;this.onDidChange=this._updateEventEmitter.event;this._textModel=i,this._decorationProvider=e,this._regions=new ay(new Uint32Array(0),new Uint32Array(0)),this._editorDecorationIds=[]}get regions(){return this._regions}get textModel(){return this._textModel}get decorationProvider(){return this._decorationProvider}toggleCollapseState(i){if(!i.length)return;i=i.sort((t,o)=>t.regionIndex-o.regionIndex);let e={};this._decorationProvider.changeDecorations(t=>{let o=0,n=-1,r=-1,s=l=>{for(;o<l;){let c=this._regions.getEndLineNumber(o),u=this._regions.isCollapsed(o);if(c<=n){let p=this.regions.getSource(o)!==0;t.changeDecorationOptions(this._editorDecorationIds[o],this._decorationProvider.getDecorationOption(u,c<=r,p))}u&&c>r&&(r=c),o++}};for(let l of i){let c=l.regionIndex,u=this._editorDecorationIds[c];if(u&&!e[u]){e[u]=!0,s(c);let p=!this._regions.isCollapsed(c);this._regions.setCollapsed(c,p),n=Math.max(n,this._regions.getEndLineNumber(c))}}s(this._regions.length)}),this._updateEventEmitter.fire({model:this,collapseStateChanged:i})}removeManualRanges(i){let e=new Array,t=o=>{for(let n of i)if(!(n.startLineNumber>o.endLineNumber||o.startLineNumber>n.endLineNumber))return!0;return!1};for(let o=0;o<this._regions.length;o++){let n=this._regions.toFoldRange(o);(n.source===0||!t(n))&&e.push(n)}this.updatePost(ay.fromFoldRanges(e))}update(i,e){let t=this._currentFoldedOrManualRanges(e),o=ay.sanitizeAndMerge(i,t,this._textModel.getLineCount(),e);this.updatePost(ay.fromFoldRanges(o))}updatePost(i){let e=[],t=-1;for(let o=0,n=i.length;o<n;o++){let r=i.getStartLineNumber(o),s=i.getEndLineNumber(o),l=i.isCollapsed(o),c=i.getSource(o)!==0,u={startLineNumber:r,startColumn:this._textModel.getLineMaxColumn(r),endLineNumber:s,endColumn:this._textModel.getLineMaxColumn(s)+1};e.push({range:u,options:this._decorationProvider.getDecorationOption(l,s<=t,c)}),l&&s>t&&(t=s)}this._decorationProvider.changeDecorations(o=>this._editorDecorationIds=o.deltaDecorations(this._editorDecorationIds,e)),this._regions=i,this._updateEventEmitter.fire({model:this})}_currentFoldedOrManualRanges(i){let e=[];for(let t=0,o=this._regions.length;t<o;t++){let n=this.regions.isCollapsed(t),r=this.regions.getSource(t);if(n||r!==0){let s=this._regions.toFoldRange(t),l=this._textModel.getDecorationRange(this._editorDecorationIds[t]);l&&(n&&i?.startsInside(l.startLineNumber+1,l.endLineNumber)&&(n=!1),e.push({startLineNumber:l.startLineNumber,endLineNumber:l.endLineNumber,type:s.type,isCollapsed:n,source:r}))}}return e}getMemento(){let i=this._currentFoldedOrManualRanges(),e=[],t=this._textModel.getLineCount();for(let o=0,n=i.length;o<n;o++){let r=i[o];if(r.startLineNumber>=r.endLineNumber||r.startLineNumber<1||r.endLineNumber>t)continue;let s=this._getLinesChecksum(r.startLineNumber+1,r.endLineNumber);e.push({startLineNumber:r.startLineNumber,endLineNumber:r.endLineNumber,isCollapsed:r.isCollapsed,source:r.source,checksum:s})}return e.length>0?e:void 0}applyMemento(i){if(!Array.isArray(i))return;let e=[],t=this._textModel.getLineCount();for(let n of i){if(n.startLineNumber>=n.endLineNumber||n.startLineNumber<1||n.endLineNumber>t)continue;let r=this._getLinesChecksum(n.startLineNumber+1,n.endLineNumber);(!n.checksum||r===n.checksum)&&e.push({startLineNumber:n.startLineNumber,endLineNumber:n.endLineNumber,type:void 0,isCollapsed:n.isCollapsed??!0,source:n.source??0})}let o=ay.sanitizeAndMerge(this._regions,e,t);this.updatePost(ay.fromFoldRanges(o))}_getLinesChecksum(i,e){return _r(this._textModel.getLineContent(i)+this._textModel.getLineContent(e))%1e6}dispose(){this._decorationProvider.removeDecorations(this._editorDecorationIds),this._updateEventEmitter.dispose()}getAllRegionsAtLine(i,e){let t=[];if(this._regions){let o=this._regions.findRange(i),n=1;for(;o>=0;){let r=this._regions.toRegion(o);(!e||e(r,n))&&t.push(r),n++,o=r.parentIndex}}return t}getRegionAtLine(i){if(this._regions){let e=this._regions.findRange(i);if(e>=0)return this._regions.toRegion(e)}return null}getRegionsInside(i,e){let t=[],o=i?i.regionIndex+1:0,n=i?i.endLineNumber:Number.MAX_VALUE;if(e&&e.length===2){let r=[];for(let s=o,l=this._regions.length;s<l;s++){let c=this._regions.toRegion(s);if(this._regions.getStartLineNumber(s)<n){for(;r.length>0&&!c.containedBy(r[r.length-1]);)r.pop();r.push(c),e(c,r.length)&&t.push(c)}else break}}else for(let r=o,s=this._regions.length;r<s;r++){let l=this._regions.toRegion(r);if(this._regions.getStartLineNumber(r)<n)(!e||e(l))&&t.push(l);else break}return t}};function i8e(a,i,e){let t=[];for(let o of e){let n=a.getRegionAtLine(o);if(n){let r=!n.isCollapsed;if(t.push(n),i>1){let s=a.getRegionsInside(n,(l,c)=>l.isCollapsed!==r&&c<i);t.push(...s)}}}a.toggleCollapseState(t)}function Vce(a,i,e=Number.MAX_VALUE,t){let o=[];if(t&&t.length>0)for(let n of t){let r=a.getRegionAtLine(n);if(r&&(r.isCollapsed!==i&&o.push(r),e>1)){let s=a.getRegionsInside(r,(l,c)=>l.isCollapsed!==i&&c<e);o.push(...s)}}else{let n=a.getRegionsInside(null,(r,s)=>r.isCollapsed!==i&&s<e);o.push(...n)}a.toggleCollapseState(o)}function ici(a,i,e,t){let o=[];for(let n of t){let r=a.getAllRegionsAtLine(n,(s,l)=>s.isCollapsed!==i&&l<=e);o.push(...r)}a.toggleCollapseState(o)}function K7i(a,i,e){let t=[];for(let o of e){let n=a.getAllRegionsAtLine(o,r=>r.isCollapsed!==i);n.length>0&&t.push(n[0])}a.toggleCollapseState(t)}function G7i(a,i,e,t){let o=(r,s)=>s===i&&r.isCollapsed!==e&&!t.some(l=>r.containsLine(l)),n=a.getRegionsInside(null,o);a.toggleCollapseState(n)}function oci(a,i,e){let t=[];for(let r of e){let s=a.getAllRegionsAtLine(r,void 0);s.length>0&&t.push(s[0])}let o=r=>t.every(s=>!s.containedBy(r)&&!r.containedBy(s))&&r.isCollapsed!==i,n=a.getRegionsInside(null,o);a.toggleCollapseState(n)}function Kxt(a,i,e){let t=a.textModel,o=a.regions,n=[];for(let r=o.length-1;r>=0;r--)if(e!==o.isCollapsed(r)){let s=o.getStartLineNumber(r);i.test(t.getLineContent(s))&&n.push(o.toRegion(r))}a.toggleCollapseState(n)}function Gxt(a,i,e){let t=a.regions,o=[];for(let n=t.length-1;n>=0;n--)e!==t.isCollapsed(n)&&i===t.getType(n)&&o.push(t.toRegion(n));a.toggleCollapseState(o)}function q7i(a,i){let e=null,t=i.getRegionAtLine(a);if(t!==null&&(e=t.startLineNumber,a===e)){let o=t.parentIndex;o!==-1?e=i.regions.getStartLineNumber(o):e=null}return e}function $7i(a,i){let e=i.getRegionAtLine(a);if(e!==null&&e.startLineNumber===a){if(a!==e.startLineNumber)return e.startLineNumber;{let t=e.parentIndex,o=0;for(t!==-1&&(o=i.regions.getStartLineNumber(e.parentIndex));e!==null;)if(e.regionIndex>0){if(e=i.regions.toRegion(e.regionIndex-1),e.startLineNumber<=o)return null;if(e.parentIndex===t)return e.startLineNumber}else return null}}else if(i.regions.length>0)for(e=i.regions.toRegion(i.regions.length-1);e!==null;){if(e.startLineNumber<a)return e.startLineNumber;e.regionIndex>0?e=i.regions.toRegion(e.regionIndex-1):e=null}return null}function j7i(a,i){let e=i.getRegionAtLine(a);if(e!==null&&e.startLineNumber===a){let t=e.parentIndex,o=0;if(t!==-1)o=i.regions.getEndLineNumber(e.parentIndex);else{if(i.regions.length===0)return null;o=i.regions.getEndLineNumber(i.regions.length-1)}for(;e!==null;)if(e.regionIndex<i.regions.length){if(e=i.regions.toRegion(e.regionIndex+1),e.startLineNumber>=o)return null;if(e.parentIndex===t)return e.startLineNumber}else return null}else if(i.regions.length>0)for(e=i.regions.toRegion(0);e!==null;){if(e.startLineNumber>a)return e.startLineNumber;e.regionIndex<i.regions.length?e=i.regions.toRegion(e.regionIndex+1):e=null}return null}var qxt=class{constructor(i){this._updateEventEmitter=new E;this._hasLineChanges=!1;this._foldingModel=i,this._foldingModelListener=i.onDidChange(e=>this.updateHiddenRanges()),this._hiddenRanges=[],i.regions.length&&this.updateHiddenRanges()}get onDidChange(){return this._updateEventEmitter.event}get hiddenRanges(){return this._hiddenRanges}notifyChangeModelContent(i){this._hiddenRanges.length&&!this._hasLineChanges&&(this._hasLineChanges=i.changes.some(e=>e.range.endLineNumber!==e.range.startLineNumber||ZS(e.text)[0]!==0))}updateHiddenRanges(){let i=!1,e=[],t=0,o=0,n=Number.MAX_VALUE,r=-1,s=this._foldingModel.regions;for(;t<s.length;t++){if(!s.isCollapsed(t))continue;let l=s.getStartLineNumber(t)+1,c=s.getEndLineNumber(t);n<=l&&c<=r||(!i&&o<this._hiddenRanges.length&&this._hiddenRanges[o].startLineNumber===l&&this._hiddenRanges[o].endLineNumber===c?(e.push(this._hiddenRanges[o]),o++):(i=!0,e.push(new z(l,1,c,1))),n=l,r=c)}(this._hasLineChanges||i||o<this._hiddenRanges.length)&&this.applyHiddenRanges(e)}applyHiddenRanges(i){this._hiddenRanges=i,this._hasLineChanges=!1,this._updateEventEmitter.fire(i)}hasRanges(){return this._hiddenRanges.length>0}isHidden(i){return Q7i(this._hiddenRanges,i)!==null}adjustSelections(i){let e=!1,t=this._foldingModel.textModel,o=null,n=r=>((!o||!sKo(r,o))&&(o=Q7i(this._hiddenRanges,r)),o?o.startLineNumber-1:null);for(let r=0,s=i.length;r<s;r++){let l=i[r],c=n(l.startLineNumber);c&&(l=l.setStartPosition(c,t.getLineMaxColumn(c)),e=!0);let u=n(l.endLineNumber);u&&(l=l.setEndPosition(u,t.getLineMaxColumn(u)),e=!0),i[r]=l}return e}dispose(){this.hiddenRanges.length>0&&(this._hiddenRanges=[],this._updateEventEmitter.fire(this._hiddenRanges)),this._foldingModelListener&&(this._foldingModelListener.dispose(),this._foldingModelListener=null),this._updateEventEmitter.dispose()}};function sKo(a,i){return a>=i.startLineNumber&&a<=i.endLineNumber}function Q7i(a,i){let e=Ky(a,t=>i<t.startLineNumber)-1;return e>=0&&a[e].endLineNumber>=i?a[e]:null}var aKo=5e3,lKo="indent",Bce=class{constructor(i,e,t){this.editorModel=i;this.languageConfigurationService=e;this.foldingRangesLimit=t;this.id=lKo}dispose(){}compute(i){let e=this.languageConfigurationService.getLanguageConfiguration(this.editorModel.getLanguageId()).foldingRules,t=e&&!!e.offSide,o=e&&e.markers;return Promise.resolve(dKo(this.editorModel,t,o,this.foldingRangesLimit))}},nci=class{constructor(i){this._startIndexes=[],this._endIndexes=[],this._indentOccurrences=[],this._length=0,this._foldingRangesLimit=i}insertFirst(i,e,t){if(i>UP||e>UP)return;let o=this._length;this._startIndexes[o]=i,this._endIndexes[o]=e,this._length++,t<1e3&&(this._indentOccurrences[t]=(this._indentOccurrences[t]||0)+1)}toIndentRanges(i){let e=this._foldingRangesLimit.limit;if(this._length<=e){this._foldingRangesLimit.update(this._length,!1);let t=new Uint32Array(this._length),o=new Uint32Array(this._length);for(let n=this._length-1,r=0;n>=0;n--,r++)t[r]=this._startIndexes[n],o[r]=this._endIndexes[n];return new ay(t,o)}else{this._foldingRangesLimit.update(this._length,e);let t=0,o=this._indentOccurrences.length;for(let l=0;l<this._indentOccurrences.length;l++){let c=this._indentOccurrences[l];if(c){if(c+t>e){o=l;break}t+=c}}let n=i.getOptions().tabSize,r=new Uint32Array(e),s=new Uint32Array(e);for(let l=this._length-1,c=0;l>=0;l--){let u=this._startIndexes[l],p=i.getLineContent(u),h=kj(p,n);(h<o||h===o&&t++<e)&&(r[c]=u,s[c]=this._endIndexes[l],c++)}return new ay(r,s)}}},cKo={limit:aKo,update:()=>{}};function dKo(a,i,e,t=cKo){let o=a.getOptions().tabSize,n=new nci(t),r;e&&(r=new RegExp(`(${e.start.source})|(?:${e.end.source})`));let s=[],l=a.getLineCount()+1;s.push({indent:-1,endAbove:l,line:l});for(let c=a.getLineCount();c>0;c--){let u=a.getLineContent(c),p=kj(u,o),h=s[s.length-1];if(p===-1){i&&(h.endAbove=c);continue}let g;if(r&&(g=u.match(r)))if(g[1]){let f=s.length-1;for(;f>0&&s[f].indent!==-2;)f--;if(f>0){s.length=f+1,h=s[f],n.insertFirst(c,h.line,p),h.line=c,h.indent=p,h.endAbove=c;continue}}else{s.push({indent:-2,endAbove:c,line:c});continue}if(h.indent>p){do s.pop(),h=s[s.length-1];while(h.indent>p);let f=h.endAbove-1;f-c>=1&&n.insertFirst(c,f,p)}h.indent===p?h.endAbove=c:s.push({indent:p,endAbove:c,line:c})}return n.toIndentRanges(a)}var uKo=te("editor.foldBackground",{light:ai(Sv,.3),dark:ai(Sv,.3),hcDark:null,hcLight:null},d(1166,null),!0);te("editor.foldPlaceholderForeground",{light:"#808080",dark:"#808080",hcDark:null,hcLight:null},d(1164,null));te("editorGutter.foldingControlForeground",cj,d(1165,null));var Hce=Ae("folding-expanded",R.chevronDown,d(1168,null)),Uce=Ae("folding-collapsed",R.chevronRight,d(1167,null)),Y7i=Ae("folding-manual-collapsed",Uce,d(1169,null)),X7i=Ae("folding-manual-expanded",Hce,d(1170,null)),rci={color:Xs(uKo),position:1},Jxe=d(1171,null),$xt=d(1172,null),jxt=class a{constructor(i){this.editor=i;this.showFoldingControls="mouseover";this.showFoldingHighlights=!0}static{this.COLLAPSED_VISUAL_DECORATION=mo.register({description:"folding-collapsed-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,linesDecorationsTooltip:Jxe,firstLineDecorationClassName:q.asClassName(Uce)})}static{this.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=mo.register({description:"folding-collapsed-highlighted-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:rci,isWholeLine:!0,linesDecorationsTooltip:Jxe,firstLineDecorationClassName:q.asClassName(Uce)})}static{this.MANUALLY_COLLAPSED_VISUAL_DECORATION=mo.register({description:"folding-manually-collapsed-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,linesDecorationsTooltip:Jxe,firstLineDecorationClassName:q.asClassName(Y7i)})}static{this.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=mo.register({description:"folding-manually-collapsed-highlighted-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:rci,isWholeLine:!0,linesDecorationsTooltip:Jxe,firstLineDecorationClassName:q.asClassName(Y7i)})}static{this.NO_CONTROLS_COLLAPSED_RANGE_DECORATION=mo.register({description:"folding-no-controls-range-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,linesDecorationsTooltip:Jxe})}static{this.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION=mo.register({description:"folding-no-controls-range-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:rci,isWholeLine:!0,linesDecorationsTooltip:Jxe})}static{this.EXPANDED_VISUAL_DECORATION=mo.register({description:"folding-expanded-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+q.asClassName(Hce),linesDecorationsTooltip:$xt})}static{this.EXPANDED_AUTO_HIDE_VISUAL_DECORATION=mo.register({description:"folding-expanded-auto-hide-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:q.asClassName(Hce),linesDecorationsTooltip:$xt})}static{this.MANUALLY_EXPANDED_VISUAL_DECORATION=mo.register({description:"folding-manually-expanded-visual-decoration",stickiness:0,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+q.asClassName(X7i),linesDecorationsTooltip:$xt})}static{this.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION=mo.register({description:"folding-manually-expanded-auto-hide-visual-decoration",stickiness:0,isWholeLine:!0,firstLineDecorationClassName:q.asClassName(X7i),linesDecorationsTooltip:$xt})}static{this.NO_CONTROLS_EXPANDED_RANGE_DECORATION=mo.register({description:"folding-no-controls-range-decoration",stickiness:0,isWholeLine:!0})}static{this.HIDDEN_RANGE_DECORATION=mo.register({description:"folding-hidden-range-decoration",stickiness:1})}getDecorationOption(i,e,t){return e?a.HIDDEN_RANGE_DECORATION:this.showFoldingControls==="never"?i?this.showFoldingHighlights?a.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION:a.NO_CONTROLS_COLLAPSED_RANGE_DECORATION:a.NO_CONTROLS_EXPANDED_RANGE_DECORATION:i?t?this.showFoldingHighlights?a.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:a.MANUALLY_COLLAPSED_VISUAL_DECORATION:this.showFoldingHighlights?a.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:a.COLLAPSED_VISUAL_DECORATION:this.showFoldingControls==="mouseover"?t?a.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION:a.EXPANDED_AUTO_HIDE_VISUAL_DECORATION:t?a.MANUALLY_EXPANDED_VISUAL_DECORATION:a.EXPANDED_VISUAL_DECORATION}changeDecorations(i){return this.editor.changeDecorations(i)}removeDecorations(i){this.editor.removeDecorations(i)}};var pKo={},mKo="syntax",zce=class{constructor(i,e,t,o,n){this.editorModel=i;this.providers=e;this.handleFoldingRangesChange=t;this.foldingRangesLimit=o;this.fallbackRangeProvider=n;this.id=mKo;this.disposables=new N,n&&this.disposables.add(n);for(let r of e)typeof r.onDidChange=="function"&&this.disposables.add(r.onDidChange(t))}compute(i){return hKo(this.providers,this.editorModel,i).then(e=>this.editorModel.isDisposed()?null:e?aci(e,this.foldingRangesLimit):this.fallbackRangeProvider?.compute(i)??null)}dispose(){this.disposables.dispose()}};function hKo(a,i,e){let t=null,o=a.map((n,r)=>Promise.resolve(n.provideFoldingRanges(i,pKo,e)).then(s=>{if(!e.isCancellationRequested&&Array.isArray(s)){Array.isArray(t)||(t=[]);let l=i.getLineCount();for(let c of s)c.start>0&&c.end>c.start&&c.end<=l&&t.push({start:c.start,end:c.end,rank:r,kind:c.kind})}},ys));return Promise.all(o).then(n=>t)}var sci=class{constructor(i){this._startIndexes=[],this._endIndexes=[],this._nestingLevels=[],this._nestingLevelCounts=[],this._types=[],this._length=0,this._foldingRangesLimit=i}add(i,e,t,o){if(i>UP||e>UP)return;let n=this._length;this._startIndexes[n]=i,this._endIndexes[n]=e,this._nestingLevels[n]=o,this._types[n]=t,this._length++,o<30&&(this._nestingLevelCounts[o]=(this._nestingLevelCounts[o]||0)+1)}toIndentRanges(){let i=this._foldingRangesLimit.limit;if(this._length<=i){this._foldingRangesLimit.update(this._length,!1);let e=new Uint32Array(this._length),t=new Uint32Array(this._length);for(let o=0;o<this._length;o++)e[o]=this._startIndexes[o],t[o]=this._endIndexes[o];return new ay(e,t,this._types)}else{this._foldingRangesLimit.update(this._length,i);let e=0,t=this._nestingLevelCounts.length;for(let s=0;s<this._nestingLevelCounts.length;s++){let l=this._nestingLevelCounts[s];if(l){if(l+e>i){t=s;break}e+=l}}let o=new Uint32Array(i),n=new Uint32Array(i),r=[];for(let s=0,l=0;s<this._length;s++){let c=this._nestingLevels[s];(c<t||c===t&&e++<i)&&(o[l]=this._startIndexes[s],n[l]=this._endIndexes[s],r[l]=this._types[s],l++)}return new ay(o,n,r)}}};function aci(a,i){let e=a.sort((r,s)=>{let l=r.start-s.start;return l===0&&(l=r.rank-s.rank),l}),t=new sci(i),o,n=[];for(let r of e)if(!o)o=r,t.add(r.start,r.end,r.kind&&r.kind.value,n.length);else if(r.start>o.start)if(r.end<=o.end)n.push(o),o=r,t.add(r.start,r.end,r.kind&&r.kind.value,n.length);else{if(r.start>o.end){do o=n.pop();while(o&&r.start>o.end);o&&n.push(o),o=r}t.add(r.start,r.end,r.kind&&r.kind.value,n.length)}return t.toIndentRanges()}var sI=new Y("foldingEnabled",!1),gf=class extends x{constructor(e,t,o,n,r,s){super();this.contextKeyService=t;this.languageConfigurationService=o;this.languageFeaturesService=s;this.localToDispose=this._register(new N);this.editor=e,this._foldingLimitReporter=this._register(new o8e(e));let l=this.editor.getOptions();this._isEnabled=l.get(52),this._useFoldingProviders=l.get(53)!=="indentation",this._unfoldOnClickAfterEndOfLine=l.get(57),this._restoringViewState=!1,this._currentModelHasFoldedImports=!1,this._foldingImportsByDefault=l.get(55),this.updateDebounceInfo=r.for(s.foldingRangeProvider,"Folding",{min:200}),this.foldingModel=null,this.hiddenRangeModel=null,this.rangeProvider=null,this.foldingRegionPromise=null,this.foldingModelPromise=null,this.updateScheduler=null,this.cursorChangedScheduler=null,this.mouseDownInfo=null,this.foldingDecorationProvider=new jxt(e),this.foldingDecorationProvider.showFoldingControls=l.get(126),this.foldingDecorationProvider.showFoldingHighlights=l.get(54),this.foldingEnabled=sI.bindTo(this.contextKeyService),this.foldingEnabled.set(this._isEnabled),this._register(this.editor.onDidChangeModel(()=>this.onModelChanged())),this._register(this.editor.onDidChangeConfiguration(c=>{if(c.hasChanged(52)&&(this._isEnabled=this.editor.getOptions().get(52),this.foldingEnabled.set(this._isEnabled),this.onModelChanged()),c.hasChanged(56)&&this.onModelChanged(),c.hasChanged(126)||c.hasChanged(54)){let u=this.editor.getOptions();this.foldingDecorationProvider.showFoldingControls=u.get(126),this.foldingDecorationProvider.showFoldingHighlights=u.get(54),this.triggerFoldingModelChanged()}c.hasChanged(53)&&(this._useFoldingProviders=this.editor.getOptions().get(53)!=="indentation",this.onFoldingStrategyChanged()),c.hasChanged(57)&&(this._unfoldOnClickAfterEndOfLine=this.editor.getOptions().get(57)),c.hasChanged(55)&&(this._foldingImportsByDefault=this.editor.getOptions().get(55))})),this.onModelChanged()}static{this.ID="editor.contrib.folding"}static get(e){return e.getContribution(gf.ID)}static getFoldingRangeProviders(e,t){let o=e.foldingRangeProvider.ordered(t);return gf._foldingRangeSelector?.(o,t)??o}static setFoldingRangeProviderSelector(e){return gf._foldingRangeSelector=e,{dispose:()=>{gf._foldingRangeSelector=void 0}}}get limitReporter(){return this._foldingLimitReporter}saveViewState(){let e=this.editor.getModel();if(!e||!this._isEnabled||e.isTooLargeForTokenization())return{};if(this.foldingModel){let t=this.foldingModel.getMemento(),o=this.rangeProvider?this.rangeProvider.id:void 0;return{collapsedRegions:t,lineCount:e.getLineCount(),provider:o,foldedImports:this._currentModelHasFoldedImports}}}restoreViewState(e){let t=this.editor.getModel();if(!(!t||!this._isEnabled||t.isTooLargeForTokenization()||!this.hiddenRangeModel)&&e&&(this._currentModelHasFoldedImports=!!e.foldedImports,e.collapsedRegions&&e.collapsedRegions.length>0&&this.foldingModel)){this._restoringViewState=!0;try{this.foldingModel.applyMemento(e.collapsedRegions)}finally{this._restoringViewState=!1}}}onModelChanged(){this.localToDispose.clear();let e=this.editor.getModel();!this._isEnabled||!e||e.isTooLargeForTokenization()||(this._currentModelHasFoldedImports=!1,this.foldingModel=new zxt(e,this.foldingDecorationProvider),this.localToDispose.add(this.foldingModel),this.hiddenRangeModel=new qxt(this.foldingModel),this.localToDispose.add(this.hiddenRangeModel),this.localToDispose.add(this.hiddenRangeModel.onDidChange(t=>this.onHiddenRangesChanges(t))),this.updateScheduler=new Xo(this.updateDebounceInfo.get(e)),this.localToDispose.add(this.updateScheduler),this.cursorChangedScheduler=new Dt(()=>this.revealCursor(),200),this.localToDispose.add(this.cursorChangedScheduler),this.localToDispose.add(this.languageFeaturesService.foldingRangeProvider.onDidChange(()=>this.onFoldingStrategyChanged())),this.localToDispose.add(this.editor.onDidChangeModelLanguageConfiguration(()=>this.onFoldingStrategyChanged())),this.localToDispose.add(this.editor.onDidChangeModelContent(t=>this.onDidChangeModelContent(t))),this.localToDispose.add(this.editor.onDidChangeCursorPosition(()=>this.onCursorPositionChanged())),this.localToDispose.add(this.editor.onMouseDown(t=>this.onEditorMouseDown(t))),this.localToDispose.add(this.editor.onMouseUp(t=>this.onEditorMouseUp(t))),this.localToDispose.add({dispose:()=>{this.foldingRegionPromise&&(this.foldingRegionPromise.cancel(),this.foldingRegionPromise=null),this.updateScheduler?.cancel(),this.updateScheduler=null,this.foldingModel=null,this.foldingModelPromise=null,this.hiddenRangeModel=null,this.cursorChangedScheduler=null,this.rangeProvider?.dispose(),this.rangeProvider=null}}),this.triggerFoldingModelChanged())}onFoldingStrategyChanged(){this.rangeProvider?.dispose(),this.rangeProvider=null,this.triggerFoldingModelChanged()}getRangeProvider(e){if(this.rangeProvider)return this.rangeProvider;let t=new Bce(e,this.languageConfigurationService,this._foldingLimitReporter);if(this.rangeProvider=t,this._useFoldingProviders&&this.foldingModel){let o=gf.getFoldingRangeProviders(this.languageFeaturesService,e);o.length>0&&(this.rangeProvider=new zce(e,o,()=>this.triggerFoldingModelChanged(),this._foldingLimitReporter,t))}return this.rangeProvider}getFoldingModel(){return this.foldingModelPromise}onDidChangeModelContent(e){this.hiddenRangeModel?.notifyChangeModelContent(e),this.triggerFoldingModelChanged()}triggerFoldingModelChanged(){this.updateScheduler&&(this.foldingRegionPromise&&(this.foldingRegionPromise.cancel(),this.foldingRegionPromise=null),this.foldingModelPromise=this.updateScheduler.trigger(()=>{let e=this.foldingModel;if(!e)return null;let t=new Dn,o=this.getRangeProvider(e.textModel),n=this.foldingRegionPromise=Ln(r=>o.compute(r));return n.then(r=>{if(r&&n===this.foldingRegionPromise){let s;if(this._foldingImportsByDefault&&!this._currentModelHasFoldedImports){let u=r.setCollapsedAllOfType(IE.Imports.value,!0);u&&(s=DC.capture(this.editor),this._currentModelHasFoldedImports=u)}let l=this.editor.getSelections();e.update(r,gKo(l)),s?.restore(this.editor);let c=this.updateDebounceInfo.update(e.textModel,t.elapsed());this.updateScheduler&&(this.updateScheduler.defaultDelay=c)}return e})}).then(void 0,e=>(mt(e),null)))}onHiddenRangesChanges(e){if(this.hiddenRangeModel&&e.length&&!this._restoringViewState){let t=this.editor.getSelections();t&&this.hiddenRangeModel.adjustSelections(t)&&this.editor.setSelections(t)}this.editor.setHiddenAreas(e,this)}onCursorPositionChanged(){this.hiddenRangeModel&&this.hiddenRangeModel.hasRanges()&&this.cursorChangedScheduler.schedule()}revealCursor(){let e=this.getFoldingModel();e&&e.then(t=>{if(t){let o=this.editor.getSelections();if(o&&o.length>0){let n=[];for(let r of o){let s=r.selectionStartLineNumber;this.hiddenRangeModel&&this.hiddenRangeModel.isHidden(s)&&n.push(...t.getAllRegionsAtLine(s,l=>l.isCollapsed&&s>l.startLineNumber))}n.length&&(t.toggleCollapseState(n),this.reveal(o[0].getPosition()))}}}).then(void 0,mt)}onEditorMouseDown(e){if(this.mouseDownInfo=null,!this.hiddenRangeModel||!e.target||!e.target.range||!e.event.leftButton&&!e.event.middleButton)return;let t=e.target.range,o=!1;switch(e.target.type){case 4:{let n=e.target.detail,r=e.target.element.offsetLeft;if(n.offsetX-r<4)return;o=!0;break}case 7:{if(this._unfoldOnClickAfterEndOfLine&&this.hiddenRangeModel.hasRanges()&&!e.target.detail.isAfterLines)break;return}case 6:{if(this.hiddenRangeModel.hasRanges()){let n=this.editor.getModel();if(n&&t.startColumn===n.getLineMaxColumn(t.startLineNumber))break}return}default:return}this.mouseDownInfo={lineNumber:t.startLineNumber,iconClicked:o}}onEditorMouseUp(e){let t=this.foldingModel;if(!t||!this.mouseDownInfo||!e.target)return;let o=this.mouseDownInfo.lineNumber,n=this.mouseDownInfo.iconClicked,r=e.target.range;if(!r||r.startLineNumber!==o)return;if(n){if(e.target.type!==4)return}else{let l=this.editor.getModel();if(!l||r.startColumn!==l.getLineMaxColumn(o))return}let s=t.getRegionAtLine(o);if(s&&s.startLineNumber===o){let l=s.isCollapsed;if(n||l){let c=e.event.altKey,u=[];if(c){let p=g=>!g.containedBy(s)&&!s.containedBy(g),h=t.getRegionsInside(null,p);for(let g of h)g.isCollapsed&&u.push(g);u.length===0&&(u=h)}else{let p=e.event.middleButton||e.event.shiftKey;if(p)for(let h of t.getRegionsInside(s))h.isCollapsed===l&&u.push(h);(l||!p||u.length===0)&&u.push(s)}t.toggleCollapseState(u),this.reveal({lineNumber:o,column:1})}}}reveal(e){this.editor.revealPositionInCenterIfOutsideViewport(e,0)}};gf=I([m(1,X),m(2,Rs),m(3,Ne),m(4,hf),m(5,Qt)],gf);var o8e=class extends x{constructor(e){super();this.editor=e;this._onDidChange=this._register(new E);this._computed=0;this._limited=!1}get limit(){return this.editor.getOptions().get(56)}get onDidChange(){return this._onDidChange.event}get computed(){return this._computed}get limited(){return this._limited}update(e,t){(e!==this._computed||t!==this._limited)&&(this._computed=e,this._limited=t,this._onDidChange.fire())}},mS=class extends Di{runEditorCommand(i,e,t){let o=i.get(Rs),n=gf.get(e);if(!n)return;let r=n.getFoldingModel();if(r)return this.reportTelemetry(i,e),r.then(s=>{if(s){this.invoke(n,s,e,t,o);let l=e.getSelection();l&&n.reveal(l.getStartPosition())}})}getSelectedLines(i){let e=i.getSelections();return e?e.map(t=>t.startLineNumber):[]}getLineNumbers(i,e){return i&&i.selectionLines?i.selectionLines.map(t=>t+1):this.getSelectedLines(e)}run(i,e){}};function gKo(a){return!a||a.length===0?{startsInside:()=>!1}:{startsInside(i,e){for(let t of a){let o=t.startLineNumber;if(o>=i&&o<=e)return!0}return!1}}}function J7i(a){if(!gn(a)){if(!xi(a))return!1;let i=a;if(!gn(i.levels)&&!Yo(i.levels)||!gn(i.direction)&&!Fe(i.direction)||!gn(i.selectionLines)&&(!Array.isArray(i.selectionLines)||!i.selectionLines.every(Yo)))return!1}return!0}var lci=class extends mS{constructor(){super({id:"editor.unfold",label:L(1159,"Unfold"),precondition:sI,kbOpts:{kbExpr:pe.editorTextFocus,primary:3166,mac:{primary:2654},weight:100},metadata:{description:"Unfold the content in the editor",args:[{name:"Unfold editor argument",description:`Property-value pairs that can be passed through this argument:
						* 'levels': Number of levels to unfold. If not set, defaults to 1.
						* 'direction': If 'up', unfold given number of levels up otherwise unfolds down.
						* 'selectionLines': Array of the start lines (0-based) of the editor selections to apply the unfold action to. If not set, the active selection(s) will be used.
						`,constraint:J7i,schema:{type:"object",properties:{levels:{type:"number",default:1},direction:{type:"string",enum:["up","down"],default:"down"},selectionLines:{type:"array",items:{type:"number"}}}}}]}})}invoke(i,e,t,o){let n=o&&o.levels||1,r=this.getLineNumbers(o,t);o&&o.direction==="up"?ici(e,!1,n,r):Vce(e,!1,n,r)}},cci=class extends mS{constructor(){super({id:"editor.unfoldRecursively",label:L(1163,"Unfold Recursively"),precondition:sI,kbOpts:{kbExpr:pe.editorTextFocus,primary:Vi(2089,2142),weight:100}})}invoke(i,e,t,o){Vce(e,!1,Number.MAX_VALUE,this.getSelectedLines(t))}},dci=class extends mS{constructor(){super({id:"editor.fold",label:L(1145,"Fold"),precondition:sI,kbOpts:{kbExpr:pe.editorTextFocus,primary:3164,mac:{primary:2652},weight:100},metadata:{description:"Fold the content in the editor",args:[{name:"Fold editor argument",description:`Property-value pairs that can be passed through this argument:
							* 'levels': Number of levels to fold.
							* 'direction': If 'up', folds given number of levels up otherwise folds down.
							* 'selectionLines': Array of the start lines (0-based) of the editor selections to apply the fold action to. If not set, the active selection(s) will be used.
							If no levels or direction is set, folds the region at the locations or if already collapsed, the first uncollapsed parent instead.
						`,constraint:J7i,schema:{type:"object",properties:{levels:{type:"number"},direction:{type:"string",enum:["up","down"]},selectionLines:{type:"array",items:{type:"number"}}}}}]}})}invoke(i,e,t,o){let n=this.getLineNumbers(o,t),r=o&&o.levels,s=o&&o.direction;typeof r!="number"&&typeof s!="string"?K7i(e,!0,n):s==="up"?ici(e,!0,r||1,n):Vce(e,!0,r||1,n)}},uci=class extends mS{constructor(){super({id:"editor.toggleFold",label:L(1156,"Toggle Fold"),precondition:sI,kbOpts:{kbExpr:pe.editorTextFocus,primary:Vi(2089,2090),weight:100}})}invoke(i,e,t){let o=this.getSelectedLines(t);i8e(e,1,o)}},pci=class extends mS{constructor(){super({id:"editor.foldRecursively",label:L(1151,"Fold Recursively"),precondition:sI,kbOpts:{kbExpr:pe.editorTextFocus,primary:Vi(2089,2140),weight:100}})}invoke(i,e,t){let o=this.getSelectedLines(t);Vce(e,!0,Number.MAX_VALUE,o)}},mci=class extends mS{constructor(){super({id:"editor.toggleFoldRecursively",label:L(1157,"Toggle Fold Recursively"),precondition:sI,kbOpts:{kbExpr:pe.editorTextFocus,primary:Vi(2089,3114),weight:100}})}invoke(i,e,t){let o=this.getSelectedLines(t);i8e(e,Number.MAX_VALUE,o)}},hci=class extends mS{constructor(){super({id:"editor.foldAllBlockComments",label:L(1147,"Fold All Block Comments"),precondition:sI,kbOpts:{kbExpr:pe.editorTextFocus,primary:Vi(2089,2138),weight:100}})}invoke(i,e,t,o,n){if(e.regions.hasTypes())Gxt(e,IE.Comment.value,!0);else{let r=t.getModel();if(!r)return;let s=n.getLanguageConfiguration(r.getLanguageId()).comments;if(s&&s.blockCommentStartToken){let l=new RegExp("^\\s*"+ns(s.blockCommentStartToken));Kxt(e,l,!0)}}}},gci=class extends mS{constructor(){super({id:"editor.foldAllMarkerRegions",label:L(1149,"Fold All Regions"),precondition:sI,kbOpts:{kbExpr:pe.editorTextFocus,primary:Vi(2089,2077),weight:100}})}invoke(i,e,t,o,n){if(e.regions.hasTypes())Gxt(e,IE.Region.value,!0);else{let r=t.getModel();if(!r)return;let s=n.getLanguageConfiguration(r.getLanguageId()).foldingRules;if(s&&s.markers&&s.markers.start){let l=new RegExp(s.markers.start);Kxt(e,l,!0)}}}},fci=class extends mS{constructor(){super({id:"editor.unfoldAllMarkerRegions",label:L(1162,"Unfold All Regions"),precondition:sI,kbOpts:{kbExpr:pe.editorTextFocus,primary:Vi(2089,2078),weight:100}})}invoke(i,e,t,o,n){if(e.regions.hasTypes())Gxt(e,IE.Region.value,!1);else{let r=t.getModel();if(!r)return;let s=n.getLanguageConfiguration(r.getLanguageId()).foldingRules;if(s&&s.markers&&s.markers.start){let l=new RegExp(s.markers.start);Kxt(e,l,!1)}}}},vci=class extends mS{constructor(){super({id:"editor.foldAllExcept",label:L(1148,"Fold All Except Selected"),precondition:sI,kbOpts:{kbExpr:pe.editorTextFocus,primary:Vi(2089,2136),weight:100}})}invoke(i,e,t){let o=this.getSelectedLines(t);oci(e,!0,o)}},bci=class extends mS{constructor(){super({id:"editor.unfoldAllExcept",label:L(1161,"Unfold All Except Selected"),precondition:sI,kbOpts:{kbExpr:pe.editorTextFocus,primary:Vi(2089,2134),weight:100}})}invoke(i,e,t){let o=this.getSelectedLines(t);oci(e,!1,o)}},Sci=class extends mS{constructor(){super({id:"editor.foldAll",label:L(1146,"Fold All"),precondition:sI,kbOpts:{kbExpr:pe.editorTextFocus,primary:Vi(2089,2069),weight:100}})}invoke(i,e,t){Vce(e,!0)}},Ici=class extends mS{constructor(){super({id:"editor.unfoldAll",label:L(1160,"Unfold All"),precondition:sI,kbOpts:{kbExpr:pe.editorTextFocus,primary:Vi(2089,2088),weight:100}})}invoke(i,e,t){Vce(e,!1)}},Qxt=class a extends mS{static{this.ID_PREFIX="editor.foldLevel"}static{this.ID=i=>a.ID_PREFIX+i}getFoldingLevel(){return parseInt(this.id.substr(a.ID_PREFIX.length))}invoke(i,e,t){G7i(e,this.getFoldingLevel(),!0,this.getSelectedLines(t))}},yci=class extends mS{constructor(){super({id:"editor.gotoParentFold",label:L(1153,"Go to Parent Fold"),precondition:sI,kbOpts:{kbExpr:pe.editorTextFocus,weight:100}})}invoke(i,e,t){let o=this.getSelectedLines(t);if(o.length>0){let n=q7i(o[0],e);n!==null&&t.setSelection({startLineNumber:n,startColumn:1,endLineNumber:n,endColumn:1})}}},wci=class extends mS{constructor(){super({id:"editor.gotoPreviousFold",label:L(1154,"Go to Previous Folding Range"),precondition:sI,kbOpts:{kbExpr:pe.editorTextFocus,weight:100}})}invoke(i,e,t){let o=this.getSelectedLines(t);if(o.length>0){let n=$7i(o[0],e);n!==null&&t.setSelection({startLineNumber:n,startColumn:1,endLineNumber:n,endColumn:1})}}},Cci=class extends mS{constructor(){super({id:"editor.gotoNextFold",label:L(1152,"Go to Next Folding Range"),precondition:sI,kbOpts:{kbExpr:pe.editorTextFocus,weight:100}})}invoke(i,e,t){let o=this.getSelectedLines(t);if(o.length>0){let n=j7i(o[0],e);n!==null&&t.setSelection({startLineNumber:n,startColumn:1,endLineNumber:n,endColumn:1})}}},xci=class extends mS{constructor(){super({id:"editor.createFoldingRangeFromSelection",label:L(1144,"Create Folding Range from Selection"),precondition:sI,kbOpts:{kbExpr:pe.editorTextFocus,primary:Vi(2089,2135),weight:100}})}invoke(i,e,t){let o=[],n=t.getSelections();if(n){for(let r of n){let s=r.endLineNumber;r.endColumn===1&&--s,s>r.startLineNumber&&(o.push({startLineNumber:r.startLineNumber,endLineNumber:s,type:void 0,isCollapsed:!0,source:1}),t.setSelection({startLineNumber:r.startLineNumber,startColumn:1,endLineNumber:r.startLineNumber,endColumn:1}))}if(o.length>0){o.sort((s,l)=>s.startLineNumber-l.startLineNumber);let r=ay.sanitizeAndMerge(e.regions,o,t.getModel()?.getLineCount());e.updatePost(ay.fromFoldRanges(r))}}}},kci=class extends mS{constructor(){super({id:"editor.removeManualFoldingRanges",label:L(1155,"Remove Manual Folding Ranges"),precondition:sI,kbOpts:{kbExpr:pe.editorTextFocus,primary:Vi(2089,2137),weight:100}})}invoke(i,e,t){let o=t.getSelections();if(o){let n=[];for(let r of o){let{startLineNumber:s,endLineNumber:l}=r;n.push(l>=s?{startLineNumber:s,endLineNumber:l}:{endLineNumber:l,startLineNumber:s})}e.removeManualRanges(n),i.triggerFoldingModelChanged()}}},Eci=class extends mS{constructor(){super({id:"editor.toggleImportFold",label:L(1158,"Toggle Import Fold"),precondition:sI,kbOpts:{kbExpr:pe.editorTextFocus,weight:100}})}async invoke(i,e){let t=[],o=e.regions;for(let n=o.length-1;n>=0;n--)o.getType(n)===IE.Imports.value&&t.push(o.toRegion(n));e.toggleCollapseState(t),i.triggerFoldingModelChanged()}};xo(gf.ID,gf,0);ni(lci);ni(cci);ni(dci);ni(pci);ni(mci);ni(Sci);ni(Ici);ni(hci);ni(gci);ni(fci);ni(vci);ni(bci);ni(uci);ni(yci);ni(wci);ni(Cci);ni(xci);ni(kci);ni(Eci);for(let a=1;a<=7;a++)E$i(new Qxt({id:Qxt.ID(a),label:L(1150,"Fold Level {0}",a),precondition:sI,kbOpts:{kbExpr:pe.editorTextFocus,primary:Vi(2089,2048|21+a),weight:100}}));$e.registerCommand("_executeFoldingRangeProvider",async function(a,...i){let[e]=i;if(!(e instanceof A))throw Yr();let t=a.get(Qt),o=a.get(Tt).getModel(e);if(!o)throw Yr();let n=a.get(B);if(!n.getValue("editor.folding",{resource:e}))return[];let r=a.get(Rs),s=n.getValue("editor.foldingStrategy",{resource:e}),l={get limit(){return n.getValue("editor.foldingMaximumRegions",{resource:e})},update:(g,f)=>{}},c=new Bce(o,r,l),u=c;if(s!=="indentation"){let g=gf.getFoldingRangeProviders(t,o);g.length&&(u=new zce(o,g,()=>{},l,c))}let p=await u.compute(Se.None),h=[];try{if(p)for(let g=0;g<p.length;g++){let f=p.getType(g);h.push({start:p.getStartLineNumber(g),end:p.getEndLineNumber(g),kind:f?IE.fromValue(f):void 0})}return h}finally{u.dispose()}});var Tci=class extends Di{constructor(){super({id:"editor.action.fontZoomIn",label:L(1173,"Increase Editor Font Size"),precondition:void 0})}run(i,e){fE.setZoomLevel(fE.getZoomLevel()+1)}},_ci=class extends Di{constructor(){super({id:"editor.action.fontZoomOut",label:L(1174,"Decrease Editor Font Size"),precondition:void 0})}run(i,e){fE.setZoomLevel(fE.getZoomLevel()-1)}},Dci=class extends Di{constructor(){super({id:"editor.action.fontZoomReset",label:L(1175,"Reset Editor Font Size"),precondition:void 0})}run(i,e){fE.setZoomLevel(0)}};ni(Tci);ni(_ci);ni(Dci);var Kce=class a{static _handleEolEdits(i,e){let t,o=[];for(let n of e)typeof n.eol=="number"&&(t=n.eol),n.range&&typeof n.text=="string"&&o.push(n);return typeof t=="number"&&i.hasModel()&&i.getModel().pushEOL(t),o}static _isFullModelReplaceEdit(i,e){if(!i.hasModel())return!1;let t=i.getModel(),o=t.validateRange(e.range);return t.getFullModelRange().equalsRange(o)}static execute(i,e,t){t&&i.pushUndoStop();let o=DC.capture(i),n=a._handleEolEdits(i,e);n.length===1&&a._isFullModelReplaceEdit(i,n[0])?i.executeEdits("formatEditsCommand",n.map(r=>Hn.replace(z.lift(r.range),r.text))):i.executeEdits("formatEditsCommand",n.map(r=>Hn.replaceMove(z.lift(r.range),r.text))),t&&i.pushUndoStop(),o.restoreRelativeVerticalPositionOfCursor(i)}};function b5(a){return a.scheme===Q.vscodeRemote?a.authority:void 0}function gb(a){if(!a)return;let i=a.indexOf("+");return i<0?a:a.substr(0,i)}function Yxt(a){if(!a)return;let i=a.indexOf("+");if(!(i<0))return a.substring(i+1)}function Z7i(a){let{host:i,port:e}=fKo(a);if(typeof e>"u")throw new Error(`Invalid remote authority: ${a}. It must either be a remote of form <remoteName>+<arg> or a remote host of form <host>:<port>.`);return{host:i,port:e}}function fKo(a){let i=a.match(/^(\[[0-9a-z:]+\]):(\d+)$/);if(i)return{host:i[1],port:parseInt(i[2],10)};let e=a.match(/^(\[[0-9a-z:]+\])$/);if(e)return{host:e[1],port:void 0};let t=a.match(/(.*):(\d+)$/);return t?{host:t[1],port:parseInt(t[2],10)}:{host:a,port:void 0}}var eYi="extensions.user.cache",tYi="extensions.builtin.cache",Xxt="undefined_publisher",iYi=["ui","workspace","web"];function Gce(a){if(typeof a=="object"&&a!==null&&a.supported!==!0)return a.description}var cF=["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 Ii=class{constructor(i){this.value=i,this._lower=i.toLowerCase()}static equals(i,e){if(typeof i>"u"||i===null)return typeof e>"u"||e===null;if(typeof e>"u"||e===null)return!1;if(typeof i=="string"||typeof e=="string"){let t=typeof i=="string"?i:i.value,o=typeof e=="string"?e:e.value;return vr(t,o)}return i._lower===e._lower}static toKey(i){return typeof i=="string"?i.toLowerCase():i._lower}},ly=class{constructor(i){this._set=new Set;if(i)for(let e of i)this.add(e)}get size(){return this._set.size}add(i){this._set.add(Ii.toKey(i))}delete(i){return this._set.delete(Ii.toKey(i))}has(i){return this._set.has(Ii.toKey(i))}},iu=class{constructor(){this._map=new Map}clear(){this._map.clear()}delete(i){this._map.delete(Ii.toKey(i))}get(i){return this._map.get(Ii.toKey(i))}has(i){return this._map.has(Ii.toKey(i))}set(i,e){this._map.set(Ii.toKey(i),e)}values(){return this._map.values()}forEach(i){this._map.forEach(i)}[Symbol.iterator](){return this._map[Symbol.iterator]()}};function S5(a){return IR(a)}function IR(a){return a.contributes&&a.contributes.localizations?a.contributes.localizations.length>0:!1}function Lci(a){return a.contributes&&a.contributes.authentication?a.contributes.authentication.length>0:!1}function Zxe(a,i){if(i){let e=`onResolveRemoteAuthority:${gb(i)}`;return!!a.activationEvents?.includes(e)}return!1}function oYi(a){return a.map(i=>{let[e,t]=i.split("@");return{proposalName:e,version:t?parseInt(t):void 0}})}function nYi(a){return a.map(i=>i.split("@")[0])}var rYi=le("IBuiltinExtensionsScannerService");function eke(a,i,e){let t=[],o=new ly,n=a.ordered(e);for(let s of n)t.push(s),s.extensionId&&o.add(s.extensionId);let r=i.ordered(e);for(let s of r){if(s.extensionId){if(o.has(s.extensionId))continue;o.add(s.extensionId)}t.push({displayName:s.displayName,extensionId:s.extensionId,provideDocumentFormattingEdits(l,c,u){return s.provideDocumentRangeFormattingEdits(l,l.getFullModelRange(),c,u)}})}return t}var qce=class a{static{this._selectors=new qs}static setFormatterSelector(i){return{dispose:a._selectors.unshift(i)}}static async select(i,e,t,o){if(i.length===0)return;let n=vt.first(a._selectors);if(n)return await n(i,e,t,o)}};async function $ce(a,i,e,t,o,n,r){let s=a.get(F),{documentRangeFormattingEditProvider:l}=a.get(Qt),c=pn(i)?i.getModel():i,u=l.ordered(c),p=await qce.select(u,c,t,2);p&&(o.report(p),await s.invokeFunction(Rci,p,i,e,n,r))}async function Rci(a,i,e,t,o,n){let r=a.get(Qs),s=a.get(se),l=a.get(lr),c,u;pn(e)?(c=e.getModel(),u=new ek(e,5,void 0,o)):(c=e,u=new uce(e,o));let p=[],h=0;for(let S of cc(t).sort(z.compareRangesUsingStarts))h>0&&z.areIntersectingOrTouching(p[h-1],S)?p[h-1]=z.fromPositions(p[h-1].getStartPosition(),S.getEndPosition()):h=p.push(S);let g=async S=>{s.trace("[format][provideDocumentRangeFormattingEdits] (request)",i.extensionId?.value,S);let y=await i.provideDocumentRangeFormattingEdits(c,S,c.getFormattingOptions(),u.token)||[];return s.trace("[format][provideDocumentRangeFormattingEdits] (response)",i.extensionId?.value,y),y},f=(S,y)=>{if(!S.length||!y.length)return!1;let w=S.reduce((k,T)=>z.plusRange(k,T.range),S[0].range);if(!y.some(k=>z.intersectRanges(w,k.range)))return!1;for(let k of S)for(let T of y)if(z.intersectRanges(k.range,T.range))return!0;return!1},v=[],b=[];try{if(typeof i.provideDocumentRangesFormattingEdits=="function"){s.trace("[format][provideDocumentRangeFormattingEdits] (request)",i.extensionId?.value,p);let S=await i.provideDocumentRangesFormattingEdits(c,p,c.getFormattingOptions(),u.token)||[];s.trace("[format][provideDocumentRangeFormattingEdits] (response)",i.extensionId?.value,S),b.push(S)}else{for(let S of p){if(u.token.isCancellationRequested)return!0;b.push(await g(S))}for(let S=0;S<p.length;++S)for(let y=S+1;y<p.length;++y){if(u.token.isCancellationRequested)return!0;if(f(b[S],b[y])){let w=z.plusRange(p[S],p[y]),k=await g(w);p.splice(y,1),p.splice(S,1),p.push(w),b.splice(y,1),b.splice(S,1),b.push(k),S=0,y=0}}}for(let S of b){if(u.token.isCancellationRequested)return!0;let y=await r.computeMoreMinimalEdits(c.uri,S);y&&v.push(...y)}if(u.token.isCancellationRequested)return!0}finally{u.dispose()}if(v.length===0)return!1;if(pn(e))Kce.execute(e,v,!0),e.revealPositionInCenterIfOutsideViewport(e.getPosition(),1);else{let[{range:S}]=v,y=new ti(S.startLineNumber,S.startColumn,S.endLineNumber,S.endColumn);c.pushEditOperations([y],v.map(w=>({text:w.text,range:z.lift(w.range),forceMoveMarkers:!0})),w=>{for(let{range:k}of w)if(z.areIntersectingOrTouching(k,y))return[new ti(k.startLineNumber,k.startColumn,k.endLineNumber,k.endColumn)];return null})}return l.playSignal($o.format,{userGesture:n}),!0}async function jce(a,i,e,t,o,n){let r=a.get(F),s=a.get(Qt),l=pn(i)?i.getModel():i,c=eke(s.documentFormattingEditProvider,s.documentRangeFormattingEditProvider,l),u=await qce.select(c,l,e,1);u&&(t.report(u),await r.invokeFunction(Mci,u,i,e,o,n))}async function Mci(a,i,e,t,o,n){let r=a.get(Qs),s=a.get(lr),l,c;pn(e)?(l=e.getModel(),c=new ek(e,5,void 0,o)):(l=e,c=new uce(e,o));let u;try{let p=await i.provideDocumentFormattingEdits(l,l.getFormattingOptions(),c.token);if(u=await r.computeMoreMinimalEdits(l.uri,p),c.token.isCancellationRequested)return!0}finally{c.dispose()}if(!u||u.length===0)return!1;if(pn(e))Kce.execute(e,u,t!==2),t!==2&&e.revealPositionInCenterIfOutsideViewport(e.getPosition(),1);else{let[{range:p}]=u,h=new ti(p.startLineNumber,p.startColumn,p.endLineNumber,p.endColumn);l.pushEditOperations([h],u.map(g=>({text:g.text,range:z.lift(g.range),forceMoveMarkers:!0})),g=>{for(let{range:f}of g)if(z.areIntersectingOrTouching(f,h))return[new ti(f.startLineNumber,f.startColumn,f.endLineNumber,f.endColumn)];return null})}return s.playSignal($o.format,{userGesture:n}),!0}async function vKo(a,i,e,t,o,n){let r=i.documentRangeFormattingEditProvider.ordered(e);for(let s of r){let l=await Promise.resolve(s.provideDocumentRangeFormattingEdits(e,t,o,n)).catch(ys);if(yr(l))return await a.computeMoreMinimalEdits(e.uri,l)}}async function bKo(a,i,e,t,o){let n=eke(i.documentFormattingEditProvider,i.documentRangeFormattingEditProvider,e);for(let r of n){let s=await Promise.resolve(r.provideDocumentFormattingEdits(e,t,o)).catch(ys);if(yr(s))return await a.computeMoreMinimalEdits(e.uri,s)}}async function n8e(a,i,e,t,o){let n=pn(e)?e.getModel():e,r=eke(i.documentFormattingEditProvider,i.documentRangeFormattingEditProvider,n),s=await qce.select(r,n,t,1);if(s){let l=await Promise.resolve(s.provideDocumentFormattingEdits(n,n.getOptions(),o)).catch(ys);return await a.computeMoreMinimalEdits(n.uri,l)}}function Pci(a,i,e,t,o,n,r){let s=i.onTypeFormattingEditProvider.ordered(e);return s.length===0||s[0].autoFormatTriggerCharacters.indexOf(o)<0?Promise.resolve(void 0):Promise.resolve(s[0].provideOnTypeFormattingEdits(e,t,o,n,r)).catch(ys).then(l=>a.computeMoreMinimalEdits(e.uri,l))}function SKo(a){let i=a;return!!i&&typeof i=="object"&&typeof i.tabSize=="number"&&typeof i.insertSpaces=="boolean"}$e.registerCommand("_executeFormatRangeProvider",async function(a,...i){let[e,t,o]=i;wo(A.isUri(e)),wo(z.isIRange(t));let n=a.get(Bt),r=a.get(Qs),s=a.get(Qt),l=await n.createModelReference(e);try{return vKo(r,s,l.object.textEditorModel,z.lift(t),Aci(o,l),Se.None)}finally{l.dispose()}});$e.registerCommand("_executeFormatDocumentProvider",async function(a,...i){let[e,t]=i;wo(A.isUri(e));let o=a.get(Bt),n=a.get(Qs),r=a.get(Qt),s=await o.createModelReference(e);try{return bKo(n,r,s.object.textEditorModel,Aci(t,s),Se.None)}finally{s.dispose()}});$e.registerCommand("_executeFormatOnTypeProvider",async function(a,...i){let[e,t,o,n]=i;wo(A.isUri(e)),wo(ye.isIPosition(t)),wo(typeof o=="string");let r=a.get(Bt),s=a.get(Qs),l=a.get(Qt),c=await r.createModelReference(e);try{return Pci(s,l,c.object.textEditorModel,ye.lift(t),o,Aci(n,c),Se.None)}finally{c.dispose()}});function Aci(a,i){let e;if(SKo(a))e=a;else{let t=i.object.textEditorModel.getOptions();e={tabSize:t.tabSize,insertSpaces:t.insertSpaces}}return e}var XY=class{constructor(i,e,t,o){this._editor=i;this._languageFeaturesService=e;this._workerService=t;this._accessibilitySignalService=o;this._disposables=new N;this._sessionDisposables=new N;this._disposables.add(e.onTypeFormattingEditProvider.onDidChange(this._update,this)),this._disposables.add(i.onDidChangeModel(()=>this._update())),this._disposables.add(i.onDidChangeModelLanguage(()=>this._update())),this._disposables.add(i.onDidChangeConfiguration(n=>{n.hasChanged(65)&&this._update()})),this._update()}static{this.ID="editor.contrib.autoFormat"}dispose(){this._disposables.dispose(),this._sessionDisposables.dispose()}_update(){if(this._sessionDisposables.clear(),!this._editor.getOption(65)||!this._editor.hasModel())return;let i=this._editor.getModel(),[e]=this._languageFeaturesService.onTypeFormattingEditProvider.ordered(i);if(!e||!e.autoFormatTriggerCharacters)return;let t=new Z$;for(let o of e.autoFormatTriggerCharacters)t.add(o.charCodeAt(0));this._sessionDisposables.add(this._editor.onDidType(o=>{let n=o.charCodeAt(o.length-1);t.has(n)&&this._trigger(String.fromCharCode(n))}))}_trigger(i){if(!this._editor.hasModel()||this._editor.getSelections().length>1||!this._editor.getSelection().isEmpty())return;let e=this._editor.getModel(),t=this._editor.getPosition(),o=new Ye,n=this._editor.onDidChangeModelContent(r=>{if(r.isFlush){o.cancel(),n.dispose();return}for(let s=0,l=r.changes.length;s<l;s++)if(r.changes[s].range.endLineNumber<=t.lineNumber){o.cancel(),n.dispose();return}});Pci(this._workerService,this._languageFeaturesService,e,t,i,e.getFormattingOptions(),o.token).then(r=>{o.token.isCancellationRequested||yr(r)&&(this._accessibilitySignalService.playSignal($o.format,{userGesture:!1}),Kce.execute(this._editor,r,!0))}).finally(()=>{n.dispose()})}};XY=I([m(1,Qt),m(2,Qs),m(3,lr)],XY);var tke=class{constructor(i,e,t){this.editor=i;this._languageFeaturesService=e;this._instantiationService=t;this._callOnDispose=new N;this._callOnModel=new N;this._callOnDispose.add(i.onDidChangeConfiguration(()=>this._update())),this._callOnDispose.add(i.onDidChangeModel(()=>this._update())),this._callOnDispose.add(i.onDidChangeModelLanguage(()=>this._update())),this._callOnDispose.add(e.documentRangeFormattingEditProvider.onDidChange(this._update,this))}static{this.ID="editor.contrib.formatOnPaste"}dispose(){this._callOnDispose.dispose(),this._callOnModel.dispose()}_update(){this._callOnModel.clear(),this.editor.getOption(64)&&this.editor.hasModel()&&this._languageFeaturesService.documentRangeFormattingEditProvider.has(this.editor.getModel())&&this._callOnModel.add(this.editor.onDidPaste(({range:i})=>this._trigger(i)))}_trigger(i){this.editor.hasModel()&&(this.editor.getSelections().length>1||this._instantiationService.invokeFunction($ce,this.editor,i,2,Mm.None,Se.None,!1).catch(mt))}};tke=I([m(1,Qt),m(2,F)],tke);var Nci=class extends Di{constructor(){super({id:"editor.action.formatDocument",label:L(1176,"Format Document"),precondition:C.and(pe.notInCompositeEditor,pe.writable,pe.hasDocumentFormattingProvider),kbOpts:{kbExpr:pe.editorTextFocus,primary:1572,linux:{primary:3111},weight:100},contextMenuOpts:{group:"1_modification",order:1.3}})}async run(i,e){if(e.hasModel()){let t=i.get(F);await i.get(wd).showWhile(t.invokeFunction(jce,e,1,Mm.None,Se.None,!0),250)}}},Oci=class extends Di{constructor(){super({id:"editor.action.formatSelection",label:L(1177,"Format Selection"),precondition:C.and(pe.writable,pe.hasDocumentSelectionFormattingProvider),kbOpts:{kbExpr:pe.editorTextFocus,primary:Vi(2089,2084),weight:100},contextMenuOpts:{when:pe.hasNonEmptySelection,group:"1_modification",order:1.31}})}async run(i,e){if(!e.hasModel())return;let t=i.get(F),o=e.getModel(),n=e.getSelections().map(s=>s.isEmpty()?new z(s.startLineNumber,1,s.startLineNumber,o.getLineMaxColumn(s.startLineNumber)):s);await i.get(wd).showWhile(t.invokeFunction($ce,e,n,1,Mm.None,Se.None,!0),250)}};xo(XY.ID,XY,2);xo(tke.ID,tke,2);ni(Nci);ni(Oci);$e.registerCommand("editor.action.format",async a=>{let i=a.get(qt).getFocusedCodeEditor();if(!i||!i.hasModel())return;let e=a.get(ge);i.getSelection().isEmpty()?await e.executeCommand("editor.action.formatDocument"):await e.executeCommand("editor.action.formatSelection")});var yR=class a{remove(){this.parent?.children.delete(this.id)}static findId(i,e){let t;typeof i=="string"?t=`${e.id}/${i}`:(t=`${e.id}/${i.name}`,e.children.get(t)!==void 0&&(t=`${e.id}/${i.name}_${i.range.startLineNumber}_${i.range.startColumn}`));let o=t;for(let n=0;e.children.get(o)!==void 0;n++)o=`${t}_${n}`;return o}static getElementById(i,e){if(!i)return;let t=tf(i,e.id);if(t===i.length)return e;if(!(t<e.id.length))for(let[,o]of e.children){let n=a.getElementById(i,o);if(n)return n}}static size(i){let e=1;for(let[,t]of i.children)e+=a.size(t);return e}static empty(i){return i.children.size===0}},jf=class extends yR{constructor(e,t,o){super();this.id=e;this.parent=t;this.symbol=o;this.children=new Map}},kw=class extends yR{constructor(e,t,o,n){super();this.id=e;this.parent=t;this.label=o;this.order=n;this.children=new Map}getItemEnclosingPosition(e){return e?this._getItemEnclosingPosition(e,this.children):void 0}_getItemEnclosingPosition(e,t){for(let[,o]of t)if(!(!o.symbol.range||!z.containsPosition(o.symbol.range,e)))return this._getItemEnclosingPosition(e,o.children)||o}updateMarker(e){for(let[,t]of this.children)this._updateMarker(e,t)}_updateMarker(e,t){t.marker=void 0;let o=Px(e,t.symbol.range,z.compareRangesUsingStarts),n;o<0?(n=~o,n>0&&z.areIntersecting(e[n-1],t.symbol.range)&&(n-=1)):n=o;let r=[],s;for(;n<e.length&&z.areIntersecting(t.symbol.range,e[n]);n++){let l=e[n];r.push(l),e[n]=void 0,(!s||l.severity>s)&&(s=l.severity)}for(let[,l]of t.children)this._updateMarker(r,l);s&&(t.marker={count:r.length,topSev:s}),C$(e)}},dF=class a extends yR{constructor(e){super();this.uri=e;this.id="root";this.parent=void 0;this._groups=new Map;this.children=new Map;this.id="root",this.parent=void 0}static create(e,t,o){let n=new Ye(o),r=new a(t.uri),s=e.ordered(t),l=s.map((u,p)=>{let h=yR.findId(`provider_${p}`,r),g=new kw(h,r,u.displayName??"Unknown Outline Provider",p);return Promise.resolve(u.provideDocumentSymbols(t,n.token)).then(f=>{for(let v of f||[])a._makeOutlineElement(v,g);return g},f=>(ys(f),g)).then(f=>{yR.empty(f)?f.remove():r._groups.set(h,f)})}),c=e.onDidChange(()=>{let u=e.ordered(t);$i(u,s)||n.cancel()});return Promise.all(l).then(()=>n.token.isCancellationRequested&&!o.isCancellationRequested?a.create(e,t,o):r._compact()).finally(()=>{n.dispose(),c.dispose(),n.dispose()})}static _makeOutlineElement(e,t){let o=yR.findId(e,t),n=new jf(o,t,e);if(e.children)for(let r of e.children)a._makeOutlineElement(r,n);t.children.set(n.id,n)}static get(e){for(;e;){if(e instanceof a)return e;e=e.parent}}_compact(){let e=0;for(let[t,o]of this._groups)o.children.size===0?this._groups.delete(t):e+=1;if(e!==1)this.children=this._groups;else{let t=vt.first(this._groups.values());for(let[,o]of t.children)o.parent=this,this.children.set(o.id,o)}return this}merge(e){return this.uri.toString()!==e.uri.toString()||this._groups.size!==e._groups.size?!1:(this._groups=e._groups,this.children=e.children,!0)}getItemEnclosingPosition(e,t){let o;if(t){let r=t.parent;for(;r&&!o;)r instanceof kw&&(o=r),r=r.parent}let n;for(let[,r]of this._groups)if(n=r.getItemEnclosingPosition(e),n&&(!o||o===r))break;return n}getItemById(e){return yR.getElementById(e,this)}updateMarker(e){e.sort(z.compareRangesUsingStarts);for(let[,t]of this._groups)t.updateMarker(e.slice(0))}getTopLevelSymbols(){let e=[];for(let t of this.children.values())t instanceof jf?e.push(t.symbol):e.push(...vt.map(t.children.values(),o=>o.symbol));return e.sort((t,o)=>z.compareRangesUsingStarts(t.range,o.range))}asListOfDocumentSymbols(){let e=this.getTopLevelSymbols(),t=[];return a._flattenDocumentSymbols(t,e,""),t.sort((o,n)=>ye.compare(z.getStartPosition(o.range),z.getStartPosition(n.range))||ye.compare(z.getEndPosition(n.range),z.getEndPosition(o.range)))}static _flattenDocumentSymbols(e,t,o){for(let n of t)e.push({kind:n.kind,tags:n.tags,name:n.name,detail:n.detail,containerName:n.containerName||o,range:n.range,selectionRange:n.selectionRange,children:void 0}),n.children&&a._flattenDocumentSymbols(e,n.children,n.name)}},AC=le("IOutlineModelService"),s8e=class{constructor(i,e,t){this._languageFeaturesService=i;this._disposables=new N;this._cache=new dl(15,.7);this._debounceInformation=e.for(i.documentSymbolProvider,"DocumentSymbols",{min:350}),this._disposables.add(t.onModelRemoved(o=>{this._cache.delete(o.id)}))}dispose(){this._disposables.dispose()}async getOrCreate(i,e){let t=this._languageFeaturesService.documentSymbolProvider,o=t.ordered(i),n=this._cache.get(i.id);if(!n||n.versionId!==i.getVersionId()||!$i(n.provider,o)){let s=new Ye;n={versionId:i.getVersionId(),provider:o,promiseCnt:0,source:s,promise:dF.create(t,i,s.token),model:void 0},this._cache.set(i.id,n);let l=Date.now();n.promise.then(c=>{n.model=c,this._debounceInformation.update(i,Date.now()-l)}).catch(c=>{this._cache.delete(i.id)})}if(n.model)return n.model;n.promiseCnt+=1;let r=e.onCancellationRequested(()=>{--n.promiseCnt===0&&(n.source.cancel(),this._cache.delete(i.id))});try{return await n.promise}finally{r.dispose()}}getDebounceValue(i){return this._debounceInformation.get(i)}getCachedModels(){return vt.filter(vt.map(this._cache.values(),i=>i.model),i=>i!==void 0)}};s8e=I([m(0,Qt),m(1,hf),m(2,Tt)],s8e);Ee(AC,s8e,1);$e.registerCommand("_executeDocumentSymbolProvider",async function(a,...i){let[e]=i;wo(A.isUri(e));let t=a.get(AC),n=await a.get(Bt).createModelReference(e);try{return(await t.getOrCreate(n.object.textEditorModel,Se.None)).getTopLevelSymbols()}finally{n.dispose()}});var ga=new class{constructor(){this._implementations=[]}register(i){return this._implementations.push(i),{dispose:()=>{let e=this._implementations.indexOf(i);e!==-1&&this._implementations.splice(e,1)}}}getImplementations(){return this._implementations}};function sYi(a){return a instanceof l8e?a._instance:a}var l8e=class{constructor(i){this.instantiationService=i}init(...i){}};function IKo(a,i){return class extends i{constructor(){super(...arguments);this._autorun=void 0}init(...o){this._autorun=il((n,r)=>{let s=a.read(n);this._instance=r.add(this.instantiationService.createInstance(s,...o))})}dispose(){this._autorun?.dispose()}}}var Jxt=class extends l8e{constructor(i){super(i),this.init()}};Jxt=I([m(0,F)],Jxt);function Zxt(a){return DE()?IKo(a,a8e):a.get()}var a8e=class extends l8e{constructor(i,e){super(e),this.init(i)}};a8e=I([m(1,F)],a8e);var JY=class{validateOrThrow(i){let e=this.validate(i);if(e.error)throw new Error(e.error.message);return e.content}},ike=class extends JY{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}}},yKo=new ike("string");function aYi(){return yKo}var Ugs=new ike("number");var wKo=new ike("boolean");function Hci(){return wKo}var zgs=new ike("object");var Fci=class extends JY{validate(i){return{content:i,error:void 0}}getJSONSchema(){return{}}};function lYi(){return new Fci}var ekt=class extends JY{validate(i){return i!==void 0?{content:void 0,error:{message:`Expected undefined, but got ${typeof i}`}}:{content:void 0,error:void 0}}getJSONSchema(){return{}}};function cYi(){return new ekt}var c8e=class{constructor(i){this.validator=i}};function d8e(a){return new c8e(a)}var Wci=class extends JY{constructor(e){super();this.properties=e}validate(e){if(typeof e!="object"||e===null)return{content:void 0,error:{message:"Expected object"}};let t={};for(let o in this.properties){let n=this.properties[o],r=e[o],s=n instanceof c8e,l=s?n.validator:n;if(s&&r===void 0)continue;let{content:c,error:u}=l.validate(r);if(u)return{content:void 0,error:{message:`Error in property '${o}': ${u.message}`}};t[o]=c}return{content:t,error:void 0}}getJSONSchema(){let e=[],t={};for(let[n,r]of Object.entries(this.properties)){let s=r instanceof c8e,l=s?r.validator:r;t[n]=l.getJSONSchema(),s||e.push(n)}return{type:"object",properties:t,...e.length>0?{required:e}:{}}}};function dYi(a){return new Wci(a)}var Vci=class extends JY{constructor(e){super();this.validators=e}validate(e){let t;for(let o of this.validators){let{content:n,error:r}=o.validate(e);if(!r)return{content:n,error:void 0};t=r}return{content:void 0,error:t}}getJSONSchema(){return{oneOf:L2i(this.validators,e=>{if(!(e instanceof ekt))return e.getJSONSchema()})}}};function uYi(...a){return new Vci(a)}var Bci=class extends JY{constructor(e,t){super();this._ref=e;this._validator=t}validate(e){return this._validator.validate(e)}getJSONSchema(){return{$ref:this._ref}}};function pYi(a,i){return new Bci(a,i)}var Xn={Visible:kCt,HasFocusedSuggestion:new Y("suggestWidgetHasFocusedSuggestion",!1,d(1625,null)),DetailsVisible:new Y("suggestWidgetDetailsVisible",!1,d(1624,null)),DetailsFocused:new Y("suggestWidgetDetailsFocused",!1,d(1623,null)),MultipleSuggestions:new Y("suggestWidgetMultipleSuggestions",!1,d(1626,null)),MakesTextEdit:new Y("suggestionMakesTextEdit",!0,d(1622,null)),AcceptSuggestionsOnEnter:new Y("acceptSuggestionOnEnter",!0,d(1618,null)),HasInsertAndReplaceRange:new Y("suggestionHasInsertAndReplaceRange",!1,d(1620,null)),InsertMode:new Y("suggestionInsertMode",void 0,{type:"string",description:d(1621,null)}),CanResolve:new Y("suggestionCanResolve",!1,d(1619,null))},sB=new D("suggestWidgetStatusBar"),Uci=class{constructor(i,e,t,o){this.position=i;this.completion=e;this.container=t;this.provider=o;this.isInvalid=!1;this.score=kv.Default;this.distance=0;this.textLabel=typeof e.label=="string"?e.label:e.label?.label,this.labelLow=this.textLabel.toLowerCase(),this.isInvalid=!this.textLabel,this.sortTextLow=e.sortText&&e.sortText.toLowerCase(),this.filterTextLow=e.filterText&&e.filterText.toLowerCase(),this.extensionId=e.extensionId,z.isIRange(e.range)?(this.editStart=new ye(e.range.startLineNumber,e.range.startColumn),this.editInsertEnd=new ye(e.range.endLineNumber,e.range.endColumn),this.editReplaceEnd=new ye(e.range.endLineNumber,e.range.endColumn),this.isInvalid=this.isInvalid||z.spansMultipleLines(e.range)||e.range.startLineNumber!==i.lineNumber):(this.editStart=new ye(e.range.insert.startLineNumber,e.range.insert.startColumn),this.editInsertEnd=new ye(e.range.insert.endLineNumber,e.range.insert.endColumn),this.editReplaceEnd=new ye(e.range.replace.endLineNumber,e.range.replace.endColumn),this.isInvalid=this.isInvalid||z.spansMultipleLines(e.range.insert)||z.spansMultipleLines(e.range.replace)||e.range.insert.startLineNumber!==i.lineNumber||e.range.replace.startLineNumber!==i.lineNumber||e.range.insert.startColumn!==e.range.replace.startColumn),typeof o.resolveCompletionItem!="function"&&(this._resolveCache=Promise.resolve(),this._resolveDuration=0)}get isResolved(){return this._resolveDuration!==void 0}get resolveDuration(){return this._resolveDuration!==void 0?this._resolveDuration:-1}async resolve(i){if(!this._resolveCache){let e=i.onCancellationRequested(()=>{this._resolveCache=void 0,this._resolveDuration=void 0}),t=new Dn(!0);this._resolveCache=Promise.resolve(this.provider.resolveCompletionItem(this.completion,i)).then(o=>{Object.assign(this.completion,o),this._resolveDuration=t.elapsed()},o=>{ao(o)&&(this._resolveCache=void 0,this._resolveDuration=void 0)}).finally(()=>{e.dispose()})}return this._resolveCache}};var I5=class a{constructor(i=2,e=new Set,t=new Set,o=new Map,n=!0){this.snippetSortOrder=i;this.kindFilter=e;this.providerFilter=t;this.providerItemsToReuse=o;this.showDeprecated=n}static{this.default=new a}},ZY;function hYi(){return ZY}function gYi(a){let i=ZY;return ZY=a,i}var zci=class{constructor(i,e,t,o){this.items=i;this.needsClipboard=e;this.durations=t;this.disposable=o}};async function Yce(a,i,e,t=I5.default,o={triggerKind:0},n=Se.None){let r=new Dn;e=e.clone();let s=i.getWordAtPosition(e),l=s?new z(e.lineNumber,s.startColumn,e.lineNumber,s.endColumn):z.fromPositions(e),c={replace:l,insert:l.setEndPosition(e.lineNumber,e.column)},u=[],p=new N,h=[],g=!1,f=(b,S,y)=>{let w=!1;if(!S)return w;for(let k of S.suggestions)if(!t.kindFilter.has(k.kind)){if(!t.showDeprecated&&k?.tags?.includes(1))continue;k.range||(k.range=c),k.sortText||(k.sortText=typeof k.label=="string"?k.label:k.label.label),!g&&k.insertTextRules&&k.insertTextRules&4&&(g=eg.guessNeedsClipboard(k.insertText)),u.push(new Uci(e,k,S,b)),w=!0}return jc(S)&&p.add(S),h.push({providerName:b._debugDisplayName??"unknown_provider",elapsedProvider:S.duration??-1,elapsedOverall:y.elapsed()}),w},v=(async()=>{if(!ZY||t.kindFilter.has(28))return;let b=t.providerItemsToReuse.get(ZY);if(b){b.forEach(w=>u.push(w));return}if(t.providerFilter.size>0&&!t.providerFilter.has(ZY))return;let S=new Dn,y=await ZY.provideCompletionItems(i,e,o,n);f(ZY,y,S)})();for(let b of a.orderedGroups(i)){let S=!1;if(await Promise.all(b.map(async y=>{if(t.providerItemsToReuse.has(y)){let w=t.providerItemsToReuse.get(y);w.forEach(k=>u.push(k)),S=S||w.length>0;return}if(!(t.providerFilter.size>0&&!t.providerFilter.has(y)))try{let w=new Dn,k=await y.provideCompletionItems(i,e,o,n);S=f(y,k,w)||S}catch(w){ys(w)}})),S||n.isCancellationRequested)break}return await v,n.isCancellationRequested?(p.dispose(),Promise.reject(new go)):new zci(u.sort(kKo(t.snippetSortOrder)),g,{entries:h,elapsed:r.elapsed()},p)}function Kci(a,i){if(a.sortTextLow&&i.sortTextLow){if(a.sortTextLow<i.sortTextLow)return-1;if(a.sortTextLow>i.sortTextLow)return 1}return a.textLabel<i.textLabel?-1:a.textLabel>i.textLabel?1:a.completion.kind-i.completion.kind}function CKo(a,i){if(a.completion.kind!==i.completion.kind){if(a.completion.kind===28)return-1;if(i.completion.kind===28)return 1}return Kci(a,i)}function xKo(a,i){if(a.completion.kind!==i.completion.kind){if(a.completion.kind===28)return 1;if(i.completion.kind===28)return-1}return Kci(a,i)}var tkt=new Map;tkt.set(0,CKo);tkt.set(2,xKo);tkt.set(1,Kci);function kKo(a){return tkt.get(a)}$e.registerCommand("_executeCompletionItemProvider",async(a,...i)=>{let[e,t,o,n]=i;wo(A.isUri(e)),wo(ye.isIPosition(t)),wo(typeof o=="string"||!o),wo(typeof n=="number"||!n);let{completionProvider:r}=a.get(Qt),s=await a.get(Bt).createModelReference(e);try{let l={incomplete:!1,suggestions:[]},c=[],u=s.object.textEditorModel.validatePosition(t),p=await Yce(r,s.object.textEditorModel,u,void 0,{triggerCharacter:o??void 0,triggerKind:o?1:0});for(let h of p.items)c.length<(n??0)&&c.push(h.resolve(Se.None)),l.incomplete=l.incomplete||h.container.incomplete,l.suggestions.push(h.completion);try{return await Promise.all(c),l}finally{setTimeout(()=>p.disposable.dispose(),100)}}finally{s.dispose()}});function ikt(a,i){a.getContribution("editor.contrib.suggestController")?.triggerSuggest(new Set().add(i),void 0,!0)}var oK=class{static isAllOff(i){return i.other==="off"&&i.comments==="off"&&i.strings==="off"}static isAllOn(i){return i.other==="on"&&i.comments==="on"&&i.strings==="on"}static valueFor(i,e){switch(e){case 1:return i.comments;case 2:return i.strings;default:return i.other}}};var Ha=class{static{this.inlineSuggestionVisible=new Y("inlineSuggestionVisible",!1,d(1361,null))}static{this.inlineSuggestionAlternativeActionVisible=new Y("inlineSuggestionAlternativeActionVisible",!1,d(1358,null))}static{this.inlineSuggestionHasIndentation=new Y("inlineSuggestionHasIndentation",!1,d(1359,null))}static{this.inlineSuggestionHasIndentationLessThanTabSize=new Y("inlineSuggestionHasIndentationLessThanTabSize",!0,d(1360,null))}static{this.suppressSuggestions=new Y("inlineSuggestionSuppressSuggestions",void 0,d(1362,null))}static{this.cursorBeforeGhostText=new Y("cursorBeforeGhostText",!1,d(1353,null))}static{this.cursorInIndentation=new Y("cursorInIndentation",!1,d(1354,null))}static{this.hasSelection=new Y("editor.hasSelection",!1,d(1355,null))}static{this.cursorAtInlineEdit=new Y("cursorAtInlineEdit",!1,d(1352,null))}static{this.inlineEditVisible=new Y("inlineEditIsVisible",!1,d(1357,null))}static{this.tabShouldJumpToInlineEdit=new Y("tabShouldJumpToInlineEdit",!1,d(1364,null))}static{this.tabShouldAcceptInlineEdit=new Y("tabShouldAcceptInlineEdit",!1,d(1363,null))}static{this.inInlineEditsPreviewEditor=new Y("inInlineEditsPreviewEditor",!0,d(1356,null))}};var okt=class{constructor(i,e,t){this._selection=i,this._cursors=e,this._selectionId=null,this._trimInRegexesAndStrings=t}getEditOperations(i,e){let t=u8e(i,this._cursors,this._trimInRegexesAndStrings);for(let o=0,n=t.length;o<n;o++){let r=t[o];e.addEditOperation(r.range,r.text)}this._selectionId=e.trackSelection(this._selection)}computeCursorState(i,e){return e.getTrackedSelection(this._selectionId)}};function u8e(a,i,e){i.sort((s,l)=>s.lineNumber===l.lineNumber?s.column-l.column:s.lineNumber-l.lineNumber);for(let s=i.length-2;s>=0;s--)i[s].lineNumber===i[s+1].lineNumber&&i.splice(s,1);let t=[],o=0,n=0,r=i.length;for(let s=1,l=a.getLineCount();s<=l;s++){let c=a.getLineContent(s),u=c.length+1,p=0;if(n<r&&i[n].lineNumber===s&&(p=i[n].column,n++,p===u)||c.length===0)continue;let h=hv(c),g=0;if(h===-1)g=1;else if(h!==c.length-1)g=h+2;else continue;if(!e){if(!a.tokenization.hasAccurateTokensForLine(s))continue;let f=a.tokenization.getLineTokens(s),v=f.getStandardTokenType(f.findTokenIndexAtOffset(g));if(v===2||v===3)continue}g=Math.max(p,g),t[o++]=Hn.delete(new z(s,g,s,u))}return t}var p8e=class{constructor(i,e,t){this._selection=i,this._isCopyingDown=e,this._noop=t||!1,this._selectionDirection=0,this._selectionId=null,this._startLineNumberDelta=0,this._endLineNumberDelta=0}getEditOperations(i,e){let t=this._selection;this._startLineNumberDelta=0,this._endLineNumberDelta=0,t.startLineNumber<t.endLineNumber&&t.endColumn===1&&(this._endLineNumberDelta=1,t=t.setEndPosition(t.endLineNumber-1,i.getLineMaxColumn(t.endLineNumber-1)));let o=[];for(let r=t.startLineNumber;r<=t.endLineNumber;r++)o.push(i.getLineContent(r));let n=o.join(`
`);n===""&&this._isCopyingDown&&(this._startLineNumberDelta++,this._endLineNumberDelta++),this._noop?e.addEditOperation(new z(t.endLineNumber,i.getLineMaxColumn(t.endLineNumber),t.endLineNumber+1,1),t.endLineNumber===i.getLineCount()?"":`
`):this._isCopyingDown?e.addEditOperation(new z(t.startLineNumber,1,t.startLineNumber,1),n+`
`):e.addEditOperation(new z(t.endLineNumber,i.getLineMaxColumn(t.endLineNumber),t.endLineNumber,i.getLineMaxColumn(t.endLineNumber)),`
`+n),this._selectionId=e.trackSelection(t),this._selectionDirection=this._selection.getDirection()}computeCursorState(i,e){let t=e.getTrackedSelection(this._selectionId);if(this._startLineNumberDelta!==0||this._endLineNumberDelta!==0){let o=t.startLineNumber,n=t.startColumn,r=t.endLineNumber,s=t.endColumn;this._startLineNumberDelta!==0&&(o=o+this._startLineNumberDelta,n=1),this._endLineNumberDelta!==0&&(r=r+this._endLineNumberDelta,s=1),t=ti.createWithDirection(o,n,r,s,this._selectionDirection)}return t}};function ak(a,i){let e=0;for(let t=0;t<a.length;t++)a.charAt(t)==="	"?e+=i:e++;return e}function Xce(a,i,e){a=a<0?0:a;let t="";if(!e){let o=Math.floor(a/i);a=a%i;for(let n=0;n<o;n++)t+="	"}for(let o=0;o<a;o++)t+=" ";return t}var nke=class{constructor(i,e,t,o){this._languageConfigurationService=o;this._selection=i,this._isMovingDown=e,this._autoIndent=t,this._selectionId=null,this._moveEndLineSelectionShrink=!1}createVirtualModel(i,e,t){return{tokenization:{getLineTokens:o=>i.tokenization.getLineTokens(e(o)),getLanguageId:()=>i.getLanguageId(),getLanguageIdAtPosition:(o,n)=>i.getLanguageIdAtPosition(o,n)},getLineContent:o=>{let n=t?.(o);return n!==void 0?n:i.getLineContent(e(o))}}}getEditOperations(i,e){let t=i.getLineCount();if(this._isMovingDown&&this._selection.endLineNumber===t){this._selectionId=e.trackSelection(this._selection);return}if(!this._isMovingDown&&this._selection.startLineNumber===1){this._selectionId=e.trackSelection(this._selection);return}this._moveEndPositionDown=!1;let o=this._selection;o.startLineNumber<o.endLineNumber&&o.endColumn===1&&(this._moveEndPositionDown=!0,o=o.setEndPosition(o.endLineNumber-1,i.getLineMaxColumn(o.endLineNumber-1)));let{tabSize:n,indentSize:r,insertSpaces:s}=i.getOptions(),l=this.buildIndentConverter(n,r,s);if(o.startLineNumber===o.endLineNumber&&i.getLineMaxColumn(o.startLineNumber)===1){let c=o.startLineNumber,u=this._isMovingDown?c+1:c-1;i.getLineMaxColumn(u)===1?e.addEditOperation(new z(1,1,1,1),null):(e.addEditOperation(new z(c,1,c,1),i.getLineContent(u)),e.addEditOperation(new z(u,1,u,i.getLineMaxColumn(u)),null)),o=new ti(u,1,u,1)}else{let c,u;if(this._isMovingDown){c=o.endLineNumber+1,u=i.getLineContent(c),e.addEditOperation(new z(c-1,i.getLineMaxColumn(c-1),c,i.getLineMaxColumn(c)),null);let p=u;if(this.shouldAutoIndent(i,o)){let h=this.matchEnterRule(i,l,n,c,o.startLineNumber-1);if(h!==null){let f=Ll(i.getLineContent(c)),v=h+ak(f,n);p=Xce(v,n,s)+this.trimStart(u)}else{let f=this.createVirtualModel(i,b=>b===o.startLineNumber?c:b),v=Bae(this._autoIndent,f,i.getLanguageIdAtPosition(c,1),o.startLineNumber,l,this._languageConfigurationService);if(v!==null){let b=Ll(i.getLineContent(c)),S=ak(v,n),y=ak(b,n);S!==y&&(p=Xce(S,n,s)+this.trimStart(u))}}e.addEditOperation(new z(o.startLineNumber,1,o.startLineNumber,1),p+`
`);let g=this.matchEnterRuleMovingDown(i,l,n,o.startLineNumber,c,p);if(g!==null)g!==0&&this.getIndentEditsOfMovingBlock(i,e,o,n,s,g);else{let f=this.createVirtualModel(i,b=>b===o.startLineNumber?c:b>=o.startLineNumber+1&&b<=o.endLineNumber+1?b-1:b,b=>b===o.startLineNumber?p:void 0),v=Bae(this._autoIndent,f,i.getLanguageIdAtPosition(c,1),o.startLineNumber+1,l,this._languageConfigurationService);if(v!==null){let b=Ll(i.getLineContent(o.startLineNumber)),S=ak(v,n),y=ak(b,n);if(S!==y){let w=S-y;this.getIndentEditsOfMovingBlock(i,e,o,n,s,w)}}}}else e.addEditOperation(new z(o.startLineNumber,1,o.startLineNumber,1),p+`
`)}else if(c=o.startLineNumber-1,u=i.getLineContent(c),e.addEditOperation(new z(c,1,c+1,1),null),e.addEditOperation(new z(o.endLineNumber,i.getLineMaxColumn(o.endLineNumber),o.endLineNumber,i.getLineMaxColumn(o.endLineNumber)),`
`+u),this.shouldAutoIndent(i,o)){let p=this.createVirtualModel(i,g=>g===c?o.startLineNumber:g),h=this.matchEnterRule(i,l,n,o.startLineNumber,o.startLineNumber-2);if(h!==null)h!==0&&this.getIndentEditsOfMovingBlock(i,e,o,n,s,h);else{let g=Bae(this._autoIndent,p,i.getLanguageIdAtPosition(o.startLineNumber,1),c,l,this._languageConfigurationService);if(g!==null){let f=Ll(i.getLineContent(o.startLineNumber)),v=ak(g,n),b=ak(f,n);if(v!==b){let S=v-b;this.getIndentEditsOfMovingBlock(i,e,o,n,s,S)}}}}}this._selectionId=e.trackSelection(o)}buildIndentConverter(i,e,t){return{shiftIndent:o=>lb.shiftIndent(o,o.length+1,i,e,t),unshiftIndent:o=>lb.unshiftIndent(o,o.length+1,i,e,t)}}parseEnterResult(i,e,t,o,n){if(n){let r=n.indentation;n.indentAction===0||n.indentAction===1?r=n.indentation+n.appendText:n.indentAction===2?r=n.indentation:n.indentAction===3&&(r=e.unshiftIndent(n.indentation)+n.appendText);let s=i.getLineContent(o);if(this.trimStart(s).indexOf(this.trimStart(r))>=0){let l=Ll(i.getLineContent(o)),c=Ll(r),u=Aft(i,o,this._languageConfigurationService);u!==null&&u&2&&(c=e.unshiftIndent(c));let p=ak(c,t),h=ak(l,t);return p-h}}return null}matchEnterRuleMovingDown(i,e,t,o,n,r){if(hv(r)>=0){let s=i.getLineMaxColumn(n),l=tj(this._autoIndent,i,new z(n,s,n,s),this._languageConfigurationService);return this.parseEnterResult(i,e,t,o,l)}else{let s=o-1;for(;s>=1;){let u=i.getLineContent(s);if(hv(u)>=0)break;s--}if(s<1||o>i.getLineCount())return null;let l=i.getLineMaxColumn(s),c=tj(this._autoIndent,i,new z(s,l,s,l),this._languageConfigurationService);return this.parseEnterResult(i,e,t,o,c)}}matchEnterRule(i,e,t,o,n,r){let s=n;for(;s>=1;){let u;if(s===n&&r!==void 0?u=r:u=i.getLineContent(s),hv(u)>=0)break;s--}if(s<1||o>i.getLineCount())return null;let l=i.getLineMaxColumn(s),c=tj(this._autoIndent,i,new z(s,l,s,l),this._languageConfigurationService);return this.parseEnterResult(i,e,t,o,c)}trimStart(i){return i.replace(/^\s+/,"")}shouldAutoIndent(i,e){if(this._autoIndent<4||!i.tokenization.isCheapToTokenize(e.startLineNumber))return!1;let t=i.getLanguageIdAtPosition(e.startLineNumber,1),o=i.getLanguageIdAtPosition(e.endLineNumber,1);return!(t!==o||this._languageConfigurationService.getLanguageConfiguration(t).indentRulesSupport===null)}getIndentEditsOfMovingBlock(i,e,t,o,n,r){for(let s=t.startLineNumber;s<=t.endLineNumber;s++){let l=i.getLineContent(s),c=Ll(l),p=ak(c,o)+r,h=Xce(p,o,n);h!==c&&(e.addEditOperation(new z(s,1,s,c.length+1),h),s===t.endLineNumber&&t.endColumn<=c.length+1&&h===""&&(this._moveEndLineSelectionShrink=!0))}}computeCursorState(i,e){let t=e.getTrackedSelection(this._selectionId);return this._moveEndPositionDown&&(t=t.setEndPosition(t.endLineNumber+1,1)),this._moveEndLineSelectionShrink&&t.startLineNumber<t.endLineNumber&&(t=t.setEndPosition(t.endLineNumber,2)),t}};nke=I([m(3,Rs)],nke);var rke=class{static{this._COLLATOR=Jc.Collator()}constructor(i,e){this.selection=i,this.descending=e,this.selectionId=null}getEditOperations(i,e){let t=EKo(i,this.selection,this.descending);t&&e.addEditOperation(t.range,t.text),this.selectionId=e.trackSelection(this.selection)}computeCursorState(i,e){return e.getTrackedSelection(this.selectionId)}static canRun(i,e,t){if(i===null)return!1;let o=vYi(i,e,t);if(!o)return!1;for(let n=0,r=o.before.length;n<r;n++)if(o.before[n]!==o.after[n])return!0;return!1}};function vYi(a,i,e){let t=i.startLineNumber,o=i.endLineNumber;if(i.endColumn===1&&o--,t>=o)return null;let n=[];for(let s=t;s<=o;s++)n.push(a.getLineContent(s));let r=n.slice(0);return r.sort(rke._COLLATOR.value.compare),e===!0&&(r=r.reverse()),{startLineNumber:t,endLineNumber:o,before:n,after:r}}function EKo(a,i,e){let t=vYi(a,i,e);return t?Hn.replace(new z(t.startLineNumber,1,t.endLineNumber,a.getLineMaxColumn(t.endLineNumber)),t.after.join(`
`)):null}var nkt=class extends Di{constructor(i,e){super(e),this.down=i}run(i,e){if(!e.hasModel())return;let t=e.getSelections().map((r,s)=>({selection:r,index:s,ignore:!1}));t.sort((r,s)=>z.compareRangesUsingStarts(r.selection,s.selection));let o=t[0];for(let r=1;r<t.length;r++){let s=t[r];o.selection.endLineNumber===s.selection.startLineNumber&&(o.index<s.index?s.ignore=!0:(o.ignore=!0,o=s))}let n=[];for(let r of t)n.push(new p8e(r.selection,this.down,r.ignore));e.pushUndoStop(),e.executeCommands(this.id,n),e.pushUndoStop()}},Gci=class extends nkt{constructor(){super(!1,{id:"editor.action.copyLinesUpAction",label:L(1417,"Copy Line Up"),precondition:pe.writable,kbOpts:{kbExpr:pe.editorTextFocus,primary:1552,linux:{primary:3600},weight:100},menuOpts:{menuId:D.MenubarSelectionMenu,group:"2_line",title:d(1434,null),order:1},canTriggerInlineEdits:!0})}},qci=class extends nkt{constructor(){super(!0,{id:"editor.action.copyLinesDownAction",label:L(1416,"Copy Line Down"),precondition:pe.writable,kbOpts:{kbExpr:pe.editorTextFocus,primary:1554,linux:{primary:3602},weight:100},menuOpts:{menuId:D.MenubarSelectionMenu,group:"2_line",title:d(1433,null),order:2},canTriggerInlineEdits:!0})}},$ci=class extends Di{constructor(){super({id:"editor.action.duplicateSelection",label:L(1407,"Duplicate Selection"),precondition:pe.writable,menuOpts:{menuId:D.MenubarSelectionMenu,group:"2_line",title:d(1435,null),order:5},canTriggerInlineEdits:!0})}run(i,e,t){if(!e.hasModel())return;let o=[],n=e.getSelections(),r=e.getModel();for(let s of n)if(s.isEmpty())o.push(new p8e(s,!0));else{let l=new ti(s.endLineNumber,s.endColumn,s.endLineNumber,s.endColumn);o.push(new ift(l,r.getValueInRange(s)))}e.pushUndoStop(),e.executeCommands(this.id,o),e.pushUndoStop()}},rkt=class extends Di{constructor(i,e){super(e),this.down=i}run(i,e){let t=i.get(Rs),o=[],n=e.getSelections()||[],r=e.getOption(16);for(let s of n)o.push(new nke(s,this.down,r,t));e.pushUndoStop(),e.executeCommands(this.id,o),e.pushUndoStop()}},jci=class extends rkt{constructor(){super(!1,{id:"editor.action.moveLinesUpAction",label:L(1427,"Move Line Up"),precondition:pe.writable,kbOpts:{kbExpr:pe.editorTextFocus,primary:528,linux:{primary:528},weight:100},menuOpts:{menuId:D.MenubarSelectionMenu,group:"2_line",title:d(1437,null),order:3},canTriggerInlineEdits:!0})}},Qci=class extends rkt{constructor(){super(!0,{id:"editor.action.moveLinesDownAction",label:L(1426,"Move Line Down"),precondition:pe.writable,kbOpts:{kbExpr:pe.editorTextFocus,primary:530,linux:{primary:530},weight:100},menuOpts:{menuId:D.MenubarSelectionMenu,group:"2_line",title:d(1436,null),order:4},canTriggerInlineEdits:!0})}},skt=class extends Di{constructor(i,e){super(e),this.descending=i}run(i,e){if(!e.hasModel())return;let t=e.getModel(),o=e.getSelections();o.length===1&&o[0].isSingleLine()&&(o=[new ti(1,1,t.getLineCount(),t.getLineMaxColumn(t.getLineCount()))]);for(let r of o)if(!rke.canRun(e.getModel(),r,this.descending))return;let n=[];for(let r=0,s=o.length;r<s;r++)n[r]=new rke(o[r],this.descending);e.pushUndoStop(),e.executeCommands(this.id,n),e.pushUndoStop()}},Yci=class extends skt{constructor(){super(!1,{id:"editor.action.sortLinesAscending",label:L(1430,"Sort Lines Ascending"),precondition:pe.writable,canTriggerInlineEdits:!0})}},Xci=class extends skt{constructor(){super(!0,{id:"editor.action.sortLinesDescending",label:L(1431,"Sort Lines Descending"),precondition:pe.writable,canTriggerInlineEdits:!0})}},Jci=class extends Di{constructor(){super({id:"editor.action.removeDuplicateLines",label:L(1421,"Delete Duplicate Lines"),precondition:pe.writable,canTriggerInlineEdits:!0})}run(i,e){if(!e.hasModel())return;let t=e.getModel();if(t.getLineCount()===1&&t.getLineMaxColumn(1)===1)return;let o=[],n=[],r=0,s=!0,l=e.getSelections();l.length===1&&l[0].isSingleLine()&&(l=[new ti(1,1,t.getLineCount(),t.getLineMaxColumn(t.getLineCount()))],s=!1);for(let c of l){let u=new Set,p=[];for(let v=c.startLineNumber;v<=c.endLineNumber;v++){let b=t.getLineContent(v);u.has(b)||(p.push(b),u.add(b))}let h=new ti(c.startLineNumber,1,c.endLineNumber,t.getLineMaxColumn(c.endLineNumber)),g=c.startLineNumber-r,f=new ti(g,1,g+p.length-1,p[p.length-1].length+1);o.push(Hn.replace(h,p.join(`
`))),n.push(f),r+=c.endLineNumber-c.startLineNumber+1-p.length}e.pushUndoStop(),e.executeEdits(this.id,o,s?n:void 0),e.pushUndoStop()}},Zci=class extends Di{constructor(){super({id:"editor.action.reverseLines",label:L(1429,"Reverse lines"),precondition:pe.writable,canTriggerInlineEdits:!0})}run(i,e){if(!e.hasModel())return;let t=e.getModel(),o=e.getSelections(),n=o;n.length===1&&n[0].isSingleLine()&&(n=[new ti(1,1,t.getLineCount(),t.getLineMaxColumn(t.getLineCount()))]);let r=[],s=[];for(let l=0;l<n.length;l++){let c=n[l],u=o[l],p=c.endLineNumber;c.startLineNumber<c.endLineNumber&&c.endColumn===1&&p--;let h=new z(c.startLineNumber,1,p,t.getLineMaxColumn(p));p===t.getLineCount()&&t.getLineContent(h.endLineNumber)===""&&(h=h.setEndPosition(h.endLineNumber-1,t.getLineMaxColumn(h.endLineNumber-1)));let g=[];for(let S=h.endLineNumber;S>=h.startLineNumber;S--)g.push(t.getLineContent(S));let f=Hn.replace(h,g.join(`
`));r.push(f);let v=function(S){return S<=h.endLineNumber?h.endLineNumber-S+h.startLineNumber:S},b=function(S){if(S.isEmpty())return new ti(v(S.positionLineNumber),S.positionColumn,v(S.positionLineNumber),S.positionColumn);{let y=v(S.selectionStartLineNumber),w=v(S.positionLineNumber),k=S.selectionStartColumn,T=S.positionColumn;return new ti(y,k,w,T)}};s.push(b(u))}e.pushUndoStop(),e.executeEdits(this.id,r,s),e.pushUndoStop()}},g8e=class a extends Di{static{this.ID="editor.action.trimTrailingWhitespace"}constructor(){super({id:a.ID,label:L(1432,"Trim Trailing Whitespace"),precondition:pe.writable,kbOpts:{kbExpr:pe.editorTextFocus,primary:Vi(2089,2102),weight:100}})}run(i,e,t){let o=[];t.reason==="auto-save"&&(o=(e.getSelections()||[]).map(u=>new ye(u.positionLineNumber,u.positionColumn)));let n=e.getSelection();if(n===null)return;let r=i.get(B),s=e.getModel(),l=r.getValue("files.trimTrailingWhitespaceInRegexAndStrings",{overrideIdentifier:s?.getLanguageId(),resource:s?.uri}),c=new okt(n,o,l);e.pushUndoStop(),e.executeCommands(this.id,[c]),e.pushUndoStop()}},edi=class extends Di{constructor(){super({id:"editor.action.deleteLines",label:L(1418,"Delete Line"),precondition:pe.writable,kbOpts:{kbExpr:pe.textInputFocus,primary:3113,weight:100},canTriggerInlineEdits:!0})}run(i,e){if(!e.hasModel())return;let t=this._getLinesToRemove(e),o=e.getModel();if(o.getLineCount()===1&&o.getLineMaxColumn(1)===1)return;let n=0,r=[],s=[];for(let l=0,c=t.length;l<c;l++){let u=t[l],p=u.startLineNumber,h=u.endLineNumber,g=1,f=o.getLineMaxColumn(h);h<o.getLineCount()?(h+=1,f=1):p>1&&(p-=1,g=o.getLineMaxColumn(p)),r.push(Hn.replace(new ti(p,g,h,f),"")),s.push(new ti(p-n,u.positionColumn,p-n,u.positionColumn)),n+=u.endLineNumber-u.startLineNumber+1}e.pushUndoStop(),e.executeEdits(this.id,r,s),e.revealAllCursors(!0),e.pushUndoStop()}_getLinesToRemove(i){let e=i.getSelections().map(n=>{let r=n.endLineNumber;return n.startLineNumber<n.endLineNumber&&n.endColumn===1&&(r-=1),{startLineNumber:n.startLineNumber,selectionStartColumn:n.selectionStartColumn,endLineNumber:r,positionColumn:n.positionColumn}});e.sort((n,r)=>n.startLineNumber===r.startLineNumber?n.endLineNumber-r.endLineNumber:n.startLineNumber-r.startLineNumber);let t=[],o=e[0];for(let n=1;n<e.length;n++)o.endLineNumber+1>=e[n].startLineNumber?o.endLineNumber=e[n].endLineNumber:(t.push(o),o=e[n]);return t.push(o),t}},tdi=class extends Di{constructor(){super({id:"editor.action.indentLines",label:L(1422,"Indent Line"),precondition:pe.writable,kbOpts:{kbExpr:pe.editorTextFocus,primary:2142,weight:100},canTriggerInlineEdits:!0})}run(i,e){let t=e._getViewModel();t&&(e.pushUndoStop(),e.executeCommands(this.id,CP.indent(t.cursorConfig,e.getModel(),e.getSelections())),e.pushUndoStop())}},idi=class extends Di{constructor(){super({id:"editor.action.outdentLines",label:L(1428,"Outdent Line"),precondition:pe.writable,kbOpts:{kbExpr:pe.editorTextFocus,primary:2140,weight:100},canTriggerInlineEdits:!0})}run(i,e){zL.Outdent.runEditorCommand(i,e,null)}},f8e=class a extends Di{static{this.ID="editor.action.insertLineBefore"}constructor(){super({id:a.ID,label:L(1424,"Insert Line Above"),precondition:pe.writable,kbOpts:{kbExpr:pe.editorTextFocus,primary:3075,weight:100},canTriggerInlineEdits:!0})}run(i,e){let t=e._getViewModel();t&&(e.pushUndoStop(),e.executeCommands(this.id,ij.lineInsertBefore(t.cursorConfig,e.getModel(),e.getSelections())))}},Jce=class a extends Di{static{this.ID="editor.action.insertLineAfter"}constructor(){super({id:a.ID,label:L(1423,"Insert Line Below"),precondition:pe.writable,kbOpts:{kbExpr:pe.editorTextFocus,primary:2051,weight:100},canTriggerInlineEdits:!0})}run(i,e){let t=e._getViewModel();t&&(e.pushUndoStop(),e.executeCommands(this.id,ij.lineInsertAfter(t.cursorConfig,e.getModel(),e.getSelections())))}},akt=class extends Di{run(i,e){if(!e.hasModel())return;let t=e.getSelection(),o=this._getRangesToDelete(e),n=[];for(let l=0,c=o.length-1;l<c;l++){let u=o[l],p=o[l+1];z.intersectRanges(u,p)===null?n.push(u):o[l+1]=z.plusRange(u,p)}n.push(o[o.length-1]);let r=this._getEndCursorState(t,n),s=n.map(l=>Hn.replace(l,""));e.pushUndoStop(),e.executeEdits(this.id,s,r),e.pushUndoStop()}},odi=class extends akt{constructor(){super({id:"deleteAllLeft",label:L(1419,"Delete All Left"),precondition:pe.writable,kbOpts:{kbExpr:pe.textInputFocus,primary:0,mac:{primary:2049},weight:100},canTriggerInlineEdits:!0})}_getEndCursorState(i,e){let t=null,o=[],n=0;return e.forEach(r=>{let s;if(r.endColumn===1&&n>0){let l=r.startLineNumber-n;s=new ti(l,r.startColumn,l,r.startColumn)}else s=new ti(r.startLineNumber,r.startColumn,r.startLineNumber,r.startColumn);n+=r.endLineNumber-r.startLineNumber,r.intersectRanges(i)?t=s:o.push(s)}),t&&o.unshift(t),o}_getRangesToDelete(i){let e=i.getSelections();if(e===null)return[];let t=e,o=i.getModel();return o===null?[]:(t.sort(z.compareRangesUsingStarts),t=t.map(n=>{if(n.isEmpty())if(n.startColumn===1){let r=Math.max(1,n.startLineNumber-1),s=n.startLineNumber===1?1:o.getLineLength(r)+1;return new z(r,s,n.startLineNumber,1)}else return new z(n.startLineNumber,1,n.startLineNumber,n.startColumn);else return new z(n.startLineNumber,1,n.endLineNumber,n.endColumn)}),t)}},ndi=class extends akt{constructor(){super({id:"deleteAllRight",label:L(1420,"Delete All Right"),precondition:pe.writable,kbOpts:{kbExpr:pe.textInputFocus,primary:0,mac:{primary:297,secondary:[2068]},weight:100},canTriggerInlineEdits:!0})}_getEndCursorState(i,e){let t=null,o=[];for(let n=0,r=e.length,s=0;n<r;n++){let l=e[n],c=new ti(l.startLineNumber-s,l.startColumn,l.startLineNumber-s,l.startColumn);l.intersectRanges(i)?t=c:o.push(c)}return t&&o.unshift(t),o}_getRangesToDelete(i){let e=i.getModel();if(e===null)return[];let t=i.getSelections();if(t===null)return[];let o=t.map(n=>{if(n.isEmpty()){let r=e.getLineMaxColumn(n.startLineNumber);return n.startColumn===r?new z(n.startLineNumber,n.startColumn,n.startLineNumber+1,1):new z(n.startLineNumber,n.startColumn,n.startLineNumber,r)}return n});return o.sort(z.compareRangesUsingStarts),o}},rdi=class extends Di{constructor(){super({id:"editor.action.joinLines",label:L(1425,"Join Lines"),precondition:pe.writable,kbOpts:{kbExpr:pe.editorTextFocus,primary:0,mac:{primary:296},weight:100},canTriggerInlineEdits:!0})}run(i,e){let t=e.getSelections();if(t===null)return;let o=e.getSelection();if(o===null)return;t.sort(z.compareRangesUsingStarts);let n=[],r=t.reduce((h,g)=>h.isEmpty()?h.endLineNumber===g.startLineNumber?(o.equalsSelection(h)&&(o=g),g):g.startLineNumber>h.endLineNumber+1?(n.push(h),g):new ti(h.startLineNumber,h.startColumn,g.endLineNumber,g.endColumn):g.startLineNumber>h.endLineNumber?(n.push(h),g):new ti(h.startLineNumber,h.startColumn,g.endLineNumber,g.endColumn));n.push(r);let s=e.getModel();if(s===null)return;let l=[],c=[],u=o,p=0;for(let h=0,g=n.length;h<g;h++){let f=n[h],v=f.startLineNumber,b=1,S=0,y,w,k=s.getLineLength(f.endLineNumber)-f.endColumn;if(f.isEmpty()||f.startLineNumber===f.endLineNumber){let O=f.getStartPosition();O.lineNumber<s.getLineCount()?(y=v+1,w=s.getLineMaxColumn(y)):(y=O.lineNumber,w=s.getLineMaxColumn(O.lineNumber))}else y=f.endLineNumber,w=s.getLineMaxColumn(y);let T=s.getLineContent(v);for(let O=v+1;O<=y;O++){let V=s.getLineContent(O),H=s.getLineFirstNonWhitespaceColumn(O);if(H>=1){let G=!0;T===""&&(G=!1),G&&(T.charAt(T.length-1)===" "||T.charAt(T.length-1)==="	")&&(G=!1,T=T.replace(/[\s\uFEFF\xA0]+$/g," "));let $=V.substr(H-1);T+=(G?" ":"")+$,G?S=$.length+1:S=$.length}else S=0}let P=new z(v,b,y,w);if(!P.isEmpty()){let O;f.isEmpty()?(l.push(Hn.replace(P,T)),O=new ti(P.startLineNumber-p,T.length-S+1,v-p,T.length-S+1)):f.startLineNumber===f.endLineNumber?(l.push(Hn.replace(P,T)),O=new ti(f.startLineNumber-p,f.startColumn,f.endLineNumber-p,f.endColumn)):(l.push(Hn.replace(P,T)),O=new ti(f.startLineNumber-p,f.startColumn,f.startLineNumber-p,T.length-k)),z.intersectRanges(P,o)!==null?u=O:c.push(O)}p+=P.endLineNumber-P.startLineNumber}c.unshift(u),e.pushUndoStop(),e.executeEdits(this.id,l,c),e.pushUndoStop()}},sdi=class extends Di{constructor(){super({id:"editor.action.transpose",label:L(1415,"Transpose Characters around the Cursor"),precondition:pe.writable,canTriggerInlineEdits:!0})}run(i,e){let t=e.getSelections();if(t===null)return;let o=e.getModel();if(o===null)return;let n=[];for(let r=0,s=t.length;r<s;r++){let l=t[r];if(!l.isEmpty())continue;let c=l.getStartPosition(),u=o.getLineMaxColumn(c.lineNumber);if(c.column>=u){if(c.lineNumber===o.getLineCount())continue;let p=new z(c.lineNumber,Math.max(1,c.column-1),c.lineNumber+1,1),h=o.getValueInRange(p).split("").reverse().join("");n.push(new qh(new ti(c.lineNumber,Math.max(1,c.column-1),c.lineNumber+1,1),h))}else{let p=new z(c.lineNumber,Math.max(1,c.column-1),c.lineNumber,c.column+1),h=o.getValueInRange(p).split("").reverse().join("");n.push(new l7(p,h,new ti(c.lineNumber,c.column+1,c.lineNumber,c.column+1)))}}e.pushUndoStop(),e.executeCommands(this.id,n),e.pushUndoStop()}},y5=class extends Di{run(i,e){let t=e.getSelections();if(t===null)return;let o=e.getModel();if(o===null)return;let n=e.getOption(148),r=[];for(let s of t)if(s.isEmpty()){let l=s.getStartPosition(),c=e.getConfiguredWordAtPosition(l);if(!c)continue;let u=new z(l.lineNumber,c.startColumn,l.lineNumber,c.endColumn),p=o.getValueInRange(u);r.push(Hn.replace(u,this._modifyText(p,n)))}else{let l=o.getValueInRange(s);r.push(Hn.replace(s,this._modifyText(l,n)))}e.pushUndoStop(),e.executeEdits(this.id,r),e.pushUndoStop()}},adi=class extends y5{constructor(){super({id:"editor.action.transformToUppercase",label:L(1414,"Transform to Uppercase"),precondition:pe.writable,canTriggerInlineEdits:!0})}_modifyText(i,e){return i.toLocaleUpperCase()}},ldi=class extends y5{constructor(){super({id:"editor.action.transformToLowercase",label:L(1410,"Transform to Lowercase"),precondition:pe.writable,canTriggerInlineEdits:!0})}_modifyText(i,e){return i.toLocaleLowerCase()}},wR=class{constructor(i,e){this._pattern=i;this._flags=e;this._actual=null,this._evaluated=!1}get(){if(!this._evaluated){this._evaluated=!0;try{this._actual=new RegExp(this._pattern,this._flags)}catch{}}return this._actual}isSupported(){return this.get()!==null}},lkt=class a extends y5{static{this.titleBoundary=new wR("(^|[^\\p{L}\\p{N}']|((^|\\P{L})'))\\p{L}","gmu")}constructor(){super({id:"editor.action.transformToTitlecase",label:L(1413,"Transform to Title Case"),precondition:pe.writable,canTriggerInlineEdits:!0})}_modifyText(i,e){let t=a.titleBoundary.get();return t?i.toLocaleLowerCase().replace(t,o=>o.toLocaleUpperCase()):i}},m8e=class a extends y5{static{this.caseBoundary=new wR("(\\p{Ll})(\\p{Lu})","gmu")}static{this.singleLetters=new wR("(\\p{Lu}|\\p{N})(\\p{Lu})(\\p{Ll})","gmu")}constructor(){super({id:"editor.action.transformToSnakecase",label:L(1412,"Transform to Snake Case"),precondition:pe.writable,canTriggerInlineEdits:!0})}_modifyText(i,e){let t=a.caseBoundary.get(),o=a.singleLetters.get();return!t||!o?i:i.replace(t,"$1_$2").replace(o,"$1_$2$3").toLocaleLowerCase()}},h8e=class a extends y5{static{this.singleLineWordBoundary=new wR("[_\\s-]+","gm")}static{this.multiLineWordBoundary=new wR("[_-]+","gm")}static{this.validWordStart=new wR("^(\\p{Lu}[^\\p{Lu}])","gmu")}constructor(){super({id:"editor.action.transformToCamelcase",label:L(1408,"Transform to Camel Case"),precondition:pe.writable,canTriggerInlineEdits:!0})}_modifyText(i,e){let t=/\r\n|\r|\n/.test(i)?a.multiLineWordBoundary.get():a.singleLineWordBoundary.get(),o=a.validWordStart.get();if(!t||!o)return i;let n=i.split(t);return n.shift()?.replace(o,s=>s.toLocaleLowerCase())+n.map(s=>s.substring(0,1).toLocaleUpperCase()+s.substring(1)).join("")}},ckt=class a extends y5{static{this.wordBoundary=new wR("[_ \\t-]","gm")}static{this.wordBoundaryToMaintain=new wR("(?<=\\.)","gm")}static{this.upperCaseWordMatcher=new wR("^\\p{Lu}+$","mu")}constructor(){super({id:"editor.action.transformToPascalcase",label:L(1411,"Transform to Pascal Case"),precondition:pe.writable,canTriggerInlineEdits:!0})}_modifyText(i,e){let t=a.wordBoundary.get(),o=a.wordBoundaryToMaintain.get(),n=a.upperCaseWordMatcher.get();return!t||!o||!n?i:i.split(o).map(l=>l.split(t)).flat().map(l=>{let c=l.charAt(0).toLocaleUpperCase()+l.slice(1);return c.length>1&&n.test(c)?c.charAt(0)+c.slice(1).toLocaleLowerCase():c}).join("")}},dkt=class a extends y5{static isSupported(){return[this.caseBoundary,this.singleLetters,this.underscoreBoundary].every(e=>e.isSupported())}static{this.caseBoundary=new wR("(\\p{Ll})(\\p{Lu})","gmu")}static{this.singleLetters=new wR("(\\p{Lu}|\\p{N})(\\p{Lu}\\p{Ll})","gmu")}static{this.underscoreBoundary=new wR("(\\S)(_)(\\S)","gm")}constructor(){super({id:"editor.action.transformToKebabcase",label:L(1409,"Transform to Kebab Case"),precondition:pe.writable,canTriggerInlineEdits:!0})}_modifyText(i,e){let t=a.caseBoundary.get(),o=a.singleLetters.get(),n=a.underscoreBoundary.get();return!t||!o||!n?i:i.replace(n,"$1-$3").replace(t,"$1-$2").replace(o,"$1-$2").toLocaleLowerCase()}};ni(Gci);ni(qci);ni($ci);ni(jci);ni(Qci);ni(Yci);ni(Xci);ni(Jci);ni(g8e);ni(edi);ni(tdi);ni(idi);ni(f8e);ni(Jce);ni(odi);ni(ndi);ni(rdi);ni(sdi);ni(adi);ni(ldi);ni(Zci);m8e.caseBoundary.isSupported()&&m8e.singleLetters.isSupported()&&ni(m8e);h8e.singleLineWordBoundary.isSupported()&&h8e.multiLineWordBoundary.isSupported()&&ni(h8e);ckt.wordBoundary.isSupported()&&ni(ckt);lkt.titleBoundary.isSupported()&&ni(lkt);dkt.isSupported()&&ni(dkt);var eX=le("dataChannelService");function bYi(a){return a.sourceId+" @@ "+JSON.stringify({...a,modelUri:a.modelUri?.toString(),sourceId:void 0})}var tX=class extends x{constructor(e,t,o){super();this._key=e;this._contextKeyService=t;this._dataChannelService=o;this._isEnabledContextKeyValue=TKo("structuredLogger.enabled:"+this._key,this._contextKeyService).recomputeInitiallyAndOnChange(this._store),this.isEnabled=this._isEnabledContextKeyValue.map(n=>n!==void 0)}static cast(){return this}log(e){return this._isEnabledContextKeyValue.get()?(this._dataChannelService.getDataChannel("structuredLogger:"+this._key).sendData(e),!0):!1}};tX=I([m(1,X),m(2,eX)],tX);function TKo(a,i){return ui(i.onDidChangeContext,()=>i.getContextKeyValue(a))}var ske=class extends x{constructor(e,t,o){super();this._editor=e;this._instantiationService=t;this._loggerService=o;this._structuredLogger=this._register(this._instantiationService.createInstance(tX.cast(),"editor.inlineSuggest.logChangeReason.commandId"));let n=this._loggerService?.createLogger("textModelChanges",{hidden:!1,name:"Text Model Changes Reason"}),r=ui(this,n.onDidChangeLogLevel,()=>n.getLevel());this._register(be(s=>{VIe(r.read(s),1)&&s.store.add(this._editor.onDidChangeModelContent(l=>{this._editor.getModel()?.uri.scheme!=="output"&&n.trace("onDidChangeModelContent: "+l.detailedReasons.map(c=>c.toKey(Number.MAX_VALUE)).join(", "))}))})),this._register(be(s=>{this._editor instanceof Xr&&this._structuredLogger.isEnabled.read(s)&&s.store.add(this._editor.onDidChangeModelContent(l=>{let c=this._editor.getModel();if(!c)return;let u=l.detailedReasons[0],p={...u.metadata,sourceId:"TextModel.setChangeReason",source:u.metadata.source,time:Date.now(),modelUri:c.uri,modelVersion:c.getVersionId()};setTimeout(()=>{this._structuredLogger.log(p)},0)}))}))}};ske=I([m(1,F),m(2,Il)],ske);var SYi=Object.freeze({CURRENT_YEAR:!0,CURRENT_YEAR_SHORT:!0,CURRENT_MONTH:!0,CURRENT_DATE:!0,CURRENT_HOUR:!0,CURRENT_MINUTE:!0,CURRENT_SECOND:!0,CURRENT_DAY_NAME:!0,CURRENT_DAY_NAME_SHORT:!0,CURRENT_MONTH_NAME:!0,CURRENT_MONTH_NAME_SHORT:!0,CURRENT_SECONDS_UNIX:!0,CURRENT_TIMEZONE_OFFSET:!0,SELECTION:!0,CLIPBOARD:!0,TM_SELECTED_TEXT:!0,TM_CURRENT_LINE:!0,TM_CURRENT_WORD:!0,TM_LINE_INDEX:!0,TM_LINE_NUMBER:!0,TM_FILENAME:!0,TM_FILENAME_BASE:!0,TM_DIRECTORY:!0,TM_DIRECTORY_BASE:!0,TM_FILEPATH:!0,CURSOR_INDEX:!0,CURSOR_NUMBER:!0,RELATIVE_FILEPATH:!0,BLOCK_COMMENT_START:!0,BLOCK_COMMENT_END:!0,LINE_COMMENT:!0,WORKSPACE_NAME:!0,WORKSPACE_FOLDER:!0,RANDOM:!0,RANDOM_HEX:!0,UUID:!0}),v8e=class{constructor(i){this._delegates=i}resolve(i){for(let e of this._delegates){let t=e.resolve(i);if(t!==void 0)return t}}},b8e=class{constructor(i,e,t,o){this._model=i;this._selection=e;this._selectionIdx=t;this._overtypingCapturer=o}resolve(i){let{name:e}=i;if(e==="SELECTION"||e==="TM_SELECTED_TEXT"){let t=this._model.getValueInRange(this._selection)||void 0,o=this._selection.startLineNumber!==this._selection.endLineNumber;if(!t&&this._overtypingCapturer){let n=this._overtypingCapturer.getLastOvertypedInfo(this._selectionIdx);n&&(t=n.value,o=n.multiline)}if(t&&o&&i.snippet){let n=this._model.getLineContent(this._selection.startLineNumber),r=Ll(n,0,this._selection.startColumn-1),s=r;i.snippet.walk(c=>c===i?!1:(c instanceof pS&&(s=Ll(yc(c.value).pop())),!0));let l=tf(s,r);t=t.replace(/(\r\n|\r|\n)(.*)/g,(c,u,p)=>`${u}${s.substr(l)}${p}`)}return t}else{if(e==="TM_CURRENT_LINE")return this._model.getLineContent(this._selection.positionLineNumber);if(e==="TM_CURRENT_WORD"){let t=this._model.getWordAtPosition({lineNumber:this._selection.positionLineNumber,column:this._selection.positionColumn});return t&&t.word||void 0}else{if(e==="TM_LINE_INDEX")return String(this._selection.positionLineNumber-1);if(e==="TM_LINE_NUMBER")return String(this._selection.positionLineNumber);if(e==="CURSOR_INDEX")return String(this._selectionIdx);if(e==="CURSOR_NUMBER")return String(this._selectionIdx+1)}}}},S8e=class{constructor(i,e){this._labelService=i;this._model=e}resolve(i){let{name:e}=i;if(e==="TM_FILENAME")return jo(this._model.uri.fsPath);if(e==="TM_FILENAME_BASE"){let t=jo(this._model.uri.fsPath),o=t.lastIndexOf(".");return o<=0?t:t.slice(0,o)}else{if(e==="TM_DIRECTORY")return ad(this._model.uri.fsPath)==="."?"":this._labelService.getUriLabel(ci(this._model.uri));if(e==="TM_DIRECTORY_BASE")return ad(this._model.uri.fsPath)==="."?"":jo(ad(this._model.uri.fsPath));if(e==="TM_FILEPATH")return this._labelService.getUriLabel(this._model.uri);if(e==="RELATIVE_FILEPATH")return this._labelService.getUriLabel(this._model.uri,{relative:!0,noPrefix:!0})}}},I8e=class{constructor(i,e,t,o){this._readClipboardText=i;this._selectionIdx=e;this._selectionCount=t;this._spread=o}resolve(i){if(i.name!=="CLIPBOARD")return;let e=this._readClipboardText();if(e){if(this._spread){let t=e.split(/\r\n|\n|\r/).filter(o=>!uc(o));if(t.length===this._selectionCount)return t[this._selectionIdx]}return e}}},Zce=class{constructor(i,e,t){this._model=i;this._selection=e;this._languageConfigurationService=t}resolve(i){let{name:e}=i,t=this._model.getLanguageIdAtPosition(this._selection.selectionStartLineNumber,this._selection.selectionStartColumn),o=this._languageConfigurationService.getLanguageConfiguration(t).comments;if(o){if(e==="LINE_COMMENT")return o.lineCommentToken||void 0;if(e==="BLOCK_COMMENT_START")return o.blockCommentStartToken||void 0;if(e==="BLOCK_COMMENT_END")return o.blockCommentEndToken||void 0}}};Zce=I([m(2,Rs)],Zce);var y8e=class a{constructor(){this._date=new Date}static{this.dayNames=[d(1599,null),d(1589,null),d(1603,null),d(1605,null),d(1601,null),d(1577,null),d(1595,null)]}static{this.dayNamesShort=[d(1600,null),d(1590,null),d(1604,null),d(1606,null),d(1602,null),d(1578,null),d(1596,null)]}static{this.monthNames=[d(1579,null),d(1575,null),d(1585,null),d(1569,null),d(1587,null),d(1583,null),d(1581,null),d(1571,null),d(1597,null),d(1593,null),d(1591,null),d(1573,null)]}static{this.monthNamesShort=[d(1580,null),d(1576,null),d(1586,null),d(1570,null),d(1588,null),d(1584,null),d(1582,null),d(1572,null),d(1598,null),d(1594,null),d(1592,null),d(1574,null)]}resolve(i){let{name:e}=i;if(e==="CURRENT_YEAR")return String(this._date.getFullYear());if(e==="CURRENT_YEAR_SHORT")return String(this._date.getFullYear()).slice(-2);if(e==="CURRENT_MONTH")return String(this._date.getMonth().valueOf()+1).padStart(2,"0");if(e==="CURRENT_DATE")return String(this._date.getDate().valueOf()).padStart(2,"0");if(e==="CURRENT_HOUR")return String(this._date.getHours().valueOf()).padStart(2,"0");if(e==="CURRENT_MINUTE")return String(this._date.getMinutes().valueOf()).padStart(2,"0");if(e==="CURRENT_SECOND")return String(this._date.getSeconds().valueOf()).padStart(2,"0");if(e==="CURRENT_DAY_NAME")return a.dayNames[this._date.getDay()];if(e==="CURRENT_DAY_NAME_SHORT")return a.dayNamesShort[this._date.getDay()];if(e==="CURRENT_MONTH_NAME")return a.monthNames[this._date.getMonth()];if(e==="CURRENT_MONTH_NAME_SHORT")return a.monthNamesShort[this._date.getMonth()];if(e==="CURRENT_SECONDS_UNIX")return String(Math.floor(this._date.getTime()/1e3));if(e==="CURRENT_TIMEZONE_OFFSET"){let t=this._date.getTimezoneOffset(),o=t>0?"-":"+",n=Math.trunc(Math.abs(t/60)),r=n<10?"0"+n:n,s=Math.abs(t)-n*60,l=s<10?"0"+s:s;return o+r+":"+l}}},w8e=class{constructor(i){this._workspaceService=i}resolve(i){if(!this._workspaceService)return;let e=Dg(this._workspaceService.getWorkspace());if(!Yj(e)){if(i.name==="WORKSPACE_NAME")return this._resolveWorkspaceName(e);if(i.name==="WORKSPACE_FOLDER")return this._resoveWorkspacePath(e)}}_resolveWorkspaceName(i){if(Zh(i))return jo(i.uri.path);let e=jo(i.configPath.path);return e.endsWith(FE)&&(e=e.substr(0,e.length-FE.length-1)),e}_resoveWorkspacePath(i){if(Zh(i))return Hp(i.uri.fsPath);let e=jo(i.configPath.path),t=i.configPath.fsPath;return t.endsWith(e)&&(t=t.substr(0,t.length-e.length-1)),t?Hp(t):"/"}},C8e=class{resolve(i){let{name:e}=i;if(e==="RANDOM")return Math.random().toString().slice(-6);if(e==="RANDOM_HEX")return Math.random().toString(16).slice(-6);if(e==="UUID")return xt()}};var ukt=class a{constructor(i,e,t){this._editor=i;this._snippet=e;this._snippetLineLeadingWhitespace=t;this._offset=-1;this._nestingLevel=1;this._placeholderGroups=Jg(e.placeholders,tk.compareByIndex),this._placeholderGroupsIdx=-1}static{this._decor={active:mo.register({description:"snippet-placeholder-1",stickiness:0,className:"snippet-placeholder"}),inactive:mo.register({description:"snippet-placeholder-2",stickiness:1,className:"snippet-placeholder"}),activeFinal:mo.register({description:"snippet-placeholder-3",stickiness:1,className:"finish-snippet-placeholder"}),inactiveFinal:mo.register({description:"snippet-placeholder-4",stickiness:1,className:"finish-snippet-placeholder"})}}initialize(i){this._offset=i.newPosition}dispose(){this._placeholderDecorations&&this._editor.removeDecorations([...this._placeholderDecorations.values()]),this._placeholderGroups.length=0}_initDecorations(){if(this._offset===-1)throw new Error("Snippet not initialized!");if(this._placeholderDecorations)return;this._placeholderDecorations=new Map;let i=this._editor.getModel();this._editor.changeDecorations(e=>{for(let t of this._snippet.placeholders){let o=this._snippet.offset(t),n=this._snippet.fullLen(t),r=z.fromPositions(i.getPositionAt(this._offset+o),i.getPositionAt(this._offset+o+n)),s=t.isFinalTabstop?a._decor.inactiveFinal:a._decor.inactive,l=e.addDecoration(r,s);this._placeholderDecorations.set(t,l)}})}move(i){if(!this._editor.hasModel())return[];if(this._initDecorations(),this._placeholderGroupsIdx>=0){let o=[];for(let n of this._placeholderGroups[this._placeholderGroupsIdx])if(n.transform){let r=this._placeholderDecorations.get(n),s=this._editor.getModel().getDecorationRange(r),l=this._editor.getModel().getValueInRange(s),c=n.transform.resolve(l).split(/\r\n|\r|\n/);for(let u=1;u<c.length;u++)c[u]=this._editor.getModel().normalizeIndentation(this._snippetLineLeadingWhitespace+c[u]);o.push(Hn.replace(s,c.join(this._editor.getModel().getEOL())))}o.length>0&&this._editor.executeEdits("snippet.placeholderTransform",o)}let e=!1;i===!0&&this._placeholderGroupsIdx<this._placeholderGroups.length-1?(this._placeholderGroupsIdx+=1,e=!0):i===!1&&this._placeholderGroupsIdx>0&&(this._placeholderGroupsIdx-=1,e=!0);let t=this._editor.getModel().changeDecorations(o=>{let n=new Set,r=[];for(let s of this._placeholderGroups[this._placeholderGroupsIdx]){let l=this._placeholderDecorations.get(s),c=this._editor.getModel().getDecorationRange(l);r.push(new ti(c.startLineNumber,c.startColumn,c.endLineNumber,c.endColumn)),e=e&&this._hasPlaceholderBeenCollapsed(s),o.changeDecorationOptions(l,s.isFinalTabstop?a._decor.activeFinal:a._decor.active),n.add(s);for(let u of this._snippet.enclosingPlaceholders(s)){let p=this._placeholderDecorations.get(u);o.changeDecorationOptions(p,u.isFinalTabstop?a._decor.activeFinal:a._decor.active),n.add(u)}}for(let[s,l]of this._placeholderDecorations)n.has(s)||o.changeDecorationOptions(l,s.isFinalTabstop?a._decor.inactiveFinal:a._decor.inactive);return r});return e?this.move(i):t??[]}_hasPlaceholderBeenCollapsed(i){let e=i;for(;e;){if(e instanceof tk){let t=this._placeholderDecorations.get(e);if(this._editor.getModel().getDecorationRange(t).isEmpty()&&e.toString().length>0)return!0}e=e.parent}return!1}get isAtFirstPlaceholder(){return this._placeholderGroupsIdx<=0||this._placeholderGroups.length===0}get isAtLastPlaceholder(){return this._placeholderGroupsIdx===this._placeholderGroups.length-1}get hasPlaceholder(){return this._snippet.placeholders.length>0}get isTrivialSnippet(){if(this._snippet.placeholders.length===0)return!0;if(this._snippet.placeholders.length===1){let[i]=this._snippet.placeholders;if(i.isFinalTabstop&&this._snippet.rightMostDescendant===i)return!0}return!1}computePossibleSelections(){let i=new Map;for(let e of this._placeholderGroups){let t;for(let o of e){if(o.isFinalTabstop)break;t||(t=[],i.set(o.index,t));let n=this._placeholderDecorations.get(o),r=this._editor.getModel().getDecorationRange(n);if(!r){i.delete(o.index);break}t.push(r)}}return i}get activeChoice(){if(!this._placeholderDecorations)return;let i=this._placeholderGroups[this._placeholderGroupsIdx][0];if(!i?.choice)return;let e=this._placeholderDecorations.get(i);if(!e)return;let t=this._editor.getModel().getDecorationRange(e);if(t)return{range:t,choice:i.choice}}get hasChoice(){let i=!1;return this._snippet.walk(e=>(i=e instanceof mce,!i)),i}merge(i){let e=this._editor.getModel();this._nestingLevel*=10,this._editor.changeDecorations(t=>{for(let o of this._placeholderGroups[this._placeholderGroupsIdx]){let n=i.shift();console.assert(n._offset!==-1),console.assert(!n._placeholderDecorations);let r=n._snippet.placeholderInfo.last.index;for(let l of n._snippet.placeholderInfo.all)l.isFinalTabstop?l.index=o.index+(r+1)/this._nestingLevel:l.index=o.index+l.index/this._nestingLevel;this._snippet.replace(o,n._snippet.children);let s=this._placeholderDecorations.get(o);t.removeDecoration(s),this._placeholderDecorations.delete(o);for(let l of n._snippet.placeholders){let c=n._snippet.offset(l),u=n._snippet.fullLen(l),p=z.fromPositions(e.getPositionAt(n._offset+c),e.getPositionAt(n._offset+c+u)),h=t.addDecoration(p,a._decor.inactive);this._placeholderDecorations.set(l,h)}}this._placeholderGroups=Jg(this._snippet.placeholders,tk.compareByIndex)})}getEnclosingRange(){let i,e=this._editor.getModel();for(let t of this._placeholderDecorations.values()){let o=e.getDecorationRange(t)??void 0;i?i=i.plusRange(o):i=o}return i}},IYi={overwriteBefore:0,overwriteAfter:0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0},NC=class{constructor(i,e,t=IYi,o){this._editor=i;this._template=e;this._options=t;this._languageConfigurationService=o;this._templateMerges=[];this._snippets=[]}static adjustWhitespace(i,e,t,o,n){let r=i.getLineContent(e.lineNumber),s=Ll(r,0,e.column-1),l;return o.walk(c=>{if(!(c instanceof pS)||c.parent instanceof mce||n&&!n.has(c))return!0;let u=c.value.split(/\r\n|\r|\n/);if(t){let h=o.offset(c);if(h===0)u[0]=i.normalizeIndentation(u[0]);else{l=l??o.toString();let g=l.charCodeAt(h-1);(g===10||g===13)&&(u[0]=i.normalizeIndentation(s+u[0]))}for(let g=1;g<u.length;g++)u[g]=i.normalizeIndentation(s+u[g])}let p=u.join(i.getEOL());return p!==c.value&&(c.parent.replace(c,[new pS(p)]),l=void 0),!0}),s}static adjustSelection(i,e,t,o){if(t!==0||o!==0){let{positionLineNumber:n,positionColumn:r}=e,s=r-t,l=r+o,c=i.validateRange({startLineNumber:n,startColumn:s,endLineNumber:n,endColumn:l});e=ti.createWithDirection(c.startLineNumber,c.startColumn,c.endLineNumber,c.endColumn,e.getDirection())}return e}static createEditsAndSnippetsFromSelections(i,e,t,o,n,r,s,l,c){let u=[],p=[];if(!i.hasModel())return{edits:u,snippets:p};let h=i.getModel(),g=i.invokeWithinContext(k=>k.get(Pe)),f=i.invokeWithinContext(k=>new S8e(k.get(rt),h)),v=()=>s,b=h.getValueInRange(NC.adjustSelection(h,i.getSelection(),t,0)),S=h.getValueInRange(NC.adjustSelection(h,i.getSelection(),0,o)),y=h.getLineFirstNonWhitespaceColumn(i.getSelection().positionLineNumber),w=i.getSelections().map((k,T)=>({selection:k,idx:T})).sort((k,T)=>z.compareRangesUsingStarts(k.selection,T.selection));for(let{selection:k,idx:T}of w){let P=NC.adjustSelection(h,k,t,0),O=NC.adjustSelection(h,k,0,o);b!==h.getValueInRange(P)&&(P=k),S!==h.getValueInRange(O)&&(O=k);let V=k.setStartPosition(P.startLineNumber,P.startColumn).setEndPosition(O.endLineNumber,O.endColumn),H=new eg().parse(e,!0,n),G=V.getStartPosition(),$=NC.adjustWhitespace(h,G,r||T>0&&y!==h.getLineFirstNonWhitespaceColumn(k.positionLineNumber),H);H.resolveVariables(new v8e([f,new I8e(v,T,w.length,i.getOption(88)==="spread"),new b8e(h,k,T,l),new Zce(h,k,c),new y8e,new w8e(g),new C8e])),u[T]=Hn.replace(V,H.toString()),u[T].identifier={major:T,minor:0},u[T]._isTracked=!0,p[T]=new ukt(i,H,$)}return{edits:u,snippets:p}}static createEditsAndSnippetsFromEdits(i,e,t,o,n,r,s){if(!i.hasModel()||e.length===0)return{edits:[],snippets:[]};let l=[],c=i.getModel(),u=new eg,p=new rxe,h=new v8e([i.invokeWithinContext(f=>new S8e(f.get(rt),c)),new I8e(()=>n,0,i.getSelections().length,i.getOption(88)==="spread"),new b8e(c,i.getSelection(),0,r),new Zce(c,i.getSelection(),s),new y8e,new w8e(i.invokeWithinContext(f=>f.get(Pe))),new C8e]);e=e.sort((f,v)=>z.compareRangesUsingStarts(f.range,v.range));let g=0;for(let f=0;f<e.length;f++){let{range:v,template:b,keepWhitespace:S}=e[f];if(f>0){let P=e[f-1].range,O=z.fromPositions(P.getEndPosition(),v.getStartPosition()),V=new pS(c.getValueInRange(O));p.appendChild(V),g+=V.value.length}let y=u.parseFragment(b,p);NC.adjustWhitespace(c,v.getStartPosition(),S!==void 0?!S:o,p,new Set(y)),p.resolveVariables(h);let w=p.toString(),k=w.slice(g);g=w.length;let T=Hn.replace(v,k);T.identifier={major:f,minor:0},T._isTracked=!0,l.push(T)}return u.ensureFinalTabstop(p,t,!0),{edits:l,snippets:[new ukt(i,p,"")]}}dispose(){Be(this._snippets)}_logInfo(){return`template="${this._template}", merged_templates="${this._templateMerges.join(" -> ")}"`}insert(i){if(!this._editor.hasModel())return;let{edits:e,snippets:t}=typeof this._template=="string"?NC.createEditsAndSnippetsFromSelections(this._editor,this._template,this._options.overwriteBefore,this._options.overwriteAfter,!1,this._options.adjustWhitespace,this._options.clipboardText,this._options.overtypingCapturer,this._languageConfigurationService):NC.createEditsAndSnippetsFromEdits(this._editor,this._template,!1,this._options.adjustWhitespace,this._options.clipboardText,this._options.overtypingCapturer,this._languageConfigurationService);this._snippets=t,this._editor.executeEdits(i??Wc.snippet(),e,o=>{let n=o.filter(r=>!!r.identifier);for(let r=0;r<t.length;r++)t[r].initialize(n[r].textChange);return this._snippets[0].hasPlaceholder?this._move(!0):n.map(r=>ti.fromPositions(r.range.getEndPosition()))}),this._editor.revealRange(this._editor.getSelections()[0])}merge(i,e=IYi){if(!this._editor.hasModel())return;this._templateMerges.push([this._snippets[0]._nestingLevel,this._snippets[0]._placeholderGroupsIdx,i]);let{edits:t,snippets:o}=NC.createEditsAndSnippetsFromSelections(this._editor,i,e.overwriteBefore,e.overwriteAfter,!0,e.adjustWhitespace,e.clipboardText,e.overtypingCapturer,this._languageConfigurationService);this._editor.executeEdits("snippet",t,n=>{let r=n.filter(l=>!!l.identifier);for(let l=0;l<o.length;l++)o[l].initialize(r[l].textChange);let s=o[0].isTrivialSnippet;if(!s){for(let l of this._snippets)l.merge(o);console.assert(o.length===0)}return this._snippets[0].hasPlaceholder&&!s?this._move(void 0):r.map(l=>ti.fromPositions(l.range.getEndPosition()))})}next(){let i=this._move(!0);this._editor.setSelections(i),this._editor.revealPositionInCenterIfOutsideViewport(i[0].getPosition())}prev(){let i=this._move(!1);this._editor.setSelections(i),this._editor.revealPositionInCenterIfOutsideViewport(i[0].getPosition())}_move(i){let e=[];for(let t of this._snippets){let o=t.move(i);e.push(...o)}return e}get isAtFirstPlaceholder(){return this._snippets[0].isAtFirstPlaceholder}get isAtLastPlaceholder(){return this._snippets[0].isAtLastPlaceholder}get hasPlaceholder(){return this._snippets[0].hasPlaceholder}get hasChoice(){return this._snippets[0].hasChoice}get activeChoice(){return this._snippets[0].activeChoice}isSelectionWithinPlaceholders(){if(!this.hasPlaceholder)return!1;let i=this._editor.getSelections();if(i.length<this._snippets.length)return!1;let e=new Map;for(let t of this._snippets){let o=t.computePossibleSelections();if(e.size===0)for(let[n,r]of o){r.sort(z.compareRangesUsingStarts);for(let s of i)if(r[0].containsRange(s)){e.set(n,[]);break}}if(e.size===0)return!1;e.forEach((n,r)=>{n.push(...o.get(r))})}i.sort(z.compareRangesUsingStarts);for(let[t,o]of e){if(o.length!==i.length){e.delete(t);continue}o.sort(z.compareRangesUsingStarts);for(let n=0;n<o.length;n++)if(!o[n].containsRange(i[n])){e.delete(t);continue}}return e.size>0}getEnclosingRange(){let i;for(let e of this._snippets){let t=e.getEnclosingRange();i?i=i.plusRange(t):i=t}return i}};NC=I([m(3,Rs)],NC);var pkt={overwriteBefore:0,overwriteAfter:0,undoStopBefore:!0,undoStopAfter:!0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0},vs=class{constructor(i,e,t,o,n){this._editor=i;this._logService=e;this._languageFeaturesService=t;this._languageConfigurationService=n;this._inSnippetObservable=Me(this,!1);this._snippetListener=new N;this._modelVersionId=-1;this._inSnippet=vs.InSnippetMode.bindTo(o),this._hasNextTabstop=vs.HasNextTabstop.bindTo(o),this._hasPrevTabstop=vs.HasPrevTabstop.bindTo(o)}static{this.ID="snippetController2"}static get(i){return i.getContribution(vs.ID)}static{this.InSnippetMode=new Y("inSnippetMode",!1,d(1567,null))}static{this.HasNextTabstop=new Y("hasNextTabstop",!1,d(1565,null))}static{this.HasPrevTabstop=new Y("hasPrevTabstop",!1,d(1566,null))}dispose(){this._inSnippet.reset(),this._inSnippetObservable.set(!1,void 0),this._hasPrevTabstop.reset(),this._hasNextTabstop.reset(),this._session?.dispose(),this._snippetListener.dispose()}apply(i,e){try{this._doInsert(i,typeof e>"u"?pkt:{...pkt,...e})}catch(t){this.cancel(),this._logService.error(t),this._logService.error("snippet_error"),this._logService.error("insert_edits=",i),this._logService.error("existing_template=",this._session?this._session._logInfo():"<no_session>")}}insert(i,e){try{this._doInsert(i,typeof e>"u"?pkt:{...pkt,...e})}catch(t){this.cancel(),this._logService.error(t),this._logService.error("snippet_error"),this._logService.error("insert_template=",i),this._logService.error("existing_template=",this._session?this._session._logInfo():"<no_session>")}}_doInsert(i,e){if(this._editor.hasModel()){if(this._snippetListener.clear(),e.undoStopBefore&&this._editor.getModel().pushStackElement(),this._session&&typeof i!="string"&&this.cancel(),this._session?(wo(typeof i=="string"),this._session.merge(i,e)):(this._modelVersionId=this._editor.getModel().getAlternativeVersionId(),this._session=new NC(this._editor,i,e,this._languageConfigurationService),this._session.insert(e.reason)),e.undoStopAfter&&this._editor.getModel().pushStackElement(),this._session?.hasChoice){let t={_debugDisplayName:"snippetChoiceCompletions",provideCompletionItems:(c,u)=>{if(!this._session||c!==this._editor.getModel()||!ye.equals(this._editor.getPosition(),u))return;let{activeChoice:p}=this._session;if(!p||p.choice.options.length===0)return;let h=c.getValueInRange(p.range),g=!!p.choice.options.find(v=>v.value===h),f=[];for(let v=0;v<p.choice.options.length;v++){let b=p.choice.options[v];f.push({kind:13,label:b.value,insertText:b.value,sortText:"a".repeat(v+1),range:p.range,filterText:g?`${h}_${b.value}`:void 0,command:{id:"jumpToNextSnippetPlaceholder",title:d(1568,null)}})}return{suggestions:f}}},o=this._editor.getModel(),n,r=!1,s=()=>{n?.dispose(),r=!1},l=()=>{r||(n=this._languageFeaturesService.completionProvider.register({language:o.getLanguageId(),pattern:o.uri.fsPath,scheme:o.uri.scheme,exclusive:!0},t),this._snippetListener.add(n),r=!0)};this._choiceCompletions={provider:t,enable:l,disable:s}}this._updateState(),this._snippetListener.add(this._editor.onDidChangeModelContent(t=>t.isFlush&&this.cancel())),this._snippetListener.add(this._editor.onDidChangeModel(()=>this.cancel())),this._snippetListener.add(this._editor.onDidChangeCursorSelection(()=>this._updateState()))}}_updateState(){if(!(!this._session||!this._editor.hasModel())){if(this._modelVersionId===this._editor.getModel().getAlternativeVersionId())return this.cancel();if(!this._session.hasPlaceholder)return this.cancel();if(this._session.isAtLastPlaceholder||!this._session.isSelectionWithinPlaceholders())return this._editor.getModel().pushStackElement(),this.cancel();this._inSnippet.set(!0),this._inSnippetObservable.set(!0,void 0),this._hasPrevTabstop.set(!this._session.isAtFirstPlaceholder),this._hasNextTabstop.set(!this._session.isAtLastPlaceholder),this._handleChoice()}}_handleChoice(){if(!this._session||!this._editor.hasModel()){this._currentChoice=void 0;return}let{activeChoice:i}=this._session;if(!i||!this._choiceCompletions){this._choiceCompletions?.disable(),this._currentChoice=void 0;return}this._currentChoice!==i.choice&&(this._currentChoice=i.choice,this._choiceCompletions.enable(),queueMicrotask(()=>{ikt(this._editor,this._choiceCompletions.provider)}))}finish(){for(;this._inSnippet.get();)this.next()}cancel(i=!1){this._inSnippet.reset(),this._inSnippetObservable.set(!1,void 0),this._hasPrevTabstop.reset(),this._hasNextTabstop.reset(),this._snippetListener.clear(),this._currentChoice=void 0,this._session?.dispose(),this._session=void 0,this._modelVersionId=-1,i&&this._editor.setSelections([this._editor.getSelection()])}prev(){this._session?.prev(),this._updateState()}next(){this._session?.next(),this._updateState()}isInSnippet(){return!!this._inSnippet.get()}get isInSnippetObservable(){return this._inSnippetObservable}getSessionEnclosingRange(){if(this._session)return this._session.getEnclosingRange()}};vs=I([m(1,se),m(2,Qt),m(3,X),m(4,Rs)],vs);xo(vs.ID,vs,4);var mkt=Oc.bindToContribution(vs.get);Xi(new mkt({id:"jumpToNextSnippetPlaceholder",precondition:C.and(vs.InSnippetMode,vs.HasNextTabstop),handler:a=>a.next(),kbOpts:{weight:130,kbExpr:pe.textInputFocus,primary:2}}));Xi(new mkt({id:"jumpToPrevSnippetPlaceholder",precondition:C.and(vs.InSnippetMode,vs.HasPrevTabstop),handler:a=>a.prev(),kbOpts:{weight:130,kbExpr:pe.textInputFocus,primary:1026}}));Xi(new mkt({id:"leaveSnippet",precondition:vs.InSnippetMode,handler:a=>a.cancel(!0),kbOpts:{weight:130,kbExpr:pe.textInputFocus,primary:9,secondary:[1033]}}));Xi(new mkt({id:"acceptSnippet",precondition:vs.InSnippetMode,handler:a=>a.finish()}));function ede(a){return new cdi(a)}var cdi=class extends gye{constructor(e){super();this._textModel=e}getOffset(e){return this._textModel.getOffsetAt(e)}getPosition(e){return this._textModel.getPositionAt(e)}};var _Ko=[];function yYi(){return _Ko}function ddi(a){return DKo(a).map(e=>e.getEndPosition())}function DKo(a){let i=sht.createSortPermutation(a,cl(o=>o.range,z.compareRangesUsingStarts)),t=new Vp(i.apply(a)).getNewRanges();return i.inverse().apply(t)}function wYi(a,i){let e=ede(i),t=i.getValue();return a.map(r=>e.getStringReplacement(r)).map(r=>r.removeCommonSuffixPrefix(t)).map(r=>e.getTextReplacement(r))}function CYi(a,i){let e=Me("result",[]),t=[];return i.add(be(o=>{let n=a.read(o);Gi(r=>{if(n.length!==t.length){t.length=n.length;for(let s=0;s<t.length;s++)t[s]||(t[s]=Me("item",n[s]));e.set([...t],r)}t.forEach((s,l)=>s.set(n[l],r))})})),e}var hkt=class{constructor(i){this._contextKeyService=i}bind(i,e){return Vd(i,this._contextKeyService,e instanceof Function?e:t=>e.read(t))}};function udi(a,i){return new Promise(e=>{let t,o=setTimeout(()=>{t&&t.dispose(),e()},a);i&&(t=i.onCancellationRequested(()=>{clearTimeout(o),t&&t.dispose(),e()}))})}var x8e=class a{constructor(i,e=void 0){this.error=i;this.message=e}static message(i){return new a(void 0,i)}static is(i){return i instanceof a}logError(){this.message?console.error(`ErrorResult: ${this.message}`,this.error):console.error("ErrorResult: An unexpected error-case occurred, usually caused by invalid input.",this.error)}};var k8e=class a{constructor(i,e,t,o=LKo){this.startValue=i;this.endValue=e;this.durationMs=t;this._interpolationFunction=o;this.startTimeMs=Date.now();i===e&&(this.durationMs=0)}static const(i){return new a(i,i,0)}isFinished(){return Date.now()>=this.startTimeMs+this.durationMs}getValue(){let i=Date.now()-this.startTimeMs;return i>=this.durationMs?this.endValue:this._interpolationFunction(i,this.startValue,this.endValue-this.startValue,this.durationMs)}};function LKo(a,i,e,t){return a===t?i+e:e*(-Math.pow(2,-10*a/t)+1)+i}function xYi(a,i,e,t){return e*((a=a/t-1)*a*a+1)+i}var gkt=class a{static const(i){return new a(k8e.const(i))}constructor(i){this._value=Me(this,i)}setAnimation(i,e){this._value.set(i,e)}changeAnimation(i,e){let t=i(this._value.get());this._value.set(t,e)}getValue(i){let e=this._value.read(i);return e.isFinished()||E8e.instance.invalidateOnNextAnimationFrame(i),e.getValue()}},E8e=class a{constructor(){this._counter=wc(this);this._isScheduled=!1}static{this.instance=new a}invalidateOnNextAnimationFrame(i){this._counter.read(i),this._isScheduled||(this._isScheduled=!0,Ki().requestAnimationFrame(()=>{this._isScheduled=!1,this._update()}))}_update(){this._counter.trigger(void 0)}};var nK=class{constructor(i,e){this.lineNumber=i;this.parts=e;lh(()=>$y(e,(t,o)=>t.column<=o.column))}equals(i){return this.lineNumber===i.lineNumber&&this.parts.length===i.parts.length&&this.parts.every((e,t)=>e.equals(i.parts[t]))}render(i,e=!1){return new Vp([...this.parts.map(t=>new ss(z.fromPositions(new ye(this.lineNumber,t.column)),e?`[${t.lines.map(o=>o.line).join(`
`)}]`:t.lines.map(o=>o.line).join(`
`)))]).applyToString(i)}renderForScreenReader(i){if(this.parts.length===0)return"";let e=this.parts[this.parts.length-1],t=i.substr(0,e.column-1);return new Vp([...this.parts.map(n=>new ss(z.fromPositions(new ye(1,n.column)),n.lines.map(r=>r.line).join(`
`)))]).applyToString(t).substring(this.parts[0].column-1)}isEmpty(){return this.parts.every(i=>i.lines.length===0)}get lineCount(){return 1+this.parts.reduce((i,e)=>i+e.lines.length-1,0)}},iX=class{constructor(i,e,t,o=[]){this.column=i;this.text=e;this.preview=t;this._inlineDecorations=o;this.lines=yc(this.text).map((n,r)=>({line:n,lineDecorations:db.filter(this._inlineDecorations,r+1,1,n.length+1)}))}equals(i){return this.column===i.column&&this.lines.length===i.lines.length&&this.lines.every((e,t)=>e.line===i.lines[t].line&&db.equalsArr(e.lineDecorations,i.lines[t].lineDecorations))}},ake=class{constructor(i,e,t,o=0){this.lineNumber=i;this.columnRange=e;this.text=t;this.additionalReservedLineCount=o;this.parts=[new iX(this.columnRange.endColumnExclusive,this.text,!1)],this.newLines=yc(this.text)}renderForScreenReader(i){return this.newLines.join(`
`)}render(i,e=!1){let t=this.columnRange.toRange(this.lineNumber);return e?new Vp([new ss(z.fromPositions(t.getStartPosition()),"("),new ss(z.fromPositions(t.getEndPosition()),`)[${this.newLines.join(`
`)}]`)]).applyToString(i):new Vp([new ss(t,this.newLines.join(`
`))]).applyToString(i)}get lineCount(){return this.newLines.length}isEmpty(){return this.parts.every(i=>i.lines.length===0)}equals(i){return this.lineNumber===i.lineNumber&&this.columnRange.equals(i.columnRange)&&this.newLines.length===i.newLines.length&&this.newLines.every((e,t)=>e===i.newLines[t])&&this.additionalReservedLineCount===i.additionalReservedLineCount}};function pdi(a,i){return $i(a,i,mdi)}function mdi(a,i){return a===i?!0:!a||!i?!1:a instanceof nK&&i instanceof nK||a instanceof ake&&i instanceof ake?a.equals(i):!1}function zP(a,i,e){let t=e?a.range.intersectRanges(e):a.range;if(!t)return a;let o=a.text.replaceAll(`\r
`,`
`),n=i.getValueInRange(t,1),r=tf(n,o),s=pc.ofText(n.substring(0,r)).addToPosition(a.range.getStartPosition()),l=o.substring(r),c=z.fromPositions(s,a.range.getEndPosition());return new ss(c,l)}function fkt(a,i){return a.text.startsWith(i.text)&&RKo(a.range,i.range)}function RKo(a,i){return i.getStartPosition().equals(a.getStartPosition())&&i.getEndPosition().isBeforeOrEqual(a.getEndPosition())}function hdi(a,i,e,t,o=0){let n=zP(a,i);if(n.range.endLineNumber!==n.range.startLineNumber)return;let r=i.getLineContent(n.range.startLineNumber),s=Ll(r).length;if(n.range.startColumn-1<=s){let f=Ll(n.text).length,v=r.substring(n.range.startColumn-1,s),[b,S]=[n.range.getStartPosition(),n.range.getEndPosition()],y=b.column+v.length<=S.column?b.delta(0,v.length):S,w=z.fromPositions(y,S),k=n.text.startsWith(v)?n.text.substring(v.length):n.text.substring(f);n=new ss(w,k)}let c=i.getValueInRange(n.range),u=MKo(c,n.text);if(!u)return;let p=n.range.startLineNumber,h=new Array;if(e==="prefix"){let f=u.filter(v=>v.originalLength===0);if(f.length>1||f.length===1&&f[0].originalStart!==c.length)return}let g=n.text.length-o;for(let f of u){let v=n.range.startColumn+f.originalStart+f.originalLength;if(e==="subwordSmart"&&t&&t.lineNumber===n.range.startLineNumber&&v<t.column||f.originalLength>0)return;if(f.modifiedLength===0)continue;let b=f.modifiedStart+f.modifiedLength,S=Math.max(f.modifiedStart,Math.min(b,g)),y=n.text.substring(f.modifiedStart,S),w=n.text.substring(S,Math.max(f.modifiedStart,b));y.length>0&&h.push(new iX(v,y,!1)),w.length>0&&h.push(new iX(v,w,!0))}return new nK(p,h)}var vkt;function MKo(a,i){if(vkt?.originalValue===a&&vkt?.newValue===i)return vkt?.changes;{let e=EYi(a,i,!0);if(e){let t=kYi(e);if(t>0){let o=EYi(a,i,!1);o&&kYi(o)<t&&(e=o)}}return vkt={originalValue:a,newValue:i,changes:e},e}}function kYi(a){let i=0;for(let e of a)i+=e.originalLength;return i}function EYi(a,i,e){if(a.length>5e3||i.length>5e3)return;function t(c){let u=0;for(let p=0,h=c.length;p<h;p++){let g=c.charCodeAt(p);g>u&&(u=g)}return u}let o=Math.max(t(a),t(i));function n(c){if(c<0)throw new Error("unexpected");return o+c+1}function r(c){let u=0,p=0,h=new Int32Array(c.length);for(let g=0,f=c.length;g<f;g++)if(e&&c[g]==="("){let v=p*100+u;h[g]=n(2*v),u++}else if(e&&c[g]===")"){u=Math.max(u-1,0);let v=p*100+u;h[g]=n(2*v+1),u===0&&p++}else h[g]=c.charCodeAt(g);return h}let s=r(a),l=r(i);return new xP({getElements:()=>s},{getElements:()=>l}).ComputeDiff(!1).changes}function TYi(a,i){let e,t=!1,o=new xIe(new Qu(a,void 0,i.update),(n,r)=>{t||(e=i.initial instanceof Function?i.initial():i.initial,t=!0);let s=i.update(n,e,r);return e=s,s},i.changeTracker,()=>{t&&(i.disposeFinal?.(e),t=!1)},i.equalityComparer??Ff,(n,r,s)=>{if(!t)throw new li("Can only set when there is a listener! This is to prevent leaks.");nO(r,l=>{e=n,o.setValue(n,l,s)})},Rl.ofCaller());return o}var gdi=class{constructor(i,e){this._baseService=i;this._intercept=e}get telemetryLevel(){return this._baseService.telemetryLevel}get sessionId(){return this._baseService.sessionId}get machineId(){return this._baseService.machineId}get sqmId(){return this._baseService.sqmId}get devDeviceId(){return this._baseService.devDeviceId}get firstSessionDate(){return this._baseService.firstSessionDate}get msftInternal(){return this._baseService.msftInternal}get sendErrorTelemetry(){return this._baseService.sendErrorTelemetry}publicLog(i,e){this._intercept(i,e),this._baseService.publicLog(i,e)}publicLog2(i,e){this._intercept(i,e),this._baseService.publicLog2(i,e)}publicLogError(i,e){this._intercept(i,e),this._baseService.publicLogError(i,e)}publicLogError2(i,e){this._intercept(i,e),this._baseService.publicLogError2(i,e)}setExperimentProperty(i,e){this._baseService.setExperimentProperty(i,e)}},uF=class extends gdi{constructor(i,e){super(i,(t,o)=>{let n=!0;o&&fdi in o&&(n=!!o[fdi]),n&&e.getDataChannel("editTelemetry").sendData({eventName:t,data:o??{}})})}};uF=I([m(0,Te),m(1,eX)],uF);var fdi=Symbol("shouldForwardToChannel");function rK(a){return{[fdi]:a}}function aB(a){if(!a)return!1;let i=a.toLowerCase();return i==="github.copilot"||i==="github.copilot-chat"}function bkt(a,i){a.publicLog2("inlineCompletion.endOfLife",i)}var PKo=new Set([";",",","=","+","-","*","/","{","}","(",")","[","]","<",">",":",".","!","?","&","|","^","%","@","#","~","`","\\","'",'"',"$"]);function AKo(a){return PKo.has(a)}function NKo(a){return/[a-zA-Z0-9_]/.test(a)}function OKo(a){return a===" "||a==="	"}function Skt(a){let i=a.split(/\r\n|\r|\n/);if(i.length>1)return{kind:"multiLine",lineCount:i.length};let e=a.length===1,t;e&&(AKo(a)?t="syntactical":NKo(a)?t="identifier":OKo(a)&&(t="whitespace"));let o=a.match(/[ \t]+/g)||[],n=o.some(u=>u.length>1),r=o.some(u=>u.includes("  ")||u.includes("		")),s=a.split(/\s+/).filter(u=>u.length>0),l=s.length===1&&/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(s[0]),c=s.length>1;return{kind:"singleLine",isSingleCharacter:e,singleCharacterKind:t,isWord:l,isMultipleWords:c,isMultipleWhitespace:n,hasDuplicatedWhitespace:r}}var bdi=class{constructor(i){this.edits=i}toString(){return JSON.stringify({edits:this.edits})}};function Sdi(a,i,e){if(a.replacements.length!==0)return new bdi(a.replacements.map(t=>FKo(t,i,e)))}function vdi(a){return a.length===0?0:a.split(/\r\n|\r|\n/).length-1}function FKo(a,i,e){let t=a.replaceRange,o=a.newText,n=t.length,r=o.length,s=vdi(o);switch(t.isEmpty?"insert":o.length===0?"delete":"replace"){case"insert":return{operation:"insert",properties:WKo(t.start,o,i,e),charactersInserted:r,charactersDeleted:0,linesInserted:s,linesDeleted:0};case"delete":{let c=i.getValue().substring(t.start,t.endExclusive);return{operation:"delete",properties:VKo(t.start,t.endExclusive,i),charactersInserted:0,charactersDeleted:n,linesInserted:0,linesDeleted:vdi(c)}}case"replace":{let c=i.getValue().substring(t.start,t.endExclusive);return{operation:"replace",properties:BKo(c,o),charactersInserted:r,charactersDeleted:n,linesInserted:s,linesDeleted:vdi(c)}}}}function WKo(a,i,e,t){let o=Skt(i),n=e.getPositionAt(a),r=e.getLineContent(n.lineNumber),s=r.length,l,c=r.trim().length===0,u=n.column>s,p=n.column===1;c?l="emptyLine":u?l="endOfLine":p?l="startOfLine":l="middleOfLine";let h;if(t){let g=t.lineNumber,f=n.lineNumber,v=t.column,b=n.column,S=g===f&&v===b,y=g===f&&b<v,w=g===f&&b>v,k=f<g?g-f:void 0,T=f>g?f-g:void 0;h={atCursor:S,beforeCursorOnSameLine:y,afterCursorOnSameLine:w,linesAbove:k,linesBelow:T}}return{textShape:o,locationShape:l,relativeToCursor:h}}function VKo(a,i,e){let t=e.getValue().substring(a,i),o=Skt(t),n=e.getPositionAt(a),r=e.getPositionAt(i),s=e.getLineContent(r.lineNumber),l=r.column>s.length,c=n.lineNumber===r.lineNumber&&n.column===1&&r.column>s.length;return{textShape:o,isAtEndOfLine:l,deletesEntireLineContent:c}}function BKo(a,i){let e=Skt(a),t=Skt(i),o=e.kind==="singleLine"&&e.isWord,n=t.kind==="singleLine"&&t.isWord,r=o&&n,s=i.length>a.length,l=i.length<a.length,c=e.kind==="singleLine"&&t.kind==="singleLine",u=e.kind==="singleLine"&&t.kind==="multiLine",p=e.kind==="multiLine"&&t.kind==="singleLine";return{isWordToWordReplacement:r,isAdditive:s,isSubtractive:l,isSingleLineToSingleLine:c,isSingleLineToMultiLine:u,isMultiLineToSingleLine:p}}function Ikt(a,i,e,t){let o=zP(a,e),n=a.range;if(!n||i&&!i.getStartPosition().equals(n.getStartPosition())||t.lineNumber!==o.range.startLineNumber||o.isEmpty)return!1;let r=e.getValueInRange(o.range,1),s=o.text,l=Math.max(0,t.column-o.range.startColumn),c=s.substring(0,l),u=s.substring(l),p=r.substring(0,l),h=r.substring(l),g=e.getLineIndentColumn(o.range.startLineNumber);return o.range.startColumn<=g&&(p=p.trimStart(),p.length===0&&(h=h.trimStart()),c=c.trimStart(),c.length===0&&(u=u.trimStart())),c.startsWith(p)&&!!X5e(h,u)}function _Yi(a,i){let e=new Ywe,t=new Jwe(e,c=>i.getLanguageConfiguration(c)),o=new Xwe(new Idi([a]),t),n=T5e(o,[],void 0,!0),r="",s=a.getLineContent();function l(c,u){if(c.kind===2)if(l(c.openingBracket,u),u=eu(u,c.openingBracket.length),c.child&&(l(c.child,u),u=eu(u,c.child.length)),c.closingBracket)l(c.closingBracket,u),u=eu(u,c.closingBracket.length);else{let h=t.getSingleLanguageBracketTokens(c.openingBracket.languageId).findClosingTokenText(c.openingBracket.bracketIds);r+=h}else if(c.kind!==3){if(c.kind===0||c.kind===1)r+=s.substring(u,eu(u,c.length));else if(c.kind===4)for(let p of c.children)l(p,u),u=eu(u,p.length)}}return l(n,mb),r}var Idi=class{constructor(i){this.lines=i;this.tokenization={getLineTokens:i=>this.lines[i-1]}}getValue(){return this.lines.map(i=>i.getLineContent()).join(`
`)}getLineCount(){return this.lines.length}getLineLength(i){return this.lines[i-1].getLineContent().length}};var ykt=class a{constructor(){this._nodes=new Set;this._outgoingEdges=new Map}static from(i,e){let t=new a;for(let o of i)t._nodes.add(o);for(let o of i){let n=e(o);if(n.length>0){let r=new Set;for(let s of n)r.add(s);t._outgoingEdges.set(o,r)}}return t}removeCycles(){let i=[],e=new Set,t=new Set,o=[],n=r=>{e.add(r),t.add(r);let s=this._outgoingEdges.get(r);if(s)for(let l of s)e.has(l)?t.has(l)&&(i.push(l),o.push({from:r,to:l})):n(l);t.delete(r)};for(let r of this._nodes)e.has(r)||n(r);for(let{from:r,to:s}of o){let l=this._outgoingEdges.get(r);l&&l.delete(s)}return{foundCycles:i}}getOutgoing(i){let e=this._outgoingEdges.get(i);return e?Array.from(e):[]}};var CR=class a{constructor(i,e=!1){this.event=i;this.alternativeAction=e}static create(i,e=!1){return new a(new Cn(Re(i),i),e)}};var tde=class{constructor(i,e,t,o,n,r,s,l){this.cursorColumnDistance=i;this.cursorLineDistance=e;this.lineCountOriginal=t;this.lineCountModified=o;this.characterCountOriginal=n;this.characterCountModified=r;this.disjointReplacements=s;this.sameShapeReplacements=l;this.longDistanceHintVisible=void 0;this.longDistanceHintDistance=void 0}setLongDistanceViewData(i,e){this.longDistanceHintVisible=!0,this.longDistanceHintDistance=Math.abs(e-i)}getData(){return{cursorColumnDistance:this.cursorColumnDistance,cursorLineDistance:this.cursorLineDistance,lineCountOriginal:this.lineCountOriginal,lineCountModified:this.lineCountModified,characterCountOriginal:this.characterCountOriginal,characterCountModified:this.characterCountModified,disjointReplacements:this.disjointReplacements,sameShapeReplacements:this.sameShapeReplacements,longDistanceHintVisible:this.longDistanceHintVisible,longDistanceHintDistance:this.longDistanceHintDistance}}};function RYi(a,i,e,t,o,n){let r=Sbt("icr"),s=new Ye,l,c={...t,requestUuid:r},u=UKo(i,e),p=S2i(a,S=>S.groupId),h=ykt.from(a,S=>S.yieldsToGroupIds?.flatMap(y=>p.get(y)??[])??[]),{foundCycles:g}=h.removeCycles();g.length>0&&ys(new Error(`Inline completions: cyclic yield-to dependency detected. Path: ${g.map(S=>S.toString?S.toString():""+S).join(" -> ")}`));let f=0,v=new NI(async S=>{try{if(f++,s.token.isCancellationRequested)return;let y=h.getOutgoing(S);for(let V of y){let H=await v.get(V);if(H)for(let G of H.inlineSuggestions.items){if(G.isInlineEdit||typeof G.insertText!="string"&&G.insertText!==void 0)return;if(G.insertText!==void 0){let $=new ss(z.lift(G.range)??u,G.insertText);if(Ikt($,void 0,e,i))return}}}let w,k=Date.now();try{w=await S.provideInlineCompletions(e,i,c,s.token)}catch(V){ys(V);return}let T=Date.now();if(!w)return;let P=[],O=new wkt(w,P,S);if(O.addRef(),wdi(s.token,()=>O.removeRef(l)),s.token.isCancellationRequested)return;for(let V of w.items){let H=HKo(V,O,u,e,n,c,o,{startTime:k,endTime:T});if(x8e.is(H)){H.logError();continue}P.push(H)}return O}finally{f--}}),b=fp.fromPromisesResolveOrder(a.map(S=>v.get(S))).filter(lo);return{contextWithUuid:c,get didAllProvidersReturn(){return f===0},lists:b,cancelAndDispose:S=>{l===void 0&&(l=S,s.dispose(!0))}}}function wdi(a,i){if(a.isCancellationRequested)return i(),x.None;{let e=a.onCancellationRequested(()=>{e.dispose(),i()});return{dispose:()=>e.dispose()}}}function HKo(a,i,e,t,o,n,r,s){let l,c=a.uri?A.revive(a.uri):void 0;if(a.jumpToPosition!==void 0)l={kind:"jumpTo",position:ye.lift(a.jumpToPosition),uri:c};else if(a.insertText!==void 0){let u,p,h=a.range?z.lift(a.range):e;if(typeof a.insertText=="string"){if(u=a.insertText,o&&a.completeBracketPairs){u=DYi(u,h.getStartPosition(),t,o);let g=u.length-a.insertText.length;g!==0&&(h=new z(h.startLineNumber,h.startColumn,h.endLineNumber,h.endColumn+g))}p=void 0}else if("snippet"in a.insertText){let g=a.insertText.snippet.length;if(o&&a.completeBracketPairs){a.insertText.snippet=DYi(a.insertText.snippet,h.getStartPosition(),t,o);let v=a.insertText.snippet.length-g;v!==0&&(h=new z(h.startLineNumber,h.startColumn,h.endLineNumber,h.endColumn+v))}let f=new eg().parse(a.insertText.snippet);f.children.length===1&&f.children[0]instanceof pS?(u=f.children[0].value,p=void 0):(u=f.toString(),p={snippet:a.insertText.snippet,range:h})}else os(a.insertText);l={kind:"edit",range:h,insertText:u,snippetInfo:p,uri:c,alternativeAction:void 0}}else if(l=void 0,!a.hint)return x8e.message("Inline completion has no insertText, jumpToPosition nor hint.");return new T8e(l,a.hint,a.additionalTextEdits||yYi(),a,i,n,a.isInlineEdit??!1,a.supportsRename??!1,r,s,a.correlationId)}var T8e=class a{constructor(i,e,t,o,n,r,s,l,c,u,p){this._action=i;this.hint=e;this.additionalTextEdits=t;this.sourceInlineCompletion=o;this.source=n;this.context=r;this.isInlineEdit=s;this.supportsRename=l;this._requestInfo=c;this._providerRequestInfo=u;this._correlationId=p;this._didShow=!1;this._timeUntilShown=void 0;this._timeUntilActuallyShown=void 0;this._showStartTime=void 0;this._shownDuration=0;this._showUncollapsedStartTime=void 0;this._showUncollapsedDuration=0;this._notShownReason=void 0;this._didReportEndOfLife=!1;this._lastSetEndOfLifeReason=void 0;this._isPreceeded=!1;this._partiallyAcceptedCount=0;this._partiallyAcceptedSinceOriginal={characters:0,ratio:0,count:0};this._renameInfo=void 0;this._editKind=void 0;this.performance=new ydi;this._viewData={editorType:c.editorType}}static createForTest(i,e){let t={insertText:i?.kind==="edit"?i.insertText:"",range:i?.kind==="edit"?i.range:void 0,isInlineEdit:!0},o={provideInlineCompletions:()=>({items:[]}),disposeInlineCompletions:()=>{}},n=new wkt({items:[t]},[],o),r={triggerKind:1,selectedSuggestionInfo:void 0,requestUuid:"test-"+Date.now(),earliestShownDateTime:0,includeInlineCompletions:!0,includeInlineEdits:!1,requestIssuedDateTime:Date.now()},s={startTime:Date.now(),sku:void 0,editorType:"textEditor",languageId:"plaintext",availableProviders:[],reason:"",typingInterval:0,typingIntervalCharacterCount:0},l={startTime:Date.now(),endTime:Date.now()};return new a(i,void 0,[],t,n,r,!0,!1,s,l,void 0)}get action(){return this._action}get showInlineEditMenu(){return this.sourceInlineCompletion.showInlineEditMenu??!1}get partialAccepts(){return this._partiallyAcceptedSinceOriginal}async reportInlineEditShown(i,e,t,o,n,r){if(this.updateShownDuration(t),this._didShow||this._didReportEndOfLife)return;this.addPerformanceMarker("shown"),this._didShow=!0,this._editKind=n,this._viewData.viewKind=t,this._viewData.renderData=o,this._timeUntilShown=r-this._requestInfo.startTime,this._timeUntilActuallyShown=Date.now()-this._requestInfo.startTime;let s=new lw(o.lineCountModified,o.lineCountOriginal,o.characterCountModified,o.characterCountOriginal);this.source.provider.handleItemDidShow?.(this.source.inlineSuggestions,this.sourceInlineCompletion,e,s),this.sourceInlineCompletion.shownCommand&&await i.executeCommand(this.sourceInlineCompletion.shownCommand.id,...this.sourceInlineCompletion.shownCommand.arguments||[])}reportPartialAccept(i,e,t){this._partiallyAcceptedCount++,this._partiallyAcceptedSinceOriginal.characters+=t.characters,this._partiallyAcceptedSinceOriginal.ratio=Math.min(this._partiallyAcceptedSinceOriginal.ratio+(1-this._partiallyAcceptedSinceOriginal.ratio)*t.ratio,1),this._partiallyAcceptedSinceOriginal.count+=t.count,this.source.provider.handlePartialAccept?.(this.source.inlineSuggestions,this.sourceInlineCompletion,i,e)}reportEndOfLife(i){if(!this._didReportEndOfLife&&(this._didReportEndOfLife=!0,this.reportInlineEditHidden(),i||(i=this._lastSetEndOfLifeReason??{kind:2,userTypingDisagreed:!1,supersededBy:void 0}),i.kind===1&&!this._didShow&&(i={kind:2,userTypingDisagreed:!1,supersededBy:void 0}),i.kind===1&&this.source.provider.handleRejection&&this.source.provider.handleRejection(this.source.inlineSuggestions,this.sourceInlineCompletion),this.source.provider.handleEndOfLifetime)){let e={requestUuid:this.context.requestUuid,correlationId:this._correlationId,selectedSuggestionInfo:!!this.context.selectedSuggestionInfo,partiallyAccepted:this._partiallyAcceptedCount,partiallyAcceptedCountSinceOriginal:this._partiallyAcceptedSinceOriginal.count,partiallyAcceptedRatioSinceOriginal:this._partiallyAcceptedSinceOriginal.ratio,partiallyAcceptedCharactersSinceOriginal:this._partiallyAcceptedSinceOriginal.characters,shown:this._didShow,shownDuration:this._shownDuration,shownDurationUncollapsed:this._showUncollapsedDuration,editKind:this._editKind?.toString(),preceeded:this._isPreceeded,timeUntilShown:this._timeUntilShown,timeUntilActuallyShown:this._timeUntilActuallyShown,timeUntilProviderRequest:this._providerRequestInfo.startTime-this._requestInfo.startTime,timeUntilProviderResponse:this._providerRequestInfo.endTime-this._requestInfo.startTime,editorType:this._viewData.editorType,languageId:this._requestInfo.languageId,requestReason:this._requestInfo.reason,viewKind:this._viewData.viewKind,notShownReason:this._notShownReason,performanceMarkers:this.performance.toString(),renameCreated:this._renameInfo?.createdRename,renameDuration:this._renameInfo?.duration,renameTimedOut:this._renameInfo?.timedOut,renameDroppedOtherEdits:this._renameInfo?.droppedOtherEdits,renameDroppedRenameEdits:this._renameInfo?.droppedRenameEdits,typingInterval:this._requestInfo.typingInterval,typingIntervalCharacterCount:this._requestInfo.typingIntervalCharacterCount,skuPlan:this._requestInfo.sku?.plan,skuType:this._requestInfo.sku?.type,availableProviders:this._requestInfo.availableProviders.map(t=>t.toString()).join(","),...this._viewData.renderData?.getData()};this.source.provider.handleEndOfLifetime(this.source.inlineSuggestions,this.sourceInlineCompletion,i,e)}}setIsPreceeded(i){this._isPreceeded=!0,(this._partiallyAcceptedSinceOriginal.characters!==0||this._partiallyAcceptedSinceOriginal.ratio!==0||this._partiallyAcceptedSinceOriginal.count!==0)&&console.warn("Expected partiallyAcceptedCountSinceOriginal to be { characters: 0, rate: 0, partialAcceptances: 0 } before setIsPreceeded."),this._partiallyAcceptedSinceOriginal=i}setNotShownReason(i){this._notShownReason??=i}setEndOfLifeReason(i){this.reportInlineEditHidden(),this._lastSetEndOfLifeReason=i}updateShownDuration(i){let e=Date.now();this._showStartTime||(this._showStartTime=e);let t=i==="collapsed";!t&&this._showUncollapsedStartTime===void 0&&(this._showUncollapsedStartTime=e),t&&this._showUncollapsedStartTime!==void 0&&(this._showUncollapsedDuration+=e-this._showUncollapsedStartTime)}reportInlineEditHidden(){if(this._showStartTime===void 0)return;let i=Date.now();this._shownDuration+=i-this._showStartTime,this._showStartTime=void 0,this._showUncollapsedStartTime!==void 0&&(this._showUncollapsedDuration+=i-this._showUncollapsedStartTime,this._showUncollapsedStartTime=void 0)}setRenameProcessingInfo(i){if(this._renameInfo)throw new li("Rename info has already been set.");this._renameInfo=i}withAction(i){return this._action=i,this}addPerformanceMarker(i){this.performance.mark(i)}},ydi=class{constructor(){this.markers=[];this.markers.push({name:"start",timeStamp:Date.now()})}mark(i){this.markers.push({name:i,timeStamp:Date.now()})}toString(){let i=[];for(let e=1;e<this.markers.length;e++){let t=this.markers[e].timeStamp-this.markers[e-1].timeStamp;i.push({[this.markers[e].name]:t})}return JSON.stringify(i)}};var wkt=class{constructor(i,e,t){this.inlineSuggestions=i;this.inlineSuggestionsData=e;this.provider=t;this.refCount=0}addRef(){this.refCount++}removeRef(i={kind:"other"}){if(this.refCount--,this.refCount===0){for(let e of this.inlineSuggestionsData)e.reportEndOfLife();this.provider.disposeInlineCompletions(this.inlineSuggestions,i)}}};function UKo(a,i){let e=i.getWordAtPosition(a),t=i.getLineMaxColumn(a.lineNumber);return e?new z(a.lineNumber,e.startColumn,a.lineNumber,t):z.fromPositions(a,a.with(void 0,t))}function DYi(a,i,e,t){let o=e.getLineContent(i.lineNumber),n=ed.replace(new pi(i.column-1,o.length),a),s=e.tokenization.tokenizeLinesAt(i.lineNumber,[n.replace(o)])?.[0].sliceZeroCopy(n.getRangeAfterReplace());return s?_Yi(s,t):a}var Cdi;(i=>{function a(e){return e?.command.id??void 0}i.toString=a})(Cdi||={});var sK=class a extends v7{constructor(e){super();this._textModel=e;this._version=e.getVersionId()}static snapshot(e){return new a(e)}get uri(){return this._textModel.uri}get version(){return this._version}_assertValid(){this._textModel.getVersionId()!==this._version&&mt(new Error(`TextModel has changed: expected version ${this._version}, got ${this._textModel.getVersionId()}`))}targets(e){return this._textModel.uri.toString()===e.uri.toString()}getValueOfRange(e){return this._assertValid(),this._textModel.getValueInRange(e)}getLineLength(e){return this._assertValid(),this._textModel.getLineLength(e)}get length(){this._assertValid();let e=this._textModel.getLineCount(),t=this._textModel.getLineLength(e);return new pc(e-1,t)}getEOL(){return this._assertValid(),this._textModel.getEOL()}getPositionAt(e){return this._assertValid(),this._textModel.getPositionAt(e)}getValueInRange(e){return this._assertValid(),this._textModel.getValueInRange(e)}getVersionId(){return this._version}dangerouslyGetUnderlyingModel(){return this._textModel}};var _8e;(i=>{function a(e,t,o=!0){return!e.isInlineEdit&&!e.action?.uri&&e.action?.kind==="edit"?xdi.create(e,t,e.action):kdi.create(e,t,o)}i.create=a})(_8e||={});function zKo(a){let i=a?.kind==="edit"?{...a,alternativeAction:Cdi.toString(a.alternativeAction),target:a?.target.uri.toString()}:{...a,target:a?.target.uri.toString()};return JSON.stringify(i)}var xkt=class{constructor(i,e,t,o){this._data=i;this.identity=e;this.hint=t;this.originalTextRef=o}get source(){return this._data.source}get isFromExplicitRequest(){return this._data.context.triggerKind===1}get forwardStable(){return this.source.inlineSuggestions.enableForwardStability??!1}get targetRange(){if(this.hint)return this.hint.range;if(this.action?.kind==="edit")return this.action.textReplacement.range;if(this.action?.kind==="jumpTo")return z.fromPositions(this.action.position);throw new li("InlineSuggestionItem: Either hint or action must be set")}get semanticId(){return this.hash}get gutterMenuLinkAction(){return this._sourceInlineCompletion.gutterMenuLinkAction}get command(){return this._sourceInlineCompletion.command}get supportsRename(){return this._data.supportsRename}get warning(){return this._sourceInlineCompletion.warning}get showInlineEditMenu(){return!!this._sourceInlineCompletion.showInlineEditMenu}get hash(){return zKo(this.action)}get shownCommand(){return this._sourceInlineCompletion.shownCommand}get requestUuid(){return this._data.context.requestUuid}get partialAccepts(){return this._data.partialAccepts}get _sourceInlineCompletion(){return this._data.sourceInlineCompletion}addRef(){this.identity.addRef(),this.source.addRef()}removeRef(){this.identity.removeRef(),this.source.removeRef()}reportInlineEditShown(i,e,t,o,n){let r=this.action?.kind==="edit"?this.action.textReplacement.text:"";this._data.reportInlineEditShown(i,r,e,t,this.computeEditKind(o),n)}reportPartialAccept(i,e,t){this._data.reportPartialAccept(i,e,t)}reportEndOfLife(i){this._data.reportEndOfLife(i)}setEndOfLifeReason(i){this._data.setEndOfLifeReason(i)}setIsPreceeded(i){this._data.setIsPreceeded(i.partialAccepts)}setNotShownReasonIfNotSet(i){this._data.setNotShownReason(i)}getSourceCompletion(){return this._sourceInlineCompletion}setRenameProcessingInfo(i){this._data.setRenameProcessingInfo(i)}withAction(i){return this._data.withAction(i)}addPerformanceMarker(i){this._data.addPerformanceMarker(i)}},kkt=class a{constructor(){this._onDispose=wc(this);this.onDispose=this._onDispose;this._jumpedTo=Me(this,!1);this._refCount=0;this.id="InlineCompletionIdentity"+a.idCounter++}static{this.idCounter=0}get jumpedTo(){return this._jumpedTo}addRef(){this._refCount++}removeRef(){this._refCount--,this._refCount===0&&this._onDispose.trigger(void 0)}setJumpTo(i){this._jumpedTo.set(!0,i)}},Ekt=class a{constructor(i,e,t){this.range=i;this.content=e;this.style=t}static create(i){return new a(z.lift(i.range),i.content,i.style)}withEdit(i,e){let t=new pi(e.getOffset(this.range.getStartPosition()),e.getOffset(this.range.getEndPosition())),o=nti([t],i)[0];if(!o)return;let n=e.getRange(o);return new a(n,this.content,this.style)}},xdi=class a extends xkt{constructor(e,t,o,n,r,s,l,c,u,p){super(l,c,u,p);this._edit=e;this._trimmedEdit=t;this._textEdit=o;this._originalRange=n;this.snippetInfo=r;this.additionalTextEdits=s;this.isInlineEdit=!1}static create(e,t,o){let n=new kkt,r=t.getTransformer(),s=o.insertText.replace(/\r\n|\r|\n/g,t.getEOL()),l=qKo(new ed(r.getOffsetRange(o.range),s),t),c=l.removeCommonSuffixAndPrefix(t.getValue()),u=r.getTextReplacement(l),p=e.hint?Ekt.create(e.hint):void 0;return new a(l,c,u,u.range,o.snippetInfo,e.additionalTextEdits,e,n,p,t)}get action(){return{kind:"edit",textReplacement:this.getSingleTextEdit(),snippetInfo:this.snippetInfo,stringEdit:new ld([this._trimmedEdit]),alternativeAction:void 0,target:this.originalTextRef}}get hash(){return JSON.stringify(this._trimmedEdit.toJson())}getSingleTextEdit(){return this._textEdit}withIdentity(e){return new a(this._edit,this._trimmedEdit,this._textEdit,this._originalRange,this.snippetInfo,this.additionalTextEdits,this._data,e,this.hint,this.originalTextRef)}withEdit(e,t){if(!this.originalTextRef.targets(t))return this;let o=nti([this._edit.replaceRange],e);if(o.length===0)return;let n=new ed(o[0],this._textEdit.text),r=ede(t),s=r.getTextReplacement(n),l=this.hint;if(l&&(l=l.withEdit(e,r),!l))return;let c=n.removeCommonSuffixAndPrefix(t.getValue());return new a(n,c,s,this._originalRange,this.snippetInfo,this.additionalTextEdits,this._data,this.identity,l,this.originalTextRef)}canBeReused(e,t){let o=this._textEdit.range;return!!o&&o.containsPosition(t)&&this.isVisible(e,t)&&pc.ofRange(o).isGreaterThanOrEqualTo(pc.ofRange(this._originalRange))}isVisible(e,t){let o=this.getSingleTextEdit();return Ikt(o,this._originalRange,e,t)}computeEditKind(e){return Sdi(new ld([this._edit]),e)}get editRange(){return this.getSingleTextEdit().range}get insertText(){return this.getSingleTextEdit().text}},kdi=class a extends xkt{constructor(e,t,o,n,r,s=!1,l,c){super(t,o,r,c);this._action=e;this._edits=n;this._lastChangePartOfInlineEdit=s;this._inlineEditModelVersion=l;this.snippetInfo=void 0;this.additionalTextEdits=[];this.isInlineEdit=!0}static createForTest(e,t,o){let n={kind:"edit",snippetInfo:void 0,insertText:o,range:t,uri:e.uri,alternativeAction:void 0};return a.create(T8e.createForTest(n,e.uri),e)}static create(e,t,o=!0){let n,r=[];if(e.action?.kind==="edit"){let c=o?KKo(t,e.action.range,e.action.insertText):GKo(t,e.action.range,e.action.insertText),u=Vp.fromStringEdit(c,t),p=c.isEmpty()?new ss(new z(1,1,1,1),""):u.toReplacement(t);r=c.replacements.map(h=>{let g=z.fromPositions(t.getPositionAt(h.replaceRange.start),t.getTransformer().getPosition(h.replaceRange.endExclusive)),f=t.getValueInRange(g);return Edi.create(h,f)}),n={kind:"edit",snippetInfo:e.action.snippetInfo,stringEdit:c,textReplacement:p,alternativeAction:e.action.alternativeAction,target:t}}else if(e.action?.kind==="jumpTo")n={kind:"jumpTo",position:e.action.position,offset:t.getTransformer().getOffset(e.action.position),target:t};else if(n=void 0,!e.hint)throw new li("InlineEditItem: action is undefined and no hint is provided");let s=new kkt,l=e.hint?Ekt.create(e.hint):void 0;return new a(n,e,s,r,l,!1,t.getVersionId(),t)}get updatedEditModelVersion(){return this._inlineEditModelVersion}get action(){return this._action}withIdentity(e){return new a(this._action,this._data,e,this._edits,this.hint,this._lastChangePartOfInlineEdit,this._inlineEditModelVersion,this.originalTextRef)}canBeReused(e,t){return this._lastChangePartOfInlineEdit&&this.updatedEditModelVersion===e.getVersionId()}withEdit(e,t){return this.originalTextRef.targets(t)?this._applyTextModelChanges(e,this._edits,t):this}_applyTextModelChanges(e,t,o){let n=ede(o),r=!1,s=this._inlineEditModelVersion,l,c=sK.snapshot(o);if(this.action?.kind==="edit"){if(t=t.map(f=>f.applyTextModelChanges(e)),t.some(f=>f.edit===void 0))return;let p=o.getVersionId();if(r=t.some(f=>f.lastChangeUpdatedEdit),r&&(s=p??-1),p===null||s+20<p||(t=t.filter(f=>!f.edit.isEmpty),t.length===0))return;let h=new ld(t.map(f=>f.edit));l={kind:"edit",textReplacement:n.getTextEdit(h).toReplacement(new pR(o)),snippetInfo:this.snippetInfo,stringEdit:h,alternativeAction:this.action.alternativeAction,target:c}}else if(this.action?.kind==="jumpTo"){let p=this.action.offset,h=e.applyToOffsetOrUndefined(p);if(h===void 0)return;l={kind:"jumpTo",position:n.getPosition(h),offset:h,target:c}}else l=void 0;let u=this.hint;if(!(u&&(u=u.withEdit(e,n),!u)))return new a(l,this._data,this.identity,t,u,r,s,c)}computeEditKind(e){let t=this.action?.kind==="edit"?this.action.stringEdit:void 0;if(t)return Sdi(t,e)}};function KKo(a,i,e){let t=a.getEOL(),o=a.getValueOfRange(i),n=e.replace(/\r\n|\r|\n/g,t),l=W1.getDefault().computeDiff(yc(o),yc(n),{ignoreTrimWhitespace:!1,computeMoves:!1,extendToSubwords:!0,maxComputationTimeMs:50}).changes.flatMap(h=>h.innerChanges??[]);function c(h,g){let f=pc.fromPosition(g.getStartPosition());return pc.ofRange(g).createRange(f.addToPosition(h))}let u=new jS(n);return new ld(l.map(h=>{let g=c(i.getStartPosition(),h.originalRange),f=a.getTransformer().getOffsetRange(g),v=u.getValueOfRange(h.modifiedRange),b=new ed(f,v),S=a.getValueOfRange(g);return $Ko(b,S,l.length,a)}))}function GKo(a,i,e){return new ld([new ed(a.getTransformer().getOffsetRange(i),e)])}var Edi=class a{constructor(i,e,t,o,n=!1){this._edit=i;this._trimmedNewText=e;this._prefixLength=t;this._suffixLength=o;this._lastChangeUpdatedEdit=n}static create(i,e){let t=tf(i.newText,e),o=vC(i.newText,e),n=i.newText.substring(t,i.newText.length-o);return new a(i,n,t,o)}get edit(){return this._edit}get lastChangeUpdatedEdit(){return this._lastChangeUpdatedEdit}applyTextModelChanges(i){let e=this._clone();return e._applyTextModelChanges(i),e}_clone(){return new a(this._edit,this._trimmedNewText,this._prefixLength,this._suffixLength,this._lastChangeUpdatedEdit)}_applyTextModelChanges(i){if(this._lastChangeUpdatedEdit=!1,!this._edit)throw new li("UpdatedInnerEdits: No edit to apply changes to");let e=this._applyChanges(this._edit,i);if(!e){this._edit=void 0;return}this._edit=e.edit,this._lastChangeUpdatedEdit=e.editHasChanged}_applyChanges(i,e){let t=i.replaceRange.start,o=i.replaceRange.endExclusive,n=i.newText,r=!1,s=this._prefixLength>0||this._suffixLength>0;for(let l=e.replacements.length-1;l>=0;l--){let c=e.replacements[l],u=c.newText.length>0&&c.replaceRange.isEmpty;if(u&&!s&&c.replaceRange.start===t&&n.startsWith(c.newText)){t+=c.newText.length,n=n.substring(c.newText.length),o+=c.newText.length,r=!0;continue}if(u&&s&&c.replaceRange.start===t+this._prefixLength&&this._trimmedNewText.startsWith(c.newText)){o+=c.newText.length,r=!0,this._prefixLength+=c.newText.length,this._trimmedNewText=this._trimmedNewText.substring(c.newText.length);continue}if(c.newText.length===0&&c.replaceRange.length>0&&c.replaceRange.start>=t+this._prefixLength&&c.replaceRange.endExclusive<=o-this._suffixLength){o-=c.replaceRange.length,r=!0;continue}if(c.equals(i)){r=!0,t=c.replaceRange.endExclusive,n="";continue}if(!(c.replaceRange.start>o)){if(c.replaceRange.endExclusive<t){t+=c.newText.length-c.replaceRange.length,o+=c.newText.length-c.replaceRange.length;continue}return}}return this._trimmedNewText.length===0&&t+this._prefixLength===o-this._suffixLength?{edit:new ed(new pi(t+this._prefixLength,t+this._prefixLength),""),editHasChanged:!0}:{edit:new ed(new pi(t,o),n),editHasChanged:r}}};function qKo(a,i){let e=i.getEOL();return a.replaceRange.isEmpty&&a.newText.includes(e)&&(a=MYi(a,i)),a}function $Ko(a,i,e,t){let o=t.getEOL();if(a.newText.endsWith(o)&&i.endsWith(o)&&(a=new ed(a.replaceRange.deltaEnd(-o.length),a.newText.slice(0,-o.length))),e===1&&a.replaceRange.isEmpty&&a.newText.includes(o)){let n=t.getTransformer().getPosition(a.replaceRange.start);t.getLineLength(n.lineNumber)!==0&&(a=MYi(a,t))}if(e===1){let n=tf(i,a.newText),r=vC(i.slice(n),a.newText.slice(n));if(n+r===i.length)return new ed(a.replaceRange.deltaStart(n).deltaEnd(-r),a.newText.substring(n,a.newText.length-r));if(n+r===a.newText.length)return new ed(a.replaceRange.deltaStart(n).deltaEnd(-r),"")}return a}function MYi(a,i){if(!a.replaceRange.isEmpty)throw new li("Unexpected original range");if(a.replaceRange.start===0)return a;let e=i.getEOL(),t=i.getTransformer().getPosition(a.replaceRange.start),o=t.column,n=t.lineNumber;return o===1&&n>1&&a.newText.endsWith(e)&&!a.newText.startsWith(e)?new ed(a.replaceRange.delta(-1),e+a.newText.slice(0,-e.length)):a}var QKo=!1,ide=new Y("renameInputVisible",!1,d(1559,null)),Cws=new Y("renameInputFocused",!1,d(1558,null)),lke=class{constructor(i,e,t,o,n,r){this._editor=i;this._acceptKeybindings=e;this._themeService=t;this._keybindingService=o;this._logService=r;this.allowEditorOverflow=!0;this._disposables=new N;this._visibleContextKey=ide.bindTo(n),this._isEditingRenameCandidate=!1,this._nRenameSuggestionsInvocations=0,this._hadAutomaticRenameSuggestionsInvocation=!1,this._candidates=new Set,this._beforeFirstInputFieldEditSW=new Dn,this._inputWithButton=new _di,this._disposables.add(this._inputWithButton),this._editor.addContentWidget(this),this._disposables.add(this._editor.onDidChangeConfiguration(s=>{s.hasChanged(59)&&this._updateFont()})),this._disposables.add(t.onDidColorThemeChange(this._updateStyles,this))}dispose(){this._disposables.dispose(),this._editor.removeContentWidget(this)}getId(){return"__renameInputWidget"}getDomNode(){return this._domNode||(this._domNode=document.createElement("div"),this._domNode.className="monaco-editor rename-box",this._domNode.appendChild(this._inputWithButton.domNode),this._renameCandidateListView=this._disposables.add(new Tdi(this._domNode,{fontInfo:this._editor.getOption(59),onFocusChange:i=>{this._inputWithButton.input.value=i,this._isEditingRenameCandidate=!1},onSelectionChange:()=>{this._isEditingRenameCandidate=!1,this.acceptInput(!1)}})),this._disposables.add(this._inputWithButton.onDidInputChange(()=>{this._renameCandidateListView?.focusedCandidate!==void 0&&(this._isEditingRenameCandidate=!0),this._timeBeforeFirstInputFieldEdit??=this._beforeFirstInputFieldEditSW.elapsed(),this._renameCandidateProvidersCts?.token.isCancellationRequested===!1&&this._renameCandidateProvidersCts.cancel(),this._renameCandidateListView?.clearFocus()})),this._label=document.createElement("div"),this._label.className="rename-label",this._domNode.appendChild(this._label),this._updateFont(),this._updateStyles(this._themeService.getColorTheme())),this._domNode}_updateStyles(i){if(!this._domNode)return;let e=i.getColor(kO),t=i.getColor(E_);this._domNode.style.backgroundColor=String(i.getColor(Su)??""),this._domNode.style.boxShadow=e?` 0 0 8px 2px ${e}`:"",this._domNode.style.border=t?`1px solid ${t}`:"",this._domNode.style.color=String(i.getColor(QL)??"");let o=i.getColor(nw);this._inputWithButton.domNode.style.backgroundColor=String(i.getColor(yv)??""),this._inputWithButton.input.style.backgroundColor=String(i.getColor(yv)??""),this._inputWithButton.domNode.style.borderWidth=o?"1px":"0px",this._inputWithButton.domNode.style.borderStyle=o?"solid":"none",this._inputWithButton.domNode.style.borderColor=o?.toString()??"none"}_updateFont(){if(this._domNode===void 0)return;wo(this._label!==void 0,"RenameWidget#_updateFont: _label must not be undefined given _domNode is defined"),this._editor.applyFontInfo(this._inputWithButton.input);let i=this._editor.getOption(59);this._label.style.fontSize=`${this._computeLabelFontSize(i.fontSize)}px`}_computeLabelFontSize(i){return i*.8}getPosition(){if(!this._visible||!this._editor.hasModel()||!this._editor.getDomNode())return null;let i=$m(this.getDomNode().ownerDocument.body),e=ir(this._editor.getDomNode()),t=this._getTopForPosition();this._nPxAvailableAbove=t+e.top,this._nPxAvailableBelow=i.height-this._nPxAvailableAbove;let o=this._editor.getOption(75),{totalHeight:n}=D8e.getLayoutInfo({lineHeight:o}),r=this._nPxAvailableBelow>n*6?[2,1]:[1,2];return{position:this._position,preference:r}}beforeRender(){let[i,e]=this._acceptKeybindings;return this._label.innerText=d(1556,null,this._keybindingService.lookupKeybinding(i)?.getLabel(),this._keybindingService.lookupKeybinding(e)?.getLabel()),this._domNode.style.minWidth="200px",null}afterRender(i){if(i===null){this.cancelInput(!0,"afterRender (because position is null)");return}if(!this._editor.hasModel()||!this._editor.getDomNode())return;wo(this._renameCandidateListView),wo(this._nPxAvailableAbove!==void 0),wo(this._nPxAvailableBelow!==void 0);let e=mh(this._inputWithButton.domNode),t=mh(this._label),o;i===2?o=this._nPxAvailableBelow:o=this._nPxAvailableAbove,this._renameCandidateListView.layout({height:o-t-e,width:zl(this._inputWithButton.domNode)})}acceptInput(i){this._trace("invoking acceptInput"),this._currentAcceptInput?.(i)}cancelInput(i,e){this._currentCancelInput?.(i)}focusNextRenameSuggestion(){this._renameCandidateListView?.focusNext()||(this._inputWithButton.input.value=this._currentName)}focusPreviousRenameSuggestion(){this._renameCandidateListView?.focusPrevious()||(this._inputWithButton.input.value=this._currentName)}getInput(i,e,t,o,n){let{start:r,end:s}=this._getSelection(i,e);this._renameCts=n;let l=new N;this._nRenameSuggestionsInvocations=0,this._hadAutomaticRenameSuggestionsInvocation=!1,o===void 0?this._inputWithButton.button.style.display="none":(this._inputWithButton.button.style.display="flex",this._requestRenameCandidatesOnce=o,this._requestRenameCandidates(e,!1),l.add(j(this._inputWithButton.button,"click",()=>this._requestRenameCandidates(e,!0))),l.add(j(this._inputWithButton.button,re.KEY_DOWN,u=>{let p=new gi(u);(p.equals(3)||p.equals(10))&&(p.stopPropagation(),p.preventDefault(),this._requestRenameCandidates(e,!0))}))),this._isEditingRenameCandidate=!1,this._domNode.classList.toggle("preview",t),this._position=new ye(i.startLineNumber,i.startColumn),this._currentName=e,this._inputWithButton.input.value=e,this._inputWithButton.input.setAttribute("selectionStart",r.toString()),this._inputWithButton.input.setAttribute("selectionEnd",s.toString()),this._inputWithButton.input.size=Math.max((i.endColumn-i.startColumn)*1.1,20),this._beforeFirstInputFieldEditSW.reset(),l.add(Z(()=>{this._renameCts=void 0,n.dispose(!0)})),l.add(Z(()=>{this._renameCandidateProvidersCts!==void 0&&(this._renameCandidateProvidersCts.dispose(!0),this._renameCandidateProvidersCts=void 0)})),l.add(Z(()=>this._candidates.clear()));let c=new Ko;return c.p.finally(()=>{l.dispose(),this._hide()}),this._currentCancelInput=u=>(this._trace("invoking _currentCancelInput"),this._currentAcceptInput=void 0,this._currentCancelInput=void 0,this._renameCandidateListView?.clearCandidates(),c.complete(u),!0),this._currentAcceptInput=u=>{this._trace("invoking _currentAcceptInput"),wo(this._renameCandidateListView!==void 0);let p=this._renameCandidateListView.nCandidates,h,g,f=this._renameCandidateListView.focusedCandidate;if(f!==void 0?(this._trace("using new name from renameSuggestion"),h=f,g={k:"renameSuggestion"}):(this._trace("using new name from inputField"),h=this._inputWithButton.input.value,g=this._isEditingRenameCandidate?{k:"userEditedRenameSuggestion"}:{k:"inputField"}),h===e||h.trim().length===0){this.cancelInput(!0,"_currentAcceptInput (because newName === value || newName.trim().length === 0)");return}this._currentAcceptInput=void 0,this._currentCancelInput=void 0,this._renameCandidateListView.clearCandidates(),c.complete({newName:h,wantsPreview:t&&u,stats:{source:g,nRenameSuggestions:p,timeBeforeFirstInputFieldEdit:this._timeBeforeFirstInputFieldEdit,nRenameSuggestionsInvocations:this._nRenameSuggestionsInvocations,hadAutomaticRenameSuggestionsInvocation:this._hadAutomaticRenameSuggestionsInvocation}})},l.add(n.token.onCancellationRequested(()=>this.cancelInput(!0,"cts.token.onCancellationRequested"))),QKo||l.add(this._editor.onDidBlurEditorWidget(()=>this.cancelInput(!this._domNode?.ownerDocument.hasFocus(),"editor.onDidBlurEditorWidget"))),this._show(),c.p}_requestRenameCandidates(i,e){if(this._requestRenameCandidatesOnce!==void 0&&(this._renameCandidateProvidersCts!==void 0&&this._renameCandidateProvidersCts.dispose(!0),wo(this._renameCts),this._inputWithButton.buttonState!=="stop")){this._renameCandidateProvidersCts=new Ye;let t=e?0:1,o=this._requestRenameCandidatesOnce(t,this._renameCandidateProvidersCts.token);if(o.length===0){this._inputWithButton.setSparkleButton();return}e||(this._hadAutomaticRenameSuggestionsInvocation=!0),this._nRenameSuggestionsInvocations+=1,this._inputWithButton.setStopButton(),this._updateRenameCandidates(o,i,this._renameCts.token)}}_getSelection(i,e){wo(this._editor.hasModel());let t=this._editor.getSelection(),o=0,n=e.length;return!z.isEmpty(t)&&!z.spansMultipleLines(t)&&z.containsRange(i,t)&&(o=Math.max(0,t.startColumn-i.startColumn),n=Math.min(i.endColumn,t.endColumn)-i.startColumn),{start:o,end:n}}_show(){this._trace("invoking _show"),this._editor.revealLineInCenterIfOutsideViewport(this._position.lineNumber,0),this._visible=!0,this._visibleContextKey.set(!0),this._editor.layoutContentWidget(this),setTimeout(()=>{this._inputWithButton.input.focus(),this._inputWithButton.input.setSelectionRange(parseInt(this._inputWithButton.input.getAttribute("selectionStart")),parseInt(this._inputWithButton.input.getAttribute("selectionEnd")))},100)}async _updateRenameCandidates(i,e,t){let o=(...c)=>this._trace("_updateRenameCandidates",...c);o("start");let n=await Va(Promise.allSettled(i),t);if(this._inputWithButton.setSparkleButton(),n===void 0){o("returning early - received updateRenameCandidates results - undefined");return}let r=n.flatMap(c=>c.status==="fulfilled"&&lo(c.value)?c.value:[]);o(`received updateRenameCandidates results - total (unfiltered) ${r.length} candidates.`);let s=zo(r,c=>c.newSymbolName);o(`distinct candidates - ${s.length} candidates.`);let l=s.filter(({newSymbolName:c})=>c.trim().length>0&&c!==this._inputWithButton.input.value&&c!==e&&!this._candidates.has(c));if(o(`valid distinct candidates - ${r.length} candidates.`),l.forEach(c=>this._candidates.add(c.newSymbolName)),l.length<1){o("returning early - no valid distinct candidates");return}o("setting candidates"),this._renameCandidateListView.setCandidates(l),o("asking editor to re-layout"),this._editor.layoutContentWidget(this)}_hide(){this._trace("invoked _hide"),this._visible=!1,this._visibleContextKey.reset(),this._editor.layoutContentWidget(this)}_getTopForPosition(){let i=this._editor.getVisibleRanges(),e;return i.length>0?e=i[0].startLineNumber:(this._logService.warn("RenameWidget#_getTopForPosition: this should not happen - visibleRanges is empty"),e=Math.max(1,this._position.lineNumber-5)),this._editor.getTopForLineNumber(this._position.lineNumber)-this._editor.getTopForLineNumber(e)}_trace(...i){this._logService.trace("RenameWidget",...i)}};lke=I([m(2,Le),m(3,_e),m(4,X),m(5,se)],lke);var Tdi=class a{constructor(i,e){this._disposables=new N,this._availableHeight=0,this._minimumWidth=0,this._lineHeight=e.fontInfo.lineHeight,this._typicalHalfwidthCharacterWidth=e.fontInfo.typicalHalfwidthCharacterWidth,this._listContainer=document.createElement("div"),this._listContainer.className="rename-box rename-candidate-list-container",i.appendChild(this._listContainer),this._listWidget=a._createListWidget(this._listContainer,this._candidateViewHeight,e.fontInfo),this._disposables.add(this._listWidget.onDidChangeFocus(t=>{t.elements.length===1&&e.onFocusChange(t.elements[0].newSymbolName)},this._disposables)),this._disposables.add(this._listWidget.onDidChangeSelection(t=>{t.elements.length===1&&e.onSelectionChange()},this._disposables)),this._disposables.add(this._listWidget.onDidBlur(t=>{this._listWidget.setFocus([])})),this._listWidget.style(uS({listInactiveFocusForeground:j1,listInactiveFocusBackground:Q1}))}dispose(){this._listWidget.dispose(),this._disposables.dispose()}layout({height:i,width:e}){this._availableHeight=i,this._minimumWidth=e}setCandidates(i){this._listWidget.splice(0,0,i);let e=this._pickListHeight(this._listWidget.length),t=this._pickListWidth(i);this._listWidget.layout(e,t),this._listContainer.style.height=`${e}px`,this._listContainer.style.width=`${t}px`,qr(d(1560,null,i.length))}clearCandidates(){this._listContainer.style.height="0px",this._listContainer.style.width="0px",this._listWidget.splice(0,this._listWidget.length,[])}get nCandidates(){return this._listWidget.length}get focusedCandidate(){if(this._listWidget.length===0)return;let i=this._listWidget.getSelectedElements()[0];if(i!==void 0)return i.newSymbolName;let e=this._listWidget.getFocusedElements()[0];if(e!==void 0)return e.newSymbolName}focusNext(){if(this._listWidget.length===0)return!1;let i=this._listWidget.getFocus();if(i.length===0)return this._listWidget.focusFirst(),this._listWidget.reveal(0),!0;if(i[0]===this._listWidget.length-1)return this._listWidget.setFocus([]),this._listWidget.reveal(0),!1;{this._listWidget.focusNext();let e=this._listWidget.getFocus()[0];return this._listWidget.reveal(e),!0}}focusPrevious(){if(this._listWidget.length===0)return!1;let i=this._listWidget.getFocus();if(i.length===0){this._listWidget.focusLast();let e=this._listWidget.getFocus()[0];return this._listWidget.reveal(e),!0}else{if(i[0]===0)return this._listWidget.setFocus([]),!1;{this._listWidget.focusPrevious();let e=this._listWidget.getFocus()[0];return this._listWidget.reveal(e),!0}}}clearFocus(){this._listWidget.setFocus([])}get _candidateViewHeight(){let{totalHeight:i}=D8e.getLayoutInfo({lineHeight:this._lineHeight});return i}_pickListHeight(i){let e=this._candidateViewHeight*i;return Math.min(e,this._availableHeight,this._candidateViewHeight*7)}_pickListWidth(i){let e=Math.ceil(Math.max(...i.map(o=>o.newSymbolName.length))*this._typicalHalfwidthCharacterWidth);return Math.max(this._minimumWidth,25+e+10)}static _createListWidget(i,e,t){let o=new class{getTemplateId(r){return"candidate"}getHeight(r){return e}},n=new class{constructor(){this.templateId="candidate"}renderTemplate(r){return new D8e(r,t)}renderElement(r,s,l){l.populate(r)}disposeTemplate(r){r.dispose()}};return new Cc("NewSymbolNameCandidates",i,o,[n],{keyboardSupport:!1,mouseSupport:!0,multipleSelectionSupport:!1})}},_di=class{constructor(){this._buttonHoverContent="";this._disposables=new N;this._onDidInputChange=this._disposables.add(new E);this.onDidInputChange=this._onDidInputChange.event}get domNode(){return this._domNode||(this._domNode=document.createElement("div"),this._domNode.className="rename-input-with-button",this._domNode.style.display="flex",this._domNode.style.flexDirection="row",this._domNode.style.alignItems="center",this._inputNode=document.createElement("input"),this._inputNode.className="rename-input",this._inputNode.type="text",this._inputNode.style.border="none",this._inputNode.setAttribute("aria-label",d(1557,null)),this._domNode.appendChild(this._inputNode),this._buttonNode=document.createElement("div"),this._buttonNode.className="rename-suggestions-button",this._buttonNode.setAttribute("tabindex","0"),this._buttonGenHoverText=d(1555,null),this._buttonCancelHoverText=d(1554,null),this._buttonHoverContent=this._buttonGenHoverText,this._disposables.add(Up().setupDelayedHover(this._buttonNode,()=>({content:this._buttonHoverContent,style:1}))),this._domNode.appendChild(this._buttonNode),this._disposables.add(j(this.input,re.INPUT,()=>this._onDidInputChange.fire())),this._disposables.add(j(this.input,re.KEY_DOWN,i=>{let e=new gi(i);(e.keyCode===15||e.keyCode===17)&&this._onDidInputChange.fire()})),this._disposables.add(j(this.input,re.CLICK,()=>this._onDidInputChange.fire())),this._disposables.add(j(this.input,re.FOCUS,()=>{this.domNode.style.outlineWidth="1px",this.domNode.style.outlineStyle="solid",this.domNode.style.outlineOffset="-1px",this.domNode.style.outlineColor="var(--vscode-focusBorder)"})),this._disposables.add(j(this.input,re.BLUR,()=>{this.domNode.style.outline="none"}))),this._domNode}get input(){return wo(this._inputNode),this._inputNode}get button(){return wo(this._buttonNode),this._buttonNode}get buttonState(){return this._buttonState}setSparkleButton(){this._buttonState="sparkle",this._sparkleIcon??=Sn(R.sparkle),Rt(this.button),this.button.appendChild(this._sparkleIcon),this.button.setAttribute("aria-label","Generating new name suggestions"),this._buttonHoverContent=this._buttonGenHoverText,this.input.focus()}setStopButton(){this._buttonState="stop",this._stopIcon??=Sn(R.stopCircle),Rt(this.button),this.button.appendChild(this._stopIcon),this.button.setAttribute("aria-label","Cancel generating new name suggestions"),this._buttonHoverContent=this._buttonCancelHoverText,this.input.focus()}dispose(){this._disposables.dispose()}},D8e=class a{static{this._PADDING=2}constructor(i,e){this._domNode=document.createElement("div"),this._domNode.className="rename-box rename-candidate",this._domNode.style.display="flex",this._domNode.style.columnGap="5px",this._domNode.style.alignItems="center",this._domNode.style.height=`${e.lineHeight}px`,this._domNode.style.padding=`${a._PADDING}px`;let t=document.createElement("div");t.style.display="flex",t.style.alignItems="center",t.style.width=t.style.height=`${e.lineHeight*.8}px`,this._domNode.appendChild(t),this._icon=Sn(R.sparkle),this._icon.style.display="none",t.appendChild(this._icon),this._label=document.createElement("div"),Jd(this._label,e),this._domNode.appendChild(this._label),i.appendChild(this._domNode)}populate(i){this._updateIcon(i),this._updateLabel(i)}_updateIcon(i){let e=!!i.tags?.includes(1);this._icon.style.display=e?"inherit":"none"}_updateLabel(i){this._label.innerText=i.newSymbolName}static getLayoutInfo({lineHeight:i}){return{totalHeight:i+a._PADDING*2}}dispose(){}};var cke=class{constructor(i,e,t){this.model=i;this.position=e;this._providerRenameIdx=0;this._providers=t.ordered(i)}hasProvider(){return this._providers.length>0}async resolveRenameLocation(i){let e=[];for(this._providerRenameIdx=0;this._providerRenameIdx<this._providers.length;this._providerRenameIdx++){let o=this._providers[this._providerRenameIdx];if(!o.resolveRenameLocation)break;let n=await o.resolveRenameLocation(this.model,this.position,i);if(n){if(n.rejectReason){e.push(n.rejectReason);continue}return n}}this._providerRenameIdx=0;let t=this.model.getWordAtPosition(this.position);return t?{range:new z(this.position.lineNumber,t.startColumn,this.position.lineNumber,t.endColumn),text:t.word,rejectReason:e.length>0?e.join(`
`):void 0}:{range:z.fromPositions(this.position),text:"",rejectReason:e.length>0?e.join(`
`):void 0}}async provideRenameEdits(i,e){return this._provideRenameEdits(i,this._providerRenameIdx,[],e)}async _provideRenameEdits(i,e,t,o){let n=this._providers[e];if(!n)return{edits:[],rejectReason:t.join(`
`)};let r=await n.provideRenameEdits(this.model,this.position,i,o);if(r){if(r.rejectReason)return this._provideRenameEdits(i,e+1,t.concat(r.rejectReason),o)}else return this._provideRenameEdits(i,e+1,t.concat(d(1548,null)),o);return r}};function PYi(a,i){return a.ordered(i).length>0}async function AYi(a,i,e,t,o){return new cke(i,e,a).provideRenameEdits(t,o??Se.None)}async function Ldi(a,i,e,t){let o=new cke(i,e,a),n=await o.resolveRenameLocation(Se.None);return n?.rejectReason?{edits:[],rejectReason:n.rejectReason}:o.provideRenameEdits(t,Se.None)}var pF=class{constructor(i,e,t,o,n,r,s,l){this.editor=i;this._instaService=e;this._notificationService=t;this._bulkEditService=o;this._progressService=n;this._logService=r;this._configService=s;this._languageFeaturesService=l;this._disposableStore=new N;this._cts=new Ye;this._renameWidget=this._disposableStore.add(this._instaService.createInstance(lke,this.editor,["acceptRenameInput","acceptRenameInputWithPreview"]))}static{this.ID="editor.contrib.renameController"}static get(i){return i.getContribution(pF.ID)}dispose(){this._disposableStore.dispose(),this._cts.dispose(!0)}async run(){let i=this._logService.trace.bind(this._logService,"[rename]");if(this._cts.dispose(!0),this._cts=new Ye,!this.editor.hasModel()){i("editor has no model");return}let e=this.editor.getPosition(),t=new cke(this.editor.getModel(),e,this._languageFeaturesService.renameProvider);if(!t.hasProvider()){i("skeleton has no provider");return}let o=new ek(this.editor,5,void 0,this._cts.token),n;try{i("resolving rename location");let f=t.resolveRenameLocation(o.token);this._progressService.showWhile(f,250),n=await f,i("resolved rename location")}catch(f){f instanceof go?i("resolve rename location cancelled",JSON.stringify(f,null,"	")):(i("resolve rename location failed",f instanceof Error?f:JSON.stringify(f,null,"	")),(typeof f=="string"||Ar(f))&&xu.get(this.editor)?.showMessage(f||d(1553,null),e));return}finally{o.dispose()}if(!n){i("returning early - no loc");return}if(n.rejectReason){i(`returning early - rejected with reason: ${n.rejectReason}`,n.rejectReason),xu.get(this.editor)?.showMessage(n.rejectReason,e);return}if(o.token.isCancellationRequested){i("returning early - cts1 cancelled");return}let r=new ek(this.editor,5,n.range,this._cts.token),s=this.editor.getModel(),l=this._languageFeaturesService.newSymbolNamesProvider.all(s),c=await Promise.all(l.map(async f=>[f,await f.supportsAutomaticNewSymbolNamesTriggerKind??!1])),u=(f,v)=>{let b=c.slice();return f===1&&(b=b.filter(([S,y])=>y)),b.map(([S])=>S.provideNewSymbolNames(s,n.range,f,v))};i("creating rename input field and awaiting its result");let p=this._bulkEditService.hasPreviewHandler()&&this._configService.getValue(this.editor.getModel().uri,"editor.rename.enablePreview"),h=await this._renameWidget.getInput(n.range,n.text,p,l.length>0?u:void 0,r);if(i("received response from rename input field"),typeof h=="boolean"){i(`returning early - rename input field response - ${h}`),h&&this.editor.focus(),r.dispose();return}this.editor.focus(),i("requesting rename edits");let g=Va(t.provideRenameEdits(h.newName,r.token),r.token).then(async f=>{if(!f){i("returning early - no rename edits result");return}if(!this.editor.hasModel()){i("returning early - no model after rename edits are provided");return}if(f.rejectReason){i(`returning early - rejected with reason: ${f.rejectReason}`),this._notificationService.info(f.rejectReason);return}this.editor.setSelection(z.fromPositions(this.editor.getSelection().getPosition())),i("applying edits"),this._bulkEditService.apply(f,{editor:this.editor,showPreview:h.wantsPreview,label:d(1547,null,n?.text,h.newName),code:"undoredo.rename",quotableLabel:d(1549,null,n?.text,h.newName),respectAutoSaveConfig:!0,reason:Wc.rename(n?.text,h.newName)}).then(v=>{i("edits applied"),v.ariaSummary&&en(d(1543,null,n.text,h.newName,v.ariaSummary))}).catch(v=>{i(`error when applying edits ${JSON.stringify(v,null,"	")}`),this._notificationService.error(d(1551,null)),this._logService.error(v)})},f=>{i("error when providing rename edits",JSON.stringify(f,null,"	")),this._notificationService.error(d(1550,null)),this._logService.error(f)}).finally(()=>{r.dispose()});return i("returning rename operation"),this._progressService.showWhile(g,250),g}acceptRenameInput(i){this._renameWidget.acceptInput(i)}cancelRenameInput(){this._renameWidget.cancelInput(!0,"cancelRenameInput command")}focusNextRenameSuggestion(){this._renameWidget.focusNextRenameSuggestion()}focusPreviousRenameSuggestion(){this._renameWidget.focusPreviousRenameSuggestion()}};pF=I([m(1,F),m(2,Ne),m(3,La),m(4,wd),m(5,se),m(6,Fn),m(7,Qt)],pF);var Ddi=class extends Di{constructor(){super({id:"editor.action.rename",label:L(1552,"Rename Symbol"),precondition:C.and(pe.writable,pe.hasRenameProvider),kbOpts:{kbExpr:pe.editorTextFocus,primary:60,weight:100},contextMenuOpts:{group:"1_modification",order:1.1},canTriggerInlineEdits:!0})}runCommand(i,e){let t=i.get(qt),[o,n]=Array.isArray(e)&&e||[void 0,void 0];return A.isUri(o)&&ye.isIPosition(n)?t.openCodeEditor({resource:o},t.getActiveCodeEditor()).then(r=>{r&&(r.setPosition(n),r.invokeWithinContext(s=>(this.reportTelemetry(s,r),this.run(s,r))))},mt):super.runCommand(i,e)}run(i,e){let t=i.get(se),o=pF.get(e);return o?(t.trace("[RenameAction] got controller, running..."),o.run()):(t.trace("[RenameAction] returning early - controller missing"),Promise.resolve())}};xo(pF.ID,pF,4);ni(Ddi);var Rdi=Oc.bindToContribution(pF.get);Xi(new Rdi({id:"acceptRenameInput",precondition:ide,handler:a=>a.acceptRenameInput(!1),kbOpts:{weight:199,kbExpr:C.and(pe.focus,C.not("isComposing")),primary:3}}));Xi(new Rdi({id:"acceptRenameInputWithPreview",precondition:C.and(ide,C.has("config.editor.rename.enablePreview")),handler:a=>a.acceptRenameInput(!0),kbOpts:{weight:199,kbExpr:C.and(pe.focus,C.not("isComposing")),primary:2051}}));Xi(new Rdi({id:"cancelRenameInput",precondition:ide,handler:a=>a.cancelRenameInput(),kbOpts:{weight:199,kbExpr:pe.focus,primary:9,secondary:[1033]}}));W(class extends K{constructor(){super({id:"focusNextRenameSuggestion",title:{...L(1545,"Focus Next Rename Suggestion")},precondition:ide,keybinding:[{primary:18,weight:199}]})}run(i){let e=i.get(qt).getFocusedCodeEditor();if(!e)return;let t=pF.get(e);t&&t.focusNextRenameSuggestion()}});W(class extends K{constructor(){super({id:"focusPreviousRenameSuggestion",title:{...L(1546,"Focus Previous Rename Suggestion")},precondition:ide,keybinding:[{primary:16,weight:199}]})}run(i){let e=i.get(qt).getFocusedCodeEditor();if(!e)return;let t=pF.get(e);t&&t.focusPreviousRenameSuggestion()}});qS("_executeDocumentRenameProvider",function(a,i,e,...t){let[o]=t;wo(typeof o=="string");let{renameProvider:n}=a.get(Qt);return Ldi(n,i,e,o)});qS("_executePrepareRename",async function(a,i,e){let{renameProvider:t}=a.get(Qt),n=await new cke(i,e,t).resolveRenameLocation(Se.None);if(n?.rejectReason)throw new Error(n.rejectReason);return n});ne.as(Jt.Configuration).registerConfiguration({id:"editor",properties:{"editor.rename.enablePreview":{scope:6,description:d(1544,null),default:!0,type:"boolean"}}});var Tkt=le("renameSymbolTrackerService");var _kt=(t=>(t.no="no",t.yes="yes",t.maybe="maybe",t))(_kt||{});(i=>{function a(e){switch(e){case"no":return"no";case"yes":return"yes";case"maybe":return"maybe";default:return"no"}}i.fromString=a})(_kt||={});var Mdi=class{constructor(){}inferRename(i,e,t,o){let n=new z(e.startLineNumber,1,e.endLineNumber,i.getLineMaxColumn(e.endLineNumber)),r=e.startColumn-n.startColumn,s=n.endColumn-e.endColumn,l=i.getValueInRange(n),c=i.getValueInRange(new z(n.startLineNumber,n.startColumn,n.startLineNumber,n.startColumn+r))+t+i.getValueInRange(new z(n.endLineNumber,n.endColumn-s,n.endLineNumber,n.endColumn)),u=[],p=[],h,g,f,v=i.getOffsetAt(n.getStartPosition()),{changes:b}=new xP(new $ae(l),new $ae(c)).ComputeDiff(!0);if(b.length===0)return;let S=[];for(let k of b){if(S.length===0){S.push(k);continue}let T=S[S.length-1],P=k.originalStart-(T.originalStart+T.originalLength);if(P>0){let O=v+T.originalStart+T.originalLength,V=i.getPositionAt(O),H=i.getWordAtPosition(V);if(H){let G=i.getOffsetAt(new ye(V.lineNumber,H.startColumn)),$=i.getOffsetAt(new ye(V.lineNumber,H.endColumn)),J=O+P;if(G<=O&&J<=$&&G<=J&&J<=$){T.originalLength=k.originalStart+k.originalLength-T.originalStart,T.modifiedLength=k.modifiedStart+k.modifiedLength-T.modifiedStart;continue}}}S.push(k)}let y=0;for(let k of S){let T=l.substring(k.originalStart,k.originalStart+k.originalLength),P=c.substring(k.modifiedStart,k.modifiedStart+k.modifiedLength),O=v+k.originalStart,V=i.getPositionAt(O),H=O+k.originalLength,G=i.getPositionAt(H),$=z.fromPositions(V,G),J=P.length-k.originalLength;if(/\s/.test(T)){u.push(new ss($,P)),y+=J;continue}if(T.length>0){o.lastIndex=0;let Ce=o.exec(T);if(Ce===null||Ce.index!==0||Ce[0].length!==T.length){u.push(new ss($,P)),y+=J;continue}}if(/\s/.test(P)){u.push(new ss($,P)),y+=J;continue}if(P.length>0){o.lastIndex=0;let Ce=o.exec(P);if(Ce===null||Ce.index!==0||Ce[0].length!==P.length){u.push(new ss($,P)),y+=J;continue}}let ae=i.getWordAtPosition(V);if(ae===null){u.push(new ss($,P)),y+=J;continue}let he=k.originalStart+1,oe=k.originalLength===0&&k.modifiedLength>0,de;if(oe&&he===ae.endColumn&&ae.endColumn>ae.startColumn?de=this.getTokenAtPosition(i,new ye(V.lineNumber,ae.startColumn)):de=this.getTokenAtPosition(i,V),ae.startColumn!==de.range.startColumn||ae.endColumn!==de.range.endColumn){u.push(new ss($,P)),y+=J;continue}if(de.type===0){let Ce=i.getValueInRange(de.range);if(Ce.length===0){u.push(new ss($,P)),y+=J;continue}if(h===void 0)h=Ce;else if(h!==Ce){u.push(new ss($,P)),y+=J;continue}let xe=i.getOffsetAt(de.range.getStartPosition())-v+y,ze=i.getOffsetAt(de.range.getEndPosition())-v+y;if(Ce=c.substring(xe,ze+J),Ce.length===0){u.push(new ss($,P)),y+=J;continue}if(g===void 0)g=Ce;else if(g!==Ce){u.push(new ss($,P)),y+=J;continue}f===void 0&&(f=de.range.getStartPosition()),h!==void 0&&g!==void 0&&h.length>0&&g.length>0&&h!==g?p.push(new ss(de.range,g)):p.push(new ss($,P)),y+=J}else u.push(new ss($,P)),y+=P.length-k.originalLength}if(h===void 0||g===void 0||f===void 0||h.length===0||g.length===0||h===g)return;o.lastIndex=0;let w=o.exec(h);if(!(w===null||w.index!==0||w[0].length!==h.length)&&(o.lastIndex=0,w=o.exec(g),!(w===null||w.index!==0||w[0].length!==g.length)))return{renames:{edits:p,position:f,oldName:h,newName:g},others:{edits:u}}}getTokenAtPosition(i,e){i.tokenization.tokenizeIfCheap(e.lineNumber);let t=i.tokenization.getLineTokens(e.lineNumber),o=t.findTokenIndexAtOffset(e.column-1);return{type:t.getStandardTokenType(o),range:new z(e.lineNumber,1+t.getStartOffset(o),e.lineNumber,1+t.getEndOffset(o))}}},L8e=class a{constructor(i,e){this.editor=i;this.versionId=e}static create(i,e){let t=i.getFocusedCodeEditor();if(t!==null&&t.getModel()===e)return new a(t,e.getVersionId())}equals(i){return i===void 0?!1:this.editor===i.editor&&this.versionId===i.versionId}},Pdi=class{constructor(i,e,t,o,n,r,s,l,c){this._result=void 0;if(this._commandService=e,this._textModel=o,this._state=n,this._requestUuid=t,this._cancellationTokenSource=new Ye,l===void 0||c===void 0){this._promise=AYi(i.renameProvider,o,r,s,this._cancellationTokenSource.token);return}else this._promise=this.sendNesRenameRequest(o,r,c,s,l)}get requestUuid(){return this._requestUuid}isValid(i){return this._state.equals(L8e.create(i,this._textModel))}cancel(){this._cancellationTokenSource.cancel()}async getCount(){if(this._cancellationTokenSource.token.isCancellationRequested)return 0;let i=await this.getResult();return i===void 0||this._cancellationTokenSource.token.isCancellationRequested?0:i.edits.length}async getWorkspaceEdit(){return this.getResult()}async getResult(){if(!this._cancellationTokenSource.token.isCancellationRequested&&(this._result===void 0&&(this._result=await this._promise),!(this._result.rejectReason||this._cancellationTokenSource.token.isCancellationRequested)))return this._result}async sendNesRenameRequest(i,e,t,o,n){try{let r=await this._commandService.executeCommand("github.copilot.nes.postRename",i.uri,e,t,o,n);if(r===void 0)return{rejectReason:"Rename failed",edits:[]};let s=[];for(let l of r)for(let c of l.changes){let u=new z(c.range.start.line+1,c.range.start.character+1,c.range.end.line+1,c.range.end.character+1),p=new nl(l.file,new ss(u,c.newText??o));s.push(p)}return{edits:s}}catch{return{rejectReason:"Rename failed",edits:[]}}}},dke=class extends x{constructor(e,t,o,n,r,s){super();this._commandService=e;this._languageFeaturesService=t;this._languageConfigurationService=o;this._renameSymbolTrackerService=r;this._codeEditorService=s;this._renameInferenceEngine=new Mdi;this._renameRunnable=void 0;this._register($e.registerCommand(qsi,async(l,c,u)=>{if(!(u===void 0||!u.isValid(this._codeEditorService)))try{let p=await u.getWorkspaceEdit();if(p===void 0)return;n.apply(p,{reason:c})}finally{this._renameRunnable===u&&(this._renameRunnable=void 0)}}))}async proposeRenameRefactoring(e,t,o){if(!t.supportsRename||t.action?.kind!=="edit"||o.selectedSuggestionInfo||!PYi(this._languageFeaturesService.renameProvider,e))return t;let n=L8e.create(this._codeEditorService,e);if(n===void 0)return t;let r=Date.now(),s=t.action.textReplacement,l=this._languageConfigurationService.getLanguageConfiguration(e.getLanguageId()),c=this._renameInferenceEngine.inferRename(e,s.range,s.text,l.wordDefinition);if(c===void 0||c.renames.edits.length===0)return t;let{oldName:u,newName:p,position:h,edits:g}=c.renames,f=this._renameSymbolTrackerService.trackedWord.get(),v;f!==void 0&&f.model===e&&f.originalWord===u&&f.currentWord===p&&(v=f.currentRange);let b=!1,S=await vp(this.checkRenamePrecondition(t,e,h,u,p,v),100,()=>{b=!0}),y=this.isRenamePossible(t,S,n,e);if(t.setRenameProcessingInfo({createdRename:y,duration:Date.now()-r,timedOut:b,droppedOtherEdits:y?c.others.edits.length:void 0,droppedRenameEdits:y?g.length-1:void 0}),!y)return t;this._renameRunnable===void 0&&(this._renameRunnable=new Pdi(this._languageFeaturesService,this._commandService,t.requestUuid,e,n,h,p,v,v!==void 0?u:void 0));let w=Wc.inlineCompletionAccept({nes:t.isInlineEdit,requestUuid:t.requestUuid,providerId:t.source.provider.providerId,languageId:e.getLanguageId(),correlationId:t.getSourceCompletion().correlationId}),k={id:qsi,title:d(1372,null),arguments:[w,this._renameRunnable]},T={label:d(1372,null),icon:R.replaceAll,command:k,count:this._renameRunnable.getCount()},P={kind:"edit",range:g[0].range,insertText:g[0].text,snippetInfo:t.snippetInfo,alternativeAction:T,uri:e.uri},O=sK.snapshot(e);return _8e.create(t.withAction(P),O,!1)}async checkRenamePrecondition(e,t,o,n,r,s){let l={canRename:"no",timedOut:!1};try{let c=await this._commandService.executeCommand("github.copilot.nes.prepareRename",t.uri,o,n,r,e.requestUuid,s);if(c===void 0)return l;if(typeof c=="string"){let u=_kt.fromString(c);return u==="yes"||u==="maybe"?{canRename:u,oldName:n,onOldState:!1}:{canRename:u,timedOut:!1}}else return c}catch{return l}}isRenamePossible(e,t,o,n){return t===void 0||t.canRename==="no"||!o.equals(L8e.create(this._codeEditorService,n))?!1:this._renameRunnable===void 0?!0:this._renameRunnable.requestUuid===e.requestUuid?!1:(this._renameRunnable.cancel(),this._renameRunnable=void 0,!0)}};dke=I([m(0,ge),m(1,Qt),m(2,Rs),m(3,La),m(4,Tkt),m(5,qt)],dke);var oX=class extends x{constructor(e,t,o,n,r,s,l,c,u,p){super();this._textModel=e;this._versionId=t;this._debounceValue=o;this._cursorPosition=n;this._languageConfigurationService=r;this._logService=s;this._configurationService=l;this._instantiationService=c;this._contextKeyService=u;this._textModelService=p;this._updateOperation=this._register(new me);this._state=TYi(this,{initial:()=>({inlineCompletions:lB.createEmpty(),suggestWidgetInlineCompletions:lB.createEmpty()}),disposeFinal:e=>{e.inlineCompletions.dispose(),e.suggestWidgetInlineCompletions.dispose()},changeTracker:_Jt(()=>({versionId:this._versionId})),update:(e,t,o)=>{let n=ld.compose(o.changes.map(r=>r.change?eY(r.change.changes):ld.empty).filter(lo));if(n.isEmpty())return t;try{return{inlineCompletions:t.inlineCompletions.createStateWithAppliedEdit(n,this._textModel),suggestWidgetInlineCompletions:t.suggestWidgetInlineCompletions.createStateWithAppliedEdit(n,this._textModel)}}finally{t.inlineCompletions.dispose(),t.suggestWidgetInlineCompletions.dispose()}}});this.inlineCompletions=this._state.map(this,e=>e.inlineCompletions);this.suggestWidgetInlineCompletions=this._state.map(this,e=>e.suggestWidgetInlineCompletions);this._completionsEnabled=void 0;this.clearOperationOnTextModelChange=ke(this,e=>{this._versionId.read(e),this._updateOperation.clear()});this._loadingCount=Me(this,0);this.loading=this._loadingCount.map(this,e=>e>0);this._loggingEnabled=hr("editor.inlineSuggest.logFetch",!1,this._configurationService).recomputeInitiallyAndOnChange(this._store),this._sendRequestData=hr("editor.inlineSuggest.emptyResponseInformation",!0,this._configurationService).recomputeInitiallyAndOnChange(this._store),this._structuredFetchLogger=this._register(this._instantiationService.createInstance(tX.cast(),"editor.inlineSuggest.logFetch.commandId")),this._renameProcessor=this._store.add(this._instantiationService.createInstance(dke)),this.clearOperationOnTextModelChange.recomputeInitiallyAndOnChange(this._store);let h=ro.defaultChatAgent?.completionsEnablementSetting??void 0;h&&(this._updateCompletionsEnablement(h),this._register(this._configurationService.onDidChangeConfiguration(g=>{g.affectsConfiguration(h)&&this._updateCompletionsEnablement(h)}))),this._state.recomputeInitiallyAndOnChange(this._store)}static{this._requestId=0}_updateCompletionsEnablement(e){let t=this._configurationService.getValue(e);xi(t)?this._completionsEnabled=t:this._completionsEnabled=void 0}_log(e){this._loggingEnabled.get()&&this._logService.info(bYi(e)),this._structuredFetchLogger.log(e)}fetch(e,t,o,n,r,s,l){let c=this._cursorPosition.get(),u=new Adi(c,o,this._textModel.getVersionId(),new Set(e)),p=o.selectedSuggestionInfo?this.suggestWidgetInlineCompletions.get():this.inlineCompletions.get();if(this._updateOperation.value?.request.satisfies(u))return this._updateOperation.value.promise;if(p?.request?.satisfies(u))return Promise.resolve(!0);let h=!!this._updateOperation.value;this._updateOperation.clear();let g=new Ye,f=(async()=>{let b=new N;this._loadingCount.set(this._loadingCount.get()+1,void 0);let S=!1,y=()=>{S||(S=!0,this._loadingCount.set(this._loadingCount.get()-1,void 0))};b.add(new Dt(()=>y(),10*1e3)).schedule();let k=e.filter(P=>P.providerId),T=new Ndi(o,l,k);try{let P=this._debounceValue.get(this._textModel),O=nht(e.map(ze=>ze.debounceDelayMs),P2i(hu))??P;if((h||r&&o.triggerKind===0)&&await udi(O,g.token),g.token.isCancellationRequested||this._store.isDisposed||this._textModel.getVersionId()!==u.versionId)return T.setNoSuggestionReasonIfNotSet("canceled:beforeFetch"),!1;let H=oX._requestId++;(this._loggingEnabled.get()||this._structuredFetchLogger.isEnabled.get())&&this._log({sourceId:"InlineCompletions.fetch",kind:"start",requestId:H,modelUri:this._textModel.uri,modelVersion:this._textModel.getVersionId(),context:{triggerKind:o.triggerKind,suggestInfo:o.selectedSuggestionInfo?!0:void 0},time:Date.now(),provider:t});let G=new Date,$=RYi(e,this._cursorPosition.get(),this._textModel,o,l,this._languageConfigurationService);wdi(g.token,()=>$.cancelAndDispose({kind:"tokenCancellation"}));let J=!1,ae=!1,he=[];for await(let ze of $.lists)if(ze){ze.addRef(),b.add(Z(()=>ze.removeRef(ze.inlineSuggestionsData.length===0?{kind:"empty"}:{kind:"notTaken"})));for(let De of ze.inlineSuggestionsData){if(ae=!0,!o.includeInlineEdits&&(De.isInlineEdit||De.showInlineEditMenu)){De.setNotShownReason("notInlineEditRequested");continue}if(!o.includeInlineCompletions&&!(De.isInlineEdit||De.showInlineEditMenu)){De.setNotShownReason("notInlineCompletionRequested");continue}De.addPerformanceMarker("providerReturned");let Oe=De.action?.uri,pt,et;if(Oe&&Oe.toString()!==this._textModel.uri.toString()){let zi=await this._textModelService.createModelReference(Oe);pt=zi.object.textEditorModel,et=zi}else pt=this._textModel,et=void 0;let Ti=sK.snapshot(pt),Ht=_8e.create(De,Ti);if(et){let zi=Vs(Ht.identity.onDispose,()=>{et?.dispose(),zi.dispose()})}De.addPerformanceMarker("itemCreated"),he.push(Ht),!Ht.isInlineEdit&&!Ht.showInlineEditMenu&&o.triggerKind===0&&Ht.isVisible(this._textModel,this._cursorPosition.get())&&(J=!0)}if(J)break}he.forEach(ze=>ze.addPerformanceMarker("providersResolved"));let oe=await Promise.all(he.map(async ze=>this._renameProcessor.proposeRenameRefactoring(this._textModel,ze,o)));if(oe.forEach(ze=>ze.addPerformanceMarker("renameProcessed")),$.cancelAndDispose({kind:"lostRace"}),this._loggingEnabled.get()||this._structuredFetchLogger.isEnabled.get()){let ze=$.didAllProvidersReturn,De;(g.token.isCancellationRequested||this._store.isDisposed||this._textModel.getVersionId()!==u.versionId)&&(De="canceled");let Oe=oe.map(pt=>{let et=pt.getSourceCompletion();if(et.doNotLog)return;let Ti={insertText:et.insertText,range:et.range,additionalTextEdits:et.additionalTextEdits,uri:et.uri,command:et.command,gutterMenuLinkAction:et.gutterMenuLinkAction,shownCommand:et.shownCommand,completeBracketPairs:et.completeBracketPairs,isInlineEdit:et.isInlineEdit,showInlineEditMenu:et.showInlineEditMenu,showRange:et.showRange,warning:et.warning,hint:et.hint,supportsRename:et.supportsRename,correlationId:et.correlationId,jumpToPosition:et.jumpToPosition};return{...Fx(Ti,Ht=>z.isIRange(Ht)?z.lift(Ht).toString():ye.isIPosition(Ht)?ye.lift(Ht).toString():qae.is(Ht)?{$commandId:Ht.id}:Ht),$providerId:pt.source.provider.providerId?.toString()}}).filter(pt=>pt!==void 0);this._log({sourceId:"InlineCompletions.fetch",kind:"end",requestId:H,durationMs:Date.now()-G.getTime(),error:De,result:Oe,time:Date.now(),didAllProvidersReturn:ze})}if(T.setRequestUuid($.contextWithUuid.requestUuid),ae)T.setHasProducedSuggestion(),oe.length>0&&g.token.isCancellationRequested&&oe.forEach(ze=>ze.setNotShownReasonIfNotSet("canceled:whileAwaitingOtherProviders"));else if(g.token.isCancellationRequested)T.setNoSuggestionReasonIfNotSet("canceled:whileFetching");else{let ze=this._contextKeyService.getContextKeyValue("completionsQuotaExceeded");T.setNoSuggestionReasonIfNotSet(ze?"completionsQuotaExceeded":"noSuggestion")}let de=o.earliestShownDateTime-Date.now();if(de>0&&await udi(de,g.token),oe.forEach(ze=>ze.addPerformanceMarker("minShowDelayPassed")),g.token.isCancellationRequested||this._store.isDisposed||this._textModel.getVersionId()!==u.versionId||s.get()){let ze=g.token.isCancellationRequested?"canceled:afterMinShowDelay":this._store.isDisposed?"canceled:disposed":this._textModel.getVersionId()!==u.versionId?"canceled:documentChanged":s.get()?"canceled:userJumped":"unknown";return oe.forEach(De=>De.setNotShownReasonIfNotSet(ze)),!1}let Ce=new Date;this._debounceValue.update(this._textModel,Ce.getTime()-G.getTime());let xe=this._cursorPosition.get();this._updateOperation.clear(),Gi(ze=>{let De=this._state.get();o.selectedSuggestionInfo?this._state.set({inlineCompletions:lB.createEmpty(),suggestWidgetInlineCompletions:De.suggestWidgetInlineCompletions.createStateWithAppliedResults(oe,u,this._textModel,xe,n)},ze):this._state.set({inlineCompletions:De.inlineCompletions.createStateWithAppliedResults(oe,u,this._textModel,xe,n),suggestWidgetInlineCompletions:lB.createEmpty()},ze),De.inlineCompletions.dispose(),De.suggestWidgetInlineCompletions.dispose()})}finally{b.dispose(),y(),this._sendInlineCompletionsRequestTelemetry(T)}return!0})(),v=new Odi(u,g,f);return this._updateOperation.value=v,f}clear(e){if(this._store.isDisposed)return;this._updateOperation.clear();let t=this._state.get();this._state.set({inlineCompletions:lB.createEmpty(),suggestWidgetInlineCompletions:lB.createEmpty()},e),t.inlineCompletions.dispose(),t.suggestWidgetInlineCompletions.dispose()}seedInlineCompletionsWithSuggestWidget(){let e=this.inlineCompletions.get(),t=this.suggestWidgetInlineCompletions.get();t&&Gi(o=>{if(!e||(t.request?.versionId??-1)>(e.request?.versionId??-1)){e?.dispose();let n=this._state.get();this._state.set({inlineCompletions:t.clone(),suggestWidgetInlineCompletions:lB.createEmpty()},o),n.inlineCompletions.dispose(),n.suggestWidgetInlineCompletions.dispose()}this.clearSuggestWidgetInlineCompletions(o)})}seedWithCompletion(e,t){let o=this._state.get();this._state.set({inlineCompletions:new lB([e],void 0),suggestWidgetInlineCompletions:lB.createEmpty()},t),o.inlineCompletions.dispose(),o.suggestWidgetInlineCompletions.dispose()}_sendInlineCompletionsRequestTelemetry(e){if(!this._sendRequestData.get()&&!this._contextKeyService.getContextKeyValue("isRunningUnificationExperiment")||e.requestUuid===void 0||e.hasProducedSuggestion||!Dvt(this._completionsEnabled,this._textModel.getLanguageId())||!e.providers.some(n=>aB(n.providerId?.extensionId)))return;let t={opportunityId:e.requestUuid,noSuggestionReason:e.noSuggestionReason??"unknown",extensionId:"vscode-core",extensionVersion:"0.0.0",groupId:"empty",shown:!1,skuPlan:e.requestInfo.sku?.plan,skuType:e.requestInfo.sku?.type,editorType:e.requestInfo.editorType,requestReason:e.requestInfo.reason,typingInterval:e.requestInfo.typingInterval,typingIntervalCharacterCount:e.requestInfo.typingIntervalCharacterCount,languageId:e.requestInfo.languageId,selectedSuggestionInfo:!!e.context.selectedSuggestionInfo,availableProviders:e.providers.map(n=>n.providerId?.toString()).filter(lo).join(","),...rK(e.providers.some(n=>aB(n.providerId?.extensionId))),timeUntilProviderRequest:void 0,timeUntilProviderResponse:void 0,viewKind:void 0,preceeded:void 0,superseded:void 0,reason:void 0,acceptedAlternativeAction:void 0,correlationId:void 0,shownDuration:void 0,shownDurationUncollapsed:void 0,timeUntilShown:void 0,partiallyAccepted:void 0,partiallyAcceptedCountSinceOriginal:void 0,partiallyAcceptedRatioSinceOriginal:void 0,partiallyAcceptedCharactersSinceOriginal:void 0,cursorColumnDistance:void 0,cursorLineDistance:void 0,lineCountOriginal:void 0,lineCountModified:void 0,characterCountOriginal:void 0,characterCountModified:void 0,disjointReplacements:void 0,sameShapeReplacements:void 0,longDistanceHintVisible:void 0,longDistanceHintDistance:void 0,notShownReason:void 0,renameCreated:!1,renameDuration:void 0,renameTimedOut:!1,renameDroppedOtherEdits:void 0,renameDroppedRenameEdits:void 0,performanceMarkers:void 0,editKind:void 0},o=this._instantiationService.createInstance(uF);bkt(o,t)}clearSuggestWidgetInlineCompletions(e){this._updateOperation.value?.request.context.selectedSuggestionInfo&&this._updateOperation.clear()}cancelUpdate(){this._updateOperation.clear()}};oX=I([m(4,Rs),m(5,se),m(6,B),m(7,F),m(8,X),m(9,Bt)],oX);var Adi=class{constructor(i,e,t,o){this.position=i;this.context=e;this.versionId=t;this.providers=o}satisfies(i){return this.position.equals(i.position)&&gJt(this.context.selectedSuggestionInfo,i.context.selectedSuggestionInfo,G9())&&(i.context.triggerKind===0||this.context.triggerKind===1)&&this.versionId===i.versionId&&YKo(i.providers,this.providers)}get isExplicitRequest(){return this.context.triggerKind===1}},Ndi=class{constructor(i,e,t){this.context=i;this.requestInfo=e;this.providers=t;this.hasProducedSuggestion=!1}setRequestUuid(i){this.requestUuid=i}setNoSuggestionReasonIfNotSet(i){this.noSuggestionReason??=i}setHasProducedSuggestion(){this.hasProducedSuggestion=!0}};function YKo(a,i){return[...a].every(e=>i.has(e))}var Odi=class{constructor(i,e,t){this.request=i;this.cancellationTokenSource=e;this.promise=t}dispose(){this.cancellationTokenSource.cancel()}},lB=class a extends x{constructor(e,t){super();this.inlineCompletions=e;this.request=t;for(let o of this.inlineCompletions)o.addRef();this._register({dispose:()=>{for(let o of this.inlineCompletions)o.removeRef()}})}static createEmpty(){return new a([],void 0)}_findById(e){return this.inlineCompletions.find(t=>t.identity===e)}_findByHash(e){return this.inlineCompletions.find(t=>t.hash===e)}createStateWithAppliedEdit(e,t){let o=this.inlineCompletions.map(n=>n.withEdit(e,t)).filter(lo);return new a(o,this.request)}createStateWithAppliedResults(e,t,o,n,r){let s;if(r){let u=this._findById(r);if(u&&u.canBeReused(o,t.position)){s=u;let p=e.find(h=>h.hash===u.hash);p?e=JKo(p,e):e=[u,...e]}}let l=s?!s.isInlineEdit:e.some(u=>!u.isInlineEdit&&u.isVisible(o,n)),c=[];for(let u of e){let p=this._findByHash(u.hash),h;p&&p!==u?(h=u.withIdentity(p.identity),u.setIsPreceeded(p),p.setEndOfLifeReason({kind:2,userTypingDisagreed:!1,supersededBy:u.getSourceCompletion()})):h=u,l!==h.isInlineEdit&&c.push(h)}return c.sort(cl(u=>u.showInlineEditMenu,uht)),c=XKo(c,u=>u.semanticId),new a(c,t)}clone(){return new a(this.inlineCompletions,this.request)}};function XKo(a,i){let e=new Set;return a.filter(t=>{let o=i(t);return e.has(o)?!1:(e.add(o),!0)})}function JKo(a,i){let e=i.indexOf(a);return e>-1?[a,...i.slice(0,e),...i.slice(e+1)]:i}var w5=le("IInlineCompletionsService"),OYi=new Y("inlineCompletions.snoozed",!1,d(192,null)),ode=class extends x{constructor(e,t){super();this._contextKeyService=e;this._telemetryService=t;this._onDidChangeIsSnoozing=this._register(new E);this.onDidChangeIsSnoozing=this._onDidChangeIsSnoozing.event;this._snoozeTimeEnd=void 0;this._recentCompletionIds=[];this._timer=this._register(new Ul);let o=OYi.bindTo(this._contextKeyService);this._register(this.onDidChangeIsSnoozing(()=>o.set(this.isSnoozing())))}static{this.SNOOZE_DURATION=3e5}get snoozeTimeLeft(){return this._snoozeTimeEnd===void 0?0:Math.max(0,this._snoozeTimeEnd-Date.now())}snooze(e=ode.SNOOZE_DURATION){this.setSnoozeDuration(e+this.snoozeTimeLeft)}setSnoozeDuration(e){if(e<0)throw new li(`Invalid snooze duration: ${e}. Duration must be non-negative.`);if(e===0){this.cancelSnooze();return}let t=this.isSnoozing(),o=this.snoozeTimeLeft;this._snoozeTimeEnd=Date.now()+e,t||this._onDidChangeIsSnoozing.fire(!0),this._timer.cancelAndSet(()=>{if(!this.isSnoozing())this._onDidChangeIsSnoozing.fire(!1);else throw new li("Snooze timer did not fire as expected")},this.snoozeTimeLeft+1),this._reportSnooze(e-o,e)}isSnoozing(){return this.snoozeTimeLeft>0}cancelSnooze(){this.isSnoozing()&&(this._reportSnooze(-this.snoozeTimeLeft,0),this._snoozeTimeEnd=void 0,this._timer.cancel(),this._onDidChangeIsSnoozing.fire(!1))}reportNewCompletion(e){this._lastCompletionId=e,this._recentCompletionIds.unshift(e),this._recentCompletionIds.length>5&&this._recentCompletionIds.pop()}_reportSnooze(e,t){let o=Math.round(e/1e3),n=Math.round(t/1e3);this._telemetryService.publicLog2("inlineCompletions.snooze",{deltaSeconds:o,totalSeconds:n,lastCompletionId:this._lastCompletionId,recentCompletionIds:this._recentCompletionIds})}};ode=I([m(0,X),m(1,Te)],ode);Ee(w5,ode,1);var ZKo="editor.action.inlineSuggest.snooze",e2o="editor.action.inlineSuggest.cancelSnooze",NYi="inlineCompletions.lastSnoozeDuration",Dkt=class a extends K{static{this.ID=ZKo}constructor(){super({id:a.ID,title:L(191,"Snooze Inline Suggestions"),precondition:C.true(),f1:!0})}async run(i,...e){let t=i.get(Ue),o=i.get(w5),n=i.get(ce),r;e.length>0&&typeof e[0]=="number"&&(r=e[0]*6e4),r||(r=await this.getDurationFromUser(t,n)),r&&o.setSnoozeDuration(r)}async getDurationFromUser(i,e){let t=e.getNumber(NYi,0,3e5),o=[{label:"1 minute",id:"1",value:6e4},{label:"5 minutes",id:"5",value:3e5},{label:"10 minutes",id:"10",value:6e5},{label:"15 minutes",id:"15",value:9e5},{label:"30 minutes",id:"30",value:18e5},{label:"60 minutes",id:"60",value:36e5}],n=await i.pick(o,{placeHolder:d(193,null),activeItem:o.find(r=>r.value===t)});if(n)return e.store(NYi,n.value,0,0),n.value}},Lkt=class a extends K{static{this.ID=e2o}constructor(){super({id:a.ID,title:L(190,"Cancel Snooze Inline Suggestions"),precondition:OYi,f1:!0})}async run(i){i.get(w5).cancelSnooze()}};var Rkt=class a extends x{constructor(e){super();this._textModel=e;this._typingSessions=[];this._currentSession=null;this._lastChangeTime=0;this._cachedTypingIntervalResult=null;this._cacheInvalidated=!0;this._register(this._textModel.onDidChangeContent(t=>this._updateTypingSpeed(t)))}static{this.MAX_SESSION_GAP_MS=3e3}static{this.MIN_SESSION_DURATION_MS=1e3}static{this.SESSION_HISTORY_LIMIT=50}static{this.TYPING_SPEED_WINDOW_MS=3e5}static{this.MIN_CHARS_FOR_RELIABLE_SPEED=20}getTypingInterval(){return(this._cacheInvalidated||this._cachedTypingIntervalResult===null)&&(this._cachedTypingIntervalResult=this._calculateTypingInterval(),this._cacheInvalidated=!1),this._cachedTypingIntervalResult}_updateTypingSpeed(e){let t=Date.now();if(!this._isUserTyping(e)){this._finalizeCurrentSession();return}this._currentSession&&t-this._lastChangeTime>a.MAX_SESSION_GAP_MS&&this._finalizeCurrentSession(),this._currentSession||(this._currentSession={startTime:t,endTime:t,characterCount:0}),this._currentSession.endTime=t,this._currentSession.characterCount+=this._getActualCharacterCount(e),this._lastChangeTime=t,this._cacheInvalidated=!0}_getActualCharacterCount(e){let t=0;for(let o of e.changes)t+=Math.max(o.text.length,o.rangeLength);return t}_isUserTyping(e){if(!e.detailedReasons||e.detailedReasons.length===0)return!1;for(let t of e.detailedReasons)if(this._isUserTypingReason(t))return!0;return!1}_isUserTypingReason(e){if(e.metadata.isUndoing||e.metadata.isRedoing)return!1;if(e.metadata.source==="cursor"){let t=e.metadata.kind;return t==="type"||t==="compositionType"||t==="compositionEnd"}else return!1}_finalizeCurrentSession(){if(!this._currentSession)return;this._currentSession.endTime-this._currentSession.startTime>=a.MIN_SESSION_DURATION_MS&&this._currentSession.characterCount>0&&(this._typingSessions.push(this._currentSession),this._typingSessions.length>a.SESSION_HISTORY_LIMIT&&this._typingSessions.shift()),this._currentSession=null}_calculateTypingInterval(){if(this._currentSession){let e={...this._currentSession};if(e.endTime-e.startTime>=a.MIN_SESSION_DURATION_MS&&e.characterCount>0){let o=[...this._typingSessions,e];return this._calculateSpeedFromSessions(o)}}return this._calculateSpeedFromSessions(this._typingSessions)}_calculateSpeedFromSessions(e){if(e.length===0)return{averageInterval:0,characterCount:0};let t=[...e].sort((p,h)=>h.endTime-p.endTime),o=Date.now()-a.TYPING_SPEED_WINDOW_MS,n=t.filter(p=>p.endTime>o),r=t.splice(n.length),s=FSe(n.map(p=>p.characterCount));for(let p=0;p<r.length&&s<a.MIN_CHARS_FOR_RELIABLE_SPEED;p++)n.push(r[p]),s+=r[p].characterCount;let l=FSe(n.map(p=>p.endTime-p.startTime));if(l===0||s<=1)return{averageInterval:0,characterCount:s};let c=Math.max(1,s-1),u=l/c;return{averageInterval:Math.round(u),characterCount:s}}reset(){this._typingSessions.length=0,this._currentSession=null,this._lastChangeTime=0,this._cachedTypingIntervalResult=null,this._cacheInvalidated=!0}dispose(){this._finalizeCurrentSession(),super.dispose()}};var ng=le("defaultAccountService");var FYi;function Mkt(a){return FYi?.(a)??null}function WYi(a){FYi=a}var uke=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super();this.textModel=e;this._selectedSuggestItem=t;this._textModelVersionId=o;this._positions=n;this._debounceValue=r;this._enabled=s;this._editor=l;this._instantiationService=c;this._commandService=u;this._languageConfigurationService=p;this._accessibilityService=h;this._languageFeaturesService=g;this._codeEditorService=f;this._inlineCompletionsService=v;this._isActive=Me(this,!1);this._onlyRequestInlineEditsSignal=wc(this);this._forceUpdateExplicitlySignal=wc(this);this._noDelaySignal=wc(this);this._fetchSpecificProviderSignal=wc(this);this._selectedInlineCompletionId=Me(this,void 0);this.primaryPosition=ke(this,e=>this._positions.read(e)[0]??new ye(1,1));this.allPositions=ke(this,e=>this._positions.read(e));this.sku=Me(this,void 0);this._isAcceptingPartially=!1;this._appearedInsideViewport=ke(this,e=>{let t=this.state.read(e);return!t||!t.inlineSuggestion?!1:Bdi(this._editor,t.inlineSuggestion)});this._onDidAccept=this._register(new E);this.onDidAccept=this._onDidAccept.event;this._lastShownInlineCompletionInfo=void 0;this._lastAcceptedInlineCompletionInfo=void 0;this._didUndoInlineEdits=kIe({owner:this,changeTracker:{createChangeSummary:()=>({didUndo:!1}),handleChange:(e,t)=>(t.didUndo=e.didChange(this._textModelVersionId)&&!!e.change?.isUndoing,!0)}},(e,t)=>{let o=this._textModelVersionId.read(e);return o!==null&&this._lastAcceptedInlineCompletionInfo&&this._lastAcceptedInlineCompletionInfo.textModelVersionIdAfter===o-1&&this._lastAcceptedInlineCompletionInfo.inlineCompletion.isInlineEdit&&t.didUndo?(this._lastAcceptedInlineCompletionInfo=void 0,!0):!1});this._preserveCurrentCompletionReasons=new Set([1,0,2]);this.dontRefetchSignal=wc(this);this._fetchInlineCompletionsPromise=kIe({owner:this,changeTracker:{createChangeSummary:()=>({dontRefetch:!1,preserveCurrentCompletion:!1,inlineCompletionTriggerKind:0,onlyRequestInlineEdits:!1,shouldDebounce:!0,provider:void 0,changeHint:void 0,textChange:!1,changeReason:""}),handleChange:(e,t)=>{if(e.didChange(this._textModelVersionId)){this._preserveCurrentCompletionReasons.has(this._getReason(e.change))&&(t.preserveCurrentCompletion=!0);let o=e.change?.detailedReasons??[];t.changeReason=o.length>0?o[0].getType():"",t.textChange=!0}else e.didChange(this._forceUpdateExplicitlySignal)?(t.preserveCurrentCompletion=!0,t.inlineCompletionTriggerKind=1):e.didChange(this.dontRefetchSignal)?t.dontRefetch=!0:e.didChange(this._onlyRequestInlineEditsSignal)?t.onlyRequestInlineEdits=!0:e.didChange(this._fetchSpecificProviderSignal)&&(t.provider=e.change?.provider,t.changeHint=e.change?.changeHint);return!0}}},(e,t)=>{if(this._source.clearOperationOnTextModelChange.read(e),this._noDelaySignal.read(e),this.dontRefetchSignal.read(e),this._onlyRequestInlineEditsSignal.read(e),this._forceUpdateExplicitlySignal.read(e),this._fetchSpecificProviderSignal.read(e),!((this._enabled.read(e)&&this._selectedSuggestItem.read(e)||this._isActive.read(e))&&(!this._inlineCompletionsService.isSnoozing()||t.inlineCompletionTriggerKind===1))){this._source.cancelUpdate();return}this._textModelVersionId.read(e);let n=this._source.suggestWidgetInlineCompletions.read(void 0),r=this._selectedSuggestItem.read(e);if(this._shouldShowOnSuggestConflict.read(void 0)&&(r=void 0),n&&!r&&this._source.seedInlineCompletionsWithSuggestWidget(),t.dontRefetch)return Promise.resolve(!0);if(this._didUndoInlineEdits.read(e)&&t.inlineCompletionTriggerKind!==1){Gi(b=>{this._source.clear(b)});return}let s="";t.provider?s+="providerOnDidChange":t.inlineCompletionTriggerKind===1&&(s+="explicit"),t.changeReason&&(s+=s.length>0?`:${t.changeReason}`:t.changeReason);let l=this._typing.getTypingInterval(),c={editorType:this.editorType,startTime:Date.now(),languageId:this.textModel.getLanguageId(),reason:s,typingInterval:l.averageInterval,typingIntervalCharacterCount:l.characterCount,availableProviders:[],sku:this.sku.read(void 0)},u={triggerKind:t.inlineCompletionTriggerKind,selectedSuggestionInfo:r?.toSelectedSuggestionInfo(),includeInlineCompletions:!t.onlyRequestInlineEdits,includeInlineEdits:this._inlineEditsEnabled.read(e),requestIssuedDateTime:c.startTime,earliestShownDateTime:c.startTime+(t.inlineCompletionTriggerKind===1||this.inAcceptFlow.read(void 0)?0:this._minShowDelay.read(void 0)),changeHint:t.changeHint};u.triggerKind===0&&t.textChange&&this.textModel.getAlternativeVersionId()===this._lastShownInlineCompletionInfo?.alternateTextModelVersionId&&(u={...u,includeInlineCompletions:!this._lastShownInlineCompletionInfo.inlineCompletion.isInlineEdit,includeInlineEdits:this._lastShownInlineCompletionInfo.inlineCompletion.isInlineEdit});let p=this.selectedInlineCompletion.read(void 0)??this._inlineSuggestionItems.read(void 0)?.inlineEdit,h=t.preserveCurrentCompletion||p?.forwardStable?p:void 0,g=this._jumpedToId.map(b=>!!b&&b===this._inlineSuggestionItems.read(void 0)?.inlineEdit?.semanticId),f=t.provider?{providers:[t.provider],label:"single:"+t.provider.providerId?.toString()}:{providers:this._languageFeaturesService.inlineCompletionsProvider.all(this.textModel),label:void 0},v=this.getAvailableProviders(f.providers);return c.availableProviders=v.map(b=>b.providerId).filter(lo),this._source.fetch(v,f.label,u,h?.identity,t.shouldDebounce,g,c)});this._inlineSuggestionItems=Os({owner:this},e=>{let t=this._source.inlineCompletions.read(e);if(!t)return;let o=this.primaryPosition.read(e),n,r=[];for(let s of t.inlineCompletions)s.isInlineEdit?n=s:s.isVisible(this.textModel,o)&&r.push(s);return r.length!==0&&(n=void 0),{inlineCompletions:r,inlineEdit:n}});this._inlineCompletionItems=Os({owner:this,equalsFn:iO()},e=>this._inlineSuggestionItems.read(e)?.inlineCompletions??[]);this.selectedInlineCompletionIndex=ke(this,e=>{let t=this._selectedInlineCompletionId.read(e),o=this._inlineCompletionItems.read(e),n=this._selectedInlineCompletionId===void 0?-1:o.findIndex(r=>r.semanticId===t);return n===-1?(this._selectedInlineCompletionId.set(void 0,void 0),0):n});this.selectedInlineCompletion=ke(this,e=>{let t=this._inlineCompletionItems.read(e),o=this.selectedInlineCompletionIndex.read(e);return t[o]});this.activeCommands=Os({owner:this,equalsFn:iO()},e=>this.selectedInlineCompletion.read(e)?.source.inlineSuggestions.commands??[]);this.inlineCompletionsCount=ke(this,e=>{if(this.lastTriggerKind.read(e)===1)return this._inlineCompletionItems.read(e).length});this._hasVisiblePeekWidgets=ke(this,e=>this._editorObs.openedPeekWidgets.read(e)>0);this._shouldShowOnSuggestConflict=ke(this,e=>{let t=this._showOnSuggestConflict.read(e);if(t!=="never"&&!!this.selectedInlineCompletion.read(e)){let n=this._selectedSuggestItem.read(e);return n?t==="whenSuggestListIsIncomplete"?n.listIncomplete:!0:!1}return!1});this.state=Os({owner:this,equalsFn:(e,t)=>!e||!t?e===t:e.kind==="ghostText"&&t.kind==="ghostText"?pdi(e.ghostTexts,t.ghostTexts)&&e.inlineSuggestion===t.inlineSuggestion&&e.suggestItem===t.suggestItem:e.kind==="inlineEdit"&&t.kind==="inlineEdit"?e.inlineSuggestion===t.inlineSuggestion:!1},e=>{let t=this.textModel;if(this._suppressInSnippetMode.read(e)&&this._isInSnippetMode.read(e))return;let o=this._inlineSuggestionItems.read(e),n=o?.inlineEdit;if(n){if(this._hasVisiblePeekWidgets.read(e))return;let s=this.primaryPosition.map(p=>uo.fromRangeInclusive(n.targetRange).addMargin(1,1).contains(p.lineNumber)),l=n.action?.kind==="edit"?n.action.stringEdit:void 0,c=l?Vp.fromStringEdit(l,new pR(this.textModel)).replacements:[],u=(o.inlineEdit?.command?.id==="vscode.open"||o.inlineEdit?.command?.id==="_workbench.open")&&o.inlineEdit?.command.arguments?.length?A.from(o.inlineEdit?.command.arguments[0]):void 0;return n.originalTextRef.targets(this.textModel)||(u=n.originalTextRef.uri),{kind:"inlineEdit",inlineSuggestion:n,edits:c,cursorAtInlineEdit:s,nextEditUri:u}}let r=this._selectedSuggestItem.read(e);if(!this._shouldShowOnSuggestConflict.read(e)&&r){let s=zP(r.getSingleTextEdit(),t),l=this._computeAugmentation(s,e);if(!this._suggestPreviewEnabled.read(e)&&!l)return;let u=l?.edit??s,p=l?l.edit.text.length-s.text.length:0,h=this._suggestPreviewMode.read(e),g=this._positions.read(e),v=[u,...Fdi(this.textModel,g,u)].map((w,k)=>({edit:w,ghostText:w?hdi(w,t,h,g[k],p):void 0})).filter(({edit:w,ghostText:k})=>w!==void 0&&k!==void 0),b=v.map(({edit:w})=>w),S=v.map(({ghostText:w})=>w),y=S[0]??new nK(u.range.endLineNumber,[]);return{kind:"ghostText",edits:b,primaryGhostText:y,ghostTexts:S,inlineSuggestion:l?.completion,suggestItem:r}}else{if(!this._isActive.read(e))return;let s=this.selectedInlineCompletion.read(e);if(!s)return;let l=s.getSingleTextEdit(),c=this._inlineSuggestMode.read(e),u=this._positions.read(e),h=[l,...Fdi(this.textModel,u,l)].map((v,b)=>({edit:v,ghostText:v?hdi(v,t,c,u[b],0):void 0})).filter(({edit:v,ghostText:b})=>v!==void 0&&b!==void 0),g=h.map(({edit:v})=>v),f=h.map(({ghostText:v})=>v);return f[0]?{kind:"ghostText",edits:g,primaryGhostText:f[0],ghostTexts:f,inlineSuggestion:s,suggestItem:void 0}:void 0}});this.status=ke(this,e=>{if(this._source.loading.read(e))return"loading";let t=this.state.read(e);return t?.kind==="ghostText"?"ghostText":t?.kind==="inlineEdit"?"inlineEdit":"noSuggestion"});this.inlineCompletionState=ke(this,e=>{let t=this.state.read(e);if(!(!t||t.kind!=="ghostText")&&!this._editorObs.inComposition.read(e))return t});this.inlineEditState=ke(this,e=>{let t=this.state.read(e);if(!(!t||t.kind!=="inlineEdit"))return t});this.inlineEditAvailable=ke(this,e=>!!this.inlineEditState.read(e));this.warning=ke(this,e=>this.inlineCompletionState.read(e)?.inlineSuggestion?.warning);this.ghostTexts=Os({owner:this,equalsFn:pdi},e=>{let t=this.inlineCompletionState.read(e);if(t)return t.ghostTexts});this.primaryGhostText=Os({owner:this,equalsFn:mdi},e=>{let t=this.inlineCompletionState.read(e);if(t)return t?.primaryGhostText});this.showCollapsed=ke(this,e=>{let t=this.state.read(e);if(!t||t.kind!=="inlineEdit"||t.inlineSuggestion.hint||t.inlineSuggestion.action?.kind==="jumpTo")return!1;let o=t.inlineSuggestion.updatedEditModelVersion===this._textModelVersionId.read(e);return(this._inlineEditsShowCollapsedEnabled.read(e)||!o)&&this._jumpedToId.read(e)!==t.inlineSuggestion.semanticId&&!this._inAcceptFlow.read(e)});this._tabShouldIndent=ke(this,e=>{if(this._inAcceptFlow.read(e))return!1;function t(r){return r.startLineNumber!==r.endLineNumber}function o(r,s){let l=r.getLineIndentColumn(s),c=r.getLineLastNonWhitespaceColumn(s),u=Math.max(c,l);return new z(s,l,s,u)}return this._editorObs.selections.read(e)?.some(r=>r.isEmpty()?this.textModel.getLineLength(r.startLineNumber)===0:t(r)||r.containsRange(o(this.textModel,r.startLineNumber)))});this.tabShouldJumpToInlineEdit=ke(this,e=>{if(this._tabShouldIndent.read(e))return!1;let t=this.inlineEditState.read(e);return t?t.inlineSuggestion.action?.kind==="jumpTo"||this.showCollapsed.read(e)?!0:this._inAcceptFlow.read(e)&&this._appearedInsideViewport.read(e)?!1:!t.cursorAtInlineEdit.read(e):!1});this.tabShouldAcceptInlineEdit=ke(this,e=>{let t=this.inlineEditState.read(e);return!t||t.inlineSuggestion.action?.kind==="jumpTo"||this.showCollapsed.read(e)||this._tabShouldIndent.read(e)?!1:this._inAcceptFlow.read(e)&&this._appearedInsideViewport.read(e)||t.inlineSuggestion.targetRange.startLineNumber===this._editorObs.cursorLineNumber.read(e)||this._jumpedToId.read(e)===t.inlineSuggestion.semanticId?!0:t.cursorAtInlineEdit.read(e)});this._jumpedToId=Me(this,void 0);this._inAcceptFlow=Me(this,!1);this.inAcceptFlow=this._inAcceptFlow;this._source=this._register(this._instantiationService.createInstance(oX,this.textModel,this._textModelVersionId,this._debounceValue,this.primaryPosition)),this.lastTriggerKind=this._source.inlineCompletions.map(this,P=>P?.request?.context.triggerKind),this._editorObs=gs(this._editor);let S=this._editorObs.getOption(134);this._suggestPreviewEnabled=S.map(P=>P.preview),this._suggestPreviewMode=S.map(P=>P.previewMode);let y=this._editorObs.getOption(71);this._inlineSuggestMode=y.map(P=>P.mode),this._suppressedInlineCompletionGroupIds=y.map(P=>new Set(P.experimental.suppressInlineSuggestions.split(","))),this._inlineEditsEnabled=y.map(P=>!!P.edits.enabled),this._inlineEditsShowCollapsedEnabled=y.map(P=>P.edits.showCollapsed),this._triggerCommandOnProviderChange=y.map(P=>P.triggerCommandOnProviderChange),this._minShowDelay=y.map(P=>P.minShowDelay),this._showOnSuggestConflict=y.map(P=>P.experimental.showOnSuggestConflict),this._suppressInSnippetMode=y.map(P=>P.suppressInSnippetMode);let w=vs.get(this._editor);this._isInSnippetMode=w?.isInSnippetObservable??So(!1),b.getDefaultAccount().then(i2o(P=>this.sku.set(VYi(P),void 0),this._store)),this._register(b.onDidChangeDefaultAccount(P=>this.sku.set(VYi(P),void 0))),this._typing=this._register(new Rkt(this.textModel)),this._register(this._inlineCompletionsService.onDidChangeIsSnoozing(P=>{P&&this.stop()}));{let P=this.textModel.uri.scheme===Q.vscodeNotebookCell,[O]=this._codeEditorService.listDiffEditors().filter(V=>V.getOriginalEditor().getId()===this._editor.getId()||V.getModifiedEditor().getId()===this._editor.getId());this.isInDiffEditor=!!O,this.editorType=P?"notebook":this.isInDiffEditor?"diffEditor":"textEditor"}this._register(fP(this.state,P=>{P&&P.inlineSuggestion&&this._inlineCompletionsService.reportNewCompletion(P.inlineSuggestion.requestUuid)})),this._register(fP(this._fetchInlineCompletionsPromise)),this._register(be(P=>{this._editorObs.versionId.read(P),this._inAcceptFlow.set(!1,void 0)})),this._register(be(P=>{this.state.map((V,H)=>!V||V.kind==="inlineEdit"&&!V.cursorAtInlineEdit.read(H)).read(P)&&this._jumpedToId.set(void 0,void 0)})),this._register(be(P=>{let O=this.state.map(V=>V?.inlineSuggestion).read(P);O&&O.addPerformanceMarker("activeSuggestion")}));let k=this.inlineEditState.map(P=>P?.inlineSuggestion.semanticId);this._register(be(P=>{k.read(P)&&(this._editor.pushUndoStop(),this._lastShownInlineCompletionInfo={alternateTextModelVersionId:this.textModel.getAlternativeVersionId(),inlineCompletion:this.state.get().inlineSuggestion})}));let T=ui(this._languageFeaturesService.inlineCompletionsProvider.onDidChange,()=>this._languageFeaturesService.inlineCompletionsProvider.all(e));ob(this,T,(P,O)=>{P.onDidChangeInlineCompletions&&O.add(P.onDidChangeInlineCompletions(V=>{if(!this._enabled.get()||(this._codeEditorService.getFocusedCodeEditor()||this._codeEditorService.getActiveCodeEditor())!==this._editor)return;if(this._triggerCommandOnProviderChange.get()){this.trigger(void 0,{onlyFetchInlineEdits:!0});return}let G=this.state.get();G&&(G.inlineSuggestion||G.edits)&&G.inlineSuggestion?.source.provider!==P||Gi($=>{this._fetchSpecificProviderSignal.trigger($,{provider:P,changeHint:V??void 0}),this.trigger($)})}))}).recomputeInitiallyAndOnChange(this._store),this._didUndoInlineEdits.recomputeInitiallyAndOnChange(this._store)}get isAcceptingPartially(){return this._isAcceptingPartially}get editor(){return this._editor}debugGetSelectedSuggestItem(){return this._selectedSuggestItem}getIndentationInfo(e){let t=!1,o=!0,n=this?.primaryGhostText.read(e);if(this?._selectedSuggestItem&&n&&n.parts.length>0){let{column:r,lines:s}=n.parts[0],l=s[0].line,c=this.textModel.getLineIndentColumn(n.lineNumber);if(r<=c){let p=nm(l);p===-1&&(p=l.length-1),t=p>0;let h=this.textModel.getOptions().tabSize;o=fl.visibleColumnFromColumn(l,p+1,h)<h}}return{startsWithIndentation:t,startsWithIndentationLessThanTabSize:o}}_getReason(e){return e?.isUndoing?0:e?.isRedoing?1:this.isAcceptingPartially?2:3}getAvailableProviders(e){let t=this._suppressedInlineCompletionGroupIds.get(),o=e.filter(s=>!(s.groupId&&t.has(s.groupId))),n=new Set;for(let s of o)s.excludesGroupIds?.forEach(l=>n.add(l));let r=[];for(let s of o)s.groupId&&n.has(s.groupId)||r.push(s);return r}async trigger(e,t={}){nO(e,o=>{t.onlyFetchInlineEdits&&this._onlyRequestInlineEditsSignal.trigger(o),t.noDelay&&this._noDelaySignal.trigger(o),this._isActive.set(!0,o),t.explicit&&(this._inAcceptFlow.set(!0,o),this._forceUpdateExplicitlySignal.trigger(o)),t.provider&&this._fetchSpecificProviderSignal.trigger(o,{provider:t.provider,changeHint:t.changeHint})}),await this._fetchInlineCompletionsPromise.get()}async triggerExplicitly(e,t=!1){return this.trigger(e,{onlyFetchInlineEdits:t,explicit:!0})}stop(e="automatic",t){nO(t,o=>{if(e==="explicitCancel"){let n=this.state.get()?.inlineSuggestion;n&&n.reportEndOfLife({kind:1})}this._isActive.set(!1,o),this._source.clear(o)})}_computeAugmentation(e,t){let o=this.textModel,n=this._source.suggestWidgetInlineCompletions.read(t),r=n?n.inlineCompletions.filter(l=>!l.isInlineEdit):[this.selectedInlineCompletion.read(t)].filter(lo);return d_(r,l=>{let c=l.getSingleTextEdit();return c=zP(c,o,z.fromPositions(c.range.getStartPosition(),e.range.getEndPosition())),fkt(c,e)?{completion:l,edit:c}:void 0})}async _deltaSelectedInlineCompletionIndex(e){await this.triggerExplicitly();let t=this._inlineCompletionItems.get()||[];if(t.length>0){let o=(this.selectedInlineCompletionIndex.get()+e+t.length)%t.length;this._selectedInlineCompletionId.set(t[o].semanticId,void 0)}else this._selectedInlineCompletionId.set(void 0,void 0)}async next(){await this._deltaSelectedInlineCompletionIndex(1)}async previous(){await this._deltaSelectedInlineCompletionIndex(-1)}_getMetadata(e,t,o=void 0){return o?Wc.inlineCompletionPartialAccept({nes:e.isInlineEdit,requestUuid:e.requestUuid,providerId:e.source.provider.providerId,languageId:t,type:o,correlationId:e.getSourceCompletion().correlationId}):Wc.inlineCompletionAccept({nes:e.isInlineEdit,requestUuid:e.requestUuid,correlationId:e.getSourceCompletion().correlationId,providerId:e.source.provider.providerId,languageId:t})}async accept(e=this._editor,t=!1){if(e.getModel()!==this.textModel)throw new li;let o,n=!1,r=this.state.get();if(r?.kind==="ghostText"){if(!r||r.primaryGhostText.isEmpty()||!r.inlineSuggestion)return;o=r.inlineSuggestion}else if(r?.kind==="inlineEdit")o=r.inlineSuggestion,n=!!r.nextEditUri;else return;o.addRef();try{let s=!1;if(e.pushUndoStop(),o.originalTextRef.targets(this.textModel)){if(!n){if(o.action?.kind==="edit"){let l=o.action;if(t&&l.alternativeAction){s=!0;let c=l.alternativeAction.command;await this._commandService.executeCommand(c.id,...c.arguments||[]).then(void 0,ys)}else if(l.snippetInfo){let c=ss.delete(l.textReplacement.range),u=o.additionalTextEdits.map(h=>new ss(z.lift(h.range),h.text??"")),p=Vp.fromParallelReplacementsUnsorted([c,...u]);e.edit(p,this._getMetadata(o,this.textModel.getLanguageId())),e.setPosition(l.snippetInfo.range.getStartPosition(),"inlineCompletionAccept"),vs.get(e)?.insert(l.snippetInfo.snippet,{undoStopBefore:!1})}else{let c=r.edits,u=c;r.kind==="ghostText"&&(u=wYi(c,this.textModel));let p=ddi(u).map(f=>ti.fromPositions(f)),h=o.additionalTextEdits.map(f=>new ss(z.lift(f.range),f.text??"")),g=Vp.fromParallelReplacementsUnsorted([...c,...h]);if(e.edit(g,this._getMetadata(o,this.textModel.getLanguageId())),o.hint===void 0&&e.setSelections(r.kind==="inlineEdit"?p.slice(-1):p,"inlineCompletionAccept"),r.kind==="inlineEdit"&&!this._accessibilityService.isMotionReduced()){let f=g.getNewRanges(),v=this._store.add(new Wdi(e,f,()=>{this._store.delete(v)}))}}}}}else{let l=await this._codeEditorService.openCodeEditor({resource:o.originalTextRef.uri},this._editor);if(l){let u=Mkt(l)?.model.get();l.focus(),u?.transplantCompletion(o),l.revealLineInCenter(o.targetRange.startLineNumber)}}this._onDidAccept.fire(),this.stop(),o.command&&await this._commandService.executeCommand(o.command.id,...o.command.arguments||[]).then(void 0,ys),s&&this.trigger(void 0),o.reportEndOfLife({kind:0,alternativeAction:t})}finally{o.removeRef(),this._inAcceptFlow.set(!0,void 0),this._lastAcceptedInlineCompletionInfo={textModelVersionIdAfter:this.textModel.getVersionId(),inlineCompletion:o}}}async acceptNextWord(){await this._acceptNext(this._editor,"word",(e,t)=>{let o=this.textModel.getLanguageIdAtPosition(e.lineNumber,e.column),n=this._languageConfigurationService.getLanguageConfiguration(o),r=new RegExp(n.wordDefinition.source,n.wordDefinition.flags.replace("g","")),s=t.match(r),l=0;s&&s.index!==void 0?s.index===0?l=s[0].length:l=s.index:l=t.length;let u=/\s+/g.exec(t);return u&&u.index!==void 0&&u.index+u[0].length<l&&(l=u.index+u[0].length),l},0)}async acceptNextLine(){await this._acceptNext(this._editor,"line",(e,t)=>{let o=t.match(/\n/);return o&&o.index!==void 0?o.index+1:t.length},1)}async _acceptNext(e,t,o,n){if(e.getModel()!==this.textModel)throw new li;let r=this.inlineCompletionState.get();if(!r||r.primaryGhostText.isEmpty()||!r.inlineSuggestion)return;let s=r.primaryGhostText,l=r.inlineSuggestion;if(l.snippetInfo){await this.accept(e);return}let c=s.parts[0],u=new ye(s.lineNumber,c.column),p=c.text,h=o(u,p);if(h===p.length&&s.parts.length===1){this.accept(e);return}let g=p.substring(0,h),f=this._positions.get(),v=f[0];l.addRef();try{this._isAcceptingPartially=!0;try{e.pushUndoStop();let w=z.fromPositions(v,u),k=e.getModel().getValueInRange(w)+g,T=new ss(w,k),P=[T,...Fdi(this.textModel,f,T)].filter(lo),O=ddi(P).map(V=>ti.fromPositions(V));e.edit(Vp.fromParallelReplacementsUnsorted(P),this._getMetadata(l,t)),e.setSelections(O,"inlineCompletionPartialAccept"),e.revealPositionInCenterIfOutsideViewport(e.getPosition(),0)}finally{this._isAcceptingPartially=!1}let b=z.fromPositions(l.editRange.getStartPosition(),pc.ofText(g).addToPosition(u)),y=e.getModel().getValueInRange(b,1).length;l.reportPartialAccept(y,{kind:n,acceptedLength:y},{characters:h,ratio:h/p.length,count:1})}finally{l.removeRef()}}handleSuggestAccepted(e){let t=zP(e.getSingleTextEdit(),this.textModel),o=this._computeAugmentation(t,void 0);if(!o)return;let r=this.textModel.getValueInRange(o.completion.editRange,1).length+t.text.length;o.completion.reportPartialAccept(t.text.length,{kind:2,acceptedLength:r},{characters:t.text.length,count:1,ratio:1})}extractReproSample(){let e=this.textModel.getValue(),t=this.state.get()?.inlineSuggestion;return{documentValue:e,inlineCompletion:t?.getSourceCompletion()}}jump(){let e=this.inlineEditState.get();if(!e)return;let t=e.inlineSuggestion;if(!t.originalTextRef.targets(this.textModel)){this.accept(this._editor);return}t.addRef();try{Gi(o=>{t.action?.kind==="jumpTo"&&(this.stop(void 0,o),t.reportEndOfLife({kind:0,alternativeAction:!1})),this._jumpedToId.set(e.inlineSuggestion.semanticId,o),this.dontRefetchSignal.trigger(o);let n=e.inlineSuggestion.targetRange,r=n.getStartPosition();if(this._editor.setPosition(r,"inlineCompletions.jump"),n.isSingleLine()&&(e.inlineSuggestion.hint||e.inlineSuggestion.action?.kind==="edit"&&!e.inlineSuggestion.action.textReplacement.text.includes(`
`))||e.inlineSuggestion.action?.kind==="jumpTo")this._editor.revealPosition(r,0);else{let l=new z(n.startLineNumber-1,1,n.endLineNumber+1,1);this._editor.revealRange(l,0)}e.inlineSuggestion.identity.setJumpTo(o),this._editor.focus()})}finally{t.removeRef()}}async handleInlineSuggestionShown(e,t,o,n){await e.reportInlineEditShown(this._commandService,t,o,this.textModel,n)}transplantCompletion(e){e.addRef(),Gi(t=>{this._source.seedWithCompletion(e,t),this._isActive.set(!0,t),this._inAcceptFlow.set(!0,t),this.dontRefetchSignal.trigger(t)})}};uke=I([m(7,F),m(8,ge),m(9,Rs),m(10,Oi),m(11,Qt),m(12,qt),m(13,w5),m(14,ng)],uke);function Fdi(a,i,e){if(i.length===1)return[];let t=new pR(a),o=t.getTransformer(),n=o.getOffset(i[0]),r=i.slice(1).map(h=>o.getOffset(h));e=e.removeCommonPrefixAndSuffix(t);let s=o.getStringReplacement(e),l=s.replaceRange.start-n,c=s.replaceRange.join(pi.emptyAt(n)),u=t.getValueOfOffsetRange(c);return r.map(h=>{let g=h+l,f=g+s.replaceRange.length,v=new pi(g,f),b=v.join(pi.emptyAt(h));if(t.getValueOfOffsetRange(b)!==u)return;let y=new ed(v,s.newText);return o.getTextReplacement(y)}).filter(lo)}var Wdi=class extends x{constructor(i,e,t){super(),t&&this._register({dispose:()=>t()}),this._register(gs(i).setDecorations(So(e.map(r=>({range:r,options:{description:"animation",className:"edits-fadeout-decoration",zIndex:1}})))));let o=new k8e(1,0,1e3,xYi),n=new gkt(o);this._register(be(r=>{let s=n.getValue(r);i.getContainerDomNode().style.setProperty("--animation-opacity",s.toString()),o.isFinished()&&this.dispose()}))}};function Bdi(a,i,e=void 0){let t=i.targetRange;gs(a).scrollTop.read(e);let o=a.getVisibleRanges();return o.length<1?!1:new z(o[0].startLineNumber,o[0].startColumn,o[o.length-1].endLineNumber,o[o.length-1].endColumn).containsRange(t)}function VYi(a){if(a?.entitlementsData?.access_type_sku&&a?.entitlementsData?.copilot_plan)return{type:a.entitlementsData.access_type_sku,plan:a.entitlementsData.copilot_plan}}var Vdi=class{constructor(i){this.handler=i=>this._cb?.(i);this._cb=i}dispose(){this._cb=void 0}};function i2o(a,i){let e=new Vdi(a);return i.add(e),e.handler}var R8e=class{constructor(i){this.name=i}select(i,e,t){if(t.length===0)return 0;let o=t[0].score[0];for(let n=0;n<t.length;n++){let{score:r,completion:s}=t[n];if(r[0]!==o)break;if(s.preselect)return n}return 0}},Pkt=class extends R8e{constructor(){super("first")}memorize(i,e,t){}toJSON(){}fromJSON(){}},Hdi=class extends R8e{constructor(){super("recentlyUsed");this._cache=new dl(300,.66);this._seq=0}memorize(e,t,o){let n=`${e.getLanguageId()}/${o.textLabel}`;this._cache.set(n,{touch:this._seq++,type:o.completion.kind,insertText:o.completion.insertText})}select(e,t,o){if(o.length===0)return 0;let n=e.getLineContent(t.lineNumber).substr(t.column-10,t.column-1);if(/\s$/.test(n))return super.select(e,t,o);let r=o[0].score[0],s=-1,l=-1,c=-1;for(let u=0;u<o.length&&o[u].score[0]===r;u++){let p=`${e.getLanguageId()}/${o[u].textLabel}`,h=this._cache.peek(p);if(h&&h.touch>c&&h.type===o[u].completion.kind&&h.insertText===o[u].completion.insertText&&(c=h.touch,l=u),o[u].completion.preselect&&s===-1)return s=u}return l!==-1?l:s!==-1?s:0}toJSON(){return this._cache.toJSON()}fromJSON(e){this._cache.clear();let t=0;for(let[o,n]of e)n.touch=t,n.type=typeof n.type=="number"?n.type:A1.fromString(n.type),this._cache.set(o,n);this._seq=this._cache.size}},Udi=class extends R8e{constructor(){super("recentlyUsedByPrefix");this._trie=Sp.forStrings();this._seq=0}memorize(e,t,o){let{word:n}=e.getWordUntilPosition(t),r=`${e.getLanguageId()}/${n}`;this._trie.set(r,{type:o.completion.kind,insertText:o.completion.insertText,touch:this._seq++})}select(e,t,o){let{word:n}=e.getWordUntilPosition(t);if(!n)return super.select(e,t,o);let r=`${e.getLanguageId()}/${n}`,s=this._trie.get(r);if(s||(s=this._trie.findSubstr(r)),s)for(let l=0;l<o.length;l++){let{kind:c,insertText:u}=o[l].completion;if(c===s.type&&u===s.insertText)return l}return super.select(e,t,o)}toJSON(){let e=[];return this._trie.forEach((t,o)=>e.push([o,t])),e.sort((t,o)=>-(t[1].touch-o[1].touch)).forEach((t,o)=>t[1].touch=o),e.slice(0,200)}fromJSON(e){if(this._trie.clear(),e.length>0){this._seq=e[0][1].touch+1;for(let[t,o]of e)o.type=typeof o.type=="number"?o.type:A1.fromString(o.type),this._trie.set(t,o)}}},C5=class{constructor(i,e){this._storageService=i;this._configService=e;this._disposables=new N;this._persistSoon=new Dt(()=>this._saveState(),500),this._disposables.add(i.onWillSaveState(t=>{t.reason===1&&this._saveState()}))}static{this._strategyCtors=new Map([["recentlyUsedByPrefix",Udi],["recentlyUsed",Hdi],["first",Pkt]])}static{this._storagePrefix="suggest/memories"}dispose(){this._disposables.dispose(),this._persistSoon.dispose()}memorize(i,e,t){this._withStrategy(i,e).memorize(i,e,t),this._persistSoon.schedule()}select(i,e,t){return this._withStrategy(i,e).select(i,e,t)}_withStrategy(i,e){let t=this._configService.getValue("editor.suggestSelection",{overrideIdentifier:i.getLanguageIdAtPosition(e.lineNumber,e.column),resource:i.uri});if(this._strategy?.name!==t){this._saveState();let o=C5._strategyCtors.get(t)||Pkt;this._strategy=new o;try{let r=this._configService.getValue("editor.suggest.shareSuggestSelections")?0:1,s=this._storageService.get(`${C5._storagePrefix}/${t}`,r);s&&this._strategy.fromJSON(JSON.parse(s))}catch{}}return this._strategy}_saveState(){if(this._strategy){let e=this._configService.getValue("editor.suggest.shareSuggestSelections")?0:1,t=JSON.stringify(this._strategy);this._storageService.store(`${C5._storagePrefix}/${this._strategy.name}`,t,e,1)}}};C5=I([m(0,ce),m(1,B)],C5);var pke=le("ISuggestMemories");Ee(pke,C5,1);var x5=class{constructor(i,e){this._editor=i;this._enabled=!1;this._ckAtEnd=x5.AtEnd.bindTo(e),this._configListener=this._editor.onDidChangeConfiguration(t=>t.hasChanged(139)&&this._update()),this._update()}static{this.AtEnd=new Y("atEndOfWord",!1,{type:"boolean",description:d(1656,null)})}dispose(){this._configListener.dispose(),this._selectionListener?.dispose(),this._ckAtEnd.reset()}_update(){let i=this._editor.getOption(139)==="on";if(this._enabled!==i)if(this._enabled=i,this._enabled){let e=()=>{if(!this._editor.hasModel()){this._ckAtEnd.set(!1);return}let t=this._editor.getModel(),o=this._editor.getSelection(),n=t.getWordAtPosition(o.getStartPosition());if(!n){this._ckAtEnd.set(!1);return}this._ckAtEnd.set(n.endColumn===o.getStartPosition().column&&o.getStartPosition().lineNumber===o.getEndPosition().lineNumber)};this._selectionListener=this._editor.onDidChangeCursorSelection(e),e()}else this._selectionListener&&(this._ckAtEnd.reset(),this._selectionListener.dispose(),this._selectionListener=void 0)}};x5=I([m(1,X)],x5);var KP=class{constructor(i,e){this._editor=i;this._index=0;this._ckOtherSuggestions=KP.OtherSuggestions.bindTo(e)}static{this.OtherSuggestions=new Y("hasOtherSuggestions",!1)}dispose(){this.reset()}reset(){this._ckOtherSuggestions.reset(),this._listener?.dispose(),this._model=void 0,this._acceptNext=void 0,this._ignore=!1}set({model:i,index:e},t){if(i.items.length===0){this.reset();return}if(KP._moveIndex(!0,i,e)===e){this.reset();return}this._acceptNext=t,this._model=i,this._index=e,this._listener=this._editor.onDidChangeCursorPosition(()=>{this._ignore||this.reset()}),this._ckOtherSuggestions.set(!0)}static _moveIndex(i,e,t){let o=t;for(let n=e.items.length;n>0&&(o=(o+e.items.length+(i?1:-1))%e.items.length,!(o===t||!e.items[o].completion.additionalTextEdits));n--);return o}next(){this._move(!0)}prev(){this._move(!1)}_move(i){if(this._model)try{this._ignore=!0,this._index=KP._moveIndex(i,this._model,this._index),this._acceptNext({index:this._index,item:this._model.items[this._index],model:this._model})}finally{this._ignore=!1}}};KP=I([m(1,X)],KP);var mke=class a{async provideSelectionRanges(i,e){let t=[];for(let o of e){let n=[];t.push(n);let r=new Map;await new Promise(s=>a._bracketsRightYield(s,0,i,o,r)),await new Promise(s=>a._bracketsLeftYield(s,0,i,o,r,n))}return t}static{this._maxDuration=30}static{this._maxRounds=2}static _bracketsRightYield(i,e,t,o,n){let r=new Map,s=Date.now();for(;;){if(e>=a._maxRounds){i();break}if(!o){i();break}let l=t.bracketPairs.findNextBracket(o);if(!l){i();break}if(Date.now()-s>a._maxDuration){setTimeout(()=>a._bracketsRightYield(i,e+1,t,o,n));break}if(l.bracketInfo.isOpeningBracket){let u=l.bracketInfo.bracketText,p=r.has(u)?r.get(u):0;r.set(u,p+1)}else{let u=l.bracketInfo.getOpeningBrackets()[0].bracketText,p=r.has(u)?r.get(u):0;if(p-=1,r.set(u,Math.max(0,p)),p<0){let h=n.get(u);h||(h=new qs,n.set(u,h)),h.push(l.range)}}o=l.range.getEndPosition()}}static _bracketsLeftYield(i,e,t,o,n,r){let s=new Map,l=Date.now();for(;;){if(e>=a._maxRounds&&n.size===0){i();break}if(!o){i();break}let c=t.bracketPairs.findPrevBracket(o);if(!c){i();break}if(Date.now()-l>a._maxDuration){setTimeout(()=>a._bracketsLeftYield(i,e+1,t,o,n,r));break}if(c.bracketInfo.isOpeningBracket){let p=c.bracketInfo.bracketText,h=s.has(p)?s.get(p):0;if(h-=1,s.set(p,Math.max(0,h)),h<0){let g=n.get(p);if(g){let f=g.shift();g.size===0&&n.delete(p);let v=z.fromPositions(c.range.getEndPosition(),f.getStartPosition()),b=z.fromPositions(c.range.getStartPosition(),f.getEndPosition());r.push({range:v}),r.push({range:b}),a._addBracketLeading(t,b,r)}}}else{let p=c.bracketInfo.getOpeningBrackets()[0].bracketText,h=s.has(p)?s.get(p):0;s.set(p,h+1)}o=c.range.getStartPosition()}}static _addBracketLeading(i,e,t){if(e.startLineNumber===e.endLineNumber)return;let o=e.startLineNumber,n=i.getLineFirstNonWhitespaceColumn(o);n!==0&&n!==e.startColumn&&(t.push({range:z.fromPositions(new ye(o,n),e.getEndPosition())}),t.push({range:z.fromPositions(new ye(o,1),e.getEndPosition())}));let r=o-1;if(r>0){let s=i.getLineFirstNonWhitespaceColumn(r);s===e.startColumn&&s!==i.getLineLastNonWhitespaceColumn(r)&&(t.push({range:z.fromPositions(new ye(r,s),e.getEndPosition())}),t.push({range:z.fromPositions(new ye(r,1),e.getEndPosition())}))}}};var hke=class a{static{this.None=new class extends a{distance(){return 0}}}static async create(i,e){if(!e.getOption(134).localityBonus||!e.hasModel())return a.None;let t=e.getModel(),o=e.getPosition();if(!i.canComputeWordRanges(t.uri))return a.None;let[n]=await new mke().provideSelectionRanges(t,[o]);if(n.length===0)return a.None;let r=await i.computeWordRanges(t.uri,n[0].range);if(!r)return a.None;let s=t.getWordUntilPosition(o);return delete r[s.word],new class extends a{distance(l,c){if(!o.equals(e.getPosition()))return 0;if(c.kind===17)return 2<<20;let u=typeof c.label=="string"?c.label:c.label.label,p=r[u];if($N(p))return 2<<20;let h=Px(p,z.fromPositions(l),z.compareRangesUsingStarts),g=h>=0?p[h]:p[Math.max(0,~h-1)],f=n.length;for(let v of n){if(!z.containsRange(v.range,g))break;f-=1}return f}}}};var M8e=class{constructor(i,e){this.leadingLineContent=i;this.characterCountDelta=e}};var gke=class a{constructor(i,e,t,o,n,r,s=Bj.default,l=void 0){this.clipboardText=l;this._snippetCompareFn=a._compareCompletionItems;this._items=i,this._column=e,this._wordDistance=o,this._options=n,this._refilterKind=1,this._lineContext=t,this._fuzzyScoreOptions=s,r==="top"?this._snippetCompareFn=a._compareCompletionItemsSnippetsUp:r==="bottom"&&(this._snippetCompareFn=a._compareCompletionItemsSnippetsDown)}get lineContext(){return this._lineContext}set lineContext(i){(this._lineContext.leadingLineContent!==i.leadingLineContent||this._lineContext.characterCountDelta!==i.characterCountDelta)&&(this._refilterKind=this._lineContext.characterCountDelta<i.characterCountDelta&&this._filteredItems?2:1,this._lineContext=i)}get items(){return this._ensureCachedState(),this._filteredItems}getItemsByProvider(){return this._ensureCachedState(),this._itemsByProvider}getIncompleteProvider(){this._ensureCachedState();let i=new Set;for(let[e,t]of this.getItemsByProvider())t.length>0&&t[0].container.incomplete&&i.add(e);return i}get stats(){return this._ensureCachedState(),this._stats}_ensureCachedState(){this._refilterKind!==0&&this._createCachedState()}_createCachedState(){this._itemsByProvider=new Map;let i=[],{leadingLineContent:e,characterCountDelta:t}=this._lineContext,o="",n="",r=this._refilterKind===1?this._items:this._filteredItems,s=[],l=!this._options.filterGraceful||r.length>2e3?rR:Eyt;for(let c=0;c<r.length;c++){let u=r[c];if(u.isInvalid)continue;let p=this._itemsByProvider.get(u.provider);p?p.push(u):this._itemsByProvider.set(u.provider,[u]);let h=u.position.column-u.editStart.column,g=h+t-(u.position.column-this._column);if(o.length!==g&&(o=g===0?"":e.slice(-g),n=o.toLowerCase()),u.word=o,g===0)u.score=kv.Default;else{let f=0;for(;f<h;){let v=o.charCodeAt(f);if(v===32||v===9)f+=1;else break}if(f>=g)u.score=kv.Default;else if(typeof u.completion.filterText=="string"){let v=l(o,n,f,u.completion.filterText,u.filterTextLow,0,this._fuzzyScoreOptions);if(!v)continue;OI(u.completion.filterText,u.textLabel)===0?u.score=v:(u.score=pQi(o,n,f,u.textLabel,u.labelLow,0),u.score[0]=v[0])}else{let v=l(o,n,f,u.textLabel,u.labelLow,0,this._fuzzyScoreOptions);if(!v)continue;u.score=v}}u.idx=c,u.distance=this._wordDistance.distance(u.position,u.completion),s.push(u),i.push(u.textLabel.length)}this._filteredItems=s.sort(this._snippetCompareFn),this._refilterKind=0,this._stats={pLabelLen:i.length?_9(i.length-.85,i,(c,u)=>c-u):0}}static _compareCompletionItems(i,e){return i.score[0]>e.score[0]?-1:i.score[0]<e.score[0]?1:i.distance<e.distance?-1:i.distance>e.distance?1:i.idx<e.idx?-1:i.idx>e.idx?1:0}static _compareCompletionItemsSnippetsDown(i,e){if(i.completion.kind!==e.completion.kind){if(i.completion.kind===28)return 1;if(e.completion.kind===28)return-1}return a._compareCompletionItems(i,e)}static _compareCompletionItemsSnippetsUp(i,e){if(i.completion.kind!==e.completion.kind){if(i.completion.kind===28)return-1;if(e.completion.kind===28)return 1}return a._compareCompletionItems(i,e)}};var k5=class{static shouldAutoTrigger(i){if(!i.hasModel())return!1;let e=i.getModel(),t=i.getPosition();e.tokenization.tokenizeIfCheap(t.lineNumber);let o=e.getWordAtPosition(t);return!(!o||o.endColumn!==t.column&&o.startColumn+1!==t.column||!isNaN(Number(o.word)))}constructor(i,e,t){this.leadingLineContent=i.getLineContent(e.lineNumber).substr(0,e.column-1),this.leadingWord=i.getWordUntilPosition(e),this.lineNumber=e.lineNumber,this.column=e.column,this.triggerOptions=t}};function o2o(a,i,e){if(!i.getContextKeyValue(Ha.inlineSuggestionVisible.key))return!0;let t=i.getContextKeyValue(Ha.suppressSuggestions.key);return t!==void 0?!t:!a.getOption(71).suppressSuggestions}function n2o(a,i,e){if(!i.getContextKeyValue("inlineSuggestionVisible"))return!0;let t=i.getContextKeyValue(Ha.suppressSuggestions.key);return t!==void 0?!t:!a.getOption(71).suppressSuggestions}var aK=class{constructor(i,e,t,o,n,r,s,l,c){this._editor=i;this._editorWorkerService=e;this._clipboardService=t;this._telemetryService=o;this._logService=n;this._contextKeyService=r;this._configurationService=s;this._languageFeaturesService=l;this._envService=c;this._toDispose=new N;this._triggerCharacterListener=new N;this._triggerQuickSuggest=new Ul;this._triggerState=void 0;this._completionDisposables=new N;this._onDidCancel=new E;this._onDidTrigger=new E;this._onDidSuggest=new E;this.onDidCancel=this._onDidCancel.event;this.onDidTrigger=this._onDidTrigger.event;this.onDidSuggest=this._onDidSuggest.event;this._currentSelection=this._editor.getSelection()||new ti(1,1,1,1),this._toDispose.add(this._editor.onDidChangeModel(()=>{this._updateTriggerCharacters(),this.cancel()})),this._toDispose.add(this._editor.onDidChangeModelLanguage(()=>{this._updateTriggerCharacters(),this.cancel()})),this._toDispose.add(this._editor.onDidChangeConfiguration(()=>{this._updateTriggerCharacters()})),this._toDispose.add(this._languageFeaturesService.completionProvider.onDidChange(()=>{this._updateTriggerCharacters(),this._updateActiveSuggestSession()}));let u=!1;this._toDispose.add(this._editor.onDidCompositionStart(()=>{u=!0})),this._toDispose.add(this._editor.onDidCompositionEnd(()=>{u=!1,this._onCompositionEnd()})),this._toDispose.add(this._editor.onDidChangeCursorSelection(p=>{u||this._onCursorChange(p)})),this._toDispose.add(this._editor.onDidChangeModelContent(()=>{!u&&this._triggerState!==void 0&&this._refilterCompletionItems()})),this._updateTriggerCharacters()}dispose(){Be(this._triggerCharacterListener),Be([this._onDidCancel,this._onDidSuggest,this._onDidTrigger,this._triggerQuickSuggest]),this._waitForInlineCompletions?.dispose(),this._toDispose.dispose(),this._completionDisposables.dispose(),this.cancel()}_updateTriggerCharacters(){if(this._triggerCharacterListener.clear(),this._editor.getOption(104)||!this._editor.hasModel()||!this._editor.getOption(137))return;let i=new Map;for(let t of this._languageFeaturesService.completionProvider.all(this._editor.getModel()))for(let o of t.triggerCharacters||[]){let n=i.get(o);if(!n){n=new Set;let r=hYi();r&&n.add(r),i.set(o,n)}n.add(t)}let e=t=>{if(!n2o(this._editor,this._contextKeyService,this._configurationService)||k5.shouldAutoTrigger(this._editor))return;if(!t){let r=this._editor.getPosition();t=this._editor.getModel().getLineContent(r.lineNumber).substr(0,r.column-1)}let o="";ZN(t.charCodeAt(t.length-1))?ju(t.charCodeAt(t.length-2))&&(o=t.substr(t.length-2)):o=t.charAt(t.length-1);let n=i.get(o);if(n){let r=new Map;if(this._completionModel)for(let[s,l]of this._completionModel.getItemsByProvider())n.has(s)||r.set(s,l);this.trigger({auto:!0,triggerKind:1,triggerCharacter:o,retrigger:!!this._completionModel,clipboardText:this._completionModel?.clipboardText,completionOptions:{providerFilter:n,providerItemsToReuse:r}})}};this._triggerCharacterListener.add(this._editor.onDidType(e)),this._triggerCharacterListener.add(this._editor.onDidCompositionEnd(()=>e()))}get state(){return this._triggerState?this._triggerState.auto?2:1:0}cancel(i=!1){this._triggerQuickSuggest.cancel(),this._waitForInlineCompletions?.dispose(),this._waitForInlineCompletions=void 0,this._triggerState!==void 0&&(this._requestToken?.cancel(),this._requestToken=void 0,this._triggerState=void 0,this._completionModel=void 0,this._context=void 0,this._onDidCancel.fire({retrigger:i}))}clear(){this._completionDisposables.clear()}_updateActiveSuggestSession(){this._triggerState!==void 0&&(!this._editor.hasModel()||!this._languageFeaturesService.completionProvider.has(this._editor.getModel())?this.cancel():this.trigger({auto:this._triggerState.auto,retrigger:!0}))}_onCursorChange(i){if(!this._editor.hasModel())return;let e=this._currentSelection;if(this._currentSelection=this._editor.getSelection(),!i.selection.isEmpty()||i.reason!==0&&i.reason!==3||i.source!=="keyboard"&&i.source!=="deleteLeft"){this.cancel();return}this._triggerState===void 0&&i.reason===0?(e.containsRange(this._currentSelection)||e.getEndPosition().isBeforeOrEqual(this._currentSelection.getPosition()))&&this._doTriggerQuickSuggest():this._triggerState!==void 0&&i.reason===3&&this._refilterCompletionItems()}_onCompositionEnd(){this._triggerState===void 0?this._doTriggerQuickSuggest():this._refilterCompletionItems()}_doTriggerQuickSuggest(){oK.isAllOff(this._editor.getOption(102))||this._editor.getOption(134).snippetsPreventQuickSuggestions&&vs.get(this._editor)?.isInSnippet()||(this.cancel(),this._waitForInlineCompletions?.dispose(),this._waitForInlineCompletions=void 0,this._triggerQuickSuggest.cancelAndSet(()=>{if(this._triggerState!==void 0||!k5.shouldAutoTrigger(this._editor)||!this._editor.hasModel()||!this._editor.hasWidgetFocus())return;let i=this._editor.getModel(),e=this._editor.getPosition(),t=this._editor.getOption(102);if(oK.isAllOff(t))return;let o=!1;if(!oK.isAllOn(t)){i.tokenization.tokenizeIfCheap(e.lineNumber);let n=i.tokenization.getLineTokens(e.lineNumber),r=n.getStandardTokenType(n.findTokenIndexAtOffset(Math.max(e.column-1-1,0))),s=oK.valueFor(t,r);if(s==="off"||s==="inline")return;s==="offWhenInlineCompletions"&&(o=this._languageFeaturesService.inlineCompletionsProvider.has(i)&&this._editor.getOption(71).enabled)}o2o(this._editor,this._contextKeyService,this._configurationService)&&this._languageFeaturesService.completionProvider.has(i)&&(o?this._waitForInlineCompletionsAndTrigger(i,e):this.trigger({auto:!0}))},this._editor.getOption(103)))}_waitForInlineCompletionsAndTrigger(i,e){let t=i.getVersionId(),n=Mkt(this._editor)?.model.get();if(!n){this.trigger({auto:!0});return}if(n.state.get()?.inlineSuggestion)return;let s=new N;this._waitForInlineCompletions=s;let l=c=>{if(s.dispose(),this._waitForInlineCompletions===s&&(this._waitForInlineCompletions=void 0),this._triggerState!==void 0||!c)return;let u=this._editor.getModel(),p=this._editor.getPosition();u===i&&u.getVersionId()===t&&p?.equals(e)&&this._editor.hasWidgetFocus()&&this.trigger({auto:!0})};tn(()=>{l(!0),n.stop("automatic")},750,s),s.add(be(c=>{let u=n.status.read(c),p=n.state.read(c);!p&&u==="loading"||l(!p)}))}_refilterCompletionItems(){wo(this._editor.hasModel()),wo(this._triggerState!==void 0);let i=this._editor.getModel(),e=this._editor.getPosition(),t=new k5(i,e,{...this._triggerState,refilter:!0});this._onNewContext(t)}trigger(i){if(!this._editor.hasModel())return;let e=this._editor.getModel(),t=new k5(e,this._editor.getPosition(),i);this.cancel(i.retrigger),this._triggerState=i,this._onDidTrigger.fire({auto:i.auto,shy:i.shy??!1,position:this._editor.getPosition()}),this._context=t;let o={triggerKind:i.triggerKind??0};i.triggerCharacter&&(o={triggerKind:1,triggerCharacter:i.triggerCharacter}),this._requestToken=new Ye;let n=this._editor.getOption(128),r=1;switch(n){case"top":r=0;break;case"bottom":r=2;break}let{itemKind:s,showDeprecated:l}=aK.createSuggestFilter(this._editor),c=new I5(r,i.completionOptions?.kindFilter??s,i.completionOptions?.providerFilter,i.completionOptions?.providerItemsToReuse,l),u=hke.create(this._editorWorkerService,this._editor),p=Yce(this._languageFeaturesService.completionProvider,e,this._editor.getPosition(),c,o,this._requestToken.token);Promise.all([p,u]).then(async([h,g])=>{if(this._requestToken?.dispose(),!this._editor.hasModel()){h.disposable.dispose();return}let f=i?.clipboardText;if(!f&&h.needsClipboard&&(f=await this._clipboardService.readText()),this._triggerState===void 0){h.disposable.dispose();return}let v=this._editor.getModel(),b=new k5(v,this._editor.getPosition(),i),S={...Bj.default,firstMatchCanBeWeak:!this._editor.getOption(134).matchOnWordStartOnly};if(this._completionModel=new gke(h.items,this._context.column,{leadingLineContent:b.leadingLineContent,characterCountDelta:b.column-this._context.column},g,this._editor.getOption(134),this._editor.getOption(128),S,f),this._completionDisposables.add(h.disposable),this._onNewContext(b),this._reportDurationsTelemetry(h.durations),!this._envService.isBuilt||this._envService.isExtensionDevelopment)for(let y of h.items)y.isInvalid&&this._logService.warn(`[suggest] did IGNORE invalid completion item from ${y.provider._debugDisplayName}`,y.completion)}).catch(mt)}_reportDurationsTelemetry(i){Math.random()>1e-4||setTimeout(()=>{this._telemetryService.publicLog2("suggest.durations.json",{data:JSON.stringify(i)}),this._logService.debug("suggest.durations.json",i)})}static createSuggestFilter(i){let e=new Set;i.getOption(128)==="none"&&e.add(28);let o=i.getOption(134);return o.showMethods||e.add(0),o.showFunctions||e.add(1),o.showConstructors||e.add(2),o.showFields||e.add(3),o.showVariables||e.add(4),o.showClasses||e.add(5),o.showStructs||e.add(6),o.showInterfaces||e.add(7),o.showModules||e.add(8),o.showProperties||e.add(9),o.showEvents||e.add(10),o.showOperators||e.add(11),o.showUnits||e.add(12),o.showValues||e.add(13),o.showConstants||e.add(14),o.showEnums||e.add(15),o.showEnumMembers||e.add(16),o.showKeywords||e.add(17),o.showWords||e.add(18),o.showColors||e.add(19),o.showFiles||e.add(20),o.showReferences||e.add(21),o.showColors||e.add(22),o.showFolders||e.add(23),o.showTypeParameters||e.add(24),o.showSnippets||e.add(28),o.showUsers||e.add(25),o.showIssues||e.add(26),{itemKind:e,showDeprecated:o.showDeprecated}}_onNewContext(i){if(this._context){if(i.lineNumber!==this._context.lineNumber){this.cancel();return}if(Ll(i.leadingLineContent)!==Ll(this._context.leadingLineContent)){this.cancel();return}if(i.column<this._context.column){i.leadingWord.word?this.trigger({auto:this._context.triggerOptions.auto,retrigger:!0}):this.cancel();return}if(this._completionModel){if(i.leadingWord.word.length!==0&&i.leadingWord.startColumn>this._context.leadingWord.startColumn){if(k5.shouldAutoTrigger(this._editor)&&this._context){let t=this._completionModel.getItemsByProvider();this.trigger({auto:this._context.triggerOptions.auto,retrigger:!0,clipboardText:this._completionModel.clipboardText,completionOptions:{providerItemsToReuse:t}})}return}if(i.column>this._context.column&&this._completionModel.getIncompleteProvider().size>0&&i.leadingWord.word.length!==0){let e=new Map,t=new Set;for(let[o,n]of this._completionModel.getItemsByProvider())n.length>0&&n[0].container.incomplete?t.add(o):e.set(o,n);this.trigger({auto:this._context.triggerOptions.auto,triggerKind:2,retrigger:!0,clipboardText:this._completionModel.clipboardText,completionOptions:{providerFilter:t,providerItemsToReuse:e}})}else{let e=this._completionModel.lineContext,t=!1;if(this._completionModel.lineContext={leadingLineContent:i.leadingLineContent,characterCountDelta:i.column-this._context.column},this._completionModel.items.length===0){let o=k5.shouldAutoTrigger(this._editor);if(!this._context){this.cancel();return}if(o&&this._context.leadingWord.endColumn<i.leadingWord.startColumn){this.trigger({auto:this._context.triggerOptions.auto,retrigger:!0});return}if(this._context.triggerOptions.auto){this.cancel();return}else if(this._completionModel.lineContext=e,t=this._completionModel.items.length>0,t&&i.leadingWord.word.length===0){this.cancel();return}}this._onDidSuggest.fire({completionModel:this._completionModel,triggerOptions:i.triggerOptions,isFrozen:t})}}}}};aK=I([m(1,Qs),m(2,Fi),m(3,Te),m(4,se),m(5,X),m(6,B),m(7,Qt),m(8,Eo)],aK);var Akt=class{constructor(i,e,t,o){this._disposables=new N;this._disposables.add(t.onDidSuggest(n=>{n.completionModel.items.length===0&&this.reset()})),this._disposables.add(t.onDidCancel(n=>{this.reset()})),this._disposables.add(e.onDidShow(()=>this._onItem(e.getFocusedItem()))),this._disposables.add(e.onDidFocus(this._onItem,this)),this._disposables.add(e.onDidHide(this.reset,this)),this._disposables.add(i.onWillType(n=>{if(this._active&&!e.isFrozen()&&t.state!==0){let r=n.charCodeAt(n.length-1);this._active.acceptCharacters.has(r)&&i.getOption(0)&&o(this._active.item)}}))}_onItem(i){if(!i||!yr(i.item.completion.commitCharacters)){this.reset();return}if(this._active&&this._active.item.item===i.item)return;let e=new Z$;for(let t of i.item.completion.commitCharacters)t.length>0&&e.add(t.charCodeAt(0));this._active={acceptCharacters:e,item:i}}reset(){this._active=void 0}dispose(){this._disposables.dispose()}};var Nkt=class a{constructor(i,e){this._disposables=new N;this._lastOvertyped=[];this._locked=!1;this._disposables.add(i.onWillType(()=>{if(this._locked||!i.hasModel())return;let t=i.getSelections(),o=t.length,n=!1;for(let s=0;s<o;s++)if(!t[s].isEmpty()){n=!0;break}if(!n){this._lastOvertyped.length!==0&&(this._lastOvertyped.length=0);return}this._lastOvertyped=[];let r=i.getModel();for(let s=0;s<o;s++){let l=t[s];if(r.getValueLengthInRange(l)>a._maxSelectionLength)return;this._lastOvertyped[s]={value:r.getValueInRange(l),multiline:l.startLineNumber!==l.endLineNumber}}})),this._disposables.add(e.onDidTrigger(t=>{this._locked=!0})),this._disposables.add(e.onDidCancel(t=>{this._locked=!1}))}static{this._maxSelectionLength=51200}getLastOvertypedInfo(i){if(i>=0&&i<this._lastOvertyped.length)return this._lastOvertyped[i]}dispose(){this._disposables.dispose()}};var E5=class{constructor(i,e,t,o,n,r){this._menuId=e;this._menuService=n;this._contextKeyService=r;this._menuDisposables=new N;this.element=M(i,_(".suggest-status-bar"));let s=(l=>t?.showIconsNoKeybindings?l instanceof Lo?o.createInstance(xl,l,void 0):void 0:l instanceof Lo?o.createInstance(bwt,l,{useComma:!1}):void 0);this._leftActions=new Zi(this.element,{actionViewItemProvider:s}),this._rightActions=new Zi(this.element,{actionViewItemProvider:s}),this._leftActions.domNode.classList.add("left"),this._rightActions.domNode.classList.add("right")}dispose(){this._menuDisposables.dispose(),this._leftActions.dispose(),this._rightActions.dispose(),this.element.remove()}show(){let i=this._menuService.createMenu(this._menuId,this._contextKeyService),e=()=>{let t=[],o=[];for(let[n,r]of i.getActions())n==="left"?t.push(...r):o.push(...r);this._leftActions.clear(),this._leftActions.push(t),this._rightActions.clear(),this._rightActions.push(o)};this._menuDisposables.add(i.onDidChange(()=>e())),this._menuDisposables.add(i)}hide(){this._menuDisposables.clear()}};E5=I([m(3,F),m(4,Kt),m(5,X)],E5);function P8e(a){return!!a&&!!(a.completion.documentation||a.completion.detail&&a.completion.detail!==a.completion.label)}var fke=class{constructor(i,e,t){this._editor=i;this._themeService=e;this._markdownRendererService=t;this._onDidClose=new E;this.onDidClose=this._onDidClose.event;this._onDidChangeContents=new E;this.onDidChangeContents=this._onDidChangeContents.event;this._disposables=new N;this._renderDisposeable=new N;this._size=new si(330,0);this.domNode=_(".suggest-details"),this.domNode.classList.add("no-docs"),this._body=_(".body"),this._scrollbar=new ms(this._body,{alwaysConsumeMouseWheel:!0}),M(this.domNode,this._scrollbar.getDomNode()),this._disposables.add(this._scrollbar),this._header=M(this._body,_(".header")),this._close=M(this._header,_("span"+q.asCSSSelector(R.close))),this._close.title=d(1652,null),this._close.role="button",this._close.tabIndex=-1,this._type=M(this._header,_("p.type")),this._docs=M(this._body,_("p.docs")),this._configureFont(),this._disposables.add(this._editor.onDidChangeConfiguration(o=>{o.hasChanged(59)&&this._configureFont()}))}dispose(){this._disposables.dispose(),this._renderDisposeable.dispose(),this._onDidClose.dispose(),this._onDidChangeContents.dispose()}_configureFont(){let i=this._editor.getOptions(),e=i.get(59),t=e.getMassagedFontFamily(),o=i.get(135)||e.fontSize,n=i.get(136)||e.lineHeight,r=e.fontWeight,s=`${o}px`,l=`${n}px`;this.domNode.style.fontSize=s,this.domNode.style.lineHeight=`${n/o}`,this.domNode.style.fontWeight=r,this.domNode.style.fontFeatureSettings=e.fontFeatureSettings,this._type.style.fontFamily=t,this._close.style.height=l,this._close.style.width=l}getLayoutInfo(){let i=this._editor.getOption(136)||this._editor.getOption(59).lineHeight,e=uf(this._themeService.getColorTheme().type)?2:1,t=e*2;return{lineHeight:i,borderWidth:e,borderHeight:t,verticalPadding:22,horizontalPadding:14}}renderLoading(){this._type.textContent=d(1653,null),this._docs.textContent="",this.domNode.classList.remove("no-docs","no-type"),this.layout(this.size.width,this.getLayoutInfo().lineHeight*2),this._onDidChangeContents.fire(this)}renderItem(i,e){this._renderDisposeable.clear();let{detail:t,documentation:o}=i.completion;if(e){let n="";n+=`score: ${i.score[0]}
`,n+=`prefix: ${i.word??"(no prefix)"}
`,n+=`word: ${i.completion.filterText?i.completion.filterText+" (filterText)":i.textLabel}
`,n+=`distance: ${i.distance} (localityBonus-setting)
`,n+=`index: ${i.idx}, based on ${i.completion.sortText&&`sortText: "${i.completion.sortText}"`||"label"}
`,n+=`commit_chars: ${i.completion.commitCharacters?.join("")}
`,o=new Ie().appendCodeblock("empty",n),t=`Provider: ${i.provider._debugDisplayName}`}if(!e&&!P8e(i)){this.clearContents();return}if(this.domNode.classList.remove("no-docs","no-type"),t){let n=t.length>1e5?`${t.substr(0,1e5)}\u2026`:t;this._type.textContent=n,this._type.title=n,un(this._type),this._type.classList.toggle("auto-wrap",!/\r?\n^\s+/gmi.test(n))}else Rt(this._type),this._type.title="",vo(this._type),this.domNode.classList.add("no-type");if(Rt(this._docs),typeof o=="string")this._docs.classList.remove("markdown-docs"),this._docs.textContent=o;else if(o){this._docs.classList.add("markdown-docs"),Rt(this._docs);let n=this._markdownRendererService.render(o,{context:this._editor,asyncRenderCallback:()=>{this.layout(this._size.width,this._type.clientHeight+this._docs.clientHeight),this._onDidChangeContents.fire(this)}});this._docs.appendChild(n.element),this._renderDisposeable.add(n)}this.domNode.classList.toggle("detail-and-doc",!!t&&!!o),this.domNode.style.userSelect="text",this.domNode.tabIndex=-1,this._close.onmousedown=n=>{n.preventDefault(),n.stopPropagation()},this._close.onclick=n=>{n.preventDefault(),n.stopPropagation(),this._onDidClose.fire()},this._body.scrollTop=0,this.layout(this._size.width,this._type.clientHeight+this._docs.clientHeight),this._onDidChangeContents.fire(this)}clearContents(){this.domNode.classList.add("no-docs"),this._type.textContent="",this._docs.textContent=""}get isEmpty(){return this.domNode.classList.contains("no-docs")}get size(){return this._size}layout(i,e){let t=new si(i,e);si.equals(t,this._size)||(this._size=t,VL(this.domNode,i,e)),this._scrollbar.scanDomNode()}scrollDown(i=8){this._body.scrollTop+=i}scrollUp(i=8){this._body.scrollTop-=i}scrollTop(){this._body.scrollTop=0}scrollBottom(){this._body.scrollTop=this._body.scrollHeight}pageDown(){this.scrollDown(80)}pageUp(){this.scrollUp(80)}focus(){this.domNode.focus()}};fke=I([m(1,Le),m(2,On)],fke);var Okt=class{constructor(i,e){this.widget=i;this._editor=e;this.allowEditorOverflow=!0;this._disposables=new N;this._added=!1;this._preferAlignAtTop=!0;this._resizable=new fR,this._resizable.domNode.classList.add("suggest-details-container"),this._resizable.domNode.appendChild(i.domNode),this._resizable.enableSashes(!1,!0,!0,!1);let t,o,n=0,r=0;this._disposables.add(this._resizable.onDidWillResize(()=>{t=this._topLeft,o=this._resizable.size})),this._disposables.add(this._resizable.onDidResize(s=>{if(t&&o){this.widget.layout(s.dimension.width,s.dimension.height);let l=!1;s.west&&(r=o.width-s.dimension.width,l=!0),s.north&&(n=o.height-s.dimension.height,l=!0),l&&this._applyTopLeft({top:t.top+n,left:t.left+r})}s.done&&(t=void 0,o=void 0,n=0,r=0,this._userSize=s.dimension)})),this._disposables.add(this.widget.onDidChangeContents(()=>{this._anchorBox&&this._placeAtAnchor(this._anchorBox,this._userSize??this.widget.size,this._preferAlignAtTop)}))}dispose(){this._resizable.dispose(),this._disposables.dispose(),this.hide()}getId(){return"suggest.details"}getDomNode(){return this._resizable.domNode}getPosition(){return this._topLeft?{preference:this._topLeft}:null}show(){this._added||(this._editor.addOverlayWidget(this),this._added=!0)}hide(i=!1){this._resizable.clearSashHoverState(),this._added&&(this._editor.removeOverlayWidget(this),this._added=!1,this._anchorBox=void 0,this._topLeft=void 0),i&&(this._userSize=void 0,this.widget.clearContents())}placeAtAnchor(i,e){let t=i.getBoundingClientRect();this._anchorBox=t,this._preferAlignAtTop=e,this._placeAtAnchor(this._anchorBox,this._userSize??this.widget.size,e)}_placeAtAnchor(i,e,t){let o=$m(this.getDomNode().ownerDocument.body),n=this.widget.getLayoutInfo(),r=new si(220,2*n.lineHeight),s=i.top,l=(function(){let O=o.width-(i.left+i.width+n.borderWidth+n.horizontalPadding),V=-n.borderWidth+i.left+i.width,H=new si(O,o.height-i.top-n.borderHeight-n.verticalPadding),G=H.with(void 0,i.top+i.height-n.borderHeight-n.verticalPadding);return{top:s,left:V,fit:O-e.width,maxSizeTop:H,maxSizeBottom:G,minSize:r.with(Math.min(O,r.width))}})(),c=(function(){let O=i.left-n.borderWidth-n.horizontalPadding,V=Math.max(n.horizontalPadding,i.left-e.width-n.borderWidth),H=new si(O,o.height-i.top-n.borderHeight-n.verticalPadding),G=H.with(void 0,i.top+i.height-n.borderHeight-n.verticalPadding);return{top:s,left:V,fit:O-e.width,maxSizeTop:H,maxSizeBottom:G,minSize:r.with(Math.min(O,r.width))}})(),u=(function(){let O=i.left,V=-n.borderWidth+i.top+i.height,H=new si(i.width-n.borderHeight,o.height-i.top-i.height-n.verticalPadding);return{top:V,left:O,fit:H.height-e.height,maxSizeBottom:H,maxSizeTop:H,minSize:r.with(H.width)}})(),p=(function(){let O=i.left,V=new si(i.width-n.borderHeight,i.top-n.verticalPadding);return{top:Math.max(n.verticalPadding,i.top-e.height),left:O,fit:V.height-e.height,maxSizeTop:V,maxSizeBottom:V,minSize:r.with(V.width)}})(),g=[l,c,t?u:p],f=g.find(O=>O.fit>=0)??g.sort((O,V)=>V.fit-O.fit)[0],v=i.top+i.height-n.borderHeight,b,S=e.height,y=Math.max(f.maxSizeTop.height,f.maxSizeBottom.height);S>y&&(S=y);let w;t?S<=f.maxSizeTop.height?(b=!0,w=f.maxSizeTop):(b=!1,w=f.maxSizeBottom):S<=f.maxSizeBottom.height?(b=!1,w=f.maxSizeBottom):(b=!0,w=f.maxSizeTop);let{top:k,left:T}=f;f===p?k=i.top-S+n.borderWidth:!b&&S>i.height&&(k=v-S);let P=this._editor.getDomNode();if(P){let O=P.getBoundingClientRect();k-=O.top,T-=O.left}this._applyTopLeft({left:T,top:k}),f===p?this._resizable.enableSashes(!0,!1,!1,!0):this._resizable.enableSashes(!b,f===l,b,f!==l),this._resizable.minSize=f.minSize,this._resizable.maxSize=w,this._resizable.layout(S,Math.min(w.width,e.width)),this.widget.layout(this._resizable.size.width,this._resizable.size.height)}_applyTopLeft(i){this._topLeft=i,this._editor.layoutOverlayWidget(this)}};var s2o=/(?:\/|^)(?:([^\/]+)\/)?([^\/]+)$/;function aa(a,i,e,t,o){if(q.isThemeIcon(o))return[`codicon-${o.id}`,"predefined-file-icon"];if(A.isUri(o))return[];let n=t===2?["rootfolder-icon"]:t===1?["folder-icon"]:["file-icon"];if(e){let r;if(e.scheme===Q.data)r=V$.parseMetaData(e).get(V$.META_DATA_LABEL);else{let s=e.path.match(s2o);s?(r=nde(s[2].toLowerCase()),s[1]&&n.push(`${nde(s[1].toLowerCase())}-name-dir-icon`)):r=nde(e.authority.toLowerCase())}if(t===2)n.push(`${r}-root-name-folder-icon`);else if(t===1)n.push(`${r}-name-folder-icon`);else{if(r){if(n.push(`${r}-name-file-icon`),n.push("name-file-icon"),r.length<=255){let l=r.split(".");for(let c=1;c<l.length;c++)n.push(`${l.slice(c).join(".")}-ext-file-icon`)}n.push("ext-file-icon")}let s=a2o(a,i,e);s&&n.push(`${nde(s)}-lang-file-icon`)}}return n}function lK(a){return["file-icon",`${nde(a)}-lang-file-icon`]}function a2o(a,i,e){if(!e)return null;let t=null;if(e.scheme===Q.data){let n=V$.parseMetaData(e).get(V$.META_DATA_MIME);n&&(t=i.getLanguageIdByMimeType(n))}else{let o=a.getModel(e);o&&(t=o.getLanguageId())}return t&&t!==$r?t:i.guessLanguageIdByFilepathOrFirstLine(e)}function nde(a){return a.replace(/[\s]/g,"/")}var l2o=Ae("suggest-more-info",R.chevronRight,d(1655,null)),c2o=new class A8e{static{this._regexRelaxed=/(#([\da-fA-F]{3}){1,2}|(rgb|hsl)a\(\s*(\d{1,3}%?\s*,\s*){3}(1|0?\.\d+)\)|(rgb|hsl)\(\s*\d{1,3}%?(\s*,\s*\d{1,3}%?){2}\s*\))/}static{this._regexStrict=new RegExp(`^${A8e._regexRelaxed.source}$`,"i")}extract(i,e){if(i.textLabel.match(A8e._regexStrict))return e[0]=i.textLabel,!0;if(i.completion.detail&&i.completion.detail.match(A8e._regexStrict))return e[0]=i.completion.detail,!0;if(i.completion.documentation){let t=typeof i.completion.documentation=="string"?i.completion.documentation:i.completion.documentation.value,o=A8e._regexRelaxed.exec(t);if(o&&(o.index===0||o.index+o[0].length===t.length))return e[0]=o[0],!0}return!1}},vke=class{constructor(i,e,t,o){this._editor=i;this._modelService=e;this._languageService=t;this._themeService=o;this._onDidToggleDetails=new E;this.onDidToggleDetails=this._onDidToggleDetails.event;this.templateId="suggestion"}dispose(){this._onDidToggleDetails.dispose()}renderTemplate(i){let e=new N,t=i;t.classList.add("show-file-icons");let o=M(i,_(".icon")),n=M(o,_("span.colorspan")),r=M(i,_(".contents")),s=M(r,_(".main")),l=M(s,_(".icon-label.codicon")),c=M(s,_("span.left")),u=M(s,_("span.right")),p=new Bc(c,{supportHighlights:!0,supportIcons:!0});e.add(p);let h=M(c,_("span.signature-label")),g=M(c,_("span.qualifier-label")),f=M(u,_("span.details-label")),v=M(u,_("span.readMore"+q.asCSSSelector(l2o)));return v.title=d(1654,null),{root:t,left:c,right:u,icon:o,colorspan:n,iconLabel:p,iconContainer:l,parametersLabel:h,qualifierLabel:g,detailsLabel:f,readMore:v,disposables:e,configureFont:()=>{let S=this._editor.getOptions(),y=S.get(59),w=y.getMassagedFontFamily(),k=y.fontFeatureSettings,T=y.fontVariationSettings,P=S.get(135)||y.fontSize,O=S.get(136)||y.lineHeight,V=y.fontWeight,H=y.letterSpacing,G=`${P}px`,$=`${O}px`,J=`${H}px`;t.style.fontSize=G,t.style.fontWeight=V,t.style.letterSpacing=J,s.style.fontFamily=w,s.style.fontFeatureSettings=k,s.style.fontVariationSettings=T,s.style.lineHeight=$,o.style.height=$,o.style.width=$,v.style.height=$,v.style.width=$}}}renderElement(i,e,t){t.configureFont();let{completion:o}=i;t.colorspan.style.backgroundColor="";let n={labelEscapeNewLines:!0,matches:xa(i.score)},r=[];if(o.kind===19&&c2o.extract(i,r))t.icon.className="icon customcolor",t.iconContainer.className="icon hide",t.colorspan.style.backgroundColor=r[0];else if(o.kind===20&&this._themeService.getFileIconTheme().hasFileIcons){t.icon.className="icon hide",t.iconContainer.className="icon hide";let s=aa(this._modelService,this._languageService,A.from({scheme:"fake",path:i.textLabel}),0),l=aa(this._modelService,this._languageService,A.from({scheme:"fake",path:o.detail}),0);n.extraClasses=s.length>l.length?s:l}else o.kind===23&&this._themeService.getFileIconTheme().hasFolderIcons?(t.icon.className="icon hide",t.iconContainer.className="icon hide",n.extraClasses=[aa(this._modelService,this._languageService,A.from({scheme:"fake",path:i.textLabel}),1),aa(this._modelService,this._languageService,A.from({scheme:"fake",path:o.detail}),1)].flat()):(t.icon.className="icon hide",t.iconContainer.className="",t.iconContainer.classList.add("suggest-icon",...q.asClassNameArray(A1.toIcon(o.kind))));o.tags&&o.tags.indexOf(1)>=0&&(n.extraClasses=(n.extraClasses||[]).concat(["deprecated"]),n.matches=[]),t.iconLabel.setLabel(i.textLabel,void 0,n),typeof o.label=="string"?(t.parametersLabel.textContent="",t.detailsLabel.textContent=zdi(o.detail||""),t.root.classList.add("string-label")):(t.parametersLabel.textContent=zdi(o.label.detail||""),t.detailsLabel.textContent=zdi(o.label.description||""),t.root.classList.remove("string-label")),this._editor.getOption(134).showInlineDetails?un(t.detailsLabel):vo(t.detailsLabel),P8e(i)?(t.right.classList.add("can-expand-details"),un(t.readMore),t.readMore.onmousedown=s=>{s.stopPropagation(),s.preventDefault()},t.readMore.onclick=s=>{s.stopPropagation(),s.preventDefault(),this._onDidToggleDetails.fire()}):(t.right.classList.remove("can-expand-details"),vo(t.readMore),t.readMore.onmousedown=null,t.readMore.onclick=null)}disposeTemplate(i){i.disposables.dispose()}};vke=I([m(1,Tt),m(2,_t),m(3,Le)],vke);function zdi(a){return a.replace(/\r\n|\r|\n/g,"")}te("editorSuggestWidget.background",Su,d(1636,null));te("editorSuggestWidget.border",CO,d(1637,null));var qdi=te("editorSuggestWidget.foreground",Id,d(1639,null));te("editorSuggestWidget.selectedForeground",j1,d(1642,null));te("editorSuggestWidget.selectedIconForeground",qye,d(1643,null));var $di=te("editorSuggestWidget.selectedBackground",Q1,d(1641,null));te("editorSuggestWidget.highlightForeground",L7,d(1640,null));te("editorSuggestWidget.focusHighlightForeground",J5i,d(1638,null));te("editorSuggestWidgetStatus.foreground",ai(qdi,.5),d(1644,null));var Kdi=class{constructor(i,e){this._service=i;this._key=`suggestWidget.size/${e.getEditorType()}/${e instanceof id}`}restore(){let i=this._service.get(this._key,0)??"";try{let e=JSON.parse(i);if(si.is(e))return si.lift(e)}catch{}}store(i){this._service.store(this._key,JSON.stringify(i),0,1)}reset(){this._service.remove(this._key,0)}},cB=class{constructor(i,e,t,o,n){this.editor=i;this._storageService=e;this._state=0;this._isAuto=!1;this._pendingLayout=new me;this._pendingShowDetails=new me;this._ignoreFocusEvents=!1;this._forceRenderingAbove=!1;this._explainMode=!1;this._showTimeout=new Ul;this._disposables=new N;this._onDidSelect=new Gm;this._onDidFocus=new Gm;this._onDidHide=new E;this._onDidShow=new E;this.onDidSelect=this._onDidSelect.event;this.onDidFocus=this._onDidFocus.event;this.onDidHide=this._onDidHide.event;this.onDidShow=this._onDidShow.event;this._onDetailsKeydown=new E;this.onDetailsKeyDown=this._onDetailsKeydown.event;this.element=new fR,this.element.domNode.classList.add("editor-widget","suggest-widget"),this._contentWidget=new Gdi(this,i),this._persistedSize=new Kdi(e,i);class r{constructor(f,v,b=!1,S=!1){this.persistedSize=f;this.currentSize=v;this.persistHeight=b;this.persistWidth=S}}let s;this._disposables.add(this.element.onDidWillResize(()=>{this._contentWidget.lockPreference(),s=new r(this._persistedSize.restore(),this.element.size)})),this._disposables.add(this.element.onDidResize(g=>{if(this._resize(g.dimension.width,g.dimension.height),s&&(s.persistHeight=s.persistHeight||!!g.north||!!g.south,s.persistWidth=s.persistWidth||!!g.east||!!g.west),!!g.done){if(s){let{itemHeight:f,defaultSize:v}=this.getLayoutInfo(),b=Math.round(f/2),{width:S,height:y}=this.element.size;(!s.persistHeight||Math.abs(s.currentSize.height-y)<=b)&&(y=s.persistedSize?.height??v.height),(!s.persistWidth||Math.abs(s.currentSize.width-S)<=b)&&(S=s.persistedSize?.width??v.width),this._persistedSize.store(new si(S,y))}this._contentWidget.unlockPreference(),s=void 0}})),this._messageElement=M(this.element.domNode,_(".message")),this._listElement=M(this.element.domNode,_(".tree"));let l=this._disposables.add(n.createInstance(fke,this.editor));l.onDidClose(()=>this.toggleDetails(),this,this._disposables),this._details=new Okt(l,this.editor);let c=()=>this.element.domNode.classList.toggle("no-icons",!this.editor.getOption(134).showIcons);c();let u=n.createInstance(vke,this.editor);this._disposables.add(u),this._disposables.add(u.onDidToggleDetails(()=>this.toggleDetails())),this._list=new Cc("SuggestWidget",this._listElement,{getHeight:g=>this.getLayoutInfo().itemHeight,getTemplateId:g=>"suggestion"},[u],{alwaysConsumeMouseWheel:!0,useShadows:!1,mouseSupport:!1,multipleSelectionSupport:!1,accessibilityProvider:{getRole:()=>ei?"listitem":"option",getWidgetAriaLabel:()=>d(1649,null),getWidgetRole:()=>"listbox",getAriaLabel:g=>{let f=g.textLabel,v=A1.toLabel(g.completion.kind);if(typeof g.completion.label!="string"){let{detail:w,description:k}=g.completion.label;w&&k?f=d(1648,null,f,w,k,v):w?f=d(1647,null,f,w,v):k&&(f=d(1646,null,f,k,v))}else f=d(1645,null,f,v);if(!g.isResolved||!this._isDetailsVisible())return f;let{documentation:b,detail:S}=g.completion,y=vd("{0}{1}",S||"",b?typeof b=="string"?b:b.value:"");return d(1635,null,f,y)}}}),this._list.style(uS({listInactiveFocusBackground:$di,listInactiveFocusOutline:Ys})),this._status=n.createInstance(E5,this.element.domNode,sB,void 0);let p=()=>this.element.domNode.classList.toggle("with-status-bar",this.editor.getOption(134).showStatusBar);p(),this._disposables.add(this._list.onMouseDown(g=>this._onListMouseDownOrTap(g))),this._disposables.add(this._list.onTap(g=>this._onListMouseDownOrTap(g))),this._disposables.add(this._list.onDidChangeSelection(g=>this._onListSelection(g))),this._disposables.add(this._list.onDidChangeFocus(g=>this._onListFocus(g))),this._disposables.add(this.editor.onDidChangeCursorSelection(()=>this._onCursorSelectionChanged())),this._disposables.add(this.editor.onDidChangeConfiguration(g=>{g.hasChanged(134)&&(p(),c()),this._completionModel&&(g.hasChanged(59)||g.hasChanged(135)||g.hasChanged(136))&&this._list.splice(0,this._list.length,this._completionModel.items)})),this._ctxSuggestWidgetVisible=Xn.Visible.bindTo(t),this._ctxSuggestWidgetDetailsVisible=Xn.DetailsVisible.bindTo(t),this._ctxSuggestWidgetMultipleSuggestions=Xn.MultipleSuggestions.bindTo(t),this._ctxSuggestWidgetHasFocusedSuggestion=Xn.HasFocusedSuggestion.bindTo(t),this._ctxSuggestWidgetDetailsFocused=Xn.DetailsFocused.bindTo(t);let h=qn(this._details.widget.domNode);this._disposables.add(h),this._disposables.add(h.onDidFocus(()=>this._ctxSuggestWidgetDetailsFocused.set(!0))),this._disposables.add(h.onDidBlur(()=>this._ctxSuggestWidgetDetailsFocused.set(!1))),this._disposables.add(Jo(this._details.widget.domNode,"keydown",g=>{this._onDetailsKeydown.fire(g)})),this._disposables.add(this.editor.onMouseDown(g=>this._onEditorMouseDown(g)))}static{this.LOADING_MESSAGE=d(1650,null)}static{this.NO_SUGGESTIONS_MESSAGE=d(1651,null)}dispose(){this._details.widget.dispose(),this._details.dispose(),this._list.dispose(),this._status.dispose(),this._disposables.dispose(),this._loadingTimeout?.dispose(),this._pendingLayout.dispose(),this._pendingShowDetails.dispose(),this._showTimeout.dispose(),this._contentWidget.dispose(),this.element.dispose(),this._onDidSelect.dispose(),this._onDidFocus.dispose(),this._onDidHide.dispose(),this._onDidShow.dispose(),this._onDetailsKeydown.dispose()}_onEditorMouseDown(i){this._details.widget.domNode.contains(i.target.element)?this._details.widget.domNode.focus():this.element.domNode.contains(i.target.element)&&this.editor.focus()}_onCursorSelectionChanged(){this._state!==0&&this._contentWidget.layout()}_onListMouseDownOrTap(i){typeof i.element>"u"||typeof i.index>"u"||(i.browserEvent.preventDefault(),i.browserEvent.stopPropagation(),this._select(i.element,i.index))}_onListSelection(i){i.elements.length&&this._select(i.elements[0],i.indexes[0])}_select(i,e){let t=this._completionModel;t&&(this._onDidSelect.fire({item:i,index:e,model:t}),this.editor.focus())}_onListFocus(i){if(this._ignoreFocusEvents)return;if(this._state===5&&this._setState(3),!i.elements.length){this._currentSuggestionDetails&&(this._currentSuggestionDetails.cancel(),this._currentSuggestionDetails=void 0,this._focusedItem=void 0),this.editor.setAriaOptions({activeDescendant:void 0}),this._ctxSuggestWidgetHasFocusedSuggestion.set(!1);return}if(!this._completionModel)return;this._ctxSuggestWidgetHasFocusedSuggestion.set(!0);let e=i.elements[0],t=i.indexes[0];e!==this._focusedItem&&(this._currentSuggestionDetails?.cancel(),this._currentSuggestionDetails=void 0,this._focusedItem=e,this._list.reveal(t),this._currentSuggestionDetails=Ln(async o=>{let n=tn(()=>{this._isDetailsVisible()&&this._showDetails(!0,!1)},250),r=o.onCancellationRequested(()=>n.dispose());try{return await e.resolve(o)}finally{n.dispose(),r.dispose()}}),this._currentSuggestionDetails.then(()=>{t>=this._list.length||e!==this._list.element(t)||(this._ignoreFocusEvents=!0,this._list.splice(t,1,[e]),this._list.setFocus([t]),this._ignoreFocusEvents=!1,this._isDetailsVisible()?this._showDetails(!1,!1):this.element.domNode.classList.remove("docs-side"),this.editor.setAriaOptions({activeDescendant:this._list.getElementID(t)}))}).catch(mt)),this._onDidFocus.fire({item:e,index:t,model:this._completionModel})}_setState(i){if(this._state!==i)switch(this._state=i,this.element.domNode.classList.toggle("frozen",i===4),this.element.domNode.classList.remove("message"),i){case 0:vo(this._messageElement,this._listElement,this._status.element),this._details.hide(!0),this._status.hide(),this._contentWidget.hide(),this._ctxSuggestWidgetVisible.reset(),this._ctxSuggestWidgetMultipleSuggestions.reset(),this._ctxSuggestWidgetHasFocusedSuggestion.reset(),this._showTimeout.cancel(),this.element.domNode.classList.remove("visible"),this._list.splice(0,this._list.length),this._focusedItem=void 0,this._cappedHeight=void 0,this._explainMode=!1;break;case 1:this.element.domNode.classList.add("message"),this._messageElement.textContent=cB.LOADING_MESSAGE,vo(this._listElement,this._status.element),un(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,qr(cB.LOADING_MESSAGE);break;case 2:this.element.domNode.classList.add("message"),this._messageElement.textContent=cB.NO_SUGGESTIONS_MESSAGE,vo(this._listElement,this._status.element),un(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,qr(cB.NO_SUGGESTIONS_MESSAGE);break;case 3:vo(this._messageElement),un(this._listElement,this._status.element),this._show();break;case 4:vo(this._messageElement),un(this._listElement,this._status.element),this._show();break;case 5:vo(this._messageElement),un(this._listElement,this._status.element),this._details.show(),this._show(),this._details.widget.focus();break}}_show(){this._status.show(),this._contentWidget.show(),this._layout(this._persistedSize.restore()),this._ctxSuggestWidgetVisible.set(!0),this._showTimeout.cancelAndSet(()=>{this.element.domNode.classList.add("visible"),this._onDidShow.fire(this)},100)}showTriggered(i,e){this._state===0&&(this._contentWidget.setPosition(this.editor.getPosition()),this._isAuto=!!i,this._isAuto||(this._loadingTimeout=tn(()=>this._setState(1),e)))}showSuggestions(i,e,t,o,n){if(this._contentWidget.setPosition(this.editor.getPosition()),this._loadingTimeout?.dispose(),this._currentSuggestionDetails?.cancel(),this._currentSuggestionDetails=void 0,this._completionModel!==i&&(this._completionModel=i),t&&this._state!==2&&this._state!==0){this._setState(4);return}let r=this._completionModel.items.length,s=r===0;if(this._ctxSuggestWidgetMultipleSuggestions.set(r>1),s){this._setState(o?0:2),this._completionModel=void 0;return}this._focusedItem=void 0,this._onDidFocus.pause(),this._onDidSelect.pause();try{this._list.splice(0,this._list.length,this._completionModel.items),this._setState(t?4:3),this._list.reveal(e,0,e===0?0:this.getLayoutInfo().itemHeight*.33),this._list.setFocus(n?[]:[e])}finally{this._onDidFocus.resume(),this._onDidSelect.resume()}this._pendingLayout.value=zh(Re(this.element.domNode),()=>{this._pendingLayout.clear(),this._layout(this.element.size),this._details.widget.domNode.classList.remove("focused")})}focusSelected(){this._list.length>0&&this._list.setFocus([0])}selectNextPage(){switch(this._state){case 0:return!1;case 5:return this._details.widget.pageDown(),!0;case 1:return!this._isAuto;default:return this._list.focusNextPage(),!0}}selectNext(){switch(this._state){case 0:return!1;case 1:return!this._isAuto;default:return this._list.focusNext(1,!0),!0}}selectLast(){switch(this._state){case 0:return!1;case 5:return this._details.widget.scrollBottom(),!0;case 1:return!this._isAuto;default:return this._list.focusLast(),!0}}selectPreviousPage(){switch(this._state){case 0:return!1;case 5:return this._details.widget.pageUp(),!0;case 1:return!this._isAuto;default:return this._list.focusPreviousPage(),!0}}selectPrevious(){switch(this._state){case 0:return!1;case 1:return!this._isAuto;default:return this._list.focusPrevious(1,!0),!1}}selectFirst(){switch(this._state){case 0:return!1;case 5:return this._details.widget.scrollTop(),!0;case 1:return!this._isAuto;default:return this._list.focusFirst(),!0}}getFocusedItem(){if(this._state!==0&&this._state!==2&&this._state!==1&&this._completionModel&&this._list.getFocus().length>0)return{item:this._list.getFocusedElements()[0],index:this._list.getFocus()[0],model:this._completionModel}}toggleDetailsFocus(){this._state===5?(this._list.setFocus(this._list.getFocus()),this._setState(3)):this._state===3&&(this._setState(5),this._isDetailsVisible()?this._details.widget.focus():this.toggleDetails(!0))}toggleDetails(i=!1){this._isDetailsVisible()?(this._pendingShowDetails.clear(),this._ctxSuggestWidgetDetailsVisible.set(!1),this._setDetailsVisible(!1),this._details.hide(),this.element.domNode.classList.remove("shows-details")):(P8e(this._list.getFocusedElements()[0])||this._explainMode)&&(this._state===3||this._state===5||this._state===4)&&(this._ctxSuggestWidgetDetailsVisible.set(!0),this._setDetailsVisible(!0),this._showDetails(!1,i))}_showDetails(i,e){this._pendingShowDetails.value=zh(Re(this.element.domNode),()=>{this._pendingShowDetails.clear(),this._details.show();let t=!1;i?this._details.widget.renderLoading():this._details.widget.renderItem(this._list.getFocusedElements()[0],this._explainMode),this._details.widget.isEmpty?this._details.hide():(this._positionDetails(),this.element.domNode.classList.add("shows-details"),e&&(this._details.widget.focus(),t=!0)),t||this.editor.focus()})}toggleExplainMode(){this._list.getFocusedElements()[0]&&(this._explainMode=!this._explainMode,this._isDetailsVisible()?this._showDetails(!1,!1):this.toggleDetails())}resetPersistedSize(){this._persistedSize.reset()}hideWidget(){this._pendingLayout.clear(),this._pendingShowDetails.clear(),this._loadingTimeout?.dispose(),this._setState(0),this._onDidHide.fire(this),this.element.clearSashHoverState();let i=this._persistedSize.restore(),e=Math.ceil(this.getLayoutInfo().itemHeight*4.3);i&&i.height<e&&this._persistedSize.store(i.with(void 0,e))}isFrozen(){return this._state===4}_afterRender(i){if(i===null){this._isDetailsVisible()&&this._details.hide();return}this._state===2||this._state===1||(this._isDetailsVisible()&&!this._details.widget.isEmpty&&this._details.show(),this._positionDetails())}_layout(i){if(!this.editor.hasModel()||!this.editor.getDomNode())return;let e=$m(this.element.domNode.ownerDocument.body),t=this.getLayoutInfo();i||(i=t.defaultSize);let o=i.height,n=i.width;if(this._status.element.style.height=`${t.itemHeight}px`,this._state===2||this._state===1)o=t.itemHeight+t.borderHeight,n=t.defaultSize.width/2,this.element.enableSashes(!1,!1,!1,!1),this.element.minSize=this.element.maxSize=new si(n,o),this._contentWidget.setPreference(2);else{let r=e.width-t.borderHeight-2*t.horizontalPadding;n>r&&(n=r);let s=this._completionModel?this._completionModel.stats.pLabelLen*t.typicalHalfwidthCharacterWidth:n,l=t.statusBarHeight+this._list.contentHeight+t.borderHeight,c=t.itemHeight+t.statusBarHeight,u=ir(this.editor.getDomNode()),p=this.editor.getScrolledVisiblePosition(this.editor.getPosition()),h=u.top+p.top+p.height,g=Math.min(e.height-h-t.verticalPadding,l),f=u.top+p.top-t.verticalPadding,v=Math.min(f,l),b=Math.min(Math.max(v,g)+t.borderHeight,l);o===this._cappedHeight?.capped&&(o=this._cappedHeight.wanted),o<c&&(o=c),o>b&&(o=b),o>g&&v>g||this._forceRenderingAbove&&f>150?(this._contentWidget.setPreference(1),this.element.enableSashes(!0,!0,!1,!1),b=v):(this._contentWidget.setPreference(2),this.element.enableSashes(!1,!0,!0,!1),b=g),this.element.preferredSize=new si(s,t.defaultSize.height),this.element.maxSize=new si(r,b),this.element.minSize=new si(220,c),this._cappedHeight=o===l?{wanted:this._cappedHeight?.wanted??i.height,capped:o}:void 0}this._resize(n,o)}_resize(i,e){let{width:t,height:o}=this.element.maxSize;i=Math.min(t,i),e=Math.min(o,e);let{statusBarHeight:n}=this.getLayoutInfo();this._list.layout(e-n,i),this._listElement.style.height=`${e-n}px`,this.element.layout(e,i),this._contentWidget.layout(),this._positionDetails()}_positionDetails(){this._isDetailsVisible()&&this._details.placeAtAnchor(this.element.domNode,this._contentWidget.getPosition()?.preference[0]===2)}getLayoutInfo(){let i=this.editor.getOption(59),e=Bn(this.editor.getOption(136)||i.lineHeight,8,1e3),t=!this.editor.getOption(134).showStatusBar||this._state===2||this._state===1?0:e,o=this._details.widget.getLayoutInfo().borderWidth,n=2*o;return{itemHeight:e,statusBarHeight:t,borderWidth:o,borderHeight:n,typicalHalfwidthCharacterWidth:i.typicalHalfwidthCharacterWidth,verticalPadding:22,horizontalPadding:14,defaultSize:new si(430,t+12*e)}}_isDetailsVisible(){return this._storageService.getBoolean("expandSuggestionDocs",0,!1)}_setDetailsVisible(i){this._storageService.store("expandSuggestionDocs",i,0,0)}forceRenderingAbove(){this._forceRenderingAbove||(this._forceRenderingAbove=!0,this._layout(this._persistedSize.restore()))}stopForceRenderingAbove(){this._forceRenderingAbove=!1}};cB=I([m(1,ce),m(2,X),m(3,Le),m(4,F)],cB);var Gdi=class{constructor(i,e){this._widget=i;this._editor=e;this.allowEditorOverflow=!0;this.suppressMouseDown=!1;this._preferenceLocked=!1;this._added=!1;this._hidden=!1}dispose(){this._added&&(this._added=!1,this._editor.removeContentWidget(this))}getId(){return"editor.widget.suggestWidget"}getDomNode(){return this._widget.element.domNode}show(){this._hidden=!1,this._added||(this._added=!0,this._editor.addContentWidget(this))}hide(){this._hidden||(this._hidden=!0,this.layout())}layout(){this._editor.layoutContentWidget(this)}getPosition(){return this._hidden||!this._position||!this._preference?null:{position:this._position,preference:[this._preference]}}beforeRender(){let{height:i,width:e}=this._widget.element.size,{borderWidth:t,horizontalPadding:o}=this._widget.getLayoutInfo();return new si(e+2*t+o,i+2*t)}afterRender(i){this._widget._afterRender(i)}setPreference(i){this._preferenceLocked||(this._preference=i)}lockPreference(){this._preferenceLocked=!0}unlockPreference(){this._preferenceLocked=!1}setPosition(i){this._position=i}};var d2o=!1,jdi=class{constructor(i,e){this._model=i;this._position=e;this._decorationOptions=mo.register({description:"suggest-line-suffix",stickiness:1});if(i.getLineMaxColumn(e.lineNumber)!==e.column){let o=i.getOffsetAt(e),n=i.getPositionAt(o+1);i.changeDecorations(r=>{this._marker&&r.removeDecoration(this._marker),this._marker=r.addDecoration(z.fromPositions(e,n),this._decorationOptions)})}}dispose(){this._marker&&!this._model.isDisposed()&&this._model.changeDecorations(i=>{i.removeDecoration(this._marker),this._marker=void 0})}delta(i){if(this._model.isDisposed()||this._position.lineNumber!==i.lineNumber)return 0;if(this._marker){let e=this._model.getDecorationRange(this._marker);return this._model.getOffsetAt(e.getStartPosition())-this._model.getOffsetAt(i)}else return this._model.getLineMaxColumn(i.lineNumber)-i.column}};var nc=class{constructor(i,e,t,o,n,r,s){this._memoryService=e;this._commandService=t;this._contextKeyService=o;this._instantiationService=n;this._logService=r;this._telemetryService=s;this._lineSuffix=new me;this._toDispose=new N;this._selectors=new Qdi(i=>i.priority);this._onWillInsertSuggestItem=new E;this._wantsForceRenderingAbove=!1;this.editor=i,this.model=n.createInstance(aK,this.editor),this._selectors.register({priority:0,select:(p,h,g)=>this._memoryService.select(p,h,g)});let l=Xn.InsertMode.bindTo(o);l.set(i.getOption(134).insertMode),this._toDispose.add(this.model.onDidTrigger(()=>l.set(i.getOption(134).insertMode))),this.widget=this._toDispose.add(new lO(Re(i.getDomNode()),()=>{let p=this._instantiationService.createInstance(cB,this.editor);this._toDispose.add(p),this._toDispose.add(p.onDidSelect(b=>this._insertSuggestion(b,0),this));let h=new Akt(this.editor,p,this.model,b=>this._insertSuggestion(b,2));this._toDispose.add(h);let g=Xn.MakesTextEdit.bindTo(this._contextKeyService),f=Xn.HasInsertAndReplaceRange.bindTo(this._contextKeyService),v=Xn.CanResolve.bindTo(this._contextKeyService);return this._toDispose.add(Z(()=>{g.reset(),f.reset(),v.reset()})),this._toDispose.add(p.onDidFocus(({item:b})=>{let S=this.editor.getPosition(),y=b.editStart.column,w=S.column,k=!0;this.editor.getOption(1)==="smart"&&this.model.state===2&&!b.completion.additionalTextEdits&&!(b.completion.insertTextRules&4)&&w-y===b.completion.insertText.length&&(k=this.editor.getModel().getValueInRange({startLineNumber:S.lineNumber,startColumn:y,endLineNumber:S.lineNumber,endColumn:w})!==b.completion.insertText),g.set(k),f.set(!ye.equals(b.editInsertEnd,b.editReplaceEnd)),v.set(!!b.provider.resolveCompletionItem||!!b.completion.documentation||b.completion.detail!==b.completion.label)})),this._wantsForceRenderingAbove&&p.forceRenderingAbove(),p})),this._overtypingCapturer=this._toDispose.add(new lO(Re(i.getDomNode()),()=>this._toDispose.add(new Nkt(this.editor,this.model)))),this._alternatives=this._toDispose.add(new lO(Re(i.getDomNode()),()=>this._toDispose.add(new KP(this.editor,this._contextKeyService)))),this._toDispose.add(n.createInstance(x5,i)),this._toDispose.add(this.model.onDidTrigger(p=>{this.widget.value.showTriggered(p.auto,p.shy?250:50),this._lineSuffix.value=new jdi(this.editor.getModel(),p.position)})),this._toDispose.add(this.model.onDidSuggest(p=>{if(p.triggerOptions.shy)return;let h=-1;for(let f of this._selectors.itemsOrderedByPriorityDesc)if(h=f.select(this.editor.getModel(),this.editor.getPosition(),p.completionModel.items),h!==-1)break;if(h===-1&&(h=0),this.model.state===0)return;let g=!1;if(p.triggerOptions.auto){let f=this.editor.getOption(134);f.selectionMode==="never"||f.selectionMode==="always"?g=f.selectionMode==="never":f.selectionMode==="whenTriggerCharacter"?g=p.triggerOptions.triggerKind!==1:f.selectionMode==="whenQuickSuggestion"&&(g=p.triggerOptions.triggerKind===1&&!p.triggerOptions.refilter)}this.widget.value.showSuggestions(p.completionModel,h,p.isFrozen,p.triggerOptions.auto,g)})),this._toDispose.add(this.model.onDidCancel(p=>{p.retrigger||this.widget.value.hideWidget()})),this._toDispose.add(this.editor.onDidBlurEditorWidget(()=>{d2o||(this.model.cancel(),this.model.clear())}));let c=Xn.AcceptSuggestionsOnEnter.bindTo(o),u=()=>{let p=this.editor.getOption(1);c.set(p==="on"||p==="smart")};this._toDispose.add(this.editor.onDidChangeConfiguration(()=>u())),u()}static{this.ID="editor.contrib.suggestController"}static get(i){return i.getContribution(nc.ID)}get onWillInsertSuggestItem(){return this._onWillInsertSuggestItem.event}dispose(){this._alternatives.dispose(),this._toDispose.dispose(),this.widget.dispose(),this.model.dispose(),this._lineSuffix.dispose(),this._onWillInsertSuggestItem.dispose()}_insertSuggestion(i,e){if(!i||!i.item){this._alternatives.value.reset(),this.model.cancel(),this.model.clear();return}if(!this.editor.hasModel())return;let t=vs.get(this.editor);if(!t)return;this._onWillInsertSuggestItem.fire({item:i.item});let o=this.editor.getModel(),n=o.getAlternativeVersionId(),{item:r}=i,s=[],l=new Ye;e&1||this.editor.pushUndoStop();let c=this.getOverwriteInfo(r,!!(e&8));this._memoryService.memorize(o,this.editor.getPosition(),r);let u=r.isResolved,p=-1,h=-1;if(Array.isArray(r.completion.additionalTextEdits)){this.model.cancel();let f=DC.capture(this.editor);this.editor.executeEdits("suggestController.additionalTextEdits.sync",r.completion.additionalTextEdits.map(v=>{let b=z.lift(v.range);if(b.startLineNumber===r.position.lineNumber&&b.startColumn>r.position.column){let S=this.editor.getPosition().column-r.position.column,y=S,w=z.spansMultipleLines(b)?0:S;b=new z(b.startLineNumber,b.startColumn+y,b.endLineNumber,b.endColumn+w)}return Hn.replaceMove(b,v.text)})),f.restoreRelativeVerticalPositionOfCursor(this.editor)}else if(!u){let f=new Dn,v,b=o.onDidChangeContent(k=>{if(k.isFlush){l.cancel(),b.dispose();return}for(let T of k.changes){let P=z.getEndPosition(T.range);(!v||ye.isBefore(P,v))&&(v=P)}}),S=e;e|=2;let y=!1,w=this.editor.onWillType(()=>{w.dispose(),y=!0,S&2||this.editor.pushUndoStop()});s.push(r.resolve(l.token).then(()=>{if(!r.completion.additionalTextEdits||l.token.isCancellationRequested)return;if(v&&r.completion.additionalTextEdits.some(T=>ye.isBefore(v,z.getStartPosition(T.range))))return!1;y&&this.editor.pushUndoStop();let k=DC.capture(this.editor);return this.editor.executeEdits("suggestController.additionalTextEdits.async",r.completion.additionalTextEdits.map(T=>Hn.replaceMove(z.lift(T.range),T.text))),k.restoreRelativeVerticalPositionOfCursor(this.editor),(y||!(S&2))&&this.editor.pushUndoStop(),!0}).then(k=>{this._logService.trace("[suggest] async resolving of edits DONE (ms, applied?)",f.elapsed(),k),h=k===!0?1:k===!1?0:-2}).finally(()=>{b.dispose(),w.dispose()}))}let{insertText:g}=r.completion;if(r.completion.insertTextRules&4||(g=eg.escape(g)),this.model.cancel(),t.insert(g,{overwriteBefore:c.overwriteBefore,overwriteAfter:c.overwriteAfter,undoStopBefore:!1,undoStopAfter:!1,adjustWhitespace:!(r.completion.insertTextRules&1),clipboardText:i.model.clipboardText,overtypingCapturer:this._overtypingCapturer.value,reason:Wc.suggest({providerId:P1.fromExtensionId(r.extensionId?.value)})}),e&2||this.editor.pushUndoStop(),r.completion.command)if(r.completion.command.id===Fkt.id)this.model.trigger({auto:!0,retrigger:!0});else{let f=new Dn;s.push(this._commandService.executeCommand(r.completion.command.id,...r.completion.command.arguments?[...r.completion.command.arguments]:[]).catch(v=>{r.completion.extensionId?ys(v):mt(v)}).finally(()=>{p=f.elapsed()}))}e&4&&this._alternatives.value.set(i,f=>{for(l.cancel();o.canUndo();){n!==o.getAlternativeVersionId()&&o.undo(),this._insertSuggestion(f,3|(e&8?8:0));break}}),this._alertCompletionItem(r),Promise.all(s).finally(()=>{this._reportSuggestionAcceptedTelemetry(r,o,u,p,h,i.index,i.model.items),this.model.clear(),l.dispose()})}_reportSuggestionAcceptedTelemetry(i,e,t,o,n,r,s){if(Math.random()>1e-4)return;let l=new Map;for(let h=0;h<Math.min(30,s.length);h++){let g=s[h].textLabel;l.has(g)?l.get(g).push(h):l.set(g,[h])}let c=l.get(i.textLabel),p=c&&c.length>1?c[0]:-1;this._telemetryService.publicLog2("suggest.acceptedSuggestion",{extensionId:i.extensionId?.value??"unknown",providerId:i.provider._debugDisplayName??"unknown",kind:i.completion.kind,basenameHash:_r(He(e.uri)).toString(16),languageId:e.getLanguageId(),fileExtension:es(e.uri),resolveInfo:i.provider.resolveCompletionItem?t?1:0:-1,resolveDuration:i.resolveDuration,commandDuration:o,additionalEditsAsync:n,index:r,firstIndex:p})}getOverwriteInfo(i,e){wo(this.editor.hasModel());let t=this.editor.getOption(134).insertMode==="replace";e&&(t=!t);let o=i.position.column-i.editStart.column,n=(t?i.editReplaceEnd.column:i.editInsertEnd.column)-i.position.column,r=this.editor.getPosition().column-i.position.column,s=this._lineSuffix.value?this._lineSuffix.value.delta(this.editor.getPosition()):0;return{overwriteBefore:o+r,overwriteAfter:n+s}}_alertCompletionItem(i){if(yr(i.completion.additionalTextEdits)){let e=d(1629,null,i.textLabel,i.completion.additionalTextEdits.length);en(e)}}triggerSuggest(i,e,t){this.editor.hasModel()&&(this.model.trigger({auto:e??!1,completionOptions:{providerFilter:i,kindFilter:t?new Set:void 0}}),this.editor.revealPosition(this.editor.getPosition(),0),this.editor.focus())}triggerSuggestAndAcceptBest(i){if(!this.editor.hasModel())return;let e=this.editor.getPosition(),t=()=>{e.equals(this.editor.getPosition())&&this._commandService.executeCommand(i.fallback)},o=n=>{if(n.completion.insertTextRules&4||n.completion.additionalTextEdits)return!0;let r=this.editor.getPosition(),s=n.editStart.column,l=r.column;return l-s!==n.completion.insertText.length?!0:this.editor.getModel().getValueInRange({startLineNumber:r.lineNumber,startColumn:s,endLineNumber:r.lineNumber,endColumn:l})!==n.completion.insertText};U.once(this.model.onDidTrigger)(n=>{let r=[];U.any(this.model.onDidTrigger,this.model.onDidCancel)(()=>{Be(r),t()},void 0,r),this.model.onDidSuggest(({completionModel:s})=>{if(Be(r),s.items.length===0){t();return}let l=this._memoryService.select(this.editor.getModel(),this.editor.getPosition(),s.items),c=s.items[l];if(!o(c)){t();return}this.editor.pushUndoStop(),this._insertSuggestion({index:l,item:c,model:s},7)},void 0,r)}),this.model.trigger({auto:!1,shy:!0}),this.editor.revealPosition(e,0),this.editor.focus()}acceptSelectedSuggestion(i,e){let t=this.widget.value.getFocusedItem(),o=0;i&&(o|=4),e&&(o|=8),this._insertSuggestion(t,o)}acceptNextSuggestion(){this._alternatives.value.next()}acceptPrevSuggestion(){this._alternatives.value.prev()}cancelSuggestWidget(){this.model.cancel(),this.model.clear(),this.widget.value.hideWidget()}focusSuggestion(){this.widget.value.focusSelected()}selectNextSuggestion(){this.widget.value.selectNext()}selectNextPageSuggestion(){this.widget.value.selectNextPage()}selectLastSuggestion(){this.widget.value.selectLast()}selectPrevSuggestion(){this.widget.value.selectPrevious()}selectPrevPageSuggestion(){this.widget.value.selectPreviousPage()}selectFirstSuggestion(){this.widget.value.selectFirst()}toggleSuggestionDetails(){this.widget.value.toggleDetails()}toggleExplainMode(){this.widget.value.toggleExplainMode()}toggleSuggestionFocus(){this.widget.value.toggleDetailsFocus()}resetWidgetSize(){this.widget.value.resetPersistedSize()}forceRenderingAbove(){this.widget.isInitialized?this.widget.value.forceRenderingAbove():this._wantsForceRenderingAbove=!0}stopForceRenderingAbove(){this.widget.isInitialized?this.widget.value.stopForceRenderingAbove():this._wantsForceRenderingAbove=!1}registerSelector(i){return this._selectors.register(i)}};nc=I([m(1,pke),m(2,ge),m(3,X),m(4,F),m(5,se),m(6,Te)],nc);var Qdi=class{constructor(i){this.prioritySelector=i;this._items=new Array}register(i){if(this._items.indexOf(i)!==-1)throw new Error("Value is already registered");return this._items.push(i),this._items.sort((e,t)=>this.prioritySelector(t)-this.prioritySelector(e)),{dispose:()=>{let e=this._items.indexOf(i);e>=0&&this._items.splice(e,1)}}}get itemsOrderedByPriorityDesc(){return this._items}},Fkt=class a extends Di{static{this.id="editor.action.triggerSuggest"}constructor(){super({id:a.id,label:L(1634,"Trigger Suggest"),precondition:C.and(pe.writable,pe.hasCompletionItemProvider,Xn.Visible.toNegated()),kbOpts:{kbExpr:pe.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[521,2087]},weight:100}})}run(i,e,t){let o=nc.get(e);if(!o)return;let n;t&&typeof t=="object"&&t.auto===!0&&(n=!0),o.triggerSuggest(void 0,n,void 0)}};xo(nc.ID,nc,2);ni(Fkt);var j_=190,lk=Oc.bindToContribution(nc.get);Xi(new lk({id:"acceptSelectedSuggestion",precondition:C.and(Xn.Visible,Xn.HasFocusedSuggestion),handler(a){a.acceptSelectedSuggestion(!0,!1)},kbOpts:[{primary:2,kbExpr:C.and(Xn.Visible,pe.textInputFocus),weight:j_},{primary:3,kbExpr:C.and(Xn.Visible,pe.textInputFocus,Xn.AcceptSuggestionsOnEnter,Xn.MakesTextEdit),weight:j_}],menuOpts:[{menuId:sB,title:d(1627,null),group:"left",order:1,when:C.and(Xn.HasFocusedSuggestion,Xn.HasInsertAndReplaceRange.toNegated())},{menuId:sB,title:d(1627,null),group:"left",order:1,when:C.and(Xn.HasFocusedSuggestion,Xn.HasInsertAndReplaceRange,Xn.InsertMode.isEqualTo("insert"))},{menuId:sB,title:d(1628,null),group:"left",order:1,when:C.and(Xn.HasFocusedSuggestion,Xn.HasInsertAndReplaceRange,Xn.InsertMode.isEqualTo("replace"))}]}));Xi(new lk({id:"acceptAlternativeSelectedSuggestion",precondition:C.and(Xn.Visible,pe.textInputFocus,Xn.HasFocusedSuggestion),kbOpts:{weight:j_,kbExpr:pe.textInputFocus,primary:1027,secondary:[1026]},handler(a){a.acceptSelectedSuggestion(!1,!0)},menuOpts:[{menuId:sB,group:"left",order:2,when:C.and(Xn.HasFocusedSuggestion,Xn.HasInsertAndReplaceRange,Xn.InsertMode.isEqualTo("insert")),title:d(1628,null)},{menuId:sB,group:"left",order:2,when:C.and(Xn.HasFocusedSuggestion,Xn.HasInsertAndReplaceRange,Xn.InsertMode.isEqualTo("replace")),title:d(1627,null)}]}));$e.registerCommandAlias("acceptSelectedSuggestionOnEnter","acceptSelectedSuggestion");Xi(new lk({id:"hideSuggestWidget",precondition:Xn.Visible,handler:a=>a.cancelSuggestWidget(),kbOpts:{weight:j_,kbExpr:pe.textInputFocus,primary:9,secondary:[1033]}}));Xi(new lk({id:"selectNextSuggestion",precondition:C.and(Xn.Visible,C.or(Xn.MultipleSuggestions,Xn.HasFocusedSuggestion.negate())),handler:a=>a.selectNextSuggestion(),kbOpts:{weight:j_,kbExpr:pe.textInputFocus,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}},menuOpts:{menuId:sB,group:"left",order:0,when:Xn.HasFocusedSuggestion.toNegated(),title:d(1632,null)}}));Xi(new lk({id:"selectNextPageSuggestion",precondition:C.and(Xn.Visible,C.or(Xn.MultipleSuggestions,Xn.HasFocusedSuggestion.negate())),handler:a=>a.selectNextPageSuggestion(),kbOpts:{weight:j_,kbExpr:pe.textInputFocus,primary:12,secondary:[2060]}}));Xi(new lk({id:"selectLastSuggestion",precondition:C.and(Xn.Visible,C.or(Xn.MultipleSuggestions,Xn.HasFocusedSuggestion.negate())),handler:a=>a.selectLastSuggestion()}));Xi(new lk({id:"selectPrevSuggestion",precondition:C.and(Xn.Visible,C.or(Xn.MultipleSuggestions,Xn.HasFocusedSuggestion.negate())),handler:a=>a.selectPrevSuggestion(),kbOpts:{weight:j_,kbExpr:pe.textInputFocus,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}}));Xi(new lk({id:"selectPrevPageSuggestion",precondition:C.and(Xn.Visible,C.or(Xn.MultipleSuggestions,Xn.HasFocusedSuggestion.negate())),handler:a=>a.selectPrevPageSuggestion(),kbOpts:{weight:j_,kbExpr:pe.textInputFocus,primary:11,secondary:[2059]}}));Xi(new lk({id:"selectFirstSuggestion",precondition:C.and(Xn.Visible,C.or(Xn.MultipleSuggestions,Xn.HasFocusedSuggestion.negate())),handler:a=>a.selectFirstSuggestion()}));Xi(new lk({id:"focusSuggestion",precondition:C.and(Xn.Visible,Xn.HasFocusedSuggestion.negate()),handler:a=>a.focusSuggestion(),kbOpts:{weight:j_,kbExpr:pe.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}}}));Xi(new lk({id:"focusAndAcceptSuggestion",precondition:C.and(Xn.Visible,Xn.HasFocusedSuggestion.negate()),handler:a=>{a.focusSuggestion(),a.acceptSelectedSuggestion(!0,!1)}}));Xi(new lk({id:"toggleSuggestionDetails",precondition:C.and(Xn.Visible,Xn.HasFocusedSuggestion),handler:a=>a.toggleSuggestionDetails(),kbOpts:{weight:j_,kbExpr:pe.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}},menuOpts:[{menuId:sB,group:"right",order:1,when:C.and(Xn.DetailsVisible,Xn.CanResolve),title:d(1631,null)},{menuId:sB,group:"right",order:1,when:C.and(Xn.DetailsVisible.toNegated(),Xn.CanResolve),title:d(1630,null)}]}));Xi(new lk({id:"toggleExplainMode",precondition:Xn.Visible,handler:a=>a.toggleExplainMode(),kbOpts:{weight:100,primary:2138}}));Xi(new lk({id:"toggleSuggestionFocus",precondition:Xn.Visible,handler:a=>a.toggleSuggestionFocus(),kbOpts:{weight:j_,kbExpr:pe.textInputFocus,primary:2570,mac:{primary:778}}}));Xi(new lk({id:"insertBestCompletion",precondition:C.and(pe.textInputFocus,C.equals("config.editor.tabCompletion","on"),x5.AtEnd,Xn.Visible.toNegated(),KP.OtherSuggestions.toNegated(),vs.InSnippetMode.toNegated()),handler:(a,i)=>{a.triggerSuggestAndAcceptBest(xi(i)?{fallback:"tab",...i}:{fallback:"tab"})},kbOpts:{weight:j_,primary:2}}));Xi(new lk({id:"insertNextSuggestion",precondition:C.and(pe.textInputFocus,C.equals("config.editor.tabCompletion","on"),KP.OtherSuggestions,Xn.Visible.toNegated(),vs.InSnippetMode.toNegated()),handler:a=>a.acceptNextSuggestion(),kbOpts:{weight:j_,kbExpr:pe.textInputFocus,primary:2}}));Xi(new lk({id:"insertPrevSuggestion",precondition:C.and(pe.textInputFocus,C.equals("config.editor.tabCompletion","on"),KP.OtherSuggestions,Xn.Visible.toNegated(),vs.InSnippetMode.toNegated()),handler:a=>a.acceptPrevSuggestion(),kbOpts:{weight:j_,kbExpr:pe.textInputFocus,primary:1026}}));Xi(new class extends Oc{constructor(){super({id:"suggestWidgetCopy",precondition:Xn.DetailsFocused,kbOpts:{weight:j_+10,kbExpr:Xn.DetailsFocused,primary:2081,win:{primary:2081,secondary:[2067]}}})}runEditorCommand(a,i){Re(i.getDomNode()).document.execCommand("copy")}});ni(class extends Di{constructor(){super({id:"editor.action.resetSuggestSize",label:L(1633,"Reset Suggest Widget Size"),precondition:void 0})}run(a,i){nc.get(i)?.resetWidgetSize()}});var Ydi=class extends x{constructor(e,t,o){super();this.editor=e;this.suggestControllerPreselector=t;this.onWillAccept=o;this.isSuggestWidgetVisible=!1;this.isShiftKeyPressed=!1;this._isActive=!1;this._currentSuggestItemInfo=void 0;this._onDidSelectedItemChange=this._register(new E);this.onDidSelectedItemChange=this._onDidSelectedItemChange.event;this._register(e.onKeyDown(r=>{r.shiftKey&&!this.isShiftKeyPressed&&(this.isShiftKeyPressed=!0,this.update(this._isActive))})),this._register(e.onKeyUp(r=>{r.shiftKey&&this.isShiftKeyPressed&&(this.isShiftKeyPressed=!1,this.update(this._isActive))}));let n=nc.get(this.editor);if(n){this._register(n.registerSelector({priority:100,select:(l,c,u)=>{let p=this.editor.getModel();if(!p)return-1;let h=this.suggestControllerPreselector(),g=h?zP(h,p):void 0;if(!g)return-1;let f=ye.lift(c),v=u.map((S,y)=>{let w=N8e.fromSuggestion(n,p,f,S,this.isShiftKeyPressed),k=zP(w.getSingleTextEdit(),p),T=fkt(g,k);return{index:y,valid:T,prefixLength:k.text.length,suggestItem:S}}).filter(S=>S&&S.valid&&S.prefixLength>0),b=n$e(v,cl(S=>S.prefixLength,hu));return b?b.index:-1}}));let r=!1,s=()=>{r||(r=!0,this._register(n.widget.value.onDidShow(()=>{this.isSuggestWidgetVisible=!0,this.update(!0)})),this._register(n.widget.value.onDidHide(()=>{this.isSuggestWidgetVisible=!1,this.update(!1)})),this._register(n.widget.value.onDidFocus(()=>{this.isSuggestWidgetVisible=!0,this.update(!0)})))};this._register(U.once(n.model.onDidTrigger)(l=>{s()})),this._register(n.onWillInsertSuggestItem(l=>{let c=this.editor.getPosition(),u=this.editor.getModel();if(!c||!u)return;let p=N8e.fromSuggestion(n,u,c,l.item,this.isShiftKeyPressed);this.onWillAccept(p)}))}this.update(this._isActive)}get selectedItem(){return this._currentSuggestItemInfo}update(e){let t=this.getSuggestItemInfo();(this._isActive!==e||!u2o(this._currentSuggestItemInfo,t))&&(this._isActive=e,this._currentSuggestItemInfo=t,this._onDidSelectedItemChange.fire())}getSuggestItemInfo(){let e=nc.get(this.editor);if(!e||!this.isSuggestWidgetVisible)return;let t=this.editor.getOption(102);if(typeof t=="object"&&(t.other==="offWhenInlineCompletions"||t.comments==="offWhenInlineCompletions"||t.strings==="offWhenInlineCompletions"))return;let o=e.widget.value.getFocusedItem(),n=this.editor.getPosition(),r=this.editor.getModel();if(!(!o||!n||!r))return N8e.fromSuggestion(e,r,n,o.item,this.isShiftKeyPressed)}stopForceRenderingAbove(){nc.get(this.editor)?.stopForceRenderingAbove()}forceRenderingAbove(){nc.get(this.editor)?.forceRenderingAbove()}},N8e=class a{constructor(i,e,t,o,n){this.range=i;this.insertText=e;this.completionItemKind=t;this.isSnippetText=o;this.listIncomplete=n}static fromSuggestion(i,e,t,o,n){let{insertText:r}=o.completion,s=!1;if(o.completion.insertTextRules&4){let c=new eg().parse(r);c.children.length<100&&NC.adjustWhitespace(e,t,!0,c),r=c.toString(),s=!0}let l=i.getOverwriteInfo(o,n);return new a(z.fromPositions(t.delta(0,-l.overwriteBefore),t.delta(0,Math.max(l.overwriteAfter,0))),r,o.completion.kind,s,o.container.incomplete??!1)}equals(i){return this.range.equalsRange(i.range)&&this.insertText===i.insertText&&this.completionItemKind===i.completionItemKind&&this.isSnippetText===i.isSnippetText}toSelectedSuggestionInfo(){return new cvt(this.range,this.insertText,this.completionItemKind,this.isSnippetText)}getSingleTextEdit(){return new ss(this.range,this.insertText)}};function u2o(a,i){return a===i?!0:!a||!i?!1:a.equals(i)}var Wkt=class extends x{constructor(e,t,o){super();this._editorObs=e;this._handleSuggestAccepted=t;this._suggestControllerPreselector=o;this._suggestWidgetAdaptor=this._register(new Ydi(this._editorObs.editor,()=>(this._editorObs.forceUpdate(),this._suggestControllerPreselector()),n=>this._editorObs.forceUpdate(r=>{this._handleSuggestAccepted(n)}))),this.selectedItem=ui(this,n=>this._suggestWidgetAdaptor.onDidSelectedItemChange(()=>{this._editorObs.forceUpdate(r=>n(void 0))}),()=>this._suggestWidgetAdaptor.selectedItem)}stopForceRenderingAbove(){this._suggestWidgetAdaptor.stopForceRenderingAbove()}forceRenderingAbove(){this._suggestWidgetAdaptor.forceRenderingAbove()}};var rde=class a{constructor(i,e){this.startColumn=i;this.endColumnExclusive=e;if(i>e)throw new li(`startColumn ${i} cannot be after endColumnExclusive ${e}`)}static fromOffsetRange(i){return new a(i.start+1,i.endExclusive+1)}toRange(i){return new z(i,this.startColumn,i,this.endColumnExclusive)}equals(i){return this.startColumn===i.startColumn&&this.endColumnExclusive===i.endColumnExclusive}toZeroBasedOffsetRange(){return new pi(this.startColumn-1,this.endColumnExclusive-1)}};var Vkt=class a{constructor(i,e){this.lineNumber=i;this.columnRange=e}static fromRange(i){if(i.endLineNumber===i.startLineNumber)return new a(i.startLineNumber,new rde(i.startColumn,i.endColumn))}toRange(){return new z(this.lineNumber,this.columnRange.startColumn,this.lineNumber,this.columnRange.endColumnExclusive)}};var O8e=class a{constructor(i){this._tokenInfo=i}static fromLineTokens(i){let e=[];for(let t=0;t<i.getCount();t++)e.push(new Bkt(i.getTokenText(t),i.getMetadata(t)));return a.create(e)}static create(i){return new a(i)}toLineTokens(i){return Zc.createFromTextAndMetadata(this.map((e,t)=>({text:t.text,metadata:t.metadata})),i)}forEach(i){let e=0;for(let t of this._tokenInfo){let o=new pi(e,e+t.text.length);i(o,t),e+=t.text.length}}map(i){let e=[],t=0;for(let o of this._tokenInfo){let n=new pi(t,t+o.text.length);e.push(i(n,o)),t+=o.text.length}return e}slice(i){let e=[],t=0;for(let o of this._tokenInfo){let n=t,r=n+o.text.length;if(r>i.start){if(n>=i.endExclusive)break;let s=Math.max(0,i.start-n),l=Math.max(0,r-i.endExclusive);e.push(new Bkt(o.text.slice(s,o.text.length-l),o.metadata))}t+=o.text.length}return a.create(e)}append(i){let e=this._tokenInfo.concat(i._tokenInfo);return a.create(e)}},Bkt=class{constructor(i,e){this.text=i;this.metadata=e}};var Hkt=class a{constructor(i=R.warning){this.icon=i}static from(i){if(i)return new a(i.icon)}},BYi=!0,zYi="ghost-text",cK=class extends x{constructor(e,t,o,n){super();this._editor=e;this._data=t;this._languageService=n;this._isDisposed=Me(this,!1);this._warningState=ke(e=>{let t=this._data.read(e),o=t?.warning;if(!t||!o)return;let n=t.ghostText;return{lineNumber:n.lineNumber,position:new ye(n.lineNumber,n.parts[0].column),icon:o.icon}});this._onDidClick=this._register(new E);this.onDidClick=this._onDidClick.event;this._nonWhitespaceCount=ke(this,e=>{let t=this._data.read(e);return t?t.ghostText.parts.map(r=>r.lines.map(s=>s.line).join("")).join("").replace(/\s/g,"").length:void 0});this._extraClassNames=ke(this,e=>{let t=this._extraClasses.slice();BYi&&this._warningState.read(e)&&t.push("warning");let o=this._nonWhitespaceCount.read(e);return this._highlightShortText&&o&&o<3?t.push("short-text"):this._useSyntaxHighlighting.read(e)&&t.push("syntax-highlighted"),t.map(r=>` ${r}`).join("")});this._state=ke(this,e=>{if(this._isDisposed.read(e))return;let t=this._data.read(e);if(!t)return;let o=this._editorObs.model.read(e);if(!o)return;let n=t.ghostText,r=n instanceof ake?n.columnRange:void 0,s=this._useSyntaxHighlighting.read(e),l=this._extraClassNames.read(e),{inlineTexts:c,additionalLines:u,hiddenRange:p,additionalLinesOriginalSuffix:h}=p2o(n,o,zYi+l),g=o.getLineContent(n.lineNumber),f=new ld(c.map(O=>ed.insert(O.column-1,O.text))),v=s?o.tokenization.tokenizeLinesAt(n.lineNumber,[f.apply(g),...u.map(O=>O.content)]):void 0,b=f.getNewRanges(),S=c.map((O,V)=>({...O,tokens:v?.[0]?.getTokensInRange(b[V])})),y=u.map((O,V)=>{let H=v?.[V+1]??Zc.createEmpty(O.content,this._languageService.languageIdCodec);if(V===u.length-1&&h){let $=O8e.fromLineTokens(o.tokenization.getLineTokens(h.lineNumber)).slice(h.columnRange.toZeroBasedOffsetRange());H=O8e.fromLineTokens(H).append($).toLineTokens(H.languageIdCodec)}return new Zdi(H,O.decorations)}),w=this._editor.getSelection()?.getStartPosition().column,k=S.filter(O=>O.text!==""),T=k.length!==0,P=new tde((T?k[0].column:1)-w,T?0:u.findIndex(O=>O.content!=="")+1,T?1:0,u.length+(T?1:0),0,FSe(k.map(O=>O.text.length))+FSe(y.map(O=>O.content.getTextLength())),k.length+(u.length>0?1:0),k.length>1&&y.length===0?k.every(O=>O.text===k[0].text):void 0);return{replacedRange:r,inlineTexts:S,additionalLines:y,hiddenRange:p,lineNumber:n.lineNumber,additionalReservedLineCount:this._minReservedLineCount.read(e),targetTextModel:o,syntaxHighlightingEnabled:s,telemetryViewData:P,handleInlineCompletionShown:t.handleInlineCompletionShown}});this._decorations=ke(this,e=>{let t=this._state.read(e);if(!t)return[];let o=[],n=this._extraClassNames.read(e);t.replacedRange&&o.push({range:t.replacedRange.toRange(t.lineNumber),options:{inlineClassName:"inline-completion-text-to-replace"+n,description:"GhostTextReplacement"}}),t.hiddenRange&&o.push({range:t.hiddenRange.toRange(t.lineNumber),options:{inlineClassName:"ghost-text-hidden",description:"ghost-text-hidden"}});for(let r of t.inlineTexts){let s="";this._highlightShortText&&r.text.length<5&&(s+=" short-text"),o.push({range:z.fromPositions(new ye(t.lineNumber,r.column)),options:{description:"ghost-text-decoration",after:{content:r.text,tokens:r.tokens,inlineClassName:(r.preview?"ghost-text-decoration-preview":"ghost-text-decoration")+(this._isClickable?" clickable":"")+n+s+r.lineDecorations.map(l=>" "+l.className).join(" "),cursorStops:2,attachedData:new F8e(this)},showIfCollapsed:!0}})}return o});this.isHovered=ke(this,e=>this._isDisposed.read(e)?!1:this._isInlineTextHovered.read(e)||this._additionalLinesWidget.isHovered.read(e));this.height=ke(this,e=>this._editorObs.getOption(75).read(e)+(this._additionalLinesWidget.viewZoneHeight.read(e)??0));this._extraClasses=o.extraClasses??[],this._isClickable=o.isClickable??!1,this._shouldKeepCursorStable=o.shouldKeepCursorStable??!1,this._minReservedLineCount=o.minReservedLineCount??So(0),this._useSyntaxHighlighting=o.useSyntaxHighlighting??So(!0),this._highlightShortText=o.highlightShortSuggestions??!1,this._editorObs=gs(this._editor),this._additionalLinesWidget=this._register(new Jdi(this._editor,Os({owner:this,equalsFn:S1(G9())},r=>{let s=this._state.read(r);return s?new Xdi(s.lineNumber,s.additionalLines,s.additionalReservedLineCount):void 0}),this._shouldKeepCursorStable,this._isClickable)),this._isInlineTextHovered=this._editorObs.isTargetHovered(r=>r.target.type===6&&r.target.detail.injectedText?.options.attachedData instanceof F8e&&r.target.detail.injectedText.options.attachedData.owner===this,this._store),this._register(Z(()=>{this._isDisposed.set(!0,void 0)})),this._register(this._editorObs.setDecorations(this._decorations)),this._isClickable&&(this._register(this._additionalLinesWidget.onDidClick(r=>this._onDidClick.fire(r))),this._register(this._editor.onMouseUp(r=>{if(r.target.type!==6)return;let s=r.target.detail.injectedText?.options.attachedData;s instanceof F8e&&s.owner===this&&this._onDidClick.fire(r.event)}))),this._register(be(r=>{let s=this._state.read(r);s?.handleInlineCompletionShown(s.telemetryViewData)})),this._register(il((r,s)=>{if(BYi)return;let l=this._warningState.read(r);if(!l)return;let c=this._editorObs.getOption(75);s.add(this._editorObs.createContentWidget({position:So({position:new ye(l.lineNumber,Number.MAX_SAFE_INTEGER),preference:[0],positionAffinity:1}),allowEditorOverflow:!1,domNode:Bo.div({class:"ghost-text-view-warning-widget",style:{width:c,height:c,marginLeft:4,color:"orange"},ref:u=>{u.ghostTextViewWarningWidgetData={range:z.fromPositions(l.position)}}},[Bo.div({class:"ghost-text-view-warning-widget-icon",style:{width:"100%",height:"100%",display:"flex",alignContent:"center",alignItems:"center"}},[Sn(l.icon)])]).keepUpdated(s).element}))}))}static getWarningWidgetContext(e){let t=e.ghostTextViewWarningWidgetData;if(t)return t;if(e.parentElement)return this.getWarningWidgetContext(e.parentElement)}ownsViewZone(e){return this._additionalLinesWidget.viewZoneId===e}};cK=I([m(3,_t)],cK);var F8e=class{constructor(i){this.owner=i}};function p2o(a,i,e){let t=[],o=[];function n(p,h){if(o.length>0){let g=o[o.length-1];h&&g.decorations.push(new db(g.content.length+1,g.content.length+1+p[0].line.length,h,0)),g.content+=p[0].line,p=p.slice(1)}for(let g of p)o.push({content:g.line,decorations:h?[new db(1,g.line.length+1,h,0),...g.lineDecorations]:[...g.lineDecorations]})}let r=i.getLineContent(a.lineNumber),s,l=0;for(let p of a.parts){let h=p.lines;s===void 0?(t.push({column:p.column,text:h[0].line,preview:p.preview,lineDecorations:h[0].lineDecorations}),h=h.slice(1)):n([{line:r.substring(l,p.column-1),lineDecorations:[]}],void 0),h.length>0&&(n(h,e),s===void 0&&p.column<=r.length&&(s=p.column)),l=p.column-1}let c;s!==void 0&&(c=new Vkt(a.lineNumber,new rde(l+1,r.length+1)));let u=s!==void 0?new rde(s,r.length+1):void 0;return{inlineTexts:t,additionalLines:o,hiddenRange:u,additionalLinesOriginalSuffix:c}}var Xdi=class{constructor(i,e,t){this.lineNumber=i;this.additionalLines=e;this.minReservedLineCount=t}equals(i){return this.lineNumber!==i.lineNumber||this.minReservedLineCount!==i.minReservedLineCount?!1:$i(this.additionalLines,i.additionalLines,G9())}},Jdi=class extends x{constructor(e,t,o,n){super();this._editor=e;this._lines=t;this._shouldKeepCursorStable=o;this._isClickable=n;this._viewZoneHeight=Me("viewZoneHeight",void 0),this.editorOptionsChanged=Fr("editorOptionChanged",U.filter(this._editor.onDidChangeConfiguration,r=>r.hasChanged(40)||r.hasChanged(133)||r.hasChanged(113)||r.hasChanged(108)||r.hasChanged(60)||r.hasChanged(59)||r.hasChanged(75))),this._onDidClick=this._register(new E),this.onDidClick=this._onDidClick.event,this._viewZoneListener=this._register(new me),this.isHovered=gs(this._editor).isTargetHovered(r=>HYi(r.target.element),this._store),this.hasBeenAccepted=!1,this._editor instanceof Xr&&this._shouldKeepCursorStable&&this._register(this._editor.onBeforeExecuteEdit(r=>this.hasBeenAccepted=r.source==="inlineSuggestion.accept")),this._register(be(r=>{let s=this._lines.read(r);this.editorOptionsChanged.read(r),s?(this.hasBeenAccepted=!1,this.updateLines(s.lineNumber,s.additionalLines,s.minReservedLineCount)):this.clear()}))}get viewZoneId(){return this._viewZoneInfo?.viewZoneId}get viewZoneHeight(){return this._viewZoneHeight}dispose(){super.dispose(),this.clear()}clear(){this._viewZoneListener.clear(),this._editor.changeViewZones(e=>{this.removeActiveViewZone(e)})}updateLines(e,t,o){let n=this._editor.getModel();if(!n)return;let{tabSize:r}=n.getOptions();gs(this._editor).transaction(s=>{this._editor.changeViewZones(l=>{let c=new N;this.removeActiveViewZone(l);let u=Math.max(t.length,o);if(u>0){let p=document.createElement("div");m2o(p,r,t,this._editor.getOptions(),this._isClickable),this._isClickable&&(c.add(j(p,"mousedown",h=>{h.preventDefault()})),c.add(j(p,"click",h=>{HYi(h.target)&&this._onDidClick.fire(new Cn(Re(h),h))}))),this.addViewZone(l,e,u,p)}this._viewZoneListener.value=c})})}addViewZone(e,t,o,n){let r=e.addZone({afterLineNumber:t,heightInLines:o,domNode:n,afterColumnAffinity:1,onComputedHeight:s=>{this._viewZoneHeight.set(s,void 0)}});this.keepCursorStable(t,o),this._viewZoneInfo={viewZoneId:r,heightInLines:o,lineNumber:t}}removeActiveViewZone(e){this._viewZoneInfo&&(e.removeZone(this._viewZoneInfo.viewZoneId),this.hasBeenAccepted||this.keepCursorStable(this._viewZoneInfo.lineNumber,-this._viewZoneInfo.heightInLines),this._viewZoneInfo=void 0,this._viewZoneHeight.set(void 0,void 0))}keepCursorStable(e,t){if(!this._shouldKeepCursorStable)return;let o=this._editor.getSelection()?.getStartPosition()?.lineNumber;o!==void 0&&e<o&&this._editor.setScrollTop(this._editor.getScrollTop()+t*this._editor.getOption(75))}};function HYi(a){return Do(a)&&a.classList.contains(zYi)}var Zdi=class{constructor(i,e){this.content=i;this.decorations=e}equals(i){return this.content.equals(i.content)?db.equalsArr(this.decorations,i.decorations):!1}};function m2o(a,i,e,t,o){let n=t.get(40),r=t.get(133),s="none",l=t.get(108),c=t.get(60),u=t.get(59),p=t.get(75),h="suggest-preview-text";o&&(h+=" clickable");let g=new $S(1e4);g.appendString(`<div class="${h}">`);for(let b=0,S=e.length;b<S;b++){let y=e[b],w=y.content;g.appendString('<div class="view-line'),g.appendString('" style="top:'),g.appendString(String(b*p)),g.appendString('px;width:1000000px;">');let k=w.getLineContent(),T=g1(k),P=uP(k);AV(new XL(u.isMonospace&&!n,u.canUseHalfwidthRightwardsArrow,k,!1,T,P,0,w,y.decorations.slice(),i,0,u.spaceWidth,u.middotWidth,u.wsmiddotWidth,r,s,l,c!==Bx.OFF,null,null,0),g),g.appendString("</div>")}g.appendString("</div>"),Jd(a,u);let f=g.build(),v=UYi?UYi.createHTML(f):f;a.innerHTML=v}var UYi=pf("editorGhostText",{createHTML:a=>a});var rX=class a{constructor(i,e){this.width=i;this.height=e}static equals(i,e){return i.width===e.width&&i.height===e.height}add(i){return new a(this.width+i.width,this.height+i.height)}deltaX(i){return new a(this.width+i,this.height)}deltaY(i){return new a(this.width,this.height+i)}toString(){return`(${this.width},${this.height})`}subtract(i){return new a(this.width-i.width,this.height-i.height)}scale(i){return new a(this.width*i,this.height*i)}scaleWidth(i){return new a(this.width*i,this.height)}mapComponents(i){return new a(i(this.width),i(this.height))}isZero(){return this.width===0&&this.height===0}transpose(){return new a(this.height,this.width)}toDimension(){return{width:this.width,height:this.height}}};var Wu=class a{constructor(i,e,t,o){this.left=i;this.top=e;this.right=t;this.bottom=o;if(i>t)throw new li("Invalid arguments: Horizontally offset by "+(i-t));if(e>o)throw new li("Invalid arguments: Vertically offset by "+(e-o))}static fromPoint(i){return new a(i.x,i.y,i.x,i.y)}static fromPoints(i,e){return new a(i.x,i.y,e.x,e.y)}static fromPointSize(i,e){return new a(i.x,i.y,i.x+e.x,i.y+e.y)}static fromLeftTopRightBottom(i,e,t,o){return new a(i,e,t,o)}static fromLeftTopWidthHeight(i,e,t,o){return new a(i,e,i+t,e+o)}static fromRanges(i,e){return new a(i.start,e.start,i.endExclusive,e.endExclusive)}static hull(i){let e=Number.MAX_SAFE_INTEGER,t=Number.MAX_SAFE_INTEGER,o=Number.MIN_SAFE_INTEGER,n=Number.MIN_SAFE_INTEGER;for(let r of i)e=Math.min(e,r.left),t=Math.min(t,r.top),o=Math.max(o,r.right),n=Math.max(n,r.bottom);return new a(e,t,o,n)}get width(){return this.right-this.left}get height(){return this.bottom-this.top}withMargin(i,e,t,o){let n,r,s,l;return e===void 0&&t===void 0&&o===void 0?n=r=s=l=i:t===void 0&&o===void 0?(n=r=e,s=l=i):(n=o,r=e,s=i,l=t),new a(this.left-n,this.top-s,this.right+r,this.bottom+l)}intersectVertical(i){let e=Math.max(this.top,i.start),t=Math.min(this.bottom,i.endExclusive);return new a(this.left,e,this.right,Math.max(e,t))}intersectHorizontal(i){let e=Math.max(this.left,i.start),t=Math.min(this.right,i.endExclusive);return new a(e,this.top,Math.max(e,t),this.bottom)}toString(){return`Rect{(${this.left},${this.top}), (${this.right},${this.bottom})}`}intersect(i){let e=Math.max(this.left,i.left),t=Math.min(this.right,i.right),o=Math.max(this.top,i.top),n=Math.min(this.bottom,i.bottom);if(!(e>t||o>n))return new a(e,o,t,n)}union(i){return new a(Math.min(this.left,i.left),Math.min(this.top,i.top),Math.max(this.right,i.right),Math.max(this.bottom,i.bottom))}containsRect(i){return this.left<=i.left&&this.top<=i.top&&this.right>=i.right&&this.bottom>=i.bottom}containsPoint(i){return this.left<=i.x&&this.top<=i.y&&this.right>=i.x&&this.bottom>=i.y}moveToBeContainedIn(i){let e=this.width,t=this.height,o=this.left,n=this.top;return o<i.left?o=i.left:o+e>i.right&&(o=i.right-e),n<i.top?n=i.top:n+t>i.bottom&&(n=i.bottom-t),new a(o,n,o+e,n+t)}withWidth(i){return new a(this.left,this.top,this.left+i,this.bottom)}withHeight(i){return new a(this.left,this.top,this.right,this.top+i)}withTop(i){return new a(this.left,i,this.right,this.bottom)}withLeft(i){return new a(i,this.top,this.right,this.bottom)}translateX(i){return new a(this.left+i,this.top,this.right+i,this.bottom)}translateY(i){return new a(this.left,this.top+i,this.right,this.bottom+i)}translate(i){return new a(this.left+i.x,this.top+i.y,this.right+i.x,this.bottom+i.y)}deltaRight(i){return new a(this.left,this.top,this.right+i,this.bottom)}deltaTop(i){return new a(this.left,this.top+i,this.right,this.bottom)}deltaLeft(i){return new a(this.left+i,this.top,this.right,this.bottom)}deltaBottom(i){return new a(this.left,this.top,this.right,this.bottom+i)}getLeftBottom(){return new Xh(this.left,this.bottom)}getRightBottom(){return new Xh(this.right,this.bottom)}getLeftTop(){return new Xh(this.left,this.top)}getRightTop(){return new Xh(this.right,this.top)}toStyles(){return{position:"absolute",left:`${this.left}px`,top:`${this.top}px`,width:`${this.width}px`,height:`${this.height}px`}}getHorizontalRange(){return new pi(this.left,this.right)}getVerticalRange(){return new pi(this.top,this.bottom)}withHorizontalRange(i){return new a(i.start,this.top,i.endExclusive,this.bottom)}withVerticalRange(i){return new a(this.left,i.start,this.right,i.endExclusive)}getSize(){return new rX(this.width,this.height)}};var bke=class a{constructor(i,e,t,o=null){this.startLineNumbers=i;this.endLineNumbers=e;this.lastLineRelativePosition=t;this.showEndForLine=o}equals(i){return!!i&&this.lastLineRelativePosition===i.lastLineRelativePosition&&this.showEndForLine===i.showEndForLine&&$i(this.startLineNumbers,i.startLineNumbers)&&$i(this.endLineNumbers,i.endLineNumbers)}static get Empty(){return new a([],[],0)}},KYi=pf("stickyScrollViewLayer",{createHTML:a=>a}),eui="data-sticky-line-index",GYi="data-sticky-is-line",h2o="data-sticky-is-line-number",qYi="data-sticky-is-folding-icon",Ukt=class extends x{constructor(e){super();this._foldingIconStore=this._register(new N);this._rootDomNode=document.createElement("div");this._lineNumbersDomNode=document.createElement("div");this._linesDomNodeScrollable=document.createElement("div");this._linesDomNode=document.createElement("div");this._renderedStickyLines=[];this._lineNumbers=[];this._lastLineRelativePosition=0;this._minContentWidthInPx=0;this._isOnGlyphMargin=!1;this._height=-1;this._onDidChangeStickyScrollHeight=this._register(new E);this.onDidChangeStickyScrollHeight=this._onDidChangeStickyScrollHeight.event;this._editor=e,this._lineNumbersDomNode.className="sticky-widget-line-numbers",this._lineNumbersDomNode.setAttribute("role","none"),this._linesDomNode.className="sticky-widget-lines",this._linesDomNode.setAttribute("role","list"),this._linesDomNodeScrollable.className="sticky-widget-lines-scrollable",this._linesDomNodeScrollable.appendChild(this._linesDomNode),this._rootDomNode.className="sticky-widget",this._rootDomNode.classList.toggle("peek",e instanceof id),this._rootDomNode.appendChild(this._lineNumbersDomNode),this._rootDomNode.appendChild(this._linesDomNodeScrollable),this._setHeight(0);let t=()=>{this._linesDomNode.style.left=this._editor.getOption(131).scrollWithEditor?`-${this._editor.getScrollLeft()}px`:"0px"};this._register(this._editor.onDidChangeConfiguration(o=>{o.hasChanged(131)&&t()})),this._register(this._editor.onDidScrollChange(o=>{o.scrollLeftChanged&&t(),o.scrollWidthChanged&&this._updateWidgetWidth()})),this._register(this._editor.onDidChangeModel(()=>{t(),this._updateWidgetWidth()})),t(),this._register(this._editor.onDidLayoutChange(o=>{this._updateWidgetWidth()})),this._updateWidgetWidth()}get height(){return this._height}get lineNumbers(){return this._lineNumbers}get lineNumberCount(){return this._lineNumbers.length}getRenderedStickyLine(e){return this._renderedStickyLines.find(t=>t.lineNumber===e)}getCurrentLines(){return this._lineNumbers}setState(e,t,o){let n=!this._state&&!e,r=this._state&&this._state.equals(e);if(o===void 0&&(n||r))return;let s=this._findRenderingData(e),l=this._lineNumbers;this._lineNumbers=s.lineNumbers,this._lastLineRelativePosition=s.lastLineRelativePosition;let c=this._findIndexToRebuildFrom(l,this._lineNumbers,o);this._renderRootNode(this._lineNumbers,this._lastLineRelativePosition,t,c),this._state=e}_findRenderingData(e){if(!e)return{lineNumbers:[],lastLineRelativePosition:0};let t=[...e.startLineNumbers];e.showEndForLine!==null&&(t[e.showEndForLine]=e.endLineNumbers[e.showEndForLine]);let o=0;for(let n=0;n<t.length;n++)o+=this._editor.getLineHeightForPosition(new ye(t[n],1));return o===0?{lineNumbers:[],lastLineRelativePosition:0}:{lineNumbers:t,lastLineRelativePosition:e.lastLineRelativePosition}}_findIndexToRebuildFrom(e,t,o){if(t.length===0)return 0;if(o!==void 0)return o;let n=t.findIndex(r=>!e.includes(r));return n===-1?0:n}_updateWidgetWidth(){let e=this._editor.getLayoutInfo(),t=e.contentLeft;this._lineNumbersDomNode.style.width=`${t}px`,this._linesDomNodeScrollable.style.setProperty("--vscode-editorStickyScroll-scrollableWidth",`${this._editor.getScrollWidth()-e.verticalScrollbarWidth}px`),this._rootDomNode.style.width=`${e.width-e.verticalScrollbarWidth}px`}_useFoldingOpacityTransition(e){this._lineNumbersDomNode.style.setProperty("--vscode-editorStickyScroll-foldingOpacityTransition",`opacity ${e?.5:0}s`)}_setFoldingIconsVisibility(e){for(let t of this._renderedStickyLines){let o=t.foldingIcon;o&&o.setVisible(e?!0:o.isCollapsed)}}async _renderRootNode(e,t,o,n){let r=this._editor._getViewModel();if(!r){this._clearWidget();return}if(e.length===0){this._clearWidget();return}let s=[],l=e[e.length-1],c=0;for(let p=0;p<this._renderedStickyLines.length;p++)if(p<n){let h=this._renderedStickyLines[p];s.push(this._updatePosition(h,c,h.lineNumber===l)),c+=h.height}else{let h=this._renderedStickyLines[p];h.lineNumberDomNode.remove(),h.lineDomNode.remove()}let u=this._editor.getLayoutInfo();for(let p=n;p<e.length;p++){let h=this._renderChildNode(r,p,e[p],c,l===e[p],o,u);c+=h.height,this._linesDomNode.appendChild(h.lineDomNode),this._lineNumbersDomNode.appendChild(h.lineNumberDomNode),s.push(h)}o&&(this._setFoldingHoverListeners(),this._useFoldingOpacityTransition(!this._isOnGlyphMargin)),this._minContentWidthInPx=Math.max(...this._renderedStickyLines.map(p=>p.scrollWidth))+u.verticalScrollbarWidth,this._renderedStickyLines=s,this._setHeight(c+t),this._editor.layoutOverlayWidget(this)}_clearWidget(){for(let e=0;e<this._renderedStickyLines.length;e++){let t=this._renderedStickyLines[e];t.lineNumberDomNode.remove(),t.lineDomNode.remove()}this._setHeight(0)}_setHeight(e){this._height!==e&&(this._height=e,this._height===0?this._rootDomNode.style.display="none":(this._rootDomNode.style.display="block",this._lineNumbersDomNode.style.height=`${this._height}px`,this._linesDomNodeScrollable.style.height=`${this._height}px`,this._rootDomNode.style.height=`${this._height}px`),this._onDidChangeStickyScrollHeight.fire({height:this._height}))}_setFoldingHoverListeners(){this._foldingIconStore.clear(),this._editor.getOption(126)==="mouseover"&&(this._foldingIconStore.clear(),this._foldingIconStore.add(j(this._lineNumbersDomNode,re.MOUSE_ENTER,()=>{this._isOnGlyphMargin=!0,this._setFoldingIconsVisibility(!0)})),this._foldingIconStore.add(j(this._lineNumbersDomNode,re.MOUSE_LEAVE,()=>{this._isOnGlyphMargin=!1,this._useFoldingOpacityTransition(!0),this._setFoldingIconsVisibility(!1)})))}_renderChildNode(e,t,o,n,r,s,l){let c=new tui(this._editor,e,l,s,this._isOnGlyphMargin,t,o);return this._updatePosition(c,n,r)}_updatePosition(e,t,o){let n=e.lineDomNode,r=e.lineNumberDomNode;if(o){n.style.zIndex="0",r.style.zIndex="0";let l=`${t+this._lastLineRelativePosition+(e.foldingIcon?.isCollapsed?1:0)}px`;n.style.top=l,r.style.top=l}else n.style.zIndex="1",r.style.zIndex="1",n.style.top=`${t}px`,r.style.top=`${t}px`;return e}getId(){return"editor.contrib.stickyScrollWidget"}getDomNode(){return this._rootDomNode}getPosition(){return{preference:2,stackOrdinal:10}}getMinContentWidthInPx(){return this._minContentWidthInPx}focusLineWithIndex(e){0<=e&&e<this._renderedStickyLines.length&&this._renderedStickyLines[e].lineDomNode.focus()}getEditorPositionFromNode(e){if(!e||e.children.length>0)return null;let t=this._getRenderedStickyLineFromChildDomNode(e);if(!t)return null;let o=gj(t.characterMapping,e,0);return new ye(t.lineNumber,o)}getLineNumberFromChildDomNode(e){return this._getRenderedStickyLineFromChildDomNode(e)?.lineNumber??null}_getRenderedStickyLineFromChildDomNode(e){let t=this.getLineIndexFromChildDomNode(e);return t===null||t<0||t>=this._renderedStickyLines.length?null:this._renderedStickyLines[t]}getLineIndexFromChildDomNode(e){let t=this._getAttributeValue(e,eui);return t?parseInt(t,10):null}isInStickyLine(e){return this._getAttributeValue(e,GYi)!==void 0}isInFoldingIconDomNode(e){return this._getAttributeValue(e,qYi)!==void 0}_getAttributeValue(e,t){for(;e&&e!==this._rootDomNode;){let o=e.getAttribute(t);if(o!==null)return o;e=e.parentElement}}},tui=class{constructor(i,e,t,o,n,r,s){this.index=r;this.lineNumber=s;let l=e.coordinatesConverter.convertModelPositionToViewPosition(new ye(s,1)).lineNumber,c=e.getViewLineRenderingData(l),u=i.getOption(76),p=i.getOption(117).verticalScrollbarSize,h;try{h=db.filter(c.inlineDecorations,l,c.minColumn,c.maxColumn)}catch{h=[]}let g=i.getLineHeightForPosition(new ye(s,1)),f=e.getTextDirection(s),v=new XL(!0,!0,c.content,c.continuesWithWrappedLine,c.isBasicASCII,c.containsRTL,0,c.tokens,h,c.tabSize,c.startVisibleColumn,1,1,1,500,"none",!0,!0,null,f,p),b=new $S(2e3),S=AV(v,b);this.characterMapping=S.characterMapping;let y;KYi?y=KYi.createHTML(b.build()):y=b.build();let w=document.createElement("span");w.setAttribute(eui,String(r)),w.setAttribute(GYi,""),w.setAttribute("role","listitem"),w.tabIndex=0,w.className="sticky-line-content",w.classList.add(`stickyLine${s}`),w.style.lineHeight=`${g}px`,w.innerHTML=y;let k=document.createElement("span");k.setAttribute(eui,String(r)),k.setAttribute(h2o,""),k.className="sticky-line-number",k.style.lineHeight=`${g}px`;let T=t.contentLeft;k.style.width=`${T}px`;let P=document.createElement("span");u.renderType===1||u.renderType===3&&s%10===0?P.innerText=s.toString():u.renderType===2&&(P.innerText=Math.abs(s-i.getPosition().lineNumber).toString()),P.className="sticky-line-number-inner",P.style.width=`${t.lineNumbersWidth}px`,P.style.paddingLeft=`${t.lineNumbersLeft}px`,k.appendChild(P),this.foldingIcon=this._renderFoldingIconForLine(i,o,s,g,n),this.foldingIcon&&(k.appendChild(this.foldingIcon.domNode),this.foldingIcon.domNode.style.left=`${t.lineNumbersWidth+t.lineNumbersLeft}px`,this.foldingIcon.domNode.style.lineHeight=`${g}px`),i.applyFontInfo(w),i.applyFontInfo(k),k.style.lineHeight=`${g}px`,w.style.lineHeight=`${g}px`,k.style.height=`${g}px`,w.style.height=`${g}px`,this.scrollWidth=w.scrollWidth,this.lineDomNode=w,this.lineNumberDomNode=k,this.height=g}_renderFoldingIconForLine(i,e,t,o,n){let r=i.getOption(126);if(!e||r==="never")return;let s=e.regions,l=s.findRange(t),c=s.getStartLineNumber(l);if(!(t===c))return;let p=s.isCollapsed(l),h=new iui(p,c,s.getEndLineNumber(l),o);return h.setVisible(n?!0:p||r==="always"),h.domNode.setAttribute(qYi,""),h}},iui=class{constructor(i,e,t,o){this.isCollapsed=i;this.foldingStartLine=e;this.foldingEndLine=t;this.dimension=o;this.domNode=document.createElement("div"),this.domNode.style.width="26px",this.domNode.style.height=`${o}px`,this.domNode.style.lineHeight=`${o}px`,this.domNode.className=q.asClassName(i?Uce:Hce)}setVisible(i){this.domNode.style.cursor=i?"pointer":"default",this.domNode.style.opacity=i?"1":"0"}};var T5=class{constructor(i,e){this.startLineNumber=i;this.endLineNumber=e}},sde=class{constructor(i,e,t){this.range=i;this.children=e;this.parent=t}},W8e=class{constructor(i,e,t,o){this.uri=i;this.version=e;this.element=t;this.outlineProviderId=o}};var Ske=class extends x{constructor(e,t,o,n){super();this._editor=e;this._modelProviders=[];this._modelPromise=null;this._updateScheduler=this._register(new Xo(300));this._updateOperation=this._register(new N);switch(this._editor.getOption(131).defaultModel){case"outlineModel":this._modelProviders.push(new V8e(this._editor,n));case"foldingProviderModel":this._modelProviders.push(new H8e(this._editor,t,n));case"indentationModel":this._modelProviders.push(new B8e(this._editor,o));break}}dispose(){this._modelProviders.forEach(e=>e.dispose()),this._updateOperation.clear(),this._cancelModelPromise(),super.dispose()}_cancelModelPromise(){this._modelPromise&&(this._modelPromise.cancel(),this._modelPromise=null)}async update(e){return this._updateOperation.clear(),this._updateOperation.add({dispose:()=>{this._cancelModelPromise(),this._updateScheduler.cancel()}}),this._cancelModelPromise(),await this._updateScheduler.trigger(async()=>{for(let t of this._modelProviders){let{statusPromise:o,modelPromise:n}=t.computeStickyModel(e);this._modelPromise=n;let r=await o;if(this._modelPromise!==n)return null;switch(r){case 2:return this._updateOperation.clear(),null;case 0:return t.stickyModel}}return null}).catch(t=>(mt(t),null))}};Ske=I([m(2,F),m(3,Qt)],Ske);var zkt=class extends x{constructor(e){super();this._editor=e;this._stickyModel=null}get stickyModel(){return this._stickyModel}_invalid(){return this._stickyModel=null,1}computeStickyModel(e){if(e.isCancellationRequested||!this.isProviderValid())return{statusPromise:this._invalid(),modelPromise:null};let t=Ln(o=>this.createModelFromProvider(o));return{statusPromise:t.then(o=>this.isModelValid(o)?e.isCancellationRequested?2:(this._stickyModel=this.createStickyModel(e,o),0):this._invalid()).then(void 0,o=>(mt(o),2)),modelPromise:t}}isModelValid(e){return!0}isProviderValid(){return!0}},V8e=class extends zkt{constructor(e,t){super(e);this._languageFeaturesService=t}createModelFromProvider(e){return dF.create(this._languageFeaturesService.documentSymbolProvider,this._editor.getModel(),e)}createStickyModel(e,t){let{stickyOutlineElement:o,providerID:n}=this._stickyModelFromOutlineModel(t,this._stickyModel?.outlineProviderId),r=this._editor.getModel();return new W8e(r.uri,r.getVersionId(),o,n)}isModelValid(e){return e&&e.children.size>0}_stickyModelFromOutlineModel(e,t){let o;if(vt.first(e.children.values())instanceof kw){let l=vt.find(e.children.values(),c=>c.id===t);if(l)o=l.children;else{let c="",u=-1,p;for(let[h,g]of e.children.entries()){let f=this._findSumOfRangesOfGroup(g);f>u&&(p=g,u=f,c=g.id)}t=c,o=p.children}}else o=e.children;let n=[],r=Array.from(o.values()).sort((l,c)=>{let u=new T5(l.symbol.range.startLineNumber,l.symbol.range.endLineNumber),p=new T5(c.symbol.range.startLineNumber,c.symbol.range.endLineNumber);return this._comparator(u,p)});for(let l of r)n.push(this._stickyModelFromOutlineElement(l,l.symbol.selectionRange.startLineNumber));return{stickyOutlineElement:new sde(void 0,n,void 0),providerID:t}}_stickyModelFromOutlineElement(e,t){let o=[];for(let r of e.children.values())if(r.symbol.selectionRange.startLineNumber!==r.symbol.range.endLineNumber)if(r.symbol.selectionRange.startLineNumber!==t)o.push(this._stickyModelFromOutlineElement(r,r.symbol.selectionRange.startLineNumber));else for(let s of r.children.values())o.push(this._stickyModelFromOutlineElement(s,r.symbol.selectionRange.startLineNumber));o.sort((r,s)=>this._comparator(r.range,s.range));let n=new T5(e.symbol.selectionRange.startLineNumber,e.symbol.range.endLineNumber);return new sde(n,o,void 0)}_comparator(e,t){return e.startLineNumber!==t.startLineNumber?e.startLineNumber-t.startLineNumber:t.endLineNumber-e.endLineNumber}_findSumOfRangesOfGroup(e){let t=0;for(let o of e.children.values())t+=this._findSumOfRangesOfGroup(o);return e instanceof jf?t+e.symbol.range.endLineNumber-e.symbol.selectionRange.startLineNumber:t}};V8e=I([m(1,Qt)],V8e);var Kkt=class extends zkt{constructor(i){super(i),this._foldingLimitReporter=this._register(new o8e(i))}createStickyModel(i,e){let t=this._fromFoldingRegions(e),o=this._editor.getModel();return new W8e(o.uri,o.getVersionId(),t,void 0)}isModelValid(i){return i!==null}_fromFoldingRegions(i){let e=i.length,t=[],o=new sde(void 0,[],void 0);for(let n=0;n<e;n++){let r=i.getParentIndex(n),s;r!==-1?s=t[r]:s=o;let l=new sde(new T5(i.getStartLineNumber(n),i.getEndLineNumber(n)+1),[],s);s.children.push(l),t.push(l)}return o}},B8e=class extends Kkt{constructor(e,t){super(e);this._languageConfigurationService=t;this.provider=this._register(new Bce(e.getModel(),this._languageConfigurationService,this._foldingLimitReporter))}async createModelFromProvider(e){return this.provider.compute(e)}};B8e=I([m(1,Rs)],B8e);var H8e=class extends Kkt{constructor(e,t,o){super(e);this._languageFeaturesService=o;this.provider=this._register(new me);this._register(this._languageFeaturesService.foldingRangeProvider.onDidChange(()=>{this._updateProvider(e,t)})),this._updateProvider(e,t)}_updateProvider(e,t){let o=gf.getFoldingRangeProviders(this._languageFeaturesService,e.getModel());o.length!==0&&(this.provider.value=new zce(e.getModel(),o,t,this._foldingLimitReporter,void 0))}isProviderValid(){return this.provider!==void 0}async createModelFromProvider(e){return this.provider.value?.compute(e)??null}};H8e=I([m(2,Qt)],H8e);var oui=class{constructor(i,e,t,o){this.startLineNumber=i;this.endLineNumber=e;this.top=t;this.height=o}},Ike=class extends x{constructor(e,t,o){super();this._languageFeaturesService=t;this._languageConfigurationService=o;this._onDidChangeStickyScroll=this._register(new E);this.onDidChangeStickyScroll=this._onDidChangeStickyScroll.event;this._model=null;this._cts=null;this._stickyModelProvider=null;this._editor=e,this._sessionStore=this._register(new N),this._updateSoon=this._register(new Dt(()=>this.update(),50)),this._register(this._editor.onDidChangeConfiguration(n=>{n.hasChanged(131)&&this.readConfiguration()})),this.readConfiguration()}static{this.ID="store.contrib.stickyScrollController"}readConfiguration(){this._sessionStore.clear(),this._editor.getOption(131).enabled&&(this._sessionStore.add(this._editor.onDidChangeModel(()=>{this._model=null,this.updateStickyModelProvider(),this._onDidChangeStickyScroll.fire(),this.update()})),this._sessionStore.add(this._editor.onDidChangeHiddenAreas(()=>this.update())),this._sessionStore.add(this._editor.onDidChangeModelContent(()=>this._updateSoon.schedule())),this._sessionStore.add(this._languageFeaturesService.documentSymbolProvider.onDidChange(()=>this.update())),this._sessionStore.add(Z(()=>{this._stickyModelProvider?.dispose(),this._stickyModelProvider=null})),this.updateStickyModelProvider(),this.update())}getVersionId(){return this._model?.version}updateStickyModelProvider(){this._stickyModelProvider?.dispose(),this._stickyModelProvider=null,this._editor.hasModel()&&(this._stickyModelProvider=new Ske(this._editor,()=>this._updateSoon.schedule(),this._languageConfigurationService,this._languageFeaturesService))}async update(){this._cts?.dispose(!0),this._cts=new Ye,await this.updateStickyModel(this._cts.token),this._onDidChangeStickyScroll.fire()}async updateStickyModel(e){if(!this._editor.hasModel()||!this._stickyModelProvider||this._editor.getModel().isTooLargeForTokenization()){this._model=null;return}let t=await this._stickyModelProvider.update(e);e.isCancellationRequested||(this._model=t)}getCandidateStickyLinesIntersecting(e){if(!this._model?.element)return[];let t=[];return this.getCandidateStickyLinesIntersectingFromStickyModel(e,this._model.element,t,0,0,-1),this.filterHiddenRanges(t)}getCandidateStickyLinesIntersectingFromStickyModel(e,t,o,n,r,s){let l=this._editor.getModel();if(!l||t.children.length===0)return;let c=s,u=[];for(let g=0;g<t.children.length;g++){let f=t.children[g];f.range&&u.push(f.range.startLineNumber)}let p=this.updateIndex(Px(u,e.startLineNumber,(g,f)=>g-f)),h=this.updateIndex(Px(u,e.endLineNumber,(g,f)=>g-f));for(let g=p;g<=h;g++){let f=t.children[g];if(!f||!f.range)continue;let{startLineNumber:v,endLineNumber:b}=f.range;if(b>v+1&&e.startLineNumber<=b+1&&v-1<=e.endLineNumber&&v!==c&&l.isValidRange(new z(v,1,b,1))){c=v;let S=this._editor.getLineHeightForPosition(new ye(v,1));o.push(new oui(v,b-1,r,S)),this.getCandidateStickyLinesIntersectingFromStickyModel(e,f,o,n+1,r+S,v)}}}filterHiddenRanges(e){let t=this._editor._getViewModel()?.getHiddenAreas();return t?e.filter(o=>!t.some(n=>o.startLineNumber>=n.startLineNumber&&o.endLineNumber<=n.endLineNumber+1)):e}updateIndex(e){return e===-1?0:e<0?-e-2:e}};Ike=I([m(1,Qt),m(2,Rs)],Ike);var fb=class extends x{constructor(e,t,o,n,r,s,l){super();this._editor=e;this._contextMenuService=t;this._languageFeaturesService=o;this._instaService=n;this._contextKeyService=l;this._sessionStore=new N;this._maxStickyLines=Number.MAX_SAFE_INTEGER;this._candidateDefinitionsLength=-1;this._focusedStickyElementIndex=-1;this._enabled=!1;this._focused=!1;this._positionRevealed=!1;this._onMouseDown=!1;this._endLineNumbers=[];this._mouseTarget=null;this._onDidChangeStickyScrollHeight=this._register(new E);this.onDidChangeStickyScrollHeight=this._onDidChangeStickyScrollHeight.event;this._stickyScrollWidget=new Ukt(this._editor),this._stickyLineCandidateProvider=new Ike(this._editor,o,r),this._register(this._stickyScrollWidget),this._register(this._stickyLineCandidateProvider),this._widgetState=bke.Empty;let c=this._stickyScrollWidget.getDomNode();this._register(this._editor.onDidChangeLineHeight(p=>{p.changes.forEach(h=>{let g=h.lineNumber;this._widgetState.startLineNumbers.includes(g)&&this._renderStickyScroll(g)})})),this._register(this._editor.onDidChangeFont(p=>{p.changes.forEach(h=>{let g=h.lineNumber;this._widgetState.startLineNumbers.includes(g)&&this._renderStickyScroll(g)})})),this._register(this._editor.onDidChangeConfiguration(p=>{this._readConfigurationChange(p)})),this._register(j(c,re.CONTEXT_MENU,async p=>{this._onContextMenu(Re(c),p)})),this._stickyScrollFocusedContextKey=pe.stickyScrollFocused.bindTo(this._contextKeyService),this._stickyScrollVisibleContextKey=pe.stickyScrollVisible.bindTo(this._contextKeyService);let u=this._register(qn(c));this._register(u.onDidBlur(p=>{this._positionRevealed===!1&&c.clientHeight===0?(this._focusedStickyElementIndex=-1,this.focus()):this._disposeFocusStickyScrollStore()})),this._register(u.onDidFocus(p=>{this.focus()})),this._registerMouseListeners(),this._register(j(c,re.MOUSE_DOWN,p=>{this._onMouseDown=!0})),this._register(this._stickyScrollWidget.onDidChangeStickyScrollHeight(p=>{this._onDidChangeStickyScrollHeight.fire(p)})),this._onDidResize(),this._readConfiguration()}static{this.ID="store.contrib.stickyScrollController"}get stickyScrollCandidateProvider(){return this._stickyLineCandidateProvider}get stickyScrollWidgetState(){return this._widgetState}get stickyScrollWidgetHeight(){return this._stickyScrollWidget.height}static get(e){return e.getContribution(fb.ID)}_disposeFocusStickyScrollStore(){this._stickyScrollFocusedContextKey.set(!1),this._focusDisposableStore?.dispose(),this._focused=!1,this._positionRevealed=!1,this._onMouseDown=!1}isFocused(){return this._focused}focus(){if(this._onMouseDown){this._onMouseDown=!1,this._editor.focus();return}this._stickyScrollFocusedContextKey.get()!==!0&&(this._focused=!0,this._focusDisposableStore=new N,this._stickyScrollFocusedContextKey.set(!0),this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumbers.length-1,this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex))}focusNext(){this._focusedStickyElementIndex<this._stickyScrollWidget.lineNumberCount-1&&this._focusNav(!0)}focusPrevious(){this._focusedStickyElementIndex>0&&this._focusNav(!1)}selectEditor(){this._editor.focus()}_focusNav(e){this._focusedStickyElementIndex=e?this._focusedStickyElementIndex+1:this._focusedStickyElementIndex-1,this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex)}goToFocused(){let e=this._stickyScrollWidget.lineNumbers;this._disposeFocusStickyScrollStore(),this._revealPosition({lineNumber:e[this._focusedStickyElementIndex],column:1})}_revealPosition(e){this._reveaInEditor(e,()=>this._editor.revealPosition(e))}_revealLineInCenterIfOutsideViewport(e){this._reveaInEditor(e,()=>this._editor.revealLineInCenterIfOutsideViewport(e.lineNumber,0))}_reveaInEditor(e,t){this._focused&&this._disposeFocusStickyScrollStore(),this._positionRevealed=!0,t(),this._editor.setSelection(z.fromPositions(e)),this._editor.focus()}_registerMouseListeners(){let e=this._register(new N),t=this._register(new JO(this._editor,{extractLineNumberFromMouseEvent:r=>{let s=this._stickyScrollWidget.getEditorPositionFromNode(r.target.element);return s?s.lineNumber:0}})),o=r=>{if(!this._editor.hasModel()||r.target.type!==12||r.target.detail!==this._stickyScrollWidget.getId())return null;let s=r.target.element;if(!s||s.innerText!==s.innerHTML)return null;let l=this._stickyScrollWidget.getEditorPositionFromNode(s);return l?{range:new z(l.lineNumber,l.column,l.lineNumber,l.column+s.innerText.length),textElement:s}:null},n=this._stickyScrollWidget.getDomNode();this._register(Jo(n,re.CLICK,r=>{if(r.ctrlKey||r.altKey||r.metaKey||!r.leftButton)return;if(r.shiftKey){let u=this._stickyScrollWidget.getLineIndexFromChildDomNode(r.target);if(u===null)return;let p=new ye(this._endLineNumbers[u],1);this._revealLineInCenterIfOutsideViewport(p);return}if(this._stickyScrollWidget.isInFoldingIconDomNode(r.target)){let u=this._stickyScrollWidget.getLineNumberFromChildDomNode(r.target);this._toggleFoldingRegionForLine(u);return}if(!this._stickyScrollWidget.isInStickyLine(r.target))return;let c=this._stickyScrollWidget.getEditorPositionFromNode(r.target);if(!c){let u=this._stickyScrollWidget.getLineNumberFromChildDomNode(r.target);if(u===null)return;c=new ye(u,1)}this._revealPosition(c)})),this._register(j(ut,re.MOUSE_MOVE,r=>{this._mouseTarget=r.target,this._onMouseMoveOrKeyDown(r)})),this._register(j(ut,re.KEY_DOWN,r=>{this._onMouseMoveOrKeyDown(r)})),this._register(j(ut,re.KEY_UP,()=>{this._showEndForLine!==void 0&&(this._showEndForLine=void 0,this._renderStickyScroll())})),this._register(t.onMouseMoveOrRelevantKeyDown(([r,s])=>{let l=o(r);if(!l||!r.hasTriggerModifier||!this._editor.hasModel()){e.clear();return}let{range:c,textElement:u}=l;if(!c.equalsRange(this._stickyRangeProjectedOnEditor))this._stickyRangeProjectedOnEditor=c,e.clear();else if(u.style.textDecoration==="underline")return;let p=new Ye;e.add(Z(()=>p.dispose(!0)));let h;sF(this._languageFeaturesService.definitionProvider,this._editor.getModel(),new ye(c.startLineNumber,c.startColumn+1),!1,p.token).then((g=>{if(!p.token.isCancellationRequested)if(g.length!==0){this._candidateDefinitionsLength=g.length;let f=u;h!==f?(e.clear(),h=f,h.style.textDecoration="underline",e.add(Z(()=>{h.style.textDecoration="none"}))):h||(h=f,h.style.textDecoration="underline",e.add(Z(()=>{h.style.textDecoration="none"})))}else e.clear()}))})),this._register(t.onCancel(()=>{e.clear()})),this._register(t.onExecute(async r=>{if(r.target.type!==12||r.target.detail!==this._stickyScrollWidget.getId())return;let s=this._stickyScrollWidget.getEditorPositionFromNode(r.target.element);s&&(!this._editor.hasModel()||!this._stickyRangeProjectedOnEditor||(this._candidateDefinitionsLength>1&&(this._focused&&this._disposeFocusStickyScrollStore(),this._revealPosition({lineNumber:s.lineNumber,column:1})),this._instaService.invokeFunction(_xt,r,this._editor,{uri:this._editor.getModel().uri,range:this._stickyRangeProjectedOnEditor})))}))}_onContextMenu(e,t){let o=new Cn(e,t);this._contextMenuService.showContextMenu({menuId:D.StickyScrollContext,getAnchor:()=>o,menuActionOptions:{renderShortTitle:!0}})}_onMouseMoveOrKeyDown(e){if(!e.shiftKey||!this._mouseTarget||!Do(this._mouseTarget))return;let t=this._stickyScrollWidget.getLineIndexFromChildDomNode(this._mouseTarget);t===null||this._showEndForLine===t||(this._showEndForLine=t,this._renderStickyScroll())}_toggleFoldingRegionForLine(e){if(!this._foldingModel||e===null)return;let t=this._stickyScrollWidget.getRenderedStickyLine(e),o=t?.foldingIcon;if(!o)return;i8e(this._foldingModel,1,[e]),o.isCollapsed=!o.isCollapsed;let n=(o.isCollapsed?this._editor.getTopForLineNumber(o.foldingEndLine):this._editor.getTopForLineNumber(o.foldingStartLine))-this._editor.getOption(75)*t.index+1;this._editor.setScrollTop(n),this._renderStickyScroll(e)}_readConfiguration(){let e=this._editor.getOption(131);if(e.enabled===!1){this._editor.removeOverlayWidget(this._stickyScrollWidget),this._resetState(),this._sessionStore.clear(),this._enabled=!1;return}else e.enabled&&!this._enabled&&(this._editor.addOverlayWidget(this._stickyScrollWidget),this._sessionStore.add(this._editor.onDidScrollChange(o=>{o.scrollTopChanged&&(this._showEndForLine=void 0,this._renderStickyScroll())})),this._sessionStore.add(this._editor.onDidLayoutChange(()=>this._onDidResize())),this._sessionStore.add(this._editor.onDidChangeModelTokens(o=>this._onTokensChange(o))),this._sessionStore.add(this._stickyLineCandidateProvider.onDidChangeStickyScroll(()=>{this._showEndForLine=void 0,this._renderStickyScroll()})),this._enabled=!0);this._editor.getOption(76).renderType===2?this._cursorPositionListener||(this._cursorPositionListener=this._editor.onDidChangeCursorPosition(o=>{this._positionLineNumber!==o.position.lineNumber&&(this._positionLineNumber=o.position.lineNumber,this._showEndForLine=void 0,this._renderStickyScroll(0))}),this._sessionStore.add(this._cursorPositionListener)):this._cursorPositionListener&&(this._sessionStore.delete(this._cursorPositionListener),this._cursorPositionListener.dispose(),this._cursorPositionListener=void 0)}_readConfigurationChange(e){(e.hasChanged(131)||e.hasChanged(81)||e.hasChanged(75)||e.hasChanged(126)||e.hasChanged(76))&&this._readConfiguration(),(e.hasChanged(76)||e.hasChanged(52)||e.hasChanged(126))&&this._renderStickyScroll(0)}_needsUpdate(e){let t=this._stickyScrollWidget.getCurrentLines();for(let o of t)for(let n of e.ranges)if(o>=n.fromLineNumber&&o<=n.toLineNumber)return!0;return!1}_onTokensChange(e){this._needsUpdate(e)&&this._renderStickyScroll(0)}_onDidResize(){let t=this._editor.getLayoutInfo().height/this._editor.getOption(75);this._maxStickyLines=Math.round(t*.25),this._renderStickyScroll(0)}async _renderStickyScroll(e){let t=this._editor.getModel();if(!t||t.isTooLargeForTokenization()){this._resetState();return}let o=this._updateAndGetMinRebuildFromLine(e),n=this._stickyLineCandidateProvider.getVersionId();if(n===void 0||n===t.getVersionId())if(!this._focused)await this._updateState(o);else if(this._focusedStickyElementIndex===-1)await this._updateState(o),this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumberCount-1,this._focusedStickyElementIndex!==-1&&this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex);else{let s=this._stickyScrollWidget.lineNumbers[this._focusedStickyElementIndex];await this._updateState(o),this._stickyScrollWidget.lineNumberCount===0?this._focusedStickyElementIndex=-1:(this._stickyScrollWidget.lineNumbers.includes(s)||(this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumberCount-1),this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex))}}_updateAndGetMinRebuildFromLine(e){if(e!==void 0){let t=this._minRebuildFromLine!==void 0?this._minRebuildFromLine:1/0;this._minRebuildFromLine=Math.min(e,t)}return this._minRebuildFromLine}async _updateState(e){this._minRebuildFromLine=void 0,this._foldingModel=await gf.get(this._editor)?.getFoldingModel()??void 0,this._widgetState=this.findScrollWidgetState();let t=this._widgetState.startLineNumbers.length>0;this._stickyScrollVisibleContextKey.set(t),this._stickyScrollWidget.setState(this._widgetState,this._foldingModel,e)}async _resetState(){this._minRebuildFromLine=void 0,this._foldingModel=void 0,this._widgetState=bke.Empty,this._stickyScrollVisibleContextKey.set(!1),this._stickyScrollWidget.setState(void 0,void 0)}findScrollWidgetState(){let e=Math.min(this._maxStickyLines,this._editor.getOption(131).maxLineCount),t=this._editor.getScrollTop(),o=0,n=[],r=[],s=this._editor.getVisibleRanges();if(s.length!==0){let l=new T5(s[0].startLineNumber,s[s.length-1].endLineNumber),c=this._stickyLineCandidateProvider.getCandidateStickyLinesIntersecting(l);for(let u of c){let p=u.startLineNumber,h=u.endLineNumber,g=u.top,f=g+u.height,v=this._editor.getTopForLineNumber(p)-t,b=this._editor.getBottomForLineNumber(h)-t;if(g>v&&g<=b&&(n.push(p),r.push(h+1),f>b&&(o=b-f)),n.length===e)break}}return this._endLineNumbers=r,new bke(n,r,o,this._showEndForLine)}dispose(){super.dispose(),this._sessionStore.dispose()}};fb=I([m(1,Xe),m(2,Qt),m(3,F),m(4,Rs),m(5,hf),m(6,X)],fb);var aX=te("inlineEdit.originalBackground",ai(zf,.2),d(1397,null),!0),Gkt=te("inlineEdit.modifiedBackground",ai(df,.3),d(1393,null),!0),eAs=te("inlineEdit.originalChangedLineBackground",ai(zf,.8),d(1399,null),!0),$Yi=te("inlineEdit.originalChangedTextBackground",ai(zf,.8),d(1400,null),!0),jYi=te("inlineEdit.modifiedChangedLineBackground",{light:ai(Bje,.7),dark:ai(Bje,.7),hcDark:Bje,hcLight:Bje},d(1395,null),!0),QYi=te("inlineEdit.modifiedChangedTextBackground",ai(df,.7),d(1396,null),!0),lX=te("inlineEdit.gutterIndicator.primaryForeground",__,d(1386,null)),mF=te("inlineEdit.gutterIndicator.primaryBorder",xC,d(1385,null)),dK=te("inlineEdit.gutterIndicator.primaryBackground",{light:ai(mF,.5),dark:ai(mF,.4),hcDark:ai(mF,.4),hcLight:ai(mF,.5)},d(1384,null)),YYi=te("inlineEdit.gutterIndicator.secondaryForeground",_7,d(1389,null)),XYi=te("inlineEdit.gutterIndicator.secondaryBorder",G1,d(1388,null)),yke=te("inlineEdit.gutterIndicator.secondaryBackground",wO,d(1387,null)),JYi=te("inlineEdit.gutterIndicator.successfulForeground",__,d(1392,null)),nui=te("inlineEdit.gutterIndicator.successfulBorder",xC,d(1391,null)),wke=te("inlineEdit.gutterIndicator.successfulBackground",nui,d(1390,null)),ZYi=te("inlineEdit.gutterIndicator.background",{hcDark:ai("tab.inactiveBackground",.5),hcLight:ai("tab.inactiveBackground",.5),dark:ai("tab.inactiveBackground",.5),light:"#5f5f5f18"},d(1383,null)),U8e=te("inlineEdit.originalBorder",{light:zf,dark:zf,hcDark:zf,hcLight:zf},d(1398,null)),z8e=te("inlineEdit.modifiedBorder",{light:ep(df,.6),dark:df,hcDark:df,hcLight:df},d(1394,null)),g2o=te("inlineEdit.tabWillAcceptModifiedBorder",{light:ep(z8e,0),dark:ep(z8e,0),hcDark:ep(z8e,0),hcLight:ep(z8e,0)},d(1401,null)),f2o=te("inlineEdit.tabWillAcceptOriginalBorder",{light:ep(U8e,0),dark:ep(U8e,0),hcDark:ep(U8e,0),hcLight:ep(U8e,0)},d(1402,null));function _5(a){return a.map(i=>i==="accept"?g2o:z8e)}function cX(a){return a.map(i=>i==="accept"?f2o:U8e)}function vb(a,i){let e;typeof a=="string"?e=sX(a,i):e=a.map((o,n)=>sX(o,i).read(n));let t=sX(Ho,i);return e.map((o,n)=>o.makeOpaque(t.read(n)))}function Q_(a){let i;switch(a){case"textEditor":i=Ho;break;case"diffEditor":i=Ho;break;case"notebook":i="notebook.cellEditorBackground";break;default:os(a,"Not supported editor type yet")}return kt(i)}function sX(a,i){return Vf({owner:{observeColor:a},equalsFn:(e,t)=>e.equals(t),debugName:()=>`observeColor(${a})`},i.onDidColorThemeChange,()=>{let e=i.getColorTheme().getColor(a);if(!e)throw new li(`Missing color: ${a}`);return e})}var bb=3;function GP(a,i,e){let t=a.model.read(e);if(!t)return 0;let o=0;for(let r=i.startLineNumber;r<i.endLineNumberExclusive;r++){let s=a.getWidthOfLine(r,e);o=Math.max(o,s)}let n=i.mapToLineArray(r=>t.getLineContent(r));return o<5&&n.some(r=>r.length>0)&&t.uri.scheme!=="file"&&console.error("unexpected width"),o}function tXi(a,i,e){Fr(a,a.editor.onDidChangeLineHeight).read(e);let t=a.model.read(e);if(!t)throw new li("Model is required");let o=[];for(let n=i.startLineNumber;n<i.endLineNumberExclusive;n++){let r=a.getWidthOfLine(n,e);if(r===-1){let l=t.getLineMaxColumn(n),c=a.editor.getOption(59).typicalHalfwidthCharacterWidth;r=l*c}let s=a.editor.getLineHeightForPosition(new ye(n,1));o.push(new rX(r,s))}return o}function iXi(a,i,e){return a.layoutInfo.read(e),a.value.read(e),a.model.read(e)?(a.scrollTop.read(e),a.editor.getOffsetForColumn(i.lineNumber,i.column)):0}function Cke(a,i,e,t,o=void 0){let n=t.getModel();if(!n)return{prefixTrim:0,prefixLeftOffset:0};let r=a.map(h=>h.isSingleLine()?h.startColumn-1:0),s=i.mapToLineArray(h=>cCe(n.getLineContent(h))),l=e.filter(h=>h!=="").map(h=>cCe(h)),c=Math.min(...r,...s,...l),u;if(n.getLineIndentColumn(i.startLineNumber)>=c+1)gs(t).scrollTop.read(o),u=t.getOffsetForColumn(i.startLineNumber,c+1);else if(e.length>0)u=K8e(e[0].slice(0,c),t,n);else return{prefixTrim:0,prefixLeftOffset:0};return{prefixTrim:c,prefixLeftOffset:u}}function K8e(a,i,e){let t=i.getOption(59).typicalHalfwidthCharacterWidth,o=e.getOptions().tabSize*t,n=a.split("	").length-1;return(a.length-n)*t+n*o}function xke(a){let i=a.layoutInfoContentLeft,e=ke({name:"editor.validOverlay.width"},o=>{let n=a.layoutInfoMinimap.read(o).minimapLeft!==0,r=Math.max(0,a.layoutInfoWidth.read(o)-i.read(o));if(n){let s=a.layoutInfoMinimap.read(o).minimapWidth+a.layoutInfoVerticalScrollbarWidth.read(o);return Math.max(0,r-s)}return r}),t=ke({name:"editor.validOverlay.height"},o=>a.layoutInfoHeight.read(o)+a.contentHeight.read(o));return ke({name:"editor.validOverlay"},o=>Wu.fromLeftTopWidthHeight(i.read(o),0,e.read(o),t.read(o)))}var eXi=class a{constructor(i){this.scheme=i}static{this._modelId=0}getUniqueUri(){return A.from({scheme:this.scheme,path:new Date().toString()+String(a._modelId++)})}};function oXi(a,i){let e=[];for(let t of a){let o=i.mapRange(t.modifiedRange);e.push(new Eg(t.originalRange,o))}return e}function kke(...a){return a.filter(i=>typeof i=="string").join(" ")}function v2o(a,i){return new z(i.lineNumber,i.column+a.start,i.lineNumber,i.column+a.endExclusive)}function b2o(a,i){let e=0;e:for(let t=0,o=a.length;t<o;t++)switch(a.charCodeAt(t)){case 9:e+=i;break;case 32:e++;break;default:break e}return e-e%i}function S2o(a,i,e){let t=i-i%e,o=0;for(;o<a.length&&t!==0;o++)switch(a.charCodeAt(o)){case 9:t-=e;break;case 32:t--;break;default:throw new li("Unexpected character found while calculating indent length")}return o}function nXi(a,i,e){let t=yc(a),o=[],n=rht(i.mapToLineArray(r=>b2o(t[r-1],e)),hu);return i.forEach(r=>{let s=S2o(t[r-1],n,e);o.push(new ss(v2o(new pi(0,s),new ye(r,1)),""))}),new Vp(o)}var lde=class{constructor(){this._data=""}moveTo(i){return this._data+=`M ${i.x} ${i.y} `,this}lineTo(i){return this._data+=`L ${i.x} ${i.y} `,this}curveTo(i,e){return this._data+=`Q ${i.x} ${i.y} ${e.x} ${e.y} `,this}curveTo2(i,e,t){return this._data+=`C ${i.x} ${i.y} ${e.x} ${e.y} ${t.x} ${t.y} `,this}build(){return this._data}};function YE(a){let i=Bf(void 0,(e,t)=>a.read(e)||t);return Os({debugName:()=>`${a.debugName}.mapOutFalsy`},e=>{if(i.read(e),!!a.read(e))return i})}function Sb(a,i=Rl.ofCaller()){return{left:ke({name:"editor.validOverlay.left"},e=>a(e)?.left,i),top:ke({name:"editor.validOverlay.top"},e=>a(e)?.top,i),width:ke({name:"editor.validOverlay.width"},e=>{let t=a(e);if(t)return t.width},i),height:ke({name:"editor.validOverlay.height"},e=>{let t=a(e);if(t)return t.height},i)}}function rXi(a,i){let e=a.getContainerDomNode(),t=Me("domRect",e.getBoundingClientRect());return i.add(a.onDidLayoutChange(o=>{t.set(e.getBoundingClientRect(),void 0)})),t}var Eke=class{constructor(i,e,t,o,n,r){this._editorObs=i;this._data=e;this._close=t;this._contextKeyService=o;this._keybindingService=n;this._commandService=r;this._inlineEditsShowCollapsed=this._editorObs.getOption(71).map(s=>s.edits.showCollapsed)}toDisposableLiveElement(){return this._createHoverContent().toDisposableLiveElement()}_createHoverContent(){let i=Me("active",void 0),e=b=>({title:b.title,icon:b.icon,keybinding:typeof b.commandId=="string"?this._getKeybinding(b.commandArgs?void 0:b.commandId):ke(this,S=>typeof b.commandId=="string"?void 0:this._getKeybinding(b.commandArgs?void 0:b.commandId.read(S)).read(S)),isActive:i.map(S=>S===b.id),onHoverChange:S=>i.set(S?b.id:void 0,void 0),onAction:()=>{let S=typeof b.commandId=="string"?b.commandId:b.commandId.get();return this._close(!0,S),this._commandService.executeCommand(S,...b.commandArgs??[])}}),t=this._data.extensionCommands.map(b=>b.map((S,y)=>D5(e({id:S.command.id+"_"+y,title:S.command.title,icon:S.icon??R.symbolEvent,commandId:S.command.id,commandArgs:S.command.arguments})))),o=[];for(let b of t)b.length>0&&(o.push(rui()),o.push(...b));if(this._data.extensionCommandsOnly)return sXi(o.slice(1));let n=I2o(this._data.displayName),r=D5(e({id:"gotoAndAccept",title:d(1373,null),icon:R.check,commandId:Fz})),s=D5(e({id:"reject",title:d(1374,null),icon:R.close,commandId:uCt})),l=this._data.alternativeAction?D5(e({id:"alternativeCommand",title:this._data.alternativeAction.command.title,icon:this._data.alternativeAction.icon,commandId:yce})):void 0,u=!1?this._data.modelInfo?.models.map(b=>D5({title:b.name,icon:b.id===this._data.modelInfo?.currentModelId?R.check:R.circle,keybinding:So(void 0),isActive:i.map(S=>S==="model_"+b.id),onHoverChange:S=>i.set(S?"model_"+b.id:void 0,void 0),onAction:()=>{this._close(!0),this._data.setModelId?.(b.id)}}))??[]:[],p=this._inlineEditsShowCollapsed.map(b=>D5(e(b?{id:"showExpanded",title:d(1377,null),icon:R.expandAll,commandId:n3e}:{id:"showCollapsed",title:d(1376,null),icon:R.collapseAll,commandId:n3e}))),h=D5(e({id:"snooze",title:d(1378,null),icon:R.bellSlash,commandId:"editor.action.inlineSuggest.snooze"})),g=D5(e({id:"settings",title:d(1375,null),icon:R.gear,commandId:"workbench.action.openSettings",commandArgs:["@tag:nextEditSuggestions"]})),f=this._data.action?[this._data.action]:[],v=f.length>0?y2o(f.map(b=>({id:b.id,label:b.title+"...",enabled:!0,run:()=>this._commandService.executeCommand(b.id,...b.arguments??[]),class:void 0,tooltip:b.tooltip??b.title})),{hoverDelegate:nI}):void 0;return sXi([n,r,l,s,p,u.length?rui():void 0,...u,h,g,...o,v?rui():void 0,v])}_getKeybinding(i){return i?ui(this._contextKeyService.onDidChangeContext,()=>this._keybindingService.lookupKeybinding(i)):So(void 0)}};Eke=I([m(3,X),m(4,_e),m(5,ge)],Eke);function sXi(a){return Bo.div({class:"content",style:{margin:4,minWidth:180}},a)}function I2o(a){return Bo.div({class:"header",style:{color:kt(Fje),fontSize:"13px",fontWeight:"600",padding:"0 4px",lineHeight:28}},[a])}function D5(a){return ke({name:"inlineEdits.option"},i=>Bo.div({class:["monaco-menu-option",a.isActive?.map(e=>e&&"active")],onmouseenter:()=>a.onHoverChange?.(!0),onmouseleave:()=>a.onHoverChange?.(!1),onclick:a.onAction,onkeydown:e=>{e.key==="Enter"&&a.onAction?.()},tabIndex:0,style:{borderRadius:3}},[Bo.elem("span",{style:{fontSize:16,display:"flex"}},[q.isThemeIcon(a.icon)?Sn(a.icon):a.icon.map(e=>Sn(e))]),Bo.elem("span",{},[a.title]),Bo.div({style:{marginLeft:"auto"},ref:e=>{let t=i.store.add(new Am(e,Po,{disableTitle:!0,...Jx,keybindingLabelShadow:void 0,keybindingLabelForeground:kt(Fje),keybindingLabelBackground:"transparent",keybindingLabelBorder:"transparent",keybindingLabelBottomBorder:void 0}));i.store.add(be(o=>{t.set(a.keybinding.read(o))}))}})]))}function y2o(a,i){return ke({name:"inlineEdits.actionBar"},e=>Bo.div({class:["action-widget-action-bar"],style:{padding:"3px 24px"}},[Bo.div({ref:t=>{e.store.add(new Zi(t,i)).push(a,{icon:!1,label:!0})}})]))}function rui(){return Bo.div({id:"inline-edit-gutter-indicator-menu-separator",class:"menu-separator",style:{color:kt(l4i),padding:"2px 0"}},Bo.div({style:{borderBottom:`1px solid ${kt(G1)}`}}))}var dX=class{constructor(i,e,t,o,n){this.gutterMenuData=i;this.originalRange=e;this.model=t;this.altAction=o;this.customization=n}},uX=class a{constructor(i,e,t,o,n,r,s=!1){this.action=i;this.displayName=e;this.extensionCommands=t;this.alternativeAction=o;this.modelInfo=n;this.setModelId=r;this.extensionCommandsOnly=s}static fromInlineSuggestion(i){let e=i.action?.kind==="edit"?i.action.alternativeAction:void 0,t=i.source.inlineSuggestions.commands??[];return new a(i.gutterMenuLinkAction,i.source.provider.displayName??d(1379,null),t.length>0?[t]:[],e,i.source.provider.modelInfo,i.source.provider.setModelId?.bind(i.source.provider))}},pX=class a{constructor(i,e){this.accept=i;this.jump=e}static fromInlineCompletionModel(i){return new a(()=>i.accept(),()=>i.jump())}},sui=16,aXi=2,uK=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this._editorObs=e;this._data=t;this._tabAction=o;this._verticalOffset=n;this._isHoveringOverInlineEdit=r;this._focusIsInMenu=s;this._hoverService=l;this._instantiationService=c;this._accessibilityService=u;this._themeService=p;this._userInteractionService=h;this._onDidCloseWithCommand=this._register(new E);this.onDidCloseWithCommand=this._onDidCloseWithCommand.event;this._modifierPressed=ke(this,e=>this._userInteractionService.readModifierKeyStatus(this._editorObs.editor.getDomNode(),e).shiftKey);this._gutterIndicatorStyles=ke(this,e=>{let t=this._tabAction.read(e),o=this._data.read(e)?.altAction,n=this._modifierPressed.read(e);switch(o&&n&&(t="inactive"),t){case"inactive":return{background:vb(yke,this._themeService).read(e).toString(),foreground:vb(YYi,this._themeService).read(e).toString(),border:vb(XYi,this._themeService).read(e).toString()};case"jump":return{background:vb(dK,this._themeService).read(e).toString(),foreground:vb(lX,this._themeService).read(e).toString(),border:vb(mF,this._themeService).read(e).toString()};case"accept":return{background:vb(wke,this._themeService).read(e).toString(),foreground:vb(JYi,this._themeService).read(e).toString(),border:vb(nui,this._themeService).read(e).toString()};default:os(t)}});this._state=ke(this,e=>{let t=this._originalRangeObs.read(e);if(t)return{range:t,lineOffsetRange:this._editorObs.observeLineOffsetRange(t,e.store)}});this._lineNumberToRender=ke(this,e=>{if(this._verticalOffset.read(e)!==0)return"";let t=this._data.read(e)?.originalRange.startLineNumber,o=this._editorObs.getOption(76).read(e);if(t===void 0||o.renderType===0)return"";if(o.renderType===3){let n=this._editorObs.cursorPosition.read(e);return t%10===0||n&&n.lineNumber===t?t.toString():""}if(o.renderType===2){let n=this._editorObs.cursorPosition.read(e);if(!n)return"";let r=Math.abs(t-n.lineNumber);return r===0?t.toString():r.toString()}return o.renderType===4?o.renderFn?o.renderFn(t):"":t.toString()});this._availableWidthForIcon=ke(this,e=>{let t=this._editorObs.editor.getModel(),o=this._editorObs.editor,n=this._editorObs.layoutInfo.read(e),r=n.decorationsLeft+n.decorationsWidth-n.glyphMarginLeft;if(!t||r<=0)return()=>0;if(n.lineNumbersLeft===0)return()=>r;let s=this._editorObs.getOption(76).read(e);if(s.renderType===2||s.renderType===0)return()=>r;let l=o.getOption(59).typicalHalfwidthCharacterWidth,c=n.lineNumbersLeft+n.lineNumbersWidth,p=(t.getLineCount()+1).toString().length,h=[];for(let g=1;g<=p;g++){let f=10**(g-1),v=o.getTopForLineNumber(f),b=g*l,S=Math.min(r,Math.max(0,c-b-n.glyphMarginLeft));h.push({firstLineNumberWithDigitCount:f,topOfLineNumber:v,usableWidthLeftOfLineNumber:S})}return g=>{for(let f=h.length-1;f>=0;f--)if(g>=h[f].topOfLineNumber)return h[f].usableWidthLeftOfLineNumber;throw new li("Could not find avilable width for icon")}});this._layout=ke(this,e=>{let t=this._state.read(e);if(!t)return;let o=this._editorObs.layoutInfo.read(e),n=this._editorObs.observeLineHeightForLine(t.range.map(he=>he.startLineNumber)).read(e),r=1,s=2,l=o.decorationsLeft+o.decorationsWidth-o.glyphMarginLeft-2*r,c=o.height-2*s,u=Wu.fromLeftTopWidthHeight(r,s,l,c),p=u.withTop(this._stickyScrollHeight.read(e)),h=u.withTop(p.top+s),g=t.lineOffsetRange.read(e),f=Wu.fromRanges(pi.fromTo(h.left,h.right),g),v=n,b=this._verticalOffset.read(e),S=f.withHeight(v).translateY(b),y=p.containsRect(S),w=this._data.read(e)?.customization?.icon,k=w?So(w):this._tabAction.map(he=>he==="accept"?R.keyboardTab:R.arrowRight),T=w?So(w):ke(this,he=>{if(this._isHoveredOverIconDebounced.read(he)||this._isHoveredOverInlineEditDebounced.read(he))return R.check;if(this._tabAction.read(he)==="accept")return R.keyboardTab;let oe=this._editorObs.cursorLineNumber.read(he)??0,de=t.range.read(he).startLineNumber;return oe<=de?R.keyboardTabAbove:R.keyboardTabBelow}),P=22,O=he=>{let oe=this._availableWidthForIcon.read(void 0)(he.bottom+this._editorObs.editor.getScrollTop())-r;return Math.max(Math.min(oe,P),sui)};if(y){let he=S,oe;o.lineNumbersWidth===0?oe=Math.max(0,Math.min(Math.max(o.lineNumbersLeft-u.left,0),he.width-P)):oe=Math.max(o.lineNumbersLeft+o.lineNumbersWidth-u.left,0);let de=he.withWidth(oe),Ce=sui+aXi,xe=Math.min(he.width-oe,P),ze=he.withWidth(Math.max(xe,Ce)).translateX(oe),De=xe>=Ce;return{gutterEditArea:f,icon:T,iconDirection:"right",iconRect:ze,iconVisible:De,pillRect:he,lineNumberRect:de}}let V=u.intersect(f);if(V&&V.height>=v){let he=S.moveToBeContainedIn(h).moveToBeContainedIn(V),oe=he.withWidth(O(he));return{gutterEditArea:f,icon:T,iconDirection:"right",iconRect:oe,pillRect:oe,iconVisible:!0}}let G=S.moveToBeContainedIn(u),$=G.withWidth(O(G)),J=$,ae=$.top<S.top?"top":"bottom";return{gutterEditArea:f,icon:k,iconDirection:ae,iconRect:J,pillRect:$,iconVisible:!0}});this._iconRef=Bo.ref();this.isVisible=this._layout.map(e=>!!e);this._hoverVisible=Me(this,!1);this.isHoverVisible=this._hoverVisible;this._isHoveredOverIcon=Me(this,!1);this._isHoveredOverIconDebounced=gP(this._isHoveredOverIcon,100);this.isHoveredOverIcon=this._isHoveredOverIconDebounced;this._indicator=Bo.div({class:"inline-edits-view-gutter-indicator",style:{position:"absolute",overflow:"visible"}},YE(this._layout).map(e=>e?[Bo.div({style:{position:"absolute",background:kt(ZYi),borderRadius:`${bb}px`,...Sb(t=>e.read(t).gutterEditArea)}}),Bo.div({class:"icon",ref:this._iconRef,tabIndex:0,onclick:()=>{let o=this._layout.get()?.icon.get()===R.check,n=this._data.get();if(!n)throw new li("Gutter indicator data not available");this._editorObs.editor.focus(),o?n.model.accept():n.model.jump()},onmouseenter:()=>{this._showHover()},style:{cursor:"pointer",zIndex:"20",position:"absolute",backgroundColor:this._gutterIndicatorStyles.map(t=>t.background),"--vscodeIconForeground":this._gutterIndicatorStyles.map(t=>t.foreground),border:this._gutterIndicatorStyles.map(t=>`1px solid ${t.border}`),boxSizing:"border-box",borderRadius:`${bb}px`,display:"flex",justifyContent:e.map(t=>t.iconDirection==="bottom"?"flex-start":"flex-end"),transition:this._modifierPressed.map(t=>t?"":"background-color 0.2s ease-in-out, width 0.2s ease-in-out"),...Sb(t=>e.read(t).pillRect)}},[Bo.div({className:"line-number",style:{lineHeight:e.map(t=>t.lineNumberRect?t.lineNumberRect.height:0),display:e.map(t=>t.lineNumberRect?"flex":"none"),alignItems:"center",justifyContent:"flex-end",width:e.map(t=>t.lineNumberRect?t.lineNumberRect.width:0),height:"100%",color:this._gutterIndicatorStyles.map(t=>t.foreground)}},this._lineNumberToRender),Bo.div({style:{transform:e.map(t=>`rotate(${w2o(t.iconDirection)}deg)`),transition:"rotate 0.2s ease-in-out, opacity 0.2s ease-in-out",display:"flex",alignItems:"center",justifyContent:"center",height:"100%",opacity:e.map(t=>t.iconVisible?"1":"0"),marginRight:e.map(t=>t.pillRect.width-t.iconRect.width-(t.lineNumberRect?.width??0)),width:e.map(t=>t.iconRect.width),position:"relative",right:e.map(t=>t.iconDirection==="top"?"1px":"0"),color:this._data.map(t=>t?.customization?.icon?.color?kt(t.customization.icon.color.id):void 0)}},[e.map((t,o)=>C2o(Sn(t.icon.read(o)),{fontSize:x2o(Math.min(t.iconRect.width-aXi,sui))}))])])]:[]));this._originalRangeObs=YE(this._data.map(f=>f?.originalRange)),this._stickyScrollController=fb.get(this._editorObs.editor),this._stickyScrollHeight=this._stickyScrollController?ui(this._stickyScrollController.onDidChangeStickyScrollHeight,()=>this._stickyScrollController.stickyScrollWidgetHeight):So(0);let g=this._indicator.keepUpdated(this._store);this._register(this._editorObs.createOverlayWidget({domNode:g.element,position:So(null),allowEditorOverflow:!1,minContentWidthInPx:So(0)})),this._register(this._editorObs.editor.onMouseMove(f=>{if(this._state.get()===void 0)return;let S=this._iconRef.element.getBoundingClientRect(),y=Wu.fromLeftTopWidthHeight(S.left,S.top,S.width,S.height),w=new Xh(f.event.posx,f.event.posy);this._isHoveredOverIcon.set(y.containsPoint(w),void 0)})),this._register(this._editorObs.editor.onDidScrollChange(()=>{this._isHoveredOverIcon.set(!1,void 0)})),this._isHoveredOverInlineEditDebounced=gP(this._isHoveringOverInlineEdit,100),this._register(Vs(this._isHoveredOverInlineEditDebounced,f=>{f&&this.triggerAnimation()})),this._register(be(f=>{g.readEffect(f),g.element&&this._editorObs.editor.applyFontInfo(g.element)}))}triggerAnimation(){return this._accessibilityService.isMotionReduced()?new Animation(null,null).finished:this._iconRef.element.animate([{outline:`2px solid ${this._gutterIndicatorStyles.map(t=>t.border).get()}`,outlineOffset:"-1px",offset:0},{outline:"2px solid transparent",outlineOffset:"10px",offset:1}],{duration:500}).finished}_showHover(){if(this._hoverVisible.get())return;let e=this._data.get();if(!e)throw new li("Gutter indicator data not available");let t=new N,o=t.add(this._instantiationService.createInstance(Eke,this._editorObs,e.gutterMenuData,(s,l)=>{s&&this._editorObs.editor.focus(),l&&this._onDidCloseWithCommand.fire(l),r?.dispose()}).toDisposableLiveElement()),n=this._userInteractionService.createFocusTracker(o.element,t);t.add(be(s=>{this._focusIsInMenu.set(n.read(s),void 0)})),t.add(Z(()=>this._focusIsInMenu.set(!1,void 0)));let r=this._hoverService.showInstantHover({target:this._iconRef.element,content:o.element});r?(this._hoverVisible.set(!0,void 0),t.add(this._editorObs.editor.onDidScrollChange(()=>r.dispose())),t.add(r.onDispose(()=>{this._hoverVisible.set(!1,void 0),t.dispose()}))):t.dispose()}};uK=I([m(6,nt),m(7,F),m(8,Oi),m(9,Le),m(10,_C)],uK);function w2o(a){switch(a){case"top":return 90;case"bottom":return-90;case"right":return 0}}function C2o(a,i){for(let e in i)a.style[e]=i[e];return a}function x2o(a){return`${a}px`}var Tke=class extends x{constructor(e,t,o,n,r){super();this._model=e;this._indicator=t;this._collapsedView=o;this._storageService=n;this._configurationService=r;this._disposables=this._register(new me);this._setupDone=Me({name:"setupDone"},!1);this._activeCompletionId=ke(e=>{let t=this._model.read(e);if(!t||!this._setupDone.read(e))return;let o=this._indicator.read(e);if(!(!o||!o.isVisible.read(e)))return t.inlineEdit.inlineCompletion.identity.id});this._register(this._initializeDebugSetting()),this._disposables.value=this.setupNewUserExperience(),this._setupDone.set(!0,void 0)}setupNewUserExperience(){if(this.getNewUserType()==="active")return;let e=new N,t=!1,o=!1,n=0,r=0;return e.add(RJt(this._activeCompletionId,async(s,l,c,u)=>{if(s===void 0)return;let p=this.getNewUserType();switch(p){case"firstTime":{(n++>=5||t)&&(p="secondTime",this.setNewUserType(p));break}case"secondTime":{r++>=3&&o&&(p="active",this.setNewUserType(p));break}}switch(p){case"firstTime":{for(let h=0;h<3&&!u.isCancellationRequested;h++)await this._indicator.get()?.triggerAnimation(),await Li(500);break}case"secondTime":{this._indicator.get()?.triggerAnimation();break}}})),e.add(be(s=>{this._collapsedView.isVisible.read(s)&&this.getNewUserType()!=="active"&&this._collapsedView.triggerAnimation()})),e.add(be(s=>{let l=this._indicator.read(s);l&&s.store.add(Vs(l.isHoveredOverIcon,async c=>{c&&(t=!0)}))})),e.add(be(s=>{let l=this._model.read(s);l&&s.store.add(l.onDidAccept(()=>{o=!0}))})),e}getNewUserType(){return this._storageService.get("inlineEditsGutterIndicatorUserKind",-1,"firstTime")}setNewUserType(e){switch(e){case"firstTime":throw new li("UserKind should not be set to first time");case"secondTime":break;case"active":this._disposables.clear();break}this._storageService.store("inlineEditsGutterIndicatorUserKind",e,-1,0)}_initializeDebugSetting(){let e="editor.inlineSuggest.edits.resetNewUserExperience";return this._configurationService.getValue(e)&&this._storageService.remove("inlineEditsGutterIndicatorUserKind",-1),this._configurationService.onDidChangeConfiguration(o=>{o.affectsConfiguration(e)&&this._configurationService.getValue(e)&&(this._storageService.remove("inlineEditsGutterIndicatorUserKind",-1),this._disposables.value=this.setupNewUserExperience())})}};Tke=I([m(3,ce),m(4,B)],Tke);var qkt=class{constructor(i,e,t,o,n,r,s){this.originalText=i;this.action=e;this.edit=t;this.cursorPosition=o;this.multiCursorPositions=n;this.commands=r;this.inlineCompletion=s}get lineEdit(){return this.action?.kind==="jumpTo"?new oz(uo.ofLength(this.action.position.lineNumber,0),[]):this.action?.kind==="edit"?oz.fromSingleTextEdit(this.edit.toReplacement(this.originalText),this.originalText):new oz(new uo(1,1),[])}get originalLineRange(){return this.lineEdit.lineRange}get modifiedLineRange(){return this.lineEdit.toLineEdit().getNewLineRanges()[0]}get displayRange(){return this.originalText.lineRange.intersect(this.originalLineRange.join(uo.ofLength(this.originalLineRange.startLineNumber,this.lineEdit.newLines.length)))}};var $kt=class{constructor(i,e,t){this._model=i;this.inlineEdit=e;this.tabAction=t;this.editorType=this._model.editorType,this.displayLocation=this.inlineEdit.inlineCompletion.hint,this.inViewPort=ke(this,o=>Bdi(this._model.editor,this.inlineEdit.inlineCompletion,o)),this.onDidAccept=this._model.onDidAccept}accept(i){this._model.accept(void 0,i)}handleInlineEditShownNextFrame(i,e){let t=this.inlineEdit.inlineCompletion,o=Date.now();t.addRef(),pC(()=>{this._model.handleInlineSuggestionShown(t,i,e,o),t.removeRef()})}};var _ke=class extends x{constructor(e,t,o){super();this._editor=e;this._edit=t;this._accessibilityService=o;this.onDidClick=U.None;this._iconRef=Bo.ref();this.isHovered=So(!1);this._editorObs=gs(this._editor);let r=this._edit.map(u=>u?.edit?.replacements[0]??null).map(u=>u?zP(u,this._editor.getModel()).range.getStartPosition():null),s=this._editorObs.observePosition(r,this._store),l=ke(u=>{let p=s.read(u);if(!p)return null;let h=this._editorObs.layoutInfoContentLeft.read(u),g=this._editorObs.scrollLeft.read(u);return new Xh(h+p.x-g,p.y)}),c=Bo.div({class:"inline-edits-collapsed-view",style:{position:"absolute",overflow:"visible",top:"0px",left:"0px",display:"block"}},[[this.getCollapsedIndicator(l)]]).keepUpdated(this._store).element;this._register(this._editorObs.createOverlayWidget({domNode:c,position:So(null),allowEditorOverflow:!1,minContentWidthInPx:So(0)})),this.isVisible=this._edit.map((u,p)=>!!u&&l.read(p)!==null)}triggerAnimation(){return this._accessibilityService.isMotionReduced()?new Animation(null,null).finished:this._iconRef.element.animate([{offset:0,transform:"translateY(-3px)"},{offset:.2,transform:"translateY(1px)"},{offset:.36,transform:"translateY(-1px)"},{offset:.52,transform:"translateY(1px)"},{offset:.68,transform:"translateY(-1px)"},{offset:.84,transform:"translateY(1px)"},{offset:1,transform:"translateY(0px)"}],{duration:2e3}).finished}getCollapsedIndicator(e){let t=this._editorObs.layoutInfoContentLeft,o=e.map((r,s)=>r?r.deltaX(-t.read(s)):null),n=this.createIconPath(o);return Bo.svg({class:"collapsedView",ref:this._iconRef,style:{position:"absolute",...Sb(r=>xke(this._editorObs).read(r)),overflow:"hidden",pointerEvents:"none"}},[Bo.svgElem("path",{class:"collapsedViewPath",d:n,fill:kt(mF)})])}createIconPath(e){return e.map(r=>{if(!r)return new lde().build();let s=r.deltaX(-6/2).deltaY(-1),l=s.deltaX(6),c=s.deltaY(1),u=l.deltaY(1),p=c.deltaX(6/2).deltaY(3);return new lde().moveTo(s).lineTo(l).lineTo(u).lineTo(p).lineTo(c).lineTo(s).build()})}};_ke=I([m(2,Oi)],_ke);var jkt=14,aui=0,L5=4,Qkt=4,lXi=2,Dke=class extends x{constructor(e,t,o,n,r,s){super();this._editor=e;this._languageService=s;this._onDidClick=this._register(new E);this.onDidClick=this._onDidClick.event;this._isHovered=Me(this,!1);this.isHovered=this._isHovered;this._viewRef=Bo.ref();this._editorObs=gs(this._editor);let l=o.map((h,g)=>{let f;switch(h){case"inactive":f=yke;break;case"jump":f=dK;break;case"accept":f=wke;break}return{border:vb(f,r).read(g).toString(),background:Q_(n.read(g))}}),c=t.map(h=>h?this.getState(h):void 0),u=c.map(h=>h?this.getRendering(h,l):void 0);this.minEditorScrollHeight=ke(this,h=>{let g=c.read(h);return g?g.rect.read(h).bottom+this._editor.getScrollTop():0});let p=Bo.div({class:"inline-edits-custom-view",style:{position:"absolute",overflow:"visible",top:"0px",left:"0px",display:"block"}},[u]).keepUpdated(this._store);this._register(this._editorObs.createOverlayWidget({domNode:p.element,position:So(null),allowEditorOverflow:!1,minContentWidthInPx:Bf(this,(h,g)=>{let f=c.read(h);if(!f)return g??0;let v=f.rect.map(b=>b.right).read(h)+this._editorObs.layoutInfoVerticalScrollbarWidth.read(h)+L5-this._editorObs.layoutInfoContentLeft.read(h);return Math.max(g??0,v)}).recomputeInitiallyAndOnChange(this._store)})),this._register(be(h=>{if(!u.read(h)){this._isHovered.set(!1,void 0);return}this._isHovered.set(p.isHovered.read(h),void 0)}))}fitsInsideViewport(e,t,o){let n=this._editorObs.layoutInfoWidth.read(o),r=this._editorObs.layoutInfoContentLeft.read(o),s=this._editor.getLayoutInfo().verticalScrollbarWidth,l=this._editorObs.layoutInfoMinimap.read(o).minimapLeft!==0?this._editorObs.layoutInfoMinimap.read(o).minimapWidth:0,c=GP(this._editorObs,e,void 0),u=K8e(t,this._editor,this._editor.getModel()),p=L5+jkt;return c+u+p<n-r-s-l}getState(e){let t=ke(this,l=>{let c=e.range.startLineNumber,u=e.range.endLineNumber,p=e.range.startColumn,h=e.range.endColumn,g=this._editor.getModel()?.getLineCount()??0,f=GP(this._editorObs,new uo(c,c+1),l),v=c+1<=g?GP(this._editorObs,new uo(c+1,c+2),l):void 0,b=c-1>=1?GP(this._editorObs,new uo(c-1,c),l):void 0,S=this._editor.getOffsetForColumn(c,p),y=this._editor.getOffsetForColumn(u,h);return{lineWidth:f,lineWidthBelow:v,lineWidthAbove:b,startContentLeftOffset:S,endContentLeftOffset:y}}),o=e.range.startLineNumber,n=e.range.endLineNumber,r=this.fitsInsideViewport(new uo(o,n+1),e.content,void 0);return{rect:ke(this,l=>{let c=this._editorObs.getOption(59).read(l).typicalHalfwidthCharacterWidth,{lineWidth:u,lineWidthBelow:p,lineWidthAbove:h,startContentLeftOffset:g,endContentLeftOffset:f}=t.read(l),v=this._editorObs.layoutInfoContentLeft.read(l),b=this._editorObs.observeLineHeightForLine(o).recomputeInitiallyAndOnChange(l.store).read(l),S=this._editorObs.scrollTop.read(l),y=this._editorObs.scrollLeft.read(l),w;o===n&&f+5*c>=u&&r?w="end":p!==void 0&&p+jkt-Qkt-L5<g?w="below":h!==void 0&&h+jkt-Qkt-L5<g?w="above":w="end";let k,T,P=0,O=0;switch(w){case"end":{k=this._editorObs.editor.getTopForLineNumber(o),T=u,P=L5+jkt;break}case"below":{k=this._editorObs.editor.getTopForLineNumber(o+1),T=g,P=L5+Qkt,O=aui+lXi;break}case"above":{k=this._editorObs.editor.getTopForLineNumber(o-1),T=g,P=L5+Qkt,O=-aui+lXi;break}}return Wu.fromLeftTopWidthHeight(v+T-y,k-S,c*e.content.length,b).withMargin(aui,L5).translateX(P).translateY(O)}),label:e.content,kind:e.style}}getRendering(e,t){let o=document.createElement("div"),n=this._editor.getModel().tokenization.tokenizeLinesAt(1,[e.label])?.[0],r;n&&e.kind===1?r=LV.fromLineTokens(n).toLineTokens(e.label,this._languageService.languageIdCodec):r=Zc.createEmpty(e.label,this._languageService.languageIdCodec);let s=lR(new NE([r]),OE.fromEditor(this._editor).withSetWidth(!1).withScrollBeyondLastColumn(0),[],o,!0);o.style.width=`${s.minWidthInPx}px`;let l=e.rect.map(c=>c.withMargin(0,L5));return Bo.div({class:"collapsedView",ref:this._viewRef,style:{position:"absolute",...Sb(c=>l.read(c)),overflow:"hidden",boxSizing:"border-box",cursor:"pointer",border:t.map(c=>`1px solid ${c.border}`),borderRadius:`${bb}px`,backgroundColor:t.map(c=>c.background),display:"flex",alignItems:"center",justifyContent:"center",whiteSpace:"nowrap"},onmousedown:c=>{c.preventDefault()},onclick:c=>{this._onDidClick.fire(CR.create(c))}},[o])}};Dke=I([m(4,Le),m(5,_t)],Dke);var E2o=0,T2o=0,lui=1,_2o=1,D2o=3,cui=bb,Ykt=class extends x{constructor(e,t,o,n){super();this._editor=e;this._edit=t;this._uiState=o;this._tabAction=n;this.onDidClick=U.None;this._display=ke(this,e=>this._uiState.read(e)?"block":"none");this._editorMaxContentWidthInRange=ke(this,e=>{let t=this._originalDisplayRange.read(e);return t?(this._editorObs.versionId.read(e),Bf(this,(o,n)=>{let r=GP(this._editorObs,t,o);return Math.max(r,n??0)})):So(0)}).map((e,t)=>e.read(t));this._maxPrefixTrim=ke(this,e=>{let t=this._uiState.read(e);return t?Cke(t.deletions,t.originalRange,[],this._editor):{prefixTrim:0,prefixLeftOffset:0}});this._editorLayoutInfo=ke(this,e=>{let t=this._edit.read(e);if(!t||!this._uiState.read(e))return null;let n=this._editorObs.layoutInfo.read(e),r=this._editorObs.scrollLeft.read(e),s=this._editorObs.getOption(59).map(f=>f.typicalHalfwidthCharacterWidth).read(e),l=n.contentLeft+Math.max(this._editorMaxContentWidthInRange.read(e),s)-r,c=t.originalLineRange,u=this._originalVerticalStartPosition.read(e)??this._editor.getTopForLineNumber(c.startLineNumber)-this._editorObs.scrollTop.read(e),p=this._originalVerticalEndPosition.read(e)??this._editor.getTopForLineNumber(c.endLineNumberExclusive)-this._editorObs.scrollTop.read(e),h=n.contentLeft+this._maxPrefixTrim.read(e).prefixLeftOffset-r;return l<=h?null:{codeRect:Wu.fromLeftTopRightBottom(h,u,l,p).withMargin(T2o,E2o),contentLeft:n.contentLeft}}).recomputeInitiallyAndOnChange(this._store);this._originalOverlay=Bo.div({style:{pointerEvents:"none"}},ke(this,e=>{let t=YE(this._editorLayoutInfo).read(e);if(!t)return;let o=t.map(c=>Wu.fromLeftTopRightBottom(c.contentLeft-cui-lui,c.codeRect.top,c.contentLeft,c.codeRect.bottom)),n=ke(this,c=>{let u=t.read(c).codeRect,p=o.read(c);return u.intersectHorizontal(new pi(p.left,Number.MAX_SAFE_INTEGER))}),r=this._uiState.map(c=>c?.editorType==="diffEditor"?D2o:_2o).read(e),s=n.map(c=>c.withMargin(r,r)),l=Q_(this._uiState.map(c=>c?.editorType??"textEditor").read(e));return[Bo.div({class:"originalSeparatorDeletion",style:{...s.read(e).toStyles(),borderRadius:`${cui}px`,border:`${lui+r}px solid ${l}`,boxSizing:"border-box"}}),Bo.div({class:"originalOverlayDeletion",style:{...n.read(e).toStyles(),borderRadius:`${cui}px`,border:cX(this._tabAction).map(c=>`${lui}px solid ${kt(c)}`),boxSizing:"border-box",backgroundColor:kt(aX)}}),Bo.div({class:"originalOverlayHiderDeletion",style:{...o.read(e).toStyles(),backgroundColor:l}})]})).keepUpdated(this._store);this._nonOverflowView=Bo.div({class:"inline-edits-view",style:{position:"absolute",overflow:"visible",top:"0px",left:"0px",display:this._display}},[[this._originalOverlay]]).keepUpdated(this._store);this.isHovered=So(!1);this._editorObs=gs(this._editor);let r=ke(this,l=>{let c=this._edit.read(l);return c?new ye(c.originalLineRange.startLineNumber,1):null}),s=ke(this,l=>{let c=this._edit.read(l);return c?new ye(c.originalLineRange.endLineNumberExclusive,1):null});this._originalDisplayRange=this._uiState.map(l=>l?.originalRange),this._originalVerticalStartPosition=this._editorObs.observePosition(r,this._store).map(l=>l?.y),this._originalVerticalEndPosition=this._editorObs.observePosition(s,this._store).map(l=>l?.y),this._register(this._editorObs.createOverlayWidget({domNode:this._nonOverflowView.element,position:So(null),allowEditorOverflow:!1,minContentWidthInPx:ke(this,l=>{let c=this._editorLayoutInfo.read(l);return c===null?0:c.codeRect.width})}))}};var G8e=1,L2o=1,R2o=3,dui=bb,Lke=class extends x{constructor(e,t,o,n,r){super();this._editor=e;this._input=t;this._tabAction=o;this._languageService=r;this._onDidClick=this._register(new E);this.onDidClick=this._onDidClick.event;this._state=ke(this,e=>{let t=this._input.read(e);if(!t)return;let o=this._editor.getModel(),n=o.getEOL();if(t.startColumn===1&&t.lineNumber>1&&o.getLineLength(t.lineNumber)!==0&&t.text.endsWith(n)&&!t.text.startsWith(n)){let r=o.getLineLength(t.lineNumber-1)+1;return{lineNumber:t.lineNumber-1,column:r,text:n+t.text.slice(0,-n.length)}}return{lineNumber:t.lineNumber,column:t.startColumn,text:t.text}});this._trimVertically=ke(this,e=>{let t=this._state.read(e),o=t?.text;if(!o||o.trim()==="")return{topOffset:0,bottomOffset:0,linesTop:0,linesBottom:0};let n=this._editor.getLineHeightForPosition(new ye(t.lineNumber,1)),r=this._editor.getModel().getEOL(),s=0,l=0,c=0;for(;c<o.length&&o.startsWith(r,c);c+=r.length)s+=1;for(let u=o.length;u>c&&o.endsWith(r,u);u-=r.length)l+=1;return{topOffset:s*n,bottomOffset:l*n,linesTop:s,linesBottom:l}});this._maxPrefixTrim=ke(this,e=>{let t=this._state.read(e);if(!t)return{prefixLeftOffset:0,prefixTrim:0};let o=this._editor.getModel(),n=o.getEOL(),r=this._trimVertically.read(e),s=t.text.split(n),l=s.slice(r.linesTop,s.length-r.linesBottom);r.linesTop===0&&(l[0]=o.getLineContent(t.lineNumber)+l[0]);let c=new uo(t.lineNumber,t.lineNumber+(r.linesTop>0?0:1));return Cke([],c,l,this._editor)});this._ghostText=ke(e=>{let t=this._state.read(e),o=this._maxPrefixTrim.read(e);if(!t)return;let r=this._editor.getModel().getEOL(),l=t.text.split(r).map((c,u)=>new CE(new z(u+1,u===0?1:o.prefixTrim+1,u+1,c.length+1),"modified-background",0));return new nK(t.lineNumber,[new iX(t.column,t.text,!1,l)])});this._display=ke(this,e=>this._state.read(e)?"block":"none");this._editorMaxContentWidthInRange=ke(this,e=>{let t=this._state.read(e);if(!t)return 0;this._editorObs.versionId.read(e);let o=this._editor.getModel(),n=o.getEOL(),r=t.text.startsWith(n)?"":o.getValueInRange(new z(t.lineNumber,1,t.lineNumber,t.column)),s=o.getValueInRange(new z(t.lineNumber,t.column,t.lineNumber,o.getLineLength(t.lineNumber)+1)),c=(r+t.text+s).split(n),u=OE.fromEditor(this._editor).withSetWidth(!1).withScrollBeyondLastColumn(0),p=c.map(h=>{let g=o.tokenization.tokenizeLinesAt(t.lineNumber,[h])?.[0],f;return g?f=LV.fromLineTokens(g).toLineTokens(h,this._languageService.languageIdCodec):f=Zc.createEmpty(h,this._languageService.languageIdCodec),lR(new NE([f]),u,[],_("div"),!0).minWidthInPx});return Math.max(...p)});this.startLineOffset=this._trimVertically.map(e=>e.topOffset);this.originalLines=this._state.map(e=>e?new uo(e.lineNumber,Math.min(e.lineNumber+2,this._editor.getModel().getLineCount()+1)):void 0);this._overlayLayout=ke(this,e=>{this._ghostText.read(e);let t=this._state.read(e);if(!t)return null;this._editorObs.observePosition(Me(this,new ye(t.lineNumber,t.column)),e.store).read(e);let o=this._editorObs.layoutInfo.read(e),n=this._editorObs.scrollLeft.read(e),r=this._editorObs.layoutInfoVerticalScrollbarWidth.read(e),s=o.contentLeft+this._editorMaxContentWidthInRange.read(e)-n,l=this._maxPrefixTrim.read(e).prefixLeftOffset??0,c=o.contentLeft+l-n;if(s<=c)return null;let{topOffset:u,bottomOffset:p}=this._trimVertically.read(e),h=this._editorObs.scrollTop.read(e),g=this._ghostTextView.height.read(e)-u-p,f=this._editor.getTopForLineNumber(t.lineNumber)-h+u,v=f+g,b=new Wu(c,f,s,v);return{overlay:b,startsAtContentLeft:l===0,contentLeft:o.contentLeft,minContentWidthRequired:l+b.width+r}}).recomputeInitiallyAndOnChange(this._store);this._modifiedOverlay=Bo.div({style:{pointerEvents:"none"}},ke(this,e=>{let t=YE(this._overlayLayout).read(e);if(!t)return;let o=t.map(c=>Wu.fromLeftTopRightBottom(c.contentLeft-dui-G8e,c.overlay.top,c.contentLeft,c.overlay.bottom)).read(e),n=this._input.map(c=>c?.editorType==="diffEditor"?R2o:L2o).read(e),r=t.map(c=>c.overlay.withMargin(0,G8e,0,c.startsAtContentLeft?0:G8e).intersectHorizontal(new pi(o.left,Number.MAX_SAFE_INTEGER))),s=r.map(c=>c.withMargin(n,n)),l=Q_(this._input.read(void 0)?.editorType??"textEditor");return[Bo.div({class:"originalUnderlayInsertion",style:{...s.read(e).toStyles(),borderRadius:dui,border:`${G8e+n}px solid ${l}`,boxSizing:"border-box"}}),Bo.div({class:"originalOverlayInsertion",style:{...r.read(e).toStyles(),borderRadius:dui,border:_5(this._tabAction).map(c=>`${G8e}px solid ${kt(c)}`),boxSizing:"border-box",backgroundColor:kt(Gkt)}}),Bo.div({class:"originalOverlayHiderInsertion",style:{...o.toStyles(),backgroundColor:l}})]})).keepUpdated(this._store);this._view=Bo.div({class:"inline-edits-view",style:{position:"absolute",overflow:"visible",top:"0px",left:"0px",display:this._display}},[[this._modifiedOverlay]]).keepUpdated(this._store);this._editorObs=gs(this._editor),this._ghostTextView=this._register(n.createInstance(cK,this._editor,ke(s=>{let l=this._ghostText.read(s);if(l)return{ghostText:l,handleInlineCompletionShown:c=>{},warning:void 0}}),{extraClasses:["inline-edit"],isClickable:!0,shouldKeepCursorStable:!0})),this.isHovered=this._ghostTextView.isHovered,this._register(this._ghostTextView.onDidClick(s=>{this._onDidClick.fire(new CR(s))})),this._register(this._editorObs.createOverlayWidget({domNode:this._view.element,position:So(null),allowEditorOverflow:!1,minContentWidthInPx:ke(this,s=>{let l=this._overlayLayout.read(s);return l===null?0:l.minContentWidthRequired})}))}};Lke=I([m(3,F),m(4,_t)],Lke);var Rke=class extends x{constructor(e,t,o,n,r,s){super();this._editor=e;this._edit=t;this._editorType=o;this._tabAction=n;this._languageService=r;this._themeService=s;this._onDidClick=this._register(new E);this.onDidClick=this._onDidClick.event;this._maxPrefixTrim=this._edit.map((l,c)=>l?Cke(l.replacements.flatMap(u=>[u.originalRange,u.modifiedRange]),l.originalRange,l.modifiedLines,this._editor.editor,c):void 0),this._modifiedLineElements=ke(this,l=>{let c=[],u=0,p=this._maxPrefixTrim.read(l),h=this._edit.read(l);if(!h||!p)return;let g=p.prefixTrim,f=M2o(h.replacements.map(S=>S.modifiedRange)).map(S=>new z(S.startLineNumber,S.startColumn-g,S.endLineNumber,S.endColumn-g)),v=this._editor.model.get(),b=h.modifiedRange.startLineNumber;for(let S=0;S<h.modifiedRange.length;S++){let y=document.createElement("div"),w=b+S,k=h.modifiedLines[S].slice(g),T=v.tokenization.tokenizeLinesAt(w,[k])?.[0],P;T?P=LV.fromLineTokens(T).toLineTokens(k,this._languageService.languageIdCodec):P=Zc.createEmpty(k,this._languageService.languageIdCodec);let O=[];for(let H of f.filter(G=>G.startLineNumber===w)){let G=Math.min(H.endColumn,k.length+1);O.push(new CE(new z(1,H.startColumn,1,G),"inlineCompletions-modified-bubble",0))}let V=lR(new NE([P]),OE.fromEditor(this._editor.editor).withSetWidth(!1).withScrollBeyondLastColumn(0),O,y,!0);this._editor.getOption(59).read(l),u=Math.max(u,V.minWidthInPx),c.push(y)}return{lines:c,requiredWidth:u}}),this._layout=ke(this,l=>{let c=this._modifiedLineElements.read(l),u=this._maxPrefixTrim.read(l),p=this._edit.read(l);if(!c||!u||!p)return;let{prefixLeftOffset:h}=u,{requiredWidth:g}=c,f=this._editor.observeLineHeightsForLineRange(p.originalRange).read(l),v=(()=>{let Ce=f.slice(0,p.modifiedRange.length);for(;Ce.length<p.modifiedRange.length;)Ce.push(f[f.length-1]);return Ce})(),b=this._editor.layoutInfoContentLeft.read(l),S=this._editor.layoutInfoVerticalScrollbarWidth.read(l),y=this._editor.scrollLeft.read(l),w=this._editor.scrollTop.read(l),k=b-y,T=this._editor.editor.getModel(),P=p.originalRange.mapToLineArray(Ce=>this._editor.editor.getOffsetForColumn(Ce,T.getLineMaxColumn(Ce))-h),O=Math.max(...P,g),V=p.originalRange.startLineNumber,H=p.originalRange.endLineNumberExclusive-1,G=this._editor.editor.getTopForLineNumber(V)-w,$=this._editor.editor.getBottomForLineNumber(H)-w,J=Wu.fromLeftTopWidthHeight(k+h,G,O,$-G),ae=Wu.fromLeftTopWidthHeight(J.left,J.bottom,J.width,v.reduce((Ce,xe)=>Ce+xe,0)),he=Wu.hull([J,ae]),oe=he.intersectVertical(new pi(J.bottom,Number.MAX_SAFE_INTEGER)),de=new Wu(oe.left,oe.top,oe.right,oe.bottom);return{originalLinesOverlay:J,modifiedLinesOverlay:ae,background:he,lowerBackground:oe,lowerText:de,modifiedLineHeights:v,minContentWidthRequired:h+O+S}}),this._viewZoneInfo=ke(l=>{if(!this._editor.getOption(71).map(f=>f.edits.allowCodeShifting==="always").read(l))return;let u=this._layout.read(l),p=this._edit.read(l);if(!u||!p)return;let h=u.lowerBackground.height,g=p.originalRange.endLineNumberExclusive;return{height:h,lineNumber:g}}),this.minEditorScrollHeight=ke(this,l=>{let c=YE(this._layout).read(l);return!c||this._viewZoneInfo.read(l)!==void 0?0:c.read(l).lowerText.bottom+this._editor.editor.getScrollTop()}),this._div=Bo.div({class:"line-replacement"},[ke(this,l=>{let c=YE(this._layout).read(l),u=this._modifiedLineElements.read(l);if(!c||!u)return[];let p=c.read(l),h=this._editor.layoutInfoContentLeft.read(l),g=this._editorType.read(l)==="diffEditor"?3:1;u.lines.forEach((S,y)=>{S.style.width=`${p.lowerText.width}px`,S.style.height=`${p.modifiedLineHeights[y]}px`,S.style.position="relative"});let f=_5(this._tabAction).read(l),v=cX(this._tabAction).read(l),b=Q_(this._editorType.read(l));return[Bo.div({style:{position:"absolute",...Sb(S=>xke(this._editor).read(S)),overflow:"hidden",pointerEvents:"none"}},[Bo.div({class:"borderAroundLineReplacement",style:{position:"absolute",...Sb(S=>c.read(S).background.translateX(-h).withMargin(g)),borderRadius:`${bb}px`,border:`${g+1}px solid ${b}`,boxSizing:"border-box",pointerEvents:"none"}}),Bo.div({class:"originalOverlayLineReplacement",style:{position:"absolute",...Sb(S=>c.read(S).background.translateX(-h)),borderRadius:`${bb}px`,border:vb(v,this._themeService).map(S=>`1px solid ${S.toString()}`),pointerEvents:"none",boxSizing:"border-box",background:kt(aX)}}),Bo.div({class:"modifiedOverlayLineReplacement",style:{position:"absolute",...Sb(S=>c.read(S).lowerBackground.translateX(-h)),borderRadius:`0 0 ${bb}px ${bb}px`,background:b,boxShadow:`${kt(U1)} 0 6px 6px -6px`,border:`1px solid ${kt(f)}`,boxSizing:"border-box",overflow:"hidden",cursor:"pointer",pointerEvents:"auto"},onmousedown:S=>{S.preventDefault()},onclick:S=>this._onDidClick.fire(CR.create(S))},[Bo.div({style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",background:kt(jYi)}})]),Bo.div({class:"modifiedLinesLineReplacement",style:{position:"absolute",boxSizing:"border-box",...Sb(S=>c.read(S).lowerText.translateX(-h)),fontFamily:this._editor.getOption(58),fontSize:this._editor.getOption(61),fontWeight:this._editor.getOption(62),pointerEvents:"none",whiteSpace:"nowrap",borderRadius:`0 0 ${bb}px ${bb}px`,overflow:"hidden"}},[...u.lines])])]})]).keepUpdated(this._store),this.isHovered=this._editor.isTargetHovered(l=>this._isMouseOverWidget(l),this._store),this._previousViewZoneInfo=void 0,this._register(Z(()=>this._editor.editor.changeViewZones(l=>this.removePreviousViewZone(l)))),this._register(sae(this._viewZoneInfo,({lastValue:l,newValue:c})=>{l===c||l?.height===c?.height&&l?.lineNumber===c?.lineNumber||this._editor.editor.changeViewZones(u=>{this.removePreviousViewZone(u),c&&this.addViewZone(c,u)})})),this._register(this._editor.createOverlayWidget({domNode:this._div.element,minContentWidthInPx:ke(this,l=>this._layout.read(l)?.minContentWidthRequired??0),position:So({preference:{top:0,left:0}}),allowEditorOverflow:!1}))}_isMouseOverWidget(e){let t=this._layout.get();return!t||!(e.event instanceof YL)?!1:t.lowerBackground.containsPoint(new Xh(e.event.relativePos.x,e.event.relativePos.y))}removePreviousViewZone(e){if(!this._previousViewZoneInfo)return;e.removeZone(this._previousViewZoneInfo.id);let t=this._editor.cursorLineNumber.get();t!==null&&t>=this._previousViewZoneInfo.lineNumber&&this._editor.editor.setScrollTop(this._editor.scrollTop.get()-this._previousViewZoneInfo.height),this._previousViewZoneInfo=void 0}addViewZone(e,t){let o=t.addZone({afterLineNumber:e.lineNumber-1,heightInPx:e.height,domNode:_("div")});this._previousViewZoneInfo={height:e.height,lineNumber:e.lineNumber,id:o};let n=this._editor.cursorLineNumber.get();n!==null&&n>=e.lineNumber&&this._editor.editor.setScrollTop(this._editor.scrollTop.get()+e.height)}};Rke=I([m(4,_t),m(5,Le)],Rke);function M2o(a){let i=[];for(;a.length;){let e=a.shift();e.startLineNumber!==e.endLineNumber&&(a.push(new z(e.startLineNumber+1,1,e.endLineNumber,e.endColumn)),e=new z(e.startLineNumber,e.startColumn,e.startLineNumber,Number.MAX_SAFE_INTEGER)),i.push(e)}return i}function P2o(a,i){a.$$visualization=i}function q8e(a,i){if(Array.isArray(a)){let e={};a.forEach((t,o)=>{e[o.toString()]=t}),a=e}return P2o(a,new uui(a,i)),a}var uui=class{constructor(i,e){this._rects=i;this._elem=e}visualize(){let i=[];for(let e in this._rects){let t=new pui(this._rects[e],this._elem,e);i.push(t.visualize())}return{dispose:()=>{i.forEach(e=>e.dispose())}}}};var pui=class{constructor(i,e,t){this._rect=i;this._elem=e;this._name=t}visualize(){let i=document.createElement("div");i.style.position="fixed",i.style.border="1px solid red",i.style.boxSizing="border-box",i.style.pointerEvents="none",i.style.zIndex="100000";let e=document.createElement("div");e.textContent=this._name,e.style.position="absolute",e.style.top="-20px",e.style.left="0",e.style.color="red",e.style.fontSize="12px",e.style.backgroundColor="rgba(255, 255, 255, 0.7)",i.appendChild(e);let t=()=>{let n=this._elem.getBoundingClientRect();console.log(n),i.style.left=n.left+this._rect.left+"px",i.style.top=n.top+this._rect.top+"px",i.style.width=this._rect.width+"px",i.style.height=this._rect.height+"px"};document.body.appendChild(i),t();let o=new ResizeObserver(t);return o.observe(this._elem),{dispose:()=>{o.disconnect(),i.remove()}}}};function $8e(a,i){if(typeof a=="object"&&a&&"$$visualization"in a){let e=a.$$visualization;A2o(e.visualize(),i)}}function A2o(a,i){ke({name:"debugReadDisposable"},e=>{e.store.add(a)}).read(i)}function cXi(a,i){let e={};for(let[r,s]of Object.entries(i))Array.isArray(s)?e[r]={min:0,rules:s}:e[r]={min:s.min??0,rules:s.rules??[{max:s.max,priority:s.priority,share:s.share}]};let t={},o=0;for(let[r,s]of Object.entries(e))t[r]=s.min,o+=s.min;if(o>a)return null;let n=a-o;for(;n>0;){let r=[];for(let[h,g]of Object.entries(e))for(let f=0;f<g.rules.length;f++){let v=g.rules[f],b=t[h],S=v.max??1/0;b<S&&r.push({partKey:h,ruleIndex:f,rule:v,priority:v.priority??0,share:v.share??1})}if(r.length===0)break;let s=Math.max(...r.map(h=>h.priority)),l=r.filter(h=>h.priority===s),c=l.reduce((h,g)=>h+g.share,0),u=0,p=[];for(let h of l){let g=h.rule,f=t[h.partKey],b=(g.max??1/0)-f,S=n*h.share/c,y=Math.min(S,b);p.push({partKey:h.partKey,ruleIndex:h.ruleIndex,amount:y}),u+=y}if(u===0)break;for(let h of p)t[h.partKey]+=h.amount;if(n-=u,n<1e-4)break}return t}var mX=class extends x{constructor(e,t,o,n,r,s){super();this._editor=e;this._data=o;this._themeService=n;this._keybindingService=r;this._contextKeyService=s;this._styles=ke(this,e=>({background:vb(dK,this._themeService).read(e).toString(),foreground:vb(lX,this._themeService).read(e).toString(),border:vb(mF,this._themeService).read(e).toString()}));this._pos=ke(this,e=>this._editor.observePosition(ke(t=>this._data.read(t)?.jumpToPosition||null),e.store)).flatten();this._layout=ke(this,e=>{let t=this._data.read(e);if(!t)return;let o=t.jumpToPosition,n=this._editor.observeLineHeightForLine(So(o.lineNumber)).read(e),r=this._editor.scrollLeft.read(e),s=this._pos.read(e);if(!s)return;let l=this._editor.layoutInfo.read(e);return{widgetRect:Wu.fromLeftTopWidthHeight(s.x+l.contentLeft+2-r,s.y,100,n)}});this._blink=N2o([{value:!0,durationMs:600},{value:!1,durationMs:600}]);this._widget=Bo.div({class:"inline-edit-jump-to-widget",style:{position:"absolute",display:this._layout.map(e=>e?"flex":"none"),alignItems:"center",cursor:"pointer",userSelect:"none",...Sb(e=>this._layout.read(e)?.widgetRect)}},ke(e=>this._data.read(e)===void 0?[]:Bo.div({style:{display:"flex",alignItems:"center",gap:"4px",padding:"0 4px",height:"100%",backgroundColor:this._styles.map(t=>t.background),"--vscodeIconForeground":this._styles.map(t=>t.foreground),border:this._styles.map(t=>`1px solid ${t.border}`),borderRadius:"3px",boxSizing:"border-box",fontSize:"11px",color:this._styles.map(t=>t.foreground)}},[this._style==="cursor"?Bo.elem("div",{style:{borderLeft:"2px solid",height:14,opacity:this._blink.map(t=>t?"0":"1")}}):[ke(()=>Bo.elem("div",{},O2o(this._keybinding))),Bo.elem("div",{style:{lineHeight:this._layout.map(t=>t?.widgetRect.height),marginTop:"-2px"}},["to jump"])]])));this._style=t.style,this._keybinding=this._getKeybinding(Fz);let l=this._widget.keepUpdated(this._store);this._register(this._editor.createOverlayWidget({domNode:l.element,position:So(null),allowEditorOverflow:!1,minContentWidthInPx:So(0)})),this._register(this._editor.setDecorations(ke(c=>{let u=this._data.read(c);return u?[{range:z.fromPositions(u.jumpToPosition,u.jumpToPosition),options:{description:"inline-edit-jump-to-decoration",inlineClassNameAffectsLetterSpacing:!0,showIfCollapsed:!0,after:{content:this._style==="label"?"          ":"  "}}}]:[]})))}_getKeybinding(e,t=Rl.ofCaller()){return e?ui(this,this._contextKeyService.onDidChangeContext,()=>this._keybindingService.lookupKeybinding(e),t):So(void 0)}};mX=I([m(3,Le),m(4,_e),m(5,X)],mX);function N2o(a,i=Rl.ofCaller()){let e=0;return ui(void 0,t=>{e=0;let o=new Dt(()=>{e=(e+1)%a.length,t(null),o.schedule(a[e].durationMs)},0);return o.schedule(0),o},()=>a[e].value,i)}function O2o(a){return ke(i=>Bo.div({style:{},ref:e=>{let t=i.store.add(new Am(e,Po,{disableTitle:!0,...Jx,keybindingLabelShadow:void 0,keybindingLabelForeground:kt(lX),keybindingLabelBackground:"transparent",keybindingLabelBorder:kt(lX),keybindingLabelBottomBorder:void 0}));i.store.add(be(o=>{t.set(a.read(o))}))}}))}var Mke=class extends x{constructor(e,t,o,n,r){super();this._previewTextModel=e;this._properties=t;this._parentEditor=o;this._tabAction=n;this._instantiationService=r;this._previewRef=Bo.ref();this.element=Bo.div({class:"preview",style:{},ref:this._previewRef});this._state=ke(this,e=>{let t=this._properties.read(e);if(!t)return;let o,n;t.nextCursorPosition!==null?(o="original",n=uo.ofLength(t.nextCursorPosition.lineNumber,1)):t.diff[0].innerChanges?.every(s=>s.modifiedRange.isEmpty())?(o="original",n=uo.ofLength(t.diff[0].original.startLineNumber,1)):(o="modified",n=uo.ofLength(t.diff[0].modified.startLineNumber,1));let r=o==="modified"?sK.snapshot(this._previewTextModel):t.target;return{mode:o,visibleLineRange:n,textModel:r,diff:t.diff}});this.updatePreviewEditorEffect=ke(this,e=>{this._previewEditorObs.model.read(e);let t=this._state.read(e)?.visibleLineRange;if(!t)return;let o=[];t.startLineNumber>1&&o.push(new z(1,1,t.startLineNumber-1,1)),t.endLineNumberExclusive<this._previewTextModel.getLineCount()+1&&o.push(new z(t.endLineNumberExclusive,1,this._previewTextModel.getLineCount()+1,1)),this.previewEditor.setHiddenAreas(o,void 0,!0)});this.horizontalContentRangeInPreviewEditorToShow=ke(this,e=>this._getHorizontalContentRangeInPreviewEditorToShow(this.previewEditor,e));this.contentHeight=ke(this,e=>{let t=this._state.read(e);return t?this._previewEditorObs.observeLineHeightForLine(t.visibleLineRange.startLineNumber):So(null)}).flatten();this._editorDecorations=ke(this,e=>{let t=this._state.read(e);if(!t)return;let o={mode:"insertionInline",diff:t.diff},n=[],r=[],s=mo.register({className:"inlineCompletions-char-delete",description:"char-delete",isWholeLine:!1,zIndex:1}),l=mo.register({className:"inlineCompletions-char-insert",description:"char-insert",isWholeLine:!0}),c=mo.register({className:"inlineCompletions-char-insert",description:"char-insert",shouldFillLineOnLineBreak:!0}),u=!0;for(let p of o.diff)if(p.modified.isEmpty||p.original.isEmpty)p.original.isEmpty||n.push({range:p.original.toInclusiveRange(),options:s}),p.modified.isEmpty||r.push({range:p.modified.toInclusiveRange(),options:l});else for(let h of p.innerChanges||[])p.original.contains(h.originalRange.startLineNumber)&&!(u&&h.originalRange.isEmpty())&&n.push({range:h.originalRange,options:{description:"char-delete",shouldFillLineOnLineBreak:!1,className:kke("inlineCompletions-char-delete",h.originalRange.isEmpty()&&"empty"),zIndex:1}}),p.modified.contains(h.modifiedRange.startLineNumber)&&r.push({range:h.modifiedRange,options:c});return{originalDecorations:n,modifiedDecorations:r}});this.previewEditor=this._register(this._createPreviewEditor()),this._parentEditorObs=gs(this._parentEditor),this._register(be(l=>{let c=this._state.read(l)?.textModel||null;c&&this.previewEditor.setModel(c.dangerouslyGetUnderlyingModel())})),this._previewEditorObs=gs(this.previewEditor),this._register(this._previewEditorObs.setDecorations(ke(l=>{let c=this._state.read(l),u=this._editorDecorations.read(l);return(c?.mode==="original"?u?.originalDecorations:u?.modifiedDecorations)??[]}))),!1&&this._register(this._instantiationService.createInstance(mX,this._previewEditorObs,{style:"cursor"},ke(l=>{let c=this._properties.read(l);if(!(!c||!c.nextCursorPosition))return{jumpToPosition:c.nextCursorPosition}}))),this._register(be(l=>{if(!this._properties.read(l))return;let c=this._parentEditorObs.cursorPosition.read(l);c&&this.previewEditor.setPosition(this._previewTextModel.validatePosition(c),"longDistanceHintPreview")})),this._register(be(l=>{let c=this._state.read(l);if(!c)return;let u=c.visibleLineRange.startLineNumber.toString().length;this.previewEditor.updateOptions({lineNumbersMinChars:u+1})})),this._register(this._instantiationService.createInstance(uK,this._previewEditorObs,ke(l=>{let c=this._state.read(l);if(!c)return;let u=this._properties.read(l);if(u)return new dX(u.inlineSuggestInfo,uo.ofLength(c.visibleLineRange.startLineNumber,1),u.model,void 0)}),this._tabAction,So(0),So(!1),Me(this,!1))),this.updatePreviewEditorEffect.recomputeInitiallyAndOnChange(this._store)}_createPreviewEditor(){return this._instantiationService.createInstance(id,this._previewRef.element,{glyphMargin:!1,lineNumbers:"on",minimap:{enabled:!1},guides:{indentation:!1,bracketPairs:!1,bracketPairsHorizontal:!1,highlightActiveIndentation:!1},editContext:!1,rulers:[],padding:{top:0,bottom:0},selectOnLineNumbers:!1,selectionHighlight:!1,columnSelection:!1,overviewRulerBorder:!1,overviewRulerLanes:0,revealHorizontalRightPadding:0,bracketPairColorization:{enabled:!0,independentColorPoolPerBracketType:!1},scrollBeyondLastLine:!1,scrollbar:{vertical:"hidden",horizontal:"hidden",handleMouseWheel:!1},readOnly:!0,wordWrap:"off",wordWrapOverride1:"off",wordWrapOverride2:"off"},{contextKeyValues:{[Ha.inInlineEditsPreviewEditor.key]:!0},contributions:[]},this._parentEditor)}_getHorizontalContentRangeInPreviewEditorToShow(e,t){let o=this._state.read(t);if(!o)return;let n=o.diff,r=this._properties.read(t)?.nextCursorPosition,s=o.visibleLineRange,l=this._previewEditorObs.layoutInfo.read(t),c=GP(this._previewEditorObs,s,t),u;if(r)u=z.fromPositions(r);else if(n[0].innerChanges)u=o.mode==="modified"?n[0].innerChanges[0].modifiedRange:n[0].innerChanges[0].originalRange;else return;let p=F2o(e.getModel(),u,5),h=this._previewEditorObs.getLeftOfPosition(p.getStartPosition(),t),g=this._previewEditorObs.getLeftOfPosition(p.getEndPosition(),t),f=Bn(h,0,c),v=Bn(g,f,c),b=e.getModel().getLineFirstNonWhitespaceColumn(p.startLineNumber),S=this._previewEditorObs.getLeftOfPosition(new ye(p.startLineNumber,b),t),y=new pi(f,v);return{indentationEnd:S,preferredRangeToReveal:y,maxEditorWidth:c+l.contentLeft,contentWidth:c,nonContentWidth:l.contentLeft}}layout(e,t){this.previewEditor.layout(e),this._previewEditorObs.editor.setScrollLeft(t)}};Mke=I([m(4,F)],Mke);function F2o(a,i,e){let t=i.getStartPosition(),o=i.getEndPosition(),n=a.getLineContent(t.lineNumber);function r(u){let p=n.charAt(u-1);return/[a-zA-Z0-9_]/.test(p)}function s(u){let p=n.charAt(u-1);return p===" "||p==="	"}let l=t.column;for(;l>1&&r(l)&&!s(l-1)&&t.column-l<e;)l--;let c=o.column-1;for(;c<=n.length&&r(c)&&!s(c+1)&&c-o.column<e;)c++;return new z(t.lineNumber,t.column,o.lineNumber,c+1)}function dXi(a,i){let e=a.start,t=a.endExclusive,o=Number.MAX_VALUE,n=0;for(let r of i){let s=n+r.width,l=Math.max(e,n),c=Math.min(t,s);l<c&&(o=Math.min(o,r.height)),n=s}return t>n||o===Number.MAX_VALUE?0:o}var j8e=class{constructor(i,e,t){this._lineRangeInfo=i;this.availableSpaceSizes=i.sizes.map((o,n)=>{let r=i.lineRange.startLineNumber+n,s=t(r);return new rX(Math.max(0,e-o.width-s),o.height)}),this.availableSpaceHeightPrefixSums=V2o(this.availableSpaceSizes,o=>o.height),this.availableSpaceSizesTransposed=this.availableSpaceSizes.map(o=>o.transpose())}getWidgetVerticalOutline(i,e,t){let o=i-this._lineRangeInfo.lineRange.startLineNumber,n=this._lineRangeInfo.top+this.availableSpaceHeightPrefixSums[o],r=pi.ofStartAndLength(n,e),{previewEditorMargin:s,widgetPadding:l,widgetBorder:c,lowerBarHeight:u}=t;return r.withMargin(s+l+c).withMargin(0,u)}tryFindWidgetOutline(i,e,t,o){if(!(this._lineRangeInfo.lineRange.length<3))return W2o(this._lineRangeInfo.lineRange.addMargin(-1,-1),i,n=>{let r=this.getWidgetVerticalOutline(n,e,o),s=dXi(r.delta(-this._lineRangeInfo.top),this.availableSpaceSizesTransposed);return s<o.minWidgetWidth?void 0:{horizontalWidgetRange:pi.ofStartAndLength(t-s,s),verticalWidgetRange:r}})}};function uXi(a,i,e,t,o){let n=[],r=a.startLineNumber,s=e,l=[];for(let c=0;c<i.length;c++){let u=a.startLineNumber+c,p=s+l.reduce((g,f)=>g+f.height,0),h=t.editor.getTopForLineNumber(u);c>0&&h!==p&&(n.push({lineRange:uo.ofLength(r,u-r),top:s,sizes:l}),r=u,s=h,l=[]),l.push(i[c])}return n.push({lineRange:uo.ofLength(r,a.endLineNumberExclusive-r),top:s,sizes:l}),ke({owner:"splitIntoContinuousLineRanges"},c=>t.observeTopForLineNumber(a.endLineNumberExclusive-1).read(c)).read(o),n}function W2o(a,i,e){for(let t=0;;t++){let o=i+t;if(o<=a.endLineNumberExclusive){let r=e(o);if(r!==void 0)return r}let n=i-t;if(n>=a.startLineNumber){let r=e(n);if(r!==void 0)return r}if(n<a.startLineNumber&&o>a.endLineNumberExclusive)return}}function V2o(a,i){let e=[0],t=0;for(let o of a)t+=i(o),e.push(t);return e}var B2o=6,mui={EMPTY_SPACE:425,OVERLAY:375},H2o=250,U2o={previewEditorMargin:2,widgetPadding:2,widgetBorder:1,lowerBarHeight:20,minWidgetWidth:H2o},Pke=class extends x{constructor(e,t,o,n,r,s,l,c,u){super();this._editor=e;this._viewState=t;this._previewTextModel=o;this._tabAction=n;this._instantiationService=r;this._themeService=s;this._keybindingService=l;this._modelService=c;this._languageService=u;this.onDidClick=U.None;this._viewWithElement=void 0;this._hintTextPosition=ke(this,e=>{let t=this._viewState.read(e);return t?new ye(t.hint.lineNumber,Number.MAX_SAFE_INTEGER):null});this._lineSizesAroundHintPosition=ke(this,e=>{let t=this._viewState.read(e),o=this._hintTextPosition.read(e);if(!t||!o)return[];let n=this._editorObs.model.read(e);if(!n)return[];let r=uo.ofLength(o.lineNumber,1).addMargin(5,5).intersect(uo.ofLength(1,n.getLineCount()));if(!r)return[];let s=tXi(this._editorObs,r,e),l=this._editorObs.observeTopForLineNumber(r.startLineNumber).read(e);return uXi(r,s,l,this._editorObs,e)});this._isVisibleDelayed=kJt(ke(this,e=>this._viewState.read(e)?.hint.isVisible),(e,t)=>e===!0&&t===!1?200:0);this._previewEditorLayoutInfo=ke(this,e=>{let t=this._viewState.read(e);if(!t||!this._isVisibleDelayed.read(e))return;let o=this._lineSizesAroundHintPosition.read(e);if(o.length===0)return;let n=this._editorObs.scrollTop.read(e),r=this._editorObs.scrollLeft.read(e),s=this._editorObs.layoutInfo.read(e),l=this._previewEditor.contentHeight.read(e),c=this._previewEditor.horizontalContentRangeInPreviewEditorToShow.read(e);if(!l||!c)return;let u=s.contentWidth-s.verticalScrollbarWidth,p=s.contentLeft+u;if(!this._editorObs.cursorLineNumber.read(e))return;let g=U2o,v=l+2,b,S,y=et=>et===t.hint.lineNumber?40:20;for(let et of o){let Ti=new j8e(et,u,y);if(S=Ti,!1){let zi=K2o(new Xh(p,et.top-n),Ti.availableSpaceSizes,"right");$8e(q8e({...zi},this._editor.getDomNode()),e)}if(b=Ti.tryFindWidgetOutline(t.hint.lineNumber,v,p,g),b)break}let w="empty-space";if(!b){w="overlay";let et=Math.min(s.width-s.contentLeft,mui.OVERLAY),Ti=S??new j8e(o[0],u,y);b={horizontalWidgetRange:pi.ofStartAndLength(p-et,et),verticalWidgetRange:Ti.getWidgetVerticalOutline(t.hint.lineNumber+2,v,g).delta(10)}}if(!b)return;let k=Wu.fromRanges(b.horizontalWidgetRange,b.verticalWidgetRange).translateX(-r).translateY(-n);!1&&$8e(q8e({rectAvailableSpace:k},this._editor.getDomNode()),e);let{previewEditorMargin:P,widgetPadding:O,widgetBorder:V,lowerBarHeight:H}=g,G=Math.min(w==="overlay"?mui.OVERLAY:mui.EMPTY_SPACE,c.maxEditorWidth+P+O),$=cXi(k.width,{spaceBefore:{min:0,max:10,priority:1},content:{min:50,rules:[{max:150,priority:2},{max:G,priority:1}]},spaceAfter:{min:10}});if(!$)return null;let J=z2o([$.spaceBefore,$.content,$.spaceAfter],k.left),ae=k.withHorizontalRange(J[0]),he=k.withHorizontalRange(J[1]),oe=k.withHorizontalRange(J[2]);!1&&$8e(q8e({spaceBeforeRect:ae,widgetRect:he,spaceAfterRect:oe},this._editor.getDomNode()),e);let Ce=he.withMargin(-O-V-P).withMargin(0,0,-H,0);!1&&$8e(q8e({previewEditorRect:Ce},this._editor.getDomNode()),e);let ze=Ce.width-c.nonContentWidth,De=ze*.8,Oe=c.preferredRangeToReveal.intersect(pi.ofStartAndLength(c.preferredRangeToReveal.start,De))??c.preferredRangeToReveal,pt=G2o(c.indentationEnd,ze,Oe);return{codeEditorSize:Ce.getSize(),codeScrollLeft:r,contentLeft:s.contentLeft,widgetRect:he,previewEditorMargin:P,widgetPadding:O,widgetBorder:V,lowerBarHeight:H,desiredPreviewEditorScrollLeft:pt.newScrollPosition}});this._view=Bo.div({class:"inline-edits-view",style:{position:"absolute",overflow:"visible",top:"0px",left:"0px",display:ke(this,e=>this._previewEditorLayoutInfo.read(e)?"block":"none")}},[ke(this,e=>[this._widgetContent])]);this._widgetContent=ke(this,e=>Bo.div({class:["inline-edits-long-distance-hint-widget","show-file-icons"],style:{position:"absolute",overflow:"hidden",cursor:"pointer",background:kt(Su),padding:this._previewEditorLayoutInfo.map(t=>t?.widgetPadding),boxSizing:"border-box",borderRadius:B2o,border:ke(t=>`${this._previewEditorLayoutInfo.read(t)?.widgetBorder}px solid ${this._styles.read(t).border}`),display:"flex",flexDirection:"column",opacity:ke(t=>this._viewState.read(t)?.hint.isVisible?"1":"0"),transition:"opacity 200ms ease-in-out",...Sb(t=>this._previewEditorLayoutInfo.read(t)?.widgetRect)},onmousedown:t=>{t.preventDefault()},onclick:()=>{this._viewState.read(void 0)?.model.jump()}},[Bo.div({class:["editorContainer"],style:{overflow:"hidden",padding:this._previewEditorLayoutInfo.map(t=>t?.previewEditorMargin),background:this._styles.map(t=>t.background),pointerEvents:"none"}},[ke(this,t=>this._previewEditor.element)]),Bo.div({class:"bar",style:{color:kt(Fje),pointerEvents:"none",margin:"0 4px",height:this._previewEditorLayoutInfo.map(t=>t?.lowerBarHeight),display:"flex",justifyContent:"space-between",alignItems:"center"}},[ke(this,t=>{let o=[],n=this._viewState.read(t);if(!n)return o;let r=this._editorObs.model.read(t)?.uri,s=n.target.uri,l=s&&(!r||s.toString()!==r.toString());if(l){let g=He(s),f=aa(this._modelService,this._languageService,s,0);o.push(Bo.div({class:"target-file",style:{display:"flex",alignItems:"center",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},[Bo.elem("span",{class:f,style:{flexShrink:"0",marginRight:"4px"}}),g]))}else{let g=this._originalOutlineSource.read(t),f=this._originalTargetLineNumber.read(t),v=g?.getAt(f,t).slice(0,1)??[],b=[];if(v.length>0)for(let S=0;S<v.length;S++){let y=v[S],w=_m.toIcon(y.kind);b.push(Bo.div({class:"breadcrumb-item",style:{display:"flex",alignItems:"center",flex:"1 1 auto",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}},[Sn(w),"\xA0",y.name,...S===v.length-1?[]:[Sn(R.chevronRight)]]))}o.push(Bo.div({class:"outline-elements",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},b))}let c=this._originalTargetLineNumber.read(t),u=l?R.arrowRight:n.hint.lineNumber<c?R.arrowDown:R.arrowUp,p=this._keybindingService.lookupKeybinding(dCt),h=l?"Go to file":"Go to suggestion";return p&&p.getLabel()==="Tab"&&(h=l?"Tab to open":"Tab to jump"),o.push(Bo.div({class:"go-to-label",style:{position:"relative",display:"flex",alignItems:"center",flex:"0 0 auto",paddingLeft:"6px"}},[h,"\xA0",Sn(u)])),o})])]));this._originalTargetLineNumber=ke(this,e=>{let t=this._viewState.read(e);return t?t.edit.action?.kind==="jumpTo"?t.edit.action.position.lineNumber:t.diff[0]?.original.startLineNumber??-1:-1});this._originalOutlineSource=UI(this,e=>{let t=this._editorObs.model.read(e),o=QO._breadcrumbsSourceFactory.read(e);return!t||!o?void 0:o(t,this._instantiationService)});this._styles=ke(p=>{let h=this._tabAction.read(p),g=sX(CO,this._themeService).read(p),f=ui(this._themeService.onDidColorThemeChange,()=>{let b=this._themeService.getColorTheme();return b.type==="hcDark"||b.type==="hcLight"}).read(p),v;if(f)v=g;else{let b;switch(h){case"inactive":b=yke;break;case"jump":b=dK;break;case"accept":b=wke;break}v=vb(b,this._themeService).read(p)}return{border:v.toString(),background:Q_(this._viewState.map(b=>b?.editorType??"textEditor").read(p))}}),this._editorObs=gs(this._editor),this._previewEditor=this._register(this._instantiationService.createInstance(Mke,this._previewTextModel,ke(p=>{let h=this._viewState.read(p);if(h)return{diff:h.diff,model:h.model,inlineSuggestInfo:h.inlineSuggestInfo,nextCursorPosition:h.nextCursorPosition,target:h.target}}),this._editor,this._tabAction)),this._viewWithElement=this._view.keepUpdated(this._store),this._register(this._editorObs.createOverlayWidget({domNode:this._viewWithElement.element,position:So(null),allowEditorOverflow:!1,minContentWidthInPx:So(0)})),this._widgetContent.get().keepUpdated(this._store),this._register(be(p=>{let h=this._previewEditorLayoutInfo.read(p);h&&this._previewEditor.layout(h.codeEditorSize.toDimension(),h.desiredPreviewEditorScrollLeft)})),this._isVisibleDelayed.recomputeInitiallyAndOnChange(this._store)}get isHovered(){return this._widgetContent.get().didMouseMoveDuringHover}};Pke=I([m(4,F),m(5,Le),m(6,_e),m(7,Tt),m(8,_t)],Pke);function z2o(a,i=0){let e=[],t=i;for(let o of a)e.push(new pi(t,t+o)),t+=o;return e}function K2o(a,i,e="left"){let t=[],o=0;for(let n of i)t.push(Wu.fromLeftTopWidthHeight(a.x+(e==="left"?0:-n.width),a.y+o,n.width,n.height)),o+=n.height;return t}function G2o(a,i,e){let t=new pi(a,a+i);return t.containsRange(e)?{newScrollPosition:a}:e.length>i?{newScrollPosition:e.start}:e.endExclusive>t.endExclusive?{newScrollPosition:e.endExclusive-i}:e.start<t.start?{newScrollPosition:e.start}:{newScrollPosition:a}}var Ake=0,Q8e=0,q2o=!1,dB=1,$2o=1,j2o=3,R5=bb,hui=20,pXi=12,cde=class extends x{constructor(e,t,o,n,r,s,l,c){super();this._editor=e;this._edit=t;this._previewTextModel=o;this._uiState=n;this._tabAction=r;this._instantiationService=s;this._themeService=l;this._userInteractionService=c;this._onDidClick=this._register(new E);this.onDidClick=this._onDidClick.event;this._editorObs=gs(this._editor),this._display=ke(this,h=>this._uiState.read(h)?"block":"none"),this.previewRef=Bo.ref();let u=this._uiState.map(h=>h?.editorType==="diffEditor"?j2o:$2o);this._editorContainer=Bo.div({class:["editorContainer"],style:{position:"absolute",overflow:"hidden",cursor:"pointer"},onmousedown:h=>{h.preventDefault()},onclick:h=>{this._onDidClick.fire(CR.create(h))}},[Bo.div({class:"preview",style:{pointerEvents:"none"},ref:this.previewRef})]).keepUpdated(this._store),this.isHovered=this._userInteractionService.createHoverTracker(this._editorContainer.element,this._store),this.previewEditor=this._register(this._instantiationService.createInstance(id,this.previewRef.element,{glyphMargin:!1,lineNumbers:"off",minimap:{enabled:!1},guides:{indentation:!1,bracketPairs:!1,bracketPairsHorizontal:!1,highlightActiveIndentation:!1},editContext:!1,rulers:[],padding:{top:0,bottom:0},folding:!1,selectOnLineNumbers:!1,selectionHighlight:!1,columnSelection:!1,overviewRulerBorder:!1,overviewRulerLanes:0,lineDecorationsWidth:0,lineNumbersMinChars:0,revealHorizontalRightPadding:0,bracketPairColorization:{enabled:!0,independentColorPoolPerBracketType:!1},scrollBeyondLastLine:!1,scrollbar:{vertical:"hidden",horizontal:"hidden",handleMouseWheel:!1},readOnly:!0,wordWrap:"off",wordWrapOverride1:"off",wordWrapOverride2:"off"},{contextKeyValues:{[Ha.inInlineEditsPreviewEditor.key]:!0},contributions:[]},this._editor)),this._previewEditorObs=gs(this.previewEditor),this._activeViewZones=[],this._updatePreviewEditor=ke(this,h=>{this._editorContainer.readEffect(h),this._previewEditorObs.model.read(h),this._display.read(h),this._nonOverflowView&&(this._nonOverflowView.element.style.display=this._display.read(h));let g=this._uiState.read(h),f=this._edit.read(h);if(!g||!f)return;let v=f.originalLineRange,b=[];v.startLineNumber>1&&b.push(new z(1,1,v.startLineNumber-1,1)),v.startLineNumber+g.newTextLineCount<this._previewTextModel.getLineCount()+1&&b.push(new z(v.startLineNumber+g.newTextLineCount,1,this._previewTextModel.getLineCount()+1,1)),this.previewEditor.setHiddenAreas(b,void 0,!0);let S=[...this._activeViewZones];this._activeViewZones=[];let y=v.endLineNumberExclusive-v.startLineNumber-g.newTextLineCount;this.previewEditor.changeViewZones(w=>{S.forEach(k=>w.removeZone(k)),y>0&&this._activeViewZones.push(w.addZone({afterLineNumber:v.startLineNumber+g.newTextLineCount-1,heightInLines:y,showInHiddenAreas:!0,domNode:_("div.diagonal-fill.inline-edits-view-zone")}))})}),this._previewEditorWidth=ke(this,h=>{let g=this._edit.read(h);return g?(this._updatePreviewEditor.read(h),GP(this._previewEditorObs,g.modifiedLineRange,h)):0}),this._cursorPosIfTouchesEdit=ke(this,h=>{let g=this._editorObs.cursorPosition.read(h),f=this._edit.read(h);if(!(!f||!g))return f.modifiedLineRange.contains(g.lineNumber)?g:void 0}),this._originalStartPosition=ke(this,h=>{let g=this._edit.read(h);return g?new ye(g.originalLineRange.startLineNumber,1):null}),this._originalEndPosition=ke(this,h=>{let g=this._edit.read(h);return g?new ye(g.originalLineRange.endLineNumberExclusive,1):null}),this._originalVerticalStartPosition=this._editorObs.observePosition(this._originalStartPosition,this._store).map(h=>h?.y),this._originalVerticalEndPosition=this._editorObs.observePosition(this._originalEndPosition,this._store).map(h=>h?.y),this._originalDisplayRange=this._edit.map(h=>h?.displayRange),this._editorMaxContentWidthInRange=ke(this,h=>{let g=this._originalDisplayRange.read(h);return g?(this._editorObs.versionId.read(h),Bf(this,(f,v)=>{let b=GP(this._editorObs,g,f);return Math.max(b,v??0)})):So(0)}).map((h,g)=>h.read(g));let p=rXi(this._editor,this._store);this._previewEditorLayoutInfo=ke(this,h=>{let g=this._edit.read(h);if(!g||!this._uiState.read(h))return null;let v=g.originalLineRange,b=this._editorObs.scrollLeft.read(h),S=this._editorMaxContentWidthInRange.read(h),y=this._editorObs.layoutInfo.read(h),w=this._previewEditorWidth.read(h),k=y.contentWidth-y.verticalScrollbarWidth,T=p.read(h),P=y.contentLeft+y.contentWidth+T.left,O=Re(this._editor.getContainerDomNode()).innerWidth-P,V=Re(this._editor.getContainerDomNode()).innerWidth-T.right,H=Math.min(y.contentWidth*.3,w,100),G=0,$=G+O,J=this._cursorPosIfTouchesEdit.read(h),ae=Math.max(k+b-G-Math.max(0,H-$),Math.min(J?iXi(this._editorObs,J,h)+50:0,k+b)),he=Math.min(S+hui,ae),oe=S+hui+w+70,de=ae-he,Ce,xe;he>b?(Ce=0,xe=y.contentLeft+he-b):(Ce=b-he,xe=y.contentLeft);let ze=this._originalVerticalStartPosition.read(h)??this._editor.getTopForLineNumber(v.startLineNumber)-this._editorObs.scrollTop.read(h),De=this._originalVerticalEndPosition.read(h)??this._editor.getBottomForLineNumber(v.endLineNumberExclusive-1)-this._editorObs.scrollTop.read(h),Oe=y.contentLeft-b,pt=Wu.fromLeftTopRightBottom(Oe,ze,xe,De),et=pt.height===0;et||(pt=pt.withMargin(Q8e,Ake));let Ht=this._previewEditorObs.observeLineHeightsForLineRange(g.modifiedLineRange).read(h).reduce((yo,Mr)=>yo+Mr,0),zi=De-ze,Vo=Math.max(zi,Ht),sn=de===0,_n=0,mn=Math.min(w+pXi,V+y.width-y.contentLeft-_n),hn=Wu.fromLeftTopWidthHeight(pt.right+_n,ze,mn,Vo);return et?hn=hn.withMargin(Q8e,Ake).translateY(Q8e):hn=hn.withMargin(Q8e,Ake).translateX(Ake+dB),{codeRect:pt,editRect:hn,codeScrollLeft:b,contentLeft:y.contentLeft,isInsertion:et,maxContentWidth:oe,shouldShowShadow:sn,desiredPreviewEditorScrollLeft:Ce,previewEditorWidth:mn}}),this._stickyScrollController=fb.get(this._editorObs.editor),this._stickyScrollHeight=this._stickyScrollController?ui(this._stickyScrollController.onDidChangeStickyScrollHeight,()=>this._stickyScrollController.stickyScrollWidgetHeight):So(0),this._shouldOverflow=ke(this,h=>{if(!q2o)return!1;let g=this._edit.read(h)?.originalLineRange;if(!g)return!1;let f=this._stickyScrollHeight.read(h);return!(this._editor.getTopForLineNumber(g.startLineNumber)-this._editorObs.scrollTop.read(h)<=f||this._editor.getTopForLineNumber(g.endLineNumberExclusive)-this._editorObs.scrollTop.read(h)>=this._editorObs.layoutInfo.read(h).height)}),this._originalBackgroundColor=ui(this,this._themeService.onDidColorThemeChange,()=>this._themeService.getColorTheme().getColor(aX)??We.transparent),this._editorBackgroundColor=this._uiState.map(h=>Q_(h?.editorType??"textEditor")),this._backgroundSvg=Bo.svg({transform:"translate(-0.5 -0.5)",style:{overflow:"visible",pointerEvents:"none",position:"absolute"}},[Bo.svgElem("path",{class:"rightOfModifiedBackgroundCoverUp",d:ke(this,h=>{let g=this._previewEditorLayoutInfo.read(h);if(!(!g||this._originalBackgroundColor.read(h).isTransparent()))return new lde().moveTo(g.codeRect.getRightTop()).lineTo(g.codeRect.getRightTop().deltaX(1e3)).lineTo(g.codeRect.getRightBottom().deltaX(1e3)).lineTo(g.codeRect.getRightBottom()).build()}),style:{fill:this._editorBackgroundColor}})]).keepUpdated(this._store),this._originalOverlay=Bo.div({style:{pointerEvents:"none",display:this._previewEditorLayoutInfo.map(h=>h?.isInsertion?"none":"block")}},ke(this,h=>{let g=YE(this._previewEditorLayoutInfo).read(h);if(!g)return;let f=this._editorBackgroundColor.read(h),v=u.read(h),b=cX(this._tabAction).map(G=>`${dB}px solid ${kt(G)}`),S=`${dB+v}px solid ${f}`,y=g.read(h).codeScrollLeft!==0,w=g.map(G=>G.codeRect.bottom<G.editRect.bottom),k=R5*2+dB*2,T=g.map(G=>Wu.fromLeftTopRightBottom(G.contentLeft-R5-dB,G.codeRect.top,G.contentLeft,G.codeRect.bottom+k)).read(h),P=new pi(T.left,Number.MAX_SAFE_INTEGER),O=g.map(G=>G.codeRect.intersectHorizontal(P)),V=O.map(G=>G.withMargin(v,0,v,v).intersectHorizontal(P)),H=O.map(G=>Wu.fromLeftTopWidthHeight(G.right-k+dB,G.bottom-dB,k,k).intersectHorizontal(P));return[Bo.div({class:"originalSeparatorSideBySide",style:{...V.read(h).toStyles(),boxSizing:"border-box",borderRadius:`${R5}px 0 0 ${R5}px`,borderTop:S,borderBottom:S,borderLeft:y?"none":S}}),Bo.div({class:"originalOverlaySideBySide",style:{...O.read(h).toStyles(),boxSizing:"border-box",borderRadius:`${R5}px 0 0 ${R5}px`,borderTop:b,borderBottom:b,borderLeft:y?"none":b,backgroundColor:kt(aX)}}),Bo.div({class:"originalCornerCutoutSideBySide",style:{pointerEvents:"none",display:w.map(G=>G?"block":"none"),...H.read(h).toStyles()}},[Bo.div({class:"originalCornerCutoutBackground",style:{position:"absolute",top:"0px",left:"0px",width:"100%",height:"100%",backgroundColor:vb(aX,this._themeService).map(G=>G.toString())}}),Bo.div({class:"originalCornerCutoutBorder",style:{position:"absolute",top:"0px",left:"0px",width:"100%",height:"100%",boxSizing:"border-box",borderTop:b,borderRight:b,borderRadius:"0 100% 0 0",backgroundColor:f}})]),Bo.div({class:"originalOverlaySideBySideHider",style:{...T.toStyles(),backgroundColor:f}})]})).keepUpdated(this._store),this._modifiedOverlay=Bo.div({style:{pointerEvents:"none"}},ke(this,h=>{let g=YE(this._previewEditorLayoutInfo).read(h);if(!g)return;let f=g.map(O=>O.codeRect.bottom<O.editRect.bottom),v=this._editorBackgroundColor.read(h),b=u.read(h),S=f.map(O=>`0 ${R5}px ${R5}px ${O?R5:0}px`),y=vb(_5(this._tabAction),this._themeService).map(O=>`1px solid ${O.toString()}`),w=`${dB+b}px solid ${v}`,k=g.map(O=>O.editRect.withMargin(0,dB)),T=k.map(O=>O.withMargin(b,b,b,0)),P=ke(this,O=>{let V=k.read(O),H=g.read(O);return!H.isInsertion||H.contentLeft>=V.left?Wu.fromLeftTopWidthHeight(V.left,V.top,0,0):new Wu(H.contentLeft,V.top,V.left,V.top+dB*2)});return[Bo.div({class:"modifiedInsertionSideBySide",style:{...P.read(h).toStyles(),backgroundColor:_5(this._tabAction).map(O=>kt(O))}}),Bo.div({class:"modifiedSeparatorSideBySide",style:{...T.read(h).toStyles(),borderRadius:S,borderTop:w,borderBottom:w,borderRight:w,boxSizing:"border-box"}}),Bo.div({class:"modifiedOverlaySideBySide",style:{...k.read(h).toStyles(),borderRadius:S,border:y,boxSizing:"border-box",backgroundColor:kt(Gkt)}})]})).keepUpdated(this._store),this._nonOverflowView=Bo.div({class:"inline-edits-view",style:{position:"absolute",overflow:"visible",top:"0px",left:"0px",display:this._display}},[this._backgroundSvg,ke(this,h=>this._shouldOverflow.read(h)?[]:[this._editorContainer,this._originalOverlay,this._modifiedOverlay])]).keepUpdated(this._store),this._register(this._editorObs.createOverlayWidget({domNode:this._nonOverflowView.element,position:So(null),allowEditorOverflow:!1,minContentWidthInPx:ke(this,h=>{let g=this._previewEditorLayoutInfo.read(h)?.maxContentWidth;return g===void 0?0:g})})),this.previewEditor.setModel(this._previewTextModel),this._register(be(h=>{let g=this._previewEditorLayoutInfo.read(h);if(!g)return;let f=g.editRect.withMargin(-Q8e,-Ake);this.previewEditor.layout({height:f.height,width:g.previewEditorWidth+15}),this._editorContainer.element.style.top=`${f.top}px`,this._editorContainer.element.style.left=`${f.left}px`,this._editorContainer.element.style.width=`${g.previewEditorWidth+Ake}px`})),this._register(be(h=>{let g=this._previewEditorLayoutInfo.read(h);g&&this._previewEditorObs.editor.setScrollLeft(g.desiredPreviewEditorScrollLeft)})),this._updatePreviewEditor.recomputeInitiallyAndOnChange(this._store)}static fitsInsideViewport(e,t,o,n){let r=gs(e),s=r.layoutInfoWidth.read(n),l=r.layoutInfoContentLeft.read(n),c=e.getLayoutInfo().verticalScrollbarWidth,u=r.layoutInfoMinimap.read(n).minimapLeft!==0?r.layoutInfoMinimap.read(n).minimapWidth:0,p=GP(r,o.displayRange,void 0),h=o.lineEdit.newLines.reduce((v,b)=>Math.max(v,K8e(b,e,t)),0),g=hui,f=pXi+2*dB;return p+h+g+f<s-l-c-u}};cde=I([m(5,F),m(6,Le),m(7,_C)],cde);var Xkt=class{constructor(i,e,t){this.edit=i;this.editorType=e;this.alternativeAction=t}equals(i){return this.edit.equals(i.edit)&&this.alternativeAction===i.alternativeAction}},ck=1,mXi="word-replacement-view-overlay",hXi="word-replacement-view-widget",gXi="word-replacement-view-replacement",gui="word-replacement-view-rename",M5=class extends x{constructor(e,t,o,n,r,s,l,c){super();this._editor=e;this._viewData=t;this._tabAction=o;this._languageService=n;this._themeService=r;this._keybindingService=s;this._hoverService=l;this._userInteractionService=c;this._onDidClick=this._register(new E);this.onDidClick=this._onDidClick.event;this._start=this._editor.observePosition(So(this._viewData.edit.range.getStartPosition()),this._store),this._end=this._editor.observePosition(So(this._viewData.edit.range.getEndPosition()),this._store),this._line=document.createElement("div"),this._primaryElement=Me(this,null),this._secondaryElement=Me(this,null),this.isHovered=ke(this,g=>{let f=this._primaryElement.read(g);return f?this._userInteractionService.createHoverTracker(f.element,g.store).read(g):!1}),this._renderTextEffect=ke(this,g=>{let f=this._editor.model.get(),v=f.getLineContent(this._viewData.edit.range.startLineNumber),b=ed.replace(new pi(this._viewData.edit.range.startColumn-1,this._viewData.edit.range.endColumn-1),this._viewData.edit.text),S=b.replace(v),y=f.tokenization.tokenizeLinesAt(this._viewData.edit.range.startLineNumber,[S])?.[0],w;y?w=LV.fromLineTokens(y).slice(b.getRangeAfterReplace()).toLineTokens(this._viewData.edit.text,this._languageService.languageIdCodec):w=Zc.createEmpty(this._viewData.edit.text,this._languageService.languageIdCodec);let k=lR(new NE([w]),OE.fromEditor(this._editor.editor).withSetWidth(!1).withScrollBeyondLastColumn(0),[],this._line,!0);this._line.style.width=`${k.minWidthInPx}px`});let u=this._editor.observeLineHeightForPosition(this._viewData.edit.range.getStartPosition()),p=R$e(this._viewData.alternativeAction?.count??new Promise(g=>g(void 0))).map(g=>g.value),h=ke(this,g=>this._userInteractionService.readModifierKeyStatus(this._editor.editor.getDomNode(),g).shiftKey);this._layout=ke(this,g=>{this._renderTextEffect.read(g);let f=this._start.read(g),v=this._end.read(g);if(!f||!v||f.x>v.x||f.y>v.y)return;let b=u.read(g),S=this._editor.scrollLeft.read(g),y=this._editor.getOption(59).read(g).typicalHalfwidthCharacterWidth,w=3*y,k=4,T=new Xh(w,k),P;if(this._viewData.alternativeAction){let $=this._viewData.alternativeAction.label,J=p.read(g),ae=h.read(g),he=J!==void 0?J===1?d(1380,null,$):d(1381,null,$,J):$,oe=d(1382,null,"[shift]");P={label:J!==void 0&&ae?he:$,tooltip:he?`${he}
${oe}`:void 0,icon:void 0,count:J,keybinding:this._keybindingService.lookupKeybinding(yce),active:h}}let O=Wu.fromPoints(f,v).withHeight(b).translateX(-S),V=Wu.fromPointSize(O.getLeftBottom().add(T),new Xh(this._viewData.edit.text.length*y,O.height)),H=V.withWidth(V.width+(P?P.label.length*y+8+4+12:0)),G=H.withLeft(O.left);return{alternativeAction:P,originalLine:O,codeLine:V,modifiedLine:H,lowerBackground:G,lineHeight:b}}),this.minEditorScrollHeight=ke(this,g=>{let f=YE(this._layout).read(g);return f?f.read(g).modifiedLine.bottom+ck+this._editor.editor.getScrollTop():0}),this._root=Bo.div({class:"word-replacement"},[ke(this,g=>{let f=YE(this._layout).read(g);if(!f)return[];let v=cX(this._tabAction).map(J=>kt(J)).read(g),b=_5(this._tabAction).map(J=>kt(J)).read(g);this._line.style.lineHeight=`${f.read(g).modifiedLine.height+2*ck}px`;let S=So(!1),y=f.map(J=>J.alternativeAction),w=ke(J=>(y.read(J)?.active.read(J)??!1)||S.read(J)),T=ui(this._themeService.onDidColorThemeChange,()=>{let J=this._themeService.getColorTheme();return J.type==="hcDark"||J.type==="hcLight"}).read(g)?sX(bi,this._themeService).read(g):null,P={borderColor:T?T.toString():b,backgroundColor:kt(QYi),color:"",opacity:"1"},O={borderColor:T?T.toString():kt(mF),backgroundColor:kt(dK),color:kt(lX),opacity:"1"},V={borderColor:T?T.toString():sX(_7,this._themeService).map(J=>J.transparent(.2).toString()).read(g),backgroundColor:Q_(this._viewData.editorType),color:"",opacity:"0.7"},H=Q_(this._viewData.editorType),G=ke(this,J=>(w.read(J),P)),$=ke(this,J=>w.read(J)?O:V);return[Bo.div({id:mXi,style:{position:"absolute",...Sb(J=>xke(this._editor).read(J)),overflow:"hidden",pointerEvents:"none"}},[Bo.div({style:{position:"absolute",...Sb(J=>f.read(J).lowerBackground.withMargin(ck,2*ck,ck,0)),background:H,cursor:"pointer",pointerEvents:"auto"},onmousedown:J=>this._mouseDown(J)}),Bo.div({id:hXi,style:{position:"absolute",...Sb(J=>f.read(J).modifiedLine.withMargin(ck,2*ck)),width:void 0,pointerEvents:"auto",boxSizing:"border-box",borderRadius:`${bb}px`,background:H,display:"flex",justifyContent:"left",outline:`2px solid ${H}`},onmousedown:J=>this._mouseDown(J)},[Bo.div({id:gXi,style:{fontFamily:this._editor.getOption(58),fontSize:this._editor.getOption(61),fontWeight:this._editor.getOption(62),width:Sb(J=>f.read(J).codeLine.withMargin(ck,2*ck)).width,borderRadius:`${bb}px`,border:G.map(J=>`${ck}px solid ${J.borderColor}`),boxSizing:"border-box",padding:`${ck}px`,opacity:G.map(J=>J.opacity),background:G.map(J=>J.backgroundColor),display:"flex",justifyContent:"left",alignItems:"center",pointerEvents:"auto",cursor:"pointer"},obsRef:J=>{this._primaryElement.set(J,void 0)}},[this._line]),ke(this,J=>{let ae=y.read(J);if(!ae)return;let he=document.createElement("div");return J.store.add(new Am(he,Po,{...j4e,disableTitle:!0})).set(ae.keybinding),Bo.div({id:gui,style:{position:"relative",borderRadius:`${bb}px`,borderTop:`${ck}px solid`,borderRight:`${ck}px solid`,borderBottom:`${ck}px solid`,borderLeft:`${ck}px solid`,borderColor:$.map(de=>de.borderColor),opacity:$.map(de=>de.opacity),color:$.map(de=>de.color),display:"flex",justifyContent:"center",alignItems:"center",padding:"0 4px 0 1px",marginLeft:"4px",background:$.map(de=>de.backgroundColor),cursor:"pointer",textWrap:"nowrap"},class:"inline-edit-alternative-action-label",obsRef:de=>{this._secondaryElement.set(de,void 0)},ref:de=>{ae.tooltip&&J.store.add(this._hoverService.setupDelayedHoverAtMouse(de,{content:ae.tooltip,appearance:{compact:!0}}))}},[he,_("div.inline-edit-alternative-action-label-separator"),ae.icon?Sn(ae.icon):void 0,ae.label])})]),Bo.div({style:{position:"absolute",...Sb(J=>f.read(J).originalLine.withMargin(ck)),boxSizing:"border-box",borderRadius:`${bb}px`,border:`${ck}px solid ${v}`,background:kt($Yi),pointerEvents:"none"}},[]),Bo.svg({width:11,height:14,viewBox:"0 0 11 14",fill:"none",style:{position:"absolute",left:f.map(J=>J.modifiedLine.left-16),top:f.map(J=>J.modifiedLine.top+Math.round((J.lineHeight-14-5)/2)),pointerEvents:"none"},onmousedown:J=>this._mouseDown(J)},[Bo.svgElem("path",{d:"M1 0C1 2.98966 1 5.92087 1 8.49952C1 9.60409 1.89543 10.5 3 10.5H10.5",stroke:kt(_7)}),Bo.svgElem("path",{d:"M6 7.5L9.99999 10.49998L6 13.5",stroke:kt(_7)})])])]})]).keepUpdated(this._store),this._register(this._editor.createOverlayWidget({domNode:this._root.element,minContentWidthInPx:So(0),position:So({preference:{top:0,left:0}}),allowEditorOverflow:!1}))}static{this.MAX_LENGTH=100}_mouseDown(e){let t=Q2o(e.target,new Set([hXi,gXi,gui,mXi]));t&&(e.preventDefault(),this._onDidClick.fire(CR.create(e,t===gui)))}};M5=I([m(3,_t),m(4,Le),m(5,_e),m(6,nt),m(7,_C)],M5);function Q2o(a,i){let e=a;for(;e;){if(i.has(e.id))return e.id;e=e.parentElement}return null}var Jkt=class extends x{constructor(e,t,o){super();this._originalEditor=e;this._state=t;this._modifiedTextModel=o;this._onDidClick=this._register(new E);this.onDidClick=this._onDidClick.event;this.isHovered=gs(this._originalEditor).isTargetHovered(r=>r.target.type===6&&r.target.detail.injectedText?.options.attachedData instanceof Y8e&&r.target.detail.injectedText.options.attachedData.owner===this,this._store),this._tokenizationFinished=X2o(this._modifiedTextModel),this._decorations=ke(this,r=>{let s=this._state.read(r);if(!s)return;let l=s.modifiedText,c=s.mode==="insertionInline",u=s.diff.length===1&&s.diff[0].innerChanges?.length===1,p=!0,h=[],g=[],f=mo.register({className:"inlineCompletions-line-insert",description:"line-insert",isWholeLine:!0,marginClassName:"gutter-insert"}),v=mo.register({className:"inlineCompletions-line-delete",description:"line-delete",isWholeLine:!0,marginClassName:"gutter-delete"}),b=mo.register({className:"inlineCompletions-char-delete",description:"char-delete",isWholeLine:!1,zIndex:1}),S=mo.register({className:"inlineCompletions-char-insert",description:"char-insert",isWholeLine:!0}),y=mo.register({className:"inlineCompletions-char-insert",description:"char-insert",shouldFillLineOnLineBreak:!0}),w=mo.register({className:"inlineCompletions-char-insert diff-range-empty",description:"char-insert diff-range-empty"}),k=mo.register({className:"inlineCompletions-original-lines",description:"inlineCompletions-original-lines",isWholeLine:!1,shouldFillLineOnLineBreak:!0}),T=s.mode!=="sideBySide"&&s.mode!=="deletion"&&s.mode!=="insertionInline"&&s.mode!=="lineReplacement",P=s.mode==="lineReplacement";for(let O of s.diff)if(T&&(O.original.isEmpty||h.push({range:O.original.toInclusiveRange(),options:v}),O.modified.isEmpty||g.push({range:O.modified.toInclusiveRange(),options:f})),O.modified.isEmpty||O.original.isEmpty)O.original.isEmpty||h.push({range:O.original.toInclusiveRange(),options:b}),O.modified.isEmpty||g.push({range:O.modified.toInclusiveRange(),options:S});else{let V=c&&fXi(O);for(let H of O.innerChanges||[]){if(O.original.contains(H.originalRange.startLineNumber)&&!(P&&H.originalRange.isEmpty())){let G=this._originalEditor.getModel()?.getValueInRange(H.originalRange,1);h.push({range:H.originalRange,options:{description:"char-delete",shouldFillLineOnLineBreak:!1,className:kke("inlineCompletions-char-delete",H.originalRange.isSingleLine()&&s.mode==="insertionInline"&&"single-line-inline",H.originalRange.isEmpty()&&"empty",(H.originalRange.isEmpty()&&u||s.mode==="deletion"&&G===`
`)&&p&&!V&&"diff-range-empty"),inlineClassName:V?kke("strike-through","inlineCompletions"):null,zIndex:1}})}if(O.modified.contains(H.modifiedRange.startLineNumber)&&g.push({range:H.modifiedRange,options:H.modifiedRange.isEmpty()&&p&&!V&&u?w:y}),V){let G=l.getValueOfRange(H.modifiedRange),$=G.length>3?[{text:G.slice(0,1),extraClasses:["start"],offsetRange:new pi(H.modifiedRange.startColumn-1,H.modifiedRange.startColumn)},{text:G.slice(1,-1),extraClasses:[],offsetRange:new pi(H.modifiedRange.startColumn,H.modifiedRange.endColumn-2)},{text:G.slice(-1),extraClasses:["end"],offsetRange:new pi(H.modifiedRange.endColumn-2,H.modifiedRange.endColumn-1)}]:[{text:G,extraClasses:["start","end"],offsetRange:new pi(H.modifiedRange.startColumn-1,H.modifiedRange.endColumn)}];this._tokenizationFinished.read(r);let J=this._modifiedTextModel.tokenization.getLineTokens(H.modifiedRange.startLineNumber);for(let{text:ae,extraClasses:he,offsetRange:oe}of $)h.push({range:z.fromPositions(H.originalRange.getEndPosition()),options:{description:"inserted-text",before:{tokens:J.getTokensInRange(oe),content:ae,inlineClassName:kke("inlineCompletions-char-insert",H.modifiedRange.isSingleLine()&&s.mode==="insertionInline"&&"single-line-inline",...he),cursorStops:3,attachedData:new Y8e(this)},zIndex:2,showIfCollapsed:!0}})}}}if(s.editorType==="diffEditor")for(let O of s.diff)O.original.isEmpty||h.push({range:O.original.toExclusiveRange(),options:k});return{originalDecorations:h,modifiedDecorations:g}}),this._register(gs(this._originalEditor).setDecorations(this._decorations.map(r=>r?.originalDecorations??[])));let n=this._state.map(r=>r?.modifiedCodeEditor);this._register(il((r,s)=>{let l=n.read(r);l&&s.add(gs(l).setDecorations(this._decorations.map(c=>c?.modifiedDecorations??[])))})),this._register(this._originalEditor.onMouseUp(r=>{if(r.target.type!==6)return;let s=r.target.detail.injectedText?.options.attachedData;s instanceof Y8e&&s.owner===this&&this._onDidClick.fire(new CR(r.event))}))}static supportsInlineDiffRendering(e){return fXi(e)}},Y8e=class{constructor(i){this.owner=i}};function fXi(a){return a.innerChanges?a.innerChanges.every(i=>E4e(i.modifiedRange)&&E4e(i.originalRange)):!1}var Y2o=0;function X2o(a){return ui(a.onDidChangeTokens,()=>Y2o++)}var Nke=class extends x{constructor(e,t,o,n,r,s){super();this._editor=e;this._model=t;this._simpleModel=o;this._inlineSuggestInfo=n;this._showCollapsed=r;this._instantiationService=s;this._tabAction=ke(e=>this._model.read(e)?.tabAction.read(e)??"inactive");this.displayRange=ke(this,e=>{let t=this._uiState.read(e);if(t&&t.target.uri.toString()===this._editorObs.model.read(e)?.uri.toString()){if(t.state?.kind==="custom"){let o=t.state.displayLocation?.range;if(!o)throw new li("custom view should have a range");return new uo(o.startLineNumber,o.endLineNumber)}return t.state?.kind==="insertionMultiLine"?this._insertion.originalLines.read(e):t.edit.displayRange}});this._currentInlineEditCache=void 0;this._uiState=ke(this,e=>{let t=this._model.read(e),o=this._editorObs.model.read(e);if(!t||!o||!this._constructorDone.read(e))return;let n=t.inlineEdit,r,s,l;n.edit?(s=Eg.fromEdit(n.edit),l=new jS(n.edit.apply(n.originalText)),r=vye(s,n.originalText,l)):(s=[],r=[],l=n.originalText);let c=this._determineRenderState(t,e,r,l);if(!c){mt(new Error(`unable to determine view: tried to render ${this._previousView?.view}`));return}let u=this._getLongDistanceHintState(t,e);if(u&&u.isVisible&&c.viewData.setLongDistanceViewData(u.lineNumber,n.lineEdit.lineRange.startLineNumber),c.kind==="sideBySide"){let g=nXi(l.getValue(),n.modifiedLineRange,o.getOptions().tabSize);l=new jS(g.applyToString(l.getValue())),s=oXi(s,g),r=vye(s,n.originalText,l)}this._previewTextModel.setLanguage(o.getLanguageId());let p=this._previewTextModel.getValue();if(p!==l.getValue()){this._previewTextModel.setEOL(o.getEndOfLineSequence());let f=ld.replace(new pi(0,p.length),l.getValue()).removeCommonSuffixPrefix(p),v=ede(this._previewTextModel).getTextEdit(f);this._previewTextModel.edit(v)}this._showCollapsed.read(e)&&(c={kind:"collapsed",viewData:c.viewData}),t.handleInlineEditShownNextFrame(c.kind,c.viewData);let h=n.action?.kind==="jumpTo"?n.action.position:null;return{state:c,diff:r,edit:n,newText:l.getValue(),newTextLineCount:n.modifiedLineRange.length,editorType:t.editorType,longDistanceHint:u,nextCursorPosition:h,target:n.inlineCompletion.originalTextRef}});this.inlineEditsIsHovered=ke(this,e=>this._sideBySide.isHovered.read(e)||this._wordReplacementViews.read(e).some(t=>t.isHovered.read(e))||this._deletion.isHovered.read(e)||this._inlineDiffView.isHovered.read(e)||this._lineReplacementView.isHovered.read(e)||this._insertion.isHovered.read(e)||this._customView.isHovered.read(e)||this._longDistanceHint.map((t,o)=>t?.isHovered.read(o)??!1).read(e));this.gutterIndicatorOffset=ke(this,e=>this._uiState.read(e)?.state?.kind==="insertionMultiLine"?this._insertion.startLineOffset.read(e):0);this._editorObs=gs(this._editor),this._constructorDone=Me(this,!1),this._previewTextModel=this._register(this._instantiationService.createInstance(ip,"",this._editor.getModel().getLanguageId(),{...ip.DEFAULT_CREATION_OPTIONS,bracketPairColorizationOptions:{enabled:!0,independentColorPoolPerBracketType:!1}},null)),this._sideBySide=this._register(this._instantiationService.createInstance(cde,this._editor,this._model.map(p=>p?.inlineEdit),this._previewTextModel,this._uiState.map(p=>p&&p.state?.kind==="sideBySide"?{newTextLineCount:p.newTextLineCount,editorType:p.editorType}:void 0),this._tabAction)),this._deletion=this._register(this._instantiationService.createInstance(Ykt,this._editor,this._model.map(p=>p?.inlineEdit),this._uiState.map(p=>p&&p.state?.kind==="deletion"?{originalRange:p.state.originalRange,deletions:p.state.deletions,editorType:p.editorType}:void 0),this._tabAction)),this._insertion=this._register(this._instantiationService.createInstance(Lke,this._editor,this._uiState.map(p=>p&&p.state?.kind==="insertionMultiLine"?{lineNumber:p.state.lineNumber,startColumn:p.state.column,text:p.state.text,editorType:p.editorType}:void 0),this._tabAction)),this._inlineCollapsedView=this._register(this._instantiationService.createInstance(_ke,this._editor,this._model.map((p,h)=>this._uiState.read(h)?.state?.kind==="collapsed"?p?.inlineEdit:void 0))),this._customView=this._register(this._instantiationService.createInstance(Dke,this._editor,this._model.map((p,h)=>this._uiState.read(h)?.state?.kind==="custom"?p?.displayLocation:void 0),this._tabAction,this._uiState.map(p=>p?.editorType??"textEditor"))),this._showLongDistanceHint=this._editorObs.getOption(71).map(this,p=>p.edits.showLongDistanceHint),this._longDistanceHint=ke(this,p=>{if(this._showLongDistanceHint.read(p))return p.store.add(this._instantiationService.createInstance(Pke,this._editor,this._uiState.map((h,g)=>h?.longDistanceHint?{hint:h.longDistanceHint,newTextLineCount:h.newTextLineCount,edit:h.edit,diff:h.diff,editorType:h.editorType,model:this._simpleModel.read(g),inlineSuggestInfo:this._inlineSuggestInfo.read(g),nextCursorPosition:h.nextCursorPosition,target:h.target}:void 0),this._previewTextModel,this._tabAction))}).recomputeInitiallyAndOnChange(this._store),this._inlineDiffViewState=ke(this,p=>{let h=this._uiState.read(p);if(!(!h||!h.state)&&!(h.state.kind==="wordReplacements"||h.state.kind==="insertionMultiLine"||h.state.kind==="collapsed"||h.state.kind==="custom"||h.state.kind==="jumpTo"))return{modifiedText:new jS(h.newText),diff:h.diff,mode:h.state.kind,modifiedCodeEditor:this._sideBySide.previewEditor,editorType:h.editorType}}),this._inlineDiffView=this._register(new Jkt(this._editor,this._inlineDiffViewState,this._previewTextModel)),this._jumpToView=this._register(this._instantiationService.createInstance(mX,this._editorObs,{style:"label"},ke(p=>{let h=this._uiState.read(p);if(h?.state?.kind==="jumpTo")return{jumpToPosition:h.state.position}})));let l=Os({equalsFn:sgt.arrayC(sgt.thisC())},p=>{let h=this._uiState.read(p);return h?.state?.kind==="wordReplacements"?h.state.replacements.map(g=>new Xkt(g,h.editorType,h.state?.alternativeAction)):[]});this._wordReplacementViews=ob(this,l,(p,h)=>h.add(this._instantiationService.createInstance(M5,this._editorObs,p,this._tabAction))),this._lineReplacementView=this._register(this._instantiationService.createInstance(Rke,this._editorObs,this._uiState.map(p=>p?.state?.kind==="lineReplacement"?{originalRange:p.state.originalRange,modifiedRange:p.state.modifiedRange,modifiedLines:p.state.modifiedLines,replacements:p.state.replacements}:void 0),this._uiState.map(p=>p?.editorType??"textEditor"),this._tabAction)),this._useCodeShifting=this._editorObs.getOption(71).map(p=>p.edits.allowCodeShifting),this._renderSideBySide=this._editorObs.getOption(71).map(p=>p.edits.renderSideBySide),this._register(be(p=>{let h=this._model.read(p);h&&p.store.add(U.any(this._sideBySide.onDidClick,this._lineReplacementView.onDidClick,this._insertion.onDidClick,...this._wordReplacementViews.read(p).map(g=>g.onDidClick),this._inlineDiffView.onDidClick,this._customView.onDidClick)(g=>{this._viewHasBeenShownLongerThan(350)&&(g.event.preventDefault(),h.accept(g.alternativeAction))}))})),this._wordReplacementViews.recomputeInitiallyAndOnChange(this._store);let c=ke(this,p=>Math.max(...this._wordReplacementViews.read(p).map(h=>h.minEditorScrollHeight.read(p)),this._lineReplacementView.minEditorScrollHeight.read(p),this._customView.minEditorScrollHeight.read(p))).recomputeInitiallyAndOnChange(this._store),u;this._register(be(p=>{let h=c.read(p),g=this._editorObs.model.read(p);g&&this._editor.changeViewZones(f=>{let v=this._editor.getScrollHeight(),b=h-v+1;b!==0&&u!==void 0&&(f.removeZone(u),u=void 0),!(b<=0)&&(u=f.addZone({afterLineNumber:g.getLineCount(),heightInPx:b,domNode:_("div.minScrollHeightViewZone")}))})})),this._constructorDone.set(!0,void 0)}_getLongDistanceHintState(e,t){if(!e.inlineEdit.inlineCompletion.identity.jumpedTo.read(t)&&e.inlineEdit.action!==void 0)return e.inlineEdit.originalText.uri.toString()!==this._editorObs.model.read(t)?.uri.toString()?{isVisible:!0,lineNumber:e.inlineEdit.cursorPosition.lineNumber}:(this._currentInlineEditCache?.inlineSuggestionIdentity!==e.inlineEdit.inlineCompletion.identity&&(this._currentInlineEditCache={inlineSuggestionIdentity:e.inlineEdit.inlineCompletion.identity,firstCursorLineNumber:e.inlineEdit.cursorPosition.lineNumber}),{lineNumber:this._currentInlineEditCache.firstCursorLineNumber,isVisible:!e.inViewPort.read(t)})}_getCacheId(e){return e.inlineEdit.inlineCompletion.identity.id}_determineView(e,t,o,n){let r=e.inlineEdit,s=this._previousView?.id===this._getCacheId(e)&&this._previousView?.uri.toString()===this._editorObs.model.get().uri.toString(),l=this._previousView?.editorWidth!==this._editorObs.layoutInfoWidth.read(t)&&(this._previousView?.view==="sideBySide"||this._previousView?.view==="lineReplacement");if(s&&!l)return this._previousView.view;let c=e.inlineEdit.inlineCompletion.action;if(c?.kind==="edit"&&c.alternativeAction)return"wordReplacements";let u=e.inlineEdit.inlineCompletion.originalTextRef.uri,p=this._editorObs.model.read(t)?.uri;if(p&&u.toString()!==p.toString())return"custom";if(e.displayLocation&&!e.inlineEdit.inlineCompletion.identity.jumpedTo.read(t))return"custom";let h=r.originalLineRange.length,g=r.modifiedLineRange.length,f=o.flatMap(b=>b.innerChanges??[]),v=f.length===1;if(e.editorType!=="diffEditor"){if(v&&this._useCodeShifting.read(t)!=="never"&&yXi(o))return Z2o(o,r.cursorPosition)?"insertionInline":"lineReplacement";if(bXi(f,r,n))return"deletion";if(vXi(o)&&this._useCodeShifting.read(t)==="always")return"insertionMultiLine";if(f.every(S=>pc.ofRange(S.originalRange).columnCount<M5.MAX_LENGTH&&pc.ofRange(S.modifiedRange).columnCount<M5.MAX_LENGTH)&&v&&h===1&&g===1){let S=f.map(w=>n.getValueOfRange(w.modifiedRange)),y=f.map(w=>e.inlineEdit.originalText.getValueOfRange(w.originalRange));if(!S.some(w=>w.includes("	"))&&!y.some(w=>w.includes("	"))&&(!f.some(w=>w.originalRange.isEmpty())||!SXi(f.map(w=>new ss(w.originalRange,"")),r.originalText).some(w=>w.range.isEmpty()&&pc.ofRange(w.range).columnCount<M5.MAX_LENGTH)))return"wordReplacements"}}if(h>0&&g>0)return h===1&&g===1&&e.editorType!=="diffEditor"?"lineReplacement":this._renderSideBySide.read(t)!=="never"&&cde.fitsInsideViewport(this._editor,this._previewTextModel,r,t)?"sideBySide":"lineReplacement";if(e.editorType==="diffEditor"){if(bXi(f,r,n))return"deletion";if(vXi(o)&&this._useCodeShifting.read(t)==="always")return"insertionMultiLine"}return"sideBySide"}_determineRenderState(e,t,o,n){if(e.inlineEdit.action?.kind==="jumpTo")return{kind:"jumpTo",position:e.inlineEdit.action.position,viewData:IXi};let r=e.inlineEdit,s=this._determineView(e,t,o,n);if(this._willRenderAboveCursor(t,r,s))switch(s){case"lineReplacement":case"wordReplacements":s="sideBySide";break}this._previousView={id:this._getCacheId(e),view:s,editorWidth:this._editor.getLayoutInfo().width,timestamp:Date.now(),uri:this._editorObs.model.get().uri};let l=o.flatMap(g=>g.innerChanges??[]),c=this._editor.getModel(),u=l.map(g=>({originalRange:g.originalRange,modifiedRange:g.modifiedRange,original:r.originalText.getValueOfRange(g.originalRange),modified:n.getValueOfRange(g.modifiedRange)})),p=J2o(r,u,c);switch(s){case"insertionInline":return{kind:"insertionInline",viewData:p};case"sideBySide":return{kind:"sideBySide",viewData:p};case"collapsed":return{kind:"collapsed",viewData:p};case"custom":return{kind:"custom",displayLocation:e.displayLocation,viewData:p}}if(s==="deletion")return{kind:"deletion",originalRange:r.originalLineRange,deletions:l.map(g=>g.originalRange),viewData:p};if(s==="insertionMultiLine"){let g=l[0];return{kind:"insertionMultiLine",lineNumber:g.originalRange.startLineNumber,column:g.originalRange.startColumn,text:n.getValueOfRange(g.modifiedRange),viewData:p}}let h=u.map(g=>new ss(g.originalRange,g.modified));if(h.length!==0){if(s==="wordReplacements"){let g=eGo(h,r.originalText);return g.some(f=>f.range.isEmpty())&&(g=SXi(h,r.originalText)),{kind:"wordReplacements",replacements:g,alternativeAction:e.inlineEdit.action?.alternativeAction,viewData:p}}if(s==="lineReplacement")return{kind:"lineReplacement",originalRange:r.originalLineRange,modifiedRange:r.modifiedLineRange,modifiedLines:r.modifiedLineRange.mapToLineArray(g=>n.getLineAt(g)),replacements:l.map(g=>({originalRange:g.originalRange,modifiedRange:g.modifiedRange})),viewData:p}}}_willRenderAboveCursor(e,t,o){if(this._useCodeShifting.read(e)==="always")return!1;for(let r of t.multiCursorPositions)if(o==="wordReplacements"&&r.lineNumber===t.originalLineRange.startLineNumber+1||o==="lineReplacement"&&r.lineNumber>=t.originalLineRange.endLineNumberExclusive&&r.lineNumber<t.modifiedLineRange.endLineNumberExclusive+t.modifiedLineRange.length)return!0;return!1}_viewHasBeenShownLongerThan(e){let t=this._previousView?.timestamp;if(!t)throw new li("viewHasBeenShownLongThan called before a view has been shown");return Date.now()-t>=e}};Nke=I([m(5,F)],Nke);var IXi=new tde(-1,-1,-1,-1,-1,-1,-1,!0);function J2o(a,i,e){if(!a.edit)return IXi;let t=a.cursorPosition,o=i.length===0?!1:i[0].modified.startsWith(e.getEOL());return new tde(a.edit.replacements.length===0?0:a.edit.replacements[0].range.getStartPosition().column-t.column,a.lineEdit.lineRange.startLineNumber-t.lineNumber+(o&&a.lineEdit.lineRange.startLineNumber>=t.lineNumber?1:0),a.lineEdit.lineRange.length,a.lineEdit.newLines.length,i.reduce((r,s)=>r+s.original.length,0),i.reduce((r,s)=>r+s.modified.length,0),i.length,i.every(r=>r.original===i[0].original&&r.modified===i[0].modified))}function yXi(a){return a.every(e=>e.innerChanges.every(t=>i(t)));function i(e){return!(!e.originalRange.isEmpty()||!(e.modifiedRange.startLineNumber===e.modifiedRange.endLineNumber))}}function Z2o(a,i){if(!i||!yXi(a))return!1;let e=i;return a.every(o=>o.innerChanges.every(n=>t(n)));function t(o){let n=o.originalRange.getStartPosition();return!!(e.isBeforeOrEqual(n)||n.lineNumber<e.lineNumber)}}function vXi(a){let i=a.flatMap(t=>t.innerChanges??[]);if(i.length!==1)return!1;let e=i[0];return!(!e.originalRange.isEmpty()||e.modifiedRange.startLineNumber===e.modifiedRange.endLineNumber)}function bXi(a,i,e){return a.map(o=>({original:i.originalText.getValueOfRange(o.originalRange),modified:e.getValueOfRange(o.modifiedRange)})).every(({original:o,modified:n})=>n.trim()===""&&o.length>0&&(o.length>n.length||o.trim()!==""))}function eGo(a,i){return wXi(a,i,e=>/^[a-zA-Z]$/.test(e))}function SXi(a,i){return wXi(a,i,e=>!/^\s$/.test(e))}function wXi(a,i,e){let t=[];a.sort((n,r)=>z.compareRangesUsingStarts(n.range,r.range));for(let n of a){let r=n.range.startColumn-1,s=n.range.endColumn-2,l="",c="",u=i.getLineAt(n.range.startLineNumber),p=i.getLineAt(n.range.endLineNumber);if(o(u[r]))for(;o(u[r-1]);)l=u[r-1]+l,r--;if(o(p[s])||s<r)for(;o(p[s+1]);)c+=p[s+1],s++;let h=new ss(new z(n.range.startLineNumber,r+1,n.range.endLineNumber,s+2),l+n.text+c);t.length>0&&z.areIntersectingOrTouching(t[t.length-1].range,h.range)&&(h=ss.joinReplacements([t.pop(),h],i)),t.push(h)}function o(n){return n===void 0?!1:e(n)}return t}var Oke=class extends x{constructor(e,t,o,n){super();this._editor=e;this._model=t;this._showCollapsed=o;this._inlineEdit=ke(this,e=>{let t=this._model.read(e);if(!t||!this._editor.getModel())return;let n=t.inlineEditState.read(e);if(!n)return;let r=n.inlineSuggestion.action,s;if(r?.kind==="edit"){let l=r.stringEdit,c=n.inlineSuggestion.originalTextRef.getTransformer(),u=l.replacements.map(p=>{let h=z.fromPositions(c.getPosition(p.replaceRange.start),c.getPosition(p.replaceRange.endExclusive));return new ss(h,p.newText)});s=new Vp(u)}else s=void 0;return new qkt(n.inlineSuggestion.originalTextRef,r,s,t.primaryPosition.read(void 0),t.allPositions.read(void 0),n.inlineSuggestion.source.inlineSuggestions.commands??[],n.inlineSuggestion)});this._inlineEditModel=ke(this,e=>{let t=this._model.read(e);if(!t)return;let o=this._inlineEdit.read(e);if(!o)return;let n=ke(this,r=>{if(this._editorObs.isFocused.read(r)){if(t.tabShouldJumpToInlineEdit.read(r))return"jump";if(t.tabShouldAcceptInlineEdit.read(r))return"accept"}return"inactive"});return new $kt(t,o,n)});this._editorObs=gs(this._editor),this.view=this._register(n.createInstance(Nke,this._editor,this._inlineEditModel,this._model.map(r=>r?pX.fromInlineCompletionModel(r):void 0),this._inlineEdit.map(r=>r?uX.fromInlineSuggestion(r.inlineCompletion):void 0),this._showCollapsed))}};Oke=I([m(3,F)],Oke);var Fke=class extends x{constructor(e,t,o,n){super();this._editor=e;this._model=t;this._focusIsInMenu=o;this._instantiationService=n;this._ghostTexts=ke(this,e=>this._model.read(e)?.ghostTexts.read(e)??[]);this._inlineEdit=ke(this,e=>this._model.read(e)?.inlineEditState.read(e)?.inlineSuggestion);this._everHadInlineEdit=Bf(this,(e,t)=>t||!!this._inlineEdit.read(e)||!!this._model.read(e)?.inlineCompletionState.read(e)?.inlineSuggestion?.showInlineEditMenu);this._indicatorIsHoverVisible=Me(this,void 0);this._showInlineEditCollapsed=ke(this,e=>(this._model.read(e)?.showCollapsed.read(e)??!1)&&!this._indicatorIsHoverVisible.read(e)?.read(e));this._inlineEditWidget=UI(e=>{if(this._everHadInlineEdit.read(e))return this._instantiationService.createInstance(Oke,this._editor,this._model,this._showInlineEditCollapsed)});this._gutterIndicatorState=ke(e=>{let t=this._model.read(e);if(!t)return;let o=t.state.read(e);if(o?.kind==="ghostText"&&o.inlineSuggestion?.showInlineEditMenu)return{displayRange:uo.ofLength(o.primaryGhostText.lineNumber,1),tabAction:ke(this,n=>this._editorObs.isFocused.read(n)?"accept":"inactive"),gutterIndicatorOffset:So(tGo(o.inlineSuggestion,this._editor)),inlineSuggestion:o.inlineSuggestion,model:t};if(o?.kind==="inlineEdit"){let n=this._inlineEditWidget.read(e)?.view;if(!n)return;let r=n.displayRange.read(e);return r?{displayRange:r,tabAction:ke(s=>{if(this._editorObs.isFocused.read(s)){if(t.tabShouldJumpToInlineEdit.read(s))return"jump";if(t.tabShouldAcceptInlineEdit.read(s))return"accept"}return"inactive"}),gutterIndicatorOffset:n.gutterIndicatorOffset,inlineSuggestion:o.inlineSuggestion,model:t}:void 0}else return});this._stablizedGhostTexts=CYi(this._ghostTexts,this._store),this._editorObs=gs(this._editor),this._ghostTextWidgets=ob(this,this._stablizedGhostTexts,(r,s)=>s.add(this._createGhostText(r))).recomputeInitiallyAndOnChange(this._store),this._inlineEditWidget.recomputeInitiallyAndOnChange(this._store),this._fontFamily=this._editorObs.getOption(71).map(r=>r.fontFamily),this._register(c5i(ke(r=>`
.monaco-editor .ghost-text-decoration,
.monaco-editor .ghost-text-decoration-preview,
.monaco-editor .ghost-text {
	font-family: ${this._fontFamily.read(r)};
}`))),this._register(new fxe(this._editor,this._model,this._instantiationService)),this._indicator=this._register(this._instantiationService.createInstance(uK,this._editorObs,ke(r=>{let s=this._gutterIndicatorState.read(r);if(s)return new dX(uX.fromInlineSuggestion(s.inlineSuggestion),s.displayRange,pX.fromInlineCompletionModel(s.model),s.inlineSuggestion.action?.kind==="edit"?s.inlineSuggestion.action.alternativeAction:void 0)}),this._gutterIndicatorState.map((r,s)=>r?.tabAction.read(s)??"inactive"),this._gutterIndicatorState.map((r,s)=>r?.gutterIndicatorOffset.read(s)??0),this._inlineEditWidget.map((r,s)=>r?.view.inlineEditsIsHovered.read(s)??!1),this._focusIsInMenu)),this._indicatorIsHoverVisible.set(this._indicator.isHoverVisible,void 0),ke(r=>{let s=this._inlineEditWidget.read(r);if(s)return r.store.add(this._instantiationService.createInstance(Tke,s._inlineEditModel,So(this._indicator),s.view._inlineCollapsedView))}).recomputeInitiallyAndOnChange(this._store)}static{this.hot=vz(this)}_createGhostText(e){return this._instantiationService.createInstance(cK,this._editor,ke(t=>{let o=this._model.read(t),n=o?.inlineCompletionState.read(t)?.inlineSuggestion;return!o||!n?{ghostText:e.read(t),handleInlineCompletionShown:()=>{},warning:void 0}:{ghostText:e.read(t),handleInlineCompletionShown:r=>o.handleInlineSuggestionShown(n,"ghostText",r,Date.now()),warning:Hkt.from(o?.warning.read(t))}}),{useSyntaxHighlighting:this._editorObs.getOption(71).map(t=>t.syntaxHighlightingEnabled),highlightShortSuggestions:!0})}shouldShowHoverAtViewZone(e){return this._ghostTextWidgets.get()[0]?.ownsViewZone(e)??!1}};Fke=I([m(3,F)],Fke);function tGo(a,i){let e=a.getSingleTextEdit(),t=i.getModel();if(!t)return 0;let o=t.getEOL();if(e.range.isEmpty()&&e.text.startsWith(o)){let n=i.getLineHeightForPosition(e.range.getStartPosition());return iGo(e.text,o)*n}return 0}function iGo(a,i){if(!i.length)return 0;let e=0,t=0;for(;a.startsWith(i,t);)e++,t+=i.length;return e}WYi(a=>Hc.get(a));var Hc=class extends x{constructor(e,t,o,n,r,s,l,c,u,p){super();this.editor=e;this._instantiationService=t;this._contextKeyService=o;this._configurationService=n;this._commandService=r;this._debounceService=s;this._languageFeaturesService=l;this._accessibilitySignalService=c;this._keybindingService=u;this._accessibilityService=p;this._enabled=ke(this,e=>this._enabledInConfig.read(e)&&(!this._isScreenReaderEnabled.read(e)||!this._editorDictationInProgress.read(e)));this._focusIsInMenu=Me(this,!1);this._focusIsInEditorOrMenu=ke(this,e=>{let t=this._editorObs.isFocused.read(e),o=this._focusIsInMenu.read(e);return t||o});this._cursorIsInIndentation=ke(this,e=>{let t=this._editorObs.cursorPosition.read(e);if(t===null)return!1;let o=this._editorObs.model.read(e);if(!o)return!1;this._editorObs.versionId.read(e);let n=o.getLineIndentColumn(t.lineNumber);return t.column<=n});this.model=UI(this,e=>{if(this._editorObs.isReadonly.read(e))return;let t=this._editorObs.model.read(e);return t?this._instantiationService.createInstance(uke,t,this._suggestWidgetAdapter.selectedItem,this._editorObs.versionId,this._positions,this._debounceValue,this._enabled,this.editor):void 0});this._playAccessibilitySignal=wc(this);this._view=ke(e=>e.store.add(this._instantiationService.createInstance(Fke.hot.read(e),this.editor,this.model,this._focusIsInMenu)));this._editorObs=gs(this.editor),this._positions=ke(this,b=>this._editorObs.selections.read(b)?.map(S=>S.getEndPosition())??[new ye(1,1)]),this._suggestWidgetAdapter=this._register(new Wkt(this._editorObs,b=>this.model.get()?.handleSuggestAccepted(b),()=>this.model.get()?.selectedInlineCompletion.get()?.getSingleTextEdit())),this._enabledInConfig=ui(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(71).enabled),this._isScreenReaderEnabled=ui(this,this._accessibilityService.onDidChangeScreenReaderOptimized,()=>this._accessibilityService.isScreenReaderOptimized()),this._editorDictationInProgress=ui(this,this._contextKeyService.onDidChangeContext,()=>this._contextKeyService.getContext(this.editor.getDomNode()).getValue("editorDictation.inProgress")===!0),this._debounceValue=this._debounceService.for(this._languageFeaturesService.inlineCompletionsProvider,"InlineCompletionsDebounce",{min:50,max:50}),this.model.recomputeInitiallyAndOnChange(this._store),this._hideInlineEditOnSelectionChange=this._editorObs.getOption(71).map(b=>!0),this._view.recomputeInitiallyAndOnChange(this._store),Hc._instances.add(this),this._register(Z(()=>Hc._instances.delete(this))),this._register(be(b=>{let S=this.model.read(b);if(!S)return;let y=S.state.read(b);if(!y||!this._focusIsInEditorOrMenu.read(void 0))return;let w=y.kind==="inlineEdit"?y.nextEditUri:void 0;for(let k of Hc._instances)k!==this&&(w&&Qe(w,k.editor.getModel()?.uri)?k.model.read(void 0)?.trigger():k.reject())})),this._register(be(b=>{let S=this.model.read(b),y=this.editor.getModel()?.uri;!S||!y||b.store.add(S.onDidAccept(()=>{for(let w of Hc._instances){if(w===this)continue;let k=w.model.read(void 0)?.state.read(void 0);k?.kind==="inlineEdit"&&Qe(k.nextEditUri,y)&&w.model.read(void 0)?.stop("automatic")}}))})),this._register(Vs(this._editorObs.onDidType,(b,S)=>{this._enabled.get()&&this.model.get()?.trigger()})),this._register(Vs(this._editorObs.onDidPaste,(b,S)=>{this._enabled.get()&&this.model.get()?.trigger()}));let h=new Set([zL.Tab.id,zL.DeleteLeft.id,zL.DeleteRight.id,Fz,"acceptSelectedSuggestion",Jce.ID,f8e.ID,xd.NextMatchFindAction,Fce.ID,G3e.ID,q3e.ID,$3e.ID,...BIe.getRegisteredCommands()]);this._register(this._commandService.onDidExecuteCommand(b=>{if(h.has(b.commandId)&&e.hasTextFocus()&&this._enabled.get()){let S=!1;b.commandId===Fz&&(S=!0),this._editorObs.forceUpdate(y=>{this.model.get()?.trigger(y,{noDelay:S})})}})),this._register(Vs(this._editorObs.selections,(b,S,y)=>{if(y.some(w=>w.reason===3||w.source==="api")){if(!this._hideInlineEditOnSelectionChange.get()&&this.model.get()?.state.get()?.kind==="inlineEdit")return;let w=this.model.get();if(!w)return;w.state.get()?.kind==="ghostText"&&this.model.get()?.stop()}})),this._register(be(b=>{let S=this._focusIsInEditorOrMenu.read(b),y=this.model.read(void 0);if(S){let w=y?.state.read(void 0);(!w||w.kind!=="inlineEdit"||!w.nextEditUri)&&Gi(k=>{for(let T of Hc._instances)T!==this&&T.model.read(void 0)?.stop("automatic",k)});return}this._contextKeyService.getContextKeyValue("accessibleViewIsShown")||this._configurationService.getValue("editor.inlineSuggest.keepOnBlur")||e.getOption(71).keepOnBlur||gR.dropDownVisible||y&&(y.state.read(void 0)?.inlineSuggestion?.isFromExplicitRequest&&y.inlineEditAvailable.read(void 0)||Gi(w=>{y.stop("automatic",w)}))})),this._register(be(b=>{let S=this.model.read(b)?.inlineCompletionState.read(b);S?.suggestItem?S.primaryGhostText.lineCount>=2&&this._suggestWidgetAdapter.forceRenderingAbove():this._suggestWidgetAdapter.stopForceRenderingAbove()})),this._register(Z(()=>{this._suggestWidgetAdapter.stopForceRenderingAbove()}));let g=Bf(this,(b,S)=>{let w=this.model.read(b)?.state.read(b);return this._suggestWidgetAdapter.selectedItem.get()?S:w?.inlineSuggestion?.semanticId});this._register(hgt(ke(b=>(this._playAccessibilitySignal.read(b),g.read(b),{})),async(b,S,y,w)=>{let k=this.model.get(),T=k?.state.get();if(!T||!k||(await Li(50,N9(w)),await Wf(this._suggestWidgetAdapter.selectedItem,gn,()=>!1,N9(w)),k=this.model.get(),T=k?.state.get(),!T||!k))return;let P=T.kind==="ghostText"?k.textModel.getLineContent(T.primaryGhostText.lineNumber):"";this._accessibilitySignalService.playSignal(T.kind==="ghostText"?$o.inlineSuggestion:$o.nextEditSuggestion),this.editor.getOption(12)&&(T.kind==="ghostText"?this._provideScreenReaderUpdate(T.primaryGhostText.renderForScreenReader(P)):this._provideScreenReaderUpdate(""))})),this._register(this._configurationService.onDidChangeConfiguration(b=>{b.affectsConfiguration("accessibility.verbosity.inlineCompletions")&&this.editor.updateOptions({inlineCompletionsAccessibilityVerbose:this._configurationService.getValue("accessibility.verbosity.inlineCompletions")})})),this.editor.updateOptions({inlineCompletionsAccessibilityVerbose:this._configurationService.getValue("accessibility.verbosity.inlineCompletions")});let f=new hkt(this._contextKeyService);this._register(f.bind(Ha.cursorInIndentation,this._cursorIsInIndentation)),this._register(f.bind(Ha.hasSelection,b=>!this._editorObs.cursorSelection.read(b)?.isEmpty())),this._register(f.bind(Ha.cursorAtInlineEdit,this.model.map((b,S)=>b?.inlineEditState?.read(S)?.cursorAtInlineEdit.read(S)))),this._register(f.bind(Ha.tabShouldAcceptInlineEdit,this.model.map((b,S)=>!!b?.tabShouldAcceptInlineEdit.read(S)))),this._register(f.bind(Ha.tabShouldJumpToInlineEdit,this.model.map((b,S)=>!!b?.tabShouldJumpToInlineEdit.read(S)))),this._register(f.bind(Ha.inlineEditVisible,b=>this.model.read(b)?.inlineEditState.read(b)!==void 0)),this._register(f.bind(Ha.inlineSuggestionHasIndentation,b=>this.model.read(b)?.getIndentationInfo(b)?.startsWithIndentation)),this._register(f.bind(Ha.inlineSuggestionHasIndentationLessThanTabSize,b=>this.model.read(b)?.getIndentationInfo(b)?.startsWithIndentationLessThanTabSize)),this._register(f.bind(Ha.suppressSuggestions,b=>{let y=this.model.read(b)?.inlineCompletionState.read(b);return y?.primaryGhostText&&y?.inlineSuggestion?y.inlineSuggestion.source.inlineSuggestions.suppressSuggestions:void 0})),this._register(f.bind(Ha.inlineSuggestionAlternativeActionVisible,b=>{let w=this.model.read(b)?.inlineEditState.read(b)?.inlineSuggestion.action;return w&&w.kind==="edit"&&w.alternativeAction!==void 0})),this._register(f.bind(Ha.inlineSuggestionVisible,b=>{let y=this.model.read(b)?.inlineCompletionState.read(b);return!!y?.inlineSuggestion&&y?.primaryGhostText!==void 0&&!y?.primaryGhostText.isEmpty()}));let v=ke(this,b=>{let w=this.model.read(b)?.inlineCompletionState.read(b)?.primaryGhostText;return!w||w.isEmpty()?void 0:new ye(w.lineNumber,w.parts[0].column)});this._register(f.bind(Ha.cursorBeforeGhostText,b=>{let S=v.read(b);if(!S)return!1;let y=this._editorObs.cursorPosition.read(b);return y?S.equals(y):!1})),this._register(this._instantiationService.createInstance(ske,this.editor))}static{this._instances=new Set}static{this.hot=vz(this)}static{this.ID="editor.contrib.inlineCompletionsController"}static getInFocusedEditorOrParent(e){let t=Rxe(e);return t?Hc.get(t):null}static get(e){return sYi(e.getContribution(Hc.ID))}playAccessibilitySignal(e){this._playAccessibilitySignal.trigger(e)}_provideScreenReaderUpdate(e){let t=this._contextKeyService.getContextKeyValue("accessibleViewIsShown"),o=this._keybindingService.lookupKeybinding("editor.action.accessibleView"),n;!t&&o&&this.editor.getOption(169)&&(n=d(1365,null,o.getAriaLabel())),en(n?e+", "+n:e)}shouldShowHoverAt(e){let t=this.model.get()?.primaryGhostText.get();return t?t.parts.some(o=>e.containsPosition(new ye(t.lineNumber,o.column))):!1}shouldShowHoverAtViewZone(e){return this._view.get().shouldShowHoverAtViewZone(e)}reject(){Gi(e=>{let t=this.model.get();if(t&&(t.stop("explicitCancel",e),this._focusIsInEditorOrMenu.get()))for(let o of Hc._instances)o!==this&&!o._focusIsInEditorOrMenu.get()&&o.model.get()?.stop("automatic",e)})}jump(){let e=this.model.get();e&&e.jump()}};Hc=I([m(1,F),m(2,X),m(3,B),m(4,ge),m(5,hf),m(6,Qt),m(7,lr),m(8,_e),m(9,Oi)],Hc);var Zkt=class a extends Di{static{this.ID=cCt}constructor(){super({id:a.ID,label:L(1343,"Show Next Inline Suggestion"),precondition:C.and(pe.writable,Ha.inlineSuggestionVisible),kbOpts:{weight:100,primary:606}})}async run(i,e){Hc.get(e)?.model.get()?.next()}},eEt=class a extends Di{static{this.ID=lCt}constructor(){super({id:a.ID,label:L(1344,"Show Previous Inline Suggestion"),precondition:C.and(pe.writable,Ha.inlineSuggestionVisible),kbOpts:{weight:100,primary:604}})}async run(i,e){Hc.get(e)?.model.get()?.previous()}},fui="vscode://schemas/inlineCompletionProviderIdArgs";function vui(a){let i=[];return a.providerId&&(i.push(a.providerId.toStringWithoutVersion()),i.push(a.providerId.extensionId+":*")),i}var CXi=uYi(dYi({showNoResultNotification:d8e(Hci()),providerId:d8e(pYi(fui,aYi())),explicit:d8e(Hci()),changeHintData:d8e(lYi())}),cYi()),tEt=class extends Di{constructor(){super({id:"editor.action.inlineSuggest.trigger",label:L(1346,"Trigger Inline Suggestion"),precondition:pe.writable,metadata:{description:d(1348,null),args:[{name:"args",description:d(1347,null),isOptional:!0,schema:CXi.getJSONSchema()}]}})}async run(i,e,t){let o=i.get(Ne),n=i.get(Qt),r=Hc.get(e),s=CXi.validateOrThrow(t),l=s?.providerId?n.inlineCompletionsProvider.all(e.getModel()).find(c=>vui(c).some(u=>u===s.providerId)):void 0;await bJt(async c=>{await r?.model.get()?.trigger(c,{provider:l,explicit:s?.explicit??!0,changeHint:s?.changeHintData?{data:s.changeHintData}:void 0}),r?.playAccessibilitySignal(c)}),s?.showNoResultNotification&&(r?.model.get()?.state.get()||o.notify({severity:ft.Info,message:d(1350,null)}))}},iEt=class extends Di{constructor(){super({id:"editor.action.inlineSuggest.acceptNextWord",label:L(1338,"Accept Next Word Of Inline Suggestion"),precondition:C.and(pe.writable,Ha.inlineSuggestionVisible),kbOpts:{weight:101,primary:2065,kbExpr:C.and(pe.writable,Ha.inlineSuggestionVisible,Ha.cursorBeforeGhostText,$a.negate())},menuOpts:[{menuId:D.InlineSuggestionToolbar,title:d(1334,null),group:"primary",order:2}]})}async run(i,e){await Hc.get(e)?.model.get()?.acceptNextWord()}},oEt=class extends Di{constructor(){super({id:"editor.action.inlineSuggest.acceptNextLine",label:L(1337,"Accept Next Line Of Inline Suggestion"),precondition:C.and(pe.writable,Ha.inlineSuggestionVisible),kbOpts:{weight:101},menuOpts:[{menuId:D.InlineSuggestionToolbar,title:d(1333,null),group:"secondary",order:2}]})}async run(i,e){await Hc.get(e)?.model.get()?.acceptNextLine()}},nEt=class extends Di{constructor(){super({id:Fz,label:L(1335,"Accept Inline Suggestion"),precondition:C.or(Ha.inlineSuggestionVisible,Ha.inlineEditVisible),menuOpts:[{menuId:D.InlineSuggestionToolbar,title:d(1332,null),group:"primary",order:2},{menuId:D.InlineEditsActions,title:d(1332,null),group:"primary",order:2}],kbOpts:[{primary:2,weight:200,kbExpr:C.or(C.and(Ha.inlineSuggestionVisible,pe.tabMovesFocus.toNegated(),Xn.Visible.toNegated(),pe.hoverFocused.toNegated(),Ha.hasSelection.toNegated(),Ha.inlineSuggestionHasIndentationLessThanTabSize),C.and(Ha.inlineEditVisible,pe.tabMovesFocus.toNegated(),Xn.Visible.toNegated(),pe.hoverFocused.toNegated(),Ha.tabShouldAcceptInlineEdit))}]})}async run(i,e){let t=Hc.getInFocusedEditorOrParent(i);t&&(t.model.get()?.accept(t.editor),t.editor.focus())}};Ct.registerKeybindingRule({id:Fz,weight:202,primary:2,when:C.and(Ha.inInlineEditsPreviewEditor)});var rEt=class extends Di{constructor(){super({id:yce,label:L(1336,"Accept Inline Suggestion Alternative Action"),precondition:C.and(Ha.inlineSuggestionAlternativeActionVisible,Ha.inlineEditVisible),menuOpts:[],kbOpts:[{primary:1026,weight:203}]})}async run(i,e){let t=Hc.getInFocusedEditorOrParent(i);t&&(t.model.get()?.accept(t.editor,!0),t.editor.focus())}};Ct.registerKeybindingRule({id:yce,weight:203,primary:1026,when:C.and(Ha.inInlineEditsPreviewEditor)});var sEt=class extends Di{constructor(){super({id:dCt,label:L(1342,"Jump to next inline edit"),precondition:Ha.inlineEditVisible,menuOpts:[{menuId:D.InlineEditsActions,title:d(1349,null),group:"primary",order:1,when:Ha.cursorAtInlineEdit.toNegated()}],kbOpts:{primary:2,weight:201,kbExpr:C.and(Ha.inlineEditVisible,pe.tabMovesFocus.toNegated(),Xn.Visible.toNegated(),pe.hoverFocused.toNegated(),Ha.tabShouldJumpToInlineEdit)}})}async run(i,e){let t=Hc.get(e);t&&t.jump()}},X8e=class a extends Di{static{this.ID=uCt}constructor(){super({id:a.ID,label:L(1341,"Hide Inline Suggestion"),precondition:C.or(Ha.inlineSuggestionVisible,Ha.inlineEditVisible),kbOpts:{weight:190,primary:9},menuOpts:[{menuId:D.InlineEditsActions,title:d(1351,null),group:"primary",order:3}]})}async run(i,e){let t=Hc.getInFocusedEditorOrParent(i);Gi(o=>{t?.model.get()?.stop("explicitCancel",o)}),t?.editor.focus()}},aEt=class a extends Di{static{this.ID=n3e}constructor(){super({id:a.ID,label:L(1345,"Toggle Inline Suggestions Show Collapsed"),precondition:C.true()})}async run(i,e){let t=i.get(B),o=t.getValue("editor.inlineSuggest.edits.showCollapsed");t.updateValue("editor.inlineSuggest.edits.showCollapsed",!o)}};Ct.registerKeybindingRule({id:X8e.ID,weight:-1,primary:9,secondary:[1033],when:C.and(Ha.inInlineEditsPreviewEditor)});var lEt=class a extends K{static{this.ID="editor.action.inlineSuggest.toggleAlwaysShowToolbar"}constructor(){super({id:a.ID,title:d(1339,null),f1:!1,precondition:void 0,menu:[{id:D.InlineSuggestionToolbar,group:"secondary",order:10}],toggled:C.equals("config.editor.inlineSuggest.showToolbar","always")})}async run(i){let e=i.get(B),o=e.getValue("editor.inlineSuggest.showToolbar")==="always"?"onHover":"always";e.updateValue("editor.inlineSuggest.showToolbar",o)}},cEt=class extends Di{constructor(){super({id:"editor.action.inlineSuggest.dev.extractRepro",label:d(1340,null),alias:"Developer: Inline Suggest Extract Repro",precondition:C.or(Ha.inlineEditVisible,Ha.inlineSuggestionVisible)})}async run(i,e){let t=i.get(Fi),n=Hc.get(e)?.model.get();if(!n)return;let r=n.extractReproSample(),l=yc(JSON.stringify({inlineCompletion:r.inlineCompletion},null,4)).map(u=>"// "+u).join(`
`),c=`${r.documentValue}

// <json>
${l}
// </json>
`;return await t.writeText(c),{reproCase:c}}};var bui=class{constructor(i,e,t){this.owner=i;this.range=e;this.controller=t}isValidForHoverAnchor(i){return i.type===1&&this.range.startColumn<=i.range.startColumn&&this.range.endColumn>=i.range.endColumn}},Wke=class{constructor(i,e,t,o,n){this._editor=i;this.accessibilityService=e;this._instantiationService=t;this._telemetryService=o;this._markdownRendererService=n;this.hoverOrdinal=4}suggestHoverAnchor(i){let e=Hc.get(this._editor);if(!e)return null;let t=i.target;if(t.type===8){let o=t.detail;if(e.shouldShowHoverAtViewZone(o.viewZoneId))return new r5(1e3,this,z.fromPositions(this._editor.getModel().validatePosition(o.positionBefore||o.position)),i.event.posx,i.event.posy,!1)}if(t.type===7&&e.shouldShowHoverAt(t.range))return new r5(1e3,this,t.range,i.event.posx,i.event.posy,!1);if(t.type===6&&t.detail.mightBeForeignElement&&e.shouldShowHoverAt(t.range))return new r5(1e3,this,t.range,i.event.posx,i.event.posy,!1);if(t.type===9&&t.element){let o=cK.getWarningWidgetContext(t.element);if(o&&e.shouldShowHoverAt(o.range))return new r5(1e3,this,o.range,i.event.posx,i.event.posy,!1)}return null}computeSync(i,e){if(this._editor.getOption(71).showToolbar!=="onHover")return[];let t=Hc.get(this._editor);return t&&t.shouldShowHoverAt(i.range)?[new bui(this,i.range,t)]:[]}renderHoverParts(i,e){let t=new N,o=e[0];this._telemetryService.publicLog2("inlineCompletionHover.shown"),this.accessibilityService.isScreenReaderOptimized()&&!this._editor.getOption(12)&&t.add(this.renderScreenReaderText(i,o));let n=o.controller.model.get(),r=document.createElement("div");i.fragment.appendChild(r),t.add(il((l,c)=>{let u=c.add(this._instantiationService.createInstance(gR.hot.read(l),this._editor,!1,So(null),n.selectedInlineCompletionIndex,n.inlineCompletionsCount,n.activeCommands,n.warning,()=>{i.onContentsChanged()}));r.replaceChildren(u.getDomNode())})),n.triggerExplicitly();let s={hoverPart:o,hoverElement:r,dispose(){t.dispose()}};return new ok([s])}getAccessibleContent(i){return d(1366,null)}renderScreenReaderText(i,e){let t=new N,o=_,n=o("div.hover-row.markdown-hover"),r=M(n,o("div.hover-contents",{"aria-live":"assertive"})),s=l=>{let c=d(1367,null),u=t.add(this._markdownRendererService.render(new Ie().appendText(c).appendCodeblock("text",l),{context:this._editor,asyncRenderCallback:()=>{r.className="hover-contents code-hover-contents",i.onContentsChanged()}}));r.replaceChildren(u.element)};return t.add(be(l=>{let c=e.controller.model.read(l)?.primaryGhostText.read(l);if(c){let u=this._editor.getModel().getLineContent(c.lineNumber);s(c.renderForScreenReader(u))}else vi(r)})),i.fragment.appendChild(n),t}};Wke=I([m(1,Oi),m(2,F),m(3,Te),m(4,On)],Wke);var ou=le("accessibleViewService");var xp=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.id=e;this.options=t;this.provideContent=o;this.onClose=n;this.verbositySettingKey=r;this.onOpen=s;this.actions=l;this.provideNextContent=c;this.providePreviousContent=u;this.onDidChangeContent=p;this.onKeyDown=h;this.getSymbols=g;this.onDidRequestClearLastProvider=f}};function dEt(a){if(!a||typeof a!="object")return!1;let i=a;return!!i.id&&!!i.options&&typeof i.provideContent=="function"&&typeof i.onClose=="function"&&typeof i.verbositySettingKey=="string"}var hX=class extends x{constructor(e,t,o,n,r,s,l,c,u){super();this.id=e;this.options=t;this.provideContent=o;this.onClose=n;this.onOpen=r;this.provideNextContent=s;this.providePreviousContent=l;this.actions=c;this.onDidChangeContent=u}};var uEt=class{constructor(){this.type="view";this.priority=95;this.name="inline-completions";this.when=C.or(Ha.inlineSuggestionVisible,Ha.inlineEditVisible)}getProvider(i){let e=i.get(qt),t=e.getActiveCodeEditor()||e.getFocusedCodeEditor();if(!t)return;let o=Hc.get(t)?.model.get();if(o?.state.get())return new Sui(t,o)}},Sui=class extends x{constructor(e,t){super();this._editor=e;this._model=t;this._onDidChangeContent=this._register(new E);this.onDidChangeContent=this._onDidChangeContent.event;this.id="inlineCompletions";this.verbositySettingKey="accessibility.verbosity.inlineCompletions";this.options={language:this._editor.getModel()?.getLanguageId()??void 0,type:"view"}}provideContent(){let e=this._model.state.get();if(!e)throw new Error("Inline completion is visible but state is not available");if(e.kind==="ghostText"){let t=this._model.textModel.getLineContent(e.primaryGhostText.lineNumber),o=e.primaryGhostText.renderForScreenReader(t);if(!o)throw new Error("Inline completion is visible but ghost text is not available");return t+o}else{let t=new pR(this._model.textModel);return Lj.fromTextEdit(new Vp(e.edits),t).humanReadablePatch(t.getLines())}}provideNextContent(){this._model.next().then((()=>this._onDidChangeContent.fire()))}providePreviousContent(){this._model.previous().then((()=>this._onDidChangeContent.fire()))}onClose(){this._model.stop(),this._editor.focus()}};xo(Hc.ID,Zxt(Hc.hot),3);ni(tEt);ni(Zkt);ni(eEt);ni(iEt);ni(oEt);ni(nEt);ni(rEt);ni(aEt);ni(X8e);ni(sEt);W(lEt);ni(cEt);W(Dkt);W(Lkt);z_.register(Wke);ga.register(new uEt);var Y_=class{constructor(i,e,t,o){this.textModelResolverService=e;this.languageService=t;this.languageFeaturesService=o;this.toUnhook=new N;this.toUnhookForKeyboard=new N;this.currentWordAtPosition=null;this.previousPromise=null;this.editor=i,this.linkDecorations=this.editor.createDecorationsCollection();let n=new JO(i);this.toUnhook.add(n),this.toUnhook.add(n.onMouseMoveOrRelevantKeyDown(([r,s])=>{this.startFindDefinitionFromMouse(r,s??void 0)})),this.toUnhook.add(n.onExecute(r=>{this.isEnabled(r)&&this.gotoDefinition(r.target.position,r.hasSideBySideModifier).catch(s=>{mt(s)}).finally(()=>{this.removeLinkDecorations()})})),this.toUnhook.add(n.onCancel(()=>{this.removeLinkDecorations(),this.currentWordAtPosition=null}))}static{this.ID="editor.contrib.gotodefinitionatposition"}static{this.MAX_SOURCE_PREVIEW_LINES=8}static get(i){return i.getContribution(Y_.ID)}async startFindDefinitionFromCursor(i){await this.startFindDefinition(i),this.toUnhookForKeyboard.add(this.editor.onDidChangeCursorPosition(()=>{this.currentWordAtPosition=null,this.removeLinkDecorations(),this.toUnhookForKeyboard.clear()})),this.toUnhookForKeyboard.add(this.editor.onKeyDown(e=>{e&&(this.currentWordAtPosition=null,this.removeLinkDecorations(),this.toUnhookForKeyboard.clear())}))}startFindDefinitionFromMouse(i,e){if(i.target.type===9&&this.linkDecorations.length>0)return;if(!this.editor.hasModel()||!this.isEnabled(i,e)){this.currentWordAtPosition=null,this.removeLinkDecorations();return}let t=i.target.position;this.startFindDefinition(t)}async startFindDefinition(i){this.toUnhookForKeyboard.clear();let e=i?this.editor.getModel()?.getWordAtPosition(i):null;if(!e){this.currentWordAtPosition=null,this.removeLinkDecorations();return}if(this.currentWordAtPosition&&this.currentWordAtPosition.startColumn===e.startColumn&&this.currentWordAtPosition.endColumn===e.endColumn&&this.currentWordAtPosition.word===e.word)return;this.currentWordAtPosition=e;let t=new Mz(this.editor,15);this.previousPromise&&(this.previousPromise.cancel(),this.previousPromise=null),this.previousPromise=Ln(r=>this.findDefinition(i,r));let o;try{o=await this.previousPromise}catch(r){mt(r);return}if(!o||!o.length||!t.validate(this.editor)){this.removeLinkDecorations();return}let n=o[0].originSelectionRange?z.lift(o[0].originSelectionRange):new z(i.lineNumber,e.startColumn,i.lineNumber,e.endColumn);if(o.length>1){let r=n;for(let{originSelectionRange:s}of o)s&&(r=z.plusRange(r,s));this.addDecoration(r,new Ie().appendText(d(1235,null,o.length)))}else{let r=o[0];return r.uri?this.textModelResolverService.createModelReference(r.uri).then(s=>{if(!s.object||!s.object.textEditorModel){s.dispose();return}let{object:{textEditorModel:l}}=s,{startLineNumber:c}=r.range;if(c<1||c>l.getLineCount()){s.dispose();return}let u=this.getPreviewValue(l,c,r),p=this.languageService.guessLanguageIdByFilepathOrFirstLine(l.uri);this.addDecoration(n,u?new Ie().appendCodeblock(p||"",u):void 0),s.dispose()}):void 0}}getPreviewValue(i,e,t){let o=t.range;return o.endLineNumber-o.startLineNumber>=Y_.MAX_SOURCE_PREVIEW_LINES&&(o=this.getPreviewRangeBasedOnIndentation(i,e)),o=i.validateRange(o),this.stripIndentationFromPreviewRange(i,e,o)}stripIndentationFromPreviewRange(i,e,t){let n=i.getLineFirstNonWhitespaceColumn(e);for(let s=e+1;s<t.endLineNumber;s++){let l=i.getLineFirstNonWhitespaceColumn(s);n=Math.min(n,l)}return i.getValueInRange(t).replace(new RegExp(`^\\s{${n-1}}`,"gm"),"").trim()}getPreviewRangeBasedOnIndentation(i,e){let t=i.getLineFirstNonWhitespaceColumn(e),o=Math.min(i.getLineCount(),e+Y_.MAX_SOURCE_PREVIEW_LINES),n=e+1;for(;n<o;n++){let r=i.getLineFirstNonWhitespaceColumn(n);if(t===r)break}return new z(e,1,n+1,1)}addDecoration(i,e){let t={range:i,options:{description:"goto-definition-link",inlineClassName:"goto-definition-link",hoverMessage:e}};this.linkDecorations.set([t])}removeLinkDecorations(){this.linkDecorations.clear()}isEnabled(i,e){return this.editor.hasModel()&&i.isLeftClick&&i.isNoneOrSingleMouseDown&&i.target.type===6&&!(i.target.detail.injectedText?.options instanceof gz)&&(i.hasTriggerModifier||(e?e.keyCodeIsTriggerKey:!1))&&this.languageFeaturesService.definitionProvider.has(this.editor.getModel())}findDefinition(i,e){let t=this.editor.getModel();return t?sF(this.languageFeaturesService.definitionProvider,t,i,!1,e):Promise.resolve(null)}async gotoDefinition(i,e){return this.editor.setPosition(i),this.editor.invokeWithinContext(t=>{let o=!e&&this.editor.getOption(101)&&!this.isInPeekEditor(t);return new nB({openToSide:e,openInPeek:o,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(t)})}isInPeekEditor(i){let e=i.get(X);return tg.inPeekEditor.getValue(e)}dispose(){this.toUnhook.dispose(),this.toUnhookForKeyboard.dispose()}};Y_=I([m(1,Bt),m(2,_t),m(3,Qt)],Y_);xo(Y_.ID,Y_,2);var Vke=class extends x{constructor(e,t,o){super();this._editor=e;this._markerService=o;this._ctxHasDiagnostics=pe.selectionHasDiagnostics.bindTo(t),this._store.add(this._editor.onDidChangeCursorSelection(()=>this._update())),this._store.add(this._editor.onDidChangeModel(()=>this._update())),this._store.add(this._markerService.onMarkerChanged(n=>{let r=this._editor.getModel();r&&n.some(s=>Qe(s,r.uri))&&this._update()})),this._update()}static{this.ID="editor.contrib.markerSelectionStatus"}dispose(){this._ctxHasDiagnostics.reset(),super.dispose()}_update(){let e=this._editor.getModel(),t=this._editor.getSelection();if(!e||!t){this._ctxHasDiagnostics.reset();return}let n=this._markerService.read({resource:e.uri,severities:14}).some(r=>z.areIntersecting({startLineNumber:r.startLineNumber,startColumn:r.startColumn,endLineNumber:r.endLineNumber,endColumn:r.endColumn},t));this._ctxHasDiagnostics.set(n)}};Vke=I([m(1,X),m(2,oa)],Vke);xo(Vke.ID,Vke,1);var Iui=class extends Di{constructor(){super({id:"editor.action.debugEditorGpuRenderer",label:L(1257,"Developer: Debug Editor GPU Renderer"),precondition:C.true()})}async run(i,e){let t=i.get(F),n=await i.get(Ue).pick([{label:d(1258,null),id:"logTextureAtlasStats"},{label:d(1259,null),id:"saveTextureAtlas"},{label:d(1256,null),id:"drawGlyph"}],{canPickMany:!1});if(n)switch(n.id){case"logTextureAtlasStats":t.invokeFunction(r=>{let s=r.get(se),l=gc.atlas;if(!gc.atlas){s.error("No texture atlas found");return}let c=l.getStats();s.info(["Texture atlas stats",...c].join(`

`))});break;case"saveTextureAtlas":t.invokeFunction(async r=>{let s=r.get(Pe),l=r.get(fe),c=s.getWorkspace().folders;if(c.length>0){let u=gc.atlas,p=[];for(let[h,g]of u.pages.entries())p.push(l.writeFile(A.joinPath(c[0].uri,`textureAtlasPage${h}_actual.png`),qe.wrap(new Uint8Array(await(await g.source.convertToBlob()).arrayBuffer()))),l.writeFile(A.joinPath(c[0].uri,`textureAtlasPage${h}_usage.png`),qe.wrap(new Uint8Array(await(await g.getUsagePreview()).arrayBuffer()))));await Promise.all(p)}});break;case"drawGlyph":t.invokeFunction(async r=>{let s=r.get(B),l=r.get(fe),c=r.get(Ue),p=r.get(Pe).getWorkspace().folders;if(p.length===0)return;let h=gc.atlas,g=s.getValue("editor.fontFamily"),f=s.getValue("editor.fontSize"),v=new tz(f,g,Ki().devicePixelRatio,gc.decorationStyleCache),b=await c.input({prompt:"Enter a character to draw (prefix with 0x for code point))"});if(!b)return;let S=b.match(/0x(?<codePoint>[0-9a-f]+)/i)?.groups?.codePoint;S!==void 0&&(b=String.fromCodePoint(parseInt(S,16)));let y=0,k=h.getGlyph(v,b,y,0,0);if(!k)return;let T=h.pages[k.pageIndex].source.getContext("2d")?.getImageData(k.x,k.y,k.w,k.h);if(!T)return;let P=new OffscreenCanvas(T.width,T.height);OO(P.getContext("2d")).putImageData(T,0,0);let V=await P.convertToBlob({type:"image/png"}),H=A.joinPath(p[0].uri,`glyph_${b}_${y}_${f}px_${g.replaceAll(/[,\\\/\.'\s]/g,"_")}.png`);await l.writeFile(H,qe.wrap(new Uint8Array(await V.arrayBuffer())))});break}}};ni(Iui);var xXi=(t=>(t.NoAutoFocus="noAutoFocus",t.FocusIfVisible="focusIfVisible",t.AutoFocusImmediately="autoFocusImmediately",t))(xXi||{}),pEt=class extends Di{constructor(){super({id:aCt,label:L(1286,"Show or Focus Hover"),metadata:{description:L(1290,"Show or focus the editor hover which shows documentation, references, and other content for a symbol at the current cursor position."),args:[{name:"args",schema:{type:"object",properties:{focus:{description:"Controls if and when the hover should take focus upon being triggered by this action.",enum:["noAutoFocus","focusIfVisible","autoFocusImmediately"],enumDescriptions:[d(1289,null),d(1288,null),d(1287,null)],default:"focusIfVisible"}}}}]},precondition:void 0,kbOpts:{kbExpr:pe.editorTextFocus,primary:Vi(2089,2087),weight:100}})}run(i,e,t){if(!e.hasModel())return;let o=Pl.get(e);if(!o)return;let n=t?.focus,r="focusIfVisible";Object.values(xXi).includes(n)?r=n:typeof n=="boolean"&&n&&(r="autoFocusImmediately");let s=c=>{let u=e.getPosition(),p=new z(u.lineNumber,u.column,u.lineNumber,u.column);o.showContentHover(p,1,2,c)},l=e.getOption(2)===2;o.isHoverVisible?r!=="noAutoFocus"?o.focus():s(l):s(l||r==="autoFocusImmediately")}},mEt=class extends Di{constructor(){super({id:_9i,label:L(1284,"Show Definition Preview Hover"),precondition:void 0,metadata:{description:L(1285,"Show the definition preview hover in the editor.")}})}run(i,e){let t=Pl.get(e);if(!t)return;let o=e.getPosition();if(!o)return;let n=new z(o.lineNumber,o.column,o.lineNumber,o.column),r=Y_.get(e);if(!r)return;r.startFindDefinitionFromCursor(o).then(()=>{t.showContentHover(n,1,2,!0)})}},hEt=class extends Di{constructor(){super({id:D9i,label:L(1271,"Hide Hover"),alias:"Hide Content Hover",precondition:void 0})}run(i,e){Pl.get(e)?.hideContentHover()}},gEt=class extends Di{constructor(){super({id:L9i,label:L(1282,"Scroll Up Hover"),precondition:pe.hoverFocused,kbOpts:{kbExpr:pe.hoverFocused,primary:16,weight:100},metadata:{description:L(1283,"Scroll up the editor hover.")}})}run(i,e){let t=Pl.get(e);t&&t.scrollUp()}},fEt=class extends Di{constructor(){super({id:R9i,label:L(1276,"Scroll Down Hover"),precondition:pe.hoverFocused,kbOpts:{kbExpr:pe.hoverFocused,primary:18,weight:100},metadata:{description:L(1277,"Scroll down the editor hover.")}})}run(i,e){let t=Pl.get(e);t&&t.scrollDown()}},vEt=class extends Di{constructor(){super({id:M9i,label:L(1278,"Scroll Left Hover"),precondition:pe.hoverFocused,kbOpts:{kbExpr:pe.hoverFocused,primary:15,weight:100},metadata:{description:L(1279,"Scroll left the editor hover.")}})}run(i,e){let t=Pl.get(e);t&&t.scrollLeft()}},bEt=class extends Di{constructor(){super({id:P9i,label:L(1280,"Scroll Right Hover"),precondition:pe.hoverFocused,kbOpts:{kbExpr:pe.hoverFocused,primary:17,weight:100},metadata:{description:L(1281,"Scroll right the editor hover.")}})}run(i,e){let t=Pl.get(e);t&&t.scrollRight()}},SEt=class extends Di{constructor(){super({id:A9i,label:L(1274,"Page Up Hover"),precondition:pe.hoverFocused,kbOpts:{kbExpr:pe.hoverFocused,primary:11,secondary:[528],weight:100},metadata:{description:L(1275,"Page up the editor hover.")}})}run(i,e){let t=Pl.get(e);t&&t.pageUp()}},IEt=class extends Di{constructor(){super({id:N9i,label:L(1272,"Page Down Hover"),precondition:pe.hoverFocused,kbOpts:{kbExpr:pe.hoverFocused,primary:12,secondary:[530],weight:100},metadata:{description:L(1273,"Page down the editor hover.")}})}run(i,e){let t=Pl.get(e);t&&t.pageDown()}},yEt=class extends Di{constructor(){super({id:O9i,label:L(1269,"Go To Top Hover"),precondition:pe.hoverFocused,kbOpts:{kbExpr:pe.hoverFocused,primary:14,secondary:[2064],weight:100},metadata:{description:L(1270,"Go to the top of the editor hover.")}})}run(i,e){let t=Pl.get(e);t&&t.goToTop()}},wEt=class extends Di{constructor(){super({id:F9i,label:L(1267,"Go To Bottom Hover"),precondition:pe.hoverFocused,kbOpts:{kbExpr:pe.hoverFocused,primary:13,secondary:[2066],weight:100},metadata:{description:L(1268,"Go to the bottom of the editor hover.")}})}run(i,e){let t=Pl.get(e);t&&t.goToBottom()}},CEt=class extends Di{constructor(){super({id:Nz,label:V9i,alias:"Increase Hover Verbosity Level",precondition:pe.hoverVisible})}run(i,e,t){let o=Pl.get(e);if(!o)return;let n=t?.index!==void 0?t.index:o.focusedHoverPartIndex();o.updateHoverVerbosityLevel(0,n,t?.focus)}},xEt=class extends Di{constructor(){super({id:Oz,label:H9i,alias:"Decrease Hover Verbosity Level",precondition:pe.hoverVisible})}run(i,e,t){let o=Pl.get(e);if(!o)return;let n=t?.index!==void 0?t.index:o.focusedHoverPartIndex();Pl.get(e)?.updateHoverVerbosityLevel(1,n,t?.focus)}};var kEt=class{constructor(i){this._editor=i}computeSync(i){let e=r=>({value:r}),t=this._editor.getLineDecorations(i.lineNumber),o=[],n=i.laneOrLine==="lineNo";if(!t)return o;for(let r of t){let s=r.options.glyphMargin?.position??2;if(!n&&s!==i.laneOrLine)continue;let l=n?r.options.lineNumberHoverMessage:r.options.glyphMarginHoverMessage;!l||UV(l)||o.push(...cc(l).map(e))}return o}};var kXi=_,gX=class extends x{constructor(e,t){super();this._markdownRendererService=t;this.allowEditorOverflow=!0;this._renderDisposeables=this._register(new N);this._editor=e,this._isVisible=!1,this._messages=[],this._hover=this._register(new bY(!0)),this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible),this._hoverOperation=this._register(new bxe(this._editor,new kEt(this._editor))),this._register(this._hoverOperation.onResult(o=>this._withResult(o))),this._register(this._editor.onDidChangeModelDecorations(()=>this._onModelDecorationsChanged())),this._register(this._editor.onDidChangeConfiguration(o=>{o.hasChanged(59)&&this._updateFont()})),this._register(Jo(this._hover.containerDomNode,"mouseleave",o=>{this._onMouseLeave(o)})),this._editor.addOverlayWidget(this)}static{this.ID="editor.contrib.modesGlyphHoverWidget"}dispose(){this._hoverComputerOptions=void 0,this._editor.removeOverlayWidget(this),super.dispose()}getId(){return gX.ID}getDomNode(){return this._hover.containerDomNode}getPosition(){return null}_updateFont(){Array.prototype.slice.call(this._hover.contentsDomNode.getElementsByClassName("code")).forEach(t=>this._editor.applyFontInfo(t))}_onModelDecorationsChanged(){this._isVisible&&this._hoverComputerOptions&&(this._hoverOperation.cancel(),this._hoverOperation.start(0,this._hoverComputerOptions))}showsOrWillShow(e){let t=e.target;return t.type===2&&t.detail.glyphMarginLane?(this._startShowingAt(t.position.lineNumber,t.detail.glyphMarginLane),!0):t.type===3?(this._startShowingAt(t.position.lineNumber,"lineNo"),!0):!1}_startShowingAt(e,t){this._hoverComputerOptions&&this._hoverComputerOptions.lineNumber===e&&this._hoverComputerOptions.laneOrLine===t||(this._hoverOperation.cancel(),this.hide(),this._hoverComputerOptions={lineNumber:e,laneOrLine:t},this._hoverOperation.start(0,this._hoverComputerOptions))}hide(){this._hoverComputerOptions=void 0,this._hoverOperation.cancel(),this._isVisible&&(this._isVisible=!1,this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible))}_withResult(e){this._messages=e.value,this._messages.length>0?this._renderMessages(e.options.lineNumber,e.options.laneOrLine,this._messages):this.hide()}_renderMessages(e,t,o){this._renderDisposeables.clear();let n=document.createDocumentFragment();for(let r of o){let s=kXi("div.hover-row.markdown-hover"),l=M(s,kXi("div.hover-contents")),c=this._renderDisposeables.add(this._markdownRendererService.render(r.value,{context:this._editor}));l.appendChild(c.element),n.appendChild(s)}this._updateContents(n),this._showAt(e,t)}_updateContents(e){this._hover.contentsDomNode.textContent="",this._hover.contentsDomNode.appendChild(e),this._updateFont()}_showAt(e,t){this._isVisible||(this._isVisible=!0,this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible));let o=this._editor.getLayoutInfo(),n=this._editor.getTopForLineNumber(e),r=this._editor.getScrollTop(),s=this._editor.getOption(75),l=this._hover.containerDomNode.clientHeight,c=n-r-(l-s)/2,u=o.glyphMarginLeft+o.glyphMarginWidth+(t==="lineNo"?o.lineNumbersWidth:0),h=o.height-l,g=Math.max(0,Math.min(Math.round(c),h));if(this._editor.getOption(51)){let v=this._editor.getDomNode();if(v){let b=ir(v);this._hover.containerDomNode.style.position="fixed",this._hover.containerDomNode.style.left=`${b.left+u}px`,this._hover.containerDomNode.style.top=`${b.top+g}px`}}else this._hover.containerDomNode.style.position="absolute",this._hover.containerDomNode.style.left=`${u}px`,this._hover.containerDomNode.style.top=`${g}px`;this._hover.containerDomNode.style.zIndex="11"}_onMouseLeave(e){let t=this._editor.getDomNode();(!t||!NY(t,e.x,e.y))&&this.hide()}};gX=I([m(1,On)],gX);var EEt=!1,ff=class extends x{constructor(e,t){super();this._editor=e;this._instantiationService=t;this.shouldKeepOpenOnEditorMouseMoveOrLeave=!1;this._listenersStore=new N;this._hoverState={mouseDown:!1};this._reactToEditorMouseMoveRunner=this._register(new Dt(()=>this._reactToEditorMouseMove(this._mouseMoveEvent),0)),this._hookListeners(),this._register(this._editor.onDidChangeConfiguration(o=>{o.hasChanged(69)&&(this._unhookListeners(),this._hookListeners())}))}static{this.ID="editor.contrib.marginHover"}static get(e){return e.getContribution(ff.ID)}_hookListeners(){let e=this._editor.getOption(69);this._hoverSettings={enabled:e.enabled,sticky:e.sticky,hidingDelay:e.hidingDelay},e.enabled!=="off"?(this._listenersStore.add(this._editor.onMouseDown(t=>this._onEditorMouseDown(t))),this._listenersStore.add(this._editor.onMouseUp(()=>this._onEditorMouseUp())),this._listenersStore.add(this._editor.onMouseMove(t=>this._onEditorMouseMove(t))),this._listenersStore.add(this._editor.onKeyDown(t=>this._onKeyDown(t)))):(this._listenersStore.add(this._editor.onMouseMove(t=>this._onEditorMouseMove(t))),this._listenersStore.add(this._editor.onKeyDown(t=>this._onKeyDown(t)))),this._listenersStore.add(this._editor.onMouseLeave(t=>this._onEditorMouseLeave(t))),this._listenersStore.add(this._editor.onDidChangeModel(()=>{this._cancelScheduler(),this.hideGlyphHover()})),this._listenersStore.add(this._editor.onDidChangeModelContent(()=>this._cancelScheduler())),this._listenersStore.add(this._editor.onDidScrollChange(t=>this._onEditorScrollChanged(t)))}_unhookListeners(){this._listenersStore.clear()}_cancelScheduler(){this._mouseMoveEvent=void 0,this._reactToEditorMouseMoveRunner.cancel()}_onEditorScrollChanged(e){(e.scrollTopChanged||e.scrollLeftChanged)&&this.hideGlyphHover()}_onEditorMouseDown(e){this._hoverState.mouseDown=!0,!this._isMouseOnGlyphHoverWidget(e)&&this.hideGlyphHover()}_isMouseOnGlyphHoverWidget(e){let t=this._glyphWidget?.getDomNode();return t?NY(t,e.event.posx,e.event.posy):!1}_onEditorMouseUp(){this._hoverState.mouseDown=!1}_onEditorMouseLeave(e){this.shouldKeepOpenOnEditorMouseMoveOrLeave||(this._cancelScheduler(),this._isMouseOnGlyphHoverWidget(e))||EEt||this.hideGlyphHover()}_shouldNotRecomputeCurrentHoverWidget(e){let t=this._hoverSettings.sticky,o=this._isMouseOnGlyphHoverWidget(e);return t&&o}_onEditorMouseMove(e){if(this.shouldKeepOpenOnEditorMouseMoveOrLeave)return;if(this._mouseMoveEvent=e,this._shouldNotRecomputeCurrentHoverWidget(e)){this._reactToEditorMouseMoveRunner.cancel();return}this._reactToEditorMouseMove(e)}_reactToEditorMouseMove(e){if(!e)return;if(!mCt(this._hoverSettings.enabled,this._editor.getOption(86),e)){if(EEt)return;this.hideGlyphHover();return}this._tryShowHoverWidget(e)||EEt||this.hideGlyphHover()}_tryShowHoverWidget(e){return this._getOrCreateGlyphWidget().showsOrWillShow(e)}_onKeyDown(e){if(this._editor.hasModel()){if(this._hoverSettings.enabled==="onKeyboardModifier"&&a3e(this._editor.getOption(86),e)&&this._mouseMoveEvent){this._tryShowHoverWidget(this._mouseMoveEvent);return}XN(e.keyCode)||this.hideGlyphHover()}}hideGlyphHover(){EEt||this._glyphWidget?.hide()}_getOrCreateGlyphWidget(){return this._glyphWidget||(this._glyphWidget=this._instantiationService.createInstance(gX,this._editor)),this._glyphWidget}dispose(){super.dispose(),this._unhookListeners(),this._listenersStore.dispose(),this._glyphWidget?.dispose()}};ff=I([m(1,F)],ff);var yui;(e=>(e.increaseVerbosity=d(1264,null,`<keybinding:${Nz}>`),e.decreaseVerbosity=d(1263,null,`<keybinding:${Oz}>`)))(yui||={});var TEt=class{constructor(){this.type="view";this.priority=95;this.name="hover";this.when=pe.hoverFocused}getProvider(i){let e=i.get(qt),t=e.getActiveCodeEditor()||e.getFocusedCodeEditor();if(!t)throw new Error("No active or focused code editor");let o=Pl.get(t);if(!o)return;let n=i.get(_e);return i.get(F).createInstance(wui,n,t,o)}},_Et=class{constructor(){this.priority=100;this.name="hover";this.type="help";this.when=pe.hoverVisible}getProvider(i){let e=i.get(qt),t=e.getActiveCodeEditor()||e.getFocusedCodeEditor();if(!t)throw new Error("No active or focused code editor");let o=Pl.get(t);if(o)return i.get(F).createInstance(LEt,o)}},DEt=class extends x{constructor(e){super();this._hoverController=e;this.id="hover";this.verbositySettingKey="accessibility.verbosity.hover";this._onDidChangeContent=this._register(new E);this.onDidChangeContent=this._onDidChangeContent.event;this._focusedHoverPartIndex=-1}onOpen(){this._hoverController&&(this._hoverController.shouldKeepOpenOnEditorMouseMoveOrLeave=!0,this._focusedHoverPartIndex=this._hoverController.focusedHoverPartIndex(),this._register(this._hoverController.onHoverContentsChanged(()=>{this._onDidChangeContent.fire()})))}onClose(){this._hoverController&&(this._focusedHoverPartIndex===-1?this._hoverController.focus():this._hoverController.focusHoverPartWithIndex(this._focusedHoverPartIndex),this._focusedHoverPartIndex=-1,this._hoverController.shouldKeepOpenOnEditorMouseMoveOrLeave=!1)}provideContentAtIndex(e,t){if(e!==-1){let o=this._hoverController.getAccessibleWidgetContentAtIndex(e);if(o===void 0)return"";let n=[];return t&&n.push(...this._descriptionsOfVerbosityActionsForIndex(e)),n.push(o),n.join(`
`)}else{let o=this._hoverController.getAccessibleWidgetContent();if(o===void 0)return"";let n=[];return n.push(o),n.join(`
`)}}_descriptionsOfVerbosityActionsForIndex(e){let t=[],o=this._descriptionOfVerbosityActionForIndex(0,e);o!==void 0&&t.push(o);let n=this._descriptionOfVerbosityActionForIndex(1,e);return n!==void 0&&t.push(n),t}_descriptionOfVerbosityActionForIndex(e,t){if(this._hoverController.doesHoverAtIndexSupportVerbosityAction(t,e))switch(e){case 0:return yui.increaseVerbosity;case 1:return yui.decreaseVerbosity}}},LEt=class extends DEt{constructor(e){super(e);this.options={type:"help"}}provideContent(){return this.provideContentAtIndex(this._focusedHoverPartIndex,!0)}},wui=class extends DEt{constructor(e,t,o){super(o);this._keybindingService=e;this._editor=t;this.options={type:"view"};this._initializeOptions(this._editor,o)}provideContent(){return this.provideContentAtIndex(this._focusedHoverPartIndex,!1)}get actions(){let e=[];return e.push(this._getActionFor(this._editor,0)),e.push(this._getActionFor(this._editor,1)),e}_getActionFor(e,t){let o,n,r;switch(t){case 0:o=Nz,n=W9i,r=R.add;break;case 1:o=Oz,n=B9i,r=R.remove;break}let s=dai(this._keybindingService,t),l=this._hoverController.doesHoverAtIndexSupportVerbosityAction(this._focusedHoverPartIndex,t);return new it(n,s,q.asClassName(r),l,()=>{e.getAction(o)?.run({index:this._focusedHoverPartIndex,focus:!1})})}_initializeOptions(e,t){let o=this._register(new LEt(t));this.options.language=e.getModel()?.getLanguageId(),this.options.customHelp=()=>o.provideContentAtIndex(this._focusedHoverPartIndex,!0)}},REt=class{constructor(){this.type="view";this.priority=90;this.name="extension-hover"}getProvider(i){let t=i.get(Wn).getContextViewElement(),o=t?.textContent??void 0,n=i.get(nt);if(!(t.classList.contains("accessible-view-container")||!o))return new xp("hover",{language:"typescript",type:"view"},()=>o,()=>{n.showAndFocusLastHover()},"accessibility.verbosity.hover")}};xo(Pl.ID,Pl,2);xo(ff.ID,ff,2);ni(pEt);ni(mEt);ni(hEt);ni(gEt);ni(fEt);ni(vEt);ni(bEt);ni(SEt);ni(IEt);ni(yEt);ni(wEt);ni(CEt);ni(xEt);z_.register(Gz);z_.register(Gxe);$e.registerCommand(o3e,a=>{a.get(B).updateValue("editor.hover.showLongLineWarning",!1)});is((a,i)=>{let e=a.getColor(G1);e&&(i.addRule(`.monaco-editor .monaco-hover .hover-row:not(:first-child):not(:empty) { border-top: 1px solid ${e.transparent(.5)}; }`),i.addRule(`.monaco-editor .monaco-hover hr { border-top: 1px solid ${e.transparent(.5)}; }`),i.addRule(`.monaco-editor .monaco-hover hr { border-bottom: 0px solid ${e.transparent(.5)}; }`))});ga.register(new TEt);ga.register(new _Et);ga.register(new REt);function Cui(a,i,e,t){if(a.getLineCount()===1&&a.getLineMaxColumn(1)===1)return[];let o=i.getLanguageConfiguration(a.getLanguageId()).indentRulesSupport;if(!o)return[];let n=new Fae(a,o,i);for(t=Math.min(t,a.getLineCount());e<=t&&n.shouldIgnore(e);)e++;if(e>t-1)return[];let{tabSize:r,indentSize:s,insertSpaces:l}=a.getOptions(),c=(v,b)=>(b=b||1,lb.shiftIndent(v,v.length+b,r,s,l)),u=(v,b)=>(b=b||1,lb.unshiftIndent(v,v.length+b,r,s,l)),p=[],h=a.getLineContent(e),g=Ll(h),f=g;n.shouldIncrease(e)?(f=c(f),g=c(g)):n.shouldIndentNextLine(e)&&(f=c(f)),e++;for(let v=e;v<=t;v++){if(oGo(a,v))continue;let b=a.getLineContent(v),S=Ll(b),y=f;n.shouldDecrease(v,y)&&(f=u(f),g=u(g)),S!==f&&p.push(Hn.replaceMove(new ti(v,1,v,S.length+1),GIe(f,s,l))),!n.shouldIgnore(v)&&(n.shouldIncrease(v,y)?(g=c(g),f=g):n.shouldIndentNextLine(v,y)?f=c(f):f=g)}return p}function oGo(a,i){return a.tokenization.isCheapToTokenize(i)?a.tokenization.getLineTokens(i).getStandardTokenType(0)===2:!1}var J8e=class a extends Di{static{this.ID="editor.action.indentationToSpaces"}constructor(){super({id:a.ID,label:L(1315,"Convert Indentation to Spaces"),precondition:pe.writable,metadata:{description:L(1316,"Convert the tab indentation to spaces.")}})}run(i,e){let t=e.getModel();if(!t)return;let o=t.getOptions(),n=e.getSelection();if(!n)return;let r=new Tui(n,o.tabSize);e.pushUndoStop(),e.executeCommands(this.id,[r]),e.pushUndoStop(),t.updateOptions({insertSpaces:!0})}},Z8e=class a extends Di{static{this.ID="editor.action.indentationToTabs"}constructor(){super({id:a.ID,label:L(1317,"Convert Indentation to Tabs"),precondition:pe.writable,metadata:{description:L(1318,"Convert the spaces indentation to tabs.")}})}run(i,e){let t=e.getModel();if(!t)return;let o=t.getOptions(),n=e.getSelection();if(!n)return;let r=new _ui(n,o.tabSize);e.pushUndoStop(),e.executeCommands(this.id,[r]),e.pushUndoStop(),t.updateOptions({insertSpaces:!1})}},eQe=class extends Di{constructor(e,t,o){super(o);this.insertSpaces=e;this.displaySizeOnly=t}run(e,t){let o=e.get(Ue),n=e.get(Tt),r=t.getModel();if(!r)return;let s=n.getCreationOptions(r.getLanguageId(),r.uri,r.isForSimpleWidget),l=r.getOptions(),c=[1,2,3,4,5,6,7,8].map(p=>({id:p.toString(),label:p.toString(),description:p===s.tabSize&&p===l.tabSize?d(1306,null):p===s.tabSize?d(1308,null):p===l.tabSize?d(1307,null):void 0})),u=Math.min(r.getOptions().tabSize-1,7);setTimeout(()=>{o.pick(c,{placeHolder:d(1323,null),activeItem:c[u]}).then(p=>{if(p&&r&&!r.isDisposed()){let h=parseInt(p.label,10);this.displaySizeOnly?r.updateOptions({tabSize:h}):r.updateOptions({tabSize:h,indentSize:h,insertSpaces:this.insertSpaces})}})},50)}},tQe=class a extends eQe{static{this.ID="editor.action.indentUsingTabs"}constructor(){super(!1,!1,{id:a.ID,label:L(1321,"Indent Using Tabs"),precondition:void 0,metadata:{description:L(1322,"Use indentation with tabs.")}})}},iQe=class a extends eQe{static{this.ID="editor.action.indentUsingSpaces"}constructor(){super(!0,!1,{id:a.ID,label:L(1319,"Indent Using Spaces"),precondition:void 0,metadata:{description:L(1320,"Use indentation with spaces.")}})}},oQe=class a extends eQe{static{this.ID="editor.action.changeTabDisplaySize"}constructor(){super(!0,!0,{id:a.ID,label:L(1304,"Change Tab Display Size"),precondition:void 0,metadata:{description:L(1305,"Change the space size equivalent of the tab.")}})}},nQe=class a extends Di{static{this.ID="editor.action.detectIndentation"}constructor(){super({id:a.ID,label:L(1309,"Detect Indentation from Content"),precondition:void 0,metadata:{description:L(1310,"Detect the indentation from content.")}})}run(i,e){let t=i.get(Tt),o=e.getModel();if(!o)return;let n=t.getCreationOptions(o.getLanguageId(),o.uri,o.isForSimpleWidget);o.detectIndentation(n.insertSpaces,n.tabSize)}},xui=class extends Di{constructor(){super({id:"editor.action.reindentlines",label:L(1311,"Reindent Lines"),precondition:pe.writable,metadata:{description:L(1312,"Reindent the lines of the editor.")},canTriggerInlineEdits:!0})}run(i,e){let t=i.get(Rs),o=e.getModel();if(!o)return;let n=Cui(o,t,1,o.getLineCount());n.length>0&&(e.pushUndoStop(),e.executeEdits(this.id,n),e.pushUndoStop())}},kui=class extends Di{constructor(){super({id:"editor.action.reindentselectedlines",label:L(1313,"Reindent Selected Lines"),precondition:pe.writable,metadata:{description:L(1314,"Reindent the selected lines of the editor.")},canTriggerInlineEdits:!0})}run(i,e){let t=i.get(Rs),o=e.getModel();if(!o)return;let n=e.getSelections();if(n===null)return;let r=[];for(let s of n){let l=s.startLineNumber,c=s.endLineNumber;if(l!==c&&s.endColumn===1&&c--,l===1){if(l===c)continue}else l--;let u=Cui(o,t,l,c);r.push(...u)}r.length>0&&(e.pushUndoStop(),e.executeEdits(this.id,r),e.pushUndoStop())}},Eui=class{constructor(i,e){this._initialSelection=e,this._edits=[],this._selectionId=null;for(let t of i)t.range&&typeof t.text=="string"&&this._edits.push(t)}getEditOperations(i,e){for(let o of this._edits)e.addEditOperation(z.lift(o.range),o.text);let t=!1;Array.isArray(this._edits)&&this._edits.length===1&&this._initialSelection.isEmpty()&&(this._edits[0].range.startColumn===this._initialSelection.endColumn&&this._edits[0].range.startLineNumber===this._initialSelection.endLineNumber?(t=!0,this._selectionId=e.trackSelection(this._initialSelection,!0)):this._edits[0].range.endColumn===this._initialSelection.startColumn&&this._edits[0].range.endLineNumber===this._initialSelection.startLineNumber&&(t=!0,this._selectionId=e.trackSelection(this._initialSelection,!1))),t||(this._selectionId=e.trackSelection(this._initialSelection))}computeCursorState(i,e){return e.getTrackedSelection(this._selectionId)}},Bke=class{constructor(i,e){this.editor=i;this._languageConfigurationService=e;this.callOnDispose=new N;this.callOnModel=new N;this.callOnDispose.add(i.onDidChangeConfiguration(()=>this.update())),this.callOnDispose.add(i.onDidChangeModel(()=>this.update())),this.callOnDispose.add(i.onDidChangeModelLanguage(()=>this.update()))}static{this.ID="editor.contrib.autoIndentOnPaste"}update(){this.callOnModel.clear(),!(!this.editor.getOption(17)||this.editor.getOption(16)<4)&&this.editor.hasModel()&&this.callOnModel.add(this.editor.onDidPaste(({range:i})=>{this.trigger(i)}))}trigger(i){let e=this.editor.getSelections();if(e===null||e.length>1)return;let t=this.editor.getModel();if(!t||this.rangeContainsOnlyWhitespaceCharacters(t,i)||!this.editor.getOption(18)&&nGo(t,i)||!t.tokenization.isCheapToTokenize(i.getStartPosition().lineNumber))return;let n=this.editor.getOption(16),{tabSize:r,indentSize:s,insertSpaces:l}=t.getOptions(),c=[],u={shiftIndent:f=>lb.shiftIndent(f,f.length+1,r,s,l),unshiftIndent:f=>lb.unshiftIndent(f,f.length+1,r,s,l)},p=i.startLineNumber,h=t.getLineContent(p);if(!/\S/.test(h.substring(0,i.startColumn-1))){let f=Bae(n,t,t.getLanguageId(),p,u,this._languageConfigurationService);if(f!==null){let v=Ll(h),b=ak(f,r),S=ak(v,r);if(b!==S){let y=Xce(b,r,l);c.push({range:new z(p,1,p,v.length+1),text:y}),h=y+h.substring(v.length)}else{let y=Aft(t,p,this._languageConfigurationService);if(y===0||y===8)return}}}let g=p;for(;p<i.endLineNumber;){if(!/\S/.test(t.getLineContent(p+1))){p++;continue}break}if(p!==i.endLineNumber){let v=Bae(n,{tokenization:{getLineTokens:b=>t.tokenization.getLineTokens(b),getLanguageId:()=>t.getLanguageId(),getLanguageIdAtPosition:(b,S)=>t.getLanguageIdAtPosition(b,S)},getLineContent:b=>b===g?h:t.getLineContent(b)},t.getLanguageId(),p+1,u,this._languageConfigurationService);if(v!==null){let b=ak(v,r),S=ak(Ll(t.getLineContent(p+1)),r);if(b!==S){let y=b-S;for(let w=p+1;w<=i.endLineNumber;w++){let k=t.getLineContent(w),T=Ll(k),O=ak(T,r)+y,V=Xce(O,r,l);V!==T&&c.push({range:new z(w,1,w,T.length+1),text:V})}}}}if(c.length>0){this.editor.pushUndoStop();let f=new Eui(c,this.editor.getSelection());this.editor.executeCommand("autoIndentOnPaste",f),this.editor.pushUndoStop()}}rangeContainsOnlyWhitespaceCharacters(i,e){let t=n=>n.trim().length===0,o=!0;if(e.startLineNumber===e.endLineNumber){let r=i.getLineContent(e.startLineNumber).substring(e.startColumn-1,e.endColumn-1);o=t(r)}else for(let n=e.startLineNumber;n<=e.endLineNumber;n++){let r=i.getLineContent(n);if(n===e.startLineNumber){let s=r.substring(e.startColumn-1);o=t(s)}else if(n===e.endLineNumber){let s=r.substring(0,e.endColumn-1);o=t(s)}else o=i.getLineFirstNonWhitespaceColumn(n)===0;if(!o)break}return o}dispose(){this.callOnDispose.dispose(),this.callOnModel.dispose()}};Bke=I([m(1,Rs)],Bke);function nGo(a,i){let e=t=>sji(a,t)===2;return e(i.getStartPosition())||e(i.getEndPosition())}function EXi(a,i,e,t){if(a.getLineCount()===1&&a.getLineMaxColumn(1)===1)return;let o="";for(let r=0;r<e;r++)o+=" ";let n=new RegExp(o,"gi");for(let r=1,s=a.getLineCount();r<=s;r++){let l=a.getLineFirstNonWhitespaceColumn(r);if(l===0&&(l=a.getLineMaxColumn(r)),l===1)continue;let c=new z(r,1,r,l),u=a.getValueInRange(c),p=t?u.replace(/\t/ig,o):u.replace(n,"	");i.addEditOperation(c,p)}}var Tui=class{constructor(i,e){this.selection=i;this.tabSize=e;this.selectionId=null}getEditOperations(i,e){this.selectionId=e.trackSelection(this.selection),EXi(i,e,this.tabSize,!0)}computeCursorState(i,e){return e.getTrackedSelection(this.selectionId)}},_ui=class{constructor(i,e){this.selection=i;this.tabSize=e;this.selectionId=null}getEditOperations(i,e){this.selectionId=e.trackSelection(this.selection),EXi(i,e,this.tabSize,!1)}computeCursorState(i,e){return e.getTrackedSelection(this.selectionId)}};xo(Bke.ID,Bke,2);ni(J8e);ni(Z8e);ni(tQe);ni(iQe);ni(oQe);ni(nQe);ni(xui);ni(kui);xo(QE.ID,QE,1);z_.register($Y);var MEt=class{constructor(i,e,t){this._editRange=i,this._originalSelection=e,this._text=t}getEditOperations(i,e){e.addTrackedEditOperation(this._editRange,this._text)}computeCursorState(i,e){let o=e.getInverseEditOperations()[0].range;return this._originalSelection.isEmpty()?new ti(o.endLineNumber,Math.min(this._originalSelection.positionColumn,o.endColumn),o.endLineNumber,Math.min(this._originalSelection.positionColumn,o.endColumn)):new ti(o.endLineNumber,o.endColumn-this._text.length,o.endLineNumber,o.endColumn)}};var uB=class{static{this.ID="editor.contrib.inPlaceReplaceController"}static get(i){return i.getContribution(uB.ID)}static{this.DECORATION=mo.register({description:"in-place-replace",className:"valueSetReplacement"})}constructor(i,e){this.editor=i,this.editorWorkerService=e,this.decorations=this.editor.createDecorationsCollection()}dispose(){}run(i,e){this.currentRequest?.cancel();let t=this.editor.getSelection(),o=this.editor.getModel();if(!o||!t)return;let n=t;if(n.startLineNumber!==n.endLineNumber)return;let r=new Mz(this.editor,5),s=o.uri;return this.editorWorkerService.canNavigateValueSet(s)?(this.currentRequest=Ln(l=>this.editorWorkerService.navigateValueSet(s,n,e)),this.currentRequest.then(l=>{if(!l||!l.range||!l.value||!r.validate(this.editor))return;let c=z.lift(l.range),u=l.range,p=l.value.length-(n.endColumn-n.startColumn);u={startLineNumber:u.startLineNumber,startColumn:u.startColumn,endLineNumber:u.endLineNumber,endColumn:u.startColumn+l.value.length},p>1&&(n=new ti(n.startLineNumber,n.startColumn,n.endLineNumber,n.endColumn+p-1));let h=new MEt(c,n,l.value);this.editor.pushUndoStop(),this.editor.executeCommand(i,h),this.editor.pushUndoStop(),this.decorations.set([{range:u,options:uB.DECORATION}]),this.decorationRemover?.cancel(),this.decorationRemover=Li(350),this.decorationRemover.then(()=>this.decorations.clear()).catch(mt)}).catch(mt)):Promise.resolve(void 0)}};uB=I([m(1,Qs)],uB);var Dui=class extends Di{constructor(){super({id:"editor.action.inPlaceReplace.up",label:L(1404,"Replace with Previous Value"),precondition:pe.writable,kbOpts:{kbExpr:pe.editorTextFocus,primary:3159,weight:100}})}run(i,e){let t=uB.get(e);return t?t.run(this.id,!1):Promise.resolve(void 0)}},Lui=class extends Di{constructor(){super({id:"editor.action.inPlaceReplace.down",label:L(1403,"Replace with Next Value"),precondition:pe.writable,kbOpts:{kbExpr:pe.editorTextFocus,primary:3161,weight:100}})}run(i,e){let t=uB.get(e);return t?t.run(this.id,!0):Promise.resolve(void 0)}};xo(uB.ID,uB,4);ni(Dui);ni(Lui);var PEt=class{constructor(i){this._selection=i,this._selectionId=null}getEditOperations(i,e){let t=rGo(i);t&&e.addEditOperation(t.range,t.text),this._selectionId=e.trackSelection(this._selection)}computeCursorState(i,e){return e.getTrackedSelection(this._selectionId)}};function rGo(a){let i=a.getLineCount(),e=a.getLineContent(i),t=hv(e)===-1;if(!(!i||t))return Hn.insert(new ye(i,a.getLineMaxColumn(i)),a.getEOL())}var Rui=class a extends Di{static{this.ID="editor.action.insertFinalNewLine"}constructor(){super({id:a.ID,label:L(1405,"Insert Final New Line"),precondition:pe.writable})}run(i,e,t){let o=e.getSelection();if(o===null)return;let n=new PEt(o);e.pushUndoStop(),e.executeCommands(this.id,[n]),e.pushUndoStop()}};ni(Rui);var Mui=class extends Di{constructor(){super({id:"expandLineSelection",label:L(1406,"Expand Line Selection"),precondition:void 0,kbOpts:{weight:0,kbExpr:pe.textInputFocus,primary:2090}})}run(i,e,t){if(t=t||{},!e.hasModel())return;let o=e._getViewModel();o.model.pushStackElement(),o.setCursorStates(t.source,3,sf.expandLineSelection(o,o.getCursorStates())),o.revealAllCursors(t.source,!0)}};ni(Mui);var TXi=new Y("LinkedEditingInputVisible",!1),sGo="linked-editing-decoration",pB=class extends x{constructor(e,t,o,n,r){super();this.languageConfigurationService=n;this._syncRangesToken=0;this._localToDispose=this._register(new N);this._editor=e,this._providers=o.linkedEditingRangeProvider,this._enabled=!1,this._visibleContextKey=TXi.bindTo(t),this._debounceInformation=r.for(this._providers,"Linked Editing",{max:200}),this._currentDecorations=this._editor.createDecorationsCollection(),this._languageWordPattern=null,this._currentWordPattern=null,this._ignoreChangeEvent=!1,this._localToDispose=this._register(new N),this._rangeUpdateTriggerPromise=null,this._rangeSyncTriggerPromise=null,this._currentRequestCts=null,this._currentRequestPosition=null,this._currentRequestModelVersion=null,this._register(this._editor.onDidChangeModel(()=>this.reinitialize(!0))),this._register(this._editor.onDidChangeConfiguration(s=>{(s.hasChanged(78)||s.hasChanged(106))&&this.reinitialize(!1)})),this._register(this._providers.onDidChange(()=>this.reinitialize(!1))),this._register(this._editor.onDidChangeModelLanguage(()=>this.reinitialize(!0))),this.reinitialize(!0)}static{this.ID="editor.contrib.linkedEditing"}static{this.DECORATION=mo.register({description:"linked-editing",stickiness:0,className:sGo})}static get(e){return e.getContribution(pB.ID)}reinitialize(e){let t=this._editor.getModel(),o=t!==null&&(this._editor.getOption(78)||this._editor.getOption(106))&&this._providers.has(t);if(o===this._enabled&&!e||(this._enabled=o,this.clearRanges(),this._localToDispose.clear(),!o||t===null))return;this._localToDispose.add(U.runAndSubscribe(t.onDidChangeLanguageConfiguration,()=>{this._languageWordPattern=this.languageConfigurationService.getLanguageConfiguration(t.getLanguageId()).getWordDefinition()}));let n=new Xo(this._debounceInformation.get(t)),r=()=>{this._rangeUpdateTriggerPromise=n.trigger(()=>this.updateRanges(),this._debounceDuration??this._debounceInformation.get(t))},s=new Xo(0),l=c=>{this._rangeSyncTriggerPromise=s.trigger(()=>this._syncRanges(c))};this._localToDispose.add(this._editor.onDidChangeCursorPosition(()=>{r()})),this._localToDispose.add(this._editor.onDidChangeModelContent(c=>{if(!this._ignoreChangeEvent&&this._currentDecorations.length>0){let u=this._currentDecorations.getRange(0);if(u&&c.changes.every(p=>u.intersectRanges(p.range))){l(this._syncRangesToken);return}}r()})),this._localToDispose.add({dispose:()=>{n.dispose(),s.dispose()}}),this.updateRanges()}_syncRanges(e){if(!this._editor.hasModel()||e!==this._syncRangesToken||this._currentDecorations.length===0)return;let t=this._editor.getModel(),o=this._currentDecorations.getRange(0);if(!o||o.startLineNumber!==o.endLineNumber)return this.clearRanges();let n=t.getValueInRange(o);if(this._currentWordPattern){let s=n.match(this._currentWordPattern);if((s?s[0].length:0)!==n.length)return this.clearRanges()}let r=[];for(let s=1,l=this._currentDecorations.length;s<l;s++){let c=this._currentDecorations.getRange(s);if(c)if(c.startLineNumber!==c.endLineNumber)r.push({range:c,text:n});else{let u=t.getValueInRange(c),p=n,h=c.startColumn,g=c.endColumn,f=tf(u,p);h+=f,u=u.substr(f),p=p.substr(f);let v=vC(u,p);g-=v,u=u.substr(0,u.length-v),p=p.substr(0,p.length-v),(h!==g||p.length!==0)&&r.push({range:new z(c.startLineNumber,h,c.endLineNumber,g),text:p})}}if(r.length!==0)try{this._editor.popUndoStop(),this._ignoreChangeEvent=!0;let s=this._editor._getViewModel().getPrevEditOperationType();this._editor.executeEdits("linkedEditing",r),this._editor._getViewModel().setPrevEditOperationType(s)}finally{this._ignoreChangeEvent=!1}}dispose(){this.clearRanges(),super.dispose()}clearRanges(){this._visibleContextKey.set(!1),this._currentDecorations.clear(),this._currentRequestCts&&(this._currentRequestCts.cancel(),this._currentRequestCts=null,this._currentRequestPosition=null)}get currentUpdateTriggerPromise(){return this._rangeUpdateTriggerPromise||Promise.resolve()}get currentSyncTriggerPromise(){return this._rangeSyncTriggerPromise||Promise.resolve()}async updateRanges(e=!1){if(!this._editor.hasModel()){this.clearRanges();return}let t=this._editor.getPosition();if(!this._enabled&&!e||this._editor.getSelections().length>1){this.clearRanges();return}let o=this._editor.getModel(),n=o.getVersionId();if(this._currentRequestPosition&&this._currentRequestModelVersion===n){if(t.equals(this._currentRequestPosition))return;if(this._currentDecorations.length>0){let s=this._currentDecorations.getRange(0);if(s&&s.containsPosition(t))return}}this._currentRequestPosition?.equals(t)||this._currentDecorations.getRange(0)?.containsPosition(t)||this.clearRanges(),this._currentRequestPosition=t,this._currentRequestModelVersion=n;let r=this._currentRequestCts=new Ye;try{let s=new Dn(!1),l=await _Xi(this._providers,o,t,r.token);if(this._debounceInformation.update(o,s.elapsed()),r!==this._currentRequestCts||(this._currentRequestCts=null,n!==o.getVersionId()))return;let c=[];l?.ranges&&(c=l.ranges),this._currentWordPattern=l?.wordPattern||this._languageWordPattern;let u=!1;for(let h=0,g=c.length;h<g;h++)if(z.containsPosition(c[h],t)){if(u=!0,h!==0){let f=c[h];c.splice(h,1),c.unshift(f)}break}if(!u){this.clearRanges();return}let p=c.map(h=>({range:h,options:pB.DECORATION}));this._visibleContextKey.set(!0),this._currentDecorations.set(p),this._syncRangesToken++}catch(s){ao(s)||mt(s),(this._currentRequestCts===r||!this._currentRequestCts)&&this.clearRanges()}}setDebounceDuration(e){this._debounceDuration=e}};pB=I([m(1,X),m(2,Qt),m(3,Rs),m(4,hf)],pB);var Pui=class extends Di{constructor(){super({id:"editor.action.linkedEditing",label:L(1439,"Start Linked Editing"),precondition:C.and(pe.writable,pe.hasRenameProvider),kbOpts:{kbExpr:pe.editorTextFocus,primary:3132,weight:100}})}runCommand(i,e){let t=i.get(qt),[o,n]=Array.isArray(e)&&e||[void 0,void 0];return A.isUri(o)&&ye.isIPosition(n)?t.openCodeEditor({resource:o},t.getActiveCodeEditor()).then(r=>{r&&(r.setPosition(n),r.invokeWithinContext(s=>(this.reportTelemetry(s,r),this.run(s,r))))},mt):super.runCommand(i,e)}run(i,e){let t=pB.get(e);return t?Promise.resolve(t.updateRanges(!0)):Promise.resolve()}},aGo=Oc.bindToContribution(pB.get);Xi(new aGo({id:"cancelLinkedEditingInput",precondition:TXi,handler:a=>a.clearRanges(),kbOpts:{kbExpr:pe.editorTextFocus,weight:199,primary:9,secondary:[1033]}}));function _Xi(a,i,e,t){let o=a.ordered(i);return nae(o.map(n=>async()=>{try{return await n.provideLinkedEditingRanges(i,e,t)}catch(r){ys(r);return}}),n=>!!n&&yr(n?.ranges))}var pqs=te("editor.linkedEditingBackground",{dark:We.fromHex("#f00").transparent(.3),light:We.fromHex("#f00").transparent(.3),hcDark:We.fromHex("#f00").transparent(.3),hcLight:We.white},d(1438,null));qS("_executeLinkedEditingProvider",(a,i,e)=>{let{linkedEditingRangeProvider:t}=a.get(Qt);return _Xi(t,i,e,Se.None)});xo(pB.ID,pB,1);ni(Pui);var Aui=class{constructor(i,e){this._link=i,this._provider=e}toJSON(){return{range:this.range,url:this.url,tooltip:this.tooltip}}get range(){return this._link.range}get url(){return this._link.url}get tooltip(){return this._link.tooltip}async resolve(i){return this._link.url?this._link.url:typeof this._provider.resolveLink=="function"?Promise.resolve(this._provider.resolveLink(this._link,i)).then(e=>(this._link=e||this._link,this._link.url?this.resolve(i):Promise.reject(new Error("missing")))):Promise.reject(new Error("missing"))}},AEt=class a{constructor(i){this._disposables=new N;let e=[];for(let[t,o]of i){let n=t.links.map(r=>new Aui(r,o));e=a._union(e,n),jc(t)&&(this._disposables??=new N,this._disposables.add(t))}this.links=e}static{this.Empty=new a([])}dispose(){this._disposables?.dispose(),this.links.length=0}static _union(i,e){let t=[],o,n,r,s;for(o=0,r=0,n=i.length,s=e.length;o<n&&r<s;){let l=i[o],c=e[r];if(z.areIntersectingOrTouching(l.range,c.range)){o++;continue}z.compareRangesUsingStarts(l.range,c.range)<0?(t.push(l),o++):(t.push(c),r++)}for(;o<n;o++)t.push(i[o]);for(;r<s;r++)t.push(e[r]);return t}};async function Nui(a,i,e){let t=[],o=a.ordered(i).reverse().map(async(r,s)=>{try{let l=await r.provideLinks(i,e);l&&(t[s]=[l,r])}catch(l){ys(l)}});await Promise.all(o);let n=new AEt(di(t));return e.isCancellationRequested&&(n.dispose(),n=AEt.Empty),n}$e.registerCommand("_executeLinkProvider",async(a,...i)=>{let[e,t]=i;wo(e instanceof A),typeof t!="number"&&(t=0);let{linkProvider:o}=a.get(Qt),n=a.get(Tt).getModel(e);if(!n)return[];let r=await Nui(o,n,Se.None);if(!r)return[];for(let l=0;l<Math.min(t,r.links.length);l++)await r.links[l].resolve(Se.None);let s=r.links.slice(0);return r.dispose(),s});var dk=class extends x{constructor(e,t,o,n,r){super();this.editor=e;this.openerService=t;this.notificationService=o;this.languageFeaturesService=n;this.providers=this.languageFeaturesService.linkProvider,this.debounceInformation=r.for(this.providers,"Links",{min:1e3,max:4e3}),this.computeLinks=this._register(new Dt(()=>this.computeLinksNow(),1e3)),this.computePromise=null,this.activeLinksList=null,this.currentOccurrences={},this.activeLinkDecorationId=null;let s=this._register(new JO(e));this._register(s.onMouseMoveOrRelevantKeyDown(([l,c])=>{this._onEditorMouseMove(l,c)})),this._register(s.onExecute(l=>{this.onEditorMouseUp(l)})),this._register(s.onCancel(l=>{this.cleanUpActiveLinkDecoration()})),this._register(e.onDidChangeConfiguration(l=>{l.hasChanged(79)&&(this.updateDecorations([]),this.stop(),this.computeLinks.schedule(0))})),this._register(e.onDidChangeModelContent(l=>{this.editor.hasModel()&&this.computeLinks.schedule(this.debounceInformation.get(this.editor.getModel()))})),this._register(e.onDidChangeModel(l=>{this.currentOccurrences={},this.activeLinkDecorationId=null,this.stop(),this.computeLinks.schedule(0)})),this._register(e.onDidChangeModelLanguage(l=>{this.stop(),this.computeLinks.schedule(0)})),this._register(this.providers.onDidChange(l=>{this.stop(),this.computeLinks.schedule(0)})),this.computeLinks.schedule(0)}static{this.ID="editor.linkDetector"}static get(e){return e.getContribution(dk.ID)}async computeLinksNow(){if(!this.editor.hasModel()||!this.editor.getOption(79))return;let e=this.editor.getModel();if(!e.isTooLargeForSyncing()&&this.providers.has(e)){this.activeLinksList&&(this.activeLinksList.dispose(),this.activeLinksList=null),this.computePromise=Ln(t=>Nui(this.providers,e,t));try{let t=new Dn(!1);if(this.activeLinksList=await this.computePromise,this.debounceInformation.update(e,t.elapsed()),e.isDisposed())return;this.updateDecorations(this.activeLinksList.links)}catch(t){mt(t)}finally{this.computePromise=null}}}updateDecorations(e){let t=this.editor.getOption(86)==="altKey",o=[],n=Object.keys(this.currentOccurrences);for(let s of n){let l=this.currentOccurrences[s];o.push(l.decorationId)}let r=[];if(e)for(let s of e)r.push(NEt.decoration(s,t));this.editor.changeDecorations(s=>{let l=s.deltaDecorations(o,r);this.currentOccurrences={},this.activeLinkDecorationId=null;for(let c=0,u=l.length;c<u;c++){let p=new NEt(e[c],l[c]);this.currentOccurrences[p.decorationId]=p}})}_onEditorMouseMove(e,t){let o=this.editor.getOption(86)==="altKey";if(this.isEnabled(e,t)){this.cleanUpActiveLinkDecoration();let n=this.getLinkOccurrence(e.target.position);n&&this.editor.changeDecorations(r=>{n.activate(r,o),this.activeLinkDecorationId=n.decorationId})}else this.cleanUpActiveLinkDecoration()}cleanUpActiveLinkDecoration(){let e=this.editor.getOption(86)==="altKey";if(this.activeLinkDecorationId){let t=this.currentOccurrences[this.activeLinkDecorationId];t&&this.editor.changeDecorations(o=>{t.deactivate(o,e)}),this.activeLinkDecorationId=null}}onEditorMouseUp(e){if(!this.isEnabled(e))return;let t=this.getLinkOccurrence(e.target.position);t&&this.openLinkOccurrence(t,e.hasSideBySideModifier,!0)}openLinkOccurrence(e,t,o=!1){if(!this.openerService)return;let{link:n}=e;n.resolve(Se.None).then(r=>{if(typeof r=="string"&&this.editor.hasModel()){let s=this.editor.getModel().uri;if(s.scheme===Q.file&&r.startsWith(`${Q.file}:`)){let l=A.parse(r);if(l.scheme===Q.file){let c=hV(l),u=null;c.startsWith("/./")||c.startsWith("\\.\\")?u=`.${c.substr(1)}`:(c.startsWith("//./")||c.startsWith("\\\\.\\"))&&(u=`.${c.substr(2)}`),u&&(r=Ge(s,u))}}}return this.openerService.open(r,{openToSide:t,fromUserGesture:o,allowContributedOpeners:!0,allowCommands:!0,fromWorkspace:!0})},r=>{let s=r instanceof Error?r.message:r;s==="invalid"?this.notificationService.warn(d(1440,null,n.url.toString())):s==="missing"?this.notificationService.warn(d(1448,null)):mt(r)})}getLinkOccurrence(e){if(!this.editor.hasModel()||!e)return null;let t=this.editor.getModel().getDecorationsInRange({startLineNumber:e.lineNumber,startColumn:e.column,endLineNumber:e.lineNumber,endColumn:e.column},0,!0);for(let o of t){let n=this.currentOccurrences[o.id];if(n)return n}return null}isEnabled(e,t){return!!(e.target.type===6&&(e.hasTriggerModifier||t&&t.keyCodeIsTriggerKey||e.isMiddleClick&&e.mouseMiddleClickAction==="openLink"))}stop(){this.computeLinks.cancel(),this.activeLinksList&&(this.activeLinksList?.dispose(),this.activeLinksList=null),this.computePromise&&(this.computePromise.cancel(),this.computePromise=null)}dispose(){super.dispose(),this.stop()}};dk=I([m(1,Je),m(2,Ne),m(3,Qt),m(4,hf)],dk);var DXi={general:mo.register({description:"detected-link",stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:"detected-link"}),active:mo.register({description:"detected-link-active",stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:"detected-link-active"})},NEt=class a{static decoration(i,e){return{range:i.range,options:a._getOptions(i,e,!1)}}static _getOptions(i,e,t){let o={...t?DXi.active:DXi.general};return o.hoverMessage=lGo(i,e),o}constructor(i,e){this.link=i,this.decorationId=e}activate(i,e){i.changeDecorationOptions(this.decorationId,a._getOptions(this.link,e,!0))}deactivate(i,e){i.changeDecorationOptions(this.decorationId,a._getOptions(this.link,e,!1))}};function lGo(a,i){let e=a.url&&/^command:/i.test(a.url.toString()),t=a.tooltip?a.tooltip:e?d(1442,null):d(1443,null),o=i?Ze?d(1447,null):d(1446,null):Ze?d(1445,null):d(1444,null);if(a.url){let n="";if(/^command:/i.test(a.url.toString())){let s=a.url.toString().match(/^command:([^?#]+)/);if(s){let l=s[1];n=d(1449,null,l)}}return new Ie("",!0).appendLink(a.url.toString(!0).replace(/ /g,"%20"),t,n).appendMarkdown(` (${o})`)}else return new Ie().appendText(`${t} (${o})`)}var Oui=class extends Di{constructor(){super({id:"editor.action.openLink",label:L(1441,"Open Link"),precondition:void 0})}run(i,e){let t=dk.get(e);if(!t||!e.hasModel())return;let o=e.getSelections();for(let n of o){let r=t.getLinkOccurrence(n.getEndPosition());r&&t.openLinkOccurrence(r,!1)}}};xo(dk.ID,dk,1);ni(Oui);var OEt=class a extends x{constructor(e){super();this._editor=e;this._register(this._editor.onMouseDown(t=>{let o=this._editor.getOption(133);o>=0&&t.target.type===6&&t.target.position.column>=o&&this._editor.updateOptions({stopRenderingLineAfter:-1})}))}static{this.ID="editor.contrib.longLinesHelper"}static get(e){return e.getContribution(a.ID)}};xo(OEt.ID,OEt,2);var rQe=class a extends x{constructor(e){super();this._editor=e;let t=gs(this._editor),o=t.getOption(171);this._register(be(n=>{if(!o.read(n))return;let r=t.domNode.read(n);if(!r)return;let s=n.store.add(SV("scrollingSession",void 0));n.store.add(this._editor.onMouseDown(c=>{if(s.read(void 0)){s.set(void 0,void 0);return}if(!c.event.middleButton)return;c.event.stopPropagation(),c.event.preventDefault();let p=new N,h=new Xh(c.event.posx,c.event.posy),f=cGo(Re(r),h,p).map(S=>S.subtract(h).withThreshold(5)),v=r.getBoundingClientRect(),b=new Xh(h.x-v.left,h.y-v.top);s.set({mouseDeltaAfterThreshold:f,initialMousePosInEditor:b,didScroll:!1,dispose:()=>p.dispose()},void 0),p.add(this._editor.onMouseUp(S=>{let y=s.read(void 0);y&&y.didScroll&&s.set(void 0,void 0)})),p.add(this._editor.onKeyDown(S=>{s.set(void 0,void 0)}))})),n.store.add(be(c=>{let u=s.read(c);if(!u)return;let p=Date.now();c.store.add(be(g=>{E8e.instance.invalidateOnNextAnimationFrame(g);let f=Date.now(),v=f-p;p=f;let b=u.mouseDeltaAfterThreshold.read(void 0),S=v/32,y=b.scale(S),w=new Xh(this._editor.getScrollLeft(),this._editor.getScrollTop());this._editor.setScrollPosition(dGo(w.add(y))),y.isZero()||(u.didScroll=!0)}));let h=ke(g=>{let f=u.mouseDeltaAfterThreshold.read(g),v="";return v+=f.y<0?"n":f.y>0?"s":"",v+=f.x<0?"w":f.x>0?"e":"",v});c.store.add(be(g=>{r.setAttribute("data-scroll-direction",h.read(g))}))}));let l=n.store.add(Bo.div({class:["scroll-editor-on-middle-click-dot",s.map(c=>c?"":"hidden")],style:{left:s.map(c=>c?c.initialMousePosInEditor.x:0),top:s.map(c=>c?c.initialMousePosInEditor.y:0)}}).toDisposableLiveElement());n.store.add($j(r,l.element)),n.store.add(be(c=>{let u=s.read(c);r.classList.toggle("scroll-editor-on-middle-click-editor",!!u)}))}))}static{this.ID="editor.contrib.middleScroll"}static get(e){return e.getContribution(a.ID)}};function cGo(a,i,e){let t=Me("pos",i);return e.add(j(a,"mousemove",o=>{t.set(new Xh(o.pageX,o.pageY),void 0)})),t}function dGo(a){return{scrollLeft:a.x,scrollTop:a.y}}xo(rQe.ID,rQe,2);var pGo=te("editor.wordHighlightBackground",{dark:"#575757B8",light:"#57575740",hcDark:null,hcLight:null},d(1728,null),!0);te("editor.wordHighlightStrongBackground",{dark:"#004972B8",light:"#0e639c40",hcDark:null,hcLight:null},d(1730,null),!0);te("editor.wordHighlightTextBackground",pGo,d(1732,null),!0);var mGo=te("editor.wordHighlightBorder",{light:null,dark:null,hcDark:Ys,hcLight:Ys},d(1729,null));te("editor.wordHighlightStrongBorder",{light:null,dark:null,hcDark:Ys,hcLight:Ys},d(1731,null));te("editor.wordHighlightTextBorder",mGo,d(1733,null));var hGo=te("editorOverviewRuler.wordHighlightForeground","#A0A0A0CC",d(1725,null),!0),gGo=te("editorOverviewRuler.wordHighlightStrongForeground","#C0A0C0CC",d(1726,null),!0),fGo=te("editorOverviewRuler.wordHighlightTextForeground",Nye,d(1727,null),!0),vGo=mo.register({description:"word-highlight-strong",stickiness:1,className:"wordHighlightStrong",overviewRuler:{color:Xs(gGo),position:2},minimap:{color:Xs(Hje),position:1}}),bGo=mo.register({description:"word-highlight-text",stickiness:1,className:"wordHighlightText",overviewRuler:{color:Xs(fGo),position:2},minimap:{color:Xs(Hje),position:1}}),SGo=mo.register({description:"selection-highlight-overview",stickiness:1,className:"selectionHighlight",overviewRuler:{color:Xs(Nye),position:2},minimap:{color:Xs(Hje),position:1}}),IGo=mo.register({description:"selection-highlight",stickiness:1,className:"selectionHighlight"}),yGo=mo.register({description:"word-highlight",stickiness:1,className:"wordHighlight",overviewRuler:{color:Xs(hGo),position:2},minimap:{color:Xs(Hje),position:1}});function LXi(a){return a===2?vGo:a===0?bGo:yGo}function RXi(a){return a?IGo:SGo}is((a,i)=>{let e=a.getColor(Aye);e&&i.addRule(`.monaco-editor .selectionHighlight { background-color: ${e.transparent(.5)}; }`)});function SX(a,i){let e=i.filter(t=>!a.find(o=>o.equals(t)));if(e.length>=1){let t=e.map(n=>`line ${n.viewState.position.lineNumber} column ${n.viewState.position.column}`).join(", "),o=e.length===1?d(1454,null,t):d(1455,null,t);qr(o)}}var Fui=class extends Di{constructor(){super({id:"editor.action.insertCursorAbove",label:L(1470,"Add Cursor Above"),precondition:void 0,kbOpts:{kbExpr:pe.editorTextFocus,primary:2576,linux:{primary:1552,secondary:[3088]},weight:100},menuOpts:{menuId:D.MenubarSelectionMenu,group:"3_multi",title:d(1458,null),order:2}})}run(i,e,t){if(!e.hasModel())return;let o=!0;t&&t.logicalLine===!1&&(o=!1);let n=e._getViewModel();if(n.cursorConfig.readOnly)return;n.model.pushStackElement();let r=n.getCursorStates();n.setCursorStates(t.source,3,sf.addCursorUp(n,r,o)),n.revealTopMostCursor(t.source),SX(r,n.getCursorStates())}},Wui=class extends Di{constructor(){super({id:"editor.action.insertCursorBelow",label:L(1472,"Add Cursor Below"),precondition:void 0,kbOpts:{kbExpr:pe.editorTextFocus,primary:2578,linux:{primary:1554,secondary:[3090]},weight:100},menuOpts:{menuId:D.MenubarSelectionMenu,group:"3_multi",title:d(1460,null),order:3}})}run(i,e,t){if(!e.hasModel())return;let o=!0;t&&t.logicalLine===!1&&(o=!1);let n=e._getViewModel();if(n.cursorConfig.readOnly)return;n.model.pushStackElement();let r=n.getCursorStates();n.setCursorStates(t.source,3,sf.addCursorDown(n,r,o)),n.revealBottomMostCursor(t.source),SX(r,n.getCursorStates())}},Vui=class extends Di{constructor(){super({id:"editor.action.insertCursorAtEndOfEachLineSelected",label:L(1471,"Add Cursors to Line Ends"),precondition:void 0,kbOpts:{kbExpr:pe.editorTextFocus,primary:1575,weight:100},menuOpts:{menuId:D.MenubarSelectionMenu,group:"3_multi",title:d(1459,null),order:4}})}getCursorsForSelection(i,e,t){if(!i.isEmpty()){for(let o=i.startLineNumber;o<i.endLineNumber;o++){let n=e.getLineMaxColumn(o);t.push(new ti(o,n,o,n))}i.endColumn>1&&t.push(new ti(i.endLineNumber,i.endColumn,i.endLineNumber,i.endColumn))}}run(i,e){if(!e.hasModel())return;let t=e.getModel(),o=e.getSelections(),n=e._getViewModel(),r=n.getCursorStates(),s=[];o.forEach(l=>this.getCursorsForSelection(l,t,s)),s.length>0&&e.setSelections(s),SX(r,n.getCursorStates())}},Bui=class extends Di{constructor(){super({id:"editor.action.addCursorsToBottom",label:L(1464,"Add Cursors to Bottom"),precondition:void 0})}run(i,e){if(!e.hasModel())return;let t=e.getSelections(),o=e.getModel().getLineCount(),n=[];for(let l=t[0].startLineNumber;l<=o;l++)n.push(new ti(l,t[0].startColumn,l,t[0].endColumn));let r=e._getViewModel(),s=r.getCursorStates();n.length>0&&e.setSelections(n),SX(s,r.getCursorStates())}},Hui=class extends Di{constructor(){super({id:"editor.action.addCursorsToTop",label:L(1465,"Add Cursors to Top"),precondition:void 0})}run(i,e){if(!e.hasModel())return;let t=e.getSelections(),o=[];for(let s=t[0].startLineNumber;s>=1;s--)o.push(new ti(s,t[0].startColumn,s,t[0].endColumn));let n=e._getViewModel(),r=n.getCursorStates();o.length>0&&e.setSelections(o),SX(r,n.getCursorStates())}},Hke=class{constructor(i,e,t){this.selections=i;this.revealRange=e;this.revealScrollType=t}},FEt=class a{constructor(i,e,t,o,n,r,s){this._editor=i;this.findController=e;this.isDisconnectedFromFindController=t;this.searchText=o;this.wholeWord=n;this.matchCase=r;this.currentMatch=s}static create(i,e){if(!i.hasModel())return null;let t=e.getState();if(!i.hasTextFocus()&&t.isRevealed&&t.searchString.length>0)return new a(i,e,!1,t.searchString,t.wholeWord,t.matchCase,null);let o=!1,n,r,s=i.getSelections();s.length===1&&s[0].isEmpty()?(o=!0,n=!0,r=!0):(n=t.wholeWord,r=t.matchCase);let l=i.getSelection(),c,u=null;if(l.isEmpty()){let p=i.getConfiguredWordAtPosition(l.getStartPosition());if(!p)return null;c=p.word,u=new ti(l.startLineNumber,p.startColumn,l.startLineNumber,p.endColumn)}else c=i.getModel().getValueInRange(l).replace(/\r\n/g,`
`);return new a(i,e,o,c,n,r,u)}addSelectionToNextFindMatch(){if(!this._editor.hasModel())return null;let i=this._getNextMatch();if(!i)return null;let e=this._editor.getSelections();return new Hke(e.concat(i),i,0)}moveSelectionToNextFindMatch(){if(!this._editor.hasModel())return null;let i=this._getNextMatch();if(!i)return null;let e=this._editor.getSelections();return new Hke(e.slice(0,e.length-1).concat(i),i,0)}_getNextMatch(){if(!this._editor.hasModel())return null;if(this.currentMatch){let o=this.currentMatch;return this.currentMatch=null,o}this.findController.highlightFindOptions();let i=this._editor.getSelections(),e=i[i.length-1],t=this._editor.getModel().findNextMatch(this.searchText,e.getEndPosition(),!1,this.matchCase,this.wholeWord?this._editor.getOption(148):null,!1);return t?new ti(t.range.startLineNumber,t.range.startColumn,t.range.endLineNumber,t.range.endColumn):null}addSelectionToPreviousFindMatch(){if(!this._editor.hasModel())return null;let i=this._getPreviousMatch();if(!i)return null;let e=this._editor.getSelections();return new Hke(e.concat(i),i,0)}moveSelectionToPreviousFindMatch(){if(!this._editor.hasModel())return null;let i=this._getPreviousMatch();if(!i)return null;let e=this._editor.getSelections();return new Hke(e.slice(0,e.length-1).concat(i),i,0)}_getPreviousMatch(){if(!this._editor.hasModel())return null;if(this.currentMatch){let o=this.currentMatch;return this.currentMatch=null,o}this.findController.highlightFindOptions();let i=this._editor.getSelections(),e=i[i.length-1],t=this._editor.getModel().findPreviousMatch(this.searchText,e.getStartPosition(),!1,this.matchCase,this.wholeWord?this._editor.getOption(148):null,!1);return t?new ti(t.range.startLineNumber,t.range.startColumn,t.range.endLineNumber,t.range.endColumn):null}selectAll(i){if(!this._editor.hasModel())return[];this.findController.highlightFindOptions();let e=this._editor.getModel();return i?e.findMatches(this.searchText,i,!1,this.matchCase,this.wholeWord?this._editor.getOption(148):null,!1,1073741824):e.findMatches(this.searchText,!0,!1,this.matchCase,this.wholeWord?this._editor.getOption(148):null,!1,1073741824)}},vX=class a extends x{constructor(e){super();this._sessionDispose=this._register(new N);this._editor=e,this._ignoreSelectionChange=!1,this._session=null}static{this.ID="editor.contrib.multiCursorController"}static get(e){return e.getContribution(a.ID)}dispose(){this._endSession(),super.dispose()}_beginSessionIfNeeded(e){if(!this._session){let t=FEt.create(this._editor,e);if(!t)return;this._session=t;let o={searchString:this._session.searchText};this._session.isDisconnectedFromFindController&&(o.wholeWordOverride=1,o.matchCaseOverride=1,o.isRegexOverride=2),e.getState().change(o,!1),this._sessionDispose.add(this._editor.onDidChangeCursorSelection(n=>{this._ignoreSelectionChange||this._endSession()})),this._sessionDispose.add(this._editor.onDidBlurEditorText(()=>{this._endSession()})),this._sessionDispose.add(e.getState().onFindReplaceStateChange(n=>{(n.matchCase||n.wholeWord)&&this._endSession()}))}}_endSession(){if(this._sessionDispose.clear(),this._session&&this._session.isDisconnectedFromFindController){let e={wholeWordOverride:0,matchCaseOverride:0,isRegexOverride:0};this._session.findController.getState().change(e,!1)}this._session=null}_setSelections(e){this._ignoreSelectionChange=!0,this._editor.setSelections(e),this._ignoreSelectionChange=!1}_expandEmptyToWord(e,t){if(!t.isEmpty())return t;let o=this._editor.getConfiguredWordAtPosition(t.getStartPosition());return o?new ti(t.startLineNumber,o.startColumn,t.startLineNumber,o.endColumn):t}_applySessionResult(e){e&&(this._setSelections(e.selections),e.revealRange&&this._editor.revealRangeInCenterIfOutsideViewport(e.revealRange,e.revealScrollType))}getSession(e){return this._session}addSelectionToNextFindMatch(e){if(this._editor.hasModel()){if(!this._session){let t=this._editor.getSelections();if(t.length>1){let n=e.getState().matchCase;if(!PXi(this._editor.getModel(),t,n)){let s=this._editor.getModel(),l=[];for(let c=0,u=t.length;c<u;c++)l[c]=this._expandEmptyToWord(s,t[c]);this._editor.setSelections(l);return}}}this._beginSessionIfNeeded(e),this._session&&this._applySessionResult(this._session.addSelectionToNextFindMatch())}}addSelectionToPreviousFindMatch(e){this._beginSessionIfNeeded(e),this._session&&this._applySessionResult(this._session.addSelectionToPreviousFindMatch())}moveSelectionToNextFindMatch(e){this._beginSessionIfNeeded(e),this._session&&this._applySessionResult(this._session.moveSelectionToNextFindMatch())}moveSelectionToPreviousFindMatch(e){this._beginSessionIfNeeded(e),this._session&&this._applySessionResult(this._session.moveSelectionToPreviousFindMatch())}selectAll(e){if(!this._editor.hasModel())return;let t=null,o=e.getState();if(o.isRevealed&&o.searchString.length>0&&o.isRegex){let n=this._editor.getModel();o.searchScope?t=n.findMatches(o.searchString,o.searchScope,o.isRegex,o.matchCase,o.wholeWord?this._editor.getOption(148):null,!1,1073741824):t=n.findMatches(o.searchString,!0,o.isRegex,o.matchCase,o.wholeWord?this._editor.getOption(148):null,!1,1073741824)}else{if(this._beginSessionIfNeeded(e),!this._session)return;t=this._session.selectAll(o.searchScope)}if(t.length>0){let n=this._editor.getSelection();for(let r=0,s=t.length;r<s;r++){let l=t[r];if(l.range.intersectRanges(n)){t[r]=t[0],t[0]=l;break}}this._setSelections(t.map(r=>new ti(r.range.startLineNumber,r.range.startColumn,r.range.endLineNumber,r.range.endColumn)))}}selectAllUsingSelections(e){e.length>0&&this._setSelections(e)}},bX=class extends Di{run(i,e){let t=vX.get(e);if(!t)return;let o=e._getViewModel();if(o){let n=o.getCursorStates(),r=$f.get(e);if(r)this._run(t,r);else{let s=i.get(F).createInstance($f,e);this._run(t,s),s.dispose()}SX(n,o.getCursorStates())}}},Uui=class extends bX{constructor(){super({id:"editor.action.addSelectionToNextFindMatch",label:L(1451,"Add Selection to Next Find Match"),precondition:void 0,kbOpts:{kbExpr:pe.focus,primary:2082,weight:100},menuOpts:{menuId:D.MenubarSelectionMenu,group:"3_multi",title:d(1456,null),order:5}})}_run(i,e){i.addSelectionToNextFindMatch(e)}},zui=class extends bX{constructor(){super({id:"editor.action.addSelectionToPreviousFindMatch",label:L(1452,"Add Selection to Previous Find Match"),precondition:void 0,menuOpts:{menuId:D.MenubarSelectionMenu,group:"3_multi",title:d(1457,null),order:6}})}_run(i,e){i.addSelectionToPreviousFindMatch(e)}},Kui=class extends bX{constructor(){super({id:"editor.action.moveSelectionToNextFindMatch",label:L(1462,"Move Last Selection to Next Find Match"),precondition:void 0,kbOpts:{kbExpr:pe.focus,primary:Vi(2089,2082),weight:100}})}_run(i,e){i.moveSelectionToNextFindMatch(e)}},Gui=class extends bX{constructor(){super({id:"editor.action.moveSelectionToPreviousFindMatch",label:L(1463,"Move Last Selection to Previous Find Match"),precondition:void 0})}_run(i,e){i.moveSelectionToPreviousFindMatch(e)}},qui=class extends bX{constructor(){super({id:"editor.action.selectHighlights",label:L(1473,"Select All Occurrences of Find Match"),precondition:void 0,kbOpts:{kbExpr:pe.focus,primary:3114,weight:100},menuOpts:{menuId:D.MenubarSelectionMenu,group:"3_multi",title:d(1461,null),order:7}})}_run(i,e){i.selectAll(e)}},$ui=class extends bX{constructor(){super({id:"editor.action.changeAll",label:L(1453,"Change All Occurrences"),precondition:C.and(pe.writable,pe.editorTextFocus),kbOpts:{kbExpr:pe.editorTextFocus,primary:2108,weight:100},contextMenuOpts:{group:"1_modification",order:1.2}})}_run(i,e){i.selectAll(e)}},jui=class{constructor(i,e,t,o,n){this._model=i;this._searchText=e;this._matchCase=t;this._wordSeparators=o;this._cachedFindMatches=null;this._modelVersionId=this._model.getVersionId(),n&&this._model===n._model&&this._searchText===n._searchText&&this._matchCase===n._matchCase&&this._wordSeparators===n._wordSeparators&&this._modelVersionId===n._modelVersionId&&(this._cachedFindMatches=n._cachedFindMatches)}findMatches(){return this._cachedFindMatches===null&&(this._cachedFindMatches=this._model.findMatches(this._searchText,!0,!1,this._matchCase,this._wordSeparators,!1).map(i=>i.range),this._cachedFindMatches.sort(z.compareRangesUsingStarts)),this._cachedFindMatches}},fX=class extends x{constructor(e,t){super();this._languageFeaturesService=t;this.editor=e,this._isEnabled=e.getOption(122),this._isEnabledMultiline=e.getOption(124),this._maxLength=e.getOption(123),this._decorations=e.createDecorationsCollection(),this.updateSoon=this._register(new Dt(()=>this._update(),300)),this.state=null,this._register(e.onDidChangeConfiguration(n=>{this._isEnabled=e.getOption(122),this._isEnabledMultiline=e.getOption(124),this._maxLength=e.getOption(123)})),this._register(e.onDidChangeCursorSelection(n=>{this._isEnabled&&(n.selection.isEmpty()?n.reason===3?(this.state&&this._setState(null),this.updateSoon.schedule()):this._setState(null):this._update())})),this._register(e.onDidChangeModel(n=>{this._setState(null)})),this._register(e.onDidChangeModelContent(n=>{this._isEnabled&&this.updateSoon.schedule()}));let o=$f.get(e);o&&this._register(o.getState().onFindReplaceStateChange(n=>{this._update()})),this.updateSoon.schedule()}static{this.ID="editor.contrib.selectionHighlighter"}_update(){this._setState(fX._createState(this.state,this._isEnabled,this._isEnabledMultiline,this._maxLength,this.editor))}static _createState(e,t,o,n,r){if(!t||!r.hasModel())return null;if(!o){let h=r.getSelection();if(h.startLineNumber!==h.endLineNumber)return null}let s=vX.get(r);if(!s)return null;let l=$f.get(r);if(!l)return null;let c=s.getSession(l);if(!c){let h=r.getSelections();if(h.length>1){let f=l.getState().matchCase;if(!PXi(r.getModel(),h,f))return null}c=FEt.create(r,l)}if(!c||c.currentMatch||/^[ \t]+$/.test(c.searchText)||n>0&&c.searchText.length>n)return null;let u=l.getState(),p=u.matchCase;if(u.isRevealed){let h=u.searchString;p||(h=h.toLowerCase());let g=c.searchText;if(p||(g=g.toLowerCase()),h===g&&c.matchCase===u.matchCase&&c.wholeWord===u.wholeWord&&!u.isRegex)return null}return new jui(r.getModel(),c.searchText,c.matchCase,c.wholeWord?r.getOption(148):null,e)}_setState(e){if(this.state=e,!this.state){this._decorations.clear();return}if(!this.editor.hasModel())return;let t=this.editor.getModel();if(t.isTooLargeForTokenization())return;let o=this.state.findMatches(),n=this.editor.getSelections();n.sort(z.compareRangesUsingStarts);let r=[];for(let u=0,p=0,h=o.length,g=n.length;u<h;){let f=o[u];if(p>=g)r.push(f),u++;else{let v=z.compareRangesUsingStarts(f,n[p]);v<0?((n[p].isEmpty()||!z.areIntersecting(f,n[p]))&&r.push(f),u++):(v>0||u++,p++)}}let s=this.editor.getOption(90)!=="off",l=this._languageFeaturesService.documentHighlightProvider.has(t)&&s,c=r.map(u=>({range:u,options:RXi(l)}));this._decorations.set(c)}dispose(){this._setState(null),super.dispose()}};fX=I([m(1,Qt)],fX);function PXi(a,i,e){let t=MXi(a,i[0],!e);for(let o=1,n=i.length;o<n;o++){let r=i[o];if(r.isEmpty())return!1;let s=MXi(a,r,!e);if(t!==s)return!1}return!0}function MXi(a,i,e){let t=a.getValueInRange(i);return e?t.toLowerCase():t}var Qui=class extends Di{constructor(){super({id:"editor.action.focusNextCursor",label:L(1466,"Focus Next Cursor"),metadata:{description:d(1467,null),args:[]},precondition:void 0})}run(i,e,t){if(!e.hasModel())return;let o=e._getViewModel();if(o.cursorConfig.readOnly)return;o.model.pushStackElement();let n=Array.from(o.getCursorStates()),r=n.shift();r&&(n.push(r),o.setCursorStates(t.source,3,n),o.revealPrimaryCursor(t.source,!0),SX(n,o.getCursorStates()))}},Yui=class extends Di{constructor(){super({id:"editor.action.focusPreviousCursor",label:L(1468,"Focus Previous Cursor"),metadata:{description:d(1469,null),args:[]},precondition:void 0})}run(i,e,t){if(!e.hasModel())return;let o=e._getViewModel();if(o.cursorConfig.readOnly)return;o.model.pushStackElement();let n=Array.from(o.getCursorStates()),r=n.pop();r&&(n.unshift(r),o.setCursorStates(t.source,3,n),o.revealPrimaryCursor(t.source,!0),SX(n,o.getCursorStates()))}};xo(vX.ID,vX,4);xo(fX.ID,fX,1);ni(Fui);ni(Wui);ni(Vui);ni(Uui);ni(zui);ni(Kui);ni(Gui);ni(qui);ni($ui);ni(Bui);ni(Hui);ni(Qui);ni(Yui);var P5={Visible:new Y("parameterHintsVisible",!1),MultipleSignatures:new Y("parameterHintsMultipleSignatures",!1)};async function Xui(a,i,e,t,o){let n=a.ordered(i);for(let r of n)try{let s=await r.provideSignatureHelp(i,e,o,t);if(s)return s}catch(s){ys(s)}}$e.registerCommand("_executeSignatureHelpProvider",async(a,...i)=>{let[e,t,o]=i;wo(A.isUri(e)),wo(ye.isIPosition(t)),wo(typeof o=="string"||!o);let n=a.get(Qt),r=await a.get(Bt).createModelReference(e);try{let s=await Xui(n.signatureHelpProvider,r.object.textEditorModel,ye.lift(t),{triggerKind:1,isRetrigger:!1,triggerCharacter:o},Se.None);return s?(setTimeout(()=>s.dispose(),0),s.value):void 0}finally{r.dispose()}});var dde;(o=>{let a;(l=>(l[l.Default=0]="Default",l[l.Active=1]="Active",l[l.Pending=2]="Pending"))(a=o.Type||={}),o.Default={type:0};class e{constructor(r,s){this.request=r;this.previouslyActiveHints=s;this.type=2}}o.Pending=e;class t{constructor(r){this.hints=r;this.type=1}}o.Active=t})(dde||={});var WEt=class a extends x{constructor(e,t,o=a.DEFAULT_DELAY){super();this._onChangedHints=this._register(new E);this.onChangedHints=this._onChangedHints.event;this.triggerOnType=!1;this._state=dde.Default;this._pendingTriggers=[];this._lastSignatureHelpResult=this._register(new me);this.triggerChars=new Z$;this.retriggerChars=new Z$;this.triggerId=0;this.editor=e,this.providers=t,this.throttledDelayer=this._register(new Xo(o)),this._register(this.editor.onDidBlurEditorWidget(()=>this.cancel())),this._register(this.editor.onDidChangeConfiguration(()=>this.onEditorConfigurationChange())),this._register(this.editor.onDidChangeModel(n=>this.onModelChanged())),this._register(this.editor.onDidChangeModelLanguage(n=>this.onModelChanged())),this._register(this.editor.onDidChangeCursorSelection(n=>this.onCursorChange(n))),this._register(this.editor.onDidChangeModelContent(n=>this.onModelContentChange())),this._register(this.providers.onDidChange(this.onModelChanged,this)),this._register(this.editor.onDidType(n=>this.onDidType(n))),this.onEditorConfigurationChange(),this.onModelChanged()}static{this.DEFAULT_DELAY=120}get state(){return this._state}set state(e){this._state.type===2&&this._state.request.cancel(),this._state=e}cancel(e=!1){this.state=dde.Default,this.throttledDelayer.cancel(),e||this._onChangedHints.fire(void 0)}trigger(e,t){let o=this.editor.getModel();if(!o||!this.providers.has(o))return;let n=++this.triggerId;this._pendingTriggers.push(e),this.throttledDelayer.trigger(()=>this.doTrigger(n),t).catch(mt)}next(){if(this.state.type!==1)return;let e=this.state.hints.signatures.length,t=this.state.hints.activeSignature,o=t%e===e-1,n=this.editor.getOption(98).cycle;if((e<2||o)&&!n){this.cancel();return}this.updateActiveSignature(o&&n?0:t+1)}previous(){if(this.state.type!==1)return;let e=this.state.hints.signatures.length,t=this.state.hints.activeSignature,o=t===0,n=this.editor.getOption(98).cycle;if((e<2||o)&&!n){this.cancel();return}this.updateActiveSignature(o&&n?e-1:t-1)}updateActiveSignature(e){this.state.type===1&&(this.state=new dde.Active({...this.state.hints,activeSignature:e}),this._onChangedHints.fire(this.state.hints))}async doTrigger(e){let t=this.state.type===1||this.state.type===2,o=this.getLastActiveHints();if(this.cancel(!0),this._pendingTriggers.length===0)return!1;let n=this._pendingTriggers.reduce(wGo);this._pendingTriggers=[];let r={triggerKind:n.triggerKind,triggerCharacter:n.triggerCharacter,isRetrigger:t,activeSignatureHelp:o};if(!this.editor.hasModel())return!1;let s=this.editor.getModel(),l=this.editor.getPosition();this.state=new dde.Pending(Ln(c=>Xui(this.providers,s,l,r,c)),o);try{let c=await this.state.request;return e!==this.triggerId?(c?.dispose(),!1):!c||!c.value.signatures||c.value.signatures.length===0?(c?.dispose(),this._lastSignatureHelpResult.clear(),this.cancel(),!1):(this.state=new dde.Active(c.value),this._lastSignatureHelpResult.value=c,this._onChangedHints.fire(this.state.hints),!0)}catch(c){return e===this.triggerId&&(this.state=dde.Default),mt(c),!1}}getLastActiveHints(){switch(this.state.type){case 1:return this.state.hints;case 2:return this.state.previouslyActiveHints;default:return}}get isTriggered(){return this.state.type===1||this.state.type===2||this.throttledDelayer.isTriggered()}onModelChanged(){this.cancel(),this.triggerChars.clear(),this.retriggerChars.clear();let e=this.editor.getModel();if(e)for(let t of this.providers.ordered(e)){for(let o of t.signatureHelpTriggerCharacters||[])if(o.length){let n=o.charCodeAt(0);this.triggerChars.add(n),this.retriggerChars.add(n)}for(let o of t.signatureHelpRetriggerCharacters||[])o.length&&this.retriggerChars.add(o.charCodeAt(0))}}onDidType(e){if(!this.triggerOnType)return;let t=e.length-1,o=e.charCodeAt(t);(this.triggerChars.has(o)||this.isTriggered&&this.retriggerChars.has(o))&&this.trigger({triggerKind:2,triggerCharacter:e.charAt(t)})}onCursorChange(e){e.source==="mouse"?this.cancel():this.isTriggered&&this.trigger({triggerKind:3})}onModelContentChange(){this.isTriggered&&this.trigger({triggerKind:3})}onEditorConfigurationChange(){this.triggerOnType=this.editor.getOption(98).enabled,this.triggerOnType||this.cancel()}dispose(){this.cancel(!0),super.dispose()}};function wGo(a,i){switch(i.triggerKind){case 1:return i;case 3:return a;case 2:default:return i}}var xR=_,CGo=Ae("parameter-hints-next",R.chevronDown,d(1477,null)),xGo=Ae("parameter-hints-previous",R.chevronUp,d(1478,null)),IX=class extends x{constructor(e,t,o,n){super();this.editor=e;this.model=t;this.markdownRendererService=n;this.renderDisposeables=this._register(new N);this.visible=!1;this.announcedLabel=null;this.allowEditorOverflow=!0;this.keyVisible=P5.Visible.bindTo(o),this.keyMultipleSignatures=P5.MultipleSignatures.bindTo(o)}static{this.ID="editor.widget.parameterHintsWidget"}createParameterHintDOMNodes(){let e=xR(".editor-widget.parameter-hints-widget"),t=M(e,xR(".phwrapper"));t.tabIndex=-1;let o=M(t,xR(".controls")),n=M(o,xR(".button"+q.asCSSSelector(xGo))),r=M(o,xR(".overloads")),s=M(o,xR(".button"+q.asCSSSelector(CGo)));this._register(j(n,"click",g=>{Xt.stop(g),this.previous()})),this._register(j(s,"click",g=>{Xt.stop(g),this.next()}));let l=xR(".body"),c=new ms(l,{alwaysConsumeMouseWheel:!0});this._register(c),t.appendChild(c.getDomNode());let u=M(l,xR(".signature")),p=M(l,xR(".docs"));e.style.userSelect="text",this.domNodes={element:e,signature:u,overloads:r,docs:p,scrollbar:c},this.editor.addContentWidget(this),this.hide(),this._register(this.editor.onDidChangeCursorSelection(g=>{this.visible&&this.editor.layoutContentWidget(this)}));let h=()=>{if(!this.domNodes)return;let g=this.editor.getOption(59),f=this.domNodes.element;f.style.fontSize=`${g.fontSize}px`,f.style.lineHeight=`${g.lineHeight/g.fontSize}`,f.style.setProperty("--vscode-parameterHintsWidget-editorFontFamily",g.fontFamily),f.style.setProperty("--vscode-parameterHintsWidget-editorFontFamilyDefault",fu.fontFamily)};h(),this._register(U.chain(this.editor.onDidChangeConfiguration.bind(this.editor),g=>g.filter(f=>f.hasChanged(59)))(h)),this._register(this.editor.onDidLayoutChange(g=>this.updateMaxHeight())),this.updateMaxHeight()}show(){this.visible||(this.domNodes||this.createParameterHintDOMNodes(),this.keyVisible.set(!0),this.visible=!0,setTimeout(()=>{this.domNodes?.element.classList.add("visible")},100),this.editor.layoutContentWidget(this))}hide(){this.renderDisposeables.clear(),this.visible&&(this.keyVisible.reset(),this.visible=!1,this.announcedLabel=null,this.domNodes?.element.classList.remove("visible"),this.editor.layoutContentWidget(this))}getPosition(){return this.visible?{position:this.editor.getPosition(),preference:[1,2]}:null}render(e){if(this.renderDisposeables.clear(),!this.domNodes)return;let t=e.signatures.length>1;this.domNodes.element.classList.toggle("multiple",t),this.keyMultipleSignatures.set(t),this.domNodes.signature.innerText="",this.domNodes.docs.innerText="";let o=e.signatures[e.activeSignature];if(!o)return;let n=M(this.domNodes.signature,xR(".code")),r=o.parameters.length>0,s=o.activeParameter??e.activeParameter;if(r)this.renderParameters(n,o,s);else{let u=M(n,xR("span"));u.textContent=o.label}let l=o.parameters[s];if(l?.documentation){let u=xR("span.documentation");if(typeof l.documentation=="string")u.textContent=l.documentation;else{let p=this.renderMarkdownDocs(l.documentation);u.appendChild(p.element)}M(this.domNodes.docs,xR("p",{},u))}if(o.documentation!==void 0)if(typeof o.documentation=="string")M(this.domNodes.docs,xR("p",{},o.documentation));else{let u=this.renderMarkdownDocs(o.documentation);M(this.domNodes.docs,u.element)}let c=this.hasDocs(o,l);if(this.domNodes.signature.classList.toggle("has-docs",c),this.domNodes.docs.classList.toggle("empty",!c),this.domNodes.overloads.textContent=String(e.activeSignature+1).padStart(e.signatures.length.toString().length,"0")+"/"+e.signatures.length,l){let u="",p=o.parameters[s];Array.isArray(p.label)?u=o.label.substring(p.label[0],p.label[1]):u=p.label,p.documentation&&(u+=typeof p.documentation=="string"?`, ${p.documentation}`:`, ${p.documentation.value}`),o.documentation&&(u+=typeof o.documentation=="string"?`, ${o.documentation}`:`, ${o.documentation.value}`),this.announcedLabel!==u&&(en(d(1476,null,u)),this.announcedLabel=u)}this.editor.layoutContentWidget(this),this.domNodes.scrollbar.scanDomNode()}renderMarkdownDocs(e){let t=this.renderDisposeables.add(this.markdownRendererService.render(e,{context:this.editor,asyncRenderCallback:()=>{this.domNodes?.scrollbar.scanDomNode()}}));return t.element.classList.add("markdown-docs"),t}hasDocs(e,t){return!!(t&&typeof t.documentation=="string"&&Ci(t.documentation).length>0||t&&typeof t.documentation=="object"&&Ci(t.documentation).value.length>0||e.documentation&&typeof e.documentation=="string"&&Ci(e.documentation).length>0||e.documentation&&typeof e.documentation=="object"&&Ci(e.documentation.value).length>0)}renderParameters(e,t,o){let[n,r]=this.getParameterLabelOffsets(t,o),s=document.createElement("span");s.textContent=t.label.substring(0,n);let l=document.createElement("span");l.textContent=t.label.substring(n,r),l.className="parameter active";let c=document.createElement("span");c.textContent=t.label.substring(r),M(e,s,l,c)}getParameterLabelOffsets(e,t){let o=e.parameters[t];if(o){if(Array.isArray(o.label))return o.label;if(o.label.length){let n=new RegExp(`(\\W|^)${ns(o.label)}(?=\\W|$)`,"g");n.test(e.label);let r=n.lastIndex-o.label.length;return r>=0?[r,n.lastIndex]:[0,0]}else return[0,0]}else return[0,0]}next(){this.editor.focus(),this.model.next()}previous(){this.editor.focus(),this.model.previous()}getDomNode(){return this.domNodes||this.createParameterHintDOMNodes(),this.domNodes.element}getId(){return IX.ID}updateMaxHeight(){if(!this.domNodes)return;let t=`${Math.max(this.editor.getLayoutInfo().height/4,250)}px`;this.domNodes.element.style.maxHeight=t;let o=this.domNodes.element.getElementsByClassName("phwrapper");o.length&&(o[0].style.maxHeight=t)}};IX=I([m(2,X),m(3,On)],IX);te("editorHoverWidget.highlightForeground",L7,d(1475,null));var hF=class extends x{static{this.ID="editor.controller.parameterHints"}static get(i){return i.getContribution(hF.ID)}constructor(i,e,t){super(),this.editor=i,this.model=this._register(new WEt(i,t.signatureHelpProvider)),this._register(this.model.onChangedHints(o=>{o?(this.widget.value.show(),this.widget.value.render(o)):this.widget.rawValue?.hide()})),this.widget=new co(()=>this._register(e.createInstance(IX,this.editor,this.model)))}cancel(){this.model.cancel()}previous(){this.widget.rawValue?.previous()}next(){this.widget.rawValue?.next()}trigger(i){this.model.trigger(i,0)}};hF=I([m(1,F),m(2,Qt)],hF);var Jui=class extends Di{constructor(){super({id:"editor.action.triggerParameterHints",label:L(1474,"Trigger Parameter Hints"),precondition:pe.hasSignatureHelpProvider,kbOpts:{kbExpr:pe.editorTextFocus,primary:3082,weight:100}})}run(i,e){hF.get(e)?.trigger({triggerKind:1})}};xo(hF.ID,hF,2);ni(Jui);var Zui=175,epi=Oc.bindToContribution(hF.get);Xi(new epi({id:"closeParameterHints",precondition:P5.Visible,handler:a=>a.cancel(),kbOpts:{weight:Zui,kbExpr:pe.focus,primary:9,secondary:[1033]}}));Xi(new epi({id:"showPrevParameterHint",precondition:C.and(P5.Visible,P5.MultipleSignatures),handler:a=>a.previous(),kbOpts:{weight:Zui,kbExpr:pe.focus,primary:16,secondary:[528],mac:{primary:16,secondary:[528,302]}}}));Xi(new epi({id:"showNextParameterHint",precondition:C.and(P5.Visible,P5.MultipleSignatures),handler:a=>a.next(),kbOpts:{weight:Zui,kbExpr:pe.focus,primary:18,secondary:[530],mac:{primary:18,secondary:[530,300]}}}));var mB=class a extends x{constructor(e){super();this._editor=e;this._editorObs=gs(this._editor),this._placeholderText=this._editorObs.getOption(100),this._state=Os({owner:this,equalsFn:b_},t=>{let o=this._placeholderText.read(t);if(o&&this._editorObs.valueIsEmpty.read(t))return{placeholder:o}}),this._shouldViewBeAlive=kGo(this,t=>this._state.read(t)?.placeholder!==void 0),this._view=ke(t=>{if(!this._shouldViewBeAlive.read(t))return;let o=ct("div.editorPlaceholder");t.store.add(be(n=>{let r=this._state.read(n),s=r?.placeholder!==void 0;o.root.style.display=s?"block":"none",o.root.innerText=r?.placeholder??""})),t.store.add(be(n=>{let r=this._editorObs.layoutInfo.read(n);o.root.style.left=`${r.contentLeft}px`,o.root.style.width=r.contentWidth-r.verticalScrollbarWidth+"px",o.root.style.top=`${this._editor.getTopForLineNumber(0)}px`})),t.store.add(be(n=>{o.root.style.fontFamily=this._editorObs.getOption(58).read(n),o.root.style.fontSize=this._editorObs.getOption(61).read(n)+"px",o.root.style.lineHeight=this._editorObs.getOption(75).read(n)+"px"})),t.store.add(this._editorObs.createOverlayWidget({allowEditorOverflow:!1,minContentWidthInPx:So(0),position:So(null),domNode:o.root}))}),this._view.recomputeInitiallyAndOnChange(this._store)}static get(e){return e.getContribution(a.ID)}static{this.ID="editor.contrib.placeholderText"}};function kGo(a,i){return Bf(a,(e,t)=>t===!0?!0:i(e))}function NXi(a){return DE()?OXi(a,sQe):a()}var VEt=class{constructor(i){this.instantiationService=i}init(...i){}};function OXi(a,i){return class extends i{constructor(){super(...arguments);this._autorun=void 0}init(...o){this._autorun=il((n,r)=>{let s=Xx(a(),n);r.add(this.instantiationService.createInstance(s,...o))})}dispose(){this._autorun?.dispose()}}}var sQe=class extends VEt{constructor(i){super(i),this.init()}};sQe=I([m(0,F)],sQe);function FXi(a){return DE()?OXi(a,aQe):a()}var aQe=class extends VEt{constructor(i,e){super(e),this.init(i)}};aQe=I([m(1,F)],aQe);xo(mB.ID,FXi(()=>mB),0);te("editor.placeholder.foreground",R3i,d(1497,null));var Uke=class extends x{constructor(e,t,o){super();this.editor=e;this.languageConfigurationService=t;this.editorWorkerService=o;this.decorations=this.editor.createDecorationsCollection(),this.options=this.createOptions(e.getOption(81)),this.computePromise=null,this.currentOccurrences={},this._register(e.onDidChangeModel(n=>{this.currentOccurrences={},this.options=this.createOptions(e.getOption(81)),this.stop(),this.computeSectionHeaders.schedule(0)})),this._register(e.onDidChangeModelLanguage(n=>{this.currentOccurrences={},this.options=this.createOptions(e.getOption(81)),this.stop(),this.computeSectionHeaders.schedule(0)})),this._register(t.onDidChange(n=>{let r=this.editor.getModel()?.getLanguageId();r&&n.affects(r)&&(this.currentOccurrences={},this.options=this.createOptions(e.getOption(81)),this.stop(),this.computeSectionHeaders.schedule(0))})),this._register(e.onDidChangeConfiguration(n=>{this.options&&!n.hasChanged(81)||(this.options=this.createOptions(e.getOption(81)),this.updateDecorations([]),this.stop(),this.computeSectionHeaders.schedule(0))})),this._register(this.editor.onDidChangeModelContent(n=>{this.computeSectionHeaders.schedule()})),this._register(e.onDidChangeModelTokens(n=>{this.computeSectionHeaders.isScheduled()||this.computeSectionHeaders.schedule(1e3)})),this.computeSectionHeaders=this._register(new Dt(()=>{this.findSectionHeaders()},250)),this.computeSectionHeaders.schedule(0)}static{this.ID="editor.sectionHeaderDetector"}createOptions(e){if(!e||!this.editor.hasModel())return;let t=this.editor.getModel().getLanguageId();if(!t)return;let o=this.languageConfigurationService.getLanguageConfiguration(t).comments,n=this.languageConfigurationService.getLanguageConfiguration(t).foldingRules;if(!(!o&&!n?.markers))return{foldingRules:n,markSectionHeaderRegex:e.markSectionHeaderRegex,findMarkSectionHeaders:e.showMarkSectionHeaders,findRegionSectionHeaders:e.showRegionSectionHeaders}}findSectionHeaders(){if(!this.editor.hasModel()||!this.options?.findMarkSectionHeaders&&!this.options?.findRegionSectionHeaders)return;let e=this.editor.getModel();if(e.isDisposed()||e.isTooLargeForSyncing())return;let t=e.getVersionId();this.editorWorkerService.findSectionHeaders(e.uri,this.options).then(o=>{e.isDisposed()||e.getVersionId()!==t||this.updateDecorations(o)})}updateDecorations(e){let t=this.editor.getModel();t&&(e=e.filter(r=>{if(!r.shouldBeInComments)return!0;let s=t.validateRange(r.range),l=t.tokenization.getLineTokens(s.startLineNumber),c=l.findTokenIndexAtOffset(s.startColumn-1),u=l.getStandardTokenType(c),p=t.getLanguageIdAtPosition(s.startLineNumber,s.startColumn);return l.getLanguageId(c)===p&&u===1}));let o=Object.values(this.currentOccurrences).map(r=>r.decorationId),n=e.map(r=>EGo(r));this.editor.changeDecorations(r=>{let s=r.deltaDecorations(o,n);this.currentOccurrences={};for(let l=0,c=s.length;l<c;l++){let u={sectionHeader:e[l],decorationId:s[l]};this.currentOccurrences[u.decorationId]=u}})}stop(){this.computeSectionHeaders.cancel(),this.computePromise&&(this.computePromise.cancel(),this.computePromise=null)}dispose(){super.dispose(),this.stop(),this.decorations.clear()}};Uke=I([m(1,Rs),m(2,Qs)],Uke);function EGo(a){return{range:a.range,options:mo.createDynamic({description:"section-header",stickiness:3,collapseOnReplaceEdit:!0,minimap:{color:void 0,position:1,sectionHeaderStyle:a.hasSeparatorLine?2:1,sectionHeaderText:a.text}})}}xo(Uke.ID,Uke,1);var BEt=class{constructor(i=5){this.timesPerSecond=i;this._lastRun=0,this._minimumTimeBetweenRuns=1e3/i}runIfNotLimited(i){let e=Date.now();e-this._lastRun>=this._minimumTimeBetweenRuns&&(this._lastRun=e,i())}};var HEt=class a{static create(i,e){return new a(i,new tpi(e))}get startLineNumber(){return this._startLineNumber}get endLineNumber(){return this._endLineNumber}constructor(i,e){this._startLineNumber=i,this._tokens=e,this._endLineNumber=this._startLineNumber+this._tokens.getMaxDeltaLine()}toString(){return this._tokens.toString(this._startLineNumber)}_updateEndLineNumber(){this._endLineNumber=this._startLineNumber+this._tokens.getMaxDeltaLine()}isEmpty(){return this._tokens.isEmpty()}getLineTokens(i){return this._startLineNumber<=i&&i<=this._endLineNumber?this._tokens.getLineTokens(i-this._startLineNumber):null}getRange(){let i=this._tokens.getRange();return i&&new z(this._startLineNumber+i.startLineNumber,i.startColumn,this._startLineNumber+i.endLineNumber,i.endColumn)}removeTokens(i){let e=i.startLineNumber-this._startLineNumber,t=i.endLineNumber-this._startLineNumber;this._startLineNumber+=this._tokens.removeTokens(e,i.startColumn-1,t,i.endColumn-1),this._updateEndLineNumber()}split(i){let e=i.startLineNumber-this._startLineNumber,t=i.endLineNumber-this._startLineNumber,[o,n,r]=this._tokens.split(e,i.startColumn-1,t,i.endColumn-1);return[new a(this._startLineNumber,o),new a(this._startLineNumber+r,n)]}applyEdit(i,e){let[t,o,n]=ZS(e);this.acceptEdit(i,t,o,n,e.length>0?e.charCodeAt(0):0)}acceptEdit(i,e,t,o,n){this._acceptDeleteRange(i),this._acceptInsertText(new ye(i.startLineNumber,i.startColumn),e,t,o,n),this._updateEndLineNumber()}_acceptDeleteRange(i){if(i.startLineNumber===i.endLineNumber&&i.startColumn===i.endColumn)return;let e=i.startLineNumber-this._startLineNumber,t=i.endLineNumber-this._startLineNumber;if(t<0){let n=t-e;this._startLineNumber-=n;return}let o=this._tokens.getMaxDeltaLine();if(!(e>=o+1)){if(e<0&&t>=o+1){this._startLineNumber=0,this._tokens.clear();return}if(e<0){let n=-e;this._startLineNumber-=n,this._tokens.acceptDeleteRange(i.startColumn-1,0,0,t,i.endColumn-1)}else this._tokens.acceptDeleteRange(0,e,i.startColumn-1,t,i.endColumn-1)}}_acceptInsertText(i,e,t,o,n){if(e===0&&t===0)return;let r=i.lineNumber-this._startLineNumber;if(r<0){this._startLineNumber+=e;return}let s=this._tokens.getMaxDeltaLine();r>=s+1||this._tokens.acceptInsertText(r,i.column-1,e,t,o,n)}reportIfInvalid(i){this._tokens.reportIfInvalid(i,this._startLineNumber)}},tpi=class a{constructor(i){this._tokens=i,this._tokenCount=i.length/4}toString(i){let e=[];for(let t=0;t<this._tokenCount;t++)e.push(`(${this._getDeltaLine(t)+i},${this._getStartCharacter(t)}-${this._getEndCharacter(t)})`);return`[${e.join(",")}]`}getMaxDeltaLine(){let i=this._getTokenCount();return i===0?-1:this._getDeltaLine(i-1)}getRange(){let i=this._getTokenCount();if(i===0)return null;let e=this._getStartCharacter(0),t=this._getDeltaLine(i-1),o=this._getEndCharacter(i-1);return new z(0,e+1,t,o+1)}_getTokenCount(){return this._tokenCount}_getDeltaLine(i){return this._tokens[4*i]}_getStartCharacter(i){return this._tokens[4*i+1]}_getEndCharacter(i){return this._tokens[4*i+2]}isEmpty(){return this._getTokenCount()===0}getLineTokens(i){let e=0,t=this._getTokenCount()-1;for(;e<t;){let o=e+Math.floor((t-e)/2),n=this._getDeltaLine(o);if(n<i)e=o+1;else if(n>i)t=o-1;else{let r=o;for(;r>e&&this._getDeltaLine(r-1)===i;)r--;let s=o;for(;s<t&&this._getDeltaLine(s+1)===i;)s++;return new UEt(this._tokens.subarray(4*r,4*s+4))}}return this._getDeltaLine(e)===i?new UEt(this._tokens.subarray(4*e,4*e+4)):null}clear(){this._tokenCount=0}removeTokens(i,e,t,o){let n=this._tokens,r=this._tokenCount,s=0,l=!1,c=0;for(let u=0;u<r;u++){let p=4*u,h=n[p],g=n[p+1],f=n[p+2],v=n[p+3];if((h>i||h===i&&f>=e)&&(h<t||h===t&&g<=o))l=!0;else{if(s===0&&(c=h),l){let b=4*s;n[b]=h-c,n[b+1]=g,n[b+2]=f,n[b+3]=v}else c!==0&&(n[p]=h-c);s++}}return this._tokenCount=s,c}split(i,e,t,o){let n=this._tokens,r=this._tokenCount,s=[],l=[],c=s,u=0,p=0;for(let h=0;h<r;h++){let g=4*h,f=n[g],v=n[g+1],b=n[g+2],S=n[g+3];if(f>i||f===i&&b>=e){if(f<t||f===t&&v<=o)continue;c!==l&&(c=l,u=0,p=f)}c[u++]=f-p,c[u++]=v,c[u++]=b,c[u++]=S}return[new a(new Uint32Array(s)),new a(new Uint32Array(l)),p]}acceptDeleteRange(i,e,t,o,n){let r=this._tokens,s=this._tokenCount,l=o-e,c=0,u=!1;for(let p=0;p<s;p++){let h=4*p,g=r[h],f=r[h+1],v=r[h+2],b=r[h+3];if(g<e||g===e&&v<=t){c++;continue}else if(g===e&&f<t)g===o&&v>n?v-=n-t:v=t;else if(g===e&&f===t)if(g===o&&v>n)v-=n-t;else{u=!0;continue}else if(g<o||g===o&&f<n)if(g===o&&v>n)g=e,f=t,v=f+(v-n);else{u=!0;continue}else if(g>o){if(l===0&&!u){c=s;break}g-=l}else if(g===o&&f>=n)i&&g===0&&(f+=i,v+=i),g-=l,f-=n-t,v-=n-t;else throw new Error("Not possible!");let S=4*c;r[S]=g,r[S+1]=f,r[S+2]=v,r[S+3]=b,c++}this._tokenCount=c}acceptInsertText(i,e,t,o,n,r){let s=t===0&&o===1&&(r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122),l=this._tokens,c=this._tokenCount;for(let u=0;u<c;u++){let p=4*u,h=l[p],g=l[p+1],f=l[p+2];if(!(h<i||h===i&&f<e)){if(h===i&&f===e)if(s)f+=1;else continue;else if(h===i&&g<e&&e<f)t===0?f+=o:f=e;else{if(h===i&&g===e&&s)continue;if(h===i)if(h+=t,t===0)g+=o,f+=o;else{let v=f-g;g=n+(g-e),f=g+v}else h+=t}l[p]=h,l[p+1]=g,l[p+2]=f}}}static{this._rateLimiter=new BEt(10/60)}reportIfInvalid(i,e){for(let t=0;t<this._tokenCount;t++){let o=this._getDeltaLine(t)+e;o<1?a._rateLimiter.runIfNotLimited(()=>{console.error("Invalid Semantic Tokens Data From Extension: lineNumber < 1")}):o>i.getLineCount()?a._rateLimiter.runIfNotLimited(()=>{console.error("Invalid Semantic Tokens Data From Extension: lineNumber > model.getLineCount()")}):this._getEndCharacter(t)>i.getLineLength(o)&&a._rateLimiter.runIfNotLimited(()=>{console.error("Invalid Semantic Tokens Data From Extension: end character > model.getLineLength(lineNumber)")})}}},UEt=class{constructor(i){this._tokens=i}getCount(){return this._tokens.length/4}getStartCharacter(i){return this._tokens[4*i+1]}getEndCharacter(i){return this._tokens[4*i+2]}getMetadata(i){return this._tokens[4*i+3]}};var zEt=!1,zke=class{constructor(i,e,t,o){this._legend=i;this._themeService=e;this._languageService=t;this._logService=o;this._hasWarnedOverlappingTokens=!1;this._hasWarnedInvalidLengthTokens=!1;this._hasWarnedInvalidEditStart=!1;this._hashTable=new opi}getMetadata(i,e,t){let o=this._languageService.languageIdCodec.encodeLanguageId(t),n=this._hashTable.get(i,e,o),r;if(n)r=n.metadata,zEt&&this._logService.getLevel()===1&&this._logService.trace(`SemanticTokensProviderStyling [CACHED] ${i} / ${e}: foreground ${bp.getForeground(r)}, fontStyle ${bp.getFontStyle(r).toString(2)}`);else{let s=this._legend.tokenTypes[i],l=[];if(s){let c=e;for(let p=0;c>0&&p<this._legend.tokenModifiers.length;p++)c&1&&l.push(this._legend.tokenModifiers[p]),c=c>>1;zEt&&c>0&&this._logService.getLevel()===1&&(this._logService.trace(`SemanticTokensProviderStyling: unknown token modifier index: ${e.toString(2)} for legend: ${JSON.stringify(this._legend.tokenModifiers)}`),l.push("not-in-legend"));let u=this._themeService.getColorTheme().getTokenStyleMetadata(s,l,t);if(typeof u>"u")r=2147483647;else{if(r=0,typeof u.italic<"u"){let p=(u.italic?1:0)<<11;r|=p|1}if(typeof u.bold<"u"){let p=(u.bold?2:0)<<11;r|=p|2}if(typeof u.underline<"u"){let p=(u.underline?4:0)<<11;r|=p|4}if(typeof u.strikethrough<"u"){let p=(u.strikethrough?8:0)<<11;r|=p|8}if(u.foreground){let p=u.foreground<<15;r|=p|16}r===0&&(r=2147483647)}}else zEt&&this._logService.getLevel()===1&&this._logService.trace(`SemanticTokensProviderStyling: unknown token type index: ${i} for legend: ${JSON.stringify(this._legend.tokenTypes)}`),r=2147483647,s="not-in-legend";this._hashTable.add(i,e,o,r),zEt&&this._logService.getLevel()===1&&this._logService.trace(`SemanticTokensProviderStyling ${i} (${s}) / ${e} (${l.join(" ")}): foreground ${bp.getForeground(r)}, fontStyle ${bp.getFontStyle(r).toString(2)}`)}return r}warnOverlappingSemanticTokens(i,e){this._hasWarnedOverlappingTokens||(this._hasWarnedOverlappingTokens=!0,this._logService.warn(`Overlapping semantic tokens detected at lineNumber ${i}, column ${e}`))}warnInvalidLengthSemanticTokens(i,e){this._hasWarnedInvalidLengthTokens||(this._hasWarnedInvalidLengthTokens=!0,this._logService.warn(`Semantic token with invalid length detected at lineNumber ${i}, column ${e}`))}warnInvalidEditStart(i,e,t,o,n){this._hasWarnedInvalidEditStart||(this._hasWarnedInvalidEditStart=!0,this._logService.warn(`Invalid semantic tokens edit detected (previousResultId: ${i}, resultId: ${e}) at edit #${t}: The provided start offset ${o} is outside the previous data (length ${n}).`))}};zke=I([m(1,Le),m(2,_t),m(3,se)],zke);function KEt(a,i,e){let t=a.data,o=a.data.length/5|0,n=Math.max(Math.ceil(o/1024),400),r=[],s=0,l=1,c=0;for(;s<o;){let u=s,p=Math.min(u+n,o);if(p<o){let y=p;for(;y-1>u&&t[5*y]===0;)y--;if(y-1===u){let w=p;for(;w+1<o&&t[5*w]===0;)w++;p=w}else p=y}let h=new Uint32Array((p-u)*4),g=0,f=0,v=0,b=0;for(;s<p;){let y=5*s,w=t[y],k=t[y+1],T=l+w|0,P=w===0?c+k|0:k,O=t[y+2],V=P+O|0,H=t[y+3],G=t[y+4];if(V<=P)i.warnInvalidLengthSemanticTokens(T,P+1);else if(v===T&&b>P)i.warnOverlappingSemanticTokens(T,P+1);else{let $=i.getMetadata(H,G,e);$!==2147483647&&(f===0&&(f=T),h[g]=T-f,h[g+1]=P,h[g+2]=V,h[g+3]=$,g+=4,v=T,b=V)}l=T,c=P,s++}g!==h.length&&(h=h.subarray(0,g));let S=HEt.create(f,h);r.push(S)}return r}var ipi=class{constructor(i,e,t,o){this.tokenTypeIndex=i,this.tokenModifierSet=e,this.languageId=t,this.metadata=o,this.next=null}},opi=class a{static{this._SIZES=[3,7,13,31,61,127,251,509,1021,2039,4093,8191,16381,32749,65521,131071,262139,524287,1048573,2097143]}constructor(){this._elementsCount=0,this._currentLengthIndex=0,this._currentLength=a._SIZES[this._currentLengthIndex],this._growCount=Math.round(this._currentLengthIndex+1<a._SIZES.length?2/3*this._currentLength:0),this._elements=[],a._nullOutEntries(this._elements,this._currentLength)}static _nullOutEntries(i,e){for(let t=0;t<e;t++)i[t]=null}_hash2(i,e){return(i<<5)-i+e|0}_hashFunc(i,e,t){return this._hash2(this._hash2(i,e),t)%this._currentLength}get(i,e,t){let o=this._hashFunc(i,e,t),n=this._elements[o];for(;n;){if(n.tokenTypeIndex===i&&n.tokenModifierSet===e&&n.languageId===t)return n;n=n.next}return null}add(i,e,t,o){if(this._elementsCount++,this._growCount!==0&&this._elementsCount>=this._growCount){let n=this._elements;this._currentLengthIndex++,this._currentLength=a._SIZES[this._currentLengthIndex],this._growCount=Math.round(this._currentLengthIndex+1<a._SIZES.length?2/3*this._currentLength:0),this._elements=[],a._nullOutEntries(this._elements,this._currentLength);for(let r of n){let s=r;for(;s;){let l=s.next;s.next=null,this._add(s),s=l}}}this._add(new ipi(i,e,t,o))}_add(i){let e=this._hashFunc(i.tokenTypeIndex,i.tokenModifierSet,i.languageId);i.next=this._elements[e],this._elements[e]=i}};var ude=le("semanticTokensStylingService");function WXi(a){for(let i=0,e=a.length;i<e;i+=4){let t=a[i+0],o=a[i+1],n=a[i+2],r=a[i+3];a[i+0]=r,a[i+1]=n,a[i+2]=o,a[i+3]=t}}function TGo(a){let i=new Uint8Array(a.buffer,a.byteOffset,a.length*4);return m$e()||WXi(i),qe.wrap(i)}function _Go(a){let i=a.buffer;if(m$e()||WXi(i),i.byteOffset%4===0)return new Uint32Array(i.buffer,i.byteOffset,i.length/4);{let e=new Uint8Array(i.byteLength);return e.set(i),new Uint32Array(e.buffer,e.byteOffset,e.length/4)}}function npi(a){let i=new Uint32Array(DGo(a)),e=0;if(i[e++]=a.id,a.type==="full")i[e++]=1,i[e++]=a.data.length,i.set(a.data,e),e+=a.data.length;else{i[e++]=2,i[e++]=a.deltas.length;for(let t of a.deltas)i[e++]=t.start,i[e++]=t.deleteCount,t.data?(i[e++]=t.data.length,i.set(t.data,e),e+=t.data.length):i[e++]=0}return TGo(i)}function DGo(a){let i=0;if(i+=2,a.type==="full")i+=1+a.data.length;else{i+=1,i+=3*a.deltas.length;for(let e of a.deltas)e.data&&(i+=e.data.length)}return i}function rpi(a){let i=_Go(a),e=0,t=i[e++];if(i[e++]===1){let s=i[e++],l=i.subarray(e,e+s);return e+=s,{id:t,type:"full",data:l}}let n=i[e++],r=[];for(let s=0;s<n;s++){let l=i[e++],c=i[e++],u=i[e++],p;u>0&&(p=i.subarray(e,e+u),e+=u),r[s]={start:l,deleteCount:c,data:p}}return{id:t,type:"delta",deltas:r}}function lQe(a){return a&&!!a.data}function lpi(a){return a&&Array.isArray(a.edits)}var spi=class{constructor(i,e,t){this.provider=i;this.tokens=e;this.error=t}};function cpi(a,i){return a.has(i)}function LGo(a,i){let e=a.orderedGroups(i);return e.length>0?e[0]:[]}async function dpi(a,i,e,t,o){let n=LGo(a,i),r=await Promise.all(n.map(async s=>{let l,c=null;try{l=await s.provideDocumentSemanticTokens(i,s===e?t:null,o)}catch(u){c=u,l=null}return(!l||!lQe(l)&&!lpi(l))&&(l=null),new spi(s,l,c)}));for(let s of r){if(s.error)throw s.error;if(s.tokens)return s}return r.length>0?r[0]:null}function RGo(a,i){let e=a.orderedGroups(i);return e.length>0?e[0]:null}var api=class{constructor(i,e){this.provider=i;this.tokens=e}};function VXi(a,i){return a.has(i)}function BXi(a,i){let e=a.orderedGroups(i);return e.length>0?e[0]:[]}async function GEt(a,i,e,t){let o=BXi(a,i),n=await Promise.all(o.map(async r=>{let s;try{s=await r.provideDocumentRangeSemanticTokens(i,e,t)}catch(l){ys(l),s=null}return(!s||!lQe(s))&&(s=null),new api(r,s)}));for(let r of n)if(r.tokens)return r;return n.length>0?n[0]:null}$e.registerCommand("_provideDocumentSemanticTokensLegend",async(a,...i)=>{let[e]=i;wo(e instanceof A);let t=a.get(Tt).getModel(e);if(!t)return;let{documentSemanticTokensProvider:o}=a.get(Qt),n=RGo(o,t);return n?n[0].getLegend():a.get(ge).executeCommand("_provideDocumentRangeSemanticTokensLegend",e)});$e.registerCommand("_provideDocumentSemanticTokens",async(a,...i)=>{let[e]=i;wo(e instanceof A);let t=a.get(Tt).getModel(e);if(!t)return;let{documentSemanticTokensProvider:o}=a.get(Qt);if(!cpi(o,t))return a.get(ge).executeCommand("_provideDocumentRangeSemanticTokens",e,t.getFullModelRange());let n=await dpi(o,t,null,null,Se.None);if(!n)return;let{provider:r,tokens:s}=n;if(!s||!lQe(s))return;let l=npi({id:0,type:"full",data:s.data});return s.resultId&&r.releaseDocumentSemanticTokens(s.resultId),l});$e.registerCommand("_provideDocumentRangeSemanticTokensLegend",async(a,...i)=>{let[e,t]=i;wo(e instanceof A);let o=a.get(Tt).getModel(e);if(!o)return;let{documentRangeSemanticTokensProvider:n}=a.get(Qt),r=BXi(n,o);if(r.length===0)return;if(r.length===1)return r[0].getLegend();if(!t||!z.isIRange(t))return console.warn("provideDocumentRangeSemanticTokensLegend might be out-of-sync with provideDocumentRangeSemanticTokens unless a range argument is passed in"),r[0].getLegend();let s=await GEt(n,o,z.lift(t),Se.None);if(s)return s.provider.getLegend()});$e.registerCommand("_provideDocumentRangeSemanticTokens",async(a,...i)=>{let[e,t]=i;wo(e instanceof A),wo(z.isIRange(t));let o=a.get(Tt).getModel(e);if(!o)return;let{documentRangeSemanticTokensProvider:n}=a.get(Qt),r=await GEt(n,o,z.lift(t),Se.None);if(!(!r||!r.tokens))return npi({id:0,type:"full",data:r.tokens.data})});var pde="editor.semanticHighlighting";function Kke(a,i,e){let t=e.getValue(pde,{overrideIdentifier:a.getLanguageId(),resource:a.uri})?.enabled;return typeof t=="boolean"?t:i.getColorTheme().semanticHighlighting}var cQe=class extends x{constructor(e,t,o,n,r,s){super();this._watchers=new gt;this._providerChangeListeners=this._register(new N);let l=s.documentSemanticTokensProvider,c=g=>{this._watchers.get(g.uri)?.dispose(),this._watchers.set(g.uri,new gF(g,e,o,r,s))},u=(g,f)=>{f.dispose(),this._watchers.delete(g.uri)},p=()=>{for(let g of t.getModels()){let f=this._watchers.get(g.uri);Kke(g,o,n)?f||c(g):f&&u(g,f)}},h=()=>{this._providerChangeListeners.clear();for(let g of l.allNoModel())typeof g.onDidChange=="function"&&this._providerChangeListeners.add(g.onDidChange(()=>{for(let f of this._watchers.values())f.handleProviderDidChange(g)}))};t.getModels().forEach(g=>{Kke(g,o,n)&&c(g)}),this._register(t.onModelAdded(g=>{Kke(g,o,n)&&c(g)})),this._register(t.onModelRemoved(g=>{let f=this._watchers.get(g.uri);f&&u(g,f)})),this._register(n.onDidChangeConfiguration(g=>{g.affectsConfiguration(pde)&&p()})),this._register(o.onDidColorThemeChange(p)),h(),this._register(l.onDidChange(()=>{h();for(let g of this._watchers.values())g.handleRegistryChange()}))}dispose(){Be(this._watchers.values()),this._watchers.clear(),super.dispose()}};cQe=I([m(0,ude),m(1,Tt),m(2,Le),m(3,B),m(4,hf),m(5,Qt)],cQe);var gF=class extends x{constructor(e,t,o,n,r){super();this._semanticTokensStylingService=t;this._relevantProviders=new Set;this._isDisposed=!1,this._model=e,this._provider=r.documentSemanticTokensProvider,this._debounceInformation=n.for(this._provider,"DocumentSemanticTokens",{min:gF.REQUEST_MIN_DELAY,max:gF.REQUEST_MAX_DELAY}),this._fetchDocumentSemanticTokens=this._register(new Dt(()=>this._fetchDocumentSemanticTokensNow(),gF.REQUEST_MIN_DELAY)),this._currentDocumentResponse=null,this._currentDocumentRequestCancellationTokenSource=null,this._providersChangedDuringRequest=!1,this._updateRelevantProviders(),this._register(this._model.onDidChangeContent(()=>{this._fetchDocumentSemanticTokens.isScheduled()||this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))})),this._register(this._model.onDidChangeAttached(()=>{this._fetchDocumentSemanticTokens.isScheduled()||this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))})),this._register(this._model.onDidChangeLanguage(()=>{this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._currentDocumentRequestCancellationTokenSource&&(this._currentDocumentRequestCancellationTokenSource.cancel(),this._currentDocumentRequestCancellationTokenSource=null),this._setDocumentSemanticTokens(null,null,null,[]),this._updateRelevantProviders(),this._fetchDocumentSemanticTokens.schedule(0)})),this._register(o.onDidColorThemeChange(s=>{this._setDocumentSemanticTokens(null,null,null,[]),this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))})),this._fetchDocumentSemanticTokens.schedule(0)}static{this.REQUEST_MIN_DELAY=300}static{this.REQUEST_MAX_DELAY=2e3}handleRegistryChange(){this._updateRelevantProviders(),this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))}handleProviderDidChange(e){if(this._relevantProviders.has(e)){if(this._currentDocumentRequestCancellationTokenSource){this._providersChangedDuringRequest=!0;return}this._fetchDocumentSemanticTokens.schedule(0)}}_updateRelevantProviders(){this._relevantProviders=new Set(this._provider.all(this._model))}dispose(){this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._currentDocumentRequestCancellationTokenSource&&(this._currentDocumentRequestCancellationTokenSource.cancel(),this._currentDocumentRequestCancellationTokenSource=null),this._setDocumentSemanticTokens(null,null,null,[]),this._isDisposed=!0,super.dispose()}_fetchDocumentSemanticTokensNow(){if(this._currentDocumentRequestCancellationTokenSource)return;if(!cpi(this._provider,this._model)){this._currentDocumentResponse&&this._model.tokenization.setSemanticTokens(null,!1);return}if(!this._model.isAttachedToEditor())return;let e=new Ye,t=this._currentDocumentResponse?this._currentDocumentResponse.provider:null,o=this._currentDocumentResponse&&this._currentDocumentResponse.resultId||null,n=dpi(this._provider,this._model,t,o,e.token);this._currentDocumentRequestCancellationTokenSource=e,this._providersChangedDuringRequest=!1;let r=[],s=this._model.onDidChangeContent(c=>{r.push(c)}),l=new Dn(!1);n.then(c=>{if(this._debounceInformation.update(this._model,l.elapsed()),this._currentDocumentRequestCancellationTokenSource=null,s.dispose(),!c)this._setDocumentSemanticTokens(null,null,null,r);else{let{provider:u,tokens:p}=c,h=this._semanticTokensStylingService.getStyling(u);this._setDocumentSemanticTokens(u,p||null,h,r)}},c=>{c&&(ao(c)||typeof c.message=="string"&&c.message.indexOf("busy")!==-1)||mt(c),this._currentDocumentRequestCancellationTokenSource=null,s.dispose(),(r.length>0||this._providersChangedDuringRequest)&&(this._fetchDocumentSemanticTokens.isScheduled()||this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model)))})}static _copy(e,t,o,n,r){r=Math.min(r,o.length-n,e.length-t);for(let s=0;s<r;s++)o[n+s]=e[t+s]}_setDocumentSemanticTokens(e,t,o,n){let r=this._currentDocumentResponse,s=()=>{(n.length>0||this._providersChangedDuringRequest)&&!this._fetchDocumentSemanticTokens.isScheduled()&&this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))};if(this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._isDisposed){e&&t&&e.releaseDocumentSemanticTokens(t.resultId);return}if(!e||!o){this._model.tokenization.setSemanticTokens(null,!1);return}if(!t){this._model.tokenization.setSemanticTokens(null,!0),s();return}if(lpi(t)){if(!r){this._model.tokenization.setSemanticTokens(null,!0);return}if(t.edits.length===0)t={resultId:t.resultId,data:r.data};else{let l=0;for(let g of t.edits)l+=(g.data?g.data.length:0)-g.deleteCount;let c=r.data,u=new Uint32Array(c.length+l),p=c.length,h=u.length;for(let g=t.edits.length-1;g>=0;g--){let f=t.edits[g];if(f.start>c.length){o.warnInvalidEditStart(r.resultId,t.resultId,g,f.start,c.length),this._model.tokenization.setSemanticTokens(null,!0);return}let v=p-(f.start+f.deleteCount);v>0&&(gF._copy(c,p-v,u,h-v,v),h-=v),f.data&&(gF._copy(f.data,0,u,h-f.data.length,f.data.length),h-=f.data.length),p=f.start}p>0&&gF._copy(c,0,u,0,p),t={resultId:t.resultId,data:u}}}if(lQe(t)){this._currentDocumentResponse=new upi(e,t.resultId,t.data);let l=KEt(t,o,this._model.getLanguageId());if(n.length>0)for(let c of n)for(let u of l)for(let p of c.changes)u.applyEdit(p.range,p.text);this._model.tokenization.setSemanticTokens(l,!0)}else this._model.tokenization.setSemanticTokens(null,!0);s()}};gF=I([m(1,ude),m(2,Le),m(3,hf),m(4,Qt)],gF);var upi=class{constructor(i,e,t){this.provider=i;this.resultId=e;this.data=t}dispose(){this.provider.releaseDocumentSemanticTokens(this.resultId)}};ik(cQe);var hB=class extends x{constructor(e,t,o,n,r,s){super();this._semanticTokensStylingService=t;this._themeService=o;this._configurationService=n;this._editor=e,this._provider=s.documentRangeSemanticTokensProvider,this._debounceInformation=r.for(this._provider,"DocumentRangeSemanticTokens",{min:100,max:500}),this._tokenizeViewport=this._register(new Dt(()=>this._tokenizeViewportNow(),100)),this._outstandingRequests=[],this._rangeProvidersChangeListeners=[];let l=()=>{this._editor.hasModel()&&this._tokenizeViewport.schedule(this._debounceInformation.get(this._editor.getModel()))},c=()=>{if(this._cleanupProviderListeners(),this._editor.hasModel()){let u=this._editor.getModel();for(let p of this._provider.all(u)){let h=p.onDidChange?.(()=>{this._cancelAll(),l()});h&&this._rangeProvidersChangeListeners.push(h)}}};this._register(this._editor.onDidScrollChange(()=>{l()})),this._register(this._editor.onDidChangeModel(()=>{c(),this._cancelAll(),l()})),this._register(this._editor.onDidChangeModelLanguage(()=>{c(),this._cancelAll(),l()})),this._register(this._editor.onDidChangeModelContent(u=>{this._cancelAll(),l()})),c(),this._register(this._provider.onDidChange(()=>{c(),this._cancelAll(),l()})),this._register(this._configurationService.onDidChangeConfiguration(u=>{u.affectsConfiguration(pde)&&(this._cancelAll(),l())})),this._register(this._themeService.onDidColorThemeChange(()=>{this._cancelAll(),l()})),l()}static{this.ID="editor.contrib.viewportSemanticTokens"}static get(e){return e.getContribution(hB.ID)}dispose(){this._cleanupProviderListeners(),super.dispose()}_cleanupProviderListeners(){Be(this._rangeProvidersChangeListeners),this._rangeProvidersChangeListeners=[]}_cancelAll(){for(let e of this._outstandingRequests)e.cancel();this._outstandingRequests=[]}_removeOutstandingRequest(e){for(let t=0,o=this._outstandingRequests.length;t<o;t++)if(this._outstandingRequests[t]===e){this._outstandingRequests.splice(t,1);return}}_tokenizeViewportNow(){if(!this._editor.hasModel())return;let e=this._editor.getModel();if(e.tokenization.hasCompleteSemanticTokens())return;if(!Kke(e,this._themeService,this._configurationService)){e.tokenization.hasSomeSemanticTokens()&&e.tokenization.setSemanticTokens(null,!1);return}if(!VXi(this._provider,e)){e.tokenization.hasSomeSemanticTokens()&&e.tokenization.setSemanticTokens(null,!1);return}let t=this._editor.getVisibleRangesPlusViewportAboveBelow();this._outstandingRequests=this._outstandingRequests.concat(t.map(o=>this._requestRange(e,o)))}_requestRange(e,t){let o=e.getVersionId(),n=Ln(s=>Promise.resolve(GEt(this._provider,e,t,s))),r=new Dn(!1);return n.then(s=>{if(this._debounceInformation.update(e,r.elapsed()),!s||!s.tokens||e.isDisposed()||e.getVersionId()!==o)return;let{provider:l,tokens:c}=s,u=this._semanticTokensStylingService.getStyling(l);e.tokenization.setPartialSemanticTokens(t,KEt(c,u,e.getLanguageId()))}).then(()=>this._removeOutstandingRequest(n),()=>this._removeOutstandingRequest(n)),n}};hB=I([m(1,ude),m(2,Le),m(3,B),m(4,hf),m(5,Qt)],hB);xo(hB.ID,hB,1);var qEt=class{constructor(i=!0){this.selectSubwords=i}provideSelectionRanges(i,e){let t=[];for(let o of e){let n=[];t.push(n),this.selectSubwords&&this._addInWordRanges(n,i,o),this._addWordRanges(n,i,o),this._addWhitespaceLine(n,i,o),n.push({range:i.getFullModelRange()})}return t}_addInWordRanges(i,e,t){let o=e.getWordAtPosition(t);if(!o)return;let{word:n,startColumn:r}=o,s=t.column-r,l=s,c=s,u=0;for(;l>=0;l--){let p=n.charCodeAt(l);if(l!==s&&(p===95||p===45))break;if(h1(p)&&pE(u))break;u=p}for(l+=1;c<n.length;c++){let p=n.charCodeAt(c);if(pE(p)&&h1(u))break;if(p===95||p===45)break;u=p}l<c&&i.push({range:new z(t.lineNumber,r+l,t.lineNumber,r+c)})}_addWordRanges(i,e,t){let o=e.getWordAtPosition(t);o&&i.push({range:new z(t.lineNumber,o.startColumn,t.lineNumber,o.endColumn)})}_addWhitespaceLine(i,e,t){e.getLineLength(t.lineNumber)>0&&e.getLineFirstNonWhitespaceColumn(t.lineNumber)===0&&e.getLineLastNonWhitespaceColumn(t.lineNumber)===0&&i.push({range:new z(t.lineNumber,1,t.lineNumber,e.getLineMaxColumn(t.lineNumber))})}};var ppi=class a{constructor(i,e){this.index=i;this.ranges=e}mov(i){let e=this.index+(i?1:-1);if(e<0||e>=this.ranges.length)return this;let t=new a(e,this.ranges);return t.ranges[e].equalsRange(this.ranges[this.index])?t.mov(i):t}},fF=class{constructor(i,e){this._editor=i;this._languageFeaturesService=e;this._ignoreSelection=!1}static{this.ID="editor.contrib.smartSelectController"}static get(i){return i.getContribution(fF.ID)}dispose(){this._selectionListener?.dispose()}async run(i){if(!this._editor.hasModel())return;let e=this._editor.getSelections(),t=this._editor.getModel();if(this._state||await HXi(this._languageFeaturesService.selectionRangeProvider,t,e.map(n=>n.getPosition()),this._editor.getOption(129),Se.None).then(n=>{if(!(!yr(n)||n.length!==e.length)&&!(!this._editor.hasModel()||!$i(this._editor.getSelections(),e,(r,s)=>r.equalsSelection(s)))){for(let r=0;r<n.length;r++)n[r]=n[r].filter(s=>s.containsPosition(e[r].getStartPosition())&&s.containsPosition(e[r].getEndPosition())),n[r].unshift(e[r]);this._state=n.map(r=>new ppi(0,r)),this._selectionListener?.dispose(),this._selectionListener=this._editor.onDidChangeCursorPosition(()=>{this._ignoreSelection||(this._selectionListener?.dispose(),this._state=void 0)})}}),!this._state)return;this._state=this._state.map(n=>n.mov(i));let o=this._state.map(n=>ti.fromPositions(n.ranges[n.index].getStartPosition(),n.ranges[n.index].getEndPosition()));this._ignoreSelection=!0;try{this._editor.setSelections(o)}finally{this._ignoreSelection=!1}}};fF=I([m(1,Qt)],fF);var $Et=class extends Di{constructor(i,e){super(e),this._forward=i}async run(i,e){let t=fF.get(e);t&&await t.run(this._forward)}},mpi=class extends $Et{constructor(){super(!0,{id:"editor.action.smartSelect.expand",label:L(1563,"Expand Selection"),precondition:void 0,kbOpts:{kbExpr:pe.editorTextFocus,primary:1553,mac:{primary:3345,secondary:[1297]},weight:100},menuOpts:{menuId:D.MenubarSelectionMenu,group:"1_basic",title:d(1561,null),order:2}})}};$e.registerCommandAlias("editor.action.smartSelect.grow","editor.action.smartSelect.expand");var hpi=class extends $Et{constructor(){super(!1,{id:"editor.action.smartSelect.shrink",label:L(1564,"Shrink Selection"),precondition:void 0,kbOpts:{kbExpr:pe.editorTextFocus,primary:1551,mac:{primary:3343,secondary:[1295]},weight:100},menuOpts:{menuId:D.MenubarSelectionMenu,group:"1_basic",title:d(1562,null),order:3}})}};xo(fF.ID,fF,4);ni(mpi);ni(hpi);async function HXi(a,i,e,t,o){let n=a.all(i).concat(new qEt(t.selectSubwords));n.length===1&&n.unshift(new mke);let r=[],s=[];for(let l of n)r.push(Promise.resolve(l.provideSelectionRanges(i,e,o)).then(c=>{if(yr(c)&&c.length===e.length)for(let u=0;u<e.length;u++){s[u]||(s[u]=[]);for(let p of c[u])z.isIRange(p.range)&&z.containsPosition(p.range,e[u])&&s[u].push(z.lift(p.range))}},ys));return await Promise.all(r),s.map(l=>{if(l.length===0)return[];l.sort((h,g)=>ye.isBefore(h.getStartPosition(),g.getStartPosition())?1:ye.isBefore(g.getStartPosition(),h.getStartPosition())||ye.isBefore(h.getEndPosition(),g.getEndPosition())?-1:ye.isBefore(g.getEndPosition(),h.getEndPosition())?1:0);let c=[],u;for(let h of l)(!u||z.containsRange(h,u)&&!z.equalsRange(h,u))&&(c.push(h),u=h);if(!t.selectLeadingAndTrailingWhitespace)return c;let p=[c[0]];for(let h=1;h<c.length;h++){let g=c[h-1],f=c[h];if(f.startLineNumber!==g.startLineNumber||f.endLineNumber!==g.endLineNumber){let v=new z(g.startLineNumber,i.getLineFirstNonWhitespaceColumn(g.startLineNumber),g.endLineNumber,i.getLineLastNonWhitespaceColumn(g.endLineNumber));v.containsRange(g)&&!v.equalsRange(g)&&f.containsRange(v)&&!f.equalsRange(v)&&p.push(v);let b=new z(g.startLineNumber,1,g.endLineNumber,i.getLineMaxColumn(g.endLineNumber));b.containsRange(g)&&!b.equalsRange(v)&&f.containsRange(b)&&!f.equalsRange(b)&&p.push(b)}p.push(f)}return p})}$e.registerCommand("_executeSelectionRangeProvider",async function(a,...i){let[e,t]=i;wo(A.isUri(e)),wo(wXt(t,r=>ye.isIPosition(r)));let o=a.get(Qt).selectionRangeProvider,n=await a.get(Bt).createModelReference(e);try{return HXi(o,n.object.textEditorModel,t.map(ye.lift),{selectLeadingAndTrailingWhitespace:!0,selectSubwords:!0},Se.None)}finally{n.dispose()}});var Ve=Object.freeze({View:L(1807,"View"),Help:L(1804,"Help"),Test:L(1806,"Test"),File:L(1803,"File"),Preferences:L(1805,"Preferences"),Developer:L(1802,"Developer")});var jEt=class extends pl{constructor(){super({id:"editor.action.toggleStickyScroll",title:{...L(1616,"Toggle Editor Sticky Scroll"),mnemonicTitle:d(1611,null)},metadata:{description:L(1617,"Toggle/enable the editor sticky scroll which shows the nested scopes at the top of the viewport")},category:Ve.View,toggled:{condition:C.equals("config.editor.stickyScroll.enabled",!0),title:d(1615,null),mnemonicTitle:d(1610,null)},menu:[{id:D.CommandPalette},{id:D.MenubarAppearanceMenu,group:"4_editor",order:3},{id:D.StickyScrollContext}]})}async runEditorCommand(i,e){let t=i.get(B),o=!t.getValue("editor.stickyScroll.enabled"),n=fb.get(e)?.isFocused();t.updateValue("editor.stickyScroll.enabled",o),n&&e.focus()}},eTt=100,QEt=class extends pl{constructor(){super({id:"editor.action.focusStickyScroll",title:{...L(1607,"Focus Editor Sticky Scroll"),mnemonicTitle:d(1609,null)},precondition:C.and(C.has("config.editor.stickyScroll.enabled"),pe.stickyScrollVisible),menu:[{id:D.CommandPalette}]})}runEditorCommand(i,e){fb.get(e)?.focus()}},YEt=class extends pl{constructor(){super({id:"editor.action.selectNextStickyScrollLine",title:L(1613,"Select the next editor sticky scroll line"),precondition:pe.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:eTt,primary:18}})}runEditorCommand(i,e){fb.get(e)?.focusNext()}},XEt=class extends pl{constructor(){super({id:"editor.action.selectPreviousStickyScrollLine",title:L(1614,"Select the previous sticky scroll line"),precondition:pe.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:eTt,primary:16}})}runEditorCommand(i,e){fb.get(e)?.focusPrevious()}},JEt=class extends pl{constructor(){super({id:"editor.action.goToFocusedStickyScrollLine",title:L(1608,"Go to the focused sticky scroll line"),precondition:pe.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:eTt,primary:3}})}runEditorCommand(i,e){fb.get(e)?.goToFocused()}},ZEt=class extends pl{constructor(){super({id:"editor.action.selectEditor",title:L(1612,"Select Editor"),precondition:pe.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:eTt,primary:9}})}runEditorCommand(i,e){fb.get(e)?.selectEditor()}};xo(fb.ID,fb,1);W(jEt);W(QEt);W(XEt);W(YEt);W(JEt);W(ZEt);var gpi=class{constructor(i,e,t,o,n,r,s){this.range=i;this.insertText=e;this.filterText=t;this.additionalTextEdits=o;this.command=n;this.gutterMenuLinkAction=r;this.completion=s;this.doNotLog=!0}},dQe=class extends s1{constructor(e,t,o,n,r,s){super(r.disposable);this.model=e;this.line=t;this.word=o;this.completionModel=n;this._suggestMemoryService=s}canBeReused(e,t,o){return this.model===e&&this.line===t&&this.word.word.length>0&&this.word.startColumn===o.startColumn&&this.word.endColumn<o.endColumn&&this.completionModel.getIncompleteProvider().size===0}get items(){let e=[],{items:t}=this.completionModel,o=this._suggestMemoryService.select(this.model,{lineNumber:this.line,column:this.word.endColumn+this.completionModel.lineContext.characterCountDelta},t),n=vt.slice(t,o),r=vt.slice(t,0,o),s=5;for(let l of vt.concat(n,r)){if(l.score===kv.Default)continue;let c=new z(l.editStart.lineNumber,l.editStart.column,l.editInsertEnd.lineNumber,l.editInsertEnd.column+this.completionModel.lineContext.characterCountDelta),u=l.completion.insertTextRules&&l.completion.insertTextRules&4?{snippet:l.completion.insertText}:l.completion.insertText;e.push(new gpi(c,u,l.filterTextLow??l.labelLow,l.completion.additionalTextEdits,l.completion.command,l.completion.action,l)),s-->=0&&l.resolve(Se.None)}return e}};dQe=I([m(5,pke)],dQe);var uQe=class extends x{constructor(e,t,o,n){super();this._languageFeatureService=e;this._clipboardService=t;this._suggestMemoryService=o;this._editorService=n;this._store.add(e.inlineCompletionsProvider.register("*",this))}async provideInlineCompletions(e,t,o,n){if(o.selectedSuggestionInfo)return;let r;for(let f of this._editorService.listCodeEditors())if(f.getModel()===e){r=f;break}if(!r)return;let s=r.getOption(102);if(oK.isAllOff(s))return;e.tokenization.tokenizeIfCheap(t.lineNumber);let l=e.tokenization.getLineTokens(t.lineNumber),c=l.getStandardTokenType(l.findTokenIndexAtOffset(Math.max(t.column-1-1,0)));if(oK.valueFor(s,c)!=="inline")return;let u=e.getWordAtPosition(t),p;if(u?.word||(p=this._getTriggerCharacterInfo(e,t)),!u?.word&&!p||(u||(u=e.getWordUntilPosition(t)),u.endColumn!==t.column))return;let h,g=e.getValueInRange(new z(t.lineNumber,1,t.lineNumber,t.column));if(!p&&this._lastResult?.canBeReused(e,t.lineNumber,u)){let f=new M8e(g,t.column-this._lastResult.word.endColumn);this._lastResult.completionModel.lineContext=f,this._lastResult.acquire(),h=this._lastResult}else{let f=await Yce(this._languageFeatureService.completionProvider,e,t,new I5(void 0,aK.createSuggestFilter(r).itemKind,p?.providers),p&&{triggerKind:1,triggerCharacter:p.ch},n),v;f.needsClipboard&&(v=await this._clipboardService.readText());let b=new gke(f.items,t.column,new M8e(g,0),hke.None,r.getOption(134),r.getOption(128),{boostFullMatch:!1,firstMatchCanBeWeak:!1},v);h=new dQe(e,t.lineNumber,u,b,f,this._suggestMemoryService)}return this._lastResult=h,h}handleItemDidShow(e,t){t.completion.resolve(Se.None)}disposeInlineCompletions(e){e.release()}_getTriggerCharacterInfo(e,t){let o=e.getValueInRange(z.fromPositions({lineNumber:t.lineNumber,column:t.column-1},t)),n=new Set;for(let r of this._languageFeatureService.completionProvider.all(e))r.triggerCharacters?.includes(o)&&n.add(r);if(n.size!==0)return{providers:n,ch:o}}};uQe=I([m(0,Qt),m(1,Fi),m(2,pke),m(3,qt)],uQe);ik(uQe);var fpi=class extends Di{constructor(){super({id:"editor.action.forceRetokenize",label:L(1694,"Developer: Force Retokenize"),precondition:void 0})}run(i,e){if(!e.hasModel())return;let t=e.getModel();t.tokenization.resetTokenization();let o=new Dn;t.tokenization.forceTokenization(t.getLineCount()),o.stop(),console.log(`tokenization took ${o.elapsed()}`)}};ni(fpi);var pQe=class a extends K{static{this.ID="editor.action.toggleTabFocusMode"}constructor(){super({id:a.ID,title:L(1691,"Toggle Tab Key Moves Focus"),precondition:void 0,keybinding:{primary:2091,mac:{primary:1323},weight:100},metadata:{description:L(1690,"Determines whether the tab key moves focus around the workbench or inserts the tab character in the current editor. This is also called tab trapping, tab navigation, or tab focus mode.")},f1:!0})}run(){let e=!x_.getTabFocusMode();x_.setTabFocusMode(e),e?en(d(1693,null)):en(d(1692,null))}};W(pQe);var rg=class extends x{constructor(e,t,o={},n,r){super();this._link=t;this._hoverService=n;this._enabled=!0;this.el=M(e,_("a.monaco-link",{tabIndex:t.tabIndex??0,href:t.href},t.label)),this.hoverDelegate=o.hoverDelegate??Ri("mouse"),this.setTooltip(t.title),this.el.setAttribute("role","button");let s=this._register(new Gn(this.el,"click")),l=this._register(new Gn(this.el,"keydown")),c=U.chain(l.event,h=>h.map(g=>new gi(g)).filter(g=>g.keyCode===3||g.keyCode===10)),u=this._register(new Gn(this.el,Kn.Tap)).event;this._register(Ms.addTarget(this.el));let p=U.any(s.event,c,u);this._register(p(h=>{this.enabled&&(Xt.stop(h,!0),o?.opener?o.opener(this._link.href):r.open(this._link.href,{allowCommands:!0}))})),this.enabled=!0}get enabled(){return this._enabled}set enabled(e){e?(this.el.setAttribute("aria-disabled","false"),this.el.tabIndex=0,this.el.style.pointerEvents="auto",this.el.style.opacity="1",this.el.style.cursor="pointer",this._enabled=!1):(this.el.setAttribute("aria-disabled","true"),this.el.tabIndex=-1,this.el.style.pointerEvents="none",this.el.style.opacity="0.4",this.el.style.cursor="default",this._enabled=!0),this._enabled=e}set link(e){typeof e.label=="string"?this.el.textContent=e.label:(Rt(this.el),this.el.appendChild(e.label)),this.el.href=e.href,typeof e.tabIndex<"u"&&(this.el.tabIndex=e.tabIndex),this.setTooltip(e.title),this._link=e}setTooltip(e){!this.hover&&e?this.hover=this._register(this._hoverService.setupManagedHover(this.hoverDelegate,this.el,e)):this.hover&&this.hover.update(e)}};rg=I([m(3,nt),m(4,Je)],rg);var MGo=26,Gke=class extends x{constructor(e,t){super();this._editor=e;this.instantiationService=t;this.banner=this._register(this.instantiationService.createInstance(mQe))}hide(){this._editor.setBanner(null,0),this.banner.clear()}show(e){this.banner.show({...e,onClose:()=>{this.hide(),e.onClose?.()}}),this._editor.setBanner(this.banner.element,MGo)}};Gke=I([m(1,F)],Gke);var mQe=class extends x{constructor(e,t){super();this.instantiationService=e;this.markdownRendererService=t;this.element=_("div.editor-banner"),this.element.tabIndex=0}getAriaLabel(e){if(e.ariaLabel)return e.ariaLabel;if(typeof e.message=="string")return e.message}getBannerMessage(e){if(typeof e=="string"){let t=_("span");return t.innerText=e,t}return this.markdownRendererService.render(e).element}clear(){Rt(this.element)}show(e){Rt(this.element);let t=this.getAriaLabel(e);t&&this.element.setAttribute("aria-label",t);let o=M(this.element,_("div.icon-container"));o.setAttribute("aria-hidden","true"),e.icon&&o.appendChild(_(`div${q.asCSSSelector(e.icon)}`));let n=M(this.element,_("div.message-container"));if(n.setAttribute("aria-hidden","true"),n.appendChild(this.getBannerMessage(e.message)),this.messageActionsContainer=M(this.element,_("div.message-actions-container")),e.actions)for(let s of e.actions)this._register(this.instantiationService.createInstance(rg,this.messageActionsContainer,{...s,tabIndex:-1},{}));let r=M(this.element,_("div.action-container"));this.actionBar=this._register(new Zi(r)),this.actionBar.push(this._register(new it("banner.close",d(1695,null),q.asClassName(PE),!0,()=>{typeof e.onClose=="function"&&e.onClose()})),{icon:!0,label:!1}),this.actionBar.setFocusable(!1)}};mQe=I([m(0,F),m(1,On)],mQe);var kR=le("workspaceTrustEnablementService"),Nr=le("workspaceTrustManagementService");var Vu=le("workspaceTrustRequestService");var PGo=Ae("extensions-warning-message",R.warning,d(1719,null)),mde=class extends x{constructor(e,t,o,n){super();this._editor=e;this._editorWorkerService=t;this._workspaceTrustService=o;this._highlighter=null;this._bannerClosed=!1;this._updateState=e=>{if(e&&e.hasMore){if(this._bannerClosed)return;let t=Math.max(e.ambiguousCharacterCount,e.nonBasicAsciiCharacterCount,e.invisibleCharacterCount),o;if(e.nonBasicAsciiCharacterCount>=t)o={message:d(1718,null),command:new vQe};else if(e.ambiguousCharacterCount>=t)o={message:d(1716,null),command:new hde};else if(e.invisibleCharacterCount>=t)o={message:d(1717,null),command:new fQe};else throw new Error("Unreachable");this._bannerController.show({id:"unicodeHighlightBanner",message:o.message,icon:PGo,actions:[{label:o.command.shortLabel,href:`command:${o.command.desc.id}`}],onClose:()=>{this._bannerClosed=!0}})}else this._bannerController.hide()};this._bannerController=this._register(n.createInstance(Gke,e)),this._register(this._editor.onDidChangeModel(()=>{this._bannerClosed=!1,this._updateHighlighter()})),this._options=e.getOption(142),this._register(o.onDidChangeTrust(r=>{this._updateHighlighter()})),this._register(e.onDidChangeConfiguration(r=>{r.hasChanged(142)&&(this._options=e.getOption(142),this._updateHighlighter())})),this._updateHighlighter()}static{this.ID="editor.contrib.unicodeHighlighter"}dispose(){this._highlighter&&(this._highlighter.dispose(),this._highlighter=null),super.dispose()}_updateHighlighter(){if(this._updateState(null),this._highlighter&&(this._highlighter.dispose(),this._highlighter=null),!this._editor.hasModel())return;let e=AGo(this._workspaceTrustService.isWorkspaceTrusted(),this._options);if([e.nonBasicASCII,e.ambiguousCharacters,e.invisibleCharacters].every(o=>o===!1))return;let t={nonBasicASCII:e.nonBasicASCII,ambiguousCharacters:e.ambiguousCharacters,invisibleCharacters:e.invisibleCharacters,includeComments:e.includeComments,includeStrings:e.includeStrings,allowedCodePoints:Object.keys(e.allowedCharacters).map(o=>o.codePointAt(0)),allowedLocales:Object.keys(e.allowedLocales).map(o=>o==="_os"?Jc.NumberFormat().value.resolvedOptions().locale:o==="_vscode"?wr:o)};this._editorWorkerService.canComputeUnicodeHighlights(this._editor.getModel().uri)?this._highlighter=new hQe(this._editor,t,this._updateState,this._editorWorkerService):this._highlighter=new bpi(this._editor,t,this._updateState)}getDecorationInfo(e){return this._highlighter?this._highlighter.getDecorationInfo(e):null}};mde=I([m(1,Qs),m(2,Nr),m(3,F)],mde);function AGo(a,i){return{nonBasicASCII:i.nonBasicASCII===w_?!a:i.nonBasicASCII,ambiguousCharacters:i.ambiguousCharacters,invisibleCharacters:i.invisibleCharacters,includeComments:i.includeComments===w_?!a:i.includeComments,includeStrings:i.includeStrings===w_?!a:i.includeStrings,allowedCharacters:i.allowedCharacters,allowedLocales:i.allowedLocales}}var hQe=class extends x{constructor(e,t,o,n){super();this._editor=e;this._options=t;this._updateState=o;this._editorWorkerService=n;this._model=this._editor.getModel(),this._decorations=this._editor.createDecorationsCollection(),this._updateSoon=this._register(new Dt(()=>this._update(),250)),this._register(this._editor.onDidChangeModelContent(()=>{this._updateSoon.schedule()})),this._updateSoon.schedule()}dispose(){this._decorations.clear(),super.dispose()}_update(){if(this._model.isDisposed())return;if(!this._model.mightContainNonBasicASCII()){this._decorations.clear();return}let e=this._model.getVersionId();this._editorWorkerService.computedUnicodeHighlights(this._model.uri,this._options).then(t=>{if(this._model.isDisposed()||this._model.getVersionId()!==e)return;this._updateState(t);let o=[];if(!t.hasMore)for(let n of t.ranges)o.push({range:n,options:tTt.instance.getDecorationFromOptions(this._options)});this._decorations.set(o)})}getDecorationInfo(e){if(!this._decorations.has(e))return null;let t=this._editor.getModel();if(!Qje(t,e))return null;let o=t.getValueInRange(e.range);return{reason:zXi(o,this._options),inComment:tbt(t,e),inString:ibt(t,e)}}};hQe=I([m(3,Qs)],hQe);var bpi=class extends x{constructor(e,t,o){super();this._editor=e;this._options=t;this._updateState=o;this._model=this._editor.getModel(),this._decorations=this._editor.createDecorationsCollection(),this._updateSoon=this._register(new Dt(()=>this._update(),250)),this._register(this._editor.onDidLayoutChange(()=>{this._updateSoon.schedule()})),this._register(this._editor.onDidScrollChange(()=>{this._updateSoon.schedule()})),this._register(this._editor.onDidChangeHiddenAreas(()=>{this._updateSoon.schedule()})),this._register(this._editor.onDidChangeModelContent(()=>{this._updateSoon.schedule()})),this._updateSoon.schedule()}dispose(){this._decorations.clear(),super.dispose()}_update(){if(this._model.isDisposed())return;if(!this._model.mightContainNonBasicASCII()){this._decorations.clear();return}let e=this._editor.getVisibleRanges(),t=[],o={ranges:[],ambiguousCharacterCount:0,invisibleCharacterCount:0,nonBasicAsciiCharacterCount:0,hasMore:!1};for(let n of e){let r=Qae.computeUnicodeHighlights(this._model,this._options,n);for(let s of r.ranges)o.ranges.push(s);o.ambiguousCharacterCount+=o.ambiguousCharacterCount,o.invisibleCharacterCount+=o.invisibleCharacterCount,o.nonBasicAsciiCharacterCount+=o.nonBasicAsciiCharacterCount,o.hasMore=o.hasMore||r.hasMore}if(!o.hasMore)for(let n of o.ranges)t.push({range:n,options:tTt.instance.getDecorationFromOptions(this._options)});this._updateState(o),this._decorations.set(t)}getDecorationInfo(e){if(!this._decorations.has(e))return null;let t=this._editor.getModel(),o=t.getValueInRange(e.range);return Qje(t,e)?{reason:zXi(o,this._options),inComment:tbt(t,e),inString:ibt(t,e)}:null}};var UXi=d(1708,null),gQe=class{constructor(i,e){this._editor=i;this._markdownRendererService=e;this.hoverOrdinal=5}computeSync(i,e){if(!this._editor.hasModel()||i.type!==1)return[];let t=this._editor.getModel(),o=this._editor.getContribution(mde.ID);if(!o)return[];let n=[],r=new Set,s=300;for(let l of e){let c=o.getDecorationInfo(l);if(!c)continue;let p=t.getValueInRange(l.range).codePointAt(0),h=vpi(p),g;switch(c.reason.kind){case 0:{g1(c.reason.confusableWith)?g=d(1705,null,h,vpi(c.reason.confusableWith.codePointAt(0))):g=d(1704,null,h,vpi(c.reason.confusableWith.codePointAt(0)));break}case 1:g=d(1706,null,h);break;case 2:g=d(1707,null,h);break}if(r.has(g))continue;r.add(g);let f={codePoint:p,reason:c.reason,inComment:c.inComment,inString:c.inString},v=d(1702,null),b=fc(iTt.ID,f),S=new Ie("",!0).appendMarkdown(g).appendText(" ").appendLink(b,v,UXi);n.push(new KE(this,l.range,[S],!1,s++))}return n}renderHoverParts(i,e){return c7i(i,e,this._editor,this._markdownRendererService)}getAccessibleContent(i){return i.contents.map(e=>e.value).join(`
`)}};gQe=I([m(1,On)],gQe);function Spi(a){return`U+${a.toString(16).padStart(4,"0")}`}function vpi(a){let i=`\`${Spi(a)}\``;return uV.isInvisibleCharacter(a)||(i+=` "${`${NGo(a)}`}"`),i}function NGo(a){return a===96?"`` ` ``":"`"+String.fromCodePoint(a)+"`"}function zXi(a,i){return Qae.computeUnicodeHighlightReason(a,i)}var tTt=class a{constructor(){this.map=new Map}static{this.instance=new a}getDecorationFromOptions(i){return this.getDecoration(!i.includeComments,!i.includeStrings)}getDecoration(i,e){let t=`${i}${e}`,o=this.map.get(t);return o||(o=mo.createDynamic({description:"unicode-highlight",stickiness:1,className:"unicode-highlight",showIfCollapsed:!0,overviewRuler:null,minimap:null,hideInCommentTokens:i,hideInStringTokens:e}),this.map.set(t,o)),o}},Ipi=class extends Di{constructor(){super({id:hde.ID,label:L(1696,"Disable highlighting of characters in comments"),precondition:void 0});this.shortLabel=d(1709,null)}static{this.ID="editor.action.unicodeHighlight.disableHighlightingInComments"}async run(e,t){let o=e.get(B);o&&this.runAction(o)}async runAction(e){await e.updateValue(Vx.includeComments,!1,2)}},ypi=class extends Di{constructor(){super({id:hde.ID,label:L(1697,"Disable highlighting of characters in strings"),precondition:void 0});this.shortLabel=d(1710,null)}static{this.ID="editor.action.unicodeHighlight.disableHighlightingInStrings"}async run(e,t){let o=e.get(B);o&&this.runAction(o)}async runAction(e){await e.updateValue(Vx.includeStrings,!1,2)}},hde=class a extends K{constructor(){super({id:a.ID,title:L(1698,"Disable highlighting of ambiguous characters"),precondition:void 0,f1:!1});this.shortLabel=d(1711,null)}static{this.ID="editor.action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters"}async run(e,t){let o=e.get(B);o&&this.runAction(o)}async runAction(e){await e.updateValue(Vx.ambiguousCharacters,!1,2)}},fQe=class a extends K{constructor(){super({id:a.ID,title:L(1699,"Disable highlighting of invisible characters"),precondition:void 0,f1:!1});this.shortLabel=d(1712,null)}static{this.ID="editor.action.unicodeHighlight.disableHighlightingOfInvisibleCharacters"}async run(e,t){let o=e.get(B);o&&this.runAction(o)}async runAction(e){await e.updateValue(Vx.invisibleCharacters,!1,2)}},vQe=class a extends K{constructor(){super({id:a.ID,title:L(1700,"Disable highlighting of non basic ASCII characters"),precondition:void 0,f1:!1});this.shortLabel=d(1713,null)}static{this.ID="editor.action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters"}async run(e,t){let o=e.get(B);o&&this.runAction(o)}async runAction(e){await e.updateValue(Vx.nonBasicASCII,!1,2)}},iTt=class a extends K{static{this.ID="editor.action.unicodeHighlight.showExcludeOptions"}constructor(){super({id:a.ID,title:L(1701,"Show Exclude Options"),precondition:void 0,f1:!1})}async run(i,e){let{codePoint:t,reason:o,inString:n,inComment:r}=e,s=String.fromCodePoint(t),l=i.get(Ue),c=i.get(B);function u(f){return uV.isInvisibleCharacter(f)?d(1715,null,Spi(f)):d(1714,null,`${Spi(f)} "${s}"`)}let p=[];if(o.kind===0)for(let f of o.notAmbiguousInLocales)p.push({label:d(1703,null,f),run:async()=>{FGo(c,[f])}});if(p.push({label:u(t),run:()=>OGo(c,[t])}),r){let f=new Ipi;p.push({label:f.label,run:async()=>f.runAction(c)})}else if(n){let f=new ypi;p.push({label:f.label,run:async()=>f.runAction(c)})}function h(f){return typeof f.desc.title=="string"?f.desc.title:f.desc.title.value}if(o.kind===0){let f=new hde;p.push({label:h(f),run:async()=>f.runAction(c)})}else if(o.kind===1){let f=new fQe;p.push({label:h(f),run:async()=>f.runAction(c)})}else if(o.kind===2){let f=new vQe;p.push({label:h(f),run:async()=>f.runAction(c)})}else WGo(o);let g=await l.pick(p,{title:UXi});g&&await g.run()}};async function OGo(a,i){let e=a.getValue(Vx.allowedCharacters),t;typeof e=="object"&&e?t=e:t={};for(let o of i)t[String.fromCodePoint(o)]=!0;await a.updateValue(Vx.allowedCharacters,t,2)}async function FGo(a,i){let e=a.inspect(Vx.allowedLocales).user?.value,t;typeof e=="object"&&e?t=Object.assign({},e):t={};for(let o of i)t[o]=!0;await a.updateValue(Vx.allowedLocales,t,2)}function WGo(a){throw new Error(`Unexpected value: ${a}`)}W(hde);W(fQe);W(vQe);W(iTt);xo(mde.ID,mde,1);z_.register(gQe);var KXi="ignoreUnusualLineTerminators";function VGo(a,i,e){a.setModelProperty(i.uri,KXi,e)}function BGo(a,i){return a.getModelProperty(i.uri,KXi)}var yX=class extends x{constructor(e,t,o){super();this._editor=e;this._dialogService=t;this._codeEditorService=o;this._isPresentingDialog=!1;this._config=this._editor.getOption(143),this._register(this._editor.onDidChangeConfiguration(n=>{n.hasChanged(143)&&(this._config=this._editor.getOption(143),this._checkForUnusualLineTerminators())})),this._register(this._editor.onDidChangeModel(()=>{this._checkForUnusualLineTerminators()})),this._register(this._editor.onDidChangeModelContent(n=>{n.isUndoing||this._checkForUnusualLineTerminators()})),this._checkForUnusualLineTerminators()}static{this.ID="editor.contrib.unusualLineTerminatorsDetector"}async _checkForUnusualLineTerminators(){if(this._config==="off"||!this._editor.hasModel())return;let e=this._editor.getModel();if(!e.mightContainUnusualLineTerminators()||BGo(this._codeEditorService,e)===!0||this._editor.getOption(104))return;if(this._config==="auto"){e.removeUnusualLineTerminators(this._editor.getSelections());return}if(this._isPresentingDialog)return;let o;try{this._isPresentingDialog=!0,o=await this._dialogService.confirm({title:d(1724,null),message:d(1723,null),detail:d(1720,null,He(e.uri)),primaryButton:d(1721,null),cancelButton:d(1722,null)})}finally{this._isPresentingDialog=!1}if(!o.confirmed){VGo(this._codeEditorService,e,!0);return}e.removeUnusualLineTerminators(this._editor.getSelections())}};yX=I([m(1,at),m(2,qt)],yX);xo(yX.ID,yX,1);function xpi(){return Object.create(null)}var bQe="**",GXi="/",oTt="[/\\\\]",nTt="[^/\\\\]",HGo=/\//g;function qXi(a,i){switch(a){case 0:return"";case 1:return`${nTt}*?`;default:return`(?:${oTt}|${nTt}+${oTt}${i?`|${oTt}${nTt}+`:""})*?`}}function ER(a,i){if(!a)return[];let e=[],t=!1,o=!1,n="";for(let r of a){switch(r){case i:if(!t&&!o){e.push(n),n="";continue}break;case"{":t=!0;break;case"}":t=!1;break;case"[":o=!0;break;case"]":o=!1;break}n+=r}return n&&e.push(n),e}function YXi(a){if(!a)return"";let i="",e=ER(a,GXi);if(e.every(t=>t===bQe))i=".*";else{let t=!1;e.forEach((o,n)=>{if(o===bQe){if(t)return;i+=qXi(2,n===e.length-1)}else{let r=!1,s="",l=!1,c="";for(let u of o){if(u!=="}"&&r){s+=u;continue}if(l&&(u!=="]"||!c)){let p;u==="-"?p=u:(u==="^"||u==="!")&&!c?p="^":u===GXi?p="":p=ns(u),c+=p;continue}switch(u){case"{":r=!0;continue;case"[":l=!0;continue;case"}":{let h=`(?:${ER(s,",").map(g=>YXi(g)).join("|")})`;i+=h,r=!1,s="";break}case"]":{i+="["+c+"]",l=!1,c="";break}case"?":i+=nTt;continue;case"*":i+=qXi(1);continue;default:i+=ns(u)}}n<e.length-1&&(e[n+1]!==bQe||n+2<e.length)&&(i+=oTt)}t=o===bQe})}return i}var UGo=/^\*\*\/\*\.[\w\.-]+$/,zGo=/^\*\*\/([\w\.-]+)\/?$/,KGo=/^{\*\*\/\*?[\w\.-]+\/?(,\*\*\/\*?[\w\.-]+\/?)*}$/,GGo=/^{\*\*\/\*?[\w\.-]+(\/(\*\*)?)?(,\*\*\/\*?[\w\.-]+(\/(\*\*)?)?)*}$/,qGo=/^\*\*((\/[\w\.-]+)+)\/?$/,$Go=/^([\w\.-]+(\/[\w\.-]+)*)\/?$/,$Xi=new dl(1e4),Cpi=function(){return!1},gB=function(){return null};function kpi(a){return a===Cpi||a===gB}function Epi(a,i){if(!a)return gB;let e;typeof a!="string"?e=a.pattern:e=a,e=e.trim();let t=i.ignoreCase??!1,o={...i,equals:t?vr:(l,c)=>l===c,endsWith:t?Hht:(l,c)=>l.endsWith(c),isEqualOrParent:(l,c)=>Yse(l,c,i.ignoreCase??!fn)},n=`${t?e.toLowerCase():e}_${!!i.trimForExclusions}_${t}`,r=$Xi.get(n);if(r)return jXi(r,a,o);let s;return UGo.test(e)?r=jGo(e.substring(4),e,o):(s=zGo.exec(wpi(e,o)))?r=QGo(s[1],e,o):(i.trimForExclusions?GGo:KGo).test(e)?r=YGo(e,o):(s=qGo.exec(wpi(e,o)))?r=QXi(s[1].substring(1),e,!0,o):(s=$Go.exec(wpi(e,o)))?r=QXi(s[1],e,!1,o):r=XGo(e,o),$Xi.set(n,r),jXi(r,a,o)}function jXi(a,i,e){if(typeof i=="string")return a;let t=function(o,n){return e.isEqualOrParent(o,i.base)?a(fC(o.substring(i.base.length),Qd),n):null};return t.allBasenames=a.allBasenames,t.allPaths=a.allPaths,t.basenames=a.basenames,t.patterns=a.patterns,t}function wpi(a,i){return i.trimForExclusions&&a.endsWith("/**")?a.substring(0,a.length-2):a}function jGo(a,i,e){return function(t,o){return typeof t=="string"&&e.endsWith(t,a)?i:null}}function QGo(a,i,e){let t=`/${a}`,o=`\\${a}`,n=function(s,l){return typeof s!="string"?null:l?e.equals(l,a)?i:null:e.equals(s,a)||e.endsWith(s,t)||e.endsWith(s,o)?i:null},r=[a];return n.basenames=r,n.patterns=[i],n.allBasenames=r,n}function YGo(a,i){let e=XXi(a.slice(1,-1).split(",").map(s=>Epi(s,i)).filter(s=>s!==gB),a),t=e.length;if(!t)return gB;if(t===1)return e[0];let o=function(s,l){for(let c=0,u=e.length;c<u;c++)if(e[c](s,l))return a;return null},n=e.find(s=>!!s.allBasenames);n&&(o.allBasenames=n.allBasenames);let r=e.reduce((s,l)=>l.allPaths?s.concat(l.allPaths):s,[]);return r.length&&(o.allPaths=r),o}function QXi(a,i,e,t){let o=Qd===Oo.sep,n=o?a:a.replace(HGo,Qd),r=Qd+n,s=Oo.sep+a,l;return e?l=function(c,u){return typeof c=="string"&&(t.equals(c,n)||t.endsWith(c,r)||!o&&(t.equals(c,a)||t.endsWith(c,s)))?i:null}:l=function(c,u){return typeof c=="string"&&(t.equals(c,n)||!o&&t.equals(c,a))?i:null},l.allPaths=[(e?"*/":"./")+a],l}function XGo(a,i){try{let e=new RegExp(`^${YXi(a)}$`,i.ignoreCase?"i":void 0);return function(t){return e.lastIndex=0,typeof t=="string"&&e.test(t)?a:null}}catch{return gB}}function Ed(a,i,e){return!a||typeof i!="string"?!1:Ym(a,e)(i)}function Ym(a,i={}){if(!a)return Cpi;if(typeof a=="string"||qP(a)){let e=Epi(a,i);if(e===gB)return Cpi;let t=function(o,n){return!!e(o,n)};return e.allBasenames&&(t.allBasenames=e.allBasenames),e.allPaths&&(t.allPaths=e.allPaths),t}return JGo(a,i)}function qP(a){let i=a;return i?typeof i.base=="string"&&typeof i.pattern=="string":!1}function JGo(a,i){let e=XXi(Object.getOwnPropertyNames(a).map(s=>ZGo(s,a[s],i)).filter(s=>s!==gB)),t=e.length;if(!t)return gB;if(!e.some(s=>!!s.requiresSiblings)){if(t===1)return e[0];let s=function(u,p){let h;for(let g=0,f=e.length;g<f;g++){let v=e[g](u,p);if(typeof v=="string")return v;f_(v)&&(h||(h=[]),h.push(v))}return h?(async()=>{for(let g of h){let f=await g;if(typeof f=="string")return f}return null})():null},l=e.find(u=>!!u.allBasenames);l&&(s.allBasenames=l.allBasenames);let c=e.reduce((u,p)=>p.allPaths?u.concat(p.allPaths):u,[]);return c.length&&(s.allPaths=c),s}let o=function(s,l,c){let u,p;for(let h=0,g=e.length;h<g;h++){let f=e[h];f.requiresSiblings&&c&&(l||(l=jo(s)),u||(u=l.substring(0,l.length-qm(s).length)));let v=f(s,l,u,c);if(typeof v=="string")return v;f_(v)&&(p||(p=[]),p.push(v))}return p?(async()=>{for(let h of p){let g=await h;if(typeof g=="string")return g}return null})():null},n=e.find(s=>!!s.allBasenames);n&&(o.allBasenames=n.allBasenames);let r=e.reduce((s,l)=>l.allPaths?s.concat(l.allPaths):s,[]);return r.length&&(o.allPaths=r),o}function ZGo(a,i,e){if(i===!1)return gB;let t=Epi(a,e);if(t===gB)return gB;if(typeof i=="boolean")return t;if(i){let o=i.when;if(typeof o=="string"){let n=(r,s,l,c)=>{if(!c||!t(r,s))return null;let u=o.replace("$(basename)",()=>l),p=c(u);return f_(p)?p.then(h=>h?a:null):p?a:null};return n.requiresSiblings=!0,n}}return t}function XXi(a,i){let e=a.filter(s=>!!s.basenames);if(e.length<2)return a;let t=e.reduce((s,l)=>{let c=l.basenames;return c?s.concat(c):s},[]),o;if(i){o=[];for(let s=0,l=t.length;s<l;s++)o.push(i)}else o=e.reduce((s,l)=>{let c=l.patterns;return c?s.concat(c):s},[]);let n=function(s,l){if(typeof s!="string")return null;if(!l){let u;for(u=s.length;u>0;u--){let p=s.charCodeAt(u-1);if(p===47||p===92)break}l=s.substring(u)}let c=t.indexOf(l);return c!==-1?o[c]:null};n.basenames=t,n.patterns=o,n.allBasenames=t;let r=a.filter(s=>!s.basenames);return r.push(n),r}function fB(a,i,e,t,o,n){if(Array.isArray(a)){let r=0;for(let s of a){let l=fB(s,i,e,t,o,n);if(l===10)return l;l>r&&(r=l)}return r}else{if(typeof a=="string")return t?a==="*"?5:a===e?10:0:0;if(a){let{language:r,pattern:s,scheme:l,hasAccessToAllModels:c,notebookType:u}=a;if(!t&&!c)return 0;u&&o&&(i=o);let p=0;if(l)if(l===i.scheme)p=10;else if(l==="*")p=5;else return 0;if(r)if(r===e)p=10;else if(r==="*")p=Math.max(p,5);else return 0;if(u)if(u===n)p=10;else if(u==="*"&&n!==void 0)p=Math.max(p,5);else return 0;if(s){let h;if(typeof s=="string"?h=s:h={...s,base:ch(s.base)},h===i.fsPath||Ed(h,i.fsPath))p=10;else return 0}return p}else return 0}}function Tpi(a,i){if(typeof a=="string")i.add(a);else if(Array.isArray(a))for(let e of a)Tpi(e,i);else{let e=a.language;e&&i.add(e)}}var rTt=class{constructor(){this.selector={language:"*"}}provideDocumentHighlights(i,e,t){let o=[],n=i.getWordAtPosition({lineNumber:e.lineNumber,column:e.column});return n?i.isDisposed()?void 0:i.findMatches(n.word,!0,!1,!0,xV,!1).map(s=>({range:s.range,kind:0})):Promise.resolve(o)}provideMultiDocumentHighlights(i,e,t,o){let n=new gt,r=i.getWordAtPosition({lineNumber:e.lineNumber,column:e.column});if(!r)return Promise.resolve(n);for(let s of[i,...t]){if(s.isDisposed())continue;let c=s.findMatches(r.word,!0,!1,!0,xV,!1).map(u=>({range:u.range,kind:0}));c&&n.set(s.uri,c)}return n}},qke=class extends x{constructor(i){super(),this._register(i.documentHighlightProvider.register("*",new rTt)),this._register(i.multiDocumentHighlightProvider.register("*",new rTt))}};qke=I([m(0,Qt)],qke);var Ppi=new Y("hasWordHighlights",!1);function JXi(a,i,e,t){let o=a.ordered(i);return nae(o.map(n=>()=>Promise.resolve(n.provideDocumentHighlights(i,e,t)).then(void 0,ys)),n=>n!=null).then(n=>{if(n){let r=new gt;return r.set(i.uri,n),r}return new gt})}function eqo(a,i,e,t,o){let n=a.ordered(i);return nae(n.map(r=>()=>{let s=o.filter(l=>Hx(l)).filter(l=>fB(r.selector,l.uri,l.getLanguageId(),!0,void 0,void 0)>0);return Promise.resolve(r.provideMultiDocumentHighlights(i,e,s,t)).then(void 0,ys)}),r=>r!=null)}var sTt=class{constructor(i,e,t){this._model=i;this._selection=e;this._wordSeparators=t;this._wordRange=this._getCurrentWordRange(i,e),this._result=null}get result(){return this._result||(this._result=Ln(i=>this._compute(this._model,this._selection,this._wordSeparators,i))),this._result}_getCurrentWordRange(i,e){let t=i.getWordAtPosition(e.getPosition());return t?new z(e.startLineNumber,t.startColumn,e.startLineNumber,t.endColumn):null}isValid(i,e,t){let o=e.startLineNumber,n=e.startColumn,r=e.endColumn,s=this._getCurrentWordRange(i,e),l=!!(this._wordRange&&this._wordRange.equalsRange(s));for(let c=0,u=t.length;!l&&c<u;c++){let p=t.getRange(c);p&&p.startLineNumber===o&&p.startColumn<=n&&p.endColumn>=r&&(l=!0)}return l}cancel(){this.result.cancel()}},_pi=class extends sTt{constructor(i,e,t,o){super(i,e,t),this._providers=o}_compute(i,e,t,o){return JXi(this._providers,i,e.getPosition(),o).then(n=>n||new gt)}},Dpi=class extends sTt{constructor(i,e,t,o,n){super(i,e,t),this._providers=o,this._otherModels=n}_compute(i,e,t,o){return eqo(this._providers,i,e.getPosition(),o,this._otherModels).then(n=>n||new gt)}};function tqo(a,i,e,t){return new _pi(i,e,t,a)}function iqo(a,i,e,t,o){return new Dpi(i,e,t,a,o)}qS("_executeDocumentHighlights",async(a,i,e)=>{let t=a.get(Qt);return(await JXi(t.documentHighlightProvider,i,e,Se.None))?.get(i.uri)});var kp=class{constructor(i,e,t,o,n,r,s,l){this.toUnhook=new N;this.workerRequestTokenId=0;this.workerRequestCompleted=!1;this.workerRequestValue=new gt;this.lastCursorPositionChangeTime=0;this.renderDecorationsTimer=void 0;this.runDelayer=this.toUnhook.add(new Xo(50));this.editor=i,this.providers=e,this.multiDocumentProviders=t,this.codeEditorService=r,this.textModelService=n,this.configurationService=s,this.logService=l,this._hasWordHighlights=Ppi.bindTo(o),this._ignorePositionChangeEvent=!1,this.occurrencesHighlightEnablement=this.editor.getOption(90),this.occurrencesHighlightDelay=this.configurationService.getValue("editor.occurrencesHighlightDelay"),this.model=this.editor.getModel(),this.toUnhook.add(i.onDidChangeCursorPosition(c=>{this._ignorePositionChangeEvent||this.occurrencesHighlightEnablement!=="off"&&this.runDelayer.trigger(()=>{this._onPositionChanged(c)}).catch(mt)})),this.toUnhook.add(i.onDidFocusEditorText(c=>{this.occurrencesHighlightEnablement!=="off"&&(this.workerRequest||this.runDelayer.trigger(()=>{this._run()}).catch(mt))})),this.toUnhook.add(i.onDidChangeModelContent(c=>{ec(this.model.uri,"output")||this._stopAll()})),this.toUnhook.add(i.onDidChangeModel(c=>{!c.newModelUrl&&c.oldModelUrl?this._stopSingular():kp.query&&this._run()})),this.toUnhook.add(i.onDidChangeConfiguration(c=>{let u=this.editor.getOption(90);if(this.occurrencesHighlightEnablement!==u)switch(this.occurrencesHighlightEnablement=u,u){case"off":this._stopAll();break;case"singleFile":this._stopAll(kp.query?.modelInfo?.modelURI);break;case"multiFile":kp.query&&this._run(!0);break;default:console.warn("Unknown occurrencesHighlight setting value:",u);break}})),this.toUnhook.add(this.configurationService.onDidChangeConfiguration(c=>{if(c.affectsConfiguration("editor.occurrencesHighlightDelay")){let u=s.getValue("editor.occurrencesHighlightDelay");this.occurrencesHighlightDelay!==u&&(this.occurrencesHighlightDelay=u)}})),this.toUnhook.add(i.onDidBlurEditorWidget(()=>{let c=this.codeEditorService.getFocusedCodeEditor();c?c.getModel()?.uri.scheme===Q.vscodeNotebookCell&&this.editor.getModel()?.uri.scheme!==Q.vscodeNotebookCell&&this._stopAll():this._stopAll()})),this.decorations=this.editor.createDecorationsCollection(),this.workerRequestTokenId=0,this.workerRequest=null,this.workerRequestCompleted=!1,this.lastCursorPositionChangeTime=0,this.renderDecorationsTimer=void 0,kp.query&&this._run()}static{this.storedDecorationIDs=new gt}static{this.query=null}hasDecorations(){return this.decorations.length>0}restore(i){this.occurrencesHighlightEnablement!=="off"&&(this.runDelayer.cancel(),this.runDelayer.trigger(()=>{this._run(!1,i)}).catch(mt))}trigger(){this.runDelayer.cancel(),this._run(!1,0)}stop(){this.occurrencesHighlightEnablement!=="off"&&this._stopAll()}_getSortedHighlights(){return this.decorations.getRanges().sort(z.compareRangesUsingStarts)}moveNext(){let i=this._getSortedHighlights(),t=(i.findIndex(n=>n.containsPosition(this.editor.getPosition()))+1)%i.length,o=i[t];try{this._ignorePositionChangeEvent=!0,this.editor.setPosition(o.getStartPosition()),this.editor.revealRangeInCenterIfOutsideViewport(o);let n=this._getWord();if(n){let r=this.editor.getModel().getLineContent(o.startLineNumber);en(`${r}, ${t+1} of ${i.length} for '${n.word}'`)}}finally{this._ignorePositionChangeEvent=!1}}moveBack(){let i=this._getSortedHighlights(),t=(i.findIndex(n=>n.containsPosition(this.editor.getPosition()))-1+i.length)%i.length,o=i[t];try{this._ignorePositionChangeEvent=!0,this.editor.setPosition(o.getStartPosition()),this.editor.revealRangeInCenterIfOutsideViewport(o);let n=this._getWord();if(n){let r=this.editor.getModel().getLineContent(o.startLineNumber);en(`${r}, ${t+1} of ${i.length} for '${n.word}'`)}}finally{this._ignorePositionChangeEvent=!1}}_removeSingleDecorations(){if(!this.editor.hasModel())return;let i=kp.storedDecorationIDs.get(this.editor.getModel().uri);i&&(this.editor.removeDecorations(i),kp.storedDecorationIDs.delete(this.editor.getModel().uri),this.decorations.length>0&&(this.decorations.clear(),this._hasWordHighlights.set(!1)))}_removeAllDecorations(i){let e=this.codeEditorService.listCodeEditors(),t=[];for(let o of e){if(!o.hasModel()||Qe(o.getModel().uri,i))continue;let n=kp.storedDecorationIDs.get(o.getModel().uri);if(!n)continue;o.removeDecorations(n),t.push(o.getModel().uri);let r=hS.get(o);r?.wordHighlighter&&r.wordHighlighter.decorations.length>0&&(r.wordHighlighter.decorations.clear(),r.wordHighlighter.workerRequest=null,r.wordHighlighter._hasWordHighlights.set(!1))}for(let o of t)kp.storedDecorationIDs.delete(o)}_stopSingular(){this._removeSingleDecorations(),this.editor.hasTextFocus()&&(this.editor.getModel()?.uri.scheme!==Q.vscodeNotebookCell&&kp.query?.modelInfo?.modelURI.scheme!==Q.vscodeNotebookCell?(kp.query=null,this._run()):kp.query?.modelInfo&&(kp.query.modelInfo=null)),this.renderDecorationsTimer!==void 0&&(clearTimeout(this.renderDecorationsTimer),this.renderDecorationsTimer=void 0),this.workerRequest!==null&&(this.workerRequest.cancel(),this.workerRequest=null),this.workerRequestCompleted||(this.workerRequestTokenId++,this.workerRequestCompleted=!0)}_stopAll(i){this._removeAllDecorations(i),this.renderDecorationsTimer!==void 0&&(clearTimeout(this.renderDecorationsTimer),this.renderDecorationsTimer=void 0),this.workerRequest!==null&&(this.workerRequest.cancel(),this.workerRequest=null),this.workerRequestCompleted||(this.workerRequestTokenId++,this.workerRequestCompleted=!0)}_onPositionChanged(i){if(this.occurrencesHighlightEnablement==="off"){this._stopAll();return}if(i.source!=="api"&&i.reason!==3){this._stopAll();return}this._run()}_getWord(){let i=this.editor.getSelection(),e=i.startLineNumber,t=i.startColumn;return this.model.isDisposed()?null:this.model.getWordAtPosition({lineNumber:e,column:t})}getOtherModelsToHighlight(i){if(!i)return[];if(i.uri.scheme===Q.vscodeNotebookCell){let n=[],r=this.codeEditorService.listCodeEditors();for(let s of r){let l=s.getModel();l&&l!==i&&l.uri.scheme===Q.vscodeNotebookCell&&n.push(l)}return n}let t=[],o=this.codeEditorService.listCodeEditors();for(let n of o){if(!mc(n))continue;let r=n.getModel();r&&i===r.modified&&t.push(r.modified)}if(t.length)return t;if(this.occurrencesHighlightEnablement==="singleFile")return[];for(let n of o){let r=n.getModel();r&&r!==i&&t.push(r)}return t}async _run(i,e){if(this.editor.hasTextFocus()){let o=this.editor.getSelection();if(!o||o.startLineNumber!==o.endLineNumber){kp.query=null,this._stopAll();return}let n=o.startColumn,r=o.endColumn,s=this._getWord();if(!s||s.startColumn>n||s.endColumn<r){kp.query=null,this._stopAll();return}kp.query={modelInfo:{modelURI:this.model.uri,selection:o}}}else if(!kp.query){this._stopAll();return}if(this.lastCursorPositionChangeTime=new Date().getTime(),Qe(this.editor.getModel().uri,kp.query.modelInfo?.modelURI)){if(!i){let s=this.decorations.getRanges();for(let l of s)if(l.containsPosition(this.editor.getPosition()))return}this._stopAll(i?this.model.uri:void 0);let o=++this.workerRequestTokenId;this.workerRequestCompleted=!1;let n=this.getOtherModelsToHighlight(this.editor.getModel());if(!kp.query||!kp.query.modelInfo)return;let r=await this.textModelService.createModelReference(kp.query.modelInfo.modelURI);try{this.workerRequest=this.computeWithModel(r.object.textEditorModel,kp.query.modelInfo.selection,n),this.workerRequest?.result.then(s=>{o===this.workerRequestTokenId&&(this.workerRequestCompleted=!0,this.workerRequestValue=s||[],this._beginRenderDecorations(e??this.occurrencesHighlightDelay))},mt)}catch(s){this.logService.error("Unexpected error during occurrence request. Log: ",s)}finally{r.dispose()}}else if(this.model.uri.scheme===Q.vscodeNotebookCell){let o=++this.workerRequestTokenId;if(this.workerRequestCompleted=!1,!kp.query||!kp.query.modelInfo)return;let n=await this.textModelService.createModelReference(kp.query.modelInfo.modelURI);try{this.workerRequest=this.computeWithModel(n.object.textEditorModel,kp.query.modelInfo.selection,[this.model]),this.workerRequest?.result.then(r=>{o===this.workerRequestTokenId&&(this.workerRequestCompleted=!0,this.workerRequestValue=r||[],this._beginRenderDecorations(e??this.occurrencesHighlightDelay))},mt)}catch(r){this.logService.error("Unexpected error during occurrence request. Log: ",r)}finally{n.dispose()}}}computeWithModel(i,e,t){return t.length?iqo(this.multiDocumentProviders,i,e,this.editor.getOption(148),t):tqo(this.providers,i,e,this.editor.getOption(148))}_beginRenderDecorations(i){let e=new Date().getTime(),t=this.lastCursorPositionChangeTime+i;e>=t?(this.renderDecorationsTimer=void 0,this.renderDecorations()):this.renderDecorationsTimer=setTimeout(()=>{this.renderDecorations()},t-e)}renderDecorations(){this.renderDecorationsTimer=void 0;let i=this.codeEditorService.listCodeEditors();for(let e of i){let t=hS.get(e);if(!t)continue;let o=[],n=e.getModel()?.uri;if(n&&this.workerRequestValue.has(n)){let r=kp.storedDecorationIDs.get(n),s=this.workerRequestValue.get(n);if(s)for(let c of s)c.range&&o.push({range:c.range,options:LXi(c.kind)});let l=[];e.changeDecorations(c=>{l=c.deltaDecorations(r??[],o)}),kp.storedDecorationIDs=kp.storedDecorationIDs.set(n,l),o.length>0&&(t.wordHighlighter?.decorations.set(o),t.wordHighlighter?._hasWordHighlights.set(!0))}}this.workerRequest=null}dispose(){this._stopSingular(),this.toUnhook.dispose()}};kp=I([m(4,Bt),m(5,qt),m(6,B),m(7,se)],kp);var hS=class extends x{static{this.ID="editor.contrib.wordHighlighter"}static get(i){return i.getContribution(hS.ID)}constructor(i,e,t,o,n,r,s){super(),this._wordHighlighter=null;let l=()=>{i.hasModel()&&!i.getModel().isTooLargeForTokenization()&&i.getModel().uri.scheme!==Q.accessibleView&&(this._wordHighlighter=new kp(i,t.documentHighlightProvider,t.multiDocumentHighlightProvider,e,n,o,r,s))};this._register(i.onDidChangeModel(c=>{this._wordHighlighter&&(!c.newModelUrl&&c.oldModelUrl?.scheme!==Q.vscodeNotebookCell&&this.wordHighlighter?.stop(),this._wordHighlighter.dispose(),this._wordHighlighter=null),l()})),l()}get wordHighlighter(){return this._wordHighlighter}saveViewState(){return!!(this._wordHighlighter&&this._wordHighlighter.hasDecorations())}moveNext(){this._wordHighlighter?.moveNext()}moveBack(){this._wordHighlighter?.moveBack()}restoreViewState(i){this._wordHighlighter&&i&&this._wordHighlighter.restore(250)}stopHighlighting(){this._wordHighlighter?.stop()}dispose(){this._wordHighlighter&&(this._wordHighlighter.dispose(),this._wordHighlighter=null),super.dispose()}};hS=I([m(1,X),m(2,Qt),m(3,qt),m(4,Bt),m(5,B),m(6,se)],hS);var aTt=class extends Di{constructor(i,e){super(e),this._isNext=i}run(i,e){let t=hS.get(e);t&&(this._isNext?t.moveNext():t.moveBack())}},Lpi=class extends aTt{constructor(){super(!0,{id:"editor.action.wordHighlight.next",label:L(1734,"Go to Next Symbol Highlight"),precondition:Ppi,kbOpts:{kbExpr:pe.editorTextFocus,primary:65,weight:100}})}},Rpi=class extends aTt{constructor(){super(!1,{id:"editor.action.wordHighlight.prev",label:L(1735,"Go to Previous Symbol Highlight"),precondition:Ppi,kbOpts:{kbExpr:pe.editorTextFocus,primary:1089,weight:100}})}},Mpi=class extends Di{constructor(){super({id:"editor.action.wordHighlight.trigger",label:L(1736,"Trigger Symbol Highlight"),precondition:void 0,kbOpts:{kbExpr:pe.editorTextFocus,primary:0,weight:100}})}run(i,e){let t=hS.get(e);t&&t.restoreViewState(!0)}};xo(hS.ID,hS,0);ni(Lpi);ni(Rpi);ni(Mpi);ik(qke);var gde=class extends Oc{constructor(i){super(i),this._inSelectionMode=i.inSelectionMode,this._wordNavigationType=i.wordNavigationType}runEditorCommand(i,e,t){if(!e.hasModel())return;let o=wC(e.getOption(148),e.getOption(147)),n=e.getModel(),r=e.getSelections(),s=r.length>1,l=r.map(c=>{let u=new ye(c.positionLineNumber,c.positionColumn),p=this._move(o,n,u,this._wordNavigationType,s);return this._moveTo(c,p,this._inSelectionMode)});if(n.pushStackElement(),e._getViewModel().setCursorStates("moveWordCommand",3,l.map(c=>js.fromModelSelection(c))),l.length===1){let c=new ye(l[0].positionLineNumber,l[0].positionColumn);e.revealPosition(c,0)}}_moveTo(i,e,t){return t?new ti(i.selectionStartLineNumber,i.selectionStartColumn,e.lineNumber,e.column):new ti(e.lineNumber,e.column,e.lineNumber,e.column)}},pK=class extends gde{_move(i,e,t,o,n){return Hf.moveWordLeft(i,e,t,o,n)}},mK=class extends gde{_move(i,e,t,o,n){return Hf.moveWordRight(i,e,t,o)}},Api=class extends pK{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartLeft",precondition:void 0})}},Npi=class extends pK{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndLeft",precondition:void 0})}},Opi=class extends pK{constructor(){super({inSelectionMode:!1,wordNavigationType:1,id:"cursorWordLeft",precondition:void 0,kbOpts:{kbExpr:C.and(pe.textInputFocus,C.and($a,ww)?.negate()),primary:2063,mac:{primary:527},weight:100}})}},Fpi=class extends pK{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartLeftSelect",precondition:void 0})}},Wpi=class extends pK{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndLeftSelect",precondition:void 0})}},Vpi=class extends pK{constructor(){super({inSelectionMode:!0,wordNavigationType:1,id:"cursorWordLeftSelect",precondition:void 0,kbOpts:{kbExpr:C.and(pe.textInputFocus,C.and($a,ww)?.negate()),primary:3087,mac:{primary:1551},weight:100}})}},Bpi=class extends pK{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityLeft",precondition:void 0})}_move(i,e,t,o,n){return super._move(wC(iS.wordSeparators.defaultValue,i.intlSegmenterLocales),e,t,o,n)}},Hpi=class extends pK{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityLeftSelect",precondition:void 0})}_move(i,e,t,o,n){return super._move(wC(iS.wordSeparators.defaultValue,i.intlSegmenterLocales),e,t,o,n)}},Upi=class extends mK{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartRight",precondition:void 0})}},zpi=class extends mK{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndRight",precondition:void 0,kbOpts:{kbExpr:C.and(pe.textInputFocus,C.and($a,ww)?.negate()),primary:2065,mac:{primary:529},weight:100}})}},Kpi=class extends mK{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordRight",precondition:void 0})}},Gpi=class extends mK{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartRightSelect",precondition:void 0})}},qpi=class extends mK{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndRightSelect",precondition:void 0,kbOpts:{kbExpr:C.and(pe.textInputFocus,C.and($a,ww)?.negate()),primary:3089,mac:{primary:1553},weight:100}})}},$pi=class extends mK{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordRightSelect",precondition:void 0})}},jpi=class extends mK{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityRight",precondition:void 0})}_move(i,e,t,o,n){return super._move(wC(iS.wordSeparators.defaultValue,i.intlSegmenterLocales),e,t,o,n)}},Qpi=class extends mK{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityRightSelect",precondition:void 0})}_move(i,e,t,o,n){return super._move(wC(iS.wordSeparators.defaultValue,i.intlSegmenterLocales),e,t,o,n)}},fde=class extends Oc{constructor(i){super({canTriggerInlineEdits:!0,...i}),this._whitespaceHeuristics=i.whitespaceHeuristics,this._wordNavigationType=i.wordNavigationType}runEditorCommand(i,e,t){let o=i?.get(Rs);if(!e.hasModel()||!o)return;let n=wC(e.getOption(148),e.getOption(147)),r=e.getModel(),s=e.getSelections(),l=e.getOption(10),c=e.getOption(15),u=o.getLanguageConfiguration(r.getLanguageId()).getAutoClosingPairs(),p=e._getViewModel(),h=s.map(g=>{let f=this._delete({wordSeparators:n,model:r,selection:g,whitespaceHeuristics:this._whitespaceHeuristics,autoClosingDelete:e.getOption(13),autoClosingBrackets:l,autoClosingQuotes:c,autoClosingPairs:u,autoClosedCharacters:p.getCursorAutoClosedCharacters()},this._wordNavigationType);return new qh(f,"")});e.pushUndoStop(),e.executeCommands(this.id,h),e.pushUndoStop()}},SQe=class extends fde{_delete(i,e){let t=Hf.deleteWordLeft(i,e);return t||new z(1,1,1,1)}},IQe=class extends fde{_delete(i,e){let t=Hf.deleteWordRight(i,e);if(t)return t;let o=i.model.getLineCount(),n=i.model.getLineMaxColumn(o);return new z(o,n,o,n)}},Ypi=class extends SQe{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartLeft",precondition:pe.writable})}},Xpi=class extends SQe{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndLeft",precondition:pe.writable})}},Jpi=class extends SQe{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordLeft",precondition:pe.writable,kbOpts:{kbExpr:pe.textInputFocus,primary:2049,mac:{primary:513},weight:100}})}},Zpi=class extends IQe{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartRight",precondition:pe.writable})}},emi=class extends IQe{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndRight",precondition:pe.writable})}},tmi=class extends IQe{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordRight",precondition:pe.writable,kbOpts:{kbExpr:pe.textInputFocus,primary:2068,mac:{primary:532},weight:100}})}},imi=class extends Di{constructor(){super({id:"deleteInsideWord",precondition:pe.writable,label:L(1737,"Delete Word"),metadata:{description:L(1739,"Delete the word at the cursor"),args:[{name:"args",schema:{type:"object",properties:{onlyWord:{type:"boolean",default:!1,description:d(1738,null)}}}}]}})}run(i,e,t){if(!e.hasModel())return;let o=!!(t&&typeof t=="object"&&t.onlyWord),n=wC(e.getOption(148),e.getOption(147)),r=e.getModel(),l=e.getSelections().map(c=>{let u=Hf.deleteInsideWord(n,r,c,o);return new qh(u,"")});e.pushUndoStop(),e.executeCommands(this.id,l),e.pushUndoStop()}};Xi(new Api);Xi(new Npi);Xi(new Opi);Xi(new Fpi);Xi(new Wpi);Xi(new Vpi);Xi(new Upi);Xi(new zpi);Xi(new Kpi);Xi(new Gpi);Xi(new qpi);Xi(new $pi);Xi(new Bpi);Xi(new Hpi);Xi(new jpi);Xi(new Qpi);Xi(new Ypi);Xi(new Xpi);Xi(new Jpi);Xi(new Zpi);Xi(new emi);Xi(new tmi);ni(imi);var omi=class extends fde{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordPartLeft",precondition:pe.writable,kbOpts:{kbExpr:pe.textInputFocus,primary:0,mac:{primary:769},weight:100}})}_delete(i,e){let t=Lae.deleteWordPartLeft(i);return t||new z(1,1,1,1)}},nmi=class extends fde{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordPartRight",precondition:pe.writable,kbOpts:{kbExpr:pe.textInputFocus,primary:0,mac:{primary:788},weight:100}})}_delete(i,e){let t=Lae.deleteWordPartRight(i);if(t)return t;let o=i.model.getLineCount(),n=i.model.getLineMaxColumn(o);return new z(o,n,o,n)}},lTt=class extends gde{_move(i,e,t,o,n){return Lae.moveWordPartLeft(i,e,t,n)}},rmi=class extends lTt{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordPartLeft",precondition:void 0,kbOpts:{kbExpr:pe.textInputFocus,primary:0,mac:{primary:783},weight:100}})}};$e.registerCommandAlias("cursorWordPartStartLeft","cursorWordPartLeft");var smi=class extends lTt{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordPartLeftSelect",precondition:void 0,kbOpts:{kbExpr:pe.textInputFocus,primary:0,mac:{primary:1807},weight:100}})}};$e.registerCommandAlias("cursorWordPartStartLeftSelect","cursorWordPartLeftSelect");var cTt=class extends gde{_move(i,e,t,o,n){return Lae.moveWordPartRight(i,e,t)}},ami=class extends cTt{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordPartRight",precondition:void 0,kbOpts:{kbExpr:pe.textInputFocus,primary:0,mac:{primary:785},weight:100}})}},lmi=class extends cTt{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordPartRightSelect",precondition:void 0,kbOpts:{kbExpr:pe.textInputFocus,primary:0,mac:{primary:1809},weight:100}})}};Xi(new omi);Xi(new nmi);Xi(new rmi);Xi(new smi);Xi(new ami);Xi(new lmi);var dTt=class extends x{constructor(e){super();this.editor=e;this._register(this.editor.onDidAttemptReadOnlyEdit(()=>this._onDidAttemptReadOnlyEdit()))}static{this.ID="editor.contrib.readOnlyMessageController"}_onDidAttemptReadOnlyEdit(){let e=xu.get(this.editor);if(e&&this.editor.hasModel()){let t=this.editor.getOptions().get(105);t||(this.editor.isSimpleWidget?t=new Ie(d(1542,null)):t=new Ie(d(1541,null))),e.showMessage(t,this.editor.getPosition())}}};xo(dTt.ID,dTt,2);var yQe=class extends x{constructor(e,t,o){super();this._textModel=e;this._languageFeaturesService=t;this._outlineModelService=o;this._currentModel=Me(this,void 0);let n=Fr("documentSymbolProvider.onDidChange",this._languageFeaturesService.documentSymbolProvider.onDidChange),r=Fr("_textModel.onDidChangeContent",U.debounce(s=>this._textModel.onDidChangeContent(s),()=>{},100));this._register(il(async(s,l)=>{n.read(s),r.read(s);let c=l.add(new Gyt),u=await this._outlineModelService.getOrCreate(this._textModel,c.token);l.isDisposed||this._currentModel.set(u,void 0)}))}getBreadcrumbItems(e,t){let o=this._currentModel.read(t);if(!o)return[];let n=o.asListOfDocumentSymbols().filter(r=>e.contains(r.range.startLineNumber)&&!e.contains(r.range.endLineNumber));return n.sort(Fse(cl(r=>r.range.endLineNumber-r.range.startLineNumber,hu))),n.map(r=>({name:r.name,kind:r.kind,startLineNumber:r.range.startLineNumber}))}getAt(e,t){let o=this._currentModel.read(t);if(!o)return[];let n=o.asListOfDocumentSymbols().filter(r=>new uo(r.range.startLineNumber,r.range.endLineNumber).contains(e));return n.length===0?[]:(n.sort(Fse(cl(r=>r.range.endLineNumber-r.range.startLineNumber,hu))),n.map(r=>({name:r.name,kind:r.kind,startLineNumber:r.range.startLineNumber})))}};yQe=I([m(1,Qt),m(2,AC)],yQe);QO.setBreadcrumbsSourceFactory((a,i)=>i.createInstance(yQe,a));var vB=class extends x{static{this.ID="editor.contrib.floatingToolbar"}constructor(i,e,t,o){super();let n=this._register(gs(i)),r=ke(l=>n.model.read(l)?.uri),s=this._register(e.createInstance(vde,D.EditorContent,i.contextKeyService,r));this._register(be(l=>{s.hasActions.read(l)&&l.store.add(n.createOverlayWidget({allowEditorOverflow:!1,domNode:s.element,minContentWidthInPx:So(0),position:So({preference:1})}))}))}};vB=I([m(1,F),m(2,_e),m(3,Kt)],vB);var vde=class extends x{constructor(i,e,t,o,n,r){super();let s=this._register(r.createMenu(i,e)),l=ui(this,s.onDidChange,()=>s.getActions()),c=ke(u=>{let p=l.read(u),{primary:h}=ml(p,()=>!0);return h.filter(g=>g.id!==ri.ID)});this.hasActions=ke(u=>c.read(u).length>0),this.element=ct("div.floating-menu-overlay-widget").root,this._register(Z(()=>this.element.remove())),this._register(be(u=>{let p=c.read(u),h=p.length>0,g=h?p[0].id:void 0,f=p.length===1;if(this.element.classList.toggle("single-button",f),this.element.style.height=f?"28px":"26px",!h)return;let v=o.createInstance(or,this.element,i,{actionViewItemProvider:(b,S)=>{if(b instanceof Lo)return o.createInstance(class extends xl{render(y){super.render(y),b.id===g&&this.element?.classList.add("primary")}updateLabel(){let y=n.lookupKeybinding(b.id),w=y?y.getLabel():void 0;this.options.label&&this.label&&(this.label.textContent=w?`${this._commandAction.label} (${w})`:this._commandAction.label)}},b,{...S,keybindingNotRenderedWithLabel:!0})},hiddenItemStrategy:0,menuOptions:{shouldForwardArgs:!0},telemetrySource:"editor.overlayToolbar",toolbarOptions:{primaryGroup:()=>!0,useSeparatorsInPrimaryActions:!0}});u.store.add(v),u.store.add(be(b=>{let S=t.read(b);v.context=S}))}))}};vde=I([m(3,F),m(4,_e),m(5,Kt)],vde);xo(vB.ID,vB,1);var xc;(et=>(et.accessibilityHelpTitle=d(911,null),et.openingDocs=d(940,null),et.readonlyDiffEditor=d(946,null),et.editableDiffEditor=d(928,null),et.readonlyEditor=d(947,null),et.editableEditor=d(929,null),et.defaultWindowTitleIncludesEditorState=d(927,null),et.defaultWindowTitleExcludingEditorState=d(926,null),et.toolbar=d(959,null),et.changeConfigToOnMac=d(916,null),et.changeConfigToOnWinLinux=d(917,null),et.auto_on=d(914,null),et.auto_off=d(913,null),et.screenReaderModeEnabled=d(949,null),et.screenReaderModeDisabled=d(948,null),et.tabFocusModeOnMsg=d(956,null,"<keybinding:editor.action.toggleTabFocusMode>"),et.tabFocusModeOffMsg=d(955,null,"<keybinding:editor.action.toggleTabFocusMode>"),et.stickScroll=d(953,null,"<keybinding:editor.action.focusStickyDebugConsole>"),et.suggestActions=d(954,null,"<keybinding:editor.action.triggerSuggest>"),et.acceptSuggestAction=d(910,null,"<keybinding:acceptSelectedSuggestion>"),et.toggleSuggestionFocus=d(958,null,"<keybinding:focusSuggestion>","<keybinding:toggleSuggestionFocus>"),et.codeFolding=d(921,null,"<keybinding:editor.toggleFold>"),et.intellisense=d(937,null,"<keybinding:editor.action.triggerSuggest>"),et.showOrFocusHover=d(951,null,"<keybinding:editor.action.showHover>"),et.goToSymbol=d(934,null,"<keybinding:workbench.action.gotoSymbol>"),et.showAccessibilityHelpAction=d(950,null),et.listSignalSounds=d(939,null),et.listAlerts=d(938,null),et.announceCursorPosition=d(912,null,"<keybinding:editor.action.announceCursorPosition>"),et.focusNotifications=d(931,null,"<keybinding:notifications.focusToasts>","<keybinding:notification.acceptPrimaryAction>"),et.quickChat=d(941,null,"<keybinding:workbench.action.quickchat.toggle>"),et.startInlineChat=d(952,null,"<keybinding:inlineChat.start>"),et.startDebugging=d(922,null,"<keybinding:workbench.action.debug.start>"),et.setBreakpoint=d(925,null,"<keybinding:editor.debug.action.toggleInlineBreakpoint>"),et.addToWatch=d(923,null,"<keybinding:editor.debug.action.selectionToWatch>"),et.debugExecuteSelection=d(924,null,"<keybinding:editor.debug.action.selectionToRepl>"),et.chatEditorModification=d(919,null),et.chatEditorRequestInProgress=d(920,null),et.chatEditActions=d(918,null,"<keybinding:chatEditor.action.navigatePrevious>","<keybinding:chatEditor.action.navigateNext>","<keybinding:chatEditor.action.acceptHunk>","<keybinding:chatEditor.action.undoHunk>","<keybinding:chatEditor.action.toggleDiff>","<keybinding:chatEditor.action.acceptAllEdits>")))(xc||={});var nqo;(i=>i.inspectTokensAction=d(936,null))(nqo||={});var rqo;(e=>(e.gotoLineActionLabel=d(932,null),e.gotoOffsetActionLabel=d(933,null)))(rqo||={});var sqo;(i=>i.helpQuickAccessActionLabel=d(935,null))(sqo||={});var aqo;(e=>(e.quickCommandActionLabel=d(943,null),e.quickCommandHelp=d(942,null)))(aqo||={});var lqo;(e=>(e.quickOutlineActionLabel=d(944,null),e.quickOutlineByCategoryActionLabel=d(945,null)))(lqo||={});var cqo;(i=>i.editorViewAccessibleLabel=d(930,null))(cqo||={});var dqo;(i=>i.toggleHighContrast=d(957,null))(dqo||={});var uqo;(i=>i.bulkEditServiceSummary=d(915,null))(uqo||={});var ji=le("lifecycleService");function uTt(a){switch(a){case 1:return"NewWindow";case 3:return"ReloadedWindow";case 4:return"ReopenedWindow"}}function ZXi(a){switch(a){case 1:return"Starting";case 2:return"Ready";case 3:return"Restored";case 4:return"Eventually"}}var pTt=le("editorPaneService");var Qi;(i=>i.Workbench="workbench.contributions.kind")(Qi||={});var St=(o=>(o[o.BlockStartup=1]="BlockStartup",o[o.BlockRestore=2]="BlockRestore",o[o.AfterRestored=3]="AfterRestored",o[o.Eventually=4]="Eventually",o))(St||{});function eJi(a){let i=a;return!!i&&typeof i.editorTypeId=="string"}function pqo(a){switch(a){case 3:return St.AfterRestored;case 4:return St.Eventually}}function tJi(a){switch(a){case St.BlockStartup:return 1;case St.BlockRestore:return 2;case St.AfterRestored:return 3;case St.Eventually:return 4}}var bde=class a extends x{constructor(){super(...arguments);this.contributionsByPhase=new Map;this.contributionsByEditor=new Map;this.contributionsById=new Map;this.instancesById=new Map;this.instanceDisposables=this._register(new N);this.timingsByPhase=new Map;this.pendingRestoredContributions=new Ko;this.whenRestored=this.pendingRestoredContributions.p}static{this.INSTANCE=new a}static{this.BLOCK_BEFORE_RESTORE_WARN_THRESHOLD=20}static{this.BLOCK_AFTER_RESTORE_WARN_THRESHOLD=100}get timings(){return this.timingsByPhase}registerWorkbenchContribution2(e,t,o){let n={id:e,ctor:t};this.instantiationService&&this.lifecycleService&&this.logService&&this.environmentService&&this.editorPaneService&&(typeof o=="number"&&this.lifecycleService.phase>=o||typeof e=="string"&&eJi(o)&&this.editorPaneService.didInstantiateEditorPane(o.editorTypeId))?this.safeCreateContribution(this.instantiationService,this.logService,this.environmentService,n,typeof o=="number"?tJi(o):this.lifecycleService.phase):(typeof o=="number"&&aV(this.contributionsByPhase,tJi(o),[]).push(n),typeof e=="string"&&(this.contributionsById.has(e)?console.error(`IWorkbenchContributionsRegistry#registerWorkbenchContribution(): Can't register multiple contributions with same id '${e}'`):this.contributionsById.set(e,n),eJi(o)&&aV(this.contributionsByEditor,o.editorTypeId,[]).push(n)))}registerWorkbenchContribution(e,t){this.registerWorkbenchContribution2(void 0,e,pqo(t))}getWorkbenchContribution(e){if(this.instancesById.has(e))return this.instancesById.get(e);let t=this.instantiationService,o=this.lifecycleService,n=this.logService,r=this.environmentService;if(!t||!o||!n||!r)throw new Error(`IWorkbenchContributionsRegistry#getContribution('${e}'): cannot be called before registry started`);let s=this.contributionsById.get(e);if(!s)throw new Error(`IWorkbenchContributionsRegistry#getContribution('${e}'): contribution with that identifier is unknown.`);o.phase<3&&n.warn(`IWorkbenchContributionsRegistry#getContribution('${e}'): contribution instantiated before LifecyclePhase.Restored!`),this.safeCreateContribution(t,n,r,s,o.phase);let l=this.instancesById.get(e);if(!l)throw new Error(`IWorkbenchContributionsRegistry#getContribution('${e}'): failed to create contribution.`);return l}start(e){let t=this.instantiationService=e.get(F),o=this.lifecycleService=e.get(ji),n=this.logService=e.get(se),r=this.environmentService=e.get(Eo),s=this.editorPaneService=e.get(pTt);this._register(o.onDidShutdown(()=>{this.instanceDisposables.clear()}));for(let l of[1,2,3,4])this.instantiateByPhase(t,o,n,r,l);for(let l of this.contributionsByEditor.keys())s.didInstantiateEditorPane(l)&&this.onEditor(l,t,o,n,r);this._register(s.onWillInstantiateEditorPane(l=>this.onEditor(l.typeId,t,o,n,r)))}onEditor(e,t,o,n,r){let s=this.contributionsByEditor.get(e);if(s){this.contributionsByEditor.delete(e);for(let l of s)this.safeCreateContribution(t,n,r,l,o.phase)}}instantiateByPhase(e,t,o,n,r){t.phase>=r?this.doInstantiateByPhase(e,o,n,r):t.when(r).then(()=>this.doInstantiateByPhase(e,o,n,r))}async doInstantiateByPhase(e,t,o,n){let r=this.contributionsByPhase.get(n);if(r)switch(this.contributionsByPhase.delete(n),n){case 1:case 2:{Mo(`code/willCreateWorkbenchContributions/${n}`);for(let s of r)this.safeCreateContribution(e,t,o,s,n);Mo(`code/didCreateWorkbenchContributions/${n}`);break}case 3:case 4:{n===4&&await this.pendingRestoredContributions.p,this.doInstantiateWhenIdle(r,e,t,o,n);break}}}doInstantiateWhenIdle(e,t,o,n,r){Mo(`code/willCreateWorkbenchContributions/${r}`);let s=0,l=r===4?3e3:500,c=u=>{for(;s<e.length;){let p=e[s++];if(this.safeCreateContribution(t,o,n,p,r),u.timeRemaining()<1){PL(c,l);break}}s===e.length&&(Mo(`code/didCreateWorkbenchContributions/${r}`),r===3&&this.pendingRestoredContributions.complete())};PL(c,l)}safeCreateContribution(e,t,o,n,r){if(typeof n.id=="string"&&this.instancesById.has(n.id))return;let s=Date.now();try{typeof n.id=="string"&&Mo(`code/willCreateWorkbenchContribution/${r}/${n.id}`);let l=e.createInstance(n.ctor);typeof n.id=="string"&&(this.instancesById.set(n.id,l),this.contributionsById.delete(n.id)),jc(l)&&this.instanceDisposables.add(l)}catch(l){t.error(`Unable to create workbench contribution '${n.id??n.ctor.name}'.`,l)}finally{typeof n.id=="string"&&Mo(`code/didCreateWorkbenchContribution/${r}/${n.id}`)}if(typeof n.id=="string"||!o.isBuilt){let l=Date.now()-s;if(l>(r<3?a.BLOCK_BEFORE_RESTORE_WARN_THRESHOLD:a.BLOCK_AFTER_RESTORE_WARN_THRESHOLD)&&t.warn(`Creation of workbench contribution '${n.id??n.ctor.name}' took ${l}ms.`),typeof n.id=="string"){let c=this.timingsByPhase.get(r);c||(c=[],this.timingsByPhase.set(r,c)),c.push([n.id,l])}}}},It=bde.INSTANCE.registerWorkbenchContribution2.bind(bde.INSTANCE),mTt=bde.INSTANCE.getWorkbenchContribution.bind(bde.INSTANCE);ne.add(Qi.Workbench,bde.INSTANCE);var hK=(n=>(n.Extensions="Extensions",n.IntegratedTerminal="IntegratedTerminal",n.InteractiveSession="InteractiveSession",n.Telemetry="Telemetry",n.Update="Update",n))(hK||{}),iJi={Extensions:{name:{key:"extensionsConfigurationTitle",value:d(138,null)}},IntegratedTerminal:{name:{key:"terminalIntegratedConfigurationTitle",value:d(141,null)}},InteractiveSession:{name:{key:"interactiveSessionConfigurationTitle",value:d(139,null)}},Telemetry:{name:{key:"telemetryConfigurationTitle",value:d(140,null)}},Update:{name:{key:"updateConfigurationTitle",value:d(142,null)}}};var vF="^([a-z0-9A-Z][a-z0-9-A-Z]*)\\.([a-z0-9A-Z][a-z0-9-A-Z]*)$",N5=new RegExp(vF),hTt="__web_extension",O5="skipWalkthrough",TR="skipPublisherTrust",bB="extensionInstallSource",gTt="dependecyOrPackExtensionInstall",oJi="clientTargetPlatform";function wQe(a){switch(a){case"win32-x64":return"Windows 64 bit";case"win32-arm64":return"Windows ARM";case"linux-x64":return"Linux 64 bit";case"linux-arm64":return"Linux ARM 64";case"linux-armhf":return"Linux ARM";case"alpine-x64":return"Alpine Linux 64 bit";case"alpine-arm64":return"Alpine ARM 64";case"darwin-x64":return"Mac";case"darwin-arm64":return"Mac Silicon";case"web":return"Web";case"universal":return"universal";case"unknown":return"unknown";case"undefined":return"undefined"}}function nJi(a){switch(a){case"win32-x64":return"win32-x64";case"win32-arm64":return"win32-arm64";case"linux-x64":return"linux-x64";case"linux-arm64":return"linux-arm64";case"linux-armhf":return"linux-armhf";case"alpine-x64":return"alpine-x64";case"alpine-arm64":return"alpine-arm64";case"darwin-x64":return"darwin-x64";case"darwin-arm64":return"darwin-arm64";case"web":return"web";case"universal":return"universal";default:return"unknown"}}function fTt(a,i){switch(a){case 3:return i==="x64"?"win32-x64":i==="arm64"?"win32-arm64":"unknown";case 2:return i==="x64"?"linux-x64":i==="arm64"?"linux-arm64":i==="arm"?"linux-armhf":"unknown";case"alpine":return i==="x64"?"alpine-x64":i==="arm64"?"alpine-arm64":"unknown";case 1:return i==="x64"?"darwin-x64":i==="arm64"?"darwin-arm64":"unknown";case 0:return"web"}}function $ke(a,i){return i==="web"&&!a.includes("web")}function Sde(a,i,e){return $ke(i,e)?!1:a==="undefined"||a==="universal"?!0:a==="unknown"?!1:a===e}function rJi(a){let i=a;return!!i&&typeof i=="object"&&typeof i.id=="string"&&(!i.uuid||typeof i.uuid=="string")}var fa=le("extensionGalleryService");var XE=class extends Error{constructor(e,t){super(e);this.code=t;this.name=t}};var vh=class extends Error{constructor(e,t){super(e);this.code=t;this.name=t}},Cs=le("extensionManagementService"),wX="extensionsIdentifiers/disabled",cmi="extensionsIdentifiers/enabled",fK=le("IGlobalExtensionEnablementService"),jke=le("IExtensionTipsService"),dm=le("IAllowedExtensionsService");async function dmi(a,i){let e;try{e=await i.resolve(a)}catch(t){if(t.fileOperationResult===1)return 0;throw t}return e.children?(await Promise.all(e.children.map(o=>dmi(o.resource,i)))).reduce((o,n)=>o+n,0):e.size??0}var bh=L(2033,"Extensions"),umi=L(2050,"Preferences"),Ide="extensions.allowed",Qke="extensions.verifySignature",vTt="extensions.requestTimeout";ne.as(Jt.Configuration).registerConfiguration({id:"extensions",order:30,title:d(2049,null),type:"object",properties:{[Ide]:{type:"object",markdownDescription:d(2039,null),default:"*",defaultSnippets:[{body:{},description:d(2044,null)},{body:{"*":!0},description:d(2040,null)}],scope:1,policy:{name:"AllowedExtensions",category:"Extensions",minimumVersion:"1.96",localization:{description:{key:"extensions.allowed.policy",value:d(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:d(2037,null),enumDescriptions:[d(2043,null),d(2041,null),d(2042,null)]},{type:"array",items:{type:"string"},description:d(2038,null)}]},"([a-z0-9A-Z][a-z0-9-A-Z]*)$":{type:["boolean","string"],enum:[!0,!1,"stable"],description:d(2032,null),enumDescriptions:[d(2048,null),d(2046,null),d(2047,null)]},"\\*":{type:"boolean",enum:[!0,!1],description:d(2034,null),enumDescriptions:[d(2036,null),d(2035,null)]}}}}});function CQe(a,i){return a?i?.capabilities.signing?.allPrivateRepositorySigned===!0:i?.capabilities.signing?.allPublicRepositorySigned===!0}var tt=le("productService"),sJi="vscode://schemas/vscode-product";var pmi=class{constructor(){this._generators=new Map;this._cache=new WeakMap}register(i,e){this._generators.set(i,e)}readActivationEvents(i){return this._cache.has(i)||this._cache.set(i,this._readActivationEvents(i)),this._cache.get(i)}createActivationEventsMap(i){let e=Object.create(null);for(let t of i){let o=this.readActivationEvents(t);o.length>0&&(e[Ii.toKey(t.identifier)]=o)}return e}_readActivationEvents(i){if(typeof i.main>"u"&&typeof i.browser>"u")return[];let e=Array.isArray(i.activationEvents)?i.activationEvents.slice(0):[];for(let t=0;t<e.length;t++)e[t]==="onUri"&&(e[t]=`onUri:${Ii.toKey(i.identifier)}`);if(!i.contributes)return e;for(let t in i.contributes){let o=this._generators.get(t);if(!o)continue;let n=i.contributes[t],r=Array.isArray(n)?n:[n];try{e.push(...o(r))}catch(s){mt(s)}}return e}},F5=new pmi;var mqo={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"}},vK=Object.freeze(mqo);var vmi=ne.as(ma.JSONContribution),bTt=class{constructor(i,e,t){this._messageHandler=i,this._extension=e,this._extensionPointId=t}_msg(i,e){this._messageHandler({type:i,message:e,extensionId:this._extension.identifier,extensionPointId:this._extensionPointId})}error(i){this._msg(bt.Error,i)}warn(i){this._msg(bt.Warning,i)}info(i){this._msg(bt.Info,i)}},mmi=class a{constructor(i,e){this.added=i;this.removed=e}static _toSet(i){let e=new ly;for(let t=0,o=i.length;t<o;t++)e.add(i[t].description.identifier);return e}static compute(i,e){if(!i||!i.length)return new a(e,[]);if(!e||!e.length)return new a([],i);let t=this._toSet(i),o=this._toSet(e),n=e.filter(s=>!t.has(s.description.identifier)),r=i.filter(s=>!o.has(s.description.identifier));return new a(n,r)}},hmi=class{constructor(i,e,t){this.name=i,this.defaultExtensionKind=e,this.canHandleResolver=t,this._handler=null,this._users=null,this._delta=null}setHandler(i){if(this._handler!==null)throw new Error("Handler already set!");return this._handler=i,this._handle(),{dispose:()=>{this._handler=null}}}acceptUsers(i){this._delta=mmi.compute(this._users,i),this._users=i,this._handle()}_handle(){if(!(this._handler===null||this._users===null||this._delta===null))try{this._handler(this._users,this._delta)}catch(i){mt(i)}}},hqo={type:"string",enum:["ui","workspace"],enumDescriptions:[d(17673,null),d(17753,null)]},aJi="vscode://schemas/vscode-extensions",gmi={properties:{engines:{type:"object",description:d(17737,null),properties:{vscode:{type:"string",description:d(17738,null),default:"^1.105.0"}}},publisher:{description:d(17749,null),type:"string"},displayName:{description:d(17734,null),type:"string"},categories:{description:d(17728,null),type:"array",uniqueItems:!0,items:{oneOf:[{type:"string",enum:cF},{type:"string",const:"Languages",deprecationMessage:d(17729,null)}]}},galleryBanner:{type:"object",description:d(17741,null),properties:{color:{description:d(17742,null),type:"string"},theme:{description:d(17743,null),type:"string",enum:["dark","light"]}}},contributes:{description:d(17730,null),type:"object",properties:{},default:{}},preview:{type:"boolean",description:d(17747,null)},enableProposedApi:{type:"boolean",deprecationMessage:d(17736,null)},enabledApiProposals:{markdownDescription:d(17735,null),type:"array",uniqueItems:!0,items:{type:"string",enum:Object.keys(vK).map(a=>a),markdownEnumDescriptions:Object.values(vK).map(a=>a.proposal)}},api:{markdownDescription:d(17708,null),type:"string",enum:["none"],enumDescriptions:[d(17709,null)]},activationEvents:{description:d(17674,null),type:"array",items:{type:"string",defaultSnippets:[{label:"onWebviewPanel",description:d(17705,null),body:"onWebviewPanel:viewType"},{label:"onLanguage",description:d(17688,null),body:"onLanguage:${1:languageId}"},{label:"onCommand",description:d(17678,null),body:"onCommand:${2:commandId}"},{label:"onDebug",description:d(17680,null),body:"onDebug"},{label:"onDebugInitialConfigurations",description:d(17683,null),body:"onDebugInitialConfigurations"},{label:"onDebugDynamicConfigurations",description:d(17682,null),body:"onDebugDynamicConfigurations"},{label:"onDebugResolve",description:d(17684,null),body:"onDebugResolve:${6:type}"},{label:"onDebugAdapterProtocolTracker",description:d(17681,null),body:"onDebugAdapterProtocolTracker:${6:type}"},{label:"workspaceContains",description:d(17707,null),body:"workspaceContains:${4:filePattern}"},{label:"onStartupFinished",description:d(17696,null),body:"onStartupFinished"},{label:"onTaskType",description:d(17697,null),body:"onTaskType:${1:taskType}"},{label:"onFileSystem",description:d(17686,null),body:"onFileSystem:${1:scheme}"},{label:"onEditSession",description:d(17685,null),body:"onEditSession:${1:scheme}"},{label:"onSearch",description:d(17695,null),body:"onSearch:${7:scheme}"},{label:"onView",body:"onView:${5:viewId}",description:d(17703,null)},{label:"onUri",body:"onUri",description:d(17702,null)},{label:"onOpenExternalUri",body:"onOpenExternalUri",description:d(17693,null)},{label:"onCustomEditor",body:"onCustomEditor:${9:viewType}",description:d(17679,null)},{label:"onNotebook",body:"onNotebook:${1:type}",description:d(17692,null)},{label:"onAuthenticationRequest",body:"onAuthenticationRequest:${11:authenticationProviderId}",description:d(17675,null)},{label:"onRenderer",description:d(17694,null),body:"onRenderer:${11:rendererId}"},{label:"onTerminalProfile",body:"onTerminalProfile:${1:terminalId}",description:d(17699,null)},{label:"onTerminalQuickFixRequest",body:"onTerminalQuickFixRequest:${1:quickFixId}",description:d(17700,null)},{label:"onWalkthrough",body:"onWalkthrough:${1:walkthroughID}",description:d(17704,null)},{label:"onIssueReporterOpened",body:"onIssueReporterOpened",description:d(17687,null)},{label:"onChatParticipant",body:"onChatParticipant:${1:participantId}",description:d(17677,null)},{label:"onChatContextProvider",body:"onChatContextProvider:${1:contextProviderId}",description:d(17676,null)},{label:"onLanguageModelChatProvider",body:"onLanguageModelChatProvider:${1:vendor}",description:d(17689,null)},{label:"onLanguageModelTool",body:"onLanguageModelTool:${1:toolId}",description:d(17690,null)},{label:"onTerminal",body:"onTerminal:{1:shellType}",description:d(17698,null)},{label:"onTerminalShellIntegration",body:"onTerminalShellIntegration:${1:shellType}",description:d(17701,null)},{label:"onMcpCollection",description:d(17691,null),body:"onMcpCollection:${2:collectionId}"},{label:"*",description:d(17706,null),body:"*"}]}},badges:{type:"array",description:d(17710,null),items:{type:"object",required:["url","href","description"],properties:{url:{type:"string",description:d(17713,null)},href:{type:"string",description:d(17712,null)},description:{type:"string",description:d(17711,null)}}}},markdown:{type:"string",description:d(17746,null),enum:["github","standard"],default:"github"},qna:{default:"marketplace",description:d(17750,null),anyOf:[{type:["string","boolean"],enum:["marketplace",!1]},{type:"string"}]},extensionDependencies:{description:d(17740,null),type:"array",uniqueItems:!0,items:{type:"string",pattern:vF}},extensionAffinity:{description:d(17739,null),type:"array",uniqueItems:!0,items:{type:"string",pattern:vF}},extensionPack:{description:d(17731,null),type:"array",uniqueItems:!0,items:{type:"string",pattern:vF}},extensionKind:{description:d(17666,null),type:"array",items:hqo,default:["workspace"],defaultSnippets:[{body:["ui"],description:d(17668,null)},{body:["workspace"],description:d(17670,null)},{body:["ui","workspace"],description:d(17669,null)},{body:["workspace","ui"],description:d(17671,null)},{body:[],description:d(17667,null)}]},capabilities:{description:d(17714,null),type:"object",properties:{virtualWorkspaces:{description:d(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:d(17724,null),type:["string","boolean"],enum:["limited",!0,!1],enumDescriptions:[d(17726,null),d(17727,null),d(17725,null)]},description:{type:"string",markdownDescription:d(17723,null)}}},untrustedWorkspaces:{description:d(17715,null),type:"object",required:["supported"],defaultSnippets:[{body:{supported:"${1:limited}",description:"${2}"}}],properties:{supported:{markdownDescription:d(17718,null),type:["string","boolean"],enum:["limited",!0,!1],enumDescriptions:[d(17720,null),d(17721,null),d(17719,null)]},restrictedConfigurations:{description:d(17717,null),type:"array",items:{type:"string"}},description:{type:"string",markdownDescription:d(17716,null)}}}}},sponsor:{description:d(17732,null),type:"object",defaultSnippets:[{body:{url:"${1:https:}"}}],properties:{url:{description:d(17733,null),type:"string"}}},scripts:{type:"object",properties:{"vscode:prepublish":{description:d(17751,null),type:"string"},"vscode:uninstall":{description:d(17752,null),type:"string"}}},icon:{type:"string",description:d(17744,null)},l10n:{type:"string",description:d(17745,null)},pricing:{type:"string",markdownDescription:d(17748,null),enum:["Free","Trial"],default:"Free"}}},fmi=class{constructor(){this._extensionPoints=new Map}registerExtensionPoint(i){if(this._extensionPoints.has(i.extensionPoint))throw new Error("Duplicate extension point: "+i.extensionPoint);let e=new hmi(i.extensionPoint,i.defaultExtensionKind,i.canHandleResolver);return this._extensionPoints.set(i.extensionPoint,e),i.activationEventsGenerator&&F5.register(i.extensionPoint,i.activationEventsGenerator),gmi.properties.contributes.properties[i.extensionPoint]=i.jsonSchema,vmi.registerSchema(aJi,gmi),e}getExtensionPoints(){return Array.from(this._extensionPoints.values())}},lJi={ExtensionsRegistry:"ExtensionsRegistry"};ne.add(lJi.ExtensionsRegistry,new fmi);var Rn=ne.as(lJi.ExtensionsRegistry);vmi.registerSchema(aJi,gmi);vmi.registerSchema(sJi,{properties:{extensionEnabledApiProposals:{description:d(17672,null),type:"object",properties:{},additionalProperties:{anyOf:[{type:"array",uniqueItems:!0,items:{type:"string",enum:Object.keys(vK),markdownEnumDescriptions:Object.values(vK).map(a=>a.proposal)}}]}}}});var As;(i=>i.ExtensionFeaturesRegistry="workbench.registry.extensionFeatures")(As||={});var cy=le("IExtensionFeaturesManagementService"),bmi=class{constructor(){this.extensionFeatures=new Map}registerExtensionFeature(i){if(this.extensionFeatures.has(i.id))throw new Error(`Extension feature with id '${i.id}' already exists`);return this.extensionFeatures.set(i.id,i),{dispose:()=>this.extensionFeatures.delete(i.id)}}getExtensionFeature(i){return this.extensionFeatures.get(i)}getExtensionFeatures(){return Array.from(this.extensionFeatures.values())}};ne.add(As.ExtensionFeaturesRegistry,new bmi);var cJi=Rn.registerExtensionPoint({extensionPoint:"jsonValidation",defaultExtensionKind:["workspace","web"],jsonSchema:{description:d(3505,null),type:"array",defaultSnippets:[{body:[{fileMatch:"${1:file.json}",url:"${2:url}"}]}],items:{type:"object",defaultSnippets:[{body:{fileMatch:"${1:file.json}",url:"${2:url}"}}],properties:{fileMatch:{type:["string","array"],description:d(3506,null),items:{type:["string"]}},url:{description:d(3507,null),type:"string"}}}}}),STt=class{constructor(){cJi.setHandler(i=>{for(let e of i){let t=e.value,o=e.collector,n=e.description.extensionLocation;if(!t||!Array.isArray(t)){o.error(d(3510,null));return}t.forEach(r=>{if(!Fe(r.fileMatch)&&!(Array.isArray(r.fileMatch)&&r.fileMatch.every(Fe))){o.error(d(3509,null));return}let s=r.url;if(!Fe(s)){o.error(d(3512,null));return}if(s.startsWith("./"))try{let l=Ge(n,s);ws(l,n)||o.warn(d(3511,null,cJi.name,l.toString(),n.path))}catch(l){o.error(d(3513,null,l.message))}else if(!/^[^:/?#]+:\/\//.test(s)){o.error(d(3514,null));return}})}})}},Smi=class extends x{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.jsonValidation}render(e){let t=e.contributes?.jsonValidation||[];if(!t.length)return{data:{headers:[],rows:[]},dispose:()=>{}};let o=[d(3508,null),d(3516,null)],n=t.map(r=>[new Ie().appendMarkdown(`\`${Array.isArray(r.fileMatch)?r.fileMatch.join(", "):r.fileMatch}\``),r.url]);return{data:{headers:o,rows:n},dispose:()=>{}}}};ne.as(As.ExtensionFeaturesRegistry).registerExtensionFeature({id:"jsonValidation",label:d(3515,null),access:{canToggle:!1},renderer:new Ft(Smi)});var Imi=ne.as(ile.ColorContribution),ITt=Imi.getColorReferenceSchema(),dJi="^\\w+[.\\w+]*$",gqo=Rn.registerExtensionPoint({extensionPoint:"colors",jsonSchema:{description:d(18031,null),type:"array",items:{type:"object",properties:{id:{type:"string",description:d(18033,null),pattern:dJi,patternErrorMessage:d(18034,null)},description:{type:"string",description:d(18032,null)},defaults:{type:"object",properties:{light:{description:d(18038,null),type:"string",anyOf:[ITt,{type:"string",format:"color-hex"}]},dark:{description:d(18035,null),type:"string",anyOf:[ITt,{type:"string",format:"color-hex"}]},highContrast:{description:d(18036,null),type:"string",anyOf:[ITt,{type:"string",format:"color-hex"}]},highContrastLight:{description:d(18037,null),type:"string",anyOf:[ITt,{type:"string",format:"color-hex"}]}},required:["light","dark"]}}}}}),yTt=class{constructor(){gqo.setHandler((i,e)=>{for(let t of e.added){let o=t.value,n=t.collector;if(!o||!Array.isArray(o)){n.error(d(18044,null));return}let r=(s,l)=>s.length>0?s[0]==="#"?We.Format.CSS.parseHex(s):s:(n.error(d(18045,null,l)),We.red);for(let s of o){if(typeof s.id!="string"||s.id.length===0){n.error(d(18050,null));return}if(!s.id.match(dJi)){n.error(d(18051,null));return}if(typeof s.description!="string"||s.id.length===0){n.error(d(18049,null));return}let l=s.defaults;if(!l||typeof l!="object"||typeof l.light!="string"||typeof l.dark!="string"){n.error(d(18046,null));return}if(l.highContrast&&typeof l.highContrast!="string"){n.error(d(18047,null));return}if(l.highContrastLight&&typeof l.highContrastLight!="string"){n.error(d(18048,null));return}Imi.registerColor(s.id,{light:r(l.light,"configuration.colors.defaults.light"),dark:r(l.dark,"configuration.colors.defaults.dark"),hcDark:r(l.highContrast??l.dark,"configuration.colors.defaults.highContrast"),hcLight:r(l.highContrastLight??l.light,"configuration.colors.defaults.highContrastLight")},s.description)}}for(let t of e.removed){let o=t.value;for(let n of o)Imi.deregisterColor(n.id)}})}},ymi=class extends x{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.colors}render(e){let t=e.contributes?.colors||[];if(!t.length)return{data:{headers:[],rows:[]},dispose:()=>{}};let o=[d(18043,null),d(18042,null),d(18039,null),d(18041,null),d(18040,null)],n=s=>s[0]==="#"?We.fromHex(s):void 0,r=t.sort((s,l)=>s.id.localeCompare(l.id)).map(s=>[new Ie().appendMarkdown(`\`${s.id}\``),s.description,n(s.defaults.dark)??new Ie().appendMarkdown(`\`${s.defaults.dark}\``),n(s.defaults.light)??new Ie().appendMarkdown(`\`${s.defaults.light}\``),n(s.defaults.highContrast)??new Ie().appendMarkdown(`\`${s.defaults.highContrast}\``)]);return{data:{headers:o,rows:r},dispose:()=>{}}}};ne.as(As.ExtensionFeaturesRegistry).registerExtensionFeature({id:"colors",label:d(18030,null),access:{canToggle:!1},renderer:new Ft(ymi)});var xQe=ne.as(Tri.IconContribution),fqo=xQe.getIconReferenceSchema(),uJi=`^${q.iconNameSegment}(-${q.iconNameSegment})+$`,vqo=Rn.registerExtensionPoint({extensionPoint:"icons",jsonSchema:{description:d(18119,null),type:"object",propertyNames:{pattern:uJi,description:d(18117,null),patternErrorMessage:d(18118,null)},additionalProperties:{type:"object",properties:{description:{type:"string",description:d(18116,null)},default:{anyOf:[fqo,{type:"object",properties:{fontPath:{description:d(18115,null),type:"string"},fontCharacter:{description:d(18114,null),type:"string"}},required:["fontPath","fontCharacter"],defaultSnippets:[{body:{fontPath:"${1:myiconfont.woff}",fontCharacter:"${2:\\\\E001}"}}]}],description:d(18113,null)}},required:["description","default"],defaultSnippets:[{body:{description:"${1:my icon}",default:{fontPath:"${2:myiconfont.woff}",fontCharacter:"${3:\\\\E001}"}}}]},defaultSnippets:[{body:{"${1:my-icon-id}":{description:"${2:my icon}",default:{fontPath:"${3:myiconfont.woff}",fontCharacter:"${4:\\\\E001}"}}}}]}}),wTt=class{constructor(){vqo.setHandler((i,e)=>{for(let t of e.added){let o=t.value,n=t.collector;if(!o||typeof o!="object"){n.error(d(18120,null));return}for(let r in o){if(!r.match(uJi)){n.error(d(18125,null));return}let s=o[r];if(typeof s.description!="string"||s.description.length===0){n.error(d(18124,null));return}let l=s.default;if(typeof l=="string")xQe.registerIcon(r,{id:l},s.description);else if(typeof l=="object"&&typeof l.fontPath=="string"&&typeof l.fontCharacter=="string"){let c=qm(l.fontPath).substring(1),u=bqo[c];if(!u){n.warn(d(18122,null,c));return}let p=t.description.extensionLocation,h=Ge(p,l.fontPath),g=Sqo(t.description,l.fontPath),f=xQe.registerIconFont(g,{src:[{location:h,format:u}]});if(!ws(h,p)){n.warn(d(18123,null,h.path,p.path));return}xQe.registerIcon(r,{fontCharacter:l.fontCharacter,font:{id:g,definition:f}},s.description)}else n.error(d(18121,null))}}for(let t of e.removed){let o=t.value;for(let n in o)xQe.deregisterIcon(n)}})}},bqo={ttf:"truetype",woff:"woff",woff2:"woff2"};function Sqo(a,i){return Oo.join(a.identifier.value,i)}var Iqo="*",hJi=":",gJi=".",CTt="\\w+[-_\\w+]*",W5=`^${CTt}$`,yqo=`^(${CTt}|\\*)(\\${gJi}${CTt})*(${hJi}${CTt})?$`,wqo="^(\\s*(italic|bold|underline|strikethrough))*\\s*$",$P=class{constructor(i,e,t,o,n){this.foreground=i;this.bold=e;this.underline=t;this.strikethrough=o;this.italic=n}};(r=>{function a(s){return{_foreground:s.foreground===void 0?null:We.Format.CSS.formatHexA(s.foreground,!0),_bold:s.bold===void 0?null:s.bold,_underline:s.underline===void 0?null:s.underline,_italic:s.italic===void 0?null:s.italic,_strikethrough:s.strikethrough===void 0?null:s.strikethrough}}r.toJSONObject=a;function i(s){if(s){let l=u=>typeof u=="boolean"?u:void 0,c=u=>typeof u=="string"?We.fromHex(u):void 0;return new r(c(s._foreground),l(s._bold),l(s._underline),l(s._strikethrough),l(s._italic))}}r.fromJSONObject=i;function e(s,l){return s===l?!0:s!==void 0&&l!==void 0&&(s.foreground instanceof We?s.foreground.equals(l.foreground):l.foreground===void 0)&&s.bold===l.bold&&s.underline===l.underline&&s.strikethrough===l.strikethrough&&s.italic===l.italic}r.equals=e;function t(s){return s instanceof r}r.is=t;function o(s){return new r(s.foreground,s.bold,s.underline,s.strikethrough,s.italic)}r.fromData=o;function n(s,l,c,u,p,h){let g;if(s!==void 0&&(g=We.fromHex(s)),l!==void 0){c=h=u=p=!1;let f=/italic|bold|underline|strikethrough/g,v;for(;v=f.exec(l);)switch(v[0]){case"bold":c=!0;break;case"italic":h=!0;break;case"underline":u=!0;break;case"strikethrough":p=!0;break}}return new r(g,c,u,p,h)}r.fromSettings=n})($P||={});var Yke;(o=>{function a(n,r){if(r&&typeof r._selector=="string"&&r._style){let s=$P.fromJSONObject(r._style);if(s)try{return{selector:n.parseTokenSelector(r._selector),style:s}}catch{}}}o.fromJSONObject=a;function i(n){return{_selector:n.selector.id,_style:$P.toJSONObject(n.style)}}o.toJSONObject=i;function e(n,r){return n===r?!0:n!==void 0&&r!==void 0&&n.selector&&r.selector&&n.selector.id===r.selector.id&&$P.equals(n.style,r.style)}o.equals=e;function t(n){return n&&n.selector&&typeof n.selector.id=="string"&&$P.is(n.style)}o.is=t})(Yke||={});var Cqo={TokenClassificationContribution:"base.contributions.tokenClassification"},Cmi=class extends x{constructor(){super();this._onDidChangeSchema=this._register(new E);this.onDidChangeSchema=this._onDidChangeSchema.event;this.currentTypeNumber=0;this.currentModifierBit=1;this.tokenStylingDefaultRules=[];this.tokenStylingSchema={type:"object",properties:{},patternProperties:{[yqo]:wmi()},additionalProperties:!1,definitions:{style:{type:"object",description:d(2714,null),properties:{foreground:{type:"string",description:d(2712,null),format:"color-hex",default:"#ff0000"},background:{type:"string",deprecationMessage:d(2708,null)},fontStyle:{type:"string",description:d(2710,null),pattern:wqo,patternErrorMessage:d(2707,null),defaultSnippets:[{label:d(2711,null),bodyText:'""'},{body:"italic"},{body:"bold"},{body:"underline"},{body:"strikethrough"},{body:"italic bold"},{body:"italic underline"},{body:"italic strikethrough"},{body:"bold underline"},{body:"bold strikethrough"},{body:"underline strikethrough"},{body:"italic bold underline"},{body:"italic bold strikethrough"},{body:"italic underline strikethrough"},{body:"bold underline strikethrough"},{body:"italic bold underline strikethrough"}]},bold:{type:"boolean",description:d(2709,null)},italic:{type:"boolean",description:d(2713,null)},underline:{type:"boolean",description:d(2716,null)},strikethrough:{type:"boolean",description:d(2715,null)}},defaultSnippets:[{body:{foreground:"${1:#FF0000}",fontStyle:"${2:bold}"}}]}}};this.tokenTypeById=Object.create(null),this.tokenModifierById=Object.create(null),this.typeHierarchy=Object.create(null)}registerTokenType(e,t,o,n){if(!e.match(W5))throw new Error("Invalid token type id.");if(o&&!o.match(W5))throw new Error("Invalid token super type id.");let s={num:this.currentTypeNumber++,id:e,superType:o,description:t,deprecationMessage:n};this.tokenTypeById[e]=s;let l=wmi(t,n);this.tokenStylingSchema.properties[e]=l,this.typeHierarchy=Object.create(null)}registerTokenModifier(e,t,o){if(!e.match(W5))throw new Error("Invalid token modifier id.");let n=this.currentModifierBit;this.currentModifierBit=this.currentModifierBit*2;let r={num:n,id:e,description:t,deprecationMessage:o};this.tokenModifierById[e]=r,this.tokenStylingSchema.properties[`*.${e}`]=wmi(t,o)}parseTokenSelector(e,t){let o=xTt(e,t);return o.type?{match:(n,r,s)=>{let l=0;if(o.language!==void 0){if(o.language!==s)return-1;l+=10}if(o.type!==Iqo){let u=this.getTypeHierarchy(n).indexOf(o.type);if(u===-1)return-1;l+=100-u}for(let c of o.modifiers)if(r.indexOf(c)===-1)return-1;return l+o.modifiers.length*100},id:`${[o.type,...o.modifiers.sort()].join(".")}${o.language!==void 0?":"+o.language:""}`}:{match:()=>-1,id:"$invalid"}}registerTokenStyleDefault(e,t){this.tokenStylingDefaultRules.push({selector:e,defaults:t})}deregisterTokenStyleDefault(e){let t=e.id;this.tokenStylingDefaultRules=this.tokenStylingDefaultRules.filter(o=>o.selector.id!==t)}deregisterTokenType(e){delete this.tokenTypeById[e],delete this.tokenStylingSchema.properties[e],this.typeHierarchy=Object.create(null)}deregisterTokenModifier(e){delete this.tokenModifierById[e],delete this.tokenStylingSchema.properties[`*.${e}`]}getTokenTypes(){return Object.keys(this.tokenTypeById).map(e=>this.tokenTypeById[e])}getTokenModifiers(){return Object.keys(this.tokenModifierById).map(e=>this.tokenModifierById[e])}getTokenStylingSchema(){return this.tokenStylingSchema}getTokenStylingDefaultRules(){return this.tokenStylingDefaultRules}getTypeHierarchy(e){let t=this.typeHierarchy[e];if(!t){this.typeHierarchy[e]=t=[e];let o=this.tokenTypeById[e];for(;o&&o.superType;)t.push(o.superType),o=this.tokenTypeById[o.superType]}return t}toString(){let e=(t,o)=>{let n=t.indexOf(".")===-1?0:1,r=o.indexOf(".")===-1?0:1;return n!==r?n-r:t.localeCompare(o)};return Object.keys(this.tokenTypeById).sort(e).map(t=>`- \`${t}\`: ${this.tokenTypeById[t].description}`).join(`
`)}},pJi=hJi.charCodeAt(0),xqo=gJi.charCodeAt(0);function xTt(a,i){let e=a.length,t=i,o=[];for(let r=e-1;r>=0;r--){let s=a.charCodeAt(r);if(s===pJi||s===xqo){let l=a.substring(r+1,e);e=r,s===pJi?t=l:o.push(l)}}return{type:a.substring(0,e),modifiers:o,language:t}}var kTt=kqo();ne.add(Cqo.TokenClassificationContribution,kTt);function kqo(){let a=new Cmi;function i(t,o,n=[],r,s){return a.registerTokenType(t,o,r,s),n&&e(t,n),t}function e(t,o){try{let n=a.parseTokenSelector(t);a.registerTokenStyleDefault(n,{scopesToProbe:o})}catch(n){console.log(n)}}return i("comment",d(2684,null),[["comment"]]),i("string",d(2718,null),[["string"]]),i("keyword",d(2694,null),[["keyword.control"]]),i("number",d(2701,null),[["constant.numeric"]]),i("regexp",d(2706,null),[["constant.regexp"]]),i("operator",d(2702,null),[["keyword.operator"]]),i("namespace",d(2700,null),[["entity.name.namespace"]]),i("type",d(2720,null),[["entity.name.type"],["support.type"]]),i("struct",d(2719,null),[["entity.name.type.struct"]]),i("class",d(2683,null),[["entity.name.type.class"],["support.class"]]),i("interface",d(2693,null),[["entity.name.type.interface"]]),i("enum",d(2689,null),[["entity.name.type.enum"]]),i("typeParameter",d(2721,null),[["entity.name.type.parameter"]]),i("function",d(2692,null),[["entity.name.function"],["support.function"]]),i("member",d(2697,null),[],"method","Deprecated use `method` instead"),i("method",d(2698,null),[["entity.name.function.member"],["support.function"]]),i("macro",d(2696,null),[["entity.name.function.preprocessor"]]),i("variable",d(2722,null),[["variable.other.readwrite"],["entity.name.variable"]]),i("parameter",d(2703,null),[["variable.parameter"]]),i("property",d(2704,null),[["variable.other.property"]]),i("enumMember",d(2690,null),[["variable.other.enummember"]]),i("event",d(2691,null),[["variable.other.event"]]),i("decorator",d(2686,null),[["entity.name.decorator"],["entity.name.function"]]),i("label",d(2695,null),void 0),a.registerTokenModifier("declaration",d(2685,null),void 0),a.registerTokenModifier("documentation",d(2688,null),void 0),a.registerTokenModifier("static",d(2717,null),void 0),a.registerTokenModifier("abstract",d(2681,null),void 0),a.registerTokenModifier("deprecated",d(2687,null),void 0),a.registerTokenModifier("modification",d(2699,null),void 0),a.registerTokenModifier("async",d(2682,null),void 0),a.registerTokenModifier("readonly",d(2705,null),void 0),e("variable.readonly",[["variable.other.constant"]]),e("property.readonly",[["variable.other.constant.property"]]),e("type.defaultLibrary",[["support.type"]]),e("class.defaultLibrary",[["support.class"]]),e("interface.defaultLibrary",[["support.class"]]),e("variable.defaultLibrary",[["support.variable"],["support.other.variable"]]),e("variable.defaultLibrary.readonly",[["support.constant"]]),e("property.defaultLibrary",[["support.variable.property"]]),e("property.defaultLibrary.readonly",[["support.constant.property"]]),e("function.defaultLibrary",[["support.function"]]),e("member.defaultLibrary",[["support.function"]]),a}function ETt(){return kTt}function wmi(a,i){return{description:a,deprecationMessage:i,defaultSnippets:[{body:"${1:#ff0000}"}],anyOf:[{type:"string",format:"color-hex"},{$ref:"#/definitions/style"}]}}var Xke="vscode://schemas/token-styling",fJi=ne.as(ma.JSONContribution);fJi.registerSchema(Xke,kTt.getTokenStylingSchema());var mJi=new Dt(()=>fJi.notifySchemaChanged(Xke),200);kTt.onDidChangeSchema(()=>{mJi.isScheduled()||mJi.schedule()});var xX=ETt(),Eqo=Rn.registerExtensionPoint({extensionPoint:"semanticTokenTypes",jsonSchema:{description:d(18194,null),type:"array",items:{type:"object",properties:{id:{type:"string",description:d(18195,null),pattern:W5,patternErrorMessage:d(18196,null)},superType:{type:"string",description:d(18197,null),pattern:W5,patternErrorMessage:d(18198,null)},description:{type:"string",description:d(18186,null)}}}}}),Tqo=Rn.registerExtensionPoint({extensionPoint:"semanticTokenModifiers",jsonSchema:{description:d(18187,null),type:"array",items:{type:"object",properties:{id:{type:"string",description:d(18189,null),pattern:W5,patternErrorMessage:d(18190,null)},description:{description:d(18188,null)}}}}}),_qo=Rn.registerExtensionPoint({extensionPoint:"semanticTokenScopes",jsonSchema:{description:d(18191,null),type:"array",items:{type:"object",properties:{language:{description:d(18192,null),type:"string"},scopes:{description:d(18193,null),type:"object",additionalProperties:{type:"array",items:{type:"string"}}}}}}}),TTt=class{constructor(){function i(e,t,o){if(typeof e.id!="string"||e.id.length===0)return o.error(d(18200,null,t)),!1;if(!e.id.match(W5))return o.error(d(18201,null,t)),!1;let n=e.superType;return n&&!n.match(W5)?(o.error(d(18209,null,t)),!1):typeof e.description!="string"||e.id.length===0?(o.error(d(18199,null,t)),!1):!0}Eqo.setHandler((e,t)=>{for(let o of t.added){let n=o.value,r=o.collector;if(!n||!Array.isArray(n)){r.error(d(18208,null));return}for(let s of n)i(s,"semanticTokenType",r)&&xX.registerTokenType(s.id,s.description,s.superType)}for(let o of t.removed){let n=o.value;for(let r of n)xX.deregisterTokenType(r.id)}}),Tqo.setHandler((e,t)=>{for(let o of t.added){let n=o.value,r=o.collector;if(!n||!Array.isArray(n)){r.error(d(18202,null));return}for(let s of n)i(s,"semanticTokenModifier",r)&&xX.registerTokenModifier(s.id,s.description)}for(let o of t.removed){let n=o.value;for(let r of n)xX.deregisterTokenModifier(r.id)}}),_qo.setHandler((e,t)=>{for(let o of t.added){let n=o.value,r=o.collector;if(!n||!Array.isArray(n)){r.error(d(18203,null));return}for(let s of n){if(s.language&&typeof s.language!="string"){r.error(d(18204,null));continue}if(!s.scopes||typeof s.scopes!="object"){r.error(d(18205,null));continue}for(let l in s.scopes){let c=s.scopes[l];if(!Array.isArray(c)||c.some(u=>typeof u!="string")){r.error(d(18207,null));continue}try{let u=xX.parseTokenSelector(l,s.language);xX.registerTokenStyleDefault(u,{scopesToProbe:c.map(p=>p.split(" "))})}catch{r.error(d(18206,null,l))}}}}for(let o of t.removed){let n=o.value;for(let r of n)for(let s in r.scopes){let l=r.scopes[s];try{let c=xX.parseTokenSelector(s,r.language);xX.registerTokenStyleDefault(c,{scopesToProbe:l.map(u=>u.split(" "))})}catch{}}}})}};var DTt;(i=>i.DEFAULT={allowTrailingComma:!0})(DTt||={});function yde(a,i=!1){let e=0,t=a.length,o="",n=0,r=16,s=0;function l(v){let b=0,S=0;for(;b<v;){let y=a.charCodeAt(e);if(y>=48&&y<=57)S=S*16+y-48;else if(y>=65&&y<=70)S=S*16+y-65+10;else if(y>=97&&y<=102)S=S*16+y-97+10;else break;e++,b++}return b<v&&(S=-1),S}function c(v){e=v,o="",n=0,r=16,s=0}function u(){let v=e;if(a.charCodeAt(e)===48)e++;else for(e++;e<a.length&&Jke(a.charCodeAt(e));)e++;if(e<a.length&&a.charCodeAt(e)===46)if(e++,e<a.length&&Jke(a.charCodeAt(e)))for(e++;e<a.length&&Jke(a.charCodeAt(e));)e++;else return s=3,a.substring(v,e);let b=e;if(e<a.length&&(a.charCodeAt(e)===69||a.charCodeAt(e)===101))if(e++,(e<a.length&&a.charCodeAt(e)===43||a.charCodeAt(e)===45)&&e++,e<a.length&&Jke(a.charCodeAt(e))){for(e++;e<a.length&&Jke(a.charCodeAt(e));)e++;b=e}else s=3;return a.substring(v,b)}function p(){let v="",b=e;for(;;){if(e>=t){v+=a.substring(b,e),s=2;break}let S=a.charCodeAt(e);if(S===34){v+=a.substring(b,e),e++;break}if(S===92){if(v+=a.substring(b,e),e++,e>=t){s=2;break}switch(a.charCodeAt(e++)){case 34:v+='"';break;case 92:v+="\\";break;case 47:v+="/";break;case 98:v+="\b";break;case 102:v+="\f";break;case 110:v+=`
`;break;case 114:v+="\r";break;case 116:v+="	";break;case 117:{let w=l(4);w>=0?v+=String.fromCharCode(w):s=4;break}default:s=5}b=e;continue}if(S>=0&&S<=31)if(_Tt(S)){v+=a.substring(b,e),s=2;break}else s=6;e++}return v}function h(){if(o="",s=0,n=e,e>=t)return n=t,r=17;let v=a.charCodeAt(e);if(xmi(v)){do e++,o+=String.fromCharCode(v),v=a.charCodeAt(e);while(xmi(v));return r=15}if(_Tt(v))return e++,o+=String.fromCharCode(v),v===13&&a.charCodeAt(e)===10&&(e++,o+=`
`),r=14;switch(v){case 123:return e++,r=1;case 125:return e++,r=2;case 91:return e++,r=3;case 93:return e++,r=4;case 58:return e++,r=6;case 44:return e++,r=5;case 34:return e++,o=p(),r=10;case 47:{let b=e-1;if(a.charCodeAt(e+1)===47){for(e+=2;e<t&&!_Tt(a.charCodeAt(e));)e++;return o=a.substring(b,e),r=12}if(a.charCodeAt(e+1)===42){e+=2;let S=t-1,y=!1;for(;e<S;){if(a.charCodeAt(e)===42&&a.charCodeAt(e+1)===47){e+=2,y=!0;break}e++}return y||(e++,s=1),o=a.substring(b,e),r=13}return o+=String.fromCharCode(v),e++,r=16}case 45:if(o+=String.fromCharCode(v),e++,e===t||!Jke(a.charCodeAt(e)))return r=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return o+=u(),r=11;default:for(;e<t&&g(v);)e++,v=a.charCodeAt(e);if(n!==e){switch(o=a.substring(n,e),o){case"true":return r=8;case"false":return r=9;case"null":return r=7}return r=16}return o+=String.fromCharCode(v),e++,r=16}}function g(v){if(xmi(v)||_Tt(v))return!1;switch(v){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function f(){let v;do v=h();while(v>=12&&v<=15);return v}return{setPosition:c,getPosition:()=>e,scan:i?f:h,getToken:()=>r,getTokenValue:()=>o,getTokenOffset:()=>n,getTokenLength:()=>e-n,getTokenError:()=>s}}function xmi(a){return a===32||a===9||a===11||a===12||a===160||a===5760||a>=8192&&a<=8203||a===8239||a===8287||a===12288||a===65279}function _Tt(a){return a===10||a===13||a===8232||a===8233}function Jke(a){return a>=48&&a<=57}function vJi(a,i){let e=[],t=new Object,o,n={value:{},offset:0,length:0,type:"object",parent:void 0},r=!1;function s(l,c,u,p){n.value=l,n.offset=c,n.length=u,n.type=p,n.colonOffset=void 0,o=n}try{uk(a,{onObjectBegin:(l,c)=>{if(i<=l)throw t;o=void 0,r=i>l,e.push("")},onObjectProperty:(l,c,u)=>{if(i<c||(s(l,c,u,"property"),e[e.length-1]=l,i<=c+u))throw t},onObjectEnd:(l,c)=>{if(i<=l)throw t;o=void 0,e.pop()},onArrayBegin:(l,c)=>{if(i<=l)throw t;o=void 0,e.push(0)},onArrayEnd:(l,c)=>{if(i<=l)throw t;o=void 0,e.pop()},onLiteralValue:(l,c,u)=>{if(i<c||(s(l,c,u,pk(l)),i<=c+u))throw t},onSeparator:(l,c,u)=>{if(i<=c)throw t;if(l===":"&&o&&o.type==="property")o.colonOffset=c,r=!1,o=void 0;else if(l===","){let p=e[e.length-1];typeof p=="number"?e[e.length-1]=p+1:(r=!0,e[e.length-1]=""),o=void 0}}})}catch(l){if(l!==t)throw l}return{path:e,previousNode:o,isAtPropertyKey:r,matches:l=>{let c=0;for(let u=0;c<l.length&&u<e.length;u++)if(l[c]===e[u]||l[c]==="*")c++;else if(l[c]!=="**")return!1;return c===l.length}}}function jr(a,i=[],e=DTt.DEFAULT){let t=null,o=[],n=[];function r(l){Array.isArray(o)?o.push(l):t!==null&&(o[t]=l)}return uk(a,{onObjectBegin:()=>{let l={};r(l),n.push(o),o=l,t=null},onObjectProperty:l=>{t=l},onObjectEnd:()=>{o=n.pop()},onArrayBegin:()=>{let l=[];r(l),n.push(o),o=l,t=null},onArrayEnd:()=>{o=n.pop()},onLiteralValue:r,onError:(l,c,u)=>{i.push({error:l,offset:c,length:u})}},e),o[0]}function _R(a,i=[],e=DTt.DEFAULT){let t={type:"array",offset:-1,length:-1,children:[],parent:void 0};function o(l){t.type==="property"&&(t.length=l-t.offset,t=t.parent)}function n(l){return t.children.push(l),l}uk(a,{onObjectBegin:l=>{t=n({type:"object",offset:l,length:-1,parent:t,children:[]})},onObjectProperty:(l,c,u)=>{t=n({type:"property",offset:c,length:-1,parent:t,children:[]}),t.children.push({type:"string",value:l,offset:c,length:u,parent:t})},onObjectEnd:(l,c)=>{t.length=l+c-t.offset,t=t.parent,o(l+c)},onArrayBegin:(l,c)=>{t=n({type:"array",offset:l,length:-1,parent:t,children:[]})},onArrayEnd:(l,c)=>{t.length=l+c-t.offset,t=t.parent,o(l+c)},onLiteralValue:(l,c,u)=>{n({type:pk(l),offset:c,length:u,parent:t,value:l}),o(c+u)},onSeparator:(l,c,u)=>{t.type==="property"&&(l===":"?t.colonOffset=c:l===","&&o(c))},onError:(l,c,u)=>{i.push({error:l,offset:c,length:u})}},e);let s=t.children[0];return s&&delete s.parent,s}function OC(a,i){if(!a)return;let e=a;for(let t of i)if(typeof t=="string"){if(e.type!=="object"||!Array.isArray(e.children))return;let o=!1;for(let n of e.children)if(Array.isArray(n.children)&&n.children[0].value===t){e=n.children[1],o=!0;break}if(!o)return}else{let o=t;if(e.type!=="array"||o<0||!Array.isArray(e.children)||o>=e.children.length)return;e=e.children[o]}return e}function kmi(a){if(!a.parent||!a.parent.children)return[];let i=kmi(a.parent);if(a.parent.type==="property"){let e=a.parent.children[0].value;i.push(e)}else if(a.parent.type==="array"){let e=a.parent.children.indexOf(a);e!==-1&&i.push(e)}return i}function Dqo(a,i,e=!1){return i>=a.offset&&i<a.offset+a.length||e&&i===a.offset+a.length}function Emi(a,i,e=!1){if(Dqo(a,i,e)){let t=a.children;if(Array.isArray(t))for(let o=0;o<t.length&&t[o].offset<=i;o++){let n=Emi(t[o],i,e);if(n)return n}return a}}function uk(a,i,e=DTt.DEFAULT){let t=yde(a,!1);function o(H){return H?()=>H(t.getTokenOffset(),t.getTokenLength()):()=>!0}function n(H){return H?G=>H(G,t.getTokenOffset(),t.getTokenLength()):()=>!0}let r=o(i.onObjectBegin),s=n(i.onObjectProperty),l=o(i.onObjectEnd),c=o(i.onArrayBegin),u=o(i.onArrayEnd),p=n(i.onLiteralValue),h=n(i.onSeparator),g=o(i.onComment),f=n(i.onError),v=e&&e.disallowComments,b=e&&e.allowTrailingComma;function S(){for(;;){let H=t.scan();switch(t.getTokenError()){case 4:y(14);break;case 5:y(15);break;case 3:y(13);break;case 1:v||y(11);break;case 2:y(12);break;case 6:y(16);break}switch(H){case 12:case 13:v?y(10):g();break;case 16:y(1);break;case 15:case 14:break;default:return H}}}function y(H,G=[],$=[]){if(f(H),G.length+$.length>0){let J=t.getToken();for(;J!==17;){if(G.indexOf(J)!==-1){S();break}else if($.indexOf(J)!==-1)break;J=S()}}}function w(H){let G=t.getTokenValue();return H?p(G):s(G),S(),!0}function k(){switch(t.getToken()){case 11:{let H=0;try{H=JSON.parse(t.getTokenValue()),typeof H!="number"&&(y(2),H=0)}catch{y(2)}p(H);break}case 7:p(null);break;case 8:p(!0);break;case 9:p(!1);break;default:return!1}return S(),!0}function T(){return t.getToken()!==10?(y(3,[],[2,5]),!1):(w(!1),t.getToken()===6?(h(":"),S(),V()||y(4,[],[2,5])):y(5,[],[2,5]),!0)}function P(){r(),S();let H=!1;for(;t.getToken()!==2&&t.getToken()!==17;){if(t.getToken()===5){if(H||y(4,[],[]),h(","),S(),t.getToken()===2&&b)break}else H&&y(6,[],[]);T()||y(4,[],[2,5]),H=!0}return l(),t.getToken()!==2?y(7,[2],[]):S(),!0}function O(){c(),S();let H=!1;for(;t.getToken()!==4&&t.getToken()!==17;){if(t.getToken()===5){if(H||y(4,[],[]),h(","),S(),t.getToken()===4&&b)break}else H&&y(6,[],[]);V()||y(4,[],[4,5]),H=!0}return u(),t.getToken()!==4?y(8,[4],[]):S(),!0}function V(){switch(t.getToken()){case 3:return O();case 1:return P();case 10:return w(!0);default:return k()}}return S(),t.getToken()===17?e.allowEmptyContent?!0:(y(4,[],[]),!1):V()?(t.getToken()!==17&&y(9,[],[]),!0):(y(4,[],[]),!1)}function pk(a){switch(typeof a){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(a){if(Array.isArray(a))return"array"}else return"null";return"object"}default:return"null"}}function Lqo(a){if(om===2&&/^penguin(\.|$)/i.test(a))return"chromebook"}function bJi(a,i,e,t,o,n,r,s,l,c,u){let p=Object.create(null);p["common.machineId"]=n,p["common.sqmId"]=r,p["common.devDeviceId"]=s,p.sessionID=xt()+Date.now(),p.commitHash=t,p.version=o,p["common.releaseDate"]=c,p["common.platformVersion"]=(a||"").replace(/^(\d+)(\.\d+)?(\.\d+)?(.*)/,"$1$2$3"),p["common.platform"]=u_(om),p["common.nodePlatform"]=jN,p["common.nodeArch"]=e,p["common.product"]=u||"desktop",l&&(p["common.msftInternal"]=l);let h=0,g=Date.now();Object.defineProperties(p,{timestamp:{get:()=>new Date,enumerable:!0},"common.timesincesessionstart":{get:()=>Date.now()-g,enumerable:!0},"common.sequence":{get:()=>h++,enumerable:!0}}),zSe&&(p["common.snap"]="true");let f=Lqo(i);return f&&(p["common.platformDetail"]=f),p}function SJi(a){let i=$u.USERDNSDOMAIN;if(!i)return!1;let e=i.toLowerCase();return a.some(t=>e===t)}var sg=class{constructor(i){this.value=i;this.isTrustedTelemetryValue=!0}},Tmi=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(){}},IJi=new Tmi;var wde="telemetry",LTt={id:wde,name:d(2372,null)};function DR(a,i){return!i.isBuilt&&!i.disableTelemetry?!0:!(i.disableTelemetry||!a.enableTelemetry)}function Zke(a,i){return i.extensionTestsLocationURI?!0:!(i.isBuilt||i.disableTelemetry||a.enableTelemetry&&a.aiConfig?.ariaKey)}function JE(a){let i=a.getValue(uO),e=a.getValue(Ugt);if(a.getValue(bae)===!1||e===!1)return 0;switch(i??"all"){case"all":return 3;case"error":return 2;case"crash":return 1;case"off":return 0}}function RTt(a,i){if(!a)return"none";let e=gb(a),t=i?.remoteExtensionTips;if(t&&Object.prototype.hasOwnProperty.call(t,e))return e;let o=i?.virtualWorkspaceExtensionTips;return o&&Object.prototype.hasOwnProperty.call(o,e)?e:"other"}function yJi(a,i){let e=a.msftInternalDomains||[],t=i.getValue("telemetry.internalTesting");return SJi(e)||t}function wJi(a){return[a.appRoot,a.extensionsPath,a.userHome.fsPath,a.tmpDir.fsPath,a.userDataPath]}function Mqo(a,i){if(!a||!a.includes("/")&&!a.includes("\\"))return a;let e=a,t=[];for(let l of i)for(;;){let c=l.exec(a);if(!c)break;t.push([c.index,l.lastIndex])}let o=/(?:^|[\\\/])((node_modules|node_modules\.asar)[\\\/].*)$/,n=/^(.*?)((?:\.vscode(?:-[a-z]+)*|resources[\\\/]app)[\\\/]extensions[\\\/].*)$/i,r=/(file:\/\/)?([a-zA-Z]:(\\\\|\\|\/)|(\\\\|\\|\/))?([\w\-\._@]+(\\\\|\\|\/))+[\w\-\._@]*/g,s=0;for(e="";;){let l=r.exec(a);if(!l)break;if(!t.some(([u,p])=>l.index<p&&u<r.lastIndex)){let u=n.exec(l[0]);if(u)e+=a.substring(s,l.index)+"<REDACTED: user-file-path>/"+u[2];else{let p=o.exec(l[0]);p?e+=a.substring(s,l.index)+"<REDACTED: user-file-path>/"+p[1]:e+=a.substring(s,l.index)+"<REDACTED: user-file-path>"}s=r.lastIndex}}return s<a.length&&(e+=a.substr(s)),e}function Pqo(a){if(!a)return a;let i=[{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 i)if(e.regex.test(a))return`<REDACTED: ${e.label}>`;return a}function CJi(a,i){return a?Fx(a,e=>{if(e instanceof sg||Object.hasOwnProperty.call(e,"isTrustedTelemetryValue"))return e.value;if(typeof e=="string"){let t=e.replaceAll("%20"," ");t=Mqo(t,i);for(let o of i)t=t.replace(o,"");return t=Pqo(t),t}}):{}}function Ut(a,i){return a.uuid&&i.uuid?a.uuid===i.uuid:a.id===i.id?!0:OI(a.id,i.id)===0}var Aqo=/^([^.]+\..+)-(\d+\.\d+\.\d+)(-(.+))?$/,MTt=class a{constructor(i,e,t="undefined"){this.identifier=i;this.version=e;this.targetPlatform=t;this.id=i.id}static create(i){let e=i.manifest?i.manifest.version:i.version,t=i.manifest?i.targetPlatform:i.properties.targetPlatform;return new a(i.identifier,e,t)}static parse(i){let e=Aqo.exec(i);return e&&e[1]&&e[2]?new a({id:e[1]},e[2],e[4]||void 0):null}toString(){return`${this.id}-${this.version}${this.targetPlatform!=="undefined"?`-${this.targetPlatform}`:""}`}equals(i){return i instanceof a?Ut(this,i)&&this.version===i.version&&this.targetPlatform===i.targetPlatform:!1}},Nqo=/^([^.]+\..+)@((prerelease)|(\d+\.\d+\.\d+(-.*)?))$/;function kQe(a){let i=Nqo.exec(a);return i&&i[1]?[Cde(i[1]),i[2]]:[Cde(a),void 0]}function gS(a,i){return`${a}.${i}`}function Cde(a){return a.toLowerCase()}function Qf(a,i){return Cde(gS(a??Xxt,i))}function _mi(a,i){let e=[],t=o=>{for(let n of e)if(n.some(r=>Ut(i(r),i(o))))return n;return null};for(let o of a){let n=t(o);n?n.push(o):e.push([o])}return e}function PTt(a){return{id:a.identifier.id,name:a.manifest.name,galleryId:null,publisherId:a.publisherId,publisherName:a.manifest.publisher,publisherDisplayName:a.publisherDisplayName,dependencies:a.manifest.extensionDependencies&&a.manifest.extensionDependencies.length>0}}function xde(a){return{id:new sg(a.identifier.id),name:new sg(a.name),extensionVersion:a.version,galleryId:a.identifier.uuid,publisherId:a.publisherId,publisherName:a.publisher,publisherDisplayName:a.publisherDisplayName,isPreReleaseVersion:a.properties.isPreReleaseVersion,dependencies:!!(a.properties.dependencies&&a.properties.dependencies.length>0),isSigned:a.isSigned,...a.telemetryData}}var xJi=new Ii("pprice.better-merge");function kde(a,i){let e=[],t=i.manifest.extensionDependencies?.slice(0)??[];for(;t.length;){let o=t.shift();if(o&&e.every(n=>!Ut(n.identifier,{id:o}))){let n=a.filter(r=>Ut(r.identifier,{id:o}));n.length===1&&(e.push(n[0]),t.push(...n[0].manifest.extensionDependencies?.slice(0)??[]))}}return e}async function Oqo(a,i){if(!fn)return!1;let e;try{e=(await a.readFile(A.file("/etc/os-release"))).value.toString()}catch{try{e=(await a.readFile(A.file("/usr/lib/os-release"))).value.toString()}catch(o){i.debug("Error while getting the os-release file.",Pn(o))}}return!!e&&(e.match(/^ID=([^\u001b\r\n]*)/m)||[])[1]==="alpine"}async function ATt(a,i){let e=await Oqo(a,i),t=fTt(e?"alpine":om,QSe);return i.debug("ComputeTargetPlatform:",t),t}function NTt(a,i){return Dmi(a,i)!==void 0}function Dmi(a,i){return i.find(({extensionOrPublisher:e})=>Fe(e)?OI(a.id.split(".")[0],e)===0:Ut(a,e))}var WTt=Object.freeze({identifier:new Ii("nullExtensionDescription"),name:"Null Extension Description",version:"0.0.0",publisher:"vscode",engines:{vscode:""},extensionLocation:A.parse("void:location"),isBuiltin:!1,targetPlatform:"undefined",isUserBuiltin:!1,isUnderDevelopment:!1,preRelease:!1}),VTt="extensions.webWorker",lt=le("extensionService");var Ede=class{get versionId(){return this._versionId}get allExtensions(){return this._allExtensions}get myExtensions(){return this._myExtensions}constructor(i,e,t){this._versionId=i,this._allExtensions=e.slice(0),this._myExtensions=t.slice(0),this._myActivationEvents=null}toSnapshot(){return{versionId:this._versionId,allExtensions:this._allExtensions,myExtensions:this._myExtensions,activationEvents:F5.createActivationEventsMap(this._allExtensions)}}set(i,e,t){if(this._versionId>i)throw new Error(`ExtensionHostExtensions: invalid versionId ${i} (current: ${this._versionId})`);let o=[],n=[],r=[],s=[],l=kJi(this._allExtensions),c=kJi(e),u=(v,b)=>v.extensionLocation.toString()===b.extensionLocation.toString()||v.isBuiltin===b.isBuiltin||v.isUserBuiltin===b.isUserBuiltin||v.isUnderDevelopment===b.isUnderDevelopment;for(let v of this._allExtensions){let b=c.get(v.identifier);if(!b){o.push(v.identifier),l.delete(v.identifier);continue}if(!u(v,b)){o.push(v.identifier),l.delete(v.identifier);continue}}for(let v of e){let b=l.get(v.identifier);if(!b){n.push(v);continue}if(!u(b,v)){o.push(b.identifier),l.delete(b.identifier);continue}}let p=new ly(this._myExtensions),h=new ly(t);for(let v of this._myExtensions)h.has(v)||r.push(v);for(let v of t)p.has(v)||s.push(v);let g=F5.createActivationEventsMap(n),f={versionId:i,toRemove:o,toAdd:n,addActivationEvents:g,myToRemove:r,myToAdd:s};return this.delta(f),f}delta(i){if(this._versionId>=i.versionId)return null;let{toRemove:e,toAdd:t,myToRemove:o,myToAdd:n}=i,r=new ly(e),s=new ly(o);for(let l=0;l<this._allExtensions.length;l++)r.has(this._allExtensions[l].identifier)&&(this._allExtensions.splice(l,1),l--);for(let l=0;l<this._myExtensions.length;l++)s.has(this._myExtensions[l])&&(this._myExtensions.splice(l,1),l--);for(let l of t)this._allExtensions.push(l);for(let l of n)this._myExtensions.push(l);return this._myActivationEvents=null,i}containsExtension(i){for(let e of this._myExtensions)if(Ii.equals(e,i))return!0;return!1}containsActivationEvent(i){return this._myActivationEvents||(this._myActivationEvents=this._readMyActivationEvents()),this._myActivationEvents.has(i)}_readMyActivationEvents(){let i=new Set;for(let e of this._allExtensions){if(!this.containsExtension(e.identifier))continue;let t=F5.readActivationEvents(e);for(let o of t)i.add(o)}return i}};function kJi(a){let i=new iu;for(let e of a)i.set(e.identifier,e);return i}function Ua(a,i){return!!a.enabledApiProposals}function EQe(a,i){if(!Ua(a,i))throw new Error(`Extension '${a.identifier.value}' CANNOT use API proposal: ${i}.
Its package.json#enabledApiProposals-property declares: ${a.enabledApiProposals?.join(", ")??"[]"} but NOT ${i}.
 The missing proposal MUST be added and you must start in extension development mode or use the following command line switch: --enable-proposed-api ${a.identifier.value}`)}var OTt=class{constructor(i,e,t,o){this.codeLoadingTime=i;this.activateCallTime=e;this.activateResolvedTime=t;this.activationReason=o}},FTt=class{constructor(i,e){this.description=i,this.value=e}};function ZE(a){return{type:a.isBuiltin?0:1,isBuiltin:a.isBuiltin||a.isUserBuiltin,identifier:{id:Qf(a.publisher,a.name),uuid:a.uuid},manifest:a,location:a.extensionLocation,targetPlatform:a.targetPlatform,validations:[],isValid:!0,preRelease:a.preRelease,publisherDisplayName:a.publisherDisplayName}}function bF(a,i){let e=gS(a.manifest.publisher,a.manifest.name);return{id:e,identifier:new Ii(e),isBuiltin:a.type===0,isUserBuiltin:a.type===1&&a.isBuiltin,isUnderDevelopment:!!i,extensionLocation:a.location,uuid:a.identifier.uuid,targetPlatform:a.targetPlatform,publisherDisplayName:a.publisherDisplayName,preRelease:a.preRelease,...a.manifest}}function SF(a){switch(a){case 1:return d(123,null);case 2:return d(122,null);case 3:return d(124,null);case 4:return d(125,null);case 5:return d(119,null);case 6:return d(120,null);case 7:return d(117,null);case 8:return d(118,null);case 9:return d(121,null);default:return""}}async function IF(a,i,e){let t=e&&e.get("storage.serviceMachineId",-1)||null;if(t)return t;try{let n=(await i.readFile(a.serviceMachineIdResource)).value.toString();t=bbt(n)?n:null}catch{t=null}if(!t){t=xt();try{await i.writeFile(a.serviceMachineIdResource,qe.fromString(t))}catch{}}return e?.store("storage.serviceMachineId",t,-1,1),t}var Dv=le("IExtensionGalleryManifestService");function YP(a,i){let[e,t]=i.split("/");for(let o of a.resources){let[n,r]=o.type.split("/");if(n===e){if(!t||r===t)return o.id;break}}}var TQe="extensions.gallery.serviceUrl";var Fqo="/web-extension-resource/",mk=le("extensionResourceLoaderService");var BTt=class extends x{constructor(e,t,o,n,r,s,l){super();this._fileService=e;this._storageService=t;this._productService=o;this._environmentService=n;this._configurationService=r;this._extensionGalleryManifestService=s;this._logService=l;this._initPromise=this._init()}async _init(){try{let e=await this._extensionGalleryManifestService.getExtensionGalleryManifest();this.resolve(e),this._register(this._extensionGalleryManifestService.onDidChangeExtensionGalleryManifest(()=>this.resolve(e)))}catch(e){this._logService.error(e)}}resolve(e){this._extensionGalleryResourceUrlTemplate=e?YP(e,"ExtensionResourceUriTemplate"):void 0,this._extensionGalleryAuthority=this._extensionGalleryResourceUrlTemplate?this._getExtensionGalleryAuthority(A.parse(this._extensionGalleryResourceUrlTemplate)):void 0}async supportsExtensionGalleryResources(){return await this._initPromise,this._extensionGalleryResourceUrlTemplate!==void 0}async getExtensionGalleryResourceURL({publisher:e,name:t,version:o,targetPlatform:n},r){if(await this._initPromise,this._extensionGalleryResourceUrlTemplate){let s=A.parse(m_(this._extensionGalleryResourceUrlTemplate,{publisher:e,name:t,version:n!==void 0&&n!=="undefined"&&n!=="unknown"&&n!=="universal"?`${o}+${n}`:o,path:"extension"}));return this._isWebExtensionResourceEndPoint(s)?s.with({scheme:RL.getPreferredWebSchema()}):s}}async isExtensionGalleryResource(e){return await this._initPromise,!!this._extensionGalleryAuthority&&this._extensionGalleryAuthority===this._getExtensionGalleryAuthority(e)}async getExtensionGalleryRequestHeaders(){let e={"X-Client-Name":`${this._productService.applicationName}${Wt?"-web":""}`,"X-Client-Version":this._productService.version};return DR(this._productService,this._environmentService)&&JE(this._configurationService)===3&&(e["X-Machine-Id"]=await this._getServiceMachineId()),this._productService.commit&&(e["X-Client-Commit"]=this._productService.commit),e}_getServiceMachineId(){return this._serviceMachineIdPromise||(this._serviceMachineIdPromise=IF(this._environmentService,this._fileService,this._storageService)),this._serviceMachineIdPromise}_getExtensionGalleryAuthority(e){if(this._isWebExtensionResourceEndPoint(e))return e.authority;let t=e.authority.indexOf(".");return t!==-1?e.authority.substring(t+1):void 0}_isWebExtensionResourceEndPoint(e){let t=e.path,o=RL.getServerRootPath();return t.startsWith(o)&&t.startsWith(Fqo,o.length)}};function EJi(a){if(!Array.isArray(a))return!1;for(let i=0,e=a.length;i<e;i++)if(typeof a[i]!="string")return!1;return!0}function _Qe(a){return EJi(a)&&a.length===2}var kX=class extends x{constructor(e,t,o,n){super();this._languageService=e;this._extensionResourceLoaderService=t;this._extensionService=o;this._languageConfigurationService=n;this._done=new Map;this._register(this._languageService.onDidRequestBasicLanguageFeatures(async r=>{this._extensionService.whenInstalledExtensionsRegistered().then(()=>{this._loadConfigurationsForMode(r)})})),this._register(this._languageService.onDidChange(()=>{for(let[r]of this._done)this._loadConfigurationsForMode(r)}))}async _loadConfigurationsForMode(e){let t=this._languageService.getConfigurationFiles(e),o=_r(t.map(r=>r.toString()));if(this._done.get(e)===o)return;this._done.set(e,o);let n=await Promise.all(t.map(r=>this._readConfigFile(r)));for(let r of n)this._handleConfig(e,r)}async _readConfigFile(e){try{let t=await this._extensionResourceLoaderService.readExtensionResource(e),o=[],n=jr(t,o);return o.length&&console.error(d(8985,null,e.toString(),o.map(r=>`[${r.offset}, ${r.length}] ${SF(r.error)}`).join(`
`))),pk(n)!=="object"&&(console.error(d(8984,null,e.toString())),n={}),n}catch(t){return console.error(t),{}}}static _extractValidCommentRule(e,t){let o=t.comments;if(typeof o>"u")return;if(!xi(o)){console.warn(`[${e}]: language configuration: expected \`comments\` to be an object.`);return}let n;if(typeof o.lineComment<"u")if(typeof o.lineComment=="string")n=n||{},n.lineComment=o.lineComment;else if(xi(o.lineComment)){let r=o.lineComment;typeof r.comment=="string"?(n=n||{},n.lineComment={comment:r.comment,noIndent:r.noIndent}):console.warn(`[${e}]: language configuration: expected \`comments.lineComment.comment\` to be a string.`)}else console.warn(`[${e}]: language configuration: expected \`comments.lineComment\` to be a string or an object with comment property.`);return typeof o.blockComment<"u"&&(_Qe(o.blockComment)?(n=n||{},n.blockComment=o.blockComment):console.warn(`[${e}]: language configuration: expected \`comments.blockComment\` to be an array of two strings.`)),n}static _extractValidBrackets(e,t){let o=t.brackets;if(typeof o>"u")return;if(!Array.isArray(o)){console.warn(`[${e}]: language configuration: expected \`brackets\` to be an array.`);return}let n;for(let r=0,s=o.length;r<s;r++){let l=o[r];if(!_Qe(l)){console.warn(`[${e}]: language configuration: expected \`brackets[${r}]\` to be an array of two strings.`);continue}n=n||[],n.push(l)}return n}static _extractValidAutoClosingPairs(e,t){let o=t.autoClosingPairs;if(typeof o>"u")return;if(!Array.isArray(o)){console.warn(`[${e}]: language configuration: expected \`autoClosingPairs\` to be an array.`);return}let n;for(let r=0,s=o.length;r<s;r++){let l=o[r];if(Array.isArray(l)){if(!_Qe(l)){console.warn(`[${e}]: language configuration: expected \`autoClosingPairs[${r}]\` to be an array of two strings or an object.`);continue}n=n||[],n.push({open:l[0],close:l[1]})}else{if(!xi(l)){console.warn(`[${e}]: language configuration: expected \`autoClosingPairs[${r}]\` to be an array of two strings or an object.`);continue}if(typeof l.open!="string"){console.warn(`[${e}]: language configuration: expected \`autoClosingPairs[${r}].open\` to be a string.`);continue}if(typeof l.close!="string"){console.warn(`[${e}]: language configuration: expected \`autoClosingPairs[${r}].close\` to be a string.`);continue}if(typeof l.notIn<"u"&&!EJi(l.notIn)){console.warn(`[${e}]: language configuration: expected \`autoClosingPairs[${r}].notIn\` to be a string array.`);continue}n=n||[],n.push({open:l.open,close:l.close,notIn:l.notIn})}}return n}static _extractValidSurroundingPairs(e,t){let o=t.surroundingPairs;if(typeof o>"u")return;if(!Array.isArray(o)){console.warn(`[${e}]: language configuration: expected \`surroundingPairs\` to be an array.`);return}let n;for(let r=0,s=o.length;r<s;r++){let l=o[r];if(Array.isArray(l)){if(!_Qe(l)){console.warn(`[${e}]: language configuration: expected \`surroundingPairs[${r}]\` to be an array of two strings or an object.`);continue}n=n||[],n.push({open:l[0],close:l[1]})}else{if(!xi(l)){console.warn(`[${e}]: language configuration: expected \`surroundingPairs[${r}]\` to be an array of two strings or an object.`);continue}if(typeof l.open!="string"){console.warn(`[${e}]: language configuration: expected \`surroundingPairs[${r}].open\` to be a string.`);continue}if(typeof l.close!="string"){console.warn(`[${e}]: language configuration: expected \`surroundingPairs[${r}].close\` to be a string.`);continue}n=n||[],n.push({open:l.open,close:l.close})}}return n}static _extractValidColorizedBracketPairs(e,t){let o=t.colorizedBracketPairs;if(typeof o>"u")return;if(!Array.isArray(o)){console.warn(`[${e}]: language configuration: expected \`colorizedBracketPairs\` to be an array.`);return}let n=[];for(let r=0,s=o.length;r<s;r++){let l=o[r];if(!_Qe(l)){console.warn(`[${e}]: language configuration: expected \`colorizedBracketPairs[${r}]\` to be an array of two strings.`);continue}n.push([l[0],l[1]])}return n}static _extractValidOnEnterRules(e,t){let o=t.onEnterRules;if(typeof o>"u")return;if(!Array.isArray(o)){console.warn(`[${e}]: language configuration: expected \`onEnterRules\` to be an array.`);return}let n;for(let r=0,s=o.length;r<s;r++){let l=o[r];if(!xi(l)){console.warn(`[${e}]: language configuration: expected \`onEnterRules[${r}]\` to be an object.`);continue}if(!xi(l.action)){console.warn(`[${e}]: language configuration: expected \`onEnterRules[${r}].action\` to be an object.`);continue}let c;if(l.action.indent==="none")c=0;else if(l.action.indent==="indent")c=1;else if(l.action.indent==="indentOutdent")c=2;else if(l.action.indent==="outdent")c=3;else{console.warn(`[${e}]: language configuration: expected \`onEnterRules[${r}].action.indent\` to be 'none', 'indent', 'indentOutdent' or 'outdent'.`);continue}let u={indentAction:c};l.action.appendText&&(typeof l.action.appendText=="string"?u.appendText=l.action.appendText:console.warn(`[${e}]: language configuration: expected \`onEnterRules[${r}].action.appendText\` to be undefined or a string.`)),l.action.removeText&&(typeof l.action.removeText=="number"?u.removeText=l.action.removeText:console.warn(`[${e}]: language configuration: expected \`onEnterRules[${r}].action.removeText\` to be undefined or a number.`));let p=this._parseRegex(e,`onEnterRules[${r}].beforeText`,l.beforeText);if(!p)continue;let h={beforeText:p,action:u};if(l.afterText){let g=this._parseRegex(e,`onEnterRules[${r}].afterText`,l.afterText);g&&(h.afterText=g)}if(l.previousLineText){let g=this._parseRegex(e,`onEnterRules[${r}].previousLineText`,l.previousLineText);g&&(h.previousLineText=g)}n=n||[],n.push(h)}return n}static extractValidConfig(e,t){let o=this._extractValidCommentRule(e,t),n=this._extractValidBrackets(e,t),r=this._extractValidAutoClosingPairs(e,t),s=this._extractValidSurroundingPairs(e,t),l=this._extractValidColorizedBracketPairs(e,t),c=typeof t.autoCloseBefore=="string"?t.autoCloseBefore:void 0,u=t.wordPattern?this._parseRegex(e,"wordPattern",t.wordPattern):void 0,p=t.indentationRules?this._mapIndentationRules(e,t.indentationRules):void 0,h;if(t.folding){let v=t.folding.markers,b=v&&v.start?this._parseRegex(e,"folding.markers.start",v.start):void 0,S=v&&v.end?this._parseRegex(e,"folding.markers.end",v.end):void 0,y=b&&S?{start:b,end:S}:void 0;h={offSide:t.folding.offSide,markers:y}}let g=this._extractValidOnEnterRules(e,t);return{comments:o,brackets:n,wordPattern:u,indentationRules:p,onEnterRules:g,autoClosingPairs:r,surroundingPairs:s,colorizedBracketPairs:l,autoCloseBefore:c,folding:h,__electricCharacterSupport:void 0}}_handleConfig(e,t){let o=kX.extractValidConfig(e,t);this._languageConfigurationService.register(e,o,50)}static _parseRegex(e,t,o){if(typeof o=="string")try{return new RegExp(o,"")}catch(n){console.warn(`[${e}]: Invalid regular expression in \`${t}\`: `,n);return}if(xi(o)){if(typeof o.pattern!="string"){console.warn(`[${e}]: language configuration: expected \`${t}.pattern\` to be a string.`);return}if(typeof o.flags<"u"&&typeof o.flags!="string"){console.warn(`[${e}]: language configuration: expected \`${t}.flags\` to be a string.`);return}try{return new RegExp(o.pattern,o.flags)}catch(n){console.warn(`[${e}]: Invalid regular expression in \`${t}\`: `,n);return}}console.warn(`[${e}]: language configuration: expected \`${t}\` to be a string or an object.`)}static _mapIndentationRules(e,t){let o=this._parseRegex(e,"indentationRules.increaseIndentPattern",t.increaseIndentPattern);if(!o)return;let n=this._parseRegex(e,"indentationRules.decreaseIndentPattern",t.decreaseIndentPattern);if(!n)return;let r={increaseIndentPattern:o,decreaseIndentPattern:n};return t.indentNextLinePattern&&(r.indentNextLinePattern=this._parseRegex(e,"indentationRules.indentNextLinePattern",t.indentNextLinePattern)),t.unIndentedLinePattern&&(r.unIndentedLinePattern=this._parseRegex(e,"indentationRules.unIndentedLinePattern",t.unIndentedLinePattern)),r}};kX=I([m(0,_t),m(1,mk),m(2,lt),m(3,Rs)],kX);var Wqo="vscode://schemas/language-configuration",Vqo={allowComments:!0,allowTrailingCommas:!0,default:{comments:{blockComment:["/*","*/"],lineComment:"//"},brackets:[["(",")"],["[","]"],["{","}"]],autoClosingPairs:[["(",")"],["[","]"],["{","}"]],surroundingPairs:[["(",")"],["[","]"],["{","}"]]},definitions:{openBracket:{type:"string",description:d(9042,null)},closeBracket:{type:"string",description:d(8993,null)},bracketPair:{type:"array",items:[{$ref:"#/definitions/openBracket"},{$ref:"#/definitions/closeBracket"}]}},properties:{comments:{default:{blockComment:["/*","*/"],lineComment:{comment:"//",noIndent:!1}},description:d(8995,null),type:"object",properties:{blockComment:{type:"array",description:d(8991,null),items:[{type:"string",description:d(8989,null)},{type:"string",description:d(8990,null)}]},lineComment:{type:"object",description:d(9020,null),properties:{comment:{type:"string",description:d(9018,null)},noIndent:{type:"boolean",description:d(9019,null),default:!1}},required:["comment"],additionalProperties:!1}}},brackets:{default:[["(",")"],["[","]"],["{","}"]],markdownDescription:d(8992,null,"`colorizedBracketPairs`"),type:"array",items:{$ref:"#/definitions/bracketPair"}},colorizedBracketPairs:{default:[["(",")"],["[","]"],["{","}"]],markdownDescription:d(8994,null,"`brackets`"),type:"array",items:{$ref:"#/definitions/bracketPair"}},autoClosingPairs:{default:[["(",")"],["[","]"],["{","}"]],description:d(8987,null),type:"array",items:{oneOf:[{$ref:"#/definitions/bracketPair"},{type:"object",properties:{open:{$ref:"#/definitions/openBracket"},close:{$ref:"#/definitions/closeBracket"},notIn:{type:"array",description:d(8988,null),items:{enum:["string","comment"]}}}}]}},autoCloseBefore:{default:`;:.,=}])> 
	`,description:d(8986,null),type:"string"},surroundingPairs:{default:[["(",")"],["[","]"],["{","}"]],description:d(9043,null),type:"array",items:{oneOf:[{$ref:"#/definitions/bracketPair"},{type:"object",properties:{open:{$ref:"#/definitions/openBracket"},close:{$ref:"#/definitions/closeBracket"}}}]}},wordPattern:{default:"",description:d(9044,null),type:["string","object"],properties:{pattern:{type:"string",description:d(9047,null),default:""},flags:{type:"string",description:d(9045,null),default:"g",pattern:"^([gimuy]+)$",patternErrorMessage:d(9046,null)}}},indentationRules:{default:{increaseIndentPattern:"",decreaseIndentPattern:""},description:d(9001,null),type:"object",properties:{increaseIndentPattern:{type:["string","object"],description:d(9006,null),properties:{pattern:{type:"string",description:d(9009,null),default:""},flags:{type:"string",description:d(9008,null),default:"",pattern:"^([gimuy]+)$",patternErrorMessage:d(9007,null)}}},decreaseIndentPattern:{type:["string","object"],description:d(9002,null),properties:{pattern:{type:"string",description:d(9005,null),default:""},flags:{type:"string",description:d(9004,null),default:"",pattern:"^([gimuy]+)$",patternErrorMessage:d(9003,null)}}},indentNextLinePattern:{type:["string","object"],description:d(9010,null),properties:{pattern:{type:"string",description:d(9013,null),default:""},flags:{type:"string",description:d(9012,null),default:"",pattern:"^([gimuy]+)$",patternErrorMessage:d(9011,null)}}},unIndentedLinePattern:{type:["string","object"],description:d(9014,null),properties:{pattern:{type:"string",description:d(9017,null),default:""},flags:{type:"string",description:d(9016,null),default:"",pattern:"^([gimuy]+)$",patternErrorMessage:d(9015,null)}}}}},folding:{type:"object",description:d(8996,null),properties:{offSide:{type:"boolean",description:d(9000,null)},markers:{type:"object",description:d(8997,null),properties:{start:{type:"string",description:d(8999,null)},end:{type:"string",description:d(8998,null)}}}}},onEnterRules:{type:"array",description:d(9021,null),items:{type:"object",description:d(9021,null),required:["beforeText","action"],properties:{beforeText:{type:["string","object"],description:d(9034,null),properties:{pattern:{type:"string",description:d(9037,null),default:""},flags:{type:"string",description:d(9036,null),default:"",pattern:"^([gimuy]+)$",patternErrorMessage:d(9035,null)}}},afterText:{type:["string","object"],description:d(9030,null),properties:{pattern:{type:"string",description:d(9033,null),default:""},flags:{type:"string",description:d(9032,null),default:"",pattern:"^([gimuy]+)$",patternErrorMessage:d(9031,null)}}},previousLineText:{type:["string","object"],description:d(9038,null),properties:{pattern:{type:"string",description:d(9041,null),default:""},flags:{type:"string",description:d(9040,null),default:"",pattern:"^([gimuy]+)$",patternErrorMessage:d(9039,null)}}},action:{type:["string","object"],description:d(9022,null),required:["indent"],default:{indent:"indent"},properties:{indent:{type:"string",description:d(9024,null),default:"indent",enum:["none","indent","indentOutdent","outdent"],markdownEnumDescriptions:[d(9027,null),d(9025,null),d(9026,null),d(9028,null)]},appendText:{type:"string",description:d(9023,null),default:""},removeText:{type:"number",description:d(9029,null),default:0}}}}}}}},Bqo=ne.as(ma.JSONContribution);Bqo.registerSchema(Wqo,Vqo);var kr=le("statusbarService");function Tde(a){let i=a;return typeof i?.location?.id=="string"&&typeof i.alignment=="number"}function TJi(a){let i=a;return(typeof i?.primary=="number"||Tde(i?.primary))&&typeof i?.secondary=="number"}var LR={id:"statusBar.entry.showTooltip",title:""},_Ji=["standard","warning","error","prominent","remote","offline"];function DJi(a){let i=a;return!!i?.content&&Array.isArray(i?.commands)}var Uc=le("remoteAuthorityResolverService");var UTt=class{constructor(i){this.id=i;this.type=1}toString(){return`Managed(${this.id})`}},zTt=class{constructor(i,e){this.host=i;this.port=e;this.type=0}toString(){return`WebSocket(${this.host}:${this.port})`}};var Ew=class a extends pa{static isNotAvailable(i){return i instanceof a&&i._code==="NotAvailable"}static isTemporarilyNotAvailable(i){return i instanceof a&&i._code==="TemporarilyNotAvailable"}static isNoResolverFound(i){return i instanceof a&&i._code==="NoResolverFound"}static isInvalidAuthority(i){return i instanceof a&&i._code==="InvalidAuthority"}static isHandled(i){return i instanceof a&&i.isHandled}constructor(i,e="Unknown",t){super(i),this._message=i,this._code=e,this._detail=t,this.isHandled=e==="NotAvailable"&&t===!0,Object.setPrototypeOf(this,a.prototype)}};function bK(a){let i=a.indexOf("+");return i===-1?a:a.substring(0,i)}function br(a){return Object.assign(a,{apply:function(...e){if(e.length===0)return Reflect.construct(a,[]);{let t=e.length===1?[]:e[1];return Reflect.construct(a,t,e[0].constructor)}},call:function(...e){if(e.length===0)return Reflect.construct(a,[]);{let[t,...o]=e;return Reflect.construct(a,o,t.constructor)}}})}var Tw,eT=class{constructor(i,e=!1){ASe(this,Tw);Zqe(this,Tw,new Ie(i,{supportThemeIcons:e}))}static isMarkdownString(i){return i instanceof eT?!0:!i||typeof i!="object"?!1:i.appendCodeblock&&i.appendMarkdown&&i.appendText&&i.value!==void 0}get value(){return Nf(this,Tw).value}set value(i){Nf(this,Tw).value=i}get isTrusted(){return Nf(this,Tw).isTrusted}set isTrusted(i){Nf(this,Tw).isTrusted=i}get supportThemeIcons(){return Nf(this,Tw).supportThemeIcons}set supportThemeIcons(i){Nf(this,Tw).supportThemeIcons=i}get supportHtml(){return Nf(this,Tw).supportHtml}set supportHtml(i){Nf(this,Tw).supportHtml=i}get supportAlertSyntax(){return Nf(this,Tw).supportAlertSyntax}set supportAlertSyntax(i){Nf(this,Tw).supportAlertSyntax=i}get baseUri(){return Nf(this,Tw).baseUri}set baseUri(i){Nf(this,Tw).baseUri=i}appendText(i){return Nf(this,Tw).appendText(i),this}appendMarkdown(i){return Nf(this,Tw).appendMarkdown(i),this}appendCodeblock(i,e){return Nf(this,Tw).appendCodeblock(e??"",i),this}};Tw=new WeakMap,eT=I([br],eT);var bc=class{static Min(...i){if(i.length===0)throw new TypeError;let e=i[0];for(let t=1;t<i.length;t++){let o=i[t];o.isBefore(e)&&(e=o)}return e}static Max(...i){if(i.length===0)throw new TypeError;let e=i[0];for(let t=1;t<i.length;t++){let o=i[t];o.isAfter(e)&&(e=o)}return e}static isPosition(i){if(!i)return!1;if(i instanceof bc)return!0;let{line:e,character:t}=i;return typeof e=="number"&&typeof t=="number"}static of(i){if(i instanceof bc)return i;if(this.isPosition(i))return new bc(i.line,i.character);throw new Error("Invalid argument, is NOT a position-like object")}get line(){return this._line}get character(){return this._character}constructor(i,e){if(i<0)throw Yr("line must be non-negative");if(e<0)throw Yr("character must be non-negative");this._line=i,this._character=e}isBefore(i){return this._line<i._line?!0:i._line<this._line?!1:this._character<i._character}isBeforeOrEqual(i){return this._line<i._line?!0:i._line<this._line?!1:this._character<=i._character}isAfter(i){return!this.isBeforeOrEqual(i)}isAfterOrEqual(i){return!this.isBefore(i)}isEqual(i){return this._line===i._line&&this._character===i._character}compareTo(i){return this._line<i._line?-1:this._line>i.line?1:this._character<i._character?-1:this._character>i._character?1:0}translate(i,e=0){if(i===null||e===null)throw Yr();let t;return typeof i>"u"?t=0:typeof i=="number"?t=i:(t=typeof i.lineDelta=="number"?i.lineDelta:0,e=typeof i.characterDelta=="number"?i.characterDelta:0),t===0&&e===0?this:new bc(this.line+t,this.character+e)}with(i,e=this.character){if(i===null||e===null)throw Yr();let t;return typeof i>"u"?t=this.line:typeof i=="number"?t=i:(t=typeof i.line=="number"?i.line:this.line,e=typeof i.character=="number"?i.character:this.character),t===this.line&&e===this.character?this:new bc(t,e)}toJSON(){return{line:this.line,character:this.character}}[Symbol.for("debug.description")](){return`(${this.line}:${this.character})`}};bc=I([br],bc);var od=class{static isRange(i){return i instanceof od?!0:!i||typeof i!="object"?!1:bc.isPosition(i.start)&&bc.isPosition(i.end)}static of(i){if(i instanceof od)return i;if(this.isRange(i))return new od(i.start,i.end);throw new Error("Invalid argument, is NOT a range-like object")}get start(){return this._start}get end(){return this._end}constructor(i,e,t,o){let n,r;if(typeof i=="number"&&typeof e=="number"&&typeof t=="number"&&typeof o=="number"?(n=new bc(i,e),r=new bc(t,o)):bc.isPosition(i)&&bc.isPosition(e)&&(n=bc.of(i),r=bc.of(e)),!n||!r)throw new Error("Invalid arguments");n.isBefore(r)?(this._start=n,this._end=r):(this._start=r,this._end=n)}contains(i){return od.isRange(i)?this.contains(i.start)&&this.contains(i.end):bc.isPosition(i)?!(bc.of(i).isBefore(this._start)||this._end.isBefore(i)):!1}isEqual(i){return this._start.isEqual(i._start)&&this._end.isEqual(i._end)}intersection(i){let e=bc.Max(i.start,this._start),t=bc.Min(i.end,this._end);if(!e.isAfter(t))return new od(e,t)}union(i){if(this.contains(i))return this;if(i.contains(this))return i;let e=bc.Min(i.start,this._start),t=bc.Max(i.end,this.end);return new od(e,t)}get isEmpty(){return this._start.isEqual(this._end)}get isSingleLine(){return this._start.line===this._end.line}with(i,e=this.end){if(i===null||e===null)throw Yr();let t;return i?bc.isPosition(i)?t=i:(t=i.start||this.start,e=i.end||this.end):t=this.start,t.isEqual(this._start)&&e.isEqual(this.end)?this:new od(t,e)}toJSON(){return[this.start,this.end]}[Symbol.for("debug.description")](){return Lmi(this)}};od=I([br],od);function Lmi(a){return a.isEmpty?`[${a.start.line}:${a.start.character})`:`[${a.start.line}:${a.start.character} -> ${a.end.line}:${a.end.character})`}var um=class{constructor(i){this.value=i}append(i){return new um(this.value?this.value+um.sep+i:i)}intersects(i){return this.contains(i)||i.contains(this)}contains(i){return this.value===i.value||i.value.startsWith(this.value+um.sep)}};um.sep=".",um=I([br],um);um.Empty=new um("");um.QuickFix=um.Empty.append("quickfix");um.Refactor=um.Empty.append("refactor");um.RefactorExtract=um.Refactor.append("extract");um.RefactorInline=um.Refactor.append("inline");um.RefactorMove=um.Refactor.append("move");um.RefactorRewrite=um.Refactor.append("rewrite");um.Source=um.Empty.append("source");um.SourceOrganizeImports=um.Source.append("organizeImports");um.SourceFixAll=um.Source.append("fixAll");um.Notebook=um.Empty.append("notebook");var KTt=(o=>(o[o.Hint=3]="Hint",o[o.Information=2]="Information",o[o.Warning=1]="Warning",o[o.Error=0]="Error",o))(KTt||{}),EX=class{static is(i){return i?typeof i.message=="string"&&i.location&&od.isRange(i.location.range)&&A.isUri(i.location.uri):!1}constructor(i,e){this.location=i,this.message=e}static isEqual(i,e){return i===e?!0:!i||!e?!1:i.message===e.message&&i.location.range.isEqual(e.location.range)&&i.location.uri.toString()===e.location.uri.toString()}};EX=I([br],EX);var _de=class{constructor(i,e,t=0){if(!od.isRange(i))throw new TypeError("range must be set");if(!e)throw new TypeError("message must be set");this.range=i,this.message=e,this.severity=t}toJSON(){return{severity:KTt[this.severity],message:this.message,range:this.range,source:this.source,code:this.code}}static isEqual(i,e){return i===e?!0:!i||!e?!1:i.message===e.message&&i.severity===e.severity&&i.code===e.code&&i.severity===e.severity&&i.source===e.source&&i.range.isEqual(e.range)&&$i(i.tags,e.tags)&&$i(i.relatedInformation,e.relatedInformation,EX.isEqual)}};_de=I([br],_de);var J_=class{static isLocation(i){return i instanceof J_?!0:i?od.isRange(i.range)&&A.isUri(i.uri):!1}constructor(i,e){if(this.uri=i,e)if(od.isRange(e))this.range=od.of(e);else if(bc.isPosition(e))this.range=new od(e,e);else throw new Error("Illegal argument")}toJSON(){return{uri:this.uri,range:this.range}}};J_=I([br],J_);var V5=class a{static isNotebookRange(i){return i instanceof a?!0:i?typeof i.start=="number"&&typeof i.end=="number":!1}get start(){return this._start}get end(){return this._end}get isEmpty(){return this._start===this._end}constructor(i,e){if(i<0)throw Yr("start must be positive");if(e<0)throw Yr("end must be positive");i<=e?(this._start=i,this._end=e):(this._start=e,this._end=i)}with(i){let e=this._start,t=this._end;return i.start!==void 0&&(e=i.start),i.end!==void 0&&(t=i.end),e===this._start&&t===this._end?this:new a(e,t)}},eEe=class a{static validate(i){if(typeof i.kind!="number")throw new Error("NotebookCellData MUST have 'kind' property");if(typeof i.value!="string")throw new Error("NotebookCellData MUST have 'value' property");if(typeof i.languageId!="string")throw new Error("NotebookCellData MUST have 'languageId' property")}static isNotebookCellDataArray(i){return Array.isArray(i)&&i.every(e=>a.isNotebookCellData(e))}static isNotebookCellData(i){return!0}constructor(i,e,t,o,n,r,s){this.kind=i,this.value=e,this.languageId=t,this.mime=o,this.outputs=n??[],this.metadata=r,this.executionSummary=s,a.validate(this)}},DQe=class{constructor(i){this.cells=i}},RR=class{static isNotebookCellEdit(i){return i instanceof RR?!0:i?V5.isNotebookRange(i)&&Array.isArray(i.newCells):!1}static replaceCells(i,e){return new RR(i,e)}static insertCells(i,e){return new RR(new V5(i,i),e)}static deleteCells(i){return new RR(i,[])}static updateCellMetadata(i,e){let t=new RR(new V5(i,i),[]);return t.newCellMetadata=e,t}static updateNotebookMetadata(i){let e=new RR(new V5(0,0),[]);return e.newNotebookMetadata=i,e}constructor(i,e){this.range=i,this.newCells=e}};RR=I([br],RR);var LQe=class a{constructor(i,e){this.data=i;this.mime=e;let t=mei(e,!0);if(!t)throw new Error(`INVALID mime type: ${e}. Must be in the format "type/subtype[;optionalparameter]"`);this.mime=t}static isNotebookCellOutputItem(i){return i instanceof a?!0:i?typeof i.mime=="string"&&i.data instanceof Uint8Array:!1}static error(i){let e={name:i.name,message:i.message,stack:i.stack};return a.json(e,"application/vnd.code.notebook.error")}static stdout(i){return a.text(i,"application/vnd.code.notebook.stdout")}static stderr(i){return a.text(i,"application/vnd.code.notebook.stderr")}static bytes(i,e="application/octet-stream"){return new a(i,e)}static$a=new TextEncoder;static text(i,e=tr.text){let t=a.$a.encode(String(i));return new a(t,e)}static json(i,e="text/x-json"){let t=JSON.stringify(i,void 0,"	");return a.text(t,e)}},RQe=class a{static isNotebookCellOutput(i){return i instanceof a?!0:!i||typeof i!="object"?!1:typeof i.id=="string"&&Array.isArray(i.items)}static ensureUniqueMimeTypes(i,e=!1){let t=new Set,o=new Set;for(let n=0;n<i.length;n++){let r=i[n],s=mei(r.mime);if(!t.has(s)||HL(s)){t.add(s);continue}o.add(n),e&&console.warn(`DUPLICATED mime type '${r.mime}' will be dropped`)}return o.size===0?i:i.filter((n,r)=>!o.has(r))}constructor(i,e,t){this.items=a.ensureUniqueMimeTypes(i,!0),typeof e=="string"?(this.id=e,this.metadata=t):(this.id=xt(),this.metadata=e??t)}};var B5=class extends od{static isSelection(i){return i instanceof B5?!0:!i||typeof i!="object"?!1:od.isRange(i)&&bc.isPosition(i.anchor)&&bc.isPosition(i.active)&&typeof i.isReversed=="boolean"}get anchor(){return this._anchor}get active(){return this._active}constructor(i,e,t,o){let n,r;if(typeof i=="number"&&typeof e=="number"&&typeof t=="number"&&typeof o=="number"?(n=new bc(i,e),r=new bc(t,o)):bc.isPosition(i)&&bc.isPosition(e)&&(n=bc.of(i),r=bc.of(e)),!n||!r)throw new Error("Invalid arguments");super(n,r),this._anchor=n,this._active=r}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 Hqo(this)}};B5=I([br],B5);function Hqo(a){let i=Lmi(a);return a.isEmpty||(a.active.isEqual(a.start)?i=`|${i}`:i=`${i}|`),i}var tT=class{constructor(i){this._tabstop=1;this.value=i||""}static isSnippetString(i){return i instanceof tT?!0:!i||typeof i!="object"?!1:typeof i.value=="string"}static _escape(i){return i.replace(/\$|}|\\/g,"\\$&")}appendText(i){return this.value+=tT._escape(i),this}appendTabstop(i=this._tabstop++){return this.value+="$",this.value+=i,this}appendPlaceholder(i,e=this._tabstop++){if(typeof i=="function"){let t=new tT;t._tabstop=this._tabstop,i(t),this._tabstop=t._tabstop,i=t.value}else i=tT._escape(i);return this.value+="${",this.value+=e,this.value+=":",this.value+=i,this.value+="}",this}appendChoice(i,e=this._tabstop++){let t=i.map(o=>o.replaceAll(/[|\\,]/g,"\\$&")).join(",");return this.value+="${",this.value+=e,this.value+="|",this.value+=t,this.value+="|}",this}appendVariable(i,e){if(typeof e=="function"){let t=new tT;t._tabstop=this._tabstop,e(t),this._tabstop=t._tabstop,e=t.value}else typeof e=="string"&&(e=e.replace(/\$|}/g,"\\$&"));return this.value+="${",this.value+=i,e&&(this.value+=":",this.value+=e),this.value+="}",this}};tT=I([br],tT);var Dde=class a{static isSnippetTextEdit(i){return i instanceof a?!0:i?od.isRange(i.range)&&tT.isSnippetString(i.snippet):!1}static replace(i,e){return new a(i,e)}static insert(i,e){return a.replace(new od(i,i),e)}constructor(i,e){this.range=i,this.snippet=e}};var GTt=(G=>(G[G.File=0]="File",G[G.Module=1]="Module",G[G.Namespace=2]="Namespace",G[G.Package=3]="Package",G[G.Class=4]="Class",G[G.Method=5]="Method",G[G.Property=6]="Property",G[G.Field=7]="Field",G[G.Constructor=8]="Constructor",G[G.Enum=9]="Enum",G[G.Interface=10]="Interface",G[G.Function=11]="Function",G[G.Variable=12]="Variable",G[G.Constant=13]="Constant",G[G.String=14]="String",G[G.Number=15]="Number",G[G.Boolean=16]="Boolean",G[G.Array=17]="Array",G[G.Object=18]="Object",G[G.Key=19]="Key",G[G.Null=20]="Null",G[G.EnumMember=21]="EnumMember",G[G.Struct=22]="Struct",G[G.Event=23]="Event",G[G.Operator=24]="Operator",G[G.TypeParameter=25]="TypeParameter",G))(GTt||{});var H5=class{static validate(i){if(!i.name)throw new Error("name must not be falsy")}constructor(i,e,t,o,n){this.name=i,this.kind=e,this.containerName=n,typeof t=="string"&&(this.containerName=t),o instanceof J_?this.location=o:t instanceof od&&(this.location=new J_(o,t)),H5.validate(this)}toJSON(){return{name:this.name,kind:GTt[this.kind],location:this.location,containerName:this.containerName}}};H5=I([br],H5);var hk=class{static isTextEdit(i){return i instanceof hk?!0:!i||typeof i!="object"?!1:od.isRange(i)&&typeof i.newText=="string"}static replace(i,e){return new hk(i,e)}static insert(i,e){return hk.replace(new od(i,i),e)}static delete(i){return hk.replace(i,"")}static setEndOfLine(i){let e=new hk(new od(new bc(0,0),new bc(0,0)),"");return e.newEol=i,e}get range(){return this._range}set range(i){if(i&&!od.isRange(i))throw Yr("range");this._range=i}get newText(){return this._newText||""}set newText(i){if(i&&typeof i!="string")throw Yr("newText");this._newText=i}get newEol(){return this._newEol}set newEol(i){if(i&&typeof i!="number")throw Yr("newEol");this._newEol=i}constructor(i,e){this._range=i,this._newText=e}toJSON(){return{range:this.range,newText:this.newText,newEol:this._newEol}}};hk=I([br],hk);var U5=le("notebookDocumentService"),Rmi=["W","X","Y","Z","a","b","c","d","e","f"],Uqo=new RegExp(`^[${Rmi.join("")}]+`),LJi=7;function tEe(a){if(a.scheme!==Q.vscodeNotebookCell)return;let i=a.fragment.indexOf("s");if(i<0)return;let e=parseInt(a.fragment.substring(0,i).replace(Uqo,""),LJi),t=qa(a.fragment.substring(i+1)).toString();if(!isNaN(e))return{handle:e,notebook:a.with({scheme:t,fragment:null})}}function RJi(a,i){let e=i.toString(LJi),o=`${e.length<Rmi.length?Rmi[e.length-1]:"z"}${e}s${Yd(qe.fromString(a.scheme),!0,!0)}`;return a.with({scheme:Q.vscodeNotebookCell,fragment:o})}function MJi(a){if(a.scheme!==Q.vscodeNotebookMetadata)return;let i=qa(a.fragment).toString();return a.with({scheme:i,fragment:null})}function PJi(a){let i=`${Yd(qe.fromString(a.scheme),!0,!0)}`;return a.with({scheme:Q.vscodeNotebookMetadata,fragment:i})}function MQe(a){if(a.scheme!==Q.vscodeNotebookCellOutput)return;let i=new URLSearchParams(a.query),e=i.get("openIn");if(!e)return;let t=i.get("outputId")??void 0,o=tEe(a.with({scheme:Q.vscodeNotebookCell,query:null})),n=i.get("outputIndex")?parseInt(i.get("outputIndex")||"",10):void 0,r=o?o.notebook:a.with({scheme:i.get("notebookScheme")||Q.file,fragment:null,query:null}),s=i.get("cellIndex")?parseInt(i.get("cellIndex")||"",10):void 0;return{notebook:r,openIn:e,outputId:t,outputIndex:n,cellHandle:o?.handle,cellFragment:a.fragment,cellIndex:s}}var Mmi=class{constructor(){this._documents=new gt}getNotebook(i){if(i.scheme===Q.vscodeNotebookCell){let e=tEe(i);if(e){let t=this._documents.get(e.notebook);if(t)return t}}if(i.scheme===Q.vscodeNotebookCellOutput){let e=MQe(i);if(e){let t=this._documents.get(e.notebook);if(t)return t}}return this._documents.get(i)}addNotebookDocument(i){this._documents.set(i.uri,i)}removeNotebookDocument(i){this._documents.delete(i.uri)}};Ee(U5,Mmi,1);var MR="workbench.editor.notebook",TX="workbench.editor.notebookTextDiffEditor",AJi="workbench.editor.notebookMultiTextDiffEditor",_X="workbench.editor.interactive",iEe="workbench.editor.repl",NJi="workbench.editor.notebookOutputEditor";var Ami=["application/json","application/javascript","text/html","image/svg+xml",tr.latex,tr.markdown,"image/png","image/jpeg",tr.text],OJi=[tr.latex,tr.markdown,"application/json","text/html","image/svg+xml","image/png","image/jpeg",tr.text],FJi=new Map([["ms-toolsai.jupyter",new Set(["jupyter-notebook","interactive"])],["ms-toolsai.jupyter-renderers",new Set(["jupyter-notebook","interactive"])]]),SK="_notAvailable";var PQe;(t=>{t.scheme=Q.vscodeNotebookMetadata;function i(o){return PJi(o)}t.generate=i;function e(o){return MJi(o)}t.parse=e})(PQe||={});var Zo;(c=>{c.scheme=Q.vscodeNotebookCell;function i(u,p){return RJi(u,p)}c.generate=i;function e(u){return tEe(u)}c.parse=e;function t(u,p){return u.with({scheme:Q.vscodeNotebookCellOutput,query:new URLSearchParams({openIn:"editor",outputId:p??"",notebookScheme:u.scheme!==Q.file?u.scheme:""}).toString()})}c.generateCellOutputUriWithId=t;function o(u,p,h){return u.with({scheme:Q.vscodeNotebookCellOutput,fragment:p.fragment,query:new URLSearchParams({openIn:"notebook",outputIndex:String(h)}).toString()})}c.generateCellOutputUriWithIndex=o;function n(u,p,h,g,f){return u.with({scheme:Q.vscodeNotebookCellOutput,query:new URLSearchParams({openIn:"notebookOutputEditor",notebook:u.toString(),cellIndex:String(h),outputId:g,outputIndex:String(f)}).toString()})}c.generateOutputEditorUri=n;function r(u){return MQe(u)}c.parseCellOutputUri=r;function s(u,p,h){return c.generate(u,p).with({scheme:h})}c.generateCellPropertyUri=s;function l(u,p){if(u.scheme===p)return c.parse(u.with({scheme:c.scheme}))}c.parseCellPropertyUri=l})(Zo||={});var qTt=a=>ei?a.replace(/\//g,"\\"):a,jTt=class{constructor(i=[],e=Ami){this.defaultOrder=e;this.order=[...new Set(i)].map(t=>({pattern:t,matches:Ym(qTt(t),{ignoreCase:!0})}))}sort(i){let e=new Map(vt.map(i,o=>[o,qTt(o)])),t=[];for(let{matches:o}of this.order)for(let[n,r]of e)if(o(r)){t.push(n),e.delete(n);break}return e.size&&(t=t.concat([...e.keys()].sort((o,n)=>this.defaultOrder.indexOf(o)-this.defaultOrder.indexOf(n)))),t}prioritize(i,e){let t=this.findIndex(i);if(t===-1){this.order.unshift({pattern:i,matches:Ym(qTt(i),{ignoreCase:!0})});return}let o=new Set(e.map(r=>this.findIndex(r,t)));o.delete(-1);let n=Array.from(o).sort();this.order.splice(t+1,0,...n.map(r=>this.order[r]));for(let r=n.length-1;r>=0;r--)this.order.splice(n[r],1)}toArray(){return this.order.map(i=>i.pattern)}findIndex(i,e=this.order.length){let t=qTt(i);for(let o=0;o<e;o++)if(this.order[o].matches(t))return o;return-1}};function AQe(a,i,e,t=(o,n)=>o===n){let o=[];function n(l,c,u){if(c===0&&u.length===0)return;let p=o[o.length-1];p&&p.start+p.deleteCount===l?(p.deleteCount+=c,p.toInsert.push(...u)):o.push({start:l,deleteCount:c,toInsert:u})}let r=0,s=0;for(;;){if(r===a.length){n(r,0,i.slice(s));break}if(s===i.length){n(r,a.length-r,[]);break}let l=a[r],c=i[s];if(t(l,c)){r+=1,s+=1;continue}e(c)?(n(r,1,[]),r+=1):(n(r,0,[c]),s+=1)}return o}var Lde=new Y("notebookEditorCursorAtBoundary","none"),Rde=new Y("notebookEditorCursorAtLineBoundary","none");function QTt(a){let i=a;return!!((typeof i.include=="string"||qP(i.include))&&(typeof i.exclude=="string"||qP(i.exclude)))}var yt={displayOrder:"notebook.displayOrder",cellToolbarLocation:"notebook.cellToolbarLocation",cellToolbarVisibility:"notebook.cellToolbarVisibility",showCellStatusBar:"notebook.showCellStatusBar",cellExecutionTimeVerbosity:"notebook.cellExecutionTimeVerbosity",textDiffEditorPreview:"notebook.diff.enablePreview",diffOverviewRuler:"notebook.diff.overviewRuler",experimentalInsertToolbarAlignment:"notebook.experimental.insertToolbarAlignment",compactView:"notebook.compactView",focusIndicator:"notebook.cellFocusIndicator",insertToolbarLocation:"notebook.insertToolbarLocation",globalToolbar:"notebook.globalToolbar",stickyScrollEnabled:"notebook.stickyScroll.enabled",stickyScrollMode:"notebook.stickyScroll.mode",undoRedoPerCell:"notebook.undoRedoPerCell",consolidatedOutputButton:"notebook.consolidatedOutputButton",openOutputInPreviewEditor:"notebook.output.openInPreviewEditor.enabled",showFoldingControls:"notebook.showFoldingControls",dragAndDropEnabled:"notebook.dragAndDropEnabled",cellEditorOptionsCustomizations:"notebook.editorOptionsCustomizations",consolidatedRunButton:"notebook.consolidatedRunButton",openGettingStarted:"notebook.experimental.openGettingStarted",globalToolbarShowLabel:"notebook.globalToolbarShowLabel",markupFontSize:"notebook.markup.fontSize",markdownLineHeight:"notebook.markdown.lineHeight",interactiveWindowCollapseCodeCells:"interactiveWindow.collapseCellInputCode",outputScrollingDeprecated:"notebook.experimental.outputScrolling",outputScrolling:"notebook.output.scrolling",textOutputLineLimit:"notebook.output.textLineLimit",LinkifyOutputFilePaths:"notebook.output.linkifyFilePaths",minimalErrorRendering:"notebook.output.minimalErrorRendering",formatOnSave:"notebook.formatOnSave.enabled",insertFinalNewline:"notebook.insertFinalNewline",defaultFormatter:"notebook.defaultFormatter",formatOnCellExecution:"notebook.formatOnCellExecution",codeActionsOnSave:"notebook.codeActionsOnSave",outputWordWrap:"notebook.output.wordWrap",outputLineHeightDeprecated:"notebook.outputLineHeight",outputLineHeight:"notebook.output.lineHeight",outputFontSizeDeprecated:"notebook.outputFontSize",outputFontSize:"notebook.output.fontSize",outputFontFamilyDeprecated:"notebook.outputFontFamily",outputFontFamily:"notebook.output.fontFamily",findFilters:"notebook.find.filters",logging:"notebook.logging",confirmDeleteRunningCell:"notebook.confirmDeleteRunningCell",remoteSaving:"notebook.experimental.remoteSave",gotoSymbolsAllSymbols:"notebook.gotoSymbols.showAllSymbols",outlineShowMarkdownHeadersOnly:"notebook.outline.showMarkdownHeadersOnly",outlineShowCodeCells:"notebook.outline.showCodeCells",outlineShowCodeCellSymbols:"notebook.outline.showCodeCellSymbols",breadcrumbsShowCodeCells:"notebook.breadcrumbs.showCodeCells",scrollToRevealCell:"notebook.scrolling.revealNextCellOnExecute",cellChat:"notebook.experimental.cellChat",cellGenerate:"notebook.experimental.generate",notebookVariablesView:"notebook.variablesView",notebookInlineValues:"notebook.inlineValues",InteractiveWindowPromptToSave:"interactiveWindow.promptToSaveOnClose",cellFailureDiagnostics:"notebook.cellFailureDiagnostics",outputBackupSizeLimit:"notebook.backup.sizeLimit",multiCursor:"notebook.multiCursor.enabled",markupFontFamily:"notebook.markup.fontFamily"};var yF=class a{static{this._prefix="notebook/"}static create(i,e){return`${a._prefix}${i}/${e??i}`}static parse(i){if(i.startsWith(a._prefix)){let e=i.substring(a._prefix.length).split("/");if(e.length===2)return{notebookType:e[0],viewType:e[1]}}}},zqo=new TextDecoder;function WJi(a){let i=[],e=!1;for(let r of a)(i.length===0||e)&&(i.push(r),e=!0);let t=Gqo(i),o=qe.concat(i.map(r=>qe.wrap(r))),n=Yqo(o);return t=t||n.byteLength!==o.byteLength,{data:n,didCompression:t}}var $Tt="\x1B[A",Pmi=$Tt.split("").map(a=>a.charCodeAt(0)),Kqo=10;function Gqo(a){let i=!1;return a.forEach((e,t)=>{if(t===0||e.length<$Tt.length)return;let o=a[t-1],n=e.subarray(0,$Tt.length);if(n[0]===Pmi[0]&&n[1]===Pmi[1]&&n[2]===Pmi[2]){let r=o.lastIndexOf(Kqo);if(r===-1)return;i=!0,a[t-1]=o.subarray(0,r),a[t]=e.subarray($Tt.length)}}),i}function qqo(a){let i=a;do a=i,i=a.replace(/[^\n]\x08/gm,"");while(i.length<a.length);return a}function $qo(a){for(a=a.replace(/\r+\n/gm,`
`);a.search(/\r[^$]/g)>-1;){let i=a.match(/^(.*)\r+/m)[1],e=a.match(/\r+(.*)$/m)[1];e=e+i.slice(e.length,i.length),a=a.replace(/\r+.*$/m,"\r").replace(/^.*\r/m,e)}return a}var jqo=8,Qqo=13;function Yqo(a){return!a.buffer.includes(jqo)&&!a.buffer.includes(Qqo)?a:qe.fromString($qo(qqo(zqo.decode(a.buffer))))}var DX=class{constructor(){this._edits=[]}_allEntries(){return this._edits}renameFile(i,e,t,o){this._edits.push({_type:1,from:i,to:e,options:t,metadata:o})}createFile(i,e,t){this._edits.push({_type:1,from:void 0,to:i,options:e,metadata:t})}deleteFile(i,e,t){this._edits.push({_type:1,from:i,to:void 0,options:e,metadata:t})}replaceNotebookMetadata(i,e,t){this._edits.push({_type:3,metadata:t,uri:i,edit:{editType:5,metadata:e}})}replaceNotebookCells(i,e,t,o){let n=e.start,r=e.end;(n!==r||t.length>0)&&this._edits.push({_type:5,uri:i,index:n,count:r-n,cells:t,metadata:o})}replaceNotebookCellMetadata(i,e,t,o){this._edits.push({_type:3,metadata:o,uri:i,edit:{editType:3,index:e,metadata:t}})}replace(i,e,t,o){this._edits.push({_type:2,uri:i,edit:new hk(e,t),metadata:o})}insert(i,e,t,o){this.replace(i,new od(e,e),t,o)}delete(i,e,t){this.replace(i,e,"",t)}has(i){return this._edits.some(e=>e._type===2&&e.uri.toString()===i.toString())}set(i,e){if(e)for(let t of e){if(!t)continue;let o,n;Array.isArray(t)?(o=t[0],n=t[1]):o=t,RR.isNotebookCellEdit(o)?o.newCellMetadata?this.replaceNotebookCellMetadata(i,o.range.start,o.newCellMetadata,n):o.newNotebookMetadata?this.replaceNotebookMetadata(i,o.newNotebookMetadata,n):this.replaceNotebookCells(i,o.range,o.newCells,n):Dde.isSnippetTextEdit(o)?this._edits.push({_type:6,uri:i,range:o.range,edit:o.snippet,metadata:n,keepWhitespace:o.keepWhitespace}):this._edits.push({_type:2,uri:i,edit:o,metadata:n})}else{for(let t=0;t<this._edits.length;t++){let o=this._edits[t];switch(o._type){case 2:case 6:case 3:case 5:o.uri.toString()===i.toString()&&(this._edits[t]=void 0);break}}C$(this._edits)}}get(i){let e=[];for(let t of this._edits)t._type===2&&t.uri.toString()===i.toString()&&e.push(t.edit);return e}entries(){let i=new gt;for(let e of this._edits)if(e._type===2){let t=i.get(e.uri);t||(t=[e.uri,[]],i.set(e.uri,t)),t[1].push(e.edit)}return[...i.values()]}get size(){return this.entries().length}toJSON(){return this.entries()}};DX=I([br],DX);var Nde,LX=class{constructor(i){ASe(this,Nde);Zqe(this,Nde,i)}static from(...i){let e=i;return new LX(function(){if(e){for(let t of e)t&&typeof t.dispose=="function"&&t.dispose();e=void 0}})}dispose(){typeof Nf(this,Nde)=="function"&&(Nf(this,Nde).call(this),Zqe(this,Nde,void 0))}};Nde=new WeakMap,LX=I([br],LX);var OQe=class{constructor(i,e){if(!i)throw new Error("Illegal argument, contents must be defined");Array.isArray(i)?this.contents=i:this.contents=[i],this.range=e}};OQe=I([br],OQe);var oEe=class extends OQe{constructor(i,e,t,o){super(i,e),this.canIncreaseVerbosity=t,this.canDecreaseVerbosity=o}};oEe=I([br],oEe);var HJi=(t=>(t[t.Text=0]="Text",t[t.Read=1]="Read",t[t.Write=2]="Write",t))(HJi||{}),nEe=class{constructor(i,e=0){this.range=i,this.kind=e}toJSON(){return{range:this.range,kind:HJi[this.kind]}}};nEe=I([br],nEe);var rEe=class{constructor(i,e){this.uri=i,this.highlights=e}toJSON(){return{uri:this.uri,highlights:this.highlights.map(i=>i.toJSON())}}};rEe=I([br],rEe);var K5=class{static validate(i){if(!i.name)throw new Error("name must not be falsy");if(!i.range.contains(i.selectionRange))throw new Error("selectionRange must be contained in fullRange");i.children?.forEach(K5.validate)}constructor(i,e,t,o,n){this.name=i,this.detail=e,this.kind=t,this.range=o,this.selectionRange=n,this.children=[],K5.validate(this)}};K5=I([br],K5);var YTt=class{constructor(i,e){this.title=i,this.kind=e}};YTt=I([br],YTt);var sEe=class{constructor(i,e){if(this.range=i,this.parent=e,e&&!e.range.contains(this.range))throw new Error("Invalid argument: parent must contain this range")}};sEe=I([br],sEe);var b_t=class{constructor(i,e,t,o,n,r){this.kind=i,this.name=e,this.detail=t,this.uri=o,this.range=n,this.selectionRange=r}},S_t=class{constructor(i,e){this.fromRanges=e,this.from=i}},I_t=class{constructor(i,e){this.fromRanges=e,this.to=i}};var XTt=class{constructor(i,e){this.range=i,this.command=e}get isResolved(){return!!this.command}};XTt=I([br],XTt);var JTt=class{constructor(i,e){this.label=i,this.documentation=e}};JTt=I([br],JTt);var ZTt=class{constructor(i,e){this.label=i,this.documentation=e,this.parameters=[]}};ZTt=I([br],ZTt);var e_t=class{constructor(){this.activeSignature=0;this.activeParameter=0;this.signatures=[]}};e_t=I([br],e_t);var aEe=class{constructor(i){this.value=i}};aEe=I([br],aEe);var lEe=class{constructor(i,e,t){this.position=i,this.label=e,this.kind=t}};lEe=I([br],lEe);var Omi=($=>($[$.Text=0]="Text",$[$.Method=1]="Method",$[$.Function=2]="Function",$[$.Constructor=3]="Constructor",$[$.Field=4]="Field",$[$.Variable=5]="Variable",$[$.Class=6]="Class",$[$.Interface=7]="Interface",$[$.Module=8]="Module",$[$.Property=9]="Property",$[$.Unit=10]="Unit",$[$.Value=11]="Value",$[$.Enum=12]="Enum",$[$.Keyword=13]="Keyword",$[$.Snippet=14]="Snippet",$[$.Color=15]="Color",$[$.File=16]="File",$[$.Reference=17]="Reference",$[$.Folder=18]="Folder",$[$.EnumMember=19]="EnumMember",$[$.Constant=20]="Constant",$[$.Struct=21]="Struct",$[$.Event=22]="Event",$[$.Operator=23]="Operator",$[$.TypeParameter=24]="TypeParameter",$[$.User=25]="User",$[$.Issue=26]="Issue",$))(Omi||{});var cEe=class{constructor(i,e){this.label=i,this.kind=e}toJSON(){return{label:this.label,kind:this.kind&&Omi[this.kind],detail:this.detail,documentation:this.documentation,sortText:this.sortText,filterText:this.filterText,preselect:this.preselect,insertText:this.insertText,textEdit:this.textEdit}}};cEe=I([br],cEe);var t_t=class{constructor(i=[],e=!1){this.items=i,this.isIncomplete=e}};t_t=I([br],t_t);var i_t=class{constructor(i,e,t){this.insertText=i,this.range=e,this.command=t}};i_t=I([br],i_t);var o_t=class{constructor(i){this.commands=void 0;this.suppressSuggestions=void 0;this.items=i}};o_t=I([br],o_t);function UJi(a,i){return`${Ii.toKey(a)}.${i}`}var Fmi=(t=>(t[t.Keyboard=1]="Keyboard",t[t.Mouse=2]="Mouse",t[t.Command=3]="Command",t))(Fmi||{});(i=>{function a(e){switch(e){case"keyboard":return 1;case"mouse":return 2;case"api":case"code.jump":case"code.navigation":return 3}}i.fromValue=a})(Fmi||={});var Wmi=(o=>(o[o.Other=0]="Other",o[o.Comment=1]="Comment",o[o.String=2]="String",o[o.RegEx=3]="RegEx",o))(Wmi||{});(i=>{function a(e){switch(e){case 0:return"other";case 1:return"comment";case 2:return"string";case 3:return"regex"}return"other"}i.toString=a})(Wmi||={});var dEe=class{constructor(i,e){if(e&&!A.isUri(e))throw Yr("target");if(!od.isRange(i)||i.isEmpty)throw Yr("range");this.range=i,this.target=e}};dEe=I([br],dEe);var Mde=class{constructor(i,e,t,o){this.red=i,this.green=e,this.blue=t,this.alpha=o}};Mde=I([br],Mde);var n_t=class{constructor(i,e){if(e&&!(e instanceof Mde))throw Yr("color");if(!od.isRange(i)||i.isEmpty)throw Yr("range");this.range=i,this.color=e}};n_t=I([br],n_t);var uEe=class{constructor(i){if(!i||typeof i!="string")throw Yr("label");this.label=i}};uEe=I([br],uEe);var gk=class{constructor(i,e){this.label=e;if(typeof i!="string")throw Yr("name");if(typeof e!="string")throw Yr("name");this._id=i}static from(i){switch(i){case"clean":return gk.Clean;case"build":return gk.Build;case"rebuild":return gk.Rebuild;case"test":return gk.Test;default:return}}get id(){return this._id}};gk.Clean=new gk("clean","Clean"),gk.Build=new gk("build","Build"),gk.Rebuild=new gk("rebuild","Rebuild"),gk.Test=new gk("test","Test"),gk=I([br],gk);function zJi(a){let i="";for(let e=0;e<a.length;e++)i+=a[e].replace(/,/g,",,")+",";return i}var FQe=class{constructor(i,e,t){if(typeof i!="string")throw Yr("process");this._args=[],this._process=i,e!==void 0&&(Array.isArray(e)?(this._args=e,this._options=t):this._options=e)}get process(){return this._process}set process(i){if(typeof i!="string")throw Yr("process");this._process=i}get args(){return this._args}set args(i){Array.isArray(i)||(i=[]),this._args=i}get options(){return this._options}set options(i){this._options=i}computeId(){let i=[];if(i.push("process"),this._process!==void 0&&i.push(this._process),this._args&&this._args.length>0)for(let e of this._args)i.push(e);return zJi(i)}};FQe=I([br],FQe);var WQe=class{constructor(i,e,t){this._args=[];if(Array.isArray(e)){if(!i)throw Yr("command can't be undefined or null");if(typeof i!="string"&&typeof i.value!="string")throw Yr("command");this._command=i,e&&(this._args=e),this._options=t}else{if(typeof i!="string")throw Yr("commandLine");this._commandLine=i,this._options=e}}get commandLine(){return this._commandLine}set commandLine(i){if(typeof i!="string")throw Yr("commandLine");this._commandLine=i}get command(){return this._command?this._command:""}set command(i){if(typeof i!="string"&&typeof i.value!="string")throw Yr("command");this._command=i}get args(){return this._args}set args(i){this._args=i||[]}get options(){return this._options}set options(i){this._options=i}computeId(){let i=[];if(i.push("shell"),this._commandLine!==void 0&&i.push(this._commandLine),this._command!==void 0&&i.push(typeof this._command=="string"?this._command:this._command.value),this._args&&this._args.length>0)for(let e of this._args)i.push(typeof e=="string"?e:e.value);return zJi(i)}};WQe=I([br],WQe);var Nmi=class{constructor(i){this._callback=i}computeId(){return"customExecution"+xt()}set callback(i){this._callback=i}get callback(){return this._callback}},fk=class{constructor(i,e,t,o,n,r){this.__deprecated=!1;this._definition=this.definition=i;let s;typeof e=="string"?(this._name=this.name=e,this._source=this.source=t,this.execution=o,s=n,this.__deprecated=!0):e===1||e===2?(this.target=e,this._name=this.name=t,this._source=this.source=o,this.execution=n,s=r):(this.target=e,this._name=this.name=t,this._source=this.source=o,this.execution=n,s=r),typeof s=="string"?(this._problemMatchers=[s],this._hasDefinedMatchers=!0):Array.isArray(s)?(this._problemMatchers=s,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(i){this.__id=i}get _deprecated(){return this.__deprecated}clear(){this.__id!==void 0&&(this.__id=void 0,this._scope=void 0,this.computeDefinitionBasedOnExecution())}computeDefinitionBasedOnExecution(){this._execution instanceof FQe?this._definition={type:fk.ProcessType,id:this._execution.computeId()}:this._execution instanceof WQe?this._definition={type:fk.ShellType,id:this._execution.computeId()}:this._execution instanceof Nmi?this._definition={type:fk.ExtensionCallbackType,id:this._execution.computeId()}:this._definition={type:fk.EmptyType,id:xt()}}get definition(){return this._definition}set definition(i){if(i==null)throw Yr("Kind can't be undefined or null");this.clear(),this._definition=i}get scope(){return this._scope}set target(i){this.clear(),this._scope=i}get name(){return this._name}set name(i){if(typeof i!="string")throw Yr("name");this.clear(),this._name=i}get execution(){return this._execution}set execution(i){i===null&&(i=void 0),this.clear(),this._execution=i;let e=this._definition.type;(fk.EmptyType===e||fk.ProcessType===e||fk.ShellType===e||fk.ExtensionCallbackType===e)&&this.computeDefinitionBasedOnExecution()}get problemMatchers(){return this._problemMatchers}set problemMatchers(i){if(Array.isArray(i))this.clear(),this._problemMatchers=i,this._hasDefinedMatchers=!0;else{this.clear(),this._problemMatchers=[],this._hasDefinedMatchers=!1;return}}get hasDefinedMatchers(){return this._hasDefinedMatchers}get isBackground(){return this._isBackground}set isBackground(i){i!==!0&&i!==!1&&(i=!1),this.clear(),this._isBackground=i}get source(){return this._source}set source(i){if(typeof i!="string"||i.length===0)throw Yr("source must be a string of length > 0");this.clear(),this._source=i}get group(){return this._group}set group(i){i===null&&(i=void 0),this.clear(),this._group=i}get detail(){return this._detail}set detail(i){i===null&&(i=void 0),this._detail=i}get presentationOptions(){return this._presentationOptions}set presentationOptions(i){i==null&&(i=Object.create(null)),this.clear(),this._presentationOptions=i}get runOptions(){return this._runOptions}set runOptions(i){i==null&&(i=Object.create(null)),this.clear(),this._runOptions=i}};fk.ExtensionCallbackType="customExecution",fk.ProcessType="process",fk.ShellType="shell",fk.EmptyType="$empty",fk=I([br],fk);var i$o;(i=>{function a(e){let t=e;return Yo(t.value)?t.tooltip&&!Fe(t.tooltip)?(console.log("INVALID view badge, invalid tooltip",t.tooltip),!1):!0:(console.log("INVALID view badge, invalid value",t.value),!1)}i.isViewBadge=a})(i$o||={});var pEe=class{constructor(i,e=0){this.collapsibleState=e;A.isUri(i)?this.resourceUri=i:this.label=i}static isTreeItem(i,e){let t=i;if(t.checkboxState!==void 0){let o=Yo(t.checkboxState)?t.checkboxState:xi(t.checkboxState)&&Yo(t.checkboxState.state)?t.checkboxState.state:void 0,n=!Yo(t.checkboxState)&&xi(t.checkboxState)?t.checkboxState.tooltip:void 0;if(o===void 0||o!==1&&o!==0||n!==void 0&&!Fe(n))return console.log("INVALID tree item, invalid checkboxState",t.checkboxState),!1}if(i instanceof pEe)return!0;if(t.label!==void 0&&!Fe(t.label)&&!t.label?.label)return console.log("INVALID tree item, invalid label",t.label),!1;if(t.id!==void 0&&!Fe(t.id))return console.log("INVALID tree item, invalid id",t.id),!1;if(t.iconPath!==void 0&&!Fe(t.iconPath)&&!A.isUri(t.iconPath)&&(!t.iconPath||!Fe(t.iconPath.id))){let o=t.iconPath;if(!o||!Fe(o.light)&&!A.isUri(o.light)&&!Fe(o.dark)&&!A.isUri(o.dark))return console.log("INVALID tree item, invalid iconPath",t.iconPath),!1}return t.description!==void 0&&!Fe(t.description)&&typeof t.description!="boolean"?(console.log("INVALID tree item, invalid description",t.description),!1):t.resourceUri!==void 0&&!A.isUri(t.resourceUri)?(console.log("INVALID tree item, invalid resourceUri",t.resourceUri),!1):t.tooltip!==void 0&&!Fe(t.tooltip)&&!(t.tooltip instanceof eT)?(console.log("INVALID tree item, invalid tooltip",t.tooltip),!1):t.command!==void 0&&!t.command.command?(console.log("INVALID tree item, invalid command",t.command),!1):t.collapsibleState!==void 0&&t.collapsibleState<0&&t.collapsibleState>2?(console.log("INVALID tree item, invalid collapsibleState",t.collapsibleState),!1):t.contextValue!==void 0&&!Fe(t.contextValue)?(console.log("INVALID tree item, invalid contextValue",t.contextValue),!1):t.accessibilityInformation!==void 0&&!t.accessibilityInformation?.label?(console.log("INVALID tree item, invalid accessibilityInformation",t.accessibilityInformation),!1):!0}};pEe=I([br],pEe);var VQe=class{constructor(i){this.value=i}async asString(){return typeof this.value=="string"?this.value:JSON.stringify(this.value)}asFile(){}};VQe=I([br],VQe);var SEe=class extends VQe{},y_t=class extends SEe{$b;constructor(i){super(""),this.$b=i}asFile(){return this.$b}},w_t=class{constructor(i,e,t,o){this.name=i,this.uri=e,this._itemId=t,this._getData=o}data(){return this._getData()}},z5,Ode,BQe,mEe=class{constructor(i){ASe(this,Ode);ASe(this,z5,new Map);for(let[e,t]of i??[]){let o=Nf(this,z5).get(e$e(this,Ode,BQe).call(this,e));o?o.push(t):Nf(this,z5).set(e$e(this,Ode,BQe).call(this,e),[t])}}get(i){return Nf(this,z5).get(e$e(this,Ode,BQe).call(this,i))?.[0]}set(i,e){Nf(this,z5).set(e$e(this,Ode,BQe).call(this,i),[e])}forEach(i,e){for(let[t,o]of Nf(this,z5))for(let n of o)i.call(e,n,t,this)}*[Symbol.iterator](){for(let[i,e]of Nf(this,z5))for(let t of e)yield[i,t]}};z5=new WeakMap,Ode=new WeakSet,BQe=function(i){return i.toLowerCase()},mEe=I([br],mEe);var r_t=class{constructor(i,e,t){this.insertText=i,this.title=e,this.kind=t}};r_t=I([br],r_t);var PX=class a{constructor(i){this.value=i}static{this.sep="."}append(...i){return new a((this.value?[this.value,...i]:i).join(a.sep))}intersects(i){return this.contains(i)||i.contains(this)}contains(i){return this.value===i.value||i.value.startsWith(this.value+a.sep)}};PX.Empty=new PX("");PX.Text=new PX("text");PX.TextUpdateImports=PX.Text.append("updateImports");var G5=class{constructor(i,e){this.id=i,this.color=e}static isThemeIcon(i){return typeof i.id!="string"?(console.log("INVALID ThemeIcon, invalid id",i.id),!1):!0}};G5=I([br],G5);G5.File=new G5("file");G5.Folder=new G5("folder");var s_t=class{constructor(i){this.id=i}};s_t=I([br],s_t);var RX=class{get base(){return this._base}set base(i){this._base=i,this._baseUri=A.file(i)}get baseUri(){return this._baseUri}set baseUri(i){this._baseUri=i,this._base=i.fsPath}constructor(i,e){if(typeof i!="string"&&(!i||!A.isUri(i)&&!A.isUri(i.uri)))throw Yr("base");if(typeof e!="string")throw Yr("pattern");typeof i=="string"?this.baseUri=A.file(i):A.isUri(i)?this.baseUri=i:this.baseUri=i.uri,this.pattern=e}toJSON(){return{pattern:this.pattern,base:this.base,baseUri:this.baseUri.toJSON()}}};RX=I([br],RX);var o$o=new WeakMap;var Pde=class{constructor(i,e,t,o,n){this.enabled=typeof i=="boolean"?i:!0,typeof e=="string"&&(this.condition=e),typeof t=="string"&&(this.hitCondition=t),typeof o=="string"&&(this.logMessage=o),typeof n=="string"&&(this.mode=n)}get id(){return this._id||(this._id=o$o.get(this)??xt()),this._id}};Pde=I([br],Pde);var a_t=class extends Pde{constructor(i,e,t,o,n,r){if(super(e,t,o,n,r),i===null)throw Yr("location");this.location=i}};a_t=I([br],a_t);var l_t=class extends Pde{constructor(i,e,t,o,n,r){super(e,t,o,n,r),this.functionName=i}};l_t=I([br],l_t);var c_t=class extends Pde{constructor(i,e,t,o,n,r,s,l){if(super(o,n,r,s,l),!e)throw Yr("dataId");this.label=i,this.dataId=e,this.canPersist=t}};c_t=I([br],c_t);var d_t=class{constructor(i,e,t){this.command=i,this.args=e||[],this.options=t}};d_t=I([br],d_t);var u_t=class{constructor(i,e){this.port=i,this.host=e}};u_t=I([br],u_t);var p_t=class{constructor(i){this.path=i}};p_t=I([br],p_t);var m_t=class{constructor(i){this.implementation=i}};m_t=I([br],m_t);var hEe=class{constructor(i,e){this.range=i,this.expression=e}};hEe=I([br],hEe);var gEe=class{constructor(i,e){this.range=i,this.text=e}};gEe=I([br],gEe);var fEe=class{constructor(i,e,t=!0){this.range=i,this.variableName=e,this.caseSensitiveLookup=t}};fEe=I([br],fEe);var vEe=class{constructor(i,e){this.range=i,this.expression=e}};vEe=I([br],vEe);var bEe=class{constructor(i,e){this.frameId=i,this.stoppedLocation=e}};bEe=I([br],bEe);var FC=class extends Error{static FileExists(i){return new FC(i,"EntryExists",FC.FileExists)}static FileNotFound(i){return new FC(i,"EntryNotFound",FC.FileNotFound)}static FileNotADirectory(i){return new FC(i,"EntryNotADirectory",FC.FileNotADirectory)}static FileIsADirectory(i){return new FC(i,"EntryIsADirectory",FC.FileIsADirectory)}static NoPermissions(i){return new FC(i,"NoPermissions",FC.NoPermissions)}static Unavailable(i){return new FC(i,"Unavailable",FC.Unavailable)}constructor(i,e="Unknown",t){super(A.isUri(i)?i.toString(!0):i),this.code=t?.name??"Unknown",Xti(this,e),Object.setPrototypeOf(this,FC.prototype),typeof Error.captureStackTrace=="function"&&typeof t=="function"&&Error.captureStackTrace(this,t)}};FC=I([br],FC);var h_t=class{constructor(i,e,t){this.start=i,this.end=e,this.kind=t}};h_t=I([br],h_t);var NQe=class{constructor(){}};NQe.Back={iconPath:new G5("arrow-left")},NQe=I([br],NQe);var g_t=class{constructor(i){this.kind=i}};g_t=I([br],g_t);var C_t=class{constructor(i,e=[]){this.uri=i;this.provides=cc(e)}};var f_t=class{constructor(i,e){this.label=i;this.timestamp=e}};f_t=I([br],f_t);var v_t=class{constructor(i=void 0,e=void 0,t=void 0,o=!1,n=!0){this.include=i;this.exclude=e;this.profile=t;this.continuous=o;this.preserveFocus=n}};v_t=I([br],v_t);var MX=class{constructor(i){this.message=i}static diff(i,e,t){let o=new MX(i);return o.expectedOutput=e,o.actualOutput=t,o}};MX=I([br],MX);var Ade=class{constructor(i){this.id=i}};Ade=I([br],Ade);var HQe=class{constructor(i,e){this.covered=i;this.total=e;r6e(this)}};function r6e(a){if(a){if(a.covered>a.total)throw new Error(`The total number of covered items (${a.covered}) cannot be greater than the total (${a.total})`);if(a.total<0)throw new Error(`The number of covered items (${a.total}) cannot be negative`)}}var x_t=class a{constructor(i,e,t,o,n=[]){this.uri=i;this.statementCoverage=e;this.branchCoverage=t;this.declarationCoverage=o;this.includesTests=n}static fromDetails(i,e){let t=new HQe(0,0),o=new HQe(0,0),n=new HQe(0,0);for(let s of e)if("branches"in s){t.total+=1,t.covered+=s.executed?1:0;for(let l of s.branches)o.total+=1,o.covered+=l.executed?1:0}else n.total+=1,n.covered+=s.executed?1:0;let r=new a(i,t,o.total>0?o:void 0,n.total>0?n:void 0);return r.detailedCoverage=e,r}},k_t=class{constructor(i,e,t=[]){this.executed=i;this.location=e;this.branches=t}get executionCount(){return+this.executed}set executionCount(i){this.executed=i}},E_t=class{constructor(i,e,t){this.executed=i;this.location=e;this.label=t}get executionCount(){return+this.executed}set executionCount(i){this.executed=i}},T_t=class{constructor(i,e,t){this.name=i;this.executed=e;this.location=t}get executionCount(){return+this.executed}set executionCount(i){this.executed=i}};var __t=class{constructor(i,e,t,o,n,r){this.kind=i,this.name=e,this.detail=t,this.uri=o,this.range=n,this.selectionRange=r}};var UQe=class{constructor(i){if(typeof i!="string"&&i.isTrusted===!0)throw new Error("The boolean form of MarkdownString.isTrusted is NOT supported for chat participants.");this.value=typeof i=="string"?new eT(i):i}},zQe=class{constructor(i,e){if(typeof i!="string"&&i.isTrusted===!0)throw new Error("The boolean form of MarkdownString.isTrusted is NOT supported for chat participants.");this.value=typeof i=="string"?new eT(i):i,this.vulnerabilities=e}},D_t=class{constructor(i,e,t,o){this.title=i,this.message=e,this.data=t,this.buttons=o}},KQe=class{constructor(i,e){this.value=i,this.baseUri=e}},GQe=class{constructor(i,e,t){this.value=i,this.title=e,this.readOnly=t}};var L_t=class{constructor(i,e,t,o){this.description=i,this.agentName=e,this.prompt=t,this.result=o}};var qQe=class{constructor(i,e){this.value=i,this.value2=i,this.title=e}},$Qe=class{constructor(i){this.value=i}};var jQe=class{constructor(i,e,t){this.value=i,this.id=e,this.metadata=t}},QQe=class{constructor(i,e,t,o){this.hookType=i,this.stopReason=e,this.systemMessage=t,this.metadata=o}},YQe=class{constructor(i){if(typeof i!="string"&&i.isTrusted===!0)throw new Error("The boolean form of MarkdownString.isTrusted is NOT supported for chat participants.");this.value=typeof i=="string"?new eT(i):i}},XQe=class{constructor(i){this.value=i}},JQe=class{constructor(i,e,t){this.value=i,this.iconPath=e,this.options=t}},ZQe=class{constructor(i,e,t){this.value=i,this.isEdit=e,this.undoStopId=t}},R_t=class{constructor(i,e,t){this.value=i,this.license=e,this.snippet=t}},e6e=class{constructor(i,e){this.uri=i;this.range=e}},M_t=class{constructor(i){this.extensions=i}},P_t=class{constructor(i,e,t,o,n){this.title=e;this.description=t;this.author=o;this.linkTag=n;km(i)?(this.uri=i,this.command={title:"Open Pull Request",command:"vscode.open",arguments:[i]}):this.command=i}toJSON(){return{$mid:26,uri:this.uri,title:this.title,description:this.description,author:this.author}}};var A_t=class{constructor(i,e,t,o){this.id=i,this.type=e,this.title=t,this.message=o?.message,this.options=o?.options,this.defaultValue=o?.defaultValue,this.allowFreeformInput=o?.allowFreeformInput}},t6e=class{constructor(i,e=!0){this.questions=i,this.allowSkip=e}},i6e=class{constructor(i,e){this.uri=i,e===!0?(this.isDone=!0,this.edits=[]):this.edits=Array.isArray(e)?e:[e]}},N_t=class{constructor(i,e){this.uri=i,e===!0?(this.isDone=!0,this.edits=[]):this.edits=Array.isArray(e)?e:[e]}},O_t=class{constructor(i){this.edits=i}};var o6e=class{constructor(i,e,t){this.toolName=i,this.toolCallId=e,this.errorMessage=t}};var BJi=class a{constructor(i){this.id=i}static{this.Agent=new a("agent")}static{this.Skill=new a("skill")}static{this.Instructions=new a("instructions")}static{this.Prompt=new a("prompt")}static{this.Hook=new a("hook")}};var F_t=class{constructor(i,e,t){this.mimeType=i,this.data=e,this.reference=t}},W_t=class{constructor(i){this.diagnostics=i}};var Fde=class{constructor(i,e,t){this.callId=i,this.content=e,this.isError=t??!1}};var V_t=class a{constructor(i,e,t){this._content=[];this.role=i,this.content=e,this.name=t}static User(i,e){return new a(1,i,e)}static Assistant(i,e){return new a(2,i,e)}set content(i){typeof i=="string"?this._content=[new aI(i)]:this._content=i}get content(){return this._content}},B_t=class a{constructor(i,e,t){this._content=[];this.role=i,this.content=e,this.name=t}static User(i,e){return new a(1,i,e)}static Assistant(i,e){return new a(2,i,e)}set content(i){typeof i=="string"?this._content=[new aI(i)]:this._content=i}get content(){return this._content}set content2(i){i&&(this.content=i.map(e=>typeof e=="string"?new aI(e):e))}get content2(){return this.content.map(i=>i instanceof aI?i.value:i)}},Wde=class{constructor(i,e,t){this.callId=i,this.name=e,this.input=t}};var aI=class{constructor(i,e){this.value=i,e=e}toJSON(){return{$mid:21,value:this.value,audience:this.audience}}},iT=class a{constructor(i,e,t){this.mimeType=e,this.data=i,this.audience=t}static image(i,e){return new a(i,e)}static json(i,e="text/x-json"){let t=JSON.stringify(i,void 0,"	");return new a(qe.fromString(t).buffer,e)}static text(i,e=tr.text){return new a(qe.fromString(i).buffer,e)}toJSON(){return{$mid:24,mimeType:this.mimeType,data:this.data,audience:this.audience}}};var IEe=class{constructor(i,e,t){this.value=i,this.id=e,this.metadata=t}toJSON(){return{$mid:22,value:this.value,id:this.id,metadata:this.metadata}}},IK=class{constructor(i){this.value=i}toJSON(){return{$mid:23,value:this.value}}};var H_t=class a extends Error{static$c="LanguageModelError";static NotFound(i){return new a(i,a.NotFound.name)}static NoPermissions(i){return new a(i,a.NoPermissions.name)}static Blocked(i){return new a(i,a.Blocked.name)}static tryDeserialize(i){if(i.name===a.$c)return new a(i.message,i.code,i.cause)}constructor(i,e,t){super(i,{cause:t}),this.name=a.$c,this.code=e??""}},n6e=class{constructor(i){this.content=i}toJSON(){return{$mid:20,content:this.content}}};var U_t=class{constructor(i,e){this.id=i;this.label=e}},z_t=class{constructor(i,e,t){this.label=i;this.name=e;this.instructions=t}};var K_t=class{constructor(i,e,t,o={},n,r){this.label=i;this.command=e;this.args=t;this.env=o;this.version=n;this.metadata=r}},G_t=class{constructor(i,e,t={},o,n,r){this.label=i;this.uri=e;this.headers=t;this.version=o;this.metadata=n;this.authentication=r}};function CF(a){switch(a.type){case"light":return We.fromHex("#F3F3F3");case"hcLight":return We.fromHex("#FFFFFF");case"hcDark":return We.fromHex("#000000");default:return We.fromHex("#252526")}}var X_t=te("tab.activeBackground",Ho,d(5049,null)),$Ji=te("tab.unfocusedActiveBackground",X_t,d(5069,null)),Vmi=te("tab.inactiveBackground",{dark:"#2D2D2D",light:"#ECECEC",hcDark:null,hcLight:null},d(5061,null)),jJi=te("tab.unfocusedInactiveBackground",Vmi,d(5074,null)),IB=te("tab.activeForeground",{dark:We.white,light:"#333333",hcDark:We.white,hcLight:"#292929"},d(5052,null)),GJi=te("tab.inactiveForeground",{dark:ai(IB,.5),light:ai(IB,.7),hcDark:We.white,hcLight:"#292929"},d(5062,null)),QJi=te("tab.unfocusedActiveForeground",{dark:ai(IB,.5),light:ai(IB,.7),hcDark:We.white,hcLight:"#292929"},d(5070,null)),roa=te("tab.unfocusedInactiveForeground",{dark:ai(GJi,.5),light:ai(GJi,.5),hcDark:We.white,hcLight:"#292929"},d(5075,null)),$_t=te("tab.hoverBackground",null,d(5058,null)),YJi=te("tab.unfocusedHoverBackground",{dark:ai($_t,.5),light:ai($_t,.7),hcDark:null,hcLight:null},d(5071,null)),j_t=te("tab.hoverForeground",null,d(5060,null)),XJi=te("tab.unfocusedHoverForeground",{dark:ai(j_t,.5),light:ai(j_t,.5),hcDark:null,hcLight:null},d(5073,null)),a6e=te("tab.border",{dark:"#252526",light:"#F3F3F3",hcDark:bi,hcLight:bi},d(5056,null)),JJi=te("tab.lastPinnedBorder",{dark:Vye,light:Vye,hcDark:bi,hcLight:bi},d(4964,null)),yEe=te("tab.activeBorder",null,d(5050,null)),ZJi=te("tab.unfocusedActiveBorder",{dark:ai(yEe,.5),light:ai(yEe,.7),hcDark:null,hcLight:null},d(5054,null)),s6e=te("tab.activeBorderTop",{dark:null,light:null,hcDark:null,hcLight:"#B5200D"},d(5051,null)),eZi=te("tab.unfocusedActiveBorderTop",{dark:ai(s6e,.5),light:ai(s6e,.7),hcDark:null,hcLight:"#B5200D"},d(5055,null)),tZi=te("tab.selectedBorderTop",s6e,d(5067,null)),soa=te("tab.selectedBackground",X_t,d(5066,null)),aoa=te("tab.selectedForeground",IB,d(5068,null)),Q_t=te("tab.hoverBorder",null,d(5059,null)),iZi=te("tab.unfocusedHoverBorder",{dark:ai(Q_t,.5),light:ai(Q_t,.7),hcDark:null,hcLight:bi},d(5072,null)),loa=te("tab.dragAndDropBorder",{dark:IB,light:IB,hcDark:Ys,hcLight:Ys},d(5057,null)),wEe=te("tab.activeModifiedBorder",{dark:"#3399CC",light:"#33AAEE",hcDark:null,hcLight:bi},d(5053,null)),Y_t=te("tab.inactiveModifiedBorder",{dark:ai(wEe,.5),light:ai(wEe,.5),hcDark:We.white,hcLight:bi},d(5063,null)),oZi=te("tab.unfocusedActiveModifiedBorder",{dark:ai(wEe,.5),light:ai(wEe,.7),hcDark:We.white,hcLight:bi},d(5081,null)),nZi=te("tab.unfocusedInactiveModifiedBorder",{dark:ai(Y_t,.5),light:ai(Y_t,.5),hcDark:We.white,hcLight:bi},d(5082,null)),l6e=te("editorPane.background",Ho,d(4960,null)),rZi=te("editorGroup.emptyBackground",null,d(4957,null)),coa=te("editorGroup.focusedEmptyBorder",{dark:null,light:null,hcDark:Sd,hcLight:Sd},d(4958,null)),J_t=te("editorGroupHeader.tabsBackground",{dark:"#252526",light:"#F3F3F3",hcDark:null,hcLight:null},d(5064,null)),sZi=te("editorGroupHeader.tabsBorder",null,d(5065,null)),aZi=te("editorGroupHeader.noTabsBackground",Ho,d(4959,null)),lZi=te("editorGroupHeader.border",{dark:null,light:null,hcDark:bi,hcLight:bi},d(4961,null)),Z_t=te("editorGroup.border",{dark:"#444444",light:"#E7E7E7",hcDark:bi,hcLight:bi},d(4956,null)),oT=te("editorGroup.dropBackground",{dark:We.fromHex("#53595D").transparent(.5),light:We.fromHex("#2677CB").transparent(.18),hcDark:null,hcLight:We.fromHex("#0F4A85").transparent(.5)},d(4952,null)),cZi=te("editorGroup.dropIntoPromptForeground",jL,d(4955,null)),dZi=te("editorGroup.dropIntoPromptBackground",Su,d(4953,null)),uZi=te("editorGroup.dropIntoPromptBorder",{dark:null,light:null,hcDark:bi,hcLight:bi},d(4954,null)),pZi=te("sideBySideEditor.horizontalBorder",Z_t,d(5015,null)),mZi=te("sideBySideEditor.verticalBorder",Z_t,d(5016,null)),n$o=te("outputView.background",null,d(4979,null));te("outputViewStickyScroll.background",n$o,d(4980,null));var doa=te("banner.background",{dark:ow,light:ep(ow,.3),hcDark:ow,hcLight:ow},d(4940,null)),uoa=te("banner.foreground",T_,d(4941,null)),poa=te("banner.iconForeground",Dm,d(4942,null)),PR=te("statusBar.foreground",{dark:"#FFFFFF",light:"#FFFFFF",hcDark:"#FFFFFF",hcLight:Id},d(5024,null)),hZi=te("statusBar.noFolderForeground",PR,d(5036,null)),eDt=te("statusBar.background",{dark:"#007ACC",light:"#007ACC",hcDark:null,hcLight:null},d(5017,null)),tDt=te("statusBar.noFolderBackground",{dark:"#68217A",light:"#68217A",hcDark:null,hcLight:null},d(5034,null)),Vde=te("statusBar.border",{dark:null,light:null,hcDark:bi,hcLight:bi},d(5018,null)),gZi=te("statusBar.focusBorder",{dark:PR,light:PR,hcDark:null,hcLight:PR},d(5023,null)),fZi=te("statusBar.noFolderBorder",Vde,d(5035,null)),moa=te("statusBarItem.activeBackground",{dark:We.white.transparent(.18),light:We.white.transparent(.18),hcDark:We.white.transparent(.18),hcLight:We.black.transparent(.18)},d(5025,null)),vZi=te("statusBarItem.focusBorder",{dark:PR,light:PR,hcDark:null,hcLight:Ys},d(5027,null)),SB=te("statusBarItem.hoverBackground",{dark:We.white.transparent(.12),light:We.black.transparent(.12),hcDark:We.black,hcLight:We.white},d(5028,null)),c6e=te("statusBarItem.hoverForeground",PR,d(5029,null)),bZi=te("statusBarItem.compactHoverBackground",{dark:We.white.transparent(.12),light:We.black.transparent(.12),hcDark:We.black,hcLight:We.white},d(5026,null)),hoa=te("statusBarItem.prominentForeground",PR,d(5040,null)),goa=te("statusBarItem.prominentBackground",We.black.transparent(.5),d(5039,null)),foa=te("statusBarItem.prominentHoverForeground",c6e,d(5042,null)),voa=te("statusBarItem.prominentHoverBackground",SB,d(5041,null)),Bmi=te("statusBarItem.errorBackground",{dark:ep(sle,.4),light:ep(sle,.4),hcDark:null,hcLight:"#B5200D"},d(5019,null)),boa=te("statusBarItem.errorForeground",We.white,d(5020,null)),Soa=te("statusBarItem.errorHoverForeground",c6e,d(5022,null)),Ioa=te("statusBarItem.errorHoverBackground",SB,d(5021,null)),SZi=te("statusBarItem.warningBackground",{dark:ep(jh,.4),light:ep(jh,.4),hcDark:null,hcLight:"#895503"},d(5045,null)),yoa=te("statusBarItem.warningForeground",We.white,d(5046,null)),woa=te("statusBarItem.warningHoverForeground",c6e,d(5048,null)),Coa=te("statusBarItem.warningHoverBackground",SB,d(5047,null)),iDt=te("activityBar.background",{dark:"#333333",light:"#2C2C2C",hcDark:"#000000",hcLight:"#FFFFFF"},d(4927,null)),yK=te("activityBar.foreground",{dark:We.white,light:We.white,hcDark:We.white,hcLight:Id},d(4932,null)),IZi=te("activityBar.inactiveForeground",{dark:ai(yK,.4),light:ai(yK,.4),hcDark:We.white,hcLight:Id},d(4933,null)),oDt=te("activityBar.border",{dark:null,light:null,hcDark:bi,hcLight:bi},d(4930,null)),Hmi=te("activityBar.activeBorder",{dark:yK,light:yK,hcDark:bi,hcLight:bi},d(4925,null)),yZi=te("activityBar.activeFocusBorder",{dark:null,light:null,hcDark:null,hcLight:"#B5200D"},d(4926,null)),Umi=te("activityBar.activeBackground",null,d(4924,null)),wZi=te("activityBar.dropBorder",{dark:yK,light:yK,hcDark:null,hcLight:null},d(4931,null)),xF=te("activityBarBadge.background",{dark:"#007ACC",light:"#007ACC",hcDark:"#000000",hcLight:"#0F4A85"},d(4928,null)),kF=te("activityBarBadge.foreground",We.white,d(4929,null)),q5=te("activityBarTop.foreground",{dark:"#E7E7E7",light:"#424242",hcDark:We.white,hcLight:Id},d(4934,null)),nDt=te("activityBarTop.activeBorder",{dark:q5,light:q5,hcDark:bi,hcLight:"#B5200D"},d(4936,null)),xoa=te("activityBarTop.activeBackground",null,d(4935,null)),rDt=te("activityBarTop.inactiveForeground",{dark:ai(q5,.6),light:ai(q5,.75),hcDark:We.white,hcLight:Id},d(4939,null)),sDt=te("activityBarTop.dropBorder",q5,d(4938,null)),koa=te("activityBarTop.background",null,d(4937,null)),lI=te("panel.background",Ho,d(4983,null)),vf=te("panel.border",{dark:We.fromHex("#808080").transparent(.35),light:We.fromHex("#808080").transparent(.35),hcDark:bi,hcLight:bi},d(4984,null)),CZi=te("panelTitle.border",{dark:null,light:null,hcDark:vf,hcLight:vf},d(4998,null)),$5=te("panelTitle.activeForeground",{dark:"#E7E7E7",light:"#424242",hcDark:We.white,hcLight:Id},d(4982,null)),aDt=te("panelTitle.inactiveForeground",{dark:ai($5,.6),light:ai($5,.75),hcDark:We.white,hcLight:Id},d(4986,null)),lDt=te("panelTitle.activeBorder",{dark:$5,light:$5,hcDark:bi,hcLight:"#B5200D"},d(4981,null)),xZi=te("panelTitleBadge.background",xF,d(4996,null)),kZi=te("panelTitleBadge.foreground",kF,d(4997,null)),Eoa=te("panelInput.border",{dark:nw,light:We.fromHex("#ddd"),hcDark:nw,hcLight:nw},d(4987,null)),cDt=te("panel.dropBorder",$5,d(4985,null)),d6e=te("panelSection.dropBackground",oT,d(4989,null)),EZi=te("panelSectionHeader.background",{dark:We.fromHex("#808080").transparent(.2),light:We.fromHex("#808080").transparent(.2),hcDark:null,hcLight:null},d(4990,null)),TZi=te("panelSectionHeader.foreground",null,d(4992,null)),_Zi=te("panelSectionHeader.border",bi,d(4991,null)),dDt=te("panelSection.border",vf,d(4988,null)),DZi=te("panelStickyScroll.background",lI,d(4993,null)),LZi=te("panelStickyScroll.border",null,d(4994,null)),RZi=te("panelStickyScroll.shadow",U1,d(4995,null)),Toa=te("browser.border",a6e,d(4943,null)),_oa=te("profileBadge.background",{dark:"#4D4D4D",light:"#C4C4C4",hcDark:We.white,hcLight:We.black},d(4999,null)),Doa=te("profileBadge.foreground",{dark:We.white,light:"#333333",hcDark:We.black,hcLight:We.white},d(5000,null)),MZi=te("statusBarItem.remoteBackground",xF,d(5032,null)),r$o=te("statusBarItem.remoteForeground",kF,d(5033,null)),Loa=te("statusBarItem.remoteHoverForeground",c6e,d(5044,null)),Roa=te("statusBarItem.remoteHoverBackground",{dark:SB,light:SB,hcDark:SB,hcLight:null},d(5043,null)),Moa=te("statusBarItem.offlineBackground","#6c1717",d(5030,null)),Poa=te("statusBarItem.offlineForeground",r$o,d(5031,null)),Aoa=te("statusBarItem.offlineHoverForeground",c6e,d(5038,null)),Noa=te("statusBarItem.offlineHoverBackground",{dark:SB,light:SB,hcDark:SB,hcLight:null},d(5037,null)),PZi=te("extensionBadge.remoteBackground",xF,d(4962,null)),AZi=te("extensionBadge.remoteForeground",kF,d(4963,null)),bf=te("sideBar.background",{dark:"#252526",light:"#F3F3F3",hcDark:"#000000",hcLight:"#FFFFFF"},d(5002,null)),CK=te("sideBar.foreground",null,d(5005,null)),wK=te("sideBar.border",{dark:null,light:null,hcDark:bi,hcLight:bi},d(5003,null)),Ooa=te("sideBarTitle.background",bf,d(5012,null)),NZi=te("sideBarTitle.foreground",CK,d(5014,null)),uDt=te("sideBarTitle.border",{dark:null,light:null,hcDark:wK,hcLight:wK},d(5013,null)),j5=te("sideBar.dropBackground",oT,d(5004,null)),OZi=te("sideBarSectionHeader.background",{dark:We.fromHex("#808080").transparent(.2),light:We.fromHex("#808080").transparent(.2),hcDark:null,hcLight:null},d(5006,null)),FZi=te("sideBarSectionHeader.foreground",CK,d(5008,null)),zmi=te("sideBarSectionHeader.border",bi,d(5007,null)),Foa=te("sideBarActivityBarTop.border",zmi,d(5001,null)),WZi=te("sideBarStickyScroll.background",bf,d(5009,null)),VZi=te("sideBarStickyScroll.border",null,d(5010,null)),BZi=te("sideBarStickyScroll.shadow",U1,d(5011,null)),wF=te("titleBar.activeForeground",{dark:"#CCCCCC",light:"#333333",hcDark:"#FFFFFF",hcLight:"#292929"},d(5077,null)),pDt=te("titleBar.inactiveForeground",{dark:ai(wF,.6),light:ai(wF,.6),hcDark:null,hcLight:"#292929"},d(5080,null)),NX=te("titleBar.activeBackground",{dark:"#3C3C3C",light:"#DDDDDD",hcDark:"#000000",hcLight:"#FFFFFF"},d(5076,null)),HZi=te("titleBar.inactiveBackground",{dark:ai(NX,.6),light:ai(NX,.6),hcDark:null,hcLight:null},d(5079,null)),mDt=te("titleBar.border",{dark:null,light:null,hcDark:bi,hcLight:bi},d(5078,null)),s$o=te("menubar.selectionForeground",wF,d(4967,null)),qJi=te("menubar.selectionBackground",{dark:ale,light:ale,hcDark:null,hcLight:null},d(4965,null)),Woa=te("menubar.selectionBorder",{dark:null,light:null,hcDark:Ys,hcLight:Ys},d(4966,null)),Voa=te("commandCenter.foreground",wF,d(4949,null),!1),Boa=te("commandCenter.activeForeground",s$o,d(4946,null),!1),Hoa=te("commandCenter.inactiveForeground",pDt,d(4951,null),!1),UZi=te("commandCenter.background",{dark:We.white.transparent(.05),hcDark:null,light:We.black.transparent(.05),hcLight:null},d(4947,null),!1),Uoa=te("commandCenter.activeBackground",{dark:We.white.transparent(.08),hcDark:qJi,light:We.black.transparent(.08),hcLight:qJi},d(4944,null),!1),zoa=te("commandCenter.border",{dark:ai(wF,.2),hcDark:bi,light:ai(wF,.2),hcLight:bi},d(4948,null),!1),Koa=te("commandCenter.activeBorder",{dark:ai(wF,.3),hcDark:wF,light:ai(wF,.3),hcLight:wF},d(4945,null),!1),Goa=te("commandCenter.inactiveBorder",ai(pDt,.25),d(4950,null),!1),zZi=te("notificationCenter.border",{dark:E_,light:E_,hcDark:bi,hcLight:bi},d(4968,null)),KZi=te("notificationToast.border",{dark:E_,light:E_,hcDark:bi,hcLight:bi},d(4978,null)),qoa=te("notifications.foreground",jL,d(4974,null)),AX=te("notifications.background",Su,d(4971,null)),$oa=te("notificationLink.foreground",nS,d(4976,null)),GZi=te("notificationCenterHeader.foreground",null,d(4970,null)),Kmi=te("notificationCenterHeader.background",{dark:cb(AX,.3),light:ep(AX,.05),hcDark:AX,hcLight:AX},d(4969,null)),joa=te("notifications.border",Kmi,d(4972,null)),Qoa=te("notificationsErrorIcon.foreground",Iv,d(4973,null)),Yoa=te("notificationsWarningIcon.foreground",jh,d(4977,null)),Xoa=te("notificationsInfoIcon.foreground",Dm,d(4975,null)),CEe=te("window.activeBorder",{dark:null,light:null,hcDark:bi,hcLight:bi},d(5083,null)),xEe=te("window.inactiveBorder",{dark:null,light:null,hcDark:bi,hcLight:bi},d(5084,null));var hDt=le("IExtensionStatusBarItemService");var u6e=class{constructor(i){this._statusbarService=i;this._entries=new Map;this._onDidChange=new E;this.onDidChange=this._onDidChange.event}dispose(){this._entries.forEach(i=>i.accessor.dispose()),this._entries.clear(),this._onDidChange.dispose()}setOrUpdateEntry(i,e,t,o,n,r,s,l,c,u,p,h){let g,f;if(h)g=h.label,f=h.role;else if(g=xz(n),typeof r=="string"||Ar(r)){let w=typeof r=="string"?r:r.value;g+=`, ${w}`}let v;switch(c?.id){case Bmi:case SZi:v=c.id===Bmi?"error":"warning",l=void 0,c=void 0}let b={name:o,text:n,tooltip:r,command:s,color:l,backgroundColor:c,ariaLabel:g,role:f,kind:v,extensionId:t};typeof p>"u"&&(p=0);let S=u?0:1,y=this._entries.get(i);if(y&&(S=y.alignment,p=y.priority),y)return y.accessor.update(b),y.entry=b,1;{let w;typeof t=="string"?w={primary:p,secondary:_r(t)}:w=p;let k=this._statusbarService.addEntry(b,e,S,w);return this._entries.set(i,{accessor:k,entry:b,alignment:S,priority:p,disposable:Z(()=>{k.dispose(),this._entries.delete(i),this._onDidChange.fire({removed:i})})}),this._onDidChange.fire({added:[i,{entry:b,alignment:S,priority:p}]}),0}}unsetEntry(i){this._entries.get(i)?.disposable.dispose(),this._entries.delete(i)}getEntries(){return this._entries.entries()}};u6e=I([m(0,kr)],u6e);Ee(hDt,u6e,1);function l$o(a){let i=a;return typeof i.id=="string"&&i.id.length>0&&typeof i.name=="string"&&typeof i.text=="string"&&(i.alignment==="left"||i.alignment==="right")&&(i.command===void 0||typeof i.command=="string")&&(i.tooltip===void 0||typeof i.tooltip=="string")&&(i.priority===void 0||typeof i.priority=="number")&&(i.accessibilityInformation===void 0||L$i(i.accessibilityInformation))}var qZi={type:"object",required:["id","text","alignment","name"],properties:{id:{type:"string",markdownDescription:d(3366,null)},name:{type:"string",description:d(3368,null)},text:{type:"string",description:d(3370,null,"$(globe)")},tooltip:{type:"string",description:d(3371,null)},command:{type:"string",description:d(3365,null)},alignment:{type:"string",enum:["left","right"],description:d(3364,null)},priority:{type:"number",description:d(3369,null)},accessibilityInformation:{type:"object",description:d(3361,null),required:["label"],properties:{role:{type:"string",description:d(3363,null)},label:{type:"string",description:d(3362,null)}}}}},c$o={description:d(3372,null),oneOf:[qZi,{type:"array",items:qZi}]},$Zi=Rn.registerExtensionPoint({extensionPoint:"statusBarItems",jsonSchema:c$o}),kEe=class{constructor(i){let e=new N;$Zi.setHandler(t=>{e.clear();for(let o of t){if(!Ua(o.description,"contribStatusBarItems")){o.collector.error(`The ${$Zi.name} is proposed API`);continue}let{value:n,collector:r}=o;for(let s of vt.wrap(n)){if(!l$o(s)){r.error(d(3367,null));continue}let l=UJi(o.description.identifier,s.id);i.setOrUpdateEntry(l,l,Ii.toKey(o.description.identifier),s.name??o.description.displayName??o.description.name,s.text,s.tooltip,s.command?{id:s.command,title:s.name}:void 0,void 0,void 0,s.alignment==="left",s.priority,s.accessibilityInformation)===0&&e.add(Z(()=>i.unsetEntry(l)))}}})}};kEe=I([m(0,hDt)],kEe);var Bde=/^([^.]+\..+)[:=](.+)$/,Eu=class{constructor(i,e,t){this._args=i;this.paths=e;this.productService=t}get appRoot(){return ad(vn.asFileUri("").fsPath)}get userHome(){return A.file(this.paths.homeDir)}get userDataPath(){return this.paths.userDataDir}get appSettingsHome(){return A.file(Yc(this.userDataPath,"User"))}get tmpDir(){return A.file(this.paths.tmpDir)}get cacheHome(){return A.file(this.userDataPath)}get stateResource(){return Ge(this.appSettingsHome,"globalStorage","storage.json")}get userRoamingDataHome(){return this.appSettingsHome.with({scheme:Q.vscodeUserData})}get userDataSyncHome(){return Ge(this.appSettingsHome,"sync")}get logsHome(){if(!this.args.logsPath){let i=aft(new Date).replace(/-|:|\.\d+Z$/g,"");this.args.logsPath=Yc(this.userDataPath,"logs",i)}return A.file(this.args.logsPath)}get sync(){return this.args.sync}get workspaceStorageHome(){return Ge(this.appSettingsHome,"workspaceStorage")}get localHistoryHome(){return Ge(this.appSettingsHome,"History")}get keyboardLayoutResource(){return Ge(this.userRoamingDataHome,"keyboardLayout.json")}get argvResource(){let i=$u.VSCODE_PORTABLE;return i?A.file(Yc(i,"argv.json")):Ge(this.userHome,this.productService.dataFolderName,"argv.json")}get isExtensionDevelopment(){return!!this.args.extensionDevelopmentPath}get untitledWorkspacesHome(){return A.file(Yc(this.userDataPath,"Workspaces"))}get builtinExtensionsPath(){let i=this.args["builtin-extensions-dir"];return i?cP(i):ch(Yc(vn.asFileUri("").fsPath,"..","extensions"))}get extensionsDownloadLocation(){let i=this.args["extensions-download-dir"];return i?A.file(cP(i)):A.file(Yc(this.userDataPath,"CachedExtensionVSIXs"))}get extensionsPath(){let i=this.args["extensions-dir"];if(i)return cP(i);let e=$u.VSCODE_EXTENSIONS;if(e)return e;let t=$u.VSCODE_PORTABLE;return t?Yc(t,"extensions"):Ge(this.userHome,this.productService.dataFolderName,"extensions").fsPath}get agentPluginsPath(){let i=this.args["agent-plugins-dir"];if(i)return cP(i);let e=$u.VSCODE_AGENT_PLUGINS;if(e)return e;let t=$u.VSCODE_PORTABLE;return t?Yc(t,"agent-plugins"):Ge(this.userHome,this.productService.dataFolderName,"agent-plugins").fsPath}get extensionDevelopmentLocationURI(){let i=this.args.extensionDevelopmentPath;if(Array.isArray(i))return i.map(e=>/^[^:/?#]+?:\/\//.test(e)?A.parse(e):A.file(ch(e)))}get extensionDevelopmentKind(){return this.args.extensionDevelopmentKind?.map(i=>i==="ui"||i==="workspace"||i==="web"?i:"workspace")}get extensionTestsLocationURI(){let i=this.args.extensionTestsPath;if(i)return/^[^:/?#]+?:\/\//.test(i)?A.parse(i):A.file(ch(i))}get disableExtensions(){if(this.args["disable-extensions"])return!0;let i=this.args["disable-extension"];if(i){if(typeof i=="string")return[i];if(Array.isArray(i)&&i.length>0)return i}return!1}get debugExtensionHost(){return d$o(this.args,this.isBuilt)}get debugRenderer(){return!!this.args.debugRenderer}get isBuilt(){return!$u.VSCODE_DEV}get verbose(){return!!this.args.verbose}get logLevel(){return this.args.log?.find(i=>!Bde.test(i))}get extensionLogLevel(){let i=[];for(let e of this.args.log||[]){let t=Bde.exec(e);t?.[1]&&t[2]&&i.push([t[1],t[2]])}return i.length?i:void 0}get serviceMachineIdResource(){return Ge(A.file(this.userDataPath),"machineid")}get crashReporterId(){return this.args["crash-reporter-id"]}get crashReporterDirectory(){return this.args["crash-reporter-directory"]}get disableTelemetry(){return!!this.args["disable-telemetry"]}get disableExperiments(){return!!this.args["disable-experiments"]}get disableWorkspaceTrust(){return!!this.args["disable-workspace-trust"]}get useInMemorySecretStorage(){return!!this.args["use-inmemory-secretstorage"]}get policyFile(){if(this.args["__enable-file-policy"]){let i=$u.VSCODE_PORTABLE;return i?A.file(Yc(i,"policy.json")):Ge(this.userHome,this.productService.dataFolderName,"policy.json")}}get agentSessionsWorkspace(){return Ge(this.appSettingsHome,"agent-sessions.code-workspace")}get editSessionId(){return this.args.editSessionId}get exportPolicyData(){return this.args["export-policy-data"]}get exportDefaultKeybindings(){return this.args["export-default-keybindings"]}get continueOn(){return this.args.continueOn}set continueOn(i){this.args.continueOn=i}get args(){return this._args}};I([hi],Eu.prototype,"appRoot",1),I([hi],Eu.prototype,"userHome",1),I([hi],Eu.prototype,"userDataPath",1),I([hi],Eu.prototype,"appSettingsHome",1),I([hi],Eu.prototype,"tmpDir",1),I([hi],Eu.prototype,"cacheHome",1),I([hi],Eu.prototype,"stateResource",1),I([hi],Eu.prototype,"userRoamingDataHome",1),I([hi],Eu.prototype,"userDataSyncHome",1),I([hi],Eu.prototype,"sync",1),I([hi],Eu.prototype,"workspaceStorageHome",1),I([hi],Eu.prototype,"localHistoryHome",1),I([hi],Eu.prototype,"keyboardLayoutResource",1),I([hi],Eu.prototype,"argvResource",1),I([hi],Eu.prototype,"isExtensionDevelopment",1),I([hi],Eu.prototype,"untitledWorkspacesHome",1),I([hi],Eu.prototype,"builtinExtensionsPath",1),I([hi],Eu.prototype,"extensionsDownloadLocation",1),I([hi],Eu.prototype,"extensionsPath",1),I([hi],Eu.prototype,"agentPluginsPath",1),I([hi],Eu.prototype,"extensionDevelopmentLocationURI",1),I([hi],Eu.prototype,"extensionDevelopmentKind",1),I([hi],Eu.prototype,"extensionTestsLocationURI",1),I([hi],Eu.prototype,"debugExtensionHost",1),I([hi],Eu.prototype,"logLevel",1),I([hi],Eu.prototype,"extensionLogLevel",1),I([hi],Eu.prototype,"serviceMachineIdResource",1),I([hi],Eu.prototype,"disableTelemetry",1),I([hi],Eu.prototype,"disableExperiments",1),I([hi],Eu.prototype,"disableWorkspaceTrust",1),I([hi],Eu.prototype,"useInMemorySecretStorage",1),I([hi],Eu.prototype,"policyFile",1),I([hi],Eu.prototype,"agentSessionsWorkspace",1);function d$o(a,i){return u$o(a["inspect-extensions"],a["inspect-brk-extensions"],5870,i,a.debugId,a.extensionEnvironment)}function u$o(a,i,e,t,o,n){let s=Number(i||a)||(t?null:e),l=s?!!i:!1,c;if(n)try{c=JSON.parse(n)}catch{}return{port:s,break:l,debugId:o,env:c}}var cd=Eo,rc=class{constructor(i,e,t,o){this.workspaceId=i;this.logsHome=e;this.options=t;this.productService=o;this.extensionHostDebugEnvironment=void 0;if(t.workspaceProvider&&Array.isArray(t.workspaceProvider.payload))try{this.payload=new Map(t.workspaceProvider.payload)}catch(n){mt(n)}}get remoteAuthority(){return this.options.remoteAuthority}get expectsResolverExtension(){return!!this.options.remoteAuthority?.includes("+")&&!this.options.webSocketFactory}get isBuilt(){return!!this.productService.commit}get logLevel(){let i=this.payload?.get("logLevel");return i?i.split(",").find(e=>!Bde.test(e)):this.options.developmentOptions?.logLevel!==void 0?IC(this.options.developmentOptions?.logLevel):void 0}get extensionLogLevel(){let i=this.payload?.get("logLevel");if(i){let e=[];for(let t of i.split(",")){let o=Bde.exec(t);o?.[1]&&o[2]&&e.push([o[1],o[2]])}return e.length?e:void 0}return this.options.developmentOptions?.extensionLogLevel!==void 0?this.options.developmentOptions?.extensionLogLevel.map(([e,t])=>[e,IC(t)]):void 0}get profDurationMarkers(){let i=this.payload?.get("profDurationMarkers");if(i){let e=[];for(let t of i.split(","))e.push(t);return e.length===2?e:void 0}}get windowLogsPath(){return this.logsHome}get logFile(){return Ge(this.windowLogsPath,"window.log")}get userRoamingDataHome(){return A.file("/User").with({scheme:Q.vscodeUserData})}get argvResource(){return Ge(this.userRoamingDataHome,"argv.json")}get cacheHome(){return Ge(this.userRoamingDataHome,"caches")}get workspaceStorageHome(){return Ge(this.userRoamingDataHome,"workspaceStorage")}get localHistoryHome(){return Ge(this.userRoamingDataHome,"History")}get stateResource(){return Ge(this.userRoamingDataHome,"State","storage.json")}get userDataSyncHome(){return Ge(this.userRoamingDataHome,"sync",this.workspaceId)}get sync(){}get keyboardLayoutResource(){return Ge(this.userRoamingDataHome,"keyboardLayout.json")}get untitledWorkspacesHome(){return Ge(this.userRoamingDataHome,"Workspaces")}get serviceMachineIdResource(){return Ge(this.userRoamingDataHome,"machineid")}get extHostLogsPath(){return Ge(this.logsHome,"exthost")}get agentPluginsHome(){return Ge(this.userRoamingDataHome,"agent-plugins")}get debugExtensionHost(){return this.extensionHostDebugEnvironment||(this.extensionHostDebugEnvironment=this.resolveExtensionHostDebugEnvironment()),this.extensionHostDebugEnvironment.params}get isExtensionDevelopment(){return this.extensionHostDebugEnvironment||(this.extensionHostDebugEnvironment=this.resolveExtensionHostDebugEnvironment()),this.extensionHostDebugEnvironment.isExtensionDevelopment}get extensionDevelopmentLocationURI(){return this.extensionHostDebugEnvironment||(this.extensionHostDebugEnvironment=this.resolveExtensionHostDebugEnvironment()),this.extensionHostDebugEnvironment.extensionDevelopmentLocationURI}get extensionDevelopmentLocationKind(){return this.extensionHostDebugEnvironment||(this.extensionHostDebugEnvironment=this.resolveExtensionHostDebugEnvironment()),this.extensionHostDebugEnvironment.extensionDevelopmentKind}get extensionTestsLocationURI(){return this.extensionHostDebugEnvironment||(this.extensionHostDebugEnvironment=this.resolveExtensionHostDebugEnvironment()),this.extensionHostDebugEnvironment.extensionTestsLocationURI}get extensionEnabledProposedApi(){return this.extensionHostDebugEnvironment||(this.extensionHostDebugEnvironment=this.resolveExtensionHostDebugEnvironment()),this.extensionHostDebugEnvironment.extensionEnabledProposedApi}get debugRenderer(){return this.extensionHostDebugEnvironment||(this.extensionHostDebugEnvironment=this.resolveExtensionHostDebugEnvironment()),this.extensionHostDebugEnvironment.debugRenderer}get enableSmokeTestDriver(){return this.options.developmentOptions?.enableSmokeTestDriver}get disableExtensions(){return this.payload?.get("disableExtensions")==="true"}get enableExtensions(){return this.options.enabledExtensions}get webviewExternalEndpoint(){let i=this.options.webviewEndpoint||this.productService.webviewContentExternalBaseUrlTemplate||"https://{{uuid}}.vscode-cdn.net/{{quality}}/{{commit}}/out/vs/workbench/contrib/webview/browser/pre/",e=this.payload?.get("webviewExternalEndpointCommit");return i.replace("{{commit}}",e??this.productService.commit??"ef65ac1ba57f57f2a3961bfe94aa20481caca4c6").replace("{{quality}}",(e?"insider":this.productService.quality)??"insider")}get extensionTelemetryLogResource(){return Ge(this.logsHome,"extensionTelemetry.log")}get disableTelemetry(){return!1}get disableExperiments(){return!1}get verbose(){return this.payload?.get("verbose")==="true"}get logExtensionHostCommunication(){return this.payload?.get("logExtensionHostCommunication")==="true"}get skipReleaseNotes(){return this.payload?.get("skipReleaseNotes")==="true"}get skipWelcome(){return this.payload?.get("skipWelcome")==="true"}get disableWorkspaceTrust(){return!this.options.enableWorkspaceTrust}get isSessionsWindow(){return this.payload?.get("isSessionsWindow")==="true"}get profile(){return this.payload?.get("profile")}get editSessionId(){return this.options.editSessionId}resolveExtensionHostDebugEnvironment(){let i={params:{port:null,break:!1},debugRenderer:!1,isExtensionDevelopment:!1,extensionDevelopmentLocationURI:void 0,extensionDevelopmentKind:void 0};if(this.payload)for(let[t,o]of this.payload)switch(t){case"extensionDevelopmentPath":i.extensionDevelopmentLocationURI||(i.extensionDevelopmentLocationURI=[]),i.extensionDevelopmentLocationURI.push(A.parse(o)),i.isExtensionDevelopment=!0;break;case"extensionDevelopmentKind":i.extensionDevelopmentKind=[o];break;case"extensionTestsPath":i.extensionTestsLocationURI=A.parse(o);break;case"debugRenderer":i.debugRenderer=o==="true";break;case"debugId":i.params.debugId=o;break;case"inspect-brk-extensions":i.params.port=parseInt(o),i.params.break=!0;break;case"inspect-extensions":i.params.port=parseInt(o);break;case"extensionEnvironment":try{i.params.env=JSON.parse(o)}catch(n){mt(n)}break;case"enableProposedApi":i.extensionEnabledProposedApi=[];break}let e=this.options.developmentOptions;return e&&!i.isExtensionDevelopment&&(e.extensions?.length&&(i.extensionDevelopmentLocationURI=e.extensions.map(t=>A.revive(t)),i.isExtensionDevelopment=!0),e.extensionTestsPath&&(i.extensionTestsLocationURI=A.revive(e.extensionTestsPath))),i}get filesToOpenOrCreate(){if(this.payload){let i=this.payload.get("openFile");if(i){let e=A.parse(i);if(this.payload.has("gotoLineMode")){let t=BGi(e.path);return[{fileUri:e.with({path:t.path}),options:{selection:gn(t.line)?void 0:{startLineNumber:t.line,startColumn:t.column||1}}}]}return[{fileUri:e}]}}}get filesToDiff(){if(this.payload){let i=this.payload.get("diffFilePrimary"),e=this.payload.get("diffFileSecondary");if(i&&e)return[{fileUri:A.parse(e)},{fileUri:A.parse(i)}]}}get filesToMerge(){if(this.payload){let i=this.payload.get("mergeFile1"),e=this.payload.get("mergeFile2"),t=this.payload.get("mergeFileBase"),o=this.payload.get("mergeFileResult");if(i&&e&&t&&o)return[{fileUri:A.parse(i)},{fileUri:A.parse(e)},{fileUri:A.parse(t)},{fileUri:A.parse(o)}]}}};I([hi],rc.prototype,"remoteAuthority",1),I([hi],rc.prototype,"expectsResolverExtension",1),I([hi],rc.prototype,"isBuilt",1),I([hi],rc.prototype,"logLevel",1),I([hi],rc.prototype,"windowLogsPath",1),I([hi],rc.prototype,"logFile",1),I([hi],rc.prototype,"userRoamingDataHome",1),I([hi],rc.prototype,"argvResource",1),I([hi],rc.prototype,"cacheHome",1),I([hi],rc.prototype,"workspaceStorageHome",1),I([hi],rc.prototype,"localHistoryHome",1),I([hi],rc.prototype,"stateResource",1),I([hi],rc.prototype,"userDataSyncHome",1),I([hi],rc.prototype,"sync",1),I([hi],rc.prototype,"keyboardLayoutResource",1),I([hi],rc.prototype,"untitledWorkspacesHome",1),I([hi],rc.prototype,"serviceMachineIdResource",1),I([hi],rc.prototype,"extHostLogsPath",1),I([hi],rc.prototype,"agentPluginsHome",1),I([hi],rc.prototype,"debugExtensionHost",1),I([hi],rc.prototype,"isExtensionDevelopment",1),I([hi],rc.prototype,"extensionDevelopmentLocationURI",1),I([hi],rc.prototype,"extensionDevelopmentLocationKind",1),I([hi],rc.prototype,"extensionTestsLocationURI",1),I([hi],rc.prototype,"extensionEnabledProposedApi",1),I([hi],rc.prototype,"debugRenderer",1),I([hi],rc.prototype,"enableSmokeTestDriver",1),I([hi],rc.prototype,"disableExtensions",1),I([hi],rc.prototype,"enableExtensions",1),I([hi],rc.prototype,"webviewExternalEndpoint",1),I([hi],rc.prototype,"extensionTelemetryLogResource",1),I([hi],rc.prototype,"disableTelemetry",1),I([hi],rc.prototype,"disableExperiments",1),I([hi],rc.prototype,"verbose",1),I([hi],rc.prototype,"logExtensionHostCommunication",1),I([hi],rc.prototype,"skipReleaseNotes",1),I([hi],rc.prototype,"skipWelcome",1),I([hi],rc.prototype,"disableWorkspaceTrust",1),I([hi],rc.prototype,"isSessionsWindow",1),I([hi],rc.prototype,"profile",1),I([hi],rc.prototype,"editSessionId",1),I([hi],rc.prototype,"filesToOpenOrCreate",1),I([hi],rc.prototype,"filesToDiff",1),I([hi],rc.prototype,"filesToMerge",1);var sp=Le,jZi="[",QZi="]",p6e="*",YZi=/\[(.+?)\]/g;var rl;(r=>(r.COLOR_THEME_DARK="Dark 2026",r.COLOR_THEME_LIGHT="Light 2026",r.COLOR_THEME_HC_DARK="Default High Contrast",r.COLOR_THEME_HC_LIGHT="Default High Contrast Light",r.FILE_ICON_THEME="vs-seti",r.PRODUCT_ICON_THEME="Default"))(rl||={});function m6e(a){switch(a){case"Default Dark Modern":return"Dark Modern";case"Default Light Modern":return"Light Modern";case"Default Dark+":return"Dark+";case"Default Light+":return"Light+";case"Experimental Dark":case"VS Code Dark":return rl.COLOR_THEME_DARK;case"Experimental Light":case"VS Code Light":return rl.COLOR_THEME_LIGHT}return a}var XZi={"actionBar.toggledBackground":"#383a49","activityBar.activeBorder":"#0078D4","activityBar.background":"#181818","activityBar.border":"#2B2B2B","activityBar.foreground":"#D7D7D7","activityBar.inactiveForeground":"#868686","activityBarBadge.background":"#0078D4","activityBarBadge.foreground":"#FFFFFF","badge.background":"#616161","badge.foreground":"#F8F8F8","button.background":"#0078D4","button.border":"#FFFFFF12","button.foreground":"#FFFFFF","button.hoverBackground":"#026EC1","button.secondaryBackground":"#313131","button.secondaryForeground":"#CCCCCC","button.secondaryHoverBackground":"#3C3C3C","chat.slashCommandBackground":"#26477866","chat.slashCommandForeground":"#85B6FF","chat.editedFileForeground":"#E2C08D","checkbox.background":"#313131","checkbox.border":"#3C3C3C","debugToolBar.background":"#181818",descriptionForeground:"#9D9D9D","dropdown.background":"#313131","dropdown.border":"#3C3C3C","dropdown.foreground":"#CCCCCC","dropdown.listBackground":"#1F1F1F","editor.background":"#1F1F1F","editor.findMatchBackground":"#9E6A03","editor.foreground":"#CCCCCC","editor.inactiveSelectionBackground":"#3A3D41","editor.selectionHighlightBackground":"#ADD6FF26","editorGroup.border":"#FFFFFF17","editorGroupHeader.tabsBackground":"#181818","editorGroupHeader.tabsBorder":"#2B2B2B","editorGutter.addedBackground":"#2EA043","editorGutter.deletedBackground":"#F85149","editorGutter.modifiedBackground":"#0078D4","editorIndentGuide.activeBackground1":"#707070","editorIndentGuide.background1":"#404040","editorLineNumber.activeForeground":"#CCCCCC","editorLineNumber.foreground":"#6E7681","editorOverviewRuler.border":"#010409","editorWidget.background":"#202020",errorForeground:"#F85149",focusBorder:"#0078D4",foreground:"#CCCCCC","icon.foreground":"#CCCCCC","input.background":"#313131","input.border":"#3C3C3C","input.foreground":"#CCCCCC","input.placeholderForeground":"#989898","inputOption.activeBackground":"#2489DB82","inputOption.activeBorder":"#2488DB","keybindingLabel.foreground":"#CCCCCC","list.activeSelectionIconForeground":"#FFF","list.dropBackground":"#383B3D","menu.background":"#1F1F1F","menu.border":"#454545","menu.foreground":"#CCCCCC","menu.selectionBackground":"#0078d4","menu.separatorBackground":"#454545","notificationCenterHeader.background":"#1F1F1F","notificationCenterHeader.foreground":"#CCCCCC","notifications.background":"#1F1F1F","notifications.border":"#2B2B2B","notifications.foreground":"#CCCCCC","panel.background":"#181818","panel.border":"#2B2B2B","panelInput.border":"#2B2B2B","panelTitle.activeBorder":"#0078D4","panelTitle.activeForeground":"#CCCCCC","panelTitle.inactiveForeground":"#9D9D9D","peekViewEditor.background":"#1F1F1F","peekViewEditor.matchHighlightBackground":"#BB800966","peekViewResult.background":"#1F1F1F","peekViewResult.matchHighlightBackground":"#BB800966","pickerGroup.border":"#3C3C3C","ports.iconRunningProcessForeground":"#369432","progressBar.background":"#0078D4","quickInput.background":"#222222","quickInput.foreground":"#CCCCCC","settings.dropdownBackground":"#313131","settings.dropdownBorder":"#3C3C3C","settings.headerForeground":"#FFFFFF","settings.modifiedItemIndicator":"#BB800966","sideBar.background":"#181818","sideBar.border":"#2B2B2B","sideBar.foreground":"#CCCCCC","sideBarSectionHeader.background":"#181818","sideBarSectionHeader.border":"#2B2B2B","sideBarSectionHeader.foreground":"#CCCCCC","sideBarTitle.foreground":"#CCCCCC","statusBar.background":"#181818","statusBar.border":"#2B2B2B","statusBar.debuggingBackground":"#0078D4","statusBar.debuggingForeground":"#FFFFFF","statusBar.focusBorder":"#0078D4","statusBar.foreground":"#CCCCCC","statusBar.noFolderBackground":"#1F1F1F","statusBarItem.focusBorder":"#0078D4","statusBarItem.prominentBackground":"#6E768166","statusBarItem.remoteBackground":"#0078D4","statusBarItem.remoteForeground":"#FFFFFF","tab.activeBackground":"#1F1F1F","tab.activeBorder":"#1F1F1F","tab.activeBorderTop":"#0078D4","tab.activeForeground":"#FFFFFF","tab.border":"#2B2B2B","tab.hoverBackground":"#1F1F1F","tab.inactiveBackground":"#181818","tab.inactiveForeground":"#9D9D9D","tab.lastPinnedBorder":"#ccc3","tab.selectedBackground":"#222222","tab.selectedBorderTop":"#6caddf","tab.selectedForeground":"#ffffffa0","tab.unfocusedActiveBorder":"#1F1F1F","tab.unfocusedActiveBorderTop":"#2B2B2B","tab.unfocusedHoverBackground":"#1F1F1F","terminal.foreground":"#CCCCCC","terminal.inactiveSelectionBackground":"#3A3D41","terminal.tab.activeBorder":"#0078D4","textBlockQuote.background":"#2B2B2B","textBlockQuote.border":"#616161","textCodeBlock.background":"#2B2B2B","textLink.activeForeground":"#4daafc","textLink.foreground":"#4daafc","textPreformat.background":"#3C3C3C","textPreformat.foreground":"#D0D0D0","textSeparator.foreground":"#21262D","titleBar.activeBackground":"#181818","titleBar.activeForeground":"#CCCCCC","titleBar.border":"#2B2B2B","titleBar.inactiveBackground":"#1F1F1F","titleBar.inactiveForeground":"#9D9D9D","welcomePage.progress.foreground":"#0078D4","welcomePage.tileBackground":"#2B2B2B","widget.border":"#313131"},JZi={"actionBar.toggledBackground":"#dddddd","activityBar.activeBorder":"#005FB8","activityBar.background":"#F8F8F8","activityBar.border":"#E5E5E5","activityBar.foreground":"#1F1F1F","activityBar.inactiveForeground":"#616161","activityBarBadge.background":"#005FB8","activityBarBadge.foreground":"#FFFFFF","badge.background":"#CCCCCC","badge.foreground":"#3B3B3B","button.background":"#005FB8","button.border":"#0000001a","button.foreground":"#FFFFFF","button.hoverBackground":"#0258A8","button.secondaryBackground":"#E5E5E5","button.secondaryForeground":"#3B3B3B","button.secondaryHoverBackground":"#CCCCCC","chat.slashCommandBackground":"#ADCEFF7A","chat.slashCommandForeground":"#26569E","chat.editedFileForeground":"#895503","checkbox.background":"#F8F8F8","checkbox.border":"#CECECE",descriptionForeground:"#3B3B3B","diffEditor.unchangedRegionBackground":"#f8f8f8","dropdown.background":"#FFFFFF","dropdown.border":"#CECECE","dropdown.foreground":"#3B3B3B","dropdown.listBackground":"#FFFFFF","editor.background":"#FFFFFF","editor.foreground":"#3B3B3B","editor.inactiveSelectionBackground":"#E5EBF1","editor.selectionHighlightBackground":"#ADD6FF80","editorGroup.border":"#E5E5E5","editorGroupHeader.tabsBackground":"#F8F8F8","editorGroupHeader.tabsBorder":"#E5E5E5","editorGutter.addedBackground":"#2EA043","editorGutter.deletedBackground":"#F85149","editorGutter.modifiedBackground":"#005FB8","editorIndentGuide.activeBackground1":"#939393","editorIndentGuide.background1":"#D3D3D3","editorLineNumber.activeForeground":"#171184","editorLineNumber.foreground":"#6E7681","editorOverviewRuler.border":"#E5E5E5","editorSuggestWidget.background":"#F8F8F8","editorWidget.background":"#F8F8F8",errorForeground:"#F85149",focusBorder:"#005FB8",foreground:"#3B3B3B","icon.foreground":"#3B3B3B","input.background":"#FFFFFF","input.border":"#CECECE","input.foreground":"#3B3B3B","input.placeholderForeground":"#767676","inputOption.activeBackground":"#BED6ED","inputOption.activeBorder":"#005FB8","inputOption.activeForeground":"#000000","keybindingLabel.foreground":"#3B3B3B","list.activeSelectionBackground":"#E8E8E8","list.activeSelectionForeground":"#000000","list.activeSelectionIconForeground":"#000000","list.focusAndSelectionOutline":"#005FB8","list.hoverBackground":"#F2F2F2","menu.border":"#CECECE","menu.selectionBackground":"#005FB8","menu.selectionForeground":"#ffffff","notebook.cellBorderColor":"#E5E5E5","notebook.selectedCellBackground":"#C8DDF150","notificationCenterHeader.background":"#FFFFFF","notificationCenterHeader.foreground":"#3B3B3B","notifications.background":"#FFFFFF","notifications.border":"#E5E5E5","notifications.foreground":"#3B3B3B","panel.background":"#F8F8F8","panel.border":"#E5E5E5","panelInput.border":"#E5E5E5","panelTitle.activeBorder":"#005FB8","panelTitle.activeForeground":"#3B3B3B","panelTitle.inactiveForeground":"#3B3B3B","peekViewEditor.matchHighlightBackground":"#BB800966","peekViewResult.background":"#FFFFFF","peekViewResult.matchHighlightBackground":"#BB800966","pickerGroup.border":"#E5E5E5","pickerGroup.foreground":"#8B949E","ports.iconRunningProcessForeground":"#369432","progressBar.background":"#005FB8","quickInput.background":"#F8F8F8","quickInput.foreground":"#3B3B3B","searchEditor.textInputBorder":"#CECECE","settings.dropdownBackground":"#FFFFFF","settings.dropdownBorder":"#CECECE","settings.headerForeground":"#1F1F1F","settings.modifiedItemIndicator":"#BB800966","settings.numberInputBorder":"#CECECE","settings.textInputBorder":"#CECECE","sideBar.background":"#F8F8F8","sideBar.border":"#E5E5E5","sideBar.foreground":"#3B3B3B","sideBarSectionHeader.background":"#F8F8F8","sideBarSectionHeader.border":"#E5E5E5","sideBarSectionHeader.foreground":"#3B3B3B","sideBarTitle.foreground":"#3B3B3B","statusBar.background":"#F8F8F8","statusBar.border":"#E5E5E5","statusBar.debuggingBackground":"#FD716C","statusBar.debuggingForeground":"#000000","statusBar.focusBorder":"#005FB8","statusBar.foreground":"#3B3B3B","statusBar.noFolderBackground":"#F8F8F8","statusBarItem.compactHoverBackground":"#CCCCCC","statusBarItem.errorBackground":"#C72E0F","statusBarItem.focusBorder":"#005FB8","statusBarItem.hoverBackground":"#B8B8B850","statusBarItem.prominentBackground":"#6E768166","statusBarItem.remoteBackground":"#005FB8","statusBarItem.remoteForeground":"#FFFFFF","tab.activeBackground":"#FFFFFF","tab.activeBorder":"#F8F8F8","tab.activeBorderTop":"#005FB8","tab.activeForeground":"#3B3B3B","tab.border":"#E5E5E5","tab.hoverBackground":"#FFFFFF","tab.inactiveBackground":"#F8F8F8","tab.inactiveForeground":"#868686","tab.lastPinnedBorder":"#D4D4D4","tab.selectedBackground":"#ffffffa5","tab.selectedBorderTop":"#68a3da","tab.selectedForeground":"#333333b3","tab.unfocusedActiveBorder":"#F8F8F8","tab.unfocusedActiveBorderTop":"#E5E5E5","tab.unfocusedHoverBackground":"#F8F8F8","terminal.foreground":"#3B3B3B","terminal.inactiveSelectionBackground":"#E5EBF1","terminal.tab.activeBorder":"#005FB8","terminalCursor.foreground":"#005FB8","textBlockQuote.background":"#F8F8F8","textBlockQuote.border":"#E5E5E5","textCodeBlock.background":"#F8F8F8","textLink.activeForeground":"#005FB8","textLink.foreground":"#005FB8","textPreformat.background":"#0000001F","textPreformat.foreground":"#3B3B3B","textSeparator.foreground":"#21262D","titleBar.activeBackground":"#F8F8F8","titleBar.activeForeground":"#1E1E1E","titleBar.border":"#E5E5E5","titleBar.inactiveBackground":"#F8F8F8","titleBar.inactiveForeground":"#8B949E","welcomePage.tileBackground":"#F3F3F3","widget.border":"#E5E5E5"},nT;(t=>{function a(o){return o&&{_extensionId:o.extensionId,_extensionIsBuiltin:o.extensionIsBuiltin,_extensionName:o.extensionName,_extensionPublisher:o.extensionPublisher}}t.toJSONObject=a;function i(o){if(o&&Fe(o._extensionId)&&Wa(o._extensionIsBuiltin)&&Fe(o._extensionName)&&Fe(o._extensionPublisher))return{extensionId:o._extensionId,extensionIsBuiltin:o._extensionIsBuiltin,extensionName:o._extensionName,extensionPublisher:o._extensionPublisher}}t.fromJSONObject=i;function e(o,n,r=!1){return{extensionPublisher:o,extensionId:`${o}.${n}`,extensionName:n,extensionIsBuiltin:r}}t.fromName=e})(nT||={});var Gmi="workbench.contrib.css.cache",ZZi=Rn.registerExtensionPoint({extensionPoint:"css",jsonSchema:{description:d(18007,null),type:"array",items:{type:"object",properties:{path:{description:d(18008,null),type:"string"}},required:["path"]},defaultSnippets:[{body:[{path:"${1:styles.css}"}]}]}}),qmi=class{constructor(i,e,t){this.fileService=i;this.environmentService=e;this.onUpdate=t;this.watchedLocations=new Map}watch(i){let e=i.toString();if(this.watchedLocations.has(e)||!this.environmentService.isExtensionDevelopment)return;let t=new N;t.add(this.fileService.watch(i)),t.add(this.fileService.onDidFilesChange(o=>{o.contains(i,0)&&this.onUpdate(i)})),this.watchedLocations.set(e,{uri:i,disposables:t})}unwatch(i){let e=i.toString(),t=this.watchedLocations.get(e);t&&(t.disposables.dispose(),this.watchedLocations.delete(e))}dispose(){for(let i of this.watchedLocations.values())i.disposables.dispose();this.watchedLocations.clear()}},EEe=class{constructor(i,e,t,o){this.themeService=t;this.storageService=o;this.disposables=new N;this.stylesheetsByExtension=new Map;this.pendingExtensions=new Map;this.watcher=this.disposables.add(new qmi(i,e,n=>this.reloadStylesheet(n))),this.disposables.add(Z(()=>{for(let n of this.stylesheetsByExtension.values())for(let r of n)r.disposables.dispose();this.stylesheetsByExtension.clear()})),this.applyCachedCSS(),this.disposables.add(this.themeService.onDidColorThemeChange(()=>this.onThemeChange())),this.disposables.add(this.themeService.onDidFileIconThemeChange(()=>this.onThemeChange())),this.disposables.add(this.themeService.onDidProductIconThemeChange(()=>this.onThemeChange())),ZZi.setHandler((n,r)=>{for(let s of r.removed){let l=s.description.identifier.value;this.pendingExtensions.delete(l),this.removeStylesheets(l),this.clearCacheForExtension(l)}for(let s of r.added){if(!Ua(s.description,"css")){s.collector.error(`The '${ZZi.name}' contribution point is proposed API.`);continue}let l=s.value,c=s.collector;if(!l||!Array.isArray(l)){c.error(d(18009,null));continue}let u=s.description.identifier.value;this.pendingExtensions.set(u,s),this.isExtensionThemeActive(u)?this.activateExtensionCSS(s):this.stylesheetsByExtension.has(u)&&(this.removeStylesheets(u),this.clearCacheForExtension(u))}})}isExtensionThemeActive(i){let e=this.themeService.getColorTheme(),t=this.themeService.getFileIconTheme(),o=this.themeService.getProductIconTheme();return!!(e.extensionData&&Ii.equals(e.extensionData.extensionId,i))||!!(t.extensionData&&Ii.equals(t.extensionData.extensionId,i))||!!(o.extensionData&&Ii.equals(o.extensionData.extensionId,i))}onThemeChange(){for(let[i,e]of this.pendingExtensions)!this.stylesheetsByExtension.has(i)&&this.isExtensionThemeActive(i)&&this.activateExtensionCSS(e);for(let i of this.stylesheetsByExtension.keys())this.isExtensionThemeActive(i)||(this.removeStylesheets(i),this.clearCacheForExtension(i))}activateExtensionCSS(i){let e=i.description.identifier.value;if(this.stylesheetsByExtension.has(e))return;let t=i.description.extensionLocation,o=i.value,n=i.collector,r=[],s=[];for(let l of o){if(!l.path||typeof l.path!="string"){n.error(d(18010,null));continue}let c=Ge(t,l.path);if(!ws(c,t)){n.warn(d(18011,null,c.path,t.path));continue}let u=new N,p=this.createCSSLinkElement(c,e,u);r.push({uri:c,element:p,disposables:u}),s.push(c.toString()),this.watcher.watch(c)}r.length>0&&(this.stylesheetsByExtension.set(e,r),this.cacheExtensionCSS(e,s))}removeStylesheets(i){let e=this.stylesheetsByExtension.get(i);if(e){for(let t of e)this.watcher.unwatch(t.uri),t.disposables.dispose();this.stylesheetsByExtension.delete(i)}}applyCachedCSS(){let i=this.getCachedCSS();if(!i)return;if(!this.isExtensionThemeActive(i.extensionId)){this.clearCacheForExtension(i.extensionId);return}let e=[];for(let t of i.cssLocations){let o=A.parse(t),n=new N,r=this.createCSSLinkElement(o,i.extensionId,n);e.push({uri:o,element:r,disposables:n}),this.watcher.watch(o)}e.length>0&&this.stylesheetsByExtension.set(i.extensionId,e)}getCachedCSS(){let i=this.storageService.get(Gmi,0);if(i)try{return JSON.parse(i)}catch{return}}cacheExtensionCSS(i,e){let t={extensionId:i,cssLocations:e};this.storageService.store(Gmi,JSON.stringify(t),0,1)}clearCacheForExtension(i){let e=this.getCachedCSS();e&&Ii.equals(e.extensionId,i)&&this.storageService.remove(Gmi,0)}createCSSLinkElement(i,e,t){let o=xgt();return o.rel="stylesheet",o.type="text/css",o.className=`extension-contributed-css ${e}`,o.href=vn.uriToBrowserUri(i).toString(!0),t.add(Z(()=>o.remove())),o}reloadStylesheet(i){let e=i.toString();for(let t of this.stylesheetsByExtension.values())for(let o of t)if(o.uri.toString()===e){let n=vn.uriToBrowserUri(i);o.element.href=n.with({query:`v=${Date.now()}`}).toString(!0)}}dispose(){this.disposables.dispose()}};EEe=I([m(0,fe),m(1,cd),m(2,sp),m(3,ce)],EEe);var h6e=class a{constructor(i){this._proxyIdentifierBrand=void 0;this.sid=i,this.nid=++a.count}static{this.count=0}},eeo=[];function Yi(a){let i=new h6e(a);return eeo[i.nid]=i,i}function g6e(a){return eeo[a].sid}var ag=class{constructor(i){this.value=i}};var teo=class a{static{this._n=0}static mixin(i){return i._id=a._n++,i}};var qi={MainThreadAuthentication:Yi("MainThreadAuthentication"),MainThreadBulkEdits:Yi("MainThreadBulkEdits"),MainThreadLanguageModels:Yi("MainThreadLanguageModels"),MainThreadEmbeddings:Yi("MainThreadEmbeddings"),MainThreadChatAgents2:Yi("MainThreadChatAgents2"),MainThreadCodeMapper:Yi("MainThreadCodeMapper"),MainThreadLanguageModelTools:Yi("MainThreadChatSkills"),MainThreadGitExtension:Yi("MainThreadGitExtension"),MainThreadClipboard:Yi("MainThreadClipboard"),MainThreadCommands:Yi("MainThreadCommands"),MainThreadComments:Yi("MainThreadComments"),MainThreadConfiguration:Yi("MainThreadConfiguration"),MainThreadConsole:Yi("MainThreadConsole"),MainThreadDebugService:Yi("MainThreadDebugService"),MainThreadDecorations:Yi("MainThreadDecorations"),MainThreadDiagnostics:Yi("MainThreadDiagnostics"),MainThreadDialogs:Yi("MainThreadDiaglogs"),MainThreadDocuments:Yi("MainThreadDocuments"),MainThreadDocumentContentProviders:Yi("MainThreadDocumentContentProviders"),MainThreadTextEditors:Yi("MainThreadTextEditors"),MainThreadEditorInsets:Yi("MainThreadEditorInsets"),MainThreadEditorTabs:Yi("MainThreadEditorTabs"),MainThreadErrors:Yi("MainThreadErrors"),MainThreadTreeViews:Yi("MainThreadTreeViews"),MainThreadDownloadService:Yi("MainThreadDownloadService"),MainThreadLanguageFeatures:Yi("MainThreadLanguageFeatures"),MainThreadLanguages:Yi("MainThreadLanguages"),MainThreadLogger:Yi("MainThreadLogger"),MainThreadMessageService:Yi("MainThreadMessageService"),MainThreadOutputService:Yi("MainThreadOutputService"),MainThreadProgress:Yi("MainThreadProgress"),MainThreadQuickDiff:Yi("MainThreadQuickDiff"),MainThreadQuickOpen:Yi("MainThreadQuickOpen"),MainThreadStatusBar:Yi("MainThreadStatusBar"),MainThreadSecretState:Yi("MainThreadSecretState"),MainThreadStorage:Yi("MainThreadStorage"),MainThreadSpeech:Yi("MainThreadSpeechProvider"),MainThreadTelemetry:Yi("MainThreadTelemetry"),MainThreadMeteredConnection:Yi("MainThreadMeteredConnection"),MainThreadTerminalService:Yi("MainThreadTerminalService"),MainThreadTerminalShellIntegration:Yi("MainThreadTerminalShellIntegration"),MainThreadWebviews:Yi("MainThreadWebviews"),MainThreadWebviewPanels:Yi("MainThreadWebviewPanels"),MainThreadWebviewViews:Yi("MainThreadWebviewViews"),MainThreadCustomEditors:Yi("MainThreadCustomEditors"),MainThreadUrls:Yi("MainThreadUrls"),MainThreadUriOpeners:Yi("MainThreadUriOpeners"),MainThreadProfileContentHandlers:Yi("MainThreadProfileContentHandlers"),MainThreadWorkspace:Yi("MainThreadWorkspace"),MainThreadFileSystem:Yi("MainThreadFileSystem"),MainThreadFileSystemEventService:Yi("MainThreadFileSystemEventService"),MainThreadExtensionService:Yi("MainThreadExtensionService"),MainThreadSCM:Yi("MainThreadSCM"),MainThreadSearch:Yi("MainThreadSearch"),MainThreadShare:Yi("MainThreadShare"),MainThreadTask:Yi("MainThreadTask"),MainThreadWindow:Yi("MainThreadWindow"),MainThreadPower:Yi("MainThreadPower"),MainThreadLabelService:Yi("MainThreadLabelService"),MainThreadNotebook:Yi("MainThreadNotebook"),MainThreadNotebookDocuments:Yi("MainThreadNotebookDocumentsShape"),MainThreadNotebookEditors:Yi("MainThreadNotebookEditorsShape"),MainThreadNotebookKernels:Yi("MainThreadNotebookKernels"),MainThreadNotebookRenderers:Yi("MainThreadNotebookRenderers"),MainThreadInteractive:Yi("MainThreadInteractive"),MainThreadTheming:Yi("MainThreadTheming"),MainThreadTunnelService:Yi("MainThreadTunnelService"),MainThreadManagedSockets:Yi("MainThreadManagedSockets"),MainThreadTimeline:Yi("MainThreadTimeline"),MainThreadTesting:Yi("MainThreadTesting"),MainThreadLocalization:Yi("MainThreadLocalizationShape"),MainThreadMcp:Yi("MainThreadMcpShape"),MainThreadAiRelatedInformation:Yi("MainThreadAiRelatedInformation"),MainThreadAiEmbeddingVector:Yi("MainThreadAiEmbeddingVector"),MainThreadChatStatus:Yi("MainThreadChatStatus"),MainThreadAiSettingsSearch:Yi("MainThreadAiSettingsSearch"),MainThreadDataChannels:Yi("MainThreadDataChannels"),MainThreadChatSessions:Yi("MainThreadChatSessions"),MainThreadChatOutputRenderer:Yi("MainThreadChatOutputRenderer"),MainThreadChatContext:Yi("MainThreadChatContext"),MainThreadChatDebug:Yi("MainThreadChatDebug"),MainThreadBrowsers:Yi("MainThreadBrowsers")},to={ExtHostCodeMapper:Yi("ExtHostCodeMapper"),ExtHostCommands:Yi("ExtHostCommands"),ExtHostConfiguration:Yi("ExtHostConfiguration"),ExtHostDiagnostics:Yi("ExtHostDiagnostics"),ExtHostDebugService:Yi("ExtHostDebugService"),ExtHostDecorations:Yi("ExtHostDecorations"),ExtHostDocumentsAndEditors:Yi("ExtHostDocumentsAndEditors"),ExtHostDocuments:Yi("ExtHostDocuments"),ExtHostDocumentContentProviders:Yi("ExtHostDocumentContentProviders"),ExtHostDocumentSaveParticipant:Yi("ExtHostDocumentSaveParticipant"),ExtHostEditors:Yi("ExtHostEditors"),ExtHostTreeViews:Yi("ExtHostTreeViews"),ExtHostFileSystem:Yi("ExtHostFileSystem"),ExtHostFileSystemInfo:Yi("ExtHostFileSystemInfo"),ExtHostFileSystemEventService:Yi("ExtHostFileSystemEventService"),ExtHostLanguages:Yi("ExtHostLanguages"),ExtHostLanguageFeatures:Yi("ExtHostLanguageFeatures"),ExtHostQuickOpen:Yi("ExtHostQuickOpen"),ExtHostQuickDiff:Yi("ExtHostQuickDiff"),ExtHostStatusBar:Yi("ExtHostStatusBar"),ExtHostShare:Yi("ExtHostShare"),ExtHostExtensionService:Yi("ExtHostExtensionService"),ExtHostLogLevelServiceShape:Yi("ExtHostLogLevelServiceShape"),ExtHostTerminalService:Yi("ExtHostTerminalService"),ExtHostTerminalShellIntegration:Yi("ExtHostTerminalShellIntegration"),ExtHostSCM:Yi("ExtHostSCM"),ExtHostSearch:Yi("ExtHostSearch"),ExtHostTask:Yi("ExtHostTask"),ExtHostWorkspace:Yi("ExtHostWorkspace"),ExtHostWindow:Yi("ExtHostWindow"),ExtHostPower:Yi("ExtHostPower"),ExtHostWebviews:Yi("ExtHostWebviews"),ExtHostWebviewPanels:Yi("ExtHostWebviewPanels"),ExtHostCustomEditors:Yi("ExtHostCustomEditors"),ExtHostWebviewViews:Yi("ExtHostWebviewViews"),ExtHostEditorInsets:Yi("ExtHostEditorInsets"),ExtHostEditorTabs:Yi("ExtHostEditorTabs"),ExtHostProgress:Yi("ExtHostProgress"),ExtHostComments:Yi("ExtHostComments"),ExtHostSecretState:Yi("ExtHostSecretState"),ExtHostStorage:Yi("ExtHostStorage"),ExtHostUrls:Yi("ExtHostUrls"),ExtHostUriOpeners:Yi("ExtHostUriOpeners"),ExtHostChatOutputRenderer:Yi("ExtHostChatOutputRenderer"),ExtHostProfileContentHandlers:Yi("ExtHostProfileContentHandlers"),ExtHostOutputService:Yi("ExtHostOutputService"),ExtHostLabelService:Yi("ExtHostLabelService"),ExtHostNotebook:Yi("ExtHostNotebook"),ExtHostNotebookDocuments:Yi("ExtHostNotebookDocuments"),ExtHostNotebookEditors:Yi("ExtHostNotebookEditors"),ExtHostNotebookKernels:Yi("ExtHostNotebookKernels"),ExtHostNotebookRenderers:Yi("ExtHostNotebookRenderers"),ExtHostNotebookDocumentSaveParticipant:Yi("ExtHostNotebookDocumentSaveParticipant"),ExtHostInteractive:Yi("ExtHostInteractive"),ExtHostChatAgents2:Yi("ExtHostChatAgents"),ExtHostLanguageModelTools:Yi("ExtHostChatSkills"),ExtHostChatProvider:Yi("ExtHostChatProvider"),ExtHostChatContext:Yi("ExtHostChatContext"),ExtHostChatDebug:Yi("ExtHostChatDebug"),ExtHostSpeech:Yi("ExtHostSpeech"),ExtHostEmbeddings:Yi("ExtHostEmbeddings"),ExtHostAiRelatedInformation:Yi("ExtHostAiRelatedInformation"),ExtHostAiEmbeddingVector:Yi("ExtHostAiEmbeddingVector"),ExtHostAiSettingsSearch:Yi("ExtHostAiSettingsSearch"),ExtHostTheming:Yi("ExtHostTheming"),ExtHostTunnelService:Yi("ExtHostTunnelService"),ExtHostManagedSockets:Yi("ExtHostManagedSockets"),ExtHostAuthentication:Yi("ExtHostAuthentication"),ExtHostTimeline:Yi("ExtHostTimeline"),ExtHostTesting:Yi("ExtHostTesting"),ExtHostTelemetry:Yi("ExtHostTelemetry"),ExtHostMeteredConnection:Yi("ExtHostMeteredConnection"),ExtHostLocalization:Yi("ExtHostLocalization"),ExtHostMcp:Yi("ExtHostMcp"),ExtHostDataChannels:Yi("ExtHostDataChannels"),ExtHostChatSessions:Yi("ExtHostChatSessions"),ExtHostGitExtension:Yi("ExtHostGitExtension"),ExtHostBrowsers:Yi("ExtHostBrowsers")};function fo(a){return function(i){_Ee.INSTANCE.registerNamedCustomer(a,i)}}function AR(a){_Ee.INSTANCE.registerCustomer(a)}var gDt;(e=>{function a(){return _Ee.INSTANCE.getNamedCustomers()}e.getNamedCustomers=a;function i(){return _Ee.INSTANCE.getCustomers()}e.getCustomers=i})(gDt||={});var _Ee=class a{static{this.INSTANCE=new a}constructor(){this._namedCustomers=[],this._customers=[]}registerNamedCustomer(i,e){let t=[i,e];this._namedCustomers.push(t)}getNamedCustomers(){return this._namedCustomers}registerCustomer(i){this._customers.push(i)}getCustomers(){return this._customers}};function OX(a){return a.tags.find(i=>i.startsWith("lp-"))?.split("lp-")[1]}var Q5=le("languagePackService"),fDt=class extends x{constructor(e){super();this.extensionGalleryService=e}async getAvailableLanguages(){let e=new Ye;setTimeout(()=>e.cancel(),1e3);let t;try{t=await this.extensionGalleryService.query({text:'category:"language packs"',pageSize:20},e.token)}catch{return[]}let n=t.firstPage.filter(r=>r.properties.localizedLanguages?.length&&r.tags.some(s=>s.startsWith("lp-"))).map(r=>{let s=r.properties.localizedLanguages?.[0],l=OX(r);return{...this.createQuickPickItem(l,s,r),extensionId:r.identifier.id,galleryExtension:r}});return n.push(this.createQuickPickItem("en","English")),n}createQuickPickItem(e,t,o){let n=t??e,r;if(n!==e&&(r=`(${e})`),e.toLowerCase()===wr.toLowerCase()&&(r??="",r+=d(2178,null)),o?.installCount){r??="";let s=o.installCount,l;s>1e6?l=`${Math.floor(s/1e5)/10}M`:s>1e3?l=`${Math.floor(s/1e3)}K`:l=String(s),r+=` $(cloud-download) ${l}`}return{id:e,label:n,description:r}}};fDt=I([m(0,fa)],fDt);var vDt=class extends x{constructor(e,t,o){super();this.fileService=t;this.languagePackService=o}async $fetchBuiltInBundleUri(e,t){try{return await this.languagePackService.getBuiltInExtensionTranslationsUri(e,t)}catch{return}}async $fetchBundleContents(e){return(await this.fileService.readFile(A.revive(e))).value.toString()}};vDt=I([fo(qi.MainThreadLocalization),m(1,fe),m(2,Q5)],vDt);var qo={EditorPane:"workbench.contributions.editors",EditorFactory:"workbench.contributions.editor.inputFactories"},la={id:"default",displayName:d(4920,null),providerDisplayName:d(4917,null)},ieo="workbench.editor.sidebysideEditor",WX="workbench.editors.textDiffEditor",bDt="workbench.editors.binaryResourceDiffEditor";function Hde(a){let i=a;return!!i&&typeof i.getSelection=="function"&&!!i.onDidChangeSelection}function SDt(a){let i=a;return!!i&&typeof i.getScrollPosition=="function"&&typeof i.setScrollPosition=="function"&&!!i.onDidChangeScroll}function Y5(a,i,e){for(let t of e.visibleEditorPanes)if(t.group.id===i&&a.matches(t.input))return t.getViewState()}function Sf(a){if(ka(a))return!1;let i=a;return A.isUri(i?.resource)}function Ib(a){if(ka(a))return!1;let i=a;return i?.original!==void 0&&i.modified!==void 0}function FX(a){if(ka(a))return!1;let i=a;return!i||i.resources&&!Array.isArray(i.resources)?!1:!!i.resources||!!i.multiDiffSource}function Z_(a){if(ka(a)||Ib(a))return!1;let i=a;return i?.primary!==void 0&&i.secondary!==void 0}function DEe(a){if(ka(a))return!1;let i=a;return i?i.resource===void 0||i.resource.scheme===Q.untitled||i.forceUntitled===!0:!1}function WC(a){if(ka(a))return!1;let i=a;return A.isUri(i?.base?.resource)&&A.isUri(i?.input1?.resource)&&A.isUri(i?.input2?.resource)&&A.isUri(i?.result?.resource)}var $mi=class{constructor(){this.mapIdToSaveSource=new Map}registerSource(i,e){let t=this.mapIdToSaveSource.get(i);return t||(t={source:i,label:e},this.mapIdToSaveSource.set(i,t)),t.source}getSourceLabel(i){return this.mapIdToSaveSource.get(i)?.label??i}},Ih=new $mi;var f6e=class extends x{};function ka(a){return a instanceof f6e}function p$o(a){let i=a;return A.isUri(i?.preferredResource)}function Ymi(a){let i=a;return ka(i?.primary)&&ka(i?.secondary)}function X5(a){let i=a;return ka(i?.modified)&&ka(i?.original)}function LEe(a,i,e,t,o){return t4(t,[ii({id:"workbench.action.openLargeFile",label:d(4919,null),run:()=>{let n={...e,limits:{size:Number.MAX_VALUE}};a.openEditor(i,n)}}),ii({id:"workbench.action.configureEditorLargeFileConfirmation",label:d(4918,null),run:()=>o.openUserSettings({query:"workbench.editorLargeFileConfirmation"})})],{forceMessage:!0,forceSeverity:bt.Warning})}function EF(a){return ka(a?.editor)}function J5(a){let i=a;return EF(a)&&i?.group!==void 0}function v6e(a){let i=a;return typeof i?.groupId=="number"&&ka(i.editor)}function Ude(a){return typeof a?.groupId=="number"}var jmi=class{getOriginalUri(i,e){if(!i)return;if(WC(i))return po.getOriginalUri(i.result,e);if(e?.supportSideBySide){let{primary:o,secondary:n}=this.getSideEditors(i);if(o&&n){if(e?.supportSideBySide===3)return{primary:this.getOriginalUri(o,{filterByScheme:e.filterByScheme}),secondary:this.getOriginalUri(n,{filterByScheme:e.filterByScheme})};if(e?.supportSideBySide===4)return this.getOriginalUri(o,{filterByScheme:e.filterByScheme})??this.getOriginalUri(n,{filterByScheme:e.filterByScheme});i=e.supportSideBySide===1?o:n}}if(Ib(i)||FX(i)||Z_(i)||WC(i))return;let t=p$o(i)?i.preferredResource:i.resource;return!t||!e?.filterByScheme?t:this.filterUri(t,e.filterByScheme)}getSideEditors(i){return Ymi(i)||Z_(i)?{primary:i.primary,secondary:i.secondary}:X5(i)||Ib(i)?{primary:i.modified,secondary:i.original}:{primary:void 0,secondary:void 0}}getCanonicalUri(i,e){if(!i)return;if(WC(i))return po.getCanonicalUri(i.result,e);if(e?.supportSideBySide){let{primary:o,secondary:n}=this.getSideEditors(i);if(o&&n){if(e?.supportSideBySide===3)return{primary:this.getCanonicalUri(o,{filterByScheme:e.filterByScheme}),secondary:this.getCanonicalUri(n,{filterByScheme:e.filterByScheme})};if(e?.supportSideBySide===4)return this.getCanonicalUri(o,{filterByScheme:e.filterByScheme})??this.getCanonicalUri(n,{filterByScheme:e.filterByScheme});i=e.supportSideBySide===1?o:n}}if(Ib(i)||FX(i)||Z_(i)||WC(i))return;let t=i.resource;return!t||!e?.filterByScheme?t:this.filterUri(t,e.filterByScheme)}filterUri(i,e){if(Array.isArray(e)){if(e.some(t=>i.scheme===t))return i}else if(e===i.scheme)return i}};function REe(a,i,e,t){if(!a.isSticky(i))return!1;switch(t.preventPinnedEditorClose){case"keyboardAndMouse":return e===2||e===1;case"mouse":return e===2;case"keyboard":return e===1}return!1}var po=new jmi;var Qmi=class{constructor(){this.editorSerializerConstructors=new Map;this.editorSerializerInstances=new Map}start(i){let e=this.instantiationService=i.get(F);for(let[t,o]of this.editorSerializerConstructors)this.createEditorSerializer(t,o,e);this.editorSerializerConstructors.clear()}createEditorSerializer(i,e,t){let o=t.createInstance(e);this.editorSerializerInstances.set(i,o)}registerFileEditorFactory(i){if(this.fileEditorFactory)throw new Error("Can only register one file editor factory.");this.fileEditorFactory=i}getFileEditorFactory(){return Ci(this.fileEditorFactory)}registerEditorSerializer(i,e){if(this.editorSerializerConstructors.has(i)||this.editorSerializerInstances.has(i))throw new Error(`A editor serializer with type ID '${i}' was already registered.`);return this.instantiationService?this.createEditorSerializer(i,e,this.instantiationService):this.editorSerializerConstructors.set(i,e),Z(()=>{this.editorSerializerConstructors.delete(i),this.editorSerializerInstances.delete(i)})}getEditorSerializer(i){return this.editorSerializerInstances.get(typeof i=="string"?i:i.typeId)}};ne.add(qo.EditorFactory,new Qmi);async function MEe(a,i,e){return a?.length?await Promise.all(a.map(async t=>{let o=A.revive(t.fileUri);if(!o){e.info("Cannot resolve the path because it is not valid.",t);return}if(!await i.canHandleResource(o)){e.info("Cannot resolve the path because it cannot be handled",t);return}let r=t.exists,s=t.type;if(typeof r!="boolean"||typeof s!="number")try{s=(await i.stat(o)).isDirectory?2:0,r=!0}catch(c){e.error(c),r=!1}if(!r&&t.openOnlyIfExists){e.info("Cannot resolve the path because it does not exist",t);return}if(s===2){e.info("Cannot resolve the path because it is a directory",t);return}let l={...t.options,pinned:!0};return r?{resource:o,options:l}:{resource:o,options:l,forceUntitled:!0}})):[]}function Z5(a){let i=a;if(!i)return!1;let e=i;if(e.modified)return Z5(e.modified);let t=i;return!!(t.contributionsState&&t.viewState&&Array.isArray(t.cursorState))}function e4(a){return i7(a)}function t4(a,i,e){let t=w1(a,i);return t.forceMessage=e?.forceMessage,t.forceSeverity=e?.forceSeverity,t.allowDialog=e?.allowDialog,t}var bn=le("notebookService"),NR=class{constructor(i,e,t){this.viewType=i;this.serializer=e;this.extensionData=t}};var yh=le("INotebookModelResolverService");var ls=class extends f6e{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,t){return this}async saveAs(e,t){return this}async revert(e,t){}async rename(e,t){}copy(){return this}canMove(e,t){return!0}canReopen(){return!0}matches(e){if(ka(e))return this===e;let t=e.options?.override;return this.editorId!==t&&t!==void 0&&this.editorId!==void 0?!1:Qe(this.resource,po.getCanonicalUri(e))}prefersEditorPane(e){return e.at(0)}toUntyped(e){}isDisposed(){return this._store.isDisposed}dispose(){this.isDisposed()||this._onWillDispose.fire(),super.dispose()}};var cI=class extends x{constructor(e,t,o,n){super();this.getExpression=e;this.shouldUpdate=t;this.contextService=o;this.configurationService=n;this._onExpressionChange=this._register(new E);this.onExpressionChange=this._onExpressionChange.event;this.mapFolderToParsedExpression=new Map;this.mapFolderToConfiguredExpression=new Map;this.updateExpressions(!1),this.registerListeners()}static{this.NO_FOLDER=null}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>{this.shouldUpdate(e)&&this.updateExpressions(!0)})),this._register(this.contextService.onDidChangeWorkspaceFolders(()=>this.updateExpressions(!0)))}updateExpressions(e){let t=!1;for(let s of this.contextService.getWorkspace().folders){let l=s.uri.toString(),c=this.doGetExpression(s.uri),u=this.mapFolderToConfiguredExpression.get(l);c?(!u||!eo(u.expression,c.expression))&&(t=!0,this.mapFolderToParsedExpression.set(l,Ym(c.expression)),this.mapFolderToConfiguredExpression.set(l,c)):u&&(t=!0,this.mapFolderToParsedExpression.delete(l),this.mapFolderToConfiguredExpression.delete(l))}let o=new En(this.contextService.getWorkspace().folders.map(s=>s.uri));for(let[s]of this.mapFolderToConfiguredExpression)s!==cI.NO_FOLDER&&(o.has(A.parse(s))||(this.mapFolderToParsedExpression.delete(s),this.mapFolderToConfiguredExpression.delete(s),t=!0));let n=this.doGetExpression(void 0),r=this.mapFolderToConfiguredExpression.get(cI.NO_FOLDER);n?(!r||!eo(r.expression,n.expression))&&(t=!0,this.mapFolderToParsedExpression.set(cI.NO_FOLDER,Ym(n.expression)),this.mapFolderToConfiguredExpression.set(cI.NO_FOLDER,n)):r&&(t=!0,this.mapFolderToParsedExpression.delete(cI.NO_FOLDER),this.mapFolderToConfiguredExpression.delete(cI.NO_FOLDER)),e&&t&&this._onExpressionChange.fire()}doGetExpression(e){let t=this.getExpression(e);if(!t)return;let o=Object.keys(t);if(o.length===0)return;let n=!1,r=Object.create(null);for(let s of o){n||(n=Zl(s));let l=s,c=VGi(l,!0);if(c){let u=c.toLowerCase();c!==c.toLowerCase()&&(l=`${u}${l.substring(1)}`)}r[l]=t[s]}return{expression:r,hasAbsolutePath:n}}matches(e,t){if(this.mapFolderToParsedExpression.size===0)return!1;let o=this.contextService.getWorkspaceFolder(e),n,r;if(o&&this.mapFolderToParsedExpression.has(o.uri.toString())?(n=this.mapFolderToParsedExpression.get(o.uri.toString()),r=this.mapFolderToConfiguredExpression.get(o.uri.toString())):(n=this.mapFolderToParsedExpression.get(cI.NO_FOLDER),r=this.mapFolderToConfiguredExpression.get(cI.NO_FOLDER)),!n)return!1;let s;return o?s=Wd(o.uri,e):s=this.uriToPath(e),typeof s=="string"&&n(s,void 0,t)?!0:s!==this.uriToPath(e)&&r?.hasAbsolutePath?!!n(this.uriToPath(e),void 0,t):!1}uriToPath(e){return e.scheme===Q.file?e.fsPath:e.path}};cI=I([m(2,Pe),m(3,B)],cI);var b6e=new Y("autoSaveAfterShortDelayContext",!1,!0);var gr=le("filesConfigurationService"),eD=class extends x{constructor(e,t,o,n,r,s,l,c){super();this.configurationService=t;this.contextService=o;this.environmentService=n;this.uriIdentityService=r;this.fileService=s;this.markerService=l;this.textResourceConfigurationService=c;this._onDidChangeAutoSaveConfiguration=this._register(new E);this.onDidChangeAutoSaveConfiguration=this._onDidChangeAutoSaveConfiguration.event;this._onDidChangeAutoSaveDisabled=this._register(new E);this.onDidChangeAutoSaveDisabled=this._onDidChangeAutoSaveDisabled.event;this._onDidChangeFilesAssociation=this._register(new E);this.onDidChangeFilesAssociation=this._onDidChangeFilesAssociation.event;this._onDidChangeReadonly=this._register(new E);this.onDidChangeReadonly=this._onDidChangeReadonly.event;this.autoSaveConfigurationCache=new dl(1e3);this.autoSaveAfterShortDelayOverrides=new gt;this.autoSaveDisabledOverrides=new gt;this.readonlyIncludeMatcher=this._register(new H$(()=>this.createReadonlyMatcher(Dbt)));this.readonlyExcludeMatcher=this._register(new H$(()=>this.createReadonlyMatcher(Lbt)));this.sessionReadonlyOverrides=new gt(e=>this.uriIdentityService.extUri.getComparisonKey(e));this.autoSaveAfterShortDelayContext=b6e.bindTo(e);let u=t.getValue();this.currentGlobalAutoSaveConfiguration=this.computeAutoSaveConfiguration(void 0,u.files),this.currentFilesAssociationConfiguration=u?.files?.associations,this.currentHotExitConfiguration=u?.files?.hotExit||XS.ON_EXIT,this.onFilesConfigurationChange(u,!1),this.registerListeners()}static{this.DEFAULT_AUTO_SAVE_MODE=Wt?Cv.AFTER_DELAY:Cv.OFF}static{this.DEFAULT_AUTO_SAVE_DELAY=1e3}static{this.READONLY_MESSAGES={providerReadonly:{value:d(17788,null),isTrusted:!0},sessionReadonly:{value:d(17789,null,"workbench.action.files.setActiveEditorWriteableInSession"),isTrusted:!0},configuredReadonly:{value:d(17785,null,`workbench.action.openSettings?${encodeURIComponent('["files.readonly"]')}`,"workbench.action.files.toggleActiveEditorReadonlyInSession"),isTrusted:!0},fileLocked:{value:d(17786,null,"workbench.action.files.setActiveEditorWriteableInSession"),isTrusted:!0},fileReadonly:{value:d(17787,null),isTrusted:!0}}}createReadonlyMatcher(e){let t=this._register(new cI(o=>this.configurationService.getValue(e,{resource:o}),o=>o.affectsConfiguration(e),this.contextService,this.configurationService));return this._register(t.onExpressionChange(()=>this._onDidChangeReadonly.fire())),t}isReadonly(e,t){let o=this.fileService.getProvider(e.scheme);if(o&&J4i(o))return o.readOnlyMessage??eD.READONLY_MESSAGES.providerReadonly;let n=this.sessionReadonlyOverrides.get(e);return typeof n=="boolean"?n===!0?eD.READONLY_MESSAGES.sessionReadonly:!1:this.uriIdentityService.extUri.isEqualOrParent(e,this.environmentService.userRoamingDataHome)||this.uriIdentityService.extUri.isEqual(e,this.contextService.getWorkspace().configuration??void 0)?!1:this.readonlyIncludeMatcher.value.matches(e)?this.readonlyExcludeMatcher.value.matches(e)?!1:eD.READONLY_MESSAGES.configuredReadonly:this.configuredReadonlyFromPermissions&&t?.locked?eD.READONLY_MESSAGES.fileLocked:t?.readonly?eD.READONLY_MESSAGES.fileReadonly:!1}async updateReadonly(e,t){if(t==="toggle"){let o;try{o=await this.fileService.resolve(e,{resolveMetadata:!0})}catch{}t=!this.isReadonly(e,o)}t==="reset"?this.sessionReadonlyOverrides.delete(e):this.sessionReadonlyOverrides.set(e,t),this._onDidChangeReadonly.fire()}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration("files")&&this.onFilesConfigurationChange(this.configurationService.getValue(),!0)}))}onFilesConfigurationChange(e,t){this.currentGlobalAutoSaveConfiguration=this.computeAutoSaveConfiguration(void 0,e.files),this.autoSaveConfigurationCache.clear(),this.autoSaveAfterShortDelayContext.set(this.getAutoSaveMode(void 0).mode===1),t&&this._onDidChangeAutoSaveConfiguration.fire();let o=e?.files?.associations;eo(this.currentFilesAssociationConfiguration,o)||(this.currentFilesAssociationConfiguration=o,t&&this._onDidChangeFilesAssociation.fire());let n=e?.files?.hotExit;n===XS.OFF||n===XS.ON_EXIT_AND_WINDOW_CLOSE?this.currentHotExitConfiguration=n:this.currentHotExitConfiguration=XS.ON_EXIT;let r=!!e?.files?.readonlyFromPermissions;r!==!!this.configuredReadonlyFromPermissions&&(this.configuredReadonlyFromPermissions=r,t&&this._onDidChangeReadonly.fire())}getAutoSaveConfiguration(e){let t=this.toResource(e);if(t){let o=this.autoSaveConfigurationCache.get(t);return o||(o=this.computeAutoSaveConfiguration(t,this.textResourceConfigurationService.getValue(t,"files")),this.autoSaveConfigurationCache.set(t,o)),o}return this.currentGlobalAutoSaveConfiguration}computeAutoSaveConfiguration(e,t){let o,n,r,s,l,c;switch(t?.autoSave??eD.DEFAULT_AUTO_SAVE_MODE){case Cv.AFTER_DELAY:{o="afterDelay",n=typeof t?.autoSaveDelay=="number"&&t.autoSaveDelay>=0?t.autoSaveDelay:eD.DEFAULT_AUTO_SAVE_DELAY,c=n<=eD.DEFAULT_AUTO_SAVE_DELAY;break}case Cv.ON_FOCUS_CHANGE:o="onFocusChange";break;case Cv.ON_WINDOW_CHANGE:o="onWindowChange";break}return t?.autoSaveWorkspaceFilesOnly===!0&&(r=!0,e&&!this.contextService.isInsideWorkspace(e)&&(l=!0,c=void 0)),t?.autoSaveWhenNoErrors===!0&&(s=!0,c=void 0),{autoSave:o,autoSaveDelay:n,autoSaveWorkspaceFilesOnly:r,autoSaveWhenNoErrors:s,isOutOfWorkspace:l,isShortAutoSaveDelay:c}}toResource(e){return e instanceof ls?po.getOriginalUri(e,{supportSideBySide:1}):e}hasShortAutoSaveDelay(e){let t=this.toResource(e);return t&&this.autoSaveAfterShortDelayOverrides.has(t)?!0:this.getAutoSaveConfiguration(t).isShortAutoSaveDelay?!t||!this.autoSaveDisabledOverrides.has(t):!1}getAutoSaveMode(e,t){let o=this.toResource(e);if(o&&this.autoSaveAfterShortDelayOverrides.has(o))return{mode:1};if(o&&this.autoSaveDisabledOverrides.has(o))return{mode:0,reason:4};let n=this.getAutoSaveConfiguration(o);if(typeof n.autoSave>"u")return{mode:0,reason:1};if(typeof t=="number"&&(n.autoSave==="afterDelay"&&t!==2||n.autoSave==="onFocusChange"&&t!==3&&t!==4||n.autoSave==="onWindowChange"&&t!==4))return{mode:0,reason:1};if(o){if(n.autoSaveWorkspaceFilesOnly&&n.isOutOfWorkspace)return{mode:0,reason:2};if(n.autoSaveWhenNoErrors&&this.markerService.read({resource:o,take:1,severities:8}).length>0)return{mode:0,reason:3}}switch(n.autoSave){case"afterDelay":return typeof n.autoSaveDelay=="number"&&n.autoSaveDelay<=eD.DEFAULT_AUTO_SAVE_DELAY?{mode:n.autoSaveWhenNoErrors?2:1}:{mode:2};case"onFocusChange":return{mode:3};case"onWindowChange":return{mode:4}}}async toggleAutoSave(){let e=this.configurationService.getValue("files.autoSave"),t;return[Cv.AFTER_DELAY,Cv.ON_FOCUS_CHANGE,Cv.ON_WINDOW_CHANGE].some(o=>o===e)?t=Cv.OFF:t=Cv.AFTER_DELAY,this.configurationService.updateValue("files.autoSave",t)}enableAutoSaveAfterShortDelay(e){let t=this.toResource(e);if(!t)return x.None;let o=this.autoSaveAfterShortDelayOverrides.get(t)??0;return this.autoSaveAfterShortDelayOverrides.set(t,o+1),Z(()=>{let n=this.autoSaveAfterShortDelayOverrides.get(t)??0;n<=1?this.autoSaveAfterShortDelayOverrides.delete(t):this.autoSaveAfterShortDelayOverrides.set(t,n-1)})}disableAutoSave(e){let t=this.toResource(e);if(!t)return x.None;let o=this.autoSaveDisabledOverrides.get(t)??0;return this.autoSaveDisabledOverrides.set(t,o+1),o===0&&this._onDidChangeAutoSaveDisabled.fire(t),Z(()=>{let n=this.autoSaveDisabledOverrides.get(t)??0;n<=1?(this.autoSaveDisabledOverrides.delete(t),this._onDidChangeAutoSaveDisabled.fire(t)):this.autoSaveDisabledOverrides.set(t,n-1)})}get isHotExitEnabled(){return this.contextService.getWorkspace().transient?!1:this.currentHotExitConfiguration!==XS.OFF}get hotExitConfiguration(){return this.currentHotExitConfiguration}preventSaveConflicts(e,t){return this.configurationService.getValue("files.saveConflictResolution",{resource:e,overrideIdentifier:t})!=="overwriteFileOnDisk"}};eD=I([m(0,X),m(1,B),m(2,Pe),m(3,Eo),m(4,ht),m(5,fe),m(6,oa),m(7,Fn)],eD);Ee(gr,eD,0);var XP=class extends x{constructor(e,t){super();this.configurationService=e;this.workspaceContextService=t;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this.patterns=[];this.enabled=!0;this.cache=new mht(1e3);this._templateRegexValidation=/[a-zA-Z0-9]/;this._parsedTemplateExpression=/\$\{(dirname|filename|extname|extname\((?<extnameN>[-+]?\d+)\)|dirname\((?<dirnameN>[-+]?\d+)\))\}/g;this._filenameCaptureExpression=/(?<filename>^\.*[^.]*)/;this.storeEnablementState(),this.storeCustomPatterns(),this.registerListeners()}static{this.SETTING_ID_PATTERNS="workbench.editor.customLabels.patterns"}static{this.SETTING_ID_ENABLED="workbench.editor.customLabels.enabled"}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>{if(e.affectsConfiguration(XP.SETTING_ID_ENABLED)){let t=this.enabled;this.storeEnablementState(),t!==this.enabled&&this.patterns.length>0&&this._onDidChange.fire()}else e.affectsConfiguration(XP.SETTING_ID_PATTERNS)&&(this.cache.clear(),this.storeCustomPatterns(),this._onDidChange.fire())}))}storeEnablementState(){this.enabled=this.configurationService.getValue(XP.SETTING_ID_ENABLED)}storeCustomPatterns(){this.patterns=[];let e=this.configurationService.getValue(XP.SETTING_ID_PATTERNS);for(let t in e){let o=e[t];if(!this._templateRegexValidation.test(o))continue;let n=Zl(t),r=Ym(t,{ignoreCase:!0});this.patterns.push({pattern:t,template:o,isAbsolutePath:n,parsedPattern:r})}this.patterns.sort((t,o)=>this.patternWeight(o.pattern)-this.patternWeight(t.pattern))}patternWeight(e){let t=0;for(let o of e.split("/"))o==="**"?t+=1:o==="*"?t+=10:o.includes("*")||o.includes("?")?t+=50:o!==""&&(t+=100);return t}getName(e){if(!this.enabled||this.patterns.length===0)return;let t=e.toString(),o=this.cache.get(t);if(o!==void 0)return o??void 0;let n=this.applyPatterns(e);return this.cache.set(t,n??null),n}applyPatterns(e){let t=this.workspaceContextService.getWorkspaceFolder(e),o;for(let n of this.patterns){let r;if(t&&!n.isAbsolutePath?(o||(o=Wd(ci(t.uri),e)??e.path),r=o):r=e.path,n.parsedPattern(r))return this.applyTemplate(n.template,e,r)}}applyTemplate(e,t,o){let n;return e.replace(this._parsedTemplateExpression,(r,s,...l)=>{n=n??P$(t.path);let{dirnameN:c="0",extnameN:u="0"}=l.pop();if(s==="filename"){let{filename:p}=this._filenameCaptureExpression.exec(n.base)?.groups??{};if(p)return p}else if(s==="extname"){let p=this.getExtnames(n.base);if(p)return p}else if(s.startsWith("extname")){let p=parseInt(u),h=this.getNthExtname(n.base,p);if(h)return h}else if(s.startsWith("dirname")){let p=parseInt(c),h=this.getNthDirname(ad(o),p);if(h)return h}return r})}removeLeadingDot(e){let t=e;for(;t.startsWith(".");)t=t.slice(1);return t}getNthDirname(e,t){e=e.startsWith("/")?e.slice(1):e;let o=e.split("/");return this.getNthFragment(o,t)}getExtnames(e){return this.removeLeadingDot(e).split(".").slice(1).join(".")}getNthExtname(e,t){let o=this.removeLeadingDot(e).split(".");return o.shift(),this.getNthFragment(o,t)}getNthFragment(e,t){let o=e.length,n;t<0?n=Math.abs(t)-1:n=o-t-1;let r=e[n];if(!(r===void 0||r===""))return r}};XP=I([m(0,B),m(1,Pe)],XP);var Rv=le("ICustomEditorLabelService");Ee(Rv,XP,1);var VX=class extends ls{constructor(e,t,o,n,r,s,l){super();this.resource=e;this.labelService=o;this.fileService=n;this.filesConfigurationService=r;this.textResourceConfigurationService=s;this.customEditorLabelService=l;this._name=void 0;this._shortDescription=void 0;this._mediumDescription=void 0;this._longDescription=void 0;this._shortTitle=void 0;this._mediumTitle=void 0;this._longTitle=void 0;this._preferredResource=t||e,this.registerListeners()}get capabilities(){let e=32;return this.fileService.hasProvider(this.resource)?this.filesConfigurationService.isReadonly(this.resource)&&(e|=2):e|=4,e&2||(e|=128),e}get preferredResource(){return this._preferredResource}registerListeners(){this._register(this.labelService.onDidChangeFormatters(e=>this.onLabelEvent(e.scheme))),this._register(this.fileService.onDidChangeFileSystemProviderRegistrations(e=>this.onLabelEvent(e.scheme))),this._register(this.fileService.onDidChangeFileSystemProviderCapabilities(e=>this.onLabelEvent(e.scheme))),this._register(this.customEditorLabelService.onDidChange(()=>this.updateLabel())),this._register(this.filesConfigurationService.onDidChangeReadonly(()=>this._onDidChangeCapabilities.fire()))}onLabelEvent(e){e===this._preferredResource.scheme&&this.updateLabel()}updateLabel(){this._name=void 0,this._shortDescription=void 0,this._mediumDescription=void 0,this._longDescription=void 0,this._shortTitle=void 0,this._mediumTitle=void 0,this._longTitle=void 0,this._onDidChangeLabel.fire()}setPreferredResource(e){Qe(e,this._preferredResource)||(this._preferredResource=e,this.updateLabel())}getName(){return typeof this._name!="string"&&(this._name=this.customEditorLabelService.getName(this._preferredResource)??this.labelService.getUriBasenameLabel(this._preferredResource)),this._name}getDescription(e=1){switch(e){case 0:return this.shortDescription;case 2:return this.longDescription;case 1:default:return this.mediumDescription}}get shortDescription(){return typeof this._shortDescription!="string"&&(this._shortDescription=this.labelService.getUriBasenameLabel(ci(this._preferredResource))),this._shortDescription}get mediumDescription(){return typeof this._mediumDescription!="string"&&(this._mediumDescription=this.labelService.getUriLabel(ci(this._preferredResource),{relative:!0})),this._mediumDescription}get longDescription(){return typeof this._longDescription!="string"&&(this._longDescription=this.labelService.getUriLabel(ci(this._preferredResource))),this._longDescription}get shortTitle(){return typeof this._shortTitle!="string"&&(this._shortTitle=this.getName()),this._shortTitle}get mediumTitle(){return typeof this._mediumTitle!="string"&&(this._mediumTitle=this.labelService.getUriLabel(this._preferredResource,{relative:!0})),this._mediumTitle}get longTitle(){return typeof this._longTitle!="string"&&(this._longTitle=this.labelService.getUriLabel(this._preferredResource)),this._longTitle}getTitle(e){switch(e){case 0:return this.shortTitle;case 2:return this.longTitle;default:case 1:return this.mediumTitle}}isReadonly(){return this.filesConfigurationService.isReadonly(this.resource)}ensureLimits(e){if(e?.limits)return e.limits;let t=Rbt(this.resource),o,n=this.textResourceConfigurationService.inspect(this.resource,null,"workbench.editorLargeFileConfirmation");return Rae(n)&&(o=n.value*vl.MB),{size:o??t}}};VX=I([m(2,rt),m(3,fe),m(4,gr),m(5,Fn),m(6,Rv)],VX);var wt=le("editorGroupsService");function Xmi(a){let i=a;return ka(i?.editor)&&ka(i?.replacement)}function zde(a){let i=a;return!!i&&typeof i.id=="number"&&Array.isArray(i.editors)}function uy(a){return a.getValue("workbench.editor.openSideBySideDirection")==="down"?1:3}var ee=le("editorService"),jn=-1,In=-2,Mg=-3,OR=-4;function oeo(a){return typeof a=="number"||zde(a)}var At=Eo;function Kde(a){return a.scheme!==Q.file&&a.scheme!==Q.vscodeRemote}function FR(a){if(a.folders.length)return a.folders.every(i=>Kde(i.uri))?a.folders[0].uri:void 0;if(a.configuration&&Kde(a.configuration))return a.configuration}function IDt(a){return FR(a)?.scheme}function neo(a){return FR(a)?.authority}function _F(a){return FR(a)!==void 0}var bo=le("remoteAgentService"),DF=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(a){let i=1/0;for(let t=0;t<this.maxSampleCount;t++){let o=await a.getRoundTripTime();if(o===void 0)return;i=Math.min(i,o/2),await Li(this.sampleDelay)}this.average.push(i),this.average.length>this.maxAverageCount&&this.average.shift();let e;return this.initial.length<this.maxInitialCount?this.initial.push(i):e=this.initial.reduce((t,o)=>t+o,0)/this.initial.length,this.lastMeasurement={initial:e,current:i,average:this.average.reduce((t,o)=>t+o,0)/this.average.length,high:typeof e>"u"?!1:i>this.highLatencyMaxThreshold||i>this.highLatencyMinThreshold&&i>e*this.highLatencyMultiple},this.lastMeasurement}};var An=le("pathService"),BX=class{constructor(i,e,t,o){this.localUserHome=i;this.remoteAgentService=e;this.environmentService=t;this.contextService=o;this.resolveOS=(async()=>(await this.remoteAgentService.getEnvironment())?.os||Po)(),this.resolveUserHome=(async()=>{let n=await this.remoteAgentService.getEnvironment();return this.maybeUnresolvedUserHome=n?.userHome??i})()}hasValidBasename(i,e,t){return typeof e=="string"||typeof e>"u"?this.resolveOS.then(o=>this.doHasValidBasename(i,o,e)):this.doHasValidBasename(i,e,t)}doHasValidBasename(i,e,t){return i.scheme===Q.file||i.scheme===Q.vscodeRemote?v1(t??He(i),e===1):!0}get defaultUriScheme(){return BX.findDefaultUriScheme(this.environmentService,this.contextService)}static findDefaultUriScheme(i,e){if(i.remoteAuthority)return Q.vscodeRemote;let t=IDt(e.getWorkspace());if(t)return t;let o=e.getWorkspace().folders[0];if(o)return o.uri.scheme;let n=e.getWorkspace().configuration;return n?n.scheme:Q.file}userHome(i){return i?.preferLocal?this.localUserHome:this.resolveUserHome}get resolvedUserHome(){return this.maybeUnresolvedUserHome}get path(){return this.resolveOS.then(i=>i===1?$s:Oo)}async fileURI(i){let e="";if(await this.resolveOS===1&&(i=i.replace(/\\/g,"/")),i[0]==="/"&&i[1]==="/"){let o=i.indexOf("/",2);o===-1?(e=i.substring(2),i="/"):(e=i.substring(2,o),i=i.substring(o)||"/")}return A.from({scheme:Q.file,authority:e,path:i,query:"",fragment:""})}};BX=I([m(1,bo),m(2,At),m(3,Pe)],BX);var Ra=class extends VX{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super(e,t,c,u,p,f,v);this.viewType=o;this.options=n;this._notebookService=r;this._notebookModelResolverService=s;this._fileDialogService=l;this.environmentService=b;this.pathService=S;this.editorModelReference=null;this._defaultDirtyState=!1;this._defaultDirtyState=!!n.startDirty,this._sideLoadedListener=r.onDidAddNotebookDocument(y=>{y.viewType===this.viewType&&y.uri.toString()===this.resource.toString()&&this.resolve().catch(mt)}),this._register(h.onWillStop(y=>{if(!y.auto&&!this.isDirty())return;let w=y.auto?d(12823,null,this.getName()):d(12824,null,this.getName());y.veto((async()=>{let k=g.findEditors(this);return y.auto?!0:!(k.length>0&&(await g.save(k[0])).success)})(),w)}))}static getOrCreate(e,t,o,n,r={}){let s=e.createInstance(Ra,t,o,n,r);return o&&s.setPreferredResource(o),s}static{this.ID="workbench.input.notebook"}dispose(){this._sideLoadedListener.dispose(),this.editorModelReference?.dispose(),this.editorModelReference=null,super.dispose()}get typeId(){return Ra.ID}get editorId(){return this.viewType}get capabilities(){let e=0;return this.resource.scheme===Q.untitled&&(e|=4),this.editorModelReference?this.editorModelReference.object.isReadonly()&&(e|=2):this.filesConfigurationService.isReadonly(this.resource)&&(e|=2),e&2||(e|=128),e}getDescription(e=1){if(!this.hasCapability(4)||this.editorModelReference?.object.hasAssociatedFilePath())return super.getDescription(e)}isReadonly(){return this.editorModelReference?this.editorModelReference.object.isReadonly():this.filesConfigurationService.isReadonly(this.resource)}isDirty(){return this.editorModelReference?this.editorModelReference.object.isDirty():this._defaultDirtyState}isSaving(){let e=this.editorModelReference?.object;return!e||!e.isDirty()||e.hasErrorState||this.hasCapability(4)?!1:this.filesConfigurationService.hasShortAutoSaveDelay(this)}async save(e,t){if(this.editorModelReference)return this.hasCapability(4)?this.saveAs(e,t):(await this.editorModelReference.object.save(t),this)}async saveAs(e,t){if(!this.editorModelReference)return;let o=this._notebookService.getContributedNotebookType(this.viewType);if(!o)return;let n=this.hasCapability(4)?await this._suggestName(o):this.editorModelReference.object.resource,r;if(this.editorModelReference.object.hasAssociatedFilePath())r=n;else if(r=await this._fileDialogService.pickFileToSave(n,t?.availableFileSystems),!r)return;if(!o.matches(r)){let s=o.selectors.map(l=>typeof l=="string"?l:qP(l)?`${l} (base ${l.base})`:l.exclude?`${l.include} (exclude: ${l.exclude})`:`${l.include}`).join(", ");throw new Error(`File name ${r} is not supported by ${o.providerDisplayName}.

Please make sure the file name matches following patterns:
${s}`)}return await this.editorModelReference.object.saveAs(r)}async _suggestName(e){let t=await this.ensureAbsolutePath(this.ensureProviderExtension(e)),o=this.environmentService.remoteAuthority;return of(t,o,this.pathService.defaultUriScheme)}async ensureAbsolutePath(e){if(e.scheme!==Q.untitled||Zl(e.path))return e;let t=await this._fileDialogService.defaultFilePath();return A.joinPath(t,e.path)}ensureProviderExtension(e){let t=e.selectors[0],o=t&&typeof t=="string"?t:void 0;if(!o&&t){let r=t.include;typeof r=="string"&&(o=r)}let n=this.resource;if(o){let r=/^\*\.([A-Za-z_-]*)$/.exec(o);if(r&&r.length>1){let s=r[1];if(!n.path.endsWith(s))return n.with({path:n.path+"."+s})}}return n}async rename(e,t){if(this.editorModelReference)return{editor:{resource:t},options:{override:this.viewType}}}async revert(e,t){this.editorModelReference&&this.editorModelReference.object.isDirty()&&await this.editorModelReference.object.revert(t)}async resolve(e,t){if(!await this._notebookService.canResolve(this.viewType))return null;if(t?.mark("extensionActivated"),this._sideLoadedListener.dispose(),this.editorModelReference)this.editorModelReference.object.load({limits:this.ensureLimits(e)});else{let o=!!(this.capabilities&512),n=await this._notebookModelResolverService.resolve(this.resource,this.viewType,{limits:this.ensureLimits(e),scratchpad:o,viewType:this.editorId});if(this.editorModelReference)return n.dispose(),this.editorModelReference.object;if(this.editorModelReference=n,this.isDisposed())return this.editorModelReference.dispose(),this.editorModelReference=null,null;this._register(this.editorModelReference.object.onDidChangeDirty(()=>this._onDidChangeDirty.fire())),this._register(this.editorModelReference.object.onDidChangeReadonly(()=>this._onDidChangeCapabilities.fire())),this._register(this.editorModelReference.object.onDidRevertUntitled(()=>this.dispose())),this.editorModelReference.object.isDirty()&&this._onDidChangeDirty.fire()}if(this.options._backupId){let o=await this._notebookService.withNotebookDataProvider(this.editorModelReference.object.notebook.viewType);if(!(o instanceof NR))throw new Error("CANNOT open file notebook with this provider");let n=await o.serializer.dataToNotebook(qe.fromString(JSON.stringify({__webview_backup:this.options._backupId})));this.editorModelReference.object.notebook.applyEdits([{editType:1,index:0,count:this.editorModelReference.object.notebook.length,cells:n.cells}],!0,void 0,()=>{},void 0,!1),this.options._workingCopy&&(this.options._backupId=void 0,this.options._workingCopy=void 0,this.options.startDirty=void 0)}return this.editorModelReference.object}toUntyped(){return{resource:this.resource,options:{override:this.viewType}}}matches(e){return super.matches(e)?!0:e instanceof Ra?this.viewType===e.viewType&&Qe(this.resource,e.resource):Sf(e)&&e.resource.scheme===Zo.scheme?Qe(this.resource,Zo.parse(e.resource)?.notebook):!1}};Ra=I([m(4,bn),m(5,yh),m(6,rn),m(7,rt),m(8,fe),m(9,gr),m(10,lt),m(11,ee),m(12,Fn),m(13,Rv),m(14,At),m(15,An)],Ra);function i4(a){return!!a&&typeof a=="object"&&Array.isArray(a.editorInputs)&&a.editorInputs.every(i=>i instanceof Ra)}function S6e(a){return!!a&&typeof a=="object"&&a.typeId===Ra.ID}function Jmi(a){return!a||typeof a!="object"?!1:typeof a.start=="number"&&typeof a.end=="number"}function Gde(a){a.sort((e,t)=>e-t);let i=a.shift();return i===void 0?[]:a.reduce(function(e,t){return t<=e[0][1]?e[0][1]=t+1:e.unshift([t,t+1]),e},[[i,i+1]]).reverse().map(e=>({start:e[0],end:e[1]}))}function Yf(a){return a.reduce((e,t)=>{for(let o=t.start;o<t.end;o++)e.push(o);return e},[])}function LF(a){let i=a.sort((o,n)=>o.start-n.start),e=i[0];if(!e)return[];let t=i.reduce((o,n)=>{let r=o[o.length-1];return r.end>=n.start?r.end=Math.max(r.end,n.end):o.push(n),o},[e]);return t.length>1?t.filter(o=>!(o.start===o.end&&o.start===0)):t}function I6e(a,i){if(a=LF(a),i=LF(i),a.length!==i.length)return!1;for(let e=0;e<a.length;e++)if(a[e].start!==i[e].start||a[e].end!==i[e].end)return!1;return!0}function yDt(a,i){return i.start>=a.start&&i.end<=a.end}var PEe="notebook.cell.expandCellInput",reo="notebook.cell.execute",y6e="notebook.cell.detectLanguage",wDt="notebook.cell.changeLanguage",Zmi="notebook.cell.quitEdit",CDt="notebook.cell.expandCellOutput",ehi="jupyter-notebook",AEe="ms-toolsai.jupyter",seo=new Map([[ehi,AEe]]),xDt=new Map;xDt.set(ehi,new Map);xDt.get(ehi)?.set("python",{extensionIds:["ms-python.python",AEe],displayName:"Python + Jupyter"});function aeo(a){return!!a&&typeof a.handle=="number"}function Jn(a){if(!a)return;if(a.getId()===MR)return a.getControl();if(a.getId()===TX)return a.getControl().inlineNotebookEditor;let i=a.input;if(i&&i4(i))return a.getControl()?.notebookEditor}function HX(a,i){let e=Yf(i),t=[];return e.forEach(o=>{if(!a.cellAt(o))return;let r=a.getViewIndexByModelIndex(o);if(r<0)return;let s=r+1,l=a.getCellRangeFromViewRange(r,s);l&&t.push(l)}),LF(t)}function w6e(a,i){let e=[];return LF(i).forEach(t=>{e.push(...a.getCellsInRange(t))}),e}var Mv=class a extends TY{constructor(e,t,o=void 0,n){super(n);this.resource=e;this.cellEdit=t;this.notebookVersionId=o}static is(e){return e instanceof a?!0:A.isUri(e.resource)&&xi(e.cellEdit)}static lift(e){return e instanceof a?e:new a(e.resource,e.cellEdit,e.notebookVersionId,e.metadata)}},NEe=class{constructor(i,e,t,o,n,r,s){this._undoRedoGroup=i;this._progress=t;this._token=o;this._edits=n;this._editorService=r;this._notebookModelService=s;this._edits=this._edits.map(l=>{if(l.resource.scheme===Zo.scheme){let c=Zo.parse(l.resource)?.notebook;if(!c)throw new Error(`Invalid notebook URI: ${l.resource}`);return new Mv(c,l.cellEdit,l.notebookVersionId,l.metadata)}else return l})}async apply(){let i=[],e=Jg(this._edits,(t,o)=>Hl(t.resource.toString(),o.resource.toString()));for(let t of e){if(this._token.isCancellationRequested)break;let[o]=t,n=await this._notebookModelService.resolve(o.resource);if(typeof o.notebookVersionId=="number"&&n.object.notebook.versionId!==o.notebookVersionId)throw n.dispose(),new Error(`Notebook '${o.resource}' has changed in the meantime`);let r=t.map(u=>u.cellEdit),s=!n.object.isReadonly(),l=Jn(this._editorService.activeEditorPane),c=l?.textModel?.uri.toString()===n.object.notebook.uri.toString()?{kind:1,focus:l.getFocus(),selections:l.getSelections()}:void 0;n.object.notebook.applyEdits(r,!0,c,()=>{},this._undoRedoGroup,s),n.dispose(),this._progress.report(void 0),i.push(o.resource)}return i}};NEe=I([m(5,ee),m(6,yh)],NEe);var kDt=class{constructor(i,e,t,o){this._bulkEditService=e;this._logService=t;this._uriIdentService=o}dispose(){}$tryApplyWorkspaceEdit(i,e,t){let o=yB(i.value,this._uriIdentService);return this._bulkEditService.apply(o,{undoRedoGroupId:e,respectAutoSaveConfig:t}).then(n=>n.isApplied,n=>(this._logService.warn(`IGNORING workspace edit: ${n}`),!1))}};kDt=I([fo(qi.MainThreadBulkEdits),m(1,La),m(2,se),m(3,ht)],kDt);function yB(a,i,e){if(!a||!a.edits)return a;let t=$n(a);for(let o of t.edits){if(nl.is(o)&&(o.resource=i.asCanonicalUri(o.resource)),Cu.is(o)){if(o.options){let n=o.options?.contents;if(n)if(n.type==="base64")o.options.contents=Promise.resolve(qa(n.value));else if(e)o.options.contents=e(n.id);else throw new Error("Could not revive data transfer file")}o.newResource=o.newResource&&i.asCanonicalUri(o.newResource),o.oldResource=o.oldResource&&i.asCanonicalUri(o.oldResource)}if(Mv.is(o)){o.resource=i.asCanonicalUri(o.resource);let n=o.cellEdit;n.editType===1&&(o.cellEdit={...n,cells:n.cells.map(r=>({...r,outputs:r.outputs.map(s=>({...s,outputs:s.items.map(l=>({mime:l.mime,data:l.valueBytes}))}))}))})}}return a}async function JP(a,i){let e=i==="image/gif";return typeof a=="string"&&(a=thi(a)),new Promise((t,o)=>{let n=new Blob([a],{type:i}),r=new Image,s=URL.createObjectURL(n);r.src=s,r.onload=()=>{URL.revokeObjectURL(s);let{width:l,height:c}=r;if((l<=768||c<=768)&&!e){t(a);return}if(l>2048||c>2048){let g=2048/Math.max(l,c);l=Math.round(l*g),c=Math.round(c*g)}let u=768/Math.min(l,c);l=Math.round(l*u),c=Math.round(c*u);let p=document.createElement("canvas");p.width=l,p.height=c;let h=p.getContext("2d");if(h){h.drawImage(r,0,0,l,c);let f=i&&["image/jpeg","image/jpg"].includes(i)?"image/jpeg":"image/png";p.toBlob(v=>{if(v){let b=new FileReader;b.onload=()=>{t(new Uint8Array(b.result))},b.onerror=S=>o(S),b.readAsArrayBuffer(v)}else o(new Error("Failed to create blob from canvas"))},f)}else o(new Error("Failed to get canvas context"))},r.onerror=l=>{URL.revokeObjectURL(s),o(l)}})}function thi(a){let i=a.includes(",")?a.split(",")[1]:a;return m$o(i)?qa(i).buffer:new TextEncoder().encode(a)}function m$o(a){return/^[A-Za-z0-9+/]*={0,2}$/.test(a)&&(()=>{try{return atob(a),!0}catch{return!1}})()}async function EDt(a,i,e,t){await a.exists(i)||await a.createFolder(i);let n=t.split("/")[1]||"png",r=`image-${Date.now()}.${n}`,s=Ge(i,r),l=qe.wrap(e);return await a.writeFile(s,l),s}async function TDt(a,i,e){if(!await a.exists(e))return;let o=10080*60*1e3,n=await a.resolve(e);n.children&&await Promise.all(n.children.map(async r=>{try{let s=h$o(r.name);s&&Date.now()-s>o&&await a.del(r.resource)}catch(s){i.error("Failed to clean up old images",s)}}))}function h$o(a){let i=a.match(/image-(\d+)\./);if(i)return parseInt(i[1],10)}$e.registerCommand("_chat.resizeImage",async(a,i,e)=>(i instanceof qe&&(i=i.buffer),JP(i,e)));var FEe=le("languageModelIgnoredFilesService"),_Dt=class{constructor(){this._providers=new Set}async fileIsIgnored(i,e){let t=this._providers.values().next().value;return t?t.isFileIgnored(i,e):!1}registerIgnoredFileProvider(i){return this._providers.add(i),Z(()=>{this._providers.delete(i)})}};var Ea=le("requestService"),deo="NO_FETCH_TELEMETRY",ohi=class{constructor(i){this.original=i}toJSON(){if(!this.headers){let i=Object.create(null);for(let e in this.original)e.toLowerCase()==="authorization"||e.toLowerCase()==="proxy-authorization"?i[e]="*****":i[e]=this.original[e];this.headers=i}return this.headers}},DDt=class extends x{constructor(e){super();this.logService=e;this.counter=0;this._onDidCompleteRequest=this._register(new E);this.onDidCompleteRequest=this._onDidCompleteRequest.event}async logAndRequest(e,t){let o=`#${++this.counter}: ${e.url}`;this.logService.trace(`${o} - begin`,e.type,new ohi(e.headers??{}));let n=Date.now();try{let r=await t();return this.logService.trace(`${o} - end`,e.type,r.res.statusCode,r.res.headers),this._onDidCompleteRequest.fire({callSite:e.callSite,latency:Date.now()-n,statusCode:r.res.statusCode}),r}catch(r){throw this.logService.error(`${o} - error`,e.type,Pn(r)),r}}};function ZP(a){return a.res.statusCode&&a.res.statusCode>=200&&a.res.statusCode<300||a.res.statusCode===1223}function LDt(a){return!!a.res.statusCode&&a.res.statusCode>=400&&a.res.statusCode<500}function ueo(a){return!!a.res.statusCode&&a.res.statusCode>=500&&a.res.statusCode<600}function RDt(a){return a.res.statusCode===204}async function tD(a){return RDt(a)?null:(await tb(a.stream)).toString()}async function _w(a){if(!ZP(a))throw new Error("Server returned "+a.res.statusCode);return tD(a)}async function If(a){if(!ZP(a))throw new Error("Server returned "+a.res.statusCode);if(RDt(a))return null;let e=(await tb(a.stream)).toString();try{return JSON.parse(e)}catch(t){throw t.message+=`:
`+e,t}}function nhi(a,i){peo(a,i)}var rhi=["http.proxy","http.proxyStrictSSL","http.proxyKerberosServicePrincipal","http.noProxy","http.proxyAuthorization","http.proxySupport","http.systemCertificates","http.systemCertificatesNode","http.experimental.systemCertificatesV2","http.fetchAdditionalSupport","http.experimental.networkInterfaceCheckInterval"],g$o=!1,ihi=[],leo,ceo;function peo(a=!0,i=!0){if(leo===a&&ceo===i)return;leo=a,ceo=i;let e=ne.as(Jt.Configuration),t=ihi;ihi=[{id:"http",order:15,title:d(2332,null),type:"object",scope:2,properties:{"http.useLocalProxyConfiguration":{type:"boolean",default:i,markdownDescription:d(2347,null),restricted:!0}}},{id:"http",order:15,title:d(2332,null),type:"object",scope:1,properties:{"http.electronFetch":{type:"boolean",default:!1,description:d(2330,null),restricted:!0}}},{id:"http",order:15,title:d(2332,null),type:"object",scope:a?1:2,properties:{"http.proxy":{type:"string",pattern:"^(https?|socks|socks4a?|socks5h?)://([^:]*(:[^@]*)?@)?([^:]+|\\[[:0-9a-fA-F]+\\])(:\\d+)?/?$|^$",markdownDescription:d(2335,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.proxyStrictSSL":{type:"boolean",default:!0,markdownDescription:d(2343,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.proxyKerberosServicePrincipal":{type:"string",markdownDescription:d(2337,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.noProxy":{type:"array",items:{type:"string"},markdownDescription:d(2334,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.proxyAuthorization":{type:["null","string"],default:null,markdownDescription:d(2336,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.proxySupport":{type:"string",enum:["off","on","fallback","override"],enumDescriptions:[d(2340,null),d(2341,null),d(2339,null),d(2342,null)],default:"override",markdownDescription:d(2338,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.systemCertificates":{type:"boolean",default:!0,markdownDescription:d(2344,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.systemCertificatesNode":{type:"boolean",tags:["experimental"],default:g$o,markdownDescription:d(2345,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0,experiment:{mode:"auto"}},"http.experimental.systemCertificatesV2":{type:"boolean",tags:["experimental"],default:!1,markdownDescription:d(2346,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.fetchAdditionalSupport":{type:"boolean",default:!0,markdownDescription:d(2331,null,"`#http.useLocalProxyConfiguration#`","`#http.proxySupport#`","`#http.systemCertificates#`"),restricted:!0},"http.webSocketAdditionalSupport":{type:"boolean",default:!0,markdownDescription:d(2348,null,"`#http.useLocalProxyConfiguration#`","`#http.proxySupport#`","`#http.systemCertificates#`"),restricted:!0},"http.experimental.networkInterfaceCheckInterval":{type:"number",default:300,minimum:-1,tags:["experimental"],markdownDescription:d(2333,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0,experiment:{mode:"auto"}}}}],e.updateConfigurations({add:ihi,remove:t})}peo();var WEe=le("encryptionService"),Mda=le("encryptionMainService");function meo(a){return a==="kwallet"||a==="kwallet5"||a==="kwallet6"}function heo(a){return a==="gnome_any"||a==="gnome_libsecret"||a==="gnome_keyring"}var Dw=le("secretStorageService"),VEe=class extends x{constructor(e,t,o,n){super();this._useInMemoryStorage=e;this._storageService=t;this._encryptionService=o;this._logService=n;this._storagePrefix="secret://";this.onDidChangeSecretEmitter=this._register(new E);this.onDidChangeSecret=this.onDidChangeSecretEmitter.event;this._sequencer=new Nx;this._type="unknown";this._onDidChangeValueDisposable=this._register(new N);this._lazyStorageService=new co(()=>this.initialize())}get type(){return this._type}get resolvedStorageService(){return this._lazyStorageService.value}get(e){return this._sequencer.queue(e,async()=>{let t=await this.resolvedStorageService,o=this.getKey(e);this._logService.trace("[secrets] getting secret for key:",o);let n=t.get(o,-1);if(!n){this._logService.trace("[secrets] no secret found for key:",o);return}try{this._logService.trace("[secrets] decrypting gotten secret for key:",o);let r=this._type==="in-memory"?n:await this._encryptionService.decrypt(n);return this._logService.trace("[secrets] decrypted secret for key:",o),r}catch(r){this._logService.error(r),this.delete(e);return}})}set(e,t){return this._sequencer.queue(e,async()=>{let o=await this.resolvedStorageService;this._logService.trace("[secrets] encrypting secret for key:",e);let n;try{n=this._type==="in-memory"?t:await this._encryptionService.encrypt(t)}catch(s){throw this._logService.error(s),s}let r=this.getKey(e);this._logService.trace("[secrets] storing encrypted secret for key:",r),o.store(r,n,-1,1),this._logService.trace("[secrets] stored encrypted secret for key:",r)})}delete(e){return this._sequencer.queue(e,async()=>{let t=await this.resolvedStorageService,o=this.getKey(e);this._logService.trace("[secrets] deleting secret for key:",o),t.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 t=e.keys(-1,1);return this._logService.trace("[secrets] fetched keys of all secrets"),t.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 dwt)}return this._onDidChangeValueDisposable.clear(),this._onDidChangeValueDisposable.add(e.onDidChangeValue(-1,void 0,this._onDidChangeValueDisposable)(t=>{this.onDidChangeValue(t.key)})),e}reinitialize(){this._lazyStorageService=new co(()=>this.initialize())}onDidChangeValue(e){if(!e.startsWith(this._storagePrefix))return;let t=e.slice(this._storagePrefix.length);this._logService.trace(`[SecretStorageService] Notifying change in value for secret: ${t}`),this.onDidChangeSecretEmitter.fire(t)}getKey(e){return`${this._storagePrefix}${e}`}};VEe=I([m(1,ce),m(2,WEe),m(3,se)],VEe);var Ma=class extends ls{constructor(e,t,o,n,r){super();this.preferredName=e;this.preferredDescription=t;this.secondary=o;this.primary=n;this.editorService=r;this.hasIdenticalSides=this.primary.matches(this.secondary),this.registerListeners()}static{this.ID="workbench.editorinputs.sidebysideEditorInput"}get typeId(){return Ma.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(U.once(U.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():d(4922,null,this.secondary.getName(),this.primary.getName()))}getPreferredName(){return this.preferredName}getDescription(e){let t=this.getPreferredDescription();return t||(this.hasIdenticalSides?this.primary.getDescription(e):super.getDescription(e))}getPreferredDescription(){return this.preferredDescription}getTitle(e){let t;this.hasIdenticalSides?t=this.primary.getTitle(e)??this.getName():t=super.getTitle(e);let o=this.getPreferredTitle();return o&&(t=`${o} (${t})`),t}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,t){let o=await this.primary.save(e,t);return this.saveResultToEditor(o)}async saveAs(e,t){let o=await this.primary.saveAs(e,t);return this.saveResultToEditor(o)}saveResultToEditor(e){if(!e||!this.hasIdenticalSides)return e;if(this.primary.matches(e))return this;if(e instanceof ls)return new Ma(this.preferredName,this.preferredDescription,e,e,this.editorService);if(!Ib(e)&&!FX(e)&&!Z_(e)&&!WC(e))return{primary:e,secondary:e,label:this.preferredName,description:this.preferredDescription}}revert(e,t){return this.primary.revert(e,t)}async rename(e,t){if(!this.hasIdenticalSides)return;let o=await this.primary.rename(e,t);if(o){if(ka(o.editor))return{editor:new Ma(this.preferredName,this.preferredDescription,o.editor,o.editor,this.editorService),options:{...o.options,viewState:Y5(this,e,this.editorService)}};if(Sf(o.editor))return{editor:{label:this.preferredName,description:this.preferredDescription,primary:o.editor,secondary:o.editor,options:{...o.options,viewState:Y5(this,e,this.editorService)}}}}}isReadonly(){return this.primary.isReadonly()}toUntyped(e){let t=this.primary.toUntyped(e),o=this.secondary.toUntyped(e);if(t&&o&&!Ib(t)&&!Ib(o)&&!FX(t)&&!FX(o)&&!Z_(t)&&!Z_(o)&&!WC(t)&&!WC(o)){let n={label:this.preferredName,description:this.preferredDescription,primary:t,secondary:o};return typeof e?.preserveViewState=="number"&&(n.options={viewState:Y5(this,e.preserveViewState,this.editorService)}),n}}matches(e){return this===e?!0:X5(e)||Ib(e)?!1:e instanceof Ma?this.primary.matches(e.primary)&&this.secondary.matches(e.secondary):Z_(e)?this.primary.matches(e.primary)&&this.secondary.matches(e.secondary):!1}};Ma=I([m(4,ee)],Ma);var C6e=class{canSerialize(i){let e=i;if(e.primary&&e.secondary){let[t,o]=this.getSerializers(e.secondary.typeId,e.primary.typeId);return!!(t?.canSerialize(e.secondary)&&o?.canSerialize(e.primary))}return!1}serialize(i){let e=i;if(e.primary&&e.secondary){let[t,o]=this.getSerializers(e.secondary.typeId,e.primary.typeId);if(o&&t){let n=o.serialize(e.primary),r=t.serialize(e.secondary);if(n&&r){let s={name:e.getPreferredName(),description:e.getPreferredDescription(),primarySerialized:n,secondarySerialized:r,primaryTypeId:e.primary.typeId,secondaryTypeId:e.secondary.typeId};return JSON.stringify(s)}}}}deserialize(i,e){let t=JSON.parse(e),[o,n]=this.getSerializers(t.secondaryTypeId,t.primaryTypeId);if(n&&o){let r=n.deserialize(i,t.primarySerialized),s=o.deserialize(i,t.secondarySerialized);if(r instanceof ls&&s instanceof ls)return this.createEditorInput(i,t.name,t.description,s,r)}}getSerializers(i,e){let t=ne.as(qo.EditorFactory);return[t.getEditorSerializer(i),t.getEditorSerializer(e)]}},MDt=class extends C6e{createEditorInput(i,e,t,o,n){return i.createInstance(Ma,e,t,o,n)}};var wh=class extends x{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 vS=le("ILanguageDetectionService"),x6e="languageDetection",geo="automaticlanguagedetection.likelywrong",feo="automaticlanguagedetection.stats";var Lw=class extends wh{constructor(e,t,o,n,r){super();this.modelService=e;this.languageService=t;this.languageDetectionService=o;this.accessibilityService=n;this.textEditorModelHandle=void 0;this.modelDisposeListener=this._register(new me);this.autoDetectLanguageThrottler=this._register(new ya(Lw.AUTO_DETECT_LANGUAGE_THROTTLE_DELAY));this._blockLanguageChangeListener=!1;this._languageChangeSource=void 0;r&&this.handleExistingModel(r)}static{this.AUTO_DETECT_LANGUAGE_THROTTLE_DELAY=600}handleExistingModel(e){let t=this.modelService.getModel(e);if(!t)throw new Error(`Document with resource ${e.toString(!0)} does not exist`);this.textEditorModelHandle=e,this.registerModelDisposeListener(t)}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,t){this._languageChangeSource="user",this.setLanguageIdInternal(e,t)}setLanguageIdInternal(e,t){if(this.isResolved()&&!(!e||e===this.textEditorModel.getLanguageId())){this._blockLanguageChangeListener=!0;try{this.textEditorModel.setLanguage(this.languageService.createById(e),t)}finally{this._blockLanguageChangeListener=!1}}}installModelListeners(e){let t=this._register(e.onDidChangeLanguage(o=>{o.source===x6e||this._blockLanguageChangeListener||(this._languageChangeSource="api",t.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()??$r))return;let e=await this.languageDetectionService.detectLanguage(this.textEditorModelHandle),t=this.getLanguageId();if(e&&e!==t&&!this.isDisposed()){this.setLanguageIdInternal(e,x6e);let o=this.languageService.getLanguageName(e);this.accessibilityService.alert(d(4923,null,o??e))}}createTextEditorModel(e,t,o){let n=this.getFirstLineText(e),r=this.getOrCreateLanguage(t,this.languageService,o,n);return this.doCreateTextEditorModel(e,r,t)}doCreateTextEditorModel(e,t,o){let n=o&&this.modelService.getModel(o);return n?this.updateTextEditorModel(e,t.languageId):(n=this.modelService.createModel(e,t,o),this.createdEditorModel=!0,this.registerModelDisposeListener(n)),this.textEditorModelHandle=n.uri,n}getFirstLineText(e){let t=e;return typeof t.getFirstLineText=="function"?t.getFirstLineText(1e3):e.getLineContent(1).substr(0,1e3)}getOrCreateLanguage(e,t,o,n){return!o||o===$r?t.createByFilepathOrFirstLine(e??null,n):t.createById(o)}updateTextEditorModel(e,t,o){this.isResolved()&&(e&&this.modelService.updateModel(this.textEditorModel,e,o),t&&t!==$r&&this.textEditorModel.getLanguageId()!==t&&this.textEditorModel.setLanguage(this.languageService.createById(t)))}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()}};Lw=I([m(0,Tt),m(1,_t),m(2,vS),m(3,Oi)],Lw);var BEe=class extends wh{get originalModel(){return this._originalModel}get modifiedModel(){return this._modifiedModel}constructor(i,e){super(),this._originalModel=i,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 HEe=class extends BEe{constructor(e,t){super(e,t);this._textDiffEditorModel=void 0;this._originalModel=e,this._modifiedModel=t,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()}};var Pa=class extends Ma{constructor(e,t,o,n,r,s){super(e,t,o,n,s);this.original=o;this.modified=n;this.forceOpenAsBinary=r;this.cachedModel=void 0;this.labels=this.computeLabels()}static{this.ID="workbench.editors.diffEditorInput"}get typeId(){return Pa.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,t=!1;if(this.preferredName)e=this.preferredName;else{let p=this.original.getName(),h=this.modified.getName();e=d(4921,null,p,h),t=p===h}let o,n,r;if(this.preferredDescription)o=this.preferredDescription,n=this.preferredDescription,r=this.preferredDescription;else{o=this.computeLabel(this.original.getDescription(0),this.modified.getDescription(0)),r=this.computeLabel(this.original.getDescription(2),this.modified.getDescription(2));let p=this.original.getDescription(1),h=this.modified.getDescription(1);if(typeof p=="string"&&typeof h=="string"&&(p||h)){let[g,f]=awe([p,h]);n=this.computeLabel(g,f)}}let s=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 "),c=this.computeLabel(this.original.getTitle(2)??this.original.getName(),this.modified.getTitle(2)??this.modified.getName()," \u2194 "),u=this.getPreferredTitle();return u&&(s=`${u} (${s})`,l=`${u} (${l})`,c=`${u} (${c})`),{name:e,shortDescription:o,mediumDescription:n,longDescription:r,forceDescription:t,shortTitle:s,mediumTitle:l,longTitle:c}}computeLabel(e,t,o=" - "){if(!(!e||!t))return e===t?t:`${e}${o}${t}`}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(t=>t.typeId===bDt):e.find(t=>t.typeId===WX)}async createModel(){let[e,t]=await Promise.all([this.original.resolve(),this.modified.resolve()]);return t instanceof Lw&&e instanceof Lw?new HEe(e,t):new BEe(Pei(e)?e:void 0,Pei(t)?t:void 0)}toUntyped(e){let t=super.toUntyped(e);if(t)return{...t,modified:t.primary,original:t.secondary}}matches(e){return this===e?!0:e instanceof Pa?this.modified.matches(e.modified)&&this.original.matches(e.original)&&e.forceOpenAsBinary===this.forceOpenAsBinary:Ib(e)?this.modified.matches(e.modified)&&this.original.matches(e.original):!1}dispose(){this.cachedModel&&(this.cachedModel.dispose(),this.cachedModel=void 0),super.dispose()}};Pa=I([m(5,ee)],Pa);var PDt=class extends C6e{createEditorInput(i,e,t,o,n){return i.createInstance(Pa,e,t,o,n,void 0)}};var za=new Y("workbenchState",void 0,{type:"string",description:d(4915,null)}),sT=new Y("workspaceFolderCount",0,d(4916,null)),RF=new Y("openFolderWorkspaceSupport",!0,!0),iD=new Y("enterMultiRootWorkspaceSupport",!0,!0),zX=new Y("emptyWorkspaceSupport",!0,!0),k6e=new Y("dirtyWorkingCopies",!1,d(4861,null)),yb=new Y("remoteName","",d(4893,null)),WR=new Y("virtualWorkspace","",d(4914,null)),ADt=new Y("temporaryWorkspace",!1,d(4908,null)),wb=new Y("isSessionsWindow",!1,d(4880,null)),NDt=new Y("hasWebFileSystemAccess",!1,!0),veo=new Y("embedderIdentifier",void 0,d(4869,null)),ODt=new Y("inAutomation",!1,d(4872,null)),eA=new Y("isFullscreen",!1,d(4878,null)),Rw=new Y("isAuxiliaryWindowFocusedContext",!1,d(4875,null)),E6e=new Y("isWindowAlwaysOnTop",!1,d(4881,null)),Cb=new Y("isAuxiliaryWindow",!1,d(4874,null)),qde=new Y("activeEditorIsDirty",!1,d(4849,null)),UEe=new Y("activeEditorIsNotPreview",!1,d(4852,null)),FDt=new Y("activeEditorIsFirstInGroup",!1,d(4850,null)),$de=new Y("activeEditorIsLastInGroup",!1,d(4851,null)),VR=new Y("activeEditorIsPinned",!1,d(4853,null)),beo=new Y("activeEditorIsReadonly",!1,d(4854,null)),zEe=new Y("activeCompareEditorCanSwap",!1,d(4840,null)),WDt=new Y("activeEditorCanToggleReadonly",!0,d(4844,null)),VDt=new Y("activeEditorCanRevert",!1,d(4843,null)),wB=new Y("activeEditorCanSplitInGroup",!0),fr=new Y("activeEditor",null,{type:"string",description:d(4841,null)}),MF=new Y("activeEditorAvailableEditorIds","",d(4842,null)),T6e=new Y("textCompareEditorVisible",!1,d(4910,null)),bS=new Y("textCompareEditorActive",!1,d(4909,null)),VC=new Y("sideBySideEditorActive",!1,d(4905,null)),BDt=new Y("groupEditorsCount",0,d(4871,null)),jde=new Y("activeEditorGroupEmpty",!1,d(4845,null)),Seo=new Y("activeEditorGroupIndex",0,d(4846,null)),Ieo=new Y("activeEditorGroupLast",!1,d(4847,null)),aT=new Y("activeEditorGroupLocked",!1,d(4848,null)),SS=new Y("multipleEditorGroups",!1,d(4883,null)),yeo=SS.toNegated(),o4=new Y("multipleEditorsSelectedInGroup",!1,d(4884,null)),HDt=new Y("twoEditorsSelectedInGroup",!1,d(4913,null)),UDt=new Y("SelectedEditorsInGroupFileOrUntitledResourceContextKey",!0,d(4902,null)),n4=new Y("editorPartMultipleEditorGroups",!1,d(4867,null)),cpa=n4.toNegated(),CB=new Y("editorPartMaximizedEditorGroup",!1,d(4863,null)),xB=new Y("editorPartModal",!1,d(4864,null)),zDt=new Y("editorPartModalMaximized",!1,d(4865,null)),Qde=new Y("editorPartModalNavigation",!1,d(4866,null)),KDt=new Y("editorIsOpen",!1,d(4862,null)),BC=new Y("inZenMode",!1,d(4873,null)),_6e=new Y("isCenteredLayout",!1,d(4879,null)),Yde=new Y("splitEditorsVertically",!1,d(4906,null)),GDt=new Y("mainEditorAreaVisible",!0,d(4882,null)),xK=new Y("editorTabsVisible",!0,d(4868,null)),tA=new Y("sideBarVisible",!1,d(4904,null)),kB=new Y("sideBarFocus",!1,d(4903,null)),weo=new Y("activeViewlet","",d(4856,null)),KX=new Y("statusBarFocused",!1,d(4907,null)),GX=new Y("titleBarStyle","custom",d(4911,null)),r4=new Y("titleBarVisible",!1,d(4912,null)),PF=new Y("isCompactTitleBar",!1,d(4876,null)),D6e=new Y("bannerFocused",!1,d(4860,null)),oD=new Y("notificationFocus",!0,d(4886,null)),L6e=new Y("notificationCenterVisible",!1,d(4885,null)),EB=new Y("notificationToastsVisible",!1,d(4887,null)),Ceo=new Y("activeAuxiliary","",d(4839,null)),xeo=new Y("auxiliaryBarFocus",!1,d(4857,null)),iA=new Y("auxiliaryBarVisible",!1,d(4859,null)),kK=new Y("auxiliaryBarMaximized",!1,d(4858,null)),keo=new Y("activePanel","",d(4855,null)),Xde=new Y("panelFocus",!1,d(4889,null)),qX=new Y("panelPosition","bottom",d(4891,null)),TB=new Y("panelAlignment","center",d(4888,null)),$X=new Y("panelVisible",!1,d(4892,null)),qDt=new Y("panelMaximized",!1,d(4890,null)),ql=new Y("focusedView","",d(4870,null));function R6e(a){return`view.${a}.visible`}var rT=class{constructor(i,e,t,o){this._contextKeyService=i;this._fileService=e;this._languageService=t;this._modelService=o;this._schemeKey=rT.Scheme.bindTo(this._contextKeyService),this._filenameKey=rT.Filename.bindTo(this._contextKeyService),this._dirnameKey=rT.Dirname.bindTo(this._contextKeyService),this._pathKey=rT.Path.bindTo(this._contextKeyService),this._langIdKey=rT.LangId.bindTo(this._contextKeyService),this._resourceKey=rT.Resource.bindTo(this._contextKeyService),this._extensionKey=rT.Extension.bindTo(this._contextKeyService),this._hasResource=rT.HasResource.bindTo(this._contextKeyService),this._isFileSystemResource=rT.IsFileSystemResource.bindTo(this._contextKeyService)}static{this.Scheme=new Y("resourceScheme",void 0,{type:"string",description:d(4900,null)})}static{this.Filename=new Y("resourceFilename",void 0,{type:"string",description:d(4897,null)})}static{this.Dirname=new Y("resourceDirname",void 0,{type:"string",description:d(4895,null)})}static{this.Path=new Y("resourcePath",void 0,{type:"string",description:d(4899,null)})}static{this.LangId=new Y("resourceLangId",void 0,{type:"string",description:d(4898,null)})}static{this.Resource=new Y("resource",void 0,{type:"URI",description:d(4894,null)})}static{this.Extension=new Y("resourceExtname",void 0,{type:"string",description:d(4896,null)})}static{this.HasResource=new Y("resourceSet",void 0,{type:"boolean",description:d(4901,null)})}static{this.IsFileSystemResource=new Y("isFileSystemResource",void 0,{type:"boolean",description:d(4877,null)})}_setLangId(){let i=this.get();if(!i){this._langIdKey.set(null);return}let e=this._modelService.getModel(i)?.getLanguageId()??this._languageService.guessLanguageIdByFilepathOrFirstLine(i);this._langIdKey.set(e)}set(i){i=i??void 0,!Qe(this._value,i)&&(this._value=i,this._contextKeyService.bufferChangeEvents(()=>{this._resourceKey.set(i?i.toString():null),this._schemeKey.set(i?i.scheme:null),this._filenameKey.set(i?He(i):null),this._dirnameKey.set(i?this.uriToPath(ci(i)):null),this._pathKey.set(i?this.uriToPath(i):null),this._setLangId(),this._extensionKey.set(i?es(i):null),this._hasResource.set(!!i),this._isFileSystemResource.set(i?this._fileService.hasProvider(i):!1)}))}uriToPath(i){return i.scheme===Q.file?i.fsPath:i.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}};rT=I([m(0,X),m(1,fe),m(2,_t),m(3,Tt)],rT);var Wo=class extends rT{constructor(e,t,o,n){super(e,t,o,n);this._disposables=new N;this._disposables.add(t.onDidChangeFileSystemProviderRegistrations(()=>{let r=this.get();this._isFileSystemResource.set(!!(r&&t.hasProvider(r)))})),this._disposables.add(n.onModelAdded(r=>{Qe(r.uri,this.get())&&this._setLangId()})),this._disposables.add(n.onModelLanguageChanged(r=>{Qe(r.model.uri,this.get())&&this._setLangId()}))}dispose(){this._disposables.dispose()}};Wo=I([m(0,X),m(1,fe),m(2,_t),m(3,Tt)],Wo);var UX=class extends rT{};function $Dt(a,i,e){if(!i){a.set("");return}let t=shi(i,e);a.set(t.join(","))}function shi(a,i){if(a.resource?.scheme===Q.untitled&&a.editorId!==la.id)return[];if(a instanceof Pa){let e=shi(a.original,i),t=new Set(shi(a.modified,i));return e.filter(o=>t.has(o))}return a.resource?i.getEditors(a.resource).map(e=>e.id):[]}var oA="__";function Jde(a){return typeof a=="object"&&a!==null&&"wwwAuthenticate"in a&&typeof a.wwwAuthenticate=="string"}var xs=le("IAuthenticationService");var jX=le("IAuthenticationExtensionsService");var cs;(n=>(n.Setup={hidden:new Y("chatSetupHidden",!1,!0),installed:new Y("chatSetupInstalled",!1,!0),disabled:new Y("chatSetupDisabled",!1,!0),untrusted:new Y("chatSetupUntrusted",!1,!0),later:new Y("chatSetupLater",!1,!0),registered:new Y("chatSetupRegistered",!1,!0)},n.Entitlement={signedOut:new Y("chatEntitlementSignedOut",!1,!0),canSignUp:new Y("chatPlanCanSignUp",!1,!0),planFree:new Y("chatPlanFree",!1,!0),planPro:new Y("chatPlanPro",!1,!0),planEdu:new Y("chatPlanEdu",!1,!0),planProPlus:new Y("chatPlanProPlus",!1,!0),planBusiness:new Y("chatPlanBusiness",!1,!0),planEnterprise:new Y("chatPlanEnterprise",!1,!0),organisations:new Y("chatEntitlementOrganisations",void 0,!0),internal:new Y("chatEntitlementInternal",!1,!0),sku:new Y("chatEntitlementSku",void 0,!0)},n.chatQuotaExceeded=new Y("chatQuotaExceeded",!1,!0),n.completionsQuotaExceeded=new Y("completionsQuotaExceeded",!1,!0),n.chatAnonymous=new Y("chatAnonymous",!1,!0)))(cs||={});var rr=le("chatEntitlementService");function AF(a){return a===10||a===6||a===7||a===8||a===9}function QDt(a){switch(a){case 10:return d(17405,null);case 6:return d(17408,null);case 7:return d(17409,null);case 8:return d(17404,null);case 9:return d(17406,null);default:return d(17407,null)}}var jDt={upgradePlanUrl:ro.defaultChatAgent?.upgradePlanUrl??"",providerUriSetting:ro.defaultChatAgent?.providerUriSetting??"",entitlementSignupLimitedUrl:ro.defaultChatAgent?.entitlementSignupLimitedUrl??"",chatQuotaExceededContext:ro.defaultChatAgent?.chatQuotaExceededContext??"",completionsQuotaExceededContext:ro.defaultChatAgent?.completionsQuotaExceededContext??""},Eeo="chat.allowAnonymousAccess";function ahi(a,i,e){return!(a.getValue(Eeo)!==!0||i!==1||e.hidden||e.disabled)}function Teo(a,i,e){e.publicLog2("chatEntitlements",{chatHidden:!!a.hidden,chatDisabled:!!a.disabled,chatEntitlement:a.entitlement,chatRegistered:!!a.registered,chatAnonymous:ahi(i,a.entitlement,a)})}var M6e=class extends x{constructor(e,t,o,n,r,s){super();this.contextKeyService=n;this.configurationService=r;this.telemetryService=s;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:jDt.chatQuotaExceededContext,completionsQuotaExceeded:jDt.completionsQuotaExceededContext};this._onDidChangeAnonymous=this._register(new E);this.onDidChangeAnonymous=this._onDidChangeAnonymous.event;this.anonymousObs=ui(this.onDidChangeAnonymous,()=>this.anonymous);if(this.chatQuotaExceededContextKey=cs.chatQuotaExceeded.bindTo(this.contextKeyService),this.completionsQuotaExceededContextKey=cs.completionsQuotaExceeded.bindTo(this.contextKeyService),this.anonymousContextKey=cs.chatAnonymous.bindTo(this.contextKeyService),this.anonymousContextKey.set(this.anonymous),this.onDidChangeEntitlement=U.map(U.filter(this.contextKeyService.onDidChangeContext,c=>c.affectsSome(new Set([cs.Entitlement.planEdu.key,cs.Entitlement.planPro.key,cs.Entitlement.planBusiness.key,cs.Entitlement.planEnterprise.key,cs.Entitlement.planProPlus.key,cs.Entitlement.planFree.key,cs.Entitlement.canSignUp.key,cs.Entitlement.signedOut.key,cs.Entitlement.organisations.key,cs.Entitlement.internal.key,cs.Entitlement.sku.key])),this._store),()=>{},this._store),this.entitlementObs=ui(this.onDidChangeEntitlement,()=>this.entitlement),this.onDidChangeSentiment=U.map(U.filter(this.contextKeyService.onDidChangeContext,c=>c.affectsSome(new Set([cs.Setup.hidden.key,cs.Setup.disabled.key,cs.Setup.untrusted.key,cs.Setup.installed.key,cs.Setup.later.key,cs.Setup.registered.key])),this._store),()=>{},this._store),this.sentimentObs=ui(this.onDidChangeSentiment,()=>this.sentiment),Wt&&!o.remoteAuthority){cs.Setup.hidden.bindTo(this.contextKeyService).set(!0);return}if(!t.defaultChatAgent)return;let l=this.context=new co(()=>this._register(e.createInstance(EK)));this.requests=new co(()=>this._register(e.createInstance(P6e,l.value,{clearQuotas:()=>this.clearQuotas(),acceptQuotas:c=>this.acceptQuotas(c)}))),this.registerListeners()}get entitlement(){return this.contextKeyService.getContextKeyValue(cs.Entitlement.planEdu.key)===!0?10:this.contextKeyService.getContextKeyValue(cs.Entitlement.planPro.key)===!0?6:this.contextKeyService.getContextKeyValue(cs.Entitlement.planBusiness.key)===!0?8:this.contextKeyService.getContextKeyValue(cs.Entitlement.planEnterprise.key)===!0?9:this.contextKeyService.getContextKeyValue(cs.Entitlement.planProPlus.key)===!0?7:this.contextKeyService.getContextKeyValue(cs.Entitlement.planFree.key)===!0?5:this.contextKeyService.getContextKeyValue(cs.Entitlement.canSignUp.key)===!0?3:this.contextKeyService.getContextKeyValue(cs.Entitlement.signedOut.key)===!0?1:2}get isInternal(){return this.contextKeyService.getContextKeyValue(cs.Entitlement.internal.key)===!0}get organisations(){return this.contextKeyService.getContextKeyValue(cs.Entitlement.organisations.key)}get sku(){return this.contextKeyService.getContextKeyValue(cs.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]),t=this._register(new me);this._register(this.contextKeyService.onDidChangeContext(r=>{r.affectsSome(e)&&(t.value&&t.value.cancel(),t.value=new Ye,this.update(t.value.token))}));let o=this.anonymous,n=()=>{let r=this.anonymous;r!==o&&(o=r,this.anonymousContextKey.set(r),this.context?.hasValue&&Teo(this.context.value.state,this.configurationService,this.telemetryService),this._onDidChangeAnonymous.fire())};this._register(this.configurationService.onDidChangeConfiguration(r=>{r.affectsConfiguration(Eeo)&&n()})),this._register(this.onDidChangeEntitlement(()=>n())),this._register(this.onDidChangeSentiment(()=>n()))}acceptQuotas(e){let t=this._quotas;this._quotas=e,this.updateContextKeys();let{changed:o}=this.compareQuotas(t.chat,e.chat),{changed:n}=this.compareQuotas(t.completions,e.completions),{changed:r}=this.compareQuotas(t.premiumChat,e.premiumChat);(o.exceeded||n.exceeded||r.exceeded)&&this._onDidChangeQuotaExceeded.fire(),(o.remaining||n.remaining||r.remaining)&&this._onDidChangeQuotaRemaining.fire()}compareQuotas(e,t){return{changed:{exceeded:e?.percentRemaining===0!=(t?.percentRemaining===0),remaining:e?.percentRemaining!==t?.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(cs.Setup.installed.key)===!0,hidden:this.contextKeyService.getContextKeyValue(cs.Setup.hidden.key)===!0,disabled:this.contextKeyService.getContextKeyValue(cs.Setup.disabled.key)===!0,untrusted:this.contextKeyService.getContextKeyValue(cs.Setup.untrusted.key)===!0,later:this.contextKeyService.getContextKeyValue(cs.Setup.later.key)===!0,registered:this.contextKeyService.getContextKeyValue(cs.Setup.registered.key)===!0}}get anonymous(){return ahi(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)}};M6e=I([m(0,F),m(1,tt),m(2,At),m(3,X),m(4,B),m(5,Te)],M6e);var P6e=class extends x{constructor(e,t,o,n,r,s,l,c,u,p){super();this.context=e;this.chatQuotasAccessor=t;this.telemetryService=o;this.logService=n;this.requestService=r;this.dialogService=s;this.openerService=l;this.lifecycleService=c;this.defaultAccountService=u;this.authenticationService=p;this.pendingResolveCts=new Ye;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 Ye,t=await this.defaultAccountService.getDefaultAccount();if(e.token.isCancellationRequested)return;let o;t?this.state.entitlement===1&&(o={entitlement:2}):o={entitlement:1},o&&this.update(o),t&&await this.resolveEntitlement(t,e.token)}async resolveEntitlement(e,t){let o=await this.doResolveEntitlement(e,t);return typeof o?.entitlement=="number"&&!t.isCancellationRequested&&this.update(o),o}async doResolveEntitlement(e,t){if(t.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 n;o.access_type_sku==="free_limited_copilot"?n=5:o.can_signup_for_limited?n=3:o.copilot_plan==="individual_edu"?n=10:o.copilot_plan==="individual"?n=6:o.copilot_plan==="individual_pro"?n=7:o.copilot_plan==="business"?n=8:o.copilot_plan==="enterprise"?n=9:n=4;let r={entitlement:n,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 ${r.entitlement}, quotas: ${JSON.stringify(r.quotas)}`),this.telemetryService.publicLog2("chatInstallEntitlement",{entitlement:r.entitlement,tid:o.analytics_tracking_id,sku:r.sku,quotaChat:r.quotas?.chat?.remaining,quotaPremiumChat:r.quotas?.premiumChat?.remaining,quotaCompletions:r.quotas?.completions?.remaining,quotaResetDate:r.quotas?.resetDate}),r}toQuotas(e){let t={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"&&(t.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"&&(t.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 n=e.quota_snapshots[o];if(!n)continue;let r={total:n.entitlement,remaining:n.remaining,percentRemaining:Math.min(100,Math.max(0,n.percent_remaining)),overageEnabled:n.overage_permitted,overageCount:n.overage_count,unlimited:n.unlimited};switch(o){case"chat":t.chat=r;break;case"completions":t.completions=r;break;case"premium_interactions":t.premiumChat=r;break}}return t}async request(e,t,o,n,r,s){let l;for(let c of n){if(r.isCancellationRequested)return l;try{let u=await this.requestService.request({type:t,url:e,data:t==="POST"?JSON.stringify(o):void 0,disableCache:!0,headers:{Authorization:`Bearer ${c.accessToken}`},callSite:s},r),p=u.res.statusCode;if(p&&p!==200){l=u;continue}return u}catch(u){r.isCancellationRequested||this.logService.error(`[chat entitlement] request: error ${u}`)}}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=Se.None){let t=await this.defaultAccountService.refresh();if(t)return this.resolveEntitlement(t,e)}async signUpFree(){let e=await this.getSessions();if(e.length!==0)return this.doSignUpFree(e)}async doSignUpFree(e){let t={restricted_telemetry:this.telemetryService.telemetryLevel===0?"disabled":"enabled",public_code_suggestions:"enabled"},o=await this.request(jDt.entitlementSignupLimitedUrl,"POST",t,e,Se.None,"chatEntitlementService.signUpFree");if(!o)return await this.onUnknownSignUpError(d(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 tD(o);if(l){let c=JSON.parse(l);if(typeof c.message=="string"&&c.message)return this.onUnprocessableSignUpError(`[chat entitlement] sign-up: unprocessable entity (${c.message})`,c.message),{errorCode:o.res.statusCode}}}catch{}return await this.onUnknownSignUpError(d(17414,null,o.res.statusCode),`[chat entitlement] sign-up: unexpected status code ${o.res.statusCode}`)?this.doSignUpFree(e):{errorCode:o.res.statusCode}}let n=null;try{n=await tD(o)}catch{}if(!n)return await this.onUnknownSignUpError(d(17412,null),"[chat entitlement] sign-up: response has no content")?this.doSignUpFree(e):{errorCode:2};let r;try{r=JSON.parse(n),this.logService.trace(`[chat entitlement] sign-up: response is ${n}`)}catch(s){return await this.onUnknownSignUpError(d(17411,null),`[chat entitlement] sign-up: error parsing response (${s})`)?this.doSignUpFree(e):{errorCode:3}}return this.update({entitlement:5}),!!r?.subscribed}async getSessions(){let e=await this.defaultAccountService.getDefaultAccount();if(e){let o=(await this.authenticationService.getSessions(e.authenticationProvider.id)).filter(n=>n.id===e.sessionId);if(o.length)return o}return[...await this.authenticationService.getSessions(this.defaultAccountService.getDefaultAccountAuthenticationProvider().id)]}async onUnknownSignUpError(e,t){if(this.logService.error(t),!this.lifecycleService.willShutdown){let{confirmed:o}=await this.dialogService.confirm({type:bt.Error,message:d(17415,null),detail:e,primaryButton:d(17410,null)});return o}return!1}onUnprocessableSignUpError(e,t){this.logService.error(e),this.lifecycleService.willShutdown||this.dialogService.prompt({type:bt.Error,message:d(17416,null),detail:t,buttons:[{label:d(17403,null),run:()=>{}},{label:d(17402,null),run:()=>this.openerService.open(A.parse(jDt.upgradePlanUrl))}]})}async signIn(e){let t=await this.defaultAccountService.signIn({additionalScopes:e?.additionalScopes,extraAuthorizeParameters:{get_started_with:"copilot-vscode"},provider:e?.useSocialProvider});if(!t)return{};let o=await this.doResolveEntitlement(t,Se.None);return{defaultAccount:t,entitlements:o}}dispose(){this.pendingResolveCts.dispose(!0),super.dispose()}};P6e=I([m(2,Te),m(3,se),m(4,Ea),m(5,at),m(6,Je),m(7,ji),m(8,ng),m(9,xs)],P6e);var EK=class extends x{constructor(e,t,o,n,r){super();this.storageService=t;this.logService=o;this.configurationService=n;this.telemetryService=r;this.suspendedState=void 0;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this.updateBarrier=void 0;this.canSignUpContextKey=cs.Entitlement.canSignUp.bindTo(e),this.signedOutContextKey=cs.Entitlement.signedOut.bindTo(e),this.freeContextKey=cs.Entitlement.planFree.bindTo(e),this.eduContextKey=cs.Entitlement.planEdu.bindTo(e),this.proContextKey=cs.Entitlement.planPro.bindTo(e),this.proPlusContextKey=cs.Entitlement.planProPlus.bindTo(e),this.businessContextKey=cs.Entitlement.planBusiness.bindTo(e),this.enterpriseContextKey=cs.Entitlement.planEnterprise.bindTo(e),this.organisationsContextKey=cs.Entitlement.organisations.bindTo(e),this.isInternalContextKey=cs.Entitlement.internal.bindTo(e),this.skuContextKey=cs.Entitlement.sku.bindTo(e),this.hiddenContext=cs.Setup.hidden.bindTo(e),this.laterContext=cs.Setup.later.bindTo(e),this.installedContext=cs.Setup.installed.bindTo(e),this.disabledContext=cs.Setup.disabled.bindTo(e),this.untrustedContext=cs.Setup.untrusted.bindTo(e),this.registeredContext=cs.Setup.registered.bindTo(e),this._state=this.storageService.getObject(EK.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(EK.CHAT_DISABLED_CONFIGURATION_KEY)&&this.updateContext()}))}withConfiguration(e){return this.configurationService.getValue(EK.CHAT_DISABLED_CONFIGURATION_KEY)===!0?{...e,hidden:!0}:e}async update(e){this.logService.trace(`[chat entitlement context] update(): ${JSON.stringify(e)}`);let t=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||AF(this._state.entitlement)?this._state.registered=!0:this._state.entitlement===3&&(this._state.registered=!1)),ahi(this.configurationService,this._state.entitlement,this._state)&&(this._state.sku="no_auth_limited_copilot"),t!==JSON.stringify(this._state))return this.storageService.store(EK.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(t=>t==="github"||t==="microsoft"||t==="ms-copilot"||t==="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)}`),Teo(e,this.configurationService,this.telemetryService),this._onDidChange.fire()}suspend(){this.suspendedState={...this._state},this.updateBarrier=new gp}resume(){this.suspendedState=void 0,this.updateBarrier?.open(),this.updateBarrier=void 0}};EK=I([m(0,X),m(1,ce),m(2,se),m(3,B),m(4,Te)],EK);Ee(rr,M6e,0);var sc="local",YDt="agent",QX;(t=>{function a(o){return new Map(Object.entries(o))}t.fromRecord=a;function i(o){let n=Object.create(null);for(let[r,s]of o)n[r]=s;return n}t.toRecord=i;function e(o){if(o)return Array.from(o,([n,r])=>({optionId:n,value:typeof r=="string"?r:r.id}))}t.toStrValueArray=e})(QX||={});var Us=le("chatSessionsService");function HC(a){return a===2||a===3}function _eo(a){let i=a;return i&&i.uri instanceof A&&typeof i.insertions=="number"&&typeof i.deletions=="number"}var ac=(t=>(t.Ask="ask",t.Edit="edit",t.Agent="agent",t))(ac||{});function Deo(a){switch(a){case"ask":case"edit":case"agent":return a;default:return}}function YX(a){return a==="autoApprove"||a==="autopilot"}var ks=(o=>(o.Chat="panel",o.Terminal="terminal",o.Notebook="notebook",o.EditorInline="editor",o))(ks||{});(i=>{function a(e){switch(e){case"panel":return"panel";case"terminal":return"terminal";case"notebook":return"notebook";case"editor":return"editor"}return"panel"}i.fromRaw=a})(ks||={});var v$o=new Set([Q.vscodeChatEditor,Q.walkThrough,Q.vscodeLocalChatSession,Q.vscodeSettings,Q.webviewPanel,Q.vscodeUserData,Q.extension,"ccreq","openai-codex"]);function KEe(a,i){let e=a.get(Us);return!(v$o.has(i)||e.getContentProviderSchemes().includes(i))}var A6e="workbench.action.chat.manage",Leo=30;var GEe=new Y("inModelsEditor",!1),XDt=new Y("inModelsSearch",!1);var ie;(Ao=>{Ao.responseVote=new Y("chatSessionResponseVote","",{type:"string",description:d(8187,null)}),Ao.responseDetectedAgentCommand=new Y("chatSessionResponseDetectedAgentOrCommand",!1,{type:"boolean",description:d(8165,null)}),Ao.responseSupportsIssueReporting=new Y("chatResponseSupportsIssueReporting",!1,{type:"boolean",description:d(8157,null)}),Ao.responseIsFiltered=new Y("chatSessionResponseFiltered",!1,{type:"boolean",description:d(8156,null)}),Ao.responseHasError=new Y("chatSessionResponseError",!1,{type:"boolean",description:d(8155,null)}),Ao.requestInProgress=new Y("chatSessionRequestInProgress",!1,{type:"boolean",description:d(8186,null)}),Ao.currentlyEditing=new Y("chatSessionCurrentlyEditing",!1,{type:"boolean",description:d(8184,null)}),Ao.currentlyEditingInput=new Y("chatSessionCurrentlyEditingInput",!1,{type:"boolean",description:d(8185,null)});let l;(MSe=>(MSe.Sent="s",MSe.Queue="q",MSe.Steer="st"))(l=Ao.EditingRequestType||={}),Ao.editingRequestType=new Y("chatEditingSentRequest",void 0,{type:"string",description:d(8130,null)}),Ao.isResponse=new Y("chatResponse",!1,{type:"boolean",description:d(8154,null)}),Ao.isRequest=new Y("chatRequest",!1,{type:"boolean",description:d(8152,null)}),Ao.isFirstRequest=new Y("chatFirstRequest",!1,{type:"boolean",description:d(8132,null)}),Ao.isPendingRequest=new Y("chatRequestIsPending",!1,{type:"boolean",description:d(8153,null)}),Ao.itemId=new Y("chatItemId","",{type:"string",description:d(8141,null)}),Ao.lastItemId=new Y("chatLastItemId",[],{type:"string",description:d(8142,null)}),Ao.editApplied=new Y("chatEditApplied",!1,{type:"boolean",description:d(8124,null)}),Ao.inputHasText=new Y("chatInputHasText",!1,{type:"boolean",description:d(8183,null)}),Ao.inputHasFocus=new Y("chatInputHasFocus",!1,{type:"boolean",description:d(8182,null)}),Ao.inChatInput=new Y("inChatInput",!1,{type:"boolean",description:d(8180,null)}),Ao.inChatSession=new Y("inChat",!1,{type:"boolean",description:d(8174,null)}),Ao.inChatQuestionCarousel=new Y("inChatQuestionCarousel",!1,{type:"boolean",description:d(8176,null)}),Ao.inChatEditor=new Y("inChatEditor",!1,{type:"boolean",description:d(8175,null)}),Ao.inChatTodoList=new Y("inChatTodoList",!1,{type:"boolean",description:d(8179,null)}),Ao.inChatTip=new Y("inChatTip",!1,{type:"boolean",description:d(8178,null)}),Ao.multipleChatTips=new Y("multipleChatTips",!1,{type:"boolean",description:d(8190,null)}),Ao.inChatTerminalToolOutput=new Y("inChatTerminalToolOutput",!1,{type:"boolean",description:d(8177,null)}),Ao.chatModeKind=new Y("chatAgentKind","ask",{type:"string",description:d(8109,null)}),Ao.chatPermissionLevel=new Y("chatPermissionLevel","default",{type:"string",description:d(8150,null)}),Ao.chatModeName=new Y("chatModeName","",{type:"string",description:d(8145,null)}),Ao.chatModelId=new Y("chatModelId","",{type:"string",description:d(8143,null)}),Ao.supported=C.or(Fu.negate(),yb.notEqualsTo(""),C.has("config.chat.experimental.serverlessWebEnabled")),Ao.enabled=new Y("chatIsEnabled",!1,{type:"boolean",description:d(8139,null)}),Ao.lockedToCodingAgent=new Y("lockedToCodingAgent",!1,{type:"boolean",description:d(8189,null)}),Ao.lockedCodingAgentId=new Y("lockedCodingAgentId","",{type:"string",description:d(8188,null)}),Ao.chatSessionHasCustomAgentTarget=new Y("chatSessionHasCustomAgentTarget",!1,{type:"boolean",description:d(8158,null)}),Ao.chatSessionHasTargetedModels=new Y("chatSessionHasTargetedModels",!1,{type:"boolean",description:d(8162,null)}),Ao.agentSupportsAttachments=new Y("agentSupportsAttachments",!1,{type:"boolean",description:d(8121,null)}),Ao.withinEditSessionDiff=new Y("withinEditSessionDiff",!1,{type:"boolean",description:d(8192,null)}),Ao.filePartOfEditSession=new Y("filePartOfEditSession",!1,{type:"boolean",description:d(8171,null)}),Ao.extensionParticipantRegistered=new Y("chatPanelExtensionParticipantRegistered",!1,{type:"boolean",description:d(8147,null)}),Ao.panelParticipantRegistered=new Y("chatPanelParticipantRegistered",!1,{type:"boolean",description:d(8149,null)}),Ao.chatEditingCanUndo=new Y("chatEditingCanUndo",!1,{type:"boolean",description:d(8126,null)}),Ao.chatEditingCanRedo=new Y("chatEditingCanRedo",!1,{type:"boolean",description:d(8125,null)}),Ao.languageModelsAreUserSelectable=new Y("chatModelsAreUserSelectable",!1,{type:"boolean",description:d(8144,null)}),Ao.chatSessionHasModels=new Y("chatSessionHasModels",!1,{type:"boolean",description:d(8161,null)}),Ao.chatSessionOptionsValid=new Y("chatSessionOptionsValid",!0,{type:"boolean",description:d(8164,null)}),Ao.extensionInvalid=new Y("chatExtensionInvalid",!1,{type:"boolean",description:d(8131,null)}),Ao.inputCursorAtTop=new Y("chatCursorAtTop",!1),Ao.inputHasAgent=new Y("chatInputHasAgent",!1),Ao.location=new Y("chatLocation",void 0),Ao.inQuickChat=new Y("quickChatHasFocus",!1,{type:"boolean",description:d(8181,null)}),Ao.inAgentSessionsWelcome=new Y("inAgentSessionsWelcome",!1,{type:"boolean",description:d(8173,null)}),Ao.chatSessionType=new Y("chatSessionType","",{type:"string",description:d(8168,null)}),Ao.hasFileAttachments=new Y("chatHasFileAttachments",!1,{type:"boolean",description:d(8136,null)}),Ao.chatSessionIsEmpty=new Y("chatSessionIsEmpty",!0,{type:"boolean",description:d(8163,null)}),Ao.hasPendingRequests=new Y("chatHasPendingRequests",!1,{type:"boolean",description:d(8137,null)}),Ao.chatSessionHasDebugData=new Y("chatSessionHasDebugData",!1,{type:"boolean",description:d(8159,null)}),Ao.chatSessionHasDebugTools=new Y("chatSessionHasDebugTools",!1,{type:"boolean",description:d(8160,null)}),Ao.remoteJobCreating=new Y("chatRemoteJobCreating",!1,{type:"boolean",description:d(8151,null)}),Ao.hasRemoteCodingAgent=new Y("hasRemoteCodingAgent",!1,d(8172,null)),Ao.hasCanDelegateProviders=new Y("chatHasCanDelegateProviders",!1,{type:"boolean",description:d(8135,null)}),Ao.enableRemoteCodingAgentPromptFileOverlay=new Y("enableRemoteCodingAgentPromptFileOverlay",!1,d(8170,null)),Ao.skipChatRequestInProgressMessage=new Y("chatSkipRequestInProgressMessage",!1,{type:"boolean",description:d(8169,null)}),Ao.Setup=cs.Setup,Ao.Entitlement=cs.Entitlement,Ao.chatQuotaExceeded=cs.chatQuotaExceeded,Ao.completionsQuotaExceeded=cs.completionsQuotaExceeded,Ao.Editing={hasToolConfirmation:new Y("chatHasToolConfirmation",!1,{type:"boolean",description:d(8129,null)}),hasElicitationRequest:new Y("chatHasElicitationRequest",!1,{type:"boolean",description:d(8127,null)}),hasQuestionCarousel:new Y("chatHasQuestionCarousel",!1,{type:"boolean",description:d(8128,null)})},Ao.Tools={toolsCount:new Y("toolsCount",0,{type:"number",description:d(8191,null)})},Ao.foregroundSessionCount=new Y("chatForegroundSessionCount",0,{type:"number",description:d(8133,null)}),Ao.Modes={hasCustomChatModes:new Y("chatHasCustomAgents",!1,{type:"boolean",description:d(8134,null)}),agentModeDisabledByPolicy:new Y("chatAgentModeDisabledByPolicy",!1,{type:"boolean",description:d(8122,null)})},Ao.panelLocation=new Y("chatPanelLocation",void 0,{type:"number",description:d(8148,null)}),Ao.agentSessionsViewerFocused=new Y("agentSessionsViewerFocused",!0,{type:"boolean",description:d(8116,null)}),Ao.agentSessionsViewerOrientation=new Y("agentSessionsViewerOrientation",void 0,{type:"number",description:d(8117,null)}),Ao.agentSessionsViewerPosition=new Y("agentSessionsViewerPosition",void 0,{type:"number",description:d(8118,null)}),Ao.agentSessionsViewerVisible=new Y("agentSessionsViewerVisible",void 0,{type:"boolean",description:d(8119,null)}),Ao.agentSessionType=new Y("chatSessionType","",{type:"string",description:d(8120,null)}),Ao.chatSessionSupportsDelegation=new Y("chatSessionSupportsDelegation",!0,{type:"boolean",description:d(8166,null)}),Ao.chatSessionSupportsFork=new Y("chatSessionSupportsFork",!1,{type:"boolean",description:d(8167,null)}),Ao.agentSessionSection=new Y("agentSessionSection","",{type:"string",description:d(8115,null)}),Ao.isArchivedAgentSession=new Y("agentSessionIsArchived",!1,{type:"boolean",description:d(8112,null)}),Ao.isPinnedAgentSession=new Y("agentSessionIsPinned",!1,{type:"boolean",description:d(8113,null)}),Ao.isReadAgentSession=new Y("agentSessionIsRead",!1,{type:"boolean",description:d(8114,null)}),Ao.hasMultipleAgentSessionsSelected=new Y("agentSessionHasMultipleSelected",!1,{type:"boolean",description:d(8111,null)}),Ao.hasAgentSessionChanges=new Y("agentSessionHasChanges",!1,{type:"boolean",description:d(8110,null)}),Ao.isKatexMathElement=new Y("chatIsKatexMathElement",!1,{type:"boolean",description:d(8140,null)}),Ao.hasUsedCreateSlashCommands=new Y("chatHasUsedCreateSlashCommands",!1,{type:"boolean",description:d(8138,null)}),Ao.contextUsageHasBeenOpened=new Y("chatContextUsageHasBeenOpened",!1,{type:"boolean",description:d(8123,null)}),Ao.newChatButtonExperimentIcon=new Y("chatNewChatButtonExperimentIcon","",{type:"string",description:d(8146,null)})})(ie||={});var lhi;(e=>(e.inEditingMode=C.or(ie.chatModeKind.isEqualTo("edit"),ie.chatModeKind.isEqualTo("agent")),e.chatSetupTriggerContext=C.or(ie.Setup.installed.negate(),ie.Entitlement.canSignUp)))(lhi||={});var s4=le("ILanguageModelsConfigurationService");var nD;(t=>{function a(o){return(typeof o.capabilities?.agentMode>"u"||o.capabilities.agentMode)&&!!o.capabilities?.toolCalling}t.suitableForAgentMode=a;function i(o){return`${o.name} (${o.vendor})`}t.asQualifiedName=i;function e(o,n){return n.vendor==="copilot"&&o===n.name?!0:o===i(n)}t.matchesQualifiedName=e})(nD||={});async function JDt(a){let i="",e=(async()=>{if(a?.stream)for await(let t of a.stream)if(Array.isArray(t))for(let o of t)o.type==="text"&&(i+=o.value);else t.type==="text"&&(i+=t.value)})();try{return await Promise.all([a.result,e]),i}catch(t){if(i)return i;throw t}}function Peo(a){if(typeof a!="object"||a===null)return!1;let i=a;return(i.name===void 0||typeof i.name=="string")&&(i.id===void 0||typeof i.id=="string")&&(i.vendor===void 0||typeof i.vendor=="string")&&(i.version===void 0||typeof i.version=="string")&&(i.family===void 0||typeof i.family=="string")&&(i.tokens===void 0||typeof i.tokens=="number")&&(i.extension===void 0||typeof i.extension=="object")}var ds=le("ILanguageModelsService"),Reo={type:"object",required:["vendor","displayName"],properties:{vendor:{type:"string",description:d(8232,null)},displayName:{type:"string",description:d(8228,null)},configuration:{type:"object",description:d(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:d(8227,null)}}}},additionalProperties:{$ref:"http://json-schema.org/draft-07/schema#",properties:{secret:{type:"boolean",description:d(8227,null)}}}}}]},managementCommand:{type:"string",description:d(8230,null),deprecated:!0,deprecationMessage:d(8231,null)},when:{type:"string",description:d(8234,null)}}},b$o=Rn.registerExtensionPoint({extensionPoint:"languageModelChatProviders",jsonSchema:{description:d(8225,null),oneOf:[Reo,{type:"array",items:Reo}]},activationEventsGenerator:function*(a){for(let i of a)yield`onLanguageModelChatProvider:${i.vendor}`}}),chi="chatModelPickerPreferences",Meo="chatModelRecentlyUsed",dhi="chat.participantNameRegistry",uhi="chat.modelsControl",a4=class{constructor(i,e,t,o,n,r,s,l,c){this._extensionService=i;this._logService=e;this._storageService=t;this._contextKeyService=o;this._languageModelsConfigurationService=n;this._quickInputService=r;this._secretStorageService=s;this._productService=l;this._requestService=c;this._store=new N;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 Nx;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=Me(this,Object.create(null));this.restrictedChatParticipants=this._restrictedChatParticipants;this._hasUserSelectableModels=ie.languageModelsAreUserSelectable.bindTo(o),this._modelPickerUserPreferences=this._readModelPickerPreferences(),this._recentlyUsedModelIds=this._readRecentlyUsedModels(),this._initChatControlData(),this._store.add(this._storageService.onDidChangeValue(0,chi,this._store)(()=>this._onDidChangeModelPickerPreferences())),this._store.add(this.onDidChangeLanguageModels(()=>{this._hasUserSelectableModels.set(this._modelCache.size>0&&Array.from(this._modelCache.values()).some(u=>u.isUserSelectable)),this._refreshModelsControlManifest()})),this._store.add(this._languageModelsConfigurationService.onDidChangeLanguageModelGroups(u=>this._onDidChangeLanguageModelGroups(u))),this._store.add(b$o.setHandler((u,{added:p,removed:h})=>{let g=[],f=[];for(let v of p)for(let b of vt.wrap(v.value)){if(this._vendors.has(b.vendor)){v.collector.error(d(8233,null,b.vendor));continue}if(uc(b.vendor)){v.collector.error(d(8229,null));continue}if(b.vendor.trim()!==b.vendor){v.collector.error(d(8235,null));continue}g.push(b)}for(let v of h)for(let b of vt.wrap(v.value))f.push(b);this.deltaLanguageModelChatProviderDescriptors(g,f)}))}static{this.SECRET_KEY_PREFIX="chat.lm.secret."}static{this.SECRET_INPUT="${input:{0}}"}deltaLanguageModelChatProviderDescriptors(i,e){let t=[],o=[];for(let n of i){if(this._vendors.has(n.vendor)){this._logService.error(`The vendor '${n.vendor}' is already registered and cannot be registered twice`);continue}if(uc(n.vendor)){this._logService.error("The vendor field cannot be empty.");continue}if(n.vendor.trim()!==n.vendor){this._logService.error("The vendor field cannot start or end with whitespace.");continue}let r={vendor:n.vendor,displayName:n.displayName,configuration:n.configuration,managementCommand:n.managementCommand,when:n.when,isDefault:n.vendor==="copilot"};this._vendors.set(n.vendor,r),t.push(n.vendor),this._hasStoredModelForVendor(n.vendor)&&this._extensionService.activateByEvent(`onLanguageModelChatProvider:${n.vendor}`)}for(let n of e)this._vendors.delete(n.vendor),this._providers.delete(n.vendor),this._clearModelCache(n.vendor),o.push(n.vendor);for(let[n,r]of this._providers)this._vendors.has(n)||this._providers.delete(n);if((t.length>0||o.length>0)&&(this._onDidChangeLanguageModelVendors.fire([...t,...o]),o.length>0))for(let n of o)this._onLanguageModelChange.fire(n)}async _onDidChangeLanguageModelGroups(i){let e=new Set(i.map(t=>t.vendor));await Promise.all(Array.from(e).map(t=>this._resolveAllLanguageModels(t,!0)))}_readModelPickerPreferences(){return this._storageService.getObject(chi,0,{})}_onDidChangeModelPickerPreferences(){let i=this._readModelPickerPreferences(),e=this._modelPickerUserPreferences,t=new Set,o=!1;for(let n in i)if(e[n]!==i[n]){o=!0;let r=this._modelCache.get(n);r&&t.add(r.vendor)}for(let n in e)if(!i.hasOwnProperty(n)){o=!0;let r=this._modelCache.get(n);r&&t.add(r.vendor)}if(o){this._logService.trace("[LM] Updated model picker preferences from storage"),this._modelPickerUserPreferences=i;for(let n of t)this._onLanguageModelChange.fire(n)}}_hasStoredModelForVendor(i){return Object.keys(this._modelPickerUserPreferences).some(e=>e.startsWith(i))}_saveModelPickerPreferences(){this._storageService.store(chi,this._modelPickerUserPreferences,0,0)}updateModelPickerPreference(i,e){let t=this._modelCache.get(i);if(!t){this._logService.warn(`[LM] Cannot update model picker preference for unknown model ${i}`);return}this._modelPickerUserPreferences[i]=e,e===t.isUserSelectable?(delete this._modelPickerUserPreferences[i],this._saveModelPickerPreferences()):t.isUserSelectable!==e&&this._saveModelPickerPreferences(),this._onLanguageModelChange.fire(t.vendor),this._logService.trace(`[LM] Updated model picker preference for ${i} to ${e}`)}getVendors(){return Array.from(this._vendors.values()).filter(i=>{if(!i.when)return!0;let e=C.deserialize(i.when);return e?this._contextKeyService.contextMatchesRules(e):!1})}getLanguageModelIds(){return Array.from(this._modelCache.keys())}lookupLanguageModel(i){let e=this._modelCache.get(i);return e&&this._modelPickerUserPreferences[i]!==void 0?{...e,isUserSelectable:this._modelPickerUserPreferences[i]}:e}lookupLanguageModelByQualifiedName(i){for(let[e,t]of this._modelCache.entries())if(nD.matchesQualifiedName(i,t))return{metadata:t,identifier:e}}async _resolveAllLanguageModels(i,e){let t=this._vendors.get(i);if(!t)return;await this._extensionService.activateByEvent(`onLanguageModelChatProvider:${i}`);let o=this._providers.get(i);if(!o){this._logService.warn(`[LM] No provider registered for vendor ${i}`);return}return this._resolveLMSequencer.queue(i,async()=>{let n=[],r=[];try{let p=await o.provideLanguageModelChatInfo({silent:e},Se.None);if(p.length){n.push(...p);let h=[];for(let g of p)t.isDefault?g.metadata.isUserSelectable||this._modelPickerUserPreferences[g.identifier]===!0?h.push(g.identifier):this._logService.trace(`[LM] Skipping model ${g.identifier} from model picker as it is not user selectable.`):h.push(g.identifier);r.push({modelIdentifiers:h})}}catch(p){r.push({modelIdentifiers:[],status:{message:Pn(p),severity:bt.Error}})}let s=this._languageModelsConfigurationService.getLanguageModelsProviderGroups(),l=new Map;for(let p of s){if(p.vendor!==i)continue;if(t.isDefault&&!t.configuration){if(p.settings)for(let g of n){let f=p.settings[g.metadata.id];f&&l.set(g.identifier,{...f})}r.push({group:p,modelIdentifiers:[]});continue}let h=await this._resolveConfiguration(p,t.configuration);try{let g=await o.provideLanguageModelChatInfo({group:p.name,silent:e,configuration:h},Se.None);if(g.length&&(n.push(...g),r.push({group:p,modelIdentifiers:g.map(f=>f.identifier)})),p.settings)for(let f of g){let v=p.settings[f.metadata.id];v&&l.set(f.identifier,{...v})}}catch(g){r.push({group:p,modelIdentifiers:[],status:{message:Pn(g),severity:bt.Error}})}}this._modelsGroups.set(i,r);let c=this._clearModelCache(i),u=!1;for(let p of n){if(this._modelCache.has(p.identifier)){this._logService.warn(`[LM] Model ${p.identifier} is already registered. Skipping.`);continue}this._modelCache.set(p.identifier,p.metadata),u=u||!eo(c.get(p.identifier),p.metadata),c.delete(p.identifier)}this._logService.trace(`[LM] Resolved language models for vendor ${i}`,n),u=u||c.size>0,this._clearModelConfigurations(i);for(let[p,h]of l)this._modelCache.has(p)&&this._modelConfigurations.set(p,h);u?this._onLanguageModelChange.fire(i):this._logService.trace(`[LM] No changes in language models for vendor ${i}`)})}getLanguageModelGroups(i){return this._modelsGroups.get(i)??[]}async selectLanguageModels(i){if(i.vendor)await this._resolveAllLanguageModels(i.vendor,!0);else{let t=Array.from(this._vendors.keys());await Promise.all(t.map(o=>this._resolveAllLanguageModels(o,!0)))}let e=[];for(let[t,o]of this._modelCache)(i.vendor===void 0||o.vendor===i.vendor)&&(i.family===void 0||o.family===i.family)&&(i.version===void 0||o.version===i.version)&&(i.id===void 0||o.id===i.id)&&e.push(t);return this._logService.trace("[LM] selected language models",i,e),e}registerLanguageModelProvider(i,e){if(this._logService.trace("[LM] registering language model provider",i,e),!this._vendors.has(i))throw new Error(`Chat model provider uses UNKNOWN vendor ${i}.`);if(this._providers.has(i))throw new Error(`Chat model provider for vendor ${i} is already registered.`);this._providers.set(i,e),this._hasStoredModelForVendor(i)&&this._resolveAllLanguageModels(i,!0);let t=e.onDidChange(()=>{this._resolveAllLanguageModels(i,!0)});return Z(()=>{this._logService.trace("[LM] UNregistered language model provider",i),this._clearModelCache(i),this._providers.delete(i),t.dispose()})}async sendChatRequest(i,e,t,o,n){let r=this._modelCache.get(i),s=this._providers.get(r?.vendor||"");if(!s)throw new Error(`Chat provider for model ${i} is not registered.`);let l=this.getModelConfiguration(i),c=l?{...o,configuration:{...l,...o.configuration}}:o;return s.sendChatRequest(i,t,e,c,n)}_resolveModelConfigurationWithDefaults(i,e){let t=this._modelConfigurations.get(i),o=e?.configurationSchema;if(!o?.properties&&!t)return;let n={};if(o?.properties)for(let[r,s]of Object.entries(o.properties))s.default!==void 0&&(n[r]=s.default);if(!(!t&&Object.keys(n).length===0))return{...n,...t}}computeTokenLength(i,e,t){let o=this._modelCache.get(i);if(!o)throw new Error(`Chat model ${i} could not be found.`);let n=this._providers.get(o.vendor);if(!n)throw new Error(`Chat provider for model ${i} is not registered.`);return n.provideTokenCount(i,e,t)}getModelConfiguration(i){let e=this._modelCache.get(i);return this._resolveModelConfigurationWithDefaults(i,e)}async setModelConfiguration(i,e){let t=this._modelCache.get(i);if(!t)return;let o=this._languageModelsConfigurationService.getLanguageModelsProviderGroups(),n;n=o.find(c=>c.vendor===t.vendor&&c.settings?.[t.id]!==void 0),n||(n=o.find(c=>c.vendor===t.vendor));let s={...this._modelConfigurations.get(i)??{},...e},l=t.configurationSchema;if(l?.properties)for(let[c,u]of Object.entries(s)){let p=l.properties[c];p?.default!==void 0&&p.default===u&&delete s[c]}if(n){let c=n.settings??{},u;Object.keys(s).length===0?(u={...c},delete u[t.id]):u={...c,[t.id]:s};let p={...n,settings:Object.keys(u).length>0?u:void 0};!p.settings&&Object.keys(p).filter(h=>h!=="name"&&h!=="vendor"&&h!=="range"&&h!=="settings").length===0?await this._languageModelsConfigurationService.removeLanguageModelsProviderGroup(n):await this._languageModelsConfigurationService.updateLanguageModelsProviderGroup(n,p)}else if(Object.keys(s).length>0){let c=this.getVendors().find(p=>p.vendor===t.vendor);if(!c)return;let u={name:c.displayName,vendor:t.vendor,settings:{[t.id]:s}};await this._languageModelsConfigurationService.addLanguageModelsProviderGroup(u)}Object.keys(s).length>0?this._modelConfigurations.set(i,s):this._modelConfigurations.delete(i),this._onLanguageModelChange.fire(t.vendor)}getModelConfigurationActions(i){let t=this._modelCache.get(i)?.configurationSchema;if(!t?.properties)return[];let o=[],n=this._modelConfigurations.get(i)??{};for(let[r,s]of Object.entries(t.properties)){if(!s.enum||!Array.isArray(s.enum))continue;let l=n[r]??s.default,c=(typeof s.title=="string"?s.title:void 0)??r.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^./,f=>f.toUpperCase()),u=s.default,p=s.enumItemLabels,h=s.enumDescriptions,g=s.enum.map((f,v)=>{let b=p?.[v]??String(f),S=f===u?d(8220,null,b):b,y=h?.[v]??"";return{id:`configureModel.${r}.${f}`,label:S,class:void 0,enabled:!0,tooltip:y,checked:l===f,run:()=>this.setModelConfiguration(i,{[r]:f})}});o.push(new Fs(`configureModel.${r}`,c,g))}return o}async configureLanguageModelsProviderGroup(i,e){let t=this.getVendors().find(({vendor:l})=>l===i);if(!t)throw new Error(`Vendor ${i} not found.`);if(t.managementCommand){await this._resolveAllLanguageModels(t.vendor,!1);return}let o=this._languageModelsConfigurationService.getLanguageModelsProviderGroups(),n=o.find(l=>l.vendor===i&&l.name===e),r=await this.promptForName(o,t,n);if(!r)return;let s=n?await this._resolveConfiguration(n,t.configuration):void 0;try{let l=t.configuration?await this.promptForConfiguration(r,t.configuration,s):void 0;if(t.configuration&&!l)return;let c=await this._resolveLanguageModelProviderGroup(r,i,l,t.configuration),u=n?await this._languageModelsConfigurationService.updateLanguageModelsProviderGroup(n,c):await this._languageModelsConfigurationService.addLanguageModelsProviderGroup(c);if(t.configuration&&this.requireConfiguring(t.configuration)){let p=this.getSnippetForFirstUnconfiguredProperty(l??{},t.configuration);await this._languageModelsConfigurationService.configureLanguageModels({group:u,snippet:p})}}catch(l){if(ao(l))return;throw l}}async configureModel(i){let e=this._modelCache.get(i);if(!e||!e.configurationSchema)return;let t=this._modelsGroups.get(e.vendor),o;if(t){for(let r of t)if(r.modelIdentifiers.includes(i)&&r.group){o=r.group;break}}if(!o){let r=this.getVendors().find(c=>c.vendor===e.vendor);if(!r)return;let l={name:r.displayName,vendor:e.vendor,settings:{[e.id]:{}}};o=await this._languageModelsConfigurationService.addLanguageModelsProviderGroup(l),await this._resolveAllLanguageModels(e.vendor,!0)}let n=this._getModelConfigurationSnippet(e.id,e.configurationSchema);await this._languageModelsConfigurationService.configureLanguageModels({group:o,snippet:n})}_getModelConfigurationSnippet(i,e){let t=[];if(e.properties)for(let[n,r]of Object.entries(e.properties))if(r.defaultSnippets?.[0]){let s=r.defaultSnippets[0],l=s.bodyText??JSON.stringify(s.body,null,"			");l=l.replace(/"(\^[^"]*)"/g,(c,u)=>u.substring(1)),t.push(`			"${n}": ${l}`)}else r.default!==void 0?t.push(`			"${n}": ${JSON.stringify(r.default)}`):t.push(`			"${n}": \${${n}}`);let o=t.length>0?`{
${t.join(`,
`)}
		}`:`{
			$0
		}`;return`"settings": {
		"${i}": ${o}
	}`}async addLanguageModelsProviderGroup(i,e,t){let o=this.getVendors().find(({vendor:r})=>r===e);if(!o)throw new Error(`Vendor ${e} not found.`);let n=await this._resolveLanguageModelProviderGroup(i,e,t,o.configuration);await this._languageModelsConfigurationService.addLanguageModelsProviderGroup(n)}async removeLanguageModelsProviderGroup(i,e){let t=this.getVendors().find(({vendor:r})=>r===i);if(!t)throw new Error(`Vendor ${i} not found.`);let n=this._languageModelsConfigurationService.getLanguageModelsProviderGroups().find(r=>r.vendor===i&&r.name===e);if(!n)throw new Error(`Language model provider group ${e} for vendor ${i} not found.`);await this._deleteSecretsInConfiguration(n,t.configuration),await this._languageModelsConfigurationService.removeLanguageModelsProviderGroup(n)}requireConfiguring(i){if(i.additionalProperties)return!0;if(!i.properties)return!1;for(let e of Object.keys(i.properties))if(!this.canPromptForProperty(i.properties[e]))return!0;return!1}getSnippetForFirstUnconfiguredProperty(i,e){if(e.properties){for(let t of Object.keys(e.properties))if(i[t]===void 0){let o=e.properties[t];if(o&&typeof o!="boolean"&&o.defaultSnippets?.[0]){let n=o.defaultSnippets[0],r=n.bodyText??JSON.stringify(n.body,null,"	");return r=r.replace(/"(\^[^"]*)"/g,(s,l)=>l.substring(1)),`"${t}": ${r}`}}}}async promptForName(i,e,t){let o=t?.name;if(!o){o=e.displayName;let s=1;for(;i.some(l=>l.vendor===e.vendor&&l.name===o);)s++,o=`${e.displayName} ${s}`}let n,r=new N;try{await new Promise(s=>{let l=r.add(this._quickInputService.createInputBox());l.title=d(8216,null),l.placeholder=d(8219,null),l.value=o,l.ignoreFocusOut=!0,r.add(l.onDidChangeValue(c=>{if(!c){l.validationMessage=d(8217,null),l.severity=bt.Error;return}if(!t&&i.some(u=>u.name===c)){l.validationMessage=d(8221,null),l.severity=bt.Error;return}l.validationMessage=void 0,l.severity=bt.Ignore})),r.add(l.onDidAccept(async()=>{n=l.value,l.hide()})),r.add(l.onDidHide(()=>s())),l.show()})}finally{r.dispose()}return n}async promptForConfiguration(i,e,t){if(!e.properties)return;let o=t?{...t}:{};for(let n of Object.keys(e.properties)){let r=e.properties[n],s=!!e.required?.includes(n),l=await this.promptForValue(i,n,r,s,t);l!==void 0&&(o[n]=l)}return o}async promptForValue(i,e,t,o,n){if(!t||!this.canPromptForProperty(t))return;if(t.type==="array"&&t.items&&!Array.isArray(t.items)&&t.items.enum){let s=await this.promptForArray(i,e,t);return s===void 0?void 0:s}let r=await this.promptForInput(i,e,t,o,n);if(r!==void 0)return r}canPromptForProperty(i){return!i||typeof i=="boolean"?!1:!!(i.type==="array"&&i.items&&!Array.isArray(i.items)&&i.items.enum||i.type==="string"||i.type==="number"||i.type==="integer"||i.type==="boolean")}async promptForArray(i,e,t){if(!t.items||Array.isArray(t.items)||!t.items.enum)return;let o=t.items.enum,n=new N;try{return await new Promise(r=>{let s=n.add(this._quickInputService.createQuickPick());s.title=`${i}: ${t.title??e}`,s.items=o.map(l=>({label:l})),s.placeholder=t.description??d(8223,null,e),s.canSelectMany=!0,s.ignoreFocusOut=!0,n.add(s.onDidAccept(()=>{r(s.selectedItems.map(l=>l.label)),s.hide()})),n.add(s.onDidHide(()=>{r(void 0)})),s.show()})}finally{n.dispose()}}async promptForInput(i,e,t,o,n){let r=new N;try{let s=await new Promise((l,c)=>{let u=r.add(this._quickInputService.createInputBox());u.title=`${i}: ${t.title??e}`,u.placeholder=d(8218,null,e),u.password=!!t.secret,u.ignoreFocusOut=!0,n?.[e]?u.value=String(n?.[e]):t.default&&(u.value=String(t.default)),t.description&&(u.prompt=t.description),r.add(u.onDidChangeValue(p=>{if(!p&&o){u.validationMessage=d(8224,null),u.severity=bt.Error;return}if((t.type==="number"||t.type==="integer")&&isNaN(Number(p))){u.validationMessage=d(8222,null),u.severity=bt.Error;return}if(t.type==="boolean"&&p!=="true"&&p!=="false"){u.validationMessage=d(8215,null),u.severity=bt.Error;return}u.validationMessage=void 0,u.severity=bt.Ignore})),r.add(u.onDidAccept(()=>{if(!u.value&&o){u.validationMessage=d(8224,null),u.severity=bt.Error;return}l(u.value),u.hide()})),r.add(u.onDidHide(p=>{p.reason===2?c(new go):l(void 0)})),u.show()});return s?t.type==="number"||t.type==="integer"?Number(s):t.type==="boolean"?s==="true":s:void 0}finally{r.dispose()}}encodeSecretKey(i){return vd(a4.SECRET_INPUT,i)}decodeSecretKey(i){if(Fe(i))return i.substring(i.indexOf(":")+1,i.length-1)}_clearModelCache(i){let e=new Map;for(let[t,o]of this._modelCache.entries())o.vendor===i&&(e.set(t,o),this._modelCache.delete(t));return e}_clearModelConfigurations(i){for(let[e]of this._modelConfigurations)(this._modelCache.get(e)?.vendor===i||e.startsWith(`${i}/`))&&this._modelConfigurations.delete(e)}async _resolveConfiguration(i,e){if(!e)return{};let t={};for(let o in i){if(o==="vendor"||o==="name"||o==="range"||o==="settings")continue;let n=i[o];if(e.properties?.[o]?.secret){let r=this.decodeSecretKey(n);n=r?await this._secretStorageService.get(r):void 0}t[o]=n}return t}async _resolveLanguageModelProviderGroup(i,e,t,o){if(!o)return{name:i,vendor:e};let n={};for(let r in t){let s=t[r];if(o.properties?.[r]?.secret&&Fe(s)){let l=`${a4.SECRET_KEY_PREFIX}${_r(xt()).toString(16)}`;await this._secretStorageService.set(l,s),s=this.encodeSecretKey(l)}n[r]=s}return{name:i,vendor:e,...n}}async _deleteSecretsInConfiguration(i,e){if(!e)return;let{vendor:t,name:o,range:n,...r}=i;for(let s in r){let l=i[s];if(e.properties?.[s]?.secret){let c=this.decodeSecretKey(l);c&&await this._secretStorageService.delete(c)}}}async migrateLanguageModelsProviderGroup(i){let{vendor:e,name:t,...o}=i;if(!this._vendors.get(e))throw new Error(`Vendor ${e} not found.`);await this._extensionService.activateByEvent(`onLanguageModelChatProvider:${e}`);let n=this._providers.get(e);if(!n)throw new Error(`Chat model provider for vendor ${e} is not registered.`);let r=await n.provideLanguageModelChatInfo({group:t,silent:!1,configuration:o},Se.None);for(let s of r){let l=`${e}/${s.metadata.id}`;this._modelPickerUserPreferences[l]===!0&&(this._modelPickerUserPreferences[s.identifier]=!0),delete this._modelPickerUserPreferences[l]}this._saveModelPickerPreferences(),await this.addLanguageModelsProviderGroup(t,e,o)}_readRecentlyUsedModels(){return this._storageService.getObject(Meo,0,[])}_saveRecentlyUsedModels(){this._storageService.store(Meo,this._recentlyUsedModelIds,0,0)}getRecentlyUsedModelIds(){return this._recentlyUsedModelIds.filter(i=>this._modelCache.has(i)&&i!=="copilot/auto").slice(0,4)}addToRecentlyUsedList(i){if(i==="copilot/auto")return;let e=this._recentlyUsedModelIds.indexOf(i);e!==-1&&this._recentlyUsedModelIds.splice(e,1),this._recentlyUsedModelIds.unshift(i),this._recentlyUsedModelIds.length>20&&(this._recentlyUsedModelIds.length=20),this._saveRecentlyUsedModels()}clearRecentlyUsedList(){this._recentlyUsedModelIds=[],this._saveRecentlyUsedModels()}getModelsControlManifest(){return this._modelsControlManifest}_setModelsControlManifest(i){this._modelsControlRawResponse=i,this._refreshModelsControlManifest()}_refreshModelsControlManifest(){let i=this._modelsControlRawResponse,e={},t={};if(i?.free){let o=Array.isArray(i.free)?i.free:Object.values(i.free);for(let n of o)!n||!xi(n)||(e[n.id]={label:n.label,featured:n.featured,exists:this._modelCache.has(`copilot/${n.id}`)})}if(i?.paid){let o=Array.isArray(i.paid)?i.paid:Object.values(i.paid);for(let n of o)!n||!xi(n)||(t[n.id]={label:n.label,featured:n.featured,minVSCodeVersion:n.minVSCodeVersion,exists:this._modelCache.has(`copilot/${n.id}`)})}this._modelsControlManifest={free:e,paid:t},this._onDidChangeModelsControlManifest.fire(this._modelsControlManifest)}_initChatControlData(){if(this._chatControlUrl=this._productService.chatParticipantRegistry,!this._chatControlUrl)return;let i=this._storageService.get(dhi,-1);try{this._restrictedChatParticipants.set(JSON.parse(i??"{}"),void 0)}catch{this._storageService.remove(dhi,-1)}let e=this._storageService.get(uhi,-1);try{let t=JSON.parse(e??"{}");xi(t)&&this._setModelsControlManifest(t)}catch{this._storageService.remove(uhi,-1)}this._refreshChatControlData()}_refreshChatControlData(){this._chatControlDisposed||this._fetchChatControlData().catch(i=>this._logService.warn("Failed to fetch chat control data",i)).then(()=>Li(300*1e3)).then(()=>this._refreshChatControlData())}async _fetchChatControlData(){this._logService.trace("[LM] Fetching chat control data from",this._chatControlUrl);let i;try{i=await this._requestService.request({type:"GET",url:this._chatControlUrl,callSite:"languageModels.fetchChatControlData"},Se.None)}catch(o){this._logService.warn("[LM] Failed to request chat control data",Pn(o));return}if(i.res.statusCode!==200){this._logService.warn(`[LM] Chat control data request failed with status ${i.res.statusCode}`);return}let e;try{e=await If(i)}catch(o){this._logService.warn("[LM] Failed to parse chat control response",Pn(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 t=e.restrictedChatParticipants;this._restrictedChatParticipants.set(t,void 0),this._storageService.store(dhi,JSON.stringify(t),-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(uhi,JSON.stringify(e.models),-1,1))}dispose(){this._chatControlDisposed=!0,this._store.dispose(),this._providers.clear()}};a4=I([m(0,lt),m(1,se),m(2,ce),m(3,X),m(4,s4),m(5,Ue),m(6,Dw),m(7,tt),m(8,Ea)],a4);var vk=le("IAuthenticationAccessService"),N6e=class extends x{constructor(e,t){super();this._storageService=e;this._productService=t;this._onDidChangeExtensionSessionAccess=this._register(new E);this.onDidChangeExtensionSessionAccess=this._onDidChangeExtensionSessionAccess.event}isAccessAllowed(e,t,o){let n=this._productService.trustedExtensionAuthAccess,r=Ii.toKey(o);if(Array.isArray(n)){if(n.includes(r))return!0}else if(n?.[e]?.includes(r))return!0;let l=this.readAllowedExtensions(e,t).find(c=>c.id===r);if(l)return l.allowed!==void 0?l.allowed:!0}readAllowedExtensions(e,t){let o=[];try{let s=this._storageService.get(`${e}-${t}`,-1);s&&(o=JSON.parse(s))}catch{}let n=this._productService.trustedExtensionAuthAccess,r=Array.isArray(n)?n:typeof n=="object"?n[e]??[]:[];for(let s of r){let l=Ii.toKey(s),c=o.find(u=>u.id===l);c?(c.allowed=!0,c.trusted=!0):o.push({id:l,name:s,allowed:!0,trusted:!0})}return o}updateAllowedExtensions(e,t,o){let n=this.readAllowedExtensions(e,t);for(let s of o){let l=Ii.toKey(s.id),c=n.findIndex(u=>u.id===l);c===-1?n.push({...s,id:l}):(n[c].allowed=s.allowed,s.name&&s.name!==l&&n[c].name!==s.name&&(n[c].name=s.name))}let r=n.filter(s=>!s.trusted);this._storageService.store(`${e}-${t}`,JSON.stringify(r),-1,0),this._onDidChangeExtensionSessionAccess.fire({providerId:e,accountName:t})}removeAllowedExtensions(e,t){this._storageService.remove(`${e}-${t}`,-1),this._onDidChangeExtensionSessionAccess.fire({providerId:e,accountName:t})}};N6e=I([m(0,ce),m(1,tt)],N6e);Ee(vk,N6e,1);var ZDt=class{constructor(i,e,t,o,n,r,s){this._chatProviderService=e;this._logService=t;this._authenticationService=o;this._authenticationAccessService=n;this._extensionService=r;this._ignoredFilesService=s;this._store=new N;this._providerRegistrations=new Vt;this._lmProviderChange=new E;this._pendingProgress=new Map;this._ignoredFileProviderRegistrations=new Vt;this._proxy=i.getProxy(to.ExtHostChatProvider)}dispose(){this._lmProviderChange.dispose(),this._providerRegistrations.dispose(),this._ignoredFileProviderRegistrations.dispose(),this._store.dispose()}$registerLanguageModelProvider(i){let e=new N;try{e.add(this._chatProviderService.registerLanguageModelProvider(i,{onDidChange:U.filter(this._lmProviderChange.event,t=>t.vendor===i,e),provideLanguageModelChatInfo:async(t,o)=>{let n=await this._proxy.$provideLanguageModelChatInfo(i,t,o);return n.forEach(r=>{r.metadata.auth&&e.add(this._registerAuthenticationProvider(r.metadata.extension,r.metadata.auth))}),n},sendChatRequest:async(t,o,n,r,s)=>{let l=Math.random()*1e6|0,c=new Ko,u=new Xht;try{this._pendingProgress.set(l,{defer:c,stream:u}),await Promise.all(o.flatMap(p=>p.content).filter(p=>p.type==="image_url").map(async p=>{p.value.data=qe.wrap(await JP(p.value.data.buffer))})),await this._proxy.$startChatRequest(t,l,n,new ag(o),r,s)}catch(p){throw this._pendingProgress.delete(l),p}return{result:c.p,stream:u.asyncIterable}},provideTokenCount:(t,o,n)=>this._proxy.$provideTokenLength(t,o,n)})),this._providerRegistrations.set(i,e)}catch(t){throw e.dispose(),t}}$onLMProviderChange(i){this._lmProviderChange.fire({vendor:i})}async $reportResponsePart(i,e){let t=this._pendingProgress.get(i);this._logService.trace("[LM] report response PART",!!t,i,e),t&&t.stream.emitOne(e.value)}async $reportResponseDone(i,e){let t=this._pendingProgress.get(i);if(this._logService.trace("[LM] report response DONE",!!t,i,e),t)if(this._pendingProgress.delete(i),e){let o=H_t.tryDeserialize(e)??T9(e);t.stream.reject(o),t.defer.error(o)}else t.stream.resolve(),t.defer.complete(void 0)}$unregisterProvider(i){this._providerRegistrations.deleteAndDispose(i)}$selectChatModels(i){return this._chatProviderService.selectLanguageModels(i)}async $tryStartChatRequest(i,e,t,o,n,r){this._logService.trace("[CHAT] request STARTED",i.value,t);let s;try{s=await this._chatProviderService.sendChatRequest(e,i,o.value,n,r)}catch(c){throw this._logService.error("[CHAT] request FAILED",i.value,t,c),c}let l=(async()=>{try{for await(let c of s.stream)this._logService.trace("[CHAT] request PART",i.value,t,c),await this._proxy.$acceptResponsePart(t,new ag(c));this._logService.trace("[CHAT] request DONE",i.value,t)}catch(c){this._logService.error("[CHAT] extension request ERRORED in STREAM",xn(c,!0),i.value,t),this._proxy.$acceptResponseDone(t,S$(c))}})();Promise.allSettled([s.result,l]).then(()=>{this._logService.debug("[CHAT] extension request DONE",i.value,t),this._proxy.$acceptResponseDone(t,void 0)},c=>{this._logService.error("[CHAT] extension request ERRORED",xn(c,!0),i.value,t),this._proxy.$acceptResponseDone(t,S$(c))})}$countTokens(i,e,t){return this._chatProviderService.computeTokenLength(i,e,t)}_registerAuthenticationProvider(i,e){let t=oA+i.value;if(this._authenticationService.getProviderIds().includes(t))return x.None;let o=e.accountLabel??d(3331,null),n=new N,r=new phi(t,e.providerLabel,o);return this._authenticationService.registerAuthenticationProvider(t,r),n.add(Z(()=>{this._authenticationService.unregisterAuthenticationProvider(t),r.dispose()})),n.add(this._authenticationAccessService.onDidChangeExtensionSessionAccess(async s=>{let l=this._authenticationAccessService.readAllowedExtensions(t,o),c=[];for(let u of l){let p=await this._extensionService.getExtension(u.id);p&&c.push({from:p.identifier,to:i,enabled:u.allowed??!0})}this._proxy.$updateModelAccesslist(c)})),n}$fileIsIgnored(i,e){return this._ignoredFilesService.fileIsIgnored(A.revive(i),e)}$registerFileIgnoreProvider(i){this._ignoredFileProviderRegistrations.set(i,this._ignoredFilesService.registerIgnoredFileProvider({isFileIgnored:async(e,t)=>this._proxy.$isFileIgnored(i,e,t)}))}$unregisterFileIgnoreProvider(i){this._ignoredFileProviderRegistrations.deleteAndDispose(i)}};ZDt=I([fo(qi.MainThreadLanguageModels),m(1,ds),m(2,se),m(3,xs),m(4,vk),m(5,lt),m(6,FEe)],ZDt);var phi=class{constructor(i,e,t){this.id=i;this.label=e;this._accountLabel=t;this.supportsMultipleAccounts=!1;this._onDidChangeSessions=new E;this.onDidChangeSessions=this._onDidChangeSessions.event}async getSessions(i){return i===void 0&&!this._session?[]:this._session?[this._session]:[await this.createSession(i||[])]}async createSession(i){return this._session=this._createFakeSession(i),this._onDidChangeSessions.fire({added:[this._session],changed:[],removed:[]}),this._session}removeSession(i){return this._session&&(this._onDidChangeSessions.fire({added:[],changed:[],removed:[this._session]}),this._session=void 0),Promise.resolve()}confirmation(i,e){return d(3330,null,i,this.label)}_createFakeSession(i){return{id:"fake-session",account:{id:this.id,label:this._accountLabel},accessToken:"fake-access-token",scopes:i}}dispose(){this._onDidChangeSessions.dispose()}};var jEe="copilot";var Pt=le("chatWidgetService"),rD=Symbol("ChatViewPaneTarget"),sD=le("quickChatService"),NF=le("chatAccessibilityService");function py(a){return typeof a.viewId=="string"}function Zde(a){return!py(a)}var XX=le("chatCodeBlockContextProviderService"),Dr=`workbench.panel.chat.view.${jEe}`,l4="workbench.panel.chat";var Jr;(r=>{r.scheme=Q.vscodeLocalChatSession;function i(s){let l=Yd(qe.wrap(new TextEncoder().encode(s)),!1,!0);return A.from({scheme:r.scheme,authority:sc,path:"/"+l})}r.forSession=i;function e(){let s=Math.floor(Math.random()*1e9);return i(`chat-${s}`)}r.getNewSessionUri=e;function t(s){let l=n(s);return l?.chatSessionType===sc?l.sessionId:void 0}r.parseLocalSessionId=t;function o(s){return!!t(s)}r.isLocalSession=o;function n(s){if(s.scheme!==r.scheme||!s.authority)return;let l=s.path.split("/");if(l.length!==2)return;let c=s.authority,u=qa(l[1]);return{chatSessionType:c,sessionId:new TextDecoder().decode(u.buffer)}}})(Jr||={});function ap(a){let i=Jr.parseLocalSessionId(a);return i||a.toString()}function gl(a){return a.scheme===Q.vscodeChatEditor?sc:a.scheme===Jr.scheme?a.authority||sc:a.scheme}function TK(a){return a.path.startsWith("/untitled-")}var yf=(s=>(s.Local="local",s.Background="copilotcli",s.Cloud="copilot-cloud-agent",s.Claude="claude-code",s.Codex="openai-codex",s.Growth="copilot-growth",s.AgentHostCopilot="agent-host-copilot",s))(yf||{});function Aeo(a){return a==="local"||a==="copilotcli"||a==="copilot-cloud-agent"||a==="claude-code"}function lg(a){let i=A.isUri(a)?gl(a):a;switch(i){case"local":case"copilotcli":case"copilot-cloud-agent":case"claude-code":case"openai-codex":case"agent-host-copilot":return i;default:return}}function IS(a){switch(a){case"local":return d(6041,null);case"copilotcli":return d(6039,null);case"copilot-cloud-agent":return d(6040,null);case"claude-code":return"Claude";case"openai-codex":return"Codex";case"copilot-growth":return"Growth";case"agent-host-copilot":return"Agent Host - Copilot";default:return a}}function lT(a){switch(a){case"local":return R.vm;case"copilotcli":return R.worktree;case"copilot-cloud-agent":return R.cloud;case"openai-codex":return R.openai;case"claude-code":return R.claude;case"copilot-growth":return R.lightbulb;case"agent-host-copilot":return R.vscodeInsiders;default:return R.extensions}}function O6e(a){return a.quality==="stable"?R.vscode:R.vscodeInsiders}function eLt(a){switch(a){case"local":case"copilotcli":case"copilot-cloud-agent":case"agent-host-copilot":return!0;case"claude-code":case"openai-codex":case"copilot-growth":return!1;default:return!1}}function Neo(a){return a==="agent-host-copilot"||a.startsWith("agent-host-")||a.startsWith("remote-")}function tLt(a){switch(a){case"local":case"copilotcli":case"copilot-cloud-agent":return!0;case"claude-code":case"openai-codex":case"copilot-growth":case"agent-host-copilot":return!1;default:return!1}}function mhi(a){switch(a){case"local":return d(6038,null);case"copilotcli":return d(6033,null);case"copilot-cloud-agent":return d(6035,null);case"claude-code":return d(6034,null);case"openai-codex":return d(6036,null);case"copilot-growth":return d(6037,null);case"agent-host-copilot":return"Run a Copilot SDK agent in a dedicated process.";default:return""}}var qha=te("agentSessionReadIndicator.foreground",{dark:ai(To,.2),light:ai(To,.2),hcDark:null,hcLight:null},d(6030,null)),$ha=te("agentSessionSelectedBadge.border",{dark:ai(T_,.3),light:ai(T_,.3),hcDark:To,hcLight:To},d(6031,null)),jha=te("agentSessionSelectedUnfocusedBadge.border",{dark:ai(To,.3),light:ai(To,.3),hcDark:To,hcLight:To},d(6032,null)),QEe="agentSession.rename",YEe="agentSession.delete";var ghi="chat-dynamic-variable",yS=class extends x{constructor(e,t){super();this.widget=e;this.labelService=t;this._variables=[];this.decorationData=[];this._editorListener=this._register(new me);this._subscribeToEditor(),this._register(e.onDidChangeActiveInputEditor(()=>{this._subscribeToEditor(),this.updateDecorations()}))}static{this.ID="chatDynamicVariableModel"}get variables(){return[...this._variables]}get id(){return yS.ID}_subscribeToEditor(){this._editorListener.value=this.widget.inputEditor.onDidChangeModelContent(e=>{let t=[],o=!1;this._variables=di(this._variables.map((n,r)=>{let s=this.widget.inputEditor.getModel();if(!s)return t.push(n),null;let l=this.decorationData[r];if(!l)return t.push(n),null;let c=s.getDecorationRange(l.id);return c?s.getValueInRange(c)!==l.text?(this.widget.inputEditor.executeEdits(this.id,[{range:c,text:""}]),this.widget.refreshParsedInput(),t.push(n),null):c.equalsRange(n.range)?n:(o=!0,{...n,range:c}):(t.push(n),null)})),Be(t.filter(jc)),(o||t.length>0)&&this.widget.refreshParsedInput(),this.updateDecorations()})}getInputState(e){e[yS.ID]=this.variables}setInputState(e){let t=e[yS.ID];Array.isArray(t)||(t=[]),this.disposeVariables(),this._variables=[];for(let o of t)I$o(o)&&this.addReference(o)}addReference(e){hhi(e.range)&&(this._variables.push(e),this.updateDecorations(),this.widget.refreshParsedInput())}updateDecorations(){let e=this.widget.inputEditor.getModel();if(!e){this.decorationData=[];return}let t=this._variables.filter(n=>hhi(n.range)),o=this.widget.inputEditor.setDecorationsByType("chat",ghi,t.map(n=>({range:n.range,hoverMessage:this.getHoverForReference(n)})));this._variables=t.slice(0,o.length),this.decorationData=[];for(let n=0;n<o.length;n++)this.decorationData.push({id:o[n],text:e.getValueInRange(this._variables[n].range)})}getHoverForReference(e){let t=e.data;if(A.isUri(t))return new Ie(this.labelService.getUriLabel(t,{relative:!0}));if(lf(t)){let o=e.fullName?` ${e.fullName}`:"",n=`#${t.range.startLineNumber}-${t.range.endLineNumber}`;return new Ie(o+this.labelService.getUriLabel(t.uri,{relative:!0})+n)}else return}disposeVariables(){for(let e of this._variables)jc(e)&&e.dispose()}dispose(){this.disposeVariables(),super.dispose()}};yS=I([m(1,rt)],yS);function I$o(a){return a&&typeof a.id=="string"&&z.isIRange(a.range)&&hhi(a.range)&&"data"in a}function hhi(a){return!(a.startLineNumber<1||a.endLineNumber<1||a.startColumn<1||a.endColumn<1||a.startLineNumber>a.endLineNumber||a.startLineNumber===a.endLineNumber&&a.startColumn>=a.endColumn)}function y$o(a){return"widget"in a&&"range"in a&&"variableData"in a}var F6e=class a extends K{static{this.ID="workbench.action.chat.addDynamicVariable"}constructor(){super({id:a.ID,title:""})}async run(i,...e){let t=e[0];if(!y$o(t))return;let o=t.range,n=t.variableData,r=()=>{t.widget.inputEditor.executeEdits("chatInsertDynamicVariableWithArguments",[{range:t.range,text:""}])};if(t.command){let l=await i.get(ge).executeCommand(t.command.id,...t.command.arguments??[]);if(!l){r();return}let c=":"+l,u=new z(o.startLineNumber,o.endColumn,o.endLineNumber,o.endColumn+c.length);if(o=new z(o.startLineNumber,o.startColumn,o.endLineNumber,o.endColumn+c.length),!t.widget.inputEditor.executeEdits("chatInsertDynamicVariableWithArguments",[{range:u,text:c+" "}])){r();return}}t.widget.getContrib(yS.ID)?.addReference({id:t.id,range:o,isFile:!0,data:n})}};W(F6e);var fhi="code/chat/",OF={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 FF(a,i){Mo(`${fhi}${ap(a)}/${i}`)}function vhi(a){O6i(`${fhi}${ap(a)}/`)}var bhi={WillWaitForActivation:"willWaitForActivation",DidWaitForActivation:"didWaitForActivation"};function Shi(a){Mo(`${fhi}${a}`)}var cr=le("chatAgentService"),XEe=class extends x{constructor(e,t){super();this.contextKeyService=e;this.configurationService=t;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=ie.enabled.bindTo(this.contextKeyService),this._extensionAgentRegistered=ie.extensionParticipantRegistered.bindTo(this.contextKeyService),this._defaultAgentRegistered=ie.panelParticipantRegistered.bindTo(this.contextKeyService),this._register(e.onDidChangeContext(o=>{o.affectsSome(this._agentsContextKeys)&&this._updateContextKeys()}))}static{this.AGENT_LEADER="@"}registerAgent(e,t){if(this.getAgent(e))throw new Error(`Agent already registered: ${JSON.stringify(e)}`);let n=this,r=t.slashCommands;t={...t,get slashCommands(){return r.filter(l=>!l.when||n.contextKeyService.contextMatchesRules(C.deserialize(l.when)))}};let s={data:t};return this._agents.set(e,s),this._updateAgentsContextKeys(),this._updateContextKeys(),this._onDidChangeAgents.fire(void 0),Z(()=>{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 t=C.deserialize(e.data.when);for(let o of t?.keys()||[])this._agentsContextKeys.add(o)}}_updateContextKeys(){let e=!1,t=!1,o=!1;for(let n of this.getAgents())n.isDefault&&(n.isCore||(e=!0),n.id==="chat.setup"||n.id==="github.copilot.editsAgent"?o=!0:t=!0);this._defaultAgentRegistered.set(t),this._extensionAgentRegistered.set(e),o!==this._hasToolsAgent&&(this._hasToolsAgent=o,this._onDidChangeAgents.fire(this.getDefaultAgent("panel","agent")))}registerAgentImplementation(e,t){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=t,this._onDidChangeAgents.fire(new JEe(o.data,t)),Z(()=>{o.impl=void 0,this._onDidChangeAgents.fire(void 0),o.data.isDefault&&this._hasDefaultAgent.set(vt.some(this._agents.values(),n=>n.data.isDefault&&!!n.impl))})}registerDynamicAgent(e,t){e.isDynamic=!0;let o={data:e,impl:t};return this._agents.set(e.id,o),this._onDidChangeAgents.fire(new JEe(e,t)),Z(()=>{this._agents.delete(e.id),this._onDidChangeAgents.fire(void 0)})}registerAgentCompletionProvider(e,t){return this._agentCompletionProviders.set(e,t),{dispose:()=>{this._agentCompletionProviders.delete(e)}}}async getAgentCompletionItems(e,t,o){return await this._agentCompletionProviders.get(e)?.(t,o)??[]}updateAgent(e,t){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,...t},this._onDidChangeAgents.fire(new JEe(o.data,o.impl))}getDefaultAgent(e,t="ask"){return this._preferExtensionAgent(this.getActivatedAgents().filter(o=>t&&!o.modes.includes(t)?!1:!!o.isDefault&&o.locations.includes(e)))}get hasToolsAgent(){return!!this.configurationService.getValue("chat.agent.enabled")}getContributedDefaultAgent(e){return this._preferExtensionAgent(this.getAgents().filter(t=>!!t.isDefault&&t.locations.includes(e)))}_preferExtensionAgent(e){return fd(e,t=>!t.isCore)??e.at(-1)}getAgent(e,t=!1){if(!(!this._agentIsEnabled(e)&&!t))return this._agents.get(e)?.data}_agentIsEnabled(e){let t=typeof e=="string"?this._agents.get(e):e;return!t?.data.when||this.contextKeyService.contextMatchesRules(C.deserialize(t.data.when))}getAgentByFullyQualifiedId(e){let t=vt.find(this._agents.values(),o=>c4(o.data)===e)?.data;if(!(t&&!this._agentIsEnabled(t.id)))return t}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 JEe(e.data,e.impl))}getAgentsByName(e){return this._preferExtensionAgents(this.getAgents().filter(t=>t.name===e))}_preferExtensionAgents(e){let t=e.filter(o=>!o.isCore);return t.length>0?t:e}agentHasDupeName(e){let t=this.getAgent(e);return t?this.getAgentsByName(t.name).filter(o=>o.extensionId.value!==t.extensionId.value).length>0:!1}async invokeAgent(e,t,o,n,r){FF(t.sessionResource,OF.AgentWillInvoke);let s=this._agents.get(e);if(!s?.impl)throw new Error(`No activated agent with id "${e}"`);let l=await s.impl.invoke(t,o,n,r);return FF(t.sessionResource,OF.AgentDidInvoke),l}setRequestTools(e,t,o){let n=this._agents.get(e);if(!n?.impl)throw new Error(`No activated agent with id "${e}"`);n.impl.setRequestTools?.(t,o)}setYieldRequested(e,t,o){let n=this._agents.get(e);n?.impl&&n.impl.setYieldRequested?.(t,o)}async getFollowups(e,t,o,n,r){let s=this._agents.get(e);return s?.impl?.provideFollowups?s.impl.provideFollowups(t,o,n,r):[]}async getChatTitle(e,t,o){let n=this._agents.get(e);if(n?.impl?.provideChatTitle)return n.impl.provideChatTitle(t,o)}async getChatSummary(e,t,o){let n=this._agents.get(e);if(n?.impl?.provideChatSummary)return n.impl.provideChatSummary(t,o)}registerChatParticipantDetectionProvider(e,t){return this._chatParticipantDetectionProviders.set(e,t),Z(()=>{this._chatParticipantDetectionProviders.delete(e)})}hasChatParticipantDetectionProviders(){return this._chatParticipantDetectionProviders.size>0}async detectAgentOrCommand(e,t,o,n){let r=vt.first(this._chatParticipantDetectionProviders.values());if(!r)return;let s=this.getAgents().reduce((p,h)=>{if(h.locations.includes(o.location)){p.push({participant:h.id,disambiguation:h.disambiguation??[]});for(let g of h.slashCommands)p.push({participant:h.id,command:g.name,disambiguation:g.disambiguation??[]})}return p},[]),l=await r.provideParticipantDetection(e,t,{...o,participants:s},n);if(!l)return;let c=this.getAgent(l.participant);if(!c)return;if(!l.command)return{agent:c};let u=c?.slashCommands.find(p=>p.name===l.command);if(u)return{agent:c,command:u}}};XEe=I([m(0,X),m(1,B)],XEe);var JEe=class{constructor(i,e){this.data=i;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(i,e,t,o){return this.impl.invoke(i,e,t,o)}setRequestTools(i,e){this.impl.setRequestTools?.(i,e)}setYieldRequested(i,e){this.impl.setYieldRequested?.(i,e)}async provideFollowups(i,e,t,o){return this.impl.provideFollowups?this.impl.provideFollowups(i,e,t,o):[]}toJSON(){return this.data}},_K=le("chatAgentNameService"),ZEe=class{constructor(i){this.languageModelsService=i}getAgentNameRestriction(i){if(i.isCore)return!0;let e=this.checkAgentNameRestriction(i.name,i).get(),t=!i.fullName||this.checkAgentNameRestriction(i.fullName.replace(/\s/g,""),i).get();return e&&t}checkAgentNameRestriction(i,e){return this.languageModelsService.restrictedChatParticipants.map(o=>o[i.toLowerCase()]).map(o=>o?o.some(n=>vr(n,n.includes(".")?e.extensionId.value:e.extensionPublisherId)):!0)}};ZEe=I([m(0,ds)],ZEe);function c4(a){return`${a.extensionId.value}.${a.id}`}function w$o(a){return a.name!==void 0}function iLt(a){let i=w$o(a)?a:{...a,name:a.id};return i.extensionPublisherId||(i.extensionPublisherId=a.extensionPublisher??""),i.extensionDisplayName||(i.extensionDisplayName=""),i.extensionId||(i.extensionId=new Ii("")),$n(i)}var Oeo="onCustomAgentProvider",Feo="onInstructionsProvider",Weo="onPromptFileProvider",Veo="onSkillProvider",Or=le("IPromptsService");function Beo(a){if(typeof a!="object"||a===null)return!1;let i=a;return typeof i.userInvocable=="boolean"&&typeof i.agentInvocable=="boolean"}var JX="https://aka.ms/vscode-ghcp-prompt-snippets",oLt="https://aka.ms/vscode-ghcp-custom-instructions",W6e="https://aka.ms/vscode-ghcp-custom-chat-modes",nLt="https://aka.ms/vscode-agent-skills",rLt="https://aka.ms/vscode-chat-hooks",cT="prompt",V6e="instructions",B6e="chatagent",Ihi="skill",DK=[cT,V6e,B6e,Ihi],BR="github.copilot.chat.agentDebugLog.enabled",eTe="github.copilot.chat.agentDebugLog.fileLogging.enabled",yhi="troubleshoot",Heo="copilot-skill",sLt="troubleshoot/SKILL.md";function Ueo(a){switch(a){case"prompt":return cT;case"instructions":return V6e;case"agent":return B6e;case"skill":return Ihi;case"hook":return"jsonc";default:throw new Error(`Unknown prompt type: ${a}`)}}function Mw(a){switch(a){case cT:return"prompt";case V6e:return"instructions";case B6e:return"agent";case Ihi:return"skill";default:return}}var nu=(n=>(n.instructions="instructions",n.prompt="prompt",n.agent="agent",n.skill="skill",n.hook="hook",n))(nu||{});function zeo(a){return Object.values(nu).includes(a)}var ZX=20,nA;(n=>{n.icon=R.error;function i(r){return{filterUri:r.resource,owner:r.owner,problemMessage:r.message,filterRange:{startLineNumber:r.startLineNumber,endLineNumber:r.endLineNumber,startColumn:r.startColumn,endColumn:r.endColumn}}}n.fromMarker=i;function e(r){return{id:t(r),name:o(r),icon:n.icon,value:r,kind:"diagnostic",...r}}n.toEntry=e;function t(r){return[r.filterUri,r.owner,r.filterSeverity,r.filterRange?.startLineNumber,r.filterRange?.startColumn].join(":")}n.id=t;function o(r){let s;if((p=>(p[p.MaxChars=30]="MaxChars",p[p.MaxSpaceLookback=10]="MaxSpaceLookback"))(s||={}),r.problemMessage){if(r.problemMessage.length<30)return r.problemMessage;let c=r.problemMessage.lastIndexOf(" ",30);return c===-1||c+10<30?r.problemMessage.substring(0,30)+"\u2026":r.problemMessage.substring(0,c)+"\u2026"}let l=d(8193,null);return r.filterUri&&(l=d(8194,null,He(r.filterUri))),l}n.label=o})(nA||={});var aD;(t=>{function a(o){return A.isUri(o.value)?o.value:lf(o.value)?o.value.uri:void 0}t.toUri=a;function i(o){if(o.value instanceof Uint8Array){let n={...o};return n.value={$base64:Yd(qe.wrap(o.value))},n}return o}t.toExport=i;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 n={...o};return n.value=qa(o.value.$base64).buffer,n}return o}t.fromExport=e})(aD||={});function aLt(a){return a.kind==="implicit"}function LK(a){return a.kind==="string"}function Keo(a){return a.kind==="terminalCommand"}function lLt(a){return a.kind==="paste"}function tTe(a){return a.kind==="workspace"}function bk(a){return a.kind==="image"}function cLt(a){return a.kind==="notebookOutput"}function dLt(a){return a.kind==="element"}function lD(a){return a.kind==="promptFile"}function RK(a){return a.kind==="promptText"}function uLt(a){return a.kind==="scmHistoryItem"}function pLt(a){return a.kind==="scmHistoryItemChange"}function mLt(a){return a.kind==="scmHistoryItemChangeRange"}function Sk(a){let i=a;return typeof i=="object"&&i!==null&&(typeof i.value=="string"||typeof i.value>"u")&&(typeof i.name=="string"||typeof i.name>"u")&&(i.resourceUri===void 0||A.isUri(i.resourceUri))&&(typeof i.name=="string"||A.isUri(i.resourceUri))&&(i.icon===void 0||q.isThemeIcon(i.icon))&&A.isUri(i.uri)&&typeof i.handle=="number"}function WF(a,i,e,t=!1,o){return{id:`${i}__${a.toString()}`,name:`prompt:${He(a)}`,value:a,kind:"promptFile",modelDescription:"Prompt instructions file",isRoot:i!=="vscode.instructions.file.reference",originLabel:e,toolReferences:o,automaticallyAdded:t}}function Geo(a,i=!1,e){return{id:"vscode.customizations.index",name:"prompt:customizationsIndex",value:a,kind:"promptText",modelDescription:"Chat customizations index",automaticallyAdded:i,toolReferences:e}}function eue(a,i){return{kind:"tool",id:a.id,icon:q.isThemeIcon(a.icon)?a.icon:void 0,name:a.displayName,value:void 0,range:i}}function hLt(a,i){return{kind:"toolset",id:a.id,icon:a.icon,name:a.referenceName,value:Array.from(a.getTools()).map(e=>eue(e)),range:i}}var d4=class{constructor(i){this._ids=new Set;this._entries=[];i&&this.add(...i)}add(...i){for(let e of i)this._ids.has(e.id)||(this._ids.add(e.id),this._entries.push(e))}insertFirst(i){this._ids.has(i.id)||(this._ids.add(i.id),this._entries.unshift(i))}remove(i){this._ids.delete(i.id),this._entries=this._entries.filter(e=>e.id!==i.id)}has(i){return this._ids.has(i.id)}asArray(){return this._entries.slice(0)}get length(){return this._entries.length}};var whi;(i=>{function a(e,t){return e.text===t.text&&hJt(e.parts,t.parts,(o,n)=>o.kind===n.kind&&pi.equals(o.range,n.range)&&z.equalsRange(o.editorRange,n.editorRange)&&o.text===n.text)}i.equals=a})(whi||={});function H6e(a){let i=a.parts.map(t=>t.promptText).join("").trimStart(),e=a.text.length-i.length;return{message:i,diff:e}}var Pv=class a{constructor(i,e,t){this.range=i;this.editorRange=e;this.text=t;this.kind=a.Kind}static{this.Kind="text"}get promptText(){return this.text}},Tu="#",zc="@",Bu="/",gLt=class a{constructor(i,e,t,o,n){this.range=i;this.editorRange=e;this.variableName=t;this.variableArg=o;this.variableId=n;this.kind=a.Kind}static{this.Kind="var"}get text(){let i=this.variableArg?`:${this.variableArg}`:"";return`${Tu}${this.variableName}${i}`}get promptText(){return this.text}},dI=class a{constructor(i,e,t,o,n,r){this.range=i;this.editorRange=e;this.toolName=t;this.toolId=o;this.displayName=n;this.icon=r;this.kind=a.Kind}static{this.Kind="tool"}get text(){return`${Tu}${this.toolName}`}get promptText(){return this.text}toVariableEntry(){return{kind:"tool",id:this.toolId,name:this.toolName,range:this.range,value:void 0,icon:q.isThemeIcon(this.icon)?this.icon:void 0,fullName:this.displayName}}},VF=class a{constructor(i,e,t,o,n,r){this.range=i;this.editorRange=e;this.id=t;this.name=o;this.icon=n;this.tools=r;this.kind=a.Kind}static{this.Kind="toolset"}get text(){return`${Tu}${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}}},lp=class a{constructor(i,e,t){this.range=i;this.editorRange=e;this.agent=t;this.kind=a.Kind}static{this.Kind="agent"}get text(){return`${zc}${this.agent.name}`}get promptText(){return""}},Xf=class a{constructor(i,e,t){this.range=i;this.editorRange=e;this.command=t;this.kind=a.Kind}static{this.Kind="subcommand"}get text(){return`${Bu}${this.command.name}`}get promptText(){return""}},UC=class a{constructor(i,e,t){this.range=i;this.editorRange=e;this.slashCommand=t;this.kind=a.Kind}static{this.Kind="slash"}get text(){return`${Bu}${this.slashCommand.command}`}get promptText(){return`${Bu}${this.slashCommand.command}`}},dT=class a{constructor(i,e,t){this.range=i;this.editorRange=e;this.name=t;this.kind=a.Kind}static{this.Kind="prompt"}get text(){return`${Bu}${this.name}`}get promptText(){return`${Bu}${this.name}`}},HR=class a{constructor(i,e,t,o,n,r,s,l,c,u){this.range=i;this.editorRange=e;this.text=t;this.id=o;this.modelDescription=n;this.data=r;this.fullName=s;this.icon=l;this.isFile=c;this.isDirectory=u;this.kind=a.Kind}static{this.Kind="dynamic"}get referenceText(){return this.text.replace(Tu,"")}get promptText(){return this.text}toVariableEntry(){return this.id==="vscode.problems"?nA.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 qeo(a){return{text:a.text,parts:a.parts.map(i=>{if(i.kind===Pv.Kind)return new Pv(new pi(i.range.start,i.range.endExclusive),i.editorRange,i.text);if(i.kind===gLt.Kind)return new gLt(new pi(i.range.start,i.range.endExclusive),i.editorRange,i.variableName,i.variableArg,i.variableId||"");if(i.kind===dI.Kind)return new dI(new pi(i.range.start,i.range.endExclusive),i.editorRange,i.toolName,i.toolId,i.displayName,i.icon);if(i.kind===VF.Kind)return new VF(new pi(i.range.start,i.range.endExclusive),i.editorRange,i.id,i.name,i.icon,i.tools??[]);if(i.kind===lp.Kind){let e=i.agent;return e=iLt(e),new lp(new pi(i.range.start,i.range.endExclusive),i.editorRange,e)}else{if(i.kind===Xf.Kind)return new Xf(new pi(i.range.start,i.range.endExclusive),i.editorRange,i.command);if(i.kind===UC.Kind)return new UC(new pi(i.range.start,i.range.endExclusive),i.editorRange,i.slashCommand);if(i.kind===dT.Kind)return new dT(new pi(i.range.start,i.range.endExclusive),i.editorRange,i.name);if(i.kind===HR.Kind)return new HR(new pi(i.range.start,i.range.endExclusive),i.editorRange,i.text,i.id,i.modelDescription,$n(i.data),i.fullName,i.icon,i.isFile,i.isDirectory);throw new Error(`Unknown chat request part: ${i.kind}`)}})}}function $eo(a){let i=a.parts.find(t=>t instanceof lp),e=a.parts.find(t=>t instanceof Xf);return{agentPart:i,commandPart:e}}function fLt(a,i,e,t=null,o=null){let n="";if(t&&t!==a.getDefaultAgent(i)?.id){let r=a.getAgent(t);if(!r)return;n+=`${zc}${r.name} `,o&&(n+=`${Bu}${o} `)}return n+e}var vLt=le("IChatVariablesService");var BF=le("chatSlashCommandService"),iTe=class extends x{constructor(e){super();this._extensionService=e;this._commands=new Map;this._onDidChangeCommands=this._register(new E);this.onDidChangeCommands=this._onDidChangeCommands.event}dispose(){super.dispose(),this._commands.clear()}registerSlashCommand(e,t){if(this._commands.has(e.command))throw new Error(`Already registered a command with id ${e.command}}`);return this._commands.set(e.command,{data:e,command:t}),this._onDidChangeCommands.fire(),Z(()=>{this._commands.delete(e.command)&&this._onDidChangeCommands.fire()})}getCommands(e,t){return Array.from(this._commands.values(),o=>o.data).filter(o=>o.locations.includes(e)&&(!o.modes||o.modes.includes(t)))}hasCommand(e){return this._commands.has(e)}async executeCommand(e,t,o,n,r,s,l,c){let u=this._commands.get(e);if(!u)throw new Error("No command with id ${id} NOT registered");if(u.command||await this._extensionService.activateByEvent(`onSlash:${e}`),!u.command)throw new Error(`No command with id ${e} NOT resolved`);return await u.command(t,o,n,r,s,l,c)}};iTe=I([m(0,lt)],iTe);function jeo(a){let i=[];return Qeo(a.node,i),i.join("")}function Qeo(a,i){if(a.type===2)a.lineBreakBefore&&i.push(`
`),typeof a.text=="string"&&i.push(a.text);else if(a.ctor===3)i.push("<image>");else if(a.ctor===1||a.ctor===2)for(let e of a.children)Qeo(e,i)}function bLt(a,i){return!a.models||a.models.length===0||!i?!0:a.models.some(e=>(!e.id||e.id===i.id)&&(!e.vendor||e.vendor===i.vendor)&&(!e.family||e.family===i.family)&&(!e.version||e.version===i.version))}var kn;(n=>{n.Internal={type:"internal",label:"Built-In"},n.External={type:"external",label:"External"};function e(r){switch(r.type){case"extension":return`extension:${r.extensionId.value}`;case"mcp":return`mcp:${r.collectionId}:${r.definitionId}`;case"user":return`user:${r.file.toString()}`;case"internal":return"internal";case"external":return"external"}}n.toKey=e;function t(r,s){return e(r)===e(s)}n.equals=t;function o(r){return r.type==="internal"?{ordinal:1,label:d(8698,null)}:r.type==="mcp"?{ordinal:2,label:r.label}:r.type==="user"?{ordinal:0,label:d(8700,null)}:{ordinal:3,label:r.label}}n.classify=o})(kn||={});function cD(a){return typeof a=="object"&&typeof a?.input=="string"&&(typeof a?.output=="string"||Array.isArray(a?.output))}function _B(a){return typeof a=="object"&&typeof a?.output=="object"&&typeof a?.output?.mimeType=="string"&&a?.output?.type==="data"}function SLt(a){return a.map(i=>{switch(i.kind){case"promptTsx":return z6e(i);case"text":return i.value;case"data":return d(8699,null,vl.formatSize(i.value.data.byteLength),i.value.mimeType||"unknown")}}).join(", ")}function Yeo(a){return a.content.some(i=>i.kind==="data")}function z6e(a){return jeo(a.value)}function Xm(a){return!!a&&a.getTools!==void 0}var oTe=class{constructor(i,e,t,o,n,r,s){this.id=i;this.referenceName=e;this.icon=t;this.source=o;this.description=n;this.legacyFullNames=r;this._contextKeyService=s;this._tools=new $9;this._toolSets=new $9;this.isHomogenous=ke(l=>!vt.some(this._tools.observable.read(l),c=>!kn.equals(c.source,this.source))&&!vt.some(this._toolSets.observable.read(l),c=>!kn.equals(c.source,this.source)))}addTool(i,e){return this._tools.add(i,e),Z(()=>{this._tools.delete(i)})}addToolSet(i,e){return i===this?x.None:(this._toolSets.add(i,e),Z(()=>{this._toolSets.delete(i)}))}getTools(i){return vt.concat(vt.filter(this._tools.observable.read(i),e=>this._contextKeyService.contextMatchesRules(e.when)),...vt.map(this._toolSets.observable.read(i),e=>e.getTools(i)))}},U6e=class{constructor(i,e){this._toolSet=i;this.model=e}get id(){return this._toolSet.id}get referenceName(){return this._toolSet.referenceName}get icon(){return this._toolSet.icon}get source(){return this._toolSet.source}get description(){return this._toolSet.description}get legacyFullNames(){return this._toolSet.legacyFullNames}getTools(i){return vt.filter(this._toolSet.getTools(i),e=>bLt(e,this.model))}},Vn=le("ILanguageModelToolsService");function Xeo(a){return A.from({scheme:Q.inMemory,path:`/lm/tool/${a}/tool_input.json`})}function K6e(a){return typeof a!="string"&&(a=a.id),A.from({scheme:Q.vscode,authority:"schemas",path:`/lm/tool/${a}`})}var pm;(s=>(s.execute="execute",s.edit="edit",s.search="search",s.agent="agent",s.read="read",s.web="web",s.todo="todo"))(pm||={});var u4;(e=>(e.runSubagent="runSubagent",e.vscode="vscode"))(u4||={});var C$o=/^@([\w_\-\.]+)(?=(\s|$|\b))/i,x$o=/^#([\w_\-]+)(:\d+)?(?=(\s|$|\b))/i,Chi=/^\/([\p{L}\d_\-\.:]+)(?=(\s|$|\b))/iu,uT=class{constructor(i,e,t,o){this.agentService=i;this.variableService=e;this.slashCommandService=t;this.promptsService=o}parseChatRequest(i,e,t="panel",o){let n=this.variableService.getDynamicVariables(i),r=this.variableService.getSelectedToolAndToolSets(i);return this.parseChatRequestWithReferences(n,r,e,t,o)}parseChatRequestWithReferences(i,e,t,o="panel",n){let r=[],s=new Map,l=new Map;for(let[g,f]of e)f&&(Xm(g)?l.set(g.referenceName,g):s.set(g.toolReferenceName??g.displayName,g));let c=1,u=1;for(let g=0;g<t.length;g++){let f=t.charAt(g-1),v=t.charAt(g),b;if((f.match(/\s/)||g===0)&&(v===Tu?b=this.tryToParseVariable(t.slice(g),g,new ye(c,u),r,s,l):v===zc?b=this.tryToParseAgent(t.slice(g),t,g,new ye(c,u),r,o,n):v===Bu&&(b=this.tryToParseSlashCommand(t.slice(g),t,g,new ye(c,u),r,o,n)),b||(b=this.tryToParseDynamicVariable(t.slice(g),g,new ye(c,u),i))),b){if(g!==0){let S=r.at(-1),y=S?.range.endExclusive??0,w=S?.editorRange.endLineNumber??1,k=S?.editorRange.endColumn??1;r.push(new Pv(new pi(y,g),new z(w,k,c,u),t.slice(y,g)))}r.push(b)}v===`
`?(c++,u=1):u++}let p=r.at(-1),h=p?.range.endExclusive??0;return h<t.length&&r.push(new Pv(new pi(h,t.length),new z(p?.editorRange.endLineNumber??1,p?.editorRange.endColumn??1,c,u),t.slice(h,t.length))),{parts:r,text:t}}tryToParseAgent(i,e,t,o,n,r,s){let l=i.match(C$o);if(!l)return;let[c,u]=l,p=new pi(t,t+c.length),h=new z(o.lineNumber,o.column,o.lineNumber,o.column+c.length),g=this.agentService.getAgentsByName(u);if(!g.length){let y=this.agentService.getAgentByFullyQualifiedId(u);y&&(g=[y])}let f=g.length>1&&s?.selectedAgent?s.selectedAgent:g.find(y=>y.locations.includes(r));if(!f||s?.mode&&!f.modes.includes(s.mode)||n.some(y=>y instanceof lp)||n.some(y=>y instanceof Pv&&y.text.trim()!==""||!(y instanceof lp)))return;let b=n.at(-1)?.range.endExclusive??0;if(e.slice(b,t).trim()==="")return new lp(p,h,f)}tryToParseVariable(i,e,t,o,n,r){let s=i.match(x$o);if(!s)return;let[l,c]=s,u=new pi(e,e+l.length),p=new z(t.lineNumber,t.column,t.lineNumber,t.column+l.length),h=n.get(c);if(h)return new dI(u,p,c,h.id,h.displayName,h.icon);let g=r.get(c);if(g){let f=Array.from(g.getTools()).map(v=>new dI(u,p,v.toolReferenceName??v.displayName,v.id,v.displayName,v.icon).toVariableEntry());return new VF(u,p,g.id,g.referenceName,g.icon,f)}}tryToParseSlashCommand(i,e,t,o,n,r,s){let l=i.match(Chi);if(!l||n.some(k=>!(k instanceof lp)&&!(k instanceof Pv&&k.text.trim()==="")))return;let u=n.at(-1)?.range.endExclusive??0;if(e.slice(u,t).trim()!=="")return;let[h,g]=l,f=new pi(t,t+h.length),v=new z(o.lineNumber,o.column,o.lineNumber,o.column+h.length),b=n.find(k=>k instanceof lp)?.agent??(s?.forcedAgent?s.forcedAgent:void 0);if(b){let k=b.slashCommands.find(T=>T.name===g);if(k)return new Xf(f,v,k)}let S=s?.attachmentCapabilities??b?.capabilities,w=this.slashCommandService.getCommands(r,s?.mode??"ask").find(k=>k.command===g);if(!b||w?.silent||S?.supportsPromptAttachments){if(w)return new UC(f,v,w);{let P=this.agentService.getDefaultAgent(r,s?.mode)?.slashCommands.find(O=>O.name===g);if(P)return new Xf(f,v,P)}if(this.promptsService.isValidSlashCommandName(g))return new dT(f,v,g)}}tryToParseDynamicVariable(i,e,t,o){let n=o.find(r=>r.range.startLineNumber===t.lineNumber&&r.range.startColumn===t.column);if(n){let r=n.range.endColumn-n.range.startColumn,s=i.substring(0,r),l=new pi(e,e+r);return new HR(l,n.range,s,n.id,n.modelDescription,n.data,n.fullName,n.icon,n.isFile,n.isDirectory)}}};uT=I([m(0,cr),m(1,vLt),m(2,BF),m(3,Or)],uT);function HF(a){if(!a.viewModel||!a.supportsFileReferences)return[];let i=a.getContrib(yS.ID);if(!i)return[];if(a.viewModel.editing&&i.variables.length>0)return i.variables;if(a.input.attachmentModel.attachments.length>0&&a.viewModel.editing){let e=[],t=a.inputEditor.getModel(),o=t?.getValueLength()??0;for(let n of a.input.attachmentModel.attachments)if(n.range){if(n.range.start>=n.range.endExclusive||n.range.start<0||n.range.endExclusive>o||!t)continue;let r=t.getPositionAt(n.range.start),s=t.getPositionAt(n.range.endExclusive),l={id:n.id,fullName:n.name,modelDescription:n.modelDescription,range:new z(r.lineNumber,r.column,s.lineNumber,s.column),icon:n.icon,isFile:n.kind==="file",isDirectory:n.kind==="directory",data:n.value};e.push(l)}return e.length>0?e:i.variables}return i.variables}function MK(a){return a.input.selectedToolsModel.entriesMap.get()}var nTe=class{constructor(i){this.chatWidgetService=i}getDynamicVariables(i){let e=this.chatWidgetService.getWidgetBySessionResource(i);return e?HF(e):[]}getSelectedToolAndToolSets(i){let e=this.chatWidgetService.getWidgetBySessionResource(i);return e?MK(e):new Map}};nTe=I([m(0,Pt)],nTe);function k$o(a){return!!a&&typeof a=="object"&&"uri"in a&&a.uri instanceof A&&"version"in a&&typeof a.version=="number"&&"ranges"in a&&Array.isArray(a.ranges)&&a.ranges.every(z.isIRange)}function Jeo(a){return!!a&&typeof a=="object"&&"documents"in a&&Array.isArray(a.documents)&&a.documents.every(k$o)}function Zeo(a){return!!a&&typeof a=="object"&&typeof a.variableName=="string"}function rTe(a){return!!a&&typeof a=="object"&&"command"in a&&"language"in a}var Pi;(p=>{let a;(y=>(y[y.Streaming=0]="Streaming",y[y.WaitingForConfirmation=1]="WaitingForConfirmation",y[y.Executing=2]="Executing",y[y.WaitingForPostApproval=3]="WaitingForPostApproval",y[y.Completed=4]="Completed",y[y.Cancelled=5]="Cancelled"))(a=p.StateKind||={});function i(h,g){if(h.kind==="toolInvocationSerialized")return h.isConfirmed===void 0||typeof h.isConfirmed=="boolean"?{type:h.isConfirmed?4:0}:h.isConfirmed;let f=h.state.read(g);if(!(f.type===0||f.type===1))return f.type===5?{type:f.reason}:f.confirmed}p.executionConfirmedOrDenied=i;function e(h,g){let f=i(h);if(f)return Promise.resolve(f);let v=new N;return new Promise(b=>{g&&v.add(g.onCancellationRequested(()=>{b({type:0})})),v.add(be(S=>{let y=i(h,S);y&&(v.dispose(),b(y))}))}).finally(()=>{v.dispose()})}p.awaitConfirmation=e;function t(h,g){let f=h.state.read(g);if(f.type===4)return f.postConfirmed||{type:1};if(f.type===5)return{type:f.reason}}function o(h,g){let f=h?.state.get();return f?.type===1||f?.type===3?(f.confirm(g),!0):!1}p.confirmWith=o;function n(h,g){let f=t(h);if(f)return Promise.resolve(f);let v=new N;return new Promise(b=>{g&&v.add(g.onCancellationRequested(()=>{b({type:0})})),v.add(be(S=>{let y=t(h,S);y&&(v.dispose(),b(y))}))}).finally(()=>{v.dispose()})}p.awaitPostConfirmation=n;function r(h,g){if(h.kind==="toolInvocationSerialized")return h.resultDetails;let f=h.state.read(g);if(f.type===4||f.type===3)return f.resultDetails}p.resultDetails=r;function s(h,g){if(h.kind==="toolInvocationSerialized")return!0;let f=h.state.read(g);return f.type===4||f.type===5}p.isComplete=s;function l(h,g){return h.kind==="toolInvocationSerialized"?!1:h.state.read(g).type===0}p.isStreaming=l;function c(h,g){if(h.kind==="toolInvocationSerialized")return;let f=h.state.read(g);if(f.type!==0)return f.parameters}p.getParameters=c;function u(h,g){if(h.kind==="toolInvocationSerialized")return;let f=h.state.read(g);if(f.type!==0)return f.confirmationMessages}p.getConfirmationMessages=u})(Pi||={});var ILt=class{constructor(i){this.state=i;this.kind="mcpServersStarting";this.didStartServerIds=[]}get isEmpty(){let i=this.state.get();return!i.working&&i.serversRequiringInteraction.length===0}wait(){return new Promise(i=>{Ox(e=>{let t=this.state.read(e);t.working||(e.dispose(),i(t))})})}toJSON(){return{kind:"mcpServersStarting",didStartServerIds:this.didStartServerIds}}};function eto(a){return!!a&&a.kind==="reply"&&typeof a.message=="string"&&typeof a.agentId=="string"}function tto(a){return No(a,{created:!0})?a:{created:a.startTime,lastRequestStarted:a.startTime,lastRequestEnded:a.endTime}}var p4;(o=>{function a(n){return n.kind==="sent"}o.isSent=a;function i(n){return n.kind==="rejected"}o.isRejected=i;function e(n){return n.kind==="queued"}o.isQueued=e;function t(n){if(n.kind!=="sent")throw new Error(`Expected ChatSendResult to be 'sent', but was '${n.kind}'`)}o.assertSent=t})(p4||={});var mi=le("IChatService"),tue="accessibility.voice.keywordActivation",G6e="chat.stopCancellationNoop",UF="chat.pendingRequestChange";var q6e=(t=>(t[t.Output=1]="Output",t[t.OutputItems=2]="OutputItems",t[t.ExecutionState=3]="ExecutionState",t))(q6e||{}),eJ=le("INotebookExecutionService");var uI;(h=>{function a(g){return{mime:g.mime,valueBytes:g.data}}h.toNotebookOutputItemDto=a;function i(g){return{outputId:g.outputId,metadata:g.metadata,items:g.outputs.map(a)}}h.toNotebookOutputDto=i;function e(g){return{cellKind:g.cellKind,language:g.language,mime:g.mime,source:g.source,internalMetadata:g.internalMetadata,metadata:g.metadata,outputs:g.outputs.map(i)}}h.toNotebookCellDataDto=e;function t(g){return{metadata:g.metadata,cells:g.cells.map(e)}}h.toNotebookDataDto=t;function o(g){return{mime:g.mime,data:g.valueBytes}}h.fromNotebookOutputItemDto=o;function n(g){return{outputId:g.outputId,metadata:g.metadata,outputs:g.items.map(o)}}h.fromNotebookOutputDto=n;function r(g){return{cellKind:g.cellKind,language:g.language,mime:g.mime,source:g.source,outputs:g.outputs.map(n),metadata:g.metadata,internalMetadata:g.internalMetadata}}h.fromNotebookCellDataDto=r;function s(g){return{metadata:g.metadata,cells:g.cells.map(r)}}h.fromNotebookDataDto=s;function l(g){return{handle:g.handle,uri:g.uri,source:g.textBuffer.getLinesContent(),eol:g.textBuffer.getEOL(),language:g.language,cellKind:g.cellKind,outputs:g.outputs.map(i),metadata:g.metadata,internalMetadata:g.internalMetadata}}h.toNotebookCellDto=l;function c(g){return g.editType===1?{editType:g.editType,cellHandle:g.cellHandle,append:g.append,outputs:g.outputs.map(n)}:g.editType===2?{editType:g.editType,append:g.append,outputId:g.outputId,items:g.items.map(o)}:g}h.fromCellExecuteUpdateDto=c;function u(g){return g}h.fromCellExecuteCompleteDto=u;function p(g){return g.editType===1?{editType:g.editType,index:g.index,count:g.count,cells:g.cells.map(r)}:g}h.fromCellEditOperationDto=p})(uI||={});var zF=le("aiCustomizationWorkspaceService"),pI="builtin",Zn={Agents:"agents",Skills:"skills",Instructions:"instructions",Prompts:"prompts",Hooks:"hooks",McpServers:"mcpServers",Plugins:"plugins",Models:"models"};function yLt(a,i){let e=new Set(i.sources);return a.filter(t=>e.has(t.storage)?t.storage==="user"&&i.includedUserFileRoots?i.includedUserFileRoots.some(o=>ws(t.uri,o)):!0:!1)}var j6e=".prompt.md",Q6e=".instructions.md",AK=".chatmode.md",tJ=".agent.md",m4="SKILL.md",wLt=/^[a-z0-9-]+$/,h4="AGENTS.md",CLt="CLAUDE.md",xLt="CLAUDE.local.md",Y6e=".claude",sTe="copilot-instructions.md",ito=".github",X6e=".github/prompts",khi=".github/instructions",kLt=".github/chatmodes",NK=".github/agents",PK=".claude/agents",ELt="~/.copilot/agents",xhi=".claude/rules";var J6e=[{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"}],TLt=[{path:khi,source:"github-workspace",storage:"local"},{path:xhi,source:"claude-workspace",storage:"local"},{path:"~/.copilot/instructions",source:"copilot-personal",storage:"user"},{path:"~/"+xhi,source:"claude-personal",storage:"user"}],E$o=[{path:X6e,source:"github-workspace",storage:"local"}],T$o=[{path:NK,source:"github-workspace",storage:"local"},{path:PK,source:"claude-workspace",storage:"local"},{path:"~/"+PK,source:"claude-personal",storage:"user"},{path:ELt,source:"copilot-personal",storage:"user"}],Z6e=[{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 oto(a){let i=ci(a).path;return i.endsWith("/"+NK)||i.endsWith("/"+PK)||_$o(a)}function _Lt(a){return ci(a).path.endsWith("/"+PK)}function _$o(a){return ci(a).path.endsWith(ELt.substring(1))}function DB(a){return a.path.includes("/"+xhi+"/")}function e9e(a){let i=He(a);if(i.endsWith(j6e))return"prompt";if(i.endsWith(Q6e)||i===sTe)return"instructions";if(i.endsWith(AK)||i.endsWith(tJ))return"agent";if(i.toLowerCase()===m4.toLowerCase())return"skill";if(i.endsWith(".md")&&i!=="README.md"&&oto(a))return"agent";if(i.endsWith(".md")&&i!=="README.md"&&DB(a))return"instructions";if(i.toLowerCase().endsWith(".json"))return"hook"}function Ehi(a){return e9e(a)!==void 0}function DLt(a){switch(a){case"instructions":return Q6e;case"prompt":return j6e;case"agent":return tJ;case"skill":return m4;case"hook":return".json";default:throw new Error("Unknown prompt type")}}function aTe(a){switch(a){case"instructions":return TLt;case"prompt":return E$o;case"agent":return T$o;case"skill":return J6e;case"hook":return Z6e;default:throw new Error("Unknown prompt type")}}function t9e(a){return He(ci(a))}function wf(a){let i=He(a),e=[j6e,Q6e,AK,tJ];for(let t of e)if(i.endsWith(t))return He(a,t);return i===sTe?He(a,".md"):i.toLowerCase()===m4.toLowerCase()?He(a,".md"):i.endsWith(".md")&&i!=="README.md"&&oto(a)?He(a,".md"):i.endsWith(".md")&&i!=="README.md"&&DB(a)?He(a,".md"):He(a)}var UR=le("customizationHarnessService");var D$o={sources:["local","user","plugin"]};function nto(a){return[Ge(a,".copilot"),Ge(a,".claude"),Ge(a,".agents")]}function rto(a){return[Ge(a,".claude")]}function sto(a){return["local","user","plugin",...a]}function ato(a){let i={sources:sto(a)};return{id:"vscode",label:d(8210,null),icon:q.fromId(R.vm.id),sectionOverrides:new Map([[Zn.Instructions,{rootFileShortcuts:[h4]}]]),getStorageSourceFilter:()=>i}}function lto(a,i,e,t,o,n){let r=sto(o),s={sources:r},l={sources:r,includedUserFileRoots:t};return{id:a,label:i,icon:e,hiddenSections:n?.hiddenSections,workspaceSubpaths:n?.workspaceSubpaths,hideGenerateButton:n?.hideGenerateButton,sectionOverrides:n?.sectionOverrides,requiredAgentId:n?.requiredAgentId,instructionFileFilter:n?.instructionFileFilter,getStorageSourceFilter(c){return c==="hook"?D$o:c==="prompt"?s:l}}}function cto(a,i){return lto("cli",d(8209,null),q.fromId(R.worktree.id),a,i,{hideGenerateButton:!0,requiredAgentId:"copilotcli",workspaceSubpaths:[".github",".copilot",".agents",".claude"],sectionOverrides:new Map([[Zn.Instructions,{rootFileShortcuts:[h4]}]])})}function dto(a,i){return lto("claude",d(8208,null),q.fromId(R.claude.id),a,i,{hiddenSections:[Zn.Prompts,Zn.Plugins],workspaceSubpaths:[".claude"],hideGenerateButton:!0,requiredAgentId:"claude-code",sectionOverrides:new Map([[Zn.Hooks,{label:d(8207,null),commandId:"copilot.claude.hooks"}],[Zn.Instructions,{label:d(8206,null),rootFile:"CLAUDE.md",typeLabel:d(8211,null),fileExtension:".md"}]]),instructionFileFilter:["CLAUDE.md","CLAUDE.local.md",".claude/rules/","copilot-instructions.md"]})}function lTe(a,i){return i.some(e=>a.includes(`/${e}/`)||a.endsWith(`/${e}`))}function Thi(a,i){let e=a.substring(a.lastIndexOf("/")+1);return i.some(t=>t.endsWith("/")?a.includes(`/${t}`)||a.startsWith(t):e===t)}var LLt=class{constructor(i,e){this._externalHarnesses=[];this._staticHarnesses=i,this._activeHarness=Me(this,e),this.activeHarness=this._activeHarness,this._availableHarnesses=Me(this,[...this._staticHarnesses]),this.availableHarnesses=this._availableHarnesses}_getAllHarnesses(){let i=new Set(this._externalHarnesses.map(e=>e.id));return[...this._staticHarnesses.filter(e=>!i.has(e.id)),...this._externalHarnesses]}_refreshAvailableHarnesses(){this._availableHarnesses.set(this._getAllHarnesses(),void 0)}registerExternalHarness(i){return this._externalHarnesses.push(i),this._refreshAvailableHarnesses(),{dispose:()=>{let e=this._externalHarnesses.indexOf(i);if(e>=0&&(this._externalHarnesses.splice(e,1),this._refreshAvailableHarnesses(),this._activeHarness.get()===i.id)){let t=this._getAllHarnesses();!t.some(o=>o.id===i.id)&&t.length>0&&this._activeHarness.set(t[0].id,void 0)}}}}setActiveHarness(i){this._getAllHarnesses().some(e=>e.id===i)&&this._activeHarness.set(i,void 0)}getStorageSourceFilter(i){let e=this._activeHarness.get(),t=this._getAllHarnesses();return t.find(n=>n.id===e)?.getStorageSourceFilter(i)??t[0].getStorageSourceFilter(i)}getActiveDescriptor(){let i=this._activeHarness.get(),e=this._getAllHarnesses();return e.find(t=>t.id===i)??e[0]}};var _hi=class{constructor(i){this.content=i;this.kind="progressTask";this.deferred=new Ko;this._onDidAddProgress=new E;this.progress=[]}get onDidAddProgress(){return this._onDidAddProgress.event}task(){return this.deferred.p}isSettled(){return this.deferred.isSettled}complete(i){this.deferred.complete(i)}add(i){this.progress.push(i),this._onDidAddProgress.fire(i)}toJSON(){return{kind:"progressTaskSerialized",content:this.content,progress:this.progress}}},RLt=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super();this._chatAgentService=t;this._chatSessionService=o;this._chatService=n;this._languageFeaturesService=r;this._chatWidgetService=s;this._instantiationService=l;this._logService=c;this._extensionService=u;this._uriIdentityService=p;this._promptsService=h;this._languageModelToolsService=g;this._customizationHarnessService=f;this._configurationService=v;this._agents=this._register(new Vt);this._agentCompletionProviders=this._register(new Vt);this._agentIdsToCompletionProviders=this._register(new Vt);this._chatParticipantDetectionProviders=this._register(new Vt);this._promptFileProviders=this._register(new Vt);this._promptFileProviderEmitters=this._register(new Vt);this._promptFileContentRegistrations=this._register(new Vt);this._customizationProviders=this._register(new Vt);this._customizationProviderEmitters=this._register(new Vt);this._pendingProgress=new Map;this._activeTasks=new Map;this._unresolvedAnchors=new Map;this._proxy=e.getProxy(to.ExtHostChatAgents2),this._register(this._configurationService.onDidChangeConfiguration(b=>{b.affectsConfiguration("chat.customizations.providerApi.enabled")&&(this._configurationService.getValue("chat.customizations.providerApi.enabled")||(this._customizationProviders.clearAndDisposeAll(),this._customizationProviderEmitters.clearAndDisposeAll()))})),this._register(this._chatService.onDidDisposeSession(b=>{for(let S of b.sessionResources)this._proxy.$releaseSession(S)})),this._register(this._chatService.onDidPerformUserAction(b=>{if(typeof b.agentId=="string"){for(let[S,y]of this._agents)if(y.id===b.agentId){b.action.kind==="vote"?this._proxy.$acceptFeedback(S,b.result??{},b.action):this._proxy.$acceptAction(S,b.result||{},b);break}}})),this._register(this._chatService.onDidReceiveQuestionCarouselAnswer(b=>{this._proxy.$handleQuestionCarouselAnswer(b.requestId,b.resolveId,b.answers)})),this._register(this._chatWidgetService.onDidChangeFocusedSession(()=>{this._acceptActiveChatSession(this._chatWidgetService.lastFocusedWidget)})),this._acceptActiveChatSession(this._chatWidgetService.lastFocusedWidget),this._pushCustomAgents(),this._register(this._promptsService.onDidChangeCustomAgents(()=>{this._pushCustomAgents()})),this._pushInstructions(),this._register(this._promptsService.onDidChangeInstructions(()=>{this._pushInstructions()})),this._pushSkills(),this._register(this._promptsService.onDidChangeSkills(()=>{this._pushSkills()}))}_acceptActiveChatSession(e){let t=e?.viewModel?.sessionResource,o=t&&lg(t)==="local";this._proxy.$acceptActiveChatSession(o?t:void 0)}async _pushCustomAgents(){try{let t=(await this._promptsService.getCustomAgents(Se.None)).map(o=>({uri:o.uri}));this._proxy.$acceptCustomAgents(t)}catch(e){this._logService.error("[chat] Failed to push custom agents to extension host",e)}}async _pushInstructions(){try{let t=(await this._promptsService.getInstructionFiles(Se.None)).map(o=>({uri:o.uri}));this._proxy.$acceptInstructions(t)}catch(e){this._logService.error("[chat] Failed to push instructions to extension host",e)}}async _pushSkills(){try{let t=(await this._promptsService.findAgentSkills(Se.None)??[]).map(o=>({uri:o.uri}));this._proxy.$acceptSkills(t)}catch(e){this._logService.error("[chat] Failed to push skills to extension host",e)}}$unregisterAgent(e){this._agents.deleteAndDispose(e)}async $transferActiveChatSession(e){let o=this._chatWidgetService.lastFocusedWidget?.viewModel?.model;if(!o){this._logService.error("MainThreadChat#$transferActiveChatSession: No active chat session found");return}await this._chatService.transferChatSession(o.sessionResource,A.revive(e))}async $registerAgent(e,t,o,n,r){await this._extensionService.whenInstalledExtensionsRegistered();let s=this._chatAgentService.getAgent(o,!0),l=this._chatSessionService.getAllChatSessionContributions().find(p=>p.type===o||p.alternativeIds?.includes(o));if(!s&&!l&&!r)throw this._chatAgentService.getAgentsByName(o).length?new Error(`chatParticipant must be declared with an ID in package.json. The "id" property may be missing! "${o}"`):new Error(`chatParticipant must be declared in package.json: ${o}`);let c={invoke:async(p,h,g,f)=>{let v=this._chatService.getSession(p.sessionResource);this._pendingProgress.set(p.requestId,{progress:h,chatSession:v});try{let b=v?.contributedChatSession,S;if(b){let y=b.chatSessionResource,w=TK(y);S={chatSessionResource:y,isUntitled:w,initialSessionOptions:QX.toStrValueArray(b.initialSessionOptions)}}return await this._proxy.$invokeAgent(e,p,{history:g,chatSessionContext:S},f)??{}}finally{this._pendingProgress.delete(p.requestId)}},setRequestTools:(p,h)=>{this._proxy.$setRequestTools(p,h)},setYieldRequested:(p,h)=>{this._proxy.$setYieldRequested(p,h)},provideFollowups:async(p,h,g,f)=>this._agents.get(e)?.hasFollowups?this._proxy.$provideFollowups(p,e,h,{history:g},f):[],provideChatTitle:(p,h)=>this._proxy.$provideChatTitle(e,p,h),provideChatSummary:(p,h)=>this._proxy.$provideChatSummary(e,p,h)};if(l?.alternativeIds?.includes(o))return;let u;if(!s&&r){let p=this._extensionService.extensions.find(h=>Ii.equals(h.identifier,t));u=this._chatAgentService.registerDynamicAgent({id:o,name:r.name,description:r.description,extensionId:t,extensionVersion:p?.version,extensionDisplayName:p?.displayName??t.value,extensionPublisherId:p?.publisher??"",publisherDisplayName:r.publisherName,fullName:r.fullName,metadata:$n(n),slashCommands:[],disambiguation:[],locations:["panel"],modes:["ask","agent","edit"]},c)}else u=this._chatAgentService.registerAgentImplementation(o,c);this._agents.set(e,{id:o,extensionId:t,dispose:()=>u.dispose(),hasFollowups:n.hasFollowups})}async $updateAgent(e,t){await this._extensionService.whenInstalledExtensionsRegistered();let o=this._agents.get(e);if(!o){this._logService.error(`MainThreadChatAgents2#$updateAgent: No agent with handle ${e} registered`);return}o.hasFollowups=t.hasFollowups,this._chatAgentService.updateAgent(o.id,$n(t))}async $handleProgressChunk(e,t){let o=this._pendingProgress.get(e);if(!o){this._logService.warn(`MainThreadChatAgents2#$handleProgressChunk: No pending progress for requestId ${e}`);return}let{progress:n,chatSession:r}=o,s=[],l=r?.getRequests().find(c=>c.id===e)?.response;for(let c of t){let[u,p]=Array.isArray(c)?c:[c];if(u.kind==="externalEdits"){if(r?.editingSession&&p!==void 0&&l){let g=u.start?await r.editingSession.startExternalEdits(l,p,$n(u.resources),u.undoStopId):await r.editingSession.stopExternalEdits(l,p);s.push(...g)}continue}if(u.kind==="beginToolInvocation"){this._languageModelToolsService.beginToolCall({toolCallId:u.toolCallId,toolId:u.toolName,chatRequestId:e,sessionResource:r?.sessionResource,subagentInvocationId:u.subagentInvocationId});continue}if(u.kind==="updateToolInvocation"){this._languageModelToolsService.updateToolStream(u.toolCallId,u.streamData?.partialInput,Se.None);continue}if(u.kind==="usage"){l&&l.setUsage({kind:"usage",promptTokens:u.promptTokens,completionTokens:u.completionTokens,outputBuffer:u.outputBuffer,promptTokenDetails:u.promptTokenDetails});continue}let h=u.kind==="notebookEdit"?uto.fromChatEdit(u):$n(u);if((h.kind==="notebookEdit"||h.kind==="textEdit"||h.kind==="codeblockUri")&&(h.uri=this._uriIdentityService.asCanonicalUri(h.uri)),p!==void 0){if(h.kind==="progressTask"){let f=`${e}_${p}`,v=new _hi(h.content);this._activeTasks.set(f,v),s.push(v)}else if(p!==void 0){let g=`${e}_${p}`,f=this._activeTasks.get(g);switch(h.kind){case"progressTaskResult":f&&h.content?(f.complete(h.content.value),this._activeTasks.delete(g)):f?.complete(void 0);break;case"warning":case"reference":f?.add(h);break}}continue}h.kind==="inlineReference"&&h.resolveId&&(this._unresolvedAnchors.has(e)||this._unresolvedAnchors.set(e,new Map),this._unresolvedAnchors.get(e)?.set(h.resolveId,h)),s.push(h)}n(s)}$handleAnchorResolve(e,t,o){let n=this._unresolvedAnchors.get(e)?.get(t);if(n&&(this._unresolvedAnchors.get(e)?.delete(t),o)){let r=$n(o);n.inlineReference=r.inlineReference}}$registerAgentCompletionsProvider(e,t,o){let n=async(r,s)=>(await this._proxy.$invokeCompletionProvider(e,r,s)).map(c=>({...c,icon:c.icon?q.fromId(c.icon):void 0}));this._agentIdsToCompletionProviders.set(t,this._chatAgentService.registerAgentCompletionProvider(t,n)),this._agentCompletionProviders.set(e,this._languageFeaturesService.completionProvider.register({scheme:Q.vscodeChatInput,hasAccessToAllModels:!0},{_debugDisplayName:"chatAgentCompletions:"+e,triggerCharacters:o,provideCompletionItems:async(r,s,l,c)=>{let u=this._chatWidgetService.getWidgetByInputUri(r.uri);if(!u||!u.viewModel)return;let p=o.map(k=>ns(k)).join(""),h=new RegExp(`[${p}]\\S*`,"g"),g=Wx(s.column,h,r.getLineContent(s.lineNumber),0)?.word??"";if(g&&!o.some(k=>g.startsWith(k)))return;let v=this._instantiationService.createInstance(uT).parseChatRequestWithReferences(HF(u),MK(u),r.getValue()).parts.find(k=>k instanceof lp),b=this._agents.get(e)?.id;if(v?.agent.id!==b)return;let S=L$o(r,s,h);return S?{suggestions:(await n(g,c)).map(k=>{let T=k.insertText??(typeof k.label=="string"?k.label:k.label.label),P=new z(S.insert.startLineNumber,S.insert.startColumn,S.insert.endLineNumber,S.insert.startColumn+T.length);return{label:k.label,range:S,insertText:T+" ",kind:18,detail:k.detail,documentation:k.documentation,command:{id:F6e.ID,title:"",arguments:[{id:k.id,widget:u,range:P,variableData:$n(k.value),command:k.command}]}}})}:null}}))}$unregisterAgentCompletionsProvider(e,t){this._agentCompletionProviders.deleteAndDispose(e),this._agentIdsToCompletionProviders.deleteAndDispose(t)}$registerChatParticipantDetectionProvider(e){this._chatParticipantDetectionProviders.set(e,this._chatAgentService.registerChatParticipantDetectionProvider(e,{provideParticipantDetection:async(t,o,n,r)=>await this._proxy.$detectChatParticipant(e,t,{history:o},n,r)}))}$unregisterChatParticipantDetectionProvider(e){this._chatParticipantDetectionProviders.deleteAndDispose(e)}async $registerPromptFileProvider(e,t,o){let n=await this._extensionService.getExtension(o.value);if(!n){this._logService.error(`[MainThreadChatAgents2] Could not find extension for prompt file provider: ${o.value}`);return}if(!zeo(t)){this._logService.error(`[MainThreadChatAgents2] Invalid contribution type: ${t}`);return}let r=new E;this._promptFileProviderEmitters.set(e,r);let s=new Vt;this._promptFileContentRegistrations.set(e,s);let l=this._promptsService.registerPromptFileProvider(n,t,{onDidChangePromptFiles:r.event,providePromptFiles:async(c,u)=>{let p=await this._proxy.$providePromptFiles(e,t,c,u);if(p)return p.map(h=>({uri:A.revive(h.uri)}))}});this._promptFileProviders.set(e,l)}$unregisterPromptFileProvider(e){this._promptFileProviders.deleteAndDispose(e),this._promptFileProviderEmitters.deleteAndDispose(e),this._promptFileContentRegistrations.deleteAndDispose(e)}$onDidChangePromptFiles(e){let t=this._promptFileProviderEmitters.get(e);t&&t.fire()}async $registerChatSessionCustomizationProvider(e,t,o,n){if(!this._configurationService.getValue("chat.customizations.providerApi.enabled")){this._logService.trace(`[MainThreadChatAgents2] Customization provider API is disabled, ignoring registration from ${n.value}`);return}if(!await this._extensionService.getExtension(n.value)){this._logService.error(`[MainThreadChatAgents2] Could not find extension for customization provider: ${n.value}`);return}let s=new E;this._customizationProviderEmitters.set(e,s);let l={onDidChange:s.event,provideChatSessionCustomizations:async h=>{let g=await this._proxy.$provideChatSessionCustomizations(e,h);if(g)return g.map(f=>({uri:A.revive(f.uri),type:f.type,name:f.name,description:f.description,groupKey:f.groupKey,badge:f.badge,badgeTooltip:f.badgeTooltip}))}},c=o.unsupportedTypes?.map(h=>{switch(h){case"agent":return Zn.Agents;case"skill":return Zn.Skills;case"instructions":return Zn.Instructions;case"prompt":return Zn.Prompts;case"hook":return Zn.Hooks;default:return h}}),u={id:t,label:o.label,icon:o.iconId?q.fromId(o.iconId):q.fromId(R.extensions.id),hiddenSections:c,getStorageSourceFilter:()=>({sources:["local","user","plugin","extension"]}),itemProvider:l},p=this._customizationHarnessService.registerExternalHarness(u);this._customizationProviders.set(e,p)}$unregisterChatSessionCustomizationProvider(e){this._customizationProviders.deleteAndDispose(e),this._customizationProviderEmitters.deleteAndDispose(e)}$onDidChangeCustomizations(e){let t=this._customizationProviderEmitters.get(e);t&&t.fire()}};RLt=I([fo(qi.MainThreadChatAgents2),m(1,cr),m(2,Us),m(3,mi),m(4,Qt),m(5,Pt),m(6,F),m(7,se),m(8,lt),m(9,ht),m(10,Or),m(11,Vn),m(12,UR),m(13,B)],RLt);function L$o(a,i,e){let t=Wx(i.column,e,a.getLineContent(i.lineNumber),0);if(!t&&a.getWordUntilPosition(i).word)return;let o,n;return t?(o=new z(i.lineNumber,t.startColumn,i.lineNumber,i.column),n=new z(i.lineNumber,t.startColumn,i.lineNumber,t.endColumn)):o=n=z.fromPositions(i),{insert:o,replace:n}}var uto;(i=>{function a(e){return{kind:"notebookEdit",uri:A.revive(e.uri),done:e.done,edits:e.edits.map(uI.fromCellEditOperationDto)}}i.fromChatEdit=a})(uto||={});var iJ=le("codeMapperService"),MLt=class{constructor(){this.providers=[]}registerCodeMapperProvider(i,e){return this.providers.push(e),{dispose:()=>{let t=this.providers.indexOf(e);t>=0&&this.providers.splice(t,1)}}}async mapCode(i,e,t){for(let o of this.providers){let n=await o.mapCode(i,e,t);return t.isCancellationRequested?void 0:n}}};var iue=class extends x{constructor(e,t){super();this.codeMapperService=t;this.providers=this._register(new Vt);this._responseMap=new Map;this._proxy=e.getProxy(to.ExtHostCodeMapper)}$registerCodeMapperProvider(e,t){let o={displayName:t,mapCode:async(r,s,l)=>{let c=String(iue._requestHandlePool++);this._responseMap.set(c,s);let u={requestId:c,codeBlocks:r.codeBlocks,chatRequestId:r.chatRequestId,chatRequestModel:r.chatRequestModel,chatSessionResource:r.chatSessionResource,location:r.location};try{return await this._proxy.$mapCode(e,u,l).then(p=>p??void 0)}finally{this._responseMap.delete(c)}}},n=this.codeMapperService.registerCodeMapperProvider(e,o);this.providers.set(e,n)}$unregisterCodeMapperProvider(e){this.providers.deleteAndDispose(e)}$handleProgress(e,t){let o=this._responseMap.get(e);if(o){let n=t.edits,r=A.revive(t.uri);n.length?n.every(SE.isTextEdit)?o.textEdit(r,n):o.notebookEdit(r,n.map(uI.fromCellEditOperationDto)):o.textEdit(r,[])}return Promise.resolve()}};iue._requestHandlePool=0,iue=I([fo(qi.MainThreadCodeMapper),m(1,iJ)],iue);var Dhi="vscode://schemas/toolsParameters",R$o={definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},enum:{type:"array",minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},defaultSnippets:[{body:{type:"object",properties:{"${1:paramName}":{type:"string",description:"${2:description}"}}}}]},M$o=ne.as(ma.JSONContribution);M$o.registerSchema(Dhi,R$o);var mto=Rn.registerExtensionPoint({extensionPoint:"languageModelTools",activationEventsGenerator:function*(a){for(let i of a)yield`onLanguageModelTool:${i.name}`},jsonSchema:{description:d(8696,null),type:"array",items:{additionalProperties:!1,type:"object",defaultSnippets:[{body:{name:"${1}",modelDescription:"${2}",inputSchema:{type:"object",properties:{"${3:name}":{type:"string",description:"${4:description}"}}}}}],required:["name","displayName","modelDescription"],properties:{name:{description:d(8684,null),type:"string",pattern:"^(?!copilot_|vscode_)[\\w-]+$"},toolReferenceName:{markdownDescription:d(8685,null,"`canBeReferencedInPrompt`"),type:"string",pattern:"^[\\w-]+$"},displayName:{description:d(8682,null),type:"string"},userDescription:{description:d(8695,null),type:"string"},modelDescription:{description:d(8683,null),type:"string"},inputSchema:{description:d(8680,null),$ref:Dhi},canBeReferencedInPrompt:{markdownDescription:d(8671,null,"`ChatRequest#toolReferences`"),type:"boolean"},icon:{markdownDescription:d(8674,null),anyOf:[{type:"string"},{type:"object",properties:{light:{description:d(8676,null),type:"string"},dark:{description:d(8675,null),type:"string"}}}]},when:{markdownDescription:d(8672,null),type:"string"},tags:{description:d(8694,null),type:"array",items:{type:"string",pattern:"^(?!copilot_|vscode_)"}}}}}}),P$o=Rn.registerExtensionPoint({extensionPoint:"languageModelToolSets",deps:[mto],jsonSchema:{description:d(8697,null),type:"array",items:{additionalProperties:!1,type:"object",defaultSnippets:[{body:{name:"${1}",description:"${2}",tools:["${3}"]}}],required:["name","description","tools"],properties:{name:{description:d(8689,null),type:"string",pattern:"^[\\w-]+$"},description:{description:d(8687,null),type:"string"},icon:{markdownDescription:d(8688,null,"`$(zap)`"),type:"string"},tools:{markdownDescription:d(8690,null),type:"array",minItems:1,items:{type:"string"}}}}}});function pto(a,i){return`${a.value}/${i}`}function i9e(a,i){return`toolset:${a.value}/${i}`}var oue=class{constructor(i,e){this._registrationDisposables=new Vt;mto.setHandler((t,o)=>{for(let n of o.added)for(let r of n.value){if(!r.name||!r.modelDescription||!r.displayName){n.collector.error(`Extension '${n.description.identifier.value}' CANNOT register tool without name, modelDescription, and displayName: ${JSON.stringify(r)}`);continue}if(!r.name.match(/^[\w-]+$/)){n.collector.error(`Extension '${n.description.identifier.value}' CANNOT register tool with invalid id: ${r.name}. The id must match /^[\\w-]+$/.`);continue}if(r.canBeReferencedInPrompt&&!r.toolReferenceName){n.collector.error(`Extension '${n.description.identifier.value}' CANNOT register tool with 'canBeReferencedInPrompt' set without a 'toolReferenceName': ${JSON.stringify(r)}`);continue}if((r.name.startsWith("copilot_")||r.name.startsWith("vscode_"))&&!Ua(n.description,"chatParticipantPrivate")){n.collector.error(`Extension '${n.description.identifier.value}' CANNOT register tool with name starting with "vscode_" or "copilot_"`);continue}if(r.tags?.some(h=>h.startsWith("copilot_")||h.startsWith("vscode_"))&&!Ua(n.description,"chatParticipantPrivate")&&n.collector.error(`Extension '${n.description.identifier.value}' CANNOT register tool with tags starting with "vscode_" or "copilot_"`),r.legacyToolReferenceFullNames&&!Ua(n.description,"chatParticipantPrivate")){n.collector.error(`Extension '${n.description.identifier.value}' CANNOT use 'legacyToolReferenceFullNames' without the 'chatParticipantPrivate' API proposal enabled`);continue}let s=r.icon,l;typeof s=="string"?l=q.fromString(s)??{dark:Ge(n.description.extensionLocation,s),light:Ge(n.description.extensionLocation,s)}:s&&(l={dark:Ge(n.description.extensionLocation,s.dark),light:Ge(n.description.extensionLocation,s.light)});let c=i.defaultChatAgent?.chatExtensionId?Ii.equals(n.description.identifier,i.defaultChatAgent.chatExtensionId):Ua(n.description,"chatParticipantPrivate"),u=c?kn.Internal:{type:"extension",label:n.description.displayName??n.description.name,extensionId:n.description.identifier},p={...r,source:u,inputSchema:r.inputSchema,id:r.name,icon:l,when:r.when?C.deserialize(r.when):void 0,alwaysDisplayInputOutput:!c};try{let h=e.registerToolData(p);this._registrationDisposables.set(pto(n.description.identifier,r.name),h)}catch(h){n.collector.error(`Failed to register tool '${r.name}': ${h}`)}}for(let n of o.removed)for(let r of n.value)this._registrationDisposables.deleteAndDispose(pto(n.description.identifier,r.name))}),P$o.setHandler((t,o)=>{for(let n of o.added){if(!Ua(n.description,"contribLanguageModelToolSets")){n.collector.error(`Extension '${n.description.identifier.value}' CANNOT register language model tools because the 'contribLanguageModelToolSets' API proposal is not enabled.`);continue}let r=i.defaultChatAgent?.chatExtensionId?Ii.equals(n.description.identifier,i.defaultChatAgent.chatExtensionId):Ua(n.description,"chatParticipantPrivate"),s=r?kn.Internal:{type:"extension",label:n.description.displayName??n.description.name,extensionId:n.description.identifier};for(let l of n.value){if(uc(l.name)){n.collector.error(`Tool set '${l.name}' CANNOT have an empty name`);continue}if(l.legacyFullNames&&!Ua(n.description,"contribLanguageModelToolSets")){n.collector.error(`Tool set '${l.name}' CANNOT use 'legacyFullNames' without the 'contribLanguageModelToolSets' API proposal enabled`);continue}if($N(l.tools)){n.collector.error(`Tool set '${l.name}' CANNOT have an empty tools array`);continue}let c=[],u=[],p=[];for(let S of l.tools){let y=e.getToolByName(S);if(y){c.push(y);continue}let w=e.getToolSetByName(S);if(w){u.push(w);continue}p.push(S)}if(u.length===0&&c.length===0){n.collector.error(`Tool set '${l.name}' CANNOT have an empty tools array (none of the tools were found)`);continue}let h=new N,g=l.referenceName??l.name,f=e.getToolSetByName(g),v=r&&f?.source===kn.Internal,b;if(v?b=f:b=e.createToolSet(s,i9e(n.description.identifier,l.name),g,{icon:l.icon?q.fromString(l.icon):void 0,description:l.description,legacyFullNames:l.legacyFullNames}),Gi(S=>{v||h.add(b),c.forEach(y=>h.add(b.addTool(y,S))),u.forEach(y=>h.add(b.addToolSet(y,S)))}),p.length>0){let S=new Set(p),y=h.add(e.onDidChangeTools(()=>{for(let w of S){let k=e.getToolByName(w);if(k)h.add(b.addTool(k)),S.delete(w);else{let T=e.getToolSetByName(w);T&&(h.add(b.addToolSet(T)),S.delete(w))}}S.size===0&&h.delete(y)}))}this._registrationDisposables.set(i9e(n.description.identifier,l.name),h)}}for(let n of o.removed)for(let r of n.value)this._registrationDisposables.deleteAndDispose(i9e(n.description.identifier,r.name))})}static{this.ID="workbench.contrib.toolsExtensionPointHandler"}};oue=I([m(0,tt),m(1,Vn)],oue);var Lhi=class extends x{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.languageModelTools}render(e){let t=e.contributes?.languageModelTools??[];if(!t.length)return{data:{headers:[],rows:[]},dispose:()=>{}};let o=[d(8693,null),d(8692,null),d(8691,null)],n=t.map(r=>[new Ie(`\`${r.name}\``),r.displayName,r.userDescription??r.modelDescription]);return{data:{headers:o,rows:n},dispose:()=>{}}}};ne.as(As.ExtensionFeaturesRegistry).registerExtensionFeature({id:"languageModelTools",label:d(8677,null),access:{canToggle:!1},renderer:new Ft(Lhi)});var Rhi=class extends x{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.languageModelToolSets}render(e){let t=e.contributes?.languageModelToolSets??[];if(!t.length)return{data:{headers:[],rows:[]},dispose:()=>{}};let o=[d(8679,null),d(8681,null),d(8686,null),d(8673,null)],n=t.map(r=>[new Ie(`\`${r.name}\``),r.referenceName?new Ie(`\`#${r.referenceName}\``):"none",r.tools.join(", "),r.description]);return{data:{headers:o,rows:n},dispose:()=>{}}}};ne.as(As.ExtensionFeaturesRegistry).registerExtensionFeature({id:"languageModelToolSets",label:d(8678,null),access:{canToggle:!1},renderer:new Ft(Rhi)});var PLt=class extends x{constructor(e,t,o,n){super();this._languageModelToolsService=t;this._logService=o;this._productService=n;this._tools=this._register(new Vt);this._runningToolCalls=new Map;this._proxy=e.getProxy(to.ExtHostLanguageModelTools),this._register(this._languageModelToolsService.onDidChangeTools(r=>this._proxy.$onDidChangeTools(this.getToolDtos())))}getToolDtos(){return Array.from(this._languageModelToolsService.getAllToolsIncludingDisabled()).map(e=>({id:e.id,displayName:e.displayName,toolReferenceName:e.toolReferenceName,legacyToolReferenceFullNames:e.legacyToolReferenceFullNames,fullReferenceName:e.source.type==="mcp"?this._languageModelToolsService.getFullReferenceName(e):void 0,tags:e.tags,userDescription:e.userDescription,modelDescription:e.modelDescription,inputSchema:e.inputSchema,source:e.source}))}async $getTools(){return this.getToolDtos()}async $invokeTool(e,t){let o=await this._languageModelToolsService.invokeTool($n(e),(r,s)=>this._proxy.$countTokensForInvocation(e.callId,r,s),t??Se.None),n={content:o.content,toolMetadata:o.toolMetadata,toolResultError:o.toolResultError};return Yeo(o)?new ag(n):n}$acceptToolProgress(e,t){this._runningToolCalls.get(e)?.progress.report(t)}$countTokensForInvocation(e,t,o){let n=this._runningToolCalls.get(e);if(!n)throw new Error(`Tool invocation call ${e} not found`);return n.countTokens(t,o)}$registerTool(e,t){let o=this._languageModelToolsService.registerToolImplementation(e,{invoke:async(n,r,s,l)=>{try{this._runningToolCalls.set(n.callId,{countTokens:r,progress:s});let c=await this._proxy.$invokeTool(n,l),u=c instanceof ag?c.value:c;return $n(u)}finally{this._runningToolCalls.delete(n.callId)}},prepareToolInvocation:(n,r)=>this._proxy.$prepareToolInvocation(e,n,r),handleToolStream:t?(n,r)=>this._proxy.$handleToolStream(e,n,r):void 0});this._tools.set(e,o)}$registerToolWithDefinition(e,t,o){let n;if(t.icon)if(q.isThemeIcon(t.icon))n=t.icon;else if(typeof t.icon=="object"&&t.icon!==null&&km(t.icon))n={dark:A.revive(t.icon)};else{let p=t.icon;n={dark:A.revive(p.dark),light:p.light?A.revive(p.light):void 0}}let s=(this._productService.defaultChatAgent?.chatExtensionId?Ii.equals(e,this._productService.defaultChatAgent.chatExtensionId):!1)?kn.Internal:$n(t.source),l={id:t.id,displayName:t.displayName,toolReferenceName:t.toolReferenceName,legacyToolReferenceFullNames:t.legacyToolReferenceFullNames,tags:t.tags,userDescription:t.userDescription,modelDescription:t.modelDescription,inputSchema:t.inputSchema,source:s,icon:n,models:t.models,canBeReferencedInPrompt:!!t.userDescription&&!t.toolSet},c=t.id,u=new N;if(u.add(this._languageModelToolsService.registerTool(l,{invoke:async(p,h,g,f)=>{try{this._runningToolCalls.set(p.callId,{countTokens:h,progress:g});let v=await this._proxy.$invokeTool(p,f),b=v instanceof ag?v.value:v;return $n(b)}finally{this._runningToolCalls.delete(p.callId)}},handleToolStream:o?(p,h)=>this._proxy.$handleToolStream(c,p,h):void 0,prepareToolInvocation:(p,h)=>this._proxy.$prepareToolInvocation(c,p,h)})),t.toolSet){let p=this._languageModelToolsService.getToolSet(i9e(e,t.toolSet))||this._languageModelToolsService.getToolSet(t.toolSet);!p||!(p instanceof oTe)?this._logService.warn(`ToolSet ${t.toolSet} not found for tool ${t.id} from extension ${e.value}`):u.add(p.addTool(l))}this._tools.set(c,u)}$unregisterTool(e){this._tools.deleteAndDispose(e)}};PLt=I([fo(qi.MainThreadLanguageModelTools),m(1,Vn),m(2,se),m(3,tt)],PLt);var hto=le("embeddingsService"),Mhi=class{constructor(){this._onDidChange=new E;this.onDidChange=this._onDidChange.event;this.providers=new Map}get allProviders(){return this.providers.keys()}registerProvider(i,e){return this.providers.set(i,e),this._onDidChange.fire(),{dispose:()=>{this.providers.delete(i),this._onDidChange.fire()}}}computeEmbeddings(i,e,t){let o=this.providers.get(i);return o?o.provideEmbeddings(e,t):Promise.reject(new Error(`No embeddings provider registered with id: ${i}`))}};Ee(hto,Mhi,1);var ALt=class{constructor(i,e){this.embeddingsService=e;this._store=new N;this._providers=this._store.add(new Vt);this._proxy=i.getProxy(to.ExtHostEmbeddings),this._store.add(e.onDidChange((()=>{this._proxy.$acceptEmbeddingModels(Array.from(e.allProviders))})))}dispose(){this._store.dispose()}$registerEmbeddingProvider(i,e){let t=this.embeddingsService.registerProvider(e,{provideEmbeddings:(o,n)=>this._proxy.$provideEmbeddings(i,o,n)});this._providers.set(i,t)}$unregisterEmbeddingProvider(i){this._providers.deleteAndDispose(i)}$computeEmbeddings(i,e,t){return this.embeddingsService.computeEmbeddings(i,e,t)}};ALt=I([fo(qi.MainThreadEmbeddings),m(1,hto)],ALt);var Phi=class{constructor(){this.buffers=[]}add(i){let e=this.buffers.indexOf(i);return e<0&&(e=this.buffers.length,this.buffers.push(i)),e}};function gto(a,i){if(i.serializeBuffersForPostMessage){let e=new Phi,o=JSON.stringify(a,(r,s)=>{if(s instanceof ArrayBuffer)return{$$vscode_array_buffer_reference$$:!0,index:e.add(s)};if(ArrayBuffer.isView(s)){let l=A$o(s);if(l)return{$$vscode_array_buffer_reference$$:!0,index:e.add(s.buffer),view:{type:l,byteLength:s.byteLength,byteOffset:s.byteOffset}}}return s}),n=e.buffers.map(r=>{let s=new Uint8Array(r);return qe.wrap(s)});return{message:o,buffers:n}}else return{message:JSON.stringify(a),buffers:[]}}function A$o(a){switch(a.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 fto(a,i){let e=i.map(n=>{let r=new ArrayBuffer(n.byteLength);return new Uint8Array(r).set(n.buffer),r}),t=i.length?(n,r)=>{if(r&&typeof r=="object"&&r.$$vscode_array_buffer_reference$$){let s=r,{index:l}=s,c=e[l];if(s.view)switch(s.view.type){case 1:return new Int8Array(c,s.view.byteOffset,s.view.byteLength/Int8Array.BYTES_PER_ELEMENT);case 2:return new Uint8Array(c,s.view.byteOffset,s.view.byteLength/Uint8Array.BYTES_PER_ELEMENT);case 3:return new Uint8ClampedArray(c,s.view.byteOffset,s.view.byteLength/Uint8ClampedArray.BYTES_PER_ELEMENT);case 4:return new Int16Array(c,s.view.byteOffset,s.view.byteLength/Int16Array.BYTES_PER_ELEMENT);case 5:return new Uint16Array(c,s.view.byteOffset,s.view.byteLength/Uint16Array.BYTES_PER_ELEMENT);case 6:return new Int32Array(c,s.view.byteOffset,s.view.byteLength/Int32Array.BYTES_PER_ELEMENT);case 7:return new Uint32Array(c,s.view.byteOffset,s.view.byteLength/Uint32Array.BYTES_PER_ELEMENT);case 8:return new Float32Array(c,s.view.byteOffset,s.view.byteLength/Float32Array.BYTES_PER_ELEMENT);case 9:return new Float64Array(c,s.view.byteOffset,s.view.byteLength/Float64Array.BYTES_PER_ELEMENT);case 10:return new BigInt64Array(c,s.view.byteOffset,s.view.byteLength/BigInt64Array.BYTES_PER_ELEMENT);case 11:return new BigUint64Array(c,s.view.byteOffset,s.view.byteLength/BigUint64Array.BYTES_PER_ELEMENT);default:throw new Error("Unknown array buffer view type")}return c}return r}:void 0;return{message:JSON.parse(a,t),arrayBuffers:e}}var oJ=class extends x{constructor(e,t,o){super();this._openerService=t;this._productService=o;this._webviews=new Map;this._proxy=e.getProxy(to.ExtHostWebviews)}static{this.standardSupportedLinkSchemes=new Set([Q.http,Q.https,Q.mailto,Q.vscode,"vscode-insider"])}addWebview(e,t,o){if(this._webviews.has(e))throw new Error("Webview already registered");this._webviews.set(e,t),this.hookupWebviewEventDelegate(e,t,o)}$setHtml(e,t){this.tryGetWebview(e)?.setHtml(t)}$setOptions(e,t){let o=this.tryGetWebview(e);o&&(o.contentOptions=cTe(t))}async $postMessage(e,t,...o){let n=this.tryGetWebview(e);if(!n)return!1;let{message:r,arrayBuffers:s}=fto(t,o);return n.postMessage(r,s)}hookupWebviewEventDelegate(e,t,o){let n=new N;n.add(t.onDidClickLink(r=>this.onDidClickLink(e,r))),n.add(t.onMessage(r=>{let s=gto(r.message,o);this._proxy.$onMessage(e,s.message,new ag(s.buffers))})),n.add(t.onMissingCsp(r=>this._proxy.$onMissingCsp(e,r.value))),n.add(t.onDidDispose(()=>{n.dispose(),this._webviews.delete(e)}))}onDidClickLink(e,t){let o=this.getWebview(e);this.isSupportedLink(o,A.parse(t))&&this._openerService.open(t,{fromUserGesture:!0,allowContributedOpeners:!0,allowCommands:Array.isArray(o.contentOptions.enableCommandUris)||o.contentOptions.enableCommandUris===!0,fromWorkspace:!0})}isSupportedLink(e,t){return oJ.standardSupportedLinkSchemes.has(t.scheme)||!Wt&&this._productService.urlProtocol===t.scheme?!0:t.scheme===Q.command?Array.isArray(e.contentOptions.enableCommandUris)?e.contentOptions.enableCommandUris.includes(t.path):e.contentOptions.enableCommandUris===!0:!1}tryGetWebview(e){return this._webviews.get(e)}getWebview(e){let t=this.tryGetWebview(e);if(!t)throw new Error(`Unknown webview handle:${e}`);return t}getWebviewResolvedFailedContent(e){return`<!DOCTYPE html>
		<html>
			<head>
				<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
				<meta http-equiv="Content-Security-Policy" content="default-src 'none';">
			</head>
			<body>${d(3355,null,mr(e))}</body>
		</html>`}};oJ=I([m(1,Je),m(2,tt)],oJ);function nue(a){return{id:a.id,location:A.revive(a.location)}}function cTe(a){return{allowScripts:a.enableScripts,allowForms:a.enableForms,enableCommandUris:a.enableCommandUris,localResourceRoots:Array.isArray(a.localResourceRoots)?a.localResourceRoots.map(i=>A.revive(i)):void 0,portMapping:a.portMapping}}var Al=class a{constructor(i,e){this.storageService=e;this.id=a.COMMON_PREFIX+i}static{this.applicationMementos=new Map}static{this.profileMementos=new Map}static{this.workspaceMementos=new Map}static{this.COMMON_PREFIX="memento/"}getMemento(i,e){switch(i){case 1:{let t=a.workspaceMementos.get(this.id);return t||(t=new o9e(this.id,i,e,this.storageService),a.workspaceMementos.set(this.id,t)),t.getMemento()}case 0:{let t=a.profileMementos.get(this.id);return t||(t=new o9e(this.id,i,e,this.storageService),a.profileMementos.set(this.id,t)),t.getMemento()}case-1:{let t=a.applicationMementos.get(this.id);return t||(t=new o9e(this.id,i,e,this.storageService),a.applicationMementos.set(this.id,t)),t.getMemento()}}}onDidChangeValue(i,e){return this.storageService.onDidChangeValue(i,this.id,e)}saveMemento(){a.workspaceMementos.get(this.id)?.save(),a.profileMementos.get(this.id)?.save(),a.applicationMementos.get(this.id)?.save()}reloadMemento(i){let e;switch(i){case-1:e=a.applicationMementos.get(this.id);break;case 0:e=a.profileMementos.get(this.id);break;case 1:e=a.workspaceMementos.get(this.id);break}e?.reload()}static clear(i){switch(i){case 1:a.workspaceMementos.clear();break;case 0:a.profileMementos.clear();break;case-1:a.applicationMementos.clear();break}}},o9e=class{constructor(i,e,t,o){this.id=i;this.scope=e;this.target=t;this.storageService=o;this.mementoObj=this.doLoad()}doLoad(){try{return this.storageService.getObject(this.id,this.scope,{})}catch(i){mt(`[memento]: failed to parse contents: ${i} (id: ${this.id}, scope: ${this.scope}, contents: ${this.storageService.get(this.id,this.scope)})`)}return{}}getMemento(){return this.mementoObj}reload(){for(let i of Object.getOwnPropertyNames(this.mementoObj))delete this.mementoObj[i];Object.assign(this.mementoObj,this.doLoad())}save(){Of(this.mementoObj)?this.storageService.remove(this.id,this.scope):this.storageService.store(this.id,this.mementoObj,this.scope,this.target)}};var NLt=new Y("webviewFindWidgetVisible",!1),FK=new Y("webviewFindWidgetFocused",!1),OLt=new Y("webviewFindWidgetEnabled",!1),cp=le("webviewService");function vto(a,i){return a.allowMultipleAPIAcquire===i.allowMultipleAPIAcquire&&a.allowScripts===i.allowScripts&&a.allowForms===i.allowForms&&$i(a.localResourceRoots,i.localResourceRoots,Qe)&&$i(a.portMapping,i.portMapping,(e,t)=>e.extensionHostPort===t.extensionHostPort&&e.webviewPort===t.webviewPort)&&N$o(a,i)}function N$o(a,i){return a.enableCommandUris===i.enableCommandUris?!0:Array.isArray(a.enableCommandUris)&&Array.isArray(i.enableCommandUris)?$i(a.enableCommandUris,i.enableCommandUris):!1}var g4=class{constructor(i,e){this._memento=new Al(i,e),this._state=this._memento.getMemento(-1,1)}getOrigin(i,e){let t=this._getKey(i,e),o=this._state[t];if(o&&typeof o=="string")return o;let n=xt();return this._state[t]=n,this._memento.saveMemento(),n}_getKey(i,e){return JSON.stringify({viewType:i,key:e})}};g4=I([m(1,ce)],g4);var OK=class{constructor(i,e){this._store=new g4(i,e)}getOrigin(i,e){return this._store.getOrigin(i,e.value)}};OK=I([m(1,ce)],OK);var Ahi=class{constructor(i,e,t,o){this.editor=i;this.line=e;this.height=t;this.webview=o;this.domNode=document.createElement("div"),this.domNode.style.zIndex="10",this.afterLineNumber=e,this.afterColumn=1,this.heightInLines=t,i.changeViewZones(n=>this._id=n.addZone(this)),o.mountTo(this.domNode,Re(i.getDomNode()))}dispose(){this.editor.changeViewZones(i=>this._id&&i.removeZone(this._id))}},FLt=class{constructor(i,e,t){this._editorService=e;this._webviewService=t;this._disposables=new N;this._insets=new Map;this._proxy=i.getProxy(to.ExtHostEditorInsets)}dispose(){this._disposables.dispose()}async $createEditorInset(i,e,t,o,n,r,s,l){let c;e=e.substr(0,e.indexOf(","));for(let f of this._editorService.listCodeEditors())if(f.getId()===e&&f.hasModel()&&Qe(f.getModel().uri,A.revive(t))){c=f;break}if(!c){setTimeout(()=>this._proxy.$onDidDispose(i));return}let u=new N,p=this._webviewService.createWebviewElement({title:void 0,options:{enableFindWidget:!1},contentOptions:cTe(r),extension:{id:s,location:A.revive(l)}}),h=new Ahi(c,o,n,p),g=()=>{u.dispose(),this._proxy.$onDidDispose(i),this._insets.delete(i)};u.add(c.onDidChangeModel(g)),u.add(c.onDidDispose(g)),u.add(h),u.add(p),u.add(p.onMessage(f=>this._proxy.$onDidReceiveMessage(i,f.message))),this._insets.set(i,h)}$disposeEditorInset(i){let e=this.getInset(i);this._insets.delete(i),e.dispose()}$setHtml(i,e){this.getInset(i).webview.setHtml(e)}$setOptions(i,e){let t=this.getInset(i);t.webview.contentOptions=cTe(e)}async $postMessage(i,e){return this.getInset(i).webview.postMessage(e),!0}getInset(i){let e=this._insets.get(i);if(!e)throw new Error("Unknown inset");return e}};FLt=I([fo(qi.MainThreadEditorInsets),m(1,qt),m(2,cp)],FLt);var WLt={},Hd={exports:WLt};(function(a,i){if(typeof WLt=="object"&&typeof Hd=="object")Hd.exports=i();else if(typeof define=="function"&&define.amd)define([],i);else{var e=i();for(var t in e)(typeof WLt=="object"?WLt:a)[t]=e[t]}})(typeof self<"u"?self:void 0,(function(){return(function(a){var i={};function e(t){if(i[t])return i[t].exports;var o=i[t]={i:t,l:!1,exports:{}};return a[t].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=a,e.c=i,e.d=function(t,o,n){e.o(t,o)||Object.defineProperty(t,o,{enumerable:!0,get:n})},e.r=function(t){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,o){if(1&o&&(t=e(t)),8&o||4&o&&typeof t=="object"&&t&&t.__esModule)return t;var n=Object.create(null);if(e.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&o&&typeof t!="string")for(var r in t)e.d(n,r,function(s){return t[s]}.bind(null,r));return n},e.n=function(t){var o=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(o,"a",o),o},e.o=function(t,o){return Object.prototype.hasOwnProperty.call(t,o)},e.p="",e(e.s=0)})([function(a,i,e){(function(t){var o;i=a.exports=Mr,o=typeof t=="object"&&t.env&&t.env.NODE_DEBUG&&/\bsemver\b/i.test(t.env.NODE_DEBUG)?function(){var jt=Array.prototype.slice.call(arguments,0);jt.unshift("SEMVER"),console.log.apply(console,jt)}:function(){},i.SEMVER_SPEC_VERSION="2.0.0";var n=256,r=Number.MAX_SAFE_INTEGER||9007199254740991,s=i.re=[],l=i.src=[],c=0,u=c++;l[u]="0|[1-9]\\d*";var p=c++;l[p]="[0-9]+";var h=c++;l[h]="\\d*[a-zA-Z-][a-zA-Z0-9-]*";var g=c++;l[g]="("+l[u]+")\\.("+l[u]+")\\.("+l[u]+")";var f=c++;l[f]="("+l[p]+")\\.("+l[p]+")\\.("+l[p]+")";var v=c++;l[v]="(?:"+l[u]+"|"+l[h]+")";var b=c++;l[b]="(?:"+l[p]+"|"+l[h]+")";var S=c++;l[S]="(?:-("+l[v]+"(?:\\."+l[v]+")*))";var y=c++;l[y]="(?:-?("+l[b]+"(?:\\."+l[b]+")*))";var w=c++;l[w]="[0-9A-Za-z-]+";var k=c++;l[k]="(?:\\+("+l[w]+"(?:\\."+l[w]+")*))";var T=c++,P="v?"+l[g]+l[S]+"?"+l[k]+"?";l[T]="^"+P+"$";var O="[v=\\s]*"+l[f]+l[y]+"?"+l[k]+"?",V=c++;l[V]="^"+O+"$";var H=c++;l[H]="((?:<|>)?=?)";var G=c++;l[G]=l[p]+"|x|X|\\*";var $=c++;l[$]=l[u]+"|x|X|\\*";var J=c++;l[J]="[v=\\s]*("+l[$]+")(?:\\.("+l[$]+")(?:\\.("+l[$]+")(?:"+l[S]+")?"+l[k]+"?)?)?";var ae=c++;l[ae]="[v=\\s]*("+l[G]+")(?:\\.("+l[G]+")(?:\\.("+l[G]+")(?:"+l[y]+")?"+l[k]+"?)?)?";var he=c++;l[he]="^"+l[H]+"\\s*"+l[J]+"$";var oe=c++;l[oe]="^"+l[H]+"\\s*"+l[ae]+"$";var de=c++;l[de]="(?:^|[^\\d])(\\d{1,16})(?:\\.(\\d{1,16}))?(?:\\.(\\d{1,16}))?(?:$|[^\\d])";var Ce=c++;l[Ce]="(?:~>?)";var xe=c++;l[xe]="(\\s*)"+l[Ce]+"\\s+",s[xe]=new RegExp(l[xe],"g");var ze=c++;l[ze]="^"+l[Ce]+l[J]+"$";var De=c++;l[De]="^"+l[Ce]+l[ae]+"$";var Oe=c++;l[Oe]="(?:\\^)";var pt=c++;l[pt]="(\\s*)"+l[Oe]+"\\s+",s[pt]=new RegExp(l[pt],"g");var et=c++;l[et]="^"+l[Oe]+l[J]+"$";var Ti=c++;l[Ti]="^"+l[Oe]+l[ae]+"$";var Ht=c++;l[Ht]="^"+l[H]+"\\s*("+O+")$|^$";var zi=c++;l[zi]="^"+l[H]+"\\s*("+P+")$|^$";var Vo=c++;l[Vo]="(\\s*)"+l[H]+"\\s*("+O+"|"+l[J]+")",s[Vo]=new RegExp(l[Vo],"g");var sn=c++;l[sn]="^\\s*("+l[J]+")\\s+-\\s+("+l[J]+")\\s*$";var _n=c++;l[_n]="^\\s*("+l[ae]+")\\s+-\\s+("+l[ae]+")\\s*$";var mn=c++;l[mn]="(<|>)?=?\\s*\\*";for(var hn=0;hn<35;hn++)o(hn,l[hn]),s[hn]||(s[hn]=new RegExp(l[hn]));function yo(jt,Mi){if(jt instanceof Mr)return jt;if(typeof jt!="string"||jt.length>n||!(Mi?s[V]:s[T]).test(jt))return null;try{return new Mr(jt,Mi)}catch{return null}}function Mr(jt,Mi){if(jt instanceof Mr){if(jt.loose===Mi)return jt;jt=jt.version}else if(typeof jt!="string")throw new TypeError("Invalid Version: "+jt);if(jt.length>n)throw new TypeError("version is longer than "+n+" characters");if(!(this instanceof Mr))return new Mr(jt,Mi);o("SemVer",jt,Mi),this.loose=Mi;var no=jt.trim().match(Mi?s[V]:s[T]);if(!no)throw new TypeError("Invalid Version: "+jt);if(this.raw=jt,this.major=+no[1],this.minor=+no[2],this.patch=+no[3],this.major>r||this.major<0)throw new TypeError("Invalid major version");if(this.minor>r||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>r||this.patch<0)throw new TypeError("Invalid patch version");no[4]?this.prerelease=no[4].split(".").map((function(Kr){if(/^[0-9]+$/.test(Kr)){var Ia=+Kr;if(Ia>=0&&Ia<r)return Ia}return Kr})):this.prerelease=[],this.build=no[5]?no[5].split("."):[],this.format()}i.parse=yo,i.valid=function(jt,Mi){var no=yo(jt,Mi);return no?no.version:null},i.clean=function(jt,Mi){var no=yo(jt.trim().replace(/^[=v]+/,""),Mi);return no?no.version:null},i.SemVer=Mr,Mr.prototype.format=function(){return this.version=this.major+"."+this.minor+"."+this.patch,this.prerelease.length&&(this.version+="-"+this.prerelease.join(".")),this.version},Mr.prototype.toString=function(){return this.version},Mr.prototype.compare=function(jt){return o("SemVer.compare",this.version,this.loose,jt),jt instanceof Mr||(jt=new Mr(jt,this.loose)),this.compareMain(jt)||this.comparePre(jt)},Mr.prototype.compareMain=function(jt){return jt instanceof Mr||(jt=new Mr(jt,this.loose)),er(this.major,jt.major)||er(this.minor,jt.minor)||er(this.patch,jt.patch)},Mr.prototype.comparePre=function(jt){if(jt instanceof Mr||(jt=new Mr(jt,this.loose)),this.prerelease.length&&!jt.prerelease.length)return-1;if(!this.prerelease.length&&jt.prerelease.length)return 1;if(!this.prerelease.length&&!jt.prerelease.length)return 0;var Mi=0;do{var no=this.prerelease[Mi],Kr=jt.prerelease[Mi];if(o("prerelease compare",Mi,no,Kr),no===void 0&&Kr===void 0)return 0;if(Kr===void 0)return 1;if(no===void 0)return-1;if(no!==Kr)return er(no,Kr)}while(++Mi)},Mr.prototype.inc=function(jt,Mi){switch(jt){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",Mi);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",Mi);break;case"prepatch":this.prerelease.length=0,this.inc("patch",Mi),this.inc("pre",Mi);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",Mi),this.inc("pre",Mi);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 no=this.prerelease.length;--no>=0;)typeof this.prerelease[no]=="number"&&(this.prerelease[no]++,no=-2);no===-1&&this.prerelease.push(0)}Mi&&(this.prerelease[0]===Mi?isNaN(this.prerelease[1])&&(this.prerelease=[Mi,0]):this.prerelease=[Mi,0]);break;default:throw new Error("invalid increment argument: "+jt)}return this.format(),this.raw=this.version,this},i.inc=function(jt,Mi,no,Kr){typeof no=="string"&&(Kr=no,no=void 0);try{return new Mr(jt,no).inc(Mi,Kr).version}catch{return null}},i.diff=function(jt,Mi){if(tm(jt,Mi))return null;var no=yo(jt),Kr=yo(Mi);if(no.prerelease.length||Kr.prerelease.length){for(var Ia in no)if((Ia==="major"||Ia==="minor"||Ia==="patch")&&no[Ia]!==Kr[Ia])return"pre"+Ia;return"prerelease"}for(var Ia in no)if((Ia==="major"||Ia==="minor"||Ia==="patch")&&no[Ia]!==Kr[Ia])return Ia},i.compareIdentifiers=er;var cn=/^[0-9]+$/;function er(jt,Mi){var no=cn.test(jt),Kr=cn.test(Mi);return no&&Kr&&(jt=+jt,Mi=+Mi),no&&!Kr?-1:Kr&&!no?1:jt<Mi?-1:jt>Mi?1:0}function Ns(jt,Mi,no){return new Mr(jt,no).compare(new Mr(Mi,no))}function ua(jt,Mi,no){return Ns(jt,Mi,no)>0}function xm(jt,Mi,no){return Ns(jt,Mi,no)<0}function tm(jt,Mi,no){return Ns(jt,Mi,no)===0}function Lu(jt,Mi,no){return Ns(jt,Mi,no)!==0}function jg(jt,Mi,no){return Ns(jt,Mi,no)>=0}function Ir(jt,Mi,no){return Ns(jt,Mi,no)<=0}function Lx(jt,Mi,no,Kr){var Ia;switch(Mi){case"===":typeof jt=="object"&&(jt=jt.version),typeof no=="object"&&(no=no.version),Ia=jt===no;break;case"!==":typeof jt=="object"&&(jt=jt.version),typeof no=="object"&&(no=no.version),Ia=jt!==no;break;case"":case"=":case"==":Ia=tm(jt,no,Kr);break;case"!=":Ia=Lu(jt,no,Kr);break;case">":Ia=ua(jt,no,Kr);break;case">=":Ia=jg(jt,no,Kr);break;case"<":Ia=xm(jt,no,Kr);break;case"<=":Ia=Ir(jt,no,Kr);break;default:throw new TypeError("Invalid operator: "+Mi)}return Ia}function Qg(jt,Mi){if(jt instanceof Qg){if(jt.loose===Mi)return jt;jt=jt.value}if(!(this instanceof Qg))return new Qg(jt,Mi);o("comparator",jt,Mi),this.loose=Mi,this.parse(jt),this.semver===lC?this.value="":this.value=this.operator+this.semver.version,o("comp",this)}i.rcompareIdentifiers=function(jt,Mi){return er(Mi,jt)},i.major=function(jt,Mi){return new Mr(jt,Mi).major},i.minor=function(jt,Mi){return new Mr(jt,Mi).minor},i.patch=function(jt,Mi){return new Mr(jt,Mi).patch},i.compare=Ns,i.compareLoose=function(jt,Mi){return Ns(jt,Mi,!0)},i.rcompare=function(jt,Mi,no){return Ns(Mi,jt,no)},i.sort=function(jt,Mi){return jt.sort((function(no,Kr){return i.compare(no,Kr,Mi)}))},i.rsort=function(jt,Mi){return jt.sort((function(no,Kr){return i.rcompare(no,Kr,Mi)}))},i.gt=ua,i.lt=xm,i.eq=tm,i.neq=Lu,i.gte=jg,i.lte=Ir,i.cmp=Lx,i.Comparator=Qg;var lC={};function Op(jt,Mi){if(jt instanceof Op)return jt.loose===Mi?jt:new Op(jt.raw,Mi);if(jt instanceof Qg)return new Op(jt.value,Mi);if(!(this instanceof Op))return new Op(jt,Mi);if(this.loose=Mi,this.raw=jt,this.set=jt.split(/\s*\|\|\s*/).map((function(no){return this.parseRange(no.trim())}),this).filter((function(no){return no.length})),!this.set.length)throw new TypeError("Invalid SemVer Range: "+jt);this.format()}function Af(jt){return!jt||jt.toLowerCase()==="x"||jt==="*"}function h$(jt,Mi,no,Kr,Ia,Yg,Co,on,Nt,je,we,Ke,Lt){return((Mi=Af(no)?"":Af(Kr)?">="+no+".0.0":Af(Ia)?">="+no+"."+Kr+".0":">="+Mi)+" "+(on=Af(Nt)?"":Af(je)?"<"+(+Nt+1)+".0.0":Af(we)?"<"+Nt+"."+(+je+1)+".0":Ke?"<="+Nt+"."+je+"."+we+"-"+Ke:"<="+on)).trim()}function C9(jt,Mi){for(var no=0;no<jt.length;no++)if(!jt[no].test(Mi))return!1;if(Mi.prerelease.length){for(no=0;no<jt.length;no++)if(o(jt[no].semver),jt[no].semver!==lC&&jt[no].semver.prerelease.length>0){var Kr=jt[no].semver;if(Kr.major===Mi.major&&Kr.minor===Mi.minor&&Kr.patch===Mi.patch)return!0}return!1}return!0}function Rx(jt,Mi,no){try{Mi=new Op(Mi,no)}catch{return!1}return Mi.test(jt)}function LI(jt,Mi,no,Kr){var Ia,Yg,Co,on,Nt;switch(jt=new Mr(jt,Kr),Mi=new Op(Mi,Kr),no){case">":Ia=ua,Yg=Ir,Co=xm,on=">",Nt=">=";break;case"<":Ia=xm,Yg=jg,Co=ua,on="<",Nt="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(Rx(jt,Mi,Kr))return!1;for(var je=0;je<Mi.set.length;++je){var we=Mi.set[je],Ke=null,Lt=null;if(we.forEach((function(Gt){Gt.semver===lC&&(Gt=new Qg(">=0.0.0")),Ke=Ke||Gt,Lt=Lt||Gt,Ia(Gt.semver,Ke.semver,Kr)?Ke=Gt:Co(Gt.semver,Lt.semver,Kr)&&(Lt=Gt)})),Ke.operator===on||Ke.operator===Nt||(!Lt.operator||Lt.operator===on)&&Yg(jt,Lt.semver)||Lt.operator===Nt&&Co(jt,Lt.semver))return!1}return!0}Qg.prototype.parse=function(jt){var Mi=this.loose?s[Ht]:s[zi],no=jt.match(Mi);if(!no)throw new TypeError("Invalid comparator: "+jt);this.operator=no[1],this.operator==="="&&(this.operator=""),no[2]?this.semver=new Mr(no[2],this.loose):this.semver=lC},Qg.prototype.toString=function(){return this.value},Qg.prototype.test=function(jt){return o("Comparator.test",jt,this.loose),this.semver===lC||(typeof jt=="string"&&(jt=new Mr(jt,this.loose)),Lx(jt,this.operator,this.semver,this.loose))},Qg.prototype.intersects=function(jt,Mi){if(!(jt instanceof Qg))throw new TypeError("a Comparator is required");var no;if(this.operator==="")return no=new Op(jt.value,Mi),Rx(this.value,no,Mi);if(jt.operator==="")return no=new Op(this.value,Mi),Rx(jt.semver,no,Mi);var Kr=!(this.operator!==">="&&this.operator!==">"||jt.operator!==">="&&jt.operator!==">"),Ia=!(this.operator!=="<="&&this.operator!=="<"||jt.operator!=="<="&&jt.operator!=="<"),Yg=this.semver.version===jt.semver.version,Co=!(this.operator!==">="&&this.operator!=="<="||jt.operator!==">="&&jt.operator!=="<="),on=Lx(this.semver,"<",jt.semver,Mi)&&(this.operator===">="||this.operator===">")&&(jt.operator==="<="||jt.operator==="<"),Nt=Lx(this.semver,">",jt.semver,Mi)&&(this.operator==="<="||this.operator==="<")&&(jt.operator===">="||jt.operator===">");return Kr||Ia||Yg&&Co||on||Nt},i.Range=Op,Op.prototype.format=function(){return this.range=this.set.map((function(jt){return jt.join(" ").trim()})).join("||").trim(),this.range},Op.prototype.toString=function(){return this.range},Op.prototype.parseRange=function(jt){var Mi=this.loose;jt=jt.trim(),o("range",jt,Mi);var no=Mi?s[_n]:s[sn];jt=jt.replace(no,h$),o("hyphen replace",jt),jt=jt.replace(s[Vo],"$1$2$3"),o("comparator trim",jt,s[Vo]),jt=(jt=(jt=jt.replace(s[xe],"$1~")).replace(s[pt],"$1^")).split(/\s+/).join(" ");var Kr=Mi?s[Ht]:s[zi],Ia=jt.split(" ").map((function(Yg){return(function(Co,on){return o("comp",Co),Co=(function(Nt,je){return Nt.trim().split(/\s+/).map((function(we){return(function(Ke,Lt){o("caret",Ke,Lt);var Gt=Lt?s[Ti]:s[et];return Ke.replace(Gt,(function(Ro,so,Pr,Is,Qr){var Ta;return o("caret",Ke,Ro,so,Pr,Is,Qr),Af(so)?Ta="":Af(Pr)?Ta=">="+so+".0.0 <"+(+so+1)+".0.0":Af(Is)?Ta=so==="0"?">="+so+"."+Pr+".0 <"+so+"."+(+Pr+1)+".0":">="+so+"."+Pr+".0 <"+(+so+1)+".0.0":Qr?(o("replaceCaret pr",Qr),Qr.charAt(0)!=="-"&&(Qr="-"+Qr),Ta=so==="0"?Pr==="0"?">="+so+"."+Pr+"."+Is+Qr+" <"+so+"."+Pr+"."+(+Is+1):">="+so+"."+Pr+"."+Is+Qr+" <"+so+"."+(+Pr+1)+".0":">="+so+"."+Pr+"."+Is+Qr+" <"+(+so+1)+".0.0"):(o("no pr"),Ta=so==="0"?Pr==="0"?">="+so+"."+Pr+"."+Is+" <"+so+"."+Pr+"."+(+Is+1):">="+so+"."+Pr+"."+Is+" <"+so+"."+(+Pr+1)+".0":">="+so+"."+Pr+"."+Is+" <"+(+so+1)+".0.0"),o("caret return",Ta),Ta}))})(we,je)})).join(" ")})(Co,on),o("caret",Co),Co=(function(Nt,je){return Nt.trim().split(/\s+/).map((function(we){return(function(Ke,Lt){var Gt=Lt?s[De]:s[ze];return Ke.replace(Gt,(function(Ro,so,Pr,Is,Qr){var Ta;return o("tilde",Ke,Ro,so,Pr,Is,Qr),Af(so)?Ta="":Af(Pr)?Ta=">="+so+".0.0 <"+(+so+1)+".0.0":Af(Is)?Ta=">="+so+"."+Pr+".0 <"+so+"."+(+Pr+1)+".0":Qr?(o("replaceTilde pr",Qr),Qr.charAt(0)!=="-"&&(Qr="-"+Qr),Ta=">="+so+"."+Pr+"."+Is+Qr+" <"+so+"."+(+Pr+1)+".0"):Ta=">="+so+"."+Pr+"."+Is+" <"+so+"."+(+Pr+1)+".0",o("tilde return",Ta),Ta}))})(we,je)})).join(" ")})(Co,on),o("tildes",Co),Co=(function(Nt,je){return o("replaceXRanges",Nt,je),Nt.split(/\s+/).map((function(we){return(function(Ke,Lt){Ke=Ke.trim();var Gt=Lt?s[oe]:s[he];return Ke.replace(Gt,(function(Ro,so,Pr,Is,Qr,Ta){o("xRange",Ke,Ro,so,Pr,Is,Qr,Ta);var Hr=Af(Pr),ll=Hr||Af(Is),Ao=ll||Af(Qr);return so==="="&&Ao&&(so=""),Hr?Ro=so===">"||so==="<"?"<0.0.0":"*":so&&Ao?(ll&&(Is=0),Ao&&(Qr=0),so===">"?(so=">=",ll?(Pr=+Pr+1,Is=0,Qr=0):Ao&&(Is=+Is+1,Qr=0)):so==="<="&&(so="<",ll?Pr=+Pr+1:Is=+Is+1),Ro=so+Pr+"."+Is+"."+Qr):ll?Ro=">="+Pr+".0.0 <"+(+Pr+1)+".0.0":Ao&&(Ro=">="+Pr+"."+Is+".0 <"+Pr+"."+(+Is+1)+".0"),o("xRange return",Ro),Ro}))})(we,je)})).join(" ")})(Co,on),o("xrange",Co),Co=(function(Nt,je){return o("replaceStars",Nt,je),Nt.trim().replace(s[mn],"")})(Co,on),o("stars",Co),Co})(Yg,Mi)})).join(" ").split(/\s+/);return this.loose&&(Ia=Ia.filter((function(Yg){return!!Yg.match(Kr)}))),Ia=Ia.map((function(Yg){return new Qg(Yg,Mi)}))},Op.prototype.intersects=function(jt,Mi){if(!(jt instanceof Op))throw new TypeError("a Range is required");return this.set.some((function(no){return no.every((function(Kr){return jt.set.some((function(Ia){return Ia.every((function(Yg){return Kr.intersects(Yg,Mi)}))}))}))}))},i.toComparators=function(jt,Mi){return new Op(jt,Mi).set.map((function(no){return no.map((function(Kr){return Kr.value})).join(" ").trim().split(" ")}))},Op.prototype.test=function(jt){if(!jt)return!1;typeof jt=="string"&&(jt=new Mr(jt,this.loose));for(var Mi=0;Mi<this.set.length;Mi++)if(C9(this.set[Mi],jt))return!0;return!1},i.satisfies=Rx,i.maxSatisfying=function(jt,Mi,no){var Kr=null,Ia=null;try{var Yg=new Op(Mi,no)}catch{return null}return jt.forEach((function(Co){Yg.test(Co)&&(Kr&&Ia.compare(Co)!==-1||(Ia=new Mr(Kr=Co,no)))})),Kr},i.minSatisfying=function(jt,Mi,no){var Kr=null,Ia=null;try{var Yg=new Op(Mi,no)}catch{return null}return jt.forEach((function(Co){Yg.test(Co)&&(Kr&&Ia.compare(Co)!==1||(Ia=new Mr(Kr=Co,no)))})),Kr},i.validRange=function(jt,Mi){try{return new Op(jt,Mi).range||"*"}catch{return null}},i.ltr=function(jt,Mi,no){return LI(jt,Mi,"<",no)},i.gtr=function(jt,Mi,no){return LI(jt,Mi,">",no)},i.outside=LI,i.prerelease=function(jt,Mi){var no=yo(jt,Mi);return no&&no.prerelease.length?no.prerelease:null},i.intersects=function(jt,Mi,no){return jt=new Op(jt,no),Mi=new Op(Mi,no),jt.intersects(Mi)},i.coerce=function(jt){if(jt instanceof Mr)return jt;if(typeof jt!="string")return null;var Mi=jt.match(s[de]);return Mi==null?null:yo((Mi[1]||"0")+"."+(Mi[2]||"0")+"."+(Mi[3]||"0"))}}).call(this,e(1))},function(a,i){var e,t,o=a.exports={};function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function s(b){if(e===setTimeout)return setTimeout(b,0);if((e===n||!e)&&setTimeout)return e=setTimeout,setTimeout(b,0);try{return e(b,0)}catch{try{return e.call(null,b,0)}catch{return e.call(this,b,0)}}}(function(){try{e=typeof setTimeout=="function"?setTimeout:n}catch{e=n}try{t=typeof clearTimeout=="function"?clearTimeout:r}catch{t=r}})();var l,c=[],u=!1,p=-1;function h(){u&&l&&(u=!1,l.length?c=l.concat(c):p=-1,c.length&&g())}function g(){if(!u){var b=s(h);u=!0;for(var S=c.length;S;){for(l=c,c=[];++p<S;)l&&l[p].run();p=-1,S=c.length}l=null,u=!1,(function(y){if(t===clearTimeout)return clearTimeout(y);if((t===r||!t)&&clearTimeout)return t=clearTimeout,clearTimeout(y);try{t(y)}catch{try{return t.call(null,y)}catch{return t.call(this,y)}}})(b)}}function f(b,S){this.fun=b,this.array=S}function v(){}o.nextTick=function(b){var S=new Array(arguments.length-1);if(arguments.length>1)for(var y=1;y<arguments.length;y++)S[y-1]=arguments[y];c.push(new f(b,S)),c.length!==1||u||s(g)},f.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=v,o.addListener=v,o.once=v,o.off=v,o.removeListener=v,o.removeAllListeners=v,o.emit=v,o.prependListener=v,o.prependOnceListener=v,o.listeners=function(b){return[]},o.binding=function(b){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(b){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}}])}));var Jya=Hd.exports.SEMVER_SPEC_VERSION,Zya=Hd.exports.parse,dTe=Hd.exports.valid,bto=Hd.exports.coerce,ewa=Hd.exports.clean,twa=Hd.exports.inc,iwa=Hd.exports.major,owa=Hd.exports.minor,nwa=Hd.exports.patch,rwa=Hd.exports.prerelease,zR=Hd.exports.gt,VLt=Hd.exports.gte,swa=Hd.exports.lt,Sto=Hd.exports.lte,BLt=Hd.exports.eq,awa=Hd.exports.neq,lwa=Hd.exports.cmp,cwa=Hd.exports.compare,dwa=Hd.exports.rcompare,uwa=Hd.exports.compareIdentifiers,pwa=Hd.exports.rcompareIdentifiers,mwa=Hd.exports.compareBuild,hwa=Hd.exports.sort,gwa=Hd.exports.rsort,fwa=Hd.exports.diff,vwa=Hd.exports.validRange,n9e=Hd.exports.satisfies,bwa=Hd.exports.maxSatisfying,Swa=Hd.exports.minSatisfying,Iwa=Hd.exports.minVersion,ywa=Hd.exports.gtr,wwa=Hd.exports.ltr,Cwa=Hd.exports.outside,xwa=Hd.exports.intersects,kwa=Hd.exports.SemVer,Ewa=Hd.exports.Comparator,Twa=Hd.exports.Range;var O$o=a=>d(2068,null,a),Ito=d(2081,null,"ms-dotnettools.csharp"),uTe=class{constructor(i,e,t,o,n){this.extensionsForceVersionByQuality=i;this.logger=e;this.extensionManagementService=t;this.extensionGalleryService=o;this.productService=n;this.extensionsForceVersionByQuality=this.extensionsForceVersionByQuality.map(r=>r.toLowerCase())}get location(){}async listExtensions(i,e,t){let o=await this.extensionManagementService.getInstalled(1,t),n=cF.map(s=>s.toLowerCase());if(e&&e!==""){if(n.indexOf(e.toLowerCase())<0){this.logger.info("Invalid category please enter a valid category. To list valid categories run --category without a category specified");return}o=o.filter(s=>s.manifest.categories?s.manifest.categories.map(c=>c.toLowerCase()).indexOf(e.toLowerCase())>-1:!1)}else if(e===""){this.logger.info("Possible Categories: "),n.forEach(s=>{this.logger.info(s)});return}this.location&&this.logger.info(d(2067,null,this.location)),o=o.sort((s,l)=>s.identifier.id.localeCompare(l.identifier.id));let r;for(let s of o)r!==s.identifier.id&&(r=s.identifier.id,this.logger.info(i?`${r}@${s.manifest.version}`:r))}async installExtensions(i,e,t,o){let n=[];try{i.length&&this.logger.info(this.location?d(2066,null,this.location):d(2065,null));let r=[],s=[],l=(u,p,h)=>{this.extensionsForceVersionByQuality?.some(g=>g===u.toLowerCase())&&(p=this.productService.quality!=="stable"?"prerelease":void 0),s.push({id:u,version:p!=="prerelease"?p:void 0,installOptions:{...t,isBuiltin:h,installPreReleaseVersion:p==="prerelease"||t.installPreReleaseVersion}})};for(let u of i)if(u instanceof A)r.push({vsix:u,installOptions:t});else{let[p,h]=kQe(u);l(p,h,!1)}for(let u of e)if(u instanceof A)r.push({vsix:u,installOptions:{...t,isBuiltin:!0,donotIncludePackAndDependencies:!0}});else{let[p,h]=kQe(u);l(p,h,!0)}let c=await this.extensionManagementService.getInstalled(void 0,t.profileLocation);if(r.length&&await Promise.all(r.map(async({vsix:u,installOptions:p})=>{try{await this.installVSIX(u,p,o,c)}catch(h){this.logger.error(h),n.push(u.toString())}})),s.length){let u=await this.installGalleryExtensions(s,c,o);n.push(...u)}}catch(r){throw this.logger.error(d(2055,null,Pn(r))),r}if(n.length)throw new Error(d(2060,null,n.join(", ")))}async updateExtensions(i){let e=await this.extensionManagementService.getInstalled(1,i),t=[];for(let s of e)s.identifier.uuid&&t.push({...s.identifier,preRelease:s.preRelease});this.logger.trace(d(2079,null,t.length));let o=await this.extensionGalleryService.getExtensions(t,{compatible:!0},Se.None),n=[];for(let s of o)for(let l of e)Ut(l.identifier,s.identifier)&&zR(s.version,l.manifest.version)&&n.push({extension:s,options:{operation:3,installPreReleaseVersion:l.preRelease,profileLocation:i,isApplicationScoped:l.isApplicationScoped}});if(!n.length){this.logger.info(d(2078,null));return}this.logger.info(d(2077,null,n.map(s=>s.extension.identifier.id).join(", ")));let r=await this.extensionManagementService.installGalleryExtensions(n);for(let s of r)s.error?this.logger.error(d(2057,null,s.identifier.id,Pn(s.error))):this.logger.info(d(2074,null,s.identifier.id,s.local?.manifest.version))}async installGalleryExtensions(i,e,t){if(i=i.filter(s=>{let{id:l,version:c,installOptions:u}=s,p=e.find(h=>Ut(h.identifier,{id:l}));if(p){if(!t&&(!c||c==="prerelease"&&p.preRelease))return this.logger.info(d(2052,null,l,p.manifest.version,l)),!1;if(c&&p.manifest.version===c)return this.logger.info(d(2051,null,`${l}@${c}`)),!1;p.preRelease&&c!=="prerelease"&&(u.preRelease=!1)}return!0}),!i.length)return[];let o=[],n=[],r=await this.getGalleryExtensions(i);if(await Promise.all(i.map(async({id:s,version:l,installOptions:c})=>{let u=r.get(s.toLowerCase());if(!u){this.logger.error(`${O$o(l?`${s}@${l}`:s)}
${Ito}`),o.push(s);return}try{let h=await this.extensionGalleryService.getManifest(u,Se.None);if(h&&!this.validateExtensionKind(h))return}catch(h){this.logger.error(h.message||h.stack||h),o.push(s);return}let p=e.find(h=>Ut(h.identifier,u.identifier));if(p){if(u.version===p.manifest.version){this.logger.info(d(2051,null,l?`${s}@${l}`:s));return}this.logger.info(d(2080,null,s,u.version))}c.isBuiltin?this.logger.info(l?d(2063,null,s,l):d(2062,null,s)):this.logger.info(l?d(2064,null,s,l):d(2061,null,s)),n.push({extension:u,options:{...c,installGivenVersion:!!l,isApplicationScoped:c.isApplicationScoped||p?.isApplicationScoped}})})),n.length){let s=await this.extensionManagementService.installGalleryExtensions(n);for(let l of s)l.error?(this.logger.error(d(2056,null,l.identifier.id,Pn(l.error))),o.push(l.identifier.id)):this.logger.info(d(2071,null,l.identifier.id,l.local?.manifest.version))}return o}async installVSIX(i,e,t,o){let n=await this.extensionManagementService.getManifest(i);if(!n)throw new Error("Invalid vsix");if(await this.validateVSIX(n,t,e.profileLocation,o))try{await this.extensionManagementService.install(i,{...e,installGivenVersion:!0}),this.logger.info(d(2075,null,He(i)))}catch(s){if(ao(s))this.logger.info(d(2054,null,He(i)));else throw s}}async getGalleryExtensions(i){let e=new Map,t=i.some(r=>r.installOptions.installPreReleaseVersion),o=await this.extensionManagementService.getTargetPlatform(),n=[];for(let r of i)N5.test(r.id)&&n.push({...r,preRelease:t});if(n.length){let r=await this.extensionGalleryService.getExtensions(n,{targetPlatform:o},Se.None);for(let s of r)e.set(s.identifier.id.toLowerCase(),s)}return e}validateExtensionKind(i){return!0}async validateVSIX(i,e,t,o){if(!e){let n={id:Qf(i.publisher,i.name)},r=o.find(s=>Ut(n,s.identifier)&&zR(s.manifest.version,i.version));if(r)return this.logger.info(d(2058,null,r.identifier.id,r.manifest.version,i.version)),!1}return this.validateExtensionKind(i)}async uninstallExtensions(i,e,t){let o=async r=>{if(r instanceof A){let s=await this.extensionManagementService.getManifest(r);return gS(s.publisher,s.name)}return r},n=[];for(let r of i){let s=await o(r),c=(await this.extensionManagementService.getInstalled(void 0,t)).filter(u=>Ut(u.identifier,{id:s}));if(!c.length)throw new Error(`${this.notInstalled(s)}
${Ito}`);if(c.some(u=>u.type===0)){this.logger.info(d(2053,null,s));return}if(!e&&c.some(u=>u.isBuiltin)){this.logger.info(d(2059,null,s));return}this.logger.info(d(2076,null,s));for(let u of c)await this.extensionManagementService.uninstall(u,{profileLocation:t}),n.push(u);this.location?this.logger.info(d(2073,null,s,this.location)):this.logger.info(d(2072,null,s))}}async locateExtension(i){let e=await this.extensionManagementService.getInstalled();i.forEach(t=>{e.forEach(o=>{if(o.identifier.id===t&&o.location.scheme===Q.file){this.logger.info(o.location.fsPath);return}})})}notInstalled(i){return this.location?d(2070,null,i,this.location):d(2069,null,i)}};uTe=I([m(2,Cs),m(3,fa),m(4,tt)],uTe);var F$o=Cs;var Ec=le("extensionManagementServerService"),ru=F$o;var Js=le("extensionEnablementService"),rCa=le("IWebExtensionsScannerService");var a9e="security.workspace.trust.enabled",Whi="security.workspace.trust.startupPrompt",Vhi="security.workspace.trust.banner",s9e="security.workspace.trust.untrustedFiles",HLt="security.workspace.trust.emptyWindow",ULt="extensions.supportUntrustedWorkspaces",W$o="content.trust.model.key",Nhi=class{constructor(i,e,t){this.originalWorkspace=i;this.canonicalFolderUris=e;this.canonicalConfiguration=t}get folders(){return this.originalWorkspace.folders.map((i,e)=>({index:i.index,name:i.name,toResource:i.toResource,uri:this.canonicalFolderUris[e]}))}get transient(){return this.originalWorkspace.transient}get configuration(){return this.canonicalConfiguration??this.originalWorkspace.configuration}get id(){return this.originalWorkspace.id}},pTe=class extends x{constructor(e,t){super();this.configurationService=e;this.environmentService=t}isWorkspaceTrustEnabled(){return this.environmentService.disableWorkspaceTrust?!1:!!this.configurationService.getValue(a9e)}};pTe=I([m(0,B),m(1,At)],pTe);var mTe=class extends x{constructor(e,t,o,n,r,s,l,c){super();this.configurationService=e;this.remoteAuthorityResolverService=t;this.storageService=o;this.uriIdentityService=n;this.environmentService=r;this.workspaceService=s;this.workspaceTrustEnablementService=l;this.fileService=c;this.storageKey=W$o;this._onDidChangeTrust=this._register(new E);this.onDidChangeTrust=this._onDidChangeTrust.event;this._onDidChangeTrustedFolders=this._register(new E);this.onDidChangeTrustedFolders=this._onDidChangeTrustedFolders.event;this._canonicalStartupFiles=[];this._canonicalUrisResolved=!1,this._canonicalWorkspace=this.workspaceService.getWorkspace(),{promise:this._workspaceResolvedPromise,resolve:this._workspaceResolvedPromiseResolve}=WI(),{promise:this._workspaceTrustInitializedPromise,resolve:this._workspaceTrustInitializedPromiseResolve}=WI(),this._storedTrustState=new Fhi(Wt&&this.isEmptyWorkspace()?void 0:this.storageService),this._trustTransitionManager=this._register(new Ohi),this._trustStateInfo=this.loadTrustInfo(),this._isTrusted=this.calculateWorkspaceTrust(),this.initializeWorkspaceTrust(),this.registerListeners()}initializeWorkspaceTrust(){this.resolveCanonicalUris().then(async()=>{this._canonicalUrisResolved=!0,await this.updateWorkspaceTrust()}).finally(()=>{this._workspaceResolvedPromiseResolve(),this.environmentService.remoteAuthority||this._workspaceTrustInitializedPromiseResolve()}),this.environmentService.remoteAuthority&&this.remoteAuthorityResolverService.resolveAuthority(this.environmentService.remoteAuthority).then(async e=>{this._remoteAuthority=e,await this.fileService.activateProvider(Q.vscodeRemote),await this.updateWorkspaceTrust()}).finally(()=>{this._workspaceTrustInitializedPromiseResolve()}),this.isEmptyWorkspace()&&this._workspaceTrustInitializedPromise.then(()=>{this._storedTrustState.isEmptyWorkspaceTrusted===void 0&&(this._storedTrustState.isEmptyWorkspaceTrusted=this.isWorkspaceTrusted())})}registerListeners(){this._register(this.workspaceService.onDidChangeWorkspaceFolders(async()=>await this.updateWorkspaceTrust())),this._register(this.storageService.onDidChangeValue(-1,this.storageKey,this._store)(async()=>{JSON.stringify(this._trustStateInfo)!==JSON.stringify(this.loadTrustInfo())&&(this._trustStateInfo=this.loadTrustInfo(),this._onDidChangeTrustedFolders.fire(),await this.updateWorkspaceTrust())}))}async getCanonicalUri(e){let t=e;if(this.environmentService.remoteAuthority&&e.scheme===Q.vscodeRemote)t=await this.remoteAuthorityResolverService.getCanonicalURI(e);else if(e.scheme==="vscode-vfs"){let o=e.authority.indexOf("+");o!==-1&&(t=e.with({authority:e.authority.substr(0,o)}))}return t.with({query:null,fragment:null})}async resolveCanonicalUris(){let e=[];if(this.environmentService.filesToOpenOrCreate&&e.push(...this.environmentService.filesToOpenOrCreate),this.environmentService.filesToDiff&&e.push(...this.environmentService.filesToDiff),this.environmentService.filesToMerge&&e.push(...this.environmentService.filesToMerge),e.length){let r=e.filter(l=>!!l.fileUri).map(l=>l.fileUri),s=await Promise.all(r.map(l=>this.getCanonicalUri(l)));this._canonicalStartupFiles.push(...s.filter(l=>this._canonicalStartupFiles.every(c=>!this.uriIdentityService.extUri.isEqual(l,c))))}let t=this.workspaceService.getWorkspace().folders.map(r=>r.uri),o=await Promise.all(t.map(r=>this.getCanonicalUri(r))),n=this.workspaceService.getWorkspace().configuration;n&&rce(n,this.environmentService)&&(n=await this.getCanonicalUri(n)),this._canonicalWorkspace=new Nhi(this.workspaceService.getWorkspace(),o,n)}loadTrustInfo(){let e=this.storageService.get(this.storageKey,-1),t;try{e&&(t=JSON.parse(e))}catch{}return t||(t={uriTrustInfo:[]}),t.uriTrustInfo||(t.uriTrustInfo=[]),t.uriTrustInfo=t.uriTrustInfo.map(o=>({uri:A.revive(o.uri),trusted:o.trusted})),t.uriTrustInfo=t.uriTrustInfo.filter(o=>o.trusted),t}async saveTrustInfo(){this.storageService.store(this.storageKey,JSON.stringify(this._trustStateInfo),-1,1),this._onDidChangeTrustedFolders.fire(),await this.updateWorkspaceTrust()}getWorkspaceUris(){let e=this._canonicalWorkspace.folders.map(o=>o.uri),t=this._canonicalWorkspace.configuration;return t&&rce(t,this.environmentService)&&e.push(t),e}calculateWorkspaceTrust(){return this.workspaceTrustEnablementService.isWorkspaceTrustEnabled()?this._canonicalUrisResolved?this.environmentService.remoteAuthority&&this._remoteAuthority?.options?.isTrusted?this._remoteAuthority.options.isTrusted:this.isEmptyWorkspace()?this._storedTrustState.isEmptyWorkspaceTrusted!==void 0?this._storedTrustState.isEmptyWorkspaceTrusted:this._canonicalStartupFiles.length?this.getUrisTrust(this._canonicalStartupFiles):!!this.configurationService.getValue(HLt):this.getUrisTrust(this.getWorkspaceUris()):!1:!0}async updateWorkspaceTrust(e){this.workspaceTrustEnablementService.isWorkspaceTrustEnabled()&&(e===void 0&&(await this.resolveCanonicalUris(),e=this.calculateWorkspaceTrust()),this.isWorkspaceTrusted()!==e&&(this.isTrusted=e,await this._trustTransitionManager.participate(e),this._onDidChangeTrust.fire(e)))}getUrisTrust(e){let t=!0;for(let o of e){let{trusted:n}=this.doGetUriTrustInfo(o);if(!n)return t=n,t}return t}doGetUriTrustInfo(e){if(!this.workspaceTrustEnablementService.isWorkspaceTrustEnabled())return{trusted:!0,uri:e};if(this.uriIdentityService.extUri.isEqual(e,this.environmentService.agentSessionsWorkspace))return{trusted:!0,uri:e};if(this.isTrustedVirtualResource(e))return{trusted:!0,uri:e};if(this.isTrustedByRemote(e))return{trusted:!0,uri:e};let t=!1,o=-1,n=e;for(let r of this._trustStateInfo.uriTrustInfo)if(this.uriIdentityService.extUri.isEqualOrParent(e,r.uri)){let s=r.uri.fsPath;s.length>o&&(o=s.length,t=r.trusted,n=r.uri)}return{trusted:t,uri:n}}async doSetUrisTrust(e,t){let o=!1;for(let n of e)if(t){if(this.isTrustedVirtualResource(n)||this.isTrustedByRemote(n))continue;this._trustStateInfo.uriTrustInfo.find(s=>this.uriIdentityService.extUri.isEqual(s.uri,n))||(this._trustStateInfo.uriTrustInfo.push({uri:n,trusted:!0}),o=!0)}else{let r=this._trustStateInfo.uriTrustInfo.length;this._trustStateInfo.uriTrustInfo=this._trustStateInfo.uriTrustInfo.filter(s=>!this.uriIdentityService.extUri.isEqual(s.uri,n)),r!==this._trustStateInfo.uriTrustInfo.length&&(o=!0)}o&&await this.saveTrustInfo()}isEmptyWorkspace(){if(this.workspaceService.getWorkbenchState()===1)return!0;let e=this.workspaceService.getWorkspace();return e?gw(this.workspaceService.getWorkspace())&&e.folders.length===0:!1}isTrustedVirtualResource(e){return Kde(e)&&e.scheme!=="vscode-vfs"}isTrustedByRemote(e){return!this.environmentService.remoteAuthority||!this._remoteAuthority?!1:gV(b5(e),this._remoteAuthority.authority.authority)&&!!this._remoteAuthority.options?.isTrusted}set isTrusted(e){this._isTrusted=e,e||(this._storedTrustState.acceptsOutOfWorkspaceFiles=!1),this.isEmptyWorkspace()&&(this._storedTrustState.isEmptyWorkspaceTrusted=e)}get workspaceResolved(){return this._workspaceResolvedPromise}get workspaceTrustInitialized(){return this._workspaceTrustInitializedPromise}get acceptsOutOfWorkspaceFiles(){return this._storedTrustState.acceptsOutOfWorkspaceFiles}set acceptsOutOfWorkspaceFiles(e){this._storedTrustState.acceptsOutOfWorkspaceFiles=e}isWorkspaceTrusted(){return this._isTrusted}isWorkspaceTrustForced(){return!!(this.environmentService.remoteAuthority&&this._remoteAuthority?.options?.isTrusted!==void 0||this.getWorkspaceUris().filter(t=>!this.isTrustedVirtualResource(t)).length===0)}canSetParentFolderTrust(){let e=Dg(this._canonicalWorkspace);if(!Zh(e)||e.uri.scheme!==Q.file&&e.uri.scheme!==Q.vscodeRemote)return!1;let t=this.uriIdentityService.extUri.dirname(e.uri);return!this.uriIdentityService.extUri.isEqual(e.uri,t)}async setParentFolderTrust(e){if(this.canSetParentFolderTrust()){let t=Dg(this._canonicalWorkspace).uri,o=this.uriIdentityService.extUri.dirname(t);await this.setUrisTrust([o],e)}}canSetWorkspaceTrust(){if(this.environmentService.remoteAuthority&&(!this._remoteAuthority||this._remoteAuthority.options?.isTrusted!==void 0))return!1;if(this.isEmptyWorkspace())return!0;if(this.getWorkspaceUris().filter(n=>!this.isTrustedVirtualResource(n)).length===0)return!1;if(!this.isWorkspaceTrusted())return!0;let t=Dg(this._canonicalWorkspace);if(!Zh(t)||t.uri.scheme!==Q.file&&t.uri.scheme!=="vscode-vfs")return!1;let o=this.doGetUriTrustInfo(t.uri);if(!o.trusted||!this.uriIdentityService.extUri.isEqual(t.uri,o.uri))return!1;if(this.canSetParentFolderTrust()){let n=this.uriIdentityService.extUri.dirname(t.uri);if(this.doGetUriTrustInfo(n).trusted)return!1}return!0}async setWorkspaceTrust(e){if(this.isEmptyWorkspace()){await this.updateWorkspaceTrust(e);return}let t=this.getWorkspaceUris();await this.setUrisTrust(t,e)}async getUriTrustInfo(e){return this.workspaceTrustEnablementService.isWorkspaceTrustEnabled()?this.isTrustedByRemote(e)?{trusted:!0,uri:e}:this.doGetUriTrustInfo(await this.getCanonicalUri(e)):{trusted:!0,uri:e}}async setUrisTrust(e,t){this.doSetUrisTrust(await Promise.all(e.map(o=>this.getCanonicalUri(o))),t)}getTrustedUris(){return this._trustStateInfo.uriTrustInfo.map(e=>e.uri)}async setTrustedUris(e){this._trustStateInfo.uriTrustInfo=[];for(let t of e){let o=await this.getCanonicalUri(t),n=this.uriIdentityService.extUri.removeTrailingPathSeparator(o),r=!1;for(let s of this._trustStateInfo.uriTrustInfo)if(this.uriIdentityService.extUri.isEqual(s.uri,n)){r=!0;break}r||this._trustStateInfo.uriTrustInfo.push({trusted:!0,uri:n})}await this.saveTrustInfo()}addWorkspaceTrustTransitionParticipant(e){return this._trustTransitionManager.addWorkspaceTrustTransitionParticipant(e)}};mTe=I([m(0,B),m(1,Uc),m(2,ce),m(3,ht),m(4,At),m(5,Pe),m(6,kR),m(7,fe)],mTe);var r9e=class extends x{constructor(e,t){super();this.configurationService=e;this.workspaceTrustManagementService=t;this._resourcesTrustRequestPromises=new gt;this._resourcesTrustRequestResolvers=new gt;this._onDidInitiateOpenFilesTrustRequest=this._register(new E);this.onDidInitiateOpenFilesTrustRequest=this._onDidInitiateOpenFilesTrustRequest.event;this._onDidInitiateResourcesTrustRequest=this._register(new E);this.onDidInitiateResourcesTrustRequest=this._onDidInitiateResourcesTrustRequest.event;this._onDidInitiateWorkspaceTrustRequest=this._register(new E);this.onDidInitiateWorkspaceTrustRequest=this._onDidInitiateWorkspaceTrustRequest.event;this._onDidInitiateWorkspaceTrustRequestOnStartup=this._register(new E);this.onDidInitiateWorkspaceTrustRequestOnStartup=this._onDidInitiateWorkspaceTrustRequestOnStartup.event}get untrustedFilesSetting(){return this.configurationService.getValue(s9e)}set untrustedFilesSetting(e){this.configurationService.updateValue(s9e,e)}async completeOpenFilesTrustRequest(e,t){this._openFilesTrustRequestResolver&&(e===1&&(this.workspaceTrustManagementService.acceptsOutOfWorkspaceFiles=!0),t&&(e===1&&(this.untrustedFilesSetting="open"),e===2&&(this.untrustedFilesSetting="newWindow")),this._openFilesTrustRequestResolver(e),this._openFilesTrustRequestResolver=void 0,this._openFilesTrustRequestPromise=void 0)}async requestOpenFilesTrust(e){if(!this.workspaceTrustManagementService.isWorkspaceTrusted())return 1;if((await Promise.all(e.map(o=>this.workspaceTrustManagementService.getUriTrustInfo(o)))).map(o=>o.trusted).every(o=>o))return 1;if(this.untrustedFilesSetting!=="prompt"){if(this.untrustedFilesSetting==="newWindow")return 2;if(this.untrustedFilesSetting==="open")return 1}if(this.workspaceTrustManagementService.acceptsOutOfWorkspaceFiles)return 1;if(!this._openFilesTrustRequestPromise)this._openFilesTrustRequestPromise=new Promise(o=>{this._openFilesTrustRequestResolver=o});else return this._openFilesTrustRequestPromise;return this._onDidInitiateOpenFilesTrustRequest.fire(),this._openFilesTrustRequestPromise}async completeResourcesTrustRequest(e,t){let o=this._resourcesTrustRequestResolvers.get(e);if(!o)return;let n=t===1;await this.workspaceTrustManagementService.setUrisTrust([e],n),o(n),this._resourcesTrustRequestResolvers.delete(e),this._resourcesTrustRequestPromises.delete(e)}async requestResourcesTrust(e){if((await this.workspaceTrustManagementService.getUriTrustInfo(e.uri)).trusted)return!0;let o=this._resourcesTrustRequestPromises.get(e.uri);if(o)return o;let n=new Promise(r=>{this._resourcesTrustRequestResolvers.set(e.uri,r)});return this._resourcesTrustRequestPromises.set(e.uri,n),this._onDidInitiateResourcesTrustRequest.fire(e),n}resolveWorkspaceTrustRequest(e){this._workspaceTrustRequestResolver&&(this._workspaceTrustRequestResolver(e??this.workspaceTrustManagementService.isWorkspaceTrusted()),this._workspaceTrustRequestResolver=void 0,this._workspaceTrustRequestPromise=void 0)}cancelWorkspaceTrustRequest(){this._workspaceTrustRequestResolver&&(this._workspaceTrustRequestResolver(void 0),this._workspaceTrustRequestResolver=void 0,this._workspaceTrustRequestPromise=void 0)}async completeWorkspaceTrustRequest(e){if(e===void 0||e===this.workspaceTrustManagementService.isWorkspaceTrusted()){this.resolveWorkspaceTrustRequest(e);return}U.once(this.workspaceTrustManagementService.onDidChangeTrust)(t=>this.resolveWorkspaceTrustRequest(t)),await this.workspaceTrustManagementService.setWorkspaceTrust(e)}async requestWorkspaceTrust(e){if(this.workspaceTrustManagementService.isWorkspaceTrusted())return this.workspaceTrustManagementService.isWorkspaceTrusted();if(!this._workspaceTrustRequestPromise)this._workspaceTrustRequestPromise=new Promise(t=>{this._workspaceTrustRequestResolver=t});else return this._workspaceTrustRequestPromise;return this._onDidInitiateWorkspaceTrustRequest.fire(e),this._workspaceTrustRequestPromise}requestWorkspaceTrustOnStartup(){this._workspaceTrustRequestPromise||(this._workspaceTrustRequestPromise=new Promise(e=>{this._workspaceTrustRequestResolver=e})),this._onDidInitiateWorkspaceTrustRequestOnStartup.fire()}};r9e=I([m(0,B),m(1,Nr)],r9e);var Ohi=class extends x{constructor(){super(...arguments);this.participants=new qs}addWorkspaceTrustTransitionParticipant(e){let t=this.participants.push(e);return Z(()=>t())}async participate(e){for(let t of this.participants)await t.participate(e)}dispose(){this.participants.clear(),super.dispose()}},Fhi=class{constructor(i){this._acceptsOutOfWorkspaceFilesKey="acceptsOutOfWorkspaceFiles";this._isEmptyWorkspaceTrustedKey="isEmptyWorkspaceTrusted";i?(this._memento=new Al("workspaceTrust",i),this._mementoObject=this._memento.getMemento(1,1)):this._mementoObject={}}get acceptsOutOfWorkspaceFiles(){return this._mementoObject[this._acceptsOutOfWorkspaceFilesKey]??!1}set acceptsOutOfWorkspaceFiles(i){this._mementoObject[this._acceptsOutOfWorkspaceFilesKey]=i,this._memento?.saveMemento()}get isEmptyWorkspaceTrusted(){return this._mementoObject[this._isEmptyWorkspaceTrustedKey]}set isEmptyWorkspaceTrusted(i){this._mementoObject[this._isEmptyWorkspaceTrustedKey]=i,this._memento?.saveMemento()}};Ee(Vu,r9e,1);var Gp=le("extensionManifestPropertiesService"),l9e=class extends x{constructor(e,t,o,n){super();this.productService=e;this.configurationService=t;this.workspaceTrustEnablementService=o;this.logService=n;this._extensionPointExtensionKindsMap=null;this._productExtensionKindsMap=null;this._configuredExtensionKindsMap=null;this._productVirtualWorkspaceSupportMap=null;this._configuredVirtualWorkspaceSupportMap=null;this._configuredExtensionWorkspaceTrustRequestMap=new iu;let r=t.inspect(ULt).userValue||{};for(let s of Object.keys(r))this._configuredExtensionWorkspaceTrustRequestMap.set(s,r[s]);if(this._productExtensionWorkspaceTrustRequestMap=new Map,e.extensionUntrustedWorkspaceSupport)for(let s of Object.keys(e.extensionUntrustedWorkspaceSupport))this._productExtensionWorkspaceTrustRequestMap.set(s,e.extensionUntrustedWorkspaceSupport[s])}prefersExecuteOnUI(e){let t=this.getExtensionKind(e);return t.length>0&&t[0]==="ui"}prefersExecuteOnWorkspace(e){let t=this.getExtensionKind(e);return t.length>0&&t[0]==="workspace"}prefersExecuteOnWeb(e){let t=this.getExtensionKind(e);return t.length>0&&t[0]==="web"}canExecuteOnUI(e){return this.getExtensionKind(e).some(o=>o==="ui")}canExecuteOnWorkspace(e){return this.getExtensionKind(e).some(o=>o==="workspace")}canExecuteOnWeb(e){return this.getExtensionKind(e).some(o=>o==="web")}getExtensionKind(e){let t=this.deduceExtensionKind(e),o=this.getConfiguredExtensionKind(e);if(o&&o.length>0){let n=[];for(let r of o)r!=="-web"&&n.push(r);return o.includes("-web")&&!n.length&&(n.push("ui"),n.push("workspace")),Wt&&!o.includes("-web")&&!o.includes("web")&&t.includes("web")&&n.push("web"),n}return t}getUserConfiguredExtensionKind(e){if(this._configuredExtensionKindsMap===null){let o=new iu,n=this.configurationService.getValue("remote.extensionKind")||{};for(let r of Object.keys(n))o.set(r,n[r]);this._configuredExtensionKindsMap=o}let t=this._configuredExtensionKindsMap.get(e.id);return t?this.toArray(t):void 0}getExtensionUntrustedWorkspaceSupportType(e){if(!this.workspaceTrustEnablementService.isWorkspaceTrustEnabled()||!e.main)return!0;let t=this.getConfiguredExtensionWorkspaceTrustRequest(e),o=this.getProductExtensionWorkspaceTrustRequest(e);return t!==void 0?t:o?.override!==void 0?o.override:e.capabilities?.untrustedWorkspaces?.supported!==void 0?e.capabilities.untrustedWorkspaces.supported:o?.default!==void 0?o.default:!1}getExtensionVirtualWorkspaceSupportType(e){let t=this.getConfiguredVirtualWorkspaceSupport(e);if(t!==void 0)return t;let o=this.getProductVirtualWorkspaceSupport(e);if(o?.override!==void 0)return o.override;let n=e.capabilities?.virtualWorkspaces;if(Wa(n))return n;if(n){let r=n.supported;if(Wa(r)||r==="limited")return r}return o?.default!==void 0?o.default:!0}deduceExtensionKind(e){if(e.main)return e.browser?Wt?["workspace","web"]:["workspace"]:["workspace"];if(e.browser)return["web"];let t=[...iYi];if((yr(e.extensionPack)||yr(e.extensionDependencies))&&(t=Wt?["workspace","web"]:["workspace"]),e.contributes)for(let o of Object.keys(e.contributes)){let n=this.getSupportedExtensionKindsForExtensionPoint(o);n.length&&(t=t.filter(r=>n.includes(r)))}return t.length||this.logService.warn("Cannot deduce extensionKind for extension",Qf(e.publisher,e.name)),t}getSupportedExtensionKindsForExtensionPoint(e){if(this._extensionPointExtensionKindsMap===null){let o=new Map;Rn.getExtensionPoints().forEach(n=>o.set(n.name,n.defaultExtensionKind||[])),this._extensionPointExtensionKindsMap=o}let t=this._extensionPointExtensionKindsMap.get(e);return t||(t=this.productService.extensionPointExtensionKind?this.productService.extensionPointExtensionKind[e]:void 0,t)?t:Wt?["workspace","web"]:["workspace"]}getConfiguredExtensionKind(e){let t={id:Qf(e.publisher,e.name)},o=this.getUserConfiguredExtensionKind(t);return typeof o<"u"?this.toArray(o):(o=this.getProductExtensionKind(e),typeof o<"u"?o:(o=e.extensionKind,typeof o<"u"?(o=this.toArray(o),o.filter(n=>["ui","workspace"].includes(n))):null))}getProductExtensionKind(e){if(this._productExtensionKindsMap===null){let o=new iu;if(this.productService.extensionKind)for(let n of Object.keys(this.productService.extensionKind))o.set(n,this.productService.extensionKind[n]);this._productExtensionKindsMap=o}let t=Qf(e.publisher,e.name);return this._productExtensionKindsMap.get(t)}getProductVirtualWorkspaceSupport(e){if(this._productVirtualWorkspaceSupportMap===null){let o=new iu;if(this.productService.extensionVirtualWorkspacesSupport)for(let n of Object.keys(this.productService.extensionVirtualWorkspacesSupport))o.set(n,this.productService.extensionVirtualWorkspacesSupport[n]);this._productVirtualWorkspaceSupportMap=o}let t=Qf(e.publisher,e.name);return this._productVirtualWorkspaceSupportMap.get(t)}getConfiguredVirtualWorkspaceSupport(e){if(this._configuredVirtualWorkspaceSupportMap===null){let o=new iu,n=this.configurationService.getValue("extensions.supportVirtualWorkspaces")||{};for(let r of Object.keys(n))n[r]!==void 0&&o.set(r,n[r]);this._configuredVirtualWorkspaceSupportMap=o}let t=Qf(e.publisher,e.name);return this._configuredVirtualWorkspaceSupportMap.get(t)}getConfiguredExtensionWorkspaceTrustRequest(e){let t=Qf(e.publisher,e.name),o=this._configuredExtensionWorkspaceTrustRequestMap.get(t);if(o&&(o.version===void 0||o.version===e.version))return o.supported}getProductExtensionWorkspaceTrustRequest(e){let t=Qf(e.publisher,e.name);return this._productExtensionWorkspaceTrustRequestMap.get(t)}toArray(e){return Array.isArray(e)?e:e==="ui"?["ui","workspace"]:[e]}};l9e=I([m(0,tt),m(1,B),m(2,kR),m(3,se)],l9e);Ee(Gp,l9e,1);$e.registerCommand("_remoteCLI.openExternal",function(a,i){return a.get(Je).open(Fe(i)?i:A.revive(i),{openExternal:!0,allowTunneling:!0})});$e.registerCommand("_remoteCLI.windowOpen",function(a,i,e){let t=a.get(ge);return i.length?t.executeCommand("_files.windowOpen",i,e):t.executeCommand("_files.newWindow",e)});$e.registerCommand("_remoteCLI.getSystemStatus",function(a){return a.get(ge).executeCommand("_issues.getSystemStatus")});$e.registerCommand("_remoteCLI.manageExtensions",async function(a,i){let e=a.get(F),o=a.get(Ec).remoteExtensionManagementServer?.extensionManagementService;if(!o)return;let n=[],r=new class extends WIe{log(l,c){n.push(c)}},s=e.createChild(new _o([Cs,o]));try{let l=s.createInstance(c9e,r);if(i.list)await l.listExtensions(!!i.list.showVersions,i.list.category,void 0);else{let c=u=>u.map(p=>Fe(p)?p:A.revive(p));if(Array.isArray(i.install)&&i.install.length)try{await l.installExtensions(c(i.install),[],{isMachineScoped:!0},!!i.force)}catch(u){n.push(u.message)}if(Array.isArray(i.uninstall)&&i.uninstall.length)try{await l.uninstallExtensions(c(i.uninstall),!!i.force,void 0)}catch(u){n.push(u.message)}}return n.join(`
`)}finally{s.dispose()}});var c9e=class extends uTe{constructor(e,t,o,n,r,s,l){super([],e,t,o,l);this._extensionManifestPropertiesService=s;let c=r.remoteAuthority;this._location=c?n.getHostLabel(Q.vscodeRemote,c):void 0}get location(){return this._location}validateExtensionKind(e){return!this._extensionManifestPropertiesService.canExecuteOnWorkspace(e)&&!(Wt&&this._extensionManifestPropertiesService.canExecuteOnWeb(e))?(this.logger.info(d(3296,null,gS(e.publisher,e.name))),!1):!0}};c9e=I([m(1,Cs),m(2,fa),m(3,rt),m(4,At),m(5,Gp),m(6,tt)],c9e);var zLt=class{constructor(i,e,t){this._clipboardService=e;this._logService=t}dispose(){}$readText(){return this._logService.trace("MainThreadClipboard#readText"),this._clipboardService.readText()}$writeText(i){return this._logService.trace("MainThreadClipboard#writeText with text.length : ",i.length),this._clipboardService.writeText(i)}};zLt=I([fo(qi.MainThreadClipboard),m(1,Fi),m(2,se)],zLt);var KLt=class{constructor(i,e,t){this._commandService=e;this._extensionService=t;this._commandRegistrations=new Vt;this._proxy=i.getProxy(to.ExtHostCommands),this._generateCommandsDocumentationRegistration=$e.registerCommand("_generateCommandsDocumentation",()=>this._generateCommandsDocumentation())}dispose(){this._commandRegistrations.dispose(),this._generateCommandsDocumentationRegistration.dispose()}async _generateCommandsDocumentation(){let i=await this._proxy.$getContributedCommandMetadata(),e=$e.getCommands();for(let[o,n]of e)n.metadata&&(i[o]=n.metadata);let t=[];for(let o in i)t.push("`"+o+"` - "+V$o(i[o]));console.log(t.join(`
`))}$registerCommand(i){this._commandRegistrations.set(i,$e.registerCommand(i,(e,...t)=>this._proxy.$executeContributedCommand(i,...t).then(o=>$n(o))))}$unregisterCommand(i){this._commandRegistrations.deleteAndDispose(i)}$fireCommandActivationEvent(i){let e=`onCommand:${i}`;this._extensionService.activationEventIsDone(e)||this._extensionService.activateByEvent(e)}async $executeCommand(i,e,t){e instanceof ag&&(e=e.value);for(let o=0;o<e.length;o++)e[o]=$n(e[o]);if(t&&e.length>0&&!$e.getCommand(i))throw await this._extensionService.activateByEvent(`onCommand:${i}`),new Error("$executeCommand:retry");return this._commandService.executeCommand(i,...e)}$getCommands(){return Promise.resolve([...$e.getCommands().keys()])}};KLt=I([fo(qi.MainThreadCommands),m(1,ge),m(2,lt)],KLt);function V$o(a){if(typeof a=="string")return a;{let e=[Fe(a.description)?a.description:a.description.original];if(e.push(`

`),a.args)for(let t of a.args)e.push(`* _${t.name}_ - ${t.description||""}
`);return a.returns&&e.push(`* _(returns)_ - ${a.returns}`),e.push(`

`),e.join("")}}var GLt=class{constructor(i,e,t,o){this._workspaceContextService=e;this.configurationService=t;this._environmentService=o;let n=i.getProxy(to.ExtHostConfiguration);n.$initializeConfiguration(this._getConfigurationData()),this._configurationListener=t.onDidChangeConfiguration(r=>{n.$acceptConfigurationChanged(this._getConfigurationData(),r.change)})}_getConfigurationData(){let i={...this.configurationService.getConfigurationData(),configurationScopes:[]};return(!this._environmentService.isBuilt||this._environmentService.isExtensionDevelopment)&&(i.configurationScopes=iji()),i}dispose(){this._configurationListener.dispose()}$updateConfigurationOption(i,e,t,o,n){return o={resource:o?.resource?A.revive(o.resource):void 0,overrideIdentifier:o?.overrideIdentifier},this.writeConfiguration(i,e,t,o,n)}$removeConfigurationOption(i,e,t,o){return t={resource:t?.resource?A.revive(t.resource):void 0,overrideIdentifier:t?.overrideIdentifier},this.writeConfiguration(i,e,void 0,t,o)}writeConfiguration(i,e,t,o,n){i=i??this.deriveConfigurationTarget(e,o);let r=this.configurationService.inspect(e,o);switch(i){case 8:return this._updateValue(e,t,i,r?.memory?.override,o,n);case 6:return this._updateValue(e,t,i,r?.workspaceFolder?.override,o,n);case 5:return this._updateValue(e,t,i,r?.workspace?.override,o,n);case 4:return this._updateValue(e,t,i,r?.userRemote?.override,o,n);default:return this._updateValue(e,t,i,r?.userLocal?.override,o,n)}}_updateValue(i,e,t,o,n,r){return n=r===!0?n:r===!1?{resource:n.resource}:n.overrideIdentifier&&o!==void 0?n:{resource:n.resource},this.configurationService.updateValue(i,e,n,t,{donotNotifyError:!0})}deriveConfigurationTarget(i,e){if(e.resource&&this._workspaceContextService.getWorkbenchState()===3){let t=ne.as(Jt.Configuration).getConfigurationProperties();if(t[i]&&(t[i].scope===5||t[i].scope===6))return 6}return 5}};GLt=I([fo(qi.MainThreadConfiguration),m(1,Pe),m(2,B),m(3,Eo)],GLt);function qLt(a){let i=[],e;try{let t=JSON.parse(a.arguments),o=t[t.length-1];o&&o.__$stack&&(t.pop(),e=o.__$stack),i.push(...t)}catch{i.push("Unable to log remote console arguments",a.arguments)}return{args:i,stack:e}}function B$o(a){if(!a)return a;let i=a.indexOf(`
`);return i===-1?a:a.substring(0,i)}function wto(a,i){let{args:e,stack:t}=qLt(a),o=typeof e[0]=="string"&&e.length===1,n=B$o(t);n&&(n=`(${n.trim()})`);let r=[];if(typeof e[0]=="string"?n&&o?r=[`%c[${i}] %c${e[0]} %c${n}`,hTe("blue"),hTe(""),hTe("grey")]:r=[`%c[${i}] %c${e[0]}`,hTe("blue"),hTe(""),...e.slice(1)]:r=[`%c[${i}]%`,hTe("blue"),...e],n&&!o&&r.push(n),typeof console[a.severity]!="function")throw new Error("Unknown console method");console[a.severity].apply(console,r)}function hTe(a){return`color: ${a}`}function Cto(a,i,e=null){let t=qLt(i).args,o=t.shift();if(typeof o=="string")switch(i.severity||(i.severity="info"),e&&(/^\[/.test(e)||(e=`[${e}]`),/ $/.test(e)||(e=`${e} `),o=e+o),i.severity){case"log":case"info":a.info(o,...t);break;case"warn":a.warn(o,...t);break;case"error":a.error(o,...t);break}}function xto(a,i,e){let t=qLt(i).args,o=t.shift();typeof o!="string"||i.severity!=="error"||(/^\[/.test(e)||(e=`[${e}]`),/ $/.test(e)||(e=`${e} `),a.error(e+o,...t))}function KF(a){let i=a.isExtensionDevelopment,e=!0,t=a.extensionDevelopmentLocationURI;if(t)for(let s of t)s.scheme!==Q.file&&(e=!1);let o=e&&typeof a.debugExtensionHost.port=="number",n=e&&!!a.debugExtensionHost.break,r=i&&!!a.extensionTestsLocationURI&&!a.debugExtensionHost.debugId;return{isExtensionDevHost:i,isExtensionDevDebug:o,isExtensionDevDebugBrk:n,isExtensionDevTestFromCli:r}}var $Lt=class{constructor(i,e,t){this._environmentService=e;this._logService=t;let o=KF(this._environmentService);this._isExtensionDevTestFromCli=o.isExtensionDevTestFromCli}dispose(){}$logExtensionHostMessage(i){this._isExtensionDevTestFromCli?Cto(this._logService,i):(xto(this._logService,i,"Extension Host"),wto(i,"Extension Host"))}};$Lt=I([fo(qi.MainThreadConsole),m(1,Eo),m(2,se)],$Lt);var cg="workbench.view.debug",VK="workbench.debug.variablesView",Ik="workbench.debug.watchExpressionsView",f4="workbench.debug.callStackView",rue="workbench.debug.loadedScriptsView",yk="workbench.debug.breakPointsView",jLt="workbench.debug.disassemblyView",QLt="workbench.panel.repl",Td="workbench.panel.repl.view",gTe=new Y("debugType",void 0,{type:"string",description:d(9867,null)}),kto=new Y("debugConfigurationType",void 0,{type:"string",description:d(9858,null)}),Zs=new Y("debugState","inactive",{type:"string",description:d(9866,null)}),Bhi="debugUx",rA=new Y(Bhi,"default",{type:"string",description:d(9868,null)}),YLt=new Y("hasDebugged",!1,{type:"boolean",description:d(9876,null)}),sl=new Y("inDebugMode",!1,{type:"boolean",description:d(9878,null)}),GF=new Y("inDebugRepl",!1,{type:"boolean",description:d(9879,null)}),d9e=new Y("breakpointWidgetVisible",!1,{type:"boolean",description:d(9848,null)}),Hhi=new Y("inBreakpointWidget",!1,{type:"boolean",description:d(9877,null)}),fTe=new Y("breakpointsFocused",!0,{type:"boolean",description:d(9846,null)}),u9e=new Y("watchExpressionsFocused",!0,{type:"boolean",description:d(9904,null)}),p9e=new Y("watchExpressionsExist",!1,{type:"boolean",description:d(9903,null)}),XLt=new Y("variablesFocused",!0,{type:"boolean",description:d(9900,null)}),nJ=new Y("expressionSelected",!1,{type:"boolean",description:d(9872,null)}),JLt=new Y("breakpointInputFocused",!1,{type:"boolean",description:d(9842,null)}),Av=new Y("callStackItemType",void 0,{type:"string",description:d(9854,null)}),ZLt=new Y("callStackSessionIsAttach",!1,{type:"boolean",description:d(9856,null)}),rJ=new Y("callStackItemStopped",!1,{type:"boolean",description:d(9853,null)}),Uhi=new Y("callStackSessionHasOneThread",!1,{type:"boolean",description:d(9855,null)}),Eto=new Y("callStackFocused",!0,{type:"boolean",description:d(9852,null)}),BK=new Y("watchItemType",void 0,{type:"string",description:d(9905,null)}),sJ=new Y("canViewMemory",void 0,{type:"boolean",description:d(9857,null)}),uD=new Y("breakpointItemType",void 0,{type:"string",description:d(9844,null)}),zhi=new Y("breakpointItemBytes",void 0,{type:"boolean",description:d(9843,null)}),Khi=new Y("breakpointHasModes",!1,{type:"boolean",description:d(9841,null)}),eRt=new Y("breakpointSupportsCondition",!1,{type:"boolean",description:d(9847,null)}),m9e=new Y("loadedScriptsSupported",!1,{type:"boolean",description:d(9884,null)}),Tto=new Y("loadedScriptsItemType",void 0,{type:"string",description:d(9883,null)}),zC=new Y("focusedSessionIsAttach",!1,{type:"boolean",description:d(9873,null)}),HK=new Y("focusedSessionIsNoDebug",!1,{type:"boolean",description:d(9874,null)}),h9e=new Y("stepBackSupported",!1,{type:"boolean",description:d(9889,null)}),tRt=new Y("restartFrameSupported",!1,{type:"boolean",description:d(9887,null)}),iRt=new Y("stackFrameSupportsRestart",!1,{type:"boolean",description:d(9888,null)}),sue=new Y("jumpToCursorSupported",!1,{type:"boolean",description:d(9881,null)}),aJ=new Y("stepIntoTargetsSupported",!1,{type:"boolean",description:d(9890,null)}),v4=new Y("breakpointsExist",!1,{type:"boolean",description:d(9845,null)}),Aa=new Y("debuggersAvailable",!1,{type:"boolean",description:d(9861,null)}),oRt=new Y("debugExtensionAvailable",!0,{type:"boolean",description:d(9859,null)}),_to=new Y("debugProtocolVariableMenuContext",void 0,{type:"string",description:d(9862,null)}),g9e=new Y("debugSetVariableSupported",!1,{type:"boolean",description:d(9865,null)}),vTe=new Y("debugSetDataBreakpointAddressSupported",!1,{type:"boolean",description:d(9863,null)}),f9e=new Y("debugSetExpressionSupported",!1,{type:"boolean",description:d(9864,null)}),UK=new Y("breakWhenValueChangesSupported",!1,{type:"boolean",description:d(9849,null)}),lJ=new Y("breakWhenValueIsAccessedSupported",!1,{type:"boolean",description:d(9850,null)}),cJ=new Y("breakWhenValueIsReadSupported",!1,{type:"boolean",description:d(9851,null)}),sA=new Y("terminateDebuggeeSupported",!1,{type:"boolean",description:d(9892,null)}),dJ=new Y("suspendDebuggeeSupported",!1,{type:"boolean",description:d(9891,null)}),v9e=new Y("terminateThreadsSupported",!1,{type:"boolean",description:d(9893,null)}),LB=new Y("variableEvaluateNamePresent",!1,{type:"boolean",description:d(9894,null)}),aue=new Y("variableIsReadonly",!1,{type:"boolean",description:d(9897,null)}),bTe=new Y("variableValue",!1,{type:"string",description:d(9902,null)}),uJ=new Y("variableType",!1,{type:"string",description:d(9901,null)}),Dto=new Y("variableInterfaces",!1,{type:"array",description:d(9896,null)}),nRt=new Y("variableName",!1,{type:"string",description:d(9899,null)}),Lto=new Y("variableLanguage",!1,{type:"string",description:d(9898,null)}),Rto=new Y("variableExtensionId",!1,{type:"string",description:d(9895,null)}),rRt=new Y("exceptionWidgetVisible",!1,{type:"boolean",description:d(9871,null)}),Ghi=new Y("multiSessionRepl",!1,{type:"boolean",description:d(9886,null)}),sRt=new Y("multiSessionDebug",!1,{type:"boolean",description:d(9885,null)}),STe=new Y("disassembleRequestSupported",!1,{type:"boolean",description:d(9869,null)}),zK=new Y("disassemblyViewFocus",!1,{type:"boolean",description:d(9870,null)}),aRt=new Y("languageSupportsDisassembleRequest",!1,{type:"boolean",description:d(9882,null)}),lRt=new Y("focusedStackFrameHasInstructionReference",!1,{type:"boolean",description:d(9875,null)}),cRt=a=>d(9860,null,a),RB="editor.contrib.debug",aA="editor.contrib.breakpoint",KC="debug",dRt={enum:["neverOpen","openOnSessionStart","openOnFirstSessionStart"],default:"openOnFirstSessionStart",description:d(9880,null)};function KR(a){switch(a){case 1:return"initializing";case 2:return"stopped";case 3:return"running";default:return"inactive"}}var lue="vscode-debug-memory";function KK(a){let i=a.presentationHint??a.source.presentationHint;return i==="deemphasize"||i==="subtle"}function Mto(a){return"type"in a&&"request"in a}var Ni=le("debugService");var H$o;(e=>(e.deserialize=t=>t,e.serialize=t=>t))(H$o||={});var qhi;(e=>(e.deserialize=t=>({id:t.id,name:t.name,iconPath:t.iconPath&&{light:A.revive(t.iconPath.light),dark:A.revive(t.iconPath.dark)},iconClass:t.iconClass,visualization:t.visualization}),e.serialize=t=>t))(qhi||={});var uRt=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(i){this.messageCallback&&this._onError.fire(new Error("attempt to set more than one 'Message' callback")),this.messageCallback=i}onEvent(i){this.eventCallback&&this._onError.fire(new Error("attempt to set more than one 'Event' callback")),this.eventCallback=i}onRequest(i){this.requestCallback&&this._onError.fire(new Error("attempt to set more than one 'Request' callback")),this.requestCallback=i}sendResponse(i){i.seq>0?this._onError.fire(new Error(`attempt to send more than one response for command ${i.command}`)):this.internalSend("response",i)}sendRequest(i,e,t,o){let n={command:i};if(e&&Object.keys(e).length>0&&(n.arguments=e),this.internalSend("request",n),typeof o=="number"){let r=setTimeout(()=>{clearTimeout(r);let s=this.pendingRequests.get(n.seq);if(s){this.pendingRequests.delete(n.seq);let l={type:"response",seq:0,request_seq:n.seq,success:!1,command:i,message:d(9840,null,o,i)};s(l)}},o)}return t&&this.pendingRequests.set(n.seq,t),n.seq}acceptMessage(i){this.messageCallback?this.messageCallback(i):(this.queue.push(i),this.queue.length===1&&this.processQueue())}needsTaskBoundaryBetween(i,e){return i.type!=="event"||e.type!=="event"}async processQueue(){let i;for(;this.queue.length;){if((!i||this.needsTaskBoundaryBetween(this.queue[0],i))&&await Li(0),i=this.queue.shift(),!i)return;switch(i.type){case"event":this.eventCallback?.(i);break;case"request":this.requestCallback?.(i);break;case"response":{let e=i,t=this.pendingRequests.get(e.request_seq);t&&(this.pendingRequests.delete(e.request_seq),t(e));break}}}}internalSend(i,e){e.type=i,e.seq=this.sequence++,this.sendMessage(e)}async cancelPendingRequests(){if(this.pendingRequests.size===0)return Promise.resolve();let i=new Map;this.pendingRequests.forEach((e,t)=>i.set(t,e)),await Li(500),i.forEach((e,t)=>{e({type:"response",seq:0,request_seq:t,success:!1,command:"canceled",message:"canceled"}),this.pendingRequests.delete(t)})}getPendingRequestIds(){return Array.from(this.pendingRequests.keys())}dispose(){this._onError.dispose(),this._onExit.dispose(),this.queue=[]}};var U$o=/{([^}]+)}/g;function Ato(a,i,e){return a.replace(U$o,function(t,o){return i&&o.length>0&&o[0]!=="_"?t:e&&e.hasOwnProperty(o)?e[o]:t})}function Nto(a){let i={};for(let e of Object.keys(a))e.startsWith("!")||(i[e]=a[e]);return i}function cue(a){return a.configuration.request==="attach"&&!b9e(a)&&(!a.parentSession||cue(a.parentSession))}function b9e(a){let i=a.configuration.type;if(i)return i==="vslsShare"&&(i=a.configuration.adapterProxy?.configuration?.type||i),vr(i,"extensionhost")||vr(i,"pwa-extensionhost")?a:a.parentSession?b9e(a.parentSession):void 0}function Oto(a){return a.type&&(a.label||a.program||a.runtime)}function z$o(a,i,e){let t,o=0,n=/([^()\[\]{}<>\s+\-/%~#^;=|,`!]|\->)+/g,r=null;for(;r=n.exec(a);){let s=r.index+1,l=s+r[0].length;if(s<=i&&l>=e){t=r[0],o=s;break}}if(t){let s=t.match(/^\.\.\.(.+)/);s&&(t=s[1],o+=3)}if(t){let s=/(\w|\p{L})+/gu,l=null;for(;(l=s.exec(t))&&!(l.index+1+o+l[0].length>=e););l&&(t=t.substring(0,s.lastIndex))}return t?{start:o,end:o+t.length-1}:{start:0,end:0}}async function pRt(a,i,e,t){if(a.evaluatableExpressionProvider.has(i)){let o=a.evaluatableExpressionProvider.ordered(i),n=di(await Promise.all(o.map(async r=>{try{return await r.provideEvaluatableExpression(i,e,t??Se.None)}catch{return}})));if(n.length>0){let r=n[0].expression,s=n[0].range;return r||(r=i.getLineContent(e.lineNumber).substring(s.startColumn-1,s.endColumn-1)),{range:s,matchingExpression:r}}}else{let o=i.getLineContent(e.lineNumber),{start:n,end:r}=z$o(o,e.column,e.column),s=o.substring(n-1,r);return{matchingExpression:s,range:new z(e.lineNumber,n,e.lineNumber,n+s.length)}}return null}var K$o=/^[a-zA-Z][a-zA-Z0-9\+\-\.]+:/;function pJ(a){return!!(a&&a.match(K$o))}function Fto(a){if(typeof a.path=="string"&&!(typeof a.sourceReference=="number"&&a.sourceReference>0)){if(pJ(a.path))return A.parse(a.path);if(Zl(a.path))return A.file(a.path)}return a.path}function Wto(a){if(typeof a.path=="object"){let i=A.revive(a.path);if(i)return i.scheme===Q.file?i.fsPath:i.toString()}return a.path}function Vto(a,i){let e=i?Fto:Wto,t=Ji(a);return Hto(t,(o,n)=>{o&&n&&(n.path=e(n))}),t}function Bto(a,i){let e=i?Fto:Wto,t=Ji(a);return Hto(t,(o,n)=>{!o&&n&&(n.path=e(n))}),t}function Hto(a,i){switch(a.type){case"event":{let e=a;switch(e.event){case"output":i(!1,e.body.source);break;case"loadedSource":i(!1,e.body.source);break;case"breakpoint":i(!1,e.body.breakpoint.source);break;default:break}break}case"request":{let e=a;switch(e.command){case"setBreakpoints":i(!0,e.arguments.source);break;case"breakpointLocations":i(!0,e.arguments.source);break;case"source":i(!0,e.arguments.source);break;case"gotoTargets":i(!0,e.arguments.source);break;case"launchVSCode":e.arguments.args.forEach(t=>i(!1,t));break;default:break}break}case"response":{let e=a;if(e.success&&e.body)switch(e.command){case"stackTrace":e.body.stackFrames.forEach(t=>i(!1,t.source));break;case"loadedSources":e.body.sources.forEach(t=>i(!1,t));break;case"scopes":e.body.scopes.forEach(t=>i(!1,t.source));break;case"setFunctionBreakpoints":e.body.breakpoints.forEach(t=>i(!1,t.source));break;case"setBreakpoints":e.body.breakpoints.forEach(t=>i(!1,t.source));break;case"disassemble":e.body?.instructions.forEach(o=>i(!1,o.location));break;case"locations":i(!1,e.body?.source);break;default:break}break}}}function $hi(a){return a.filter(i=>!i.presentation?.hidden).sort((i,e)=>i.presentation?e.presentation?i.presentation.group?e.presentation.group?i.presentation.group!==e.presentation.group?i.presentation.group.localeCompare(e.presentation.group):Pto(i.presentation.order,e.presentation.order):-1:e.presentation.group?1:Pto(i.presentation.order,e.presentation.order):-1:e.presentation?1:0)}function Pto(a,i){return typeof a!="number"?typeof i!="number"?0:1:typeof i!="number"?-1:a-i}async function S9e(a,i){let e=a.getValue("debug.saveBeforeStart",{overrideIdentifier:i.activeTextEditorLanguageId});if(e!=="none"&&(await i.saveAll(),e==="allEditorsInActiveGroup")){let t=i.activeEditorPane;t&&t.input.resource?.scheme===Q.untitled&&await i.save({editor:t.input,groupId:t.group.id})}await a.reloadConfiguration()}var Uto=(a,i)=>!a||!i?a===i:a.name===i.name&&a.path===i.path&&a.sourceReference===i.sourceReference;function mRt(a,i){let e=i.filter(t=>t.parentSession===a);if(e.length>0){let t=e.find(o=>o.state===2);return t||e[0]}return a}function G$o(a,i){switch(i){case 1:return a.windows;case 2:return a.osx;case 3:return a.linux}}function jhi(a,i=Po){let e=G$o(a,i);return e?{...a,...e,presentation:e.presentation?{...a.presentation,...e.presentation}:a.presentation}:a}function hRt(a,i,e=[]){let t=i.getSession(),o=[[_to.key,i.variableMenuContext||""],[LB.key,!!i.evaluateName],[sJ.key,!!t?.capabilities.supportsReadMemoryRequest&&i.memoryReference!==void 0],[aue.key,!!i.presentationHint?.attributes?.includes("readOnly")||i.presentationHint?.lazy],[uJ.key,i.type],[gTe.key,t?.configuration.type],...e];return a.createOverlay(o)}var gRt=d(9973,null),GK=class{constructor(i,e,t,o){let n;i?(this.raw=i,n=this.raw.path||this.raw.name||"",this.available=!0):(this.raw={name:gRt},this.available=!1,n=`${KC}:${gRt}`),this.uri=I9e(this.raw,n,e,t,o)}get name(){return this.raw.name||Ga(this.uri)}get origin(){return this.raw.origin}get presentationHint(){return this.raw.presentationHint}get reference(){return this.raw.sourceReference}get inMemory(){return this.uri.scheme===KC}openInEditor(i,e,t,o,n){return this.available?i.openEditor({resource:this.uri,description:this.origin,options:{preserveFocus:t,selection:e,revealIfOpened:!0,selectionRevealType:1,pinned:n}},o?In:jn):Promise.resolve(void 0)}static getEncodedDebugData(i){let e,t,o;switch(i.scheme){case Q.file:e=ch(i.fsPath);break;case KC:if(e=i.path,i.query){let n=i.query.split("&");for(let r of n){let s=r.split("=");if(s.length===2)switch(s[0]){case"session":o=s[1];break;case"ref":t=parseInt(s[1]);break}}}break;default:e=i.toString();break}return{name:Ga(i),path:e,sourceReference:t,sessionId:o}}};function I9e(a,i,e,t,o){let n=r=>typeof a.sourceReference=="number"&&a.sourceReference>0?A.from({scheme:KC,path:r?.replace(/^\/+/g,"/"),query:`session=${e}&ref=${a.sourceReference}`}):r&&pJ(r)?t.asCanonicalUri(A.parse(r)):r&&Zl(r)?t.asCanonicalUri(A.file(r)):t.asCanonicalUri(A.from({scheme:KC,path:r,query:`session=${e}`}));try{return n(i)}catch{return o.error("Invalid path from debug adapter: "+i),n("/invalidDebugSource")}}var q$o=Ae("disassembly-editor-label-icon",R.debug,d(9974,null)),GR=class a extends ls{constructor(){super(...arguments);this.resource=void 0}static{this.ID="debug.disassemblyView.input"}get typeId(){return a.ID}static get instance(){return(!a._instance||a._instance.isDisposed())&&(a._instance=new a),a._instance}getName(){return d(9975,null)}getIcon(){return q$o}matches(e){return e instanceof a}};var Uo=le("textFileService");var fRt=class extends ta{constructor(e,t,o){super(e,10);this.textFileOperationResult=t;this.options=o}static isTextFileOperationError(e){return e instanceof Error&&!nr(e.textFileOperationResult)}};function y9e(a){let i=a;return ght(i.setEncoding,i.getEncoding,i.save,i.revert,i.isDirty,i.getLanguageId)}function ITe(a){let i=!1;return{read(){return i?null:(i=!0,a)}}}function zto(a){if(!(typeof a>"u"))return typeof a=="string"?qe.fromString(a):{read:()=>{let i=a.read();return typeof i=="string"?qe.fromString(i):null}}}var lA=class a{constructor(i,e,t,o,n=0,r=0,s=void 0,l=0,c=void 0,u=void 0){this.session=i;this.threadId=e;this._reference=t;this.id=o;this.namedVariables=n;this.indexedVariables=r;this.memoryReference=s;this.startOfVariables=l;this.presentationHint=c;this.valueLocationReference=u;this.valueChanged=!1;this._value=""}static{this.allValues=new Map}static{this.BASE_CHUNK_SIZE=100}get reference(){return this._reference}set reference(i){this._reference=i,this.children=void 0}async evaluateLazy(){if(typeof this.reference>"u")return;let i=await this.session.variables(this.reference,this.threadId,void 0,void 0,void 0);if(!i||!i.body||!i.body.variables||i.body.variables.length!==1)return;let e=i.body.variables[0];this.reference=e.variablesReference,this._value=e.value,this.namedVariables=e.namedVariables,this.indexedVariables=e.indexedVariables,this.memoryReference=e.memoryReference,this.presentationHint=e.presentationHint,this.valueLocationReference=e.valueLocationReference,this.adoptLazyResponse(e)}adoptLazyResponse(i){}getChildren(){return this.children||(this.children=this.doGetChildren()),this.children}async doGetChildren(){if(!this.hasChildren)return[];if(!this.getChildrenInChunks)return this.fetchVariables(void 0,void 0,void 0);let i=this.namedVariables?await this.fetchVariables(void 0,void 0,"named"):[],e=a.BASE_CHUNK_SIZE;for(;this.indexedVariables&&this.indexedVariables>e*a.BASE_CHUNK_SIZE;)e*=a.BASE_CHUNK_SIZE;if(this.indexedVariables&&this.indexedVariables>e){let o=Math.ceil(this.indexedVariables/e);for(let n=0;n<o;n++){let r=(this.startOfVariables||0)+n*e,s=Math.min(e,this.indexedVariables-n*e);i.push(new $l(this.session,this.threadId,this,this.reference,`[${r}..${r+s-1}]`,"","",void 0,s,void 0,{kind:"virtual"},void 0,void 0,!0,r))}return i}let t=await this.fetchVariables(this.startOfVariables,this.indexedVariables,"indexed");return i.concat(t)}getId(){return this.id}getSession(){return this.session}get value(){return this._value}get hasChildren(){return!!this.reference&&this.reference>0&&!this.presentationHint?.lazy}async fetchVariables(i,e,t){try{let o=await this.session.variables(this.reference||0,this.threadId,t,i,e);if(!o||!o.body||!o.body.variables)return[];let n=new Map,r=o.body.variables.filter(s=>!!s).map(s=>{if(Fe(s.value)&&Fe(s.name)&&typeof s.variablesReference=="number"){let l=n.get(s.name)||0,c=l>0?l.toString():"";return n.set(s.name,l+1),new $l(this.session,this.threadId,this,s.variablesReference,s.name,s.evaluateName,s.value,s.namedVariables,s.indexedVariables,s.memoryReference,s.presentationHint,s.type,s.__vscodeVariableMenuContext,!0,0,c,s.declarationLocationReference,s.valueLocationReference)}return new $l(this.session,this.threadId,this,0,"",void 0,d(9924,null),0,0,void 0,{kind:"virtual"},void 0,void 0,!1)});return this.session.autoExpandLazyVariables&&await Promise.all(r.map(s=>s.presentationHint?.lazy&&s.evaluateLazy())),r}catch(o){return[new $l(this.session,this.threadId,this,0,"",void 0,o.message,0,0,void 0,{kind:"virtual"},void 0,void 0,!1)]}}get getChildrenInChunks(){return!!this.indexedVariables}set value(i){this._value=i,this.valueChanged=!!a.allValues.get(this.getId())&&a.allValues.get(this.getId())!==dd.DEFAULT_VALUE&&a.allValues.get(this.getId())!==i,a.allValues.set(this.getId(),i)}toString(){return this.value}async evaluateExpression(i,e,t,o,n=!1,r){if(!e||!t&&o!=="repl")return this.value=o==="repl"?d(9929,null):dd.DEFAULT_VALUE,this.reference=0,!1;this.session=e;try{let s=await e.evaluate(i,t?t.frameId:void 0,o,r);return s&&s.body?(this.value=s.body.result||"",this.reference=s.body.variablesReference,this.namedVariables=s.body.namedVariables,this.indexedVariables=s.body.indexedVariables,this.memoryReference=s.body.memoryReference,this.type=s.body.type||this.type,this.presentationHint=s.body.presentationHint,this.valueLocationReference=s.body.valueLocationReference,!n&&s.body.presentationHint?.lazy&&await this.evaluateLazy(),!0):!1}catch(s){return this.value=s.message||"",this.reference=0,this.memoryReference=void 0,!1}}};function Qhi(a,i){i&&i.body&&(a.value=i.body.value||"",a.type=i.body.type||a.type,a.reference=i.body.variablesReference,a.namedVariables=i.body.namedVariables,a.indexedVariables=i.body.indexedVariables,a.memoryReference=i.body.memoryReference,a.valueLocationReference=i.body.valueLocationReference)}var qR=class{constructor(i,e,t,o,n){this.session=i;this.visualizer=e;this.treeId=t;this.treeItem=o;this.original=n;this.id=xt()}evaluateLazy(){return Promise.resolve()}getChildren(){return this.visualizer.getVisualizedChildren(this.session,this.treeId,this.treeItem.id)}getId(){return this.id}get name(){return this.treeItem.label}get value(){return this.treeItem.description||""}get hasChildren(){return this.treeItem.collapsibleState!==0}getSession(){return this.session}async edit(i){try{return await this.visualizer.editTreeItem(this.treeId,this.treeItem,i),!0}catch(e){return this.errorMessage=e.message,!1}}},dd=class a extends lA{constructor(e,t=xt()){super(void 0,void 0,0,t);this.name=e;this._onDidChangeValue=new E;this.onDidChangeValue=this._onDidChangeValue.event;this.available=!1,e&&(this.value=a.DEFAULT_VALUE)}static{this.DEFAULT_VALUE=d(9925,null)}async evaluate(e,t,o,n,r){let s=this.value===a.DEFAULT_VALUE;this.available=await this.evaluateExpression(this.name,e,t,o,n,r),(s||this.valueChanged)&&this._onDidChangeValue.fire(this)}toString(){return`${this.name}
${this.value}`}toJSON(){return{sessionId:this.getSession()?.getId(),variable:this.toDebugProtocolObject()}}toDebugProtocolObject(){return{name:this.name,variablesReference:this.reference||0,memoryReference:this.memoryReference,value:this.value,type:this.type,evaluateName:this.name}}async setExpression(e,t){if(!this.session)return;let o=await this.session.setExpression(t.frameId,this.name,e);Qhi(this,o)}},$l=class extends lA{constructor(e,t,o,n,r,s,l,c,u,p,h,g=void 0,f=void 0,v=!0,b=0,S="",y=void 0,w=void 0){super(e,t,n,`variable:${o.getId()}:${r}:${S}`,c,u,p,b,h,w);this.parent=o;this.name=r;this.evaluateName=s;this.variableMenuContext=f;this.available=v;this.declarationLocationReference=y;this.value=l||"",this.type=g}getThreadId(){return this.threadId}async setVariable(e,t){if(this.session)try{if(this.session.capabilities.supportsSetExpression&&!this.session.capabilities.supportsSetVariable&&this.evaluateName)return this.setExpression(e,t);let o=await this.session.setVariable(this.parent.reference,this.name,e);Qhi(this,o)}catch(o){this.errorMessage=o.message}}async setExpression(e,t){if(!this.session||!this.evaluateName)return;let o=await this.session.setExpression(t.frameId,this.evaluateName,e);Qhi(this,o)}toString(){return this.name?`${this.name}: ${this.value}`:this.value}toJSON(){return{sessionId:this.getSession()?.getId(),container:this.parent instanceof dd?{expression:this.parent.name}:this.parent.toDebugProtocolObject(),variable:this.toDebugProtocolObject()}}adoptLazyResponse(e){this.evaluateName=e.evaluateName}toDebugProtocolObject(){return{name:this.name,variablesReference:this.reference||0,memoryReference:this.memoryReference,value:this.value,type:this.type,evaluateName:this.evaluateName}}},qK=class extends lA{constructor(e,t,o,n,r,s,l,c){super(e.thread.session,e.thread.threadId,n,`scope:${o}:${t}`,s,l);this.stackFrame=e;this.name=o;this.expensive=r;this.range=c}get childrenHaveBeenLoaded(){return!!this.children}toString(){return this.name}toDebugProtocolObject(){return{name:this.name,variablesReference:this.reference||0,expensive:this.expensive}}},C9e=class extends qK{constructor(i,e,t){super(i,e,t,0,!1)}toString(){return this.name}},pT=class{constructor(i,e,t,o,n,r,s,l,c){this.thread=i;this.frameId=e;this.source=t;this.name=o;this.presentationHint=n;this.range=r;this.index=s;this.canRestart=l;this.instructionPointerReference=c}getId(){return`stackframe:${this.thread.getId()}:${this.index}:${this.source.name}`}getScopes(){return this.scopes||(this.scopes=this.thread.session.scopes(this.frameId,this.thread.threadId).then(i=>{if(!i||!i.body||!i.body.scopes)return[];let e=new Set;return i.body.scopes.map(t=>{let o=0;do o=CIe(`${t.name}:${t.line}:${t.column}`,o);while(e.has(o));return e.add(o),new qK(this,o,t.name,t.variablesReference,t.expensive,t.namedVariables,t.indexedVariables,t.line&&t.column&&t.endLine&&t.endColumn?new z(t.line,t.column,t.endLine,t.endColumn):void 0)})},i=>[new C9e(this,0,i.message)])),this.scopes}async getMostSpecificScopes(i){let t=(await this.getScopes()).filter(r=>!r.expensive);if(!t.some(r=>!!r.range))return t;let n=t.filter(r=>r.range&&z.containsRange(r.range,i)).sort((r,s)=>r.range.endLineNumber-r.range.startLineNumber-(s.range.endLineNumber-s.range.startLineNumber));return n.length?n:t}restart(){return this.thread.session.restartFrame(this.frameId,this.thread.threadId)}forgetScopes(){this.scopes=void 0}toString(){let i=typeof this.range.startLineNumber=="number"?`:${this.range.startLineNumber}`:"",e=`${this.source.inMemory?this.source.name:this.source.uri.fsPath}${i}`;return e===gRt?this.name:`${this.name} (${e})`}async openInEditor(i,e,t,o){let n=this.thread.stoppedDetails?.reason;if(this.instructionPointerReference&&(n==="instruction breakpoint"&&!e||n==="step"&&this.thread.lastSteppingGranularity==="instruction"&&!e||i.activeEditor instanceof GR))return i.openEditor(GR.instance,{pinned:!0,revealIfOpened:!0,preserveFocus:e});if(this.source.available)return this.source.openInEditor(i,this.range,e,t,o)}equals(i){return this.name===i.name&&i.thread===this.thread&&this.frameId===i.frameId&&i.source===this.source&&z.equalsRange(this.range,i.range)}},Q$o=["breakpoint","step","function breakpoint"],cA=class{constructor(i,e,t){this.session=i;this.name=e;this.threadId=t;this.callStackCancellationTokens=[];this.reachedEndOfCallStack=!1;this.callStack=[],this.staleCallStack=[],this.stopped=!1}getId(){return`thread:${this.session.getId()}:${this.threadId}`}clearCallStack(){this.callStack.length&&(this.staleCallStack=this.callStack),this.callStack=[],this.callStackCancellationTokens.forEach(i=>i.dispose(!0)),this.callStackCancellationTokens=[]}getCallStack(){return this.callStack}getStaleCallStack(){return this.staleCallStack}getTopStackFrame(){let i=this.getCallStack(),e=this.stoppedDetails?.reason;return i.find(o=>!!((e==="instruction breakpoint"||e==="step"&&this.lastSteppingGranularity==="instruction")&&o.instructionPointerReference||o.source&&o.source.available&&(Q$o.includes(e)||!KK(o))))}get stateLabel(){return this.stoppedDetails?this.stoppedDetails.description||(this.stoppedDetails.reason?d(9927,null,this.stoppedDetails.reason):d(9926,null)):d(9928,null)}async fetchCallStack(i=20){if(this.stopped){let e=this.callStack.length,t=await this.getCallStackImpl(e,i);this.reachedEndOfCallStack=t.length<i,e<this.callStack.length&&this.callStack.splice(e,this.callStack.length-e),this.callStack=this.callStack.concat(t||[]),typeof this.stoppedDetails?.totalFrames=="number"&&this.stoppedDetails.totalFrames===this.callStack.length&&(this.reachedEndOfCallStack=!0)}}async getCallStackImpl(i,e){try{let t=new Ye;this.callStackCancellationTokens.push(t);let o=await this.session.stackTrace(this.threadId,i,e,t.token);return!o||!o.body||t.token.isCancellationRequested?[]:(this.stoppedDetails&&(this.stoppedDetails.totalFrames=o.body.totalFrames),o.body.stackFrames.map((n,r)=>{let s=this.session.getSource(n.source);return new pT(this,n.id,s,n.name,n.presentationHint,new z(n.line,n.column,n.endLine||n.line,n.endColumn||n.column),i+r,typeof n.canRestart=="boolean"?n.canRestart:!0,n.instructionPointerReference)}))}catch(t){return this.stoppedDetails&&(this.stoppedDetails.framesErrorMessage=t.message),[]}}get exceptionInfo(){return this.stoppedDetails&&this.stoppedDetails.reason==="exception"?this.session.capabilities.supportsExceptionInfoRequest?this.session.exceptionInfo(this.threadId):Promise.resolve({description:this.stoppedDetails.text,breakMode:null}):Promise.resolve(void 0)}next(i){return this.session.next(this.threadId,i)}stepIn(i){return this.session.stepIn(this.threadId,void 0,i)}stepOut(i){return this.session.stepOut(this.threadId,i)}stepBack(i){return this.session.stepBack(this.threadId,i)}continue(){return this.session.continue(this.threadId)}pause(){return this.session.pause(this.threadId)}terminate(){return this.session.terminateThreads([this.threadId])}reverseContinue(){return this.session.reverseContinue(this.threadId)}},Kto=(a,i,e,t="memory")=>A.from({scheme:lue,authority:a,path:"/"+encodeURIComponent(i)+`/${encodeURIComponent(t)}.bin`,query:e?`?range=${e.fromOffset}:${e.toOffset}`:void 0}),vRt=class extends x{constructor(e,t){super();this.memoryReference=e;this.session=t;this.invalidateEmitter=this._register(new E);this.onDidInvalidate=this.invalidateEmitter.event;this.writable=!!this.session.capabilities.supportsWriteMemoryRequest,this._register(t.onDidInvalidateMemory(o=>{o.body.memoryReference===e&&this.invalidate(o.body.offset,o.body.count-o.body.offset)}))}async read(e,t){let o=t-e,n=e,r=await this.session.readMemory(this.memoryReference,n,o);if(r===void 0||!r.body?.data)return[{type:1,offset:n,length:o}];let s;try{s=qa(r.body.data)}catch{return[{type:2,offset:n,length:o,error:"Invalid base64 data from debug adapter"}]}let l=r.body.unreadableBytes||0,c=o-l;if(s.byteLength<c){let u=qe.alloc(c-s.byteLength);u.buffer.fill(0),s=qe.concat([s,u],c)}else s.byteLength>c&&(s=s.slice(0,c));return l?[{type:0,offset:n,length:c,data:s},{type:1,offset:n+c,length:l}]:[{type:0,offset:n,length:o,data:s}]}async write(e,t){let n=(await this.session.writeMemory(this.memoryReference,e,Yd(t),!0))?.body?.bytesWritten??t.byteLength;return this.invalidate(e,e+n),n}dispose(){super.dispose()}invalidate(e,t){this.invalidateEmitter.fire({fromOffset:e,toOffset:t})}},Yhi=class{constructor(i,e){this.enabled=i;this.id=e}getId(){return this.id}};function w9e(a,i){return Xu({supportsConditionalBreakpoints:!!i.supportsConditionalBreakpoints,supportsHitConditionalBreakpoints:!!i.supportsHitConditionalBreakpoints,supportsLogPoints:!!i.supportsLogPoints,supportsFunctionBreakpoints:!!i.supportsFunctionBreakpoints,supportsDataBreakpoints:!!i.supportsDataBreakpoints,supportsInstructionBreakpoints:!!i.supportsInstructionBreakpoints},a)}var due=class extends Yhi{constructor(e,t){super(t.enabled??!0,e);this.sessionData=new Map;this.condition=t.condition,this.hitCondition=t.hitCondition,this.logMessage=t.logMessage,this.mode=t.mode,this.modeLabel=t.modeLabel}setSessionData(e,t){t?(t.sessionId=e,this.sessionData.set(e,t)):this.sessionData.delete(e);let o=Array.from(this.sessionData.values()),n=zo(o.filter(r=>r.verified),r=>`${r.line}:${r.column}`);n.length?this.data=n.length===1?n[0]:void 0:this.data=o.length?o[0]:void 0}get message(){if(this.data)return this.data.message}get verified(){return this.data?this.data.verified:!0}get sessionsThatVerified(){let e=[];for(let[t,o]of this.sessionData)o.verified&&e.push(t);return e}getIdFromAdapter(e){let t=this.sessionData.get(e);return t?t.id:void 0}getDebugProtocolBreakpoint(e){let t=this.sessionData.get(e);if(t)return{id:t.id,verified:t.verified,message:t.message,source:t.source,line:t.line,column:t.column,endLine:t.endLine,endColumn:t.endColumn,instructionReference:t.instructionReference,offset:t.offset}}toJSON(){return{id:this.getId(),enabled:this.enabled,condition:this.condition,hitCondition:this.hitCondition,logMessage:this.logMessage,mode:this.mode,modeLabel:this.modeLabel}}},Nv=class extends due{constructor(e,t,o,n,r=xt()){super(r,e);this.textFileService=t;this.uriIdentityService=o;this.logService=n;this._uri=e.uri,this._lineNumber=e.lineNumber,this._column=e.column,this._adapterData=e.adapterData,this.triggeredBy=e.triggeredBy}toDAP(){return{line:this.sessionAgnosticData.lineNumber,column:this.sessionAgnosticData.column,condition:this.condition,hitCondition:this.hitCondition,logMessage:this.logMessage,mode:this.mode}}get originalUri(){return this._uri}get lineNumber(){return this.verified&&this.data&&typeof this.data.line=="number"?this.data.line:this._lineNumber}get verified(){return this.data?this.data.verified&&!this.textFileService.isDirty(this._uri):!0}get pending(){return this.data?!1:this.triggeredBy!==void 0}get uri(){return this.verified&&this.data&&this.data.source?I9e(this.data.source,this.data.source.path,this.data.sessionId,this.uriIdentityService,this.logService):this._uri}get column(){return this.verified&&this.data&&typeof this.data.column=="number"?this.data.column:this._column}get message(){return this.textFileService.isDirty(this.uri)?d(9923,null):super.message}get adapterData(){return this.data&&this.data.source&&this.data.source.adapterData?this.data.source.adapterData:this._adapterData}get endLineNumber(){return this.verified&&this.data?this.data.endLine:void 0}get endColumn(){return this.verified&&this.data?this.data.endColumn:void 0}get sessionAgnosticData(){return{lineNumber:this._lineNumber,column:this._column}}get supported(){return this.data?!(this.logMessage&&!this.data.supportsLogPoints||this.condition&&!this.data.supportsConditionalBreakpoints||this.hitCondition&&!this.data.supportsHitConditionalBreakpoints):!0}setSessionData(e,t){super.setSessionData(e,t),this._adapterData||(this._adapterData=this.adapterData)}toJSON(){return{...super.toJSON(),uri:this._uri,lineNumber:this._lineNumber,column:this._column,adapterData:this.adapterData,triggeredBy:this.triggeredBy}}toString(){return`${Ga(this.uri)} ${this.lineNumber}`}setSessionDidTrigger(e,t=!0){t?(this.sessionsDidTrigger??=new Set,this.sessionsDidTrigger.add(e)):this.sessionsDidTrigger?.delete(e)}getSessionDidTrigger(e){return!!this.sessionsDidTrigger?.has(e)}update(e){e.hasOwnProperty("lineNumber")&&!nr(e.lineNumber)&&(this._lineNumber=e.lineNumber),e.hasOwnProperty("column")&&(this._column=e.column),e.hasOwnProperty("condition")&&(this.condition=e.condition),e.hasOwnProperty("hitCondition")&&(this.hitCondition=e.hitCondition),e.hasOwnProperty("logMessage")&&(this.logMessage=e.logMessage),e.hasOwnProperty("mode")&&(this.mode=e.mode,this.modeLabel=e.modeLabel),e.hasOwnProperty("triggeredBy")&&(this.triggeredBy=e.triggeredBy,this.sessionsDidTrigger=void 0)}},mI=class extends due{constructor(i,e=xt()){super(e,i),this.name=i.name}toDAP(){return{name:this.name,condition:this.condition,hitCondition:this.hitCondition}}toJSON(){return{...super.toJSON(),name:this.name}}get supported(){return this.data?this.data.supportsFunctionBreakpoints:!0}toString(){return this.name}},hy=class extends due{constructor(e,t=xt()){super(t,e);this.sessionDataIdForAddr=new WeakMap;this.description=e.description,"dataId"in e&&(e.src={type:0,dataId:e.dataId}),this.src=e.src,this.canPersist=e.canPersist,this.accessTypes=e.accessTypes,this.accessType=e.accessType,e.initialSessionData&&this.sessionDataIdForAddr.set(e.initialSessionData.session,e.initialSessionData.dataId)}async toDAP(e){let t;if(this.src.type===0)t=this.src.dataId;else{let o=this.sessionDataIdForAddr.get(e);if(!o){if(o=(await e.dataBytesBreakpointInfo(this.src.address,this.src.bytes))?.dataId,!o)return;this.sessionDataIdForAddr.set(e,o)}t=o}return{dataId:t,accessType:this.accessType,condition:this.condition,hitCondition:this.hitCondition}}toJSON(){return{...super.toJSON(),description:this.description,src:this.src,accessTypes:this.accessTypes,accessType:this.accessType,canPersist:this.canPersist}}get supported(){return this.data?this.data.supportsDataBreakpoints:!0}toString(){return this.description}},dA=class extends due{constructor(e,t=xt()){super(t,e);this.supportedSessions=new Set;this.fallback=!1;this.filter=e.filter,this.label=e.label,this.supportsCondition=e.supportsCondition,this.description=e.description,this.conditionDescription=e.conditionDescription,this.fallback=e.fallback||!1}toJSON(){return{...super.toJSON(),filter:this.filter,label:this.label,enabled:this.enabled,supportsCondition:this.supportsCondition,conditionDescription:this.conditionDescription,condition:this.condition,fallback:this.fallback,description:this.description}}setSupportedSession(e,t){t?this.supportedSessions.add(e):this.supportedSessions.delete(e)}setFallback(e){this.fallback=e}get supported(){return!0}isSupportedSession(e){return e?this.supportedSessions.has(e):this.fallback}matches(e){return this.filter===e.filter&&this.label===e.label&&this.supportsCondition===!!e.supportsCondition&&this.conditionDescription===e.conditionDescription&&this.description===e.description}toString(){return this.label}},hI=class extends due{constructor(i,e=xt()){super(e,i),this.instructionReference=i.instructionReference,this.offset=i.offset,this.canPersist=i.canPersist,this.address=i.address}toDAP(){return{instructionReference:this.instructionReference,condition:this.condition,hitCondition:this.hitCondition,mode:this.mode,offset:this.offset}}toJSON(){return{...super.toJSON(),instructionReference:this.instructionReference,offset:this.offset,canPersist:this.canPersist,address:this.address}}get supported(){return this.data?this.data.supportsInstructionBreakpoints:!0}toString(){return this.instructionReference}},mJ=class{constructor(i,e){this.sessionId=i;this.threadId=e}getId(){return`${this.sessionId}:${this.threadId}`}},yTe=class extends x{constructor(e,t,o,n){super();this.textFileService=t;this.uriIdentityService=o;this.logService=n;this.schedulers=new Map;this.breakpointsActivated=!0;this._onDidChangeBreakpoints=this._register(new E);this._onDidChangeCallStack=this._register(new E);this._onDidChangeCallStackFire=this._register(new Dt(()=>{this._onDidChangeCallStack.fire(void 0)},100));this._onDidChangeWatchExpressions=this._register(new E);this._onDidChangeWatchExpressionValue=this._register(new E);this._breakpointModes=new Map;this._register(be(r=>{this.breakpoints=e.breakpoints.read(r),this.functionBreakpoints=e.functionBreakpoints.read(r),this.exceptionBreakpoints=e.exceptionBreakpoints.read(r),this.dataBreakpoints=e.dataBreakpoints.read(r),this._onDidChangeBreakpoints.fire(void 0)})),this._register(be(r=>{this.watchExpressions=e.watchExpressions.read(r),this._onDidChangeWatchExpressions.fire(void 0)})),this._register(aGi(()=>new Set(this.watchExpressions),this.onDidChangeWatchExpressions,r=>r.onDidChangeValue(s=>this._onDidChangeWatchExpressionValue.fire(s)))),this.instructionBreakpoints=[],this.sessions=[]}getId(){return"root"}getSession(e,t=!1){if(e)return this.getSessions(t).find(o=>o.getId()===e)}getSessions(e=!1){return this.sessions.filter(t=>e||t.state!==0)}addSession(e){this.sessions=this.sessions.filter(n=>n.getId()===e.getId()?!1:n.state===0&&n.configuration.name===e.configuration.name?(n.dispose(),!1):!0);let t=1;for(;this.sessions.some(n=>n.getLabel()===e.getLabel());)e.setName(`${e.configuration.name} ${++t}`);let o=-1;e.parentSession&&(o=this.sessions.findLastIndex(n=>n.parentSession===e.parentSession||n===e.parentSession)),o>=0?this.sessions.splice(o+1,0,e):this.sessions.push(e),this._onDidChangeCallStack.fire(void 0)}get onDidChangeBreakpoints(){return this._onDidChangeBreakpoints.event}get onDidChangeCallStack(){return this._onDidChangeCallStack.event}get onDidChangeWatchExpressions(){return this._onDidChangeWatchExpressions.event}get onDidChangeWatchExpressionValue(){return this._onDidChangeWatchExpressionValue.event}rawUpdate(e){let t=this.sessions.find(o=>o.getId()===e.sessionId);t&&(t.rawUpdate(e),this._onDidChangeCallStack.fire(void 0))}clearThreads(e,t,o=void 0){let n=this.sessions.find(r=>r.getId()===e);if(n){let r;if(o===void 0)r=n.getAllThreads();else{let s=n.getThread(o);r=s!==void 0?[s]:[]}for(let s of r){let l=s.getId(),c=this.schedulers.get(l);c!==void 0&&(c.scheduler.dispose(),c.completeDeferred.complete(),this.schedulers.delete(l))}n.clearThreads(t,o),this._onDidChangeCallStackFire.isScheduled()||this._onDidChangeCallStackFire.schedule()}}async fetchCallstack(e,t){if(e.reachedEndOfCallStack)return;let o=e.stoppedDetails?.totalFrames,n=typeof o=="number"?o-e.getCallStack().length:void 0;(!t||n&&t>n)&&(t=n),t&&t>0&&(await e.fetchCallStack(t),this._onDidChangeCallStack.fire())}refreshTopOfCallstack(e,t=!0){if(e.session.capabilities.supportsDelayedStackTraceLoading){let n=Promise.resolve(),r=new Promise((s,l)=>{n=e.fetchCallStack(1).then(()=>{if(!t){s(),this._onDidChangeCallStack.fire();return}if(!this.schedulers.has(e.getId())){let u=new Ko;this.schedulers.set(e.getId(),{completeDeferred:u,scheduler:new Dt(()=>{e.fetchCallStack(19).then(()=>{let p=e.getStaleCallStack(),h=e.getCallStack(),g=p.length!==h.length;for(let f=1;f<p.length&&!g;f++)g=!p[f].equals(h[f]);g&&this._onDidChangeCallStack.fire()}).finally(()=>{u.complete(),this.schedulers.delete(e.getId())})},420)})}let c=this.schedulers.get(e.getId());c.scheduler.schedule(),c.completeDeferred.p.then(s,l),this._onDidChangeCallStack.fire()})});return{topCallStack:n,wholeCallStack:r}}let o=e.fetchCallStack();return{wholeCallStack:o,topCallStack:o}}getBreakpoints(e){if(e){let t=e.uri?.toString(),o=e.originalUri?.toString();return this.breakpoints.filter(n=>!(t&&n.uri.toString()!==t||o&&n.originalUri.toString()!==o||e.lineNumber&&n.lineNumber!==e.lineNumber||e.column&&n.column!==e.column||e.enabledOnly&&(!this.breakpointsActivated||!n.enabled)||e.triggeredOnly&&n.triggeredBy===void 0))}return this.breakpoints}getFunctionBreakpoints(){return this.functionBreakpoints}getDataBreakpoints(){return this.dataBreakpoints}getExceptionBreakpoints(){return this.exceptionBreakpoints}getExceptionBreakpointsForSession(e){return this.exceptionBreakpoints.filter(t=>t.isSupportedSession(e))}getInstructionBreakpoints(){return this.instructionBreakpoints}setExceptionBreakpointsForSession(e,t){if(!t)return;let o=!1;t.forEach(n=>{let r=this.exceptionBreakpoints.filter(s=>s.matches(n)).pop();r||(o=!0,r=new dA({filter:n.filter,label:n.label,enabled:!!n.default,supportsCondition:!!n.supportsCondition,description:n.description,conditionDescription:n.conditionDescription}),this.exceptionBreakpoints.push(r)),r.setSupportedSession(e,!0)}),o&&this._onDidChangeBreakpoints.fire(void 0)}removeExceptionBreakpointsForSession(e){this.exceptionBreakpoints.forEach(t=>t.setSupportedSession(e,!1))}setExceptionBreakpointFallbackSession(e){this.exceptionBreakpoints.forEach(t=>t.setFallback(t.isSupportedSession(e)))}setExceptionBreakpointCondition(e,t){e.condition=t,this._onDidChangeBreakpoints.fire(void 0)}areBreakpointsActivated(){return this.breakpointsActivated}setBreakpointsActivated(e){this.breakpointsActivated=e,this._onDidChangeBreakpoints.fire(void 0)}addBreakpoints(e,t,o=!0){let n=t.map(r=>new Nv({uri:e,lineNumber:r.lineNumber,column:r.column,enabled:r.enabled??!0,condition:r.condition,hitCondition:r.hitCondition,logMessage:r.logMessage,triggeredBy:r.triggeredBy,adapterData:void 0,mode:r.mode,modeLabel:r.modeLabel},this.textFileService,this.uriIdentityService,this.logService,r.id));return this.breakpoints=this.breakpoints.concat(n),this.breakpointsActivated=!0,this.sortAndDeDup(),o&&this._onDidChangeBreakpoints.fire({added:n,sessionOnly:!1}),n}removeBreakpoints(e){this.breakpoints=this.breakpoints.filter(t=>!e.some(o=>o.getId()===t.getId())),this._onDidChangeBreakpoints.fire({removed:e,sessionOnly:!1})}updateBreakpoints(e){let t=[];this.breakpoints.forEach(o=>{let n=e.get(o.getId());n&&(o.update(n),t.push(o))}),this.sortAndDeDup(),this._onDidChangeBreakpoints.fire({changed:t,sessionOnly:!1})}setBreakpointSessionData(e,t,o){this.breakpoints.forEach(n=>{if(!o)n.setSessionData(e,void 0);else{let r=o.get(n.getId());r&&n.setSessionData(e,w9e(r,t))}}),this.functionBreakpoints.forEach(n=>{if(!o)n.setSessionData(e,void 0);else{let r=o.get(n.getId());r&&n.setSessionData(e,w9e(r,t))}}),this.dataBreakpoints.forEach(n=>{if(!o)n.setSessionData(e,void 0);else{let r=o.get(n.getId());r&&n.setSessionData(e,w9e(r,t))}}),this.exceptionBreakpoints.forEach(n=>{if(!o)n.setSessionData(e,void 0);else{let r=o.get(n.getId());r&&n.setSessionData(e,w9e(r,t))}}),this.instructionBreakpoints.forEach(n=>{if(!o)n.setSessionData(e,void 0);else{let r=o.get(n.getId());r&&n.setSessionData(e,w9e(r,t))}}),this._onDidChangeBreakpoints.fire({sessionOnly:!0})}getDebugProtocolBreakpoint(e,t){let o=this.breakpoints.find(n=>n.getId()===e);if(o)return o.getDebugProtocolBreakpoint(t)}getBreakpointModes(e){return[...this._breakpointModes.values()].filter(t=>t.appliesTo.includes(e))}registerBreakpointModes(e,t){for(let o of t){let n=`${o.mode}/${o.label}`,r=this._breakpointModes.get(n);if(r)for(let s of o.appliesTo)r.appliesTo.includes(s)||r.appliesTo.push(s);else{let s=[...this._breakpointModes.values()].find(l=>l!==r&&l.label===o.label);s&&(s.label=`${s.label} (${s.firstFromDebugType})`),this._breakpointModes.set(n,{mode:o.mode,label:s?`${o.label} (${e})`:o.label,firstFromDebugType:e,description:o.description,appliesTo:o.appliesTo.slice()})}}}sortAndDeDup(){this.breakpoints=this.breakpoints.sort((e,t)=>e.uri.toString()!==t.uri.toString()?Ga(e.uri).localeCompare(Ga(t.uri)):e.lineNumber===t.lineNumber?e.column&&t.column?e.column-t.column:1:e.lineNumber-t.lineNumber),this.breakpoints=zo(this.breakpoints,e=>`${e.uri.toString()}:${e.lineNumber}:${e.column}`)}setEnablement(e,t){if(e instanceof Nv||e instanceof mI||e instanceof dA||e instanceof hy||e instanceof hI){let o=[];e.enabled!==t&&(e instanceof Nv||e instanceof mI||e instanceof hy||e instanceof hI)&&o.push(e),e.enabled=t,t&&(this.breakpointsActivated=!0),this._onDidChangeBreakpoints.fire({changed:o,sessionOnly:!1})}}enableOrDisableAllBreakpoints(e){let t=[];this.breakpoints.forEach(o=>{o.enabled!==e&&t.push(o),o.enabled=e}),this.functionBreakpoints.forEach(o=>{o.enabled!==e&&t.push(o),o.enabled=e}),this.dataBreakpoints.forEach(o=>{o.enabled!==e&&t.push(o),o.enabled=e}),this.instructionBreakpoints.forEach(o=>{o.enabled!==e&&t.push(o),o.enabled=e}),e&&(this.breakpointsActivated=!0),this._onDidChangeBreakpoints.fire({changed:t,sessionOnly:!1})}addFunctionBreakpoint(e,t){let o=new mI(e,t);return this.functionBreakpoints.push(o),this._onDidChangeBreakpoints.fire({added:[o],sessionOnly:!1}),o}updateFunctionBreakpoint(e,t){let o=this.functionBreakpoints.find(n=>n.getId()===e);o&&(typeof t.name=="string"&&(o.name=t.name),typeof t.condition=="string"&&(o.condition=t.condition),typeof t.hitCondition=="string"&&(o.hitCondition=t.hitCondition),this._onDidChangeBreakpoints.fire({changed:[o],sessionOnly:!1}))}removeFunctionBreakpoints(e){let t;e?(t=this.functionBreakpoints.filter(o=>o.getId()===e),this.functionBreakpoints=this.functionBreakpoints.filter(o=>o.getId()!==e)):(t=this.functionBreakpoints,this.functionBreakpoints=[]),this._onDidChangeBreakpoints.fire({removed:t,sessionOnly:!1})}addDataBreakpoint(e,t){let o=new hy(e,t);this.dataBreakpoints.push(o),this._onDidChangeBreakpoints.fire({added:[o],sessionOnly:!1})}updateDataBreakpoint(e,t){let o=this.dataBreakpoints.find(n=>n.getId()===e);o&&(typeof t.condition=="string"&&(o.condition=t.condition),typeof t.hitCondition=="string"&&(o.hitCondition=t.hitCondition),this._onDidChangeBreakpoints.fire({changed:[o],sessionOnly:!1}))}removeDataBreakpoints(e){let t;e?(t=this.dataBreakpoints.filter(o=>o.getId()===e),this.dataBreakpoints=this.dataBreakpoints.filter(o=>o.getId()!==e)):(t=this.dataBreakpoints,this.dataBreakpoints=[]),this._onDidChangeBreakpoints.fire({removed:t,sessionOnly:!1})}addInstructionBreakpoint(e){let t=new hI(e);this.instructionBreakpoints.push(t),this._onDidChangeBreakpoints.fire({added:[t],sessionOnly:!0})}removeInstructionBreakpoints(e,t){let o=[];if(e)for(let n=0;n<this.instructionBreakpoints.length;n++){let r=this.instructionBreakpoints[n];r.instructionReference===e&&(t===void 0||r.offset===t)&&(o.push(r),this.instructionBreakpoints.splice(n--,1))}else o=this.instructionBreakpoints,this.instructionBreakpoints=[];this._onDidChangeBreakpoints.fire({removed:o,sessionOnly:!1})}getWatchExpressions(){return this.watchExpressions}addWatchExpression(e){let t=new dd(e||"");return this.watchExpressions.push(t),this._onDidChangeWatchExpressions.fire(t),t}renameWatchExpression(e,t){let o=this.watchExpressions.filter(n=>n.getId()===e);o.length===1&&(o[0].name=t,this._onDidChangeWatchExpressions.fire(o[0]))}removeWatchExpressions(e=null){this.watchExpressions=e?this.watchExpressions.filter(t=>t.getId()!==e):[],this._onDidChangeWatchExpressions.fire(void 0)}moveWatchExpression(e,t){let o=this.watchExpressions.find(n=>n.getId()===e);o&&(this.watchExpressions=this.watchExpressions.filter(n=>n.getId()!==e),this.watchExpressions=this.watchExpressions.slice(0,t).concat(o,this.watchExpressions.slice(t)),this._onDidChangeWatchExpressions.fire(void 0))}sourceIsNotAvailable(e){this.sessions.forEach(t=>{let o=t.getSourceForUri(e);o&&(o.available=!1)}),this._onDidChangeCallStack.fire(void 0)}};yTe=I([m(1,Uo),m(2,ht),m(3,se)],yTe);var hJ=le("debugVisualizerService"),Jhi=class{constructor(i,e){this.handle=i;this.viz=e}get name(){return this.viz.name}get iconPath(){return this.viz.iconPath}get iconClass(){return this.viz.iconClass}async resolve(i){return this.viz.visualization??=await this.handle.resolveDebugVisualizer(this.viz,i)}async execute(){await this.handle.executeDebugVisualizerCommand(this.viz.id)}},Gto={object:[],dispose:()=>{}},wTe=class{constructor(i,e,t){this.contextKeyService=i;this.extensionService=e;this.logService=t;this.handles=new Map;this.trees=new Map;this.didActivate=new Map;this.registrations=[];Y$o.setHandler((o,{added:n,removed:r})=>{this.registrations=this.registrations.filter(s=>!r.some(l=>Ii.equals(l.description.identifier,s.extensionId))),n.forEach(s=>this.processExtensionRegistration(s.description))})}async getApplicableFor(i,e){if(!(i instanceof $l))return Gto;let t=i.getThreadId();if(t===void 0)return Gto;let o=this.getVariableContext(t,i),n=hRt(this.contextKeyService,i,[[nRt.key,i.name],[bTe.key,i.value],[uJ.key,i.type]]),r=await Promise.all(this.registrations.map(async l=>{if(!n.contextMatchesRules(l.expr))return;let c=this.didActivate.get(l.id);if(c||(c=this.extensionService.activateByEvent(`onDebugVisualizer:${l.id}`),this.didActivate.set(l.id,c)),await c,e.isCancellationRequested)return;let u=this.handles.get(qto(l.extensionId,l.id));return u&&{handle:u,result:await u.provideDebugVisualizers(o,e)}})),s={object:r.filter(lo).flatMap(l=>l.result.map(c=>new Jhi(l.handle,c))),dispose:()=>{for(let l of r)l?.handle.disposeDebugVisualizers(l.result.map(c=>c.id))}};return e.isCancellationRequested&&s.dispose(),s}register(i){let e=qto(i.extensionId,i.id);return this.handles.set(e,i),Z(()=>this.handles.delete(e))}registerTree(i,e){return this.trees.set(i,e),Z(()=>this.trees.delete(i))}async getVisualizedNodeFor(i,e){if(!(e instanceof $l))return;let t=e.getThreadId();if(t===void 0)return;let o=this.trees.get(i);if(o)try{let n=await o.getTreeItem(this.getVariableContext(t,e));return n?new qR(e.getSession(),this,i,n,e):void 0}catch(n){this.logService.warn("Failed to get visualized node",n);return}}async getVisualizedChildren(i,e,t){return(await this.trees.get(e)?.getChildren(t)||[]).map(r=>new qR(i,this,e,r,void 0))}async editTreeItem(i,e,t){let o=await this.trees.get(i)?.editItem?.(e.id,t);o&&Object.assign(e,o)}getVariableContext(i,e){let t={sessionId:e.getSession()?.getId()||"",containerId:e.parent instanceof $l?e.reference:void 0,threadId:i,variable:{name:e.name,value:e.value,type:e.type,evaluateName:e.evaluateName,variablesReference:e.reference||0,indexedVariables:e.indexedVariables,memoryReference:e.memoryReference,namedVariables:e.namedVariables,presentationHint:e.presentationHint}};for(let o=e;o instanceof $l;o=o.parent)o.parent instanceof qK&&(t.frameId=o.parent.stackFrame.frameId);return t}processExtensionRegistration(i){let e=i.contributes?.debugVisualizers;if(e instanceof Array)for(let{when:t,id:o}of e)try{let n=C.deserialize(t);n&&this.registrations.push({expr:n,id:o,extensionId:i.identifier})}catch(n){this.logService.error(`Error processing debug visualizer registration from extension '${i.identifier.value}'`,n)}}};wTe=I([m(0,X),m(1,lt),m(2,se)],wTe);var qto=(a,i)=>`${Ii.toKey(a)}\0${i}`,Y$o=Rn.registerExtensionPoint({extensionPoint:"debugVisualizers",jsonSchema:{type:"array",items:{type:"object",properties:{id:{type:"string",description:"Name of the debug visualizer"},when:{type:"string",description:"Condition when the debug visualizer is applicable"}},required:["id","when"]}},activationEventsGenerator:function*(a){for(let i of a)i.id&&(yield`onDebugVisualizer:${i.id}`)}});var bRt=class{constructor(i,e,t){this.debugService=e;this.visualizerService=t;this._toDispose=new N;this._debugAdaptersHandleCounter=1;this._visualizerHandles=new Map;this._visualizerTreeHandles=new Map;this._proxy=i.getProxy(to.ExtHostDebugService);let o=new Vt;this._toDispose.add(o),this._toDispose.add(e.onDidNewSession(r=>{this._proxy.$acceptDebugSessionStarted(this.getSessionDto(r)),o.get(r)?.add(r.onDidChangeName(l=>{this._proxy.$acceptDebugSessionNameChanged(this.getSessionDto(r),l)}))})),this._toDispose.add(e.onWillNewSession(r=>{let s=o.get(r);s||(s=new N,o.set(r,s)),s.add(r.onDidCustomEvent(l=>this._proxy.$acceptDebugSessionCustomEvent(this.getSessionDto(r),l)))})),this._toDispose.add(e.onDidEndSession(({session:r,restart:s})=>{this._proxy.$acceptDebugSessionTerminated(this.getSessionDto(r)),this._extHostKnownSessions.delete(r.getId()),s||o.deleteAndDispose(r);for(let[l,c]of this._debugAdapters)c.session===r&&this._debugAdapters.delete(l)})),this._toDispose.add(e.getViewModel().onDidFocusSession(r=>{this._proxy.$acceptDebugSessionActiveChanged(this.getSessionDto(r))})),this._toDispose.add(Z(()=>{for(let[r,s]of this._debugAdapters)s.fireError(r,new Error("Extension host shut down"))})),this._debugAdapters=new Map,this._debugConfigurationProviders=new Map,this._debugAdapterDescriptorFactories=new Map,this._extHostKnownSessions=new Set;let n=this.debugService.getViewModel();this._toDispose.add(U.any(n.onDidFocusStackFrame,n.onDidFocusThread)(()=>{let r=n.focusedStackFrame,s=n.focusedThread;r?this._proxy.$acceptStackFrameFocus({kind:"stackFrame",threadId:r.thread.threadId,frameId:r.frameId,sessionId:r.thread.session.getId()}):s?this._proxy.$acceptStackFrameFocus({kind:"thread",threadId:s.threadId,sessionId:s.session.getId()}):this._proxy.$acceptStackFrameFocus(void 0)})),this.sendBreakpointsAndListen()}$registerDebugVisualizerTree(i,e){this._visualizerTreeHandles.set(i,this.visualizerService.registerTree(i,{disposeItem:t=>this._proxy.$disposeVisualizedTree(t),getChildren:t=>this._proxy.$getVisualizerTreeItemChildren(i,t),getTreeItem:t=>this._proxy.$getVisualizerTreeItem(i,t),editItem:e?((t,o)=>this._proxy.$editVisualizerTreeItem(t,o)):void 0}))}$unregisterDebugVisualizerTree(i){this._visualizerTreeHandles.get(i)?.dispose(),this._visualizerTreeHandles.delete(i)}$registerDebugVisualizer(i,e){let t=this.visualizerService.register({extensionId:new Ii(i),id:e,disposeDebugVisualizers:o=>this._proxy.$disposeDebugVisualizers(o),executeDebugVisualizerCommand:o=>this._proxy.$executeDebugVisualizerCommand(o),provideDebugVisualizers:(o,n)=>this._proxy.$provideDebugVisualizers(i,e,o,n).then(r=>r.map(qhi.deserialize)),resolveDebugVisualizer:(o,n)=>this._proxy.$resolveDebugVisualizer(o.id,n)});this._visualizerHandles.set(`${i}/${e}`,t)}$unregisterDebugVisualizer(i,e){let t=`${i}/${e}`;this._visualizerHandles.get(t)?.dispose(),this._visualizerHandles.delete(t)}sendBreakpointsAndListen(){this._toDispose.add(this.debugService.getModel().onDidChangeBreakpoints(o=>{if(o&&!o.sessionOnly){let n={};o.added&&(n.added=this.convertToDto(o.added)),o.removed&&(n.removed=o.removed.map(r=>r.getId())),o.changed&&(n.changed=this.convertToDto(o.changed)),(n.added||n.removed||n.changed)&&this._proxy.$acceptBreakpointsDelta(n)}}));let i=this.debugService.getModel().getBreakpoints(),e=this.debugService.getModel().getFunctionBreakpoints(),t=this.debugService.getModel().getDataBreakpoints();(i.length>0||e.length>0)&&this._proxy.$acceptBreakpointsDelta({added:this.convertToDto(i).concat(this.convertToDto(e)).concat(this.convertToDto(t))})}dispose(){this._toDispose.dispose()}createDebugAdapter(i){let e=this._debugAdaptersHandleCounter++,t=new Zhi(this,e,this._proxy,i);return this._debugAdapters.set(e,t),t}substituteVariables(i,e){return Promise.resolve(this._proxy.$substituteVariables(i?i.uri:void 0,e))}runInTerminal(i,e){return this._proxy.$runInTerminal(i,e)}$registerDebugTypes(i){this._toDispose.add(this.debugService.getAdapterManager().registerDebugAdapterFactory(i,this))}$registerBreakpoints(i){for(let e of i)if(e.type==="sourceMulti"){let t=e.lines.map(o=>({id:o.id,enabled:o.enabled,lineNumber:o.line+1,column:o.character>0?o.character+1:void 0,condition:o.condition,hitCondition:o.hitCondition,logMessage:o.logMessage,mode:o.mode}));this.debugService.addBreakpoints(A.revive(e.uri),t)}else e.type==="function"?this.debugService.addFunctionBreakpoint({name:e.functionName,mode:e.mode,condition:e.condition,hitCondition:e.hitCondition,enabled:e.enabled,logMessage:e.logMessage},e.id):e.type==="data"&&this.debugService.addDataBreakpoint({description:e.label,src:{type:0,dataId:e.dataId},canPersist:e.canPersist,accessTypes:e.accessTypes,accessType:e.accessType,mode:e.mode});return Promise.resolve()}$unregisterBreakpoints(i,e,t){return i.forEach(o=>this.debugService.removeBreakpoints(o)),e.forEach(o=>this.debugService.removeFunctionBreakpoints(o)),t.forEach(o=>this.debugService.removeDataBreakpoints(o)),Promise.resolve()}$registerDebugConfigurationProvider(i,e,t,o,n,r){let s={type:i,triggerKind:e};return t&&(s.provideDebugConfigurations=(l,c)=>this._proxy.$provideDebugConfigurations(r,l,c)),o&&(s.resolveDebugConfiguration=(l,c,u)=>this._proxy.$resolveDebugConfiguration(r,l,c,u)),n&&(s.resolveDebugConfigurationWithSubstitutedVariables=(l,c,u)=>this._proxy.$resolveDebugConfigurationWithSubstitutedVariables(r,l,c,u)),this._debugConfigurationProviders.set(r,s),this._toDispose.add(this.debugService.getConfigurationManager().registerDebugConfigurationProvider(s)),Promise.resolve(void 0)}$unregisterDebugConfigurationProvider(i){let e=this._debugConfigurationProviders.get(i);e&&(this._debugConfigurationProviders.delete(i),this.debugService.getConfigurationManager().unregisterDebugConfigurationProvider(e))}$registerDebugAdapterDescriptorFactory(i,e){let t={type:i,createDebugAdapterDescriptor:o=>Promise.resolve(this._proxy.$provideDebugAdapter(e,this.getSessionDto(o)))};return this._debugAdapterDescriptorFactories.set(e,t),this._toDispose.add(this.debugService.getAdapterManager().registerDebugAdapterDescriptorFactory(t)),Promise.resolve(void 0)}$unregisterDebugAdapterDescriptorFactory(i){let e=this._debugAdapterDescriptorFactories.get(i);e&&(this._debugAdapterDescriptorFactories.delete(i),this.debugService.getAdapterManager().unregisterDebugAdapterDescriptorFactory(e))}getSession(i){if(i)return this.debugService.getModel().getSession(i,!0)}async $startDebugging(i,e,t){let o=i?A.revive(i):void 0,n=this.debugService.getConfigurationManager().getLaunch(o),r=this.getSession(t.parentSessionID),s=typeof t.suppressSaveBeforeStart=="boolean"?!t.suppressSaveBeforeStart:void 0,l={noDebug:t.noDebug,parentSession:r,lifecycleManagedByParent:t.lifecycleManagedByParent,repl:t.repl,compact:t.compact,compoundRoot:r?.compoundRoot,saveBeforeRestart:s,testRun:t.testRun,suppressDebugStatusbar:t.suppressDebugStatusbar,suppressDebugToolbar:t.suppressDebugToolbar,suppressDebugView:t.suppressDebugView};try{return this.debugService.startDebugging(n,e,l,s)}catch(c){throw new pa(c&&c.message?c.message:"cannot start debugging")}}$setDebugSessionName(i,e){this.debugService.getModel().getSession(i)?.setName(e)}$customDebugAdapterRequest(i,e,t){let o=this.debugService.getModel().getSession(i,!0);return o?o.customRequest(e,t).then(n=>n&&n.success?n.body:Promise.reject(new pa(n?n.message:"custom request failed"))):Promise.reject(new pa("debug session not found"))}$getDebugProtocolBreakpoint(i,e){let t=this.debugService.getModel().getSession(i,!0);return t?Promise.resolve(t.getDebugProtocolBreakpoint(e)):Promise.reject(new pa("debug session not found"))}$stopDebugging(i){if(i){let e=this.debugService.getModel().getSession(i,!0);if(e)return this.debugService.stopSession(e,cue(e))}else return this.debugService.stopSession(void 0);return Promise.reject(new pa("debug session not found"))}$appendDebugConsole(i){this.debugService.getViewModel().focusedSession?.appendToRepl({output:i,sev:bt.Warning})}$acceptDAMessage(i,e){this.getDebugAdapter(i).acceptMessage(Bto(e,!1))}$acceptDAError(i,e,t,o){this._debugAdapters.get(i)?.fireError(i,new Error(`${e}: ${t}
${o}`))}$acceptDAExit(i,e,t){this._debugAdapters.get(i)?.fireExit(i,e,t)}getDebugAdapter(i){let e=this._debugAdapters.get(i);if(!e)throw new Error("Invalid debug adapter");return e}$sessionCached(i){this._extHostKnownSessions.add(i)}getSessionDto(i){if(i){let e=i.getId();return this._extHostKnownSessions.has(e)?e:{id:e,type:i.configuration.type,name:i.name,folderUri:i.root?i.root.uri:void 0,configuration:i.configuration,parent:i.parentSession?.getId()}}}convertToDto(i){return i.map(e=>{if("name"in e){let t=e;return{type:"function",id:t.getId(),enabled:t.enabled,condition:t.condition,hitCondition:t.hitCondition,logMessage:t.logMessage,functionName:t.name}}else if("src"in e){let t=e;return{type:"data",id:t.getId(),dataId:t.src.type===0?t.src.dataId:t.src.address,enabled:t.enabled,condition:t.condition,hitCondition:t.hitCondition,logMessage:t.logMessage,accessType:t.accessType,label:t.description,canPersist:t.canPersist}}else if("uri"in e){let t=e;return{type:"source",id:t.getId(),enabled:t.enabled,condition:t.condition,hitCondition:t.hitCondition,logMessage:t.logMessage,uri:t.uri,line:t.lineNumber>0?t.lineNumber-1:0,character:typeof t.column=="number"&&t.column>0?t.column-1:0}}else return}).filter(lo)}};bRt=I([fo(qi.MainThreadDebugService),m(1,Ni),m(2,hJ)],bRt);var Zhi=class extends uRt{constructor(e,t,o,n){super();this._ds=e;this._handle=t;this._proxy=o;this.session=n}fireError(e,t){this._onError.fire(t)}fireExit(e,t,o){this._onExit.fire(t)}startSession(){return Promise.resolve(this._proxy.$startDASession(this._handle,this._ds.getSessionDto(this.session)))}sendMessage(e){this._proxy.$sendDAMessage(this._handle,Vto(e,!0))}async stopSession(){return await this.cancelPendingRequests(),Promise.resolve(this._proxy.$stopDASession(this._handle))}};var Ov=le("IFileDecorationsService");var egi=class{constructor(i,e){this._proxy=i;this._handle=e;this._idPool=0;this._requests=new Map;this._resolver=new Map}enqueue(i,e){let t=++this._idPool,o=new Ko;this._requests.set(t,{id:t,uri:i}),this._resolver.set(t,o),this._processQueue();let n=e.onCancellationRequested(()=>{this._requests.delete(t),this._resolver.delete(t),o.error(new go)});return o.p.finally(()=>n.dispose())}_processQueue(){this._timer===void 0&&(this._timer=setTimeout(()=>{let i=this._requests,e=this._resolver;this._proxy.$provideDecorations(this._handle,[...i.values()],Se.None).then(t=>{for(let[o,n]of e)n.complete(t[o])}),this._requests=new Map,this._resolver=new Map,this._timer=void 0},0))}},SRt=class{constructor(i,e){this._decorationsService=e;this._provider=new Map;this._proxy=i.getProxy(to.ExtHostDecorations)}dispose(){this._provider.forEach(i=>Be(i)),this._provider.clear()}$registerDecorationProvider(i,e){let t=new E,o=new egi(this._proxy,i),n=this._decorationsService.registerDecorationsProvider({label:e,onDidChange:t.event,provideDecorations:async(r,s)=>{let l=await o.enqueue(r,s);if(!l)return;let[c,u,p,h]=l;return{weight:10,bubble:c??!1,color:h?.id,tooltip:u,letter:p}}});this._provider.set(i,[t,n])}$onDidChange(i,e){let t=this._provider.get(i);if(t){let[o]=t;o.fire(e&&e.map(n=>A.revive(n)))}}$unregisterDecorationProvider(i){let e=this._provider.get(i);e&&(Be(e),this._provider.delete(i))}};SRt=I([fo(qi.MainThreadDecorations),m(1,Ov)],SRt);var uue=class{constructor(i,e,t){this._markerService=e;this._uriIdentService=t;this._activeOwners=new Set;this._proxy=i.getProxy(to.ExtHostDiagnostics),this._markerListener=this._markerService.onMarkerChanged(this._forwardMarkers,this),this.extHostId=`extHost${uue.ExtHostCounter++}`}dispose(){this._markerListener.dispose();for(let i of this._activeOwners){let e=new gt;for(let t of this._markerService.read({owner:i})){let o=e.get(t.resource);o===void 0&&(o=[],e.set(t.resource,o)),t.origin!==this.extHostId&&o.push(t)}for(let[t,o]of e.entries())this._markerService.changeOne(i,t,o)}this._activeOwners.clear()}_forwardMarkers(i){let e=[];for(let t of i){let o=this._markerService.read({resource:t,ignoreResourceFilters:!0});if(o.length===0)e.push([t,[]]);else{let n=o.filter(r=>r?.origin!==this.extHostId);n.length>0&&e.push([t,n])}}e.length>0&&this._proxy.$acceptMarkersChange(e)}$changeMany(i,e){for(let t of e){let[o,n]=t;if(n)for(let r of n){if(r.relatedInformation)for(let s of r.relatedInformation)s.resource=A.revive(s.resource);r.code&&typeof r.code!="string"&&(r.code.target=A.revive(r.code.target)),r.origin===void 0&&(r.origin=this.extHostId)}this._markerService.changeOne(i,this._uriIdentService.asCanonicalUri(A.revive(o)),n)}this._activeOwners.add(i)}$clear(i){this._markerService.changeAll(i,[]),this._activeOwners.delete(i)}};uue.ExtHostCounter=1,uue=I([fo(qi.MainThreadDiagnostics),m(1,oa),m(2,ht)],uue);var pue=class{constructor(i,e){this._fileDialogService=e}dispose(){}async $showOpenDialog(i){let e=pue._convertOpenOptions(i);return e.defaultUri||(e.defaultUri=await this._fileDialogService.defaultFilePath()),Promise.resolve(this._fileDialogService.showOpenDialog(e))}async $showSaveDialog(i){let e=pue._convertSaveOptions(i);return e.defaultUri||(e.defaultUri=await this._fileDialogService.defaultFilePath()),Promise.resolve(this._fileDialogService.showSaveDialog(e))}static _convertOpenOptions(i){let e={openLabel:i?.openLabel||void 0,canSelectFiles:i?.canSelectFiles||!i?.canSelectFiles&&!i?.canSelectFolders,canSelectFolders:i?.canSelectFolders,canSelectMany:i?.canSelectMany,defaultUri:i?.defaultUri?A.revive(i.defaultUri):void 0,title:i?.title||void 0,availableFileSystems:[]};if(i?.filters){e.filters=[];for(let[t,o]of Object.entries(i.filters))e.filters.push({name:t,extensions:o})}return e}static _convertSaveOptions(i){let e={defaultUri:i?.defaultUri?A.revive(i.defaultUri):void 0,saveLabel:i?.saveLabel||void 0,title:i?.title||void 0};if(i?.filters){e.filters=[];for(let[t,o]of Object.entries(i.filters))e.filters.push({name:t,extensions:o})}return e}};pue=I([fo(qi.MainThreadDialogs),m(1,rn)],pue);var IRt=class{constructor(i,e,t,o,n){this._textModelResolverService=e;this._languageService=t;this._modelService=o;this._editorWorkerService=n;this._resourceContentProvider=new Vt;this._pendingUpdate=new Map;this._proxy=i.getProxy(to.ExtHostDocumentContentProviders)}dispose(){this._resourceContentProvider.dispose(),Be(this._pendingUpdate.values())}$registerTextContentProvider(i,e){let t=this._textModelResolverService.registerTextModelContentProvider(e,{provideTextContent:o=>this._proxy.$provideTextDocumentContent(i,o).then(n=>{if(typeof n=="string"){let r=n.substr(0,1+n.search(/\r?\n/)),s=this._languageService.createByFilepathOrFirstLine(o,r);return this._modelService.createModel(n,s,o)}return null})});this._resourceContentProvider.set(i,t)}$unregisterTextContentProvider(i){this._resourceContentProvider.deleteAndDispose(i)}async $onVirtualDocumentChange(i,e){let t=this._modelService.getModel(A.revive(i));if(!t)return;this._pendingUpdate.get(t.id)?.cancel();let n=new Ye;this._pendingUpdate.set(t.id,n);try{let r=await this._editorWorkerService.computeMoreMinimalEdits(t.uri,[{text:e,range:t.getFullModelRange()}]);if(this._pendingUpdate.delete(t.id),n.token.isCancellationRequested||t.isDisposed())return;r&&r.length>0&&t.applyEdits(r.map(s=>Hn.replace(z.lift(s.range),s.text)))}catch(r){mt(r)}}};IRt=I([fo(qi.MainThreadDocumentContentProviders),m(1,Bt),m(2,_t),m(3,Tt),m(4,Qs)],IRt);var Xa=le("workingCopyService"),tgi=class extends Error{constructor(i,e){super(i),this.name="WorkingCopyLeakError",this.stack=e}},igi=class a extends x{constructor(){super(...arguments);this._onDidRegister=this._register(new E);this.onDidRegister=this._onDidRegister.event;this._onDidUnregister=this._register(new E);this.onDidUnregister=this._onDidUnregister.event;this._onDidChangeDirty=this._register(new E);this.onDidChangeDirty=this._onDidChangeDirty.event;this._onDidChangeContent=this._register(new E);this.onDidChangeContent=this._onDidChangeContent.event;this._onDidSave=this._register(new E);this.onDidSave=this._onDidSave.event;this._workingCopies=new Set;this.mapResourceToWorkingCopies=new gt;this.mapWorkingCopyToListeners=this._register(new Vt);this.mapLeakToCounter=new Map}get workingCopies(){return Array.from(this._workingCopies.values())}registerWorkingCopy(e){let t=this.mapResourceToWorkingCopies.get(e.resource);if(t?.has(e.typeId))throw new Error(`Cannot register more than one working copy with the same resource ${e.resource.toString()} and type ${e.typeId}.`);this._workingCopies.add(e),t||(t=new Map,this.mapResourceToWorkingCopies.set(e.resource,t)),t.set(e.typeId,e);let o=new N;o.add(e.onDidChangeContent(()=>this._onDidChangeContent.fire(e))),o.add(e.onDidChangeDirty(()=>this._onDidChangeDirty.fire(e))),o.add(e.onDidSave(r=>this._onDidSave.fire({workingCopy:e,...r}))),this.mapWorkingCopyToListeners.set(e,o),this._onDidRegister.fire(e),e.isDirty()&&this._onDidChangeDirty.fire(e);let n=this.trackLeaks(e);return Z(()=>{n&&this.untrackLeaks(n),this.unregisterWorkingCopy(e),this._onDidUnregister.fire(e)})}unregisterWorkingCopy(e){this._workingCopies.delete(e);let t=this.mapResourceToWorkingCopies.get(e.resource);t?.delete(e.typeId)&&t.size===0&&this.mapResourceToWorkingCopies.delete(e.resource),e.isDirty()&&this._onDidChangeDirty.fire(e),this.mapWorkingCopyToListeners.deleteAndDispose(e)}has(e){return A.isUri(e)?this.mapResourceToWorkingCopies.has(e):this.mapResourceToWorkingCopies.get(e.resource)?.has(e.typeId)??!1}get(e){return this.mapResourceToWorkingCopies.get(e.resource)?.get(e.typeId)}getAll(e){let t=this.mapResourceToWorkingCopies.get(e);if(t)return Array.from(t.values())}static{this.LEAK_TRACKING_THRESHOLD=256}static{this.LEAK_REPORTING_THRESHOLD=2*a.LEAK_TRACKING_THRESHOLD}static{this.LEAK_REPORTED=!1}trackLeaks(e){if(a.LEAK_REPORTED||this._workingCopies.size<a.LEAK_TRACKING_THRESHOLD)return;let t=`${e.resource.scheme}#${e.typeId||"<no typeId>"}
${new Error().stack?.split(`
`).slice(2).join(`
`)??""}`,o=(this.mapLeakToCounter.get(t)??0)+1;if(this.mapLeakToCounter.set(t,o),this._workingCopies.size>a.LEAK_REPORTING_THRESHOLD){a.LEAK_REPORTED=!0;let[n,r]=Array.from(this.mapLeakToCounter.entries()).reduce(([l,c],[u,p])=>p>c?[u,p]:[l,c]),s=`Potential working copy LEAK detected, having ${this._workingCopies.size} working copies already. Most frequent owner (${r})`;mt(new tgi(s,n))}return t}untrackLeaks(e){let t=(this.mapLeakToCounter.get(e)??1)-1;this.mapLeakToCounter.set(e,t),t===0&&this.mapLeakToCounter.delete(e)}get hasDirty(){for(let e of this._workingCopies)if(e.isDirty())return!0;return!1}get dirtyCount(){let e=0;for(let t of this._workingCopies)t.isDirty()&&e++;return e}get dirtyWorkingCopies(){return this.workingCopies.filter(e=>e.isDirty())}get modifiedCount(){let e=0;for(let t of this._workingCopies)t.isModified()&&e++;return e}get modifiedWorkingCopies(){return this.workingCopies.filter(e=>e.isModified())}isDirty(e,t){let o=this.mapResourceToWorkingCopies.get(e);if(o){if(typeof t=="string")return o.get(t)?.isDirty()??!1;for(let[,n]of o)if(n.isDirty())return!0}return!1}};Ee(Xa,igi,1);var CTe=class extends x{constructor(e,t){super();this.logService=e;this.configurationService=t;this.participants=new qs}addFileOperationParticipant(e){let t=this.participants.push(e);return Z(()=>t())}async participate(e,t,o,n){let r=this.configurationService.getValue("files.participants.timeout");if(!(typeof r!="number"||r<=0))for(let s of this.participants)try{await s.participate(e,t,o,r,n)}catch(l){this.logService.warn(l)}}dispose(){this.participants.clear(),super.dispose()}};CTe=I([m(0,se),m(1,B)],CTe);var xTe=class extends x{constructor(e,t){super();this.logService=e;this.progressService=t;this.saveParticipants=new qs}get length(){return this.saveParticipants.size}addSaveParticipant(e){let t=this.saveParticipants.push(e);return Z(()=>t())}async participate(e,t,o,n){let r=new Ye(n);e.model?.pushStackElement(),o.report({message:d(18357,null)});let s=!1;if(await this.progressService.withProgress({priority:3,location:15,cancellable:d(18358,null),delay:e.isDirty()?5e3:3e3},async l=>{let c=Array.from(this.saveParticipants).sort((u,p)=>{let h=u.ordinal??0,g=p.ordinal??0;return h-g});for(let u of c){if(r.token.isCancellationRequested||e.isDisposed())break;try{let p=u.participate(e,t,l,r.token);await Va(p,r.token)}catch(p){ao(p)?r.token.isCancellationRequested||(r.cancel(),s=!0):this.logService.error(p)}}},()=>{r.cancel()}),e.model?.pushStackElement(),r.dispose(),s)throw new go}dispose(){this.saveParticipants.clear(),super.dispose()}};xTe=I([m(0,se),m(1,Fo)],xTe);var qp=le("workingCopyFileService"),x9e=class extends x{constructor(e,t,o,n){super();this.fileService=e;this.workingCopyService=t;this.uriIdentityService=n;this._onWillRunWorkingCopyFileOperation=this._register(new P9);this.onWillRunWorkingCopyFileOperation=this._onWillRunWorkingCopyFileOperation.event;this._onDidFailWorkingCopyFileOperation=this._register(new P9);this.onDidFailWorkingCopyFileOperation=this._onDidFailWorkingCopyFileOperation.event;this._onDidRunWorkingCopyFileOperation=this._register(new P9);this.onDidRunWorkingCopyFileOperation=this._onDidRunWorkingCopyFileOperation.event;this.correlationIds=0;this.workingCopyProviders=[];this.fileOperationParticipants=this._register(o.createInstance(CTe)),this.saveParticipants=this._register(o.createInstance(xTe)),this._register(this.registerWorkingCopyProvider(r=>this.workingCopyService.workingCopies.filter(s=>this.fileService.hasProvider(r)?this.uriIdentityService.extUri.isEqualOrParent(s.resource,r):this.uriIdentityService.extUri.isEqual(s.resource,r))))}create(e,t,o){return this.doCreateFileOrFolder(e,!0,t,o)}createFolder(e,t,o){return this.doCreateFileOrFolder(e,!1,t,o)}async doCreateFileOrFolder(e,t,o,n){if(e.length===0)return[];if(t){let u=(await dn.settled(e.map(p=>this.fileService.canCreateFile(p.resource,{overwrite:p.overwrite})))).find(p=>p instanceof Error);if(u instanceof Error)throw u}let r=e.map(c=>({target:c.resource}));await this.runFileOperationParticipants(r,0,n,o);let s={correlationId:this.correlationIds++,operation:0,files:r};await this._onWillRunWorkingCopyFileOperation.fireAsync(s,Se.None);let l;try{t?l=await dn.settled(e.map(c=>this.fileService.createFile(c.resource,c.contents,{overwrite:c.overwrite}))):l=await dn.settled(e.map(c=>this.fileService.createFolder(c.resource)))}catch(c){throw await this._onDidFailWorkingCopyFileOperation.fireAsync(s,Se.None),c}return await this._onDidRunWorkingCopyFileOperation.fireAsync(s,Se.None),l}async move(e,t,o){return this.doMoveOrCopy(e,!0,t,o)}async copy(e,t,o){return this.doMoveOrCopy(e,!1,t,o)}async doMoveOrCopy(e,t,o,n){let r=[];for(let{file:{source:c,target:u},overwrite:p}of e){let h=await(t?this.fileService.canMove(c,u,p):this.fileService.canCopy(c,u,p));if(h instanceof Error)throw h}let s=e.map(c=>c.file);await this.runFileOperationParticipants(s,t?2:3,n,o);let l={correlationId:this.correlationIds++,operation:t?2:3,files:s};await this._onWillRunWorkingCopyFileOperation.fireAsync(l,Se.None);try{for(let{file:{source:c,target:u},overwrite:p}of e){if(!this.uriIdentityService.extUri.isEqual(c,u)){let h=t?[...this.getDirty(c),...this.getDirty(u)]:this.getDirty(u);await dn.settled(h.map(g=>g.revert({soft:!0})))}t?r.push(await this.fileService.move(c,u,p)):r.push(await this.fileService.copy(c,u,p))}}catch(c){throw await this._onDidFailWorkingCopyFileOperation.fireAsync(l,Se.None),c}return await this._onDidRunWorkingCopyFileOperation.fireAsync(l,Se.None),r}async delete(e,t,o){for(let s of e){let l=await this.fileService.canDelete(s.resource,{recursive:s.recursive,useTrash:s.useTrash});if(l instanceof Error)throw l}let n=e.map(s=>({target:s.resource}));await this.runFileOperationParticipants(n,1,o,t);let r={correlationId:this.correlationIds++,operation:1,files:n};await this._onWillRunWorkingCopyFileOperation.fireAsync(r,Se.None);for(let s of e){let l=this.getDirty(s.resource);await dn.settled(l.map(c=>c.revert({soft:!0})))}try{for(let s of e)await this.fileService.del(s.resource,{recursive:s.recursive,useTrash:s.useTrash})}catch(s){throw await this._onDidFailWorkingCopyFileOperation.fireAsync(r,Se.None),s}await this._onDidRunWorkingCopyFileOperation.fireAsync(r,Se.None)}addFileOperationParticipant(e){return this.fileOperationParticipants.addFileOperationParticipant(e)}runFileOperationParticipants(e,t,o,n){return this.fileOperationParticipants.participate(e,t,o,n)}get hasSaveParticipants(){return this.saveParticipants.length>0}addSaveParticipant(e){return this.saveParticipants.addSaveParticipant(e)}runSaveParticipants(e,t,o,n){return this.saveParticipants.participate(e,t,o,n)}registerWorkingCopyProvider(e){let t=ah(this.workingCopyProviders,e);return Z(t)}getDirty(e){let t=new Set;for(let o of this.workingCopyProviders)for(let n of o(e))n.isDirty()&&t.add(n);return Array.from(t)}};x9e=I([m(0,fe),m(1,Xa),m(2,F),m(3,ht)],x9e);Ee(qp,x9e,1);var k9e=class{constructor(i,e=1e3*60*3,t=1024*1024*80,o=50){this._extUri=i;this._maxAge=e;this._maxLength=t;this._maxSize=o;this._data=new Array;this._length=0}dispose(){this._data=Be(this._data)}remove(i){for(let e of[...this._data])this._extUri.isEqualOrParent(e.uri,i)&&e.dispose()}add(i,e,t=0){let o=()=>{let s=this._data.indexOf(r);s>=0&&(this._length-=t,e.dispose(),clearTimeout(n),this._data.splice(s,1))},n=setTimeout(o,this._maxAge),r={uri:i,length:t,dispose:o};this._data.push(r),this._length+=t,this._cleanup()}_cleanup(){for(;this._length>this._maxLength;)this._data[0].dispose();let i=Math.ceil(this._maxSize*1.2);this._data.length>=i&&Be(this._data.slice(0,i-this._maxSize))}},ogi=class extends x{constructor(e,t,o,n){super();this._model=e;this._onIsCaughtUpWithContentChanges=t;this._proxy=o;this._textFileService=n;this._knownVersionId=this._model.getVersionId(),this._store.add(this._model.onDidChangeContent(r=>{this._knownVersionId=r.versionId,r.detailedReasonsChangeLengths.length!==1&&mt(new Error(`Unexpected reasons: ${r.detailedReasons.map(l=>l.toString())}`));let s={changes:r.changes,isEolChange:r.isEolChange,isUndoing:r.isUndoing,isRedoing:r.isRedoing,isFlush:r.isFlush,eol:r.eol,versionId:r.versionId,detailedReason:r.detailedReasons[0].metadata};this._proxy.$acceptModelChanged(this._model.uri,s,this._textFileService.isDirty(this._model.uri)),this.isCaughtUpWithContentChanges()&&this._onIsCaughtUpWithContentChanges.fire(this._model.uri)}))}isCaughtUpWithContentChanges(){return this._model.getVersionId()===this._knownVersionId}},kTe=class extends x{constructor(e,t,o,n,r,s,l,c,u){super();this._modelService=t;this._textFileService=o;this._fileService=n;this._textModelResolverService=r;this._environmentService=s;this._uriIdentityService=l;this._pathService=u;this._onIsCaughtUpWithContentChanges=this._store.add(new E);this.onIsCaughtUpWithContentChanges=this._onIsCaughtUpWithContentChanges.event;this._modelTrackers=new gt;this._modelReferenceCollection=this._store.add(new k9e(l.extUri)),this._proxy=e.getProxy(to.ExtHostDocuments),this._store.add(t.onModelLanguageChanged(this._onModelModeChanged,this)),this._store.add(o.files.onDidSave(p=>{this._shouldHandleFileEvent(p.model.resource)&&this._proxy.$acceptModelSaved(p.model.resource)})),this._store.add(o.files.onDidChangeDirty(p=>{this._shouldHandleFileEvent(p.resource)&&this._proxy.$acceptDirtyStateChanged(p.resource,p.isDirty())})),this._store.add(U.any(o.files.onDidChangeEncoding,o.untitled.onDidChangeEncoding)(p=>{if(this._shouldHandleFileEvent(p.resource)){let h=p.getEncoding();h&&this._proxy.$acceptEncodingChanged(p.resource,h)}})),this._store.add(c.onDidRunWorkingCopyFileOperation(p=>{let h=p.operation===2;if(h||p.operation===1)for(let g of p.files){let f=h?g.source:g.target;f&&this._modelReferenceCollection.remove(f)}}))}dispose(){Be(this._modelTrackers.values()),this._modelTrackers.clear(),super.dispose()}isCaughtUpWithContentChanges(e){let t=this._modelTrackers.get(e);return t?t.isCaughtUpWithContentChanges():!0}_shouldHandleFileEvent(e){let t=this._modelService.getModel(e);return!!t&&Hx(t)}handleModelAdded(e){Hx(e)&&this._modelTrackers.set(e.uri,new ogi(e,this._onIsCaughtUpWithContentChanges,this._proxy,this._textFileService))}_onModelModeChanged(e){let{model:t}=e;this._modelTrackers.has(t.uri)&&this._proxy.$acceptModelLanguageChanged(t.uri,t.getLanguageId())}handleModelRemoved(e){this._modelTrackers.has(e)&&(this._modelTrackers.get(e).dispose(),this._modelTrackers.delete(e))}async $trySaveDocument(e){return!!await this._textFileService.save(A.revive(e))}async $tryOpenDocument(e,t){let o=A.revive(e);if(!o.scheme||!(o.fsPath||o.authority))throw new pa("Invalid uri. Scheme and authority or path must be set.");let n=this._uriIdentityService.asCanonicalUri(o),r;switch(n.scheme){case Q.untitled:r=this._handleUntitledScheme(n,t);break;case Q.file:default:r=this._handleAsResourceInput(n,t);break}let s;try{s=await r}catch(l){throw new pa(`cannot open ${n.toString()}. Detail: ${xn(l)}`)}if(s)if(ar.isEqual(s,n)){if(this._modelTrackers.has(n))return n;throw new pa(`cannot open ${n.toString()}. Detail: Files above 50MB cannot be synchronized with extensions.`)}else throw new pa(`cannot open ${n.toString()}. Detail: Actual document opened as ${s.toString()}`);else throw new pa(`cannot open ${n.toString()}`)}$tryCreateDocument(e){return this._doCreateUntitled(void 0,e)}async _handleAsResourceInput(e,t){if(t?.encoding){let n=await this._textFileService.files.resolve(e,{encoding:t.encoding,reason:2});if(n.isDirty())throw new pa("Cannot re-open a dirty text document with different encoding. Save it first.");await n.setEncoding(t.encoding,1)}let o=await this._textModelResolverService.createModelReference(e);return this._modelReferenceCollection.add(e,o,o.object.textEditorModel.getValueLength()),o.object.textEditorModel.uri}async _handleUntitledScheme(e,t){let o=of(e,this._environmentService.remoteAuthority,this._pathService.defaultUriScheme);return await this._fileService.exists(o)?Promise.reject(new Error("file already exists")):await this._doCreateUntitled(e.path?e:void 0,t)}async _doCreateUntitled(e,t){let o=this._textFileService.untitled.create({associatedResource:e,languageId:t?.language,initialValue:t?.content,encoding:t?.encoding});t?.encoding&&await o.setEncoding(t.encoding);let n=o.resource,r=await this._textModelResolverService.createModelReference(n);if(!this._modelTrackers.has(n))throw r.dispose(),new Error(`expected URI ${n.toString()} to have come to LIFE`);return this._modelReferenceCollection.add(n,r,r.object.textEditorModel.getValueLength()),U.once(o.onDidRevert)(()=>this._modelReferenceCollection.remove(n)),this._proxy.$acceptDirtyStateChanged(n,!0),n}};kTe=I([m(1,Tt),m(2,Uo),m(3,fe),m(4,Bt),m(5,At),m(6,ht),m(7,qp),m(8,An)],kTe);var yRt=class a{constructor(i,e,t){this.selections=i;this.options=e;this.visibleRanges=t}static readFromEditor(i,e,t){let o=a._readSelectionsFromCodeEditor(i,t),n=a._readOptionsFromCodeEditor(i,e,t),r=a._readVisibleRangesFromCodeEditor(i,t);return new a(o,n,r)}static _readSelectionsFromCodeEditor(i,e){let t=null;return e&&(t=e.getSelections()),!t&&i&&(t=i.selections),t||(t=[new ti(1,1,1,1)]),t}static _readOptionsFromCodeEditor(i,e,t){if(e.isDisposed()){if(i)return i.options;throw new Error("No valid properties")}let o,n;if(t){let s=t.getOptions(),l=s.get(76);o=s.get(34),n=l.renderType}else i?(o=i.options.cursorStyle,n=i.options.lineNumbers):(o=1,n=1);let r=e.getOptions();return{insertSpaces:r.insertSpaces,tabSize:r.tabSize,indentSize:r.indentSize,originalIndentSize:r.originalIndentSize,cursorStyle:o,lineNumbers:n}}static _readVisibleRangesFromCodeEditor(i,e){return e?e.getVisibleRanges():[]}generateDelta(i,e){let t={options:null,selections:null,visibleRanges:null};return(!i||!a._selectionsEqual(i.selections,this.selections))&&(t.selections={selections:this.selections,source:e??void 0}),(!i||!a._optionsEqual(i.options,this.options))&&(t.options=this.options),(!i||!a._rangesEqual(i.visibleRanges,this.visibleRanges))&&(t.visibleRanges=this.visibleRanges),t.selections||t.options||t.visibleRanges?t:null}static _selectionsEqual(i,e){return $i(i,e,(t,o)=>t.equalsSelection(o))}static _rangesEqual(i,e){return $i(i,e,(t,o)=>t.equalsRange(o))}static _optionsEqual(i,e){return i&&!e||!i&&e?!1:!i&&!e?!0:i.tabSize===e.tabSize&&i.indentSize===e.indentSize&&i.insertSpaces===e.insertSpaces&&i.cursorStyle===e.cursorStyle&&i.lineNumbers===e.lineNumbers}},wRt=class{constructor(i,e,t,o,n,r,s){this._modelListeners=new N;this._codeEditorListeners=new N;this._id=i,this._model=e,this._codeEditor=null,this._properties=null,this._focusTracker=o,this._mainThreadDocuments=n,this._modelService=r,this._clipboardService=s,this._onPropertiesChanged=new E,this._modelListeners.add(this._model.onDidChangeOptions(l=>{this._updatePropertiesNow(null)})),this.setCodeEditor(t),this._updatePropertiesNow(null)}dispose(){this._modelListeners.dispose(),this._onPropertiesChanged.dispose(),this._codeEditor=null,this._codeEditorListeners.dispose()}_updatePropertiesNow(i){this._setProperties(yRt.readFromEditor(this._properties,this._model,this._codeEditor),i)}_setProperties(i,e){let t=i.generateDelta(this._properties,e);this._properties=i,t&&this._onPropertiesChanged.fire(t)}getId(){return this._id}getModel(){return this._model}getCodeEditor(){return this._codeEditor}hasCodeEditor(i){return this._codeEditor===i}setCodeEditor(i){if(!this.hasCodeEditor(i)&&(this._codeEditorListeners.clear(),this._codeEditor=i,this._codeEditor)){this._codeEditorListeners.add(this._codeEditor.onDidChangeModel(()=>{this.setCodeEditor(null)})),this._codeEditorListeners.add(this._codeEditor.onDidFocusEditorWidget(()=>{this._focusTracker.onGainedFocus()})),this._codeEditorListeners.add(this._codeEditor.onDidBlurEditorWidget(()=>{this._focusTracker.onLostFocus()}));let e=null;this._codeEditorListeners.add(this._mainThreadDocuments.onIsCaughtUpWithContentChanges(n=>{if(n.toString()===this._model.uri.toString()){let r=e;e=null,this._updatePropertiesNow(r)}}));let t=()=>this._codeEditor&&this._codeEditor.getModel()===this._model,o=n=>{this._mainThreadDocuments.isCaughtUpWithContentChanges(this._model.uri)?(e=null,this._updatePropertiesNow(n)):e=n};this._codeEditorListeners.add(this._codeEditor.onDidChangeCursorSelection(n=>{t()&&o(n.source)})),this._codeEditorListeners.add(this._codeEditor.onDidChangeConfiguration(n=>{t()&&o(null)})),this._codeEditorListeners.add(this._codeEditor.onDidLayoutChange(()=>{t()&&o(null)})),this._codeEditorListeners.add(this._codeEditor.onDidScrollChange(()=>{t()&&o(null)})),this._updatePropertiesNow(null)}}isVisible(){return!!this._codeEditor}getProperties(){return this._properties}get onPropertiesChanged(){return this._onPropertiesChanged.event}setSelections(i){if(this._codeEditor){this._codeEditor.setSelections(i);return}let e=i.map(ti.liftSelection);this._setProperties(new yRt(e,this._properties.options,this._properties.visibleRanges),null)}_setIndentConfiguration(i){let e=this._modelService.getCreationOptions(this._model.getLanguageId(),this._model.uri,this._model.isForSimpleWidget);if(i.tabSize==="auto"||i.insertSpaces==="auto"){let o=e.insertSpaces,n=e.tabSize;i.insertSpaces!=="auto"&&typeof i.insertSpaces<"u"&&(o=i.insertSpaces),i.tabSize!=="auto"&&typeof i.tabSize<"u"&&(n=i.tabSize),this._model.detectIndentation(o,n);return}let t={};typeof i.insertSpaces<"u"&&(t.insertSpaces=i.insertSpaces),typeof i.tabSize<"u"&&(t.tabSize=i.tabSize),typeof i.indentSize<"u"&&(t.indentSize=i.indentSize),this._model.updateOptions(t)}setConfiguration(i){if(this._setIndentConfiguration(i),!!this._codeEditor){if(i.cursorStyle){let e=P$i(i.cursorStyle);this._codeEditor.updateOptions({cursorStyle:e})}if(typeof i.lineNumbers<"u"){let e;switch(i.lineNumbers){case 1:e="on";break;case 2:e="relative";break;case 3:e="interval";break;default:e="off"}this._codeEditor.updateOptions({lineNumbers:e})}}}setDecorations(i,e){this._codeEditor&&this._codeEditor.setDecorationsByType("exthost-api",i,e)}setDecorationsFast(i,e){if(!this._codeEditor)return;let t=[];for(let o=0,n=Math.floor(e.length/4);o<n;o++)t[o]=new z(e[4*o],e[4*o+1],e[4*o+2],e[4*o+3]);this._codeEditor.setDecorationsByTypeFast(i,t)}revealRange(i,e){if(this._codeEditor)switch(e){case 0:this._codeEditor.revealRange(i,0);break;case 1:this._codeEditor.revealRangeInCenter(i,0);break;case 2:this._codeEditor.revealRangeInCenterIfOutsideViewport(i,0);break;case 3:this._codeEditor.revealRangeAtTop(i,0);break;default:console.warn(`Unknown revealType: ${e}`);break}}isFocused(){return this._codeEditor?this._codeEditor.hasTextFocus():!1}matches(i){return i?i.getControl()===this._codeEditor:!1}applyEdits(i,e,t){if(this._model.getVersionId()!==i||!this._codeEditor)return!1;typeof t.setEndOfLine<"u"&&this._model.pushEOL(t.setEndOfLine);let o=e.map(n=>({range:z.lift(n.range),text:n.text,forceMoveMarkers:n.forceMoveMarkers}));return t.undoStopBefore&&this._codeEditor.pushUndoStop(),this._codeEditor.executeEdits("MainThreadTextEditor",o),t.undoStopAfter&&this._codeEditor.pushUndoStop(),!0}async insertSnippet(i,e,t,o){if(!this._codeEditor||!this._codeEditor.hasModel())return!1;let n;if(eg.guessNeedsClipboard(e)){let c=new Mz(this._codeEditor,5);if(n=await this._clipboardService.readText(),!c.validate(this._codeEditor))return!1}if(this._codeEditor.getModel().getVersionId()!==i)return!1;let s=vs.get(this._codeEditor);if(!s)return!1;this._codeEditor.focus();let l=t.map(c=>({range:z.lift(c),template:e}));return s.apply(l,{overwriteBefore:0,overwriteAfter:0,undoStopBefore:o.undoStopBefore,undoStopAfter:o.undoStopAfter,adjustWhitespace:!o.keepWhitespace,clipboardText:n}),!0}};function wk(a,i,e=jn){if(e===jn||e===In||e===Mg||e===OR)return e;let t=a.getGroups(2)[e];if(!t&&e<9){for(let o=0;o<=e;o++){let n=a.getGroups(2);n[o]||a.addGroup(n[o-1],uy(i))}t=a.getGroups(2)[e]}return t?.id??In}function GC(a,i){let e=typeof i=="number"?a.getGroup(i):i;return a.getGroups(2).indexOf(e??a.activeGroup)}var mT=le("quickDiff"),E9e=te("editorGutter.modifiedBackground",{dark:"#1B81A8",light:"#2090D3",hcDark:"#1B81A8",hcLight:"#2090D3"},d(13806,null));te("editorGutter.modifiedSecondaryBackground",{dark:ep(E9e,.5),light:cb(E9e,.7),hcDark:"#1B81A8",hcLight:"#2090D3"},d(13807,null));var T9e=te("editorGutter.addedBackground",{dark:"#487E02",light:"#48985D",hcDark:"#487E02",hcLight:"#48985D"},d(13800,null));te("editorGutter.addedSecondaryBackground",{dark:ep(T9e,.5),light:cb(T9e,.7),hcDark:"#487E02",hcLight:"#48985D"},d(13801,null));var _9e=te("editorGutter.deletedBackground",Iv,d(13802,null));te("editorGutter.deletedSecondaryBackground",{dark:ep(_9e,.4),light:cb(_9e,.3),hcDark:"#F48771",hcLight:"#B5200D"},d(13803,null));var ETe=te("minimapGutter.modifiedBackground",E9e,d(13810,null)),TTe=te("minimapGutter.addedBackground",T9e,d(13808,null)),_Te=te("minimapGutter.deletedBackground",_9e,d(13809,null)),gJ=te("editorOverviewRuler.modifiedForeground",ai(E9e,.6),d(13813,null)),fJ=te("editorOverviewRuler.addedForeground",ai(T9e,.6),d(13811,null)),vJ=te("editorOverviewRuler.deletedForeground",ai(_9e,.6),d(13812,null)),nMa=te("editorGutter.itemGlyphForeground",{dark:Id,light:Id,hcDark:We.black,hcLight:We.white},d(13805,null)),rMa=te("editorGutter.itemBackground",{dark:lj(Kf,Ho),light:ep(lj(Kf,Ho),.05),hcDark:We.white,hcLight:We.black},d(13804,null));function D9e(a){return a.originalEndLineNumber===0?1:a.modifiedEndLineNumber===0?2:0}function $to(a,i){switch(i){case 0:return a.getColor(E9e);case 1:return a.getColor(T9e);case 2:return a.getColor(_9e)}}function CRt(a,i){let e=a.modifiedStartLineNumber-i.modifiedStartLineNumber;return e!==0||(e=a.modifiedEndLineNumber-i.modifiedEndLineNumber,e!==0)||(e=a.originalStartLineNumber-i.originalStartLineNumber,e!==0)?e:a.originalEndLineNumber-i.originalEndLineNumber}function jto(a){let i=a.modifiedEndLineNumber-a.modifiedStartLineNumber+1,e=a.originalEndLineNumber-a.originalStartLineNumber+1;return a.originalEndLineNumber===0?i:a.modifiedEndLineNumber===0?e:i+e}function L9e(a){return a.modifiedEndLineNumber===0?a.modifiedStartLineNumber===0?1:a.modifiedStartLineNumber:a.modifiedEndLineNumber}function Qto(a,i){return a===1&&i.modifiedStartLineNumber===0&&i.modifiedEndLineNumber===0?!0:a>=i.modifiedStartLineNumber&&a<=(i.modifiedEndLineNumber||i.modifiedStartLineNumber)}var mue="workbench.view.scm",Jf="workbench.scm",xRt="workbench.scm.repositories",uA="workbench.scm.history";var rd=le("scm");var _u=le("scmView");var ud=le("chatEditingService");function b4(a){return new Promise(i=>{Ox(e=>{a.state.read(e)!==0&&(e.dispose(),i())})})}function bJ(a,i){return{originalURI:a,modifiedURI:i,added:0,removed:0,quitEarly:!1,identical:!1,isFinal:!1,isBusy:!1}}var $K="chat-editing-multi-diff-source",jK=new Y("chatEditingWidgetFileState",void 0,d(8213,null)),Yto=new Y("chatEditingAgentSupportsReadonlyReferences",void 0,d(8212,null)),R9e=new Y("decidedChatEditingResource",[]),DTe=new Y("chatEditingResource",void 0),kRt=new Y("inChatEditingSession",void 0),mD=new Y("hasUndecidedChatEditingResource",!1),M9e=new Y("hasAppliedChatEdits",!1),S4=new Y("applyingChatEditsFailed",!1);function Xto(a){return typeof a=="object"&&!!a&&No(a,{sessionResource:!0})}function ERt(a,i){return A.from({scheme:$K,authority:U$(qe.fromString(a.chatSessionResource.toString())),query:i?"previous":void 0})}function P9e(a){let i=A.parse(yIe(a.authority).toString()),e=a.query==="previous";return{chatSessionResource:i,showPreviousChanges:e}}var qF=le("IQuickDiffModelService"),X$o={algorithm:"advanced",maxComputationTimeMs:1e3},A9e=class extends uC{constructor(e){super();this._instantiationService=e}createReferencedObject(e,t,o){return this._instantiationService.createInstance(N9e,t,o)}destroyReferencedObject(e,t){t.dispose()}};A9e=I([m(0,F)],A9e);var LTe=class{constructor(i,e,t){this.instantiationService=i;this.textFileService=e;this.uriIdentityService=t;this._references=this.instantiationService.createInstance(A9e)}createQuickDiffModelReference(i,e=X$o){let t=this.textFileService.files.get(i);if(t?.isResolved())return i=this.uriIdentityService.asCanonicalUri(i).with({query:JSON.stringify(e)}),this._references.acquire(i.toString(),t,e)}};LTe=I([m(0,F),m(1,Uo),m(2,ht)],LTe);var N9e=class extends x{constructor(e,t,o,n,r,s,l,c,u,p){super();this.options=t;this.scmService=o;this.quickDiffService=n;this.editorWorkerService=r;this.configurationService=s;this.textModelResolverService=l;this._chatEditingService=c;this.progressService=u;this.environmentService=p;this._originalEditorModels=new gt;this._originalEditorModelsDisposables=this._register(new N);this._disposed=!1;this._quickDiffs=[];this._diffDelayer=this._register(new ya(200));this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._allChanges=[];this._changes=[];this._quickDiffChanges=new Map;this._repositoryDisposables=new Vt;this._model=e,this._register(e.textEditorModel.onDidChangeContent(()=>this.triggerDiff())),this._register(U.filter(s.onDidChangeConfiguration,h=>h.affectsConfiguration("scm.diffDecorationsIgnoreTrimWhitespace")||h.affectsConfiguration("diffEditor.ignoreTrimWhitespace"))(this.triggerDiff,this)),this._register(o.onDidAddRepository(this.onDidAddRepository,this));for(let h of o.repositories)this.onDidAddRepository(h);this._register(this._model.onDidChangeEncoding(()=>{this._diffDelayer.cancel(),this._quickDiffs=[],this._originalEditorModels.clear(),this._quickDiffsPromise=void 0,this.setChanges([],[],new Map),this.triggerDiff()})),this._register(this.quickDiffService.onDidChangeQuickDiffProviders(()=>this.triggerDiff())),this._register(be(h=>{for(let g of this._chatEditingService.editingSessionsObs.read(h))h.store.add(be(f=>{for(let v of g.entries.read(f))v.state.read(f);this.triggerDiff()}))})),this.triggerDiff()}get originalTextModels(){return vt.map(this._originalEditorModels.values(),e=>e.textEditorModel)}get allChanges(){return this._allChanges}get changes(){return this._changes}get quickDiffChanges(){return this._quickDiffChanges}get quickDiffs(){return this._quickDiffs}getQuickDiffResults(){return this._quickDiffs.map(e=>{let t=this.allChanges.filter(o=>o.providerId===e.id);return{providerId:e.id,providerKind:e.kind,original:e.originalResource,modified:this._model.resource,changes:t.map(o=>o.change),changes2:t.map(o=>o.change2)}})}getDiffEditorModel(e){let t=this._originalEditorModels.get(e);return t?{modified:this._model.textEditorModel,original:t.textEditorModel}:void 0}onDidAddRepository(e){let t=new N;t.add(e.provider.onDidChangeResources(this.triggerDiff,this));let o=U.filter(this.scmService.onDidRemoveRepository,n=>n===e);t.add(o(()=>this._repositoryDisposables.deleteAndDispose(e))),this._repositoryDisposables.set(e,t),this.triggerDiff()}triggerDiff(){this._diffDelayer&&this._diffDelayer.trigger(async()=>{let e=await this.diff(),t=Array.from(this._originalEditorModels.values());!e||this._disposed||this._model.isDisposed()||t.some(o=>o.isDisposed())||this.setChanges(e.allChanges,e.changes,e.mapChanges)}).catch(e=>mt(e))}setChanges(e,t,o){let n=r$e(this.changes,t,(r,s)=>CRt(r.change,s.change));this._allChanges=e,this._changes=t,this._quickDiffChanges=o,this._onDidChange.fire({changes:t,diff:n})}diff(){let e=this.environmentService.isSessionsWindow?10:3;return this.progressService.withProgress({location:e,delay:250},async()=>{let t=await this.getQuickDiffsPromise();if(this._disposed||this._model.isDisposed()||t.length===0)return Promise.resolve({allChanges:[],changes:[],mapChanges:new Map});let o=t.filter(g=>this.editorWorkerService.canComputeDirtyDiff(g.originalResource,this._model.resource));if(o.length===0)return Promise.resolve({allChanges:[],changes:[],mapChanges:new Map});let n=o.find(g=>g.kind==="primary"),r=this.configurationService.getValue("scm.diffDecorationsIgnoreTrimWhitespace"),s=r==="inherit"?this.configurationService.getValue("diffEditor.ignoreTrimWhitespace"):r!=="false",l=[],c=[];for(let g of o){let f=await this._diff(g.originalResource,this._model.resource,s);if(f.changes&&f.changes2&&f.changes.length===f.changes2.length)for(let v=0;v<f.changes.length;v++){let b=f.changes2[v];if(n&&g.kind==="secondary"){let S=l.find(y=>y.change2.modified.equals(b.modified)&&y.change2.original.length===b.original.length);if(S){let w=this._originalEditorModels.get(n.originalResource)?.textEditorModel?.getValueInRange(S.change2.toRangeMapping().originalRange),T=this._originalEditorModels.get(g.originalResource)?.textEditorModel?.getValueInRange(b.toRangeMapping().originalRange);if(w===T){c.push({providerId:g.id,original:g.originalResource,modified:this._model.resource,change:f.changes[v],change2:f.changes2[v]});continue}}}l.push({providerId:g.id,original:g.originalResource,modified:this._model.resource,change:f.changes[v],change2:f.changes2[v]})}}let u=l.sort((g,f)=>CRt(g.change,f.change)),p=[...l,...c].sort((g,f)=>CRt(g.change,f.change)),h=new Map;for(let g=0;g<u.length;g++){let f=u[g].providerId;h.has(f)||h.set(f,[]),h.get(f).push(g)}return{allChanges:p,changes:u,mapChanges:h}})}async _diff(e,t,o){let n=this.options.maxComputationTimeMs??Number.MAX_SAFE_INTEGER,r=await this.editorWorkerService.computeDiff(e,t,{computeMoves:!1,ignoreTrimWhitespace:o,maxComputationTimeMs:n},this.options.algorithm);return{changes:r?Jri(ice.fromDiffResult(r)):null,changes2:r?.changes??null}}getQuickDiffsPromise(){return this._quickDiffsPromise?this._quickDiffsPromise:(this._quickDiffsPromise=this.getOriginalResource().then(async e=>this._disposed?[]:e.length===0?(this._quickDiffs=[],this._originalEditorModels.clear(),[]):$i(this._quickDiffs,e,(t,o)=>t.id===o.id&&t.originalResource.toString()===o.originalResource.toString()&&this.quickDiffService.isQuickDiffProviderVisible(t.id)===this.quickDiffService.isQuickDiffProviderVisible(o.id))?e:(this._quickDiffs=e,this._originalEditorModels.clear(),this._originalEditorModelsDisposables.clear(),(await Promise.all(e.map(async t=>{try{let o=await this.textModelResolverService.createModelReference(t.originalResource);if(this._disposed)return o.dispose(),[];if(this._originalEditorModels.set(t.originalResource,o.object),y9e(o.object)&&!o.object.isDirty()){let n=this._model.getEncoding();n&&o.object.setEncoding(n,1)}return this._originalEditorModelsDisposables.add(o),this._originalEditorModelsDisposables.add(o.object.textEditorModel.onDidChangeContent(()=>this.triggerDiff())),t}catch{return[]}}))).flat())),this._quickDiffsPromise.finally(()=>{this._quickDiffsPromise=void 0}))}async getOriginalResource(){if(this._disposed)return Promise.resolve([]);let e=this._model.resource;if(this._chatEditingService.editingSessionsObs.get().some(n=>n.getEntry(e)?.state.get()===0))return Promise.resolve([]);let o=this._model.textEditorModel?Hx(this._model.textEditorModel):void 0;return this.quickDiffService.getQuickDiffs(e,this._model.getLanguageId(),o)}findNextClosestChange(e,t=!0,o){let n=new Set(this.quickDiffs.filter(r=>this.quickDiffService.isQuickDiffProviderVisible(r.id)).map(r=>r.id));for(let r=0;r<this.changes.length;r++){if(o&&this.changes[r].providerId!==o||!n.has(this.changes[r].providerId))continue;let s=this.changes[r].change;if(t){if(L9e(s)>=e)return r}else if(s.modifiedStartLineNumber>e)return r}return 0}findPreviousClosestChange(e,t=!0,o){let n=new Set(this.quickDiffs.filter(r=>this.quickDiffService.isQuickDiffProviderVisible(r.id)).map(r=>r.id));for(let r=this.changes.length-1;r>=0;r--){if(o&&this.changes[r].providerId!==o||!n.has(this.changes[r].providerId))continue;let s=this.changes[r].change;if(t){if(s.modifiedStartLineNumber<=e)return r}else if(L9e(s)<e)return r}return this.changes.length-1}dispose(){this._disposed=!0,this._quickDiffs=[],this._diffDelayer.cancel(),this._originalEditorModels.clear(),this._repositoryDisposables.dispose(),super.dispose()}};N9e=I([m(2,rd),m(3,mT),m(4,Qs),m(5,B),m(6,Bt),m(7,ud),m(8,Fo),m(9,At)],N9e);var SJ=class{constructor(i,e,t,o,n,r,s,l){this._editorLocator=i;this._codeEditorService=t;this._editorService=o;this._editorGroupService=n;this._configurationService=r;this._quickDiffModelService=s;this._uriIdentityService=l;this._toDispose=new N;this._instanceId=String(++SJ.INSTANCE_COUNT),this._proxy=e.getProxy(to.ExtHostEditors),this._textEditorsListenersMap=Object.create(null),this._editorPositionData=null,this._toDispose.add(this._editorService.onDidVisibleEditorsChange(()=>this._updateActiveAndVisibleTextEditors())),this._toDispose.add(this._editorGroupService.onDidRemoveGroup(()=>this._updateActiveAndVisibleTextEditors())),this._toDispose.add(this._editorGroupService.onDidMoveGroup(()=>this._updateActiveAndVisibleTextEditors())),this._registeredDecorationTypes=Object.create(null)}static{this.INSTANCE_COUNT=0}dispose(){Object.keys(this._textEditorsListenersMap).forEach(i=>{Be(this._textEditorsListenersMap[i])}),this._textEditorsListenersMap=Object.create(null),this._toDispose.dispose();for(let i in this._registeredDecorationTypes)this._codeEditorService.removeDecorationType(i);this._registeredDecorationTypes=Object.create(null)}handleTextEditorAdded(i){let e=i.getId(),t=[];t.push(i.onPropertiesChanged(n=>{this._proxy.$acceptEditorPropertiesChanged(e,n)}));let o=this._getTextEditorDiffInformation(i,t);t.push(be(n=>{let r=o.read(n);this._proxy.$acceptEditorDiffInformation(e,r)})),this._textEditorsListenersMap[e]=t}handleTextEditorRemoved(i){Be(this._textEditorsListenersMap[i]),delete this._textEditorsListenersMap[i]}_updateActiveAndVisibleTextEditors(){let i=this._getTextEditorPositionData();eo(this._editorPositionData,i)||(this._editorPositionData=i,this._proxy.$acceptEditorPositionData(this._editorPositionData))}_getTextEditorPositionData(){let i=Object.create(null);for(let e of this._editorService.visibleEditorPanes){let t=this._editorLocator.findTextEditorIdFor(e);t&&(i[t]=GC(this._editorGroupService,e.group))}return i}_getTextEditorDiffInformation(i,e){let t=i.getCodeEditor();if(!t)return So(void 0);let[o]=this._codeEditorService.listDiffEditors().filter(s=>s.getOriginalEditor().getId()===t.getId()||s.getModifiedEditor().getId()===t.getId()),n=o?ui(this,o.onDidChangeModel,()=>o.getModel()):ui(this,t.onDidChangeModel,()=>t.getModel()),r=ke(s=>{let l=n.read(s);if(!l)return So(void 0);if(d7(l)){let p=this._quickDiffModelService.createQuickDiffModelReference(l.uri);return p?(e.push(p),ui(this,p.object.onDidChange,()=>p.object.getQuickDiffResults().map(h=>({original:h.original,modified:h.modified,changes:h.changes2})))):So(void 0)}let c=this._configurationService.getValue("diffEditor.diffAlgorithm"),u=this._quickDiffModelService.createQuickDiffModelReference(l.modified.uri,{algorithm:c});return u?(e.push(u),ui(U.any(u.object.onDidChange,o.onDidUpdateDiff),()=>{let p=o.getDiffComputationResult()?.changes2??[],h=[{original:l.original.uri,modified:l.modified.uri,changes:p.map(f=>f)}],g=u.object.getQuickDiffResults().filter(f=>f.providerKind!=="primary").map(f=>({original:f.original,modified:f.modified,changes:f.changes2}));return h.concat(g)})):So(void 0)});return Os({owner:this,equalsFn:(s,l)=>$i(s,l,(c,u)=>mji(this._uriIdentityService,c,u))},s=>{let l=n.read(s),c=r.read(s).read(s);if(!l||!c)return;let u=d7(l)?l.getVersionId():l.modified.getVersionId();return c.map(p=>{let h=p.changes.map(g=>[g.original.startLineNumber,g.original.endLineNumberExclusive,g.modified.startLineNumber,g.modified.endLineNumberExclusive]);return{documentVersion:u,original:p.original,modified:p.modified,changes:h}})})}async $tryShowTextDocument(i,e){let t=A.revive(i),o={preserveFocus:e.preserveFocus,pinned:e.pinned,selection:e.selection,activation:e.preserveFocus?2:void 0,override:1},n={resource:t,options:o},r=await this._editorService.openEditor(n,wk(this._editorGroupService,this._configurationService,e.position));if(!r)return;let s=r.getControl(),l=ha(s);return l?this._editorLocator.getIdOfCodeEditor(l):void 0}async $tryShowEditor(i,e){let t=this._editorLocator.getEditor(i);if(t){let o=t.getModel();await this._editorService.openEditor({resource:o.uri,options:{preserveFocus:!1}},wk(this._editorGroupService,this._configurationService,e));return}}async $tryHideEditor(i){let e=this._editorLocator.getEditor(i);if(e){let t=this._editorService.visibleEditorPanes;for(let o of t)if(e.matches(o)){await o.group.closeEditor(o.input);return}}}$trySetSelections(i,e){let t=this._editorLocator.getEditor(i);return t?(t.setSelections(e),Promise.resolve(void 0)):Promise.reject(Yr(`TextEditor(${i})`))}$trySetDecorations(i,e,t){e=`${this._instanceId}-${e}`;let o=this._editorLocator.getEditor(i);return o?(o.setDecorations(e,t),Promise.resolve(void 0)):Promise.reject(Yr(`TextEditor(${i})`))}$trySetDecorationsFast(i,e,t){e=`${this._instanceId}-${e}`;let o=this._editorLocator.getEditor(i);return o?(o.setDecorationsFast(e,t),Promise.resolve(void 0)):Promise.reject(Yr(`TextEditor(${i})`))}$tryRevealRange(i,e,t){let o=this._editorLocator.getEditor(i);return o?(o.revealRange(e,t),Promise.resolve()):Promise.reject(Yr(`TextEditor(${i})`))}$trySetOptions(i,e){let t=this._editorLocator.getEditor(i);return t?(t.setConfiguration(e),Promise.resolve(void 0)):Promise.reject(Yr(`TextEditor(${i})`))}$tryApplyEdits(i,e,t,o){let n=this._editorLocator.getEditor(i);return n?Promise.resolve(n.applyEdits(e,t,o)):Promise.reject(Yr(`TextEditor(${i})`))}$tryInsertSnippet(i,e,t,o,n){let r=this._editorLocator.getEditor(i);return r?Promise.resolve(r.insertSnippet(e,t,o,n)):Promise.reject(Yr(`TextEditor(${i})`))}$registerTextEditorDecorationType(i,e,t){e=`${this._instanceId}-${e}`,this._registeredDecorationTypes[e]=!0,this._codeEditorService.registerDecorationType(`exthost-api-${i}`,e,t)}$removeTextEditorDecorationType(i){i=`${this._instanceId}-${i}`,delete this._registeredDecorationTypes[i],this._codeEditorService.removeDecorationType(i)}$getDiffInformation(i){let e=this._editorLocator.getEditor(i);if(!e)return Promise.reject(new Error("No such TextEditor"));let t=e.getCodeEditor();if(!t)return Promise.reject(new Error("No such CodeEditor"));let o=t.getId(),n=this._codeEditorService.listDiffEditors(),[r]=n.filter(l=>l.getOriginalEditor().getId()===o||l.getModifiedEditor().getId()===o);if(r)return Promise.resolve(r.getLineChanges()||[]);if(!t.hasModel())return Promise.resolve([]);let s=this._quickDiffModelService.createQuickDiffModelReference(t.getModel().uri);if(!s)return Promise.resolve([]);try{let l=s.object.quickDiffs.find(u=>u.kind==="primary"),c=s.object.changes.filter(u=>u.providerId===l?.id);return Promise.resolve(c.map(u=>u.change)??[])}finally{s.dispose()}}};SJ=I([m(2,qt),m(3,ee),m(4,wt),m(5,B),m(6,qF),m(7,ht)],SJ);$e.registerCommand("_workbench.revertAllDirty",async function(a){if(!a.get(Eo).extensionTestsLocationURI)throw new Error("Command is only available when running extension tests.");let e=a.get(Xa);for(let t of e.dirtyWorkingCopies)await t.revert({soft:!0})});var Br=class a{constructor(i,e,t){this.ctor=i;this.typeId=e;this.name=t}static{this.instantiatedEditorPanes=new Set}static didInstantiateEditorPane(i){return a.instantiatedEditorPanes.has(i)}static{this._onWillInstantiateEditorPane=new E}static{this.onWillInstantiateEditorPane=a._onWillInstantiateEditorPane.event}static create(i,e,t){return new a(i,e,t)}instantiate(i,e){a._onWillInstantiateEditorPane.fire({typeId:this.typeId});let t=i.createInstance(this.ctor,e);return a.instantiatedEditorPanes.add(this.typeId),t}describes(i){return i.getId()===this.typeId}},sgi=class{constructor(){this.mapEditorPanesToEditors=new Map}registerEditorPane(i,e){return this.mapEditorPanesToEditors.set(i,e),Z(()=>{this.mapEditorPanesToEditors.delete(i)})}getEditorPane(i){let e=this.findEditorPaneDescriptors(i);if(e.length!==0)return e.length===1?e[0]:i.prefersEditorPane(e)}findEditorPaneDescriptors(i,e){let t=[];for(let o of this.mapEditorPanesToEditors.keys()){let n=this.mapEditorPanesToEditors.get(o)||[];for(let r of n){let s=r.ctor;if(!e&&i.constructor===s){t.push(o);break}else if(e&&i instanceof s){t.push(o);break}}}return!e&&t.length===0?this.findEditorPaneDescriptors(i,!0):t}getEditorPaneByType(i){return vt.find(this.mapEditorPanesToEditors.keys(),e=>e.typeId===i)}getEditorPanes(){return Array.from(this.mapEditorPanesToEditors.keys())}getEditors(){let i=[];for(let e of this.mapEditorPanesToEditors.keys()){let t=this.mapEditorPanesToEditors.get(e);t&&i.push(...t.map(o=>o.ctor))}return i}};ne.add(qo.EditorPane,new sgi);function Jto(a,i){let e=a.get(ee),t=a.get(ht),o=a.get(Xa);return new Promise(n=>{let r=[...i],s=e.onDidCloseEditor(async l=>{if(l.context===2)return;let c=po.getOriginalUri(l.editor,{supportSideBySide:1}),u=po.getOriginalUri(l.editor,{supportSideBySide:2});if(l.context===1){let p=po.getOriginalUri(e.activeEditor,{supportSideBySide:1}),h=po.getOriginalUri(e.activeEditor,{supportSideBySide:2});t.extUri.isEqual(c,p)&&(c=void 0),t.extUri.isEqual(u,h)&&(u=void 0)}if(r=r.filter(p=>!(t.extUri.isEqual(p,c)||t.extUri.isEqual(p,u)||l.context!==1&&(c?.scheme===Q.untitled&&t.extUri.isEqual(p,c.with({scheme:p.scheme}))||u?.scheme===Q.untitled&&t.extUri.isEqual(p,u.with({scheme:p.scheme}))))),r.length===0){let p=i.filter(h=>o.isDirty(h));return p.length>0&&await dn.settled(p.map(async h=>await new Promise(g=>{if(!o.isDirty(h))return g();let f=o.onDidChangeDirty(v=>{if(!v.isDirty()&&t.extUri.isEqual(h,v.resource))return f.dispose(),g()})}))),s.dispose(),n()}})})}function IJ(a,i,e,t){let o=a.getAriaLabel();return e&&!e.isPinned(a)&&(o=d(3786,null,o)),e?.isSticky(i??a)&&(o=d(3785,null,o)),e&&typeof t=="number"&&t>1&&(o=`${o}, ${e.ariaLabel}`),o}var I4=class extends yu{constructor(e,t,o){super(t);this.id=e;this.memento=new Al(this.id,o),this._register(o.onWillSaveState(()=>{this.saveState(),this.memento.saveMemento()}))}getId(){return this.id}getMemento(e,t){return this.memento.getMemento(e,t)}reloadMemento(e){this.memento.reloadMemento(e)}onDidChangeMementoValue(e,t){return this.memento.onDidChangeValue(e,t)}saveState(){}};var RTe=class extends I4{constructor(e,t,o,n){super(e,o,n);this.telemetryService=t;this._onTitleAreaUpdate=this._register(new E);this.onTitleAreaUpdate=this._onTitleAreaUpdate.event;this._hasFocus=!1;this.visible=!1}get onDidFocus(){return this._onDidFocus||(this._onDidFocus=this.registerFocusTrackEvents().onDidFocus),this._onDidFocus.event}get onDidBlur(){return this._onDidBlur||(this._onDidBlur=this.registerFocusTrackEvents().onDidBlur),this._onDidBlur.event}hasFocus(){return this._hasFocus}registerFocusTrackEvents(){let e=Ci(this.getContainer()),t=this._register(qn(e)),o=this._onDidFocus=this._register(new E);this._register(t.onDidFocus(()=>{this._hasFocus=!0,o.fire()}));let n=this._onDidBlur=this._register(new E);return this._register(t.onDidBlur(()=>{this._hasFocus=!1,n.fire()})),{onDidFocus:o,onDidBlur:n}}getTitle(){}create(e){this.parent=e}getContainer(){return this.parent}setVisible(e){this.visible!==!!e&&(this.visible=e)}focus(){}getMenuIds(){return[]}getActions(){return[]}getSecondaryActions(){return[]}getContextMenuActions(){return[]}getActionViewItem(e,t){}getActionsContext(){return null}getActionRunner(){return this.actionRunner||(this.actionRunner=this._register(new rs)),this.actionRunner}updateTitleArea(){this._onTitleAreaUpdate.fire()}isVisible(){return this.visible}getControl(){}},_Rt=class{constructor(i,e,t,o,n,r){this.ctor=i;this.id=e;this.name=t;this.cssClass=o;this.order=n;this.requestedIndex=r}instantiate(i){return i.createInstance(this.ctor)}},DRt=class extends x{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.composites=[]}registerComposite(e){this.compositeById(e.id)||(this.composites.push(e),this._onDidRegister.fire(e))}deregisterComposite(e){let t=this.compositeById(e);t&&(this.composites.splice(this.composites.indexOf(t),1),this._onDidDeregister.fire(t))}getComposite(e){return this.compositeById(e)}getComposites(){return this.composites.slice(0)}compositeById(e){return this.composites.find(t=>t.id===e)}};var hue=class{constructor(i){this.defaultValue=i}verify(i){return this.isType(i)?i:this.defaultValue}},mm=class extends hue{isType(i){return typeof i=="boolean"}},MTe=class extends hue{isType(i){return typeof i=="number"}},LRt=class extends hue{isType(i){return i instanceof Set}},qC=class extends hue{constructor(i,e){super(i),this.allowedValues=e}isType(i){return this.allowedValues.includes(i)}},O9e=class extends hue{constructor(e,t){super(e);this.verifier=t}verify(e){return this.isType(e)?lgi(this.verifier,e):this.defaultValue}isType(e){return xi(e)}};function lgi(a,i){let e=Object.create(null);for(let t in a)if(Object.hasOwnProperty.call(a,t)){let o=a[t];e[t]=o.verify(i[t])}return e}var hT=new si(220,70),y4=new si(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),al={showTabs:"multiple",highlightModifiedTabs:!1,tabActionLocation:"right",tabActionCloseVisibility:!0,tabActionUnpinVisibility:!0,showTabIndex:!1,alwaysShowEditorActions:!1,tabSizing:"fit",tabSizingFixedMinWidth:50,tabSizingFixedMaxWidth:160,pinnedTabSizing:"normal",pinnedTabsOnSeparateRow:!1,tabHeight:"default",preventPinnedEditorClose:"keyboardAndMouse",titleScrollbarSizing:"default",titleScrollbarVisibility:"auto",focusRecentEditorAfterClose:!0,showIcons:!0,hasIcons:!0,enablePreview:!0,openPositioning:"right",openSideBySideDirection:"right",closeEmptyGroups:!0,labelFormat:"default",splitSizing:"auto",splitOnDragAndDrop:!0,allowDropIntoGroup:!0,dragToOpenWindow:!0,centeredLayoutFixedWidth:!1,doubleClickTabToToggleEditorGroupSizes:"expand",editorActionsLocation:"default",wrapTabs:!1,enablePreviewFromQuickOpen:!1,scrollToSwitchTabs:!1,enablePreviewFromCodeNavigation:!1,closeOnFileDelete:!1,swipeToNavigate:!1,mouseBackForwardToNavigate:!0,restoreViewState:!0,splitInGroupLayout:"horizontal",revealIfOpen:!1,get limit(){return{enabled:!1,value:10,perEditorGroup:!1,excludeDirty:!1}},get decorations(){return{badges:!0,colors:!0}},get autoLockGroups(){return new Set}};function Zto(a){return a.affectsConfiguration("workbench.editor")||a.affectsConfiguration("workbench.iconTheme")||a.affectsConfiguration("window.density")}function cgi(a,i){let e={...al,hasIcons:i.getFileIconTheme().hasFileIcons},t=a.getValue();if(t?.workbench?.editor)if(Object.assign(e,t.workbench.editor),xi(t.workbench.editor.autoLockGroups)){e.autoLockGroups=al.autoLockGroups;for(let[n,r]of Object.entries(t.workbench.editor.autoLockGroups))r===!0&&e.autoLockGroups.add(n)}else e.autoLockGroups=al.autoLockGroups;let o=a.getValue();return o?.window?.density?.editorTabHeight&&(e.tabHeight=o.window.density.editorTabHeight),J$o(e)}function J$o(a){return typeof a.showTabs=="boolean"&&(a.showTabs=a.showTabs?"multiple":"single"),lgi({wrapTabs:new mm(al.wrapTabs),scrollToSwitchTabs:new mm(al.scrollToSwitchTabs),highlightModifiedTabs:new mm(al.highlightModifiedTabs),tabActionCloseVisibility:new mm(al.tabActionCloseVisibility),tabActionUnpinVisibility:new mm(al.tabActionUnpinVisibility),showTabIndex:new mm(al.showTabIndex),alwaysShowEditorActions:new mm(al.alwaysShowEditorActions),pinnedTabsOnSeparateRow:new mm(al.pinnedTabsOnSeparateRow),focusRecentEditorAfterClose:new mm(al.focusRecentEditorAfterClose),showIcons:new mm(al.showIcons),enablePreview:new mm(al.enablePreview),enablePreviewFromQuickOpen:new mm(al.enablePreviewFromQuickOpen),enablePreviewFromCodeNavigation:new mm(al.enablePreviewFromCodeNavigation),closeOnFileDelete:new mm(al.closeOnFileDelete),closeEmptyGroups:new mm(al.closeEmptyGroups),revealIfOpen:new mm(al.revealIfOpen),swipeToNavigate:new mm(al.swipeToNavigate),mouseBackForwardToNavigate:new mm(al.mouseBackForwardToNavigate),restoreViewState:new mm(al.restoreViewState),splitOnDragAndDrop:new mm(al.splitOnDragAndDrop),allowDropIntoGroup:new mm(al.allowDropIntoGroup),dragToOpenWindow:new mm(al.dragToOpenWindow),centeredLayoutFixedWidth:new mm(al.centeredLayoutFixedWidth),hasIcons:new mm(al.hasIcons),tabSizingFixedMinWidth:new MTe(al.tabSizingFixedMinWidth),tabSizingFixedMaxWidth:new MTe(al.tabSizingFixedMaxWidth),showTabs:new qC(al.showTabs,["multiple","single","none"]),tabActionLocation:new qC(al.tabActionLocation,["left","right"]),tabSizing:new qC(al.tabSizing,["fit","shrink","fixed"]),pinnedTabSizing:new qC(al.pinnedTabSizing,["normal","compact","shrink"]),tabHeight:new qC(al.tabHeight,["default","compact"]),preventPinnedEditorClose:new qC(al.preventPinnedEditorClose,["keyboardAndMouse","keyboard","mouse","never"]),titleScrollbarSizing:new qC(al.titleScrollbarSizing,["default","large"]),titleScrollbarVisibility:new qC(al.titleScrollbarVisibility,["auto","visible","hidden"]),openPositioning:new qC(al.openPositioning,["left","right","first","last"]),openSideBySideDirection:new qC(al.openSideBySideDirection,["right","down"]),labelFormat:new qC(al.labelFormat,["default","short","medium","long"]),splitInGroupLayout:new qC(al.splitInGroupLayout,["vertical","horizontal"]),splitSizing:new qC(al.splitSizing,["distribute","split","auto"]),doubleClickTabToToggleEditorGroupSizes:new qC(al.doubleClickTabToToggleEditorGroupSizes,["maximize","expand","off"]),editorActionsLocation:new qC(al.editorActionsLocation,["default","titleBar","hidden"]),autoLockGroups:new LRt(al.autoLockGroups),limit:new O9e(al.limit,{enabled:new mm(al.limit.enabled),value:new MTe(al.limit.value),perEditorGroup:new mm(al.limit.perEditorGroup),excludeDirty:new mm(al.limit.excludeDirty)}),decorations:new O9e(al.decorations,{badges:new mm(al.decorations.badges),colors:new mm(al.decorations.colors)})},a)}function dgi(a,i,e){return!i||!a.activeEditor||i.matches(a.activeEditor)?{...e,viewState:a.activeEditorPane?.getViewState()}:e||Object.create(null)}function yJ(a,i,e){if(i.length===0)return[];let t=[],o,n=[];for(let s of i)!o&&a.isActive(s)?o=s:n.push(s);o||(o=n.shift()),n.sort((s,l)=>a.getIndexOfEditor(l)-a.getIndexOfEditor(s));let r=di([o,...n]);for(let s=0;s<r.length;s++){let l=r[s];t.push({editor:l,options:{pinned:!0,sticky:a.isSticky(l),inactive:s>0,preserveFocus:e}})}return t}var Ts=class a extends RTe{constructor(e,t,o,n,r){super(e,o,n,r);this.group=t;this.onDidChangeSizeConstraints=U.None;this._onDidChangeControl=this._register(new E);this.onDidChangeControl=this._onDidChangeControl.event}static{this.EDITOR_MEMENTOS=new Map}get minimumWidth(){return hT.width}get maximumWidth(){return y4.width}get minimumHeight(){return hT.height}get maximumHeight(){return y4.height}get input(){return this._input}get options(){return this._options}get window(){return rb(this.group.windowId,!0).window}get scopedContextKeyService(){}create(e){super.create(e),this.createEditor(e)}async setInput(e,t,o,n){this._input=e,this._options=t}clearInput(){this._input=void 0,this._options=void 0}setOptions(e){this._options=e}setVisible(e){super.setVisible(e),this.setEditorVisible(e)}setEditorVisible(e){}setBoundarySashes(e){}getEditorMemento(e,t,o,n=10){let r=`${this.getId()}${o}`,s=a.EDITOR_MEMENTOS.get(r);return s||(s=this._register(new ugi(this.getId(),o,this.getMemento(1,1),n,e,t)),a.EDITOR_MEMENTOS.set(r,s)),s}getViewState(){}saveState(){for(let[,e]of a.EDITOR_MEMENTOS)e.id===this.getId()&&e.saveState();super.saveState()}dispose(){this._input=void 0,this._options=void 0,super.dispose()}},ugi=class a extends x{constructor(e,t,o,n,r,s){super();this.id=e;this.key=t;this.memento=o;this.limit=n;this.editorGroupService=r;this.configurationService=s;this.cleanedUp=!1;this.shareEditorState=!1;this.updateConfiguration(void 0),this.registerListeners()}static{this.SHARED_EDITOR_STATE=-1}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>this.updateConfiguration(e)))}updateConfiguration(e){(!e||e.affectsConfiguration(void 0,"workbench.editor.sharedViewState"))&&(this.shareEditorState=this.configurationService.getValue(void 0,"workbench.editor.sharedViewState")===!0)}saveEditorState(e,t,o){let n=this.doGetResource(t);if(!n||!e)return;let r=this.doLoad(),s=r.get(n.toString());s||(s=Object.create(null),r.set(n.toString(),s)),s[e.id]=o,this.shareEditorState&&(s[a.SHARED_EDITOR_STATE]=o),ka(t)&&this.clearEditorStateOnDispose(n,t)}loadEditorState(e,t){let o=this.doGetResource(t);if(!o||!e)return;let r=this.doLoad().get(o.toString());if(r){let s=r[e.id];if(s)return s;if(this.shareEditorState)return r[a.SHARED_EDITOR_STATE]}}clearEditorState(e,t){ka(e)&&this.editorDisposables?.delete(e);let o=this.doGetResource(e);if(o){let n=this.doLoad();if(t){let r=n.get(o.toString());r&&(delete r[t.id],Of(r)&&n.delete(o.toString()))}else n.delete(o.toString())}}clearEditorStateOnDispose(e,t){this.editorDisposables||(this.editorDisposables=new Map),this.editorDisposables.has(t)||this.editorDisposables.set(t,U.once(t.onWillDispose)(()=>{this.clearEditorState(e),this.editorDisposables?.delete(t)}))}moveEditorState(e,t,o){let n=this.doLoad(),r=[...n.keys()];for(let s of r){let l=A.parse(s);if(!o.isEqualOrParent(l,e))continue;let c;if(Qe(e,l))c=t;else{let p=hIe(l.path,e.path);c=Ge(t,l.path.substr(p+e.path.length+1))}let u=n.get(s,0);u&&(n.delete(s),n.set(c.toString(),u))}}doGetResource(e){return ka(e)?e.resource:e}doLoad(){if(!this.cache){this.cache=new dl(this.limit);let e=this.memento[this.key];Array.isArray(e)&&this.cache.fromJSON(e)}return this.cache}saveState(){let e=this.doLoad();this.cleanedUp||(this.cleanUp(),this.cleanedUp=!0),this.memento[this.key]=e.toJSON()}cleanUp(){let e=this.doLoad(),t=[...e.entries()];for(let[o,n]of t)for(let r of Object.keys(n)){let s=Number(r);s===a.SHARED_EDITOR_STATE&&this.shareEditorState||this.editorGroupService.getGroup(s)||(delete n[s],Of(n)&&e.delete(o))}}};var $F=class extends Ts{constructor(e,t,o,n,r,s,l,c,u,p){super(e,t,n,c,s);this.instantiationService=r;this.textResourceConfigurationService=l;this.editorService=u;this.editorGroupService=p;this.groupListener=this._register(new me);this.viewState=this.getEditorMemento(p,l,o,100)}setEditorVisible(e){this.groupListener.value=this.group.onWillCloseEditor(t=>this.onWillCloseEditor(t)),super.setEditorVisible(e)}onWillCloseEditor(e){let t=e.editor;t===this.input&&this.updateEditorViewState(t)}clearInput(){this.updateEditorViewState(this.input),super.clearInput()}saveState(){this.updateEditorViewState(this.input),super.saveState()}updateEditorViewState(e){if(!e||!this.tracksEditorViewState(e))return;let t=this.toEditorViewStateResource(e);t&&(this.tracksDisposedEditorViewState()||(this.editorViewStateDisposables||(this.editorViewStateDisposables=this._register(new Vt)),this.editorViewStateDisposables.has(e)||this.editorViewStateDisposables.set(e,U.once(e.onWillDispose)(()=>{this.clearEditorViewState(t,this.group),this.editorViewStateDisposables?.deleteAndDispose(e)}))),e.isDisposed()&&!this.tracksDisposedEditorViewState()||!this.shouldRestoreEditorViewState(e)&&!this.group.contains(e)?(this.clearEditorViewState(t,this.group),this.editorViewStateDisposables?.deleteAndDispose(e)):e.isDisposed()||this.saveEditorViewState(t))}shouldRestoreEditorViewState(e,t){return t?.newInGroup?this.textResourceConfigurationService.getValue(po.getOriginalUri(e,{supportSideBySide:1}),"workbench.editor.restoreViewState")!==!1:!0}getViewState(){let e=this.input;if(!e||!this.tracksEditorViewState(e))return;let t=this.toEditorViewStateResource(e);if(t)return this.computeEditorViewState(t)}saveEditorViewState(e){let t=this.computeEditorViewState(e);t&&this.viewState.saveEditorState(this.group,e,t)}loadEditorViewState(e,t){if(!e||!this.tracksEditorViewState(e)||!this.shouldRestoreEditorViewState(e,t))return;let o=this.toEditorViewStateResource(e);if(o)return this.viewState.loadEditorState(this.group,o)}moveEditorViewState(e,t,o){return this.viewState.moveEditorState(e,t,o)}clearEditorViewState(e,t){this.viewState.clearEditorState(e,t)}tracksDisposedEditorViewState(){return!1}};$F=I([m(3,Te),m(4,F),m(5,ce),m(6,Fn),m(7,Le),m(8,ee),m(9,wt)],$F);var $R=class extends $F{constructor(e,t,o,n,r,s,l,c,u,p){super(e,t,$R.VIEW_STATE_PREFERENCE_KEY,o,n,r,s,l,c,u);this.fileService=p;this._onDidChangeSelection=this._register(new E);this.onDidChangeSelection=this._onDidChangeSelection.event;this._onDidChangeScroll=this._register(new E);this.onDidChangeScroll=this._onDidChangeScroll.event;this.inputListener=this._register(new me);this._register(this.textResourceConfigurationService.onDidChangeConfiguration(h=>this.handleConfigurationChangeEvent(h))),this._register(U.any(this.editorGroupService.onDidAddGroup,this.editorGroupService.onDidRemoveGroup)(()=>{let h=this.computeAriaLabel();this.editorContainer?.setAttribute("aria-label",h),this.updateEditorControlOptions({ariaLabel:h})})),this._register(this.fileService.onDidChangeFileSystemProviderCapabilities(h=>this.onDidChangeFileSystemProvider(h.scheme))),this._register(this.fileService.onDidChangeFileSystemProviderRegistrations(h=>this.onDidChangeFileSystemProvider(h.scheme)))}static{this.VIEW_STATE_PREFERENCE_KEY="textEditorViewState"}handleConfigurationChangeEvent(e){let t=this.getActiveResource();this.shouldHandleConfigurationChangeEvent(e,t)&&(this.isVisible()?this.updateEditorConfiguration(t):this.hasPendingConfigurationChange=!0)}shouldHandleConfigurationChangeEvent(e,t){return e.affectsConfiguration(t,"editor")||e.affectsConfiguration(t,"problems.visibility")}consumePendingConfigurationChangeEvent(){this.hasPendingConfigurationChange&&(this.updateEditorConfiguration(),this.hasPendingConfigurationChange=!1)}computeConfiguration(e){let t=xi(e.editor)?Ji(e.editor):Object.create(null);return Object.assign(t,this.getConfigurationOverrides(e)),t.ariaLabel=this.computeAriaLabel(),t}computeAriaLabel(){return this.input?IJ(this.input,void 0,this.group,this.editorGroupService.count):d(4340,null)}onDidChangeFileSystemProvider(e){this.input&&this.getActiveResource()?.scheme===e&&this.updateReadonly(this.input)}onDidChangeInputCapabilities(e){this.input===e&&this.updateReadonly(e)}updateReadonly(e){this.updateEditorControlOptions({...this.getReadonlyConfiguration(e.isReadonly())})}getReadonlyConfiguration(e){return{readOnly:!!e,readOnlyMessage:typeof e!="boolean"?e:void 0}}getConfigurationOverrides(e){return{overviewRulerLanes:3,lineNumbersMinChars:3,fixedOverflowWidgets:!0,...this.getReadonlyConfiguration(this.input?.isReadonly()),renderValidationDecorations:e.problems?.visibility!==!1?"on":"off"}}createEditor(e){this.editorContainer=e,this.createEditorControl(e,this.computeConfiguration(this.textResourceConfigurationService.getValue(this.getActiveResource()))),this.registerCodeEditorListeners()}registerCodeEditorListeners(){let e=this.getMainControl();e&&(this._register(e.onDidChangeModelLanguage(()=>this.updateEditorConfiguration())),this._register(e.onDidChangeModel(()=>this.updateEditorConfiguration())),this._register(e.onDidChangeCursorPosition(t=>this._onDidChangeSelection.fire({reason:this.toEditorPaneSelectionChangeReason(t)}))),this._register(e.onDidChangeModelContent(()=>this._onDidChangeSelection.fire({reason:3}))),this._register(e.onDidScrollChange(()=>this._onDidChangeScroll.fire())))}toEditorPaneSelectionChangeReason(e){switch(e.source){case"api":return 1;case"code.navigation":return 4;case"code.jump":return 5;default:return 2}}getSelection(){let e=this.getMainControl();if(e){let t=e.getSelection();if(t)return new pgi(t)}}async setInput(e,t,o,n){await super.setInput(e,t,o,n),this.inputListener.value=e.onDidChangeCapabilities(()=>this.onDidChangeInputCapabilities(e)),this.updateEditorConfiguration(),Ci(this.editorContainer).setAttribute("aria-label",this.computeAriaLabel())}clearInput(){this.inputListener.clear(),super.clearInput()}getScrollPosition(){let e=this.getMainControl();if(!e)throw new Error("Control has not yet been initialized");return{scrollTop:e.getScrollTop()-e.getTopForLineNumber(1),scrollLeft:e.getScrollLeft()}}setScrollPosition(e){let t=this.getMainControl();if(!t)throw new Error("Control has not yet been initialized");t.setScrollTop(e.scrollTop),e.scrollLeft&&t.setScrollLeft(e.scrollLeft)}setEditorVisible(e){e&&this.consumePendingConfigurationChangeEvent(),super.setEditorVisible(e)}toEditorViewStateResource(e){return e.resource}updateEditorConfiguration(e=this.getActiveResource()){let t;if(e&&(t=this.textResourceConfigurationService.getValue(e)),!t)return;let o=this.computeConfiguration(t),n=o;this.lastAppliedEditorOptions&&(n=J$e(this.lastAppliedEditorOptions,n)),Object.keys(n).length>0&&(this.lastAppliedEditorOptions=o,this.updateEditorControlOptions(n))}getActiveResource(){let e=this.getMainControl();if(e){let t=e.getModel();if(t)return t.uri}if(this.input)return this.input.resource}dispose(){this.lastAppliedEditorOptions=void 0,super.dispose()}};$R=I([m(2,Te),m(3,F),m(4,ce),m(5,Fn),m(6,Le),m(7,ee),m(8,wt),m(9,fe)],$R);var pgi=class a{constructor(i){this.textSelection=i}static{this.TEXT_EDITOR_SELECTION_THRESHOLD=10}compare(i){if(!(i instanceof a))return 3;let e=Math.min(this.textSelection.selectionStartLineNumber,this.textSelection.positionLineNumber),t=Math.min(i.textSelection.selectionStartLineNumber,i.textSelection.positionLineNumber);return e===t?1:Math.abs(e-t)<a.TEXT_EDITOR_SELECTION_THRESHOLD?2:3}restore(i){return{...i,selection:this.textSelection,selectionRevealType:1}}log(){return`line: ${this.textSelection.startLineNumber}-${this.textSelection.endLineNumber}, col:  ${this.textSelection.startColumn}-${this.textSelection.endColumn}`}};var us=le("paneCompositePartService");var W9e="views",V9e=d(5088,null),PTe=Ae("default-view-icon",R.window,d(5085,null)),Mn;(e=>(e.ViewContainersRegistry="workbench.registry.view.containers",e.ViewsRegistry="workbench.registry.view"))(Mn||={});function Pw(a){switch(a){case 0:return"sidebar";case 1:return"panel";case 2:return"auxiliarybar";case 3:return"chatbar"}}var mgi=class extends x{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,t,o){let n=this.get(e.id);if(n)return n;let r=e;return r.openCommandActionDescriptor=o?.doNotRegisterOpenCommand?void 0:r.openCommandActionDescriptor??{id:r.id},aV(this.viewContainers,t,[]).push(r),o?.isDefault&&this.defaultViewContainers.push(r),this._onDidRegister.fire({viewContainer:r,viewContainerLocation:t}),r}deregisterViewContainer(e){for(let t of this.viewContainers.keys()){let o=this.viewContainers.get(t),n=o?.indexOf(e);if(n!==-1){o?.splice(n,1),o.length===0&&this.viewContainers.delete(t),this._onDidDeregister.fire({viewContainer:e,viewContainerLocation:t});return}}}get(e){return this.all.filter(t=>t.id===e)[0]}getViewContainers(e){return[...this.viewContainers.get(e)||[]]}getViewContainerLocation(e){return[...this.viewContainers.keys()].filter(t=>this.getViewContainers(t).filter(o=>o?.id===e.id).length>0)[0]}getDefaultViewContainers(e){return this.defaultViewContainers.filter(t=>this.getViewContainerLocation(t)===e)}};ne.add(Mn.ViewContainersRegistry,new mgi);function Z$o(a,i){let e=a.group??"9_more",t=i.group??"9_more";return e!==t?e.localeCompare(t):(a.order??5)-(i.order??5)}var hgi=class extends x{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 n1}registerViews(e,t){this.registerViews2([{views:e,viewContainer:t}])}registerViews2(e){e.forEach(({views:t,viewContainer:o})=>this.addViews(t,o)),this._onViewsRegistered.fire(e)}deregisterViews(e,t){let o=this.removeViews(e,t);o.length&&this._onViewsDeregistered.fire({views:o,viewContainer:t})}moveViews(e,t){for(let o of this._views.keys())if(o!==t){let n=this.removeViews(e,o);n.length&&(this.addViews(n,t),this._onDidChangeContainer.fire({views:n,from:o,to:t}))}}getViews(e){return this._views.get(e)||[]}getView(e){for(let t of this._viewContainers){let o=(this._views.get(t)||[]).filter(n=>n.id===e)[0];if(o)return o}return null}getViewContainer(e){for(let t of this._viewContainers)if((this._views.get(t)||[]).filter(n=>n.id===e)[0])return t;return null}registerViewWelcomeContent(e,t){return this._viewWelcomeContents.add(e,t),this._onDidChangeViewWelcomeContent.fire(e),Z(()=>{this._viewWelcomeContents.delete(e,t),this._onDidChangeViewWelcomeContent.fire(e)})}registerViewWelcomeContent2(e,t){let o=new Map;for(let[n,r]of t)this._viewWelcomeContents.add(e,r),o.set(n,Z(()=>{this._viewWelcomeContents.delete(e,r),this._onDidChangeViewWelcomeContent.fire(e)}));return this._onDidChangeViewWelcomeContent.fire(e),o}getViewWelcomeContent(e){let t=[];return this._viewWelcomeContents.forEach(e,o=>t.push(o)),t.sort(Z$o)}addViews(e,t){let o=this._views.get(t);o||(o=[],this._views.set(t,o),this._viewContainers.push(t));for(let n of e){if(this.getView(n.id)!==null)throw new Error(d(5086,null,n.id));o.push(n)}}removeViews(e,t){let o=this._views.get(t);if(!o)return[];let n=[],r=[];for(let s of o)e.includes(s)?n.push(s):r.push(s);return n.length&&(r.length?this._views.set(t,r):(this._views.delete(t),this._viewContainers.splice(this._viewContainers.indexOf(t),1))),n}};ne.add(Mn.ViewsRegistry,new hgi);var Bi=le("viewDescriptorService");var w4=class{constructor(i,e){this.resolved=!1;this._hasResolve=!1;Xu(this,i),this._hasResolve=!!e,this.resolve=async t=>{if(e&&!this.resolved){let o=await e(t);o&&(this.tooltip=this.tooltip??o.tooltip,this.command=this.command??o.command)}t.isCancellationRequested||(this.resolved=!0)}}get hasResolve(){return this._hasResolve}resetResolve(){this.resolved=!1}asTreeItem(){return{handle:this.handle,parentHandle:this.parentHandle,collapsibleState:this.collapsibleState,label:this.label,description:this.description,icon:this.icon,iconDark:this.iconDark,themeIcon:this.themeIcon,resourceUri:this.resourceUri,tooltip:this.tooltip,contextValue:this.contextValue,command:this.command,children:this.children,accessibilityInformation:this.accessibilityInformation}}},PRt=class extends Error{constructor(e){super(d(5087,null,e));this.name="NoTreeViewError"}static is(e){return!!e&&e.name==="NoTreeViewError"}};var ggi=class{constructor(i){this.editor=i;this.id=`${i.getId()},${i.getModel().id}`}},U9e=class{constructor(i,e,t,o,n,r){this.removedDocuments=i;this.addedDocuments=e;this.removedEditors=t;this.addedEditors=o;this.oldActiveEditor=n;this.newActiveEditor=r;this.isEmpty=this.removedDocuments.length===0&&this.addedDocuments.length===0&&this.removedEditors.length===0&&this.addedEditors.length===0&&n===r}toString(){let i=`DocumentAndEditorStateDelta
`;return i+=`	Removed Documents: [${this.removedDocuments.map(e=>e.uri.toString(!0)).join(", ")}]
`,i+=`	Added Documents: [${this.addedDocuments.map(e=>e.uri.toString(!0)).join(", ")}]
`,i+=`	Removed Editors: [${this.removedEditors.map(e=>e.id).join(", ")}]
`,i+=`	Added Editors: [${this.addedEditors.map(e=>e.id).join(", ")}]
`,i+=`	New Active Editor: ${this.newActiveEditor}
`,i}},H9e=class{constructor(i,e,t){this.documents=i;this.textEditors=e;this.activeEditor=t}static compute(i,e){if(!i)return new U9e([],[...e.documents.values()],[],[...e.textEditors.values()],void 0,e.activeEditor);let t=t1(i.documents,e.documents),o=i$e(i.textEditors,e.textEditors),n=i.activeEditor!==e.activeEditor?i.activeEditor:void 0,r=i.activeEditor!==e.activeEditor?e.activeEditor:void 0;return new U9e(t.removed,t.added,o.removed,o.added,n,r)}};var B9e=class{constructor(i,e,t,o,n){this._onDidChangeState=i;this._modelService=e;this._codeEditorService=t;this._editorService=o;this._paneCompositeService=n;this._toDispose=new N;this._toDisposeOnEditorRemove=new Vt;this._activeEditorOrder=0;this._modelService.onModelAdded(this._updateStateOnModelAdd,this,this._toDispose),this._modelService.onModelRemoved(r=>this._updateState(),this,this._toDispose),this._editorService.onDidActiveEditorChange(r=>this._updateState(),this,this._toDispose),this._codeEditorService.onCodeEditorAdd(this._onDidAddEditor,this,this._toDispose),this._codeEditorService.onCodeEditorRemove(this._onDidRemoveEditor,this,this._toDispose),this._codeEditorService.listCodeEditors().forEach(this._onDidAddEditor,this),U.filter(this._paneCompositeService.onDidPaneCompositeOpen,r=>r.viewContainerLocation===1)(r=>this._activeEditorOrder=1,void 0,this._toDispose),U.filter(this._paneCompositeService.onDidPaneCompositeClose,r=>r.viewContainerLocation===1)(r=>this._activeEditorOrder=0,void 0,this._toDispose),this._editorService.onDidVisibleEditorsChange(r=>this._activeEditorOrder=0,void 0,this._toDispose),this._updateState()}dispose(){this._toDispose.dispose(),this._toDisposeOnEditorRemove.dispose()}_onDidAddEditor(i){this._toDisposeOnEditorRemove.set(i.getId(),wn(i.onDidChangeModel(()=>this._updateState()),i.onDidFocusEditorText(()=>this._updateState()),i.onDidFocusEditorWidget(()=>this._updateState(i)))),this._updateState()}_onDidRemoveEditor(i){let e=i.getId();this._toDisposeOnEditorRemove.has(e)&&(this._toDisposeOnEditorRemove.deleteAndDispose(e),this._updateState())}_updateStateOnModelAdd(i){if(Hx(i)){if(!this._currentState){this._updateState();return}this._currentState=new H9e(this._currentState.documents.add(i),this._currentState.textEditors,this._currentState.activeEditor),this._onDidChangeState(new U9e([],[i],[],[],void 0,void 0))}}_updateState(i){let e=new Set;for(let s of this._modelService.getModels())Hx(s)&&e.add(s);let t=new Map,o=null;for(let s of this._codeEditorService.listCodeEditors()){if(s.isSimpleWidget)continue;let l=s.getModel();if(s.hasModel()&&l&&Hx(l)&&!l.isDisposed()&&this._modelService.getModel(l.uri)){let c=new ggi(s);t.set(c.id,c),(s.hasTextFocus()||i===s&&s.hasWidgetFocus())&&(o=c.id)}}if(!o){let s;if(this._activeEditorOrder===0?s=this._getActiveEditorFromEditorPart()||this._getActiveEditorFromPanel():s=this._getActiveEditorFromPanel()||this._getActiveEditorFromEditorPart(),s)for(let l of t.values())s===l.editor&&(o=l.id)}let n=new H9e(e,t,o),r=H9e.compute(this._currentState,n);r.isEmpty||(this._currentState=n,this._onDidChangeState(r))}_getActiveEditorFromPanel(){let i=this._paneCompositeService.getActivePaneComposite(1);if(i instanceof $R){let e=i.getControl();if(pn(e))return e}}_getActiveEditorFromEditorPart(){let i=this._editorService.activeTextEditorControl;return mc(i)&&(i=i.getModifiedEditor()),i}};B9e=I([m(1,Tt),m(2,qt),m(3,ee),m(4,us)],B9e);var ARt=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){this._modelService=e;this._textFileService=t;this._editorService=o;this._editorGroupService=l;this._clipboardService=g;this._toDispose=new N;this._textEditors=new Map;this._proxy=i.getProxy(to.ExtHostDocumentsAndEditors),this._mainThreadDocuments=this._toDispose.add(new kTe(i,this._modelService,this._textFileService,r,s,u,h,p,f)),i.set(qi.MainThreadDocuments,this._mainThreadDocuments),this._mainThreadEditors=this._toDispose.add(new SJ(this,i,n,this._editorService,this._editorGroupService,v,b,h)),i.set(qi.MainThreadTextEditors,this._mainThreadEditors),this._toDispose.add(new B9e(S=>this._onDelta(S),e,n,this._editorService,c))}dispose(){this._toDispose.dispose()}_onDelta(i){let e=[],t=[],o=i.removedDocuments.map(s=>s.uri);for(let s of i.addedEditors){let l=new wRt(s.id,s.editor.getModel(),s.editor,{onGainedFocus(){},onLostFocus(){}},this._mainThreadDocuments,this._modelService,this._clipboardService);this._textEditors.set(s.id,l),t.push(l)}for(let{id:s}of i.removedEditors){let l=this._textEditors.get(s);l&&(l.dispose(),this._textEditors.delete(s),e.push(s))}let n=Object.create(null),r=!0;i.newActiveEditor!==void 0&&(r=!1,n.newActiveEditor=i.newActiveEditor),o.length>0&&(r=!1,n.removedDocuments=o),e.length>0&&(r=!1,n.removedEditors=e),i.addedDocuments.length>0&&(r=!1,n.addedDocuments=i.addedDocuments.map(s=>this._toModelAddData(s))),i.addedEditors.length>0&&(r=!1,n.addedEditors=t.map(s=>this._toTextEditorAddData(s))),r||(this._proxy.$acceptDocumentsAndEditorsDelta(n),o.forEach(this._mainThreadDocuments.handleModelRemoved,this._mainThreadDocuments),i.addedDocuments.forEach(this._mainThreadDocuments.handleModelAdded,this._mainThreadDocuments),e.forEach(this._mainThreadEditors.handleTextEditorRemoved,this._mainThreadEditors),t.forEach(this._mainThreadEditors.handleTextEditorAdded,this._mainThreadEditors))}_toModelAddData(i){return{uri:i.uri,versionId:i.getVersionId(),lines:i.getLinesContent(),EOL:i.getEOL(),languageId:i.getLanguageId(),isDirty:this._textFileService.isDirty(i.uri),encoding:this._textFileService.getEncoding(i.uri)}}_toTextEditorAddData(i){let e=i.getProperties();return{id:i.getId(),documentUri:i.getModel().uri,options:e.options,selections:e.selections,visibleRanges:e.visibleRanges,editorPosition:this._findEditorPosition(i)}}_findEditorPosition(i){for(let e of this._editorService.visibleEditorPanes)if(i.matches(e))return GC(this._editorGroupService,e.group)}findTextEditorIdFor(i){for(let[e,t]of this._textEditors)if(t.matches(i))return e}getIdOfCodeEditor(i){for(let[e,t]of this._textEditors)if(t.getCodeEditor()===i)return e}getEditor(i){return this._textEditors.get(i)}};ARt=I([AR,m(1,Tt),m(2,Uo),m(3,ee),m(4,qt),m(5,fe),m(6,Bt),m(7,wt),m(8,us),m(9,At),m(10,qp),m(11,ht),m(12,Fi),m(13,An),m(14,B),m(15,qF)],ARt);var fgi={LEFT:"left",RIGHT:"right",FIRST:"first",LAST:"last"};function z9e(a){let i=a;return!!(i&&typeof i=="object"&&Array.isArray(i.editors)&&Array.isArray(i.mru))}function eio(a){let i=a;return i.kind===5&&i.editorIndex!==void 0}function tio(a){let i=a;return i.kind===7&&i.editorIndex!==void 0&&i.oldEditorIndex!==void 0}function iio(a){let i=a;return i.kind===6&&i.editorIndex!==void 0&&i.context!==void 0&&i.sticky!==void 0}var mA=class extends x{constructor(e,t,o){super();this.instantiationService=t;this.configurationService=o;this._onDidModelChange=this._register(new E({leakWarningThreshold:500}));this.onDidModelChange=this._onDidModelChange.event;this.editors=[];this.mru=[];this.editorListeners=new Set;this.locked=!1;this.selection=[];this.preview=null;this.sticky=-1;this.transient=new Set;z9e(e)?this._id=this.deserialize(e):this._id=mA.IDS++,this.onConfigurationUpdated(),this.registerListeners()}static{this.IDS=0}get id(){return this._id}get active(){return this.selection[0]??null}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>this.onConfigurationUpdated(e)))}onConfigurationUpdated(e){e&&!e.affectsConfiguration("workbench.editor.openPositioning")&&!e.affectsConfiguration("workbench.editor.focusRecentEditorAfterClose")||(this.editorOpenPositioning=this.configurationService.getValue("workbench.editor.openPositioning"),this.focusRecentEditorAfterClose=this.configurationService.getValue("workbench.editor.focusRecentEditorAfterClose"))}get count(){return this.editors.length}get stickyCount(){return this.sticky+1}getEditors(e,t){let o=e===0?this.mru.slice(0):this.editors.slice(0);return t?.excludeSticky?e===0?o.filter(n=>!this.isSticky(n)):o.slice(this.sticky+1):o}getEditorByIndex(e){return this.editors[e]}get activeEditor(){return this.active}isActive(e){return this.matches(this.active,e)}get previewEditor(){return this.preview}openEditor(e,t){let o=t?.sticky||typeof t?.index=="number"&&this.isSticky(t.index),n=t?.pinned||t?.sticky,r=!!t?.transient,s=t?.active||!this.activeEditor||!n&&this.preview===this.activeEditor,l=this.findEditor(e,t);if(l){let[c,u]=l;return this.doSetTransient(c,u,r===!1?!1:this.isTransient(c)),n&&this.doPin(c,u),this.setSelection(s?c:this.activeEditor,t?.inactiveSelection??[]),t&&typeof t.index=="number"&&this.moveEditor(c,t.index),o&&this.doStick(c,this.indexOf(c)),{editor:c,isNew:!1}}else{let c=e,u=this.indexOf(this.active),p;if(t&&typeof t.index=="number"?p=t.index:this.editorOpenPositioning===fgi.FIRST?(p=0,!o&&this.isSticky(p)&&(p=this.sticky+1)):this.editorOpenPositioning===fgi.LAST?p=this.editors.length:(this.editorOpenPositioning===fgi.LEFT?u===0||!this.editors.length?p=0:p=u:p=u+1,!o&&this.isSticky(p)&&(p=this.sticky+1)),o&&(this.sticky++,this.isSticky(p)||(p=this.sticky)),(n||!this.preview)&&this.splice(p,!1,c),r&&this.doSetTransient(c,p,!0),!n){if(this.preview){let g=this.indexOf(this.preview);p>g&&p--,this.replaceEditor(this.preview,c,p,!s)}this.preview=c}this.registerEditorListeners(c);let h={kind:5,editor:c,editorIndex:p};return this._onDidModelChange.fire(h),this.setSelection(s?c:this.activeEditor,t?.inactiveSelection??[]),{editor:c,isNew:!0}}}registerEditorListeners(e){let t=new N;this.editorListeners.add(t),t.add(U.once(e.onWillDispose)(()=>{let o=this.editors.indexOf(e);if(o>=0){let n={kind:15,editor:e,editorIndex:o};this._onDidModelChange.fire(n)}})),t.add(e.onDidChangeDirty(()=>{let o={kind:14,editor:e,editorIndex:this.editors.indexOf(e)};this._onDidModelChange.fire(o)})),t.add(e.onDidChangeLabel(()=>{let o={kind:9,editor:e,editorIndex:this.editors.indexOf(e)};this._onDidModelChange.fire(o)})),t.add(e.onDidChangeCapabilities(()=>{let o={kind:10,editor:e,editorIndex:this.editors.indexOf(e)};this._onDidModelChange.fire(o)})),t.add(this.onDidModelChange(o=>{o.kind===6&&o.editor?.matches(e)&&(Be(t),this.editorListeners.delete(t))}))}replaceEditor(e,t,o,n=!0){let r=this.doCloseEditor(e,1,n);if(this.splice(o,!1,t),r){let s={kind:6,...r};this._onDidModelChange.fire(s)}}closeEditor(e,t=0,o=!0){let n=this.doCloseEditor(e,t,o);if(n){let r={kind:6,...n};return this._onDidModelChange.fire(r),n}}doCloseEditor(e,t,o){let n=this.indexOf(e);if(n===-1)return;let r=this.editors[n],s=this.isSticky(n),l=this.active===r;if(o&&l)if(this.mru.length>1){let c;this.focusRecentEditorAfterClose?c=this.mru[1]:n===this.editors.length-1?c=this.editors[n-1]:c=this.editors[n+1];let u=this.selection.filter(p=>p!==r&&p!==c);this.doSetSelection(c,this.editors.indexOf(c),u)}else this.doSetSelection(null,void 0,[]);else if(!l&&this.doIsSelected(r)){let c=this.selection.filter(u=>u!==r&&u!==this.activeEditor);this.doSetSelection(this.activeEditor,this.indexOf(this.activeEditor),c)}return this.preview===r&&(this.preview=null),this.transient.delete(r),this.splice(n,!0),{editor:r,sticky:s,editorIndex:n,context:t}}moveEditor(e,t){t>=this.editors.length?t=this.editors.length-1:t<0&&(t=0);let o=this.indexOf(e);if(o<0||t===o)return;let n=this.editors[o],r=this.sticky;this.isSticky(o)&&t>this.sticky?this.sticky--:!this.isSticky(o)&&t<=this.sticky&&this.sticky++,this.editors.splice(o,1),this.editors.splice(t,0,n);let s={kind:7,editor:n,oldEditorIndex:o,editorIndex:t};if(this._onDidModelChange.fire(s),r!==this.sticky){let l={kind:13,editor:n,editorIndex:t};this._onDidModelChange.fire(l)}return n}setActive(e){let t;return e?t=this.setEditorActive(e):this.setGroupActive(),t}setGroupActive(){this._onDidModelChange.fire({kind:0})}setEditorActive(e){let t=this.findEditor(e);if(!t)return;let[o,n]=t;return this.doSetSelection(o,n,[]),o}get selectedEditors(){return this.editors.filter(e=>this.doIsSelected(e))}isSelected(e){let t;return typeof e=="number"?t=this.editors[e]:t=this.findEditor(e)?.[0],!!t&&this.doIsSelected(t)}doIsSelected(e){return this.selection.includes(e)}setSelection(e,t){let o=this.findEditor(e);if(!o)return;let[n,r]=o,s=new Set;for(let l of t){let c=this.findEditor(l);if(!c)return;let[u]=c;u!==n&&s.add(u)}this.doSetSelection(n,r,Array.from(s))}doSetSelection(e,t,o){let n=this.activeEditor,r=this.selection,s;e?s=[e,...o]:s=[],this.selection=s;let l=e&&typeof t=="number"&&n!==e;if(l){let c=this.indexOf(e,this.mru);this.mru.splice(c,1),this.mru.unshift(e);let u={kind:8,editor:e,editorIndex:t};this._onDidModelChange.fire(u)}if(l||r.length!==s.length||r.some(c=>!s.includes(c))){let c={kind:4};this._onDidModelChange.fire(c)}}setIndex(e){this._onDidModelChange.fire({kind:1})}setLabel(e){this._onDidModelChange.fire({kind:2})}pin(e){let t=this.findEditor(e);if(!t)return;let[o,n]=t;return this.doPin(o,n),o}doPin(e,t){if(this.isPinned(e))return;this.setTransient(e,!1),this.preview=null;let o={kind:11,editor:e,editorIndex:t};this._onDidModelChange.fire(o)}unpin(e){let t=this.findEditor(e);if(!t)return;let[o,n]=t;return this.doUnpin(o,n),o}doUnpin(e,t){if(!this.isPinned(e))return;let o=this.preview;this.preview=e;let n={kind:11,editor:e,editorIndex:t};this._onDidModelChange.fire(n),o&&this.closeEditor(o,3)}isPinned(e){let t;return typeof e=="number"?t=this.editors[e]:t=e,!this.matches(this.preview,t)}stick(e){let t=this.findEditor(e);if(!t)return;let[o,n]=t;return this.doStick(o,n),o}doStick(e,t){if(this.isSticky(t))return;this.pin(e);let o=this.sticky+1;this.moveEditor(e,o),this.sticky++;let n={kind:13,editor:e,editorIndex:o};this._onDidModelChange.fire(n)}unstick(e){let t=this.findEditor(e);if(!t)return;let[o,n]=t;return this.doUnstick(o,n),o}doUnstick(e,t){if(!this.isSticky(t))return;let o=this.sticky;this.moveEditor(e,o),this.sticky--;let n={kind:13,editor:e,editorIndex:o};this._onDidModelChange.fire(n)}isSticky(e){if(this.sticky<0)return!1;let t;return typeof e=="number"?t=e:t=this.indexOf(e),t<0?!1:t<=this.sticky}setTransient(e,t){if(!t&&this.transient.size===0)return;let o=this.findEditor(e);if(!o)return;let[n,r]=o;return this.doSetTransient(n,r,t),n}doSetTransient(e,t,o){if(o){if(this.transient.has(e))return;this.transient.add(e)}else{if(!this.transient.has(e))return;this.transient.delete(e)}let n={kind:12,editor:e,editorIndex:t};this._onDidModelChange.fire(n)}isTransient(e){if(this.transient.size===0)return!1;let t;return typeof e=="number"?t=this.editors[e]:t=this.findEditor(e)?.[0],!!t&&this.transient.has(t)}splice(e,t,o){let n=this.editors[e];if(t&&this.isSticky(e)&&this.sticky--,o?this.editors.splice(e,t?1:0,o):this.editors.splice(e,t?1:0),!t&&o)this.mru.length===0?this.mru.push(o):this.mru.splice(1,0,o);else{let r=this.indexOf(n,this.mru);t&&!o?this.mru.splice(r,1):t&&o&&this.mru.splice(r,1,o)}}indexOf(e,t=this.editors,o){let n=-1;if(!e)return n;for(let r=0;r<t.length;r++){let s=t[r];if(this.matches(s,e,o))if(o?.supportSideBySide&&s instanceof Ma&&!(e instanceof Ma))n=r;else{n=r;break}}return n}findEditor(e,t){let o=this.indexOf(e,this.editors,t);if(o!==-1)return[this.editors[o],o]}isFirst(e,t=this.editors){return this.matches(t[0],e)}isLast(e,t=this.editors){return this.matches(t[t.length-1],e)}contains(e,t){return this.indexOf(e,this.editors,t)!==-1}matches(e,t,o){if(!e||!t)return!1;if(o?.supportSideBySide&&e instanceof Ma&&!(t instanceof Ma))switch(o.supportSideBySide){case 4:if(this.matches(e.primary,t,o)||this.matches(e.secondary,t,o))return!0;break;case 3:if(this.matches(e.primary,t,o)&&this.matches(e.secondary,t,o))return!0;break}let n=e===t;return o?.strictEquals?n:n||e.matches(t)}get isLocked(){return this.locked}lock(e){this.isLocked!==e&&(this.locked=e,this._onDidModelChange.fire({kind:3}))}clone(){let e=this.instantiationService.createInstance(mA,void 0);e.editors=this.editors.slice(0),e.mru=this.mru.slice(0),e.preview=this.preview,e.selection=this.selection.slice(0),e.sticky=this.sticky;for(let t of e.editors)e.registerEditorListeners(t);return e}serialize(){let e=ne.as(qo.EditorFactory),t=[],o=[],n,r=this.sticky;for(let l=0;l<this.editors.length;l++){let c=this.editors[l],u=!1,p=e.getEditorSerializer(c);if(p){let h=p.canSerialize(c)?p.serialize(c):void 0;typeof h=="string"?(u=!0,o.push({id:c.typeId,value:h}),t.push(c),this.preview===c&&(n=t.length-1)):u=!1}!u&&this.isSticky(l)&&r--}let s=this.mru.map(l=>this.indexOf(l,t)).filter(l=>l>=0);return{id:this.id,locked:this.locked?!0:void 0,editors:o,mru:s,preview:n,sticky:r>=0?r:void 0}}deserialize(e){let t=ne.as(qo.EditorFactory);return typeof e.id=="number"?(this._id=e.id,mA.IDS=Math.max(e.id+1,mA.IDS)):this._id=mA.IDS++,e.locked&&(this.locked=!0),this.editors=di(e.editors.map((o,n)=>{let r,s=t.getEditorSerializer(o.id);if(s){let l=s.deserialize(this.instantiationService,o.value);l instanceof ls&&(r=l,this.registerEditorListeners(r))}return!r&&typeof e.sticky=="number"&&n<=e.sticky&&e.sticky--,r})),this.mru=di(e.mru.map(o=>this.editors[o])),this.selection=this.mru.length>0?[this.mru[0]]:[],typeof e.preview=="number"&&(this.preview=this.editors[e.preview]),typeof e.sticky=="number"&&(this.sticky=e.sticky),this._id}dispose(){Be(Array.from(this.editorListeners)),this.editorListeners.clear(),this.transient.clear(),super.dispose()}};mA=I([m(1,F),m(2,B)],mA);var wJ=class extends Lw{constructor(i,e,t,o,n){super(t,e,o,n,i)}dispose(){this.textEditorModelHandle&&this.modelService.destroyModel(this.textEditorModelHandle),super.dispose()}};wJ=I([m(1,_t),m(2,Tt),m(3,vS),m(4,Oi)],wJ);var Ck=class extends VX{constructor(e,t,o,n,r,s,l,c,u){super(e,t,r,s,l,c,u);this.editorService=o;this.textFileService=n}save(e,t){return this.resource.scheme!==Q.untitled&&!this.fileService.hasProvider(this.resource)?this.saveAs(e,t):this.doSave(t,!1,e)}saveAs(e,t){return this.doSave(t,!0,e)}async doSave(e,t,o){let n;if(t?n=await this.textFileService.saveAs(this.resource,void 0,{...e,suggestedTarget:this.preferredResource}):n=await this.textFileService.save(this.resource,e),!!n)return{resource:n}}async revert(e,t){await this.textFileService.revert(this.resource,t)}};Ck=I([m(2,ee),m(3,Uo),m(4,rt),m(5,fe),m(6,gr),m(7,Fn),m(8,Rv)],Ck);var $C=class extends Ck{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super(e,void 0,c,l,p,u,h,g,f);this.name=t;this.description=o;this.preferredLanguageId=n;this.preferredContents=r;this.textModelService=s;this.cachedModel=void 0;this.modelReference=void 0}static{this.ID="workbench.editors.resourceEditorInput"}get typeId(){return $C.ID}get editorId(){return la.id}getName(){return this.name||super.getName()}setName(e){this.name!==e&&(this.name=e,this._onDidChangeLabel.fire())}getDescription(){return this.description}setDescription(e){this.description!==e&&(this.description=e,this._onDidChangeLabel.fire())}setLanguageId(e,t){this.setPreferredLanguageId(e),this.cachedModel?.setLanguageId(e,t)}setPreferredLanguageId(e){this.preferredLanguageId=e}setPreferredContents(e){this.preferredContents=e}async resolve(){let e=this.preferredContents,t=this.preferredLanguageId;this.preferredContents=void 0,this.preferredLanguageId=void 0,this.modelReference||(this.modelReference=this.textModelService.createModelReference(this.resource));let o=await this.modelReference,n=o.object;if(!(n instanceof wJ))throw o.dispose(),this.modelReference=void 0,new Error(`Unexpected model for TextResourceEditorInput: ${this.resource}`);return this.cachedModel=n,(typeof e=="string"||typeof t=="string")&&n.updateTextEditorModel(typeof e=="string"?Vj(e):void 0,t),n}matches(e){return this===e?!0:e instanceof $C?Qe(e.resource,this.resource):Sf(e)?super.matches(e):!1}dispose(){this.modelReference&&(this.modelReference.then(e=>e.dispose()),this.modelReference=void 0),this.cachedModel=void 0,super.dispose()}};$C=I([m(5,Bt),m(6,Uo),m(7,ee),m(8,fe),m(9,rt),m(10,gr),m(11,Fn),m(12,Rv)],$C);var ejo=Ae("chat-editor-label-icon",R.chatSparkle,d(8092,null)),Na=class extends ls{constructor(e,t,o,n,r,s){super();this.resource=e;this.options=t;this.chatService=o;this.dialogService=n;this.chatSessionsService=r;this.instantiationService=s;this.didTransferOutEditingSession=!1;this.modelRef=this._register(new me);this.closeHandler=this;if(e.scheme===Q.vscodeChatEditor){let l=bgi.parse(e);if(!l||typeof l!="number")throw new Error("Invalid chat URI")}else if(e.scheme===Q.vscodeLocalChatSession){if(!Jr.parseLocalSessionId(e))throw new Error("Invalid local chat session URI");this._sessionResource=e}else this._sessionResource=e}static{this.TypeID="workbench.input.chatSession"}static{this.EditorID="workbench.editor.chatSession"}get sessionResource(){return this._sessionResource}get model(){return this.modelRef.value?.object}static getNewEditorUri(){return bgi.getNewEditorUri()}showConfirm(){return!!(this.model&&oio(this.model))}transferOutEditingSession(){return this.didTransferOutEditingSession=!0,this.model?.editingSession}async confirm(e){if(!this.model?.editingSession||this.didTransferOutEditingSession||this.getSessionType()!==sc)return 0;let t=d(8091,null),o=d(8088,null);return await K9e(this.model,this.dialogService,{titleOverride:t,messageOverride:o})?0:2}get editorId(){return Na.EditorID}get capabilities(){return super.capabilities|1024|128}copy(){return this.instantiationService.createInstance(Na,Na.getNewEditorUri(),{})}matches(e){return e instanceof Na?Qe(this.sessionResource,e.sessionResource):!1}get typeId(){return Na.TypeID}getName(){if(this.model?.title)return this.model.hasCustomTitle?this.model.title:JN(this.model.title,Leo);if(this._sessionResource){let e=this.chatService.getSession(this._sessionResource);if(e?.title)return e.title;let t=this.chatService.getSessionTitle(this._sessionResource);if(t&&t.trim())return t}return this.options.title?.preferred?this.options.title.preferred:this.options.title?.fallback??d(8093,null)}getTitle(e){let t=this.getName();if(e===2){let o=this.getSessionTypeDisplayName();if(o)return`${t} | ${o}`}return t}getSessionTypeDisplayName(){let e=this.getSessionType();return e===sc?void 0:this.chatSessionsService.getAllChatSessionContributions().find(n=>n.type===e)?.displayName}getIcon(){let e=this.resolveIcon();return e?(this.cachedIcon=e,e):ejo}resolveIcon(){let e=this.getSessionType();if(e!==sc)return this.chatSessionsService.getChatSessionContribution(e)?.icon}getSessionType(){return gl(this.resource)}async resolve(){let o=new URLSearchParams(this.resource.query).get("chatSessionType")??this.resource.authority;if(this._sessionResource?(this.modelRef.value=await this.chatService.acquireOrLoadSession(this._sessionResource,"panel",Se.None),!this.model&&Jr.parseLocalSessionId(this._sessionResource)&&(this.modelRef.value=this.chatService.startNewLocalSession("panel",{canUseTools:!0}))):this.options.target?this.options.target.data&&(this.modelRef.value=this.chatService.loadSessionFromData(this.options.target.data)):this.modelRef.value=this.chatService.startNewLocalSession("panel",{canUseTools:!o}),!this.model||this.isDisposed())return null;this._sessionResource=this.model.sessionResource,this._register(this.model.onDidChange(r=>{this.cachedIcon=void 0,this._onDidChangeLabel.fire()}));let n=this.resolveIcon();return n&&(!this.cachedIcon||!this.iconsEqual(this.cachedIcon,n))&&(this.cachedIcon=n),this._onDidChangeLabel.fire(),this._register(new vgi(this.model))}iconsEqual(e,t){return q.isThemeIcon(e)&&q.isThemeIcon(t)?e.id===t.id:e instanceof A&&t instanceof A?e.toString()===t.toString():!1}};Na=I([m(2,mi),m(3,at),m(4,Us),m(5,F)],Na);var vgi=class extends x{constructor(e){super();this.model=e;this._isResolved=!1}async resolve(){this._isResolved=!0}isResolved(){return this._isResolved}isDisposed(){return this._store.isDisposed}},bgi;(t=>{let a=Q.vscodeChatEditor;function i(){let o=Math.floor(Math.random()*1e9);return A.from({scheme:a,path:`chat-${o}`})}t.getNewEditorUri=i;function e(o){if(o.scheme!==a)return;let r=o.path.match(/chat-(\d+)/)?.[1];if(typeof r!="string")return;let s=parseInt(r);if(!isNaN(s))return s}t.parse=e})(bgi||={});var NRt=class{canSerialize(i){return i instanceof Na&&!!i.sessionResource}serialize(i){if(!this.canSerialize(i))return;let e={options:i.options,sessionResource:i.sessionResource,resource:i.resource};return JSON.stringify(e)}deserialize(i,e){try{let t=$n(JSON.parse(e));if(t.sessionResource){let n=A.revive(t.sessionResource);return i.createInstance(Na,n,t.options)}let o=A.revive(t.resource);return o.scheme===Q.vscodeChatEditor&&t.sessionId&&(o=Jr.forSession(t.sessionId)),i.createInstance(Na,o,t.options)}catch{return}}};async function K9e(a,i,e){let t=oio(a,e);if(!t)return!0;let o=d(8089,null),n=d(8090,null),r=e?.messageOverride??o,s=e?.titleOverride??n,{result:l}=await i.prompt({title:s,message:r+" "+d(8087,null,t),type:"info",cancelButton:!0,buttons:[{label:d(8085,null),run:async()=>(await a.editingSession.accept(),!0)},{label:d(8086,null),run:async()=>(await a.editingSession.reject(),!0)}]});return!!l}function oio(a,i){return!a.editingSession||a.willKeepAlive&&!i?.isArchiveAction?0:a.editingSession.entries.get().filter(o=>o.state.get()===0).length}var FRt=Object.freeze({id:"application",order:100,title:d(4830,null),type:"object"}),Ud=Object.freeze({id:"workbench",order:7,title:d(4838,null),type:"object"}),G9e=Object.freeze({id:"security",scope:1,title:d(4836,null),type:"object",order:7}),WRt=Object.freeze({id:"problems",title:d(4832,null),type:"object",order:101}),Igi=Object.freeze({id:"window",order:8,title:d(4837,null),type:"object"}),Ep={ConfigurationMigration:"base.contributions.configuration.migration"},Sgi=class{constructor(){this.migrations=[];this._onDidRegisterConfigurationMigrations=new E;this.onDidRegisterConfigurationMigration=this._onDidRegisterConfigurationMigrations.event}registerConfigurationMigrations(i){this.migrations.push(...i)}},ORt=new Sgi;ne.add(Ep.ConfigurationMigration,ORt);var fue=class extends x{constructor(e,t){super();this.configurationService=e;this.workspaceService=t;this._register(this.workspaceService.onDidChangeWorkspaceFolders(async o=>{for(let n of o.added)await this.migrateConfigurationsForFolder(n,ORt.migrations)})),this.migrateConfigurations(ORt.migrations),this._register(ORt.onDidRegisterConfigurationMigration(o=>this.migrateConfigurations(o)))}static{this.ID="workbench.contrib.configurationMigration"}async migrateConfigurations(e){await this.migrateConfigurationsForFolder(void 0,e);for(let t of this.workspaceService.getWorkspace().folders)await this.migrateConfigurationsForFolder(t,e)}async migrateConfigurationsForFolder(e,t){await Promise.all([t.map(o=>this.migrateConfigurationsForFolderAndOverride(o,e?.uri))])}async migrateConfigurationsForFolderAndOverride(e,t){let o=this.configurationService.inspect(e.key,{resource:t}),n=this.workspaceService.getWorkbenchState()===3?[["user",2],["userLocal",3],["userRemote",4],["workspace",5],["workspaceFolder",6]]:[["user",2],["userLocal",3],["userRemote",4],["workspace",5]];for(let[r,s]of n){let l=o[r];if(!l)continue;let c=[];if(l.value!==void 0){let u=await this.runMigration(e,r,l.value,t,void 0);for(let p of u??[])c.push([p,[]])}for(let{identifiers:u,value:p}of l.overrides??[])if(p!==void 0){let h=await this.runMigration(e,r,p,t,u);for(let g of h??[])c.push([g,u])}c.length&&await Promise.allSettled(c.map(async([[u,p],h])=>this.configurationService.updateValue(u,p.value,{resource:t,overrideIdentifiers:h},s)))}}async runMigration(e,t,o,n,r){let s=c=>{let p=this.configurationService.inspect(c,{resource:n})[t];if(p)return r?p.overrides?.find(({identifiers:h})=>eo(h,r))?.value:p.value},l=await e.migrateFn(o,s);return Array.isArray(l)?l:[[e.key,l]]}};fue=I([m(0,B),m(1,Pe)],fue);var x4=class extends x{constructor(e){super();this.remoteAgentService=e;this._ready=new Ko;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(!ei&&(await this.remoteAgentService.getEnvironment())?.os!==1)return;ne.as(Jt.Configuration).registerConfiguration({...G9e,properties:{"security.allowedUNCHosts":{type:"array",items:{type:"string",pattern:"^[^\\\\]+$",patternErrorMessage:d(4834,null)},default:[],markdownDescription:d(4833,null),scope:3},"security.restrictUNCAccess":{type:"boolean",default:!0,markdownDescription:d(4835,null),scope:3}}})}};x4=I([m(0,bo)],x4);var hA="window.newWindowProfile",vue=class extends x{constructor(e,t){super();this.userDataProfilesService=e;this.configurationService=t;this.registerNewWindowProfileConfiguration(),this._register(this.userDataProfilesService.onDidChangeProfiles(o=>this.registerNewWindowProfileConfiguration())),this.setNewWindowProfile(),this.checkAndResetNewWindowProfileConfig(),this._register(t.onDidChangeConfiguration(o=>{o.source!==7&&o.affectsConfiguration(hA)&&this.setNewWindowProfile()})),this._register(this.userDataProfilesService.onDidChangeProfiles(()=>this.checkAndResetNewWindowProfileConfig()))}static{this.ID="workbench.contrib.dynamicWindowConfiguration"}registerNewWindowProfileConfiguration(){let e=ne.as(Jt.Configuration),t={...Igi,properties:{[hA]:{type:["string","null"],default:null,enum:[...this.userDataProfilesService.profiles.map(o=>o.name),null],enumItemLabels:[...this.userDataProfilesService.profiles.map(()=>""),d(4829,null)],description:d(4831,null),scope:1}}};this.configurationNode?e.updateConfigurations({add:[t],remove:[this.configurationNode]}):e.registerConfiguration(t),this.configurationNode=t}setNewWindowProfile(){let e=this.configurationService.getValue(hA);this.newWindowProfile=e?this.userDataProfilesService.profiles.find(t=>t.name===e):void 0}checkAndResetNewWindowProfileConfig(){let e=this.configurationService.getValue(hA);if(!e)return;let t=this.newWindowProfile?this.userDataProfilesService.profiles.find(o=>o.id===this.newWindowProfile.id):void 0;e!==t?.name&&this.configurationService.updateValue(hA,t?.name)}};vue=I([m(0,an),m(1,B)],vue);var Ka=le("editorResolverService"),ygi="workbench.editorAssociations",tjo=ne.as(Jt.Configuration),ijo={...Ud,properties:{"workbench.editorAssociations":{type:"object",markdownDescription:d(17546,null),additionalProperties:{type:"string"}}}};tjo.registerConfiguration(ijo);function jR(a){switch(a){case"exclusive":return 5;case"default":return 4;case"builtin":return 3;default:return 1}}function CJ(a,i){if(new Set([Q.extension,Q.webviewPanel,Q.vscodeWorkspaceTrust,Q.vscodeSettings]).has(i.scheme))return!1;let o=typeof a=="string"&&a.indexOf(Oo.sep)>=0?`${i.scheme}:${i.path}`:He(i);return Ed(a,o,{ignoreCase:!0})}var xJ=le("customEditorService"),nio=new Y("activeCustomEditorId","",{type:"string",description:d(9202,null)}),rio=new Y("focusedCustomEditorIsEditable",!1);var q9e=class{constructor(i){this.id=i.id,this.displayName=i.displayName,this.providerDisplayName=i.providerDisplayName,this.priority=i.priority,this.selector=i.selector}matches(i){return this.selector.some(e=>e.filenamePattern&&CJ(e.filenamePattern,i))}},ATe=class{constructor(i){this.allEditors=zo(i,e=>e.id)}get length(){return this.allEditors.length}get defaultEditor(){return this.allEditors.find(i=>{switch(i.priority){case"default":case"builtin":return this.allEditors.every(e=>e===i||ojo(e,i));default:return!1}})}get bestAvailableEditor(){return Array.from(this.allEditors).sort((e,t)=>jR(e.priority)-jR(t.priority))[0]}};function ojo(a,i){return jR(a.priority)<jR(i.priority)}var kJ=class extends x{constructor(i,e){super();let t=()=>{e()?.windowDidDragStart()},o=()=>{e()?.windowDidDragEnd()};this._register(j(i,re.DRAG_START,()=>{t()})),this._register(j(i,re.DRAG_END,o)),this._register(j(i,re.MOUSE_MOVE,n=>{n.buttons===0&&o()})),this._register(j(i,re.DRAG,n=>{n.shiftKey?o():t()})),this._register(j(i,re.DRAG_OVER,n=>{n.shiftKey?o():t()}))}};var Hu=class extends ls{constructor(e,t,o){super();this._themeService=o;this._resourceId=xt();this._hasTransfered=!1;this.viewType=e.viewType,this.providerId=e.providedId,this._webviewTitle=e.name,this._iconPath=e.iconPath,this._webview=t,this._register(o.onDidColorThemeChange(()=>{this._onDidChangeLabel.fire()}))}static{this.typeId="workbench.editors.webviewInput"}get typeId(){return Hu.typeId}get editorId(){return this.viewType}get capabilities(){return 138}get resource(){return A.from({scheme:Q.webviewPanel,path:`webview-panel/webview-${this.providerId}-${this._resourceId}`})}dispose(){this.isDisposed()||this._hasTransfered||this._webview?.dispose(),super.dispose()}getName(){return this._webviewTitle}getTitle(e){return this.getName()}getDescription(){}setWebviewTitle(e){this._webviewTitle=e,this.webview.setTitle(e),this._onDidChangeLabel.fire()}getWebviewTitle(){return this._webviewTitle}get webview(){return this._webview}get extension(){return this.webview.extension}getIcon(){if(this._iconPath)return q.isThemeIcon(this._iconPath)?this._iconPath:Bp(this._themeService.getColorTheme().type)?this._iconPath.dark:this._iconPath.light??this._iconPath.dark}get iconPath(){return this._iconPath}set iconPath(e){this._iconPath=e,this._onDidChangeLabel.fire()}matches(e){return super.matches(e)||e===this}get group(){return this._group}updateGroup(e){this._group=e}transfer(e){if(!this._hasTransfered)return this._hasTransfered=!0,e._webview=this._webview,e}claim(e,t,o){return this._webview.claim(e,t,o)}};Hu=I([m(2,Le)],Hu);var Zt=le("hostService");var yi=Kl;function xh(a){return a===2||a===3}function jC(a){switch(a){case 0:return"left";case 1:return"right";case 2:return"bottom";case 3:return"top";default:return"bottom"}}var njo={[jC(0)]:0,[jC(1)]:1,[jC(2)]:2,[jC(3)]:3};function bue(a){return njo[a]}function wgi(a){switch(a){case 0:return"always";case 1:return"never";case 2:return"preserve";default:return"preserve"}}var rjo={[wgi(0)]:0,[wgi(1)]:1,[wgi(2)]:2};function aio(a){return rjo[a]}function lio(a){return a==="workbench.parts.editor"||a==="workbench.parts.statusbar"||a==="workbench.parts.titlebar"}function MB(a,i,e){if(!jO(a))return!1;let t=hC(i),o=LC(a);if(!Wt){let r=a.getValue("window.customTitleBarVisibility");if(r==="never"&&o||r==="windowed"&&t)return!1}if(!sjo(a))return!0;if(o&&$O(a))return!1;if(Ze&&Vr)return!t;if(Vr&&!t||zse()&&!t)return!0;switch(zy(i)?"hidden":uR(a)){case"classic":return!t||!!e;case"compact":case"hidden":return!1;case"toggle":return!!e;case"visible":return!0;default:return Wt?!1:!t||!!e}}function sjo(a){if(a.getValue("window.commandCenter"))return!1;let i=a.getValue("workbench.activityBar.location");if(i==="top"||i==="bottom")return!1;let e=a.getValue("workbench.editor.editorActionsLocation"),t=a.getValue("workbench.editor.showTabs");return!(e==="titleBar"||e==="default"&&t==="none"||a.getValue("workbench.layoutControl.enabled"))}var cio=new Y("activeWebviewPanelId","",{type:"string",description:d(16627,null)}),QR=class extends Ts{constructor(e,t,o,n,r,s,l,c,u){super(QR.ID,e,t,o,n);this._editorGroupsService=r;this._editorService=s;this._workbenchLayoutService=l;this._hostService=c;this._contextKeyService=u;this._visible=!1;this._isDisposed=!1;this._webviewVisibleDisposables=this._register(new N);this._onFocusWindowHandler=this._register(new me);this._onDidFocusWebview=this._register(new E);this._scopedContextKeyService=this._register(new me);let p=r.getPart(e);this._register(U.any(p.onDidScroll,p.onDidAddGroup,p.onDidRemoveGroup,p.onDidMoveGroup)(()=>{this.webview&&this._visible&&this.synchronizeWebviewContainerDimensions(this.webview)}))}static{this.ID="WebviewEditor"}get onDidFocus(){return this._onDidFocusWebview.event}get webview(){return this.input instanceof Hu?this.input.webview:void 0}get scopedContextKeyService(){return this._scopedContextKeyService.value}createEditor(e){let t=document.createElement("div");this._element=t,this._element.id=`webview-editor-element-${xt()}`,e.appendChild(t),this._scopedContextKeyService.value=this._register(this._contextKeyService.createScoped(t))}dispose(){this._isDisposed=!0,this._element?.remove(),this._element=void 0,super.dispose()}layout(e){this._dimension=e,this.webview&&this._visible&&this.synchronizeWebviewContainerDimensions(this.webview,e)}focus(){super.focus(),!this._onFocusWindowHandler.value&&!Wt&&(this._onFocusWindowHandler.value=this._hostService.onDidChangeFocus(e=>{e&&this._editorService.activeEditorPane===this&&this._workbenchLayoutService.hasFocus("workbench.parts.editor")&&this.focus()})),this.webview?.focus()}setEditorVisible(e){this._visible=e,this.input instanceof Hu&&this.webview&&(e?this.claimWebview(this.input):this.webview.release(this)),super.setEditorVisible(e)}clearInput(){this.webview&&(this.webview.release(this),this._webviewVisibleDisposables.clear()),super.clearInput()}async setInput(e,t,o,n){if(this.input&&e.matches(this.input))return;let r=e instanceof Hu&&e.webview===this.webview;this.webview&&!r&&this.webview.release(this),await super.setInput(e,t,o,n),await e.resolve(),!(n.isCancellationRequested||this._isDisposed)&&e instanceof Hu&&(e.updateGroup(this.group.id),r||this.claimWebview(e),this._dimension&&this.layout(this._dimension))}claimWebview(e){e.claim(this,this.window,this.scopedContextKeyService),this._element&&(this._element.setAttribute("aria-flowto",e.webview.container.id),dO(e.webview.container,this._element)),this._webviewVisibleDisposables.clear(),this._webviewVisibleDisposables.add(this._editorGroupsService.createEditorDropTarget(e.webview.container,{containsGroup:t=>this.group.id===t.id})),this._webviewVisibleDisposables.add(new kJ(this.window,()=>this.webview)),this.synchronizeWebviewContainerDimensions(e.webview),this._webviewVisibleDisposables.add(this.trackFocus(e.webview))}synchronizeWebviewContainerDimensions(e,t){if(!this._element?.isConnected)return;let o=this._editorGroupsService.activeModalEditorPart?.modalElement,n;Do(o)?n=o:n=this._workbenchLayoutService.getContainer(this.window,"workbench.parts.editor"),e.layoutWebviewOverElement(this._element.parentElement,t,n)}trackFocus(e){let t=new N,o=qn(e.container);return t.add(o),t.add(o.onDidFocus(()=>this._onDidFocusWebview.fire())),t.add(e.onDidFocus(()=>this._onDidFocusWebview.fire())),t}};QR=I([m(1,Te),m(2,Le),m(3,ce),m(4,wt),m(5,ee),m(6,yi),m(7,Zt),m(8,X)],QR);var hD=le("webviewEditorService");function BRt(a,i){return a.canResolve(i)}var k4=class extends Hu{constructor(e,t,o,n){super(e,t,o);this._webviewWorkbenchService=n;this._resolved=!1}dispose(){super.dispose(),this._resolvePromise?.cancel(),this._resolvePromise=void 0}async resolve(){if(!this._resolved){this._resolved=!0,this._resolvePromise=Ln(e=>this._webviewWorkbenchService.resolveWebview(this,e));try{await this._resolvePromise}catch(e){if(!ao(e))throw e}}return super.resolve()}transfer(e){if(super.transfer(e))return e._resolved=this._resolved,e}};I([hi],k4.prototype,"resolve",1),k4=I([m(2,Le),m(3,hD)],k4);var Cgi=class{constructor(){this._awaitingRevival=[]}enqueueForRestoration(i,e){let t=new Ko,o=()=>{let r=this._awaitingRevival.findIndex(s=>i===s.input);r>=0&&this._awaitingRevival.splice(r,1)},n=wn(i.webview.onDidDispose(o),e.onCancellationRequested(()=>{o(),t.cancel()}));return this._awaitingRevival.push({input:i,promise:t,disposable:n}),t.p}reviveFor(i,e){let t=this._awaitingRevival.filter(({input:o})=>BRt(i,o));this._awaitingRevival=this._awaitingRevival.filter(({input:o})=>!BRt(i,o));for(let{input:o,promise:n,disposable:r}of t)i.resolveWebview(o,e).then(s=>n.complete(s),s=>n.error(s)).finally(()=>{r.dispose()})}},NTe=class extends x{constructor(e,t,o,n){super();this._editorService=t;this._instantiationService=o;this._webviewService=n;this._revivers=new Set;this._revivalPool=new Cgi;this._onDidChangeActiveWebviewEditor=this._register(new E);this.onDidChangeActiveWebviewEditor=this._onDidChangeActiveWebviewEditor.event;this._register(e.registerContextKeyProvider({contextKey:cio,getGroupContextKeyValue:r=>this.getWebviewId(r.activeEditor)})),this._register(t.onDidActiveEditorChange(()=>{this.updateActiveWebview()})),this._register(n.onDidChangeActiveWebview(()=>{this.updateActiveWebview()})),this.updateActiveWebview()}getWebviewId(e){let t;return e instanceof Hu?t=e:e instanceof Pa&&(e.primary instanceof Hu?t=e.primary:e.secondary instanceof Hu&&(t=e.secondary)),t?.webview.providedViewType??""}updateActiveWebview(){let e=this._editorService.activeEditor,t;e instanceof Hu?t=e:e instanceof Pa&&(e.primary instanceof Hu&&e.primary.webview===this._webviewService.activeWebview?t=e.primary:e.secondary instanceof Hu&&e.secondary.webview===this._webviewService.activeWebview&&(t=e.secondary)),t!==this._activeWebview&&(this._activeWebview=t,this._onDidChangeActiveWebviewEditor.fire(t))}openWebview(e,t,o,n,r){let s=this._webviewService.createWebviewOverlay(e),l=this._instantiationService.createInstance(Hu,{viewType:t,name:o,providedId:e.providedViewType,iconPath:n},s);return this._editorService.openEditor(l,{pinned:!0,preserveFocus:r.preserveFocus,activation:r.preserveFocus?2:void 0},r.group),l}revealWebview(e,t,o){let n=this.findTopLevelEditorForWebview(e);this._editorService.openEditor(n,{preserveFocus:o,activation:o?2:void 0},t)}findTopLevelEditorForWebview(e){for(let t of this._editorService.editors)if(t===e||t instanceof Pa&&(e===t.primary||e===t.secondary))return t;return e}openRevivedWebview(e){let t=this._webviewService.createWebviewOverlay(e.webviewInitInfo);t.state=e.state;let o=this._instantiationService.createInstance(k4,{viewType:e.viewType,providedId:e.webviewInitInfo.providedViewType,name:e.title,iconPath:e.iconPath},t);return o.iconPath=e.iconPath,typeof e.group=="number"&&o.updateGroup(e.group),o}registerResolver(e){this._revivers.add(e);let t=new Ye;return this._revivalPool.reviveFor(e,t.token),Z(()=>{this._revivers.delete(e),t.dispose(!0)})}shouldPersist(e){return e instanceof k4?!0:vt.some(this._revivers.values(),t=>BRt(t,e))}async tryRevive(e,t){for(let o of this._revivers.values())if(BRt(o,e))return await o.resolveWebview(e,t),!0;return!1}async resolveWebview(e,t){if(!await this.tryRevive(e,t)&&!t.isCancellationRequested)return this._revivalPool.enqueueForRestoration(e,t)}};NTe=I([m(0,wt),m(1,ee),m(2,F),m(3,cp)],NTe);var hm=le("workingCopyBackupService");var gA="";var QK=!1,kgi=class{constructor(i,e,t){this.id=i;this.dependencies=e;this.callback=t}};var Egi=class a{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 a}_initialize(){if(this._state===1){if(globalThis.define){this._state=3;return}}else return;this._state=2,globalThis.define=(i,e,t)=>{typeof i!="string"&&(t=e,e=i,i=null),(typeof e!="object"||!Array.isArray(e))&&(t=e,e=null),this._defineCalls.push(new kgi(i,e,t))},globalThis.define.amd=!0,this._isRenderer?this._amdPolicy=globalThis._VSCODE_WEB_PACKAGE_TTP??window.trustedTypes?.createPolicy("amdLoader",{createScriptURL(i){if(i.startsWith(window.location.origin)||i.startsWith(`${Q.vscodeFileResource}://${YXt}`))return i;throw new Error(`[trusted_script_src] Invalid script url: ${i}`)}}):this._isWebWorker&&(this._amdPolicy=globalThis._VSCODE_WEB_PACKAGE_TTP??globalThis.trustedTypes?.createPolicy("amdLoader",{createScriptURL(i){return i}}))}async load(i){if(this._initialize(),this._state===3)return new Promise(r=>{let s=xt();globalThis.define(s,[i],function(l){r(l)})});let e=await(this._isWebWorker?this._workerLoadScript(i):this._isRenderer?this._rendererLoadScript(i):this._nodeJSLoadScript(i));if(!e){console.warn(`Did not receive a define call from script ${i}`);return}let t={},o=[],n=[];if(Array.isArray(e.dependencies))for(let r of e.dependencies)r==="exports"?o.push(t):n.push(r);if(n.length>0)throw new Error(`Cannot resolve dependencies for script ${i}. The dependencies are: ${n.join(", ")}`);return typeof e.callback=="function"?e.callback(...o)??t:e.callback}_rendererLoadScript(i){return new Promise((e,t)=>{let o=document.createElement("script");o.setAttribute("async","async"),o.setAttribute("type","text/javascript");let n=()=>{o.removeEventListener("load",r),o.removeEventListener("error",s)},r=l=>{n(),e(this._defineCalls.pop())},s=l=>{n(),t(l)};o.addEventListener("load",r),o.addEventListener("error",s),this._amdPolicy&&(i=this._amdPolicy.createScriptURL(i)),o.setAttribute("src",i),window.document.getElementsByTagName("head")[0].appendChild(o)})}async _workerLoadScript(i){return this._amdPolicy&&(i=this._amdPolicy.createScriptURL(i)),await import(i),this._defineCalls.pop()}async _nodeJSLoadScript(i){try{let e=(await import("fs")).default,t=(await import("vm")).default,o=(await import("module")).default,n=A.parse(i).fsPath,r=e.readFileSync(n).toString(),s=o.wrap(r.replace(/^#!.*/,""));return new t.Script(s).runInThisContext().apply(),this._defineCalls.pop()}catch(e){throw e}}},xgi=new Map;async function Pg(a,i,e){e===void 0&&(e=!!(globalThis._VSCODE_PRODUCT_JSON??globalThis.vscode?.context?.configuration()?.product)?.commit);let t=i?`${a}/${i}`:a;if(xgi.has(t))return xgi.get(t);let o;if(/^\w[\w\d+.-]*:\/\//.test(t))o=t;else{let l=`${QK&&e&&!Wt?H9:tO}/${t}`;o=vn.asBrowserUri(l).toString(!0)}let n=Egi.INSTANCE.load(o);return xgi.set(t,n),n}function HRt(a,i){let t=!!(globalThis._VSCODE_PRODUCT_JSON??globalThis.vscode?.context?.configuration()?.product)?.commit,o=QK&&t&&!Wt,n=`${a}/${i}`,s=`${o?H9:tO}/${n}`;return vn.asBrowserUri(s).toString(!0)}var kb="utf8",PB="utf8bom",E4="utf16be",T4="utf16le";var URt=[254,255],Tgi=[255,254],$9e=[239,187,191],ajo=512,ljo=512,cjo=512*8,djo=512*128;var _gi=class extends Error{constructor(e,t){super(e);this.decodeStreamErrorKind=t}},Dgi=class a{constructor(i){this.iconvLiteDecoder=i}static async create(i){let e;if(i!==kb)e=(await Pg("@vscode/iconv-lite-umd","lib/iconv-lite-umd.js")).getDecoder(Lgi(i));else{let t=new TextDecoder;e={write(o){return t.decode(o,{stream:!0})},end(){return t.decode()}}}return new a(e)}write(i){return this.iconvLiteDecoder.write(i)}end(){return this.iconvLiteDecoder.end()}};function dio(a,i){let e=i.minBytesRequiredForDetection??(i.guessEncoding?cjo:ljo);return new Promise((t,o)=>{let n=VI(p=>p.join("")),r=[],s=0,l,c=new Ye,u=async()=>{try{let p=await OTe({buffer:qe.concat(r),bytesRead:s},i.guessEncoding,i.candidateGuessEncodings);if(p.seemsBinary&&i.acceptTextOnly)throw new _gi("Stream is binary but only text is accepted for decoding",1);p.encoding=await i.overwriteEncoding(p.encoding),l=await Dgi.create(p.encoding);let h=l.write(qe.concat(r).buffer);n.write(h),r.length=0,s=0,t({stream:n,detected:p})}catch(p){c.cancel(),n.destroy(),o(p)}};fV(a,{onData:async p=>{l?n.write(l.write(p.buffer)):(r.push(p),s+=p.byteLength,s>=e&&(a.pause(),await u(),setTimeout(()=>a.resume())))},onError:p=>n.error(p),onEnd:async()=>{l||await u(),n.end(l?.end())}},c.token)})}async function uio(a,i,e){let o=(await Pg("@vscode/iconv-lite-umd","lib/iconv-lite-umd.js")).getEncoder(Lgi(i),e),n=!1,r=!1;return{read(){if(r)return null;let s=a.read();if(typeof s!="string"){if(r=!0,!n&&e?.addBOM)switch(i){case kb:case PB:return qe.wrap(Uint8Array.from($9e));case E4:return qe.wrap(Uint8Array.from(URt));case T4:return qe.wrap(Uint8Array.from(Tgi))}let l=o.end();return l&&l.length>0?(n=!0,qe.wrap(l)):null}return n=!0,qe.wrap(o.write(s))}}}async function pio(a){return(await Pg("@vscode/iconv-lite-umd","lib/iconv-lite-umd.js")).encodingExists(Lgi(a))}function Lgi(a){return a===PB||a===null?kb:a}function ujo(a,i){if(!a||i<URt.length)return null;let e=a.readUInt8(0),t=a.readUInt8(1);if(e===URt[0]&&t===URt[1])return E4;if(e===Tgi[0]&&t===Tgi[1])return T4;if(i<$9e.length)return null;let o=a.readUInt8(2);return e===$9e[0]&&t===$9e[1]&&o===$9e[2]?PB:null}var pjo=["ascii","utf-16","utf-32"];async function mjo(a,i){let e=await Pg("jschardet","dist/jschardet.min.js"),t=a.slice(0,djo),o=vjo(t.buffer);i&&(i=di(i.map(s=>fjo(s))),i.length===0&&(i=void 0));let n;try{n=e.detect(o,i?{detectEncodings:i}:void 0)}catch{return null}if(!n?.encoding)return null;let r=n.encoding.toLowerCase();return 0<=pjo.indexOf(r)?null:gjo(n.encoding)}var hjo={ibm866:"cp866",big5:"cp950"};function mio(a){return a.replace(/[^a-zA-Z0-9]/g,"").toLowerCase()}function gjo(a){let i=mio(a);return hjo[i]||i}function fjo(a){let i=mio(a),e=j9e[i];return e?e.guessableName:void 0}function vjo(a){let i="";for(let e=0;e<a.length;e++)i+=String.fromCharCode(a[e]);return i}function OTe({buffer:a,bytesRead:i},e,t){let o=ujo(a,i),n=!1;if(o!==E4&&o!==T4&&a){let r=!0,s=!0,l=!1;for(let c=0;c<i&&c<ajo;c++){let u=c%2===1,p=a.readUInt8(c)===0;if(p&&(l=!0),r&&(u&&!p||!u&&p)&&(r=!1),s&&(u&&p||!u&&!p)&&(s=!1),p&&!r&&!s)break}l&&(r?o=T4:s?o=E4:n=!0)}return e&&!n&&!o&&a?mjo(a.slice(0,i),t).then(r=>({seemsBinary:!1,encoding:r})):{seemsBinary:n,encoding:o}}var Nw={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}},j9e=(()=>{let a={};for(let i in Nw)Nw[i].guessableName&&(a[i]=Nw[i]);return a})();var gD=class extends Lw{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super(l,s,v,b);this.resource=e;this.hasAssociatedFilePath=t;this.initialValue=o;this.preferredLanguageId=n;this.preferredEncoding=r;this.workingCopyBackupService=c;this.textResourceConfigurationService=u;this.workingCopyService=p;this.textFileService=h;this.labelService=g;this.editorService=f;this._onDidChangeContent=this._register(new E);this.onDidChangeContent=this._onDidChangeContent.event;this._onDidChangeName=this._register(new E);this.onDidChangeName=this._onDidChangeName.event;this._onDidChangeDirty=this._register(new E);this.onDidChangeDirty=this._onDidChangeDirty.event;this._onDidChangeEncoding=this._register(new E);this.onDidChangeEncoding=this._onDidChangeEncoding.event;this._onDidSave=this._register(new E);this.onDidSave=this._onDidSave.event;this._onDidRevert=this._register(new E);this.onDidRevert=this._onDidRevert.event;this.typeId=gA;this.capabilities=2;this.configuredLabelFormat="content";this.cachedModelFirstLineWords=void 0;this.ignoreDirtyOnModelContentChange=!1;this.dirty=this.hasAssociatedFilePath||!!this.initialValue,this._register(this.workingCopyService.registerWorkingCopy(this)),n&&this.setLanguageId(n),this.onConfigurationChange(void 0,!1),this.registerListeners()}static{this.FIRST_LINE_NAME_MAX_LENGTH=40}static{this.FIRST_LINE_NAME_CANDIDATE_MAX_LENGTH=this.FIRST_LINE_NAME_MAX_LENGTH*10}static{this.ACTIVE_EDITOR_LANGUAGE_ID="${activeEditorLanguage}"}get name(){return this.configuredLabelFormat==="content"&&!this.hasAssociatedFilePath&&this.cachedModelFirstLineWords?this.cachedModelFirstLineWords:this.labelService.getUriBasenameLabel(this.resource)}registerListeners(){this._register(this.textResourceConfigurationService.onDidChangeConfiguration(e=>this.onConfigurationChange(e,!0)))}onConfigurationChange(e,t){if(!e||e.affectsConfiguration(this.resource,"files.encoding")){let o=this.textResourceConfigurationService.getValue(this.resource,"files.encoding");this.configuredEncoding!==o&&typeof o=="string"&&(this.configuredEncoding=o,t&&!this.preferredEncoding&&this._onDidChangeEncoding.fire())}if(!e||e.affectsConfiguration(this.resource,"workbench.editor.untitled.labelFormat")){let o=this.textResourceConfigurationService.getValue(this.resource,"workbench.editor.untitled.labelFormat");this.configuredLabelFormat!==o&&(o==="content"||o==="name")&&(this.configuredLabelFormat=o,t&&this._onDidChangeName.fire())}}setLanguageId(e,t){let o=e===gD.ACTIVE_EDITOR_LANGUAGE_ID?this.editorService.activeTextEditorLanguageId:e;this.preferredLanguageId=o,o&&super.setLanguageId(o,t)}getLanguageId(){return this.textEditorModel?this.textEditorModel.getLanguageId():this.preferredLanguageId}getEncoding(){return this.preferredEncoding||this.configuredEncoding}async setEncoding(e){let t=this.getEncoding();this.preferredEncoding=e,t!==this.preferredEncoding&&this._onDidChangeEncoding.fire()}isDirty(){return this.dirty}isModified(){return this.isDirty()}setDirty(e){this.dirty!==e&&(this.dirty=e,this._onDidChangeDirty.fire())}async save(e){let t=await this.textFileService.save(this.resource,e);return t&&this._onDidSave.fire({reason:e?.reason,source:e?.source}),!!t}async revert(){this.ignoreDirtyOnModelContentChange=!0;try{this.updateTextEditorModel(Vj(""))}finally{this.ignoreDirtyOnModelContentChange=!1}this.setDirty(!1),this._onDidRevert.fire()}async backup(e){let t;return this.isResolved()?t=await this.textFileService.getEncodedReadable(this.resource,this.createSnapshot()??void 0,{encoding:kb}):typeof this.initialValue=="string"&&(t=SIe(qe.fromString(this.initialValue))),{content:t}}async resolve(){let e=!1,t=!1;if(this.textEditorModel)this.updateTextEditorModel(void 0,this.preferredLanguageId);else{let n,r=await this.workingCopyBackupService.resolve(this);r?(n=r.value,t=!0):n=v_(qe.fromString(this.initialValue||""));let s=await iY(await this.textFileService.getDecodedStream(this.resource,n,{encoding:kb}));this.createTextEditorModel(s,this.resource,this.preferredLanguageId),e=!0}let o=Ci(this.textEditorModel);return this.installModelListeners(o),e&&((t||this.initialValue)&&this.updateNameFromFirstLine(o),this.setDirty(this.hasAssociatedFilePath||!!t||!!this.initialValue),(t||this.initialValue)&&this._onDidChangeContent.fire()),super.resolve()}isResolved(){return!!this.textEditorModelHandle}installModelListeners(e){this._register(e.onDidChangeContent(t=>this.onModelContentChanged(e,t))),this._register(e.onDidChangeLanguage(()=>this.onConfigurationChange(void 0,!0))),super.installModelListeners(e)}onModelContentChanged(e,t){this.ignoreDirtyOnModelContentChange||(!this.hasAssociatedFilePath&&e.getLineCount()===1&&e.getLineLength(1)===0?this.setDirty(!1):this.setDirty(!0)),t.changes.some(o=>(o.range.startLineNumber===1||o.range.endLineNumber===1)&&o.range.startColumn<=gD.FIRST_LINE_NAME_CANDIDATE_MAX_LENGTH)&&this.updateNameFromFirstLine(e),this._onDidChangeContent.fire(),this.autoDetectLanguage()}updateNameFromFirstLine(e){if(this.hasAssociatedFilePath)return;let t,o=e.getValueInRange({startLineNumber:1,endLineNumber:1,startColumn:1,endColumn:gD.FIRST_LINE_NAME_CANDIDATE_MAX_LENGTH+1}).trim().replace(/\s+/g," ").replace(/\u202E/g,"");o=o.substr(0,zht(o,gD.FIRST_LINE_NAME_MAX_LENGTH)[0]),o&&Q$().exec(o)&&(t=o),t!==this.cachedModelFirstLineWords&&(this.cachedModelFirstLineWords=t,this._onDidChangeName.fire())}isReadonly(){return!1}};gD=I([m(5,_t),m(6,Tt),m(7,hm),m(8,Fn),m(9,Xa),m(10,Uo),m(11,rt),m(12,ee),m(13,vS),m(14,Oi)],gD);var fD=le("untitledTextEditorService"),Sue=class extends x{constructor(e,t){super();this.instantiationService=e;this.configurationService=t;this._onDidSave=this._register(new E);this.onDidSave=this._onDidSave.event;this._onDidChangeDirty=this._register(new E);this.onDidChangeDirty=this._onDidChangeDirty.event;this._onDidChangeEncoding=this._register(new E);this.onDidChangeEncoding=this._onDidChangeEncoding.event;this._onDidCreate=this._register(new E);this.onDidCreate=this._onDidCreate.event;this._onWillDispose=this._register(new E);this.onWillDispose=this._onWillDispose.event;this._onDidChangeLabel=this._register(new E);this.onDidChangeLabel=this._onDidChangeLabel.event;this.mapResourceToModel=this._register(new Xb)}static{this.UNTITLED_WITHOUT_ASSOCIATED_RESOURCE_REGEX=/Untitled-\d+/}get(e){return this.mapResourceToModel.get(e)}getValue(e){return this.get(e)?.textEditorModel?.getValue()}async resolve(e){let t=this.doCreateOrGet(e);return await t.resolve(),t}create(e){return this.doCreateOrGet(e)}doCreateOrGet(e=Object.create(null)){let t=this.massageOptions(e);return t.untitledResource&&this.mapResourceToModel.has(t.untitledResource)?this.mapResourceToModel.get(t.untitledResource):this.doCreate(t)}massageOptions(e){let t=Object.create(null);if(e.associatedResource?(t.untitledResource=A.from({scheme:Q.untitled,authority:e.associatedResource.authority,fragment:e.associatedResource.fragment,path:e.associatedResource.path,query:e.associatedResource.query}),t.associatedResource=e.associatedResource):e.untitledResource?.scheme===Q.untitled&&(t.untitledResource=e.untitledResource),e.languageId)t.languageId=e.languageId;else if(!t.associatedResource){let o=this.configurationService.getValue();o.files?.defaultLanguage&&(t.languageId=o.files.defaultLanguage)}return t.encoding=e.encoding,t.initialValue=e.initialValue,t}doCreate(e){let t=e.untitledResource;if(!t){let n=1;do t=A.from({scheme:Q.untitled,path:`Untitled-${n}`}),n++;while(this.mapResourceToModel.has(t))}let o=this.instantiationService.createInstance(gD,t,!!e.associatedResource,e.initialValue,e.languageId,e.encoding);return this.registerModel(o),o}registerModel(e){let t=new N;t.add(e.onDidChangeDirty(()=>this._onDidChangeDirty.fire(e))),t.add(e.onDidChangeName(()=>this._onDidChangeLabel.fire(e))),t.add(e.onDidChangeEncoding(()=>this._onDidChangeEncoding.fire(e))),t.add(e.onWillDispose(()=>this._onWillDispose.fire(e))),U.once(e.onWillDispose)(()=>{this.mapResourceToModel.deleteAndLeak(e.resource),t.dispose()}),this.mapResourceToModel.set(e.resource,e),this._onDidCreate.fire(e),e.isDirty()&&this._onDidChangeDirty.fire(e)}isUntitledWithAssociatedResource(e){return e.scheme===Q.untitled&&e.path.length>1&&!Sue.UNTITLED_WITHOUT_ASSOCIATED_RESOURCE_REGEX.test(e.path)}canDispose(e){return e.isDisposed()?!0:this.doCanDispose(e)}async doCanDispose(e){return e.isDirty()?(await U.toPromise(e.onDidChangeDirty),this.canDispose(e)):!0}notifyDidSave(e,t){this._onDidSave.fire({source:e,target:t})}};Sue=I([m(0,F),m(1,B)],Sue);Ee(fD,Sue,1);var gm=class extends k4{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super({providedId:e.viewType,viewType:e.viewType,name:"",iconPath:e.iconPath},t,n,r);this.instantiationService=s;this.labelService=l;this.customEditorService=c;this.fileDialogService=u;this.undoRedoService=p;this.fileService=h;this.filesConfigurationService=g;this.editorGroupsService=f;this.layoutService=v;this.customEditorLabelService=b;this._editorName=void 0;this._shortDescription=void 0;this._mediumDescription=void 0;this._longDescription=void 0;this._shortTitle=void 0;this._mediumTitle=void 0;this._longTitle=void 0;this._editorResource=e.resource,this.oldResource=o.oldResource,this._defaultDirtyState=o.startsDirty,this._backupId=o.backupId,this._untitledDocumentData=o.untitledDocumentData,this.registerListeners()}static create(e,t,o,n){return e.invokeFunction(r=>{let l=r.get(fD).get(t.resource),c=l?.textEditorModel?.getValue(),u=c?qe.fromString(c):void 0;l?.revert();let p=r.get(cp).createWebviewOverlay({providedViewType:t.viewType,title:t.webviewTitle,options:{customClasses:n?.customClasses},contentOptions:{},extension:void 0}),h=e.createInstance(gm,t,p,{untitledDocumentData:u,oldResource:n?.oldResource});return typeof o<"u"&&h.updateGroup(o),h})}static{this.typeId="workbench.editors.webviewEditor"}get resource(){return this._editorResource}registerListeners(){this._register(this.labelService.onDidChangeFormatters(e=>this.onLabelEvent(e.scheme))),this._register(this.fileService.onDidChangeFileSystemProviderRegistrations(e=>this.onLabelEvent(e.scheme))),this._register(this.fileService.onDidChangeFileSystemProviderCapabilities(e=>this.onLabelEvent(e.scheme))),this._register(this.customEditorLabelService.onDidChange(()=>this.updateLabel())),this._register(this.filesConfigurationService.onDidChangeReadonly(()=>this._onDidChangeCapabilities.fire()))}onLabelEvent(e){e===this.resource.scheme&&this.updateLabel()}updateLabel(){this._editorName=void 0,this._shortDescription=void 0,this._mediumDescription=void 0,this._longDescription=void 0,this._shortTitle=void 0,this._mediumTitle=void 0,this._longTitle=void 0,this._onDidChangeLabel.fire()}get typeId(){return gm.typeId}get editorId(){return this.viewType}get capabilities(){let e=0;return e|=128,this.customEditorService.getCustomEditorCapabilities(this.viewType)?.supportsMultipleEditorsPerDocument||(e|=8),this._modelRef?this._modelRef.object.isReadonly()&&(e|=2):this.filesConfigurationService.isReadonly(this.resource)&&(e|=2),this.resource.scheme===Q.untitled&&(e|=4),e}getName(){let e=this.getWebviewTitle();return e||(this._editorName??=this.customEditorLabelService.getName(this.resource)??jo(this.labelService.getUriLabel(this.resource)),this._editorName)}getDescription(e=1){switch(e){case 0:return this.shortDescription;case 2:return this.longDescription;case 1:default:return this.mediumDescription}}get shortDescription(){return this._shortDescription??=this.labelService.getUriBasenameLabel(ci(this.resource)),this._shortDescription}get mediumDescription(){return this._mediumDescription??=this.labelService.getUriLabel(ci(this.resource),{relative:!0}),this._mediumDescription}get longDescription(){return this._longDescription??=this.labelService.getUriLabel(ci(this.resource)),this._longDescription}get shortTitle(){return this._shortTitle??=this.getName(),this._shortTitle}get mediumTitle(){return this._mediumTitle??=this.labelService.getUriLabel(this.resource,{relative:!0}),this._mediumTitle}get longTitle(){return this._longTitle??=this.labelService.getUriLabel(this.resource),this._longTitle}getTitle(e){let t=this.getWebviewTitle();if(t)return t;switch(e){case 0:return this.shortTitle;case 2:return this.longTitle;default:case 1:return this.mediumTitle}}matches(e){return super.matches(e)?!0:this===e||e instanceof gm&&this.viewType===e.viewType&&Qe(this.resource,e.resource)}copy(){return gm.create(this.instantiationService,{resource:this.resource,viewType:this.viewType,webviewTitle:this.getWebviewTitle(),iconPath:this.iconPath},this.group,this.webview.options)}isReadonly(){return this._modelRef?this._modelRef.object.isReadonly():this.filesConfigurationService.isReadonly(this.resource)}isDirty(){return this._modelRef?this._modelRef.object.isDirty():!!this._defaultDirtyState}async save(e,t){if(!this._modelRef)return;let o=await this._modelRef.object.saveCustomEditor(t);if(o)return Qe(o,this.resource)?this:{resource:o}}async saveAs(e,t){if(!this._modelRef)return;let o=this._editorResource,n=await this.fileDialogService.pickFileToSave(o,t?.availableFileSystems);if(n&&await this._modelRef.object.saveCustomEditorAs(this._editorResource,n,t))return(await this.rename(e,n))?.editor}async revert(e,t){if(this._modelRef)return this._modelRef.object.revert(t);this._defaultDirtyState=!1,this._onDidChangeDirty.fire()}async resolve(){if(await super.resolve(),this.isDisposed())return null;if(!this._modelRef){let e=this.capabilities;this._modelRef=this._register(Ci(await this.customEditorService.models.tryRetain(this.resource,this.viewType))),this._register(this._modelRef.object.onDidChangeDirty(()=>this._onDidChangeDirty.fire())),this._register(this._modelRef.object.onDidChangeReadonly(()=>this._onDidChangeCapabilities.fire())),this._untitledDocumentData&&(this._defaultDirtyState=!0),this.isDirty()&&this._onDidChangeDirty.fire(),this.capabilities!==e&&this._onDidChangeCapabilities.fire()}return null}async rename(e,t){return{editor:{resource:t}}}undo(){return Ci(this._modelRef),this.undoRedoService.undo(this.resource)}redo(){return Ci(this._modelRef),this.undoRedoService.redo(this.resource)}onMove(e){this._moveHandler=e}transfer(e){if(super.transfer(e))return e._moveHandler=this._moveHandler,this._moveHandler=void 0,e}get backupId(){return this._modelRef?this._modelRef.object.backupId:this._backupId}get untitledDocumentData(){return this._untitledDocumentData}toUntyped(){return{resource:this.resource,options:{override:this.viewType}}}claim(e,t,o){if(this.doCanMove(t.vscodeWindowId)!==!0)throw t4(d(9199,null),[ii({id:"openInOriginalWindow",label:d(9200,null),run:async()=>{let n=this.editorGroupsService.getPart(this.layoutService.getContainer(Re(this.webview.container).window));this.editorGroupsService.getPart(this.layoutService.getContainer(t.window)).activeGroup.moveEditor(this,n.activeGroup)}})],{forceMessage:!0});return super.claim(e,t,o)}canMove(e,t){let o=this.editorGroupsService.getGroup(t);if(o){let n=this.doCanMove(o.windowId);if(typeof n=="string")return n}return super.canMove(e,t)}doCanMove(e){return this.isModified()&&this._modelRef?.object.canHotExit===!1&&Re(this.webview.container).vscodeWindowId!==e?d(9198,null,this.getName()):!0}};gm=I([m(3,Le),m(4,hD),m(5,F),m(6,rt),m(7,xJ),m(8,rn),m(9,Ml),m(10,fe),m(11,gr),m(12,wt),m(13,yi),m(14,Rv)],gm);var FTe=le("IInteractiveDocumentService"),zRt=class extends x{constructor(){super();this._onWillAddInteractiveDocument=this._register(new E);this.onWillAddInteractiveDocument=this._onWillAddInteractiveDocument.event;this._onWillRemoveInteractiveDocument=this._register(new E);this.onWillRemoveInteractiveDocument=this._onWillRemoveInteractiveDocument.event}willCreateInteractiveDocument(e,t,o){this._onWillAddInteractiveDocument.fire({notebookUri:e,inputUri:t,languageId:o})}willRemoveInteractiveDocument(e,t){this._onWillRemoveInteractiveDocument.fire({notebookUri:e,inputUri:t})}};var QF=le("IInteractiveHistoryService"),KRt=class extends x{constructor(){super(),this._history=new gt}matchesCurrent(i,e){let t=this._history.get(i);return t?t.current()===e:!1}addToHistory(i,e){let t=this._history.get(i);if(!t){this._history.set(i,new YV([e],50));return}t.resetCursor(),t.add(e)}getPreviousValue(i){return this._history.get(i)?.previous()??null}getNextValue(i){return this._history.get(i)?.next()??null}replaceLast(i,e){let t=this._history.get(i);if(t)t.replaceLast(e),t.resetCursor();else{this._history.set(i,new YV([e],50));return}}clearHistory(i){this._history.delete(i)}has(i){return!!this._history.has(i)}};var Cf=class extends ls{constructor(e,t,o,n,r,s,l,c,u,p,h){let g=Ra.getOrCreate(r,e,void 0,"interactive",{});super();this._notebookService=u;this._fileDialogService=p;this.isScratchpad=h.getValue(yt.InteractiveWindowPromptToSave)!==!0,this._notebookEditorInput=g,this._register(this._notebookEditorInput),this.name=o??Cf.windowNames[e.path]??jo(e.path,qm(e.path)),this._initLanguage=n,this._resource=e,this._inputResource=t,this._inputResolver=null,this._editorModelReference=null,this._inputModelRef=null,this._textModelService=s,this._interactiveDocumentService=l,this._historyService=c,this._registerListeners()}static create(e,t,o,n,r){return e.createInstance(Cf,t,o,n,r)}static{this.windowNames={}}static setName(e,t){t&&(this.windowNames[e.path]=t)}static{this.ID="workbench.input.interactive"}get editorId(){return"interactive"}get typeId(){return Cf.ID}get language(){return this._inputModelRef?.object.textEditorModel.getLanguageId()??this._initLanguage}get notebookEditorInput(){return this._notebookEditorInput}get editorInputs(){return[this._notebookEditorInput]}get resource(){return this._resource}get inputResource(){return this._inputResource}get primary(){return this._notebookEditorInput}_registerListeners(){let e=U.once(this.primary.onWillDispose);this._register(e(()=>{this.isDisposed()||this.dispose()})),this._register(this.primary.onDidChangeDirty(()=>this._onDidChangeDirty.fire())),this._register(this.primary.onDidChangeLabel(()=>this._onDidChangeLabel.fire())),this._register(this.primary.onDidChangeCapabilities(()=>this._onDidChangeCapabilities.fire()))}get capabilities(){let e=this.isScratchpad?512:0;return 6|e}async _resolveEditorModel(){return this._editorModelReference||(this._editorModelReference=await this._notebookEditorInput.resolve()),this._editorModelReference}async resolve(){return this._editorModelReference?this._editorModelReference:this._inputResolver?this._inputResolver:(this._inputResolver=this._resolveEditorModel(),this._inputResolver)}async resolveInput(e){if(this._inputModelRef)return this._inputModelRef.object.textEditorModel;let t=e??this._initLanguage??$r;return this._interactiveDocumentService.willCreateInteractiveDocument(this.resource,this.inputResource,t),this._inputModelRef=await this._textModelService.createModelReference(this.inputResource),this._inputModelRef.object.textEditorModel}async save(e,t){if(this._editorModelReference)return this.hasCapability(4)?this.saveAs(e,t):(await this._editorModelReference.save(t),this)}async saveAs(e,t){if(!this._editorModelReference||!this._notebookService.getContributedNotebookType("interactive"))return;let n=this.getName()+".ipynb",r=Ge(await this._fileDialogService.defaultFilePath(),n),s=await this._fileDialogService.pickFileToSave(r,t?.availableFileSystems);if(!s)return;let l=await this._editorModelReference.saveAs(s);return l&&"resource"in l&&l.resource&&this._notebookService.getNotebookTextModel(l.resource)?.dispose(),l}matches(e){return super.matches(e)?!0:e instanceof Cf?Qe(this.resource,e.resource)&&Qe(this.inputResource,e.inputResource):!1}getName(){return this.name}isDirty(){return this.isScratchpad?!1:this._editorModelReference?.isDirty()??!1}isModified(){return this._editorModelReference?.isModified()??!1}async revert(e,t){this._editorModelReference&&this._editorModelReference.isDirty()&&await this._editorModelReference.revert(t)}dispose(){this._editorModelReference?.revert({soft:!0}),this._notebookEditorInput?.dispose(),this._editorModelReference?.dispose(),this._editorModelReference=null,this._interactiveDocumentService.willRemoveInteractiveDocument(this.resource,this.inputResource),this._inputModelRef?.dispose(),this._inputModelRef=null,super.dispose()}get historyService(){return this._historyService}};Cf=I([m(4,F),m(5,Bt),m(6,FTe),m(7,QF),m(8,bn),m(9,rn),m(10,B)],Cf);var ug=class a extends uo{static fromLineNumbers(i,e){return a.fromLength(i,e-i)}static fromLength(i,e){return new a(i,i+e)}join(i){return a.fromLineNumbers(Math.min(this.startLineNumber,i.startLineNumber),Math.max(this.endLineNumberExclusive,i.endLineNumberExclusive))}isAfter(i){return this.startLineNumber>=i.endLineNumberExclusive}isBefore(i){return i.startLineNumber>=this.endLineNumberExclusive}delta(i){return a.fromLength(this.startLineNumber+i,this.length)}deltaEnd(i){return a.fromLength(this.startLineNumber,this.length+i)}deltaStart(i){return a.fromLength(this.startLineNumber+i,this.length-i)}getLines(i){let e=new Array(this.length);for(let t=0;t<this.length;t++)e[t]=i.getLineContent(this.startLineNumber+t);return e}toInclusiveRangeOrEmpty(){return this.isEmpty?new z(this.startLineNumber,1,this.startLineNumber,1):new z(this.startLineNumber,1,this.endLineNumberExclusive-1,1073741824)}};var hio={start:"<<<<<<<",end:">>>>>>>"};var YK=class{constructor(i,e){this.range=i;this.newLines=e}equals(i){return this.range.equals(i.range)&&$i(this.newLines,i.newLines)}toEdits(i){return new Rgi([this]).toEdits(i)}},GRt=class{constructor(i,e){this.range=i;this.newText=e}equals(i){return z.equalsRange(this.range,i.range)&&this.newText===i.newText}},Rgi=class{constructor(i){this.edits=i}toEdits(i){return this.edits.map(e=>e.range.endLineNumberExclusive<=i?{range:new z(e.range.startLineNumber,1,e.range.endLineNumberExclusive,1),text:e.newLines.map(t=>t+`
`).join("")}:e.range.startLineNumber===1?{range:new z(1,1,i,Number.MAX_SAFE_INTEGER),text:e.newLines.join(`
`)}:{range:new z(e.range.startLineNumber-1,Number.MAX_SAFE_INTEGER,i,Number.MAX_SAFE_INTEGER),text:e.newLines.map(t=>`
`+t).join("")})}};function gio(a,i){return!(i.lineNumber<a.startLineNumber||i.lineNumber>a.endLineNumber||i.lineNumber===a.startLineNumber&&i.column<a.startColumn||i.lineNumber===a.endLineNumber&&i.column>=a.endColumn)}function Q9e(a){return a.startLineNumber===a.endLineNumber?new pc(0,a.endColumn-a.startColumn):new pc(a.endLineNumber-a.startLineNumber,a.endColumn-1)}function qRt(a,i){return a.lineNumber===i.lineNumber?new pc(0,i.column-a.column):new pc(i.lineNumber-a.lineNumber,i.column-1)}function Y9e(a,i){return i.lineCount===0?new ye(a.lineNumber,a.column+i.columnCount):new ye(a.lineNumber+i.lineCount,i.columnCount+1)}function Mgi(a,i){return a.endLineNumber<i.startLineNumber||a.endLineNumber===i.startLineNumber&&a.endColumn<=i.startColumn}var fA=class a{constructor(i,e){this.inputRange=i;this.outputRange=e}static join(i){return i.reduce((e,t)=>e?e.join(t):t,void 0)}extendInputRange(i){if(!i.containsRange(this.inputRange))throw new li;let e=i.startLineNumber-this.inputRange.startLineNumber,t=i.endLineNumberExclusive-this.inputRange.endLineNumberExclusive;return new a(i,ug.fromLength(this.outputRange.startLineNumber+e,this.outputRange.length-e+t))}join(i){return new a(this.inputRange.join(i.inputRange),this.outputRange.join(i.outputRange))}get resultingDeltaFromOriginalToModified(){return this.outputRange.endLineNumberExclusive-this.inputRange.endLineNumberExclusive}toString(){return`${this.inputRange.toString()} -> ${this.outputRange.toString()}`}addOutputLineDelta(i){return new a(this.inputRange,this.outputRange.delta(i))}addInputLineDelta(i){return new a(this.inputRange.delta(i),this.outputRange)}reverse(){return new a(this.outputRange,this.inputRange)}},YF=class a{constructor(i,e){this.lineRangeMappings=i;this.inputLineCount=e;lh(()=>$y(i,(t,o)=>t.inputRange.isBefore(o.inputRange)&&t.outputRange.isBefore(o.outputRange)&&o.inputRange.startLineNumber-t.inputRange.endLineNumberExclusive===o.outputRange.startLineNumber-t.outputRange.endLineNumberExclusive))}static betweenOutputs(i,e,t){let n=X9e.compute(i,e).map(r=>new fA(r.output1Range,r.output2Range));return new a(n,t)}project(i){let e=fd(this.lineRangeMappings,n=>n.inputRange.startLineNumber<=i);if(!e)return new fA(ug.fromLength(i,1),ug.fromLength(i,1));if(e.inputRange.contains(i))return e;let t=ug.fromLength(i,1),o=ug.fromLength(i+e.outputRange.endLineNumberExclusive-e.inputRange.endLineNumberExclusive,1);return new fA(t,o)}get outputLineCount(){let i=this.lineRangeMappings.at(-1),e=i?i.outputRange.endLineNumberExclusive-i.inputRange.endLineNumberExclusive:0;return this.inputLineCount+e}reverse(){return new a(this.lineRangeMappings.map(i=>i.reverse()),this.outputLineCount)}},X9e=class a{constructor(i,e,t,o,n){this.inputRange=i;this.output1Range=e;this.output1LineMappings=t;this.output2Range=o;this.output2LineMappings=n}static compute(i,e){let t=cl(u=>u.inputRange.startLineNumber,hu),o=lht(i.map(u=>({source:0,diff:u})),e.map(u=>({source:1,diff:u}))).sort(cl(u=>u.diff,t)),n=[new Array,new Array],r=[0,0],s=new Array;function l(u){let p=fA.join(n[0])||new fA(u,u.delta(r[0])),h=fA.join(n[1])||new fA(u,u.delta(r[1]));s.push(new a(c,p.extendInputRange(c).outputRange,n[0],h.extendInputRange(c).outputRange,n[1])),n[0]=[],n[1]=[]}let c;for(let u of o){let p=u.diff.inputRange;c&&!c.intersectsOrTouches(p)&&(l(c),c=void 0),r[u.source]=u.diff.resultingDeltaFromOriginalToModified,c=c?c.join(p):p,n[u.source].push(u.diff)}return c&&l(c),s}toString(){return`${this.output1Range} <- ${this.inputRange} -> ${this.output2Range}`}},_4=class a extends fA{constructor(e,t,o,n,r){super(e,o);this.inputTextModel=t;this.outputTextModel=n;this.rangeMappings=r||[new AB(this.inputRange.toExclusiveRange(),this.outputRange.toExclusiveRange())]}static join(e){return e.reduce((t,o)=>t?t.join(o):o,void 0)}addOutputLineDelta(e){return new a(this.inputRange,this.inputTextModel,this.outputRange.delta(e),this.outputTextModel,this.rangeMappings.map(t=>t.addOutputLineDelta(e)))}addInputLineDelta(e){return new a(this.inputRange.delta(e),this.inputTextModel,this.outputRange,this.outputTextModel,this.rangeMappings.map(t=>t.addInputLineDelta(e)))}join(e){return new a(this.inputRange.join(e.inputRange),this.inputTextModel,this.outputRange.join(e.outputRange),this.outputTextModel)}getLineEdit(){return new YK(this.inputRange,this.getOutputLines())}getReverseLineEdit(){return new YK(this.outputRange,this.getInputLines())}getOutputLines(){return this.outputRange.getLines(this.outputTextModel)}getInputLines(){return this.inputRange.getLines(this.inputTextModel)}},AB=class a{constructor(i,e){this.inputRange=i;this.outputRange=e}toString(){function i(e){return`[${e.startLineNumber}:${e.startColumn}, ${e.endLineNumber}:${e.endColumn})`}return`${i(this.inputRange)} -> ${i(this.outputRange)}`}addOutputLineDelta(i){return new a(this.inputRange,new z(this.outputRange.startLineNumber+i,this.outputRange.startColumn,this.outputRange.endLineNumber+i,this.outputRange.endColumn))}addInputLineDelta(i){return new a(new z(this.inputRange.startLineNumber+i,this.inputRange.startColumn,this.inputRange.endLineNumber+i,this.inputRange.endColumn),this.outputRange)}reverse(){return new a(this.outputRange,this.inputRange)}},Iue=class a{constructor(i,e){this.rangeMappings=i;this.inputLineCount=e;lh(()=>$y(i,(t,o)=>Mgi(t.inputRange,o.inputRange)&&Mgi(t.outputRange,o.outputRange)))}project(i){let e=fd(this.rangeMappings,n=>n.inputRange.getStartPosition().isBeforeOrEqual(i));if(!e)return new AB(z.fromPositions(i,i),z.fromPositions(i,i));if(gio(e.inputRange,i))return e;let t=qRt(e.inputRange.getEndPosition(),i),o=Y9e(e.outputRange.getEndPosition(),t);return new AB(z.fromPositions(i),z.fromPositions(o))}projectRange(i){let e=this.project(i.getStartPosition()),t=this.project(i.getEndPosition());return new AB(e.inputRange.plusRange(t.inputRange),e.outputRange.plusRange(t.outputRange))}get outputLineCount(){let i=this.rangeMappings.at(-1),e=i?i.outputRange.endLineNumber-i.inputRange.endLineNumber:0;return this.inputLineCount+e}reverse(){return new a(this.rangeMappings.map(i=>i.reverse()),this.outputLineCount)}};var yue=class{constructor(i,e){this.editorWorkerService=i;this.configurationService=e;this.mergeAlgorithm=hr("mergeEditor.diffAlgorithm","advanced",this.configurationService).map(t=>t==="smart"?"legacy":t==="experimental"?"advanced":t)}async computeDiff(i,e,t){let o=this.mergeAlgorithm.read(t),n=i.getVersionId(),r=e.getVersionId(),s=await this.editorWorkerService.computeDiff(i.uri,e.uri,{ignoreTrimWhitespace:!1,maxComputationTimeMs:0,computeMoves:!1},o);if(!s)throw new Error("Diff computation failed");if(i.isDisposed()||e.isDisposed())return{diffs:null};let l=s.changes.map(p=>new _4(fio(p.original),i,fio(p.modified),e,p.innerChanges?.map(h=>bjo(h)))),c=i.getVersionId(),u=e.getVersionId();return n!==c||r!==u?{diffs:null}:(lh(()=>l.length===0||l[0].inputRange.startLineNumber===l[0].outputRange.startLineNumber&&$y(l,(p,h)=>h.inputRange.startLineNumber-p.inputRange.endLineNumberExclusive===h.outputRange.startLineNumber-p.outputRange.endLineNumberExclusive&&p.inputRange.endLineNumberExclusive<h.inputRange.startLineNumber&&p.outputRange.endLineNumberExclusive<h.outputRange.startLineNumber)),{diffs:l})}};yue=I([m(0,Qs),m(1,B)],yue);function fio(a){return ug.fromLength(a.startLineNumber,a.length)}function bjo(a){return new AB(a.originalRange,a.modifiedRange)}var EJ=class{constructor(){this._isOccupied=!1}runExclusivelyOrSkip(i){if(!this._isOccupied){this._isOccupied=!0;try{i()}finally{this._isOccupied=!1}}}runExclusivelyOrThrow(i){if(this._isOccupied)throw new li("ReentrancyBarrier: reentrant call detected!");this._isOccupied=!0;try{i()}finally{this._isOccupied=!1}}get isOccupied(){return this._isOccupied}makeExclusiveOrSkip(i){return((...e)=>{if(!this._isOccupied){this._isOccupied=!0;try{return i(...e)}finally{this._isOccupied=!1}}})}};var WTe=class extends x{constructor(e,t,o){super();this.baseTextModel=e;this.textModel=t;this.diffComputer=o;this._recomputeCount=0;this._state=Me(this,1);this._diffs=Me(this,[]);this._barrier=new EJ;this._isDisposed=!1;this._isInitializing=!0;let n=wc("recompute");this._register(be(r=>{n.read(r),this._recompute(r)})),this._register(e.onDidChangeContent(this._barrier.makeExclusiveOrSkip(()=>{n.trigger(void 0)}))),this._register(t.onDidChangeContent(this._barrier.makeExclusiveOrSkip(()=>{n.trigger(void 0)}))),this._register(Z(()=>{this._isDisposed=!0}))}get isApplyingChange(){return this._barrier.isOccupied}get state(){return this._state}get diffs(){return this._diffs}_recompute(e){this._recomputeCount++;let t=this._recomputeCount;this._state.get()===1&&(this._isInitializing=!0),Gi(n=>{this._state.set(this._isInitializing?1:3,n,0)}),this.diffComputer.computeDiff(this.baseTextModel,this.textModel,e).then(n=>{this._isDisposed||t===this._recomputeCount&&Gi(r=>{n.diffs?(this._state.set(2,r,1),this._diffs.set(n.diffs,r,1)):this._state.set(4,r,1),this._isInitializing=!1})})}ensureUpToDate(){if(this.state.get()!==2)throw new li("Cannot remove diffs when the model is not up to date")}removeDiffs(e,t,o){this.ensureUpToDate(),e.sort(cl(u=>u.inputRange.startLineNumber,hu)),e.reverse();let n=this._diffs.get(),r=new Set(e);if(r.size!==e.length)throw new li;let s=new Set(n);for(let u of e)if(!s.has(u))throw new li;for(let u of e)this._barrier.runExclusivelyOrThrow(()=>{let p=u.getReverseLineEdit().toEdits(this.textModel.getLineCount());this.textModel.pushEditOperations(null,p,()=>null,o)});let l=0,c=[];for(let u of n)r.has(u)?l+=u.inputRange.length-u.outputRange.length:c.push(l!==0?u.addOutputLineDelta(l):u);this._diffs.set(c,t,0)}applyEditRelativeToOriginal(e,t,o){this.ensureUpToDate();let n=new _4(e.range,this.baseTextModel,ug.fromLength(e.range.startLineNumber,e.newLines.length),this.textModel),r=!1,s=0,l=new Array;for(let c of this.diffs.get()){if(c.inputRange.intersectsOrTouches(e.range))throw new li("Edit must be conflict free.");c.inputRange.isAfter(e.range)?(r||(r=!0,l.push(n.addOutputLineDelta(s))),l.push(c.addOutputLineDelta(e.newLines.length-e.range.length))):l.push(c),r||(s+=c.outputRange.length-c.inputRange.length)}r||(r=!0,l.push(n.addOutputLineDelta(s))),this._barrier.runExclusivelyOrThrow(()=>{let c=new YK(e.range.delta(s),e.newLines).toEdits(this.textModel.getLineCount());this.textModel.pushEditOperations(null,c,()=>null,o)}),this._diffs.set(l,t,0)}findTouchingDiffs(e){return this.diffs.get().filter(t=>t.inputRange.intersectsOrTouches(e))}getResultLine(e,t){let o=0,n=t?this.diffs.read(t):this.diffs.get();for(let r of n){if(r.inputRange.contains(e)||r.inputRange.endLineNumberExclusive===e)return r;if(r.inputRange.endLineNumberExclusive<e)o=r.resultingDeltaFromOriginalToModified;else break}return e+o}getResultLineRange(e,t){let o=this.getResultLine(e.startLineNumber,t);typeof o!="number"&&(o=o.outputRange.startLineNumber);let n=this.getResultLine(e.endLineNumberExclusive,t);return typeof n!="number"&&(n=n.outputRange.endLineNumberExclusive),ug.fromLineNumbers(o,n)}};function vio(a,i){Object.entries(i).forEach(([e,t])=>{a.style.setProperty(e,Sjo(t))})}function Sjo(a){return typeof a=="number"?`${a}px`:a}function BTe(a,i){let e=new N,t=[];return e.add(NL({debugName:()=>`Apply decorations from ${i.debugName}`},o=>{let n=i.read(o);a.changeDecorations(r=>{t=r.deltaDecorations(t,n)})})),e.add({dispose:()=>{a.changeDecorations(o=>{t=o.deltaDecorations(t,[])})}}),e}function*bio(a,i,e){let t=new uE(i);for(let o of a){t.takeWhile(r=>dC.isGreaterThan(e(o,r)));let n=t.takeWhile(r=>dC.isNeitherLessOrGreaterThan(e(o,r)));yield{left:o,rights:n||[]}}}function*$Rt(a,i,e){let t=new uE(i);for(let o of a){let n=t.takeWhile(s=>dC.isGreaterThan(e(o,s)));n&&(yield{rights:n});let r=t.takeWhile(s=>dC.isNeitherLessOrGreaterThan(e(o,s)));yield{left:o,rights:r||[]}}}function jRt(a,i){return Object.assign(a,i)}function QRt(a,i){let e={};for(let t in a)e[t]=a[t];for(let t in i){let o=i[t];typeof e[t]=="object"&&o&&typeof o=="object"?e[t]=QRt(e[t],o):e[t]=o}return e}var VTe=class{constructor(i,e){this.key=i;this.storageService=e;this.hasValue=!1;this.value=void 0}get(){if(!this.hasValue){let i=this.storageService.get(this.key,0);if(i!==void 0)try{this.value=JSON.parse(i)}catch(e){mt(e)}this.hasValue=!0}return this.value}set(i){this.value=i,this.storageService.store(this.key,JSON.stringify(this.value),0,0)}};VTe=I([m(1,ce)],VTe);var YRt=class a{constructor(i,e,t,o,n,r,s,l){this.baseRange=i;this.baseTextModel=e;this.input1Range=t;this.input1TextModel=o;this.input1Diffs=n;this.input2Range=r;this.input2TextModel=s;this.input2Diffs=l;if(this.input1CombinedDiff=_4.join(this.input1Diffs),this.input2CombinedDiff=_4.join(this.input2Diffs),this.isEqualChange=$i(this.input1Diffs,this.input2Diffs,(c,u)=>c.getLineEdit().equals(u.getLineEdit())),this.smartInput1LineRangeEdit=null,this.smartInput2LineRangeEdit=null,this.dumbInput1LineRangeEdit=null,this.dumbInput2LineRangeEdit=null,this.input1Diffs.length===0&&this.input2Diffs.length===0)throw new li("must have at least one diff")}static fromDiffs(i,e,t,o,n){return X9e.compute(i,e).map(s=>new a(s.inputRange,t,s.output1Range,o,s.output1LineMappings,s.output2Range,n,s.output2LineMappings))}getInputRange(i){return i===1?this.input1Range:this.input2Range}getInputCombinedDiff(i){return i===1?this.input1CombinedDiff:this.input2CombinedDiff}getInputDiffs(i){return i===1?this.input1Diffs:this.input2Diffs}get isConflicting(){return this.input1Diffs.length>0&&this.input2Diffs.length>0}get canBeCombined(){return this.smartCombineInputs(1)!==void 0}get isOrderRelevant(){let i=this.smartCombineInputs(1),e=this.smartCombineInputs(2);return!i||!e?!1:!i.equals(e)}getEditForBase(i){let e=[];if(i.includesInput1&&this.input1CombinedDiff&&e.push({diff:this.input1CombinedDiff,inputNumber:1}),i.includesInput2&&this.input2CombinedDiff&&e.push({diff:this.input2CombinedDiff,inputNumber:2}),e.length===0)return{edit:void 0,effectiveState:wS.base};if(e.length===1)return{edit:e[0].diff.getLineEdit(),effectiveState:wS.base.withInputValue(e[0].inputNumber,!0,!1)};if(i.kind!==3)throw new li;let t=i.smartCombination?this.smartCombineInputs(i.firstInput):this.dumbCombineInputs(i.firstInput);return t?{edit:t,effectiveState:i}:{edit:e[Pgi(i.firstInput)-1].diff.getLineEdit(),effectiveState:wS.base.withInputValue(Pgi(i.firstInput),!0,!1)}}smartCombineInputs(i){if(i===1&&this.smartInput1LineRangeEdit!==null)return this.smartInput1LineRangeEdit;if(i===2&&this.smartInput2LineRangeEdit!==null)return this.smartInput2LineRangeEdit;let t=lht(this.input1Diffs.flatMap(n=>n.rangeMappings.map(r=>({diff:r,input:1}))),this.input2Diffs.flatMap(n=>n.rangeMappings.map(r=>({diff:r,input:2})))).sort(dht(cl(n=>n.diff.inputRange,z.compareRangesUsingStarts),cl(n=>n.input===i?1:2,hu))).map(n=>{let r=n.input===1?this.input1TextModel:this.input2TextModel;return new GRt(n.diff.inputRange,r.getValueInRange(n.diff.outputRange))}),o=Ijo(this.baseRange,t,this.baseTextModel);return i===1?this.smartInput1LineRangeEdit=o:this.smartInput2LineRangeEdit=o,o}dumbCombineInputs(i){if(i===1&&this.dumbInput1LineRangeEdit!==null)return this.dumbInput1LineRangeEdit;if(i===2&&this.dumbInput2LineRangeEdit!==null)return this.dumbInput2LineRangeEdit;let e=this.input1Range.getLines(this.input1TextModel),t=this.input2Range.getLines(this.input2TextModel);i===2&&([e,t]=[t,e]);let o=new YK(this.baseRange,e.concat(t));return i===1?this.dumbInput1LineRangeEdit=o:this.dumbInput2LineRangeEdit=o,o}};function Ijo(a,i,e){let t="",o=a.startLineNumber>1,n=o?new ye(a.startLineNumber-1,e.getLineMaxColumn(a.startLineNumber-1)):new ye(a.startLineNumber,1);for(let u of i){let p=u.range.getStartPosition();if(!n.isBeforeOrEqual(p))return;let h=e.getValueInRange(z.fromPositions(n,p));p.lineNumber>e.getLineCount()&&(h+=`
`),t+=h,t+=u.newText,n=u.range.getEndPosition()}let r=a.endLineNumberExclusive<=e.getLineCount(),s=r?new ye(a.endLineNumberExclusive,1):new ye(a.endLineNumberExclusive-1,1073741824),l=e.getValueInRange(z.fromPositions(n,s));t+=l;let c=yc(t);if(o){if(c[0]!=="")return;c.shift()}if(r){if(c[c.length-1]!=="")return;c.pop()}return new YK(a,c)}function Pgi(a){return a===1?2:1}var wue=class{constructor(){}get includesInput1(){return!1}get includesInput2(){return!1}includesInput(i){return i===1?this.includesInput1:this.includesInput2}isInputIncluded(i){return i===1?this.includesInput1:this.includesInput2}toggle(i){return this.withInputValue(i,!this.includesInput(i),!0)}getInput(i){return this.isInputIncluded(i)?1:0}},J9e=class extends wue{get kind(){return 0}toString(){return"base"}swap(){return this}withInputValue(i,e,t=!1){return i===1?e?new HTe:this:e?new Cue:this}equals(i){return i.kind===0}},HTe=class extends wue{get kind(){return 1}get includesInput1(){return!0}toString(){return"1\u2713"}swap(){return new Cue}withInputValue(i,e,t=!1){return i===1?e?this:new J9e:e?new XRt(1,t):new Cue}equals(i){return i.kind===1}},Cue=class a extends wue{get kind(){return 2}get includesInput2(){return!0}toString(){return"2\u2713"}swap(){return new HTe}withInputValue(i,e,t=!1){return i===2?e?this:new J9e:e?new XRt(2,t):new a}equals(i){return i.kind===2}},XRt=class a extends wue{constructor(e,t){super();this.firstInput=e;this.smartCombination=t}get kind(){return 3}get includesInput1(){return!0}get includesInput2(){return!0}toString(){return"2\u2713"}swap(){return new a(Pgi(this.firstInput),this.smartCombination)}withInputValue(e,t,o=!1){return t?this:e===1?new Cue:new HTe}equals(e){return e.kind===3&&this.firstInput===e.firstInput&&this.smartCombination===e.smartCombination}getInput(e){return e===this.firstInput?1:2}},Agi=class extends wue{get kind(){return 4}toString(){return"unrecognized"}swap(){return this}withInputValue(i,e,t=!1){return e?i===1?new HTe:new Cue:this}equals(i){return i.kind===4}},wS;(e=>(e.base=new J9e,e.unrecognized=new Agi))(wS||={});var xue=class extends wh{constructor(e,t,o,n,r,s,l,c,u){super();this.base=e;this.input1=t;this.input2=o;this.resultTextModel=n;this.diffComputer=r;this.options=s;this.telemetry=l;this.languageService=c;this.undoRedoService=u;this.input1TextModelDiffs=this._register(new WTe(this.base,this.input1.textModel,this.diffComputer)),this.input2TextModelDiffs=this._register(new WTe(this.base,this.input2.textModel,this.diffComputer)),this.resultTextModelDiffs=this._register(new WTe(this.base,this.resultTextModel,this.diffComputer)),this.modifiedBaseRanges=ke(this,h=>{let g=this.input1TextModelDiffs.diffs.read(h),f=this.input2TextModelDiffs.diffs.read(h);return YRt.fromDiffs(g,f,this.base,this.input1.textModel,this.input2.textModel)}),this.modifiedBaseRangeResultStates=ke(this,h=>new Map(this.modifiedBaseRanges.read(h).map(f=>[f,new JRt(f)]))),this.resultSnapshot=this.resultTextModel.createSnapshot(),this.baseInput1Diffs=this.input1TextModelDiffs.diffs,this.baseInput2Diffs=this.input2TextModelDiffs.diffs,this.baseResultDiffs=this.resultTextModelDiffs.diffs,this.input1ResultMapping=ke(this,h=>this.getInputResultMapping(this.baseInput1Diffs.read(h),this.baseResultDiffs.read(h),this.input1.textModel.getLineCount())),this.resultInput1Mapping=ke(this,h=>this.input1ResultMapping.read(h).reverse()),this.input2ResultMapping=ke(this,h=>this.getInputResultMapping(this.baseInput2Diffs.read(h),this.baseResultDiffs.read(h),this.input2.textModel.getLineCount())),this.resultInput2Mapping=ke(this,h=>this.input2ResultMapping.read(h).reverse()),this.baseResultMapping=ke(this,h=>{let g=new YF(this.baseResultDiffs.read(h),-1);return new YF(g.lineRangeMappings.map(f=>f.inputRange.isEmpty||f.outputRange.isEmpty?new fA(f.inputRange.deltaStart(-1),f.outputRange.deltaStart(-1)):f),g.inputLineCount)}),this.resultBaseMapping=ke(this,h=>this.baseResultMapping.read(h).reverse()),this.diffComputingState=ke(this,h=>{let g=[this.input1TextModelDiffs,this.input2TextModelDiffs,this.resultTextModelDiffs].map(f=>f.state.read(h));return g.some(f=>f===1)?1:g.some(f=>f===3)?3:2}),this.inputDiffComputingState=ke(this,h=>{let g=[this.input1TextModelDiffs,this.input2TextModelDiffs].map(f=>f.state.read(h));return g.some(f=>f===1)?1:g.some(f=>f===3)?3:2}),this.isUpToDate=ke(this,h=>this.diffComputingState.read(h)===2),this.firstRun=!0,this.unhandledConflictsCount=ke(this,h=>{let g=this.modifiedBaseRangeResultStates.read(h),f=0;for(let[v,b]of g)b.handled.read(h)||f++;return f}),this.hasUnhandledConflicts=this.unhandledConflictsCount.map(h=>h>0),this._register(I1(this.modifiedBaseRangeResultStates)),this._register(I1(this.input1ResultMapping)),this._register(I1(this.input2ResultMapping));let p=this.initialize();this.onInitialized=Wf(this.diffComputingState,h=>h===2).then(async()=>{await p}),p.then(()=>{let h=!0;this._register(hP({changeTracker:{createChangeSummary:()=>{},handleChange:g=>(g.didChange(this.modifiedBaseRangeResultStates)&&(h=!0),g.didChange(this.resultTextModelDiffs.diffs)?g.change===1:!0)}},g=>{let f=this.modifiedBaseRangeResultStates.read(g);if(!this.isUpToDate.read(g))return;let v=this.resultTextModelDiffs.diffs.read(g);Gi(b=>{if(this.updateBaseRangeAcceptedState(v,f,b),h){h=!1;for(let[S,y]of f){let w=y.accepted.read(void 0),k=!(w.kind===0||w.kind===4);y.handledInput1.set(k,b),y.handledInput2.set(k,b)}}})}))})}async initialize(){this.options.resetResult&&await this.reset()}async reset(){await Wf(this.inputDiffComputingState,t=>t===2);let e=this.modifiedBaseRangeResultStates.get();Gi(t=>{for(let[o,n]of e){let r,s=!1;o.input1Diffs.length===0?(r=wS.base.withInputValue(2,!0),s=!0):o.input2Diffs.length===0?(r=wS.base.withInputValue(1,!0),s=!0):o.isEqualChange?(r=wS.base.withInputValue(1,!0),s=!0):(r=wS.base,s=!1),n.accepted.set(r,t),n.computedFromDiffing=!1,n.previousNonDiffingState=void 0,n.handledInput1.set(s,t),n.handledInput2.set(s,t)}this.resultTextModel.pushEditOperations(null,[{range:new z(1,1,Number.MAX_SAFE_INTEGER,1),text:this.computeAutoMergedResult()}],()=>null)})}computeAutoMergedResult(){let e=this.modifiedBaseRanges.get(),t=this.base.getLinesContent(),o=this.input1.textModel.getLinesContent(),n=this.input2.textModel.getLinesContent(),r=[];function s(c,u){for(let p=u.startLineNumber;p<u.endLineNumberExclusive;p++)r.push(c[p-1])}let l=1;for(let c of e)s(t,ug.fromLineNumbers(l,c.baseRange.startLineNumber)),l=c.baseRange.endLineNumberExclusive,c.input1Diffs.length===0?s(n,c.input2Range):c.input2Diffs.length===0||c.isEqualChange?s(o,c.input1Range):s(t,c.baseRange);return s(t,ug.fromLineNumbers(l,t.length+1)),r.join(this.resultTextModel.getEOL())}hasBaseRange(e){return this.modifiedBaseRangeResultStates.get().has(e)}get isApplyingEditInResult(){return this.resultTextModelDiffs.isApplyingChange}getInputResultMapping(e,t,o){let n=YF.betweenOutputs(e,t,o);return new YF(n.lineRangeMappings.map(r=>r.inputRange.isEmpty||r.outputRange.isEmpty?new fA(r.inputRange.deltaStart(-1),r.outputRange.deltaStart(-1)):r),n.inputLineCount)}translateInputRangeToBase(e,t){let o=e===1?this.baseInput1Diffs.get():this.baseInput2Diffs.get();return new Iue(o.flatMap(r=>r.rangeMappings),0).reverse().projectRange(t).outputRange}translateBaseRangeToInput(e,t){let o=e===1?this.baseInput1Diffs.get():this.baseInput2Diffs.get();return new Iue(o.flatMap(r=>r.rangeMappings),0).projectRange(t).outputRange}getLineRangeInResult(e,t){return this.resultTextModelDiffs.getResultLineRange(e,t)}translateResultRangeToBase(e){return new Iue(this.baseResultDiffs.get().flatMap(o=>o.rangeMappings),0).reverse().projectRange(e).outputRange}translateBaseRangeToResult(e){return new Iue(this.baseResultDiffs.get().flatMap(o=>o.rangeMappings),0).projectRange(e).outputRange}findModifiedBaseRangesInRange(e){return this.modifiedBaseRanges.get().filter(t=>t.baseRange.intersectsOrTouches(e))}updateBaseRangeAcceptedState(e,t,o){let n=bio(t,e,(r,s)=>r[0].baseRange.intersectsOrTouches(s.inputRange)?dC.neitherLessOrGreaterThan:ug.compareByStart(r[0].baseRange,s.inputRange));for(let r of n){let s=this.computeState(r.left[0],r.rights),l=r.left[1],c=l.accepted.get();c.equals(s)||(!this.firstRun&&!l.computedFromDiffing&&(l.computedFromDiffing=!0,l.previousNonDiffingState=c),l.accepted.set(s,o))}this.firstRun&&(this.firstRun=!1)}computeState(e,t){if(t.length===0)return wS.base;let o=t.map(s=>s.getLineEdit());function n(s){return $i(o,s.map(l=>l.getLineEdit()),(l,c)=>l.equals(c))}if(n(e.input1Diffs))return wS.base.withInputValue(1,!0);if(n(e.input2Diffs))return wS.base.withInputValue(2,!0);let r=[wS.base.withInputValue(1,!0).withInputValue(2,!0,!0),wS.base.withInputValue(2,!0).withInputValue(1,!0,!0),wS.base.withInputValue(1,!0).withInputValue(2,!0,!1),wS.base.withInputValue(2,!0).withInputValue(1,!0,!1)];for(let s of r){let{edit:l}=e.getEditForBase(s);if(l){let u=this.resultTextModelDiffs.getResultLineRange(e.baseRange).getLines(this.resultTextModel);if($i(l.newLines,u,(p,h)=>p===h))return s}}return wS.unrecognized}getState(e){let t=this.modifiedBaseRangeResultStates.get().get(e);if(!t)throw new li("object must be from this instance");return t.accepted}setState(e,t,o,n,r=!1){if(!this.isUpToDate.get())throw new li("Cannot set state while updating");let s=this.modifiedBaseRangeResultStates.get().get(e);if(!s)throw new li("object must be from this instance");let l=this.resultTextModelDiffs.findTouchingDiffs(e.baseRange),c=new Q7;l&&this.resultTextModelDiffs.removeDiffs(l,n,c);let{edit:u,effectiveState:p}=e.getEditForBase(t);s.accepted.set(p,n),s.previousNonDiffingState=void 0,s.computedFromDiffing=!1;let h=s.handledInput1.get(),g=s.handledInput2.get();(!h||!g)&&this.undoRedoService.pushElement(new Ngi(this.resultTextModel.uri,new WeakRef(this),new WeakRef(s),h,g),c),u&&(this.resultTextModel.pushStackElement(),this.resultTextModelDiffs.applyEditRelativeToOriginal(u,n,c),this.resultTextModel.pushStackElement()),s.handledInput1.set(!0,n),s.handledInput2.set(!0,n)}resetDirtyConflictsToBase(){Gi(e=>{this.resultTextModel.pushStackElement();for(let t of this.modifiedBaseRanges.get())this.getState(t).get().kind===4&&this.setState(t,wS.base,!1,e,!1);this.resultTextModel.pushStackElement()})}isHandled(e){return this.modifiedBaseRangeResultStates.get().get(e).handled}isInputHandled(e,t){let o=this.modifiedBaseRangeResultStates.get().get(e);return t===1?o.handledInput1:o.handledInput2}setInputHandled(e,t,o,n){let r=this.modifiedBaseRangeResultStates.get().get(e);if(r.handled.get()===o)return;let s=new WeakRef(JRt),l=new WeakRef(this);this.undoRedoService.pushElement({type:0,resource:this.resultTextModel.uri,code:"setInputHandled",label:d(12205,null),redo(){let c=l.deref(),u=s.deref();c&&!c.isDisposed()&&u&&Gi(p=>{t===1?r.handledInput1.set(o,p):r.handledInput2.set(o,p)})},undo(){let c=l.deref(),u=s.deref();c&&!c.isDisposed()&&u&&Gi(p=>{t===1?r.handledInput1.set(!o,p):r.handledInput2.set(!o,p)})}}),t===1?r.handledInput1.set(o,n):r.handledInput2.set(o,n)}setHandled(e,t,o){let n=this.modifiedBaseRangeResultStates.get().get(e);n.handled.get()!==t&&(n.handledInput1.set(t,o),n.handledInput2.set(t,o))}setLanguageId(e,t){let o=this.languageService.createById(e);this.base.setLanguage(o,t),this.input1.textModel.setLanguage(o,t),this.input2.textModel.setLanguage(o,t),this.resultTextModel.setLanguage(o,t)}getInitialResultValue(){let e=[];for(;;){let t=this.resultSnapshot.read();if(t===null)break;e.push(t)}return e.join()}async getResultValueWithConflictMarkers(){if(await Wf(this.diffComputingState,c=>c===2),this.unhandledConflictsCount.get()===0)return this.resultTextModel.getValue();let e=this.resultTextModel.getLinesContent(),t=this.input1.textModel.getLinesContent(),o=this.input2.textModel.getLinesContent(),n=this.modifiedBaseRangeResultStates.get(),r=[];function s(c,u){for(let p=u.startLineNumber;p<u.endLineNumberExclusive;p++)r.push(c[p-1])}let l=1;for(let[c,u]of n){if(u.handled.get())continue;let p=this.resultTextModelDiffs.getResultLineRange(c.baseRange);s(e,ug.fromLineNumbers(l,Math.max(l,p.startLineNumber))),l=p.endLineNumberExclusive,r.push("<<<<<<<"),u.accepted.get().kind===4?s(e,p):s(t,c.input1Range),r.push("======="),s(o,c.input2Range),r.push(">>>>>>>")}return s(e,ug.fromLineNumbers(l,e.length+1)),r.join(`
`)}get conflictCount(){return vD(this.modifiedBaseRanges.get(),e=>e.isConflicting)}get combinableConflictCount(){return vD(this.modifiedBaseRanges.get(),e=>e.isConflicting&&e.canBeCombined)}get conflictsResolvedWithBase(){return vD(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>e.isConflicting&&t.accepted.get().kind===0)}get conflictsResolvedWithInput1(){return vD(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>e.isConflicting&&t.accepted.get().kind===1)}get conflictsResolvedWithInput2(){return vD(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>e.isConflicting&&t.accepted.get().kind===2)}get conflictsResolvedWithSmartCombination(){return vD(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>{let o=t.accepted.get();return e.isConflicting&&o.kind===3&&o.smartCombination})}get manuallySolvedConflictCountThatEqualNone(){return vD(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>e.isConflicting&&t.accepted.get().kind===4)}get manuallySolvedConflictCountThatEqualSmartCombine(){return vD(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>{let o=t.accepted.get();return e.isConflicting&&t.computedFromDiffing&&o.kind===3&&o.smartCombination})}get manuallySolvedConflictCountThatEqualInput1(){return vD(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>{let o=t.accepted.get();return e.isConflicting&&t.computedFromDiffing&&o.kind===1})}get manuallySolvedConflictCountThatEqualInput2(){return vD(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>{let o=t.accepted.get();return e.isConflicting&&t.computedFromDiffing&&o.kind===2})}get manuallySolvedConflictCountThatEqualNoneAndStartedWithBase(){return vD(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>{let o=t.accepted.get();return e.isConflicting&&o.kind===4&&t.previousNonDiffingState?.kind===0})}get manuallySolvedConflictCountThatEqualNoneAndStartedWithInput1(){return vD(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>{let o=t.accepted.get();return e.isConflicting&&o.kind===4&&t.previousNonDiffingState?.kind===1})}get manuallySolvedConflictCountThatEqualNoneAndStartedWithInput2(){return vD(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>{let o=t.accepted.get();return e.isConflicting&&o.kind===4&&t.previousNonDiffingState?.kind===2})}get manuallySolvedConflictCountThatEqualNoneAndStartedWithBothNonSmart(){return vD(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>{let o=t.accepted.get();return e.isConflicting&&o.kind===4&&t.previousNonDiffingState?.kind===3&&!t.previousNonDiffingState?.smartCombination})}get manuallySolvedConflictCountThatEqualNoneAndStartedWithBothSmart(){return vD(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>{let o=t.accepted.get();return e.isConflicting&&o.kind===4&&t.previousNonDiffingState?.kind===3&&t.previousNonDiffingState?.smartCombination})}};xue=I([m(7,_t),m(8,Ml)],xue);function vD(a,i){let e=0;for(let t of a)i(t)&&e++;return e}var JRt=class{constructor(i){this.baseRange=i;this.accepted=Me(`BaseRangeState${this.baseRange.baseRange}`,wS.base),this.handledInput1=Me(`BaseRangeHandledState${this.baseRange.baseRange}.Input1`,!1),this.handledInput2=Me(`BaseRangeHandledState${this.baseRange.baseRange}.Input2`,!1),this.computedFromDiffing=!1,this.previousNonDiffingState=void 0,this.handled=ke(this,e=>this.handledInput1.read(e)&&this.handledInput2.read(e))}};var Ngi=class{constructor(i,e,t,o,n){this.resource=i;this.mergeEditorModelRef=e;this.stateRef=t;this.input1Handled=o;this.input2Handled=n;this.code="undoMarkAsHandled";this.label=d(12206,null);this.type=0}redo(){let i=this.mergeEditorModelRef.deref();if(!i||i.isDisposed())return;let e=this.stateRef.deref();e&&Gi(t=>{e.handledInput1.set(!0,t),e.handledInput2.set(!0,t)})}undo(){let i=this.mergeEditorModelRef.deref();if(!i||i.isDisposed())return;let e=this.stateRef.deref();e&&Gi(t=>{e.handledInput1.set(this.input1Handled,t),e.handledInput2.set(this.input2Handled,t)})}};var $p=new Y("isMergeEditor",!1,{type:"boolean",description:d(12260,null)}),ZRt=new Y("isMergeResultEditor",!1,{type:"boolean",description:d(12261,null)}),TJ=new Y("mergeEditorLayout","mixed",{type:"string",description:d(12259,null)}),UTe=new Y("mergeEditorShowBase",!1,{type:"boolean",description:d(12263,null)}),Z9e=new Y("mergeEditorShowBaseAtTop",!1,{type:"boolean",description:d(12264,null)}),eMt=new Y("mergeEditorShowNonConflictingChanges",!1,{type:"boolean",description:d(12265,null)}),tMt=new Y("mergeEditorBaseUri","",{type:"string",description:d(12258,null)}),Iio=new Y("mergeEditorResultUri","",{type:"string",description:d(12262,null)}),e7e="mergeEditorCloseWithConflicts";var zTe=class{constructor(i,e,t,o){this._mergeEditorTelemetry=i;this._instantiationService=e;this._textModelService=t;this._modelService=o}async createInputModel(i){let e=new N,[t,o,n,r]=await Promise.all([this._textModelService.createModelReference(i.base),this._textModelService.createModelReference(i.result),iMt(i.input1,this._textModelService,e),iMt(i.input2,this._textModelService,e)]);e.add(t),e.add(o);let s=o.object.textEditorModel.uri.with({scheme:"merge-result"}),l=this._modelService.createModel("",{languageId:o.object.textEditorModel.getLanguageId(),onDidChange:U.None},s);e.add(l);let c=this._instantiationService.createInstance(yue),u=this._instantiationService.createInstance(xue,t.object.textEditorModel,n,r,l,c,{resetResult:!0},this._mergeEditorTelemetry);return e.add(u),await u.onInitialized,this._instantiationService.createInstance(t7e,u,e,o.object,i.result)}};zTe=I([m(1,F),m(2,Bt),m(3,Tt)],zTe);var t7e=class extends wh{constructor(e,t,o,n,r,s,l){super();this.model=e;this.disposable=t;this.result=o;this.resultUri=n;this.textFileService=r;this.dialogService=s;this.editorService=l;this.savedAltVersionId=Me(this,this.model.resultTextModel.getAlternativeVersionId()),this.altVersionId=ui(this,c=>this.model.resultTextModel.onDidChangeContent(c),()=>this.model.resultTextModel.getAlternativeVersionId()),this.isDirty=ke(this,c=>this.altVersionId.read(c)!==this.savedAltVersionId.read(c)),this.finished=!1}dispose(){this.disposable.dispose(),super.dispose()}async accept(){let e=await this.model.resultTextModel.getValue();this.result.textEditorModel.setValue(e),this.savedAltVersionId.set(this.model.resultTextModel.getAlternativeVersionId(),void 0),await this.textFileService.save(this.result.textEditorModel.uri),this.finished=!0}async _discard(){await this.textFileService.revert(this.model.resultTextModel.uri),this.savedAltVersionId.set(this.model.resultTextModel.getAlternativeVersionId(),void 0),this.finished=!0}shouldConfirmClose(){return!0}async confirmClose(e){lh(()=>e.some(n=>n===this));let t=e.some(n=>n.isDirty.get()),o;if(t){let n=e.length>1,r=n?d(12182,null,e.length):d(12181,null,He(e[0].model.resultTextModel.uri)),s=e.some(c=>c.model.hasUnhandledConflicts.get()),l=[{label:s?d(12187,null):d(12184,null),run:()=>0},{label:d(12179,null),run:()=>1}];o=(await this.dialogService.prompt({type:bt.Info,message:r,detail:s?n?d(12178,null):d(12176,null):n?d(12177,null):d(12175,null),buttons:l,cancelButton:{run:()=>2}})).result}else o=1;return o===0?await Promise.all(e.map(n=>n.accept())):o===1&&await Promise.all(e.map(n=>n._discard())),o}async save(e){this.finished||(async()=>{let{confirmed:t}=await this.dialogService.confirm({message:d(12186,null),detail:d(12185,null),primaryButton:d(12174,null)});if(t){await this.accept();let o=this.editorService.findEditors(this.resultUri).filter(n=>n.editor.typeId==="mergeEditor.Input");await this.editorService.closeEditors(o)}})()}async revert(e){}};t7e=I([m(4,Uo),m(5,at),m(6,ee)],t7e);var _J=class{constructor(i,e,t,o,n,r){this._mergeEditorTelemetry=i;this._instantiationService=e;this._textModelService=t;this.textFileService=o;this._modelService=n;this._languageService=r}static{this.FILE_SAVED_SOURCE=Ih.registerSource("merge-editor.source",d(12180,null))}async createInputModel(i){let e=new N,[t,o,n,r]=await Promise.all([this._textModelService.createModelReference(i.base).then(g=>({object:g.object.textEditorModel,dispose:()=>g.dispose()})).catch(g=>{mt(g),console.error(g)}),this._textModelService.createModelReference(i.result),iMt(i.input1,this._textModelService,e),iMt(i.input2,this._textModelService,e)]);if(t===void 0){let g=this._modelService.createModel("",this._languageService.createById(o.object.getLanguageId()));t={dispose:()=>{g.dispose()},object:g}}e.add(t),e.add(o);let s=this.textFileService.files.models.find(g=>g.resource.toString()===o.object.textEditorModel.uri.toString());if(!s)throw new li;await s.save({source:_J.FILE_SAVED_SOURCE});let u=s.textEditorModel.getLinesContent().some(g=>g.startsWith(hio.start)),p=this._instantiationService.createInstance(yue),h=this._instantiationService.createInstance(xue,t.object,n,r,o.object.textEditorModel,p,{resetResult:u},this._mergeEditorTelemetry);return e.add(h),await h.onInitialized,this._instantiationService.createInstance(i7e,h,e,s,this._mergeEditorTelemetry)}};_J=I([m(1,F),m(2,Bt),m(3,Uo),m(4,Tt),m(5,_t)],_J);var i7e=class extends wh{constructor(e,t,o,n,r,s){super();this.model=e;this.disposableStore=t;this.resultTextFileModel=o;this.telemetry=n;this._dialogService=r;this._storageService=s;this.isDirty=ui(this,U.any(this.resultTextFileModel.onDidChangeDirty,this.resultTextFileModel.onDidSaveError),()=>this.resultTextFileModel.isDirty()),this.reported=!1,this.dateTimeOpened=new Date}dispose(){this.disposableStore.dispose(),super.dispose(),this.reportClose(!1)}reportClose(e){if(!this.reported){let t=this.model.unhandledConflictsCount.get(),o=new Date().getTime()-this.dateTimeOpened.getTime();this.telemetry.reportMergeEditorClosed({durationOpenedSecs:o/1e3,remainingConflictCount:t,accepted:e,conflictCount:this.model.conflictCount,combinableConflictCount:this.model.combinableConflictCount,conflictsResolvedWithBase:this.model.conflictsResolvedWithBase,conflictsResolvedWithInput1:this.model.conflictsResolvedWithInput1,conflictsResolvedWithInput2:this.model.conflictsResolvedWithInput2,conflictsResolvedWithSmartCombination:this.model.conflictsResolvedWithSmartCombination,manuallySolvedConflictCountThatEqualNone:this.model.manuallySolvedConflictCountThatEqualNone,manuallySolvedConflictCountThatEqualSmartCombine:this.model.manuallySolvedConflictCountThatEqualSmartCombine,manuallySolvedConflictCountThatEqualInput1:this.model.manuallySolvedConflictCountThatEqualInput1,manuallySolvedConflictCountThatEqualInput2:this.model.manuallySolvedConflictCountThatEqualInput2,manuallySolvedConflictCountThatEqualNoneAndStartedWithBase:this.model.manuallySolvedConflictCountThatEqualNoneAndStartedWithBase,manuallySolvedConflictCountThatEqualNoneAndStartedWithInput1:this.model.manuallySolvedConflictCountThatEqualNoneAndStartedWithInput1,manuallySolvedConflictCountThatEqualNoneAndStartedWithInput2:this.model.manuallySolvedConflictCountThatEqualNoneAndStartedWithInput2,manuallySolvedConflictCountThatEqualNoneAndStartedWithBothNonSmart:this.model.manuallySolvedConflictCountThatEqualNoneAndStartedWithBothNonSmart,manuallySolvedConflictCountThatEqualNoneAndStartedWithBothSmart:this.model.manuallySolvedConflictCountThatEqualNoneAndStartedWithBothSmart}),this.reported=!0}}async accept(){this.reportClose(!0),await this.resultTextFileModel.save()}get resultUri(){return this.resultTextFileModel.resource}async save(e){await this.resultTextFileModel.save(e)}async revert(e){await this.resultTextFileModel.revert(e)}shouldConfirmClose(){return!0}async confirmClose(e){let t=e.length>1,o=e.some(r=>r.isDirty.get()),n=e.some(r=>r.model.hasUnhandledConflicts.get());if(o){let r=t?d(12199,null,e.length):d(12197,null,He(e[0].resultUri)),{result:s}=await this._dialogService.prompt({type:bt.Info,message:r,detail:n?t?d(12194,null):d(12191,null):t?d(12193,null):d(12190,null),buttons:[{label:n?d(12202,null):d(12201,null),run:()=>0},{label:d(12196,null),run:()=>1}],cancelButton:{run:()=>2}});return s}else if(n&&!this._storageService.getBoolean(e7e,0,!1)){let{confirmed:r,checkboxChecked:s}=await this._dialogService.confirm({message:t?d(12200,null,e.length):d(12198,null,He(e[0].resultUri)),detail:n?t?d(12195,null):d(12192,null):void 0,primaryButton:n?d(12189,null):d(12188,null),checkbox:{label:d(12183,null)}});return s&&this._storageService.store(e7e,!0,0,0),r?0:2}else return 0}};i7e=I([m(4,at),m(5,ce)],i7e);async function iMt(a,i,e){let t=await i.createModelReference(a.uri);return e.add(t),{textModel:t.object.textEditorModel,title:a.title,description:a.description,detail:a.detail}}var KTe=class{constructor(i){this.telemetryService=i}reportMergeEditorOpened(i){this.telemetryService.publicLog2("mergeEditor.opened",{conflictCount:i.conflictCount,combinableConflictCount:i.combinableConflictCount,baseVisible:i.baseVisible,isColumnView:i.isColumnView,baseTop:i.baseTop})}reportLayoutChange(i){this.telemetryService.publicLog2("mergeEditor.layoutChanged",{baseVisible:i.baseVisible,isColumnView:i.isColumnView,baseTop:i.baseTop})}reportMergeEditorClosed(i){this.telemetryService.publicLog2("mergeEditor.closed",{conflictCount:i.conflictCount,combinableConflictCount:i.combinableConflictCount,durationOpenedSecs:i.durationOpenedSecs,remainingConflictCount:i.remainingConflictCount,accepted:i.accepted,conflictsResolvedWithBase:i.conflictsResolvedWithBase,conflictsResolvedWithInput1:i.conflictsResolvedWithInput1,conflictsResolvedWithInput2:i.conflictsResolvedWithInput2,conflictsResolvedWithSmartCombination:i.conflictsResolvedWithSmartCombination,manuallySolvedConflictCountThatEqualNone:i.manuallySolvedConflictCountThatEqualNone,manuallySolvedConflictCountThatEqualSmartCombine:i.manuallySolvedConflictCountThatEqualSmartCombine,manuallySolvedConflictCountThatEqualInput1:i.manuallySolvedConflictCountThatEqualInput1,manuallySolvedConflictCountThatEqualInput2:i.manuallySolvedConflictCountThatEqualInput2,manuallySolvedConflictCountThatEqualNoneAndStartedWithBase:i.manuallySolvedConflictCountThatEqualNoneAndStartedWithBase,manuallySolvedConflictCountThatEqualNoneAndStartedWithInput1:i.manuallySolvedConflictCountThatEqualNoneAndStartedWithInput1,manuallySolvedConflictCountThatEqualNoneAndStartedWithInput2:i.manuallySolvedConflictCountThatEqualNoneAndStartedWithInput2,manuallySolvedConflictCountThatEqualNoneAndStartedWithBothNonSmart:i.manuallySolvedConflictCountThatEqualNoneAndStartedWithBothNonSmart,manuallySolvedConflictCountThatEqualNoneAndStartedWithBothSmart:i.manuallySolvedConflictCountThatEqualNoneAndStartedWithBothSmart})}reportAcceptInvoked(i,e){this.telemetryService.publicLog2("mergeEditor.action.accept",{otherAccepted:e,isInput1:i===1})}reportSmartCombinationInvoked(i){this.telemetryService.publicLog2("mergeEditor.action.smartCombination",{otherAccepted:i})}reportRemoveInvoked(i,e){this.telemetryService.publicLog2("mergeEditor.action.remove",{otherAccepted:e,isInput1:i===1})}reportResetToBaseInvoked(){this.telemetryService.publicLog2("mergeEditor.action.resetToBase",{})}reportNavigationToNextConflict(){this.telemetryService.publicLog2("mergeEditor.action.goToNextConflict",{})}reportNavigationToPreviousConflict(){this.telemetryService.publicLog2("mergeEditor.action.goToPreviousConflict",{})}reportConflictCounterClicked(){this.telemetryService.publicLog2("mergeEditor.action.conflictCounterClicked",{})}};KTe=I([m(0,Te)],KTe);var D4=class{constructor(i,e,t,o){this.uri=i;this.title=e;this.detail=t;this.description=o}},Eb=class extends Ck{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super(n,void 0,s,l,c,u,h,g,f);this.base=e;this.input1=t;this.input2=o;this.result=n;this._instaService=r;this.configurationService=p;this.logService=v;this._focusedEditor="result",this.closeHandler={showConfirm:()=>this._inputModel?.shouldConfirmClose()??!1,confirm:async b=>{lh(()=>b.every(y=>y.editor instanceof Eb));let S=b.map(y=>y.editor._inputModel).filter(lo);return await this._inputModel.confirmClose(S)}},this.mergeEditorModeFactory=this._instaService.createInstance(this.useWorkingCopy?zTe:_J,this._instaService.createInstance(KTe))}static{this.ID="mergeEditor.Input"}get useWorkingCopy(){return this.configurationService.getValue("mergeEditor.useWorkingCopy")??!1}dispose(){super.dispose()}get typeId(){return Eb.ID}get editorId(){return la.id}get capabilities(){let e=super.capabilities|256;return this.useWorkingCopy&&(e|=4),e}getName(){return d(12173,null,super.getName())}async resolve(){if(!this._inputModel){let e=this._register(await this.mergeEditorModeFactory.createInputModel({base:this.base,input1:this.input1,input2:this.input2,result:this.result}));this._inputModel=e,this._register(be(t=>{e.isDirty.read(t),this._onDidChangeDirty.fire()})),await this._inputModel.model.onInitialized}return this._inputModel}async accept(){await this._inputModel?.accept()}async save(e,t){await this._inputModel?.save(t)}toUntyped(){return{input1:{resource:this.input1.uri,label:this.input1.title,description:this.input1.description,detail:this.input1.detail},input2:{resource:this.input2.uri,label:this.input2.title,description:this.input2.description,detail:this.input2.detail},base:{resource:this.base},result:{resource:this.result},options:{override:this.typeId}}}matches(e){return this===e?!0:e instanceof Eb?Qe(this.base,e.base)&&Qe(this.input1.uri,e.input1.uri)&&Qe(this.input2.uri,e.input2.uri)&&Qe(this.result,e.result):WC(e)?(this.editorId===e.options?.override||e.options?.override===void 0)&&Qe(this.base,e.base.resource)&&Qe(this.input1.uri,e.input1.resource)&&Qe(this.input2.uri,e.input2.resource)&&Qe(this.result,e.result.resource):!1}async revert(e,t){return this._inputModel?.revert(t)}isDirty(){return this._inputModel?.isDirty.get()??!1}setLanguageId(e,t){this._inputModel?.model.setLanguageId(e,t)}updateFocusedEditor(e){this._focusedEditor!==e&&(this._focusedEditor=e,this.logService.trace("alertFocusedEditor",e),yjo(e))}};Eb=I([m(4,F),m(5,ee),m(6,Uo),m(7,rt),m(8,fe),m(9,B),m(10,gr),m(11,Fn),m(12,Rv),m(13,se)],Eb);function yjo(a){switch(a){case"input1":en(d(12170,null));break;case"input2":en(d(12171,null));break;case"result":en(d(12172,null));break}}var GTe=class extends x{constructor(e,t){super();this.model=e;this._instantiationService=t;this._documents=lae(this.model,this.model.documents),this._documentsArr=ke(this,o=>{let n=this._documents.read(o);return n==="loading"?[]:n}),this.isLoading=ke(this,o=>this._documents.read(o)==="loading"),this.items=ob(this,this._documentsArr,(o,n)=>n.add(this._instantiationService.createInstance(o7e,o,this))).recomputeInitiallyAndOnChange(this._store),this.focusedDiffItem=ke(this,o=>this.items.read(o).find(n=>n.isFocused.read(o))),this.activeDiffItem=M$e(this,(o,n)=>this.focusedDiffItem.read(o)??(n&&this.items.read(o).indexOf(n)!==-1)?n:void 0)}async waitForDiffs(){for(let e of this.items.get())await e.diffEditorViewModel.waitForDiff()}collapseAll(){Gi(e=>{for(let t of this.items.get())t.collapsed.set(!0,e)})}expandAll(){Gi(e=>{for(let t of this.items.get())t.collapsed.set(!1,e)})}get contextKeys(){return this.model.contextKeys}},o7e=class extends x{constructor(e,t,o,n){super();this._editorViewModel=t;this._instantiationService=o;this._modelService=n;this.collapsed=Me(this,!1);this.lastTemplateData=Me(this,{contentHeight:500,selections:void 0});this.isActive=ke(this,e=>this._editorViewModel.activeDiffItem.read(e)===this);this._isFocusedSource=Me(this,So(!1));this.isFocused=ke(this,e=>this._isFocusedSource.read(e).read(e));this.isAlive=Me(this,!0);this._register(Z(()=>{this.isAlive.set(!1,void 0)})),this.documentDiffItemRef=this._register(e.createNewRef(this));function r(p){return{...p,hideUnchangedRegions:{enabled:!0}}}let s=this._instantiationService.createInstance(vY,r(this.documentDiffItem.options||{}));this.documentDiffItem.onOptionsDidChange&&this._register(this.documentDiffItem.onOptionsDidChange(()=>{s.updateOptions(r(this.documentDiffItem.options||{}))}));let l=new N,c=this.documentDiffItem.original??l.add(this._modelService.createModel("",null)),u=this.documentDiffItem.modified??l.add(this._modelService.createModel("",null));l.add(this.documentDiffItemRef.createNewRef(this)),this.diffEditorViewModelRef=this._register(KV.createWithDisposable(this._instantiationService.createInstance(hY,{original:c,modified:u},s),l,this))}get diffEditorViewModel(){return this.diffEditorViewModelRef.object}get originalUri(){return this.documentDiffItem.original?.uri}get modifiedUri(){return this.documentDiffItem.modified?.uri}setIsFocused(e,t){this._isFocusedSource.set(e,t)}get documentDiffItem(){return this.documentDiffItemRef.object}getKey(){return JSON.stringify([this.originalUri?.toString(),this.modifiedUri?.toString()])}};o7e=I([m(2,F),m(3,Tt)],o7e);var yio=Ae("multi-diff-editor-label-icon",R.diffMultiple,d(12287,null));var XK=le("multiDiffSourceResolverService"),xk=class{constructor(i,e,t,o,n){this.originalUri=i;this.modifiedUri=e;this.goToFileUri=t;this.goToFileEditorTitle=o;this.contextKeys=n;if(!i&&!e)throw new li("Invalid arguments")}getKey(){return JSON.stringify([this.modifiedUri?.toString(),this.originalUri?.toString()])}},oMt=class{constructor(){this._resolvers=new Set}registerResolver(i){if(this._resolvers.has(i))throw new li("Duplicate resolver");return this._resolvers.add(i),Z(()=>this._resolvers.delete(i))}resolve(i){for(let e of this._resolvers)if(e.canHandleUri(i))return e.resolveDiffSource(i);return Promise.resolve(void 0)}};var au=class extends ls{constructor(e,t,o,n=!1,r,s,l,c,u){super();this.multiDiffSource=e;this.label=t;this.initialResources=o;this.isTransient=n;this._textModelService=r;this._textResourceConfigurationService=s;this._instantiationService=l;this._multiDiffSourceResolverService=c;this._textFileService=u;this._name="",this._viewModel=new Yht(async()=>{let p=await this._createModel();this._register(p);let h=new GTe(p,this._instantiationService);return this._register(h),await vp(h.waitForDiffs(),1e3),h}),this._resolvedSource=new L$e(async()=>{let p=this.initialResources?{resources:eIe.const(this.initialResources)}:await this._multiDiffSourceResolverService.resolve(this.multiDiffSource);return{source:p,resources:p?lae(this,p.resources):So([])}}),this.resources=ke(this,p=>this._resolvedSource.cachedPromiseResult.read(p)?.data?.resources.read(p)),this.textFileServiceOnDidChange=new Ogi(this._textFileService.files.onDidChangeDirty,p=>p.resource.toString(),p=>p.toString()),this._isDirtyObservables=ob(this,this.resources.map(p=>p??[]),p=>{let h=p.modifiedUri?wio(this.textFileServiceOnDidChange,this._textFileService,p.modifiedUri):So(!1),g=p.originalUri?wio(this.textFileServiceOnDidChange,this._textFileService,p.originalUri):So(!1);return ke(f=>h.read(f)||g.read(f))},p=>p.getKey()),this._isDirtyObservable=ke(this,p=>this._isDirtyObservables.read(p).some(h=>h.read(p))).keepObserved(this._store),this.onDidChangeDirty=U.fromObservableLight(this._isDirtyObservable),this.closeHandler={async confirm(){return 1},showConfirm(){return!1}},this._register(be(p=>{let h=this.resources.read(p),g=this.label??d(12289,null);h&&h.length===1?this._name=d(12291,null,g):h?this._name=d(12290,null,g,h.length):this._name=g,this._onDidChangeLabel.fire()}))}static fromResourceMultiDiffEditorInput(e,t){if(!e.multiDiffSource&&!e.resources)throw new li("MultiDiffEditorInput requires either multiDiffSource or resources");let o=e.multiDiffSource??A.parse(`multi-diff-editor:${new Date().getMilliseconds().toString()+Math.random().toString()}`);return t.createInstance(au,o,e.label,e.resources?.map(n=>new xk(n.original.resource,n.modified.resource,n.goToFileResource)),e.isTransient??!1)}static fromSerialized(e,t){return t.createInstance(au,A.parse(e.multiDiffSourceUri),e.label,e.resources?.map(o=>new xk(o.originalUri?A.parse(o.originalUri):void 0,o.modifiedUri?A.parse(o.modifiedUri):void 0,o.goToFileUri?A.parse(o.goToFileUri):void 0)),!1)}static{this.ID="workbench.input.multiDiffEditor"}get resource(){return this.multiDiffSource}get capabilities(){return 2}get typeId(){return au.ID}getName(){return this._name}get editorId(){return la.id}getIcon(){return yio}serialize(){return{label:this.label,multiDiffSourceUri:this.multiDiffSource.toString(),resources:this.initialResources?.map(e=>({originalUri:e.originalUri?.toString(),modifiedUri:e.modifiedUri?.toString(),goToFileUri:e.goToFileUri?.toString()}))}}setLanguageId(e,t){let n=this._viewModel.requireValue().activeDiffItem.get()?.documentDiffItem;if(!n)return;let r=n.modified??n.original;r&&r.setLanguage(e,t)}async getViewModel(){return this._viewModel.getPromise()}async _createModel(){let e=await this._resolvedSource.getPromise(),t=this._textResourceConfigurationService,o=ob(this,e.resources,async(c,u)=>{let p,h,g=new N;try{[p,h]=await Promise.all([c.originalUri?this._textModelService.createModelReference(c.originalUri):void 0,c.modifiedUri?this._textModelService.createModelReference(c.modifiedUri):void 0]),p&&g.add(p),h&&g.add(h)}catch(b){console.error(b),mt(b);return}let f=c.modifiedUri??c.originalUri,v={multiDiffEditorItem:c,original:p?.object.textEditorModel,modified:h?.object.textEditorModel,contextKeys:c.contextKeys,get options(){return{...wjo(h?.object.isReadonly()??!0),...Cjo(t.getValue(f))}},onOptionsDidChange:b=>this._textResourceConfigurationService.onDidChangeConfiguration(S=>{(S.affectsConfiguration(f,"editor")||S.affectsConfiguration(f,"diffEditor"))&&b()})};return u.add(KV.createOfNonDisposable(v,g,this))},c=>JSON.stringify([c.modifiedUri?.toString(),c.originalUri?.toString()])),n=Me("documents","loading"),r=ke(async c=>{let u=o.read(c),h=(await Promise.all(u)).filter(lo);n.set(h,void 0)}),s=fP(r);return await r.get(),{dispose:()=>s.dispose(),documents:new sO(n),contextKeys:e.source?.contextKeys}}matches(e){return super.matches(e)?!0:e instanceof au?this.multiDiffSource.toString()===e.multiDiffSource.toString():!1}isDirty(){return this._isDirtyObservable.get()}async save(e,t){return await this.doSaveOrRevert("save",e,t),this}revert(e,t){return this.doSaveOrRevert("revert",e,t)}async doSaveOrRevert(e,t,o){let n=this._viewModel.currentValue?.items.get();n&&await Promise.all(n.map(async r=>{let s=r.diffEditorViewModel.model,l=s.original.uri.scheme!==Q.untitled&&this._textFileService.isDirty(s.original.uri);await Promise.all([l?e==="save"?this._textFileService.save(s.original.uri,o):this._textFileService.revert(s.original.uri,o):Promise.resolve(),e==="save"?this._textFileService.save(s.modified.uri,o):this._textFileService.revert(s.modified.uri,o)])}))}};au=I([m(4,Bt),m(5,Fn),m(6,F),m(7,XK),m(8,Uo)],au);var Ogi=class{constructor(i,e,t){this._event=i;this._getEventArgsKey=e;this._keyToString=t;this._count=0;this._buckets=new Map;this._handleEventChange=i=>{let e=this._getEventArgsKey(i),t=this._buckets.get(e);if(t)for(let o of t)o(i)}}filteredEvent(i){return e=>{let t=this._keyToString(i),o=this._buckets.get(t);return o||(o=new Set,this._buckets.set(t,o)),o.add(e),this._count++,this._count===1&&(this._eventSubscription=this._event(this._handleEventChange)),{dispose:()=>{o.delete(e),o.size===0&&this._buckets.delete(t),this._count--,this._count===0&&(this._eventSubscription?.dispose(),this._eventSubscription=void 0)}}}}};function wio(a,i,e){return ui(a.filteredEvent(e),()=>i.isDirty(e))}function wjo(a){return{readOnly:!!a,readOnlyMessage:typeof a!="boolean"?a:void 0}}function Cjo(a){let i=Ji(a.editor);if(xi(a.diffEditor)){let e=Ji(a.diffEditor);e.diffCodeLens=e.codeLens,delete e.codeLens,e.diffWordWrap=e.wordWrap,delete e.wordWrap,Object.assign(i,e)}return i}var kue=class extends x{static{this.ID="workbench.contrib.multiDiffEditorResolver"}constructor(i,e){super(),this._register(i.registerEditor("*",{id:la.id,label:la.displayName,detail:la.providerDisplayName,priority:"builtin"},{},{createMultiDiffEditorInput:t=>({editor:au.fromResourceMultiDiffEditorInput(t,e)})}))}};kue=I([m(0,Ka),m(1,F)],kue);var nMt=class{canSerialize(i){return i instanceof au&&!i.isTransient}serialize(i){if(this.canSerialize(i))return JSON.stringify(i.serialize())}deserialize(i,e){try{let t=am(e);return au.fromSerialized(t,i)}catch(t){mt(t);return}}};var nn=le("terminalService"),Uu=le("terminalConfigurationService"),Fv=le("terminalEditorService"),DJ=le("terminalEditingService"),lc=le("terminalGroupService"),Nm=le("terminalInstanceService"),Wv=le("terminalChatService");var YR=a=>!Yo(a.instanceId),Eue=class extends MouseEvent{},JK="terminalEditor";var Cio=["workbench.action.terminal.focusAccessibleBuffer"];var xio={"terminal.integrated.accessibleViewPreserveCursorPosition":{markdownDescription:d(15208,null),type:"boolean",default:!1},"terminal.integrated.accessibleViewFocusOnCommandExecution":{markdownDescription:d(15207,null),type:"boolean",default:!1}};var kio={"terminal.integrated.autoReplies":{markdownDescription:d(15209,null,'`"Terminate batch job (Y/N)": "Y\\r"`','`"\\r"`'),type:"object",additionalProperties:{oneOf:[{type:"string",description:d(15210,null)},{type:"null"}]},restricted:!0,default:{}}};var Eio=D.for("terminalChatWidget"),XF=D.for("terminalChatWidget.status"),LKa=D.for("terminalChatWidget.toolbar");var Ja;(c=>(c.focused=new Y("terminalChatFocus",!1,d(15212,null)),c.visible=new Y("terminalChatVisible",!1,d(15217,null)),c.requestActive=new Y("terminalChatActiveRequest",!1,d(15214,null)),c.inputHasText=new Y("terminalChatInputHasText",!1,d(15213,null)),c.responseContainsCodeBlock=new Y("terminalChatResponseContainsCodeBlock",!1,d(15215,null)),c.responseContainsMultipleCodeBlocks=new Y("terminalChatResponseContainsMultipleCodeBlocks",!1,d(15216,null)),c.hasChatAgent=new Y("terminalChatAgentRegistered",!1,d(15211,null)),c.hasChatTerminals=new Y("hasChatTerminals",!1,d(15218,null)),c.hasHiddenChatTerminals=new Y("hasHiddenChatTerminals",!1,d(15219,null))))(Ja||={});var AKa=le("ptyService");var NB={Backend:"workbench.contributions.terminal.processBackend"},Fgi=class{constructor(){this._backends=new Map}get backends(){return this._backends}registerTerminalBackend(i){let e=this._sanitizeRemoteAuthority(i.remoteAuthority);if(this._backends.has(e))throw new Error(`A terminal backend with remote authority '${e}' was already registered.`);this._backends.set(e,i)}getTerminalBackend(i){return this._backends.get(this._sanitizeRemoteAuthority(i))}_sanitizeRemoteAuthority(i){return i?.toLowerCase()??""}};ne.add(NB.Backend,new Fgi);var rMt=le("localPtyService"),ca=le("terminalLogService");var Tio={"terminal.integrated.initialHint":{restricted:!0,markdownDescription:d(15531,null,"`#terminal.integrated.sendKeybindingsToShell#`"),type:"boolean",default:!0}};function sMt(a,i){let e=[{name:null,description:d(2404,null)}];return e.push(...a.map(t=>({name:t.profileName,description:xjo(t)}))),i&&e.push(...i.map(t=>({name:t.title,description:kjo(t)}))),{values:e.map(t=>t.name),markdownDescriptions:e.map(t=>t.description)}}function xjo(a){let i=`$(${q.isThemeIcon(a.icon)?a.icon.id:a.icon?a.icon:R.terminal.id}) ${a.profileName}
- path: ${a.path}`;return a.args&&(Fe(a.args)?i+=`
- args: "${a.args}"`:i+=`
- args: [${a.args.length===0?"":`'${a.args.join("','")}'`}]`),a.overrideName!==void 0&&(i+=`
- overrideName: ${a.overrideName}`),a.color&&(i+=`
- color: ${a.color}`),a.env&&(i+=`
- env: ${JSON.stringify(a.env)}`),i}function kjo(a){return`$(${q.isThemeIcon(a.icon)?a.icon.id:a.icon?a.icon:R.terminal.id}) ${a.title}
- extensionIdentifier: ${a.extensionIdentifier}`}function _io(a,i){if(!a&&!i)return!0;if(Fe(a)&&Fe(i))return a===i;if(Array.isArray(a)&&Array.isArray(i)){if(a.length!==i.length)return!1;for(let e=0;e<a.length;e++)if(a[e]!==i[e])return!1;return!0}return!1}function Dio(a,i){if(!a&&!i)return!0;if(!a||!i)return!1;if(q.isThemeIcon(a)&&q.isThemeIcon(i))return a.id===i.id&&a.color===i.color;if(xi(a)&&!A.isUri(a)&&!q.isThemeIcon(a)&&xi(i)&&!A.isUri(i)&&!q.isThemeIcon(i)){let e=a,t=i;if((A.isUri(e.light)||km(e.light))&&(A.isUri(e.dark)||km(e.dark))&&(A.isUri(t.light)||km(t.light))&&(A.isUri(t.dark)||km(t.dark)))return e.light.path===t.light.path&&e.dark.path===t.dark.path}if(A.isUri(a)&&A.isUri(i)||km(a)||km(i)){let e=a,t=i;return e.path===t.path&&e.scheme===t.scheme}return!1}var Ugi={type:["string","null"],enum:["terminal.ansiBlack","terminal.ansiRed","terminal.ansiGreen","terminal.ansiYellow","terminal.ansiBlue","terminal.ansiMagenta","terminal.ansiCyan","terminal.ansiWhite"],default:null},zgi={type:"string",enum:Array.from(j$(),a=>a.id),markdownEnumDescriptions:Array.from(j$(),a=>`$(${a.id})`)},LJ={args:{description:d(2388,null),type:"array",items:{type:"string"}},icon:{description:d(2391,null),...zgi},color:{description:d(2389,null),...Ugi},env:{markdownDescription:d(2390,null),type:"object",additionalProperties:{type:["string","null"]},default:{}}},Wgi={type:"object",required:["path"],properties:{path:{description:d(2399,null),type:["string","array"],items:{type:"string"}},overrideName:{description:d(2398,null),type:"boolean"},...LJ}},Vgi={type:"object",required:["path"],properties:{path:{description:d(2386,null),type:["string"],items:{type:"string"}},...LJ}};function Bgi(a){let i=a===2?"linux":a===1?"osx":"windows";return d(2383,null,u_(a),'```json\n"terminal.integrated.profile.'+i+'": {\n  "bash": null\n}\n```',"[","](https://code.visualstudio.com/docs/terminal/profiles)")}var Ejo={id:"terminal",order:100,title:d(2387,null),type:"object",properties:{"terminal.integrated.automationProfile.linux":{restricted:!0,markdownDescription:d(2374,null),type:["object","null"],default:null,anyOf:[{type:"null"},Vgi],defaultSnippets:[{body:{path:"${1}",icon:"${2}"}}]},"terminal.integrated.automationProfile.osx":{restricted:!0,markdownDescription:d(2375,null),type:["object","null"],default:null,anyOf:[{type:"null"},Vgi],defaultSnippets:[{body:{path:"${1}",icon:"${2}"}}]},"terminal.integrated.automationProfile.windows":{restricted:!0,markdownDescription:d(2376,null,"`terminal.integrated.automationShell.windows`"),type:["object","null"],default:null,anyOf:[{type:"null"},Vgi],defaultSnippets:[{body:{path:"${1}",icon:"${2}"}}]},"terminal.integrated.profiles.windows":{restricted:!0,markdownDescription:Bgi(3),type:"object",default:{PowerShell:{source:"PowerShell",icon:R.terminalPowershell.id},"Command Prompt":{path:["${env:windir}\\Sysnative\\cmd.exe","${env:windir}\\System32\\cmd.exe"],args:[],icon:R.terminalCmd.id},"Git Bash":{source:"Git Bash",icon:R.terminalGitBash.id}},additionalProperties:{anyOf:[{type:"object",required:["source"],properties:{source:{description:d(2403,null),enum:["PowerShell","Git Bash"]},...LJ}},{type:"object",required:["extensionIdentifier","id","title"],properties:{extensionIdentifier:{description:d(2401,null),type:"string"},id:{description:d(2400,null),type:"string"},title:{description:d(2402,null),type:"string"},...LJ}},{type:"null"},Wgi]}},"terminal.integrated.profiles.osx":{restricted:!0,markdownDescription:Bgi(1),type:"object",default:{bash:{path:"bash",args:["-l"],icon:R.terminalBash.id},zsh:{path:"zsh",args:["-l"]},fish:{path:"fish",args:["-l"]},tmux:{path:"tmux",icon:R.terminalTmux.id},pwsh:{path:"pwsh",icon:R.terminalPowershell.id}},additionalProperties:{anyOf:[{type:"object",required:["extensionIdentifier","id","title"],properties:{extensionIdentifier:{description:d(2396,null),type:"string"},id:{description:d(2395,null),type:"string"},title:{description:d(2397,null),type:"string"},...LJ}},{type:"null"},Wgi]}},"terminal.integrated.profiles.linux":{restricted:!0,markdownDescription:Bgi(2),type:"object",default:{bash:{path:"bash",icon:R.terminalBash.id},zsh:{path:"zsh"},fish:{path:"fish"},tmux:{path:"tmux",icon:R.terminalTmux.id},pwsh:{path:"pwsh",icon:R.terminalPowershell.id}},additionalProperties:{anyOf:[{type:"object",required:["extensionIdentifier","id","title"],properties:{extensionIdentifier:{description:d(2393,null),type:"string"},id:{description:d(2392,null),type:"string"},title:{description:d(2394,null),type:"string"},...LJ}},{type:"null"},Wgi]}},"terminal.integrated.useWslProfiles":{description:d(2385,null),type:"boolean",default:!0},"terminal.integrated.inheritEnv":{scope:1,description:d(2381,null),type:"boolean",default:!0},"terminal.integrated.persistentSessionScrollback":{scope:1,markdownDescription:d(2382,null),type:"number",default:100},"terminal.integrated.showLinkHover":{scope:1,description:d(2384,null),type:"boolean",default:!0},"terminal.integrated.ignoreProcessNames":{markdownDescription:d(2377,null,"`#terminal.integrated.confirmOnKill#`"),type:"array",items:{type:"string",uniqueItems:!0},default:["starship","oh-my-posh","bash","zsh"]}}};function Lio(){ne.as(Jt.Configuration).registerConfiguration(Ejo),Kgi()}var Hgi;function Kgi(a,i){let e=ne.as(Jt.Configuration),t;a&&(t=sMt(a?.profiles,i));let o=Hgi;Hgi={id:"terminal",order:100,title:d(2387,null),type:"object",properties:{"terminal.integrated.defaultProfile.linux":{restricted:!0,markdownDescription:d(2378,null),type:["string","null"],default:null,enum:a?.os===3?t?.values:void 0,markdownEnumDescriptions:a?.os===3?t?.markdownDescriptions:void 0},"terminal.integrated.defaultProfile.osx":{restricted:!0,markdownDescription:d(2379,null),type:["string","null"],default:null,enum:a?.os===2?t?.values:void 0,markdownEnumDescriptions:a?.os===2?t?.markdownDescriptions:void 0},"terminal.integrated.defaultProfile.windows":{restricted:!0,markdownDescription:d(2380,null),type:["string","null"],default:null,enum:a?.os===1?t?.values:void 0,markdownEnumDescriptions:a?.os===1?t?.markdownDescriptions:void 0}}},e.updateConfigurations({add:[Hgi],remove:o?[o]:[]})}var Rio={type:"boolean",enum:[!0,!1],enumDescriptions:[d(15416,null),d(15410,null)],description:d(15411,null)},Ggi={type:"object",required:["path"],properties:{path:{description:d(15439,null),type:"string"},...LJ}},L4={"chat.tools.terminal.enableAutoApprove":{description:d(15417,null),type:"boolean",default:!0,policy:{name:"ChatToolsTerminalEnableAutoApprove",category:"IntegratedTerminal",minimumVersion:"1.104",localization:{description:{key:"autoApproveMode.description",value:d(15417,null)}}}},"chat.tools.terminal.autoApprove":{markdownDescription:[d(15407,null,"`/`","`i`"),d(15409,null,"`true`","`false`","`null`"),d(15408,null,"`foo && bar`","`foo`","`bar`","`true`","`false`","`<(foo)`"),d(15394,null,"`{ approve: false, matchCommandLine: true }`"),d(15392,null,"`#chat.tools.terminal.ignoreDefaultAutoApproveRules#`","`true`"),[d(15405,null),`|${d(15406,null)}|${d(15396,null)}|`,"|---|---|",'| `"mkdir": true` | '+d(15397,null,"`mkdir`"),'| `"npm run build": true` | '+d(15398,null,"`npm run build`"),'| `"bin/test.sh": true` | '+d(15395,null,"`bin/test.sh`","`bin\\test.sh`","`./bin/test.sh`"),'| `"/^git (status\\|show\\\\b.*)$/": true` | '+d(15402,null,"`git status`","`git show`"),'| `"/^Get-ChildItem\\\\b/i": true` | '+d(15401,null,"`Get-ChildItem`"),'| `"/.*/": true` | '+d(15400,null),'| `"rm": false` | '+d(15403,null,"`rm`"),'| `"/\\\\.ps1/i": { approve: false, matchCommandLine: true }` | '+d(15399,null,'`".ps1"`'),'| `"rm": null` | '+d(15404,null,"`false`","`rm`")].join(`
`)].join(`

`),type:"object",additionalProperties:{anyOf:[Rio,{type:"object",properties:{approve:Rio,matchCommandLine:{type:"boolean",enum:[!0,!1],enumDescriptions:[d(15414,null),d(15413,null)],description:d(15412,null)}},required:["approve"]},{type:"null",description:d(15415,null)}]},default:{cd:!0,echo:!0,ls:!0,dir:!0,pwd:!0,cat:!0,head:!0,tail:!0,findstr:!0,wc:!0,tr:!0,cut:!0,cmp:!0,which:!0,basename:!0,dirname:!0,realpath:!0,readlink:!0,stat:!0,file:!0,od:!0,du:!0,df:!0,sleep:!0,nl:!0,grep:!0,"/^git(\\s+(-C\\s+\\S+|--no-pager))*\\s+status\\b/":!0,"/^git(\\s+(-C\\s+\\S+|--no-pager))*\\s+log\\b/":!0,"/^git(\\s+(-C\\s+\\S+|--no-pager))*\\s+log\\b.*\\s--output(=|\\s|$)/":!1,"/^git(\\s+(-C\\s+\\S+|--no-pager))*\\s+show\\b/":!0,"/^git(\\s+(-C\\s+\\S+|--no-pager))*\\s+diff\\b/":!0,"/^git(\\s+(-C\\s+\\S+|--no-pager))*\\s+ls-files\\b/":!0,"/^git(\\s+(-C\\s+\\S+|--no-pager))*\\s+grep\\b/":!0,"/^git(\\s+(-C\\s+\\S+|--no-pager))*\\s+branch\\b/":!0,"/^git(\\s+(-C\\s+\\S+|--no-pager))*\\s+branch\\b.*\\s-(d|D|m|M|-delete|-force)\\b/":!1,"/^docker\\s+(ps|images|info|version|inspect|logs|top|stats|port|diff|search|events)\\b/":!0,"/^docker\\s+(container|image|network|volume|context|system)\\s+(ls|ps|inspect|history|show|df|info)\\b/":!0,"/^docker\\s+compose\\s+(ps|ls|top|logs|images|config|version|port|events)\\b/":!0,"Get-ChildItem":!0,"Get-Content":!0,"Get-Date":!0,"Get-Random":!0,"Get-Location":!0,"Set-Location":!0,"Write-Host":!0,"Write-Output":!0,"Out-String":!0,"Split-Path":!0,"Join-Path":!0,"Start-Sleep":!0,"Where-Object":!0,"/^Select-[a-z0-9]/i":!0,"/^Measure-[a-z0-9]/i":!0,"/^Compare-[a-z0-9]/i":!0,"/^Format-[a-z0-9]/i":!0,"/^Sort-[a-z0-9]/i":!0,"/^npm\\s+(ls|list|outdated|view|info|show|explain|why|root|prefix|bin|search|doctor|fund|repo|bugs|docs|home|help(-search)?)\\b/":!0,"/^npm\\s+config\\s+(list|get)\\b/":!0,"/^npm\\s+pkg\\s+get\\b/":!0,"/^npm\\s+audit$/":!0,"/^npm\\s+cache\\s+verify\\b/":!0,"/^yarn\\s+(list|outdated|info|why|bin|help|versions)\\b/":!0,"/^yarn\\s+licenses\\b/":!0,"/^yarn\\s+audit\\b(?!.*\\bfix\\b)/":!0,"/^yarn\\s+config\\s+(list|get)\\b/":!0,"/^yarn\\s+cache\\s+dir\\b/":!0,"/^pnpm\\s+(ls|list|outdated|why|root|bin|doctor)\\b/":!0,"/^pnpm\\s+licenses\\b/":!0,"/^pnpm\\s+audit\\b(?!.*\\bfix\\b)/":!0,"/^pnpm\\s+config\\s+(list|get)\\b/":!0,"npm ci":!0,"/^yarn\\s+install\\s+--frozen-lockfile\\b/":!0,"/^pnpm\\s+install\\s+--frozen-lockfile\\b/":!0,column:!0,"/^column\\b.*\\s-c\\s+[0-9]{4,}/":!1,date:!0,"/^date\\b.*\\s(-s|--set)\\b/":!1,find:!0,"/^find\\b.*\\s-(delete|exec|execdir|fprint|fprintf|fls|ok|okdir)\\b/":!1,rg:!0,"/^rg\\b.*\\s(--pre|--hostname-bin)\\b/":!1,sed:!0,"/^sed\\b.*\\s(-[a-zA-Z]*(e|f)[a-zA-Z]*|--expression|--file)\\b/":!1,"/^sed\\b.*s\\/.*\\/.*\\/[ew]/":!1,"/^sed\\b.*;W/":!1,sort:!0,"/^sort\\b.*\\s-(o|S)\\b/":!1,tree:!0,"/^tree\\b.*\\s-o\\b/":!1,"/^xxd$/":!0,"/^xxd\\b(\\s+-\\S+)*\\s+[^-\\s]\\S*$/":!0,rm:!1,rmdir:!1,del:!1,"Remove-Item":!1,ri:!1,rd:!1,erase:!1,dd:!1,kill:!1,ps:!1,top:!1,"Stop-Process":!1,spps:!1,taskkill:!1,"taskkill.exe":!1,curl:!1,wget:!1,"Invoke-RestMethod":!1,"Invoke-WebRequest":!1,irm:!1,iwr:!1,chmod:!1,chown:!1,"Set-ItemProperty":!1,sp:!1,"Set-Acl":!1,jq:!1,xargs:!1,eval:!1,"Invoke-Expression":!1,iex:!1}},"chat.tools.terminal.ignoreDefaultAutoApproveRules":{type:"boolean",default:!1,tags:["experimental"],markdownDescription:d(15426,null,"`#chat.tools.terminal.autoApprove#`")},"chat.tools.terminal.autoApproveWorkspaceNpmScripts":{restricted:!0,type:"boolean",default:!0,tags:["experimental"],markdownDescription:d(15418,null)},"chat.tools.terminal.blockDetectedFileWrites":{type:"string",enum:["never","outsideWorkspace","all"],enumDescriptions:[d(15422,null),d(15423,null),d(15420,null)],default:"outsideWorkspace",tags:["experimental"],markdownDescription:d(15421,null)},"chat.tools.terminal.shellIntegrationTimeout":{markdownDescription:d(15436,null,"`#terminal.integrated.shellIntegration.enabled#`"),type:"integer",minimum:-1,maximum:6e4,default:-1,markdownDeprecationMessage:d(15435,null,"`#terminal.integrated.shellIntegration.timeout#`")},"chat.tools.terminal.idlePollInterval":{markdownDescription:d(15425,null),type:"integer",minimum:50,maximum:1e4,default:1e3},"chat.tools.terminal.terminalProfile.linux":{restricted:!0,markdownDescription:d(15437,null),type:["object","null"],default:null,anyOf:[{type:"null"},Ggi],defaultSnippets:[{body:{path:"${1}"}}]},"chat.tools.terminal.terminalProfile.osx":{restricted:!0,markdownDescription:d(15438,null),type:["object","null"],default:null,anyOf:[{type:"null"},Ggi],defaultSnippets:[{body:{path:"${1}"}}]},"chat.tools.terminal.terminalProfile.windows":{restricted:!0,markdownDescription:d(15440,null),type:["object","null"],default:null,anyOf:[{type:"null"},Ggi],defaultSnippets:[{body:{path:"${1}"}}]},"chat.tools.terminal.autoReplyToPrompts":{type:"boolean",default:!1,tags:["experimental"],markdownDescription:d(15419,null)},"chat.tools.terminal.outputLocation":{markdownDescription:d(15428,null),type:"string",enum:["terminal","chat"],enumDescriptions:[d(15429,null),d(15427,null)],default:"chat",tags:["experimental"],experiment:{mode:"auto"}},"chat.agent.sandbox":{markdownDescription:d(15375,null),type:"boolean",default:!1,tags:["preview"],restricted:!0,experiment:{mode:"auto"}},"chat.agent.sandboxNetwork.allowedDomains":{markdownDescription:d(15384,null,"`#chat.agent.sandbox#`","`*.example.com`"),type:"array",items:{type:"string"},default:[],tags:["preview"],restricted:!0},"chat.agent.sandboxNetwork.deniedDomains":{markdownDescription:d(15385,null,"`#chat.agent.sandbox#`","`#chat.agent.sandboxNetwork.allowedDomains#`"),type:"array",items:{type:"string"},default:[],tags:["preview"],restricted:!0},"chat.agent.sandboxFileSystem.linux":{markdownDescription:d(15376,null,"`#chat.agent.sandbox#`"),type:"object",properties:{denyRead:{type:"array",description:d(15378,null),items:{type:"string"},default:[]},allowWrite:{type:"array",description:d(15377,null),items:{type:"string"},default:["."]},denyWrite:{type:"array",description:d(15379,null),items:{type:"string"},default:[]}},default:{denyRead:[],allowWrite:["."],denyWrite:[]},tags:["preview"],restricted:!0},"chat.agent.sandboxFileSystem.mac":{markdownDescription:d(15380,null,"`#chat.agent.sandbox#`"),type:"object",properties:{denyRead:{type:"array",description:d(15382,null),items:{type:"string"},default:[]},allowWrite:{type:"array",description:d(15381,null),items:{type:"string"},default:["."]},denyWrite:{type:"array",description:d(15383,null),items:{type:"string"},default:[]}},default:{denyRead:[],allowWrite:["."],denyWrite:[]},tags:["preview"],restricted:!0},"chat.tools.terminal.preventShellHistory":{type:"boolean",default:!0,markdownDescription:[d(15430,null),`- \`bash\`: ${d(15431,null)}`,`- \`zsh\`: ${d(15434,null)}`,`- \`fish\`: ${d(15432,null)}`,`- \`pwsh\`: ${d(15433,null)}`].join(`
`)},"chat.tools.terminal.enforceTimeoutFromModel":{restricted:!0,type:"boolean",default:!0,tags:["experimental"],experiment:{mode:"auto"},markdownDescription:d(15424,null)}};for(let a of["chat.agent.terminal.allowList","chat.agent.terminal.denyList","github.copilot.chat.agent.terminal.allowList","github.copilot.chat.agent.terminal.denyList","chat.agent.terminal.autoApprove"])L4[a]={deprecated:!0,markdownDeprecationMessage:d(15393,null,"`#chat.tools.terminal.autoApprove#`")};L4["chat.tools.terminal.sandbox.network"]={type:"object",deprecated:!0,markdownDeprecationMessage:d(15389,null,"`#chat.agent.sandboxNetwork.allowedDomains#`","`#chat.agent.sandboxNetwork.deniedDomains#`")};L4["chat.tools.terminal.sandbox.enabled"]={type:"boolean",deprecated:!0,markdownDeprecationMessage:d(15386,null,"`#chat.agent.sandbox#`")};L4["chat.tools.terminal.sandbox.network.allowedDomains"]={type:"array",items:{type:"string"},deprecated:!0,markdownDeprecationMessage:d(15390,null,"`#chat.agent.sandboxNetwork.allowedDomains#`")};L4["chat.tools.terminal.sandbox.network.deniedDomains"]={type:"array",items:{type:"string"},deprecated:!0,markdownDeprecationMessage:d(15391,null,"`#chat.agent.sandboxNetwork.deniedDomains#`")};L4["chat.tools.terminal.sandbox.linuxFileSystem"]={type:"object",deprecated:!0,markdownDeprecationMessage:d(15387,null,"`#chat.agent.sandboxFileSystem.linux#`")};L4["chat.tools.terminal.sandbox.macFileSystem"]={type:"object",deprecated:!0,markdownDeprecationMessage:d(15388,null,"`#chat.agent.sandboxFileSystem.mac#`")};var Mio="terminal.integrated.shellIntegration",Pio={"terminal.integrated.shellIntegration.showCommandGuide":{restricted:!0,markdownDescription:d(15459,null),type:"boolean",default:!0}};var Aio=["workbench.action.terminal.focusFind","workbench.action.terminal.hideFind","workbench.action.terminal.findNext","workbench.action.terminal.findPrevious","workbench.action.terminal.toggleFindRegex","workbench.action.terminal.toggleFindWholeWord","workbench.action.terminal.toggleFindCaseSensitive","workbench.action.terminal.searchWorkspace"];var Nio=["workbench.action.terminal.goToRecentDirectory","workbench.action.terminal.runRecentCommand"];var Oio={"terminal.integrated.shellIntegration.history":{restricted:!0,markdownDescription:d(15520,null),type:"number",default:100}};var Fio={"terminal.integrated.enableNotifications":{description:d(15558,null),type:"boolean",default:!0}};var Wio={"terminal.integrated.stickyScroll.enabled":{markdownDescription:d(15602,null,"https://code.visualstudio.com/docs/terminal/shell-integration","`#terminal.integrated.shellIntegration.enabled#`"),type:"boolean",default:!0},"terminal.integrated.stickyScroll.maxLineCount":{markdownDescription:d(15604,null),type:"number",default:5,minimum:1,maximum:10},"terminal.integrated.stickyScroll.ignoredCommands":{markdownDescription:d(15603,null),type:"array",items:{type:"string"},default:["clear","cls","clear-host","copilot","claude","codex","gemini"]}};var Vio=["workbench.action.terminal.selectPrevSuggestion","workbench.action.terminal.selectPrevPageSuggestion","workbench.action.terminal.selectNextSuggestion","workbench.action.terminal.selectNextPageSuggestion","workbench.action.terminal.acceptSelectedSuggestion","workbench.action.terminal.acceptSelectedSuggestionEnter","workbench.action.terminal.hideSuggestWidget","workbench.action.terminal.triggerSuggest","workbench.action.terminal.suggestToggleDetails","workbench.action.terminal.suggestToggleDetailsFocus"];var Tjo=["exe","bat","cmd","com","msi","ps1","vbs","js","jar","py","rb","pl","sh"],ZK="terminal.integrated.suggest";function $gi(a){return typeof a=="boolean"?a?{commands:"on",arguments:"on",unknown:"off"}:{commands:"off",arguments:"off",unknown:"off"}:a}var Bio={"terminal.integrated.suggest.enabled":{restricted:!0,markdownDescription:d(15693,null,"Windows PowerShell, PowerShell v7+, zsh, bash, fish","`#terminal.integrated.shellIntegration.enabled#`"),type:"boolean",default:!0},"terminal.integrated.suggest.providers":{restricted:!0,markdownDescription:d(15701,null),type:"object",properties:{}},"terminal.integrated.suggest.quickSuggestions":{restricted:!0,markdownDescription:d(15703,null,"`#terminal.integrated.suggest.suggestOnTriggerCharacters#`"),type:"object",properties:{commands:{description:d(15705,null),type:"string",enum:["on","off"]},arguments:{description:d(15704,null),type:"string",enum:["on","off"]},unknown:{description:d(15706,null),type:"string",enum:["on","off"]}},additionalProperties:!1,default:{commands:"off",arguments:"off",unknown:"off"}},"terminal.integrated.suggest.suggestOnTriggerCharacters":{restricted:!0,markdownDescription:d(15709,null),type:"boolean",default:!1},"terminal.integrated.suggest.runOnEnter":{restricted:!0,markdownDescription:d(15707,null),enum:["never","exactMatch","exactMatchIgnoreExtension","always"],markdownEnumDescriptions:[d(15688,null),d(15686,null),d(15687,null),d(15685,null)],default:"never"},"terminal.integrated.suggest.selectionMode":{markdownDescription:d(15711,null),type:"string",enum:["partial","always","never"],markdownEnumDescriptions:[d(15714,null),d(15712,null),d(15713,null)],default:"partial"},"terminal.integrated.suggest.windowsExecutableExtensions":{restricted:!0,markdownDescription:d(15716,null,Tjo.sort().map(a=>`- ${a}`).join(`
`)),type:"object",default:{}},"terminal.integrated.suggest.showStatusBar":{restricted:!0,markdownDescription:d(15708,null),type:"boolean",default:!0},"terminal.integrated.suggest.cdPath":{restricted:!0,markdownDescription:d(15689,null),type:"string",enum:["off","relative","absolute"],markdownEnumDescriptions:[d(15691,null),d(15692,null),d(15690,null)],default:"absolute"},"terminal.integrated.suggest.inlineSuggestion":{restricted:!0,markdownDescription:d(15694,null),type:"string",enum:["off","alwaysOnTopExceptExactMatch","alwaysOnTop"],markdownEnumDescriptions:[d(15697,null),d(15696,null),d(15695,null)],default:"alwaysOnTop"},"terminal.integrated.suggest.upArrowNavigatesHistory":{restricted:!0,markdownDescription:d(15710,null),type:"boolean",default:!0},"terminal.integrated.suggest.insertTrailingSpace":{restricted:!0,markdownDescription:d(15698,null),type:"boolean",default:!1}},qgi;function jgi(a){let i=qgi;a??=new Map,a.has("lsp")||a.set("lsp",{id:"lsp",description:d(15699,null)});let e={};for(let n of Array.from(a.keys()).sort())e[n]={type:"boolean",default:n!=="lsp",description:a.get(n)?.description??d(15700,null,n)};let t={};for(let n in e)t[n]=e[n].default;qgi={id:"terminalSuggestProviders",order:100,title:d(15715,null),type:"object",properties:{"terminal.integrated.suggest.providers":{restricted:!0,markdownDescription:d(15702,null),type:"object",properties:e,default:t,tags:["preview"],additionalProperties:!1}}},ne.as(Jt.Configuration).updateConfigurations({add:[qgi],remove:i?[i]:[]})}jgi();var Qgi=["vim","vi","nano","tmux"];var Hio={"terminal.integrated.localEchoLatencyThreshold":{description:d(15722,null),type:"integer",minimum:-1,default:30,tags:["preview"]},"terminal.integrated.localEchoEnabled":{markdownDescription:d(15717,null,"`#terminal.integrated.localEchoLatencyThreshold#`"),type:"string",enum:["on","off","auto"],enumDescriptions:[d(15720,null),d(15719,null),d(15718,null)],default:"off",tags:["preview"]},"terminal.integrated.localEchoExcludePrograms":{description:d(15721,null),type:"array",items:{type:"string",uniqueItems:!0},default:Qgi,tags:["preview"]},"terminal.integrated.localEchoStyle":{description:d(15723,null),default:"dim",anyOf:[{enum:["bold","dim","italic","underlined","inverted","#ff0000"]},{type:"string",format:"color-hex"}],tags:["preview"]}};var Uio={"terminal.integrated.mouseWheelZoom":{markdownDescription:Ze?d(15739,null):d(15738,null),type:"boolean",default:!1}};var Ow=(c=>(c[c.A11yFocusAccessibleBuffer="workbench.action.terminal.focusAccessibleBuffer"]="A11yFocusAccessibleBuffer",c[c.DeveloperRestartPtyHost="workbench.action.terminal.restartPtyHost"]="DeveloperRestartPtyHost",c[c.OpenTerminalSettingsLink="workbench.action.terminal.chat.openTerminalSettingsLink"]="OpenTerminalSettingsLink",c[c.DisableSessionAutoApproval="workbench.action.terminal.chat.disableSessionAutoApproval"]="DisableSessionAutoApproval",c[c.FocusMostRecentChatTerminalOutput="workbench.action.terminal.chat.focusMostRecentChatTerminalOutput"]="FocusMostRecentChatTerminalOutput",c[c.FocusMostRecentChatTerminal="workbench.action.terminal.chat.focusMostRecentChatTerminal"]="FocusMostRecentChatTerminal",c[c.ToggleChatTerminalOutput="workbench.action.terminal.chat.toggleChatTerminalOutput"]="ToggleChatTerminalOutput",c[c.FocusChatInstanceAction="workbench.action.terminal.chat.focusChatInstance"]="FocusChatInstanceAction",c[c.ContinueInBackground="workbench.action.terminal.chat.continueInBackground"]="ContinueInBackground",c))(Ow||{}),jl=(S=>(S[S.StickyScrollEnabled="terminal.integrated.stickyScroll.enabled"]="StickyScrollEnabled",S[S.SuggestEnabled="terminal.integrated.suggest.enabled"]="SuggestEnabled",S[S.AutoApprove="chat.tools.terminal.autoApprove"]="AutoApprove",S[S.EnableAutoApprove="chat.tools.terminal.enableAutoApprove"]="EnableAutoApprove",S[S.ShellIntegrationTimeout="chat.tools.terminal.shellIntegrationTimeout"]="ShellIntegrationTimeout",S[S.OutputLocation="chat.tools.terminal.outputLocation"]="OutputLocation",S[S.AgentSandboxEnabled="chat.agent.sandbox"]="AgentSandboxEnabled",S[S.DeprecatedTerminalSandboxNetwork="chat.tools.terminal.sandbox.network"]="DeprecatedTerminalSandboxNetwork",S[S.DeprecatedTerminalSandboxEnabled="chat.tools.terminal.sandbox.enabled"]="DeprecatedTerminalSandboxEnabled",S[S.DeprecatedTerminalSandboxNetworkAllowedDomains="chat.tools.terminal.sandbox.network.allowedDomains"]="DeprecatedTerminalSandboxNetworkAllowedDomains",S[S.DeprecatedTerminalSandboxNetworkDeniedDomains="chat.tools.terminal.sandbox.network.deniedDomains"]="DeprecatedTerminalSandboxNetworkDeniedDomains",S[S.DeprecatedTerminalSandboxLinuxFileSystem="chat.tools.terminal.sandbox.linuxFileSystem"]="DeprecatedTerminalSandboxLinuxFileSystem",S[S.DeprecatedTerminalSandboxMacFileSystem="chat.tools.terminal.sandbox.macFileSystem"]="DeprecatedTerminalSandboxMacFileSystem",S[S.AgentSandboxNetworkAllowedDomains="chat.agent.sandboxNetwork.allowedDomains"]="AgentSandboxNetworkAllowedDomains",S[S.AgentSandboxNetworkDeniedDomains="chat.agent.sandboxNetwork.deniedDomains"]="AgentSandboxNetworkDeniedDomains",S[S.AgentSandboxLinuxFileSystem="chat.agent.sandboxFileSystem.linux"]="AgentSandboxLinuxFileSystem",S[S.AgentSandboxMacFileSystem="chat.agent.sandboxFileSystem.mac"]="AgentSandboxMacFileSystem",S))(jl||{}),Tue=(e=>(e[e.ChatHasTerminals="hasChatTerminals"]="ChatHasTerminals",e[e.ChatHasHiddenTerminals="hasHiddenChatTerminals"]="ChatHasHiddenTerminals",e))(Tue||{}),Kio={...xio,...kio,...L4,...Tio,...Pio,...Oio,...Fio,...Wio,...Bio,...Hio,...Uio},Gio=[...Cio,...Aio,...Nio,...Vio];var Sc="terminal";var Vv="terminal.integrated",aMt=0,qio=-5,lMt=fn?1.1:1,r7e=1,s7e=1e3,$io="normal",jio="bold",Xgi=["normal","bold","100","200","300","400","500","600","700","800","900"],Ag=le("terminalProfileResolverService");var vy=le("terminalProfileService"),Qio=a=>typeof a.write=="function";var cMt=["workbench.action.terminal.clearSelection","workbench.action.terminal.clear","workbench.action.terminal.copyAndClearSelection","workbench.action.terminal.copySelection","workbench.action.terminal.copySelectionAsHtml","workbench.action.terminal.copyLastCommand","workbench.action.terminal.copyLastCommandOutput","workbench.action.terminal.copyLastCommandAndLastCommandOutput","workbench.action.terminal.deleteToLineStart","workbench.action.terminal.deleteWordLeft","workbench.action.terminal.deleteWordRight","workbench.action.terminal.focusNextPane","workbench.action.terminal.focusNext","workbench.action.terminal.focusPreviousPane","workbench.action.terminal.focusPrevious","workbench.action.terminal.focus","workbench.action.terminal.sizeToContentWidth","workbench.action.terminal.kill","workbench.action.terminal.killEditor","workbench.action.terminal.moveToEditor","workbench.action.terminal.moveToLineEnd","workbench.action.terminal.moveToLineStart","workbench.action.terminal.moveToTerminalPanel","workbench.action.terminal.newInActiveWorkspace","workbench.action.terminal.new","workbench.action.terminal.newInNewWindow","workbench.action.terminal.paste","workbench.action.terminal.pasteSelection","workbench.action.terminal.resizePaneDown","workbench.action.terminal.resizePaneLeft","workbench.action.terminal.resizePaneRight","workbench.action.terminal.resizePaneUp","workbench.action.terminal.runActiveFile","workbench.action.terminal.runSelectedText","workbench.action.terminal.scrollDown","workbench.action.terminal.scrollDownPage","workbench.action.terminal.scrollToBottom","workbench.action.terminal.scrollToNextCommand","workbench.action.terminal.scrollToPreviousCommand","workbench.action.terminal.scrollToTop","workbench.action.terminal.scrollUp","workbench.action.terminal.scrollUpPage","workbench.action.terminal.sendSequence","workbench.action.terminal.selectAll","workbench.action.terminal.selectToNextCommand","workbench.action.terminal.selectToNextLine","workbench.action.terminal.selectToPreviousCommand","workbench.action.terminal.selectToPreviousLine","workbench.action.terminal.splitInActiveWorkspace","workbench.action.terminal.split","workbench.action.terminal.toggleTerminal","workbench.action.terminal.focusHover","editor.action.accessibilityHelp","workbench.action.terminal.stopVoice","workbench.action.terminal.sendSignal","workbench.action.tasks.rerunForActiveTerminal","editor.action.toggleTabFocusMode","notifications.hideList","notifications.hideToasts","workbench.action.closeQuickOpen","workbench.action.quickOpen","workbench.action.quickOpenPreviousEditor","workbench.action.showCommands","workbench.action.tasks.build","workbench.action.tasks.restartTask","workbench.action.tasks.runTask","workbench.action.tasks.reRunTask","workbench.action.tasks.showLog","workbench.action.tasks.showTasks","workbench.action.tasks.terminate","workbench.action.tasks.test","workbench.action.toggleFullScreen","workbench.action.terminal.focusAtIndex1","workbench.action.terminal.focusAtIndex2","workbench.action.terminal.focusAtIndex3","workbench.action.terminal.focusAtIndex4","workbench.action.terminal.focusAtIndex5","workbench.action.terminal.focusAtIndex6","workbench.action.terminal.focusAtIndex7","workbench.action.terminal.focusAtIndex8","workbench.action.terminal.focusAtIndex9","workbench.action.focusSecondEditorGroup","workbench.action.focusThirdEditorGroup","workbench.action.focusFourthEditorGroup","workbench.action.focusFifthEditorGroup","workbench.action.focusSixthEditorGroup","workbench.action.focusSeventhEditorGroup","workbench.action.focusEighthEditorGroup","workbench.action.focusNextPart","workbench.action.focusPreviousPart","workbench.action.nextPanelView","workbench.action.previousPanelView","workbench.action.nextSideBarView","workbench.action.previousSideBarView","workbench.action.debug.disconnect","workbench.action.debug.start","workbench.action.debug.stop","workbench.action.debug.run","workbench.action.debug.restart","workbench.action.debug.continue","workbench.action.debug.pause","workbench.action.debug.stepInto","workbench.action.debug.stepOut","workbench.action.debug.stepOver","workbench.action.nextEditor","workbench.action.previousEditor","workbench.action.nextEditorInGroup","workbench.action.previousEditorInGroup","workbench.action.openNextRecentlyUsedEditor","workbench.action.openPreviousRecentlyUsedEditor","workbench.action.openNextRecentlyUsedEditorInGroup","workbench.action.openPreviousRecentlyUsedEditorInGroup","workbench.action.quickOpenPreviousRecentlyUsedEditor","workbench.action.quickOpenLeastRecentlyUsedEditor","workbench.action.quickOpenPreviousRecentlyUsedEditorInGroup","workbench.action.quickOpenLeastRecentlyUsedEditorInGroup","workbench.action.focusActiveEditorGroup","workbench.action.focusFirstEditorGroup","workbench.action.focusLastEditorGroup","workbench.action.firstEditorInGroup","workbench.action.lastEditorInGroup","workbench.action.navigateUp","workbench.action.navigateDown","workbench.action.navigateRight","workbench.action.navigateLeft","workbench.action.togglePanel","workbench.action.quickOpenView","workbench.action.toggleMaximizedPanel","workbench.action.zoomIn","workbench.action.zoomOut","workbench.action.zoomReset","notification.acceptPrimaryAction","runCommands","workbench.action.terminal.chat.start","workbench.action.terminal.chat.close","workbench.action.terminal.chat.discard","workbench.action.terminal.chat.makeRequest","workbench.action.terminal.chat.cancel","workbench.action.terminal.chat.feedbackHelpful","workbench.action.terminal.chat.feedbackUnhelpful","workbench.action.terminal.chat.feedbackReportIssue","workbench.action.terminal.chat.runCommand","workbench.action.terminal.chat.insertCommand","workbench.action.terminal.chat.viewInChat",...Gio],Yio={extensionPoint:"terminal",defaultExtensionKind:["workspace"],activationEventsGenerator:function*(a){for(let i of a)for(let e of i.profiles??[])yield`onTerminalProfile:${e.id}`},jsonSchema:{description:d(14939,null),type:"object",properties:{profiles:{type:"array",description:d(14942,null),items:{type:"object",required:["id","title"],defaultSnippets:[{body:{id:"$1",title:"$2"}}],properties:{id:{description:d(14943,null),type:"string"},title:{description:d(14944,null),type:"string"},icon:{description:d(14946,null),anyOf:[{type:"string"},{type:"object",properties:{light:{description:d(14948,null),type:"string"},dark:{description:d(14947,null),type:"string"}}}]},titleTemplate:{description:d(14945,null),type:"string"}}}},completionProviders:{type:"array",description:d(14940,null),items:{type:"object",required:["id"],defaultSnippets:[{body:{id:"$1",description:"$2"}}],properties:{description:{description:d(14941,null),type:"string"}}}}}}};var CS=[],RJ=te("terminal.background",null,d(14950,null)),Xio=te("terminal.foreground",{light:"#333333",dark:"#CCCCCC",hcDark:"#FFFFFF",hcLight:"#292929"},d(14957,null)),Jio=te("terminalCursor.foreground",null,d(14967,null)),Zio=te("terminalCursor.background",null,d(14966,null)),$Te=te("terminal.selectionBackground",Sv,d(14960,null)),eoo=te("terminal.inactiveSelectionBackground",{light:ai($Te,.5),dark:ai($Te,.5),hcDark:ai($Te,.7),hcLight:ai($Te,.5)},d(14959,null)),too=te("terminal.selectionForeground",{light:null,dark:null,hcDark:"#000000",hcLight:"#ffffff"},d(14961,null)),ioo=te("terminalCommandDecoration.defaultBackground",{light:"#00000040",dark:"#ffffff40",hcDark:"#ffffff80",hcLight:"#00000040"},d(14963,null)),ooo=te("terminalCommandDecoration.successBackground",{dark:"#1B81A8",light:"#2090D3",hcDark:"#1B81A8",hcLight:"#007100"},d(14965,null)),noo=te("terminalCommandDecoration.errorBackground",{dark:"#F14C4C",light:"#E51400",hcDark:"#F14C4C",hcLight:"#B5200D"},d(14964,null)),uMt=te("terminalOverviewRuler.cursorForeground","#A0A0A0CC",d(14970,null)),cGa=te("terminal.border",vf,d(14951,null)),roo=te("terminalOverviewRuler.border",Qbt,d(14969,null)),soo=te("terminal.findMatchBackground",{dark:lle,light:lle,hcDark:null,hcLight:"#0F4A85"},d(14953,null),!0),dGa=te("terminal.hoverHighlightBackground",ai(Pvt,.5),d(14958,null)),aoo=te("terminal.findMatchBorder",{dark:null,light:null,hcDark:"#f38518",hcLight:"#0F4A85"},d(14954,null)),loo=te("terminal.findMatchHighlightBackground",{dark:rS,light:rS,hcDark:null,hcLight:null},d(14955,null),!0),coo=te("terminal.findMatchHighlightBorder",{dark:null,light:null,hcDark:"#f38518",hcLight:"#0F4A85"},d(14956,null)),doo=te("terminalOverviewRuler.findMatchForeground",{dark:EO,light:EO,hcDark:"#f38518",hcLight:"#0F4A85"},d(14971,null)),uGa=te("terminal.dropBackground",oT,d(14952,null),!0),pGa=te("terminal.tab.activeBorder",yEe,d(14962,null)),mGa=te("terminal.initialHintForeground",{dark:"#ffffff56",light:"#0007",hcDark:null,hcLight:null},d(14968,null)),dMt={"terminal.ansiBlack":{index:0,defaults:{light:"#000000",dark:"#000000",hcDark:"#000000",hcLight:"#292929"}},"terminal.ansiRed":{index:1,defaults:{light:"#cd3131",dark:"#cd3131",hcDark:"#cd0000",hcLight:"#cd3131"}},"terminal.ansiGreen":{index:2,defaults:{light:"#107C10",dark:"#0DBC79",hcDark:"#00cd00",hcLight:"#136C13"}},"terminal.ansiYellow":{index:3,defaults:{light:"#949800",dark:"#e5e510",hcDark:"#cdcd00",hcLight:"#949800"}},"terminal.ansiBlue":{index:4,defaults:{light:"#0451a5",dark:"#2472c8",hcDark:"#0000ee",hcLight:"#0451a5"}},"terminal.ansiMagenta":{index:5,defaults:{light:"#bc05bc",dark:"#bc3fbc",hcDark:"#cd00cd",hcLight:"#bc05bc"}},"terminal.ansiCyan":{index:6,defaults:{light:"#0598bc",dark:"#11a8cd",hcDark:"#00cdcd",hcLight:"#0598bc"}},"terminal.ansiWhite":{index:7,defaults:{light:"#555555",dark:"#e5e5e5",hcDark:"#e5e5e5",hcLight:"#555555"}},"terminal.ansiBrightBlack":{index:8,defaults:{light:"#666666",dark:"#666666",hcDark:"#7f7f7f",hcLight:"#666666"}},"terminal.ansiBrightRed":{index:9,defaults:{light:"#cd3131",dark:"#f14c4c",hcDark:"#ff0000",hcLight:"#cd3131"}},"terminal.ansiBrightGreen":{index:10,defaults:{light:"#14CE14",dark:"#23d18b",hcDark:"#00ff00",hcLight:"#00bc00"}},"terminal.ansiBrightYellow":{index:11,defaults:{light:"#b5ba00",dark:"#f5f543",hcDark:"#ffff00",hcLight:"#b5ba00"}},"terminal.ansiBrightBlue":{index:12,defaults:{light:"#0451a5",dark:"#3b8eea",hcDark:"#5c5cff",hcLight:"#0451a5"}},"terminal.ansiBrightMagenta":{index:13,defaults:{light:"#bc05bc",dark:"#d670d6",hcDark:"#ff00ff",hcLight:"#bc05bc"}},"terminal.ansiBrightCyan":{index:14,defaults:{light:"#0598bc",dark:"#29b8db",hcDark:"#00ffff",hcLight:"#0598bc"}},"terminal.ansiBrightWhite":{index:15,defaults:{light:"#a5a5a5",dark:"#e5e5e5",hcDark:"#ffffff",hcLight:"#a5a5a5"}}};function uoo(){for(let a in dMt){let i=dMt[a],e=a.substring(13);CS[i.index]=te(a,i.defaults,d(14949,null,e))}}function by(a){let i;if(Fe(a)?i=a:a.color?i=a.color.replace(/\./g,"_"):q.isThemeIcon(a.icon)&&a.icon.color&&(i=a.icon.color.id.replace(/\./g,"_")),i)return`terminal-icon-${i.replace(/\./g,"_")}`}function pMt(a){let i=[];for(let e in dMt)a.getColor(e)&&!e.toLowerCase().includes("bright")&&i.push(e);return i}function jTe(a){let i=new N,e=pMt(a),t=Cr(void 0,void 0,i),o="";for(let n of e){let r=by(n),s=a.getColor(n);s&&(o+=`.monaco-workbench .${r} .codicon:first-child:not(.codicon-split-horizontal):not(.codicon-trashcan):not(.file-icon){ color: ${s} !important; }`)}return t.textContent=o,i}function poo(a,i){let e=pMt(a),t="";for(let o of e){let n=by(o),r=a.getColor(o);r&&(i?t+=`.monaco-workbench .show-file-icons .predefined-file-icon.terminal-tab.${n}::before,.monaco-workbench .show-file-icons .file-icon.terminal-tab.${n}::before{ color: ${r} !important; }`:t+=`.monaco-workbench .${n} .codicon:first-child:not(.codicon-split-horizontal):not(.codicon-trashcan):not(.file-icon){ color: ${r} !important; }`)}return t}function SD(a,i,e){let t=a.icon;if(!t)return;let o=[],n;if(e){if(Fe(t)&&(t.startsWith("$(")||mw().getIcon(t)))return o;Fe(t)&&(n=A.parse(t))}if(A.isUri(t)?n=t:!q.isThemeIcon(t)&&!Fe(t)&&(n=Bp(i)?t.dark:t.light),n instanceof A){let s=`terminal-uri-icon-${_r(n.path).toString(36)}`;o.push(s),o.push("terminal-uri-icon")}return o}function MJ(a,i){return Fe(i.icon)?i.icon:q.isThemeIcon(i.icon)?i.icon.id:a.get(Ag).getDefaultIcon().id}var dt;(xe=>(xe.isOpen=new Y("terminalIsOpen",!1,!0),xe.focus=new Y("terminalFocus",!1,d(15140,null)),xe.focusInAny=new Y("terminalFocusInAny",!1,d(15141,null)),xe.editorFocus=new Y("terminalEditorFocus",!1,d(15139,null)),xe.count=new Y("terminalCount",0,d(15138,null)),xe.groupCount=new Y("terminalGroupCount",0,!0),xe.tabsNarrow=new Y("isTerminalTabsNarrow",!1,!0),xe.terminalHasFixedWidth=new Y("terminalHasFixedWidth",!1,!0),xe.tabsFocus=new Y("terminalTabsFocus",!1,d(15146,null)),xe.webExtensionContributedProfile=new Y("terminalWebExtensionContributedProfile",!1,!0),xe.terminalHasBeenCreated=new Y("terminalHasBeenCreated",!1,!0),xe.terminalEditorActive=new Y("terminalEditorActive",!1,!0),xe.tabsMouse=new Y("terminalTabsMouse",!1,!0),xe.shellType=new Y("terminalShellType",void 0,{type:"string",description:d(15144,null)}),xe.altBufferActive=new Y("terminalAltBufferActive",!1,d(15137,null)),xe.suggestWidgetVisible=new Y("terminalSuggestWidgetVisible",!1,d(15145,null)),xe.notFocus=xe.focus.toNegated(),xe.viewShowing=new Y("terminalViewShowing",!1,d(15150,null)),xe.textSelected=new Y("terminalTextSelected",!1,d(15148,null)),xe.textSelectedInFocused=new Y("terminalTextSelectedInFocused",!1,d(15149,null)),xe.notTextSelected=xe.textSelected.toNegated(),xe.findVisible=new Y("terminalFindVisible",!1,!0),xe.notFindVisible=xe.findVisible.toNegated(),xe.findInputFocus=new Y("terminalFindInputFocused",!1,!0),xe.findFocus=new Y("terminalFindFocused",!1,!0),xe.notFindFocus=xe.findInputFocus.toNegated(),xe.processSupported=new Y("terminalProcessSupported",!1,d(15142,null)),xe.tabsSingularSelection=new Y("terminalTabsSingularSelection",!1,d(15147,null)),xe.splitTerminalTabFocused=new Y("terminalSplitTerminal",!1,d(15135,null)),xe.splitTerminalActive=new Y("terminalSplitPaneActive",!1,d(15136,null)),xe.inTerminalRunCommandPicker=new Y("inTerminalRunCommandPicker",!1,d(15134,null)),xe.terminalShellIntegrationEnabled=new Y("terminalShellIntegrationEnabled",!1,d(15143,null)),xe.terminalDictationInProgress=new Y("terminalDictationInProgress",!1),xe.shouldShowViewInlineActions=C.and(C.equals("view",Sc),C.notEquals("config.terminal.integrated.tabs.hideCondition","never"),C.not(Tue.ChatHasHiddenTerminals),C.or(C.not("config.terminal.integrated.tabs.enabled"),C.and(C.equals("config.terminal.integrated.tabs.showActions","singleTerminal"),C.equals("terminalGroupCount",1)),C.and(C.equals("config.terminal.integrated.tabs.showActions","singleTerminalOrNarrow"),C.or(C.equals("terminalGroupCount",1),C.has("isTerminalTabsNarrow"))),C.and(C.equals("config.terminal.integrated.tabs.showActions","singleGroup"),C.equals("terminalGroupCount",1)),C.equals("config.terminal.integrated.tabs.showActions","always")))))(dt||={});var xf=class extends ls{constructor(e,t,o,n,r,s,l,c,u){super();this.resource=e;this._terminalInstance=t;this._themeService=o;this._terminalInstanceService=n;this._instantiationService=r;this._configurationService=s;this._lifecycleService=l;this._contextKeyService=c;this._dialogService=u;this.closeHandler=this;this._isDetached=!1;this._isShuttingDown=!1;this._isReverted=!1;this._onDidRequestAttach=this._register(new E);this.onDidRequestAttach=this._onDidRequestAttach.event;this._terminalEditorFocusContextKey=dt.editorFocus.bindTo(c),t&&this._setupInstanceListeners()}static{this.ID="workbench.editors.terminal"}setGroup(e){this._group=e,e?.scopedContextKeyService&&this._terminalInstance?.setParentContextKeyService(e.scopedContextKeyService)}get group(){return this._group}get typeId(){return xf.ID}get editorId(){return JK}get capabilities(){return 1218}setTerminalInstance(e){if(this._terminalInstance)throw new Error("cannot set instance that has already been set");this._terminalInstance=e,this._setupInstanceListeners()}copy(){let e=this._terminalInstanceService.createInstance(this._copyLaunchConfig||{},2);return e.focusWhenReady(),this._copyLaunchConfig=void 0,this._instantiationService.createInstance(xf,e.resource,e)}setCopyLaunchConfig(e){this._copyLaunchConfig=e}get terminalInstance(){return this._isDetached?void 0:this._terminalInstance}showConfirm(){if(this._isReverted)return!1;let e=this._configurationService.getValue("terminal.integrated.confirmOnKill");return(e==="editor"||e==="always")&&this._terminalInstance?.hasChildProcesses||!1}async confirm(e){let{confirmed:t}=await this._dialogService.confirm({type:bt.Warning,message:d(14797,null),primaryButton:d(14795,null),detail:e.length>1?e.map(o=>o.editor.getName()).join(`
`)+`

`+d(14798,null):d(14796,null)});return t?1:2}async revert(){this._isReverted=!0}_setupInstanceListeners(){let e=this._terminalInstance;if(!e)return;let t=e.onDidFocus(()=>this._terminalEditorFocusContextKey.set(!0)),o=e.onDidBlur(()=>this._terminalEditorFocusContextKey.reset()),n=[e.onExit(r=>{e.waitOnExit||this.dispose()}),e.onDisposed(()=>this.dispose()),e.onTitleChanged(()=>this._onDidChangeLabel.fire()),e.onIconChanged(()=>this._onDidChangeLabel.fire()),t,o,e.statusList.onDidChangePrimaryStatus(()=>this._onDidChangeLabel.fire())];this._register(Z(()=>{!this._isDetached&&!this._isShuttingDown&&e.dispose(3),Be(n),Be([t,o])})),this._register(this._lifecycleService.onWillShutdown(r=>{this._isShuttingDown=!0,Be(n),this._configurationService.getValue("terminal.integrated.enablePersistentSessions")&&r.reason===3?e.detachProcessAndDispose(1):e.dispose(1)}))}getName(){return this._terminalInstance?.title||this.resource.fragment}getIcon(){if(!(!this._terminalInstance||!q.isThemeIcon(this._terminalInstance.icon)))return this._terminalInstance.icon}getLabelExtraClasses(){if(!this._terminalInstance)return[];let e=["terminal-tab","predefined-file-icon"],t=by(this._terminalInstance);t&&e.push(t);let o=SD(this._terminalInstance,this._themeService.getColorTheme().type);return o&&e.push(...o),e}detachInstance(){this._isShuttingDown||(this._terminalInstance?.detachFromElement(),this._terminalInstance?.setParentContextKeyService(this._contextKeyService),this._isDetached=!0)}getDescription(){return this._terminalInstance?.description}toUntyped(){return{resource:this.resource,options:{override:JK,pinned:!0,forceReload:!0}}}canReopen(){return!1}};xf=I([m(2,Le),m(3,Nm),m(4,F),m(5,B),m(6,ji),m(7,X),m(8,at)],xf);var mMt=class{constructor(i,e,t,o,n){this._editorGroupsService=e;this._configurationService=t;this._logService=o;this._dispoables=new N;this._tabGroupModel=[];this._groupLookup=new Map;this._tabInfoLookup=new Map;this._multiDiffEditorInputListeners=new Vt;this._proxy=i.getProxy(to.ExtHostEditorTabs),this._dispoables.add(n.onDidEditorsChange(r=>{try{this._updateTabsModel(r)}catch{this._logService.error("Failed to update model, rebuilding"),this._createTabsModel()}})),this._dispoables.add(this._multiDiffEditorInputListeners),this._dispoables.add(this._editorGroupsService.onDidAddGroup(()=>this._createTabsModel())),this._dispoables.add(this._editorGroupsService.onDidRemoveGroup(()=>this._createTabsModel())),this._editorGroupsService.whenReady.then(()=>this._createTabsModel())}dispose(){this._groupLookup.clear(),this._tabInfoLookup.clear(),this._dispoables.dispose()}_buildTabObject(i,e,t){let o=e.editorId;return{id:this._generateTabId(e,i.id),label:e.getName(),editorId:o,input:this._editorInputToDto(e),isPinned:i.isSticky(t),isPreview:!i.isPinned(t),isActive:i.isActive(e),isDirty:e.isDirty()}}_editorInputToDto(i){if(i instanceof Eb)return{kind:3,base:i.base,input1:i.input1.uri,input2:i.input2.uri,result:i.resource};if(i instanceof Ck)return{kind:1,uri:i.resource};if(i instanceof Ma&&!(i instanceof Pa)){let e=i.primary.resource,t=i.secondary.resource;return i.primary instanceof Ck&&i.secondary instanceof Ck&&Qe(e,t)&&e&&t?{kind:1,uri:e}:{kind:0}}if(i instanceof Ra)return{kind:4,notebookType:i.viewType,uri:i.resource};if(i instanceof gm)return{kind:6,viewType:i.viewType,uri:i.resource};if(i instanceof Hu)return{kind:7,viewType:i.viewType};if(i instanceof xf)return{kind:8};if(i instanceof Pa){if(i.modified instanceof Ck&&i.original instanceof Ck)return{kind:2,modified:i.modified.resource,original:i.original.resource};if(i.modified instanceof Ra&&i.original instanceof Ra)return{kind:5,notebookType:i.original.viewType,modified:i.modified.resource,original:i.original.resource}}if(i instanceof Cf)return{kind:9,uri:i.resource,inputBoxUri:i.inputResource};if(i instanceof Na)return{kind:10};if(i instanceof au){let e=[];for(let t of i?.resources.get()??[])t.originalUri&&t.modifiedUri&&e.push({kind:2,original:t.originalUri,modified:t.modifiedUri});return{kind:11,diffEditors:e}}return{kind:0}}_generateTabId(i,e){let t,o=po.getCanonicalUri(i,{supportSideBySide:3});return o instanceof A?t=o.toString():t=`${o?.primary?.toString()}-${o?.secondary?.toString()}`,`${e}~${i.editorId}-${i.typeId}-${t} `}_onDidGroupActivate(){let i=this._editorGroupsService.activeGroup.id,e=this._groupLookup.get(i);e&&(e.isActive=!0,this._proxy.$acceptTabGroupUpdate(e))}_onDidTabLabelChange(i,e,t){let o=this._generateTabId(e,i),n=this._tabInfoLookup.get(o);n?(n.tab.label=e.getName(),this._proxy.$acceptTabOperation({groupId:i,index:t,tabDto:n.tab,kind:2})):(this._logService.error("Invalid model for label change, rebuilding"),this._createTabsModel())}_onDidTabOpen(i,e,t){let o=this._editorGroupsService.getGroup(i),n=this._groupLookup.get(i)!==void 0;if(!o||!n){this._createTabsModel();return}let r=this._groupLookup.get(i)?.tabs;if(!r)return;let s=this._buildTabObject(o,e,t);r.splice(t,0,s);let l=this._generateTabId(e,i);this._tabInfoLookup.set(l,{group:o,editorInput:e,tab:s}),e instanceof au&&this._multiDiffEditorInputListeners.set(e,U.fromObservableLight(e.resources)(()=>{let c=this._tabInfoLookup.get(l);c&&(c.tab=this._buildTabObject(o,e,t),this._proxy.$acceptTabOperation({groupId:i,index:t,tabDto:c.tab,kind:2}))})),this._proxy.$acceptTabOperation({groupId:i,index:t,tabDto:s,kind:0})}_onDidTabClose(i,e){let t=this._editorGroupsService.getGroup(i),o=this._groupLookup.get(i)?.tabs;if(!t||!o){this._createTabsModel();return}let n=o.splice(e,1);n.length!==0&&(this._tabInfoLookup.delete(n[0]?.id??""),n[0]?.input instanceof au&&this._multiDiffEditorInputListeners.deleteAndDispose(n[0]?.input),this._proxy.$acceptTabOperation({groupId:i,index:e,tabDto:n[0],kind:1}))}_onDidTabActiveChange(i,e){let t=this._groupLookup.get(i)?.tabs;if(!t)return;let o=t[e];o.isActive=!0,this._proxy.$acceptTabOperation({groupId:i,index:e,tabDto:o,kind:2})}_onDidTabDirty(i,e,t){let o=this._generateTabId(t,i),n=this._tabInfoLookup.get(o);if(!n){this._logService.error("Invalid model for dirty change, rebuilding"),this._createTabsModel();return}n.tab.isDirty=t.isDirty(),this._proxy.$acceptTabOperation({groupId:i,index:e,tabDto:n.tab,kind:2})}_onDidTabPinChange(i,e,t){let o=this._generateTabId(t,i),n=this._tabInfoLookup.get(o),r=n?.group,s=n?.tab;if(!r||!s){this._logService.error("Invalid model for sticky change, rebuilding"),this._createTabsModel();return}s.isPinned=r.isSticky(e),this._proxy.$acceptTabOperation({groupId:i,index:e,tabDto:s,kind:2})}_onDidTabPreviewChange(i,e,t){let o=this._generateTabId(t,i),n=this._tabInfoLookup.get(o),r=n?.group,s=n?.tab;if(!r||!s){this._logService.error("Invalid model for sticky change, rebuilding"),this._createTabsModel();return}s.isPreview=!r.isPinned(e),this._proxy.$acceptTabOperation({kind:2,groupId:i,tabDto:s,index:e})}_onDidTabMove(i,e,t,o){let n=this._groupLookup.get(i)?.tabs;if(!n){this._logService.error("Invalid model for move change, rebuilding"),this._createTabsModel();return}let r=n.splice(t,1);r.length!==0&&(n.splice(e,0,r[0]),this._proxy.$acceptTabOperation({kind:3,groupId:i,tabDto:r[0],index:e,oldIndex:t}))}_createTabsModel(){if(this._editorGroupsService.groups.length===0)return;this._tabGroupModel=[],this._groupLookup.clear(),this._tabInfoLookup.clear();let i=[];for(let e of this._editorGroupsService.groups){let t={groupId:e.id,isActive:e.id===this._editorGroupsService.activeGroup.id,viewColumn:GC(this._editorGroupsService,e),tabs:[]};e.editors.forEach((o,n)=>{let r=this._buildTabObject(e,o,n);i.push(r),this._tabInfoLookup.set(this._generateTabId(o,e.id),{group:e,tab:r,editorInput:o})}),t.tabs=i,this._tabGroupModel.push(t),this._groupLookup.set(e.id,t),i=[]}this._proxy.$acceptEditorTabModel(this._tabGroupModel)}_updateTabsModel(i){let e=i.event,t=i.groupId;switch(e.kind){case 0:if(t===this._editorGroupsService.activeGroup.id){this._onDidGroupActivate();break}else return;case 9:if(e.editor!==void 0&&e.editorIndex!==void 0){this._onDidTabLabelChange(t,e.editor,e.editorIndex);break}case 5:if(e.editor!==void 0&&e.editorIndex!==void 0){this._onDidTabOpen(t,e.editor,e.editorIndex);break}case 6:if(e.editorIndex!==void 0){this._onDidTabClose(t,e.editorIndex);break}case 8:if(e.editorIndex!==void 0){this._onDidTabActiveChange(t,e.editorIndex);break}case 14:if(e.editorIndex!==void 0&&e.editor!==void 0){this._onDidTabDirty(t,e.editorIndex,e.editor);break}case 13:if(e.editorIndex!==void 0&&e.editor!==void 0){this._onDidTabPinChange(t,e.editorIndex,e.editor);break}case 11:if(e.editorIndex!==void 0&&e.editor!==void 0){this._onDidTabPreviewChange(t,e.editorIndex,e.editor);break}case 12:break;case 7:if(tio(e)&&e.editor&&e.editorIndex!==void 0&&e.oldEditorIndex!==void 0){this._onDidTabMove(t,e.editorIndex,e.oldEditorIndex,e.editor);break}default:this._createTabsModel()}}$moveTab(i,e,t,o){let n=wk(this._editorGroupsService,this._configurationService,t),r=this._tabInfoLookup.get(i);if(!r?.tab)throw new Error(`Attempted to close tab with id ${i} which does not exist`);let l,c=this._editorGroupsService.getGroup(r.group.id);if(!c)return;if(this._groupLookup.get(n)===void 0){let p=3;t===In&&(p=uy(this._configurationService)),l=this._editorGroupsService.addGroup(this._editorGroupsService.groups[this._editorGroupsService.groups.length-1],p)}else l=this._editorGroupsService.getGroup(n);if(!l)return;(e<0||e>l.editors.length)&&(e=l.editors.length);let u=r?.editorInput;u&&c.moveEditor(u,l,{index:e,preserveFocus:o})}async $closeTab(i,e){let t=new Map;for(let n of i){let r=this._tabInfoLookup.get(n),s=r?.tab,l=r?.group,c=r?.editorInput;if(!l||!s||!r||!c)continue;let u=t.get(l);u?u.push(c):t.set(l,[c])}let o=[];for(let[n,r]of t)o.push(await n.closeEditors(r,{preserveFocus:e}));return o.every(n=>n)}async $closeGroup(i,e){let t=[];for(let o of i){let n=this._editorGroupsService.getGroup(o);n&&(t.push(await n.closeAllEditors()),n.count===0&&this._editorGroupsService.getGroup(n.id)&&this._editorGroupsService.removeGroup(n))}return t.every(o=>o)}};mMt=I([fo(qi.MainThreadEditorTabs),m(1,wt),m(2,B),m(3,se),m(4,ee)],mMt);var hMt=class{dispose(){}$onUnexpectedError(i){i?.$isError&&(i=T9(i)),mt(i)}};hMt=I([fo(qi.MainThreadErrors)],hMt);var pg="workbench.view.extensions",M4=L(10700,"Extensions");var Hi=le("extensionsWorkbenchService");var Fw="extensions.autoUpdate",c7e="extensions.autoCheckUpdates",moo="extensions.closeExtensionDetailsOnViewChange",OB="extensions.autoRestart",PJ=class extends x{constructor(e,t){super();this.containers=e;this._register(t.onChange(this.update,this))}set extension(e){this.containers.forEach(t=>t.extension=e)}update(e){for(let t of this.containers)e&&t.extension?Ut(t.extension.identifier,e.identifier)&&(t.extension.server&&e.server&&t.extension.server!==e.server?t.updateWhenCounterExtensionChanges&&t.update():t.extension=e):t.update()}};PJ=I([m(1,Hi)],PJ);var QTe="workbench.views.extensions.workspaceRecommendations",gMt="workbench.views.extensions.searchOutdated",fMt="workbench.extensions.action.toggleIgnoreExtension",vMt="workbench.extensions.action.installVSIX",d7e="workbench.extensions.command.installFromVSIX",FB="workbench.extensions.action.listWorkspaceUnsupportedExtensions",QC=new Y("defaultExtensionViews",!0),bMt=new Y("hasOutdatedExtensions",!1),kh=new Y("hasGallery",!1),AJ=new Y("extensionsGalleryStatus","unavailable"),hoo=new Y("extensionResultListFocused ",!0),u7e=new Y("searchMcpServers",!1),SMt=new Y("searchAgentPlugins",!1),YTe="_theme_",NJ="0_install",p7e="0_update",m7e=new D("extensionsSearchActionsMenu"),mg=new D("extensionsFilterSubMenu");function bA(a){if(a===null)return"None";switch(a){case 1:return"LocalProcess";case 2:return"LocalWebWorker";case 3:return"Remote"}}function foo(a){switch(a){case 0:return"None";case 1:return"Local";case 2:return"Remote"}}function voo(a,i,e,t){let o=goo(a,e),n=goo(i,e),r=new Map,s=c=>{if(r.has(c.key))return;let u=o.get(c.key)||null,p=n.get(c.key)||null,h=new Zgi(u,p);r.set(h.key,h)};o.forEach(c=>s(c)),n.forEach(c=>s(c));let l=new Map;return r.forEach(c=>{let u=!!c.local,p=!!c.remote,h=!!(c.local&&c.local.isUnderDevelopment),g=!!(c.remote&&c.remote.isUnderDevelopment),f=0;h&&!g?f=1:g&&!h&&(f=2),l.set(c.key,t(c.identifier,c.kind,u,p,f))}),l}function goo(a,i){let e=new Map;return a.forEach(t=>{let o=new Jgi(t,i(t));e.set(o.key,o)}),e}var Jgi=class{constructor(i,e){this.desc=i;this.kind=e}get key(){return Ii.toKey(this.desc.identifier)}get isUnderDevelopment(){return this.desc.isUnderDevelopment}},Zgi=class{constructor(i,e){this.local=i;this.remote=e}get key(){return this.local?this.local.key:this.remote.key}get identifier(){return this.local?this.local.desc.identifier:this.remote.desc.identifier}get kind(){return this.local?this.local.kind:this.remote.kind}};var boo={Uninitialized:{type:"uninitialized"},Disabled:a=>({type:"disabled",reason:a}),Idle:(a,i,e)=>({type:"idle",updateType:a,error:i,notAvailable:e}),CheckingForUpdates:a=>({type:"checking for updates",explicit:a}),AvailableForDownload:(a,i)=>({type:"available for download",update:a,canInstall:i}),Downloading:(a,i,e,t,o,n)=>({type:"downloading",update:a,explicit:i,overwrite:e,downloadedBytes:t,totalBytes:o,startTime:n}),Downloaded:(a,i,e)=>({type:"downloaded",update:a,explicit:i,overwrite:e}),Updating:(a,i,e)=>({type:"updating",update:a,currentProgress:i,maxProgress:e}),Ready:(a,i,e)=>({type:"ready",update:a,explicit:i,overwrite:e}),Overwriting:(a,i)=>({type:"overwriting",update:a,explicit:i})},zd=le("updateService");var IMt=class a{static{this._workerIdPool=0}createWorkerClient(i){let e,t=++a._workerIdPool;return i instanceof Worker||Rjo(i)?e=Promise.resolve(i):e=this._createWorker(i),new svt(new efi(e,t))}_createWorker(i){let e=this.getWorkerUrl(i),t=Djo(i.label,e,this._getWorkerLoadingFailedErrorMessage(i)),o=new Worker(yMt?yMt.createScriptURL(t):t,{name:i.label,type:"module"});return Ljo(o)}_getWorkerLoadingFailedErrorMessage(i){}getWorkerUrl(i){if(!i.esmModuleLocation)throw new Error("Missing esmModuleLocation in WebWorkerDescriptor");return(typeof i.esmModuleLocation=="function"?i.esmModuleLocation():i.esmModuleLocation).toString(!0)}},yMt=(()=>{let a=globalThis;return typeof self=="object"&&self.constructor&&self.constructor.name==="DedicatedWorkerGlobalScope"&&a.workerttPolicy!==void 0?a.workerttPolicy:pf("defaultWorkerFactory",{createScriptURL:i=>i})})();function Soo(a,i){if(!a.startsWith("blob:"))throw new URIError("Not a blob-url: "+a);return new Worker(yMt?yMt.createScriptURL(a):a,{...i,type:"module"})}function Djo(a,i,e){if(!(/^((http:)|(https:)|(file:))/.test(i)&&i.substring(0,globalThis.origin.length)!==globalThis.origin)){let o=i.lastIndexOf("?"),n=i.lastIndexOf("#",o),r=o>0?new URLSearchParams(i.substring(o+1,~n?n:void 0)):new URLSearchParams;Jse.addSearchParam(r,!0,!0),r.toString()?i=`${i}?${r.toString()}#${a}`:i=`${i}#${a}`}let t=new Blob([di([`/*${a}*/`,`globalThis._VSCODE_NLS_MESSAGES = ${JSON.stringify(t$e())};`,`globalThis._VSCODE_NLS_LANGUAGE = ${JSON.stringify(Pse())};`,`globalThis._VSCODE_FILE_ROOT = ${JSON.stringify(globalThis._VSCODE_FILE_ROOT)};`,"const ttPolicy = globalThis.trustedTypes?.createPolicy('defaultWorkerFactory', { createScriptURL: value => value });","globalThis.workerttPolicy = ttPolicy;",e?"try {":"",`await import(ttPolicy?.createScriptURL(${JSON.stringify(i)}) ?? ${JSON.stringify(i)});`,e?`} catch (err) { console.error(${JSON.stringify(e)}, err); throw err; }`:"","globalThis.postMessage({ type: 'vscode-worker-ready' });",`/*${a}*/`]).join("")],{type:"application/javascript"});return URL.createObjectURL(t)}function Ljo(a){return new Promise((i,e)=>{a.onmessage=function(t){t.data.type==="vscode-worker-ready"&&(a.onmessage=null,i(a))},a.onerror=e})}function Rjo(a){return!!a&&typeof a.then=="function"}var efi=class extends x{constructor(e,t){super();this._onMessage=this._register(new E);this.onMessage=this._onMessage.event;this._onError=this._register(new E);this.onError=this._onError.event;this.id=t,this.worker=e,this.postMessage("-please-ignore-",[]);let o=n=>{this._onError.fire(n)};this.worker.then(n=>{n.onmessage=r=>{this._onMessage.fire(r.data)},n.onmessageerror=r=>{this._onError.fire(r)},typeof n.addEventListener=="function"&&n.addEventListener("error",o)}),this._register(Z(()=>{this.worker?.then(n=>{n.onmessage=null,n.onmessageerror=null,n.removeEventListener("error",o),n.terminate()}),this.worker=null}))}getId(){return this.id}postMessage(e,t){this.worker?.then(o=>{try{o.postMessage(e,t)}catch(n){mt(n),mt(new Error("FAILED to post message to worker",{cause:n}))}})}};var YC=le("timerService"),tfi=class{constructor(){this._entries=[]}setMarks(i,e){this._entries.push([i,e])}getDuration(i,e){let t=this._findEntry(i);if(!t)return 0;let o=this._findEntry(e);return o?o.startTime-t.startTime:0}getStartTime(i){let e=this._findEntry(i);return e?e.startTime:-1}_findEntry(i){for(let[,e]of this._entries)for(let t=e.length-1;t>=0;t--)if(e[t].name===i)return e[t]}getEntries(){return this._entries.slice(0)}},XTe=class{constructor(i,e,t,o,n,r,s,l,c){this._lifecycleService=i;this._contextService=e;this._extensionService=t;this._updateService=o;this._paneCompositeService=n;this._editorService=r;this._accessibilityService=s;this._telemetryService=l;this._barrier=new gp;this._marks=new tfi;this._rndValueShouldSendTelemetry=Math.random()<.03;Promise.all([this._extensionService.whenInstalledExtensionsRegistered(),i.when(3),c.whenRestored,Promise.all(Array.from(ne.as(NB.Backend).backends.values()).map(u=>u.whenReady))]).then(()=>(this.setPerformanceMarks("renderer",F6i()),this._computeStartupMetrics())).then(u=>{this._startupMetrics=u,this._reportStartupTimes(u),this._barrier.open()}),this.perfBaseline=this._barrier.wait().then(()=>this._lifecycleService.when(4)).then(()=>Li(this._startupMetrics.timers.ellapsedRequire)).then(()=>{let u=(function(){let f=!1;function v(y){return f?0:(performance.now()-b>=1e3&&(f=!0),y<=2?y:v(y-1)+v(y-2))}let b=performance.now();v(24);let S=Math.round(performance.now()-b);self.postMessage({value:f?-1:S})}).toString(),p=new Blob([`(${u})();`],{type:"application/javascript"}),h=URL.createObjectURL(p),g=Soo(h,{name:"perfBaseline"});return new Promise(f=>{g.onmessage=v=>f(v.data.value)}).finally(()=>{g.terminate(),URL.revokeObjectURL(h)})})}whenReady(){return this._barrier.wait()}get startupMetrics(){if(!this._startupMetrics)throw new Error("illegal state, MUST NOT access startupMetrics before whenReady has resolved");return this._startupMetrics}setPerformanceMarks(i,e){let t=e.filter(o=>o.name.startsWith("code/"));this._marks.setMarks(i,t),this._reportPerformanceMarks(i,t)}getPerformanceMarks(){return this._marks.getEntries()}getDuration(i,e){return this._marks.getDuration(i,e)}getStartTime(i){return this._marks.getStartTime(i)}_reportStartupTimes(i){this._telemetryService.publicLog("startupTimeVaried",i)}_shouldReportPerfMarks(){return this._rndValueShouldSendTelemetry}_reportPerformanceMarks(i,e){if(this._shouldReportPerfMarks())for(let t of e)this._telemetryService.publicLog2("startup.timer.mark",{source:i,name:new sg(t.name),startTime:t.startTime})}async _computeStartupMetrics(){let i=this._isInitialStartup(),e;Wt?e="code/timeOrigin":e=i?"code/didStartMain":"code/willOpenNewWindow";let t=this._paneCompositeService.getActivePaneComposite(0),o=this._paneCompositeService.getActivePaneComposite(2),n=this._paneCompositeService.getActivePaneComposite(1),r={ellapsed:this._marks.getDuration(e,"code/didStartWorkbench"),isLatestVersion:!!await this._updateService.isLatestVersion(),didUseCachedData:this._didUseCachedData(),windowKind:this._lifecycleService.startupKind,windowCount:await this._getWindowCount(),viewletId:t?.getId(),auxiliaryViewletId:o?.getId(),editorIds:this._editorService.visibleEditors.map(s=>s.typeId),panelId:n?n.getId():void 0,timers:{ellapsedAppReady:i?this._marks.getDuration("code/didStartMain","code/mainAppReady"):void 0,ellapsedNlsGeneration:i?this._marks.getDuration("code/willGenerateNls","code/didGenerateNls"):void 0,ellapsedLoadMainBundle:i?this._marks.getDuration("code/willLoadMainBundle","code/didLoadMainBundle"):void 0,ellapsedRunMainBundle:i?this._marks.getDuration("code/didStartMain","code/didRunMainBundle"):void 0,ellapsedCrashReporter:i?this._marks.getDuration("code/willStartCrashReporter","code/didStartCrashReporter"):void 0,ellapsedMainServer:i?this._marks.getDuration("code/willStartMainServer","code/didStartMainServer"):void 0,ellapsedWindowCreate:i?this._marks.getDuration("code/willCreateCodeWindow","code/didCreateCodeWindow"):void 0,ellapsedWindowRestoreState:i?this._marks.getDuration("code/willRestoreCodeWindowState","code/didRestoreCodeWindowState"):void 0,ellapsedBrowserWindowCreate:i?this._marks.getDuration("code/willCreateCodeBrowserWindow","code/didCreateCodeBrowserWindow"):void 0,ellapsedWindowMaximize:i?this._marks.getDuration("code/willMaximizeCodeWindow","code/didMaximizeCodeWindow"):void 0,ellapsedWindowLoad:i?this._marks.getDuration("code/mainAppReady","code/willOpenNewWindow"):void 0,ellapsedWindowLoadToRequire:this._marks.getDuration("code/willOpenNewWindow","code/willLoadWorkbenchMain"),ellapsedRequire:this._marks.getDuration("code/willLoadWorkbenchMain","code/didLoadWorkbenchMain"),ellapsedWaitForWindowConfig:this._marks.getDuration("code/willWaitForWindowConfig","code/didWaitForWindowConfig"),ellapsedStorageInit:this._marks.getDuration("code/willInitStorage","code/didInitStorage"),ellapsedSharedProcesConnected:this._marks.getDuration("code/willConnectSharedProcess","code/didConnectSharedProcess"),ellapsedWorkspaceServiceInit:this._marks.getDuration("code/willInitWorkspaceService","code/didInitWorkspaceService"),ellapsedRequiredUserDataInit:this._marks.getDuration("code/willInitRequiredUserData","code/didInitRequiredUserData"),ellapsedOtherUserDataInit:this._marks.getDuration("code/willInitOtherUserData","code/didInitOtherUserData"),ellapsedExtensions:this._marks.getDuration("code/willLoadExtensions","code/didLoadExtensions"),ellapsedEditorRestore:this._marks.getDuration("code/willRestoreEditors","code/didRestoreEditors"),ellapsedViewletRestore:this._marks.getDuration("code/willRestoreViewlet","code/didRestoreViewlet"),ellapsedAuxiliaryViewletRestore:this._marks.getDuration("code/willRestoreAuxiliaryBar","code/didRestoreAuxiliaryBar"),ellapsedPanelRestore:this._marks.getDuration("code/willRestorePanel","code/didRestorePanel"),ellapsedWorkbenchContributions:this._marks.getDuration("code/willCreateWorkbenchContributions/1","code/didCreateWorkbenchContributions/2"),ellapsedWorkbench:this._marks.getDuration("code/willStartWorkbench","code/didStartWorkbench"),ellapsedExtensionsReady:this._marks.getDuration(e,"code/didLoadExtensions"),ellapsedRenderer:this._marks.getDuration("code/didStartRenderer","code/didStartWorkbench")},platform:void 0,release:void 0,arch:void 0,totalmem:void 0,freemem:void 0,meminfo:void 0,cpus:void 0,loadavg:void 0,isVMLikelyhood:void 0,initialStartup:i,hasAccessibilitySupport:this._accessibilityService.isScreenReaderOptimized(),emptyWorkbench:this._contextService.getWorkbenchState()===1};return await this._extendStartupInfo(r),r}};XTe=I([m(0,ji),m(1,Pe),m(2,lt),m(3,zd),m(4,us),m(5,ee),m(6,Oi),m(7,Te),m(8,yi)],XTe);var wMt=class{constructor(i,e,t,o,n,r,s,l,c){this._extensionService=e;this._notificationService=t;this._extensionsWorkbenchService=o;this._hostService=n;this._extensionEnablementService=r;this._timerService=s;this._commandService=l;this._environmentService=c;this._extensionHostKind=i.extensionHostKind;let u=i;this._internalExtensionService=u.internalExtensionService,u._setExtensionHostProxy(new ifi(i.getProxy(to.ExtHostExtensionService))),u._setAllMainProxyIdentifiers(Object.keys(qi).map(p=>qi[p]))}dispose(){}$getExtension(i){return this._extensionService.getExtension(i)}$activateExtension(i,e){return this._internalExtensionService._activateById(i,e)}async $onWillActivateExtension(i){this._internalExtensionService._onWillActivateExtension(i)}$onDidActivateExtension(i,e,t,o,n){this._internalExtensionService._onDidActivateExtension(i,e,t,o,n)}$onExtensionRuntimeError(i,e){let t=T9(e);this._internalExtensionService._onExtensionRuntimeError(i,t),console.error(`[${i.value}]${t.message}`),console.error(t.stack)}async $onExtensionActivationError(i,e,t){let o=T9(e);if(this._internalExtensionService._onDidActivateExtensionError(i,o),t){let r=await this._extensionService.getExtension(i.value);if(r){let l=(await this._extensionsWorkbenchService.queryLocal()).find(c=>Ut(c.identifier,{id:t.dependency}));if(l?.local){await this._handleMissingInstalledDependency(r,l.local);return}else{await this._handleMissingNotInstalledDependency(r,t.dependency);return}}}if(!this._environmentService.isBuilt||this._environmentService.isExtensionDevelopment){this._notificationService.error(o);return}console.error(o.message)}async _handleMissingInstalledDependency(i,e){let t=i.displayName||i.name;if(this._extensionEnablementService.isEnabled(e))this._notificationService.notify({severity:bt.Error,message:d(3308,null,t,e.manifest.displayName||e.manifest.name),actions:{primary:[ii({id:"reload",label:d(3307,null),run:()=>this._hostService.reload()})]}});else{let o=this._extensionEnablementService.getEnablementState(e);o===5?this._notificationService.notify({severity:bt.Error,message:d(3306,null,t,e.manifest.displayName||e.manifest.name)}):o===0?this._notificationService.notify({severity:bt.Error,message:d(3309,null,t,e.manifest.displayName||e.manifest.name),actions:{primary:[ii({id:"manageWorkspaceTrust",label:d(3305,null),run:()=>this._commandService.executeCommand("workbench.trust.manage")})]}}):this._extensionEnablementService.canChangeEnablement(e)?this._notificationService.notify({severity:bt.Error,message:d(3301,null,t,e.manifest.displayName||e.manifest.name),actions:{primary:[ii({id:"enable",label:d(3303,null),enabled:!0,run:()=>this._extensionEnablementService.setEnablement([e],o===10?12:13).then(()=>this._hostService.reload(),n=>this._notificationService.error(n))})]}}):this._notificationService.notify({severity:bt.Error,message:d(3302,null,t,e.manifest.displayName||e.manifest.name)})}}async _handleMissingNotInstalledDependency(i,e){let t=i.displayName||i.name,o=null;try{o=(await this._extensionsWorkbenchService.getExtensions([{id:e}],Se.None))[0]}catch{}o?this._notificationService.notify({severity:bt.Error,message:d(3310,null,t,o.displayName,o.publisherDisplayName),actions:{primary:[ii({id:"install",label:d(3304,null),run:()=>this._extensionsWorkbenchService.install(o).then(()=>this._hostService.reload(),n=>this._notificationService.error(n))})]}}):this._notificationService.error(d(3311,null,t,e))}async $setPerformanceMarks(i){this._extensionHostKind===1?this._timerService.setPerformanceMarks("localExtHost",i):this._extensionHostKind===2?this._timerService.setPerformanceMarks("workerExtHost",i):this._timerService.setPerformanceMarks("remoteExtHost",i)}async $asBrowserUri(i){return vn.uriToBrowserUri(A.revive(i))}};wMt=I([fo(qi.MainThreadExtensionService),m(1,lt),m(2,Ne),m(3,Hi),m(4,Zt),m(5,Js),m(6,YC),m(7,ge),m(8,At)],wMt);var ifi=class{constructor(i){this._actual=i}async resolveAuthority(i,e){return Mjo(await this._actual.$resolveAuthority(i,e))}async getCanonicalURI(i,e){let t=await this._actual.$getCanonicalURI(i,e);return t&&A.revive(t)}startExtensionHost(i){return this._actual.$startExtensionHost(i)}extensionTestsExecute(){return this._actual.$extensionTestsExecute()}activateByEvent(i,e){return this._actual.$activateByEvent(i,e)}activate(i,e){return this._actual.$activate(i,e)}setRemoteEnvironment(i){return this._actual.$setRemoteEnvironment(i)}updateRemoteConnectionData(i){return this._actual.$updateRemoteConnectionData(i)}deltaExtensions(i){return this._actual.$deltaExtensions(i)}test_latency(i){return this._actual.$test_latency(i)}test_up(i){return this._actual.$test_up(i)}test_down(i){return this._actual.$test_down(i)}};function Mjo(a){return a.type==="ok"?{type:"ok",value:{...a.value,authority:Pjo(a.value.authority)}}:a}function Pjo(a){return{...a,connectTo:Ajo(a.connectTo)}}function Ajo(a){return a.type===0?new zTt(a.host,a.port):new UTt(a.id)}var ID=class{constructor(i,e){this._fileService=e;this._fileProvider=new Vt;this._disposables=new N;this._proxy=i.getProxy(to.ExtHostFileSystem);let t=i.getProxy(to.ExtHostFileSystemInfo);for(let o of e.listCapabilities())t.$acceptProviderInfos(A.from({scheme:o.scheme,path:"/dummy"}),o.capabilities);this._disposables.add(e.onDidChangeFileSystemProviderRegistrations(o=>t.$acceptProviderInfos(A.from({scheme:o.scheme,path:"/dummy"}),o.provider?.capabilities??null))),this._disposables.add(e.onDidChangeFileSystemProviderCapabilities(o=>t.$acceptProviderInfos(A.from({scheme:o.scheme,path:"/dummy"}),o.provider.capabilities)))}dispose(){this._disposables.dispose(),this._fileProvider.dispose()}async $registerFileSystemProvider(i,e,t,o){this._fileProvider.set(i,new ofi(this._fileService,e,t,o,i,this._proxy))}$unregisterProvider(i){this._fileProvider.deleteAndDispose(i)}$onFileSystemChange(i,e){let t=this._fileProvider.get(i);if(!t)throw new Error("Unknown file provider");t.$onFileSystemChange(e)}async $stat(i){try{let e=await this._fileService.stat(A.revive(i));return{ctime:e.ctime,mtime:e.mtime,size:e.size,permissions:e.readonly?1:void 0,type:ID._asFileType(e)}}catch(e){return ID._handleError(e)}}async $readdir(i){try{let e=await this._fileService.resolve(A.revive(i),{resolveMetadata:!1});if(!e.isDirectory){let t=new Error(e.name);throw t.name="EntryNotADirectory",t}return e.children?e.children.map(t=>[t.name,ID._asFileType(t)]):[]}catch(e){return ID._handleError(e)}}static _asFileType(i){let e=0;return i.isFile?e+=1:i.isDirectory&&(e+=2),i.isSymbolicLink&&(e+=64),e}async $readFile(i){try{return(await this._fileService.readFile(A.revive(i))).value}catch(e){return ID._handleError(e)}}async $writeFile(i,e){try{await this._fileService.writeFile(A.revive(i),e)}catch(t){return ID._handleError(t)}}async $rename(i,e,t){try{await this._fileService.move(A.revive(i),A.revive(e),t.overwrite)}catch(o){return ID._handleError(o)}}async $copy(i,e,t){try{await this._fileService.copy(A.revive(i),A.revive(e),t.overwrite)}catch(o){return ID._handleError(o)}}async $mkdir(i){try{await this._fileService.createFolder(A.revive(i))}catch(e){return ID._handleError(e)}}async $delete(i,e){try{return await this._fileService.del(A.revive(i),e)}catch(t){return ID._handleError(t)}}static _handleError(i){if(i instanceof ta)switch(i.fileOperationResult){case 1:i.name="EntryNotFound";break;case 0:i.name="EntryIsADirectory";break;case 6:i.name="NoPermissions";break;case 4:i.name="EntryExists";break}else if(i instanceof Error){let e=Ile(i);e!=="Unknown"&&(i.name=e)}throw i}$ensureActivation(i){return this._fileService.activateProvider(i)}};ID=I([fo(qi.MainThreadFileSystem),m(1,fe)],ID);var ofi=class a{constructor(i,e,t,o,n,r){this.readOnlyMessage=o;this._handle=n;this._proxy=r;this._onDidChange=new E;this.onDidChangeFile=this._onDidChange.event;this.onDidChangeCapabilities=U.None;this.capabilities=t,this._registration=i.registerProvider(e,this)}dispose(){this._registration.dispose(),this._onDidChange.dispose()}watch(i,e){let t=Math.random();return this._proxy.$watch(this._handle,t,i,e),Z(()=>{this._proxy.$unwatch(this._handle,t)})}$onFileSystemChange(i){this._onDidChange.fire(i.map(a._createFileChange))}static _createFileChange(i){return{resource:A.revive(i.resource),type:i.type}}async stat(i){try{return await this._proxy.$stat(this._handle,i)}catch(e){throw e}}async readFile(i){return(await this._proxy.$readFile(this._handle,i)).buffer}writeFile(i,e,t){return this._proxy.$writeFile(this._handle,i,qe.wrap(e),t)}delete(i,e){return this._proxy.$delete(this._handle,i,e)}mkdir(i){return this._proxy.$mkdir(this._handle,i)}readdir(i){return this._proxy.$readdir(this._handle,i)}rename(i,e,t){return this._proxy.$rename(this._handle,i,e,t)}copy(i,e,t){return this._proxy.$copy(this._handle,i,e,t)}open(i,e){return this._proxy.$open(this._handle,i,e)}close(i){return this._proxy.$close(this._handle,i)}async read(i,e,t,o,n){let r=await this._proxy.$read(this._handle,i,e,n);return t.set(r.buffer,o),r.byteLength}write(i,e,t,o,n){return this._proxy.$write(this._handle,i,e,qe.wrap(t).slice(o,o+n))}};var A4=class{constructor(i,e,t,o,n,r,s,l,c,u,p){this._fileService=e;this._logService=p;this._listener=new N;this._watches=new Vt;this._proxy=i.getProxy(to.ExtHostFileSystemEventService),this._listener.add(e.onDidFilesChange(f=>{this._proxy.$onFileEvent({created:f.rawAdded,changed:f.rawUpdated,deleted:f.rawDeleted})}));let h=this,g=new class{async participate(f,v,b,S,y){if(b?.isUndoing)return;let w=new Ye(y),k=setTimeout(()=>w.cancel(),S),T=await n.withProgress({location:15,title:this._progressLabel(v),cancellable:!0,delay:Math.min(S/2,3e3)},()=>{let V=h._proxy.$onWillRunFileOperation(v,f,S,w.token);return Va(V,w.token)},()=>{w.cancel()}).finally(()=>{w.dispose(),clearTimeout(k)});if(!T||T.edit.edits.length===0)return;let P=T.edit.edits.some(V=>V.metadata?.needsConfirmation),O=s.getBoolean(A4.MementoKeyAdditionalEdits,0);if(c.extensionTestsLocationURI&&(O=!1),O===void 0){let V;if(T.extensionNames.length===1?v===0?V=d(3314,null,T.extensionNames[0]):v===3?V=d(3313,null,T.extensionNames[0]):v===2?V=d(3316,null,T.extensionNames[0]):V=d(3315,null,T.extensionNames[0]):v===0?V=d(3318,null,T.extensionNames.length):v===3?V=d(3317,null,T.extensionNames.length):v===2?V=d(3320,null,T.extensionNames.length):V=d(3319,null,T.extensionNames.length),P){let{confirmed:H}=await r.confirm({type:bt.Info,message:V,primaryButton:d(3329,null),cancelButton:d(3321,null)});if(O=!0,!H)return}else{let H;(oe=>(oe[oe.OK=0]="OK",oe[oe.Preview=1]="Preview",oe[oe.Cancel=2]="Cancel"))(H||={});let{result:G,checkboxChecked:$}=await r.prompt({type:bt.Info,message:V,buttons:[{label:d(3328,null),run:()=>0},{label:d(3329,null),run:()=>1}],cancelButton:{label:d(3321,null),run:()=>2},checkbox:{label:d(3312,null)}});if(G===2)return;O=G===1,$&&s.store(A4.MementoKeyAdditionalEdits,O,0,0)}}l.info("[onWill-handler] applying additional workspace edit from extensions",T.extensionNames),await o.apply(yB(T.edit,u),{undoRedoGroupId:b?.undoRedoGroupId,showPreview:O})}_progressLabel(f){switch(f){case 0:return d(3324,null);case 2:return d(3326,null);case 3:return d(3323,null);case 1:return d(3325,null);case 4:return d(3327,null)}}};this._listener.add(t.addFileOperationParticipant(g)),this._listener.add(t.onDidRunWorkingCopyFileOperation(f=>this._proxy.$onDidRunFileOperation(f.operation,f.files)))}async $watch(i,e,t,o,n){let r=A.revive(t);await this._fileService.canHandleResource(r)||this._logService.warn(`MainThreadFileSystemEventService#$watch(): cannot watch resource as its scheme is not handled by the file service (extension: ${i}, path: ${r.toString(!0)})`);let l={...o};if(l.recursive)try{(await this._fileService.stat(r)).isDirectory||(l.recursive=!1)}catch{}if(n&&!l.recursive){this._logService.trace(`MainThreadFileSystemEventService#$watch(): request to start watching correlated (extension: ${i}, path: ${r.toString(!0)}, recursive: ${l.recursive}, session: ${e}, excludes: ${JSON.stringify(l.excludes)}, includes: ${JSON.stringify(l.includes)})`);let c=new N,u=c.add(this._fileService.createWatcher(r,{...l,recursive:!1}));c.add(u.onDidChange(p=>{this._proxy.$onFileEvent({session:e,created:p.rawAdded,changed:p.rawUpdated,deleted:p.rawDeleted})})),this._watches.set(e,c)}else{this._logService.trace(`MainThreadFileSystemEventService#$watch(): request to start watching uncorrelated (extension: ${i}, path: ${r.toString(!0)}, recursive: ${l.recursive}, session: ${e}, excludes: ${JSON.stringify(l.excludes)}, includes: ${JSON.stringify(l.includes)})`);let c=this._fileService.watch(r,l);this._watches.set(e,c)}}$unwatch(i){this._watches.has(i)&&(this._logService.trace(`MainThreadFileSystemEventService#$unwatch(): request to stop watching (session: ${i})`),this._watches.deleteAndDispose(i))}dispose(){this._listener.dispose(),this._watches.dispose()}};A4.MementoKeyAdditionalEdits="file.particpants.additionalEdits",A4=I([fo(qi.MainThreadFileSystemEventService),m(1,fe),m(2,qp),m(3,La),m(4,Fo),m(5,at),m(6,ce),m(7,se),m(8,Eo),m(9,ht),m(10,se)],A4);W(class extends K{constructor(){super({id:"files.participants.resetChoice",title:{value:d(3322,null),original:"Reset choice for 'File operation needs preview'"},f1:!0})}run(i){i.get(ce).remove(A4.MementoKeyAdditionalEdits,0)}});var gT=Symbol("unset"),SA=class{constructor(){this.root=new f7e;this._size=0}get size(){return this._size}get nodes(){return this.root.children?.values()||vt.empty()}get entries(){return this.root.children?.entries()||vt.empty()}insert(i,e,t){this.opNode(i,o=>o._value=e,t)}mutate(i,e){this.opNode(i,t=>t._value=e(t._value===gT?void 0:t._value))}mutatePath(i,e){this.opNode(i,()=>{},t=>e(t))}delete(i){let e=this.getPathToKey(i);if(!e)return;let t=e.length-1,o=e[t].node._value;if(o!==gT){for(this._size--,e[t].node._value=gT;t>0;t--){let{node:n,part:r}=e[t];if(n.children?.size||n._value!==gT)break;e[t-1].node.children.delete(r)}return o}}*deleteRecursive(i){let e=this.getPathToKey(i);if(!e)return;let t=e[e.length-1].node;for(let o=e.length-1;o>0;o--){let n=e[o-1];if(n.node.children.delete(e[o].part),n.node.children.size>0||n.node._value!==gT)break}for(let o of Ioo(t))o._value!==gT&&(this._size--,yield o._value);t===this.root&&(this.root._value=gT,this.root.children=void 0)}find(i){let e=this.root;for(let t of i){let o=e.children?.get(t);if(!o)return;e=o}return e._value===gT?void 0:e._value}hasKeyOrParent(i){let e=this.root;for(let t of i){let o=e.children?.get(t);if(!o)return!1;if(o._value!==gT)return!0;e=o}return!1}hasKeyOrChildren(i){let e=this.root;for(let t of i){let o=e.children?.get(t);if(!o)return!1;e=o}return!0}hasKey(i){let e=this.root;for(let t of i){let o=e.children?.get(t);if(!o)return!1;e=o}return e._value!==gT}getPathToKey(i){let e=[{part:"",node:this.root}],t=0;for(let o of i){let n=e[t].node.children?.get(o);if(!n)return;e.push({part:o,node:n}),t++}return e}opNode(i,e,t){let o=this.root;for(let s of i){if(o.children)if(o.children.has(s))o=o.children.get(s);else{let l=new f7e;o.children.set(s,l),o=l}else{let l=new f7e;o.children=new Map([[s,l]]),o=l}t?.(o)}let n=o._value===gT?0:1;e(o);let r=o._value===gT?0:1;this._size+=r-n}*values(){for(let{_value:i}of Ioo(this.root))i!==gT&&(yield i)}};function*Ioo(a){let i=[a];for(;i.length>0;){let e=i.pop();if(yield e,e.children)for(let t of e.children.values())i.push(t)}}var f7e=class{constructor(){this._value=gT}get value(){return this._value===gT?void 0:this._value}set value(i){this._value=i===void 0?gT:i}};var IA=(u=>(u.SessionStart="SessionStart",u.SessionEnd="SessionEnd",u.UserPromptSubmit="UserPromptSubmit",u.PreToolUse="PreToolUse",u.PostToolUse="PostToolUse",u.PreCompact="PreCompact",u.SubagentStart="SubagentStart",u.SubagentStop="SubagentStop",u.Stop="Stop",u.ErrorOccurred="ErrorOccurred",u))(IA||{}),hg={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(IA).map(a=>[a,a]))},XC={SessionStart:{label:d(8315,null),description:d(8314,null)},UserPromptSubmit:{label:d(8323,null),description:d(8322,null)},PreToolUse:{label:d(8311,null),description:d(8310,null)},PostToolUse:{label:d(8307,null),description:d(8306,null)},PreCompact:{label:d(8309,null),description:d(8308,null)},SubagentStart:{label:d(8319,null),description:d(8318,null)},SubagentStop:{label:d(8321,null),description:d(8320,null)},Stop:{label:d(8317,null),description:d(8316,null)},SessionEnd:{label:d(8313,null),description:d(8312,null)},ErrorOccurred:{label:d(8305,null),description:d(8304,null)}};function CMt(a,i){if(!a)return i;let e={...a};for(let t of Object.values(IA)){let o=a[t],n=i[t];n&&n.length>0&&(e[t]=o?[...o,...n]:n)}return e}var JC={type:d(8297,null),command:d(8288,null),windows:d(8298,null),linux:d(8292,null),osx:d(8293,null),bash:d(8286,null),powershell:d(8294,null),cwd:d(8290,null),env:d(8291,null),timeout:d(8295,null),timeoutSec:d(8296,null)},Njo={type:"object",additionalProperties:!0,required:["type"],anyOf:[{required:["command"]},{required:["windows"]},{required:["linux"]},{required:["osx"]},{required:["bash"]},{required:["powershell"]}],errorMessage:d(8289,null),properties:{type:{type:"string",enum:["command"],description:JC.type},command:{type:"string",description:JC.command},windows:{type:"string",description:JC.windows},linux:{type:"string",description:JC.linux},osx:{type:"string",description:JC.osx},cwd:{type:"string",description:JC.cwd},env:{type:"object",additionalProperties:{type:"string"},description:JC.env},timeout:{type:"number",default:30,description:JC.timeout}}},Ojo={type:"array",items:Njo};function Coo(a,i){return Object.fromEntries(Object.entries(hg[a]).map(([e,t])=>[e,{...i,description:XC[t]?.description}]))}var Fjo=Coo("vscode",Ojo),Wjo={type:"object",additionalProperties:!0,required:["type"],anyOf:[{required:["bash"]},{required:["powershell"]}],errorMessage:d(8287,null),properties:{type:{type:"string",enum:["command"],description:JC.type},bash:{type:"string",description:JC.bash},powershell:{type:"string",description:JC.powershell},cwd:{type:"string",description:JC.cwd},env:{type:"object",additionalProperties:{type:"string"},description:JC.env},timeoutSec:{type:"number",default:10,description:JC.timeoutSec}}},Vjo={type:"array",items:Wjo},Bjo=Coo("github-copilot",Vjo),xoo={$schema:"http://json-schema.org/draft-07/schema#",type:"object",description:d(8299,null),additionalProperties:!0,required:["hooks"],properties:{hooks:{type:"object",description:d(8300,null),additionalProperties:!0}},if:{required:["version"],properties:{version:{type:"number"}}},then:{properties:{version:{type:"number",description:d(8303,null)},hooks:{properties:Bjo}}},else:{properties:{hooks:{properties:Fjo}}},defaultSnippets:[{label:d(8301,null),description:d(8302,null),body:{hooks:{SessionStart:[{type:"command",command:'${1:echo "Session started" >> session.log}'}],PreToolUse:[{type:"command",command:"${2:./scripts/validate.sh}",timeout:15}]}}}]},rfi="vscode://schemas/hooks";function v7e(a){if(Object.values(IA).includes(a))return a}function Hjo(a){if(a.type!=="command")return;let i=typeof a.command=="string"&&a.command.length>0,e=typeof a.bash=="string"&&a.bash.length>0,t=typeof a.powershell=="string"&&a.powershell.length>0,o=typeof a.windows=="string"&&a.windows.length>0,n=typeof a.linux=="string"&&a.linux.length>0,r=typeof a.osx=="string"&&a.osx.length>0,s=o?a.windows:t?a.powershell:void 0,l=n?a.linux:e?a.bash:void 0,c=r?a.osx:e?a.bash:void 0,u=o?"windows":t?"powershell":void 0,p=n?"linux":e?"bash":void 0,h=r?"osx":e?"bash":void 0;return{...i&&{command:a.command},...s&&{windows:s},...l&&{linux:l},...c&&{osx:c},...u&&{windowsSource:u},...p&&{linuxSource:p},...h&&{osxSource:h},...typeof a.cwd=="string"&&{cwd:a.cwd},...typeof a.env=="object"&&a.env!==null&&{env:a.env},...typeof a.timeout!="number"&&typeof a.timeoutSec=="number"&&{timeout:a.timeoutSec},...typeof a.timeout=="number"&&{timeout:a.timeout}}}function sfi(a,i){return i===1&&a.windows?a.windows:i===2&&a.osx?a.osx:i===3&&a.linux?a.linux:a.command}function koo(a,i){return i===1&&a.windows?a.windowsSource??"windows":i===2&&a.osx?a.osxSource??"osx":i===3&&a.linux?a.linuxSource??"linux":"command"}function N4(a,i){let e=sfi(a,i);return e||""}function yoo(a,i,e){let t=Hjo(a);if(!t)return;let o;if(t.cwd){let n=F7(t.cwd,e);Zl(n)?o=A.file(n):i&&(o=Ge(i,n))}else o=i;return{type:"command",...t.command&&{command:t.command},...t.windows&&{windows:t.windows},...t.linux&&{linux:t.linux},...t.osx&&{osx:t.osx},...t.windowsSource&&{windowsSource:t.windowsSource},...t.linuxSource&&{linuxSource:t.linuxSource},...t.osxSource&&{osxSource:t.osxSource},...o&&{cwd:o},...t.env&&{env:t.env},...t.timeout!==void 0&&{timeout:t.timeout}}}function b7e(a,i,e){if(!a||typeof a!="object")return[];let t=a,o=[],n=t.hooks;if(n!==void 0&&Array.isArray(n))for(let r of n){if(!r||typeof r!="object")continue;let s=woo(r),l=yoo(s,i,e);l&&o.push(l)}else{let r=woo(t),s=yoo(r,i,e);s&&o.push(s)}return o}function woo(a){return a.type===void 0||a.type==="command"?{...a,type:"command"}:a}function nfi(a){switch(a.type){case"scalar":return a.value;case"sequence":return a.items.map(nfi);case"map":{let i={};for(let e of a.properties)i[e.key.value]=nfi(e.value);return i}}}function Eoo(a,i,e,t="undefined"){let o={},n=hg[t]??hg.undefined;for(let r of a.properties){let s=r.key.value,l=n[s]??v7e(s);if(!l||r.value.type!=="sequence")continue;let c=[];for(let u of r.value.items){let p=nfi(u),h=b7e(p,i,e);c.push(...h)}c.length>0&&(o[l]||(o[l]=[]),o[l].push(...c))}return o}var WB=le("IMcpGalleryManifestService");function O4(a,i){let[e,t]=i.split("/");for(let o of a.resources){let[n,r]=o.type.split("/");if(n===e){if(!t||r===t)return o.id;break}}}var Bv;(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))(Bv||={});var Too="ext.";function I7e(a,i){return Ii.toKey(a)+"/"+i}var afi;(i=>{function a(e,t){return e.id===t.id&&e.remoteAuthority===t.remoteAuthority&&e.label===t.label&&e.trustBehavior===t.trustBehavior&&eo(e.sandbox,t.sandbox)}i.equals=a})(afi||={});var VB;(t=>{function a(o){return o}t.toSerialized=a;function i(o){return{id:o.id,label:o.label,cacheNonce:o.cacheNonce,staticMetadata:o.staticMetadata,launch:yA.fromSerialized(o.launch),sandboxEnabled:o.sandboxEnabled,variableReplacement:o.variableReplacement?_oo.fromSerialized(o.variableReplacement):void 0}}t.fromSerialized=i;function e(o,n){return o.id===n.id&&o.label===n.label&&o.cacheNonce===n.cacheNonce&&$i(o.roots,n.roots,(r,s)=>r.toString()===s.toString())&&eo(o.launch,n.launch)&&eo(o.presentation,n.presentation)&&eo(o.variableReplacement,n.variableReplacement)&&eo(o.devMode,n.devMode)&&o.sandboxEnabled===n.sandboxEnabled}t.equals=e})(VB||={});var _oo;(e=>{function a(t){return t}e.toSerialized=a;function i(t){return{section:t.section,folder:t.folder?{...t.folder,uri:A.revive(t.folder.uri)}:void 0,target:t.target}}e.fromSerialized=i})(_oo||={});var JTe;(i=>i.Empty={working:!1,starting:[],serversRequiringInteraction:[]})(JTe||={});var _s=le("IMcpService"),FJ=class{constructor(){this.participants=new G$}},Ek;(i=>{let a;(r=>(r[r.Trusted=0]="Trusted",r[r.TrustedOnNonce=1]="TrustedOnNonce",r[r.Untrusted=2]="Untrusted",r[r.Unknown=3]="Unknown"))(a=i.Kind||={})})(Ek||={});var ZTe=a=>a.template!==void 0;var lfi=a=>a.replace(/[^a-z0-9_.-]/gi,"_"),Doo=a=>"/mcp."+lfi(a.label);var yA;(t=>{function a(o){return o}t.toSerialized=a;function i(o){switch(o.type){case 2:return{type:o.type,uri:A.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}}}t.fromSerialized=i;async function e(o){let n=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(JSON.stringify(o)));return U$(qe.wrap(new Uint8Array(n)))}t.hash=e})(yA||={});var dr;(n=>{let a;(u=>(u[u.Stopped=0]="Stopped",u[u.Starting=1]="Starting",u[u.Running=2]="Running",u[u.Error=3]="Error"))(a=n.Kind||={}),n.toString=r=>{switch(r.state){case 0:return d(12124,null);case 1:return d(12123,null);case 2:return d(12122,null);case 3:return d(12121,null,r.message);default:os(r)}},n.toKindString=r=>{switch(r){case 0:return"stopped";case 1:return"starting";case 2:return"running";case 3:return"error";default:os(r)}},n.canBeStarted=r=>r===3||r===0,n.isRunning=r=>!(0,n.canBeStarted)(r.state)})(dr||={});var WJ=class extends Error{constructor(e,t,o){super(`MPC ${t}: ${e}`);this.code=t;this.data=o}},S7e=class extends Error{},Vw=class a extends Error{constructor(e){super(`${a.prefix}${e}`);this.reason=e}static{this.prefix="User interaction required: "}static is(e){return e.message.startsWith(this.prefix)}};var Ng=le("IMcpWorkbenchService"),OJ=class extends x{constructor(e,t){super();this.containers=e;this._register(t.onChange(this.update,this))}set mcpServer(e){this.containers.forEach(t=>t.mcpServer=e)}update(e){for(let t of this.containers)e&&t.mcpServer?e.id===t.mcpServer.id&&(t.mcpServer=e):t.update()}};OJ=I([m(1,Ng)],OJ);var _ue=new Y("mcpServersGalleryStatus","unavailable"),VJ=new Y("hasInstalledMcpServers",!0),e_e="workbench.views.mcp.installed",Bw;(o=>{o.scheme="mcp-resource";let i="dylo78gyp";function e(n,r){return typeof r=="string"&&(r=A.parse(r)),r.with({scheme:o.scheme,authority:U$(qe.fromString(n.id)),path:["",r.scheme,r.authority||i].join("/")+r.path})}o.fromServer=e;function t(n){if(typeof n=="string"&&(n=A.parse(n)),n.scheme!==o.scheme)throw new Error(`Invalid MCP resource URI: ${n.toString()}`);let r=n.path.split("/");if(r.length<3)throw new Error(`Invalid MCP resource URI: ${n.toString()}`);let[,s,l,...c]=r,u=new URL(`${s}://${l.toLowerCase()===i?"":l}`);return u.pathname=c.length?"/"+c.join("/"):"",u.search=n.query,u.hash=n.fragment,{definitionId:yIe(n.authority).toString(),resourceURL:u}}o.toServer=t})(Bw||={});var F4=le("IMcpServerSampling"),Tb=class a extends Error{constructor(e,t,o){super(t);this.code=e;this.data=o}static methodNotFound(e){return new a(Bv.METHOD_NOT_FOUND,`Method not found: ${e}`)}static notAllowed(){return new a(-32e3,"The user has denied permission to call this method.")}static unknown(e){let t=new a(Bv.INTERNAL_ERROR,`Unknown error: ${e.stack}`);return t.cause=e,t}};var y7e=le("IMcpElicitationService"),Loo="application/vnd.code.resource-link";var Ur=class a{constructor(i,e=i.length){this.path=i;this.viewEnd=e;if(i.length===0||e<1)throw new Error("cannot create test with empty path")}static fromExtHostTestItem(i,e,t=i.parent){if(i._isRoot)return new a([e]);let o=[i.id];for(let n=t;n&&n.id!==e;n=n.parent)o.push(n.id);return o.push(e),new a(o.reverse())}static isRoot(i){return!i.includes("\0")}static root(i){let e=i.indexOf("\0");return e===-1?i:i.slice(0,e)}static fromString(i){return new a(i.split("\0"))}static join(i,e){return new a([...i.path,e])}static split(i){return i.split("\0")}static joinToString(i,e){return i.toString()+"\0"+e}static parentId(i){let e=i.lastIndexOf("\0");return e===-1?void 0:i.slice(0,e)}static localId(i){let e=i.lastIndexOf("\0");return e===-1?i:i.slice(e+1)}static isChild(i,e){return e[i.length]==="\0"&&e.startsWith(i)}static compare(i,e){return i===e?0:a.isChild(i,e)?2:a.isChild(e,i)?3:1}static getLengthOfCommonPrefix(i,e){if(i===0)return 0;let t=0;for(;t<i-1;){for(let o=1;o<i;o++){let n=e(o-1),r=e(o);if(n.path[t]!==r.path[t])return t}t++}return t}get rootId(){return new a(this.path,1)}get parentId(){return this.viewEnd>1?new a(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 i=1;i<=this.viewEnd;i++)yield new a(this.path,i)}*idsToRoot(){for(let i=this.viewEnd;i>0;i--)yield new a(this.path,i)}compare(i){if(typeof i=="string")return a.compare(this.toString(),i);for(let e=0;e<i.viewEnd&&e<this.viewEnd;e++)if(i.path[e]!==this.path[e])return 1;return i.viewEnd>this.viewEnd?2:i.viewEnd<this.viewEnd?3:0}toJSON(){return this.toString()}toString(){if(!this.stringifed){this.stringifed=this.path[0];for(let i=1;i<this.viewEnd;i++)this.stringifed+="\0",this.stringifed+=this.path[i]}return this.stringifed}};var _Mt={0:"unset",1:"queued",2:"running",3:"passed",4:"failed",5:"skipped",6:"errored"};var gfi={2:d(16113,null),4:d(16112,null),8:d(16111,null)},Roo=[2,4,8,16,32,64];var w7e;(e=>(e.serialize=t=>({range:t.range.toJSON(),uri:t.uri.toJSON()}),e.deserialize=(t,o)=>({range:z.lift(o.range),uri:t.asCanonicalUri(A.revive(o.uri))})))(w7e||={});var cfi;(e=>(e.serialize=t=>({label:t.label,uri:t.uri?.toJSON(),position:t.position?.toJSON()}),e.deserialize=(t,o)=>({label:o.label,uri:o.uri?t.asCanonicalUri(A.revive(o.uri)):void 0,position:o.position?ye.lift(o.position):void 0})))(cfi||={});var dfi;(e=>(e.serialize=t=>({message:t.message,type:0,expected:t.expected,actual:t.actual,contextValue:t.contextValue,location:t.location&&w7e.serialize(t.location),stackTrace:t.stackTrace?.map(cfi.serialize)}),e.deserialize=(t,o)=>({message:o.message,type:0,expected:o.expected,actual:o.actual,contextValue:o.contextValue,location:o.location&&w7e.deserialize(t,o.location),stackTrace:o.stackTrace&&o.stackTrace.map(n=>cfi.deserialize(t,n))})))(dfi||={});var x7e=(a,i)=>`${i?"s":"e"}${a}`,ufi;(e=>(e.serialize=t=>({message:t.message,type:1,offset:t.offset,length:t.length,location:t.location&&w7e.serialize(t.location)}),e.deserialize=(t,o)=>({message:o.message,type:1,offset:o.offset,length:o.length,location:o.location&&w7e.deserialize(t,o.location)})))(ufi||={});var JF;(t=>(t.serialize=o=>o.type===0?dfi.serialize(o):ufi.serialize(o),t.deserialize=(o,n)=>n.type===0?dfi.deserialize(o,n):ufi.deserialize(o,n),t.isDiffable=o=>o.type===0&&o.actual!==void 0&&o.expected!==void 0))(JF||={});var kMt;(t=>(t.serializeWithoutMessages=o=>({state:o.state,duration:o.duration,messages:[]}),t.serialize=o=>({state:o.state,duration:o.duration,messages:o.messages.map(JF.serialize)}),t.deserialize=(o,n)=>({state:n.state,duration:n.duration,messages:n.messages.map(r=>JF.deserialize(o,r))})))(kMt||={});var Moo="\0",t_e=(a,i)=>a+Moo+i,DMt=a=>{let i=a.indexOf(Moo);return{ctrlId:a.slice(0,i),tagId:a.slice(i+1)}},C7e;(e=>(e.serialize=t=>({extId:t.extId,label:t.label,tags:t.tags,busy:t.busy,children:void 0,uri:t.uri?.toJSON(),range:t.range?.toJSON()||null,description:t.description,error:t.error,sortText:t.sortText}),e.deserialize=(t,o)=>({extId:o.extId,label:o.label,tags:o.tags,busy:o.busy,children:void 0,uri:o.uri?t.asCanonicalUri(A.revive(o.uri)):void 0,range:o.range?z.lift(o.range):null,description:o.description,error:o.error,sortText:o.sortText})))(C7e||={});var JR;(e=>(e.serialize=t=>({expand:t.expand,item:C7e.serialize(t.item)}),e.deserialize=(t,o)=>({controllerId:Ur.root(o.item.extId),expand:o.expand,item:C7e.deserialize(t,o.item)})))(JR||={});var EMt;(e=>(e.serialize=t=>{let o;return t.item&&(o={},t.item.label!==void 0&&(o.label=t.item.label),t.item.tags!==void 0&&(o.tags=t.item.tags),t.item.busy!==void 0&&(o.busy=t.item.busy),t.item.uri!==void 0&&(o.uri=t.item.uri?.toJSON()),t.item.range!==void 0&&(o.range=t.item.range?.toJSON()),t.item.description!==void 0&&(o.description=t.item.description),t.item.error!==void 0&&(o.error=t.item.error),t.item.sortText!==void 0&&(o.sortText=t.item.sortText)),{extId:t.extId,expand:t.expand,item:o}},e.deserialize=t=>{let o;return t.item&&(o={},t.item.label!==void 0&&(o.label=t.item.label),t.item.tags!==void 0&&(o.tags=t.item.tags),t.item.busy!==void 0&&(o.busy=t.item.busy),t.item.range!==void 0&&(o.range=t.item.range?z.lift(t.item.range):null),t.item.description!==void 0&&(o.description=t.item.description),t.item.error!==void 0&&(o.error=t.item.error),t.item.sortText!==void 0&&(o.sortText=t.item.sortText)),{extId:t.extId,expand:t.expand,item:o}}))(EMt||={});var i_e=(a,i)=>{i.expand!==void 0&&(a.expand=i.expand),i.item!==void 0&&(a.item=a.item?Object.assign(a.item,i.item):i.item)},k7e;(t=>(t.serializeWithoutMessages=o=>({...JR.serialize(o),ownComputedState:o.ownComputedState,computedState:o.computedState,tasks:o.tasks.map(kMt.serializeWithoutMessages)}),t.serialize=o=>({...JR.serialize(o),ownComputedState:o.ownComputedState,computedState:o.computedState,tasks:o.tasks.map(kMt.serialize)}),t.deserialize=(o,n)=>({...JR.deserialize(o,n),ownComputedState:n.ownComputedState,computedState:n.computedState,tasks:n.tasks.map(r=>kMt.deserialize(o,r)),retired:!0})))(k7e||={});var ffi;(e=>(e.empty=()=>({covered:0,total:0}),e.sum=(t,o)=>{t.covered+=o.covered,t.total+=o.total}))(ffi||={});var vfi;(t=>(t.serialize=o=>({id:o.id,statement:o.statement,branch:o.branch,declaration:o.declaration,testIds:o.testIds,uri:o.uri.toJSON()}),t.deserialize=(o,n)=>({id:n.id,statement:n.statement,branch:n.branch,declaration:n.declaration,testIds:n.testIds,uri:o.asCanonicalUri(A.revive(n.uri))}),t.empty=(o,n)=>({id:o,uri:n,statement:ffi.empty()})))(vfi||={});function bfi(a){return{...a,location:a.location?.toJSON()}}function Sfi(a){return a.location=a.location?ye.isIPosition(a.location)?ye.lift(a.location):z.lift(a.location):void 0,a}var Ifi;(e=>(e.serialize=t=>t.type===0?mfi.serialize(t):hfi.serialize(t),e.deserialize=t=>t.type===0?mfi.deserialize(t):hfi.deserialize(t)))(Ifi||={});var pfi;(e=>(e.serialize=bfi,e.deserialize=Sfi))(pfi||={});var mfi;(e=>(e.serialize=bfi,e.deserialize=Sfi))(mfi||={});var hfi;(e=>(e.serialize=t=>({...bfi(t),branches:t.branches?.map(pfi.serialize)}),e.deserialize=t=>({...Sfi(t),branches:t.branches?.map(pfi.deserialize)})))(hfi||={});var LMt;(e=>(e.deserialize=(t,o)=>o.op===0?{op:o.op,item:JR.deserialize(t,o.item)}:o.op===1?{op:o.op,item:EMt.deserialize(o.item)}:o.op===2?{op:o.op,uri:t.asCanonicalUri(A.revive(o.uri)),docv:o.docv}:o,e.serialize=t=>t.op===0?{op:t.op,item:JR.serialize(t.item)}:t.op===1?{op:t.op,item:EMt.serialize(t.item)}:t))(LMt||={});var TMt=class{constructor(i){this.uriIdentity=i;this._tags=new Map;this.items=new Map;this.roots=new Set;this.busyControllerCount=0;this.pendingRootCount=0;this.tags=this._tags}apply(i){let e=this.createChangeCollector();for(let t of i)switch(t.op){case 0:this.add(JR.deserialize(this.uriIdentity,t.item),e);break;case 1:this.update(EMt.deserialize(t.item),e);break;case 3:this.remove(t.itemId,e);break;case 5:this.retireTest(t.itemId);break;case 4:this.updatePendingRoots(t.amount);break;case 6:this._tags.set(t.tag.id,t.tag);break;case 7:this._tags.delete(t.id);break}e.complete?.()}add(i,e){let t=Ur.parentId(i.item.extId)?.toString(),o;if(!t)o=this.createItem(i),this.roots.add(o),this.items.set(i.item.extId,o);else if(this.items.has(t)){let n=this.items.get(t);n.children.add(i.item.extId),o=this.createItem(i,n),this.items.set(i.item.extId,o)}else{console.error(`Test with unknown parent ID: ${JSON.stringify(i)}`);return}return e.add?.(o),i.expand===2&&this.busyControllerCount++,o}update(i,e){let t=this.items.get(i.extId);if(t)return i.expand!==void 0&&(t.expand===2&&this.busyControllerCount--,i.expand===2&&this.busyControllerCount++),i_e(t,i),e.update?.(t),t}remove(i,e){let t=this.items.get(i);if(!t)return;let o=Ur.parentId(t.item.extId)?.toString();o?this.items.get(o).children.delete(t.item.extId):this.roots.delete(t);let n=[[i]];for(;n.length;)for(let r of n.pop()){let s=this.items.get(r);s&&(n.push(s.children),this.items.delete(r),e.remove?.(s,s!==t),s.expand===2&&this.busyControllerCount--)}}retireTest(i){}updatePendingRoots(i){this.pendingRootCount+=i}createChangeCollector(){return{}}};var o_e=le("IAiSettingsSearchService");var E7e=(a,i)=>a===i,Ujo={range:(a,i)=>a===i?!0:!a||!i?!1:a.equalsRange(i),busy:E7e,label:E7e,description:E7e,error:E7e,sortText:E7e,tags:(a,i)=>!(a.length!==i.length||a.some(e=>!i.includes(e)))},F4a=Object.entries(Ujo);var RMt=class extends Error{constructor(i){super(`TestItem with ID "${i}" is invalid. Make sure to create it from the createTestItem method.`)}};var zjo=new WeakMap;var Poo=a=>{let i=zjo.get(a);if(!i)throw new RMt(a?.id||"<unknown>");return i};var $jo;(e=>{function a(t){let{selectionStartLineNumber:o,selectionStartColumn:n,positionLineNumber:r,positionColumn:s}=t,l=new bc(o-1,n-1),c=new bc(r-1,s-1);return new B5(l,c)}e.to=a;function i(t){let{anchor:o,active:n}=t;return{selectionStartLineNumber:o.line+1,selectionStartColumn:o.character+1,positionLineNumber:n.line+1,positionColumn:n.character+1}}e.from=i})($jo||={});var Ks;(e=>{function a(t){if(!t)return;let{start:o,end:n}=t;return{startLineNumber:o.line+1,startColumn:o.character+1,endLineNumber:n.line+1,endColumn:n.character+1}}e.from=a;function i(t){if(!t)return;let{startLineNumber:o,startColumn:n,endLineNumber:r,endColumn:s}=t;return new od(o-1,n-1,r-1,s-1)}e.to=i})(Ks||={});var W4;(e=>{function a(t){return{uri:t.uri,range:Ks.from(t.range)}}e.from=a;function i(t){return new J_(A.revive(t.uri),Ks.to(t.range))}e.to=i})(W4||={});var jjo;(i=>{function a(e){switch(e){case 1:return 1;case 0:return 0;case 3:return 3;case 2:return 2}}i.to=a})(jjo||={});var _7e;(e=>{function a(t){return new bc(t.lineNumber-1,t.column-1)}e.to=a;function i(t){return{lineNumber:t.line+1,column:t.character+1}}e.from=i})(_7e||={});var Qjo;(t=>{function a(o,n,r){return di(cc(o).map(s=>i(s,n,r)))}t.from=a;function i(o,n,r){if(typeof o=="string")return{$serialized:!0,language:o,isBuiltin:r?.isBuiltin};if(o)return{$serialized:!0,language:o.language,scheme:e(o.scheme,n),pattern:e2.from(o.pattern)??void 0,exclusive:o.exclusive,notebookType:o.notebookType,isBuiltin:r?.isBuiltin}}function e(o,n){return n&&typeof o=="string"?n.transformOutgoingScheme(o):o}})(Qjo||={});var yfi;(e=>{function a(t){switch(t){case 1:return 1;case 2:return 2}}e.from=a;function i(t){switch(t){case 1:return 1;case 2:return 2;default:return}}e.to=i})(yfi||={});var Yjo;(e=>{function a(t){let o;return t.code&&(Fe(t.code)||Yo(t.code)?o=String(t.code):o={value:String(t.code.value),target:t.code.target}),{...Ks.from(t.range),message:t.message,source:t.source,code:o,severity:PMt.from(t.severity),relatedInformation:t.relatedInformation&&t.relatedInformation.map(wfi.from),tags:Array.isArray(t.tags)?di(t.tags.map(yfi.from)):void 0}}e.from=a;function i(t){let o=new _de(Ks.to(t),t.message,PMt.to(t.severity));return o.source=t.source,o.code=Fe(t.code)?t.code:t.code?.value,o.relatedInformation=t.relatedInformation&&t.relatedInformation.map(wfi.to),o.tags=t.tags&&di(t.tags.map(yfi.to)),o}e.to=i})(Yjo||={});var wfi;(e=>{function a(t){return{...Ks.from(t.location.range),message:t.message,resource:t.location.uri}}e.from=a;function i(t){return new EX(new J_(t.resource,Ks.to(t)),t.message)}e.to=i})(wfi||={});var PMt;(e=>{function a(t){switch(t){case 0:return 8;case 1:return 4;case 2:return 2;case 3:return 1}return 8}e.from=a;function i(t){switch(t){case 2:return 2;case 4:return 1;case 8:return 0;case 1:return 3;default:return 0}}e.to=i})(PMt||={});var Xjo;(e=>{function a(t){return typeof t=="number"&&t>=1?t-1:t===-2?In:jn}e.from=a;function i(t){if(typeof t=="number"&&t>=0)return t+1;throw new Error("invalid 'EditorGroupColumn'")}e.to=i})(Xjo||={});var dp;(r=>{function a(s){return s.map(r.from)}r.fromMany=a;function i(s){return s&&typeof s=="object"&&typeof s.language=="string"&&typeof s.value=="string"}function e(s){let l;if(i(s)){let{language:p,value:h}=s;l={value:"```"+p+`
`+h+"\n```\n"}}else eT.isMarkdownString(s)?l={value:s.value,isTrusted:s.isTrusted,supportThemeIcons:s.supportThemeIcons,supportHtml:s.supportHtml,supportAlertSyntax:s.supportAlertSyntax,baseUri:s.baseUri}:typeof s=="string"?l={value:s}:l={value:""};let c=Object.create(null);l.uris=c;let u=({href:p})=>{try{let h=A.parse(p,!0);h=h.with({query:t(h.query,c)}),c[p]=h}catch{}return""};return oc.walkTokens(oc.lexer(l.value),p=>{p.type==="link"?u({href:p.href}):p.type==="image"&&typeof p.href=="string"&&u(Pyt(p.href))}),l}r.from=e;function t(s,l){if(!s)return s;let c;try{c=am(s)}catch{}if(!c)return s;let u=!1;return c=Fx(c,p=>{if(A.isUri(p)){let h=`__uri_${Math.random().toString(16).slice(2,8)}`;return l[h]=p,u=!0,h}else return}),u?JSON.stringify(c):s}function o(s){let l=new eT(s.value,s.supportThemeIcons);return l.isTrusted=s.isTrusted,l.supportHtml=s.supportHtml,l.supportAlertSyntax=s.supportAlertSyntax,l.baseUri=s.baseUri?A.from(s.baseUri):void 0,l}r.to=o;function n(s){if(s)return typeof s=="string"?s:r.from(s)}r.fromStrict=n})(dp||={});function Bfi(a){return typeof a>"u"?a:typeof a=="string"?A.file(a):a}var D7e;(i=>{function a(e){return typeof e>"u"?e:{contentText:e.contentText,contentIconPath:e.contentIconPath?Bfi(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}}i.from=a})(D7e||={});var Cfi;(i=>{function a(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?Bfi(e.gutterIconPath):void 0,gutterIconSize:e.gutterIconSize,overviewRulerColor:e.overviewRulerColor,before:e.before?D7e.from(e.before):void 0,after:e.after?D7e.from(e.after):void 0}}i.from=a})(Cfi||={});var Noo;(i=>{function a(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}}i.from=a})(Noo||={});var Jjo;(i=>{function a(e){return{isWholeLine:e.isWholeLine,rangeBehavior:e.rangeBehavior?Noo.from(e.rangeBehavior):void 0,overviewRulerLane:e.overviewRulerLane,light:e.light?Cfi.from(e.light):void 0,dark:e.dark?Cfi.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?Bfi(e.gutterIconPath):void 0,gutterIconSize:e.gutterIconSize,overviewRulerColor:e.overviewRulerColor,before:e.before?D7e.from(e.before):void 0,after:e.after?D7e.from(e.after):void 0}}i.from=a})(Jjo||={});var t2;(e=>{function a(t){return{text:t.newText,eol:t.newEol&&_fi.from(t.newEol),range:Ks.from(t.range)}}e.from=a;function i(t){let o=new hk(Ks.to(t.range),t.text);return o.newEol=typeof t.eol>"u"?void 0:_fi.to(t.eol),o}e.to=i})(t2||={});var Zjo;(e=>{function a(t,o){let n={edits:[]};if(t instanceof DX){let r=new En;for(let s of t._allEntries())s._type===1&&A.isUri(s.to)&&s.from===void 0&&r.add(s.to);for(let s of t._allEntries())if(s._type===1){let l;s.options?.contents&&(ArrayBuffer.isView(s.options.contents)?l={type:"base64",value:Yd(qe.wrap(s.options.contents))}:l={type:"dataTransferItem",id:s.options.contents._itemId}),n.edits.push({oldResource:s.from,newResource:s.to,options:{...s.options,contents:l},metadata:s.metadata})}else s._type===2?n.edits.push({resource:s.uri,textEdit:t2.from(s.edit),versionId:r.has(s.uri)?void 0:o?.getTextDocumentVersion(s.uri),metadata:s.metadata}):s._type===6?n.edits.push({resource:s.uri,textEdit:{range:Ks.from(s.range),text:s.edit.value,insertAsSnippet:!0,keepWhitespace:s.keepWhitespace},versionId:r.has(s.uri)?void 0:o?.getTextDocumentVersion(s.uri),metadata:s.metadata}):s._type===3?n.edits.push({metadata:s.metadata,resource:s.uri,cellEdit:s.edit,notebookVersionId:o?.getNotebookDocumentVersion(s.uri)}):s._type===5&&n.edits.push({metadata:s.metadata,resource:s.uri,notebookVersionId:o?.getNotebookDocumentVersion(s.uri),cellEdit:{editType:1,index:s.index,count:s.count,cells:s.cells.map(R7e.from)}})}return n}e.from=a;function i(t){let o=new DX,n=new gt;for(let r of t.edits)if(r.textEdit){let s=r,l=A.revive(s.resource),c=Ks.to(s.textEdit.range),u=s.textEdit.text,p=s.textEdit.insertAsSnippet,h;p?h=Dde.replace(c,new tT(u)):h=hk.replace(c,u);let g=n.get(l);g?g.push(h):n.set(l,[h])}else o.renameFile(A.revive(r.oldResource),A.revive(r.newResource),r.options);for(let[r,s]of n)o.set(r,s);return o}e.to=i})(Zjo||={});var V4;(t=>{let a=Object.create(null);a[0]=0,a[1]=1,a[2]=2,a[3]=3,a[4]=4,a[5]=5,a[6]=6,a[7]=7,a[8]=8,a[9]=9,a[10]=10,a[11]=11,a[12]=12,a[13]=13,a[14]=14,a[15]=15,a[16]=16,a[17]=17,a[18]=18,a[19]=19,a[20]=20,a[21]=21,a[22]=22,a[23]=23,a[24]=24,a[25]=25;function i(o){return typeof a[o]=="number"?a[o]:6}t.from=i;function e(o){for(let n in a)if(a[n]===o)return Number(n);return 6}t.to=e})(V4||={});var Due;(e=>{function a(t){if(t===1)return 1}e.from=a;function i(t){if(t===1)return 1}e.to=i})(Due||={});var xfi;(e=>{function a(t){return{name:t.name,kind:V4.from(t.kind),tags:t.tags&&t.tags.map(Due.from),containerName:t.containerName,location:L7e.from(t.location)}}e.from=a;function i(t){let o=new H5(t.name,V4.to(t.kind),t.containerName,L7e.to(t.location));return o.tags=t.tags&&t.tags.map(Due.to),o}e.to=i})(xfi||={});var e5o;(e=>{function a(t){let o={name:t.name||"!!MISSING: name!!",detail:t.detail,range:Ks.from(t.range),selectionRange:Ks.from(t.selectionRange),kind:V4.from(t.kind),tags:t.tags?.map(Due.from)??[]};return t.children&&(o.children=t.children.map(a)),o}e.from=a;function i(t){let o=new K5(t.name,t.detail,V4.to(t.kind),Ks.to(t.range),Ks.to(t.selectionRange));return yr(t.tags)&&(o.tags=t.tags.map(Due.to)),t.children&&(o.children=t.children.map(i)),o}e.to=i})(e5o||={});var Hfi;(e=>{function a(t){let o=new b_t(V4.to(t.kind),t.name,t.detail||"",A.revive(t.uri),Ks.to(t.range),Ks.to(t.selectionRange));return o._sessionId=t._sessionId,o._itemId=t._itemId,o}e.to=a;function i(t,o,n){if(o=o??t._sessionId,n=n??t._itemId,o===void 0||n===void 0)throw new Error("invalid item");return{_sessionId:o,_itemId:n,name:t.name,detail:t.detail,kind:V4.from(t.kind),uri:t.uri,range:Ks.from(t.range),selectionRange:Ks.from(t.selectionRange),tags:t.tags?.map(Due.from)}}e.from=i})(Hfi||={});var t5o;(i=>{function a(e){return new S_t(Hfi.to(e.from),e.fromRanges.map(t=>Ks.to(t)))}i.to=a})(t5o||={});var i5o;(i=>{function a(e){return new I_t(Hfi.to(e.to),e.fromRanges.map(t=>Ks.to(t)))}i.to=a})(i5o||={});var L7e;(e=>{function a(t){return{range:t.range&&Ks.from(t.range),uri:t.uri}}e.from=a;function i(t){return new J_(A.revive(t.uri),Ks.to(t.range))}e.to=i})(L7e||={});var o5o;(e=>{function a(t){let o=t,n=t;return{originSelectionRange:o.originSelectionRange?Ks.from(o.originSelectionRange):void 0,uri:o.targetUri?o.targetUri:n.uri,range:Ks.from(o.targetRange?o.targetRange:n.range),targetSelectionRange:o.targetSelectionRange?Ks.from(o.targetSelectionRange):void 0}}e.from=a;function i(t){return{targetUri:A.revive(t.uri),targetRange:Ks.to(t.range),targetSelectionRange:t.targetSelectionRange?Ks.to(t.targetSelectionRange):void 0,originSelectionRange:t.originSelectionRange?Ks.to(t.originSelectionRange):void 0}}e.to=i})(o5o||={});var n5o;(e=>{function a(t){return{range:Ks.from(t.range),contents:dp.fromMany(t.contents),canIncreaseVerbosity:t.canIncreaseVerbosity,canDecreaseVerbosity:t.canDecreaseVerbosity}}e.from=a;function i(t){let o=t.contents.map(dp.to),n=Ks.to(t.range),r=t.canIncreaseVerbosity,s=t.canDecreaseVerbosity;return new oEe(o,n,r,s)}e.to=i})(n5o||={});var r5o;(e=>{function a(t){return{range:Ks.from(t.range),expression:t.expression}}e.from=a;function i(t){return new hEe(Ks.to(t.range),t.expression)}e.to=i})(r5o||={});var s5o;(e=>{function a(t){if(t instanceof gEe)return{type:"text",range:Ks.from(t.range),text:t.text};if(t instanceof fEe)return{type:"variable",range:Ks.from(t.range),variableName:t.variableName,caseSensitiveLookup:t.caseSensitiveLookup};if(t instanceof vEe)return{type:"expression",range:Ks.from(t.range),expression:t.expression};throw new Error("Unknown 'InlineValue' type")}e.from=a;function i(t){switch(t.type){case"text":return{range:Ks.to(t.range),text:t.text};case"variable":return{range:Ks.to(t.range),variableName:t.variableName,caseSensitiveLookup:t.caseSensitiveLookup};case"expression":return{range:Ks.to(t.range),expression:t.expression}}}e.to=i})(s5o||={});var a5o;(e=>{function a(t){return{frameId:t.frameId,stoppedLocation:Ks.from(t.stoppedLocation)}}e.from=a;function i(t){return new bEe(t.frameId,Ks.to(t.stoppedLocation))}e.to=i})(a5o||={});var kfi;(e=>{function a(t){return{range:Ks.from(t.range),kind:t.kind}}e.from=a;function i(t){return new nEe(Ks.to(t.range),t.kind)}e.to=i})(kfi||={});var l5o;(e=>{function a(t){return{uri:t.uri,highlights:t.highlights.map(kfi.from)}}e.from=a;function i(t){return new rEe(A.revive(t.uri),t.highlights.map(kfi.to))}e.to=i})(l5o||={});var Ooo;(i=>{function a(e){switch(e){case 1:return 1;case 2:return 2;case 0:default:return 0}}i.to=a})(Ooo||={});var c5o;(i=>{function a(e){return{triggerKind:Ooo.to(e.triggerKind),triggerCharacter:e.triggerCharacter}}i.to=a})(c5o||={});var Foo;(e=>{function a(t){if(t===1)return 1}e.from=a;function i(t){if(t===1)return 1}e.to=i})(Foo||={});var d5o;(i=>{function a(e,t,o){return"icon"in e&&"command"in e?{command:t.toInternal(e.command,o),icon:fno.fromThemeIcon(e.icon)}:{command:t.toInternal(e,o)}}i.from=a})(d5o||={});var Woo;(o=>{let a=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 i(n){return a.get(n)??9}o.from=i;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 t(n){return e.get(n)??9}o.to=t})(Woo||={});var u5o;(i=>{function a(e,t){let o=new cEe(e.label);return o.insertText=e.insertText,o.kind=Woo.to(e.kind),o.tags=e.tags?.map(Foo.to),o.detail=e.detail,o.documentation=Ar(e.documentation)?dp.to(e.documentation):e.documentation,o.sortText=e.sortText,o.filterText=e.filterText,o.preselect=e.preselect,o.commitCharacters=e.commitCharacters,z.isIRange(e.range)?o.range=Ks.to(e.range):typeof e.range=="object"&&(o.range={inserting:Ks.to(e.range.insert),replacing:Ks.to(e.range.replace)}),o.keepWhitespace=typeof e.insertTextRules>"u"?!1:!!(e.insertTextRules&1),typeof e.insertTextRules<"u"&&e.insertTextRules&4?o.insertText=new tT(e.insertText):(o.insertText=e.insertText,o.textEdit=o.range instanceof od?new hk(o.range,o.insertText):void 0),e.additionalTextEdits&&e.additionalTextEdits.length>0&&(o.additionalTextEdits=e.additionalTextEdits.map(n=>t2.to(n))),o.command=t&&e.command?t.fromInternal(e.command):void 0,o}i.to=a})(u5o||={});var Efi;(e=>{function a(t){if(typeof t.label!="string"&&!Array.isArray(t.label))throw new TypeError("Invalid label");return{label:t.label,documentation:dp.fromStrict(t.documentation)}}e.from=a;function i(t){return{label:t.label,documentation:Ar(t.documentation)?dp.to(t.documentation):t.documentation}}e.to=i})(Efi||={});var Tfi;(e=>{function a(t){return{label:t.label,documentation:dp.fromStrict(t.documentation),parameters:Array.isArray(t.parameters)?t.parameters.map(Efi.from):[],activeParameter:t.activeParameter}}e.from=a;function i(t){return{label:t.label,documentation:Ar(t.documentation)?dp.to(t.documentation):t.documentation,parameters:Array.isArray(t.parameters)?t.parameters.map(Efi.to):[],activeParameter:t.activeParameter}}e.to=i})(Tfi||={});var p5o;(e=>{function a(t){return{activeSignature:t.activeSignature,activeParameter:t.activeParameter,signatures:Array.isArray(t.signatures)?t.signatures.map(Tfi.from):[]}}e.from=a;function i(t){return{activeSignature:t.activeSignature,activeParameter:t.activeParameter,signatures:Array.isArray(t.signatures)?t.signatures.map(Tfi.to):[]}}e.to=i})(p5o||={});var m5o;(i=>{function a(e,t){let o=new lEe(_7e.to(t.position),typeof t.label=="string"?t.label:t.label.map(Voo.to.bind(void 0,e)),t.kind&&Boo.to(t.kind));return o.textEdits=t.textEdits&&t.textEdits.map(t2.to),o.tooltip=Ar(t.tooltip)?dp.to(t.tooltip):t.tooltip,o.paddingLeft=t.paddingLeft,o.paddingRight=t.paddingRight,o}i.to=a})(m5o||={});var Voo;(i=>{function a(e,t){let o=new aEe(t.label);return o.tooltip=Ar(t.tooltip)?dp.to(t.tooltip):t.tooltip,qae.is(t.command)&&(o.command=e.fromInternal(t.command)),t.location&&(o.location=L7e.to(t.location)),o}i.to=a})(Voo||={});var Boo;(e=>{function a(t){return t}e.from=a;function i(t){return t}e.to=i})(Boo||={});var h5o;(e=>{function a(t){return{range:Ks.from(t.range),url:t.target,tooltip:t.tooltip}}e.from=a;function i(t){let o;if(t.url)try{o=typeof t.url=="string"?A.parse(t.url,!0):A.revive(t.url)}catch{}let n=new dEe(Ks.to(t.range),o);return n.tooltip=t.tooltip,n}e.to=i})(h5o||={});var g5o;(e=>{function a(t){let o=new uEe(t.label);return t.textEdit&&(o.textEdit=t2.to(t.textEdit)),t.additionalTextEdits&&(o.additionalTextEdits=t.additionalTextEdits.map(n=>t2.to(n))),o}e.to=a;function i(t){return{label:t.label,textEdit:t.textEdit?t2.from(t.textEdit):void 0,additionalTextEdits:t.additionalTextEdits?t.additionalTextEdits.map(o=>t2.from(o)):void 0}}e.from=i})(g5o||={});var f5o;(e=>{function a(t){return new Mde(t[0],t[1],t[2],t[3])}e.to=a;function i(t){return[t.red,t.green,t.blue,t.alpha]}e.from=i})(f5o||={});var v5o;(e=>{function a(t){return{range:Ks.from(t.range)}}e.from=a;function i(t){return new sEe(Ks.to(t.range))}e.to=i})(v5o||={});var b5o;(i=>{function a(e){switch(e){case 2:return 2;case 1:return 1;case 3:case 4:return 3}}i.to=a})(b5o||={});var S5o;(e=>{function a(t){switch(t){case 0:return 0;case 2:return 2;case 3:return 3;case 1:default:return 1}}e.from=a;function i(t){switch(t){case 0:return 0;case 2:return 2;case 3:return 3;case 1:default:return 1}}e.to=i})(S5o||={});var _fi;(e=>{function a(t){if(t===2)return 1;if(t===1)return 0}e.from=a;function i(t){if(t===1)return 2;if(t===0)return 1}e.to=i})(_fi||={});var I5o;(i=>{function a(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'")}i.from=a})(I5o||={});var y5o;(e=>{function a(t){let o={start:t.start+1,end:t.end+1};return t.kind&&(o.kind=Dfi.from(t.kind)),o}e.from=a;function i(t){let o={start:t.start-1,end:t.end-1};return t.kind&&(o.kind=Dfi.to(t.kind)),o}e.to=i})(y5o||={});var Dfi;(e=>{function a(t){if(t)switch(t){case 1:return IE.Comment;case 2:return IE.Imports;case 3:return IE.Region}}e.from=a;function i(t){if(t)switch(t.value){case IE.Comment.value:return 1;case IE.Imports.value:return 2;case IE.Region.value:return 3}}e.to=i})(Dfi||={});var w5o;(i=>{function a(e){if(e)return{pinned:typeof e.preview=="boolean"?!e.preview:void 0,inactive:e.background,preserveFocus:e.preserveFocus,selection:typeof e.selection=="object"?Ks.from(e.selection):void 0,override:typeof e.override=="boolean"?la.id:void 0}}i.from=a})(w5o||={});var e2;(o=>{function a(n){return n instanceof RX?n.toJSON():typeof n=="string"?n:i(n)||e(n)?new RX(n.baseUri??n.base,n.pattern).toJSON():n}o.from=a;function i(n){let r=n;return r?A.isUri(r.baseUri)&&typeof r.pattern=="string":!1}function e(n){let r=n;return r?typeof r.base=="string"&&typeof r.pattern=="string":!1}function t(n){return typeof n=="string"?n:new RX(A.revive(n.baseUri),n.pattern)}o.to=t})(e2||={});var C5o;(i=>{function a(e){if(e){if(Array.isArray(e))return e.map(a);if(typeof e=="string")return e;{let t=e;return{language:t.language,scheme:t.scheme,pattern:e2.from(t.pattern)??void 0,exclusive:t.exclusive,notebookType:t.notebookType}}}else return}i.from=a})(C5o||={});var x5o;(e=>{function a(t){return{start:t.start,end:t.end}}e.from=a;function i(t){return new V5(t.start,t.end)}e.to=i})(x5o||={});var Lfi;(e=>{function a(t){return{timing:typeof t.runStartTime=="number"&&typeof t.runEndTime=="number"?{startTime:t.runStartTime,endTime:t.runEndTime}:void 0,executionOrder:t.executionOrder,success:t.lastRunSuccess}}e.to=a;function i(t){return{lastRunSuccess:t.success,runStartTime:t.timing?.startTime,runEndTime:t.timing?.endTime,executionOrder:t.executionOrder}}e.from=i})(Lfi||={});var Rfi;(e=>{function a(t){switch(t){case 1:return 1;case 2:default:return 2}}e.from=a;function i(t){switch(t){case 1:return 1;case 2:default:return 2}}e.to=i})(Rfi||={});var k5o;(e=>{function a(t){let o={metadata:t.metadata??Object.create(null),cells:[]};for(let n of t.cells)eEe.validate(n),o.cells.push(R7e.from(n));return o}e.from=a;function i(t){let o=new DQe(t.cells.map(R7e.to));return Of(t.metadata)||(o.metadata=t.metadata),o}e.to=i})(k5o||={});var R7e;(e=>{function a(t){return{cellKind:Rfi.from(t.kind),language:t.languageId,mime:t.mime,source:t.value,metadata:t.metadata,internalMetadata:Lfi.from(t.executionSummary??{}),outputs:t.outputs?t.outputs.map(Pfi.from):[]}}e.from=a;function i(t){return new eEe(Rfi.to(t.cellKind),t.source,t.language,t.mime,t.outputs?t.outputs.map(Pfi.to):void 0,t.metadata,t.internalMetadata?Lfi.to(t.internalMetadata):void 0)}e.to=i})(R7e||={});var Mfi;(e=>{function a(t){return{mime:t.mime,valueBytes:qe.wrap(t.data)}}e.from=a;function i(t){return new LQe(t.valueBytes.buffer,t.mime)}e.to=i})(Mfi||={});var Pfi;(e=>{function a(t){return{outputId:t.id,items:t.items.map(Mfi.from),metadata:t.metadata}}e.from=a;function i(t){let o=t.items.map(Mfi.to);return new RQe(o,t.outputId,t.metadata)}e.to=i})(Pfi||={});var E5o;(t=>{function a(o){return e(o)?{include:e2.from(o.include)??void 0,exclude:e2.from(o.exclude)??void 0}:e2.from(o)??void 0}t.from=a;function i(o){return e(o)?{include:e2.to(o.include),exclude:e2.to(o.exclude)}:e2.to(o)}t.to=i;function e(o){let n=o;return n?!nr(n.include)&&!nr(n.exclude):!1}})(E5o||={});var T5o;(i=>{function a(e,t,o){let n=typeof e.command=="string"?{title:"",command:e.command}:e.command;return{alignment:e.alignment===1?1:2,command:t.toInternal(n,o),text:e.text,tooltip:e.tooltip,accessibilityInformation:e.accessibilityInformation,priority:e.priority}}i.from=a})(T5o||={});var _5o;(i=>{function a(e,t,o){let n=typeof e.command=="string"?{title:"",command:e.command}:e.command;return{command:t.toInternal(n,o),label:e.label,description:e.description,detail:e.detail,documentation:e.documentation}}i.from=a})(_5o||={});var D5o;(i=>{function a(e){return{transientOutputs:e?.transientOutputs??!1,transientCellMetadata:e?.transientCellMetadata??{},transientDocumentMetadata:e?.transientDocumentMetadata??{},cellContentMetadata:e?.cellContentMetadata??{}}}i.from=a})(D5o||={});var L5o;(e=>{function a(t){return{uri:t.uri,provides:t.provides}}e.from=a;function i(t){return new C_t(A.revive(t.uri),t.provides)}e.to=i})(L5o||={});var Hoo;(e=>{function a(t){return{message:dp.fromStrict(t.message)||"",type:0,expected:t.expectedOutput,actual:t.actualOutput,contextValue:t.contextValue,location:t.location&&{range:Ks.from(t.location.range),uri:t.location.uri},stackTrace:t.stackTrace?.map(o=>({label:o.label,position:o.position&&_7e.from(o.position),uri:o.uri&&A.revive(o.uri).toJSON()}))}}e.from=a;function i(t){let o=new MX(typeof t.message=="string"?t.message:dp.to(t.message));return o.actualOutput=t.actual,o.expectedOutput=t.expected,o.contextValue=t.contextValue,o.location=t.location?L7e.to(t.location):void 0,o}e.to=i})(Hoo||={});var M7e;(e=>(e.namespace=t_e,e.denamespace=DMt))(M7e||={});var R5o;(i=>{function a(e){return{controllerId:e.controllerId,profileId:e.profileId,group:Uoo.from(e.kind)}}i.from=a})(R5o||={});var Uoo;(e=>{let a={3:8,2:4,1:2};function i(t){return a.hasOwnProperty(t)?a[t]:2}e.from=i})(Uoo||={});var zoo;(e=>{function a(t){let o=Poo(t).controllerId;return{extId:Ur.fromExtHostTestItem(t,o).toString(),label:t.label,uri:A.revive(t.uri),busy:t.busy,tags:t.tags.map(n=>M7e.namespace(o,n.id)),range:z.lift(Ks.from(t.range)),description:t.description||null,sortText:t.sortText||null,error:t.error&&dp.fromStrict(t.error)||null}}e.from=a;function i(t){return{parent:void 0,error:void 0,id:Ur.fromString(t.extId).localId,label:t.label,uri:A.revive(t.uri),tags:(t.tags||[]).map(o=>{let{tagId:n}=M7e.denamespace(o);return new Ade(n)}),children:{add:()=>{},delete:()=>{},forEach:()=>{},*[Symbol.iterator](){},get:()=>{},replace:()=>{},size:0},range:Ks.to(t.range||void 0),canResolveChildren:!1,busy:t.busy,description:t.description||void 0,sortText:t.sortText||void 0}}e.toPlain=i})(zoo||={});(e=>{function a(t){return{id:t.id}}e.from=a;function i(t){return new Ade(t.id)}e.to=i})(M7e||={});var M5o;(e=>{let a=(t,o)=>{let n=t.value;if(!n)return;let r={...zoo.toPlain(n.item),parent:o,taskStates:n.tasks.map(s=>({state:s.state,duration:s.duration,messages:s.messages.filter(l=>l.type===0).map(Hoo.to)})),children:[]};if(t.children)for(let s of t.children.values()){let l=a(s,r);l&&r.children.push(l)}return r};function i(t){let o=new SA;for(let s of t.items)o.insert(Ur.fromString(s.item.extId).path,s);let n=[o.nodes],r=[];for(;n.length;)for(let s of n.pop())s.value?r.push(s):s.children&&n.push(s.children.values());return{completedAt:t.completedAt,results:r.map(s=>a(s)).filter(lo)}}e.to=i})(M5o||={});var P5o;(r=>{function a(s){return{covered:s.covered,total:s.total}}function i(s){return"line"in s?_7e.from(s):Ks.from(s)}function e(s){if(s)return"endLineNumber"in s?Ks.to(s):_7e.to(s)}function t(s){if(s.type===1){let l=[];if(s.branches)for(let c of s.branches)l.push({executed:c.count,location:e(c.location),label:c.label});return new k_t(s.count,e(s.location),s.branches?.map(c=>new E_t(c.count,e(c.location),c.label)))}else return new T_t(s.name,s.count,e(s.location))}r.to=t;function o(s){if(typeof s.executed=="number"&&s.executed<0)throw new Error(`Invalid coverage count ${s.executed}`);return"branches"in s?{count:s.executed,location:i(s.location),type:1,branches:s.branches.length?s.branches.map(l=>({count:l.executed,location:l.location&&i(l.location),label:l.label})):void 0}:{type:0,name:s.name,count:s.executed,location:i(s.location)}}r.fromDetails=o;function n(s,l,c){return r6e(c.statementCoverage),r6e(c.branchCoverage),r6e(c.declarationCoverage),{id:l,uri:c.uri,statement:a(c.statementCoverage),branch:c.branchCoverage&&a(c.branchCoverage),declaration:c.declarationCoverage&&a(c.declarationCoverage),testIds:c instanceof x_t&&c.includesTests.length?c.includesTests.map(u=>Ur.fromExtHostTestItem(u,s).toString()):void 0}}r.fromFile=n})(P5o||={});var A5o;(i=>{function a(e){switch(e){case 1:return 1;case 2:return 2}}i.to=a})(A5o||={});var N5o;(e=>{function a(t){let o=new __t(V4.to(t.kind),t.name,t.detail||"",A.revive(t.uri),Ks.to(t.range),Ks.to(t.selectionRange));return o._sessionId=t._sessionId,o._itemId=t._itemId,o}e.to=a;function i(t,o,n){if(o=o??t._sessionId,n=n??t._itemId,o===void 0||n===void 0)throw new Error("invalid item");return{_sessionId:o,_itemId:n,kind:V4.from(t.kind),name:t.name,detail:t.detail??"",uri:t.uri,range:Ks.from(t.range),selectionRange:Ks.from(t.selectionRange),tags:t.tags?.map(Due.from)}}e.from=i})(N5o||={});var O5o;(i=>{function a(e){if(e)return{value:e.value,tooltip:e.tooltip}}i.from=a})(O5o||={});var MMt;(o=>{function a(n,r,s){let l=r.fileData;return l?new y_t(new w_t(l.name,A.revive(l.uri),l.id,$c(()=>s(l.id)))):n===tr.uriList&&r.uriListData?new SEe(t(r.uriListData)):new SEe(r.asString)}o.to=a;async function i(n,r,s=xt()){let l=await r.asString();if(n===tr.uriList)return{id:s,asString:l,fileData:void 0,uriListData:e(l)};let c=r.asFile();return{id:s,asString:l,fileData:c?{name:c.name,uri:c.uri,id:c._itemId??c.id}:void 0}}o.from=i;function e(n){return aw.split(n).map(r=>{if(r.startsWith("#"))return r;try{return A.parse(r)}catch{}return r})}function t(n){return aw.create(n.map(r=>typeof r=="string"?r:A.revive(r)))}})(MMt||={});var Lue;(t=>{function a(o,n){let r=o.items.map(([s,l])=>[s,MMt.to(s,l,n)]);return new mEe(r)}t.toDataTransfer=a;async function i(o){return{items:await Promise.all(Array.from(o,async([r,s])=>[r,await MMt.from(r,s)]))}}t.from=i;async function e(o){return{items:await Promise.all(Array.from(o,async([r,s])=>[r,await MMt.from(r,s,s.id)]))}}t.fromList=e})(Lue||={});var Koo;(e=>{function a(t,o){return{kind:"reply",agentId:t.participant??o?.agentId??"",subCommand:t.command??o?.command,message:t.prompt,title:t.label}}e.from=a;function i(t){return{prompt:t.message,label:t.title,participant:t.agentId,command:t.subCommand}}e.to=i})(Koo||={});var P7e;(e=>{function a(t){switch(t){case 0:return 3;case 1:return 1;case 2:return 2}}e.to=a;function i(t){switch(t){case 3:return 0;case 1:return 1;case 2:return 2}return 1}e.from=i})(P7e||={});var F5o;(e=>{function a(t){let o=t.content.map(s=>{if(s.type==="text")return new aI(s.value,s.audience);if(s.type==="tool_result"){let l=di(s.value.map(c=>c.type==="text"?new aI(c.value,c.audience):c.type==="data"?new iT(c.data.buffer,c.mimeType):c.type==="prompt_tsx"?new IK(c.value):void 0));return new Fde(s.toolCallId,l,s.isError)}else{if(s.type==="image_url")return new iT(s.value.data.buffer,s.value.mimeType);if(s.type==="data")return new iT(s.data.buffer,s.mimeType);if(s.type==="tool_use")return new Wde(s.toolCallId,s.name,s.parameters)}}).filter(s=>s!==void 0),n=P7e.to(t.role);return new V_t(n,o,t.name)}e.to=a;function i(t){let o=P7e.from(t.role),n=t.name,r=t.content;typeof r=="string"&&(r=[new aI(r)]);let s=r.map(l=>{if(l instanceof Fde)return{type:"tool_result",toolCallId:l.callId,value:di(l.content.map(c=>c instanceof aI?{type:"text",value:c.value,audience:c.audience}:c instanceof IK?{type:"prompt_tsx",value:c.value}:c instanceof iT?{type:"data",mimeType:c.mimeType,data:qe.wrap(c.data),audience:c.audience}:void 0)),isError:l.isError};if(l instanceof iT)return Goo(l)?{type:"image_url",value:{mimeType:l.mimeType,data:qe.wrap(l.data)}}:{type:"data",mimeType:l.mimeType,data:qe.wrap(l.data),audience:l.audience};if(l instanceof Wde)return{type:"tool_use",toolCallId:l.callId,name:l.name,parameters:l.input};if(l instanceof aI)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:n,content:s}}e.from=i})(F5o||={});var W5o;(e=>{function a(t){let o=t.content.map(s=>{if(s.type==="text")return new aI(s.value,s.audience);if(s.type==="tool_result"){let l=s.value.map(c=>c.type==="text"?new aI(c.value,c.audience):c.type==="data"?new iT(c.data.buffer,c.mimeType):new IK(c.value));return new Fde(s.toolCallId,l,s.isError)}else return s.type==="image_url"?new iT(s.value.data.buffer,s.value.mimeType):s.type==="data"?new iT(s.data.buffer,s.mimeType):s.type==="thinking"?new IEe(s.value,s.id,s.metadata):new Wde(s.toolCallId,s.name,s.parameters)}),n=P7e.to(t.role);return new B_t(n,o,t.name)}e.to=a;function i(t){let o=P7e.from(t.role),n=t.name,r=t.content;typeof r=="string"&&(r=[new aI(r)]);let s=r.map(l=>{if(l instanceof Fde)return{type:"tool_result",toolCallId:l.callId,value:di(l.content.map(c=>c instanceof aI?{type:"text",value:c.value,audience:c.audience}:c instanceof IK?{type:"prompt_tsx",value:c.value}:c instanceof iT?{type:"data",mimeType:c.mimeType,data:qe.wrap(c.data),audience:c.audience}:void 0)),isError:l.isError};if(l instanceof iT)return Goo(l)?{type:"image_url",value:{mimeType:l.mimeType,data:qe.wrap(l.data)}}:{type:"data",mimeType:l.mimeType,data:qe.wrap(l.data),audience:l.audience};if(l instanceof Wde)return{type:"tool_use",toolCallId:l.callId,name:l.name,parameters:l.input};if(l instanceof aI)return{type:"text",value:l.value};if(l instanceof IEe)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:n,content:s}}e.from=i})(W5o||={});function Goo(a){switch(typeof a.mimeType=="string"?a.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 Afi;(e=>{function a(t){return{kind:"markdownContent",content:dp.from(t.value)}}e.from=a;function i(t){return new UQe(dp.to(t.content))}e.to=i})(Afi||={});var qoo;(e=>{function a(t){return{kind:"codeblockUri",uri:t.value,isEdit:t.isEdit,undoStopId:t.undoStopId}}e.from=a;function i(t){return new ZQe(A.revive(t.uri),t.isEdit,t.undoStopId)}e.to=i})(qoo||={});var $oo;(e=>{function a(t){return{kind:"markdownVuln",content:dp.from(t.value),vulnerabilities:t.vulnerabilities}}e.from=a;function i(t){return new zQe(dp.to(t.content),t.vulnerabilities)}e.to=i})($oo||={});var joo;(i=>{function a(e){return{kind:"confirmation",title:e.title,message:dp.from(e.message),data:e.data,buttons:e.buttons}}i.from=a})(joo||={});var Qoo;(o=>{function a(n){switch(n){case 1:return"text";case 2:return"singleSelect";case 3:return"multiSelect";default:return"text"}}function i(n){switch(n){case"text":return 1;case"singleSelect":return 2;case"multiSelect":return 3;default:return 1}}function e(n){return{kind:"questionCarousel",questions:n.questions.map(r=>({id:r.id,type:a(r.type),title:r.title,message:r.message?dp.from(r.message):void 0,options:r.options?.map(s=>({id:s.id,label:s.label,value:String(s.value)})),defaultValue:r.defaultValue,allowFreeformInput:r.allowFreeformInput})),allowSkip:n.allowSkip}}o.from=e;function t(n){let r=n.questions.map(s=>new A_t(s.id,i(s.type),s.title,{message:s.message?typeof s.message=="string"?new eT(s.message):dp.to(s.message):void 0,options:s.options?.map(l=>({id:l.id,label:l.label,value:l.value})),defaultValue:s.defaultValue,allowFreeformInput:s.allowFreeformInput}));return new t6e(r,n.allowSkip)}o.to=t})(Qoo||={});var Nfi;(e=>{function a(t){let{value:o,baseUri:n}=t;function r(s,l){return s.map(c=>{let u=A.joinPath(l,c.name);return{label:c.name,uri:u,children:c.children&&r(c.children,u)}})}return{kind:"treeData",treeData:{label:He(n),uri:n,children:r(o,n)}}}e.from=a;function i(t){let o=$n(t.treeData);function n(l){return l.map(c=>({name:c.label,children:c.children&&n(c.children)}))}let r=o.uri,s=o.children?n(o.children):[];return new KQe(s,r)}e.to=i})(Nfi||={});var Yoo;(e=>{function a(t){return{kind:"multiDiffData",multiDiffData:{title:t.title,resources:t.value.map(o=>({originalUri:o.originalUri,modifiedUri:o.modifiedUri,goToFileUri:o.goToFileUri,added:o.added,removed:o.removed}))},readOnly:t.readOnly}}e.from=a;function i(t){let o=t.multiDiffData.resources.map(n=>({originalUri:n.originalUri?A.revive(n.originalUri):void 0,modifiedUri:n.modifiedUri?A.revive(n.modifiedUri):void 0,goToFileUri:n.goToFileUri?A.revive(n.goToFileUri):void 0,added:n.added,removed:n.removed}));return new GQe(o,t.multiDiffData.title,t.readOnly)}e.to=i})(Yoo||={});var Ofi;(e=>{function a(t){let o=r=>A.isUri(r),n=r=>"name"in r;return{kind:"inlineReference",name:t.title,inlineReference:o(t.value)?t.value:n(t.value)?xfi.from(t.value):W4.from(t.value)}}e.from=a;function i(t){let o=$n(t);return new qQe(A.isUri(o.inlineReference)?o.inlineReference:"location"in o.inlineReference?xfi.to(o.inlineReference):W4.to(o.inlineReference),t.name)}e.to=i})(Ofi||={});var Xoo;(e=>{function a(t){return{kind:"progressMessage",content:dp.from(t.value)}}e.from=a;function i(t){return new $Qe(t.content.value)}e.to=i})(Xoo||={});var Joo;(e=>{function a(t){return{kind:"thinking",value:t.value,id:t.id,metadata:t.metadata}}e.from=a;function i(t){return new jQe(t.value??"",t.id,t.metadata)}e.to=i})(Joo||={});var Zoo;(e=>{function a(t){return{kind:"hook",hookType:t.hookType,stopReason:t.stopReason,systemMessage:t.systemMessage,metadata:t.metadata}}e.from=a;function i(t){return new QQe(t.hookType,t.stopReason,t.systemMessage,t.metadata)}e.to=i})(Zoo||={});var eno;(e=>{function a(t){return{kind:"warning",content:dp.from(t.value)}}e.from=a;function i(t){return new YQe(t.content.value)}e.to=i})(eno||={});var tno;(i=>{function a(e){return{kind:"extensions",extensions:e.extensions}}i.from=a})(tno||={});var ino;(i=>{function a(e,t,o){let n;if(e.command)n=t.toInternal(e.command,o);else{if(!e.uri)throw new Error("Pull request part must have a command if URI is provided");n={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:n}}i.from=a})(ino||={});var ono;(e=>{function a(t){return{kind:"move",uri:t.uri,range:Ks.from(t.range)}}e.from=a;function i(t){return new e6e(A.revive(t.uri),Ks.to(t.range))}e.to=i})(ono||={});var nno;(l=>{function a(c){let u,p;c.toolSpecificData&&i(c.toolSpecificData)?(u=e(c.toolSpecificData,c.isError),p=void 0):p=c.toolSpecificData?t(c.toolSpecificData):void 0;let h=c.presentation==="hidden"?"hidden":c.presentation==="hiddenAfterComplete"?"hiddenAfterComplete":void 0;return c.enablePartialUpdate?{kind:"externalToolInvocationUpdate",toolCallId:c.toolCallId,toolName:c.toolName,isComplete:!!c.isComplete,invocationMessage:c.invocationMessage?dp.from(c.invocationMessage):void 0,pastTenseMessage:c.pastTenseMessage?dp.from(c.pastTenseMessage):void 0,toolSpecificData:p,subagentInvocationId:c.subAgentInvocationId,resultDetails:u}:{kind:"toolInvocationSerialized",toolCallId:c.toolCallId,toolId:c.toolName,invocationMessage:c.invocationMessage?dp.from(c.invocationMessage):c.toolName,originMessage:c.originMessage?dp.from(c.originMessage):void 0,pastTenseMessage:c.pastTenseMessage?dp.from(c.pastTenseMessage):void 0,isConfirmed:c.isConfirmed,isComplete:!0,source:kn.External,toolSpecificData:p,resultDetails:u,presentation:h,subAgentInvocationId:c.subAgentInvocationId}}l.from=a;function i(c){return c!==null&&typeof c=="object"&&"input"in c&&typeof c.input=="string"&&"output"in c&&Array.isArray(c.output)}function e(c,u){return{input:c.input,output:c.output.map(p=>{let h=p.mimeType.startsWith("text/");return{type:"embed",mimeType:p.mimeType,value:h?qe.wrap(p.data).toString():Yd(qe.wrap(p.data)),isText:h}}),isError:u??!1}}function t(c){return"command"in c&&"language"in c?{kind:"terminal",command:c.command,language:c.language}:"commandLine"in c&&"language"in c?{kind:"terminal",presentationOverrides:c.presentationOverrides&&typeof c.presentationOverrides.commandLine=="string"?{commandLine:c.presentationOverrides.commandLine,language:c.presentationOverrides.language}:void 0,commandLine:c.commandLine,language:c.language,terminalCommandOutput:typeof c.output?.text=="string"?{text:c.output.text}:void 0,terminalCommandState:c.state?{exitCode:c.state.exitCode,duration:c.state.duration}:void 0}:"todoList"in c&&Array.isArray(c.todoList)?{kind:"todoList",todoList:c.todoList.map(u=>({id:String(u.id),title:u.title,status:o(u.status)}))}:"input"in c&&"output"in c&&!Array.isArray(c.output)?{kind:"simpleToolInvocation",input:typeof c.input=="string"?c.input:"",output:typeof c.output=="string"?c.output:""}:c&&"values"in c&&Array.isArray(c.values)?{kind:"resources",values:c.values.map(u=>u instanceof J_?W4.from(u):A.revive(u))}:c instanceof L_t?{kind:"subagent",description:c.description,agentName:c.agentName,prompt:c.prompt,result:c.result}:c}function o(c){switch(c){case 1:return"not-started";case 2:return"in-progress";case 3:return"completed";default:return"not-started"}}function n(c){switch(c){case"not-started":return 1;case"in-progress":return 2;case"completed":return 3;default:return 1}}function r(c){let u=new o6e(c.toolId||c.toolName,c.toolCallId,c.errorMessage);return c.invocationMessage&&(u.invocationMessage=c.invocationMessage),c.originMessage&&(u.originMessage=c.originMessage),c.pastTenseMessage&&(u.pastTenseMessage=c.pastTenseMessage),c.isConfirmed!==void 0&&(u.isConfirmed=c.isConfirmed),c.isComplete!==void 0&&(u.isComplete=c.isComplete),c.toolSpecificData&&(u.toolSpecificData=s(c.toolSpecificData)),u.subAgentInvocationId=c.subAgentInvocationId,u.subAgentName=c.subAgentName,u}l.to=r;function s(c){if(c.kind==="terminal")if(c.commandLine){let u={commandLine:c.commandLine,language:c.language};return c.terminalCommandOutput&&(u.output={text:c.terminalCommandOutput.text,truncated:c.terminalCommandOutput.truncated,lineCount:c.terminalCommandOutput.lineCount}),c.terminalCommandState&&(u.state={exitCode:c.terminalCommandState.exitCode,duration:c.terminalCommandState.duration}),u}else return{command:c.command,language:c.language};else{if(c.kind==="terminal2")return{commandLine:c.commandLine,language:c.language};if(c.kind==="todoList")return{todoList:c.todoList.map((u,p)=>{let h=Number(u.id);return{id:Number.isFinite(h)?h:p,title:u.title,status:n(u.status)}})}}return c}})(nno||={});var V5o;(i=>{function a(e){return{kind:"progressTask",content:dp.from(e.value)}}i.from=a})(V5o||={});var B5o;(i=>{function a(e){return{kind:"progressTaskResult",content:typeof e=="string"?dp.from(e):void 0}}i.from=a})(B5o||={});var Ffi;(e=>{function a(t,o,n){return{kind:"command",command:o.toInternal(t.value,n)??{command:t.value.command,title:t.value.title}}}e.from=a;function i(t,o){return new XQe(o.fromInternal(t.command)??{command:t.command.id,title:t.command.title})}e.to=i})(Ffi||={});var rno;(e=>{function a(t){return{kind:"textEdit",uri:t.uri,edits:t.edits.map(o=>t2.from(o)),done:t.isDone}}e.from=a;function i(t){let o=new i6e(A.revive(t.uri),t.edits.map(n=>t2.to(n)));return o.isDone=t.done,o}e.to=i})(rno||={});var sno;(i=>{function a(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(R7e.from)}}i.from=a})(sno||={});var ano;(i=>{function a(e){return{kind:"notebookEdit",uri:e.uri,edits:e.edits.map(sno.from),done:e.isDone}}i.from=a})(ano||={});var lno;(i=>{function a(e){return{kind:"workspaceEdit",edits:e.edits.map(t=>({oldResource:t.oldResource,newResource:t.newResource}))}}i.from=a})(lno||={});var Wfi;(e=>{function a(t){let o=q.isThemeIcon(t.iconPath)?t.iconPath:A.isUri(t.iconPath)?{light:A.revive(t.iconPath)}:t.iconPath&&"light"in t.iconPath&&"dark"in t.iconPath&&A.isUri(t.iconPath.light)&&A.isUri(t.iconPath.dark)?{light:A.revive(t.iconPath.light),dark:A.revive(t.iconPath.dark)}:void 0;return typeof t.value=="object"&&"variableName"in t.value?{kind:"reference",reference:{variableName:t.value.variableName,value:A.isUri(t.value.value)||!t.value.value?t.value.value:W4.from(t.value.value)},iconPath:o,options:t.options}:{kind:"reference",reference:A.isUri(t.value)||typeof t.value=="string"?t.value:W4.from(t.value),iconPath:o,options:t.options}}e.from=a;function i(t){let o=$n(t),n=r=>A.isUri(r)?r:W4.to(r);return new JQe(typeof o.reference=="string"?o.reference:"variableName"in o.reference?{variableName:o.reference.variableName,value:o.reference.value&&n(o.reference.value)}:n(o.reference))}e.to=i})(Wfi||={});var cno;(i=>{function a(e){return{kind:"codeCitation",value:e.value,license:e.license,snippet:e.snippet}}i.from=a})(cno||={});var H5o;(t=>{function a(o,n,r){return o instanceof UQe?Afi.from(o):o instanceof qQe?Ofi.from(o):o instanceof JQe?Wfi.from(o):o instanceof $Qe?Xoo.from(o):o instanceof jQe?Joo.from(o):o instanceof QQe?Zoo.from(o):o instanceof KQe?Nfi.from(o):o instanceof GQe?Yoo.from(o):o instanceof XQe?Ffi.from(o,n,r):o instanceof i6e?rno.from(o):o instanceof N_t?ano.from(o):o instanceof zQe?$oo.from(o):o instanceof ZQe?qoo.from(o):o instanceof YQe?eno.from(o):o instanceof D_t?joo.from(o):o instanceof t6e?Qoo.from(o):o instanceof R_t?cno.from(o):o instanceof e6e?ono.from(o):o instanceof M_t?tno.from(o):o instanceof P_t?ino.from(o,n,r):o instanceof o6e?nno.from(o):o instanceof O_t?lno.from(o):{kind:"markdownContent",content:dp.from("")}}t.from=a;function i(o,n){switch(o.kind){case"reference":return Wfi.to(o);case"markdownContent":case"inlineReference":case"progressMessage":case"treeData":case"command":return e(o,n)}}t.to=i;function e(o,n){switch(o.kind){case"markdownContent":return Afi.to(o);case"inlineReference":return Ofi.to(o);case"progressMessage":return;case"treeData":return Nfi.to(o);case"command":return Ffi.to(o,n)}}t.toContent=e})(H5o||={});var U5o;(i=>{function a(e,t,o,n,r,s,l,c){let u=[],p=[];for(let f of e.variables.variables)f.kind==="tool"?u.push(f):f.kind==="toolset"?u.push(...f.value):p.push(f);let h=Jr.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:h,sessionResource:e.sessionResource,references:p.map(f=>uno.to(f,r,c)).filter(lo),toolReferences:u.map(AMt.to),location:dno.to(e.location),acceptedConfirmationData:e.acceptedConfirmationData,rejectedConfirmationData:e.rejectedConfirmationData,location2:t,toolInvocationToken:Object.freeze({sessionResource:e.sessionResource}),tools:s,model:o,modelConfiguration:n,editedFileEvents:e.editedFileEvents,modeInstructions:e.modeInstructions?.content,modeInstructions2:pno.to(e.modeInstructions),permissionLevel:e.permissionLevel,subAgentInvocationId:e.subAgentInvocationId,subAgentName:e.subAgentName,parentRequestId:e.parentRequestId,hasHooksEnabled:e.hasHooksEnabled??!1,hooks:e.hooks?vno.to(e.hooks):void 0};return Ua(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),Ua(l,"chatParticipantAdditions")||(delete g.acceptedConfirmationData,delete g.rejectedConfirmationData,delete g.tools),g}i.to=a})(U5o||={});var dno;(e=>{function a(t){switch(t){case"notebook":return 3;case"terminal":return 2;case"panel":return 1;case"editor":return 4}}e.to=a;function i(t){switch(t){case 3:return"notebook";case 2:return"terminal";case 1:return"panel";case 4:return"editor"}}e.from=i})(dno||={});var z5o;(i=>{function a(e){return e.id}i.from=a})(z5o||={});var uno;(i=>{function a(e,t,o){let n=e.value;if(!n){let s;try{s=JSON.stringify(e)}catch{s=`kind=${e.kind}, id=${e.id}, name=${e.name}`}o.error(`[ChatPromptReference] Ignoring invalid reference in variable: ${s}`);return}if(km(n))n=A.revive(n);else if(n&&typeof n=="object"&&"uri"in n&&"range"in n&&km(n.uri))n=W4.to($n(n));else if(bk(e)){let s=e.references?.[0]?.reference;n=new F_t(e.mimeType??"image/png",()=>Promise.resolve(new Uint8Array(Object.values(e.value))),s&&A.isUri(s)?s:void 0)}else if(e.kind==="diagnostic"){let s=e.filterSeverity&&PMt.to(e.filterSeverity),l=e.filterUri&&A.revive(e.filterUri).toString();n=new W_t(t.map(([c,u])=>e.filterUri&&c.toString()!==l?[c,[]]:[c,u.filter(p=>!(s&&p.severity>s||e.filterRange&&!z.areIntersectingOrTouching(e.filterRange,Ks.from(p.range))))]).filter(([,c])=>c.length>0))}let r;return(lD(e)||RK(e))&&e.toolReferences&&(r=Ufi.to(e.toolReferences)),{id:e.id,name:e.name,range:e.range&&[e.range.start,e.range.endExclusive],toolReferences:r,value:n,modelDescription:e.modelDescription}}i.to=a})(uno||={});var AMt;(i=>{function a(e){if(e.value)throw new Error("Invalid tool reference");return{name:e.id,range:e.range&&[e.range.start,e.range.endExclusive]}}i.to=a})(AMt||={});var Ufi;(i=>{function a(e){let t=[];for(let o of e)if(o.kind==="tool")t.push(AMt.to(o));else if(o.kind==="toolset")t.push(...o.value.map(AMt.to));else throw new Error("Invalid tool reference in prompt variables");return t}i.to=a})(Ufi||={});var pno;(e=>{function a(t){if(t)return{uri:A.revive(t.uri),name:t.name,content:t.content,toolReferences:Ufi.to($n(t.toolReferences)),metadata:t.metadata,isBuiltin:t.isBuiltin}}e.to=a;function i(t){if(t)return{uri:t.uri,name:t.name,content:t.content,toolReferences:t.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:t.metadata,isBuiltin:t.isBuiltin}}e.from=i})(pno||={});var K5o;(i=>{function a(e,t,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:t.toInternal(e.command,o)}}i.from=a})(K5o||={});var mno;(t=>{function a(o){return{errorDetails:o.errorDetails,metadata:e(o.metadata),nextQuestion:o.nextQuestion,details:o.details}}t.to=a;function i(o){return{errorDetails:o.errorDetails,metadata:o.metadata,nextQuestion:o.nextQuestion,details:o.details}}t.from=i;function e(o){return Fx(o,n=>{if(n.$mid===20)return new n6e(Fx(n.content,e));if(n.$mid===21)return new aI(n.value);if(n.$mid===22)return new IEe(n.value,n.id,n.metadata);if(n.$mid===23)return new IK(n.value);if(n.$mid===24)return new iT(n.data,n.mimeType,n.audience)})}})(mno||={});var G5o;(i=>{function a(e,t,o){if(t.action.kind==="vote")return;let n=mno.to(e);if(t.action.kind==="command"){let r=t.action.commandButton.command;return{action:{kind:"command",commandButton:{command:o.fromInternal(r)??{command:r.id,title:r.title}}},result:n}}else return t.action.kind==="followUp"?{action:{kind:"followUp",followup:Koo.to(t.action.followup)},result:n}:t.action.kind==="inlineChat"?{action:{kind:"editor",accepted:t.action.action==="accepted"},result:n}:t.action.kind==="chatEditingSessionAction"?{action:{kind:"chatEditingSessionAction",outcome:new Map([["accepted",1],["rejected",2],["saved",3]]).get(t.action.outcome)??2,uri:A.revive(t.action.uri),hasRemainingEdits:t.action.hasRemainingEdits},result:n}:t.action.kind==="chatEditingHunkAction"?{action:{kind:"chatEditingHunkAction",outcome:new Map([["accepted",1],["rejected",2]]).get(t.action.outcome)??2,uri:A.revive(t.action.uri),hasRemainingEdits:t.action.hasRemainingEdits,lineCount:t.action.lineCount,linesAdded:t.action.linesAdded,linesRemoved:t.action.linesRemoved},result:n}:{action:t.action,result:n}}i.to=a})(G5o||={});var q5o;(i=>{function a(e,t,o){return"terminalCommand"in e?{terminalCommand:e.terminalCommand,shouldExecute:e.shouldExecute}:"uri"in e?{uri:e.uri}:t.toInternal(e,o)}i.from=a})(q5o||={});var Vfi;(i=>{function a(e){return{...e,documentation:dp.fromStrict(e.documentation)}}i.from=a})(Vfi||={});var $5o;(i=>{function a(e,t){return Array.isArray(e)?{items:e.map(o=>Vfi.from(o))}:{items:e.items.map(o=>Vfi.from(o)),resourceOptions:e.resourceOptions?hno.from(e.resourceOptions,t):void 0}}i.from=a})($5o||={});var hno;(i=>{function a(e,t){return{...e,pathSeparator:t,cwd:e.cwd,globPattern:e2.from(e.globPattern)??void 0}}i.from=a})(hno||={});var j5o;(i=>{function a(e){return{kind:gno.to(e.kind),acceptedLength:e.acceptedLength}}i.to=a})(j5o||={});var gno;(i=>{function a(e){switch(e){case 0:return 1;case 1:return 2;case 2:return 3;default:return 0}}i.to=a})(gno||={});var Q5o;(i=>{function a(e,t){if(e.kind===2){let o=e.supersededBy?t(e.supersededBy):void 0;return{kind:2,supersededBy:o,userTypingDisagreed:e.userTypingDisagreed}}else if(e.kind===0)return{kind:0};return{kind:1}}i.to=a})(Q5o||={});var Y5o;(e=>{function a(t){return t===2?2:1}e.from=a;function i(t){return t===2?2:1}e.to=i})(Y5o||={});var X5o;(i=>{function a(e,t){return{id:t,label:e.label,description:e.description,canEdit:e.canEdit,collapsibleState:e.collapsibleState||0,contextValue:e.contextValue}}i.from=a})(X5o||={});var J5o;(i=>{function a(e){return e.type==="mcp"?new z_t(e.label,e.serverLabel||e.label,e.instructions):e.type==="extension"?new U_t(e.extensionId.value,e.label):void 0}i.to=a})(J5o||={});var Z5o;(e=>{function a(t){let o=new n6e(t.content.map(n=>n.kind==="text"?new aI(n.value,n.audience):n.kind==="data"?new iT(n.value.data.buffer,n.value.mimeType,n.audience):new IK(n.value)));return t.toolMetadata!==void 0&&(o.toolMetadata=t.toolMetadata),t.toolResultError&&(o.hasError=!!t.toolResultError),o}e.to=a;function i(t,o){t.toolResultMessage&&EQe(o,"chatParticipantPrivate");let n=c=>{c.audience&&EQe(o,"languageModelToolResultAudience")},r=!1,s;Array.isArray(t.toolResultDetails)?s=t.toolResultDetails?.map(c=>A.isUri(c)?c:W4.from(c)):t.toolResultDetails2&&(s={output:{type:"data",mimeType:t.toolResultDetails2.mime,value:qe.wrap(t.toolResultDetails2.value)}},r=!0);let l={content:t.content.map(c=>{if(c instanceof aI)return n(c),{kind:"text",value:c.value,audience:c.audience};if(c instanceof IK)return{kind:"promptTsx",value:c.value};if(c instanceof iT)return n(c),r=!0,{kind:"data",value:{mimeType:c.mimeType,data:qe.wrap(c.data)},audience:c.audience};throw new Error("Unknown LanguageModelToolResult part type")}),toolResultMessage:dp.fromStrict(t.toolResultMessage),toolResultDetails:s,toolMetadata:t.toolMetadata,toolResultError:t.hasError};return r?new ag(l):l}e.from=i})(Z5o||={});var fno;(t=>{function a(o){return o}t.fromThemeIcon=a;function i(o){if(o){if(q.isThemeIcon(o))return o;if(A.isUri(o))return o;if(typeof o=="string")return A.file(o);if(typeof o=="object"&&o!==null&&"dark"in o){let n=typeof o.dark=="string"?A.file(o.dark):o.dark,r=typeof o.light=="string"?A.file(o.light):o.light;return n?{dark:n,light:r??n}:void 0}else return}else return}t.from=i;function e(o){if(o){if(q.isThemeIcon(o))return o;if(km(o))return A.revive(o);{let n=o;return{light:A.revive(n.light),dark:A.revive(n.dark)}}}else return}t.to=e})(fno||={});var e4o;(e=>{function a(t){return{query:t.query,kind:i(t.kind),settings:t.settings}}e.fromSettingsSearchResult=a;function i(t){switch(t){case 1:return 1;case 2:return 2;case 3:return 3;default:throw new Error("Unknown AiSettingsSearchResultKind")}}})(e4o||={});var t4o;(t=>{function a(o){return!!o.uri}function i(o){return yA.toSerialized(a(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})}t.from=i;function e(o){let n=yA.fromSerialized(o.launch);if(n.type===2)return new G_t(o.label,n.uri,Object.fromEntries(n.headers),o.cacheNonce==="$$NONE"?void 0:o.cacheNonce);{let r=new K_t(o.label,n.command,[...n.args],Object.fromEntries(Object.entries(n.env).map(([s,l])=>[s,l===null?null:String(l)])),o.cacheNonce==="$$NONE"?void 0:o.cacheNonce);return n.cwd&&(r.cwd=A.file(n.cwd)),r}}t.to=e})(t4o||={});var i4o;(i=>{function a(e){switch(e){case 0:return 0;case 1:return 1;case 2:return 2;default:throw new Error("Unknown SourceControlInputBoxValidationType")}}i.from=a})(i4o||={});var vno;(i=>{function a(e){let t={};for(let[o,n]of Object.entries(e)){if(!n||n.length===0)continue;let r=[];for(let s of n){let l=bno.to(s);l&&r.push(l)}r.length>0&&(t[o]=r)}return t}i.to=a})(vno||={});var bno;(i=>{function a(e){let t=sfi(e,Po);if(t)return{command:t,cwd:e.cwd,env:e.env,timeout:e.timeout}}i.to=a})(bno||={});var o4o;(e=>{function a(t){if(t!==void 0)switch(t){case 0:return 0;case 1:return 1;case 2:return 2;case 3:return 3;default:return}}function i(t){let o=t.timing,n=o?.created??o?.startTime??0,r=o?.lastRequestStarted??o?.startTime,s=o?.lastRequestEnded??o?.endTime;return{resource:t.resource,label:t.label,description:t.description?dp.from(t.description):void 0,badge:t.badge?dp.from(t.badge):void 0,status:a(t.status),archived:t.archived,tooltip:dp.fromStrict(t.tooltip),timing:{created:n,lastRequestStarted:r,lastRequestEnded:s},changes:t.changes instanceof Array?t.changes:void 0,metadata:t.metadata}}e.from=i})(o4o||={});var Rue=class{constructor(){this.requestIdPool=0;this.dataTransferFiles=new Map}add(i){let e=this.requestIdPool++;return this.dataTransferFiles.set(e,di(Array.from(i,([,t])=>t.asFile()))),{id:e,dispose:()=>{this.dataTransferFiles.delete(e)}}}async resolveFileData(i,e){let t=this.dataTransferFiles.get(i);if(!t)throw new Error("No data transfer found");let o=t.find(n=>n.id===e);if(!o)throw new Error("No matching file found in data transfer");return qe.wrap(await o.data())}dispose(){this.dataTransferFiles.clear()}};function Ino(a){return typeof a=="string"?!1:Array.isArray(a)?a.every(Ino):!!a.exclusive}var FMt=class{constructor(i,e,t,o,n){this.uri=i;this.languageId=e;this.notebookUri=t;this.notebookType=o;this.recursive=n}equals(i){return this.notebookType===i.notebookType&&this.languageId===i.languageId&&this.uri.toString()===i.uri.toString()&&this.notebookUri?.toString()===i.notebookUri?.toString()&&this.recursive===i.recursive}},_d=class a{constructor(i){this._notebookInfoResolver=i;this._clock=0;this._entries=[];this._onDidChange=new E}get onDidChange(){return this._onDidChange.event}register(i,e){let t={selector:i,provider:e,_score:-1,_time:this._clock++};return this._entries.push(t),this._lastCandidate=void 0,this._onDidChange.fire(this._entries.length),Z(()=>{if(t){let o=this._entries.indexOf(t);o>=0&&(this._entries.splice(o,1),this._lastCandidate=void 0,this._onDidChange.fire(this._entries.length),t=void 0)}})}has(i){return this.all(i).length>0}all(i){if(!i)return[];this._updateScores(i,!1);let e=[];for(let t of this._entries)t._score>0&&e.push(t.provider);return e}allNoModel(){return this._entries.map(i=>i.provider)}get registeredLanguageIds(){let i=new Set;for(let e of this._entries)Tpi(e.selector,i);return i}ordered(i,e=!1){let t=[];return this._orderedForEach(i,e,o=>t.push(o.provider)),t}orderedGroups(i){let e=[],t,o;return this._orderedForEach(i,!1,n=>{t&&o===n._score?t.push(n.provider):(o=n._score,t=[n.provider],e.push(t))}),e}_orderedForEach(i,e,t){this._updateScores(i,e);for(let o of this._entries)o._score>0&&t(o)}_updateScores(i,e){let t=this._notebookInfoResolver?.(i.uri),o=t?new FMt(i.uri,i.getLanguageId(),t.uri,t.type,e):new FMt(i.uri,i.getLanguageId(),void 0,void 0,e);if(!this._lastCandidate?.equals(o)){this._lastCandidate=o;for(let n of this._entries)if(n._score=fB(n.selector,o.uri,o.languageId,Hx(i),o.notebookUri,o.notebookType),Ino(n.selector)&&n._score>0)if(e)n._score=0;else{for(let r of this._entries)r._score=0;n._score=1e3;break}this._entries.sort(a._compareByScoreAndTime)}}static _compareByScoreAndTime(i,e){return i._score<e._score?1:i._score>e._score?-1:F7e(i.selector)&&!F7e(e.selector)?1:!F7e(i.selector)&&F7e(e.selector)?-1:i._time<e._time?1:i._time>e._time?-1:0}};function F7e(a){return typeof a=="string"?!1:Array.isArray(a)?a.some(F7e):!!a.isBuiltin}var Pue=new _d,Mue=class a{constructor(i,e,t,o){this.id=i;this.provider=e;this.roots=t;this.ref=o;this.root=t[0]}static async create(i,e,t){let[o]=Pue.ordered(i);if(!o)return;let n=await o.prepareCallHierarchy(i,e,t);if(n)return new a(n.roots.reduce((r,s)=>r+s._sessionId,""),o,n.roots,new s1(n))}dispose(){this.ref.release()}fork(i){let e=this;return new class extends a{constructor(){super(e.id,e.provider,[i],e.ref.acquire())}}}async resolveIncomingCalls(i,e){try{let t=await this.provider.provideIncomingCalls(i,e);if(yr(t))return t}catch(t){ys(t)}return[]}async resolveOutgoingCalls(i,e){try{let t=await this.provider.provideOutgoingCalls(i,e);if(yr(t))return t}catch(t){ys(t)}return[]}},W7e=new Map;$e.registerCommand("_executePrepareCallHierarchy",async(a,...i)=>{let[e,t]=i;wo(A.isUri(e)),wo(ye.isIPosition(t));let n=a.get(Tt).getModel(e),r;if(!n){let l=await a.get(Bt).createModelReference(e);n=l.object.textEditorModel,r=l}try{let s=await Mue.create(n,t,Se.None);return s?(W7e.set(s.id,s),W7e.forEach((l,c,u)=>{u.size>10&&(l.dispose(),W7e.delete(c))}),[s.root]):[]}finally{r?.dispose()}});function yno(a){return!0}$e.registerCommand("_executeProvideIncomingCalls",async(a,...i)=>{let[e]=i;wo(yno(e));let t=W7e.get(e._sessionId);return t?t.resolveIncomingCalls(e,Se.None):[]});$e.registerCommand("_executeProvideOutgoingCalls",async(a,...i)=>{let[e]=i;wo(yno(e));let t=W7e.get(e._sessionId);return t?t.resolveOutgoingCalls(e,Se.None):[]});var WMt;(t=>{let a=[];function i(o){let n=o;return n&&a.push(n),{dispose(){if(n){let r=a.indexOf(n);r>=0&&(a.splice(r,1),n=void 0)}}}}t.register=i;function e(){return a.slice(0)}t.all=e})(WMt||={});var zfi=class{constructor(i,e){this.symbol=i;this.provider=e}};async function VMt(a,i=Se.None){let e=[],t=WMt.all().map(async n=>{try{let r=await n.provideWorkspaceSymbols(a,i);if(!r)return;for(let s of r)e.push(new zfi(s,n))}catch(r){ys(r)}});if(await Promise.all(t),i.isCancellationRequested)return[];function o(n,r){let s=Hl(n.symbol.name,r.symbol.name);return s===0&&(s=n.symbol.kind-r.symbol.kind),s===0&&(s=Hl(n.symbol.location.uri.toString(),r.symbol.location.uri.toString())),s===0&&(n.symbol.location.range&&r.symbol.location.range?z.areIntersecting(n.symbol.location.range,r.symbol.location.range)||(s=z.compareRangesUsingStarts(n.symbol.location.range,r.symbol.location.range)):n.provider.resolveWorkspaceSymbol&&!r.provider.resolveWorkspaceSymbol?s=-1:!n.provider.resolveWorkspaceSymbol&&r.provider.resolveWorkspaceSymbol&&(s=1)),s===0&&(s=Hl(n.symbol.containerName??"",r.symbol.containerName??"")),s}return Jg(e,o).map(n=>n[0]).flat()}function UJ(a){let i=a.get(ee),e=a.get(Pe),t=a.get(fe);return i.editors.map(n=>po.getOriginalUri(n,{supportSideBySide:1})).filter(n=>!!n&&!e.isInsideWorkspace(n)&&t.hasProvider(n))}var wno=/\s?[#:\(](?:line )?(\d*)(?:[#:,](\d*))?\)?:?\s*$/;function Cno(a,i){if(!a||i?.some(o=>{let n=a.indexOf(o);return n===0||n>0&&!wno.test(a.substring(n+1))}))return;let e,t=wno.exec(a);if(t){let o=parseInt(t[1]??"",10);if(Yo(o)){e={startLineNumber:o,startColumn:1,endLineNumber:o,endColumn:1};let n=parseInt(t[2]??"",10);Yo(n)&&(e={startLineNumber:e.startLineNumber,startColumn:n,endLineNumber:e.endLineNumber,endColumn:n})}else t[1]===""&&(e={startLineNumber:1,startColumn:1,endLineNumber:1,endColumn:1})}if(t&&e)return{filter:a.substr(0,t.index),range:e}}var n_e=new Y("searchState",0);var Nue=new _d,Aue=class a{constructor(i,e,t,o){this.id=i;this.provider=e;this.roots=t;this.ref=o;this.root=t[0]}static async create(i,e,t){let[o]=Nue.ordered(i);if(!o)return;let n=await o.prepareTypeHierarchy(i,e,t);if(n)return new a(n.roots.reduce((r,s)=>r+s._sessionId,""),o,n.roots,new s1(n))}dispose(){this.ref.release()}fork(i){let e=this;return new class extends a{constructor(){super(e.id,e.provider,[i],e.ref.acquire())}}}async provideSupertypes(i,e){try{let t=await this.provider.provideSupertypes(i,e);if(yr(t))return t}catch(t){ys(t)}return[]}async provideSubtypes(i,e){try{let t=await this.provider.provideSubtypes(i,e);if(yr(t))return t}catch(t){ys(t)}return[]}},V7e=new Map;$e.registerCommand("_executePrepareTypeHierarchy",async(a,...i)=>{let[e,t]=i;wo(A.isUri(e)),wo(ye.isIPosition(t));let n=a.get(Tt).getModel(e),r;if(!n){let l=await a.get(Bt).createModelReference(e);n=l.object.textEditorModel,r=l}try{let s=await Aue.create(n,t,Se.None);if(!s)return[];V7e.forEach((l,c,u)=>{u.size>10&&(l.dispose(),V7e.delete(c))});for(let l of s.roots)V7e.set(l._sessionId,s);return s.roots}finally{r?.dispose()}});function xno(a){let i=a;return typeof a=="object"&&typeof i.name=="string"&&typeof i.kind=="number"&&A.isUri(i.uri)&&z.isIRange(i.range)&&z.isIRange(i.selectionRange)}$e.registerCommand("_executeProvideSupertypes",async(a,...i)=>{let[e]=i;wo(xno(e));let t=V7e.get(e._sessionId);return t?t.provideSupertypes(e,Se.None):[]});$e.registerCommand("_executeProvideSubtypes",async(a,...i)=>{let[e]=i;wo(xno(e));let t=V7e.get(e._sessionId);return t?t.provideSubtypes(e,Se.None):[]});var xS=le("aiEditTelemetryService");var kno="VSCode.ABExp.FeatureData",Eno=3600*1e3;var Tno=(h=>(h.Market="X-MSEdge-Market",h.CorpNet="X-FD-Corpnet",h.ApplicationVersion="X-VSCode-AppVersion",h.Build="X-VSCode-Build",h.ClientId="X-MSEdge-ClientId",h.DeveloperDeviceId="X-VSCode-DevDeviceId",h.ExtensionName="X-VSCode-ExtensionName",h.ExtensionVersion="X-VSCode-ExtensionVersion",h.Language="X-VSCode-Language",h.TargetPopulation="X-VSCode-TargetPopulation",h.Platform="X-VSCode-Platform",h.ReleaseDate="X-VSCode-ReleaseDate",h))(Tno||{}),BMt=class a{constructor(i,e,t,o,n,r){this.version=i;this.appName=e;this.machineId=t;this.devDeviceId=o;this.targetPopulation=n;this.releaseDate=r}static trimVersionSuffix(i){let e=/\-[a-zA-Z0-9]+$/;return i.split(e)[0]}getFilterValue(i){switch(i){case"X-VSCode-AppVersion":return a.trimVersionSuffix(this.version);case"X-VSCode-Build":return this.appName;case"X-MSEdge-ClientId":return this.machineId;case"X-VSCode-DevDeviceId":return this.devDeviceId;case"X-VSCode-Language":return wr;case"X-VSCode-ExtensionName":return"vscode-core";case"X-VSCode-ExtensionVersion":return"999999.0";case"X-VSCode-TargetPopulation":return this.targetPopulation;case"X-VSCode-Platform":return u_(om);case"X-VSCode-ReleaseDate":return a.formatReleaseDate(this.releaseDate);default:return""}}static formatReleaseDate(i){if(!i)return"";let e=/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2})/.exec(i);return e?e.slice(1,5).join(""):""}getFilters(){let i=new Map,e=Object.values(Tno);for(let t of e)i.set(t,this.getFilterValue(t));return i}};function HMt(a){let i=a?.includes("Visual-Studio-Code"),e=a?.includes("github"),t=a?.includes("microsoft")||a?.includes("ms-copilot")||a?.includes("MicrosoftCopilot");return i?"vscode":e?"github":t?"microsoft":void 0}var _no=(l=>(l.CopilotExtensionVersion="X-Copilot-RelatedPluginVersion-githubcopilot",l.CopilotChatExtensionVersion="X-Copilot-RelatedPluginVersion-githubcopilotchat",l.CompletionsVersionInCopilotChat="X-VSCode-CompletionsInChatExtensionVersion",l.CopilotSku="X-GitHub-Copilot-SKU",l.MicrosoftInternalOrg="X-Microsoft-Internal-Org",l.CopilotTrackingId="X-Copilot-Tracking-Id",l.CopilotIsSn="X-GitHub-Copilot-IsSn",l.CopilotIsFcv1="X-GitHub-Copilot-IsFcv1",l))(_no||{});var o2=class extends x{constructor(e,t,o,n,r){super();this._extensionService=e;this._logService=t;this._storageService=o;this._chatEntitlementService=n;this._defaultAccountService=r;this._onDidChangeFilters=this._register(new E);this.onDidChangeFilters=this._onDidChangeFilters.event;this.copilotExtensionVersion=this._storageService.get("extensionsAssignmentFilterProvider.copilotExtensionVersion",0),this.copilotChatExtensionVersion=this._storageService.get("extensionsAssignmentFilterProvider.copilotChatExtensionVersion",0),this.copilotCompletionsVersion=this._storageService.get("extensionsAssignmentFilterProvider.copilotCompletionsVersion",0),this.copilotSku=this._storageService.get("extensionsAssignmentFilterProvider.copilotSku",0),this.copilotInternalOrg=this._storageService.get("extensionsAssignmentFilterProvider.copilotInternalOrg",0),this.copilotTrackingId=this._storageService.get("extensionsAssignmentFilterProvider.copilotTrackingId",0),this.copilotIsSn=this._storageService.get("extensionsAssignmentFilterProvider.copilotIsSn",0),this.copilotIsFcv1=this._storageService.get("extensionsAssignmentFilterProvider.copilotIsFcv1",0),this._register(this._extensionService.onDidChangeExtensionsStatus(s=>{s.some(l=>Ii.equals(l,"github.copilot")||Ii.equals(l,"github.copilot-chat"))&&this.updateExtensionVersions()})),this._register(this._chatEntitlementService.onDidChangeEntitlement(()=>{this.updateCopilotEntitlementInfo()})),this._register(this._defaultAccountService.onDidChangeCopilotTokenInfo(()=>{this.updateCopilotTokenInfo()})),this.updateExtensionVersions(),this.updateCopilotEntitlementInfo(),this.updateCopilotTokenInfo()}async updateExtensionVersions(){let e,t,o;try{let[n,r]=await Promise.all([this._extensionService.getExtension("github.copilot"),this._extensionService.getExtension("github.copilot-chat")]);e=n?.version,t=r?.version,o=r?.completionsCoreVersion}catch(n){this._logService.error("Failed to update extension version assignments",n)}this.copilotCompletionsVersion===o&&this.copilotExtensionVersion===e&&this.copilotChatExtensionVersion===t||(this.copilotExtensionVersion=e,this.copilotChatExtensionVersion=t,this.copilotCompletionsVersion=o,this._storageService.store("extensionsAssignmentFilterProvider.copilotExtensionVersion",this.copilotExtensionVersion,0,1),this._storageService.store("extensionsAssignmentFilterProvider.copilotChatExtensionVersion",this.copilotChatExtensionVersion,0,1),this._storageService.store("extensionsAssignmentFilterProvider.copilotCompletionsVersion",this.copilotCompletionsVersion,0,1),this._onDidChangeFilters.fire())}updateCopilotEntitlementInfo(){let e=this._chatEntitlementService.sku,t=this._chatEntitlementService.copilotTrackingId,o=HMt(this._chatEntitlementService.organisations);this.copilotSku===e&&this.copilotInternalOrg===o&&this.copilotTrackingId===t||(this.copilotSku=e,this.copilotInternalOrg=o,this.copilotTrackingId=t,this._storageService.store("extensionsAssignmentFilterProvider.copilotSku",this.copilotSku,0,1),this._storageService.store("extensionsAssignmentFilterProvider.copilotInternalOrg",this.copilotInternalOrg,0,1),this._storageService.store("extensionsAssignmentFilterProvider.copilotTrackingId",this.copilotTrackingId,0,1),this._onDidChangeFilters.fire())}updateCopilotTokenInfo(){let e=this._defaultAccountService.copilotTokenInfo,t=e?.sn==="1"?"1":"0",o=e?.fcv1==="1"?"1":"0";this.copilotIsSn===t&&this.copilotIsFcv1===o||(this.copilotIsSn=t,this.copilotIsFcv1=o,this._storageService.store("extensionsAssignmentFilterProvider.copilotIsSn",this.copilotIsSn,0,1),this._storageService.store("extensionsAssignmentFilterProvider.copilotIsFcv1",this.copilotIsFcv1,0,1),this._onDidChangeFilters.fire())}static trimVersionSuffix(e){let t=/\-[a-zA-Z0-9]+$/;return e.split(t)[0]}getFilterValue(e){switch(e){case"X-Copilot-RelatedPluginVersion-githubcopilot":return this.copilotExtensionVersion?o2.trimVersionSuffix(this.copilotExtensionVersion):null;case"X-VSCode-CompletionsInChatExtensionVersion":return this.copilotCompletionsVersion?o2.trimVersionSuffix(this.copilotCompletionsVersion):null;case"X-Copilot-RelatedPluginVersion-githubcopilotchat":return this.copilotChatExtensionVersion?o2.trimVersionSuffix(this.copilotChatExtensionVersion):null;case"X-GitHub-Copilot-SKU":return this.copilotSku??null;case"X-Microsoft-Internal-Org":return this.copilotInternalOrg??null;case"X-Copilot-Tracking-Id":return this.copilotTrackingId??null;case"X-GitHub-Copilot-IsSn":return this.copilotIsSn??null;case"X-GitHub-Copilot-IsFcv1":return this.copilotIsFcv1??null;default:return null}}getFilters(){let e=new Map,t=Object.values(_no);for(let o of t)e.set(o,this.getFilterValue(o));return e}};o2=I([m(0,lt),m(1,se),m(2,ce),m(3,rr),m(4,ng)],o2);function UMt(a,i,e){return JE(a)===3&&!!i.tasConfig&&!e.disableExperiments&&!e.extensionTestsLocationURI&&!e.enableSmokeTestDriver&&a.getValue("workbench.enableExperiments")===!0}var yD=le("assignmentService"),Kfi=class{constructor(i){this.memento=i;this.mementoObj=i.getMemento(-1,1)}async getValue(i,e){return await this.mementoObj[i]||e}setValue(i,e){this.mementoObj[i]=e,this.memento.saveMemento()}},Gfi=class extends x{constructor(e,t){super();this.telemetryService=e;this.productService=t;this._onDidUpdateAssignmentContext=this._register(new E);this.onDidUpdateAssignmentContext=this._onDidUpdateAssignmentContext.event;this._assignmentFilters=[];this._assignmentFilterDisposables=this._register(new N)}get assignmentContext(){return this._lastAssignmentContext?.split(";")}_filterAssignmentContext(e){return e.split(";").filter(n=>{for(let r of this._assignmentFilters)if(r.exclude(n))return!1;return!0}).join(";")}_setAssignmentContext(e){let t=this._filterAssignmentContext(e);this._lastAssignmentContext=t,this._onDidUpdateAssignmentContext.fire(),this.productService.tasConfig?.assignmentContextTelemetryPropertyName&&this.telemetryService.setExperimentProperty(this.productService.tasConfig.assignmentContextTelemetryPropertyName,t)}addAssignmentFilter(e){this._assignmentFilters.push(e),this._assignmentFilterDisposables.add(e.onDidChange(()=>{this._previousAssignmentContext&&this._setAssignmentContext(this._previousAssignmentContext)})),this._previousAssignmentContext&&this._setAssignmentContext(this._previousAssignmentContext)}setSharedProperty(e,t){if(e===this.productService.tasConfig?.assignmentContextTelemetryPropertyName)return this._previousAssignmentContext=t,this._setAssignmentContext(t);this.telemetryService.setExperimentProperty(e,t)}postEvent(e,t){let o={};for(let[n,r]of t.entries())o[n]=r;this.telemetryService.publicLog(e,o)}},B7e=class extends x{constructor(e,t,o,n,r,s){super();this.telemetryService=e;this.configurationService=o;this.productService=n;this.instantiationService=s;this.tasSetupDisposables=new N;this.networkInitialized=!1;this._onDidRefetchAssignments=this._register(new E);this.onDidRefetchAssignments=this._onDidRefetchAssignments.event;this.experimentsEnabled=UMt(o,n,r),this.experimentsEnabled&&(this.tasClient=this.setupTASClient()),this.telemetry=this._register(new Gfi(e,n)),this._register(this.telemetry.onDidUpdateAssignmentContext(()=>this._onDidRefetchAssignments.fire())),this._register(this.configurationService.onDidChangeConfiguration(u=>{u.affectsConfiguration("experiments.override")&&this._onDidRefetchAssignments.fire()})),this.keyValueStorage=new Kfi(new Al("experiment.service.memento",t));let l=o.getValue("experiments.overrideDelay"),c=typeof l=="number"?l:0;this.overrideInitDelay=Li(c)}async getTreatment(e){let t=await this.doGetTreatment(e);return this.telemetryService.publicLog2("tasClientReadTreatmentComplete",{treatmentName:e,treatmentValue:JSON.stringify(t)}),t}async doGetTreatment(e){await this.overrideInitDelay;let t=this.configurationService.getValue(`experiments.override.${e}`);if(t!==void 0)return t;if(!this.tasClient||!this.experimentsEnabled)return;let o,n=await this.tasClient;return this.networkInitialized?o=n.getTreatmentVariable("vscode",e):o=await n.getTreatmentVariableAsync("vscode",e,!0),o=n.getTreatmentVariable("vscode",e),o}async setupTASClient(){this.tasSetupDisposables.clear();let e=this.productService.quality==="stable"?"public":this.productService.quality==="exploration"?"exploration":"insider",t=new BMt(this.productService.version,this.productService.nameLong,this.telemetryService.machineId,this.telemetryService.devDeviceId,e,this.productService.date??""),o=this.instantiationService.createInstance(o2);this.tasSetupDisposables.add(o),this.tasSetupDisposables.add(o.onDidChangeFilters(()=>this.refetchAssignments()));let n=this.productService.tasConfig,r=new(await Pg("tas-client","dist/tas-client.min.js")).ExperimentationService({filterProviders:[t,o],telemetry:this.telemetry,storageKey:kno,keyValueStorage:this.keyValueStorage,assignmentContextTelemetryPropertyName:n.assignmentContextTelemetryPropertyName,telemetryEventName:n.telemetryEventName,endpoint:n.endpoint,refetchInterval:Eno});return await r.initializePromise,r.initialFetch.then(()=>{this.networkInitialized=!0}),r}async refetchAssignments(){if(!this.tasClient)return;let e=await this.tasClient;await e.initialFetch,await e.getTreatmentVariableAsync("vscode","refresh",!1)}async getCurrentExperiments(){if(this.tasClient&&this.experimentsEnabled)return await this.tasClient,this.telemetry.assignmentContext}addTelemetryAssignmentFilter(e){this.telemetry.addAssignmentFilter(e)}};B7e=I([m(0,Te),m(1,ce),m(2,B),m(3,tt),m(4,At),m(5,F)],B7e);Ee(yD,B7e,1);var a4o=ne.as(Jt.Configuration);a4o.registerConfiguration({...Ud,properties:{"workbench.enableExperiments":{type:"boolean",description:d(17369,null),default:!0,scope:1,restricted:!0,tags:["usesOnlineServices"]}}});var qfi=le("inlineCompletionsUnificationService"),l4o="cmp-cht-",Dno="cmp-ext-",c4o="inlineCompletionsUnificationCode",d4o="inlineCompletionsUnificationModel",u4o=new Y("isRunningUnificationExperiment",!1),zMt="chat.extensionUnification.enabled",H7e=class extends x{constructor(e,t,o,n,r,s,l){super();this._assignmentService=e;this._contextKeyService=t;this._configurationService=o;this._extensionEnablementService=n;this._extensionManagementService=r;this._extensionService=s;this._state=new KMt(!1,!1,!1,[]);this._onDidStateChange=this._register(new E);this.onDidStateChange=this._onDidStateChange.event;this._onDidChangeExtensionUnificationState=this._register(new E);this._onDidChangeExtensionUnificationSetting=this._register(new E);this._completionsExtensionId=l.defaultChatAgent?.extensionId.toLowerCase(),this._chatExtensionId=l.defaultChatAgent?.chatExtensionId.toLowerCase();let c=[this._completionsExtensionId,this._chatExtensionId].filter(u=>!!u);this.isRunningUnificationExperiment=u4o.bindTo(this._contextKeyService),this._assignmentService.addTelemetryAssignmentFilter({exclude:u=>u.startsWith(Dno)&&this._state.extensionUnification!==this._configurationService.getValue(zMt),onDidChange:U.any(this._onDidChangeExtensionUnificationState.event,this._onDidChangeExtensionUnificationSetting.event)}),this._register(this._extensionEnablementService.onEnablementChanged(u=>{u.some(p=>c.includes(p.identifier.id.toLowerCase()))&&this._update()})),this._register(this._configurationService.onDidChangeConfiguration(u=>{u.affectsConfiguration(zMt)&&(this._update(),this._onDidChangeExtensionUnificationSetting.fire())})),this._register(this._extensionService.onDidChangeExtensions(({added:u})=>{u.some(p=>c.includes(p.identifier.value.toLowerCase()))&&this._update()})),this._register(this._assignmentService.onDidRefetchAssignments(()=>this._update())),this._update()}get state(){return this._state}async _update(){let[e,t,o]=await Promise.all([this._assignmentService.getTreatment(c4o),this._assignmentService.getTreatment(d4o),this._isExtensionUnificationActive()]),n=this._configurationService.getValue(zMt)===o,r=await this._assignmentService.getCurrentExperiments(),s=new KMt(e===!0,t===!0,o,r?.filter(c=>c.startsWith(l4o)||n&&c.startsWith(Dno))??[]);if(this._state.equals(s))return;let l=this._state;this._state=s,this.isRunningUnificationExperiment.set(this._state.codeUnification||this._state.modelUnification||this._state.extensionUnification),this._onDidStateChange.fire(),l.extensionUnification!==this._state.extensionUnification&&this._onDidChangeExtensionUnificationState.fire()}async _isExtensionUnificationActive(){if(!this._configurationService.getValue(zMt)||!this._completionsExtensionId||!this._chatExtensionId)return!1;let[e,t,o]=await Promise.all([this._extensionService.getExtension(this._completionsExtensionId),this._extensionService.getExtension(this._chatExtensionId),this._extensionManagementService.getInstalled(1)]);if(!t||e)return!1;let n=o.filter(s=>s.identifier.id.toLowerCase()===this._completionsExtensionId);if(n.length===0)return!0;let r=n.some(s=>this._extensionEnablementService.getEnablementState(s)===9);return!!t&&r}};H7e=I([m(0,yD),m(1,X),m(2,B),m(3,Js),m(4,Cs),m(5,lt),m(6,tt)],H7e);var KMt=class{constructor(i,e,t,o){this.codeUnification=i;this.modelUnification=e;this.extensionUnification=t;this.expAssignments=o}equals(i){return this.codeUnification===i.codeUnification&&this.modelUnification===i.modelUnification&&this.extensionUnification===i.extensionUnification&&$i(this.expAssignments,i.expAssignments)}};Ee(qfi,H7e,1);var Kd=class extends x{constructor(e,t,o,n,r,s,l){super();this._languageService=t;this._languageConfigurationService=o;this._languageFeaturesService=n;this._uriIdentService=r;this._instantiationService=s;this._inlineCompletionsUnificationService=l;this._registrations=this._register(new Vt);this._pasteEditProviders=new Map;this._documentOnDropEditProviders=new Map;if(this._proxy=e.getProxy(to.ExtHostLanguageFeatures),this._languageService){let c=()=>{let u=[];for(let p of t.getRegisteredLanguageIds()){let h=this._languageConfigurationService.getLanguageConfiguration(p).getWordDefinition();u.push({languageId:p,regexSource:h.source,regexFlags:h.flags})}this._proxy.$setWordDefinitions(u)};this._register(this._languageConfigurationService.onDidChange(u=>{if(!u.languageId)c();else{let p=this._languageConfigurationService.getLanguageConfiguration(u.languageId).getWordDefinition();this._proxy.$setWordDefinitions([{languageId:u.languageId,regexSource:p.source,regexFlags:p.flags}])}})),c()}this._inlineCompletionsUnificationService&&(this._register(this._inlineCompletionsUnificationService.onDidStateChange(()=>{this._proxy.$acceptInlineCompletionsUnificationState(this._inlineCompletionsUnificationService.state)})),this._proxy.$acceptInlineCompletionsUnificationState(this._inlineCompletionsUnificationService.state))}$unregister(e){this._registrations.deleteAndDispose(e)}static _reviveLocationDto(e){return e&&(Array.isArray(e)?(e.forEach(t=>Kd._reviveLocationDto(t)),e):(e.uri=A.revive(e.uri),e))}static _reviveLocationLinkDto(e){return e&&(Array.isArray(e)?(e.forEach(t=>Kd._reviveLocationLinkDto(t)),e):(e.uri=A.revive(e.uri),e))}static _reviveWorkspaceSymbolDto(e){return e&&(Array.isArray(e)?(e.forEach(Kd._reviveWorkspaceSymbolDto),e):(e.location=Kd._reviveLocationDto(e.location),e))}static _reviveCodeActionDto(e,t){return e?.forEach(o=>yB(o.edit,t)),e}static _reviveLinkDTO(e){return e.url&&typeof e.url!="string"&&(e.url=A.revive(e.url)),e}static _reviveCallHierarchyItemDto(e){return e&&(e.uri=A.revive(e.uri)),e}static _reviveTypeHierarchyItemDto(e){return e&&(e.uri=A.revive(e.uri)),e}$registerDocumentSymbolProvider(e,t,o){this._registrations.set(e,this._languageFeaturesService.documentSymbolProvider.register(t,{displayName:o,provideDocumentSymbols:(n,r)=>this._proxy.$provideDocumentSymbols(e,n.uri,r)}))}$registerCodeLensSupport(e,t,o){let n={provideCodeLenses:async(r,s)=>{let l=await this._proxy.$provideCodeLenses(e,r.uri,s);if(l)return{lenses:l.lenses,dispose:()=>l.cacheId&&this._proxy.$releaseCodeLenses(e,l.cacheId)}},resolveCodeLens:async(r,s,l)=>{let c=await this._proxy.$resolveCodeLens(e,s,l);if(!(!c||l.isCancellationRequested))return{...c,range:r.validateRange(c.range)}}};if(typeof o=="number"){let r=new E;this._registrations.set(o,r),n.onDidChange=r.event}this._registrations.set(e,this._languageFeaturesService.codeLensProvider.register(t,n))}$emitCodeLensEvent(e,t){let o=this._registrations.get(e);o instanceof E&&o.fire(t)}$registerDefinitionSupport(e,t){this._registrations.set(e,this._languageFeaturesService.definitionProvider.register(t,{provideDefinition:(o,n,r)=>this._proxy.$provideDefinition(e,o.uri,n,r).then(Kd._reviveLocationLinkDto)}))}$registerDeclarationSupport(e,t){this._registrations.set(e,this._languageFeaturesService.declarationProvider.register(t,{provideDeclaration:(o,n,r)=>this._proxy.$provideDeclaration(e,o.uri,n,r).then(Kd._reviveLocationLinkDto)}))}$registerImplementationSupport(e,t){this._registrations.set(e,this._languageFeaturesService.implementationProvider.register(t,{provideImplementation:(o,n,r)=>this._proxy.$provideImplementation(e,o.uri,n,r).then(Kd._reviveLocationLinkDto)}))}$registerTypeDefinitionSupport(e,t){this._registrations.set(e,this._languageFeaturesService.typeDefinitionProvider.register(t,{provideTypeDefinition:(o,n,r)=>this._proxy.$provideTypeDefinition(e,o.uri,n,r).then(Kd._reviveLocationLinkDto)}))}$registerHoverProvider(e,t){this._registrations.set(e,this._languageFeaturesService.hoverProvider.register(t,{provideHover:async(o,n,r,s)=>{let l={verbosityRequest:s?.verbosityRequest?{verbosityDelta:s.verbosityRequest.verbosityDelta,previousHover:{id:s.verbosityRequest.previousHover.id}}:void 0};return await this._proxy.$provideHover(e,o.uri,n,l,r)}}))}$registerEvaluatableExpressionProvider(e,t){this._registrations.set(e,this._languageFeaturesService.evaluatableExpressionProvider.register(t,{provideEvaluatableExpression:(o,n,r)=>this._proxy.$provideEvaluatableExpression(e,o.uri,n,r)}))}$registerInlineValuesProvider(e,t,o){let n={provideInlineValues:(r,s,l,c)=>this._proxy.$provideInlineValues(e,r.uri,s,l,c)};if(typeof o=="number"){let r=new E;this._registrations.set(o,r),n.onDidChangeInlineValues=r.event}this._registrations.set(e,this._languageFeaturesService.inlineValuesProvider.register(t,n))}$emitInlineValuesEvent(e,t){let o=this._registrations.get(e);o instanceof E&&o.fire(t)}$registerDocumentHighlightProvider(e,t){this._registrations.set(e,this._languageFeaturesService.documentHighlightProvider.register(t,{provideDocumentHighlights:(o,n,r)=>this._proxy.$provideDocumentHighlights(e,o.uri,n,r)}))}$registerMultiDocumentHighlightProvider(e,t){this._registrations.set(e,this._languageFeaturesService.multiDocumentHighlightProvider.register(t,{selector:t,provideMultiDocumentHighlights:(o,n,r,s)=>this._proxy.$provideMultiDocumentHighlights(e,o.uri,n,r.map(l=>l.uri),s).then(l=>{if(l==null)return;let c=new gt;return l?.forEach(u=>{let p=A.revive(u.uri);c.has(p)?c.get(p).push(...u.highlights):c.set(p,u.highlights)}),c})}))}$registerLinkedEditingRangeProvider(e,t){this._registrations.set(e,this._languageFeaturesService.linkedEditingRangeProvider.register(t,{provideLinkedEditingRanges:async(o,n,r)=>{let s=await this._proxy.$provideLinkedEditingRanges(e,o.uri,n,r);if(s)return{ranges:s.ranges,wordPattern:s.wordPattern?Kd._reviveRegExp(s.wordPattern):void 0}}}))}$registerReferenceSupport(e,t){this._registrations.set(e,this._languageFeaturesService.referenceProvider.register(t,{provideReferences:(o,n,r,s)=>this._proxy.$provideReferences(e,o.uri,n,r,s).then(Kd._reviveLocationDto)}))}$registerCodeActionSupport(e,t,o,n,r,s){let l={provideCodeActions:async(c,u,p,h)=>{let g=await this._proxy.$provideCodeActions(e,c.uri,u,p,h);if(g)return{actions:Kd._reviveCodeActionDto(g.actions,this._uriIdentService),dispose:()=>{typeof g.cacheId=="number"&&this._proxy.$releaseCodeActions(e,g.cacheId)}}},providedCodeActionKinds:o.providedKinds,documentation:o.documentation,displayName:n,extensionId:r};s&&(l.resolveCodeAction=async(c,u)=>{let p=await this._proxy.$resolveCodeAction(e,c.cacheId,u);return p.edit&&(c.edit=yB(p.edit,this._uriIdentService)),p.command&&(c.command=p.command),c}),this._registrations.set(e,this._languageFeaturesService.codeActionProvider.register(t,l))}$registerPasteEditProvider(e,t,o){let n=new U7e(e,this._proxy,o,this._uriIdentService);this._pasteEditProviders.set(e,n),this._registrations.set(e,wn(this._languageFeaturesService.documentPasteEditProvider.register(t,n),Z(()=>this._pasteEditProviders.delete(e))))}$resolvePasteFileData(e,t,o){let n=this._pasteEditProviders.get(e);if(!n)throw new Error("Could not find provider");return n.resolveFileData(t,o)}$registerDocumentFormattingSupport(e,t,o,n){this._registrations.set(e,this._languageFeaturesService.documentFormattingEditProvider.register(t,{extensionId:o,displayName:n,provideDocumentFormattingEdits:(r,s,l)=>this._proxy.$provideDocumentFormattingEdits(e,r.uri,s,l)}))}$registerRangeFormattingSupport(e,t,o,n,r){this._registrations.set(e,this._languageFeaturesService.documentRangeFormattingEditProvider.register(t,{extensionId:o,displayName:n,provideDocumentRangeFormattingEdits:(s,l,c,u)=>this._proxy.$provideDocumentRangeFormattingEdits(e,s.uri,l,c,u),provideDocumentRangesFormattingEdits:r?(s,l,c,u)=>this._proxy.$provideDocumentRangesFormattingEdits(e,s.uri,l,c,u):void 0}))}$registerOnTypeFormattingSupport(e,t,o,n){this._registrations.set(e,this._languageFeaturesService.onTypeFormattingEditProvider.register(t,{extensionId:n,autoFormatTriggerCharacters:o,provideOnTypeFormattingEdits:(r,s,l,c,u)=>this._proxy.$provideOnTypeFormattingEdits(e,r.uri,s,l,c,u)}))}$registerNavigateTypeSupport(e,t){let o,n={provideWorkspaceSymbols:async(r,s)=>{let l=await this._proxy.$provideWorkspaceSymbols(e,r,s);return o!==void 0&&this._proxy.$releaseWorkspaceSymbols(e,o),o=l.cacheId,Kd._reviveWorkspaceSymbolDto(l.symbols)}};t&&(n.resolveWorkspaceSymbol=async(r,s)=>{let l=await this._proxy.$resolveWorkspaceSymbol(e,r,s);return l&&Kd._reviveWorkspaceSymbolDto(l)}),this._registrations.set(e,WMt.register(n))}$registerRenameSupport(e,t,o){this._registrations.set(e,this._languageFeaturesService.renameProvider.register(t,{provideRenameEdits:(n,r,s,l)=>this._proxy.$provideRenameEdits(e,n.uri,r,s,l).then(c=>yB(c,this._uriIdentService)),resolveRenameLocation:o?(n,r,s)=>this._proxy.$resolveRenameLocation(e,n.uri,r,s):void 0}))}$registerNewSymbolNamesProvider(e,t){this._registrations.set(e,this._languageFeaturesService.newSymbolNamesProvider.register(t,{supportsAutomaticNewSymbolNamesTriggerKind:this._proxy.$supportsAutomaticNewSymbolNamesTriggerKind(e),provideNewSymbolNames:(o,n,r,s)=>this._proxy.$provideNewSymbolNames(e,o.uri,n,r,s)}))}$registerDocumentSemanticTokensProvider(e,t,o,n){let r;if(typeof n=="number"){let s=new E;this._registrations.set(n,s),r=s.event}this._registrations.set(e,this._languageFeaturesService.documentSemanticTokensProvider.register(t,new $fi(this._proxy,e,o,r)))}$emitDocumentSemanticTokensEvent(e){let t=this._registrations.get(e);t instanceof E&&t.fire(void 0)}$emitDocumentRangeSemanticTokensEvent(e){let t=this._registrations.get(e);t instanceof E&&t.fire(void 0)}$registerDocumentRangeSemanticTokensProvider(e,t,o,n){let r;if(typeof n=="number"){let s=new E;this._registrations.set(n,s),r=s.event}this._registrations.set(e,this._languageFeaturesService.documentRangeSemanticTokensProvider.register(t,new jfi(this._proxy,e,o,r)))}static _inflateSuggestDto(e,t,o){let n=t.a,r=t.o,s=t.n,l=t.k,c;return r&&(c={$ident:s,id:r,title:"",arguments:s?[s]:t.p}),{label:n,extensionId:o,kind:t.b??9,tags:t.m,detail:t.c,documentation:t.d,sortText:t.e,filterText:t.f,preselect:t.g,insertText:t.h??(typeof n=="string"?n:n.label),range:t.j??e,insertTextRules:t.i,commitCharacters:l?Array.from(l):void 0,additionalTextEdits:t.l,command:c,_id:t.x}}$registerCompletionsProvider(e,t,o,n,r){let s={triggerCharacters:o,_debugDisplayName:`${r.value}(${o.join("")})`,provideCompletionItems:async(l,c,u,p)=>{let h=await this._proxy.$provideCompletionItems(e,l.uri,c,u,p);return h&&{suggestions:h.b.map(g=>Kd._inflateSuggestDto(h.a,g,r)),incomplete:h.c||!1,duration:h.d,dispose:()=>{typeof h.x=="number"&&this._proxy.$releaseCompletionItems(e,h.x)}}}};n&&(s.resolveCompletionItem=(l,c)=>this._proxy.$resolveCompletionItem(e,l._id,c).then(u=>{if(!u)return l;let p=Kd._inflateSuggestDto(l.range,u,r);return Xu(l,p,!0)})),this._registrations.set(e,this._languageFeaturesService.completionProvider.register(t,s))}$registerInlineCompletionsSupport(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){let w=new P1(n,r,s),k=this._instantiationService.createInstance(zJ,e,s??n,w,l,p,u,c,f,o,g,h,v,S,b,y,t,this._proxy);this._registrations.set(e,k)}$emitInlineCompletionsChange(e,t){let o=this._registrations.get(e);o instanceof zJ&&o._emitDidChange(t)}$emitInlineCompletionModelInfoChange(e,t){let o=this._registrations.get(e);o instanceof zJ&&o._setModelInfo(t)}$emitInlineCompletionProviderOptionsChange(e,t){let o=this._registrations.get(e);o instanceof zJ&&o._setProviderOptions(t)}$registerSignatureHelpProvider(e,t,o){this._registrations.set(e,this._languageFeaturesService.signatureHelpProvider.register(t,{signatureHelpTriggerCharacters:o.triggerCharacters,signatureHelpRetriggerCharacters:o.retriggerCharacters,provideSignatureHelp:async(n,r,s,l)=>{let c=await this._proxy.$provideSignatureHelp(e,n.uri,r,l,s);if(c)return{value:c,dispose:()=>{this._proxy.$releaseSignatureHelp(e,c.id)}}}}))}$registerInlayHintsProvider(e,t,o,n,r){let s={displayName:r,provideInlayHints:async(l,c,u)=>{let p=await this._proxy.$provideInlayHints(e,l.uri,c,u);if(p)return{hints:$n(p.hints),dispose:()=>{p.cacheId&&this._proxy.$releaseInlayHints(e,p.cacheId)}}}};if(o&&(s.resolveInlayHint=async(l,c)=>{let u=l;if(!u.cacheId)return l;let p=await this._proxy.$resolveInlayHint(e,u.cacheId,c);if(c.isCancellationRequested)throw new go;return p?{...l,tooltip:p.tooltip,label:$n(p.label),textEdits:p.textEdits}:l}),typeof n=="number"){let l=new E;this._registrations.set(n,l),s.onDidChangeInlayHints=l.event}this._registrations.set(e,this._languageFeaturesService.inlayHintsProvider.register(t,s))}$emitInlayHintsEvent(e){let t=this._registrations.get(e);t instanceof E&&t.fire(void 0)}$registerDocumentLinkProvider(e,t,o){let n={provideLinks:(r,s)=>this._proxy.$provideDocumentLinks(e,r.uri,s).then(l=>{if(l)return{links:l.links.map(Kd._reviveLinkDTO),dispose:()=>{typeof l.cacheId=="number"&&this._proxy.$releaseDocumentLinks(e,l.cacheId)}}})};o&&(n.resolveLink=(r,s)=>{let l=r;return l.cacheId?this._proxy.$resolveDocumentLink(e,l.cacheId,s).then(c=>c&&Kd._reviveLinkDTO(c)):r}),this._registrations.set(e,this._languageFeaturesService.linkProvider.register(t,n))}$registerDocumentColorProvider(e,t){let o=this._proxy;this._registrations.set(e,this._languageFeaturesService.colorProvider.register(t,{provideDocumentColors:(n,r)=>o.$provideDocumentColors(e,n.uri,r).then(s=>s.map(l=>{let[c,u,p,h]=l.color;return{color:{red:c,green:u,blue:p,alpha:h},range:l.range}})),provideColorPresentations:(n,r,s)=>o.$provideColorPresentations(e,n.uri,{color:[r.color.red,r.color.green,r.color.blue,r.color.alpha],range:r.range},s)}))}$registerFoldingRangeProvider(e,t,o,n){let r={id:o.value,provideFoldingRanges:(s,l,c)=>this._proxy.$provideFoldingRanges(e,s.uri,l,c)};if(typeof n=="number"){let s=new E;this._registrations.set(n,s),r.onDidChange=s.event}this._registrations.set(e,this._languageFeaturesService.foldingRangeProvider.register(t,r))}$emitFoldingRangeEvent(e,t){let o=this._registrations.get(e);o instanceof E&&o.fire(t)}$registerSelectionRangeProvider(e,t){this._registrations.set(e,this._languageFeaturesService.selectionRangeProvider.register(t,{provideSelectionRanges:(o,n,r)=>this._proxy.$provideSelectionRanges(e,o.uri,n,r)}))}$registerCallHierarchyProvider(e,t){this._registrations.set(e,Pue.register(t,{prepareCallHierarchy:async(o,n,r)=>{let s=await this._proxy.$prepareCallHierarchy(e,o.uri,n,r);if(!(!s||s.length===0))return{dispose:()=>{for(let l of s)this._proxy.$releaseCallHierarchy(e,l._sessionId)},roots:s.map(Kd._reviveCallHierarchyItemDto)}},provideOutgoingCalls:async(o,n)=>{let r=await this._proxy.$provideCallHierarchyOutgoingCalls(e,o._sessionId,o._itemId,n);return r&&(r.forEach(s=>{s.to=Kd._reviveCallHierarchyItemDto(s.to)}),r)},provideIncomingCalls:async(o,n)=>{let r=await this._proxy.$provideCallHierarchyIncomingCalls(e,o._sessionId,o._itemId,n);return r&&(r.forEach(s=>{s.from=Kd._reviveCallHierarchyItemDto(s.from)}),r)}}))}static _reviveRegExp(e){return new RegExp(e.pattern,e.flags)}static _reviveIndentationRule(e){return{decreaseIndentPattern:Kd._reviveRegExp(e.decreaseIndentPattern),increaseIndentPattern:Kd._reviveRegExp(e.increaseIndentPattern),indentNextLinePattern:e.indentNextLinePattern?Kd._reviveRegExp(e.indentNextLinePattern):void 0,unIndentedLinePattern:e.unIndentedLinePattern?Kd._reviveRegExp(e.unIndentedLinePattern):void 0}}static _reviveOnEnterRule(e){return{beforeText:Kd._reviveRegExp(e.beforeText),afterText:e.afterText?Kd._reviveRegExp(e.afterText):void 0,previousLineText:e.previousLineText?Kd._reviveRegExp(e.previousLineText):void 0,action:e.action}}static _reviveOnEnterRules(e){return e.map(Kd._reviveOnEnterRule)}$setLanguageConfiguration(e,t,o){let n={comments:o.comments,brackets:o.brackets,wordPattern:o.wordPattern?Kd._reviveRegExp(o.wordPattern):void 0,indentationRules:o.indentationRules?Kd._reviveIndentationRule(o.indentationRules):void 0,onEnterRules:o.onEnterRules?Kd._reviveOnEnterRules(o.onEnterRules):void 0,autoClosingPairs:void 0,surroundingPairs:void 0,__electricCharacterSupport:void 0};o.autoClosingPairs?n.autoClosingPairs=o.autoClosingPairs:o.__characterPairSupport&&(n.autoClosingPairs=o.__characterPairSupport.autoClosingPairs),o.__electricCharacterSupport&&o.__electricCharacterSupport.docComment&&(n.__electricCharacterSupport={docComment:{open:o.__electricCharacterSupport.docComment.open,close:o.__electricCharacterSupport.docComment.close}}),this._languageService.isRegisteredLanguageId(t)&&this._registrations.set(e,this._languageConfigurationService.register(t,n,100))}$registerTypeHierarchyProvider(e,t){this._registrations.set(e,Nue.register(t,{prepareTypeHierarchy:async(o,n,r)=>{let s=await this._proxy.$prepareTypeHierarchy(e,o.uri,n,r);if(s)return{dispose:()=>{for(let l of s)this._proxy.$releaseTypeHierarchy(e,l._sessionId)},roots:s.map(Kd._reviveTypeHierarchyItemDto)}},provideSupertypes:async(o,n)=>{let r=await this._proxy.$provideTypeHierarchySupertypes(e,o._sessionId,o._itemId,n);return r&&r.map(Kd._reviveTypeHierarchyItemDto)},provideSubtypes:async(o,n)=>{let r=await this._proxy.$provideTypeHierarchySubtypes(e,o._sessionId,o._itemId,n);return r&&r.map(Kd._reviveTypeHierarchyItemDto)}}))}$registerDocumentOnDropEditProvider(e,t,o){let n=new z7e(e,this._proxy,o,this._uriIdentService);this._documentOnDropEditProviders.set(e,n),this._registrations.set(e,wn(this._languageFeaturesService.documentDropEditProvider.register(t,n),Z(()=>this._documentOnDropEditProviders.delete(e))))}async $resolveDocumentOnDropFileData(e,t,o){let n=this._documentOnDropEditProviders.get(e);if(!n)throw new Error("Could not find provider");return n.resolveDocumentOnDropFileData(t,o)}};Kd=I([fo(qi.MainThreadLanguageFeatures),m(1,_t),m(2,Rs),m(3,Qt),m(4,ht),m(5,F),m(6,qfi)],Kd);var U7e=class{constructor(i,e,t,o){this._handle=i;this._proxy=e;this._uriIdentService=o;this.dataTransfers=new Rue;this.copyMimeTypes=t.copyMimeTypes??[],this.pasteMimeTypes=t.pasteMimeTypes??[],this.providedPasteEditKinds=t.providedPasteEditKinds?.map(n=>new fs(n))??[],t.supportsCopy&&(this.prepareDocumentPaste=async(n,r,s,l)=>{let c=await Lue.fromList(s);if(l.isCancellationRequested)return;let u=await this._proxy.$prepareDocumentPaste(i,n.uri,r,c,l);if(!u)return;let p=new qx;for(let[h,g]of u.items)p.replace(h,DO(g.asString,g.id));return p}),t.supportsPaste&&(this.provideDocumentPasteEdits=async(n,r,s,l,c)=>{let u=this.dataTransfers.add(s);try{let p=await Lue.fromList(s);if(c.isCancellationRequested)return;let h=await this._proxy.$providePasteEdits(this._handle,u.id,n.uri,r,p,{only:l.only?.value,triggerKind:l.triggerKind},c);return h?{edits:h.map(g=>({...g,kind:g.kind?new fs(g.kind.value):new fs(""),yieldTo:g.yieldTo?.map(f=>({kind:new fs(f)})),additionalEdit:g.additionalEdit?yB(g.additionalEdit,this._uriIdentService,f=>this.resolveFileData(u.id,f)):void 0})),dispose:()=>{this._proxy.$releasePasteEdits(this._handle,u.id)}}:void 0}finally{u.dispose()}}),t.supportsResolve&&(this.resolveDocumentPasteEdit=async(n,r)=>{let s=await this._proxy.$resolvePasteEdit(this._handle,n._cacheId,r);return typeof s.insertText<"u"&&(n.insertText=s.insertText),s.additionalEdit&&(n.additionalEdit=yB(s.additionalEdit,this._uriIdentService)),n})}resolveFileData(i,e){return this.dataTransfers.resolveFileData(i,e)}};U7e=I([m(3,ht)],U7e);var z7e=class{constructor(i,e,t,o){this._handle=i;this._proxy=e;this._uriIdentService=o;this.dataTransfers=new Rue;this.dropMimeTypes=t?.dropMimeTypes??["*/*"],this.providedDropEditKinds=t?.providedDropKinds?.map(n=>new fs(n)),t?.supportsResolve&&(this.resolveDocumentDropEdit=async(n,r)=>{let s=await this._proxy.$resolvePasteEdit(this._handle,n._cacheId,r);return s.additionalEdit&&(n.additionalEdit=yB(s.additionalEdit,this._uriIdentService)),n})}async provideDocumentDropEdits(i,e,t,o){let n=this.dataTransfers.add(t);try{let r=await Lue.fromList(t);if(o.isCancellationRequested)return;let s=await this._proxy.$provideDocumentOnDropEdits(this._handle,n.id,i.uri,e,r,o);return s?{edits:s.map(l=>({...l,yieldTo:l.yieldTo?.map(c=>({kind:new fs(c)})),kind:l.kind?new fs(l.kind):void 0,additionalEdit:yB(l.additionalEdit,this._uriIdentService,c=>this.resolveDocumentOnDropFileData(n.id,c))})),dispose:()=>{this._proxy.$releaseDocumentOnDropEdits(this._handle,n.id)}}:void 0}finally{n.dispose()}}resolveDocumentOnDropFileData(i,e){return this.dataTransfers.resolveFileData(i,e)}};z7e=I([m(3,ht)],z7e);var $fi=class{constructor(i,e,t,o){this._proxy=i;this._handle=e;this._legend=t;this.onDidChange=o}releaseDocumentSemanticTokens(i){i&&this._proxy.$releaseDocumentSemanticTokens(this._handle,parseInt(i,10))}getLegend(){return this._legend}async provideDocumentSemanticTokens(i,e,t){let o=e?parseInt(e,10):0,n=await this._proxy.$provideDocumentSemanticTokens(this._handle,i.uri,o,t);if(!n||t.isCancellationRequested)return null;let r=rpi(n);return r.type==="full"?{resultId:String(r.id),data:r.data}:{resultId:String(r.id),edits:r.deltas}}},jfi=class{constructor(i,e,t,o){this._proxy=i;this._handle=e;this._legend=t;this.onDidChange=o}getLegend(){return this._legend}async provideDocumentRangeSemanticTokens(i,e,t){let o=await this._proxy.$provideDocumentRangeSemanticTokens(this._handle,i.uri,e,t);if(!o||t.isCancellationRequested)return null;let n=rpi(o);if(n.type==="full")return{resultId:String(n.id),data:n.data};throw new Error("Unexpected")}},zJ=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T){super();this.handle=e;this.groupId=t;this.providerId=o;this.yieldsToGroupIds=n;this.excludesGroupIds=r;this.debounceDelayMs=s;this.displayName=l;this.modelInfo=c;this._supportsHandleEvents=u;this._supportsSetModelId=p;this._supportsOnDidChange=h;this._supportsOnDidChangeModelInfo=g;this.providerOptions=f;this._supportsSetProviderOption=v;this._supportsOnDidChangeProviderOptions=b;this._selector=S;this._proxy=y;this._languageFeaturesService=w;this._aiEditTelemetryService=k;this._instantiationService=T;this._onDidChangeEmitter=this._register(new E);this._onDidChangeModelInfoEmitter=this._register(new E);this._onDidProviderOptionsChangeEmitter=this._register(new E);this.setModelId=this._supportsSetModelId?async P=>{await this._proxy.$handleInlineCompletionSetCurrentModelId(this.handle,P)}:void 0,this.setProviderOption=this._supportsSetProviderOption?async(P,O)=>{await this._proxy.$handleInlineCompletionSetProviderOption(this.handle,P,O)}:void 0,this.onDidChangeInlineCompletions=this._supportsOnDidChange?this._onDidChangeEmitter.event:void 0,this.onDidChangeModelInfo=this._supportsOnDidChangeModelInfo?this._onDidChangeModelInfoEmitter.event:void 0,this.onDidProviderOptionsChange=this._supportsOnDidChangeProviderOptions?this._onDidProviderOptionsChangeEmitter.event:void 0,this._register(this._languageFeaturesService.inlineCompletionsProvider.register(this._selector,this))}_setModelInfo(e){this.modelInfo=e,this._supportsOnDidChangeModelInfo&&this._onDidChangeModelInfoEmitter.fire()}_setProviderOptions(e){this.providerOptions=e,this._supportsOnDidChangeProviderOptions&&this._onDidProviderOptionsChangeEmitter.fire()}_emitDidChange(e){this._supportsOnDidChange&&this._onDidChangeEmitter.fire(e)}async provideInlineCompletions(e,t,o,n){return await this._proxy.$provideInlineCompletions(this.handle,e.uri,t,o,n)}async handleItemDidShow(e,t,o,n){t.suggestionId===void 0&&(t.suggestionId=this._aiEditTelemetryService.createSuggestionId({applyCodeBlockSuggestionId:void 0,feature:"inlineSuggestion",source:this.providerId,languageId:e.languageId,editDeltaInfo:n,modeId:void 0,modelId:void 0,presentation:t.isInlineEdit?"nextEditSuggestion":"inlineCompletion"})),this._supportsHandleEvents&&await this._proxy.$handleInlineCompletionDidShow(this.handle,e.pid,t.idx,o)}async handlePartialAccept(e,t,o,n){this._supportsHandleEvents&&await this._proxy.$handleInlineCompletionPartialAccept(this.handle,e.pid,t.idx,o,n)}async handleEndOfLifetime(e,t,o,n){function r(c,u){return c.kind===2?{...c,supersededBy:c.supersededBy?u(c.supersededBy):void 0}:c}this._supportsHandleEvents&&await this._proxy.$handleInlineCompletionEndOfLifetime(this.handle,e.pid,t.idx,r(o,c=>({pid:e.pid,idx:c.idx}))),o.kind===0&&t.suggestionId!==void 0&&this._aiEditTelemetryService.handleCodeAccepted({suggestionId:t.suggestionId,feature:"inlineSuggestion",source:this.providerId,languageId:e.languageId,editDeltaInfo:lw.tryCreate(n.lineCountModified,n.lineCountOriginal,n.characterCountModified,n.characterCountOriginal),modeId:void 0,modelId:void 0,presentation:t.isInlineEdit?"nextEditSuggestion":"inlineCompletion",acceptanceMethod:"accept",applyCodeBlockSuggestionId:void 0});let s={opportunityId:n.requestUuid,correlationId:n.correlationId,shown:n.shown,shownDuration:n.shownDuration,shownDurationUncollapsed:n.shownDurationUncollapsed,timeUntilShown:n.timeUntilShown,timeUntilProviderRequest:n.timeUntilProviderRequest,timeUntilProviderResponse:n.timeUntilProviderResponse,editorType:n.editorType,viewKind:n.viewKind,preceeded:n.preceeded,requestReason:n.requestReason,typingInterval:n.typingInterval,typingIntervalCharacterCount:n.typingIntervalCharacterCount,languageId:n.languageId,cursorColumnDistance:n.cursorColumnDistance,cursorLineDistance:n.cursorLineDistance,lineCountOriginal:n.lineCountOriginal,lineCountModified:n.lineCountModified,characterCountOriginal:n.characterCountOriginal,characterCountModified:n.characterCountModified,disjointReplacements:n.disjointReplacements,sameShapeReplacements:n.sameShapeReplacements,selectedSuggestionInfo:n.selectedSuggestionInfo,extensionId:this.providerId.extensionId,extensionVersion:this.providerId.extensionVersion,groupId:p4o(n.correlationId)??this.groupId,skuPlan:n.skuPlan,skuType:n.skuType,performanceMarkers:n.performanceMarkers,availableProviders:n.availableProviders,partiallyAccepted:n.partiallyAccepted,partiallyAcceptedCountSinceOriginal:n.partiallyAcceptedCountSinceOriginal,partiallyAcceptedRatioSinceOriginal:n.partiallyAcceptedRatioSinceOriginal,partiallyAcceptedCharactersSinceOriginal:n.partiallyAcceptedCharactersSinceOriginal,superseded:o.kind===2&&!!o.supersededBy,reason:o.kind===0?"accepted":o.kind===1?"rejected":o.kind===2?"ignored":void 0,acceptedAlternativeAction:o.kind===0&&o.alternativeAction,noSuggestionReason:void 0,notShownReason:n.notShownReason,renameCreated:n.renameCreated,renameDuration:n.renameDuration,renameTimedOut:n.renameTimedOut,renameDroppedOtherEdits:n.renameDroppedOtherEdits,renameDroppedRenameEdits:n.renameDroppedRenameEdits,editKind:n.editKind,longDistanceHintVisible:n.longDistanceHintVisible,longDistanceHintDistance:n.longDistanceHintDistance,...rK(aB(this.providerId.extensionId))},l=this._instantiationService.createInstance(uF);bkt(l,s)}disposeInlineCompletions(e,t){this._proxy.$freeInlineCompletionsList(this.handle,e.pid,t)}async handleRejection(e,t){this._supportsHandleEvents&&await this._proxy.$handleInlineCompletionRejection(this.handle,e.pid,t.idx)}toString(){return`InlineCompletionsProvider(${this.providerId.toString()})`}};zJ=I([m(17,Qt),m(18,xS),m(19,F)],zJ);function p4o(a){if(a)try{let i=JSON.parse(a);return typeof i=="object"&&i!==null&&typeof i.engine=="string"?i.engine:void 0}catch{return}}var HB=le("ILanguageStatusService"),Qfi=class{constructor(){this._provider=new _d;this.onDidChange=U.map(this._provider.onDidChange,()=>{})}addStatus(i){return this._provider.register(i.selector,i)}getLanguageStatus(i){return this._provider.ordered(i).sort((e,t)=>{let o=t.severity-e.severity;return o===0&&(o=Hl(e.source,t.source)),o===0&&(o=Hl(e.id,t.id)),o})}};Ee(HB,Qfi,1);var GMt=class extends x{constructor(e,t,o,n,r){super();this._languageService=t;this._modelService=o;this._resolverService=n;this._languageStatusService=r;this._status=this._register(new Vt);this._proxy=e.getProxy(to.ExtHostLanguages),this._proxy.$acceptLanguageIds(t.getRegisteredLanguageIds()),this._register(t.onDidChange(s=>{this._proxy.$acceptLanguageIds(t.getRegisteredLanguageIds())}))}async $changeLanguage(e,t){if(!this._languageService.isRegisteredLanguageId(t))return Promise.reject(new Error(`Unknown language id: ${t}`));let o=A.revive(e),n=await this._resolverService.createModelReference(o);try{n.object.textEditorModel.setLanguage(this._languageService.createById(t))}finally{n.dispose()}}async $tokensAtPosition(e,t){let o=A.revive(e),n=this._modelService.getModel(o);if(!n)return;n.tokenization.tokenizeIfCheap(t.lineNumber);let r=n.tokenization.getLineTokens(t.lineNumber),s=r.findTokenIndexAtOffset(t.column-1);return{type:r.getStandardTokenType(s),range:new z(t.lineNumber,1+r.getStartOffset(s),t.lineNumber,1+r.getEndOffset(s))}}$setLanguageStatus(e,t){this._status.set(e,this._languageStatusService.addStatus(t))}$removeLanguageStatus(e){this._status.deleteAndDispose(e)}};GMt=I([fo(qi.MainThreadLanguages),m(1,_t),m(2,Tt),m(3,Bt),m(4,HB)],GMt);var qMt=class{constructor(i,e){this.loggerService=e;this.disposables=new N;let t=i.getProxy(to.ExtHostLogLevelServiceShape);this.disposables.add(e.onDidChangeLogLevel(o=>{o7(o)?t.$setLogLevel(o):t.$setLogLevel(o[1],o[0])}))}$log(i,e){let t=this.loggerService.getLogger(A.revive(i));if(!t)throw new Error("Create the logger before logging");for(let[o,n]of e)Sae(t,o,n)}async $createLogger(i,e){this.loggerService.createLogger(A.revive(i),e)}async $registerLogger(i){this.loggerService.registerLogger({...i,resource:A.revive(i.resource)})}async $deregisterLogger(i){this.loggerService.deregisterLogger(A.revive(i))}async $setVisibility(i,e){this.loggerService.setVisibility(A.revive(i),e)}$flush(i){let e=this.loggerService.getLogger(A.revive(i));if(!e)throw new Error("Create the logger before flushing");e.flush()}dispose(){this.disposables.dispose()}};qMt=I([fo(qi.MainThreadLogger),m(1,Il)],qMt);$e.registerCommand("_extensionTests.setLogLevel",function(a,i){let e=a.get(Il),t=a.get(Eo);if(t.isExtensionDevelopment&&t.extensionTestsLocationURI){let o=Iae(i);o!==void 0&&e.setLogLevel(o)}});$e.registerCommand("_extensionTests.getLogLevel",function(a){let i=a.get(se);return IC(i.getLevel())});var Oue=class{constructor(i,e,t,o,n){this._notificationService=e;this._commandService=t;this._dialogService=o;this.extensionsListener=n.onDidChangeExtensions(r=>{for(let s of r.removed)this._notificationService.removeFilter(s.identifier.value)})}dispose(){this.extensionsListener.dispose()}$showMessage(i,e,t,o){return t.modal?this._showModalMessage(i,e,t.detail,o,t.useCustom):this._showMessage(i,e,o,t)}_showMessage(i,e,t,o){return new Promise(n=>{let r=t.map(p=>ii({id:`_extension_message_handle_${p.handle}`,label:p.title,enabled:!0,run:()=>(n(p.handle),Promise.resolve())})),s,l=!1;o.source&&(s={label:o.source.label,id:o.source.identifier.value},l=Oue.URGENT_NOTIFICATION_SOURCES.includes(s.id)),s||(s=d(3341,null));let c=[];o.source&&c.push(ii({id:o.source.identifier.value,label:d(3342,null),run:()=>this._commandService.executeCommand("_extensions.manage",o.source.identifier.value)}));let u=this._notificationService.notify({severity:i,message:e,actions:{primary:r,secondary:c},source:s,priority:l?3:0,sticky:l});U.once(u.onDidClose)(()=>{n(void 0)})})}async _showModalMessage(i,e,t,o,n){let r=[],s;for(let c of o){let u={label:c.title,run:()=>c.handle};c.isCloseAffordance?s=u:r.push(u)}s||(r.length>0?s={label:d(3340,null),run:()=>{}}:s={label:d(3343,null),run:()=>{}});let{result:l}=await this._dialogService.prompt({type:i,message:e,detail:t,buttons:r,cancelButton:s,custom:n});return l}};Oue.URGENT_NOTIFICATION_SOURCES=["vscode.github-authentication","vscode.microsoft-authentication"],Oue=I([fo(qi.MainThreadMessageService),m(1,Ne),m(2,ge),m(3,at),m(4,lt)],Oue);function a_e(a){switch(a){case 100:return"req";case 101:return"cancel";case 102:return"subscribe";case 103:return"unsubscribe"}}function jMt(a){switch(a){case 200:return"init";case 201:return"reply:";case 202:case 203:return"replyErr:";case 204:return"event:"}}function r_e(a){let i=0;for(let e=0;;e+=7){let t=a.read(1);if(i|=(t.buffer[0]&127)<<e,!(t.buffer[0]&128))return i}}var m4o=KJ(0);function s_e(a,i){if(i===0){a.write(m4o);return}let e=0;for(let o=i;o!==0;o=o>>>7)e++;let t=qe.alloc(e);for(let o=0;i!==0;o++)t.buffer[o]=i&127,i=i>>>7,i>0&&(t.buffer[o]|=128);a.write(t)}var QMt=class{constructor(i){this.buffer=i;this.pos=0}read(i){let e=this.buffer.slice(this.pos,this.pos+i);return this.pos+=e.byteLength,e}},K7e=class{constructor(){this.buffers=[]}get buffer(){return qe.concat(this.buffers)}write(i){this.buffers.push(i)}};function KJ(a){let i=qe.alloc(1);return i.writeUInt8(a,0),i}var Fue={Undefined:KJ(0),String:KJ(1),Buffer:KJ(2),VSBuffer:KJ(3),Array:KJ(4),Object:KJ(5),Uint:KJ(6)};function l_e(a,i){if(typeof i>"u")a.write(Fue.Undefined);else if(typeof i=="string"){let e=qe.fromString(i);a.write(Fue.String),s_e(a,e.byteLength),a.write(e)}else if(qe.isNativeBuffer(i)){let e=qe.wrap(i);a.write(Fue.Buffer),s_e(a,e.byteLength),a.write(e)}else if(i instanceof qe)a.write(Fue.VSBuffer),s_e(a,i.byteLength),a.write(i);else if(Array.isArray(i)){a.write(Fue.Array),s_e(a,i.length);for(let e of i)l_e(a,e)}else if(typeof i=="number"&&(i|0)===i)a.write(Fue.Uint),s_e(a,i);else{let e=qe.fromString(JSON.stringify(i));a.write(Fue.Object),s_e(a,e.byteLength),a.write(e)}}function G7e(a){switch(a.read(1).readUInt8(0)){case 0:return;case 1:return a.read(r_e(a)).toString();case 2:return a.read(r_e(a)).buffer;case 3:return a.read(r_e(a));case 4:{let e=r_e(a),t=[];for(let o=0;o<e;o++)t.push(G7e(a));return t}case 5:return JSON.parse(a.read(r_e(a)).toString());case 6:return r_e(a)}}var Yfi=class{constructor(i,e,t=null,o=1e3){this.protocol=i;this.ctx=e;this.logger=t;this.timeoutDelay=o;this.channels=new Map;this.activeRequests=new Map;this.pendingRequests=new Map;this.protocolListener=this.protocol.onMessage(n=>this.onRawMessage(n)),this.sendResponse({type:200})}registerChannel(i,e){this.channels.set(i,e),setTimeout(()=>this.flushPendingRequests(i),0)}sendResponse(i){switch(i.type){case 200:{let e=this.send([i.type]);this.logger?.logOutgoing(e,0,1,jMt(i.type));return}case 201:case 202:case 204:case 203:{let e=this.send([i.type,i.id],i.data);this.logger?.logOutgoing(e,i.id,1,jMt(i.type),i.data);return}}}send(i,e=void 0){let t=new K7e;return l_e(t,i),l_e(t,e),this.sendBuffer(t.buffer)}sendBuffer(i){try{return this.protocol.send(i),i.byteLength}catch{return 0}}onRawMessage(i){let e=new QMt(i),t=G7e(e),o=G7e(e),n=t[0];switch(n){case 100:return this.logger?.logIncoming(i.byteLength,t[1],1,`${a_e(n)}: ${t[2]}.${t[3]}`,o),this.onPromise({type:n,id:t[1],channelName:t[2],name:t[3],arg:o});case 102:return this.logger?.logIncoming(i.byteLength,t[1],1,`${a_e(n)}: ${t[2]}.${t[3]}`,o),this.onEventListen({type:n,id:t[1],channelName:t[2],name:t[3],arg:o});case 101:return this.logger?.logIncoming(i.byteLength,t[1],1,`${a_e(n)}`),this.disposeActiveRequest({type:n,id:t[1]});case 103:return this.logger?.logIncoming(i.byteLength,t[1],1,`${a_e(n)}`),this.disposeActiveRequest({type:n,id:t[1]})}}onPromise(i){let e=this.channels.get(i.channelName);if(!e){this.collectPendingRequest(i);return}let t=new Ye,o;try{o=e.call(this.ctx,i.name,i.arg,t.token)}catch(s){o=Promise.reject(s)}let n=i.id;o.then(s=>{this.sendResponse({id:n,data:s,type:201})},s=>{s instanceof Error?this.sendResponse({id:n,data:{message:s.message,name:s.name,stack:s.stack?s.stack.split(`
`):void 0},type:202}):this.sendResponse({id:n,data:s,type:203})}).finally(()=>{r.dispose(),this.activeRequests.delete(i.id)});let r=Z(()=>t.cancel());this.activeRequests.set(i.id,r)}onEventListen(i){let e=this.channels.get(i.channelName);if(!e){this.collectPendingRequest(i);return}let t=i.id,n=e.listen(this.ctx,i.name,i.arg)(r=>this.sendResponse({id:t,data:r,type:204}));this.activeRequests.set(i.id,n)}disposeActiveRequest(i){let e=this.activeRequests.get(i.id);e&&(e.dispose(),this.activeRequests.delete(i.id))}collectPendingRequest(i){let e=this.pendingRequests.get(i.channelName);e||(e=[],this.pendingRequests.set(i.channelName,e));let t=setTimeout(()=>{console.error(`Unknown channel: ${i.channelName}`),i.type===100&&this.sendResponse({id:i.id,data:{name:"Unknown channel",message:`Channel name '${i.channelName}' timed out after ${this.timeoutDelay}ms`,stack:void 0},type:202})},this.timeoutDelay);e.push({request:i,timeoutTimer:t})}flushPendingRequests(i){let e=this.pendingRequests.get(i);if(e){for(let t of e)switch(clearTimeout(t.timeoutTimer),t.request.type){case 100:this.onPromise(t.request);break;case 102:this.onEventListen(t.request);break}this.pendingRequests.delete(i)}}dispose(){this.protocolListener&&(this.protocolListener.dispose(),this.protocolListener=null),Be(this.activeRequests.values()),this.activeRequests.clear()}};var $Mt=class{constructor(i,e=null){this.protocol=i;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(t=>this.onBuffer(t)),this.logger=e}getChannel(i){let e=this;return{call(t,o,n){return e.isDisposed?Promise.reject(new go):e.requestPromise(i,t,o,n)},listen(t,o){return e.isDisposed?U.None:e.requestEvent(i,t,o)}}}requestPromise(i,e,t,o=Se.None){let n=this.lastRequestId++,s={id:n,type:100,channelName:i,name:e,arg:t};if(o.isCancellationRequested)return Promise.reject(new go);let l,c;return new Promise((p,h)=>{if(o.isCancellationRequested)return h(new go);let g=()=>{let b=S=>{switch(S.type){case 201:this.handlers.delete(n),p(S.data);break;case 202:{this.handlers.delete(n);let y=new Error(S.data.message);y.stack=Array.isArray(S.data.stack)?S.data.stack.join(`
`):S.data.stack,y.name=S.data.name,h(y);break}case 203:this.handlers.delete(n),h(S.data);break}};this.handlers.set(n,b),this.sendRequest(s)},f=null;this.state===1?g():(f=Ln(b=>this.whenInitialized()),f.then(()=>{f=null,g()}));let v=()=>{f?(f.cancel(),f=null):this.sendRequest({id:n,type:101}),h(new go)};l=o.onCancellationRequested(v),c={dispose:$c(()=>{v(),l.dispose()})},this.activeRequests.add(c)}).finally(()=>{l?.dispose(),this.activeRequests.delete(c)})}requestEvent(i,e,t){let o=this.lastRequestId++,r={id:o,type:102,channelName:i,name:e,arg:t},s=null,l=new E({onWillAddFirstListener:()=>{let u=()=>{this.activeRequests.add(l),this.sendRequest(r)};this.state===1?u():(s=Ln(p=>this.whenInitialized()),s.then(()=>{s=null,u()}))},onDidRemoveLastListener:()=>{s?(s.cancel(),s=null):(this.activeRequests.delete(l),this.sendRequest({id:o,type:103})),this.handlers.delete(o)}}),c=u=>l.fire(u.data);return this.handlers.set(o,c),l.event}sendRequest(i){switch(i.type){case 100:case 102:{let e=this.send([i.type,i.id,i.channelName,i.name],i.arg);this.logger?.logOutgoing(e,i.id,0,`${a_e(i.type)}: ${i.channelName}.${i.name}`,i.arg);return}case 101:case 103:{let e=this.send([i.type,i.id]);this.logger?.logOutgoing(e,i.id,0,a_e(i.type));return}}}send(i,e=void 0){let t=new K7e;return l_e(t,i),l_e(t,e),this.sendBuffer(t.buffer)}sendBuffer(i){try{return this.protocol.send(i),i.byteLength}catch{return 0}}onBuffer(i){let e=new QMt(i),t=G7e(e),o=G7e(e),n=t[0];switch(n){case 200:return this.logger?.logIncoming(i.byteLength,0,0,jMt(n)),this.onResponse({type:t[0]});case 201:case 202:case 204:case 203:return this.logger?.logIncoming(i.byteLength,t[1],0,jMt(n),o),this.onResponse({type:t[0],id:t[1],data:o})}}onResponse(i){if(i.type===200){this.state=1,this._onDidInitialize.fire();return}this.handlers.get(i.id)?.(i)}get onDidInitializePromise(){return U.toPromise(this.onDidInitialize)}whenInitialized(){return this.state===1?Promise.resolve():this.onDidInitializePromise}dispose(){this.isDisposed=!0,this.protocolListener&&(this.protocolListener.dispose(),this.protocolListener=null),Be(this.activeRequests.values()),this.activeRequests.clear(),this._onDidInitialize.dispose()}};I([hi],$Mt.prototype,"onDidInitializePromise",1);var GJ=class{constructor(i,e,t=null){let o=new K7e;l_e(o,e),i.send(o.buffer),this.channelClient=new $Mt(i,t),this.channelServer=new Yfi(i,e,t)}getChannel(i){return this.channelClient.getChannel(i)}registerChannel(i,e){this.channelServer.registerChannel(i,e)}dispose(){this.channelClient.dispose(),this.channelServer.dispose()}};function n2(a){return{call(i,e,t){return a.then(o=>o.call(i,e,t))},listen(i,e){let t=new Bh;return a.then(o=>t.input=o.listen(i,e)),t.event}}}var Tc;(o=>{function a(n,r,s){let l=n,c=s?.disableMarshalling,u=new Map;for(let p in l)e(p)&&u.set(p,U.buffer(l[p],p,!0,void 0,r));return new class{listen(p,h,g){let f=u.get(h);if(f)return f;let v=l[h];if(typeof v=="function"){if(t(h))return v.call(l,g);if(e(h))return u.set(h,U.buffer(l[h],h,!0,void 0,r)),u.get(h)}throw new pa(`Event not found: ${h}`)}call(p,h,g){let f=l[h];if(typeof f=="function"){if(!c&&Array.isArray(g))for(let b=0;b<g.length;b++)g[b]=$n(g[b]);let v=f.apply(l,g);return v instanceof Promise||(v=Promise.resolve(v)),v}throw new pa(`Method not found: ${h}`)}}}o.fromService=a;function i(n,r){let s=r?.disableMarshalling;return new Proxy({},{get(l,c){if(typeof c=="string")return r?.properties?.has(c)?r.properties.get(c):t(c)?function(u){return n.listen(c,u)}:e(c)?n.listen(c):async function(...u){let p;r&&!nr(r.context)?p=[r.context,...u]:p=u;let h=await n.call(c,p);return s?h:$n(h)};throw new pa(`Property not found: ${String(c)}`)}})}o.toService=i;function e(n){return n[0]==="o"&&n[1]==="n"&&pE(n.charCodeAt(2))}function t(n){return/^onDynamic/.test(n)&&pE(n.charCodeAt(9))}})(Tc||={});var c_e;(r=>{r.enableDiagnostics=!1,r.records=[];let e=new WeakMap,t=0;function o(s,l){if(!e.has(s)){let c=String(++t);e.set(s,c)}return e.get(s)}function n(s,l,c,u){}r.traceSocketEvent=n})(c_e||={});var Xfi=null;function qJ(){return Xfi||(Xfi=qe.alloc(0)),Xfi}var Jfi=class{get byteLength(){return this._totalLength}constructor(){this._chunks=[],this._totalLength=0}acceptChunk(i){this._chunks.push(i),this._totalLength+=i.byteLength}read(i){return this._read(i,!0)}peek(i){return this._read(i,!1)}_read(i,e){if(i===0)return qJ();if(i>this._totalLength)throw new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===i){let r=this._chunks[0];return e&&(this._chunks.shift(),this._totalLength-=i),r}if(this._chunks[0].byteLength>i){let r=this._chunks[0].slice(0,i);return e&&(this._chunks[0]=this._chunks[0].slice(i),this._totalLength-=i),r}let t=qe.alloc(i),o=0,n=0;for(;i>0;){let r=this._chunks[n];if(r.byteLength>i){let s=r.slice(0,i);t.set(s,o),o+=i,e&&(this._chunks[n]=r.slice(i),this._totalLength-=i),i-=i}else t.set(r,o),o+=r.byteLength,e?(this._chunks.shift(),this._totalLength-=r.byteLength):n++,i-=r.byteLength}return t}};function Lno(a){switch(a){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 wA=class{constructor(i,e,t,o){this.type=i;this.id=e;this.ack=t;this.data=o;this.writtenTime=0}get size(){return this.data.byteLength}},q7e=class extends x{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 Jfi,this._register(this._socket.onData(t=>this.acceptChunk(t))),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 t=this._incomingData.read(this._state.readLen);if(this._state.readHead)this._state.readHead=!1,this._state.readLen=t.readUInt32BE(9),this._state.messageType=t.readUInt8(0),this._state.id=t.readUInt32BE(1),this._state.ack=t.readUInt32BE(5),this._socket.traceSocketEvent("protocolHeaderRead",{messageType:Lno(this._state.messageType),id:this._state.id,ack:this._state.ack,messageSize:this._state.readLen});else{let o=this._state.messageType,n=this._state.id,r=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",t),this._onMessage.fire(new wA(o,n,r,t)),this._isDisposed)break}}}readEntireBuffer(){return this._incomingData.read(this._incomingData.byteLength)}dispose(){this._isDisposed=!0,super.dispose()}},$7e=class{constructor(i){this._writeNowTimeout=null;this._isDisposed=!1,this._isPaused=!1,this._socket=i,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(i){if(this._isDisposed)return;i.writtenTime=Date.now(),this.lastWriteTime=Date.now();let e=qe.alloc(13);e.writeUInt8(i.type,0),e.writeUInt32BE(i.id,1),e.writeUInt32BE(i.ack,5),e.writeUInt32BE(i.data.byteLength,9),this._socket.traceSocketEvent("protocolHeaderWrite",{messageType:Lno(i.type),id:i.id,ack:i.ack,messageSize:i.data.byteLength}),this._socket.traceSocketEvent("protocolMessageWrite",i.data),this._writeSoon(e,i.data)}_bufferAdd(i,e){let t=this._totalLength===0;return this._data.push(i,e),this._totalLength+=i.byteLength+e.byteLength,t}_bufferTake(){let i=qe.concat(this._data,this._totalLength);return this._data.length=0,this._totalLength=0,i}_writeSoon(i,e){this._bufferAdd(i,e)&&this._scheduleWriting()}_scheduleWriting(){this._writeNowTimeout||(this._writeNowTimeout=setTimeout(()=>{this._writeNowTimeout=null,this._writeNow()}))}_writeNow(){if(this._totalLength===0||this._isPaused)return;let i=this._bufferTake();this._socket.traceSocketEvent("protocolWrite",{byteLength:i.byteLength}),this._socket.write(i)}},Zfi=class extends x{constructor(e){super();this._onMessage=this._register(new E);this.onMessage=this._onMessage.event;this._onDidDispose=this._register(new E);this.onDidDispose=this._onDidDispose.event;this._socket=e,this._socketWriter=this._register(new $7e(this._socket)),this._socketReader=this._register(new q7e(this._socket)),this._register(this._socketReader.onMessage(t=>{t.type===1&&this._onMessage.fire(t.data)})),this._register(this._socket.onClose(()=>this._onDidDispose.fire()))}drain(){return this._socketWriter.drain()}getSocket(){return this._socket}sendDisconnect(){}send(e){this._socketWriter.write(new wA(1,0,0,e))}},YMt=class a extends GJ{constructor(e,t,o=null){super(e,t,o);this.protocol=e}static fromSocket(e,t){return new a(new Zfi(e),t)}get onDidDispose(){return this.protocol.onDidDispose}dispose(){super.dispose();let e=this.protocol.getSocket();this.protocol.sendDisconnect(),this.protocol.dispose(),e.end()}},U4=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(i){this._hasListeners?this._bufferedMessages.length>0?this._bufferedMessages.push(i):this._emitter.fire(i):this._bufferedMessages.push(i)}flushBuffer(){this._bufferedMessages=[]}},evi=class{constructor(i){this.data=i,this.next=null}},tvi=class{constructor(){this._first=null,this._last=null}length(){let i=0,e=this._first;for(;e;)e=e.next,i++;return i}peek(){return this._first?this._first.data:null}toArray(){let i=[],e=0,t=this._first;for(;t;)i[e++]=t.data,t=t.next;return i}pop(){if(this._first){if(this._first===this._last){this._first=null,this._last=null;return}this._first=this._first.next}}push(i){let e=new evi(i);if(!this._first){this._first=e,this._last=e;return}this._last.next=e,this._last=e}},ivi=class a{static{this._HISTORY_LENGTH=10}static{this._INSTANCE=null}static getInstance(){return a._INSTANCE||(a._INSTANCE=new a),a._INSTANCE}constructor(){this.lastRuns=[];let i=Date.now();for(let e=0;e<a._HISTORY_LENGTH;e++)this.lastRuns[e]=i-1e3*e;setInterval(()=>{for(let e=a._HISTORY_LENGTH;e>=1;e--)this.lastRuns[e]=this.lastRuns[e-1];this.lastRuns[0]=Date.now()},1e3)}load(){let i=Date.now(),e=(1+a._HISTORY_LENGTH)*1e3,t=0;for(let o=0;o<a._HISTORY_LENGTH;o++)i-this.lastRuns[o]<=e&&t++;return 1-t/a._HISTORY_LENGTH}hasHighLoad(){return this.load()>=.5}},XMt=class{constructor(i){this._onControlMessage=new U4;this.onControlMessage=this._onControlMessage.event;this._onMessage=new U4;this.onMessage=this._onMessage.event;this._onDidDispose=new U4;this.onDidDispose=this._onDidDispose.event;this._onSocketClose=new U4;this.onSocketClose=this._onSocketClose.event;this._onSocketTimeout=new U4;this.onSocketTimeout=this._onSocketTimeout.event;this._loadEstimator=i.loadEstimator??ivi.getInstance(),this._shouldSendKeepAlive=i.sendKeepAlive??!0,this._isReconnecting=!1,this._outgoingUnackMsg=new tvi,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 N,this._socket=i.socket,this._socketWriter=this._socketDisposables.add(new $7e(this._socket)),this._socketReader=this._socketDisposables.add(new q7e(this._socket)),this._socketDisposables.add(this._socketReader.onMessage(e=>this._receiveMessage(e))),this._socketDisposables.add(this._socket.onClose(e=>this._onSocketClose.fire(e))),i.initialChunk&&this._socketReader.acceptChunk(i.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 i=new wA(5,0,0,qJ());this._socketWriter.write(i),this._socketWriter.flush()}}sendPause(){let i=new wA(7,0,0,qJ());this._socketWriter.write(i)}sendResume(){let i=new wA(8,0,0,qJ());this._socketWriter.write(i)}pauseSocketWriting(){this._socketWriter.pause()}getSocket(){return this._socket}getMillisSinceLastIncomingData(){return Date.now()-this._socketReader.lastReadTime}beginAcceptReconnection(i,e){this._isReconnecting=!0,this._socketDisposables.dispose(),this._socketDisposables=new N,this._onControlMessage.flushBuffer(),this._onSocketClose.flushBuffer(),this._onSocketTimeout.flushBuffer(),this._socket.dispose(),this._lastReplayRequestTime=0,this._lastSocketTimeoutTime=Date.now(),this._socket=i,this._socketWriter=this._socketDisposables.add(new $7e(this._socket)),this._socketReader=this._socketDisposables.add(new q7e(this._socket)),this._socketDisposables.add(this._socketReader.onMessage(t=>this._receiveMessage(t))),this._socketDisposables.add(this._socket.onClose(t=>this._onSocketClose.fire(t))),this._socketReader.acceptChunk(e)}endAcceptReconnection(){this._isReconnecting=!1,this._incomingAckId=this._incomingMsgId;let i=new wA(3,0,this._incomingAckId,qJ());this._socketWriter.write(i);let e=this._outgoingUnackMsg.toArray();for(let t=0,o=e.length;t<o;t++)this._socketWriter.write(e[t]);this._recvAckCheck()}acceptDisconnect(){this._onDidDispose.fire()}_receiveMessage(i){if(i.ack>this._outgoingAckId){this._outgoingAckId=i.ack;do{let e=this._outgoingUnackMsg.peek();if(e&&e.id<=i.ack)this._outgoingUnackMsg.pop();else break}while(!0)}switch(i.type){case 0:break;case 1:{if(i.id>this._incomingMsgId)if(i.id!==this._incomingMsgId+1){let e=Date.now();e-this._lastReplayRequestTime>1e4&&(this._lastReplayRequestTime=e,this._socketWriter.write(new wA(6,0,0,qJ())))}else this._incomingMsgId=i.id,this._incomingMsgLastTime=Date.now(),this._sendAckCheck(),this._onMessage.fire(i.data);break}case 2:{this._onControlMessage.fire(i.data);break}case 3:break;case 5:{this._onDidDispose.fire();break}case 6:{let e=this._outgoingUnackMsg.toArray();for(let t=0,o=e.length;t<o;t++)this._socketWriter.write(e[t]);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(i){let e=++this._outgoingMsgId;this._incomingAckId=this._incomingMsgId;let t=new wA(1,e,this._incomingAckId,i);this._outgoingUnackMsg.push(t),this._isReconnecting||(this._socketWriter.write(t),this._recvAckCheck())}sendControl(i){let e=new wA(2,0,0,i);this._socketWriter.write(e)}_sendAckCheck(){if(this._incomingMsgId<=this._incomingAckId||this._incomingAckTimeout)return;let i=Date.now()-this._incomingMsgLastTime;if(i>=2e3){this._sendAck();return}this._incomingAckTimeout=setTimeout(()=>{this._incomingAckTimeout=null,this._sendAckCheck()},2e3-i+5)}_recvAckCheck(){if(this._outgoingMsgId<=this._outgoingAckId||this._outgoingAckTimeout||this._isReconnecting)return;let i=this._outgoingUnackMsg.peek(),e=Date.now()-i.writtenTime,t=Date.now()-this._socketReader.lastReadTime,o=Date.now()-this._lastSocketTimeoutTime;if(e>=2e4&&t>=2e4&&o>=2e4&&!this._loadEstimator.hasHighLoad()){this._lastSocketTimeoutTime=Date.now(),this._onSocketTimeout.fire({unacknowledgedMsgCount:this._outgoingUnackMsg.length(),timeSinceOldestUnacknowledgedMsg:e,timeSinceLastReceivedSomeData:t});return}let n=Math.max(2e4-e,2e4-t,2e4-o,500);this._outgoingAckTimeout=setTimeout(()=>{this._outgoingAckTimeout=null,this._recvAckCheck()},n)}_sendAck(){if(this._incomingMsgId<=this._incomingAckId)return;this._incomingAckId=this._incomingMsgId;let i=new wA(3,0,this._incomingAckId,qJ());this._socketWriter.write(i)}_sendKeepAlive(){this._incomingAckId=this._incomingMsgId;let i=new wA(9,0,this._incomingAckId,qJ());this._socketWriter.write(i)}};var h4o=(a,i,e)=>{let t=new Uint8Array(16);for(let r=0;r<16;r++)t[r]=Math.round(Math.random()*256);let o=Yd(qe.wrap(t));return[`GET ws://localhost${a}?${i}&skipWebSocketFrames=true HTTP/1.1`,"Connection: Upgrade","Upgrade: websocket",`Sec-WebSocket-Key: ${o}`].join(`\r
`)+`\r
\r
`},Rno=qe.fromString(`\r
\r
`);async function Mno(a,i,e,t,o){a.write(qe.fromString(h4o(i,e,t)));let n=new N;try{return await new Promise((r,s)=>{let l;n.add(a.onData(c=>{l?l=qe.concat([l,c],l.byteLength+c.byteLength):l=c;let u=l.indexOf(Rno);if(u===-1)return;r(a),a.pauseData();let p=l.slice(u+Rno.byteLength);p.byteLength&&o.onData.fire(p)})),n.add(a.onClose(c=>s(c??new Error("socket closed")))),n.add(a.onEnd(()=>s(new Error("socket ended"))))})}catch(r){throw a.dispose(),r}finally{n.dispose()}}var JMt=class extends x{constructor(e,t){super();this.debugLabel=e;this.pausableDataEmitter=this._register(new Gm);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(t.onData),this._register(t.onData.event(o=>this.pausableDataEmitter.fire(o))),this.onClose=this._register(t.onClose).event,this.onEnd=this._register(t.onEnd).event}pauseData(){this.pausableDataEmitter.pause()}drain(){return Promise.resolve()}end(){this.ended=!0,this.closeRemote()}traceSocketEvent(e,t){c_e.traceSocketEvent(this,this.debugLabel,e,t)}dispose(){this.ended||this.closeRemote(),this.didDisposeEmitter.fire(),super.dispose()}};var r2=le("remoteSocketFactoryService"),ZMt=class{constructor(){this.factories={}}register(i,e){return this.factories[i]??=[],this.factories[i].push(e),Z(()=>{let t=this.factories[i]?.indexOf(e);typeof t=="number"&&t>=0&&this.factories[i]?.splice(t,1)})}getSocketFactory(i){return(this.factories[i.type]||[]).find(t=>t.supports(i))}connect(i,e,t,o){let n=this.getSocketFactory(i);if(!n)throw new Error(`No socket factory found for ${i}`);return n.connect(i,e,t,o)}};var ePt=class extends x{constructor(e,t){super();this._remoteSocketFactoryService=t;this._registrations=this._register(new Vt);this._remoteSockets=new Map;this._proxy=e.getProxy(to.ExtHostManagedSockets)}async $registerSocketFactory(e){let t=this,o=new N,n=new class{supports(r){return r.id===e}connect(r,s,l,c){return new Promise((u,p)=>{if(r.id!==e)return p(new Error("Invalid connectTo"));let h=r.id;t._proxy.$openRemoteSocket(h).then(g=>{let f={onClose:new E,onData:new E,onEnd:new E};t._remoteSockets.set(g,f),ovi.connect(g,t._proxy,s,l,c,f).then(v=>{o.add(U.once(v.onDidDispose)(()=>t._remoteSockets.delete(g))),u(v)},v=>{t._remoteSockets.delete(g),p(v)})}).catch(p)})}};o.add(this._remoteSocketFactoryService.register(1,n)),this._registrations.set(e,o)}async $unregisterSocketFactory(e){this._registrations.deleteAndDispose(e)}$onDidManagedSocketHaveData(e,t){this._remoteSockets.get(e)?.onData.fire(t)}$onDidManagedSocketClose(e,t){this._remoteSockets.get(e)?.onClose.fire({type:0,error:t?new Error(t):void 0,hadError:!!t}),this._remoteSockets.delete(e)}$onDidManagedSocketEnd(e){this._remoteSockets.get(e)?.onEnd.fire()}};ePt=I([fo(qi.MainThreadManagedSockets),m(1,r2)],ePt);var ovi=class a extends JMt{constructor(e,t,o,n){super(o,n);this.socketId=e;this.proxy=t}static connect(e,t,o,n,r,s){let l=new a(e,t,r,s);return Mno(l,o,n,r,s)}write(e){this.proxy.$remoteSocketWrite(this.socketId,e)}closeRemote(){this.proxy.$remoteSocketEnd(this.socketId)}drain(){return this.proxy.$remoteSocketDrain(this.socketId)}};var tPt="text/x-code-output",d_e="Log",$J="text/x-code-log-output",u_e="log",Kc="workbench.panel.output",iPt=new Y("inOutput",!1),Ano=new Y("activeLogOutput",!1),oPt=new Y("activeLogOutput.isLog",!1),nPt=new Y("activeLogOutput.levelSettable",!1),rPt=new Y("activeLogOutput.level",""),sPt=new Y("activeLogOutput.levelIsDefault",!1),aPt=new Y("outputView.scrollLock",!1),lPt=new Y("activeOutputChannel",""),cPt=new Y("output.filter.trace",!0),dPt=new Y("output.filter.debug",!0),uPt=new Y("output.filter.info",!0),pPt=new Y("output.filter.warning",!0),mPt=new Y("output.filter.error",!0),p_e=new Y("outputFilterFocus",!1),hPt=new Y("output.filter.categories",""),kl=le("outputService");var Hv={OutputChannels:"workbench.contributions.outputChannels"};function CA(a){return!!a.source&&!Array.isArray(a.source)}function UB(a){return Array.isArray(a.source)}var nvi=class extends x{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(t=>e.push(t)),e}getChannel(e){return this.channels.get(e)}updateChannelSources(e,t){let o=this.channels.get(e);o&&UB(o)&&(o.source=t,this._onDidUpdateChannelFiles.fire(o))}removeChannel(e){let t=this.channels.get(e);t&&(this.channels.delete(e),this._onDidRemoveChannel.fire(t))}};ne.add(Hv.OutputChannels,new nvi);var $t=le("viewsService");var jJ=class extends x{constructor(e,t,o,n,r){super();this._outputStatusItem=this._register(new me);this._outputService=t,this._viewsService=o,this._configurationService=n,this._statusbarService=r,this._proxy=e.getProxy(to.ExtHostOutputService);let s=()=>{let l=this._viewsService.isViewVisible(Kc)?this._outputService.getActiveChannel():void 0;this._proxy.$setVisibleChannel(l?l.id:null),this._outputStatusItem.value=void 0};this._register(U.any(this._outputService.onActiveOutputChannel,U.filter(this._viewsService.onDidChangeViewVisibility,({id:l})=>l===Kc))(()=>s())),s()}async $register(e,t,o,n){let r=(jJ._extensionIdPool.get(n)||0)+1;jJ._extensionIdPool.set(n,r);let s=`extension-output-${n}-#${r}-${e}`,l=A.revive(t);return ne.as(Hv.OutputChannels).registerChannel({id:s,label:e,source:{resource:l},log:!1,languageId:o,extensionId:n}),this._register(Z(()=>this.$dispose(s))),s}async $update(e,t,o){let n=this._getChannel(e);n&&(t===1?n.update(t):Yo(o)&&n.update(t,o))}async $reveal(e,t){let o=this._getChannel(e);if(!o)return;let n=this._configurationService.getValue("workbench.view.showQuietly")??{};if(!this._viewsService.isViewVisible(Kc)&&n[Kc]){this._showChannelQuietly(o);return}this._outputService.showChannel(o.id,t)}_showChannelQuietly(e){let t={name:d(3345,null),text:"$(output)",ariaLabel:d(3346,null,e.label),command:`workbench.action.output.show.${e.id}`,tooltip:d(3347,null,e.label),kind:"prominent"};this._outputStatusItem.value?this._outputStatusItem.value.update(t):this._outputStatusItem.value=this._statusbarService.addEntry(t,"status.view.showQuietly",1,{location:{id:"status.notifications",priority:Number.NEGATIVE_INFINITY},alignment:0})}async $close(e){if(this._viewsService.isViewVisible(Kc)){let t=this._outputService.getActiveChannel();t&&e===t.id&&this._viewsService.closeView(Kc)}}async $dispose(e){this._getChannel(e)?.dispose()}_getChannel(e){return this._outputService.getChannel(e)}};jJ._extensionIdPool=new Map,jJ=I([fo(qi.MainThreadOutputService),m(1,kl),m(2,$t),m(3,B),m(4,kr)],jJ);var Wue=class{constructor(i,e,t){this._commandService=t;this._progress=new Map;this._proxy=i.getProxy(to.ExtHostProgress),this._progressService=e}dispose(){this._progress.forEach(i=>i.resolve()),this._progress.clear()}async $startProgress(i,e,t){let o=this._createTask(i);if(e.location===15&&t){let n=Wue.URGENT_PROGRESS_SOURCES.includes(t);e={...e,priority:n?3:0,location:15,secondaryActions:[ii({id:t,label:d(3348,null),run:()=>this._commandService.executeCommand("_extensions.manage",t)})]}}try{this._progressService.withProgress(e,o,()=>this._proxy.$acceptProgressCanceled(i))}catch(n){ys(n)}}$progressReport(i,e){this._progress.get(i)?.progress.report(e)}$progressEnd(i){let e=this._progress.get(i);e&&(e.resolve(),this._progress.delete(i))}_createTask(i){return e=>new Promise(t=>{this._progress.set(i,{resolve:t,progress:e})})}};Wue.URGENT_PROGRESS_SOURCES=["vscode.github-authentication","vscode.microsoft-authentication"],Wue=I([fo(qi.MainThreadProgress),m(1,Fo),m(2,ge)],Wue);var gPt=class{constructor(i,e){this.quickDiffService=e;this.providerDisposables=new Vt;this.proxy=i.getProxy(to.ExtHostQuickDiff)}async $registerQuickDiffProvider(i,e,t,o,n){let r={id:t,label:o,rootUri:A.revive(n),selector:e,kind:"contributed",getOriginalResource:async l=>A.revive(await this.proxy.$provideOriginalResource(i,l,Se.None))},s=this.quickDiffService.addQuickDiffProvider(r);this.providerDisposables.set(i,s)}async $unregisterQuickDiffProvider(i){this.providerDisposables.has(i)&&this.providerDisposables.deleteAndDispose(i)}dispose(){this.providerDisposables.dispose()}};gPt=I([fo(qi.MainThreadQuickDiff),m(1,mT)],gPt);var fPt=class{constructor(i,e,t,o,n,r){this.labelService=t;this.customEditorLabelService=o;this.modelService=n;this.languageService=r;this._items={};this.sessions=new Map;this._proxy=i.getProxy(to.ExtHostQuickOpen),this._quickInputService=e}dispose(){for(let[i,e]of this.sessions)e.store.dispose()}$show(i,e,t){let o=new Promise((n,r)=>{this._items[i]={resolve:n,reject:r}});return e={...e,onDidFocus:n=>{n&&this._proxy.$onItemSelected(n.handle)}},e.canPickMany?this._quickInputService.pick(o,e,t).then(n=>{if(n)return n.map(r=>r.handle)}):this._quickInputService.pick(o,e,t).then(n=>{if(n)return n.handle})}$setItems(i,e){return this._items[i]&&(e.forEach(t=>this.expandItemProps(t)),this._items[i].resolve(e),delete this._items[i]),Promise.resolve()}$setError(i,e){return this._items[i]&&(this._items[i].reject(e),delete this._items[i]),Promise.resolve()}$input(i,e,t){let o=Object.create(null);return i&&(o.title=i.title,o.password=i.password,o.placeHolder=i.placeHolder,o.valueSelection=i.valueSelection,o.prompt=i.prompt,o.value=i.value,o.ignoreFocusLost=i.ignoreFocusOut),e&&(o.validateInput=n=>this._proxy.$validateInput(n)),this._quickInputService.input(o,t)}$createOrUpdate(i){let e=i.id,t=this.sessions.get(e);if(!t){let s=new N,l=i.type==="quickPick"?this._quickInputService.createQuickPick():this._quickInputService.createInputBox();if(s.add(l),s.add(l.onDidAccept(()=>{this._proxy.$onDidAccept(e)})),s.add(l.onDidTriggerButton(c=>{this._proxy.$onDidTriggerButton(e,c.handle,c.toggle?.checked)})),s.add(l.onDidChangeValue(c=>{this._proxy.$onDidChangeValue(e,c)})),s.add(l.onDidHide(()=>{this._proxy.$onDidHide(e)})),i.type==="quickPick"){let c=l;s.add(c.onDidChangeActive(u=>{this._proxy.$onDidChangeActive(e,u.map(p=>p.handle))})),s.add(c.onDidChangeSelection(u=>{this._proxy.$onDidChangeSelection(e,u.map(p=>p.handle))})),s.add(c.onDidTriggerItemButton(u=>{let p=u.button;this._proxy.$onDidTriggerItemButton(e,u.item.handle,p.handle,p.toggle?.checked)}))}t={input:l,handlesToItems:new Map,store:s},this.sessions.set(e,t)}let{input:o,handlesToItems:n}=t,r=o;for(let s in i)switch(s){case"id":case"type":continue;case"visible":i.visible?o.show():o.hide();break;case"items":{n.clear(),i.items?.forEach(l=>{this.expandItemProps(l),l.type!=="separator"&&(l.buttons?.forEach(c=>this.expandIconPath(c)),n.set(l.handle,l))}),r.items=i.items;break}case"activeItems":r.activeItems=i.activeItems?.map(l=>n.get(l)).filter(Boolean);break;case"selectedItems":r.selectedItems=i.selectedItems?.map(l=>n.get(l)).filter(Boolean);break;case"buttons":{let l=[];for(let c of i.buttons)c.handle===-1?l.push(this._quickInputService.backButton):(this.expandIconPath(c),l.push(c));o.buttons=l;break}default:o[s]=i[s];break}return Promise.resolve(void 0)}$dispose(i){let e=this.sessions.get(i);return e&&(e.store.dispose(),this.sessions.delete(i)),Promise.resolve(void 0)}expandItemProps(i){if(i.type==="separator")return;if(!i.resourceUri){this.expandIconPath(i);return}let e=A.from(i.resourceUri);i.label??=this.customEditorLabelService.getName(e)||"",i.label?i.description??=this.labelService.getUriLabel(e,{relative:!0}):(i.label=Ga(e),i.description??=this.labelService.getUriLabel(ci(e),{relative:!0}));let t=i.iconPathDto;if(q.isThemeIcon(t)&&(q.isFile(t)||q.isFolder(t))){let o=q.isFolder(t)||eae(e)?1:0,n=new co(()=>aa(this.modelService,this.languageService,e,o));Object.defineProperty(i,"iconClasses",{get:()=>n.value})}else this.expandIconPath(i)}expandIconPath(i){let e=i.iconPathDto;if(e)if(q.isThemeIcon(e))i.iconClass=q.asClassName(e);else if(km(e)){let t=A.from(e);i.iconPath={dark:t,light:t}}else{let{dark:t,light:o}=e;i.iconPath={dark:A.from(t),light:A.from(o)}}else return}};fPt=I([fo(qi.MainThreadQuickOpen),m(1,Ue),m(2,rt),m(3,Rv),m(4,Tt),m(5,_t)],fPt);var vPt=class extends x{constructor(e,t,o){super();this._environmentService=t;this._proxy=e.getProxy(to.ExtHostExtensionService);let n=this._environmentService.remoteAuthority;n&&this._register(o.onDidChangeConnectionData(()=>{let r=o.getConnectionData(n);r&&this._proxy.$updateRemoteConnectionData(r)}))}};vPt=I([AR,m(1,At),m(2,Uc)],vPt);var rvi=class{constructor(i){this._proxy=i.getProxy(to.ExtHostDocumentSaveParticipant)}async participate(i,e,t,o){if(!i.textEditorModel||!Hx(i.textEditorModel))return;let n=new Promise((r,s)=>{setTimeout(()=>s(new Error(d(3349,null))),1750),this._proxy.$participateInSave(i.resource,e.reason).then(l=>{if(!l.every(c=>c))return Promise.reject(new Error("listener failed"))}).then(r,s)});return Wp(n,o)}},bPt=class{constructor(i,e,t){this._textFileService=t;this._saveParticipantDisposable=this._textFileService.files.addSaveParticipant(e.createInstance(rvi,i))}dispose(){this._saveParticipantDisposable.dispose()}};bPt=I([AR,m(1,F),m(2,Uo)],bPt);var ZC=le("speechService"),zB=new Y("hasSpeechProvider",!1,{type:"boolean",description:d(14247,null)}),QJ=new Y("speechToTextInProgress",!1,{type:"boolean",description:d(14274,null)}),SPt=new Y("textToSpeechInProgress",!1,{type:"boolean",description:d(14275,null)});var svi="accessibility.voice.speechLanguage",avi={"da-DK":{name:d(14248,null)},"de-DE":{name:d(14249,null)},"en-AU":{name:d(14250,null)},"en-CA":{name:d(14251,null)},"en-GB":{name:d(14252,null)},"en-IE":{name:d(14253,null)},"en-IN":{name:d(14254,null)},"en-NZ":{name:d(14255,null)},"en-US":{name:d(14256,null)},"es-ES":{name:d(14257,null)},"es-MX":{name:d(14258,null)},"fr-CA":{name:d(14259,null)},"fr-FR":{name:d(14260,null)},"hi-IN":{name:d(14261,null)},"it-IT":{name:d(14262,null)},"ja-JP":{name:d(14263,null)},"ko-KR":{name:d(14264,null)},"nl-NL":{name:d(14265,null)},"pt-PT":{name:d(14267,null)},"pt-BR":{name:d(14266,null)},"ru-RU":{name:d(14268,null)},"sv-SE":{name:d(14269,null)},"tr-TR":{name:d(14270,null)},"zh-CN":{name:d(14271,null)},"zh-HK":{name:d(14272,null)},"zh-TW":{name:d(14273,null)}};function IPt(a,i=wr){if(typeof a=="string"){if(a==="auto"){if(i!=="en"){let e=i.split("-");return IPt(`${e[0]}-${(e[1]??e[0]).toUpperCase()}`)}}else if(avi[a])return a}return"en-US"}var yPt=class{constructor(i,e,t){this.speechService=e;this.logService=t;this.providerRegistrations=new Map;this.speechToTextSessions=new Map;this.textToSpeechSessions=new Map;this.keywordRecognitionSessions=new Map;this.proxy=i.getProxy(to.ExtHostSpeech)}$registerProvider(i,e,t){this.logService.trace("[Speech] extension registered provider",t.extension.value);let o=this.speechService.registerSpeechProvider(e,{metadata:t,createSpeechToTextSession:(n,r)=>{if(n.isCancellationRequested)return{onDidChange:U.None};let s=new N,l=Math.random();this.proxy.$createSpeechToTextSession(i,l,r?.language);let c=s.add(new E);return this.speechToTextSessions.set(l,{onDidChange:c}),s.add(n.onCancellationRequested(()=>{this.proxy.$cancelSpeechToTextSession(l),this.speechToTextSessions.delete(l),s.dispose()})),{onDidChange:c.event}},createTextToSpeechSession:(n,r)=>{if(n.isCancellationRequested)return{onDidChange:U.None,synthesize:async()=>{}};let s=new N,l=Math.random();this.proxy.$createTextToSpeechSession(i,l,r?.language);let c=s.add(new E);return this.textToSpeechSessions.set(l,{onDidChange:c}),s.add(n.onCancellationRequested(()=>{this.proxy.$cancelTextToSpeechSession(l),this.textToSpeechSessions.delete(l),s.dispose()})),{onDidChange:c.event,synthesize:async u=>{await this.proxy.$synthesizeSpeech(l,u);let p=new N;try{await Va(U.toPromise(U.filter(c.event,h=>h.status===2,p),p),n)}finally{p.dispose()}}}},createKeywordRecognitionSession:n=>{if(n.isCancellationRequested)return{onDidChange:U.None};let r=new N,s=Math.random();this.proxy.$createKeywordRecognitionSession(i,s);let l=r.add(new E);return this.keywordRecognitionSessions.set(s,{onDidChange:l}),r.add(n.onCancellationRequested(()=>{this.proxy.$cancelKeywordRecognitionSession(s),this.keywordRecognitionSessions.delete(s),r.dispose()})),{onDidChange:l.event}}});this.providerRegistrations.set(i,{dispose:()=>{o.dispose()}})}$unregisterProvider(i){let e=this.providerRegistrations.get(i);e&&(e.dispose(),this.providerRegistrations.delete(i))}$emitSpeechToTextEvent(i,e){this.speechToTextSessions.get(i)?.onDidChange.fire(e)}$emitTextToSpeechEvent(i,e){this.textToSpeechSessions.get(i)?.onDidChange.fire(e)}$emitKeywordRecognitionEvent(i,e){this.keywordRecognitionSessions.get(i)?.onDidChange.fire(e)}dispose(){this.providerRegistrations.forEach(i=>i.dispose()),this.providerRegistrations.clear(),this.speechToTextSessions.forEach(i=>i.onDidChange.dispose()),this.speechToTextSessions.clear(),this.textToSpeechSessions.forEach(i=>i.onDidChange.dispose()),this.textToSpeechSessions.clear(),this.keywordRecognitionSessions.forEach(i=>i.onDidChange.dispose()),this.keywordRecognitionSessions.clear()}};yPt=I([fo(qi.MainThreadSpeech),m(1,ZC),m(2,se)],yPt);var s2=le("editSessionIdentityService");var lvi=class{constructor(i){this.timeout=2e4;this._proxy=i.getProxy(to.ExtHostWorkspace)}async participate(i,e){let t=new Promise((o,n)=>{setTimeout(()=>n(new Error(d(3300,null))),this.timeout),this._proxy.$onWillCreateEditSessionIdentity(i.uri,e,this.timeout).then(o,n)});return Wp(t,e)}},wPt=class{constructor(i,e,t){this._editSessionIdentityService=t;this._saveParticipantDisposable=this._editSessionIdentityService.addEditSessionIdentityCreateParticipant(e.createInstance(lvi,i))}dispose(){this._saveParticipantDisposable.dispose()}};wPt=I([AR,m(1,F),m(2,s2)],wPt);var m_e=class{constructor(i,e,t,o=void 0,n=void 0){this.uri=i;this.relativePath=e;this.context=t;this.element=o;this.parent=n;this._children=new Map}get childrenCount(){return this._children.size}get children(){return this._children.values()}get name(){return Oo.basename(this.relativePath)}get(i){return this._children.get(i)}set(i,e){this._children.set(i,e)}delete(i){this._children.delete(i)}clear(){this._children.clear()}};I([hi],m_e.prototype,"name",1);function Ono(a,i){typeof a.element<"u"&&i.push(a.element);for(let e of a.children)Ono(e,i);return i}var fm=class{constructor(i,e=A.file("/"),t=ar){this.extUri=t;this.root=new m_e(e,"",i)}static getRoot(i){for(;i.parent;)i=i.parent;return i}static collect(i){return Ono(i,[])}static isResourceNode(i){return i instanceof m_e}add(i,e){let t=this.extUri.relativePath(this.root.uri,i)||i.path,o=new W7(!1).reset(t),n=this.root,r="";for(;;){let s=o.value();r=r+"/"+s;let l=n.get(s);if(l?o.hasNext()||(l.element=e):(l=new m_e(this.extUri.joinPath(this.root.uri,r),r,this.root.context,o.hasNext()?void 0:e,n),n.set(s,l)),n=l,!o.hasNext())return;o.next()}}delete(i){let e=this.extUri.relativePath(this.root.uri,i)||i.path,t=new W7(!1).reset(e);return this._delete(this.root,t)}_delete(i,e){let t=e.value(),o=i.get(t);if(o){if(e.hasNext()){let n=this._delete(o,e.next());return typeof n<"u"&&o.childrenCount===0&&i.delete(t),n}return i.delete(t),o.element}}clear(){this.root.clear()}getNode(i){let e=this.extUri.relativePath(this.root.uri,i)||i.path,t=new W7(!1).reset(e),o=this.root;for(;;){let n=t.value(),r=o.get(n);if(!r||!t.hasNext())return r;o=r,t.next()}}};var ZF="scm-graph-incoming-changes",YJ="scm-graph-outgoing-changes";var xA=22,Eh=11,Vue=5,z4=4,XJ=2,Hue=te("scmGraph.historyItemRefColor",zje,d(13745,null)),j7e=te("scmGraph.historyItemRemoteRefColor",Vvt,d(13746,null)),Wno=te("scmGraph.historyItemBaseRefColor","#EA5C00",d(13741,null)),f4o=te("scmGraph.historyItemHoverDefaultLabelForeground",To,d(13743,null)),dvi=te("scmGraph.historyItemHoverDefaultLabelBackground",bv,d(13742,null)),uvi=te("scmGraph.historyItemHoverLabelForeground",lI,d(13744,null)),ZZa=te("scmGraph.historyItemHoverAdditionsForeground",{light:"#587C0C",dark:"#81B88B",hcDark:"#A1E3AD",hcLight:"#374E06"},d(13734,null)),eel=te("scmGraph.historyItemHoverDeletionsForeground",{light:"#AD0707",dark:"#C74E39",hcDark:"#C74E39",hcLight:"#AD0707"},d(13735,null)),Fno=[te("scmGraph.foreground1","#FFB000",d(13736,null)),te("scmGraph.foreground2","#DC267F",d(13737,null)),te("scmGraph.foreground3","#994F00",d(13738,null)),te("scmGraph.foreground4","#40B0A6",d(13739,null)),te("scmGraph.foreground5","#B66DFF",d(13740,null))];function cvi(a,i){if(a.id===ZF)return j7e;if(a.id===YJ)return Hue;for(let e of a.references??[]){let t=i.get(e.id);if(t!==void 0)return t}}function CPt(a,i=1){let e=document.createElementNS("http://www.w3.org/2000/svg","path");return e.setAttribute("fill","none"),e.setAttribute("stroke-width",`${i}px`),e.setAttribute("stroke-linecap","round"),e.style.stroke=kt(a),e}function Bue(a,i,e,t){let o=document.createElementNS("http://www.w3.org/2000/svg","circle");return o.setAttribute("cx",`${Eh*(a+1)}`),o.setAttribute("cy",`${Eh}`),o.setAttribute("r",`${i}`),o.style.strokeWidth=`${e}px`,t&&(o.style.fill=kt(t)),o}function v4o(a,i,e,t){let o=document.createElementNS("http://www.w3.org/2000/svg","circle");return o.setAttribute("cx",`${Eh*(a+1)}`),o.setAttribute("cy",`${Eh}`),o.setAttribute("r",`${z4+1}`),o.style.stroke=kt(t),o.style.strokeWidth=`${e}px`,o.style.strokeDasharray="4,2",o}function xPt(a,i,e,t,o=1){let n=CPt(t,o);return n.setAttribute("d",`M ${a} ${i} V ${e}`),n}function b4o(a,i){for(let e=a.length-1;e>=0;e--)if(a[e].id===i)return e;return-1}function Vno(a){let i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.classList.add("graph");let e=a.historyItem,t=a.inputSwimlanes,o=a.outputSwimlanes,n=t.findIndex(c=>c.id===e.id),r=n!==-1?n:t.length,s=r<o.length?o[r].color:r<t.length?t[r].color:Hue,l=0;for(let c=0;c<t.length;c++){let u=t[c].color;if(t[c].id===e.id)if(c!==r){let p=[],h=CPt(u);p.push(`M ${Eh*(c+1)} 0`),p.push(`A ${Eh} ${Eh} 0 0 1 ${Eh*c} ${Eh}`),p.push(`H ${Eh*(r+1)}`),h.setAttribute("d",p.join(" ")),i.append(h)}else l++;else if(l<o.length&&t[c].id===o[l].id){if(c===l){let p=xPt(Eh*(c+1),0,xA,u);i.append(p)}else{let p=[],h=CPt(u);p.push(`M ${Eh*(c+1)} 0`),p.push("V 6"),p.push(`A ${Vue} ${Vue} 0 0 1 ${Eh*(c+1)-Vue} ${xA/2}`),p.push(`H ${Eh*(l+1)+Vue}`),p.push(`A ${Vue} ${Vue} 0 0 0 ${Eh*(l+1)} ${xA/2+Vue}`),p.push(`V ${xA}`),h.setAttribute("d",p.join(" ")),i.append(h)}l++}}for(let c=1;c<e.parentIds.length;c++){let u=b4o(o,e.parentIds[c]);if(u===-1)continue;let p=[],h=CPt(o[u].color);p.push(`M ${Eh*u} ${xA/2}`),p.push(`A ${Eh} ${Eh} 0 0 1 ${Eh*(u+1)} ${xA}`),p.push(`M ${Eh*u} ${xA/2}`),p.push(`H ${Eh*(r+1)} `),h.setAttribute("d",p.join(" ")),i.append(h)}if(n!==-1){let c=xPt(Eh*(r+1),0,xA/2,t[n].color);i.append(c)}if(e.parentIds.length>0){let c=xPt(Eh*(r+1),xA/2,xA,s);i.append(c)}if(a.kind==="HEAD"){let c=Bue(r,z4+3,XJ,s);i.append(c);let u=Bue(r,XJ,z4);i.append(u)}else if(a.kind==="incoming-changes"||a.kind==="outgoing-changes"){let c=Bue(r,z4+3,XJ,s);i.append(c);let u=Bue(r,z4+1,XJ+1);i.append(u);let p=v4o(r,z4+1,XJ-1,s);i.append(p)}else if(e.parentIds.length>1){let c=Bue(r,z4+2,XJ,s);i.append(c);let u=Bue(r,z4-1,XJ,s);i.append(u)}else{let c=Bue(r,z4+1,XJ,s);i.append(c)}return i.style.height=`${xA}px`,i.style.width=`${Eh*(Math.max(t.length,o.length,1)+1)}px`,i}function pvi(a,i){let e=o$i("svg",{style:{height:`${xA}px`,width:`${Eh*(a.length+1)}px`}});for(let t=0;t<a.length;t++){let o=t===i?3:1,n=xPt(Eh*(t+1),0,xA,a[t].color,o);e.root.append(n)}return e.root}function Bno(a,i=new Map,e,t,o,n,r,s){let l=-1,c=[];for(let u=0;u<a.length;u++){let p=a[u],h=p.id===e?.revision?"HEAD":"node",f=(c.at(-1)?.outputSwimlanes??[]).map(y=>Ji(y)),v=[],b=!1;if(p.parentIds.length>0)for(let y of f){if(y.id===p.id){b||(v.push({id:p.parentIds[0],color:cvi(p,i)??y.color}),b=!0);continue}v.push(Ji(y))}for(let y=b?1:0;y<p.parentIds.length;y++){let w;if(y===0)w=cvi(p,i);else{let k=a.find(T=>T.id===p.parentIds[y]);w=k?cvi(k,i):void 0}w||(l=bV(l+1,Fno.length),w=Fno[l]),v.push({id:p.parentIds[y],color:w})}let S=(p.references??[]).map(y=>{let w=i.get(y.id);if(i.has(y.id)&&w===void 0){let k=f.findIndex(P=>P.id===p.id),T=k!==-1?k:f.length;w=T<v.length?v[T].color:T<f.length?f[T].color:Hue}return{...y,color:w}});S.sort((y,w)=>I4o(y,w,e,t,o)),c.push({historyItem:{...p,references:S},kind:h,inputSwimlanes:f,outputSwimlanes:v})}return S4o(c,e,t,n,r,s),c}function Hno(a){let i=a.historyItem,e=a.inputSwimlanes,t=e.findIndex(o=>o.id===i.id);return t!==-1?t:e.length}function S4o(a,i,e,t,o,n){if(i?.revision!==e?.revision&&n){if(t&&e&&e.revision!==n){let r=OSe(a,l=>l.outputSwimlanes.some(c=>c.id===n)),s=a.findIndex(l=>l.historyItem.id===n);if(r!==-1&&s!==-1&&!(a[r].historyItem.parentIds.length===2&&a[r].historyItem.parentIds.includes(n))){a[r]={...a[r],inputSwimlanes:a[r].inputSwimlanes.map(g=>g.id===n&&g.color===j7e?{...g,id:ZF}:g),outputSwimlanes:a[r].outputSwimlanes.map(g=>g.id===n&&g.color===j7e?{...g,id:ZF}:g)};let c=a[r].outputSwimlanes.map(g=>Ji(g)),u=a[s].inputSwimlanes.map(g=>Ji(g)),p=a[0].historyItem.displayId?.length??0,h={id:ZF,displayId:"0".repeat(p),parentIds:[n],author:e?.name,subject:d(13732,null),message:""};a.splice(s,0,{historyItem:h,kind:"incoming-changes",inputSwimlanes:c,outputSwimlanes:u})}}if(o&&i?.revision&&i.revision!==n){let r=a.findIndex(s=>s.kind==="HEAD"&&s.historyItem.id===i.revision);if(r!==-1){let s={id:YJ,displayId:a[0].historyItem.displayId?"0".repeat(a[0].historyItem.displayId.length):void 0,parentIds:[i.revision],author:i?.name,subject:d(13733,null),message:""},l=a[r].inputSwimlanes.slice(0),c=l.slice(0).concat({id:i.revision,color:Hue});a.splice(r,0,{historyItem:s,kind:"outgoing-changes",inputSwimlanes:l,outputSwimlanes:c}),a[r+1].inputSwimlanes.push({id:i.revision,color:Hue})}}}}function I4o(a,i,e,t,o){let n=l=>l.id===e?.id?1:l.id===t?.id?2:l.id===o?.id?3:l.color!==void 0?4:99,r=n(a),s=n(i);return r-s}function Q7e(a,i,e){let t=new N;if(i.tooltip===void 0)return{content:i.message,disposables:t};if(Ar(i.tooltip))return{content:i.tooltip,disposables:t};let o=i.tooltip.slice();if(e&&i.references?.length){let r=new Ie("",{supportHtml:!0,supportThemeIcons:!0});for(let s of i.references){let l=q.isThemeIcon(s.icon)?s.icon.id:"",c=s.color?kt(s.color):kt(dvi),u=s.color?kt(uvi):kt(f4o);r.appendMarkdown(`<span style="color:${u};background-color:${c};border-radius:10px;">&nbsp;$(${l})&nbsp;`),r.appendText(s.name),r.appendMarkdown("&nbsp;&nbsp;</span>")}r.appendMarkdown(`

---

`),o.splice(o.length-1,0,r)}let n=_(".history-item-hover-container");for(let r of o){if(UV(r))continue;let s=a.render(r);n.appendChild(s.element),t.add(s)}return{content:n,disposables:t}}function Uue(a){if(a!==void 0){if(q.isThemeIcon(a))return a;if(km(a))return A.revive(a);{let i=a;return{light:A.revive(i.light),dark:A.revive(i.dark)}}}}function Uno(a){let i=Uue(a.authorIcon),e=a.references?.map(t=>({...t,icon:Uue(t.icon)}));return{...a,authorIcon:i,references:e}}function h_e(a,i){return a?{...a,icon:Uue(a.icon),color:i}:void 0}var mvi=class extends x{constructor(e,t,o){super();this.modelService=t;this.languageService=o;this._register(e.registerTextModelContentProvider(Q.vscodeSourceControl,this))}async provideTextContent(e){let t=this.modelService.getModel(e);return t||this.modelService.createModel("",this.languageService.createById("scminput"),e)}},hvi=class{constructor(i,e,t,o,n,r,s,l){this.sourceControlHandle=i;this.handle=e;this.provider=t;this.features=o;this.label=n;this.id=r;this.multiDiffEditorEnableViewChanges=s;this._uriIdentService=l;this.resources=[];this._onDidChange=new E;this.onDidChange=this._onDidChange.event;this._onDidChangeResources=new E;this.onDidChangeResources=this._onDidChangeResources.event}get resourceTree(){if(!this._resourceTree){let i=this.provider.rootUri??A.file("/");this._resourceTree=new fm(this,i,this._uriIdentService.extUri);for(let e of this.resources)this._resourceTree.add(e.sourceUri,e)}return this._resourceTree}get hideWhenEmpty(){return!!this.features.hideWhenEmpty}get contextValue(){return this.features.contextValue}toJSON(){return{$mid:4,sourceControlHandle:this.sourceControlHandle,groupHandle:this.handle}}splice(i,e,t){this.resources.splice(i,e,...t),this._resourceTree=void 0,this._onDidChangeResources.fire()}$updateGroup(i){this.features={...this.features,...i},this._onDidChange.fire()}$updateGroupLabel(i){this.label=i,this._onDidChange.fire()}},gvi=class{constructor(i,e,t,o,n,r,s,l,c,u,p){this.proxy=i;this.sourceControlHandle=e;this.groupHandle=t;this.handle=o;this.sourceUri=n;this.resourceGroup=r;this.decorations=s;this.contextValue=l;this.command=c;this.multiDiffEditorOriginalUri=u;this.multiDiffEditorModifiedUri=p}open(i){return this.proxy.$executeResourceCommand(this.sourceControlHandle,this.groupHandle,this.handle,i)}toJSON(){return{$mid:3,sourceControlHandle:this.sourceControlHandle,groupHandle:this.groupHandle,handle:this.handle}}},fvi=class{constructor(i,e){this.proxy=i;this.handle=e;this._onDidChangeArtifacts=new E;this.onDidChangeArtifacts=this._onDidChangeArtifacts.event;this._disposables=new N;this._disposables.add(this._onDidChangeArtifacts)}async provideArtifactGroups(i){return(await this.proxy.$provideArtifactGroups(this.handle,i??Se.None))?.map(t=>({...t,icon:Uue(t.icon)}))}async provideArtifacts(i,e){return(await this.proxy.$provideArtifacts(this.handle,i,e??Se.None))?.map(o=>({...o,icon:Uue(o.icon)}))}$onDidChangeArtifacts(i){this._onDidChangeArtifacts.fire(i)}dispose(){this._disposables.dispose()}},vvi=class{constructor(i,e){this.proxy=i;this.handle=e;this._historyItemRef=ph({owner:this,equalsFn:b_},void 0);this._historyItemRemoteRef=ph({owner:this,equalsFn:b_},void 0);this._historyItemBaseRef=ph({owner:this,equalsFn:b_},void 0);this._historyItemRefChanges=Me(this,{added:[],modified:[],removed:[],silent:!1})}get historyItemRef(){return this._historyItemRef}get historyItemRemoteRef(){return this._historyItemRemoteRef}get historyItemBaseRef(){return this._historyItemBaseRef}get historyItemRefChanges(){return this._historyItemRefChanges}async resolveHistoryItem(i,e){let t=await this.proxy.$resolveHistoryItem(this.handle,i,e??Se.None);return t?Uno(t):void 0}async resolveHistoryItemChatContext(i,e){return this.proxy.$resolveHistoryItemChatContext(this.handle,i,e??Se.None)}async resolveHistoryItemChangeRangeChatContext(i,e,t,o){return this.proxy.$resolveHistoryItemChangeRangeChatContext(this.handle,i,e,t,o??Se.None)}async resolveHistoryItemRefsCommonAncestor(i,e){return this.proxy.$resolveHistoryItemRefsCommonAncestor(this.handle,i,e??Se.None)}async provideHistoryItemRefs(i,e){return(await this.proxy.$provideHistoryItemRefs(this.handle,i,e??Se.None))?.map(o=>({...o,icon:Uue(o.icon)}))}async provideHistoryItems(i,e){return(await this.proxy.$provideHistoryItems(this.handle,i,e??Se.None))?.map(o=>Uno(o))}async provideHistoryItemChanges(i,e,t){return(await this.proxy.$provideHistoryItemChanges(this.handle,i,e,t??Se.None))?.map(n=>({uri:A.revive(n.uri),originalUri:n.originalUri&&A.revive(n.originalUri),modifiedUri:n.modifiedUri&&A.revive(n.modifiedUri)}))}$onDidChangeCurrentHistoryItemRefs(i,e,t){Gi(o=>{this._historyItemRef.set(h_e(i,Hue),o),this._historyItemRemoteRef.set(h_e(e,j7e),o),this._historyItemBaseRef.set(h_e(t,Wno),o)})}$onDidChangeHistoryItemRefs(i){let e=i.added.map(n=>h_e(n)),t=i.modified.map(n=>h_e(n)),o=i.removed.map(n=>h_e(n));this._historyItemRefChanges.set({added:e,modified:t,removed:o,silent:i.silent},void 0)}},bvi=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h){this.proxy=i;this._handle=e;this._parentHandle=t;this._providerId=o;this._label=n;this._rootUri=r;this._iconPath=s;this._isHidden=l;this._inputBoxTextModel=c;this._quickDiffService=u;this._uriIdentService=p;this._workspaceContextService=h;this.groups=[];this._onDidChangeResourceGroups=new E;this.onDidChangeResourceGroups=this._onDidChangeResourceGroups.event;this._onDidChangeResources=new E;this.onDidChangeResources=this._onDidChangeResources.event;this._groupsByHandle=Object.create(null);this.features={};this._contextValue=Me(this,void 0);this._count=Me(this,void 0);this._statusBarCommands=Me(this,void 0);this._commitTemplate=Me(this,"");this._actionButton=Me(this,void 0);this._artifactProvider=Me(this,void 0);this._historyProvider=Me(this,void 0);if(r){let g=this._workspaceContextService.getWorkspaceFolder(r);g?.uri.toString()===r.toString()?this._name=g.name:r.path!=="/"&&(this._name=He(r))}}get id(){return`scm${this._handle}`}get parentId(){return this._parentHandle!==void 0?`scm${this._parentHandle}`:void 0}get providerId(){return this._providerId}get handle(){return this._handle}get label(){return this._label}get rootUri(){return this._rootUri}get iconPath(){return this._iconPath}get isHidden(){return this._isHidden}get inputBoxTextModel(){return this._inputBoxTextModel}get contextValue(){return this._contextValue}get acceptInputCommand(){return this.features.acceptInputCommand}get count(){return this._count}get statusBarCommands(){return this._statusBarCommands}get name(){return this._name??this._label}get commitTemplate(){return this._commitTemplate}get actionButton(){return this._actionButton}get artifactProvider(){return this._artifactProvider}get historyProvider(){return this._historyProvider}$updateSourceControl(i){if(this.features={...this.features,...i},typeof i.commitTemplate<"u"&&this._commitTemplate.set(i.commitTemplate,void 0),typeof i.actionButton<"u"&&this._actionButton.set(i.actionButton??void 0,void 0),typeof i.contextValue<"u"&&this._contextValue.set(i.contextValue,void 0),typeof i.count<"u"&&this._count.set(i.count,void 0),typeof i.statusBarCommands<"u"&&this._statusBarCommands.set(i.statusBarCommands,void 0),i.hasQuickDiffProvider&&!this._quickDiff?this._quickDiff=this._quickDiffService.addQuickDiffProvider({id:`${this._providerId}.quickDiffProvider`,label:i.quickDiffLabel??this.label,rootUri:this.rootUri,kind:"primary",getOriginalResource:async e=>{if(!this.features.hasQuickDiffProvider)return null;let t=await this.proxy.$provideOriginalResource(this.handle,e,Se.None);return t&&A.revive(t)}}):i.hasQuickDiffProvider===!1&&this._quickDiff&&(this._quickDiff.dispose(),this._quickDiff=void 0),i.hasSecondaryQuickDiffProvider&&!this._stagedQuickDiff?this._stagedQuickDiff=this._quickDiffService.addQuickDiffProvider({id:`${this._providerId}.secondaryQuickDiffProvider`,label:i.secondaryQuickDiffLabel??this.label,rootUri:this.rootUri,kind:"secondary",getOriginalResource:async e=>{if(!this.features.hasSecondaryQuickDiffProvider)return null;let t=await this.proxy.$provideSecondaryOriginalResource(this.handle,e,Se.None);return t&&A.revive(t)}}):i.hasSecondaryQuickDiffProvider===!1&&this._stagedQuickDiff&&(this._stagedQuickDiff.dispose(),this._stagedQuickDiff=void 0),i.hasArtifactProvider&&!this.artifactProvider.get()){let e=new fvi(this.proxy,this.handle);this._artifactProvider.set(e,void 0)}else i.hasArtifactProvider===!1&&this.artifactProvider.get()&&(this._artifactProvider.get()?.dispose(),this._artifactProvider.set(void 0,void 0));if(i.hasHistoryProvider&&!this.historyProvider.get()){let e=new vvi(this.proxy,this.handle);this._historyProvider.set(e,void 0)}else i.hasHistoryProvider===!1&&this.historyProvider.get()&&this._historyProvider.set(void 0,void 0)}$registerGroups(i){let e=i.map(([t,o,n,r,s])=>{let l=new hvi(this.handle,t,this,r,n,o,s,this._uriIdentService);return this._groupsByHandle[t]=l,l});this.groups.splice(this.groups.length,0,...e),this._onDidChangeResourceGroups.fire()}$updateGroup(i,e){let t=this._groupsByHandle[i];t&&t.$updateGroup(e)}$updateGroupLabel(i,e){let t=this._groupsByHandle[i];t&&t.$updateGroupLabel(e)}$spliceGroupResourceStates(i){for(let[e,t]of i){let o=this._groupsByHandle[e];if(!o){console.warn(`SCM group ${e} not found in provider ${this.label}`);continue}t.reverse();for(let[n,r,s]of t){let l=s.map(c=>{let[u,p,h,g,f,v,b,S,y,w]=c,[k,T]=h,P=q.isThemeIcon(k)?k:A.revive(k),O=(q.isThemeIcon(T)?T:A.revive(T))||P,V={icon:P,iconDark:O,tooltip:g,strikeThrough:f,faded:v};return new gvi(this.proxy,this.handle,e,u,A.revive(p),o,V,b||void 0,S,A.revive(y),A.revive(w))});o.splice(n,r,l)}}this._onDidChangeResources.fire()}$unregisterGroup(i){let e=this._groupsByHandle[i];e&&(delete this._groupsByHandle[i],this.groups.splice(this.groups.indexOf(e),1),this._onDidChangeResourceGroups.fire())}async getOriginalResource(i){if(!this.features.hasQuickDiffProvider)return null;let e=await this.proxy.$provideOriginalResource(this.handle,i,Se.None);return e&&A.revive(e)}$onDidChangeHistoryProviderCurrentHistoryItemRefs(i,e,t){let o=this.historyProvider.get();o&&o.$onDidChangeCurrentHistoryItemRefs(i,e,t)}$onDidChangeHistoryProviderHistoryItemRefs(i){let e=this.historyProvider.get();e&&e.$onDidChangeHistoryItemRefs(i)}$onDidChangeArtifacts(i){let e=this.artifactProvider.get();e&&e.$onDidChangeArtifacts(i)}toJSON(){return{$mid:5,handle:this.handle}}dispose(){this._onDidChangeResourceGroups.dispose(),this._onDidChangeResources.dispose(),this._artifactProvider.get()?.dispose(),this._stagedQuickDiff?.dispose(),this._quickDiff?.dispose()}},kPt=class{constructor(i,e,t,o,n,r,s,l,c){this.scmService=e;this.scmViewService=t;this.languageService=o;this.modelService=n;this.textModelService=r;this.quickDiffService=s;this._uriIdentService=l;this.workspaceContextService=c;this._repositories=new Map;this._repositoryBarriers=new Map;this._repositoryDisposables=new Map;this._disposables=new N;this._proxy=i.getProxy(to.ExtHostSCM),this._disposables.add(new mvi(this.textModelService,this.modelService,this.languageService))}dispose(){Be(this._repositories.values()),this._repositories.clear(),Be(this._repositoryDisposables.values()),this._repositoryDisposables.clear(),this._disposables.dispose()}async $registerSourceControl(i,e,t,o,n,r,s,l){this._repositoryBarriers.set(i,new gp);let c=await this.textModelService.createModelReference(A.revive(l)),u=new bvi(this._proxy,i,e,t,o,n?A.revive(n):void 0,Uue(r),s,c.object.textEditorModel,this.quickDiffService,this._uriIdentService,this.workspaceContextService),p=this.scmService.registerSCMProvider(u);this._repositories.set(i,p);let h=wn(c,U.filter(this.scmViewService.onDidFocusRepository,g=>g===p)(g=>this._proxy.$setSelectedSourceControl(i)),p.input.onDidChange(({value:g})=>this._proxy.$onInputBoxValueChange(i,g)));this._repositoryDisposables.set(i,h),this.scmViewService.focusedRepository===p&&setTimeout(()=>this._proxy.$setSelectedSourceControl(i),0),p.input.value&&setTimeout(()=>this._proxy.$onInputBoxValueChange(i,p.input.value),0),this._repositoryBarriers.get(i)?.open()}async $updateSourceControl(i,e){await this._repositoryBarriers.get(i)?.wait();let t=this._repositories.get(i);if(!t)return;t.provider.$updateSourceControl(e)}async $unregisterSourceControl(i){await this._repositoryBarriers.get(i)?.wait();let e=this._repositories.get(i);e&&(this._repositoryDisposables.get(i).dispose(),this._repositoryDisposables.delete(i),e.dispose(),this._repositories.delete(i))}async $registerGroups(i,e,t){await this._repositoryBarriers.get(i)?.wait();let o=this._repositories.get(i);if(!o)return;let n=o.provider;n.$registerGroups(e),n.$spliceGroupResourceStates(t)}async $updateGroup(i,e,t){await this._repositoryBarriers.get(i)?.wait();let o=this._repositories.get(i);if(!o)return;o.provider.$updateGroup(e,t)}async $updateGroupLabel(i,e,t){await this._repositoryBarriers.get(i)?.wait();let o=this._repositories.get(i);if(!o)return;o.provider.$updateGroupLabel(e,t)}async $spliceResourceStates(i,e){await this._repositoryBarriers.get(i)?.wait();let t=this._repositories.get(i);if(!t)return;t.provider.$spliceGroupResourceStates(e)}async $unregisterGroup(i,e){await this._repositoryBarriers.get(i)?.wait();let t=this._repositories.get(i);if(!t)return;t.provider.$unregisterGroup(e)}async $setInputBoxValue(i,e){await this._repositoryBarriers.get(i)?.wait();let t=this._repositories.get(i);t&&t.input.setValue(e,!1)}async $setInputBoxPlaceholder(i,e){await this._repositoryBarriers.get(i)?.wait();let t=this._repositories.get(i);t&&(t.input.placeholder=e)}async $setInputBoxEnablement(i,e){await this._repositoryBarriers.get(i)?.wait();let t=this._repositories.get(i);t&&(t.input.enabled=e)}async $setInputBoxVisibility(i,e){await this._repositoryBarriers.get(i)?.wait();let t=this._repositories.get(i);t&&(t.input.visible=e)}async $showValidationMessage(i,e,t){await this._repositoryBarriers.get(i)?.wait();let o=this._repositories.get(i);o&&o.input.showValidationMessage(e,t)}async $setValidationProviderIsEnabled(i,e){await this._repositoryBarriers.get(i)?.wait();let t=this._repositories.get(i);t&&(e?t.input.validateInput=async(o,n)=>{let r=await this._proxy.$validateInput(i,o,n);return r&&{message:r[0],type:r[1]}}:t.input.validateInput=async()=>{})}async $onDidChangeHistoryProviderCurrentHistoryItemRefs(i,e,t,o){await this._repositoryBarriers.get(i)?.wait();let n=this._repositories.get(i);if(!n)return;n.provider.$onDidChangeHistoryProviderCurrentHistoryItemRefs(e,t,o)}async $onDidChangeHistoryProviderHistoryItemRefs(i,e){await this._repositoryBarriers.get(i)?.wait();let t=this._repositories.get(i);if(!t)return;t.provider.$onDidChangeHistoryProviderHistoryItemRefs(e)}async $onDidChangeArtifacts(i,e){await this._repositoryBarriers.get(i)?.wait();let t=this._repositories.get(i);if(!t)return;t.provider.$onDidChangeArtifacts(e)}};kPt=I([fo(qi.MainThreadSCM),m(1,rd),m(2,_u),m(3,_t),m(4,Tt),m(5,Bt),m(6,mT),m(7,ht),m(8,Pe)],kPt);var Svi="workbench.view.search";var Iy="workbench.view.search",a2="search-result",_Pt="search.exclude",K4=2e4,Kno="\u27EA ",Gno=" characters skipped \u27EB",y4o=(Kno.length+Gno.length+5)*2,gg=le("searchService");function e0(a){return!!a.rangeLocations&&!!a.previewText}function Ivi(a){return!!a.resource}function DPt(a){return!!a.keyword}function yvi(a){return!!a.message}var EPt=class{constructor(i){this.resource=i;this.results=[]}},JJ=class{constructor(i,e,t,o){this.rangeLocations=[];this.webviewIndex=o;let n=Array.isArray(e)?e:[e];if(t&&t.matchLines===1&&w4o(n)){i=MGi(i,t.matchLines);let r="",s=0,l=0,c=Math.floor(t.charsPerLine/5);for(let u of n){let p=Math.max(u.startColumn-c,0),h=u.startColumn+t.charsPerLine;if(p>l+c+y4o){let g=Kno+(p-l)+Gno;r+=g+i.slice(p,h),s+=p-(l+g.length)}else r+=i.slice(l,h);l=h,this.rangeLocations.push({source:u,preview:new X7e(0,u.startColumn-s,u.endColumn-s)})}this.previewText=r}else{let r=Array.isArray(e)?e[0].startLineNumber:e.startLineNumber,s=D2i(e,l=>({preview:new TPt(l.startLineNumber-r,l.startColumn,l.endLineNumber-r,l.endColumn),source:l}));this.rangeLocations=Array.isArray(s)?s:[s],this.previewText=i}}};function w4o(a){let i=a[0].startLineNumber;for(let e of a)if(e.startLineNumber!==i||e.endLineNumber!==i)return!1;return!0}var TPt=class{constructor(i,e,t,o){this.startLineNumber=i,this.startColumn=e,this.endLineNumber=t,this.endColumn=o}},X7e=class extends TPt{constructor(i,e,t){super(i,e,i,t)}};function KB(a,i=!0){let e=a&&a.files&&a.files.exclude,t=i&&a&&a.search&&a.search.exclude;if(!e&&!t)return;if(!e||!t)return e||t||void 0;let o=Object.create(null);return o=Xu(o,Ji(e)),o=Xu(o,Ji(t),!0),o}function zue(a,i){let e=a.ignoreGlobCase?{ignoreCase:!0}:void 0;return a.excludePattern&&Ed(a.excludePattern,i,e)?!1:a.includePattern||a.usingSearchPaths?a.includePattern&&Ed(a.includePattern,i,e)?!0:a.usingSearchPaths?!!a.folderQueries&&a.folderQueries.some(t=>{let o=t.folder.fsPath;if(Yse(i,o,a.ignoreGlobCase)){let n=dP(o,i);return!t.includePattern||!!Ed(t.includePattern,n,e)}else return!1}):!1:!0}var Y7e=class extends Error{constructor(e,t){super(e);this.code=t}};function qno(a){let i=a.message;if(ao(a))return new Y7e(i,7);try{let e=JSON.parse(i);return new Y7e(e.message,e.code)}catch{return new Y7e(i,6)}}var _i={SearchViewVisibleKey:new Y("searchViewletVisible",!0),SearchViewFocusedKey:new Y("searchViewletFocus",!1),SearchResultListFocusedKey:new Y("searchResultListFocused",!0),InputBoxFocusedKey:new Y("inputBoxFocus",!1),SearchInputBoxFocusedKey:new Y("searchInputBoxFocus",!1),ReplaceInputBoxFocusedKey:new Y("replaceInputBoxFocus",!1),PatternIncludesFocusedKey:new Y("patternIncludesInputBoxFocus",!1),PatternExcludesFocusedKey:new Y("patternExcludesInputBoxFocus",!1),ReplaceActiveKey:new Y("replaceActive",!1),HasSearchResults:new Y("hasSearchResult",!1),FirstMatchFocusKey:new Y("firstMatchFocus",!1),FileMatchOrMatchFocusKey:new Y("fileMatchOrMatchFocus",!1),FileMatchOrFolderMatchFocusKey:new Y("fileMatchOrFolderMatchFocus",!1),FileMatchOrFolderMatchWithResourceFocusKey:new Y("fileMatchOrFolderMatchWithResourceFocus",!1),FileFocusKey:new Y("fileMatchFocus",!1),FolderFocusKey:new Y("folderMatchFocus",!1),ResourceFolderFocusKey:new Y("folderMatchWithResourceFocus",!1),IsEditableItemKey:new Y("isEditableItem",!0),MatchFocusKey:new Y("matchFocus",!1),SearchResultHeaderFocused:new Y("searchResultHeaderFocused",!1),ViewHasSearchPatternKey:new Y("viewHasSearchPattern",!1),ViewHasReplacePatternKey:new Y("viewHasReplacePattern",!1),ViewHasFilePatternKey:new Y("viewHasFilePattern",!1),ViewHasSomeCollapsibleKey:new Y("viewHasSomeCollapsibleResult",!1),InTreeViewKey:new Y("inTreeView",!1),hasAIResultProvider:new Y("hasAIResultProviderKey",!1),AIResultsTitle:new Y("aiResultsTitle",!1),AIResultsRequested:new Y("aiResultsRequested",!1)};var LPt=class{constructor(i,e,t,o,n){this._searchService=e;this._telemetryService=t;this.contextKeyService=n;this._searchProvider=new Map;this._aiSearchProviderHandles=new Set;this._proxy=i.getProxy(to.ExtHostSearch),this._proxy.$enableExtensionHostSearch()}dispose(){this._searchProvider.forEach(i=>i.dispose()),this._searchProvider.clear(),this._aiSearchProviderHandles.clear(),_i.hasAIResultProvider.bindTo(this.contextKeyService).set(!1)}$registerTextSearchProvider(i,e){this._searchProvider.set(i,new J7e(this._searchService,1,e,i,this._proxy))}$registerAITextSearchProvider(i,e){_i.hasAIResultProvider.bindTo(this.contextKeyService).set(!0),this._aiSearchProviderHandles.add(i),this._searchProvider.set(i,new J7e(this._searchService,2,e,i,this._proxy))}$registerFileSearchProvider(i,e){this._searchProvider.set(i,new J7e(this._searchService,0,e,i,this._proxy))}$unregisterProvider(i){Be(this._searchProvider.get(i)),this._searchProvider.delete(i),this._aiSearchProviderHandles.delete(i)&&this._aiSearchProviderHandles.size===0&&_i.hasAIResultProvider.bindTo(this.contextKeyService).set(!1)}$handleFileMatch(i,e,t){let o=this._searchProvider.get(i);if(!o)throw new Error("Got result for unknown provider");o.handleFindMatch(e,t)}$handleTextMatch(i,e,t){let o=this._searchProvider.get(i);if(!o)throw new Error("Got result for unknown provider");o.handleFindMatch(e,t)}$handleKeywordResult(i,e,t){let o=this._searchProvider.get(i);if(!o)throw new Error("Got result for unknown provider");o.handleKeywordResult(e,t)}$handleTelemetry(i,e){this._telemetryService.publicLog(i,e)}};LPt=I([fo(qi.MainThreadSearch),m(1,gg),m(2,Te),m(3,B),m(4,X)],LPt);var wvi=class a{constructor(i,e=++a._idPool,t=new Map,o=[]){this.progress=i;this.id=e;this.matches=t;this.keywords=o}static{this._idPool=0}addMatch(i){let e=this.matches.get(i.resource.toString());e?e.results&&i.results&&e.results.push(...i.results):this.matches.set(i.resource.toString(),i),this.progress?.(i)}addKeyword(i){this.keywords.push(i),this.progress?.(i)}},J7e=class{constructor(i,e,t,o,n){this._scheme=t;this._handle=o;this._proxy=n;this._registrations=new N;this._searches=new Map;this._registrations.add(i.registerSearchResultProvider(this._scheme,e,this))}async getAIName(){return this.cachedAIName===void 0&&(this.cachedAIName=await this._proxy.$getAIName(this._handle)),this.cachedAIName}dispose(){this._registrations.dispose()}fileSearch(i,e=Se.None){return this.doSearch(i,void 0,e)}textSearch(i,e,t=Se.None){return this.doSearch(i,e,t)}doSearch(i,e,t=Se.None){if(!i.folderQueries.length)throw new Error("Empty folderQueries");let o=new wvi(e);this._searches.set(o.id,o);let n=this._provideSearchResults(i,o.id,t);return Promise.resolve(n).then(r=>(this._searches.delete(o.id),{results:Array.from(o.matches.values()),aiKeywords:Array.from(o.keywords),stats:r.stats,limitHit:r.limitHit,messages:r.messages}),r=>(this._searches.delete(o.id),Promise.reject(r)))}clearCache(i){return Promise.resolve(this._proxy.$clearCache(i))}handleFindMatch(i,e){let t=this._searches.get(i);t&&e.forEach(o=>{o.results?t.addMatch($n(o)):t.addMatch({resource:A.revive(o)})})}handleKeywordResult(i,e){let t=this._searches.get(i);t&&t.addKeyword(e)}_provideSearchResults(i,e,t){switch(i.type){case 1:return this._proxy.$provideFileSearchResults(this._handle,e,i,t);case 2:return this._proxy.$provideTextSearchResults(this._handle,e,i,t);default:return this._proxy.$provideAITextSearchResults(this._handle,e,i,t)}}};var RPt=class extends x{constructor(e,t){super();this.statusbarService=t;this._entryDisposables=this._register(new Vt);this._proxy=e.getProxy(to.ExtHostStatusBar);let o=[];for(let[r,s]of t.getEntries())o.push(n(r,s));this._proxy.$acceptStaticEntries(o),this._register(t.onDidChange(r=>{r.added&&this._proxy.$acceptStaticEntries([n(r.added[0],r.added[1])])}));function n(r,s){return{entryId:r,name:s.entry.name,text:s.entry.text,tooltip:s.entry.tooltip,command:typeof s.entry.command=="string"?s.entry.command:typeof s.entry.command=="object"?s.entry.command.id:void 0,priority:s.priority,alignLeft:s.alignment===0,accessibilityInformation:s.entry.ariaLabel?{label:s.entry.ariaLabel,role:s.entry.role}:void 0}}}$setEntry(e,t,o,n,r,s,l,c,u,p,h,g,f){let v=l?{markdown:S=>this._proxy.$provideTooltip(e,S),markdownNotSupportedFallback:void 0}:s;if(this.statusbarService.setOrUpdateEntry(e,t,o,n,r,v,c,u,p,h,g,f)===0){let S=Z(()=>this.statusbarService.unsetEntry(e));this._entryDisposables.set(e,S)}}$disposeEntry(e){this._entryDisposables.deleteAndDispose(e)}};RPt=I([fo(qi.MainThreadStatusBar),m(1,hDt)],RPt);var l2=le("IExtensionStorageService"),x4o=/^extensionKeys\/([^.]+\..+)@(\d+\.\d+\.\d+(-.*)?)$/,Hw=class extends x{constructor(e,t,o){super();this.storageService=e;this.productService=t;this.logService=o;this._onDidChangeExtensionStorageToSync=this._register(new E);this.onDidChangeExtensionStorageToSync=this._onDidChangeExtensionStorageToSync.event;this.extensionsWithKeysForSync=Hw.readAllExtensionsWithKeysForSync(e),this._register(this.storageService.onDidChangeValue(0,void 0,this._store)(n=>this.onDidChangeStorageValue(n)))}static{this.LARGE_STATE_WARNING_THRESHOLD=512*1024}static toKey(e){return`extensionKeys/${Cde(e.id)}@${e.version}`}static fromKey(e){let t=x4o.exec(e);if(t&&t[1])return{id:t[1],version:t[2]}}static async removeOutdatedExtensionVersions(e,t){let o=await e.getInstalled(),n=[];for(let[r,s]of Hw.readAllExtensionsWithKeysForSync(t)){let l=o.find(c=>Ut(c.identifier,{id:r}))?.manifest.version;for(let c of s)l!==c&&n.push(Hw.toKey({id:r,version:c}))}for(let r of n)t.remove(r,0)}static readAllExtensionsWithKeysForSync(e){let t=new Map,o=e.keys(0,1);for(let n of o){let r=Hw.fromKey(n);if(r){let s=t.get(r.id.toLowerCase());s||t.set(r.id.toLowerCase(),s=[]),s.push(r.version)}}return t}onDidChangeStorageValue(e){if(this.extensionsWithKeysForSync.has(e.key.toLowerCase())){this._onDidChangeExtensionStorageToSync.fire();return}let t=Hw.fromKey(e.key);if(t){if(this.storageService.get(e.key,0)===void 0)this.extensionsWithKeysForSync.delete(t.id.toLowerCase());else{let o=this.extensionsWithKeysForSync.get(t.id.toLowerCase());o||this.extensionsWithKeysForSync.set(t.id.toLowerCase(),o=[]),o.push(t.version),this._onDidChangeExtensionStorageToSync.fire()}return}}getExtensionId(e){if(Fe(e))return e;let t=e.manifest?e.manifest.publisher:e.publisher,o=e.manifest?e.manifest.name:e.name;return gS(t,o)}getExtensionState(e,t){let o=this.getExtensionId(e),n=this.getExtensionStateRaw(e,t);if(n)try{return JSON.parse(n)}catch(r){this.logService.error(`[mainThreadStorage] unexpected error parsing storage contents (extensionId: ${o}, global: ${t}): ${r}`)}}getExtensionStateRaw(e,t){let o=this.getExtensionId(e),n=this.storageService.get(o,t?0:1);return n&&n?.length>Hw.LARGE_STATE_WARNING_THRESHOLD&&this.logService.warn(`[mainThreadStorage] large extension state detected (extensionId: ${o}, global: ${t}): ${n.length/1024}kb. Consider to use 'storageUri' or 'globalStorageUri' to store this data on disk instead.`),n}setExtensionState(e,t,o){let n=this.getExtensionId(e);t===void 0?this.storageService.remove(n,o?0:1):this.storageService.store(n,JSON.stringify(t),o?0:1,1)}setKeysForSync(e,t){this.storageService.store(Hw.toKey(e),JSON.stringify(t),0,1)}getKeysForSync(e){let t=this.productService.extensionSyncedKeys?.[e.id.toLowerCase()],o=this.storageService.get(Hw.toKey(e),0),n=o?JSON.parse(o):void 0;return n&&t?zo([...n,...t]):n||t}addToMigrationList(e,t){if(e!==t){let o=this.migrationList.filter(n=>!n.includes(e)&&!n.includes(t));o.push([e,t]),this.migrationList=o}}getSourceExtensionToMigrate(e){let t=this.migrationList.find(([,o])=>e===o);return t?t[0]:void 0}get migrationList(){let e=this.storageService.get("extensionStorage.migrationList",-1,"[]");try{let t=JSON.parse(e);if(Array.isArray(t))return t}catch{}return[]}set migrationList(e){e.length?this.storageService.store("extensionStorage.migrationList",JSON.stringify(e),-1,1):this.storageService.remove("extensionStorage.migrationList",-1)}};Hw=I([m(0,ce),m(1,tt),m(2,se)],Hw);async function $no(a,i,e,t){return t.invokeFunction(async o=>{let n=o.get(Eo),r=o.get(an),s=o.get(l2),l=o.get(ce),c=o.get(ht),u=o.get(fe),p=o.get(Pe),h=o.get(se),g=`extensionStorage.migrate.${a}-${i}`,f=a.toLowerCase()===i.toLowerCase()?`extension.storage.migrateFromLowerCaseKey.${a.toLowerCase()}`:void 0;if(a===i)return;let v=(S,y)=>y?c.extUri.joinPath(r.defaultProfile.globalStorageHome,S.toLowerCase()):c.extUri.joinPath(n.workspaceStorageHome,p.getWorkspace().id,S),b=e?0:1;if(!l.getBoolean(g,b,!1)&&!(f&&l.getBoolean(f,b,!1))){h.info(`Migrating ${e?"global":"workspace"} extension storage from ${a} to ${i}...`);let S=s.getExtensionState(a,e);S&&(s.setExtensionState(i,S,e),s.setExtensionState(a,void 0,e));let y=v(a,e),w=v(i,e);if(!c.extUri.isEqual(y,w))try{await u.move(y,w,!0)}catch(k){k.code!=="EntryNotFound"&&h.info(`Error while migrating ${e?"global":"workspace"} file storage from '${a}' to '${i}'`,Pn(k))}h.info(`Migrated ${e?"global":"workspace"} extension storage from ${a} to ${i}`),l.store(g,!0,b,1)}})}var MPt=class{constructor(i,e,t,o,n){this._extensionStorageService=e;this._storageService=t;this._instantiationService=o;this._logService=n;this._storageListener=new N;this._sharedStorageKeysToWatch=new Map;this._proxy=i.getProxy(to.ExtHostStorage),this._storageListener.add(this._storageService.onDidChangeValue(0,void 0,this._storageListener)(r=>{if(this._sharedStorageKeysToWatch.has(r.key)){let s=this._extensionStorageService.getExtensionStateRaw(r.key,!0);typeof s=="string"&&this._proxy.$acceptValue(!0,r.key,s)}}))}dispose(){this._storageListener.dispose()}async $initializeExtensionStorage(i,e){return await this.checkAndMigrateExtensionStorage(e,i),i&&this._sharedStorageKeysToWatch.set(e,!0),this._extensionStorageService.getExtensionStateRaw(e,i)}async $setValue(i,e,t){this._extensionStorageService.setExtensionState(e,t,i)}$registerExtensionStorageKeysToSync(i,e){this._extensionStorageService.setKeysForSync(i,e)}async checkAndMigrateExtensionStorage(i,e){try{let t=this._extensionStorageService.getSourceExtensionToMigrate(i);!t&&Wt&&i!==i.toLowerCase()&&(t=i.toLowerCase()),t&&(Wt&&t!==t.toLowerCase()&&this._extensionStorageService.getExtensionState(t.toLowerCase(),e)&&!this._extensionStorageService.getExtensionState(t,e)&&(t=t.toLowerCase()),await $no(t,i,e,this._instantiationService))}catch(t){this._logService.error(t)}}};MPt=I([fo(qi.MainThreadStorage),m(1,l2),m(2,ce),m(3,F),m(4,se)],MPt);var Kue=class extends x{constructor(e,t,o,n,r){super();this._telemetryService=t;this._configurationService=o;this._environmentService=n;this._productService=r;this._proxy=e.getProxy(to.ExtHostTelemetry),DR(this._productService,this._environmentService)&&this._register(this._configurationService.onDidChangeConfiguration(s=>{(s.affectsConfiguration(uO)||s.affectsConfiguration(bae))&&this._proxy.$onDidChangeTelemetryLevel(this.telemetryLevel)})),this._proxy.$initializeTelemetryLevel(this.telemetryLevel,DR(this._productService,this._environmentService),this._productService.enabledTelemetryLevels)}get telemetryLevel(){return DR(this._productService,this._environmentService)?this._telemetryService.telemetryLevel:0}$publicLog(e,t=Object.create(null)){t[Kue._name]=!0,this._telemetryService.publicLog(e,t)}$publicLog2(e,t){this.$publicLog(e,t)}};Kue._name="pluginHostTelemetry",Kue=I([fo(qi.MainThreadTelemetry),m(1,Te),m(2,B),m(3,Eo),m(4,tt)],Kue);var PPt=class{constructor(i){this._callback=i;this._terminalBufferMap=new Map}dispose(){for(let i of this._terminalBufferMap.values())i.dispose()}startBuffering(i,e,t=5){let o=e(n=>{let r=Fe(n)?n:n.data,s=this._terminalBufferMap.get(i);if(s){s.data.push(r);return}let l=setTimeout(()=>this.flushBuffer(i),t);s={data:[r],timeoutId:l,dispose:()=>{clearTimeout(l),this.flushBuffer(i),o.dispose()}},this._terminalBufferMap.set(i,s)});return o}stopBuffering(i){this._terminalBufferMap.get(i)?.dispose()}flushBuffer(i){let e=this._terminalBufferMap.get(i);e&&(this._terminalBufferMap.delete(i),this._callback(i,e.data.join("")))}};var ZJ=class extends x{constructor(e,t,o,n){super();this.instanceId=e;this._cols=t;this._rows=o;this._terminalService=n;this.id=0;this.shouldPersist=!1;this._onProcessData=this._register(new E);this.onProcessData=this._onProcessData.event;this._onProcessReady=this._register(new E);this._onStart=this._register(new E);this.onStart=this._onStart.event;this._onInput=this._register(new E);this.onInput=this._onInput.event;this._onBinary=this._register(new E);this.onBinary=this._onBinary.event;this._onResize=this._register(new E);this.onResize=this._onResize.event;this._onAcknowledgeDataEvent=this._register(new E);this.onAcknowledgeDataEvent=this._onAcknowledgeDataEvent.event;this._onShutdown=this._register(new E);this.onShutdown=this._onShutdown.event;this._onRequestInitialCwd=this._register(new E);this.onRequestInitialCwd=this._onRequestInitialCwd.event;this._onRequestCwd=this._register(new E);this.onRequestCwd=this._onRequestCwd.event;this._onDidChangeProperty=this._register(new E);this.onDidChangeProperty=this._onDidChangeProperty.event;this._onProcessExit=this._register(new E);this.onProcessExit=this._onProcessExit.event;this._pendingInitialCwdRequests=[];this._pendingCwdRequests=[]}get onProcessReady(){return this._onProcessReady.event}emitData(e){this._onProcessData.fire(e)}emitTitle(e){this._onDidChangeProperty.fire({type:"title",value:e})}emitReady(e,t){this._onProcessReady.fire({pid:e,cwd:t,windowsPty:void 0})}emitProcessProperty({type:e,value:t}){switch(e){case"cwd":this.emitCwd(t);break;case"initialCwd":this.emitInitialCwd(t);break;case"title":this.emitTitle(t);break;case"overrideDimensions":this.emitOverrideDimensions(t);break;case"resolvedShellLaunchConfig":this.emitResolvedShellLaunchConfig(t);break}}emitExit(e){this._onProcessExit.fire(e),this.dispose()}emitOverrideDimensions(e){this._onDidChangeProperty.fire({type:"overrideDimensions",value:e})}emitResolvedShellLaunchConfig(e){this._onDidChangeProperty.fire({type:"resolvedShellLaunchConfig",value:e})}emitInitialCwd(e){for(;this._pendingInitialCwdRequests.length>0;)this._pendingInitialCwdRequests.pop()(e)}emitCwd(e){for(;this._pendingCwdRequests.length>0;)this._pendingCwdRequests.pop()(e)}async start(){return this._terminalService.requestStartExtensionTerminal(this,this._cols,this._rows)}shutdown(e){this._onShutdown.fire(e)}input(e){this._onInput.fire(e)}sendSignal(e){}resize(e,t){this._onResize.fire({cols:e,rows:t})}clearBuffer(){}acknowledgeDataEvent(){}async setUnicodeVersion(e){}async processBinary(e){this._onBinary.fire(e)}getInitialCwd(){return new Promise(e=>{this._onRequestInitialCwd.fire(),this._pendingInitialCwdRequests.push(e)})}getCwd(){return new Promise(e=>{this._onRequestCwd.fire(),this._pendingCwdRequests.push(e)})}async refreshProperty(e){throw new Error("refreshProperty not implemented on extension host")}async updateProperty(e,t){}};ZJ=I([m(3,nn)],ZJ);var c2=le("environmentVariableService");function Gue(a){return[...a.entries()]}function eYe(a){return a?[...a.entries()]:[]}function tYe(a){return new Map(a)}function iYe(a){return new Map(a??[])}function Cvi(a){return Array.from(a.entries()).map(i=>[i[0],Gue(i[1].map),eYe(i[1].descriptionMap)])}function jno(a){return new Map(a.map(i=>[i[0],{map:tYe(i[1]),descriptionMap:iYe(i[2])}]))}var oYe=le("terminalLinkProviderService");var g_e=le("terminalQuickFixService");var APt=class{constructor(i){this.completion=i;this.score=kv.Default;this.isInvalid=!1;this.textLabel=typeof i.label=="string"?i.label:i.label?.label,this.labelLow=this.textLabel.toLowerCase()}};function Qno(a){switch(a){case 20:return 0;case 23:return 1;case 0:return 2;case 18:return 4;case 4:return 4;case 16:return 6;case 17:return 3;default:return 2}}var f_e=class extends APt{constructor(e,t){super(e);this.completion=e;this.fileExtLow="";this.punctuationPenalty=0;let n=(t??(this.labelLow.includes("\\")?"\\":void 0))==="\\";if(this.labelLowExcludeFileExt=this.labelLow,this.labelLowNormalizedPath=this.labelLow,(xvi(e)||e.kind===11)&&n&&(this.labelLow=this.labelLow.replaceAll("/","\\")),xvi(e)){let r=this.labelLow.lastIndexOf(".");r>0&&(this.labelLowExcludeFileExt=this.labelLow.substring(0,r),this.fileExtLow=this.labelLow.substring(r+1))}(xvi(e)||e.kind===1)&&(n&&(this.labelLowNormalizedPath=this.labelLow.replaceAll("\\","/")),e.kind===1&&(this.labelLowNormalizedPath=this.labelLowNormalizedPath.replace(/\/$/,""))),this.punctuationPenalty=k4o(this.labelLowExcludeFileExt)?1:0}async resolve(e){if(this.resolveCache)return this.resolveCache;let t=this.completion._unresolvedItem,o=this.completion._resolveProvider;if(!(!t||!o||!o.resolveCompletionItem))return this.resolveCache=(async()=>{try{let n=await o.resolveCompletionItem(t,e);n&&(n.detail&&(this.completion.detail=n.detail),n.documentation&&(this.completion.documentation=n.documentation))}catch{return}})(),this.resolveCache}};function xvi(a){return!!(a.kind===0||a.isFileOverride)}function k4o(a){return jo(a).startsWith("_")||/^[\[\]\{\}\(\)\.,;:!?\/\\\-_@#~*%^=$]+$/.test(a)}function Yno(a,i){let e=(i||"C:").toUpperCase();if(a==="/")return`${e}\\`;let t=a.match(/^\/([a-zA-Z])(\/.*)?$/);if(t){let o=t[1].toUpperCase(),n=t[2]?t[2].replace(/\//g,"\\"):"\\";return`${o}:${n}`}return a.replace(/\//g,"\\")}function Xno(a){return a.replace(/^[a-zA-Z]:\\/,i=>`/${i[0].toLowerCase()}/`).replace(/\\/g,"/")}var tZ=le("terminalCompletionService");var v_e=class extends x{constructor(e,t,o,n){super();this._configurationService=e;this._fileService=t;this._labelService=o;this._logService=n;this._providers=new Map;this._onDidChangeProviders=this._register(new E);this.onDidChangeProviders=this._onDidChangeProviders.event;this._processEnv=$u}get providers(){return this._providersGenerator()}*_providersGenerator(){for(let e of this._providers.values())for(let t of e.values())yield t}set processEnv(e){this._processEnv=e}registerTerminalCompletionProvider(e,t,o,...n){let r=this._providers.get(e);return r||(r=new Map,this._providers.set(e,r)),o.triggerCharacters=n,o.id=t,r.set(t,o),this._onDidChangeProviders.fire(),Z(()=>{let s=this._providers.get(e);s&&(s.delete(t),s.size===0&&this._providers.delete(e)),this._onDidChangeProviders.fire()})}async provideCompletions(e,t,o,n,r,s,l,c,u){if(this._logService.trace("TerminalCompletionService#provideCompletions"),!this._providers||!this._providers.values||t<0)return;let p;if(l){let h=[];for(let g of this.providers)if(g.triggerCharacters){for(let f of g.triggerCharacters)if(e.substring(0,t)?.endsWith(f)){h.push(g);break}}p=h}else p=[...this._providers.values()].flatMap(h=>[...h.values()]);if(c)return p=p.filter(h=>h.isBuiltin),this._collectCompletions(p,n,e,t,o,r,s,u);if(p=this._getEnabledProviders(p),!!p.length)return this._collectCompletions(p,n,e,t,o,r,s,u)}_getEnabledProviders(e){let t=this._configurationService.getValue("terminal.integrated.suggest.providers");return e.filter(o=>{let n=o.id;return n&&(!Object.prototype.hasOwnProperty.call(t,n)||t[n]!==!1)})}async _collectCompletions(e,t,o,n,r,s,l,c){this._logService.trace("TerminalCompletionService#_collectCompletions");let u=e.map(async h=>{if(h.shellTypes&&t&&!h.shellTypes.includes(t))return;let g=c?3e4:5e3,f=!1,v;try{v=await Promise.race([h.provideCompletions(o,n,l).then(S=>(this._logService.trace(`TerminalCompletionService#_collectCompletions provider ${h.id} finished`),S)),(async()=>{await Li(g),f=!0})()])}catch(S){this._logService.trace(`[TerminalCompletionService] Exception from provider '${h.id}':`,S);return}if(f){this._logService.trace(`[TerminalCompletionService] Provider '${h.id}' timed out after ${g}ms. promptValue='${o}', cursorPosition=${n}, explicitlyInvoked=${c}`);return}if(!v)return;let b=Array.isArray(v)?v:v.items??[];if(this._logService.trace(`TerminalCompletionService#_collectCompletions amend ${b.length} completion items`),t==="pwsh")for(let S of b){let y=S.replacementRange?S.replacementRange[0]:0;S.isFileOverride??=S.kind===2&&y===0}if(h.isBuiltin)for(let S of b)S.provider??=h.id;if(Array.isArray(v))return b;if(v.resourceOptions){let S=await this.resolveResources(v.resourceOptions,o,n,`core:path:ext:${h.id}`,s,t);if(this._logService.trace("TerminalCompletionService#_collectCompletions dedupe"),S){let y=new Set(b.map(w=>w.label));for(let w of S)y.has(w.label)||b.push(w)}this._logService.trace("TerminalCompletionService#_collectCompletions dedupe done")}return b}),p=await Promise.all(u);return this._logService.trace("TerminalCompletionService#_collectCompletions done"),p.filter(h=>!!h).flat()}async resolveResources(e,t,o,n,r,s){this._logService.trace("TerminalCompletionService#resolveResources");let l=e.pathSeparator==="\\";l&&(t=t.replaceAll(/[\\/]/g,e.pathSeparator));let c=(e.showDirectories||e.showFiles)??!1,u=e.showFiles??!1,p=e.globPattern??void 0;if(!c&&!u)return;let h=[],g=t.substring(0,o),v=g.split(/(?<!\\) /).length<=1&&!g.endsWith(" "),b=g.endsWith(" ")?"":g.split(/(?<!\\) /).at(-1)??"",S=b.match(/^[a-zA-Z_]+=(?<rhs>.+)$/);S?.groups?.rhs&&(b=S.groups.rhs);let y;if(l){let $=-1;for(let J=b.length-1;J>=0;J--)if(b[J]==="\\"&&(J===b.length-1||b[J+1]!==" ")){$=J;break}y=Math.max($,b.lastIndexOf("/"))}else y=b.lastIndexOf(e.pathSeparator);let w=y===-1?"":b.slice(0,y+1);l&&(w=w.replaceAll("/","\\"));let k=!!w.match(/^\.\.?[\\\/]/),T=!!w.match(/^~[\\\/]?/),P=T4o(s,e.pathSeparator,w,l),O=T?"tilde":P?"absolute":"relative",V=A.revive(e.cwd),H;if(O==="relative"&&w.length>0){let $=(l?w.replaceAll("\\","/"):w).replaceAll("\\ "," ");if($.startsWith("./")){let ae=$.replace(/^\.\/+/,"").replace(/\/+$/,"");if(ae){let he=V.path.replace(/\/+$/,"").split("/"),oe=ae.split("/");if(oe.length<=he.length&&oe.every((Ce,xe)=>he[he.length-oe.length+xe]===Ce))try{await this._fileService.stat(V),H=V}catch{return}}else try{await this._fileService.stat(V),H=V}catch{return}}if(!H){let ae=A.joinPath(V,$);try{await this._fileService.stat(ae),H=ae}catch{return}}}else O==="relative"&&(H=V);if(O==="relative"&&!H)try{await this._fileService.stat(V),H=V}catch{return}switch(O){case"tilde":{let $=this._getHomeDir(l,r);$&&(H=A.joinPath(nYe(V,$),w.slice(1).replaceAll("\\ "," "))),H||b.match(/^~[\\\/]$/)&&(H=l?"Home directory":"$HOME");break}case"absolute":{s==="gitbash"?H=nYe(V,Yno(w,this._processEnv.SystemDrive)):H=nYe(V,w.replaceAll("\\ "," "));break}case"relative":{H??=V;break}}if(!H)return;if(Fe(H))return h.push({label:w,provider:n,kind:1,detail:H,replacementRange:[o-b.length,o]}),h;let G=await this._fileService.resolve(H,{resolveMetadata:!0,resolveSingleChildDescendants:!0});if(G?.children){if(this._logService.trace("TerminalCompletionService#resolveResources cwd"),c){let $;switch(O){case"tilde":{$=w;break}case"absolute":{$=w;break}case"relative":{$=".",w.length>0&&($=kvi(w,e,k));break}}h.push({label:$,provider:n,kind:1,detail:eZ(this._labelService,H,e.pathSeparator,1,s),replacementRange:[o-b.length,o]})}if(this._logService.trace("TerminalCompletionService#resolveResources direct children"),await Promise.all(G.children.map($=>(async()=>{let J,ae;if(c&&$.isDirectory)$.isSymbolicLink?J=9:J=1;else if(u&&$.isFile){if(v&&!l&&!$.executable)return;$.isSymbolicLink?J=8:J=0}if(J===void 0)return;let he=w;if(he.length>0&&!he.endsWith(e.pathSeparator)&&(he+=e.pathSeparator),he+=$.name,O==="relative"&&(he=kvi(he,e,k)),$.isDirectory&&!he.endsWith(e.pathSeparator)&&(he+=e.pathSeparator),he=E4o(he,s,e.pathSeparator),$.isFile&&p){let oe=$.resource.fsPath,de=!this._fileService.hasCapability($.resource,1024);if(!Ed(p,oe,{ignoreCase:de}))return}if($.isSymbolicLink)try{let oe=await this._fileService.realpath($.resource);oe&&!Qe($.resource,oe)&&(ae=`${eZ(this._labelService,$.resource,e.pathSeparator,J,s)} -> ${eZ(this._labelService,oe,e.pathSeparator,J,s)}`)}catch{}h.push({label:he,provider:n,kind:J,detail:ae??eZ(this._labelService,$.resource,e.pathSeparator,J,s),replacementRange:[o-b.length,o]})})())),this._logService.trace("TerminalCompletionService#resolveResources CDPATH"),O==="relative"&&c&&t.startsWith("cd ")){let $=this._configurationService.getValue("terminal.integrated.suggest.cdPath");if($==="absolute"||$==="relative"){let J=this._getEnvVar("CDPATH",r);if(J){let ae=J.split(l?";":":");for(let he of ae)try{let oe=await this._fileService.resolve(nYe(V,he),{resolveSingleChildDescendants:!0});if(oe?.children)for(let de of oe.children){if(!de.isDirectory)continue;let Ce=$==="relative",xe=1,ze=Ce?jo(de.resource.fsPath):s==="gitbash"?Xno(de.resource.fsPath):eZ(this._labelService,de.resource,e.pathSeparator,xe,s),De=Ce?`CDPATH ${eZ(this._labelService,de.resource,e.pathSeparator,xe,s)}`:"CDPATH";h.push({label:ze,provider:n,kind:xe,detail:De,replacementRange:[o-b.length,o]})}}catch{}}}}if(this._logService.trace("TerminalCompletionService#resolveResources parent dir"),O==="relative"&&c){let $=`..${e.pathSeparator}`;w.length>0&&($=kvi(w+$,e,k));let J=A.joinPath(H,".."+e.pathSeparator);h.push({label:$,provider:n,kind:1,detail:eZ(this._labelService,J,e.pathSeparator,1,s),replacementRange:[o-b.length,o]})}if(this._logService.trace("TerminalCompletionService#resolveResources tilde"),O==="relative"&&!w.match(/[\\\/]/)){let $,J=this._getHomeDir(l,r);J&&($=nYe(V,J)),$||($=l?"Home directory":"$HOME"),h.push({label:"~",provider:n,kind:1,detail:Fe($)?$:eZ(this._labelService,$,e.pathSeparator,1,s),replacementRange:[o-b.length,o]})}return this._logService.trace("TerminalCompletionService#resolveResources done"),h}}_getEnvVar(e,t){let o=t.get(5)?.env?.value;return o?o[e]:this._processEnv[e]}_getHomeDir(e,t){return e?this._getEnvVar("USERPROFILE",t):this._getEnvVar("HOME",t)}};v_e=I([m(0,B),m(1,fe),m(2,rt),m(3,ca)],v_e);function eZ(a,i,e,t,o){let n=a.getUriLabel(i,{noPrefix:!0}),r=o==="gitbash"?"\\":e;return t===1&&!n.endsWith(r)&&(n+=r),n}function kvi(a,i,e){return e?a:a.startsWith(i.pathSeparator)?`.${a}`:`.${i.pathSeparator}${a}`}function E4o(a,i,e){return i===void 0||i==="pwsh"||i==="cmd"?a:a.replace(/[\[\]\(\)'"\\\`\*\?;|&<>]/g,"\\$&")}function T4o(a,i,e,t){return a==="gitbash"?e.startsWith(i)||/^[a-zA-Z]:\//.test(e):t?/^[a-zA-Z]:[\\\/]/.test(e):e.startsWith(i)}function nYe(a,i){return a.scheme==="file"?A.file(i):a.with({path:i})}var OPt=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super();this._terminalService=t;this._terminalLinkProviderService=o;this._terminalQuickFixService=n;this._instantiationService=r;this._environmentVariableService=s;this._logService=l;this._terminalProfileResolverService=c;this._terminalGroupService=p;this._terminalEditorService=h;this._terminalProfileService=g;this._terminalCompletionService=f;this._environmentService=v;this._extHostTerminals=new Map;this._terminalProcessProxies=new Map;this._profileProviders=new Map;this._completionProviders=new Map;this._quickFixProviders=new Map;this._dataEventTracker=this._register(new me);this._sendCommandEventListener=this._register(new me);this._linkProvider=this._register(new me);this._os=Po;this._proxy=e.getProxy(to.ExtHostTerminalService),this._register(t.onDidCreateInstance(S=>{this._onTerminalOpened(S),this._onInstanceDimensionsChanged(S)})),this._register(t.onDidDisposeInstance(S=>this._onTerminalDisposed(S))),this._register(t.onAnyInstanceProcessIdReady(S=>this._onTerminalProcessIdReady(S))),this._register(t.onDidChangeInstanceDimensions(S=>this._onInstanceDimensionsChanged(S))),this._register(t.onAnyInstanceMaximumDimensionsChange(S=>this._onInstanceMaximumDimensionsChanged(S))),this._register(t.onDidRequestStartExtensionTerminal(S=>this._onRequestStartExtensionTerminal(S))),this._register(t.onDidChangeActiveInstance(S=>this._onActiveTerminalChanged(S?S.instanceId:null))),this._register(t.onAnyInstanceTitleChange(S=>S&&this._onTitleChanged(S.instanceId,S.title))),this._register(t.onAnyInstanceDataInput(S=>this._proxy.$acceptTerminalInteraction(S.instanceId))),this._register(t.onAnyInstanceSelectionChange(S=>this._proxy.$acceptTerminalSelection(S.instanceId,S.selection))),this._register(t.onAnyInstanceShellTypeChanged(S=>this._onShellTypeChanged(S.instanceId)));for(let S of this._terminalService.instances)this._onTerminalOpened(S),S.processReady.then(()=>this._onTerminalProcessIdReady(S)),S.shellType&&this._proxy.$acceptTerminalShellType(S.instanceId,S.shellType);let b=this._terminalService.activeInstance;if(b&&this._proxy.$acceptActiveTerminalChanged(b.instanceId),this._environmentVariableService.collections.size>0){let y=[...this._environmentVariableService.collections.entries()].map(w=>[w[0],Gue(w[1].map)]);this._proxy.$initEnvironmentVariableCollections(y)}this._store.add(Z(()=>{for(let S of this._terminalProcessProxies.values())S.proxy.dispose(),S.store.dispose();this._terminalProcessProxies.clear()})),u.getEnvironment().then(async S=>{this._os=S?.os||Po,this._updateDefaultProfile()}),this._register(this._terminalProfileService.onDidChangeAvailableProfiles(()=>this._updateDefaultProfile())),this._register(Z(()=>{for(let S of this._profileProviders.values())S.dispose();for(let S of this._quickFixProviders.values())S.dispose()}))}async _updateDefaultProfile(){let e=this._environmentService.remoteAuthority,t=this._terminalProfileResolverService.getDefaultProfile({remoteAuthority:e,os:this._os}),o=this._terminalProfileResolverService.getDefaultProfile({remoteAuthority:e,os:this._os,allowAutomationShell:!0});this._proxy.$acceptDefaultProfile(...await Promise.all([t,o]))}async _getTerminalInstance(e){return typeof e=="string"?this._extHostTerminals.get(e):this._terminalService.getInstanceFromId(e)}async $createTerminal(e,t){let o={name:t.name,executable:t.shellPath,args:t.shellArgs,cwd:typeof t.cwd=="string"?t.cwd:A.revive(t.cwd),icon:t.icon,color:t.color,initialText:t.initialText,waitOnExit:t.waitOnExit,ignoreConfigurationCwd:!0,env:t.env,strictEnv:t.strictEnv,hideFromUser:t.hideFromUser,customPtyImplementation:t.isExtensionCustomPtyTerminal?(s,l,c)=>new ZJ(s,l,c,this._terminalService):void 0,extHostTerminalId:e,forceShellIntegration:t.forceShellIntegration,isFeatureTerminal:t.isFeatureTerminal,isExtensionOwnedTerminal:t.isExtensionOwnedTerminal,useShellEnvironment:t.useShellEnvironment,isTransient:t.isTransient,shellIntegrationNonce:t.shellIntegrationNonce,titleTemplate:t.titleTemplate},n=dn.withAsyncBody(async s=>{let l=await this._terminalService.createTerminal({config:o,location:await this._deserializeParentTerminal(t.location)});s(l)});this._extHostTerminals.set(e,n);let r=await n;this._register(r.onDisposed(()=>{this._extHostTerminals.delete(e)}))}async _deserializeParentTerminal(e){if(typeof e=="object"&&No(e,{parentTerminal:!0})){let t=await this._extHostTerminals.get(e.parentTerminal.toString());return t?{parentTerminal:t}:void 0}return e}async $show(e,t){let o=await this._getTerminalInstance(e);o&&(this._terminalService.setActiveInstance(o),o.target===2?await this._terminalEditorService.revealActiveEditor(t):await this._terminalGroupService.showPanel(!t))}async $hide(e){let t=await this._getTerminalInstance(e),o=this._terminalService.activeInstance;o&&o.instanceId===t?.instanceId&&o.target!==2&&this._terminalGroupService.hidePanel()}async $dispose(e){(await this._getTerminalInstance(e))?.dispose(4)}async $sendText(e,t,o){await(await this._getTerminalInstance(e))?.sendText(t,o)}$sendProcessExit(e,t){this._terminalProcessProxies.get(e)?.proxy.emitExit(t)}$startSendingDataEvents(){if(!this._dataEventTracker.value){this._dataEventTracker.value=this._instantiationService.createInstance(rYe,(e,t)=>{this._onTerminalData(e,t)});for(let e of this._terminalService.instances)for(let t of e.initialDataEvents||[])this._onTerminalData(e.instanceId,t)}}$stopSendingDataEvents(){this._dataEventTracker.clear()}$startSendingCommandEvents(){if(this._sendCommandEventListener.value)return;let e=this._terminalService.createOnInstanceCapabilityEvent(2,o=>o.onCommandFinished),t=e.event(o=>{this._onDidExecuteCommand(o.instance.instanceId,{commandLine:o.data.command,cwd:o.data.cwd,exitCode:o.data.exitCode,output:o.data.getOutput()})});this._sendCommandEventListener.value=wn(e,t)}$stopSendingCommandEvents(){this._sendCommandEventListener.clear()}$startLinkProvider(){this._linkProvider.value=this._terminalLinkProviderService.registerLinkProvider(new Evi(this._proxy))}$stopLinkProvider(){this._linkProvider.clear()}$registerProcessSupport(e){this._terminalService.registerProcessSupport(e)}$registerCompletionProvider(e,t,...o){this._completionProviders.set(e,this._terminalCompletionService.registerTerminalCompletionProvider(t,e,{id:e,provideCompletions:async(n,r,s)=>{let l=await this._proxy.$provideTerminalCompletions(e,{commandLine:n,cursorIndex:r},s);if(l){if(l.resourceOptions){let{cwd:c,globPattern:u,...p}=l.resourceOptions;return{items:l.items?.map(h=>({provider:`ext:${e}`,...h})),resourceOptions:{...p,cwd:c,globPattern:u}}}return l.items?.map(c=>({provider:`ext:${e}`,...c}))}}},...o))}$unregisterCompletionProvider(e){this._completionProviders.get(e)?.dispose(),this._completionProviders.delete(e)}$registerProfileProvider(e,t){this._profileProviders.set(e,this._terminalProfileService.registerTerminalProfileProvider(t,e,{createContributedTerminalProfile:async o=>this._proxy.$createContributedProfileTerminal(e,o)}))}$unregisterProfileProvider(e){this._profileProviders.get(e)?.dispose(),this._profileProviders.delete(e)}async $registerQuickFixProvider(e,t){this._quickFixProviders.set(e,this._terminalQuickFixService.registerQuickFixProvider(e,{provideTerminalQuickFixes:async(o,n,r,s)=>{if(s.isCancellationRequested)return;r.outputMatcher?.length&&r.outputMatcher.length>40&&(r.outputMatcher.length=40,this._logService.warn("Cannot exceed output matcher length of 40"));let l=o.command.match(r.commandLineMatcher);if(!l||!n)return;let c=r.outputMatcher,u;if(c&&(u=_4o(n,c)),!u)return;let p={commandLineMatch:l,outputMatch:u,commandLine:o.command};if(p){let h=await this._proxy.$provideTerminalQuickFixes(e,p,s);if(h&&Array.isArray(h))return h.map(g=>Jno(e,t,g));if(h)return Jno(e,t,h)}}}))}$unregisterQuickFixProvider(e){this._quickFixProviders.get(e)?.dispose(),this._quickFixProviders.delete(e)}_onActiveTerminalChanged(e){this._proxy.$acceptActiveTerminalChanged(e)}_onTerminalData(e,t){this._proxy.$acceptTerminalProcessData(e,t)}_onDidExecuteCommand(e,t){this._proxy.$acceptDidExecuteCommand(e,t)}_onTitleChanged(e,t){this._proxy.$acceptTerminalTitleChange(e,t)}_onShellTypeChanged(e){let t=this._terminalService.getInstanceFromId(e);t&&this._proxy.$acceptTerminalShellType(e,t.shellType)}_onTerminalDisposed(e){this._proxy.$acceptTerminalClosed(e.instanceId,e.exitCode,e.exitReason??0);let t=this._terminalProcessProxies.get(e.instanceId);t&&(t.proxy.dispose(),t.store.dispose(),this._terminalProcessProxies.delete(e.instanceId))}_onTerminalOpened(e){let t=e.shellLaunchConfig.extHostTerminalId,o={name:e.shellLaunchConfig.name,executable:e.shellLaunchConfig.executable,args:e.shellLaunchConfig.args,cwd:e.shellLaunchConfig.cwd,env:e.shellLaunchConfig.env,hideFromUser:e.shellLaunchConfig.hideFromUser,tabActions:e.shellLaunchConfig.tabActions,titleTemplate:e.shellLaunchConfig.titleTemplate};this._proxy.$acceptTerminalOpened(e.instanceId,t,e.title,o)}_onTerminalProcessIdReady(e){e.processId!==void 0&&this._proxy.$acceptTerminalProcessId(e.instanceId,e.processId)}_onInstanceDimensionsChanged(e){this._proxy.$acceptTerminalDimensions(e.instanceId,e.cols,e.rows)}_onInstanceMaximumDimensionsChanged(e){this._proxy.$acceptTerminalMaximumDimensions(e.instanceId,e.maxCols,e.maxRows)}_onRequestStartExtensionTerminal(e){let t=e.proxy,o=new N;this._terminalProcessProxies.set(t.instanceId,{proxy:t,store:o});let n=e.cols&&e.rows?{columns:e.cols,rows:e.rows}:void 0;this._proxy.$startExtensionTerminal(t.instanceId,n).then(e.callback),o.add(t.onInput(r=>this._proxy.$acceptProcessInput(t.instanceId,r))),o.add(t.onShutdown(r=>this._proxy.$acceptProcessShutdown(t.instanceId,r))),o.add(t.onRequestCwd(()=>this._proxy.$acceptProcessRequestCwd(t.instanceId))),o.add(t.onRequestInitialCwd(()=>this._proxy.$acceptProcessRequestInitialCwd(t.instanceId)))}$sendProcessData(e,t){this._terminalProcessProxies.get(e)?.proxy.emitData(t)}$sendProcessReady(e,t,o,n){this._terminalProcessProxies.get(e)?.proxy.emitReady(t,o,n)}$sendProcessProperty(e,t){t.type==="title"&&this._terminalService.getInstanceFromId(e)?.rename(t.value),this._terminalProcessProxies.get(e)?.proxy.emitProcessProperty(t)}$setEnvironmentVariableCollection(e,t,o,n){if(o){let r={persistent:t,map:tYe(o),descriptionMap:iYe(n)};this._environmentVariableService.set(e,r)}else this._environmentVariableService.delete(e)}};OPt=I([fo(qi.MainThreadTerminalService),m(1,nn),m(2,oYe),m(3,g_e),m(4,F),m(5,c2),m(6,se),m(7,Ag),m(8,bo),m(9,lc),m(10,Fv),m(11,vy),m(12,tZ),m(13,At)],OPt);var rYe=class extends x{constructor(e,t){super();this._callback=e;this._terminalService=t;this._register(this._bufferer=new PPt(this._callback));for(let o of this._terminalService.instances)this._registerInstance(o);this._register(this._terminalService.onDidCreateInstance(o=>this._registerInstance(o))),this._register(this._terminalService.onDidDisposeInstance(o=>this._bufferer.stopBuffering(o.instanceId)))}_registerInstance(e){this._register(this._bufferer.startBuffering(e.instanceId,e.onData))}};rYe=I([m(1,nn)],rYe);var Evi=class{constructor(i){this._proxy=i}async provideLinks(i,e){let t=this._proxy;return(await t.$provideLinks(i.instanceId,e)).map(n=>({id:n.id,startIndex:n.startIndex,length:n.length,label:n.label,activate:()=>t.$activateLink(i.instanceId,n.id)}))}};function _4o(a,i){let e=a.join(`
`).match(i.lineMatcher);return e?{regexMatch:e,outputLines:a}:void 0}function Jno(a,i,e){let t=0;return No(e,{uri:!0})?(e.uri=A.revive(e.uri),t=1):No(e,{id:!0})&&(t=3),{id:a,type:t,source:i,...e}}var FPt=class extends x{constructor(e,t,o,n){super();this._terminalService=t;this._extensionService=n;this._proxy=e.getProxy(to.ExtHostTerminalShellIntegration);let r=new Map;this._register(Z(()=>{for(let g of r.values())g.dispose()}));for(let g of this._terminalService.instances)g.capabilities.get(2)&&this._enableShellIntegration(g);let s=this._store.add(this._terminalService.createOnInstanceEvent(g=>U.map(g.capabilities.onDidAddCommandDetectionCapability,()=>g))).event;this._store.add(s(g=>this._enableShellIntegration(g)));let l=this._store.add(this._terminalService.createOnInstanceCapabilityEvent(0,g=>g.onDidChangeCwd));this._store.add(l.event(g=>{this._proxy.$cwdChange(g.instance.instanceId,g.data)}));let c=this._store.add(this._terminalService.createOnInstanceCapabilityEvent(5,g=>g.onDidChangeEnv));this._store.add(c.event(g=>{if(g.data.value&&typeof g.data.value=="object"){let f=g.data.value,v=Object.keys(f),b=Object.values(f);this._proxy.$shellEnvChange(g.instance.instanceId,v,b,g.data.isTrusted)}}));let u=this._store.add(this._terminalService.createOnInstanceCapabilityEvent(2,g=>g.onCommandExecuted)),p;this._store.add(u.event(g=>{if(g.data===p)return;p=g.data;let f=g.instance.instanceId;this._proxy.$shellExecutionStart(f,tro(g.instance),g.data.command,ero(g.data),g.data.isTrusted,g.data.cwd),r.get(f)?.dispose(),r.set(f,U.accumulate(g.instance.onData,50,!0,this._store)(v=>{this._proxy.$shellExecutionData(f,v.join(""))}))}));let h=this._store.add(this._terminalService.createOnInstanceCapabilityEvent(2,g=>g.onCommandFinished));this._store.add(h.event(g=>{p=void 0;let f=g.instance.instanceId;r.get(f)?.dispose(),this._proxy.$shellExecutionEnd(f,g.data.command,ero(g.data),g.data.isTrusted,g.data.exitCode)})),this._store.add(this._terminalService.onDidDisposeInstance(g=>this._proxy.$closeTerminal(g.instanceId)))}$executeCommand(e,t){this._terminalService.getInstanceFromId(e)?.runCommand(t,!0)}_enableShellIntegration(e){this._extensionService.activateByEvent("onTerminalShellIntegration:*"),e.shellType&&this._extensionService.activateByEvent(`onTerminalShellIntegration:${e.shellType}`),this._proxy.$shellIntegrationChange(e.instanceId,tro(e));let t=e.capabilities.get(0);t&&this._proxy.$cwdChange(e.instanceId,t.getCwd())}};FPt=I([fo(qi.MainThreadTerminalShellIntegration),m(1,nn),m(2,At),m(3,lt)],FPt);function ero(a){switch(a.commandLineConfidence){case"high":return 2;case"medium":return 1;default:return 0}}function tro(a){return a.shellLaunchConfig.type!=="Task"}var WPt=class{constructor(i,e){this._themeService=e,this._proxy=i.getProxy(to.ExtHostTheming),this._themeChangeListener=this._themeService.onDidColorThemeChange(t=>{this._proxy.$onColorThemeChange(this._themeService.getColorTheme().type)}),this._proxy.$onColorThemeChange(this._themeService.getColorTheme().type)}dispose(){this._themeChangeListener.dispose()}};WPt=I([fo(qi.MainThreadTheming),m(1,Le)],WPt);var VPt=class extends x{constructor(e,t,o,n,r,s){super();this.viewsService=t;this.notificationService=o;this.extensionService=n;this.logService=r;this.telemetryService=s;this._dataProviders=this._register(new Vt);this._dndControllers=new Map;this._proxy=e.getProxy(to.ExtHostTreeViews)}async $registerTreeViewDataProvider(e,t){this.logService.trace("MainThreadTreeViews#$registerTreeViewDataProvider",e,t),this.extensionService.whenInstalledExtensionsRegistered().then(()=>{let o=new _vi(e,this._proxy,this.notificationService),n=new N;this._dataProviders.set(e,{dataProvider:o,dispose:()=>n.dispose()});let r=t.hasHandleDrag||t.hasHandleDrop?new Tvi(e,t.dropMimeTypes,t.dragMimeTypes,t.hasHandleDrag,this._proxy):void 0,s=this.getTreeView(e);s?(s.showCollapseAllAction=t.showCollapseAll,s.canSelectMany=t.canSelectMany,s.manuallyManageCheckboxes=t.manuallyManageCheckboxes,s.dragAndDropController=r,r&&this._dndControllers.set(e,r),s.dataProvider=o,this.registerListeners(e,s,n),this._proxy.$setVisible(e,s.visible)):this.notificationService.error("No view is registered with id: "+e)})}$reveal(e,t,o){return this.logService.trace("MainThreadTreeViews#$reveal",e,t?.item,t?.parentChain,o),this.viewsService.openView(e,o.focus).then(()=>{let n=this.getTreeView(e);if(n&&t)return this.reveal(n,this._dataProviders.get(e).dataProvider,t.item,t.parentChain,o)})}$refresh(e,t){this.logService.trace("MainThreadTreeViews#$refresh",e,t);let o=this.getTreeView(e),n=this._dataProviders.get(e);if(o&&n){let r=n.dataProvider.getItemsToRefresh(t);return o.refresh(r.items.length?r.items:void 0,r.checkboxes.length?r.checkboxes:void 0)}return Promise.resolve()}$setMessage(e,t){this.logService.trace("MainThreadTreeViews#$setMessage",e,t.toString());let o=this.getTreeView(e);o&&(o.message=t)}$setTitle(e,t,o){this.logService.trace("MainThreadTreeViews#$setTitle",e,t,o);let n=this.getTreeView(e);n&&(n.title=t,n.description=o)}$setBadge(e,t){this.logService.trace("MainThreadTreeViews#$setBadge",e,t?.value,t?.tooltip);let o=this.getTreeView(e);o&&(o.badge=t)}$resolveDropFileData(e,t,o){let n=this._dndControllers.get(e);if(!n)throw new Error("Unknown tree");return n.resolveDropFileData(t,o)}async $disposeTree(e){let t=this.getTreeView(e);t&&(t.dataProvider=void 0),this._dataProviders.deleteAndDispose(e)}$logResolveTreeNodeFailure(e){this.telemetryService.publicLog2("treeView.resolveFailure",{extensionId:e})}async reveal(e,t,o,n,r){r=r||{select:!1,focus:!1};let s=nr(r.select)?!1:r.select,l=nr(r.focus)?!1:r.focus,c=Math.min(Yo(r.expand)?r.expand:r.expand===!0?1:0,3);t.isEmpty()&&await e.refresh();for(let p of n){let h=t.getItem(p.handle);h&&await e.expand(h)}let u=t.getItem(o.handle);if(u){await e.reveal(u),s&&e.setSelection([u]),l===!1?e.setFocus():l&&e.setFocus(u);let p=[u];for(;p.length>0&&c>0;c--)await e.expand(p),p=p.reduce((h,g)=>{let f=t.getItem(g.handle);return f&&f.children&&f.children.length&&h.push(...f.children),h},[])}}registerListeners(e,t,o){o.add(t.onDidExpandItem(n=>this._proxy.$setExpanded(e,n.handle,!0))),o.add(t.onDidCollapseItem(n=>this._proxy.$setExpanded(e,n.handle,!1))),o.add(t.onDidChangeSelectionAndFocus(n=>this._proxy.$setSelectionAndFocus(e,n.selection.map(({handle:r})=>r),n.focus.handle))),o.add(t.onDidChangeVisibility(n=>this._proxy.$setVisible(e,n))),o.add(t.onDidChangeCheckboxState(n=>{this._proxy.$changeCheckboxState(e,n.map(r=>({treeItemHandle:r.handle,newState:r.checkbox?.isChecked??!1})))}))}getTreeView(e){let t=ne.as(Mn.ViewsRegistry).getView(e);return t?t.treeView:null}dispose(){for(let e of this._dataProviders){let t=this.getTreeView(e[0]);t&&(t.dataProvider=void 0)}this._dataProviders.dispose(),this._dndControllers.clear(),super.dispose()}};VPt=I([fo(qi.MainThreadTreeViews),m(1,$t),m(2,Ne),m(3,lt),m(4,se),m(5,Te)],VPt);var Tvi=class{constructor(i,e,t,o,n){this.treeViewId=i;this.dropMimeTypes=e;this.dragMimeTypes=t;this.hasWillDrop=o;this._proxy=n;this.dataTransfersCache=new Rue}async handleDrop(i,e,t,o,n,r){let s=this.dataTransfersCache.add(i);try{let l=await Lue.fromList(i);return t.isCancellationRequested?void 0:await this._proxy.$handleDrop(this.treeViewId,s.id,l,e?.handle,t,o,n,r)}finally{s.dispose()}}async handleDrag(i,e,t){if(!this.hasWillDrop)return;let o=await this._proxy.$handleDrag(this.treeViewId,i,e,t);if(!o)return;let n=new qx;return o.items.forEach(([r,s])=>{let l=r===tr.uriList&&s.uriListData?aw.create(s.uriListData.map(c=>typeof c=="string"?c:A.revive(c))):s.asString;n.replace(r,DO(l))}),n}resolveDropFileData(i,e){return this.dataTransfersCache.resolveFileData(i,e)}},_vi=class{constructor(i,e,t){this.treeViewId=i;this._proxy=e;this.notificationService=t;this.itemsMap=new Map;this.hasResolve=this._proxy.$hasResolve(this.treeViewId)}async getChildren(i){return(await this.getChildrenBatch(i?[i]:void 0))?.[0]}getChildrenBatch(i){return i||this.itemsMap.clear(),this._proxy.$getChildren(this.treeViewId,i?i.map(e=>e.handle):void 0).then(e=>{let t=this.convertTransferChildren(i??[],e);return this.postGetChildren(t)},e=>(PRt.is(e)||this.notificationService.error(e),[]))}convertTransferChildren(i,e){let t=Array(i.length);if(e)for(let o of e){let n=o[0];t[n]=o.slice(1)}return t}getItemsToRefresh(i){let e=[],t=[];if(i)for(let o of Object.keys(i)){let n=this.getItem(o);if(n){let r=i[o];if(n.checkbox?.isChecked!==r.checkbox?.isChecked&&t.push(n),this.updateTreeItem(n,r),o===r.handle)e.push(n);else{this.itemsMap.delete(o),this.itemsMap.set(n.handle,n);let s=r.parentHandle?this.itemsMap.get(r.parentHandle):null;s&&e.push(s)}}}return{items:e,checkboxes:t}}getItem(i){return this.itemsMap.get(i)}isEmpty(){return this.itemsMap.size===0}async postGetChildren(i){if(i===void 0)return;let e=[],t=await this.hasResolve;if(i)for(let o of i){let n=[];if(e.push(n),!!o)for(let r of o){let s=new w4(r,t?l=>this._proxy.$resolve(this.treeViewId,r.handle,l):void 0);this.itemsMap.set(r.handle,s),n.push(s)}}return e}updateTreeItem(i,e){if(e.children=e.children?e.children:void 0,i){let t=zo([...Object.keys(i instanceof w4?i.asTreeItem():i),...Object.keys(e)]);for(let o of t)i[o]=e[o];i instanceof w4&&i.resetResolve()}}};var i0=le("downloadService");var BPt=class extends x{constructor(e,t){super();this.downloadService=t}$download(e,t){return this.downloadService.download(A.revive(e),A.revive(t),"mainThreadDownloadService.download")}};BPt=I([fo(qi.MainThreadDownloadService),m(1,i0)],BPt);var _b=le("urlService");var D4o=300*1e3,L4o=30*1e3,Dvi="extensionUrlHandler.urlToHandle",R4o="extensions.confirmedUriHandlerExtensionIds",iro="extensionUrlHandler.confirmedExtensions";function oro(a){return/^[a-z0-9][a-z0-9\-]*\.[a-z0-9][a-z0-9\-]*$/i.test(a)}var HPt=class{constructor(i){this.storageService=i}get extensions(){let i=this.storageService.get(iro,0,"[]");try{return JSON.parse(i)}catch{return[]}}has(i){return this.extensions.indexOf(i)>-1}add(i){this.set([...this.extensions,i])}set(i){this.storageService.store(iro,JSON.stringify(i),0,1)}},Rvi=le("extensionUrlHandler"),aYe=class{static{this.handlers=new Set}static registerHandler(i){return this.handlers.add(i),Z(()=>this.handlers.delete(i))}static getHandler(i){for(let e of this.handlers)if(e.canHandleURL(i))return e}},sYe=class{constructor(i,e,t,o,n,r,s,l,c){this.extensionService=e;this.dialogService=t;this.commandService=o;this.hostService=n;this.storageService=r;this.configurationService=s;this.notificationService=l;this.productService=c;this.extensionHandlers=new Map;this.uriBuffer=new Map;this.userTrustedExtensionsStorage=new HPt(r);let u=zI(ut,()=>this.garbageCollect(),L4o),p=this.storageService.get(Dvi,1);p&&(this.storageService.remove(Dvi,1),this.handleURL(A.revive(JSON.parse(p)),{trusted:!0})),this.disposable=wn(i.registerHandler(this),u);let h=kA.cache;setTimeout(()=>h.forEach(([g,f])=>this.handleURL(g,f)))}async handleURL(i,e){if(!oro(i.authority))return!1;let t=aYe.getHandler(i);if(t){let p=await t.handleURL(i);if(p)return p}let o=i.authority,n=this.extensionHandlers.get(Ii.toKey(o)),r;if(n)r=n.extensionDisplayName;else{let p=await this.extensionService.getExtension(o);if(p)r=p.displayName??"";else return await this.handleUnhandledURL(i,o,e),!0}if(!(e?.trusted||this.productService.trustedExtensionProtocolHandlers?.some(p=>vr(p,o))||this.didUserTrustExtension(Ii.toKey(o)))){let p=i.toString(!1),h=p;h.length>40&&(h=`${h.substring(0,30)}...${h.substring(h.length-5)}`);let g=await this.dialogService.confirm({message:d(17643,null,r),checkbox:{label:d(17652,null)},primaryButton:d(17648,null),custom:{markdownDetails:[{markdown:new Ie(`<div title="${p}" aria-label='${p}'>${h}</div>`,{supportHtml:!0})}]}});if(!g.confirmed)return!0;g.checkboxChecked&&this.userTrustedExtensionsStorage.add(Ii.toKey(o))}let l=this.extensionHandlers.get(Ii.toKey(o));if(l)return n?!1:await this.handleURLByExtension(o,l,i,e);let c=new Date().getTime(),u=this.uriBuffer.get(Ii.toKey(o));return u||(u=[],this.uriBuffer.set(Ii.toKey(o),u)),u.push({timestamp:c,uri:i}),await this.extensionService.activateByEvent(`onUri:${Ii.toKey(o)}`,1),!0}registerExtensionHandler(i,e){this.extensionHandlers.set(Ii.toKey(i),e);let t=this.uriBuffer.get(Ii.toKey(i))||[];for(let{uri:o}of t)this.handleURLByExtension(i,e,o);this.uriBuffer.delete(Ii.toKey(i))}unregisterExtensionHandler(i){this.extensionHandlers.delete(Ii.toKey(i))}async handleURLByExtension(i,e,t,o){return await e.handleURL(t,o)}async handleUnhandledURL(i,e,t){try{await this.commandService.executeCommand("workbench.extensions.installExtension",e,{justification:{reason:`${d(17645,null)}
${i.toString()}`,action:d(17649,null)},enable:!0,installPreReleaseVersion:this.productService.quality!=="stable"})}catch(n){ao(n)||this.notificationService.error(n);return}if(await this.extensionService.getExtension(e))await this.handleURL(i,{...t,trusted:!0});else{if(!(await this.dialogService.confirm({message:d(17650,null,e),primaryButton:d(17651,null)})).confirmed)return;this.storageService.store(Dvi,JSON.stringify(i.toJSON()),1,1),await this.hostService.reload()}}garbageCollect(){let i=new Date().getTime(),e=new Map;this.uriBuffer.forEach((t,o)=>{t=t.filter(({timestamp:n})=>i-n<D4o),t.length>0&&e.set(o,t)}),this.uriBuffer=e}didUserTrustExtension(i){return this.userTrustedExtensionsStorage.has(i)?!0:this.getConfirmedTrustedExtensionIdsFromConfiguration().indexOf(i)>-1}getConfirmedTrustedExtensionIdsFromConfiguration(){let i=this.configurationService.getValue(R4o);return Array.isArray(i)?i:[]}dispose(){this.disposable.dispose(),this.extensionHandlers.clear(),this.uriBuffer.clear()}};sYe=I([m(0,_b),m(1,lt),m(2,at),m(3,ge),m(4,Zt),m(5,ce),m(6,B),m(7,Ne),m(8,tt)],sYe);Ee(Rvi,sYe,0);var kA=class{static{this.ID="workbench.contrib.extensionUrlBootstrapHandler"}static{this._cache=[]}static get cache(){kA.disposable.dispose();let i=kA._cache;return kA._cache=[],i}constructor(i){kA.disposable=i.registerHandler(this)}async handleURL(i,e){return oro(i.authority)?(kA._cache.push([i,e]),!0):!1}};kA=I([m(0,_b)],kA);It(kA.ID,kA,St.BlockRestore);var Lvi=class extends K{constructor(){super({id:"workbench.extensions.action.manageAuthorizedExtensionURIs",title:L(17646,"Manage Authorized Extension URIs..."),category:L(17644,"Extensions"),menu:{id:D.CommandPalette,when:Fu.toNegated()}})}async run(i){let e=i.get(ce),t=i.get(Ue),o=new HPt(e),n=o.extensions.map(s=>({label:s,picked:!0}));if(n.length===0){await t.pick([{label:d(17647,null)}]);return}let r=await t.pick(n,{canPickMany:!0});r&&o.set(r.map(s=>s.label))}};W(Lvi);var rro=A.parse("trustedDomains:/Trusted Domains"),I_e="http.linkProtectionTrustedDomains",UPt="http.linkProtectionTrustedDomainsContent";async function sro(a,i){await a.openEditor({resource:i,languageId:"jsonc",options:{pinned:!0}});let e=a.activeTextEditorControl;if(!pn(e))return;let t=e.getModel();if(!t||!Qe(t.uri,i))return;let o=yde(t.getValue(),!0),n;for(let r=o.scan();r!==17;r=o.scan())if(r===3){n=o.getTokenOffset()+o.getTokenLength();let s=o.scan();s!==17&&s!==4&&(n=o.getTokenOffset());break}if(n!==void 0){let r=t.getPositionAt(n);e.setPosition(r),e.revealPositionInCenter(r)}}var zPt={id:"workbench.action.manageTrustedDomain",description:{description:L(16336,"Manage Trusted Domains"),args:[]},handler:async a=>{let i=a.get(ee);await sro(i,rro)}};async function aro(a,i,e,t,o,n,r){let s=A.parse(i),l=s.authority.split("."),c=l.slice(l.length-2).join("."),u="*."+c,p=[];if(p.push({type:"item",label:d(16340,null,i),id:"trust",toTrust:i,picked:!0}),l.length===4&&l.every(f=>Number.isInteger(+f)||Number.isInteger(+f.split(":")[0]))){if(s.authority.includes(":")){let f=s.authority.split(":")[0];p.push({type:"item",label:d(16339,null,f),toTrust:f+":*",id:"trust"})}}else p.push({type:"item",label:d(16341,null,c),toTrust:u,id:"trust"});p.push({type:"item",label:d(16338,null),toTrust:"*",id:"trust"}),p.push({type:"item",label:d(16337,null),id:"manage"});let g=await t.pick(p,{activeItem:p[0]});if(g&&g.id)switch(g.id){case"manage":{let f=rro.with({fragment:e.toString()});return await sro(n,f),a}case"trust":{let f=g.toTrust;if(a.indexOf(f)===-1)return o.remove(UPt,-1),o.store(I_e,JSON.stringify([...a,f]),-1,0),[...a,f]}}return[]}async function lro(a){let{defaultTrustedDomains:i,trustedDomains:e}=y_e(a);return{defaultTrustedDomains:i,trustedDomains:e}}function y_e(a){let i=a.get(ce),e=a.get(tt),t=a.get(cd),o=[...e.linkProtectionTrustedDomains??[],...t.options?.additionalTrustedDomains??[]],n=[];try{let r=i.get(I_e,-1);r&&(n=JSON.parse(r))}catch{}return{defaultTrustedDomains:o,trustedDomains:n}}function Mvi(a){let i=typeof a=="string"?A.parse(a):a;return i.with({path:i.path.replace(/\/+$/,""),query:null,fragment:null})}function w_e(a,i){let e=Mvi(a),t;if(/^[^./:]*:\/\//.test(i))t=Mvi(i);else{if(e.scheme!=="http"&&e.scheme!=="https")return!1;t=Mvi(`${e.scheme}://${i}`)}return Pvi(e.scheme,t.scheme)&&Pvi(e.authority,t.authority,!0)&&(t.path==="/"||Pvi(e.path,t.path))}function Pvi(a,i,e=!1){let t=Array.from({length:a.length+1}).map(()=>Array.from({length:i.length+1}).map(()=>{}));return q4(t,e,a,i,0,0)}function q4(a,i,e,t,o,n){if(a[o]?.[n]!==void 0)return a[o][n];let r=[];if(o===e.length)return n===t.length?!0:i&&t[n]+t[n+1]===":*"?n+2===t.length:!1;if(n===t.length)return e.slice(o)[0]==="/";if(e[o]===t[n]&&r.push(q4(a,i,e,t,o+1,n+1)),t[n]+t[n+1]==="*."&&(["/",":"].includes(e[o])||r.push(q4(a,i,e,t,o+1,n)),(o===0||e[o-1]===".")&&r.push(q4(a,i,e,t,o,n+2))),t[n]==="*"&&(o+1===e.length?r.push(q4(a,i,e,t,o+1,n+1)):r.push(q4(a,i,e,t,o+1,n)),r.push(q4(a,i,e,t,o,n+1))),i&&t[n]+t[n+1]===":*")if(e[o]===":"){let s=o+1;do s++;while(/[0-9]/.test(e[s]));r.push(q4(a,i,e,t,s,n+2))}else r.push(q4(a,i,e,t,o,n+2));return a[o][n]=r.some(s=>s===!0)}function KPt(a,i){if(a=A.parse(cYe(a)),i=i.map(cYe),dYe(a.authority))return!0;for(let e=0;e<i.length;e++)if(i[e]==="*"||w_e(a,i[e]))return!0;return!1}function cYe(a){let i=["github.com"];try{let e=typeof a=="string"?A.parse(a,!0):a;return i.includes(e.authority)?e.with({path:e.path.toLowerCase()}).toString(!0):e.toString(!0)}catch{return a.toString()}}var M4o=/^(.+\.)?localhost(:\d+)?$/i,P4o=/^127.0.0.1(:\d+)?$/,A4o=/^\[::1\](:\d+)?$/;function dYe(a){return M4o.test(a)||P4o.test(a)||A4o.test(a)}var $4=le("ITrustedDomainService");var C_e=class extends x{constructor(e,t){super();this._instantiationService=e;this._storageService=t;this._onDidChangeTrustedDomains=this._register(new E);this.onDidChangeTrustedDomains=this._onDidChangeTrustedDomains.event;let o=()=>new lO(ut,()=>{let{defaultTrustedDomains:n,trustedDomains:r}=this._instantiationService.invokeFunction(y_e);return[...n,...r]});this._staticTrustedDomainsResult=o(),this._register(this._storageService.onDidChangeValue(-1,I_e,this._store)(()=>{this._staticTrustedDomainsResult?.dispose(),this._staticTrustedDomainsResult=o(),this._onDidChangeTrustedDomains.fire()}))}get trustedDomains(){return this._staticTrustedDomainsResult.value}isValid(e){let{defaultTrustedDomains:t,trustedDomains:o}=this._instantiationService.invokeFunction(y_e),n=[...t,...o];return KPt(e,n)}};C_e=I([m(0,F),m(1,ce)],C_e);var Avi=class{constructor(i,e,t,o){this.proxy=i;this.handle=e;this.extensionId=t;this.extensionDisplayName=o}async handleURL(i,e){return Ii.equals(this.extensionId,i.authority)?(await this.proxy.$handleExternalUri(this.handle,i),!0):!1}},GPt=class extends x{constructor(e,t,o,n){super();this.urlService=o;this.extensionUrlHandler=n;this.handlers=new Map;this.proxy=e.getProxy(to.ExtHostUrls)}async $registerUriHandler(e,t,o){let n=new Avi(this.proxy,e,t,o),r=this.urlService.registerHandler(n);this.handlers.set(e,{extensionId:t,disposable:r}),this.extensionUrlHandler.registerExtensionHandler(t,n)}async $unregisterUriHandler(e){let t=this.handlers.get(e);if(!t)return;let{extensionId:o,disposable:n}=t;this.extensionUrlHandler.unregisterExtensionHandler(o),this.handlers.delete(e),n.dispose()}async $createAppUri(e){return this.urlService.create(e)}dispose(){super.dispose(),this.handlers.forEach(({disposable:e})=>e.dispose()),this.handlers.clear()}};GPt=I([fo(qi.MainThreadUrls),m(1,$4),m(2,_b),m(3,Rvi)],GPt);var que="default",qPt="workbench.externalUriOpeners",Nvi={type:"string",enum:[]},cro="\n- `https://microsoft.com`: Matches this specific domain using https\n- `https://microsoft.com:8080`: Matches this specific domain on this port using https\n- `https://microsoft.com:*`: Matches this specific domain on any port using https\n- `https://microsoft.com/foo`: Matches `https://microsoft.com/foo` and `https://microsoft.com/foo/bar`, but not `https://microsoft.com/foobar` or `https://microsoft.com/bar`\n- `https://*.microsoft.com`: Match all domains ending in `microsoft.com` using https\n- `microsoft.com`: Match this specific domain using either http or https\n- `*.microsoft.com`: Match all domains ending in `microsoft.com` using either http or https\n- `http://192.168.0.1`: Matches this specific IP using http\n- `http://192.168.0.*`: Matches all IP's with this prefix using http\n- `*`: Match all domains using either http or https",Ovi={...Ud,properties:{[qPt]:{type:"object",markdownDescription:d(10765,null),defaultSnippets:[{body:{"example.com":"$1"}}],additionalProperties:{anyOf:[{type:"string",markdownDescription:d(10767,null,cro)},{type:"string",markdownDescription:d(10767,null,cro),enum:[que],enumDescriptions:[d(10766,null)]},Nvi]}}}};function dro(a,i){Nvi.enum=a,Nvi.enumDescriptions=i,ne.as(Jt.Configuration).notifyConfigurationSchemaUpdated(Ovi)}var iZ=class extends x{constructor(e,t){super();this._extensionService=t;this._openers=new Map;this._memento=new Al(iZ.STORAGE_ID,e),this._mementoObject=this._memento.getMemento(0,1);for(let[o,n]of Object.entries(this._mementoObject||{}))n&&this.add(o,n.extensionId,{isCurrentlyRegistered:!1});this.invalidateOpenersOnExtensionsChanged(),this._register(this._extensionService.onDidChangeExtensions(()=>this.invalidateOpenersOnExtensionsChanged())),this._register(this._extensionService.onDidChangeExtensionsStatus(()=>this.invalidateOpenersOnExtensionsChanged()))}static{this.STORAGE_ID="externalUriOpeners"}didRegisterOpener(e,t){this.add(e,t,{isCurrentlyRegistered:!0})}add(e,t,o){let n=this._openers.get(e);if(n){n.isCurrentlyRegistered=n.isCurrentlyRegistered||o.isCurrentlyRegistered;return}let r={extensionId:t,isCurrentlyRegistered:o.isCurrentlyRegistered};this._openers.set(e,r),this._mementoObject[e]=r,this._memento.saveMemento(),this.updateSchema()}delete(e){this._openers.delete(e),delete this._mementoObject[e],this._memento.saveMemento(),this.updateSchema()}async invalidateOpenersOnExtensionsChanged(){await this._extensionService.whenInstalledExtensionsRegistered();let e=this._extensionService.extensions;for(let[t,o]of this._openers){let n=e.find(r=>r.identifier.value===o.extensionId);n?this._extensionService.canRemoveExtension(n)||o.isCurrentlyRegistered||this.delete(t):this.delete(t)}}updateSchema(){let e=[],t=[];for(let[o,n]of this._openers)e.push(o),t.push(n.extensionId);dro(e,t)}};iZ=I([m(0,ce),m(1,lt)],iZ);var uro=244;function x_e(a){return{...a,override:la.id,pinned:!0}}var Go=le("preferencesService"),$Pt="editor.contrib.defineKeybinding",k_e=".vscode/settings.json",uYe="workbench.settings.openDefaultSettings",pYe="workbench.settings.useSplitJSON",Fvi="workbench.settings.alwaysShowAdvancedSettings",E_e="settings";var oZ=le("externalUriOpenerService"),T_e=class extends x{constructor(e,t,o,n,r){super();this.configurationService=t;this.logService=o;this.preferencesService=n;this.quickInputService=r;this._providers=new qs;this._register(e.registerExternalOpener(this))}registerExternalOpenerProvider(e){return{dispose:this._providers.push(e)}}async getOpeners(e,t,o,n){let r=await this.getAllOpenersForUri(e);if(r.size===0)return[];if(o.preferredOpenerId){if(o.preferredOpenerId===que)return[];let u=r.get(o.preferredOpenerId);if(u)return[u]}let s=this.getConfiguredOpenerForUri(r,e);if(s)return s===que?[]:[s];let l=[];if(await Promise.all(Array.from(r.values()).map(async u=>{let p;try{p=await u.canOpen(o.sourceUri,n)}catch(h){this.logService.error(h);return}switch(p){case 1:case 2:case 3:l.push({opener:u,priority:p});break}})),l.length===0)return[];let c=l.filter(u=>u.priority===3).at(0);return c?[c.opener]:!t&&l.every(u=>u.priority===1)?[]:l.map(u=>u.opener)}async openExternal(e,t,o){let n=typeof e=="string"?A.parse(e):e,r=await this.getOpeners(n,!1,t,o);return r.length===0?!1:r.length===1?r[0].openExternalUri(n,t,o):this.showOpenerPrompt(r,n,t,o)}async getOpener(e,t,o){let n=await this.getOpeners(e,!0,t,o);if(n.length>=1)return n[0]}async getAllOpenersForUri(e){let t=new Map;return await Promise.all(vt.map(this._providers,async o=>{for await(let n of o.getOpeners(e))t.set(n.id,n)})),t}getConfiguredOpenerForUri(e,t){let o=this.configurationService.getValue(qPt)||{};for(let[n,r]of Object.entries(o))if(w_e(t,n)){if(r===que)return"default";let s=e.get(r);if(s)return s}}async showOpenerPrompt(e,t,o,n){let r=e.map(l=>({label:l.label,opener:l}));r.push({label:Wt?d(10770,null):d(10769,null),opener:void 0},{type:"separator"},{label:d(10768,null),opener:"configureDefault"});let s=await this.quickInputService.pick(r,{placeHolder:d(10771,null,t.toString())});return s?typeof s.opener>"u"?!1:s.opener==="configureDefault"?(await this.preferencesService.openUserSettings({jsonEditor:!0,revealSetting:{key:qPt,edit:!0}}),!0):s.opener.openExternalUri(t,o,n):!0}};T_e=I([m(0,Je),m(1,B),m(2,se),m(3,Go),m(4,Ue)],T_e);var jPt=class extends x{constructor(e,t,o,n,r,s){super();this.extensionService=n;this.openerService=r;this.notificationService=s;this._registeredOpeners=new Map;this.proxy=e.getProxy(to.ExtHostUriOpeners),this._register(o.registerExternalOpenerProvider(this)),this._contributedExternalUriOpenersStore=this._register(new iZ(t,n))}async*getOpeners(e){if(!(e.scheme!==Q.http&&e.scheme!==Q.https)){await this.extensionService.activateByEvent(`onOpenExternalUri:${e.scheme}`);for(let[t,o]of this._registeredOpeners)o.schemes.has(e.scheme)&&(yield this.createOpener(t,o))}}createOpener(e,t){return{id:e,label:t.label,canOpen:(o,n)=>this.proxy.$canOpenUri(e,o,n),openExternalUri:async(o,n,r)=>{try{await this.proxy.$openUri(e,{resolvedUri:o,sourceUri:n.sourceUri},r)}catch(s){if(!ao(s)){let l=new it("default",d(3354,null),void 0,void 0,async()=>{await this.openerService.open(o,{allowTunneling:!1,allowContributedOpeners:que})});l.tooltip=o.toString(),this.notificationService.notify({severity:ft.Error,message:d(3353,null,e,s.toString()),actions:{primary:[l]}})}}return!0}}}async $registerUriOpener(e,t,o,n){if(this._registeredOpeners.has(e))throw new Error(`Opener with id '${e}' already registered`);this._registeredOpeners.set(e,{schemes:new Set(t),label:n,extensionId:o}),this._contributedExternalUriOpenersStore.didRegisterOpener(e,o.value)}async $unregisterUriOpener(e){this._registeredOpeners.delete(e),this._contributedExternalUriOpenersStore.delete(e)}dispose(){super.dispose(),this._registeredOpeners.clear()}};jPt=I([fo(qi.MainThreadUriOpeners),m(1,ce),m(2,oZ),m(3,lt),m(4,Je),m(5,Ne)],jPt);var Wvi=class{constructor(){this.todo=[];this.add=i=>{this.todo.push(i)}}take(i,e){this.add=t=>e.createInstance(t,i),this.todo.forEach(this.add),this.todo=[]}},QPt=new Wvi;var N4o=1e4,$ue=le("IUserActivityService"),mYe=class extends x{constructor(e){super();this.markInactive=this._register(new Dt(()=>{this.isActive=!1,this.changeEmitter.fire(!1)},N4o));this.changeEmitter=this._register(new E);this.active=0;this.isActive=!0;this.onDidChangeIsActive=this.changeEmitter.event;this._register(PL(()=>QPt.take(this,e)))}markActive(e){if(e?.extendOnly&&!this.isActive)return x.None;if(e?.whenHeldFor){let t=new N;return t.add(tn(()=>t.add(this.markActive()),e.whenHeldFor)),t}return++this.active===1&&(this.isActive=!0,this.changeEmitter.fire(!0),this.markInactive.cancel()),Z(()=>{--this.active===0&&this.markInactive.schedule()})}};mYe=I([m(0,F)],mYe);Ee($ue,mYe,1);var YPt=class{constructor(i,e,t,o){this.hostService=e;this.openerService=t;this.userActivityService=o;this.disposables=new N;this.proxy=i.getProxy(to.ExtHostWindow),U.latch(e.onDidChangeFocus)(this.proxy.$onDidChangeWindowFocus,this.proxy,this.disposables),o.onDidChangeIsActive(this.proxy.$onDidChangeWindowActive,this.proxy,this.disposables),this.registerNativeHandle()}dispose(){this.disposables.dispose()}registerNativeHandle(){U.latch(this.hostService.onDidChangeActiveWindow)(async i=>{let e=await this.hostService.getNativeWindowHandle(i);this.proxy.$onDidChangeActiveNativeWindowHandle(e?Yd(e):void 0)},this,this.disposables)}$getInitialState(){return Promise.resolve({isFocused:this.hostService.hasFocus,isActive:this.userActivityService.isActive})}async $openUri(i,e,t){let o=A.from(i),n;return e&&A.parse(e).toString()===o.toString()?n=e:n=o,this.openerService.open(n,{openExternal:!0,allowTunneling:t.allowTunneling,allowContributedOpeners:t.allowContributedOpeners})}async $asExternalUri(i,e){return(await this.openerService.resolveExternalUri(A.revive(i),e)).resolved}};YPt=I([fo(qi.MainThreadWindow),m(1,Zt),m(2,Je),m(3,$ue)],YPt);var XPt=le("powerService");var JPt=class extends x{constructor(e,t){super();this.powerService=t;this.proxy=e.getProxy(to.ExtHostPower),this._register(this.powerService.onDidSuspend(this.proxy.$onDidSuspend,this.proxy)),this._register(this.powerService.onDidResume(this.proxy.$onDidResume,this.proxy)),this._register(this.powerService.onDidChangeOnBatteryPower(this.proxy.$onDidChangeOnBatteryPower,this.proxy)),this._register(this.powerService.onDidChangeThermalState(o=>this.proxy.$onDidChangeThermalState(o),this)),this._register(this.powerService.onDidChangeSpeedLimit(this.proxy.$onDidChangeSpeedLimit,this.proxy)),this._register(this.powerService.onWillShutdown(this.proxy.$onWillShutdown,this.proxy)),this._register(this.powerService.onDidLockScreen(this.proxy.$onDidLockScreen,this.proxy)),this._register(this.powerService.onDidUnlockScreen(this.proxy.$onDidUnlockScreen,this.proxy))}async $getSystemIdleState(e){return this.powerService.getSystemIdleState(e)}async $getSystemIdleTime(){return this.powerService.getSystemIdleTime()}async $getCurrentThermalState(){return this.powerService.getCurrentThermalState()}async $isOnBatteryPower(){return this.powerService.isOnBatteryPower()}async $startPowerSaveBlocker(e){return this.powerService.startPowerSaveBlocker(e)}async $stopPowerSaveBlocker(e){return this.powerService.stopPowerSaveBlocker(e)}async $isPowerSaveBlockerStarted(e){return this.powerService.isPowerSaveBlockerStarted(e)}};JPt=I([fo(qi.MainThreadPower),m(1,XPt)],JPt);var nZ=class extends x{constructor(e,t,o,n,r,s){super();this.viewType=e;this._resource=t;this._model=o;this.textFileService=n;this._labelService=r;this._onDidChangeOrphaned=this._register(new E);this.onDidChangeOrphaned=this._onDidChangeOrphaned.event;this._onDidChangeReadonly=this._register(new E);this.onDidChangeReadonly=this._onDidChangeReadonly.event;this._onDidChangeDirty=this._register(new E);this.onDidChangeDirty=this._onDidChangeDirty.event;this._onDidChangeContent=this._register(new E);this.onDidChangeContent=this._onDidChangeContent.event;this._register(o),this._textFileModel=this.textFileService.files.get(t),this._textFileModel&&(this._register(this._textFileModel.onDidChangeOrphaned(()=>this._onDidChangeOrphaned.fire())),this._register(this._textFileModel.onDidChangeReadonly(()=>this._onDidChangeReadonly.fire()))),this._register(this.textFileService.files.onDidChangeDirty(l=>{Qe(this.resource,l.resource)&&(this._onDidChangeDirty.fire(),this._onDidChangeContent.fire())})),this._register(s.onWillStop(l=>{l.veto(!0,d(9203,null,this.name))}))}static async create(e,t,o){return e.invokeFunction(async n=>{let s=await n.get(Bt).createModelReference(o);return e.createInstance(nZ,t,o,s)})}get resource(){return this._resource}get name(){return jo(this._labelService.getUriLabel(this._resource))}isReadonly(){return this._model.object.isReadonly()}get backupId(){}get canHotExit(){return!0}isDirty(){return this.textFileService.isDirty(this.resource)}isOrphaned(){return!!this._textFileModel?.hasState(4)}async revert(e){return this.textFileService.revert(this.resource,e)}saveCustomEditor(e){return this.textFileService.save(this.resource,e)}async saveCustomEditorAs(e,t,o){return!!await this.textFileService.saveAs(e,t,o)}};nZ=I([m(3,Uo),m(4,rt),m(5,lt)],nZ);var rZ=class extends x{constructor(e,t){super();this.resource=e;this.fileService=t;this._onDidChangeOrphaned=this._register(new E);this.onDidChangeOrphaned=this._onDidChangeOrphaned.event;this.orphaned=!1;this._onWillDispose=this._register(new E);this.onWillDispose=this._onWillDispose.event;this._register(this.fileService.onDidFilesChange(o=>this.onDidFilesChange(o)))}isOrphaned(){return this.orphaned}async onDidFilesChange(e){let t=!1,o;if(this.orphaned?e.contains(this.resource,1)&&(o=!1,t=!0):e.contains(this.resource,2)&&(o=!0,t=!0),t&&this.orphaned!==o){let n=!1;o&&(await Li(100,Se.None),this.isDisposed()?n=!0:n=!await this.fileService.exists(this.resource)),this.orphaned!==n&&!this.isDisposed()&&this.setOrphaned(n)}}setOrphaned(e){this.orphaned!==e&&(this.orphaned=e,this._onDidChangeOrphaned.fire())}isDisposed(){return this._store.isDisposed}dispose(){this.orphaned=!1,this._onWillDispose.fire(),super.dispose()}isModified(){return this.isDirty()}};rZ=I([m(1,fe)],rZ);var D_e=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.mainThreadWebview=t;this.mainThreadWebviewPanels=o;this._customEditorService=c;this._editorGroupService=u;this._editorService=p;this._instantiationService=h;this._webviewWorkbenchService=g;this._uriIdentityService=f;this._editorProviders=this._register(new Vt);this._editorRenameBackups=new Map;this._webviewOriginStore=new OK("mainThreadCustomEditors.origins",r),this._proxyCustomEditors=e.getProxy(to.ExtHostCustomEditors),this._register(l.registerWorkingCopyProvider(v=>{let b=[];for(let S of s.workingCopies)S instanceof GB&&ws(v,S.editorResource)&&b.push(S);return b})),this._register(g.registerResolver({canResolve:v=>(v instanceof gm&&n.activateByEvent(`onCustomEditor:${v.viewType}`),!1),resolveWebview:()=>{throw new Error("not implemented")}})),this._register(l.onWillRunWorkingCopyFileOperation(async v=>this.onWillRunWorkingCopyFileOperation(v)))}$registerTextEditorProvider(e,t,o,n,r){this.registerEditorProvider(1,nue(e),t,o,n,!0,r)}$registerCustomEditorProvider(e,t,o,n,r){this.registerEditorProvider(0,nue(e),t,o,{},n,r)}registerEditorProvider(e,t,o,n,r,s,l){if(this._editorProviders.has(o))throw new Error(`Provider for ${o} already registered`);let c=new N;c.add(this._customEditorService.registerCustomEditorCapabilities(o,{supportsMultipleEditorsPerDocument:s})),c.add(this._webviewWorkbenchService.registerResolver({canResolve:u=>u instanceof gm&&u.viewType===o,resolveWebview:async(u,p)=>{let h=xt(),g=u.resource;u.webview.origin=this._webviewOriginStore.getOrigin(o,t.id),this.mainThreadWebviewPanels.addWebviewInput(h,u,{serializeBuffersForPostMessage:l}),u.webview.options=n,u.webview.extension=t;let f=u.backupId;u.oldResource&&!u.backupId&&(f=this._editorRenameBackups.get(u.oldResource.toString())?.backupId,this._editorRenameBackups.delete(u.oldResource.toString()));let v;try{v=await this.getOrCreateCustomEditorModel(e,g,o,{backupId:f},p)}catch(y){mt(y),u.webview.setHtml(this.mainThreadWebview.getWebviewResolvedFailedContent(o));return}if(p.isCancellationRequested){v.dispose();return}let b=u.webview.onDidDispose(()=>{if(b.dispose(),S.dispose(),v.object.isDirty()){let y=v.object.onDidChangeDirty(()=>{v.object.isDirty()||(y.dispose(),v.dispose())});return}v.dispose()}),S=u.onWillDispose(()=>{S.dispose(),b.dispose(),v.dispose()});r.supportsMove&&u.onMove(async y=>{let w=v;v=await this.getOrCreateCustomEditorModel(e,y,o,{},Se.None),this._proxyCustomEditors.$onMoveCustomEditor(h,y,o),w.dispose()});try{let y=e===1?this._uriIdentityService.asCanonicalUri(g):g;await this._proxyCustomEditors.$resolveCustomEditor(y,h,o,{title:u.getTitle(),contentOptions:u.webview.contentOptions,options:u.webview.options,active:u===this._editorService.activeEditor},GC(this._editorGroupService,u.group||0),p)}catch(y){mt(y),u.webview.setHtml(this.mainThreadWebview.getWebviewResolvedFailedContent(o)),v.dispose();return}}})),this._editorProviders.set(o,c)}$unregisterEditorProvider(e){if(!this._editorProviders.has(e))throw new Error(`No provider for ${e} registered`);this._editorProviders.deleteAndDispose(e),this._customEditorService.models.disposeAllModelsForView(e)}async getOrCreateCustomEditorModel(e,t,o,n,r){let s=this._customEditorService.models.tryRetain(t,o);if(s)return s;switch(e){case 1:{let l=nZ.create(this._instantiationService,o,t);return this._customEditorService.models.add(t,o,l)}case 0:{let l=GB.create(this._instantiationService,this._proxyCustomEditors,o,t,n,()=>Array.from(this.mainThreadWebviewPanels.webviewInputs).filter(c=>c instanceof gm&&Qe(c.resource,t)),r);return this._customEditorService.models.add(t,o,l)}}}async $onDidEdit(e,t,o,n){(await this.getCustomEditorModel(e,t)).pushEdit(o,n)}async $onContentChange(e,t){(await this.getCustomEditorModel(e,t)).changeContent()}async getCustomEditorModel(e,t){let o=A.revive(e),n=await this._customEditorService.models.get(o,t);if(!n||!(n instanceof GB))throw new Error("Could not find model for webview editor");return n}async onWillRunWorkingCopyFileOperation(e){e.operation===2&&e.waitUntil((async()=>{let t=[];for(let o of e.files)o.source&&t.push(...await this._customEditorService.models.getAllModels(o.source));for(let o of t)if(o instanceof GB&&o.isDirty()){let n=await o.backup(Se.None);n.meta&&this._editorRenameBackups.set(o.editorResource.toString(),n.meta)}})())}};D_e=I([m(3,lt),m(4,ce),m(5,Xa),m(6,qp),m(7,xJ),m(8,wt),m(9,ee),m(10,F),m(11,hD),m(12,ht)],D_e);var __e;(o=>{let a;(l=>(l[l.Allowed=0]="Allowed",l[l.NotAllowed=1]="NotAllowed",l[l.Pending=2]="Pending"))(a=o.Type||={}),o.Allowed=Object.freeze({type:0}),o.NotAllowed=Object.freeze({type:1});class t{constructor(r){this.operation=r;this.type=2}}o.Pending=t})(__e||={});var GB=class extends rZ{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super(GB.toWorkingCopyResource(t,o),u);this._proxy=e;this._viewType=t;this._editorResource=o;this._editable=r;this._getEditors=l;this._fileDialogService=c;this._labelService=p;this._undoService=h;this._environmentService=g;this._pathService=v;this._fromBackup=!1;this._hotExitState=__e.Allowed;this._currentEditIndex=-1;this._savePoint=-1;this._edits=[];this.typeId=gA;this._onDidChangeDirty=this._register(new E);this.onDidChangeDirty=this._onDidChangeDirty.event;this._onDidChangeContent=this._register(new E);this.onDidChangeContent=this._onDidChangeContent.event;this._onDidSave=this._register(new E);this.onDidSave=this._onDidSave.event;this.onDidChangeReadonly=U.None;this._fromBackup=n,this._isDirtyFromContentChange=s,r&&(this._register(f.registerWorkingCopy(this)),this._register(b.onWillStop(S=>{S.veto(!0,d(3299,null,this.name))})))}static async create(e,t,o,n,r,s,l){let c=s(),u;c.length!==0&&(u=c[0].untitledDocumentData);let{editable:p}=await t.$createCustomDocument(n,o,r.backupId,u,l);return e.createInstance(GB,t,o,n,!!r.backupId,p,!!u,s)}get editorResource(){return this._editorResource}dispose(){this._editable&&this._undoService.removeElements(this._editorResource),this._proxy.$disposeCustomDocument(this._editorResource,this._viewType),super.dispose()}static toWorkingCopyResource(e,t){let o=e.replace(/[^a-z0-9\-_]/gi,"-"),n=`/${F9(t.with({query:null,fragment:null}).toString(!0))}`;return A.from({scheme:Q.vscodeCustomEditor,authority:o,path:n,query:JSON.stringify(t.toJSON())})}get name(){return jo(this._labelService.getUriLabel(this._editorResource))}get capabilities(){return this.isUntitled()?2:0}isDirty(){return this._isDirtyFromContentChange?!0:this._edits.length>0?this._savePoint!==this._currentEditIndex:this._fromBackup}isUntitled(){return this._editorResource.scheme===Q.untitled}isReadonly(){return!this._editable}get viewType(){return this._viewType}get backupId(){return this._backupId}pushEdit(e,t){if(!this._editable)throw new Error("Document is not editable");this.change(()=>{this.spliceEdits(e),this._currentEditIndex=this._edits.length-1}),this._undoService.pushElement({type:0,resource:this._editorResource,label:t??d(3298,null),code:"undoredo.customEditorEdit",undo:()=>this.undo(),redo:()=>this.redo()})}changeContent(){this.change(()=>{this._isDirtyFromContentChange=!0})}async undo(){if(!this._editable||this._currentEditIndex<0)return;let e=this._edits[this._currentEditIndex];this.change(()=>{--this._currentEditIndex}),await this._proxy.$undo(this._editorResource,this.viewType,e,this.isDirty())}async redo(){if(!this._editable||this._currentEditIndex>=this._edits.length-1)return;let e=this._edits[this._currentEditIndex+1];this.change(()=>{++this._currentEditIndex}),await this._proxy.$redo(this._editorResource,this.viewType,e,this.isDirty())}spliceEdits(e){let t=this._currentEditIndex+1,o=this._edits.length-this._currentEditIndex,n=typeof e=="number"?this._edits.splice(t,o,e):this._edits.splice(t,o);n.length&&this._proxy.$disposeEdits(this._editorResource,this._viewType,n)}change(e){let t=this.isDirty();e(),this._onDidChangeContent.fire(),this.isDirty()!==t&&this._onDidChangeDirty.fire()}async revert(e){this._editable&&(this._currentEditIndex===this._savePoint&&!this._isDirtyFromContentChange&&!this._fromBackup||(e?.soft||this._proxy.$revert(this._editorResource,this.viewType,Se.None),this.change(()=>{this._isDirtyFromContentChange=!1,this._fromBackup=!1,this._currentEditIndex=this._savePoint,this.spliceEdits()})))}async save(e){let t=!!await this.saveCustomEditor(e);return t&&this._onDidSave.fire({reason:e?.reason,source:e?.source}),t}async saveCustomEditor(e){if(!this._editable)return;if(this.isUntitled()){let o=await this.suggestUntitledSavePath(e);return o?(await this.saveCustomEditorAs(this._editorResource,o,e),o):void 0}let t=Ln(o=>this._proxy.$onSave(this._editorResource,this.viewType,o));this._ongoingSave?.cancel(),this._ongoingSave=t;try{await t,this._ongoingSave===t&&this.change(()=>{this._isDirtyFromContentChange=!1,this._savePoint=this._currentEditIndex,this._fromBackup=!1})}finally{this._ongoingSave===t&&(this._ongoingSave=void 0)}return this._editorResource}suggestUntitledSavePath(e){if(!this.isUntitled())throw new Error("Resource is not untitled");let t=this._environmentService.remoteAuthority,o=of(this._editorResource,t,this._pathService.defaultUriScheme);return this._fileDialogService.pickFileToSave(o,e?.availableFileSystems)}async saveCustomEditorAs(e,t,o){return this._editable?(await Ln(n=>this._proxy.$onSaveAs(this._editorResource,this.viewType,t,n)),this.change(()=>{this._isDirtyFromContentChange=!1,this._savePoint=this._currentEditIndex,this._fromBackup=!1}),!0):(await this.fileService.copy(e,t,!1),!0)}get canHotExit(){return typeof this._backupId=="string"&&this._hotExitState.type===0}async backup(e){let t=this._getEditors();if(!t.length)throw new Error("No editors found for resource, cannot back up");let o=t[0],r={meta:{viewType:this.viewType,editorResource:this._editorResource,customTitle:o.getWebviewTitle(),iconPath:o.iconPath,backupId:"",extension:o.extension?{id:o.extension.id.value,location:o.extension.location}:void 0,webview:{origin:o.webview.origin,options:o.webview.options,state:o.webview.state}}};if(!this._editable)return r;this._hotExitState.type===2&&this._hotExitState.operation.cancel();let s=new __e.Pending(Ln(c=>this._proxy.$backup(this._editorResource.toJSON(),this.viewType,c)));this._hotExitState=s,e.onCancellationRequested(()=>{s.operation.cancel()});let l="";try{let c=await s.operation;this._hotExitState===s&&(this._hotExitState=__e.Allowed,r.meta.backupId=c,this._backupId=c)}catch(c){if(ao(c))throw c;this._hotExitState===s&&(this._hotExitState=__e.NotAllowed),c.message&&(l=c.message)}if(this._hotExitState===__e.Allowed)return r;throw new Error(`Cannot backup in this state: ${l}`)}};GB=I([m(7,rn),m(8,fe),m(9,rt),m(10,Ml),m(11,At),m(12,Xa),m(13,An),m(14,lt)],GB);var Vvi=class{constructor(){this._handlesToInputs=new Map;this._inputsToHandles=new Map}add(i,e){this._handlesToInputs.set(i,e),this._inputsToHandles.set(e,i)}getHandleForInput(i){return this._inputsToHandles.get(i)}getInputForHandle(i){return this._handlesToInputs.get(i)}delete(i){let e=this.getInputForHandle(i);this._handlesToInputs.delete(i),e&&this._inputsToHandles.delete(e)}get size(){return this._handlesToInputs.size}[Symbol.iterator](){return this._handlesToInputs.values()}},Bvi=class{constructor(i){this.prefix=i}fromExternal(i){return this.prefix+i}toExternal(i){return i.startsWith(this.prefix)?i.substr(this.prefix.length):void 0}},L_e=class extends x{constructor(e,t,o,n,r,s,l,c){super();this._mainThreadWebviews=t;this._configurationService=o;this._editorGroupService=n;this._editorService=r;this._webviewWorkbenchService=c;this.webviewPanelViewType=new Bvi("mainThreadWebview-");this._webviewInputs=new Vvi;this._revivers=this._register(new Vt);this.webviewOriginStore=new OK("mainThreadWebviewPanel.origins",l),this._proxy=e.getProxy(to.ExtHostWebviewPanels),this._register(U.any(r.onDidActiveEditorChange,r.onDidVisibleEditorsChange,n.onDidAddGroup,n.onDidRemoveGroup,n.onDidMoveGroup)(()=>{this.updateWebviewViewStates(this._editorService.activeEditor)})),this._register(c.onDidChangeActiveWebviewEditor(u=>{this.updateWebviewViewStates(u)})),this._register(c.registerResolver({canResolve:u=>{let p=this.webviewPanelViewType.toExternal(u.viewType);return typeof p=="string"&&s.activateByEvent(`onWebviewPanel:${p}`),!1},resolveWebview:()=>{throw new Error("not implemented")}}))}get webviewInputs(){return this._webviewInputs}addWebviewInput(e,t,o){this._webviewInputs.add(e,t),this._mainThreadWebviews.addWebview(e,t.webview,o);let n=t.webview.onDidDispose(()=>{n.dispose(),this._proxy.$onDidDisposeWebviewPanel(e).finally(()=>{this._webviewInputs.delete(e)})})}$createWebviewPanel(e,t,o,n,r){let s=this.getTargetGroupFromShowOptions(r),l=r?{preserveFocus:!!r.preserveFocus,group:s}:{},c=nue(e),u=this.webviewOriginStore.getOrigin(o,c.id),p=this._webviewWorkbenchService.openWebview({origin:u,providedViewType:o,title:n.title,options:F4o(n.panelOptions),contentOptions:cTe(n.webviewOptions),extension:c},this.webviewPanelViewType.fromExternal(o),n.title,void 0,l);this.addWebviewInput(t,p,{serializeBuffersForPostMessage:n.serializeBuffersForPostMessage})}$disposeWebview(e){let t=this.tryGetWebviewInput(e);t&&t.dispose()}$setTitle(e,t){this.tryGetWebviewInput(e)?.setWebviewTitle(t)}$setIconPath(e,t){let o=this.tryGetWebviewInput(e);o&&(o.iconPath=O4o(t))}$reveal(e,t){let o=this.tryGetWebviewInput(e);if(!o||o.isDisposed())return;let n=this.getTargetGroupFromShowOptions(t);this._webviewWorkbenchService.revealWebview(o,n,!!t.preserveFocus)}getTargetGroupFromShowOptions(e){if(typeof e.viewColumn>"u"||e.viewColumn===jn||this._editorGroupService.count===1&&this._editorGroupService.activeGroup.isEmpty)return jn;if(e.viewColumn===In)return In;if(e.viewColumn>=0){let t=this._editorGroupService.getGroups(2)[e.viewColumn];if(t)return t.id;let o=this._editorGroupService.findGroup({location:1});if(o){let n=uy(this._configurationService);return this._editorGroupService.addGroup(o,n)}}return jn}$registerSerializer(e,t){if(this._revivers.has(e))throw new Error(`Reviver for ${e} already registered`);this._revivers.set(e,this._webviewWorkbenchService.registerResolver({canResolve:o=>o.viewType===this.webviewPanelViewType.fromExternal(e),resolveWebview:async o=>{let n=this.webviewPanelViewType.toExternal(o.viewType);if(!n){o.webview.setHtml(this._mainThreadWebviews.getWebviewResolvedFailedContent(o.viewType));return}let r=xt();this.addWebviewInput(r,o,t);let s;if(o.webview.state)try{s=JSON.parse(o.webview.state)}catch(l){console.error("Could not load webview state",l,o.webview.state)}try{await this._proxy.$deserializeWebviewPanel(r,n,{title:o.getTitle(),state:s,panelOptions:o.webview.options,webviewOptions:o.webview.contentOptions,active:o===this._editorService.activeEditor},GC(this._editorGroupService,o.group||0))}catch(l){mt(l),o.webview.setHtml(this._mainThreadWebviews.getWebviewResolvedFailedContent(n))}}}))}$unregisterSerializer(e){if(!this._revivers.has(e))throw new Error(`No reviver for ${e} registered`);this._revivers.deleteAndDispose(e)}updateWebviewViewStates(e){if(!this._webviewInputs.size)return;let t={},o=(n,r,s)=>{if(!(s instanceof Hu))return;s.updateGroup(n.id);let l=this._webviewInputs.getHandleForInput(s);l&&(t[l]={visible:r===n.activeEditor,active:s===e,position:GC(this._editorGroupService,n.id)})};for(let n of this._editorGroupService.groups)for(let r of n.editors)r instanceof Pa?(o(n,r,r.primary),o(n,r,r.secondary)):o(n,r,r);Object.keys(t).length&&this._proxy.$onDidChangeWebviewPanelViewStates(t)}tryGetWebviewInput(e){return this._webviewInputs.getInputForHandle(e)}};L_e=I([m(2,B),m(3,wt),m(4,ee),m(5,lt),m(6,ce),m(7,hD)],L_e);function O4o(a){if(a)return q.isThemeIcon(a)?a:{light:A.revive(a.light),dark:A.revive(a.dark)}}function F4o(a){return{enableFindWidget:a.enableFindWidget,retainContextWhenHidden:a.retainContextWhenHidden}}var R_e=le("webviewViewService"),ZPt=class extends x{constructor(){super(...arguments);this._resolvers=new Map;this._awaitingRevival=new Map;this._onNewResolverRegistered=this._register(new E);this.onNewResolverRegistered=this._onNewResolverRegistered.event}register(e,t){if(this._resolvers.has(e))throw new Error(`View resolver already registered for ${e}`);this._resolvers.set(e,t),this._onNewResolverRegistered.fire({viewType:e});let o=this._awaitingRevival.get(e);return o&&t.resolve(o.webview,Se.None).then(()=>{this._awaitingRevival.delete(e),o.resolve()}),Z(()=>{this._resolvers.delete(e)})}resolve(e,t,o){let n=this._resolvers.get(e);if(!n){if(this._awaitingRevival.has(e))throw new Error("View already awaiting revival");let{promise:r,resolve:s}=WI();return this._awaitingRevival.set(e,{webview:t,resolve:s}),r}return n.resolve(t,o)}};var M_e=class extends x{constructor(e,t,o,n){super();this.mainThreadWebviews=t;this._telemetryService=o;this._webviewViewService=n;this._webviewViews=this._register(new Vt);this._webviewViewProviders=this._register(new Vt);this._proxy=e.getProxy(to.ExtHostWebviewViews)}$setWebviewViewTitle(e,t){let o=this.getWebviewView(e);o.title=t}$setWebviewViewDescription(e,t){let o=this.getWebviewView(e);o.description=t}$setWebviewViewBadge(e,t){let o=this.getWebviewView(e);o.badge=t}$show(e,t){this.getWebviewView(e).show(t)}$registerWebviewViewProvider(e,t,o){if(this._webviewViewProviders.has(t))throw new Error(`View provider for ${t} already registered`);let n=nue(e),r=this._webviewViewService.register(t,{resolve:async(s,l)=>{let c=xt();this._webviewViews.set(c,s),this.mainThreadWebviews.addWebview(c,s.webview,{serializeBuffersForPostMessage:o.serializeBuffersForPostMessage});let u;if(s.webview.state)try{u=JSON.parse(s.webview.state)}catch(h){console.error("Could not load webview state",h,s.webview.state)}s.webview.extension=n,o&&(s.webview.options=o);let p=new N;p.add(s.onDidChangeVisibility(h=>{this._proxy.$onDidChangeWebviewViewVisibility(c,h)})),p.add(s.onDispose(()=>{this._proxy.$disposeWebviewView(c),this._webviewViews.deleteAndDispose(c),p.dispose()})),this._telemetryService.publicLog2("webviews:createWebviewView",{extensionId:n.id.value,id:t});try{await this._proxy.$resolveWebviewView(c,t,s.title,u,l)}catch(h){mt(h),s.webview.setHtml(this.mainThreadWebviews.getWebviewResolvedFailedContent(t))}}});this._webviewViewProviders.set(t,r)}$unregisterWebviewViewProvider(e){if(!this._webviewViewProviders.has(e))throw new Error(`No view provider for ${e} registered`);this._webviewViewProviders.deleteAndDispose(e)}getWebviewView(e){let t=this._webviewViews.get(e);if(!t)throw new Error("unknown webview view");return t}};M_e=I([m(2,Te),m(3,R_e)],M_e);var A_e=le("chatOutputRendererService"),P_e=class extends x{constructor(e,t,o){super();this._contextKeyService=e;this._extensionService=t;this._webviewService=o;this._contributions=new Map;this._renderers=new Map;this._register(V4o.setHandler(n=>{this.updateContributions(n)}))}registerRenderer(e,t,o){return this._renderers.set(e,{viewType:e,renderer:t,options:o}),{dispose:()=>{this._renderers.delete(e)}}}async renderOutputPart(e,t,o,n,r){let s=await this.getRenderer(e,r);if(r.isCancellationRequested)throw new go;if(!s)throw new Error(`No renderer registered found for mime type: ${e}`);let l=new N,c=l.add(this._webviewService.createWebviewElement({title:"",origin:n.origin??xt(),providedViewType:s.viewType,options:{enableFindWidget:!1,purpose:"chatOutputItem",tryRestoreScrollPosition:!1},contentOptions:{},extension:s.options.extension?s.options.extension:void 0}));c.setContextKeyService(l.add(this._contextKeyService.createScoped(o)));let u=l.add(new E);return l.add(be(p=>{let h=p.readObservable(c.intrinsicContentSize);h&&(u.fire(h.height),o.style.height=`${h.height}px`)})),n.webviewState&&(c.state=n.webviewState),c.mountTo(o,Re(o)),await s.renderer.renderOutputPart(e,t,c,r),{get webview(){return c},onDidChangeHeight:u.event,dispose:()=>{l.dispose()},reinitialize:()=>{c.reinitializeAfterDismount()}}}async getRenderer(e,t){await Wp(this._extensionService.whenInstalledExtensionsRegistered(),t);for(let[o,n]of this._contributions)if(n.mimes.some(r=>Zje(r,[e]))){await Wp(this._extensionService.activateByEvent(`onChatOutputRenderer:${o}`),t);let r=this._renderers.get(o);if(r)return r}}updateContributions(e){this._contributions.clear();for(let t of e)if(Ua(t.description,"chatOutputRenderer"))for(let o of t.value){if(this._contributions.has(o.viewType)){t.collector.error(`Chat output renderer with view type '${o.viewType}' already registered`);continue}this._contributions.set(o.viewType,{mimes:o.mimeTypes})}}};P_e=I([m(0,X),m(1,lt),m(2,cp)],P_e);var W4o={type:"object",additionalProperties:!1,required:["viewType","mimeTypes"],properties:{viewType:{type:"string",description:d(7094,null)},mimeTypes:{type:"array",description:d(7093,null),items:{type:"string"}}}},V4o=Rn.registerExtensionPoint({extensionPoint:"chatOutputRenderers",activationEventsGenerator:function*(a){for(let i of a)yield`onChatOutputRenderer:${i.viewType}`},jsonSchema:{description:d(7095,null),type:"array",items:W4o}});var N_e=class extends x{constructor(e,t,o){super();this._mainThreadWebview=t;this._rendererService=o;this._webviewHandlePool=0;this.registeredRenderers=new Map;this._proxy=e.getProxy(to.ExtHostChatOutputRenderer)}dispose(){super.dispose(),this.registeredRenderers.forEach(e=>e.dispose()),this.registeredRenderers.clear()}$registerChatOutputRenderer(e,t,o){this._rendererService.registerRenderer(e,{renderOutputPart:async(n,r,s,l)=>{let c=`chat-output-${++this._webviewHandlePool}`;return this._mainThreadWebview.addWebview(c,s,{serializeBuffersForPostMessage:!0}),this._proxy.$renderChatOutput(e,n,qe.wrap(r),c,l)}},{extension:{id:t,location:A.revive(o)}})}$unregisterChatOutputRenderer(e){this.registeredRenderers.get(e)?.dispose()}};N_e=I([m(2,A_e)],N_e);var tAt=class extends x{constructor(i,e){super();let t=this._register(e.createInstance(oJ,i));i.set(qi.MainThreadWebviews,t);let o=this._register(e.createInstance(L_e,i,t));i.set(qi.MainThreadWebviewPanels,o);let n=this._register(e.createInstance(D_e,i,t,o));i.set(qi.MainThreadCustomEditors,n);let r=this._register(e.createInstance(M_e,i,t));i.set(qi.MainThreadWebviewViews,r);let s=this._register(e.createInstance(N_e,i,t));i.set(qi.MainThreadChatOutputRenderer,s)}};tAt=I([AR,m(1,F)],tAt);function B4o(a){return typeof a=="object"&&"uri"in a&&"pattern"in a}var kS=class{constructor(i,e,t,o,n,r){this.configurationService=i;this.workspaceContextService=e;this.editorGroupsService=t;this.logService=o;this.pathService=n;this.uriIdentityService=r}aiText(i,e,t={}){return{...this.commonQuery(e?.map(wY),t),type:3,contentPattern:i}}text(i,e,t={}){i=this.getContentPattern(i,t);let o=this.configurationService.getValue(),n=e&&e.some(s=>!this.configurationService.getValue({resource:s}).search.useRipgrep);return{...this.commonQuery(e?.map(wY),t),type:2,contentPattern:i,previewOptions:t.previewOptions,maxFileSize:t.maxFileSize,usePCRE2:o.search.usePCRE2||n||!1,surroundingContext:t.surroundingContext,userDisabledExcludesAndIgnoreFiles:t.disregardExcludeSettings&&t.disregardIgnoreFiles}}getContentPattern(i,e){let t=this.configurationService.getValue();i.isRegExp&&(i.pattern=i.pattern.replace(/\r?\n/g,"\\n"));let o={...i,wordSeparators:t.editor.wordSeparators};return this.isCaseSensitive(i,e)&&(o.isCaseSensitive=!0),this.isMultiline(i)&&(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(i,e={}){return{...this.commonQuery(i,e),type:1,filePattern:e.filePattern?e.filePattern.trim():e.filePattern,exists:e.exists,sortByScore:e.sortByScore,cacheKey:e.cacheKey,shouldGlobMatchFilePattern:e.shouldGlobSearch}}handleIncludeExclude(i,e){if(!i)return{};if(Array.isArray(i)){if(i=i.filter(t=>t.length>0).map(iAt),!i.length)return{}}else i=iAt(i);return e?this.parseSearchPaths(i):{pattern:Hvi(...Array.isArray(i)?i:[i])}}commonQuery(i=[],e={}){let t=Array.isArray(e.excludePattern)?e.excludePattern.map(u=>u.pattern).flat():e.excludePattern;t=t?.length===1?t[0]:t;let o=this.handleIncludeExclude(e.includePattern,e.expandPatterns),n=this.handleIncludeExclude(t,e.expandPatterns),r=i.length>1,s=(o.searchPaths&&o.searchPaths.length?o.searchPaths.map(u=>this.getFolderQueryForSearchPath(u,e,n)):i.map(u=>this.getFolderQueryForRoot(u,e,n,r))).filter(u=>!!u),l={_reason:e._reason,folderQueries:s,usingSearchPaths:!!(o.searchPaths&&o.searchPaths.length),extraFileResources:e.extraFileResources,excludePattern:n.pattern,includePattern:o.pattern,ignoreGlobCase:e.ignoreGlobCase,onlyOpenEditors:e.onlyOpenEditors,maxResults:e.maxResults,onlyFileScheme:e.onlyFileScheme};if(e.onlyOpenEditors){let u=di(this.editorGroupsService.groups.flatMap(g=>g.editors.map(f=>f.resource)));this.logService.trace("QueryBuilder#commonQuery - openEditor URIs",JSON.stringify(u));let p=u.filter(g=>zue(l,g.fsPath)),h=this.commonQueryFromFileList(p);return this.logService.trace("QueryBuilder#commonQuery - openEditor Query",JSON.stringify(h)),{...l,...h}}let c=e.extraFileResources&&e.extraFileResources.filter(u=>zue(l,u.fsPath));return l.extraFileResources=c&&c.length?c:void 0,l}commonQueryFromFileList(i){let e=[],t=new gt,o={},n=!1;return i.forEach(r=>{if(r.scheme===Q.walkThrough)return;if(jht(r)){let l=this.workspaceContextService.getWorkspaceFolder(r)?.uri??this.uriIdentityService.extUri.dirname(r),c=t.get(l);c||(n=!0,c={folder:l,includePattern:{}},e.push(c),t.set(l,c));let u=dP(l.fsPath,r.fsPath);Ci(c.includePattern)[zvi(u.replace(/\\/g,"/"))]=!0}else r.fsPath&&(n=!0,o[zvi(r.fsPath)]=!0)}),{folderQueries:e,includePattern:o,usingSearchPaths:!0,excludePattern:n?void 0:{"**/*":!0}}}isCaseSensitive(i,e){if(e.isSmartCase){if(i.isRegExp){if(I$e(i.pattern,!0))return!0}else if(I$e(i.pattern))return!0}return!!i.isCaseSensitive}isMultiline(i){return i.isMultiline||i.isRegExp&&Cje(i.pattern)||i.pattern.indexOf(`
`)>=0?!0:!!i.isMultiline}parseSearchPaths(i){let e=p=>Zl(p)||/^\.\.?([\/\\]|$)/.test(p),o=(Array.isArray(i)?i:U4o(i)).map(p=>{let h=this.pathService.resolvedUserHome;return h?F7(p,h.scheme===Q.file?h.fsPath:h.path):p}),n=MI(o,p=>e(p)?"searchPaths":"exprSegments"),r=(n.exprSegments||[]).map(p=>dh(p,"/")).map(p=>dh(p,"\\")).map(p=>(p[0]==="."&&(p="*"+p),z4o(p))),s={},l=this.expandSearchPathPatterns(n.searchPaths||[]);l&&l.length&&(s.searchPaths=l);let c=r.flat(),u=Hvi(...c);return u&&(s.pattern=u),s}getExcludesForFolder(i,e){return e.disregardExcludeSettings?void 0:KB(i,!e.disregardSearchExcludeSettings)}expandSearchPathPatterns(i){if(!i||!i.length)return[];let e=i.flatMap(o=>{let{pathPortion:n,globPortion:r}=H4o(o);return r&&(r=Uvi(r)),this.expandOneSearchPath(n).flatMap(l=>this.resolveOneSearchPathPattern(l,r))}),t=new Map;return e.forEach(o=>{let n=o.searchPath.toString(),r=t.get(n);r?o.pattern&&(r.pattern=r.pattern||{},r.pattern[o.pattern]=!0):t.set(n,{searchPath:o.searchPath,pattern:o.pattern?Hvi(o.pattern):void 0})}),Array.from(t.values())}expandOneSearchPath(i){if(Zl(i)){let e=this.workspaceContextService.getWorkspace().folders;return e[0]&&e[0].uri.scheme!==Q.file?[{searchPath:e[0].uri.with({path:i})}]:[{searchPath:A.file(ch(i))}]}if(this.workspaceContextService.getWorkbenchState()===2){let e=this.workspaceContextService.getWorkspace().folders[0].uri;if(i=iAt(i),i.startsWith("../")||i===".."){let o=Oo.resolve(e.path,i);return[{searchPath:e.with({path:o})}]}let t=Uvi(i);return[{searchPath:e,pattern:t}]}else{if(i==="./"||i===".\\")return[];{let e=i.replace(/^\.[\/\\]/,""),o=this.workspaceContextService.getWorkspace().folders.map(n=>{let r=e.match(new RegExp(`^${ns(n.name)}(?:/(.*)|$)`));return r?{match:r,folder:n}:null}).filter(lo);if(o.length)return o.map(n=>{let r=n.match[1];return{searchPath:n.folder.uri,pattern:r&&Uvi(r)}});{let n=i.match(/\.[\/\\](.+)[\/\\]?/),r=n?n[1]:i,s=d(17946,null,r);throw new Error(s)}}}}resolveOneSearchPathPattern(i,e){let t=i.pattern&&e?`${i.pattern}/${e}`:i.pattern||e,o=[{searchPath:i.searchPath,pattern:t}];return t&&!t.endsWith("**")&&o.push({searchPath:i.searchPath,pattern:t+"/**"}),o}getFolderQueryForSearchPath(i,e,t){let o=this.getFolderQueryForRoot(wY(i.searchPath),e,t,!1);return o?{...o,includePattern:i.pattern}:null}getFolderQueryForRoot(i,e,t,o){let n,r=A.isUri(i)?i:i.uri,s=e.excludePattern?.map(g=>{let f=e.excludePattern&&B4o(g)?g.uri:void 0;return!f||!(A.isUri(i)&&this.uriIdentityService.extUri.isEqual(i,f))?f:void 0});if(s?.length||(s=[void 0]),t.searchPaths){let g=t.searchPaths.filter(f=>Qe(f.searchPath,r))[0];if(g&&!g.pattern)return null;g&&(n=g.pattern)}let l=this.configurationService.getValue({resource:r}),u={...this.getExcludesForFolder(l,e)||{},...n||{}},p=A.isUri(i)?He(i):i.name,h=s.map(g=>Object.keys(u).length>0?{folder:g,pattern:u}:void 0).filter(g=>g);return{folder:r,folderName:o?p:void 0,excludePattern:h,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}}};kS=I([m(0,B),m(1,Pe),m(2,wt),m(3,se),m(4,An),m(5,ht)],kS);function H4o(a){let i=a.match(/[\*\{\}\(\)\[\]\?]/);if(i){let e=i.index,t=a.substr(0,e).match(/[/|\\][^/\\]*$/);if(t){let o=a.substr(0,t.index);return o.match(/[/\\]/)||(o+="/"),{pathPortion:o,globPortion:a.substr((t.index||0)+1)}}}return{pathPortion:a}}function Hvi(...a){return a.length?a.reduce((i,e)=>(i[e]=!0,i),Object.create(null)):void 0}function U4o(a){return ER(a,",").map(i=>i.trim()).filter(i=>!!i.length)}function z4o(a){return[`**/${a}/**`,`**/${a}`].map(e=>e.replace(/\*\*\/\*\*/g,"**"))}function iAt(a){return a.replace(/\\/g,"/")}function Uvi(a){return iAt(a).replace(/^\.\//,"").replace(/\/+$/g,"")}function zvi(a){return a.replace(/([?*[\]])/g,"[$1]")}function pro(a,i){a=zo(a,o=>o.toString());let e=[],t=i.getWorkspace();return a&&a.forEach(o=>{let n;if(i.getWorkbenchState()===2)n=Wd(t.folders[0].uri,o),n&&n!=="."&&(n="./"+n);else{let r=i.getWorkspaceFolder(o);if(r){let s=r.name;if(t.folders.filter(c=>c.name===s).length===1){let c=Wd(r.uri,o);c===""?n=`./${r.name}`:n=`./${r.name}/${c}`}else n=o.fsPath}}n&&e.push(zvi(n))}),e}var K4o=7e3;function mro(a,i){let e=i.activationEvents;if(!e)return Promise.resolve(void 0);let t=[],o=[];for(let u of e)if(/^workspaceContains:/.test(u)){let p=u.substr(18);p.indexOf("*")>=0||p.indexOf("?")>=0||a.forceUsingSearch?o.push(p):t.push(p)}if(t.length===0&&o.length===0)return Promise.resolve(void 0);let{promise:n,resolve:r}=WI(),s=u=>r({activationEvent:u}),l=Promise.all(t.map(u=>G4o(a,u,s))).then(()=>{}),c=q4o(a,i.identifier,o,s);return Promise.all([l,c]).then(()=>{r(void 0)}),n}async function G4o(a,i,e){for(let t of a.folders)if(await a.exists(Ge(A.revive(t),i))){e(`workspaceContains:${i}`);return}}async function q4o(a,i,e,t){if(e.length===0)return Promise.resolve(void 0);let o=new Ye,n=a.checkExists(a.folders,e,o.token),r=setTimeout(async()=>{o.cancel(),a.logService.info(`Not activating extension '${i.value}': Timed out while searching for 'workspaceContains' pattern ${e.join(",")}`)},K4o),s=!1;try{s=await n}catch(l){ao(l)||mt(l)}o.dispose(),clearTimeout(r),s&&t(`workspaceContains:${e.join(",")}`)}function O_e(a,i,e,t){let o=a.get(F),n=a.get(gg),s=o.createInstance(kS).file(i.map(l=>wY(A.revive(l))),{_reason:"checkExists",includePattern:e,exists:!0});return n.fileSearch(s,t).then(l=>!!l.limitHit,l=>ao(l)?!1:Promise.reject(l))}var Db=le("workspaceEditingService");var oAt=le("canonicalUriIdentityService");var nAt=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super();this._searchService=t;this._contextService=o;this._editSessionIdentityService=n;this._canonicalUriService=r;this._editorService=s;this._workspaceEditingService=l;this._notificationService=c;this._requestService=u;this._instantiationService=p;this._labelService=h;this._environmentService=g;this._workspaceTrustManagementService=v;this._workspaceTrustRequestService=b;this._textFileService=S;this._activeCancelTokens=Object.create(null);this.registeredEditSessionProviders=this._register(new Vt);this.registeredCanonicalUriProviders=this._register(new Vt);this._queryBuilder=this._instantiationService.createInstance(kS),this._proxy=e.getProxy(to.ExtHostWorkspace);let y=this._contextService.getWorkspace();y.configuration&&!Vr&&!f.hasProvider(y.configuration)?this._proxy.$initializeWorkspace(this.getWorkspaceData(y),this.isWorkspaceTrusted()):this._contextService.getCompleteWorkspace().then(w=>this._proxy.$initializeWorkspace(this.getWorkspaceData(w),this.isWorkspaceTrusted())),this._register(this._contextService.onDidChangeWorkspaceFolders(this._onDidChangeWorkspace,this)),this._register(this._contextService.onDidChangeWorkbenchState(this._onDidChangeWorkspace,this)),this._register(this._workspaceTrustManagementService.onDidChangeTrust(this._onDidGrantWorkspaceTrust,this)),this._register(this._workspaceTrustManagementService.onDidChangeTrustedFolders(this._onDidChangeWorkspaceTrustedFolders,this))}dispose(){super.dispose();for(let e in this._activeCancelTokens)this._activeCancelTokens[e].cancel()}$updateWorkspaceFolders(e,t,o,n){let r=n.map(s=>({uri:A.revive(s.uri),name:s.name}));return this._notificationService.status(this.getStatusMessage(e,r.length,o),{hideAfter:10*1e3}),this._workspaceEditingService.updateFolders(t,o,r,!0)}getStatusMessage(e,t,o){let n,r=t>0,s=o>0;return r&&!s?t===1?n=d(3358,null,e):n=d(3357,null,e,t):s&&!r?o===1?n=d(3360,null,e):n=d(3359,null,e,o):n=d(3356,null,e),n}_onDidChangeWorkspace(){this._proxy.$acceptWorkspaceData(this.getWorkspaceData(this._contextService.getWorkspace()))}getWorkspaceData(e){return this._contextService.hasWorkspaceData()?{configuration:e.configuration||void 0,isUntitled:e.configuration?dR(e.configuration,this._environmentService):!1,folders:e.folders,id:e.id,name:this._labelService.getWorkspaceLabel(e),transient:e.transient}:null}$startFileSearch(e,t,o){let n=A.revive(e),r=this._contextService.getWorkspace(),s=this._queryBuilder.file(n?[n]:r.folders,$n(t));return this._searchService.fileSearch(s,o).then(l=>l.results.map(c=>c.resource),l=>ao(l)?null:Promise.reject(l))}$startTextSearch(e,t,o,n,r){let s=A.revive(t),l=this._contextService.getWorkspace(),c=s?[s]:l.folders.map(g=>g.uri),u=this._queryBuilder.text(e,c,$n(o));u._reason="startTextSearch";let p=g=>{g.results&&this._proxy.$handleTextSearchResult(g,n)};return this._searchService.textSearch(u,r,p).then(g=>({limitHit:g.limitHit}),g=>ao(g)?null:Promise.reject(g))}$checkExists(e,t,o){return this._instantiationService.invokeFunction(n=>O_e(n,e,t,o))}async $save(e,t){let o=A.revive(e),n=[...this._editorService.findEditors(o,{supportSideBySide:1})],r=await this._editorService.save(n,{reason:1,saveAs:t.saveAs,force:!t.saveAs});return this._saveResultToUris(r).at(0)}_saveResultToUris(e){return e.success?di(e.editors.map(t=>po.getCanonicalUri(t,{supportSideBySide:1}))):[]}$saveAll(e){return this._editorService.saveAll({includeUntitled:e}).then(t=>t.success)}$resolveProxy(e){return this._requestService.resolveProxy(e)}$lookupAuthorization(e){return this._requestService.lookupAuthorization(e)}$lookupKerberosAuthorization(e){return this._requestService.lookupKerberosAuthorization(e)}$loadCertificates(){return this._requestService.loadCertificates()}$requestResourceTrust(e){let t={...e,uri:A.revive(e.uri)};return this._workspaceTrustRequestService.requestResourcesTrust(t)}$requestWorkspaceTrust(e){return this._workspaceTrustRequestService.requestWorkspaceTrust(e)}async $isResourceTrusted(e){let t=A.revive(e);return(await this._workspaceTrustManagementService.getUriTrustInfo(t)).trusted}isWorkspaceTrusted(){return this._workspaceTrustManagementService.isWorkspaceTrusted()}_onDidGrantWorkspaceTrust(){this._proxy.$onDidGrantWorkspaceTrust()}_onDidChangeWorkspaceTrustedFolders(){this._proxy.$onDidChangeWorkspaceTrustedFolders()}$registerEditSessionIdentityProvider(e,t){let o=this._editSessionIdentityService.registerEditSessionIdentityProvider({scheme:t,getEditSessionIdentifier:async(n,r)=>this._proxy.$getEditSessionIdentifier(n.uri,r),provideEditSessionIdentityMatch:async(n,r,s,l)=>this._proxy.$provideEditSessionIdentityMatch(n.uri,r,s,l)});this.registeredEditSessionProviders.set(e,o)}$unregisterEditSessionIdentityProvider(e){this.registeredEditSessionProviders.deleteAndDispose(e)}$registerCanonicalUriProvider(e,t){let o=this._canonicalUriService.registerCanonicalUriProvider({scheme:t,provideCanonicalUri:async(n,r,s)=>{let l=await this._proxy.$provideCanonicalUri(n,r,s);return l&&A.revive(l)}});this.registeredCanonicalUriProviders.set(e,o)}$unregisterCanonicalUriProvider(e){this.registeredCanonicalUriProviders.deleteAndDispose(e)}$resolveDecoding(e,t){return this._textFileService.resolveDecoding(A.revive(e),t)}$validateDetectedEncoding(e,t,o){return this._textFileService.validateDetectedEncoding(A.revive(e),t,o)}$resolveEncoding(e,t){return this._textFileService.resolveEncoding(A.revive(e),t)}};nAt=I([fo(qi.MainThreadWorkspace),m(1,gg),m(2,Pe),m(3,s2),m(4,oAt),m(5,ee),m(6,Db),m(7,Ne),m(8,Ea),m(9,F),m(10,rt),m(11,Eo),m(12,fe),m(13,Nr),m(14,Vu),m(15,Uo)],nAt);var F_e=class{constructor(i){this.menuService=i}getCommentThreadTitleActions(i){return this.getMenu(D.CommentThreadTitle,i)}getCommentThreadActions(i){return this.getMenu(D.CommentThreadActions,i)}getCommentEditorActions(i){return this.getMenu(D.CommentEditorActions,i)}getCommentThreadAdditionalActions(i){return this.getMenu(D.CommentThreadAdditionalActions,i,{emitEventsForSubmenuChanges:!0})}getCommentTitleActions(i,e){return this.getMenu(D.CommentTitle,e)}getCommentActions(i,e){return this.getMenu(D.CommentActions,e)}getCommentThreadTitleContextActions(i){return this.getActions(D.CommentThreadTitleContext,i,{shouldForwardArgs:!0})}getMenu(i,e,t){return this.menuService.createMenu(i,e,t)}getActions(i,e,t){return this.menuService.getMenuActions(i,e,t).map(o=>o[1]).flat()}dispose(){}};F_e=I([m(0,Kt)],F_e);var d2="comments";var _c;(h=>(h.activeCursorHasCommentingRange=new Y("activeCursorHasCommentingRange",!1,{description:d(9197,null),type:"boolean"}),h.activeCursorHasComment=new Y("activeCursorHasComment",!1,{description:d(9195,null),type:"boolean"}),h.activeEditorHasCommentingRange=new Y("activeEditorHasCommentingRange",!1,{description:d(9194,null),type:"boolean"}),h.WorkspaceHasCommenting=new Y("workspaceHasCommenting",!1,{description:d(9196,null),type:"boolean"}),h.commentThreadIsEmpty=new Y("commentThreadIsEmpty",!1,{type:"boolean",description:d(9192,null)}),h.commentIsEmpty=new Y("commentIsEmpty",!1,{type:"boolean",description:d(9190,null)}),h.commentContext=new Y("comment",void 0,{type:"string",description:d(9186,null)}),h.commentThreadContext=new Y("commentThread",void 0,{type:"string",description:d(9191,null)}),h.commentControllerContext=new Y("commentController",void 0,{type:"string",description:d(9187,null)}),h.commentFocused=new Y("commentFocused",!1,{type:"boolean",description:d(9188,null)}),h.commentWidgetVisible=new Y("commentWidgetVisible",!1,{type:"boolean",description:d(9193,null)}),h.commentingEnabled=new Y("commentingEnabled",!0,{description:d(9189,null),type:"boolean"})))(_c||={});var fT=class{constructor(i,e,t,o,n){this.uniqueOwner=i;this.owner=e;this.resource=t;this.comment=o;this.thread=n;this.isRoot=!1;this.replies=[];this.threadId=n.threadId,this.range=n.range,this.threadState=n.state,this.threadRelevance=n.applicability,this.contextValue=n.contextValue,this.controllerHandle=n.controllerHandle,this.threadHandle=n.commentThreadHandle}hasReply(){return this.replies&&this.replies.length!==0}get lastUpdatedAt(){if(this._lastUpdatedAt===void 0){let i=this.comment.timestamp||"";if(this.replies.length){let t=this.replies[this.replies.length-1].lastUpdatedAt;t>i&&(i=t)}this._lastUpdatedAt=i}return this._lastUpdatedAt}},Uw=class a{constructor(i,e,t,o){this.uniqueOwner=i,this.owner=e,this.id=t.toString(),this.resource=t,this.commentThreads=o.filter(n=>n.comments&&n.comments.length).map(n=>a.createCommentNode(i,e,t,n))}static createCommentNode(i,e,t,o){let{comments:n}=o,r=n.map(s=>new fT(i,e,t,s,o));return r.length>1&&(r[0].replies=r.slice(1,r.length)),r[0].isRoot=!0,r[0]}get lastUpdatedAt(){if(this._lastUpdatedAt===void 0){let i="";if(!this.commentThreads.length)return i;for(let e of this.commentThreads){let t=e.lastUpdatedAt;t&&t>i&&(i=t)}this._lastUpdatedAt=i}return this._lastUpdatedAt}};function fYe(a){return!!a.comments&&!!a.comments.length&&a.comments.some(i=>Ar(i.body)?i.body.value.length>0:i.body.length>0)}var u2=class a extends x{get resourceCommentThreads(){return this._resourceCommentThreads}constructor(){super(),this._resourceCommentThreads=[],this.commentThreadsMap=new Map}updateResourceCommentThreads(){let i=this.commentThreadsMap.size>1;this._resourceCommentThreads=[...this.commentThreadsMap.values()].map(e=>e.resourceWithCommentThreads.map(t=>(t.ownerLabel=i?e.ownerLabel:void 0,t)).flat()).flat()}setCommentThreads(i,e,t,o){this.commentThreadsMap.set(i,{ownerLabel:t,resourceWithCommentThreads:this.groupByResource(i,e,o)}),this.updateResourceCommentThreads()}deleteCommentsByOwner(i){if(i){let e=this.commentThreadsMap.get(i);this.commentThreadsMap.set(i,{ownerLabel:e?.ownerLabel,resourceWithCommentThreads:[]})}else this.commentThreadsMap.clear();this.updateResourceCommentThreads()}updateCommentThreads(i){let{uniqueOwner:e,owner:t,ownerLabel:o,removed:n,changed:r,added:s}=i,l=this.commentThreadsMap.get(e)?.resourceWithCommentThreads||[];return n.forEach(c=>{let u=l.findIndex(g=>g.id===c.resource),p=u>=0?l[u]:void 0,h=p?.commentThreads.findIndex(g=>g.threadId===c.threadId)??0;h>=0&&p?.commentThreads.splice(h,1),p?.commentThreads.length===0&&l.splice(u,1)}),r.forEach(c=>{let u=l.findIndex(g=>g.id===c.resource),p=u>=0?l[u]:void 0;if(!p)return;let h=p.commentThreads.findIndex(g=>g.threadId===c.threadId);h>=0?p.commentThreads[h]=Uw.createCommentNode(e,t,A.parse(p.id),c):c.comments&&c.comments.length&&p.commentThreads.push(Uw.createCommentNode(e,t,A.parse(p.id),c))}),s.forEach(c=>{let u=l.filter(p=>p.resource.toString()===c.resource);if(u.length){let p=u[0];c.comments&&c.comments.length&&p.commentThreads.push(Uw.createCommentNode(e,t,p.resource,c))}else l.push(new Uw(e,t,A.parse(c.resource),[c]))}),this.commentThreadsMap.set(e,{ownerLabel:o,resourceWithCommentThreads:l}),this.updateResourceCommentThreads(),n.length>0||r.length>0||s.length>0}hasCommentThreads(){return!!this._resourceCommentThreads.length&&this._resourceCommentThreads.some(i=>i.commentThreads.length>0&&i.commentThreads.some(e=>fYe(e.thread)))}getMessage(){return this._resourceCommentThreads.length?"":d(9129,null)}groupByResource(i,e,t){let o=[],n=new Map;for(let r of Jg(t,a._compareURIs))n.set(r[0].resource,new Uw(i,e,A.parse(r[0].resource),r));return n.forEach((r,s,l)=>{o.push(r)}),o}static _compareURIs(i,e){let t=i.resource.toString(),o=e.resource.toString();return t<o?-1:t>o?1:0}};var Om=le("commentService"),Kvi="comments.continueOnComments",W_e=class extends x{constructor(e,t,o,n,r,s,l){super();this.instantiationService=e;this.layoutService=t;this.configurationService=o;this.storageService=r;this.logService=s;this.modelService=l;this._onDidSetDataProvider=this._register(new E);this.onDidSetDataProvider=this._onDidSetDataProvider.event;this._onDidDeleteDataProvider=this._register(new E);this.onDidDeleteDataProvider=this._onDidDeleteDataProvider.event;this._onDidSetResourceCommentInfos=this._register(new E);this.onDidSetResourceCommentInfos=this._onDidSetResourceCommentInfos.event;this._onDidSetAllCommentThreads=this._register(new E);this.onDidSetAllCommentThreads=this._onDidSetAllCommentThreads.event;this._onDidUpdateCommentThreads=this._register(new E);this.onDidUpdateCommentThreads=this._onDidUpdateCommentThreads.event;this._onDidUpdateNotebookCommentThreads=this._register(new E);this.onDidUpdateNotebookCommentThreads=this._onDidUpdateNotebookCommentThreads.event;this._onDidUpdateCommentingRanges=this._register(new E);this.onDidUpdateCommentingRanges=this._onDidUpdateCommentingRanges.event;this._onDidChangeActiveEditingCommentThread=this._register(new E);this.onDidChangeActiveEditingCommentThread=this._onDidChangeActiveEditingCommentThread.event;this._onDidChangeCurrentCommentThread=this._register(new E);this.onDidChangeCurrentCommentThread=this._onDidChangeCurrentCommentThread.event;this._onDidChangeCommentingEnabled=this._register(new E);this.onDidChangeCommentingEnabled=this._onDidChangeCommentingEnabled.event;this._onResourceHasCommentingRanges=this._register(new E);this.onResourceHasCommentingRanges=this._onResourceHasCommentingRanges.event;this._onDidChangeActiveCommentingRange=this._register(new E);this.onDidChangeActiveCommentingRange=this._onDidChangeActiveCommentingRange.event;this._commentControls=new Map;this._commentMenus=new Map;this._isCommentingEnabled=!0;this._continueOnComments=new Map;this._continueOnCommentProviders=new Set;this._commentsModel=this._register(new u2);this.commentsModel=this._commentsModel;this._commentingRangeResources=new Set;this._commentingRangeResourceHintSchemes=new Set;this._handleConfiguration(),this._handleZenMode(),this._workspaceHasCommenting=_c.WorkspaceHasCommenting.bindTo(n),this._commentingEnabled=_c.commentingEnabled.bindTo(n);let c=this._register(new N),u=U.debounce(this.storageService.onDidChangeValue(1,Kvi,c),(p,h)=>p?.external?p:h,500);c.add(u(p=>{if(!p.external)return;let h=this.storageService.getObject(Kvi,1);if(!h)return;this.logService.debug(`Comments: URIs of continue on comments from storage ${h.map(f=>f.uri.toString()).join(", ")}.`);let g=this._addContinueOnComments(h,this._continueOnComments);for(let f of g){let v=this._commentControls.get(f);if(!v)continue;let b={uniqueOwner:f,owner:v.owner,ownerLabel:v.label,pending:this._continueOnComments.get(f)||[],added:[],removed:[],changed:[]};this.updateModelThreads(b)}})),this._register(r.onWillSaveState(()=>{let p=new Map;for(let h of this._continueOnCommentProviders){let g=h.provideContinueOnComments();this._addContinueOnComments(g,p)}this._saveContinueOnComments(p)})),this._register(this.modelService.onModelAdded(p=>{p.uri.scheme!==Q.vscodeSourceControl&&(this._commentingRangeResources.has(p.uri.toString())||this.getDocumentComments(p.uri))}))}_updateResourcesWithCommentingRanges(e,t){let o=!1;for(let n of t)n&&(n.commentingRanges.ranges.length>0||n.threads.length>0)&&(this._commentingRangeResources.add(e.toString()),o=!0);o&&this._onResourceHasCommentingRanges.fire()}_handleConfiguration(){this._isCommentingEnabled=this._defaultCommentingEnablement,this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration("comments.visible")&&this.enableCommenting(this._defaultCommentingEnablement)}))}_handleZenMode(){let e=this._isCommentingEnabled;this._register(this.layoutService.onDidChangeZenMode(t=>{t?(e=this._isCommentingEnabled,this.enableCommenting(!1)):this.enableCommenting(e)}))}get _defaultCommentingEnablement(){return!!this.configurationService.getValue(d2)?.visible}get isCommentingEnabled(){return this._isCommentingEnabled}enableCommenting(e){e!==this._isCommentingEnabled&&(this._isCommentingEnabled=e,this._commentingEnabled.set(e),this._onDidChangeCommentingEnabled.fire(e))}setCurrentCommentThread(e){this._onDidChangeCurrentCommentThread.fire(e)}setActiveEditingCommentThread(e){this._onDidChangeActiveEditingCommentThread.fire(e)}get lastActiveCommentcontroller(){return this._lastActiveCommentController}async setActiveCommentAndThread(e,t){let o=this._commentControls.get(e);if(o)return o!==this._lastActiveCommentController&&await this._lastActiveCommentController?.setActiveCommentAndThread(void 0),this._lastActiveCommentController=o,o.setActiveCommentAndThread(t)}setDocumentComments(e,t){this._onDidSetResourceCommentInfos.fire({resource:e,commentInfos:t})}setModelThreads(e,t,o,n){this._commentsModel.setCommentThreads(e,t,o,n),this._onDidSetAllCommentThreads.fire({ownerId:e,ownerLabel:o,commentThreads:n})}updateModelThreads(e){this._commentsModel.updateCommentThreads(e),this._onDidUpdateCommentThreads.fire(e)}setWorkspaceComments(e,t){t.length&&this._workspaceHasCommenting.set(!0);let o=this._commentControls.get(e);o&&this.setModelThreads(e,o.owner,o.label,t)}removeWorkspaceComments(e){let t=this._commentControls.get(e);t&&this.setModelThreads(e,t.owner,t.label,[])}registerCommentController(e,t){this._commentControls.set(e,t),this._onDidSetDataProvider.fire()}unregisterCommentController(e){e?this._commentControls.delete(e):this._commentControls.clear(),this._commentsModel.deleteCommentsByOwner(e),this._onDidDeleteDataProvider.fire(e)}getCommentController(e){return this._commentControls.get(e)}async createCommentThreadTemplate(e,t,o,n){let r=this._commentControls.get(e);if(r)return r.createCommentThreadTemplate(t,o,n)}async updateCommentThreadTemplate(e,t,o){let n=this._commentControls.get(e);n&&await n.updateCommentThreadTemplate(t,o)}disposeCommentThread(e,t){this.getCommentController(e)?.deleteCommentThreadMain(t)}getCommentMenus(e){if(this._commentMenus.get(e))return this._commentMenus.get(e);let t=this.instantiationService.createInstance(F_e);return this._commentMenus.set(e,t),t}updateComments(e,t){let o=this._commentControls.get(e);if(o){let n=Object.assign({},t,{uniqueOwner:e,ownerLabel:o.label,owner:o.owner});this.updateModelThreads(n)}}updateNotebookComments(e,t){let o=Object.assign({},t,{uniqueOwner:e});this._onDidUpdateNotebookCommentThreads.fire(o)}updateCommentingRanges(e,t){if(t?.schemes&&t.schemes.length>0)for(let o of t.schemes)this._commentingRangeResourceHintSchemes.add(o);this._workspaceHasCommenting.set(!0),this._onDidUpdateCommentingRanges.fire({uniqueOwner:e})}async toggleReaction(e,t,o,n,r){let s=this._commentControls.get(e);if(s)return s.toggleReaction(t,o,n,r,Se.None);throw new Error("Not supported")}hasReactionHandler(e){let t=this._commentControls.get(e);return t?!!t.features.reactionHandler:!1}async getDocumentComments(e){let t=[];for(let n of this._commentControls.values())t.push(n.getDocumentComments(e,Se.None).then(r=>{for(let l of r.threads)l.comments?.length===0&&l.range&&this.removeContinueOnComment({range:l.range,uri:e,uniqueOwner:r.uniqueOwner});let s=this._continueOnComments.get(r.uniqueOwner);return r.pendingCommentThreads=s?.filter(l=>l.uri.toString()===e.toString()),r}).catch(r=>null));let o=await Promise.all(t);return this._updateResourcesWithCommentingRanges(e,o),o}async getNotebookComments(e){let t=[];return this._commentControls.forEach(o=>{t.push(o.getNotebookComments(e,Se.None).catch(n=>null))}),Promise.all(t)}registerContinueOnCommentProvider(e){return this._continueOnCommentProviders.add(e),{dispose:()=>{this._continueOnCommentProviders.delete(e)}}}_saveContinueOnComments(e){let t=[];for(let o of e.values())t.push(...o);this.logService.debug(`Comments: URIs of continue on comments to add to storage ${t.map(o=>o.uri.toString()).join(", ")}.`),this.storageService.store(Kvi,t,1,0)}removeContinueOnComment(e){let t=this._continueOnComments.get(e.uniqueOwner);if(t){let o=t.findIndex(n=>n.uri.toString()===e.uri.toString()&&z.equalsRange(n.range,e.range)&&(e.isReply===void 0||n.isReply===e.isReply));if(o>-1)return t.splice(o,1)[0]}}_addContinueOnComments(e,t){let o=new Set;for(let n of e)if(!t.has(n.uniqueOwner))t.set(n.uniqueOwner,[n]),o.add(n.uniqueOwner);else{let r=t.get(n.uniqueOwner);r.every(s=>s.uri.toString()!==n.uri.toString()||!z.equalsRange(s.range,n.range))&&(r.push(n),o.add(n.uniqueOwner))}return o}resourceHasCommentingRanges(e){return this._commentingRangeResourceHintSchemes.has(e.scheme)||this._commentingRangeResources.has(e.toString())}};W_e=I([m(0,F),m(1,yi),m(2,B),m(3,X),m(4,ce),m(5,se),m(6,Tt)],W_e);function p2(a){if(a?.resource)return A.isUri(a.resource)?a.resource:a.resource.primary}var qB={onDidChangeVisibility:U.None},Nl=class extends x{constructor(e,t,o,n,r,s,l,c,u,p){super();this.instantiationService=t;this.configurationService=o;this.modelService=n;this.workspaceService=r;this.languageService=s;this.decorationsService=l;this.themeService=c;this.labelService=u;this.textFileService=p;this._onDidChangeDecorations=this._register(new E);this.widgets=[];this.labels=[];this.registerListeners(e)}get onDidChangeDecorations(){return this._onDidChangeDecorations.event}registerListeners(e){this._register(e.onDidChangeVisibility(t=>{this.widgets.forEach(o=>o.notifyVisibilityChanged(t))})),this._register(this.languageService.onDidChange(()=>this.widgets.forEach(t=>t.notifyExtensionsRegistered()))),this._register(this.modelService.onModelLanguageChanged(t=>{t.model.uri&&this.widgets.forEach(o=>o.notifyModelLanguageChanged(t.model))})),this._register(this.modelService.onModelAdded(t=>{t.uri&&this.widgets.forEach(o=>o.notifyModelAdded(t))})),this._register(this.workspaceService.onDidChangeWorkspaceFolders(()=>{this.widgets.forEach(t=>t.notifyWorkspaceFoldersChange())})),this._register(this.decorationsService.onDidChangeDecorations(t=>{let o=!1;this.widgets.forEach(n=>{n.notifyFileDecorationsChanges(t)&&(o=!0)}),o&&this._onDidChangeDecorations.fire()})),this._register(this.themeService.onDidColorThemeChange(()=>this.widgets.forEach(t=>t.notifyThemeChange()))),this._register(this.configurationService.onDidChangeConfiguration(t=>{t.affectsConfiguration(yj)&&this.widgets.forEach(o=>o.notifyFileAssociationsChange())})),this._register(this.labelService.onDidChangeFormatters(t=>{this.widgets.forEach(o=>o.notifyFormattersChange(t.scheme))})),this._register(this.textFileService.untitled.onDidChangeLabel(t=>{this.widgets.forEach(o=>o.notifyUntitledLabelChange(t.resource))}))}get(e){return this.labels[e]}create(e,t){let o=this.instantiationService.createInstance(vYe,e,t),n={element:o.element,get onDidRender(){return o.onDidRender},setLabel:(r,s,l)=>o.setLabel(r,s,l),setResource:(r,s)=>o.setResource(r,s),setFile:(r,s)=>o.setFile(r,s),clear:()=>o.clear(),dispose:()=>this.disposeWidget(o)};return this.labels.push(n),this.widgets.push(o),n}disposeWidget(e){let t=this.widgets.indexOf(e);t>-1&&(this.widgets.splice(t,1),this.labels.splice(t,1)),Be(e)}clear(){this.widgets=Be(this.widgets),this.labels=[]}dispose(){super.dispose(),this.clear()}};Nl=I([m(1,F),m(2,B),m(3,Tt),m(4,Pe),m(5,_t),m(6,Ov),m(7,Le),m(8,rt),m(9,Uo)],Nl);var Tk=class extends Nl{get element(){return this.label}constructor(i,e,t,o,n,r,s,l,c,u,p){super(qB,t,o,n,r,s,l,c,u,p),this.label=this._register(this.create(i,e))}};Tk=I([m(2,F),m(3,B),m(4,Tt),m(5,Pe),m(6,_t),m(7,Ov),m(8,Le),m(9,rt),m(10,Uo)],Tk);var vYe=class extends Bc{constructor(e,t,o,n,r,s,l,c,u){super(e,t);this.languageService=o;this.modelService=n;this.decorationsService=r;this.labelService=s;this.textFileService=l;this.contextService=c;this.notebookDocumentService=u;this._onDidRender=this._register(new E);this.label=void 0;this.decoration=this._register(new me);this.options=void 0;this.computedIconClasses=void 0;this.computedLanguageId=void 0;this.computedPathLabel=void 0;this.computedWorkspaceFolderLabel=void 0;this.needsRedraw=void 0;this.isHidden=!1}get onDidRender(){return this._onDidRender.event}notifyVisibilityChanged(e){e===this.isHidden&&(this.isHidden=!e,e&&this.needsRedraw&&(this.render({updateIcon:this.needsRedraw===2,updateDecoration:this.needsRedraw===2}),this.needsRedraw=void 0))}notifyModelLanguageChanged(e){this.handleModelEvent(e)}notifyModelAdded(e){this.handleModelEvent(e)}handleModelEvent(e){let t=p2(this.label);t&&Qe(e.uri,t)&&this.computedLanguageId!==e.getLanguageId()&&(this.computedLanguageId=e.getLanguageId(),this.render({updateIcon:!0,updateDecoration:!1}))}notifyFileDecorationsChanges(e){if(!this.options)return!1;let t=p2(this.label);return t&&this.options.fileDecorations&&e.affectsResource(t)?this.render({updateIcon:!1,updateDecoration:!0}):!1}notifyExtensionsRegistered(){this.render({updateIcon:!0,updateDecoration:!1})}notifyThemeChange(){this.render({updateIcon:!1,updateDecoration:!1})}notifyFileAssociationsChange(){this.render({updateIcon:!0,updateDecoration:!1})}notifyFormattersChange(e){p2(this.label)?.scheme===e&&this.render({updateIcon:!1,updateDecoration:!1})}notifyUntitledLabelChange(e){Qe(e,p2(this.label))&&this.render({updateIcon:!1,updateDecoration:!1})}notifyWorkspaceFoldersChange(){if(typeof this.computedWorkspaceFolderLabel=="string"){let e=p2(this.label);A.isUri(e)&&this.label?.name===this.computedWorkspaceFolderLabel&&this.setFile(e,this.options)}}setFile(e,t){let o=t?.hideLabel,n;if(!o){if(t?.fileKind===2){let s=this.contextService.getWorkspaceFolder(e);s&&(n=s.name,this.computedWorkspaceFolderLabel=n)}n||(n=Hp(Ga(e)))}let r;if(!t?.hidePath){let s=this.labelService.getUriLabel(ci(e),{relative:!0});s&&s!=="."&&(r=s)}this.setResource({resource:e,name:n,description:r,range:t?.range},t)}setResource(e,t=Object.create(null)){let o=p2(e),n=e?.resource&&!A.isUri(e.resource);if(!t.forceLabel&&!n&&o?.scheme===Q.untitled){let u=this.textFileService.untitled.get(o);if(u&&!u.hasAssociatedFilePath){if(typeof e.name=="string"&&(e.name=u.name),typeof e.description=="string"){let h=u.resource.path;e.name!==h?e.description=h:e.description=void 0}let p=u.resource.path;u.name!==p?t.title=`${u.name} \u2022 ${p}`:t.title=p}}if(!t.forceLabel&&!n&&o?.scheme===Q.vscodeNotebookCell){let u=this.notebookDocumentService.getNotebook(o),p=u?.getCellIndex(o);u&&p!==void 0&&typeof e.name=="string"&&(t.title=d(3787,null,e.name,`${p+1}`)),typeof e.name=="string"&&u&&p!==void 0&&typeof e.name=="string"&&(e.name=d(3787,null,e.name,`${p+1}`))}if(!t.forceLabel&&!n&&o?.scheme===Q.vscodeNotebookCellOutput){let u=this.notebookDocumentService.getNotebook(o),p=MQe(o);if(p?.cellFragment){if(!p.notebook)return;let h=p.notebook.with({scheme:Q.vscodeNotebookCell,fragment:p.cellFragment}),g=u?.getCellIndex(h),f=p.outputIndex;g!==void 0&&f!==void 0&&typeof e.name=="string"?e.name=d(3788,null,e.name,`${g+1}`,`${f+1}`):g!==void 0&&typeof e.name=="string"&&(e.name=d(3789,null,e.name,`${g+1}`))}}t.namePrefix&&(typeof e.name=="string"?e.name=t.namePrefix+e.name:Array.isArray(e.name)&&e.name.length>0&&(e.name=[t.namePrefix+e.name[0],...e.name.slice(1)])),t.nameSuffix&&(typeof e.name=="string"?e.name=e.name+t.nameSuffix:Array.isArray(e.name)&&e.name.length>0&&(e.name=[...e.name.slice(0,e.name.length-1),e.name[e.name.length-1]+t.nameSuffix]));let r=this.hasResourceChanged(e),s=r||this.hasPathLabelChanged(e),l=this.hasFileKindChanged(t),c=this.hasIconChanged(t);this.label=e,this.options=t,r&&(this.computedLanguageId=void 0),s&&(this.computedPathLabel=void 0),this.render({updateIcon:r||l||c,updateDecoration:r||l})}hasFileKindChanged(e){let t=e?.fileKind,o=this.options?.fileKind;return t!==o}hasResourceChanged(e){let t=p2(e),o=p2(this.label);return t&&o?t.toString()!==o.toString():!(!t&&!o)}hasPathLabelChanged(e){let t=p2(e);return!!t&&this.computedPathLabel!==this.labelService.getUriLabel(t)}hasIconChanged(e){return this.options?.icon!==e?.icon}clear(){this.label=void 0,this.options=void 0,this.computedLanguageId=void 0,this.computedIconClasses=void 0,this.computedPathLabel=void 0,this.setLabel("")}render(e){if(this.isHidden)return this.needsRedraw!==2&&(this.needsRedraw=e.updateIcon||e.updateDecoration?2:1),!1;if(e.updateIcon&&(this.computedIconClasses=void 0),!this.label)return!1;let t={title:"",bold:this.options?.bold,italic:this.options?.italic,strikethrough:this.options?.strikethrough,matches:this.options?.matches,descriptionMatches:this.options?.descriptionMatches,extraClasses:[],separator:this.options?.separator,domId:this.options?.domId,disabledCommand:this.options?.disabledCommand,labelEscapeNewLines:this.options?.labelEscapeNewLines,descriptionTitle:this.options?.descriptionTitle,supportIcons:this.options?.supportIcons},o=p2(this.label);if(this.options?.title!==void 0&&(t.title=this.options.title),o&&o.scheme!==Q.data&&(!this.options?.title||typeof this.options.title!="string"&&!this.options.title.markdownNotSupportedFallback)&&(this.computedPathLabel||(this.computedPathLabel=this.labelService.getUriLabel(o)),!t.title||typeof t.title=="string"?t.title=this.computedPathLabel:t.title.markdownNotSupportedFallback||(t.title.markdownNotSupportedFallback=this.computedPathLabel)),this.options&&!this.options.hideIcon&&(this.computedIconClasses||(this.computedIconClasses=aa(this.modelService,this.languageService,o,this.options.fileKind,this.options.icon)),A.isUri(this.options.icon)&&(t.iconPath=this.options.icon),t.extraClasses=this.computedIconClasses.slice(0)),this.options?.extraClasses&&t.extraClasses.push(...this.options.extraClasses),this.options?.fileDecorations&&o){e.updateDecoration&&(this.decoration.value=this.decorationsService.getDecoration(o,this.options.fileKind!==0));let n=this.decoration.value;if(n){if(n.tooltip){if(typeof t.title=="string")t.title=`${t.title} \u2022 ${n.tooltip}`;else if(typeof t.title?.markdown=="string"){let r=`${t.title.markdown} \u2022 ${n.tooltip}`;t.title={markdown:r,markdownNotSupportedFallback:r}}}n.strikethrough&&(t.strikethrough=!0),this.options.fileDecorations.colors&&t.extraClasses.push(n.labelClassName),this.options.fileDecorations.badges&&(t.extraClasses.push(n.badgeClassName),t.extraClasses.push(n.iconClassName))}}return this.label.range&&(t.suffix=this.label.range.startLineNumber!==this.label.range.endLineNumber?`:${this.label.range.startLineNumber}-${this.label.range.endLineNumber}`:`:${this.label.range.startLineNumber}`),this.setLabel(this.label.name??"",this.label.description,t),this._onDidRender.fire(),!0}dispose(){super.dispose(),this.label=void 0,this.options=void 0,this.computedLanguageId=void 0,this.computedIconClasses=void 0,this.computedPathLabel=void 0,this.computedWorkspaceFolderLabel=void 0}};vYe=I([m(2,_t),m(3,Tt),m(4,Ov),m(5,rt),m(6,Uo),m(7,Pe),m(8,U5)],vYe);var jue=class extends x{constructor(e,t,o,n){super();this.configurationService=e;this._date=M(o,_("span.timestamp")),this._date.style.display="none",this._useRelativeTime=this.useRelativeTimeSetting,this.hover=this._register(t.setupManagedHover(Ri("mouse"),this._date,"")),this.setTimestamp(n)}get useRelativeTimeSetting(){return this.configurationService.getValue(d2).useRelativeTime}async setTimestamp(e){(e!==this._timestamp||this.useRelativeTimeSetting!==this._useRelativeTime)&&this.updateDate(e),this._timestamp=e,this._useRelativeTime=this.useRelativeTimeSetting}updateDate(e){if(!e)this._date.textContent="",this._date.style.display="none";else if(e!==this._timestamp||this.useRelativeTimeSetting!==this._useRelativeTime){this._date.style.display="";let t,o;this.useRelativeTimeSetting?(t=this.getRelative(e),o=this.getDateString(e)):t=this.getDateString(e),this._date.textContent=t,this.hover.update(o??"")}}getRelative(e){return ea(e,!0,!0)}getDateString(e){return e.toLocaleString(wr)}};var Gvi=te("commentsView.resolvedIcon",{dark:Iti,light:Iti,hcDark:bi,hcLight:bi},d(9059,null)),qvi=te("commentsView.unresolvedIcon",{dark:Kje,light:Kje,hcDark:bi,hcLight:bi},d(9061,null));te("editorCommentsWidget.replyInputBackground",JV,d(9055,null));var $4o=te("editorCommentsWidget.resolvedBorder",{dark:Gvi,light:Gvi,hcDark:bi,hcLight:bi},d(9058,null)),$vi=te("editorCommentsWidget.unresolvedBorder",{dark:qvi,light:qvi,hcDark:bi,hcLight:bi},d(9060,null)),mgl=te("editorCommentsWidget.rangeBackground",ai($vi,.1),d(9057,null)),hgl=te("editorCommentsWidget.rangeActiveBackground",ai($vi,.1),d(9056,null)),j4o=new Map([[0,$vi],[1,$4o]]),Q4o=new Map([[0,qvi],[1,Gvi]]),hro="--comment-thread-state-color",jvi="--comment-view-thread-state-color",gro="--comment-thread-state-background-color";function fro(a,i,e){let t=a!==void 0?e.get(a):void 0;return t!==void 0?i.getColor(t):void 0}function vro(a,i){return fro(a,i,j4o)}function bro(a,i){return fro(a,i,Q4o)}var $B=class{constructor(i,e,t){this.filter=i;this.showResolved=!0;this.showUnresolved=!0;i=i.trim(),this.showResolved=e,this.showUnresolved=t;let o=i.startsWith("!");this.textFilter={text:(o?fC(i,"!"):i).trim(),negate:o}}static{this._filter=bCe}static{this._messageFilter=lm}};var zu="workbench.panel.comments",Sro="Comments",SYe=L(9133,"Comments"),Qvi=class a{static{this.RESOURCE_ID="resource-with-comments"}static{this.COMMENT_ID="comment-node"}getHeight(i){return i instanceof fT&&i.hasReply()?44:22}getTemplateId(i){return i instanceof Uw?a.RESOURCE_ID:i instanceof fT?a.COMMENT_ID:""}},Yvi=class{constructor(i){this.labels=i;this.templateId="resource-with-comments"}renderTemplate(i){let e=M(i,_(".resource-container")),t=this.labels.create(e),o=M(e,_(".separator")),n=e.appendChild(_(".owner"));return{resourceLabel:t,owner:n,separator:o}}renderElement(i,e,t){t.resourceLabel.setFile(i.element.resource),t.separator.innerText="\xB7",i.element.ownerLabel?(t.owner.innerText=i.element.ownerLabel,t.separator.style.display="inline"):(t.owner.innerText="",t.separator.style.display="none")}disposeTemplate(i){i.resourceLabel.dispose()}},Yue=class{constructor(i){this.menuService=i}getResourceActions(i){return{actions:this.getActions(D.CommentsViewThreadActions,i).primary}}getResourceContextActions(i){return this.getActions(D.CommentsViewThreadActions,i).secondary}setContextKeyService(i){this.contextKeyService=i}getActions(i,e){if(!this.contextKeyService)return{primary:[],secondary:[]};let t=[["commentController",e.owner],["resourceScheme",e.resource.scheme],["commentThread",e.contextValue],["canReply",e.thread.canReply]],o=this.contextKeyService.createOverlay(t),n=this.menuService.getMenuActions(i,o,{shouldForwardArgs:!0});return zp(n,"inline")}dispose(){this.contextKeyService=void 0}};Yue=I([m(0,Kt)],Yue);var bYe=class{constructor(i,e,t,o,n){this.actionViewItemProvider=i;this.menus=e;this.configurationService=t;this.hoverService=o;this.themeService=n;this.templateId="comment-node"}renderTemplate(i){let e=M(i,_(".comment-thread-container")),t=M(e,_(".comment-metadata-container")),o=M(t,_(".comment-metadata")),n=M(o,_(".icon")),r=M(o,_(".user")),s=new jue(this.configurationService,this.hoverService,M(o,_(".timestamp-container"))),l=M(o,_(".relevance")),c=M(o,_(".separator")),u=M(o,_(".text")),p=M(o,_(".range")),h=_("p");p.appendChild(h);let g={icon:n,userNames:r,timestamp:s,relevance:l,separator:c,commentPreview:u,range:h};g.separator.innerText="\xB7";let f=M(t,_(".actions")),v=new Zi(f,{actionViewItemProvider:this.actionViewItemProvider}),b=M(e,_(".comment-snippet-container")),S={container:b,icon:M(b,_(".icon")),count:M(b,_(".count")),lastReplyDetail:M(b,_(".reply-detail")),separator:M(b,_(".separator")),timestamp:new jue(this.configurationService,this.hoverService,M(b,_(".timestamp-container")))};S.separator.innerText="\xB7",S.icon.classList.add(...q.asClassNameArray(R.indent));let y=[g.timestamp,S.timestamp];return{threadMetadata:g,repliesMetadata:S,actionBar:v,disposables:y}}getCountString(i){return i>2?d(9134,null,i-1):i===2?d(9135,null):d(9130,null)}getRenderedComment(i){let e=Gf(i,{},document.createElement("span")),t=e.element.getElementsByTagName("img");for(let n=0;n<t.length;n++){let r=t[n],s=_("");s.textContent=r.alt?d(9137,null,r.alt):d(9136,null),r.replaceWith(s)}let o=[...e.element.getElementsByTagName("h1"),...e.element.getElementsByTagName("h2"),...e.element.getElementsByTagName("h3"),...e.element.getElementsByTagName("h4"),...e.element.getElementsByTagName("h5"),...e.element.getElementsByTagName("h6")];for(let n of o){let r=document.createTextNode(n.textContent||"");n.replaceWith(r)}for(;e.element.children.length>1&&e.element.firstElementChild?.tagName==="HR";)e.element.removeChild(e.element.firstElementChild);return e}getIcon(i,e){return e?R.commentDraft:i===0?R.commentUnresolved:R.comment}renderElement(i,e,t){t.actionBar.clear();let o=i.element.replies.length+1;i.element.threadRelevance===1?(t.threadMetadata.relevance.style.display="",t.threadMetadata.relevance.innerText=d(9139,null),t.threadMetadata.separator.style.display="none"):(t.threadMetadata.relevance.innerText="",t.threadMetadata.relevance.style.display="none",t.threadMetadata.separator.style.display=""),t.threadMetadata.icon.classList.remove(...Array.from(t.threadMetadata.icon.classList.values()).filter(c=>c.startsWith("codicon")));let n=i.element.thread.comments?.some(c=>c.state===1);if(t.threadMetadata.icon.classList.add(...q.asClassNameArray(this.getIcon(i.element.threadState,n))),i.element.threadState!==void 0){let c=this.getCommentThreadWidgetStateColor(i.element.threadState,this.themeService.getColorTheme());t.threadMetadata.icon.style.setProperty(jvi,`${c}`),t.threadMetadata.icon.style.color=`var(${jvi})`}t.threadMetadata.userNames.textContent=i.element.comment.userName,t.threadMetadata.timestamp.setTimestamp(i.element.comment.timestamp?new Date(i.element.comment.timestamp):void 0);let r=i.element;if(t.threadMetadata.commentPreview.innerText="",t.threadMetadata.commentPreview.style.height="22px",typeof r.comment.body=="string")t.threadMetadata.commentPreview.innerText=r.comment.body;else{let c=new N;t.disposables.push(c);let u=this.getRenderedComment(r.comment.body);t.disposables.push(u);for(let p=u.element.children.length-1;p>=1;p--)u.element.removeChild(u.element.children[p]);t.threadMetadata.commentPreview.appendChild(u.element),t.disposables.push(this.hoverService.setupManagedHover(Ri("mouse"),t.threadMetadata.commentPreview,u.element.textContent??""))}i.element.range&&(i.element.range.startLineNumber===i.element.range.endLineNumber?t.threadMetadata.range.textContent=d(9131,null,i.element.range.startLineNumber):t.threadMetadata.range.textContent=d(9132,null,i.element.range.startLineNumber,i.element.range.endLineNumber));let s=this.menus.getResourceActions(i.element);if(t.actionBar.push(s.actions,{icon:!0,label:!1}),t.actionBar.context={commentControlHandle:i.element.controllerHandle,commentThreadHandle:i.element.threadHandle,$mid:7},!i.element.hasReply()){t.repliesMetadata.container.style.display="none";return}t.repliesMetadata.container.style.display="",t.repliesMetadata.count.textContent=this.getCountString(o);let l=i.element.replies[i.element.replies.length-1].comment;t.repliesMetadata.lastReplyDetail.textContent=d(9138,null,l.userName),t.repliesMetadata.timestamp.setTimestamp(l.timestamp?new Date(l.timestamp):void 0)}getCommentThreadWidgetStateColor(i,e){return i!==void 0?bro(i,e):void 0}disposeTemplate(i){i.disposables.forEach(e=>e.dispose()),i.actionBar.dispose()}};bYe=I([m(2,B),m(3,nt),m(4,Le)],bYe);var rAt=class{constructor(i){this.options=i}filter(i,e){return this.options.filter===""&&this.options.showResolved&&this.options.showUnresolved?1:i instanceof Uw?this.filterResourceMarkers(i):this.filterCommentNode(i,e)}filterResourceMarkers(i){if(this.options.textFilter.text&&!this.options.textFilter.negate){let e=$B._filter(this.options.textFilter.text,He(i.resource));if(e)return{visibility:!0,data:{type:0,uriMatches:e||[]}}}return 2}filterCommentNode(i,e){if(!(i.threadState===void 0||this.options.showResolved&&1===i.threadState||this.options.showUnresolved&&0===i.threadState))return!1;if(!this.options.textFilter.text)return!0;let o=$B._messageFilter(this.options.textFilter.text,typeof i.comment.body=="string"?i.comment.body:i.comment.body.value)||$B._messageFilter(this.options.textFilter.text,i.comment.userName)||i.replies.map(n=>$B._messageFilter(this.options.textFilter.text,n.comment.userName)||$B._messageFilter(this.options.textFilter.text,typeof n.comment.body=="string"?n.comment.body:n.comment.body.value)).filter(n=>!!n).flat();return o.length&&!this.options.textFilter.negate?{visibility:!0,data:{type:1,textMatches:o}}:o.length&&this.options.textFilter.negate&&e===2?!1:o.length===0&&this.options.textFilter.negate&&e===2?!0:e}},V_e=class extends Rg{constructor(e,t,o,n,r,s,l,c,u){let p=new Qvi,h=Bs.bind(void 0,s),g=s.createInstance(Yue);g.setContextKeyService(n);let f=[s.createInstance(Yvi,e),s.createInstance(bYe,h,g)];super("CommentsTree",t,p,f,{accessibilityProvider:o.accessibilityProvider,identityProvider:{getId:v=>v instanceof u2?"root":v instanceof Uw?`${v.uniqueOwner}-${v.id}`:v instanceof fT?`${v.uniqueOwner}-${v.resource.toString()}-${v.threadId}-${v.comment.uniqueIdInThread}`+(v.isRoot?"-root":""):""},expandOnlyOnTwistieClick:!0,collapseByDefault:!1,overrideStyles:o.overrideStyles,filter:o.filter,sorter:o.sorter,findWidgetEnabled:!1,multipleSelectionSupport:!1},s,n,r,l);this.contextMenuService=c;this.keybindingService=u;this.menus=g,this.disposables.add(this.onContextMenu(v=>this.commentsOnContextMenu(v)))}commentsOnContextMenu(e){let t=e.element;if(!(t instanceof fT))return;let o=e.browserEvent;o.preventDefault(),o.stopPropagation(),this.setFocus([t]);let n=this.menus.getResourceContextActions(t);n.length&&this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>n,getActionViewItem:r=>{let s=this.keybindingService.lookupKeybinding(r.id);if(s)return new hs(r,r,{label:!0,keybinding:s.getLabel()})},onHide:r=>{r&&this.domFocus()},getActionsContext:()=>({commentControlHandle:t.controllerHandle,commentThreadHandle:t.threadHandle,$mid:7,thread:t.thread})})}filterComments(){this.refilter()}getVisibleItemCount(){let e=0,t=this.getNode();for(let o of t.children)for(let n of o.children)n.visible&&o.visible&&e++;return e}};V_e=I([m(3,X),m(4,Io),m(5,F),m(6,B),m(7,Xe),m(8,_e)],V_e);var sAt=class a extends x{constructor(e){super();this.expandedSize=void 0;this._headerVisible=!0;this._collapsible=!0;this._bodyRendered=!1;this.styles={dropBackground:void 0,headerBackground:void 0,headerBorder:void 0,headerForeground:void 0,leftBorder:void 0};this.animationTimer=void 0;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._onDidChangeExpansionState=this._register(new E);this.onDidChangeExpansionState=this._onDidChangeExpansionState.event;this.orthogonalSize=0;this._expanded=typeof e.expanded>"u"?!0:!!e.expanded,this._orientation=typeof e.orientation>"u"?0:e.orientation,this._ariaHeaderLabel=this.getAriaHeaderLabel(e.title),this._minimumBodySize=typeof e.minimumBodySize=="number"?e.minimumBodySize:this._orientation===1?200:120,this._maximumBodySize=typeof e.maximumBodySize=="number"?e.maximumBodySize:Number.POSITIVE_INFINITY,this.element=_(".pane")}static{this.HEADER_SIZE=22}get ariaHeaderLabel(){return this._ariaHeaderLabel}set ariaHeaderLabel(e){this._ariaHeaderLabel=e,this.header?.setAttribute("aria-label",this.ariaHeaderLabel)}get draggableElement(){return this.header}get dropTargetElement(){return this.element}get dropBackground(){return this.styles.dropBackground}get minimumBodySize(){return this._minimumBodySize}set minimumBodySize(e){this._minimumBodySize=e,this._onDidChange.fire(void 0)}get maximumBodySize(){return this._maximumBodySize}set maximumBodySize(e){this._maximumBodySize=e,this._onDidChange.fire(void 0)}get headerSize(){return this.headerVisible?a.HEADER_SIZE:0}get minimumSize(){let e=this.headerSize,o=!this.headerVisible||this.isExpanded()?this.minimumBodySize:0;return e+o}get maximumSize(){let e=this.headerSize,o=!this.headerVisible||this.isExpanded()?this.maximumBodySize:0;return e+o}getAriaHeaderLabel(e){return d(31,null,e)}isExpanded(){return this._expanded}setExpanded(e){return!e&&!this.collapsible||this._expanded===!!e?!1:(this.element?.classList.toggle("expanded",e),this._expanded=!!e,this.updateHeader(),e?(this._bodyRendered||(this.renderBody(this.body),this._bodyRendered=!0),typeof this.animationTimer=="number"&&Re(this.element).clearTimeout(this.animationTimer),M(this.element,this.body)):this.animationTimer=Re(this.element).setTimeout(()=>{this.body.remove()},200),this._onDidChangeExpansionState.fire(e),this._onDidChange.fire(e?this.expandedSize:void 0),!0)}get headerVisible(){return this._headerVisible}set headerVisible(e){this._headerVisible!==!!e&&(this._headerVisible=!!e,this.updateHeader(),this._onDidChange.fire(void 0))}get collapsible(){return this._collapsible}set collapsible(e){this._collapsible!==!!e&&(this._collapsible=!!e,this.updateHeader())}get orientation(){return this._orientation}set orientation(e){this._orientation!==e&&(this._orientation=e,this.element&&(this.element.classList.toggle("horizontal",this.orientation===1),this.element.classList.toggle("vertical",this.orientation===0)),this.header&&this.updateHeader())}render(){this.element.classList.toggle("expanded",this.isExpanded()),this.element.classList.toggle("horizontal",this.orientation===1),this.element.classList.toggle("vertical",this.orientation===0),this.header=_(".pane-header"),M(this.element,this.header),this.header.setAttribute("tabindex","0"),this.header.setAttribute("role","button"),this.header.setAttribute("aria-label",this.ariaHeaderLabel),this.renderHeader(this.header);let e=qn(this.header);this._register(e),this._register(e.onDidFocus(()=>this.header?.classList.add("focused"),null)),this._register(e.onDidBlur(()=>this.header?.classList.remove("focused"),null)),this.updateHeader();let t=this._register(new N),o=this._register(new Gn(this.header,"keydown")),n=U.map(o.event,s=>new gi(s),t);this._register(U.filter(n,s=>s.keyCode===3||s.keyCode===10,t)(()=>this.setExpanded(!this.isExpanded()),null)),this._register(U.filter(n,s=>s.keyCode===15,t)(()=>this.setExpanded(!1),null)),this._register(U.filter(n,s=>s.keyCode===17,t)(()=>this.setExpanded(!0),null)),this._register(Ms.addTarget(this.header));let r=this.header;[re.CLICK,Kn.Tap].forEach(s=>{this._register(j(r,s,l=>{l.defaultPrevented||this.setExpanded(!this.isExpanded())}))}),this.body=M(this.element,_(".pane-body")),!this._bodyRendered&&this.isExpanded()&&(this.renderBody(this.body),this._bodyRendered=!0),this.isExpanded()||this.body.remove()}layout(e){let t=this.headerVisible?a.HEADER_SIZE:0,o=this._orientation===0?this.orthogonalSize:e,n=this._orientation===0?e-t:this.orthogonalSize-t;this.isExpanded()&&(this.body.classList.toggle("wide",o>=600),this.layoutBody(n,o),this.expandedSize=e)}style(e){this.styles=e,this.header&&this.updateHeader()}updateHeader(){if(!this.header)return;let e=!this.headerVisible||this.isExpanded();this.collapsible?(this.header.setAttribute("tabindex","0"),this.header.setAttribute("role","button")):(this.header.removeAttribute("tabindex"),this.header.removeAttribute("role")),this.header.style.lineHeight=`${this.headerSize}px`,this.header.classList.toggle("hidden",!this.headerVisible),this.header.classList.toggle("expanded",e),this.header.classList.toggle("not-collapsible",!this.collapsible),this.header.setAttribute("aria-expanded",String(e)),this.header.style.color=this.collapsible?this.styles.headerForeground??"":"",this.header.style.backgroundColor=(this.collapsible?this.styles.headerBackground:"transparent")??"",this.header.style.borderTop=this.styles.headerBorder&&this.orientation===0?`1px solid ${this.styles.headerBorder}`:"",this.element.style.borderLeft=this.styles.leftBorder&&this.orientation===1?`1px solid ${this.styles.leftBorder}`:""}},Xvi=class a extends x{constructor(e,t,o){super();this.pane=e;this.dnd=t;this.context=o;this.dragOverCounter=0;this._onDidDrop=this._register(new E);this.onDidDrop=this._onDidDrop.event;e.draggableElement.draggable=!0,this._register(j(e.draggableElement,"dragstart",n=>this.onDragStart(n))),this._register(j(e.dropTargetElement,"dragenter",n=>this.onDragEnter(n))),this._register(j(e.dropTargetElement,"dragleave",n=>this.onDragLeave(n))),this._register(j(e.dropTargetElement,"dragend",n=>this.onDragEnd(n))),this._register(j(e.dropTargetElement,"drop",n=>this.onDrop(n)))}static{this.DefaultDragOverBackgroundColor=new We(new zt(128,128,128,.5))}onDragStart(e){if(!this.dnd.canDrag(this.pane)||!e.dataTransfer){e.preventDefault(),e.stopPropagation();return}let t=this.pane.draggableElement?.textContent||"";e.dataTransfer.effectAllowed="move",Ac&&e.dataTransfer?.setData(yl.TEXT,t),MP(e,this.pane.element,t),this.context.draggable=this}onDragEnter(e){!this.context.draggable||this.context.draggable===this||this.dnd.canDrop(this.context.draggable.pane,this.pane)&&(this.dragOverCounter++,this.render())}onDragLeave(e){!this.context.draggable||this.context.draggable===this||this.dnd.canDrop(this.context.draggable.pane,this.pane)&&(this.dragOverCounter--,this.dragOverCounter===0&&this.render())}onDragEnd(e){this.context.draggable&&(this.dragOverCounter=0,this.render(),this.context.draggable=null)}onDrop(e){this.context.draggable&&(Xt.stop(e),this.dragOverCounter=0,this.render(),this.dnd.canDrop(this.context.draggable.pane,this.pane)&&this.context.draggable!==this&&this._onDidDrop.fire({from:this.context.draggable.pane,to:this.pane}),this.context.draggable=null)}render(){let e=null;this.dragOverCounter>0&&(e=this.pane.dropBackground??a.DefaultDragOverBackgroundColor.toString()),this.pane.dropTargetElement.style.backgroundColor=e||""}};var aAt=class extends x{constructor(e,t={}){super();this.dndContext={draggable:null};this.paneItems=[];this.orthogonalSize=0;this.size=0;this.animationTimer=void 0;this._onDidDrop=this._register(new E);this.onDidDrop=this._onDidDrop.event;this.dnd=t.dnd,this.orientation=t.orientation??0,this.element=M(e,_(".monaco-pane-view")),this.splitview=this._register(new Ou(this.element,{orientation:this.orientation})),this.onDidSashReset=this.splitview.onDidSashReset,this.onDidSashChange=this.splitview.onDidSashChange,this.onDidScroll=this.splitview.onDidScroll;let o=this._register(new N),n=this._register(new Gn(this.element,"keydown")),r=U.map(U.filter(n.event,s=>Do(s.target)&&s.target.classList.contains("pane-header"),o),s=>new gi(s),o);this._register(U.filter(r,s=>s.keyCode===16,o)(()=>this.focusPrevious())),this._register(U.filter(r,s=>s.keyCode===18,o)(()=>this.focusNext()))}addPane(e,t,o=this.splitview.length){let n=new N;e.onDidChangeExpansionState(this.setupAnimation,this,n);let r={pane:e,disposable:n};if(this.paneItems.splice(o,0,r),e.orientation=this.orientation,e.orthogonalSize=this.orthogonalSize,this.splitview.addView(e,t,o),this.dnd){let s=new Xvi(e,this.dnd,this.dndContext);n.add(s),n.add(s.onDidDrop(this._onDidDrop.fire,this._onDidDrop))}}removePane(e){let t=this.paneItems.findIndex(n=>n.pane===e);if(t===-1)return;this.splitview.removeView(t,e.isExpanded()?Gl.Distribute:void 0),this.paneItems.splice(t,1)[0].disposable.dispose()}movePane(e,t){let o=this.paneItems.findIndex(s=>s.pane===e),n=this.paneItems.findIndex(s=>s.pane===t);if(o===-1||n===-1)return;let[r]=this.paneItems.splice(o,1);this.paneItems.splice(n,0,r),this.splitview.moveView(o,n)}resizePane(e,t){let o=this.paneItems.findIndex(n=>n.pane===e);o!==-1&&this.splitview.resizeView(o,t)}getPaneSize(e){let t=this.paneItems.findIndex(o=>o.pane===e);return t===-1?-1:this.splitview.getViewSize(t)}layout(e,t){this.orthogonalSize=this.orientation===0?t:e,this.size=this.orientation===1?t:e;for(let o of this.paneItems)o.pane.orthogonalSize=this.orthogonalSize;this.splitview.layout(this.size)}setBoundarySashes(e){this.boundarySashes=e,this.updateSplitviewOrthogonalSashes(e)}updateSplitviewOrthogonalSashes(e){this.orientation===0?(this.splitview.orthogonalStartSash=e?.left,this.splitview.orthogonalEndSash=e?.right):this.splitview.orthogonalEndSash=e?.bottom}flipOrientation(e,t){this.orientation=this.orientation===0?1:0;let o=this.paneItems.map(s=>this.getPaneSize(s.pane));this.splitview.dispose(),Rt(this.element),this.splitview=this._register(new Ou(this.element,{orientation:this.orientation})),this.updateSplitviewOrthogonalSashes(this.boundarySashes);let n=this.orientation===0?t:e,r=this.orientation===1?t:e;this.paneItems.forEach((s,l)=>{s.pane.orthogonalSize=n,s.pane.orientation=this.orientation;let c=this.size===0?0:r*o[l]/this.size;this.splitview.addView(s.pane,c,l)}),this.size=r,this.orthogonalSize=n,this.splitview.layout(this.size)}setupAnimation(){typeof this.animationTimer=="number"&&Re(this.element).clearTimeout(this.animationTimer),this.element.classList.add("animated"),this.animationTimer=Re(this.element).setTimeout(()=>{this.animationTimer=void 0,this.element.classList.remove("animated")},200)}getPaneHeaderElements(){return[...this.element.querySelectorAll(".pane-header")]}focusPrevious(){let e=this.getPaneHeaderElements(),t=e.indexOf(this.element.ownerDocument.activeElement);t!==-1&&e[Math.max(t-1,0)].focus()}focusNext(){let e=this.getPaneHeaderElements(),t=e.indexOf(this.element.ownerDocument.activeElement);t!==-1&&e[Math.min(t+1,e.length-1)].focus()}dispose(){super.dispose(),this.paneItems.forEach(e=>e.disposable.dispose())}};var lAt=class{constructor(i){this.nodes=i}toString(){return this.nodes.map(i=>typeof i=="string"?i:i.label).join("")}};I([hi],lAt.prototype,"toString",1);var J4o=/\[([^\]]+)\]\(((?:https?:\/\/|command:|file:)[^\)\s]+)(?: (["'])(.+?)(\3))?\)/gi;function ES(a){let i=[],e=0,t;for(;t=J4o.exec(a);){t.index-e>0&&i.push(a.substring(e,t.index));let[,o,n,,r]=t;r?i.push({label:o,href:n,title:r}):i.push({label:o,href:n}),e=t.index+t[0].length}return e<a.length&&i.push(a.substring(e)),new lAt(i)}var Z4o=()=>({msLoopTime:-1,msDelayTime:-1,dispose:()=>{}}),Iro=Z4o;function yro(a){Iro=a}function wro(a,i){return Iro(a,i)}var Jvi="done",Zvi="active",cAt="infinite",dAt="infinite-long-running",ebi="discrete",e3o=d(28,null);var Zf=class a extends x{constructor(e,t){super();this.progressSignal=this._register(new me);this.workedVal=0,this.showDelayedScheduler=this._register(new Dt(()=>un(this.element),0)),this.longRunningScheduler=this._register(new Dt(()=>this.infiniteLongRunning(),a.LONG_RUNNING_INFINITE_THRESHOLD)),this.create(e,t)}static{this.LONG_RUNNING_INFINITE_THRESHOLD=1e4}static{this.PROGRESS_SIGNAL_DEFAULT_DELAY=3e3}create(e,t){this.element=document.createElement("div"),this.element.classList.add("monaco-progress-container"),this.element.setAttribute("role","progressbar"),this.element.setAttribute("aria-valuemin","0"),this.element.setAttribute("aria-label",t?.ariaLabel&&t.ariaLabel.trim()?t.ariaLabel:e3o),e.appendChild(this.element),this.bit=document.createElement("div"),this.bit.classList.add("progress-bit"),this.bit.style.backgroundColor=t?.progressBarBackground||"#0E70C0",this.element.appendChild(this.bit)}off(){this.bit.style.width="inherit",this.bit.style.opacity="1",this.element.classList.remove(Zvi,cAt,dAt,ebi),this.workedVal=0,this.totalWork=void 0,this.longRunningScheduler.cancel(),this.progressSignal.clear()}done(){return this.doDone(!0)}stop(){return this.doDone(!1)}doDone(e){return this.element.classList.add(Jvi),this.element.classList.contains(cAt)?(this.bit.style.opacity="0",e?setTimeout(()=>this.off(),200):this.off()):(this.bit.style.width="inherit",e?setTimeout(()=>this.off(),200):this.off()),this}infinite(){return this.bit.style.width="2%",this.bit.style.opacity="1",this.element.classList.remove(ebi,Jvi,dAt),this.element.classList.add(Zvi,cAt),this.longRunningScheduler.schedule(),this}infiniteLongRunning(){this.element.classList.add(dAt)}total(e){return this.workedVal=0,this.totalWork=e,this.element.setAttribute("aria-valuemax",e.toString()),this}hasTotal(){return Yo(this.totalWork)}worked(e){return e=Math.max(1,Number(e)),this.doSetWorked(this.workedVal+e)}setWorked(e){return e=Math.max(1,Number(e)),this.doSetWorked(e)}doSetWorked(e){let t=this.totalWork||100;return this.workedVal=e,this.workedVal=Math.min(t,this.workedVal),this.element.classList.remove(cAt,dAt,Jvi),this.element.classList.add(Zvi,ebi),this.element.setAttribute("aria-valuenow",e.toString()),this.bit.style.width=100*(this.workedVal/t)+"%",this}getContainer(){return this.element}show(e){this.showDelayedScheduler.cancel(),this.progressSignal.value=wro(a.PROGRESS_SIGNAL_DEFAULT_DELAY),typeof e=="number"?this.showDelayedScheduler.schedule(e):un(this.element)}hide(){vo(this.element),this.showDelayedScheduler.cancel(),this.progressSignal.clear()}};var uAt=class extends x{constructor(e,t){super();this.progressBar=e;this.group=t;this.registerListeners()}registerListeners(){this._register(this.group.onDidModelChange(e=>{(e.kind===8||e.kind===6&&this.group.isEmpty)&&this.progressBar.stop().hide()}))}show(e,t){return this.group.isEmpty?Iyt:e===!0?this.doShow(!0,t):this.doShow(e,t)}doShow(e,t){return typeof e=="boolean"?this.progressBar.infinite().show(t):this.progressBar.total(e).show(t),{total:o=>{this.progressBar.total(o)},worked:o=>{this.progressBar.hasTotal()?this.progressBar.worked(o):this.progressBar.infinite().show()},done:()=>{this.progressBar.stop().hide()}}}async showWhile(e,t){if(this.group.isEmpty)try{await e}catch{}return this.doShowWhile(e,t)}async doShowWhile(e,t){try{this.progressBar.infinite().show(t),await e}catch{}finally{this.progressBar.stop().hide()}}},jB;(r=>{let a;(h=>(h[h.None=0]="None",h[h.Done=1]="Done",h[h.Infinite=2]="Infinite",h[h.While=3]="While",h[h.Work=4]="Work"))(a=r.Type||={}),r.None={type:0},r.Done={type:1},r.Infinite={type:2};class o{constructor(l,c,u){this.whilePromise=l;this.whileStart=c;this.whileDelay=u;this.type=3}}r.While=o;class n{constructor(l,c){this.total=l;this.worked=c;this.type=4}}r.Work=n})(jB||={});var B_e=class extends x{constructor(e,t){super();this.progressBar=e;this.scope=t;this.progressState=jB.None;this.registerListeners()}registerListeners(){this._register(this.scope.onDidChangeActive(()=>{this.scope.isActive?this.onDidScopeActivate():this.onDidScopeDeactivate()}))}onDidScopeActivate(){if(this.progressState.type!==jB.Done.type)if(this.progressState.type===3){let e;if(this.progressState.whileDelay>0){let t=this.progressState.whileDelay-(Date.now()-this.progressState.whileStart);t>0&&(e=t)}this.doShowWhile(e)}else this.progressState.type===2?this.progressBar.infinite().show():this.progressState.type===4&&(this.progressState.total&&this.progressBar.total(this.progressState.total).show(),this.progressState.worked&&this.progressBar.worked(this.progressState.worked).show())}onDidScopeDeactivate(){this.progressBar.stop().hide()}show(e,t){return typeof e=="boolean"?this.progressState=jB.Infinite:this.progressState=new jB.Work(e,void 0),this.scope.isActive&&(this.progressState.type===2?this.progressBar.infinite().show(t):this.progressState.type===4&&typeof this.progressState.total=="number"&&this.progressBar.total(this.progressState.total).show(t)),{total:o=>{this.progressState=new jB.Work(o,this.progressState.type===4?this.progressState.worked:void 0),this.scope.isActive&&this.progressBar.total(o)},worked:o=>{!this.scope.isActive||this.progressBar.hasTotal()?(this.progressState=new jB.Work(this.progressState.type===4?this.progressState.total:void 0,this.progressState.type===4&&typeof this.progressState.worked=="number"?this.progressState.worked+o:o),this.scope.isActive&&this.progressBar.worked(o)):(this.progressState=jB.Infinite,this.progressBar.infinite().show())},done:()=>{this.progressState=jB.Done,this.scope.isActive&&this.progressBar.stop().hide()}}}async showWhile(e,t){this.progressState.type===3&&(e=Promise.allSettled([e,this.progressState.whilePromise])),this.progressState=new jB.While(e,t||0,Date.now());try{this.doShowWhile(t),await e}catch{}finally{(this.progressState.type!==3||this.progressState.whilePromise===e)&&(this.progressState=jB.None,this.scope.isActive&&this.progressBar.stop().hide())}}doShowWhile(e){this.scope.isActive&&this.progressBar.infinite().show(e)}},H_e=class extends x{constructor(e,t){super();this.scopeId=e;this._isActive=t;this._onDidChangeActive=this._register(new E);this.onDidChangeActive=this._onDidChangeActive.event}get isActive(){return this._isActive}onScopeOpened(e){e===this.scopeId&&(this._isActive||(this._isActive=!0,this._onDidChangeActive.fire()))}onScopeClosed(e){e===this.scopeId&&this._isActive&&(this._isActive=!1,this._onDidChangeActive.fire())}};var Cro=new D("menu.view.filter"),ex=new D("submenu.view.filter");ve.appendMenuItem(Cro,{submenu:ex,title:d(4539,null),group:"navigation",icon:R.filter});var tbi=class extends VE{constructor(){super(...arguments);this._checked=!1}set checked(e){this._checked!==e&&(this._checked=e,this.updateChecked())}updateChecked(){this.element&&this.element.classList.toggle("checked",this._checked)}render(e){super.render(e),this.updateChecked()}},m2=class extends ja{constructor(e,t,o,n,r,s,l){super();this.options=e;this.instantiationService=t;this.contextViewService=o;this.keybindingService=r;this.configurationService=s;this.accessibilityService=l;this._onDidChangeFilterText=this._register(new E);this.onDidChangeFilterText=this._onDidChangeFilterText.event;this._onDidAcceptFilterText=this._register(new E);this.onDidAcceptFilterText=this._onDidAcceptFilterText.event;this.isMoreFiltersChecked=!1;this._accessibilityHelpHintAnnounced=!1;this.delayedFilterUpdate=new Xo(300),this._register(Z(()=>this.delayedFilterUpdate.cancel())),e.focusContextKey&&(this.focusContextKey=new Y(e.focusContextKey,!1).bindTo(n)),this.element=_(".viewpane-filter"),[this.filterInputBox,this.focusTracker]=this.createInput(this.element),this._register(this.filterInputBox),this._register(this.focusTracker);let c=M(this.element,_(".viewpane-filter-controls"));this.filterBadge=this.createBadge(c),this.toolbar=this._register(this.createToolBar(c)),this.adjustInputBox()}get onDidFocus(){return this.focusTracker.onDidFocus}get onDidBlur(){return this.focusTracker.onDidBlur}hasFocus(){return this.filterInputBox.hasFocus()}focus(){this._updateFilterInputAriaLabel(),this.filterInputBox.focus()}_updateFilterInputAriaLabel(){let e=this.options.ariaLabel||d(4540,null);if(!this._accessibilityHelpHintAnnounced&&this.configurationService.getValue("accessibility.verbosity.find")&&this.accessibilityService.isScreenReaderOptimized()){let t=this.keybindingService.lookupKeybinding("editor.action.accessibilityHelp")?.getAriaLabel();t&&(e+=", "+d(4538,null,t),this._accessibilityHelpHintAnnounced=!0,this._labelResetTimeout?.dispose(),this._labelResetTimeout=tn(()=>{this.filterInputBox.setAriaLabel(this.options.ariaLabel||d(4540,null))},1e3))}this.filterInputBox.setAriaLabel(e)}blur(){this.filterInputBox.blur()}updateBadge(e){this.filterBadge.classList.toggle("hidden",!e),this.filterBadge.textContent=e||"",this.adjustInputBox()}setFilterText(e){this.filterInputBox.value=e}getFilterText(){return this.filterInputBox.value}getHistory(){return this.filterInputBox.getHistory()}layout(e){this.element.parentElement?.classList.toggle("grow",e>700),this.element.classList.toggle("small",e<400),this.adjustInputBox(),this.lastWidth=e}relayout(){this.lastWidth&&this.layout(this.lastWidth)}checkMoreFilters(e){this.isMoreFiltersChecked=e,this.moreFiltersActionViewItem&&(this.moreFiltersActionViewItem.checked=e)}createInput(e){let t=this.options.history||[],o=this._register(this.instantiationService.createInstance(Bz,e,this.contextViewService,{placeholder:this.options.placeholder,ariaLabel:this.options.ariaLabel,history:new Set(t),showHistoryHint:()=>bR(this.keybindingService),inputBoxStyles:Cl}));this.options.text&&(o.value=this.options.text),this._register(o.onDidChange(r=>this.delayedFilterUpdate.trigger(()=>this.onDidInputChange(o)))),this._register(Jo(o.inputElement,re.KEY_DOWN,r=>this.onInputKeyDown(r))),this._register(Jo(e,re.KEY_DOWN,r=>this.handleKeyboardEvent(r))),this._register(Jo(e,re.KEY_UP,r=>this.handleKeyboardEvent(r))),this._register(Jo(o.inputElement,re.CLICK,r=>{r.stopPropagation(),r.preventDefault()}));let n=this._register(qn(o.inputElement));return this.focusContextKey&&(this._register(n.onDidFocus(()=>this.focusContextKey.set(!0))),this._register(n.onDidBlur(()=>this.focusContextKey.set(!1))),this._register(Z(()=>this.focusContextKey.reset()))),[o,n]}createBadge(e){let t=M(e,_(".viewpane-filter-badge.hidden"));return t.style.backgroundColor=kt(bv),t.style.color=kt(CC),t.style.border=`1px solid ${kt(bi)}`,t}createToolBar(e){return this.instantiationService.createInstance(or,e,Cro,{hiddenItemStrategy:-1,actionViewItemProvider:(t,o)=>{if(t instanceof Nc&&t.item.submenu.id===ex.id)return this.moreFiltersActionViewItem=this.instantiationService.createInstance(tbi,t,o),this.moreFiltersActionViewItem.checked=this.isMoreFiltersChecked,this.moreFiltersActionViewItem}})}onDidInputChange(e){e.addToHistory(),this._onDidChangeFilterText.fire(e.value)}adjustInputBox(){this.filterInputBox.inputElement.style.paddingRight=this.element.classList.contains("small")||this.filterBadge.classList.contains("hidden")?"25px":"150px"}handleKeyboardEvent(e){(e.equals(10)||e.equals(15)||e.equals(17)||e.equals(14)||e.equals(13))&&e.stopPropagation()}onInputKeyDown(e){let t=!1;e.equals(2)&&!this.toolbar.isEmpty()&&(this.toolbar.focus(),t=!0),e.equals(3)&&(this._onDidAcceptFilterText.fire(),t=!0),t&&(e.stopPropagation(),e.preventDefault())}};m2=I([m(1,F),m(2,Wn),m(3,X),m(4,_e),m(5,B),m(6,Oi)],m2);var Xue=class extends x{constructor(e,t,o,n,r){super();this.menuId=e;this.contextMenuId=t;this.options=o;this.contextKeyService=n;this.menuService=r;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this.menu=this._register(r.createMenu(e,n,{emitEventsForSubmenuChanges:!0})),this._register(this.menu.onDidChange(()=>{this.actions=void 0,this._onDidChange.fire()}))}getActions(){return this.actions||(this.actions=ml(this.menu.getActions(this.options))),this.actions}getPrimaryActions(){return this.getActions().primary}getSecondaryActions(){return this.getActions().secondary}getContextMenuActions(){if(this.contextMenuId){let e=this.menuService.getMenuActions(this.contextMenuId,this.contextKeyService,this.options);return ml(e).secondary}return[]}};Xue=I([m(3,X),m(4,Kt)],Xue);var U_e=class extends Xue{constructor(i,e,t,o,n){let r=o.createScoped(i);r.createKey("viewContainer",e.id);let s=r.createKey("viewContainerLocation",Pw(t.getViewContainerLocation(e)));super(D.ViewContainerTitle,D.ViewContainerTitleContext,{shouldForwardArgs:!0,renderShortTitle:!0},r,n),this._register(r),this._register(U.filter(t.onDidChangeContainerLocation,l=>l.viewContainer===e)(()=>s.set(Pw(t.getViewContainerLocation(e)))))}};U_e=I([m(2,Bi),m(3,X),m(4,Kt)],U_e);var pAt=new it("viewpane.action.filter"),t3o=Ae("view-pane-container-expanded",R.chevronDown,d(4543,null)),i3o=Ae("view-pane-container-collapsed",R.chevronRight,d(4542,null)),xro=ne.as(Mn.ViewsRegistry),IYe=class{constructor(i,e,t,o,n,r){this.container=i;this.delegate=e;this.instantiationService=t;this.openerService=o;this.contextKeyService=n;this.items=[];this._enabled=!1;this._wide=!1;this.disposables=new N;this.enabledDisposables=this.disposables.add(new N);this.renderDisposables=this.disposables.add(new N);this.disposables.add(U.runAndSubscribe(this.delegate.onDidChangeViewWelcomeState,()=>this.onDidChangeViewWelcomeState())),this.disposables.add(r.onWillShutdown(()=>this.dispose()))}get enabled(){return this._enabled}layout(i,e){this._enabled&&(this.element.style.height=`${i}px`,this.element.style.width=`${e}px`,this._wide=e>640,this.element.classList.toggle("wide",this._wide),this.scrollableElement.scanDomNode())}focus(){this._enabled&&this.element.focus()}onDidChangeViewWelcomeState(){let i=this.delegate.shouldShowWelcome();if(this._enabled===i)return;if(this._enabled=i,!i){this.enabledDisposables.clear();return}this.container.classList.add("welcome");let e=M(this.container,_(".welcome-view"));this.element=_(".welcome-view-content",{tabIndex:0,role:"region","aria-label":d(4545,null)}),this._wide&&this.element.classList.add("wide"),this.scrollableElement=new ms(this.element,{alwaysConsumeMouseWheel:!0,horizontal:2,vertical:3}),M(e,this.scrollableElement.getDomNode()),this.enabledDisposables.add(Z(()=>{this.container.classList.remove("welcome"),this.scrollableElement.dispose(),e.remove(),this.scrollableElement=void 0,this.element=void 0})),this.contextKeyService.onDidChangeContext(this.onDidChangeContext,this,this.enabledDisposables),U.chain(xro.onDidChangeViewWelcomeContent,t=>t.filter(o=>o===this.delegate.id))(this.onDidChangeViewWelcomeContent,this,this.enabledDisposables),this.onDidChangeViewWelcomeContent()}onDidChangeViewWelcomeContent(){let i=xro.getViewWelcomeContent(this.delegate.id);this.items=[];for(let e of i)if(e.when==="default")this.defaultItem={descriptor:e,visible:!0};else{let t=e.when?this.contextKeyService.contextMatchesRules(e.when):!0;this.items.push({descriptor:e,visible:t})}this.render()}onDidChangeContext(){let i=!1;for(let e of this.items){if(!e.descriptor.when||e.descriptor.when==="default")continue;let t=this.contextKeyService.contextMatchesRules(e.descriptor.when);e.visible!==t&&(e.visible=t,i=!0)}i&&this.render()}render(){this.renderDisposables.clear(),this.element.textContent="";let i=this.getContentDescriptors();if(i.length===0){this.container.classList.remove("welcome"),this.scrollableElement.scanDomNode();return}let e=0;for(let{content:t,precondition:o,renderSecondaryButtons:n}of i){let r=t.split(`
`);for(let s of r){if(s=s.trim(),!s)continue;let l=ES(s);if(l.nodes.length===1&&typeof l.nodes[0]!="string"){let c=l.nodes[0],u=M(this.element,_(".button-container")),p=new Wi(u,{title:c.title,supportIcons:!0,secondary:!!(n&&e>0),...Qo});if(p.label=c.label,p.onDidClick(h=>{this.openerService.open(c.href,{allowCommands:!0})},null,this.renderDisposables),this.renderDisposables.add(p),e++,o){let h=()=>p.enabled=this.contextKeyService.contextMatchesRules(o);h();let g=new Set(o.keys());U.filter(this.contextKeyService.onDidChangeContext,v=>v.affectsSome(g))(h,null,this.renderDisposables)}}else{let c=M(this.element,_("p"));for(let u of l.nodes)if(typeof u=="string")M(c,...Un(u));else{let p=this.renderDisposables.add(this.instantiationService.createInstance(rg,c,u,{}));if(o&&u.href.startsWith("command:")){let h=()=>p.enabled=this.contextKeyService.contextMatchesRules(o);h();let g=new Set(o.keys());U.filter(this.contextKeyService.onDidChangeContext,v=>v.affectsSome(g))(h,null,this.renderDisposables)}}}}}this.container.classList.add("welcome"),this.scrollableElement.scanDomNode()}getContentDescriptors(){let i=this.items.filter(e=>e.visible);return i.length===0&&this.defaultItem?[this.defaultItem.descriptor]:i.map(e=>e.descriptor)}dispose(){this.disposables.dispose()}};IYe=I([m(2,F),m(3,Je),m(4,X),m(5,ji)],IYe);var Gs=class extends sAt{constructor(e,t,o,n,r,s,l,c,u,p,h){super({...e,orientation:s.getViewLocationById(e.id)===1?1:0});this.keybindingService=t;this.contextMenuService=o;this.configurationService=n;this.contextKeyService=r;this.viewDescriptorService=s;this.instantiationService=l;this.openerService=c;this.themeService=u;this.hoverService=p;this.accessibleViewInformationService=h;this._onDidFocus=this._register(new E);this.onDidFocus=this._onDidFocus.event;this._onDidBlur=this._register(new E);this.onDidBlur=this._onDidBlur.event;this._onDidChangeBodyVisibility=this._register(new E);this.onDidChangeBodyVisibility=this._onDidChangeBodyVisibility.event;this._onDidChangeTitleArea=this._register(new E);this.onDidChangeTitleArea=this._onDidChangeTitleArea.event;this._onDidChangeViewWelcomeState=this._register(new E);this.onDidChangeViewWelcomeState=this._onDidChangeViewWelcomeState.event;this._isVisible=!1;this.headerActionViewItems=this._register(new Vt);this.id=e.id,this._title=e.title,this._titleDescription=e.titleDescription,this._singleViewPaneContainerTitle=e.singleViewPaneContainerTitle,this.showActions=e.showActions??0,this.scopedContextKeyService=this._register(r.createScoped(this.element)),this.scopedContextKeyService.createKey("view",this.id);let g=this.scopedContextKeyService.createKey("viewLocation",Pw(s.getViewLocationById(this.id)));this._register(U.filter(s.onDidChangeLocation,v=>v.views.some(b=>b.id===this.id))(()=>g.set(Pw(s.getViewLocationById(this.id)))));let f=this._register(this.instantiationService.createChild(new _o([X,this.scopedContextKeyService])));this.menuActions=this._register(f.createInstance(Xue,e.titleMenuId??D.ViewTitle,D.ViewTitleContext,{shouldForwardArgs:!e.donotForwardArgs,renderShortTitle:!0})),this._register(this.menuActions.onDidChange(()=>this.updateActions()))}static{this.AlwaysShowActionsConfig="workbench.view.alwaysShowHeaderActions"}get title(){return this._title}get titleDescription(){return this._titleDescription}get singleViewPaneContainerTitle(){return this._singleViewPaneContainerTitle}get headerVisible(){return super.headerVisible}set headerVisible(e){super.headerVisible=e,this.element.classList.toggle("merged-header",!e)}setVisible(e){this._isVisible!==e&&(this._isVisible=e,this.isExpanded()&&this._onDidChangeBodyVisibility.fire(e))}isVisible(){return this._isVisible}isBodyVisible(){return this._isVisible&&this.isExpanded()}setExpanded(e){let t=super.setExpanded(e);return t&&this._onDidChangeBodyVisibility.fire(e),this.updateTwistyIcon(),t}render(){super.render();let e=qn(this.element);this._register(e),this._register(e.onDidFocus(()=>this._onDidFocus.fire())),this._register(e.onDidBlur(()=>this._onDidBlur.fire()))}renderHeader(e){this.headerContainer=e,this.twistiesContainer=M(e,_(`.twisty-container${q.asCSSSelector(this.getTwistyIcon(this.isExpanded()))}`)),this.renderHeaderTitle(e,this.title);let t=M(e,_(".actions"));t.classList.toggle("show-always",this.showActions===2),t.classList.toggle("show-expanded",this.showActions===1),this.toolbar=this.instantiationService.createInstance(ol,t,{orientation:0,actionViewItemProvider:(r,s)=>{let l=this.createActionViewItem(r,s);return l&&this.headerActionViewItems.set(l.action.id,l),l},ariaLabel:d(4544,null,this.title),getKeyBinding:r=>this.keybindingService.lookupKeybinding(r.id),renderDropdownAsChildElement:!0,actionRunner:this.getActionRunner(),resetMenu:this.menuActions.menuId}),this._register(this.toolbar),this.setActions(),this._register(j(t,re.CLICK,r=>r.preventDefault()));let o=this.viewDescriptorService.getViewContainerByViewId(this.id);o?this._register(this.viewDescriptorService.getViewContainerModel(o).onDidChangeContainerInfo(({title:r})=>this.updateTitle(this.title))):console.error(`View container model not found for view ${this.id}`);let n=U.filter(this.configurationService.onDidChangeConfiguration,r=>r.affectsConfiguration(Gs.AlwaysShowActionsConfig));this._register(n(this.updateActionsVisibility,this)),this.updateActionsVisibility()}updateHeader(){super.updateHeader(),this.updateTwistyIcon()}updateTwistyIcon(){this.twistiesContainer&&(this.twistiesContainer.classList.remove(...q.asClassNameArray(this.getTwistyIcon(!this._expanded))),this.twistiesContainer.classList.add(...q.asClassNameArray(this.getTwistyIcon(this._expanded))))}getTwistyIcon(e){return e?t3o:i3o}style(e){super.style(e);let t=this.getIcon();if(this.iconContainer){let o=O_(e.headerForeground,kt(To));A.isUri(t)?(this.iconContainer.style.backgroundColor=o,this.iconContainer.style.color=""):(this.iconContainer.style.color=o,this.iconContainer.style.backgroundColor="")}}getIcon(){return this.viewDescriptorService.getViewDescriptorById(this.id)?.containerIcon||PTe}renderHeaderTitle(e,t){this.iconContainer=M(e,_(".icon",void 0));let o=this.getIcon(),n;if(A.isUri(o)){n=`view-${this.id.replace(/[\.\:]/g,"-")}`;let s=`.pane-header .icon.${n}`;$h(s,`
				mask: ${Qa(o)} no-repeat 50% 50%;
				mask-size: 24px;
				-webkit-mask: ${Qa(o)} no-repeat 50% 50%;
				-webkit-mask-size: 16px;
			`)}else q.isThemeIcon(o)&&(n=q.asClassName(o));n&&this.iconContainer.classList.add(...n.split(" "));let r=this.calculateTitle(t);this.titleContainer=M(e,_("h3.title",{},r)),this.titleContainerHover=this._register(this.hoverService.setupManagedHover(Ri("mouse"),this.titleContainer,r)),this._titleDescription&&this.setTitleDescription(this._titleDescription),this.iconContainerHover=this._register(this.hoverService.setupManagedHover(Ri("mouse"),this.iconContainer,r)),this.iconContainer.setAttribute("aria-label",this._getAriaLabel(r,this._titleDescription))}_getAriaLabel(e,t){let o=this.viewDescriptorService.getViewDescriptorById(this.id)?.accessibilityHelpContent,n=this.accessibleViewInformationService?.hasShownAccessibleView(this.id);return!o||n?t?`${e} - ${t}`:e:d(4541,null,e)}updateTitle(e){let t=this.calculateTitle(e);this.titleContainer&&(this.titleContainer.textContent=t,this.titleContainerHover?.update(t)),this.updateAriaHeaderLabel(t,this._titleDescription),this._title=e,this._onDidChangeTitleArea.fire()}updateAriaHeaderLabel(e,t){let o=this._getAriaLabel(e,t);this.iconContainer&&(this.iconContainerHover?.update(e),this.iconContainer.setAttribute("aria-label",o)),this.ariaHeaderLabel=this.getAriaHeaderLabel(o)}setTitleDescription(e){this.titleDescriptionContainer?(this.titleDescriptionContainer.textContent=e??"",this.titleDescriptionContainerHover?.update(e??"")):e&&this.titleContainer&&(this.titleDescriptionContainer=Tgt(this.titleContainer,_("span.description",{},e)),this.titleDescriptionContainerHover=this._register(this.hoverService.setupManagedHover(Ri("mouse"),this.titleDescriptionContainer,e)))}updateTitleDescription(e){this.setTitleDescription(e),this.updateAriaHeaderLabel(this._title,e),this._titleDescription=e,this._onDidChangeTitleArea.fire()}calculateTitle(e){let t=this.viewDescriptorService.getViewContainerByViewId(this.id),o=this.viewDescriptorService.getViewContainerModel(t),n=this.viewDescriptorService.getViewDescriptorById(this.id);return!(this.viewDescriptorService.getDefaultContainerById(this.id)===t)&&n?.containerTitle&&o.title!==n.containerTitle&&e!==n.containerTitle?`${n.containerTitle}: ${e}`:e}renderBody(e){this.viewWelcomeController=this._register(this.instantiationService.createInstance(IYe,e,this))}layoutBody(e,t){this.viewWelcomeController?.layout(e,t)}onDidScrollRoot(){}getProgressIndicator(){if(this.progressBar===void 0&&(this.progressBar=this._register(new Zf(this.element,vw)),this.progressBar.hide()),this.progressIndicator===void 0){let e=this;this.progressIndicator=this._register(new B_e(Ci(this.progressBar),this._register(new class extends H_e{constructor(){super(e.id,e.isBodyVisible()),this._register(e.onDidChangeBodyVisibility(t=>t?this.onScopeOpened(e.id):this.onScopeClosed(e.id)))}})))}return this.progressIndicator}getProgressLocation(){return this.viewDescriptorService.getViewContainerByViewId(this.id).id}getLocationBasedColors(){return h2(this.viewDescriptorService.getViewLocationById(this.id))}focus(){this.viewWelcomeController?.enabled?this.viewWelcomeController.focus():this.element&&this.element.focus(),(wa(this.element)||Gr(this.element))&&this._onDidFocus.fire()}setActions(){if(this.toolbar){let e=[...this.menuActions.getPrimaryActions()];this.shouldShowFilterInHeader()&&e.unshift(pAt),this.toolbar.setActions(B_(e),B_(this.menuActions.getSecondaryActions())),this.toolbar.context=this.getActionsContext()}}updateActionsVisibility(){if(!this.headerContainer)return;let e=this.configurationService.getValue("workbench.view.alwaysShowHeaderActions");this.headerContainer.classList.toggle("actions-always-visible",e)}updateActions(){this.setActions(),this._onDidChangeTitleArea.fire()}createActionViewItem(e,t){if(e.id===pAt.id){let o=this;return new class extends wl{constructor(){super(null,e)}setFocusable(){}get trapsArrowNavigation(){return!0}render(n){n.classList.add("viewpane-filter-container");let r=o.getFilterWidget();M(n,r.element),r.relayout()}}}return Bs(this.instantiationService,e,{...t,menuAsChild:e instanceof Nc})}getActionsContext(){}getActionRunner(){}getOptimalWidth(){return 0}saveState(){}shouldShowWelcome(){return!1}getFilterWidget(){}shouldShowFilterInHeader(){return!1}};Gs=I([m(1,_e),m(2,Xe),m(3,B),m(4,X),m(5,Bi),m(6,F),m(7,Je),m(8,Le),m(9,nt)],Gs);var o0=class extends Gs{constructor(i,e,t,o,n,r,s,l,c,u,p){super(i,e,t,o,n,r,s,l,c,u,p);let h=this._register(s.createChild(new _o([X,this.scopedContextKeyService])));this.filterWidget=this._register(h.createInstance(m2,i.filterOptions)),this._register(this.filterWidget.onDidAcceptFilterText(()=>this.focusBodyContent()))}getFilterWidget(){return this.filterWidget}renderBody(i){super.renderBody(i),this.filterContainer=M(i,_(".viewpane-filter-container"))}layoutBody(i,e){super.layoutBody(i,e),this.dimension=new si(e,i);let t=!this.filterContainer?.hasChildNodes(),o=this.shouldShowFilterInHeader();t!==o&&(o&&vi(this.filterContainer),this.updateActions(),o||M(this.filterContainer,this.filterWidget.element)),o||(i=i-44),this.filterWidget.layout(e),this.layoutBodyContent(i,e)}shouldShowFilterInHeader(){return!(this.dimension&&this.dimension.width<600&&this.dimension.height>100)}focusBodyContent(){this.focus()}};o0=I([m(1,_e),m(2,Xe),m(3,B),m(4,X),m(5,Bi),m(6,F),m(7,Je),m(8,Le),m(9,nt)],o0);function h2(a){let i,e,t,o,n;switch(a){case 1:i=lI,e=d6e,t=DZi,o=LZi,n=RZi;break;case 0:case 2:default:i=bf,e=j5,t=WZi,o=VZi,n=BZi}return{background:i,overlayBackground:e,listOverrideStyles:{listBackground:i,treeStickyScrollBackground:t,treeStickyScrollBorder:o,treeStickyScrollShadow:n}}}var Yn=class extends K{constructor(i){super(i),this.desc=i}run(i,...e){let t=i.get($t).getActiveViewWithId(this.desc.viewId);if(t)return this.runInView(i,t,...e)}};var yYe=new Y("commentsFilterFocus",!1);var kro=new Y("commentsView.showResolvedFilter",!0),Ero=new Y("commentsView.showUnResolvedFilter",!0),ibi=new Y("commentsView.sortBy","resourceAscending"),mAt=class extends x{constructor(e,t){super();this.contextKeyService=t;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._showUnresolved=Ero.bindTo(this.contextKeyService),this._showResolved=kro.bindTo(this.contextKeyService),this._sortBy=ibi.bindTo(this.contextKeyService),this._showResolved.set(e.showResolved),this._showUnresolved.set(e.showUnresolved),this._sortBy.set(e.sortBy)}get showUnresolved(){return!!this._showUnresolved.get()}set showUnresolved(e){this._showUnresolved.get()!==e&&(this._showUnresolved.set(e),this._onDidChange.fire({showUnresolved:!0}))}get showResolved(){return!!this._showResolved.get()}set showResolved(e){this._showResolved.get()!==e&&(this._showResolved.set(e),this._onDidChange.fire({showResolved:!0}))}get sortBy(){return this._sortBy.get()??"resourceAscending"}set sortBy(e){this._sortBy.get()!==e&&(this._sortBy.set(e),this._onDidChange.fire({sortBy:e}))}};W(class extends Yn{constructor(){super({id:"commentsFocusViewFromFilter",title:d(9158,null),keybinding:{when:yYe,weight:200,primary:2066},viewId:zu})}async runInView(a,i){i.focus()}});W(class extends Yn{constructor(){super({id:"commentsClearFilterText",title:d(9156,null),keybinding:{when:yYe,weight:200,primary:9},viewId:zu})}async runInView(a,i){i.clearFilterText()}});W(class extends Yn{constructor(){super({id:"commentsFocusFilter",title:d(9157,null),keybinding:{when:ql.isEqualTo(zu),weight:200,primary:2084},viewId:zu})}async runInView(a,i){i.focusFilter()}});W(class extends Yn{constructor(){super({id:`workbench.actions.${zu}.toggleUnResolvedComments`,title:d(9165,null),category:d(9155,null),toggled:{condition:Ero,title:d(9166,null)},menu:{id:ex,group:"1_filter",when:C.equals("view",zu),order:1},viewId:zu})}async runInView(a,i){i.filters.showUnresolved=!i.filters.showUnresolved}});W(class extends Yn{constructor(){super({id:`workbench.actions.${zu}.toggleResolvedComments`,title:d(9162,null),category:d(9155,null),toggled:{condition:kro,title:d(9159,null)},menu:{id:ex,group:"1_filter",when:C.equals("view",zu),order:1},viewId:zu})}async runInView(a,i){i.filters.showResolved=!i.filters.showResolved}});var obi=new D("submenu.filter.commentSort");ve.appendMenuItem(ex,{submenu:obi,title:d(9154,null),group:"2_sort",icon:R.history,when:C.equals("view",zu)});W(class extends Yn{constructor(){super({id:`workbench.actions.${zu}.toggleSortByUpdatedAt`,title:d(9164,null),category:d(9155,null),icon:R.history,viewId:zu,toggled:{condition:C.equals(ibi.key,"updatedAtDescending"),title:d(9161,null)},menu:{id:obi,group:"navigation",order:1,isHiddenByDefault:!1}})}async runInView(a,i){i.filters.sortBy="updatedAtDescending"}});W(class extends Yn{constructor(){super({id:`workbench.actions.${zu}.toggleSortByResource`,title:d(9163,null),category:d(9155,null),icon:R.history,viewId:zu,toggled:{condition:C.equals(ibi.key,"resourceAscending"),title:d(9160,null)},menu:{id:obi,group:"navigation",order:0,isHiddenByDefault:!1}})}async runInView(a,i){i.filters.sortBy="resourceAscending"}});var o3o=te("editorGutter.commentRangeForeground",{dark:lj(Kf,Ho),light:ep(lj(Kf,Ho),.05),hcDark:We.white,hcLight:We.black},d(9064,null)),Tro=te("editorOverviewRuler.commentForeground",o3o,d(9067,null)),_ro=te("editorOverviewRuler.commentUnresolvedForeground",Tro,d(9068,null)),n3o=te("editorOverviewRuler.commentDraftForeground",_ro,d(9066,null)),Dro=te("editorGutter.commentGlyphForeground",{dark:Id,light:Id,hcDark:We.black,hcLight:We.white},d(9063,null));te("editorGutter.commentUnresolvedGlyphForeground",Dro,d(9065,null));te("editorGutter.commentDraftGlyphForeground",Dro,d(9062,null));var Jue=class a extends x{constructor(e,t){super();this._threadHasDraft=!1;this._onDidChangeLineNumber=this._register(new E);this.onDidChangeLineNumber=this._onDidChangeLineNumber.event;this._commentsOptions=this.createDecorationOptions(),this._editor=e,this._commentsDecorations=this._editor.createDecorationsCollection(),this._register(this._commentsDecorations.onDidChange(o=>{let n=this._commentsDecorations.length>0?this._commentsDecorations.getRange(0):null;n&&n.endLineNumber!==this._lineNumber&&(this._lineNumber=n.endLineNumber,this._onDidChangeLineNumber.fire(this._lineNumber))})),this._register(Z(()=>this._commentsDecorations.clear())),this.setLineNumber(t)}static{this.description="comment-glyph-widget"}createDecorationOptions(){let e;this._threadHasDraft?e="comment-range-glyph comment-thread-draft":e=`comment-range-glyph comment-thread${this._threadState===0?"-unresolved":""}`;let t={description:a.description,isWholeLine:!0,overviewRuler:{color:Xs(this._threadHasDraft?n3o:this._threadState===0?_ro:Tro),position:2},collapseOnReplaceEdit:!0,linesDecorationsClassName:e};return mo.createDynamic(t)}setThreadState(e,t=!1){(this._threadState!==e||this._threadHasDraft!==t)&&(this._threadState=e,this._threadHasDraft=t,this._commentsOptions=this.createDecorationOptions(),this._updateDecorations())}_updateDecorations(){let e=[{range:{startLineNumber:this._lineNumber,startColumn:1,endLineNumber:this._lineNumber,endColumn:1},options:this._commentsOptions}];this._commentsDecorations.set(e)}setLineNumber(e){this._lineNumber=e,this._updateDecorations()}getPosition(){let e=this._commentsDecorations.length>0?this._commentsDecorations.getRange(0):null;return{position:{lineNumber:e?e.endLineNumber:this._lineNumber,column:1},preference:[0]}}};var g2=class{constructor(i,e,t,o,n,r,s){this.keybindingService=i;this.contextKeyService=e;this.contextMenuService=t;this.container=o;this.actionHandler=n;this.maxActions=r;this.supportDropdowns=s;this._buttonElements=[];this._toDispose=new N;this._actions=[]}setActions(i,e=!1){this._toDispose.clear(),this._buttonElements.forEach(n=>n.remove()),this._buttonElements=[];let t=i.getActions({shouldForwardArgs:!0}),o=!e;for(let n of t){let[,r]=n;this._actions=r;for(let s of r){let l=this.supportDropdowns&&s instanceof Nc?s.actions:[],c=l.length?l[0]:s,u=this.keybindingService.lookupKeybinding(c.id,this.contextKeyService)?.getLabel();!u&&o&&(u=this.keybindingService.lookupKeybinding("editor.action.submitComment",this.contextKeyService)?.getLabel());let p=u?`${c.label} (${u})`:c.label,h=this.actionHandler,g=l.length?new ry(this.container,{contextMenuProvider:this.contextMenuService,actions:l,actionRunner:this._toDispose.add(new class extends rs{async runAction(f,v){return h(f)}}),secondary:!o,title:p,addPrimaryActionToDropdown:!1,small:!0,...Qo}):new Wi(this.container,{secondary:!o,title:p,small:!0,...Qo});if(o=!1,this._buttonElements.push(g.element),this._toDispose.add(g),this._toDispose.add(g.onDidClick(()=>this.actionHandler(c))),g.enabled=c.enabled,g.label=c.label,this.maxActions!==void 0&&this._buttonElements.length>=this.maxActions){console.warn("An extension has contributed more than the allowable number of actions to a comments menu.");return}}}}triggerDefaultAction(){if(this._actions.length){let i=this._actions[0];if(i.enabled)return this.actionHandler(i)}}dispose(){this._toDispose.dispose()}};var yy=class extends x{static{this.ID="editor.contrib.menuPreventer"}constructor(i){super(),this._editor=i,this._altListeningMouse=!1,this._altMouseTriggered=!1,this._register(this._editor.onMouseDown(e=>{this._altListeningMouse&&(this._altMouseTriggered=!0)})),this._register(this._editor.onKeyDown(e=>{e.equals(512)&&(this._altListeningMouse||(this._altMouseTriggered=!1),this._altListeningMouse=!0)})),this._register(this._editor.onKeyUp(e=>{e.equals(512)&&(this._altMouseTriggered&&e.preventDefault(),this._altListeningMouse=!1,this._altMouseTriggered=!1)}))}};xo(yy.ID,yy,2);var Lro=new Y("editorDictation.inProgress",!1),Rro=L(8796,"Voice"),rbi=class extends pl{constructor(){super({id:"workbench.action.editorDictation.start",title:L(8792,"Start Dictation in Editor"),category:Rro,precondition:C.and(zB,QJ.toNegated(),pe.readOnly.toNegated()),f1:!0,keybinding:{primary:2612,weight:200,secondary:ei?[603]:void 0}})}runEditorCommand(i,e){let o=i.get(_e).enableKeybindingHoldMode(this.desc.id);if(o){let n=!1,r=setTimeout(()=>{n=!0},500);o.finally(()=>{clearTimeout(r),n&&tx.get(e)?.stop()})}tx.get(e)?.start()}},wYe=class a extends pl{static{this.ID="workbench.action.editorDictation.stop"}constructor(){super({id:a.ID,title:L(8793,"Stop Dictation in Editor"),category:Rro,precondition:Lro,f1:!0,keybinding:{primary:9,weight:300}})}runEditorCommand(i,e){tx.get(e)?.stop()}},sbi=class extends x{constructor(e,t){super();this.editor=e;this.suppressMouseDown=!0;this.allowEditorOverflow=!0;this.domNode=document.createElement("div");let o=this._register(new Zi(this.domNode)),n=t.lookupKeybinding(wYe.ID)?.getLabel();o.push(ii({id:wYe.ID,label:n?d(8794,null,n):d(8795,null),class:q.asClassName(R.micFilled),run:()=>tx.get(e)?.stop()}),{icon:!0,label:!1,keybinding:n}),this.domNode.classList.add("editor-dictation-widget"),this.domNode.appendChild(o.domNode)}getId(){return"editorDictation"}getDomNode(){return this.domNode}getPosition(){if(!this.editor.hasModel())return null;let e=this.editor.getSelection();return{position:e.getPosition(),preference:[e.getPosition().equals(e.getStartPosition())?1:2,0]}}beforeRender(){let e=this.editor.getPosition(),t=e?this.editor.getLineHeightForPosition(e):this.editor.getOption(75),o=this.editor.getLayoutInfo().contentWidth*.7;return this.domNode.style.setProperty("--vscode-editor-dictation-widget-height",`${t}px`),this.domNode.style.setProperty("--vscode-editor-dictation-widget-width",`${o}px`),null}show(){this.editor.addContentWidget(this)}layout(){this.editor.layoutContentWidget(this)}active(){this.domNode.classList.add("recording")}hide(){this.domNode.classList.remove("recording"),this.editor.removeContentWidget(this)}},tx=class extends x{constructor(e,t,o,n){super();this.editor=e;this.speechService=t;this.sessionDisposables=this._register(new me);this.widget=this._register(new sbi(this.editor,n)),this.editorDictationInProgress=Lro.bindTo(o)}static{this.ID="editorDictation"}static get(e){return e.getContribution(tx.ID)}async start(){let e=new N;this.sessionDisposables.value=e,this.widget.show(),e.add(Z(()=>this.widget.hide())),this.editorDictationInProgress.set(!0),e.add(Z(()=>this.editorDictationInProgress.reset()));let t=this.editor.createDecorationsCollection();e.add(Z(()=>t.clear())),e.add(this.editor.onDidChangeCursorPosition(()=>this.widget.layout()));let o,n=0,r=(c,u)=>{o||(o=Ci(this.editor.getPosition()));let p=new ye(o.lineNumber,o.column+c.length);this.editor.executeEdits(tx.ID,[Hn.replace(z.fromPositions(o,o.with(void 0,o.column+n)),c)],[ti.fromPositions(p)]),u?t.set([{range:z.fromPositions(o,o.with(void 0,o.column+c.length)),options:{description:"editor-dictation-preview",inlineClassName:"ghost-text-decoration-preview"}}]):t.clear(),n=c.length,u||(o=void 0,n=0),this.editor.revealPositionInCenterIfOutsideViewport(p)},s=new Ye;e.add(Z(()=>s.dispose(!0)));let l=await this.speechService.createSpeechToTextSession(s.token,"editor");e.add(l.onDidChange(c=>{if(!s.token.isCancellationRequested)switch(c.status){case 1:this.widget.active();break;case 4:e.dispose();break;case 2:{if(!c.text)return;r(c.text,!0);break}case 3:{if(!c.text)return;r(`${c.text} `,!1);break}}}))}stop(){this.sessionDisposables.clear()}};tx=I([m(1,ZC),m(2,X),m(3,_e)],tx);xo(tx.ID,tx,4);W(rbi);W(wYe);var wy=le("snippetService");var abi=class{constructor(i){this.isBogous=!1,this.isTrivial=!1,this.usesClipboardVariable=!1,this.usesSelectionVariable=!1,this.codeSnippet=i;let e=new eg().parse(i,!1),t=new Map,o=0;for(let r of e.placeholders)o=Math.max(o,r.index);if(e.placeholders.length===0)this.isTrivial=!0;else if(o===0){let r=e.children.at(-1);this.isTrivial=r instanceof tk&&r.isFinalTabstop}let n=[...e.children];for(;n.length>0;){let r=n.shift();if(r instanceof hce){if(r.children.length===0&&!SYi[r.name]){let s=t.has(r.name)?t.get(r.name):++o;t.set(r.name,s);let l=new tk(s).appendChild(new pS(r.name));e.replace(r,[l]),this.isBogous=!0}switch(r.name){case"CLIPBOARD":this.usesClipboardVariable=!0;break;case"SELECTION":case"TM_SELECTED_TEXT":this.usesSelectionVariable=!0;break}}else n.push(...r.children)}this.isBogous&&(this.codeSnippet=e.toTextmateString())}},Zue=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h){this.isFileTemplate=i;this.scopes=e;this.name=t;this.prefix=o;this.description=n;this.body=r;this.source=s;this.snippetSource=l;this.snippetIdentifier=c;this.include=u;this.exclude=p;this.extensionId=h;this.prefixLow=o.toLowerCase(),this._bodyInsights=new lO(Ki(),()=>new abi(this.body))}get codeSnippet(){return this._bodyInsights.value.codeSnippet}get isBogous(){return this._bodyInsights.value.isBogous}get isTrivial(){return this._bodyInsights.value.isTrivial}get needsClipboard(){return this._bodyInsights.value.usesClipboardVariable}get usesSelection(){return this._bodyInsights.value.usesSelectionVariable}isFileIncluded(i){let e=i.scheme===Q.file?i.fsPath:i.path,t=jo(e),o=n=>n.includes("/")?e:t;if(this.exclude){for(let n of this.exclude.filter(Boolean))if(Ed(n,o(n),{ignoreCase:!0}))return!1}if(this.include){for(let n of this.include.filter(Boolean))if(Ed(n,o(n),{ignoreCase:!0}))return!0;return!1}return!0}};function r3o(a){return xi(a)&&!!a.body}var z_e=class{constructor(i,e,t,o,n,r){this.source=i;this.location=e;this.defaultScopes=t;this._extension=o;this._fileService=n;this._extensionResourceLoaderService=r;this.data=[];this.isGlobalSnippets=qm(e.path)===".code-snippets",this.isUserSnippets=!this._extension}select(i,e){this.isGlobalSnippets||!this.isUserSnippets?this._scopeSelect(i,e):this._filepathSelect(i,e)}_filepathSelect(i,e){i+".json"===jo(this.location.path)&&e.push(...this.data)}_scopeSelect(i,e){for(let o of this.data){let n=o.scopes.length;if(n===0)e.push(o);else for(let r=0;r<n;r++)if(o.scopes[r]===i){e.push(o);break}}let t=i.lastIndexOf(".");t>=0&&this._scopeSelect(i.substring(0,t),e)}async _load(){return this._extension?this._extensionResourceLoaderService.readExtensionResource(this.location):(await this._fileService.readFile(this.location)).value.toString()}load(){return this._loadPromise||(this._loadPromise=Promise.resolve(this._load()).then(i=>{let e=jr(i);if(pk(e)==="object")for(let[t,o]of Object.entries(e))if(r3o(o))this._parseSnippet(t,o,this.data);else for(let[n,r]of Object.entries(o))this._parseSnippet(n,r,this.data);return this})),this._loadPromise}reset(){this._loadPromise=void 0,this.data.length=0}_parseSnippet(i,e,t){let{isFileTemplate:o,prefix:n,body:r,description:s}=e;if(n||(n=""),Array.isArray(r)&&(r=r.join(`
`)),typeof r!="string")return;Array.isArray(s)&&(s=s.join(`
`));let l;this.defaultScopes?l=this.defaultScopes:typeof e.scope=="string"?l=e.scope.split(",").map(h=>h.trim()).filter(Boolean):l=[];let c;e.include&&(Array.isArray(e.include)?c=e.include:typeof e.include=="string"&&(c=[e.include]));let u;e.exclude&&(Array.isArray(e.exclude)?u=e.exclude:typeof e.exclude=="string"&&(u=[e.exclude]));let p;this._extension?p=this._extension.displayName||this._extension.name:this.source===2?p=d(14234,null):this.isGlobalSnippets?p=d(14233,null):p=d(14232,null);for(let h of vt.wrap(n))t.push(new Zue(!!o,l,i,h,s,r,p,this.source,this._extension?`${Wd(this._extension.extensionLocation,this.location)}/${i}`:`${jo(this.location.path)}/${i}`,c,u,this._extension?.identifier))}};var sZ=[],lbi=[],cbi=[];function CYe(a,i=!1){Aro(a,!1,i)}function Pro(a){Aro(a,!0,!1)}function Aro(a,i,e){let t=s3o(a,i);sZ.push(t),t.userConfigured?cbi.push(t):lbi.push(t),e&&!t.userConfigured&&sZ.forEach(o=>{o.mime===t.mime||o.userConfigured||(t.extension&&o.extension===t.extension&&console.warn(`Overwriting extension <<${t.extension}>> to now point to mime <<${t.mime}>>`),t.filename&&o.filename===t.filename&&console.warn(`Overwriting filename <<${t.filename}>> to now point to mime <<${t.mime}>>`),t.filepattern&&o.filepattern===t.filepattern&&console.warn(`Overwriting filepattern <<${t.filepattern}>> to now point to mime <<${t.mime}>>`),t.firstline&&o.firstline===t.firstline&&console.warn(`Overwriting firstline <<${t.firstline}>> to now point to mime <<${t.mime}>>`))})}function s3o(a,i){return{id:a.id,mime:a.mime,filename:a.filename,extension:a.extension,filepattern:a.filepattern,firstline:a.firstline,userConfigured:i,filepatternParsed:a.filepattern?Ym(a.filepattern,{ignoreCase:!0}):void 0,filepatternOnPath:a.filepattern?a.filepattern.indexOf(Oo.sep)>=0:!1}}function Nro(){sZ=sZ.filter(a=>a.userConfigured),lbi=[]}function Oro(){sZ=sZ.filter(a=>!a.userConfigured),cbi=[]}function K_e(a,i){return Wro(a,i).map(e=>e.mime)}function Fro(a,i){return Wro(a,i).map(e=>e.id)}function Wro(a,i){let e;if(a)switch(a.scheme){case Q.file:e=a.fsPath;break;case Q.data:{e=V$.parseMetaData(a).get(V$.META_DATA_LABEL);break}case Q.vscodeNotebookCell:e=void 0;break;default:e=a.path}if(!e)return[{id:"unknown",mime:tr.unknown}];e=e.toLowerCase();let t=jo(e),o=Mro(e,t,cbi);if(o)return[o,{id:$r,mime:tr.text}];let n=Mro(e,t,lbi);if(n)return[n,{id:$r,mime:tr.text}];if(i){let r=a3o(i);if(r)return[r,{id:$r,mime:tr.text}]}return[{id:"unknown",mime:tr.unknown}]}function Mro(a,i,e){let t,o,n;for(let r=e.length-1;r>=0;r--){let s=e[r];if(EGi(i,s.filename,!0)){t=s;break}if(s.filepattern&&(!o||s.filepattern.length>o.filepattern.length)){let l=s.filepatternOnPath?a:i;s.filepatternParsed?.(l)&&(o=s)}s.extension&&(!n||s.extension.length>n.extension.length)&&Hht(i,s.extension)&&(n=s)}if(t)return t;if(o)return o;if(n)return n}function a3o(a){if(Ght(a)&&(a=a.substring(1)),a.length>0)for(let i=sZ.length-1;i>=0;i--){let e=sZ[i];if(!e.firstline)continue;let t=a.match(e.firstline);if(t&&t.length>0)return e}}var QB=Object.prototype.hasOwnProperty,Vro="vs.editor.nullLanguage",dbi=class{constructor(){this._languageIdToLanguage=[];this._languageToLanguageId=new Map;this._register(Vro,0),this._register($r,1),this._nextLanguageId=2}_register(i,e){this._languageIdToLanguage[e]=i,this._languageToLanguageId.set(i,e)}register(i){if(this._languageToLanguageId.has(i))return;let e=this._nextLanguageId++;this._register(i,e)}encodeLanguageId(i){return this._languageToLanguageId.get(i)||0}decodeLanguageId(i){return this._languageIdToLanguage[i]||Vro}},gAt=class a extends x{constructor(e=!0,t=!1){super();this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;a.instanceCount++,this._warnOnOverwrite=t,this.languageIdCodec=new dbi,this._dynamicLanguages=[],this._languages={},this._mimeTypesMap={},this._nameMap={},this._lowercaseNameMap={},e&&(this._initializeFromRegistry(),this._register(wP.onDidChangeLanguages(o=>{this._initializeFromRegistry()})))}static{this.instanceCount=0}dispose(){a.instanceCount--,super.dispose()}setDynamicLanguages(e){this._dynamicLanguages=e,this._initializeFromRegistry()}_initializeFromRegistry(){this._languages={},this._mimeTypesMap={},this._nameMap={},this._lowercaseNameMap={},Nro();let e=[].concat(wP.getLanguages()).concat(this._dynamicLanguages);this._registerLanguages(e)}registerLanguage(e){return wP.registerLanguage(e)}_registerLanguages(e){for(let t of e)this._registerLanguage(t);this._mimeTypesMap={},this._nameMap={},this._lowercaseNameMap={},Object.keys(this._languages).forEach(t=>{let o=this._languages[t];o.name&&(this._nameMap[o.name]=o.identifier),o.aliases.forEach(n=>{this._lowercaseNameMap[n.toLowerCase()]=o.identifier}),o.mimetypes.forEach(n=>{this._mimeTypesMap[n]=o.identifier})}),ne.as(Jt.Configuration).registerOverrideIdentifiers(this.getRegisteredLanguageIds()),this._onDidChange.fire()}_registerLanguage(e){let t=e.id,o;QB.call(this._languages,t)?o=this._languages[t]:(this.languageIdCodec.register(t),o={identifier:t,name:null,mimetypes:[],aliases:[],extensions:[],filenames:[],configurationFiles:[],icons:[]},this._languages[t]=o),this._mergeLanguage(o,e)}_mergeLanguage(e,t){let o=t.id,n=null;if(Array.isArray(t.mimetypes)&&t.mimetypes.length>0&&(e.mimetypes.push(...t.mimetypes),n=t.mimetypes[0]),n||(n=`text/x-${o}`,e.mimetypes.push(n)),Array.isArray(t.extensions)){t.configuration?e.extensions=t.extensions.concat(e.extensions):e.extensions=e.extensions.concat(t.extensions);for(let l of t.extensions)CYe({id:o,mime:n,extension:l},this._warnOnOverwrite)}if(Array.isArray(t.filenames))for(let l of t.filenames)CYe({id:o,mime:n,filename:l},this._warnOnOverwrite),e.filenames.push(l);if(Array.isArray(t.filenamePatterns))for(let l of t.filenamePatterns)CYe({id:o,mime:n,filepattern:l},this._warnOnOverwrite);if(typeof t.firstLine=="string"&&t.firstLine.length>0){let l=t.firstLine;l.charAt(0)!=="^"&&(l="^"+l);try{let c=new RegExp(l);cIe(c)||CYe({id:o,mime:n,firstline:c},this._warnOnOverwrite)}catch(c){console.warn(`[${t.id}]: Invalid regular expression \`${l}\`: `,c)}}e.aliases.push(o);let r=null;if(typeof t.aliases<"u"&&Array.isArray(t.aliases)&&(t.aliases.length===0?r=[null]:r=t.aliases),r!==null)for(let l of r)!l||l.length===0||e.aliases.push(l);let s=r!==null&&r.length>0;if(!(s&&r[0]===null)){let l=(s?r[0]:null)||o;(s||!e.name)&&(e.name=l)}t.configuration&&e.configurationFiles.push(t.configuration),t.icon&&e.icons.push(t.icon)}isRegisteredLanguageId(e){return e?QB.call(this._languages,e):!1}getRegisteredLanguageIds(){return Object.keys(this._languages)}getSortedRegisteredLanguageNames(){let e=[];for(let t in this._nameMap)QB.call(this._nameMap,t)&&e.push({languageName:t,languageId:this._nameMap[t]});return e.sort((t,o)=>OI(t.languageName,o.languageName)),e}getLanguageName(e){return QB.call(this._languages,e)?this._languages[e].name:null}getMimeType(e){return QB.call(this._languages,e)&&this._languages[e].mimetypes[0]||null}getExtensions(e){return QB.call(this._languages,e)?this._languages[e].extensions:[]}getFilenames(e){return QB.call(this._languages,e)?this._languages[e].filenames:[]}getIcon(e){return QB.call(this._languages,e)&&this._languages[e].icons[0]||null}getConfigurationFiles(e){return QB.call(this._languages,e)?this._languages[e].configurationFiles||[]:[]}getLanguageIdByLanguageName(e){let t=e.toLowerCase();return QB.call(this._lowercaseNameMap,t)?this._lowercaseNameMap[t]:null}getLanguageIdByMimeType(e){return e&&QB.call(this._mimeTypesMap,e)?this._mimeTypesMap[e]:null}guessLanguageIdByFilepathOrFirstLine(e,t){return!e&&!t?[]:Fro(e,t)}};var fAt=class a extends x{constructor(e=!1){super();this._onDidRequestBasicLanguageFeatures=this._register(new E);this.onDidRequestBasicLanguageFeatures=this._onDidRequestBasicLanguageFeatures.event;this._onDidRequestRichLanguageFeatures=this._register(new E);this.onDidRequestRichLanguageFeatures=this._onDidRequestRichLanguageFeatures.event;this._onDidChange=this._register(new E({leakWarningThreshold:200}));this.onDidChange=this._onDidChange.event;this._requestedBasicLanguages=new Set;this._requestedRichLanguages=new Set;a.instanceCount++,this._registry=this._register(new gAt(!0,e)),this.languageIdCodec=this._registry.languageIdCodec,this._register(this._registry.onDidChange(()=>this._onDidChange.fire()))}static{this.instanceCount=0}dispose(){a.instanceCount--,super.dispose()}registerLanguage(e){return this._registry.registerLanguage(e)}isRegisteredLanguageId(e){return this._registry.isRegisteredLanguageId(e)}getRegisteredLanguageIds(){return this._registry.getRegisteredLanguageIds()}getSortedRegisteredLanguageNames(){return this._registry.getSortedRegisteredLanguageNames()}getLanguageName(e){return this._registry.getLanguageName(e)}getMimeType(e){return this._registry.getMimeType(e)}getIcon(e){return this._registry.getIcon(e)}getExtensions(e){return this._registry.getExtensions(e)}getFilenames(e){return this._registry.getFilenames(e)}getConfigurationFiles(e){return this._registry.getConfigurationFiles(e)}getLanguageIdByLanguageName(e){return this._registry.getLanguageIdByLanguageName(e)}getLanguageIdByMimeType(e){return this._registry.getLanguageIdByMimeType(e)}guessLanguageIdByFilepathOrFirstLine(e,t){return this._registry.guessLanguageIdByFilepathOrFirstLine(e,t).at(0)??null}createById(e){return new xYe(this.onDidChange,()=>this._createAndGetLanguageIdentifier(e))}createByMimeType(e){return new xYe(this.onDidChange,()=>{let t=this.getLanguageIdByMimeType(e);return this._createAndGetLanguageIdentifier(t)})}createByFilepathOrFirstLine(e,t){return new xYe(this.onDidChange,()=>{let o=this.guessLanguageIdByFilepathOrFirstLine(e,t);return this._createAndGetLanguageIdentifier(o)})}_createAndGetLanguageIdentifier(e){return(!e||!this.isRegisteredLanguageId(e))&&(e=$r),e}requestBasicLanguageFeatures(e){this._requestedBasicLanguages.has(e)||(this._requestedBasicLanguages.add(e),this._onDidRequestBasicLanguageFeatures.fire(e))}requestRichLanguageFeatures(e){this._requestedRichLanguages.has(e)||(this._requestedRichLanguages.add(e),this.requestBasicLanguageFeatures(e),ic.getOrCreate(e),this._onDidRequestRichLanguageFeatures.fire(e))}},xYe=class{constructor(i,e){this._value=ui(this,i,()=>e()),this.onDidChange=U.fromObservable(this._value)}get languageId(){return this._value.get()}};var j4=Rn.registerExtensionPoint({extensionPoint:"languages",jsonSchema:{description:d(17855,null),type:"array",items:{type:"object",defaultSnippets:[{body:{id:"${1:languageId}",aliases:["${2:label}"],extensions:["${3:extension}"],configuration:"./language-configuration.json"}}],properties:{id:{description:d(17865,null),type:"string"},aliases:{description:d(17856,null),type:"array",items:{type:"string"}},extensions:{description:d(17858,null),default:[".foo"],type:"array",items:{type:"string"}},filenames:{description:d(17860,null),type:"array",items:{type:"string"}},filenamePatterns:{description:d(17859,null),type:"array",items:{type:"string"}},mimetypes:{description:d(17866,null),type:"array",items:{type:"string"}},firstLine:{description:d(17861,null),type:"string"},configuration:{description:d(17857,null),type:"string",default:"./language-configuration.json"},icon:{type:"object",description:d(17862,null),properties:{light:{description:d(17864,null),type:"string"},dark:{description:d(17863,null),type:"string"}}}}}},activationEventsGenerator:function*(a){for(let i of a)i.id&&i.configuration&&(yield`onLanguage:${i.id}`)}}),ubi=class extends x{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.languages}render(e){let t=e.contributes,o=t?.languages||[],n=[];for(let p of o)Bro(p)&&n.push({id:p.id,name:(p.aliases||[])[0]||p.id,extensions:p.extensions||[],hasGrammar:!1,hasSnippets:!1});let r=L9(n,p=>p.id);if((t?.grammars||[]).forEach(p=>{if(!Fe(p.language))return;let h=r[p.language];h?h.hasGrammar=!0:(h={id:p.language,name:p.language,extensions:[],hasGrammar:!0,hasSnippets:!1},r[h.id]=h,n.push(h))}),(t?.snippets||[]).forEach(p=>{if(!Fe(p.language))return;let h=r[p.language];h?h.hasSnippets=!0:(h={id:p.language,name:p.language,extensions:[],hasGrammar:!1,hasSnippets:!0},r[h.id]=h,n.push(h))}),!n.length)return{data:{headers:[],rows:[]},dispose:()=>{}};let c=[d(17843,null),d(17844,null),d(17839,null),d(17840,null),d(17854,null)],u=n.sort((p,h)=>p.id.localeCompare(h.id)).map(p=>[p.id,p.name,new Ie().appendMarkdown(`${p.extensions.map(h=>`\`${h}\``).join("&nbsp;")}`),p.hasGrammar?"\u2714\uFE0E":"\u2014",p.hasSnippets?"\u2714\uFE0E":"\u2014"]);return{data:{headers:c,rows:u},dispose:()=>{}}}};ne.as(As.ExtensionFeaturesRegistry).registerExtensionFeature({id:"languages",label:d(17845,null),access:{canToggle:!1},renderer:new Ft(ubi)});var kYe=class extends fAt{constructor(e,t,o,n){super(o.verbose||o.isExtensionDevelopment||!o.isBuilt);this.logService=n;this._configurationService=t,this._extensionService=e,j4.setHandler(r=>{let s=[];for(let l=0,c=r.length;l<c;l++){let u=r[l];if(!Array.isArray(u.value)){u.collector.error(d(17841,null,j4.name));continue}for(let p=0,h=u.value.length;p<h;p++){let g=u.value[p];if(Bro(g,u.collector)){let f;g.configuration&&(f=Ge(u.description.extensionLocation,g.configuration)),s.push({id:g.id,extensions:g.extensions,filenames:g.filenames,filenamePatterns:g.filenamePatterns,firstLine:g.firstLine,aliases:g.aliases,mimetypes:g.mimetypes,configuration:f,icon:g.icon&&{light:Ge(u.description.extensionLocation,g.icon.light),dark:Ge(u.description.extensionLocation,g.icon.dark)}})}}}this._registry.setDynamicLanguages(s)}),this.updateMime(),this._register(this._configurationService.onDidChangeConfiguration(r=>{r.affectsConfiguration(yj)&&this.updateMime()})),this._extensionService.whenInstalledExtensionsRegistered().then(()=>{this.updateMime()}),this._register(this.onDidRequestRichLanguageFeatures(r=>{this._extensionService.activateByEvent(`onLanguage:${r}`),this._extensionService.activateByEvent("onLanguage")}))}updateMime(){let e=this._configurationService.getValue();Oro(),e.files?.associations&&Object.keys(e.files.associations).forEach(t=>{let o=e.files.associations[t];if(typeof o!="string"){this.logService.warn(`Ignoring configured 'files.associations' for '${t}' because its type is not a string but '${typeof o}'`);return}let n=this.getMimeType(o)||`text/x-${o}`;Pro({id:o,mime:n,filepattern:t})}),this._onDidChange.fire()}};kYe=I([m(0,lt),m(1,B),m(2,Eo),m(3,se)],kYe);function vAt(a){return typeof a>"u"?!0:Array.isArray(a)?a.every(i=>typeof i=="string"):!1}function Bro(a,i){return a?typeof a.id!="string"?(i?.error(d(17853,null,"id")),!1):vAt(a.extensions)?vAt(a.filenames)?typeof a.firstLine<"u"&&typeof a.firstLine!="string"?(i?.error(d(17850,null,"firstLine")),!1):typeof a.configuration<"u"&&typeof a.configuration!="string"?(i?.error(d(17847,null,"configuration")),!1):vAt(a.aliases)?vAt(a.mimetypes)?typeof a.icon<"u"&&(typeof a.icon!="object"||typeof a.icon.light!="string"||typeof a.icon.dark!="string")?(i?.error(d(17851,null,"icon","light","dark")),!1):!0:(i?.error(d(17852,null,"mimetypes")),!1):(i?.error(d(17846,null,"aliases")),!1):(i?.error(d(17849,null,"filenames")),!1):(i?.error(d(17848,null,"extensions")),!1):(i?.error(d(17842,null,j4.name)),!1)}Ee(_t,kYe,0);var Hro="_snippet.markAsUsed";$e.registerCommand(Hro,(a,...i)=>{let e=a.get(wy),[t]=i;t instanceof Zue&&e.updateUsageTimestamp(t)});var aZ=class{constructor(i,e){this.snippet=i;this.label={label:i.prefix,description:i.name},this.detail=d(14213,null,i.description||i.name,i.source),this.insertText=i.codeSnippet,this.extensionId=i.extensionId,this.range=e,this.sortText=`${i.snippetSource===3?"z":"a"}-${i.prefix}`,this.kind=28,this.insertTextRules=4,this.command={id:Hro,title:"",arguments:[i]}}resolve(){return this.documentation=new Ie().appendCodeblock("",eg.asInsertText(this.snippet.codeSnippet)),this}static compareByLabel(i,e){return Hl(i.label.label,e.label.label)}},G_e=class{constructor(i,e,t){this._languageService=i;this._snippets=e;this._languageConfigurationService=t;this._debugDisplayName="snippetCompletions"}async provideCompletionItems(i,e,t){let o=new Dn,n=e.lineNumber,r=i.getWordAtPosition(e)??{startColumn:e.column,endColumn:e.column,word:""},s=i.getLineContent(e.lineNumber).toLowerCase(),l=s.substring(0,r.startColumn+r.word.length-1),c=this._computeSnippetPositions(i,n,r,l),u=e.column-1,p=t.triggerCharacter?.toLowerCase()??"",h=this._getLanguageIdAtPosition(i,e),g=this._languageConfigurationService.getLanguageConfiguration(h),f=new Set(await this._snippets.getSnippets(h,i.uri)),v=[];for(let b of f){if(t.triggerKind===1&&!b.prefixLow.startsWith(p))continue;let S;for(let H of c)if(!(H.prefixLow.match(/^\s/)&&!b.prefixLow.match(/^\s/))&&SCe(H.prefixLow,0,H.prefixLow.length,b.prefixLow,0,b.prefixLow.length)){S=H;break}if(!S)continue;let y=S.startColumn-1,w=b.prefixLow.length-(u-y),k=dIe(s,b.prefixLow,u,u+w,u-y),T=e.with(void 0,y+1),P=k===0?e.column+w:e.column;u<s.length&&g.getAutoClosingPairs().autoClosingPairsCloseSingleChar.get(s[u])?.some($=>$.open===s[T.column-1]&&b.prefix.startsWith($.open)&&b.prefix[b.prefix.length-1]===$.close)&&P++;let O=z.fromPositions({lineNumber:n,column:S.startColumn},{lineNumber:n,column:P}),V=O.setEndPosition(n,e.column);v.push(new aZ(b,{replace:O,insert:V})),f.delete(b)}if(!p&&(/\s/.test(s[e.column-2])||!s))for(let b of f){let S=z.fromPositions(e),y=s.indexOf(b.prefixLow,u)===u?S.setEndPosition(e.lineNumber,e.column+b.prefixLow.length):S;v.push(new aZ(b,{replace:y,insert:S}))}return this._disambiguateSnippets(v),{suggestions:v,duration:o.elapsed()}}_disambiguateSnippets(i){i.sort(aZ.compareByLabel);for(let e=0;e<i.length;e++){let t=i[e],o=e+1;for(;o<i.length&&t.label===i[o].label;o++)i[o].label.label=d(14214,null,i[o].label.label,i[o].snippet.name);o>e+1&&(i[e].label.label=d(14214,null,i[e].label.label,i[e].snippet.name),e=o)}}resolveCompletionItem(i){return i instanceof aZ?i.resolve():i}_computeSnippetPositions(i,e,t,o){let n=[];for(let r=1;r<t.startColumn;r++){let s=i.getWordAtPosition(new ye(e,r));n.push({startColumn:r,prefixLow:o.substring(r-1),isWord:!!s}),s&&(r=s.endColumn,n.push({startColumn:s.endColumn,prefixLow:o.substring(s.endColumn-1),isWord:!1}))}return(t.word.length>0||n.length===0)&&n.push({startColumn:t.startColumn,prefixLow:o.substring(t.startColumn-1),isWord:!0}),n}_getLanguageIdAtPosition(i,e){i.tokenization.tokenizeIfCheap(e.lineNumber);let t=i.getLanguageIdAtPosition(e.lineNumber,e.column);return this._languageService.getLanguageName(t)||(t=i.getLanguageId()),t}};G_e=I([m(0,_t),m(1,wy),m(2,Rs)],G_e);var ln=le("IUserDataProfileService"),vT=le("IUserDataProfileManagementService");var EYe="profile";function Uro(a,i){return A.from({scheme:i.urlProtocol,authority:EYe,path:a.startsWith("/")?a:`/${a}`})}var pbi="profile-";function q_e(a){return a.authority===EYe||new RegExp(`^${pbi}`).test(a.authority)}var YB=le("IUserDataProfileImportExportService"),zro=Ae("defaultProfile-icon",R.settings,d(18269,null)),mbi=L(18271,"Profiles"),n0={...mbi},TYe="code-profile",_Ye=[{name:d(18270,null),extensions:[TYe]}],DYe=new Y("currentProfile",""),Kro=new Y("isCurrentProfileTransient",!1),Q4=new Y("hasProfiles",!1);var hbi;(t=>{function a(o,n,r){if(uc(n.path))return o.collector.error(d(14239,null,o.description.name,String(n.path))),null;if(uc(n.language)&&!n.path.endsWith(".code-snippets"))return o.collector.error(d(14238,null,o.description.name,String(n.path))),null;if(!uc(n.language)&&!r.isRegisteredLanguageId(n.language))return o.collector.error(d(14237,null,o.description.name,String(n.language))),null;let s=o.description.extensionLocation,l=Ge(s,n.path);return ws(l,s)?{language:n.language,location:l}:(o.collector.error(d(14240,null,o.description.name,l.path,s.path)),null)}t.toValidSnippet=a,t.snippetsContribution={description:d(14241,null),type:"array",defaultSnippets:[{body:[{language:"",path:""}]}],items:{type:"object",defaultSnippets:[{body:{language:"${1:id}",path:"./snippets/${2:id}.json."}}],properties:{language:{description:d(14242,null),type:"string"},path:{description:d(14243,null),type:"string"}}}},t.point=Rn.registerExtensionPoint({extensionPoint:"snippets",deps:[j4],jsonSchema:t.snippetsContribution})})(hbi||={});function l3o(a,i,e){return wn(a.watch(i),a.onDidFilesChange(t=>{t.affects(i)&&e()}))}var lZ=class{constructor(i){this._storageService=i;let e=i.get(lZ._key,0,""),t;try{t=JSON.parse(e)}catch{}this._ignored=HS(t)?new Set(t):new Set}static{this._key="snippets.ignoredSnippets"}isIgnored(i){return this._ignored.has(i)}updateIgnored(i,e){let t=!1;this._ignored.has(i)&&!e?(this._ignored.delete(i),t=!0):!this._ignored.has(i)&&e&&(this._ignored.add(i),t=!0),t&&this._storageService.store(lZ._key,JSON.stringify(Array.from(this._ignored)),0,0)}};lZ=I([m(0,ce)],lZ);var cZ=class{constructor(i){this._storageService=i;let e=i.get(cZ._key,0,""),t;try{t=JSON.parse(e)}catch{t=[]}this._usages=Array.isArray(t)?new Map(t):new Map}static{this._key="snippets.usageTimestamps"}getUsageTimestamp(i){return this._usages.get(i)}updateUsageTimestamp(i){this._usages.delete(i),this._usages.set(i,Date.now());let e=[...this._usages].slice(-100);this._storageService.store(cZ._key,JSON.stringify(e),0,0)}};cZ=I([m(0,ce)],cZ);var $_e=class{constructor(i,e,t,o,n,r,s,l,c,u,p){this._environmentService=i;this._userDataProfileService=e;this._contextService=t;this._languageService=o;this._logService=n;this._fileService=r;this._textfileService=s;this._extensionResourceLoaderService=l;this._disposables=new N;this._pendingWork=[];this._files=new gt;this._pendingWork.push(Promise.resolve(c.when(3).then(()=>{this._initExtensionSnippets(),this._initUserSnippets(),this._initWorkspaceSnippets()}))),gYi(new G_e(this._languageService,this,p)),this._enablement=u.createInstance(lZ),this._usageTimestamps=u.createInstance(cZ)}dispose(){this._disposables.dispose()}isEnabled(i){return!this._enablement.isIgnored(i.snippetIdentifier)}updateEnablement(i,e){this._enablement.updateIgnored(i.snippetIdentifier,!e)}updateUsageTimestamp(i){this._usageTimestamps.updateUsageTimestamp(i.snippetIdentifier)}_joinSnippets(){let i=this._pendingWork.slice(0);return this._pendingWork.length=0,Promise.all(i)}async getSnippetFiles(){return await this._joinSnippets(),this._files.values()}async getSnippets(i,e,t){await this._joinSnippets();let o=[],n=[];if(i){if(this._languageService.isRegisteredLanguageId(i))for(let r of this._files.values())n.push(r.load().then(s=>s.select(i,o)).catch(s=>this._logService.error(s,r.location.toString())))}else for(let r of this._files.values())n.push(r.load().then(s=>Nse(o,o.length,s.data)).catch(s=>this._logService.error(s,r.location.toString())));return await Promise.all(n),this._filterAndSortSnippets(o,e,t)}getSnippetsSync(i,e,t){let o=[];if(this._languageService.isRegisteredLanguageId(i))for(let n of this._files.values())n.load().catch(r=>{}),n.select(i,o);return this._filterAndSortSnippets(o,e,t)}_filterAndSortSnippets(i,e,t){let o=[];for(let n of i)!n.prefix&&!t?.includeNoPrefixSnippets||!this.isEnabled(n)&&!t?.includeDisabledSnippets||typeof t?.fileTemplateSnippets=="boolean"&&t.fileTemplateSnippets!==n.isFileTemplate||e&&!n.isFileIncluded(e)||o.push(n);return o.sort((n,r)=>{let s=0;if(!t?.noRecencySort){let l=this._usageTimestamps.getUsageTimestamp(n.snippetIdentifier)??-1;s=(this._usageTimestamps.getUsageTimestamp(r.snippetIdentifier)??-1)-l}return s===0&&(s=this._compareSnippet(n,r)),s})}_compareSnippet(i,e){return i.snippetSource<e.snippetSource?-1:i.snippetSource>e.snippetSource?1:i.source<e.source?-1:i.source>e.source||i.name>e.name?1:i.name<e.name?-1:0}_initExtensionSnippets(){hbi.point.setHandler(i=>{for(let[e,t]of this._files)t.source===3&&this._files.delete(e);for(let e of i)for(let t of e.value){let o=hbi.toValidSnippet(e,t,this._languageService);if(!o)continue;let n=this._files.get(o.location);if(n)n.defaultScopes?n.defaultScopes.push(o.language):n.defaultScopes=[];else{let r=new z_e(3,o.location,o.language?[o.language]:void 0,e.description,this._fileService,this._extensionResourceLoaderService);this._files.set(r.location,r),this._environmentService.isExtensionDevelopment&&r.load().then(s=>{s.data.some(l=>l.isBogous)&&e.collector.warn(d(14236,null,e.description.name))},s=>{e.collector.warn(d(14235,null,r.location.toString()))})}}})}_initWorkspaceSnippets(){let i=new N,e=()=>{i.clear(),this._pendingWork.push(this._initWorkspaceFolderSnippets(this._contextService.getWorkspace(),i))};this._disposables.add(i),this._disposables.add(this._contextService.onDidChangeWorkspaceFolders(e)),this._disposables.add(this._contextService.onDidChangeWorkbenchState(e)),e()}async _initWorkspaceFolderSnippets(i,e){let t=i.folders.map(async o=>{let n=o.toResource(".vscode");await this._fileService.exists(n)?this._initFolderSnippets(2,n,e):e.add(this._fileService.onDidFilesChange(s=>{s.contains(n,1)&&this._initFolderSnippets(2,n,e)}))});await Promise.all(t)}async _initUserSnippets(){let i=new N,e=async()=>{i.clear();let t=this._userDataProfileService.currentProfile.snippetsHome;await this._fileService.createFolder(t),await this._initFolderSnippets(1,t,i)};this._disposables.add(i),this._disposables.add(this._userDataProfileService.onDidChangeCurrentProfile(t=>t.join((async()=>{this._pendingWork.push(e())})()))),await e()}_initFolderSnippets(i,e,t){let o=new N,n=async()=>{if(o.clear(),!!await this._fileService.exists(e))try{let r=await this._fileService.resolve(e);for(let s of r.children||[])o.add(this._addSnippetFile(s.resource,i))}catch(r){this._logService.error(`Failed snippets from folder '${e.toString()}'`,r)}};return t.add(this._textfileService.files.onDidSave(r=>{ws(r.model.resource,e)&&n()})),t.add(l3o(this._fileService,e,n)),t.add(o),n()}_addSnippetFile(i,e){let t=es(i);if(e===1&&t===".json"){let o=He(i).replace(/\.json/,"");this._files.set(i,new z_e(e,i,[o],void 0,this._fileService,this._extensionResourceLoaderService))}else t===".code-snippets"&&this._files.set(i,new z_e(e,i,void 0,void 0,this._fileService,this._extensionResourceLoaderService));return{dispose:()=>this._files.delete(i)}}};$_e=I([m(0,Eo),m(1,ln),m(2,Pe),m(3,_t),m(4,se),m(5,fe),m(6,Uo),m(7,mk),m(8,ji),m(9,F),m(10,Rs)],$_e);function Gro(a,i){let t=a.getLineContent(i.lineNumber).substr(0,i.column-1),o=Math.max(0,t.length-100);for(let n=t.length-1;n>=o;n--){let r=t.charAt(n);if(/\s/.test(r))return t.substr(n+1)}return o===0?t:""}var Cy=class{constructor(i,e,t,o,n){this._editor=i;this._snippetService=e;this._clipboardService=t;this._languageFeaturesService=o;this._activeSnippets=[];this._hasSnippets=Cy.ContextKey.bindTo(n),this._configListener=this._editor.onDidChangeConfiguration(r=>{r.hasChanged(139)&&this._update()}),this._update()}static{this.ID="editor.tabCompletionController"}static{this.ContextKey=new Y("hasSnippetCompletions",void 0)}static get(i){return i.getContribution(Cy.ID)}dispose(){this._configListener.dispose(),this._selectionListener?.dispose()}_update(){let i=this._editor.getOption(139)==="onlySnippets";this._enabled!==i&&(this._enabled=i,this._enabled?(this._selectionListener=this._editor.onDidChangeCursorSelection(e=>this._updateSnippets()),this._editor.getModel()&&this._updateSnippets()):this._selectionListener?.dispose())}_updateSnippets(){if(this._activeSnippets=[],this._completionProvider?.dispose(),!this._editor.hasModel())return;let i=this._editor.getSelection(),e=this._editor.getModel();e.tokenization.tokenizeIfCheap(i.positionLineNumber);let t=e.getLanguageIdAtPosition(i.positionLineNumber,i.positionColumn),o=this._snippetService.getSnippetsSync(t,e.uri);if(!o){this._hasSnippets.set(!1);return}if(z.isEmpty(i)){let r=Gro(e,i.getPosition());if(r)for(let s of o)r.endsWith(s.prefix)&&this._activeSnippets.push(s)}else if(!z.spansMultipleLines(i)&&e.getValueLengthInRange(i)<=100){let r=e.getValueInRange(i);if(r)for(let s of o)r===s.prefix&&this._activeSnippets.push(s)}let n=this._activeSnippets.length;if(n===0)this._hasSnippets.set(!1);else if(n===1)this._hasSnippets.set(!0);else{this._hasSnippets.set(!0),this._completionProvider={_debugDisplayName:"tabCompletion",dispose:()=>{r.dispose()},provideCompletionItems:(s,l)=>s!==e||!i.containsPosition(l)?void 0:{suggestions:this._activeSnippets.map(u=>{let p=z.fromPositions(l.delta(0,-u.prefix.length),l);return new aZ(u,p)})}};let r=this._languageFeaturesService.completionProvider.register({language:e.getLanguageId(),pattern:e.uri.fsPath,scheme:e.uri.scheme},this._completionProvider)}}async performSnippetCompletions(){if(this._editor.hasModel())if(this._activeSnippets.length===1){let[i]=this._activeSnippets,e;if(i.needsClipboard){let t=new Mz(this._editor,5);if(e=await this._clipboardService.readText(),!t.validate(this._editor))return}vs.get(this._editor)?.insert(i.codeSnippet,{overwriteBefore:i.prefix.length,overwriteAfter:0,clipboardText:e})}else this._activeSnippets.length>1&&this._completionProvider&&ikt(this._editor,this._completionProvider)}};Cy=I([m(1,wy),m(2,Fi),m(3,Qt),m(4,X)],Cy);xo(Cy.ID,Cy,0);var c3o=Oc.bindToContribution(Cy.get);Xi(new c3o({id:"insertSnippet",precondition:Cy.ContextKey,handler:a=>a.performSnippetCompletions(),kbOpts:{weight:100,kbExpr:C.and(pe.editorTextFocus,pe.tabDoesNotMoveFocus,vs.InSnippetMode.toNegated()),primary:2}}));var xy="editor.contrib.selectionClipboard";var j_e=new Y("commentEditorFocused",!1),epe=90,d3o=450,wD=class extends Xr{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g){let f={contributions:[{id:yy.ID,ctor:yy,instantiation:2},{id:og.ID,ctor:og,instantiation:2},{id:nc.ID,ctor:nc,instantiation:0},{id:vs.ID,ctor:vs,instantiation:4},{id:Cy.ID,ctor:Cy,instantiation:0},{id:tx.ID,ctor:tx,instantiation:4},...Ba.getSomeEditorContributions([ku.ID,fh.ID,dk.ID,xu.ID,Pl.ID,ff.ID,xy,Hc.ID,Cp.ID,mB.ID])],contextMenuId:D.SimpleEditorContext};super(i,e,f,n,r,s,t,l,c,u,p,h,g),this._commentEditorFocused=j_e.bindTo(t),this._commentEditorEmpty=_c.commentIsEmpty.bindTo(t),this._commentEditorEmpty.set(!this.getModel()?.getValueLength()),this._parentThread=o,this._register(this.onDidFocusEditorWidget(v=>this._commentEditorFocused.set(!0))),this._register(this.onDidChangeModelContent(v=>this._commentEditorEmpty.set(!this.getModel()?.getValueLength()))),this._register(this.onDidBlurEditorWidget(v=>this._commentEditorFocused.reset()))}getParentThread(){return this._parentThread}_getActions(){return Ba.getEditorActions()}updateOptions(i){let e={...i,lineNumbers:"off"};super.updateOptions(e)}static getEditorOptions(i){return{wordWrap:"on",glyphMargin:!1,lineNumbers:"off",folding:!1,selectOnLineNumbers:!1,scrollbar:{vertical:"visible",verticalScrollbarSize:14,horizontal:"auto",useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,alwaysConsumeMouseWheel:!1},overviewRulerLanes:2,lineDecorationsWidth:0,scrollBeyondLastLine:!1,renderLineHighlight:"none",fixedOverflowWidgets:!0,acceptSuggestionOnEnter:"smart",minimap:{enabled:!1},dropIntoEditor:{enabled:!0},autoClosingBrackets:i.getValue("editor.autoClosingBrackets"),quickSuggestions:!1,accessibilitySupport:i.getValue("editor.accessibilitySupport"),fontFamily:i.getValue("editor.fontFamily"),fontSize:i.getValue("editor.fontSize"),allowVariableLineHeights:!1}}};wD=I([m(4,F),m(5,qt),m(6,ge),m(7,Le),m(8,Ne),m(9,Oi),m(10,Rs),m(11,Qt),m(12,_C)],wD);function SAt(a,i,e){let t=i.getLayoutInfo(),o=i.getOption(75),n=i._getViewModel()?.getLineCount()*o;if(n>t.height||n<t.height&&e>epe){let r=Math.ceil((n-t.height)/o),s=t.height+o*r;return Bn(s,epe,Bn(a.getLayoutInfo().height-90,epe,d3o))}return e}var u3o=0,IAt="commenteditordecoration",Q_e=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w){super();this.owner=e;this._parentEditor=o;this._commentThread=n;this._scopedInstatiationService=r;this._contextKeyService=s;this._commentMenus=l;this._commentOptions=c;this._pendingComment=u;this._parentThread=p;this._actionRunDelegate=g;this.commentService=f;this.keybindingService=b;this.contextMenuService=S;this.hoverService=y;this.textModelService=w;this._commentThreadDisposables=[];this._editorHeight=epe;this._container=M(t,_(".comment-form-container")),this._form=M(this._container,_(".comment-form")),this.commentEditor=this._register(this._scopedInstatiationService.createInstance(wD,this._form,wD.getEditorOptions(v),s,this._parentThread)),this.commentEditorIsEmpty=_c.commentIsEmpty.bindTo(this._contextKeyService),this.commentEditorIsEmpty.set(!this._pendingComment),this.initialize(h)}async initialize(e){this.avatar=M(this._form,_(".avatar-container")),this.updateAuthorInfo();let t=this._commentThread.comments&&this._commentThread.comments.length>0,o=xt()+"-"+(t?this._commentThread.threadId:++u3o),n=JSON.stringify({extensionId:this._commentThread.extensionId,commentThreadId:this._commentThread.threadId}),r=A.from({scheme:Q.commentsInput,path:`/${this._commentThread.extensionId}/commentinput-${o}.md?${n}`}),s=this.commentService.getCommentController(this.owner);s&&(r=r.with({authority:s.id}));let l=await this.textModelService.createModelReference(r);l.object.textEditorModel.setValue(this._pendingComment?.body||""),this._register(l),this.commentEditor.setModel(l.object.textEditorModel),this._pendingComment&&this.commentEditor.setPosition(this._pendingComment.cursor),this.calculateEditorHeight(),this._register(l.object.textEditorModel.onDidChangeContent(()=>{this.setCommentEditorDecorations(),this.commentEditorIsEmpty?.set(!this.commentEditor.getValue()),this.calculateEditorHeight()&&(this.commentEditor.layout({height:this._editorHeight,width:this.commentEditor.getLayoutInfo().width}),this.commentEditor.render(!0))})),this.createTextModelListener(this.commentEditor,this._form),this.setCommentEditorDecorations(),this._pendingComment?this.expandReplyArea():t?this.createReplyButton(this.commentEditor,this._form):this._commentThread.comments&&this._commentThread.comments.length===0&&this.expandReplyArea(e),this._error=M(this._container,_(".validation-error.hidden"));let c=M(this._container,_(".form-actions"));this._formActions=M(c,_(".other-actions")),this.createCommentWidgetFormActions(this._formActions,l.object.textEditorModel),this._editorActions=M(c,_(".editor-actions")),this.createCommentWidgetEditorActions(this._editorActions,l.object.textEditorModel)}calculateEditorHeight(){let e=SAt(this._parentEditor,this.commentEditor,this._editorHeight);return e!==this._editorHeight?(this._editorHeight=e,!0):!1}updateCommentThread(e){let t=this.commentEditor.hasTextFocus(),o=!this._commentThread.comments?.length&&!e.comments?.length;this._reviewThreadReplyButton||this.createReplyButton(this.commentEditor,this._form),this._commentThread.comments&&this._commentThread.comments.length===0&&!o&&this.expandReplyArea(),t&&this.commentEditor.focus()}getPendingComment(){let e=this.commentEditor.getModel();if(e&&e.getValueLength()>0)return{body:e.getValue(),cursor:this.commentEditor.getPosition()??new ye(1,1)}}setPendingComment(e){this._pendingComment=e,this.expandReplyArea(),this.commentEditor.setValue(e.body),this.commentEditor.setPosition(e.cursor)}layout(e){this.commentEditor.layout({height:this._editorHeight,width:e-54})}focusIfNeeded(){!this._commentThread.comments||!this._commentThread.comments.length?this.commentEditor.focus():(this.commentEditor.getModel()?.getValueLength()??0)>0&&this.expandReplyArea()}focusCommentEditor(){this.commentEditor.focus()}expandReplyAreaAndFocusCommentEditor(){this.expandReplyArea(),this.commentEditor.focus()}isCommentEditorFocused(){return this.commentEditor.hasWidgetFocus()}updateAuthorInfo(){if(this.avatar.textContent="",typeof this._commentThread.canReply!="boolean"&&this._commentThread.canReply.iconPath){this.avatar.style.display="block";let e=M(this.avatar,_("img.avatar"));e.src=vn.uriToBrowserUri(A.revive(this._commentThread.canReply.iconPath)).toString(!0)}else this.avatar.style.display="none"}updateCanReply(){this.updateAuthorInfo(),this._commentThread.canReply?this._container.style.display="block":this._container.style.display="none"}async submitComment(){await this._commentFormActions?.triggerDefaultAction(),this._pendingComment=void 0}setCommentEditorDecorations(){let t=this._commentThread.comments&&this._commentThread.comments.length>0?this._commentOptions?.placeHolder||d(9077,null):this._commentOptions?.placeHolder||d(9076,null);this.commentEditor.updateOptions({placeholder:t})}createTextModelListener(e,t){this._commentThreadDisposables.push(e.onDidFocusEditorWidget(()=>{this._commentThread.input={uri:e.getModel().uri,value:e.getValue()},this.commentService.setActiveEditingCommentThread(this._commentThread),this.commentService.setActiveCommentAndThread(this.owner,{thread:this._commentThread})})),this._commentThreadDisposables.push(e.getModel().onDidChangeContent(()=>{let o=e.getValue();if(this._commentThread.input&&this._commentThread.input.uri===e.getModel().uri&&this._commentThread.input.value!==o){let n=this._commentThread.input;n.value=o,this._commentThread.input=n}this.commentService.setActiveEditingCommentThread(this._commentThread)})),this._commentThreadDisposables.push(this._commentThread.onDidChangeInput(o=>{let n=this._commentThread,r=e.getModel();n.input&&r&&n.input.uri!==r.uri||o&&e.getValue()!==o.value&&(e.setValue(o.value),o.value===""&&(this._pendingComment={body:"",cursor:new ye(1,1)},t.classList.remove("expand"),e.getDomNode().style.outline="",this._error.textContent="",this._error.classList.add("hidden")))}))}createCommentWidgetFormActions(e,t){let o=this._commentMenus.getCommentThreadActions(this._contextKeyService);this._register(o),this._register(o.onDidChange(()=>{this._commentFormActions.setActions(o)})),this._commentFormActions=new g2(this.keybindingService,this._contextKeyService,this.contextMenuService,e,async n=>{await this._actionRunDelegate?.(),await n.run({thread:this._commentThread,text:this.commentEditor.getValue(),$mid:9}),this.hideReplyArea()}),this._register(this._commentFormActions),this._commentFormActions.setActions(o)}createCommentWidgetEditorActions(e,t){let o=this._commentMenus.getCommentEditorActions(this._contextKeyService);this._register(o),this._register(o.onDidChange(()=>{this._commentEditorActions.setActions(o,!0)})),this._commentEditorActions=new g2(this.keybindingService,this._contextKeyService,this.contextMenuService,e,async n=>{this._actionRunDelegate?.(),n.run({thread:this._commentThread,text:this.commentEditor.getValue(),$mid:9}),this.focusCommentEditor()}),this._register(this._commentEditorActions),this._commentEditorActions.setActions(o,!0)}get isReplyExpanded(){return this._container.classList.contains("expand")}expandReplyArea(e=!0){this.isReplyExpanded||(this._container.classList.add("expand"),e&&this.commentEditor.focus(),this.commentEditor.layout())}clearAndExpandReplyArea(){this.isReplyExpanded||(this.commentEditor.setValue(""),this.expandReplyArea())}hideReplyArea(){let e=this.commentEditor.getDomNode();e&&(e.style.outline=""),this.commentEditor.setValue(""),this._pendingComment={body:"",cursor:new ye(1,1)},this._container.classList.remove("expand"),this._error.textContent="",this._error.classList.add("hidden")}createReplyButton(e,t){this._reviewThreadReplyButton=M(t,_(`button.review-thread-reply-button.${kE}`)),this._register(this.hoverService.setupManagedHover(Ri("mouse"),this._reviewThreadReplyButton,this._commentOptions?.prompt||d(9077,null))),this._reviewThreadReplyButton.textContent=this._commentOptions?.prompt||d(9077,null),this._register(j(this._reviewThreadReplyButton,"click",o=>this.clearAndExpandReplyArea())),this._register(j(this._reviewThreadReplyButton,"focus",o=>this.clearAndExpandReplyArea())),this._register(e.onDidBlurEditorWidget(()=>{e.getModel().getValueLength()===0&&t.classList.contains("expand")&&t.classList.remove("expand")}))}dispose(){super.dispose(),Be(this._commentThreadDisposables)}};Q_e=I([m(12,Om),m(13,B),m(14,_e),m(15,Xe),m(16,nt),m(17,Bt)],Q_e);var dZ=class a extends it{constructor(e,t){super(a.ID,t||d(9185,null),"toggle-reactions",!0);this._menuActions=[];this.toggleDropdownMenu=e}static{this.ID="toolbar.toggle.pickReactions"}run(){return this.toggleDropdownMenu(),Promise.resolve(!0)}get menuActions(){return this._menuActions}set menuActions(e){this._menuActions=e}},yAt=class extends hs{constructor(i){super(null,i,{})}updateLabel(){if(!this.label)return;let i=this.action;if(i.class&&this.label.classList.add(i.class),i.icon){let e=M(this.label,_(".reaction-icon")),t=A.revive(i.icon);e.style.backgroundImage=Qa(t)}else{let e=M(this.label,_("span.reaction-label"));e.innerText=i.label}if(i.count){let e=M(this.label,_("span.reaction-count"));e.innerText=`${i.count}`}}getTooltip(){let i=this.action,e=i.enabled?d(9184,null):"";if(i.count===void 0)return d(9180,null,e,i.label);if(i.reactors===void 0||i.reactors.length===0){if(i.count===1)return d(9181,null,e,i.label);if(i.count>1)return d(9179,null,e,i.count,i.label)}else{if(i.reactors.length<=10&&i.reactors.length===i.count)return d(9182,null,e,i.reactors.join(", "),i.label);if(i.count>1){let t=i.reactors.slice(0,10);return d(9183,null,e,t.join(", "),i.count-t.length,i.label)}}}},LYe=class a extends it{constructor(e,t="",o="",n=!0,r,s,l,c){super(a.ID,t,o,n,r);this.reactors=s;this.icon=l;this.count=c}static{this.ID="toolbar.toggle.reaction"}};var gbi=class extends rs{async runAction(i,e){await i.run(...e)}},Y_e=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w){super();this.parentEditor=e;this.commentThread=t;this.comment=o;this.pendingEdit=n;this.owner=r;this.resource=s;this.parentThread=l;this.markdownRendererOptions=c;this.instantiationService=u;this.commentService=p;this.notificationService=h;this.contextMenuService=g;this.configurationService=v;this.hoverService=b;this.keybindingService=S;this.textModelService=y;this.markdownRendererService=w;this._md=this._register(new me);this._editAction=null;this._commentEditContainer=null;this._reactionsActionBar=this._register(new me);this._reactionActions=this._register(new N);this._commentEditor=null;this._commentEditorModel=null;this._editorHeight=epe;this._actionRunner=this._register(new gbi);this.toolbar=this._register(new me);this._commentFormActions=null;this._commentEditorActions=null;this._onDidClick=this._register(new E);this.isEditing=!1;this._editModeDisposables=this._register(new N);this._domNode=_("div.review-comment"),this._contextKeyService=this._register(f.createScoped(this._domNode)),this._commentContextValue=_c.commentContext.bindTo(this._contextKeyService),this.comment.contextValue&&this._commentContextValue.set(this.comment.contextValue),this._commentMenus=this.commentService.getCommentMenus(this.owner),this._domNode.tabIndex=-1,this._avatar=M(this._domNode,_("div.avatar-container")),this.updateCommentUserIcon(this.comment.userIconPath),this._commentDetailsContainer=M(this._domNode,_(".review-comment-contents")),this.createHeader(this._commentDetailsContainer),this._body=document.createElement("div"),this._body.classList.add("comment-body",kE),v.getValue(d2)?.maxHeight!==!1&&this._body.classList.add("comment-body-max-height"),this.createScroll(this._commentDetailsContainer,this._body),this.updateCommentBody(this.comment.body),this.createReactionsContainer(this._commentDetailsContainer),this._domNode.setAttribute("aria-label",`${o.userName}, ${this.commentBodyValue}`),this._domNode.setAttribute("role","treeitem"),this._clearTimeout=null,this._register(j(this._domNode,re.CLICK,()=>this.isEditing||this._onDidClick.fire(this))),this._register(j(this._domNode,re.CONTEXT_MENU,k=>this.onContextMenu(k))),n&&this.switchToEditMode(),this.activeCommentListeners()}get domNode(){return this._domNode}activeCommentListeners(){this._register(j(this._domNode,re.FOCUS_IN,()=>{this.commentService.setActiveCommentAndThread(this.owner,{thread:this.commentThread,comment:this.comment})},!0))}createScroll(e,t){this._scrollable=this._register(new y_({forceIntegerValues:!0,smoothScrollDuration:125,scheduleAtNextAnimationFrame:n=>Wr(Re(e),n)})),this._scrollableElement=this._register(new _O(t,{horizontal:3,vertical:3},this._scrollable)),this._register(this._scrollableElement.onScroll(n=>{n.scrollLeftChanged&&(t.scrollLeft=n.scrollLeft),n.scrollTopChanged&&(t.scrollTop=n.scrollTop)}));let o=this._register(new Gn(t,"scroll")).event;this._register(o(n=>{let r=this._scrollableElement.getScrollPosition(),s=Math.abs(t.scrollLeft-r.scrollLeft)<=1?void 0:t.scrollLeft,l=Math.abs(t.scrollTop-r.scrollTop)<=1?void 0:t.scrollTop;(s!==void 0||l!==void 0)&&this._scrollableElement.setScrollPosition({scrollLeft:s,scrollTop:l})})),e.appendChild(this._scrollableElement.getDomNode())}updateCommentBody(e){this._body.innerText="",this._md.clear(),this._plainText=void 0,typeof e=="string"?(this._plainText=M(this._body,_(".comment-body-plainstring")),this._plainText.innerText=e):(this._md.value=this.markdownRendererService.render(e,this.markdownRendererOptions),this._body.appendChild(this._md.value.element))}updateCommentUserIcon(e){if(this._avatar.textContent="",e){let t=M(this._avatar,_("img.avatar"));t.src=vn.uriToBrowserUri(A.revive(e)).toString(!0),t.onerror=o=>t.remove()}}get onDidClick(){return this._onDidClick.event}createTimestamp(e){this._timestamp=M(e,_("span.timestamp-container")),this.updateTimestamp(this.comment.timestamp)}updateTimestamp(e){if(!this._timestamp)return;let t=e!==void 0?new Date(e):void 0;t?this._timestampWidget?this._timestampWidget.setTimestamp(t):(this._timestampWidget=new jue(this.configurationService,this.hoverService,this._timestamp,t),this._register(this._timestampWidget)):this._timestampWidget?.dispose()}createHeader(e){let t=M(e,_(`div.comment-title.${kE}`)),o=M(t,_("comment-header-info")),n=M(o,_("strong.author"));n.innerText=this.comment.userName,this.createTimestamp(o),this._isPendingLabel=M(o,_("span.isPending")),this.comment.label?this._isPendingLabel.innerText=this.comment.label:this._isPendingLabel.innerText="",this._actionsToolbarContainer=M(t,_(".comment-actions")),this.createActionsToolbar()}getToolbarActions(e){let t=e.getActions({shouldForwardArgs:!0}),r={primary:[],secondary:[]};return m3o(t,r,!1,s=>/^inline/.test(s)),r}get commentNodeContext(){return[{thread:this.commentThread,commentUniqueId:this.comment.uniqueIdInThread,$mid:10},{commentControlHandle:this.commentThread.controllerHandle,commentThreadHandle:this.commentThread.commentThreadHandle,$mid:7}]}createToolbar(){this.toolbar.value=new wp(this._actionsToolbarContainer,this.contextMenuService,{actionViewItemProvider:(e,t)=>e.id===dZ.ID?new Pm(e,e.menuActions,this.contextMenuService,{...t,actionViewItemProvider:(o,n)=>this.actionViewItemProvider(o,n),classNames:["toolbar-toggle-pickReactions",...q.asClassNameArray(R.reactions)],anchorAlignmentProvider:()=>1}):this.actionViewItemProvider(e,t),orientation:0}),this.toolbar.value.context=this.commentNodeContext,this.toolbar.value.actionRunner=this._actionRunner}createActionsToolbar(){let e=[],t=this._commentMenus.getCommentTitleActions(this.comment,this._contextKeyService);this._register(t),this._register(t.onDidChange(r=>{let{primary:s,secondary:l}=this.getToolbarActions(t);!this.toolbar&&(s.length||l.length)&&this.createToolbar(),this.toolbar.value.setActions(s,l)}));let{primary:o,secondary:n}=this.getToolbarActions(t);e.push(...o),(e.length||n.length)&&(this.createToolbar(),this.toolbar.value.setActions(e,n))}actionViewItemProvider(e,t){return e.id===dZ.ID?t={label:!1,icon:!0}:t={label:!1,icon:!0},e.id===LYe.ID?new yAt(e):e instanceof Lo?this.instantiationService.createInstance(xl,e,{hoverDelegate:t.hoverDelegate}):e instanceof Nc?this.instantiationService.createInstance(VE,e,t):new hs({},e,t)}async submitComment(){this._commentEditor&&this._commentFormActions&&(await this._commentFormActions.triggerDefaultAction(),this.pendingEdit=void 0)}createReactionPicker(e){let t=this._reactionActions.add(new dZ(()=>{n?.show()},d(9073,null))),o=[];e&&e.length&&(o=e.map(r=>this._reactionActions.add(new it(`reaction.command.${r.label}`,`${r.label}`,"",!0,async()=>{try{await this.commentService.toggleReaction(this.owner,this.resource,this.commentThread,this.comment,r)}catch(s){let l=s.message?d(9075,null,s.message):d(9074,null);this.notificationService.error(l)}})))),t.menuActions=o;let n=this._reactionActions.add(new Pm(t,t.menuActions,this.contextMenuService,{actionViewItemProvider:(r,s)=>r.id===dZ.ID?n:this.actionViewItemProvider(r,s),classNames:"toolbar-toggle-pickReactions",anchorAlignmentProvider:()=>1}));return t}createReactionsContainer(e){this._reactionActionsContainer?.remove(),this._reactionsActionBar.clear(),this._reactionActions.clear();let t=this.commentService.hasReactionHandler(this.owner),o=this.comment.commentReactions?.filter(n=>!!n.count)||[];if(!(o.length===0&&!t)&&(this._reactionActionsContainer=M(e,_("div.comment-reactions")),this._reactionsActionBar.value=new Zi(this._reactionActionsContainer,{actionViewItemProvider:(n,r)=>n.id===dZ.ID?new Pm(n,n.menuActions,this.contextMenuService,{actionViewItemProvider:(s,l)=>this.actionViewItemProvider(s,l),classNames:["toolbar-toggle-pickReactions",...q.asClassNameArray(R.reactions)],anchorAlignmentProvider:()=>1}):this.actionViewItemProvider(n,r)}),o.map(n=>{let r=this._reactionActions.add(new LYe(`reaction.${n.label}`,`${n.label}`,n.hasReacted&&(n.canEdit||t)?"active":"",n.canEdit||t,async()=>{try{await this.commentService.toggleReaction(this.owner,this.resource,this.commentThread,this.comment,n)}catch(s){let l;n.hasReacted?l=s.message?d(9072,null,s.message):d(9071,null):l=s.message?d(9070,null,s.message):d(9069,null),this.notificationService.error(l)}},n.reactors,n.iconPath,n.count));this._reactionsActionBar.value?.push(r,{label:!0,icon:!0})}),t)){let n=this.createReactionPicker(this.comment.commentReactions||[]);this._reactionsActionBar.value?.push(n,{label:!1,icon:!0})}}get commentBodyValue(){return typeof this.comment.body=="string"?this.comment.body:this.comment.body.value}async createCommentEditor(e){this._editModeDisposables.clear();let t=M(e,_(".edit-textarea"));this._commentEditor=this.instantiationService.createInstance(wD,t,wD.getEditorOptions(this.configurationService),this._contextKeyService,this.parentThread),this._editModeDisposables.add(this._commentEditor);let o=A.from({scheme:Q.commentsInput,path:`/commentinput-${this.comment.uniqueIdInThread}-${Date.now()}.md`}),n=await this.textModelService.createModelReference(o);if(this._commentEditorModel=n,this._editModeDisposables.add(this._commentEditorModel),this._commentEditor.setModel(this._commentEditorModel.object.textEditorModel),this._commentEditor.setValue(this.pendingEdit?.body??this.commentBodyValue),this.pendingEdit)this._commentEditor.setPosition(this.pendingEdit.cursor);else{let s=this._commentEditorModel.object.textEditorModel.getLineCount(),l=this._commentEditorModel.object.textEditorModel.getLineLength(s)+1;this._commentEditor.setPosition(new ye(s,l))}this.pendingEdit=void 0,this._commentEditor.layout({width:t.clientWidth-14,height:this._editorHeight}),this._commentEditor.focus(),Wr(Re(e),()=>{this._commentEditor.layout({width:t.clientWidth-14,height:this._editorHeight}),this._commentEditor.focus()});let r=this.commentThread;r.input={uri:this._commentEditor.getModel().uri,value:this.commentBodyValue},this.commentService.setActiveEditingCommentThread(r),this.commentService.setActiveCommentAndThread(this.owner,{thread:r,comment:this.comment}),this._editModeDisposables.add(this._commentEditor.onDidFocusEditorWidget(()=>{r.input={uri:this._commentEditor.getModel().uri,value:this.commentBodyValue},this.commentService.setActiveEditingCommentThread(r),this.commentService.setActiveCommentAndThread(this.owner,{thread:r,comment:this.comment})})),this._editModeDisposables.add(this._commentEditor.onDidChangeModelContent(s=>{if(r.input&&this._commentEditor&&this._commentEditor.getModel().uri===r.input.uri){let l=this._commentEditor.getValue();if(l!==r.input.value){let c=r.input;c.value=l,r.input=c,this.commentService.setActiveEditingCommentThread(r),this.commentService.setActiveCommentAndThread(this.owner,{thread:r,comment:this.comment})}}})),this.calculateEditorHeight(),this._editModeDisposables.add(this._commentEditorModel.object.textEditorModel.onDidChangeContent(()=>{this._commentEditor&&this.calculateEditorHeight()&&(this._commentEditor.layout({height:this._editorHeight,width:this._commentEditor.getLayoutInfo().width}),this._commentEditor.render(!0))}))}calculateEditorHeight(){if(this._commentEditor){let e=SAt(this.parentEditor,this._commentEditor,this._editorHeight);if(e!==this._editorHeight)return this._editorHeight=e,!0}return!1}getPendingEdit(){let e=this._commentEditor?.getModel();if(this._commentEditor&&e&&e.getValueLength()>0)return{body:e.getValue(),cursor:this._commentEditor.getPosition()}}removeCommentEditor(){this.isEditing=!1,this._editAction&&(this._editAction.enabled=!0),this._body.classList.remove("hidden"),this._editModeDisposables.clear(),this._commentEditor=null,this._commentEditContainer.remove()}layout(e){let t=e!==void 0?e-72:this._commentEditor?.getLayoutInfo().width??0;this._commentEditor?.layout({width:t,height:this._editorHeight});let o=this._body.scrollWidth,n=X9(this._body),r=this._body.scrollHeight,s=RIe(this._body)+4;this._scrollableElement.setScrollDimensions({width:n,scrollWidth:o,height:s,scrollHeight:r})}async switchToEditMode(){if(this.isEditing)return;this.isEditing=!0,this._body.classList.add("hidden"),this._commentEditContainer=M(this._commentDetailsContainer,_(".edit-container")),await this.createCommentEditor(this._commentEditContainer);let e=M(this._commentEditContainer,_(".form-actions")),t=M(e,_(".other-actions"));this.createCommentWidgetFormActions(t);let o=M(e,_(".editor-actions"));this.createCommentWidgetEditorActions(o)}createCommentWidgetFormActions(e){let o=this.commentService.getCommentMenus(this.owner).getCommentActions(this.comment,this._contextKeyService);this._editModeDisposables.add(o),this._editModeDisposables.add(o.onDidChange(()=>{this._commentFormActions?.setActions(o)})),this._commentFormActions=new g2(this.keybindingService,this._contextKeyService,this.contextMenuService,e,n=>{let r=this._commentEditor.getValue();n.run({thread:this.commentThread,commentUniqueId:this.comment.uniqueIdInThread,text:r,$mid:11}),this.removeCommentEditor()}),this._editModeDisposables.add(this._commentFormActions),this._commentFormActions.setActions(o)}createCommentWidgetEditorActions(e){let o=this.commentService.getCommentMenus(this.owner).getCommentEditorActions(this._contextKeyService);this._editModeDisposables.add(o),this._editModeDisposables.add(o.onDidChange(()=>{this._commentEditorActions?.setActions(o,!0)})),this._commentEditorActions=new g2(this.keybindingService,this._contextKeyService,this.contextMenuService,e,n=>{let r=this._commentEditor.getValue();n.run({thread:this.commentThread,commentUniqueId:this.comment.uniqueIdInThread,text:r,$mid:11}),this._commentEditor?.focus()}),this._editModeDisposables.add(this._commentEditorActions),this._commentEditorActions.setActions(o,!0)}setFocus(e,t=!1){e?(this._domNode.focus(),this._actionsToolbarContainer.classList.add("tabfocused"),this._domNode.tabIndex=0,this.comment.mode===0&&this._commentEditor?.focus()):(this._actionsToolbarContainer.classList.contains("tabfocused")&&!this._actionsToolbarContainer.classList.contains("mouseover")&&(this._domNode.tabIndex=-1),this._actionsToolbarContainer.classList.remove("tabfocused"))}async update(e){e.body!==this.comment.body&&this.updateCommentBody(e.body),this.comment.userIconPath&&e.userIconPath&&A.from(this.comment.userIconPath).toString()!==A.from(e.userIconPath).toString()&&this.updateCommentUserIcon(e.userIconPath);let t=e.mode!==void 0&&e.mode!==this.comment.mode;this.comment=e,t&&(e.mode===0?await this.switchToEditMode():this.removeCommentEditor()),e.label?this._isPendingLabel.innerText=e.label:this._isPendingLabel.innerText="",this.createReactionsContainer(this._commentDetailsContainer),this.comment.contextValue?this._commentContextValue.set(this.comment.contextValue):this._commentContextValue.reset(),this.comment.timestamp&&this.updateTimestamp(this.comment.timestamp)}onContextMenu(e){let t=new Cn(Re(this._domNode),e);this.contextMenuService.showContextMenu({getAnchor:()=>t,menuId:D.CommentThreadCommentContext,menuActionOptions:{shouldForwardArgs:!0},contextKeyService:this._contextKeyService,actionRunner:this._actionRunner,getActionsContext:()=>this.commentNodeContext})}focus(){this.domNode.focus(),this._clearTimeout||(this.domNode.classList.add("focus"),this._clearTimeout=setTimeout(()=>{this.domNode.classList.remove("focus")},3e3))}dispose(){super.dispose()}};Y_e=I([m(8,F),m(9,Om),m(10,Ne),m(11,Xe),m(12,X),m(13,B),m(14,nt),m(15,_e),m(16,Bt),m(17,On)],Y_e);function m3o(a,i,e,t=o=>o==="navigation"){for(let o of a){let[n,r]=o;if(e&&(r=r.map(s=>s instanceof Lo&&s.alt?s.alt:s)),t(n))(Array.isArray(i)?i:i.primary).unshift(...r);else{let s=Array.isArray(i)?i:i.secondary;s.length>0&&s.push(new ri),s.push(...r)}}}var X_e=class extends x{constructor(e,t,o,n,r,s,l,c,u,p){super();this._parentEditor=e;this.owner=t;this.parentResourceUri=o;this.container=n;this._markdownRendererOptions=r;this._commentThread=s;this._pendingEdits=l;this._scopedInstatiationService=c;this._parentCommentThreadWidget=u;this.commentService=p;this._commentElements=[];this._resizeObserver=null;this._focusedComment=void 0;this._onDidResize=this._register(new E);this.onDidResize=this._onDidResize.event;this._commentDisposable=new Vt;this._containerClientArea=void 0;this._register(j(n,re.FOCUS_IN,h=>{this.commentService.setActiveEditingCommentThread(this._commentThread)}))}get length(){return this._commentThread.comments?this._commentThread.comments.length:0}get activeComment(){return this._commentElements.filter(e=>e.isEditing)[0]}focus(e){if(e!==void 0){let t=this._commentElements.find(o=>o.comment.uniqueIdInThread===e);if(t){t.focus();return}}this._commentsElement.focus()}hasCommentsInEditMode(){return this._commentElements.some(e=>e.isEditing)}ensureFocusIntoNewEditingComment(){this._commentElements.length===1&&this._commentElements[0].isEditing&&this._commentElements[0].setFocus(!0)}async display(){if(this._commentsElement=M(this.container,_("div.comments-container")),this._commentsElement.setAttribute("role","presentation"),this._commentsElement.tabIndex=0,this._updateAriaLabel(),this._register(j(this._commentsElement,re.KEY_DOWN,e=>{let t=new gi(e);if((t.equals(16)||t.equals(18))&&(!this._focusedComment||!this._commentElements[this._focusedComment].isEditing)){let o=n=>{if(this._focusedComment===void 0&&n>=0)return 0;if(this._focusedComment===void 0&&n<0)return this._commentElements.length-1;let r=this._focusedComment+n;return Math.min(Math.max(0,r),this._commentElements.length-1)};this._setFocusedComment(t.equals(16)?o(-1):o(1))}})),this._commentDisposable.clearAndDisposeAll(),this._commentElements=[],this._commentThread.comments)for(let e of this._commentThread.comments){let t=this.createNewCommentNode(e);this._commentElements.push(t),this._commentsElement.appendChild(t.domNode),e.mode===0&&await t.switchToEditMode()}this._resizeObserver=new MutationObserver(this._refresh.bind(this)),this._resizeObserver.observe(this.container,{attributes:!0,childList:!0,characterData:!0,subtree:!0})}_refresh(){let e=$m(this.container);e.height===0&&e.width===0||si.equals(this._containerClientArea,e)||(this._containerClientArea=e,this._onDidResize.fire(e))}getDimensions(){return $m(this.container)}layout(e){this._commentElements.forEach(t=>{t.layout(e)})}getPendingEdits(){let e={};return this._commentElements.forEach(t=>{if(t.isEditing){let o=t.getPendingEdit();o&&(e[t.comment.uniqueIdInThread]=o)}}),e}getCommentCoords(e){let t=this._commentElements.filter(o=>o.comment.uniqueIdInThread===e);if(t&&t.length){let o=ir(this._commentElements[0].domNode),n=ir(t[0].domNode);return{thread:o,comment:n}}}async updateCommentThread(e,t){let o=this._commentElements.length,n=e.comments?e.comments.length:0,r=[],s=[];for(let h=0;h<o;h++){let g=this._commentElements[h].comment,f=e.comments?e.comments.filter(v=>v.uniqueIdInThread===g.uniqueIdInThread):[];f.length?this._commentElements[h].update(f[0]):(s.push(h),r.push(this._commentElements[h]))}for(let h=r.length-1;h>=0;h--){let g=r[h];this._commentDisposable.deleteAndDispose(g),this._commentElements.splice(s[h],1),g.domNode.remove()}let l=null,c=[],u=[],p=[];for(let h=n-1;h>=0;h--){let g=e.comments[h],f=this._commentElements.filter(v=>v.comment.uniqueIdInThread===g.uniqueIdInThread);if(f.length)l=f[0].domNode,c.unshift(f[0]);else{let v=this.createNewCommentNode(g);c.unshift(v),l?(this._commentsElement.insertBefore(v.domNode,l),l=v.domNode):(this._commentsElement.appendChild(v.domNode),l=v.domNode),g.mode===0&&(p.push(v.switchToEditMode()),u.push(v))}}if(this._commentThread=e,this._commentElements=c,await Promise.all(p),u.length){let h=this._commentElements.indexOf(u[u.length-1]);this._focusedComment=h}this._updateAriaLabel(),t||this._setFocusedComment(this._focusedComment)}_updateAriaLabel(){this._commentThread.isDocumentCommentThread()?this._commentThread.range?this._commentsElement.ariaLabel=d(9169,null,this._commentThread.comments?.length,this._commentThread.range.startLineNumber,this._commentThread.range.endLineNumber,this._commentThread.label):this._commentsElement.ariaLabel=d(9168,null,this._commentThread.comments?.length,this._commentThread.label):this._commentsElement.ariaLabel=d(9167,null,this._commentThread.comments?.length,this._commentThread.label)}_setFocusedComment(e){this._focusedComment!==void 0&&this._commentElements[this._focusedComment]?.setFocus(!1),this._commentElements.length===0||e===void 0?this._focusedComment=void 0:(this._focusedComment=Math.min(e,this._commentElements.length-1),this._commentElements[this._focusedComment].setFocus(!0))}createNewCommentNode(e){let t=this._scopedInstatiationService.createInstance(Y_e,this._parentEditor,this._commentThread,e,this._pendingEdits?this._pendingEdits[e.uniqueIdInThread]:void 0,this.owner,this.parentResourceUri,this._parentCommentThreadWidget,this._markdownRendererOptions),o=new N;return o.add(t.onDidClick(n=>this._setFocusedComment(this._commentElements.findIndex(r=>r.comment.uniqueIdInThread===n.comment.uniqueIdInThread)))),o.add(t),this._commentDisposable.set(t,o),t}dispose(){super.dispose(),this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null),this._commentDisposable.dispose()}};X_e=I([m(9,Om)],X_e);var h3o=Ae("review-comment-collapse",R.chevronUp,d(9170,null)),qro="expand-review-action "+q.asClassName(h3o),g3o="expand-review-action "+q.asClassName(R.trashcan);function fbi(a){return!!a&&a.length>0}var J_e=class extends x{constructor(e,t,o,n,r,s,l){super();this._delegate=t;this._commentMenus=o;this._commentThread=n;this._contextKeyService=r;this._instantiationService=s;this._contextMenuService=l;this._headElement=_(".head"),e.appendChild(this._headElement),this._register(Z(()=>this._headElement.remove())),this._fillHead()}_fillHead(){let e=M(this._headElement,_(".review-title"));this._headingLabel=M(e,_("span.filename")),this.createThreadLabel();let t=M(this._headElement,_(".review-actions"));this._actionbarWidget=new Zi(t,{actionViewItemProvider:Bs.bind(void 0,this._instantiationService)}),this._register(this._actionbarWidget);let o=fbi(this._commentThread.comments)?qro:g3o;if(this._collapseAction=new it("workbench.action.hideComment",d(9171,null),o,!0,()=>this._delegate.collapse()),!fbi(this._commentThread.comments)){let r=this._register(new me);r.value=this._commentThread.onDidChangeComments(()=>{fbi(this._commentThread.comments)&&(this._collapseAction.class=qro,r.clear())})}let n=this._commentMenus.getCommentThreadTitleActions(this._contextKeyService);this._register(n),this.setActionBarActions(n),this._register(n),this._register(n.onDidChange(r=>{this.setActionBarActions(n)})),this._register(j(this._headElement,re.CONTEXT_MENU,r=>this.onContextMenu(r))),this._actionbarWidget.context=this._commentThread}setActionBarActions(e){let t=e.getActions({shouldForwardArgs:!0}).reduce((o,[,n])=>[...o,...n],[]);this._actionbarWidget.clear(),this._actionbarWidget.push([...t,this._collapseAction],{label:!1,icon:!0})}updateCommentThread(e){this._commentThread=e,this._actionbarWidget.context=this._commentThread,this.createThreadLabel()}createThreadLabel(){let e;e=this._commentThread.label,e===void 0&&(this._commentThread.comments&&this._commentThread.comments.length||(e=d(9172,null))),e&&(this._headingLabel.textContent=mr(e),this._headingLabel.setAttribute("aria-label",e))}updateHeight(e){this._headElement.style.height=`${e}px`,this._headElement.style.lineHeight=this._headElement.style.height}onContextMenu(e){let t=this._commentMenus.getCommentThreadTitleContextActions(this._contextKeyService);if(!t.length)return;let o=new Cn(Re(this._headElement),e);this._contextMenuActionRunner||(this._contextMenuActionRunner=this._register(new rs)),this._contextMenuService.showContextMenu({getAnchor:()=>o,getActions:()=>t,actionRunner:this._contextMenuActionRunner,getActionsContext:()=>({commentControlHandle:this._commentThread.controllerHandle,commentThreadHandle:this._commentThread.commentThreadHandle,$mid:7})})}};J_e=I([m(4,X),m(5,F),m(6,Xe)],J_e);var Z_e=class extends x{constructor(e,t,o,n,r,s,l){super();this._commentThread=t;this._contextKeyService=o;this._commentMenus=n;this._actionRunDelegate=r;this._keybindingService=s;this._contextMenuService=l;this._container=M(e,_(".comment-additional-actions")),M(this._container,_(".section-separator")),this._buttonBar=M(this._container,_(".button-bar")),this._createAdditionalActions(this._buttonBar)}_showMenu(){this._container?.classList.remove("hidden")}_hideMenu(){this._container?.classList.add("hidden")}_enableDisableMenu(e){let t=e.getActions({shouldForwardArgs:!0});for(let o of t){let[,n]=o;for(let r of n){if(r.enabled){this._showMenu();return}for(let s of r.actions??[])if(s.enabled){this._showMenu();return}}}this._hideMenu()}_createAdditionalActions(e){let t=this._commentMenus.getCommentThreadAdditionalActions(this._contextKeyService);this._register(t),this._register(t.onDidChange(()=>{this._commentFormActions.setActions(t,!0),this._enableDisableMenu(t)})),this._commentFormActions=new g2(this._keybindingService,this._contextKeyService,this._contextMenuService,e,async o=>{this._actionRunDelegate?.(),o.run({thread:this._commentThread,$mid:8})},4,!0),this._register(this._commentFormActions),this._commentFormActions.setActions(t,!0),this._enableDisableMenu(t)}};Z_e=I([m(5,_e),m(6,Xe)],Z_e);function f3o(a,i,e){let t=new Set;return wn(...a.map((o,n)=>wn(o.onDidFocus(()=>{e?.(n,"focus"),t.size||i(!0),t.add(n)}),o.onDidBlur(()=>{e?.(n,"blur"),t.delete(n),t.size||i(!1)}))))}var vbi=new Y("navigableContainerFocused",!1),r0=class{constructor(i,e,t){this.logService=e;this.configurationService=t;this.containers=new Set;this.focused=vbi.bindTo(i),r0.INSTANCE=this}static{this.ID="workbench.contrib.navigableContainerManager"}dispose(){this.containers.clear(),this.focused.reset(),r0.INSTANCE=void 0}get debugEnabled(){return this.configurationService.getValue("workbench.navigibleContainer.enableDebug")}log(i,...e){this.debugEnabled&&this.logService.debug(i,...e)}static register(i){let e=this.INSTANCE;return e?(e.containers.add(i),e.log("NavigableContainerManager.register",i.name),wn(f3o(i.focusNotifiers,t=>{t?(e.log("NavigableContainerManager.focus",i.name),e.focused.set(!0),e.lastContainer=i):(e.log("NavigableContainerManager.blur",i.name,e.lastContainer?.name),e.lastContainer===i&&(e.focused.set(!1),e.lastContainer=void 0))},(t,o)=>{e.log("NavigableContainerManager.partFocusChange",i.name,t,o)}),Z(()=>{e.containers.delete(i),e.log("NavigableContainerManager.unregister",i.name,e.lastContainer?.name),e.lastContainer===i&&(e.focused.set(!1),e.lastContainer=void 0)}))):x.None}static getActive(){return this.INSTANCE?.lastContainer}};r0=I([m(0,X),m(1,se),m(2,B)],r0);function bT(a){return r0.register(a)}It(r0.ID,r0,St.BlockStartup);Ct.registerCommandAndKeybindingRule({id:"widgetNavigation.focusPrevious",weight:200,when:C.and(vbi,C.or(vc?.negate(),mxt)),primary:2064,handler:()=>{r0.getActive()?.focusPreviousWidget()}});Ct.registerCommandAndKeybindingRule({id:"widgetNavigation.focusNext",weight:200,when:C.and(vbi,C.or(vc?.negate(),hxt)),primary:2066,handler:()=>{r0.getActive()?.focusNextWidget()}});var ox=new Y("accessibilityHelpIsShown",!1,!0),Dd=new Y("accessibleViewIsShown",!1,!0),ipe=new Y("accessibleViewSupportsNavigation",!1,!0),RYe=new Y("accessibleViewVerbosityEnabled",!1,!0),MYe=new Y("accessibleViewGoToSymbolSupported",!1,!0),wAt=new Y("accessibleViewOnLastLine",!1,!0),cu=new Y("accessibleViewCurrentProviderId",void 0,void 0),eDe=new Y("accessibleViewInCodeBlock",void 0,void 0),ope=new Y("accessibleViewContainsCodeBlocks",void 0,void 0),PYe=new Y("accessibleViewHasUnassignedKeybindings",void 0,void 0),AYe=new Y("accessibleViewHasAssignedKeybindings",void 0,void 0);var ix={type:"boolean",default:!0,tags:["accessibility"]},CAt=Object.freeze({id:"accessibility",title:d(5214,null),type:"object"}),vm={type:"string",enum:["auto","on","off"],default:"auto",enumDescriptions:[d(5221,null),d(5224,null),d(5223,null)],tags:["accessibility"]},Lb={type:"object",tags:["accessibility"],additionalProperties:!1,default:{sound:"auto",announcement:"auto"}},Rb={type:"string",enum:["auto","off"],default:"auto",enumDescriptions:[d(5215,null),d(5216,null)],tags:["accessibility"]},f2={type:"object",tags:["accessibility"],additionalProperties:!1,default:{sound:"auto"}},v3o={...CAt,scope:5,properties:{"accessibility.verbosity.terminal":{description:d(5242,null),...ix},"accessibility.verbosity.diffEditor":{description:d(5230,null),...ix},"accessibility.verbosity.panelChat":{description:d(5227,null),...ix},"accessibility.verbosity.inlineChat":{description:d(5236,null),...ix},"accessibility.verbosity.terminalChatOutput":{description:d(5243,null),...ix},"accessibility.verbosity.inlineCompletions":{description:d(5235,null),...ix},"accessibility.verbosity.keybindingsEditor":{description:d(5237,null),...ix},"accessibility.verbosity.notebook":{description:d(5238,null),...ix},"accessibility.verbosity.hover":{description:d(5234,null),...ix},"accessibility.verbosity.notification":{description:d(5239,null),...ix},"accessibility.verbosity.emptyEditorHint":{description:d(5232,null),...ix},"accessibility.verbosity.replEditor":{description:d(5240,null),...ix},"accessibility.verbosity.comments":{description:d(5228,null),...ix},"accessibility.verbosity.diffEditorActive":{description:d(5231,null),...ix},"accessibility.verbosity.debug":{description:d(5229,null),...ix},"accessibility.verbosity.walkthrough":{description:d(5244,null),...ix},"accessibility.accessibleView.closeOnKeyPress":{markdownDescription:d(5226,null),type:"boolean",default:!0},"accessibility.verbosity.sourceControl":{description:d(5241,null),...ix},"accessibility.verbosity.find":{description:d(5233,null),...ix},"accessibility.signalOptions.volume":{description:d(5101,null),type:"number",minimum:0,maximum:100,default:70,tags:["accessibility"]},"accessibility.signalOptions.debouncePositionChanges":{description:d(5094,null),type:"boolean",default:!1,tags:["accessibility"]},"accessibility.signalOptions.experimental.delays.general":{type:"object",description:"Delays for all signals besides error and warning at position",additionalProperties:!1,properties:{announcement:{description:d(5097,null),type:"number",minimum:0,default:3e3},sound:{description:d(5098,null),type:"number",minimum:0,default:400}},tags:["accessibility"]},"accessibility.signalOptions.experimental.delays.warningAtPosition":{type:"object",additionalProperties:!1,properties:{announcement:{description:d(5099,null),type:"number",minimum:0,default:3e3},sound:{description:d(5100,null),type:"number",minimum:0,default:1e3}},tags:["accessibility"]},"accessibility.signalOptions.experimental.delays.errorAtPosition":{type:"object",additionalProperties:!1,properties:{announcement:{description:d(5095,null),type:"number",minimum:0,default:3e3},sound:{description:d(5096,null),type:"number",minimum:0,default:1e3}},tags:["accessibility"]},"accessibility.signals.lineHasBreakpoint":{...Lb,description:d(5139,null),properties:{sound:{description:d(5141,null),...vm},announcement:{description:d(5140,null),...Rb}}},"accessibility.signals.lineHasInlineSuggestion":{...f2,description:d(5148,null),properties:{sound:{description:d(5149,null),...vm,default:"off"}}},"accessibility.signals.nextEditSuggestion":{...Lb,description:d(5153,null),properties:{sound:{description:d(5155,null),...vm},announcement:{description:d(5154,null),...Rb}}},"accessibility.signals.lineHasError":{...Lb,description:d(5142,null),properties:{sound:{description:d(5144,null),...vm},announcement:{description:d(5143,null),...Rb,default:"off"}}},"accessibility.signals.lineHasFoldedArea":{...Lb,description:d(5145,null),properties:{sound:{description:d(5147,null),...vm,default:"off"},announcement:{description:d(5146,null),...Rb}}},"accessibility.signals.lineHasWarning":{...Lb,description:d(5150,null),properties:{sound:{description:d(5152,null),...vm},announcement:{description:d(5151,null),...Rb,default:"off"}}},"accessibility.signals.positionHasError":{...Lb,description:d(5168,null),properties:{sound:{description:d(5170,null),...vm},announcement:{description:d(5169,null),...Rb,default:"on"}}},"accessibility.signals.positionHasWarning":{...Lb,description:d(5171,null),properties:{sound:{description:d(5173,null),...vm},announcement:{description:d(5172,null),...Rb,default:"on"}}},"accessibility.signals.onDebugBreak":{...Lb,description:d(5165,null),properties:{sound:{description:d(5167,null),...vm},announcement:{description:d(5166,null),...Rb}}},"accessibility.signals.noInlayHints":{...Lb,description:d(5156,null),properties:{sound:{description:d(5158,null),...vm},announcement:{description:d(5157,null),...Rb}}},"accessibility.signals.taskCompleted":{...Lb,description:d(5187,null),properties:{sound:{description:d(5189,null),...vm},announcement:{description:d(5188,null),...Rb}}},"accessibility.signals.taskFailed":{...Lb,description:d(5190,null),properties:{sound:{description:d(5192,null),...vm},announcement:{description:d(5191,null),...Rb}}},"accessibility.signals.terminalCommandFailed":{...Lb,description:d(5196,null),properties:{sound:{description:d(5198,null),...vm},announcement:{description:d(5197,null),...Rb}}},"accessibility.signals.terminalCommandSucceeded":{...Lb,description:d(5199,null),properties:{sound:{description:d(5201,null),...vm},announcement:{description:d(5200,null),...Rb}}},"accessibility.signals.terminalQuickFix":{...Lb,description:d(5202,null),properties:{sound:{description:d(5204,null),...vm},announcement:{description:d(5203,null),...Rb}}},"accessibility.signals.terminalBell":{...Lb,description:d(5193,null),properties:{sound:{description:d(5195,null),...vm},announcement:{description:d(5194,null),...Rb}}},"accessibility.signals.diffLineInserted":{...f2,description:d(5121,null),properties:{sound:{description:d(5186,null),...vm}}},"accessibility.signals.diffLineModified":{...f2,description:d(5122,null),properties:{sound:{description:d(5123,null),...vm}}},"accessibility.signals.diffLineDeleted":{...f2,description:d(5119,null),properties:{sound:{description:d(5120,null),...vm}}},"accessibility.signals.chatEditModifiedFile":{...f2,description:d(5102,null),properties:{sound:{description:d(5103,null),...vm}}},"accessibility.signals.notebookCellCompleted":{...Lb,description:d(5159,null),properties:{sound:{description:d(5161,null),...vm},announcement:{description:d(5160,null),...Rb}}},"accessibility.signals.notebookCellFailed":{...Lb,description:d(5162,null),properties:{sound:{description:d(5164,null),...vm},announcement:{description:d(5163,null),...Rb}}},"accessibility.signals.progress":{...Lb,description:d(5174,null),default:{sound:"auto",announcement:"off"},properties:{sound:{description:d(5176,null),...vm},announcement:{description:d(5175,null),...Rb}}},"accessibility.signals.chatRequestSent":{...Lb,description:d(5104,null),properties:{sound:{description:d(5106,null),...vm},announcement:{description:d(5105,null),...Rb}}},"accessibility.signals.chatResponseReceived":{...f2,description:d(5107,null),properties:{sound:{description:d(5108,null),...vm}}},"accessibility.signals.codeActionTriggered":{...f2,description:d(5117,null),properties:{sound:{description:d(5118,null),...vm}}},"accessibility.signals.codeActionApplied":{...f2,description:d(5115,null),properties:{sound:{description:d(5116,null),...vm}}},"accessibility.signals.voiceRecordingStarted":{...f2,description:d(5205,null),properties:{sound:{description:d(5206,null),...vm}},default:{sound:"on"}},"accessibility.signals.voiceRecordingStopped":{...f2,description:d(5207,null),properties:{sound:{description:d(5208,null),...vm,default:"off"}}},"accessibility.signals.clear":{...Lb,description:d(5112,null),properties:{sound:{description:d(5114,null),...vm},announcement:{description:d(5113,null),...Rb}}},"accessibility.signals.editsUndone":{...Lb,description:d(5127,null),properties:{sound:{description:d(5129,null),...vm},announcement:{description:d(5128,null),...Rb}}},"accessibility.signals.editsKept":{...Lb,description:d(5124,null),properties:{sound:{description:d(5126,null),...vm},announcement:{description:d(5125,null),...Rb}}},"accessibility.signals.save":{type:"object",tags:["accessibility"],additionalProperties:!1,markdownDescription:d(5177,null),properties:{sound:{description:d(5182,null),type:"string",enum:["userGesture","always","never"],default:"never",enumDescriptions:[d(5185,null),d(5183,null),d(5184,null)]},announcement:{description:d(5178,null),type:"string",enum:["userGesture","always","never"],default:"never",enumDescriptions:[d(5181,null),d(5179,null),d(5180,null)]}},default:{sound:"never",announcement:"never"}},"accessibility.signals.format":{type:"object",tags:["accessibility"],additionalProperties:!1,markdownDescription:d(5130,null),properties:{sound:{description:d(5137,null),type:"string",enum:["userGesture","always","never"],default:"never",enumDescriptions:[d(5138,null),d(5131,null),d(5136,null)]},announcement:{description:d(5132,null),type:"string",enum:["userGesture","always","never"],default:"never",enumDescriptions:[d(5135,null),d(5133,null),d(5134,null)]}},default:{sound:"never",announcement:"never"}},"accessibility.signals.chatUserActionRequired":{...Lb,markdownDescription:d(5109,null),properties:{sound:{description:d(5111,null),type:"string",enum:["auto","on","off"],enumDescriptions:[d(5222,null),d(5224,null),d(5223,null)]},announcement:{description:d(5110,null),...Rb}},default:{sound:"auto",announcement:"auto"},tags:["accessibility"]},"accessibility.underlineLinks":{type:"boolean",description:d(5209,null),default:!1},"accessibility.debugWatchVariableAnnouncements":{type:"boolean",description:d(5090,null),default:!0},"accessibility.replEditor.readLastExecutionOutput":{type:"boolean",description:d(5093,null),default:!0},"accessibility.replEditor.autoFocusReplExecution":{type:"string",enum:["none","input","lastExecution"],default:"input",description:d(5220,null)},"accessibility.windowTitleOptimized":{type:"boolean",default:!0,markdownDescription:d(5213,null,"`#window.title#`","`activeEditorState`")},"accessibility.openChatEditedFiles":{type:"boolean",default:!1,markdownDescription:d(5092,null)},"accessibility.verboseChatProgressUpdates":{type:"boolean",default:!0,markdownDescription:d(5210,null)}}};function $ro(){let a=ne.as(Jt.Configuration);a.registerConfiguration(v3o),a.registerConfiguration({...Ud,properties:{"accessibility.dimUnfocused.enabled":{description:d(5218,null),type:"boolean",default:!1,tags:["accessibility"],scope:1},"accessibility.dimUnfocused.opacity":{markdownDescription:d(5219,null,"`#accessibility.dimUnfocused.enabled#`"),type:"number",minimum:.2,maximum:1,default:.75,tags:["accessibility"],scope:1},"accessibility.hideAccessibleView":{description:d(5091,null),type:"boolean",default:!1,tags:["accessibility"]},"accessibility.verboseChatProgressUpdates":{type:"boolean",default:!0,markdownDescription:d(5210,null)},"accessibility.chat.showCheckmarks":{type:"boolean",default:!1,tags:["accessibility"],markdownDescription:d(5089,null)}}})}var NYe=0,tpe=class extends x{constructor(e){super();this.speechService=e;this._register(U.runAndSubscribe(e.onDidChangeHasSpeechProvider,()=>this.updateConfiguration()))}static{this.ID="workbench.contrib.dynamicSpeechAccessibilityConfiguration"}updateConfiguration(){if(!this.speechService.hasSpeechProvider)return;let e=this.getLanguages(),t=Object.keys(e).sort((n,r)=>e[n].name.localeCompare(e[r].name));ne.as(Jt.Configuration).registerConfiguration({...CAt,properties:{"accessibility.voice.speechTimeout":{markdownDescription:d(5247,null),type:"number",default:NYe,minimum:0,tags:["accessibility"]},"accessibility.voice.ignoreCodeBlocks":{markdownDescription:d(5245,null),type:"boolean",default:!1,tags:["accessibility"]},"accessibility.voice.speechLanguage":{markdownDescription:d(5246,null),type:"string",enum:t,default:"auto",tags:["accessibility"],enumDescriptions:t.map(n=>e[n].name),enumItemLabels:t.map(n=>e[n].name)},"accessibility.voice.autoSynthesize":{type:"string",enum:["on","off"],enumDescriptions:[d(5212,null),d(5211,null)],markdownDescription:d(5217,null),default:"off",tags:["accessibility"]}}})}getLanguages(){return{auto:{name:d(5225,null)},...avi}}};tpe=I([m(0,ZC)],tpe);ne.as(Ep.ConfigurationMigration).registerConfigurationMigrations([{key:"audioCues.volume",migrateFn:(a,i)=>[["accessibility.signalOptions.volume",{value:a}],["audioCues.volume",{value:void 0}]]}]);ne.as(Ep.ConfigurationMigration).registerConfigurationMigrations([{key:"audioCues.debouncePositionChanges",migrateFn:a=>[["accessibility.signalOptions.debouncePositionChanges",{value:a}],["audioCues.debouncePositionChanges",{value:void 0}]]}]);ne.as(Ep.ConfigurationMigration).registerConfigurationMigrations([{key:"accessibility.signalOptions",migrateFn:(a,i)=>{let e=bbi(i,"general"),t=bbi(i,"errorAtPosition"),o=bbi(i,"warningAtPosition"),n=b3o(i),r=S3o(i),s=[];return n&&s.push(["accessibility.signalOptions.volume",{value:n}]),e&&s.push(["accessibility.signalOptions.experimental.delays.general",{value:e}]),t&&s.push(["accessibility.signalOptions.experimental.delays.errorAtPosition",{value:t}]),o&&s.push(["accessibility.signalOptions.experimental.delays.warningAtPosition",{value:o}]),r&&s.push(["accessibility.signalOptions.debouncePositionChanges",{value:r}]),s.push(["accessibility.signalOptions",{value:void 0}]),s}}]);ne.as(Ep.ConfigurationMigration).registerConfigurationMigrations([{key:"accessibility.signals.sounds.volume",migrateFn:a=>[["accessibility.signalOptions.volume",{value:a}],["accessibility.signals.sounds.volume",{value:void 0}]]}]);ne.as(Ep.ConfigurationMigration).registerConfigurationMigrations([{key:"accessibility.signals.debouncePositionChanges",migrateFn:a=>[["accessibility.signalOptions.debouncePositionChanges",{value:a}],["accessibility.signals.debouncePositionChanges",{value:void 0}]]}]);function bbi(a,i){return a(`accessibility.signalOptions.experimental.delays.${i}`)||a("accessibility.signalOptions")?.["experimental.delays"]?.[`${i}`]||a("accessibility.signalOptions")?.delays?.[`${i}`]}function b3o(a){return a("accessibility.signalOptions.volume")||a("accessibility.signalOptions")?.volume||a("accessibility.signals.sounds.volume")||a("audioCues.volume")}function S3o(a){return a("accessibility.signalOptions.debouncePositionChanges")||a("accessibility.signalOptions")?.debouncePositionChanges||a("accessibility.signals.debouncePositionChanges")||a("audioCues.debouncePositionChanges")}ne.as(Ep.ConfigurationMigration).registerConfigurationMigrations([{key:"accessibility.voice.autoSynthesize",migrateFn:a=>{let i;if(a===!0)i="on";else if(a===!1)i="off";else return[];return[["accessibility.voice.autoSynthesize",{value:i}]]}}]);ne.as(Ep.ConfigurationMigration).registerConfigurationMigrations([{key:"accessibility.signals.chatResponsePending",migrateFn:(a,i)=>[["accessibility.signals.progress",{value:a}],["accessibility.signals.chatResponsePending",{value:void 0}]]}]);ne.as(Ep.ConfigurationMigration).registerConfigurationMigrations($o.allAccessibilitySignals.map(a=>a.legacySoundSettingsKey?{key:a.legacySoundSettingsKey,migrateFn:(i,e)=>{let t=[],o=a.legacyAnnouncementSettingsKey,n;return o&&(n=e(o)??void 0,n!==void 0&&typeof n!="string"&&(n=n?"auto":"off")),t.push([`${a.legacySoundSettingsKey}`,{value:void 0}]),t.push([`${a.settingsKey}`,{value:n!==void 0?{announcement:n,sound:i}:{sound:i}}]),t}}:void 0).filter(lo));ne.as(Ep.ConfigurationMigration).registerConfigurationMigrations($o.allAccessibilitySignals.filter(a=>!!a.legacyAnnouncementSettingsKey&&!!a.legacySoundSettingsKey).map(a=>({key:a.legacyAnnouncementSettingsKey,migrateFn:(i,e)=>{let t=[],o=e(a.settingsKey)?.sound||e(a.legacySoundSettingsKey);return i!==void 0&&typeof i!="string"&&(i=i?"auto":"off"),t.push([`${a.settingsKey}`,{value:i!==void 0?{announcement:i,sound:o}:{sound:o}}]),t.push([`${a.legacyAnnouncementSettingsKey}`,{value:void 0}]),t.push([`${a.legacySoundSettingsKey}`,{value:void 0}]),t}})));var uZ=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super();this.container=e;this._parentEditor=t;this._owner=o;this._parentResourceUri=n;this._contextKeyService=r;this._scopedInstantiationService=s;this._commentThread=l;this._pendingComment=c;this._pendingEdits=u;this._markdownOptions=p;this._commentOptions=h;this._containerDelegate=g;this.commentService=f;this.configurationService=v;this._keybindingService=b;this._commentThreadDisposables=[];this._onDidResize=this._register(new E);this.onDidResize=this._onDidResize.event;this._threadIsEmpty=_c.commentThreadIsEmpty.bindTo(this._contextKeyService),this._threadIsEmpty.set(!l.comments||!l.comments.length),this._focusedContextKey=_c.commentFocused.bindTo(this._contextKeyService),this._commentMenus=this.commentService.getCommentMenus(this._owner),this._register(this._header=this._scopedInstantiationService.createInstance(J_e,e,{collapse:this._containerDelegate.collapse.bind(this)},this._commentMenus,this._commentThread)),this._header.updateCommentThread(this._commentThread);let S=_(".body");e.appendChild(S),this._register(Z(()=>S.remove()));let y=this._register(qn(S));this._register(bT({name:"commentThreadWidget",focusNotifiers:[y],focusNextWidget:()=>{this._commentReply?.isCommentEditorFocused()||this._commentReply?.expandReplyAreaAndFocusCommentEditor()},focusPreviousWidget:()=>{this._commentReply?.isCommentEditorFocused()&&this._commentThread.comments?.length&&this._body.focus()}})),this._register(y.onDidFocus(()=>this._focusedContextKey.set(!0))),this._register(y.onDidBlur(()=>this._focusedContextKey.reset())),this._register(this.configurationService.onDidChangeConfiguration(T=>{T.affectsConfiguration("accessibility.verbosity.comments")&&this._setAriaLabel()})),this._body=this._scopedInstantiationService.createInstance(X_e,this._parentEditor,this._owner,this._parentResourceUri,S,this._markdownOptions,this._commentThread,this._pendingEdits,this._scopedInstantiationService,this),this._register(this._body),this._setAriaLabel(),this._commentThreadContextValue=_c.commentThreadContext.bindTo(this._contextKeyService),this._commentThreadContextValue.set(l.contextValue);let w=_c.commentControllerContext.bindTo(this._contextKeyService),k=this.commentService.getCommentController(this._owner);k?.contextValue&&w.set(k.contextValue),this.currentThreadListeners()}get commentThread(){return this._commentThread}get hasUnsubmittedComments(){return!!this._commentReply?.commentEditor.getValue()||this._body.hasCommentsInEditMode()}_setAriaLabel(){let e=d(9173,null),t,o=this.configurationService.getValue("accessibility.verbosity.comments");o&&(t=this._keybindingService.lookupKeybinding("editor.action.accessibilityHelp",this._contextKeyService)?.getLabel()??void 0),t?e=d(9174,null,e,t):o&&(e=d(9175,null,e)),this._body.container.ariaLabel=e}updateCurrentThread(e,t){e||t?this.commentService.setCurrentCommentThread(this.commentThread):this.commentService.setCurrentCommentThread(void 0)}currentThreadListeners(){let e=!1,t=!1;this._register(j(this.container,re.MOUSE_ENTER,o=>{o.relatedTarget===this.container&&(e=!0,this.updateCurrentThread(e,t))},!0)),this._register(j(this.container,re.MOUSE_LEAVE,o=>{o.relatedTarget===this.container&&(e=!1,this.updateCurrentThread(e,t))},!0)),this._register(j(this.container,re.FOCUS_IN,()=>{t=!0,this.updateCurrentThread(e,t)},!0)),this._register(j(this.container,re.FOCUS_OUT,()=>{t=!1,this.updateCurrentThread(e,t)},!0))}async updateCommentThread(e){let t=this._commentThread.collapsibleState===1&&this._commentThreadState===0&&e.state===1;this._commentThreadState=e.state,this._commentThread=e,Be(this._commentThreadDisposables),this._commentThreadDisposables=[],this._bindCommentThreadListeners(),await this._body.updateCommentThread(e,this._commentReply?.isCommentEditorFocused()??!1),this._threadIsEmpty.set(!this._body.length),this._header.updateCommentThread(e),this._commentReply?.updateCommentThread(e),this._commentThread.contextValue?this._commentThreadContextValue.set(this._commentThread.contextValue):this._commentThreadContextValue.reset(),t&&this.configurationService.getValue(d2).collapseOnResolve&&this.collapse()}async display(e,t){let o=Math.max(23,Math.ceil(e*1.2));this._header.updateHeight(o),await this._body.display(),this._commentThread.canReply&&this._createCommentForm(t),this._createAdditionalActions(),this._register(this._body.onDidResize(n=>{this._refresh(n)})),this._commentThread.canReply&&this._commentReply&&this._commentReply.focusIfNeeded(),this._bindCommentThreadListeners()}_refresh(e){this._body.layout(),this._onDidResize.fire(e)}dispose(){super.dispose(),Be(this._commentThreadDisposables),this.updateCurrentThread(!1,!1)}_bindCommentThreadListeners(){this._commentThreadDisposables.push(this._commentThread.onDidChangeCanReply(()=>{this._commentReply?this._commentReply.updateCanReply():this._commentThread.canReply&&this._createCommentForm(!1)})),this._commentThreadDisposables.push(this._commentThread.onDidChangeComments(async e=>{await this.updateCommentThread(this._commentThread)})),this._commentThreadDisposables.push(this._commentThread.onDidChangeLabel(e=>{this._header.createThreadLabel()}))}_createCommentForm(e){this._commentReply=this._scopedInstantiationService.createInstance(Q_e,this._owner,this._body.container,this._parentEditor,this._commentThread,this._scopedInstantiationService,this._contextKeyService,this._commentMenus,this._commentOptions,this._pendingComment,this,e,this._containerDelegate.actionRunner),this._register(this._commentReply)}_createAdditionalActions(){this._additionalActions=this._scopedInstantiationService.createInstance(Z_e,this._body.container,this._commentThread,this._contextKeyService,this._commentMenus,this._containerDelegate.actionRunner),this._register(this._additionalActions)}getCommentCoords(e){return this._body.getCommentCoords(e)}getPendingEdits(){return this._body.getPendingEdits()}getPendingComment(){if(this._commentReply)return this._commentReply.getPendingComment()}setPendingComment(e){this._pendingComment=e,this._commentReply?.setPendingComment(e)}getDimensions(){return this._body.getDimensions()}layout(e){this._body.layout(e),e!==void 0&&this._commentReply?.layout(e)}ensureFocusIntoNewEditingComment(){this._body.ensureFocusIntoNewEditingComment()}focusCommentEditor(){this._commentReply?.expandReplyAreaAndFocusCommentEditor()}focus(e){this._body.focus(e)}async submitComment(){let e=this._body.activeComment;if(e)return e.submitComment();if((this._commentReply?.getPendingComment()?.body.length??0)>0)return this._commentReply?.submitComment()}async collapse(){await this._containerDelegate.collapse()&&z.isIRange(this.commentThread.range)&&pn(this._parentEditor)&&this._parentEditor.setSelection(this.commentThread.range)}applyTheme(e){let t="--comment-thread-editor-font-family",o="--comment-thread-editor-font-weight";this.container?.style.setProperty(t,e.fontFamily),this.container?.style.setProperty(o,e.fontWeight),this._commentReply?.setCommentEditorDecorations()}};uZ=I([m(12,Om),m(13,B),m(14,_e)],uZ);function jro(a,i){return vro(a,i)??i.getColor(K_)}function Qro(a){let i=a.comments;return i?i.some(e=>e.state===1):!1}function Yro(a){let i=a.target.range;if(!i||!a.event.leftButton||a.target.type!==4)return null;let e=a.target.detail;return e.offsetX-e.glyphMarginWidth-e.lineNumbersWidth-e.glyphMarginLeft>20?null:{lineNumber:i.startLineNumber}}function Xro(a,i){if(!a)return null;let{lineNumber:e}=a;return i.target.range?e:null}var tDe=class extends ZO{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,{keepEditorSelection:!0,isAccessible:!0,showArrow:!!o.range});this._uniqueOwner=t;this._commentThread=o;this._pendingComment=n;this._pendingEdits=r;this.themeService=l;this.commentService=c;this.configurationService=p;this.dialogService=h;this._onDidClose=new E;this._onDidCreateThread=new E;this._onDidChangeExpandedState=new E;this._globalToDispose=new N;this._commentThreadDisposables=[];this._contextKeyService=this._globalToDispose.add(u.createScoped(this.domNode)),this._scopedInstantiationService=this._globalToDispose.add(s.createChild(new _o([X,this._contextKeyService])));let g=this.commentService.getCommentController(this._uniqueOwner);g&&(this._commentOptions=g.options),this._initialCollapsibleState=n?1:o.initialCollapsibleState,o.initialCollapsibleState=this._initialCollapsibleState,this._commentThreadDisposables=[],this.create(),this._globalToDispose.add(this.themeService.onDidColorThemeChange(this._applyTheme,this)),this._globalToDispose.add(this.editor.onDidChangeConfiguration(f=>{f.hasChanged(59)&&this._applyTheme()})),this._applyTheme()}get uniqueOwner(){return this._uniqueOwner}get commentThread(){return this._commentThread}get expanded(){return this._isExpanded}get onDidClose(){return this._onDidClose.event}get onDidCreateThread(){return this._onDidCreateThread.event}get onDidChangeExpandedState(){return this._onDidChangeExpandedState.event}getPosition(){if(this.position)return this.position;if(this._commentGlyph)return this._commentGlyph.getPosition().position??void 0}revealRange(){}reveal(e,t=0){this.makeVisible(e,t);let o=this._commentThread.comments?.find(n=>n.uniqueIdInThread===e)??this._commentThread.comments?.[0];this.commentService.setActiveCommentAndThread(this.uniqueOwner,{thread:this._commentThread,comment:o})}_expandAndShowZoneWidget(){this._isExpanded||this.show(this.arrowPosition(this._commentThread.range),2)}_setFocus(e,t){t===1?this._commentThreadWidget.focus(e):t===2&&this._commentThreadWidget.focusCommentEditor()}_goToComment(e,t){let o=this.editor.getLayoutInfo().height,n=this._commentThreadWidget.getCommentCoords(e);if(n){let r=1;if(this._commentThread.range){let s=n.thread,l=n.comment;r=this.editor.getTopForLineNumber(this._commentThread.range.startLineNumber)-o/2+l.top-s.top}this.editor.setScrollTop(r),this._setFocus(e,t)}else this._goToThread(t)}_goToThread(e){let t=this._commentThread.range?new z(this._commentThread.range.startLineNumber,this._commentThread.range.startColumn,this._commentThread.range.endLineNumber+1,1):new z(1,1,1,1);this.editor.revealRangeInCenter(t),this._setFocus(void 0,e)}makeVisible(e,t=0){this._expandAndShowZoneWidget(),e!==void 0?this._goToComment(e,t):this._goToThread(t)}getPendingComments(){return{newComment:this._commentThreadWidget.getPendingComment(),edits:this._commentThreadWidget.getPendingEdits()}}setPendingComment(e){this._pendingComment=e,this.expand(),this._commentThreadWidget.setPendingComment(e)}_fillContainer(e){this.setCssClass("review-widget"),this._commentThreadWidget=this._scopedInstantiationService.createInstance(uZ,e,this.editor,this._uniqueOwner,this.editor.getModel().uri,this._contextKeyService,this._scopedInstantiationService,this._commentThread,this._pendingComment,this._pendingEdits,{context:this.editor},this._commentOptions,{actionRunner:async()=>{if(!this._commentThread.comments||!this._commentThread.comments.length){let t=this.getPosition();if(t){let o=this._commentThread.range;if(!o)return;let n;if(t.lineNumber!==o.endLineNumber){let r=t.lineNumber-o.endLineNumber;n=new z(o.startLineNumber+r,o.startColumn,o.endLineNumber+r,o.endColumn)}else n=new z(o.startLineNumber,o.startColumn,o.endLineNumber,o.endColumn);await this.commentService.updateCommentThreadTemplate(this.uniqueOwner,this._commentThread.commentThreadHandle,n)}}},collapse:()=>this.collapse(!0)}),this._disposables.add(this._commentThreadWidget)}arrowPosition(e){if(e)return{lineNumber:e.endLineNumber,column:e.endLineNumber===e.startLineNumber?(e.startColumn+e.endColumn+1)/2:1}}deleteCommentThread(){this.dispose(),this.commentService.disposeCommentThread(this.uniqueOwner,this._commentThread.threadId)}doCollapse(){this._commentThread.collapsibleState=0}async collapse(e=!1){return!e||await this.confirmCollapse()?(this.doCollapse(),!0):!1}async confirmCollapse(){if(this.configurationService.getValue("comments.thread.confirmOnCollapse")==="whenHasUnsubmittedComments"&&this._commentThreadWidget.hasUnsubmittedComments){let t=await this.dialogService.confirm({message:d(9176,null),primaryButton:d(9177,null),type:bt.Warning,checkbox:{label:d(9178,null),checked:!1}});return t.checkboxChecked&&await this.configurationService.updateValue("comments.thread.confirmOnCollapse","never"),t.confirmed}return!0}expand(e){this._commentThread.collapsibleState=1,e&&this.commentService.setActiveCommentAndThread(this.uniqueOwner,{thread:this._commentThread})}getGlyphPosition(){return this._commentGlyph?this._commentGlyph.getPosition().position.lineNumber:0}async update(e){this._commentThread!==e&&(this._commentThreadDisposables.forEach(n=>n.dispose()),this._commentThread=e,this._commentThreadDisposables=[],this.bindCommentThreadListeners()),await this._commentThreadWidget.updateCommentThread(e);let t=this._commentThread.range?.endLineNumber??1,o=!1;if(this._commentGlyph){let n=Qro(e);this._commentGlyph.setThreadState(e.state,n),this._commentGlyph.getPosition().position.lineNumber!==t&&(o=!0,this._commentGlyph.setLineNumber(t))}o&&this._isExpanded||this._commentThread.collapsibleState===1&&!this._isExpanded?this.show(this.arrowPosition(this._commentThread.range),2):this._commentThread.collapsibleState!==1&&this.hide()}_onWidth(e){this._commentThreadWidget.layout(e)}_doLayout(e,t){this._commentThreadWidget.layout(t)}async display(e,t){if(e){this._commentGlyph=new Jue(this.editor,e?.endLineNumber??-1);let o=Qro(this._commentThread);this._commentGlyph.setThreadState(this._commentThread.state,o),this._globalToDispose.add(this._commentGlyph.onDidChangeLineNumber(async n=>{if(!this._commentThread.range)return;let r=n-this._commentThread.range.endLineNumber,s=new z(this._commentThread.range.startLineNumber+r,this._commentThread.range.startColumn,this._commentThread.range.endLineNumber+r,this._commentThread.range.endColumn);this._commentThread.range=s}))}await this._commentThreadWidget.display(this.editor.getOption(75),t),this._disposables.add(this._commentThreadWidget.onDidResize(o=>{this._refresh(o)})),this._commentThread.collapsibleState===1&&this.show(this.arrowPosition(e),2),t&&this.makeVisible(),this.bindCommentThreadListeners()}bindCommentThreadListeners(){if(this._commentThreadDisposables.push(this._commentThread.onDidChangeComments(async e=>{await this.update(this._commentThread)})),this._commentThreadDisposables.push(this._commentThread.onDidChangeCollapsibleState(e=>{if(e===1&&!this._isExpanded){this.show(this.arrowPosition(this._commentThread.range),2),this._commentThreadWidget.ensureFocusIntoNewEditingComment();return}if(e===0&&this._isExpanded){this.hide();return}})),this._initialCollapsibleState===void 0){let e=this._commentThread.onDidChangeInitialCollapsibleState(t=>{this._initialCollapsibleState=t,this._commentThread.collapsibleState=this._initialCollapsibleState,e.dispose()});this._commentThreadDisposables.push(e)}this._commentThreadDisposables.push(this._commentThread.onDidChangeState(()=>{let e=jro(this._commentThread.state,this.themeService.getColorTheme())||We.transparent;this.style({frameColor:e,arrowColor:e}),this.container?.style.setProperty(hro,`${e}`),this.container?.style.setProperty(gro,`${e.transparent(.1)}`)}))}async submitComment(){return this._commentThreadWidget.submitComment()}_refresh(e){if(this._isExpanded===void 0&&e.height===0&&e.width===0){this.commentThread.collapsibleState=0;return}if(this._isExpanded){this._commentThreadWidget.layout();let t=Math.ceil(this.editor.getOption(75)*1.2),o=this.editor.getOption(75),n=Math.round(o/3),r=Math.round(o/9)*2,s=Math.ceil((t+e.height+n+r+8)/o);if(this._viewZone?.heightInLines===s)return;let l=this.getPosition();this._viewZone&&l&&l.lineNumber!==this._viewZone.afterLineNumber&&this._viewZone.afterLineNumber!==0&&(this._viewZone.afterLineNumber=l.lineNumber);let c=DC.capture(this.editor);this._relayout(s),c.restore(this.editor)}}_applyTheme(){let e=jro(this._commentThread.state,this.themeService.getColorTheme())||We.transparent;this.style({arrowColor:e,frameColor:e});let t=this.editor.getOption(59);this._commentThreadWidget.applyTheme(t)}show(e,t){let o=this._commentGlyph?.getPosition(),n=z.isIRange(e)?e:e?z.fromPositions(e):void 0;if(o?.position&&n&&o.position.lineNumber!==n.endLineNumber){let s=o.position.lineNumber-n.endLineNumber;n=new z(n.startLineNumber+s,n.startColumn,n.endLineNumber+s,n.endColumn)}let r=this._isExpanded;this._isExpanded=!0,super.show(n??new z(0,0,0,0),t),this._commentThread.collapsibleState=1,this._refresh(this._commentThreadWidget.getDimensions()),r||this._onDidChangeExpandedState.fire(!0)}async collapseAndFocusRange(){await this.collapse(!0)&&z.isIRange(this.commentThread.range)&&pn(this.editor)&&this.editor.setSelection(this.commentThread.range)}hide(){this._isExpanded&&(this._isExpanded=!1,this.editor.hasWidgetFocus()&&this.editor.focus(),(!this._commentThread.comments||!this._commentThread.comments.length)&&this.deleteCommentThread(),this._onDidChangeExpandedState.fire(!1)),super.hide()}dispose(){super.dispose(),this._commentGlyph&&(this._commentGlyph.dispose(),this._commentGlyph=void 0),this._globalToDispose.dispose(),this._commentThreadDisposables.forEach(e=>e.dispose()),this._onDidClose.fire(void 0),this._onDidClose.dispose(),this._onDidCreateThread.dispose(),this._onDidChangeExpandedState.dispose()}};tDe=I([m(5,F),m(6,Le),m(7,Om),m(8,X),m(9,B),m(10,at)],tDe);var kAt=class{constructor(i,e){this.range=i;this.options=e}get id(){return this._decorationId}set id(i){this._decorationId=i}},EAt=class a extends x{constructor(e){super();this.decorationIds=[];this.activeDecorationIds=[];this.threadCollapseStateListeners=[];let t={description:a.description,isWholeLine:!1,zIndex:20,className:"comment-thread-range",shouldFillLineOnLineBreak:!0};this.decorationOptions=mo.createDynamic(t);let o={description:a.description,isWholeLine:!1,zIndex:20,className:"comment-thread-range-current",shouldFillLineOnLineBreak:!0};this.activeDecorationOptions=mo.createDynamic(o),this._register(e.onDidChangeCurrentCommentThread(n=>{this.updateCurrent(n)})),this._register(e.onDidUpdateCommentThreads(()=>{this.updateCurrent(void 0)}))}static{this.description="comment-thread-range-decorator"}updateCurrent(e){if(!this.editor||e?.resource&&e.resource?.toString()!==this.editor.getModel()?.uri.toString())return;this.currentThreadCollapseStateListener?.dispose();let t=[];if(e){let o=e.range;o&&!(o.startLineNumber===o.endLineNumber&&o.startColumn===o.endColumn)&&e.collapsibleState===1&&(this.currentThreadCollapseStateListener=e.onDidChangeCollapsibleState(n=>{n===0&&this.updateCurrent(void 0)}),t.push(new kAt(o,this.activeDecorationOptions)))}this.editor.changeDecorations(o=>{this.activeDecorationIds=o.deltaDecorations(this.activeDecorationIds,t),t.forEach((n,r)=>n.id=this.decorationIds[r])})}update(e,t){let o=e?.getModel();if(!e||!o)return;Be(this.threadCollapseStateListeners),this.editor=e;let n=[];for(let r of t)r.threads.forEach(s=>{if(s.isDisposed)return;let l=s.range;!l||l.startLineNumber===l.endLineNumber&&l.startColumn===l.endColumn||(this.threadCollapseStateListeners.push(s.onDidChangeCollapsibleState(()=>{this.update(e,t)})),s.collapsibleState!==0&&n.push(new kAt(l,this.decorationOptions)))});e.changeDecorations(r=>{this.decorationIds=r.deltaDecorations(this.decorationIds,n),n.forEach((s,l)=>s.id=this.decorationIds[l])})}dispose(){Be(this.threadCollapseStateListeners),this.currentThreadCollapseStateListener?.dispose(),super.dispose()}};var Ibi="editor.contrib.review",v2=class{constructor(i,e,t,o,n,r,s,l=!1){this._editor=i;this._ownerId=e;this._extensionId=t;this._label=o;this._range=n;this.options=r;this.commentingRangesInfo=s;this.isHover=l;this._startLineNumber=n.startLineNumber,this._endLineNumber=n.endLineNumber}get id(){return this._decorationId}set id(i){this._decorationId=i}get range(){return{startLineNumber:this._startLineNumber,startColumn:1,endLineNumber:this._endLineNumber,endColumn:1}}getCommentAction(){return{extensionId:this._extensionId,label:this._label,ownerId:this._ownerId,commentingRangesInfo:this.commentingRangesInfo}}getOriginalRange(){return this._range}getActiveRange(){return this.id?this._editor.getModel().getDecorationRange(this.id):void 0}},TAt=class a{constructor(){this.commentingRangeDecorations=[];this.decorationIds=[];this._lastHover=-1;this._onDidChangeDecorationsCount=new E;this.onDidChangeDecorationsCount=this._onDidChangeDecorationsCount.event;let i={description:a.description,isWholeLine:!0,linesDecorationsClassName:"comment-range-glyph comment-diff-added"};this.decorationOptions=mo.createDynamic(i);let e={description:a.description,isWholeLine:!0,linesDecorationsClassName:"comment-range-glyph line-hover"};this.hoverDecorationOptions=mo.createDynamic(e);let t={description:a.description,isWholeLine:!0,linesDecorationsClassName:"comment-range-glyph multiline-add"};this.multilineDecorationOptions=mo.createDynamic(t)}static{this.description="commenting-range-decorator"}updateHover(i){this._editor&&this._infos&&i!==this._lastHover&&this._doUpdate(this._editor,this._infos,i),this._lastHover=i??-1}updateSelection(i,e=new z(0,0,0,0)){this._lastSelection=e.isEmpty()?void 0:e,this._lastSelectionCursor=e.isEmpty()?void 0:i,this._editor&&this._infos&&this._doUpdate(this._editor,this._infos,i,e)}update(i,e,t,o){i&&(this._editor=i,this._infos=e,this._doUpdate(i,e,t,o))}_lineHasThread(i,e){return i.getDecorationsInRange(e)?.find(t=>t.options.description===Jue.description)}_doUpdate(i,e,t=-1,o=this._lastSelection){if(!i.getModel())return;t=this._lastSelectionCursor??t;let r=[];for(let l of e)l.commentingRanges.ranges.forEach(c=>{let u=new z(c.startLineNumber,c.startColumn,c.endLineNumber,c.endColumn),p=o?u.intersectRanges(o):void 0;if(o&&t>=0&&p&&!(p.startLineNumber===p.endLineNumber&&t===p.startLineNumber)){let h;t<=p.startLineNumber?(h=p.collapseToStart(),p=new z(p.startLineNumber+1,1,p.endLineNumber,1)):(h=new z(p.endLineNumber,1,p.endLineNumber,1),p=new z(p.startLineNumber,1,p.endLineNumber-1,1)),r.push(new v2(i,l.uniqueOwner,l.extensionId,l.label,p,this.multilineDecorationOptions,l.commentingRanges,!0)),this._lineHasThread(i,h)||r.push(new v2(i,l.uniqueOwner,l.extensionId,l.label,h,this.hoverDecorationOptions,l.commentingRanges,!0));let g=Math.min(h.startLineNumber,p.startLineNumber)-1,f=u.startLineNumber<=g,v=Math.max(h.endLineNumber,p.endLineNumber)+1,b=u.endLineNumber>=v;if(f){let S=new z(c.startLineNumber,1,g,1);r.push(new v2(i,l.uniqueOwner,l.extensionId,l.label,S,this.decorationOptions,l.commentingRanges,!0))}if(b){let S=new z(v,1,c.endLineNumber,1);r.push(new v2(i,l.uniqueOwner,l.extensionId,l.label,S,this.decorationOptions,l.commentingRanges,!0))}}else if(u.startLineNumber<=t&&t<=u.endLineNumber){if(u.startLineNumber<t){let g=new z(c.startLineNumber,1,t-1,1);r.push(new v2(i,l.uniqueOwner,l.extensionId,l.label,g,this.decorationOptions,l.commentingRanges,!0))}let h=new z(t,1,t,1);if(this._lineHasThread(i,h)||r.push(new v2(i,l.uniqueOwner,l.extensionId,l.label,h,this.hoverDecorationOptions,l.commentingRanges,!0)),t<u.endLineNumber){let g=new z(t+1,1,c.endLineNumber,1);r.push(new v2(i,l.uniqueOwner,l.extensionId,l.label,g,this.decorationOptions,l.commentingRanges,!0))}}else r.push(new v2(i,l.uniqueOwner,l.extensionId,l.label,c,this.decorationOptions,l.commentingRanges))});i.changeDecorations(l=>{this.decorationIds=l.deltaDecorations(this.decorationIds,r),r.forEach((c,u)=>c.id=this.decorationIds[u])});let s=this.commentingRangeDecorations.length-r.length;this.commentingRangeDecorations=r,s&&this._onDidChangeDecorationsCount.fire(this.commentingRangeDecorations.length)}areRangesIntersectingOrTouchingByLine(i,e){return!(i.endLineNumber<e.startLineNumber-1||e.endLineNumber+1<i.startLineNumber)}getMatchedCommentAction(i){if(i===void 0){let o=this._infos?.filter(n=>n.commentingRanges.fileComments);return o?o.map(n=>({action:{ownerId:n.uniqueOwner,extensionId:n.extensionId,label:n.label,commentingRangesInfo:n.commentingRanges}})):[]}let e=new Map;for(let o of this.commentingRangeDecorations){let n=o.getActiveRange();if(n&&this.areRangesIntersectingOrTouchingByLine(n,i)){let r=o.getCommentAction(),s=e.get(r.ownerId);if(s?.action.commentingRangesInfo===r.commentingRangesInfo){let l=new z(n.startLineNumber<s.range.startLineNumber?n.startLineNumber:s.range.startLineNumber,n.startColumn<s.range.startColumn?n.startColumn:s.range.startColumn,n.endLineNumber>s.range.endLineNumber?n.endLineNumber:s.range.endLineNumber,n.endColumn>s.range.endColumn?n.endColumn:s.range.endColumn);e.set(r.ownerId,{range:l,action:r})}else e.set(r.ownerId,{range:n,action:r})}}let t=new Set;return Array.from(e.values()).filter(o=>t.has(o.action.ownerId)?!1:(t.add(o.action.ownerId),!0))}getNearestCommentingRange(i,e){let t,o;if(e){o=[];for(let n=this.commentingRangeDecorations.length-1;n>=0;n--)o.push(this.commentingRangeDecorations[n])}else o=this.commentingRangeDecorations;for(let n of o){let r=n.getActiveRange();if(r){if(t&&this.areRangesIntersectingOrTouchingByLine(r,t)){t=z.plusRange(t,r);continue}if(r.startLineNumber<=i.lineNumber&&i.lineNumber<=r.endLineNumber){t=new z(r.startLineNumber,r.startColumn,r.endLineNumber,r.endColumn);continue}if(!(!e&&r.endLineNumber<i.lineNumber)&&!(e&&r.startLineNumber>i.lineNumber))return r}}return o.length>0?o[0].getActiveRange()??void 0:void 0}dispose(){this._onDidChangeDecorationsCount.dispose(),this.commentingRangeDecorations=[]}};function ybi(a,i){if(!a?.comment||!a?.thread?.comments)return;let e=a.thread.comments?.indexOf(a.comment);if(e===void 0||e<0||i==="previous"&&e===0||i==="next"&&e===a.thread.comments.length-1)return;let t=a.thread.comments?.[i==="previous"?e-1:e+1];if(t)return{...a,comment:t}}function pZ(a,i,e,t,o,n,r,s,l){if(!t.resource)return;a.isCommentingEnabled||a.enableCommenting(!0);let c=t.range,u=n?2:s?0:1,p=i.activeTextEditorControl,h=mc(p)?[p.getOriginalEditor(),p.getModifiedEditor()]:p?[p]:[],g=t.threadId,f=o?.uniqueIdInThread,v=A.parse(t.resource);for(let b of h){let S=b.getModel();if(S instanceof ip&&e.extUri.isEqual(v,S.uri)){g&&pn(b)&&nx.get(b)?.revealCommentThread(g,f,!0,u);return}}i.openEditor({resource:v,options:{pinned:r,preserveFocus:s,selection:c??new z(1,1,1,1)}},l?In:jn).then(b=>{if(b){let S=b.getControl();g&&pn(S)&&nx.get(S)?.revealCommentThread(g,f,!0,u)}})}var nx=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.commentService=t;this.instantiationService=o;this.codeEditorService=n;this.contextMenuService=r;this.quickInputService=s;this.viewsService=l;this.configurationService=c;this.editorService=p;this.keybindingService=h;this.accessibilityService=g;this.notificationService=f;this.localToDispose=this._register(new N);this.mouseDownInfo=null;this._commentingRangeSpaceReserved=!1;this._commentingRangeAmountReserved=0;this._emptyThreadsToAddQueue=[];this._inProcessContinueOnComments=new Map;this._editorDisposables=[];this._hasRespondedToEditorChange=!1;this._commentInfos=[],this._commentWidgets=[],this._pendingNewCommentCache={},this._pendingEditsCache={},this._computePromise=null,this._activeCursorHasCommentingRange=_c.activeCursorHasCommentingRange.bindTo(u),this._activeCursorHasComment=_c.activeCursorHasComment.bindTo(u),this._activeEditorHasCommentingRange=_c.activeEditorHasCommentingRange.bindTo(u),this._commentWidgetVisible=_c.commentWidgetVisible.bindTo(u),!(e instanceof id)&&(this.editor=e,this._commentingRangeDecorator=this._register(new TAt),this._register(this._commentingRangeDecorator.onDidChangeDecorationsCount(v=>{v===0?this.clearEditorListeners():this._editorDisposables.length===0&&this.registerEditorListeners()})),this._register(this._commentThreadRangeDecorator=new EAt(this.commentService)),this._register(this.commentService.onDidDeleteDataProvider(v=>{v?(delete this._pendingNewCommentCache[v],delete this._pendingEditsCache[v]):(this._pendingNewCommentCache={},this._pendingEditsCache={}),this.beginCompute()})),this._register(this.commentService.onDidSetDataProvider(v=>this.beginComputeAndHandleEditorChange())),this._register(this.commentService.onDidUpdateCommentingRanges(v=>this.beginComputeAndHandleEditorChange())),this._register(this.commentService.onDidSetResourceCommentInfos(async v=>{let b=this.editor&&this.editor.hasModel()&&this.editor.getModel().uri;b&&b.toString()===v.resource.toString()&&await this.setComments(v.commentInfos.filter(S=>S!==null))})),this._register(this.commentService.onDidChangeCommentingEnabled(v=>{v?(this.registerEditorListeners(),this.beginCompute()):(this.tryUpdateReservedSpace(),this.clearEditorListeners(),this._commentingRangeDecorator.update(this.editor,[]),this._commentThreadRangeDecorator.update(this.editor,[]),Be(this._commentWidgets),this._commentWidgets=[])})),this._register(this.editor.onWillChangeModel(v=>this.onWillChangeModel(v))),this._register(this.editor.onDidChangeModel(v=>this.onModelChanged())),this._register(this.configurationService.onDidChangeConfiguration(v=>{v.affectsConfiguration("diffEditor.renderSideBySide")&&this.beginCompute()})),this.onModelChanged(),this._register(this.codeEditorService.registerDecorationType("comment-controller",IAt,{})),this._register(this.commentService.registerContinueOnCommentProvider({provideContinueOnComments:()=>{let v=[];if(this._commentWidgets)for(let b of this._commentWidgets){let y=b.getPendingComments().newComment;if(!y)continue;let w;if(b.commentThread.comments&&b.commentThread.comments.length){let k=b.commentThread.comments[b.commentThread.comments.length-1];typeof k.body=="string"?w=k.body:w=k.body.value}y.body!==w&&v.push({uniqueOwner:b.uniqueOwner,uri:b.editor.getModel().uri,range:b.commentThread.range,comment:y,isReply:b.commentThread.comments!==void 0&&b.commentThread.comments.length>0})}return v}})))}registerEditorListeners(){this._editorDisposables=[],this.editor&&(this._editorDisposables.push(this.editor.onMouseMove(e=>this.onEditorMouseMove(e))),this._editorDisposables.push(this.editor.onMouseLeave(()=>this.onEditorMouseLeave())),this._editorDisposables.push(this.editor.onDidChangeCursorPosition(e=>this.onEditorChangeCursorPosition(e.position))),this._editorDisposables.push(this.editor.onDidFocusEditorWidget(()=>this.onEditorChangeCursorPosition(this.editor?.getPosition()??null))),this._editorDisposables.push(this.editor.onDidChangeCursorSelection(e=>this.onEditorChangeCursorSelection(e))),this._editorDisposables.push(this.editor.onDidBlurEditorWidget(()=>this.onEditorChangeCursorSelection())))}clearEditorListeners(){Be(this._editorDisposables),this._editorDisposables=[]}onEditorMouseLeave(){this._commentingRangeDecorator.updateHover()}onEditorMouseMove(e){let t=e.target.position?.lineNumber;e.event.leftButton.valueOf()&&t&&this.mouseDownInfo?this._commentingRangeDecorator.updateSelection(t,new z(this.mouseDownInfo.lineNumber,1,t,1)):this._commentingRangeDecorator.updateHover(t)}onEditorChangeCursorSelection(e){let t=this.editor?.getPosition()?.lineNumber;t&&this._commentingRangeDecorator.updateSelection(t,e?.selection)}onEditorChangeCursorPosition(e){if(!e)return;let t=z.fromPositions(e,{column:-1,lineNumber:e.lineNumber}),o=this.editor?.getDecorationsInRange(t),n=!1;if(o)for(let r of o)if(r.options.description===Jue.description){n=!1;break}else r.options.description===TAt.description&&(n=!0);this._activeCursorHasCommentingRange.set(n),this._activeCursorHasComment.set(this.getCommentsAtLine(t).length>0)}isEditorInlineOriginal(e){return this.configurationService.getValue("diffEditor.renderSideBySide")?!1:!!this.editorService.visibleTextEditorControls.find(o=>o.getEditorType()===oj.IDiffEditor?o.getOriginalEditor()===e:!1)}beginCompute(){return this._computePromise=Ln(e=>{let t=this.editor&&this.editor.hasModel()&&this.editor.getModel().uri;return t?this.commentService.getDocumentComments(t):Promise.resolve([])}),this._computeAndSetPromise=this._computePromise.then(async e=>{await this.setComments(di(e)),this._computePromise=null},e=>console.log(e)),this._computePromise.then(()=>this._computeAndSetPromise=void 0),this._computeAndSetPromise}beginComputeCommentingRanges(){this._computeCommentingRangeScheduler&&this._computeCommentingRangeScheduler.trigger(()=>{let e=this.editor&&this.editor.hasModel()&&this.editor.getModel().uri;return e?this.commentService.getDocumentComments(e):Promise.resolve([])}).then(e=>{if(this.commentService.isCommentingEnabled){let t=di(e);this._commentingRangeDecorator.update(this.editor,t,this.editor?.getPosition()?.lineNumber,this.editor?.getSelection()??void 0)}},e=>(mt(e),null))}static get(e){return e.getContribution(Ibi)}revealCommentThread(e,t,o,n){let r=this._commentWidgets.filter(s=>s.commentThread.threadId===e);r.length===1?r[0].reveal(t,n):o&&(this._computeAndSetPromise?this._computeAndSetPromise.then(s=>{this.revealCommentThread(e,t,!1,n)}):this.beginCompute().then(s=>{this.revealCommentThread(e,t,!1,n)}))}collapseAll(){for(let e of this._commentWidgets)e.collapse(!0)}async collapseVisibleComments(){if(!this.editor)return;let e=this.editor.getVisibleRanges();for(let t of this._commentWidgets)t.expanded&&t.commentThread.range&&e.some(n=>z.areIntersectingOrTouching(n,t.commentThread.range))&&await t.collapse(!0)}_updateCommentWidgetVisibleContext(){let e=this._commentWidgets.some(t=>t.expanded);this._commentWidgetVisible.set(e)}expandAll(){for(let e of this._commentWidgets)e.expand()}expandUnresolved(){for(let e of this._commentWidgets)e.commentThread.state===0&&e.expand()}nextCommentThread(e){this._findNearestCommentThread(e)}_findNearestCommentThread(e,t){if(!this._commentWidgets.length||!this.editor?.hasModel())return;let o=t?this.editor.getSelection().getStartPosition():this.editor.getSelection().getEndPosition(),n=this._commentWidgets.sort((l,c)=>{if(t){let u=l;l=c,c=u}return l.commentThread.range===void 0?-1:c.commentThread.range===void 0?1:l.commentThread.range.startLineNumber<c.commentThread.range.startLineNumber?-1:l.commentThread.range.startLineNumber>c.commentThread.range.startLineNumber?1:l.commentThread.range.startColumn<c.commentThread.range.startColumn?-1:l.commentThread.range.startColumn>c.commentThread.range.startColumn?1:0}),r=Ky(n,l=>{let c=t?o.lineNumber:l.commentThread.range?.startLineNumber??0,u=t?l.commentThread.range?.startLineNumber??0:o.lineNumber,p=t?o.column:l.commentThread.range?.startColumn??0,h=t?l.commentThread.range?.startColumn??0:o.column;return c>u?!0:c<u?!1:p>h}),s=n[r];s!==void 0&&(this.editor.setSelection(s.commentThread.range??new z(1,1,1,1)),s.reveal(void 0,e?1:0))}previousCommentThread(e){this._findNearestCommentThread(e,!0)}_findNearestCommentingRange(e){if(!this.editor?.hasModel())return;let t=this.editor.getSelection().getEndPosition(),o=this._commentingRangeDecorator.getNearestCommentingRange(t,e);if(o){let n=e?o.getEndPosition():o.getStartPosition();this.editor.setPosition(n),this.editor.revealLineInCenterIfOutsideViewport(n.lineNumber)}if(this.accessibilityService.isScreenReaderOptimized()){let n=o?.getStartPosition().lineNumber,r=o?.getEndPosition().lineNumber;n&&r&&(n===r?qr(d(9109,null,n)):qr(d(9110,null,n,r)))}}nextCommentingRange(){this._findNearestCommentingRange()}previousCommentingRange(){this._findNearestCommentingRange(!0)}dispose(){super.dispose(),Be(this._editorDisposables),Be(this._commentWidgets),this.editor=null}onWillChangeModel(e){e.newModelUrl&&this.tryUpdateReservedSpace(e.newModelUrl)}async handleCommentAdded(e,t,o){if(this._commentWidgets.filter(h=>h.uniqueOwner===t&&h.commentThread.threadId===o.threadId).length)return;let r=this._commentWidgets.filter(h=>h.uniqueOwner===t&&h.commentThread.commentThreadHandle===-1&&z.equalsRange(h.commentThread.range,o.range));if(r.length){r[0].update(o);return}let s=this._inProcessContinueOnComments.get(t)?.findIndex(h=>h.range===void 0?o.range===void 0:z.lift(h.range).equalsRange(o.range)),l;s!==void 0&&s>=0&&(l=this._inProcessContinueOnComments.get(t)?.splice(s,1)[0].comment.body);let c=(this._pendingNewCommentCache[t]&&this._pendingNewCommentCache[t][o.threadId])??l,u=this._pendingEditsCache[t]&&this._pendingEditsCache[t][o.threadId],p=o.canReply&&o.isTemplate&&(!o.comments||o.comments.length===0)&&(!o.editorId||o.editorId===e);await this.displayCommentThread(t,o,p,c,u),this._commentInfos.filter(h=>h.uniqueOwner===t)[0].threads.push(o),this.tryUpdateReservedSpace()}onModelChanged(){this.localToDispose.clear(),this.tryUpdateReservedSpace(),this.removeCommentWidgetsAndStoreCache(),this.editor&&(this._hasRespondedToEditorChange=!1,this.localToDispose.add(this.editor.onMouseDown(e=>this.onEditorMouseDown(e))),this.localToDispose.add(this.editor.onMouseUp(e=>this.onEditorMouseUp(e))),this._editorDisposables.length&&(this.clearEditorListeners(),this.registerEditorListeners()),this._computeCommentingRangeScheduler=new Xo(200),this.localToDispose.add({dispose:()=>{this._computeCommentingRangeScheduler?.cancel(),this._computeCommentingRangeScheduler=null}}),this.localToDispose.add(this.editor.onDidChangeModelContent(async()=>{this.beginComputeCommentingRanges()})),this.localToDispose.add(this.commentService.onDidUpdateCommentThreads(async e=>{let t=this.editor&&this.editor.hasModel()&&this.editor.getModel().uri;if(!t||!this.commentService.isCommentingEnabled)return;this._computePromise&&await this._computePromise;let o=this._commentInfos.filter(u=>u.uniqueOwner===e.uniqueOwner);if(!o||!o.length)return;let n=e.added.filter(u=>u.resource&&u.resource===t.toString()),r=e.removed.filter(u=>u.resource&&u.resource===t.toString()),s=e.changed.filter(u=>u.resource&&u.resource===t.toString()),l=e.pending.filter(u=>u.uri.toString()===t.toString());r.forEach(u=>{let p=this._commentWidgets.filter(g=>g.uniqueOwner===e.uniqueOwner&&g.commentThread.threadId===u.threadId&&g.commentThread.threadId!=="");if(p.length){let g=p[0],f=this._commentWidgets.indexOf(g);this._commentWidgets.splice(f,1),g.dispose()}let h=this._commentInfos.filter(g=>g.uniqueOwner===e.uniqueOwner)[0].threads;for(let g=0;g<h.length;g++)h[g]===u&&(h.splice(g,1),g--)});for(let u of s){let p=this._commentWidgets.filter(h=>h.uniqueOwner===e.uniqueOwner&&h.commentThread.threadId===u.threadId);p.length&&(p[0].update(u),this.openCommentsView(u))}let c=this.editor?.getId();for(let u of n)await this.handleCommentAdded(c,e.uniqueOwner,u);for(let u of l)await this.resumePendingComment(t,u);this._commentThreadRangeDecorator.update(this.editor,o)})),this.beginComputeAndHandleEditorChange())}async resumePendingComment(e,t){let o=this._commentWidgets.filter(n=>n.uniqueOwner===t.uniqueOwner&&z.lift(n.commentThread.range)?.equalsRange(t.range));if(t.isReply&&o.length)this.commentService.removeContinueOnComment({uniqueOwner:t.uniqueOwner,uri:e,range:t.range,isReply:!0}),o[0].setPendingComment(t.comment);else if(o.length){this.commentService.removeContinueOnComment({uniqueOwner:t.uniqueOwner,uri:e,range:t.range,isReply:!1});let n=o[0].getPendingComments().newComment,r;!n||t.comment.body.includes(n.body)?r=t.comment:n.body.includes(t.comment.body)?r=n:r={body:`${n}
${t.comment.body}`,cursor:t.comment.cursor},o[0].setPendingComment(r)}else if(!t.isReply){if(!this.commentService.removeContinueOnComment({uniqueOwner:t.uniqueOwner,uri:e,range:t.range,isReply:!1}))return;this._inProcessContinueOnComments.has(t.uniqueOwner)||this._inProcessContinueOnComments.set(t.uniqueOwner,[]),this._inProcessContinueOnComments.get(t.uniqueOwner)?.push(t),await this.commentService.createCommentThreadTemplate(t.uniqueOwner,t.uri,t.range?z.lift(t.range):void 0)}}beginComputeAndHandleEditorChange(){this.beginCompute().then(()=>{if(!this._hasRespondedToEditorChange&&this._commentInfos.some(e=>e.commentingRanges.ranges.length>0||e.commentingRanges.fileComments))if(this._hasRespondedToEditorChange=!0,this.configurationService.getValue("accessibility.verbosity.comments")){let t=this.keybindingService.lookupKeybinding("editor.action.accessibilityHelp")?.getAriaLabel();t?qr(d(9114,null,t)):qr(d(9115,null))}else qr(d(9113,null))})}async openCommentsView(e){if(e.comments&&e.comments.length>0&&fYe(e)){let t=this.configurationService.getValue(d2).openView;if(t==="file")return this.viewsService.openView(zu);if((t==="firstFile"||t==="firstFileUnresolved"&&e.state===0)&&!this.viewsService.getViewWithId(zu)?.hasRendered)return this.viewsService.openView(zu)}}async displayCommentThread(e,t,o,n,r){let s=this.editor?.getModel();if(!s||!this.editor||this.isEditorInlineOriginal(this.editor))return;let l;t.range&&!n&&(l=this.commentService.removeContinueOnComment({uniqueOwner:e,uri:s.uri,range:t.range,isReply:!0}));let c=this.instantiationService.createInstance(tDe,this.editor,e,t,n??l?.comment,r);await c.display(t.range,o),this._commentWidgets.push(c),this.localToDispose.add(c.onDidChangeExpandedState(()=>this._updateCommentWidgetVisibleContext())),this.localToDispose.add(c.onDidClose(()=>this._updateCommentWidgetVisibleContext())),this.openCommentsView(t)}onEditorMouseDown(e){this.mouseDownInfo=(e.target.element?.className.indexOf("comment-range-glyph")??-1)>=0?Yro(e):null}onEditorMouseUp(e){let t=Xro(this.mouseDownInfo,e);if(this.mouseDownInfo=null,!this.editor||t===null||!e.target.element)return;let o=e.target.element.className.indexOf("comment-range-glyph")>=0,n=e.target.position.lineNumber,r,s;t!==n?t>n?s=new z(t,this.editor.getModel().getLineLength(t)+1,n,1):s=new z(t,1,n,this.editor.getModel().getLineLength(n)+1):o&&(s=this.editor.getSelection()),s&&s.startLineNumber<=n&&n<=s.endLineNumber?(r=s,this.editor.setSelection(new z(s.endLineNumber,1,s.endLineNumber,1))):o&&(r=new z(n,1,n,1)),r&&this.addOrToggleCommentAtLine(r,e)}getCommentsAtLine(e){return this._commentWidgets.filter(t=>t.getGlyphPosition()===(e?e.endLineNumber:0))}async addOrToggleCommentAtLine(e,t){if(this._addInProgress)this._emptyThreadsToAddQueue.push([e,t]);else{this._addInProgress=!0;let o=this.getCommentsAtLine(e);if(o.length){let n=o.every(r=>r.expanded);o.forEach(n?r=>r.collapse(!0):r=>r.expand(!0)),this.processNextThreadToAdd();return}else this.addCommentAtLine(e,t)}}processNextThreadToAdd(){this._addInProgress=!1;let e=this._emptyThreadsToAddQueue.shift();e&&this.addOrToggleCommentAtLine(e[0],e[1])}clipUserRangeToCommentRange(e,t){return e.startLineNumber<t.startLineNumber&&(e=new z(t.startLineNumber,t.startColumn,e.endLineNumber,e.endColumn)),e.endLineNumber>t.endLineNumber&&(e=new z(e.startLineNumber,e.startColumn,t.endLineNumber,t.endColumn)),e}addCommentAtLine(e,t){let o=this._commentingRangeDecorator.getMatchedCommentAction(e);if(!o.length||!this.editor?.hasModel())return this._addInProgress=!1,o.length||(e?this.notificationService.error(d(9111,null)):this.notificationService.error(d(9112,null))),Promise.resolve();if(o.length>1){if(t&&e)return this.contextMenuService.showContextMenu({getAnchor:()=>t.event,getActions:()=>this.getContextMenuActions(o,e),getActionsContext:()=>o.length?o[0]:void 0,onHide:()=>{this._addInProgress=!1}}),Promise.resolve();{let n=this.getCommentProvidersQuickPicks(o);return this.quickInputService.pick(n,{placeHolder:d(9116,null),matchOnDescription:!0}).then(r=>{if(!r)return;let s=o.filter(l=>l.action.ownerId===r.id);if(s.length){let{ownerId:l}=s[0].action,c=e&&s[0].range?this.clipUserRangeToCommentRange(e,s[0].range):e;this.addCommentAtLine2(c,l)}}).then(()=>{this._addInProgress=!1})}}else{let{ownerId:n}=o[0].action,r=e&&o[0].range?this.clipUserRangeToCommentRange(e,o[0].range):e;this.addCommentAtLine2(r,n)}return Promise.resolve()}getCommentProvidersQuickPicks(e){return e.map(o=>{let{ownerId:n,extensionId:r,label:s}=o.action;return{label:s??r??n,id:n}})}getContextMenuActions(e,t){let o=[];return e.forEach(n=>{let{ownerId:r,extensionId:s,label:l}=n.action;o.push(new it("addCommentThread",`${l||s}`,void 0,!0,()=>{let c=n.range?this.clipUserRangeToCommentRange(t,n.range):t;return this.addCommentAtLine2(c,r),Promise.resolve()}))}),o}addCommentAtLine2(e,t){this.editor&&(this.commentService.createCommentThreadTemplate(t,this.editor.getModel().uri,e,this.editor.getId()),this.processNextThreadToAdd())}getExistingCommentEditorOptions(e){let t=e.getOption(74),o=[],n=e.getRawOptions().extraEditorClassName;return n&&(o=n.split(" ")),{lineDecorationsWidth:t,extraEditorClassName:o}}getWithoutCommentsEditorOptions(e,t,o){let n=o,r=t.findIndex(l=>l==="inline-comment");r>=0&&t.splice(r,1);let s=e.getOptions();return s.get(52)&&s.get(126)!=="never"&&(n+=11),n-=24,{extraEditorClassName:t,lineDecorationsWidth:n}}getWithCommentsLineDecorationWidth(e,t){let o=t,n=e.getOptions();return n.get(52)&&n.get(126)!=="never"&&(o-=11),o+=24,this._commentingRangeAmountReserved=o,this._commentingRangeAmountReserved}getWithCommentsEditorOptions(e,t,o){return t.push("inline-comment"),{lineDecorationsWidth:this.getWithCommentsLineDecorationWidth(e,o),extraEditorClassName:t}}updateEditorLayoutOptions(e,t,o){e.updateOptions({extraEditorClassName:t.join(" "),lineDecorationsWidth:o})}ensureCommentingRangeReservedAmount(e){let t=this.getExistingCommentEditorOptions(e);t.lineDecorationsWidth!==this._commentingRangeAmountReserved&&e.updateOptions({lineDecorationsWidth:this.getWithCommentsLineDecorationWidth(e,t.lineDecorationsWidth)})}tryUpdateReservedSpace(e){if(!this.editor)return;let t=this._commentInfos.some(r=>!!(r.commentingRanges&&(Array.isArray(r.commentingRanges)?r.commentingRanges:r.commentingRanges.ranges).length)||r.threads.length>0);e=e??this.editor.getModel()?.uri;let o=e?this.commentService.resourceHasCommentingRanges(e):!1,n=t||o;if(n&&this.commentService.isCommentingEnabled)if(this._commentingRangeSpaceReserved)this.ensureCommentingRangeReservedAmount(this.editor);else{this._commentingRangeSpaceReserved=!0;let{lineDecorationsWidth:r,extraEditorClassName:s}=this.getExistingCommentEditorOptions(this.editor),l=this.getWithCommentsEditorOptions(this.editor,s,r);this.updateEditorLayoutOptions(this.editor,l.extraEditorClassName,l.lineDecorationsWidth)}else if((!n||!this.commentService.isCommentingEnabled)&&this._commentingRangeSpaceReserved){this._commentingRangeSpaceReserved=!1;let{lineDecorationsWidth:r,extraEditorClassName:s}=this.getExistingCommentEditorOptions(this.editor),l=this.getWithoutCommentsEditorOptions(this.editor,s,r);this.updateEditorLayoutOptions(this.editor,l.extraEditorClassName,l.lineDecorationsWidth)}}async setComments(e){if(!this.editor||!this.commentService.isCommentingEnabled)return;this._commentInfos=e,this.tryUpdateReservedSpace(),this.removeCommentWidgetsAndStoreCache();let t=!1;for(let o of this._commentInfos){!t&&(o.commentingRanges.ranges.length>0||o.commentingRanges.fileComments)&&(t=!0);let n=this._pendingNewCommentCache[o.uniqueOwner],r=this._pendingEditsCache[o.uniqueOwner];o.threads=o.threads.filter(s=>!s.isDisposed);for(let s of o.threads){let l;n&&(l=n[s.threadId]);let c;r&&(c=r[s.threadId]),await this.displayCommentThread(o.uniqueOwner,s,!1,l,c)}for(let s of o.pendingCommentThreads??[])this.resumePendingComment(this.editor.getModel().uri,s)}this._commentingRangeDecorator.update(this.editor,this._commentInfos),this._commentThreadRangeDecorator.update(this.editor,this._commentInfos),t?this._activeEditorHasCommentingRange.set(!0):this._activeEditorHasCommentingRange.set(!1)}collapseAndFocusRange(e){this._commentWidgets?.find(t=>t.commentThread.threadId===e)?.collapseAndFocusRange()}removeCommentWidgetsAndStoreCache(){this._commentWidgets&&this._commentWidgets.forEach(e=>{let t=e.getPendingComments(),o=t.newComment,n=this._pendingNewCommentCache[e.uniqueOwner],r;if(e.commentThread.comments&&e.commentThread.comments.length){let c=e.commentThread.comments[e.commentThread.comments.length-1];typeof c.body=="string"?r=c.body:r=c.body.value}o&&o.body!==r?(n||(this._pendingNewCommentCache[e.uniqueOwner]={}),this._pendingNewCommentCache[e.uniqueOwner][e.commentThread.threadId]=o):n&&delete n[e.commentThread.threadId];let s=t.edits,l=this._pendingEditsCache[e.uniqueOwner];Object.keys(s).length>0?(l||(this._pendingEditsCache[e.uniqueOwner]={}),this._pendingEditsCache[e.uniqueOwner][e.commentThread.threadId]=s):l&&delete l[e.commentThread.threadId],e.dispose()}),this._commentWidgets=[]}};nx=I([m(1,Om),m(2,F),m(3,qt),m(4,Xe),m(5,Ue),m(6,$t),m(7,B),m(8,X),m(9,ee),m(10,_e),m(11,Oi),m(12,Ne)],nx);var OYe={id:D.AccessibleView,group:"navigation",when:Dd},FYe={id:D.CommandPalette,group:"",order:1},wbi=class extends K{constructor(){super({id:"editor.action.accessibleViewNext",precondition:C.and(Dd,ipe),keybinding:{primary:606,weight:200},menu:[FYe,{...OYe,when:C.and(Dd,ipe)}],icon:R.arrowDown,title:d(5291,null)})}run(i){i.get(ou).next()}};W(wbi);var Cbi=class extends K{constructor(){super({id:"editor.action.accessibleViewNextCodeBlock",precondition:C.and(ope,C.or(C.equals(cu.key,"panelChat"),C.equals(cu.key,"inlineChat"),C.equals(cu.key,"quickChat"))),keybinding:{primary:2572,mac:{primary:2572},weight:200},icon:R.arrowRight,menu:{...OYe,when:C.and(Dd,ope)},title:d(5292,null)})}run(i){i.get(ou).navigateToCodeBlock("next")}};W(Cbi);var xbi=class extends K{constructor(){super({id:"editor.action.accessibleViewPreviousCodeBlock",precondition:C.and(ope,C.or(C.equals(cu.key,"panelChat"),C.equals(cu.key,"inlineChat"),C.equals(cu.key,"quickChat"))),keybinding:{primary:2571,mac:{primary:2571},weight:200},icon:R.arrowLeft,menu:{...OYe,when:C.and(Dd,ope)},title:d(5294,null)})}run(i){i.get(ou).navigateToCodeBlock("previous")}};W(xbi);var kbi=class extends K{constructor(){super({id:"editor.action.accessibleViewPrevious",precondition:C.and(Dd,ipe),keybinding:{primary:604,weight:200},icon:R.arrowUp,menu:[FYe,{...OYe,when:C.and(Dd,ipe)}],title:d(5293,null)})}run(i){i.get(ou).previous()}};W(kbi);var Ebi=class extends K{constructor(){super({id:"editor.action.accessibleViewGoToSymbol",precondition:C.and(C.or(Dd,ox),MYe),keybinding:{primary:3117,secondary:[3161],weight:210},icon:R.symbolMisc,menu:[FYe,{...OYe,when:C.and(C.or(Dd,ox),MYe)}],title:d(5290,null)})}run(i){i.get(ou).goToSymbol()}};W(Ebi);function Jro(a){return a.register(),a}var npe=Jro(new pO({id:"editor.action.accessibilityHelp",precondition:void 0,kbOpts:{primary:571,weight:200,linux:{primary:1595,secondary:[571]},kbExpr:ox.toNegated()},menuOpts:[{menuId:D.CommandPalette,group:"",title:d(5283,null),order:1}]})),mZ=Jro(new pO({id:"editor.action.accessibleView",precondition:void 0,kbOpts:{primary:572,weight:200,linux:{primary:1596,secondary:[572]}},menuOpts:[{menuId:D.CommandPalette,group:"",title:d(5287,null),order:1}]})),Tbi=class extends K{constructor(){super({id:"editor.action.accessibleViewDisableHint",precondition:C.and(C.or(Dd,ox),RYe),keybinding:{primary:576,weight:200},icon:R.bellSlash,menu:[FYe,{id:D.AccessibleView,group:"navigation",when:C.and(C.or(Dd,ox),RYe)}],title:d(5289,null)})}run(i){i.get(ou).disableHint()}};W(Tbi);var _bi=class extends K{constructor(){super({id:"editor.action.accessibilityHelpConfigureKeybindings",precondition:C.and(ox,PYe),icon:R.recordKeys,keybinding:{primary:553,weight:200},menu:[{id:D.AccessibleView,group:"navigation",order:3,when:PYe}],title:d(5285,null)})}async run(i){await i.get(ou).configureKeybindings(!0)}};W(_bi);var Dbi=class extends K{constructor(){super({id:"editor.action.accessibilityHelpConfigureAssignedKeybindings",precondition:C.and(ox,AYe),icon:R.recordKeys,keybinding:{primary:543,weight:200},menu:[{id:D.AccessibleView,group:"navigation",order:4,when:AYe}],title:d(5284,null)})}async run(i){await i.get(ou).configureKeybindings(!1)}};W(Dbi);var Lbi=class extends K{constructor(){super({id:"editor.action.accessibilityHelpOpenHelpLink",precondition:C.and(ox),keybinding:{primary:550,weight:200},title:d(5286,null)})}run(i){i.get(ou).openHelpLink()}};W(Lbi);var Rbi=class extends K{constructor(){super({id:"editor.action.accessibleViewAcceptInlineCompletion",precondition:C.and(Dd,C.equals(cu.key,"inlineCompletions")),keybinding:{primary:2138,mac:{primary:346},weight:200},icon:R.check,menu:[FYe,{id:D.AccessibleView,group:"navigation",order:0,when:C.and(Dd,C.equals(cu.key,"inlineCompletions"))}],title:d(5288,null)})}async run(i){let e=i.get(qt),t=e.getActiveCodeEditor()||e.getFocusedCodeEditor();if(!t)return;let o=Hc.get(t)?.model.get(),n=o?.state.get();!o||!n||(await o.accept(t),o.stop(),t.focus())}};W(Rbi);var _At=new Y("commentsView.hasComments",!1),DAt=new Y("commentsView.someCommentsExpanded",!1),Mbi=new Y("commentsView.commentFocused",!1),y3o="commentsViewState";function w3o(a){let i=[];for(let e of a.resourceCommentThreads){let t=[];for(let o of e.commentThreads)fYe(o.thread)&&t.push({element:o});t.length>0&&i.push({element:e,children:t})}return i}var iDe=class extends o0{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){let S=new Al(y3o,v),y=S.getMemento(1,1);super({...e,filterOptions:{placeholder:d(9143,null),ariaLabel:d(9142,null),history:y.filterHistory||[],text:y.filter||"",focusContextKey:yYe.key}},c,l,r,s,o,t,u,p,g);this.editorService=n;this.commentService=h;this.uriIdentityService=f;this.pathService=b;this.totalComments=0;this.currentHeight=0;this.currentWidth=0;this.cachedFilterStats=void 0;this.onDidChangeVisibility=this.onDidChangeBodyVisibility;this.hasCommentsContextKey=_At.bindTo(s),this.someCommentsExpandedContextKey=DAt.bindTo(s),this.commentsFocusedContextKey=Mbi.bindTo(s),this.stateMemento=S,this.viewState=y,this.filters=this._register(new mAt({showResolved:this.viewState.showResolved!==!1,showUnresolved:this.viewState.showUnresolved!==!1,sortBy:this.viewState.sortBy??"resourceAscending"},this.contextKeyService)),this.filter=new rAt(new $B(this.filterWidget.getFilterText(),this.filters.showResolved,this.filters.showUnresolved)),this._register(this.filters.onDidChange(w=>{(w.showResolved||w.showUnresolved)&&this.updateFilter(),w.sortBy&&this.refresh()})),this._register(this.filterWidget.onDidChangeFilterText(()=>this.updateFilter()))}get focusedCommentNode(){let e=this.tree?.getFocus();if(e?.length===1&&e[0]instanceof fT)return e[0]}get focusedCommentInfo(){if(this.focusedCommentNode)return this.getScreenReaderInfoForNode(this.focusedCommentNode)}focusNextNode(){if(!this.tree)return;let e=this.tree.getFocus()?.[0];if(!e)return;let t=this.tree.navigate(e).next();for(;t&&!(t instanceof fT);)t=this.tree.navigate(t).next();t&&this.tree.setFocus([t])}focusPreviousNode(){if(!this.tree)return;let e=this.tree.getFocus()?.[0];if(!e)return;let t=this.tree.navigate(e).previous();for(;t&&!(t instanceof fT);)t=this.tree.navigate(t).previous();t&&this.tree.setFocus([t])}saveState(){this.viewState.filter=this.filterWidget.getFilterText(),this.viewState.filterHistory=this.filterWidget.getHistory(),this.viewState.showResolved=this.filters.showResolved,this.viewState.showUnresolved=this.filters.showUnresolved,this.viewState.sortBy=this.filters.sortBy,this.stateMemento.saveMemento(),super.saveState()}render(){super.render(),this._register(bT({name:"commentsView",focusNotifiers:[this,this.filterWidget],focusNextWidget:()=>{this.filterWidget.hasFocus()&&this.focus()},focusPreviousWidget:()=>{this.filterWidget.hasFocus()||this.focusFilter()}}))}focusFilter(){this.filterWidget.focus()}clearFilterText(){this.filterWidget.setFilterText("")}getFilterStats(){return this.cachedFilterStats||(this.cachedFilterStats={total:this.totalComments,filtered:this.tree?.getVisibleItemCount()??0}),this.cachedFilterStats}updateFilter(){this.filter.options=new $B(this.filterWidget.getFilterText(),this.filters.showResolved,this.filters.showUnresolved),this.tree?.filterComments(),this.cachedFilterStats=void 0;let{total:e,filtered:t}=this.getFilterStats();this.filterWidget.updateBadge(e===t||e===0?void 0:d(9153,null,t,e)),this.filterWidget.checkMoreFilters(!this.filters.showResolved||!this.filters.showUnresolved)}renderBody(e){super.renderBody(e),e.classList.add("comments-panel");let t=M(e,_(".comments-panel-container"));this.treeContainer=M(t,_(".tree-container")),this.treeContainer.classList.add("file-icon-themable-tree","show-file-icons"),this.cachedFilterStats=void 0,this.createTree(),this.createMessageBox(t),this._register(this.commentService.onDidSetAllCommentThreads(this.onAllCommentsChanged,this)),this._register(this.commentService.onDidUpdateCommentThreads(this.onCommentsUpdated,this)),this._register(this.commentService.onDidDeleteDataProvider(this.onDataProviderDeleted,this)),this._register(this.onDidChangeBodyVisibility(o=>{o&&this.refresh()})),this.renderComments()}focus(){super.focus();let e=this.tree?.getHTMLElement();e&&wa(e)||(!this.commentService.commentsModel.hasCommentThreads()&&this.messageBoxContainer?this.messageBoxContainer.focus():this.tree&&this.tree.domFocus())}renderComments(){this.treeContainer.classList.toggle("hidden",!this.commentService.commentsModel.hasCommentThreads()),this.renderMessage(),this.tree?.setChildren(null,w3o(this.commentService.commentsModel))}collapseAll(){this.tree&&(this.tree.collapseAll(),this.tree.setSelection([]),this.tree.setFocus([]),this.tree.domFocus(),this.tree.focusFirst())}expandAll(){this.tree&&(this.tree.expandAll(),this.tree.setSelection([]),this.tree.setFocus([]),this.tree.domFocus(),this.tree.focusFirst())}get hasRendered(){return!!this.tree}layoutBodyContent(e=this.currentHeight,t=this.currentWidth){this.messageBoxContainer&&(this.messageBoxContainer.style.height=`${e}px`),this.tree?.layout(e,t),this.currentHeight=e,this.currentWidth=t}createMessageBox(e){this.messageBoxContainer=M(e,_(".message-box-container")),this.messageBoxContainer.setAttribute("tabIndex","0")}renderMessage(){this.messageBoxContainer.textContent=this.commentService.commentsModel.getMessage(),this.messageBoxContainer.classList.toggle("hidden",this.commentService.commentsModel.hasCommentThreads())}makeCommentLocationLabel(e,t){let o=He(e);return t?t.startLineNumber===t.endLineNumber?d(9146,null,t.startLineNumber,t.startColumn,o):d(9145,null,t.startLineNumber,t.endLineNumber,o):d(9144,null,o)}makeScreenReaderLabelInfo(e,t){let o=e.comment.userName,n=this.makeCommentLocationLabel(e.resource,e.range),r=this.getReplyCountAsString(e,t),s=typeof e.comment.body=="string"?e.comment.body:e.comment.body.value;return{userName:o,locationLabel:n,replyCountLabel:r,bodyLabel:s}}getScreenReaderInfoForNode(e,t){let o="";if(t&&this.configurationService.getValue("accessibility.verbosity.comments")){let u=this.keybindingService.lookupKeybinding(mZ.id)?.getAriaLabel();o=u?d(9140,null,u):d(9141,null)}let n=this.getRepliesAsString(e,t),r=this.editorService.findEditors(e.resource),s=this.editorService.activeEditorPane?.getControl(),l;e.range&&r?.length&&pn(s)&&(l=s.getModel()?.getValueInRange(e.range),l&&(l=`
Corresponding code: 
`+l)),l||(l="");let c=this.makeScreenReaderLabelInfo(e,t);return e.threadRelevance===1?d(9149,null,c.userName,c.bodyLabel,c.locationLabel,c.replyCountLabel,l)+n+o:d(9148,null,c.userName,c.bodyLabel,c.locationLabel,c.replyCountLabel,l)+n+o}getRepliesAsString(e,t){return!e.replies.length||t?"":`
`+e.replies.map(o=>d(9151,null,o.comment.userName,typeof o.comment.body=="string"?o.comment.body:o.comment.body.value)).join(`
`)}getReplyCountAsString(e,t){return e.replies.length&&!t?d(9147,null,e.replies.length):""}createTree(){this.treeLabels=this._register(this.instantiationService.createInstance(Nl,this)),this.tree=this._register(this.instantiationService.createInstance(V_e,this.treeLabels,this.treeContainer,{overrideStyles:this.getLocationBasedColors().listOverrideStyles,selectionNavigation:!0,filter:this.filter,sorter:{compare:(e,t)=>{if(e instanceof u2||t instanceof u2)return 0;if(this.filters.sortBy==="updatedAtDescending")return e.lastUpdatedAt>t.lastUpdatedAt?-1:1;if(this.filters.sortBy==="resourceAscending"){if(e instanceof Uw&&t instanceof Uw){let o=this.pathService.defaultUriScheme;return e.resource.scheme!==t.resource.scheme&&(e.resource.scheme===o||t.resource.scheme===o)?t.resource.scheme===o?1:-1:e.resource.toString()>t.resource.toString()?1:-1}else if(e instanceof fT&&t instanceof fT&&e.thread.range&&t.thread.range)return e.thread.range?.startLineNumber>t.thread.range?.startLineNumber?1:-1}return 0}},keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:e=>{}},accessibilityProvider:{getAriaLabel:e=>e instanceof u2?d(9152,null):e instanceof Uw?d(9150,null,He(e.resource),e.resource.fsPath):e instanceof fT?this.getScreenReaderInfoForNode(e,!0):"",getWidgetAriaLabel(){return SYe.value}}})),this._register(this.tree.onDidOpen(e=>{this.openFile(e.element,e.editorOptions.pinned,e.editorOptions.preserveFocus,e.sideBySide)})),this._register(this.tree.onDidChangeModel(()=>{this.updateSomeCommentsExpanded()})),this._register(this.tree.onDidChangeCollapseState(()=>{this.updateSomeCommentsExpanded()})),this._register(this.tree.onDidFocus(()=>this.commentsFocusedContextKey.set(!0))),this._register(this.tree.onDidBlur(()=>this.commentsFocusedContextKey.set(!1)))}openFile(e,t,o,n){if(!e||!(e instanceof Uw||e instanceof fT))return;let r=e instanceof Uw?e.commentThreads[0].thread:e.thread,s=e instanceof Uw?e.commentThreads[0].comment:void 0;return pZ(this.commentService,this.editorService,this.uriIdentityService,r,s,!1,t,o,n)}async refresh(){if(this.tree&&this.isVisible()&&(this.hasCommentsContextKey.set(this.commentService.commentsModel.hasCommentThreads()),this.cachedFilterStats=void 0,this.renderComments(),this.tree.getSelection().length===0&&this.commentService.commentsModel.hasCommentThreads())){let e=this.commentService.commentsModel.resourceCommentThreads[0].commentThreads[0];e&&(this.tree.setFocus([e]),this.tree.setSelection([e]))}}onAllCommentsChanged(e){this.cachedFilterStats=void 0,this.totalComments+=e.commentThreads.length;let t=0;for(let o of e.commentThreads)o.state===0&&t++;this.refresh()}onCommentsUpdated(e){this.cachedFilterStats=void 0,this.totalComments+=e.added.length,this.totalComments-=e.removed.length;let t=0;for(let o of this.commentService.commentsModel.resourceCommentThreads)for(let n of o.commentThreads)n.threadState===0&&t++;this.refresh()}onDataProviderDeleted(e){this.cachedFilterStats=void 0,this.totalComments=0,this.refresh()}updateSomeCommentsExpanded(){this.someCommentsExpandedContextKey.set(this.isSomeCommentsExpanded())}areAllCommentsExpanded(){if(!this.tree)return!1;let e=this.tree.navigate();for(;e.next();)if(this.tree.isCollapsed(e.current()))return!1;return!0}isSomeCommentsExpanded(){if(!this.tree)return!1;let e=this.tree.navigate();for(;e.next();)if(!this.tree.isCollapsed(e.current()))return!0;return!1}};iDe=I([m(1,F),m(2,Bi),m(3,ee),m(4,B),m(5,X),m(6,Xe),m(7,_e),m(8,Je),m(9,Le),m(10,Om),m(11,nt),m(12,ht),m(13,ce),m(14,An)],iDe);function Zro(a,i,e){let t,o,n,r,s;if(i){for(r=i.offset,s=r+i.length,n=r;n>0&&!WYe(a,n-1);)n--;let w=s;for(;w<a.length&&!WYe(a,w);)w++;o=a.substring(n,w),t=C3o(o,e)}else o=a,t=0,n=0,r=0,s=a.length;let l=Abi(e,a),c=!1,u=0,p;e.insertSpaces?p=Pbi(" ",e.tabSize||4):p="	";let h=yde(o,!1),g=!1;function f(){return l+Pbi(p,t+u)}function v(){let w=h.scan();for(c=!1;w===15||w===14;)c=c||w===14,w=h.scan();return g=w===16||h.getTokenError()!==0,w}let b=[];function S(w,k,T){!g&&k<s&&T>r&&a.substring(k,T)!==w&&b.push({offset:k,length:T-k,content:w})}let y=v();if(y!==17){let w=h.getTokenOffset()+n,k=Pbi(p,t);S(k,n,w)}for(;y!==17;){let w=h.getTokenOffset()+h.getTokenLength()+n,k=v(),T="";for(;!c&&(k===12||k===13);){let O=h.getTokenOffset()+n;S(" ",w,O),w=h.getTokenOffset()+h.getTokenLength()+n,T=k===12?f():"",k=v()}if(k===2)y!==1&&(u--,T=f());else if(k===4)y!==3&&(u--,T=f());else{switch(y){case 3:case 1:u++,T=f();break;case 5:case 12:T=f();break;case 13:c?T=f():T=" ";break;case 6:T=" ";break;case 10:if(k===6){T="";break}case 7:case 8:case 9:case 11:case 2:case 4:k===12||k===13?T=" ":k!==5&&k!==17&&(g=!0);break;case 16:g=!0;break}c&&(k===12||k===13)&&(T=f())}let P=h.getTokenOffset()+n;S(T,w,P),y=k}return b}function s0(a,i){let e=JSON.stringify(a,void 0,i.insertSpaces?i.tabSize||4:"	");return i.eol!==void 0?e.replace(/\r\n|\r|\n/g,i.eol):e}function Pbi(a,i){let e="";for(let t=0;t<i;t++)e+=a;return e}function C3o(a,i){let e=0,t=0,o=i.tabSize||4;for(;e<a.length;){let n=a.charAt(e);if(n===" ")t++;else if(n==="	")t+=o;else break;e++}return Math.floor(t/o)}function Abi(a,i){for(let e=0;e<i.length;e++){let t=i.charAt(e);if(t==="\r")return e+1<i.length&&i.charAt(e+1)===`
`?`\r
`:"\r";if(t===`
`)return`
`}return a&&a.eol||`
`}function WYe(a,i){return`\r
`.indexOf(a.charAt(i))!==-1}function eso(a,i,e){return Mb(a,i,void 0,e)}function Mb(a,i,e,t,o){let n=i.slice(),s=_R(a,[]),l,c;for(;n.length>0&&(c=n.pop(),l=OC(s,n),l===void 0&&e!==void 0);)typeof c=="string"?e={[c]:e}:e=[e];if(l)if(l.type==="object"&&typeof c=="string"&&Array.isArray(l.children)){let u=OC(l,[c]);if(u!==void 0)if(e===void 0){if(!u.parent)throw new Error("Malformed AST");let p=l.children.indexOf(u.parent),h,g=u.parent.offset+u.parent.length;if(p>0){let f=l.children[p-1];h=f.offset+f.length}else h=l.offset+1,l.children.length>1&&(g=l.children[1].offset);return hZ(a,{offset:h,length:g-h,content:""},t)}else return hZ(a,{offset:u.offset,length:u.length,content:JSON.stringify(e)},t);else{if(e===void 0)return[];let p=`${JSON.stringify(c)}: ${JSON.stringify(e)}`,h=o?o(l.children.map(f=>f.children[0].value)):l.children.length,g;if(h>0){let f=l.children[h-1];g={offset:f.offset+f.length,length:0,content:","+p}}else l.children.length===0?g={offset:l.offset+1,length:0,content:p}:g={offset:l.offset+1,length:0,content:p+","};return hZ(a,g,t)}}else if(l.type==="array"&&typeof c=="number"&&Array.isArray(l.children))if(e!==void 0){let u=`${JSON.stringify(e)}`,p;if(l.children.length===0||c===0)p={offset:l.offset+1,length:0,content:l.children.length===0?u:u+","};else{let h=c===-1||c>l.children.length?l.children.length:c,g=l.children[h-1];p={offset:g.offset+g.length,length:0,content:","+u}}return hZ(a,p,t)}else{let u=c,p=l.children[u],h;if(l.children.length===1)h={offset:l.offset+1,length:l.length-2,content:""};else if(l.children.length-1===u){let g=l.children[u-1],f=g.offset+g.length,v=l.offset+l.length;h={offset:f,length:v-2-f,content:""}}else h={offset:p.offset,length:l.children[u+1].offset-p.offset,content:""};return hZ(a,h,t)}else throw new Error(`Can not add ${typeof c!="number"?"index":"property"} to parent of type ${l.type}`);else return e===void 0?[]:hZ(a,{offset:s?s.offset:0,length:s?s.length:0,content:JSON.stringify(e)},t)}function hZ(a,i,e){let t=Nbi(a,i),o=i.offset,n=i.offset+i.content.length;if(i.length===0||i.content.length===0){for(;o>0&&!WYe(t,o-1);)o--;for(;n<t.length&&!WYe(t,n);)n++}let r=Zro(t,{offset:o,length:n-o},e);for(let l=r.length-1;l>=0;l--){let c=r[l];t=Nbi(t,c),o=Math.min(o,c.offset),n=Math.max(n,c.offset+c.length),n+=c.content.length-c.length}let s=a.length-(t.length-n)-o;return[{offset:o,length:s,content:t.substring(o,n)}]}function Nbi(a,i){return a.substring(0,i.offset)+i.content+a.substring(i.offset+i.length)}function rpe(a,i){let e=i.slice(0).sort((o,n)=>{let r=o.offset-n.offset;return r===0?o.length-n.length:r}),t=a.length;for(let o=e.length-1;o>=0;o--){let n=e[o];if(n.offset+n.length<=t)a=Nbi(a,n);else throw new Error("Overlapping edit");t=n.offset}return a}var jp=le("workspacesService");function EA(a){return a.hasOwnProperty("workspace")}function ZR(a){return a.hasOwnProperty("folderUri")}function Obi(a){return LAt(a)||iso(a)}function LAt(a){let i=a;return typeof i?.path=="string"&&(!i.name||typeof i.name=="string")}function iso(a){let i=a;return typeof i?.uri=="string"&&(!i.name||typeof i.name=="string")}function Fbi(a,i,e,t,o){if(a.scheme!==t.scheme)return{name:e,uri:a.toString(!0)};let n=i?void 0:o.relativePath(t,a);if(n!==void 0)n.length===0?n=".":ei&&(n=tso(n));else if(a.scheme===Q.file)n=a.fsPath,ei&&(n=tso(n));else if(o.isEqualAuthority(a.authority,t.authority))n=a.path;else return{name:e,uri:a.toString(!0)};return{name:e,path:n}}function tso(a){return a=Hp(a),O$(a)||(a=f1(a)),a}function RAt(a,i,e){let t=[],o=new Set,n=e.dirname(i);for(let r of a){let s;if(LAt(r))r.path&&(s=e.resolvePath(n,r.path));else if(iso(r))try{s=A.parse(r.uri),s.path[0]!==Oo.sep&&(s=s.with({path:Oo.sep+s.path}))}catch(l){console.warn(l)}if(s){let l=e.getComparisonKey(s);if(!o.has(l)){o.add(l);let c=r.name||e.basenameOrAuthority(s);t.push(new nce({uri:s,name:c,index:t.length},r))}}}return t}function Wbi(a,i,e,t,o){let n=k3o(i,a),r=o.dirname(i),s=o.dirname(t),l=[];for(let h of n.folders){let g=LAt(h)?o.resolvePath(r,h.path):A.parse(h.uri),f;e?f=!1:f=!LAt(h)||Zl(h.path),l.push(Fbi(g,f,h.name,s,o))}let c={insertSpaces:!1,tabSize:4,eol:fn||Ze?`
`:`\r
`},u=Mb(a,["folders"],l,c),p=rpe(a,u);return gV(n.remoteAuthority,b5(t))&&(p=rpe(p,eso(p,["remoteAuthority"],c))),p}function k3o(a,i){let e=jr(i);if(e&&Array.isArray(e.folders))e.folders=e.folders.filter(t=>Obi(t));else throw new Error(`${a} looks like an invalid workspace file.`);return e}var MAt=class extends x{constructor(e){super();this.channelName=e;this._onDidReceiveData=this._register(new E);this.onDidReceiveData=this._onDidReceiveData.event;if("BroadcastChannel"in ut)try{this.broadcastChannel=new BroadcastChannel(e);let t=o=>{this._onDidReceiveData.fire(o.data)};this.broadcastChannel.addEventListener("message",t),this._register(Z(()=>{this.broadcastChannel&&(this.broadcastChannel.removeEventListener("message",t),this.broadcastChannel.close())}))}catch(t){console.warn("Error while creating broadcast channel. Falling back to localStorage.",Pn(t))}this.broadcastChannel||(this.channelName=`BroadcastDataChannel.${e}`,this.createBroadcastChannel())}createBroadcastChannel(){let e=t=>{t.key===this.channelName&&t.newValue&&this._onDidReceiveData.fire(JSON.parse(t.newValue))};ut.addEventListener("storage",e),this._register(Z(()=>ut.removeEventListener("storage",e)))}postData(e){this.broadcastChannel?this.broadcastChannel.postMessage(e):(localStorage.removeItem(this.channelName),localStorage.setItem(this.channelName,JSON.stringify(e)))}};var ev=class{constructor(i){this.identifier=i}},gI=class{constructor(i){this.identifier=i}};async function PAt(a){let i=[],e=tr.uriList.toLowerCase();if(a.has(e))try{let t=await a.get(e)?.asString(),o=JSON.stringify(aw.parse(t??""));i.push(...oii(o))}catch{}return i}var a0=class{constructor(i,e,t,o,n,r,s,l){this.options=i;this.fileService=e;this.workspacesService=t;this.editorService=o;this.workspaceEditingService=n;this.hostService=r;this.contextService=s;this.instantiationService=l}async handleDrop(i,e,t,o,n){let r=await this.instantiationService.invokeFunction(u=>pwe(u,i));if(!r.length)return;await this.hostService.focus(e);let s=ne.as(OV.DragAndDropContribution);for(let{resource:u}of r)if(u&&await this.instantiationService.invokeFunction(h=>s.handleResourceDrop(u,h)))return;if(this.options.allowWorkspaceOpen){let u=di(r.filter(p=>p.allowWorkspaceOpen&&p.resource?.scheme===Q.file).map(p=>p.resource));if(u.length>0&&await this.handleWorkspaceDrop(u))return}let l=di(r.filter(u=>u.isExternal&&u.resource?.scheme===Q.file).map(u=>u.resource));l.length&&this.workspacesService.addRecentlyOpened(l.map(u=>({fileUri:u})));let c=t?.();await this.editorService.openEditors(r.map(u=>({...u,resource:u.resource,options:{...u.options,...n,pinned:!0}})),c,{validateTrust:!0}),o?.(c)}async handleWorkspaceDrop(i){let e=[],t=[];return await Promise.all(i.map(async o=>{if(GO(o)){e.push({workspaceUri:o});return}try{let n=await this.fileService.stat(o);n.isDirectory&&(e.push({folderUri:n.resource}),t.push({uri:n.resource}))}catch{}})),e.length===0?!1:(e.length>t.length||t.length===1?await this.hostService.openWindow(e):gw(this.contextService.getWorkspace())?await this.workspaceEditingService.addFolders(t):await this.workspaceEditingService.createAndEnterWorkspace(t),!0)}};a0=I([m(1,fe),m(2,jp),m(3,ee),m(4,Db),m(5,Zt),m(6,Pe),m(7,F)],a0);function tv(a,i,e,t){if(i.length===0||!e.dataTransfer)return;let o=a.get(Uo),n=a.get(ee),r=a.get(fe),s=a.get(rt),l=di(i.map(f=>A.isUri(f)?{resource:f}:v6e(f)?A.isUri(f.editor.resource)?{resource:f.editor.resource}:void 0:{resource:f.selection?ZL(f.resource,f.selection):f.resource,isDirectory:f.isDirectory,selection:f.selection})),c=l.filter(({resource:f})=>r.hasProvider(f));if(!t?.disableStandardTransfer){let f=ei?`\r
`:`
`;e.dataTransfer.setData(yl.TEXT,c.map(({resource:b})=>s.getUriLabel(b,{noPrefix:!0})).join(f));let v=c.find(({isDirectory:b})=>!b);if(v){let b=vn.uriToFileUri(v.resource);b.scheme===Q.file&&e.dataTransfer.setData(yl.DOWNLOAD_URL,[tr.binary,He(v.resource),b.toString()].join(":"))}}let u=c.filter(({isDirectory:f})=>!f);u.length&&e.dataTransfer.setData(yl.RESOURCES,JSON.stringify(u.map(({resource:f})=>f.toString())));let p=ne.as(OV.DragAndDropContribution).getAll();for(let f of p)f.setData(l,e);let h=[];for(let f of i){let v;if(v6e(f)){let b=f.editor.toUntyped({preserveViewState:f.groupId});b&&(v={...b,resource:po.getCanonicalUri(b)})}else if(A.isUri(f)){let{selection:b,uri:S}=uwe(f);v={resource:S,options:b?{selection:b}:void 0}}else f.isDirectory||(v={resource:f.resource,options:{selection:f.selection}});if(v){{let b=v.resource;if(b){let S=o.files.get(b);S&&(typeof v.languageId!="string"&&(v.languageId=S.getLanguageId()),typeof v.encoding!="string"&&(v.encoding=S.getEncoding()),typeof v.contents!="string"&&S.isDirty()&&!S.textEditorModel.isTooLargeForHeapOperation()&&(v.contents=S.textEditorModel.getValue())),v.options?.viewState||(v.options={...v.options,viewState:(()=>{for(let y of n.visibleEditorPanes)if(Qe(y.input.resource,b)){let w=y.getViewState();if(w)return w}})()})}}h.push(v)}}h.length&&e.dataTransfer.setData(hc.EDITORS,swe(h));let g=c.filter(({isDirectory:f})=>f).map(({resource:f})=>f);if(h.length||g.length){let f=[...g];for(let v of h)v.resource?f.push(v.options?.selection?ZL(v.resource,v.options.selection):v.resource):Ib(v)?v.modified.resource&&f.push(v.modified.resource):Z_(v)?v.primary.resource&&f.push(v.primary.resource):WC(v)&&f.push(v.result.resource);t?.disableStandardTransfer||e.dataTransfer.setData(tr.uriList,aw.create(f.slice(0,1))),e.dataTransfer.setData(yl.INTERNAL_URI_LIST,aw.create(f))}}var Vbi=class{constructor(i,e){this.type=i;this.id=e}update(i){}getData(){return{type:this.type,id:this.id}}},spe=class{constructor(i){this.compositeId=i}get id(){return this.compositeId}},ape=class{constructor(i){this.viewId=i}get id(){return this.viewId}},ST=class a extends x{constructor(){super();this.transferData=JI.getInstance();this.onDragStart=this._register(new E);this.onDragEnd=this._register(new E);this._register(this.onDragEnd.event(e=>{let t=e.dragAndDropData.getData().id,o=e.dragAndDropData.getData().type;this.readDragData(o)?.getData().id===t&&this.transferData.clearData(o==="view"?ape.prototype:spe.prototype)}))}static get INSTANCE(){return a.instance||(a.instance=new a,im(a.instance)),a.instance}readDragData(e){if(this.transferData.hasData(e==="view"?ape.prototype:spe.prototype)){let t=this.transferData.getData(e==="view"?ape.prototype:spe.prototype);if(t?.[0])return new Vbi(e,t[0].id)}}writeDragData(e,t){this.transferData.setData([t==="view"?new ape(e):new spe(e)],t==="view"?ape.prototype:spe.prototype)}registerTarget(e,t){let o=new N;return o.add(new Uh(e,{onDragEnter:n=>{if(n.preventDefault(),t.onDragEnter){let r=this.readDragData("composite")||this.readDragData("view");r&&t.onDragEnter({eventData:n,dragAndDropData:r})}},onDragLeave:n=>{let r=this.readDragData("composite")||this.readDragData("view");t.onDragLeave&&r&&t.onDragLeave({eventData:n,dragAndDropData:r})},onDrop:n=>{if(t.onDrop){let r=this.readDragData("composite")||this.readDragData("view");if(!r)return;t.onDrop({eventData:n,dragAndDropData:r}),this.onDragEnd.fire({eventData:n,dragAndDropData:r})}},onDragOver:n=>{if(n.preventDefault(),t.onDragOver){let r=this.readDragData("composite")||this.readDragData("view");if(!r)return;t.onDragOver({eventData:n,dragAndDropData:r})}}})),t.onDragStart&&this.onDragStart.event(n=>{t.onDragStart(n)},this,o),t.onDragEnd&&this.onDragEnd.event(n=>{t.onDragEnd(n)},this,o),this._register(o)}registerDraggable(e,t,o){e.draggable=!0;let n=new N;return n.add(new Uh(e,{onDragStart:r=>{let{id:s,type:l}=t();this.writeDragData(s,l),r.dataTransfer?.setDragImage(e,0,0),this.onDragStart.fire({eventData:r,dragAndDropData:this.readDragData(l)})},onDragEnd:r=>{let{type:s}=t(),l=this.readDragData(s);l&&this.onDragEnd.fire({eventData:r,dragAndDropData:l})},onDragEnter:r=>{if(o.onDragEnter){let s=this.readDragData("composite")||this.readDragData("view");if(!s)return;s&&o.onDragEnter({eventData:r,dragAndDropData:s})}},onDragLeave:r=>{let s=this.readDragData("composite")||this.readDragData("view");s&&o.onDragLeave?.({eventData:r,dragAndDropData:s})},onDrop:r=>{if(o.onDrop){let s=this.readDragData("composite")||this.readDragData("view");if(!s)return;o.onDrop({eventData:r,dragAndDropData:s}),this.onDragEnd.fire({eventData:r,dragAndDropData:s})}},onDragOver:r=>{if(o.onDragOver){let s=this.readDragData("composite")||this.readDragData("view");if(!s)return;o.onDragOver({eventData:r,dragAndDropData:s})}}})),o.onDragStart&&this.onDragStart.event(r=>{o.onDragStart(r)},this,n),o.onDragEnd&&this.onDragEnd.event(r=>{o.onDragEnd(r)},this,n),this._register(n)}};function X4(a,i,e){a&&(a.dropEffect=e?i:"none")}var Y4=class{constructor(i,e){this.toResource=i;this.instantiationService=e}getDragURI(i){let e=this.toResource(i);return e?e.toString():null}getDragLabel(i){let e=di(i.map(this.toResource));return e.length===1?He(e[0]):e.length>1?String(e.length):void 0}onDragStart(i,e){let t=[],o=i.elements;for(let n of o){let r=this.toResource(n);r&&t.push(r)}this.onWillDragElements(o,e),t.length&&this.instantiationService.invokeFunction(n=>tv(n,t,e))}onWillDragElements(i,e){}onDragOver(i,e,t,o,n){return!1}drop(i,e,t,o,n){}dispose(){}};Y4=I([m(1,F)],Y4);var Bbi=class a extends x{constructor(){super();this.broadcaster=this._register(new MAt(a.CHANNEL_NAME));this.draggedOver=!1;this.registerListeners()}static{this.CHANNEL_NAME="monaco-workbench-global-dragged-over"}registerListeners(){this._register(U.runAndSubscribe(nf,({window:e,disposables:t})=>{t.add(j(e,re.DRAG_OVER,()=>this.markDraggedOver(!1),!0)),t.add(j(e,re.DRAG_LEAVE,()=>this.clearDraggedOver(!1),!0))},{window:ut,disposables:this._store})),this._register(this.broadcaster.onDidReceiveData(e=>{e===!0?this.markDraggedOver(!0):this.clearDraggedOver(!0)}))}get isDraggedOver(){return this.draggedOver}markDraggedOver(e){this.draggedOver!==!0&&(this.draggedOver=!0,e||this.broadcaster.postData(!0))}clearDraggedOver(e){this.draggedOver!==!1&&(this.draggedOver=!1,e||this.broadcaster.postData(!1))}},E3o=new Bbi;function AAt(){return E3o.isDraggedOver}var J4=new D("Views");ve.appendMenuItem(D.ViewContainerTitle,{submenu:J4,title:d(4550,null),order:1});var oDe=class a extends yu{constructor(e,t,o,n,r){super(r);this.paneElement=e;this.orientation=t;this.bounds=o;this.location=n;this.cleanupOverlayScheduler=this._register(new Dt(()=>this.dispose(),300)),this.create()}static{this.OVERLAY_ID="monaco-pane-drop-overlay"}get currentDropOperation(){return this._currentDropOperation}get disposed(){return!!this._disposed}create(){this.container=_("div",{id:a.OVERLAY_ID}),this.container.style.top="0px",this.paneElement.appendChild(this.container),this.paneElement.classList.add("dragged-over"),this._register(Z(()=>{this.container.remove(),this.paneElement.classList.remove("dragged-over")})),this.overlay=_(".pane-overlay-indicator"),this.container.appendChild(this.overlay),this.registerListeners(),this.updateStyles()}updateStyles(){this.overlay.style.backgroundColor=this.getColor(this.location===1?d6e:j5)||"";let e=this.getColor(Ys);this.overlay.style.outlineColor=e||"",this.overlay.style.outlineOffset=e?"-2px":"",this.overlay.style.outlineStyle=e?"dashed":"",this.overlay.style.outlineWidth=e?"2px":"",this.overlay.style.borderColor=e||"",this.overlay.style.borderStyle="solid",this.overlay.style.borderWidth="0px"}registerListeners(){this._register(new Uh(this.container,{onDragOver:e=>{this.positionOverlay(e.offsetX,e.offsetY),this.cleanupOverlayScheduler.isScheduled()&&this.cleanupOverlayScheduler.cancel()},onDragLeave:e=>this.dispose(),onDragEnd:e=>this.dispose(),onDrop:e=>{this.dispose()}})),this._register(j(this.container,re.MOUSE_OVER,()=>{this.cleanupOverlayScheduler.isScheduled()||this.cleanupOverlayScheduler.schedule()}))}positionOverlay(e,t){let o=this.paneElement.clientWidth,n=this.paneElement.clientHeight,r=o/2,s=n/2,l;switch(this.orientation===0?t<s?l=0:t>=s&&(l=1):this.orientation===1&&(e<r?l=2:e>=r&&(l=3)),l){case 0:this.doPositionOverlay({top:"0",left:"0",width:"100%",height:"50%"});break;case 1:this.doPositionOverlay({bottom:"0",left:"0",width:"100%",height:"50%"});break;case 2:this.doPositionOverlay({top:"0",left:"0",width:"50%",height:"100%"});break;case 3:this.doPositionOverlay({top:"0",right:"0",width:"50%",height:"100%"});break;default:{let c="0",u="0",p="100%",h="100%";if(this.bounds){let g=this.container.getBoundingClientRect();c=`${this.bounds.top-g.top}px`,u=`${this.bounds.left-g.left}px`,h=`${this.bounds.bottom-this.bounds.top}px`,p=`${this.bounds.right-this.bounds.left}px`}this.doPositionOverlay({top:c,left:u,width:p,height:h})}}this.orientation===0&&n<=25||this.orientation===1&&o<=25?this.doUpdateOverlayBorder(l):this.doUpdateOverlayBorder(void 0),this.overlay.style.opacity="1",setTimeout(()=>this.overlay.classList.add("overlay-move-transition"),0),this._currentDropOperation=l}doUpdateOverlayBorder(e){this.overlay.style.borderTopWidth=e===0?"2px":"0px",this.overlay.style.borderLeftWidth=e===2?"2px":"0px",this.overlay.style.borderBottomWidth=e===1?"2px":"0px",this.overlay.style.borderRightWidth=e===3?"2px":"0px"}doPositionOverlay(e){this.container.style.height="100%",this.overlay.style.top=e.top||"",this.overlay.style.left=e.left||"",this.overlay.style.bottom=e.bottom||"",this.overlay.style.right=e.right||"",this.overlay.style.width=e.width,this.overlay.style.height=e.height}contains(e){return e===this.container||e===this.overlay}dispose(){super.dispose(),this._disposed=!0}},Dc=class extends I4{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super(e,u,p);this.options=t;this.instantiationService=o;this.configurationService=n;this.layoutService=r;this.contextMenuService=s;this.telemetryService=l;this.extensionService=c;this.storageService=p;this.contextService=h;this.viewDescriptorService=g;this.logService=f;this.paneItems=[];this.visible=!1;this.areExtensionsReady=!1;this.didLayout=!1;this._onTitleAreaUpdate=this._register(new E);this.onTitleAreaUpdate=this._onTitleAreaUpdate.event;this._onDidChangeVisibility=this._register(new E);this.onDidChangeVisibility=this._onDidChangeVisibility.event;this._onDidAddViews=this._register(new E);this.onDidAddViews=this._onDidAddViews.event;this._onDidRemoveViews=this._register(new E);this.onDidRemoveViews=this._onDidRemoveViews.event;this._onDidChangeViewVisibility=this._register(new E);this.onDidChangeViewVisibility=this._onDidChangeViewVisibility.event;this._onDidFocusView=this._register(new E);this.onDidFocusView=this._onDidFocusView.event;this._onDidBlurView=this._register(new E);this.onDidBlurView=this._onDidBlurView.event;let v=this.viewDescriptorService.getViewContainerById(e);if(!v)throw new Error("Could not find container");this.viewContainer=v,this.visibleViewsStorageId=`${e}.numberOfVisibleViews`,this.visibleViewsCountFromCache=this.storageService.getNumber(this.visibleViewsStorageId,1,void 0),this.viewContainerModel=this.viewDescriptorService.getViewContainerModel(v)}get onDidSashChange(){return Ci(this.paneview).onDidSashChange}get panes(){return this.paneItems.map(e=>e.pane)}get views(){return this.panes}get length(){return this.paneItems.length}get menuActions(){return this._menuActions}create(e){let t=this.options;t.orientation=this.orientation,this.paneview=this._register(new aAt(e,this.options)),this._boundarySashes&&this.paneview.setBoundarySashes(this._boundarySashes),this._register(this.paneview.onDidDrop(({from:c,to:u})=>this.movePane(c,u))),this._register(this.paneview.onDidScroll(c=>this.onDidScrollPane())),this._register(this.paneview.onDidSashReset(c=>this.onDidSashReset(c))),this._register(j(e,re.CONTEXT_MENU,c=>this.showContextMenu(new Cn(Re(e),c)))),this._register(Ms.addTarget(e)),this._register(j(e,Kn.Contextmenu,c=>this.showContextMenu(new Cn(Re(e),c)))),this._menuActions=this._register(this.instantiationService.createInstance(U_e,this.paneview.element,this.viewContainer)),this._register(this._menuActions.onDidChange(()=>this.updateTitleArea()));let o,n=()=>{let c=e.getBoundingClientRect(),u=this.panes[this.panes.length-1].element.getBoundingClientRect(),p=this.orientation===0?u.bottom:c.top,h=this.orientation===1?u.right:c.left;return{top:p,bottom:c.bottom,left:h,right:c.right}},r=(c,u)=>u.x>=c.left&&u.x<=c.right&&u.y>=c.top&&u.y<=c.bottom,s;this.viewDescriptorService.canMoveViews()&&this._register(ST.INSTANCE.registerTarget(e,{onDragEnter:c=>{if(s=n(),o?.disposed&&(o=void 0),!o&&r(s,c.eventData)){let u=c.dragAndDropData.getData();if(u.type==="view"){let p=this.viewDescriptorService.getViewContainerByViewId(u.id),h=this.viewDescriptorService.getViewDescriptorById(u.id);if(p!==this.viewContainer&&(!h||!h.canMoveView||this.viewContainer.rejectAddedViews))return;o=new oDe(e,void 0,s,this.viewDescriptorService.getViewContainerLocation(this.viewContainer),this.themeService)}if(u.type==="composite"&&u.id!==this.viewContainer.id){let p=this.viewDescriptorService.getViewContainerById(u.id),h=this.viewDescriptorService.getViewContainerModel(p).allViewDescriptors;!h.some(g=>!g.canMoveView)&&h.length>0&&(o=new oDe(e,void 0,s,this.viewDescriptorService.getViewContainerLocation(this.viewContainer),this.themeService))}}},onDragOver:c=>{o?.disposed&&(o=void 0),o&&!r(s,c.eventData)&&(o.dispose(),o=void 0),r(s,c.eventData)&&X4(c.eventData.dataTransfer,"move",o!==void 0)},onDragLeave:c=>{o?.dispose(),o=void 0},onDrop:c=>{if(o){let u=c.dragAndDropData.getData(),p=[];if(u.type==="composite"&&u.id!==this.viewContainer.id){let g=this.viewDescriptorService.getViewContainerById(u.id),f=this.viewDescriptorService.getViewContainerModel(g).allViewDescriptors;f.some(v=>!v.canMoveView)||p.push(...f)}else if(u.type==="view"){let g=this.viewDescriptorService.getViewContainerByViewId(u.id),f=this.viewDescriptorService.getViewDescriptorById(u.id);g!==this.viewContainer&&f?.canMoveView&&this.viewDescriptorService.moveViewsToContainer([f],this.viewContainer,void 0,"dnd")}let h=this.panes.length;if(p.length>0&&this.viewDescriptorService.moveViewsToContainer(p,this.viewContainer,void 0,"dnd"),h>0)for(let g of p){let f=this.panes.find(v=>v.id===g.id);f&&this.movePane(f,this.panes[this.panes.length-1])}}o?.dispose(),o=void 0}})),this._register(this.onDidSashChange(()=>this.saveViewSizes())),this._register(this.viewContainerModel.onDidAddVisibleViewDescriptors(c=>this.onDidAddViewDescriptors(c))),this._register(this.viewContainerModel.onDidRemoveVisibleViewDescriptors(c=>this.onDidRemoveViewDescriptors(c)));let l=this.viewContainerModel.visibleViewDescriptors.map((c,u)=>{let p=this.viewContainerModel.getSize(c.id),h=this.viewContainerModel.isCollapsed(c.id);return{viewDescriptor:c,index:u,size:p,collapsed:h}});l.length&&this.onDidAddViewDescriptors(l),this.extensionService.whenInstalledExtensionsRegistered().then(()=>{this.areExtensionsReady=!0,this.panes.length&&(this.updateTitleArea(),this.updateViewHeaders()),this._register(this.configurationService.onDidChangeConfiguration(c=>{c.affectsConfiguration("workbench.activityBar.location")&&this.updateViewHeaders()}))}),this._register(this.viewContainerModel.onDidChangeActiveViewDescriptors(()=>this._onTitleAreaUpdate.fire()))}getTitle(){let e=this.viewContainerModel.title;if(this.isViewMergedWithContainer()){let t=this.paneItems[0].pane.singleViewPaneContainerTitle;if(t)return t;let o=this.paneItems[0].pane.title;return e===o?o:o?`${e}: ${o}`:e}return e}showContextMenu(e){for(let t of this.paneItems)if(ts(e.target,t.pane.element))return;e.stopPropagation(),e.preventDefault(),this.contextMenuService.showContextMenu({getAnchor:()=>e,getActions:()=>this.menuActions?.getContextMenuActions()??[]})}getActionsContext(){if(this.isViewMergedWithContainer())return this.panes[0].getActionsContext()}getActionViewItem(e,t){return this.isViewMergedWithContainer()?this.paneItems[0].pane.createActionViewItem(e,t):Bs(this.instantiationService,e,t)}focus(){let e;if(this.lastFocusedPane)e=this.lastFocusedPane;else if(this.paneItems.length>0){for(let{pane:t}of this.paneItems)if(t.isExpanded()){e=t;break}}e&&e.focus()}get orientation(){switch(this.viewDescriptorService.getViewContainerLocation(this.viewContainer)){case 0:case 2:return 0;case 1:return xh(this.layoutService.getPanelPosition())?1:0}return 0}layout(e){this.paneview&&(this.paneview.orientation!==this.orientation&&this.paneview.flipOrientation(e.height,e.width),this.paneview.layout(e.height,e.width)),this.dimension=e,this.didLayout?this.saveViewSizes():(this.didLayout=!0,this.restoreViewSizes())}setBoundarySashes(e){this._boundarySashes=e,this.paneview?.setBoundarySashes(e)}getOptimalWidth(){return Math.max(...this.panes.map(o=>o.getOptimalWidth()||0))+16}addPanes(e){let t=this.isViewMergedWithContainer();for(let{pane:o,size:n,index:r,disposable:s}of e)this.addPane(o,n,s,r);this.updateViewHeaders(),this.isViewMergedWithContainer()!==t&&this.updateTitleArea(),this._onDidAddViews.fire(e.map(({pane:o})=>o))}setVisible(e){this.visible!==!!e&&(this.visible=e,this._onDidChangeVisibility.fire(e)),this.panes.filter(t=>t.isVisible()!==e).map(t=>t.setVisible(e))}isVisible(){return this.visible}updateTitleArea(){this._onTitleAreaUpdate.fire()}createView(e,t){return this.instantiationService.createInstance(e.ctorDescriptor.ctor,...e.ctorDescriptor.staticArguments||[],t)}getView(e){return this.panes.filter(t=>t.id===e)[0]}saveViewSizes(){this.didLayout&&this.viewContainerModel.setSizes(this.panes.map(e=>({id:e.id,size:this.getPaneSize(e)})))}restoreViewSizes(){if(this.didLayout){let e;for(let t=0;t<this.viewContainerModel.visibleViewDescriptors.length;t++){let o=this.panes[t],n=this.viewContainerModel.visibleViewDescriptors[t],r=this.viewContainerModel.getSize(n.id);typeof r=="number"?this.resizePane(o,r):(e=e||this.computeInitialSizes(),this.resizePane(o,e.get(o.id)||200))}}}computeInitialSizes(){let e=new Map;if(this.dimension){let t=this.viewContainerModel.visibleViewDescriptors.reduce((o,{weight:n})=>o+(n||20),0);for(let o of this.viewContainerModel.visibleViewDescriptors)this.orientation===0?e.set(o.id,this.dimension.height*(o.weight||20)/t):e.set(o.id,this.dimension.width*(o.weight||20)/t)}return e}saveState(){this.panes.forEach(e=>e.saveState()),this.storageService.store(this.visibleViewsStorageId,this.length,1,1)}onContextMenu(e,t){e.stopPropagation(),e.preventDefault();let o=t.menuActions.getContextMenuActions();this.contextMenuService.showContextMenu({getAnchor:()=>e,getActions:()=>o})}openView(e,t){let o=this.getView(e);return o||this.toggleViewVisibility(e),o=this.getView(e),o&&(o.setExpanded(!0),t&&o.focus()),o}onDidAddViewDescriptors(e){let t=[];for(let{viewDescriptor:n,collapsed:r,index:s,size:l}of e){let c=this.createView(n,{id:n.id,title:n.name.value,fromExtensionId:n.extensionId,expanded:!r,singleViewPaneContainerTitle:n.singleViewPaneContainerTitle});try{c.render()}catch(u){this.logService.error(`Fail to render view ${n.id}`,u);continue}if(c.draggableElement){let u=j(c.draggableElement,"contextmenu",h=>{h.stopPropagation(),h.preventDefault(),this.onContextMenu(new Cn(Re(c.draggableElement),h),c)}),p=U.latch(U.map(c.onDidChange,()=>!c.isExpanded()))(h=>{this.viewContainerModel.setCollapsed(n.id,h)});t.push({pane:c,size:l||c.minimumSize,index:s,disposable:wn(u,p)})}}this.addPanes(t),this.restoreViewSizes();let o=[];for(let{pane:n}of t)n.setVisible(this.isVisible()),o.push(n);return o}onDidRemoveViewDescriptors(e){e=e.sort((o,n)=>n.index-o.index);let t=[];for(let{index:o}of e)this.paneItems[o]&&t.push(this.paneItems[o].pane);if(t.length){this.removePanes(t);for(let o of t)o.setVisible(!1)}}toggleViewVisibility(e){if(this.viewContainerModel.activeViewDescriptors.some(t=>t.id===e)){let t=!this.viewContainerModel.isVisible(e);this.viewContainerModel.setVisible(e,t)}}addPane(e,t,o,n=this.paneItems.length-1){let r=e.onDidFocus(()=>{this._onDidFocusView.fire(e),this.lastFocusedPane=e}),s=e.onDidBlur(()=>this._onDidBlurView.fire(e)),l=e.onDidChangeTitleArea(()=>{this.isViewMergedWithContainer()&&this.updateTitleArea()}),c=e.onDidChangeBodyVisibility(()=>this._onDidChangeViewVisibility.fire(e)),u=e.onDidChange(()=>{e===this.lastFocusedPane&&!e.isExpanded()&&(this.lastFocusedPane=void 0)}),p=this.viewDescriptorService.getViewContainerLocation(this.viewContainer)===1;e.style({headerForeground:kt(p?TZi:FZi),headerBackground:kt(p?EZi:OZi),headerBorder:kt(p?_Zi:zmi),dropBackground:kt(p?d6e:j5),leftBorder:p?kt(dDt):void 0});let h=new N;h.add(o),h.add(wn(e,r,s,l,u,c));let g={pane:e,disposable:h};this.paneItems.splice(n,0,g),Ci(this.paneview).addPane(e,t,n);let f;this.viewDescriptorService.canMoveViews()&&(e.draggableElement&&h.add(ST.INSTANCE.registerDraggable(e.draggableElement,()=>({type:"view",id:e.id}),{})),h.add(ST.INSTANCE.registerTarget(e.dropTargetElement,{onDragEnter:v=>{if(!f){let b=v.dragAndDropData.getData();if(b.type==="view"&&b.id!==e.id){let S=this.viewDescriptorService.getViewContainerByViewId(b.id),y=this.viewDescriptorService.getViewDescriptorById(b.id);if(S!==this.viewContainer&&(!y||!y.canMoveView||this.viewContainer.rejectAddedViews))return;f=new oDe(e.dropTargetElement,this.orientation??0,void 0,this.viewDescriptorService.getViewContainerLocation(this.viewContainer),this.themeService)}if(b.type==="composite"&&b.id!==this.viewContainer.id&&!this.viewContainer.rejectAddedViews){let S=this.viewDescriptorService.getViewContainerById(b.id),y=this.viewDescriptorService.getViewContainerModel(S).allViewDescriptors;!y.some(w=>!w.canMoveView)&&y.length>0&&(f=new oDe(e.dropTargetElement,this.orientation??0,void 0,this.viewDescriptorService.getViewContainerLocation(this.viewContainer),this.themeService))}}},onDragOver:v=>{X4(v.eventData.dataTransfer,"move",f!==void 0)},onDragLeave:v=>{f?.dispose(),f=void 0},onDrop:v=>{if(f){let b=v.dragAndDropData.getData(),S=[],y;if(b.type==="composite"&&b.id!==this.viewContainer.id&&!this.viewContainer.rejectAddedViews){let w=this.viewDescriptorService.getViewContainerById(b.id),k=this.viewDescriptorService.getViewContainerModel(w).allViewDescriptors;k.length>0&&!k.some(T=>!T.canMoveView)&&(S.push(...k),y=k[0])}else if(b.type==="view"){let w=this.viewDescriptorService.getViewContainerByViewId(b.id),k=this.viewDescriptorService.getViewDescriptorById(b.id);w!==this.viewContainer&&k&&k.canMoveView&&!this.viewContainer.rejectAddedViews&&S.push(k),k&&(y=k)}if(S&&this.viewDescriptorService.moveViewsToContainer(S,this.viewContainer,void 0,"dnd"),y){if(f.currentDropOperation===1||f.currentDropOperation===3){let w=this.panes.findIndex(T=>T.id===y.id),k=this.panes.findIndex(T=>T.id===e.id);w>=0&&k>=0&&(w>k&&k++,k<this.panes.length&&k!==w&&this.movePane(this.panes[w],this.panes[k]))}if(f.currentDropOperation===0||f.currentDropOperation===2){let w=this.panes.findIndex(T=>T.id===y.id),k=this.panes.findIndex(T=>T.id===e.id);w>=0&&k>=0&&(w<k&&k--,k>=0&&k!==w&&this.movePane(this.panes[w],this.panes[k]))}S.length>1&&S.slice(1).forEach(w=>{let k=this.panes.findIndex(P=>P.id===y.id),T=this.panes.findIndex(P=>P.id===w.id);T>=0&&k>=0&&(T>k&&k++,k<this.panes.length&&k!==T&&(this.movePane(this.panes[T],this.panes[k]),y=w))})}}f?.dispose(),f=void 0}})))}removePanes(e){let t=this.isViewMergedWithContainer();e.forEach(o=>this.removePane(o)),this.updateViewHeaders(),t!==this.isViewMergedWithContainer()&&this.updateTitleArea(),this._onDidRemoveViews.fire(e)}removePane(e){let t=this.paneItems.findIndex(n=>n.pane===e);if(t===-1)return;this.lastFocusedPane===e&&(this.lastFocusedPane=void 0),Ci(this.paneview).removePane(e);let[o]=this.paneItems.splice(t,1);o.disposable.dispose()}movePane(e,t){let o=this.paneItems.findIndex(c=>c.pane===e),n=this.paneItems.findIndex(c=>c.pane===t),r=this.viewContainerModel.visibleViewDescriptors[o],s=this.viewContainerModel.visibleViewDescriptors[n];if(o<0||o>=this.paneItems.length||n<0||n>=this.paneItems.length)return;let[l]=this.paneItems.splice(o,1);this.paneItems.splice(n,0,l),Ci(this.paneview).movePane(e,t),this.viewContainerModel.move(r.id,s.id),this.updateTitleArea()}resizePane(e,t){Ci(this.paneview).resizePane(e,t)}getPaneSize(e){return Ci(this.paneview).getPaneSize(e)}updateViewHeaders(){this.isViewMergedWithContainer()?(this.paneItems[0].pane.isExpanded()?this.lastMergedCollapsedPane=void 0:(this.lastMergedCollapsedPane=this.paneItems[0].pane,this.paneItems[0].pane.setExpanded(!0)),this.paneItems[0].pane.headerVisible=!1,this.paneItems[0].pane.collapsible=!0):(this.paneItems.length===1?(this.paneItems[0].pane.headerVisible=!0,this.paneItems[0].pane===this.lastMergedCollapsedPane&&this.paneItems[0].pane.setExpanded(!1),this.paneItems[0].pane.collapsible=!1):this.paneItems.forEach(e=>{e.pane.headerVisible=!0,e.pane.collapsible=!0,e.pane===this.lastMergedCollapsedPane&&e.pane.setExpanded(!1)}),this.lastMergedCollapsedPane=void 0)}isViewMergedWithContainer(){return this.options.mergeViewWithContainerWhenSingleView&&this.paneItems.length===1?this.areExtensionsReady?!0:this.visibleViewsCountFromCache===void 0?this.paneItems[0].pane.isExpanded():this.visibleViewsCountFromCache===1:!1}onDidScrollPane(){for(let e of this.panes)e.onDidScrollRoot()}onDidSashReset(e){let t,o;for(let n=e;n>=0;n--)if(this.paneItems[n].pane?.isVisible()&&this.paneItems[n]?.pane.isExpanded()){t=this.paneItems[n].pane;break}for(let n=e+1;n<this.paneItems.length;n++)if(this.paneItems[n].pane?.isVisible()&&this.paneItems[n]?.pane.isExpanded()){o=this.paneItems[n].pane;break}if(t&&o){let n=this.getPaneSize(t),r=this.getPaneSize(o),s=Math.ceil((n+r)/2),l=Math.floor((n+r)/2);n>r?(this.resizePane(t,s),this.resizePane(o,l)):(this.resizePane(o,l),this.resizePane(t,s))}}dispose(){super.dispose(),this.paneItems.forEach(e=>e.disposable.dispose()),this.paneview&&this.paneview.dispose()}};Dc=I([m(2,F),m(3,B),m(4,yi),m(5,Xe),m(6,Te),m(7,lt),m(8,Le),m(9,ce),m(10,Pe),m(11,Bi),m(12,se)],Dc);var VYe=class extends K{constructor(i){super(i),this.desc=i}run(i,...e){let t=i.get($t).getActiveViewPaneContainerWithId(this.desc.viewPaneContainerId);if(t)return this.runInViewPaneContainer(i,t,...e)}},nDe=class extends K{constructor(e,t){super(e);this.offset=t}async run(e){let t=e.get(Bi),o=e.get(X),n=ql.getValue(o);if(n===void 0)return;let r=t.getViewContainerByViewId(n),s=t.getViewContainerModel(r),l=s.visibleViewDescriptors.find(p=>p.id===n),c=s.visibleViewDescriptors.indexOf(l);if(c+this.offset<0||c+this.offset>=s.visibleViewDescriptors.length)return;let u=s.visibleViewDescriptors[c+this.offset];s.move(l.id,u.id)}};W(class extends nDe{constructor(){super({id:"views.moveViewUp",title:d(4549,null),keybinding:{primary:Vi(2089,16),weight:201,when:ql.notEqualsTo("")}},-1)}});W(class extends nDe{constructor(){super({id:"views.moveViewLeft",title:d(4547,null),keybinding:{primary:Vi(2089,15),weight:201,when:ql.notEqualsTo("")}},-1)}});W(class extends nDe{constructor(){super({id:"views.moveViewDown",title:d(4546,null),keybinding:{primary:Vi(2089,18),weight:201,when:ql.notEqualsTo("")}},1)}});W(class extends nDe{constructor(){super({id:"views.moveViewRight",title:d(4548,null),keybinding:{primary:Vi(2089,17),weight:201,when:ql.notEqualsTo("")}},1)}});W(class extends K{constructor(){super({id:"vscode.moveViews",title:d(4551,null)})}async run(i,e){if(!Array.isArray(e?.viewIds)||typeof e?.destinationId!="string")return Promise.reject("Invalid arguments");let t=i.get(Bi),o=t.getViewContainerById(e.destinationId);if(o){for(let n of e.viewIds){let r=t.getViewDescriptorById(n);r?.canMoveView&&t.moveViewsToContainer([r],o,0,this.desc.id)}await i.get($t).openViewContainer(o.id,!0)}}});var Hbi=class{constructor(i,e,t,o,n,r,s,l,c,u){this.commentThreadHandle=i;this.controllerHandle=e;this.extensionId=t;this.threadId=o;this.resource=n;this._range=r;this._canReply=l;this._isTemplate=c;this.editorId=u;this._onDidChangeInput=new E;this._onDidChangeLabel=new E;this.onDidChangeLabel=this._onDidChangeLabel.event;this._onDidChangeComments=new E;this._onDidChangeCanReply=new E;this._collapsibleState=0;this._onDidChangeCollapsibleState=new E;this.onDidChangeCollapsibleState=this._onDidChangeCollapsibleState.event;this._onDidChangeInitialCollapsibleState=new E;this.onDidChangeInitialCollapsibleState=this._onDidChangeInitialCollapsibleState.event;this._onDidChangeApplicability=new E;this.onDidChangeApplicability=this._onDidChangeApplicability.event;this._onDidChangeState=new E;this.onDidChangeState=this._onDidChangeState.event;this._isDisposed=!1,c?this.comments=[]:s&&(this._comments=s)}get input(){return this._input}set input(i){this._input=i,this._onDidChangeInput.fire(i)}get onDidChangeInput(){return this._onDidChangeInput.event}get label(){return this._label}set label(i){this._label=i,this._onDidChangeLabel.fire(this._label)}get contextValue(){return this._contextValue}set contextValue(i){this._contextValue=i}get comments(){return this._comments}set comments(i){this._comments=i,this._onDidChangeComments.fire(this._comments)}get onDidChangeComments(){return this._onDidChangeComments.event}set range(i){this._range=i}get range(){return this._range}get onDidChangeCanReply(){return this._onDidChangeCanReply.event}set canReply(i){this._canReply=i,this._onDidChangeCanReply.fire(!!this._canReply)}get canReply(){return this._canReply}get collapsibleState(){return this._collapsibleState}set collapsibleState(i){this.initialCollapsibleState===void 0&&(this.initialCollapsibleState=i),i!==this._collapsibleState&&(this._collapsibleState=i,this._onDidChangeCollapsibleState.fire(this._collapsibleState))}get initialCollapsibleState(){return this._initialCollapsibleState}set initialCollapsibleState(i){this._initialCollapsibleState=i,this._onDidChangeInitialCollapsibleState.fire(i)}get isDisposed(){return this._isDisposed}isDocumentCommentThread(){return this._range===void 0||z.isIRange(this._range)}get state(){return this._state}set state(i){this._state=i,this._onDidChangeState.fire(this._state)}get applicability(){return this._applicability}set applicability(i){this._applicability=i,this._onDidChangeApplicability.fire(i)}get isTemplate(){return this._isTemplate}batchUpdate(i){let e=t=>Object.prototype.hasOwnProperty.call(i,t);e("range")&&(this._range=i.range),e("label")&&(this._label=i.label),e("contextValue")&&(this._contextValue=i.contextValue===null?void 0:i.contextValue),e("comments")&&(this.comments=i.comments),e("collapseState")&&(this.collapsibleState=i.collapseState),e("canReply")&&(this.canReply=i.canReply),e("state")&&(this.state=i.state),e("applicability")&&(this.applicability=i.applicability),e("isTemplate")&&(this._isTemplate=i.isTemplate)}hasComments(){return!!this.comments&&this.comments.length>0}dispose(){this._isDisposed=!0,this._onDidChangeCollapsibleState.dispose(),this._onDidChangeInitialCollapsibleState.dispose(),this._onDidChangeComments.dispose(),this._onDidChangeInput.dispose(),this._onDidChangeLabel.dispose(),this._onDidChangeCanReply.dispose(),this._onDidChangeState.dispose(),this._onDidChangeApplicability.dispose()}toJSON(){return{$mid:7,commentControlHandle:this.controllerHandle,commentThreadHandle:this.commentThreadHandle}}},Ubi=class{constructor(i){this.thread=i;this.disposableStore=new N}dispose(){this.disposableStore.dispose()}},zbi=class extends x{constructor(e,t,o,n,r,s,l){super();this._proxy=e;this._commentService=t;this._handle=o;this._uniqueId=n;this._id=r;this._label=s;this._features=l;this._threads=this._register(new Vt)}get handle(){return this._handle}get id(){return this._id}get contextValue(){return this._id}get proxy(){return this._proxy}get label(){return this._label}get reactions(){return this._reactions}set reactions(e){this._reactions=e}get options(){return this._features.options}get features(){return this._features}get owner(){return this._id}get activeComment(){return this._activeComment}async setActiveCommentAndThread(e){return this._activeComment=e,this._proxy.$setActiveComment(this._handle,e?{commentThreadHandle:e.thread.commentThreadHandle,uniqueIdInThread:e.comment?.uniqueIdInThread}:void 0)}updateFeatures(e){this._features=e}createCommentThread(e,t,o,n,r,s,l,c){let u=new Hbi(t,this.handle,e,o,A.revive(n).toString(),r,s,!0,l,c),p=new Ubi(u);return this._threads.set(t,p),p.disposableStore.add(u.onDidChangeCollapsibleState(()=>{this.proxy.$updateCommentThread(this.handle,u.commentThreadHandle,{collapseState:u.collapsibleState})})),u.isDocumentCommentThread()?this._commentService.updateComments(this._uniqueId,{added:[u],removed:[],changed:[],pending:[]}):this._commentService.updateNotebookComments(this._uniqueId,{added:[u],removed:[],changed:[],pending:[]}),u}updateCommentThread(e,t,o,n){let r=this.getKnownThread(e);r.batchUpdate(n),r.isDocumentCommentThread()?this._commentService.updateComments(this._uniqueId,{added:[],removed:[],changed:[r],pending:[]}):this._commentService.updateNotebookComments(this._uniqueId,{added:[],removed:[],changed:[r],pending:[]})}deleteCommentThread(e){let t=this.getKnownThread(e);this._threads.deleteAndDispose(e),t.dispose(),t.isDocumentCommentThread()?this._commentService.updateComments(this._uniqueId,{added:[],removed:[t],changed:[],pending:[]}):this._commentService.updateNotebookComments(this._uniqueId,{added:[],removed:[t],changed:[],pending:[]})}deleteCommentThreadMain(e){for(let{thread:t}of this._threads.values())t.threadId===e&&this._proxy.$deleteCommentThread(this._handle,t.commentThreadHandle)}updateInput(e){let t=this.activeEditingCommentThread;if(t&&t.input){let o=t.input;o.value=e,t.input=o}}updateCommentingRanges(e){this._commentService.updateCommentingRanges(this._uniqueId,e)}getKnownThread(e){let t=this._threads.get(e);if(!t)throw new Error("unknown thread");return t.thread}async getDocumentComments(e,t){if(e.scheme===Q.vscodeNotebookCell)return{uniqueOwner:this._uniqueId,label:this.label,threads:[],commentingRanges:{resource:e,ranges:[],fileComments:!1}};let o=[];for(let r of[...this._threads.keys()]){let s=this._threads.get(r);s.thread.resource===e.toString()&&s.thread.isDocumentCommentThread()&&o.push(s.thread)}let n=await this._proxy.$provideCommentingRanges(this.handle,e,t);return{uniqueOwner:this._uniqueId,label:this.label,threads:o,commentingRanges:{resource:e,ranges:n?.ranges||[],fileComments:!!n?.fileComments}}}async getNotebookComments(e,t){if(e.scheme!==Q.vscodeNotebookCell)return{uniqueOwner:this._uniqueId,label:this.label,threads:[]};let o=[];for(let n of[...this._threads.keys()]){let r=this._threads.get(n);r.thread.resource===e.toString()&&(r.thread.isDocumentCommentThread()||o.push(r.thread))}return{uniqueOwner:this._uniqueId,label:this.label,threads:o}}async toggleReaction(e,t,o,n,r){return this._proxy.$toggleReaction(this._handle,t.commentThreadHandle,e,o,n)}getAllComments(){let e=[];for(let t of[...this._threads.keys()])e.push(this._threads.get(t).thread);return e}createCommentThreadTemplate(e,t,o){return this._proxy.$createCommentThreadTemplate(this.handle,e,t,o)}async updateCommentThreadTemplate(e,t){await this._proxy.$updateCommentThreadTemplate(this.handle,e,t)}toJSON(){return{$mid:6,handle:this.handle}}},oso=Ae("comments-view-icon",R.commentDiscussion,d(3297,null)),NAt=class extends x{constructor(e,t,o,n,r,s){super();this._commentService=t;this._viewsService=o;this._viewDescriptorService=n;this._uriIdentityService=r;this._editorService=s;this._handlers=new Map;this._commentControllers=new Map;this._activeEditingCommentThreadDisposables=this._register(new N);this._openViewListener=this._register(new me);this._onChangeContainerListener=this._register(new me);this._onChangeContainerLocationListener=this._register(new me);this._proxy=e.getProxy(to.ExtHostComments),this._commentService.unregisterCommentController(),this._register(this._commentService.onDidChangeActiveEditingCommentThread(async l=>{let c=l.controllerHandle,u=this._commentControllers.get(c);u&&(this._activeEditingCommentThreadDisposables.clear(),this._activeEditingCommentThread=l,u.activeEditingCommentThread=this._activeEditingCommentThread)}))}$registerCommentController(e,t,o,n){let r=`${t}-${n}`;this._handlers.set(e,r);let s=new zbi(this._proxy,this._commentService,e,r,t,o,{});this._commentService.registerCommentController(r,s),this._commentControllers.set(e,s),this._register(this._commentService.onResourceHasCommentingRanges(l=>{this.registerView()})),this._register(this._commentService.onDidUpdateCommentThreads(l=>{this.registerView()})),this._commentService.setWorkspaceComments(String(e),[])}$unregisterCommentController(e){let t=this._handlers.get(e);this._handlers.delete(e),this._commentControllers.get(e)?.dispose(),this._commentControllers.delete(e),typeof t=="string"&&this._commentService.unregisterCommentController(t)}$updateCommentControllerFeatures(e,t){let o=this._commentControllers.get(e);o&&o.updateFeatures(t)}$createCommentThread(e,t,o,n,r,s,l,c,u){let p=this._commentControllers.get(e);if(p)return p.createCommentThread(l.value,t,o,n,r,s,c,u)}$updateCommentThread(e,t,o,n,r){let s=this._commentControllers.get(e);if(s)return s.updateCommentThread(t,o,n,r)}$deleteCommentThread(e,t){let o=this._commentControllers.get(e);if(o)return o.deleteCommentThread(t)}$updateCommentingRanges(e,t){let o=this._commentControllers.get(e);o&&o.updateCommentingRanges(t)}async $revealCommentThread(e,t,o,n){let r=this._commentControllers.get(e);if(!r)return Promise.resolve();let s=r.getAllComments().find(c=>c.commentThreadHandle===t);if(!s||!s.isDocumentCommentThread())return Promise.resolve();let l=s.comments?.find(c=>c.uniqueIdInThread===o);pZ(this._commentService,this._editorService,this._uriIdentityService,s,l,n.focusReply,void 0,n.preserveFocus)}async $hideCommentThread(e,t){let o=this._commentControllers.get(e);if(!o)return Promise.resolve();let n=o.getAllComments().find(r=>r.commentThreadHandle===t);if(!n||!n.isDocumentCommentThread())return Promise.resolve();n.collapsibleState=0}registerView(){let e=!!this._viewDescriptorService.getViewDescriptorById(zu);if(!e){let t=ne.as(Mn.ViewContainersRegistry).registerViewContainer({id:zu,title:SYe,ctorDescriptor:new Ft(Dc,[zu,{mergeViewWithContainerWhenSingleView:!0}]),storageId:Sro,hideIfEmpty:!0,icon:oso,order:10},1);ne.as(Mn.ViewsRegistry).registerViews([{id:zu,name:SYe,canToggleVisibility:!1,ctorDescriptor:new Ft(iDe),canMoveView:!0,containerIcon:oso,focusCommand:{id:"workbench.action.focusCommentsPanel"}}],t)}this.registerViewListeners(e)}setComments(){[...this._commentControllers.keys()].forEach(e=>{let t=this._commentControllers.get(e).getAllComments();if(t.length){let o=this.getHandler(e);this._commentService.setWorkspaceComments(o,t)}})}registerViewOpenedListener(){this._openViewListener.value||(this._openViewListener.value=this._viewsService.onDidChangeViewVisibility(e=>{e.id===zu&&e.visible&&(this.setComments(),this._openViewListener&&this._openViewListener.dispose())}))}registerViewListeners(e){e||this.registerViewOpenedListener(),this._onChangeContainerListener.value||(this._onChangeContainerListener.value=this._viewDescriptorService.onDidChangeContainer(t=>{t.views.find(o=>o.id===zu)&&(this.setComments(),this.registerViewOpenedListener())})),this._onChangeContainerLocationListener.value||(this._onChangeContainerLocationListener.value=this._viewDescriptorService.onDidChangeContainerLocation(t=>{let o=this._viewDescriptorService.getViewContainerByViewId(zu);t.viewContainer.id===o?.id&&(this.setComments(),this.registerViewOpenedListener())}))}getHandler(e){if(!this._handlers.has(e))throw new Error("Unknown handler");return this._handlers.get(e)}};NAt=I([fo(qi.MainThreadComments),m(1,Om),m(2,$t),m(3,Bi),m(4,ht),m(5,ee)],NAt);var gZ=le("notebookCellStatusBarService");var OAt=class{constructor(i,e,t,o){this._notebookService=e;this._cellStatusBarService=t;this._logService=o;this._disposables=new N;this._notebookSerializer=new Map;this._notebookCellStatusBarRegistrations=new Map;this._proxy=i.getProxy(to.ExtHostNotebook)}dispose(){this._disposables.dispose(),Be(this._notebookSerializer.values())}$registerNotebookSerializer(i,e,t,o,n){let r=new N;r.add(this._notebookService.registerNotebookSerializer(t,e,{options:o,dataToNotebook:async s=>{let l=new Dn,c;if(s.byteLength===0&&t==="interactive")c=uI.fromNotebookDataDto({cells:[],metadata:{}});else{let u=await this._proxy.$dataToNotebook(i,s,Se.None);c=uI.fromNotebookDataDto(u.value)}return this._logService.trace(`[NotebookSerializer] dataToNotebook DONE after ${l.elapsed()}ms`,{viewType:t,extensionId:e.id.value}),c},notebookToData:s=>{let l=new Dn,c=this._proxy.$notebookToData(i,new ag(uI.toNotebookDataDto(s)),Se.None);return this._logService.trace(`[NotebookSerializer] notebookToData DONE after ${l.elapsed()}`,{viewType:t,extensionId:e.id.value}),c},save:async(s,l,c,u)=>{let p=await this._proxy.$saveNotebook(i,s,l,c,u);if(_3o(p))throw new ta(p.message,p.fileOperationResult,p.options);return{...p,children:void 0,resource:s}},searchInNotebooks:async(s,l,c)=>{let u=this._notebookService.getContributedNotebookType(t);if(!u)return{results:[],limitHit:!1};let h=u.selectors.map(S=>(S.include||S).toString());if(!h.length)return{results:[],limitHit:!1};let g=di([{isFromSettings:!1,filenamePatterns:h},...c.get(t)??[]]),f=Array.from(c.keys()).flatMap(S=>S!==t?c.get(S)??[]:[]),v=await this._proxy.$searchInNotebooks(i,s,g,f,l);return{results:v.results.map(S=>({resource:A.revive(S.resource),cellResults:S.cellResults.map(w=>$n(w))})),limitHit:v.limitHit}}})),n&&r.add(this._notebookService.registerContributedNotebookType(t,n)),this._notebookSerializer.set(i,r),this._logService.trace("[NotebookSerializer] registered notebook serializer",{viewType:t,extensionId:e.id.value})}$unregisterNotebookSerializer(i){this._notebookSerializer.get(i)?.dispose(),this._notebookSerializer.delete(i)}$emitCellStatusBarEvent(i){let e=this._notebookCellStatusBarRegistrations.get(i);e instanceof E&&e.fire(void 0)}async $registerNotebookCellStatusBarItemProvider(i,e,t){let o=this,n={async provideCellStatusBarItems(s,l,c){let u=await o._proxy.$provideNotebookCellStatusBarItems(i,s,l,c);return{items:u?.items??[],dispose(){u&&o._proxy.$releaseNotebookCellStatusBarItems(u.cacheId)}}},viewType:t};if(typeof e=="number"){let s=new E;this._notebookCellStatusBarRegistrations.set(e,s),n.onDidChangeStatusBarItems=s.event}let r=this._cellStatusBarService.registerCellStatusBarItemProvider(n);this._notebookCellStatusBarRegistrations.set(i,r)}async $unregisterNotebookCellStatusBarItemProvider(i,e){let t=o=>{this._notebookCellStatusBarRegistrations.get(o)&&(this._notebookCellStatusBarRegistrations.get(o)?.dispose(),this._notebookCellStatusBarRegistrations.delete(o))};t(i),typeof e=="number"&&t(e)}};OAt=I([fo(qi.MainThreadNotebook),m(1,bn),m(2,gZ),m(3,se)],OAt);$e.registerCommand("_executeDataToNotebook",async(a,...i)=>{let[e,t]=i;wo(typeof e=="string","string"),wo(t instanceof qe,"VSBuffer");let n=await a.get(bn).withNotebookDataProvider(e);if(!(n instanceof NR))return;let r=await n.serializer.dataToNotebook(t);return new ag(uI.toNotebookDataDto(r))});$e.registerCommand("_executeNotebookToData",async(a,i,e)=>{wo(typeof i=="string","string");let o=await a.get(bn).withNotebookDataProvider(i);if(!(o instanceof NR))return;let n=uI.fromNotebookDataDto(e.value);return await o.serializer.notebookToData(n)});function _3o(a){let i=a;return typeof i?.fileOperationResult=="number"&&typeof i?.message=="string"}var Gc=le("INotebookEditorWidgetService");var bs=le("INotebookExecutionStateService");var FAt=100;var Ol=le("INotebookKernelService"),eM=le("INotebookKernelHistoryService");var Kbi=class{constructor(i,e){this._languageService=e;this._onDidChange=new E;this.onDidChange=this._onDidChange.event;this.id=i.id,this.viewType=i.notebookType,this.extension=i.extensionId,this.implementsInterrupt=i.supportsInterrupt??!1,this.label=i.label,this.description=i.description,this.detail=i.detail,this.supportedLanguages=yr(i.supportedLanguages)?i.supportedLanguages:e.getRegisteredLanguageIds(),this.implementsExecutionOrder=i.supportsExecutionOrder??!1,this.hasVariableProvider=i.hasVariableProvider??!1,this.localResourceRoot=A.revive(i.extensionLocation),this.preloads=i.preloads?.map(t=>({uri:A.revive(t.uri),provides:t.provides}))??[]}get preloadUris(){return this.preloads.map(i=>i.uri)}get preloadProvides(){return this.preloads.flatMap(i=>i.provides)}update(i){let e=Object.create(null);i.label!==void 0&&(this.label=i.label,e.label=!0),i.description!==void 0&&(this.description=i.description,e.description=!0),i.detail!==void 0&&(this.detail=i.detail,e.detail=!0),i.supportedLanguages!==void 0&&(this.supportedLanguages=yr(i.supportedLanguages)?i.supportedLanguages:this._languageService.getRegisteredLanguageIds(),e.supportedLanguages=!0),i.supportsExecutionOrder!==void 0&&(this.implementsExecutionOrder=i.supportsExecutionOrder,e.hasExecutionOrder=!0),i.supportsInterrupt!==void 0&&(this.implementsInterrupt=i.supportsInterrupt,e.hasInterruptHandler=!0),i.hasVariableProvider!==void 0&&(this.hasVariableProvider=i.hasVariableProvider,e.hasVariableProvider=!0),this._onDidChange.fire(e)}},Gbi=class{constructor(i){this.notebookType=i}},WAt=class{constructor(i,e,t,o,n,r){this._languageService=e;this._notebookKernelService=t;this._notebookExecutionStateService=o;this._notebookService=n;this._editors=new Vt;this._disposables=new N;this._kernels=new Map;this._kernelDetectionTasks=new Map;this._kernelSourceActionProviders=new Map;this._kernelSourceActionProvidersEventRegistrations=new Map;this._executions=new Map;this._notebookExecutions=new Map;this.variableRequestIndex=0;this.variableRequestMap=new Map;this._proxy=i.getProxy(to.ExtHostNotebookKernels),r.listNotebookEditors().forEach(this._onEditorAdd,this),r.onDidAddNotebookEditor(this._onEditorAdd,this,this._disposables),r.onDidRemoveNotebookEditor(this._onEditorRemove,this,this._disposables),this._disposables.add(Z(()=>{this._executions.forEach(s=>{s.complete({})}),this._notebookExecutions.forEach(s=>s.complete())})),this._disposables.add(this._notebookKernelService.onDidChangeSelectedNotebooks(s=>{for(let[l,[c]]of this._kernels)s.oldKernel===c.id?this._proxy.$acceptNotebookAssociation(l,s.notebook,!1):s.newKernel===c.id&&this._proxy.$acceptNotebookAssociation(l,s.notebook,!0)}))}dispose(){this._disposables.dispose();for(let[,i]of this._kernels.values())i.dispose();for(let[,i]of this._kernelDetectionTasks.values())i.dispose();for(let[,i]of this._kernelSourceActionProviders.values())i.dispose();this._editors.dispose()}_onEditorAdd(i){let e=i.onDidReceiveMessage(t=>{if(!i.hasModel())return;let{selected:o}=this._notebookKernelService.getMatchingKernel(i.textModel);if(o){for(let[n,r]of this._kernels)if(r[0]===o){this._proxy.$acceptKernelMessageFromRenderer(n,i.getId(),t.message);break}}});this._editors.set(i,e)}_onEditorRemove(i){this._editors.deleteAndDispose(i)}async $postMessage(i,e,t){let o=this._kernels.get(i);if(!o)throw new Error("kernel already disposed");let[n]=o,r=!1;for(let[s]of this._editors)if(s.hasModel()&&this._notebookKernelService.getMatchingKernel(s.textModel).selected===n){if(e===void 0)s.postMessage(t),r=!0;else if(s.getId()===e){s.postMessage(t),r=!0;break}}return r}$receiveVariable(i,e){let t=this.variableRequestMap.get(i);t&&t.emitOne(e)}async $addKernel(i,e){let t=this,o=new class extends Kbi{async executeNotebookCellsRequest(r,s){await t._proxy.$executeCells(i,r,s)}async cancelNotebookCellExecution(r,s){await t._proxy.$cancelCells(i,r,s)}provideVariables(r,s,l,c,u){let p=`${i}variables${t.variableRequestIndex++}`;return new fp(async h=>{t.variableRequestMap.set(p,h);try{await t._proxy.$provideVariables(i,p,r,s,l,c,u)}finally{t.variableRequestMap.delete(p)}})}}(e,this._languageService),n=this._disposables.add(new N);this._kernels.set(i,[o,n]),n.add(this._notebookKernelService.registerKernel(o))}$updateKernel(i,e){let t=this._kernels.get(i);t&&t[0].update(e)}$removeKernel(i){let e=this._kernels.get(i);e&&(e[1].dispose(),this._kernels.delete(i))}$updateNotebookPriority(i,e,t){let o=this._kernels.get(i);o&&this._notebookKernelService.updateKernelNotebookAffinity(o[0],A.revive(e),t)}$createExecution(i,e,t,o){let n=A.revive(t),r=this._notebookService.getNotebookTextModel(n);if(!r)throw new Error(`Notebook not found: ${n.toString()}`);let s=this._notebookKernelService.getMatchingKernel(r);if(!s.selected||s.selected.id!==e)throw new Error(`Kernel is not selected: ${s.selected?.id} !== ${e}`);let l=this._notebookExecutionStateService.createCellExecution(n,o);l.confirm(),this._executions.set(i,l)}$updateExecution(i,e){let t=e.value;try{this._executions.get(i)?.update(t.map(uI.fromCellExecuteUpdateDto))}catch(o){mt(o)}}$completeExecution(i,e){try{this._executions.get(i)?.complete(uI.fromCellExecuteCompleteDto(e.value))}catch(t){mt(t)}finally{this._executions.delete(i)}}$createNotebookExecution(i,e,t){let o=A.revive(t),n=this._notebookService.getNotebookTextModel(o);if(!n)throw new Error(`Notebook not found: ${o.toString()}`);let r=this._notebookKernelService.getMatchingKernel(n);if(!r.selected||r.selected.id!==e)throw new Error(`Kernel is not selected: ${r.selected?.id} !== ${e}`);let s=this._notebookExecutionStateService.createExecution(o);s.confirm(),this._notebookExecutions.set(i,s)}$beginNotebookExecution(i){try{this._notebookExecutions.get(i)?.begin()}catch(e){mt(e)}}$completeNotebookExecution(i){try{this._notebookExecutions.get(i)?.complete()}catch(e){mt(e)}finally{this._notebookExecutions.delete(i)}}async $addKernelDetectionTask(i,e){let t=new Gbi(e),o=this._notebookKernelService.registerNotebookKernelDetectionTask(t);this._kernelDetectionTasks.set(i,[t,o])}$removeKernelDetectionTask(i){let e=this._kernelDetectionTasks.get(i);e&&(e[1].dispose(),this._kernelDetectionTasks.delete(i))}async $addKernelSourceActionProvider(i,e,t){let o={viewType:t,provideKernelSourceActions:async()=>(await this._proxy.$provideKernelSourceActions(i,Se.None)).map(s=>{let l=s.documentation;return s.documentation&&typeof s.documentation!="string"&&(l=A.revive(s.documentation)),{label:s.label,command:s.command,description:s.description,detail:s.detail,documentation:l}})};if(typeof e=="number"){let r=new E;this._kernelSourceActionProvidersEventRegistrations.set(e,r),o.onDidChangeSourceActions=r.event}let n=this._notebookKernelService.registerKernelSourceActionProvider(t,o);this._kernelSourceActionProviders.set(i,[o,n])}$removeKernelSourceActionProvider(i,e){let t=this._kernelSourceActionProviders.get(i);t&&(t[1].dispose(),this._kernelSourceActionProviders.delete(i)),typeof e=="number"&&this._kernelSourceActionProvidersEventRegistrations.delete(e)}$emitNotebookKernelSourceActionsChangeEvent(i){let e=this._kernelSourceActionProvidersEventRegistrations.get(i);e instanceof E&&e.fire(void 0)}$variablesUpdated(i){this._notebookKernelService.notifyVariablesChange(A.revive(i))}};WAt=I([fo(qi.MainThreadNotebookKernels),m(1,_t),m(2,Ol),m(3,bs),m(4,bn),m(5,Gc)],WAt);var rDe=class{constructor(i,e,t){this._notebookEditorModelResolverService=e;this._uriIdentityService=t;this._disposables=new N;this._documentEventListenersMapping=new gt;this._proxy=i.getProxy(to.ExtHostNotebookDocuments),this._modelReferenceCollection=new k9e(this._uriIdentityService.extUri),this._disposables.add(this._notebookEditorModelResolverService.onDidChangeDirty(o=>this._proxy.$acceptDirtyStateChanged(o.resource,o.isDirty()))),this._disposables.add(this._notebookEditorModelResolverService.onDidSaveNotebook(o=>this._proxy.$acceptModelSaved(o))),this._disposables.add(e.onWillFailWithConflict(o=>{this._modelReferenceCollection.remove(o.resource)}))}dispose(){this._disposables.dispose(),this._modelReferenceCollection.dispose(),Be(this._documentEventListenersMapping.values())}handleNotebooksAdded(i){for(let e of i){let t=new N;t.add(e.onDidChangeContent(o=>{let n={versionId:o.versionId,rawEvents:[]};for(let s of o.rawEvents)switch(s.kind){case 1:n.rawEvents.push({kind:s.kind,changes:s.changes.map(l=>[l[0],l[1],l[2].map(c=>uI.toNotebookCellDto(c))])});break;case 2:n.rawEvents.push({kind:s.kind,index:s.index,length:s.length,newIdx:s.newIdx});break;case 8:n.rawEvents.push({kind:s.kind,index:s.index,outputs:s.outputs.map(uI.toNotebookOutputDto)});break;case 9:n.rawEvents.push({kind:s.kind,index:s.index,outputId:s.outputId,outputItems:s.outputItems.map(uI.toNotebookOutputItemDto),append:s.append});break;case 5:case 10:case 7:case 12:n.rawEvents.push(s);break}let r=o.rawEvents.find(s=>s.kind===11);this._proxy.$acceptModelChanged(e.uri,new ag(n),this._notebookEditorModelResolverService.isDirty(e.uri),r?e.metadata:void 0)})),this._documentEventListenersMapping.set(e.uri,t)}}handleNotebooksRemoved(i){for(let e of i)this._documentEventListenersMapping.get(e)?.dispose(),this._documentEventListenersMapping.delete(e)}async $tryCreateNotebook(i){if(i.content){let e=await this._notebookEditorModelResolverService.resolve({untitledResource:void 0},i.viewType);if(U.once(e.object.notebook.onWillDispose)(()=>{e.dispose()}),this._proxy.$acceptDirtyStateChanged(e.object.resource,!0),i.content){let t=uI.fromNotebookDataDto(i.content);e.object.notebook.reset(t.cells,t.metadata,e.object.notebook.transientOptions)}return e.object.notebook.uri}else return(await this._notebookEditorModelResolverService.createUntitledNotebookTextModel(i.viewType)).uri}async $tryOpenNotebook(i){let e=A.revive(i),t=await this._notebookEditorModelResolverService.resolve(e,void 0);return i.scheme==="untitled"&&t.object.notebook.onWillDispose(()=>{t.dispose()}),this._modelReferenceCollection.add(e,t),e}async $trySaveNotebook(i){let e=A.revive(i),t=await this._notebookEditorModelResolverService.resolve(e),o=await t.object.save();return t.dispose(),o}};rDe=I([m(1,yh),m(2,ht)],rDe);var qbi=class{constructor(i,e){this.editor=i;this.disposables=e}dispose(){this.disposables.dispose()}},sDe=class{constructor(i,e,t,o,n){this._editorService=e;this._notebookEditorService=t;this._editorGroupService=o;this._configurationService=n;this._disposables=new N;this._mainThreadEditors=new Map;this._proxy=i.getProxy(to.ExtHostNotebookEditors),this._editorService.onDidActiveEditorChange(()=>this._updateEditorViewColumns(),this,this._disposables),this._editorGroupService.onDidRemoveGroup(()=>this._updateEditorViewColumns(),this,this._disposables),this._editorGroupService.onDidMoveGroup(()=>this._updateEditorViewColumns(),this,this._disposables)}dispose(){this._disposables.dispose(),Be(this._mainThreadEditors.values())}handleEditorsAdded(i){for(let e of i){let t=new N;t.add(e.onDidChangeVisibleRanges(()=>{this._proxy.$acceptEditorPropertiesChanged(e.getId(),{visibleRanges:{ranges:e.visibleRanges}})})),t.add(e.onDidChangeSelection(()=>{this._proxy.$acceptEditorPropertiesChanged(e.getId(),{selections:{selections:e.getSelections()}})}));let o=new qbi(e,t);this._mainThreadEditors.set(e.getId(),o)}}handleEditorsRemoved(i){for(let e of i)this._mainThreadEditors.get(e)?.dispose(),this._mainThreadEditors.delete(e)}_updateEditorViewColumns(){let i=Object.create(null);for(let e of this._editorService.visibleEditorPanes){let t=Jn(e);t&&this._mainThreadEditors.has(t.getId())&&(i[t.getId()]=GC(this._editorGroupService,e.group))}eo(i,this._currentViewColumnInfo)||(this._currentViewColumnInfo=i,this._proxy.$acceptEditorViewColumns(i))}async $tryShowNotebookDocument(i,e,t){let o={cellSelections:t.selections,preserveFocus:t.preserveFocus,pinned:t.pinned,activation:t.preserveFocus?2:void 0,label:t.label,override:e},n=await this._editorService.openEditor({resource:A.revive(i),options:o},wk(this._editorGroupService,this._configurationService,t.position)),r=Jn(n);if(r)return r.getId();throw new Error(`Notebook Editor creation failure for document ${JSON.stringify(i)}`)}async $tryRevealRange(i,e,t){let o=this._notebookEditorService.getNotebookEditor(i);if(!o)return;let n=o;if(!n.hasModel()||e.start>=n.getLength())return;let r=n.cellAt(e.start);switch(t){case 0:return n.revealCellRangeInView(e);case 1:return n.revealInCenter(r);case 2:return n.revealInCenterIfOutsideViewport(r);case 3:return n.revealInViewAtTop(r)}}$trySetSelections(i,e){let t=this._notebookEditorService.getNotebookEditor(i);t&&(t.setSelections(e),e.length&&t.setFocus({start:e[0].start,end:e[0].start+1}))}};sDe=I([m(1,ee),m(2,Gc),m(3,wt),m(4,B)],sDe);var VAt=class{constructor(i,e,t,o){this.documents=i;this.textEditors=e;this.activeEditor=t;this.visibleEditors=o}static delta(i,e){if(!i)return{addedDocuments:[...e.documents],removedDocuments:[],addedEditors:[...e.textEditors.values()],removedEditors:[],visibleEditors:[...e.visibleEditors].map(s=>s[0])};let t=t1(i.documents,e.documents),o=i$e(i.textEditors,e.textEditors),n=i.activeEditor!==e.activeEditor?e.activeEditor:void 0,r=i$e(i.visibleEditors,e.visibleEditors);return{addedDocuments:t.added,removedDocuments:t.removed.map(s=>s.uri),addedEditors:o.added,removedEditors:o.removed.map(s=>s.getId()),newActiveEditor:n,visibleEditors:r.added.length===0&&r.removed.length===0?void 0:[...e.visibleEditors].map(s=>s[0])}}},lpe=class{constructor(i,e,t,o,n,r,s){this._notebookService=t;this._notebookEditorService=o;this._editorService=n;this._editorGroupService=r;this._logService=s;this._disposables=new N;this._editorListeners=new Vt;this._proxy=i.getProxy(to.ExtHostNotebook),this._mainThreadNotebooks=e.createInstance(rDe,i),this._mainThreadEditors=e.createInstance(sDe,i),i.set(qi.MainThreadNotebookDocuments,this._mainThreadNotebooks),i.set(qi.MainThreadNotebookEditors,this._mainThreadEditors),this._notebookService.onWillAddNotebookDocument(()=>this._updateState(),this,this._disposables),this._notebookService.onDidRemoveNotebookDocument(()=>this._updateState(),this,this._disposables),this._editorService.onDidActiveEditorChange(()=>this._updateState(),this,this._disposables),this._editorService.onDidVisibleEditorsChange(()=>this._updateState(),this,this._disposables),this._notebookEditorService.onDidAddNotebookEditor(this._handleEditorAdd,this,this._disposables),this._notebookEditorService.onDidRemoveNotebookEditor(this._handleEditorRemove,this,this._disposables),this._updateState()}dispose(){this._mainThreadNotebooks.dispose(),this._mainThreadEditors.dispose(),this._disposables.dispose(),this._editorListeners.dispose()}_handleEditorAdd(i){this._editorListeners.set(i.getId(),wn(i.onDidChangeModel(()=>this._updateState()),i.onDidFocusWidget(()=>this._updateState(i)))),this._updateState()}_handleEditorRemove(i){this._editorListeners.deleteAndDispose(i.getId()),this._updateState()}_updateState(i){let e=new Map,t=new Map;for(let s of this._notebookEditorService.listNotebookEditors())s.hasModel()&&e.set(s.getId(),s);let o=Jn(this._editorService.activeEditorPane),n=null;o?n=o.getId():i?.textModel&&(n=i.getId()),n&&!e.has(n)&&(this._logService.trace("MainThreadNotebooksAndEditors#_updateState: active editor is not in editors list",n,e.keys()),n=null);for(let s of this._editorService.visibleEditorPanes){let l=Jn(s);l?.hasModel()&&e.has(l.getId())&&t.set(l.getId(),l)}let r=new VAt(new Set(this._notebookService.listNotebookDocuments()),e,n,t);this._onDelta(VAt.delta(this._currentState,r)),this._currentState=r}_onDelta(i){if(lpe._isDeltaEmpty(i))return;let e={removedDocuments:i.removedDocuments,removedEditors:i.removedEditors,newActiveEditor:i.newActiveEditor,visibleEditors:i.visibleEditors,addedDocuments:i.addedDocuments.map(lpe._asModelAddData),addedEditors:i.addedEditors.map(this._asEditorAddData,this)};this._proxy.$acceptDocumentAndEditorsDelta(new ag(e)),this._mainThreadEditors.handleEditorsRemoved(i.removedEditors),this._mainThreadNotebooks.handleNotebooksRemoved(i.removedDocuments),this._mainThreadNotebooks.handleNotebooksAdded(i.addedDocuments),this._mainThreadEditors.handleEditorsAdded(i.addedEditors)}static _isDeltaEmpty(i){return!(i.addedDocuments!==void 0&&i.addedDocuments.length>0||i.removedDocuments!==void 0&&i.removedDocuments.length>0||i.addedEditors!==void 0&&i.addedEditors.length>0||i.removedEditors!==void 0&&i.removedEditors.length>0||i.visibleEditors!==void 0&&i.visibleEditors.length>0||i.newActiveEditor!==void 0)}static _asModelAddData(i){return{viewType:i.viewType,uri:i.uri,metadata:i.metadata,versionId:i.versionId,cells:i.cells.map(uI.toNotebookCellDto)}}_asEditorAddData(i){let e=this._editorService.visibleEditorPanes.find(t=>Jn(t)===i);return{id:i.getId(),documentUri:i.textModel.uri,selections:i.getSelections(),visibleRanges:i.visibleRanges,viewColumn:e&&GC(this._editorGroupService,e.group),viewType:i.getViewModel().viewType}}};lpe=I([AR,m(1,F),m(2,bn),m(3,Gc),m(4,ee),m(5,wt),m(6,se)],lpe);var aDe=le("INotebookRendererMessagingService");var BAt=class extends x{constructor(e,t){super();this.messaging=t;this.proxy=e.getProxy(to.ExtHostNotebookRenderers),this._register(t.onShouldPostMessage(o=>{this.proxy.$postRendererMessage(o.editorId,o.rendererId,o.message)}))}$postMessage(e,t,o){return this.messaging.receiveMessage(e,t,o)}};BAt=I([fo(qi.MainThreadNotebookRenderers),m(1,aDe)],BAt);var Uv=le("INotebookLoggingService");var iv=le("workingCopyEditorService"),BYe=class extends x{constructor(e){super();this.editorService=e;this._onDidRegisterHandler=this._register(new E);this.onDidRegisterHandler=this._onDidRegisterHandler.event;this.handlers=new Set}registerHandler(e){return this.handlers.add(e),this._onDidRegisterHandler.fire(e),Z(()=>this.handlers.delete(e))}findEditor(e){for(let t of this.editorService.getEditors(0))if(this.isOpen(e,t.editor))return t}isOpen(e,t){for(let o of this.handlers)if(o.isOpen(e,t))return!0;return!1}};BYe=I([m(0,ee)],BYe);Ee(iv,BYe,1);var l0=le("elevatedFileService");function nso(a){return!!a.stat}var Z4=class extends rZ{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super(t,s);this.typeId=e;this.name=o;this.modelFactory=n;this.externalResolver=r;this.logService=l;this.workingCopyFileService=c;this.filesConfigurationService=u;this.workingCopyBackupService=p;this.notificationService=g;this.workingCopyEditorService=f;this.editorService=v;this.elevatedFileService=b;this.progressService=S;this.capabilities=0;this._model=void 0;this._onDidChangeContent=this._register(new E);this.onDidChangeContent=this._onDidChangeContent.event;this._onDidResolve=this._register(new E);this.onDidResolve=this._onDidResolve.event;this._onDidChangeDirty=this._register(new E);this.onDidChangeDirty=this._onDidChangeDirty.event;this._onDidSaveError=this._register(new E);this.onDidSaveError=this._onDidSaveError.event;this._onDidSave=this._register(new E);this.onDidSave=this._onDidSave.event;this._onDidRevert=this._register(new E);this.onDidRevert=this._onDidRevert.event;this._onDidChangeReadonly=this._register(new E);this.onDidChangeReadonly=this._onDidChangeReadonly.event;this.dirty=!1;this.ignoreDirtyOnModelContentChange=!1;this.versionId=0;this.lastContentChangeFromUndoRedo=void 0;this.saveSequentializer=new bIe;this.ignoreSaveFromSaveParticipants=!1;this.inConflictMode=!1;this.inErrorMode=!1;this._register(h.registerWorkingCopy(this)),this.registerListeners()}get model(){return this._model}registerListeners(){this._register(this.filesConfigurationService.onDidChangeReadonly(()=>this._onDidChangeReadonly.fire()))}isDirty(){return this.dirty}markModified(){this.setDirty(!0)}setDirty(e){if(!this.isResolved())return;let t=this.dirty;this.doSetDirty(e),e!==t&&this._onDidChangeDirty.fire()}doSetDirty(e){let t=this.dirty,o=this.inConflictMode,n=this.inErrorMode,r=this.savedVersionId;return e?this.dirty=!0:(this.dirty=!1,this.inConflictMode=!1,this.inErrorMode=!1,this.isResolved()&&(this.savedVersionId=this.model.versionId)),()=>{this.dirty=t,this.inConflictMode=o,this.inErrorMode=n,this.savedVersionId=r}}isResolved(){return!!this.model}async resolve(e){if(this.trace("resolve() - enter"),this.isDisposed()){this.trace("resolve() - exit - without resolving because file working copy is disposed");return}if(!e?.contents&&(this.dirty||this.saveSequentializer.isRunning())){this.trace("resolve() - exit - without resolving because file working copy is dirty or being saved");return}return this.doResolve(e)}async doResolve(e){if(e?.contents)return this.resolveFromBuffer(e.contents);if(!(!this.isResolved()&&await this.resolveFromBackup()))return this.resolveFromFile(e)}async resolveFromBuffer(e){this.trace("resolveFromBuffer()");let t,o,n,r;try{let s=await this.fileService.stat(this.resource);t=s.mtime,o=s.ctime,n=s.size,r=s.etag,this.setOrphaned(!1)}catch(s){t=Date.now(),o=Date.now(),n=0,r=JL,this.setOrphaned(s.fileOperationResult===1)}return this.resolveFromContent({resource:this.resource,name:this.name,mtime:t,ctime:o,size:n,etag:r,value:e,readonly:!1,locked:!1,executable:!1},!0)}async resolveFromBackup(){let e=await this.workingCopyBackupService.resolve(this);return this.isResolved()?(this.trace("resolveFromBackup() - exit - withoutresolving because previously new file working copy got created meanwhile"),!0):e?(await this.doResolveFromBackup(e),!0):!1}async doResolveFromBackup(e){this.trace("doResolveFromBackup()"),await this.resolveFromContent({resource:this.resource,name:this.name,mtime:e.meta?e.meta.mtime:Date.now(),ctime:e.meta?e.meta.ctime:Date.now(),size:e.meta?e.meta.size:0,etag:e.meta?e.meta.etag:JL,value:e.value,readonly:!1,locked:!1,executable:!1},!0),e.meta?.orphaned&&this.setOrphaned(!0)}async resolveFromFile(e){this.trace("resolveFromFile()");let t=e?.forceReadFromFile,o;t?o=JL:this.lastResolvedFileStat&&(o=this.lastResolvedFileStat.etag);let n=this.versionId;try{let r=await this.fileService.readFileStream(this.resource,{etag:o,limits:e?.limits});if(this.setOrphaned(!1),n!==this.versionId){this.trace("resolveFromFile() - exit - without resolving because file working copy content changed");return}await this.resolveFromContent(r,!1)}catch(r){let s=r.fileOperationResult;if(this.setOrphaned(s===1),this.isResolved()&&s===2){r instanceof J1&&this.updateLastResolvedFileStat(r.stat);return}if(this.isResolved()&&s===1&&!t)return;throw r}}async resolveFromContent(e,t){if(this.trace("resolveFromContent() - enter"),this.isDisposed()){this.trace("resolveFromContent() - exit - because working copy is disposed");return}this.updateLastResolvedFileStat({resource:this.resource,name:e.name,mtime:e.mtime,ctime:e.ctime,size:e.size,etag:e.etag,readonly:e.readonly,locked:e.locked,executable:!1,isFile:!0,isDirectory:!1,isSymbolicLink:!1,children:void 0}),this.isResolved()?await this.doUpdateModel(e.value):await this.doCreateModel(e.value),this.setDirty(!!t),this._onDidResolve.fire()}async doCreateModel(e){this.trace("doCreateModel()"),this._model=this._register(await this.modelFactory.createModel(this.resource,e,Se.None)),this.installModelListeners(this._model)}async doUpdateModel(e){this.trace("doUpdateModel()"),this.ignoreDirtyOnModelContentChange=!0;try{await this.model?.update(e,Se.None)}finally{this.ignoreDirtyOnModelContentChange=!1}}installModelListeners(e){this._register(e.onDidChangeContent(t=>this.onModelContentChanged(e,t.isUndoing||t.isRedoing))),this._register(e.onWillDispose(()=>this.dispose()))}onModelContentChanged(e,t){if(this.trace("onModelContentChanged() - enter"),this.versionId++,this.trace(`onModelContentChanged() - new versionId ${this.versionId}`),t&&(this.lastContentChangeFromUndoRedo=Date.now()),!this.ignoreDirtyOnModelContentChange&&!this.isReadonly())if(e.versionId===this.savedVersionId){this.trace("onModelContentChanged() - model content changed back to last saved version");let o=this.dirty;this.setDirty(!1),o&&this._onDidRevert.fire()}else this.trace("onModelContentChanged() - model content changed and marked as dirty"),this.setDirty(!0);this._onDidChangeContent.fire()}async forceResolveFromFile(){this.isDisposed()||await this.externalResolver({forceReadFromFile:!0})}get backupDelay(){return this.model?.configuration?.backupDelay}async backup(e){let t;this.lastResolvedFileStat&&(t={mtime:this.lastResolvedFileStat.mtime,ctime:this.lastResolvedFileStat.ctime,size:this.lastResolvedFileStat.size,etag:this.lastResolvedFileStat.etag,orphaned:this.isOrphaned()});let o;return this.isResolved()&&(o=await Va(this.model.snapshot(2,e),e)),{meta:t,content:o}}static{this.UNDO_REDO_SAVE_PARTICIPANTS_AUTO_SAVE_THROTTLE_THRESHOLD=500}async save(e=Object.create(null)){return this.isResolved()?this.isReadonly()?(this.trace("save() - ignoring request for readonly resource"),!1):(this.hasState(3)||this.hasState(5))&&(e.reason===2||e.reason===3||e.reason===4)?(this.trace("save() - ignoring auto save request for file working copy that is in conflict or error"),!1):(this.trace("save() - enter"),await this.doSave(e),this.trace("save() - exit"),this.hasState(0)):!1}async doSave(e){typeof e.reason!="number"&&(e.reason=1);let t=this.versionId;if(this.trace(`doSave(${t}) - enter with versionId ${t}`),this.ignoreSaveFromSaveParticipants){this.trace(`doSave(${t}) - exit - refusing to save() recursively from save participant`);return}if(this.saveSequentializer.isRunning(t))return this.trace(`doSave(${t}) - exit - found a running save for versionId ${t}`),this.saveSequentializer.running;if(!e.force&&!this.dirty){this.trace(`doSave(${t}) - exit - because not dirty and/or versionId is different (this.isDirty: ${this.dirty}, this.versionId: ${this.versionId})`);return}if(this.saveSequentializer.isRunning())return this.trace(`doSave(${t}) - exit - because busy saving`),this.saveSequentializer.cancelRunning(),this.saveSequentializer.queue(()=>this.doSave(e));this.isResolved()&&this.model.pushStackElement();let o=new Ye;return this.progressService.withProgress({title:d(18353,null,this.name),location:10,cancellable:!0,delay:this.isDirty()?3e3:5e3},n=>this.doSaveSequential(t,e,n,o),()=>{o.cancel()}).finally(()=>{o.dispose()})}doSaveSequential(e,t,o,n){return this.saveSequentializer.run(e,(async()=>{if(this.isResolved()&&!t.skipSaveParticipants&&this.workingCopyFileService.hasSaveParticipants)try{if(t.reason===2&&typeof this.lastContentChangeFromUndoRedo=="number"){let l=Date.now()-this.lastContentChangeFromUndoRedo;l<Z4.UNDO_REDO_SAVE_PARTICIPANTS_AUTO_SAVE_THROTTLE_THRESHOLD&&await Li(Z4.UNDO_REDO_SAVE_PARTICIPANTS_AUTO_SAVE_THROTTLE_THRESHOLD-l)}if(!n.token.isCancellationRequested){this.ignoreSaveFromSaveParticipants=!0;try{await this.workingCopyFileService.runSaveParticipants(this,{reason:t.reason??1,savedFrom:t.from},o,n.token)}catch(l){ao(l)&&!n.token.isCancellationRequested&&n.cancel()}finally{this.ignoreSaveFromSaveParticipants=!1}}}catch(l){this.logService.error(`[stored file working copy] runSaveParticipants(${e}) - resulted in an error: ${l.toString()}`,this.resource.toString(),this.typeId)}if(n.token.isCancellationRequested||this.isDisposed()||!this.isResolved())return;e=this.versionId,this.inErrorMode=!1,o.report({message:d(18354,null)}),this.trace(`doSave(${e}) - before write()`);let r=Ci(this.lastResolvedFileStat),s=this;return this.saveSequentializer.run(e,(async()=>{try{let l={mtime:r.mtime,etag:t.ignoreModifiedSince||!this.filesConfigurationService.preventSaveConflicts(r.resource)?JL:r.etag,unlock:t.writeUnlock},c;if(typeof s.model.save=="function")try{c=await s.model.save(l,n.token)}catch(u){if(n.token.isCancellationRequested)return;throw u}else{let u=await Va(s.model.snapshot(1,n.token),n.token);if(n.token.isCancellationRequested)return;n.dispose(),t?.writeElevated&&this.elevatedFileService.isSupported(r.resource)?c=await this.elevatedFileService.writeFileElevated(r.resource,Ci(u),l):c=await this.fileService.writeFile(r.resource,Ci(u),l)}this.handleSaveSuccess(c,e,t)}catch(l){this.handleSaveError(l,e,t)}})(),()=>n.cancel())})(),()=>n.cancel())}handleSaveSuccess(e,t,o){this.updateLastResolvedFileStat(e),t===this.versionId?(this.trace(`handleSaveSuccess(${t}) - setting dirty to false because versionId did not change`),this.setDirty(!1)):this.trace(`handleSaveSuccess(${t}) - not setting dirty to false because versionId did change meanwhile`),this.setOrphaned(!1),this._onDidSave.fire({reason:o.reason,stat:e,source:o.source})}handleSaveError(e,t,o){if((o.ignoreErrorHandler?this.logService.trace:this.logService.error).apply(this.logService,[`[stored file working copy] handleSaveError(${t}) - exit - resulted in a save error: ${e.toString()}`,this.resource.toString(),this.typeId]),o.ignoreErrorHandler)throw e;this.setDirty(!0),this.inErrorMode=!0,e.fileOperationResult===3&&(this.inConflictMode=!0),this.doHandleSaveError(e,o),this._onDidSaveError.fire()}doHandleSaveError(e,t){let o=e,n=[],r;if(o.fileOperationResult===3)r=d(18355,null,this.name),n.push(ii({id:"fileWorkingCopy.overwrite",label:d(18340,null),run:()=>this.save({...t,ignoreModifiedSince:!0,reason:1})})),n.push(ii({id:"fileWorkingCopy.revert",label:d(18349,null),run:()=>this.revert()}));else{let c=o.fileOperationResult===5,u=c&&o.options?.unlock,p=o.fileOperationResult===6,h=this.elevatedFileService.isSupported(this.resource);i7(e)&&n.push(...e.actions),h&&(p||u)?n.push(ii({id:"fileWorkingCopy.saveElevated",label:u?ei?d(18341,null):d(18342,null):ei?d(18351,null):d(18352,null),run:()=>{this.save({...t,writeElevated:!0,writeUnlock:u,reason:1})}})):c?n.push(ii({id:"fileWorkingCopy.unlock",label:d(18340,null),run:()=>this.save({...t,writeUnlock:!0,reason:1})})):n.push(ii({id:"fileWorkingCopy.retry",label:d(18348,null),run:()=>this.save({...t,reason:1})})),n.push(ii({id:"fileWorkingCopy.saveAs",label:d(18350,null),run:async()=>{let g=this.workingCopyEditorService.findEditor(this);g&&((await this.editorService.save(g,{saveAs:!0,reason:1})).success||this.doHandleSaveError(e,t))}})),n.push(ii({id:"fileWorkingCopy.revert",label:d(18349,null),run:()=>this.revert()})),c?u&&h?r=ei?d(18346,null,this.name):d(18347,null,this.name):r=d(18345,null,this.name):h&&p?r=ei?d(18343,null,this.name):d(18344,null,this.name):r=d(18339,null,this.name,xn(e,!1))}let s=this.notificationService.notify({id:`${_r(this.resource.toString())}`,severity:ft.Error,message:r,actions:{primary:n}}),l=this._register(U.once(U.any(this.onDidSave,this.onDidRevert))(()=>s.close()));this._register(U.once(s.onDidClose)(()=>l.dispose()))}updateLastResolvedFileStat(e){let t=this.isReadonly();this.lastResolvedFileStat?this.lastResolvedFileStat.mtime<=e.mtime?this.lastResolvedFileStat=e:this.lastResolvedFileStat={...this.lastResolvedFileStat,readonly:e.readonly,locked:e.locked}:this.lastResolvedFileStat=e,this.isReadonly()!==t&&this._onDidChangeReadonly.fire()}async revert(e){if(!this.isResolved()||!this.dirty&&!e?.force)return;this.trace("revert()");let t=this.dirty,o=this.doSetDirty(!1);if(!e?.soft)try{await this.forceResolveFromFile()}catch(r){if(r.fileOperationResult!==1)throw o(),r}this._onDidRevert.fire(),t&&this._onDidChangeDirty.fire()}hasState(e){switch(e){case 3:return this.inConflictMode;case 1:return this.dirty;case 5:return this.inErrorMode;case 4:return this.isOrphaned();case 2:return this.saveSequentializer.isRunning();case 0:return!this.dirty}}async joinState(e){return this.saveSequentializer.running}isReadonly(){return this.filesConfigurationService.isReadonly(this.resource,this.lastResolvedFileStat)}trace(e){this.logService.trace(`[stored file working copy] ${e}`,this.resource.toString(),this.typeId)}dispose(){this.trace("dispose()"),this.inConflictMode=!1,this.inErrorMode=!1,this._model=void 0,super.dispose()}};Z4=I([m(5,fe),m(6,se),m(7,qp),m(8,gr),m(9,hm),m(10,Xa),m(11,Ne),m(12,iv),m(13,ee),m(14,l0),m(15,Fo)],Z4);var c0=class extends wh{constructor(e,t,o,n,r,s){super();this.resource=e;this._hasAssociatedFilePath=t;this.viewType=o;this._workingCopyManager=n;this._filesConfigurationService=s;this._onDidChangeDirty=this._register(new E);this._onDidSave=this._register(new E);this._onDidChangeOrphaned=this._register(new E);this._onDidChangeReadonly=this._register(new E);this._onDidRevertUntitled=this._register(new E);this.onDidChangeDirty=this._onDidChangeDirty.event;this.onDidSave=this._onDidSave.event;this.onDidChangeOrphaned=this._onDidChangeOrphaned.event;this.onDidChangeReadonly=this._onDidChangeReadonly.event;this.onDidRevertUntitled=this._onDidRevertUntitled.event;this._workingCopyListeners=this._register(new N);this.scratchPad=r}dispose(){this._workingCopy?.dispose(),super.dispose()}get notebook(){return this._workingCopy?.model?.notebookModel}isResolved(){return!!this._workingCopy?.model?.notebookModel}async canDispose(){return this._workingCopy&&c0._isStoredFileWorkingCopy(this._workingCopy)?this._workingCopyManager.stored.canDispose(this._workingCopy):!0}isDirty(){return this._workingCopy?.isDirty()??!1}isModified(){return this._workingCopy?.isModified()??!1}isOrphaned(){return c0._isStoredFileWorkingCopy(this._workingCopy)&&this._workingCopy.hasState(4)}hasAssociatedFilePath(){return!c0._isStoredFileWorkingCopy(this._workingCopy)&&!!this._workingCopy?.hasAssociatedFilePath}isReadonly(){return c0._isStoredFileWorkingCopy(this._workingCopy)?this._workingCopy?.isReadonly():this._filesConfigurationService.isReadonly(this.resource)}get hasErrorState(){return this._workingCopy&&No(this._workingCopy,{hasState:!0})?this._workingCopy.hasState(5):!1}async revert(e){return wo(this.isResolved()),this._workingCopy.revert(e)}async save(e){return wo(this.isResolved()),this._workingCopy.save(e)}async load(e){return!this._workingCopy||!this._workingCopy.model?(this.resource.scheme===Q.untitled?(this._hasAssociatedFilePath?this._workingCopy=await this._workingCopyManager.resolve({associatedResource:this.resource}):this._workingCopy=await this._workingCopyManager.resolve({untitledResource:this.resource,isScratchpad:this.scratchPad}),this._register(this._workingCopy.onDidRevert(()=>this._onDidRevertUntitled.fire()))):(this._workingCopy=await this._workingCopyManager.resolve(this.resource,{limits:e?.limits,reload:e?.forceReadFromFile?{async:!1,force:!0}:void 0}),this._workingCopyListeners.add(this._workingCopy.onDidSave(t=>this._onDidSave.fire(t))),this._workingCopyListeners.add(this._workingCopy.onDidChangeOrphaned(()=>this._onDidChangeOrphaned.fire())),this._workingCopyListeners.add(this._workingCopy.onDidChangeReadonly(()=>this._onDidChangeReadonly.fire()))),this._workingCopyListeners.add(this._workingCopy.onDidChangeDirty(()=>this._onDidChangeDirty.fire(),void 0)),this._workingCopyListeners.add(this._workingCopy.onWillDispose(()=>{this._workingCopyListeners.clear(),this._workingCopy?.model?.dispose()}))):await this._workingCopyManager.resolve(this.resource,{reload:{async:!e?.forceReadFromFile,force:e?.forceReadFromFile},limits:e?.limits}),wo(this.isResolved()),this}async saveAs(e){let t=await this._workingCopyManager.saveAs(this.resource,e);if(t)return{resource:t.resource}}static _isStoredFileWorkingCopy(e){return!(e&&e.capabilities&2)}};c0=I([m(5,gr)],c0);var XB=class extends x{constructor(e,t,o,n,r){super();this._notebookModel=e;this._notebookService=t;this._configurationService=o;this._telemetryService=n;this._notebookLogService=r;this._onDidChangeContent=this._register(new E);this.onDidChangeContent=this._onDidChangeContent.event;this.configuration=void 0;this.onWillDispose=e.onWillDispose.bind(e),this._register(e.onDidChangeContent(l=>{for(let c of l.rawEvents)if(c.kind!==6&&!c.transient){this._onDidChangeContent.fire({isRedoing:!1,isUndoing:!1,isInitial:!1});break}}));let s=this._configurationService.getValue(yt.remoteSaving);(s||e.uri.scheme===Q.vscodeRemote)&&(this.configuration={backupDelay:1e4}),s&&this.setSaveDelegate().catch(l=>this._notebookLogService.error("WorkingCopyModel",`Failed to set save delegate: ${l}`))}async setSaveDelegate(){await this.getNotebookSerializer(),this.save=async(e,t)=>{try{let o=this._notebookService.tryGetDataProviderSync(this.notebookModel.viewType)?.serializer;if(o||(this._notebookLogService.info("WorkingCopyModel","No serializer found for notebook model, checking if provider still needs to be resolved"),o=await this.getNotebookSerializer().catch(r=>{throw this._notebookLogService.error("WorkingCopyModel",`Failed to get notebook serializer: ${r}`),this.save=void 0,new HAt("Failed to get notebook serializer")})),t.isCancellationRequested)throw new go;return await o.save(this._notebookModel.uri,this._notebookModel.versionId,e,t)}catch(o){if(!t.isCancellationRequested&&o.name!=="Canceled"){let n=this._notebookModel.viewType==="jupyter-notebook"||this._notebookModel.viewType==="interactive",r=D3o(o);this._telemetryService.publicLogError2("notebook/SaveError",{isRemote:this._notebookModel.uri.scheme===Q.vscodeRemote,isIPyNbWorkerSerializer:n&&this._configurationService.getValue("ipynb.experimental.serialization"),error:r})}throw o}}}dispose(){this._notebookModel.dispose(),super.dispose()}get notebookModel(){return this._notebookModel}async snapshot(e,t){return this._notebookService.createNotebookTextDocumentSnapshot(this._notebookModel.uri,e,t)}async update(e,t){let o=await this.getNotebookSerializer(),n=await tb(e),r=await o.dataToNotebook(n);if(t.isCancellationRequested)throw new go;this._notebookLogService.info("WorkingCopyModel","Notebook content updated from file system - "+this._notebookModel.uri.toString()),this._notebookModel.reset(r.cells,r.metadata,o.options)}async getNotebookSerializer(){let e=await this._notebookService.withNotebookDataProvider(this.notebookModel.viewType);if(!(e instanceof NR)){let t="CANNOT open notebook with this provider";throw new HAt(t)}return e.serializer}get versionId(){return this._notebookModel.alternativeVersionId}pushStackElement(){this._notebookModel.pushStackElement()}},cDe=class{constructor(i,e,t,o,n){this._viewType=i;this._notebookService=e;this._configurationService=t;this._telemetryService=o;this._notebookLogService=n}async createModel(i,e,t){let o=this._notebookService.getNotebookTextModel(i)??await this._notebookService.createNotebookTextModel(this._viewType,i,e);return new XB(o,this._notebookService,this._configurationService,this._telemetryService,this._notebookLogService)}};cDe=I([m(1,bn),m(2,B),m(3,Te),m(4,Uv)],cDe);var HAt=class extends Error{constructor(i){super(i),this.name="NotebookSaveError"}};function D3o(a){if(a.name==="NotebookSaveError")return a.message;if(a instanceof ta)switch(a.fileOperationResult){case 0:return"File is a directory";case 1:return"File not found";case 2:return"File not modified since";case 3:return"File modified since";case 4:return"File move conflict";case 5:return"File write locked";case 6:return"File permission denied";case 7:return"File too large";case 8:return"File invalid path";case 9:return"File not directory";case 10:return"File other error"}return"Unknown error"}var $bi=class{constructor(i){this._proxy=i.getProxy(to.ExtHostNotebookDocumentSaveParticipant)}async participate(i,e,t,o){if(!i.model||!(i.model instanceof XB))return;let n,r=new Promise((s,l)=>{n=setTimeout(()=>l(new Error(d(3344,null))),1750),this._proxy.$participateInSave(i.resource,e.reason,o).then(c=>{clearTimeout(n)}).then(s,l)});return Wp(r,o)}},UAt=class{constructor(i,e,t){this.workingCopyFileService=t;this._saveParticipantDisposable=this.workingCopyFileService.addSaveParticipant(e.createInstance($bi,i))}dispose(){this._saveParticipantDisposable.dispose()}};UAt=I([AR,m(1,F),m(2,qp)],UAt);var zAt=class{constructor(i,e){this._disposables=new N;this._proxy=i.getProxy(to.ExtHostInteractive),this._disposables.add(e.onWillAddInteractiveDocument(t=>{this._proxy.$willAddInteractiveDocument(t.inputUri,`
`,$r,t.notebookUri)})),this._disposables.add(e.onWillRemoveInteractiveDocument(t=>{this._proxy.$willRemoveInteractiveDocument(t.inputUri,t.notebookUri)}))}dispose(){this._disposables.dispose()}};zAt=I([fo(qi.MainThreadInteractive),m(1,FTe)],zAt);var L3o={type:"object",additionalProperties:!1,properties:{type:{type:"string",description:d(14700,null)},required:{type:"array",items:{type:"string"}},properties:{type:"object",description:d(14701,null),additionalProperties:{$ref:"http://json-schema.org/draft-07/schema#"}},when:{type:"string",markdownDescription:d(14702,null),default:""}}},sso;(i=>{function a(e,t,o){if(!e)return;let n=Fe(e.type)?e.type:void 0;if(!n||n.length===0){o.error(d(14704,null));return}let r=[];if(Array.isArray(e.required))for(let s of e.required)Fe(s)&&r.push(s);return{extensionId:t.value,taskType:n,required:r,properties:e.properties?Ji(e.properties):{},when:e.when?C.deserialize(e.when):void 0}}i.from=a})(sso||={});var R3o=Rn.registerExtensionPoint({extensionPoint:"taskDefinitions",activationEventsGenerator:function*(a){for(let i of a)i.type&&(yield`onTaskType:${i.type}`)},jsonSchema:{description:d(14703,null),type:"array",items:L3o}}),jbi=class{constructor(){this._onDefinitionsChanged=new E;this.onDefinitionsChanged=this._onDefinitionsChanged.event;this.taskTypes=Object.create(null),this.readyPromise=new Promise((i,e)=>{R3o.setHandler((t,o)=>{this._schema=void 0;try{for(let n of o.removed){let r=n.value;for(let s of r)this.taskTypes&&s.type&&this.taskTypes[s.type]&&delete this.taskTypes[s.type]}for(let n of o.added){let r=n.value;for(let s of r){let l=sso.from(s,n.description.identifier,n.collector);l&&(this.taskTypes[l.taskType]=l)}}(o.removed.length>0||o.added.length>0)&&this._onDefinitionsChanged.fire()}catch{}i(void 0)})})}onReady(){return this.readyPromise}get(i){return this.taskTypes[i]}all(){return Object.keys(this.taskTypes).map(i=>this.taskTypes[i])}getJsonSchema(){if(this._schema===void 0){let i=[];for(let e of this.all()){let t={type:"object",additionalProperties:!1};e.required.length>0&&(t.required=e.required.slice(0)),e.properties!==void 0?t.properties=Ji(e.properties):t.properties=Object.create(null),t.properties.type={type:"string",enum:[e.taskType]},i.push(t)}this._schema={oneOf:i}}return this._schema}},_k=new jbi;var JB="settings",uDe=new Y("taskRunning",!1,d(14707,null)),UYe=new Y("taskTerminalActive",!1,d(14709,null)),rx=L(14708,"Tasks"),pDe=(t=>(t[t.Escape=1]="Escape",t[t.Strong=2]="Strong",t[t.Weak=3]="Weak",t))(pDe||{}),e3="$customized";(i=>{function a(e){if(!e)return 2;switch(e.toLowerCase()){case"escape":return 1;case"strong":return 2;case"weak":return 3;default:return 2}}i.from=a})(pDe||={});var zYe;(i=>i.defaults={cwd:"${workspaceFolder}"})(zYe||={});var cpe=(t=>(t[t.Always=1]="Always",t[t.Silent=2]="Silent",t[t.Never=3]="Never",t))(cpe||{});(i=>{function a(e){switch(e.toLowerCase()){case"always":return 1;case"silent":return 2;case"never":return 3;default:return 1}}i.fromString=a})(cpe||={});var mDe=(t=>(t[t.Never=1]="Never",t[t.OnProblem=2]="OnProblem",t[t.Always=3]="Always",t))(mDe||{});(i=>{function a(e){switch(e.toLowerCase()){case"always":return 3;case"never":return 1;case"onproblem":return 2;default:return 2}}i.fromString=a})(mDe||={});var hDe=(t=>(t[t.Shared=1]="Shared",t[t.Dedicated=2]="Dedicated",t[t.New=3]="New",t))(hDe||{});(i=>{function a(e){switch(e.toLowerCase()){case"shared":return 1;case"dedicated":return 2;case"new":return 3;default:return 1}}i.fromString=a})(hDe||={});var GAt;(i=>i.defaults={echo:!0,reveal:1,revealProblems:1,focus:!1,panel:1,showReuseMessage:!0,clear:!1,preserveTerminalName:!1})(GAt||={});var t3=(t=>(t[t.Shell=1]="Shell",t[t.Process=2]="Process",t[t.CustomExecution=3]="CustomExecution",t))(t3||{});(e=>{function a(t){switch(t.toLowerCase()){case"shell":return 1;case"process":return 2;case"customExecution":return 3;default:return 2}}e.fromString=a;function i(t){switch(t){case 1:return"shell";case 2:return"process";case 3:return"customExecution";default:return"process"}}e.toString=i})(t3||={});var i3;(i=>{function a(e){return Fe(e)?e:e.value}i.value=a})(i3||={});var Jm;(r=>{r.Clean={_id:"clean",isDefault:!1},r.Build={_id:"build",isDefault:!1},r.Rebuild={_id:"rebuild",isDefault:!1},r.Test={_id:"test",isDefault:!1};function o(s){return s===r.Clean._id||s===r.Build._id||s===r.Rebuild._id||s===r.Test._id}r.is=o;function n(s){if(s!==void 0)return Fe(s)?o(s)?{_id:s,isDefault:!1}:void 0:s}r.from=n})(Jm||={});var El;(r=>{r.Workspace="workspace",r.Extension="extension",r.InMemory="inMemory",r.WorkspaceFile="workspaceFile",r.User="user";function n(s){switch(s){case r.User:return 2;case r.WorkspaceFile:return 5;default:return 6}}r.toConfigurationTarget=n})(El||={});var qAt;(i=>i.defaults={reevaluateOnRerun:!0,runOn:1,instanceLimit:1,instancePolicy:"prompt"})(qAt||={});var dDe=class{constructor(i,e,t,o,n,r){this._label="";this._id=i,e&&(this._label=e),t&&(this.type=t),this.runOptions=o,this.configurationProperties=n,this._source=r}getDefinition(i){}getMapKey(){return this._id}getKey(){}getCommonTaskId(){let i={folder:this.getFolderId(),id:this._id};return JSON.stringify(i)}clone(){return this.fromObject(Object.assign({},this))}getWorkspaceFolder(){}getWorkspaceFileName(){}getTelemetryKind(){return"unknown"}matches(i,e=!1){if(i===void 0)return!1;if(Fe(i))return i===this._label||i===this.configurationProperties.identifier||e&&i===this._id;let t=this.getDefinition(!0);return t!==void 0&&t._key===i._key}getQualifiedLabel(){let i=this.getWorkspaceFolder();return i?`${this._label} (${i.name})`:this._label}getTaskExecution(){return{id:this._id,task:this}}addTaskLoadMessages(i){this._taskLoadMessages===void 0&&(this._taskLoadMessages=[]),i&&(this._taskLoadMessages=this._taskLoadMessages.concat(i))}get taskLoadMessages(){return this._taskLoadMessages}},Ld=class a extends dDe{constructor(e,t,o,n,r,s,l,c){super(e,o,void 0,l,c,t);this.command={};this._source=t,this.hasDefinedMatchers=s,r&&(this.command=r)}clone(){return new a(this._id,this._source,this._label,this.type,this.command,this.hasDefinedMatchers,this.runOptions,this.configurationProperties)}customizes(){if(this._source&&this._source.customizes)return this._source.customizes}getDefinition(e=!1){if(e&&this._source.customizes!==void 0)return this._source.customizes;{let t;switch(this.command?this.command.runtime:void 0){case 1:t="shell";break;case 2:t="process";break;case 3:t="customExecution";break;case void 0:t="$composite";break;default:throw new Error("Unexpected task runtime")}return{type:t,_key:this._id,id:this._id}}}static is(e){return e instanceof a}getMapKey(){let e=this._source.config.workspaceFolder;return e?`${e.uri.toString()}|${this._id}|${this.instance}`:`${this._id}|${this.instance}`}getFolderId(){return this._source.kind===El.User?JB:this._source.config.workspaceFolder?.uri.toString()}getCommonTaskId(){return this._source.customizes?super.getCommonTaskId():this.getKey()??super.getCommonTaskId()}getKey(){let e=this.getFolderId();if(!e)return;let t=this.configurationProperties.identifier;return this._source.kind!==El.Workspace&&(t+=this._source.kind),JSON.stringify({type:e3,folder:e,id:t})}getWorkspaceFolder(){return this._source.config.workspaceFolder}getWorkspaceFileName(){return this._source.config.workspace&&this._source.config.workspace.configuration?He(this._source.config.workspace.configuration):void 0}getTelemetryKind(){return this._source.customizes?"workspace>extension":"workspace"}fromObject(e){let t=e;return new a(t._id,t._source,t._label,t.type,t.command,t.hasDefinedMatchers,t.runOptions,t.configurationProperties)}},kf=class a extends dDe{constructor(i,e,t,o,n,r,s){super(i,t,o,r,s,e),this._source=e,this.configures=n}static is(i){return i instanceof a}fromObject(i){return i}getDefinition(){return this.configures}getWorkspaceFileName(){return this._source.config.workspace&&this._source.config.workspace.configuration?He(this._source.config.workspace.configuration):void 0}getWorkspaceFolder(){return this._source.config.workspaceFolder}getFolderId(){return this._source.kind===El.User?JB:this._source.config.workspaceFolder?.uri.toString()}getKey(){let i=this.getFolderId();if(!i)return;let e=this.configurationProperties.identifier;return this._source.kind!==El.Workspace&&(e+=this._source.kind),JSON.stringify({type:e3,folder:i,id:e})}},Th=class a extends dDe{constructor(i,e,t,o,n,r,s,l,c){super(i,t,o,l,c,e),this.defines=n,this.hasDefinedMatchers=s,this.command=r,this.icon=c.icon,this.hide=c.hide}clone(){return new a(this._id,this._source,this._label,this.type,this.defines,this.command,this.hasDefinedMatchers,this.runOptions,this.configurationProperties)}getDefinition(){return this.defines}static is(i){return i instanceof a}getMapKey(){let i=this._source.workspaceFolder;return i?`${this._source.scope.toString()}|${i.uri.toString()}|${this._id}|${this.instance}`:`${this._source.scope.toString()}|${this._id}|${this.instance}`}getFolderId(){if(this._source.scope===3&&this._source.workspaceFolder)return this._source.workspaceFolder.uri.toString()}getKey(){let i={type:"contributed",scope:this._source.scope,id:this._id};return i.folder=this.getFolderId(),JSON.stringify(i)}getWorkspaceFolder(){return this._source.workspaceFolder}getTelemetryKind(){return"extension"}fromObject(i){let e=i;return new a(e._id,e._source,e._label,e.type,e.defines,e.command,e.hasDefinedMatchers,e.runOptions,e.configurationProperties)}},IT=class a extends dDe{constructor(i,e,t,o,n,r){super(i,t,o,n,r,e),this._source=e}clone(){return new a(this._id,this._source,this._label,this.type,this.runOptions,this.configurationProperties)}static is(i){return i instanceof a}getTelemetryKind(){return"composite"}getMapKey(){return`${this._id}|${this.instance}`}getFolderId(){}fromObject(i){let e=i;return new a(e._id,e._source,e._label,e.type,e.runOptions,e.configurationProperties)}},dpe=(e=>(e[e.Process=1]="Process",e[e.Terminal=2]="Terminal",e))(dpe||{});(i=>i._default=2)(dpe||={});var KAt=class{constructor(i){this._order=new Map;for(let e=0;e<i.length;e++)this._order.set(i[e].uri.toString(),e)}compare(i,e){let t=i.getWorkspaceFolder(),o=e.getWorkspaceFolder();if(t&&o){let n=this._order.get(t.uri.toString());n=n===void 0?0:n+1;let r=this._order.get(o.uri.toString());return r=r===void 0?0:r+1,n===r?i._label.localeCompare(e._label):n-r}else return!t&&o?-1:t&&!o?1:0}};var up;(c=>{function a(u){return{taskId:u._id,taskName:u.configurationProperties.name,runType:u.configurationProperties.isBackground?"background":"singleRun",group:u.configurationProperties.group,__task:u}}function i(u,p,h){return{...a(u),kind:"start",terminalId:p,resolvedVariables:h}}c.start=i;function e(u,p,h){return{...a(u),kind:"processStarted",terminalId:p,processId:h}}c.processStarted=e;function t(u,p,h,g){return{...a(u),kind:"processEnded",terminalId:p,exitCode:h,durationMs:g}}c.processEnded=t;function o(u,p,h){return{...a(u),kind:"inactive",terminalId:p,durationMs:h}}c.inactive=o;function n(u,p,h){return{...a(u),kind:"terminated",exitReason:h,terminalId:p}}c.terminated=n;function r(u,p,h){return{...a(p),kind:u,terminalId:h}}c.general=r;function s(u,p,h){return{...a(u),kind:"problemMatcherEnded",hasErrors:p}}c.problemMatcherEnded=s;function l(){return{kind:"changed"}}c.changed=l})(up||={});var HYe;(e=>{function a(t){let o=Object.keys(t).sort(),n="";for(let r of o){let s=t[r];s instanceof Object?s=a(s):typeof s=="string"&&(s=s.replace(/,/g,",,")),n+=r+","+s+","}return n}function i(t){let n={_key:a(t),type:t.taskType};return Object.assign(n,t),n}e.create=i})(HYe||={});var ZB;(i=>{function a(e,t){let o=_k.get(e.type);if(o===void 0){let l=Ji(e);return delete l._key,HYe.create(l)}let n=Object.create(null);n.type=o.taskType;let r=new Set;o.required.forEach(l=>r.add(l));let s=o.properties;for(let l of Object.keys(s)){let c=e[l];if(c!=null)n[l]=c;else if(r.has(l)){let u=s[l];if(u.default!==void 0)n[l]=Ji(u.default);else switch(u.type){case"boolean":n[l]=!1;break;case"number":case"integer":n[l]=0;break;case"string":n[l]="";break;default:t.error(d(14706,null,JSON.stringify(e,void 0,0),l));return}}}return HYe.create(n)}i.createTaskIdentifier=a})(ZB||={});var $At=Ae("rerun-task",R.refresh,d(14705,null)),jAt="workbench.action.tasks.rerunForActiveTerminal",QAt="workbench.action.tasks.rerunAllRunningTasks";var Qbi=new Y("customExecutionSupported",!1,d(14710,null)),upe=new Y("shellExecutionSupported",!1,d(14713,null)),YAt=new Y("taskCommandsRegistered",!1,d(14714,null)),gDe=new Y("processExecutionSupported",!1,d(14711,null)),XAt=new Y("serverlessWebContext",!1,d(14712,null)),fDe=new Y("tasksAvailable",!1,d(14715,null)),_h=C.or(C.and(upe,gDe),Qbi),Og=le("taskService");var Tp=le("configurationResolverService"),JAt=(J=>(J.Unknown="unknown",J.Env="env",J.Config="config",J.Command="command",J.Input="input",J.ExtensionInstallFolder="extensionInstallFolder",J.TaskVar="taskVar",J.WorkspaceFolder="workspaceFolder",J.Cwd="cwd",J.WorkspaceFolderBasename="workspaceFolderBasename",J.UserHome="userHome",J.LineNumber="lineNumber",J.ColumnNumber="columnNumber",J.SelectedText="selectedText",J.File="file",J.FileWorkspaceFolder="fileWorkspaceFolder",J.FileWorkspaceFolderBasename="fileWorkspaceFolderBasename",J.RelativeFile="relativeFile",J.RelativeFileDirname="relativeFileDirname",J.FileDirname="fileDirname",J.FileExtname="fileExtname",J.FileBasename="fileBasename",J.FileBasenameNoExtension="fileBasenameNoExtension",J.FileDirnameBasename="fileDirnameBasename",J.ExecPath="execPath",J.ExecInstallFolder="execInstallFolder",J.PathSeparator="pathSeparator",J.PathSeparatorAlias="/",J))(JAt||{}),aso=Object.values(JAt).filter(a=>typeof a=="string"),ov=class extends pa{constructor(e,t){super(t);this.variable=e}};var TS=class a{constructor(i){this.locations=new Map;this.newReplacementNotifiers=new Set;typeof i=="string"?(this.stringRoot=!0,this.root={value:i}):(this.stringRoot=!1,this.root=structuredClone(i))}static{this.VARIABLE_LHS="${"}static parse(i){if(i instanceof a)return i;let e=new a(i);return e.applyPlatformSpecificKeys(),e.parseObject(e.root),e}applyPlatformSpecificKeys(){let i=this.root,e=ei?"windows":Ze?"osx":fn?"linux":void 0;e&&i&&typeof i=="object"&&i.hasOwnProperty(e)&&Object.keys(i[e]).forEach(t=>i[t]=i[e][t]),delete i.windows,delete i.osx,delete i.linux}parseVariable(i,e){if(i[e]!=="$"||i[e+1]!=="{")return;let t=e+2,o=1;for(;t<i.length;){if(i[t]==="{")o++;else if(i[t]==="}"&&(o--,o===0))break;t++}if(o!==0)return;let n=i.slice(e,t+1),r=i.substring(e+2,t),s=r.indexOf(":");return s===-1?{replacement:{id:n,name:r,inner:r},end:t}:{replacement:{id:n,inner:r,name:r.slice(0,s),arg:r.slice(s+1)},end:t}}parseObject(i){if(!(typeof i!="object"||i===null)){if(Array.isArray(i)){for(let e=0;e<i.length;e++){let t=i[e];typeof t=="string"?this.parseString(i,e,t):this.parseObject(t)}return}for(let[e,t]of Object.entries(i))this.parseString(i,e,e,!0),typeof t=="string"?this.parseString(i,e,t):this.parseObject(t)}}parseString(i,e,t,o,n){let r=0;for(;r<t.length;){let s=t.indexOf("${",r);if(s===-1)break;let l=this.parseVariable(t,s);if(l){if(r=l.end+1,n?.includes(l.replacement.id))continue;let c=this.locations.get(l.replacement.id)||{locations:[],replacement:l.replacement},u={object:i,propertyName:e,replaceKeyName:o};c.locations.push(u),this.locations.set(l.replacement.id,c),c.resolved?this._resolveAtLocation(l.replacement,u,c.resolved,n):this.newReplacementNotifiers.forEach(p=>p(l.replacement))}else r=s+2}}*unresolved(){let i=new Map,e=t=>{i.set(t.id,t)};for(let t of this.locations.values())t.resolved===void 0&&i.set(t.replacement.id,t.replacement);for(this.newReplacementNotifiers.add(e);;){let t=vt.first(i);if(!t)break;let[o,n]=t;yield n,i.delete(o)}this.newReplacementNotifiers.delete(e)}resolved(){return vt.map(vt.filter(this.locations.values(),i=>!!i.resolved),i=>[i.replacement,i.resolved])}resolve(i,e){typeof e!="object"&&(e={value:String(e)});let t=this.locations.get(i.id);if(t&&(t.resolved=e,e.value!==void 0))for(let o of t.locations||vt.empty())this._resolveAtLocation(i,o,e)}_resolveAtLocation(i,{replaceKeyName:e,propertyName:t,object:o},n,r=[]){if(n.value!==void 0){if(r.push(i.id),e&&typeof t=="string"){let s=o[t],l=t.replaceAll(i.id,n.value);delete o[t],o[l]=s,this._renameKeyInLocations(o,t,l),this.parseString(o,l,n.value,!0,r)}else o[t]=o[t].replaceAll(i.id,n.value),this.parseString(o,t,n.value,!1,r);r.pop()}}_renameKeyInLocations(i,e,t){for(let o of this.locations.values())for(let n of o.locations)n.object===i&&n.propertyName===e&&(n.propertyName=t)}toObject(){return this.stringRoot?this.root.value:this.root}};var Ybi;(i=>{function a(e){return{id:e.id,task:CD.from(e.task)}}i.from=a})(Ybi||={});var lso;(i=>{function a(e){return{execution:{id:e.execution.id,task:CD.from(e.execution.task)}}}i.from=a})(lso||={});var Xbi;(i=>{function a(e){return{execution:{id:e.execution.id,task:CD.from(e.execution.task)},hasErrors:e.hasErrors}}i.from=a})(Xbi||={});var cso;(i=>{function a(e,t){return{id:e.id,processId:t}}i.from=a})(cso||={});var dso;(i=>{function a(e,t){return{id:e.id,exitCode:t}}i.from=a})(dso||={});var Jbi;(e=>{function a(t){let o=Object.assign(Object.create(null),t);return delete o._key,o}e.from=a;function i(t,o){let n=ZB.createTaskIdentifier(t,console);return n===void 0&&o&&(n={_key:xt(),type:"$executeOnly"}),n}e.to=i})(Jbi||={});var Zbi;(e=>{function a(t){if(t!=null)return Object.assign(Object.create(null),t)}e.from=a;function i(t){return t==null?GAt.defaults:Object.assign(Object.create(null),GAt.defaults,t)}e.to=i})(Zbi||={});var eSi;(e=>{function a(t){if(t!=null)return Object.assign(Object.create(null),t)}e.from=a;function i(t){return t==null?qAt.defaults:Object.assign(Object.create(null),qAt.defaults,t)}e.to=i})(eSi||={});var tSi;(e=>{function a(t){if(t!=null)return{cwd:t.cwd,env:t.env}}e.from=a;function i(t){return t==null?zYe.defaults:{cwd:t.cwd||zYe.defaults.cwd,env:t.env}}e.to=i})(tSi||={});var eNt;(t=>{function a(o){let n=o;return n&&!!n.process}t.is=a;function i(o){let n=Fe(o.name)?o.name:o.name.value,r=o.args?o.args.map(l=>Fe(l)?l:l.value):[],s={process:n,args:r};return o.options&&(s.options=tSi.from(o.options)),s}t.from=i;function e(o){let n={runtime:2,name:o.process,args:o.args,presentation:void 0};return n.options=tSi.to(o.options),n}t.to=e})(eNt||={});var iSi;(e=>{function a(t){if(t==null)return;let o={cwd:t.cwd||zYe.defaults.cwd,env:t.env};return t.shell&&(o.executable=t.shell.executable,o.shellArgs=t.shell.args,o.shellQuoting=t.shell.quoting),o}e.from=a;function i(t){if(t==null)return;let o={cwd:t.cwd,env:t.env};return t.executable&&(o.shell={executable:t.executable},t.shellArgs&&(o.shell.args=t.shellArgs),t.shellQuoting&&(o.shell.quoting=t.shellQuoting)),o}e.to=i})(iSi||={});var tNt;(t=>{function a(o){let n=o;return n&&(!!n.commandLine||!!n.command)}t.is=a;function i(o){let n={};return o.name&&Fe(o.name)&&(o.args===void 0||o.args===null||o.args.length===0)?n.commandLine=o.name:(n.command=o.name,n.args=o.args),o.options&&(n.options=iSi.from(o.options)),n}t.from=i;function e(o){let n={runtime:1,name:o.commandLine?o.commandLine:o.command,args:o.args,presentation:void 0};return o.options&&(n.options=iSi.to(o.options)),n}t.to=e})(tNt||={});var vDe;(t=>{function a(o){let n=o;return n&&n.customExecution==="customExecution"}t.is=a;function i(o){return{customExecution:"customExecution"}}t.from=i;function e(o){return{runtime:3,presentation:void 0}}t.to=e})(vDe||={});var oSi;(e=>{function a(t){let o={label:t.label};return t.kind===El.Extension?(o.extensionId=t.extension,t.workspaceFolder?o.scope=t.workspaceFolder.uri:o.scope=t.scope):t.kind===El.Workspace&&(o.extensionId="$core",o.scope=t.config.workspaceFolder?t.config.workspaceFolder.uri:1),o}e.from=a;function i(t,o){let n,r;return t.scope===void 0||typeof t.scope=="number"&&t.scope!==1?o.getWorkspace().folders.length===0?(n=1,r=void 0):(n=3,r=o.getWorkspace().folders[0]):typeof t.scope=="number"?n=t.scope:(n=3,r=o.getWorkspaceFolder(A.revive(t.scope))??void 0),{kind:El.Extension,label:t.label,extension:t.extensionId,scope:n,workspaceFolder:r}}e.to=i})(oSi||={});var nSi;(i=>{function a(e){let t=e;return!!t&&Fe(t.id)&&!!t.workspaceFolder}i.is=a})(nSi||={});var CD;(e=>{function a(t){if(t==null||!Ld.is(t)&&!Th.is(t)&&!kf.is(t))return;let o={_id:t._id,name:t.configurationProperties.name,definition:Jbi.from(t.getDefinition(!0)),source:oSi.from(t._source),execution:void 0,presentationOptions:!kf.is(t)&&t.command?Zbi.from(t.command.presentation):void 0,isBackground:t.configurationProperties.isBackground,problemMatchers:[],hasDefinedMatchers:Th.is(t)?t.hasDefinedMatchers:!1,runOptions:eSi.from(t.runOptions)};if(o.group=uso.from(t.configurationProperties.group),t.configurationProperties.detail&&(o.detail=t.configurationProperties.detail),!kf.is(t)&&t.command)switch(t.command.runtime){case 2:o.execution=eNt.from(t.command);break;case 1:o.execution=tNt.from(t.command);break;case 3:o.execution=vDe.from(t.command);break}if(t.configurationProperties.problemMatchers)for(let n of t.configurationProperties.problemMatchers)Fe(n)&&o.problemMatchers.push(n);return o}e.from=a;function i(t,o,n,r,s){if(!t||typeof t.name!="string")return;let l;if(t.execution&&(tNt.is(t.execution)?l=tNt.to(t.execution):eNt.is(t.execution)?l=eNt.to(t.execution):vDe.is(t.execution)&&(l=vDe.to(t.execution))),!l)return;l.presentation=Zbi.to(t.presentationOptions);let c=oSi.to(t.source,o),u=d(3350,null,c.label,t.name),p=Jbi.to(t.definition,n),h=vDe.is(t.execution)&&t._id?t._id:`${t.source.extensionId}.${p._key}`;return new Th(h,c,u,p.type,p,l,t.hasDefinedMatchers,eSi.to(t.runOptions),{name:t.name,identifier:u,group:t.group,isBackground:!!t.isBackground,problemMatchers:t.problemMatchers.slice(),detail:t.detail,icon:r,hide:s})}e.to=i})(CD||={});var uso;(i=>{function a(e){if(e!==void 0)return{_id:typeof e=="string"?e:e._id,isDefault:typeof e=="string"||typeof e.isDefault=="string"?!1:e.isDefault}}i.from=a})(uso||={});var pso;(e=>{function a(t){return t}e.from=a;function i(t){return t}e.to=i})(pso||={});var ZAt=class extends x{constructor(e,t,o,n){super();this._taskService=t;this._workspaceContextServer=o;this._configurationResolverService=n;this._proxy=e.getProxy(to.ExtHostTask),this._providers=new Map,this._register(this._taskService.onDidStateChange(async r=>{if(r.kind==="changed")return;let s=r.__task;if(r.kind==="start"){let l=Ybi.from(s.getTaskExecution()),c=l.task.definition;if(l.task?.execution&&vDe.is(l.task.execution)&&r.resolvedVariables){let u=TS.parse(l.task.definition);for(let p of u.unresolved()){let h=r.resolvedVariables.get(p.inner);h!==void 0&&u.resolve(p,h)}c=await this._configurationResolverService.resolveAsync(s.getWorkspaceFolder(),u)}this._proxy.$onDidStartTask(l,r.terminalId,c)}else r.kind==="processStarted"?this._proxy.$onDidStartTaskProcess(cso.from(s.getTaskExecution(),r.processId)):r.kind==="processEnded"?this._proxy.$onDidEndTaskProcess(dso.from(s.getTaskExecution(),r.exitCode)):r.kind==="end"?this._proxy.$OnDidEndTask(Ybi.from(s.getTaskExecution())):r.kind==="problemMatcherStarted"?this._proxy.$onDidStartTaskProblemMatchers(lso.from({execution:s.getTaskExecution()})):r.kind==="problemMatcherEnded"?this._proxy.$onDidEndTaskProblemMatchers(Xbi.from({execution:s.getTaskExecution(),hasErrors:!1})):r.kind==="problemMatcherFoundErrors"&&this._proxy.$onDidEndTaskProblemMatchers(Xbi.from({execution:s.getTaskExecution(),hasErrors:!0}))}))}dispose(){for(let e of this._providers.values())e.disposable.dispose();this._providers.clear(),super.dispose()}$createTaskId(e){return new Promise((t,o)=>{let n=CD.to(e,this._workspaceContextServer,!0);n?t(n._id):o(new Error("Task could not be created from DTO"))})}$registerTaskProvider(e,t){let o={provideTasks:r=>Promise.resolve(this._proxy.$provideTasks(e,r)).then(s=>{let l=[];for(let u of s.tasks){let p=CD.to(u,this._workspaceContextServer,!0);p?l.push(p):console.error(`Task System: can not convert task: ${JSON.stringify(u.definition,void 0,0)}. Task will be dropped`)}let c={...s.extension,extensionLocation:A.revive(s.extension.extensionLocation)};return{tasks:l,extension:c}}),resolveTask:r=>{let s=CD.from(r);return s?(s.name=s.name===void 0?"":s.name,Promise.resolve(this._proxy.$resolveTask(e,s)).then(l=>{if(l)return CD.to(l,this._workspaceContextServer,!0,r.configurationProperties.icon,r.configurationProperties.hide)})):Promise.resolve(void 0)}},n=this._taskService.registerTaskProvider(o,t);return this._providers.set(e,{disposable:n,provider:o}),Promise.resolve(void 0)}$unregisterTaskProvider(e){let t=this._providers.get(e);return t&&(t.disposable.dispose(),this._providers.delete(e)),Promise.resolve(void 0)}$fetchTasks(e){return this._taskService.tasks(pso.to(e)).then(t=>{let o=[];for(let n of t){let r=CD.from(n);r&&o.push(r)}return o})}getWorkspace(e){let t;if(typeof e=="string")t=e;else{let o=this._workspaceContextServer.getWorkspace(),n=A.revive(e);o.configuration?.toString()===n.toString()?t=o:t=this._workspaceContextServer.getWorkspaceFolder(n)}return t}async $getTaskExecution(e){if(nSi.is(e)){let t=this.getWorkspace(e.workspaceFolder);if(t){let o=await this._taskService.getTask(t,e.id,!0);if(o)return{id:o._id,task:CD.from(o)};throw new Error("Task not found")}else throw new Error("No workspace folder")}else{let t=CD.to(e,this._workspaceContextServer,!0);return{id:t._id,task:CD.from(t)}}}$executeTask(e){return new Promise((t,o)=>{if(nSi.is(e)){let n=this.getWorkspace(e.workspaceFolder);n?this._taskService.getTask(n,e.id,!0).then(r=>{if(!r)o(new Error("Task not found"));else{let s={id:e.id,task:CD.from(r)};this._taskService.run(r).then(l=>{(l?.exitCode===void 0||l.exitCode!==0)&&this._proxy.$OnDidEndTask(s)},l=>{}),t(s)}},r=>{o(new Error("Task not found"))}):o(new Error("No workspace folder"))}else{let n=CD.to(e,this._workspaceContextServer,!0);this._taskService.run(n).then(void 0,s=>{});let r={id:n._id,task:CD.from(n)};t(r)}})}$customExecutionComplete(e,t){return new Promise((o,n)=>{this._taskService.getActiveTasks().then(r=>{for(let s of r)if(e===s._id){this._taskService.extensionCallbackTaskComplete(s,t).then(l=>{o(void 0)},l=>{n(l)});return}n(new Error("Task to mark as complete not found"))})})}$terminateTask(e){return new Promise((t,o)=>{this._taskService.getActiveTasks().then(n=>{for(let r of n)if(e===r._id){this._taskService.terminate(r).then(s=>{t(void 0)},s=>{o(void 0)});return}o(new pa("Task to terminate not found"))})})}$registerTaskSystem(e,t){let o;switch(t.platform){case"Web":o=0;break;case"win32":o=3;break;case"darwin":o=1;break;case"linux":o=2;break;default:o=om}this._taskService.registerTaskSystem(e,{platform:o,uriProvider:n=>A.from({scheme:t.scheme,authority:t.authority,path:n}),context:this._extHostContext,resolveVariables:(n,r,s)=>{let l=[];return r.variables.forEach(c=>l.push(c)),Promise.resolve(this._proxy.$resolveVariables(n.uri,{process:r.process,variables:l})).then(c=>{let u=Array.from(Object.values(c.variables));return new Promise((p,h)=>{this._configurationResolverService.resolveWithInteraction(n,u,"tasks",void 0,s).then(g=>{g||p(void 0);let f={process:void 0,variables:new Map};for(let v=0;v<u.length;v++){let b=l[v].substring(2,l[v].length-1);if(g&&c.variables[l[v]]===l[v]){let S=g.get(b);typeof S=="string"&&f.variables.set(b,S)}else f.variables.set(b,u[v])}Fe(c.process)&&(f.process=c.process),p(f)},g=>{h(g)})})})},findExecutable:(n,r,s)=>this._proxy.$findExecutable(n,r,s)})}async $registerSupportedExecutions(e,t,o){return this._taskService.registerSupportedExecutions(e,t,o)}};ZAt=I([fo(qi.MainThreadTask),m(1,Og),m(2,Pe),m(3,Tp)],ZAt);var iNt=class extends x{constructor(e,t){super();this._labelService=t;this._resourceLabelFormatters=this._register(new Vt)}$registerResourceLabelFormatter(e,t){t.priority=!0;let o=this._labelService.registerCachedFormatter(t);this._resourceLabelFormatters.set(e,o)}$unregisterResourceLabelFormatter(e){this._resourceLabelFormatters.deleteAndDispose(e)}};iNt=I([fo(qi.MainThreadLabelService),m(1,rt)],iNt);var _p=le("tunnelService"),dWl=le("sharedTunnelsService");function rSi(a){let i=a;return!!(i.tunnelRemotePort&&i.tunnelRemoteHost&&i.localAddress&&i.privacy&&i.dispose)}function mso(a){return!!a.forwardPort}function IDe(a){if(a.scheme!=="http"&&a.scheme!=="https")return;let i=/^(localhost|127\.0\.0\.1|0\.0\.0\.0):(\d+)$/.exec(a.authority);if(i)return{address:i[1],port:+i[2]}}function hso(a){if(a.scheme!=="http"&&a.scheme!=="https"||!a.query)return;let i=a.query.split("&");for(let e of i){let t=e.split("=")[1];if(/^https?:/.exec(t)){let o=IDe(A.parse(t));if(o)return o}}}var SDe=["localhost","127.0.0.1","0:0:0:0:0:0:0:1","::1"];function fZ(a){return SDe.indexOf(a)>=0}var KYe=["0.0.0.0","0:0:0:0:0:0:0:0","::"];function o3(a){return KYe.indexOf(a)>=0}function gso(a,i,e,t){if(e===1)return!1;if(e===2&&o3(i)){let o=/(\d+)\.(\d+)\.(\d+)/g.exec(t);if(o?.length===4&&parseInt(o[1])>=18)return!1}return a<1024}var oNt=class{constructor(i,e,t){this.remoteAddress=i;this.localAddress=e;this._dispose=t;this._onDispose=new E;this.onDidDispose=this._onDispose.event}dispose(){return this._onDispose.fire(),this._onDispose.dispose(),this._dispose()}},bDe=class extends x{constructor(e,t){super();this.logService=e;this.configurationService=t;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=[],t=Array.from(this._tunnels.values());for(let o of t){let n=Array.from(o.values());for(let r of n){let s=await r.value;s&&typeof s!="string"&&e.push(s)}}return e}async dispose(){super.dispose();for(let e of this._tunnels.values()){for(let{value:t}of e.values())await t.then(o=>typeof o!="string"?o?.dispose():void 0);e.clear()}this._tunnels.clear()}setEnvironmentTunnel(e,t,o,n,r){this.addTunnelToMap(e,t,Promise.resolve({tunnelRemoteHost:e,tunnelRemotePort:t,localAddress:o,privacy:n,protocol:r,dispose:()=>Promise.resolve()}))}async getExistingTunnel(e,t){(o3(e)||fZ(e))&&(e=SDe[0]);let o=this.getTunnelFromMap(e,t);if(o)return++o.refcount,o.value}openTunnel(e,t,o,n,r,s=!1,l,c){this.logService.trace(`ForwardedPorts: (TunnelService) openTunnel request for ${t}:${o} on local port ${r}.`);let u=this._tunnelProvider??e;if(!u)return;if(t||(t="localhost"),n||(n=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 p=this.retainOrCreateTunnel(u,t,o,n,r,s,l,c);return p?p.then(h=>{if(h){if(typeof h=="string")return this.logService.trace("ForwardedPorts: (TunnelService) The tunnel provider returned an error when creating the tunnel."),this.removeEmptyOrErrorTunnelFromMap(t,o),h}else{this.logService.trace("ForwardedPorts: (TunnelService) New tunnel is undefined."),this.removeEmptyOrErrorTunnelFromMap(t,o);return}this.logService.trace("ForwardedPorts: (TunnelService) New tunnel established.");let g=this.makeTunnel(h);return(h.tunnelRemoteHost!==t||h.tunnelRemotePort!==o)&&this.logService.warn("ForwardedPorts: (TunnelService) Created tunnel does not match requirements of requested tunnel. Host or port mismatch."),l&&h.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."),p)}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 t=this._tunnels.get(e.tunnelRemoteHost);if(t){let o=t.get(e.tunnelRemotePort);o&&(o.refcount--,await this.tryDisposeTunnel(e.tunnelRemoteHost,e.tunnelRemotePort,o))}}}}async tryDisposeTunnel(e,t,o){if(o.refcount<=0){this.logService.trace(`ForwardedPorts: (TunnelService) Tunnel is being disposed ${e}:${t}.`);let n=o.value.then(async r=>{r&&typeof r!="string"&&(await r.dispose(!0),this._onTunnelClosed.fire({host:r.tunnelRemoteHost,port:r.tunnelRemotePort}))});return this._tunnels.has(e)&&this._tunnels.get(e).delete(t),n}}async closeTunnel(e,t){this.logService.trace(`ForwardedPorts: (TunnelService) close request for ${e}:${t} `);let o=this._tunnels.get(e);if(o&&o.has(t)){let n=o.get(t);n.refcount=0,await this.tryDisposeTunnel(e,t,n)}}addTunnelToMap(e,t,o){this._tunnels.has(e)||this._tunnels.set(e,new Map),this._tunnels.get(e).set(t,{refcount:1,value:o})}async removeEmptyOrErrorTunnelFromMap(e,t){let o=this._tunnels.get(e);if(o){let n=o.get(t),r=n?await n.value:void 0;(!r||typeof r=="string")&&o.delete(t),o.size===0&&this._tunnels.delete(e)}}getTunnelFromMap(e,t){let o=[e];fZ(e)?(o.push(...SDe),o.push(...KYe)):o3(e)&&o.push(...KYe);let n=o.map(r=>this._tunnels.get(r));for(let r of n){let s=r?.get(t);if(s)return s}}canTunnel(e){return!!IDe(e)}createWithProvider(e,t,o,n,r,s,l){this.logService.trace(`ForwardedPorts: (TunnelService) Creating tunnel with provider ${t}:${o} on local port ${n}.`);let c=o;this._factoryInProgress.add(c);let u=n===void 0?o:n,p={elevationRequired:r?this.isPortPrivileged(u):!1},h={remoteAddress:{host:t,port:o},localAddressPort:n,privacy:s,public:s?s!=="private":void 0,protocol:l},g=e.forwardPort(h,p);return g?(this.addTunnelToMap(t,o,g),g.finally(()=>{this.logService.trace("ForwardedPorts: (TunnelService) Tunnel created by provider."),this._factoryInProgress.delete(c)})):this._factoryInProgress.delete(c),g}};bDe=I([m(0,se),m(1,B)],bDe);var fso=le("IExtHostInitDataService");var vso=le("IExtHostRpcService");var sSi=class extends oNt{},rNt;(e=>{function a(t){return{remoteAddress:t.remoteAddress,localAddress:t.localAddress,public:!!t.public,privacy:t.privacy??(t.public?"public":"private"),protocol:t.protocol}}e.fromApiTunnel=a;function i(t){return{remoteAddress:{host:t.tunnelRemoteHost,port:t.tunnelRemotePort},localAddress:t.localAddress,public:t.privacy!=="constantPrivate"&&t.privacy!=="constantPrivate",privacy:t.privacy,protocol:t.protocol}}e.fromServiceTunnel=i})(rNt||={});var OWl=le("IExtHostTunnelService"),nNt=class extends x{constructor(e,t,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(qi.MainThreadTunnelService)}async openTunnel(e,t){this.logService.trace(`ForwardedPorts: (ExtHostTunnelService) ${e.identifier.value} called openTunnel API for ${t.remoteAddress.host}:${t.remoteAddress.port}.`);let o=await this._proxy.$openTunnel(t,e.displayName);if(o){let n=new sSi(o.remoteAddress,o.localAddress,()=>this._proxy.$closeTunnel(o.remoteAddress));return this._register(n),n}}async getTunnels(){return this._proxy.$getTunnels()}nextPortAttributesProviderHandle(){return this._providerHandleCounter++}registerPortsAttributesProvider(e,t){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:t}),this._proxy.$registerPortsAttributesProvider(e,o),new LX(()=>{this._portAttributesProviders.delete(o),this._proxy.$unregisterPortsAttributesProvider(o)})}async $providePortAttributes(e,t,o,n,r){let s=[];for(let c of e){let u=this._portAttributesProviders.get(c);if(!u)return[];s.push(...await Promise.all(t.map(async p=>{let h;try{h=await u.provider.providePortAttributes({port:p,pid:o,commandLine:n},r)}catch{h=await u.provider.providePortAttributes(p,o,n,r)}return{providedAttributes:h,port:p}})))}let l=s.filter(c=>!!c.providedAttributes);return l.length>0?l.map(c=>({autoForwardAction:c.providedAttributes.autoForwardAction,port:c.port})):[]}async $registerCandidateFinder(e){}registerTunnelProvider(e,t){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(n,r)=>await e.provideTunnel(n,r,Se.None)??void 0;let o=t.tunnelFeatures?{elevation:!!t.tunnelFeatures?.elevation,privacyOptions:t.tunnelFeatures?.privacyOptions,protocol:t.tunnelFeatures.protocol===void 0?!0:t.tunnelFeatures.protocol}:void 0;return this._proxy.$setTunnelProvider(o,!0),Promise.resolve(Z(()=>{this._forwardPortProvider=void 0,this._proxy.$setTunnelProvider(void 0,!1)}))}hasTunnelProvider(){return this._proxy.$hasTunnelProvider()}async setTunnelFactory(e,t){if(e){e.candidatePortSource!==void 0&&this._proxy.$setCandidatePortSource(e.candidatePortSource),e.showCandidatePort&&(this._showCandidatePort=e.showCandidatePort,this._proxy.$setCandidateFilter());let o=e.tunnelFactory??(t?this.makeManagedTunnelFactory(t):void 0);if(o){this._forwardPortProvider=o;let n=e.tunnelFeatures?.privacyOptions??[];e.tunnelFeatures?.public&&n.length===0&&(n=[{id:"private",label:d(3502,null),themeIcon:"lock"},{id:"public",label:d(3503,null),themeIcon:"eye"}]);let r=e.tunnelFeatures?{elevation:!!e.tunnelFeatures?.elevation,public:!!e.tunnelFeatures?.public,privacyOptions:n,protocol:!0}:void 0;this._proxy.$setTunnelProvider(r,!!e.tunnelFactory)}}else this._forwardPortProvider=void 0;return Z(()=>{this._forwardPortProvider=void 0})}makeManagedTunnelFactory(e){}async $closeTunnel(e,t){if(this._extensionTunnels.has(e.host)){let o=this._extensionTunnels.get(e.host);o.has(e.port)&&(t&&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,t){if(this._forwardPortProvider)try{this.logService.trace("ForwardedPorts: (ExtHostTunnelService) Getting tunnel from provider.");let o=this._forwardPortProvider(e,t);if(this.logService.trace("ForwardedPorts: (ExtHostTunnelService) Got tunnel promise from provider."),o!==void 0){let n=await o;if(this.logService.trace("ForwardedPorts: (ExtHostTunnelService) Successfully awaited tunnel from provider."),n===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 r=this._register(n.onDidDispose(()=>(this.logService.trace("ForwardedPorts: (ExtHostTunnelService) Extension fired tunnel's onDidDispose."),this._proxy.$closeTunnel(n.remoteAddress))));return this._extensionTunnels.get(e.remoteAddress.host).set(e.remoteAddress.port,{tunnel:n,disposeListener:r}),rNt.fromApiTunnel(n)}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 t=await Promise.all(e.map(n=>this._showCandidatePort(n.host,n.port,n.detail??""))),o=e.filter((n,r)=>t[r]);return this.logService.trace(`ForwardedPorts: (ExtHostTunnelService) filtered from ${e.map(n=>n.port).join(", ")} to ${o.map(n=>n.port).join(", ")}`),o}};nNt=I([m(0,vso),m(1,fso),m(2,se)],nNt);var A3o=10*1e3,sNt="remote.tunnels.toRestore",aSi="remote.tunnels.toRestoreExpiration",N3o=1e3*60*60*24*14,bso="onTunnel",mpe=new Y("forwardedPortsViewEnabled",!1,d(17938,null)),b2=new Y("forwardedPortsViewOnlyEnabled",!1,d(17938,null));function qYe(a){let i=a.match(/^([a-zA-Z0-9_-]+(?:\.[a-zA-Z0-9_-]+)*:)?([0-9]+)$/);if(i)return{host:i[1]?.substring(0,i[1].length-1)||"localhost",port:Number(i[2])}}var lSi={source:0,description:d(17940,null)},lNt={source:1,description:d(17939,null)};function Sso(a,i,e){let t=a.get(Qp(i,e));if(t)return t;if(fZ(i))for(let o of SDe){let n=Qp(o,e);if(a.has(n))return a.get(n)}else if(o3(i))for(let o of KYe){let n=Qp(o,e);if(a.has(n))return a.get(n)}}function Pb(a,i,e){let t=Sso(a,i,e);if(t)return t;let o=o3(i)?"localhost":fZ(i)?"0.0.0.0":void 0;if(o)return Sso(a,o,e)}function Qp(a,i){return a+":"+i}function O3o(a){return a&&"host"in a&&typeof a.host=="string"&&"port"in a&&typeof a.port=="number"&&(!("detail"in a)||typeof a.detail=="string")&&(!("pid"in a)||typeof a.pid=="string")}var aNt=class a extends x{constructor(e){super();this.configurationService=e;this.portsAttributes=[];this._onDidChangeAttributes=this._register(new E);this.onDidChangeAttributes=this._onDidChangeAttributes.event;this._register(e.onDidChangeConfiguration(t=>{(t.affectsConfiguration(a.SETTING)||t.affectsConfiguration(a.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,t,o){let n=this.findNextIndex(e,t,o,this.portsAttributes,0),r={label:void 0,onAutoForward:void 0,elevateIfNeeded:void 0,requireLocalPort:void 0,protocol:void 0};for(;n>=0;){let s=this.portsAttributes[n];s.key===e?(r.onAutoForward=s.onAutoForward??r.onAutoForward,r.elevateIfNeeded=s.elevateIfNeeded!==void 0?s.elevateIfNeeded:r.elevateIfNeeded,r.label=s.label??r.label,r.requireLocalPort=s.requireLocalPort,r.protocol=s.protocol):(r.onAutoForward=r.onAutoForward??s.onAutoForward,r.elevateIfNeeded=r.elevateIfNeeded!==void 0?r.elevateIfNeeded:s.elevateIfNeeded,r.label=r.label??s.label,r.requireLocalPort=r.requireLocalPort!==void 0?r.requireLocalPort:void 0,r.protocol=r.protocol??s.protocol),n=this.findNextIndex(e,t,o,this.portsAttributes,n+1)}return r.onAutoForward!==void 0||r.elevateIfNeeded!==void 0||r.label!==void 0||r.requireLocalPort!==void 0||r.protocol!==void 0?r:this.getOtherAttributes()}hasStartEnd(e){return e.start!==void 0&&e.end!==void 0}hasHostAndPort(e){return e.host!==void 0&&e.port!==void 0&&Fe(e.host)&&Yo(e.port)}findNextIndex(e,t,o,n,r){if(r>=n.length)return-1;let s=!fZ(t)&&!o3(t),c=n.slice(r).findIndex(u=>Yo(u.key)?s?!1:u.key===e:this.hasStartEnd(u.key)?s?!1:e>=u.key.start&&e<=u.key.end:this.hasHostAndPort(u.key)?e===u.key.port&&t===u.key.host:o?u.key.test(o):!1);return c>=0?c+r:-1}readSetting(){let e=this.configurationService.getValue(a.SETTING);if(!e||!xi(e))return[];let t=[];for(let n in e){if(n===void 0)continue;let r=e[n],s;if(Number(n))s=Number(n);else if(Fe(n))if(a.RANGE.test(n)){let l=n.match(a.RANGE);s={start:Number(l[1]),end:Number(l[2])}}else if(a.HOST_AND_PORT.test(n)){let l=n.match(a.HOST_AND_PORT);s={host:l[1],port:Number(l[2])}}else{let l;try{l=RegExp(n)}catch{}l&&(s=l)}s&&t.push({key:s,elevateIfNeeded:r.elevateIfNeeded,onAutoForward:r.onAutoForward,label:r.label,requireLocalPort:r.requireLocalPort,protocol:r.protocol})}let o=this.configurationService.getValue(a.DEFAULTS);return o&&(this.defaultPortAttributes={elevateIfNeeded:o.elevateIfNeeded,label:o.label,onAutoForward:o.onAutoForward,requireLocalPort:o.requireLocalPort,protocol:o.protocol}),this.sortAttributes(t)}sortAttributes(e){function t(o,n){return Yo(o.key)?o.key:n.hasStartEnd(o.key)?o.key.start:n.hasHostAndPort(o.key)?o.key.port:Number.MAX_VALUE}return e.sort((o,n)=>t(o,this)-t(n,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,t,o){let r=this.configurationService.inspect(a.SETTING).userRemoteValue,s;!r||!xi(r)?s={}:s=Ji(r),s[`${e}`]||(s[`${e}`]={});for(let l in t)s[`${e}`][l]=t[l];return this.configurationService.updateValue(a.SETTING,s,o)}},ppe=class extends x{constructor(e,t,o,n,r,s,l,c,u,p){super();this.tunnelService=e;this.storageService=t;this.configurationService=o;this.environmentService=n;this.remoteAuthorityResolverService=r;this.workspaceContextService=s;this.logService=l;this.dialogService=c;this.extensionService=u;this.contextKeyService=p;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 aNt(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 h=>{let g=await this.getAttributes(h.map(f=>({port:f.tunnelRemotePort,host:f.tunnelRemoteHost})));for(let f of h)if(f.localAddress){let v=Qp(f.tunnelRemoteHost,f.tunnelRemotePort),b=Pb(this._candidates??new Map,f.tunnelRemoteHost,f.tunnelRemotePort);this.forwarded.set(v,{remotePort:f.tunnelRemotePort,remoteHost:f.tunnelRemoteHost,localAddress:f.localAddress,protocol:g?.get(f.tunnelRemotePort)?.protocol??"http",localUri:await this.makeLocalUri(f.localAddress,g?.get(f.tunnelRemotePort)),localPort:f.tunnelLocalPort,name:g?.get(f.tunnelRemotePort)?.label,runningProcess:b?.detail,hasRunningProcess:!!b,pid:b?.pid,privacy:f.privacy,source:lSi}),this.remoteTunnels.set(v,f)}}),this.detected=new Map,this._register(this.tunnelService.onTunnelOpened(async h=>{let g=Qp(h.tunnelRemoteHost,h.tunnelRemotePort);if(!Pb(this.forwarded,h.tunnelRemoteHost,h.tunnelRemotePort)&&!Pb(this.detected,h.tunnelRemoteHost,h.tunnelRemotePort)&&!Pb(this.inProgress,h.tunnelRemoteHost,h.tunnelRemotePort)&&h.localAddress){let f=Pb(this._candidates??new Map,h.tunnelRemoteHost,h.tunnelRemotePort),v=(await this.getAttributes([{port:h.tunnelRemotePort,host:h.tunnelRemoteHost}]))?.get(h.tunnelRemotePort);this.forwarded.set(g,{remoteHost:h.tunnelRemoteHost,remotePort:h.tunnelRemotePort,localAddress:h.localAddress,protocol:v?.protocol??"http",localUri:await this.makeLocalUri(h.localAddress,v),localPort:h.tunnelLocalPort,name:v?.label,closeable:!0,runningProcess:f?.detail,hasRunningProcess:!!f,pid:f?.pid,privacy:h.privacy,source:lSi})}await this.storeForwarded(),this.checkExtensionActivationEvents(!0),this.remoteTunnels.set(g,h),this._onForwardPort.fire(this.forwarded.get(g))})),this._register(this.tunnelService.onTunnelClosed(h=>this.onTunnelClosed(h,"Other"))),this.checkExtensionActivationEvents(!1)}extensionHasActivationEvent(){return this.extensionService.extensions.find(e=>e.activationEvents?.includes(bso))?(this.contextKeyService.createKey(b2.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,t){let o=Qp(e.host,e.port);this.forwarded.delete(o)&&(await this.storeForwarded(),this._onClosePort.fire(e))}makeLocalUri(e,t){if(e.startsWith("http"))return A.parse(e);let o=t?.protocol??"http";return A.parse(`${o}://${e}`)}async addStorageKeyPostfix(e){let t=this.workspaceContextService.getWorkspace(),o=t.configuration?_r(t.configuration.path):t.folders.length>0?_r(t.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(sNt)}async getRestoreExpirationStorageKey(){return this.addStorageKeyPostfix(aSi)}async getTunnelRestoreValue(){let e=this.storageService.get(sNt,1);if(e)return this.storageService.remove(sNt,1),await this.storeForwarded(),e;let t=await this.getTunnelRestoreStorageKey();if(t)return this.storageService.get(t,0)}async restoreForwarded(){if(this.cleanupExpiredTunnelsForRestore(),this.configurationService.getValue("remote.restoreForwardedPorts")){let e=await this.tunnelRestoreValue;if(e&&e!==this.knownPortsRestoreValue){let t=JSON.parse(e)??[];this.logService.trace(`ForwardedPorts: (TunnelModel) restoring ports ${t.map(o=>o.remotePort).join(", ")}`);for(let o of t){let n=Pb(this.detected,o.remoteHost,o.remotePort);o.source.source!==2&&!n||o.source.source===2&&n?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&&!n&&this.unrestoredExtensionTunnels.set(Qp(o.remoteHost,o.remotePort),o)}}}if(this.restoreComplete=!0,this.onRestoreComplete.fire(),!this.restoreListener){let e=await this.getTunnelRestoreStorageKey();this.restoreListener=this._register(new N),this.restoreListener.add(this.storageService.onDidChangeValue(0,void 0,this.restoreListener)(async t=>{t.key===e&&(this.tunnelRestoreValue=Promise.resolve(this.storageService.get(e,0)),await this.restoreForwarded())}))}}cleanupExpiredTunnelsForRestore(){let e=this.storageService.keys(0,0).filter(t=>t.startsWith(aSi));for(let t of e){let o=this.storageService.getNumber(t,0);if(o&&o<Date.now()){this.tunnelRestoreValue=Promise.resolve(void 0);let n=t.replace(aSi,sNt);this.storageService.remove(t,0),this.storageService.remove(n,0)}}}async storeForwarded(){if(this.configurationService.getValue("remote.restoreForwardedPorts")){let e=Array.from(this.forwarded.values()),t=e.map(s=>({remoteHost:s.remoteHost,remotePort:s.remotePort,localPort:s.localPort,name:s.name,localAddress:s.localAddress,localUri:s.localUri,protocol:s.protocol,source:s.source})),o;e.length>0&&(o=JSON.stringify(t));let n=await this.getTunnelRestoreStorageKey(),r=await this.getRestoreExpirationStorageKey();!o&&n&&r?(this.storageService.remove(n,0),this.storageService.remove(r,0)):o!==this.knownPortsRestoreValue&&n&&r&&(this.storageService.store(n,o,0,0),this.storageService.store(r,Date.now()+N3o,0,0)),this.knownPortsRestoreValue=o}}async showPortMismatchModalIfNeeded(e,t,o){if(!e.tunnelLocalPort||!o?.requireLocalPort||e.tunnelLocalPort===t)return;let n=new Date;if(this.mismatchCooldown.getTime()+A3o>n.getTime())return;this.mismatchCooldown=n;let r=d(17937,null,t,e.tunnelRemotePort,e.tunnelLocalPort);return this.dialogService.info(r)}async forward(e,t){return!this.restoreComplete&&this.environmentService.remoteAuthority&&await U.toPromise(this.onRestoreComplete.event),this.doForward(e,t)}async doForward(e,t){await this.extensionService.activateByEvent(bso);let o=Pb(this.forwarded,e.remote.host,e.remote.port);t=t??(t!==null?(await this.getAttributes([e.remote]))?.get(e.remote.port):void 0);let n=e.local!==void 0?e.local:e.remote.port,r;if(o)return this.mergeAttributesIntoExistingTunnel(o,e,t);{let s=this.environmentService.remoteAuthority,l=s?{getAddress:async()=>(await this.remoteAuthorityResolverService.resolveAuthority(s)).authority}:void 0,c=Qp(e.remote.host,e.remote.port);this.inProgress.set(c,!0),e=this.mergeCachedAndUnrestoredProperties(c,e);let u=await this.tunnelService.openTunnel(l,e.remote.host,e.remote.port,void 0,n,e.elevateIfNeeded?e.elevateIfNeeded:t?.elevateIfNeeded,e.privacy,t?.protocol);if(typeof u=="string")r=u;else if(u&&u.localAddress){let p=Pb(this._candidates??new Map,e.remote.host,e.remote.port),h=u.protocol?u.protocol==="https"?"https":"http":t?.protocol??"http",g={remoteHost:u.tunnelRemoteHost,remotePort:u.tunnelRemotePort,localPort:u.tunnelLocalPort,name:t?.label??e.name,closeable:!0,localAddress:u.localAddress,protocol:h,localUri:await this.makeLocalUri(u.localAddress,t),runningProcess:p?.detail,hasRunningProcess:!!p,pid:p?.pid,source:e.source??lSi,privacy:u.privacy};return this.forwarded.set(c,g),this.remoteTunnels.set(c,u),this.inProgress.delete(c),await this.storeForwarded(),await this.showPortMismatchModalIfNeeded(u,n,t),this._onForwardPort.fire(g),u}this.inProgress.delete(c)}return r}mergeCachedAndUnrestoredProperties(e,t){let o=this.unrestoredExtensionTunnels.has(e)?this.unrestoredExtensionTunnels:this.sessionCachedProperties.has(e)?this.sessionCachedProperties:void 0;if(o){let n=o.get(e);o.delete(e),n&&(t.name=n.name??t.name,t.local=("local"in n?n.local:"localPort"in n?n.localPort:void 0)??t.local,t.privacy=t.privacy)}return t}async mergeAttributesIntoExistingTunnel(e,t,o){let n=o?.label??t.name,r;(p=>(p[p.None=0]="None",p[p.Fire=1]="Fire",p[p.Reopen=2]="Reopen"))(r||={});let s=0;switch(n!==e.name&&(e.name=n,s=1),(o?.protocol||e.protocol!=="http")&&o?.protocol!==e.protocol&&(t.source=e.source,s=2),t.privacy&&e.privacy!==t.privacy&&(s=2),s){case 1:{this._onForwardPort.fire();break}case 2:await this.close(e.remoteHost,e.remotePort,"User"),await this.doForward(t,o)}return Pb(this.remoteTunnels,t.remote.host,t.remote.port)}async name(e,t,o){let n=Pb(this.forwarded,e,t),r=Qp(e,t);if(n){n.name=o,await this.storeForwarded(),this._onPortName.fire({host:e,port:t});return}else this.detected.has(r)&&(this.detected.get(r).name=o,this._onPortName.fire({host:e,port:t}))}async close(e,t,o){let n=Qp(e,t),r=this.forwarded.get(n);return o==="AutoForwardEnd"&&r&&r.source.source===1&&this.sessionCachedProperties.set(n,{local:r.localPort,name:r.name,privacy:r.privacy}),await this.tunnelService.closeTunnel(e,t),this.onTunnelClosed({host:e,port:t},o)}address(e,t){let o=Qp(e,t);return(this.forwarded.get(o)||this.detected.get(o))?.localAddress}get environmentTunnelsSet(){return this._environmentTunnelsSet}addEnvironmentTunnels(e){if(e)for(let t of e){let o=Pb(this._candidates??new Map,t.remoteAddress.host,t.remoteAddress.port),n=typeof t.localAddress=="string"?t.localAddress:Qp(t.localAddress.host,t.localAddress.port);this.detected.set(Qp(t.remoteAddress.host,t.remoteAddress.port),{remoteHost:t.remoteAddress.host,remotePort:t.remoteAddress.port,localAddress:n,protocol:"http",localUri:this.makeLocalUri(n),closeable:!1,runningProcess:o?.detail,hasRunningProcess:!!o,pid:o?.pid,privacy:"constantPrivate",source:{source:2,description:d(17941,null)}}),this.tunnelService.setEnvironmentTunnel(t.remoteAddress.host,t.remoteAddress.port,n,"constantPrivate","http")}this._environmentTunnelsSet=!0,this._onEnvironmentTunnelsSet.fire(),this._onForwardPort.fire()}setCandidateFilter(e){this._candidateFilter=e}async setCandidates(e){let t=e;this._candidateFilter&&(t=await this._candidateFilter(e));let o=this.updateInResponseToCandidates(t);this.logService.trace(`ForwardedPorts: (TunnelModel) removed candidates ${Array.from(o.values()).map(n=>n.port).join(", ")}`),this._onCandidatesChanged.fire(o)}updateInResponseToCandidates(e){let t=this._candidates??new Map,o=new Map;return this._candidates=o,e.forEach(n=>{let r=Qp(n.host,n.port);o.set(r,{host:n.host,port:n.port,detail:n.detail,pid:n.pid}),t.delete(r);let s=Pb(this.forwarded,n.host,n.port);s&&(s.runningProcess=n.detail,s.hasRunningProcess=!0,s.pid=n.pid)}),t.forEach((n,r)=>{let s=qYe(r);if(!s)return;let l=Pb(this.forwarded,s.host,s.port);l&&(l.runningProcess=void 0,l.hasRunningProcess=!1,l.pid=void 0);let c=Pb(this.detected,s.host,s.port);c&&(c.runningProcess=void 0,c.hasRunningProcess=!1,c.pid=void 0)}),t}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()),t=await this.getAttributes(e.map(o=>({port:o.remotePort,host:o.remoteHost})),!1);if(t)for(let o of e){let n=t.get(o.remotePort);(n?.protocol||o.protocol!=="http")&&n?.protocol!==o.protocol&&await this.doForward({remote:{host:o.remoteHost,port:o.remotePort},local:o.localPort,name:o.name,source:o.source},n),n&&n.label&&n.label!==o.name&&await this.name(o.remoteHost,o.remotePort,n.label)}}async getAttributes(e,t=!0){let o=new Map,n=new Map;e.forEach(u=>{let p=Pb(this._candidates??new Map,SDe[0],u.port)??u;if(p){o.set(u.port,p);let h=O3o(p)?p.pid:void 0;n.has(h)||n.set(h,[]),n.get(h)?.push(u.port)}});let r=new Map;if(e.forEach(u=>{let p=this.configPortsAttributes.getAttributes(u.port,u.host,o.get(u.port)?.detail);p&&r.set(u.port,p)}),this.portAttributesProviders.length===0||!t)return r.size>0?r:void 0;let s=await Promise.all(this.portAttributesProviders.flatMap(u=>Array.from(n.entries()).map(p=>{let h=p[1],g=o.get(h[0]);return u.providePortAttributes(h,g?.pid,g?.detail,Se.None)}))),l=new Map;if(s.forEach(u=>u.forEach(p=>{p&&l.set(p.port,p)})),!r&&!l)return;let c=new Map;return e.forEach(u=>{let p=r.get(u.port),h=l.get(u.port);c.set(u.port,{elevateIfNeeded:p?.elevateIfNeeded,label:p?.label,onAutoForward:p?.onAutoForward??aNt.providedActionToAction(h?.autoForwardAction),requireLocalPort:p?.requireLocalPort,protocol:p?.protocol})}),c}addAttributesProvider(e){this.portAttributesProviders.push(e)}};I([Zd(1e3)],ppe.prototype,"storeForwarded",1),ppe=I([m(0,_p),m(1,ce),m(2,B),m(3,At),m(4,Uc),m(5,Pe),m(6,se),m(7,at),m(8,lt),m(9,X)],ppe);var du=le("remoteExplorerService"),jYe="remote.explorerType",n3="~remote.forwardedPorts",cNt="~remote.forwardedPortsContainer",r3="remote.autoForwardPorts",xD="remote.autoForwardPortsSource",QYe="remote.autoForwardPortsFallback",S2="process",vZ="output",yDe="hybrid";var F3o={type:"object",required:["id"],properties:{id:{description:d(17929,null),type:"string"}}},W3o=Rn.registerExtensionPoint({extensionPoint:"remoteHelp",jsonSchema:{description:d(17930,null),type:"object",properties:{getStarted:{description:d(17934,null),oneOf:[{type:"string"},F3o]},documentation:{description:d(17931,null),type:"string"},feedback:{description:d(17932,null),type:"string",markdownDeprecationMessage:d(17933,null,"`reportIssue`")},reportIssue:{description:d(17936,null),type:"string"},issues:{description:d(17935,null),type:"string"}}}});var $Ye=class{constructor(i,e,t){this.storageService=i;this.tunnelService=e;this._targetType=[];this._onDidChangeTargetType=new E;this.onDidChangeTargetType=this._onDidChangeTargetType.event;this._onDidChangeHelpInformation=new E;this.onDidChangeHelpInformation=this._onDidChangeHelpInformation.event;this._helpInformation=[];this._onDidChangeEditable=new E;this.onDidChangeEditable=this._onDidChangeEditable.event;this._onEnabledPortsFeatures=new E;this.onEnabledPortsFeatures=this._onEnabledPortsFeatures.event;this._portsFeaturesEnabled=0;this.namedProcesses=new Map;this._tunnelModel=t.createInstance(ppe),W3o.setHandler(o=>{this._helpInformation.push(...o),this._onDidChangeHelpInformation.fire(o)})}get helpInformation(){return this._helpInformation}set targetType(i){let e=this._targetType.length>0?this._targetType[0]:"",t=i.length>0?i[0]:"";e!==t&&(this._targetType=i,this.storageService.store(jYe,this._targetType.toString(),1,1),this.storageService.store(jYe,this._targetType.toString(),0,0),this._onDidChangeTargetType.fire(this._targetType))}get targetType(){return this._targetType}get tunnelModel(){return this._tunnelModel}forward(i,e){return this.tunnelModel.forward(i,e)}close(i,e){return this.tunnelModel.close(i.host,i.port,e)}setTunnelInformation(i){i?.features&&this.tunnelService.setTunnelFeatures(i.features),this.tunnelModel.addEnvironmentTunnels(i?.environmentTunnels)}setEditable(i,e,t){t?this._editable={tunnelItem:i,data:t,editId:e}:this._editable=void 0,this._onDidChangeEditable.fire(i?{tunnel:i,editId:e}:void 0)}getEditableData(i,e){return this._editable&&(!i&&i===this._editable.tunnelItem||i&&this._editable.tunnelItem?.remotePort===i.remotePort&&this._editable.tunnelItem.remoteHost===i.remoteHost&&this._editable.editId===e)?this._editable.data:void 0}setCandidateFilter(i){return i?(this.tunnelModel.setCandidateFilter(i),{dispose:()=>{this.tunnelModel.setCandidateFilter(void 0)}}):{dispose:()=>{}}}onFoundNewCandidates(i){this.tunnelModel.setCandidates(i)}restore(){return this.tunnelModel.restoreForwarded()}enablePortsFeatures(i){this._portsFeaturesEnabled=i?1:2,this._onEnabledPortsFeatures.fire()}get portsFeaturesEnabled(){return this._portsFeaturesEnabled}};$Ye=I([m(0,ce),m(1,_p),m(2,F)],$Ye);Ee(du,$Ye,1);var dNt=class extends x{constructor(e,t,o,n,r,s,l,c){super();this.remoteExplorerService=t;this.tunnelService=o;this.notificationService=n;this.configurationService=r;this.logService=s;this.remoteAgentService=l;this.contextKeyService=c;this.elevateionRetry=!1;this.portsAttributesProviders=new Map;this._alreadyRegistered=!1;this._proxy=e.getProxy(to.ExtHostTunnelService),this._register(o.onTunnelOpened(()=>this._proxy.$onDidTunnelsChange())),this._register(o.onTunnelClosed(()=>this._proxy.$onDidTunnelsChange()))}processFindingEnabled(){return(!!this.configurationService.getValue(r3)||this.tunnelService.hasTunnelProvider)&&this.configurationService.getValue(xD)!==vZ}async $setRemoteTunnelService(e){this.remoteExplorerService.namedProcesses.set(e,"Code Extension Host"),this.remoteExplorerService.portsFeaturesEnabled===2?this._proxy.$registerCandidateFinder(this.processFindingEnabled()):this._register(this.remoteExplorerService.onEnabledPortsFeatures(()=>this._proxy.$registerCandidateFinder(this.processFindingEnabled()))),this._register(this.configurationService.onDidChangeConfiguration(async t=>{if(this.remoteExplorerService.portsFeaturesEnabled===2&&(t.affectsConfiguration(r3)||t.affectsConfiguration(xD)))return this._proxy.$registerCandidateFinder(this.processFindingEnabled())})),this._register(this.tunnelService.onAddedTunnelProvider(async()=>{if(this.remoteExplorerService.portsFeaturesEnabled===2)return this._proxy.$registerCandidateFinder(this.processFindingEnabled())}))}async $registerPortsAttributesProvider(e,t){this.portsAttributesProviders.set(t,e),this._alreadyRegistered||(this.remoteExplorerService.tunnelModel.addAttributesProvider(this),this._alreadyRegistered=!0)}async $unregisterPortsAttributesProvider(e){this.portsAttributesProviders.delete(e)}async providePortAttributes(e,t,o,n){if(this.portsAttributesProviders.size===0)return[];let r=Array.from(this.portsAttributesProviders.entries()).filter(s=>{let l=s[1],c=typeof l.portRange=="number"?[l.portRange,l.portRange+1]:l.portRange,u=c?e.some(h=>c[0]<=h&&h<c[1]):!0,p=!l.commandPattern||o&&o.match(l.commandPattern);return u&&p}).map(s=>s[0]);return r.length===0?[]:this._proxy.$providePortAttributes(r,e,t,o,n)}async $openTunnel(e,t){let o=await this.remoteExplorerService.forward({remote:e.remoteAddress,local:e.localAddressPort,name:e.label,source:{source:2,description:t},elevateIfNeeded:!1});if(!(!o||typeof o=="string"))return!this.elevateionRetry&&e.localAddressPort!==void 0&&o.tunnelLocalPort!==void 0&&this.tunnelService.isPortPrivileged(e.localAddressPort)&&o.tunnelLocalPort!==e.localAddressPort&&this.tunnelService.canElevate&&this.elevationPrompt(e,o,t),rNt.fromServiceTunnel(o)}async elevationPrompt(e,t,o){return this.notificationService.prompt(ft.Info,d(3351,null,o,e.remoteAddress.port,e.localAddressPort),[{label:d(3352,null,t.tunnelRemotePort),run:async()=>{this.elevateionRetry=!0,await this.remoteExplorerService.close({host:t.tunnelRemoteHost,port:t.tunnelRemotePort},"Other"),await this.remoteExplorerService.forward({remote:e.remoteAddress,local:e.localAddressPort,name:e.label,source:{source:2,description:o},elevateIfNeeded:!0}),this.elevateionRetry=!1}}])}async $closeTunnel(e){return this.remoteExplorerService.close(e,"Other")}async $getTunnels(){return(await this.tunnelService.tunnels).map(e=>({remoteAddress:{port:e.tunnelRemotePort,host:e.tunnelRemoteHost},localAddress:e.localAddress,privacy:e.privacy,protocol:e.protocol}))}async $onFoundNewCandidates(e){this.remoteExplorerService.onFoundNewCandidates(e)}async $setTunnelProvider(e,t){let o={forwardPort:(n,r)=>this._proxy.$forwardPort(n,r).then(l=>{if(l){if(typeof l=="string")return l}else return;let c=l;return this.logService.trace(`ForwardedPorts: (MainThreadTunnelService) New tunnel established by tunnel provider: ${c?.remoteAddress.host}:${c?.remoteAddress.port}`),{tunnelRemotePort:c.remoteAddress.port,tunnelRemoteHost:c.remoteAddress.host,localAddress:typeof c.localAddress=="string"?c.localAddress:Qp(c.localAddress.host,c.localAddress.port),tunnelLocalPort:typeof c.localAddress!="string"?c.localAddress.port:void 0,public:c.public,privacy:c.privacy,protocol:c.protocol??"http",dispose:async u=>(this.logService.trace(`ForwardedPorts: (MainThreadTunnelService) Closing tunnel from tunnel provider: ${c?.remoteAddress.host}:${c?.remoteAddress.port}`),this._proxy.$closeTunnel({host:c.remoteAddress.host,port:c.remoteAddress.port},u))}})};e&&this.tunnelService.setTunnelFeatures(e),this.tunnelService.setTunnelProvider(o),t&&this.contextKeyService.createKey(mpe.key,!0)}async $hasTunnelProvider(){return this.tunnelService.hasTunnelProvider}async $setCandidateFilter(){this.remoteExplorerService.setCandidateFilter(e=>this._proxy.$applyCandidateFilter(e))}async $setCandidatePortSource(e){this.remoteAgentService.getEnvironment().then(()=>{switch(e){case 0:{ne.as(Jt.Configuration).registerDefaultConfigurations([{overrides:{"remote.autoForwardPorts":!1}}]);break}case 2:{ne.as(Jt.Configuration).registerDefaultConfigurations([{overrides:{"remote.autoForwardPortsSource":vZ}}]);break}case 3:{ne.as(Jt.Configuration).registerDefaultConfigurations([{overrides:{"remote.autoForwardPortsSource":yDe}}]);break}default:}}).catch(()=>{})}};dNt=I([fo(qi.MainThreadTunnelService),m(1,du),m(2,_p),m(3,Ne),m(4,B),m(5,se),m(6,bo),m(7,X)],dNt);var DA=le("IAuthenticationUsageService"),YYe=class extends x{constructor(e,t,o,n){super();this._storageService=e;this._authenticationService=t;this._logService=o;this._queue=this._register(new uh);this._extensionsUsingAuth=new Set;this._disposed=!1;this._register(Z(()=>this._disposed=!0));let r=n.trustedExtensionAuthAccess;if(Array.isArray(r))for(let s of r)this._extensionsUsingAuth.add(s);else if(r)for(let s of Object.values(r))for(let l of s)this._extensionsUsingAuth.add(l);this._register(this._authenticationService.onDidRegisterAuthenticationProvider(s=>this._queue.queue(()=>this._addExtensionsToCache(s.id))))}async initializeExtensionUsageCache(){await this._queue.queue(()=>Promise.all(this._authenticationService.getProviderIds().map(e=>this._addExtensionsToCache(e))))}async extensionUsesAuth(e){return await this._queue.whenIdle(),this._extensionsUsingAuth.has(e)}readAccountUsages(e,t){let o=`${e}-${t}-usages`,n=this._storageService.get(o,-1),r=[];if(n)try{r=JSON.parse(n)}catch{}return r}removeAccountUsage(e,t){let o=`${e}-${t}-usages`;this._storageService.remove(o,-1)}addAccountUsage(e,t,o,n,r){let s=`${e}-${t}-usages`,l=this.readAccountUsages(e,t),c=l.findIndex(u=>u.extensionId===n);c>-1?l.splice(c,1,{extensionId:n,extensionName:r,scopes:o,lastUsed:Date.now()}):l.push({extensionId:n,extensionName:r,scopes:o,lastUsed:Date.now()}),this._storageService.store(s,JSON.stringify(l),-1,1),this._extensionsUsingAuth.add(n)}async _addExtensionsToCache(e){if(!this._disposed)try{let t=await this._authenticationService.getAccounts(e);for(let o of t){let n=this.readAccountUsages(e,o.label);for(let r of n)this._extensionsUsingAuth.add(r.extensionId)}}catch(t){this._logService.error(t)}}};YYe=I([m(0,ce),m(1,xs),m(2,se),m(3,tt)],YYe);Ee(DA,YYe,1);var uSi="/.well-known",vBl=`${uSi}/oauth-protected-resource`,bBl=`${uSi}/oauth-authorization-server`,SBl=`${uSi}/openid-configuration`;function yso(a){if(typeof a!="object"||a===null)return!1;let i=a;return i.access_token!==void 0&&i.token_type!==void 0}function pSi(a){let i=[],e=[],t="",o=!1;for(let r=0;r<a.length;r++){let s=a[r];s==='"'?(o=!o,t+=s):s===","&&!o?(t.trim()&&e.push(t.trim()),t=""):t+=s}t.trim()&&e.push(t.trim());let n;for(let r of e)if(!r.includes("="))n&&i.push(n),n={scheme:r.trim(),params:{}};else{let l=r.indexOf(" ");if(l>0){let c=r.substring(0,l),u=r.substring(l+1);if(!c.includes("=")&&u.includes("=")){n&&i.push(n),n={scheme:c.trim(),params:{}};let p=u.indexOf("=");if(p>0){let h=u.substring(0,p).trim(),g=u.substring(p+1).trim().replace(/^"|"$/g,"");h&&g!==void 0&&(n.params[h]=g)}continue}}if(n){let c=r.indexOf("=");if(c>0){let u=r.substring(0,c).trim(),p=r.substring(c+1).trim().replace(/^"|"$/g,"");u&&p!==void 0&&(n.params[u]=p)}}}return n&&i.push(n),i}function uNt(a,i){if(a===i)return!0;if(!a||!i||a.length!==i.length)return!1;let e=[...a].sort(),t=[...i].sort();return e.every((o,n)=>o===t[n])}function mSi(a){return`onAuthenticationRequest:${a}`}async function bZ(a,i){let e=await a.get(`${i.urlProtocol}.loginAccount`);if(e)try{let t=JSON.parse(e);if(t&&Fe(t.id)&&Fe(t.accessToken)&&Fe(t.providerId))return t}catch(t){console.error(`Failed parsing current auth session value: ${t}`)}}var B3o={type:"object",additionalProperties:!1,properties:{id:{type:"string",description:d(17390,null)},label:{type:"string",description:d(17392,null)},authorizationServerGlobs:{type:"array",items:{type:"string",description:d(17388,null)},description:d(17389,null)}}},H3o=Rn.registerExtensionPoint({extensionPoint:"authentication",jsonSchema:{description:d(17395,null),type:"array",items:B3o},activationEventsGenerator:function*(a){for(let i of a)i.id&&(yield`onAuthenticationRequest:${i.id}`)}}),XYe=class extends x{constructor(e,t,o,n){super();this._extensionService=e;this._environmentService=o;this._logService=n;this._onDidRegisterAuthenticationProvider=this._register(new E);this.onDidRegisterAuthenticationProvider=this._onDidRegisterAuthenticationProvider.event;this._onDidUnregisterAuthenticationProvider=this._register(new E);this.onDidUnregisterAuthenticationProvider=this._onDidUnregisterAuthenticationProvider.event;this._onDidChangeSessions=this._register(new E);this.onDidChangeSessions=this._onDidChangeSessions.event;this._onDidChangeDeclaredProviders=this._register(new E);this.onDidChangeDeclaredProviders=this._onDidChangeDeclaredProviders.event;this._authenticationProviders=new Map;this._authenticationProviderDisposables=this._register(new Vt);this._dynamicAuthenticationProviderIds=new Set;this._delegates=[];this._disposedSource=new Ye;this._declaredProviders=[];this._register(Z(()=>this._disposedSource.dispose(!0))),this._register(t.onDidChangeExtensionSessionAccess(r=>{this._onDidChangeSessions.fire({providerId:r.providerId,label:r.accountName,event:{added:[],changed:[],removed:[]}})})),this._registerEnvContributedAuthenticationProviders(),this._registerAuthenticationExtensionPointHandler()}get declaredProviders(){return this._declaredProviders}_registerEnvContributedAuthenticationProviders(){if(this._environmentService.options?.authenticationProviders?.length)for(let e of this._environmentService.options.authenticationProviders)this.registerDeclaredAuthenticationProvider(e),this.registerAuthenticationProvider(e.id,e)}_registerAuthenticationExtensionPointHandler(){this._register(H3o.setHandler((e,{added:t,removed:o})=>{this._logService.debug(`Found authentication providers. added: ${t.length}, removed: ${o.length}`),t.forEach(r=>{for(let s of r.value){if(uc(s.id)){r.collector.error(d(17393,null));continue}if(uc(s.label)){r.collector.error(d(17394,null));continue}this.declaredProviders.some(l=>l.id===s.id)?r.collector.error(d(17391,null,s.id)):(this.registerDeclaredAuthenticationProvider(s),this._logService.debug(`Declared authentication provider: ${s.id}`))}}),o.flatMap(r=>r.value).forEach(r=>{let s=this.declaredProviders.find(l=>l.id===r.id);s&&(this.unregisterDeclaredAuthenticationProvider(s.id),this._logService.debug(`Undeclared authentication provider: ${s.id}`))})}))}registerDeclaredAuthenticationProvider(e){if(uc(e.id))throw new Error(d(17393,null));if(uc(e.label))throw new Error(d(17394,null));if(this.declaredProviders.some(t=>t.id===e.id))throw new Error(d(17391,null,e.id));this._declaredProviders.push(e),this._onDidChangeDeclaredProviders.fire()}unregisterDeclaredAuthenticationProvider(e){let t=this.declaredProviders.findIndex(o=>o.id===e);t>-1&&this.declaredProviders.splice(t,1),this._onDidChangeDeclaredProviders.fire()}isAuthenticationProviderRegistered(e){return this._authenticationProviders.has(e)}isDynamicAuthenticationProvider(e){return this._dynamicAuthenticationProviderIds.has(e)}registerAuthenticationProvider(e,t){this._authenticationProviders.set(e,t);let o=new N;o.add(t.onDidChangeSessions(n=>this._onDidChangeSessions.fire({providerId:e,label:t.label,event:n}))),jc(t)&&o.add(t),this._authenticationProviderDisposables.set(e,o),this._onDidRegisterAuthenticationProvider.fire({id:e,label:t.label})}unregisterAuthenticationProvider(e){let t=this._authenticationProviders.get(e);t&&(this._authenticationProviders.delete(e),this._dynamicAuthenticationProviderIds.delete(e),this._onDidUnregisterAuthenticationProvider.fire({id:e,label:t.label})),this._authenticationProviderDisposables.deleteAndDispose(e)}getProviderIds(){let e=[];return this._authenticationProviders.forEach(t=>{e.push(t.id)}),e}getProvider(e){if(this._authenticationProviders.has(e))return this._authenticationProviders.get(e);throw new Error(`No authentication provider '${e}' is currently registered.`)}async getAccounts(e){let t=await this.getSessions(e),o=new Array,n=new Set;for(let r of t)n.has(r.account.label)||(n.add(r.account.label),o.push(r.account));return o}async getSessions(e,t,o,n=!1){if(this._disposedSource.token.isCancellationRequested)return[];let r=this._authenticationProviders.get(e)||await this.tryActivateProvider(e,n);if(r){let s=o?.authorizationServer;if(s&&!this.matchesProvider(r,s))throw new Error(`The authentication provider '${e}' does not support the authorization server '${s.toString(!0)}'.`);if(Jde(t)){if(!r.getSessionsFromChallenges)throw new Error(`The authentication provider '${e}' does not support getting sessions from challenges.`);return await r.getSessionsFromChallenges({challenges:pSi(t.wwwAuthenticate),fallbackScopes:t.fallbackScopes},{...o})}return await r.getSessions(t?[...t]:void 0,{...o})}else throw new Error(`No authentication provider '${e}' is currently registered.`)}async createSession(e,t,o){if(this._disposedSource.token.isCancellationRequested)throw new Error("Authentication service is disposed.");let n=this._authenticationProviders.get(e)||await this.tryActivateProvider(e,!!o?.activateImmediate);if(n){if(Jde(t)){if(!n.createSessionFromChallenges)throw new Error(`The authentication provider '${e}' does not support creating sessions from challenges.`);return await n.createSessionFromChallenges({challenges:pSi(t.wwwAuthenticate),fallbackScopes:t.fallbackScopes},{...o})}return await n.createSession([...t],{...o})}else throw new Error(`No authentication provider '${e}' is currently registered.`)}async removeSession(e,t){if(this._disposedSource.token.isCancellationRequested)throw new Error("Authentication service is disposed.");let o=this._authenticationProviders.get(e);if(o)return o.removeSession(t);throw new Error(`No authentication provider '${e}' is currently registered.`)}async getOrActivateProviderIdForServer(e,t){for(let r of this._authenticationProviders.values())if(this.matchesProvider(r,e,t))return r.id;let o=e.toString(!0),n=this._declaredProviders.filter(r=>!this._authenticationProviders.has(r.id)).filter(r=>!!r.authorizationServerGlobs?.some(s=>Ed(s,o,{ignoreCase:!0})));for(let r of n){let s=await this.tryActivateProvider(r.id,!0);if(this.matchesProvider(s,e,t))return s.id}}async createDynamicAuthenticationProvider(e,t,o){let n=this._delegates[0];if(!n){this._logService.error("No authentication provider host delegate found");return}let r=await n.create(e,t,o),s=this._authenticationProviders.get(r);if(s)return this._logService.debug(`Created dynamic authentication provider: ${r}`),this._dynamicAuthenticationProviderIds.add(r),s;this._logService.error(`Failed to create dynamic authentication provider: ${r}`)}registerAuthenticationProviderHostDelegate(e){return this._delegates.push(e),this._delegates.sort((t,o)=>o.priority-t.priority),{dispose:()=>{let t=this._delegates.indexOf(e);t!==-1&&this._delegates.splice(t,1)}}}matchesProvider(e,t,o){if(o&&e.resourceServer){let n=o.toString(!0),r=e.resourceServer.toString(!0);if(!vr(r,n))return!1}if(e.authorizationServers){let n=t.toString(!0);for(let r of e.authorizationServers){let s=r.toString(!0);if(vr(s,n)||Ed(s,n,{ignoreCase:!0}))return!0}}return!1}async tryActivateProvider(e,t){await this._extensionService.activateByEvent(mSi(e),t?1:0);let o=this._authenticationProviders.get(e);if(o)return o;if(this._disposedSource.token.isCancellationRequested)throw new Error("Authentication service is disposed.");let n=new N;try{let r=await vp(Va(U.toPromise(U.filter(this.onDidRegisterAuthenticationProvider,s=>s.id===e,n),n),this._disposedSource.token),5e3);if(o=this._authenticationProviders.get(e),o)return o;throw r?new Error(`No authentication provider '${e}' is currently registered.`):new Error(`Timed out waiting for authentication provider '${e}' to register.`)}finally{n.dispose()}}};XYe=I([m(0,lt),m(1,vk),m(2,cd),m(3,se)],XYe);Ee(xs,XYe,1);var SZ=le("dynamicAuthenticationProviderStorageService");var mNt=class extends x{constructor(e,t,o,n,r,s,l){super();this._proxy=e;this.id=t;this.label=o;this.supportsMultipleAccounts=n;this.authorizationServers=r;this.resourceServer=s;this.onDidChangeSessions=l.event}async getSessions(e,t){return this._proxy.$getSessions(this.id,e,t)}createSession(e,t){return this._proxy.$createSession(this.id,e,t)}async removeSession(e){await this._proxy.$removeSession(this.id,e)}},hSi=class extends mNt{constructor(i,e,t,o,n,r,s){super(i,e,t,o,n,r,s)}getSessionsFromChallenges(i,e){return this._proxy.$getSessionsFromChallenges(this.id,i,e)}createSessionFromChallenges(i,e){return this._proxy.$createSessionFromChallenges(this.id,i,e)}},pNt=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super();this.productService=t;this.authenticationService=o;this.authenticationExtensionsService=n;this.authenticationAccessService=r;this.authenticationUsageService=s;this.dialogService=l;this.notificationService=c;this.extensionService=u;this.telemetryService=p;this.openerService=h;this.logService=g;this.urlService=f;this.dynamicAuthProviderStorageService=v;this.clipboardService=b;this.quickInputService=S;this._registrations=this._register(new Vt);this._sentProviderUsageEvents=new Set;this._suppressUnregisterEvent=!1;this._sentClientIdUsageEvents=new Set;this._proxy=e.getProxy(to.ExtHostAuthentication),this._register(this.authenticationService.onDidChangeSessions(y=>this._proxy.$onDidChangeAuthenticationSessions(y.providerId,y.label))),this._register(this.authenticationService.onDidUnregisterAuthenticationProvider(y=>{this._suppressUnregisterEvent||this._proxy.$onDidUnregisterAuthenticationProvider(y.id)})),this._register(this.authenticationExtensionsService.onDidChangeAccountPreference(y=>{let w=this.authenticationService.getProvider(y.providerId);this._proxy.$onDidChangeAuthenticationSessions(w.id,w.label,y.extensionIds)})),this._register(this.dynamicAuthProviderStorageService.onDidChangeTokens(y=>{this._proxy.$onDidChangeDynamicAuthProviderTokens(y.authProviderId,y.clientId,y.tokens)})),this._register(o.registerAuthenticationProviderHostDelegate({priority:e.extensionHostKind===2?0:1,create:async(y,w,k)=>{let T=k?`${y.toString(!0)} ${k.resource}`:y.toString(!0),P=await this.dynamicAuthProviderStorageService.getClientRegistration(T),O=P?.clientId,V=P?.clientSecret,H;return O?H=await this.dynamicAuthProviderStorageService.getSessionsForDynamicAuthProvider(T,O):w.client_id_metadata_document_supported&&(O=this.productService.authClientIdMetadataUrl),await this._proxy.$registerDynamicAuthProvider(y,w,k,O,V,H)}}))}async $registerAuthenticationProvider({id:e,label:t,supportsMultipleAccounts:o,resourceServer:n,supportedAuthorizationServers:r,supportsChallenges:s}){this.authenticationService.declaredProviders.find(p=>p.id===e)||(this.logService.warn(`Authentication provider ${e} was not declared in the Extension Manifest.`),this.telemetryService.publicLog2("authentication.providerNotDeclared",{id:e}));let l=new E;this._registrations.set(e,l);let c=(r??[]).map(p=>A.revive(p)),u=s?new hSi(this._proxy,e,t,o,c,n?A.revive(n):void 0,l):new mNt(this._proxy,e,t,o,c,n?A.revive(n):void 0,l);this.authenticationService.registerAuthenticationProvider(e,u)}async $unregisterAuthenticationProvider(e){this._registrations.deleteAndDispose(e),this._suppressUnregisterEvent=!0;try{this.authenticationService.unregisterAuthenticationProvider(e)}finally{this._suppressUnregisterEvent=!1}}async $ensureProvider(e){if(!this.authenticationService.isAuthenticationProviderRegistered(e))return await this.extensionService.activateByEvent(mSi(e),1)}async $sendDidChangeSessions(e,t){let o=this._registrations.get(e);o instanceof E&&o.fire(t)}$removeSession(e,t){return this.authenticationService.removeSession(e,t)}async $waitForUriHandler(e){let t=new Ko,o=this.urlService.registerHandler({handleURL:async r=>r.scheme!==e.scheme||r.authority!==e.authority||r.path!==e.path?!1:(t.complete(r),o.dispose(),!0)});if(!await vp(t.p,300*1e3))throw new Error("Timed out waiting for URI handler");return await t.p}$showContinueNotification(e){let t=d(3293,null),o=d(3292,null),n=new Ko,r=!1,l=this.notificationService.prompt(bt.Warning,e,[{label:t,run:()=>r=!0},{label:o,run:()=>r=!1}]).onDidClose(()=>{n.complete(r),l.dispose()});return n.p}async $registerDynamicAuthenticationProvider(e){await this.$registerAuthenticationProvider({id:e.id,label:e.label,supportsMultipleAccounts:!0,supportedAuthorizationServers:[e.authorizationServer],resourceServer:e.resourceServer}),await this.dynamicAuthProviderStorageService.storeClientRegistration(e.id,A.revive(e.authorizationServer).toString(!0),e.clientId,e.clientSecret,e.label)}async $setSessionsForDynamicAuthProvider(e,t,o){await this.dynamicAuthProviderStorageService.setSessionsForDynamicAuthProvider(e,t,o)}async $sendDidChangeDynamicProviderInfo({providerId:e,clientId:t,authorizationServer:o,label:n,clientSecret:r}){this.logService.info(`Client ID for authentication provider ${e} changed to ${t}`);let s=this.dynamicAuthProviderStorageService.getInteractedProviders().find(l=>l.providerId===e);if(!s)throw new Error(`Dynamic authentication provider ${e} not found. Has it been registered?`);await this.dynamicAuthProviderStorageService.storeClientRegistration(e||s.providerId,o?A.revive(o).toString(!0):s.authorizationServer,t||s.clientId,r,n||s.label)}async loginPrompt(e,t,o,n){let r,s=e.confirmation?.(t,o);s?r=s:r=o?d(3278,null,t,e.label):d(3277,null,t,e.label);let l=[{label:d(3270,null),run(){return!0}}];n?.learnMore&&l.push({label:d(3290,null),run:async()=>{let u=this.loginPrompt(e,t,o,n);return await this.openerService.open(A.revive(n.learnMore),{allowCommands:!0}),await u}});let{result:c}=await this.dialogService.prompt({type:bt.Info,message:r,buttons:l,detail:n?.detail,cancelButton:!0});return c??!1}async continueWithIncorrectAccountPrompt(e,t){let o=await this.dialogService.prompt({message:d(3287,null),detail:d(3288,null,e,t),type:bt.Warning,cancelButton:!0,buttons:[{label:d(3289,null,e),run:()=>e},{label:d(3291,null,t),run:()=>t}]});if(!o.result)throw new go;return o.result===e}async doGetSession(e,t,o,n,r){let s=A.revive(r.authorizationServer),l=await this.authenticationService.getSessions(e,t,{account:r.account,authorizationServer:s},!0),c=this.authenticationService.getProvider(e);if(r.forceNewSession&&r.createIfNone)throw new Error("Invalid combination of options. Please remove one of the following: forceNewSession, createIfNone");if(r.forceNewSession&&r.silent)throw new Error("Invalid combination of options. Please remove one of the following: forceNewSession, silent");if(r.createIfNone&&r.silent)throw new Error("Invalid combination of options. Please remove one of the following: createIfNone, silent");r.clearSessionPreference&&this.authenticationExtensionsService.removeAccountPreference(o,e);let u=r.account?l[0]:this._getAccountPreference(o,e,l);if(!r.forceNewSession&&l.length){if(u&&this.authenticationAccessService.isAccessAllowed(e,u.account.label,o))return u;if(!c.supportsMultipleAccounts&&this.authenticationAccessService.isAccessAllowed(e,l[0].account.label,o))return l[0]}if(r.createIfNone||r.forceNewSession){let p;typeof r.forceNewSession=="object"?p=r.forceNewSession:typeof r.createIfNone=="object"&&(p=r.createIfNone);let h=!!(r.forceNewSession&&l.length);if(!await this.loginPrompt(c,n,h,p))throw new Error("User did not consent to login.");let f;if(l?.length&&!r.forceNewSession)f=c.supportsMultipleAccounts&&!r.account?await this.authenticationExtensionsService.selectSession(e,o,n,t,l):l[0];else{let v=r.account??u?.account;do f=await this.authenticationService.createSession(e,t,{activateImmediate:!0,account:v,authorizationServer:s});while(v&&v.label!==f.account.label&&!await this.continueWithIncorrectAccountPrompt(f.account.label,v.label))}return this.authenticationAccessService.updateAllowedExtensions(e,f.account.label,[{id:o,name:n,allowed:!0}]),this.authenticationExtensionsService.updateNewSessionRequests(e,[f]),this.authenticationExtensionsService.updateAccountPreference(o,e,f.account),f}if(!u){let p=l.filter(h=>this.authenticationAccessService.isAccessAllowed(e,h.account.label,o));if(p.length===1)return p[0]}r.silent||(l.length?this.authenticationExtensionsService.requestSessionAccess(e,o,n,t,l):await this.authenticationExtensionsService.requestNewSession(e,t,o,n))}async $getSession(e,t,o,n,r){let s=Jde(t)?t.fallbackScopes:t;s&&this.sendClientIdUsageTelemetry(o,e,s);let l=await this.doGetSession(e,t,o,n,r);return l&&(this.sendProviderUsageTelemetry(o,e),this.authenticationUsageService.addAccountUsage(e,l.account.label,l.scopes,o,n)),l}async $getAccounts(e){return await this.authenticationService.getAccounts(e)}sendClientIdUsageTelemetry(e,t,o){let n=o.some(s=>s.startsWith("VSCODE_CLIENT_ID:")),r=`${e}|${t}|${n}`;this._sentClientIdUsageEvents.has(r)||(this._sentClientIdUsageEvents.add(r),n&&this.telemetryService.publicLog2("authentication.clientIdUsage",{extensionId:e}))}sendProviderUsageTelemetry(e,t){let o=`${e}|${t}`;this._sentProviderUsageEvents.has(o)||(this._sentProviderUsageEvents.add(o),this.telemetryService.publicLog2("authentication.providerUsage",{providerId:t,extensionId:e}))}_getAccountPreference(e,t,o){if(o.length===0)return;let n=this.authenticationExtensionsService.getAccountPreference(e,t);if(n)return o.find(s=>s.account.label===n)}async $showDeviceCodeModal(e,t){let{result:o}=await this.dialogService.prompt({type:bt.Info,message:d(3285,null),detail:d(3284,null,e,t),buttons:[{label:d(3279,null),run:()=>!0}],cancelButton:!0});if(o)try{return await this.clipboardService.writeText(e),await this.openerService.open(A.parse(t))}catch{this.notificationService.error(d(3286,null,t))}return!1}async $promptForClientRegistration(e){let t=`http://127.0.0.1:33418
https://vscode.dev/redirect`;if(!await this.dialogService.prompt({type:bt.Info,message:d(3282,null),detail:d(3283,null,e,t),buttons:[{label:d(3280,null),run:async()=>{try{await this.clipboardService.writeText(t)}catch{this.notificationService.error(d(3281,null))}return!0}}],cancelButton:{label:d(3271,null),run:()=>!1}}))return;let n=d(3269,null),r=await this.quickInputService.input({title:n,prompt:d(3273,null),placeHolder:d(3272,null),ignoreFocusLost:!0,validateInput:async l=>{if(!l||l.trim().length===0)return d(3274,null)}});if(!r||r.trim().length===0)return;let s=await this.quickInputService.input({title:n,prompt:d(3276,null,r),placeHolder:d(3275,null),password:!0,ignoreFocusLost:!0});return{clientId:r.trim(),clientSecret:s?.trim()||void 0}}};pNt=I([fo(qi.MainThreadAuthentication),m(1,tt),m(2,xs),m(3,jX),m(4,vk),m(5,DA),m(6,at),m(7,Ne),m(8,lt),m(9,Te),m(10,Je),m(11,se),m(12,_b),m(13,SZ),m(14,Fi),m(15,Ue)],pNt);var hNt="timeline",U3o="timeline",I2=le(U3o);var gNt=class{constructor(i,e,t){this.logService=e;this._timelineService=t;this._providerEmitters=new Map;this._proxy=i.getProxy(to.ExtHostTimeline)}$registerTimelineProvider(i){this.logService.trace(`MainThreadTimeline#registerTimelineProvider: id=${i.id}`);let e=this._proxy,t=this._providerEmitters,o=t.get(i.id);o===void 0&&(o=new E,t.set(i.id,o)),this._timelineService.registerTimelineProvider({...i,onDidChange:o.event,async provideTimeline(n,r,s){return $n(await e.$getTimeline(i.id,n,r,s))},dispose(){t.delete(i.id),o?.dispose()}})}$unregisterTimelineProvider(i){this.logService.trace(`MainThreadTimeline#unregisterTimelineProvider: id=${i}`),this._timelineService.unregisterTimelineProvider(i)}$emitTimelineChangeEvent(i){this.logService.trace(`MainThreadTimeline#emitChangeEvent: id=${i.id}, uri=${i.uri?.toString(!0)}`),this._providerEmitters.get(i.id)?.fire(i)}dispose(){}};gNt=I([fo(qi.MainThreadTimeline),m(1,se),m(2,I2)],gNt);var wso=0,fNt=class{constructor(i,e,t,o){this.result=i;this.fromTaskId=e;this.uriIdentityService=t;this.accessor=o;this.fileCoverage=new gt;this.didAddCoverage=wc(this);this.tree=new SA;this.associatedData=new Map}*allPerTestIDs(){let i=new Set;for(let e of this.tree.nodes)if(e.value&&e.value.perTestData)for(let t of e.value.perTestData)i.has(t)||(i.add(t),yield t)}append(i,e){let t=this.getComputedForUri(i.uri),o=this.result,n=(l,c)=>{c[l]?(c[l].covered+=(i[l]?.covered||0)-(t?.[l]?.covered||0),c[l].total+=(i[l]?.total||0)-(t?.[l]?.total||0)):i[l]&&(c[l]={...i[l]})},r=[...this.treePathForUri(i.uri,!0)],s=[];this.tree.mutatePath(this.treePathForUri(i.uri,!1),l=>{if(s.push(l),s.length===r.length)if(l.value){let c=l.value;c.id=i.id,c.statement=i.statement,c.branch=i.branch,c.declaration=i.declaration}else{let c=l.value=new s3(i,o,this.accessor);this.fileCoverage.set(i.uri,c)}else if(l.value)n("statement",l.value),n("branch",l.value),n("declaration",l.value),l.value.didChange.trigger(e);else{let c=Ji(i);c.id=String(wso++),c.uri=this.treePathToUri(r.slice(0,s.length)),l.value=new bNt(c,o)}if(i.testIds){l.value.perTestData??=new Set;for(let c of i.testIds)l.value.perTestData.add(c)}}),s&&this.didAddCoverage.trigger(e,s)}filterTreeForTest(i){let e=new SA;for(let t of this.tree.values())if(t instanceof s3){if(!t.perTestData?.has(i.toString()))continue;let o=[...this.treePathForUri(t.uri,!0)],n=[];e.mutatePath(this.treePathForUri(t.uri,!1),r=>{n.push(r),r.value??=new JYe(this.treePathToUri(o.slice(0,n.length)),t.fromResult)})}return e}getAllFiles(){return this.fileCoverage}getUri(i){return this.fileCoverage.get(i)}getComputedForUri(i){return this.tree.find(this.treePathForUri(i,!1))}*treePathForUri(i,e){yield i.scheme,yield i.authority,yield*(!e&&this.uriIdentityService.extUri.ignorePathCasing(i)?i.path.toLowerCase():i.path).split("/")}treePathToUri(i){return A.from({scheme:i[0],authority:i[1],path:i.slice(2).join("/")})}},IZ=(a,i,e)=>{let t=a.covered,o=a.total;return i&&(t+=i.covered,o+=i.total),e&&(t+=e.covered,o+=e.total),o===0?1:t/o},vNt=class{constructor(i,e){this.fromResult=e;this.didChange=wc(this);this.id=i.id,this.uri=i.uri,this.statement=i.statement,this.branch=i.branch,this.declaration=i.declaration}get tpc(){return IZ(this.statement,this.branch,this.declaration)}},bNt=class extends vNt{},JYe=class extends bNt{constructor(i,e){super({id:String(wso++),uri:i,statement:{covered:0,total:0}},e)}},s3=class extends vNt{constructor(e,t,o){super(e,t);this.accessor=o}get hasSynchronousDetails(){return this._details instanceof Array||this.resolved}async detailsForTest(e,t=Se.None){this._detailsForTest??=new Map;let o=e.toString(),n=this._detailsForTest.get(o);if(n)return n;let r=(async()=>{try{return await this.accessor.getCoverageDetails(this.id,o,t)}catch(s){throw this._detailsForTest?.delete(o),s}})();return this._detailsForTest.set(o,r),r}async details(e=Se.None){this._details??=this.accessor.getCoverageDetails(this.id,void 0,e);try{let t=await this._details;return this.resolved=!0,t}catch(t){throw this._details=void 0,t}}};var z3o={deserialize:a=>JSON.parse(a),serialize:a=>JSON.stringify(a)},_S=class extends x{constructor(e,t){super();this.storage=t;this.key=e.key,this.scope=e.scope,this.target=e.target,this.serialization=e.serialization??z3o,this.onDidChange=this.storage.onDidChangeValue(this.scope,this.key,this._store)}get(e){if(this.value===void 0){let t=this.storage.get(this.key,this.scope);this.value=t===void 0?e:this.serialization.deserialize(t)}return this.value}store(e){this.value=e,this.storage.store(this.key,this.serialization.serialize(e),this.scope,this.target)}delete(){this.storage.remove(this.key,this.scope)}};_S=I([m(1,ce)],_S);var K3o={6:d(16052,null),4:d(16053,null),3:d(16054,null),1:d(16055,null),2:d(16056,null),5:d(16057,null),0:d(16058,null)},SNt=(a,i)=>d(16051,null,Nu(a),K3o[i]),INt={4:d(16049,null),2:d(16050,null),8:d(16048,null)};var oo;(et=>(et.providerCount=new Y("testing.providerCount",0),et.canRefreshTests=new Y("testing.canRefresh",!1,{type:"boolean",description:d(16074,null)}),et.isRefreshingTests=new Y("testing.isRefreshing",!1,{type:"boolean",description:d(16090,null)}),et.isContinuousModeOn=new Y("testing.isContinuousModeOn",!1,{type:"boolean",description:d(16087,null)}),et.hasDebuggableTests=new Y("testing.hasDebuggableTests",!1,{type:"boolean",description:d(16081,null)}),et.hasRunnableTests=new Y("testing.hasRunnableTests",!1,{type:"boolean",description:d(16085,null)}),et.hasCoverableTests=new Y("testing.hasCoverableTests",!1,{type:"boolean",description:d(16079,null)}),et.hasNonDefaultProfile=new Y("testing.hasNonDefaultProfile",!1,{type:"boolean",description:d(16083,null)}),et.hasConfigurableProfile=new Y("testing.hasConfigurableProfile",!1,{type:"boolean",description:d(16078,null)}),et.supportsContinuousRun=new Y("testing.supportsContinuousRun",!1,{type:"boolean",description:d(16095,null)}),et.isParentRunningContinuously=new Y("testing.isParentRunningContinuously",!1,{type:"boolean",description:d(16089,null)}),et.activeEditorHasTests=new Y("testing.activeEditorHasTests",!1,{type:"boolean",description:d(16071,null)}),et.cursorInsideTestRange=new Y("testing.cursorInsideTestRange",!1,{type:"boolean",description:d(16077,null)}),et.isTestCoverageOpen=new Y("testing.isTestCoverageOpen",!1,{type:"boolean",description:d(16091,null)}),et.hasCoverageInFile=new Y("testing.hasCoverageInFile",!1,{type:"boolean",description:d(16080,null)}),et.hasPerTestCoverage=new Y("testing.hasPerTestCoverage",!1,{type:"boolean",description:d(16084,null)}),et.hasInlineCoverageDetails=new Y("testing.hasInlineCoverageDetails",!1,{type:"boolean",description:d(16082,null)}),et.isCoverageFilteredToTest=new Y("testing.isCoverageFilteredToTest",!1,{type:"boolean",description:d(16088,null)}),et.coverageToolbarEnabled=new Y("testing.coverageToolbarEnabled",!0,{type:"boolean",description:d(16076,null)}),et.inlineCoverageEnabled=new Y("testing.inlineCoverageEnabled",!1,{type:"boolean",description:d(16086,null)}),et.canGoToRelatedCode=new Y("testing.canGoToRelatedCode",!1,{type:"boolean",description:d(16072,null)}),et.canGoToRelatedTest=new Y("testing.canGoToRelatedTest",!1,{type:"boolean",description:d(16073,null)}),et.peekHasStack=new Y("testing.peekHasStack",!1,{type:"boolean",description:d(16092,null)}),et.capabilityToContextKey={2:et.hasRunnableTests,8:et.hasCoverableTests,4:et.hasDebuggableTests,16:et.hasNonDefaultProfile,32:et.hasConfigurableProfile,64:et.supportsContinuousRun},et.hasAnyResults=new Y("testing.hasAnyResults",!1),et.viewMode=new Y("testing.explorerViewMode","list"),et.viewSorting=new Y("testing.explorerViewSorting","location"),et.isRunning=new Y("testing.isRunning",!1),et.isInPeek=new Y("testing.isInPeek",!1),et.isPeekVisible=new Y("testing.isPeekVisible",!1),et.peekItemType=new Y("peekItemType",void 0,{type:"string",description:d(16093,null)}),et.controllerId=new Y("controllerId",void 0,{type:"string",description:d(16075,null)}),et.testItemExtId=new Y("testId",void 0,{type:"string",description:d(16096,null)}),et.testItemHasUri=new Y("testing.testItemHasUri",!1,{type:"boolean",description:d(16097,null)}),et.testItemIsHidden=new Y("testing.testItemIsHidden",!1,{type:"boolean",description:d(16098,null)}),et.testMessageContext=new Y("testMessage",void 0,{type:"string",description:d(16099,null)}),et.testResultOutdated=new Y("testResultOutdated",void 0,{type:"boolean",description:d(16100,null)}),et.testResultState=new Y("testResultState",void 0,{type:"string",description:d(16101,null)}),et.testProfileContextGroup=new Y("testing.profile.context.group",void 0,{type:"string",description:d(16094,null)})))(oo||={});var uu=le("testProfileService"),tM=(a,i)=>a.controllerId===i.controllerId&&(Ur.isRoot(i.item.extId)||!a.tag||i.item.tags.includes(a.tag)),gSi=(a,i)=>a.isDefault!==i.isDefault?a.isDefault?-1:1:a.label.localeCompare(i.label),yNt=a=>[[oo.hasRunnableTests.key,(a&2)!==0],[oo.hasDebuggableTests.key,(a&4)!==0],[oo.hasCoverableTests.key,(a&8)!==0]],wDe=class extends x{constructor(e,t){super();this.changeEmitter=this._register(new E);this.controllerProfiles=new Map;this.onDidChange=this.changeEmitter.event;t.remove("testingPreferredProfiles",1),this.userDefaults=this._register(new _S({key:"testingPreferredProfiles2",scope:1,target:1},t)),this.capabilitiesContexts={2:oo.hasRunnableTests.bindTo(e),4:oo.hasDebuggableTests.bindTo(e),8:oo.hasCoverableTests.bindTo(e),16:oo.hasNonDefaultProfile.bindTo(e),32:oo.hasConfigurableProfile.bindTo(e),64:oo.supportsContinuousRun.bindTo(e)},this.refreshContextKeys()}addProfile(e,t){let o=this.userDefaults.get()?.[e.id]?.[t.profileId],n={...t,isDefault:o??t.isDefault,wasInitiallyDefault:t.isDefault},r=this.controllerProfiles.get(t.controllerId);r?(r.profiles.push(n),r.profiles.sort(gSi)):(r={profiles:[n],controller:e},this.controllerProfiles.set(t.controllerId,r)),this.refreshContextKeys(),this.changeEmitter.fire()}updateProfile(e,t,o){let n=this.controllerProfiles.get(e);if(!n)return;let r=n.profiles.find(s=>s.controllerId===e&&s.profileId===t);if(r){if(Object.assign(r,o),n.profiles.sort(gSi),o.isDefault!==void 0){let s=Ji(this.userDefaults.get({}));fSi(s,r,o.isDefault),this.userDefaults.store(s)}this.changeEmitter.fire()}}configure(e,t){this.controllerProfiles.get(e)?.controller.configureRunProfile(t)}removeProfile(e,t){let o=this.controllerProfiles.get(e);if(!o)return;if(!t){this.controllerProfiles.delete(e),this.changeEmitter.fire();return}let n=o.profiles.findIndex(r=>r.profileId===t);n!==-1&&(o.profiles.splice(n,1),this.refreshContextKeys(),this.changeEmitter.fire())}capabilitiesForTest(e){let t=this.controllerProfiles.get(Ur.root(e.extId));if(!t)return 0;let o=0;for(let n of t.profiles)(!n.tag||e.tags.includes(n.tag))&&(o|=o&n.group?16:n.group);return o}all(){return this.controllerProfiles.values()}getControllerProfiles(e){return this.controllerProfiles.get(e)?.profiles??[]}getGroupDefaultProfiles(e,t){let o=t?this.controllerProfiles.get(t)?.profiles||[]:[...vt.flatMap(this.controllerProfiles.values(),r=>r.profiles)],n=o.filter(r=>r.group===e&&r.isDefault);if(n.length===0){let r=o.find(s=>s.group===e);r&&n.push(r)}return n}setGroupDefaultProfiles(e,t){let o={};for(let n of this.controllerProfiles.values()){o[n.controller.id]={};for(let r of n.profiles)r.group===e&&fSi(o,r,t.some(s=>s.profileId===r.profileId));for(let r of n.profiles){if(r.group===e)continue;let s=n.profiles.find(l=>l.group===e&&l.label===r.label);s&&fSi(o,r,s.isDefault)}n.profiles.sort(gSi)}this.userDefaults.store(o),this.changeEmitter.fire()}getDefaultProfileForTest(e,t){return this.getControllerProfiles(t.controllerId).find(o=>(o.group&e)!==0&&tM(o,t))}refreshContextKeys(){let e=0;for(let{profiles:t}of this.controllerProfiles.values())for(let o of t)e|=e&o.group?16:o.group,e|=o.supportsContinuousRun?64:0;for(let t of Roo)this.capabilitiesContexts[t].set((e&t)!==0)}};wDe=I([m(0,X),m(1,ce)],wDe);var fSi=(a,i,e)=>{i.isDefault=e,a[i.controllerId]??={},i.isDefault!==i.wasInitiallyDefault?a[i.controllerId][i.profileId]=i.isDefault:delete a[i.controllerId][i.profileId]};var LA={2:6,6:5,4:4,1:3,3:2,0:0,5:1},Dk=a=>a===6||a===4,kso=a=>a===6||a===4||a===3,JUl=HIe(LA,(a,i)=>({statusNode:!0,state:Number(i),priority:a})),ZYe=(a,i)=>LA[i]-LA[a],CDe=(...a)=>{switch(a.length){case 0:return 0;case 1:return a[0];case 2:return LA[a[0]]>LA[a[1]]?a[0]:a[1];default:{let i=a[0];for(let e=1;e<a.length;e++)LA[i]<LA[a[e]]&&(i=a[e]);return i}}},eXe=Object.keys(LA).map(a=>Number(a)).sort(ZYe),vSi={3:0,5:1,4:2,6:3},tXe=()=>new Uint32Array(eXe.length);var G3o=a=>"getOwnDuration"in a,bSi=(a,i,e=!1)=>{let t=a.getCurrentComputedState(i);if(t===void 0||e){t=a.getOwnState(i)??0;let o=0,n=tXe();for(let r of a.getChildren(i)){let s=bSi(a,r);o++,n[s]++,t=s===5&&t===0?5:CDe(t,s)}o>q3o&&Tso.set(i,n),a.setComputedState(i,t)}return t},Eso=(a,i,e=!1)=>{let t=a.getCurrentComputedDuration(i);if(t===void 0||e){let o=a.getOwnDuration(i);if(o!==void 0)t=o;else{t=void 0;for(let n of a.getChildren(i)){let r=Eso(a,n);r!==void 0&&(t=(t||0)+r)}}a.setComputedDuration(i,t)}return t},q3o=64,Tso=new WeakMap,hpe=(a,i,e,t=!0)=>{let o=a.getCurrentComputedState(i),n=LA[o],r=e??bSi(a,i,!0),s=LA[r],l=new Set;if(s!==n){a.setComputedState(i,r),l.add(i);let c=o,u=r;for(let p of a.getParents(i)){let h=Tso.get(p);h&&(h[c]--,h[u]++);let g=a.getCurrentComputedState(p);if(s>n){if(g!==void 0&&LA[g]>=s||h&&h[u]>1)break;a.setComputedState(p,r),l.add(p)}else{if(g===void 0||LA[g]>n||h&&h[c]>0)break;u=bSi(a,p,!0),a.setComputedState(p,u),l.add(p)}c=g}}if(G3o(a)&&t)for(let c of vt.concat(vt.single(i),a.getParents(i))){let u=a.getCurrentComputedDuration(c),p=Eso(a,c,!0);if(u===p)break;a.setComputedDuration(c,p),l.add(c)}return l};var $3o={buffers:[],length:0,onDidWriteData:U.None,endPromise:Promise.resolve(),getRange:()=>qe.alloc(0),getRangeIter:()=>[]},SSi=class{constructor(){this.writeDataEmitter=new E;this.endDeferred=new Ko;this.offset=0;this.onDidWriteData=this.writeDataEmitter.event;this.endPromise=this.endDeferred.p;this.buffers=[]}get length(){return this.offset}getRange(i,e){let t=qe.alloc(e),o=0;for(let n of this.getRangeIter(i,e))t.buffer.set(n.buffer,o),o+=n.byteLength;return o<e?t.slice(0,o):t}*getRangeIter(i,e){let t=0,o=0;for(let n of this.buffers){if(o+n.byteLength<=i){o+=n.byteLength;continue}let r=Math.max(0,i-o),s=Math.min(n.byteLength,r+e-t);if(yield n.slice(r,s),t+=s-r,o+=n.byteLength,t===e)break}}append(i,e){let t=this.offset,o=i.byteLength;if(e===void 0)return this.push(i),{offset:t,length:o};let n;(p=>(p[p.CR=13]="CR",p[p.LF=10]="LF"))(n||={});let r=qe.fromString(_so(e,!0)),s=qe.fromString(_so(e,!1));o+=r.byteLength+s.byteLength,this.push(r);let l=i.byteLength;for(;l>0;l--){let c=i.buffer[l-1];if(c!==13&&c!==10)break}return this.push(i.slice(0,l)),this.push(s),this.push(i.slice(l)),{offset:t,length:o}}push(i){i.byteLength!==0&&(this.buffers.push(i),this.writeDataEmitter.fire(i),this.offset+=i.byteLength)}end(){this.endDeferred.complete()}},Dso=function*(a,i){for(let e of Ur.fromString(i.item.extId).idsToRoot())yield a.getStateById(e.toString())},Lso=a=>{for(let i of eXe)if(a[i]>0)return i;return 0},_so=(a,i)=>`\x1B]633;SetMark;Id=${x7e(a,i)};Hidden\x07`,j3o=(a,i,e)=>({controllerId:a,expand:0,item:{...i},children:[],tasks:[],ownComputedState:0,computedState:0});var Dh=class extends x{constructor(e,t,o,n,r){super();this.id=e;this.persist=t;this.request=o;this.insertOrder=n;this.telemetry=r;this.completeEmitter=this._register(new E);this.newTaskEmitter=this._register(new E);this.endTaskEmitter=this._register(new E);this.changeEmitter=this._register(new E);this.testById=new Map;this.testMarkerCounter=0;this.startedAt=Date.now();this.onChange=this.changeEmitter.event;this.onComplete=this.completeEmitter.event;this.onNewTask=this.newTaskEmitter.event;this.onEndTask=this.endTaskEmitter.event;this.tasks=[];this.name=d(16107,null,new Date().toLocaleString(wr));this.counts=tXe();this.computedStateAccessor={getOwnState:e=>e.ownComputedState,getCurrentComputedState:e=>e.computedState,setComputedState:(e,t)=>e.computedState=t,getChildren:e=>e.children,getParents:e=>{let{testById:t}=this;return(function*(){let o=Ur.fromString(e.item.extId).parentId;if(o)for(let n of o.idsToRoot())yield t.get(n.toString())})()}};this.doSerialize=new co(()=>({id:this.id,completedAt:this.completedAt,tasks:this.tasks.map(e=>({id:e.id,name:e.name,ctrlId:e.ctrlId,hasCoverage:!!e.coverage.get()})),name:this.name,request:this.request,items:[...this.testById.values()].map(k7e.serializeWithoutMessages)}));this.doSerializeWithMessages=new co(()=>({id:this.id,completedAt:this.completedAt,tasks:this.tasks.map(e=>({id:e.id,name:e.name,ctrlId:e.ctrlId,hasCoverage:!!e.coverage.get()})),name:this.name,request:this.request,items:[...this.testById.values()].map(k7e.serialize)}))}get completedAt(){return this._completedAt}get tests(){return this.testById.values()}getTestById(e){return this.testById.get(e)?.item}getStateById(e){return this.testById.get(e)}appendOutput(e,t,o,n){let r=e.byteLength>100?e.slice(0,100).toString()+"\u2026":e.toString(),s;(n||o)&&(s=this.testMarkerCounter++);let l=this.mustGetTaskIndex(t),c=this.tasks[l],{offset:u,length:p}=c.output.append(e,s),h={location:o,message:r,offset:u,length:p,marker:s,type:1},g=n&&this.testById.get(n);g?(g.tasks[l].messages.push(h),this.changeEmitter.fire({item:g,result:this,reason:2,message:h})):c.otherMessages.push(h)}addTask(e){this.tasks.push({...e,coverage:Me(this,void 0),otherMessages:[],output:new SSi});for(let t of this.tests)t.tasks.push({duration:void 0,messages:[],state:0});this.newTaskEmitter.fire(this.tasks.length-1)}addTestChainToRun(e,t){let o=this.testById.get(t[0].extId);o||(o=this.addTestToRun(e,t[0],null));for(let n=1;n<t.length;n++)o=this.addTestToRun(e,t[n],o.item.extId)}updateState(e,t,o,n){let r=this.testById.get(e);if(!r)return;let s=this.mustGetTaskIndex(t),l=vSi[r.tasks[s].state],c=vSi[o];l!==void 0&&(c===void 0||c<l)||this.fireUpdateAndRefresh(r,s,o,n)}appendMessage(e,t,o){let n=this.testById.get(e);n&&(n.tasks[this.mustGetTaskIndex(t)].messages.push(o),this.changeEmitter.fire({item:n,result:this,reason:2,message:o}))}markTaskComplete(e){let t=this.mustGetTaskIndex(e),o=this.tasks[t];o.running=!1,o.output.end(),this.setAllToState(5,e,n=>n.state===1||n.state===2),this.endTaskEmitter.fire(t)}markComplete(){if(this._completedAt!==void 0)throw new Error("cannot complete a test result multiple times");for(let e of this.tasks)e.running&&this.markTaskComplete(e.id);this._completedAt=Date.now(),this.completeEmitter.fire(),this.telemetry.publicLog2("test.outcomes",{failures:this.counts[6]+this.counts[4],passes:this.counts[3],controller:this.request.targets.map(e=>e.controllerId).join(",")})}markRetired(e){for(let[t,o]of this.testById)!o.retired&&(!e||e.hasKeyOrParent(Ur.fromString(t).path))&&(o.retired=!0,this.changeEmitter.fire({reason:0,item:o,result:this}))}toJSON(){return this.completedAt&&this.persist?this.doSerialize.value:void 0}toJSONWithMessages(){return this.completedAt&&this.persist?this.doSerializeWithMessages.value:void 0}setAllToState(e,t,o){let n=this.mustGetTaskIndex(t);for(let r of this.testById.values())o(r.tasks[n],r)&&this.fireUpdateAndRefresh(r,n,e)}fireUpdateAndRefresh(e,t,o,n){let r=e.ownComputedState,s=e.ownDuration,l={item:e,result:this,reason:1,previousState:r,previousOwnDuration:s};e.tasks[t].state=o,n!==void 0&&(e.tasks[t].duration=n,e.ownDuration=Math.max(e.ownDuration||0,n));let c=CDe(...e.tasks.map(u=>u.state));if(c===r){n!==s&&this.changeEmitter.fire(l);return}e.ownComputedState=c,this.counts[r]--,this.counts[c]++,hpe(this.computedStateAccessor,e).forEach(u=>this.changeEmitter.fire(u===e?l:{item:u,result:this,reason:0}))}addTestToRun(e,t,o){let n=j3o(e,t,o);if(this.testById.set(t.extId,n),this.counts[0]++,o&&this.testById.get(o)?.children.push(n),this.tasks.length)for(let r=0;r<this.tasks.length;r++)n.tasks.push({duration:void 0,messages:[],state:0});return n}mustGetTaskIndex(e){let t=this.tasks.findIndex(o=>o.id===e);if(t===-1)throw new Error(`Unknown task ${e} in updateState`);return t}};Dh=I([m(4,Te)],Dh);var wNt=class{constructor(i,e,t=!0){this.serialized=e;this.persist=t;this.counts=tXe();this.testById=new Map;this.id=e.id,this.completedAt=e.completedAt,this.tasks=e.tasks.map((o,n)=>({id:o.id,name:o.name||d(16108,null),ctrlId:o.ctrlId,running:!1,coverage:Me(this,void 0),output:$3o,otherMessages:[]})),this.name=e.name,this.request=e.request;for(let o of e.items){let n=k7e.deserialize(i,o);this.counts[n.ownComputedState]++,this.testById.set(o.item.extId,n)}}get tests(){return this.testById.values()}getStateById(i){return this.testById.get(i)}toJSON(){return this.persist?this.serialized:void 0}toJSONWithMessages(){return this.toJSON()}};var ISi=128,Q3o=16,Y3o=1024*128,X3o=.2,xNt=le("ITestResultStorage"),CNt=1,iXe=class extends x{constructor(e,t,o){super();this.uriIdentityService=e;this.logService=o;this.stored=this._register(new _S({key:"storedTestResults",scope:1,target:1},t))}async read(){let e=await Promise.all(this.stored.get([]).map(async o=>{if(o.rev===CNt)try{let n=await this.readForResultId(o.id);return n?{rec:o,result:new wNt(this.uriIdentityService,n)}:void 0}catch(n){this.logService.warn(`Error deserializing stored test result ${o.id}`,n);return}})),t=e.filter(lo);return t.length!==e.length&&this.stored.store(t.map(({rec:o})=>o)),t.map(({result:o})=>o)}getResultOutputWriter(e){let t=IIe();return this.storeOutputForResultId(e,t),t}async persist(e){let t=new Map(this.stored.get([]).map(({id:s,bytes:l})=>[s,l])),o=[],n=[],r=Y3o;for(let s=0;s<e.length&&s<ISi&&(r>0||o.length<Q3o);s++){let l=e[s],c=t.get(l.id);if(c!==void 0){t.delete(l.id),o.push({id:l.id,rev:CNt,bytes:c}),r-=c;continue}let u=l.toJSON();if(!u)continue;let p=qe.fromString(JSON.stringify(u));n.push(this.storeForResultId(l.id,u)),o.push({id:l.id,rev:CNt,bytes:p.byteLength}),r-=p.byteLength}for(let s of t.keys())n.push(this.deleteForResultId(s).catch(()=>{}));this.stored.store(o),await Promise.all(n)}};iXe=I([m(0,ht),m(1,ce),m(2,se)],iXe);var xDe=class extends iXe{constructor(e,t,o,n,r,s){super(e,t,o);this.fileService=r;this.directory=A.joinPath(s.workspaceStorageHome,n.getWorkspace().id,"testResults")}async readForResultId(e){let t=await this.fileService.readFile(this.getResultJsonPath(e));return JSON.parse(t.value.toString())}storeForResultId(e,t){return this.fileService.writeFile(this.getResultJsonPath(e),qe.fromString(JSON.stringify(t)))}deleteForResultId(e){return this.fileService.del(this.getResultJsonPath(e)).catch(()=>{})}async readOutputRangeForResultId(e,t,o){try{let{value:n}=await this.fileService.readFile(this.getResultOutputPath(e),{position:t,length:o});return n}catch{return qe.alloc(0)}}async readOutputForResultId(e){try{let{value:t}=await this.fileService.readFileStream(this.getResultOutputPath(e));return t}catch{return v_(qe.alloc(0))}}async storeOutputForResultId(e,t){await this.fileService.createFile(this.getResultOutputPath(e),t)}async persist(e){await super.persist(e),Math.random()<X3o&&await this.cleanupDereferenced()}async cleanupDereferenced(){let{children:e}=await this.fileService.resolve(this.directory);if(!e)return;let t=new Set(this.stored.get([]).filter(o=>o.rev===CNt).map(o=>o.id));await Promise.all(e.filter(o=>!t.has(o.name.replace(/\.[a-z]+$/,""))).map(o=>this.fileService.del(o.resource).catch(()=>{})))}getResultJsonPath(e){return A.joinPath(this.directory,`${e}.json`)}getResultOutputPath(e){return A.joinPath(this.directory,`${e}.output`)}};xDe=I([m(0,ht),m(1,ce),m(2,se),m(3,Pe),m(4,fe),m(5,Eo)],xDe);var J3o=a=>a.results.length>0&&a.results[0].completedAt===void 0,pd=le("testResultService"),kDe=class extends x{constructor(e,t,o,n){super();this.storage=t;this.testProfiles=o;this.telemetryService=n;this.changeResultEmitter=this._register(new E);this._results=[];this._resultsDisposables=[];this.testChangeEmitter=this._register(new E);this.insertOrderCounter=0;this.onResultsChanged=this.changeResultEmitter.event;this.onTestChanged=this.testChangeEmitter.event;this.loadResults=$c(()=>this.storage.read().then(e=>{for(let t=e.length-1;t>=0;t--)this.push(e[t])}));this.persistScheduler=this._register(new Dt(()=>this.persistImmediately(),500));this._register(Z(()=>Be(this._resultsDisposables))),this.isRunning=oo.isRunning.bindTo(e),this.hasAnyResults=oo.hasAnyResults.bindTo(e)}get results(){return this.loadResults(),this._results}getStateById(e){for(let t of this.results){let o=t.getStateById(e);if(o&&o.computedState!==0)return[t,o]}}createLiveResult(e){if("targets"in e){let n=xt();return this.push(new Dh(n,!0,e,this.insertOrderCounter++,this.telemetryService))}let t;e.profile&&(t=this.testProfiles.getControllerProfiles(e.controllerId).find(r=>r.profileId===e.profile.id));let o={preserveFocus:e.preserveFocus,targets:[],exclude:e.exclude,continuous:e.continuous,group:t?.group??2};return t&&o.targets.push({profileId:t.profileId,controllerId:e.controllerId,testIds:e.include}),this.push(new Dh(e.id,e.persist,o,this.insertOrderCounter++,this.telemetryService))}push(e){if(e.completedAt===void 0)this.results.unshift(e);else{let o=Ky(this.results,n=>n.completedAt!==void 0&&n.completedAt<=e.completedAt);this.results.splice(o,0,e),this.persistScheduler.schedule()}this.hasAnyResults.set(!0),this.results.length>ISi&&(this.results.pop(),this._resultsDisposables.pop()?.dispose());let t=new N;if(this._resultsDisposables.push(t),e instanceof Dh)t.add(e),t.add(e.onComplete(()=>this.onComplete(e))),t.add(e.onChange(this.testChangeEmitter.fire,this.testChangeEmitter)),this.isRunning.set(!0),this.changeResultEmitter.fire({started:e});else{this.changeResultEmitter.fire({inserted:e});for(let o of e.tests)for(let n of this.results)if(n===e){this.testChangeEmitter.fire({item:o,result:e,reason:0});break}else if(n.getStateById(o.item.extId)!==void 0)break}return e}getResult(e){return this.results.find(t=>t.id===e)}clear(){let e=[],t=[];for(let o of this.results)o.completedAt!==void 0?t.push(o):e.push(o);this._results=e,this.persistScheduler.schedule(),e.length===0&&this.hasAnyResults.set(!1),this.changeResultEmitter.fire({removed:t})}onComplete(e){this.resort(),this.updateIsRunning(),this.persistScheduler.schedule(),this.changeResultEmitter.fire({completed:e})}resort(){this.results.sort((e,t)=>{if(!!e.completedAt!=!!t.completedAt)return e.completedAt===void 0?-1:1;let o=e instanceof Dh?e.insertOrder:-1;return(t instanceof Dh?t.insertOrder:-1)-o})}updateIsRunning(){this.isRunning.set(J3o(this))}async persistImmediately(){await this.loadResults(),this.storage.persist(this.results)}};kDe=I([m(0,X),m(1,xNt),m(2,uu),m(3,Te)],kDe);var Ws=le("testService"),Rso=a=>!vt.some(a.rootItems,i=>i.children.size>0),Mso=(a,i)=>{if(typeof i=="string"&&(i=Ur.fromString(i)),i.isRoot)return{controller:i.toString()};let e={$mid:16,tests:[]};for(let t of i.idsFromRoot())if(!t.isRoot){let o=a.getNodeById(t.toString());o&&e.tests.push(o)}return e},Pso=async(a,i,e=Se.None)=>{let t=[...Ur.fromString(i).idsFromRoot()],o=0;for(let n=t.length-1;!e.isCancellationRequested&&n>=o;){let r=t[n].toString(),s=a.getNodeById(r);if(!s){n--;continue}if(n===t.length-1)return s;s.children.has(t[n+1].toString())||await a.expand(r,0),o=n+1,n=t.length-1}},oXe=(a,i)=>{if(i.item.busy)return new Promise(e=>{let t=a.onDidProcessDiff(()=>{a.collection.getNodeById(i.item.extId)?.item.busy!==!0&&(e(),t.dispose())})})},gpe=async function*(a,i,e,t=!0,o=!0){let n=new qs,r=[...a.collection.getNodeByUrl(e)].sort((c,u)=>c.item.extId.length-u.item.extId.length);for(let c=0;c<r.length-1;c++){let u=r[c].item.extId+"\0";for(let p=c+1;p<r.length;p++)r[p].item.extId.startsWith(u)&&r.splice(p--,1)}n.push(r.length?r.map(c=>c.item.extId):a.collection.rootIds);let s=0,l=[];for(;n.size>0;){let c=n.pop(),u;c instanceof Ko?c.isSettled?u=c.value||vt.empty():(l.length&&(yield l,l=[]),u=await c.p):u=c;for(let p of u){s++;let h=a.collection.getNodeById(p);if(h){if(!h.item.uri){n.push(h.children);continue}if(!(i.extUri.isEqual(e,h.item.uri)&&(l.push(h),!o))&&i.extUri.isEqualOrParent(e,h.item.uri)){let g;h.expand===1&&(g=a.collection.expand(h.item.extId,1)),t&&(g?g=g.then(()=>oXe(a,h)):h.item.busy&&(g=oXe(a,h))),g?n.push(Ko.fromPromise(g.then(()=>h.children))):h.children.size&&n.push(h.children)}}}}l.length&&(yield l)},Aso=async function*(a,i,e,t=!0){let o=[a.collection.rootIds];for(;o.length;)for(let n of o.pop()){let r=a.collection.getNodeById(n);r&&(r.item.uri&&i.extUri.isEqualOrParent(r.item.uri,e)?yield r:(!r.item.uri||i.extUri.isEqualOrParent(e,r.item.uri))&&(r.expand===1&&await a.collection.expand(r.item.extId,1),t&&await oXe(a,r),o.push(r.children.values())))}},Nso=(a,i)=>{if(i.length<2)return i;let e=new SA;for(let n of i)e.insert(Ur.fromString(n.item.extId).path,n);let t=[],o=(n,r)=>{if(r.value)return r.value;qy(!!r.children,"expect to have children");let s=[];for(let[u,p]of r.children){n.push(u);let h=o(n,p);h&&s.push(h),n.pop()}if(!s.length)return;let l=new Ur(n),c=a.getNodeById(l.toString());if(c?.children.size===s.length)return c;t.push(...s)};for(let[n,r]of e.entries){let s=o([n],r);s&&t.push(s)}return t};var kNt=class extends x{constructor(e,t,o,n,r){super();this.uriIdentityService=t;this.testService=o;this.testProfiles=n;this.resultService=r;this.diffListener=this._register(new me);this.testProviderRegistrations=new Map;this.proxy=e.getProxy(to.ExtHostTesting),this._register(this.testService.registerExtHost({provideTestFollowups:(s,l)=>this.proxy.$provideTestFollowups(s,l),executeTestFollowup:s=>this.proxy.$executeTestFollowup(s),disposeTestFollowups:s=>this.proxy.$disposeTestFollowups(s),getTestsRelatedToCode:(s,l,c)=>this.proxy.$getTestsRelatedToCode(s,l,c)})),this._register(this.testService.onDidCancelTestRun(({runId:s,taskId:l})=>{this.proxy.$cancelExtensionTestRun(s,l)})),this._register(U.debounce(n.onDidChange,(s,l)=>l)(()=>{let s={};for(let l of[2,4,8])for(let c of this.testProfiles.getGroupDefaultProfiles(l))s[c.controllerId]??=[],s[c.controllerId].push(c.profileId);this.proxy.$setDefaultRunProfiles(s)})),this._register(r.onResultsChanged(s=>{if("completed"in s){let l=s.completed.toJSONWithMessages();l&&this.proxy.$publishTestResults([l])}else"removed"in s&&s.removed.forEach(l=>{l instanceof Dh&&this.proxy.$disposeRun(l.id)})}))}$markTestRetired(e){let t;if(e){t=new SA;for(let o of e)t.insert(Ur.fromString(o).path,void 0)}for(let o of this.resultService.results)o instanceof Dh&&o.markRetired(t)}$publishTestRunProfile(e){let t=this.testProviderRegistrations.get(e.controllerId);t&&this.testProfiles.addProfile(t.instance,e)}$updateTestRunConfig(e,t,o){this.testProfiles.updateProfile(e,t,o)}$removeTestProfile(e,t){this.testProfiles.removeProfile(e,t)}$addTestsToRun(e,t,o){this.withLiveRun(t,n=>n.addTestChainToRun(e,o.map(r=>C7e.deserialize(this.uriIdentityService,r))))}$appendCoverage(e,t,o){this.withLiveRun(e,n=>{let r=n.tasks.find(l=>l.id===t);if(!r)return;let s=vfi.deserialize(this.uriIdentityService,o);Gi(l=>{let c=r.coverage.read(void 0);c?c.append(s,l):(c=new fNt(n,t,this.uriIdentityService,{getCoverageDetails:(u,p,h)=>this.proxy.$getCoverageDetails(u,p,h).then(g=>g.map(Ifi.deserialize))}),c.append(s,l),r.coverage.set(c,l))})})}$startedExtensionTestRun(e){this.resultService.createLiveResult(e)}$startedTestRunTask(e,t){this.withLiveRun(e,o=>o.addTask(t))}$finishedTestRunTask(e,t){this.withLiveRun(e,o=>o.markTaskComplete(t))}$finishedExtensionTestRun(e){this.withLiveRun(e,t=>t.markComplete())}$updateTestStateInRun(e,t,o,n,r){this.withLiveRun(e,s=>s.updateState(o,t,n,r))}$appendOutputToRun(e,t,o,n,r){let s=n&&{uri:A.revive(n.uri),range:z.lift(n.range)};this.withLiveRun(e,l=>l.appendOutput(o,t,s,r))}$appendTestMessagesInRun(e,t,o,n){let r=this.resultService.getResult(e);if(r&&r instanceof Dh)for(let s of n)r.appendMessage(o,t,JF.deserialize(this.uriIdentityService,s))}$registerTestController(e,t,o){let n=new N,r=Me(`${e}.label`,t),s=Me(`${e}.cap`,o),l={id:e,label:r,capabilities:s,syncTests:()=>this.proxy.$syncTests(),refreshTests:c=>this.proxy.$refreshTests(e,c),configureRunProfile:c=>this.proxy.$configureRunProfile(e,c),runTests:(c,u)=>this.proxy.$runControllerTests(c,u),startContinuousRun:(c,u)=>this.proxy.$startContinuousRun(c,u),expandTest:(c,u)=>this.proxy.$expandTest(c,isFinite(u)?u:-1),getRelatedCode:(c,u)=>this.proxy.$getCodeRelatedToTest(c,u).then(p=>p.map(h=>({uri:A.revive(h.uri),range:z.lift(h.range)})))};n.add(Z(()=>this.testProfiles.removeProfile(e))),n.add(this.testService.registerTestController(e,l)),this.testProviderRegistrations.set(e,{instance:l,label:r,capabilities:s,disposable:n})}$updateController(e,t){let o=this.testProviderRegistrations.get(e);o&&Gi(n=>{t.label!==void 0&&o.label.set(t.label,n),t.capabilities!==void 0&&o.capabilities.set(t.capabilities,n)})}$unregisterTestController(e){this.testProviderRegistrations.get(e)?.disposable.dispose(),this.testProviderRegistrations.delete(e)}$subscribeToDiffs(){this.proxy.$acceptDiff(this.testService.collection.getReviverDiff().map(LMt.serialize)),this.diffListener.value=this.testService.onDidProcessDiff(this.proxy.$acceptDiff,this.proxy)}$unsubscribeFromDiffs(){this.diffListener.clear()}$publishDiff(e,t){this.testService.publishDiff(e,t.map(o=>LMt.deserialize(this.uriIdentityService,o)))}async $runTests(e,t){return(await this.testService.runResolvedTests(e,t)).id}async $getCoverageDetails(e,t,o,n){return await this.resultService.getResult(e)?.tasks[t]?.coverage.get()?.getUri(A.from(o))?.details(n)||[]}dispose(){super.dispose();for(let e of this.testProviderRegistrations.values())e.disposable.dispose();this.testProviderRegistrations.clear()}withLiveRun(e,t){let o=this.resultService.getResult(e);return o&&o instanceof Dh?t(o):void 0}};kNt=I([fo(qi.MainThreadTesting),m(1,ht),m(2,Ws),m(3,uu),m(4,pd)],kNt);var ENt=class extends x{constructor(e,t,o,n){super();this.secretStorageService=t;this.logService=o;this._sequencer=new Nx;this._proxy=e.getProxy(to.ExtHostSecretState),this._register(this.secretStorageService.onDidChangeSecret(r=>{let s=this.parseKey(r);s&&this._proxy.$onDidChangePassword(s)}))}$getPassword(e,t){return this.logService.trace(`[mainThreadSecretState] Getting password for ${e} extension: `,t),this._sequencer.queue(e,()=>this.doGetPassword(e,t))}async doGetPassword(e,t){let o=this.getKey(e,t),n=await this.secretStorageService.get(o);return this.logService.trace(`[mainThreadSecretState] ${n?"P":"No p"}assword found for: `,e,t),n}$setPassword(e,t,o){return this.logService.trace(`[mainThreadSecretState] Setting password for ${e} extension: `,t),this._sequencer.queue(e,()=>this.doSetPassword(e,t,o))}async doSetPassword(e,t,o){let n=this.getKey(e,t);await this.secretStorageService.set(n,o),this.logService.trace("[mainThreadSecretState] Password set for: ",e,t)}$deletePassword(e,t){return this.logService.trace(`[mainThreadSecretState] Deleting password for ${e} extension: `,t),this._sequencer.queue(e,()=>this.doDeletePassword(e,t))}async doDeletePassword(e,t){let o=this.getKey(e,t);await this.secretStorageService.delete(o),this.logService.trace("[mainThreadSecretState] Password deleted for: ",e,t)}$getKeys(e){return this.logService.trace(`[mainThreadSecretState] Getting keys for ${e} extension: `),this._sequencer.queue(e,()=>this.doGetKeys(e))}async doGetKeys(e){if(!this.secretStorageService.keys)throw new Error("Secret storage service does not support keys() method");let o=(await this.secretStorageService.keys()).map(n=>this.parseKey(n)).filter(n=>n!==void 0&&n.extensionId===e).map(({key:n})=>n);return this.logService.trace(`[mainThreadSecretState] Got ${o.length}key(s) for: `,e),o}getKey(e,t){return JSON.stringify({extensionId:e,key:t})}parseKey(e){try{return JSON.parse(e)}catch{return}}};ENt=I([fo(qi.MainThreadSecretState),m(1,Dw),m(2,se),m(3,cd)],ENt);var EDe=le("shareService");var TNt=class{constructor(i,e){this.shareService=e;this.providers=new Map;this.providerDisposables=new Map;this.proxy=i.getProxy(to.ExtHostShare)}$registerShareProvider(i,e,t,o,n){let r={id:t,label:o,selector:e,priority:n,provideShare:async l=>{let c=await this.proxy.$provideShare(i,l,Se.None);return typeof c=="string"?c:A.revive(c)}};this.providers.set(i,r);let s=this.shareService.registerShareProvider(r);this.providerDisposables.set(i,s)}$unregisterShareProvider(i){this.providers.delete(i),this.providerDisposables.delete(i)}dispose(){this.providers.clear(),Be(this.providerDisposables.values()),this.providerDisposables.clear()}};TNt=I([fo(qi.MainThreadShare),m(1,EDe)],TNt);var _Nt=class extends x{constructor(e,t){super();this.userDataProfileImportExportService=t;this.registeredHandlers=this._register(new Vt);this.proxy=e.getProxy(to.ExtHostProfileContentHandlers)}async $registerProfileContentHandler(e,t,o,n){this.registeredHandlers.set(e,this.userDataProfileImportExportService.registerProfileContentHandler(e,{name:t,description:o,extensionId:n,saveProfile:async(r,s,l)=>{let c=await this.proxy.$saveProfile(e,r,s,l);return c?$n(c):null},readProfile:async(r,s)=>this.proxy.$readProfile(e,r,s)}))}async $unregisterProfileContentHandler(e){this.registeredHandlers.deleteAndDispose(e)}};_Nt=I([fo(qi.MainThreadProfileContentHandlers),m(1,YB)],_Nt);var TDe=le("IAiRelatedInformationService");var DNt=class extends x{constructor(e,t){super();this._aiRelatedInformationService=t;this._registrations=this._register(new Vt);this._proxy=e.getProxy(to.ExtHostAiRelatedInformation)}$getAiRelatedInformation(e,t){return this._aiRelatedInformationService.getRelatedInformation(e,t,Se.None)}$registerAiRelatedInformationProvider(e,t){let o={provideAiRelatedInformation:(n,r)=>this._proxy.$provideAiRelatedInformation(e,n,r)};this._registrations.set(e,this._aiRelatedInformationService.registerAiRelatedInformationProvider(t,o))}$unregisterAiRelatedInformationProvider(e){this._registrations.deleteAndDispose(e)}};DNt=I([fo(qi.MainThreadAiRelatedInformation),m(1,TDe)],DNt);var ySi=le("IAiEmbeddingVectorService"),fpe=class{constructor(i){this.logService=i;this._providers=[]}static{this.DEFAULT_TIMEOUT=1e3*10}isEnabled(){return this._providers.length>0}registerAiEmbeddingVectorProvider(i,e){return this._providers.push(e),{dispose:()=>{let t=this._providers.indexOf(e);t>=0&&this._providers.splice(t,1)}}}async getEmbeddingVector(i,e){if(this._providers.length===0)throw new Error("No embedding vector providers registered");let t=Dn.create(),o=[],n=Li(fpe.DEFAULT_TIMEOUT),r=e.onCancellationRequested(()=>{r.dispose(),n.cancel()});for(let s of this._providers)o.push(Ln(async l=>{try{return await s.provideAiEmbeddingVector(Array.isArray(i)?i:[i],l)}catch{}throw await n,new Error("Embedding vector provider timed out")}));o.push(Ln(async s=>{let l=s.onCancellationRequested(()=>{n.cancel(),l.dispose()});throw await n,new Error("Embedding vector provider timed out")}));try{let s=await oae(o);return s.length===1?s[0]:s}finally{t.stop(),this.logService.trace(`[AiEmbeddingVectorService]: getEmbeddingVector took ${t.elapsed()}ms`)}}};fpe=I([m(0,se)],fpe);Ee(ySi,fpe,1);var LNt=class extends x{constructor(e,t){super();this._AiEmbeddingVectorService=t;this._registrations=this._register(new Vt);this._proxy=e.getProxy(to.ExtHostAiEmbeddingVector)}$registerAiEmbeddingVectorProvider(e,t){let o={provideAiEmbeddingVector:(n,r)=>this._proxy.$provideAiEmbeddingVector(t,n,r)};this._registrations.set(t,this._AiEmbeddingVectorService.registerAiEmbeddingVectorProvider(e,o))}$unregisterAiEmbeddingVectorProvider(e){this._registrations.deleteAndDispose(e)}};LNt=I([fo(qi.MainThreadAiEmbeddingVector),m(1,ySi)],LNt);var RNt=class extends x{constructor(e,t){super();this._settingsSearchService=t;this._registrations=this._register(new Vt);this._proxy=e.getProxy(to.ExtHostAiSettingsSearch)}$registerAiSettingsSearchProvider(e){let t={searchSettings:(o,n,r)=>this._proxy.$startSearch(e,o,n,r)};this._registrations.set(e,this._settingsSearchService.registerSettingsSearchProvider(t))}$unregisterAiSettingsSearchProvider(e){this._registrations.deleteAndDispose(e)}$handleSearchResult(e,t){if(!this._registrations.has(e))throw new Error("No AI settings search provider found");this._settingsSearchService.handleSearchResult(t)}};RNt=I([fo(qi.MainThreadAiSettingsSearch),m(1,o_e)],RNt);var _De=le("IWorkbenchMcpGatewayService");var Lc=le("mcpRegistry");var vpe=le("IAuthenticationMcpAccessService"),nXe=class extends x{constructor(e,t){super();this._storageService=e;this._productService=t;this._onDidChangeMcpSessionAccess=this._register(new E);this.onDidChangeMcpSessionAccess=this._onDidChangeMcpSessionAccess.event}isAccessAllowed(e,t,o){let n=this._productService.trustedMcpAuthAccess;if(Array.isArray(n)){if(n.includes(o))return!0}else if(n?.[e]?.includes(o))return!0;let s=this.readAllowedMcpServers(e,t).find(l=>l.id===o);if(s)return s.allowed!==void 0?s.allowed:!0}readAllowedMcpServers(e,t){let o=[];try{let s=this._storageService.get(`mcpserver-${e}-${t}`,-1);s&&(o=JSON.parse(s))}catch{}let n=this._productService.trustedMcpAuthAccess,r=Array.isArray(n)?n:typeof n=="object"?n[e]??[]:[];for(let s of r){let l=o.find(c=>c.id===s);l?(l.allowed=!0,l.trusted=!0):o.push({id:s,name:s,allowed:!0,trusted:!0})}return o}updateAllowedMcpServers(e,t,o){let n=this.readAllowedMcpServers(e,t);for(let s of o){let l=n.findIndex(c=>c.id===s.id);l===-1?n.push(s):(n[l].allowed=s.allowed,s.name&&s.name!==s.id&&n[l].name!==s.name&&(n[l].name=s.name))}let r=n.filter(s=>!s.trusted);this._storageService.store(`mcpserver-${e}-${t}`,JSON.stringify(r),-1,0),this._onDidChangeMcpSessionAccess.fire({providerId:e,accountName:t})}removeAllowedMcpServers(e,t){this._storageService.remove(`mcpserver-${e}-${t}`,-1),this._onDidChangeMcpSessionAccess.fire({providerId:e,accountName:t})}};nXe=I([m(0,ce),m(1,tt)],nXe);Ee(vpe,nXe,1);var Sl=le("activityService"),rXe=class{constructor(i,e){this.descriptorFn=i;this.stylesFn=e}getDescription(){return this.descriptorFn(null)}getColors(i){return this.stylesFn?.(i)}},Rd=class extends rXe{constructor(e,t){super(t,void 0);this.number=e;this.number=e}getDescription(){return this.descriptorFn(this.number)}},y2=class extends rXe{constructor(e,t,o){super(t,o);this.icon=e}},sx=class extends rXe{constructor(i){super(i,void 0)}},sXe=class extends y2{constructor(i){super(R.warning,i,e=>({badgeBackground:e.getColor(m5i),badgeForeground:e.getColor(p5i),badgeBorder:void 0}))}};var bpe=le("IAuthenticationMcpUsageService"),aXe=class extends x{constructor(e,t,o,n){super();this._storageService=e;this._authenticationService=t;this._logService=o;this._queue=new uh;this._mcpServersUsingAuth=new Set;let r=n.trustedMcpAuthAccess;if(Array.isArray(r))for(let s of r)this._mcpServersUsingAuth.add(s);else if(r)for(let s of Object.values(r))for(let l of s)this._mcpServersUsingAuth.add(l);this._register(this._authenticationService.onDidRegisterAuthenticationProvider(s=>this._queue.queue(()=>this._addToCache(s.id))))}async initializeUsageCache(){await this._queue.queue(()=>Promise.all(this._authenticationService.getProviderIds().map(e=>this._addToCache(e))))}async hasUsedAuth(e){return await this._queue.whenIdle(),this._mcpServersUsingAuth.has(e)}readAccountUsages(e,t){let o=`${e}-${t}-mcpserver-usages`,n=this._storageService.get(o,-1),r=[];if(n)try{r=JSON.parse(n)}catch{}return r}removeAccountUsage(e,t){let o=`${e}-${t}-mcpserver-usages`;this._storageService.remove(o,-1)}addAccountUsage(e,t,o,n,r){let s=`${e}-${t}-mcpserver-usages`,l=this.readAccountUsages(e,t),c=l.findIndex(u=>u.mcpServerId===n);c>-1?l.splice(c,1,{mcpServerId:n,mcpServerName:r,scopes:o,lastUsed:Date.now()}):l.push({mcpServerId:n,mcpServerName:r,scopes:o,lastUsed:Date.now()}),this._storageService.store(s,JSON.stringify(l),-1,1),this._mcpServersUsingAuth.add(n)}async _addToCache(e){try{let t=await this._authenticationService.getAccounts(e);for(let o of t){let n=this.readAccountUsages(e,o.label);for(let r of n)this._mcpServersUsingAuth.add(r.mcpServerId)}}catch(t){this._logService.error(t)}}};aXe=I([m(0,ce),m(1,xs),m(2,se),m(3,tt)],aXe);Ee(bpe,aXe,1);var lXe=" ",dXe=le("IAuthenticationMcpService"),cXe=class extends x{constructor(e,t,o,n,r,s,l,c){super();this.activityService=e;this.storageService=t;this.dialogService=o;this.quickInputService=n;this._productService=r;this._authenticationService=s;this._authenticationUsageService=l;this._authenticationAccessService=c;this._signInRequestItems=new Map;this._sessionAccessRequestItems=new Map;this._accountBadgeDisposable=this._register(new me);this._onDidAccountPreferenceChange=this._register(new E);this.onDidChangeAccountPreference=this._onDidAccountPreferenceChange.event;this._inheritAuthAccountPreferenceParentToChildren=this._productService.inheritAuthAccountPreference||{},this._inheritAuthAccountPreferenceChildToParent=Object.entries(this._inheritAuthAccountPreferenceParentToChildren).reduce((u,[p,h])=>(h.forEach(g=>{u[g]=p}),u),{}),this.registerListeners()}registerListeners(){this._register(this._authenticationService.onDidChangeSessions(async e=>{e.event.added?.length&&await this.updateNewSessionRequests(e.providerId,e.event.added),e.event.removed?.length&&await this.updateAccessRequests(e.providerId,e.event.removed),this.updateBadgeCount()})),this._register(this._authenticationService.onDidUnregisterAuthenticationProvider(e=>{let t=this._sessionAccessRequestItems.get(e.id)||{};Object.keys(t).forEach(o=>{this.removeAccessRequest(e.id,o)})}))}async updateNewSessionRequests(e,t){let o=this._signInRequestItems.get(e);o&&Object.keys(o).forEach(n=>{let r=n.split(lXe);t.some(s=>uNt(s.scopes,r))&&(o[n]?.disposables.forEach(l=>l.dispose()),delete o[n],Object.keys(o).length===0?this._signInRequestItems.delete(e):this._signInRequestItems.set(e,o))})}async updateAccessRequests(e,t){let o=this._sessionAccessRequestItems.get(e);o&&Object.keys(o).forEach(n=>{t.forEach(r=>{let s=o[n].possibleSessions.findIndex(l=>l.id===r.id);s&&o[n].possibleSessions.splice(s,1)}),o[n].possibleSessions.length||this.removeAccessRequest(e,n)})}updateBadgeCount(){this._accountBadgeDisposable.clear();let e=0;if(this._signInRequestItems.forEach(t=>{Object.keys(t).forEach(o=>{e+=t[o].requestingMcpServerIds.length})}),this._sessionAccessRequestItems.forEach(t=>{e+=Object.keys(t).length}),e>0){let t=new Rd(e,()=>d(17385,null));this._accountBadgeDisposable.value=this.activityService.showAccountsActivity({badge:t})}}removeAccessRequest(e,t){let o=this._sessionAccessRequestItems.get(e)||{};o[t]&&(Be(o[t].disposables),delete o[t],this.updateBadgeCount())}updateAccountPreference(e,t,o){let n=this._inheritAuthAccountPreferenceChildToParent[e]??e,r=this._getKey(n,t);this.storageService.store(r,o.label,1,1),this.storageService.store(r,o.label,-1,1);let s=this._inheritAuthAccountPreferenceParentToChildren[n],l=s?[n,...s]:[n];this._onDidAccountPreferenceChange.fire({mcpServerIds:l,providerId:t})}getAccountPreference(e,t){let o=this._getKey(this._inheritAuthAccountPreferenceChildToParent[e]??e,t);return this.storageService.get(o,1)??this.storageService.get(o,-1)}removeAccountPreference(e,t){let o=this._getKey(this._inheritAuthAccountPreferenceChildToParent[e]??e,t);this.storageService.remove(o,1),this.storageService.remove(o,-1)}_getKey(e,t){return`${e}-${t}`}updateSessionPreference(e,t,o){let n=`${t}-${e}-${o.scopes.join(lXe)}`;this.storageService.store(n,o.id,1,1),this.storageService.store(n,o.id,-1,1)}getSessionPreference(e,t,o){let n=`${t}-${e}-${o.join(lXe)}`;return this.storageService.get(n,1)??this.storageService.get(n,-1)}removeSessionPreference(e,t,o){let n=`${t}-${e}-${o.join(lXe)}`;this.storageService.remove(n,1),this.storageService.remove(n,-1)}_updateAccountAndSessionPreferences(e,t,o){this.updateAccountPreference(t,e,o.account),this.updateSessionPreference(e,t,o)}async showGetSessionPrompt(e,t,o,n){let r;(p=>(p[p.Allow=0]="Allow",p[p.Deny=1]="Deny",p[p.Cancel=2]="Cancel"))(r||={});let{result:s}=await this.dialogService.prompt({type:ft.Info,message:d(17381,null,n,e.label,t),buttons:[{label:d(17380,null),run:()=>0},{label:d(17382,null),run:()=>1}],cancelButton:{run:()=>2}});return s!==2&&(this._authenticationAccessService.updateAllowedMcpServers(e.id,t,[{id:o,name:n,allowed:s===0}]),this.removeAccessRequest(e.id,o)),s===0}async selectSession(e,t,o,n,r){let s=await this._authenticationService.getAccounts(e);if(!s.length)throw new Error("No accounts available");let l=new N,c=l.add(this.quickInputService.createQuickPick());c.ignoreFocusOut=!0;let u=new Set,p=r.filter(h=>!u.has(h.account.label)&&u.add(h.account.label)).map(h=>({label:h.account.label,session:h}));return s.forEach(h=>{u.has(h.label)||p.push({label:h.label,account:h})}),p.push({label:d(17387,null)}),c.items=p,c.title=d(17384,null,o,this._authenticationService.getProvider(e).label),c.placeholder=d(17383,null,o),await new Promise((h,g)=>{l.add(c.onDidAccept(async f=>{c.dispose();let v=c.selectedItems[0].session;if(!v){let S=c.selectedItems[0].account;try{v=await this._authenticationService.createSession(e,n,{account:S})}catch(y){g(y);return}}let b=v.account.label;this._authenticationAccessService.updateAllowedMcpServers(e,b,[{id:t,name:o,allowed:!0}]),this._updateAccountAndSessionPreferences(e,t,v),this.removeAccessRequest(e,t),h(v)})),l.add(c.onDidHide(f=>{c.selectedItems[0]||g("User did not consent to account access"),l.dispose()})),c.show()})}async completeSessionAccessRequest(e,t,o,n){let s=(this._sessionAccessRequestItems.get(e.id)||{})[t];if(!s||!e)return;let l=s.possibleSessions,c;if(e.supportsMultipleAccounts)try{c=await this.selectSession(e.id,t,o,n,l)}catch{}else await this.showGetSessionPrompt(e,l[0].account.label,t,o)&&(c=l[0]);c&&this._authenticationUsageService.addAccountUsage(e.id,c.account.label,c.scopes,t,o)}requestSessionAccess(e,t,o,n,r){let s=this._sessionAccessRequestItems.get(e)||{};if(s[t])return;let c=this._authenticationService.getProvider(e),u=ve.appendMenuItem(D.AccountsContext,{group:"3_accessRequests",command:{id:`${e}${t}Access`,title:d(17379,null,c.label,o)}}),p=$e.registerCommand({id:`${e}${t}Access`,handler:async h=>{this.completeSessionAccessRequest(c,t,o,n)}});s[t]={possibleSessions:r,disposables:[u,p]},this._sessionAccessRequestItems.set(e,s),this.updateBadgeCount()}async requestNewSession(e,t,o,n){this._authenticationService.isAuthenticationProviderRegistered(e)||await new Promise((g,f)=>{let v=this._authenticationService.onDidRegisterAuthenticationProvider(b=>{b.id===e&&(v.dispose(),g())})});let r;try{r=this._authenticationService.getProvider(e)}catch{return}let s=this._signInRequestItems.get(e),l=t.join(lXe);if(s&&s[l]&&s[l].requestingMcpServerIds.includes(o))return;let u=`${e}:${o}:signIn${Object.keys(s||[]).length}`,p=ve.appendMenuItem(D.AccountsContext,{group:"2_signInRequests",command:{id:u,title:d(17386,null,r.label,n)}}),h=$e.registerCommand({id:u,handler:async g=>{let v=await g.get(xs).createSession(e,t);this._authenticationAccessService.updateAllowedMcpServers(e,v.account.label,[{id:o,name:n,allowed:!0}]),this._updateAccountAndSessionPreferences(e,o,v)}});if(s){let g=s[l]||{disposables:[],requestingMcpServerIds:[]};s[l]={disposables:[...g.disposables,p,h],requestingMcpServerIds:[...g.requestingMcpServerIds,o]},this._signInRequestItems.set(e,s)}else this._signInRequestItems.set(e,{[l]:{disposables:[p,h],requestingMcpServerIds:[o]}});this.updateBadgeCount()}};cXe=I([m(0,Sl),m(1,ce),m(2,at),m(3,Ue),m(4,tt),m(5,xs),m(6,bpe),m(7,vpe)],cXe);Ee(dXe,cXe,1);var MNt=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this._extHostContext=e;this._mcpRegistry=t;this.dialogService=o;this._authenticationService=n;this.authenticationMcpServersService=r;this.authenticationMCPServerAccessService=s;this.authenticationMCPServerUsageService=l;this._dynamicAuthenticationProviderStorageService=c;this._extensionService=u;this._contextKeyService=p;this._telemetryService=h;this._mcpGatewayService=g;this._serverIdCounter=0;this._servers=new Map;this._serverDefinitions=new Map;this._serverAuthTracking=new CSi;this._collectionDefinitions=this._register(new Vt);this._gateways=this._register(new Vt);this._register(n.onDidChangeSessions(b=>this._onDidChangeAuthSessions(b.providerId,b.label)));let f=this._proxy=e.getProxy(to.ExtHostMcp);this._register(this._mcpRegistry.registerDelegate({priority:e.extensionHostKind===2?0:1,waitForInitialProviderPromises(){return f.$waitForInitialCollectionProviders()},canStart(b,S){return!(b.remoteAuthority!==e.remoteAuthority||S.launch.type===1&&e.extensionHostKind===2)},async substituteVariables(b,S){let y=await f.$substituteVariables(b.variableReplacement?.folder?.uri,yA.toSerialized(S));return yA.fromSerialized(y)},start:(b,S,y,w)=>{let k=++this._serverIdCounter,T=new wSi(e.extensionHostKind,()=>f.$stopMcp(k),P=>f.$sendMessage(k,JSON.stringify(P)));return this._servers.set(k,T),this._serverDefinitions.set(k,S),f.$startMcp(k,{launch:y,defaultCwd:S.variableReplacement?.folder?.uri,errorOnUserInteraction:w?.errorOnUserInteraction}),T}}));let v=this._register(new Dt(()=>this._publishServerDefinitions(),500));this._register(be(b=>{let S=this._mcpRegistry.collections.read(b);for(let y of S)y.serverDefinitions.read(b);v.isScheduled()||v.schedule()})),v.schedule()}_publishServerDefinitions(){let e=this._mcpRegistry.collections.get(),t=[];for(let o of e){let n=o.serverDefinitions.get();for(let r of n)t.push(VB.toSerialized(r))}this._proxy.$onDidChangeMcpServerDefinitions(t)}$upsertMcpCollection(e,t){let o=t.map(VB.fromSerialized),n=this._collectionDefinitions.get(e.id);if(n)n.servers.set(o,void 0);else{let r=Me("mcpServers",o),s=new Ii(e.extensionId),l=new N,c=l.add(new me),u=()=>{c.value??=this._mcpRegistry.registerCollection({...e,source:s,resolveServerLanch:e.canResolveLaunch?(async g=>{let f=await this._proxy.$resolveMcpLaunch(e.id,g.label);return f?yA.fromSerialized(f):void 0}):void 0,trustBehavior:e.isTrustedByDefault?Ek.Kind.Trusted:Ek.Kind.TrustedOnNonce,remoteAuthority:this._extHostContext.remoteAuthority,serverDefinitions:r})},p=d_(this._extensionService.extensions,g=>Ii.equals(s,g.identifier)?g.contributes?.mcpServerDefinitionProviders?.find(f=>I7e(s,f.id)===e.id)?.when:void 0),h=p&&C.deserialize(p);if(!h)u();else{let g=()=>{this._contextKeyService.contextMatchesRules(h)?u():c.clear()};l.add(this._contextKeyService.onDidChangeContext(g)),g()}this._collectionDefinitions.set(e.id,{servers:r,dispose:()=>l.dispose()})}}$deleteMcpCollection(e){this._collectionDefinitions.deleteAndDispose(e)}$onDidChangeState(e,t){let o=this._servers.get(e);o&&(o.state.set(t,void 0),dr.isRunning(t)||(o.dispose(),this._servers.delete(e),this._serverDefinitions.delete(e),this._serverAuthTracking.untrack(e)))}$onDidPublishLog(e,t,o){typeof t=="string"&&(t=3,o=t),this._servers.get(e)?.pushLog(t,o)}$onDidReceiveMessage(e,t){this._servers.get(e)?.pushMessage(t)}async $getTokenForProviderId(e,t,o,n={}){let r=this._serverDefinitions.get(e);if(r)return this._getSessionForProvider(e,r,t,o,void 0,n.errorOnUserInteraction)}async $getTokenFromServerMetadata(e,t,{errorOnUserInteraction:o,forceNewRegistration:n}={}){let r=this._serverDefinitions.get(e);if(!r)return;let s=A.revive(t.authorizationServer),l=t.resourceMetadata?.resource?A.parse(t.resourceMetadata.resource):void 0,c=t.scopes??t.resourceMetadata?.scopes_supported??t.authorizationServerMetadata.scopes_supported??[],u=await this._authenticationService.getOrActivateProviderIdForServer(s,l);if(n&&u){if(!this._authenticationService.isDynamicAuthenticationProvider(u))throw new Error("Cannot force new registration for a non-dynamic authentication provider.");this._authenticationService.unregisterAuthenticationProvider(u),await this._dynamicAuthenticationProviderStorageService.removeDynamicProvider(u),u=void 0}if(!u){let p=await this._authenticationService.createDynamicAuthenticationProvider(s,t.authorizationServerMetadata,t.resourceMetadata);if(!p)return;u=p.id}return this._getSessionForProvider(e,r,u,c,s,o)}async _getSessionForProvider(e,t,o,n,r,s=!1){let l=await this._authenticationService.getSessions(o,n,{authorizationServer:r},!0),c=this.authenticationMcpServersService.getAccountPreference(t.id,o),u;c&&(u=l.find(f=>f.account.label===c));let p=this._authenticationService.getProvider(o),h;if(l.length){if(u&&this.authenticationMCPServerAccessService.isAccessAllowed(o,u.account.label,t.id))return this.authenticationMCPServerUsageService.addAccountUsage(o,u.account.label,n,t.id,t.label),this._serverAuthTracking.track(o,e,n),u.accessToken;if(!p.supportsMultipleAccounts&&this.authenticationMCPServerAccessService.isAccessAllowed(o,l[0].account.label,t.id))return this.authenticationMCPServerUsageService.addAccountUsage(o,l[0].account.label,n,t.id,t.label),this._serverAuthTracking.track(o,e,n),l[0].accessToken}if(s)throw new Vw("authentication");if(!await this.loginPrompt(t.label,p.label,!1))throw new Error("User did not consent to login.");if(l.length){if(p.supportsMultipleAccounts&&s)throw new Vw("authentication");h=p.supportsMultipleAccounts?await this.authenticationMcpServersService.selectSession(o,t.id,t.label,n,l):l[0]}else{if(s)throw new Vw("authentication");let f=u?.account;do h=await this._authenticationService.createSession(o,n,{activateImmediate:!0,account:f,authorizationServer:r});while(f&&f.label!==h.account.label&&!await this.continueWithIncorrectAccountPrompt(h.account.label,f.label))}return this.authenticationMCPServerAccessService.updateAllowedMcpServers(o,h.account.label,[{id:t.id,name:t.label,allowed:!0}]),this.authenticationMcpServersService.updateAccountPreference(t.id,o,h.account),this.authenticationMCPServerUsageService.addAccountUsage(o,h.account.label,n,t.id,t.label),this._serverAuthTracking.track(o,e,n),h.accessToken}async continueWithIncorrectAccountPrompt(e,t){let o=await this.dialogService.prompt({message:d(3335,null),detail:d(3336,null,e,t),type:bt.Warning,cancelButton:!0,buttons:[{label:d(3337,null,e),run:()=>e},{label:d(3338,null,t),run:()=>t}]});if(!o.result)throw new go;return o.result===e}async _onDidChangeAuthSessions(e,t){let o=this._serverAuthTracking.get(e);if(o)for(let{serverId:n,scopes:r}of o){let s=this._servers.get(n),l=this._serverDefinitions.get(n);if(!(!s||!l||s.state.get().state!==dr.Kind.Running))try{await this._getSessionForProvider(n,l,e,r,void 0,!0)}catch(u){Vw.is(u)&&(s.pushLog(4,d(3339,null,t)),s.stop())}}}$logMcpAuthSetup(e){this._telemetryService.publicLog2("mcp/authSetup",e)}async $startMcpGateway(){let e=await this._mcpGatewayService.createGateway(this._extHostContext.extensionHostKind===3);if(!e)return;if(this._store.isDisposed){e.dispose();return}let t=xt(),o=new N;return o.add(e),o.add(e.onDidChangeServers(n=>{this._proxy.$onDidChangeGatewayServers(t,n.map(r=>({label:r.label,address:r.address})))})),this._gateways.set(t,o),{servers:e.servers.map(n=>({label:n.label,address:n.address})),gatewayId:t}}$disposeMcpGateway(e){this._gateways.deleteAndDispose(e)}async loginPrompt(e,t,o){let n=o?d(3334,null,e,t):d(3333,null,e,t),r=[{label:d(3332,null),run(){return!0}}],{result:s}=await this.dialogService.prompt({type:bt.Info,message:n,buttons:r,cancelButton:!0});return s??!1}dispose(){for(let e of this._servers.values())e.extHostDispose();this._servers.clear(),this._serverDefinitions.clear(),this._serverAuthTracking.clear(),super.dispose()}};MNt=I([fo(qi.MainThreadMcp),m(1,Lc),m(2,at),m(3,xs),m(4,dXe),m(5,vpe),m(6,bpe),m(7,SZ),m(8,lt),m(9,X),m(10,Te),m(11,_De)],MNt);var wSi=class extends x{constructor(e,t,o){super();this.stop=t;this.send=o;this.state=Me("mcpServerState",{state:dr.Kind.Starting});this._onDidLog=this._register(new E);this.onDidLog=this._onDidLog.event;this._onDidReceiveMessage=this._register(new E);this.onDidReceiveMessage=this._onDidReceiveMessage.event;this._register(tn(()=>{this.pushLog(3,`Starting server from ${bA(e)} extension host`)}))}pushLog(e,t){this._onDidLog.fire({message:t,level:e})}pushMessage(e){let t;try{t=JSON.parse(e)}catch{this.pushLog(4,`Failed to parse message: ${JSON.stringify(e)}`)}t&&(Array.isArray(t)?t.forEach(o=>this._onDidReceiveMessage.fire(o)):this._onDidReceiveMessage.fire(t))}extHostDispose(){dr.isRunning(this.state.get())&&(this.pushLog(4,"Extension host shut down, server will stop."),this.state.set({state:dr.Kind.Stopped},void 0)),this.dispose()}dispose(){dr.isRunning(this.state.get())&&this.stop(),super.dispose()}},CSi=class{constructor(){this._tracking=new Map}track(i,e,t){let n=(this._tracking.get(i)||[]).filter(r=>r.serverId!==e);n.push({serverId:e,scopes:t}),this._tracking.set(i,n)}untrack(i){for(let[e,t]of this._tracking.entries()){let o=t.filter(n=>n.serverId!==i);o.length===0?this._tracking.delete(e):this._tracking.set(e,o)}}get(i){return this._tracking.get(i)}clear(){this._tracking.clear()}};function Oso(a){return xi(a)&&typeof a.asAttachment=="function"}function Spe(a){return(i,e)=>ke(o=>{let n=i.read(o),r=new Ye(e);return o.store.add(Z(()=>r.dispose(!0))),new bd(a(n,r.token))}).map((o,n)=>{let r=o.promiseResult.read(n);return{picks:r?.data||[],busy:r===void 0}})}var DS=le("IContextPickService"),PNt=class{constructor(){this._picks=[];this.items=this._picks}registerChatContextItem(i){return this._picks.push(i),this._picks.sort((e,t)=>{let o=e.ordinal??0,n=t.ordinal??0;return o===n?Hl(e.label,t.label):o<n?1:-1}),Z(()=>{let e=this._picks.indexOf(i);e>=0&&this._picks.splice(e,1)})}};var ED=le("chatContextService"),uXe=class extends x{constructor(e,t){super();this._contextPickService=e;this._extensionService=t;this._providers=new Map;this._workspaceContext=new Map;this._registeredPickers=this._register(new Vt);this._lastResourceContext=new Map}setExecuteCommandCallback(e){this._executeCommandCallback=e}async executeChatContextItemCommand(e){this._executeCommandCallback&&await this._executeCommandCallback(e)}setChatContextProvider(e,t){let o=this._providers.get(e)??{};o.picker=t,this._providers.set(e,o),this._registerWithPickService(e)}_registerWithPickService(e){let t=this._providers.get(e);if(!t||!t.picker||!t.explicitProvider)return;let o=`${t.picker.title.replace(/\.+$/,"")}...`;this._registeredPickers.set(e,this._contextPickService.registerChatContextItem(this._asPicker(o,t.picker.icon,e)))}registerChatWorkspaceContextProvider(e,t){let o=this._providers.get(e)??{};o.workspaceProvider=t,this._providers.set(e,o)}registerChatExplicitContextProvider(e,t){let o=this._providers.get(e)??{};o.explicitProvider=t,this._providers.set(e,o),this._registerWithPickService(e)}registerChatResourceContextProvider(e,t,o){let n=this._providers.get(e)??{};n.resourceProvider={selector:t,provider:o},this._providers.set(e,n)}unregisterChatContextProvider(e){this._providers.delete(e),this._registeredPickers.deleteAndDispose(e)}updateWorkspaceContextItems(e,t){this._workspaceContext.set(e,t)}getWorkspaceContextItems(){let e=[];for(let t of this._workspaceContext.values())for(let o of t){if(!o.value)continue;let n=o.label??(o.resourceUri?He(o.resourceUri):"Unknown");e.push({value:o.value,name:n,modelDescription:o.modelDescription,id:n,kind:"workspace"})}return e}async contextForResource(e,t){return this._contextForResource(e,!1,t)}async _contextForResource(e,t,o){let n=[];for(let p of this._providers.values()){if(!p.resourceProvider)continue;let h=fB(p.resourceProvider.selector,e,o??"",!0,void 0,void 0);n.push({score:h,provider:p.resourceProvider.provider})}if(n.sort((p,h)=>h.score-p.score),n.length===0||n[0].score<=0)return;let r=n[0].provider,s=await r.provideChatContext(e,t,Se.None);if(!s)return;let l=s.resourceUri??e,u={value:void 0,name:s.label??He(l),icon:s.icon,uri:e,resourceUri:s.resourceUri,modelDescription:s.modelDescription,tooltip:s.tooltip,commandId:s.command?.id,handle:s.handle};return this._lastResourceContext.clear(),this._lastResourceContext.set(u,{originalItem:s,provider:r}),u}async resolveChatContext(e,t){if(e.value!==void 0)return e;let o=this._lastResourceContext.get(e);if(o){let n=await o.provider.resolveChatContext(o.originalItem,Se.None);if(n)return e.value=n.value,e.modelDescription=n.modelDescription,e.tooltip=n.tooltip,e}else{let n=await this._contextForResource(e.uri,!0,t);return e.value=n?.value,e.modelDescription=n?.modelDescription,e.tooltip=n?.tooltip,e}return e}_asPicker(e,t,o){return{asPicker:()=>{let s=this._providers.get(o);if(!s)throw new Error("No chat context provider registered");return{picks:(async()=>s&&!s.explicitProvider&&(await this._extensionService.activateByEvent(`onChatContextProvider:${o}`),s=this._providers.get(o),!s?.explicitProvider)?[]:await s?.explicitProvider.provideChatContext(Se.None)||[])().then(c=>c.map(u=>({label:u.label??(u.resourceUri?He(u.resourceUri):"Unknown"),iconClass:u.icon?q.asClassName(u.icon):void 0,asAttachment:async()=>{let h=u;h.value===void 0&&s?.explicitProvider&&(h=await s.explicitProvider.resolveChatContext(u,Se.None));let g=h.label??(h.resourceUri?He(h.resourceUri):"Unknown");return{kind:"generic",id:g,name:g,icon:h.icon,value:h.value}}}))),placeholder:e}},type:"pickerPick",label:e,icon:t}}};uXe=I([m(0,DS),m(1,lt)],uXe);Ee(ED,uXe,1);function NNt(a){return{...a,resourceUri:a.resourceUri?A.revive(a.resourceUri):void 0}}function xSi(a){return a.map(NNt)}var ANt=class extends x{constructor(e,t){super();this._chatContextService=t;this._providers=new Map;this._proxy=e.getProxy(to.ExtHostChatContext),this._chatContextService.setExecuteCommandCallback(o=>this._proxy.$executeChatContextItemCommand(o))}$registerChatWorkspaceContextProvider(e,t){this._providers.set(e,{id:t}),this._chatContextService.registerChatWorkspaceContextProvider(t,{provideWorkspaceChatContext:async o=>{let n=await this._proxy.$provideWorkspaceChatContext(e,o);return xSi(n)}})}$registerChatExplicitContextProvider(e,t){this._providers.set(e,{id:t}),this._chatContextService.registerChatExplicitContextProvider(t,{provideChatContext:async o=>{let n=await this._proxy.$provideExplicitChatContext(e,o);return xSi(n)},resolveChatContext:async(o,n)=>{let r=await this._proxy.$resolveExplicitChatContext(e,o,n);return NNt(r)}})}$registerChatResourceContextProvider(e,t,o){this._providers.set(e,{id:t,selector:o}),this._chatContextService.registerChatResourceContextProvider(t,o,{provideChatContext:async(n,r,s)=>{let l=await this._proxy.$provideResourceChatContext(e,{resource:n,withValue:r},s);return l?NNt(l):void 0},resolveChatContext:async(n,r)=>{let s=await this._proxy.$resolveResourceChatContext(e,n,r);return NNt(s)}})}$unregisterChatContextProvider(e){let t=this._providers.get(e);t&&(this._chatContextService.unregisterChatContextProvider(t.id),this._providers.delete(e))}$updateWorkspaceContextItems(e,t){let o=this._providers.get(e);o&&this._chatContextService.updateWorkspaceContextItems(o.id,xSi(t))}$executeChatContextItemCommand(e){return this._proxy.$executeChatContextItemCommand(e)}};ANt=I([fo(qi.MainThreadChatContext),m(1,ED)],ANt);var Yp=le("chatDebugService");var ONt=class extends x{constructor(e,t,o){super();this._chatDebugService=t;this._chatService=o;this._providerDisposables=new Map;this._activeSessionResources=new Map;this._coreEventForwarder=this._register(new me);this._proxy=e.getProxy(to.ExtHostChatDebug)}$subscribeToCoreDebugEvents(){this._coreEventForwarder.value=this._chatDebugService.onDidAddEvent(e=>{this._chatDebugService.isCoreEvent(e)&&this._proxy.$onCoreDebugEvent(this._serializeEvent(e))})}$unsubscribeFromCoreDebugEvents(){this._coreEventForwarder.clear()}$registerChatDebugLogProvider(e){let t=new N;this._providerDisposables.set(e,t),t.add(this._chatDebugService.registerProvider({provideChatDebugLog:async(o,n)=>(this._activeSessionResources.set(e,o),(await this._proxy.$provideChatDebugLog(e,o,n))?.map(s=>this._reviveEvent(s,o))),resolveChatDebugLogEvent:async(o,n)=>{let r=await this._proxy.$resolveChatDebugLogEvent(e,o,n);return r?this._reviveResolvedContent(r):void 0},provideChatDebugLogExport:async(o,n)=>{let r=this._chatDebugService.getEvents(o).filter(c=>this._chatDebugService.isCoreEvent(c)).map(c=>this._serializeEvent(c)),s=this._chatService.getSessionTitle(o);return(await this._proxy.$exportChatDebugLog(e,o,r,s,n))?.buffer},resolveChatDebugLogImport:async(o,n)=>{let r=await this._proxy.$importChatDebugLog(e,qe.wrap(o),n);if(!r)return;let s=A.revive(r.uri);return r.sessionTitle&&this._chatDebugService.setImportedSessionTitle(s,r.sessionTitle),s}}))}$unregisterChatDebugLogProvider(e){this._providerDisposables.get(e)?.dispose(),this._providerDisposables.delete(e),this._activeSessionResources.delete(e)}$acceptChatDebugEvent(e,t){let o=(t.sessionResource?A.revive(t.sessionResource):void 0)??this._activeSessionResources.get(e)??this._chatDebugService.activeSessionResource;if(!o)return;let n=this._reviveEvent(t,o);this._chatDebugService.addProviderEvent(n)}_serializeEvent(e){let t={id:e.id,sessionResource:e.sessionResource,created:e.created.getTime(),parentEventId:e.parentEventId};switch(e.kind){case"toolCall":return{...t,kind:"toolCall",toolName:e.toolName,toolCallId:e.toolCallId,input:e.input,output:e.output,result:e.result,durationInMillis:e.durationInMillis};case"modelTurn":return{...t,kind:"modelTurn",model:e.model,requestName:e.requestName,inputTokens:e.inputTokens,outputTokens:e.outputTokens,totalTokens:e.totalTokens,durationInMillis:e.durationInMillis};case"generic":return{...t,kind:"generic",name:e.name,details:e.details,level:e.level,category:e.category};case"subagentInvocation":return{...t,kind:"subagentInvocation",agentName:e.agentName,description:e.description,status:e.status,durationInMillis:e.durationInMillis,toolCallCount:e.toolCallCount,modelTurnCount:e.modelTurnCount};case"userMessage":return{...t,kind:"userMessage",message:e.message,sections:e.sections.map(o=>({name:o.name,content:o.content}))};case"agentResponse":return{...t,kind:"agentResponse",message:e.message,sections:e.sections.map(o=>({name:o.name,content:o.content}))}}}_reviveEvent(e,t){let o={id:e.id,sessionResource:t,created:new Date(e.created),parentEventId:e.parentEventId};switch(e.kind){case"toolCall":return{...o,kind:"toolCall",toolName:e.toolName,toolCallId:e.toolCallId,input:e.input,output:e.output,result:e.result,durationInMillis:e.durationInMillis};case"modelTurn":return{...o,kind:"modelTurn",model:e.model,requestName:e.requestName,inputTokens:e.inputTokens,outputTokens:e.outputTokens,totalTokens:e.totalTokens,durationInMillis:e.durationInMillis};case"generic":return{...o,kind:"generic",name:e.name,details:e.details,level:e.level,category:e.category};case"subagentInvocation":return{...o,kind:"subagentInvocation",agentName:e.agentName,description:e.description,status:e.status,durationInMillis:e.durationInMillis,toolCallCount:e.toolCallCount,modelTurnCount:e.modelTurnCount};case"userMessage":return{...o,kind:"userMessage",message:e.message,sections:e.sections};case"agentResponse":return{...o,kind:"agentResponse",message:e.message,sections:e.sections}}}_reviveResolvedContent(e){switch(e.kind){case"text":return{kind:"text",value:e.value};case"message":return{kind:"message",type:e.type,message:e.message,sections:e.sections};case"toolCall":return{kind:"toolCall",toolName:e.toolName,result:e.result,durationInMillis:e.durationInMillis,input:e.input,output:e.output};case"modelTurn":return{kind:"modelTurn",requestName:e.requestName,model:e.model,status:e.status,durationInMillis:e.durationInMillis,inputTokens:e.inputTokens,outputTokens:e.outputTokens,cachedTokens:e.cachedTokens,totalTokens:e.totalTokens,errorMessage:e.errorMessage,sections:e.sections};case"hook":return{kind:"hook",hookType:e.hookType,command:e.command,result:e.result==="success"?0:e.result==="error"?1:e.result==="nonBlockingError"?2:void 0,durationInMillis:e.durationInMillis,input:e.input,output:e.output,exitCode:e.exitCode,errorMessage:e.errorMessage}}}};ONt=I([fo(qi.MainThreadChatDebug),m(1,Yp),m(2,mi)],ONt);var pXe=le("chatStatusItemService"),kSi=class{constructor(){this._entries=new Map;this._onDidChange=new E;this.onDidChange=this._onDidChange.event}setOrUpdateEntry(i){let e=this._entries.has(i.id);this._entries.set(i.id,i),e&&this._onDidChange.fire({entry:i})}deleteEntry(i){this._entries.delete(i)}getEntries(){return this._entries.values()}};Ee(pXe,kSi,1);var FNt=class extends x{constructor(e,t){super();this._chatStatusItemService=t}$setEntry(e,t){this._chatStatusItemService.setOrUpdateEntry({id:e,label:t.title,description:t.description,detail:t.detail})}$disposeEntry(e){this._chatStatusItemService.deleteEntry(e)}};FNt=I([fo(qi.MainThreadChatStatus),m(1,pXe)],FNt);function Ipe(a){return a?a instanceof Array?a.length>0:a.files>0||a.insertions>0||a.deletions>0:!1}function DDe(a){if(!a)return;if(!(a instanceof Array))return a;let i=0,e=0;for(let t of a)i+=t.insertions,e+=t.deletions;return{files:a.length,insertions:i,deletions:e}}function LDe(a){return a.providerType==="local"}function d0(a){let i=a;return A.isUri(i?.resource)&&typeof i.isArchived=="function"&&typeof i.setArchived=="function"&&typeof i.isPinned=="function"&&typeof i.setPinned=="function"&&typeof i.isRead=="function"&&typeof i.isMarkedUnread=="function"&&typeof i.setRead=="function"}function WNt(a){let i=a;return Array.isArray(i?.sessions)&&typeof i?.getSession=="function"}function LS(a){let i=a;return typeof i.section=="string"&&Array.isArray(i.sessions)}function u0(a){return a?.showMore===!0}function p0(a){return a?.showLess===!0}function VNt(a){if(typeof a=="object"&&a!==null){let i=a;return i.$mid===25&&typeof i.session=="object"&&i.session!==null}return!1}var ESi="agentSessionsOutput",e8o=d(6106,null);function t8o(a){switch(a){case 0:return"Failed";case 1:return"Completed";case 2:return"InProgress";case 3:return"NeedsInput";default:return`Unknown(${a})`}}var mXe=class extends x{constructor(e,t,o,n){super();this.getSessionsData=e;this.logService=t;this.outputService=o;this.chatEntitlementService=n;this.isChannelRegistered=!1;this.updateChannelRegistration(),this.registerListeners()}updateChannelRegistration(){let e=this.chatEntitlementService.sentiment.hidden;e&&this.isChannelRegistered?(ne.as(Hv.OutputChannels).removeChannel(ESi),this.isChannelRegistered=!1):!e&&!this.isChannelRegistered&&(ne.as(Hv.OutputChannels).registerChannel({id:ESi,label:e8o,log:!1}),this.isChannelRegistered=!0)}registerListeners(){this._register(this.logService.onDidChangeLogLevel(e=>{e===1&&this.logAllStatsIfTrace("Log level changed to trace")})),this._register(this.chatEntitlementService.onDidChangeSentiment(()=>{this.updateChannelRegistration()}))}logIfTrace(e){this.logService.getLevel()===1&&this.trace(`[Agent Sessions] ${e}`)}logAllStatsIfTrace(e){this.logService.getLevel()===1&&(this.logAllSessions(e),this.logSessionStates())}logAllSessions(e){let{sessions:t,sessionStates:o}=this.getSessionsData(),n=[];n.push(`=== Agent Sessions (${e}) ===`);let r=0;for(let s of t){r++;let l=o.get(s.resource);if(n.push(`--- Session: ${s.label} ---`),n.push(`  Resource: ${s.resource.toString()}`),n.push(`  Provider Type: ${s.providerType}`),n.push(`  Provider Label: ${s.providerLabel}`),n.push(`  Status: ${t8o(s.status)}`),n.push(`  Icon: ${s.icon.id}`),s.description&&n.push(`  Description: ${typeof s.description=="string"?s.description:s.description.value}`),s.badge&&n.push(`  Badge: ${typeof s.badge=="string"?s.badge:s.badge.value}`),s.tooltip&&n.push(`  Tooltip: ${typeof s.tooltip=="string"?s.tooltip:s.tooltip.value}`),n.push("  Timing:"),n.push(`    Created: ${s.timing.created?new Date(s.timing.created).toISOString():"N/A"}`),n.push(`    Last Request Started: ${s.timing.lastRequestStarted?new Date(s.timing.lastRequestStarted).toISOString():"N/A"}`),n.push(`    Last Request Ended: ${s.timing.lastRequestEnded?new Date(s.timing.lastRequestEnded).toISOString():"N/A"}`),s.changes){let c=DDe(s.changes);c&&n.push(`  Changes: ${c.files} files, +${c.insertions} -${c.deletions}`)}if(s.metadata&&Object.keys(s.metadata).length>0){n.push("  Metadata:");for(let[c,u]of Object.entries(s.metadata)){let p=typeof u=="string"?u:CV(u);n.push(`    ${c}: ${p}`)}}n.push("  State:"),n.push(`    Archived (provider): ${s.archived??"N/A"}`),n.push(`    Archived (computed): ${s.isArchived()}`),n.push(`    Archived (stored): ${l?.archived??"N/A"}`),n.push(`    Pinned: ${s.isPinned()}`),n.push(`    Pinned (stored): ${l?.pinned??"N/A"}`),n.push(`    Read: ${s.isRead()}`),n.push(`    Read date (stored): ${l?.read?new Date(l.read).toISOString():"N/A"}`),n.push("")}n.unshift(`Total sessions: ${r}`,""),n.push("=== End Agent Sessions ==="),this.trace(n.join(`
`))}logSessionStates(){let{sessionStates:e}=this.getSessionsData(),t=[];t.push("=== Session States ==="),t.push(`Total stored states: ${e.size}`),t.push("");for(let[o,n]of e)t.push(`URI: ${o.toString()}`),t.push(`  Archived: ${n.archived}`),t.push(`  Pinned: ${n.pinned}`),t.push(`  Read: ${n.read?new Date(n.read).toISOString():"0 (unread)"}`),t.push("");t.push("=== End Session States ==="),this.trace(t.join(`
`))}trace(e){let t=this.outputService.getChannel(ESi);t&&t.append(`${e}
`)}};mXe=I([m(1,se),m(2,kl),m(3,rr)],mXe);var RA=class extends x{constructor(e,t,o,n,r,s,l,c,u){super();this.chatSessionsService=e;this.lifecycleService=t;this.instantiationService=o;this.storageService=n;this.productService=r;this.chatWidgetService=s;this.workspaceContextService=l;this.workspaceTrustManagementService=c;this.chatEntitlementService=u;this._onWillResolve=this._register(new E);this.onWillResolve=this._onWillResolve.event;this._onDidResolve=this._register(new E);this.onDidResolve=this._onDidResolve.event;this._onDidChangeSessions=this._register(new E);this.onDidChangeSessions=this._onDidChangeSessions.event;this._onDidChangeSessionArchivedState=this._register(new E);this.onDidChangeSessionArchivedState=this._onDidChangeSessionArchivedState.event;this._resolved=!1;this.resolvers=this._register(new Vt);this._sessions=new gt,this.cache=this.instantiationService.createInstance(w2);for(let p of this.cache.loadCachedSessions()){let h=this.toAgentSession(p);this._sessions.set(h.resource,h)}this.sessionStates=this.cache.loadSessionStates(),this.logger=this._register(this.instantiationService.createInstance(mXe,()=>({sessions:this._sessions.values(),sessionStates:this.sessionStates}))),this.logger.logAllStatsIfTrace("Loaded cached sessions"),this.readDateBaseline=this.resolveReadDateBaseline(),this.registerListeners()}get resolved(){return this._resolved}get sessions(){return Array.from(this._sessions.values())}registerListeners(){this._register(this.chatSessionsService.onDidChangeItemsProviders(({chatSessionType:e})=>this.resolve(e))),this._register(this.chatSessionsService.onDidChangeAvailability(()=>this.resolve(void 0))),this._register(this.chatSessionsService.onDidChangeSessionItems(e=>{let t=new Set;for(let o of e.addedOrUpdated??[])t.add(gl(o.resource));for(let o of e.removed??[])t.add(gl(o));for(let o of t)this.resolveProvider(o,{refreshProvider:!1})})),this._register(this.workspaceContextService.onDidChangeWorkspaceFolders(()=>this.resolve(void 0))),this._register(this.workspaceTrustManagementService.onDidChangeTrust(()=>this.resolve(void 0))),this._register(this.storageService.onWillSaveState(()=>{this.cache.saveCachedSessions(Array.from(this._sessions.values())),this.cache.saveSessionStates(this.sessionStates)}))}getSession(e){return this._sessions.get(e)}async resolve(e){let t=Array.isArray(e)?e:e!==void 0?[e]:this.chatSessionsService.getRegisteredChatSessionItemProviders();await Promise.all(t.map(o=>this.resolveProvider(o,{refreshProvider:!0})))}resolveProvider(e,t){if(this.chatEntitlementService.sentiment.hidden)return Promise.resolve();let o=this.resolvers.get(e);return o||(o=new ya(500),this.resolvers.set(e,o)),o.trigger(async n=>{if(!(n.isCancellationRequested||this.lifecycleService.willShutdown))try{return this._onWillResolve.fire(e),await this.doResolveProvider(e,t,n)}catch(r){this.logger.logIfTrace(`Error resolving sessions for provider ${e}: ${r instanceof Error?r.stack:String(r)}`)}finally{this._onDidResolve.fire(e)}})}async doResolveProvider(e,t,o){t.refreshProvider&&await this.chatSessionsService.refreshChatSessionItems([e],o);let n=new Map;for(let s of this.chatSessionsService.getAllChatSessionContributions())n.set(s.type,s);let r=new gt;for await(let{chatSessionType:s,items:l}of this.chatSessionsService.getChatSessionItems([e],o)){if(o.isCancellationRequested)return;for(let c of l){let u,p,h=lg(s);h!==void 0?(p=IS(h),u=lT(h)):(p=n.get(s)?.name??s,u=c.iconPath??R.terminal);let g=c.changes,f=g&&!(g instanceof Array)?{files:g.files,insertions:g.insertions,deletions:g.deletions}:g;r.set(c.resource,this.toAgentSession({providerType:s,providerLabel:p,resource:c.resource,label:c.label.split(`
`)[0],description:c.description,icon:u,badge:c.badge,tooltip:c.tooltip,status:c.status??1,archived:c.archived,timing:c.timing,changes:f,metadata:c.metadata}))}}for(let[,s]of this._sessions)s.providerType!==e&&!r.has(s.resource)&&(Aeo(s.providerType)||n.has(s.providerType))&&r.set(s.resource,s);this._sessions=r,this._resolved=!0,this.logger.logAllStatsIfTrace("Sessions resolved from providers"),this._onDidChangeSessions.fire()}toAgentSession(e){return{...e,isArchived:()=>this.isArchived(e),setArchived:t=>this.setArchived(e,t),isPinned:()=>this.isPinned(e),setPinned:t=>this.setPinned(e,t),isRead:()=>this.isRead(e),isMarkedUnread:()=>this.isMarkedUnread(e),setRead:t=>this.setRead(e,t)}}static{this.UNREAD_MARKER=-1}isArchived(e){return this.sessionStates.get(e.resource)?.archived??!!e.archived}setArchived(e,t){if(t&&this.setRead(e,!0),t===this.isArchived(e))return;let o=this.sessionStates.get(e.resource)??{};this.sessionStates.set(e.resource,{...o,archived:t});let n=this._sessions.get(e.resource);n&&this._onDidChangeSessionArchivedState.fire(n),this._onDidChangeSessions.fire()}isPinned(e){return this.sessionStates.get(e.resource)?.pinned??!1}setPinned(e,t){if(t===this.isPinned(e))return;let o=this.sessionStates.get(e.resource)??{};this.sessionStates.set(e.resource,{...o,pinned:t}),this._onDidChangeSessions.fire()}isMarkedUnread(e){return this.sessionStates.get(e.resource)?.read===RA.UNREAD_MARKER}isRead(e){if(this.isArchived(e))return!0;let t=this.sessionStates.get(e.resource)?.read;return t===RA.UNREAD_MARKER?!1:Math.max(t??0,this.readDateBaseline)>=this.sessionTimeForReadStateTracking(e)-2e3?!0:!!this.chatWidgetService.getWidgetBySessionResource(e.resource)}sessionTimeForReadStateTracking(e){return e.timing.lastRequestEnded??e.timing.created}setRead(e,t,o){let n=this.sessionStates.get(e.resource)??{},r;if(t){if(r=Math.max(Date.now(),this.sessionTimeForReadStateTracking(e)),typeof n.read=="number"&&n.read>=r)return}else if(r=RA.UNREAD_MARKER,n.read===RA.UNREAD_MARKER)return;this.sessionStates.set(e.resource,{...n,read:r}),o||this._onDidChangeSessions.fire()}static{this.READ_DATE_BASELINE_KEY="agentSessions.readDateBaseline2"}resolveReadDateBaseline(){let e=this.storageService.getNumber(RA.READ_DATE_BASELINE_KEY,1,0);return e>0||(e=this.productService.quality==="stable"?Date.now()-10080*60*1e3:Date.now(),this.storageService.store(RA.READ_DATE_BASELINE_KEY,e,1,1)),e}};RA=I([m(0,Us),m(1,ji),m(2,F),m(3,ce),m(4,tt),m(5,Pt),m(6,Pe),m(7,Nr),m(8,rr)],RA);var w2=class{constructor(i){this.storageService=i}static{this.SESSIONS_STORAGE_KEY="agentSessions.model.cache"}static{this.STATE_STORAGE_KEY="agentSessions.state.cache"}saveCachedSessions(i){let e=i.map(t=>({providerType:t.providerType,providerLabel:t.providerLabel,resource:t.resource.toString(),icon:t.icon.id,label:t.label,description:t.description,badge:t.badge,tooltip:t.tooltip,status:HC(t.status)?1:t.status,archived:t.archived,timing:t.timing,changes:t.changes,metadata:t.metadata}));this.storageService.store(w2.SESSIONS_STORAGE_KEY,CV(e),1,1)}loadCachedSessions(){let i=this.storageService.get(w2.SESSIONS_STORAGE_KEY,1);if(!i)return[];try{return JSON.parse(i).map(t=>({providerType:t.providerType,providerLabel:t.providerLabel,resource:typeof t.resource=="string"?A.parse(t.resource):A.revive(t.resource),icon:q.fromId(t.icon),label:t.label,description:t.description,badge:t.badge,tooltip:t.tooltip,status:t.status,archived:t.archived,timing:{created:t.timing.created??0,lastRequestStarted:t.timing.lastRequestStarted,lastRequestEnded:t.timing.lastRequestEnded},changes:Array.isArray(t.changes)?t.changes.map(o=>({modifiedUri:A.revive(o.modifiedUri),originalUri:o.originalUri?A.revive(o.originalUri):void 0,insertions:o.insertions,deletions:o.deletions})):t.changes,metadata:t.metadata}))}catch{return[]}}saveSessionStates(i){let e=Array.from(i.entries()).map(([t,o])=>({resource:t.toString(),archived:o.archived,pinned:o.pinned,read:o.read}));this.storageService.store(w2.STATE_STORAGE_KEY,JSON.stringify(e),1,1)}loadSessionStates(){let i=new gt,e=this.storageService.get(w2.STATE_STORAGE_KEY,1);if(!e)return i;try{let t=JSON.parse(e);for(let o of t)i.set(typeof o.resource=="string"?A.parse(o.resource):A.revive(o.resource),{archived:o.archived,pinned:o.pinned,read:o.read})}catch{}return i}};w2=I([m(0,ce)],w2);var RDe=class extends x{constructor(e,t){super();this.instantiationService=e;this.chatService=t;this._onDidChangeSessionArchivedState=this._register(new E);this.onDidChangeSessionArchivedState=this._onDidChangeSessionArchivedState.event}get model(){return this._model||(this._model=this._register(this.instantiationService.createInstance(RA)),this._register(this._model.onDidChangeSessionArchivedState(e=>{e.isArchived()&&this.chatService.cancelCurrentRequestForSession(e.resource,"archive"),this._onDidChangeSessionArchivedState.fire(e)})),this._model.resolve(void 0)),this._model}getSession(e){return this.model.getSession(e)}};RDe=I([m(0,F),m(1,mi)],RDe);var md=le("agentSessions");function BNt(a){let i=a.getRequests();if(i.length===0)return;let t=i.at(-1)?.response;if(!t||t.isComplete)return;let o=t.response.value,n="";for(let r=o.length-1;r>=0;r--){let s=o[r];if(n)break;if(s.kind==="confirmation"&&typeof s.message=="string")n=s.message;else if(s.kind==="toolInvocation"){let l=s,c=l.state.get();if(n=l.generatedTitle||l.pastTenseMessage||l.invocationMessage,c.type===Pi.StateKind.WaitingForConfirmation){let u=c.confirmationMessages?.title,p=u&&(typeof u=="string"?u:u.value),h=typeof n=="string"?n:n.value;n=p??d(7130,null,h)}}else s.kind==="toolInvocationSerialized"?n=s.invocationMessage:s.kind==="progressMessage"?n=s.content:s.kind==="thinking"&&(n=d(7129,null))}return n?Da(n,{useLinkFormatter:!0}):""}var eH=class{constructor(i,e){this._scmService=i;this._activityService=e}static{this._scheme="scm-multi-diff-source"}static getMultiDiffSourceUri(i,e){return A.from({scheme:eH._scheme,query:JSON.stringify({repositoryUri:i,groupId:e})})}static parseUri(i){if(i.scheme!==eH._scheme)return;let e;try{e=JSON.parse(i.query)}catch{return}if(typeof e!="object"||e===null)return;let{repositoryUri:t,groupId:o}=e;if(!(typeof t!="string"||typeof o!="string"))return{repositoryUri:A.parse(t),groupId:o}}canHandleUri(i){return eH.parseUri(i)!==void 0}async resolveDiffSource(i){let{repositoryUri:e,groupId:t}=eH.parseUri(i),o=await Wf(ui(this,this._scmService.onDidAddRepository,()=>[...this._scmService.repositories].find(l=>l.provider.rootUri?.toString()===e.toString()))),n=await Wf(ui(this,o.provider.onDidChangeResourceGroups,()=>o.provider.groups.find(l=>l.id===t))),s=ui(this._activityService.onDidChangeActivity,()=>[...this._activityService.getViewContainerActivities("workbench.view.scm")]).map(l=>!l.some(c=>c.badge instanceof sx));return await Wf(s,l=>l),new TSi(n,o)}};eH=I([m(0,rd),m(1,Sl)],eH);var ax=class{constructor(i){this._scmService=i}static{this.scheme="scm-history-item"}static getMultiDiffSourceUri(i,e,t,o){return A.from({scheme:ax.scheme,path:i.rootUri?.fsPath,query:JSON.stringify({repositoryId:i.id,historyItemId:e,historyItemParentId:t,historyItemDisplayId:o})},!0)}static parseUri(i){if(i.scheme!==ax.scheme)return;let e;try{e=JSON.parse(i.query)}catch{return}if(typeof e!="object"||e===null)return;let{repositoryId:t,historyItemId:o,historyItemParentId:n,historyItemDisplayId:r}=e;if(!(typeof t!="string"||typeof o!="string"||typeof n!="string"&&n!==void 0||typeof r!="string"&&r!==void 0))return{repositoryId:t,historyItemId:o,historyItemParentId:n,historyItemDisplayId:r}}canHandleUri(i){return ax.parseUri(i)!==void 0}async resolveDiffSource(i){let{repositoryId:e,historyItemId:t,historyItemParentId:o,historyItemDisplayId:n}=ax.parseUri(i),l=await this._scmService.getRepository(e)?.provider.historyProvider.get()?.provideHistoryItemChanges(t,o)??[];return{resources:eIe.const(l.map(u=>{let p=u.modifiedUri?`${jo(u.modifiedUri.fsPath)} (${n??t})`:void 0;return new xk(u.originalUri,u.modifiedUri,u.modifiedUri,p)}))}}};ax=I([m(0,rd)],ax);var TSi=class{constructor(i,e){this._group=i;this._repository=e;this._resources=ui(this._group.onDidChangeResources,()=>this._group.resources.map(t=>new xk(t.multiDiffEditorOriginalUri,t.multiDiffEditorModifiedUri,t.sourceUri))),this.resources=new sO(this._resources),this.contextKeys={scmResourceGroup:this._group.id,scmProvider:this._repository.provider.providerId}}},ype=class extends x{static{this.ID="workbench.contrib.scmMultiDiffSourceResolver"}constructor(i,e){super(),this._register(e.registerResolver(i.createInstance(ax))),this._register(e.registerResolver(i.createInstance(eH)))}};ype=I([m(0,F),m(1,XK)],ype);var MDe=class a extends K{static async openMultiFileDiffEditor(i,e,t,o,n){if(!t)return;let r=eH.getMultiDiffSourceUri(t.toString(),o);return await i.openEditor({label:e,multiDiffSource:r,options:n})}constructor(){super({id:"_workbench.openScmMultiDiffEditor",title:L(12292,"Open Changes"),f1:!1})}async run(i,e){let t=i.get(ee);await a.openMultiFileDiffEditor(t,e.title,A.revive(e.repositoryUri),e.resourceGroupId)}};function Fso(a){if(!a.dataTransfer?.types.includes(hc.SCM_HISTORY_ITEM))return;let i=a.dataTransfer?.getData(hc.SCM_HISTORY_ITEM);if(i)return JSON.parse(i)}var wpe=class extends x{static{this.ID="workbench.contrib.chat.scmHistoryItemContextContribution"}constructor(i,e,t){super(),this._store.add(i.registerChatContextItem(e.createInstance(a3))),this._store.add(t.registerTextModelContentProvider(ax.scheme,e.createInstance(hXe))),this._store.add(t.registerTextModelContentProvider(C2.scheme,e.createInstance(C2)))}};wpe=I([m(0,DS),m(1,F),m(2,Bt)],wpe);var a3=class{constructor(i){this._scmViewService=i;this.type="pickerPick";this.label=d(13749,null);this.icon=R.gitCommit;this._delayer=new ya(200)}static asAttachment(i,e){let t=e.parentIds.length>0?e.parentIds[0]:void 0,o=ax.getMultiDiffSourceUri(i,e.id,t,e.displayId),n=`$(${R.repo.id})\xA0${i.name}\xA0$(${R.gitCommit.id})\xA0${e.displayId??e.id}`;return{id:e.id,name:n,value:o,historyItem:{...e,references:[]},kind:"scmHistoryItem"}}isEnabled(i){let e=this._scmViewService.activeRepository.get(),t=!!i.attachmentCapabilities.supportsSourceControlAttachments;return e?.repository.provider.historyProvider.get()!==void 0&&t}asPicker(i){return{placeholder:d(13750,null),picks:Spe((e,t)=>{let o=e.trim()!==""?e.trim():void 0,n=this._scmViewService.activeRepository.get(),r=n?.repository.provider.historyProvider.get();if(!n||!r)return Promise.resolve([]);let s=di([r.historyItemRef.get(),r.historyItemRemoteRef.get(),r.historyItemBaseRef.get()]).map(l=>l.id);return this._delayer.trigger(()=>r.provideHistoryItems({historyItemRefs:s,filterText:o,limit:100},t).then(l=>l?l.map(c=>{let u=[`${c.displayId??c.id}`];return c.author&&u.push(c.author),c.statistics&&u.push(`${c.statistics.files} ${d(13751,null)}`),c.timestamp&&u.push(ea(c.timestamp,!0,!0)),{iconClass:q.asClassName(R.gitCommit),label:c.subject,detail:u.join(`$(${R.circleSmallFilled.id})`),asAttachment:()=>a3.asAttachment(n.repository.provider,c)}}):[]))})}}};a3=I([m(0,_u)],a3);var hXe=class{constructor(i,e){this._modelService=i;this._scmService=e}async provideTextContent(i){let e=ax.parseUri(i);if(!e)return null;let t=this._modelService.getModel(i);if(t)return t;let{repositoryId:o,historyItemId:n}=e,r=this._scmService.getRepository(o),s=r?.provider.historyProvider.get();if(!r||!s)return null;let l=await s.resolveHistoryItemChatContext(n);return l?this._modelService.createModel(l,null,i,!1):null}};hXe=I([m(0,Tt),m(1,rd)],hXe);var C2=class{constructor(i,e){this._modelService=i;this._scmService=e}static{this.scheme="scm-history-item-change-range"}async provideTextContent(i){let e=this._parseUri(i);if(!e)return null;let t=this._modelService.getModel(i);if(t)return t;let{repositoryId:o,start:n,end:r}=e,s=this._scmService.getRepository(o),l=s?.provider.historyProvider.get();if(!s||!l)return null;let c=await l.resolveHistoryItemChangeRangeChatContext(r,n,i.path);return c?this._modelService.createModel(c,null,i,!1):null}_parseUri(i){if(i.scheme!==C2.scheme)return;let e;try{e=JSON.parse(i.query)}catch{return}if(typeof e!="object"||e===null)return;let{repositoryId:t,start:o,end:n}=e;if(!(typeof t!="string"||typeof o!="string"||typeof n!="string"))return{repositoryId:t,start:o,end:n}}};C2=I([m(0,Tt),m(1,rd)],C2);W(class extends K{constructor(){super({id:"workbench.scm.action.graph.addHistoryItemToChat",title:d(13747,null),f1:!1,menu:{id:D.SCMHistoryItemContext,group:"z_chat",order:1,when:ie.enabled}})}async run(a,i,e){let o=await a.get(Pt).revealWidget();!i||!e||!o||o.attachmentModel.addContext(a3.asAttachment(i,e))}});W(class extends K{constructor(){super({id:"workbench.scm.action.graph.summarizeHistoryItem",title:d(13748,null),f1:!1,menu:{id:D.SCMHistoryItemContext,group:"z_chat",order:2,when:ie.enabled}})}async run(a,i,e){let o=await a.get(Pt).revealWidget();!i||!e||!o||(o.attachmentModel.addContext(a3.asAttachment(i,e)),await o.acceptInput("Summarize the attached history item"))}});W(class extends K{constructor(){super({id:"workbench.scm.action.graph.addHistoryItemChangeToChat",title:d(13747,null),f1:!1,menu:{id:D.SCMHistoryItemChangeContext,group:"z_chat",order:1,when:ie.enabled}})}async run(a,i,e){let o=await a.get(Pt).revealWidget();!i||!e.modifiedUri||!o||o.attachmentModel.addContext({id:e.uri.toString(),name:`${He(e.modifiedUri)}`,value:e.modifiedUri,historyItem:i,kind:"scmHistoryItemChange"})}});function Wso(a,i=[],e={}){let o=new _Si(a).scan();return new DSi(o,a,i,e).parse()}function fI(a,i,e,t){return{type:a,startOffset:i,endOffset:e,rawValue:t?.rawValue??"",value:t?.value??"",format:t?.format??"none",indent:t?.indent??0}}var _Si=class{constructor(i){this.input=i;this.pos=0;this.tokens=[];this.flowDepth=0;this.seenBlockColon=!1}scan(){for(;this.pos<this.input.length;)this.scanLine();return this.tokens.push(fI(13,this.pos,this.pos)),this.tokens}scanLine(){if(this.seenBlockColon=!1,this.peekChar()===`
`){this.tokens.push(fI(8,this.pos,this.pos+1)),this.pos++;return}if(this.peekChar()==="\r"){let t=this.pos+(this.input[this.pos+1]===`
`?2:1);this.tokens.push(fI(8,this.pos,t)),this.pos=t;return}let i=this.pos,e=0;for(;this.pos<this.input.length&&(this.input[this.pos]===" "||this.input[this.pos]==="	");)e++,this.pos++;if(e>0&&this.tokens.push(fI(9,i,this.pos,{indent:e})),this.pos>=this.input.length||this.peekChar()===`
`||this.peekChar()==="\r"){if(this.pos<this.input.length){let t=this.pos,o=this.peekChar()==="\r"&&this.input[this.pos+1]===`
`?this.pos+2:this.pos+1;this.tokens.push(fI(8,t,o)),this.pos=o}return}if(e===0&&this.input.length-this.pos>=3){let t=this.input[this.pos],o=this.input[this.pos+1],n=this.input[this.pos+2],r=this.input[this.pos+3],s=r===void 0||r===" "||r==="	"||r===`
`||r==="\r";if(t==="-"&&o==="-"&&n==="-"&&s){this.tokens.push(fI(11,this.pos,this.pos+3)),this.pos+=3,this.scanLineContent(),this.scanNewline();return}if(t==="."&&o==="."&&n==="."&&s){this.tokens.push(fI(12,this.pos,this.pos+3)),this.pos+=3,this.scanLineContent(),this.scanNewline();return}}if(this.peekChar()==="#"){this.scanComment(),this.scanNewline();return}if(this.peekChar()==="%"){for(;this.pos<this.input.length&&this.input[this.pos]!==`
`&&this.input[this.pos]!=="\r";)this.pos++;this.scanNewline();return}this.scanLineContent(),this.scanNewline()}scanLineContent(){for(;this.pos<this.input.length&&this.peekChar()!==`
`&&this.peekChar()!=="\r"&&(this.skipInlineWhitespace(),!(this.pos>=this.input.length||this.peekChar()===`
`||this.peekChar()==="\r"));){let i=this.peekChar();if(i==="#"){this.scanComment();break}else if(i==="{")this.flowDepth++,this.tokens.push(fI(4,this.pos,this.pos+1)),this.pos++;else if(i==="}"&&this.flowDepth>0)this.flowDepth--,this.tokens.push(fI(5,this.pos,this.pos+1)),this.pos++;else if(i==="[")this.flowDepth++,this.tokens.push(fI(6,this.pos,this.pos+1)),this.pos++;else if(i==="]"&&this.flowDepth>0)this.flowDepth--,this.tokens.push(fI(7,this.pos,this.pos+1)),this.pos++;else if(i===","&&this.flowDepth>0)this.tokens.push(fI(3,this.pos,this.pos+1)),this.pos++;else if(i==="-"&&this.isBlockDash())this.tokens.push(fI(2,this.pos,this.pos+1)),this.pos++;else if(i===":"&&this.isBlockColon())this.tokens.push(fI(1,this.pos,this.pos+1)),this.pos++,this.flowDepth===0&&(this.seenBlockColon=!0);else if(i===":"&&this.flowDepth>0&&this.lastTokenIsJsonLike())this.tokens.push(fI(1,this.pos,this.pos+1)),this.pos++;else if(i==="'"||i==='"')this.scanQuotedScalar(i);else if((i==="|"||i===">")&&this.flowDepth===0&&this.isBlockScalarStart()){this.scanBlockScalar(i);break}else this.scanUnquotedScalar()}}isBlockDash(){let i=this.input[this.pos+1];return i===void 0||i===" "||i==="	"||i===`
`||i==="\r"}isBlockColon(){if(this.seenBlockColon&&this.flowDepth===0)return!1;let i=this.input[this.pos+1];return i===void 0||i===" "||i==="	"||i===`
`||i==="\r"||this.flowDepth>0&&(i===","||i==="}"||i==="]")}lastTokenIsJsonLike(){for(let i=this.tokens.length-1;i>=0;i--){let e=this.tokens[i];if(!(e.type===8||e.type===9||e.type===10))return e.type===0&&e.format!=="none"||e.type===5||e.type===7}return!1}scanQuotedScalar(i){let e=this.pos;this.pos++;let t="",o=0;for(;this.pos<this.input.length;){let r=this.input[this.pos];if(r===i){if(i==="'"&&this.input[this.pos+1]==="'"){t+="'",this.pos+=2,o=0;continue}this.pos++;let s=this.input.substring(e,this.pos);this.tokens.push(fI(0,e,this.pos,{rawValue:s,value:t,format:i==="'"?"single":"double"}));return}if(i==='"'&&r==="\\"){let s=this.input[this.pos+1];if(s===`
`||s==="\r"){this.pos++,this.consumeNewline(),this.skipInlineWhitespace(),o=0;continue}switch(s){case"n":t+=`
`;break;case"t":t+="	";break;case"\\":t+="\\";break;case'"':t+='"';break;case"/":t+="/";break;case"r":t+="\r";break;case"0":t+="\0";break;case"a":t+="\x07";break;case"b":t+="\b";break;case"e":t+="\x1B";break;case"v":t+="\v";break;case"f":t+="\f";break;case" ":t+=" ";break;case"_":t+="\xA0";break;case"x":{let l=this.input.substring(this.pos+2,this.pos+4),c=parseInt(l,16);l.length===2&&!isNaN(c)?(t+=String.fromCharCode(c),this.pos+=4):(t+="\\x",this.pos+=2),o=0;continue}case"u":{let l=this.input.substring(this.pos+2,this.pos+6),c=parseInt(l,16);l.length===4&&!isNaN(c)?(t+=String.fromCodePoint(c),this.pos+=6):(t+="\\u",this.pos+=2),o=0;continue}case"U":{let l=this.input.substring(this.pos+2,this.pos+10),c=parseInt(l,16);l.length===8&&!isNaN(c)?(t+=String.fromCodePoint(c),this.pos+=10):(t+="\\U",this.pos+=2),o=0;continue}default:t+="\\"+(s??"");break}this.pos+=2,o=0;continue}if(r===`
`||r==="\r"){o>0&&(t=t.substring(0,t.length-o)),o=0,this.consumeNewline();let s=0;for(;this.pos<this.input.length;){this.skipInlineWhitespace();let l=this.input[this.pos];if(l===`
`||l==="\r")s++,this.consumeNewline();else break}s>0?t+=`
`.repeat(s):t+=" ";continue}r===" "||r==="	"?o++:o=0,t+=r,this.pos++}let n=this.input.substring(e,this.pos);this.tokens.push(fI(0,e,this.pos,{rawValue:n,value:t,format:i==="'"?"single":"double"}))}scanUnquotedScalar(){let i=this.pos,e=this.pos;for(;this.pos<this.input.length;){let o=this.input[this.pos];if(o===`
`||o==="\r"||this.flowDepth>0&&(o===","||o==="}"||o==="]")||this.flowDepth>0&&(o==="{"||o==="[")||o===":"&&this.isBlockColon()||o==="#"&&this.pos>i&&(this.input[this.pos-1]===" "||this.input[this.pos-1]==="	"))break;this.pos++,o!==" "&&o!=="	"&&(e=this.pos)}let t=this.input.substring(i,e);this.tokens.push(fI(0,i,e,{rawValue:t,value:t,format:"none"}))}isBlockScalarStart(){let i=this.pos+1;for(;i<this.input.length;){let t=this.input[i];if(t>="1"&&t<="9"){i++;continue}if(t==="+"||t==="-"){i++;continue}break}for(;i<this.input.length&&(this.input[i]===" "||this.input[i]==="	");)i++;if(i>=this.input.length)return!0;let e=this.input[i];return e===`
`||e==="\r"||e==="#"}scanBlockScalar(i){let e=this.pos;this.pos++;let t=0,o="clip";for(let h=0;h<2;h++)if(this.pos<this.input.length){let g=this.input[this.pos];g>="1"&&g<="9"&&t===0?(t=parseInt(g,10),this.pos++):g==="-"&&o==="clip"?(o="strip",this.pos++):g==="+"&&o==="clip"&&(o="keep",this.pos++)}for(;this.pos<this.input.length&&(this.input[this.pos]===" "||this.input[this.pos]==="	");)this.pos++;if(this.pos<this.input.length&&this.input[this.pos]==="#")for(;this.pos<this.input.length&&this.input[this.pos]!==`
`&&this.input[this.pos]!=="\r";)this.pos++;this.consumeNewline();let n=this.getParentBlockIndent(e),r=t>0?n+t:0,s=[],l=0;for(;this.pos<this.input.length;){let h=this.pos,g=0;for(;this.pos<this.input.length&&this.input[this.pos]===" ";)g++,this.pos++;if(this.pos>=this.input.length||this.input[this.pos]===`
`||this.input[this.pos]==="\r"){if(r>0&&g>=r){let b=this.input.substring(h+r,this.pos);s.push(b),b===""?l++:l=0}else s.push(""),l++;this.consumeNewline();continue}if(g===0&&this.input.length-this.pos>=3){let b=this.input[this.pos],S=this.input[this.pos+1],y=this.input[this.pos+2],w=this.input[this.pos+3],k=w===void 0||w===" "||w==="	"||w===`
`||w==="\r";if(b==="-"&&S==="-"&&y==="-"&&k||b==="."&&S==="."&&y==="."&&k){this.pos=h;break}}if(r===0){if(g<=n){this.pos=h;break}r=g}if(g<r){this.pos=h;break}let f=h+r;for(;this.pos<this.input.length&&this.input[this.pos]!==`
`&&this.input[this.pos]!=="\r";)this.pos++;let v=this.input.substring(f,this.pos);s.push(v),l=0,this.consumeNewline()}let c;if(i==="|")c=s.join(`
`);else{c="";let h=!1,g=!1,f=!1;for(let v=0;v<s.length;v++){let b=s[v],S=b.length>0&&(b[0]===" "||b[0]==="	");b===""?(c+=`
`,g=!0):v===0?(c=b,h=S,f=!0):g?((h||S)&&f?c+=`
`+b:c+=b,h=S,g=!1,f=!0):S||h?(c+=`
`+b,h=S,f=!0):(c+=" "+b,h=!1,f=!0)}}if(l>0){let h=c.length;for(;h>0&&c[h-1]===`
`;)h--;c=c.substring(0,h)}let u=s.some(h=>h!=="");switch(o){case"clip":u&&(c+=`
`);break;case"keep":u?c+=`
`.repeat(l+1):c=`
`.repeat(l);break;case"strip":break}let p=this.input.substring(e,this.pos);this.tokens.push(fI(0,e,this.pos,{rawValue:p,value:c,format:i==="|"?"literal":"folded"}))}getParentBlockIndent(i){for(let e=this.tokens.length-1;e>=0;e--){let t=this.tokens[e];if(!(t.type===8||t.type===10||t.type===9)){if(t.type===1){for(let o=e-1;o>=0;o--){let n=this.tokens[o];if(!(n.type===8||n.type===10||n.type===9))return this.getColumnAt(n.startOffset)}return 0}if(t.type===2)return this.getColumnAt(t.startOffset);if(t.type===11)return-1;break}}return 0}getColumnAt(i){let e=0,t=i-1;for(;t>=0&&this.input[t]!==`
`&&this.input[t]!=="\r";)e++,t--;return e}scanComment(){let i=this.pos;for(;this.pos<this.input.length&&this.input[this.pos]!==`
`&&this.input[this.pos]!=="\r";)this.pos++;this.tokens.push(fI(10,i,this.pos,{rawValue:this.input.substring(i,this.pos),value:this.input.substring(i,this.pos)}))}scanNewline(){let i=this.pos;this.consumeNewline()&&this.tokens.push(fI(8,i,this.pos))}skipInlineWhitespace(){for(;this.pos<this.input.length;){let i=this.input[this.pos];if(i===" "||i==="	")this.pos++;else break}}consumeNewline(){return this.pos>=this.input.length?!1:this.input[this.pos]==="\r"&&this.input[this.pos+1]===`
`?(this.pos+=2,!0):this.input[this.pos]===`
`||this.input[this.pos]==="\r"?(this.pos++,!0):!1}peekChar(){return this.input[this.pos]}},DSi=class{constructor(i,e,t,o){this.tokens=i;this.input=e;this.errors=t;this.options=o;this.pos=0}parse(){return this.skipNewlinesAndComments(),this.currentToken().type===11&&(this.advance(),this.skipNewlinesAndComments()),this.currentToken().type===13||this.currentToken().type===12?void 0:this.parseValue(-1)}currentToken(){return this.tokens[this.pos]}peek(i=0){return this.tokens[Math.min(this.pos+i,this.tokens.length-1)]}advance(){let i=this.tokens[this.pos];return i.type!==13&&this.pos++,i}expect(i){let e=this.currentToken();return e.type===i?this.advance():e}emitError(i,e,t,o){this.errors.push({message:i,startOffset:e,endOffset:t,code:o})}skipNewlinesAndComments(){for(;this.currentToken().type===8||this.currentToken().type===10||this.currentToken().type===9&&this.isFollowedByNewlineOrComment();)this.advance()}isFollowedByNewlineOrComment(){let i=this.peek(1);return i.type===8||i.type===10||i.type===13}currentIndent(){return this.currentToken().type===9?this.currentToken().indent:0}parseValue(i){this.skipNewlinesAndComments();let e=this.currentToken(),t=e.type===9?this.peek(1):e;if(t.type===4||t.type===6)return e.type===9&&this.advance(),t.type===4?this.parseFlowMap():this.parseFlowSeq();let o=this.currentIndent();if(this.peekPastIndent().type===2)return this.parseBlockSequence(o);if(this.looksLikeMapping())return this.parseBlockMapping(o);if(e.type===0||e.type===9)return this.parseScalar(i)}peekPastIndent(){return this.currentToken().type===9?this.peek(1):this.currentToken()}looksLikeMapping(){let i=0;return this.peek(i).type===9&&i++,this.peek(i).type===0&&(i++,this.peek(i).type===1)}parseScalar(i=-1){this.currentToken().type===9&&this.advance();let e=this.expect(0);return e.format!=="none"?this.scalarFromToken(e):this.parsePlainMultiline(e,i)}parsePlainMultiline(i,e){let t=i.value,o=i.endOffset;for(;;){let n=this.pos,r=0,s=!1;for(;this.pos<this.tokens.length;){let c=this.currentToken();if(c.type===10)break;if(c.type===8){this.advance();let u=this.currentToken();if(u.type===8){r++;continue}if(u.type===9){let p=this.peek(1);if(p.type===8||p.type===13){r++,this.advance();continue}if(p.type===10)break;if(u.indent>e){s=!0;break}else break}if(u.type===13||u.type===11||u.type===12)break;if(e<0){s=!0;break}break}if(c.type===9)break;break}if(!s){this.pos=n;break}if(this.currentToken().type===9&&this.advance(),this.currentToken().type!==0){if(this.currentToken().type===2){let c=this.advance(),u="-";if(this.currentToken().type===0){let p=this.advance();u="- "+p.value,o=p.endOffset}else o=c.endOffset;r>0?t+=`
`.repeat(r):t+=" ",t+=u;continue}this.pos=n;break}if(this.peek(1).type===1){this.pos=n;break}let l=this.advance();r>0?t+=`
`.repeat(r):t+=" ",t+=l.value,o=l.endOffset}return{type:"scalar",value:t,rawValue:this.input.substring(i.startOffset,o),startOffset:i.startOffset,endOffset:o,format:"none"}}parseBlockMapping(i,e=!1){let t=this.currentToken().startOffset,o=[],n=new Set;if(e){let s=this.parseMappingEntry(i);s&&(n.add(s.key.value),o.push(s))}for(;this.currentToken().type!==13&&(this.skipNewlinesAndComments(),this.currentToken().type!==13);){let s=this.currentIndent();if(s<i)break;if(s!==i)if(s>i)this.emitError(d(150,null,i,s),this.currentToken().startOffset,this.currentToken().endOffset,"unexpected-indentation");else break;if(!this.looksLikeMapping())break;let l=this.parseMappingEntry(i);if(!l)break;!this.options.allowDuplicateKeys&&n.has(l.key.value)&&this.emitError(d(143,null,l.key.value),l.key.startOffset,l.key.endOffset,"duplicate-key"),n.add(l.key.value),o.push(l)}let r=o.length>0?o[o.length-1].value.endOffset:t;return{type:"map",properties:o,style:"block",startOffset:t,endOffset:r}}parseMappingEntry(i){this.currentToken().type===9&&this.advance();let e=this.expect(0),t=this.scalarFromToken(e),o=this.expect(1);if(o.type!==1){this.emitError(d(144,null),o.startOffset,o.endOffset,"expected-colon");return}let n=this.parseMappingValue(i,o);return{key:t,value:n}}parseMappingValue(i,e){let t=this.currentToken();if(t.type===4)return this.parseFlowMap();if(t.type===6)return this.parseFlowSeq();if(t.type===0){this.currentToken().type===9&&this.advance();let r=this.advance();return r.format!=="none"?this.scalarFromToken(r):this.parsePlainMultiline(r,i)}if(this.skipNewlinesAndComments(),this.currentToken().type===13)return this.emitError(d(149,null),e.startOffset,e.endOffset,"missing-value"),this.makeEmptyScalar(e.endOffset);let n=this.currentIndent();return n===i&&this.peekPastIndent().type===2?this.parseValue(i)??this.makeEmptyScalar(e.endOffset):n<=i?(this.emitError(d(149,null),e.startOffset,e.endOffset,"missing-value"),this.makeEmptyScalar(e.endOffset)):this.parseValue(i)??this.makeEmptyScalar(e.endOffset)}parseBlockSequence(i){let e=[],t=this.currentToken().startOffset,o=t,n=!0;for(;this.currentToken().type!==13&&(this.skipNewlinesAndComments(),this.currentToken().type!==13);){let r;if(n&&this.currentToken().type===2?r=this.currentToken().startOffset-this.getLineStart(this.currentToken().startOffset):r=this.currentIndent(),n=!1,r<i)break;if(r!==i)if(r>i)this.emitError(d(150,null,i,r),this.currentToken().startOffset,this.currentToken().endOffset,"unexpected-indentation");else break;if(this.peekPastIndent().type!==2)break;this.currentToken().type===9&&this.advance();let l=this.advance(),c=this.parseSequenceItemValue(i,l);e.push(c),o=c.endOffset}return{type:"sequence",items:e,style:"block",startOffset:t,endOffset:o}}parseSequenceItemValue(i,e){let t=this.currentToken();if(t.type===10&&this.advance(),t.type===4)return this.parseFlowMap();if(t.type===6)return this.parseFlowSeq();if(t.type===2){let n=t.startOffset-this.getLineStart(t.startOffset);return this.parseBlockSequence(n)}if(t.type===0){if(this.peek(1).type===1){let n=t.startOffset-this.getLineStart(t.startOffset);return this.parseBlockMapping(n,!0)}return this.parseScalar(i)}return this.skipNewlinesAndComments(),this.currentToken().type===13?(this.emitError(d(148,null),e.startOffset,e.endOffset,"missing-value"),this.makeEmptyScalar(e.endOffset)):this.currentIndent()<=i?(this.emitError(d(148,null),e.startOffset,e.endOffset,"missing-value"),this.makeEmptyScalar(e.endOffset)):this.parseValue(i)??this.makeEmptyScalar(e.endOffset)}getLineStart(i){let e=i-1;for(;e>=0&&this.input[e]!==`
`&&this.input[e]!=="\r";)e--;return e+1}parseFlowMap(){let i=this.advance(),e=[];for(this.skipFlowWhitespace();this.currentToken().type!==5&&this.currentToken().type!==13;){let o;if(this.currentToken().type===0)o=this.parseFlowScalar();else{this.emitError(d(147,null),this.currentToken().startOffset,this.currentToken().endOffset,"expected-key");break}this.skipFlowWhitespace();let n;this.currentToken().type===1?(this.advance(),this.skipFlowWhitespace(),n=this.parseFlowValue()):n=this.makeEmptyScalar(o.endOffset),e.push({key:o,value:n}),this.skipFlowWhitespace(),this.currentToken().type===3&&(this.advance(),this.skipFlowWhitespace())}let t=this.currentToken();return t.type===5?this.advance():this.emitError(d(145,null),t.startOffset,t.endOffset,"expected-flow-map-end"),{type:"map",properties:e,style:"flow",startOffset:i.startOffset,endOffset:t.type===5?t.endOffset:t.startOffset}}parseFlowSeq(){let i=this.advance(),e=[];for(this.skipFlowWhitespace();this.currentToken().type!==7&&this.currentToken().type!==13;){let o;if(this.currentToken().type===4)o=this.parseFlowMap();else if(this.currentToken().type===6)o=this.parseFlowSeq();else if(this.currentToken().type===0)o=this.parseFlowScalar();else{this.emitError(d(151,null),this.currentToken().startOffset,this.currentToken().endOffset,"unexpected-token"),this.advance();continue}e.push(o),this.skipFlowWhitespace(),this.currentToken().type===3&&(this.advance(),this.skipFlowWhitespace())}let t=this.currentToken();return t.type===7?this.advance():this.emitError(d(146,null),t.startOffset,t.endOffset,"expected-flow-seq-end"),{type:"sequence",items:e,style:"flow",startOffset:i.startOffset,endOffset:t.type===7?t.endOffset:t.startOffset}}parseFlowScalar(){let i=this.advance();if(i.format!=="none")return this.scalarFromToken(i);let e=i.value,t=i.endOffset;for(;;){let o=!1,n=this.pos;for(;n<this.tokens.length;){let s=this.tokens[n];if(s.type===8)o=!0,n++;else if(s.type===9||s.type===10)n++;else break}if(!o||n>=this.tokens.length)break;let r=this.tokens[n];if(r.type===0&&r.format==="none")this.pos=n+1,e+=" "+r.value,t=r.endOffset;else break}return{type:"scalar",value:e,rawValue:this.input.substring(i.startOffset,t),startOffset:i.startOffset,endOffset:t,format:"none"}}parseFlowValue(){return this.currentToken().type===4?this.parseFlowMap():this.currentToken().type===6?this.parseFlowSeq():this.currentToken().type===0?this.parseFlowScalar():this.makeEmptyScalar(this.currentToken().startOffset)}skipFlowWhitespace(){for(;;){let i=this.currentToken().type;if(i===8||i===9||i===10)this.advance();else break}}scalarFromToken(i){return{type:"scalar",value:i.value,rawValue:i.rawValue,startOffset:i.startOffset,endOffset:i.endOffset,format:i.format}}makeEmptyScalar(i){return{type:"scalar",value:"",rawValue:"",startOffset:i,endOffset:i,format:"none"}}};var gXe=class{constructor(){}parse(i,e){let t=kGi(e);if(t.length===0)return new HNt(i,void 0,void 0);let o,n,r=0;if(t[0].match(/^---[\s\r\n]*$/)){let s=t.findIndex((c,u)=>u>0&&c.match(/^---[\s\r\n]*$/));s===-1?(s=t.length,r=t.length):r=s+1;let l=new z(2,1,s+1,1);o=new RSi(l,i,t)}if(r<t.length){let s=new z(r+1,1,t.length+1,1);n=new MSi(s,t,i)}return new HNt(i,o,n)}},HNt=class{constructor(i,e,t){this.uri=i;this.header=e;this.body=t}},io;(T=>(T.name="name",T.description="description",T.agent="agent",T.mode="mode",T.model="model",T.applyTo="applyTo",T.paths="paths",T.tools="tools",T.handOffs="handoffs",T.advancedOptions="advancedOptions",T.argumentHint="argument-hint",T.excludeAgent="excludeAgent",T.target="target",T.infer="infer",T.license="license",T.compatibility="compatibility",T.metadata="metadata",T.agents="agents",T.userInvocable="user-invocable",T.disableModelInvocation="disable-model-invocation",T.hooks="hooks"))(io||={});var RSi=class{constructor(i,e,t){this.range=i;this.uri=e;this.linesWithEOL=t}get _parsedHeader(){if(this._parsed===void 0){let i=[],e=this.linesWithEOL.slice(this.range.startLineNumber-1,this.range.endLineNumber-1).join(""),t=Wso(e,i),o=new EP(e),n=({startOffset:c,endOffset:u})=>{let p=o.getPosition(c),h=o.getPosition(u),g=this.range.startLineNumber-1;return new z(p.lineNumber+g,p.column,h.lineNumber+g,h.column)},r=c=>{switch(c.type){case"scalar":return{type:"scalar",value:c.value,range:n(c),format:c.format};case"sequence":return{type:"sequence",items:c.items.map(u=>r(u)),range:n(c)};case"map":return{type:"map",properties:c.properties.map(p=>({key:r(p.key),value:r(p.value)})),range:n(c)}}},s=[],l=i.map(c=>({message:c.message,range:n(c),code:c.code}));if(t)if(t.type!=="map")l.push({message:"Invalid header, expecting <key: value> pairs",range:this.range,code:"INVALID_YAML"});else for(let c of t.properties)s.push({key:c.key.value,range:n({startOffset:c.key.startOffset,endOffset:c.value.endOffset}),value:r(c.value)});this._parsed={node:t,attributes:s,errors:l}}return this._parsed}get attributes(){return this._parsedHeader.attributes}getAttribute(i){return this._parsedHeader.attributes.find(e=>e.key===i)}get errors(){return this._parsedHeader.errors}getStringAttribute(i){let e=this._parsedHeader.attributes.find(t=>t.key===i);if(e?.value.type==="scalar")return e.value.value}get name(){return this.getStringAttribute(io.name)}get description(){return this.getStringAttribute(io.description)}get agent(){return this.getStringAttribute(io.agent)??this.getStringAttribute(io.mode)}get model(){return this.getStringOrStringArrayAttribute(io.model)}get applyTo(){return this.getStringAttribute(io.applyTo)}get paths(){return this.getStringOrStringArrayAttribute(io.paths)}get argumentHint(){return this.getStringAttribute(io.argumentHint)}get target(){return this.getStringAttribute(io.target)}get infer(){return this.getBooleanAttribute(io.infer)}get tools(){let i=this._parsedHeader.attributes.find(t=>t.key===io.tools);if(!i)return;let e=i.value;if(e.type==="scalar"&&(e=tH(e)),e.type==="sequence"){let t=[];for(let o of e.items)o.type==="scalar"&&o.value&&t.push(o.value);return t}}get handOffs(){let i=this._parsedHeader.attributes.find(e=>e.key===io.handOffs);if(i&&i.value.type==="sequence"){let e=[];for(let t of i.value.items)if(t.type==="map"){let o,n,r,s,l,c;for(let u of t.properties)u.key.value==="agent"&&u.value.type==="scalar"?o=u.value.value:u.key.value==="label"&&u.value.type==="scalar"?n=u.value.value:u.key.value==="prompt"&&u.value.type==="scalar"?r=u.value.value:u.key.value==="send"&&u.value.type==="scalar"?s=LSi(u.value):u.key.value==="showContinueOn"&&u.value.type==="scalar"?l=LSi(u.value):u.key.value==="model"&&u.value.type==="scalar"&&(c=u.value.value);if(o&&n?.trim()&&r!==void 0){let u={agent:o,label:n,prompt:r,...s!==void 0?{send:s}:{},...l!==void 0?{showContinueOn:l}:{},...c!==void 0?{model:c}:{}};e.push(u)}}return e}}getStringArrayAttribute(i){let e=this._parsedHeader.attributes.find(t=>t.key===i);if(e&&e.value.type==="sequence"){let t=[];for(let o of e.value.items)o.type==="scalar"&&o.value&&t.push(o.value);return t}}getStringOrStringArrayAttribute(i){let e=this._parsedHeader.attributes.find(t=>t.key===i);if(e){if(e.value.type==="scalar")return[e.value.value];if(e.value.type==="sequence"){let t=[];for(let o of e.value.items)o.type==="scalar"&&t.push(o.value);return t}}}get agents(){return this.getStringArrayAttribute(io.agents)}get userInvocable(){return this.getBooleanAttribute(io.userInvocable)}get disableModelInvocation(){return this.getBooleanAttribute(io.disableModelInvocation)}get hooksRaw(){let i=this._parsedHeader.attributes.find(e=>e.key===io.hooks);if(i?.value.type==="map")return i.value}getBooleanAttribute(i){let e=this._parsedHeader.attributes.find(t=>t.key===i);if(e?.value.type==="scalar")return LSi(e.value)}};function LSi(a){if(a.value==="true")return!0;if(a.value==="false")return!1}var MSi=class{constructor(i,e,t){this.range=i;this.linesWithEOL=e;this.uri=t}get fileReferences(){return this.getParsedBody().fileReferences}get variableReferences(){return this.getParsedBody().variableReferences}get offset(){return this.getParsedBody().bodyOffset}getParsedBody(){if(this._parsed===void 0){let i=[],e=[],t=[],o=vt.reduce(vt.slice(this.linesWithEOL,0,this.range.startLineNumber-1),(l,c)=>c.length+l,0),n=!1,r,s=0;for(let l=this.range.startLineNumber-1,c=o;l<this.range.endLineNumber-1;l++){let u=this.linesWithEOL[l],p=u.trimStart(),h=/^(?<fence>(`{3,}|~{3,}))/u.exec(p);if(h){let y=h.groups.fence,w=y[0],k=y.length,T=p.slice(y.length);if(!n){n=!0,r=w,s=k,c+=u.length;continue}if(r===w&&k>=s&&/^\s*$/.test(T)){n=!1,r=void 0,s=0,c+=u.length;continue}}if(n){c+=u.length;continue}let g=[];for(let y of u.matchAll(/`[^`]+`/g))g.push({start:y.index,end:y.index+y[0].length});let f=y=>g.some(w=>y>=w.start&&y<w.end),v=u.matchAll(/\[(.*?)\]\((.+?)\)/g);for(let y of v){if(y.index>0&&u[y.index-1]==="!"||f(y.index))continue;let w=y.index+y[0].length-1,k=y.index+y[0].length-y[2].length-1,T=new z(l+1,k+1,l+1,w+1);e.push({content:y[2],range:T,isMarkdownLink:!0}),i.push(new z(l+1,y.index+1,l+1,y.index+y[0].length+1))}let b=/#file:(?<filePath>[^\s#]+)|#tool:(?<toolName>[\w_\-\.\/]+)/gi,S=u.matchAll(b);for(let y of S){let w=y[0],k=new z(l+1,y.index+1,l+1,y.index+w.length+1);if(i.some(H=>z.areIntersectingOrTouching(H,k))||f(y.index))continue;let T=y.groups?.filePath||y.groups?.toolName;if(!T)continue;let P=y.index+w.length-T.length,O=y.index+w.length,V=new z(l+1,P+1,l+1,O+1);y.groups?.filePath?e.push({content:y.groups?.filePath,range:V,isMarkdownLink:!1}):y.groups?.toolName&&t.push({name:y.groups?.toolName,range:V,offset:c+y.index})}c+=u.length}this._parsed={fileReferences:e.sort((l,c)=>z.compareRangesUsingStarts(l.range,c.range)),variableReferences:t,bodyOffset:o}}return this._parsed}getContent(){return this.linesWithEOL.slice(this.range.startLineNumber-1,this.range.endLineNumber-1).join("")}resolveFilePath(i){try{if(i.startsWith("/"))return this.uri.with({path:i});if(i.match(/^[a-zA-Z]+:\//))return A.parse(i);{let e=ci(this.uri);return Ge(e,i)}}catch{return}}};function tH(a){let i=[],e=a.value,t=a.range.getStartPosition(),o=0,n=r=>r===" "||r==="	";for(;o<e.length;){for(;o<e.length&&n(e[o]);)o++;if(o>=e.length)break;let r=o,s="",l,c,u=e[o];if(u==='"'||u==="'"){let p=u;for(o++;o<e.length&&e[o]!==p;)s+=e[o],o++;l=o+1,o<e.length&&o++,c=p==='"'?"double":"single"}else{let p=o;for(;o<e.length&&e[o]!==",";)s+=e[o],o++;s=s.trimEnd(),l=p+s.length,c="none"}for(i.push({type:"scalar",value:s,range:new z(t.lineNumber,t.column+r,t.lineNumber,t.column+l),format:c});o<e.length&&n(e[o]);)o++;o<e.length&&e[o]===","&&o++}return{type:"sequence",items:i,range:a.range}}var l3;(e=>(e.mcpServers="mcp-servers",e.github="github"))(l3||={});var bXe;(i=>i.disallowedTools="disallowedTools")(bXe||={});function zNt(a){return a==="vscode"||a==="github-copilot"||a==="claude"||a==="undefined"}var vXe=[{name:"true"},{name:"false"}],i8o=[{name:"vscode"},{name:"github-copilot"}],Vso={[io.name]:{type:"scalar",description:d(8395,null)},[io.description]:{type:"scalar",description:d(8393,null)},[io.argumentHint]:{type:"scalar",description:d(8392,null)},[io.model]:{type:"scalar | sequence",description:d(8394,null)},[io.tools]:{type:"scalar | sequence",description:d(8396,null),defaults:["[]","['search', 'edit', 'web']"]},[io.agent]:{type:"scalar",description:d(8391,null)},[io.mode]:{type:"scalar",description:d(8391,null)}},Bso={[io.name]:{type:"scalar",description:d(8390,null)},[io.description]:{type:"scalar",description:d(8388,null)},[io.applyTo]:{type:"scalar",description:d(8387,null),defaults:["'**'","'**/*.ts, **/*.js'","'**/*.php'","'**/*.py'"]},[io.excludeAgent]:{type:"scalar | sequence",description:d(8389,null)}},Hso={[io.name]:{type:"scalar",description:d(8383,null)},[io.description]:{type:"scalar",description:d(8376,null)},[io.argumentHint]:{type:"scalar",description:d(8375,null)},[io.model]:{type:"scalar | sequence",description:d(8382,null)},[io.tools]:{type:"scalar | sequence",description:d(8385,null),defaults:["[]","[search, edit, web]"]},[io.handOffs]:{type:"sequence",description:d(8379,null)},[io.target]:{type:"scalar",description:d(8384,null),enums:i8o},[io.infer]:{type:"scalar",description:d(8381,null),enums:vXe},[io.agents]:{type:"sequence",description:d(8374,null),defaults:['["*"]']},[io.userInvocable]:{type:"scalar",description:d(8386,null),enums:vXe},[io.disableModelInvocation]:{type:"scalar",description:d(8377,null),enums:vXe},[io.advancedOptions]:{type:"map",description:d(8373,null)},[l3.github]:{type:"map",description:d(8378,null)},[io.hooks]:{type:"map",description:d(8380,null)}},Uso={[io.name]:{type:"scalar",description:d(8403,null)},[io.description]:{type:"scalar",description:d(8399,null)},[io.argumentHint]:{type:"scalar",description:d(8397,null)},[io.userInvocable]:{type:"scalar",description:d(8404,null),enums:vXe},[io.disableModelInvocation]:{type:"scalar",description:d(8400,null),enums:vXe},[io.license]:{type:"scalar | map",description:d(8401,null)},[io.compatibility]:{type:"scalar | map",description:d(8398,null)},[io.metadata]:{type:"map",description:d(8402,null)}},fXe={prompt:Object.keys(Vso),instructions:Object.keys(Bso),agent:Object.keys(Hso),skill:Object.keys(Uso),hook:[]},o8o=[io.name,io.description,io.tools,io.target,l3.mcpServers,l3.github,io.infer],n8o={prompt:fXe.prompt.filter(a=>!UNt(a)),instructions:fXe.instructions.filter(a=>!UNt(a)),agent:fXe.agent.filter(a=>!UNt(a)),skill:fXe.skill.filter(a=>!UNt(a)),hook:[]};function PSi(a,i,e){return e==="claude"?a==="instructions"?Object.keys($so):Object.keys(qso):e==="github-copilot"&&a==="agent"?o8o:i?fXe[a]:n8o[a]}function UNt(a){return a===io.advancedOptions||a===io.excludeAgent||a===io.mode||a===io.infer}function PDe(a,i,e){switch(i){case"instructions":return e==="claude"?$so[a]:Bso[a];case"skill":return Uso[a];case"agent":return e==="claude"?qso[a]:Hso[a];case"prompt":return Vso[a];default:return}}var zso=[{name:pm.execute,description:d(8370,null)},{name:pm.read,description:d(8371,null)},{name:pm.edit,description:d(8369,null)},{name:pm.search,description:d(8372,null)},{name:pm.agent,description:d(8368,null)}],wZ=[{name:"Bash",description:d(8342,null),toolEquivalent:[pm.execute]},{name:"Edit",description:d(8343,null),toolEquivalent:["edit/editNotebook","edit/editFiles"]},{name:"Glob",description:d(8344,null),toolEquivalent:["search/fileSearch"]},{name:"Grep",description:d(8345,null),toolEquivalent:["search/textSearch"]},{name:"Read",description:d(8361,null),toolEquivalent:["read/readFile","read/getNotebookSummary"]},{name:"Write",description:d(8367,null),toolEquivalent:["edit/createDirectory","edit/createFile","edit/createJupyterNotebook"]},{name:"WebFetch",description:d(8365,null),toolEquivalent:[pm.web]},{name:"WebSearch",description:d(8366,null),toolEquivalent:[pm.web]},{name:"Task",description:d(8364,null),toolEquivalent:[pm.agent]},{name:"Skill",description:d(8362,null),toolEquivalent:[]},{name:"LSP",description:d(8348,null),toolEquivalent:[]},{name:"NotebookEdit",description:d(8353,null),toolEquivalent:["edit/editNotebook"]},{name:"AskUserQuestion",description:d(8341,null),toolEquivalent:["vscode/askQuestions"]},{name:"MCPSearch",description:d(8349,null),toolEquivalent:[]}],KNt=[{name:"sonnet",description:d(8363,null),modelEquivalent:"Claude Sonnet 4.5 (copilot)"},{name:"opus",description:d(8354,null),modelEquivalent:"Claude Opus 4.6 (copilot)"},{name:"haiku",description:d(8346,null),modelEquivalent:"Claude Haiku 4.5 (copilot)"},{name:"inherit",description:d(8347,null),modelEquivalent:void 0}];function Kso(a){let i=[];for(let e of a){let t=KNt.find(o=>o.name===e);t&&t.modelEquivalent&&i.push(t.modelEquivalent)}return i}function Gso(a){let i=[];for(let e of a){let t=wZ.find(o=>o.name===e);t&&i.push(...t.toolEquivalent)}return i}var qso={name:{type:"scalar",description:d(8335,null)},description:{type:"scalar",description:d(8329,null)},tools:{type:"sequence",description:d(8340,null),defaults:["Read, Edit, Bash"],items:wZ},disallowedTools:{type:"sequence",description:d(8330,null),defaults:["Write, Edit, Bash"],items:wZ},model:{type:"scalar",description:d(8334,null),defaults:["sonnet","opus","haiku","inherit"],enums:KNt},permissionMode:{type:"scalar",description:d(8336,null),defaults:["default","acceptEdits","dontAsk","bypassPermissions","plan"],enums:[{name:"default",description:d(8357,null)},{name:"acceptEdits",description:d(8355,null)},{name:"plan",description:d(8360,null)},{name:"delegate",description:d(8358,null)},{name:"dontAsk",description:d(8359,null)},{name:"bypassPermissions",description:d(8356,null)}]},skills:{type:"sequence",description:d(8339,null)},mcpServers:{type:"sequence",description:d(8332,null)},hooks:{type:"object",description:d(8331,null)},memory:{type:"scalar",description:d(8333,null),defaults:["user","project","local"],enums:[{name:"user",description:d(8352,null)},{name:"project",description:d(8351,null)},{name:"local",description:d(8350,null)}]}},$so={description:{type:"scalar",description:d(8337,null)},paths:{type:"sequence",description:d(8338,null)}};function CZ(a){return a==="vscode"||a==="undefined"}function TD(a,i){let e=i instanceof A?i:i.uri;if(a==="agent"){if(ci(e).path.endsWith(`/${PK}`))return"claude";if(!(i instanceof A)){let o=i.target;if(o==="github-copilot"||o==="vscode")return o}return"undefined"}else if(a==="instructions"&&DB(e))return"claude";return"undefined"}var Fg=le("chatModeService"),c3=class extends x{constructor(e,t,o,n,r,s){super();this.promptsService=e;this.chatAgentService=t;this.logService=n;this.storageService=r;this.configurationService=s;this._customModeInstances=new Map;this._onDidChangeChatModes=this._register(new E);this.onDidChangeChatModes=this._onDidChangeChatModes.event;this.hasCustomModes=ie.Modes.hasCustomChatModes.bindTo(o),this.agentModeDisabledByPolicy=ie.Modes.agentModeDisabledByPolicy.bindTo(o),this.updateAgentModePolicyContextKey(),this.loadCachedModes(),this.refreshCustomPromptModes(!0),this._register(this.promptsService.onDidChangeCustomAgents(()=>{this.refreshCustomPromptModes(!0)})),this._register(this.storageService.onWillSaveState(()=>this.saveCachedModes())),this._register(this.configurationService.onDidChangeConfiguration(c=>{c.affectsConfiguration("chat.agent.enabled")&&(this.updateAgentModePolicyContextKey(),this._onDidChangeChatModes.fire())}));let l=this.chatAgentService.hasToolsAgent;this._register(this.chatAgentService.onDidChangeAgents(()=>{l!==this.chatAgentService.hasToolsAgent&&(l=this.chatAgentService.hasToolsAgent,this._onDidChangeChatModes.fire())}))}static{this.CUSTOM_MODES_STORAGE_KEY="chat.customModes"}loadCachedModes(){try{let e=this.storageService.getObject(c3.CUSTOM_MODES_STORAGE_KEY,1);e&&this.deserializeCachedModes(e)}catch(e){this.logService.error(e,"Failed to load cached custom agents")}}deserializeCachedModes(e){if(!Array.isArray(e)){this.logService.error("Invalid cached custom modes data: expected array");return}for(let t of e)if(r8o(t)&&t.uri)try{let o=t.visibility??{userInvocable:!0,agentInvocable:t.infer!==!1};if(!o.userInvocable)continue;let n=A.revive(t.uri),r={uri:n,name:t.name,description:t.description,tools:t.customTools,model:Fe(t.model)?[t.model]:t.model,argumentHint:t.argumentHint,agentInstructions:t.modeInstructions??{content:t.body??"",toolReferences:[]},handOffs:t.handOffs,target:t.target??"undefined",visibility:o,agents:t.agents,source:l8o(t.source)??{storage:"local"}},s=new GNt(r);this._customModeInstances.set(n.toString(),s)}catch(o){this.logService.error(o,"Failed to revive cached custom agent")}this.hasCustomModes.set(this._customModeInstances.size>0)}saveCachedModes(){try{let e=Array.from(this._customModeInstances.values());this.storageService.store(c3.CUSTOM_MODES_STORAGE_KEY,e,1,1)}catch(e){this.logService.warn("Failed to save cached custom agents",e)}}async refreshCustomPromptModes(e){try{let t=await this.promptsService.getCustomAgents(Se.None),o=new Set;for(let n of t){if(!n.visibility.userInvocable)continue;let r=n.uri.toString();o.add(r);let s=this._customModeInstances.get(r);s?s.updateData(n):(s=new GNt(n),this._customModeInstances.set(r,s))}for(let[n]of this._customModeInstances.entries())o.has(n)||this._customModeInstances.delete(n);this.hasCustomModes.set(this._customModeInstances.size>0)}catch(t){this.logService.error(t,"Failed to load custom agents"),this._customModeInstances.clear(),this.hasCustomModes.set(!1)}e&&this._onDidChangeChatModes.fire()}getModes(){return{builtin:this.getBuiltinModes(),custom:this.getCustomModes()}}findModeById(e){return this.getBuiltinModes().find(t=>t.id===e)??this._customModeInstances.get(e)}findModeByName(e){return this.getBuiltinModes().find(t=>t.name.get()===e)??this.getCustomModes().find(t=>t.name.get()===e)}getBuiltinModes(){let e=[Tl.Ask];return(this.chatAgentService.hasToolsAgent||this.isAgentModeDisabledByPolicy())&&e.unshift(Tl.Agent),e.push(Tl.Edit),e}getCustomModes(){return this.chatAgentService.hasToolsAgent||this.isAgentModeDisabledByPolicy()?Array.from(this._customModeInstances.values()):[]}updateAgentModePolicyContextKey(){this.agentModeDisabledByPolicy.set(this.isAgentModeDisabledByPolicy())}isAgentModeDisabledByPolicy(){return this.configurationService.inspect("chat.agent.enabled").policyValue===!1}};c3=I([m(0,Or),m(1,cr),m(2,X),m(3,se),m(4,ce),m(5,B)],c3);function r8o(a){if(typeof a!="object"||a===null)return!1;let i=a;return typeof i.id=="string"&&typeof i.name=="string"&&typeof i.kind=="string"&&(i.description===void 0||typeof i.description=="string")&&(i.customTools===void 0||Array.isArray(i.customTools))&&(i.modeInstructions===void 0||typeof i.modeInstructions=="object"&&i.modeInstructions!==null)&&(i.model===void 0||typeof i.model=="string"||Array.isArray(i.model))&&(i.argumentHint===void 0||typeof i.argumentHint=="string")&&(i.handOffs===void 0||Array.isArray(i.handOffs))&&(i.uri===void 0||typeof i.uri=="object"&&i.uri!==null)&&(i.source===void 0||s8o(i.source))&&(i.target===void 0||zNt(i.target))&&(i.visibility===void 0||Beo(i.visibility))&&(i.agents===void 0||Array.isArray(i.agents))}var GNt=class{constructor(i){this.kind="agent";this.id=i.uri.toString(),this._nameObservable=Me("name",i.name),this._descriptionObservable=Me("description",i.description),this._customToolsObservable=Me("customTools",i.tools),this._modelObservable=Me("model",i.model),this._argumentHintObservable=Me("argumentHint",i.argumentHint),this._handoffsObservable=Me("handOffs",i.handOffs),this._targetObservable=Me("target",i.target),this._visibilityObservable=Me("visibility",i.visibility),this._agentsObservable=Me("agents",i.agents),this._modeInstructions=Me("_modeInstructions",i.agentInstructions),this._uriObservable=Me("uri",i.uri),this._source=i.source}get name(){return this._nameObservable}get description(){return this._descriptionObservable}get icon(){return So(void 0)}get isBuiltin(){return qNt(this)}get customTools(){return this._customToolsObservable}get model(){return this._modelObservable}get argumentHint(){return this._argumentHintObservable}get modeInstructions(){return this._modeInstructions}get uri(){return this._uriObservable}get label(){return this.name}get handOffs(){return this._handoffsObservable}get source(){return this._source}get target(){return this._targetObservable}get visibility(){return this._visibilityObservable}get agents(){return this._agentsObservable}updateData(i){Gi(e=>{this._nameObservable.set(i.name,e),this._descriptionObservable.set(i.description,e),this._customToolsObservable.set(i.tools,e),this._modelObservable.set(i.model,e),this._argumentHintObservable.set(i.argumentHint,e),this._handoffsObservable.set(i.handOffs,e),this._targetObservable.set(i.target,e),this._visibilityObservable.set(i.visibility,e),this._agentsObservable.set(i.agents,e),this._modeInstructions.set(i.agentInstructions,e),this._uriObservable.set(i.uri,e),this._source=i.source})}toJSON(){return{id:this.id,name:this.name.get(),description:this.description.get(),kind:this.kind,customTools:this.customTools.get(),model:this.model.get(),argumentHint:this.argumentHint.get(),modeInstructions:this.modeInstructions.get(),uri:this.uri.get(),handOffs:this.handOffs.get(),source:a8o(this._source),target:this.target.get(),visibility:this.visibility.get(),agents:this.agents.get()}}};function s8o(a){if(typeof a!="object"||a===null)return!1;let i=a;return i.storage==="extension"?typeof i.extensionId=="string":i.storage==="plugin"?km(i.pluginUri):i.storage==="local"||i.storage==="user"}function a8o(a){if(a)return a.storage==="extension"?{storage:"extension",extensionId:a.extensionId.value,type:a.type}:a.storage==="plugin"?{storage:"plugin",pluginUri:a.pluginUri}:{storage:a.storage}}function l8o(a){if(a){if(a.storage==="extension"){let i;return a.type==="provider"||a.type==="extension-api"?i="extension-api":i="extension-contribution",{storage:"extension",extensionId:new Ii(a.extensionId),type:i}}return a.storage==="plugin"?{storage:"plugin",pluginUri:A.revive(a.pluginUri)}:{storage:a.storage}}}var SXe=class{constructor(i,e,t,o){this.kind=i;this.name=So(i),this.label=So(e),this.description=Me("description",t),this.icon=So(o),this.target=So("undefined")}get isBuiltin(){return qNt(this)}get id(){return this.kind}toJSON(){return{id:this.id,name:this.name.get(),description:this.description.get(),kind:this.kind}}},Tl;(t=>(t.Ask=new SXe("ask","Ask",d(8201,null),R.question),t.Edit=new SXe("edit","Edit",d(8202,null),R.edit),t.Agent=new SXe("agent","Agent",d(8200,null),R.agent)))(Tl||={});function qNt(a){return a.id===Tl.Ask.id||a.id===Tl.Edit.id||a.id===Tl.Agent.id}function d3(a){let i=a.source?.storage;return i==="local"||i==="user"?String(_r(a.name.get())):a.name.get()}function ASi(a){let i=a.label.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");return`${a.agent}:${i}`}function jso(a){return a.map(i=>{let e=i.handOffs?.get()??[],t=i.visibility?.get();return{id:i.id,name:i.name.get(),isBuiltin:i.isBuiltin,visibility:{userInvocable:t?.userInvocable??!0,agentInvocable:t?.agentInvocable??!0},handoffs:e.map(o=>({id:ASi(o),label:o.label,agent:o.agent,prompt:o.prompt,...o.send!==void 0?{send:o.send}:{},...o.showContinueOn!==void 0?{showContinueOn:o.showContinueOn}:{},...o.model!==void 0?{model:o.model}:{}}))}})}var c8o=250,d8o=500,u8o=250,p8o=1e3,NSi=10,m8o=2,ADe=class{constructor(i){this.logService=i;let e=Date.now();this._data={totalTime:0,lastUpdateTime:e,impliedWordLoadRate:0,lastWordCount:0,firstMarkdownTime:void 0,bootstrapActive:!0,wordCountAtBootstrapExit:void 0,updatesWithNewWords:0},this._publicData={impliedWordLoadRate:0,lastWordCount:0}}get data(){return this._publicData}get internalData(){return this._data}update(i){let{totalWordCount:e}=i;if(e===this._data.lastWordCount){this.trace("Update- no new words");return}let t=Date.now(),o=e-this._data.lastWordCount,n=this._data.lastWordCount===0,r=this._data.firstMarkdownTime,s=this._data.wordCountAtBootstrapExit;typeof r!="number"&&e>0&&(r=t);let l=this._data.updatesWithNewWords+1;n&&(this._data.lastUpdateTime=t);let c=o>NSi?p8o:u8o,u=Math.min(t-this._data.lastUpdateTime,c),p=this._data.totalTime+u,h=n&&e>NSi?d8o:c8o,g=this._data.bootstrapActive;if(g){let w=r;typeof w=="number"&&l>=m8o&&e>=NSi?(g=!1,p=Math.max(t-w,u),s=this._data.lastWordCount,this.trace("Has stable data")):p=Math.max(p,h)}let f=typeof s=="number"?Math.max(e-s,0):e,v=p,b=g?e:f,S=v>0?b/(v/1e3):0;this._data={totalTime:p,lastUpdateTime:t,impliedWordLoadRate:S,lastWordCount:e,firstMarkdownTime:r,bootstrapActive:g,wordCountAtBootstrapExit:s,updatesWithNewWords:l},this._publicData={impliedWordLoadRate:S,lastWordCount:e};let y=g?e:f;return this.trace(`Update- got ${y} words over last ${p}ms = ${S} words/s`),this._data}trace(i){this.logService.trace(`ChatStreamStatsTracker#update: ${i}`)}};ADe=I([m(0,se)],ADe);var OSi=/(?<![a-zA-Z0-9])(?<dollars>\${1,2})(?!\.|\(["'])((?:\\.|[^\\\n])*?(?:\\.|[^\\\n\$]))\k<dollars>(?![a-zA-Z0-9])/,NDe="vscode-katex-container",IXe="data-latex",h8o=new RegExp("^"+OSi.source),$Nt;(n=>{let a=/^(\${1,2})\n((?:\\[^]|[^\\])+?)\n\1(?:\n|$)/;function i(r,s={}){return{extensions:[t(s,e(r,s,!1)),o(s,e(r,s,!0))]}}n.extension=i;function e(r,s,l){return c=>{let u;try{let p=r.renderToString(c.text,{...s,throwOnError:!0,displayMode:c.displayMode});u=`<span class="${NDe}" ${IXe}="${Bht(c.text)}">${p}</span>`}catch{u=c.raw}return u+(l?`
`:"")}}function t(r,s){let l=h8o;return{name:"inlineKatex",level:"inline",start(c){let u,p=c;for(;p;){if(u=p.indexOf("$"),u===-1)return;if(p.substring(u).match(l))return u;p=p.substring(u+1).replace(/^\$+/,"")}},tokenizer(c,u){let p=c.match(l);if(p)return{type:"inlineKatex",raw:p[0],text:p[2].trim(),displayMode:p[1].length===2}},renderer:s}}function o(r,s){return{name:"blockKatex",level:"block",start(l){return l.match(new RegExp(a.source,"m"))?.index},tokenizer(l,c){let u=l.match(a);if(u)return{type:"blockKatex",raw:u[0],text:u[2].trim(),displayMode:u[1].length===2}},renderer:s}}})($Nt||={});var yT=String.raw,f8o=yT`(?<!\\)`+yT`(!?\[`+yT`(?:`+yT`[^\[\]\\]|`+yT`\\.|`+yT`\[[^\[\]]*\]`+yT`)*`+yT`\])`+yT`(\(\s*)`+yT`(`+yT`[^\s\(\)<](?:[^\s\(\)]|\([^\s\(\)]*?\))*|`+yT`<(?:\\[<>]|[^<>])+>`+yT`)`+yT`\s*(?:"[^"]*"|'[^']*'|\([^\(\)]*\))?\s*`+yT`\)`;function FSi(a,i){let t=new RegExp("(?:"+f8o+")|(?:"+OSi.source+yT`)|\p{sc=Han}|=+|\++|-+|[^\s\|\p{sc=Han}|=|\+|\-|${"`"}]+`,"gu"),o=Array.from(a.matchAll(t)),n=o.slice(0,i),r=i>=o.length?a.length:n.length?n.at(-1).index+n.at(-1)[0].length:0,s=a.substring(0,r);return{value:s,returnedWordCount:n.length===0?s.length?1:0:n.length,isFullString:r>=a.length,totalWordCount:o.length}}function Qso(a){return FSi(a,Number.MAX_SAFE_INTEGER).returnedWordCount}function Sr(a){return!!a&&typeof a=="object"&&"message"in a}function Ui(a){return!!a&&typeof a.setVote<"u"}function yXe(a){return!!a&&typeof a=="object"&&a.kind==="pendingDivider"}function Lk(a){return Sr(a)||Ui(a)}function Yso(a){if(!Ui(a))throw new Error("Expected item to be IChatResponseViewModel")}var xZ=class extends x{constructor(e,t,o,n){super();this._model=e;this.codeBlockModelCollection=t;this._options=o;this.instantiationService=n;this._onDidDisposeModel=this._register(new E);this.onDidDisposeModel=this._onDidDisposeModel.event;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._items=[];this._inputPlaceholder=void 0;this._editing=void 0;e.getRequests().forEach((r,s)=>{let l=this.instantiationService.createInstance(ODe,r);this._items.push(l),r.response&&this.onAddResponse(r.response)}),this._register(e.onDidDispose(()=>this._onDidDisposeModel.fire())),this._register(e.onDidChangePendingRequests(()=>this._onDidChange.fire(null))),this._register(e.onDidChange(r=>{if(r.kind==="addRequest"){let l=this.instantiationService.createInstance(ODe,r.request);this._items.push(l),r.request.response&&this.onAddResponse(r.request.response)}else if(r.kind==="addResponse")this.onAddResponse(r.response);else if(r.kind==="removeRequest"){let l=this._items.findIndex(u=>Sr(u)&&u.id===r.requestId);l>=0&&this._items.splice(l,1);let c=r.responseId&&this._items.findIndex(u=>Ui(u)&&u.id===r.responseId);if(typeof c=="number"&&c>=0){let p=this._items.splice(c,1)[0];p instanceof u3&&p.dispose()}}let s=r.kind==="addRequest"?{kind:"addRequest"}:r.kind==="initialize"?{kind:"initialize"}:r.kind==="setHidden"?{kind:"setHidden"}:null;this._onDidChange.fire(s)}))}get inputPlaceholder(){return this._inputPlaceholder}get model(){return this._model}setInputPlaceholder(e){this._inputPlaceholder=e,this._onDidChange.fire({kind:"changePlaceholder"})}resetInputPlaceholder(){this._inputPlaceholder=void 0,this._onDidChange.fire({kind:"changePlaceholder"})}get sessionResource(){return this._model.sessionResource}onAddResponse(e){let t=this.instantiationService.createInstance(u3,e,this);this._register(t.onDidChange(()=>this._onDidChange.fire(null))),this._items.push(t)}getItems(){let e=this._items.filter(o=>!o.shouldBeRemovedOnSend||o.shouldBeRemovedOnSend.afterUndoStop);this._options?.maxVisibleItems!==void 0&&e.length>this._options.maxVisibleItems&&(e=e.slice(-this._options.maxVisibleItems));let t=this._model.getPendingRequests();if(t.length>0){let o=t.filter(r=>r.kind==="steering"),n=t.filter(r=>r.kind==="queued");if(o.length>0){e.push({kind:"pendingDivider",id:"pending-divider-steering",sessionResource:this._model.sessionResource,isComplete:!0,dividerKind:"steering",currentRenderedHeight:void 0});for(let r of o){let s=this.instantiationService.createInstance(ODe,r.request,r.kind);e.push(s)}}if(n.length>0){e.push({kind:"pendingDivider",id:"pending-divider-queued",sessionResource:this._model.sessionResource,isComplete:!0,dividerKind:"queued",currentRenderedHeight:void 0});for(let r of n){let s=this.instantiationService.createInstance(ODe,r.request,r.kind);e.push(s)}}}return e}get editing(){return this._editing}setEditing(e){this.editing&&e&&this.editing.id===e.id||(this._editing=e)}dispose(){super.dispose(),Be(this._items.filter(e=>e instanceof u3))}};xZ=I([m(3,F)],xZ);var ODe=class{constructor(i,e){this._model=i;this._pendingKind=e}get id(){return this._model.id}get dataId(){return`${this.id}_${this._model.version+(this._model.response?.isComplete?1:0)}`}get sessionResource(){return this._model.session.sessionResource}get username(){return"User"}get avatarIcon(){return R.account}get message(){return this._model.message}get messageText(){return this.message.text}get attempt(){return this._model.attempt}get variables(){return this._model.variableData.variables}get contentReferences(){return this._model.response?.contentReferences}get confirmation(){return this._model.confirmation}get isComplete(){return this._model.response?.isComplete??!1}get isCompleteAddedRequest(){return this._model.isCompleteAddedRequest}get shouldBeRemovedOnSend(){return this._model.shouldBeRemovedOnSend}get shouldBeBlocked(){return this._model.shouldBeBlocked}get slashCommand(){return this._model.response?.slashCommand}get agentOrSlashCommandDetected(){return this._model.response?.agentOrSlashCommandDetected??!1}get attachedContext(){return this._model.attachedContext}get modelId(){return this._model.modelId}get timestamp(){return this._model.timestamp}get pendingKind(){return this._pendingKind}},u3=class extends x{constructor(e,t,o,n){super();this._model=e;this.session=t;this.instantiationService=o;this.chatAgentNameService=n;this._modelChangeCount=0;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this.renderData=void 0;this._vulnerabilitiesListExpanded=!1;e.isComplete||(this.liveUpdateTracker=this.instantiationService.createInstance(ADe));let r=this.liveUpdateTracker?this._register(new Dt(()=>{let s=Qso(e.entireResponse.getMarkdown());this.liveUpdateTracker.update({totalWordCount:s})},0)):void 0;this._register(e.onDidChange(()=>{r?.schedule(),this._modelChangeCount++,this._onDidChange.fire()}))}get model(){return this._model}get id(){return this._model.id}get dataId(){return this._model.id+`_${this._modelChangeCount}`+(this.isLast?"_last":"")}get sessionResource(){return this._model.session.sessionResource}get username(){return this.agent?this.chatAgentNameService.getAgentNameRestriction(this.agent)?this.agent.fullName||this.agent.name:c4(this.agent):this._model.username}get agent(){return this._model.agent}get slashCommand(){return this._model.slashCommand}get agentOrSlashCommandDetected(){return this._model.agentOrSlashCommandDetected}get response(){return this._model.response}get usedContext(){return this._model.usedContext}get contentReferences(){return this._model.contentReferences}get codeCitations(){return this._model.codeCitations}get progressMessages(){return this._model.progressMessages}get isComplete(){return this._model.isComplete}get isCanceled(){return this._model.isCanceled}get shouldBeBlocked(){return this._model.shouldBeBlocked}get shouldBeRemovedOnSend(){return this._model.shouldBeRemovedOnSend}get isCompleteAddedRequest(){return this._model.isCompleteAddedRequest}get replyFollowups(){return this._model.followups?.filter(e=>e.kind==="reply")}get result(){return this._model.result}get errorDetails(){return this.result?.errorDetails}get vote(){return this._model.vote}get requestId(){return this._model.requestId}get isStale(){return this._model.isStale}get isLast(){return this.session.getItems().at(-1)===this}get usedReferencesExpanded(){if(typeof this._usedReferencesExpanded=="boolean")return this._usedReferencesExpanded}set usedReferencesExpanded(e){this._usedReferencesExpanded=e}get vulnerabilitiesListExpanded(){return this._vulnerabilitiesListExpanded}set vulnerabilitiesListExpanded(e){this._vulnerabilitiesListExpanded=e}get contentUpdateTimings(){return this.liveUpdateTracker?.data}setVote(e){this._modelChangeCount++,this._model.setVote(e)}setEditApplied(e,t){this._modelChangeCount++,this._model.setEditApplied(e,t)}};u3=I([m(2,F),m(3,_K)],u3);var wXe=le("IChatWidgetHistoryService"),v8o=40,FDe=class extends x{constructor(e){super();this._onDidChangeHistory=this._register(new E);this.changed=!1;this.onDidChangeHistory=this._onDidChangeHistory.event;this.memento=new Al("interactive-session",e);let t=this.memento.getMemento(1,1);this.viewState=t,this._register(e.onWillSaveState(()=>{this.changed&&(this.memento.saveMemento(),this.changed=!1)}))}getHistory(e){let t=this.getKey(e);return(this.viewState.history?.[t]??[]).map(n=>this.migrateHistoryEntry(n))}migrateHistoryEntry(e){if(e.inputText!==void 0)return e;let t=e,o=t.state??{},n,r;if(o.chatMode)if(typeof o.chatMode=="string")n=o.chatMode,r=Object.values(ac).includes(o.chatMode)?o.chatMode:void 0;else if(typeof o.chatMode=="object"&&o.chatMode!==null){let s=o.chatMode;n=s.id??"ask",r=s.id&&Object.values(ac).includes(s.id)?s.id:void 0}else n="ask",r="ask";else n="ask",r="ask";return{inputText:t.text??"",attachments:o.chatContextAttachments??[],mode:{id:n,kind:r},contrib:t.state||{},selectedModel:void 0,selections:[]}}getKey(e){return e==="panel"?jEe:e}append(e,t){this.viewState.history??={};let o=this.getKey(e);this.viewState.history[o]=this.getHistory(e).concat(t).slice(-v8o),this.changed=!0,this._onDidChangeHistory.fire({kind:"append",entry:t})}clearHistory(){this.viewState.history={},this.changed=!0,this._onDidChangeHistory.fire({kind:"clear"})}};FDe=I([m(0,ce)],FDe);var WDe=class extends x{constructor(e,t){super();this.location=e;this.chatWidgetHistoryService=t;this._overlay=[];this._history=this.chatWidgetHistoryService.getHistory(this.location),this._currentIndex=this._history.length,this._register(this.chatWidgetHistoryService.onDidChangeHistory(o=>{if(o.kind==="append"){let n=this._history.length;this._history=this.chatWidgetHistoryService.getHistory(this.location);let r=this._history.length;n===r?(this._overlay.shift(),this._currentIndex<this._history.length&&(this._currentIndex=Math.max(this._currentIndex-1,0))):this._currentIndex===n&&(this._currentIndex=r)}else o.kind==="clear"&&(this._history=[],this._currentIndex=0,this._overlay=[])}))}get values(){return this.chatWidgetHistoryService.getHistory(this.location)}isAtEnd(){return this._currentIndex===Math.max(this._history.length,this._overlay.length)}isAtStart(){return this._currentIndex===0}overlay(e){this._overlay[this._currentIndex]=e}resetCursor(){this._currentIndex=this._history.length}previous(){return this._currentIndex=Math.max(this._currentIndex-1,0),this.current()}next(){return this._currentIndex=Math.min(this._currentIndex+1,this._history.length),this.current()}current(){return this._overlay[this._currentIndex]??this._history[this._currentIndex]}append(e){this._overlay=[],this._currentIndex=this._history.length,b8o(this._history.at(-1),e)||this.chatWidgetHistoryService.append(this.location,e)}};WDe=I([m(1,wXe)],WDe);function b8o(a,i){return!(!a||!i||a.inputText!==i.inputText||!$i(a.attachments,i.attachments,(e,t)=>e.id===t.id))}var jNt="workbench.editor.aiCustomizationManagement",QNt="workbench.input.aiCustomizationManagement",YNt={OpenEditor:"aiCustomization.openManagementEditor",CreateNewAgent:"aiCustomization.createNewAgent",CreateNewSkill:"aiCustomization.createNewSkill",CreateNewInstructions:"aiCustomization.createNewInstructions",CreateNewPrompt:"aiCustomization.createNewPrompt"},Xso=new Y("aiCustomizationManagementEditorFocused",!1,d(6288,null)),Jso=new Y("aiCustomizationManagementSection",Zn.Agents,d(6290,null)),Zso=new Y("aiCustomizationManagementHarness","",d(6289,null)),R3l=D.for("AICustomizationManagementEditorTitle"),Rk=D.for("AICustomizationManagementEditorItem"),eao=D.for("AICustomizationManagementCreate"),p3="aiCustomizationManagementItemType",m0="aiCustomizationManagementItemStorage",VDe="aiCustomizationManagementItemUri",WSi="aiCustomizationManagementItemPluginUri",EZ="aiCustomizationManagementItemDisabled",XNt="aiCustomizationManagement.selectedSection",VSi="aiCustomizationManagement.sidebarWidth";var JNt=200,tao=150,iao=350,oao=400;var nao=le("ILanguageModelStatsService"),BDe=class extends x{constructor(e,t){super();this.extensionFeaturesManagementService=e;for(let o in t.keys(-1,0))(o.startsWith("languageModelStats.")||o.startsWith("languageModelAccess."))&&t.remove(o,-1)}async update(e,t,o,n){await this.extensionFeaturesManagementService.getAccess(t,ZNt)}};BDe=I([m(0,cy),m(1,ce)],BDe);var ZNt="copilot";ne.as(As.ExtensionFeaturesRegistry).registerExtensionFeature({id:ZNt,label:d(8237,null),description:d(8238,null),icon:R.copilot,access:{canToggle:!1},accessDataLabel:d(8236,null)});var _D=le("ILanguageModelToolsConfirmationService");var S8o="screenshot-focused-window";function eOt(a){return{id:S8o,name:d(6484,null),value:a.buffer,kind:"image"}}var Si=L(5710,"Chat"),Zm="workbench.action.chat.newChat",rao="workbench.action.chat.newEditSession",tOt="workbench.action.openChat",lx="workbench.action.chat.open",Ab="workbench.action.chat.triggerSetup",xpe="workbench.action.chat.triggerSetupSupportAnonymousAction",I8o="workbench.action.chat.toggle",x2="workbench.action.chat.generateAgentInstructions",CXe="workbench.action.chat.generateOnDemandInstructions",m3="workbench.action.chat.generatePrompt",h3="workbench.action.chat.generateSkill",g3="workbench.action.chat.generateAgent",HSi="workbench.action.chat.generateHook",xXe="workbench.action.chat.insertForkConversationCommand",nOt="workbench.action.chat.insertTroubleshootCommand",iOt={manageSettingsUrl:ro.defaultChatAgent?.manageSettingsUrl??"",provider:ro.defaultChatAgent?.provider??{enterprise:{id:""}},completionsAdvancedSetting:ro.defaultChatAgent?.completionsAdvancedSetting??"",completionsMenuCommand:ro.defaultChatAgent?.completionsMenuCommand??""},ky=new D("workbench.chat.menu.config"),y8o="workbench.action.chat.openQuotaExceededDialog",oOt=class extends K{constructor(e,t){super({...e,icon:R.chatSparkle,f1:!0,category:Si,precondition:C.and(ie.Setup.hidden.negate(),ie.Setup.disabled.negate())});this.mode=t}async run(e,t){t=typeof t=="string"?{query:t}:t;let o=e.get(mi),n=e.get(Pt),r=e.get(Vn),s=e.get(Zt),l=e.get(cr),c=e.get(F),u=e.get(ge),p=e.get(Fg),h=e.get(fe),g=e.get(ds),f=e.get(rd),v=e.get(se),b=e.get(B),S=n.lastFocusedWidget;if((!this.mode||!S||!Gr(S.domNode))&&(S=await n.revealWidget()),!S)return;let y=(t?.mode?p.findModeByName(t?.mode):void 0)??this.mode;if(y&&await this.handleSwitchToMode(y,S,c,u),t?.modelSelector){let T=(await g.selectLanguageModels(t.modelSelector)).sort().at(0);if(!T)throw new Error(`No language models found matching selector: ${JSON.stringify(t.modelSelector)}.`);let P=g.lookupLanguageModel(T);if(!P)throw new Error(`Language model not loaded: ${T}.`);S.input.setCurrentLanguageModel({metadata:P,identifier:T})}if(t?.toolsInclude||t?.toolsExclude){let k=S.input.selectedLanguageModel.get()?.metadata,T=Array.from(r.getTools(k)),P=Array.from(r.getToolSetsForModel(k)),O=x8o({allTools:T,allToolSets:P,toolsInclude:t.toolsInclude,toolsExclude:t.toolsExclude});for(let V of O.unknownIdentifiers)v.warn(`Tool filtering: Unknown identifier '${V}' - no matching tool or toolset found.`);S.input.selectedToolsModel.set(O.enablementMap,!0)}if(t?.previousRequests?.length&&S.viewModel)for(let{request:k,response:T}of t.previousRequests)o.addCompleteRequest(S.viewModel.sessionResource,k,void 0,0,{message:T});if(t?.attachScreenshot){let k=await s.getScreenshot();k&&S.attachmentModel.addContext(eOt(k))}if(t?.attachFiles)for(let k of t.attachFiles){let T=k instanceof A?k:k.uri,P=k instanceof A?void 0:k.range;await h.exists(T)&&S.attachmentModel.addFile(T,P)}if(t?.attachHistoryItemChanges)for(let k of t.attachHistoryItemChanges){let P=f.getRepository(A.file(k.uri.path))?.provider.historyProvider.get();if(!P)continue;let O=await P.resolveHistoryItem(k.historyItemId);O&&S.attachmentModel.addContext({id:k.uri.toString(),name:`${He(k.uri)}`,value:k.uri,historyItem:O,kind:"scmHistoryItemChange"})}if(t?.attachHistoryItemChangeRanges)for(let k of t.attachHistoryItemChangeRanges){let T=f.getRepository(A.file(k.end.uri.path)),P=T?.provider.historyProvider.get();if(!T||!P)continue;let[O,V]=await Promise.all([P.resolveHistoryItem(k.start.historyItemId),P.resolveHistoryItem(k.end.historyItemId)]);if(!O||!V)continue;let H=k.end.uri.with({scheme:C2.scheme,query:JSON.stringify({repositoryId:T.id,start:O.id,end:k.end.historyItemId})});S.attachmentModel.addContext({id:H.toString(),name:`${He(H)}`,value:H,historyItemChangeStart:{uri:k.start.uri,historyItem:O},historyItemChangeEnd:{uri:k.end.uri,historyItem:{...V,displayId:k.end.historyItemId}},kind:"scmHistoryItemChangeRange"})}let w;if(t?.query&&(t.isPartialQuery?(S.input.showScrollbarUntilAccept(),S.setInput(t.query)):(S.viewModel||await U.toPromise(S.onDidChangeViewModel),await w8o(l,S.input.currentModeKind),S.setInput(t.query),w=S.acceptInput())),t?.toolIds&&t.toolIds.length>0)for(let k of t.toolIds){let T=r.getTool(k);T&&S.attachmentModel.addContext({id:T.id,name:T.displayName,fullName:T.displayName,value:void 0,icon:q.isThemeIcon(T.icon)?T.icon:void 0,kind:"tool"})}if(S.focusInput(),t?.blockOnResponse){let k=await w;if(k){let T=b.getValue("chat.autoReply");await new Promise(O=>{let V=k.onDidChange(async()=>{if(k.isComplete){V.dispose(),O();return}if(k.isPendingConfirmation.get()){let G=k.response.value.some($=>$.kind==="questionCarousel"&&!$.isUsed);if(T&&G)return;V.dispose(),O()}})});let P=C8o(k);return P?{...k.result,...P}:{...k.result}}}}async handleSwitchToMode(e,t,o,n){let r=t.input.currentModeKind;if(e){let s=t.viewModel?.model,l=s?await o.invokeFunction(EXe,r,e.kind,s.getRequests().length,s):{needToClearSession:!1};if(!l)return;t.input.setChatMode(e.id),l.needToClearSession&&await n.executeCommand(Zm)}}};async function w8o(a,i){a.getDefaultAgent("panel",i)||await Promise.race([U.toPromise(U.filter(a.onDidChangeAgents,()=>!!a.getDefaultAgent("panel",i))),Li(6e4).then(()=>{throw new Error("Timed out waiting for default agent")})])}function C8o(a){for(let i of a.response.value){if(i.kind==="toolInvocation"){let e=i.state.get();if(e.type===Pi.StateKind.WaitingForConfirmation)return{type:"confirmation",kind:"toolInvocation",toolId:i.toolId};if(e.type===Pi.StateKind.WaitingForPostApproval)return{type:"confirmation",kind:"toolPostApproval",toolId:i.toolId}}if(i.kind==="confirmation"&&!i.isUsed)return{type:"confirmation",kind:"confirmation",title:i.title,data:i.data};if(i.kind==="questionCarousel"&&!i.isUsed)return{type:"confirmation",kind:"questionCarousel",questions:i.questions};if(i.kind==="elicitation2"&&i.state.get()==="pending"){let e=i.title;return{type:"confirmation",kind:"elicitation",title:typeof e=="string"?e:e.value}}}}var BSi=class extends oOt{constructor(){super({id:lx,title:L(5752,"Open Chat"),keybinding:{weight:200,primary:2599,mac:{primary:2343}},menu:[{id:D.ChatTitleBarMenu,group:"a_open",order:1}]})}};function USi(a){return`workbench.action.chat.open${a.name.get()}`}var Cpe=class extends oOt{constructor(i,e){super({id:USi(i),title:L(5756,"Open Chat ({0})",i.label.get()),keybinding:e},i)}};function uao(){W(BSi),W(class extends Cpe{constructor(){super(Tl.Ask)}}),W(class extends Cpe{constructor(){super(Tl.Agent,{when:C.has("config.chat.agent.enabled"),weight:200,primary:3111,linux:{primary:3623}})}}),W(class extends Cpe{constructor(){super(Tl.Edit)}}),W(class extends K{constructor(){super({id:I8o,title:L(5762,"Toggle Chat"),category:Si})}async run(e){let t=e.get(yi),o=e.get($t),n=e.get(Bi),r=e.get(Pt),s=n.getViewLocationById(Dr);o.isViewVisible(Dr)?this.updatePartVisibility(t,s,!1):(this.updatePartVisibility(t,s,!0),(await r.revealWidget())?.focusInput())}updatePartVisibility(e,t,o){let n;switch(t){case 1:n="workbench.parts.panel";break;case 0:n="workbench.parts.sidebar";break;case 2:n="workbench.parts.auxiliarybar";break}n&&e.setPartHidden(!o,n)}}),W(class extends K{constructor(){super({id:tOt,title:L(5747,"New Chat Editor"),icon:R.plus,f1:!0,category:Si,precondition:ie.enabled,keybinding:{weight:200,primary:2092,when:C.and(ie.inChatSession,ie.inChatEditor)},menu:[{id:D.ChatTitleBarMenu,group:"b_new",order:0},{id:D.ChatNewMenu,group:"2_new",order:2},{id:D.EditorTitle,group:"navigation",when:C.and(fr.isEqualTo(Na.EditorID),ie.newChatButtonExperimentIcon.notEqualsTo("copilot"),ie.newChatButtonExperimentIcon.notEqualsTo("new-session"),ie.newChatButtonExperimentIcon.notEqualsTo("comment")),order:1}]})}async run(e){await e.get(Pt).openSession(Jr.getNewSessionUri(),jn,{pinned:!0})}}),W(class extends K{constructor(){super({id:tOt+".copilotIcon",title:L(5747,"New Chat Editor"),icon:R.copilot,f1:!1,category:Si,precondition:ie.enabled,menu:[{id:D.EditorTitle,group:"navigation",when:C.and(fr.isEqualTo(Na.EditorID),ie.newChatButtonExperimentIcon.isEqualTo("copilot")),order:1}]})}async run(e){await e.get(Pt).openSession(Jr.getNewSessionUri(),jn,{pinned:!0})}}),W(class extends K{constructor(){super({id:tOt+".newSessionIcon",title:L(5747,"New Chat Editor"),icon:R.newSession,f1:!1,category:Si,precondition:ie.enabled,menu:[{id:D.EditorTitle,group:"navigation",when:C.and(fr.isEqualTo(Na.EditorID),ie.newChatButtonExperimentIcon.isEqualTo("new-session")),order:1}]})}async run(e){await e.get(Pt).openSession(Jr.getNewSessionUri(),jn,{pinned:!0})}}),W(class extends K{constructor(){super({id:tOt+".commentIcon",title:L(5747,"New Chat Editor"),icon:R.comment,f1:!1,category:Si,precondition:ie.enabled,menu:[{id:D.EditorTitle,group:"navigation",when:C.and(fr.isEqualTo(Na.EditorID),ie.newChatButtonExperimentIcon.isEqualTo("comment")),order:1}]})}async run(e){await e.get(Pt).openSession(Jr.getNewSessionUri(),jn,{pinned:!0})}}),W(class extends K{constructor(){super({id:"workbench.action.openChatToSide",title:L(5748,"New Chat Editor to the Side"),f1:!0,category:Si,precondition:ie.enabled})}async run(e){await e.get(Pt).openSession(Jr.getNewSessionUri(),In,{pinned:!0})}}),W(class extends K{constructor(){super({id:"workbench.action.newChatWindow",title:L(5745,"New Chat Window"),f1:!0,category:Si,precondition:ie.enabled,menu:[{id:D.ChatTitleBarMenu,group:"b_new",order:1},{id:D.ChatNewMenu,group:"2_new",order:3}]})}async run(e){await e.get(Pt).openSession(Jr.getNewSessionUri(),Mg,{pinned:!0,auxiliary:{compact:!0,bounds:{width:640,height:640}}})}}),W(class extends K{constructor(){super({id:"workbench.action.chat.clearInputHistory",title:L(5740,"Clear Input History"),precondition:ie.enabled,category:Si,f1:!0})}async run(e,...t){e.get(wXe).clearHistory()}}),W(class extends pl{constructor(){super({id:"chat.action.focus",title:L(5705,"Focus Chat List"),precondition:C.and(ie.inChatInput),category:Si,keybinding:[{when:C.and(ie.inputCursorAtTop,ie.inQuickChat.negate()),primary:2064,weight:100},{when:C.and(C.or(ww,Dce),ie.inQuickChat.negate()),primary:2064,weight:100},{when:C.and(ie.inChatSession,ie.inQuickChat),primary:2066,weight:200}]})}runEditorCommand(e,t){let o=t.getModel()?.uri;o&&e.get(Pt).getWidgetByInputUri(o)?.focusResponseItem()}}),W(class extends pl{constructor(){super({id:"workbench.chat.action.focusLastFocused",title:L(5706,"Focus Last Focused Chat List Item"),precondition:C.and(ie.inChatInput),category:Si,keybinding:[{when:C.and(ie.inputCursorAtTop,ie.inQuickChat.negate()),primary:3088,weight:101},{when:C.and(C.or(ww,Dce),ie.inQuickChat.negate()),primary:3088,weight:101},{when:C.and(ie.inChatSession,ie.inQuickChat),primary:3090,weight:201}]})}runEditorCommand(e,t){let o=t.getModel()?.uri;o&&e.get(Pt).getWidgetByInputUri(o)?.focusResponseItem(!0)}}),W(class extends K{constructor(){super({id:"workbench.action.chat.focusInput",title:L(5741,"Focus Chat Input"),f1:!1,keybinding:[{primary:2066,weight:200,when:C.and(ie.inChatSession,ie.inChatInput.negate(),ie.inQuickChat.negate())},{when:C.and(ie.inChatSession,ie.inChatInput.negate(),ie.inQuickChat),primary:2064,weight:200}]})}run(e,...t){e.get(Pt).lastFocusedWidget?.focusInput()}}),W(class sao extends K{static{this.ID="workbench.action.chat.focusTodosView"}constructor(){super({id:sao.ID,title:L(5744,"Toggle Focus Between TODOs and Input"),category:Si,f1:!0,precondition:ie.chatModeKind.isEqualTo("agent"),keybinding:[{weight:201,primary:3122,when:C.or(C.and(ie.inChatInput,ie.chatModeKind.isEqualTo("agent")),C.and(ie.inChatTodoList,ie.chatModeKind.isEqualTo("agent")))}]})}run(e){let o=e.get(Pt).lastFocusedWidget;(!o||!o.toggleTodosViewFocus())&&en(d(5716,null))}}),W(class aao extends K{static{this.ID="workbench.action.chat.focusQuestionCarousel"}constructor(){super({id:aao.ID,title:L(5742,"Chat: Toggle Focus Between Question and Input"),category:Si,f1:!0,precondition:ie.inChatSession,keybinding:[{weight:200,primary:3103,when:C.and(ie.inChatSession,ie.Editing.hasQuestionCarousel)}]})}run(e){let o=e.get(Pt).lastFocusedWidget;(!o||!o.toggleQuestionCarouselFocus())&&en(d(5713,null))}}),W(class lao extends K{static{this.ID="workbench.action.chat.previousQuestion"}constructor(){super({id:lao.ID,title:L(5749,"Chat: Previous Question"),category:Si,f1:!0,precondition:C.and(ie.inChatSession,ie.Editing.hasQuestionCarousel),keybinding:[{weight:200,primary:558,when:C.and(ie.inChatQuestionCarousel,ie.Editing.hasQuestionCarousel)}]})}run(e){e.get(Pt).lastFocusedWidget?.navigateToPreviousQuestion()}}),W(class cao extends K{static{this.ID="workbench.action.chat.nextQuestion"}constructor(){super({id:cao.ID,title:L(5746,"Chat: Next Question"),category:Si,f1:!0,precondition:C.and(ie.inChatSession,ie.Editing.hasQuestionCarousel),keybinding:[{weight:200,primary:556,when:C.and(ie.inChatQuestionCarousel,ie.Editing.hasQuestionCarousel)}]})}run(e){e.get(Pt).lastFocusedWidget?.navigateToNextQuestion()}}),W(class dao extends K{static{this.ID="workbench.action.chat.focusTip"}constructor(){super({id:dao.ID,title:L(5743,"Chat: Toggle Focus Between Tip and Input"),category:Si,f1:!0,precondition:ie.inChatSession,keybinding:[{weight:200,primary:3162,when:C.or(ie.inChatSession,ie.inChatTip)}]})}run(e){let o=e.get(Pt).lastFocusedWidget;(!o||!o.toggleTipFocus())&&en(d(5715,null))}}),W(class extends K{constructor(){super({id:"workbench.action.chat.showContextUsage",title:L(5750,"Show Context Window Usage"),category:Si,f1:!0,precondition:ie.enabled})}async run(e){let t=e.get(Pt);(t.lastFocusedWidget??await t.revealWidget())?.input.showContextUsageDetails()}}),W(class extends K{constructor(){super({id:"workbench.action.chat.toggleShowContextUsage",title:L(5714,"Show Context Usage"),category:Si,toggled:C.equals("config.chat.contextUsage.enabled",!0),menu:{id:D.ChatWelcomeContext,group:"1_display",order:1,when:ie.inChatEditor.negate()}})}async run(e){let t=e.get(B),o=t.getValue("chat.contextUsage.enabled");await t.updateValue("chat.contextUsage.enabled",!o)}});let a=C.and(ie.enabled,C.notEquals(`config.${iOt.completionsAdvancedSetting}.authProvider`,iOt.provider.enterprise.id));W(class extends K{constructor(){super({id:"workbench.action.chat.manageSettings",title:L(5751,"Manage Chat"),category:Si,f1:!0,precondition:C.and(C.or(ie.Entitlement.planFree,ie.Entitlement.planEdu,ie.Entitlement.planPro,ie.Entitlement.planProPlus),a),menu:{id:D.ChatTitleBarMenu,group:"y_manage",order:1,when:a}})}async run(i){i.get(Je).open(A.parse(iOt.manageSettingsUrl))}}),W(class extends K{constructor(){super({id:"workbench.action.chat.showExtensionsUsingCopilot",title:L(5760,"Show Extensions using Copilot"),f1:!0,category:M4,precondition:ie.enabled})}async run(e){e.get(Hi).openSearch(`@contribute:${ZNt}`)}}),W(class extends K{constructor(){super({id:"workbench.action.chat.configureCodeCompletions",title:L(5722,"Configure Inline Suggestions..."),precondition:C.and(ie.Setup.installed,ie.Setup.disabled.negate(),ie.Setup.untrusted.negate()),menu:{id:D.ChatTitleBarMenu,group:"f_completions",order:10}})}async run(e){e.get(ge).executeCommand(iOt.completionsMenuCommand)}}),W(class extends K{constructor(){super({id:y8o,title:d(5763,null)})}async run(e){let t=e.get(rr),o=e.get(ge),n=e.get(at),r=e.get(Te),s,l=t.quotas.chat?.percentRemaining===0,c=t.quotas.completions?.percentRemaining===0;if(l&&!c?s=d(5719,null):c&&!l?s=d(5720,null):s=d(5718,null),t.quotas.resetDate){let h=t.quotas.resetDateHasTime?Jc.DateTimeFormat(wr,{year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"numeric"}):Jc.DateTimeFormat(wr,{year:"numeric",month:"long",day:"numeric"}),g=new Date(t.quotas.resetDate);s=[s,d(5757,null,h.value.format(g))].join(" ")}let u=t.entitlement===5,p=u?d(5766,null):void 0;await n.prompt({type:"none",message:d(5723,null),cancelButton:{label:d(5724,null),run:()=>{}},buttons:[{label:u?d(5765,null):d(5764,null),run:()=>{let h="workbench.action.chat.upgradePlan";r.publicLog2("workbenchActionExecuted",{id:h,from:"chat-dialog"}),o.executeCommand(h)}}],custom:{icon:R.copilotWarningLarge,markdownDetails:di([{markdown:new Ie(s,!0)},p?{markdown:new Ie(p,!0)}:void 0])}})}}),W(class extends K{constructor(){super({id:"workbench.action.chat.resetTrustedTools",title:L(5758,"Reset Tool Confirmations"),category:Si,f1:!0,precondition:ie.enabled})}run(e){e.get(_D).resetToolAutoConfirmation(),e.get(Ne).info(d(5759,null))}}),W(class extends K{constructor(){super({id:x2,title:L(5730,"Generate Agent Instructions"),category:Si,icon:R.sparkle,f1:!0,precondition:ie.enabled})}async run(e){await e.get(ge).executeCommand("workbench.action.chat.open",{mode:"agent",query:"/init",isPartialQuery:!1})}}),W(class extends K{constructor(){super({id:CXe,title:L(5731,"Generate On-Demand Instructions"),category:Si,icon:R.sparkle,f1:!0,precondition:ie.enabled})}async run(e){await e.get(ge).executeCommand("workbench.action.chat.open",{mode:"agent",query:"/create-instructions ",isPartialQuery:!0})}}),W(class extends K{constructor(){super({id:m3,title:L(5732,"Generate Prompt File"),shortTitle:L(5733,"Generate Prompt"),category:Si,icon:R.sparkle,f1:!0,precondition:ie.enabled})}async run(e){await e.get(ge).executeCommand("workbench.action.chat.open",{mode:"agent",query:"/create-prompt ",isPartialQuery:!0})}}),W(class extends K{constructor(){super({id:h3,title:L(5734,"Generate Skill"),shortTitle:L(5735,"Generate Skill"),category:Si,icon:R.sparkle,f1:!0,precondition:ie.enabled})}async run(e){await e.get(ge).executeCommand("workbench.action.chat.open",{mode:"agent",query:"/create-skill ",isPartialQuery:!0})}}),W(class extends K{constructor(){super({id:g3,title:L(5725,"Generate Custom Agent"),shortTitle:L(5726,"Generate Agent"),category:Si,icon:R.sparkle,f1:!0,precondition:ie.enabled})}async run(e){await e.get(ge).executeCommand("workbench.action.chat.open",{mode:"agent",query:"/create-agent ",isPartialQuery:!0})}}),W(class extends K{constructor(){super({id:HSi,title:L(5728,"Generate Hook"),shortTitle:L(5729,"Generate Hook"),category:Si,icon:R.sparkle,f1:!0,precondition:ie.enabled})}async run(e){await e.get(ge).executeCommand("workbench.action.chat.open",{mode:"agent",query:"/create-hook ",isPartialQuery:!0})}}),W(class extends K{constructor(){super({id:xXe,title:L(5736,"Insert Fork Command"),shortTitle:L(5737,"Insert /fork"),category:Si,icon:R.repoForked,f1:!0,precondition:ie.enabled})}async run(e){await e.get(ge).executeCommand("workbench.action.chat.open",{query:"/fork ",isPartialQuery:!0})}}),W(class extends K{constructor(){super({id:nOt,title:L(5738,"Insert Troubleshoot Command"),shortTitle:L(5739,"Insert /troubleshoot"),category:Si,f1:!0,precondition:ie.enabled})}async run(e){await e.get(ge).executeCommand("workbench.action.chat.open",{query:"/troubleshoot ",isPartialQuery:!0})}}),W(class extends K{constructor(){super({id:"workbench.action.chat.openFeatureSettings",title:L(5754,"Chat Settings"),shortTitle:d(5755,null),category:Si,f1:!0,precondition:ie.enabled,menu:[{id:ky,when:C.and(ie.enabled,C.equals("view",Dr)),order:15,group:"3_configure"},{id:D.ChatWelcomeContext,group:"2_settings",order:1},{id:D.ViewTitle,when:C.and(ie.enabled,C.equals("view",Dr),C.has("config.chat.customizationsMenu.enabled")),order:15,group:"3_configure"}]})}async run(e){e.get(Go).openSettings({query:"@feature:chat "})}}),ve.appendMenuItem(D.ViewTitle,{command:{id:YNt.OpenEditor,title:L(5753,"Open Customizations"),category:Si,icon:R.gear},group:"navigation",when:C.and(ie.enabled,C.equals("view",Dr),C.has("config.chat.customizationsMenu.enabled")),order:6}),ve.appendMenuItem(D.ViewTitle,{submenu:ky,title:L(5721,"Configure Chat"),group:"navigation",when:C.and(C.equals("view",Dr),C.has("config.chat.customizationsMenu.enabled").negate()),icon:R.gear,order:6})}function zSi(a,i=!0){return Sr(a)?(i?`${a.username}: `:"")+a.messageText:(i?`${a.username}: `:"")+a.response.toString()}function x8o(a){let{allTools:i,allToolSets:e,toolsInclude:t,toolsExclude:o}=a,n=new Map,r=new Set,s=(g,f)=>f.has(g.id)?(r.add(g.id),!0):g.toolReferenceName&&f.has(g.toolReferenceName)?(r.add(g.toolReferenceName),!0):!1,l=(g,f)=>f.has(g.id)?(r.add(g.id),!0):f.has(g.referenceName)?(r.add(g.referenceName),!0):!1,c=new Set;if(t){let g=new Set(t);for(let f of e)if(l(f,g))for(let v of f.getTools())n.set(v,!0);for(let f of i)s(f,g)?(n.set(f,!0),c.add(f)):n.has(f)||n.set(f,!1);for(let f of e)for(let v of f.getTools())s(v,g)?(n.set(v,!0),c.add(v)):n.has(v)||n.set(v,!1)}else{for(let g of i)n.set(g,!0);for(let g of e)for(let f of g.getTools())n.set(f,!0)}if(o){let g=new Set(o);for(let f of e)if(l(f,g))for(let v of f.getTools())c.has(v)||n.set(v,!1);for(let f of i)s(f,g)&&n.set(f,!1);for(let f of e)for(let v of f.getTools())s(v,g)&&n.set(v,!1)}let u=new Set([...t??[],...o??[]]),p=[];for(let g of u)r.has(g)||p.push(g);if(Array.from(n.entries()).filter(([g,f])=>f&&!Xm(g)).length===0)throw new Error("Tool filtering resulted in zero enabled tools. At least one tool must be enabled.");for(let g of e){let f=Array.from(g.getTools()),v=f.length>0&&f.every(b=>n.get(b)===!0);n.set(g,v)}return{enablementMap:n,unknownIdentifiers:p}}async function kXe(a,i,e){return K9e(a,e,{messageOverride:i})}async function EXe(a,i,e,t,o){if(!o?.editingSession||i===e)return{needToClearSession:!1};let n=a.get(at);if((i==="edit"||e==="edit")&&t>0){let s=d(5761,null);return o.editingSession.entries.get().filter(u=>u.state.get()===0).length>0?await kXe(o,s,n)?{needToClearSession:!0}:!1:(await n.confirm({title:d(5707,null),message:d(5709,null),primaryButton:d(5708,null),type:"info"})).confirmed?{needToClearSession:!0}:!1}return{needToClearSession:!1}}async function rOt(a,i,e){let t=a.viewModel?.model.sessionResource,o=e??(t?gl(t):sc);if(py(a.viewContext)&&o!==sc){let n=A.from({scheme:o,path:`/untitled-${xt()}`});await(await i.openView(Dr)).loadSession(n)}else await a.clear()}ve.appendMenuItem(D.EditorContext,{submenu:D.ChatTextEditorMenu,group:"1_chat",order:5,title:d(5727,null),when:C.and(ie.Setup.hidden.negate(),ie.Setup.disabled.negate())});W(class extends K{constructor(){super({id:"workbench.action.chat.toggleDefaultVisibility",title:L(5717,"Show View by Default"),toggled:C.equals("config.workbench.secondarySideBar.defaultVisibility","hidden").negate(),f1:!1,menu:{id:D.ViewTitle,when:C.and(C.equals("view",Dr),ie.panelLocation.isEqualTo(2)),order:0,group:"5_configure"}})}async run(i){let e=i.get(B),t=e.getValue("workbench.secondarySideBar.defaultVisibility");e.updateValue("workbench.secondarySideBar.defaultVisibility",t!=="hidden"?"hidden":"visible")}});W(class extends K{constructor(){super({id:"workbench.action.chat.editToolApproval",title:L(5712,"Manage Tool Approval"),metadata:{description:L(5711,"Edit/manage the tool approval and confirmation preferences for AI chat agents.")},precondition:ie.enabled,f1:!0,category:Si})}async run(i,e){let t=i.get(_D),o=i.get(Vn);t.manageConfirmationPreferences([...o.getAllToolsIncludingDisabled()],e?{defaultScope:e}:void 0)}});var k8o=Rn.registerExtensionPoint({extensionPoint:"chatSessions",jsonSchema:{description:d(7138,null),type:"array",items:{type:"object",additionalProperties:!1,properties:{type:{description:d(7143,null),type:"string"},name:{description:d(7149,null),type:"string",pattern:"^[\\w-]+$"},displayName:{description:d(7146,null),type:"string"},description:{description:d(7145,null),type:"string"},when:{description:d(7167,null),type:"string"},icon:{description:d(7147,null,"$(github)","$(cloud)"),anyOf:[{type:"string"},{type:"object",properties:{light:{description:d(7169,null),type:"string"},dark:{description:d(7168,null),type:"string"}}}]},order:{description:d(7150,null),type:"integer"},alternativeIds:{description:d(7139,null),type:"array",items:{type:"string"}},welcomeTitle:{description:d(7166,null),type:"string"},welcomeMessage:{description:d(7164,null),type:"string"},welcomeTips:{description:d(7165,null),type:"string"},inputPlaceholder:{description:d(7148,null),type:"string"},capabilities:{description:d(7142,null),type:"object",additionalProperties:!1,properties:{supportsFileAttachments:{description:d(7152,null),type:"boolean"},supportsToolAttachments:{description:d(7162,null),type:"boolean"},supportsMCPAttachments:{description:d(7156,null),type:"boolean"},supportsImageAttachments:{description:d(7154,null),type:"boolean"},supportsSearchResultAttachments:{description:d(7159,null),type:"boolean"},supportsInstructionAttachments:{description:d(7155,null),type:"boolean"},supportsSourceControlAttachments:{description:d(7160,null),type:"boolean"},supportsProblemAttachments:{description:d(7157,null),type:"boolean"},supportsSymbolAttachments:{description:d(7161,null),type:"boolean"},supportsPromptAttachments:{description:d(7158,null),type:"boolean"},supportsHandOffs:{description:d(7153,null),type:"boolean"}}},commands:{markdownDescription:d(7135,null),type:"array",items:{additionalProperties:!1,type:"object",defaultSnippets:[{body:{name:"",description:""}}],required:["name"],properties:{name:{description:d(7133,null),type:"string"},description:{description:d(7134,null),type:"string"},when:{description:d(7136,null),type:"string"}}}},canDelegate:{description:d(7141,null),type:"boolean",default:!1},customAgentTarget:{description:d(7144,null),type:"string"},requiresCustomModels:{description:d(7151,null),type:"boolean",default:!1},autoAttachReferences:{description:d(7140,null),type:"boolean",default:!1},useRequestToPopulateBuiltInPickers:{description:d(7163,null),type:"boolean",default:!1}},required:["type","name","displayName","description"]}},activationEventsGenerator:function*(a){for(let i of a)yield`onChatSession:${i.type}`}}),GSi=class extends x{constructor(e,t,o,n,r){super();this.session=e;this.chatSessionType=t;this.resource=o;this.options=n;this.onWillDispose=r;this._optionsCache=new Map(n),this._register(this.session.onWillDispose(()=>{this.onWillDispose(this.resource)}))}getOption(e){return this._optionsCache.get(e)}getAllOptions(){return this._optionsCache.entries()}setOption(e,t){this._optionsCache.set(e,t)}},TXe=class extends x{constructor(e,t,o,n,r,s,l){super();this._logService=e;this._chatAgentService=t;this._extensionService=o;this._contextKeyService=n;this._menuService=r;this._themeService=s;this._labelService=l;this._itemControllers=new Map;this._contributions=new Map;this._contributionDisposables=this._register(new Vt);this._contentProviders=new Map;this._alternativeIdMap=new Map;this._contextKeys=new Set;this._onDidChangeItemsProviders=this._register(new E);this.onDidChangeItemsProviders=this._onDidChangeItemsProviders.event;this._onDidChangeSessionItems=this._register(new E);this.onDidChangeSessionItems=this._onDidChangeSessionItems.event;this._onDidCommitSession=this._register(new E);this.onDidCommitSession=this._onDidCommitSession.event;this._onDidChangeAvailability=this._register(new E);this.onDidChangeAvailability=this._onDidChangeAvailability.event;this._onDidChangeInProgress=this._register(new E);this._onDidChangeContentProviderSchemes=this._register(new E);this._onDidChangeSessionOptions=this._register(new E);this._onDidChangeOptionGroups=this._register(new E);this.inProgressMap=new Map;this._sessionTypeOptions=new Map;this._sessionTypeNewSessionOptions=new Map;this._sessions=new gt;this._resourceAliases=new gt;this._customizationsProviders=new Map;this._onDidChangeCustomizations=this._register(new E);this.onDidChangeCustomizations=this._onDidChangeCustomizations.event;this._hasCanDelegateProvidersKey=ie.hasCanDelegateProviders.bindTo(this._contextKeyService),this._register(k8o.setHandler(p=>{for(let h of p)if(Ua(h.description,"chatSessionsProvider")&&Array.isArray(h.value))for(let g of h.value)this._register(this.registerContribution(g,h.description))})),this._register(U.filter(this._contextKeyService.onDidChangeContext,p=>p.affectsSome(this._contextKeys))(()=>{this._evaluateAvailability()}));let c=["local"],u=ui(this.onDidChangeAvailability,()=>Array.from(this._contributions.keys()).filter(p=>this._contributionDisposables.has(p))).recomputeInitiallyAndOnChange(this._store);this._register(be(p=>{let h=u.read(p);for(let g of c)p.store.add(KSi(g,IS(g)));for(let g of h){let f=lg(g);if(f)p.store.add(KSi(g,IS(f)));else{let v=this._contributions.get(g);v&&p.store.add(KSi(g,v.contribution.displayName??v.contribution.name??g))}}})),this._register(this._labelService.registerFormatter({scheme:Q.copilotPr,formatting:{label:"${authority}${path}",separator:Qd,stripPathStartingSeparator:!0}}))}get onDidChangeInProgress(){return this._onDidChangeInProgress.event}get onDidChangeContentProviderSchemes(){return this._onDidChangeContentProviderSchemes.event}get onDidChangeSessionOptions(){return this._onDidChangeSessionOptions.event}get onDidChangeOptionGroups(){return this._onDidChangeOptionGroups.event}reportInProgress(e,t){this._itemControllers.has(e)||this._logService.warn(`Attempted to report in-progress status for unknown chat session type '${e}'`),this.inProgressMap.set(e,t),this._onDidChangeInProgress.fire()}getInProgress(){return Array.from(this.inProgressMap.entries()).map(([e,t])=>({chatSessionType:e,count:t}))}async updateInProgressStatus(e){try{let t=[];for await(let n of this.getChatSessionItems([e],Se.None))t.push(...n.items);let o=t.filter(n=>n.status&&HC(n.status));this.reportInProgress(e,o.length)}catch(t){this._logService.warn(`Failed to update in-progress status for chat session type '${e}':`,t)}}registerContribution(e,t){if(this._logService.trace(`[ChatSessionsService] registerContribution called for type='${e.type}', canDelegate=${e.canDelegate}, when='${e.when}', extension='${t.identifier.value}'`),this._contributions.has(e.type))return this._logService.trace(`[ChatSessionsService] registerContribution: type='${e.type}' already registered, skipping`),x.None;if(e.when){let o=C.deserialize(e.when);if(o)for(let n of o.keys())this._contextKeys.add(n)}if(this._contributions.set(e.type,{contribution:e,extension:t}),e.alternativeIds)for(let o of e.alternativeIds)this._alternativeIdMap.has(o)&&this._logService.warn(`Alternative ID '${o}' is already mapped to '${this._alternativeIdMap.get(o)}'. Remapping to '${e.type}'.`),this._alternativeIdMap.set(o,e.type);return this._evaluateAvailability(),{dispose:()=>{if(this._contributions.delete(e.type),e.alternativeIds)for(let o of e.alternativeIds)this._alternativeIdMap.get(o)===e.type&&this._alternativeIdMap.delete(o);this._contributionDisposables.deleteAndDispose(e.type),this._updateHasCanDelegateProvidersContextKey()}}}_isContributionAvailable(e){if(!e.when)return!0;let t=C.deserialize(e.when);return!t||this._contextKeyService.contextMatchesRules(t)}_resolveToPrimaryType(e){let t=this._contributions.get(e)?.contribution;if(t&&this._isContributionAvailable(t))return e;let o=this._alternativeIdMap.get(e);if(o){let n=this._contributions.get(o)?.contribution;if(n&&this._isContributionAvailable(n))return o}}_registerMenuItems(e,t){let o=this._contextKeyService.createOverlay([["chatSessionType",e.type]]),r=this._menuService.getMenuActions(D.AgentSessionsCreateSubMenu,o).map(l=>l[1]).flat(),s=new N;for(let l=0;l<r.length;l++){let c=r[l];c instanceof Lo&&(l===0&&!e.canDelegate?s.add(E8o(e.type,e.displayName,c.item.id)):s.add(ve.appendMenuItem(D.ChatNewMenu,{command:c.item,group:"4_externally_contributed"})))}return{dispose:()=>s.dispose()}}_registerCommands(e){let t=T8o(e.type);return wn(W(class extends K{constructor(){super({id:`workbench.action.chat.openSessionWithPrompt.${e.type}`,title:L(7174,"New {0} with Prompt",e.displayName),category:Si,icon:R.plus,f1:!1,precondition:ie.enabled})}async run(n,r){let s=n.get(mi),l=n.get(Or),c=n.get(Vn),{type:u}=e;if(r){let p=r.attachedContext,h=A.revive(r.resource),g=await s.acquireOrLoadSession(h,"panel",Se.None);try{let f=await pao(r.prompt,l,c);f&&(p=[f,...p??[]]);let v=await s.sendRequest(h,r.prompt,{agentIdSilent:u,attachedContext:p});v.kind==="queued"?await v.deferred:v.kind==="sent"&&await v.data.responseCompletePromise}finally{g?.dispose()}}}}),W(class extends K{constructor(){super({id:`workbench.action.chat.openNewSessionEditor.${e.type}`,title:L(7172,"New {0}",e.displayName),category:Si,icon:R.plus,f1:!0,precondition:ie.enabled})}async run(n,r){let{type:s,displayName:l}=e;await qSi(n,{type:s,displayName:l,position:"editor"},r)}}),W(class extends K{constructor(){super({id:`workbench.action.chat.openNewSessionSidebar.${e.type}`,title:L(7173,"New {0}",e.displayName),category:Si,icon:R.plus,f1:!1,precondition:ie.enabled,menu:t?void 0:{id:D.ChatNewMenu,group:"3_new_special"}})}async run(n,r){let{type:s,displayName:l}=e;await qSi(n,{type:s,displayName:l,position:"sidebar"},r)}}))}_evaluateAvailability(){let e=new Set,t=new Set,o=new En;for(let{contribution:n,extension:r}of this._contributions.values()){let s=this._contributionDisposables.has(n.type),l=this._isContributionAvailable(n);if(this._logService.trace(`[ChatSessionsService] _evaluateAvailability: type='${n.type}', isCurrentlyRegistered=${s}, shouldBeRegistered=${l}, when='${n.when}'`),s&&!l){this._contributionDisposables.deleteAndDispose(n.type);for(let c of this._disposeSessionsForContribution(n.type))o.add(c);t.add(n.type)}else!s&&l&&(r&&this._enableContribution(n,r),e.add(n.type))}if(e.size>0||t.size>0){this._onDidChangeAvailability.fire();for(let n of[...e,...t])this._onDidChangeItemsProviders.fire({chatSessionType:n});o.size>0&&this._onDidChangeSessionItems.fire({removed:Array.from(o)})}this._updateHasCanDelegateProvidersContextKey()}_enableContribution(e,t){this._logService.trace(`[ChatSessionsService] _enableContribution: type='${e.type}', canDelegate=${e.canDelegate}`);let o=new N;this._contributionDisposables.set(e.type,o),e.canDelegate&&(o.add(this._registerAgent(e,t)),o.add(this._registerCommands(e))),o.add(this._registerMenuItems(e,t))}_disposeSessionsForContribution(e){let t=[];for(let[o,n]of this._sessions)n.chatSessionType===e&&t.push(o);t.length>0&&this._logService.info(`Disposing ${t.length} cached sessions for contribution '${e}' due to when clause change`);for(let o of t){let n=this._sessions.get(o);n&&n.dispose()}return t}_registerAgent(e,t){let o=this.getContributionIcon(t,e),n=q.isThemeIcon(o)?{themeIcon:o,icon:void 0,iconDark:void 0}:o?{icon:o.light,iconDark:o.dark}:{themeIcon:R.sendToRemoteAgent},r=e.type,s={id:r,name:e.name,fullName:e.displayName,description:e.description,isDefault:!1,isCore:!1,isDynamic:!0,slashCommands:e.commands??[],locations:["panel"],modes:["agent","ask"],disambiguation:[],metadata:{...n},capabilities:e.capabilities,canAccessPreviousChatHistory:!0,extensionId:t.identifier,extensionVersion:t.version,extensionDisplayName:t.displayName||t.name,extensionPublisherId:t.publisher};return this._chatAgentService.registerAgent(r,s)}getAllChatSessionContributions(){return Array.from(this._contributions.values()).filter(e=>this._isContributionAvailable(e.contribution)).map(e=>this.resolveChatSessionContribution(e.extension,e.contribution))}_updateHasCanDelegateProvidersContextKey(){let e=this.getAllChatSessionContributions().filter(o=>o.canDelegate),t=e.length>0;this._logService.trace(`[ChatSessionsService] hasCanDelegateProvidersAvailable=${t} (${e.map(o=>o.type).join(", ")})`),this._hasCanDelegateProvidersKey.set(t)}getChatSessionContribution(e){let t=this._contributions.get(e);if(t&&this._isContributionAvailable(t.contribution))return this.resolveChatSessionContribution(t.extension,t.contribution)}resolveChatSessionContribution(e,t){return{...t,icon:this.resolveIconForCurrentColorTheme(this.getContributionIcon(e,t))}}getContributionIcon(e,t){if(t.icon)return typeof t.icon=="string"?t.icon.startsWith("$(")&&t.icon.endsWith(")")?q.fromString(t.icon):q.fromId(t.icon):{dark:e?Ge(e.extensionLocation,t.icon.dark):A.parse(t.icon.dark),light:e?Ge(e.extensionLocation,t.icon.light):A.parse(t.icon.light)}}resolveIconForCurrentColorTheme(e){if(e)return q.isThemeIcon(e)?e:Bp(this._themeService.getColorTheme().type)?e.dark:e.light}registerChatSessionContribution(e){return this._contributions.has(e.type)?{dispose:()=>{}}:(this._contributions.set(e.type,{contribution:e,extension:void 0}),this._onDidChangeAvailability.fire(),Z(()=>{this._contributions.delete(e.type),this._onDidChangeAvailability.fire()}))}async activateChatSessionItemProvider(e){await this.doActivateChatSessionItemController(e)}async doActivateChatSessionItemController(e){await this._extensionService.whenInstalledExtensionsRegistered();let t=this._resolveToPrimaryType(e);t&&(e=t);let o=this._contributions.get(e)?.contribution;return o&&!this._isContributionAvailable(o)?!1:this._itemControllers.has(e)?!0:(await this._extensionService.activateByEvent(`onChatSession:${e}`),!!this._itemControllers.get(e))}async canResolveChatSession(e){await this._extensionService.whenInstalledExtensionsRegistered();let t=this._resolveToPrimaryType(e)||e,o=this._contributions.get(t)?.contribution;return o&&!this._isContributionAvailable(o)?!1:this._contentProviders.has(e)?!0:(await this._extensionService.activateByEvent(`onChatSession:${e}`),this._contentProviders.has(e))}async tryActivateControllers(e){await Promise.all(this.getAllChatSessionContributions().map(async t=>{e&&!e.includes(t.type)||await this.doActivateChatSessionItemController(t.type)||e?.includes(t.type)&&this._logService.trace(`[ChatSessionsService] No enabled provider found for chat session type ${t.type}`)}))}getChatSessionItems(e,t){return new fp(async o=>{await Wp(this.tryActivateControllers(e),t),await Promise.all(Array.from(this._itemControllers,async([n,r])=>{let s=this._resolveToPrimaryType(n)??n;if(!(e&&!e.includes(s)))try{await Wp(r.initialRefresh,t);let l=r.controller.items;this._logService.trace(`[ChatSessionsService] Resolved ${l.length} sessions for provider ${s}`),o.emitOne({chatSessionType:s,items:l})}catch(l){ao(l)||this._logService.error(`[ChatSessionsService] Failed to resolve sessions for provider ${s}`,l)}}))})}async refreshChatSessionItems(e,t){await this.tryActivateControllers(e),await Promise.all(Array.from(this._itemControllers).map(async([o,n])=>{let r=this._resolveToPrimaryType(o)??o;if(!(e&&!e.includes(r)))try{await n.controller.refresh(t)}catch(s){ao(s)||this._logService.error(`[ChatSessionsService] Failed to resolve sessions for provider ${r}`,s)}}))}getRegisteredChatSessionItemProviders(){return[...new Set(Array.from(this._itemControllers.keys()).map(e=>this._resolveToPrimaryType(e)??e))]}registerChatSessionItemController(e,t){let o=new N,n=o.add(new Ye);return this._itemControllers.set(e,{controller:t,initialRefresh:t.refresh(n.token)}),this._onDidChangeItemsProviders.fire({chatSessionType:e}),o.add(t.onDidChangeChatSessionItems(r=>{this._onDidChangeSessionItems.fire(r),this.updateInProgressStatus(e)})),{dispose:()=>{n.cancel(),o.dispose(),this._itemControllers.get(e)&&(this._itemControllers.delete(e),this._onDidChangeItemsProviders.fire({chatSessionType:e})),this.updateInProgressStatus(e)}}}registerChatSessionContentProvider(e,t){if(this._contentProviders.has(e))throw new Error(`Content provider for ${e} is already registered.`);return this._contentProviders.set(e,t),this._onDidChangeContentProviderSchemes.fire({added:[e],removed:[]}),{dispose:()=>{this._contentProviders.delete(e),this._onDidChangeContentProviderSchemes.fire({added:[],removed:[e]});for(let[o,n]of this._sessions)n.chatSessionType===e&&(n.dispose(),this._sessions.delete(o))}}}registerCustomizationsProvider(e,t){this._customizationsProviders.set(e,t);let o=t.onDidChangeCustomizations(()=>{this._onDidChangeCustomizations.fire({chatSessionType:e})});return Z(()=>{o.dispose(),this._customizationsProviders.get(e)===t&&this._customizationsProviders.delete(e)})}hasCustomizationsProvider(e){return this._customizationsProviders.has(e)}async getCustomizations(e,t){let o=this._customizationsProviders.get(e);if(o)return o.provideCustomizations(t)}async createNewChatSessionItem(e,t,o){let n=this._itemControllers.get(e);if(n)return await n.initialRefresh,n.controller.newChatSessionItem?.(t,o)}async getOrCreateChatSession(e,t){{let c=this._sessions.get(e);if(c)return c.session}if(!await Wp(this.canResolveChatSession(e.scheme),t))throw Error(`Can not find provider for ${e}`);{let c=this._sessions.get(e);if(c)return c.session}let o=this._resolveToPrimaryType(e.scheme)||e.scheme,n=this._contentProviders.get(o);if(!n)throw Error(`Can not find provider for ${e}`);let r,s=this.getNewSessionOptionsForSessionType(o);if(TK(e)&&s?r={sessionResource:e,onWillDispose:U.None,history:[],options:s??{},dispose:()=>{}}:r=await Wp(n.provideChatSessionContent(e,t),t),r.options)for(let[c,u]of r.options)this.setSessionOption(e,c,u);{let c=this._sessions.get(e);if(c)return r.dispose(),c.session}let l=new GSi(r,e.scheme,e,r.options,c=>{l.dispose(),this._sessions.delete(c)});return this._sessions.set(e,l),r.options&&this._onDidChangeSessionOptions.fire({sessionResource:e,updates:r.options}),r}hasAnySessionOptions(e){let t=this._sessions.get(this._resolveResource(e));return!!t&&!!t.options&&t.options.size>0}getSessionOptions(e){let t=this._sessions.get(this._resolveResource(e));if(!t)return;let o=new Map;for(let[n,r]of t.getAllOptions())o.set(n,typeof r=="string"?r:r.id);return o.size>0?o:void 0}getSessionOption(e,t){return this._sessions.get(this._resolveResource(e))?.getOption(t)}setSessionOption(e,t,o){return this.updateSessionOptions(e,new Map([[t,o]]))}updateSessionOptions(e,t){let o=this._sessions.get(this._resolveResource(e));if(!o)return!1;let n=!1;for(let[r,s]of t)o.getOption(r)!==s&&(o.setOption(r,s),n=!0);return n&&this._onDidChangeSessionOptions.fire({sessionResource:e,updates:t}),n}_resolveResource(e){return this._resourceAliases.get(e)??e}registerSessionResourceAlias(e,t){this._resourceAliases.set(t,e)}fireSessionCommitted(e,t){this._onDidCommitSession.fire({original:e,committed:t})}setOptionGroupsForSessionType(e,t,o){o?this._sessionTypeOptions.set(e,o):this._sessionTypeOptions.delete(e),this._onDidChangeOptionGroups.fire(e)}getOptionGroupsForSessionType(e){return this._sessionTypeOptions.get(e)}getNewSessionOptionsForSessionType(e){let t=this._sessionTypeNewSessionOptions.get(e);if(!(!t||t.size===0))return new Map(t)}setNewSessionOptionsForSessionType(e,t){this._sessionTypeNewSessionOptions.set(e,new Map(t))}getCapabilitiesForSessionType(e){return this._contributions.get(e)?.contribution?.capabilities}getCustomAgentTargetForSessionType(e){return this._contributions.get(e)?.contribution?.customAgentTarget??"undefined"}requiresCustomModelsForSessionType(e){return!!this._contributions.get(e)?.contribution?.requiresCustomModels}supportsDelegationForSessionType(e){return this._contributions.get(e)?.contribution?.supportsDelegation!==!1}sessionSupportsFork(e){return!!(this._sessions.get(e)??this._sessions.get(this._resolveResource(e)))?.session.forkSession}async forkChatSession(e,t,o){let n=this._sessions.get(e)??this._sessions.get(this._resolveResource(e));if(!n?.session.forkSession)throw new Error(`Session ${e.toString()} does not support forking`);return n.session.forkSession(t,o)}getContentProviderSchemes(){return Array.from(this._contentProviders.keys())}};TXe=I([m(0,se),m(1,cr),m(2,lt),m(3,X),m(4,Kt),m(5,Le),m(6,rt)],TXe);Ee(Us,TXe,1);function KSi(a,i){return W(class extends K{constructor(){super({id:`workbench.action.chat.openNewChatSessionInPlace.${a}`,title:L(7171,"New {0}",i),category:Si,f1:!1,precondition:ie.enabled})}async run(t,...o){if(o.length===0)throw new li("Expected chat session position argument");let n=o[0];if(n!=="sidebar"&&n!=="editor")throw new li(`Invalid chat session position argument: ${n}`);await qSi(t,{type:a,displayName:d(7132,null),position:n,replaceEditor:!0})}})}function E8o(a,i,e){return W(class extends K{constructor(){super({id:`workbench.action.chat.openNewChatSessionExternal.${a}`,title:L(7170,"New {0}",i),category:Si,f1:!1,precondition:ie.enabled})}async run(o){await o.get(ge).executeCommand(e)}})}async function qSi(a,i,e){let t=a.get($t),o=a.get(mi),n=a.get(se),r=a.get(wt),s=a.get(ee),l=a.get(Or),c=a.get(Vn),u=$Si(i);try{switch(i.position){case"sidebar":{let p=await t.openView(Dr);i.type==="local"?await p.widget.clear():await p.loadSession(u),p.focus();break}case"editor":{let p={override:Na.EditorID,pinned:!0,title:{fallback:d(7137,null,i.displayName)}};if(i.replaceEditor){let h=r.activeGroup.activeEditor;if(!h||!(h instanceof Na))throw new Error("No active chat editor to replace");await s.replaceEditors([{editor:h,replacement:{resource:u,options:p}}],r.activeGroup)}else await s.openEditor({resource:u,options:p});break}default:os(i.position,`Unknown chat session position: ${i.position}`)}}catch(p){n.error(`Failed to open '${i.type}' chat session with openOptions: ${JSON.stringify(i)}`,p);return}if(e)try{if(e.initialSessionOptions){let g=o.getSession(u);g?.contributedChatSession&&g.setContributedChatSession({...g.contributedChatSession,initialSessionOptions:e.initialSessionOptions})}let p=e.attachedContext,h=await pao(e.prompt,l,c);h&&(p=[h,...p??[]]),await o.sendRequest(u,e.prompt,{agentIdSilent:i.type,attachedContext:p})}catch(p){n.error(`Failed to send initial request to '${i.type}' chat session with contextOptions: ${JSON.stringify(e)}`,p)}}async function pao(a,i,e){let t=a.match(Chi);if(t){let o=await i.resolvePromptSlashCommand(t[1],Se.None);if(o){let n=o.parsedPromptFile,r=n.body?.variableReferences.map(({name:l,offset:c})=>({name:l,range:new pi(c,c+l.length+1)}))??[],s=e.toToolReferences(r);return WF(n.uri,"vscode.prompt.file",void 0,!0,s)}}}function $Si(a){return a.type!=="local"?A.from({scheme:a.type,path:`/untitled-${xt()}`}):a.position==="editor"?Na.getNewEditorUri():Jr.getNewSessionUri()}function T8o(a){return Object.values(yf).includes(a)}function sOt(a){if(a.requestInProgress.get())return 2;let i=a.getRequests().at(-1);if(i?.response)return i.response.state===4?3:i.response.isCanceled||i.response.result?.errorDetails?.code==="canceled"?1:i.response.result?.errorDetails?0:i.response.isComplete?1:2}function mao(a){switch(a){case 2:case 1:return 1;case 3:return 0;case 0:return 2;case 4:return 3}}function _Z(a,i){if(i!==void 0)return typeof i=="function"?i(a):i}function iM(a){return rTe(a)&&(a={kind:"terminal",commandLine:{original:a.command,toolEdited:void 0,userEdited:void 0},language:a.language}),a}async function aOt(a){if(!a.editingSession)return;await b4(a.editingSession),await Promise.all(a.editingSession.entries.get().map(t=>t.getDiffInfo?.()));let e=a.editingSession.entries.get().reduce((t,o)=>(t.fileUris.add(o.originalURI),t.added+=o.linesAdded?.get()??0,t.removed+=o.linesRemoved?.get()??0,t),{fileUris:new En,added:0,removed:0});if(e.fileUris.size>0&&(e.added>0||e.removed>0))return{fileCount:e.fileUris.size,added:e.added,removed:e.removed}}var MA=class a{constructor(i,e,t,o,n,r={},s){this.toolCallId=t;this.kind="toolInvocation";this.isAttachedToThinking=!1;this._progress=Me(this,{progress:0});this._partialInput=Me(this,void 0);this._streamingMessage=Me(this,void 0);let l="";r.startInStreaming?l=e.displayName:r.startInCancelled&&(l=r.cancelReasonMessage??d(8246,null,e.displayName)),this.invocationMessage=i?.invocationMessage??l,this.pastTenseMessage=i?.pastTenseMessage,this.originMessage=i?.originMessage,this.confirmationMessages=i?.confirmationMessages,this.presentation=i?.presentation,this.toolSpecificData=i?.toolSpecificData,this.toolId=e.id,this.icon=i?.icon??(e.icon&&q.isThemeIcon(e.icon)?e.icon:void 0),this.source=e.source,this.subAgentInvocationId=o,this.parameters=n,this.chatRequestId=s,r.startInCancelled?this._state=Me(this,{type:Pi.StateKind.Cancelled,reason:r.cancelReason??0,reasonMessage:r.cancelReasonMessage,parameters:this.parameters,confirmationMessages:this.confirmationMessages}):r.startInStreaming?this._state=Me(this,{type:Pi.StateKind.Streaming,partialInput:this._partialInput,streamingMessage:this._streamingMessage}):this.confirmationMessages?.title?this._state=Me(this,{type:Pi.StateKind.WaitingForConfirmation,parameters:this.parameters,confirmationMessages:this.confirmationMessages,confirm:c=>{c.type===0||c.type===5?this._state.set({type:Pi.StateKind.Cancelled,reason:c.type,parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0):this._state.set({type:Pi.StateKind.Executing,confirmed:c,progress:this._progress,parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0)}}):this._state=Me(this,{type:Pi.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(i){return new a(void 0,i.toolData,i.toolCallId,i.subagentInvocationId,void 0,{startInStreaming:!0},i.chatRequestId)}static createCancelled(i,e,t,o){return new a(void 0,i.toolData,i.toolCallId,i.subagentInvocationId,e,{startInCancelled:!0,cancelReason:t,cancelReasonMessage:o},i.chatRequestId)}updatePartialInput(i){this._state.get().type===Pi.StateKind.Streaming&&this._partialInput.set(i,void 0)}updateStreamingMessage(i){this._state.get().type===Pi.StateKind.Streaming&&this._streamingMessage.set(i,void 0)}cancelFromStreaming(i,e){return this._state.get().type!==Pi.StateKind.Streaming?!1:(this._state.set({type:Pi.StateKind.Cancelled,reason:i,reasonMessage:e,parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0),!0)}transitionFromStreaming(i,e,t){if(this._state.get().type!==Pi.StateKind.Streaming)return;let n=this._streamingMessage.get();n&&!i?.invocationMessage&&(this.invocationMessage=n),this.parameters=e,i&&(i.invocationMessage&&(this.invocationMessage=i.invocationMessage),this.pastTenseMessage=i.pastTenseMessage,this.confirmationMessages=i.confirmationMessages,this.presentation=i.presentation,this.toolSpecificData=i.toolSpecificData);let r=s=>{s.type===0||s.type===5?this._state.set({type:Pi.StateKind.Cancelled,reason:s.type,parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0):this._state.set({type:Pi.StateKind.Executing,confirmed:s,progress:this._progress,parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0)};t?r(t):this.confirmationMessages?.title?this._state.set({type:Pi.StateKind.WaitingForConfirmation,parameters:this.parameters,confirmationMessages:this.confirmationMessages,confirm:r},void 0):this._state.set({type:Pi.StateKind.Executing,confirmed:{type:1,reason:this.confirmationMessages?.confirmationNotNeededReason},progress:this._progress,parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0)}_setCompleted(i,e){if(e&&(e.type===0||e.type===5)){this._state.set({type:Pi.StateKind.Cancelled,reason:e.type,parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0);return}this._state.set({type:Pi.StateKind.Completed,confirmed:Pi.executionConfirmedOrDenied(this)||{type:1},resultDetails:i?.toolResultDetails,postConfirmed:e,contentForModel:i?.content||[],parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0)}async didExecuteTool(i,e,t){if(i?.toolResultMessage?this.pastTenseMessage=i.toolResultMessage:this._progress.get().message&&(this.pastTenseMessage=this._progress.get().message),this.confirmationMessages?.confirmResults&&!i?.toolResultError&&i?.confirmResults!==!1&&!e){let o=await t?.();o?this._setCompleted(i,o):this._state.set({type:Pi.StateKind.WaitingForPostApproval,confirmed:Pi.executionConfirmedOrDenied(this)||{type:1},resultDetails:i?.toolResultDetails,contentForModel:i?.content||[],confirm:n=>this._setCompleted(i,n),parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0)}else this._setCompleted(i);return this._state.get()}acceptProgress(i){let e=this._progress.get();this._progress.set({progress:i.progress||e.progress||0,message:i.message},void 0)}toJSON(){let i=this.state.get().type===Pi.StateKind.WaitingForPostApproval,e=i?void 0:Pi.resultDetails(this);return{kind:"toolInvocationSerialized",presentation:this.presentation,invocationMessage:this.invocationMessage,pastTenseMessage:this.pastTenseMessage,originMessage:this.originMessage,isConfirmed:i?{type:5}:Pi.executionConfirmedOrDenied(this),isComplete:!0,source:this.source,resultDetails:_B(e)?{output:{type:"data",mimeType:e.output.mimeType,base64Data:Yd(e.output.value)}}:e,toolSpecificData:this.toolSpecificData,toolCallId:this.toolCallId,toolId:this.toolId,subAgentInvocationId:this.subAgentInvocationId,generatedTitle:this.generatedTitle}}};var uOt={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp"};function f3(a){return Object.entries(uOt).find(([i,e])=>e===a)?.[0]}var hao;(i=>{function a(e){return{variables:e.variables.map(aD.toExport)}}i.toExport=a})(hao||={});function _8o(a){let i=a;return!!i&&!!i.edit&&!!i.uri&&A.isUri(i.uri)}function UDe(a){return a.some(_8o)}var D8o=new Set(["toolInvocation","toolInvocationSerialized","undoStop"]);function L8o(a){return!D8o.has(a.kind)}function gao(a){return a.filter(L8o)}var iH={reason:"other"},oH=class{constructor(i){this._shouldBeBlocked=Me(this,!1);this._version=0;this._session=i.session,this.message=i.message,this._variableData=i.variableData,this.timestamp=i.timestamp,this._attempt=i.attempt??0,this.modeInfo=i.modeInfo,this._confirmation=i.confirmation,this._locationData=i.locationData,this._attachedContext=i.attachedContext,this.isCompleteAddedRequest=i.isCompleteAddedRequest??!1,this.modelId=i.modelId,this.id=i.restoredId??"request_"+xt(),this._editedFileEvents=i.editedFileEvents,this.userSelectedTools=i.userSelectedTools}get shouldBeBlocked(){return this._shouldBeBlocked}setShouldBeBlocked(i){this._shouldBeBlocked.set(i,void 0)}get session(){return this._session}get attempt(){return this._attempt}get variableData(){return this._variableData}set variableData(i){this._version++,this._variableData=i}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(i){this._session=i}},lOt=class{get value(){return this._responseParts}constructor(i){this._responseParts=i}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 i=this._responseParts,e=i.length-1;for(;e>=0;){let r=i[e];if(r.kind==="markdownContent"||r.kind==="markdownVuln"){if(r.content.value.length>0)break}else if(r.kind==="inlineReference")break;e--}if(e<0)return"";let t=e;for(;e>=0;){let r=i[e];if(r.kind==="markdownContent"||r.kind==="markdownVuln"||r.kind==="inlineReference")e--;else break}let o=e+1,n=[];for(let r=o;r<=t;r++){let s=i[r];s.kind==="inlineReference"?n.push(this.inlineRefToRepr(s)):(s.kind==="markdownContent"||s.kind==="markdownVuln")&&s.content.value.length>0&&n.push(s.content.value)}return n.join("")}_invalidateRepr(){this._responseRepr=void 0,this._markdownContent=void 0}computeMarkdownContent(){let i=[];for(let e of this._responseParts)e.kind==="inlineReference"?i.push(this.inlineRefToRepr(e)):(e.kind==="markdownContent"||e.kind==="markdownVuln")&&e.content.value.length>0&&i.push(e.content.value);return i.join("")}computeRepr(){return this.partsToRepr(this._responseParts)}partsToRepr(i){let e=[],t=[],o=!1;for(let n of i){let r;switch(n.kind){case"clearToPreviousToolInvocation":t=[],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":r=this.getToolInvocationText(n);break;case"inlineReference":r={text:this.inlineRefToRepr(n)};break;case"command":r={text:n.command.title,isBlock:!0};break;case"textEditGroup":case"notebookEditGroup":o=!0;continue;case"confirmation":if(n.message instanceof Ie){r={text:`${n.title}
${n.message.value}`,isBlock:!0};break}r={text:`${n.title}
${n.message}`,isBlock:!0};break;case"markdownContent":case"markdownVuln":case"progressTask":case"progressTaskSerialized":case"warning":r={text:n.content.value};break;default:continue}r.isBlock?(t.length&&(e.push(t.join("")),t=[]),e.push(r.text)):t.push(r.text)}return t.length&&e.push(t.join("")),o&&e.push(d(8242,null)),e.join(`

`)}inlineRefToRepr(i){return"uri"in i.inlineReference?this.uriToRepr(i.inlineReference.uri):"name"in i.inlineReference?"`"+i.inlineReference.name+"`":this.uriToRepr(i.inlineReference)}getToolInvocationText(i){let e="",t="";if(i.pastTenseMessage?e=typeof i.pastTenseMessage=="string"?i.pastTenseMessage:i.pastTenseMessage.value:e=typeof i.invocationMessage=="string"?i.invocationMessage:i.invocationMessage.value,i.toolSpecificData&&i.toolSpecificData.kind==="terminal"){e="Ran terminal command";let n=iM(i.toolSpecificData);t=n.commandLine.userEdited??n.commandLine.toolEdited??n.commandLine.original}let o=e;if(t&&(o+=`: ${t}`),i.kind==="toolInvocationSerialized"||i.kind==="toolInvocation"&&Pi.isComplete(i)){let n=Pi.resultDetails(i);if(n&&"input"in n){let r=i.kind==="toolInvocationSerialized"||Pi.isComplete(i)?"Completed":"Errored";o+=`
${r} with input: ${n.input}`}}return{text:o,isBlock:!0}}uriToRepr(i){return i.scheme===Q.http||i.scheme===Q.https?i.toString(!1):He(i)}},jSi=class extends lOt{constructor(e,t){let o=e.value.findIndex(n=>n.kind==="undoStop"&&n.id===t);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=t}},QSi=class extends lOt{constructor(e){super(cc(e).map(t=>"kind"in t?t:Ar(t)?{content:t,kind:"markdownContent"}:{kind:"treeData",treeData:t}));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 t=-1;for(let o=this._responseParts.length-1;o>=0;o--){let n=this._responseParts[o];if(n.kind==="toolInvocation"||n.kind==="toolInvocationSerialized"){t=o;break}}t!==-1?this._responseParts=this._responseParts.slice(0,t+1):this._responseParts=[],e&&this._responseParts.push({kind:"warning",content:new Ie(e)}),this._contentChanged(!0)}updateContent(e,t){if(e.kind==="clearToPreviousToolInvocation"){e.reason===2?this.clearToPreviousToolInvocation(d(8241,null)):e.reason===1?this.clearToPreviousToolInvocation(d(8243,null)):this.clearToPreviousToolInvocation();return}else if(e.kind==="markdownContent"){let o=this._responseParts.filter(n=>n.kind!=="textEditGroup").at(-1);if(!o||o.kind!=="markdownContent"||!cOt(o.content,e.content))this._responseParts.push(e);else{let n=this._responseParts.indexOf(o);this._responseParts[n]={...o,content:DZ(o.content,e.content)}}this._contentChanged(t)}else if(e.kind==="thinking"){let o=this._responseParts.filter(l=>l.kind!=="textEditGroup").at(-1),n=o&&o.kind==="thinking"?Array.isArray(o.value)?o.value.join(""):o.value||"":"",r=Array.isArray(e.value)?e.value.join(""):e.value||"",s=l=>l.length===0;if(!o||o.kind!=="thinking"||s(r)||s(n)||!cOt(new Ie(n),new Ie(r)))this._responseParts.push(e);else{let l=this._responseParts.indexOf(o);this._responseParts[l]={...o,value:DZ(new Ie(n),new Ie(r)).value}}this._contentChanged(t)}else if(e.kind==="textEdit"||e.kind==="notebookEdit"){let o=Zo.parse(e.uri)?.notebook,n=o??e.uri,r=e.isExternalEdit;if(e.kind==="textEdit"&&!o)this._mergeOrPushTextEditGroup(n,e.edits,e.done,r);else if(e.kind==="textEdit"){let s=e.edits.map(l=>({uri:e.uri,edit:l}));this._mergeOrPushNotebookEditGroup(n,s,e.done,r)}else this._mergeOrPushNotebookEditGroup(n,e.edits,e.done,r);this._contentChanged(t)}else if(e.kind==="progressTask"){let o=this._responseParts.push(e)-1;this._contentChanged(t);let n=e.onDidAddProgress(()=>{this._contentChanged(!1)});e.task?.().then(r=>{n.dispose(),typeof r=="string"&&(this._responseParts[o].content=new Ie(r)),this._contentChanged(!1)})}else e.kind==="toolInvocation"?(Ox(o=>{e.state.read(o),this._contentChanged(!1),Pi.isComplete(e,o)&&o.dispose()}),this._responseParts.push(e),this._contentChanged(t)):e.kind==="externalToolInvocationUpdate"?(this._handleExternalToolInvocationUpdate(e),this._contentChanged(t)):(this._responseParts.push(e),this._contentChanged(t))}addCitation(e){this._citations.push(e),this._contentChanged()}_mergeOrPushTextEditGroup(e,t,o,n){for(let r of this._responseParts)if(r.kind==="textEditGroup"&&!r.done&&Qe(r.uri,e)){r.edits.push(t),r.done=o;return}this._responseParts.push({kind:"textEditGroup",uri:e,edits:[t],done:o,isExternalEdit:n})}_mergeOrPushNotebookEditGroup(e,t,o,n){for(let r of this._responseParts)if(r.kind==="notebookEditGroup"&&!r.done&&Qe(r.uri,e)){r.edits.push(t),r.done=o;return}this._responseParts.push({kind:"notebookEditGroup",uri:e,edits:[t],done:o,isExternalEdit:n})}_handleExternalToolInvocationUpdate(e){let t=this._responseParts.findLast(r=>r.kind==="toolInvocation"&&r.toolCallId===e.toolCallId);if(t){e.toolSpecificData!==void 0&&(t.toolSpecificData=e.toolSpecificData),e.isComplete&&t.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},n=new MA({invocationMessage:e.invocationMessage,pastTenseMessage:e.pastTenseMessage,toolSpecificData:e.toolSpecificData},o,e.toolCallId,e.subagentInvocationId,void 0,{},void 0);e.isComplete&&(e.toolSpecificData!==void 0&&(n.toolSpecificData=e.toolSpecificData),n.didExecuteTool({content:[],toolResultMessage:e.pastTenseMessage,toolResultError:e.errorMessage,toolResultDetails:e.resultDetails})),this._responseParts.push(n)}computeRepr(){let e=super.computeRepr();return this._citations.length&&(e+=`

`+JSi(this._citations)),e}_contentChanged(e){this._invalidateRepr(),e||this._onDidChangeValue.fire()}},HDe=class extends x{constructor(e){super();this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._modelState=Me(this,{value:0});this._shouldBeBlocked=Me(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||Ar(e.responseContent)&&e.responseContent.value.length!==0),this._response=this._register(new QSi(e.responseContent)),this._codeBlockInfos=e.codeBlockInfos?[...e.codeBlockInfos]:void 0;let t=Fr(this,this.onDidChange),o=t.map((s,l)=>{t.read(l);for(let c of this._response.value){if(c.kind==="toolInvocation"){let u=c.state.read(l);if(u.type===Pi.StateKind.WaitingForConfirmation){let p=u.confirmationMessages?.title;return p?Ar(p)?p.value:p:void 0}if(u.type===Pi.StateKind.WaitingForPostApproval)return d(8245,null)}if(c.kind==="confirmation"&&!c.isUsed)return c.title;if(c.kind==="questionCarousel"&&!c.isUsed)return d(8244,null);if(c.kind==="elicitation2"&&c.state.read(l)==="pending"){let u=c.title;return Ar(u)?u.value:u}}}),n=o.map(s=>!!s).map(s=>s?Date.now():void 0);this.isPendingConfirmation=n.map((s,l)=>s?{startedWaitingAt:s,detail:o.read(l)}:void 0),this.isInProgress=t.map((s,l)=>(t.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(iH))),this.id=e.restoredId??"response_"+xt();let r;this.confirmationAdjustedTimestamp=ke(s=>{let l=this.isPendingConfirmation.read(s);return l?(this._modelState.set({value:4},void 0),r||(r=l.startedWaitingAt)):r&&(this._modelState.read(s).value===4&&this._modelState.set({value:0},void 0),this._timeSpentWaitingAccumulator+=Date.now()-r,r=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(iH))}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 jSi(this._response,e)),this._responseView):this._finalizedResponse||this._response}get codeBlockInfos(){return this._codeBlockInfos}initializeCodeBlockInfos(e){if(this._codeBlockInfos)throw new li("Code block infos have already been initialized");this._codeBlockInfos=[...e]}setBlockedState(e){this._shouldBeBlocked.set(e,void 0)}updateContent(e,t){this._response.updateContent(e,t)}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(iH))}applyCodeCitation(e){this._codeCitations.push(e),this._response.addCitation(e),this._onDidChange.fire(iH)}setAgent(e,t){this._agent=e,this._slashCommand=t,this._agentOrSlashCommandDetected=!e.isDefault||!!t,this._onDidChange.fire(iH)}setResult(e){this._result=e,this._onDidChange.fire(iH)}setUsage(e){this._usage=e,this._onDidChange.fire(iH)}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(iH)}setVote(e){this._vote=e,this._onDidChange.fire(iH)}setEditApplied(e,t){return!this.response.value.includes(e)||!e.state?!1:(e.state.applied=t,this._onDidChange.fire(iH),!0)}adoptTo(e){this._session=e,this._onDidChange.fire(iH)}finalizeUndoState(){this._finalizedResponse=this.response,this._responseView=void 0,this._shouldBeRemovedOnSend=void 0}toJSON(){let e=this._modelState.get(),t=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:(t?Date.now()-t.startedWaitingAt:0)+this._timeSpentWaitingAccumulator}}};function pOt(a){return R8o(a),"version"in a?a.version===2?{...a,version:3,customTitle:a.computedTitle}:a:{version:3,...a,customTitle:void 0}}function R8o(a){a.sessionId||(a.sessionId=xt()),a.creationDate||(a.creationDate=M8o()),a.initialLocation==="editing-session"&&(a.initialLocation="panel")}function M8o(){let a=new Date;return a.setFullYear(a.getFullYear()-1),a.getTime()}function mOt(a){return!!a&&Array.isArray(a.requests)&&typeof a.responderUsername=="string"}function P8o(a){let i=a;return mOt(a)&&typeof i.creationDate=="number"&&typeof i.sessionId=="string"&&a.requests.every(e=>!e.usedContext||Jeo(e.usedContext))}var YSi=class{constructor(i){this._state=ph({debugName:"inputModelState",equalsFn:eo},i),this.state=this._state}setState(i){let e=this._state.get();this._state.set({attachments:[],mode:{id:"agent",kind:"agent"},selectedModel:void 0,inputText:"",selections:[],contrib:{},...e,...i},void 0)}clearState(){this._state.set(void 0,void 0)}toJSON(){let i=this.state.get();if(!i)return;let e=i.attachments.filter(t=>!(LK(t)||aLt(t)&&Sk(t.value)));return{contrib:i.contrib,attachments:e.map(aD.toExport),mode:i.mode,selectedModel:i.selectedModel?{identifier:i.selectedModel.identifier,metadata:i.selectedModel.metadata}:void 0,inputText:i.inputText,selections:i.selections,permissionLevel:i.permissionLevel}}},Ef=class extends x{constructor(e,t,o,n,r,s){super();this.logService=o;this.chatAgentService=n;this.chatEditingService=r;this.chatService=s;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 gt;this._checkpoint=void 0;let l=e?.value,c=mOt(l),u=c&&P8o(l);l&&!c&&this.logService.warn(`ChatModel#constructor: Loaded malformed session data: ${JSON.stringify(l)}`),this._isImported=!!l&&c&&!u,t.resource?(this._sessionId=ap(t.resource),this._sessionResource=t.resource):u?(this._sessionId=l.sessionId,this._sessionResource=Jr.forSession(l.sessionId)):(this._sessionId=xt(),this._sessionResource=Jr.forSession(this._sessionId)),this._disableBackgroundKeepAlive=t.disableBackgroundKeepAlive??!1,this._requests=l?this._deserialize(l):[],this._timestamp=u&&l.creationDate||Date.now(),this._customTitle=u?l.customTitle:void 0;let p=t.inputState||(u&&l.inputState?l.inputState:void 0);if(this.inputModel=new YSi(p&&{attachments:(p.attachments??[]).map(aD.fromExport),mode:p.mode,selectedModel:p.selectedModel&&{identifier:p.selectedModel.identifier,metadata:p.selectedModel.metadata},contrib:p.contrib,inputText:p.inputText,selections:p.selections,permissionLevel:p.permissionLevel}),this.dataSerializer=e?.serializer,this._initialResponderUsername=l?.responderUsername,this._repoData=u&&l.repoData?l.repoData:void 0,u&&l.pendingRequests&&(this._pendingRequests=this._deserializePendingRequests(l.pendingRequests)),this._initialLocation=l?.initialLocation??t.initialLocation,this._canUseTools=t.canUseTools,this.lastRequestObs=ui(this,this.onDidChange,()=>this._requests.at(-1)),this._register(be(h=>{let g=this.lastRequestObs.read(h);g?.response&&h.store.add(g.response.onDidChange(async f=>{!this._editingSession||f.reason!=="completedRequest"||this._onDidChange.fire({kind:"completedRequest",request:g})}))})),this.requestInProgress=this.lastRequestObs.map((h,g)=>h?.response?.isInProgress.read(g)??!1),this.requestNeedsInput=this.lastRequestObs.map((h,g)=>{let f=h?.response?.isPendingConfirmation.read(g);if(f)return{title:this.title,detail:f.detail}}),this.initialLocation==="panel"&&!t.disableBackgroundKeepAlive){let h=this._register(new me);this._register(be(g=>{let f=this.requestInProgress.read(g),v=this.requestNeedsInput.read(g),b=f||!!v;b&&!h.value?h.value=s.acquireExistingSession(this._sessionResource):!b&&h.value&&h.clear()}))}}static getDefaultTitle(e){let t=e.at(0)?.message??"";return(typeof t=="string"?t:t.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 t=new Map(this._pendingRequests.map(n=>[n.request.id,n])),o=[];for(let{requestId:n,kind:r}of e){let s=t.get(n);s&&o.push(s.kind===r?s:{request:s.request,kind:r,sendOptions:s.sendOptions})}this._pendingRequests.length=0,this._pendingRequests.push(...o),this._onDidChangePendingRequests.fire()}addPendingRequest(e,t,o){let n={request:e,kind:t,sendOptions:o};if(t==="steering"){let r=0;for(let s=0;s<this._pendingRequests.length&&this._pendingRequests[s].kind==="steering";s++)r=s+1;this._pendingRequests.splice(r,0,n)}else this._pendingRequests.push(n);return this._onDidChangePendingRequests.fire(),n}removePendingRequest(e){let t=this._pendingRequests.findIndex(o=>o.request.id===e);t!==-1&&(this._pendingRequests.splice(t,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),t=e?.response,o=e?.timestamp,n=t?.completedAt??t?.timestamp;return{created:this._timestamp,lastRequestStarted:o,lastRequestEnded:n}}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||Ef.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,t){let o=this._editingSession??=this._register(t?this.chatEditingService.transferEditingSession(this,t):e?this.chatEditingService.startOrContinueGlobalEditingSession(this):this.chatEditingService.createEditingSession(this));if(!this._disableBackgroundKeepAlive){let n=this._register(new me);this._register(be(r=>{let s=o.entries.read(r).some(l=>l.state.read(r)===0);s&&!n.value?n.value=this.chatService.acquireExistingSession(this._sessionResource):!s&&n.value&&n.clear()}))}this._register(be(n=>{this._setDisabledRequests(o.requestDisablement.read(n))}))}notifyEditingAction(e){let t=e.outcome==="accepted"?1:e.outcome==="rejected"?2:e.outcome==="userModified"?3:null;t!==null&&(!this.currentEditedFileEvents.has(e.uri)||this.currentEditedFileEvents.get(e.uri)?.eventKind===1)&&this.currentEditedFileEvents.set(e.uri,{eventKind:t,uri:e.uri})}_deserialize(e){let t=No(e,{serializer:!0})?e.value.requests:e.requests;if(!Array.isArray(t))return this.logService.error(`Ignoring malformed session data: ${JSON.stringify(e)}`),[];try{return t.map(o=>this._deserializeRequest(o))}catch(o){return this.logService.error("Failed to parse chat data",o),[]}}_deserializeRequest(e){let t=typeof e.message=="string"?this.getParsedRequestFromString(e.message):qeo(e.message),o=this.reviveVariableData(e.variableData),n=new oH({session:this,message:t,variableData:o,timestamp:e.timestamp??-1,restoredId:e.requestId,confirmation:e.confirmation,editedFileEvents:e.editedFileEvents,modelId:e.modelId,modeInfo:e.modeInfo});if(n.shouldBeRemovedOnSend=e.isHidden?{requestId:e.requestId}:e.shouldBeRemovedOnSend,e.response||e.result||e.responseErrorDetails){let r=e.agent&&"metadata"in e.agent?iLt(e.agent):void 0,s="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 c of e.response)No(c,{kind:!0})&&c.kind==="questionCarousel"&&(c.isUsed=!0);n.response=new HDe({responseContent:e.response??[new Ie(e.response)],session:this,agent:r,slashCommand:e.slashCommand,requestId:n.id,modelState:l,vote:e.vote,timestamp:e.timestamp,result:s,followups:e.followups,restoredId:e.responseId,timeSpentWaiting:e.timeSpentWaiting,shouldBeBlocked:n.shouldBeBlocked.get(),codeBlockInfos:e.responseMarkdownInfo?.map(c=>({suggestionId:c.suggestionId}))}),n.response.shouldBeRemovedOnSend=e.isHidden?{requestId:e.requestId}:e.shouldBeRemovedOnSend,e.usedContext&&n.response.applyReference($n(e.usedContext)),e.contentReferences?.forEach(c=>n.response.applyReference($n(c))),e.codeCitations?.forEach(c=>n.response.applyCodeCitation($n(c)))}return n}reviveVariableData(e){let t=e&&Array.isArray(e.variables)?e:{variables:[]};return t.variables=t.variables.map(aD.fromExport),t}getParsedRequestFromString(e){let t=[new Pv(new pi(0,e.length),{startColumn:1,startLineNumber:1,endColumn:1,endLineNumber:1},e)];return{text:e,parts:t}}_deserializePendingRequests(e){try{return e.map(t=>({id:t.id,request:this._deserializeRequest(t.request),kind:t.kind,sendOptions:{...t.sendOptions,userSelectedTools:t.sendOptions.userSelectedTools?So(t.sendOptions.userSelectedTools):void 0}}))}catch(t){return this.logService.error("Failed to parse pending chat requests",t),[]}}getRequests(){return this._requests}resetCheckpoint(){for(let e of this._requests)e.setShouldBeBlocked(!1),e.response&&e.response.setBlockedState(!1)}setCheckpoint(e){let t,o=-1;if(!(e!==void 0&&(this._requests.forEach((n,r)=>{n.id===e&&(o=r,t=n,n.setShouldBeBlocked(!0))}),!t))){for(let n=this._requests.length-1;n>=0;n-=1){let r=this._requests[n];this._checkpoint&&!t?(r.setShouldBeBlocked(!1),r.response&&r.response.setBlockedState(!1)):t&&n>=o?(r.setShouldBeBlocked(!0),r.response&&r.response.setBlockedState(!0)):t&&n<o&&(r.setShouldBeBlocked(!1),r.response&&r.response.setBlockedState(!1))}this._checkpoint=t}}get checkpoint(){return this._checkpoint}_setDisabledRequests(e){this._requests.forEach(t=>{let o=e.find(n=>n.requestId===t.id);t.shouldBeRemovedOnSend=o,t.response&&(t.response.shouldBeRemovedOnSend=o)}),this._onDidChange.fire({kind:"setHidden"})}addRequest(e,t,o,n,r,s,l,c,u,p,h,g,f){let v=[...this.currentEditedFileEvents.values()];this.currentEditedFileEvents.clear();let b=new oH({restoredId:f,session:this,message:e,variableData:t,timestamp:Date.now(),attempt:o,modeInfo:n,confirmation:l,locationData:c,attachedContext:u,isCompleteAddedRequest:p,modelId:h,editedFileEvents:v.length?v:void 0,userSelectedTools:g});return b.response=new HDe({responseContent:[],session:this,agent:r,slashCommand:s,requestId:b.id,isCompleteAddedRequest:p,codeBlockInfos:void 0}),this._requests.push(b),FF(this.sessionResource,OF.RequestUiUpdated),this._onDidChange.fire({kind:"addRequest",request:b}),b}setCustomTitle(e){this._customTitle=e,this._onDidChange.fire({kind:"setCustomTitle",title:e})}updateRequest(e,t){e.variableData=t,this._onDidChange.fire({kind:"changedRequest",request:e})}adoptRequest(e){let t=e.session,o=t._requests.findIndex(n=>n.id===e.id);o!==-1&&(t._requests.splice(o,1),e.adoptTo(this),e.response?.adoptTo(this),this._requests.push(e),t._onDidChange.fire({kind:"removeRequest",requestId:e.id,responseId:e.response?.id,reason:2}),this._onDidChange.fire({kind:"addRequest",request:e}))}acceptResponseProgress(e,t,o){if(e.response||(e.response=new HDe({responseContent:[],session:this,requestId:e.id,codeBlockInfos:void 0})),e.response.isComplete)throw new Error("acceptResponseProgress: Adding progress to a completed response");t.kind==="usedContext"||t.kind==="reference"?e.response.applyReference(t):t.kind==="codeCitation"?e.response.applyCodeCitation(t):t.kind==="move"?this._onDidChange.fire({kind:"move",target:t.uri,range:t.range}):t.kind==="codeblockUri"&&t.isEdit?(e.response.addUndoStop({id:t.undoStopId??xt(),kind:"undoStop"}),e.response.updateContent(t,o)):t.kind==="progressTaskResult"?this.logService.error(`Couldn't handle progress: ${JSON.stringify(t)}`):e.response.updateContent(t,o)}removeRequest(e,t=0){let o=this._requests.findIndex(r=>r.id===e),n=this._requests[o];o!==-1&&(this._onDidChange.fire({kind:"removeRequest",requestId:n.id,responseId:n.response?.id,reason:t}),this._requests.splice(o,1),n.response?.dispose())}cancelRequest(e){e.response&&e.response.cancel()}setResponse(e,t){e.response||(e.response=new HDe({responseContent:[],session:this,requestId:e.id,codeBlockInfos:void 0})),e.response.setResult(t)}setFollowups(e,t){e.response&&e.response.setFollowups(t)}setResponseModel(e,t){e.response=t,this._onDidChange.fire({kind:"addResponse",response:t})}toExport(){return{responderUsername:this.responderUsername,initialLocation:this.initialLocation,requests:this._requests.map(e=>{let t={...e.message,parts:e.message.parts.map(r=>r&&"toJSON"in r?r.toJSON():r)},o=e.response?.agent,n=o&&"toJSON"in o?o.toJSON():o?{...o}:void 0;return{requestId:e.id,message:t,variableData:hao.toExport(e.variableData),response:e.response?e.response.entireResponse.value.map(r=>r.kind==="treeData"?r.treeData:r.kind==="markdownContent"?r.content:r):void 0,shouldBeRemovedOnSend:e.shouldBeRemovedOnSend,agent:n,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()}};Ef=I([m(2,se),m(3,cr),m(4,ud),m(5,mi)],Ef);function XSi(a,i){return{variables:a.variables.map(e=>({...e,range:e.range&&{start:e.range.start-i,endExclusive:e.range.endExclusive-i}}))}}function cOt(a,i){if(a.baseUri&&i.baseUri){if(!(a.baseUri.scheme===i.baseUri.scheme&&a.baseUri.authority===i.baseUri.authority&&a.baseUri.path===i.baseUri.path&&a.baseUri.query===i.baseUri.query&&a.baseUri.fragment===i.baseUri.fragment))return!1}else if(a.baseUri||i.baseUri)return!1;return eo(a.isTrusted,i.isTrusted)&&a.supportHtml===i.supportHtml&&a.supportThemeIcons===i.supportThemeIcons}function DZ(a,i){let e=typeof i=="string"?i:i.value;return{value:a.value+e,isTrusted:a.isTrusted,supportThemeIcons:a.supportThemeIcons,supportHtml:a.supportHtml,baseUri:a.baseUri}}function JSi(a){if(a.length===0)return"";let i=a.reduce((t,o)=>t.add(o.license),new Set);return i.size===1?d(8239,null,i.size):d(8240,null,i.size)}function fao(a){return{modeInfo:a.modeInfo,userSelectedModelId:a.userSelectedModelId,userSelectedTools:a.userSelectedTools?.get(),location:a.location,locationData:a.locationData,attempt:a.attempt,noCommandDetection:a.noCommandDetection,agentId:a.agentId,agentIdSilent:a.agentIdSilent,slashCommand:a.slashCommand,confirmation:a.confirmation}}var CT;(t=>{t.scheme="vscode-chat-response-resource";function i(o,n,r,s){return A.from({scheme:t.scheme,authority:U$(qe.fromString(o.toString())),path:`/tool/${n}/${r}`+(s?`/${s}`:"")})}t.createUri=i;function e(o){if(o.scheme!==t.scheme)return;let n=o.path.split("/");if(n.length<4)return;let[,r,s,l]=n;if(r!=="tool")return;let c;try{c=A.parse(yIe(o.authority).toString())}catch(u){if(u instanceof SyntaxError)c=Jr.forSession(o.authority);else throw u}return{sessionResource:c,toolCallId:s,index:Number(l)}}t.parseUri=e})(CT||={});function A8o(a,i){if(a===i)return!0;let[e,t]=a.split("/"),[o]=i.split("/");return t==="*"&&e===o}function ZSi(a,i){let e=jo(a);for(let[t,o]of Object.entries(i))if(Ed(t,a)||Ed(t,e))return o}function vao(a,i){for(let[e,t]of Object.entries(i))if(A8o(e,a))return t}function N8o(a){return typeof a=="object"&&a!==null&&"output"in a&&typeof a.output=="object"&&a.output?.type==="data"&&typeof a.output?.mimeType=="string"}function bao(a,i,e,t){let o=[],n=new Set;for(let r of a.value){if(r.kind==="codeblockUri"){let s=r.uri,l=s.toString();if(n.has(l))continue;let c=ZSi(s.path,t);c&&(n.add(l),o.push({label:He(s),uri:l,type:"plan",groupName:c.groupName,onlyShowGroup:c.onlyShowGroup}))}if(r.kind==="textEditGroup"){let s=r.uri,l=s.toString();if(n.has(l))continue;let c=ZSi(s.path,t);c&&(n.add(l),o.push({label:He(s),uri:l,type:"plan",groupName:c.groupName,onlyShowGroup:c.onlyShowGroup}))}if(r.kind==="workspaceEdit")for(let s of r.edits){let l=s.newResource??s.oldResource;if(!l)continue;let c=l.toString();if(n.has(c))continue;let u=ZSi(l.path,t);u&&(n.add(c),o.push({label:He(l),uri:c,type:"plan",groupName:u.groupName,onlyShowGroup:u.onlyShowGroup}))}if(r.kind==="toolInvocation"||r.kind==="toolInvocationSerialized"){let s=Pi.resultDetails(r);if(!s)continue;if(cD(s))for(let l=0;l<s.output.length;l++){let c=s.output[l];if(c.type==="embed"&&!c.isText&&c.mimeType){let u=vao(c.mimeType,e);if(u){let p=`${r.toolCallId}:${l}`;if(!n.has(p)){n.add(p);let h=yP(c.mimeType),g=h?`file${h}`:"file.bin",f=CT.createUri(i,r.toolCallId,l,g);o.push({label:c.uri?.path.split("/").pop()??`${u.groupName} ${l+1}`,uri:f.toString(),toolCallId:r.toolCallId,dataPartIndex:l,type:"screenshot",groupName:u.groupName,onlyShowGroup:u.onlyShowGroup})}}}}if(N8o(s)){let l=vao(s.output.mimeType,e);if(l){let c=`${r.toolCallId}:0`;if(!n.has(c)){n.add(c);let u=yP(s.output.mimeType),p=u?`file${u}`:"file.bin",h=CT.createUri(i,r.toolCallId,0,p);o.push({label:`${l.groupName}`,uri:h.toString(),toolCallId:r.toolCallId,dataPartIndex:0,type:"screenshot",groupName:l.groupName,onlyShowGroup:l.onlyShowGroup})}}}}}return o}var LZ=le("chatArtifactsService"),LXe=class{constructor(i){this._memento=new Al("chat-artifacts",i)}get(i){return this._memento.getMemento(1,1)[i]||[]}set(i,e){let t=this._memento.getMemento(1,1);t[i]=e,this._memento.saveMemento()}delete(i){let e=this._memento.getMemento(1,1);delete e[i],this._memento.saveMemento()}};LXe=I([m(0,ce)],LXe);var eIi=class extends x{constructor(e,t,o){super();this.mutable=So(!1);this._responseCache=new Map;let n=ui(this,o.onDidChangeConfiguration,()=>o.getValue("chat.artifacts.rules.byMimeType")??{}),r=ui(this,o.onDidChangeConfiguration,()=>o.getValue("chat.artifacts.rules.byFilePath")??{}),s=ui(this,t.onDidCreateModel,()=>t.getSession(e));this.artifacts=ke(l=>{let c=n.read(l),u=r.read(l),p=s.read(l);if(!p)return[];Fr(this,p.onDidChange).read(l);let g=p.getRequests(),f=[],v=new Set,b=new Set;for(let S of g){let y=S.response;if(!y)continue;v.add(y.id);let w=y.response,k=w.value.length,T=0;for(let V of w.value)(V.kind==="toolInvocation"||V.kind==="toolInvocationSerialized")&&Pi.resultDetails(V)!==void 0&&T++;let P=this._responseCache.get(y.id),O;P&&P.partsLength===k&&P.completedToolCount===T&&P.byMimeType===c&&P.byFilePath===u?O=P.artifacts:(O=bao(w,e,c,u),this._responseCache.set(y.id,{partsLength:k,completedToolCount:T,byMimeType:c,byFilePath:u,artifacts:O}));for(let V of O){let H=V.toolCallId?`${V.toolCallId}:${V.dataPartIndex}`:V.uri;if(b.has(H)){let G=f.findIndex($=>$.toolCallId?`${$.toolCallId}:${$.dataPartIndex}`===H:$.uri===H);G!==-1&&f.splice(G,1)}b.add(H),f.push(V)}}for(let S of this._responseCache.keys())v.has(S)||this._responseCache.delete(S);return f})}set(){throw new Error("Artifacts are not mutable in rules mode")}clear(){throw new Error("Artifacts are not mutable in rules mode")}migrate(){}},tIi=class{constructor(i,e){this._storageKey=i;this._storage=e;this.mutable=So(!0);this._artifacts=ph({owner:this,equalsFn:()=>!1},[]);this.artifacts=this._artifacts;this._artifacts.set(this._storage.get(this._storageKey),void 0)}set(i){this._artifacts.set(i,void 0),this._storage.set(this._storageKey,i)}clear(){this._artifacts.set([],void 0),this._storage.set(this._storageKey,[])}migrate(i){let e=this._artifacts.get();e.length>0&&i.mutable.get()&&i.set([...e]),this._artifacts.set([],void 0),this._storage.delete(this._storageKey)}},iIi=class extends x{constructor(i,e,t,o,n){super(),this._rules=this._register(new eIi(i,o,n)),this._storage=new tIi(e,t);let r=ui(this,n.onDidChangeConfiguration,()=>n.getValue("chat.artifacts.mode")??"rules");this._active=ke(s=>r.read(s)==="tool"?this._storage:this._rules),this.mutable=ke(s=>this._active.read(s).mutable.read(s)),this.artifacts=ke(s=>this._active.read(s).artifacts.read(s))}set(i){this._active.get().set(i)}clear(){this._active.get().clear()}migrate(i){this._storage.migrate(i)}},zDe=class extends x{constructor(e,t,o){super();this._chatService=t;this._configurationService=o;this._instances=this._register(new Vt);this._storage=new LXe(e)}getArtifacts(e){let t=ap(e),o=this._instances.get(t);return o||(o=new iIi(e,t,this._storage,this._chatService,this._configurationService),this._instances.set(t,o)),o}};zDe=I([m(0,ce),m(1,mi),m(2,B)],zDe);var h0=le("chatTodoListService"),RXe=class{constructor(i){this.memento=new Al("chat-todo-list",i)}getSessionData(i){return this.memento.getMemento(1,1)[this.toKey(i)]||[]}setSessionData(i,e){let t=this.memento.getMemento(1,1);t[this.toKey(i)]=e,this.memento.saveMemento()}getTodoList(i){return this.getSessionData(i)}setTodoList(i,e){this.setSessionData(i,e)}migrateTodoList(i,e){let t=this.getSessionData(i);if(t.length>0){this.setSessionData(e,t);let o=this.memento.getMemento(1,1);delete o[this.toKey(i)],this.memento.saveMemento()}}toKey(i){return ap(i)}};RXe=I([m(0,ce)],RXe);var KDe=class extends x{constructor(e){super();this._onDidUpdateTodos=this._register(new E);this.onDidUpdateTodos=this._onDidUpdateTodos.event;this.todoListStorage=new RXe(e)}getTodos(e){return this.todoListStorage.getTodoList(e)}setTodos(e,t){this.todoListStorage.setTodoList(e,t),this._onDidUpdateTodos.fire(e)}migrateTodos(e,t){this.todoListStorage.migrateTodoList(e,t),this._onDidUpdateTodos.fire(t)}};KDe=I([m(0,ce)],KDe);function Sao(a,i){return a===i?!0:!a||!i||typeof a=="string"||typeof i=="string"?!1:Gle(a,i)}var nIi=class extends x{constructor(e,t,o,n,r){super();this._progressObservable=Me(this,[]);this._isCompleteObservable=Me(this,!1);this._onWillDispose=new E;this.onWillDispose=this._onWillDispose.event;this._pendingProgressChunks=new Map;this._isInitialized=!1;this._interruptionWasCanceled=!1;this._disposalPending=!1;this.sessionResource=e,this.providerHandle=t,this.history=[],this._proxy=o,this._providerHandle=t,this._logService=n,this._dialogService=r}get options(){return this._options?new Map(this._options):void 0}get progressObs(){return this._progressObservable}get isCompleteObs(){return this._isCompleteObservable}initialize(e,t){return this._initializationPromise||(this._initializationPromise=this._doInitializeContent(e,t)),this._initializationPromise}async _doInitializeContent(e,t){try{let o=await Wp(this._proxy.$provideChatSessionContent(this._providerHandle,this.sessionResource,t,e),e);this._options=o.options?QX.fromRecord(o.options):void 0,this.title=o.title,this.history.length=0,this.history.push(...o.history.map(l=>{if(l.type==="request"){let c=l.variableData?.variables.map(u=>({...u,value:$n(u.value)}));return{type:"request",prompt:l.prompt,participant:l.participant,command:l.command,variableData:c?{variables:c}:void 0,id:l.id,modelId:l.modelId,modeInstructions:l.modeInstructions?$n(l.modeInstructions):void 0}}return{type:"response",parts:l.parts.map(c=>$n(c)),participant:l.participant}})),o.hasActiveResponseCallback&&!this.interruptActiveResponseCallback&&(this.interruptActiveResponseCallback=async()=>{let l=()=>(this._disposalPending&&(this._proxy.$disposeChatSessionContent(this._providerHandle,this.sessionResource),this._disposalPending=!1),this._proxy.$interruptChatSessionActiveResponse(this._providerHandle,this.sessionResource,"ongoing"),!0);return o.supportsInterruption?l():this._dialogService.confirm({message:d(3295,null)}).then(c=>c.confirmed?l():(this._addProgress([{kind:"progressMessage",content:{value:"",isTrusted:!1}}]),this._interruptionWasCanceled=!0,this._disposalPending&&(this._logService.info(`Canceling deferred disposal for session ${this.sessionResource} (user canceled interruption)`),this._disposalPending=!1),!1))}),o.hasRequestHandler&&!this.requestHandler&&(this.requestHandler=async(l,c,u,p)=>{this._progressObservable.set([],void 0),this._isCompleteObservable.set(!1,void 0);let h=0,g=be(f=>{let v=this._progressObservable.read(f),b=this._isCompleteObservable.read(f);if(v.length>h){let S=v.slice(h);c(S),h=v.length}b&&g.dispose()});try{await this._proxy.$invokeChatSessionRequestHandler(this._providerHandle,this.sessionResource,l,u,p),!this._isCompleteObservable.get()&&!this.interruptActiveResponseCallback&&this._markComplete()}catch(f){let v={kind:"progressMessage",content:{value:`Error: ${f instanceof Error?f.message:String(f)}`,isTrusted:!1}};throw this._addProgress([v]),this._markComplete(),f}finally{g.dispose()}}),o.hasForkHandler&&!this.forkSession&&(this.forkSession=async(l,c)=>{let u=await this._proxy.$forkChatSession(this._providerHandle,this.sessionResource,l?this.toRequestDto(l):void 0,c);return $n(u)}),this._isInitialized=!0;let n=o.hasActiveResponseCallback,r=o.hasRequestHandler,s=n||r;for(let[l,c]of this._pendingProgressChunks)this._logService.debug(`Processing ${c.length} pending progress chunks for session ${this.sessionResource}, requestId ${l}`),this._addProgress(c);this._pendingProgressChunks.clear(),s||this._isCompleteObservable.set(!0,void 0)}catch(o){throw this._logService.error(`Failed to initialize chat session ${this.sessionResource}:`,o),o}}handleProgressChunk(e,t){if(!this._isInitialized){let o=this._pendingProgressChunks.get(e)||[];this._pendingProgressChunks.set(e,[...o,...t]),this._logService.debug(`Queuing ${t.length} progress chunks for session ${this.sessionResource}, requestId ${e} (session not initialized)`);return}this._addProgress(t)}handleProgressComplete(e){this._pendingProgressChunks.delete(e),this._isInitialized&&(this._interruptionWasCanceled?this._interruptionWasCanceled=!1:this._markComplete())}_addProgress(e){let t=this._progressObservable.get();this._progressObservable.set([...t,...e],void 0)}_markComplete(){this._isCompleteObservable.get()||this._isCompleteObservable.set(!0,void 0)}toRequestDto(e){return{type:"request",id:e.id,prompt:e.prompt,participant:e.participant,command:e.command,variableData:void 0,modelId:e.modelId,modeInstructions:e.modeInstructions}}dispose(){this._onWillDispose.fire(),this._onWillDispose.dispose(),this._pendingProgressChunks.clear(),this.interruptActiveResponseCallback&&!this._interruptionWasCanceled?this._disposalPending=!0:this._proxy.$disposeChatSessionContent(this._providerHandle,this.sessionResource),super.dispose()}},MXe=class extends x{constructor(e,t,o,n,r){super();this._chatService=n;this._logService=r;this._onDidChangeChatSessionItems=this._register(new E);this.onDidChangeChatSessionItems=this._onDidChangeChatSessionItems.event;this._modelListeners=this._register(new Xb);this._isDisposed=!1;this._items=new gt;this._proxy=e,this._handle=o;let s=async l=>{if(gl(l.sessionResource)!==t||(await this.refresh(Se.None),this._isDisposed))return;this.tryUpdateItemForModel(l);let c=l.lastRequestObs.map(p=>p?.response&&Fr("chatSessions.modelRequestChangeListener",p.response.onDidChange)),u=Fr("chatSessions.modelChangeListener",l.onDidChange);this._modelListeners.set(l.sessionResource,be(p=>{c.read(p)?.read(p),u.read(p),this.tryUpdateItemForModel(l)}))};this._register(n.onDidCreateModel(l=>s(l)));for(let l of n.chatModels.get())s(l);this._register(n.onDidDisposeSession(l=>{for(let c of l.sessionResources)this._modelListeners.deleteAndDispose(c)}))}dispose(){this._isDisposed=!0,super.dispose()}get items(){return Array.from(this._items.values())}refresh(e){return this._proxy.$refreshChatSessionItems(this._handle,e)}async newChatSessionItem(e,t){let o=await Wp(this._proxy.$newChatSessionItem(this._handle,{prompt:e.prompt,command:e.command,initialSessionOptions:e.initialSessionOptions?QX.toStrValueArray(e.initialSessionOptions):void 0},t),t);return o?this.addOrUpdateItem(o):void 0}async acceptChange(e){let t=[];for(let o of e.addedOrUpdated)t.push(await this.addOrUpdateItem(o));for(let o of e.removed)this._items.delete(o);this._onDidChangeChatSessionItems.fire({addedOrUpdated:t,removed:e.removed})}async addOrUpdateItem(e){let t=A.revive(e.resource);GDe(t,this._logService);let o=this._items.get(t),n=new rIi(e,this._chatService.getSession(t),await this._chatService.getMetadataForSession(t));return o?.isEqual(n)?o:(this._items.set(t,n),this._onDidChangeChatSessionItems.fire({addedOrUpdated:[n]}),n)}async tryUpdateItemForModel(e){let t=e.sessionResource,o=this._items.get(t);o&&this.addOrUpdateItem(o)}};MXe=I([m(3,mi),m(4,se)],MXe);var rIi=class{constructor(i,e,t){if(this.resource=A.revive(i.resource),this.label=i.label,this.timing=i.timing,this.iconPath=i.iconPath,this.badge=oIi(i.badge),this.tooltip=oIi(i.tooltip),this.archived=i.archived,this.metadata=i.metadata,this.description=(e&&BNt(e))??oIi(i.description),this.status=(e&&sOt(e))??i.status,this.changes=$n(i.changes),t&&!this.changes){let o={files:t.stats?.fileCount||0,insertions:t.stats?.added||0,deletions:t.stats?.removed||0};Ipe(o)&&(this.changes=o)}}isEqual(i){return Qe(this.resource,i.resource)&&this.label===i.label&&this.description===i.description&&this.status===i.status&&this.timing.created===i.timing.created&&this.timing.lastRequestStarted===i.timing.lastRequestStarted&&this.timing.lastRequestEnded===i.timing.lastRequestEnded&&eo(this.changes,i.changes)&&eo(this.iconPath,i.iconPath)&&Sao(this.badge,i.badge)&&Sao(this.tooltip,i.tooltip)&&this.archived===i.archived&&eo(this.metadata,i.metadata)}},hOt=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this._extHostContext=e;this._agentSessionsService=t;this._chatSessionsService=o;this._chatService=n;this._chatWidgetService=r;this._chatTodoListService=s;this._chatArtifactsService=l;this._chatDebugService=c;this._dialogService=u;this._editorService=p;this.editorGroupService=h;this._logService=g;this._instantiationService=f;this._itemControllerRegistrations=this._register(new Vt);this._contentProvidersRegistrations=this._register(new Vt);this._sessionTypeToHandle=new Map;this._activeSessions=new gt;this._sessionDisposables=new gt;this._proxy=this._extHostContext.getProxy(to.ExtHostChatSessions),this._register(this._chatSessionsService.onDidChangeSessionOptions(({sessionResource:v,updates:b})=>{GDe(v,this._logService);let S=this._getHandleForSessionType(v.scheme);this._logService.trace(`[MainThreadChatSessions] onRequestNotifyExtension received: scheme '${v.scheme}', handle ${S}, ${b.size} update(s)`),S!==void 0?this.notifyOptionsChange(S,v,b):this._logService.warn(`[MainThreadChatSessions] Cannot notify option change for scheme '${v.scheme}': no provider registered. Registered schemes: [${Array.from(this._sessionTypeToHandle.keys()).join(", ")}]`)})),this._register(this._agentSessionsService.model.onDidChangeSessionArchivedState(v=>{for(let[b,{chatSessionType:S}]of this._itemControllerRegistrations)S===v.providerType&&(GDe(v.resource,this._logService),this._proxy.$onDidChangeChatSessionItemState(b,v.resource,v.isArchived()))}))}_getHandleForSessionType(e){return this._sessionTypeToHandle.get(e)}$registerChatSessionItemController(e,t){let o=new N,n=o.add(this._instantiationService.createInstance(MXe,this._proxy,t,e));o.add(this._chatSessionsService.registerChatSessionItemController(t,n)),this._itemControllerRegistrations.set(e,{chatSessionType:t,controller:n,dispose:()=>o.dispose()})}getController(e){let t=this._itemControllerRegistrations.get(e);if(!t)throw new Error(`No chat session controller registered for handle ${e}`);return t.controller}async $updateChatSessionItems(e,t){this.getController(e).acceptChange({addedOrUpdated:t.addedOrUpdated,removed:t.removed.map(n=>A.revive(n))})}async $addOrUpdateChatSessionItem(e,t){this.getController(e).acceptChange({addedOrUpdated:[t],removed:[]})}$onDidChangeChatSessionOptions(e,t,o){let n=A.revive(t);GDe(n,this._logService),this._chatSessionsService.updateSessionOptions(n,QX.fromRecord(o))}async $onDidCommitChatSessionItem(e,t,o){let n=A.revive(t),r=A.revive(o);this._logService.trace(`$onDidCommitChatSessionItem: handle(${e}), original(${n}), modified(${r})`);let s=this._itemControllerRegistrations.get(e)?.chatSessionType;if(!s){this._logService.error(`No chat session type found for provider handle ${e}`);return}let l=this._editorService.editors.find(p=>p.resource?.toString()===n.toString()),c=this._chatService.acquireExistingSession(n),u=this._chatSessionsService.getAllChatSessionContributions().find(p=>p.type===s);try{this._chatTodoListService.migrateTodos(n,r),this._chatArtifactsService.getArtifacts(n).migrate(this._chatArtifactsService.getArtifacts(r)),s==="copilotcli"&&this._chatDebugService.invokeProviders(r).catch(()=>{});let p=this.editorGroupService.groups.find(v=>v.editors.some(b=>Qe(b.resource,n)))??this.editorGroupService.activeGroup,h={title:{preferred:l?.getName()||void 0,fallback:d(3294,null,u?.displayName)}},g=await this._chatSessionsService.getOrCreateChatSession(A.revive(r),Se.None);if(l){g.transferredState=l instanceof Na?{editingSession:l.transferOutEditingSession(),inputState:c?.object?.inputModel.toJSON()}:void 0,await this._editorService.replaceEditors([{editor:l,replacement:{resource:r,options:h}}],p),this._resendPendingRequests(n,r);return}c&&(g.transferredState={editingSession:c.object.editingSession,inputState:c.object.inputModel.toJSON()});let f=this._chatWidgetService.getWidgetBySessionResource(n);f&&py(f.viewContext)?await this._chatWidgetService.openSession(r,void 0,{preserveFocus:!0}):(await this._chatService.acquireOrLoadSession(r,"panel",Se.None))?.dispose(),this._resendPendingRequests(n,r),this._chatSessionsService.fireSessionCommitted(n,r)}finally{c?.dispose()}}_resendPendingRequests(e,t){this._chatService.migrateRequests(e,t)}async _provideChatSessionContent(e,t,o){GDe(t,this._logService);let n=this._activeSessions.get(t);if(!n){n=new nIi(t,e,this._proxy,this._logService,this._dialogService),this._activeSessions.set(t,n);let r=n.onWillDispose(()=>{this._activeSessions.delete(t),this._sessionDisposables.get(t)?.dispose(),this._sessionDisposables.delete(t)});this._sessionDisposables.set(t,r)}try{let r=this._chatSessionsService.getSessionOptions(t);if(await n.initialize(o,{initialSessionOptions:r?[...r].map(([s,l])=>({optionId:s,value:typeof l=="string"?l:l?.id})):void 0}),n.options){for(let[s,l]of this._sessionTypeToHandle)if(l===e){for(let[c,u]of n.options)this._chatSessionsService.setSessionOption(t,c,u);break}}return n}catch(r){throw n.dispose(),this._logService.error(`Error providing chat session content for handle ${e} and resource ${t.toString()}:`,r),r}}$unregisterChatSessionItemController(e){this._itemControllerRegistrations.deleteAndDispose(e)}$registerChatSessionContentProvider(e,t){let o={provideChatSessionContent:(n,r)=>this._provideChatSessionContent(e,n,r)};this._sessionTypeToHandle.set(t,e),this._contentProvidersRegistrations.set(e,this._chatSessionsService.registerChatSessionContentProvider(t,o)),this._refreshProviderOptions(e,t)}$unregisterChatSessionContentProvider(e){this._contentProvidersRegistrations.deleteAndDispose(e);for(let[t,o]of this._sessionTypeToHandle)if(o===e){this._sessionTypeToHandle.delete(t);break}for(let[t,o]of this._activeSessions)o.providerHandle===e&&(o.dispose(),this._activeSessions.delete(t))}async $handleProgressChunk(e,t,o,n){let r=A.revive(t),s=this._activeSessions.get(r);if(!s){this._logService.warn(`No session found for progress chunks: handle ${e}, sessionResource ${r}, requestId ${o}`);return}let l=n.map(c=>{let[u]=Array.isArray(c)?c:[c];return $n(u)});s.handleProgressChunk(o,l)}$handleProgressComplete(e,t,o){let n=A.revive(t);GDe(n,this._logService);let r=this._activeSessions.get(n);if(!r){this._logService.warn(`No session found for progress completion: handle ${e}, sessionResource ${n}, requestId ${o}`);return}r.handleProgressComplete(o)}$handleAnchorResolve(e,t,o,n,r){}$onDidChangeChatSessionProviderOptions(e){let t;for(let[o,n]of this._sessionTypeToHandle)if(n===e){t=o;break}if(!t){this._logService.warn(`No session type found for chat session content provider handle ${e} when refreshing provider options`);return}this._refreshProviderOptions(e,t)}_refreshProviderOptions(e,t){this._proxy.$provideChatSessionProviderOptions(e,Se.None).then(o=>{if(o?.optionGroups&&o.optionGroups.length){let n=o.optionGroups.map(r=>({...r,onSearch:r.searchable?async(s,l)=>await this._proxy.$invokeOptionGroupSearch(e,r.id,s,l):void 0}));this._chatSessionsService.setOptionGroupsForSessionType(t,e,n)}o?.newSessionOptions&&this._chatSessionsService.setNewSessionOptionsForSessionType(t,QX.fromRecord(o.newSessionOptions))}).catch(o=>this._logService.error("Error fetching chat session options",o))}dispose(){for(let e of this._activeSessions.values())e.dispose();this._activeSessions.clear();for(let e of this._sessionDisposables.values())e.dispose();this._sessionDisposables.clear(),super.dispose()}async notifyOptionsChange(e,t,o){this._logService.trace(`[MainThreadChatSessions] notifyOptionsChange: starting proxy call for handle ${e}, sessionResource ${t}`);try{await this._proxy.$provideHandleOptionsChange(e,t,Object.fromEntries(o),Se.None),this._logService.trace(`[MainThreadChatSessions] notifyOptionsChange: proxy call completed for handle ${e}, sessionResource ${t}`)}catch(n){this._logService.error(`[MainThreadChatSessions] notifyOptionsChange: error for handle ${e}, sessionResource ${t}:`,n)}}};hOt=I([fo(qi.MainThreadChatSessions),m(1,md),m(2,Us),m(3,mi),m(4,Pt),m(5,h0),m(6,LZ),m(7,Yp),m(8,at),m(9,ee),m(10,wt),m(11,se),m(12,F)],hOt);function GDe(a,i){TK(a)&&i.warn(`[MainThreadChatSessions] untitled-style sessionResource detected ${a.toString()}`)}function oIi(a){if(a){if(typeof a=="string")return a;if(typeof a=="object"&&"value"in a)return Ie.lift(a)}}var gOt=class extends x{constructor(e,t){super();this._dataChannelService=t;this._proxy=e.getProxy(to.ExtHostDataChannels),this._register(this._dataChannelService.onDidSendData(o=>{this._proxy.$onDidReceiveData(o.channelId,o.data)}))}};gOt=I([fo(qi.MainThreadDataChannels),m(1,eX)],gOt);var k2=le("meteredConnectionService"),qDe="network.meteredConnection";function sIi(){let a=navigator.connection;if(!a)return!1;if(a.saveData||a.metered)return!0;let i=a.effectiveType;return i==="2g"||i==="slow-2g"}var fOt=class extends x{constructor(e,t){super();this._onDidChangeIsConnectionMetered=this._register(new E);this.onDidChangeIsConnectionMetered=this._onDidChangeIsConnectionMetered.event;this._isBrowserConnectionMetered=t,this._meteredConnectionSetting=e.getValue(qDe),this._isConnectionMetered=this._meteredConnectionSetting==="on"||this._meteredConnectionSetting!=="off"&&this._isBrowserConnectionMetered,this._register(e.onDidChangeConfiguration(o=>{if(o.affectsConfiguration(qDe)){let n=e.getValue(qDe);n!==this._meteredConnectionSetting&&(this._meteredConnectionSetting=n,this.onUpdated())}}))}get isConnectionMetered(){return this._isConnectionMetered}get isBrowserConnectionMetered(){return this._isBrowserConnectionMetered}setIsBrowserConnectionMetered(e){e!==this._isBrowserConnectionMetered&&(this._isBrowserConnectionMetered=e,this.onChangeBrowserConnection())}onChangeBrowserConnection(){this.onUpdated()}onUpdated(){let e=this._meteredConnectionSetting==="on"||this._meteredConnectionSetting!=="off"&&this._isBrowserConnectionMetered;e!==this._isConnectionMetered&&(this._isConnectionMetered=e,this.onChangeIsConnectionMetered())}onChangeIsConnectionMetered(){this._onDidChangeIsConnectionMetered.fire(this._isConnectionMetered)}};var vOt=class extends x{constructor(e,t){super();this.meteredConnectionService=t;this._proxy=e.getProxy(to.ExtHostMeteredConnection),this._proxy.$initializeIsConnectionMetered(this.meteredConnectionService.isConnectionMetered),this._register(this.meteredConnectionService.onDidChangeIsConnectionMetered(o=>{this._proxy.$onDidChangeIsConnectionMetered(o)}))}};vOt=I([fo(qi.MainThreadMeteredConnection),m(1,k2)],vOt);var $De=class extends x{constructor(e){super();this.logService=e;this._delegateBarrier=new B$(1e4)}get repositories(){return this._delegate?.repositories??[]}setDelegate(e){if(this._delegate)throw this.logService.error("[GitService][setDelegate] GitExtension delegate is already set."),new li("GitExtension delegate is already set.");return this._delegate=e,this._delegateBarrier.open(),Z(()=>{this._delegate=void 0})}async openRepository(e){if(await this._delegateBarrier.wait(),!this._delegate){this.logService.warn("[GitService][openRepository] GitExtension delegate is not set after 10 seconds. Cannot open repository.");return}return this._delegate.openRepository(e)}};$De=I([m(0,se)],$De);var bOt=class extends x{constructor(e,t,o){super();this.delegate=o;this.rootUri=e,this.state=ph({owner:this,equalsFn:b_},t)}updateState(e){this.state.set(e,void 0)}async getRefs(e,t){return this.delegate.getRefs(this.rootUri,e,t)}async diffBetweenWithStats(e,t,o){return this.delegate.diffBetweenWithStats(this.rootUri,e,t,o)}async diffBetweenWithStats2(e,t){return this.delegate.diffBetweenWithStats2(this.rootUri,e,t)}};var jDe=le("gitService");function wao(a){switch(a){case 0:return 0;case 1:return 1;case 2:return 2;default:throw new Error(`Unknown GitRefType: ${a}`)}}function Iao(a){return{uri:A.revive(a.uri),originalUri:a.originalUri?A.revive(a.originalUri):void 0,modifiedUri:a.modifiedUri?A.revive(a.modifiedUri):void 0,insertions:a.insertions,deletions:a.deletions}}function yao(a){return{HEAD:a?.HEAD?{type:wao(a.HEAD.type),name:a.HEAD.name,commit:a.HEAD.commit,remote:a.HEAD.remote,base:a.HEAD.base,upstream:a.HEAD.upstream,ahead:a.HEAD.ahead,behind:a.HEAD.behind}:void 0,mergeChanges:a?.mergeChanges?.map(i=>({uri:A.revive(i.uri),originalUri:i.originalUri?A.revive(i.originalUri):void 0,modifiedUri:i.modifiedUri?A.revive(i.modifiedUri):void 0}))??[],indexChanges:a?.indexChanges?.map(i=>({uri:A.revive(i.uri),originalUri:i.originalUri?A.revive(i.originalUri):void 0,modifiedUri:i.modifiedUri?A.revive(i.modifiedUri):void 0}))??[],workingTreeChanges:a?.workingTreeChanges?.map(i=>({uri:A.revive(i.uri),originalUri:i.originalUri?A.revive(i.originalUri):void 0,modifiedUri:i.modifiedUri?A.revive(i.modifiedUri):void 0}))??[],untrackedChanges:a?.untrackedChanges?.map(i=>({uri:A.revive(i.uri),originalUri:i.originalUri?A.revive(i.originalUri):void 0,modifiedUri:i.modifiedUri?A.revive(i.modifiedUri):void 0}))??[]}}var SOt=class extends x{constructor(e,t){super();this.gitService=t;this._openRepositorySequencer=new rm;this._repositoryHandles=new gt;this._repositories=new Map;this._proxy=e.getProxy(to.ExtHostGitExtension),this._initializeDelegate()}get repositories(){return this._repositories.values()}async _initializeDelegate(){await this._proxy.$isGitExtensionAvailable()&&!this._store.isDisposed&&this._register(this.gitService.setDelegate(this))}_getRepositoryByUri(e){let t=this._repositoryHandles.get(e);return t!==void 0?this._repositories.get(t):void 0}async openRepository(e){return this._openRepositorySequencer.queue(async()=>{let t=this._getRepositoryByUri(e);if(t)return t;let o=await this._proxy.$openRepository(e);if(!o)return;let n=A.revive(o.rootUri),r=this._getRepositoryByUri(n);if(r)return r;let s=yao(o.state),l=new bOt(n,s,this);return this._repositories.set(o.handle,l),this._repositoryHandles.set(n,o.handle),l})}async getRefs(e,t,o){let n=this._repositoryHandles.get(e);if(n===void 0)return[];let r=await this._proxy.$getRefs(n,t,o);return o?.isCancellationRequested?[]:r.map(s=>({...s,type:wao(s.type)}))}async diffBetweenWithStats(e,t,o,n){let r=this._repositoryHandles.get(e);return r===void 0?[]:(await this._proxy.$diffBetweenWithStats(r,t,o,n)).map(Iao)}async diffBetweenWithStats2(e,t,o){let n=this._repositoryHandles.get(e);return n===void 0?[]:(await this._proxy.$diffBetweenWithStats2(n,t,o)).map(Iao)}async $onDidChangeRepository(e){let t=this._repositories.get(e);if(!t)return;let o=await this._proxy.$getRepositoryState(e);o&&t.updateState(yao(o))}};SOt=I([fo(qi.MainThreadGitExtension),m(1,jDe)],SOt);var Tf=le("playwrightService");var RS="workbench.action.browser",Du=(P=>(P.Open=`${RS}.open`,P.NewTab=`${RS}.newTab`,P.QuickOpen=`${RS}.quickOpen`,P.CloseAll=`${RS}.closeAll`,P.CloseAllInGroup=`${RS}.closeAllInGroup`,P.GoBack=`${RS}.goBack`,P.GoForward=`${RS}.goForward`,P.Reload=`${RS}.reload`,P.HardReload=`${RS}.hardReload`,P.FocusUrlInput=`${RS}.focusUrlInput`,P.OpenExternal=`${RS}.openExternal`,P.OpenSettings=`${RS}.openSettings`,P.AddElementToChat=`${RS}.addElementToChat`,P.AddConsoleLogsToChat=`${RS}.addConsoleLogsToChat`,P.ToggleDevTools=`${RS}.toggleDevTools`,P.ClearGlobalStorage=`${RS}.clearGlobalStorage`,P.ClearWorkspaceStorage=`${RS}.clearWorkspaceStorage`,P.ClearEphemeralStorage=`${RS}.clearEphemeralStorage`,P.ShowFind=`${RS}.showFind`,P.HideFind=`${RS}.hideFind`,P.FindNext=`${RS}.findNext`,P.FindPrevious=`${RS}.findPrevious`,P))(Du||{});var Cao="browserView",DD=[.25,1/3,.5,2/3,.75,.8,.9,1,1.1,1.25,1.5,1.75,2,2.5,3,4,5],PXe=DD.indexOf(1);function xao(a){return d(1889,null,Math.round(a*100))}function kao(a){return d(1888,null,Math.round(a*100))}var YDe=le("browserZoomService"),aIi="browserView.zoomPerHost",AXe="Match Window",O8o=new Map(DD.map((a,i)=>[`${Math.round(a*100)}%`,i])),QDe=class extends x{constructor(e,t){super();this.configurationService=e;this.storageService=t;this._onDidChangeZoom=this._register(new E);this.onDidChangeZoom=this._onDidChangeZoom.event;this._ephemeralZoomMap=new Map;this._windowZoomFactor=lce(0);this._persistentZoomMap=this._readPersistentZoomMap(),this._register(this.configurationService.onDidChangeConfiguration(o=>{o.affectsConfiguration("workbench.browser.pageZoom")&&this._onDidChangeZoom.fire({host:void 0,isEphemeralChange:!1})}))}getEffectiveZoomIndex(e,t){if(e!==void 0)if(t){let o=this._ephemeralZoomMap.get(e);if(o!==void 0)return this._clamp(o)}else{let o=this._persistentZoomMap[e];if(o!==void 0)return this._clamp(o)}return this._getDefaultZoomIndex()}setHostZoomIndex(e,t,o){let n=this._clamp(t),r=this._getDefaultZoomIndex(),s=n===r;if(o){if(s){if(!this._ephemeralZoomMap.has(e))return;this._ephemeralZoomMap.delete(e)}else{if(this._ephemeralZoomMap.get(e)===n)return;this._ephemeralZoomMap.set(e,n)}this._onDidChangeZoom.fire({host:e,isEphemeralChange:!0})}else{let l=!1;s?Object.prototype.hasOwnProperty.call(this._persistentZoomMap,e)&&(delete this._persistentZoomMap[e],l=!0):this._persistentZoomMap[e]!==n&&(this._persistentZoomMap[e]=n,l=!0);let c=!1;if(s?c=this._ephemeralZoomMap.delete(e):this._ephemeralZoomMap.get(e)!==n&&(this._ephemeralZoomMap.set(e,n),c=!0),!l&&!c)return;l&&this._writePersistentZoomMap(),this._onDidChangeZoom.fire({host:e,isEphemeralChange:!1})}}notifyWindowZoomChanged(e){this._windowZoomFactor=e,this.configurationService.getValue("workbench.browser.pageZoom")===AXe&&this._onDidChangeZoom.fire({host:void 0,isEphemeralChange:!1})}_getDefaultZoomIndex(){let e=this.configurationService.getValue("workbench.browser.pageZoom");return e===AXe?this._getMatchWindowZoomIndex():O8o.get(e)??PXe}_getMatchWindowZoomIndex(){let e=this._windowZoomFactor,t=PXe,o=1/0;for(let n=0;n<DD.length;n++){let r=Math.abs(Math.log(DD[n])-Math.log(e));r<o&&(o=r,t=n)}return t}_readPersistentZoomMap(){let e=this.storageService.get(aIi,0);if(!e)return{};try{let t=JSON.parse(e);if(typeof t!="object"||t===null||Array.isArray(t))return{};let o={};for(let[n,r]of Object.entries(t))typeof r=="number"&&r>=0&&r<DD.length&&(o[n]=r);return o}catch{return{}}}_writePersistentZoomMap(){Object.keys(this._persistentZoomMap).length>0?this.storageService.store(aIi,JSON.stringify(this._persistentZoomMap),0,1):this.storageService.remove(aIi,0)}_clamp(e){return Math.max(0,Math.min(Math.trunc(e),DD.length-1))}};QDe=I([m(0,B),m(1,ce)],QDe);function Eao(a){let i=URL.parse(a);if(!(!i?.host||i.protocol!=="http:"&&i.protocol!=="https:"))return i.host}var v3=le("browserViewWorkbenchService"),IOt=le("browserViewCDPService"),E2=class extends x{constructor(e,t,o,n,r,s,l,c,u,p){super();this.id=e;this.browserViewService=t;this.workspaceContextService=o;this.workspaceTrustManagementService=n;this.telemetryService=r;this.configurationService=s;this.playwrightService=l;this.dialogService=c;this.storageService=u;this.zoomService=p;this._url="";this._title="";this._favicon=void 0;this._screenshot=void 0;this._loading=!1;this._focused=!1;this._visible=!1;this._isDevToolsOpen=!1;this._canGoBack=!1;this._canGoForward=!1;this._error=void 0;this._certificateError=void 0;this._storageScope="ephemeral";this._isEphemeral=!1;this._zoomHost=void 0;this._sharedWithAgent=!1;this._browserZoomIndex=PXe;this._onDidChangeSharedWithAgent=this._register(new E);this.onDidChangeSharedWithAgent=this._onDidChangeSharedWithAgent.event;this._onDidChangeZoom=this._register(new E);this.onDidChangeZoom=this._onDidChangeZoom.event;this._onWillDispose=this._register(new E);this.onWillDispose=this._onWillDispose.event}get url(){return this._url}get title(){return this._title}get favicon(){return this._favicon}get loading(){return this._loading}get focused(){return this._focused}get visible(){return this._visible}get isDevToolsOpen(){return this._isDevToolsOpen}get canGoBack(){return this._canGoBack}get canGoForward(){return this._canGoForward}get screenshot(){return this._screenshot}get error(){return this._error}get certificateError(){return this._certificateError}get storageScope(){return this._storageScope}get sharedWithAgent(){return this._sharedWithAgent}get zoomFactor(){return DD[this._browserZoomIndex]}get canZoomIn(){return this._browserZoomIndex<DD.length-1}get canZoomOut(){return this._browserZoomIndex>0}get onDidNavigate(){return this.browserViewService.onDynamicDidNavigate(this.id)}get onDidChangeLoadingState(){return this.browserViewService.onDynamicDidChangeLoadingState(this.id)}get onDidChangeFocus(){return this.browserViewService.onDynamicDidChangeFocus(this.id)}get onDidChangeDevToolsState(){return this.browserViewService.onDynamicDidChangeDevToolsState(this.id)}get onDidKeyCommand(){return this.browserViewService.onDynamicDidKeyCommand(this.id)}get onDidChangeTitle(){return this.browserViewService.onDynamicDidChangeTitle(this.id)}get onDidChangeFavicon(){return this.browserViewService.onDynamicDidChangeFavicon(this.id)}get onDidRequestNewPage(){return this.browserViewService.onDynamicDidRequestNewPage(this.id)}get onDidFindInPage(){return this.browserViewService.onDynamicDidFindInPage(this.id)}get onDidChangeVisibility(){return this.browserViewService.onDynamicDidChangeVisibility(this.id)}get onDidClose(){return this.browserViewService.onDynamicDidClose(this.id)}async initialize(e){let t=this.configurationService.getValue("workbench.browser.dataStorage")??"global";await this.workspaceTrustManagementService.workspaceTrustInitialized;let n=this.workspaceContextService.getWorkbenchState()!==1&&!this.workspaceTrustManagementService.isWorkspaceTrusted()?"ephemeral":t,r=this.workspaceContextService.getWorkspace().id,s=e?await this.browserViewService.getOrCreateBrowserView(this.id,n,r):await this.browserViewService.getState(this.id);this._url=s.url,this._title=s.title,this._loading=s.loading,this._focused=s.focused,this._visible=s.visible,this._isDevToolsOpen=s.isDevToolsOpen,this._canGoBack=s.canGoBack,this._canGoForward=s.canGoForward,this._screenshot=s.lastScreenshot,this._favicon=s.lastFavicon,this._error=s.lastError,this._certificateError=s.certificateError,this._storageScope=s.storageScope,this._sharedWithAgent=await this.playwrightService.isPageTracked(this.id),this._browserZoomIndex=s.browserZoomIndex,this._isEphemeral=this._storageScope==="ephemeral",this._zoomHost=Eao(this._url);let l=this.zoomService.getEffectiveZoomIndex(this._zoomHost,this._isEphemeral);l!==this._browserZoomIndex&&await this.setBrowserZoomIndex(l),this._register(this.zoomService.onDidChangeZoom(({host:c,isEphemeralChange:u})=>{u&&!this._isEphemeral||(c===void 0||c===this._zoomHost)&&this.setBrowserZoomIndex(this.zoomService.getEffectiveZoomIndex(this._zoomHost,this._isEphemeral))})),this._register(this.onDidNavigate(c=>{URL.parse(c.url)?.host!==URL.parse(this._url)?.host&&(this._favicon=void 0),this._zoomHost=Eao(c.url),this._url=c.url,this._title=c.title,this._canGoBack=c.canGoBack,this._canGoForward=c.canGoForward,this._certificateError=c.certificateError,this.setBrowserZoomIndex(this.zoomService.getEffectiveZoomIndex(this._zoomHost,this._isEphemeral),!0)})),this._register(this.onDidChangeLoadingState(c=>{this._loading=c.loading,this._error=c.error})),this._register(this.onDidChangeDevToolsState(c=>{this._isDevToolsOpen=c.isDevToolsOpen})),this._register(this.onDidChangeTitle(c=>{this._title=c.title})),this._register(this.onDidChangeFavicon(c=>{this._favicon=c.favicon})),this._register(this.onDidChangeFocus(({focused:c})=>{this._focused=c})),this._register(this.onDidChangeVisibility(({visible:c})=>{this._visible=c})),this._register(this.playwrightService.onDidChangeTrackedPages(c=>{this._setSharedWithAgent(c.includes(this.id))}))}async layout(e){return this.browserViewService.layout(this.id,e)}async setVisible(e){return this._visible=e,this.browserViewService.setVisible(this.id,e)}async loadURL(e){return this.logNavigationTelemetry("urlInput",e),this.browserViewService.loadURL(this.id,e)}async goBack(){return this.logNavigationTelemetry("goBack",this._url),this.browserViewService.goBack(this.id)}async goForward(){return this.logNavigationTelemetry("goForward",this._url),this.browserViewService.goForward(this.id)}async reload(e){return this.logNavigationTelemetry("reload",this._url),this.browserViewService.reload(this.id,e)}async toggleDevTools(){return this.browserViewService.toggleDevTools(this.id)}async captureScreenshot(e){let t=await this.browserViewService.captureScreenshot(this.id,e);return!e?.screenRect&&!e?.pageRect&&(this._screenshot=t),t}async focus(){return this.browserViewService.focus(this.id)}async findInPage(e,t){return this.browserViewService.findInPage(this.id,e,t)}async stopFindInPage(e){return this.browserViewService.stopFindInPage(this.id,e)}async getSelectedText(){return this.browserViewService.getSelectedText(this.id)}async clearStorage(){return this.browserViewService.clearStorage(this.id)}async trustCertificate(e,t){return this.browserViewService.trustCertificate(this.id,e,t)}async untrustCertificate(e,t){return this.browserViewService.untrustCertificate(this.id,e,t)}async setBrowserZoomIndex(e,t=!1){let o=Math.max(0,Math.min(e,DD.length-1));!t&&o===this._browserZoomIndex||(this._browserZoomIndex=o,await this.browserViewService.setBrowserZoomIndex(this.id,this._browserZoomIndex),this._onDidChangeZoom.fire())}async zoomIn(){this.canZoomIn&&(await this.setBrowserZoomIndex(this._browserZoomIndex+1),this._zoomHost&&this.zoomService.setHostZoomIndex(this._zoomHost,this._browserZoomIndex,this._isEphemeral))}async zoomOut(){this.canZoomOut&&(await this.setBrowserZoomIndex(this._browserZoomIndex-1),this._zoomHost&&this.zoomService.setHostZoomIndex(this._zoomHost,this._browserZoomIndex,this._isEphemeral))}async resetZoom(){let e=this.zoomService.getEffectiveZoomIndex(void 0,!1);await this.setBrowserZoomIndex(e),this._zoomHost&&this.zoomService.setHostZoomIndex(this._zoomHost,e,this._isEphemeral)}async getConsoleLogs(){return this.browserViewService.getConsoleLogs(this.id)}async getElementData(e){return this._wrapCancellable(e,t=>this.browserViewService.getElementData(this.id,t))}async getFocusedElementData(){return this.browserViewService.getFocusedElementData(this.id)}static{this.SHARE_DONT_ASK_KEY="browserView.shareWithAgent.dontAskAgain"}async setSharedWithAgent(e){if(e){if(this.storageService.getBoolean(E2.SHARE_DONT_ASK_KEY,0))this.telemetryService.publicLog2("integratedBrowser.shareWithAgent",{shared:!0,dontAskAgain:!0});else{let o=await this.dialogService.confirm({type:"question",title:d(5384,null),message:d(5383,null),detail:d(5381,null),primaryButton:d(5379,null),cancelButton:d(5380,null),checkbox:{label:d(5382,null),checked:!1}});if(o.confirmed&&o.checkboxChecked&&this.storageService.store(E2.SHARE_DONT_ASK_KEY,o.confirmed,0,0),this.telemetryService.publicLog2("integratedBrowser.shareWithAgent",{shared:o.confirmed,dontAskAgain:o.checkboxChecked??!1}),!o.confirmed)return}await this.playwrightService.startTrackingPage(this.id),this._setSharedWithAgent(!0)}else await this.playwrightService.stopTrackingPage(this.id),this._setSharedWithAgent(!1)}_setSharedWithAgent(e){e!==this._sharedWithAgent&&(this._sharedWithAgent=e,this._onDidChangeSharedWithAgent.fire(e))}static{this._cancellationIdPool=0}async _wrapCancellable(e,t){let o=E2._cancellationIdPool++,n=e.onCancellationRequested(()=>{this.browserViewService.cancel(o)});try{return await t(o)}finally{n.dispose()}}logNavigationTelemetry(e,t){let o;try{o=dYe(new URL(t).host)}catch{o=!1}this.telemetryService.publicLog2("integratedBrowser.navigation",{navigationType:e,isLocalhost:o})}dispose(){this._onWillDispose.fire(),this.browserViewService.destroyBrowserView(this.id),super.dispose()}};E2=I([m(2,Pe),m(3,Nr),m(4,Te),m(5,B),m(6,Tf),m(7,at),m(8,ce),m(9,YDe)],E2);var Ey;(o=>{o.scheme=Q.vscodeBrowser;function i(n){return A.from({scheme:o.scheme,path:`/${n}`})}o.forId=i;function e(n){if(n.scheme!==o.scheme)return;let r=n.path.startsWith("/")?n.path.substring(1):n.path;if(r)return{id:r}}o.parse=e;function t(n){return e(n)?.id}o.getId=t})(Ey||={});function nH(a,i){a.publicLog2("integratedBrowser.open",{source:i})}var W8o=a=>`
	<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">
		<path d="M8 1a7 7 0 1 0 0 14 7 7 0 0 0 0-14zm0 1.5a5.5 5.5 0 1 1 0 11 5.5 5.5 0 0 1 0-11z" fill="${a}" opacity="0.3"/>
		<path d="M8 1a7 7 0 0 1 7 7h-1.5A5.5 5.5 0 0 0 8 2.5V1z" fill="${a}">
			<animateTransform attributeName="transform" type="rotate" dur="1s" repeatCount="indefinite" values="0 8 8;360 8 8"/>
		</path>
	</svg>
`,V8o=30,sd=class extends ls{constructor(e,t,o,n,r,s){super();this.themeService=t;this.browserViewWorkbenchService=o;this.lifecycleService=n;this.instantiationService=r;this.telemetryService=s;this._id=e.id,this._initialData=e,this._register(this.lifecycleService.onWillShutdown(l=>{this._model&&(l.reason===3?this._model.setVisible(!1):(this._model.dispose(),this._model=void 0))}))}static{this.ID="workbench.editorinputs.browser"}static{this.EDITOR_ID="workbench.editor.browser"}static{this.DEFAULT_LABEL=d(5378,null)}get id(){return this._id}get url(){return this._model?this._model.url:this._initialData.url}get title(){return this._model?this._model.title:this._initialData.title}get favicon(){return this._model?this._model.favicon:this._initialData.favicon}navigate(e){this._model?this._model.loadURL(e):(this._initialData={id:this._id,url:e},this._onDidChangeLabel.fire())}async resolve(){return!this._model&&!this._modelPromise&&(this._modelPromise=(async()=>(this._model=await this.browserViewWorkbenchService.getOrCreateBrowserViewModel(this._id),this._modelPromise=void 0,this._register(this._model.onWillDispose(()=>{this._model=void 0})),this._register(this._model.onDidClose(()=>{this.dispose()})),this._register(this._model.onDidChangeTitle(()=>this._onDidChangeLabel.fire())),this._register(this._model.onDidChangeFavicon(()=>this._onDidChangeLabel.fire())),this._register(this._model.onDidChangeLoadingState(()=>this._onDidChangeLabel.fire())),this._register(this._model.onDidNavigate(()=>this._onDidChangeLabel.fire())),this._initialData.url&&this._model.url!==this._initialData.url&&this._model.loadURL(this._initialData.url),this._model))()),this._model||this._modelPromise}get typeId(){return sd.ID}get editorId(){return sd.EDITOR_ID}get capabilities(){return 1026}get resource(){return this._resourceBeforeDisposal?this._resourceBeforeDisposal:Ey.forId(this._id)}getIcon(){if(this._model){if(this._model.loading){let e=this.themeService.getColorTheme().getColor(IB);return A.parse("data:image/svg+xml;utf8,"+encodeURIComponent(W8o(e?.toString())))}return this._model.favicon?A.parse(this._model.favicon):R.globe}return this._initialData.favicon?A.parse(this._initialData.favicon):R.globe}getName(){return JN(this.getTitle(),V8o)}getTitle(){if(this._model&&this._model.url)return this._model.title?this._model.title:A.parse(this._model.url).authority||sd.DEFAULT_LABEL;if(this._initialData.title)return this._initialData.title;let e=this._initialData.url??"";return A.parse(e).authority||sd.DEFAULT_LABEL}getDescription(){return this.url}canReopen(){return!0}matches(e){if(super.matches(e))return!0;if(e instanceof sd)return this._id===e._id;if(No(e,{resource:!0})&&e.resource?.scheme===Ey.scheme){let t=Ey.parse(e.resource);if(t)return this._id===t.id}return!1}copy(){return nH(this.telemetryService,"copyToNewWindow"),this.instantiationService.createInstance(sd,{id:xt(),url:this.url,title:this.title,favicon:this.favicon})}toUntyped(){let e={url:this.url,title:this.title,favicon:this.favicon};return{resource:this.resource,options:{override:sd.EDITOR_ID,viewState:e}}}dispose(){this._model&&(this._resourceBeforeDisposal=this.resource,this._model.dispose(),this._model=void 0),super.dispose()}serialize(){return{id:this._id,url:this.url,title:this.title,favicon:this.favicon}}};sd=I([m(1,Le),m(2,v3),m(3,ji),m(4,F),m(5,Te)],sd);var yOt=class{canSerialize(i){return i instanceof sd}serialize(i){if(this.canSerialize(i))return JSON.stringify(i.serialize())}deserialize(i,e){try{let t=JSON.parse(e);return i.createInstance(sd,t)}catch{return}}};var wOt=class extends x{constructor(e,t,o,n,r){super();this.editorService=t;this.cdpService=o;this.editorGroupsService=n;this.configurationService=r;this._cdpSessions=this._register(new Vt);this._knownBrowsers=this._register(new Vt);this._lastActiveBrowserId=void 0;this._proxy=e.getProxy(to.ExtHostBrowsers),this._register(this.editorService.onWillOpenEditor(s=>{s.editor instanceof sd&&this._track(s.editor)})),this._register(this.editorService.onDidActiveEditorChange(()=>this._syncActiveBrowserTab()));for(let s of this.editorService.editors)s instanceof sd&&this._track(s);this._syncActiveBrowserTab()}async $openBrowserTab(e,t,o){let n=xt(),r=Ey.forId(n);await this.editorService.openEditor({resource:r,options:{...o,viewState:{url:e}}},wk(this.editorGroupsService,this.configurationService,t));let s=this._knownBrowsers.get(n);if(!s)throw new Error("Failed to open browser tab");return this._toDto(s.input)}async _syncActiveBrowserTab(){let e=this.editorService.activeEditorPane?.input,t;e instanceof sd&&(this._track(e),t=e.id),this._lastActiveBrowserId!==t&&(this._lastActiveBrowserId=t,this._proxy.$onDidChangeActiveBrowserTab(t))}_track(e){if(this._knownBrowsers.has(e.id))return;let t=new N;t.add(e.onDidChangeLabel(()=>{this._proxy.$onDidChangeBrowserTabState(this._toDto(e))})),t.add(e.onWillDispose(()=>{this._knownBrowsers.deleteAndDispose(e.id)})),t.add(Z(()=>{this._proxy.$onDidCloseBrowserTab(e.id)})),this._knownBrowsers.set(e.id,{input:e,dispose:()=>t.dispose()}),this._proxy.$onDidOpenBrowserTab(this._toDto(e))}_toDto(e){return{id:e.id,url:e.url||"about:blank",title:e.getTitle(),favicon:e.favicon}}async $startCDPSession(e,t){let o=this._knownBrowsers.get(t);if(!o)throw new Error(`Unknown browser id: ${t}`);await o.input.resolve();let n=await this.cdpService.createSessionGroup(t),r=new N;r.add(this.cdpService.onCDPMessage(n)(s=>{this._proxy.$onCDPSessionMessage(e,s)})),r.add(this.cdpService.onDidDestroy(n)(()=>{this._cdpSessions.deleteAndDispose(e)})),r.add(Z(()=>{this.cdpService.destroySessionGroup(n).catch(()=>{}),this._proxy.$onCDPSessionClosed(e)})),this._cdpSessions.set(e,{groupId:n,dispose:()=>r.dispose()})}async $closeCDPSession(e){this._cdpSessions.deleteAndDispose(e)}async $sendCDPMessage(e,t){let o=this._cdpSessions.get(e);o&&await this.cdpService.sendCDPMessage(o.groupId,t)}async $closeBrowserTab(e){let t=this._knownBrowsers.get(e);if(!t)throw new Error(`Unknown browser id: ${e}`);t.input.dispose()}};wOt=I([fo(qi.MainThreadBrowsers),m(1,ee),m(2,IOt),m(3,wt),m(4,B)],wOt);var XDe=class{constructor(i){this.instantiationService=i;this.instantiationService.createInstance(STt),this.instantiationService.createInstance(yTt),this.instantiationService.createInstance(wTt),this.instantiationService.createInstance(TTt),this.instantiationService.createInstance(kX),this.instantiationService.createInstance(kEe),this.instantiationService.createInstance(EEe)}static{this.ID="workbench.contrib.extensionPoints"}};XDe=I([m(0,F)],XDe);It(XDe.ID,XDe,St.BlockStartup);var lIi=class extends x{constructor(e,t){super();this.item=e;this.onClose=t;this._onDidClose=this._register(new E);this.onDidClose=this._onDidClose.event;this._onDidChangeVisibility=this._register(new E);this.onDidChangeVisibility=this._onDidChangeVisibility.event;this.registerListeners()}registerListeners(){this._register(this.item.onDidChangeVisibility(e=>this._onDidChangeVisibility.fire(e))),U.once(this.item.onDidClose)(()=>{this._onDidClose.fire(),this.dispose()})}get progress(){return this.item.progress}updateSeverity(e){this.item.updateSeverity(e)}updateMessage(e){this.item.updateMessage(e)}updateActions(e){this.item.updateActions(e)}close(){this.onClose(this.item),this.dispose()}},COt=class a extends x{constructor(){super(...arguments);this._onDidChangeNotification=this._register(new E);this.onDidChangeNotification=this._onDidChangeNotification.event;this._onDidChangeStatusMessage=this._register(new E);this.onDidChangeStatusMessage=this._onDidChangeStatusMessage.event;this._onDidChangeFilter=this._register(new E);this.onDidChangeFilter=this._onDidChangeFilter.event;this._notifications=[];this.filter={global:0,sources:new Map}}static{this.NO_OP_NOTIFICATION=new Lle}get notifications(){return this._notifications}get statusMessage(){return this._statusMessage}setFilter(e){let t=!1;typeof e.global=="number"&&(t=this.filter.global!==e.global,this.filter.global=e.global);let o=!1;e.sources&&(o=!Wse(this.filter.sources,e.sources),this.filter.sources=e.sources),(t||o)&&this._onDidChangeFilter.fire({global:t?e.global:void 0,sources:o?e.sources:void 0})}addNotification(e){let t=this.createViewItem(e);return t?(this.findNotification(t)?.close(),this._notifications.splice(0,0,t),this._onDidChangeNotification.fire({item:t,index:0,kind:0}),new lIi(t,n=>this.onClose(n))):a.NO_OP_NOTIFICATION}onClose(e){let t=this.findNotification(e);t&&t!==e?t.close():e.close()}findNotification(e){return this._notifications.find(t=>t.equals(e))}createViewItem(e){let t=JDe.create(e,this.filter);if(!t)return;let o=(s,l)=>{let c=this._notifications.indexOf(t);c>=0&&this._onDidChangeNotification.fire({item:t,index:c,kind:s,detail:l})},n=t.onDidChangeExpansion(()=>o(2)),r=t.onDidChangeContent(s=>o(1,s.kind));return U.once(t.onDidClose)(()=>{n.dispose(),r.dispose();let s=this._notifications.indexOf(t);s>=0&&(this._notifications.splice(s,1),this._onDidChangeNotification.fire({item:t,index:s,kind:3}))}),t}showStatusMessage(e,t){let o=dIi.create(e,t);return o?(this._statusMessage=o,this._onDidChangeStatusMessage.fire({kind:0,item:o}),{close:()=>{this._statusMessage===o&&(this._statusMessage=void 0,this._onDidChangeStatusMessage.fire({kind:1,item:o}))}}):{close:()=>{}}}};function xOt(a){return a instanceof JDe}var cIi=class extends x{constructor(){super();this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._state=Object.create(null)}get state(){return this._state}infinite(){this._state.infinite||(this._state.infinite=!0,this._state.total=void 0,this._state.worked=void 0,this._state.done=void 0,this._onDidChange.fire())}done(){this._state.done||(this._state.done=!0,this._state.infinite=void 0,this._state.total=void 0,this._state.worked=void 0,this._onDidChange.fire())}total(e){this._state.total!==e&&(this._state.total=e,this._state.infinite=void 0,this._state.done=void 0,this._onDidChange.fire())}worked(e){typeof this._state.worked=="number"?this._state.worked+=e:this._state.worked=e,this._state.infinite=void 0,this._state.done=void 0,this._onDidChange.fire()}},JDe=class a extends x{constructor(e,t,o,n,r,s,l,c){super();this.id=e;this._severity=t;this._sticky=o;this._priority=n;this._message=r;this._source=s;this._visible=!1;this._onDidChangeExpansion=this._register(new E);this.onDidChangeExpansion=this._onDidChangeExpansion.event;this._onDidClose=this._register(new E);this.onDidClose=this._onDidClose.event;this._onDidChangeContent=this._register(new E);this.onDidChangeContent=this._onDidChangeContent.event;this._onDidChangeVisibility=this._register(new E);this.onDidChangeVisibility=this._onDidChangeVisibility.event;l&&this.setProgress(l),this.setActions(c)}static{this.MAX_MESSAGE_LENGTH=1e3}static create(e,t){if(!e?.message||ao(e.message))return;let o;typeof e.severity=="number"?o=e.severity:o=ft.Info;let n=a.parseNotificationMessage(e.message);if(!n)return;let r;e.actions?r=e.actions:i7(e.message)&&(r={primary:e.message.actions});let s=e.priority??0;return(s===0||s===1)&&o!==ft.Error&&(t.global===1?s=2:H7(e.source)&&t.sources.get(e.source.id)===1&&(s=2)),new a(e.id,o,e.sticky,s,n,e.source,e.progress,r)}static parseNotificationMessage(e){let t;if(e instanceof Error?t=xn(e,!1):typeof e=="string"&&(t=e),!t)return;let o=t;t.length>a.MAX_MESSAGE_LENGTH&&(t=`${t.substr(0,a.MAX_MESSAGE_LENGTH)}...`),t=t.replace(/(\r\n|\n|\r)/gm," ").trim();let n=ES(t);return{raw:o,linkedText:n,original:e}}setProgress(e){e.infinite?this.progress.infinite():e.total&&(this.progress.total(e.total),e.worked&&this.progress.worked(e.worked))}setActions(e={primary:[],secondary:[]}){this._actions={primary:Array.isArray(e.primary)?e.primary:[],secondary:Array.isArray(e.secondary)?e.secondary:[]},this._expanded=e.primary&&e.primary.length>0}get canCollapse(){return!this.hasActions}get expanded(){return!!this._expanded}get severity(){return this._severity}get sticky(){if(this._sticky)return!0;let e=this.hasActions;return!!(e&&this._severity===ft.Error||!e&&this._expanded||this._progress&&!this._progress.state.done)}get priority(){return this._priority}get hasActions(){return!this._actions||!this._actions.primary?!1:this._actions.primary.length>0}get hasProgress(){return!!this._progress}get progress(){return this._progress||(this._progress=this._register(new cIi),this._register(this._progress.onDidChange(()=>this._onDidChangeContent.fire({kind:3})))),this._progress}get message(){return this._message}get source(){return typeof this._source=="string"?this._source:this._source?this._source.label:void 0}get sourceId(){return this._source&&typeof this._source!="string"&&"id"in this._source?this._source.id:void 0}get actions(){return this._actions}get visible(){return this._visible}updateSeverity(e){e!==this._severity&&(this._severity=e,this._onDidChangeContent.fire({kind:0}))}updateMessage(e){let t=a.parseNotificationMessage(e);!t||t.raw===this._message.raw||(this._message=t,this._onDidChangeContent.fire({kind:1}))}updateActions(e){this.setActions(e),this._onDidChangeContent.fire({kind:2})}updateVisibility(e){this._visible!==e&&(this._visible=e,this._onDidChangeVisibility.fire(e))}expand(){this._expanded||!this.canCollapse||(this._expanded=!0,this._onDidChangeExpansion.fire())}collapse(e){!this._expanded||!this.canCollapse||(this._expanded=!1,e||this._onDidChangeExpansion.fire())}toggle(){this._expanded?this.collapse():this.expand()}close(){this._onDidClose.fire(),this.dispose()}equals(e){if(this.hasProgress||e.hasProgress)return!1;if(typeof this.id=="string"||typeof e.id=="string")return this.id===e.id;if(typeof this._source=="object"){if(this._source.label!==e.source||this._source.id!==e.sourceId)return!1}else if(this._source!==e.source)return!1;if(this._message.raw!==e.message.raw)return!1;let t=this._actions?.primary||[],o=e.actions?.primary||[];return $i(t,o,(n,r)=>n.id+n.label===r.id+r.label)}},kpe=class a extends it{constructor(e,t){super(e,t.label,void 0,!0,async()=>{t.run(),this._onDidRun.fire()});this._onDidRun=this._register(new E);this.onDidRun=this._onDidRun.event;this._keepOpen=!!t.keepOpen,this._menu=!t.isSecondary&&t.menu?t.menu.map((o,n)=>new a(`${e}.${n}`,o)):void 0}get menu(){return this._menu}get keepOpen(){return this._keepOpen}},dIi=class{static create(i,e){if(!i||ao(i))return;let t;if(i instanceof Error?t=xn(i,!1):typeof i=="string"&&(t=i),!!t)return{message:t,options:e}}};function PA(a){let i=a.getValue("workbench.notifications.position");return i==="bottom-left"||i==="top-right"?i:"bottom-right"}var uIi=(()=>{if(Ze&&Vr)return"${activeEditorShort}${separator}${rootName}${separator}${profileName}";let a="${dirty}${activeEditorShort}${separator}${rootName}${separator}${profileName}${separator}${appName}";return Wt?a+"${separator}${remoteName}":a})(),pIi=Ze?" \u2014 ":" - ",Mk=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this.configurationService=t;this.contextKeyService=o;this.editorService=n;this.environmentService=r;this.contextService=s;this.labelService=l;this.userDataProfileService=c;this.productService=u;this.viewsService=p;this.decorationsService=h;this.accessibilityService=g;this.properties={isPure:!0,isAdmin:!1,prefix:void 0};this.variables=new Map;this.activeEditorListeners=this._register(new N);this.titleUpdater=this._register(new Dt(()=>this.doUpdateTitle(),0));this.onDidChangeEmitter=this._register(new E);this.onDidChange=this.onDidChangeEmitter.event;this.titleIncludesFocusedView=!1;this.titleIncludesEditorState=!1;this.windowId=e.vscodeWindowId,this.checkTitleVariables(),this.registerListeners()}static{this.NLS_USER_IS_ADMIN=ei?d(4527,null):d(4528,null)}static{this.NLS_EXTENSION_HOST=d(4526,null)}static{this.TITLE_DIRTY="\u25CF "}get value(){return this.title??""}get workspaceName(){return this.labelService.getWorkspaceLabel(this.contextService.getWorkspace())}get fileName(){let e=this.editorService.activeEditor;if(!e)return;let t=e.getTitle(0);return`${e?.isDirty()&&!e.isSaving()?Mk.TITLE_DIRTY:""}${t}`}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>this.onConfigurationChanged(e))),this._register(this.editorService.onDidActiveEditorChange(()=>this.onActiveEditorChange())),this._register(this.contextService.onDidChangeWorkspaceFolders(()=>this.titleUpdater.schedule())),this._register(this.contextService.onDidChangeWorkbenchState(()=>this.titleUpdater.schedule())),this._register(this.contextService.onDidChangeWorkspaceName(()=>this.titleUpdater.schedule())),this._register(this.labelService.onDidChangeFormatters(()=>this.titleUpdater.schedule())),this._register(this.userDataProfileService.onDidChangeCurrentProfile(()=>this.titleUpdater.schedule())),this._register(this.viewsService.onDidChangeFocusedView(()=>{this.titleIncludesFocusedView&&this.titleUpdater.schedule()})),this._register(this.contextKeyService.onDidChangeContext(e=>{e.affectsSome(this.variables)&&this.titleUpdater.schedule()})),this._register(this.accessibilityService.onDidChangeScreenReaderOptimized(()=>this.titleUpdater.schedule()))}onConfigurationChanged(e){let t=e.affectsConfiguration("window.title");t&&this.checkTitleVariables(),(t||e.affectsConfiguration("window.titleSeparator"))&&this.titleUpdater.schedule()}checkTitleVariables(){let e=this.configurationService.getValue("window.title");typeof e=="string"&&(this.titleIncludesFocusedView=e.includes("${focusedView}"),this.titleIncludesEditorState=e.includes("${activeEditorState}"))}onActiveEditorChange(){this.activeEditorListeners.clear(),this.titleUpdater.schedule();let e=this.editorService.activeEditor;if(e&&(this.activeEditorListeners.add(e.onDidChangeDirty(()=>this.titleUpdater.schedule())),this.activeEditorListeners.add(e.onDidChangeLabel(()=>this.titleUpdater.schedule()))),this.titleIncludesFocusedView){let t=this.editorService.activeTextEditorControl,o=[];pn(t)?o.push(t):mc(t)&&o.push(t.getOriginalEditor(),t.getModifiedEditor());for(let n of o)this.activeEditorListeners.add(n.onDidBlurEditorText(()=>this.titleUpdater.schedule())),this.activeEditorListeners.add(n.onDidFocusEditorText(()=>this.titleUpdater.schedule()))}this.titleIncludesEditorState&&this.activeEditorListeners.add(this.decorationsService.onDidChangeDecorations(()=>this.titleUpdater.schedule()))}doUpdateTitle(){let e=this.getFullWindowTitle();if(e!==this.title){let t=e;LL(t)||(t=this.productService.nameLong);let o=rb(this.windowId,!0).window;!o.document.title&&Ze&&t===this.productService.nameLong&&(o.document.title=`${this.productService.nameLong} ${Mk.TITLE_DIRTY}`),o.document.title=t,this.title=e,this.onDidChangeEmitter.fire()}}getFullWindowTitle(){let{prefix:e,suffix:t}=this.getTitleDecorations(),o=this.getWindowTitle()||this.productService.nameLong;return e&&(o=`${e} ${o}`),t&&(o=`${o} ${t}`),o.replace(/[^\S ]/g," ")}getTitleDecorations(){let e,t;return this.properties.prefix&&(e=this.properties.prefix),this.environmentService.isExtensionDevelopment&&(e=e?`${Mk.NLS_EXTENSION_HOST} - ${e}`:Mk.NLS_EXTENSION_HOST),this.properties.isAdmin&&(t=Mk.NLS_USER_IS_ADMIN),{prefix:e,suffix:t}}updateProperties(e){let t=typeof e.isAdmin=="boolean"?e.isAdmin:this.properties.isAdmin,o=typeof e.isPure=="boolean"?e.isPure:this.properties.isPure,n=typeof e.prefix=="string"?e.prefix:this.properties.prefix;(t!==this.properties.isAdmin||o!==this.properties.isPure||n!==this.properties.prefix)&&(this.properties.isAdmin=t,this.properties.isPure=o,this.properties.prefix=n,this.titleUpdater.schedule())}registerVariables(e){let t=!1;for(let{name:o,contextKey:n}of e)this.variables.has(n)||(this.variables.set(n,o),t=!0);t&&this.titleUpdater.schedule()}getWindowTitle(){let e=this.editorService.activeEditor,t=this.contextService.getWorkspace(),o;t.configuration?o=t.configuration:t.folders.length&&(o=t.folders[0].uri);let n=po.getOriginalUri(e,{supportSideBySide:1}),r=n?ci(n):void 0;r?.path==="."&&(r=void 0);let s;this.contextService.getWorkbenchState()===2?s=t.folders[0]:n&&(s=this.contextService.getWorkspaceFolder(n)??void 0);let l;if(this.environmentService.remoteAuthority&&!Wt)l=this.labelService.getHostLabel(Q.vscodeRemote,this.environmentService.remoteAuthority);else{let ae=FR(t);ae&&(l=this.labelService.getHostLabel(ae.scheme,ae.authority))}let c=e?e.getTitle(0):"",u=e?e.getTitle(1):c,p=e?e.getTitle(2):u,h=r?He(r):"",g=r?this.labelService.getUriLabel(r,{relative:!0}):"",f=r?this.labelService.getUriLabel(r):"",v=this.labelService.getWorkspaceLabel(t),b=this.labelService.getWorkspaceLabel(t,{verbose:0}),S=o?this.labelService.getUriLabel(o):"",y=s?s.name:"",w=s?this.labelService.getUriLabel(s.uri):"",k=e?.isDirty()&&!e.isSaving()?Mk.TITLE_DIRTY:"",T=this.productService.nameLong,P=this.userDataProfileService.currentProfile.isDefault?"":this.userDataProfileService.currentProfile.name,O=this.viewsService.getFocusedViewName(),V=n?this.decorationsService.getDecoration(n,!1)?.tooltip:void 0,H=this.editorService.activeTextEditorLanguageId,G={};for(let[ae,he]of this.variables)G[he]=this.contextKeyService.getContextKeyValue(ae)??"";let $=this.configurationService.getValue("window.title");typeof $!="string"&&($=uIi),!this.titleIncludesEditorState&&this.accessibilityService.isScreenReaderOptimized()&&this.configurationService.getValue("accessibility.windowTitleOptimized")&&($+="${separator}${activeEditorState}");let J=this.configurationService.getValue("window.titleSeparator");return typeof J!="string"&&(J=pIi),wbt($,{...G,activeEditorShort:c,activeEditorLong:p,activeEditorMedium:u,activeEditorLanguageId:H,activeFolderShort:h,activeFolderMedium:g,activeFolderLong:f,rootName:v,rootPath:S,rootNameShort:b,folderName:y,folderPath:w,dirty:k,appName:T,remoteName:l,profileName:P,focusedView:O,activeEditorState:V,separator:{label:J}})}isCustomTitleFormat(){if(this.accessibilityService.isScreenReaderOptimized()||this.titleIncludesEditorState)return!0;let e=this.configurationService.inspect("window.title"),t=this.configurationService.inspect("window.titleSeparator");if(Rae(e)||Rae(t))return!0;let n=ne.as(Jt.Configuration).getConfigurationProperties();return e.defaultValue!==n["window.title"]?.defaultDefaultValue}};Mk=I([m(1,B),m(2,X),m(3,ee),m(4,cd),m(5,Pe),m(6,rt),m(7,ln),m(8,tt),m(9,$t),m(10,Ov),m(11,Oi)],Mk);var kOt=ne.as(Jt.Configuration);(function(){It(fue.ID,fue,St.Eventually),It(x4.ID,x4,St.AfterRestored),kOt.registerConfiguration({...Ud,properties:{"workbench.externalBrowser":{type:"string",markdownDescription:d(4591,null),included:Vr,restricted:!0},"workbench.editor.titleScrollbarSizing":{type:"string",enum:["default","large"],enumDescriptions:[d(4781,null),d(4782,null)],description:d(4687,null),default:"default"},"workbench.editor.titleScrollbarVisibility":{type:"string",enum:["auto","visible","hidden"],enumDescriptions:[d(4783,null),d(4785,null),d(4784,null)],description:d(4690,null),default:"auto"},"workbench.editor.showTabs":{type:"string",enum:["multiple","single","none"],enumDescriptions:[d(4765,null),d(4767,null),d(4766,null)],description:d(4674,null),default:"multiple"},"workbench.editor.editorActionsLocation":{type:"string",enum:["default","titleBar","hidden"],markdownEnumDescriptions:[d(4731,null,"`#workbench.editor.showTabs#`","`none`"),d(4733,null,"`#window.customTitleBarVisibility#`","`never`"),d(4732,null)],markdownDescription:d(4607,null),default:"default"},"workbench.editor.alwaysShowEditorActions":{type:"boolean",markdownDescription:d(4586,null),default:!1},"workbench.editor.wrapTabs":{type:"boolean",markdownDescription:d(4816,null,"`#workbench.editor.showTabs#`","`multiple`"),default:!1},"workbench.editor.scrollToSwitchTabs":{type:"boolean",markdownDescription:d(4662,null,"`#workbench.editor.showTabs#`","`multiple`"),default:!1},"workbench.editor.highlightModifiedTabs":{type:"boolean",markdownDescription:d(4620,null,"`#workbench.editor.showTabs#`","multiple"),default:!1},"workbench.editor.decorations.badges":{type:"boolean",markdownDescription:d(4602,null),default:!0},"workbench.editor.decorations.colors":{type:"boolean",markdownDescription:d(4603,null),default:!0},[XP.SETTING_ID_ENABLED]:{type:"boolean",markdownDescription:d(4737,null),default:!0},[XP.SETTING_ID_PATTERNS]:{type:"object",markdownDescription:(()=>{let e=d(4742,null);return e+=`
- `+[d(4736,null),d(4740,null),d(4739,null),d(4738,null),d(4741,null)].join(`
- `),e+=`

`+d(4600,null),e})(),additionalProperties:{type:["string","null"],markdownDescription:d(4743,null),minLength:1,pattern:".*[a-zA-Z0-9].*"},default:{}},"workbench.editor.labelFormat":{type:"string",enum:["default","short","medium","long"],enumDescriptions:[d(4744,null),d(4747,null),d(4746,null),d(4745,null)],default:"default",description:d(4686,null)},"workbench.editor.untitled.labelFormat":{type:"string",enum:["content","name"],enumDescriptions:[d(4786,null),d(4787,null)],default:"content",description:d(4691,null)},"workbench.editor.empty.hint":{type:"string",enum:["text","hidden"],default:"text",markdownDescription:d(4734,null)},"workbench.editor.languageDetection":{type:"boolean",default:!0,description:d(4748,null),scope:6},"workbench.editor.historyBasedLanguageDetection":{type:"boolean",default:!0,description:d(4735,null)},"workbench.editor.preferHistoryBasedLanguageDetection":{type:"boolean",default:!1,description:d(4756,null)},"workbench.editor.languageDetectionHints":{type:"object",default:{untitledEditors:!0,notebookEditors:!0},description:d(4762,null),additionalProperties:!1,properties:{untitledEditors:{type:"boolean",description:d(4763,null)},notebookEditors:{type:"boolean",description:d(4764,null)}}},"workbench.editor.tabActionLocation":{type:"string",enum:["left","right"],default:"right",markdownDescription:d(4685,null,"`#workbench.editor.showTabs#`","`multiple`")},"workbench.editor.tabActionCloseVisibility":{type:"boolean",default:!0,description:d(4773,null)},"workbench.editor.tabActionUnpinVisibility":{type:"boolean",default:!0,description:d(4774,null)},"workbench.editor.showTabIndex":{type:"boolean",default:!1,markdownDescription:d(4676,null,"`#workbench.editor.showTabs#`","`multiple`")},"workbench.editor.tabSizing":{type:"string",enum:["fit","shrink","fixed"],default:"fit",enumDescriptions:[d(4776,null),d(4778,null),d(4777,null)],markdownDescription:d(4688,null,"`#workbench.editor.showTabs#`","`multiple`")},"workbench.editor.tabSizingFixedMinWidth":{type:"number",default:50,minimum:38,markdownDescription:d(4780,null,"`#workbench.editor.tabSizing#`","`fixed`")},"workbench.editor.tabSizingFixedMaxWidth":{type:"number",default:160,minimum:38,markdownDescription:d(4779,null,"`#workbench.editor.tabSizing#`","`fixed`")},"window.density.editorTabHeight":{type:"string",enum:["default","compact"],default:"default",markdownDescription:d(4775,null,"`#workbench.editor.showTabs#`","`multiple`")},"workbench.editor.pinnedTabSizing":{type:"string",enum:["normal","compact","shrink"],default:"normal",enumDescriptions:[d(4753,null),d(4752,null),d(4754,null)],markdownDescription:d(4651,null,"`#workbench.editor.showTabs#`","`multiple`")},"workbench.editor.pinnedTabsOnSeparateRow":{type:"boolean",default:!1,markdownDescription:d(4755,null,"`#workbench.editor.showTabs#`","`multiple`")},"workbench.editor.preventPinnedEditorClose":{type:"string",enum:["keyboardAndMouse","keyboard","mouse","never"],default:"keyboardAndMouse",enumDescriptions:[d(4758,null),d(4760,null),d(4761,null),d(4759,null)],description:d(4757,null)},"workbench.editor.splitSizing":{type:"string",enum:["auto","distribute","split"],default:"auto",enumDescriptions:[d(4770,null),d(4771,null),d(4772,null)],description:d(4681,null)},"workbench.editor.splitOnDragAndDrop":{type:"boolean",default:!0,description:d(4680,null)},"workbench.editor.dragToOpenWindow":{type:"boolean",default:!0,markdownDescription:d(4606,null)},"workbench.editor.focusRecentEditorAfterClose":{type:"boolean",description:d(4616,null),default:!0},"workbench.editor.showIcons":{type:"boolean",description:d(4675,null),default:!0},"workbench.editor.enablePreview":{type:"boolean",description:d(4611,null),default:!0},"workbench.editor.enablePreviewFromQuickOpen":{type:"boolean",markdownDescription:d(4613,null,"`#workbench.editor.showTabs#`","`multiple`"),default:!1},"workbench.editor.enablePreviewFromCodeNavigation":{type:"boolean",markdownDescription:d(4612,null,"`#workbench.editor.showTabs#`","`multiple`"),default:!1},"workbench.editor.closeOnFileDelete":{type:"boolean",description:d(4595,null),default:!1},"workbench.editor.openPositioning":{type:"string",enum:["left","right","first","last"],default:"right",markdownDescription:d(4608,null,"`left`","`right`","`first`","`last`")},"workbench.editor.openSideBySideDirection":{type:"string",enum:["right","down"],default:"right",markdownDescription:d(4678,null)},"workbench.editor.closeEmptyGroups":{type:"boolean",description:d(4594,null),default:!0},"workbench.editor.revealIfOpen":{type:"boolean",description:d(4658,null),default:!1},"workbench.editor.useModal":{type:"string",enum:["off","some","all"],enumDescriptions:[d(4694,null),d(4695,null),d(4693,null)],description:d(4692,null),default:"some"},"workbench.editor.swipeToNavigate":{type:"boolean",description:d(4684,null),default:!1,included:Ze&&!Wt},"workbench.editor.mouseBackForwardToNavigate":{type:"boolean",description:d(4636,null),default:!0},"workbench.editor.navigationScope":{type:"string",enum:["default","editorGroup","editor"],default:"default",markdownDescription:d(4639,null),enumDescriptions:[d(4749,null),d(4751,null),d(4750,null)]},"workbench.editor.restoreViewState":{type:"boolean",markdownDescription:d(4657,null,"`#workbench.editor.sharedViewState#`"),default:!0,scope:6},"workbench.editor.sharedViewState":{type:"boolean",description:d(4672,null),default:!1},"workbench.editor.restoreEditors":{type:"boolean",description:d(4656,null),default:!0},"workbench.editor.splitInGroupLayout":{type:"string",enum:["vertical","horizontal"],default:"horizontal",markdownDescription:d(4679,null),enumDescriptions:[d(4769,null),d(4768,null)]},"workbench.editor.centeredLayoutAutoResize":{type:"boolean",default:!0,description:d(4592,null)},"workbench.editor.centeredLayoutFixedWidth":{type:"boolean",default:!1,description:d(4593,null)},"workbench.editor.doubleClickTabToToggleEditorGroupSizes":{type:"string",enum:["maximize","expand","off"],default:"expand",markdownDescription:d(4605,null,"`#workbench.editor.showTabs#`","`multiple`"),enumDescriptions:[d(4729,null),d(4728,null),d(4730,null)]},"workbench.editor.limit.enabled":{type:"boolean",default:!1,description:d(4627,null)},"workbench.editor.limit.value":{type:"number",default:10,exclusiveMinimum:0,markdownDescription:d(4629,null,"`#workbench.editor.limit.perEditorGroup#`")},"workbench.editor.limit.excludeDirty":{type:"boolean",default:!1,description:d(4628,null)},"workbench.editor.limit.perEditorGroup":{type:"boolean",default:!1,description:d(4650,null)},"workbench.localHistory.enabled":{type:"boolean",default:!0,description:d(4630,null),scope:5},"workbench.localHistory.maxFileSize":{type:"number",default:256,minimum:1,description:d(4632,null),scope:5},"workbench.localHistory.maxFileEntries":{type:"number",default:50,minimum:0,description:d(4631,null),scope:5},"workbench.localHistory.exclude":{type:"object",patternProperties:{".*":{type:"boolean"}},markdownDescription:d(4614,null),scope:5},"workbench.localHistory.mergeWindow":{type:"number",default:10,minimum:1,markdownDescription:d(4635,null),scope:5},"workbench.commandPalette.history":{type:"number",description:d(4597,null),default:50,minimum:0},"workbench.commandPalette.preserveInput":{type:"boolean",description:d(4652,null),default:!1},"workbench.commandPalette.experimental.suggestCommands":{type:"boolean",tags:["experimental"],description:d(4683,null),default:!1},"workbench.commandPalette.experimental.askChatLocation":{type:"string",tags:["experimental"],description:d(4588,null),default:"chatView",enum:["chatView","quickChat"],enumDescriptions:[d(4589,null),d(4590,null)]},"workbench.commandPalette.showAskInChat":{type:"boolean",tags:["experimental"],description:d(4673,null),default:!0},"workbench.commandPalette.experimental.enableNaturalLanguageSearch":{type:"boolean",tags:["experimental"],description:d(4610,null),default:!0},"workbench.quickOpen.closeOnFocusLost":{type:"boolean",description:d(4596,null),default:!0},"workbench.quickOpen.preserveInput":{type:"boolean",description:d(4801,null),default:!1},"workbench.settings.openDefaultSettings":{type:"boolean",description:d(4643,null),default:!1},"workbench.settings.useSplitJSON":{type:"boolean",markdownDescription:d(4696,null),default:!1},"workbench.settings.openDefaultKeybindings":{type:"boolean",description:d(4642,null),default:!1},"workbench.settings.alwaysShowAdvancedSettings":{type:"boolean",description:d(4585,null),default:ro.quality!=="stable"},"workbench.sideBar.location":{type:"string",enum:["left","right"],default:"left",description:d(4677,null)},"workbench.panel.showLabels":{type:"boolean",default:!0,description:d(4649,null)},"workbench.panel.defaultLocation":{type:"string",enum:["left","bottom","top","right"],default:"bottom",description:d(4647,null)},"workbench.panel.opensMaximized":{type:"string",enum:["always","never","preserve"],default:"preserve",description:d(4648,null),enumDescriptions:[d(4797,null),d(4798,null),d(4799,null)]},"workbench.secondarySideBar.defaultVisibility":{type:"string",enum:["hidden","visibleInWorkspace","visible","maximizedInWorkspace","maximized"],default:"visibleInWorkspace",description:d(4663,null),enumDescriptions:[d(4810,null),d(4814,null),d(4813,null),d(4812,null),d(4811,null)]},"workbench.secondarySideBar.forceMaximized":{type:"boolean",default:!1,tags:["experimental"],description:d(4664,null)},"workbench.secondarySideBar.showLabels":{type:"boolean",default:!0,markdownDescription:d(4665,null,"`#workbench.activityBar.location#`","`top`")},"workbench.statusBar.visible":{type:"boolean",default:!0,description:d(4682,null)},"workbench.notifications.position":{type:"string",enum:["bottom-right","bottom-left","top-right"],default:"bottom-right",description:d(4641,null),enumDescriptions:[d(4795,null),d(4794,null),d(4796,null)],tags:["experimental"],experiment:{mode:"auto"}},"workbench.notifications.showInTitleBar":{type:"boolean",default:!0,description:d(4640,null)},"workbench.activityBar.location":{type:"string",enum:["default","top","bottom","hidden"],default:"default",markdownDescription:d(4584,null),enumDescriptions:[d(4725,null),d(4727,null),d(4724,null),d(4726,null)]},"workbench.activityBar.autoHide":{type:"boolean",default:!1,markdownDescription:d(4581,null,"`#workbench.activityBar.location#`","`top`","`bottom`")},"workbench.activityBar.compact":{type:"boolean",default:!1,markdownDescription:d(4582,null,"`#workbench.activityBar.location#`","`default`")},"workbench.activityBar.iconClickBehavior":{type:"string",enum:["toggle","focus"],default:"toggle",markdownDescription:d(4583,null,"`#workbench.activityBar.location#`","`default`"),enumDescriptions:[d(4723,null),d(4722,null)]},"workbench.view.alwaysShowHeaderActions":{type:"boolean",default:!1,description:d(4697,null)},"workbench.view.showQuietly":{type:"object",description:d(4815,null),scope:4,properties:{"workbench.panel.output":{type:"boolean",description:d(4800,null)}},additionalProperties:!1},"workbench.fontAliasing":{type:"string",enum:["default","antialiased","none","auto"],default:"default",description:d(4619,null),enumDescriptions:[d(4790,null),d(4788,null),d(4791,null),d(4789,null)],included:Ze},"workbench.settings.editor":{type:"string",enum:["ui","json"],enumDescriptions:[d(4669,null),d(4668,null)],description:d(4667,null),default:"ui",scope:4},"workbench.settings.showAISearchToggle":{type:"boolean",default:!0,description:d(4670,null)},"workbench.hover.delay":{type:"number",description:d(4792,null),default:Ze?1500:500,minimum:0},"workbench.hover.reducedDelay":{type:"number",description:d(4793,null),default:500,minimum:0},"workbench.reduceMotion":{type:"string",description:d(4802,null),enumDescriptions:[d(4805,null),d(4804,null),d(4803,null)],default:"auto",tags:["accessibility"],enum:["on","off","auto"]},"workbench.reduceTransparency":{type:"string",description:d(4806,null),enumDescriptions:[d(4809,null),d(4808,null),d(4807,null)],default:"off",tags:["accessibility"],enum:["on","off","auto"]},"workbench.navigationControl.enabled":{type:"boolean",default:!0,markdownDescription:Wt?d(4638,null):d(4637,null,"`#window.customTitleBarVisibility#`","`never`")},"workbench.layoutControl.enabled":{type:"boolean",default:!0,markdownDescription:Wt?d(4625,null):d(4624,null,"`#window.customTitleBarVisibility#`","`never`")},"workbench.layoutControl.type":{type:"string",enum:["menu","toggles","both"],enumDescriptions:[d(4622,null),d(4623,null),d(4621,null)],default:"both",description:d(4626,null)},"workbench.tips.enabled":{type:"boolean",default:!0,description:d(4689,null)},"workbench.shadows":{type:"boolean",default:!0,description:d(4671,null)}}});let i=d(4721,null);i+=`
- `+[d(4574,null),d(4573,null),d(4572,null),d(4571,null),d(4578,null),d(4577,null),d(4576,null),d(4617,null),d(4618,null),d(4659,null),d(4660,null),d(4661,null),d(4654,null),d(4587,null),d(4655,null),d(4604,null),d(4615,null),d(4580,null),d(4579,null),d(4575,null,"`accessibility.windowTitleOptimized`"),d(4666,null)].join(`
- `),kOt.registerConfiguration({...Igi,properties:{"window.title":{type:"string",default:uIi,markdownDescription:i},"window.titleSeparator":{type:"string",default:pIi,markdownDescription:d(4720,null,"`#window.title#`")},"window.commandCenter":{type:"boolean",default:!0,markdownDescription:Wt?d(4699,null):d(4698,null,"`#window.customTitleBarVisibility#`","`never`")},"window.menuBarVisibility":{type:"string",enum:["classic","visible","toggle","hidden","compact"],markdownEnumDescriptions:[d(4706,null),d(4712,null),Ze?d(4711,null):d(4710,null),d(4709,null),Wt?d(4708,null):d(4707,null,"`#window.titleBarStyle#`","`native`","`#window.menuStyle#`","`native`","`inherit`")],default:Wt?"compact":"classic",scope:1,markdownDescription:Ze?d(4634,null):d(4633,null),included:ei||fn||Wt},"window.enableMenuBarMnemonics":{type:"boolean",default:!0,scope:1,description:d(4609,null),included:ei||fn},"window.customMenuBarAltFocus":{type:"boolean",default:!0,scope:1,markdownDescription:d(4601,null),included:ei||fn},"window.openFilesInNewWindow":{type:"string",enum:["on","off","default"],enumDescriptions:[d(4716,null),d(4715,null),Ze?d(4714,null):d(4713,null)],default:"off",scope:1,markdownDescription:Ze?d(4645,null):d(4644,null)},"window.openFoldersInNewWindow":{type:"string",enum:["on","off","default"],enumDescriptions:[d(4719,null),d(4718,null),d(4717,null)],default:"default",scope:1,markdownDescription:d(4646,null)},"window.confirmBeforeClose":{type:"string",enum:["always","keyboardOnly","never"],enumDescriptions:[Wt?d(4701,null):d(4700,null),Wt?d(4703,null):d(4702,null),Wt?d(4705,null):d(4704,null)],default:Wt&&!oIe()?"keyboardOnly":"never",markdownDescription:Wt?d(4599,null):d(4598,null),scope:1}}}),It(vue.ID,vue,St.Eventually),kOt.registerConfiguration({...WRt,properties:{"problems.visibility":{type:"boolean",default:!0,description:d(4653,null)}}}),kOt.registerConfiguration({id:"zenMode",order:9,title:d(4828,null),type:"object",properties:{"zenMode.fullScreen":{type:"boolean",default:!0,description:d(4818,null)},"zenMode.centerLayout":{type:"boolean",default:!0,description:d(4817,null)},"zenMode.showTabs":{type:"string",enum:["multiple","single","none"],description:d(4823,null),enumDescriptions:[d(4824,null),d(4826,null),d(4825,null)],default:"multiple"},"zenMode.hideStatusBar":{type:"boolean",default:!0,description:d(4821,null)},"zenMode.hideActivityBar":{type:"boolean",default:!0,description:d(4819,null)},"zenMode.hideLineNumbers":{type:"boolean",default:!0,description:d(4820,null)},"zenMode.restore":{type:"boolean",default:!0,description:d(4822,null)},"zenMode.silentNotifications":{type:"boolean",default:!0,description:d(4827,null)}}})})();ne.as(Ep.ConfigurationMigration).registerConfigurationMigrations([{key:"workbench.activityBar.visible",migrateFn:a=>{let i=[];return a!==void 0&&i.push(["workbench.activityBar.visible",{value:void 0}]),a===!1&&i.push(["workbench.activityBar.location",{value:"hidden"}]),i}}]);ne.as(Ep.ConfigurationMigration).registerConfigurationMigrations([{key:"workbench.activityBar.location",migrateFn:a=>{let i=[];return a==="side"&&i.push(["workbench.activityBar.location",{value:"default"}]),i}}]);ne.as(Ep.ConfigurationMigration).registerConfigurationMigrations([{key:"workbench.editor.doubleClickTabToToggleEditorGroupSizes",migrateFn:a=>{let i=[];return typeof a=="boolean"&&(a=a?"expand":"off",i.push(["workbench.editor.doubleClickTabToToggleEditorGroupSizes",{value:a}])),i}},{key:"workbench.editor.showTabs",migrateFn:a=>{let i=[];return typeof a=="boolean"&&(a=a?"multiple":"single",i.push(["workbench.editor.showTabs",{value:a}])),i}},{key:"workbench.editor.tabCloseButton",migrateFn:a=>{let i=[];return a==="left"||a==="right"?i.push(["workbench.editor.tabActionLocation",{value:a}]):a==="off"&&i.push(["workbench.editor.tabActionCloseVisibility",{value:!1}]),i}},{key:"zenMode.hideTabs",migrateFn:a=>{let i=[["zenMode.hideTabs",{value:void 0}]];return a===!0&&i.push(["zenMode.showTabs",{value:"single"}]),i}}]);function gIi(a,i){return[ii({id:"undo",label:d(3728,null),run:()=>sm().execCommand("undo")}),ii({id:"redo",label:d(3726,null),run:()=>sm().execCommand("redo")}),new ri,ii({id:"editor.action.clipboardCutAction",label:d(3724,null),run:()=>{i.trace("TextInputActionsProvider#cut"),sm().execCommand("cut")}}),ii({id:"editor.action.clipboardCopyAction",label:d(3723,null),run:()=>{i.trace("TextInputActionsProvider#copy"),sm().execCommand("copy")}}),ii({id:"editor.action.clipboardPasteAction",label:d(3725,null),run:async e=>{i.trace("TextInputActionsProvider#paste");let t=await a.readText();if(J9(e)||mae(e)){let o=e.selectionStart||0,n=e.selectionEnd||0;e.value=`${e.value.substring(0,o)}${t}${e.value.substring(n,e.value.length)}`,e.selectionStart=o+t.length,e.selectionEnd=e.selectionStart,e.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!0}))}}}),new ri,ii({id:"editor.action.selectAll",label:d(3727,null),run:()=>sm().execCommand("selectAll")})]}var tLe=class extends x{constructor(e,t,o,n){super();this.layoutService=e;this.contextMenuService=t;this.clipboardService=o;this.logService=n;this.textInputActions=new co(()=>gIi(this.clipboardService,this.logService));this.registerListeners()}static{this.ID="workbench.contrib.textInputActionsProvider"}registerListeners(){this._register(U.runAndSubscribe(this.layoutService.onDidAddContainer,({container:e,disposables:t})=>{t.add(j(e,"contextmenu",o=>this.onContextMenu(Re(e),o)))},{container:this.layoutService.mainContainer,disposables:this._store}))}onContextMenu(e,t){if(t.defaultPrevented)return;let o=t.target;if(!J9(o)&&!mae(o))return;Xt.stop(t,!0);let n=new Cn(e,t);this.contextMenuService.showContextMenu({getAnchor:()=>n,getActions:()=>this.textInputActions.value,getActionsContext:()=>o})}};tLe=I([m(0,yi),m(1,Xe),m(2,Fi),m(3,se)],tLe);It(tLe.ID,tLe,St.BlockRestore);var _pe="rendererLog",oM={id:_pe,name:d(17873,null)},T2="workbench.action.showWindowLog";var iLe=le("policy"),MZ=class extends x{constructor(){super(...arguments);this.policyDefinitions={};this.policies=new Map;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event}async updatePolicyDefinitions(e){let t=Object.keys(this.policyDefinitions).length;return this.policyDefinitions={...e,...this.policyDefinitions},t!==Object.keys(this.policyDefinitions).length&&await this._updatePolicyDefinitions(this.policyDefinitions),vt.reduce(this.policies.entries(),(o,[n,r])=>({...o,[n]:r}),{})}getPolicyValue(e){return this.policies.get(e)}serialize(){return vt.reduce(Object.entries(this.policyDefinitions),(e,[t,o])=>({...e,[t]:{definition:o,value:this.policies.get(t)}}),{})}},EOt=class{constructor(){this.onDidChange=U.None;this.policyDefinitions={}}async updatePolicyDefinitions(){return{}}getPolicyValue(){}serialize(){}};var fIi=class extends K{constructor(){super({id:"workbench.action.inspectContextKeys",title:L(3523,"Inspect Context Keys"),category:Ve.Developer,f1:!0})}run(i){let e=i.get(X),t=new N,o=Cr(void 0,void 0,t);$h("*","cursor: crosshair !important;",o);let n=document.createElement("div"),r=sm();r.body.appendChild(n),t.add(Z(()=>n.remove())),n.style.position="absolute",n.style.pointerEvents="none",n.style.backgroundColor="rgba(255, 0, 0, 0.5)",n.style.zIndex="1000";let s=t.add(new Gn(r,"mousemove",!0));t.add(s.event(u=>{let p=u.target,h=ir(p);n.style.top=`${h.top}px`,n.style.left=`${h.left}px`,n.style.width=`${h.width}px`,n.style.height=`${h.height}px`}));let l=t.add(new Gn(r,"mousedown",!0));U.once(l.event)(u=>{u.preventDefault(),u.stopPropagation()},null,t);let c=t.add(new Gn(r,"mouseup",!0));U.once(c.event)(u=>{u.preventDefault(),u.stopPropagation();let p=e.getContext(u.target);console.log(p.collectAllValues()),Be(t)},null,t)}},vIi=class a extends K{constructor(){super({id:"workbench.action.toggleScreencastMode",title:L(3554,"Toggle Screencast Mode"),category:Ve.Developer,f1:!0})}run(i){if(a.disposable){a.disposable.dispose(),a.disposable=void 0;return}let e=i.get(Kl),t=i.get(B),o=i.get(_e),n=new N,r=e.activeContainer,s=M(r,_(".screencast-mouse"));n.add(Z(()=>s.remove()));let l=M(r,_(".screencast-keyboard"));n.add(Z(()=>l.remove()));let c=n.add(new E),u=n.add(new E),p=n.add(new E);function h(ae,he){let oe=new N;oe.add(oe.add(new Gn(ae,"mousedown",!0)).event(de=>c.fire(de))),oe.add(oe.add(new Gn(ae,"mouseup",!0)).event(de=>u.fire(de))),oe.add(oe.add(new Gn(ae,"mousemove",!0)).event(de=>p.fire(de))),he.add(oe),n.add(Z(()=>he.delete(oe))),n.add(oe)}for(let{window:ae,disposables:he}of SC())h(e.getContainer(ae),he);n.add(nf(({window:ae,disposables:he})=>h(e.getContainer(ae),he))),n.add(e.onDidChangeActiveContainer(()=>{e.activeContainer.appendChild(s),e.activeContainer.appendChild(l)}));let g=()=>{s.style.borderColor=We.fromHex(t.getValue("screencastMode.mouseIndicatorColor")).toString()},f,v=()=>{f=Bn(t.getValue("screencastMode.mouseIndicatorSize")||20,20,100),s.style.height=`${f}px`,s.style.width=`${f}px`};g(),v(),n.add(c.event(ae=>{s.style.top=`${ae.clientY-f/2}px`,s.style.left=`${ae.clientX-f/2}px`,s.style.display="block",s.style.transform="scale(1)",s.style.transition="transform 0.1s";let he=p.event(oe=>{s.style.top=`${oe.clientY-f/2}px`,s.style.left=`${oe.clientX-f/2}px`,s.style.transform=`scale(${.8})`});U.once(u.event)(()=>{s.style.display="none",he.dispose()})}));let b=()=>{l.style.fontSize=`${Bn(t.getValue("screencastMode.fontSize")||56,20,100)}px`},S=()=>{l.style.bottom=`${Bn(t.getValue("screencastMode.verticalOffset")||0,0,90)}%`},y,w=()=>{y=Bn(t.getValue("screencastMode.keyboardOverlayTimeout")||800,500,5e3)};b(),S(),w(),n.add(t.onDidChangeConfiguration(ae=>{ae.affectsConfiguration("screencastMode.verticalOffset")&&S(),ae.affectsConfiguration("screencastMode.fontSize")&&b(),ae.affectsConfiguration("screencastMode.keyboardOverlayTimeout")&&w(),ae.affectsConfiguration("screencastMode.mouseIndicatorColor")&&g(),ae.affectsConfiguration("screencastMode.mouseIndicatorSize")&&v()}));let k=n.add(new E),T=n.add(new E),P=n.add(new E),O=n.add(new E);function V(ae,he){let oe=new N;oe.add(oe.add(new Gn(ae,"keydown",!0)).event(de=>k.fire(de))),oe.add(oe.add(new Gn(ae,"compositionstart",!0)).event(de=>T.fire(de))),oe.add(oe.add(new Gn(ae,"compositionupdate",!0)).event(de=>P.fire(de))),oe.add(oe.add(new Gn(ae,"compositionend",!0)).event(de=>O.fire(de))),he.add(oe),n.add(Z(()=>he.delete(oe))),n.add(oe)}for(let{window:ae,disposables:he}of SC())V(ae,he);n.add(nf(({window:ae,disposables:he})=>V(ae,he)));let H=0,G,$=!1,J=n.add(new Dt(()=>{l.textContent="",G=void 0,H=0},y));n.add(T.event(ae=>{$=!0})),n.add(P.event(ae=>{ae.data&&$?(H>20&&(l.innerText="",H=0),G=G??M(l,_("span.key")),G.textContent=ae.data):$&&(l.innerText="",M(l,_("span.key",{},"Backspace"))),J.schedule(y)})),n.add(O.event(ae=>{G=void 0,H++})),n.add(k.event(ae=>{if(ae.key==="Process"||/[\uac00-\ud787\u3131-\u314e\u314f-\u3163\u3041-\u3094\u30a1-\u30f4\u30fc\u3005\u3006\u3024\u4e00-\u9fa5]/u.test(ae.key)){ae.code==="Backspace"||ae.code.includes("Key")?$=!0:(G=void 0,$=!1),J.schedule(y);return}if(ae.isComposing)return;let he=t.getValue("screencastMode.keyboardOptions"),oe=new gi(ae),de=o.softDispatch(oe,oe.target);if(de.kind===2&&de.commandId&&!(he.showSingleEditorCursorMoves??!0)&&["cursorLeft","cursorRight","cursorUp","cursorDown"].includes(de.commandId))return;(oe.ctrlKey||oe.altKey||oe.metaKey||oe.shiftKey||H>20||oe.keyCode===1||oe.keyCode===9||oe.keyCode===16||oe.keyCode===18||oe.keyCode===15||oe.keyCode===17)&&(l.innerText="",H=0);let Ce=o.resolveKeyboardEvent(oe),xe=this._isKbFound(de)&&de.commandId?this.getCommandDetails(de.commandId):void 0,ze=xe?.title,De=Ce.getLabel();if(xe&&((he.showCommandGroups??!1)&&xe.category&&(ze=`${xe.category}: ${ze} `),this._isKbFound(de)&&de.commandId)){let Oe=o.lookupKeybindings(de.commandId).filter(pt=>pt.getLabel()?.endsWith(De??""));Oe.length>0&&(De=Oe[Oe.length-1].getLabel())}(he.showCommands??!0)&&ze&&M(l,_("span.title",{},`${ze} `)),((he.showKeys??!0)||(he.showKeybindings??!0)&&this._isKbFound(de))&&(De=De?.replace("UpArrow","\u2191")?.replace("DownArrow","\u2193")?.replace("LeftArrow","\u2190")?.replace("RightArrow","\u2192"),M(l,_("span.key",{},De??""))),H++,J.schedule(y)})),a.disposable=n}_isKbFound(i){return i.kind===2}getCommandDetails(i){let e=ve.getCommand(i);if(e)return{title:typeof e.title=="string"?e.title:e.title.value,category:e.category?typeof e.category=="string"?e.category:e.category.value:void 0};let t=$e.getCommand(i);if(t?.metadata?.description)return{title:typeof t.metadata.description=="string"?t.metadata.description:t.metadata.description.value}}},bIi=class extends K{constructor(){super({id:"workbench.action.logStorage",title:L(3525,"Log Storage Database Contents"),category:Ve.Developer,f1:!0})}run(i){let e=i.get(ce),t=i.get(at);e.log(),t.info(d(3553,null),d(3552,null))}},SIi=class extends K{constructor(){super({id:"workbench.action.logWorkingCopies",title:L(3526,"Log Working Copies"),category:Ve.Developer,f1:!0})}async run(i){let e=i.get(Xa),t=i.get(hm),o=i.get(se),n=i.get(kl),r=await t.getBackups(),s=["","[Working Copies]",...e.workingCopies.length>0?e.workingCopies.map(l=>`${l.isDirty()?"\u25CF ":""}${l.resource.toString(!0)} (typeId: ${l.typeId||"<no typeId>"})`):["<none>"],"","[Backups]",...r.length>0?r.map(l=>`${l.resource.toString(!0)} (typeId: ${l.typeId||"<no typeId>"})`):["<none>"]];o.info(s.join(`
`)),n.showChannel(_pe,!0)}},IIi=class a extends K{static{this.SIZE_THRESHOLD=1024*16}constructor(){super({id:"workbench.action.removeLargeStorageDatabaseEntries",title:L(3530,"Remove Large Storage Database Entries..."),category:Ve.Developer,f1:!0})}async run(i){let e=i.get(ce),t=i.get(Ue),o=i.get(ln),n=i.get(at),r=i.get(Eo),s=[];for(let p of[-1,0,1])if(!(p===0&&o.currentProfile.isDefault))for(let h of[1,0])for(let g of e.keys(p,h)){let f=e.get(g,p);f&&(!r.isBuilt||f.length>a.SIZE_THRESHOLD)&&s.push({key:g,scope:p,target:h,size:f.length,label:g,description:vl.formatSize(f.length),detail:d(3524,null,p===-1?d(3522,null):p===0?d(3529,null):d(3556,null),h===1?d(3527,null):d(3555,null))})}s.sort((p,h)=>h.size-p.size);let l=await new Promise(p=>{let h=new N,g=h.add(t.createQuickPick());g.items=s,g.canSelectMany=!0,g.ok=!1,g.customButton=!0,g.hideCheckAll=!0,g.customLabel=d(3534,null),g.placeholder=d(3536,null),s.length===0&&(g.description=d(3535,null)),g.show(),h.add(g.onDidCustom(()=>{p(g.selectedItems),g.hide()})),h.add(g.onDidHide(()=>h.dispose()))});if(l.length===0)return;let{confirmed:c}=await n.confirm({type:"warning",message:d(3532,null),detail:d(3533,null,l.map(p=>p.label).join(`
`)),primaryButton:d(3531,null)});if(!c)return;let u=new Set;for(let p of l)e.remove(p.key,p.scope),u.add(p.scope);for(let p of u)await e.optimize(p)}},Dpe,TOt=new Set,Lpe=new Y("dirtyWorkingCopies","stopped"),yIi=class extends K{constructor(){super({id:"workbench.action.startTrackDisposables",title:L(3550,"Start Tracking Disposables"),category:Ve.Developer,f1:!0,precondition:C.and(Lpe.isEqualTo("pending").negate(),Lpe.isEqualTo("started").negate())})}run(i){Lpe.bindTo(i.get(X)).set("started"),TOt.clear(),Dpe=new vht,HSe(Dpe)}},wIi=class extends K{constructor(){super({id:"workbench.action.snapshotTrackedDisposables",title:L(3549,"Snapshot Tracked Disposables"),category:Ve.Developer,f1:!0,precondition:Lpe.isEqualTo("started")})}run(i){Lpe.bindTo(i.get(X)).set("pending"),TOt=new Set(Dpe?.computeLeakingDisposables(1e3)?.leaks.map(t=>t.value))}},CIi=class extends K{constructor(){super({id:"workbench.action.stopTrackDisposables",title:L(3551,"Stop Tracking Disposables"),category:Ve.Developer,f1:!0,precondition:Lpe.isEqualTo("pending")})}run(i){let e=i.get(ee);if(Lpe.bindTo(i.get(X)).set("stopped"),Dpe){let o=new Set;for(let r of new Set(Dpe.computeLeakingDisposables(1e3)?.leaks)??[])TOt.has(r.value)&&o.add(r);let n=Dpe.computeLeakingDisposables(1e3,Array.from(o));n&&e.openEditor({resource:void 0,contents:n.details})}HSe(null),Dpe=void 0,TOt.clear()}},xIi=class extends K{constructor(){super({id:"workbench.action.showPolicyDiagnostics",title:L(3528,"Policy Diagnostics"),category:Ve.Developer,f1:!0})}async run(i){let e=i.get(ee),t=i.get(B),o=i.get(tt),n=i.get(ng),r=i.get(xs),s=i.get(vk),l=i.get(iLe),c=ne.as(Jt.Configuration),u=`# VS Code Policy Diagnostics

`;u+=`*WARNING: This file may contain sensitive information.*

`,u+=`## System Information

`,u+=`| Property | Value |
`,u+=`|----------|-------|
`,u+=`| Generated | ${new Date().toISOString()} |
`,u+=`| Product | ${o.nameLong} ${o.version} |
`,u+=`| Commit | ${o.commit||"n/a"} |

`,u+=`## Account Information

`;try{let f=await n.getDefaultAccount(),v=["sessionId","analytics_tracking_id"];if(f){let b="Unknown",S="Unknown";try{let w=r.getProviderIds();for(let k of w){let P=(await r.getSessions(k)).find(O=>O.id===f.sessionId);if(P){b=P.account.id,S=P.account.label;break}}}catch{}u+=`### Default Account Summary

`,u+=`**Account ID/Username**: ${b}

`,u+=`**Account Label**: ${S}

`,u+=`### Detailed Account Properties

`,u+=`| Property | Value |
`,u+=`|----------|-------|
`;for(let[w,k]of Object.entries(f))if(k!=null){let T;v.includes(w)?T="***":typeof k=="object"?T=JSON.stringify(k):T=String(k),u+=`| ${w} | ${T} |
`}let y=n.policyData;u+=`| policyData | ${y?JSON.stringify(y):"No Policy Data"} |
`,u+=`
`}else u+=`*No default account configured*

`}catch(f){u+=`*Error retrieving account information: ${f}*

`}u+=`## Policy-Controlled Settings

`;let p=c.getPolicyConfigurations(),h=c.getConfigurationProperties(),g=c.getExcludedConfigurationProperties();if(p.size>0){let f=[],v=[];for(let[y,w]of p){let k=h[w]??g[w];if(k){let T=t.inspect(w),P={name:y,key:w,property:k,inspection:T};T.policyValue!==void 0?f.push(P):v.push(P)}}let b=new Map,S=y=>{if(b.has(y))return b.get(y);try{if(l.constructor.name==="MultiplexPolicyService"){let k=l;if(k.policyServices){let T=k.policyServices;for(let P of T)if(P.getPolicyValue&&P.getPolicyValue(y)!==void 0)return b.set(y,P.constructor.name),P.constructor.name}}return""}catch{return"Unknown"}};if(u+=`### Applied Policy

`,f.sort((y,w)=>S(y.name).localeCompare(S(w.name))||y.name.localeCompare(w.name)),f.length>0){u+=`| Setting Key | Policy Name | Policy Source | Default Value | Current Value | Policy Value |
`,u+=`|-------------|-------------|---------------|---------------|---------------|-------------|
`;for(let y of f){let w=JSON.stringify(y.property.default),k=JSON.stringify(y.inspection.value),T=JSON.stringify(y.inspection.policyValue),P=S(y.name);u+=`| ${y.key} | ${y.name} | ${P} | \`${w}\` | \`${k}\` | \`${T}\` |
`}u+=`
`}else u+=`*No settings are currently controlled by policies*

`;if(u+=`###  Non-applied Policy

`,v.length>0){u+=`| Setting Key | Policy Name  
`,u+=`|-------------|-------------|
`;for(let y of v)u+=`| ${y.key} | ${y.name}|
`;u+=`
`}else u+=`*All policy-controllable settings are currently being enforced*

`}else u+=`*No policy-controlled settings found*

`;u+=`## Authentication Information

`;try{let f=r.getProviderIds();if(f.length>0){u+=`### Authentication Providers

`,u+=`| Provider ID | Sessions | Accounts |
`,u+=`|-------------|----------|----------|
`;for(let v of f)try{let b=await r.getSessions(v),S=b.map(w=>w.account),y=Array.from(new Set(S.map(w=>w.label)));u+=`| ${v} | ${b.length} | ${y.join(", ")||"None"} |
`}catch(b){u+=`| ${v} | Error | ${b} |
`}u+=`
`,u+=`### Detailed Session Information

`;for(let v of f)try{let b=await r.getSessions(v);if(b.length>0){u+=`#### ${v}

`,u+=`| Account | Scopes | Extensions with Access |
`,u+=`|---------|--------|------------------------|
`;for(let S of b){let y=S.account.label,w=S.scopes.join(", ")||"Default";try{let T=s.readAllowedExtensions(v,y).filter(P=>P.allowed!==!1).map(P=>`${P.name}${P.trusted?" (trusted)":""}`).join(", ")||"None";u+=`| ${y} | ${w} | ${T} |
`}catch(k){u+=`| ${y} | ${w} | Error: ${k} |
`}}u+=`
`}}catch(b){u+=`#### ${v}
*Error retrieving sessions: ${b}*

`}}else u+=`*No authentication providers found*

`}catch(f){u+=`*Error retrieving authentication information: ${f}*

`}await e.openEditor({resource:void 0,contents:u,languageId:"markdown",options:{pinned:!0}})}};W(fIi);W(vIi);W(bIi);W(SIi);W(IIi);W(xIi);ro.commit||(W(yIi),W(wIi),W(CIi));var B8o=ne.as(Jt.Configuration);B8o.registerConfiguration({id:"screencastMode",order:9,title:d(3548,null),type:"object",properties:{"screencastMode.verticalOffset":{type:"number",default:20,minimum:0,maximum:90,description:d(3545,null)},"screencastMode.fontSize":{type:"number",default:56,minimum:20,maximum:100,description:d(3537,null)},"screencastMode.keyboardOptions":{type:"object",description:d(3538,null),properties:{showKeys:{type:"boolean",default:!0,description:d(3542,null)},showKeybindings:{type:"boolean",default:!0,description:d(3541,null)},showCommands:{type:"boolean",default:!0,description:d(3540,null)},showCommandGroups:{type:"boolean",default:!1,description:d(3539,null)},showSingleEditorCursorMoves:{type:"boolean",default:!0,description:d(3543,null)}},default:{showKeys:!0,showKeybindings:!0,showCommands:!0,showCommandGroups:!1,showSingleEditorCursorMoves:!0},additionalProperties:!1},"screencastMode.keyboardOverlayTimeout":{type:"number",default:800,minimum:500,maximum:5e3,description:d(3544,null)},"screencastMode.mouseIndicatorColor":{type:"string",format:"color-hex",default:"#FF0000",description:d(3546,null)},"screencastMode.mouseIndicatorSize":{type:"number",default:20,minimum:20,maximum:100,description:d(3547,null)}}});var _Ot=class a extends K{static{this.ID="workbench.action.keybindingsReference"}static{this.AVAILABLE=!!(fn?ro.keyboardShortcutsUrlLinux:Ze?ro.keyboardShortcutsUrlMac:ro.keyboardShortcutsUrlWin)}constructor(){super({id:a.ID,title:{...L(3559,"Keyboard Shortcuts Reference"),mnemonicTitle:d(3561,null)},category:Ve.Help,f1:!0,keybinding:{weight:200,when:null,primary:Vi(2089,2096)},menu:{id:D.MenubarHelpMenu,group:"2_reference",order:1}})}run(i){let e=i.get(tt),t=i.get(Je),o=fn?e.keyboardShortcutsUrlLinux:Ze?e.keyboardShortcutsUrlMac:e.keyboardShortcutsUrlWin;o&&t.open(A.parse(o))}},DOt=class a extends K{static{this.ID="workbench.action.openVideoTutorialsUrl"}static{this.AVAILABLE=!!ro.introductoryVideosUrl}constructor(){super({id:a.ID,title:{...L(3574,"Video Tutorials"),mnemonicTitle:d(3566,null)},category:Ve.Help,f1:!0,menu:{id:D.MenubarHelpMenu,group:"2_reference",order:2}})}run(i){let e=i.get(tt),t=i.get(Je);e.introductoryVideosUrl&&t.open(A.parse(e.introductoryVideosUrl))}},LOt=class a extends K{static{this.ID="workbench.action.openTipsAndTricksUrl"}static{this.AVAILABLE=!!ro.tipsAndTricksUrl}constructor(){super({id:a.ID,title:{...L(3572,"Tips and Tricks"),mnemonicTitle:d(3564,null)},category:Ve.Help,f1:!0,menu:{id:D.MenubarHelpMenu,group:"2_reference",order:3}})}run(i){let e=i.get(tt),t=i.get(Je);e.tipsAndTricksUrl&&t.open(A.parse(e.tipsAndTricksUrl))}},ROt=class a extends K{static{this.ID="workbench.action.openDocumentationUrl"}static{this.AVAILABLE=!!(Wt?ro.serverDocumentationUrl:ro.documentationUrl)}constructor(){super({id:a.ID,title:{...L(3569,"Documentation"),mnemonicTitle:d(3560,null)},category:Ve.Help,f1:!0,menu:{id:D.MenubarHelpMenu,group:"1_welcome",order:3}})}run(i){let e=i.get(tt),t=i.get(Je),o=Wt?e.serverDocumentationUrl:e.documentationUrl;o&&t.open(A.parse(o))}},MOt=class a extends K{static{this.ID="workbench.action.openNewsletterSignupUrl"}static{this.AVAILABLE=!!ro.newsletterSignupUrl}constructor(){super({id:a.ID,title:L(3568,"Signup for the VS Code Newsletter"),category:Ve.Help,f1:!0})}run(i){let e=i.get(tt),t=i.get(Je),o=i.get(Te);t.open(A.parse(`${e.newsletterSignupUrl}?machineId=${encodeURIComponent(o.machineId)}`))}},POt=class a extends K{static{this.ID="workbench.action.openYouTubeUrl"}static{this.AVAILABLE=!!ro.youTubeUrl}constructor(){super({id:a.ID,title:{...L(3575,"Join Us on YouTube"),mnemonicTitle:d(3567,null)},category:Ve.Help,f1:!0,menu:{id:D.MenubarHelpMenu,group:"3_feedback",order:1}})}run(i){let e=i.get(tt),t=i.get(Je);e.youTubeUrl&&t.open(A.parse(e.youTubeUrl))}},AOt=class a extends K{static{this.ID="workbench.action.openRequestFeatureUrl"}static{this.AVAILABLE=!!ro.requestFeatureUrl}constructor(){super({id:a.ID,title:{...L(3573,"Search Feature Requests"),mnemonicTitle:d(3565,null)},category:Ve.Help,f1:!0,menu:{id:D.MenubarHelpMenu,group:"3_feedback",order:2}})}run(i){let e=i.get(tt),t=i.get(Je);e.requestFeatureUrl&&t.open(A.parse(e.requestFeatureUrl))}},NOt=class a extends K{static{this.ID="workbench.action.openLicenseUrl"}static{this.AVAILABLE=!!(Wt?ro.serverLicense:ro.licenseUrl)}constructor(){super({id:a.ID,title:{...L(3570,"View License"),mnemonicTitle:d(3562,null)},category:Ve.Help,f1:!0,menu:{id:D.MenubarHelpMenu,group:"4_legal",order:1}})}run(i){let e=i.get(tt),t=i.get(Je),o=Wt?e.serverLicenseUrl:e.licenseUrl;if(o)if(wr){let n=o.indexOf("?")>0?"&":"?";t.open(A.parse(`${o}${n}lang=${wr}`))}else t.open(A.parse(o))}},OOt=class a extends K{static{this.ID="workbench.action.openPrivacyStatementUrl"}static{this.AVAILABLE=!!ro.privacyStatementUrl}constructor(){super({id:a.ID,title:{...L(3571,"Privacy Statement"),mnemonicTitle:d(3563,null)},category:Ve.Help,f1:!0,menu:{id:D.MenubarHelpMenu,group:"4_legal",order:2}})}run(i){let e=i.get(tt),t=i.get(Je);e.privacyStatementUrl&&t.open(A.parse(e.privacyStatementUrl))}},kIi=class a extends K{static{this.ID="workbench.action.getStartedWithAccessibilityFeatures"}constructor(){super({id:a.ID,title:L(3558,"Get Started with Accessibility Features"),category:Ve.Help,f1:!0,menu:{id:D.MenubarHelpMenu,group:"1_welcome",order:6}})}run(i){i.get(ge).executeCommand("workbench.action.openWalkthrough","SetupAccessibility")}},FOt=class a extends K{static{this.ID="workbench.action.askVScode"}constructor(){super({id:a.ID,title:L(3557,"Ask @vscode"),category:Ve.Help,f1:!0,precondition:C.equals("chatSetupHidden",!1)})}async run(i){i.get(ge).executeCommand("workbench.action.chat.open",{mode:"agent",query:"@vscode ",isPartialQuery:!0})}};ve.appendMenuItem(D.MenubarHelpMenu,{command:{id:FOt.ID,title:L(3557,"Ask @vscode")},order:7,group:"1_welcome",when:C.equals("chatSetupHidden",!1)});_Ot.AVAILABLE&&W(_Ot);DOt.AVAILABLE&&W(DOt);LOt.AVAILABLE&&W(LOt);ROt.AVAILABLE&&W(ROt);MOt.AVAILABLE&&W(MOt);POt.AVAILABLE&&W(POt);AOt.AVAILABLE&&W(AOt);NOt.AVAILABLE&&W(NOt);OOt.AVAILABLE&&W(OOt);W(kIi);W(FOt);var _2=class extends it{constructor(e){super(e.id,e.name,e.classNames?.join(" "),!0);this.item=e;this._onDidChangeCompositeBarActionItem=this._register(new E);this.onDidChangeCompositeBarActionItem=this._onDidChangeCompositeBarActionItem.event;this._onDidChangeActivity=this._register(new E);this.onDidChangeActivity=this._onDidChangeActivity.event;this._activities=[]}get compositeBarActionItem(){return this.item}set compositeBarActionItem(e){this._label=e.name,this.item=e,this._onDidChangeCompositeBarActionItem.fire(this)}get activities(){return this._activities}set activities(e){this._activities=e,this._onDidChangeActivity.fire(e)}activate(){this.checked||this._setChecked(!0)}deactivate(){this.checked&&this._setChecked(!1)}},PZ=class extends wl{constructor(e,t,o,n,r,s,l){super(null,e,t);this.badgesEnabled=o;this.themeService=n;this.hoverService=r;this.configurationService=s;this.keybindingService=l;this.badgeDisposable=this._register(new me);this.options=t,this._register(this.themeService.onDidColorThemeChange(this.onThemeChange,this)),this._register(e.onDidChangeCompositeBarActionItem(()=>this.update())),this._register(U.filter(l.onDidUpdateKeybindings,()=>this.keybindingLabel!==this.computeKeybindingLabel())(()=>this.updateTitle())),this._register(e.onDidChangeActivity(()=>this.updateActivity()))}get compositeBarActionItem(){return this._action.compositeBarActionItem}updateStyles(){let e=this.themeService.getColorTheme(),t=this.options.colors(e);if(this.label){if(this.options.icon){let o=this._action.checked?t.activeForegroundColor:t.inactiveForegroundColor;this.compositeBarActionItem.iconUrl?(this.label.style.backgroundColor=o?o.toString():"",this.label.style.color=""):(this.label.style.color=o?o.toString():"",this.label.style.backgroundColor="")}else{let o=this._action.checked?t.activeForegroundColor:t.inactiveForegroundColor,n=this._action.checked?t.activeBorderBottomColor:null;this.label.style.color=o?o.toString():"",this.label.style.borderBottomColor=n?n.toString():""}this.container.style.setProperty("--insert-border-color",t.dragAndDropBorder?t.dragAndDropBorder.toString():"")}if(this.badgeContent){let o=this.getActivities()[0]?.badge.getColors(e),n=o?.badgeForeground??t.badgeForeground??e.getColor(CC),r=o?.badgeBackground??t.badgeBackground??e.getColor(bv),s=o?.badgeBorder??e.getColor(bi);this.badgeContent.style.color=n?n.toString():"",this.badgeContent.style.backgroundColor=r?r.toString():"",this.badgeContent.style.borderStyle=s&&!this.options.compact?"solid":"",this.badgeContent.style.borderWidth=s?"1px":"",this.badgeContent.style.borderColor=s?s.toString():""}}render(e){super.render(e),this.container=e,this.options.icon&&this.container.classList.add("icon");let t=this.options.isTabList||!this.options.hasPopup?"tab":"button";this.container.setAttribute("role",t),this.options.hasPopup&&this.container.setAttribute("aria-haspopup","true"),this._register(j(this.container,re.MOUSE_DOWN,()=>{this.container.classList.add("clicked")})),this._register(j(this.container,re.MOUSE_UP,()=>{this.mouseUpTimeout&&clearTimeout(this.mouseUpTimeout),this.mouseUpTimeout=setTimeout(()=>{this.container.classList.remove("clicked")},800)})),this._register(this.hoverService.setupDelayedHover(this.container,()=>({content:this.computeTitle(),style:1,position:{hoverPosition:this.options.hoverOptions.position()},persistence:{hideOnKeyDown:!0}}),{groupId:"composite-bar-actions"})),this.label=M(e,_("a")),this.badge=M(e,_(".badge")),this.badgeContent=M(this.badge,_(".badge-content")),M(e,_(".active-item-indicator")),vo(this.badge),this.update(),this.updateStyles(),this.updateTitle()}onThemeChange(e){this.updateStyles()}update(){this.updateLabel(),this.updateActivity(),this.updateTitle(),this.updateStyles()}getActivities(){return this._action instanceof _2?this._action.activities:[]}updateActivity(){if(!this.badge||!this.badgeContent||!(this._action instanceof _2))return;let{badges:e,type:t}=this.getVisibleBadges(this.getActivities());this.badgeDisposable.value=new N,Rt(this.badgeContent),vo(this.badge);let o=this.badgesEnabled(this.compositeBarActionItem.id);if(e.length>0&&o){let n=[];if(this.options.compact&&n.push("compact"),t==="progress")un(this.badge),n.push("progress-badge");else if(t==="number"){let r=e.reduce((s,l)=>s+(l instanceof Rd?l.number:0),0);if(r>0){let s=r.toString();if(r>999){let l=r/1e3,c=Math.floor(l);s=l>c?`${c}K+`:`${l}K`}this.options.compact&&s.length>=3&&n.push("compact-content"),this.badgeContent.textContent=s,un(this.badge)}}else if(t==="icon"){n.push("icon-badge");let r=["icon-overlay",...q.asClassNameArray(e[0].icon)];this.badgeContent.classList.add(...r),this.badgeDisposable.value.add(Z(()=>this.badgeContent?.classList.remove(...r))),un(this.badge)}n.length&&(this.badge.classList.add(...n),this.badgeDisposable.value.add(Z(()=>this.badge.classList.remove(...n))))}this.updateTitle(),this.updateStyles()}getVisibleBadges(e){let t=e.filter(r=>r.badge instanceof sx).map(r=>r.badge);if(t.length>0)return{badges:t,type:"progress"};let o=e.filter(r=>r.badge instanceof y2).map(r=>r.badge);if(o.length>0)return{badges:o,type:"icon"};let n=e.filter(r=>r.badge instanceof Rd).map(r=>r.badge);return n.length>0?{badges:n,type:"number"}:{badges:[],type:void 0}}updateLabel(){this.label.className="action-label",this.compositeBarActionItem.classNames&&this.label.classList.add(...this.compositeBarActionItem.classNames),this.options.icon||(this.label.textContent=this.action.label)}updateTitle(){let e=this.computeTitle();[this.label,this.badge,this.container].forEach(t=>{t&&(t.setAttribute("aria-label",e),t.setAttribute("title",""),t.removeAttribute("title"))})}computeTitle(){this.keybindingLabel=this.computeKeybindingLabel();let e=this.keybindingLabel?d(3851,null,this.compositeBarActionItem.name,this.keybindingLabel):this.compositeBarActionItem.name,t=this.getVisibleBadges(this.action.activities).badges;for(let o of t)o.getDescription()&&(e=`${e} - ${o.getDescription()}`);return e}computeKeybindingLabel(){return(this.compositeBarActionItem.keybindingId?this.keybindingService.lookupKeybinding(this.compositeBarActionItem.keybindingId):null)?.getLabel()}dispose(){super.dispose(),this.mouseUpTimeout&&clearTimeout(this.mouseUpTimeout),this.badge.remove()}};PZ=I([m(3,Le),m(4,nt),m(5,B),m(6,_e)],PZ);var NXe=class extends _2{constructor(e){super({id:"additionalComposites.action",name:d(3845,null),classNames:q.asClassNameArray(R.more)});this.showMenu=e}async run(){this.showMenu()}},oLe=class extends PZ{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super(e,{icon:!0,colors:s,hasPopup:!0,hoverOptions:l,isTabList:!0},()=>!0,u,p,h,g);this.getOverflowingComposites=t;this.getActiveCompositeId=o;this.getBadge=n;this.getCompositeOpenAction=r;this.contextMenuService=c}showMenu(){this.contextMenuService.showContextMenu({getAnchor:()=>this.container,getActions:()=>this.getActions(),getCheckedActionsRepresentation:()=>"radio"})}getActions(){return this.getOverflowingComposites().map(e=>{let t=this.getCompositeOpenAction(e.id);t.checked=this.getActiveCompositeId()===t.id;let o=this.getBadge(e.id),n;return o instanceof Rd&&(n=o.number),n?t.label=d(3849,null,e.name,n):t.label=e.name||"",t})}};oLe=I([m(7,Xe),m(8,Le),m(9,nt),m(10,B),m(11,_e)],oLe);var nLe=class extends PZ{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super(t,e,c.areBadgesEnabled.bind(c),g,f,v,p);this.toggleCompositePinnedAction=o;this.toggleCompositeBadgeAction=n;this.compositeContextMenuActionsProvider=r;this.contextMenuActionsProvider=s;this.dndHandler=l;this.compositeBar=c;this.contextMenuService=u;this.commandService=b}render(e){super.render(e),this.updateChecked(),this.updateEnabled(),this._register(j(this.container,re.CONTEXT_MENU,o=>{Xt.stop(o,!0),this.showContextMenu(e)}));let t;this._register(ST.INSTANCE.registerDraggable(this.container,()=>({type:"composite",id:this.compositeBarActionItem.id}),{onDragOver:o=>{let n=o.dragAndDropData.getData().id!==this.compositeBarActionItem.id&&this.dndHandler.onDragOver(o.dragAndDropData,this.compositeBarActionItem.id,o.eventData);X4(o.eventData.dataTransfer,"move",n),t=this.updateFromDragging(e,n,o.eventData)},onDragLeave:o=>{t=this.updateFromDragging(e,!1,o.eventData)},onDragEnd:o=>{t=this.updateFromDragging(e,!1,o.eventData)},onDrop:o=>{Xt.stop(o.eventData,!0),this.dndHandler.drop(o.dragAndDropData,this.compositeBarActionItem.id,o.eventData,t),t=this.updateFromDragging(e,!1,o.eventData)},onDragStart:o=>{o.dragAndDropData.getData().id===this.compositeBarActionItem.id&&(o.eventData.dataTransfer&&(o.eventData.dataTransfer.effectAllowed="move"),this.blur())}})),[this.badge,this.label].forEach(o=>this._register(new rwe(o,()=>{this.action.checked||this.action.run()}))),this.updateStyles()}updateFromDragging(e,t,o){let n=e.getBoundingClientRect(),r=o.clientX,s=o.clientY,l=n.bottom-n.top,c=n.right-n.left,u=s<=n.top+l*.4,p=s>n.bottom-l*.4,h=s<=n.top+l*.5,g=r<=n.left+c*.4,f=r>n.right-c*.4,v=r<=n.left+c*.5,b=e.classList,S={vertical:b.contains("top")?"top":b.contains("bottom")?"bottom":void 0,horizontal:b.contains("left")?"left":b.contains("right")?"right":void 0},y=u||h&&!S.vertical||!p&&S.vertical==="top",w=p||!h&&!S.vertical||!u&&S.vertical==="bottom",k=g||v&&!S.horizontal||!f&&S.horizontal==="left",T=f||!v&&!S.horizontal||!g&&S.horizontal==="right";if(e.classList.toggle("top",t&&y),e.classList.toggle("bottom",t&&w),e.classList.toggle("left",t&&k),e.classList.toggle("right",t&&T),!!t)return{verticallyBefore:y,horizontallyBefore:k}}showContextMenu(e){let t=[];this.compositeBarActionItem.keybindingId&&t.push(W4e(this.commandService,this.keybindingService,this.compositeBarActionItem.keybindingId)),t.push(this.toggleCompositePinnedAction,this.toggleCompositeBadgeAction);let o=this.compositeContextMenuActionsProvider(this.compositeBarActionItem.id);o.length&&t.push(...o),this.compositeBar.isPinned(this.compositeBarActionItem.id)?(this.toggleCompositePinnedAction.label=d(3846,null,this.compositeBarActionItem.name),this.toggleCompositePinnedAction.checked=!1,this.toggleCompositePinnedAction.enabled=this.compositeBar.getPinnedCompositeIds().length>1):(this.toggleCompositePinnedAction.label=d(3848,null,this.compositeBarActionItem.name),this.toggleCompositePinnedAction.enabled=!0),this.compositeBar.areBadgesEnabled(this.compositeBarActionItem.id)?this.toggleCompositeBadgeAction.label=d(3847,null):this.toggleCompositeBadgeAction.label=d(3850,null);let s=this.contextMenuActionsProvider();s.length&&(t.push(new ri),t.push(...s));let l=ir(e),c={x:Math.floor(l.left+l.width/2),y:l.top+l.height};this.contextMenuService.showContextMenu({getAnchor:()=>c,getActions:()=>t,getActionsContext:()=>this.compositeBarActionItem.id})}updateChecked(){this.action.checked?(this.container.classList.add("checked"),this.container.setAttribute("aria-label",this.getTooltip()??this.container.title),this.container.setAttribute("aria-expanded","true"),this.container.setAttribute("aria-selected","true")):(this.container.classList.remove("checked"),this.container.setAttribute("aria-label",this.getTooltip()??this.container.title),this.container.setAttribute("aria-expanded","false"),this.container.setAttribute("aria-selected","false")),this.updateStyles()}updateEnabled(){this.element&&(this.action.enabled?this.element.classList.remove("disabled"):this.element.classList.add("disabled"))}dispose(){super.dispose(),this.label.remove()}};nLe=I([m(8,Xe),m(9,_e),m(10,F),m(11,Le),m(12,nt),m(13,B),m(14,ge)],nLe);var OXe=class extends it{constructor(e,t){super("show.toggleCompositePinned",e?e.name:d(3852,null));this.activity=e;this.compositeBar=t;this.checked=!!this.activity&&this.compositeBar.isPinned(this.activity.id)}async run(e){let t=this.activity?this.activity.id:e;this.compositeBar.isPinned(t)?this.compositeBar.unpin(t):this.compositeBar.pin(t)}},FXe=class extends it{constructor(e,t){super("show.toggleCompositeBadge",e?e.name:d(3853,null));this.compositeBarActionItem=e;this.compositeBar=t;this.checked=!1}async run(e){let t=this.compositeBarActionItem?this.compositeBarActionItem.id:e;this.compositeBar.toggleBadgeEnablement(t)}},rH=class extends K{constructor(e,t,o){super(e);this.location=t;this.offset=o}async run(e){let t=e.get(us),o=t.getActivePaneComposite(this.location);if(!o)return;let n,r=t.getVisiblePaneCompositeIds(this.location);for(let s=0;s<r.length;s++)if(r[s]===o.getId()){n=r[(s+r.length+this.offset)%r.length];break}typeof n<"u"&&await t.openPaneComposite(n,this.location,!0)}};var H8o=Ae("auxiliarybar-maximize",R.screenFull,d(3822,null)),EIi=Ae("auxiliarybar-close",R.close,d(3814,null)),U8o=Ae("auxiliarybar-right-layout-icon",R.layoutSidebarRight,d(3832,null)),z8o=Ae("auxiliarybar-right-off-layout-icon",R.layoutSidebarRightOff,d(3833,null)),K8o=Ae("auxiliarybar-left-layout-icon",R.layoutSidebarLeft,d(3830,null)),G8o=Ae("auxiliarybar-left-off-layout-icon",R.layoutSidebarLeftOff,d(3831,null)),g0=class a extends K{static{this.ID="workbench.action.toggleAuxiliaryBar"}static{this.LABEL=L(3829,"Toggle Secondary Side Bar Visibility")}constructor(){super({id:a.ID,title:a.LABEL,toggled:{condition:iA,title:d(3815,null),icon:EIi,mnemonicTitle:d(3823,null)},icon:EIi,category:Ve.View,metadata:{description:d(3825,null)},f1:!0,keybinding:{weight:200,primary:2592},menu:[{id:D.LayoutControlMenuSubmenu,group:"0_workbench_layout",order:1},{id:D.MenubarAppearanceMenu,group:"2_workbench_layout",order:2}]})}async run(i){let e=i.get(yi),t=e.isVisible("workbench.parts.auxiliarybar");e.setPartHidden(t,"workbench.parts.auxiliarybar");let o=t?d(3812,null):d(3813,null);en(o)}};W(g0);ve.appendMenuItem(D.AuxiliaryBarTitle,{command:{id:g0.ID,title:d(3815,null),icon:EIi},group:"navigation",order:2,when:C.equals("config.workbench.activityBar.location","default")});W(class extends K{constructor(){super({id:"workbench.action.closeAuxiliaryBar",title:L(3816,"Hide Secondary Side Bar"),category:Ve.View,precondition:iA,f1:!0})}run(a){a.get(yi).setPartHidden(!0,"workbench.parts.auxiliarybar")}});W(class TIi extends K{static{this.ID="workbench.action.focusAuxiliaryBar"}static{this.LABEL=L(3817,"Focus into Secondary Side Bar")}constructor(){super({id:TIi.ID,title:TIi.LABEL,category:Ve.View,f1:!0})}async run(i){let e=i.get(us),t=i.get(yi);t.isVisible("workbench.parts.auxiliarybar")||t.setPartHidden(!1,"workbench.parts.auxiliarybar"),e.getActivePaneComposite(2)?.focus()}});ve.appendMenuItems([{id:D.LayoutControlMenu,item:{group:"2_pane_toggles",command:{id:g0.ID,title:d(3835,null),toggled:{condition:iA,icon:K8o},icon:G8o},when:C.and(Cb.negate(),C.or(C.equals("config.workbench.layoutControl.type","toggles"),C.equals("config.workbench.layoutControl.type","both")),C.equals("config.workbench.sideBar.location","right")),order:0}},{id:D.LayoutControlMenu,item:{group:"2_pane_toggles",command:{id:g0.ID,title:d(3835,null),toggled:{condition:iA,icon:U8o},icon:z8o},when:C.and(Cb.negate(),C.or(C.equals("config.workbench.layoutControl.type","toggles"),C.equals("config.workbench.layoutControl.type","both")),C.equals("config.workbench.sideBar.location","left")),order:2}},{id:D.ViewContainerTitleContext,item:{group:"3_workbench_layout_move",command:{id:g0.ID,title:L(3818,"Hide Secondary Side Bar")},when:C.and(iA,C.equals("viewContainerLocation",Pw(2))),order:2}}]);W(class extends rH{constructor(){super({id:"workbench.action.previousAuxiliaryBarView",title:L(3826,"Previous Secondary Side Bar View"),category:Ve.View,f1:!0},2,-1)}});W(class extends rH{constructor(){super({id:"workbench.action.nextAuxiliaryBarView",title:L(3824,"Next Secondary Side Bar View"),category:Ve.View,f1:!0},2,1)}});var _Ii=class a extends K{static{this.ID="workbench.action.maximizeAuxiliaryBar"}constructor(){super({id:a.ID,title:L(3819,"Maximize Secondary Side Bar"),tooltip:d(3820,null),category:Ve.View,f1:!0,precondition:kK.negate()})}run(i){i.get(yi).setAuxiliaryBarMaximized(!0)}};W(_Ii);var DIi=class a extends K{static{this.ID="workbench.action.restoreAuxiliaryBar"}constructor(){super({id:a.ID,title:L(3827,"Restore Secondary Side Bar"),tooltip:d(3828,null),category:Ve.View,f1:!0,precondition:kK,keybinding:{weight:200,primary:2101,win:{primary:2110,secondary:[2101]}}})}run(i){i.get(yi).setAuxiliaryBarMaximized(!1)}};W(DIi);var LIi=class a extends K{static{this.ID="workbench.action.toggleMaximizedAuxiliaryBar"}constructor(){super({id:a.ID,title:L(3834,"Toggle Maximized Secondary Side Bar"),tooltip:d(3821,null),f1:!0,category:Ve.View,icon:H8o,toggled:{condition:kK,tooltip:d(3828,null)},menu:{id:D.AuxiliaryBarTitle,group:"navigation",order:1}})}run(i){i.get(yi).toggleMaximizedAuxiliaryBar()}};W(LIi);var q8o=Ae("panel-maximize",R.screenFull,d(4447,null)),RIi=Ae("panel-close",R.close,d(4442,null)),$8o=Ae("panel-layout-icon",R.layoutPanel,d(4468,null)),j8o=Ae("panel-layout-icon-off",R.layoutPanelOff,d(4469,null)),D2=class a extends K{static{this.ID="workbench.action.togglePanel"}static{this.LABEL=L(4470,"Toggle Panel Visibility")}constructor(){super({id:a.ID,title:a.LABEL,toggled:{condition:$X,title:d(4443,null),icon:RIi,mnemonicTitle:d(4450,null)},icon:RIi,f1:!0,category:Ve.View,metadata:{description:d(4454,null)},keybinding:{primary:2088,weight:200},menu:[{id:D.MenubarAppearanceMenu,group:"2_workbench_layout",order:5},{id:D.LayoutControlMenuSubmenu,group:"0_workbench_layout",order:4}]})}async run(i){let e=i.get(yi);e.setPartHidden(e.isVisible("workbench.parts.panel"),"workbench.parts.panel")}};W(D2);ve.appendMenuItem(D.PanelTitle,{command:{id:D2.ID,title:d(4443,null),icon:RIi},group:"navigation",order:2});W(class extends K{constructor(){super({id:"workbench.action.closePanel",title:L(4444,"Hide Panel"),category:Ve.View,precondition:$X,f1:!0})}run(a){a.get(yi).setPartHidden(!0,"workbench.parts.panel")}});W(class extends K{static{this.ID="workbench.action.focusPanel"}static{this.LABEL=d(4445,null)}constructor(){super({id:"workbench.action.focusPanel",title:L(4446,"Focus into Panel"),category:Ve.View,f1:!0})}async run(a){let i=a.get(yi),e=a.get(us);i.isVisible("workbench.parts.panel")||i.setPartHidden(!1,"workbench.parts.panel"),e.getActivePaneComposite(1)?.focus()}});var WOt={LEFT:"workbench.action.positionPanelLeft",RIGHT:"workbench.action.positionPanelRight",BOTTOM:"workbench.action.positionPanelBottom",TOP:"workbench.action.positionPanelTop"},VOt={LEFT:"workbench.action.alignPanelLeft",RIGHT:"workbench.action.alignPanelRight",CENTER:"workbench.action.alignPanelCenter",JUSTIFY:"workbench.action.alignPanelJustify"};function _ao(a,i,e,t,o){return{id:a,title:i,shortLabel:e,value:t,when:o}}function BOt(a,i,e,t){return _ao(a,i,e,t,qX.notEqualsTo(jC(t)))}function HOt(a,i,e,t){return _ao(a,i,e,t,TB.notEqualsTo(t))}var Q8o=[BOt(WOt.TOP,L(4463,"Move Panel To Top"),d(4464,null),3),BOt(WOt.LEFT,L(4459,"Move Panel Left"),d(4460,null),0),BOt(WOt.RIGHT,L(4461,"Move Panel Right"),d(4462,null),1),BOt(WOt.BOTTOM,L(4457,"Move Panel To Bottom"),d(4458,null),2)],Y8o=[HOt(VOt.LEFT,L(4438,"Set Panel Alignment to Left"),d(4439,null),"left"),HOt(VOt.RIGHT,L(4440,"Set Panel Alignment to Right"),d(4441,null),"right"),HOt(VOt.CENTER,L(4434,"Set Panel Alignment to Center"),d(4435,null),"center"),HOt(VOt.JUSTIFY,L(4436,"Set Panel Alignment to Justify"),d(4437,null),"justify")];ve.appendMenuItem(D.MenubarAppearanceMenu,{submenu:D.PanelPositionMenu,title:d(4456,null),group:"3_workbench_layout_move",order:4});Q8o.forEach((a,i)=>{let{id:e,title:t,shortLabel:o,value:n,when:r}=a;W(class extends K{constructor(){super({id:e,title:t,category:Ve.View,f1:!0})}run(s){s.get(yi).setPanelPosition(n===void 0?2:n)}}),ve.appendMenuItem(D.PanelPositionMenu,{command:{id:e,title:o,toggled:r.negate()},order:5+i})});ve.appendMenuItem(D.MenubarAppearanceMenu,{submenu:D.PanelAlignmentMenu,title:d(4433,null),group:"3_workbench_layout_move",order:5});Y8o.forEach(a=>{let{id:i,title:e,shortLabel:t,value:o,when:n}=a;W(class extends K{constructor(){super({id:i,title:e,category:Ve.View,toggled:n.negate(),f1:!0})}run(r){r.get(yi).setPanelAlignment(o===void 0?"center":o)}}),ve.appendMenuItem(D.PanelAlignmentMenu,{command:{id:i,title:t,toggled:n.negate()},order:5})});W(class extends rH{constructor(){super({id:"workbench.action.previousPanelView",title:L(4465,"Previous Panel View"),category:Ve.View,f1:!0},1,-1)}});W(class extends rH{constructor(){super({id:"workbench.action.nextPanelView",title:L(4453,"Next Panel View"),category:Ve.View,f1:!0},1,1)}});var Tao=C.or(TB.isEqualTo("center"),C.and(qX.notEqualsTo("bottom"),qX.notEqualsTo("top")));W(class extends K{constructor(){super({id:"workbench.action.toggleMaximizedPanel",title:L(4466,"Toggle Maximized Panel"),tooltip:d(4448,null),category:Ve.View,f1:!0,icon:q8o,precondition:Tao,toggled:{condition:qDt,tooltip:d(4449,null)},menu:[{id:D.PanelTitle,group:"navigation",order:1,when:Tao}]})}run(a){let i=a.get(yi),e=a.get(Ne);if(i.getPanelAlignment()!=="center"&&xh(i.getPanelPosition())){e.warn(d(4455,null));return}i.isVisible("workbench.parts.panel")?i.toggleMaximizedPanel():(i.setPartHidden(!1,"workbench.parts.panel"),i.isPanelMaximized()||i.toggleMaximizedPanel())}});ve.appendMenuItems([{id:D.LayoutControlMenu,item:{group:"2_pane_toggles",command:{id:D2.ID,title:d(4467,null),icon:j8o,toggled:{condition:$X,icon:$8o}},when:C.and(Cb.negate(),C.or(C.equals("config.workbench.layoutControl.type","toggles"),C.equals("config.workbench.layoutControl.type","both"))),order:1}}]);var rLe=class extends K{constructor(e,t,o){super(o);this.source=e;this.destination=t}run(e,...t){let o=e.get(Bi),n=e.get(yi),r=e.get($t),s=o.getViewContainersByLocation(this.source),l=o.getViewContainersByLocation(this.destination);if(s.length){let c=r.getVisibleViewContainer(this.source);s.forEach(u=>o.moveViewContainerToLocation(u,this.destination,void 0,this.desc.id)),n.setPartHidden(!1,this.destination===1?"workbench.parts.panel":"workbench.parts.auxiliarybar"),c&&l.length===0&&r.openViewContainer(c.id,!0)}}},MIi=class a extends rLe{static{this.ID="workbench.action.movePanelToSidePanel"}constructor(){super(1,2,{id:a.ID,title:L(4451,"Move Panel Views To Secondary Side Bar"),category:Ve.View,f1:!1})}},PIi=class a extends rLe{static{this.ID="workbench.action.movePanelToSecondarySideBar"}constructor(){super(1,2,{id:a.ID,title:L(4451,"Move Panel Views To Secondary Side Bar"),category:Ve.View,f1:!0})}};W(MIi);W(PIi);var AIi=class a extends rLe{static{this.ID="workbench.action.moveSidePanelToPanel"}constructor(){super(2,1,{id:a.ID,title:L(4452,"Move Secondary Side Bar Views To Panel"),category:Ve.View,f1:!1})}},NIi=class a extends rLe{static{this.ID="workbench.action.moveSecondarySideBarToPanel"}constructor(){super(2,1,{id:a.ID,title:L(4452,"Move Secondary Side Bar Views To Panel"),category:Ve.View,f1:!0})}};W(AIi);W(NIi);var OIi={},X8o=new qle("quick-input-button-icon-");function J8o(a){if(!a)return;let i,e=a.dark.toString();return OIi[e]?i=OIi[e]:(i=X8o.nextId(),$h(`.${i}, .hc-light .${i}`,`background-image: ${Qa(a.light||a.dark)}`),$h(`.vs-dark .${i}, .hc-black .${i}`,`background-image: ${Qa(a.dark)}`),OIi[e]=i),i}var FIi=class{constructor(i,e,t,o,n,r,s){this.id=i;this.label=e;this.tooltip=t;this.enabled=n;this._checked=r;this._run=s;this.class=o}get checked(){return this._checked}set checked(i){this._checked=i,this._run()}run(){return this._checked=!this._checked,this._run()}};function WIi(a,i,e){let t=a.iconClass||J8o(a.iconPath);a.alwaysVisible&&(t=t?`${t} always-visible`:"always-visible");let o=()=>(a.toggle&&(a.toggle.checked=!a.toggle.checked),e());return a.toggle?new FIi(i,a.tooltip||"","",t,!0,a.toggle.checked,o):{id:i,label:"",tooltip:a.tooltip||"",class:t,enabled:!0,run:o}}function b3(a,i,e){let t=[],o=[];return a.forEach((n,r)=>{let s=WIi(n,`${i}-${r}`,async()=>e(n));n.label&&(s.label=n.label),n.secondary?o.push(s):t.push(s)}),{primary:t,secondary:o}}function Dao(a,i,e){vi(i);let t=ES(a),o=0;for(let n of t.nodes)if(typeof n=="string")i.append(...Un(n));else{let r=n.title;!r&&n.href.startsWith("command:")?r=d(2318,null,n.href.substring(8)):r||(r=n.href);let s=_("a",{href:n.href,title:r,tabIndex:o++},n.label);s.style.textDecoration="underline";let l=g=>{Egt(g)&&Xt.stop(g,!0),e.callback(n.href)},c=e.disposables.add(new Gn(s,re.CLICK)).event,u=e.disposables.add(new Gn(s,re.KEY_DOWN)).event,p=U.chain(u,g=>g.filter(f=>{let v=new gi(f);return v.equals(10)||v.equals(3)}));e.disposables.add(Ms.addTarget(s));let h=e.disposables.add(new Gn(s,Kn.Tap)).event;U.any(c,h,p)(l,null,e.disposables),i.appendChild(s)}}var Rao="inQuickInput",Mao=new Y(Rao,!1,d(2298,null)),lLe=C.has(Rao),Z8o="quickInputAlignment",WXe=new Y(Z8o,"top",d(2302,null)),OZ="quickInputType",Pao=new Y(OZ,void 0,d(2304,null)),Aao="cursorAtEndOfQuickInputBox",Nao=new Y(Aao,!1,d(2295,null)),Oao=C.has(Aao),GOt={iconClass:q.asClassName(R.quickInputBack),tooltip:d(2300,null),handle:-1},AZ=class a extends x{constructor(e){super();this.ui=e;this._visible=Me("visible",!1);this._enabled=!0;this._busy=!1;this._ignoreFocusOut=!1;this._leftButtons=[];this._rightButtons=[];this._inlineButtons=[];this._inputButtons=[];this.buttonsUpdated=!1;this.noValidationMessage=a.noPromptMessage;this._severity=bt.Ignore;this.onDidTriggerButtonEmitter=this._register(new E);this.onDidHideEmitter=this._register(new E);this.onWillHideEmitter=this._register(new E);this.onDisposeEmitter=this._register(new E);this.visibleDisposables=this._register(new N);this.onDidTriggerButton=this.onDidTriggerButtonEmitter.event;this.onDidHide=this.onDidHideEmitter.event;this.onWillHide=this.onWillHideEmitter.event;this.onDispose=this.onDisposeEmitter.event}static{this.noPromptMessage=d(2296,null)}get visible(){return this._visible.get()}get title(){return this._title}set title(e){this._title=e,this.update()}get description(){return this._description}set description(e){this._description=e,this.update()}get step(){return this._steps}set step(e){this._steps=e,this.update()}get totalSteps(){return this._totalSteps}set totalSteps(e){this._totalSteps=e,this.update()}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this.update()}get contextKey(){return this._contextKey}set contextKey(e){this._contextKey=e,this.update()}get busy(){return this._busy}set busy(e){this._busy=e,this.update()}get ignoreFocusOut(){return this._ignoreFocusOut}set ignoreFocusOut(e){let t=this._ignoreFocusOut!==e&&!dc;this._ignoreFocusOut=e&&!dc,t&&this.update()}get titleButtons(){return this._leftButtons.length?[...this._leftButtons,this._rightButtons]:this._rightButtons}get buttons(){return[...this._leftButtons,...this._rightButtons,...this._inlineButtons,...this._inputButtons]}set buttons(e){let t=[],o=[],n=[],r=[];for(let s of e)if(s===GOt)t.push(s);else switch(s.location){case 2:n.push(s);break;case 3:r.push(s);break;default:o.push(s);break}this._leftButtons=t,this._rightButtons=o,this._inlineButtons=n,this._inputButtons=r,this.buttonsUpdated=!0,this.update()}get validationMessage(){return this._validationMessage}set validationMessage(e){this._validationMessage=e,this.update()}get severity(){return this._severity}set severity(e){this._severity=e,this.update()}show(){this.visible||(this.visibleDisposables.add(this.ui.onDidTriggerButton(e=>{this.buttons.indexOf(e)!==-1&&this.onDidTriggerButtonEmitter.fire(e)})),this.ui.show(this),this._visible.set(!0,void 0),this._lastValidationMessage=void 0,this._lastSeverity=void 0,this.buttons.length&&(this.buttonsUpdated=!0),this.update())}hide(){this.visible&&this.ui.hide()}didHide(e=3){this._visible.set(!1,void 0),this.visibleDisposables.clear(),this.onDidHideEmitter.fire({reason:e})}willHide(e=3){this.onWillHideEmitter.fire({reason:e})}update(){if(!this.visible)return;let e=this.getTitle();e&&this.ui.title.textContent!==e?this.ui.title.textContent=e:!e&&this.ui.title.innerHTML!=="&nbsp;"&&(this.ui.title.innerText="\xA0");let t=this.getDescription();if(this.ui.description1.textContent!==t&&(this.ui.description1.textContent=t),this.ui.description2.textContent!==t&&(this.ui.description2.textContent=t),this.busy&&!this.busyDelay&&(this.busyDelay=new Ul,this.busyDelay.setIfNotSet(()=>{this.visible&&(this.ui.progressBar.infinite(),this.ui.progressBar.getContainer().removeAttribute("aria-hidden"))},800)),!this.busy&&this.busyDelay&&(this.ui.progressBar.stop(),this.ui.progressBar.getContainer().setAttribute("aria-hidden","true"),this.busyDelay.cancel(),this.busyDelay=void 0),this.buttonsUpdated){this.buttonsUpdated=!1;let n=b3(this._leftButtons,"left-button",c=>this.onDidTriggerButtonEmitter.fire(c));this.ui.leftActionBar.setActions(n.primary,n.secondary);let r=b3(this._rightButtons,"right-button",c=>this.onDidTriggerButtonEmitter.fire(c));this.ui.rightActionBar.setActions(r.primary,r.secondary);let s=b3(this._inlineButtons,"inline-button",c=>this.onDidTriggerButtonEmitter.fire(c));this.ui.inlineActionBar.setActions(s.primary,s.secondary);let l=this._inputButtons.length*22;this.ui.countContainer.style.right=l>0?`${4+l}px`:"4px",this.ui.inputBox.actions=this._inputButtons.map((c,u)=>WIi(c,`id-${u}`,async()=>this.onDidTriggerButtonEmitter.fire(c)))}this.ui.ignoreFocusOut=this.ignoreFocusOut,this.ui.setEnabled(this.enabled),this.ui.setContextKey(this.contextKey);let o=this.validationMessage||this.noValidationMessage;this._lastValidationMessage!==o&&(this._lastValidationMessage=o,vi(this.ui.message),o&&Dao(o,this.ui.message,{callback:n=>{this.ui.linkOpenerDelegate(n)},disposables:this.visibleDisposables})),this._lastSeverity!==this.severity&&(this._lastSeverity=this.severity,this.showMessageDecoration(this.severity))}getTitle(){return this.title&&this.step?`${this.title} (${this.getSteps()})`:this.title?this.title:this.step?this.getSteps():""}getDescription(){return this.description||""}getSteps(){return this.step&&this.totalSteps?d(2301,null,this.step,this.totalSteps):this.step?String(this.step):""}showMessageDecoration(e){if(this.ui.inputBox.showDecoration(e),e!==bt.Ignore){let t=this.ui.inputBox.stylesForType(e);this.ui.message.style.color=t.foreground?`${t.foreground}`:"",this.ui.message.style.backgroundColor=t.background?`${t.background}`:"",this.ui.message.style.border=t.border?`1px solid ${t.border}`:"",this.ui.message.style.marginBottom="-2px"}else this.ui.message.style.color="",this.ui.message.style.backgroundColor="",this.ui.message.style.border="",this.ui.message.style.marginBottom=""}dispose(){this.hide(),this.onDisposeEmitter.fire(),super.dispose()}},NZ=class a extends AZ{constructor(e){super(e);this._value="";this.onDidChangeValueEmitter=this._register(new E);this.onWillAcceptEmitter=this._register(new E);this.onDidAcceptEmitter=this._register(new E);this.onDidCustomEmitter=this._register(new E);this._items=[];this.itemsUpdated=!1;this._canSelectMany=!1;this._canAcceptInBackground=!1;this._matchOnDescription=!1;this._matchOnDetail=!1;this._matchOnLabel=!0;this._matchOnLabelMode="fuzzy";this._sortByLabel=!0;this._keepScrollPosition=!1;this._itemActivation=1;this._activeItems=[];this.activeItemsUpdated=!1;this.activeItemsToConfirm=[];this.onDidChangeActiveEmitter=this._register(new E);this._selectedItems=[];this.selectedItemsUpdated=!1;this.selectedItemsToConfirm=[];this.onDidChangeSelectionEmitter=this._register(new E);this.onDidTriggerItemButtonEmitter=this._register(new E);this.onDidTriggerSeparatorButtonEmitter=this._register(new E);this.valueSelectionUpdated=!0;this._ok="default";this._customButton=!1;this._customButtonSecondary=!1;this._focusEventBufferer=new QN;this.type="quickPick";this.filterValue=e=>e;this.onDidChangeValue=this.onDidChangeValueEmitter.event;this.onWillAccept=this.onWillAcceptEmitter.event;this.onDidAccept=this.onDidAcceptEmitter.event;this.onDidCustom=this.onDidCustomEmitter.event;this.onDidChangeActive=this.onDidChangeActiveEmitter.event;this.onDidChangeSelection=this.onDidChangeSelectionEmitter.event;this.onDidTriggerItemButton=this.onDidTriggerItemButtonEmitter.event;this.onDidTriggerSeparatorButton=this.onDidTriggerSeparatorButtonEmitter.event;this.noValidationMessage=void 0}static{this.DEFAULT_ARIA_LABEL=d(2303,null)}get quickNavigate(){return this._quickNavigate}set quickNavigate(e){this._quickNavigate=e,this.update()}get value(){return this._value}set value(e){this.doSetValue(e)}doSetValue(e,t){this._value!==e&&(this._value=e,t||this.update(),this.visible&&this.ui.list.filter(this.filterValue(this._value))&&this.trySelectFirst(),this.onDidChangeValueEmitter.fire(this._value))}set ariaLabel(e){this._ariaLabel=e,this.update()}get ariaLabel(){return this._ariaLabel}get placeholder(){return this._placeholder}set placeholder(e){this._placeholder=e,this.update()}get prompt(){return this.noValidationMessage}set prompt(e){this.noValidationMessage=e,this.update()}get items(){return this._items}get scrollTop(){return this.ui.list.scrollTop}set scrollTop(e){this.ui.list.scrollTop=e}set items(e){this._items=e,this.itemsUpdated=!0,this.update()}get canSelectMany(){return this._canSelectMany}set canSelectMany(e){this._canSelectMany=e,this.update()}get canAcceptInBackground(){return this._canAcceptInBackground}set canAcceptInBackground(e){this._canAcceptInBackground=e}get matchOnDescription(){return this._matchOnDescription}set matchOnDescription(e){this._matchOnDescription=e,this.update()}get matchOnDetail(){return this._matchOnDetail}set matchOnDetail(e){this._matchOnDetail=e,this.update()}get matchOnLabel(){return this._matchOnLabel}set matchOnLabel(e){this._matchOnLabel=e,this.update()}get matchOnLabelMode(){return this._matchOnLabelMode}set matchOnLabelMode(e){this._matchOnLabelMode=e,this.update()}get sortByLabel(){return this._sortByLabel}set sortByLabel(e){this._sortByLabel=e,this.update()}get keepScrollPosition(){return this._keepScrollPosition}set keepScrollPosition(e){this._keepScrollPosition=e}get itemActivation(){return this._itemActivation}set itemActivation(e){this._itemActivation=e}get activeItems(){return this._activeItems}set activeItems(e){this._activeItems=e,this.activeItemsUpdated=!0,this.update()}get selectedItems(){return this._selectedItems}set selectedItems(e){this._selectedItems=e,this.selectedItemsUpdated=!0,this.update()}get keyMods(){return this._quickNavigate?e9i:this.ui.keyMods}get valueSelection(){let e=this.ui.inputBox.getSelection();if(e)return[e.start,e.end]}set valueSelection(e){this._valueSelection=e,this.valueSelectionUpdated=!0,this.update()}get customButton(){return this._customButton}set customButton(e){this._customButton=e,this.update()}get customLabel(){return this._customButtonLabel}set customLabel(e){this._customButtonLabel=e,this.update()}get customHover(){return this._customButtonHover}set customHover(e){this._customButtonHover=e,this.update()}get customButtonSecondary(){return this._customButtonSecondary}set customButtonSecondary(e){this._customButtonSecondary=e??!1,this.update()}get ok(){return this._ok}set ok(e){this._ok=e,this.update()}get okLabel(){return this._okLabel??d(2299,null)}set okLabel(e){this._okLabel=e,this.update()}inputHasFocus(){return this.visible?this.ui.inputBox.hasFocus():!1}focusOnInput(){this.ui.inputBox.setFocus()}get hideInput(){return!!this._hideInput}set hideInput(e){this._hideInput=e,this.update()}get hideCountBadge(){return!!this._hideCountBadge}set hideCountBadge(e){this._hideCountBadge=e,this.update()}get hideCheckAll(){return!!this._hideCheckAll}set hideCheckAll(e){this._hideCheckAll=e,this.update()}trySelectFirst(){this.canSelectMany||this.ui.list.focus(1)}show(){this.visible||(this.visibleDisposables.add(this.ui.inputBox.onDidChange(e=>{this.doSetValue(e,!0)})),this.visibleDisposables.add(this.ui.onDidAccept(()=>{this.canSelectMany?this.ui.list.getCheckedElements().length||(this._selectedItems=[],this.onDidChangeSelectionEmitter.fire(this.selectedItems)):this.activeItems[0]&&(this._selectedItems=[this.activeItems[0]],this.onDidChangeSelectionEmitter.fire(this.selectedItems)),this.handleAccept(!1)})),this.visibleDisposables.add(this.ui.onDidCustom(()=>{this.onDidCustomEmitter.fire()})),this.visibleDisposables.add(this._focusEventBufferer.wrapEvent(this.ui.list.onDidChangeFocus,(e,t)=>t)(e=>{this.activeItemsUpdated||this.activeItemsToConfirm!==this._activeItems&&$i(e,this._activeItems,(t,o)=>t===o)||(this._activeItems=e,this.onDidChangeActiveEmitter.fire(e))})),this.visibleDisposables.add(this.ui.list.onDidChangeSelection(({items:e,event:t})=>{if(this.canSelectMany&&!e.some(o=>o.pickable===!1)){e.length&&this.ui.list.setSelectedElements([]);return}this.selectedItemsToConfirm!==this._selectedItems&&$i(e,this._selectedItems,(o,n)=>o===n)||(this._selectedItems=e,this.onDidChangeSelectionEmitter.fire(e),e.length&&this.handleAccept(Ru(t)&&t.button===1))})),this.visibleDisposables.add(this.ui.list.onChangedCheckedElements(e=>{!this.canSelectMany||!this.visible||this.selectedItemsToConfirm!==this._selectedItems&&$i(e,this._selectedItems,(t,o)=>t===o)||(this._selectedItems=e,this.onDidChangeSelectionEmitter.fire(e))})),this.visibleDisposables.add(this.ui.list.onButtonTriggered(e=>this.onDidTriggerItemButtonEmitter.fire(e))),this.visibleDisposables.add(this.ui.list.onSeparatorButtonTriggered(e=>this.onDidTriggerSeparatorButtonEmitter.fire(e))),this.visibleDisposables.add(this.registerQuickNavigation()),this.valueSelectionUpdated=!0),super.show()}handleAccept(e){let t=!1;this.onWillAcceptEmitter.fire({veto:()=>t=!0}),t||this.onDidAcceptEmitter.fire({inBackground:e})}registerQuickNavigation(){return j(this.ui.container,re.KEY_UP,e=>{if(this.canSelectMany||!this._quickNavigate)return;let t=new gi(e),o=t.keyCode;this._quickNavigate.keybindings.some(s=>{let l=s.getChords();return l.length>1?!1:l[0].shiftKey&&o===4?!(t.ctrlKey||t.altKey||t.metaKey):!!(l[0].altKey&&o===6||l[0].ctrlKey&&o===5||l[0].metaKey&&o===57)})&&(this.activeItems[0]&&(this._selectedItems=[this.activeItems[0]],this.onDidChangeSelectionEmitter.fire(this.selectedItems),this.handleAccept(!1)),this._quickNavigate=void 0)})}update(){if(!this.visible)return;let e=this.keepScrollPosition?this.scrollTop:0,t=!!this.description,o={title:!!this.title||!!this.step||!!this.titleButtons.length,description:t,checkAll:this.canSelectMany&&!this._hideCheckAll,checkBox:this.canSelectMany,inputBox:!this._hideInput,progressBar:!this._hideInput||t,visibleCount:!0,count:this.canSelectMany&&!this._hideCountBadge,ok:this.ok==="default"?this.canSelectMany:this.ok,list:!0,message:!!this.validationMessage||!!this.prompt,customButton:this.customButton};this.ui.setVisibilities(o),super.update(),this.ui.inputBox.value!==this.value&&(this.ui.inputBox.value=this.value),this.valueSelectionUpdated&&(this.valueSelectionUpdated=!1,this.ui.inputBox.select(this._valueSelection&&{start:this._valueSelection[0],end:this._valueSelection[1]})),this.ui.inputBox.placeholder!==(this.placeholder||"")&&(this.ui.inputBox.placeholder=this.placeholder||"");let n=this.ariaLabel;!n&&o.inputBox&&(n=this.placeholder,this.title&&(n=n?`${n} - ${this.title}`:this.title),n||(n=a.DEFAULT_ARIA_LABEL)),this.ui.list.ariaLabel!==n&&(this.ui.list.ariaLabel=n??null),this.ui.inputBox.ariaLabel!==n&&(this.ui.inputBox.ariaLabel=n??"input"),this.ui.list.matchOnDescription=this.matchOnDescription,this.ui.list.matchOnDetail=this.matchOnDetail,this.ui.list.matchOnLabel=this.matchOnLabel,this.ui.list.matchOnLabelMode=this.matchOnLabelMode,this.ui.list.sortByLabel=this.sortByLabel,this.itemsUpdated&&(this.itemsUpdated=!1,this._focusEventBufferer.bufferEvents(()=>{switch(this.ui.list.setElements(this.items),this.ui.list.shouldLoop=!this.canSelectMany,this.ui.list.filter(this.filterValue(this.ui.inputBox.value)),this._itemActivation){case 0:this._itemActivation=1;break;case 2:this.ui.list.focus(2),this._itemActivation=1;break;case 3:this.ui.list.focus(3),this._itemActivation=1;break;default:this.trySelectFirst();break}})),this.ui.container.classList.contains("show-checkboxes")!==!!this.canSelectMany&&(this.canSelectMany?this.ui.list.clearFocus():this.trySelectFirst()),this.activeItemsUpdated&&(this.activeItemsUpdated=!1,this.activeItemsToConfirm=this._activeItems,this.ui.list.setFocusedElements(this.activeItems),this.activeItemsToConfirm===this._activeItems&&(this.activeItemsToConfirm=null)),this.selectedItemsUpdated&&(this.selectedItemsUpdated=!1,this.selectedItemsToConfirm=this._selectedItems,this.canSelectMany?this.ui.list.setCheckedElements(this.selectedItems):this.ui.list.setSelectedElements(this.selectedItems),this.selectedItemsToConfirm===this._selectedItems&&(this.selectedItemsToConfirm=null)),this.ui.ok.label=this.okLabel||"",this.ui.customButton.label=this.customLabel||"",this.ui.customButton.element.title=this.customHover||"",this.ui.customButton.secondary=this.customButtonSecondary||!1,o.inputBox||(this.ui.list.domFocus(),this.canSelectMany&&this.ui.list.focus(1)),this.keepScrollPosition&&(this.scrollTop=e)}focus(e){this.ui.list.focus(e),this.canSelectMany&&this.ui.list.domFocus()}accept(e){e&&!this._canAcceptInBackground||(this.activeItems[0]&&!this._canSelectMany&&(this._selectedItems=[this.activeItems[0]],this.onDidChangeSelectionEmitter.fire(this.selectedItems)),this.handleAccept(e??!1))}},UOt=class extends AZ{constructor(){super(...arguments);this._value="";this.valueSelectionUpdated=!0;this._password=!1;this.onDidValueChangeEmitter=this._register(new E);this.onDidAcceptEmitter=this._register(new E);this.type="inputBox";this.onDidChangeValue=this.onDidValueChangeEmitter.event;this.onDidAccept=this.onDidAcceptEmitter.event}get value(){return this._value}set value(e){this._value=e||"",this.update()}get valueSelection(){let e=this.ui.inputBox.getSelection();if(e)return[e.start,e.end]}set valueSelection(e){this._valueSelection=e,this.valueSelectionUpdated=!0,this.update()}get placeholder(){return this._placeholder}set placeholder(e){this._placeholder=e,this.update()}get ariaLabel(){return this._ariaLabel}set ariaLabel(e){this._ariaLabel=e,this.update()}get password(){return this._password}set password(e){this._password=e,this.update()}get prompt(){return this._prompt}set prompt(e){this._prompt=e,this.noValidationMessage=e?d(2297,null,e):AZ.noPromptMessage,this.update()}show(){this.visible||(this.visibleDisposables.add(this.ui.inputBox.onDidChange(e=>{e!==this.value&&(this._value=e,this.onDidValueChangeEmitter.fire(e))})),this.visibleDisposables.add(this.ui.onDidAccept(()=>this.onDidAcceptEmitter.fire())),this.valueSelectionUpdated=!0),super.show()}accept(){this.onDidAcceptEmitter.fire()}update(){if(!this.visible)return;this.ui.container.classList.remove("hidden-input");let e={title:!!this.title||!!this.step||!!this.titleButtons.length,description:!!this.description||!!this.step,inputBox:!0,message:!0,progressBar:!0};this.ui.setVisibilities(e),super.update(),this.ui.inputBox.value!==this.value&&(this.ui.inputBox.value=this.value),this.valueSelectionUpdated&&(this.valueSelectionUpdated=!1,this.ui.inputBox.select(this._valueSelection&&{start:this._valueSelection[0],end:this._valueSelection[1]})),this.ui.inputBox.placeholder!==(this.placeholder||"")&&(this.ui.inputBox.placeholder=this.placeholder||""),this.ui.inputBox.password!==this.password&&(this.ui.inputBox.password=this.password);let t=this.ariaLabel;!t&&e.inputBox&&(t=this.placeholder?this.title?`${this.placeholder} - ${this.title}`:this.placeholder:this.title?this.title:"input"),this.ui.inputBox.ariaLabel!==t&&(this.ui.inputBox.ariaLabel=t||"input")}},zOt=class extends AZ{constructor(){super(...arguments);this.type="quickWidget";this._widgetUpdated=!1}get widget(){return this._widget}set widget(e){this._widget!==e&&(this._widget=e,this._widgetUpdated=!0,this.update())}update(){this.visible&&(this.ui.setVisibilities({title:!!this.title||!!this.step||!!this.titleButtons.length,description:!!this.description||!!this.step}),this._widgetUpdated&&(this._widgetUpdated=!1,this._widget?vi(this.ui.widget,this._widget):vi(this.ui.widget)),super.update())}},sLe=class extends mf{constructor(i,e){super("mouse",void 0,t=>this.getOverrideOptions(t),i,e)}getOverrideOptions(i){let e=(Do(i.content)?i.content.textContent??"":typeof i.content=="string"?i.content:i.content.value).includes(`
`);return{persistence:{hideOnKeyDown:!1},appearance:{showHoverHint:e,skipFadeInAnimation:!0}}}};sLe=I([m(0,B),m(1,nt)],sLe);var tQo=Ae("menuBar",R.layoutMenubar,d(3614,null)),iQo=Ae("activity-bar-left",R.layoutActivitybarLeft,d(3578,null)),oQo=Ae("activity-bar-right",R.layoutActivitybarRight,d(3579,null)),qOt=Ae("panel-left",R.layoutSidebarLeft,d(3655,null)),nQo=Ae("panel-left-off",R.layoutSidebarLeftOff,d(3656,null)),$Ot=Ae("panel-right",R.layoutSidebarRight,d(3657,null)),rQo=Ae("panel-right-off",R.layoutSidebarRightOff,d(3658,null)),sQo=Ae("panel-bottom",R.layoutPanel,d(3649,null)),aQo=Ae("statusBar",R.layoutStatusbar,d(3691,null)),lQo=Ae("panel-align-left",R.layoutPanelLeft,d(3652,null)),cQo=Ae("panel-align-right",R.layoutPanelRight,d(3653,null)),dQo=Ae("panel-align-center",R.layoutPanelCenter,d(3650,null)),uQo=Ae("panel-align-justify",R.layoutPanelJustify,d(3651,null)),pQo=Ae("quickInputAlignmentTop",R.arrowUp,d(3662,null)),mQo=Ae("quickInputAlignmentCenter",R.circle,d(3661,null)),hQo=Ae("fullscreen",R.screenFull,d(3599,null)),gQo=Ae("centerLayoutIcon",R.layoutCentered,d(3584,null)),fQo=Ae("zenMode",R.target,d(3707,null)),$Ii="workbench.action.toggleActivityBarVisibility";W(class extends K{constructor(){super({id:"workbench.action.toggleCenteredLayout",title:{...L(3693,"Toggle Centered Layout"),mnemonicTitle:d(3622,null)},precondition:Rw.toNegated(),category:Ve.View,f1:!0,toggled:_6e,menu:[{id:D.MenubarAppearanceMenu,group:"1_toggle_view",order:3}]})}run(a){let i=a.get(yi),e=a.get(wt);i.centerMainEditorLayout(!i.isMainEditorLayoutCentered()),e.activeGroup.focus()}});var Fao="workbench.sideBar.location",jOt=class extends K{constructor(e,t,o){super({id:e,title:t,f1:!1});this.position=o}async run(e){let t=e.get(yi),o=e.get(B);if(t.getSideBarPosition()!==this.position)return o.updateValue(Fao,jC(this.position))}},QOt=class a extends jOt{static{this.ID="workbench.action.moveSideBarRight"}constructor(){super(a.ID,L(3643,"Move Primary Side Bar Right"),1)}},YOt=class a extends jOt{static{this.ID="workbench.action.moveSideBarLeft"}constructor(){super(a.ID,L(3641,"Move Primary Side Bar Left"),0)}};W(QOt);W(YOt);var kT=class a extends K{static{this.ID="workbench.action.toggleSidebarPosition"}static{this.LABEL=d(3700,null)}static getLabel(i){return i.getSideBarPosition()===0?d(3644,null):d(3642,null)}constructor(){super({id:a.ID,title:L(3701,"Toggle Primary Side Bar Position"),category:Ve.View,f1:!0})}run(i){let e=i.get(yi),t=i.get(B),n=e.getSideBarPosition()===0?"right":"left";return t.updateValue(Fao,n)}};W(kT);var Wao=Ae("configure-layout-icon",R.layout,d(3587,null));ve.appendMenuItem(D.LayoutControlMenu,{submenu:D.LayoutControlMenuSubmenu,title:d(3590,null),icon:Wao,group:"1_workbench_layout",when:C.and(Cb.negate(),C.equals("config.workbench.layoutControl.type","menu"))});ve.appendMenuItems([{id:D.ViewContainerTitleContext,item:{group:"3_workbench_layout_move",command:{id:kT.ID,title:d(3626,null)},when:C.and(C.notEquals("config.workbench.sideBar.location","right"),C.equals("viewContainerLocation",Pw(0))),order:1}},{id:D.ViewContainerTitleContext,item:{group:"3_workbench_layout_move",command:{id:kT.ID,title:d(3627,null)},when:C.and(C.equals("config.workbench.sideBar.location","right"),C.equals("viewContainerLocation",Pw(0))),order:1}},{id:D.ViewContainerTitleContext,item:{group:"3_workbench_layout_move",command:{id:kT.ID,title:d(3624,null)},when:C.and(C.notEquals("config.workbench.sideBar.location","right"),C.equals("viewContainerLocation",Pw(2))),order:1}},{id:D.ViewContainerTitleContext,item:{group:"3_workbench_layout_move",command:{id:kT.ID,title:d(3625,null)},when:C.and(C.equals("config.workbench.sideBar.location","right"),C.equals("viewContainerLocation",Pw(2))),order:1}}]);ve.appendMenuItem(D.MenubarAppearanceMenu,{group:"3_workbench_layout_move",command:{id:kT.ID,title:d(3619,null)},when:C.notEquals("config.workbench.sideBar.location","right"),order:2});ve.appendMenuItem(D.MenubarAppearanceMenu,{group:"3_workbench_layout_move",command:{id:kT.ID,title:d(3618,null)},when:C.equals("config.workbench.sideBar.location","right"),order:2});W(class extends K{constructor(){super({id:"workbench.action.toggleEditorVisibility",title:{...L(3694,"Toggle Editor Area Visibility"),mnemonicTitle:d(3620,null)},category:Ve.View,f1:!0,toggled:GDt,precondition:C.and(Rw.toNegated(),C.or(TB.isEqualTo("center"),qX.notEqualsTo("bottom")))})}run(a){a.get(yi).toggleMaximizedPanel()}});ve.appendMenuItem(D.MenubarViewMenu,{group:"2_appearance",title:d(3615,null),submenu:D.MenubarAppearanceMenu,order:1});var aH=class a extends K{static{this.ID="workbench.action.toggleSidebarVisibility"}static{this.LABEL=d(3588,null)}constructor(){super({id:a.ID,title:L(3698,"Toggle Primary Side Bar Visibility"),toggled:{condition:tA,title:d(3659,null),mnemonicTitle:d(3660,null)},metadata:{description:d(3646,null)},category:Ve.View,f1:!0,keybinding:{weight:200,primary:2080},menu:[{id:D.LayoutControlMenuSubmenu,group:"0_workbench_layout",order:0},{id:D.MenubarAppearanceMenu,group:"2_workbench_layout",order:1}]})}run(i){let e=i.get(yi),t=e.isVisible("workbench.parts.sidebar");e.setPartHidden(t,"workbench.parts.sidebar");let o=t?d(3687,null):d(3689,null);en(o)}};W(aH);ve.appendMenuItems([{id:D.ViewContainerTitleContext,item:{group:"3_workbench_layout_move",command:{id:aH.ID,title:d(3588,null)},when:C.and(tA,C.equals("viewContainerLocation",Pw(0))),order:2}},{id:D.LayoutControlMenu,item:{group:"2_pane_toggles",command:{id:aH.ID,title:d(3699,null),icon:nQo,toggled:{condition:tA,icon:qOt}},when:C.and(Cb.negate(),C.or(C.equals("config.workbench.layoutControl.type","toggles"),C.equals("config.workbench.layoutControl.type","both")),C.equals("config.workbench.sideBar.location","left")),order:0}},{id:D.LayoutControlMenu,item:{group:"2_pane_toggles",command:{id:aH.ID,title:d(3699,null),icon:rQo,toggled:{condition:tA,icon:$Ot}},when:C.and(Cb.negate(),C.or(C.equals("config.workbench.layoutControl.type","toggles"),C.equals("config.workbench.layoutControl.type","both")),C.equals("config.workbench.sideBar.location","right")),order:2}}]);var Mpe=class a extends K{static{this.ID="workbench.action.toggleStatusbarVisibility"}static{this.statusbarVisibleKey="workbench.statusBar.visible"}constructor(){super({id:a.ID,title:{...L(3702,"Toggle Status Bar Visibility"),mnemonicTitle:d(3621,null)},category:Ve.View,f1:!0,toggled:C.equals("config.workbench.statusBar.visible",!0),menu:[{id:D.MenubarAppearanceMenu,group:"2_workbench_layout",order:3}]})}run(i){let e=i.get(yi),t=i.get(B),n=!e.isVisible("workbench.parts.statusbar",ut);return t.updateValue(a.statusbarVisibleKey,n)}};W(Mpe);var FZ=class extends K{constructor(e,t,o,n,r,s){super({id:n,title:o,category:Ve.View,precondition:r,metadata:s?{description:s}:void 0,f1:!0});this.settingName=e;this.value=t}run(e){return e.get(B).updateValue(this.settingName,this.value)}},VXe=class a extends FZ{static{this.ID="workbench.action.hideEditorTabs"}constructor(){let i=C.and(C.equals("config.workbench.editor.showTabs","none").negate(),BC.negate()),e=L(3602,"Hide Editor Tabs");super("workbench.editor.showTabs","none",e,a.ID,i,L(3603,"Hide Tab Bar"))}},BXe=class a extends FZ{static{this.ID="workbench.action.zenHideEditorTabs"}constructor(){let i=C.and(C.equals("config.zenMode.showTabs","none").negate(),BC),e=L(3604,"Hide Editor Tabs in Zen Mode");super("zenMode.showTabs","none",e,a.ID,i,L(3605,"Hide Tab Bar in Zen Mode"))}},HXe=class a extends FZ{static{this.ID="workbench.action.showMultipleEditorTabs"}constructor(){let i=C.and(C.equals("config.workbench.editor.showTabs","multiple").negate(),BC.negate()),e=L(3676,"Show Multiple Editor Tabs");super("workbench.editor.showTabs","multiple",e,a.ID,i,L(3677,"Show Tab Bar with multiple tabs"))}},UXe=class a extends FZ{static{this.ID="workbench.action.zenShowMultipleEditorTabs"}constructor(){let i=C.and(C.equals("config.zenMode.showTabs","multiple").negate(),BC),e=L(3678,"Show Multiple Editor Tabs in Zen Mode");super("zenMode.showTabs","multiple",e,a.ID,i,L(3679,"Show Tab Bar in Zen Mode"))}},zXe=class a extends FZ{static{this.ID="workbench.action.showEditorTab"}constructor(){let i=C.and(C.equals("config.workbench.editor.showTabs","single").negate(),BC.negate()),e=L(3680,"Show Single Editor Tab");super("workbench.editor.showTabs","single",e,a.ID,i,L(3681,"Show Tab Bar with one Tab"))}},KXe=class a extends FZ{static{this.ID="workbench.action.zenShowEditorTab"}constructor(){let i=C.and(C.equals("config.zenMode.showTabs","single").negate(),BC),e=L(3682,"Show Single Editor Tab in Zen Mode");super("zenMode.showTabs","single",e,a.ID,i,L(3683,"Show Tab Bar in Zen Mode with one Tab"))}};W(VXe);W(BXe);W(HXe);W(UXe);W(zXe);W(KXe);ve.appendMenuItem(D.MenubarAppearanceMenu,{submenu:D.EditorTabsBarShowTabsSubmenu,title:d(3692,null),group:"3_workbench_layout_move",order:10,when:BC.negate()});ve.appendMenuItem(D.MenubarAppearanceMenu,{submenu:D.EditorTabsBarShowTabsZenModeSubmenu,title:d(3692,null),group:"3_workbench_layout_move",order:10,when:BC});var GXe=class a extends K{static{this.ID="workbench.action.editorActionsTitleBar"}constructor(){super({id:a.ID,title:L(3630,"Move Editor Actions to Title Bar"),category:Ve.View,precondition:C.equals("config.workbench.editor.editorActionsLocation","titleBar").negate(),metadata:{description:L(3631,"Move Editor Actions from the tab bar to the title bar")},f1:!0})}run(i){return i.get(B).updateValue("workbench.editor.editorActionsLocation","titleBar")}};W(GXe);var qXe=class a extends K{static{this.ID="workbench.action.editorActionsDefault"}constructor(){super({id:a.ID,title:L(3628,"Move Editor Actions to Tab Bar"),category:Ve.View,precondition:C.and(C.equals("config.workbench.editor.editorActionsLocation","default").negate(),C.equals("config.workbench.editor.showTabs","none").negate()),metadata:{description:L(3629,"Move Editor Actions from the title bar to the tab bar")},f1:!0})}run(i){return i.get(B).updateValue("workbench.editor.editorActionsLocation","default")}};W(qXe);var $Xe=class a extends K{static{this.ID="workbench.action.hideEditorActions"}constructor(){super({id:a.ID,title:L(3600,"Hide Editor Actions"),category:Ve.View,precondition:C.equals("config.workbench.editor.editorActionsLocation","hidden").negate(),metadata:{description:L(3601,"Hide Editor Actions in the tab and title bar")},f1:!0})}run(i){return i.get(B).updateValue("workbench.editor.editorActionsLocation","hidden")}};W($Xe);var VIi=class a extends K{static{this.ID="workbench.action.showEditorActions"}constructor(){super({id:a.ID,title:L(3674,"Show Editor Actions"),category:Ve.View,precondition:C.equals("config.workbench.editor.editorActionsLocation","hidden"),metadata:{description:L(3675,"Make Editor Actions visible.")},f1:!0})}run(i){return i.get(B).updateValue("workbench.editor.editorActionsLocation","default")}};W(VIi);ve.appendMenuItem(D.MenubarAppearanceMenu,{submenu:D.EditorActionsPositionSubmenu,title:d(3597,null),group:"3_workbench_layout_move",order:11});var jXe=class a extends K{static{this.ID="workbench.action.configureEditorTabs"}constructor(){super({id:a.ID,title:L(3591,"Configure Tabs"),category:Ve.View})}run(i){i.get(Go).openSettings({jsonEditor:!1,query:"workbench.editor tab"})}};W(jXe);var QXe=class a extends K{static{this.ID="workbench.action.configureEditor"}constructor(){super({id:a.ID,title:L(3589,"Configure Editors"),category:Ve.View})}run(i){i.get(Go).openSettings({jsonEditor:!1,query:"workbench.editor"})}};W(QXe);W(class extends K{constructor(){super({id:"workbench.action.toggleSeparatePinnedEditorTabs",title:L(3696,"Separate Pinned Editor Tabs"),category:Ve.View,precondition:C.equals("config.workbench.editor.showTabs","multiple"),metadata:{description:L(3697,"Toggle whether pinned editor tabs are shown on a separate row above unpinned tabs.")},f1:!0})}run(a){let i=a.get(B),t=!i.getValue("workbench.editor.pinnedTabsOnSeparateRow");return i.updateValue("workbench.editor.pinnedTabsOnSeparateRow",t)}});W(class extends K{constructor(){super({id:"workbench.action.toggleZenMode",title:{...L(3704,"Toggle Zen Mode"),mnemonicTitle:d(3623,null)},precondition:Rw.toNegated(),category:Ve.View,f1:!0,keybinding:{weight:200,primary:Vi(2089,56)},toggled:BC,menu:[{id:D.MenubarAppearanceMenu,group:"1_toggle_view",order:2}]})}run(a){return a.get(yi).toggleZenMode()}});Ct.registerCommandAndKeybindingRule({id:"workbench.action.exitZenMode",weight:-900,handler(a){let i=a.get(yi),e=a.get(X);BC.getValue(e)&&i.toggleZenMode()},when:BC,primary:Vi(9,9)});if(ei||fn||Wt){W(class extends K{constructor(){super({id:"workbench.action.toggleMenuBar",title:{...L(3695,"Toggle Menu Bar"),mnemonicTitle:d(3616,null)},category:Ve.View,f1:!0,toggled:C.and(rk.toNegated(),C.notEquals("config.window.menuBarVisibility","hidden"),C.notEquals("config.window.menuBarVisibility","toggle"),C.notEquals("config.window.menuBarVisibility","compact")),menu:[{id:D.MenubarAppearanceMenu,group:"2_workbench_layout",order:0}]})}run(i){return i.get(yi).toggleMenuBar()}});for(let a of[D.TitleBarContext,D.TitleBarTitleContext])ve.appendMenuItem(a,{command:{id:"workbench.action.toggleMenuBar",title:d(3617,null),toggled:C.and(rk.toNegated(),C.notEquals("config.window.menuBarVisibility","hidden"),C.notEquals("config.window.menuBarVisibility","toggle"),C.notEquals("config.window.menuBarVisibility","compact"))},when:C.and(Rw.toNegated(),C.notEquals(GX.key,"native"),eA.negate()),group:"2_config",order:0})}W(class extends K{constructor(){super({id:"workbench.action.resetViewLocations",title:L(3666,"Reset View Locations"),category:Ve.View,f1:!0})}run(a){return a.get(Bi).reset()}});W(class extends K{constructor(){super({id:"workbench.action.moveView",title:L(3645,"Move View"),category:Ve.View,f1:!0})}async run(a){let i=a.get(Bi),e=a.get(F),t=a.get(Ue),o=a.get(X),n=a.get(us),r=ql.getValue(o),s;r&&i.getViewDescriptorById(r)?.canMoveView&&(s=r);try{if(s=await this.getView(t,i,n,s),!s)return;let l=new XOt;e.invokeFunction(c=>l.run(c,s))}catch{}}getViewItems(a,i){let e=[];return i.getVisiblePaneCompositeIds(0).forEach(r=>{let s=a.getViewContainerById(r),l=a.getViewContainerModel(s),c=!1;l.visibleViewDescriptors.forEach(u=>{u.canMoveView&&(c||(e.push({type:"separator",label:d(3686,null,l.title)}),c=!0),e.push({id:u.id,label:u.name.value}))})}),i.getPinnedPaneCompositeIds(1).forEach(r=>{let s=a.getViewContainerById(r),l=a.getViewContainerModel(s),c=!1;l.visibleViewDescriptors.forEach(u=>{u.canMoveView&&(c||(e.push({type:"separator",label:d(3654,null,l.title)}),c=!0),e.push({id:u.id,label:u.name.value}))})}),i.getPinnedPaneCompositeIds(2).forEach(r=>{let s=a.getViewContainerById(r),l=a.getViewContainerModel(s),c=!1;l.visibleViewDescriptors.forEach(u=>{u.canMoveView&&(c||(e.push({type:"separator",label:d(3671,null,l.title)}),c=!0),e.push({id:u.id,label:u.name.value}))})}),e}async getView(a,i,e,t){let o=new N,n=o.add(a.createQuickPick({useSeparators:!0}));return n.placeholder=d(3639,null),n.items=this.getViewItems(i,e),n.selectedItems=n.items.filter(r=>r.id===t),new Promise((r,s)=>{o.add(n.onDidAccept(()=>{let l=n.selectedItems[0];l.id?r(l.id):s(),n.hide()})),o.add(n.onDidHide(()=>{o.dispose(),s()})),n.show()})}});var XOt=class extends K{constructor(){super({id:"workbench.action.moveFocusedView",title:L(3632,"Move Focused View"),category:Ve.View,precondition:ql.notEqualsTo(""),f1:!0})}run(i,e){let t=i.get(Bi),o=i.get($t),n=i.get(Ue),r=i.get(X),s=i.get(at),l=i.get(us),c=e||ql.getValue(r);if(c===void 0||c.trim()===""){s.error(d(3633,null));return}let u=t.getViewDescriptorById(c);if(!u?.canMoveView){s.error(d(3634,null));return}let p=new N,h=p.add(n.createQuickPick({useSeparators:!0}));h.placeholder=d(3638,null),h.title=d(3640,null,u.name.value);let g=[],f=t.getViewContainerByViewId(c),v=t.getViewLocationById(c),b=t.getViewContainerModel(f).allViewDescriptors.length===1;b&&v===1||g.push({id:"_.panel.newcontainer",label:d(3635,null)}),b&&v===0||g.push({id:"_.sidebar.newcontainer",label:d(3636,null)}),b&&v===2||g.push({id:"_.auxiliarybar.newcontainer",label:d(3637,null)}),g.push({type:"separator",label:d(3684,null)});let S=l.getVisiblePaneCompositeIds(0);g.push(...S.filter(k=>k===t.getViewContainerByViewId(c).id?!1:!t.getViewContainerById(k).rejectAddedViews).map(k=>({id:k,label:t.getViewContainerModel(t.getViewContainerById(k)).title}))),g.push({type:"separator",label:d(3647,null)});let y=l.getPinnedPaneCompositeIds(1);g.push(...y.filter(k=>k===t.getViewContainerByViewId(c).id?!1:!t.getViewContainerById(k).rejectAddedViews).map(k=>({id:k,label:t.getViewContainerModel(t.getViewContainerById(k)).title}))),g.push({type:"separator",label:d(3670,null)});let w=l.getPinnedPaneCompositeIds(2);g.push(...w.filter(k=>k===t.getViewContainerByViewId(c).id?!1:!t.getViewContainerById(k).rejectAddedViews).map(k=>({id:k,label:t.getViewContainerModel(t.getViewContainerById(k)).title}))),h.items=g,p.add(h.onDidAccept(()=>{let k=h.selectedItems[0];k.id==="_.panel.newcontainer"?(t.moveViewToLocation(u,1,this.desc.id),o.openView(c,!0)):k.id==="_.sidebar.newcontainer"?(t.moveViewToLocation(u,0,this.desc.id),o.openView(c,!0)):k.id==="_.auxiliarybar.newcontainer"?(t.moveViewToLocation(u,2,this.desc.id),o.openView(c,!0)):k.id&&(t.moveViewsToContainer([u],t.getViewContainerById(k.id),void 0,this.desc.id),o.openView(c,!0)),h.hide()})),p.add(h.onDidHide(()=>p.dispose())),h.show()}};W(XOt);W(class extends K{constructor(){super({id:"workbench.action.resetFocusedViewLocation",title:L(3665,"Reset Focused View Location"),category:Ve.View,f1:!0,precondition:ql.notEqualsTo("")})}run(a){let i=a.get(Bi),e=a.get(X),t=a.get(at),o=a.get($t),n=ql.getValue(e),r=null;if(n!==void 0&&n.trim()!==""&&(r=i.getViewDescriptorById(n)),!r){t.error(d(3664,null));return}let s=i.getDefaultContainerById(r.id);!s||s===i.getViewContainerByViewId(r.id)||(i.moveViewsToContainer([r],s,void 0,this.desc.id),o.openView(r.id,!0))}});var ET=class extends K{static{this.RESIZE_INCREMENT=60}resizePart(i,e,t,o){if(t.activeContainer!==t.mainContainer)return;let n;if(o===void 0){let r=t.hasFocus("workbench.parts.editor"),s=t.hasFocus("workbench.parts.sidebar"),l=t.hasFocus("workbench.parts.panel"),c=t.hasFocus("workbench.parts.auxiliarybar");s?n="workbench.parts.sidebar":l?n="workbench.parts.panel":r?n="workbench.parts.editor":c&&(n="workbench.parts.auxiliarybar")}else n=o;n&&t.resizePart(n,i,e)}},BIi=class extends ET{constructor(){super({id:"workbench.action.increaseViewSize",title:L(3608,"Increase Current View Size"),f1:!0,precondition:Rw.toNegated()})}run(i){this.resizePart(ET.RESIZE_INCREMENT,ET.RESIZE_INCREMENT,i.get(yi))}},HIi=class extends ET{constructor(){super({id:"workbench.action.increaseViewWidth",title:L(3607,"Increase Editor Width"),f1:!0,precondition:Rw.toNegated()})}run(i){this.resizePart(ET.RESIZE_INCREMENT,0,i.get(yi),"workbench.parts.editor")}},UIi=class extends ET{constructor(){super({id:"workbench.action.increaseViewHeight",title:L(3606,"Increase Editor Height"),f1:!0,precondition:Rw.toNegated()})}run(i){this.resizePart(0,ET.RESIZE_INCREMENT,i.get(yi),"workbench.parts.editor")}},zIi=class extends ET{constructor(){super({id:"workbench.action.decreaseViewSize",title:L(3596,"Decrease Current View Size"),f1:!0,precondition:Rw.toNegated()})}run(i){this.resizePart(-ET.RESIZE_INCREMENT,-ET.RESIZE_INCREMENT,i.get(yi))}},KIi=class extends ET{constructor(){super({id:"workbench.action.decreaseViewWidth",title:L(3595,"Decrease Editor Width"),f1:!0,precondition:Rw.toNegated()})}run(i){this.resizePart(-ET.RESIZE_INCREMENT,0,i.get(yi),"workbench.parts.editor")}},GIi=class extends ET{constructor(){super({id:"workbench.action.decreaseViewHeight",title:L(3594,"Decrease Editor Height"),f1:!0,precondition:Rw.toNegated()})}run(i){this.resizePart(0,-ET.RESIZE_INCREMENT,i.get(yi),"workbench.parts.editor")}};W(BIi);W(HIi);W(UIi);W(zIi);W(KIi);W(GIi);W(class extends K{constructor(){super({id:"workbench.action.alignQuickInputTop",title:L(3581,"Align Quick Input Top"),f1:!1})}run(i){i.get(Ue).setAlignment("top")}});W(class extends K{constructor(){super({id:"workbench.action.alignQuickInputCenter",title:L(3580,"Align Quick Input Center"),f1:!1})}run(i){i.get(Ue).setAlignment("center")}});function vQo(a){return a.iconA!==void 0}var cLe=(a,i,e,t)=>({id:a,active:i,label:e,visualIcon:t,activeIcon:R.eye,inactiveIcon:R.eyeClosed,activeAriaLabel:d(3672,null),inactiveAriaLabel:d(3673,null),useButtons:!0}),sH=(a,i,e,t)=>({id:a,active:i,label:e,visualIcon:t,activeIcon:R.check,activeAriaLabel:d(3576,null),useButtons:!1}),bQo=C.and(rk.toNegated(),C.notEquals("config.window.menuBarVisibility","hidden"),C.notEquals("config.window.menuBarVisibility","toggle"),C.notEquals("config.window.menuBarVisibility","compact")),JOt=[];(!Ze||!Vr)&&JOt.push(cLe("workbench.action.toggleMenuBar",bQo,d(3613,null),tQo));JOt.push(cLe($Ii,C.notEquals("config.workbench.activityBar.location","hidden"),d(3577,null),{whenA:C.equals("config.workbench.sideBar.location","left"),iconA:iQo,iconB:oQo}),cLe(aH.ID,tA,d(3685,null),{whenA:C.equals("config.workbench.sideBar.location","left"),iconA:qOt,iconB:$Ot}),cLe(g0.ID,iA,d(3670,null),{whenA:C.equals("config.workbench.sideBar.location","left"),iconA:$Ot,iconB:qOt}),cLe(D2.ID,$X,d(3647,null),sQo),cLe(Mpe.ID,C.equals("config.workbench.statusBar.visible",!0),d(3690,null),aQo));var Vao=[sH(YOt.ID,C.equals("config.workbench.sideBar.location","left"),d(3612,null),qOt),sH(QOt.ID,C.equals("config.workbench.sideBar.location","right"),d(3669,null),$Ot)],Bao=[sH("workbench.action.alignPanelLeft",TB.isEqualTo("left"),d(3611,null),lQo),sH("workbench.action.alignPanelRight",TB.isEqualTo("right"),d(3668,null),cQo),sH("workbench.action.alignPanelCenter",TB.isEqualTo("center"),d(3585,null),dQo),sH("workbench.action.alignPanelJustify",TB.isEqualTo("justify"),d(3609,null),uQo)],Hao=[sH("workbench.action.alignQuickInputTop",WXe.isEqualTo("top"),d(3705,null),pQo),sH("workbench.action.alignQuickInputCenter",WXe.isEqualTo("center"),d(3582,null),mQo)],Uao=[sH("workbench.action.toggleFullScreen",eA,d(3598,null),hQo),sH("workbench.action.toggleZenMode",BC,d(3706,null),fQo),sH("workbench.action.toggleCenteredLayout",_6e,d(3583,null),gQo)],zao=new Set;for(let{active:a}of[...JOt,...Vao,...Bao,...Hao,...Uao])for(let i of a.keys())zao.add(i);W(class extends K{constructor(){super({id:"workbench.action.customizeLayout",title:L(3592,"Customize Layout..."),f1:!0,icon:Wao,menu:[{id:D.LayoutControlMenuSubmenu,group:"z_end"},{id:D.LayoutControlMenu,when:C.and(Cb.toNegated(),C.equals("config.workbench.layoutControl.type","both")),group:"1_layout"}]})}getItems(i,e){let t=o=>{let n=o.active.evaluate(i.getContext(null)),r=o.useButtons?o.label:o.label+(n&&o.activeIcon?` $(${o.activeIcon.id})`:!n&&o.inactiveIcon?` $(${o.inactiveIcon.id})`:""),s=o.label+(n&&o.activeAriaLabel?` (${o.activeAriaLabel})`:!n&&o.inactiveAriaLabel?` (${o.inactiveAriaLabel})`:"");if(o.visualIcon){let c=o.visualIcon;vQo(c)&&(c=c.whenA.evaluate(i.getContext(null))?c.iconA:c.iconB),r=`$(${c.id}) ${r}`}let l=n?o.activeIcon:o.inactiveIcon;return{type:"item",id:o.id,label:r,ariaLabel:s,keybinding:e.lookupKeybinding(o.id,i),buttons:o.useButtons?[{alwaysVisible:!1,tooltip:s,iconClass:l?q.asClassName(l):void 0}]:void 0}};return[{type:"separator",label:d(3703,null)},...JOt.map(t),{type:"separator",label:d(3688,null)},...Vao.map(t),{type:"separator",label:d(3648,null)},...Bao.map(t),{type:"separator",label:d(3663,null)},...Hao.map(t),{type:"separator",label:d(3610,null)},...Uao.map(t)]}run(i){if(this._currentQuickPick){this._currentQuickPick.hide();return}let e=i.get(B),t=i.get(X),o=i.get(ge),n=i.get(Ue),r=i.get(_e),s=new N,l=s.add(n.createQuickPick({useSeparators:!0}));this._currentQuickPick=l,l.items=this.getItems(t,r),l.ignoreFocusOut=!0,l.hideInput=!0,l.title=d(3593,null);let c={alwaysVisible:!0,iconClass:q.asClassName(R.close),tooltip:d(3586,null)},u={alwaysVisible:!0,iconClass:q.asClassName(R.discard),tooltip:d(3667,null)};l.buttons=[u,c];let p;s.add(t.onDidChangeContext(h=>{h.affectsSome(zao)&&(l.items=this.getItems(t,r),p&&(l.activeItems=l.items.filter(g=>g.id===p?.id)),setTimeout(()=>n.focus(),0))})),s.add(l.onDidAccept(h=>{l.selectedItems.length&&(p=l.selectedItems[0],o.executeCommand(p.id))})),s.add(l.onDidTriggerItemButton(h=>{h.item&&(p=h.item,o.executeCommand(p.id))})),s.add(l.onDidTriggerButton(h=>{if(h===c)l.hide();else if(h===u){let g=f=>{let v=e.inspect(f);e.updateValue(f,v.defaultValue)};g("workbench.activityBar.location"),g("workbench.sideBar.location"),g("workbench.statusBar.visible"),g("workbench.panel.defaultLocation"),(!Ze||!Vr)&&g("window.menuBarVisibility"),o.executeCommand("workbench.action.alignPanelCenter"),o.executeCommand("workbench.action.alignQuickInputTop")}})),s.add(l.onDidHide(()=>{l.dispose()})),s.add(l.onDispose(()=>{this._currentQuickPick=void 0,s.dispose()})),l.show()}});function jIi(a){let i=a?.getHTMLElement();i&&!wa(i)&&a?.domFocus()}async function SQo(a,i){if(!Lce.getValue(a.contextKeyService))return i(a);let e=a.getFocus(),t=a.getSelection();await i(a);let o=a.getFocus();if(t.length>1||!$i(e,t)||$i(e,o))return;let n=new KeyboardEvent("keydown");a.setSelection(o,n)}async function nM(a,i){if(!a)return;await SQo(a,i);let e=a.getFocus();e.length&&a.reveal(e[0]),a.setAnchor(e[0]),jIi(a)}Ct.registerCommandAndKeybindingRule({id:"list.focusDown",weight:200,when:vc,primary:18,mac:{primary:18,secondary:[300]},handler:(a,i)=>{nM(a.get(Io).lastFocusedList,async e=>{let t=new KeyboardEvent("keydown");await e.focusNext(typeof i=="number"?i:1,!1,t)})}});Ct.registerCommandAndKeybindingRule({id:"list.focusUp",weight:200,when:vc,primary:16,mac:{primary:16,secondary:[302]},handler:(a,i)=>{nM(a.get(Io).lastFocusedList,async e=>{let t=new KeyboardEvent("keydown");await e.focusPrevious(typeof i=="number"?i:1,!1,t)})}});Ct.registerCommandAndKeybindingRule({id:"list.focusAnyDown",weight:200,when:vc,primary:530,mac:{primary:530,secondary:[812]},handler:(a,i)=>{nM(a.get(Io).lastFocusedList,async e=>{let t=new KeyboardEvent("keydown",{altKey:!0});await e.focusNext(typeof i=="number"?i:1,!1,t)})}});Ct.registerCommandAndKeybindingRule({id:"list.focusAnyUp",weight:200,when:vc,primary:528,mac:{primary:528,secondary:[814]},handler:(a,i)=>{nM(a.get(Io).lastFocusedList,async e=>{let t=new KeyboardEvent("keydown",{altKey:!0});await e.focusPrevious(typeof i=="number"?i:1,!1,t)})}});Ct.registerCommandAndKeybindingRule({id:"list.focusPageDown",weight:200,when:vc,primary:12,handler:a=>{nM(a.get(Io).lastFocusedList,async i=>{let e=new KeyboardEvent("keydown");await i.focusNextPage(e)})}});Ct.registerCommandAndKeybindingRule({id:"list.focusPageUp",weight:200,when:vc,primary:11,handler:a=>{nM(a.get(Io).lastFocusedList,async i=>{let e=new KeyboardEvent("keydown");await i.focusPreviousPage(e)})}});Ct.registerCommandAndKeybindingRule({id:"list.focusFirst",weight:200,when:vc,primary:14,handler:a=>{nM(a.get(Io).lastFocusedList,async i=>{let e=new KeyboardEvent("keydown");await i.focusFirst(e)})}});Ct.registerCommandAndKeybindingRule({id:"list.focusLast",weight:200,when:vc,primary:13,handler:a=>{nM(a.get(Io).lastFocusedList,async i=>{let e=new KeyboardEvent("keydown");await i.focusLast(e)})}});Ct.registerCommandAndKeybindingRule({id:"list.focusAnyFirst",weight:200,when:vc,primary:526,handler:a=>{nM(a.get(Io).lastFocusedList,async i=>{let e=new KeyboardEvent("keydown",{altKey:!0});await i.focusFirst(e)})}});Ct.registerCommandAndKeybindingRule({id:"list.focusAnyLast",weight:200,when:vc,primary:525,handler:a=>{nM(a.get(Io).lastFocusedList,async i=>{let e=new KeyboardEvent("keydown",{altKey:!0});await i.focusLast(e)})}});function Kao(a,i){if(a instanceof Cc||a instanceof qz||a instanceof iF){let e=a,t=e.getFocus()?e.getFocus()[0]:void 0,o=e.getSelection();o&&typeof t=="number"&&o.indexOf(t)>=0?e.setSelection(o.filter(n=>n!==i)):typeof t=="number"&&e.setSelection(o.concat(t))}else if(a instanceof yw||a instanceof qE||a instanceof Tv){let e=a,t=e.getFocus()?e.getFocus()[0]:void 0;if(i===t)return;let o=e.getSelection(),n=new KeyboardEvent("keydown",{shiftKey:!0});o&&o.indexOf(t)>=0?e.setSelection(o.filter(r=>r!==i),n):e.setSelection(o.concat(t),n)}}function QIi(a,i){let e=a.getStickyScrollFocus();if(e.length===0)throw new Error("StickyScroll has no focus");if(e.length>1)throw new Error("StickyScroll can only have a single focused item");a.reveal(e[0]),a.getHTMLElement().focus(),a.setFocus(e),i?.(e[0])}Ct.registerCommandAndKeybindingRule({id:"list.expandSelectionDown",weight:200,when:C.and(vc,GY),primary:1042,handler:(a,i)=>{let e=a.get(Io).lastFocusedList;if(!e)return;let t=e.getFocus()?e.getFocus()[0]:void 0,o=new KeyboardEvent("keydown");e.focusNext(typeof i=="number"?i:1,!1,o),Kao(e,t);let n=e.getFocus();n.length&&e.reveal(n[0]),jIi(e)}});Ct.registerCommandAndKeybindingRule({id:"list.expandSelectionUp",weight:200,when:C.and(vc,GY),primary:1040,handler:(a,i)=>{let e=a.get(Io).lastFocusedList;if(!e)return;let t=e.getFocus()?e.getFocus()[0]:void 0,o=new KeyboardEvent("keydown");e.focusPrevious(typeof i=="number"?i:1,!1,o),Kao(e,t);let n=e.getFocus();n.length&&e.reveal(n[0]),jIi(e)}});Ct.registerCommandAndKeybindingRule({id:"list.collapse",weight:200,when:C.and(vc,C.or(Fxe,lli)),primary:15,mac:{primary:15,secondary:[2064]},handler:a=>{let i=a.get(Io).lastFocusedList;if(!i||!(i instanceof yw||i instanceof qE||i instanceof Tv))return;let e=i,t=e.getFocus();if(t.length===0)return;let o=t[0];if(!e.collapse(o)){let n=e.getParentElement(o);n&&nM(i,r=>{let s=new KeyboardEvent("keydown");r.setFocus([n],s)})}}});Ct.registerCommandAndKeybindingRule({id:"list.stickyScroll.collapse",weight:250,when:Oxe,primary:15,mac:{primary:15,secondary:[2064]},handler:a=>{let i=a.get(Io).lastFocusedList;!i||!(i instanceof yw||i instanceof qE||i instanceof Tv)||QIi(i,e=>i.collapse(e))}});Ct.registerCommandAndKeybindingRule({id:"list.collapseAll",weight:200,when:vc,primary:2063,mac:{primary:2063,secondary:[3088]},handler:a=>{let i=a.get(Io).lastFocusedList;i&&!(i instanceof Cc||i instanceof qz||i instanceof iF)&&i.collapseAll()}});Ct.registerCommandAndKeybindingRule({id:"list.collapseAllToFocus",weight:200,when:vc,handler:a=>{let i=a.get(Io).lastFocusedList,e=$E("keydown",!0);if(i instanceof yw||i instanceof qE||i instanceof Tv){let t=i,o=t.getFocus();o.length>0&&t.collapse(o[0],!0),t.setSelection(o,e),t.setAnchor(o[0])}}});Ct.registerCommandAndKeybindingRule({id:"list.focusParent",weight:200,when:vc,handler:a=>{let i=a.get(Io).lastFocusedList;if(!i||!(i instanceof yw||i instanceof qE||i instanceof Tv))return;let e=i,t=e.getFocus();if(t.length===0)return;let o=t[0],n=e.getParentElement(o);n&&nM(i,r=>{let s=new KeyboardEvent("keydown");r.setFocus([n],s)})}});Ct.registerCommandAndKeybindingRule({id:"list.expand",weight:200,when:C.and(vc,C.or(Wxe,cli)),primary:17,handler:a=>{let i=a.get(Io).lastFocusedList;if(i){if(i instanceof yw||i instanceof qE){let e=i.getFocus();if(e.length===0)return;let t=e[0];if(!i.expand(t)){let o=i.getFirstElementChild(t);o&&i.getNode(o).visible&&nM(i,r=>{let s=new KeyboardEvent("keydown");r.setFocus([o],s)})}}else if(i instanceof Tv){let e=i.getFocus();if(e.length===0)return;let t=e[0];i.expand(t).then(o=>{if(t&&!o){let n=i.getFirstElementChild(t);n&&i.getNode(n).visible&&nM(i,s=>{let l=new KeyboardEvent("keydown");s.setFocus([n],l)})}})}}}});function YIi(a,i){let e=a.get(Io).lastFocusedList,t=$E("keydown",i);if(e instanceof Cc||e instanceof qz||e instanceof iF){let o=e;o.setAnchor(o.getFocus()[0]),o.setSelection(o.getFocus(),t)}else if(e instanceof yw||e instanceof qE||e instanceof Tv){let o=e,n=o.getFocus();if(n.length>0){let r=!0;(o.expandOnlyOnTwistieClick===!0||typeof o.expandOnlyOnTwistieClick!="boolean"&&o.expandOnlyOnTwistieClick(n[0]))&&(r=!1),r&&o.toggleCollapsed(n[0])}o.setAnchor(n[0]),o.setSelection(n,t)}}Ct.registerCommandAndKeybindingRule({id:"list.select",weight:200,when:vc,primary:3,mac:{primary:3,secondary:[2066]},handler:a=>{YIi(a,!1)}});Ct.registerCommandAndKeybindingRule({id:"list.stickyScrollselect",weight:250,when:Oxe,primary:3,mac:{primary:3,secondary:[2066]},handler:a=>{let i=a.get(Io).lastFocusedList;!i||!(i instanceof yw||i instanceof qE||i instanceof Tv)||QIi(i,e=>i.setSelection([e]))}});Ct.registerCommandAndKeybindingRule({id:"list.selectAndPreserveFocus",weight:200,when:vc,handler:a=>{YIi(a,!0)}});Ct.registerCommandAndKeybindingRule({id:"list.selectAll",weight:200,when:C.and(vc,GY),primary:2079,handler:a=>{let i=a.get(Io).lastFocusedList;if(i instanceof Cc||i instanceof qz||i instanceof iF){let e=i,t=new KeyboardEvent("keydown");e.setSelection(Ig(e.length),t)}else if(i instanceof yw||i instanceof qE||i instanceof Tv){let e=i,t=e.getFocus(),o=e.getSelection(),n;t.length>0&&(o.length===0||!o.includes(t[0]))&&(n=t[0]),!n&&o.length>0&&(n=o[0]);let r;n?r=e.getParentElement(n):r=void 0;let s=[],l=u=>{for(let p of u.children)p.visible&&(s.push(p.element),p.collapsed||l(p))};l(e.getNode(r)),r&&o.length===s.length&&s.unshift(r);let c=new KeyboardEvent("keydown");e.setSelection(s,c)}}});Ct.registerCommandAndKeybindingRule({id:"list.toggleSelection",weight:200,when:vc,primary:3075,handler:a=>{let i=a.get(Io).lastFocusedList;if(!i)return;let e=i.getFocus();if(e.length===0)return;let t=i.getSelection(),o=t.indexOf(e[0]);o>-1?i.setSelection([...t.slice(0,o),...t.slice(o+1)]):i.setSelection([...t,e[0]])}});Ct.registerCommandAndKeybindingRule({id:"list.showHover",weight:200,primary:Vi(2089,2087),when:vc,handler:async a=>{let e=a.get(Io).lastFocusedList;if(!e)return;let t=e.getFocus();if(!t||t.length===0)return;let s=e.getHTMLElement().querySelector(".monaco-scrollable-element")?.querySelector(".monaco-list-rows")?.querySelector(".focused");if(!s)return;let l=IQo(s);l&&a.get(nt).showManagedHover(l)}});function IQo(a){if(a.matches('[custom-hover="true"]'))return a;let i=a.querySelector('[custom-hover="true"]:not([tabindex]):not(.action-item)');if(i)return i}Ct.registerCommandAndKeybindingRule({id:"list.toggleExpand",weight:200,when:vc,primary:10,handler:a=>{let i=a.get(Io).lastFocusedList;if(i instanceof yw||i instanceof qE||i instanceof Tv){let e=i,t=e.getFocus();if(!e.options.disableExpandOnSpacebar&&t.length>0&&e.isCollapsible(t[0])){e.toggleCollapsed(t[0]);return}}YIi(a,!0)}});Ct.registerCommandAndKeybindingRule({id:"list.stickyScrolltoggleExpand",weight:250,when:Oxe,primary:10,handler:a=>{let i=a.get(Io).lastFocusedList;!i||!(i instanceof yw||i instanceof qE||i instanceof Tv)||QIi(i)}});Ct.registerCommandAndKeybindingRule({id:"list.clear",weight:200,when:C.and(vc,A3e),primary:9,handler:a=>{let i=a.get(Io).lastFocusedList;if(!i)return;let e=i.getSelection(),t=new KeyboardEvent("keydown");if(e.length>1)if(Lce.getValue(i.contextKeyService)){let n=i.getFocus();i.setSelection([n[0]],t)}else i.setSelection([],t);else i.setSelection([],t),i.setFocus([],t);i.setAnchor(void 0)}});$e.registerCommand({id:"list.triggerTypeNavigation",handler:a=>{a.get(Io).lastFocusedList?.triggerTypeNavigation()}});$e.registerCommand({id:"list.toggleFindMode",handler:a=>{let i=a.get(Io).lastFocusedList;if(i instanceof ZV||i instanceof Tv){let e=i;e.findMode=e.findMode===1?0:1}}});$e.registerCommand({id:"list.toggleFindMatchType",handler:a=>{let i=a.get(Io).lastFocusedList;if(i instanceof ZV||i instanceof Tv){let e=i;e.findMatchType=e.findMatchType===1?0:1}}});$e.registerCommandAlias("list.toggleKeyboardNavigation","list.triggerTypeNavigation");$e.registerCommandAlias("list.toggleFilterOnType","list.toggleFindMode");Ct.registerCommandAndKeybindingRule({id:"list.find",weight:200,when:C.and(P3e,ali),primary:2596,secondary:[61],handler:a=>{let i=a.get(Io).lastFocusedList;i instanceof Cc||i instanceof qz||i instanceof iF||(i instanceof ZV||i instanceof Tv)&&i.openFind()}});Ct.registerCommandAndKeybindingRule({id:"list.closeFind",weight:200,when:C.and(P3e,dli),primary:9,handler:a=>{let i=a.get(Io).lastFocusedList;(i instanceof ZV||i instanceof Tv)&&i.closeFind()}});Ct.registerCommandAndKeybindingRule({id:"list.scrollUp",weight:200,when:C.and(vc,mxt?.negate()),primary:2064,handler:a=>{let i=a.get(Io).lastFocusedList;i&&(i.scrollTop-=10)}});Ct.registerCommandAndKeybindingRule({id:"list.scrollDown",weight:200,when:C.and(vc,hxt?.negate()),primary:2066,handler:a=>{let i=a.get(Io).lastFocusedList;i&&(i.scrollTop+=10)}});Ct.registerCommandAndKeybindingRule({id:"list.scrollLeft",weight:200,when:vc,handler:a=>{let i=a.get(Io).lastFocusedList;i&&(i.scrollLeft-=10)}});Ct.registerCommandAndKeybindingRule({id:"list.scrollRight",weight:200,when:vc,handler:a=>{let i=a.get(Io).lastFocusedList;i&&(i.scrollLeft+=10)}});W(class extends K{constructor(){super({id:"tree.toggleStickyScroll",title:{...L(3709,"Toggle Tree Sticky Scroll"),mnemonicTitle:d(3708,null)},category:"View",metadata:{description:d(3710,null)},f1:!0})}run(i){let e=i.get(B),t=!e.getValue("workbench.tree.enableStickyScroll");e.updateValue("workbench.tree.enableStickyScroll",t)}});var yQo={separatorBorder:We.transparent};function AA(a){return a===0?1:0}var XIi=class{constructor(i){this.isLayoutEnabled=i}};function wQo(a,i){return i===1?{left:a.start,right:a.end,top:a.orthogonalStart,bottom:a.orthogonalEnd}:{top:a.start,bottom:a.end,left:a.orthogonalStart,right:a.orthogonalEnd}}function CQo(a,i){return i===1?{start:a.left,end:a.right,orthogonalStart:a.top,orthogonalEnd:a.bottom}:{start:a.top,end:a.bottom,orthogonalStart:a.left,orthogonalEnd:a.right}}function lH(a,i){if(Math.abs(a)>i)throw new Error("Invalid index");return bV(a,i+1)}var Nb=class a{constructor(i,e,t,o,n=0,r=0,s=!1,l){this.orientation=i;this.layoutController=e;this.splitviewProportionalLayout=o;this.children=[];this._absoluteOffset=0;this._absoluteOrthogonalOffset=0;this.absoluteOrthogonalSize=0;this._onDidChange=new E;this.onDidChange=this._onDidChange.event;this._onDidVisibilityChange=new E;this.onDidVisibilityChange=this._onDidVisibilityChange.event;this.childrenVisibilityChangeDisposable=new N;this._onDidScroll=new E;this.onDidScrollDisposable=x.None;this.onDidScroll=this._onDidScroll.event;this.childrenChangeDisposable=x.None;this._onDidSashReset=new E;this.onDidSashReset=this._onDidSashReset.event;this.splitviewSashResetDisposable=x.None;this.childrenSashResetDisposable=x.None;this._boundarySashes={};this._edgeSnapping=!1;if(this._styles=t,this._size=n,this._orthogonalSize=r,this.element=_(".monaco-grid-branch-node"),!l)this.splitview=new Ou(this.element,{orientation:i,styles:t,proportionalLayout:o}),this.splitview.layout(n,{orthogonalSize:r,absoluteOffset:0,absoluteOrthogonalOffset:0,absoluteSize:n,absoluteOrthogonalSize:r});else{let u={views:l.map(h=>({view:h.node,size:h.node.size,visible:h.visible!==!1})),size:this.orthogonalSize},p={proportionalLayout:o,orientation:i,styles:t};this.children=l.map(h=>h.node),this.splitview=new Ou(this.element,{...p,descriptor:u}),this.children.forEach((h,g)=>{let f=g===0,v=g===this.children.length;h.boundarySashes={start:this.boundarySashes.orthogonalStart,end:this.boundarySashes.orthogonalEnd,orthogonalStart:f?this.boundarySashes.start:this.splitview.sashes[g-1],orthogonalEnd:v?this.boundarySashes.end:this.splitview.sashes[g]}})}let c=U.map(this.splitview.onDidSashReset,u=>[u]);this.splitviewSashResetDisposable=c(this._onDidSashReset.fire,this._onDidSashReset),this.updateChildrenEvents()}get size(){return this._size}get orthogonalSize(){return this._orthogonalSize}get absoluteOffset(){return this._absoluteOffset}get absoluteOrthogonalOffset(){return this._absoluteOrthogonalOffset}get styles(){return this._styles}get width(){return this.orientation===1?this.size:this.orthogonalSize}get height(){return this.orientation===1?this.orthogonalSize:this.size}get top(){return this.orientation===1?this._absoluteOffset:this._absoluteOrthogonalOffset}get left(){return this.orientation===1?this._absoluteOrthogonalOffset:this._absoluteOffset}get minimumSize(){return this.children.length===0?0:Math.max(...this.children.map((i,e)=>this.splitview.isViewVisible(e)?i.minimumOrthogonalSize:0))}get maximumSize(){return Math.min(...this.children.map((i,e)=>this.splitview.isViewVisible(e)?i.maximumOrthogonalSize:Number.POSITIVE_INFINITY))}get priority(){if(this.children.length===0)return 0;let i=this.children.map(e=>typeof e.priority>"u"?0:e.priority);return i.some(e=>e===2)?2:i.some(e=>e===1)?1:0}get proportionalLayout(){return this.children.length===0?!0:this.children.every(i=>i.proportionalLayout)}get minimumOrthogonalSize(){return this.splitview.minimumSize}get maximumOrthogonalSize(){return this.splitview.maximumSize}get minimumWidth(){return this.orientation===1?this.minimumOrthogonalSize:this.minimumSize}get minimumHeight(){return this.orientation===1?this.minimumSize:this.minimumOrthogonalSize}get maximumWidth(){return this.orientation===1?this.maximumOrthogonalSize:this.maximumSize}get maximumHeight(){return this.orientation===1?this.maximumSize:this.maximumOrthogonalSize}get boundarySashes(){return this._boundarySashes}set boundarySashes(i){if(!(this._boundarySashes.start===i.start&&this._boundarySashes.end===i.end&&this._boundarySashes.orthogonalStart===i.orthogonalStart&&this._boundarySashes.orthogonalEnd===i.orthogonalEnd)){this._boundarySashes=i,this.splitview.orthogonalStartSash=i.orthogonalStart,this.splitview.orthogonalEndSash=i.orthogonalEnd;for(let e=0;e<this.children.length;e++){let t=this.children[e],o=e===0,n=e===this.children.length-1;t.boundarySashes={start:i.orthogonalStart,end:i.orthogonalEnd,orthogonalStart:o?i.start:t.boundarySashes.orthogonalStart,orthogonalEnd:n?i.end:t.boundarySashes.orthogonalEnd}}}}get edgeSnapping(){return this._edgeSnapping}set edgeSnapping(i){if(this._edgeSnapping!==i){this._edgeSnapping=i;for(let e of this.children)e instanceof a&&(e.edgeSnapping=i);this.updateSplitviewEdgeSnappingEnablement()}}style(i){this._styles=i,this.splitview.style(i);for(let e of this.children)e instanceof a&&e.style(i)}layout(i,e,t){if(this.layoutController.isLayoutEnabled){if(typeof t>"u")throw new Error("Invalid state");this._size=t.orthogonalSize,this._orthogonalSize=i,this._absoluteOffset=t.absoluteOffset+e,this._absoluteOrthogonalOffset=t.absoluteOrthogonalOffset,this.absoluteOrthogonalSize=t.absoluteOrthogonalSize,this.splitview.layout(t.orthogonalSize,{orthogonalSize:i,absoluteOffset:this._absoluteOrthogonalOffset,absoluteOrthogonalOffset:this._absoluteOffset,absoluteSize:t.absoluteOrthogonalSize,absoluteOrthogonalSize:t.absoluteSize}),this.updateSplitviewEdgeSnappingEnablement()}}setVisible(i){for(let e of this.children)e.setVisible(i)}addChild(i,e,t,o){t=lH(t,this.children.length),this.splitview.addView(i,e,t,o),this.children.splice(t,0,i),this.updateBoundarySashes(),this.onDidChildrenChange()}removeChild(i,e){i=lH(i,this.children.length);let t=this.splitview.removeView(i,e);return this.children.splice(i,1),this.updateBoundarySashes(),this.onDidChildrenChange(),t}removeAllChildren(){let i=this.splitview.removeAllViews();return this.children.splice(0,this.children.length),this.updateBoundarySashes(),this.onDidChildrenChange(),i}moveChild(i,e){i=lH(i,this.children.length),e=lH(e,this.children.length),i!==e&&(i<e&&(e-=1),this.splitview.moveView(i,e),this.children.splice(e,0,this.children.splice(i,1)[0]),this.updateBoundarySashes(),this.onDidChildrenChange())}swapChildren(i,e){i=lH(i,this.children.length),e=lH(e,this.children.length),i!==e&&(this.splitview.swapViews(i,e),[this.children[i].boundarySashes,this.children[e].boundarySashes]=[this.children[i].boundarySashes,this.children[e].boundarySashes],[this.children[i],this.children[e]]=[this.children[e],this.children[i]],this.onDidChildrenChange())}resizeChild(i,e){i=lH(i,this.children.length),this.splitview.resizeView(i,e)}isChildExpanded(i){return this.splitview.isViewExpanded(i)}distributeViewSizes(i=!1){if(this.splitview.distributeViewSizes(),i)for(let e of this.children)e instanceof a&&e.distributeViewSizes(!0)}getChildSize(i){return i=lH(i,this.children.length),this.splitview.getViewSize(i)}isChildVisible(i){return i=lH(i,this.children.length),this.splitview.isViewVisible(i)}setChildVisible(i,e){if(i=lH(i,this.children.length),this.splitview.isViewVisible(i)===e)return;let t=this.splitview.contentSize===0;this.splitview.setViewVisible(i,e);let o=this.splitview.contentSize===0;(e&&t||!e&&o)&&this._onDidVisibilityChange.fire(e)}getChildCachedVisibleSize(i){return i=lH(i,this.children.length),this.splitview.getViewCachedVisibleSize(i)}updateBoundarySashes(){for(let i=0;i<this.children.length;i++)this.children[i].boundarySashes={start:this.boundarySashes.orthogonalStart,end:this.boundarySashes.orthogonalEnd,orthogonalStart:i===0?this.boundarySashes.start:this.splitview.sashes[i-1],orthogonalEnd:i===this.children.length-1?this.boundarySashes.end:this.splitview.sashes[i]}}onDidChildrenChange(){this.updateChildrenEvents(),this._onDidChange.fire(void 0)}updateChildrenEvents(){let i=U.map(U.any(...this.children.map(o=>o.onDidChange)),()=>{});this.childrenChangeDisposable.dispose(),this.childrenChangeDisposable=i(this._onDidChange.fire,this._onDidChange);let e=U.any(...this.children.map((o,n)=>U.map(o.onDidSashReset,r=>[n,...r])));this.childrenSashResetDisposable.dispose(),this.childrenSashResetDisposable=e(this._onDidSashReset.fire,this._onDidSashReset);let t=U.any(U.signal(this.splitview.onDidScroll),...this.children.map(o=>o.onDidScroll));this.onDidScrollDisposable.dispose(),this.onDidScrollDisposable=t(this._onDidScroll.fire,this._onDidScroll),this.childrenVisibilityChangeDisposable.clear(),this.children.forEach((o,n)=>{o instanceof a&&this.childrenVisibilityChangeDisposable.add(o.onDidVisibilityChange(r=>{this.setChildVisible(n,r)}))})}trySet2x2(i){if(this.children.length!==2||i.children.length!==2)return x.None;if(this.getChildSize(0)!==i.getChildSize(0))return x.None;let[e,t]=this.children,[o,n]=i.children;if(!(e instanceof Ob)||!(t instanceof Ob))return x.None;if(!(o instanceof Ob)||!(n instanceof Ob))return x.None;this.orientation===0?(t.linkedWidthNode=o.linkedHeightNode=e,e.linkedWidthNode=n.linkedHeightNode=t,n.linkedWidthNode=e.linkedHeightNode=o,o.linkedWidthNode=t.linkedHeightNode=n):(o.linkedWidthNode=t.linkedHeightNode=e,n.linkedWidthNode=e.linkedHeightNode=t,e.linkedWidthNode=n.linkedHeightNode=o,t.linkedWidthNode=o.linkedHeightNode=n);let r=this.splitview.sashes[0],s=i.splitview.sashes[0];return r.linkedSash=s,s.linkedSash=r,this._onDidChange.fire(void 0),i._onDidChange.fire(void 0),Z(()=>{r.linkedSash=s.linkedSash=void 0,e.linkedHeightNode=e.linkedWidthNode=void 0,t.linkedHeightNode=t.linkedWidthNode=void 0,o.linkedHeightNode=o.linkedWidthNode=void 0,n.linkedHeightNode=n.linkedWidthNode=void 0})}updateSplitviewEdgeSnappingEnablement(){this.splitview.startSnappingEnabled=this._edgeSnapping||this._absoluteOrthogonalOffset>0,this.splitview.endSnappingEnabled=this._edgeSnapping||this._absoluteOrthogonalOffset+this._size<this.absoluteOrthogonalSize}dispose(){for(let i of this.children)i.dispose();this._onDidChange.dispose(),this._onDidScroll.dispose(),this._onDidSashReset.dispose(),this._onDidVisibilityChange.dispose(),this.childrenVisibilityChangeDisposable.dispose(),this.splitviewSashResetDisposable.dispose(),this.childrenSashResetDisposable.dispose(),this.childrenChangeDisposable.dispose(),this.onDidScrollDisposable.dispose(),this.splitview.dispose()}};function xQo(a){let[i,e]=U.split(a.onDidChange,gn);return U.any(e,U.map(U.latch(U.map(i,t=>[a.minimumWidth,a.maximumWidth,a.minimumHeight,a.maximumHeight]),$i),t=>{}))}var Ob=class{constructor(i,e,t,o,n=0){this.view=i;this.orientation=e;this.layoutController=t;this._size=0;this.absoluteOffset=0;this.absoluteOrthogonalOffset=0;this.onDidScroll=U.None;this.onDidSashReset=U.None;this._onDidLinkedWidthNodeChange=new Bh;this._linkedWidthNode=void 0;this._onDidLinkedHeightNodeChange=new Bh;this._linkedHeightNode=void 0;this._onDidSetLinkedNode=new E;this.disposables=new N;this._boundarySashes={};this.cachedWidth=0;this.cachedHeight=0;this.cachedTop=0;this.cachedLeft=0;this._orthogonalSize=o,this._size=n;let r=xQo(i);this._onDidViewChange=U.map(r,s=>s&&(this.orientation===0?s.width:s.height),this.disposables),this.onDidChange=U.any(this._onDidViewChange,this._onDidSetLinkedNode.event,this._onDidLinkedWidthNodeChange.event,this._onDidLinkedHeightNodeChange.event)}get size(){return this._size}get orthogonalSize(){return this._orthogonalSize}get linkedWidthNode(){return this._linkedWidthNode}set linkedWidthNode(i){this._onDidLinkedWidthNodeChange.input=i?i._onDidViewChange:U.None,this._linkedWidthNode=i,this._onDidSetLinkedNode.fire(void 0)}get linkedHeightNode(){return this._linkedHeightNode}set linkedHeightNode(i){this._onDidLinkedHeightNodeChange.input=i?i._onDidViewChange:U.None,this._linkedHeightNode=i,this._onDidSetLinkedNode.fire(void 0)}get width(){return this.orientation===1?this.orthogonalSize:this.size}get height(){return this.orientation===1?this.size:this.orthogonalSize}get top(){return this.orientation===1?this.absoluteOffset:this.absoluteOrthogonalOffset}get left(){return this.orientation===1?this.absoluteOrthogonalOffset:this.absoluteOffset}get element(){return this.view.element}get minimumWidth(){return this.linkedWidthNode?Math.max(this.linkedWidthNode.view.minimumWidth,this.view.minimumWidth):this.view.minimumWidth}get maximumWidth(){return this.linkedWidthNode?Math.min(this.linkedWidthNode.view.maximumWidth,this.view.maximumWidth):this.view.maximumWidth}get minimumHeight(){return this.linkedHeightNode?Math.max(this.linkedHeightNode.view.minimumHeight,this.view.minimumHeight):this.view.minimumHeight}get maximumHeight(){return this.linkedHeightNode?Math.min(this.linkedHeightNode.view.maximumHeight,this.view.maximumHeight):this.view.maximumHeight}get minimumSize(){return this.orientation===1?this.minimumHeight:this.minimumWidth}get maximumSize(){return this.orientation===1?this.maximumHeight:this.maximumWidth}get priority(){return this.view.priority}get proportionalLayout(){return this.view.proportionalLayout??!0}get snap(){return this.view.snap}get minimumOrthogonalSize(){return this.orientation===1?this.minimumWidth:this.minimumHeight}get maximumOrthogonalSize(){return this.orientation===1?this.maximumWidth:this.maximumHeight}get boundarySashes(){return this._boundarySashes}set boundarySashes(i){this._boundarySashes=i,this.view.setBoundarySashes?.(wQo(i,this.orientation))}layout(i,e,t){if(this.layoutController.isLayoutEnabled){if(typeof t>"u")throw new Error("Invalid state");this._size=i,this._orthogonalSize=t.orthogonalSize,this.absoluteOffset=t.absoluteOffset+e,this.absoluteOrthogonalOffset=t.absoluteOrthogonalOffset,this._layout(this.width,this.height,this.top,this.left)}}_layout(i,e,t,o){this.cachedWidth===i&&this.cachedHeight===e&&this.cachedTop===t&&this.cachedLeft===o||(this.cachedWidth=i,this.cachedHeight=e,this.cachedTop=t,this.cachedLeft=o,this.view.layout(i,e,t,o))}setVisible(i){this.view.setVisible?.(i)}dispose(){this._onDidSetLinkedNode.dispose(),this.disposables.dispose()}};function Gao(a,i,e){if(a instanceof Nb){let t=new Nb(AA(a.orientation),a.layoutController,a.styles,a.splitviewProportionalLayout,i,e,a.edgeSnapping),o=0;for(let n=a.children.length-1;n>=0;n--){let r=a.children[n],s=r instanceof Nb?r.orthogonalSize:r.size,l=a.size===0?0:Math.round(i*s/a.size);o+=l,n===0&&(l+=i-o),t.addChild(Gao(r,e,l),l,0,!0)}return a.dispose(),t}else{let t=new Ob(a.view,AA(a.orientation),a.layoutController,e);return a.dispose(),t}}var Ppe=class a{constructor(i={}){this.onDidSashResetRelay=new Bh;this._onDidScroll=new Bh;this._onDidChange=new Bh;this._boundarySashes={};this.disposable2x2=x.None;this.onDidSashReset=this.onDidSashResetRelay.event;this.onDidScroll=this._onDidScroll.event;this.onDidChange=this._onDidChange.event;this.maximizedNode=void 0;this._onDidChangeViewMaximized=new E;this.onDidChangeViewMaximized=this._onDidChangeViewMaximized.event;this.element=_(".monaco-grid-view"),this.styles=i.styles||yQo,this.proportionalLayout=typeof i.proportionalLayout<"u"?!!i.proportionalLayout:!0,this.layoutController=new XIi(!1),this.root=new Nb(0,this.layoutController,this.styles,this.proportionalLayout)}get root(){return this._root}set root(i){let e=this._root;e&&(e.element.remove(),e.dispose()),this._root=i,this.element.appendChild(i.element),this.onDidSashResetRelay.input=i.onDidSashReset,this._onDidChange.input=U.map(i.onDidChange,()=>{}),this._onDidScroll.input=i.onDidScroll}get width(){return this.root.width}get height(){return this.root.height}get minimumWidth(){return this.root.minimumWidth}get minimumHeight(){return this.root.minimumHeight}get maximumWidth(){return this.root.maximumHeight}get maximumHeight(){return this.root.maximumHeight}get orientation(){return this._root.orientation}get boundarySashes(){return this._boundarySashes}set orientation(i){if(this._root.orientation===i)return;let{size:e,orthogonalSize:t,absoluteOffset:o,absoluteOrthogonalOffset:n}=this._root;this.root=Gao(this._root,t,e),this.root.layout(e,0,{orthogonalSize:t,absoluteOffset:n,absoluteOrthogonalOffset:o,absoluteSize:e,absoluteOrthogonalSize:t}),this.boundarySashes=this.boundarySashes}set boundarySashes(i){this._boundarySashes=i,this.root.boundarySashes=CQo(i,this.orientation)}set edgeSnapping(i){this.root.edgeSnapping=i}style(i){this.styles=i,this.root.style(i)}layout(i,e,t=0,o=0){this.layoutController.isLayoutEnabled=!0;let[n,r,s,l]=this.root.orientation===1?[e,i,t,o]:[i,e,o,t];this.root.layout(n,0,{orthogonalSize:r,absoluteOffset:s,absoluteOrthogonalOffset:l,absoluteSize:n,absoluteOrthogonalSize:r})}addView(i,e,t){this.hasMaximizedView()&&this.exitMaximizedView(),this.disposable2x2.dispose(),this.disposable2x2=x.None;let[o,n]=Xg(t),[r,s]=this.getNode(o);if(s instanceof Nb){let l=new Ob(i,AA(s.orientation),this.layoutController,s.orthogonalSize);try{s.addChild(l,e,n)}catch(c){throw l.dispose(),c}}else{let[,l]=Xg(r),[,c]=Xg(o),u=0,p=l.getChildCachedVisibleSize(c);typeof p=="number"&&(u=Gl.Invisible(p)),l.removeChild(c).dispose();let g=new Nb(s.orientation,s.layoutController,this.styles,this.proportionalLayout,s.size,s.orthogonalSize,l.edgeSnapping);l.addChild(g,s.size,c);let f=new Ob(s.view,l.orientation,this.layoutController,s.size);g.addChild(f,u,0),typeof e!="number"&&e.type==="split"&&(e=Gl.Split(0));let v=new Ob(i,l.orientation,this.layoutController,s.size);g.addChild(v,e,n)}this.trySet2x2()}removeView(i,e){this.hasMaximizedView()&&this.exitMaximizedView(),this.disposable2x2.dispose(),this.disposable2x2=x.None;let[t,o]=Xg(i),[n,r]=this.getNode(t);if(!(r instanceof Nb))throw new Error("Invalid location");let s=r.children[o];if(!(s instanceof Ob))throw new Error("Invalid location");if(r.removeChild(o,e),s.dispose(),r.children.length===0)throw new Error("Invalid grid state");if(r.children.length>1)return this.trySet2x2(),s.view;if(n.length===0){let g=r.children[0];return g instanceof Ob||(r.removeChild(0),r.dispose(),this.root=g,this.boundarySashes=this.boundarySashes,this.trySet2x2()),s.view}let[,l]=Xg(n),[,c]=Xg(t),u=r.isChildVisible(0),p=r.removeChild(0),h=l.children.map((g,f)=>l.getChildSize(f));if(l.removeChild(c,e),r.dispose(),p instanceof Nb){h.splice(c,1,...p.children.map(f=>f.size));let g=p.removeAllChildren();for(let f=0;f<g.length;f++)l.addChild(g[f],g[f].size,c+f)}else{let g=new Ob(p.view,AA(p.orientation),this.layoutController,p.size),f=u?p.orthogonalSize:Gl.Invisible(p.orthogonalSize);l.addChild(g,f,c)}p.dispose();for(let g=0;g<h.length;g++)l.resizeChild(g,h[g]);return this.trySet2x2(),s.view}moveView(i,e,t){this.hasMaximizedView()&&this.exitMaximizedView();let[,o]=this.getNode(i);if(!(o instanceof Nb))throw new Error("Invalid location");o.moveChild(e,t),this.trySet2x2()}swapViews(i,e){this.hasMaximizedView()&&this.exitMaximizedView();let[t,o]=Xg(i),[,n]=this.getNode(t);if(!(n instanceof Nb))throw new Error("Invalid from location");let r=n.getChildSize(o),s=n.children[o];if(!(s instanceof Ob))throw new Error("Invalid from location");let[l,c]=Xg(e),[,u]=this.getNode(l);if(!(u instanceof Nb))throw new Error("Invalid to location");let p=u.getChildSize(c),h=u.children[c];if(!(h instanceof Ob))throw new Error("Invalid to location");n===u?n.swapChildren(o,c):(n.removeChild(o),u.removeChild(c),n.addChild(h,r,o),u.addChild(s,p,c)),this.trySet2x2()}resizeView(i,e){this.hasMaximizedView()&&this.exitMaximizedView();let[t,o]=Xg(i),[n,r]=this.getNode(t);if(!(r instanceof Nb))throw new Error("Invalid location");if(!e.width&&!e.height)return;let[s,l]=r.orientation===1?[e.width,e.height]:[e.height,e.width];if(typeof l=="number"&&n.length>0){let[,c]=Xg(n),[,u]=Xg(t);c.resizeChild(u,l)}typeof s=="number"&&r.resizeChild(o,s),this.trySet2x2()}getViewSize(i){if(!i)return{width:this.root.width,height:this.root.height};let[,e]=this.getNode(i);return{width:e.width,height:e.height}}getViewCachedVisibleSize(i){let[e,t]=Xg(i),[,o]=this.getNode(e);if(!(o instanceof Nb))throw new Error("Invalid location");return o.getChildCachedVisibleSize(t)}expandView(i){this.hasMaximizedView()&&this.exitMaximizedView();let[e,t]=this.getNode(i);if(!(t instanceof Ob))throw new Error("Invalid location");for(let o=0;o<e.length;o++)e[o].resizeChild(i[o],Number.POSITIVE_INFINITY)}isViewExpanded(i){if(this.hasMaximizedView())return!1;let[e,t]=this.getNode(i);if(!(t instanceof Ob))throw new Error("Invalid location");for(let o=0;o<e.length;o++)if(!e[o].isChildExpanded(i[o]))return!1;return!0}maximizeView(i,e=[]){let[,t]=this.getNode(i);if(!(t instanceof Ob))throw new Error("Location is not a LeafNode");if(this.maximizedNode===t)return;this.hasMaximizedView()&&this.exitMaximizedView();let o=new Set(e);function n(r,s){for(let l=0;l<r.children.length;l++){let c=r.children[l];c instanceof Ob?c!==s&&!o.has(c.view)&&r.setChildVisible(l,!1):n(c,s)}}n(this.root,t),this.maximizedNode=t,this._onDidChangeViewMaximized.fire(!0)}exitMaximizedView(){if(!this.maximizedNode)return;this.maximizedNode=void 0;function i(e){for(let t=e.children.length-1;t>=0;t--){let o=e.children[t];o instanceof Ob?e.setChildVisible(t,!0):i(o)}}i(this.root),this._onDidChangeViewMaximized.fire(!1)}hasMaximizedView(){return this.maximizedNode!==void 0}isViewMaximized(i){let[,e]=this.getNode(i);if(!(e instanceof Ob))throw new Error("Location is not a LeafNode");return e===this.maximizedNode}distributeViewSizes(i){if(this.hasMaximizedView()&&this.exitMaximizedView(),!i){this.root.distributeViewSizes(!0);return}let[,e]=this.getNode(i);if(!(e instanceof Nb))throw new Error("Invalid location");e.distributeViewSizes(),this.trySet2x2()}isViewVisible(i){let[e,t]=Xg(i),[,o]=this.getNode(e);if(!(o instanceof Nb))throw new Error("Invalid from location");return o.isChildVisible(t)}setViewVisible(i,e){if(this.hasMaximizedView()){this.exitMaximizedView();return}let[t,o]=Xg(i),[,n]=this.getNode(t);if(!(n instanceof Nb))throw new Error("Invalid from location");n.setChildVisible(o,e)}getView(i){let e=i?this.getNode(i)[1]:this._root;return this._getViews(e,this.orientation)}static deserialize(i,e,t={}){if(typeof i.orientation!="number")throw new Error("Invalid JSON: 'orientation' property must be a number.");if(typeof i.width!="number")throw new Error("Invalid JSON: 'width' property must be a number.");if(typeof i.height!="number")throw new Error("Invalid JSON: 'height' property must be a number.");if(i.root?.type!=="branch")throw new Error("Invalid JSON: 'root' property must have 'type' value of branch.");let o=i.orientation,n=i.height,r=new a(t);return r._deserialize(i.root,o,e,n),r}_deserialize(i,e,t,o){this.root=this._deserializeNode(i,e,t,o)}_deserializeNode(i,e,t,o){let n;if(i.type==="branch"){let s=i.data.map(l=>({node:this._deserializeNode(l,AA(e),t,i.size),visible:l.visible}));n=new Nb(e,this.layoutController,this.styles,this.proportionalLayout,i.size,o,void 0,s)}else n=new Ob(t.fromJSON(i.data),e,this.layoutController,o,i.size),i.maximized&&!this.maximizedNode&&(this.maximizedNode=n,this._onDidChangeViewMaximized.fire(!0));return n}_getViews(i,e,t){let o={top:i.top,left:i.left,width:i.width,height:i.height};if(i instanceof Ob)return{view:i.view,box:o,cachedVisibleSize:t,maximized:this.maximizedNode===i};let n=[];for(let r=0;r<i.children.length;r++){let s=i.children[r],l=i.getChildCachedVisibleSize(r);n.push(this._getViews(s,AA(e),l))}return{children:n,box:o}}getNode(i,e=this.root,t=[]){if(i.length===0)return[t,e];if(!(e instanceof Nb))throw new Error("Invalid location");let[o,...n]=i;if(o<0||o>=e.children.length)throw new Error("Invalid location");let r=e.children[o];return t.push(e),this.getNode(n,r,t)}trySet2x2(){if(this.disposable2x2.dispose(),this.disposable2x2=x.None,this.root.children.length!==2)return;let[i,e]=this.root.children;!(i instanceof Nb)||!(e instanceof Nb)||(this.disposable2x2=i.trySet2x2(e))}getViewMap(i,e){e||(e=this.root),e instanceof Nb?e.children.forEach(t=>this.getViewMap(i,t)):i.set(e.view,e.element)}dispose(){this._onDidChangeViewMaximized.dispose(),this.onDidSashResetRelay.dispose(),this.root.dispose(),this.element.remove()}};function kQo(a){switch(a){case 0:return 1;case 1:return 0;case 2:return 3;case 3:return 2}}function WZ(a){return!!a.children}function $ao(a,i){if(i.length===0)return a;if(!WZ(a))throw new Error("Invalid location");let[e,...t]=i;return $ao(a.children[e],t)}function EQo(a,i){return!(a.start>=i.end||i.start>=a.end)}function jao(a,i){let e=eyi(i),t=i===0?a.top:i===3?a.left+a.width:i===1?a.top+a.height:a.left,o={start:e===1?a.top:a.left,end:e===1?a.top+a.height:a.left+a.width};return{offset:t,range:o}}function TQo(a,i,e){let t=[];function o(n,r,s){if(WZ(n))for(let l of n.children)o(l,r,s);else{let{offset:l,range:c}=jao(n.box,r);l===s.offset&&EQo(c,s.range)&&t.push(n)}}return o(a,i,e),t}function JIi(a,i){return i.length%2===0?AA(a):a}function eyi(a){return a===0||a===1?0:1}function qao(a,i,e){let t=JIi(a,i),o=eyi(e);if(t===o){let[n,r]=Xg(i);return(e===3||e===1)&&(r+=1),[...n,r]}else{let n=e===3||e===1?1:0;return[...i,n]}}function _Qo(a){let i=a.parentElement;if(!i)throw new Error("Invalid grid element");let e=i.firstElementChild,t=0;for(;e!==a&&e!==i.lastElementChild&&e;)e=e.nextElementSibling,t++;return t}function Qao(a){let i=a.parentElement;if(!i)throw new Error("Invalid grid element");if(/\bmonaco-grid-view\b/.test(i.className))return[];let e=_Qo(i),t=i.parentElement.parentElement.parentElement.parentElement;return[...Qao(t),e]}var f0;(o=>{o.Distribute={type:"distribute"},o.Split={type:"split"},o.Auto={type:"auto"};function t(n){return{type:"invisible",cachedVisibleSize:n}}o.Invisible=t})(f0||={});var ZIi=class extends x{constructor(e,t={}){super();this.views=new Map;this.didLayout=!1;e instanceof Ppe?(this.gridview=e,this.gridview.getViewMap(this.views)):this.gridview=new Ppe(t),this._register(this.gridview),this._register(this.gridview.onDidSashReset(this.onDidSashReset,this)),e instanceof Ppe||this._addView(e,0,[0]),this.onDidChange=this.gridview.onDidChange,this.onDidScroll=this.gridview.onDidScroll,this.onDidChangeViewMaximized=this.gridview.onDidChangeViewMaximized}get orientation(){return this.gridview.orientation}set orientation(e){this.gridview.orientation=e}get width(){return this.gridview.width}get height(){return this.gridview.height}get minimumWidth(){return this.gridview.minimumWidth}get minimumHeight(){return this.gridview.minimumHeight}get maximumWidth(){return this.gridview.maximumWidth}get maximumHeight(){return this.gridview.maximumHeight}get boundarySashes(){return this.gridview.boundarySashes}set boundarySashes(e){this.gridview.boundarySashes=e}set edgeSnapping(e){this.gridview.edgeSnapping=e}get element(){return this.gridview.element}style(e){this.gridview.style(e)}layout(e,t,o=0,n=0){this.gridview.layout(e,t,o,n),this.didLayout=!0}addView(e,t,o,n){if(this.views.has(e))throw new Error("Can't add same view twice");let r=eyi(n);this.views.size===1&&this.orientation!==r&&(this.orientation=r);let s=this.getViewLocation(o),l=qao(this.gridview.orientation,s,n),c;if(typeof t=="number")c=t;else if(t.type==="split"){let[,u]=Xg(s);c=Gl.Split(u)}else if(t.type==="distribute")c=Gl.Distribute;else if(t.type==="auto"){let[,u]=Xg(s);c=Gl.Auto(u)}else c=t;this._addView(e,c,l)}addViewAt(e,t,o){if(this.views.has(e))throw new Error("Can't add same view twice");let n;typeof t=="number"?n=t:t.type==="distribute"?n=Gl.Distribute:n=t,this._addView(e,n,o)}_addView(e,t,o){this.views.set(e,e.element),this.gridview.addView(e,t,o)}removeView(e,t){if(this.views.size===1)throw new Error("Can't remove last view");let o=this.getViewLocation(e),n;if(t?.type==="distribute")n=Gl.Distribute;else if(t?.type==="auto"){let r=o[o.length-1];n=Gl.Auto(r===0?1:r-1)}this.gridview.removeView(o,n),this.views.delete(e)}moveView(e,t,o,n){let r=this.getViewLocation(e),[s,l]=Xg(r),c=this.getViewLocation(o),u=qao(this.gridview.orientation,c,n),[p,h]=Xg(u);$i(s,p)?this.gridview.moveView(s,l,h):(this.removeView(e,typeof t=="number"?void 0:t),this.addView(e,t,o,n))}moveViewTo(e,t){let o=this.getViewLocation(e),[n,r]=Xg(o),[s,l]=Xg(t);if($i(n,s))this.gridview.moveView(n,r,l);else{let c=this.getViewSize(e),u=JIi(this.gridview.orientation,o),p=this.getViewCachedVisibleSize(e),h=typeof p>"u"?u===1?c.width:c.height:f0.Invisible(p);this.removeView(e),this.addViewAt(e,h,t)}}swapViews(e,t){let o=this.getViewLocation(e),n=this.getViewLocation(t);return this.gridview.swapViews(o,n)}resizeView(e,t){let o=this.getViewLocation(e);return this.gridview.resizeView(o,t)}isViewExpanded(e){let t=this.getViewLocation(e);return this.gridview.isViewExpanded(t)}isViewMaximized(e){let t=this.getViewLocation(e);return this.gridview.isViewMaximized(t)}hasMaximizedView(){return this.gridview.hasMaximizedView()}getViewSize(e){if(!e)return this.gridview.getViewSize();let t=this.getViewLocation(e);return this.gridview.getViewSize(t)}getViewCachedVisibleSize(e){let t=this.getViewLocation(e);return this.gridview.getViewCachedVisibleSize(t)}maximizeView(e,t=[]){if(this.views.size<2)throw new Error("At least two views are required to maximize a view");let o=this.getViewLocation(e);this.gridview.maximizeView(o,t)}exitMaximizedView(){this.gridview.exitMaximizedView()}expandView(e){let t=this.getViewLocation(e);this.gridview.expandView(t)}distributeViewSizes(){this.gridview.distributeViewSizes()}isViewVisible(e){let t=this.getViewLocation(e);return this.gridview.isViewVisible(t)}setViewVisible(e,t){let o=this.getViewLocation(e);this.gridview.setViewVisible(o,t)}getViews(){return this.gridview.getView()}getNeighborViews(e,t,o=!1){if(!this.didLayout)throw new Error("Can't call getNeighborViews before first layout");let n=this.getViewLocation(e),r=this.getViews(),s=$ao(r,n),l=jao(s.box,t);return o&&(t===0&&s.box.top===0?l={offset:r.box.top+r.box.height,range:l.range}:t===3&&s.box.left+s.box.width===r.box.width?l={offset:0,range:l.range}:t===1&&s.box.top+s.box.height===r.box.height?l={offset:0,range:l.range}:t===2&&s.box.left===0&&(l={offset:r.box.left+r.box.width,range:l.range})),TQo(r,kQo(t),l).map(c=>c.view)}getViewLocation(e){let t=this.views.get(e);if(!t)throw new Error("View not found");return Qao(t)}onDidSashReset(e){let t=r=>{let s=this.gridview.getView(r);if(WZ(s))return!1;let l=JIi(this.orientation,r),c=l===1?s.view.preferredWidth:s.view.preferredHeight;if(typeof c!="number")return!1;let u=l===1?{width:Math.round(c)}:{height:Math.round(c)};return this.gridview.resizeView(r,u),!0};if(t(e))return;let[o,n]=Xg(e);t([...o,n+1])||this.gridview.distributeViewSizes(o)}},S3=class a extends ZIi{constructor(){super(...arguments);this.initialLayoutContext=!0}static serializeNode(e,t){let o=t===0?e.box.width:e.box.height;if(!WZ(e)){let r={type:"leaf",data:e.view.toJSON(),size:o};return typeof e.cachedVisibleSize=="number"?(r.size=e.cachedVisibleSize,r.visible=!1):e.maximized&&(r.maximized=!0),r}let n=e.children.map(r=>a.serializeNode(r,AA(t)));return n.some(r=>r.visible!==!1)?{type:"branch",data:n,size:o}:{type:"branch",data:n,size:o,visible:!1}}static deserialize(e,t,o={}){if(typeof e.orientation!="number")throw new Error("Invalid JSON: 'orientation' property must be a number.");if(typeof e.width!="number")throw new Error("Invalid JSON: 'width' property must be a number.");if(typeof e.height!="number")throw new Error("Invalid JSON: 'height' property must be a number.");let n=Ppe.deserialize(e,t,o);return new a(n,o)}static from(e,t={}){return a.deserialize(tyi(e),{fromJSON:o=>o},t)}serialize(){return{root:a.serializeNode(this.getViews(),this.orientation),orientation:this.orientation,width:this.width,height:this.height}}layout(e,t,o=0,n=0){super.layout(e,t,o,n),this.initialLayoutContext&&(this.initialLayoutContext=!1,this.gridview.trySet2x2())}};function Yao(a){return!!a.groups}function Xao(a,i){if(!i&&a.groups&&a.groups.length<=1&&(a.groups=void 0),!Yao(a))return;let e=0,t=0;for(let s of a.groups)Xao(s,!1),s.size&&(e+=s.size,t++);let o=t>0?e:1,n=a.groups.length-t,r=o/n;for(let s of a.groups)s.size||(s.size=r)}function Jao(a){return Yao(a)?{type:"branch",data:a.groups.map(i=>Jao(i)),size:a.size}:{type:"leaf",data:a.data,size:a.size}}function Zao(a,i){if(a.type==="branch"){let e=a.data.map(t=>Zao(t,AA(i)));if(i===0){let t=a.size||(e.length===0?void 0:Math.max(...e.map(n=>n.width||0))),o=e.length===0?void 0:e.reduce((n,r)=>n+(r.height||0),0);return{width:t,height:o}}else{let t=e.length===0?void 0:e.reduce((n,r)=>n+(r.width||0),0),o=a.size||(e.length===0?void 0:Math.max(...e.map(n=>n.height||0)));return{width:t,height:o}}}else{let e=i===0?a.size:void 0,t=i===0?void 0:a.size;return{width:e,height:t}}}function tyi(a){Xao(a,!0);let i=Jao(a),{width:e,height:t}=Zao(i,a.orientation);return{root:i,orientation:a.orientation,width:e||1,height:t||1}}var pLe=class extends K{constructor(e,t){super(e);this.direction=t}run(e){let t=e.get(yi),o=e.get(wt),n=e.get(us),r=t.hasFocus("workbench.parts.editor"),s=t.hasFocus("workbench.parts.panel"),l=t.hasFocus("workbench.parts.sidebar"),c=t.hasFocus("workbench.parts.auxiliarybar"),u;if(r){if(this.navigateAcrossEditorGroup(this.toGroupDirection(this.direction),o))return;u=t.getVisibleNeighborPart("workbench.parts.editor",this.direction)}s&&(u=t.getVisibleNeighborPart("workbench.parts.panel",this.direction)),l&&(u=t.getVisibleNeighborPart("workbench.parts.sidebar",this.direction)),c&&(u=u=t.getVisibleNeighborPart("workbench.parts.auxiliarybar",this.direction)),u==="workbench.parts.editor"?this.navigateBackToEditorGroup(this.toGroupDirection(this.direction),o)||this.navigateToEditorGroup(this.direction===3?0:1,o):u==="workbench.parts.sidebar"?this.navigateToSidebar(t,n):u==="workbench.parts.panel"?this.navigateToPanel(t,n):u==="workbench.parts.auxiliarybar"&&this.navigateToAuxiliaryBar(t,n)}async navigateToPanel(e,t){if(!e.isVisible("workbench.parts.panel"))return!1;let o=t.getActivePaneComposite(1);if(!o)return!1;let n=o.getId(),r=await t.openPaneComposite(n,1,!0);return r||!1}async navigateToSidebar(e,t){if(!e.isVisible("workbench.parts.sidebar"))return!1;let o=t.getActivePaneComposite(0);if(!o)return!1;let n=o.getId();return!!await t.openPaneComposite(n,0,!0)}async navigateToAuxiliaryBar(e,t){if(!e.isVisible("workbench.parts.auxiliarybar"))return!1;let o=t.getActivePaneComposite(2);if(!o)return!1;let n=o.getId(),r=await t.openPaneComposite(n,2,!0);return r||!1}navigateAcrossEditorGroup(e,t){return this.doNavigateToEditorGroup({direction:e},t)}navigateToEditorGroup(e,t){return this.doNavigateToEditorGroup({location:e},t)}navigateBackToEditorGroup(e,t){if(!t.activeGroup)return!1;let o=this.toOppositeDirection(e);return t.findGroup({direction:o},t.activeGroup)?!1:(t.activeGroup.focus(),!0)}toGroupDirection(e){switch(e){case 1:return 1;case 2:return 2;case 3:return 3;case 0:return 0}}toOppositeDirection(e){switch(e){case 0:return 1;case 3:return 2;case 2:return 3;case 1:return 0}}doNavigateToEditorGroup(e,t){let o=t.findGroup(e,t.activeGroup);return o?(o.focus(),!0):!1}};W(class extends pLe{constructor(){super({id:"workbench.action.navigateLeft",title:L(3714,"Navigate to the View on the Left"),category:Ve.View,f1:!0},2)}});W(class extends pLe{constructor(){super({id:"workbench.action.navigateRight",title:L(3715,"Navigate to the View on the Right"),category:Ve.View,f1:!0},3)}});W(class extends pLe{constructor(){super({id:"workbench.action.navigateUp",title:L(3716,"Navigate to the View Above"),category:Ve.View,f1:!0},0)}});W(class extends pLe{constructor(){super({id:"workbench.action.navigateDown",title:L(3713,"Navigate to the View Below"),category:Ve.View,f1:!0},1)}});var ZOt=class extends K{constructor(e,t){super(e);this.focusNext=t}run(e){let t=e.get(yi),o=e.get(ee);this.focusNextOrPreviousPart(t,o,this.focusNext)}findVisibleNeighbour(e,t,o){let n=Ki(),r=zy(n),s;if(r)t==="workbench.parts.editor"?s="workbench.parts.statusbar":s="workbench.parts.editor";else switch(t){case"workbench.parts.editor":s=o?"workbench.parts.panel":"workbench.parts.sidebar";break;case"workbench.parts.panel":s=o?"workbench.parts.auxiliarybar":"workbench.parts.editor";break;case"workbench.parts.auxiliarybar":s=o?"workbench.parts.statusbar":"workbench.parts.panel";break;case"workbench.parts.statusbar":s=o?"workbench.parts.activitybar":"workbench.parts.auxiliarybar";break;case"workbench.parts.activitybar":s=o?"workbench.parts.sidebar":"workbench.parts.statusbar";break;case"workbench.parts.sidebar":s=o?"workbench.parts.editor":"workbench.parts.activitybar";break;default:s="workbench.parts.editor"}return e.isVisible(s,n)||s==="workbench.parts.editor"?s:this.findVisibleNeighbour(e,s,o)}focusNextOrPreviousPart(e,t,o){let n;t.activeEditorPane?.hasFocus()||e.hasFocus("workbench.parts.editor")?n="workbench.parts.editor":e.hasFocus("workbench.parts.activitybar")?n="workbench.parts.activitybar":e.hasFocus("workbench.parts.statusbar")?n="workbench.parts.statusbar":e.hasFocus("workbench.parts.sidebar")?n="workbench.parts.sidebar":e.hasFocus("workbench.parts.auxiliarybar")?n="workbench.parts.auxiliarybar":e.hasFocus("workbench.parts.panel")&&(n="workbench.parts.panel"),e.focusPart(n?this.findVisibleNeighbour(e,n,o):"workbench.parts.editor",Ki())}};W(class extends ZOt{constructor(){super({id:"workbench.action.focusNextPart",title:L(3711,"Focus Next Part"),category:Ve.View,f1:!0,keybinding:{primary:64,weight:200}},!0)}});W(class extends ZOt{constructor(){super({id:"workbench.action.focusPreviousPart",title:L(3712,"Focus Previous Part"),category:Ve.View,f1:!0,keybinding:{primary:1088,weight:200}},!1)}});var tlo="inQuickOpen",ilo=new Y(tlo,!1,d(4552,null)),TT=C.has(tlo),iyi="inFilesPicker",oyi=C.and(TT,C.has(iyi));function LD(a,i){return e=>{let t=e.get(_e),o=e.get(Ue),r={keybindings:t.lookupKeybindings(a)};o.navigate(!!i,r)}}var L2=class extends x{constructor(e,t){super();this.editorService=e;this.editorGroupsService=t;this.editorViewState=void 0;this.openedTransientEditors=new Set}set(){if(this.editorViewState)return;let e=this.editorService.activeEditorPane;e&&(this.editorViewState={group:e.group,editor:e.input,state:o5i(e.getControl())?.saveViewState()??void 0})}async openTransientEditor(e,t){e.options={...e.options,transient:!0};let o=await this.editorService.openEditor(e,t);return o?.input&&o.input!==this.editorViewState?.editor&&o.group.isTransient(o.input)&&this.openedTransientEditors.add(o.input),o}async restore(){if(this.editorViewState){for(let e of this.openedTransientEditors)if(!e.isDirty())for(let t of this.editorGroupsService.groups)t.isTransient(e)&&await t.closeEditor(e,{preserveFocus:!0});await this.editorViewState.group.openEditor(this.editorViewState.editor,{viewState:this.editorViewState.state,preserveFocus:!0}),this.reset()}}reset(){this.editorViewState=void 0,this.openedTransientEditors.clear()}dispose(){super.dispose(),this.reset()}};L2=I([m(0,ee),m(1,wt)],L2);function nyi(a){return a?.hasOwnProperty("folderUri")}function olo(a){return a?.hasOwnProperty("workspace")}var slo="inRecentFilesPicker",eFt=class extends K{constructor(){super(...arguments);this.removeFromRecentlyOpened={iconClass:q.asClassName(R.removeClose),tooltip:d(3759,null)};this.dirtyRecentlyOpenedFolder={iconClass:"dirty-workspace "+q.asClassName(R.closeDirty),tooltip:d(3736,null),alwaysVisible:!0};this.dirtyRecentlyOpenedWorkspace={...this.dirtyRecentlyOpenedFolder,tooltip:d(3737,null)};this.windowOpenedRecentlyOpenedFolder={iconClass:"opened-workspace "+q.asClassName(R.window),tooltip:d(3750,null),alwaysVisible:!0};this.windowOpenedRecentlyOpenedWorkspace={...this.windowOpenedRecentlyOpenedFolder,tooltip:d(3751,null)};this.activeWindowOpenedRecentlyOpenedFolder={iconClass:"opened-workspace "+q.asClassName(R.windowActive),tooltip:d(3730,null),alwaysVisible:!0};this.activeWindowOpenedRecentlyOpenedWorkspace={...this.activeWindowOpenedRecentlyOpenedFolder,tooltip:d(3731,null)}}async run(e){let t=e.get(jp),o=e.get(Ue),n=e.get(Pe),r=e.get(rt),s=e.get(_e),l=e.get(Tt),c=e.get(_t),u=e.get(Zt),p=e.get(at),[h,g,f]=await Promise.all([u.getWindows({includeAuxiliaryWindows:!1}),t.getRecentlyOpened(),t.getDirtyWorkspaces()]),v=!1,b=new gt,S=new gt;for(let oe of f)nyi(oe)?b.set(oe.folderUri,!0):(S.set(oe.workspace.configPath,oe.workspace),v=!0);let y=Ki().vscodeWindowId,w=new gt;for(let oe of h){let de=oe.id===y;Zh(oe.workspace)?w.set(oe.workspace.uri,{isActive:de}):ny(oe.workspace)&&w.set(oe.workspace.configPath,{isActive:de})}let k=new gt,T=new gt;for(let oe of g.workspaces)ZR(oe)?k.set(oe.folderUri,!0):(T.set(oe.workspace.configPath,oe.workspace),v=!0);let P=[];for(let oe of g.workspaces){let de=ZR(oe)?b.has(oe.folderUri):S.has(oe.workspace.configPath),Ce=ZR(oe)?w.get(oe.folderUri):w.get(oe.workspace.configPath);P.push(this.toQuickPick(l,c,r,oe,{isDirty:de,windowState:Ce}))}for(let oe of f)nyi(oe)&&!k.has(oe.folderUri)?P.push(this.toQuickPick(l,c,r,oe,{isDirty:!0,windowState:void 0})):olo(oe)&&!T.has(oe.workspace.configPath)&&P.push(this.toQuickPick(l,c,r,oe,{isDirty:!0,windowState:void 0}));let O=g.files.map(oe=>this.toQuickPick(l,c,r,oe,{isDirty:!1,windowState:void 0})),V=g.workspaces[0],H=V&&n.isCurrentWorkspace(EA(V)?V.workspace:V.folderUri),G,$={type:"separator",label:v?d(3761,null):d(3742,null)},J={type:"separator",label:d(3741,null)},ae=[$,...P,J,...O],he=await o.pick(ae,{contextKey:slo,activeItem:[...P,...O][H?1:0],placeHolder:Ze?d(3754,null):d(3753,null),matchOnDescription:!0,sortByLabel:!1,onKeyMods:oe=>G=oe,quickNavigate:this.isQuickNavigate()?{keybindings:s.lookupKeybindings(this.desc.id)}:void 0,hideInput:this.isQuickNavigate(),onDidTriggerItemButton:async oe=>{if(oe.button===this.removeFromRecentlyOpened||oe.button===this.windowOpenedRecentlyOpenedFolder||oe.button===this.windowOpenedRecentlyOpenedWorkspace)await t.removeRecentlyOpened([oe.item.resource]),oe.removeItem();else if(oe.button===this.dirtyRecentlyOpenedFolder||oe.button===this.dirtyRecentlyOpenedWorkspace){let de=oe.button===this.dirtyRecentlyOpenedWorkspace,{confirmed:Ce}=await p.confirm({title:de?d(3738,null):d(3733,null),message:de?d(3739,null):d(3734,null),detail:de?d(3740,null):d(3735,null)});Ce&&(u.openWindow([oe.item.openable],{remoteAuthority:oe.item.remoteAuthority||null}),o.cancel())}}});if(he)return u.openWindow([he.openable],{forceNewWindow:G?.ctrlCmd,forceReuseWindow:G?.alt,remoteAuthority:he.remoteAuthority||null})}toQuickPick(e,t,o,n,r){let s,l,c,u,p=!1;ZR(n)?(u=n.folderUri,l=aa(e,t,u,1),s={folderUri:u},c=n.label||o.getWorkspaceLabel(u,{verbose:2})):EA(n)?(u=n.workspace.configPath,l=aa(e,t,u,2),s={workspaceUri:u},c=n.label||o.getWorkspaceLabel(n.workspace,{verbose:2}),p=!0):(u=n.fileUri,l=aa(e,t,u,0),s={fileUri:u},c=n.label||o.getUriLabel(u,{appendWorkspaceSuffix:!0}));let{name:h,parentPath:g}=Cbt(c),f=[];return r.isDirty?f.push(p?this.dirtyRecentlyOpenedWorkspace:this.dirtyRecentlyOpenedFolder):r.windowState?r.windowState.isActive?f.push(p?this.activeWindowOpenedRecentlyOpenedWorkspace:this.activeWindowOpenedRecentlyOpenedFolder):f.push(p?this.windowOpenedRecentlyOpenedWorkspace:this.windowOpenedRecentlyOpenedFolder):f.push(this.removeFromRecentlyOpened),{iconClasses:l,label:h,ariaLabel:r.isDirty?p?d(3757,null,h):d(3756,null,h):h,description:g,buttons:f,openable:s,resource:u,remoteAuthority:n.remoteAuthority}}},v0=class a extends eFt{static{this.ID="workbench.action.openRecent"}constructor(){super({id:a.ID,title:{...L(3752,"Open Recent..."),mnemonicTitle:d(3745,null)},category:Ve.File,f1:!0,keybinding:{weight:200,primary:2096,mac:{primary:304}},menu:{id:D.MenubarRecentMenu,group:"y_more",order:1}})}isQuickNavigate(){return!1}},ryi=class extends eFt{constructor(){super({id:"workbench.action.quickOpenRecent",title:L(3755,"Quick Open Recent..."),category:Ve.File,f1:!1})}isQuickNavigate(){return!0}},syi=class extends K{constructor(){super({id:"workbench.action.toggleFullScreen",title:{...L(3760,"Toggle Full Screen"),mnemonicTitle:d(3748,null)},category:Ve.View,f1:!0,keybinding:{weight:200,primary:69,mac:{primary:2340}},precondition:nxt.toNegated(),toggled:eA,menu:[{id:D.MenubarAppearanceMenu,group:"1_toggle_view",order:1}]})}run(i){return i.get(Zt).toggleFullScreen(Ki())}},VZ=class a extends K{static{this.ID="workbench.action.reloadWindow"}constructor(){super({id:a.ID,title:L(3758,"Reload Window"),category:Ve.Developer,f1:!0,keybinding:{weight:250,when:p5,primary:2096}})}async run(i){return i.get(Zt).reload()}},ayi=class extends K{constructor(){super({id:"workbench.action.showAboutDialog",title:{...L(3729,"About"),mnemonicTitle:d(3743,null)},category:Ve.Help,f1:!0,menu:{id:D.MenubarHelpMenu,group:"z_about",order:1,when:rk.toNegated()}})}run(i){return i.get(at).about()}},lyi=class extends K{constructor(){super({id:"workbench.action.newWindow",title:{...L(3749,"New Window"),mnemonicTitle:d(3746,null)},f1:!0,keybinding:{weight:200,primary:Wt?ei?Vi(2089,1068):3628:3116,secondary:Wt?[3116]:void 0},menu:{id:D.MenubarFileMenu,group:"1_new",order:3}})}run(i){return i.get(Zt).openWindow({remoteAuthority:null})}},cyi=class extends K{constructor(){super({id:"workbench.action.blur",title:L(3732,"Remove keyboard focus from focused element")})}run(){let i=Nn();Do(i)&&i.blur()}};W(lyi);W(syi);W(ryi);W(v0);W(VZ);W(ayi);W(cyi);var alo=C.and(TT,C.has(slo)),nlo="workbench.action.quickOpenNavigateNextInRecentFilesPicker";Ct.registerCommandAndKeybindingRule({id:nlo,weight:250,handler:LD(nlo,!0),when:alo,primary:2096,mac:{primary:304}});var rlo="workbench.action.quickOpenNavigatePreviousInRecentFilesPicker";Ct.registerCommandAndKeybindingRule({id:rlo,weight:250,handler:LD(rlo,!1),when:alo,primary:3120,mac:{primary:1328}});$e.registerCommand("workbench.action.toggleConfirmBeforeClose",a=>{let i=a.get(B),e=i.inspect("window.confirmBeforeClose").userValue;return i.updateValue("window.confirmBeforeClose",e==="never"?"keyboardOnly":"never")});ve.appendMenuItem(D.MenubarFileMenu,{group:"z_ConfirmClose",command:{id:"workbench.action.toggleConfirmBeforeClose",title:d(3744,null),toggled:C.notEquals("config.window.confirmBeforeClose","never")},order:1,when:Fu});ve.appendMenuItem(D.MenubarFileMenu,{title:d(3747,null),submenu:D.MenubarRecentMenu,group:"2_open",order:4});var mLe="addRootFolder",tFt=L(3782,"Add Folder to Workspace..."),dyi="setRootFolder",rM="_workbench.pickWorkspaceFolder";$e.registerCommand({id:"workbench.action.files.openFileFolderInNewWindow",handler:a=>a.get(rn).pickFileFolderAndOpen({forceNewWindow:!0})});$e.registerCommand({id:"_files.pickFolderAndOpen",handler:(a,i)=>a.get(rn).pickFolderAndOpen(i)});$e.registerCommand({id:"workbench.action.files.openFolderInNewWindow",handler:a=>a.get(rn).pickFolderAndOpen({forceNewWindow:!0})});$e.registerCommand({id:"workbench.action.files.openFileInNewWindow",handler:a=>a.get(rn).pickFileAndOpen({forceNewWindow:!0})});$e.registerCommand({id:"workbench.action.openWorkspaceInNewWindow",handler:a=>a.get(rn).pickWorkspaceAndOpen({forceNewWindow:!0})});$e.registerCommand({id:mLe,handler:async a=>{let i=a.get(Db),e=await llo(a);e?.length&&await i.addFolders(e.map(t=>({uri:t})))}});$e.registerCommand({id:dyi,handler:async a=>{let i=a.get(Db),e=a.get(Pe),t=await llo(a);t?.length&&await i.updateFolders(0,e.getWorkspace().folders.length,t.map(o=>({uri:o})))}});async function llo(a){let i=a.get(rn),e=a.get(An);return await i.showOpenDialog({openLabel:vj(d(3781,null)),title:d(3783,null),canSelectFolders:!0,canSelectMany:!0,defaultUri:await i.defaultFolderPath(),availableFileSystems:[e.defaultUriScheme]})}$e.registerCommand(rM,async function(a,i){let e=a.get(Ue),t=a.get(rt),o=a.get(Pe),n=a.get(Tt),r=a.get(_t),s=o.getWorkspace().folders;if(!s.length)return;let l=s.map(h=>{let g=h.name,f=t.getUriLabel(ci(h.uri),{relative:!0});return{label:g,description:f!==g?f:void 0,folder:h,iconClasses:aa(n,r,h.uri,2)}}),c=(i?i[0]:void 0)||Object.create(null);c.activeItem||(c.activeItem=l[0]),c.placeHolder||(c.placeHolder=d(3784,null)),typeof c.matchOnDescription!="boolean"&&(c.matchOnDescription=!0);let u=(i?i[1]:void 0)||Se.None,p=await e.pick(l,c,u);if(p)return s[l.indexOf(p)]});$e.registerCommand({id:"vscode.openFolder",handler:(a,i,e)=>{let t=a.get(ge);if(typeof e=="boolean"&&(e={forceNewWindow:e}),!i){let l={forceNewWindow:e?.forceNewWindow};return e?.forceLocalWindow&&(l.remoteAuthority=null,l.availableFileSystems=["file"]),t.executeCommand("_files.pickFolderAndOpen",l)}let o=A.from(i,!0),n={forceNewWindow:e?.forceNewWindow,forceReuseWindow:e?.forceReuseWindow,noRecentEntry:e?.noRecentEntry,remoteAuthority:e?.forceLocalWindow?null:void 0,forceProfile:e?.forceProfile,forceTempProfile:e?.forceTempProfile},r=GO(o)||o.scheme===Q.untitled?{workspaceUri:o}:{folderUri:o},s=e?.filesToOpen?.map(l=>({fileUri:A.from(l,!0)}))??[];return t.executeCommand("_files.windowOpen",[r,...s],n)},metadata:{description:"Open a folder or workspace in the current window or new window depending on the newWindow argument. Note that opening in the same window will shutdown the current extension host process and start a new one on the given folder/workspace unless the newWindow parameter is set to true.",args:[{name:"uri",description:"(optional) Uri of the folder or workspace file to open. If not provided, a native dialog will ask the user for the folder",constraint:a=>a==null||a instanceof A},{name:"options",description:"(optional) Options. Object with the following properties: `forceNewWindow`: Whether to open the folder/workspace in a new window or the same. Defaults to opening in the same window. `forceReuseWindow`: Whether to force opening the folder/workspace in the same window.  Defaults to false. `noRecentEntry`: Whether the opened URI will appear in the 'Open Recent' list. Defaults to false. `forceLocalWindow`: Whether to force opening the folder/workspace in a local window. Defaults to false. `forceProfile`: The profile to use when opening the folder/workspace. Defaults to the current profile. `forceTempProfile`: Whether to use a temporary profile when opening the folder/workspace. Defaults to false. `filesToOpen`: An array of files to open in the new window. Defaults to an empty array. Note, for backward compatibility, options can also be of type boolean, representing the `forceNewWindow` setting.",constraint:a=>a===void 0||typeof a=="object"||typeof a=="boolean"}]}});$e.registerCommand({id:"vscode.newWindow",handler:(a,i)=>{let e=a.get(ge),t={forceReuseWindow:i?.reuseWindow,remoteAuthority:i?.remoteAuthority};return e.executeCommand("_files.newWindow",t)},metadata:{description:"Opens an new window depending on the newWindow argument.",args:[{name:"options",description:"(optional) Options. Object with the following properties: `reuseWindow`: Whether to open a new window or the same. Defaults to opening in a new window. ",constraint:a=>a===void 0||typeof a=="object"}]}});$e.registerCommand("_workbench.removeFromRecentlyOpened",function(a,i){return a.get(jp).removeRecentlyOpened([i])});$e.registerCommand({id:"vscode.removeFromRecentlyOpened",handler:(a,i)=>{let e=a.get(jp);return typeof i=="string"?i=i.match(/^[^:/?#]+:\/\//)?A.parse(i):A.file(i):i=A.revive(i),e.removeRecentlyOpened([i])},metadata:{description:"Removes an entry with the given path from the recently opened list.",args:[{name:"path",description:"URI or URI string to remove from recently opened.",constraint:a=>typeof a=="string"||a instanceof A}]}});$e.registerCommand("_workbench.addToRecentlyOpened",async function(a,i){let e=a.get(jp),t=i.uri,o=i.label,n=i.remoteAuthority,r;return i.type==="workspace"?r={workspace:await e.getWorkspaceIdentifier(t),label:o,remoteAuthority:n}:i.type==="folder"?r={folderUri:t,label:o,remoteAuthority:n}:r={fileUri:t,label:o,remoteAuthority:n},e.addRecentlyOpened([r])});$e.registerCommand("_workbench.getRecentlyOpened",async function(a){return a.get(jp).getRecentlyOpened()});var vLe=L(3780,"Workspaces"),hLe=class a extends K{static{this.ID="workbench.action.files.openFile"}constructor(){super({id:a.ID,title:L(3774,"Open File..."),category:Ve.File,f1:!0,keybinding:{when:rk.toNegated(),weight:200,primary:2093}})}async run(i,e){return i.get(rn).pickFileAndOpen({forceNewWindow:!1,telemetryExtraData:e})}},b0=class a extends K{static{this.ID="workbench.action.files.openFolder"}constructor(){super({id:a.ID,title:L(3776,"Open Folder..."),category:Ve.File,f1:!0,precondition:RF,keybinding:{weight:200,primary:void 0,linux:{primary:Vi(2089,2093)},win:{primary:Vi(2089,2093)}}})}async run(i,e){return i.get(rn).pickFolderAndOpen({forceNewWindow:!1,telemetryExtraData:e})}},BZ=class a extends K{static{this.ID="workbench.action.files.openFolderViaWorkspace"}constructor(){super({id:a.ID,title:L(3776,"Open Folder..."),category:Ve.File,f1:!0,precondition:C.and(RF.toNegated(),za.isEqualTo("workspace")),keybinding:{weight:200,primary:2093}})}run(i){return i.get(ge).executeCommand(dyi)}},gLe=class a extends K{static{this.ID="workbench.action.files.openFileFolder"}static{this.LABEL=L(3775,"Open...")}constructor(){super({id:a.ID,title:a.LABEL,category:Ve.File,f1:!0,precondition:C.and(rk,RF),keybinding:{weight:200,primary:2093}})}async run(i,e){return i.get(rn).pickFileFolderAndOpen({forceNewWindow:!1,telemetryExtraData:e})}},iFt=class a extends K{static{this.ID="workbench.action.openWorkspace"}constructor(){super({id:a.ID,title:L(3777,"Open Workspace from File..."),category:Ve.File,f1:!0,precondition:iD})}async run(i,e){return i.get(rn).pickWorkspaceAndOpen({telemetryExtraData:e})}},YXe=class a extends K{static{this.ID="workbench.action.closeFolder"}constructor(){super({id:a.ID,title:L(3762,"Close Workspace"),category:vLe,f1:!0,precondition:C.and(za.notEqualsTo("empty"),zX),keybinding:{weight:200,primary:Vi(2089,36)}})}async run(i){let e=i.get(Zt),t=i.get(At);return e.openWindow({forceReuseWindow:!0,remoteAuthority:t.remoteAuthority})}},uyi=class a extends K{static{this.ID="workbench.action.openWorkspaceConfigFile"}constructor(){super({id:a.ID,title:L(3778,"Open Workspace Configuration File"),category:vLe,f1:!0,precondition:za.isEqualTo("workspace")})}async run(i){let e=i.get(Pe),t=i.get(ee),o=e.getWorkspace().configuration;o&&await t.openEditor({resource:o,options:{pinned:!0}})}},fLe=class a extends K{static{this.ID="workbench.action.addRootFolder"}constructor(){super({id:a.ID,title:tFt,category:vLe,f1:!0,precondition:C.or(iD,za.isEqualTo("workspace"))})}run(i){return i.get(ge).executeCommand(mLe)}},XXe=class a extends K{static{this.ID="workbench.action.removeRootFolder"}constructor(){super({id:a.ID,title:L(3765,"Remove Folder from Workspace..."),category:vLe,f1:!0,precondition:C.and(sT.notEqualsTo("0"),C.or(iD,za.isEqualTo("workspace")))})}async run(i){let e=i.get(ge),t=i.get(Db),o=await e.executeCommand(rM);o&&await t.removeFolders([o.uri])}},oFt=class a extends K{static{this.ID="workbench.action.saveWorkspaceAs"}constructor(){super({id:a.ID,title:L(3779,"Save Workspace As..."),category:vLe,f1:!0,precondition:iD})}async run(i){let e=i.get(Db),t=i.get(Pe),o=await e.pickNewWorkspacePath();if(o&&GO(o))switch(t.getWorkbenchState()){case 1:case 2:{let n=t.getWorkspace().folders.map(r=>({uri:r.uri}));return e.createAndEnterWorkspace(n,o)}case 3:return e.saveAndEnterWorkspace(o)}}},nFt=class a extends K{static{this.ID="workbench.action.duplicateWorkspaceInNewWindow"}constructor(){super({id:a.ID,title:L(3764,"Duplicate As Workspace in New Window"),category:vLe,f1:!0,precondition:iD})}async run(i){let e=i.get(Pe),t=i.get(Db),o=i.get(Zt),n=i.get(jp),r=i.get(At),s=e.getWorkspace().folders,l=r.remoteAuthority,c=await n.createUntitledWorkspace(s,l);return await t.copyWorkspaceSettings(c),o.openWindow([{workspaceUri:c.configPath}],{forceNewWindow:!0,remoteAuthority:l})}};W(fLe);W(XXe);W(hLe);W(b0);W(BZ);W(gLe);W(iFt);W(uyi);W(YXe);W(oFt);W(nFt);ve.appendMenuItem(D.MenubarFileMenu,{group:"2_open",command:{id:hLe.ID,title:d(3770,null)},order:1,when:rk.toNegated()});ve.appendMenuItem(D.MenubarFileMenu,{group:"2_open",command:{id:b0.ID,title:d(3771,null)},order:2,when:RF});ve.appendMenuItem(D.MenubarFileMenu,{group:"2_open",command:{id:BZ.ID,title:d(3771,null)},order:2,when:C.and(RF.toNegated(),za.isEqualTo("workspace"))});ve.appendMenuItem(D.MenubarFileMenu,{group:"2_open",command:{id:gLe.ID,title:d(3769,null)},order:1,when:C.and(rk,RF)});ve.appendMenuItem(D.MenubarFileMenu,{group:"2_open",command:{id:iFt.ID,title:d(3772,null)},order:3,when:iD});ve.appendMenuItem(D.MenubarFileMenu,{group:"3_workspace",command:{id:mLe,title:d(3766,null)},when:C.or(iD,za.isEqualTo("workspace")),order:1});ve.appendMenuItem(D.MenubarFileMenu,{group:"3_workspace",command:{id:oFt.ID,title:d(3773,null)},order:2,when:iD});ve.appendMenuItem(D.MenubarFileMenu,{group:"3_workspace",command:{id:nFt.ID,title:d(3763,null)},order:3,when:iD});ve.appendMenuItem(D.MenubarFileMenu,{group:"6_close",command:{id:YXe.ID,title:d(3767,null)},order:3,when:C.and(za.isEqualTo("folder"),zX)});ve.appendMenuItem(D.MenubarFileMenu,{group:"6_close",command:{id:YXe.ID,title:d(3768,null)},order:3,when:C.and(za.isEqualTo("workspace"),zX)});var DQo="chat.unifiedAgentsBar.enabled",I3={primary:2094,secondary:[2083],mac:{primary:2094,secondary:void 0}};Ct.registerCommandAndKeybindingRule({id:"workbench.action.closeQuickOpen",weight:200,when:TT,primary:9,secondary:[1033],handler:a=>a.get(Ue).cancel(2)});Ct.registerCommandAndKeybindingRule({id:"workbench.action.acceptSelectedQuickOpenItem",weight:200,when:TT,primary:0,handler:a=>a.get(Ue).accept()});Ct.registerCommandAndKeybindingRule({id:"workbench.action.alternativeAcceptSelectedQuickOpenItem",weight:200,when:TT,primary:0,handler:a=>a.get(Ue).accept({ctrlCmd:!0,alt:!1,shift:!1})});Ct.registerCommandAndKeybindingRule({id:"workbench.action.focusQuickOpen",weight:200,when:TT,primary:0,handler:a=>{a.get(Ue).focus()}});var clo="workbench.action.quickOpenNavigateNextInFilePicker";Ct.registerCommandAndKeybindingRule({id:clo,weight:250,handler:LD(clo,!0),when:oyi,primary:I3.primary,secondary:I3.secondary,mac:I3.mac});var dlo="workbench.action.quickOpenNavigatePreviousInFilePicker";Ct.registerCommandAndKeybindingRule({id:dlo,weight:250,handler:LD(dlo,!1),when:oyi,primary:I3.primary|1024,secondary:[I3.secondary[0]|1024],mac:{primary:I3.mac.primary|1024,secondary:void 0}});Ct.registerCommandAndKeybindingRule({id:"workbench.action.quickPickManyToggle",weight:200,when:TT,primary:0,handler:a=>{a.get(Ue).toggle()}});Ct.registerCommandAndKeybindingRule({id:"workbench.action.quickInputBack",weight:250,when:TT,primary:0,win:{primary:527},mac:{primary:344},linux:{primary:2648},handler:a=>{a.get(Ue).back()}});W(class extends K{constructor(){super({id:"workbench.action.quickOpen",title:L(3719,"Go to File..."),metadata:{description:"Quick access",args:[{name:"prefix",schema:{type:"string"}}]},keybinding:{weight:200,primary:I3.primary,secondary:I3.secondary,mac:I3.mac},f1:!0})}run(i,e){i.get(Ue).quickAccess.show(typeof e=="string"?e:void 0,{preserveValue:typeof e=="string"})}});W(class extends K{constructor(){super({id:"workbench.action.quickOpenWithModes",title:d(3720,null),icon:R.search,menu:{id:D.CommandCenterCenter,order:100}})}async run(i){let e=()=>{let r=i.get(Ue),s={includeHelp:!0,from:"commandCenter"};r.quickAccess.show(void 0,{preserveValue:!0,providerOptions:s})},t=i.get(B),o=i.get(ge);if(t.getValue(DQo)===!0){try{await o.executeCommand("workbench.action.unifiedQuickAccess")}catch{e()}return}e()}});$e.registerCommand("workbench.action.quickOpenPreviousEditor",async a=>{a.get(Ue).quickAccess.show("",{itemActivation:2})});var bLe=class extends K{constructor(e,t,o,n,r){super({id:e,title:t,f1:!0,keybinding:r});this.id=e;this.next=o;this.quickNavigate=n}async run(e){let t=e.get(_e),o=e.get(Ue),n=t.lookupKeybindings(this.id),r=this.quickNavigate?{keybindings:n}:void 0;o.navigate(this.next,r)}},pyi=class extends bLe{constructor(){super("workbench.action.quickOpenNavigateNext",L(3717,"Navigate Next in Quick Open"),!0,!0)}},myi=class extends bLe{constructor(){super("workbench.action.quickOpenNavigatePrevious",L(3718,"Navigate Previous in Quick Open"),!1,!0)}},hyi=class extends bLe{constructor(){super("workbench.action.quickOpenSelectNext",L(3721,"Select Next in Quick Open"),!0,!1,{weight:250,when:TT,primary:0,mac:{primary:300}})}},gyi=class extends bLe{constructor(){super("workbench.action.quickOpenSelectPrevious",L(3722,"Select Previous in Quick Open"),!1,!1,{weight:250,when:TT,primary:0,mac:{primary:302}})}};W(hyi);W(gyi);W(pyi);W(myi);var mlo=[{key:"commandPalette",id:D.CommandPalette,description:d(17268,null),supportsSubmenus:!1},{key:"touchBar",id:D.TouchBarContext,description:d(17307,null),supportsSubmenus:!1},{key:"editor/title",id:D.EditorTitle,description:d(17279,null)},{key:"modalEditor/editorTitle",id:D.ModalEditorEditorTitle,description:d(17290,null)},{key:"editor/title/run",id:D.EditorTitleRun,description:d(17281,null)},{key:"editor/context",id:D.EditorContext,description:d(17275,null)},{key:"editor/context/copy",id:D.EditorContextCopy,description:d(17276,null)},{key:"editor/context/share",id:D.EditorContextShare,description:d(17277,null),proposed:"contribShareMenu"},{key:"explorer/context",id:D.ExplorerContext,description:d(17282,null)},{key:"explorer/context/share",id:D.ExplorerContextShare,description:d(17283,null),proposed:"contribShareMenu"},{key:"editor/title/context",id:D.EditorTitleContext,description:d(17278,null)},{key:"editor/title/context/share",id:D.EditorTitleContextShare,description:d(17280,null),proposed:"contribShareMenu"},{key:"debug/callstack/context",id:D.DebugCallStackContext,description:d(17269,null)},{key:"debug/variables/context",id:D.DebugVariablesContext,description:d(17272,null)},{key:"debug/watch/context",id:D.DebugWatchContext,description:d(17273,null)},{key:"debug/toolBar",id:D.DebugToolBar,description:d(17271,null)},{key:"debug/createConfiguration",id:D.DebugCreateConfiguration,proposed:"contribDebugCreateConfiguration",description:d(17270,null)},{key:"notebook/variables/context",id:D.NotebookVariablesContext,description:d(17293,null)},{key:"menuBar/home",id:D.MenubarHomeMenu,description:d(17287,null),proposed:"contribMenuBarHome",supportsSubmenus:!1},{key:"menuBar/edit/copy",id:D.MenubarCopy,description:d(17294,null)},{key:"scm/title",id:D.SCMTitle,description:d(17302,null)},{key:"scm/sourceControl",id:D.SCMSourceControl,description:d(17299,null)},{key:"scm/repositories/title",id:D.SCMSourceControlTitle,description:d(17301,null),proposed:"contribSourceControlTitleMenu"},{key:"scm/repository",id:D.SCMSourceControlInline,description:d(17300,null)},{key:"scm/resourceState/context",id:D.SCMResourceContext,description:d(17297,null)},{key:"scm/resourceFolder/context",id:D.SCMResourceFolderContext,description:d(17295,null)},{key:"scm/resourceGroup/context",id:D.SCMResourceGroupContext,description:d(17296,null)},{key:"scm/change/title",id:D.SCMChangeContext,description:d(17255,null)},{key:"scm/inputBox",id:D.SCMInputBox,description:d(17288,null),proposed:"contribSourceControlInputBoxMenu"},{key:"scm/history/title",id:D.SCMHistoryTitle,description:d(17298,null),proposed:"contribSourceControlHistoryTitleMenu"},{key:"scm/historyItem/context",id:D.SCMHistoryItemContext,description:d(17285,null),proposed:"contribSourceControlHistoryItemMenu"},{key:"scm/historyItemRef/context",id:D.SCMHistoryItemRefContext,description:d(17286,null),proposed:"contribSourceControlHistoryItemMenu"},{key:"scm/artifactGroup/context",id:D.SCMArtifactGroupContext,description:d(17254,null),proposed:"contribSourceControlArtifactGroupMenu"},{key:"scm/artifact/context",id:D.SCMArtifactContext,description:d(17253,null),proposed:"contribSourceControlArtifactMenu"},{key:"statusBar/remoteIndicator",id:D.StatusBarRemoteIndicatorMenu,description:d(17304,null),supportsSubmenus:!1},{key:"terminal/context",id:D.TerminalInstanceContext,description:d(17305,null)},{key:"terminal/title/context",id:D.TerminalTabContext,description:d(17306,null)},{key:"view/title",id:D.ViewTitle,description:d(17345,null)},{key:"viewContainer/title",id:D.ViewContainerTitle,description:d(17338,null),proposed:"contribViewContainerTitle"},{key:"view/item/context",id:D.ViewItemContext,description:d(17339,null)},{key:"comments/comment/editorActions",id:D.CommentEditorActions,description:d(17239,null),proposed:"contribCommentEditorActionsMenu"},{key:"comments/commentThread/title",id:D.CommentThreadTitle,description:d(17240,null)},{key:"comments/commentThread/context",id:D.CommentThreadActions,description:d(17238,null),supportsSubmenus:!1},{key:"comments/commentThread/additionalActions",id:D.CommentThreadAdditionalActions,description:d(17238,null),supportsSubmenus:!0,proposed:"contribCommentThreadAdditionalMenu"},{key:"comments/commentThread/title/context",id:D.CommentThreadTitleContext,description:d(17241,null),proposed:"contribCommentPeekContext"},{key:"comments/comment/title",id:D.CommentTitle,description:d(17236,null)},{key:"comments/comment/context",id:D.CommentActions,description:d(17234,null),supportsSubmenus:!1},{key:"comments/commentThread/comment/context",id:D.CommentThreadCommentContext,description:d(17235,null),proposed:"contribCommentPeekContext"},{key:"commentsView/commentThread/context",id:D.CommentsViewThreadActions,description:d(17237,null),proposed:"contribCommentsViewThreadMenus"},{key:"notebook/toolbar",id:D.NotebookToolbar,description:d(17316,null)},{key:"notebook/kernelSource",id:D.NotebookKernelSource,description:d(17315,null),proposed:"notebookKernelSource"},{key:"notebook/cell/title",id:D.NotebookCellTitle,description:d(17314,null)},{key:"notebook/cell/execute",id:D.NotebookCellExecute,description:d(17313,null)},{key:"interactive/toolbar",id:D.InteractiveToolbar,description:d(17249,null)},{key:"interactive/cell/title",id:D.InteractiveCellTitle,description:d(17248,null)},{key:"issue/reporter",id:D.IssueReporter,description:d(17250,null)},{key:"testing/item/context",id:D.TestItem,description:d(17331,null)},{key:"testing/item/gutter",id:D.TestItemGutter,description:d(17332,null)},{key:"testing/profiles/context",id:D.TestProfilesContext,description:d(17336,null)},{key:"testing/item/result",id:D.TestPeekElement,description:d(17333,null)},{key:"testing/message/context",id:D.TestMessageContext,description:d(17335,null)},{key:"testing/message/content",id:D.TestMessageContent,description:d(17334,null)},{key:"extension/context",id:D.ExtensionContext,description:d(17284,null)},{key:"timeline/title",id:D.TimelineTitle,description:d(17341,null)},{key:"timeline/item/context",id:D.TimelineItemContext,description:d(17340,null)},{key:"ports/item/context",id:D.TunnelContext,description:d(17342,null)},{key:"ports/item/origin/inline",id:D.TunnelOriginInline,description:d(17343,null)},{key:"ports/item/port/inline",id:D.TunnelPortInline,description:d(17344,null)},{key:"file/newFile",id:D.NewFile,description:d(17246,null),supportsSubmenus:!1},{key:"webview/context",id:D.WebviewContext,description:d(17368,null)},{key:"file/share",id:D.MenubarShare,description:d(17303,null),proposed:"contribShareMenu"},{key:"editor/inlineCompletions/actions",id:D.InlineCompletionsActions,description:d(17247,null),supportsSubmenus:!1,proposed:"inlineCompletionsAdditions"},{key:"editor/content",id:D.EditorContent,description:d(17308,null),proposed:"contribEditorContentMenu"},{key:"editor/lineNumber/context",id:D.EditorLineNumberContext,description:d(17245,null)},{key:"mergeEditor/result/title",id:D.MergeInputResultToolbar,description:d(17289,null),proposed:"contribMergeEditorMenus"},{key:"multiDiffEditor/content",id:D.MultiDiffEditorContent,description:d(17291,null),proposed:"contribEditorContentMenu"},{key:"multiDiffEditor/resource/title",id:D.MultiDiffEditorFileToolbar,description:d(17292,null),proposed:"contribMultiDiffEditorMenus"},{key:"diffEditor/gutter/hunk",id:D.DiffEditorHunkToolbar,description:d(17274,null),proposed:"contribDiffEditorGutterToolBarMenus"},{key:"diffEditor/gutter/selection",id:D.DiffEditorSelectionToolbar,description:d(17274,null),proposed:"contribDiffEditorGutterToolBarMenus"},{key:"searchPanel/aiResults/commands",id:D.SearchActionMenu,description:d(17326,null)},{key:"editor/context/chat",id:D.ChatTextEditorMenu,description:d(17267,null),supportsSubmenus:!1,proposed:"chatParticipantPrivate"},{key:"chat/input/editing/sessionToolbar",id:D.ChatEditingSessionChangesToolbar,description:d(17259,null),proposed:"chatSessionsProvider"},{key:"chat/input/editing/sessionApplyActions",id:D.ChatEditingSessionApplySubmenu,description:d(17258,null),proposed:"chatSessionsProvider"},{key:"chat/input/editing/sessionTitleToolbar",id:D.ChatEditingSessionTitleToolbar,description:d(17261,null),proposed:"chatSessionsProvider"},{key:"chat/input/editing/sessionChangeToolbar",id:D.ChatEditingSessionChangeToolbar,description:d(17260,null),proposed:"chatSessionsProvider"},{key:"chat/chatSessions",id:D.AgentSessionsContext,description:d(17265,null),supportsSubmenus:!1,proposed:"chatSessionsProvider"},{key:"chatSessions/newSession",id:D.AgentSessionsCreateSubMenu,description:d(17266,null),supportsSubmenus:!1,proposed:"chatSessionsProvider"},{key:"chat/multiDiff/context",id:D.ChatMultiDiffContext,description:d(17263,null),supportsSubmenus:!1,proposed:"chatSessionsProvider"},{key:"chat/customizations/create",id:D.for("AICustomizationManagementCreate"),description:d(17257,null),supportsSubmenus:!1,proposed:"chatSessionCustomizationProvider"},{key:"chat/editor/inlineGutter",id:D.ChatEditorInlineMenu,description:d(17262,null),supportsSubmenus:!1,proposed:"contribChatEditorInlineGutterMenu"},{key:"chat/contextUsage/actions",id:D.ChatContextUsageActions,description:d(17256,null),proposed:"chatParticipantAdditions"},{key:"chat/newSession",id:D.ChatNewMenu,description:d(17264,null),proposed:"chatSessionsProvider"}],HZ;(v=>{function a(b){return typeof b.command=="string"}v.isMenuItem=a;function i(b,S){return typeof b.command!="string"?(S.error(d(17323,null,"command")),!1):b.alt&&typeof b.alt!="string"?(S.error(d(17318,null,"alt")),!1):b.when&&typeof b.when!="string"?(S.error(d(17318,null,"when")),!1):b.group&&typeof b.group!="string"?(S.error(d(17318,null,"group")),!1):!0}v.isValidMenuItem=i;function e(b,S){return typeof b.submenu!="string"?(S.error(d(17323,null,"submenu")),!1):b.when&&typeof b.when!="string"?(S.error(d(17318,null,"when")),!1):b.group&&typeof b.group!="string"?(S.error(d(17318,null,"group")),!1):!0}v.isValidSubmenuItem=e;function t(b,S){if(!Array.isArray(b))return S.error(d(17322,null)),!1;for(let y of b)if(a(y)){if(!i(y,S))return!1}else if(!e(y,S))return!1;return!0}v.isValidItems=t;function o(b,S){return typeof b!="object"?(S.error(d(17321,null)),!1):typeof b.id!="string"?(S.error(d(17323,null,"id")),!1):typeof b.label!="string"?(S.error(d(17323,null,"label")),!1):!0}v.isValidSubmenu=o;let n={type:"object",required:["command"],properties:{command:{description:d(17357,null),type:"string"},alt:{description:d(17356,null),type:"string"},when:{description:d(17360,null),type:"string"},group:{description:d(17358,null),type:"string"}}},r={type:"object",required:["submenu"],properties:{submenu:{description:d(17359,null),type:"string"},when:{description:d(17360,null),type:"string"},group:{description:d(17358,null),type:"string"}}},s={type:"object",required:["id","label"],properties:{id:{description:d(17365,null),type:"string"},label:{description:d(17366,null),type:"string"},icon:{description:d(17362,null),anyOf:[{type:"string"},{type:"object",properties:{light:{description:d(17364,null),type:"string"},dark:{description:d(17363,null),type:"string"}}}]}}};v.menusContribution={description:d(17361,null),type:"object",properties:L9(mlo,b=>b.key,b=>({markdownDescription:b.proposed?d(17319,null,b.proposed,b.description):b.description,type:"array",items:b.supportsSubmenus===!1?n:{oneOf:[n,r]}})),additionalProperties:{description:"Submenu",type:"array",items:{oneOf:[n,r]}}},v.submenusContribution={description:d(17367,null),type:"array",items:s};function u(b,S){return b?uc(b.command)?(S.error(d(17323,null,"command")),!1):!h(b.title,S,"title")||b.shortTitle&&!h(b.shortTitle,S,"shortTitle")?!1:b.enablement&&typeof b.enablement!="string"?(S.error(d(17318,null,"precondition")),!1):!(b.category&&!h(b.category,S,"category")||!p(b.icon,S)):(S.error(d(17312,null)),!1)}v.isValidCommand=u;function p(b,S){return typeof b>"u"||typeof b=="string"||typeof b.dark=="string"&&typeof b.light=="string"?!0:(S.error(d(17317,null)),!1)}function h(b,S,y){return typeof b>"u"?(S.error(d(17324,null,y)),!1):typeof b=="string"&&uc(b)?(S.error(d(17323,null,y)),!1):typeof b!="string"&&(uc(b.original)||uc(b.value))?(S.error(d(17325,null,`${y}.value`,`${y}.original`)),!1):!0}let g={type:"object",required:["command","title"],properties:{command:{description:d(17349,null),type:"string"},title:{description:d(17355,null),type:"string"},shortTitle:{markdownDescription:d(17354,null),type:"string"},category:{description:d(17348,null),type:"string"},enablement:{description:d(17353,null),type:"string"},icon:{description:d(17350,null),anyOf:[{type:"string"},{type:"object",properties:{light:{description:d(17352,null),type:"string"},dark:{description:d(17351,null),type:"string"}}}]}}};v.commandsContribution={description:d(17347,null),oneOf:[g,{type:"array",items:g}]}})(HZ||={});var ulo=new N,vyi=Rn.registerExtensionPoint({extensionPoint:"commands",jsonSchema:HZ.commandsContribution,activationEventsGenerator:function*(a){for(let i of a)i.command&&(yield`onCommand:${i.command}`)}});vyi.setHandler(a=>{function i(e,t){if(!HZ.isValidCommand(e,t.collector))return;let{icon:o,enablement:n,category:r,title:s,shortTitle:l,command:c}=e,u;o&&(typeof o=="string"?u=q.fromString(o)??{dark:Ge(t.description.extensionLocation,o),light:Ge(t.description.extensionLocation,o)}:u={dark:Ge(t.description.extensionLocation,o.dark),light:Ge(t.description.extensionLocation,o.light)});let p=ve.getCommand(c);p&&(p.source?t.collector.info(d(17243,null,e.command,p.source.title,p.source.id)):t.collector.info(d(17242,null,e.command))),ulo.add(ve.addCommand({id:c,title:s,source:{id:t.description.identifier.value,title:t.description.displayName??t.description.name},shortTitle:l,tooltip:s,category:r,precondition:C.deserialize(n),icon:u}))}ulo.clear();for(let e of a){let{value:t}=e;if(Array.isArray(t))for(let o of t)i(o,e);else i(t,e)}});var ZXe=new Map,hlo=Rn.registerExtensionPoint({extensionPoint:"submenus",jsonSchema:HZ.submenusContribution});hlo.setHandler(a=>{ZXe.clear();for(let i of a){let{value:e,collector:t}=i;for(let[,o]of Object.entries(e)){if(!HZ.isValidSubmenu(o,t))continue;if(!o.id){t.warn(d(17328,null,o.id));continue}if(ZXe.has(o.id)){t.info(d(17327,null,o.id));continue}if(!o.label){t.warn(d(17329,null,o.label));continue}let n;o.icon&&(typeof o.icon=="string"?n=q.fromString(o.icon)||{dark:Ge(i.description.extensionLocation,o.icon)}:n={dark:Ge(i.description.extensionLocation,o.icon.dark),light:Ge(i.description.extensionLocation,o.icon.light)});let r={id:D.for(`api:${o.id}`),label:o.label,icon:n};ZXe.set(o.id,r)}}});var LQo=new Map(mlo.map(a=>[a.key,a])),plo=new N,fyi=new Map,RQo=Rn.registerExtensionPoint({extensionPoint:"menus",jsonSchema:HZ.menusContribution,deps:[hlo]});RQo.setHandler(a=>{plo.clear(),fyi.clear();for(let i of a){let{value:e,collector:t}=i;for(let o of Object.entries(e)){if(!HZ.isValidItems(o[1],t))continue;let n=LQo.get(o[0]);if(!n){let r=ZXe.get(o[0]);r&&(n={key:o[0],id:r.id,description:""})}if(n){if(n.proposed&&!Ua(i.description,n.proposed)){t.error(d(17320,null,o[0],n.proposed,i.description.identifier.value));continue}for(let r of o[1]){let s;if(HZ.isMenuItem(r)){let l=ve.getCommand(r.command),c=r.alt&&ve.getCommand(r.alt)||void 0;if(!l){t.error(d(17310,null,r.command));continue}r.alt&&!c&&t.warn(d(17309,null,r.alt)),r.command===r.alt&&t.info(d(17244,null)),s={command:l,alt:c,group:void 0,order:void 0,when:void 0}}else{if(n.supportsSubmenus===!1){t.error(d(17337,null));continue}let l=ZXe.get(r.submenu);if(!l){t.error(d(17311,null,r.submenu));continue}let c=fyi.get(n.id.id);if(c||(c=new Set,fyi.set(n.id.id,c)),c.has(l.id.id)){t.warn(d(17330,null,r.submenu,o[0]));continue}c.add(l.id.id),s={submenu:l.id,icon:l.icon,title:l.label,group:void 0,order:void 0,when:void 0}}if(r.group){let l=r.group.lastIndexOf("@");l>0?(s.group=r.group.substr(0,l),s.order=Number(r.group.substr(l+1))||void 0):s.group=r.group}if(n.id===D.ViewContainerTitle&&!r.when?.includes("viewContainer == workbench.view.debug")){t.error(d(17346,null,"`viewContainer/title`","`viewContainer == workbench.view.debug`",'"when"'));continue}s.when=C.deserialize(r.when),plo.add(ve.appendMenuItem(n.id,s))}}}}});var JXe=class extends x{constructor(e){super();this._keybindingService=e;this.type="table"}shouldRender(e){return!!e.contributes?.commands}render(e){let o=(e.contributes?.commands||[]).map(p=>({id:p.command,title:p.title,keybindings:[],menus:[]})),n=L9(o,p=>p.id),r=e.contributes?.menus||{},s=L9(o,p=>p.id);if(r.commandPalette)for(let p of r.commandPalette)delete s[p.command];if(Object.keys(s).length){r.commandPalette||(r.commandPalette=[]);for(let p in s)r.commandPalette.push({command:p})}for(let p in r)for(let h of r[p])if(h.when!=="false"&&h.command){let g=n[h.command];g?g.menus.includes(p)||g.menus.push(p):(g={id:h.command,title:"",keybindings:[],menus:[p]},n[g.id]=g,o.push(g))}if((e.contributes?.keybindings?Array.isArray(e.contributes.keybindings)?e.contributes.keybindings:[e.contributes.keybindings]:[]).forEach(p=>{let h=this.resolveKeybinding(p);if(!h)return;let g=n[p.command];g?g.keybindings.push(h):(g={id:p.command,title:"",keybindings:[h],menus:[]},n[g.id]=g,o.push(g))}),!o.length)return{data:{headers:[],rows:[]},dispose:()=>{}};let c=[d(17231,null),d(17232,null),d(17251,null),d(17252,null)],u=o.sort((p,h)=>p.id.localeCompare(h.id)).map(p=>[new Ie().appendMarkdown(`\`${p.id}\``),typeof p.title=="string"?p.title:p.title.value,p.keybindings,new Ie().appendMarkdown(`${p.menus.sort((h,g)=>h.localeCompare(g)).map(h=>`\`${h}\``).join("&nbsp;")}`)]);return{data:{headers:c,rows:u},dispose:()=>{}}}resolveKeybinding(e){let t;switch(jN){case"win32":t=e.win;break;case"linux":t=e.linux;break;case"darwin":t=e.mac;break}return this._keybindingService.resolveUserBinding(t??e.key)[0]}};JXe=I([m(0,_e)],JXe);ne.as(As.ExtensionFeaturesRegistry).registerExtensionFeature({id:"commands",label:d(17233,null),access:{canToggle:!1},renderer:new Ft(JXe)});var SLe=".vscode",eJe="settings",glo=`${SLe}/${eJe}.json`,flo="vscode://schemas/settings/default",vlo="vscode://schemas/settings/user",blo="vscode://schemas/settings/profile",Slo="vscode://schemas/settings/machine",rFt="vscode://schemas/settings/workspace",Ilo="vscode://schemas/settings/folder",cH="vscode://schemas/launch",Ape="vscode://schemas/tasks",ILe="vscode://schemas/mcp",Kw=[1,3],ylo=[2,4,5,6,7],byi=[4,5,6],sFt=[1,...byi],yLe=[2,3,4,5,6,7],y3=[4,5,6,7],UZ=[5,6,7],_T="tasks",R2="launch",zv="mcp",RD=Object.create(null);RD[_T]=`${SLe}/${_T}.json`;RD[R2]=`${SLe}/${R2}.json`;RD[zv]=`${SLe}/${zv}.json`;var aFt=Object.create(null);aFt[_T]=`${_T}.json`;aFt[zv]=`${zv}.json`;var fg=B,wlo=`{
	"version": "2.0.0",
	"tasks": []
}`,Ty="workbench.settings.applyToAllProfiles";var MQo=ne.as(ma.JSONContribution),lFt=ne.as(Jt.Configuration),Clo={type:"object",defaultSnippets:[{body:{title:"",properties:{}}}],properties:{title:{description:d(3470,null),type:"string"},order:{description:d(3466,null),type:"integer"},properties:{description:d(3467,null),type:"object",propertyNames:{pattern:"\\S+",patternErrorMessage:d(3469,null)},additionalProperties:{anyOf:[{title:d(3468,null),$ref:"http://json-schema.org/draft-07/schema#"},{type:"object",properties:{scope:{type:"string",enum:["application","machine","window","resource","language-overridable","machine-overridable"],default:"window",enumDescriptions:[d(3438,null),d(3448,null),d(3457,null),d(3454,null),d(3446,null),d(3447,null)],markdownDescription:d(3440,null)},enumDescriptions:{type:"array",items:{type:"string"},description:d(3442,null)},markdownEnumDescriptions:{type:"array",items:{type:"string"},description:d(3451,null)},enumItemLabels:{type:"array",items:{type:"string"},markdownDescription:d(3443,null,"`enum`")},markdownDescription:{type:"string",description:d(3450,null)},deprecationMessage:{type:"string",description:d(3439,null)},markdownDeprecationMessage:{type:"string",description:d(3449,null)},editPresentation:{type:"string",enum:["singlelineText","multilineText"],enumDescriptions:[d(3455,null),d(3452,null)],default:"singlelineText",description:d(3441,null)},order:{type:"integer",description:d(3453,null)},ignoreSync:{type:"boolean",description:d(3444,null)},keywords:{type:"array",items:{type:"string"},description:d(3445,null)},tags:{type:"array",items:{type:"string",enum:["accessibility","advanced","experimental","telemetry","usesOnlineServices"],enumDescriptions:[d(3423,null),d(3424,null),d(3431,null),d(3437,null),d(3462,null),d(3464,null)]},additionalItems:!0,markdownDescription:d(3456,null)}}}]}}}},NA,xlo=Rn.registerExtensionPoint({extensionPoint:"configurationDefaults",jsonSchema:{$ref:Ift},canHandleResolver:!0});xlo.setHandler((a,{added:i,removed:e})=>{NA&&lFt.deltaConfiguration(NA);let t=NA={};if(queueMicrotask(()=>{NA===t&&(lFt.deltaConfiguration(NA),NA=void 0)}),e.length){let o=e.map(n=>({overrides:Ji(n.value),source:{id:n.description.identifier.value,displayName:n.description.displayName}}));NA.removedDefaults=o}if(i.length){let o=lFt.getConfigurationProperties(),n=[7,4,5,6],r=i.map(s=>{let l=Ji(s.value);for(let c of Object.keys(l)){let u=o[c];if(u?.disallowConfigurationDefault){s.collector.warn(d(3427,null,c)),delete l[c];continue}if(!kg.test(c)&&u?.scope&&!n.includes(u.scope)){s.collector.warn(d(3425,null,c)),delete l[c];continue}}return{overrides:l,source:{id:s.description.identifier.value,displayName:s.description.displayName}}});NA.addedDefaults=r}});var PQo=Rn.registerExtensionPoint({extensionPoint:"configuration",deps:[xlo],jsonSchema:{description:d(3465,null),oneOf:[Clo,{type:"array",items:Clo}]},canHandleResolver:!0}),Syi=new iu;PQo.setHandler((a,{added:i,removed:e})=>{if(NA??={},e.length){let r=[];for(let s of e)r.push(...Syi.get(s.description.identifier)||[]),Syi.delete(s.description.identifier);NA.removedConfigurations=r}let t=new Set;function o(r,s){let l=Ji(r);return l.title&&typeof l.title!="string"&&s.collector.error(d(3435,null)),n(l,s),l.id=r.id||s.description.identifier.value,l.extensionInfo={id:s.description.identifier.value,displayName:s.description.displayName},l.restrictedProperties=s.description.capabilities?.untrustedWorkspaces?.supported==="limited"?s.description.capabilities?.untrustedWorkspaces.restrictedConfigurations:void 0,l.title=l.title||s.description.displayName||s.description.identifier.value,l}function n(r,s){let l=r.properties,c=ro.extensionConfigurationPolicy;if(l){typeof l!="object"&&(s.collector.error(d(3433,null)),r.properties={});for(let p in l){let h=l[p],g=bei(p,h,s.description.identifier.value);if(g){delete l[p],s.collector.warn(g);continue}if(t.has(p)&&!Sei.has(s.description.identifier.value.toLowerCase())){delete l[p],s.collector.warn(d(3426,null,p));continue}if(!xi(h)){delete l[p],s.collector.error(d(3434,null,p));continue}c?.[p]&&(h.policy=c?.[p]),h.tags?.some(f=>f.toLowerCase()==="onexp")&&(h.experiment={mode:"startup"}),t.add(p),h.scope=h.scope?Cft(h.scope.toString()):4}}let u=r.allOf;if(u){s.collector.error(d(3432,null));for(let p of u)n(p,s)}}if(i.length){let r=[];for(let s of i){let l=[],c=s.value;Array.isArray(c)?c.forEach(u=>l.push(o(u,s))):l.push(o(c,s)),Syi.set(s.description.identifier,l),r.push(...l)}NA.addedConfigurations=r}lFt.deltaConfiguration(NA),NA=void 0});MQo.registerSchema("vscode://schemas/workspaceConfig",{allowComments:!0,allowTrailingCommas:!0,default:{folders:[{path:""}],settings:{}},required:["folders"],properties:{folders:{minItems:0,uniqueItems:!0,description:d(3472,null),items:{type:"object",defaultSnippets:[{body:{path:"$1"}}],oneOf:[{properties:{path:{type:"string",description:d(3476,null)},name:{type:"string",description:d(3475,null)}},required:["path"]},{properties:{uri:{type:"string",description:d(3481,null)},name:{type:"string",description:d(3475,null)}},required:["uri"]}]}},settings:{type:"object",default:{},description:d(3478,null),$ref:rFt},launch:{type:"object",default:{configurations:[],compounds:[]},description:d(3473,null),$ref:cH},tasks:{type:"object",default:{version:"2.0.0",tasks:[]},description:d(3479,null),$ref:Ape},mcp:{type:"object",default:{inputs:[],servers:{"mcp-server-time":{command:"uvx",args:["mcp_server_time","--local-timezone=America/Los_Angeles"]}}},description:d(3474,null),$ref:ILe},extensions:{type:"object",default:{},description:d(3471,null),$ref:"vscode://schemas/extensions"},remoteAuthority:{type:"string",doNotSuggest:!0,description:d(3477,null)},transient:{type:"boolean",doNotSuggest:!0,description:d(3480,null)}},errorMessage:d(3463,null)});var Iyi=class extends x{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.configuration}render(e){let t=e.contributes?.configuration?Array.isArray(e.contributes.configuration)?e.contributes.configuration:[e.contributes.configuration]:[],o=wft(t),n=o?Object.keys(o):[],r=[d(3459,null),d(3430,null),d(3428,null)],s=n.sort((l,c)=>l.localeCompare(c)).map(l=>[new Ie().appendMarkdown(`\`${l}\``),o[l].markdownDescription?new Ie(o[l].markdownDescription,!1):o[l].description??"",new Ie().appendCodeblock("json",JSON.stringify(gn(o[l].default)?lje(o[l].type):o[l].default,null,2))]);return{data:{headers:r,rows:s},dispose:()=>{}}}};ne.as(As.ExtensionFeaturesRegistry).registerExtensionFeature({id:"configuration",label:d(3460,null),access:{canToggle:!1},renderer:new Ft(Iyi)});var yyi=class extends x{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.configurationDefaults}render(e){let t=e.contributes?.configurationDefaults??{},o=[d(3436,null),d(3458,null),d(3429,null)],n=[];for(let r of Object.keys(t).sort((s,l)=>s.localeCompare(l))){let s=t[r];if(kg.test(r)){let l=R1(r),c=new Ie().appendMarkdown(`${l.join(", ")}`);for(let u of Object.keys(s).sort((p,h)=>p.localeCompare(h))){let p=[];p.push(c),p.push(new Ie().appendMarkdown(`\`${u}\``)),p.push(new Ie().appendCodeblock("json",JSON.stringify(s[u],null,2))),n.push(p)}}else{let l=[];l.push(""),l.push(new Ie().appendMarkdown(`\`${r}\``)),l.push(new Ie().appendCodeblock("json",JSON.stringify(s,null,2))),n.push(l)}}return{data:{headers:o,rows:n},dispose:()=>{}}}};ne.as(As.ExtensionFeaturesRegistry).registerExtensionFeature({id:"configurationDefaults",label:d(3461,null),access:{canToggle:!1},renderer:new Ft(yyi)});var wLe=class extends RTe{constructor(e,t,o,n,r,s,l,c){super(e,t,r,o);this.storageService=o;this.instantiationService=n;this.contextMenuService=s;this.extensionService=l;this.contextService=c}create(e){super.create(e),this.viewPaneContainer=this._register(this.createViewPaneContainer(e)),this._register(this.viewPaneContainer.onTitleAreaUpdate(()=>this.updateTitleArea())),this.viewPaneContainer.create(e)}setVisible(e){super.setVisible(e),this.viewPaneContainer?.setVisible(e)}layout(e){this.viewPaneContainer?.layout(e)}setBoundarySashes(e){this.viewPaneContainer?.setBoundarySashes(e)}getOptimalWidth(){return this.viewPaneContainer?.getOptimalWidth()??0}openView(e,t){return this.viewPaneContainer?.openView(e,t)}getViewPaneContainer(){return this.viewPaneContainer}getActionsContext(){return this.getViewPaneContainer()?.getActionsContext()}getContextMenuActions(){return this.viewPaneContainer?.menuActions?.getContextMenuActions()??[]}getMenuIds(){let e=[];return this.viewPaneContainer?.menuActions&&(e.push(this.viewPaneContainer.menuActions.menuId),this.viewPaneContainer.isViewMergedWithContainer()&&e.push(this.viewPaneContainer.panes[0].menuActions.menuId)),e}getActions(){let e=[];if(this.viewPaneContainer?.menuActions&&(e.push(...this.viewPaneContainer.menuActions.getPrimaryActions()),this.viewPaneContainer.isViewMergedWithContainer())){let t=this.viewPaneContainer.panes[0];t.shouldShowFilterInHeader()&&e.push(pAt),e.push(...t.menuActions.getPrimaryActions())}return e}getSecondaryActions(){if(!this.viewPaneContainer?.menuActions)return[];let e=this.viewPaneContainer.isViewMergedWithContainer()?this.viewPaneContainer.panes[0].menuActions.getSecondaryActions():[],t=this.viewPaneContainer.menuActions.getSecondaryActions(),o=t.findIndex(n=>n instanceof Nc&&n.item.submenu===J4);if(o!==-1){let n=t[o];n.actions.some(({enabled:r})=>r)?t.length===1&&e.length===0?t=n.actions.slice():o!==0&&(t=[n,...t.slice(0,o),...t.slice(o+1)]):t.splice(o,1)}return t.length&&e.length?[...t,new ri,...e]:t.length?t:e}getActionViewItem(e,t){return this.viewPaneContainer?.getActionViewItem(e,t)}getTitle(){return this.viewPaneContainer?.getTitle()??""}focus(){super.focus(),this.viewPaneContainer?.focus()}};wLe=I([m(1,Te),m(2,ce),m(3,F),m(4,Le),m(5,Xe),m(6,lt),m(7,Pe)],wLe);var cFt=class a extends _Rt{constructor(e,t,o,n,r,s,l){super(e,t,o,n,r,s);this.iconUrl=l}static create(e,t,o,n,r,s,l){return new a(e,t,o,n,r,s,l)}},S0={Viewlets:"workbench.contributions.viewlets",Panels:"workbench.contributions.panels",Auxiliary:"workbench.contributions.auxiliary",ChatBar:"workbench.contributions.chatbar"},CLe=class extends DRt{registerPaneComposite(i){super.registerComposite(i)}deregisterPaneComposite(i){super.deregisterComposite(i)}getPaneComposite(i){return this.getComposite(i)}getPaneComposites(){return this.getComposites()}};ne.add(S0.Viewlets,new CLe);ne.add(S0.Panels,new CLe);ne.add(S0.Auxiliary,new CLe);ne.add(S0.ChatBar,new CLe);var dFt=class extends it{constructor(e,t){super("vs.tree.collapse",d(45,null),"collapse-all",t);this.viewer=e}async run(){this.viewer.collapseAll(),this.viewer.setSelection([]),this.viewer.setFocus([])}};function wyi(a){return Array.isArray(a.items)}function klo(a){let i=a;return!!i.picks&&i.additionalPicks instanceof Promise}var Lh=class extends x{constructor(e,t){super();this.prefix=e;this.options=t}provide(e,t,o){let n=new N;e.canAcceptInBackground=!!this.options?.canAcceptInBackground,e.matchOnLabel=e.matchOnDescription=e.matchOnDetail=e.sortByLabel=!1;let r,s=n.add(new me),l=async()=>{r?.dispose(!0),e.busy=!1;let u=s.value=new N;r=u.add(new Ye(t));let p=r.token,h=e.value.substring(this.prefix.length);this.options?.shouldSkipTrimPickFilter||(h=h.trim());let g=this._getPicks(h,u,p,o),f=(b,S)=>{let y,w;if(wyi(b)?(y=b.items,w=b.active):y=b,y.length===0){if(S)return!1;(h.length>0||e.hideInput)&&this.options?.noResultsPick&&(xL(this.options.noResultsPick)?y=[this.options.noResultsPick(h)]:y=[this.options.noResultsPick])}return e.items=y,w&&(e.activeItems=[w]),!0},v=async b=>{let S=!1,y=!1;await Promise.all([(async()=>{typeof b.mergeDelay=="number"&&(await Li(b.mergeDelay),p.isCancellationRequested)||y||(S=f(b.picks,!0))})(),(async()=>{e.busy=!0;try{let w=await b.additionalPicks;if(p.isCancellationRequested)return;let k,T;wyi(b.picks)?(k=b.picks.items,T=b.picks.active):k=b.picks;let P,O;if(wyi(w)?(P=w.items,O=w.active):P=w,P.length>0||!S){let V;if(!T&&!O){let H=e.activeItems[0];H&&k.indexOf(H)!==-1&&(V=H)}f({items:[...k,...P],active:T||O||V})}}finally{p.isCancellationRequested||(e.busy=!1),y=!0}})()])};if(g!==null)if(klo(g))await v(g);else if(!(g instanceof Promise))f(g);else{e.busy=!0;try{let b=await g;if(p.isCancellationRequested)return;klo(b)?await v(b):f(b)}finally{p.isCancellationRequested||(e.busy=!1)}}};n.add(e.onDidChangeValue(()=>l())),l(),n.add(e.onDidAccept(u=>{if(o?.handleAccept){u.inBackground||e.hide(),o.handleAccept?.(e.activeItems[0],u.inBackground);return}let[p]=e.selectedItems;if(typeof p?.accept=="function"){if(Z6i(e.keyMods)&&!!p.attach){p.attach(e.keyMods,u);return}u.inBackground||e.hide(),p.accept(e.keyMods,u)}}));let c=async(u,p)=>{if(typeof p.trigger!="function")return;let h=p.buttons?.indexOf(u)??-1;if(h>=0){let g=p.trigger(h,e.keyMods),f=typeof g=="number"?g:await g;if(t.isCancellationRequested)return;switch(f){case 0:break;case 1:e.hide();break;case 2:l();break;case 3:{let v=e.items.indexOf(p);if(v!==-1){let b=e.items.slice(),S=b.splice(v,1),y=e.activeItems.filter(k=>k!==S[0]),w=e.keepScrollPosition;e.keepScrollPosition=!0,e.items=b,y&&(e.activeItems=y),e.keepScrollPosition=w}break}}}};return n.add(e.onDidTriggerItemButton(({button:u,item:p})=>c(u,p))),n.add(e.onDidTriggerSeparatorButton(({button:u,separator:p})=>c(u,p))),n}};var xLe=new co(()=>{let a=Jc.Collator(void 0,{numeric:!0,sensitivity:"base"}).value;return{collator:a,collatorIsNumeric:a.resolvedOptions().numeric}}),kLe=new co(()=>({collator:Jc.Collator(void 0,{numeric:!0}).value})),Cyi=new co(()=>({collator:Jc.Collator(void 0,{numeric:!0,sensitivity:"accent"}).value}));function DT(a,i,e=!1){let t=a||"",o=i||"",n=xLe.value.collator.compare(t,o);return xLe.value.collatorIsNumeric&&n===0&&t!==o?t<o?-1:1:n}function tJe(a,i){let e=kLe.value.collator;return a=a||"",i=i||"",w3(e,a,i)}function Tlo(a,i){let e=kLe.value.collator;return a=a||"",i=i||"",Olo(a,i)||w3(e,a,i)}function _lo(a,i){let e=kLe.value.collator;return a=a||"",i=i||"",Nlo(a,i)||w3(e,a,i)}function Dlo(a,i){return a=a||"",i=i||"",a===i?0:a<i?-1:1}function xyi(a,i){let[e,t]=Elo(a),[o,n]=Elo(i),r=xLe.value.collator.compare(t,n);if(r===0){if(xLe.value.collatorIsNumeric&&t!==n)return t<n?-1:1;if(r=xLe.value.collator.compare(e,o),xLe.value.collatorIsNumeric&&r===0&&e!==o)return e<o?-1:1}return r}function Llo(a,i){a=a||"",i=i||"";let e=zZ(a),t=zZ(i),o=kLe.value.collator,n=Cyi.value.collator;return w3(n,e,t)||w3(o,a,i)}function Rlo(a,i){a=a||"",i=i||"";let e=zZ(a),t=zZ(i),o=kLe.value.collator,n=Cyi.value.collator;return w3(n,e,t)||Olo(a,i)||w3(o,a,i)}function Mlo(a,i){a=a||"",i=i||"";let e=zZ(a),t=zZ(i),o=kLe.value.collator,n=Cyi.value.collator;return w3(n,e,t)||Nlo(a,i)||w3(o,a,i)}function Plo(a,i){a=a||"",i=i||"";let e=zZ(a).toLowerCase(),t=zZ(i).toLowerCase();return e!==t?e<t?-1:1:a!==i?a<i?-1:1:0}var Alo=/^(.*?)(\.([^.]*))?$/;function Elo(a,i=!1){let e=a?Alo.exec(a):[],t=[e&&e[1]||"",e&&e[3]||""];return i&&(!t[0]&&t[1]||t[0]&&t[0].charAt(0)===".")&&(t=[t[0]+"."+t[1],""]),t}function zZ(a){let i=a?Alo.exec(a):[];return i&&i[1]&&i[1].charAt(0)!=="."&&i[3]||""}function w3(a,i,e){let t=a.compare(i,e);return t!==0?t:i.length!==e.length?i.length<e.length?-1:1:0}function uFt(a){let i=a.charAt(0);return i.toLocaleUpperCase()!==i}function pFt(a){let i=a.charAt(0);return i.toLocaleLowerCase()!==i}function Nlo(a,i){return uFt(a)&&pFt(i)?-1:pFt(a)&&uFt(i)?1:0}function Olo(a,i){return pFt(a)&&uFt(i)?-1:uFt(a)&&pFt(i)?1:0}function AQo(a,i,e=!1){return e||(a=a&&a.toLowerCase(),i=i&&i.toLowerCase()),a===i?0:a<i?-1:1}function KZ(a,i,e=!1){let t=a.split(Qd),o=i.split(Qd),n=t.length-1,r=o.length-1,s,l;for(let c=0;;c++){if(s=n===c,l=r===c,s&&l)return DT(t[c],o[c],e);if(s)return-1;if(l)return 1;let u=AQo(t[c],o[c],e);if(u!==0)return u}}function ELe(a,i,e){let t=a.toLowerCase(),o=i.toLowerCase(),n=NQo(a,i,e);if(n)return n;let r=t.endsWith(e),s=o.endsWith(e);if(r!==s)return r?-1:1;let l=DT(t,o);return l!==0?l:t.localeCompare(o)}function NQo(a,i,e){let t=a.toLowerCase(),o=i.toLowerCase(),n=t.startsWith(e),r=o.startsWith(e);if(n!==r)return n?-1:1;if(n&&r){if(t.length<o.length)return-1;if(t.length>o.length)return 1}return 0}var hFt=0,Flo=[hFt,[]];function Wlo(a,i,e,t){if(!a||!i)return Flo;let o=a.length,n=i.length;if(o<n)return Flo;let r=a.toLowerCase();return OQo(i,e,n,a,r,o,t)}function OQo(a,i,e,t,o,n,r){let s=[],l=[];for(let h=0;h<e;h++){let g=h*n,f=g-n,v=h>0,b=a[h],S=i[h];for(let y=0;y<n;y++){let w=y>0,k=g+y,T=k-1,P=f+y-1,O=w?s[T]:0,V=v&&w?s[P]:0,H=v&&w?l[P]:0,G;!V&&v?G=0:G=FQo(b,S,t,o,y,H),G&&V+G>=O&&(r||v||o.startsWith(i,y))?(l[k]=H+1,s[k]=V+G):(l[k]=hFt,s[k]=O)}}let c=[],u=e-1,p=n-1;for(;u>=0&&p>=0;){let h=u*n+p;l[h]===hFt||(c.push(p),u--),p--}return[s[e*n-1],c.reverse()]}function FQo(a,i,e,t,o,n){let r=0;if(!WQo(i,t[o]))return r;if(r+=1,n>0&&(r+=Math.min(n,3)*6+Math.max(0,n-3)*3),a===e[o]&&(r+=1),o===0)r+=8;else{let s=VQo(e.charCodeAt(o-1));s?r+=s:vCe(e.charCodeAt(o))&&n===0&&(r+=2)}return r}function WQo(a,i){return a===i?!0:a==="/"||a==="\\"?i==="/"||i==="\\":!1}function VQo(a){switch(a){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 zlo=[void 0,[]];function qZ(a,i,e=0,t=0){let o=i;return o.values&&o.values.length>1?BQo(a,o.values,e,t):Klo(a,i,e,t)}function BQo(a,i,e,t){let o=0,n=[];for(let r of i){let[s,l]=Klo(a,r,e,t);if(typeof s!="number")return zlo;o+=s,n.push(...l)}return[o,Tyi(n)]}function Klo(a,i,e,t){let o=rR(i.normalized,i.normalizedLowercase,e,a,a.toLowerCase(),t,{firstMatchCanBeWeak:!0,boostFullMatch:!0});return o?[o[0],xa(o)]:zlo}var gFt=Object.freeze({score:0}),mFt=1<<18,kyi=1<<17,Eyi=65536;function HQo(a,i,e,t){let o=t.values?t.values:[t];return _r({[t.normalized]:{values:o.map(r=>({value:r.normalized,expectContiguousMatch:r.expectContiguousMatch})),label:a,description:i,allowNonContiguousMatches:e}})}function GZ(a,i,e,t,o){if(!a||!i.normalized)return gFt;let n=t.getItemLabel(a);if(!n)return gFt;let r=t.getItemDescription(a),s=HQo(n,r,e,i),l=o[s];if(l)return l;let c=UQo(n,r,t.getItemPath(a),i,e);return o[s]=c,c}function UQo(a,i,e,t,o){let n=!e||!t.containsPathSeparator;return e&&(fn?t.pathNormalized===e:vr(t.pathNormalized,e))?{score:mFt,labelMatch:[{start:0,end:a.length}],descriptionMatch:i?[{start:0,end:i.length}]:void 0}:t.values&&t.values.length>1?zQo(a,i,e,t.values,n,o):Glo(a,i,e,t,n,o)}function zQo(a,i,e,t,o,n){let r=0,s=[],l=[];for(let c of t){let{score:u,labelMatch:p,descriptionMatch:h}=Glo(a,i,e,c,o,n);if(u===hFt)return gFt;r+=u,p&&s.push(...p),h&&l.push(...h)}return{score:r,labelMatch:Tyi(s),descriptionMatch:Tyi(l)}}function Glo(a,i,e,t,o,n){if(o||!i){let[r,s]=Wlo(a,t.normalized,t.normalizedLowercase,n&&!t.expectContiguousMatch);if(r){let l=Ble(t.normalized,a),c;if(l){c=kyi;let u=Math.round(t.normalized.length/a.length*100);c+=u}else c=Eyi;return{score:c+r,labelMatch:l||Vlo(s)}}}if(i){let r=i;e&&(r=`${i}${Qd}`);let s=r.length,l=`${r}${a}`,[c,u]=Wlo(l,t.normalized,t.normalizedLowercase,n&&!t.expectContiguousMatch);if(c){let p=Vlo(u),h=[],g=[];return p.forEach(f=>{f.start<s&&f.end>s?(h.push({start:0,end:f.end-s}),g.push({start:f.start,end:s})):f.start>=s?h.push({start:f.start-s,end:f.end-s}):g.push(f)}),{score:c,labelMatch:h,descriptionMatch:g}}}return gFt}function Vlo(a){let i=[];if(!a)return i;let e;for(let t of a)e&&e.end===t?e.end+=1:(e={start:t,end:t+1},i.push(e));return i}function Tyi(a){let i=a.sort((o,n)=>o.start-n.start),e=[],t;for(let o of i)!t||!KQo(t,o)?(t=o,e.push(o)):(t.start=Math.min(t.start,o.start),t.end=Math.max(t.end,o.end));return e}function KQo(a,i){return!(a.end<i.start||i.end<a.start)}function iJe(a,i,e,t,o,n){let r=GZ(a,e,t,o,n),s=GZ(i,e,t,o,n),l=r.score,c=s.score;if((l===mFt||c===mFt)&&l!==c)return l===mFt?-1:1;if(l>Eyi||c>Eyi){if(l!==c)return l>c?-1:1;if(l<kyi&&c<kyi){let b=GQo(r.labelMatch,s.labelMatch);if(b!==0)return b}let f=o.getItemLabel(a)||"",v=o.getItemLabel(i)||"";if(f.length!==v.length)return f.length-v.length}if(l!==c)return l>c?-1:1;let u=Array.isArray(r.labelMatch)&&r.labelMatch.length>0,p=Array.isArray(s.labelMatch)&&s.labelMatch.length>0;if(u&&!p)return-1;if(p&&!u)return 1;let h=Blo(a,r,o),g=Blo(i,s,o);return h&&g&&h!==g?g>h?-1:1:qQo(a,i,e,o)}function Blo(a,i,e){let t=-1,o=-1;if(i.descriptionMatch?.length?t=i.descriptionMatch[0].start:i.labelMatch?.length&&(t=i.labelMatch[0].start),i.labelMatch?.length){if(o=i.labelMatch[i.labelMatch.length-1].end,i.descriptionMatch?.length){let n=e.getItemDescription(a);n&&(o+=n.length)}}else i.descriptionMatch?.length&&(o=i.descriptionMatch[i.descriptionMatch.length-1].end);return o-t}function GQo(a,i){if(!a&&!i||!a?.length&&!i?.length)return 0;if(!i?.length)return-1;if(!a?.length)return 1;let e=a[0].start,o=a[a.length-1].end-e,n=i[0].start,s=i[i.length-1].end-n;return o===s?0:s<o?1:-1}function qQo(a,i,e,t){let o=t.getItemLabel(a)||"",n=t.getItemLabel(i)||"",r=t.getItemDescription(a),s=t.getItemDescription(i),l=o.length+(r?r.length:0),c=n.length+(s?s.length:0);if(l!==c)return l-c;let u=t.getItemPath(a),p=t.getItemPath(i);return u&&p&&u.length!==p.length?u.length-p.length:o!==n?ELe(o,n,e.normalized):r&&s&&r!==s?ELe(r,s,e.normalized):u&&p&&u!==p?ELe(u,p,e.normalized):0}function Hlo(a){return a.startsWith('"')&&a.endsWith('"')}var qlo=" ";function I0(a){typeof a!="string"&&(a="");let i=a.toLowerCase(),{pathNormalized:e,normalized:t,normalizedLowercase:o}=Ulo(a),n=e.indexOf(Qd)>=0,r=Hlo(a),s,l=a.split(qlo);if(l.length>1)for(let c of l){let u=Hlo(c),{pathNormalized:p,normalized:h,normalizedLowercase:g}=Ulo(c);h&&(s||(s=[]),s.push({original:c,originalLowercase:c.toLowerCase(),pathNormalized:p,normalized:h,normalizedLowercase:g,expectContiguousMatch:u}))}return{original:a,originalLowercase:i,pathNormalized:e,normalized:t,normalizedLowercase:o,values:s,containsPathSeparator:n,expectContiguousMatch:r}}function Ulo(a){let i;ei?i=a.replace(/\//g,Qd):i=a.replace(/\\/g,Qd);let e=i.replace(/[\*\u2026\s"]/g,"").replace(/(?<=.)#$/,"");return{pathNormalized:i,normalized:e,normalizedLowercase:e.toLowerCase()}}function TLe(a){return Array.isArray(a)?I0(a.map(i=>i.original).join(qlo)):I0(a.original)}var Npe=class extends Lh{constructor(e,t,o,n,r){super(e,{canAcceptInBackground:!0,noResultsPick:{label:d(4267,null),groupId:-1}});this.editorGroupService=t;this.editorService=o;this.modelService=n;this.languageService=r;this.pickState=new class{constructor(){this.scorerCache=Object.create(null);this.isQuickNavigating=void 0}reset(e){e||(this.scorerCache=Object.create(null)),this.isQuickNavigating=e}}}provide(e,t){return this.pickState.reset(!!e.quickNavigate),super.provide(e,t)}_getPicks(e){let t=I0(e),o=this.doGetEditorPickItems().filter(r=>{if(!t.normalized)return!0;let s=GZ(r,t,!0,EY,this.pickState.scorerCache);return s.score?(r.highlights={label:s.labelMatch,description:s.descriptionMatch},!0):!1});if(t.normalized){let r=this.editorGroupService.getGroups(2).map(s=>s.id);o.sort((s,l)=>s.groupId!==l.groupId?r.indexOf(s.groupId)-r.indexOf(l.groupId):iJe(s,l,t,!0,EY,this.pickState.scorerCache))}let n=[];if(this.editorGroupService.count>1){let r;for(let s of o){if(typeof r!="number"||r!==s.groupId){let l=this.editorGroupService.getGroup(s.groupId);l&&n.push({type:"separator",label:l.label}),r=s.groupId}n.push(s)}}else n.push(...o);return n}doGetEditorPickItems(){let e=this.doGetEditors(),t=new Map;for(let{groupId:o}of e)if(!t.has(o)){let n=this.editorGroupService.getGroup(o);n&&t.set(o,n.ariaLabel)}return this.doGetEditors().map(({editor:o,groupId:n})=>{let r=po.getOriginalUri(o,{supportSideBySide:1}),s=o.isDirty()&&!o.isSaving(),l=o.getDescription(),c=l?`${o.getName()} ${l}`:o.getName();return{groupId:n,resource:r,label:o.getName(),ariaLabel:t.size>1?s?d(4266,null,c,t.get(n)):d(4265,null,c,t.get(n)):s?d(4264,null,c):c,description:l,iconClasses:aa(this.modelService,this.languageService,r,void 0,o.getIcon()).concat(o.getLabelExtraClasses()),italic:!this.editorGroupService.getGroup(n)?.isPinned(o),buttons:[{iconClass:s?"dirty-editor "+q.asClassName(R.closeDirty):q.asClassName(R.close),tooltip:d(4263,null),alwaysVisible:s}],trigger:async()=>{let u=this.editorGroupService.getGroup(n);return u&&(await u.closeEditor(o,{preserveFocus:!0}),!u.contains(o))?3:0},accept:(u,p)=>this.editorGroupService.getGroup(n)?.openEditor(o,{preserveFocus:p.inBackground})}})}};Npe=I([m(1,wt),m(2,ee),m(3,Tt),m(4,_t)],Npe);var MD=class extends Npe{static{this.PREFIX="edt active "}constructor(i,e,t,o){super(MD.PREFIX,i,e,t,o)}doGetEditors(){let i=this.editorGroupService.activeGroup;return i.getEditors(0).map(e=>({editor:e,groupId:i.id}))}};MD=I([m(0,wt),m(1,ee),m(2,Tt),m(3,_t)],MD);var dH=class extends Npe{static{this.PREFIX="edt "}constructor(i,e,t,o){super(dH.PREFIX,i,e,t,o)}doGetEditors(){let i=[];for(let e of this.editorGroupService.getGroups(2))for(let t of e.getEditors(1))i.push({editor:t,groupId:e.id});return i}};dH=I([m(0,wt),m(1,ee),m(2,Tt),m(3,_t)],dH);var OA=class extends Npe{static{this.PREFIX="edt mru "}constructor(i,e,t,o){super(OA.PREFIX,i,e,t,o)}doGetEditors(){let i=[];for(let e of this.editorService.getEditors(0))i.push(e);return i}};OA=I([m(0,wt),m(1,ee),m(2,Tt),m(3,_t)],OA);function $Qo(a){let i=a;return typeof i?.primary=="object"&&typeof i.secondary=="object"}var _f=class extends $F{constructor(e,t,o,n,r,s,l,c,u){super(_f.ID,e,_f.VIEW_STATE_PREFERENCE_KEY,t,o,r,l,n,c,u);this.configurationService=s;this.onDidCreateEditors=this._register(new E);this._onDidChangeSizeConstraints=this._register(new Bh);this.onDidChangeSizeConstraints=U.any(this.onDidCreateEditors.event,this._onDidChangeSizeConstraints.event);this._onDidChangeSelection=this._register(new E);this.onDidChangeSelection=this._onDidChangeSelection.event;this.primaryEditorPane=void 0;this.secondaryEditorPane=void 0;this.splitviewDisposables=this._register(new N);this.editorDisposables=this._register(new N);this.dimension=new si(0,0);this.lastFocusedSide=void 0;this.orientation=this.configurationService.getValue(_f.SIDE_BY_SIDE_LAYOUT_SETTING)==="vertical"?0:1,this.registerListeners()}static{this.ID=ieo}static{this.SIDE_BY_SIDE_LAYOUT_SETTING="workbench.editor.splitInGroupLayout"}static{this.VIEW_STATE_PREFERENCE_KEY="sideBySideEditorViewState"}get minimumPrimaryWidth(){return this.primaryEditorPane?this.primaryEditorPane.minimumWidth:0}get maximumPrimaryWidth(){return this.primaryEditorPane?this.primaryEditorPane.maximumWidth:Number.POSITIVE_INFINITY}get minimumPrimaryHeight(){return this.primaryEditorPane?this.primaryEditorPane.minimumHeight:0}get maximumPrimaryHeight(){return this.primaryEditorPane?this.primaryEditorPane.maximumHeight:Number.POSITIVE_INFINITY}get minimumSecondaryWidth(){return this.secondaryEditorPane?this.secondaryEditorPane.minimumWidth:0}get maximumSecondaryWidth(){return this.secondaryEditorPane?this.secondaryEditorPane.maximumWidth:Number.POSITIVE_INFINITY}get minimumSecondaryHeight(){return this.secondaryEditorPane?this.secondaryEditorPane.minimumHeight:0}get maximumSecondaryHeight(){return this.secondaryEditorPane?this.secondaryEditorPane.maximumHeight:Number.POSITIVE_INFINITY}set minimumWidth(e){}set maximumWidth(e){}set minimumHeight(e){}set maximumHeight(e){}get minimumWidth(){return this.minimumPrimaryWidth+this.minimumSecondaryWidth}get maximumWidth(){return this.maximumPrimaryWidth+this.maximumSecondaryWidth}get minimumHeight(){return this.minimumPrimaryHeight+this.minimumSecondaryHeight}get maximumHeight(){return this.maximumPrimaryHeight+this.maximumSecondaryHeight}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>this.onConfigurationUpdated(e)))}onConfigurationUpdated(e){e.affectsConfiguration(_f.SIDE_BY_SIDE_LAYOUT_SETTING)&&(this.orientation=this.configurationService.getValue(_f.SIDE_BY_SIDE_LAYOUT_SETTING)==="vertical"?0:1,this.splitview&&this.recreateSplitview())}recreateSplitview(){let e=Ci(this.getContainer()),t=this.getSplitViewRatio();this.splitview&&(this.splitview.el.remove(),this.splitviewDisposables.clear()),this.createSplitView(e,t),this.layout(this.dimension)}getSplitViewRatio(){let e;if(this.splitview){let t=this.splitview.getViewSize(0),o=this.splitview.getViewSize(1);if(Math.abs(t-o)>1){let n=this.splitview.orientation===1?this.dimension.width:this.dimension.height;e=t/n}}return e}createEditor(e){e.classList.add("side-by-side-editor"),this.secondaryEditorContainer=_(".side-by-side-editor-container.editor-instance"),this.primaryEditorContainer=_(".side-by-side-editor-container.editor-instance"),this.createSplitView(e)}createSplitView(e,t){this.splitview=this.splitviewDisposables.add(new Ou(e,{orientation:this.orientation})),this.splitviewDisposables.add(this.splitview.onDidSashReset(()=>this.splitview?.distributeViewSizes())),this.orientation===1?this.splitview.orthogonalEndSash=this._boundarySashes?.bottom:(this.splitview.orthogonalStartSash=this._boundarySashes?.left,this.splitview.orthogonalEndSash=this._boundarySashes?.right);let o=Gl.Distribute,n=Gl.Distribute;if(t){let l=this.splitview.orientation===1?this.dimension.width:this.dimension.height;o=Math.round(l*t),n=l-o,this.splitview.layout(this.orientation===1?this.dimension.width:this.dimension.height)}let r=Ci(this.secondaryEditorContainer);this.splitview.addView({element:r,layout:l=>this.layoutPane(this.secondaryEditorPane,l),minimumSize:this.orientation===1?hT.width:hT.height,maximumSize:Number.POSITIVE_INFINITY,onDidChange:U.None},o);let s=Ci(this.primaryEditorContainer);this.splitview.addView({element:s,layout:l=>this.layoutPane(this.primaryEditorPane,l),minimumSize:this.orientation===1?hT.width:hT.height,maximumSize:Number.POSITIVE_INFINITY,onDidChange:U.None},n),this.updateStyles()}getTitle(){return this.input?this.input.getName():d(4335,null)}async setInput(e,t,o,n){let r=this.input;await super.setInput(e,t,o,n),(!r||!e.matches(r))&&(r&&this.disposeEditors(),this.createEditors(e));let{primary:s,secondary:l,viewState:c}=this.loadViewState(e,t,o);if(this.lastFocusedSide=c?.focus,typeof c?.ratio=="number"&&this.splitview){let u=this.splitview.orientation===1?this.dimension.width:this.dimension.height;this.splitview.resizeView(0,Math.round(u*c.ratio))}else this.splitview?.distributeViewSizes();await Promise.all([this.secondaryEditorPane?.setInput(e.secondary,l,o,n),this.primaryEditorPane?.setInput(e.primary,s,o,n)]),typeof t?.target=="number"&&(this.lastFocusedSide=t.target)}loadViewState(e,t,o){let n=$Qo(t?.viewState)?t?.viewState:this.loadEditorViewState(e,o),r=Object.create(null),s;return t?.target===2?s={...t}:r={...t},r.viewState=n?.primary,n?.secondary&&(s?s.viewState=n?.secondary:s={viewState:n.secondary}),{primary:r,secondary:s,viewState:n}}createEditors(e){this.secondaryEditorPane=this.doCreateEditor(e.secondary,Ci(this.secondaryEditorContainer)),this.primaryEditorPane=this.doCreateEditor(e.primary,Ci(this.primaryEditorContainer)),this.layout(this.dimension),this._onDidChangeSizeConstraints.input=U.any(U.map(this.secondaryEditorPane.onDidChangeSizeConstraints,()=>{}),U.map(this.primaryEditorPane.onDidChangeSizeConstraints,()=>{})),this.onDidCreateEditors.fire(void 0),this.editorDisposables.add(this.primaryEditorPane.onDidFocus(()=>this.onDidFocusChange(1))),this.editorDisposables.add(this.secondaryEditorPane.onDidFocus(()=>this.onDidFocusChange(2)))}doCreateEditor(e,t){let o=ne.as(qo.EditorPane).getEditorPane(e);if(!o)throw new Error("No editor pane descriptor for editor found");let n=o.instantiate(this.instantiationService,this.group);return n.create(t),n.setVisible(this.isVisible()),Hde(n)&&this.editorDisposables.add(n.onDidChangeSelection(r=>this._onDidChangeSelection.fire(r))),this.editorDisposables.add(n),n}onDidFocusChange(e){this.lastFocusedSide=e,this._onDidChangeControl.fire()}getSelection(){let e=this.getLastFocusedEditorPane();if(Hde(e)){let t=e.getSelection();if(t)return new _yi(t,e===this.primaryEditorPane?1:2)}}setOptions(e){super.setOptions(e),typeof e?.target=="number"&&(this.lastFocusedSide=e.target),this.getLastFocusedEditorPane()?.setOptions(e)}setEditorVisible(e){this.primaryEditorPane?.setVisible(e),this.secondaryEditorPane?.setVisible(e),super.setEditorVisible(e)}clearInput(){super.clearInput(),this.primaryEditorPane?.clearInput(),this.secondaryEditorPane?.clearInput(),this.disposeEditors()}focus(){super.focus(),this.getLastFocusedEditorPane()?.focus()}getLastFocusedEditorPane(){return this.lastFocusedSide===2?this.secondaryEditorPane:this.primaryEditorPane}layout(e){this.dimension=e,Ci(this.splitview).layout(this.orientation===1?e.width:e.height)}setBoundarySashes(e){this._boundarySashes=e,this.splitview&&(this.splitview.orthogonalEndSash=e.bottom)}layoutPane(e,t){e?.layout(this.orientation===1?new si(t,this.dimension.height):new si(this.dimension.width,t))}getControl(){return this.getLastFocusedEditorPane()?.getControl()}getPrimaryEditorPane(){return this.primaryEditorPane}getSecondaryEditorPane(){return this.secondaryEditorPane}tracksEditorViewState(e){return e instanceof Ma}computeEditorViewState(e){if(!this.input||!Qe(e,this.toEditorViewStateResource(this.input)))return;let t=this.primaryEditorPane?.getViewState(),o=this.secondaryEditorPane?.getViewState();if(!(!t||!o))return{primary:t,secondary:o,focus:this.lastFocusedSide,ratio:this.getSplitViewRatio()}}toEditorViewStateResource(e){let t,o;if(e instanceof Ma&&(t=e.primary.resource,o=e.secondary.resource),!(!o||!t))return A.from({scheme:"sideBySide",path:`${F9(o.toString())}${F9(t.toString())}`})}updateStyles(){super.updateStyles(),this.primaryEditorContainer&&(this.orientation===1?(this.primaryEditorContainer.style.borderLeftWidth="1px",this.primaryEditorContainer.style.borderLeftStyle="solid",this.primaryEditorContainer.style.borderLeftColor=this.getColor(mZi)??"",this.primaryEditorContainer.style.borderTopWidth="0"):(this.primaryEditorContainer.style.borderTopWidth="1px",this.primaryEditorContainer.style.borderTopStyle="solid",this.primaryEditorContainer.style.borderTopColor=this.getColor(pZi)??"",this.primaryEditorContainer.style.borderLeftWidth="0"))}dispose(){this.disposeEditors(),super.dispose()}disposeEditors(){this.editorDisposables.clear(),this.secondaryEditorPane=void 0,this.primaryEditorPane=void 0,this.lastFocusedSide=void 0,this.secondaryEditorContainer&&Rt(this.secondaryEditorContainer),this.primaryEditorContainer&&Rt(this.primaryEditorContainer)}};_f=I([m(1,Te),m(2,F),m(3,Le),m(4,ce),m(5,B),m(6,Fn),m(7,ee),m(8,wt)],_f);var _yi=class a{constructor(i,e){this.selection=i;this.side=e}compare(i){return i instanceof a?this.side!==i.side?3:this.selection.compare(i.selection):3}restore(i){let e={...i,target:this.side};return this.selection.restore(e)}};function LT(a,i,e){let t=!1,o=jQo(a);if(Z5(o)&&(i.restoreViewState(o),t=!0),a.selection){let n={startLineNumber:a.selection.startLineNumber,startColumn:a.selection.startColumn,endLineNumber:a.selection.endLineNumber??a.selection.startLineNumber,endColumn:a.selection.endColumn??a.selection.startColumn};i.setSelection(n,a.selectionSource??"code.navigation"),a.selectionRevealType===2?i.revealRangeNearTop(n,e):a.selectionRevealType===3?i.revealRangeNearTopIfOutsideViewport(n,e):a.selectionRevealType===1?i.revealRangeInCenterIfOutsideViewport(n,e):i.revealRangeInCenter(n,e),t=!0}return t}function jQo(a){if(!a.selection||!a.viewState)return a.viewState;let i=a.viewState;if(i.modified)return i.modified.cursorState=[],i;let e=a.viewState;return e.cursorState&&(e.cursorState=[]),e}var PD=class extends $R{constructor(e,t,o,n,r,s,l,c,u,p){super(PD.ID,e,t,o,n,r,l,s,c,u);this.preferencesService=p;this.diffEditorControl=void 0;this.inputLifecycleStopWatch=void 0;this._previousViewModel=null}static{this.ID=WX}get scopedContextKeyService(){if(!this.diffEditorControl)return;let e=this.diffEditorControl.getOriginalEditor(),t=this.diffEditorControl.getModifiedEditor();return(e.hasTextFocus()?e:t).invokeWithinContext(o=>o.get(X))}getTitle(){return this.input?this.input.getName():d(4339,null)}createEditorControl(e,t){this.diffEditorControl=this._register(this.instantiationService.createInstance(op,e,t,{}))}updateEditorControlOptions(e){this.diffEditorControl?.updateOptions(e)}getMainControl(){return this.diffEditorControl?.getModifiedEditor()}async setInput(e,t,o,n){this._previousViewModel&&(this._previousViewModel.dispose(),this._previousViewModel=null),this.inputLifecycleStopWatch=void 0,await super.setInput(e,t,o,n);try{let r=await e.resolve();if(n.isCancellationRequested)return;if(!(r instanceof HEe)){this.openAsBinary(e,t);return}let s=Ci(this.diffEditorControl),l=r,c=l.textDiffEditorModel?s.createViewModel(l.textDiffEditorModel):null;this._previousViewModel=c,await c?.waitForDiff(),s.setModel(c);let u=!1;Z5(t?.viewState)||(u=this.restoreTextDiffEditorViewState(e,t,o,s));let p=!1;t&&(p=LT(t,s,1)),!p&&!u&&s.revealFirstDiff(),s.updateOptions({...this.getReadonlyConfiguration(l.modifiedModel?.isReadonly()),originalEditable:!l.originalModel?.isReadonly()}),s.handleInitialized(),this.inputLifecycleStopWatch=new Dn(!1)}catch(r){await this.handleSetInputError(r,e,t)}}async handleSetInputError(e,t,o){if(this.isFileBinaryError(e))return this.openAsBinary(t,o);if(e.fileOperationResult===7){let n;throw e instanceof MO?n=d(4338,null,vl.formatSize(e.size)):n=d(4337,null),LEe(this.group,t,o,n,this.preferencesService)}throw e}restoreTextDiffEditorViewState(e,t,o,n){let r=this.loadEditorViewState(e,o);return r?(t?.selection&&r.modified&&(r.modified.cursorState=[]),n.restoreViewState(r),t?.revealIfVisible&&n.revealFirstDiff(),!0):!1}openAsBinary(e,t){let o=e.original,n=e.modified,r=this.instantiationService.createInstance(Pa,e.getName(),e.getDescription(),o,n,!0),s=ne.as(qo.EditorFactory).getFileEditorFactory();s.isFileEditor(o)&&o.setForceOpenAsBinary(),s.isFileEditor(n)&&n.setForceOpenAsBinary(),this.group.replaceEditors([{editor:e,replacement:r,options:{...t,activation:3,pinned:this.group.isPinned(e),sticky:this.group.isSticky(e)}}])}setOptions(e){super.setOptions(e),e&&LT(e,Ci(this.diffEditorControl),0)}shouldHandleConfigurationChangeEvent(e,t){return super.shouldHandleConfigurationChangeEvent(e,t)?!0:e.affectsConfiguration(t,"diffEditor")||e.affectsConfiguration(t,"accessibility.verbosity.diffEditor")}computeConfiguration(e){let t=super.computeConfiguration(e);if(xi(e.diffEditor)){let n=Ji(e.diffEditor);n.diffCodeLens=n.codeLens,delete n.codeLens,n.diffWordWrap=n.wordWrap,delete n.wordWrap,Object.assign(t,n)}let o=e.accessibility?.verbosity?.diffEditor??!1;return t.accessibilityVerbose=o,t}getConfigurationOverrides(e){return{...super.getConfigurationOverrides(e),...this.getReadonlyConfiguration(this.input?.isReadonly()),originalEditable:this.input instanceof Pa&&!this.input.original.isReadonly(),lineDecorationsWidth:"2ch"}}updateReadonly(e){e instanceof Pa?this.diffEditorControl?.updateOptions({...this.getReadonlyConfiguration(e.isReadonly()),originalEditable:!e.original.isReadonly()}):super.updateReadonly(e)}isFileBinaryError(e){return Array.isArray(e)?e.some(o=>this.isFileBinaryError(o)):e.textFileOperationResult===0}clearInput(){this._previousViewModel&&(this._previousViewModel.dispose(),this._previousViewModel=null),super.clearInput();let e=this.inputLifecycleStopWatch?.elapsed();this.inputLifecycleStopWatch=void 0,typeof e=="number"&&this.logInputLifecycleTelemetry(e,this.getControl()?.getModel()?.modified?.getLanguageId()),this.diffEditorControl?.setModel(null)}logInputLifecycleTelemetry(e,t){let o=!1;this.diffEditorControl instanceof op&&(o=this.diffEditorControl.collapseUnchangedRegions),this.telemetryService.publicLog2("diffEditor.editorVisibleTime",{editorVisibleTimeMs:e,languageId:t??"",collapseUnchangedRegions:o})}getControl(){return this.diffEditorControl}focus(){super.focus(),this.diffEditorControl?.focus()}hasFocus(){return this.diffEditorControl?.hasTextFocus()||super.hasFocus()}setEditorVisible(e){super.setEditorVisible(e),e?this.diffEditorControl?.onVisible():this.diffEditorControl?.onHide()}layout(e){this.diffEditorControl?.layout(e)}setBoundarySashes(e){this.diffEditorControl?.setBoundarySashes(e)}tracksEditorViewState(e){return e instanceof Pa}computeEditorViewState(e){if(!this.diffEditorControl)return;let t=this.diffEditorControl.getModel();if(!t?.modified||!t.original)return;let o=this.toEditorViewStateResource(t);if(o&&Qe(o,e))return this.diffEditorControl.saveViewState()??void 0}toEditorViewStateResource(e){let t,o;if(e instanceof Pa?(t=e.original.resource,o=e.modified.resource):ka(e)||(t=e.original.uri,o=e.modified.uri),!(!t||!o))return A.from({scheme:"diff",path:`${F9(t.toString())}${F9(o.toString())}`})}};PD=I([m(1,Te),m(2,F),m(3,ce),m(4,Fn),m(5,ee),m(6,Le),m(7,wt),m(8,fe),m(9,Go)],PD);var fFt="toggle.diff.renderSideBySide",vFt="workbench.action.compareEditor.nextChange",bFt="workbench.action.compareEditor.previousChange",Lyi="workbench.action.compareEditor.focusPrimarySide",Ryi="workbench.action.compareEditor.focusSecondarySide",Myi="workbench.action.compareEditor.focusOtherSide",$lo="workbench.action.compareEditor.openSide",Pyi="toggle.diff.ignoreTrimWhitespace",SFt="workbench.action.compareEditor.swapSides";function jlo(){Ct.registerCommandAndKeybindingRule({id:$lo,weight:200,when:pe.inDiffEditor,primary:Vi(2089,1069),handler:async s=>{let l=s.get(ee),c=l.activeEditor,u=l.activeTextEditorControl;if(!mc(u)||!(c instanceof Pa))return;let p;return u.getOriginalEditor().hasTextFocus()?p=c.original:p=c.modified,l.openEditor(p)}}),ve.appendMenuItem(D.CommandPalette,{command:{id:$lo,title:L(3924,"Open Active Diff Side")}}),Ct.registerCommandAndKeybindingRule({id:vFt,weight:200,when:T6e,primary:575,handler:(s,...l)=>i(s,l,!0)}),ve.appendMenuItem(D.CommandPalette,{command:{id:vFt,title:L(3923,"Go to Next Change")}}),Ct.registerCommandAndKeybindingRule({id:bFt,weight:200,when:T6e,primary:1599,handler:(s,...l)=>i(s,l,!1)}),ve.appendMenuItem(D.CommandPalette,{command:{id:bFt,title:L(3925,"Go to Previous Change")}});function a(s,l){let c=s.get(ee),u=l.length>0&&l[0]instanceof A?l[0]:void 0;for(let p of[c.activeEditorPane,...c.visibleEditorPanes])if(p instanceof PD&&(!u||p.input instanceof Pa&&Qe(p.input.primary.resource,u)))return p}function i(s,l,c){let u=a(s,l);u&&u.getControl()?.goToDiff(c?"next":"previous")}let e;(u=>(u[u.Original=0]="Original",u[u.Modified=1]="Modified",u[u.Toggle=2]="Toggle"))(e||={});function t(s,l,c){let u=a(s,l);if(u)switch(c){case 0:u.getControl()?.getOriginalEditor().focus();break;case 1:u.getControl()?.getModifiedEditor().focus();break;case 2:return u.getControl()?.getModifiedEditor().hasWidgetFocus()?t(s,l,0):t(s,l,1)}}function o(s,l){let c=s.get(Fn),p=a(s,l)?.getControl()?.getModifiedEditor()?.getModel();if(!p)return;let h="diffEditor.renderSideBySide",g=c.getValue(p.uri,h);c.updateValue(p.uri,h,!g)}function n(s,l){let c=s.get(Fn),p=a(s,l)?.getControl()?.getModifiedEditor()?.getModel();if(!p)return;let h="diffEditor.ignoreTrimWhitespace",g=c.getValue(p.uri,h);c.updateValue(p.uri,h,!g)}async function r(s,l){let c=s.get(ee),u=a(s,l),p=u?.group,h=u?.input;if(!u||typeof p>"u"||!(h instanceof Pa)||!h.modified.resource)return;let g=h.toUntyped({preserveViewState:p.id,preserveResource:!0});if(g){if(h.modified.isModified()&&c.findEditors({resource:h.modified.resource,typeId:h.modified.typeId,editorId:h.modified.editorId}).length===0){let f={...g.modified};f.options||(f.options={}),f.options.pinned=!0,f.options.inactive=!0,await c.openEditor(f,p)}await c.replaceEditors([{editor:h,replacement:{...g,original:g.modified,modified:g.original,options:{...g.options,pinned:!0}}}],p)}}Ct.registerCommandAndKeybindingRule({id:fFt,weight:200,when:void 0,primary:void 0,handler:(s,...l)=>o(s,l)}),Ct.registerCommandAndKeybindingRule({id:Lyi,weight:200,when:void 0,primary:void 0,handler:(s,...l)=>t(s,l,1)}),Ct.registerCommandAndKeybindingRule({id:Ryi,weight:200,when:void 0,primary:void 0,handler:(s,...l)=>t(s,l,0)}),Ct.registerCommandAndKeybindingRule({id:Myi,weight:200,when:void 0,primary:void 0,handler:(s,...l)=>t(s,l,2)}),Ct.registerCommandAndKeybindingRule({id:Pyi,weight:200,when:void 0,primary:void 0,handler:(s,...l)=>n(s,l)}),Ct.registerCommandAndKeybindingRule({id:SFt,weight:200,when:void 0,primary:void 0,handler:(s,...l)=>r(s,l)}),ve.appendMenuItem(D.CommandPalette,{command:{id:fFt,title:L(3927,"Toggle Inline View"),category:d(3922,null)},when:bS}),ve.appendMenuItem(D.CommandPalette,{command:{id:SFt,title:L(3926,"Swap Left and Right Editor Side"),category:d(3922,null)},when:C.and(bS,zEe)})}function Dp(a,i,e,t){let o=QQo(a,i,e,t),n=o.length&&o[0].preserveFocus||!1,r={groupedEditors:[],preserveFocus:n};for(let s of o){let l=JQo(s,e);if(!l)continue;let{group:c,editor:u}=l,p;for(let h of r.groupedEditors)if(h.group.id===c.id){p=h;break}p||(p={group:c,editors:[]},r.groupedEditors.push(p)),u&&p.editors.push(u)}return r}function QQo(a,i,e,t){let o=t.lastFocusedList,n=o instanceof Cc&&o.getHTMLElement()===Nn(),r=XQo(a,n,i,e,t);if(!r){let l=e.activeGroup,c=l.activeEditor;r={groupId:l.id,editorIndex:c?l.getIndexOfEditor(c):void 0},n=!1}let s=Qlo(r,n,i,e,t);return YQo(r,s)}function YQo(a,i){if(i.length<=1)return i;let e=i.findIndex(t=>t.groupId===a.groupId&&t.editorIndex===a.editorIndex);if(e!==-1)i.splice(e,1),i.unshift(a);else if(a.editorIndex===void 0)i.unshift(a);else throw new Error("Editor context not found in multi editor context");return i}function XQo(a,i,e,t,o){let n=a.filter(r=>Ude(r)||A.isUri(r));for(let r of n)if(Ude(r))return r;for(let r of n){let s=e.findEditors(r);if(s.length){let l=s[0],c=t.getGroup(l.groupId);return{groupId:l.groupId,editorIndex:c?.getIndexOfEditor(l.editor)}}}if(i){let r=o.lastFocusedList;for(let s of r.getFocusedElements())if(Ylo(s))return Ayi(s,void 0,t)}}function Qlo(a,i,e,t,o){if(i){let r=o.lastFocusedList.getSelectedElements().filter(Ylo);if(r.length>1)return r.map(s=>Ayi(s,a.preserveFocus,t));if(r.length===0)return Qlo(a,!1,e,t,o)}else{let n=t.getGroup(a.groupId),r=a.editorIndex!==void 0?n?.getEditorByIndex(a.editorIndex):n?.activeEditor;if(n&&r&&n.isSelected(r))return n.selectedEditors.map(s=>Ayi({editor:s,groupId:n.id},a.preserveFocus,t))}return[a]}function Ayi(a,i,e){if(zde(a))return{groupId:a.id,editorIndex:void 0,preserveFocus:i};let t=e.getGroup(a.groupId);return{groupId:a.groupId,editorIndex:t?t.getIndexOfEditor(a.editor):-1,preserveFocus:i}}function Ylo(a){return zde(a)||v6e(a)}function JQo(a,i){let e=i.getGroup(a.groupId);if(!e)return;if(a.editorIndex===void 0)return{group:e,editor:void 0};let t=e.getEditorByIndex(a.editorIndex);return{group:e,editor:t}}var Ope="workbench.action.closeUnmodifiedEditors",C3="workbench.action.closeEditorsInGroup",oJe="workbench.action.closeEditorsAndGroup",IFt="workbench.action.closeEditorsToTheRight",dx="workbench.action.closeActiveEditor",Nyi="workbench.action.closeActivePinnedEditor",yFt="workbench.action.closeGroup",DLe="workbench.action.closeOtherEditors",P2="moveActiveEditor",A2="copyActiveEditor",N2="layoutEditorGroups",wFt="workbench.action.keepEditor",Oyi="workbench.action.toggleKeepEditors",CFt="workbench.action.toggleEditorGroupLock",xFt="workbench.action.lockEditorGroup",x3="workbench.action.unlockEditorGroup",Fyi="workbench.action.showEditorsInGroup",LLe="workbench.action.reopenWithEditor",ZQo="reopenActiveEditorWith",kFt="workbench.action.pinEditor",k3="workbench.action.unpinEditor",$Z="workbench.action.splitEditor",E3="workbench.action.splitEditorUp",O2="workbench.action.splitEditorDown",T3="workbench.action.splitEditorLeft",F2="workbench.action.splitEditorRight",RLe="workbench.action.moveEditorToAboveGroup",MLe="workbench.action.moveEditorToBelowGroup",PLe="workbench.action.moveEditorToLeftGroup",ALe="workbench.action.moveEditorToRightGroup",NLe="workbench.action.toggleMaximizeEditorGroup",EFt="workbench.action.splitEditorInGroup",e6o="workbench.action.toggleSplitEditorInGroup",TFt="workbench.action.joinEditorInGroup",Wyi="workbench.action.toggleSplitEditorInGroupLayout",Vyi="workbench.action.focusFirstSideEditor",Byi="workbench.action.focusSecondSideEditor",t6o="workbench.action.focusOtherSideEditor",i6o="workbench.action.focusLeftGroupWithoutWrap",o6o="workbench.action.focusRightGroupWithoutWrap",n6o="workbench.action.focusAboveGroupWithoutWrap",r6o="workbench.action.focusBelowGroupWithoutWrap",Xlo="workbench.action.openEditorAtIndex",nJe="workbench.action.moveEditorToNewWindow",rJe="workbench.action.copyEditorToNewWindow",_Ft="workbench.action.moveEditorGroupToNewWindow",DFt="workbench.action.copyEditorGroupToNewWindow",LFt="workbench.action.newEmptyEditorWindow",Hyi="workbench.action.closeModalEditor",Uyi="workbench.action.moveModalEditorToMain",zyi="workbench.action.moveModalEditorToWindow",Kyi="workbench.action.toggleModalEditorMaximized",Gyi="workbench.action.navigateModalEditorPrevious",qyi="workbench.action.navigateModalEditorNext",vg="_workbench.open",cx="_workbench.diff",s6o="_workbench.openWith",RFt=[$Z,dx,k3,x3,NLe],Jlo=function(a){return!(!xi(a)||!Fe(a.to)||!gn(a.by)&&!Fe(a.by)||!gn(a.value)&&!Yo(a.value))};function a6o(){let a={type:"object",required:["to"],properties:{to:{type:"string",enum:["left","right"]},by:{type:"string",enum:["tab","group"]},value:{type:"number"}}};Ct.registerCommandAndKeybindingRule({id:P2,weight:200,when:pe.editorTextFocus,primary:0,handler:(n,r)=>i(!0,r,n),metadata:{description:d(4203,null),args:[{name:d(4202,null),description:d(4201,null),constraint:Jlo,schema:a}]}}),Ct.registerCommandAndKeybindingRule({id:A2,weight:200,when:pe.editorTextFocus,primary:0,handler:(n,r)=>i(!1,r,n),metadata:{description:d(4200,null),args:[{name:d(4199,null),description:d(4198,null),constraint:Jlo,schema:a}]}}),[{id:RLe,to:"up"},{id:MLe,to:"down"},{id:PLe,to:"left"},{id:ALe,to:"right"}].forEach(({id:n,to:r})=>{$e.registerCommand(n,function(s,...l){let c=Dp(l,s.get(ee),s.get(wt),s.get(Io));c.groupedEditors.length&&o(!0,{to:r,by:"group"},c.groupedEditors[0].group,c.groupedEditors[0].editors,s)})});function i(n,r=Object.create(null),s){r.to=r.to||"right",r.by=r.by||"tab",r.value=typeof r.value=="number"?r.value:1;let l=s.get(wt).activeGroup,c=l.selectedEditors;if(c.length>0)switch(r.by){case"tab":if(n)return e(r,l,c);break;case"group":return o(n,r,l,c,s)}}function e(n,r,s){let l=n.to;l==="first"||l==="right"?s=[...s].reverse():l==="position"&&(n.value??1)<r.getIndexOfEditor(s[0])&&(s=[...s].reverse());for(let c of s)t(n,r,c)}function t(n,r,s){let l=r.getIndexOfEditor(s);switch(n.to){case"first":l=0;break;case"last":l=r.count-1;break;case"left":l=l-(n.value??1);break;case"right":l=l+(n.value??1);break;case"center":l=Math.round(r.count/2)-1;break;case"position":l=(n.value??1)-1;break}l=l<0?0:l>=r.count?r.count-1:l,r.moveEditor(s,r,{index:l})}function o(n,r,s,l,c){let u=c.get(wt),p=c.get(B),h;switch(r.to){case"left":h=u.findGroup({direction:2},s),h||(h=u.addGroup(s,2));break;case"right":h=u.findGroup({direction:3},s),h||(h=u.addGroup(s,3));break;case"up":h=u.findGroup({direction:0},s),h||(h=u.addGroup(s,0));break;case"down":h=u.findGroup({direction:1},s),h||(h=u.addGroup(s,1));break;case"first":h=u.findGroup({location:0},s);break;case"last":h=u.findGroup({location:1},s);break;case"previous":if(h=u.findGroup({location:3},s),!h){let g=uy(p)===3?2:0;h=u.addGroup(s,g)}break;case"next":h=u.findGroup({location:2},s),h||(h=u.addGroup(s,uy(p)));break;case"center":h=u.getGroups(2)[u.count/2-1];break;case"position":h=u.getGroups(2)[(r.value??1)-1];break}if(h){let g=yJ(s,l);n?s.moveEditors(g,h):s.id!==h.id&&s.copyEditors(g,h),h.focus()}}}function l6o(){function a(i,e){if(!e||typeof e!="object")return;i.get(wt).applyLayout(e)}$e.registerCommand(N2,(i,e)=>{a(i,e)}),$e.registerCommand({id:"vscode.setEditorLayout",handler:(i,e)=>a(i,e),metadata:{description:`Set the editor layout. Editor layout is represented as a tree of groups in which the first group is the root group of the layout.
					The orientation of the first group is 0 (horizontal) by default unless specified otherwise. The other orientations are 1 (vertical).
					The orientation of subsequent groups is the opposite of the orientation of the group that contains it.
					Here are some examples: A layout representing 1 row and 2 columns: { orientation: 0, groups: [{}, {}] }.
					A layout representing 3 rows and 1 column: { orientation: 1, groups: [{}, {}, {}] }.
					A layout representing 3 rows and 1 column in which the second row has 2 columns: { orientation: 1, groups: [{}, { groups: [{}, {}] }, {}] }
					`,args:[{name:"args",schema:{type:"object",required:["groups"],properties:{orientation:{type:"number",default:0,description:"The orientation of the root group in the layout. 0 for horizontal, 1 for vertical.",enum:[0,1],enumDescriptions:[d(4204,null),d(4205,null)]},groups:{$ref:"#/definitions/editorGroupsSchema",default:[{},{}]}}}}]}}),$e.registerCommand({id:"vscode.getEditorLayout",handler:i=>i.get(wt).getLayout(),metadata:{description:"Get Editor Layout",args:[],returns:"An editor layout object, in the same format as vscode.setEditorLayout"}})}function c6o(){function a(i,e,t){return i?[{...i.editorOptions,...e??Object.create(null)},i.sideBySide?In:t]:[e,t]}$e.registerCommand({id:"vscode.open",handler:(i,e)=>{i.get(ge).executeCommand(vg,e)},metadata:{description:"Opens the provided resource in the editor.",args:[{name:"Uri"}]}}),$e.registerCommand(vg,async function(i,e,t,o,n){let r=i.get(ee),s=i.get(wt),l=i.get(Je),c=i.get(An),u=i.get(B),p=i.get(fD),h=typeof e=="string"?e:A.from(e,!0),[g,f]=t??[];if(f||typeof g=="number"||ec(h,Q.untitled)){let[v,b]=a(n,f,g),S=A.isUri(h)?h:A.parse(h),y;p.isUntitledWithAssociatedResource(S)?y={resource:S.with({scheme:c.defaultUriScheme}),forceUntitled:!0,options:v,label:o}:y={resource:S,options:v,label:o},await r.openEditor(y,wk(s,u,b))}else{if(ec(h,Q.command))return;await l.open(h,{openToSide:n?.sideBySide,editorOptions:n?.editorOptions})}}),$e.registerCommand({id:"vscode.diff",handler:(i,e,t,o)=>{i.get(ge).executeCommand(cx,e,t,o)},metadata:{description:"Opens the provided resources in the diff editor to compare their contents.",args:[{name:"left",description:"Left-hand side resource of the diff editor"},{name:"right",description:"Right-hand side resource of the diff editor"},{name:"title",description:"Human readable title for the diff editor"}]}}),$e.registerCommand(cx,async function(i,e,t,o,n,r){let s=i.get(ee),l=i.get(wt),c=i.get(B),[u,p]=n??[],[h,g]=a(r,p,u),f,v;typeof o=="string"?f=o:o&&(f=o.label,v=o.description),await s.openEditor({original:{resource:A.from(e,!0)},modified:{resource:A.from(t,!0)},label:f,description:v,options:h},wk(l,c,g))}),$e.registerCommand(s6o,async(i,e,t,o)=>{let n=i.get(ee),r=i.get(wt),s=i.get(B),[l,c]=o??[];await n.openEditor({resource:A.from(e,!0),options:{pinned:!0,...c,override:t}},wk(r,s,l))}),$e.registerCommand({id:"vscode.changes",handler:(i,e,t)=>{i.get(ge).executeCommand("_workbench.changes",e,t)},metadata:{description:"Opens a list of resources in the changes editor to compare their contents.",args:[{name:"title",description:"Human readable title for the diff editor"},{name:"resources",description:"List of resources to open in the changes editor"}]}}),$e.registerCommand("_workbench.changes",async(i,e,t)=>{let o=i.get(ee),n=[];for(let[r,s,l]of t)n.push({resource:A.revive(r),original:{resource:A.revive(s)},modified:{resource:A.revive(l)}});await o.openEditor({resources:n,label:e})}),$e.registerCommand("_workbench.openMultiDiffEditor",async(i,e)=>{let t=i.get(ee),o=e.resources?.map(l=>({original:{resource:A.revive(l.originalUri)},modified:{resource:A.revive(l.modifiedUri)}})),n=e.reveal?.modifiedUri?A.revive(e.reveal.modifiedUri):void 0,r=n&&o?o.find(l=>Qe(l.modified.resource,n)):void 0;e.reveal&&!r&&console.error("Reveal resource not found");let s={viewState:r?{revealData:{resource:{original:r.original.resource,modified:r.modified.resource},range:e.reveal?.range}}:void 0};await t.openEditor({multiDiffSource:e.multiDiffSourceUri?A.revive(e.multiDiffSourceUri):void 0,resources:o,label:e.title,options:s})})}function d6o(){let a=(e,t)=>{let o=e.get(ee),n=o.activeEditorPane;if(n&&typeof t=="number"){let r=n.group.getEditorByIndex(t);r&&o.openEditor(r)}};$e.registerCommand({id:Xlo,handler:a});for(let e=0;e<9;e++){let t=e,o=e+1;Ct.registerCommandAndKeybindingRule({id:Xlo+o,weight:200,when:void 0,primary:512|i(o),mac:{primary:256|i(o)},handler:n=>a(n,t)})}function i(e){switch(e){case 0:return 21;case 1:return 22;case 2:return 23;case 3:return 24;case 4:return 25;case 5:return 26;case 6:return 27;case 7:return 28;case 8:return 29;case 9:return 30}throw new Error("invalid index")}}function u6o(){for(let e=1;e<8;e++)Ct.registerCommandAndKeybindingRule({id:a(e),weight:200,when:void 0,primary:2048|i(e),handler:t=>{let o=t.get(wt),n=t.get(B);if(e>o.count)return;let r=o.getGroups(2);if(r[e])return r[e].focus();let s=uy(n),l=o.findGroup({location:1});if(!l)return;o.addGroup(l,s).focus()}});function a(e){switch(e){case 1:return"workbench.action.focusSecondEditorGroup";case 2:return"workbench.action.focusThirdEditorGroup";case 3:return"workbench.action.focusFourthEditorGroup";case 4:return"workbench.action.focusFifthEditorGroup";case 5:return"workbench.action.focusSixthEditorGroup";case 6:return"workbench.action.focusSeventhEditorGroup";case 7:return"workbench.action.focusEighthEditorGroup"}throw new Error("Invalid index")}function i(e){switch(e){case 1:return 23;case 2:return 24;case 3:return 25;case 4:return 26;case 5:return 27;case 6:return 28;case 7:return 29}throw new Error("Invalid index")}}function $yi(a,i,e){if(!e.groupedEditors.length)return;let{group:t,editors:o}=e.groupedEditors[0],n=e.preserveFocus,r=a.addGroup(t,i);for(let s of o)s&&!s.hasCapability(8)&&t.copyEditor(s,r,{preserveFocus:n});r.focus()}function p6o(){[{id:E3,direction:0},{id:O2,direction:1},{id:T3,direction:2},{id:F2,direction:3}].forEach(({id:a,direction:i})=>{$e.registerCommand(a,function(e,...t){let o=Dp(t,e.get(ee),e.get(wt),e.get(Io));$yi(e.get(wt),i,o)})})}function m6o(){function a(e,t,...o){let n=e.get(wt),r=e.get(ee),s;if(t||o.length?s=!1:s=n.partOptions.preventPinnedEditorClose==="keyboard"||n.partOptions.preventPinnedEditorClose==="keyboardAndMouse",s){let u=n.activeGroup,p=u.activeEditor;if(p&&u.isSticky(p)){let h=u.getEditors(0,{excludeSticky:!0})[0];if(h)return u.openEditor(h);let g=r.getEditors(0,{excludeSticky:!0})[0];if(g)return Promise.resolve(n.getGroup(g.groupId)?.openEditor(g.editor))}}let l=Dp(o,e.get(ee),e.get(wt),e.get(Io)),c=l.preserveFocus;return Promise.all(l.groupedEditors.map(async({group:u,editors:p})=>{let h=p.filter(g=>!s||!u.isSticky(g));await u.closeEditors(h,{preserveFocus:c})}))}Ct.registerCommandAndKeybindingRule({id:dx,weight:200,when:void 0,primary:2101,win:{primary:2110,secondary:[2101]},handler:(e,...t)=>a(e,!1,...t)}),$e.registerCommand(Nyi,(e,...t)=>a(e,!0,...t)),Ct.registerCommandAndKeybindingRule({id:C3,weight:200,when:void 0,primary:Vi(2089,53),handler:(e,...t)=>{let o=Dp(t,e.get(ee),e.get(wt),e.get(Io));return Promise.all(o.groupedEditors.map(async({group:n})=>{await n.closeAllEditors({excludeSticky:!0})}))}}),Ct.registerCommandAndKeybindingRule({id:yFt,weight:200,when:C.and(jde,SS),primary:2101,win:{primary:2110,secondary:[2101]},handler:(e,...t)=>{let o=e.get(wt),n=Dp(t,e.get(ee),o,e.get(Io));n.groupedEditors.length&&o.removeGroup(n.groupedEditors[0].group)}}),Ct.registerCommandAndKeybindingRule({id:Ope,weight:200,when:void 0,primary:Vi(2089,51),handler:(e,...t)=>{let o=Dp(t,e.get(ee),e.get(wt),e.get(Io));return Promise.all(o.groupedEditors.map(async({group:n})=>{await n.closeEditors({savedOnly:!0,excludeSticky:!0},{preserveFocus:o.preserveFocus})}))}}),Ct.registerCommandAndKeybindingRule({id:DLe,weight:200,when:void 0,primary:void 0,mac:{primary:2610},handler:(e,...t)=>{let o=Dp(t,e.get(ee),e.get(wt),e.get(Io));return Promise.all(o.groupedEditors.map(async({group:n,editors:r})=>{let s=n.getEditors(1,{excludeSticky:!0}).filter(l=>!r.includes(l));for(let l of r)l&&n.pinEditor(l);await n.closeEditors(s,{preserveFocus:o.preserveFocus})}))}}),Ct.registerCommandAndKeybindingRule({id:IFt,weight:200,when:void 0,primary:void 0,handler:async(e,...t)=>{let o=Dp(t,e.get(ee),e.get(wt),e.get(Io));if(o.groupedEditors.length){let{group:n,editors:r}=o.groupedEditors[0];n.activeEditor&&n.pinEditor(n.activeEditor),await n.closeEditors({direction:1,except:r[0],excludeSticky:!0},{preserveFocus:o.preserveFocus})}}}),Ct.registerCommandAndKeybindingRule({id:LLe,weight:200,when:void 0,primary:void 0,handler:(e,...t)=>i(e,0,...t)}),Ct.registerCommandAndKeybindingRule({id:ZQo,weight:200,when:void 0,primary:void 0,handler:(e,t,...o)=>i(e,t??0,...o)});async function i(e,t,...o){let n=e.get(ee),r=e.get(Ka),s=e.get(Te),l=Dp(o,n,e.get(wt),e.get(Io)),c=new Map;for(let{group:u,editors:p}of l.groupedEditors)for(let h of p){let g=h.toUntyped();if(!g)return;g.options={...n.activeEditorPane?.options,override:t};let f=await r.resolveEditor(g,u);if(!J5(f))return;let v=c.get(u);v||(v=[],c.set(u,v)),v.push({editor:h,replacement:f.editor,forceReplaceDirty:h.resource?.scheme===Q.untitled,options:f.options}),s.publicLog2("workbenchEditorReopen",{scheme:h.resource?.scheme??"",ext:h.resource?es(h.resource):"",from:h.editorId??"",to:f.editor.editorId??""})}for(let[u,p]of c)await u.replaceEditors(p),await u.openEditor(p[0].replacement)}$e.registerCommand(oJe,async(e,...t)=>{let o=e.get(wt),n=Dp(t,e.get(ee),o,e.get(Io));if(n.groupedEditors.length){let{group:r}=n.groupedEditors[0];await r.closeAllEditors(),r.count===0&&o.getGroup(r.id)&&o.removeGroup(r)}})}function h6o(){let a=[{id:i6o,direction:2},{id:o6o,direction:3},{id:n6o,direction:0},{id:r6o,direction:1}];for(let i of a)$e.registerCommand(i.id,async e=>{let t=e.get(wt);(t.findGroup({direction:i.direction},t.activeGroup,!1)??t.activeGroup).focus()})}function g6o(){async function a(e,t){let o=e.get(F);if(!t.groupedEditors.length)return;let{group:n,editors:r}=t.groupedEditors[0],s=r[0];s&&await n.replaceEditors([{editor:s,replacement:o.createInstance(Ma,void 0,void 0,s,s),forceReplaceDirty:!0}])}W(class extends K{constructor(){super({id:EFt,title:L(4216,"Split Editor in Group"),category:Ve.View,precondition:wB,f1:!0,keybinding:{weight:200,when:wB,primary:Vi(2089,3165)}})}run(e,...t){return a(e,Dp(t,e.get(ee),e.get(wt),e.get(Io)))}});async function i(e){if(!e.groupedEditors.length)return;let{group:t,editors:o}=e.groupedEditors[0],n=o[0];if(!n||!(n instanceof Ma))return;let r,s=t.activeEditorPane;if(s instanceof _f&&t.activeEditor===n){for(let l of[s.getPrimaryEditorPane(),s.getSecondaryEditorPane()])if(l?.hasFocus()){r={viewState:l.getViewState()};break}}await t.replaceEditors([{editor:n,replacement:n.primary,options:r}])}W(class extends K{constructor(){super({id:TFt,title:L(4209,"Join Editor in Group"),category:Ve.View,precondition:VC,f1:!0,keybinding:{weight:200,when:VC,primary:Vi(2089,3165)}})}run(e,...t){return i(Dp(t,e.get(ee),e.get(wt),e.get(Io)))}}),W(class extends K{constructor(){super({id:e6o,title:L(4218,"Toggle Split Editor in Group"),category:Ve.View,precondition:C.or(wB,VC),f1:!0})}async run(e,...t){let o=Dp(t,e.get(ee),e.get(wt),e.get(Io));if(!o.groupedEditors.length)return;let{editors:n}=o.groupedEditors[0];n[0]instanceof Ma?await i(o):n[0]&&await a(e,o)}}),W(class extends K{constructor(){super({id:Wyi,title:L(4220,"Toggle Layout of Split Editor in Group"),category:Ve.View,precondition:VC,f1:!0})}async run(e){let t=e.get(B),o=t.getValue(_f.SIDE_BY_SIDE_LAYOUT_SETTING),n;return o!=="horizontal"?n="horizontal":n="vertical",t.updateValue(_f.SIDE_BY_SIDE_LAYOUT_SETTING,n)}})}function f6o(){W(class extends K{constructor(){super({id:Vyi,title:L(4206,"Focus First Side in Active Editor"),category:Ve.View,precondition:C.or(VC,bS),f1:!0})}async run(a){let i=a.get(ee),e=a.get(ge),t=i.activeEditorPane;t instanceof _f?t.getSecondaryEditorPane()?.focus():t instanceof PD&&await e.executeCommand(Ryi)}}),W(class extends K{constructor(){super({id:Byi,title:L(4208,"Focus Second Side in Active Editor"),category:Ve.View,precondition:C.or(VC,bS),f1:!0})}async run(a){let i=a.get(ee),e=a.get(ge),t=i.activeEditorPane;t instanceof _f?t.getPrimaryEditorPane()?.focus():t instanceof PD&&await e.executeCommand(Lyi)}}),W(class extends K{constructor(){super({id:t6o,title:L(4207,"Focus Other Side in Active Editor"),category:Ve.View,precondition:C.or(VC,bS),f1:!0})}async run(a){let i=a.get(ee),e=a.get(ge),t=i.activeEditorPane;t instanceof _f?t.getPrimaryEditorPane()?.hasFocus()?t.getSecondaryEditorPane()?.focus():t.getPrimaryEditorPane()?.focus():t instanceof PD&&await e.executeCommand(Myi)}})}function v6o(){Ct.registerCommandAndKeybindingRule({id:wFt,weight:200,when:void 0,primary:Vi(2089,3),handler:async(i,...e)=>{let t=Dp(e,i.get(ee),i.get(wt),i.get(Io));for(let{group:o,editors:n}of t.groupedEditors)for(let r of n)o.pinEditor(r)}}),$e.registerCommand({id:Oyi,handler:i=>{let e=i.get(B),o=e.getValue("workbench.editor.enablePreview")!==!0;e.updateValue("workbench.editor.enablePreview",o)}});function a(i,e,...t){let n=Dp(t,i.get(ee),i.get(wt),i.get(Io)).groupedEditors[0]?.group;n?.lock(e??!n.isLocked)}W(class extends K{constructor(){super({id:CFt,title:L(4217,"Toggle Editor Group Lock"),category:Ve.View,f1:!0})}async run(i,...e){a(i,void 0,...e)}}),W(class extends K{constructor(){super({id:xFt,title:L(4210,"Lock Editor Group"),category:Ve.View,precondition:aT.toNegated(),f1:!0})}async run(i,...e){a(i,!0,...e)}}),W(class extends K{constructor(){super({id:x3,title:L(4221,"Unlock Editor Group"),precondition:aT,category:Ve.View,f1:!0})}async run(i,...e){a(i,!1,...e)}}),Ct.registerCommandAndKeybindingRule({id:kFt,weight:200,when:VR.toNegated(),primary:Vi(2089,1027),handler:async(i,...e)=>{let t=Dp(e,i.get(ee),i.get(wt),i.get(Io));for(let{group:o,editors:n}of t.groupedEditors)for(let r of n)o.stickEditor(r)}}),Ct.registerCommandAndKeybindingRule({id:k3,weight:200,when:VR,primary:Vi(2089,1027),handler:async(i,...e)=>{let t=Dp(e,i.get(ee),i.get(wt),i.get(Io));for(let{group:o,editors:n}of t.groupedEditors)for(let r of n)o.unstickEditor(r)}}),Ct.registerCommandAndKeybindingRule({id:Fyi,weight:200,when:void 0,primary:void 0,handler:(i,...e)=>{let t=i.get(wt),o=i.get(Ue),r=Dp(e,i.get(ee),t,i.get(Io)).groupedEditors[0]?.group;return r&&t.activateGroup(r),o.quickAccess.show(MD.PREFIX)}})}function b6o(){W(class extends K{constructor(){super({id:Uyi,title:L(4212,"Open Modal Editor in Main Window"),category:Ve.View,f1:!0,icon:R.openInProduct,precondition:xB,menu:{id:D.ModalEditorTitle,group:"navigation",order:0,when:wb.negate()}})}async run(a){let i=a.get(wt);for(let e of i.parts)if(_Le(e)){await e.close({mergeAllEditorsToMainPart:!0});break}}}),W(class extends K{constructor(){super({id:zyi,title:L(4211,"Open Modal Editor in New Window"),category:Ve.View,f1:!0,icon:R.emptyWindow,precondition:xB,menu:{id:D.ModalEditorTitle,group:"navigation",order:0,when:wb}})}async run(a){let i=a.get(wt);for(let e of i.parts)if(_Le(e)){let t=await i.createAuxiliaryEditorPart();for(let o of e.getGroups(1))o.moveEditors(o.editors.map(n=>({editor:n,options:{preserveFocus:!0}})),t.activeGroup);t.activeGroup.focus(),await e.close();break}}}),W(class extends K{constructor(){super({id:Kyi,title:L(4219,"Maximize Modal Editor"),category:Ve.View,f1:!0,precondition:xB,icon:R.screenFull,toggled:{condition:zDt,title:d(4215,null)},menu:{id:D.ModalEditorTitle,group:"navigation",order:1}})}run(a){let i=a.get(wt);for(let e of i.parts)if(_Le(e)){e.toggleMaximized();break}}}),W(class extends K{constructor(){super({id:Hyi,title:L(4197,"Close Modal Editor"),category:Ve.View,f1:!0,icon:R.close,precondition:xB,keybinding:[{primary:9,weight:210,when:pe.focus.toNegated()},{primary:9,weight:99,when:pe.focus}],menu:{id:D.ModalEditorTitle,group:"navigation",order:2}})}async run(a){let i=a.get(wt);for(let e of i.parts)if(_Le(e)){await e.close();break}}}),W(class extends K{constructor(){super({id:Gyi,title:L(4214,"Navigate to Previous Item in Modal Editor"),category:Ve.View,precondition:C.and(xB,Qde),keybinding:{primary:528,weight:210,when:C.and(xB,Qde)}})}run(a){let i=a.get(wt);for(let e of i.parts)if(_Le(e)){let t=e.navigation;t&&t.current>0&&t.navigate(t.current-1);break}}}),W(class extends K{constructor(){super({id:qyi,title:L(4213,"Navigate to Next Item in Modal Editor"),category:Ve.View,precondition:C.and(xB,Qde),keybinding:{primary:530,weight:210,when:C.and(xB,Qde)}})}run(a){let i=a.get(wt);for(let e of i.parts)if(_Le(e)){let t=e.navigation;t&&t.current<t.total-1&&t.navigate(t.current+1);break}}})}function _Le(a){let i=a;return!!i&&typeof i.close=="function"&&typeof i.onWillClose=="function"&&typeof i.toggleMaximized=="function"&&typeof i.maximized=="boolean"&&typeof i.updateOptions=="function"&&!!i.modalElement&&i.windowId===ut.vscodeWindowId}function eco(){a6o(),l6o(),jlo(),c6o(),d6o(),m6o(),v6o(),g6o(),f6o(),u6o(),p6o(),h6o(),b6o()}var MFt=class extends x{constructor(){super(...arguments);this._onDidChangeCheckboxState=this._register(new E);this.onDidChangeCheckboxState=this._onDidChangeCheckboxState.event}setCheckboxState(e){this._onDidChangeCheckboxState.fire([e])}},sJe=class a extends x{constructor(e,t,o,n){super();this.checkboxStateHandler=t;this.hoverDelegate=o;this.hoverService=n;this.checkboxContainer=e}static{this.checkboxClass="custom-view-tree-node-item-checkbox"}render(e){e.checkbox&&(this.toggle?this.toggle.checked=e.checkbox.isChecked:this.createCheckbox(e))}createCheckbox(e){e.checkbox&&(this.toggle=new Ev("",e.checkbox.isChecked,{...qf,size:15}),this.setHover(e.checkbox),this.setAccessibilityInformation(e.checkbox),this.toggle.domNode.classList.add(a.checkboxClass),this.toggle.domNode.tabIndex=1,M(this.checkboxContainer,this.toggle.domNode),this.registerListener(e))}registerListener(e){this.toggle&&(this._register({dispose:()=>this.removeCheckbox()}),this._register(this.toggle),this._register(this.toggle.onChange(()=>{this.setCheckbox(e)})))}setHover(e){this.toggle&&(this.hover?this.hover.update(e.tooltip):this.hover=this._register(this.hoverService.setupManagedHover(this.hoverDelegate,this.toggle.domNode,this.checkboxHoverContent(e))))}setCheckbox(e){this.toggle&&e.checkbox&&(e.checkbox.isChecked=this.toggle.checked,this.setHover(e.checkbox),this.setAccessibilityInformation(e.checkbox),this.checkboxStateHandler.setCheckboxState(e))}checkboxHoverContent(e){return e.tooltip?e.tooltip:e.isChecked?d(4529,null):d(4530,null)}setAccessibilityInformation(e){this.toggle&&e.accessibilityInformation&&(this.toggle.setTitle(e.accessibilityInformation.label),e.accessibilityInformation.role&&(this.toggle.domNode.role=e.accessibilityInformation.role))}removeCheckbox(){let e=this.checkboxContainer.children;for(let t of e)t.remove()}};var FLe=le("accessibleViewInformationService"),OLe=class extends x{constructor(e){super();this._storageService=e}hasShownAccessibleView(e){return this._storageService.getBoolean(`${Z$e}${e}`,-1,!1)===!0}};OLe=I([m(0,ce)],OLe);var AD=class extends Gs{constructor(i,e,t,o,n,r,s,l,c,u,p,h){super({...i,titleMenuId:D.ViewTitle,donotForwardArgs:!1},e,t,o,n,r,s,l,c,p,h);let{treeView:g}=ne.as(Mn.ViewsRegistry).getView(i.id);this.treeView=g,this._register(this.treeView.onDidChangeActions(()=>this.updateActions(),this)),this._register(this.treeView.onDidChangeTitle(f=>this.updateTitle(f))),this._register(this.treeView.onDidChangeDescription(f=>this.updateTitleDescription(f))),this._register(Z(()=>{this._container&&this.treeView.container&&this._container===this.treeView.container&&this.treeView.setVisibility(!1)})),this._register(this.onDidChangeBodyVisibility(()=>this.updateTreeVisibility())),this._register(this.treeView.onDidChangeWelcomeState(()=>this._onDidChangeViewWelcomeState.fire())),i.title!==this.treeView.title&&this.updateTitle(this.treeView.title),i.titleDescription!==this.treeView.description&&this.updateTitleDescription(this.treeView.description),this._actionRunner=this._register(new PFt(u,()=>this.treeView.getSelection())),this.updateTreeVisibility()}focus(){super.focus(),this.treeView.focus()}renderBody(i){this._container=i,super.renderBody(i),this.renderTreeView(i)}shouldShowWelcome(){return(this.treeView.dataProvider===void 0||!!this.treeView.dataProvider.isTreeEmpty)&&(this.treeView.message===void 0||this.treeView.message==="")}layoutBody(i,e){super.layoutBody(i,e),this.layoutTreeView(i,e)}getOptimalWidth(){return this.treeView.getOptimalWidth()}renderTreeView(i){this.treeView.show(i)}layoutTreeView(i,e){this.treeView.layout(i,e)}updateTreeVisibility(){this.treeView.setVisibility(this.isBodyVisible())}getActionRunner(){return this._actionRunner}getActionsContext(){return{$treeViewId:this.id,$focusedTreeItem:!0,$selectedTreeItems:!0}}};AD=I([m(1,_e),m(2,Xe),m(3,B),m(4,X),m(5,Bi),m(6,F),m(7,Je),m(8,Le),m(9,Ne),m(10,nt),m(11,FLe)],AD);var cJe=class{constructor(){this.label={label:"root"};this.handle="0";this.parentHandle=void 0;this.collapsibleState=2;this.children=void 0}};function ico(a){let i=$e.getCommand(a);if(i)return ve.getCommand(i.id)?.precondition}function oco(a,i){let e=a.originalId?a.originalId:a.id,t=ico(e);return t?i.contextMatchesRules(t):!0}function tco(a){return!!a&&typeof a!="string"&&!!a.element&&!!a.disposables}var S6o=d(4533,null),I6o=new Y("customTreeView",!1),jyi=class extends rp{},WLe=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super();this.id=e;this._title=t;this.themeService=o;this.instantiationService=n;this.commandService=r;this.configurationService=s;this.progressService=l;this.contextMenuService=c;this.keybindingService=u;this.notificationService=p;this.viewDescriptorService=h;this.hoverService=g;this.contextKeyService=f;this.activityService=v;this.logService=b;this.openerService=S;this.markdownRendererService=y;this.isVisible=!1;this._hasIconForParentNode=!1;this._hasIconForLeafNode=!1;this.focused=!1;this._canSelectMany=!1;this._manuallyManageCheckboxes=!1;this.elementsToRefresh=[];this.lastSelection=[];this._onDidExpandItem=this._register(new E);this._onDidCollapseItem=this._register(new E);this._onDidChangeSelectionAndFocus=this._register(new E);this._onDidChangeVisibility=this._register(new E);this._onDidChangeActions=this._register(new E);this._onDidChangeWelcomeState=this._register(new E);this._onDidChangeTitle=this._register(new E);this._onDidChangeDescription=this._register(new E);this._onDidChangeCheckboxState=this._register(new E);this._onDidCompleteRefresh=this._register(new E);this._isInitialized=!1;this._activity=this._register(new me);this.activated=!1;this.treeDisposables=this._register(new N);this._height=0;this._width=0;this.refreshing=!1;this.root=new cJe,this.lastActive=this.root}get onDidExpandItem(){return this._onDidExpandItem.event}get onDidCollapseItem(){return this._onDidCollapseItem.event}get onDidChangeSelectionAndFocus(){return this._onDidChangeSelectionAndFocus.event}get onDidChangeVisibility(){return this._onDidChangeVisibility.event}get onDidChangeActions(){return this._onDidChangeActions.event}get onDidChangeWelcomeState(){return this._onDidChangeWelcomeState.event}get onDidChangeTitle(){return this._onDidChangeTitle.event}get onDidChangeDescription(){return this._onDidChangeDescription.event}get onDidChangeCheckboxState(){return this._onDidChangeCheckboxState.event}initialize(){this._isInitialized||(this._isInitialized=!0,this.contextKeyService.bufferChangeEvents(()=>{this.initializeShowCollapseAllAction(),this.initializeCollapseAllToggle(),this.initializeShowRefreshAction()}),this.treeViewDnd=this.instantiationService.createInstance(lJe,this.id),this._dragAndDropController&&(this.treeViewDnd.controller=this._dragAndDropController),this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration("explorer.decorations")&&this.doRefresh([this.root])})),this._register(this.viewDescriptorService.onDidChangeLocation(({views:e,from:t,to:o})=>{e.some(n=>n.id===this.id)&&this.tree?.updateOptions({overrideStyles:h2(this.viewLocation).listOverrideStyles})})),this.registerActions(),this.create())}get viewContainer(){return this.viewDescriptorService.getViewContainerByViewId(this.id)}get viewLocation(){return this.viewDescriptorService.getViewLocationById(this.id)}get dragAndDropController(){return this._dragAndDropController}set dragAndDropController(e){this._dragAndDropController=e,this.treeViewDnd&&(this.treeViewDnd.controller=e)}get dataProvider(){return this._dataProvider}set dataProvider(e){if(e){this.visible&&this.activate();let t=this;this._dataProvider=new class{constructor(){this._isEmpty=!0;this._onDidChangeEmpty=new E;this.onDidChangeEmpty=this._onDidChangeEmpty.event}get isTreeEmpty(){return this._isEmpty}async getChildren(o){return(await this.getChildrenBatch(o?[o]:void 0))?.[0]}updateEmptyState(o,n){if(o.length===1&&o[0]instanceof cJe){let r=this._isEmpty;this._isEmpty=n.length===0||n[0].length===0,r!==this._isEmpty&&this._onDidChangeEmpty.fire()}}findCheckboxesUpdated(o,n){if(n.length===0)return[];let r=[];for(let s=0;s<o.length;s++){let l=o[s],c=n[s];for(let u of c)u.parent=l,!t.manuallyManageCheckboxes&&l?.checkbox?.isChecked===!0&&u.checkbox?.isChecked===!1&&(u.checkbox.isChecked=!0,r.push(u))}return r}async getChildrenBatch(o){let n,r=[];if(o?.every(s=>!!s.children))n=o.map(s=>s.children);else{o=o??[t.root];let s=await(o.length===1&&o[0]instanceof cJe?Xyi(e,void 0):Xyi(e,o));for(let l=0;l<o.length;l++){let c=o[l];c.children=s?s[l]:void 0}n=s??[],r=this.findCheckboxesUpdated(o,n)}return this.updateEmptyState(o,n),r.length>0&&t._onDidChangeCheckboxState.fire(r),n}},this._dataProvider.onDidChangeEmpty&&this._register(this._dataProvider.onDidChangeEmpty(()=>{this.updateCollapseAllToggle(),this._onDidChangeWelcomeState.fire()})),this.updateMessage(),this.refresh()}else this._dataProvider=void 0,this.treeDisposables.clear(),this.activated=!1,this.updateMessage();this._onDidChangeWelcomeState.fire()}get message(){return this._message}set message(e){this._message=e,this.updateMessage(),this._onDidChangeWelcomeState.fire()}get title(){return this._title}set title(e){this._title=e,this.tree&&(this.tree.ariaLabel=this._title),this._onDidChangeTitle.fire(this._title)}get description(){return this._description}set description(e){this._description=e,this._onDidChangeDescription.fire(this._description)}get badge(){return this._badge}set badge(e){if(!(this._badge?.value===e?.value&&this._badge?.tooltip===e?.tooltip))if(this._badge=e,e){let t={badge:new Rd(e.value,()=>e.tooltip),priority:50};this._activity.value=this.activityService.showViewActivity(this.id,t)}else this._activity.clear()}get canSelectMany(){return this._canSelectMany}set canSelectMany(e){let t=this._canSelectMany;this._canSelectMany=e,this._canSelectMany!==t&&this.tree?.updateOptions({multipleSelectionSupport:this.canSelectMany})}get manuallyManageCheckboxes(){return this._manuallyManageCheckboxes}set manuallyManageCheckboxes(e){this._manuallyManageCheckboxes=e}get hasIconForParentNode(){return this._hasIconForParentNode}get hasIconForLeafNode(){return this._hasIconForLeafNode}get visible(){return this.isVisible}initializeShowCollapseAllAction(e=!1){return this.collapseAllContext||(this.collapseAllContextKey=new Y(`treeView.${this.id}.enableCollapseAll`,e,d(4535,null,this.id)),this.collapseAllContext=this.collapseAllContextKey.bindTo(this.contextKeyService)),!0}get showCollapseAllAction(){return this.initializeShowCollapseAllAction(),!!this.collapseAllContext?.get()}set showCollapseAllAction(e){this.initializeShowCollapseAllAction(e),this.collapseAllContext?.set(e)}initializeShowRefreshAction(e=!1){this.refreshContext||(this.refreshContextKey=new Y(`treeView.${this.id}.enableRefresh`,e,d(4536,null,this.id)),this.refreshContext=this.refreshContextKey.bindTo(this.contextKeyService))}get showRefreshAction(){return this.initializeShowRefreshAction(),!!this.refreshContext?.get()}set showRefreshAction(e){this.initializeShowRefreshAction(e),this.refreshContext?.set(e)}registerActions(){let e=this;this._register(W(class extends K{constructor(){super({id:`workbench.actions.treeView.${e.id}.refresh`,title:d(4534,null),menu:{id:D.ViewTitle,when:C.and(C.equals("view",e.id),e.refreshContextKey),group:"navigation",order:Number.MAX_SAFE_INTEGER-1},icon:R.refresh})}async run(){return e.refresh()}})),this._register(W(class extends K{constructor(){super({id:`workbench.actions.treeView.${e.id}.collapseAll`,title:d(4531,null),menu:{id:D.ViewTitle,when:C.and(C.equals("view",e.id),e.collapseAllContextKey),group:"navigation",order:Number.MAX_SAFE_INTEGER},precondition:e.collapseAllToggleContextKey,icon:R.collapseAll})}async run(){if(e.tree)return new dFt(e.tree,!0).run()}}))}setVisibility(e){this.initialize(),e=!!e,this.isVisible!==e&&(this.isVisible=e,this.tree&&(this.isVisible?un(this.tree.getHTMLElement()):vo(this.tree.getHTMLElement()),this.isVisible&&this.elementsToRefresh.length&&this.dataProvider&&(this.doRefresh(this.elementsToRefresh),this.elementsToRefresh=[])),pC(()=>{this.dataProvider&&this._onDidChangeVisibility.fire(this.isVisible)}),this.visible&&this.activate())}focus(e=!0,t){if(this.tree&&this.root.children&&this.root.children.length>0){let o=t??this.tree.getSelection()[0];o&&e&&this.tree.reveal(o,.5),this.tree.domFocus()}else this.tree&&this.treeContainer&&!this.treeContainer.classList.contains("hide")?this.tree.domFocus():this.domNode.focus()}show(e){this._container=e,M(e,this.domNode)}create(){this.domNode=_(".tree-explorer-viewlet-tree-view"),this.messageElement=M(this.domNode,_(".message")),this.updateMessage(),this.treeContainer=M(this.domNode,_(".customview-tree")),this.treeContainer.classList.add("file-icon-themable-tree","show-file-icons");let e=this._register(qn(this.domNode));this._register(e.onDidFocus(()=>this.focused=!0)),this._register(e.onDidBlur(()=>this.focused=!1))}createTree(){this.treeDisposables.clear();let e=Bs.bind(void 0,this.instantiationService),t=this.treeDisposables.add(this.instantiationService.createInstance(aJe,this.id));this.treeLabels=this.treeDisposables.add(this.instantiationService.createInstance(Nl,this));let o=this.instantiationService.createInstance(Jyi,this,p=>this.progressService.withProgress({location:this.id},()=>p)),n=this.treeDisposables.add(new Zyi(this.themeService,this.logService)),r=this.treeDisposables.add(new MFt),s=this.treeDisposables.add(this.instantiationService.createInstance(_3,this.id,t,this.treeLabels,e,n,r,()=>this.manuallyManageCheckboxes));this.treeDisposables.add(s.onDidChangeCheckboxState(p=>this._onDidChangeCheckboxState.fire(p)));let l=this._title;this.tree=this.treeDisposables.add(this.instantiationService.createInstance(jyi,this.id,this.treeContainer,new Yyi,[s],o,{identityProvider:new Qyi,accessibilityProvider:{getAriaLabel(p){if(p.accessibilityInformation)return p.accessibilityInformation.label;if(Fe(p.tooltip))return p.tooltip;{if(p.resourceUri&&!p.label)return null;let h="";if(p.label){let g=Ar(p.label.label)?p.label.label.value:p.label.label;h+=g+" "}return p.description&&(h+=p.description),h}},getRole(p){return p.accessibilityInformation?.role??"treeitem"},getWidgetAriaLabel(){return l}},keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:p=>p.label?Ar(p.label.label)?p.label.label.value:p.label.label:p.resourceUri?He(A.revive(p.resourceUri)):void 0},expandOnlyOnTwistieClick:p=>!!p.command||!!p.checkbox||this.configurationService.getValue("workbench.tree.expandMode")==="doubleClick",collapseByDefault:p=>p.collapsibleState!==2,multipleSelectionSupport:this.canSelectMany,dnd:this.treeViewDnd,overrideStyles:h2(this.viewLocation).listOverrideStyles})),this.treeDisposables.add(s.onDidChangeMenuContext(p=>p.forEach(h=>this.tree?.rerender(h)))),this.treeDisposables.add(this.tree),t.setContextKeyService(this.tree.contextKeyService),n.tree=this.tree;let c=this.treeDisposables.add(new PFt(this.notificationService,()=>this.tree.getSelection()));s.actionRunner=c,this.tree.contextKeyService.createKey(this.id,!0),I6o.bindTo(this.tree.contextKeyService).set(!0),this.treeDisposables.add(this.tree.onContextMenu(p=>this.onContextMenu(t,p,c))),this.treeDisposables.add(this.tree.onDidChangeSelection(p=>{this.lastSelection=p.elements,this.lastActive=this.tree?.getFocus()[0]??this.lastActive,this._onDidChangeSelectionAndFocus.fire({selection:this.lastSelection,focus:this.lastActive})})),this.treeDisposables.add(this.tree.onDidChangeFocus(p=>{p.elements.length&&p.elements[0]!==this.lastActive&&(this.lastActive=p.elements[0],this.lastSelection=this.tree?.getSelection()??this.lastSelection,this._onDidChangeSelectionAndFocus.fire({selection:this.lastSelection,focus:this.lastActive}))})),this.treeDisposables.add(this.tree.onDidChangeCollapseState(p=>{if(!p.node.element)return;let h=Array.isArray(p.node.element.element)?p.node.element.element[0]:p.node.element.element;p.node.collapsed?this._onDidCollapseItem.fire(h):this._onDidExpandItem.fire(h)})),this.tree.setInput(this.root).then(()=>this.updateContentAreas()),this.treeDisposables.add(this.tree.onDidOpen(async p=>{if(!p.browserEvent||p.browserEvent.target&&p.browserEvent.target.classList.contains(sJe.checkboxClass))return;let h=this.tree.getSelection(),g=await this.resolveCommand(h.length===1?h[0]:void 0);if(g&&oco(g,this.contextKeyService)){let f=g.arguments||[];(g.id===vg||g.id===cx)&&(f=[...f,p]);try{await this.commandService.executeCommand(g.id,...f)}catch(v){this.notificationService.error(v)}}})),this.treeDisposables.add(t.onDidChange(p=>{this.tree?.hasNode(p)&&this.tree?.rerender(p)}))}async resolveCommand(e){let t=e?.command;return e&&!t&&e instanceof w4&&e.hasResolve&&(await e.resolve(Se.None),t=e.command),t}onContextMenu(e,t,o){this.hoverService.hideHover();let n=t.element;if(n===null)return;let r=t.browserEvent;r.preventDefault(),r.stopPropagation(),this.tree.setFocus([n]);let s=this.canSelectMany?this.getSelection():[];s.find(c=>c.handle===n.handle)||(s=[n]);let l=e.getResourceContextActions(s);l.length&&this.contextMenuService.showContextMenu({getAnchor:()=>t.anchor,getActions:()=>l,getActionViewItem:c=>{let u=this.keybindingService.lookupKeybinding(c.id);if(u)return new hs(c,c,{label:!0,keybinding:u.getLabel()})},onHide:c=>{c&&this.tree.domFocus()},getActionsContext:()=>({$treeViewId:this.id,$treeItemHandle:n.handle}),actionRunner:o})}updateMessage(){this._message?this.showMessage(this._message):this.dataProvider?this.hideMessage():this.showMessage(S6o),this.updateContentAreas()}processMessage(e,t){let o=e.value.split(`
`),n=[],r=!1;for(let l of o){let c=ES(l);if(c.nodes.length===1&&typeof c.nodes[0]!="string"){let u=c.nodes[0],p=document.createElement("div");p.classList.add("button-container");let h=new Wi(p,{title:u.title,secondary:r,supportIcons:!0,...Qo});h.label=u.label,h.onDidClick(f=>{this.openerService.open(u.href,{allowCommands:!0})},null,t);let g=A.parse(u.href);if(g.scheme===Q.command){let f=ico(g.path);f&&(h.enabled=this.contextKeyService.contextMatchesRules(f),t.add(this.contextKeyService.onDidChangeContext(v=>{v.affectsSome(new Set(f.keys()))&&(h.enabled=this.contextKeyService.contextMatchesRules(f))})))}t.add(h),r=!0,n.push(p)}else{r=!1;let u=this.markdownRendererService.render(new Ie(l,{isTrusted:e.isTrusted,supportThemeIcons:e.supportThemeIcons,supportHtml:e.supportHtml}));n.push(u.element),t.add(u)}}let s=document.createElement("div");s.classList.add("rendered-message");for(let l of n)Do(l)?s.appendChild(l):s.appendChild(l.element);return s}showMessage(e){if(tco(this._messageValue)&&this._messageValue.disposables.dispose(),Ar(e)){let t=new N,o=this.processMessage(e,t);this._messageValue={element:o,disposables:t}}else this._messageValue=e;this.messageElement&&(this.messageElement.classList.remove("hide"),this.resetMessageElement(),typeof this._messageValue=="string"&&!uc(this._messageValue)?this.messageElement.textContent=this._messageValue:tco(this._messageValue)&&this.messageElement.appendChild(this._messageValue.element),this.layout(this._height,this._width))}hideMessage(){this.resetMessageElement(),this.messageElement?.classList.add("hide"),this.layout(this._height,this._width)}resetMessageElement(){this.messageElement&&Rt(this.messageElement)}layout(e,t){if(e&&t&&this.messageElement&&this.treeContainer){this._height=e,this._width=t;let o=e-mh(this.messageElement);this.treeContainer.style.height=o+"px",this.tree?.layout(o,t)}}getOptimalWidth(){if(this.tree){let e=this.tree.getHTMLElement(),t=[].slice.call(e.querySelectorAll(".outline-item-label > a"));return MIe(e,t)}return 0}updateCheckboxes(e){return nco(e)}async refresh(e,t){if(this.dataProvider&&this.tree){this.refreshing&&await U.toPromise(this._onDidCompleteRefresh.event),e||(e=[this.root],this.elementsToRefresh=[]);for(let o of e)o.children=void 0;if(this.isVisible){let o=this.updateCheckboxes(t??[]);return this.doRefresh(e.concat(o))}else if(this.elementsToRefresh.length){let o=new Set;this.elementsToRefresh.forEach(n=>o.add(n.handle));for(let n of e)o.has(n.handle)||this.elementsToRefresh.push(n)}else this.elementsToRefresh.push(...e)}}async expand(e){let t=this.tree;if(t)try{e=Array.isArray(e)?e:[e];for(let o of e)await t.expand(o,!1)}catch{}}isCollapsed(e){return!!this.tree?.isCollapsed(e)}setSelection(e){this.tree?.setSelection(e)}getSelection(){return this.tree?.getSelection()??[]}setFocus(e){this.tree&&(e?(this.focus(!0,e),this.tree.setFocus([e])):this.tree.getFocus().length===0&&this.tree.setFocus([]))}async reveal(e){if(this.tree)return this.tree.reveal(e)}async doRefresh(e){let t=this.tree;if(t&&this.visible){this.refreshing=!0;let o=t.getSelection();try{await Promise.all(e.map(r=>t.updateChildren(r,!0,!0)))}catch(r){this.logService.error(r)}let n=t.getSelection();(o.length!==n.length||o.some((r,s)=>r.handle!==n[s].handle))&&(this.lastSelection=n,this._onDidChangeSelectionAndFocus.fire({selection:this.lastSelection,focus:this.lastActive})),this.refreshing=!1,this._onDidCompleteRefresh.fire(),this.updateContentAreas(),this.focused&&this.focus(!1),this.updateCollapseAllToggle()}}initializeCollapseAllToggle(){this.collapseAllToggleContext||(this.collapseAllToggleContextKey=new Y(`treeView.${this.id}.toggleCollapseAll`,!1,d(4537,null,this.id)),this.collapseAllToggleContext=this.collapseAllToggleContextKey.bindTo(this.contextKeyService))}updateCollapseAllToggle(){this.showCollapseAllAction&&(this.initializeCollapseAllToggle(),this.collapseAllToggleContext?.set(!!this.root.children&&this.root.children.length>0&&this.root.children.some(e=>e.collapsibleState!==0)))}updateContentAreas(){let e=!this.root.children||this.root.children.length===0;this._messageValue&&e&&!this.refreshing&&this.treeContainer?(this.dragAndDropController||this.treeContainer.classList.add("hide"),this.domNode.setAttribute("tabindex","0")):this.treeContainer&&(this.treeContainer.classList.remove("hide"),this.domNode===Nn()&&this.focus(),this.domNode.removeAttribute("tabindex"))}get container(){return this._container}};WLe=I([m(2,Le),m(3,F),m(4,ge),m(5,B),m(6,Fo),m(7,Xe),m(8,_e),m(9,Ne),m(10,Bi),m(11,nt),m(12,X),m(13,Sl),m(14,se),m(15,Je),m(16,On)],WLe);var Qyi=class{getId(i){return i.handle}},Yyi=class{getHeight(i){return _3.ITEM_HEIGHT}getTemplateId(i){return _3.TREE_TEMPLATE_ID}};async function Xyi(a,i){return a.getChildrenBatch?a.getChildrenBatch(i):i?Promise.all(i.map(e=>a.getChildren(e).then(t=>t??[]))):[await a.getChildren()].filter(e=>e!==void 0)}var Jyi=class{constructor(i,e){this.treeView=i;this.withProgress=e}hasChildren(i){return!!this.treeView.dataProvider&&i.collapsibleState!==0}async getChildren(i){let e=this.treeView.dataProvider;if(!e)return[];this.batch===void 0?(this.batch=[i],this.batchPromise=void 0):this.batch.push(i);let t=this.batch.length-1;return new Promise((o,n)=>{setTimeout(async()=>{let r=this.batch;this.batch=void 0,this.batchPromise||(this.batchPromise=this.withProgress(Xyi(e,r)));try{let s=await this.batchPromise;o(s&&t<s.length?s[t]:[])}catch(s){s.message.startsWith("Bad progress location:")||n(s)}},0)})}},_3=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.treeViewId=e;this.menus=t;this.labels=o;this.actionViewItemProvider=n;this.aligner=r;this.checkboxStateHandler=s;this.manuallyManageCheckboxes=l;this.themeService=c;this.configurationService=u;this.labelService=p;this.contextKeyService=h;this.hoverService=g;this._onDidChangeCheckboxState=this._register(new E);this.onDidChangeCheckboxState=this._onDidChangeCheckboxState.event;this._onDidChangeMenuContext=this._register(new E);this.onDidChangeMenuContext=this._onDidChangeMenuContext.event;this._hasCheckbox=!1;this._renderedElements=new Map;this._hoverDelegate=this._register(f.createInstance(mf,"mouse",void 0,{})),this._register(this.themeService.onDidFileIconThemeChange(()=>this.rerender())),this._register(this.themeService.onDidColorThemeChange(()=>this.rerender())),this._register(s.onDidChangeCheckboxState(v=>{this.updateCheckboxes(v)})),this._register(this.contextKeyService.onDidChangeContext(v=>this.onDidChangeContext(v)))}static{this.ITEM_HEIGHT=22}static{this.TREE_TEMPLATE_ID="treeExplorer"}get templateId(){return _3.TREE_TEMPLATE_ID}set actionRunner(e){this._actionRunner=e}renderTemplate(e){e.classList.add("custom-view-tree-node-item");let t=M(e,_("")),o=this.labels.create(e,{supportHighlights:!0,hoverDelegate:this._hoverDelegate}),n=KS(o.element,_(".custom-view-tree-node-item-icon")),r=M(o.element,_(".actions")),s=new Zi(r,{actionViewItemProvider:this.actionViewItemProvider});return{resourceLabel:o,icon:n,checkboxContainer:t,actionBar:s,container:e}}getHover(e,t,o){return!(o instanceof w4)||!o.hasResolve?t&&!o.tooltip?void 0:o.tooltip===void 0?Ar(e)?{markdown:e,markdownNotSupportedFallback:e.value}:e:Fe(o.tooltip)?o.tooltip!==""?o.tooltip:void 0:{markdown:o.tooltip,markdownNotSupportedFallback:t?void 0:Da(o.tooltip)}:{markdown:typeof o.tooltip=="string"?o.tooltip:n=>new Promise(r=>{o.resolve(n).then(()=>r(o.tooltip))}),markdownNotSupportedFallback:t?void 0:e?Ar(e)?e.value:e:""}}processLabel(e,t){if(!Ar(e))return{label:e};let o=e.value.trim(),n=!1,r=!1,s=!1;function l(p){if(t)for(let h of t)h.start-=p,h.end-=p}let c=[{open:"~~",close:"~~",mark:()=>{s=!0}},{open:"**",close:"**",mark:()=>{n=!0}},{open:"*",close:"*",mark:()=>{r=!0}},{open:"_",close:"_",mark:()=>{r=!0}}];function u(){let p=!1;for(let h of c)if(o.startsWith(h.open)&&o.endsWith(h.close)){if(t?.some(g=>g.start<h.open.length||g.end>o.length-h.close.length))return!1;h.mark(),o=o.substring(h.open.length,o.length-h.close.length),l(h.open.length),p=!0}return p}for(let p=0;p<10&&u();p++);return{label:o,bold:n,italic:r,strikethrough:s,supportIcons:e.supportThemeIcons}}renderElement(e,t,o){let n=e.element,r=n.resourceUri?A.revive(n.resourceUri):null,s=n.label?n.label:r?{label:He(r)}:void 0,l=Fe(n.description)?n.description:r&&n.description===!0?this.labelService.getUriLabel(ci(r),{relative:!0}):void 0,c=s?Ar(s.label)?s.label.value:s.label:void 0,u=s?.highlights&&c?s.highlights.map(([P,O])=>{if(P<0&&(P=c.length+P),O<0&&(O=c.length+O),P>=c.length||O>c.length)return{start:0,end:0};if(P>O){let V=P;P=O,O=V}return{start:P,end:O}}):void 0,{label:p,bold:h,italic:g,strikethrough:f,supportIcons:v}=this.processLabel(s?.label,u),b=Bp(this.themeService.getColorTheme().type)?n.iconDark:n.icon,S=b?A.revive(b):void 0,y=this.getHover(s?.label,r,n);o.actionBar.clear(),o.icon.style.color="";let w=!0;if(n.command&&(w=oco(n.command,this.contextKeyService)),this.renderCheckbox(n,o),r){let P=this.configurationService.getValue("explorer.decorations"),O=r||A.parse("missing:_icon_resource");o.resourceLabel.setResource({name:p,description:l,resource:O},{fileKind:this.getFileKind(n),title:y,hideIcon:this.shouldHideResourceLabelIcon(S,n.themeIcon),fileDecorations:P,extraClasses:["custom-view-tree-node-item-resourceLabel"],matches:u||xa(e.filterData),bold:h,italic:g,strikethrough:f,disabledCommand:!w,labelEscapeNewLines:!0,forceLabel:!!n.label,supportIcons:v})}else o.resourceLabel.setResource({name:p,description:l},{title:y,hideIcon:!0,extraClasses:["custom-view-tree-node-item-resourceLabel"],matches:u||xa(e.filterData),bold:h,italic:g,strikethrough:f,disabledCommand:!w,labelEscapeNewLines:!0,supportIcons:v});if(S)o.icon.className="custom-view-tree-node-item-icon",o.icon.style.backgroundImage=Qa(S);else{let P;this.shouldShowThemeIcon(!!r,n.themeIcon)&&(P=q.asClassName(n.themeIcon),n.themeIcon.color&&(o.icon.style.color=this.themeService.getColorTheme().getColor(n.themeIcon.color.id)?.toString()??"")),o.icon.className=P?`custom-view-tree-node-item-icon ${P}`:"",o.icon.style.backgroundImage=""}w||(o.icon.className=o.icon.className+" disabled",o.container.parentElement&&(o.container.parentElement.className=o.container.parentElement.className+" disabled")),o.actionBar.context={$treeViewId:this.treeViewId,$treeItemHandle:n.handle};let k=this.menus.getResourceActions([n]);o.actionBar.push(k,{icon:!0,label:!1}),this._actionRunner&&(o.actionBar.actionRunner=this._actionRunner),this.setAlignment(o.container,n);let T=this._renderedElements.get(e.element.handle)??[];this._renderedElements.set(e.element.handle,[...T,{original:e,rendered:o}])}rerender(){let e=new Set(this._renderedElements.keys());for(let t of e){let o=this._renderedElements.get(t)??[];for(let n of o)this.disposeElement(n.original,0,n.rendered),this.renderElement(n.original,0,n.rendered)}}renderCheckbox(e,t){if(e.checkbox){if(this._hasCheckbox||(this._hasCheckbox=!0,this.rerender()),!t.checkbox){let o=new sJe(t.checkboxContainer,this.checkboxStateHandler,this._hoverDelegate,this.hoverService);t.checkbox=o}t.checkbox.render(e)}else t.checkbox&&(t.checkbox.dispose(),t.checkbox=void 0)}setAlignment(e,t){e.parentElement.classList.toggle("align-icon-with-twisty",this.aligner.alignIconWithTwisty(t))}shouldHideResourceLabelIcon(e,t){return!!e||!!t&&!this.isFileKindThemeIcon(t)}shouldShowThemeIcon(e,t){return t?!(e&&this.isFileKindThemeIcon(t)):!1}isFileKindThemeIcon(e){return q.isFile(e)||q.isFolder(e)}getFileKind(e){if(e.themeIcon)switch(e.themeIcon.id){case c3i.id:return 0;case wj.id:return 1}return e.collapsibleState===1||e.collapsibleState===2?1:0}onDidChangeContext(e){let t=e.affectsSome(this.menus.getEntireMenuContexts()),o=[];for(let[n,r]of this._renderedElements)for(let s of r)(t||e.affectsSome(this.menus.getElementOverlayContexts(s.original.element)))&&o.push(s.original.element);o.length&&this._onDidChangeMenuContext.fire(o)}updateCheckboxes(e){let t=[];this.manuallyManageCheckboxes()?t=e:t=nco(e),t.forEach(o=>{let n=this._renderedElements.get(o.handle);n&&n.forEach(r=>r.rendered.checkbox?.render(o))}),this._onDidChangeCheckboxState.fire(t)}disposeElement(e,t,o){let n=this._renderedElements.get(e.element.handle)??[],r=n.findIndex(s=>o===s.rendered);n.length===1?this._renderedElements.delete(e.element.handle):n.length>0&&n.splice(r,1),o.checkbox?.dispose(),o.checkbox=void 0}disposeTemplate(e){e.resourceLabel.dispose(),e.actionBar.dispose()}};_3=I([m(7,Le),m(8,B),m(9,rt),m(10,X),m(11,nt),m(12,F)],_3);var Zyi=class extends x{constructor(e,t){super();this.themeService=e;this.logService=t}set tree(e){this._tree=e}alignIconWithTwisty(e){if(e.collapsibleState!==0||!this.hasIconOrCheckbox(e))return!1;if(this._tree){let t=this._tree.getInput(),o;try{o=this._tree.getParentElement(e)||t}catch(n){return this.logService.error(`[TreeView] Failed to resolve parent for ${e.handle}`,n),!1}return this.hasIconOrCheckbox(o)?!!o.children&&o.children.some(n=>n.collapsibleState!==0&&!this.hasIconOrCheckbox(n)):!!o.children&&o.children.every(n=>n.collapsibleState===0||!this.hasIconOrCheckbox(n))}else return!1}hasIconOrCheckbox(e){return this.hasIcon(e)||!!e.checkbox}hasIcon(e){if(Bp(this.themeService.getColorTheme().type)?e.iconDark:e.icon)return!0;if(e.resourceUri||e.themeIcon){let o=this.themeService.getFileIconTheme();return(e.themeIcon?e.themeIcon.id===wj.id:e.collapsibleState!==0)?o.hasFileIcons&&o.hasFolderIcons:o.hasFileIcons}return!1}},PFt=class extends rs{constructor(e,t){super();this.getSelectedResources=t;this._register(this.onDidRun(o=>{o.error&&!ao(o.error)&&e.error(d(4532,null,o.error.message,o.action.id))}))}async runAction(e,t){let o=this.getSelectedResources(),n,r=!1;o.length>1&&(n=o.map(s=>((s.handle===t.$treeItemHandle||t.$selectedTreeItems)&&(r=!0),{$treeViewId:t.$treeViewId,$treeItemHandle:s.handle}))),!r&&n&&(n=void 0),await e.run(t,n)}},aJe=class{constructor(i,e){this.id=i;this.menuService=e;this._onDidChange=new E;this.onDidChange=this._onDidChange.event}getResourceActions(i){return this.getActions(this.getMenuId(),i).primary}getResourceContextActions(i){return this.getActions(this.getMenuId(),i).secondary}setContextKeyService(i){this.contextKeyService=i}filterNonUniversalActions(i,e){let t=new Set(e.map(o=>o.id));for(let o of i){let n=o.keys();for(let r of n)t.has(r)||o.delete(r)}}buildMenu(i){let e=[];for(let t of i)t.size>0&&(e.length&&e.push(new ri),e.push(...t.values()));return e}createGroups(i){let e=[],t=new Map;for(let o of i)o instanceof ri?(e.push(t),t=new Map):t.set(o.id,o);return e.push(t),e}getElementOverlayContexts(i){return new Map([["view",this.id],["viewItem",i.contextValue]])}getEntireMenuContexts(){return this.menuService.getMenuContexts(this.getMenuId())}getMenuId(){return D.ViewItemContext}getActions(i,e){if(!this.contextKeyService)return{primary:[],secondary:[]};let t=[],o=[];for(let n=0;n<e.length;n++){let r=e[n],s=this.contextKeyService.createOverlay(this.getElementOverlayContexts(r)),l=this.menuService.getMenuActions(i,s,{shouldForwardArgs:!0}),c=zp(l,"inline");n===0?(t=this.createGroups(c.primary),o=this.createGroups(c.secondary)):(this.filterNonUniversalActions(t,c.primary),this.filterNonUniversalActions(o,c.secondary))}return{primary:this.buildMenu(t),secondary:this.buildMenu(o)}}dispose(){this.contextKeyService=void 0,this._onDidChange.dispose()}};aJe=I([m(1,Kt)],aJe);var VLe=class extends WLe{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T){super(e,t,n,r,s,l,c,u,p,h,g,v,f,S,w,k,T);this.extensionId=o;this.extensionService=b;this.telemetryService=y}activate(){this.activated||(this.telemetryService.publicLog2("Extension:ViewActivate",{extensionId:new sg(this.extensionId),id:this.id}),this.createTree(),this.progressService.withProgress({location:this.id},()=>this.extensionService.activateByEvent(`onView:${this.id}`)).then(()=>Li(2e3)).then(()=>{this.updateMessage()}),this.activated=!0)}};VLe=I([m(3,Le),m(4,F),m(5,ge),m(6,B),m(7,Fo),m(8,Xe),m(9,_e),m(10,Ne),m(11,Bi),m(12,X),m(13,nt),m(14,lt),m(15,Sl),m(16,Te),m(17,se),m(18,Je),m(19,On)],VLe);var W2=class extends WLe{activate(){this.activated||(this.createTree(),this.activated=!0)}},lJe=class{constructor(i,e,t,o,n){this.treeId=i;this.labelService=e;this.instantiationService=t;this.treeViewsDragAndDropService=o;this.logService=n;this.treeItemsTransfer=JI.getInstance();this.treeMimeType=`application/vnd.code.tree.${i.toLowerCase()}`}set controller(i){this.dndController=i}handleDragAndLog(i,e,t,o){return i.handleDrag(e,t,o).then(n=>{if(n){let r=[];for(let s of n)s[0]!==this.treeMimeType&&i.dragMimeTypes.findIndex(l=>l===s[0])<0&&r.push(s[0]);r.length&&this.logService.warn(`Drag and drop controller for tree ${this.treeId} adds the following data transfer types but does not declare them in dragMimeTypes: ${r.join(", ")}`)}return n})}addExtensionProvidedTransferTypes(i,e){if(!i.dataTransfer||!this.dndController)return;let t=xt();this.dragCancellationToken=new Ye,this.treeViewsDragAndDropService.addDragOperationTransfer(t,this.handleDragAndLog(this.dndController,e,t,this.dragCancellationToken.token)),this.treeItemsTransfer.setData([new PC(t)],PC.prototype),i.dataTransfer.clearData(tr.text),this.dndController.dragMimeTypes.find(o=>o===tr.uriList)&&i.dataTransfer?.setData(yl.RESOURCES,""),this.dndController.dragMimeTypes.forEach(o=>{i.dataTransfer?.setData(o,"")})}addResourceInfoToTransfer(i,e){if(e.length&&i.dataTransfer){this.instantiationService.invokeFunction(o=>tv(o,e,i));let t=e.filter(o=>o.scheme===Q.file).map(o=>o.fsPath);t.length&&i.dataTransfer.setData(hc.FILES,JSON.stringify(t))}}onDragStart(i,e){if(e.dataTransfer){let t=i.getData(),o=[],n={id:this.treeId,itemHandles:[]};t.forEach(r=>{n.itemHandles.push(r.handle),r.resourceUri&&o.push(A.revive(r.resourceUri))}),this.addResourceInfoToTransfer(e,o),this.addExtensionProvidedTransferTypes(e,n.itemHandles),e.dataTransfer.setData(this.treeMimeType,JSON.stringify(n))}}debugLog(i){i.size?this.logService.debug(`TreeView dragged mime types: ${Array.from(i).join(", ")}`):this.logService.debug("TreeView dragged with no supported mime types.")}onDragOver(i,e,t,o,n){let r=yle(n.dataTransfer),s=new Set(Array.from(r,u=>u[0]));if(n.dataTransfer){for(let u of n.dataTransfer.items)if(u.kind==="file"||u.type===yl.RESOURCES.toLowerCase()){s.add(tr.uriList);break}}this.debugLog(s);let l=this.dndController;return!l||!n.dataTransfer||l.dropMimeTypes.length===0?!1:Array.from(s).some((u,p)=>u===this.treeMimeType?!0:l.dropMimeTypes.indexOf(u)>=0)?{accept:!0,bubble:0,autoExpand:!0}:!1}getDragURI(i){return this.dndController?i.resourceUri?A.revive(i.resourceUri).toString():i.handle:null}getDragLabel(i){if(!this.dndController)return;if(i.length>1)return String(i.length);let e=i[0];return e.label?Ar(e.label.label)?e.label.label.value:e.label.label:e.resourceUri?this.labelService.getUriLabel(A.revive(e.resourceUri)):void 0}async drop(i,e,t,o,n){let r=this.dndController;if(!n.dataTransfer||!r)return;let s,l;this.treeItemsTransfer.hasData(PC.prototype)&&(l=this.treeItemsTransfer.getData(PC.prototype)[0].identifier);let c=yle(n.dataTransfer,!0),u=new qx;for(let[h,g]of c)if((h===this.treeMimeType||r.dropMimeTypes.includes(h)||g.asFile()&&r.dropMimeTypes.includes(yl.FILES.toLowerCase()))&&(u.append(h,g),h===this.treeMimeType))try{s=JSON.parse(await g.asString())}catch{}let p=await this.treeViewsDragAndDropService.removeDragOperationTransfer(l);if(p)for(let[h,g]of p)u.append(h,g);return r.handleDrop(u,e,Se.None,l,s?.id,s?.itemHandles)}onDragEnd(i){i.dataTransfer?.dropEffect==="none"&&this.dragCancellationToken?.cancel()}dispose(){}};lJe=I([m(1,rt),m(2,F),m(3,v5),m(4,se)],lJe);function nco(a){let i=[];for(let e of a)if(e.checkbox!==void 0){let t=r=>{for(let s of r.children??[])s.checkbox!==void 0&&r.checkbox!==void 0&&s.checkbox.isChecked!==r.checkbox.isChecked&&(s.checkbox.isChecked=r.checkbox.isChecked,i.push(s),t(s))};t(e);let o=new Set,n=r=>{if(r.parent?.checkbox!==void 0&&r.parent.children){if(o.has(r.parent))return;o.add(r.parent);let s=!1,l=!1;for(let c of r.parent.children){if(s&&l)break;c.checkbox!==void 0&&(c.checkbox.isChecked?l=!0:s=!0)}l&&!s&&r.parent.checkbox.isChecked!==!0?(r.parent.checkbox.isChecked=!0,i.push(r.parent),n(r.parent)):s&&r.parent.checkbox.isChecked!==!1&&(r.parent.checkbox.isChecked=!1,i.push(r.parent),n(r.parent))}};n(e)}return a.concat(i)}var nv="workbench.view.explorer",Fb="workbench.explorer.fileView",rco=new Y("explorerViewletVisible",!0,{type:"boolean",description:d(11153,null)}),D3=new Y("foldersViewVisible",!0,{type:"boolean",description:d(11155,null)}),Gd=new Y("explorerResourceIsFolder",!1,{type:"boolean",description:d(11144,null)}),ewi=new Y("explorerResourceReadonly",!1,{type:"boolean",description:d(11148,null)}),y0=ewi.toNegated(),twi=new Y("explorerResourceParentReadonly",!1,{type:"boolean",description:d(11147,null)}),AFt=new Y("explorerResourceAvailableEditorIds",""),ux=new Y("explorerResourceIsRoot",!1,{type:"boolean",description:d(11145,null)}),NFt=new Y("explorerResourceCut",!1,{type:"boolean",description:d(11143,null)}),Fpe=new Y("explorerResourceMoveableToTrash",!1,{type:"boolean",description:d(11146,null)}),iwi=new Y("filesExplorerFocus",!0,{type:"boolean",description:d(11154,null)}),sco=new Y("openEditorsFocus",!0,{type:"boolean",description:d(11156,null)}),dJe=new Y("explorerViewletFocus",!0,{type:"boolean",description:d(11152,null)}),OFt=new Y("explorerFindProviderActive",!1,{type:"boolean",description:d(11142,null)}),Wpe=new Y("explorerViewletCompressedFocus",!0,{type:"boolean",description:d(11150,null)}),uJe=new Y("explorerViewletCompressedFirstFocus",!0,{type:"boolean",description:d(11149,null)}),pJe=new Y("explorerViewletCompressedLastFocus",!0,{type:"boolean",description:d(11151,null)}),aco=new Y("viewHasSomeCollapsibleItem",!1,{type:"boolean",description:d(11157,null)}),px=C.and(D3,iwi,C.not(np)),lco=C.and(D3,dJe,C.not(np)),w0="workbench.editors.files.textFileEditor",Vpe="workbench.editors.files.fileEditorInput",FFt="workbench.editors.files.binaryFileEditor",BLe="code-text-binary";var sM=class extends x{constructor(e,t,o,n){super();this.textFileService=e;this.fileService=t;this.languageService=o;this.modelService=n;this.fileWatcherDisposable=this._register(new me)}static async open(e,t,o,n,r){await n.openEditor({original:{resource:sM.resourceToTextFile(t,e)},modified:{resource:e},label:o,options:r})}static resourceToTextFile(e,t){return t.with({scheme:e,query:JSON.stringify({scheme:t.scheme,query:t.query})})}static textFileToResource(e){let{scheme:t,query:o}=JSON.parse(e.query);return e.with({scheme:t,query:o})}async provideTextContent(e){if(!e.query)return null;let t=sM.textFileToResource(e),o=await this.resolveEditorModel(e);if(!this.fileWatcherDisposable.value){let n=new N;this.fileWatcherDisposable.value=n,n.add(this.fileService.onDidFilesChange(r=>{r.contains(t,0)&&this.resolveEditorModel(e,!1)})),o&&n.add(U.once(o.onWillDispose)(()=>this.fileWatcherDisposable.clear()))}return o}async resolveEditorModel(e,t=!0){let o=sM.textFileToResource(e),n=await this.textFileService.readStream(o),r=this.modelService.getModel(e);if(r)this.modelService.updateModel(r,n.value);else if(t){let s=this.modelService.getModel(o),l;s?l=this.languageService.createById(s.getLanguageId()):l=this.languageService.createByFilepathOrFirstLine(o),r=this.modelService.createModel(n.value,l,e)}return r}};sM=I([m(0,Uo),m(1,fe),m(2,_t),m(3,Tt)],sM);var Rh=class a{constructor(i,e){this._editor=i;this._group=e;this.id=a.COUNTER++}static{this.COUNTER=0}get editor(){return this._editor}get group(){return this._group}get groupId(){return this._group.id}getId(){return`openeditor:${this.groupId}:${this.id}`}isPreview(){return!this._group.isPinned(this.editor)}isSticky(){return this._group.isSticky(this.editor)}getResource(){return po.getOriginalUri(this.editor,{supportSideBySide:1})}};var owi=Ae("remote-explorer-get-started",R.star,d(13393,null)),nwi=Ae("remote-explorer-documentation",R.book,d(13388,null)),wIc=Ae("remote-explorer-feedback",R.twitter,d(13389,null)),rwi=Ae("remote-explorer-review-issues",R.issues,d(13402,null)),swi=Ae("remote-explorer-report-issues",R.comment,d(13401,null)),cco=Ae("remote-explorer-view-icon",R.remoteExplorer,d(13400,null)),WFt=Ae("ports-view-icon",R.plug,d(13398,null)),CIc=Ae("ports-view-icon",R.plug,d(13397,null)),awi=Ae("private-ports-view-icon",R.lock,d(13399,null)),dco=Ae("ports-forward-icon",R.plus,d(13392,null)),uco=Ae("ports-stop-forward-icon",R.x,d(13403,null)),pco=Ae("ports-open-browser-icon",R.globe,d(13395,null)),mco=Ae("ports-open-preview-icon",R.openPreview,d(13396,null)),hco=Ae("ports-copy-address-icon",R.clippy,d(13387,null)),lwi=Ae("ports-label-icon",R.tag,d(13394,null)),gco=Ae("ports-forwarded-without-process-icon",R.circleOutline,d(13390,null)),fco=Ae("ports-forwarded-with-process-icon",R.circleFilled,d(13391,null));var vco=new Y("openPreviewEnabled",!1),cwi=class{constructor(i){this.remoteExplorerService=i;this.headerRowHeight=22}getHeight(i){return i.tunnelType==="Add"&&!this.remoteExplorerService.getEditableData(void 0)?30:22}},HLe=class{constructor(i,e){this.remoteExplorerService=i;this.tunnelService=e;this._candidates=new Map;this.input={label:d(13462,null),icon:void 0,tunnelType:"Add",hasRunningProcess:!1,remoteHost:"",remotePort:0,processDescription:"",tooltipPostfix:"",iconTooltip:"",portTooltip:"",processTooltip:"",originTooltip:"",privacyTooltip:"",source:{source:0,description:""},protocol:"http",privacy:{id:"private",themeIcon:awi.id,label:d(13486,null)},strip:()=>{}};this.model=i.tunnelModel,this.onForwardedPortsChanged=U.any(this.model.onForwardPort,this.model.onClosePort,this.model.onPortName,this.model.onCandidatesChanged)}get all(){let i=[];return this._candidates=new Map,this.model.candidates.forEach(e=>{this._candidates.set(Qp(e.host,e.port),e)}),(this.model.forwarded.size>0||this.remoteExplorerService.getEditableData(void 0))&&i.push(...this.forwarded),this.model.detected.size>0&&i.push(...this.detected),i.push(this.input),i}addProcessInfoFromCandidate(i){let e=Qp(i.remoteHost,i.remotePort);this._candidates.has(e)&&(i.processDescription=this._candidates.get(e).detail)}get forwarded(){return Array.from(this.model.forwarded.values()).map(e=>{let t=mx.createFromTunnel(this.remoteExplorerService,this.tunnelService,e);return this.addProcessInfoFromCandidate(t),t}).sort((e,t)=>e.remotePort===t.remotePort?e.remoteHost<t.remoteHost?-1:1:e.remotePort<t.remotePort?-1:1)}get detected(){return Array.from(this.model.detected.values()).map(i=>{let e=mx.createFromTunnel(this.remoteExplorerService,this.tunnelService,i,"Detected",!1);return this.addProcessInfoFromCandidate(e),e})}isEmpty(){return this.detected.length===0&&(this.forwarded.length===0||this.forwarded.length===1&&this.forwarded[0].tunnelType==="Add"&&!this.remoteExplorerService.getEditableData(void 0))}};HLe=I([m(0,du),m(1,_p)],HLe);function fJe(a){return{label:"",tunnel:a,editId:0,tooltip:""}}var dwi=class{constructor(){this.label="";this.tooltip="";this.weight=1;this.minimumWidth=40;this.maximumWidth=40;this.templateId="actionbar"}project(i){if(i.tunnelType==="Add")return fJe(i);let e=i.processDescription?fco:gco,t="";return i instanceof mx&&(t=`${i.iconTooltip} ${i.tooltipPostfix}`),{label:"",icon:e,tunnel:i,editId:0,tooltip:t}}},uwi=class{constructor(){this.label=d(13478,null);this.tooltip=d(13479,null);this.weight=1;this.templateId="actionbar"}project(i){let e=i.tunnelType==="Add",t=i.label,o="";return i instanceof mx&&!e?o=`${i.portTooltip} ${i.tooltipPostfix}`:o=t,{label:t,tunnel:i,menuId:D.TunnelPortInline,editId:i.tunnelType==="Add"?1:2,tooltip:o}}},pwi=class a{constructor(){this.label=d(13471,null);this.tooltip=d(13472,null);this.weight=1;this.templateId="actionbar"}project(i){if(i.tunnelType==="Add")return fJe(i);let e=i.localAddress??"",t=e;return i instanceof mx&&(t=i.tooltipPostfix),{label:e,menuId:D.TunnelLocalAddressInline,tunnel:i,editId:3,tooltip:t,markdownTooltip:e?a.getHoverText(e):void 0}}static getHoverText(i){return function(e){let t=e.getValue("editor"),o="";t.multiCursorModifier==="ctrlCmd"?Ze?o=d(13432,null):o=d(13431,null):Ze?o=d(13433,null):o=d(13434,null);let n=new Ie("",!0),r=i.startsWith("http")?i:`http://${i}`;return n.appendLink(r,"Follow link").appendMarkdown(` (${o})`)}}},mwi=class{constructor(){this.label=d(13482,null);this.tooltip=d(13483,null);this.weight=2;this.templateId="actionbar"}project(i){return i.tunnelType==="Add"?fJe(i):{label:i.processDescription??"",tunnel:i,editId:0,tooltip:i instanceof mx?i.processTooltip:""}}},hwi=class{constructor(){this.label=d(13476,null);this.tooltip=d(13477,null);this.weight=1;this.templateId="actionbar"}project(i){if(i.tunnelType==="Add")return fJe(i);let e=i.source.description,t=`${i instanceof mx?i.originTooltip:""}. ${i instanceof mx?i.tooltipPostfix:""}`;return{label:e,menuId:D.TunnelOriginInline,tunnel:i,editId:0,tooltip:t}}},gwi=class{constructor(){this.label=d(13480,null);this.tooltip=d(13481,null);this.weight=1;this.templateId="actionbar"}project(i){if(i.tunnelType==="Add")return fJe(i);let e=i.privacy?.label,t="";return i instanceof mx&&(t=`${i.privacy.label} ${i.tooltipPostfix}`),{label:e,tunnel:i,icon:{id:i.privacy.themeIcon},editId:0,tooltip:t}}},mJe=class{constructor(i,e,t,o,n,r,s){this.instantiationService=i;this.contextKeyService=e;this.menuService=t;this.contextViewService=o;this.remoteExplorerService=n;this.commandService=r;this.configurationService=s;this.templateId="actionbar";this._hoverDelegate=Ri("mouse")}set actionRunner(i){this._actionRunner=i}renderTemplate(i){let e=M(i,_(".ports-view-actionbar-cell")),t=M(e,_(".ports-view-actionbar-cell-icon")),o=new N,n=new N;o.add(n);let r=o.add(new Bc(e,{supportHighlights:!0,hoverDelegate:this._hoverDelegate})),s=M(e,_(".actions")),l=o.add(new Zi(s,{actionViewItemProvider:Bs.bind(void 0,this.instantiationService),hoverDelegate:this._hoverDelegate}));return{label:r,icon:t,actionBar:l,container:e,templateDisposables:o,elementDisposables:n}}renderElement(i,e,t){t.actionBar.clear(),t.icon.className="ports-view-actionbar-cell-icon",t.icon.style.display="none",t.label.setLabel(""),t.label.element.style.display="none",t.container.style.height="22px",t.button&&(t.button.element.style.display="none"),t.container.style.paddingLeft="0px",t.elementDisposables.clear();let o;i.editId===1&&(o=this.remoteExplorerService.getEditableData(void 0))?this.renderInputBox(t,o):(o=this.remoteExplorerService.getEditableData(i.tunnel,i.editId),o?this.renderInputBox(t,o):i.tunnel.tunnelType==="Add"&&i.menuId===D.TunnelPortInline?this.renderButton(i,t):this.renderActionBarItem(i,t))}renderButton(i,e){e.container.style.paddingLeft="7px",e.container.style.height="28px",e.button=e.elementDisposables.add(new Wi(e.container,Qo)),e.button.label=i.label,e.button.element.title=i.tooltip,e.elementDisposables.add(e.button.onDidClick(()=>{this.commandService.executeCommand(Gw.INLINE_ID)}))}tunnelContext(i){let e;return i instanceof mx&&(e=i.strip()),e||(e={tunnelType:i.tunnelType,remoteHost:i.remoteHost,remotePort:i.remotePort,localAddress:i.localAddress,protocol:i.protocol,localUri:i.localUri,localPort:i.localPort,name:i.name,closeable:i.closeable,source:i.source,privacy:i.privacy,processDescription:i.processDescription,label:i.label}),e}renderActionBarItem(i,e){e.label.element.style.display="flex",e.label.setLabel(i.label,void 0,{title:i.markdownTooltip?{markdown:i.markdownTooltip(this.configurationService),markdownNotSupportedFallback:i.tooltip}:i.tooltip,extraClasses:i.menuId===D.TunnelLocalAddressInline?["ports-view-actionbar-cell-localaddress"]:void 0}),e.actionBar.context=this.tunnelContext(i.tunnel),e.container.style.paddingLeft="10px";let t=[["view",n3],[vJe.key,i.tunnel.tunnelType],[bJe.key,i.tunnel.closeable],[fwi.key,i.tunnel.privacy.id],[BFt.key,i.tunnel.protocol]],o=this.contextKeyService.createOverlay(t);if(i.menuId){let n=e.elementDisposables.add(this.menuService.createMenu(i.menuId,o)),r=jm(n.getActions({shouldForwardArgs:!0}));if(r){let s=r.filter(l=>l.id.toLowerCase().indexOf("label")>=0);s.length>1&&(s.sort((l,c)=>l.label.length-c.label.length),s.pop(),r=r.filter(l=>s.indexOf(l)<0)),e.actionBar.push(r,{icon:!0,label:!1}),this._actionRunner&&(e.actionBar.actionRunner=this._actionRunner)}}i.icon&&(e.icon.className=`ports-view-actionbar-cell-icon ${q.asClassName(i.icon)}`,e.icon.title=i.tooltip,e.icon.style.display="inline")}renderInputBox(i,e){this.inputDone&&(this.inputDone(!1,!1),this.inputDone=void 0);let{container:t}=i;t.style.paddingLeft="5px";let o=e.startingValue||"",n=new Vc(t,this.contextViewService,{ariaLabel:d(13464,null),validationOptions:{validation:l=>{let c=e.validationMessage(l);return c?{content:c.content,formatContent:!0,type:c.severity===ft.Error?3:1}:null}},placeholder:e.placeholder||"",inputBoxStyles:Cl});n.value=o,n.focus(),n.select({start:0,end:e.startingValue?e.startingValue.length:0});let r=$c(async(l,c)=>{Be(s),this.inputDone&&(this.inputDone=void 0),n.element.style.display="none";let u=n.value;if(c)return e.onFinish(u,l)});this.inputDone=r;let s=[n,Jo(n.inputElement,re.KEY_DOWN,async l=>{if(l.equals(3))return l.stopPropagation(),n.validate()!==3?r(!0,!0):r(!1,!0);if(l.equals(9))return l.preventDefault(),l.stopPropagation(),r(!1,!0)}),j(n.inputElement,re.BLUR,()=>r(n.validate()!==3,!0))];i.elementDisposables.add(Z(()=>{r(!1,!1)}))}disposeElement(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.templateDisposables.dispose()}};mJe=I([m(0,F),m(1,X),m(2,Kt),m(3,Wn),m(4,du),m(5,ge),m(6,B)],mJe);var mx=class a{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){this.tunnelType=i;this.remoteHost=e;this.remotePort=t;this.source=o;this.hasRunningProcess=n;this.protocol=r;this.localUri=s;this.localAddress=l;this.localPort=c;this.closeable=u;this.name=p;this.runningProcess=h;this.pid=g;this._privacy=f;this.remoteExplorerService=v;this.tunnelService=b}static createFromTunnel(i,e,t,o="Forwarded",n){return new a(o,t.remoteHost,t.remotePort,t.source,!!t.hasRunningProcess,t.protocol,t.localUri,t.localAddress,t.localPort,n===void 0?t.closeable:n,t.name,t.runningProcess,t.pid,t.privacy,i,e)}strip(){return new a(this.tunnelType,this.remoteHost,this.remotePort,this.source,this.hasRunningProcess,this.protocol,this.localUri,this.localAddress,this.localPort,this.closeable,this.name,this.runningProcess,this.pid,this._privacy)}get label(){if(this.tunnelType==="Add"&&this.name)return this.name;let i=fZ(this.remoteHost)||o3(this.remoteHost)?`${this.remotePort}`:`${this.remoteHost}:${this.remotePort}`;return this.name?`${this.name} (${i})`:i}set processDescription(i){this.runningProcess=i}get processDescription(){let i="";return this.runningProcess?(this.pid&&this.remoteExplorerService?.namedProcesses.has(this.pid)?i=this.remoteExplorerService.namedProcesses.get(this.pid):i=this.runningProcess.replace(/\0/g," ").trim(),this.pid&&(i+=` (${this.pid})`)):this.hasRunningProcess&&(i=d(13489,null)),i}get tooltipPostfix(){let i;return this.localAddress?i=d(13460,null,this.remoteHost,this.remotePort,this.localAddress):i=d(13459,null,this.remoteHost,this.remotePort),i}get iconTooltip(){return this.tunnelType==="Add"?this.label:`${this.processDescription?d(13475,null):d(13474,null)}`}get portTooltip(){return this.tunnelType==="Add"?"":`${this.name?d(13461,null,this.name):""}`}get processTooltip(){return this.processDescription??""}get originTooltip(){return this.source.description}get privacy(){return this.tunnelService?.privacyOptions?this.tunnelService?.privacyOptions.find(i=>i.id===this._privacy)??{id:"",themeIcon:R.question.id,label:d(13487,null)}:{id:"private",themeIcon:awi.id,label:d(13486,null)}}},vJe=new Y("tunnelType","Add",!0),bJe=new Y("tunnelCloseable",!1,!0),fwi=new Y("tunnelPrivacy",void 0,!0),bco=new Y("tunnelPrivacyEnabled",!1,!0),BFt=new Y("tunnelProtocol","http",!0),HFt=new Y("tunnelViewFocus",!1,d(13473,null)),SJe="tunnelViewSelection",C6o=new Y(SJe,void 0,!0),Sco="tunnelViewMultiSelection",Ico=new Y(Sco,void 0,!0),yco=new Y("portChangable",!1,!0),wco=new Y("protocolChangable",!0,!0),C0=class extends Gs{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super(t,o,n,s,r,c,l,u,f,b);this.viewModel=e;this.quickInputService=p;this.commandService=h;this.menuService=g;this.remoteExplorerService=v;this.tunnelService=S;this.contextViewService=y;this.tableDisposables=this._register(new N);this.isEditing=!1;this.titleActions=[];this.lastFocus=[];this.height=0;this.width=0;this.tunnelTypeContext=vJe.bindTo(r),this.tunnelCloseableContext=bJe.bindTo(r),this.tunnelPrivacyContext=fwi.bindTo(r),this.tunnelPrivacyEnabledContext=bco.bindTo(r),this.tunnelPrivacyEnabledContext.set(S.canChangePrivacy),this.protocolChangableContextKey=wco.bindTo(r),this.protocolChangableContextKey.set(S.canChangeProtocol),this.tunnelProtocolContext=BFt.bindTo(r),this.tunnelViewFocusContext=HFt.bindTo(r),this.tunnelViewSelectionContext=C6o.bindTo(r),this.tunnelViewMultiSelectionContext=Ico.bindTo(r),this.portChangableContextKey=yco.bindTo(r);let w=this.contextKeyService.createOverlay([["view",C0.ID]]),k=this._register(this.menuService.createMenu(D.TunnelTitle,w)),T=()=>{this.titleActions=jm(k.getActions()),this.updateActions()};this._register(k.onDidChange(T)),T(),this._register(Z(()=>{this.titleActions=[]})),this.registerPrivacyActions(),this._register(U.once(this.tunnelService.onAddedTunnelProvider)(()=>{let P=!1;this.tunnelPrivacyEnabledContext.get()===!1&&(this.tunnelPrivacyEnabledContext.set(S.canChangePrivacy),P=!0),this.protocolChangableContextKey.get()===!0&&(this.protocolChangableContextKey.set(S.canChangeProtocol),P=!0),P&&(T(),this.registerPrivacyActions(),this.createTable(),this.table?.layout(this.height,this.width))}))}static{this.ID=n3}static{this.TITLE=L(13436,"Ports")}registerPrivacyActions(){for(let e of this.tunnelService.privacyOptions){let t=`remote.tunnel.privacy${e.id}`;$e.registerCommand(t,Eco.handler(e.id)),ve.appendMenuItem(D.TunnelPrivacy,{order:0,command:{id:t,title:e.label,toggled:fwi.isEqualTo(e.id)}})}}get portCount(){return this.remoteExplorerService.tunnelModel.forwarded.size+this.remoteExplorerService.tunnelModel.detected.size}createTable(){if(!this.panelContainer)return;this.tableDisposables.clear(),Rt(this.panelContainer);let e=M(this.panelContainer,_(".customview-tree"));e.classList.add("ports-view"),e.classList.add("file-icon-themable-tree","show-file-icons");let t=new mJe(this.instantiationService,this.contextKeyService,this.menuService,this.contextViewService,this.remoteExplorerService,this.commandService,this.configurationService),o=[new dwi,new uwi,new pwi,new mwi];this.tunnelService.canChangePrivacy&&o.push(new gwi),o.push(new hwi),this.table=this.instantiationService.createInstance(MC,"RemoteTunnels",e,new cwi(this.remoteExplorerService),o,[t],{keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:l=>l.label},multipleSelectionSupport:!0,accessibilityProvider:{getAriaLabel:l=>l instanceof mx?`${l.tooltipPostfix} ${l.portTooltip} ${l.iconTooltip} ${l.processTooltip} ${l.originTooltip} ${this.tunnelService.canChangePrivacy?l.privacy.label:""}`:l.label,getWidgetAriaLabel:()=>d(13488,null)},openOnSingleClick:!0});let n=this.tableDisposables.add(new rs);t.actionRunner=n,this.tableDisposables.add(this.table),this.tableDisposables.add(this.table.onContextMenu(l=>this.onContextMenu(l,n))),this.tableDisposables.add(this.table.onMouseDblClick(l=>this.onMouseDblClick(l))),this.tableDisposables.add(this.table.onDidChangeFocus(l=>this.onFocusChanged(l))),this.tableDisposables.add(this.table.onDidChangeSelection(l=>this.onSelectionChanged(l))),this.tableDisposables.add(this.table.onDidFocus(()=>this.tunnelViewFocusContext.set(!0))),this.tableDisposables.add(this.table.onDidBlur(()=>this.tunnelViewFocusContext.set(!1)));let r=()=>this.table?.splice(0,Number.POSITIVE_INFINITY,this.viewModel.all);r();let s=this.portCount;this.tableDisposables.add(U.debounce(this.viewModel.onForwardedPortsChanged,(l,c)=>c,50)(()=>{let l=this.portCount;(s===0||l===0)&&s!==l&&this._onDidChangeViewWelcomeState.fire(),s=l,r()})),this.tableDisposables.add(this.table.onMouseClick(l=>{if(this.hasOpenLinkModifier(l.browserEvent)&&this.table){let c=this.table.getSelectedElements();(c.length===0||c.length===1&&c[0]===l.element)&&this.commandService.executeCommand(FA.ID,l.element)}})),this.tableDisposables.add(this.table.onDidOpen(l=>{!l.element||l.element.tunnelType!=="Forwarded"||l.browserEvent?.type==="dblclick"&&this.commandService.executeCommand(jZ.ID)})),this.tableDisposables.add(this.remoteExplorerService.onDidChangeEditable(l=>{this.isEditing=!!this.remoteExplorerService.getEditableData(l?.tunnel,l?.editId),this._onDidChangeViewWelcomeState.fire(),this.isEditing||e.classList.remove("highlight"),r(),this.isEditing?(e.classList.add("highlight"),l||this.table?.reveal(this.table.indexOf(this.viewModel.input))):(l&&l.tunnel.tunnelType!=="Add"&&this.table?.setFocus(this.lastFocus),this.focus())}))}renderBody(e){super.renderBody(e),this.panelContainer=M(e,_(".tree-explorer-viewlet-tree-view")),this.createTable()}shouldShowWelcome(){return this.viewModel.isEmpty()&&!this.isEditing}focus(){super.focus(),this.table?.domFocus()}onFocusChanged(e){e.indexes.length>0&&e.elements.length>0&&(this.lastFocus=[...e.indexes]);let t=e.elements,o=t&&t.length?t[0]:void 0;o?(this.tunnelViewSelectionContext.set(Qp(o.remoteHost,o.remotePort)),this.tunnelTypeContext.set(o.tunnelType),this.tunnelCloseableContext.set(!!o.closeable),this.tunnelPrivacyContext.set(o.privacy.id),this.tunnelProtocolContext.set(o.protocol==="https"?"https":"https"),this.portChangableContextKey.set(!!o.localPort)):(this.tunnelTypeContext.reset(),this.tunnelViewSelectionContext.reset(),this.tunnelCloseableContext.reset(),this.tunnelPrivacyContext.reset(),this.tunnelProtocolContext.reset(),this.portChangableContextKey.reset())}hasOpenLinkModifier(e){let t=this.configurationService.getValue("editor"),o=!1;return t.multiCursorModifier==="ctrlCmd"?o=e.altKey:Ze?o=e.metaKey:o=e.ctrlKey,o}onSelectionChanged(e){let t=e.elements;t.length>1?this.tunnelViewMultiSelectionContext.set(t.map(o=>Qp(o.remoteHost,o.remotePort))):this.tunnelViewMultiSelectionContext.set(void 0)}onContextMenu(e,t){if(e.element!==void 0&&!(e.element instanceof mx))return;e.browserEvent.preventDefault(),e.browserEvent.stopPropagation();let o=e.element;o?(this.table?.setFocus([this.table.indexOf(o)]),this.tunnelTypeContext.set(o.tunnelType),this.tunnelCloseableContext.set(!!o.closeable),this.tunnelPrivacyContext.set(o.privacy.id),this.tunnelProtocolContext.set(o.protocol),this.portChangableContextKey.set(!!o.localPort)):(this.tunnelTypeContext.set("Add"),this.tunnelCloseableContext.set(!1),this.tunnelPrivacyContext.set(void 0),this.tunnelProtocolContext.set(void 0),this.portChangableContextKey.set(!1)),this.contextMenuService.showContextMenu({menuId:D.TunnelContext,menuActionOptions:{shouldForwardArgs:!0},contextKeyService:this.table?.contextKeyService,getAnchor:()=>e.anchor,getActionViewItem:n=>{let r=this.keybindingService.lookupKeybinding(n.id);if(r)return new hs(n,n,{label:!0,keybinding:r.getLabel()})},onHide:n=>{n&&this.table?.domFocus()},getActionsContext:()=>o?.strip(),actionRunner:t})}onMouseDblClick(e){e.element||this.commandService.executeCommand(Gw.INLINE_ID)}layoutBody(e,t){this.height=e,this.width=t,super.layoutBody(e,t),this.table?.layout(e,t)}};C0=I([m(2,_e),m(3,Xe),m(4,X),m(5,B),m(6,F),m(7,Bi),m(8,Je),m(9,Ue),m(10,ge),m(11,Kt),m(12,Le),m(13,du),m(14,nt),m(15,_p),m(16,Wn)],C0);var VFt=class{constructor(i,e){this.id=C0.ID;this.name=C0.TITLE;this.canToggleVisibility=!0;this.hideByDefault=!1;this.group="details@0";this.order=-500;this.canMoveView=!0;this.containerIcon=WFt;this.ctorDescriptor=new Ft(C0,[i]),this.remoteAuthority=e.remoteAuthority?e.remoteAuthority.split("+")[0]:void 0}};function QZ(a){return a&&a.tunnelType&&a.remoteHost&&a.source}var jZ;(o=>{o.ID="remote.tunnel.label",o.LABEL=d(13450,null),o.COMMAND_ID_KEYWORD="label";function t(){return async(n,r)=>{let s=n.get(du),l;if(QZ(r))l=r;else{let c=n.get(X).getContextKeyValue(SJe),u=c?s.tunnelModel.forwarded.get(c):void 0;if(u){let p=n.get(_p);l=mx.createFromTunnel(s,p,u)}}if(l){let c=l;return new Promise(u=>{let p=c.name?c.name:`${c.remotePort}`;s.setEditable(c,2,{onFinish:async(h,g)=>{h=h.trim(),s.setEditable(c,2,null);let f=g&&h!==p;f&&await s.tunnelModel.name(c.remoteHost,c.remotePort,h),u(f?{port:c.remotePort,label:h}:void 0)},validationMessage:()=>null,placeholder:d(13465,null),startingValue:p})})}}}o.handler=t})(jZ||={});var x6o=d(13467,null),vwi=65536,Cco=d(13466,null,vwi),xco=d(13470,null),k6o=d(13469,null),Gw;(c=>{c.INLINE_ID="remote.tunnel.forwardInline",c.COMMANDPALETTE_ID="remote.tunnel.forwardCommandPalette",c.LABEL=L(13445,"Forward a Port"),c.TREEITEM_LABEL=d(13448,null);let o=d(13449,null);function n(u,p,h,g){let f=qYe(h);if(f){if(f.port>=vwi)return{content:Cco,severity:ft.Error};if(g&&p.isPortPrivileged(f.port))return{content:xco,severity:ft.Info};if(Pb(u.tunnelModel.forwarded,f.host,f.port))return{content:k6o,severity:ft.Error}}else return{content:x6o,severity:ft.Error};return null}function r(u,p,h,g){p?typeof p=="string"&&u.warn(d(13447,null,h,g,p)):u.warn(d(13446,null,h,g))}function s(){return async(u,p)=>{let h=u.get(du),g=u.get(Ne),f=u.get(_p);h.setEditable(void 0,1,{onFinish:async(v,b)=>{h.setEditable(void 0,1,null);let S;b&&(S=qYe(v))&&h.forward({remote:{host:S.host,port:S.port},elevateIfNeeded:!0}).then(y=>r(g,y,S.host,S.port))},validationMessage:v=>n(h,f,v,f.canElevate),placeholder:o})}}c.inlineHandler=s;function l(){return async(u,p)=>{let h=u.get(du),g=u.get(Ne),f=u.get($t),v=u.get(Ue),b=u.get(_p);await f.openView(C0.ID,!0);let S=await v.input({prompt:o,validateInput:w=>Promise.resolve(n(h,b,w,b.canElevate))}),y;S&&(y=qYe(S))&&h.forward({remote:{host:y.host,port:y.port},elevateIfNeeded:!0}).then(w=>r(g,w,y.host,y.port))}}c.commandPaletteHandler=l})(Gw||={});function kco(a,i,e){let t=a.map(o=>{let n=mx.createFromTunnel(i,e,o);return{label:n.label,description:n.processDescription,tunnel:n}});return t.length===0&&t.push({label:d(13440,null,Gw.LABEL.value)}),t}var uH;(n=>{n.INLINE_ID="remote.tunnel.closeInline",n.COMMANDPALETTE_ID="remote.tunnel.closeCommandPalette",n.LABEL=L(13439,"Stop Forwarding Port");function t(){return async(r,s)=>{let l=r.get(X),c=r.get(du),u=[],p=l.getContextKeyValue(Sco);if(p)p.forEach(h=>{let g=c.tunnelModel.forwarded.get(h);g&&u?.push(g)});else if(QZ(s))u=[s];else{let h=l.getContextKeyValue(SJe),g=h?c.tunnelModel.forwarded.get(h):void 0;g&&(u=[g])}if(!(!u||u.length===0))return Promise.all(u.map(h=>c.close({host:h.remoteHost,port:h.remotePort},"User")))}}n.inlineHandler=t;function o(){return async r=>{let s=r.get(Ue),l=r.get(du),c=r.get(_p),u=r.get(ge),p=kco(Array.from(l.tunnelModel.forwarded.values()).filter(g=>g.closeable),l,c),h=await s.pick(p,{placeHolder:d(13441,null)});h&&h.tunnel?await l.close({host:h.tunnel.remoteHost,port:h.tunnel.remotePort},"User"):h&&await u.executeCommand(Gw.COMMANDPALETTE_ID)}}n.commandPaletteHandler=o})(uH||={});var FA;(o=>{o.ID="remote.tunnel.open",o.LABEL=d(13451,null);function e(){return async(n,r)=>{let s;if(QZ(r)?s=Qp(r.remoteHost,r.remotePort):rSi(r)&&(s=Qp(r.tunnelRemoteHost,r.tunnelRemotePort)),s){let l=n.get(du).tunnelModel,c=n.get(Je);return t(l,c,s)}}}o.handler=e;function t(n,r,s){let l=n.forwarded.get(s)||n.detected.get(s);return l?r.open(l.localUri,{allowContributedOpeners:!1}):Promise.resolve()}o.run=t})(FA||={});var pH;(o=>{o.ID="remote.tunnel.openPreview",o.LABEL=d(13456,null);function e(){return async(n,r)=>{let s;if(QZ(r)?s=Qp(r.remoteHost,r.remotePort):rSi(r)&&(s=Qp(r.tunnelRemoteHost,r.tunnelRemotePort)),s){let l=n.get(du).tunnelModel,c=n.get(Je),u=n.get(oZ);return t(l,c,u,s)}}}o.handler=e;async function t(n,r,s,l){let c=n.forwarded.get(l)||n.detected.get(l);if(c){let u=c.remoteHost.includes(":")?`[${c.remoteHost}]`:c.remoteHost,p=A.parse(`http://${u}:${c.remotePort}`),h=await s.getOpener(c.localUri,{sourceUri:p},Se.None);return h?h.openExternalUri(c.localUri,{sourceUri:p},Se.None):r.open(c.localUri)}return Promise.resolve()}o.run=t})(pH||={});var hJe;(t=>{t.ID="remote.tunnel.openCommandPalette",t.LABEL=d(13452,null);function e(){return async(o,n)=>{let r=o.get(du),s=o.get(_p),l=r.tunnelModel,c=o.get(Ue),u=o.get(Je),p=o.get(ge),h=[...l.forwarded,...l.detected].map(f=>{let v=mx.createFromTunnel(r,s,f[1]);return{label:v.label,description:v.processDescription,tunnel:v}});h.length===0?h.push({label:d(13453,null)}):h.push({label:d(13455,null)});let g=await c.pick(h,{placeHolder:d(13454,null)});if(g&&g.tunnel)return FA.run(l,u,Qp(g.tunnel.remoteHost,g.tunnel.remotePort));if(g)return p.executeCommand(`${n3}.focus`)}}t.handler=e})(hJe||={});var mH;(s=>{s.INLINE_ID="remote.tunnel.copyAddressInline",s.COMMANDPALETTE_ID="remote.tunnel.copyAddressCommandPalette",s.INLINE_LABEL=d(13443,null),s.COMMANDPALETTE_LABEL=d(13442,null);async function o(l,c,u){let p=l.tunnelModel.address(u.remoteHost,u.remotePort);p&&await c.writeText(p.toString())}function n(){return async(l,c)=>{let u=l.get(du),p;if(QZ(c))p=c;else{let h=l.get(X).getContextKeyValue(SJe);p=h?u.tunnelModel.forwarded.get(h):void 0}if(p)return o(u,l.get(Fi),p)}}s.inlineHandler=n;function r(){return async(l,c)=>{let u=l.get(Ue),p=l.get(du),h=l.get(_p),g=l.get(ge),f=l.get(Fi),v=Array.from(p.tunnelModel.forwarded.values()).concat(Array.from(p.tunnelModel.detected.values())),b=await u.pick(kco(v,p,h),{placeHolder:d(13444,null)});b&&b.tunnel?await o(p,f,b.tunnel):b&&await g.executeCommand(Gw.COMMANDPALETTE_ID)}}s.commandPaletteHandler=r})(mH||={});var gJe;(o=>{o.ID="remote.tunnel.changeLocalPort",o.LABEL=d(13437,null);function e(n,r,s){if(r.match(/^[0-9]+$/)){if(Number(r)>=vwi)return{content:Cco,severity:ft.Error};if(s&&n.isPortPrivileged(Number(r)))return{content:xco,severity:ft.Info}}else return{content:d(13468,null),severity:ft.Error};return null}function t(){return async(n,r)=>{let s=n.get(du),l=n.get(Ne),c=n.get(_p),u;if(QZ(r))u=r;else{let p=n.get(X).getContextKeyValue(SJe),h=p?s.tunnelModel.forwarded.get(p):void 0;if(h){let g=n.get(_p);u=mx.createFromTunnel(s,g,h)}}if(u){let p=u;s.setEditable(p,3,{onFinish:async(h,g)=>{if(s.setEditable(p,3,null),g){await s.close({host:p.remoteHost,port:p.remotePort},"Other");let f=Number(h),v=await s.forward({remote:{host:p.remoteHost,port:p.remotePort},local:f,name:p.name,elevateIfNeeded:!0,source:p.source});v&&typeof v!="string"&&v.tunnelLocalPort!==f&&l.warn(d(13438,null,h,v.tunnelLocalPort??v.localAddress))}},validationMessage:h=>e(c,h,c.canElevate),placeholder:d(13463,null)})}}}o.handler=t})(gJe||={});var Eco;(i=>{function a(e){return async(t,o)=>{if(QZ(o)){let n=t.get(du);return await n.close({host:o.remoteHost,port:o.remotePort},"Other"),n.forward({remote:{host:o.remoteHost,port:o.remotePort},local:o.localPort,name:o.name,elevateIfNeeded:!0,privacy:e,source:o.source})}}}i.handler=a})(Eco||={});var L3;(s=>{s.ID_HTTP="remote.tunnel.setProtocolHttp",s.ID_HTTPS="remote.tunnel.setProtocolHttps",s.LABEL_HTTP=d(13457,null),s.LABEL_HTTPS=d(13458,null);async function o(l,c,u,p){if(QZ(l)){let h={protocol:c},g=p.remoteAuthority?4:3;return u.tunnelModel.configPortsAttributes.addAttributes(l.remotePort,h,g)}}function n(){return async(l,c)=>o(c,"http",l.get(du),l.get(At))}s.handlerHttp=n;function r(){return async(l,c)=>o(c,"https",l.get(du),l.get(At))}s.handlerHttps=r})(L3||={});var bwi=10,Bpe=vJe.isEqualTo("Forwarded"),Hpe=C.or(Bpe,vJe.isEqualTo("Detected")),YZ=Ico.isEqualTo(void 0);Ct.registerCommandAndKeybindingRule({id:jZ.ID,weight:200+bwi,when:C.and(HFt,Bpe,YZ),primary:60,mac:{primary:3},handler:jZ.handler()});$e.registerCommand(Gw.INLINE_ID,Gw.inlineHandler());$e.registerCommand(Gw.COMMANDPALETTE_ID,Gw.commandPaletteHandler());Ct.registerCommandAndKeybindingRule({id:uH.INLINE_ID,weight:200+bwi,when:C.and(bJe,HFt),primary:20,mac:{primary:2049,secondary:[20]},handler:uH.inlineHandler()});$e.registerCommand(uH.COMMANDPALETTE_ID,uH.commandPaletteHandler());$e.registerCommand(FA.ID,FA.handler());$e.registerCommand(pH.ID,pH.handler());$e.registerCommand(hJe.ID,hJe.handler());Ct.registerCommandAndKeybindingRule({id:mH.INLINE_ID,weight:200+bwi,when:C.and(HFt,Hpe,YZ),primary:2081,handler:mH.inlineHandler()});$e.registerCommand(mH.COMMANDPALETTE_ID,mH.commandPaletteHandler());$e.registerCommand(gJe.ID,gJe.handler());$e.registerCommand(L3.ID_HTTP,L3.handlerHttp());$e.registerCommand(L3.ID_HTTPS,L3.handlerHttps());ve.appendMenuItem(D.CommandPalette,{command:{id:uH.COMMANDPALETTE_ID,title:uH.LABEL},when:b2});ve.appendMenuItem(D.CommandPalette,{command:{id:Gw.COMMANDPALETTE_ID,title:Gw.LABEL},when:b2});ve.appendMenuItem(D.CommandPalette,{command:{id:mH.COMMANDPALETTE_ID,title:mH.COMMANDPALETTE_LABEL},when:b2});ve.appendMenuItem(D.CommandPalette,{command:{id:hJe.ID,title:hJe.LABEL},when:b2});ve.appendMenuItem(D.TunnelContext,{group:"._open",order:0,command:{id:FA.ID,title:FA.LABEL},when:C.and(Hpe,YZ)});ve.appendMenuItem(D.TunnelContext,{group:"._open",order:1,command:{id:pH.ID,title:pH.LABEL},when:C.and(Hpe,YZ)});ve.appendMenuItem(D.TunnelContext,{group:"0_manage",order:1,command:{id:jZ.ID,title:jZ.LABEL,icon:lwi},when:C.and(Bpe,YZ)});ve.appendMenuItem(D.TunnelContext,{group:"2_localaddress",order:0,command:{id:mH.INLINE_ID,title:mH.INLINE_LABEL},when:C.and(Hpe,YZ)});ve.appendMenuItem(D.TunnelContext,{group:"2_localaddress",order:1,command:{id:gJe.ID,title:gJe.LABEL},when:C.and(Bpe,yco,YZ)});ve.appendMenuItem(D.TunnelContext,{group:"2_localaddress",order:2,submenu:D.TunnelPrivacy,title:d(13484,null),when:C.and(Bpe,bco)});ve.appendMenuItem(D.TunnelContext,{group:"2_localaddress",order:3,submenu:D.TunnelProtocol,title:d(13485,null),when:C.and(Bpe,YZ,wco)});ve.appendMenuItem(D.TunnelContext,{group:"3_forward",order:0,command:{id:uH.INLINE_ID,title:uH.LABEL},when:bJe});ve.appendMenuItem(D.TunnelContext,{group:"3_forward",order:1,command:{id:Gw.INLINE_ID,title:Gw.LABEL}});ve.appendMenuItem(D.TunnelProtocol,{order:0,command:{id:L3.ID_HTTP,title:L3.LABEL_HTTP,toggled:BFt.isEqualTo("http")}});ve.appendMenuItem(D.TunnelProtocol,{order:1,command:{id:L3.ID_HTTPS,title:L3.LABEL_HTTPS,toggled:BFt.isEqualTo("https")}});ve.appendMenuItem(D.TunnelPortInline,{group:"0_manage",order:0,command:{id:Gw.INLINE_ID,title:Gw.TREEITEM_LABEL,icon:dco},when:vJe.isEqualTo("Candidate")});ve.appendMenuItem(D.TunnelPortInline,{group:"0_manage",order:4,command:{id:jZ.ID,title:jZ.LABEL,icon:lwi},when:Bpe});ve.appendMenuItem(D.TunnelPortInline,{group:"0_manage",order:5,command:{id:uH.INLINE_ID,title:uH.LABEL,icon:uco},when:bJe});ve.appendMenuItem(D.TunnelLocalAddressInline,{order:-1,command:{id:mH.INLINE_ID,title:mH.INLINE_LABEL,icon:hco},when:Hpe});ve.appendMenuItem(D.TunnelLocalAddressInline,{order:0,command:{id:FA.ID,title:FA.LABEL,icon:pco},when:Hpe});ve.appendMenuItem(D.TunnelLocalAddressInline,{order:1,command:{id:pH.ID,title:pH.LABEL,icon:mco},when:Hpe});te("ports.iconRunningProcessForeground",MZi,d(13435,null));var UFt=class a extends x{constructor(e,t){super();this._onDidMatchLocalUrl=this._register(new E);this.onDidMatchLocalUrl=this._onDidMatchLocalUrl.event;this.listeners=new Map;this.terminalDataWorkers=this._register(new Vt);this.replPositions=new Map;e.instances.forEach(o=>{this.registerTerminalInstance(o)}),this._register(e.onDidCreateInstance(o=>{this.registerTerminalInstance(o)})),this._register(e.onDidDisposeInstance(o=>{this.listeners.get(o)?.dispose(),this.listeners.delete(o),this.terminalDataWorkers.deleteAndDispose(o)})),this._register(t.onDidNewSession(o=>{(!o.parentSession||o.parentSession&&o.hasSeparateRepl())&&this.listeners.set(o.getId(),o.onDidChangeReplElements(()=>{this.processNewReplElements(o)}))})),this._register(t.onDidEndSession(({session:o})=>{this.listeners.has(o.getId())&&(this.listeners.get(o.getId())?.dispose(),this.listeners.delete(o.getId()))}))}static{this.dataDebounceTimeout=500}static{this.maxDataLength=1e4}static{this.localUrlRegex=/\b\w{0,20}(?::\/\/)?(?:localhost|127\.0\.0\.1|0\.0\.0\.0|:\d{2,5})[\w\-\.\~:\/\?\#[\]\@!\$&\(\)\*\+\,\;\=]*/gim}static{this.extractPortRegex=/(localhost|127\.0\.0\.1|0\.0\.0\.0):(\d{1,5})/}static{this.localPythonServerRegex=/HTTP\son\s(127\.0\.0\.1|0\.0\.0\.0)\sport\s(\d+)/}static{this.excludeTerminals=["Dev Containers"]}registerTerminalInstance(e){a.excludeTerminals.includes(e.title)||this.listeners.set(e,e.onData(t=>{this.getOrCreateWorker(e).work(t)}))}getOrCreateWorker(e){let t=this.terminalDataWorkers.get(e);return t||(t=new pP(o=>this.processTerminalData(o),a.dataDebounceTimeout),this.terminalDataWorkers.set(e,t)),t}processTerminalData(e){e.reduce((o,n)=>o+n.length,0)>a.maxDataLength||this.processData(e.join(""))}processNewReplElements(e){let t=this.replPositions.get(e.getId()),o=e.getReplElements();if(this.replPositions.set(e.getId(),{position:o.length-1,tail:o[o.length-1]}),!t&&o.length>0)o.forEach(n=>this.processData(n.toString()));else if(t&&o.length-1!==t.position)for(let n=o.length-1;n>=0;n--){let r=o[n];if(r===t.tail)break;this.processData(r.toString())}}dispose(){super.dispose();for(let e of this.listeners.values())e.dispose()}processData(e){e=zS(e);let t=e.match(a.localUrlRegex)||[];if(t&&t.length>0)t.forEach(o=>{let n;try{n=new URL(o)}catch{}if(n){let r=o.match(a.extractPortRegex),s=parseFloat(n.port?n.port:r?r[2]:"NaN");if(!isNaN(s)&&Number.isInteger(s)&&s>0&&s<=65535){let l=n.hostname;if(l!=="0.0.0.0"&&l!=="127.0.0.1"&&(l="localhost"),s!==9229&&e.startsWith("Debugger listening on"))return;this._onDidMatchLocalUrl.fire({port:s,host:l})}}});else{let o=e.match(a.localPythonServerRegex);o&&o.length===3&&this._onDidMatchLocalUrl.fire({host:o[1],port:Number(o[2])})}}};var hH="workbench.view.remote",ULe=class extends x{constructor(e,t,o,n,r,s){super();this.contextKeyService=e;this.environmentService=t;this.remoteExplorerService=o;this.tunnelService=n;this.activityService=r;this.statusbarService=s;this.contextKeyListener=this._register(new me);this.activityBadge=this._register(new me);this.hasPortsInSession=!1;this._register(ne.as(Mn.ViewsRegistry).registerViewWelcomeContent(n3,{content:this.environmentService.remoteAuthority?d(13385,null,`command:${Gw.INLINE_ID}`):d(13373,null,`command:${Gw.INLINE_ID}`)})),this.enableBadgeAndStatusBar(),this.enableForwardedPortsFeatures(),this.environmentService.remoteAuthority||this._register(U.once(this.tunnelService.onTunnelOpened)(()=>{this.hasPortsInSession=!0}))}async getViewContainer(){return ne.as(Mn.ViewContainersRegistry).registerViewContainer({id:cNt,title:L(13374,"Ports"),icon:WFt,ctorDescriptor:new Ft(Dc,[cNt,{mergeViewWithContainerWhenSingleView:!0}]),storageId:cNt,hideIfEmpty:!0,order:5},1)}async enableForwardedPortsFeatures(){this.contextKeyListener.clear();let e=!!mpe.getValue(this.contextKeyService),t=!!b2.getValue(this.contextKeyService);if(e||t){t||this.contextKeyService.createKey(b2.key,!0);let o=await this.getViewContainer(),n=new VFt(new HLe(this.remoteExplorerService,this.tunnelService),this.environmentService),r=ne.as(Mn.ViewsRegistry);o&&(this.remoteExplorerService.enablePortsFeatures(!e),r.registerViews([n],o))}else this.contextKeyListener.value=this.contextKeyService.onDidChangeContext(o=>{o.affectsSome(new Set([...mpe.keys(),...b2.keys()]))&&this.enableForwardedPortsFeatures()})}enableBadgeAndStatusBar(){let e=ne.as(Mn.ViewsRegistry).onViewsRegistered(t=>{t.find(o=>o.views.find(n=>n.id===n3))&&(this._register(U.debounce(this.remoteExplorerService.tunnelModel.onForwardPort,(o,n)=>n,50)(()=>{this.updateActivityBadge(),this.updateStatusBar()})),this._register(U.debounce(this.remoteExplorerService.tunnelModel.onClosePort,(o,n)=>n,50)(()=>{this.updateActivityBadge(),this.updateStatusBar()})),this.updateActivityBadge(),this.updateStatusBar(),e.dispose())})}async updateActivityBadge(){this.remoteExplorerService.tunnelModel.forwarded.size>0?this.activityBadge.value=this.activityService.showViewActivity(n3,{badge:new Rd(this.remoteExplorerService.tunnelModel.forwarded.size,e=>e===1?d(13371,null):d(13372,null,e))}):this.activityBadge.clear()}updateStatusBar(){!this.environmentService.remoteAuthority&&!this.hasPortsInSession||(this.entryAccessor?this.entryAccessor.update(this.entry):this._register(this.entryAccessor=this.statusbarService.addEntry(this.entry,"status.forwardedPorts",0,40)))}get entry(){let e,t=this.remoteExplorerService.tunnelModel.forwarded.size+this.remoteExplorerService.tunnelModel.detected.size,o=`${t}`;if(t===0)e=d(13378,null);else{let n=Array.from(this.remoteExplorerService.tunnelModel.forwarded.values());n.push(...Array.from(this.remoteExplorerService.tunnelModel.detected.values())),e=d(13379,null,n.map(r=>r.remotePort).join(", "))}return{name:d(13386,null),text:`$(radio-tower) ${o}`,ariaLabel:e,tooltip:e,command:`${n3}.focus`}}};ULe=I([m(0,X),m(1,At),m(2,du),m(3,_p),m(4,Sl),m(5,kr)],ULe);var zLe=class{constructor(i,e){this.remoteExplorerService=i;this.logService=e;this.remoteExplorerService.tunnelModel.environmentTunnelsSet?this.restore():U.once(this.remoteExplorerService.tunnelModel.onEnvironmentTunnelsSet)(async()=>{await this.restore()})}async restore(){return this.logService.trace("ForwardedPorts: Doing first restore."),this.remoteExplorerService.restore()}};zLe=I([m(0,du),m(1,se)],zLe);var KLe=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super();this.terminalService=e;this.notificationService=t;this.openerService=o;this.externalOpenerService=n;this.remoteExplorerService=r;this.contextKeyService=l;this.configurationService=c;this.debugService=u;this.tunnelService=h;this.hostService=g;this.logService=f;this.storageService=v;this.preferencesService=b;s.remoteAuthority&&(c.whenRemoteConfigurationLoaded().then(()=>p.getEnvironment()).then(S=>{this.setup(S),this._register(c.onDidChangeConfiguration(y=>{y.affectsConfiguration(xD)?this.setup(S):y.affectsConfiguration(QYe)&&!this.portListener&&this.listenForPorts()}))}),this.storageService.getBoolean("processPortForwardingFallback",1,!0)||this.configurationService.updateValue(QYe,0,5))}getPortAutoFallbackNumber(){let e=this.configurationService.inspect(QYe);if(e.value!==void 0&&(e.value===0||e.value!==e.defaultValue))return e.value;let t=this.configurationService.inspect(xD);return t.applicationValue===S2||t.userValue===S2||t.userLocalValue===S2||t.userRemoteValue===S2||t.workspaceFolderValue===S2||t.workspaceValue===S2?0:e.value??20}listenForPorts(){let e=this.getPortAutoFallbackNumber();if(e===0){this.portListener?.dispose();return}this.procForwarder&&!this.portListener&&this.configurationService.getValue(xD)===S2?this.portListener=this._register(this.remoteExplorerService.tunnelModel.onForwardPort(async()=>{if(e=this.getPortAutoFallbackNumber(),e===0){this.portListener?.dispose();return}Array.from(this.remoteExplorerService.tunnelModel.forwarded.values()).filter(t=>t.source.source===1).length>e&&(await this.configurationService.updateValue(xD,yDe),this.notificationService.notify({message:d(13375,null),severity:bt.Warning,actions:{primary:[ii({id:"switchBack",label:d(13377,null),run:async()=>{await this.configurationService.updateValue(xD,S2),await this.configurationService.updateValue(QYe,0,5),this.portListener?.dispose(),this.portListener=void 0}}),ii({id:"showPortSourceSetting",label:d(13376,null),run:async()=>{await this.preferencesService.openSettings({query:"remote.autoForwardPortsSource"})}})]}}))})):(this.portListener?.dispose(),this.portListener=void 0)}setup(e){let t=this.procForwarder?.forwarded,o=this.outputForwarder||this.procForwarder;if(this.procForwarder?.dispose(),this.procForwarder=void 0,this.outputForwarder?.dispose(),this.outputForwarder=void 0,e?.os!==3)this.configurationService.inspect(xD).default?.value!==vZ&&ne.as(Jt.Configuration).registerDefaultConfigurations([{overrides:{"remote.autoForwardPortsSource":vZ}}]),this.outputForwarder=this._register(new KFt(this.terminalService,this.notificationService,this.openerService,this.externalOpenerService,this.remoteExplorerService,this.configurationService,this.debugService,this.tunnelService,this.hostService,this.logService,this.contextKeyService,()=>!1));else{let n=()=>this.configurationService.getValue(xD)===S2;n()?this.procForwarder=this._register(new GFt(!1,t,!o,this.configurationService,this.remoteExplorerService,this.notificationService,this.openerService,this.externalOpenerService,this.tunnelService,this.hostService,this.logService,this.contextKeyService)):this.configurationService.getValue(xD)===yDe&&(this.procForwarder=this._register(new GFt(!0,t,!o,this.configurationService,this.remoteExplorerService,this.notificationService,this.openerService,this.externalOpenerService,this.tunnelService,this.hostService,this.logService,this.contextKeyService))),this.outputForwarder=this._register(new KFt(this.terminalService,this.notificationService,this.openerService,this.externalOpenerService,this.remoteExplorerService,this.configurationService,this.debugService,this.tunnelService,this.hostService,this.logService,this.contextKeyService,n))}this.listenForPorts()}};KLe=I([m(0,nn),m(1,Ne),m(2,Je),m(3,oZ),m(4,du),m(5,At),m(6,X),m(7,fg),m(8,Ni),m(9,bo),m(10,_p),m(11,Zt),m(12,se),m(13,ce),m(14,Go)],KLe);var zFt=class a extends x{constructor(e,t,o,n,r,s,l,c){super();this.notificationService=e;this.remoteExplorerService=t;this.openerService=o;this.externalOpenerService=n;this.tunnelService=r;this.hostService=s;this.logService=l;this.contextKeyService=c;this.notificationDisposable=this._register(new me);this.alreadyOpenedOnce=new Set;this.lastNotifyTime=new Date,this.lastNotifyTime.setFullYear(this.lastNotifyTime.getFullYear()-1)}static{this.NOTIFY_COOL_DOWN=5e3}async doAction(e){this.logService.trace(`ForwardedPorts: (OnAutoForwardedAction) Starting action for ${e[0]?.tunnelRemotePort}`),this.doActionTunnels=e;let t=await this.portNumberHeuristicDelay();if(this.logService.trace(`ForwardedPorts: (OnAutoForwardedAction) Heuristic chose ${t?.tunnelRemotePort}`),t){let n=(await this.remoteExplorerService.tunnelModel.getAttributes([{port:t.tunnelRemotePort,host:t.tunnelRemoteHost}]))?.get(t.tunnelRemotePort)?.onAutoForward;switch(this.logService.trace(`ForwardedPorts: (OnAutoForwardedAction) onAutoForward action is ${n}`),n){case"openBrowserOnce":{if(this.alreadyOpenedOnce.has(t.localAddress))break;this.alreadyOpenedOnce.add(t.localAddress)}case"openBrowser":{let r=Qp(t.tunnelRemoteHost,t.tunnelRemotePort);await FA.run(this.remoteExplorerService.tunnelModel,this.openerService,r);break}case"openPreview":{let r=Qp(t.tunnelRemoteHost,t.tunnelRemotePort);await pH.run(this.remoteExplorerService.tunnelModel,this.openerService,this.externalOpenerService,r);break}case"silent":break;default:{let r=new Date().getTime()-this.lastNotifyTime.getTime();this.logService.trace(`ForwardedPorts: (OnAutoForwardedAction) time elapsed since last notification ${r} ms`),r>a.NOTIFY_COOL_DOWN&&await this.showNotification(t)}}}}hide(e){this.doActionTunnels&&(this.doActionTunnels=this.doActionTunnels.filter(t=>!e.includes(t.tunnelRemotePort))),this.lastShownPort&&e.indexOf(this.lastShownPort)>=0&&this.lastNotification?.close()}async portNumberHeuristicDelay(){if(this.logService.trace("ForwardedPorts: (OnAutoForwardedAction) Starting heuristic delay"),!this.doActionTunnels||this.doActionTunnels.length===0)return;this.doActionTunnels=this.doActionTunnels.sort((t,o)=>t.tunnelRemotePort-o.tunnelRemotePort);let e=this.doActionTunnels.shift();return e.tunnelRemotePort%1e3===0?(this.logService.trace(`ForwardedPorts: (OnAutoForwardedAction) Heuristic chose tunnel because % 1000: ${e.tunnelRemotePort}`),this.newerTunnel=e,e):e.tunnelRemotePort<1e4&&e.tunnelRemotePort!==9229?(this.logService.trace(`ForwardedPorts: (OnAutoForwardedAction) Heuristic chose tunnel because < 10000: ${e.tunnelRemotePort}`),this.newerTunnel=e,e):(this.logService.trace(`ForwardedPorts: (OnAutoForwardedAction) Waiting for "better" tunnel than ${e.tunnelRemotePort}`),this.newerTunnel=void 0,new Promise(t=>{setTimeout(()=>{this.newerTunnel?t(void 0):this.doActionTunnels?.includes(e)?t(e):t(void 0)},3e3)}))}async basicMessage(e){let o=(await this.remoteExplorerService.tunnelModel.getAttributes([{host:e.tunnelRemoteHost,port:e.tunnelRemotePort}],!1))?.get(e.tunnelRemotePort)?.label;return d(13380,null,o?` (${o})`:"",e.tunnelRemotePort)}linkMessage(){return d(13384,null,`command:${C0.ID}.focus`)}async showNotification(e){if(!await this.hostService.hadLastFocus())return;this.lastNotification?.close();let t=await this.basicMessage(e),o=[this.openBrowserChoice(e)];(!Wt||vco.getValue(this.contextKeyService))&&o.push(this.openPreviewChoice(e)),e.tunnelLocalPort!==e.tunnelRemotePort&&this.tunnelService.canElevate&&this.tunnelService.isPortPrivileged(e.tunnelRemotePort)&&(t+=d(13382,null,e.tunnelRemotePort),o.unshift(this.elevateChoice(e))),e.privacy==="private"&&Wt&&this.tunnelService.canChangePrivacy&&o.push(this.makePublicChoice(e)),t+=this.linkMessage(),this.lastNotification=this.notificationService.prompt(bt.Info,t,o,{neverShowAgain:{id:"remote.tunnelsView.autoForwardNeverShow",isSecondary:!0}}),this.lastShownPort=e.tunnelRemotePort,this.lastNotifyTime=new Date,this.notificationDisposable.value=this.lastNotification.onDidClose(()=>{this.lastNotification=void 0,this.lastShownPort=void 0})}makePublicChoice(e){return{label:d(13383,null),run:async()=>{let t=Pb(this.remoteExplorerService.tunnelModel.forwarded,e.tunnelRemoteHost,e.tunnelRemotePort);return await this.remoteExplorerService.close({host:e.tunnelRemoteHost,port:e.tunnelRemotePort},"Other"),this.remoteExplorerService.forward({remote:{host:e.tunnelRemoteHost,port:e.tunnelRemotePort},local:e.tunnelLocalPort,name:t?.name,elevateIfNeeded:!0,privacy:"public",source:t?.source})}}}openBrowserChoice(e){let t=Qp(e.tunnelRemoteHost,e.tunnelRemotePort);return{label:FA.LABEL,run:()=>FA.run(this.remoteExplorerService.tunnelModel,this.openerService,t)}}openPreviewChoice(e){let t=Qp(e.tunnelRemoteHost,e.tunnelRemotePort);return{label:pH.LABEL,run:()=>pH.run(this.remoteExplorerService.tunnelModel,this.openerService,this.externalOpenerService,t)}}elevateChoice(e){return{label:d(13381,null,e.tunnelRemotePort),run:async()=>{await this.remoteExplorerService.close({host:e.tunnelRemoteHost,port:e.tunnelRemotePort},"Other");let t=await this.remoteExplorerService.forward({remote:{host:e.tunnelRemoteHost,port:e.tunnelRemotePort},local:e.tunnelRemotePort,elevateIfNeeded:!0,source:lNt});!t||typeof t=="string"||(this.lastNotification?.close(),this.lastShownPort=t.tunnelRemotePort,this.lastNotification=this.notificationService.prompt(bt.Info,await this.basicMessage(t)+this.linkMessage(),[this.openBrowserChoice(t),this.openPreviewChoice(e)],{neverShowAgain:{id:"remote.tunnelsView.autoForwardNeverShow",isSecondary:!0}}),this.notificationDisposable.value=this.lastNotification.onDidClose(()=>{this.lastNotification=void 0,this.lastShownPort=void 0}))}}}},KFt=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this.terminalService=e;this.notificationService=t;this.openerService=o;this.externalOpenerService=n;this.remoteExplorerService=r;this.configurationService=s;this.debugService=l;this.tunnelService=c;this.hostService=u;this.logService=p;this.contextKeyService=h;this.privilegedOnly=g;this.notifier=new zFt(t,r,o,n,c,u,p,h),this._register(s.onDidChangeConfiguration(f=>{f.affectsConfiguration(r3)&&this.tryStartStopUrlFinder()})),this.portsFeatures=this._register(this.remoteExplorerService.onEnabledPortsFeatures(()=>{this.tryStartStopUrlFinder()})),this.tryStartStopUrlFinder(),s.getValue(xD)===yDe&&this._register(this.tunnelService.onTunnelClosed(f=>this.notifier.hide([f.port])))}tryStartStopUrlFinder(){this.configurationService.getValue(r3)?this.startUrlFinder():this.stopUrlFinder()}startUrlFinder(){!this.urlFinder&&this.remoteExplorerService.portsFeaturesEnabled!==2||(this.portsFeatures?.dispose(),this.urlFinder=this._register(new UFt(this.terminalService,this.debugService)),this._register(this.urlFinder.onDidMatchLocalUrl(async e=>{if(Pb(this.remoteExplorerService.tunnelModel.detected,e.host,e.port))return;let t=(await this.remoteExplorerService.tunnelModel.getAttributes([e]))?.get(e.port);if(t?.onAutoForward==="ignore"||this.privilegedOnly()&&!this.tunnelService.isPortPrivileged(e.port))return;let o=await this.remoteExplorerService.forward({remote:e,source:lNt},t??null);o&&typeof o!="string"&&this.notifier.doAction([o])})))}stopUrlFinder(){this.urlFinder&&(this.urlFinder.dispose(),this.urlFinder=void 0)}},GFt=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this.unforwardOnly=e;this.alreadyAutoForwarded=t;this.needsInitialCandidates=o;this.configurationService=n;this.remoteExplorerService=r;this.notificationService=s;this.openerService=l;this.externalOpenerService=c;this.tunnelService=u;this.hostService=p;this.logService=h;this.contextKeyService=g;this.autoForwarded=new Set;this.notifiedOnly=new Set;this.initialCandidates=new Set;this.notifier=new zFt(s,r,l,c,u,p,h,g),t?.forEach(f=>this.autoForwarded.add(f)),this.initialize()}get forwarded(){return this.autoForwarded}async initialize(){this.remoteExplorerService.tunnelModel.environmentTunnelsSet||await new Promise(e=>this.remoteExplorerService.tunnelModel.onEnvironmentTunnelsSet(()=>e())),this._register(this.configurationService.onDidChangeConfiguration(async e=>{e.affectsConfiguration(r3)&&await this.startStopCandidateListener()})),this.portsFeatures=this._register(this.remoteExplorerService.onEnabledPortsFeatures(async()=>{await this.startStopCandidateListener()})),this.startStopCandidateListener()}async startStopCandidateListener(){this.configurationService.getValue(r3)?await this.startCandidateListener():this.stopCandidateListener()}stopCandidateListener(){this.candidateListener&&(this.candidateListener.dispose(),this.candidateListener=void 0)}async startCandidateListener(){this.candidateListener||this.remoteExplorerService.portsFeaturesEnabled!==2||(this.portsFeatures?.dispose(),await this.setInitialCandidates(),this.configurationService.getValue(r3)&&(this.candidateListener=this._register(this.remoteExplorerService.tunnelModel.onCandidatesChanged(this.handleCandidateUpdate,this))))}async setInitialCandidates(){if(!this.needsInitialCandidates){this.logService.debug("ForwardedPorts: (ProcForwarding) Not setting initial candidates");return}let e=this.remoteExplorerService.tunnelModel.candidatesOrUndefined;e||(await new Promise(t=>this.remoteExplorerService.tunnelModel.onCandidatesChanged(()=>t())),e=this.remoteExplorerService.tunnelModel.candidates);for(let t of e)this.initialCandidates.add(Qp(t.host,t.port));this.logService.debug(`ForwardedPorts: (ProcForwarding) Initial candidates set to ${e.map(t=>t.port).join(", ")}`)}async forwardCandidates(){let e,t=[];this.logService.trace(`ForwardedPorts: (ProcForwarding) Attempting to forward ${this.remoteExplorerService.tunnelModel.candidates.length} candidates`);for(let o of this.remoteExplorerService.tunnelModel.candidates){if(!o.detail){this.logService.trace(`ForwardedPorts: (ProcForwarding) Port ${o.port} missing detail`);continue}e||(e=await this.remoteExplorerService.tunnelModel.getAttributes(this.remoteExplorerService.tunnelModel.candidates));let n=e?.get(o.port),r=Qp(o.host,o.port);if(this.initialCandidates.has(r)&&n?.onAutoForward===void 0||this.notifiedOnly.has(r)||this.autoForwarded.has(r))continue;let s=Pb(this.remoteExplorerService.tunnelModel.forwarded,o.host,o.port);if(Pb(this.remoteExplorerService.tunnelModel.detected,o.host,o.port))continue;if(n?.onAutoForward==="ignore"){this.logService.trace(`ForwardedPorts: (ProcForwarding) Port ${o.port} is ignored`);continue}let l=await this.remoteExplorerService.forward({remote:o,source:lNt},n??null);!s&&l?(this.logService.trace(`ForwardedPorts: (ProcForwarding) Port ${o.port} has been forwarded`),this.autoForwarded.add(r)):l&&(this.logService.trace(`ForwardedPorts: (ProcForwarding) Port ${o.port} has been notified`),this.notifiedOnly.add(r)),l&&typeof l!="string"&&t.push(l)}if(this.logService.trace(`ForwardedPorts: (ProcForwarding) Forwarded ${t.length} candidates`),t.length!==0)return t}async handleCandidateUpdate(e){let t=[],o;if(this.unforwardOnly){o=new Map;for(let r of this.remoteExplorerService.tunnelModel.forwarded.entries())r[1].source.source===1&&o.set(r[0],r[1])}else o=new Map(this.autoForwarded.entries());for(let r of e){let s=r[0],l=r[1],c=Pb(o,l.host,l.port);c?(typeof c=="string"?this.autoForwarded.delete(s):l={host:c.remoteHost,port:c.remotePort},await this.remoteExplorerService.close(l,"AutoForwardEnd"),t.push(l.port)):this.notifiedOnly.delete(s)?t.push(l.port):this.initialCandidates.delete(s)}if(this.unforwardOnly)return;t.length>0&&await this.notifier.hide(t);let n=await this.forwardCandidates();n&&await this.notifier.doAction(n)}};var Swi={webviewState:"webviewState"},XZ=class extends Gs{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super({...e,titleMenuId:D.ViewTitle,showActions:1},s,n,t,o,p,r,l,u,c);this.activityService=h;this.extensionService=g;this.progressService=f;this.storageService=v;this.viewService=b;this.webviewService=S;this.webviewViewService=y;this._webview=this._register(new me);this._webviewDisposables=this._register(new N);this._activated=!1;this.activity=this._register(new me);this._onDidChangeVisibility=this._register(new E);this.onDidChangeVisibility=this._onDidChangeVisibility.event;this._onDispose=this._register(new E);this.onDispose=this._onDispose.event;this.extensionId=e.fromExtensionId,this.defaultTitle=this.title,this.memento=new Al(`webviewView.${this.id}`,v),this.viewState=this.memento.getMemento(1,1),this._register(this.onDidChangeBodyVisibility(()=>this.updateTreeVisibility())),this._register(this.webviewViewService.onNewResolverRegistered(w=>{w.viewType===this.id&&this.updateTreeVisibility()})),this.updateTreeVisibility()}static getOriginStore(e){return this._originStore??=new OK("webviewViews.origins",e),this._originStore}dispose(){this._onDispose.fire(),clearTimeout(this._repositionTimeout),super.dispose()}focus(){super.focus(),this._webview.value?.focus()}renderBody(e){super.renderBody(e),this._container=e,this._rootContainer=void 0,this._resizeObserver||(this._resizeObserver=new ResizeObserver(()=>{setTimeout(()=>{this.layoutWebview()},0)}),this._register(Z(()=>{this._resizeObserver?.disconnect()})),this._resizeObserver.observe(e))}saveState(){this._webview.value&&(this.viewState[Swi.webviewState]=this._webview.value.state),this.memento.saveMemento(),super.saveState()}layoutBody(e,t){super.layoutBody(e,t),this.layoutWebview(new si(t,e))}updateTreeVisibility(){this.isBodyVisible()?(this.activate(),this._webview.value?.claim(this,Re(this.element),void 0)):this._webview.value?.release(this)}activate(){if(this._activated)return;this._activated=!0;let e=this.extensionId?XZ.getOriginStore(this.storageService).getOrigin(this.id,this.extensionId):void 0,t=this.webviewService.createWebviewOverlay({origin:e,providedViewType:this.id,title:this.title,options:{purpose:"webviewView"},contentOptions:{},extension:this.extensionId?{id:this.extensionId}:void 0});t.state=this.viewState[Swi.webviewState],this._webview.value=t,this._container&&this.layoutWebview(),this._webviewDisposables.add(Z(()=>{this._webview.value?.release(this)})),this._webviewDisposables.add(t.onDidUpdateState(()=>{this.viewState[Swi.webviewState]=t.state}));for(let n of[re.DRAG,re.DRAG_END,re.DRAG_ENTER,re.DRAG_LEAVE,re.DRAG_START])this._webviewDisposables.add(j(this._webview.value.container,n,r=>{r.preventDefault(),r.stopImmediatePropagation(),this.dropTargetElement.dispatchEvent(new DragEvent(r.type,r))}));this._webviewDisposables.add(new kJ(Re(this.element),()=>this._webview.value));let o=this._webviewDisposables.add(new Ye);this.withProgress(async()=>{await this.extensionService.activateByEvent(`onView:${this.id}`);let n=this,r={webview:t,onDidChangeVisibility:this.onDidChangeBodyVisibility,onDispose:this.onDispose,get title(){return n.setTitle},set title(s){n.updateTitle(s)},get description(){return n.titleDescription},set description(s){n.updateTitleDescription(s)},get badge(){return n.badge},set badge(s){n.updateBadge(s)},dispose:()=>{this._activated=!1,this._webview.clear(),this._webviewDisposables.clear()},show:s=>{this.viewService.openView(this.id,!s)}};await this.webviewViewService.resolve(this.id,r,o.token)})}updateTitle(e){this.setTitle=e,super.updateTitle(typeof e=="string"?e:this.defaultTitle)}updateBadge(e){if(!(this.badge?.value===e?.value&&this.badge?.tooltip===e?.tooltip)&&(this.badge=e,e)){let t={badge:new Rd(e.value,()=>e.tooltip),priority:150};this.activity.value=this.activityService.showViewActivity(this.id,t)}}async withProgress(e){return this.progressService.withProgress({location:this.id,delay:500},e)}onDidScrollRoot(){this.layoutWebview()}doLayoutWebview(e){let t=this._webview.value;!this._container||!t||((!this._rootContainer||!this._rootContainer.isConnected)&&(this._rootContainer=this.findRootContainer(this._container)),t.layoutWebviewOverElement(this._container,e,this._rootContainer))}layoutWebview(e){this.doLayoutWebview(e),clearTimeout(this._repositionTimeout),this._repositionTimeout=setTimeout(()=>this.doLayoutWebview(e),200)}findRootContainer(e){return Cg(e,"monaco-scrollable-element")??void 0}};XZ=I([m(1,B),m(2,X),m(3,Xe),m(4,F),m(5,_e),m(6,Je),m(7,nt),m(8,Le),m(9,Bi),m(10,Sl),m(11,lt),m(12,Fo),m(13,ce),m(14,$t),m(15,cp),m(16,R_e)],XZ);var Iwi={type:"object",properties:{id:{description:d(3419,null),type:"string",pattern:"^[a-zA-Z0-9_-]+$"},title:{description:d(3420,null),type:"string"},icon:{description:d(3418,null),type:"string"}},required:["id","title","icon"]},E6o={description:d(3421,null),type:"object",properties:{activitybar:{description:d(3392,null),type:"array",items:Iwi},panel:{description:d(3393,null),type:"array",items:Iwi},secondarySidebar:{description:d(3394,null),type:"array",items:Iwi}},additionalProperties:!1};var ywi=(t=>(t.Visible="visible",t.Hidden="hidden",t.Collapsed="collapsed",t))(ywi||{}),IJe={type:"object",required:["id","name","icon"],defaultSnippets:[{body:{id:"${1:id}",name:"${2:name}",icon:"${3:icon}"}}],properties:{type:{markdownDescription:d(3414,null),type:"string",enum:["tree","webview"],markdownEnumDescriptions:[d(3413,null),d(3415,null)]},id:{markdownDescription:d(3406,null),type:"string"},name:{description:d(3411,null),type:"string"},when:{description:d(3416,null),type:"string"},icon:{description:d(3405,null),type:"string"},contextualTitle:{description:d(3403,null),type:"string"},visibility:{description:d(3407,null),type:"string",enum:["visible","hidden","collapsed"],default:"visible",enumDescriptions:[d(3410,null),d(3409,null),d(3408,null)]},initialSize:{type:"number",description:d(3422,null)},accessibilityHelpContent:{type:"string",markdownDescription:d(3402,null)}}},T6o={type:"object",required:["id","name"],properties:{id:{description:d(3406,null),type:"string"},name:{description:d(3411,null),type:"string"},when:{description:d(3416,null),type:"string"},group:{description:d(3404,null),type:"string"},remoteName:{description:d(3412,null),type:["string","array"],items:{type:"string"}}}},_6o={description:d(3417,null),type:"object",properties:{explorer:{description:d(3397,null),type:"array",items:IJe,default:[]},debug:{description:d(3396,null),type:"array",items:IJe,default:[]},scm:{description:d(3399,null),type:"array",items:IJe,default:[]},test:{description:d(3400,null),type:"array",items:IJe,default:[]},remote:{description:d(3398,null),type:"array",items:T6o,default:[]}},additionalProperties:{description:d(3395,null),type:"array",items:IJe,default:[]}},_co=Rn.registerExtensionPoint({extensionPoint:"viewsContainers",jsonSchema:E6o}),D6o=Rn.registerExtensionPoint({extensionPoint:"views",deps:[_co],jsonSchema:_6o,activationEventsGenerator:function*(a){for(let i of a)for(let e of Object.values(i))for(let t of e)t.id&&(yield`onView:${t.id}`)}}),L6o=7,GLe=class{constructor(i,e){this.instantiationService=i;this.logService=e;this.viewContainersRegistry=ne.as(Mn.ViewContainersRegistry),this.viewsRegistry=ne.as(Mn.ViewsRegistry),this.handleAndRegisterCustomViewContainers(),this.handleAndRegisterCustomViews()}static{this.ID="workbench.contrib.viewsExtensionHandler"}handleAndRegisterCustomViewContainers(){_co.setHandler((i,{added:e,removed:t})=>{t.length&&this.removeCustomViewContainers(t),e.length&&this.addCustomViewContainers(e,this.viewContainersRegistry.all)})}addCustomViewContainers(i,e){let t=ne.as(Mn.ViewContainersRegistry),o=L6o+t.all.filter(s=>!!s.extensionId&&t.getViewContainerLocation(s)===0).length,n=5+t.all.filter(s=>!!s.extensionId&&t.getViewContainerLocation(s)===1).length+1,r=100+t.all.filter(s=>!!s.extensionId&&t.getViewContainerLocation(s)===2).length+1;for(let{value:s,collector:l,description:c}of i)Object.entries(s).forEach(([u,p])=>{if(this.isValidViewsContainer(p,l))switch(u){case"activitybar":o=this.registerCustomViewContainers(p,c,o,e,0);break;case"panel":n=this.registerCustomViewContainers(p,c,n,e,1);break;case"secondarySidebar":r=this.registerCustomViewContainers(p,c,r,e,2);break}})}removeCustomViewContainers(i){let e=ne.as(Mn.ViewContainersRegistry),t=i.reduce((o,n)=>(o.add(n.description.identifier),o),new ly);for(let o of e.all)if(o.extensionId&&t.has(o.extensionId)){let n=this.viewsRegistry.getViews(o);n.length&&this.viewsRegistry.moveViews(n,this.getDefaultViewContainer()),this.deregisterCustomViewContainer(o)}}isValidViewsContainer(i,e){if(!Array.isArray(i))return e.error(d(3388,null)),!1;for(let t of i){if(typeof t.id!="string"&&uc(t.id))return e.error(d(3378,null,"id")),!1;if(!/^[a-z0-9_-]+$/i.test(t.id))return e.error(d(3378,null,"id")),!1;if(typeof t.title!="string")return e.error(d(3381,null,"title")),!1;if(typeof t.icon!="string")return e.error(d(3381,null,"icon")),!1;if(uc(t.title))return e.warn(d(3379,null,"title")),!0}return!0}registerCustomViewContainers(i,e,t,o,n){return i.forEach(r=>{let l=q.fromString(r.icon)||Ge(e.extensionLocation,r.icon),c=`workbench.view.extension.${r.id}`,u=r.title||c,p=this.registerCustomViewContainer(c,u,l,t++,e.identifier,n);if(o.length){let h=[];for(let g of o)p!==g&&h.push(...this.viewsRegistry.getViews(g).filter(f=>f.originalContainerId===r.id));h.length&&this.viewsRegistry.moveViews(h,p)}}),t}registerCustomViewContainer(i,e,t,o,n,r){let s=this.viewContainersRegistry.get(i);return s||(s=this.viewContainersRegistry.registerViewContainer({id:i,title:{value:e,original:e},extensionId:n,ctorDescriptor:new Ft(Dc,[i,{mergeViewWithContainerWhenSingleView:!0}]),hideIfEmpty:!0,order:o,icon:t},r)),s}deregisterCustomViewContainer(i){this.viewContainersRegistry.deregisterViewContainer(i),ne.as(S0.Viewlets).deregisterPaneComposite(i.id)}handleAndRegisterCustomViews(){D6o.setHandler((i,{added:e,removed:t})=>{t.length&&this.removeViews(t),e.length&&this.addViews(e)})}addViews(i){let e=new Set,t=[];for(let o of i){let{value:n,collector:r}=o;Object.entries(n).forEach(([s,l])=>{if(!this.isValidViewDescriptors(l,r))return;if(s==="remote"&&!Ua(o.description,"contribViewsRemote")){r.warn(d(3390,null,s));return}if(s==="agentSessions"&&!Ua(o.description,"chatSessionsProvider")){r.warn(d(3380,null,s));return}let c=this.getViewContainer(s);c||r.warn(d(3389,null,s));let u=c||this.getDefaultViewContainer(),p=[];for(let h=0;h<l.length;h++){let g=l[h];if(e.has(g.id)){r.error(d(3373,null,g.id));continue}if(this.viewsRegistry.getView(g.id)!==null){r.error(d(3374,null,g.id));continue}let f=Ii.equals(o.description.identifier,u.extensionId)?h+1:u.viewOrderDelegate?u.viewOrderDelegate.getOrder(g.group):void 0,v;typeof g.icon=="string"&&(v=q.fromString(g.icon)||Ge(o.description.extensionLocation,g.icon));let b=this.convertInitialVisibility(g.visibility),S=this.getViewType(g.type);if(!S){r.error(d(3382,null,g.type));continue}let y;typeof g.initialSize=="number"&&(u.extensionId?.value===o.description.identifier.value?y=g.initialSize:this.logService.warn(`${o.description.identifier.value} tried to set the view size of ${g.id} but it was ignored because the view container does not belong to it.`));let w;Ua(o.description,"contribAccessibilityHelpContent")&&g.accessibilityHelpContent&&(w=new Ie(g.accessibilityHelpContent));let k={type:S,ctorDescriptor:S==="tree"?new Ft(AD):new Ft(XZ),id:g.id,name:{value:g.name,original:g.name},when:C.deserialize(g.when),containerIcon:v||c?.icon,containerTitle:g.contextualTitle||c&&(typeof c.title=="string"?c.title:c.title.value),canToggleVisibility:!0,canMoveView:c?.id!==hH,treeView:S==="tree"?this.instantiationService.createInstance(VLe,g.id,g.name,o.description.identifier.value):void 0,collapsed:this.showCollapsed(u)||b==="collapsed",order:f,extensionId:o.description.identifier,originalContainerId:s,group:g.group,remoteAuthority:g.remoteName||g.remoteAuthority,virtualWorkspace:g.virtualWorkspace,hideByDefault:b==="hidden",workspace:c?.id===hH?!0:void 0,weight:y,accessibilityHelpContent:w};e.add(k.id),p.push(k)}t.push({viewContainer:u,views:p})})}this.viewsRegistry.registerViews2(t)}getViewType(i){if(i==="webview")return"webview";if(!i||i==="tree")return"tree"}getDefaultViewContainer(){return this.viewContainersRegistry.get(nv)}removeViews(i){let e=i.reduce((t,o)=>(t.add(o.description.identifier),t),new ly);for(let t of this.viewContainersRegistry.all){let o=this.viewsRegistry.getViews(t).filter(n=>n.extensionId&&e.has(n.extensionId));if(o.length){this.viewsRegistry.deregisterViews(o,t);for(let n of o){let r=n;r.treeView&&r.treeView.dispose()}}}}convertInitialVisibility(i){if(Object.values(ywi).includes(i))return i}isValidViewDescriptors(i,e){if(!Array.isArray(i))return e.error(d(3377,null)),!1;for(let t of i){if(typeof t.id!="string")return e.error(d(3381,null,"id")),!1;if(typeof t.name!="string")return e.error(d(3381,null,"name")),!1;if(t.when&&typeof t.when!="string")return e.error(d(3376,null,"when")),!1;if(t.icon&&typeof t.icon!="string")return e.error(d(3376,null,"icon")),!1;if(t.contextualTitle&&typeof t.contextualTitle!="string")return e.error(d(3376,null,"contextualTitle")),!1;if(t.visibility&&!this.convertInitialVisibility(t.visibility))return e.error(d(3375,null,"visibility",Object.values(ywi).join(", "))),!1}return!0}getViewContainer(i){switch(i){case"explorer":return this.viewContainersRegistry.get(nv);case"debug":return this.viewContainersRegistry.get(cg);case"scm":return this.viewContainersRegistry.get(mue);case"remote":return this.viewContainersRegistry.get(hH);default:return this.viewContainersRegistry.get(`workbench.view.extension.${i}`)}}showCollapsed(i){switch(i.id){case nv:case mue:case cg:return!0}return!1}};GLe=I([m(0,F),m(1,se)],GLe);var wwi=class extends x{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.viewsContainers}render(e){let t=e.contributes?.viewsContainers||{},o=Object.keys(t).reduce((s,l)=>{let c=t[l];return s.push(...c.map(u=>({...u,location:l}))),s},[]);if(!o.length)return{data:{headers:[],rows:[]},dispose:()=>{}};let n=[d(3383,null),d(3385,null),d(3384,null)],r=o.sort((s,l)=>s.id.localeCompare(l.id)).map(s=>[s.id,s.title,s.location]);return{data:{headers:n,rows:r},dispose:()=>{}}}},Cwi=class extends x{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.views}render(e){let t=e.contributes?.views||{},o=Object.keys(t).reduce((s,l)=>{let c=t[l];return s.push(...c.map(u=>({...u,location:l}))),s},[]);if(!o.length)return{data:{headers:[],rows:[]},dispose:()=>{}};let n=[d(3386,null),d(3387,null),d(3384,null)],r=o.sort((s,l)=>s.id.localeCompare(l.id)).map(s=>[s.id,s.name,s.location]);return{data:{headers:n,rows:r},dispose:()=>{}}}};ne.as(As.ExtensionFeaturesRegistry).registerExtensionFeature({id:"viewsContainers",label:d(3401,null),access:{canToggle:!1},renderer:new Ft(wwi)});ne.as(As.ExtensionFeaturesRegistry).registerExtensionFeature({id:"views",label:d(3391,null),access:{canToggle:!1},renderer:new Ft(Cwi)});It(GLe.ID,GLe,St.BlockStartup);var eh=class extends Ck{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e.resource,void 0,n,t,o,r,c,p,h);this.model=e;this.environmentService=s;this.pathService=l;this.textModelService=u;this.modelResolve=void 0;this.modelDisposables=this._register(new N);this.cachedUntitledTextEditorModelReference=void 0;this.registerModelListeners(e),this._register(this.textFileService.untitled.onDidCreate(g=>this.onDidCreateUntitledModel(g)))}static{this.ID="workbench.editors.untitledEditorInput"}get typeId(){return eh.ID}get editorId(){return la.id}registerModelListeners(e){this.modelDisposables.clear(),this.modelDisposables.add(e.onDidChangeDirty(()=>this._onDidChangeDirty.fire())),this.modelDisposables.add(e.onDidChangeName(()=>this._onDidChangeLabel.fire())),this.modelDisposables.add(e.onDidRevert(()=>this.dispose()))}onDidCreateUntitledModel(e){Qe(e.resource,this.model.resource)&&e!==this.model&&(this.model=e,this.registerModelListeners(e))}getName(){return this.model.name}getDescription(e=1){if(!this.model.hasAssociatedFilePath){let t=this.resource.path;return t!==this.getName()?t:void 0}return super.getDescription(e)}getTitle(e){if(!this.model.hasAssociatedFilePath){let t=this.getName(),o=this.getDescription();return o&&o!==t?`${t} \u2022 ${o}`:t}return super.getTitle(e)}isDirty(){return this.model.isDirty()}getEncoding(){return this.model.getEncoding()}setEncoding(e,t){return this.model.setEncoding(e)}get hasLanguageSetExplicitly(){return this.model.hasLanguageSetExplicitly}get hasAssociatedFilePath(){return this.model.hasAssociatedFilePath}setLanguageId(e,t){this.model.setLanguageId(e,t)}getLanguageId(){return this.model.getLanguageId()}async resolve(){return this.modelResolve||(this.modelResolve=(async()=>{this.cachedUntitledTextEditorModelReference=await this.textModelService.createModelReference(this.resource)})()),await this.modelResolve,this.isDisposed()&&this.disposeModelReference(),this.model}toUntyped(e){let t={resource:this.model.hasAssociatedFilePath?of(this.model.resource,this.environmentService.remoteAuthority,this.pathService.defaultUriScheme):this.resource,forceUntitled:!0,options:{override:this.editorId}};return typeof e?.preserveViewState=="number"&&(t.encoding=this.getEncoding(),t.languageId=this.getLanguageId(),t.contents=this.model.isModified()?this.model.textEditorModel?.getValue():void 0,t.options.viewState=Y5(this,e.preserveViewState,this.editorService),typeof t.contents=="string"&&!this.model.hasAssociatedFilePath&&!e.preserveResource&&(t.resource=void 0)),t}matches(e){return this===e?!0:e instanceof eh?Qe(e.resource,this.resource):DEe(e)?super.matches(e):!1}dispose(){this.modelResolve=void 0,this.disposeModelReference(),super.dispose()}disposeModelReference(){Be(this.cachedUntitledTextEditorModelReference),this.cachedUntitledTextEditorModelReference=void 0}};eh=I([m(1,Uo),m(2,rt),m(3,ee),m(4,fe),m(5,At),m(6,An),m(7,gr),m(8,Bt),m(9,Fn),m(10,Rv)],eh);var JZ=class extends $R{constructor(){super(...arguments);this.editorControl=void 0}get scopedContextKeyService(){return this.editorControl?.invokeWithinContext(e=>e.get(X))}getTitle(){return this.input?this.input.getName():d(4336,null)}createEditorControl(e,t){this.editorControl=this._register(this.instantiationService.createInstance(Xr,e,t,this.getCodeEditorWidgetOptions()))}getCodeEditorWidgetOptions(){return Object.create(null)}updateEditorControlOptions(e){this.editorControl?.updateOptions(e)}getMainControl(){return this.editorControl}getControl(){return this.editorControl}computeEditorViewState(e){if(!this.editorControl)return;let t=this.editorControl.getModel();if(!t)return;let o=t.uri;if(o&&Qe(o,e))return this.editorControl.saveViewState()??void 0}setOptions(e){super.setOptions(e),e&&LT(e,Ci(this.editorControl),0)}focus(){super.focus(),this.editorControl?.focus()}hasFocus(){return this.editorControl?.hasTextFocus()||super.hasFocus()}setEditorVisible(e){super.setEditorVisible(e),e?this.editorControl?.onVisible():this.editorControl?.onHide()}layout(e){this.editorControl?.layout(e)}};var Upe=class extends JZ{constructor(i,e,t,o,n,r,s,l,c,u){super(i,e,t,o,n,r,s,c,l,u)}async setInput(i,e,t,o){await super.setInput(i,e,t,o);let n=await i.resolve();if(o.isCancellationRequested)return;if(!(n instanceof Lw))throw new Error("Unable to open file as text");let r=Ci(this.editorControl),s=n.textEditorModel;if(r.setModel(s),!Z5(e?.viewState)){let l=this.loadEditorViewState(i,t);l&&(e?.selection&&(l.cursorState=[]),r.restoreViewState(l))}e&&LT(e,r,1),r.updateOptions(this.getReadonlyConfiguration(n.isReadonly()))}revealLastLine(){let i=this.editorControl;if(!i)return;let e=i.getModel();if(e){let t=e.getLineCount();i.revealPosition({lineNumber:t,column:e.getLineMaxColumn(t)},0)}}clearInput(){super.clearInput(),this.editorControl?.setModel(null)}tracksEditorViewState(i){return i instanceof eh||i instanceof $C}};Upe=I([m(2,Te),m(3,F),m(4,ce),m(5,Fn),m(6,Le),m(7,wt),m(8,ee),m(9,fe)],Upe);var R3=class extends Upe{constructor(e,t,o,n,r,s,l,c,u,p,h){super(R3.ID,e,t,o,n,r,s,c,l,h);this.modelService=u;this.languageService=p}static{this.ID="workbench.editors.textResourceEditor"}createEditorControl(e,t){super.createEditorControl(e,t);let o=this.editorControl;o&&this._register(o.onDidPaste(n=>this.onDidEditorPaste(n,o)))}onDidEditorPaste(e,t){if(this.input instanceof eh&&this.input.hasLanguageSetExplicitly||e.range.startLineNumber!==1||e.range.startColumn!==1||t.getOption(104))return;let o=t.getModel();if(!o||!(o.getLineCount()===e.range.endLineNumber&&o.getLineMaxColumn(e.range.endLineNumber)===e.range.endColumn)||o.getLanguageId()!==$r)return;let s;if(e.languageId)s={id:e.languageId,source:"event"};else{let l=this.languageService.guessLanguageIdByFilepathOrFirstLine(o.uri,o.getLineContent(1).substr(0,1e3))??void 0;l&&(s={id:l,source:"guess"})}if(s&&s.id!==$r){this.input instanceof eh&&s.source==="event"?this.input.setLanguageId(s.id):o.setLanguage(this.languageService.createById(s.id));let l=this.modelService.getCreationOptions(o.getLanguageId(),o.uri,o.isForSimpleWidget);o.detectIndentation(l.insertSpaces,l.tabSize)}}};R3=I([m(1,Te),m(2,F),m(3,ce),m(4,Fn),m(5,Le),m(6,ee),m(7,wt),m(8,Tt),m(9,_t),m(10,fe)],R3);var B2=class extends wh{constructor(e,t,o){super();this.resource=e;this.name=t;this.fileService=o;this.mime=tr.binary}getName(){return this.name}getSize(){return this.size}getMime(){return this.mime}getETag(){return this.etag}async resolve(){if(this.fileService.hasProvider(this.resource)){let e=await this.fileService.stat(this.resource);this.etag=e.etag,typeof e.size=="number"&&(this.size=e.size)}return super.resolve()}};B2=I([m(2,fe)],B2);var hx=class{constructor(i){this._container=i}set text(i){vi(this._container,...Un(i??""))}set title(i){!this.hover&&i?this.hover=Up().setupManagedHover(Ri("mouse"),this._container,i):this.hover&&this.hover.update(i)}dispose(){this.hover?.dispose()}};var H2=class extends Ts{constructor(e,t,o,n,r){super(e,t,o,n,r);this.inputDisposable=this._register(new me)}static{this.PLACEHOLDER_LABEL_MAX_LENGTH=1024}createEditor(e){this.container=_(".monaco-editor-pane-placeholder",{tabIndex:0}),this.container.style.outline="none",this.scrollbar=this._register(new ms(this.container,{horizontal:1,vertical:1})),e.appendChild(this.scrollbar.getDomNode())}async setInput(e,t,o,n){await super.setInput(e,t,o,n),!n.isCancellationRequested&&(this.inputDisposable.value=await this.renderInput(e,t))}async renderInput(e,t){let[o,n]=jy(this.container,this.scrollbar);Rt(o);let r=new N,{icon:s,label:l,actions:c}=await this.getContents(e,t,r),u=JN(l,H2.PLACEHOLDER_LABEL_MAX_LENGTH),p=o.appendChild(_(".editor-placeholder-icon-container")),h=r.add(new hx(p));h.text=s;let g=o.appendChild(_(".editor-placeholder-label-container")),f=_("span");if(f.textContent=u,g.appendChild(f),o.setAttribute("aria-label",`${IJ(e,void 0,this.group,void 0)}, ${u}`),c.length){let v=o.appendChild(_(".editor-placeholder-buttons-container")),b=r.add(new Sw(v));for(let S=0;S<c.length;S++){let y=r.add(b.addButton({...Qo,secondary:S!==0}));y.label=c[S].label,r.add(y.onDidClick(w=>{w&&Xt.stop(w,!0),c[S].run()}))}}return n.scanDomNode(),r}clearInput(){this.container&&Rt(this.container),this.inputDisposable.clear(),super.clearInput()}layout(e){let[t,o]=jy(this.container,this.scrollbar);VL(t,e.width,e.height),o.scanDomNode(),t.classList.toggle("max-height-200px",e.height<=200)}focus(){super.focus(),this.container?.focus()}dispose(){this.container?.remove(),super.dispose()}};H2=I([m(2,Te),m(3,Le),m(4,ce)],H2);var M3=class extends H2{constructor(e,t,o,n,r,s){super(M3.ID,e,t,o,s);this.commandService=n;this.workspaceService=r}static{this.ID="workbench.editors.workspaceTrustRequiredEditor"}static{this.LABEL=d(4259,null)}static{this.DESCRIPTOR=Br.create(this,this.ID,this.LABEL)}getTitle(){return M3.LABEL}async getContents(){return{icon:"$(workspace-untrusted)",label:Zh(Dg(this.workspaceService.getWorkspace()))?d(4255,null):d(4256,null),actions:[{label:d(4254,null),run:()=>this.commandService.executeCommand("workbench.trust.manage")}]}}};M3=I([m(1,Te),m(2,Le),m(3,ge),m(4,Pe),m(5,ce)],M3);var ZZ=class extends H2{constructor(e,t,o,n,r,s,l){super(ZZ.ID,e,t,o,n);this.fileService=r;this.dialogService=s;this.commandService=l}static{this.ID="workbench.editors.errorEditor"}static{this.LABEL=d(4253,null)}static{this.DESCRIPTOR=Br.create(this,this.ID,this.LABEL)}async getContents(e,t,o){let n=e.resource,r=t.error,s=r?.fileOperationResult===1,l;s?l=d(4260,null):e4(r)&&r.forceMessage?l=r.message:r?l=d(4261,null):l=d(4262,null);let c="$(error)";e4(r)&&(r.forceSeverity===bt.Info?c="$(info)":r.forceSeverity===bt.Warning&&(c="$(warning)"));let u;return e4(r)&&r.actions.length>0?u=r.actions.map(p=>({label:p.label,run:()=>{let h=p.run();h instanceof Promise&&h.catch(g=>this.dialogService.error(xn(g)))}})):u=[{label:d(4257,null),run:()=>this.group.openEditor(e,{...t,source:1})},{label:d(4258,null),run:()=>this.commandService.executeCommand(T2)}],s&&n&&this.fileService.hasProvider(n)&&o.add(this.fileService.onDidFilesChange(p=>{p.contains(n,1,0)&&this.group.openEditor(e,t)})),{icon:c,label:l,actions:u??[]}}};ZZ=I([m(1,Te),m(2,Le),m(3,ce),m(4,fe),m(5,at),m(6,ge)],ZZ);var aM=class extends H2{constructor(e,t,o,n,r,s){super(e,t,n,r,s);this.callbacks=o;this._onDidChangeMetadata=this._register(new E);this.onDidChangeMetadata=this._onDidChangeMetadata.event;this._onDidOpenInPlace=this._register(new E);this.onDidOpenInPlace=this._onDidOpenInPlace.event}getTitle(){return this.input?this.input.getName():d(3864,null)}async getContents(e,t){let o=await e.resolve();if(!(o instanceof B2))throw new Error("Unable to open file as binary");let n=o.getSize();return this.handleMetadataChanged(typeof n=="number"?vl.formatSize(n):""),{icon:"$(warning)",label:d(3865,null),actions:[{label:d(3866,null),run:async()=>{await this.callbacks.openInternal(e,t),this._onDidOpenInPlace.fire()}}]}}handleMetadataChanged(e){this.metadata=e,this._onDidChangeMetadata.fire()}getMetadata(){return this.metadata}};aM=I([m(5,ce)],aM);var gH=class extends _f{static{this.ID=bDt}constructor(i,e,t,o,n,r,s,l,c){super(i,e,t,o,n,r,s,l,c)}getMetadata(){let i=this.getPrimaryEditorPane(),e=this.getSecondaryEditorPane();if(i instanceof aM&&e instanceof aM)return d(3863,null,e.getMetadata(),i.getMetadata())}};gH=I([m(1,Te),m(2,F),m(3,Le),m(4,ce),m(5,B),m(6,Fn),m(7,ee),m(8,wt)],gH);var xwi=class{constructor(i,e){this.primary=i;this.secondary=e}getEncoding(){return this.primary.getEncoding()}async setEncoding(i,e){await dn.settled([this.primary,this.secondary].map(t=>t.setEncoding(i,e)))}},kwi=class{constructor(i,e){this.primary=i;this.secondary=e}setLanguageId(i,e){[this.primary,this.secondary].forEach(t=>t.setLanguageId(i,e))}};function xJe(a){if(a instanceof eh)return a;if(a instanceof Ma){let e=xJe(a.primary),t=xJe(a.secondary);return e&&t?new xwi(e,t):e}let i=a;return ght(i.setEncoding,i.getEncoding)?i:null}function qFt(a){if(a instanceof eh)return a;if(a instanceof Ma){let e=qFt(a.primary),t=qFt(a.secondary);return e&&t?new kwi(e,t):e}let i=a;return typeof i.setLanguageId=="function"?i:null}var Ewi=class{constructor(){this.indentation=!1;this.selectionStatus=!1;this.languageId=!1;this.languageStatus=!1;this.encoding=!1;this.EOL=!1;this.tabFocusMode=!1;this.inputMode=!1;this.columnSelectionMode=!1;this.metadata=!1}combine(i){this.indentation=this.indentation||i.indentation,this.selectionStatus=this.selectionStatus||i.selectionStatus,this.languageId=this.languageId||i.languageId,this.languageStatus=this.languageStatus||i.languageStatus,this.encoding=this.encoding||i.encoding,this.EOL=this.EOL||i.EOL,this.tabFocusMode=this.tabFocusMode||i.tabFocusMode,this.inputMode=this.inputMode||i.inputMode,this.columnSelectionMode=this.columnSelectionMode||i.columnSelectionMode,this.metadata=this.metadata||i.metadata}hasChanges(){return this.indentation||this.selectionStatus||this.languageId||this.languageStatus||this.encoding||this.EOL||this.tabFocusMode||this.inputMode||this.columnSelectionMode||this.metadata}},Twi=class{get selectionStatus(){return this._selectionStatus}get languageId(){return this._languageId}get encoding(){return this._encoding}get EOL(){return this._EOL}get indentation(){return this._indentation}get tabFocusMode(){return this._tabFocusMode}get inputMode(){return this._inputMode}get columnSelectionMode(){return this._columnSelectionMode}get metadata(){return this._metadata}update(i){let e=new Ewi;switch(i.type){case"selectionStatus":this._selectionStatus!==i.selectionStatus&&(this._selectionStatus=i.selectionStatus,e.selectionStatus=!0);break;case"indentation":this._indentation!==i.indentation&&(this._indentation=i.indentation,e.indentation=!0);break;case"languageId":this._languageId!==i.languageId&&(this._languageId=i.languageId,e.languageId=!0);break;case"encoding":this._encoding!==i.encoding&&(this._encoding=i.encoding,e.encoding=!0);break;case"EOL":this._EOL!==i.EOL&&(this._EOL=i.EOL,e.EOL=!0);break;case"tabFocusMode":this._tabFocusMode!==i.tabFocusMode&&(this._tabFocusMode=i.tabFocusMode,e.tabFocusMode=!0);break;case"inputMode":this._inputMode!==i.inputMode&&(this._inputMode=i.inputMode,e.inputMode=!0);break;case"columnSelectionMode":this._columnSelectionMode!==i.columnSelectionMode&&(this._columnSelectionMode=i.columnSelectionMode,e.columnSelectionMode=!0);break;case"metadata":this._metadata!==i.metadata&&(this._metadata=i.metadata,e.metadata=!0);break}return e}},yJe=class extends x{constructor(e){super();this.configurationService=e;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this.registerListeners();let t=e.getValue("editor.tabFocusMode")===!0;x_.setTabFocusMode(t)}registerListeners(){this._register(x_.onDidChangeTabFocus(e=>this._onDidChange.fire(e))),this._register(this.configurationService.onDidChangeConfiguration(e=>{if(e.affectsConfiguration("editor.tabFocusMode")){let t=this.configurationService.getValue("editor.tabFocusMode")===!0;x_.setTabFocusMode(t),this._onDidChange.fire(t)}}))}};yJe=I([m(0,B)],yJe);var _wi=class extends x{constructor(){super();this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;TV.setInputMode("insert"),this._register(TV.onDidChangeInputMode(e=>this._onDidChange.fire(e)))}},R6o=d(4314,null),M6o=d(4313,null),P6o=d(4293,null),A6o=d(4292,null),Dco=d(4282,null),Lco=d(4281,null),wJe=class extends x{constructor(e,t,o,n,r,s,l,c){super();this.targetWindowId=e;this.editorService=t;this.quickInputService=o;this.languageService=n;this.textFileService=r;this.statusbarService=s;this.configurationService=c;this.tabFocusModeElement=this._register(new me);this.inputModeElement=this._register(new me);this.columnSelectionModeElement=this._register(new me);this.indentationElement=this._register(new me);this.selectionElement=this._register(new me);this.encodingElement=this._register(new me);this.eolElement=this._register(new me);this.languageElement=this._register(new me);this.metadataElement=this._register(new me);this.state=new Twi;this.toRender=void 0;this.activeEditorListeners=this._register(new N);this.delayedRender=this._register(new me);this.currentMarkerStatus=this._register(l.createInstance(CJe)),this.tabFocusMode=this._register(l.createInstance(yJe)),this.inputMode=this._register(l.createInstance(_wi)),this.registerCommands(),this.registerListeners()}registerListeners(){this._register(this.editorService.onDidActiveEditorChange(()=>this.updateStatusBar())),this._register(this.textFileService.untitled.onDidChangeEncoding(e=>this.onResourceEncodingChange(e.resource))),this._register(this.textFileService.files.onDidChangeEncoding(e=>this.onResourceEncodingChange(e.resource))),this._register(U.runAndSubscribe(this.tabFocusMode.onDidChange,e=>{e!==void 0?this.onTabFocusModeChange(e):this.onTabFocusModeChange(this.configurationService.getValue("editor.tabFocusMode"))})),this._register(U.runAndSubscribe(this.inputMode.onDidChange,e=>this.onInputModeChange(e??"insert")))}registerCommands(){this._register($e.registerCommand({id:`changeEditorIndentation${this.targetWindowId}`,handler:()=>this.showIndentationPicker()}))}async showIndentationPicker(){let e=ha(this.editorService.activeTextEditorControl);if(!e)return this.quickInputService.pick([{label:d(4294,null)}]);if(this.editorService.activeEditor?.isReadonly())return this.quickInputService.pick([{label:d(4296,null)}]);let t=[Ci(e.getAction(iQe.ID)),Ci(e.getAction(tQe.ID)),Ci(e.getAction(oQe.ID)),Ci(e.getAction(nQe.ID)),Ci(e.getAction(J8e.ID)),Ci(e.getAction(Z8e.ID)),Ci(e.getAction(g8e.ID))].map(n=>({id:n.id,label:n.label,detail:US.isDefaultVariant()||n.label===n.alias?void 0:n.alias,run:()=>{e.focus(),n.run()}}));return t.splice(3,0,{type:"separator",label:d(4286,null)}),t.unshift({type:"separator",label:d(4287,null)}),(await this.quickInputService.pick(t,{placeHolder:d(4297,null),matchOnDetail:!0}))?.run()}updateTabFocusModeElement(e){if(e){if(!this.tabFocusModeElement.value){let t=d(4326,null);this.tabFocusModeElement.value=this.statusbarService.addEntry({name:d(4325,null),text:t,ariaLabel:t,tooltip:d(4280,null),command:"editor.action.toggleTabFocusMode",kind:"prominent"},"status.editor.tabFocusMode",1,100.7)}}else this.tabFocusModeElement.clear()}updateInputModeElement(e){if(e==="overtype"){if(!this.inputModeElement.value){let t=d(4288,null),o=d(4318,null);this.inputModeElement.value=this.statusbarService.addEntry({name:o,text:t,ariaLabel:t,tooltip:o,command:"editor.action.toggleOvertypeInsertMode",kind:"prominent"},"status.editor.inputMode",1,100.6)}}else this.inputModeElement.clear()}updateColumnSelectionModeElement(e){if(e){if(!this.columnSelectionModeElement.value){let t=d(4274,null);this.columnSelectionModeElement.value=this.statusbarService.addEntry({name:d(4317,null),text:t,ariaLabel:t,tooltip:d(4279,null),command:"editor.action.toggleColumnSelection",kind:"prominent"},"status.editor.columnSelectionMode",1,100.8)}}else this.columnSelectionModeElement.clear()}updateSelectionElement(e){if(!e){this.selectionElement.clear();return}if(ha(this.editorService.activeTextEditorControl)?.getModel()?.uri?.scheme===Q.vscodeNotebookCell){this.selectionElement.clear();return}let o={name:d(4324,null),text:e,ariaLabel:e,tooltip:d(4284,null),command:"workbench.action.gotoLine"};this.updateElement(this.selectionElement,o,"status.editor.selection",1,100.5)}updateIndentationElement(e){if(!e){this.indentationElement.clear();return}if(ha(this.editorService.activeTextEditorControl)?.getModel()?.uri?.scheme===Q.vscodeNotebookCell){this.indentationElement.clear();return}let o={name:d(4321,null),text:e,ariaLabel:e,tooltip:d(4310,null),command:`changeEditorIndentation${this.targetWindowId}`};this.updateElement(this.indentationElement,o,"status.editor.indentation",1,100.4)}updateEncodingElement(e){if(!e){this.encodingElement.clear();return}let t={name:d(4319,null),text:e,ariaLabel:e,tooltip:d(4308,null),command:"workbench.action.editor.changeEncoding"};this.updateElement(this.encodingElement,t,"status.editor.encoding",1,100.3)}updateEOLElement(e){if(!e){this.eolElement.clear();return}let t={name:d(4320,null),text:e,ariaLabel:e,tooltip:d(4309,null),command:"workbench.action.editor.changeEOL"};this.updateElement(this.eolElement,t,"status.editor.eol",1,100.2)}updateLanguageIdElement(e){if(!e){this.languageElement.clear();return}let t={name:d(4323,null),text:e,ariaLabel:e,tooltip:d(4311,null),command:"workbench.action.editor.changeLanguageMode"};this.updateElement(this.languageElement,t,"status.editor.mode",1,100.1)}updateMetadataElement(e){if(!e){this.metadataElement.clear();return}let t={name:d(4322,null),text:e,ariaLabel:e,tooltip:d(4283,null)};this.updateElement(this.metadataElement,t,"status.editor.info",1,100)}updateElement(e,t,o,n,r){e.value?e.value.update(t):e.value=this.statusbarService.addEntry(t,o,n,r)}updateState(e){let t=this.state.update(e);t.hasChanges()&&(this.toRender?this.toRender.combine(t):(this.toRender=t,this.delayedRender.value=zh(rb(this.targetWindowId,!0).window,()=>{this.delayedRender.clear();let o=this.toRender;this.toRender=void 0,o&&this.doRenderNow()})))}doRenderNow(){this.updateTabFocusModeElement(!!this.state.tabFocusMode),this.updateInputModeElement(this.state.inputMode),this.updateColumnSelectionModeElement(!!this.state.columnSelectionMode),this.updateIndentationElement(this.state.indentation),this.updateSelectionElement(this.state.selectionStatus),this.updateEncodingElement(this.state.encoding),this.updateEOLElement(this.state.EOL?this.state.EOL===`\r
`?Lco:Dco:void 0),this.updateLanguageIdElement(this.state.languageId),this.updateMetadataElement(this.state.metadata)}getSelectionLabel(e){if(e?.selections){if(e.selections.length===1)return e.charactersSelected?vd(R6o,e.selections[0].positionLineNumber,e.selections[0].positionColumn,e.charactersSelected):vd(M6o,e.selections[0].positionLineNumber,e.selections[0].positionColumn);if(e.charactersSelected)return vd(P6o,e.selections.length,e.charactersSelected);if(e.selections.length>0)return vd(A6o,e.selections.length)}}updateStatusBar(){let e=this.editorService.activeEditor,t=this.editorService.activeEditorPane,o=t?ha(t.getControl())??void 0:void 0;if(this.onColumnSelectionModeChange(o),this.onSelectionChange(o),this.onLanguageChange(o,e),this.onEOLChange(o),this.onEncodingChange(t,o),this.onIndentationChange(o),this.onMetadataChange(t),this.currentMarkerStatus.update(o),this.activeEditorListeners.clear(),t&&this.activeEditorListeners.add(t.onDidChangeControl(()=>{this.updateStatusBar()})),o)this.activeEditorListeners.add(o.onDidChangeConfiguration(n=>{n.hasChanged(28)&&this.onColumnSelectionModeChange(o)})),this.activeEditorListeners.add(U.defer(o.onDidChangeCursorPosition)(()=>{this.onSelectionChange(o),this.currentMarkerStatus.update(o)})),this.activeEditorListeners.add(o.onDidChangeModelLanguage(()=>{this.onLanguageChange(o,e)})),this.activeEditorListeners.add(U.accumulate(o.onDidChangeModelContent)(n=>{this.onEOLChange(o),this.currentMarkerStatus.update(o);let r=o.getSelections();if(r){for(let s of n)for(let l of s.changes)if(r.some(c=>z.areIntersecting(c,l.range))){this.onSelectionChange(o);break}}})),this.activeEditorListeners.add(o.onDidChangeModelOptions(()=>{this.onIndentationChange(o)}));else if(t instanceof aM||t instanceof gH){let n=[];if(t instanceof gH){let r=t.getPrimaryEditorPane();r instanceof aM&&n.push(r);let s=t.getSecondaryEditorPane();s instanceof aM&&n.push(s)}else n.push(t);for(let r of n)this.activeEditorListeners.add(r.onDidChangeMetadata(()=>{this.onMetadataChange(t)})),this.activeEditorListeners.add(r.onDidOpenInPlace(()=>{this.updateStatusBar()}))}}onLanguageChange(e,t){let o={type:"languageId",languageId:void 0};if(e&&t&&qFt(t)){let n=e.getModel();if(n){let r=n.getLanguageId();o.languageId=this.languageService.getLanguageName(r)??void 0}}this.updateState(o)}onIndentationChange(e){let t={type:"indentation",indentation:void 0};if(e){let o=e.getModel();if(o){let n=o.getOptions();t.indentation=n.insertSpaces?n.tabSize===n.indentSize?d(4316,null,n.indentSize):d(4315,null,n.indentSize,n.tabSize):d(4327,null,n.tabSize)}}this.updateState(t)}onMetadataChange(e){let t={type:"metadata",metadata:void 0};(e instanceof aM||e instanceof gH)&&(t.metadata=e.getMetadata()),this.updateState(t)}onColumnSelectionModeChange(e){let t={type:"columnSelectionMode",columnSelectionMode:!1};e?.getOption(28)&&(t.columnSelectionMode=!0),this.updateState(t)}onSelectionChange(e){let t=Object.create(null);if(e){t.selections=e.getSelections()||[],t.charactersSelected=0;let o=e.getModel();if(o)for(let n of t.selections)typeof t.charactersSelected!="number"&&(t.charactersSelected=0),t.charactersSelected+=o.getCharacterCountInRange(n);if(t.selections.length===1){let n=e.getPosition(),r=new ti(t.selections[0].selectionStartLineNumber,t.selections[0].selectionStartColumn,t.selections[0].positionLineNumber,n?e.getStatusbarColumn(n):t.selections[0].positionColumn);t.selections[0]=r}}this.updateState({type:"selectionStatus",selectionStatus:this.getSelectionLabel(t)})}onEOLChange(e){let t={type:"EOL",EOL:void 0};if(e&&!e.getOption(104)){let o=e.getModel();o&&(t.EOL=o.getEOL())}this.updateState(t)}onEncodingChange(e,t){if(e&&!this.isActiveEditor(e))return;let o={type:"encoding",encoding:void 0};if(e&&t?.hasModel()){let n=e.input?xJe(e.input):null;if(n){let r=n.getEncoding(),s=typeof r=="string"?Nw[r]:void 0;s?o.encoding=s.labelShort:o.encoding=r}}this.updateState(o)}onResourceEncodingChange(e){let t=this.editorService.activeEditorPane;if(t){let o=po.getCanonicalUri(t.input,{supportSideBySide:1});if(o&&Qe(o,e)){let n=ha(t.getControl())??void 0;return this.onEncodingChange(t,n)}}}onTabFocusModeChange(e){let t={type:"tabFocusMode",tabFocusMode:e};this.updateState(t)}onInputModeChange(e){let t={type:"inputMode",inputMode:e};this.updateState(t)}isActiveEditor(e){let t=this.editorService.activeEditorPane;return!!t&&t===e}};wJe=I([m(1,ee),m(2,Ue),m(3,_t),m(4,Uo),m(5,kr),m(6,F),m(7,B)],wJe);var zpe=class extends x{constructor(e){super();this.editorGroupService=e;for(let t of e.parts)this.createEditorStatus(t);this._register(e.onDidCreateAuxiliaryEditorPart(t=>this.createEditorStatus(t)))}static{this.ID="workbench.contrib.editorStatus"}createEditorStatus(e){let t=new N;U.once(e.onWillDispose)(()=>t.dispose());let o=this.editorGroupService.getScopedInstantiationService(e);t.add(o.createInstance(wJe,e.windowId))}};zpe=I([m(0,wt)],zpe);var CJe=class extends x{constructor(e,t,o){super();this.statusbarService=e;this.markerService=t;this.configurationService=o;this.editor=void 0;this.markers=[];this.currentMarker=null;this.statusBarEntryAccessor=this._register(new me),this._register(t.onMarkerChanged(n=>this.onMarkerChanged(n))),this._register(U.filter(o.onDidChangeConfiguration,n=>n.affectsConfiguration("problems.showCurrentInStatus"))(()=>this.updateStatus()))}update(e){this.editor=e,this.updateMarkers(),this.updateStatus()}updateStatus(){let e=this.currentMarker;if(this.currentMarker=this.getMarker(),this.hasToUpdateStatus(e,this.currentMarker))if(this.currentMarker){let t=yc(this.currentMarker.message)[0],o=`${this.getType(this.currentMarker)} ${t}`;this.statusBarEntryAccessor.value?this.statusBarEntryAccessor.value.update({name:d(4278,null),text:o,ariaLabel:o}):this.statusBarEntryAccessor.value=this.statusbarService.addEntry({name:d(4278,null),text:o,ariaLabel:o},"statusbar.currentProblem",0)}else this.statusBarEntryAccessor.clear()}hasToUpdateStatus(e,t){return!t||!e?!0:jV.makeKey(e)!==jV.makeKey(t)}getType(e){switch(e.severity){case 8:return"$(error)";case 4:return"$(warning)";case 2:return"$(info)"}return""}getMarker(){if(!this.configurationService.getValue("problems.showCurrentInStatus")||!this.editor||!this.editor.getModel())return null;let t=this.editor.getPosition();return t&&this.markers.find(o=>z.containsPosition(o,t))||null}onMarkerChanged(e){if(!this.editor)return;let t=this.editor.getModel();t&&(t&&!e.some(o=>Qe(t.uri,o))||this.updateMarkers())}updateMarkers(){if(!this.editor)return;let e=this.editor.getModel();e&&(e?(this.markers=this.markerService.read({resource:e.uri,severities:14}),this.markers.sort(this.compareMarker)):this.markers=[],this.updateStatus())}compareMarker(e,t){let o=Hl(e.resource.toString(),t.resource.toString());return o===0&&(o=bl.compare(e.severity,t.severity)),o===0&&(o=z.compareRangesUsingStarts(e,t)),o}};CJe=I([m(0,kr),m(1,oa),m(2,B)],CJe);var eee=class a extends K{static{this.ID="workbench.action.editor.changeLanguageMode"}constructor(){super({id:a.ID,title:L(4273,"Change Language Mode"),f1:!0,keybinding:{weight:200,primary:Vi(2089,43)},precondition:C.not("notebookEditorFocused"),metadata:{description:d(4272,null),args:[{name:d(4271,null),constraint:i=>typeof i=="string"}]}})}async run(i,e){let t=i.get(Ue),o=i.get(ee),n=i.get(_t),r=i.get(vS),s=i.get(Uo),l=i.get(Go),c=i.get(B),u=i.get(Te),p=i.get(ge),h=i.get(fa),g=ha(o.activeTextEditorControl);if(!g){await t.pick([{label:d(4294,null)}]);return}let f=g.getModel(),v=po.getOriginalUri(o.activeEditor,{supportSideBySide:1}),b,S;f&&(S=f.getLanguageId(),b=n.getLanguageName(S)??void 0);let y=!!v;v?.scheme===Q.untitled&&!s.untitled.get(v)?.hasAssociatedFilePath&&(y=!1);let k=n.getSortedRegisteredLanguageNames().map(({languageName:$,languageId:J})=>{let ae=n.getExtensions(J).join(" "),he;return b===$?he=d(4289,null,J):he=d(4290,null,J),{id:J,label:$,meta:ae,iconClasses:lK(J),description:he}});k.unshift({type:"separator",label:d(4291,null)});let T,P,O;if(y&&v){let $=es(v)||He(v);h.isEnabled()&&(O=ii({id:"workbench.action.showLanguageExtensions",label:d(4312,null,$),run:()=>p.executeCommand("workbench.extensions.action.showExtensionsForLanguage",$)}),k.unshift(O)),P={label:d(4276,null,b)},k.unshift(P),T={label:d(4275,null,$)},k.unshift(T)}let V={label:d(4268,null)};f&&f.getValueLength()>0&&k.unshift(V);let H=typeof e=="string"?{label:e}:await t.pick(k,{placeHolder:d(4301,null),matchOnDescription:!0});if(!H)return;if(H===O){O.run();return}if(H===T){v&&this.configureFileAssociation(v,n,t,c);return}if(H===P){l.openUserSettings({jsonEditor:!0,revealSetting:{key:`[${S??null}]`,edit:!0}});return}let G=o.activeEditor;if(G){let $=qFt(G);if($){let J,ae;if(H===V){if(f){let he=po.getOriginalUri(G,{supportSideBySide:1});if(he){let oe=n.guessLanguageIdByFilepathOrFirstLine(he,f.getLineContent(1))??void 0;(!oe||oe==="unknown")&&(ae=await r.detectLanguage(he),oe=ae),oe&&(J=n.createById(oe))}}}else J=n.createById(H.id),v&&r.detectLanguage(v).then(he=>{let oe=n.getLanguageIdByLanguageName(H.label)||"unknown";if(he===S&&S!==oe){let de=c.getValue("workbench.editor.preferHistoryBasedLanguageDetection")?"history":"classic";u.publicLog2(geo,{currentLanguageId:b??"unknown",nextLanguageId:H.label,lineCount:f?.getLineCount()??-1,modelPreference:de})}});if(typeof J<"u"&&($.setLanguageId(J.languageId,a.ID),v?.scheme===Q.untitled)){let he=c.getValue("workbench.editor.preferHistoryBasedLanguageDetection")?"history":"classic";u.publicLog2("setUntitledDocumentLanguage",{to:J.languageId,from:S??"none",modelPreference:he})}}g.focus()}}configureFileAssociation(i,e,t,o){let n=es(i),r=He(i),s=e.guessLanguageIdByFilepathOrFirstLine(A.file(r)),c=e.getSortedRegisteredLanguageNames().map(({languageName:u,languageId:p})=>({id:p,label:u,iconClasses:lK(p),description:p===s?d(4277,null):void 0}));setTimeout(async()=>{let u=await t.pick(c,{placeHolder:d(4302,null,n||r)});if(u){let p=o.inspect(yj),h;n&&r[0]!=="."?h=`*${n}`:h=r;let g=2;p.workspaceValue?.[h]&&(g=5);let f=Ji(g===5?p.workspaceValue:p.userValue)||Object.create(null);f[h]=u.id,o.updateValue(yj,f,g)}},50)}},$Ft=class extends K{constructor(){super({id:"workbench.action.editor.changeEOL",title:L(4270,"Change End of Line Sequence"),f1:!0})}async run(i){let e=i.get(ee),t=i.get(Ue),o=ha(e.activeTextEditorControl);if(!o){await t.pick([{label:d(4294,null)}]);return}if(e.activeEditor?.isReadonly()){await t.pick([{label:d(4296,null)}]);return}let n=o.getModel(),r=[{label:Dco,eol:0},{label:Lco,eol:1}],s=n?.getEOL()===`
`?0:1,l=await t.pick(r,{placeHolder:d(4300,null),activeItem:r[s]});if(l){let c=ha(e.activeTextEditorControl);c?.hasModel()&&!e.activeEditor?.isReadonly()&&(n=c.getModel(),n.pushStackElement(),n.pushEOL(l.eol),n.pushStackElement())}o.focus()}},jFt=class extends K{constructor(){super({id:"workbench.action.editor.changeEncoding",title:L(4269,"Change File Encoding"),f1:!0})}async run(i){let e=i.get(ee),t=i.get(Ue),o=i.get(fe),n=i.get(Uo),r=i.get(Fn),s=i.get(at),l=ha(e.activeTextEditorControl);if(!l){await t.pick([{label:d(4294,null)}]);return}let c=e.activeEditorPane;if(!c){await t.pick([{label:d(4294,null)}]);return}let u=xJe(c.input);if(!u){await t.pick([{label:d(4295,null)}]);return}let p={label:d(4307,null)},h={label:d(4304,null)};if(!US.isDefaultVariant()){let V="Save with Encoding";V!==p.label&&(p.detail=V);let H="Reopen with Encoding";H!==h.label&&(h.detail=H)}let g;if(u instanceof eh?g=p:c.input.isReadonly()?g=h:g=await t.pick([h,p],{placeHolder:d(4297,null),matchOnDetail:!0}),!g)return;await Li(50);let f=po.getOriginalUri(c.input,{supportSideBySide:1});if(!f||!o.hasProvider(f)&&f.scheme!==Q.untitled)return;let v;o.hasProvider(f)&&(v=(await n.readStream(f,{autoGuessEncoding:!0,candidateGuessEncodings:r.getValue(f,"files.candidateGuessEncodings")})).encoding);let b=g===h,S=r.getValue(f,"files.encoding"),y,w,k=Object.keys(Nw).sort((V,H)=>V===S?-1:H===S?1:Nw[V].order-Nw[H].order).filter(V=>V===v&&v!==S?!1:!b||!Nw[V].encodeOnly).map((V,H)=>(V===u.getEncoding()?y=H:Nw[V].alias===u.getEncoding()&&(w=H),{id:V,label:Nw[V].labelLong,description:V})),T=k.slice();v&&S!==v&&Nw[v]&&(k.unshift({type:"separator"}),k.unshift({id:v,label:Nw[v].labelLong,description:d(4285,null)}));let P=await t.pick(k,{placeHolder:b?d(4298,null):d(4299,null),activeItem:T[typeof y=="number"?y:typeof w=="number"?w:-1]});if(!P||!e.activeEditorPane)return;let O=xJe(e.activeEditorPane.input);if(typeof P.id<"u"&&O){if(b&&e.activeEditorPane.input.isDirty()){let{confirmed:V}=await s.confirm({message:d(4306,null),detail:d(4305,null),primaryButton:d(4303,null)});if(!V)return;await e.activeEditorPane.input.revert(e.activeEditorPane.group.id)}await O.setEncoding(P.id,b?1:0)}l.focus()}};var na=le("historyService");var Lp=class extends K{constructor(e,t,o){super(e);this.commandId=t;this.commandArgs=o}run(e){return e.get(ge).executeCommand(this.commandId,this.commandArgs)}},QFt=class extends K{getDirection(i){return uy(i)}async run(i,...e){let t=i.get(wt),o=i.get(B),n=i.get(ee),r=i.get(Io),s=this.getDirection(o),l=Dp(e,n,t,r);$yi(t,s,l)}},YFt=class a extends QFt{static{this.ID=$Z}constructor(){super({id:a.ID,title:L(4175,"Split Editor"),f1:!0,keybinding:{weight:200,primary:2141},category:Ve.View})}},XFt=class extends QFt{constructor(){super({id:"workbench.action.splitEditorOrthogonal",title:L(4182,"Split Editor Orthogonal"),f1:!0,keybinding:{weight:200,primary:Vi(2089,2141)},category:Ve.View})}getDirection(i){return uy(i)===3?1:3}},JFt=class extends Lp{constructor(){super({id:T3,title:L(4178,"Split Editor Left"),f1:!0,keybinding:{weight:200,primary:Vi(2089,2141)},category:Ve.View},T3)}},ZFt=class extends Lp{constructor(){super({id:F2,title:L(4179,"Split Editor Right"),f1:!0,keybinding:{weight:200,primary:Vi(2089,2141)},category:Ve.View},F2)}},e0t=class extends Lp{static{this.LABEL=d(4180,null)}constructor(){super({id:E3,title:L(4181,"Split Editor Up"),f1:!0,keybinding:{weight:200,primary:Vi(2089,2141)},category:Ve.View},E3)}},t0t=class extends Lp{static{this.LABEL=d(4176,null)}constructor(){super({id:O2,title:L(4177,"Split Editor Down"),f1:!0,keybinding:{weight:200,primary:Vi(2089,2141)},category:Ve.View},O2)}},i0t=class extends K{constructor(){super({id:"workbench.action.joinTwoGroups",title:L(4104,"Join Editor Group with Next Group"),f1:!0,category:Ve.View})}async run(i,e){let t=i.get(wt),o;if(e&&typeof e.groupId=="number"?o=t.getGroup(e.groupId):o=t.activeGroup,o){let n=[3,1,2,0];for(let r of n){let s=t.findGroup({direction:r},o);if(s&&o!==s){t.mergeGroup(o,s);break}}}}},o0t=class extends K{constructor(){super({id:"workbench.action.joinAllGroups",title:L(4103,"Join All Editor Groups"),f1:!0,category:Ve.View})}async run(i){let e=i.get(wt);e.mergeAllGroups(e.activeGroup)}},n0t=class extends K{constructor(){super({id:"workbench.action.navigateEditorGroups",title:L(4139,"Navigate Between Editor Groups"),f1:!0,category:Ve.View})}async run(i){let e=i.get(wt);e.findGroup({location:2},e.activeGroup,!0)?.focus()}},r0t=class extends K{constructor(){super({id:"workbench.action.focusActiveEditorGroup",title:L(4095,"Focus Active Editor Group"),f1:!0,category:Ve.View})}async run(i){i.get(wt).activeGroup.focus()}},U2=class extends K{constructor(e,t){super(e);this.scope=t}async run(e){let t=e.get(wt);t.findGroup(this.scope,t.activeGroup,!0)?.focus()}},s0t=class extends U2{constructor(){super({id:"workbench.action.focusFirstEditorGroup",title:L(4097,"Focus First Editor Group"),f1:!0,keybinding:{weight:200,primary:2070},category:Ve.View},{location:0})}},a0t=class extends U2{constructor(){super({id:"workbench.action.focusLastEditorGroup",title:L(4098,"Focus Last Editor Group"),f1:!0,category:Ve.View},{location:1})}},l0t=class extends U2{constructor(){super({id:"workbench.action.focusNextGroup",title:L(4100,"Focus Next Editor Group"),f1:!0,category:Ve.View},{location:2})}},c0t=class extends U2{constructor(){super({id:"workbench.action.focusPreviousGroup",title:L(4101,"Focus Previous Editor Group"),f1:!0,category:Ve.View},{location:3})}},d0t=class extends U2{constructor(){super({id:"workbench.action.focusLeftGroup",title:L(4099,"Focus Left Editor Group"),f1:!0,keybinding:{weight:200,primary:Vi(2089,2063)},category:Ve.View},{direction:2})}},u0t=class extends U2{constructor(){super({id:"workbench.action.focusRightGroup",title:L(4102,"Focus Right Editor Group"),f1:!0,keybinding:{weight:200,primary:Vi(2089,2065)},category:Ve.View},{direction:3})}},p0t=class extends U2{constructor(){super({id:"workbench.action.focusAboveGroup",title:L(4094,"Focus Editor Group Above"),f1:!0,keybinding:{weight:200,primary:Vi(2089,2064)},category:Ve.View},{direction:0})}},m0t=class extends U2{constructor(){super({id:"workbench.action.focusBelowGroup",title:L(4096,"Focus Editor Group Below"),f1:!0,keybinding:{weight:200,primary:Vi(2089,2066)},category:Ve.View},{direction:1})}},tee=class extends it{constructor(e,t,o){super(e,t,q.asClassName(R.close));this.commandService=o}static{this.ID="workbench.action.closeActiveEditor"}static{this.LABEL=d(4070,null)}run(e){return this.commandService.executeCommand(dx,void 0,e)}};tee=I([m(2,ge)],tee);var x0=class extends it{constructor(e,t,o){super(e,t,q.asClassName(R.pinned));this.commandService=o}static{this.ID="workbench.action.unpinActiveEditor"}static{this.LABEL=d(4196,null)}run(e){return this.commandService.executeCommand(k3,void 0,e)}};x0=I([m(2,ge)],x0);var iee=class extends it{constructor(e,t,o){super(e,t,q.asClassName(R.close));this.editorGroupService=o}static{this.ID="workbench.action.closeActiveEditor"}static{this.LABEL=d(4074,null)}async run(e){let t=e?this.editorGroupService.getGroup(e.groupId):this.editorGroupService.activeGroup;if(!t)return;let o=e?.editorIndex!==void 0?t.getEditorByIndex(e.editorIndex):t.activeEditor;if(!o)return;let n=[];t.isSelected(o)?n.push(...t.selectedEditors):n.push(o);for(let r of n)await t.closeEditor(r,{preserveFocus:e?.preserveFocus})}};iee=I([m(2,wt)],iee);var h0t=class extends K{constructor(){super({id:"workbench.action.revertAndCloseActiveEditor",title:L(4170,"Revert and Close Editor"),f1:!0,category:Ve.View})}async run(i){let e=i.get(ee),t=i.get(se),o=e.activeEditorPane;if(o){let n=o.input,r=o.group;try{await e.revert({editor:n,groupId:r.id})}catch(s){t.error(s),await e.revert({editor:n,groupId:r.id},{soft:!0})}await r.closeEditor(n)}}},g0t=class extends K{constructor(){super({id:"workbench.action.closeEditorsToTheLeft",title:L(4073,"Close Editors to the Left in Group"),f1:!0,category:Ve.View})}async run(i,e){let t=i.get(wt),{group:o,editor:n}=this.getTarget(t,e);o&&n&&await o.closeEditors({direction:0,except:n,excludeSticky:!0})}getTarget(i,e){return e?{editor:e.editor,group:i.getGroup(e.groupId)}:{group:i.activeGroup,editor:i.activeGroup.activeEditor}}},f0t=class extends K{groupsToClose(i){let e=[],t=i.getGroups(2);for(let o=t.length-1;o>=0;o--)e.push(t[o]);return e}async run(i){let e=i.get(ee),t=i.get(se),o=i.get(Fo),n=i.get(wt),r=i.get(gr),s=i.get(rn),l=new Set,c=new Set,u=new Set,p=new Map;for(let{editor:h,groupId:g}of e.getEditors(1,{excludeSticky:this.excludeSticky})){let f=!1,v=!1;if(h.closeHandler)try{f=h.closeHandler.showConfirm()}catch(b){t.error(b),v=!0}if((!h.closeHandler||v)&&(f=h.isDirty()&&!h.isSaving()),!!f)if(typeof h.closeHandler?.confirm=="function"){let b=p.get(h.typeId);b||(b=new Set,p.set(h.typeId,b)),b.add({editor:h,groupId:g})}else!h.hasCapability(4)&&r.getAutoSaveMode(h).mode===3?c.add({editor:h,groupId:g}):Vr&&(ei||fn)&&!h.hasCapability(4)&&r.getAutoSaveMode(h).mode===4?u.add({editor:h,groupId:g}):l.add({editor:h,groupId:g})}if(l.size>0){let h=Array.from(l.values());switch(await this.revealEditorsToConfirm(h,n),await s.showSaveConfirm(h.map(({editor:f})=>f instanceof Ma?f.primary.getName():f.getName()))){case 2:return;case 1:await this.revertEditors(e,t,o,h);break;case 0:await e.save(h,{reason:1});break}}for(let[,h]of p){let g=Array.from(h.values());await this.revealEditorsToConfirm(g,n);let f=await g.at(0)?.editor.closeHandler?.confirm?.(g);if(typeof f=="number")switch(f){case 2:return;case 1:await this.revertEditors(e,t,o,g);break;case 0:await e.save(g,{reason:1});break}}if(c.size>0){let h=Array.from(c.values());await e.save(h,{reason:3})}if(u.size>0){let h=Array.from(u.values());await e.save(h,{reason:4})}return this.doCloseAll(n)}revertEditors(i,e,t,o){return t.withProgress({location:10,delay:800,title:d(4171,null)},()=>this.doRevertEditors(i,e,o))}async doRevertEditors(i,e,t){try{await i.revert(t)}catch(o){e.error(o),await i.revert(t,{soft:!0})}}async revealEditorsToConfirm(i,e){try{let t=new Set;for(let{editor:o,groupId:n}of i){if(t.has(n))continue;t.add(n),await e.getGroup(n)?.openEditor(o)}}catch{}}async doCloseAll(i){await Promise.all(this.groupsToClose(i).map(e=>e.closeAllEditors({excludeSticky:this.excludeSticky})))}},Kpe=class a extends f0t{static{this.ID="workbench.action.closeAllEditors"}static{this.LABEL=L(4068,"Close All Editors")}constructor(){super({id:a.ID,title:a.LABEL,f1:!0,keybinding:{weight:200,primary:Vi(2089,2101)},icon:R.closeAll,category:Ve.View})}get excludeSticky(){return!0}},v0t=class extends f0t{constructor(){super({id:"workbench.action.closeAllGroups",title:L(4069,"Close All Editor Groups"),f1:!0,keybinding:{weight:200,primary:Vi(2089,3125)},category:Ve.View})}get excludeSticky(){return!1}async doCloseAll(i){await super.doCloseAll(i);for(let e of this.groupsToClose(i))i.removeGroup(e)}},b0t=class extends K{constructor(){super({id:"workbench.action.closeEditorsInOtherGroups",title:L(4072,"Close Editors in Other Groups"),f1:!0,category:Ve.View})}async run(i,e){let t=i.get(wt),o=e?t.getGroup(e.groupId):t.activeGroup;await Promise.all(t.getGroups(1).map(async n=>{if(!(o&&n.id===o.id))return n.closeAllEditors({excludeSticky:!0})}))}},S0t=class extends K{constructor(){super({id:"workbench.action.closeEditorInAllGroups",title:L(4071,"Close Editor in All Groups"),f1:!0,category:Ve.View})}async run(i){let e=i.get(ee),t=i.get(wt),o=e.activeEditor;o&&await Promise.all(t.getGroups(1).map(n=>n.closeEditor(o)))}},I0t=class extends K{constructor(e,t,o){super(e);this.direction=t;this.isMove=o}async run(e,t){let o=e.get(wt),n;if(t&&typeof t.groupId=="number"?n=o.getGroup(t.groupId):n=o.activeGroup,n){let r;if(this.isMove){let s=this.findTargetGroup(o,n);s&&(r=o.moveGroup(n,s,this.direction))}else r=o.copyGroup(n,n,this.direction);r&&o.activateGroup(r)}}findTargetGroup(e,t){let o=[this.direction];switch(this.direction){case 2:case 3:o.push(0,1);break;case 0:case 1:o.push(2,3);break}for(let n of o){let r=e.findGroup({direction:n},t);if(r)return r}}},$Le=class extends I0t{constructor(i,e){super(i,e,!0)}},y0t=class extends $Le{constructor(){super({id:"workbench.action.moveActiveEditorGroupLeft",title:L(4118,"Move Editor Group Left"),f1:!0,keybinding:{weight:200,primary:Vi(2089,15)},category:Ve.View},2)}},w0t=class extends $Le{constructor(){super({id:"workbench.action.moveActiveEditorGroupRight",title:L(4119,"Move Editor Group Right"),f1:!0,keybinding:{weight:200,primary:Vi(2089,17)},category:Ve.View},3)}},C0t=class extends $Le{constructor(){super({id:"workbench.action.moveActiveEditorGroupUp",title:L(4120,"Move Editor Group Up"),f1:!0,keybinding:{weight:200,primary:Vi(2089,16)},category:Ve.View},0)}},x0t=class extends $Le{constructor(){super({id:"workbench.action.moveActiveEditorGroupDown",title:L(4117,"Move Editor Group Down"),f1:!0,keybinding:{weight:200,primary:Vi(2089,18)},category:Ve.View},1)}},jLe=class extends I0t{constructor(i,e){super(i,e,!1)}},k0t=class extends jLe{constructor(){super({id:"workbench.action.duplicateActiveEditorGroupLeft",title:L(4081,"Duplicate Editor Group Left"),f1:!0,category:Ve.View},2)}},E0t=class extends jLe{constructor(){super({id:"workbench.action.duplicateActiveEditorGroupRight",title:L(4082,"Duplicate Editor Group Right"),f1:!0,category:Ve.View},3)}},T0t=class extends jLe{constructor(){super({id:"workbench.action.duplicateActiveEditorGroupUp",title:L(4083,"Duplicate Editor Group Up"),f1:!0,category:Ve.View},0)}},_0t=class extends jLe{constructor(){super({id:"workbench.action.duplicateActiveEditorGroupDown",title:L(4080,"Duplicate Editor Group Down"),f1:!0,category:Ve.View},1)}},D0t=class extends K{constructor(){super({id:"workbench.action.minimizeOtherEditors",title:L(4114,"Expand Editor Group"),f1:!0,category:Ve.View,precondition:SS})}async run(i){i.get(wt).arrangeGroups(1)}},L0t=class extends K{constructor(){super({id:"workbench.action.minimizeOtherEditorsHideSidebar",title:L(4115,"Expand Editor Group and Hide Side Bars"),f1:!0,category:Ve.View,precondition:C.or(SS,tA,iA)})}async run(i){let e=i.get(wt),t=i.get(yi);t.setPartHidden(!0,"workbench.parts.sidebar"),t.setPartHidden(!0,"workbench.parts.auxiliarybar"),e.arrangeGroups(1)}},R0t=class extends K{constructor(){super({id:"workbench.action.evenEditorWidths",title:L(4092,"Reset Editor Group Sizes"),f1:!0,category:Ve.View})}async run(i){i.get(wt).arrangeGroups(2)}},M0t=class extends K{constructor(){super({id:"workbench.action.toggleEditorWidths",title:L(4193,"Toggle Editor Group Sizes"),f1:!0,category:Ve.View})}async run(i){i.get(wt).toggleExpandGroup()}},P0t=class extends K{constructor(){super({id:"workbench.action.maximizeEditorHideSidebar",title:L(4106,"Maximize Editor Group and Hide Side Bars"),f1:!0,category:Ve.View,precondition:C.or(C.and(CB.negate(),n4),tA,iA)})}async run(i){let e=i.get(yi),t=i.get(wt);i.get(ee).activeEditor&&(e.setPartHidden(!0,"workbench.parts.sidebar"),e.setPartHidden(!0,"workbench.parts.auxiliarybar"),t.arrangeGroups(0))}},A0t=class extends K{constructor(){super({id:NLe,title:L(4194,"Toggle Maximize Editor Group"),f1:!0,category:Ve.View,precondition:C.or(n4,CB),keybinding:{weight:200,primary:Vi(2089,2091)},menu:[{id:D.EditorTitle,order:-1e4,group:"navigation",when:CB},{id:D.EmptyEditorGroup,order:-1e4,group:"navigation",when:CB}],icon:R.screenFull,toggled:{condition:CB,title:d(4195,null)}})}async run(i,...e){let t=i.get(wt),o=i.get(ee),n=i.get(Io),r=Dp(e,o,t,n);r.groupedEditors.length&&t.toggleMaximizeGroup(r.groupedEditors[0].group)}},oee=class extends K{async run(i){let e=i.get(wt),t=this.navigate(e);if(!t)return;let{groupId:o,editor:n}=t;if(!n)return;let r=e.getGroup(o);r&&await r.openEditor(n)}},N0t=class extends oee{constructor(){super({id:"workbench.action.nextEditor",title:L(4156,"Open Next Editor"),f1:!0,keybinding:{weight:200,primary:2060,mac:{primary:2577,secondary:[3166]}},category:Ve.View})}navigate(i){let e=i.activeGroup,t=e.getEditors(1),o=e.activeEditor?t.indexOf(e.activeEditor):-1;if(o+1<t.length)return{editor:t[o+1],groupId:e.id};let n=new Set,r=i.activeGroup;for(;r&&!n.has(r.id);)if(r=i.findGroup({location:2},r,!0),r){n.add(r.id);let s=r.getEditors(1);if(s.length>0)return{editor:s[0],groupId:r.id}}}},O0t=class extends oee{constructor(){super({id:"workbench.action.previousEditor",title:L(4159,"Open Previous Editor"),f1:!0,keybinding:{weight:200,primary:2059,mac:{primary:2575,secondary:[3164]}},category:Ve.View})}navigate(i){let e=i.activeGroup,t=e.getEditors(1),o=e.activeEditor?t.indexOf(e.activeEditor):-1;if(o>0)return{editor:t[o-1],groupId:e.id};let n=new Set,r=i.activeGroup;for(;r&&!n.has(r.id);)if(r=i.findGroup({location:3},r,!0),r){n.add(r.id);let s=r.getEditors(1);if(s.length>0)return{editor:s[s.length-1],groupId:r.id}}}},F0t=class extends oee{constructor(){super({id:"workbench.action.nextEditorInGroup",title:L(4155,"Open Next Editor in Group"),f1:!0,keybinding:{weight:200,primary:Vi(2089,2060),mac:{primary:Vi(2089,2577)}},category:Ve.View})}navigate(i){let e=i.activeGroup,t=e.getEditors(1),o=e.activeEditor?t.indexOf(e.activeEditor):-1;return{editor:o+1<t.length?t[o+1]:t[0],groupId:e.id}}},W0t=class extends oee{constructor(){super({id:"workbench.action.previousEditorInGroup",title:L(4160,"Open Previous Editor in Group"),f1:!0,keybinding:{weight:200,primary:Vi(2089,2059),mac:{primary:Vi(2089,2575)}},category:Ve.View})}navigate(i){let e=i.activeGroup,t=e.getEditors(1),o=e.activeEditor?t.indexOf(e.activeEditor):-1;return{editor:o>0?t[o-1]:t[t.length-1],groupId:e.id}}},V0t=class extends oee{constructor(){super({id:"workbench.action.firstEditorInGroup",title:L(4093,"Open First Editor in Group"),f1:!0,category:Ve.View})}navigate(i){let e=i.activeGroup;return{editor:e.getEditors(1)[0],groupId:e.id}}},B0t=class extends oee{constructor(){super({id:"workbench.action.lastEditorInGroup",title:L(4105,"Open Last Editor in Group"),f1:!0,keybinding:{weight:200,primary:533,secondary:[2078],mac:{primary:277,secondary:[2078]}},category:Ve.View})}navigate(i){let e=i.activeGroup,t=e.getEditors(1);return{editor:t[t.length-1],groupId:e.id}}},QLe=class a extends K{static{this.ID="workbench.action.navigateForward"}static{this.LABEL=d(4141,null)}constructor(){super({id:a.ID,title:{...L(4142,"Go Forward"),mnemonicTitle:d(4110,null)},f1:!0,icon:R.arrowRight,precondition:C.has("canNavigateForward"),keybinding:{weight:200,win:{primary:529,secondary:[123]},mac:{primary:1368,secondary:[123]},linux:{primary:3160,secondary:[123]}},menu:[{id:D.MenubarGoMenu,group:"1_history_nav",order:2},{id:D.CommandCenter,order:2,when:C.has("config.workbench.navigationControl.enabled")}]})}async run(i){await i.get(na).goForward(0)}},YLe=class a extends K{static{this.ID="workbench.action.navigateBack"}static{this.LABEL=d(4135,null)}constructor(){super({id:a.ID,title:{...L(4136,"Go Back"),mnemonicTitle:d(4107,null)},f1:!0,precondition:C.has("canNavigateBack"),icon:R.arrowLeft,keybinding:{weight:200,win:{primary:527,secondary:[122]},mac:{primary:344,secondary:[122]},linux:{primary:2648,secondary:[122]}},menu:[{id:D.MenubarGoMenu,group:"1_history_nav",order:1},{id:D.CommandCenter,order:1,when:C.has("config.workbench.navigationControl.enabled")}]})}async run(i){await i.get(na).goBack(0)}},H0t=class extends K{constructor(){super({id:"workbench.action.navigateLast",title:L(4145,"Go Previous"),f1:!0})}async run(i){await i.get(na).goPrevious(0)}},U0t=class extends K{constructor(){super({id:"workbench.action.navigateForwardInEditLocations",title:L(4143,"Go Forward in Edit Locations"),f1:!0})}async run(i){await i.get(na).goForward(1)}},z0t=class extends K{constructor(){super({id:"workbench.action.navigateBackInEditLocations",title:L(4137,"Go Back in Edit Locations"),f1:!0})}async run(i){await i.get(na).goBack(1)}},K0t=class extends K{constructor(){super({id:"workbench.action.navigatePreviousInEditLocations",title:L(4146,"Go Previous in Edit Locations"),f1:!0})}async run(i){await i.get(na).goPrevious(1)}},G0t=class extends K{constructor(){super({id:"workbench.action.navigateToLastEditLocation",title:L(4148,"Go to Last Edit Location"),f1:!0,keybinding:{weight:200,primary:Vi(2089,2095)}})}async run(i){await i.get(na).goLast(1)}},q0t=class extends K{constructor(){super({id:"workbench.action.navigateForwardInNavigationLocations",title:L(4144,"Go Forward in Navigation Locations"),f1:!0})}async run(i){await i.get(na).goForward(2)}},$0t=class extends K{constructor(){super({id:"workbench.action.navigateBackInNavigationLocations",title:L(4138,"Go Back in Navigation Locations"),f1:!0})}async run(i){await i.get(na).goBack(2)}},j0t=class extends K{constructor(){super({id:"workbench.action.navigatePreviousInNavigationLocations",title:L(4147,"Go Previous in Navigation Locations"),f1:!0})}async run(i){await i.get(na).goPrevious(2)}},Q0t=class extends K{constructor(){super({id:"workbench.action.navigateToLastNavigationLocation",title:L(4149,"Go to Last Navigation Location"),f1:!0})}async run(i){await i.get(na).goLast(2)}},kJe=class a extends K{static{this.ID="workbench.action.reopenClosedEditor"}constructor(){super({id:a.ID,title:L(4167,"Reopen Closed Editor"),f1:!0,keybinding:{weight:200,primary:3122},category:Ve.View})}async run(i){await i.get(na).reopenLastClosedEditor()}},EJe=class a extends K{static{this.ID="workbench.action.clearRecentFiles"}constructor(){super({id:a.ID,title:L(4067,"Clear Recently Opened..."),f1:!0,category:Ve.File})}async run(i){let e=i.get(at),t=i.get(jp),o=i.get(na),{confirmed:n}=await e.confirm({type:"warning",message:d(4077,null),detail:d(4075,null),primaryButton:d(4064,null)});n&&(t.clearRecentlyOpened(),o.clearRecentlyOpened())}},TJe=class a extends K{static{this.ID="workbench.action.showEditorsInActiveGroup"}constructor(){super({id:a.ID,title:L(4174,"Show Editors in Active Group By Most Recently Used"),f1:!0,category:Ve.View})}async run(i){i.get(Ue).quickAccess.show(MD.PREFIX)}},_Je=class a extends K{static{this.ID="workbench.action.showAllEditors"}constructor(){super({id:a.ID,title:L(4172,"Show All Editors By Appearance"),f1:!0,keybinding:{weight:200,primary:Vi(2089,2094),mac:{primary:2562}},category:Ve.File})}async run(i){i.get(Ue).quickAccess.show(dH.PREFIX)}},DJe=class a extends K{static{this.ID="workbench.action.showAllEditorsByMostRecentlyUsed"}constructor(){super({id:a.ID,title:L(4173,"Show All Editors By Most Recently Used"),f1:!0,category:Ve.View})}async run(i){i.get(Ue).quickAccess.show(OA.PREFIX)}},XLe=class extends K{constructor(e,t,o){super(e);this.prefix=t;this.itemActivation=o}async run(e){let t=e.get(_e),o=e.get(Ue),n=t.lookupKeybindings(this.desc.id);o.quickAccess.show(this.prefix,{quickNavigateConfiguration:{keybindings:n},itemActivation:this.itemActivation})}},Y0t=class extends XLe{constructor(){super({id:"workbench.action.quickOpenPreviousRecentlyUsedEditor",title:L(4165,"Quick Open Previous Recently Used Editor"),f1:!0,category:Ve.View},OA.PREFIX,void 0)}},X0t=class extends XLe{constructor(){super({id:"workbench.action.quickOpenLeastRecentlyUsedEditor",title:L(4163,"Quick Open Least Recently Used Editor"),f1:!0,category:Ve.View},OA.PREFIX,void 0)}},J0t=class extends XLe{constructor(){super({id:"workbench.action.quickOpenPreviousRecentlyUsedEditorInGroup",title:L(4166,"Quick Open Previous Recently Used Editor in Group"),f1:!0,keybinding:{weight:200,primary:2050,mac:{primary:258}},precondition:jde.toNegated(),category:Ve.View},MD.PREFIX,void 0)}},Z0t=class extends XLe{constructor(){super({id:"workbench.action.quickOpenLeastRecentlyUsedEditorInGroup",title:L(4164,"Quick Open Least Recently Used Editor in Group"),f1:!0,keybinding:{weight:200,primary:3074,mac:{primary:1282}},precondition:jde.toNegated(),category:Ve.View},MD.PREFIX,3)}},eWt=class a extends K{static{this.ID="workbench.action.openPreviousEditorFromHistory"}constructor(){super({id:a.ID,title:L(4140,"Quick Open Previous Editor from History"),f1:!0})}async run(i){let e=i.get(_e),t=i.get(Ue),o=i.get(wt),n=e.lookupKeybindings(a.ID),r;o.activeGroup.count===0&&(r=1),t.quickAccess.show("",{quickNavigateConfiguration:{keybindings:n},itemActivation:r})}},tWt=class extends K{constructor(){super({id:"workbench.action.openNextRecentlyUsedEditor",title:L(4157,"Open Next Recently Used Editor"),f1:!0,category:Ve.View})}async run(i){i.get(na).openNextRecentlyUsedEditor()}},iWt=class extends K{constructor(){super({id:"workbench.action.openPreviousRecentlyUsedEditor",title:L(4161,"Open Previous Recently Used Editor"),f1:!0,category:Ve.View})}async run(i){i.get(na).openPreviouslyUsedEditor()}},oWt=class extends K{constructor(){super({id:"workbench.action.openNextRecentlyUsedEditorInGroup",title:L(4158,"Open Next Recently Used Editor In Group"),f1:!0,category:Ve.View})}async run(i){let e=i.get(na),t=i.get(wt);e.openNextRecentlyUsedEditor(t.activeGroup.id)}},nWt=class extends K{constructor(){super({id:"workbench.action.openPreviousRecentlyUsedEditorInGroup",title:L(4162,"Open Previous Recently Used Editor In Group"),f1:!0,category:Ve.View})}async run(i){let e=i.get(na),t=i.get(wt);e.openPreviouslyUsedEditor(t.activeGroup.id)}},rWt=class extends K{constructor(){super({id:"workbench.action.clearEditorHistoryWithoutConfirm",title:L(4066,"Clear Editor History without Confirmation"),f1:!0,precondition:ODt})}async run(i){i.get(na).clear()}},sWt=class extends K{constructor(){super({id:"workbench.action.clearEditorHistory",title:L(4065,"Clear Editor History"),f1:!0})}async run(i){let e=i.get(at),t=i.get(na),{confirmed:o}=await e.confirm({type:"warning",message:d(4076,null),detail:d(4075,null),primaryButton:d(4064,null)});o&&t.clear()}},aWt=class extends Lp{constructor(){super({id:"workbench.action.moveEditorLeftInGroup",title:L(4122,"Move Editor Left"),keybinding:{weight:200,primary:3083,mac:{primary:Vi(2089,3087)}},f1:!0,category:Ve.View},P2,{to:"left"})}},lWt=class extends Lp{constructor(){super({id:"workbench.action.moveEditorRightInGroup",title:L(4123,"Move Editor Right"),keybinding:{weight:200,primary:3084,mac:{primary:Vi(2089,3089)}},f1:!0,category:Ve.View},P2,{to:"right"})}},cWt=class extends Lp{constructor(){super({id:"workbench.action.moveEditorToStart",title:L(4134,"Move Editor to Start"),f1:!0,category:Ve.View},P2,{to:"first"})}},dWt=class extends Lp{constructor(){super({id:"workbench.action.moveEditorToEnd",title:L(4126,"Move Editor to End"),f1:!0,category:Ve.View},P2,{to:"last"})}},uWt=class extends Lp{constructor(){super({id:"workbench.action.moveEditorToPreviousGroup",title:L(4132,"Move Editor into Previous Group"),keybinding:{weight:200,primary:2575,mac:{primary:2319}},f1:!0,category:Ve.View},P2,{to:"previous",by:"group"})}},pWt=class extends Lp{constructor(){super({id:"workbench.action.moveEditorToNextGroup",title:L(4131,"Move Editor into Next Group"),f1:!0,keybinding:{weight:200,primary:2577,mac:{primary:2321}},category:Ve.View},P2,{to:"next",by:"group"})}},mWt=class extends Lp{constructor(){super({id:RLe,title:L(4124,"Move Editor into Group Above"),f1:!0,category:Ve.View},RLe)}},hWt=class extends Lp{constructor(){super({id:MLe,title:L(4125,"Move Editor into Group Below"),f1:!0,category:Ve.View},MLe)}},gWt=class extends Lp{constructor(){super({id:PLe,title:L(4129,"Move Editor into Left Group"),f1:!0,category:Ve.View},PLe)}},fWt=class extends Lp{constructor(){super({id:ALe,title:L(4133,"Move Editor into Right Group"),f1:!0,category:Ve.View},ALe)}},vWt=class extends Lp{constructor(){super({id:"workbench.action.moveEditorToFirstGroup",title:L(4127,"Move Editor into First Group"),f1:!0,keybinding:{weight:200,primary:1558,mac:{primary:2326}},category:Ve.View},P2,{to:"first",by:"group"})}},bWt=class extends Lp{constructor(){super({id:"workbench.action.moveEditorToLastGroup",title:L(4128,"Move Editor into Last Group"),f1:!0,keybinding:{weight:200,primary:1566,mac:{primary:2334}},category:Ve.View},P2,{to:"last",by:"group"})}},SWt=class extends Lp{constructor(){super({id:"workbench.action.splitEditorToPreviousGroup",title:L(4190,"Split Editor into Previous Group"),f1:!0,category:Ve.View},A2,{to:"previous",by:"group"})}},IWt=class extends Lp{constructor(){super({id:"workbench.action.splitEditorToNextGroup",title:L(4189,"Split Editor into Next Group"),f1:!0,category:Ve.View},A2,{to:"next",by:"group"})}},yWt=class extends Lp{constructor(){super({id:"workbench.action.splitEditorToAboveGroup",title:L(4183,"Split Editor into Group Above"),f1:!0,category:Ve.View},A2,{to:"up",by:"group"})}},wWt=class extends Lp{constructor(){super({id:"workbench.action.splitEditorToBelowGroup",title:L(4184,"Split Editor into Group Below"),f1:!0,category:Ve.View},A2,{to:"down",by:"group"})}},CWt=class extends Lp{static{this.ID="workbench.action.splitEditorToLeftGroup"}static{this.LABEL=d(4187,null)}constructor(){super({id:"workbench.action.splitEditorToLeftGroup",title:L(4188,"Split Editor into Left Group"),f1:!0,category:Ve.View},A2,{to:"left",by:"group"})}},xWt=class extends Lp{constructor(){super({id:"workbench.action.splitEditorToRightGroup",title:L(4191,"Split Editor into Right Group"),f1:!0,category:Ve.View},A2,{to:"right",by:"group"})}},kWt=class extends Lp{constructor(){super({id:"workbench.action.splitEditorToFirstGroup",title:L(4185,"Split Editor into First Group"),f1:!0,category:Ve.View},A2,{to:"first",by:"group"})}},EWt=class extends Lp{constructor(){super({id:"workbench.action.splitEditorToLastGroup",title:L(4186,"Split Editor into Last Group"),f1:!0,category:Ve.View},A2,{to:"last",by:"group"})}},LJe=class a extends Lp{static{this.ID="workbench.action.editorLayoutSingle"}constructor(){super({id:a.ID,title:L(4084,"Single Column Editor Layout"),f1:!0,category:Ve.View},N2,{groups:[{}],orientation:0})}},RJe=class a extends Lp{static{this.ID="workbench.action.editorLayoutTwoColumns"}constructor(){super({id:a.ID,title:L(4088,"Two Columns Editor Layout"),f1:!0,category:Ve.View},N2,{groups:[{},{}],orientation:0})}},MJe=class a extends Lp{static{this.ID="workbench.action.editorLayoutThreeColumns"}constructor(){super({id:a.ID,title:L(4085,"Three Columns Editor Layout"),f1:!0,category:Ve.View},N2,{groups:[{},{},{}],orientation:0})}},PJe=class a extends Lp{static{this.ID="workbench.action.editorLayoutTwoRows"}constructor(){super({id:a.ID,title:L(4090,"Two Rows Editor Layout"),f1:!0,category:Ve.View},N2,{groups:[{},{}],orientation:1})}},AJe=class a extends Lp{static{this.ID="workbench.action.editorLayoutThreeRows"}constructor(){super({id:a.ID,title:L(4086,"Three Rows Editor Layout"),f1:!0,category:Ve.View},N2,{groups:[{},{},{}],orientation:1})}},NJe=class a extends Lp{static{this.ID="workbench.action.editorLayoutTwoByTwoGrid"}constructor(){super({id:a.ID,title:L(4087,"Grid Editor Layout (2x2)"),f1:!0,category:Ve.View},N2,{groups:[{groups:[{},{}]},{groups:[{},{}]}],orientation:0})}},OJe=class a extends Lp{static{this.ID="workbench.action.editorLayoutTwoColumnsBottom"}constructor(){super({id:a.ID,title:L(4089,"Two Columns Bottom Editor Layout"),f1:!0,category:Ve.View},N2,{groups:[{},{groups:[{},{}]}],orientation:1})}},FJe=class a extends Lp{static{this.ID="workbench.action.editorLayoutTwoRowsRight"}constructor(){super({id:a.ID,title:L(4091,"Two Rows Right Editor Layout"),f1:!0,category:Ve.View},N2,{groups:[{},{groups:[{},{}]}],orientation:0})}},JLe=class extends K{constructor(e,t){super(e);this.direction=t}async run(e){let t=e.get(wt),o=e.get(yi),n=sm(),r=o.hasFocus("workbench.parts.editor")||n.activeElement===n.body,s=t.addGroup(t.activeGroup,this.direction);t.activateGroup(s),r&&s.focus()}},TWt=class extends JLe{constructor(){super({id:"workbench.action.newGroupLeft",title:L(4153,"New Editor Group to the Left"),f1:!0,category:Ve.View},2)}},_Wt=class extends JLe{constructor(){super({id:"workbench.action.newGroupRight",title:L(4154,"New Editor Group to the Right"),f1:!0,category:Ve.View},3)}},DWt=class extends JLe{constructor(){super({id:"workbench.action.newGroupAbove",title:L(4151,"New Editor Group Above"),f1:!0,category:Ve.View},0)}},LWt=class extends JLe{constructor(){super({id:"workbench.action.newGroupBelow",title:L(4152,"New Editor Group Below"),f1:!0,category:Ve.View},1)}},RWt=class extends K{constructor(){super({id:"workbench.action.toggleEditorType",title:L(4192,"Toggle Editor Type"),f1:!0,category:Ve.View,precondition:MF})}async run(i){let e=i.get(ee),t=i.get(Ka),o=e.activeEditorPane;if(!o)return;let n=po.getCanonicalUri(o.input);if(!n)return;let r=t.getEditors(n).map(s=>s.id).filter(s=>s!==o.input.editorId);r.length!==0&&await e.replaceEditors([{editor:o.input,replacement:{resource:n,options:{override:r[0]}}}],o.group)}},MWt=class extends K{constructor(){super({id:"workbench.action.reopenTextEditor",title:L(4168,"Reopen Editor with Text Editor"),f1:!0,category:Ve.View,precondition:MF})}async run(i){let e=i.get(ee),t=e.activeEditorPane;if(!t)return;let o=po.getCanonicalUri(t.input);o&&await e.replaceEditors([{editor:t.input,replacement:{resource:o,options:{override:la.id}}}],t.group)}},PWt=class extends K{constructor(e,t,o,n){super({id:e,title:t,category:Ve.View,precondition:fr,keybinding:o,f1:!0});this.move=n}async run(e,...t){let o=e.get(wt),n=e.get(ee),r=e.get(Io),s=Dp(t,n,o,r);if(!s.groupedEditors.length)return;let l=await o.createAuxiliaryEditorPart(),{group:c,editors:u}=s.groupedEditors[0],p=yJ(c,u,s.preserveFocus);this.move?c.moveEditors(p,l.activeGroup):c.copyEditors(p,l.activeGroup),l.activeGroup.focus()}},AWt=class extends PWt{constructor(){super(nJe,{...L(4130,"Move Editor into New Window"),mnemonicTitle:d(4112,null)},void 0,!0)}},NWt=class extends PWt{constructor(){super(rJe,{...L(4079,"Copy Editor into New Window"),mnemonicTitle:d(4109,null)},{primary:Vi(2089,45),weight:200},!1)}},OWt=class extends K{constructor(e,t,o){super({id:e,title:t,category:Ve.View,f1:!0});this.move=o}async run(e){let t=e.get(wt),o=t.activeGroup,n=await t.createAuxiliaryEditorPart();t.mergeGroup(o,n.activeGroup,{mode:this.move?1:0}),n.activeGroup.focus()}},FWt=class extends OWt{constructor(){super(_Ft,{...L(4121,"Move Editor Group into New Window"),mnemonicTitle:d(4111,null)},!0)}},WWt=class extends OWt{constructor(){super(DFt,{...L(4078,"Copy Editor Group into New Window"),mnemonicTitle:d(4108,null)},!1)}},VWt=class extends K{constructor(){super({id:"workbench.action.restoreEditorsToMainWindow",title:{...L(4169,"Restore Editors into Main Window"),mnemonicTitle:d(4116,null)},f1:!0,precondition:Rw,category:Ve.View})}async run(i){let e=i.get(wt);e.mergeAllGroups(e.mainPart.activeGroup)}},BWt=class extends K{constructor(){super({id:LFt,title:{...L(4150,"New Empty Editor Window"),mnemonicTitle:d(4113,null)},f1:!0,category:Ve.View})}async run(i){(await i.get(wt).createAuxiliaryEditorPart()).activeGroup.focus()}};var Gpe=class extends x{constructor(e,t,o,n,r,s,l,c){super();this.filesConfigurationService=e;this.hostService=t;this.editorService=o;this.editorGroupService=n;this.workingCopyService=r;this.logService=s;this.markerService=l;this.uriIdentityService=c;this.scheduledAutoSavesAfterDelay=new Map;this.lastActiveEditor=void 0;this.lastActiveGroupId=void 0;this.lastActiveEditorControlDisposable=this._register(new N);this.waitingOnConditionAutoSaveWorkingCopies=new gt(e=>this.uriIdentityService.extUri.getComparisonKey(e));this.waitingOnConditionAutoSaveEditors=new gt(e=>this.uriIdentityService.extUri.getComparisonKey(e));for(let u of this.workingCopyService.dirtyWorkingCopies)this.onDidRegister(u);this.registerListeners()}static{this.ID="workbench.contrib.editorAutoSave"}registerListeners(){this._register(this.hostService.onDidChangeFocus(e=>this.onWindowFocusChange(e))),this._register(this.hostService.onDidChangeActiveWindow(()=>this.onActiveWindowChange())),this._register(this.editorService.onDidActiveEditorChange(()=>this.onDidActiveEditorChange())),this._register(this.filesConfigurationService.onDidChangeAutoSaveConfiguration(()=>this.onDidChangeAutoSaveConfiguration())),this._register(this.workingCopyService.onDidRegister(e=>this.onDidRegister(e))),this._register(this.workingCopyService.onDidUnregister(e=>this.onDidUnregister(e))),this._register(this.workingCopyService.onDidChangeDirty(e=>this.onDidChangeDirty(e))),this._register(this.workingCopyService.onDidChangeContent(e=>this.onDidChangeContent(e))),this._register(this.markerService.onMarkerChanged(e=>this.onConditionChanged(e,3))),this._register(this.filesConfigurationService.onDidChangeAutoSaveDisabled(e=>this.onConditionChanged([e],4)))}onConditionChanged(e,t){for(let o of e){let n=this.waitingOnConditionAutoSaveWorkingCopies.get(o);if(n?.condition===t)n.workingCopy.isDirty()&&this.filesConfigurationService.getAutoSaveMode(n.workingCopy.resource,n.reason).mode!==0&&(this.discardAutoSave(n.workingCopy),this.logService.trace("[editor auto save] running auto save from condition change event",n.workingCopy.resource.toString(),n.workingCopy.typeId),n.workingCopy.save({reason:n.reason}));else{let r=this.waitingOnConditionAutoSaveEditors.get(o);r?.condition===t&&!r.editor.editor.isDisposed()&&r.editor.editor.isDirty()&&this.filesConfigurationService.getAutoSaveMode(r.editor.editor,r.reason).mode!==0&&(this.waitingOnConditionAutoSaveEditors.delete(o),this.logService.trace(`[editor auto save] running auto save from condition change event with reason ${r.reason}`),this.editorService.save(r.editor,{reason:r.reason}))}}}onWindowFocusChange(e){e||this.maybeTriggerAutoSave(4)}onActiveWindowChange(){this.maybeTriggerAutoSave(4)}onDidActiveEditorChange(){this.lastActiveEditor&&typeof this.lastActiveGroupId=="number"&&this.maybeTriggerAutoSave(3,{groupId:this.lastActiveGroupId,editor:this.lastActiveEditor});let e=this.editorGroupService.activeGroup,t=this.lastActiveEditor=e.activeEditor??void 0;this.lastActiveGroupId=e.id,this.lastActiveEditorControlDisposable.clear();let o=this.editorService.activeEditorPane;t&&o&&this.lastActiveEditorControlDisposable.add(o.onDidBlur(()=>{this.maybeTriggerAutoSave(3,{groupId:e.id,editor:t})}))}maybeTriggerAutoSave(e,t){if(t){if(!t.editor.isDirty()||t.editor.isReadonly()||t.editor.hasCapability(4))return;let o=this.filesConfigurationService.getAutoSaveMode(t.editor,e);o.mode!==0?(e===4&&(o.mode===3||o.mode===4)||e===3&&o.mode===3)&&(this.logService.trace(`[editor auto save] triggering auto save with reason ${e}`),this.editorService.save(t,{reason:e})):t.editor.resource&&(o.reason===3||o.reason===4)&&this.waitingOnConditionAutoSaveEditors.set(t.editor.resource,{editor:t,reason:e,condition:o.reason})}else this.saveAllDirtyAutoSaveables(e)}onDidChangeAutoSaveConfiguration(){let e;switch(this.filesConfigurationService.getAutoSaveMode(void 0).mode){case 3:e=3;break;case 4:e=4;break;case 1:case 2:e=2;break}e&&this.saveAllDirtyAutoSaveables(e)}saveAllDirtyAutoSaveables(e){for(let t of this.workingCopyService.dirtyWorkingCopies){if(t.capabilities&2)continue;let o=this.filesConfigurationService.getAutoSaveMode(t.resource,e);o.mode!==0?t.save({reason:e}):(o.reason===3||o.reason===4)&&this.waitingOnConditionAutoSaveWorkingCopies.set(t.resource,{workingCopy:t,reason:e,condition:o.reason})}}onDidRegister(e){e.isDirty()&&this.scheduleAutoSave(e)}onDidUnregister(e){this.discardAutoSave(e)}onDidChangeDirty(e){e.isDirty()?this.scheduleAutoSave(e):this.discardAutoSave(e)}onDidChangeContent(e){e.isDirty()&&this.scheduleAutoSave(e)}scheduleAutoSave(e){if(e.capabilities&2)return;let t=this.filesConfigurationService.getAutoSaveConfiguration(e.resource).autoSaveDelay;if(typeof t!="number")return;this.discardAutoSave(e),this.logService.trace(`[editor auto save] scheduling auto save after ${t}ms`,e.resource.toString(),e.typeId);let o=setTimeout(()=>{if(this.discardAutoSave(e),e.isDirty()){let n=2,r=this.filesConfigurationService.getAutoSaveMode(e.resource,n);r.mode!==0?(this.logService.trace("[editor auto save] running auto save",e.resource.toString(),e.typeId),e.save({reason:n})):(r.reason===3||r.reason===4)&&this.waitingOnConditionAutoSaveWorkingCopies.set(e.resource,{workingCopy:e,reason:n,condition:r.reason})}},t);this.scheduledAutoSavesAfterDelay.set(e,Z(()=>{this.logService.trace("[editor auto save] clearing pending auto save",e.resource.toString(),e.typeId),clearTimeout(o)}))}discardAutoSave(e){Be(this.scheduledAutoSavesAfterDelay.get(e)),this.scheduledAutoSavesAfterDelay.delete(e),this.waitingOnConditionAutoSaveWorkingCopies.delete(e.resource),this.waitingOnConditionAutoSaveEditors.delete(e.resource)}};Gpe=I([m(0,gr),m(1,Zt),m(2,ee),m(3,wt),m(4,Xa),m(5,se),m(6,oa),m(7,ht)],Gpe);var Ku={Quickaccess:"workbench.contributions.quickaccess"},Rwi=class{constructor(){this.providers=[];this.defaultProvider=void 0}registerQuickAccessProvider(i){return i.prefix.length===0?this.defaultProvider=i:this.providers.push(i),this.providers.sort((e,t)=>t.prefix.length-e.prefix.length),Z(()=>{this.providers.splice(this.providers.indexOf(i),1),this.defaultProvider===i&&(this.defaultProvider=void 0)})}getQuickAccessProviders(i){return di([this.defaultProvider,...this.providers]).filter(e=>!e.when||i.contextMatchesRules(e.when))}getQuickAccessProvider(i,e){return(i?this.providers.find(o=>i.startsWith(o.prefix)&&(!o.when||e.contextMatchesRules(o.when))):void 0)||this.defaultProvider}clear(){let i=[...this.providers],e=this.defaultProvider;return this.providers=[],this.defaultProvider=void 0,()=>{this.providers=i,this.defaultProvider=e}}};ne.add(Ku.Quickaccess,new Rwi);var Pk=le("textEditorService"),Mwi=class extends Error{constructor(i,e){super(i),this.name="FileEditorInputLeakError",this.stack=e}},z2=class extends x{constructor(e,t,o,n,r){super();this.untitledTextEditorService=e;this.instantiationService=t;this.uriIdentityService=o;this.fileService=n;this.editorResolverService=r;this.editorInputCache=new gt;this.fileEditorFactory=ne.as(qo.EditorFactory).getFileEditorFactory();this.mapLeakToCounter=new Map;this.registerDefaultEditor()}registerDefaultEditor(){this._register(this.editorResolverService.registerEditor("*",{id:la.id,label:la.displayName,detail:la.providerDisplayName,priority:"builtin"},{},{createEditorInput:e=>({editor:this.createTextEditor(e)}),createUntitledEditorInput:e=>({editor:this.createTextEditor(e)}),createDiffEditorInput:e=>({editor:this.createTextEditor(e)})}))}async resolveTextEditor(e){return this.createTextEditor(e)}createTextEditor(e){if(WC(e))return this.createTextEditor(e.result);if(Ib(e)){let n=this.createTextEditor(e.original),r=this.createTextEditor(e.modified);return this.instantiationService.createInstance(Pa,e.label,e.description,n,r,void 0)}if(Z_(e)){let n=this.createTextEditor(e.primary),r=this.createTextEditor(e.secondary);return this.instantiationService.createInstance(Ma,e.label,e.description,r,n)}let t=e;if(t.forceUntitled||!t.resource||t.resource.scheme===Q.untitled){let n={languageId:t.languageId,initialValue:t.contents,encoding:t.encoding},r;return t.resource?.scheme===Q.untitled?r=this.untitledTextEditorService.create({untitledResource:t.resource,...n}):r=this.untitledTextEditorService.create({associatedResource:t.resource,...n}),this.createOrGetCached(r.resource,()=>this.instantiationService.createInstance(eh,r))}let o=e;if(o.resource instanceof A){let n=o.label||He(o.resource),r=o.resource,s=this.uriIdentityService.asCanonicalUri(r);return this.createOrGetCached(s,()=>o.forceFile||this.fileService.hasProvider(s)?this.fileEditorFactory.createFileEditor(s,r,o.label,o.description,o.encoding,o.languageId,o.contents,this.instantiationService):this.instantiationService.createInstance($C,s,o.label,o.description,o.languageId,o.contents),l=>{l instanceof eh||(l instanceof $C?(n&&l.setName(n),o.description&&l.setDescription(o.description),o.languageId&&l.setPreferredLanguageId(o.languageId),typeof o.contents=="string"&&l.setPreferredContents(o.contents)):(l.setPreferredResource(r),o.label&&l.setPreferredName(o.label),o.description&&l.setPreferredDescription(o.description),o.encoding&&l.setPreferredEncoding(o.encoding),o.languageId&&l.setPreferredLanguageId(o.languageId),typeof o.contents=="string"&&l.setPreferredContents(o.contents)))})}throw new Error(`ITextEditorService: Unable to create texteditor from ${JSON.stringify(e)}`)}createOrGetCached(e,t,o){let n=this.editorInputCache.get(e);if(n)return o?.(n),n;n=t(),this.editorInputCache.set(e,n);let r=this.trackLeaks(n);return U.once(n.onWillDispose)(()=>{this.editorInputCache.delete(e),r&&this.untrackLeaks(r)}),n}static{this.LEAK_TRACKING_THRESHOLD=256}static{this.LEAK_REPORTING_THRESHOLD=2*this.LEAK_TRACKING_THRESHOLD}static{this.LEAK_REPORTED=!1}trackLeaks(e){if(z2.LEAK_REPORTED||this.editorInputCache.size<z2.LEAK_TRACKING_THRESHOLD)return;let t=`${e.resource.scheme}#${e.typeId||"<no typeId>"}#${e.editorId||"<no editorId>"}
${new Error().stack?.split(`
`).slice(2).join(`
`)??""}`,o=(this.mapLeakToCounter.get(t)??0)+1;if(this.mapLeakToCounter.set(t,o),this.editorInputCache.size>z2.LEAK_REPORTING_THRESHOLD){z2.LEAK_REPORTED=!0;let[n,r]=Array.from(this.mapLeakToCounter.entries()).reduce(([l,c],[u,p])=>p>c?[u,p]:[l,c]),s=`Potential text editor input LEAK detected, having ${this.editorInputCache.size} text editor inputs already. Most frequent owner (${r})`;mt(new Mwi(s,n))}return t}untrackLeaks(e){let t=(this.mapLeakToCounter.get(e)??1)-1;this.mapLeakToCounter.set(e,t),t===0&&this.mapLeakToCounter.delete(e)}};z2=I([m(0,fD),m(1,F),m(2,ht),m(3,fe),m(4,Ka)],z2);Ee(Pk,z2,0);var ZLe=class{constructor(i,e,t){this.filesConfigurationService=i;this.environmentService=e;this.pathService=t}canSerialize(i){return this.filesConfigurationService.isHotExitEnabled&&!i.isDisposed()}serialize(i){if(!this.canSerialize(i))return;let e=i,t=e.resource;e.hasAssociatedFilePath&&(t=of(t,this.environmentService.remoteAuthority,this.pathService.defaultUriScheme));let o,n=e.getLanguageId();(n!==$r||e.hasLanguageSetExplicitly)&&(o=n);let r={resourceJSON:t.toJSON(),modeId:o,encoding:e.getEncoding()};return JSON.stringify(r)}deserialize(i,e){return i.invokeFunction(t=>{let o=JSON.parse(e),n=A.revive(o.resourceJSON),r=o.modeId,s=o.encoding;return t.get(Pk).createTextEditor({resource:n,languageId:r,encoding:s,forceUntitled:!0})})}};ZLe=I([m(0,gr),m(1,At),m(2,An)],ZLe);var qpe=class extends x{constructor(e,t,o,n,r){super();this.environmentService=t;this.pathService=o;this.textEditorService=n;this.untitledTextEditorService=r;this._register(e.registerHandler(this))}static{this.ID="workbench.contrib.untitledTextEditorWorkingCopyEditorHandler"}handles(e){return e.resource.scheme===Q.untitled&&e.typeId===gA}isOpen(e,t){return this.handles(e)?t instanceof eh&&Qe(e.resource,t.resource):!1}createEditor(e){let t;return this.untitledTextEditorService.isUntitledWithAssociatedResource(e.resource)?t=of(e.resource,this.environmentService.remoteAuthority,this.pathService.defaultUriScheme):t=e.resource,this.textEditorService.createTextEditor({resource:t,forceUntitled:!0})}};qpe=I([m(0,iv),m(1,At),m(2,An),m(3,Pk),m(4,fD)],qpe);var k0=class extends x{constructor(e,t,o){super();this.editorResolverService=e;this.environmentService=o;this.configurationRegistry=ne.as(Jt.Configuration);(async()=>(await t.whenInstalledExtensionsRegistered(),this.updateDynamicEditorConfigurations(),this.registerListeners()))()}static{this.ID="workbench.contrib.dynamicEditorConfigurations"}static{this.AUTO_LOCK_DEFAULT_ENABLED=new Set(["terminalEditor","mainThreadWebview-simpleBrowser.view","mainThreadWebview-browserPreview","workbench.editor.processExplorer"])}static{this.AUTO_LOCK_EXTRA_EDITORS=[{id:"workbench.input.interactive",label:d(4224,null),priority:"builtin"},{id:"mainThreadWebview-markdown.preview",label:d(4226,null),priority:"builtin"},{id:"mainThreadWebview-simpleBrowser.view",label:d(4227,null),priority:"builtin"},{id:"mainThreadWebview-browserPreview",label:d(4225,null),priority:"builtin"}]}static{this.AUTO_LOCK_REMOVE_EDITORS=new Set(["vscode-interactive-input","interactive","vscode.markdown.preview.editor"])}registerListeners(){this._register(U.debounce(this.editorResolverService.onDidChangeEditorRegistrations,(e,t)=>t)(()=>this.updateDynamicEditorConfigurations()))}updateDynamicEditorConfigurations(){let e=[...this.editorResolverService.getEditors(),...k0.AUTO_LOCK_EXTRA_EDITORS].filter(u=>!k0.AUTO_LOCK_REMOVE_EDITORS.has(u.id)),t=this.editorResolverService.getEditors().filter(u=>u.priority!=="exclusive").map(u=>u.id),o=Object.create(null);for(let u of e)o[u.id]={type:"boolean",default:k0.AUTO_LOCK_DEFAULT_ENABLED.has(u.id),description:u.label};let n=Object.create(null);for(let u of e)n[u.id]=k0.AUTO_LOCK_DEFAULT_ENABLED.has(u.id);let r=this.autoLockConfigurationNode;this.autoLockConfigurationNode={...Ud,properties:{"workbench.editor.autoLockGroups":{type:"object",description:d(4228,null),properties:o,default:n,additionalProperties:!1}}};let s=this.defaultBinaryEditorConfigurationNode;this.defaultBinaryEditorConfigurationNode={...Ud,properties:{"workbench.editor.defaultBinaryEditor":{type:"string",default:"",enum:[...t,""],description:d(4229,null)}}};let l=this.editorAssociationsConfigurationNode;this.editorAssociationsConfigurationNode={...Ud,properties:{"workbench.editorAssociations":{type:"object",markdownDescription:d(4222,null),patternProperties:{".*":{type:"string",enum:t}}}}};let c=this.editorLargeFileConfirmationConfigurationNode;this.editorLargeFileConfirmationConfigurationNode={...Ud,properties:{"workbench.editorLargeFileConfirmation":{type:"number",default:Rbt(this.environmentService.remoteAuthority)/vl.MB,minimum:1,scope:5,markdownDescription:d(4223,null)}}},this.configurationRegistry.updateConfigurations({add:[this.autoLockConfigurationNode,this.defaultBinaryEditorConfigurationNode,this.editorAssociationsConfigurationNode,this.editorLargeFileConfirmationConfigurationNode],remove:di([r,s,l,c])})}};k0=I([m(0,Ka),m(1,lt),m(2,At)],k0);ne.as(qo.EditorPane).registerEditorPane(Br.create(R3,R3.ID,d(4053,null)),[new Ft(eh),new Ft($C)]);ne.as(qo.EditorPane).registerEditorPane(Br.create(PD,PD.ID,d(4052,null)),[new Ft(Pa)]);ne.as(qo.EditorPane).registerEditorPane(Br.create(gH,gH.ID,d(3931,null)),[new Ft(Pa)]);ne.as(qo.EditorPane).registerEditorPane(Br.create(_f,_f.ID,d(4040,null)),[new Ft(Ma)]);ne.as(qo.EditorFactory).registerEditorSerializer(eh.ID,ZLe);ne.as(qo.EditorFactory).registerEditorSerializer(Ma.ID,MDt);ne.as(qo.EditorFactory).registerEditorSerializer(Pa.ID,PDt);It(Gpe.ID,Gpe,St.BlockRestore);It(zpe.ID,zpe,St.BlockRestore);It(qpe.ID,qpe,St.BlockRestore);It(k0.ID,k0,St.BlockRestore);var Pwi=ne.as(Ku.Quickaccess),UWt="inEditorsPicker",Pco=C.and(TT,C.has(UWt));Pwi.registerQuickAccessProvider({ctor:MD,prefix:MD.PREFIX,contextKey:UWt,placeholder:d(3951,null),helpEntries:[{description:d(3928,null),commandId:TJe.ID}]});Pwi.registerQuickAccessProvider({ctor:dH,prefix:dH.PREFIX,contextKey:UWt,placeholder:d(3951,null),helpEntries:[{description:d(3929,null),commandId:_Je.ID}]});Pwi.registerQuickAccessProvider({ctor:OA,prefix:OA.PREFIX,contextKey:UWt,placeholder:d(3951,null),helpEntries:[{description:d(3930,null),commandId:DJe.ID}]});W(eee);W($Ft);W(jFt);W(QLe);W(YLe);W(N0t);W(O0t);W(F0t);W(W0t);W(V0t);W(B0t);W(tWt);W(iWt);W(oWt);W(nWt);W(kJe);W(EJe);W(_Je);W(DJe);W(TJe);W(Kpe);W(v0t);W(g0t);W(b0t);W(S0t);W(h0t);W(YFt);W(XFt);W(JFt);W(ZFt);W(e0t);W(t0t);W(i0t);W(o0t);W(n0t);W(R0t);W(M0t);W(P0t);W(A0t);W(D0t);W(L0t);W(aWt);W(lWt);W(cWt);W(dWt);W(y0t);W(w0t);W(C0t);W(x0t);W(k0t);W(E0t);W(T0t);W(_0t);W(uWt);W(pWt);W(vWt);W(bWt);W(gWt);W(fWt);W(mWt);W(hWt);W(SWt);W(IWt);W(kWt);W(EWt);W(CWt);W(xWt);W(yWt);W(wWt);W(r0t);W(s0t);W(a0t);W(c0t);W(l0t);W(d0t);W(u0t);W(p0t);W(m0t);W(TWt);W(_Wt);W(DWt);W(LWt);W(H0t);W(U0t);W(z0t);W(K0t);W(G0t);W(q0t);W($0t);W(j0t);W(Q0t);W(sWt);W(rWt);W(LJe);W(RJe);W(MJe);W(PJe);W(AJe);W(NJe);W(FJe);W(OJe);W(RWt);W(MWt);W(Y0t);W(X0t);W(J0t);W(Z0t);W(eWt);W(AWt);W(NWt);W(FWt);W(WWt);W(VWt);W(BWt);var Rco="workbench.action.quickOpenNavigateNextInEditorPicker";Ct.registerCommandAndKeybindingRule({id:Rco,weight:250,handler:LD(Rco,!0),when:Pco,primary:2050,mac:{primary:258}});var Mco="workbench.action.quickOpenNavigatePreviousInEditorPicker";Ct.registerCommandAndKeybindingRule({id:Mco,weight:250,handler:LD(Mco,!1),when:Pco,primary:3074,mac:{primary:1282}});eco();Ze&&(ve.appendMenuItem(D.TouchBarContext,{command:{id:YLe.ID,title:YLe.LABEL,icon:{dark:vn.asFileUri("vs/workbench/browser/parts/editor/media/back-tb.png")}},group:"navigation",order:0}),ve.appendMenuItem(D.TouchBarContext,{command:{id:QLe.ID,title:QLe.LABEL,icon:{dark:vn.asFileUri("vs/workbench/browser/parts/editor/media/forward-tb.png")}},group:"navigation",order:1}));ve.appendMenuItem(D.EmptyEditorGroup,{command:{id:xFt,title:d(3961,null),icon:R.unlock},group:"navigation",order:10,when:C.and(Cb,aT.toNegated())});ve.appendMenuItem(D.EmptyEditorGroup,{command:{id:x3,title:d(4060,null),icon:R.lock,toggled:C.true()},group:"navigation",order:10,when:aT});ve.appendMenuItem(D.EmptyEditorGroup,{command:{id:yFt,title:d(3938,null),icon:R.close},group:"navigation",order:20,when:C.or(Cb,n4)});ve.appendMenuItem(D.EmptyEditorGroupContext,{command:{id:E3,title:d(4049,null)},group:"2_split",order:10});ve.appendMenuItem(D.EmptyEditorGroupContext,{command:{id:O2,title:d(4043,null)},group:"2_split",order:20});ve.appendMenuItem(D.EmptyEditorGroupContext,{command:{id:T3,title:d(4047,null)},group:"2_split",order:30});ve.appendMenuItem(D.EmptyEditorGroupContext,{command:{id:F2,title:d(4048,null)},group:"2_split",order:40});ve.appendMenuItem(D.EmptyEditorGroupContext,{command:{id:LFt,title:d(4031,null)},group:"3_window",order:10});ve.appendMenuItem(D.EmptyEditorGroupContext,{command:{id:CFt,title:d(4055,null),toggled:aT},group:"4_lock",order:10,when:Cb.toNegated()});ve.appendMenuItem(D.EmptyEditorGroupContext,{command:{id:yFt,title:d(3932,null)},group:"5_close",order:10,when:SS});ve.appendMenuItem(D.EditorTabsBarContext,{command:{id:E3,title:d(4049,null)},group:"2_split",order:10});ve.appendMenuItem(D.EditorTabsBarContext,{command:{id:O2,title:d(4043,null)},group:"2_split",order:20});ve.appendMenuItem(D.EditorTabsBarContext,{command:{id:T3,title:d(4047,null)},group:"2_split",order:30});ve.appendMenuItem(D.EditorTabsBarContext,{command:{id:F2,title:d(4048,null)},group:"2_split",order:40});ve.appendMenuItem(D.EditorTabsBarContext,{command:{id:_Ft,title:d(4023,null)},group:"3_window",order:10});ve.appendMenuItem(D.EditorTabsBarContext,{command:{id:DFt,title:d(3947,null)},group:"3_window",order:20});ve.appendMenuItem(D.EditorTabsBarContext,{submenu:D.EditorTabsBarShowTabsSubmenu,title:d(4051,null),group:"4_config",order:10,when:BC.negate()});ve.appendMenuItem(D.EditorTabsBarShowTabsSubmenu,{command:{id:HXe.ID,title:d(4028,null),toggled:C.equals("config.workbench.editor.showTabs","multiple")},group:"1_config",order:10});ve.appendMenuItem(D.EditorTabsBarShowTabsSubmenu,{command:{id:zXe.ID,title:d(4041,null),toggled:C.equals("config.workbench.editor.showTabs","single")},group:"1_config",order:20});ve.appendMenuItem(D.EditorTabsBarShowTabsSubmenu,{command:{id:VXe.ID,title:d(3953,null),toggled:C.equals("config.workbench.editor.showTabs","none")},group:"1_config",order:30});ve.appendMenuItem(D.EditorTabsBarContext,{submenu:D.EditorTabsBarShowTabsZenModeSubmenu,title:d(4051,null),group:"4_config",order:10,when:BC});ve.appendMenuItem(D.EditorTabsBarShowTabsZenModeSubmenu,{command:{id:UXe.ID,title:d(4028,null),toggled:C.equals("config.zenMode.showTabs","multiple")},group:"1_config",order:10});ve.appendMenuItem(D.EditorTabsBarShowTabsZenModeSubmenu,{command:{id:KXe.ID,title:d(4041,null),toggled:C.equals("config.zenMode.showTabs","single")},group:"1_config",order:20});ve.appendMenuItem(D.EditorTabsBarShowTabsZenModeSubmenu,{command:{id:BXe.ID,title:d(3953,null),toggled:C.equals("config.zenMode.showTabs","none")},group:"1_config",order:30});ve.appendMenuItem(D.EditorTabsBarContext,{submenu:D.EditorActionsPositionSubmenu,title:d(3950,null),group:"4_config",order:20});ve.appendMenuItem(D.EditorActionsPositionSubmenu,{command:{id:qXe.ID,title:d(4051,null),toggled:C.equals("config.workbench.editor.editorActionsLocation","default")},group:"1_config",order:10,when:C.equals("config.workbench.editor.showTabs","none").negate()});ve.appendMenuItem(D.EditorActionsPositionSubmenu,{command:{id:GXe.ID,title:d(4054,null),toggled:C.or(C.equals("config.workbench.editor.editorActionsLocation","titleBar"),C.and(C.equals("config.workbench.editor.showTabs","none"),C.equals("config.workbench.editor.editorActionsLocation","default")))},group:"1_config",order:20});ve.appendMenuItem(D.EditorActionsPositionSubmenu,{command:{id:$Xe.ID,title:d(3952,null),toggled:C.equals("config.workbench.editor.editorActionsLocation","hidden")},group:"1_config",order:30});ve.appendMenuItem(D.EditorTabsBarContext,{command:{id:jXe.ID,title:d(3946,null)},group:"9_configure",order:10});ve.appendMenuItem(D.EditorTitleContext,{command:{id:dx,title:d(3932,null)},group:"1_close",order:10});ve.appendMenuItem(D.EditorTitleContext,{command:{id:DLe,title:d(3940,null),precondition:BDt.notEqualsTo("1")},group:"1_close",order:20});ve.appendMenuItem(D.EditorTitleContext,{command:{id:IFt,title:d(3942,null),precondition:C.and($de.toNegated(),o4.negate())},group:"1_close",order:30,when:xK});ve.appendMenuItem(D.EditorTitleContext,{command:{id:Ope,title:d(3934,null)},group:"1_close",order:40});ve.appendMenuItem(D.EditorTitleContext,{command:{id:C3,title:d(3933,null)},group:"1_close",order:50});ve.appendMenuItem(D.EditorTitleContext,{command:{id:LLe,title:d(4036,null)},group:"1_open",order:10,when:MF});ve.appendMenuItem(D.EditorTitleContext,{command:{id:wFt,title:d(3958,null),precondition:UEe.toNegated()},group:"3_preview",order:10,when:C.has("config.workbench.editor.enablePreview")});ve.appendMenuItem(D.EditorTitleContext,{command:{id:kFt,title:d(4033,null)},group:"3_preview",order:20,when:VR.toNegated()});ve.appendMenuItem(D.EditorTitleContext,{command:{id:k3,title:d(4062,null)},group:"3_preview",order:20,when:VR});ve.appendMenuItem(D.EditorTitleContext,{command:{id:$Z,title:d(4048,null)},group:"5_split",order:10,when:Yde.negate()});ve.appendMenuItem(D.EditorTitleContext,{command:{id:$Z,title:d(4043,null)},group:"5_split",order:10,when:Yde});ve.appendMenuItem(D.EditorTitleContext,{submenu:D.EditorSplitMoveSubmenu,title:d(4042,null),group:"5_split",order:15});ve.appendMenuItem(D.EditorTitleContext,{command:{id:nJe,title:d(4027,null)},group:"7_new_window",order:10});ve.appendMenuItem(D.EditorTitleContext,{command:{id:rJe,title:d(3949,null)},group:"7_new_window",order:20});ve.appendMenuItem(D.EditorTitleContext,{submenu:D.EditorTitleContextShare,title:d(4038,null),group:"11_share",order:-1,when:o4.negate()});ve.appendMenuItem(D.EditorSplitMoveSubmenu,{command:{id:E3,title:d(4049,null)},group:"1_split",order:10});ve.appendMenuItem(D.EditorSplitMoveSubmenu,{command:{id:O2,title:d(4043,null)},group:"1_split",order:20});ve.appendMenuItem(D.EditorSplitMoveSubmenu,{command:{id:T3,title:d(4047,null)},group:"1_split",order:30});ve.appendMenuItem(D.EditorSplitMoveSubmenu,{command:{id:F2,title:d(4048,null)},group:"1_split",order:40});ve.appendMenuItem(D.EditorSplitMoveSubmenu,{command:{id:RLe,title:d(4021,null)},group:"2_move",order:10});ve.appendMenuItem(D.EditorSplitMoveSubmenu,{command:{id:MLe,title:d(4022,null)},group:"2_move",order:20});ve.appendMenuItem(D.EditorSplitMoveSubmenu,{command:{id:PLe,title:d(4025,null)},group:"2_move",order:30});ve.appendMenuItem(D.EditorSplitMoveSubmenu,{command:{id:ALe,title:d(4026,null)},group:"2_move",order:40});ve.appendMenuItem(D.EditorSplitMoveSubmenu,{command:{id:EFt,title:d(4046,null),precondition:o4.negate()},group:"3_split_in_group",order:10,when:wB});ve.appendMenuItem(D.EditorSplitMoveSubmenu,{command:{id:TFt,title:d(3956,null),precondition:o4.negate()},group:"3_split_in_group",order:10,when:VC});ve.appendMenuItem(D.EditorTitle,{command:{id:fFt,title:d(3955,null),toggled:C.equals("config.diffEditor.renderSideBySide",!1)},group:"1_diff",order:10,when:C.has("isInDiffEditor")});ve.appendMenuItem(D.EditorTitle,{command:{id:Fyi,title:d(4039,null)},group:"3_open",order:10});ve.appendMenuItem(D.EditorTitle,{command:{id:C3,title:d(3933,null)},group:"5_close",order:10});ve.appendMenuItem(D.EditorTitle,{command:{id:Ope,title:d(3934,null)},group:"5_close",order:20});ve.appendMenuItem(D.EditorTitle,{command:{id:Oyi,title:d(4056,null),toggled:C.has("config.workbench.editor.enablePreview")},group:"7_settings",order:10});ve.appendMenuItem(D.EditorTitle,{command:{id:NLe,title:d(3962,null)},group:"8_group_operations",order:5,when:C.and(CB.negate(),n4)});ve.appendMenuItem(D.EditorTitle,{command:{id:NLe,title:d(4061,null)},group:"8_group_operations",order:5,when:CB});ve.appendMenuItem(D.EditorTitle,{command:{id:CFt,title:d(3960,null),toggled:aT},group:"8_group_operations",order:10,when:Cb.toNegated()});ve.appendMenuItem(D.EditorTitle,{command:{id:QXe.ID,title:d(3945,null)},group:"9_configure",order:10});function E0(a,i,e,t,o,n,r){let s={command:{id:a.id,title:a.title,icon:a.icon,toggled:a.toggled,precondition:o},group:"navigation",when:i,order:e};t&&(s.alt={id:t.id,title:t.title,icon:t.icon}),ve.appendMenuItem(D.EditorTitle,s),n&&ve.appendMenuItem(D.CompactWindowEditorTitle,s),r&&ve.appendMenuItem(D.ModalEditorEditorTitle,s)}var Awi=1e5,eRe=1e6;E0({id:$Z,title:d(4045,null),icon:R.splitHorizontal},Yde.negate(),Awi,{id:O2,title:d(4044,null),icon:R.splitVertical});E0({id:$Z,title:d(4044,null),icon:R.splitVertical},Yde,Awi,{id:F2,title:d(4045,null),icon:R.splitHorizontal});E0({id:Wyi,title:d(4057,null),icon:R.editorLayout},VC,Awi-1);E0({id:dx,title:d(3932,null),icon:R.close},C.and(xK.toNegated(),qde.toNegated(),VR.toNegated()),eRe,{id:C3,title:d(3933,null),icon:R.closeAll});E0({id:dx,title:d(3932,null),icon:R.closeDirty},C.and(xK.toNegated(),qde,VR.toNegated()),eRe,{id:C3,title:d(3933,null),icon:R.closeAll});E0({id:k3,title:d(4062,null),icon:R.pinned},C.and(xK.toNegated(),qde.toNegated(),VR),eRe,{id:dx,title:d(3932,null),icon:R.close});E0({id:k3,title:d(4062,null),icon:R.pinnedDirty},C.and(xK.toNegated(),qde,VR),eRe,{id:dx,title:d(3932,null),icon:R.close});E0({id:xFt,title:d(3959,null),icon:R.unlock},C.and(Cb,aT.toNegated()),eRe-1);E0({id:x3,title:d(4059,null),icon:R.lock,toggled:C.true()},aT,eRe-1);var F6o=Ae("diff-editor-previous-change",R.arrowUp,d(4035,null));E0({id:bFt,title:d(4030,null),icon:F6o},bS,10,void 0,pe.hasChanges,!0,!0);var W6o=Ae("diff-editor-next-change",R.arrowDown,d(4032,null));E0({id:vFt,title:d(4029,null),icon:W6o},bS,11,void 0,pe.hasChanges,!0,!0);E0({id:SFt,title:d(4050,null),icon:R.arrowSwap},C.and(bS,zEe),15,void 0,void 0);var V6o=Ae("diff-editor-toggle-whitespace",R.whitespace,d(4058,null));ve.appendMenuItem(D.EditorTitle,{command:{id:Pyi,title:d(3954,null),icon:V6o,precondition:bS,toggled:C.equals("config.diffEditor.ignoreTrimWhitespace",!1)},group:"navigation",when:bS,order:20});ve.appendMenuItem(D.CommandPalette,{command:{id:wFt,title:L(3957,"Keep Editor"),category:Ve.View},when:C.has("config.workbench.editor.enablePreview")});ve.appendMenuItem(D.CommandPalette,{command:{id:kFt,title:L(4034,"Pin Editor"),category:Ve.View}});ve.appendMenuItem(D.CommandPalette,{command:{id:k3,title:L(4063,"Unpin Editor"),category:Ve.View}});ve.appendMenuItem(D.CommandPalette,{command:{id:dx,title:L(3935,"Close Editor"),category:Ve.View}});ve.appendMenuItem(D.CommandPalette,{command:{id:Nyi,title:L(3941,"Close Pinned Editor"),category:Ve.View}});ve.appendMenuItem(D.CommandPalette,{command:{id:C3,title:L(3937,"Close All Editors in Group"),category:Ve.View}});ve.appendMenuItem(D.CommandPalette,{command:{id:Ope,title:L(3944,"Close Saved Editors in Group"),category:Ve.View}});ve.appendMenuItem(D.CommandPalette,{command:{id:DLe,title:L(3939,"Close Other Editors in Group"),category:Ve.View}});ve.appendMenuItem(D.CommandPalette,{command:{id:IFt,title:L(3943,"Close Editors to the Right in Group"),category:Ve.View},when:$de.toNegated()});ve.appendMenuItem(D.CommandPalette,{command:{id:oJe,title:L(3936,"Close Editor Group"),category:Ve.View},when:SS});ve.appendMenuItem(D.CommandPalette,{command:{id:LLe,title:L(4037,"Reopen Editor With..."),category:Ve.View},when:MF});ve.appendMenuItem(D.MenubarRecentMenu,{group:"1_editor",command:{id:kJe.ID,title:d(3990,null),precondition:C.has("canReopenClosedEditor")},order:1});ve.appendMenuItem(D.MenubarRecentMenu,{group:"z_clear",command:{id:EJe.ID,title:d(3963,null)},order:1});ve.appendMenuItem(D.MenubarFileMenu,{title:d(3992,null),submenu:D.MenubarShare,group:"45_share",order:1});ve.appendMenuItem(D.MenubarViewMenu,{group:"2_appearance",title:d(3965,null),submenu:D.MenubarLayoutMenu,order:2});ve.appendMenuItem(D.MenubarLayoutMenu,{group:"1_split",command:{id:E3,title:{...L(4004,"Split Up"),mnemonicTitle:d(4003,null)}},order:1});ve.appendMenuItem(D.MenubarLayoutMenu,{group:"1_split",command:{id:O2,title:{...L(3996,"Split Down"),mnemonicTitle:d(3995,null)}},order:2});ve.appendMenuItem(D.MenubarLayoutMenu,{group:"1_split",command:{id:T3,title:{...L(4000,"Split Left"),mnemonicTitle:d(3999,null)}},order:3});ve.appendMenuItem(D.MenubarLayoutMenu,{group:"1_split",command:{id:F2,title:{...L(4002,"Split Right"),mnemonicTitle:d(4001,null)}},order:4});ve.appendMenuItem(D.MenubarLayoutMenu,{group:"2_split_in_group",command:{id:EFt,title:{...L(3998,"Split in Group"),mnemonicTitle:d(3997,null)}},when:wB,order:1});ve.appendMenuItem(D.MenubarLayoutMenu,{group:"2_split_in_group",command:{id:TFt,title:{...L(3977,"Join in Group"),mnemonicTitle:d(3976,null)}},when:VC,order:1});ve.appendMenuItem(D.MenubarLayoutMenu,{group:"3_new_window",command:{id:nJe,title:{...L(4024,"Move Editor into New Window"),mnemonicTitle:d(3979,null)}},order:1});ve.appendMenuItem(D.MenubarLayoutMenu,{group:"3_new_window",command:{id:rJe,title:{...L(3948,"Copy Editor into New Window"),mnemonicTitle:d(3964,null)}},order:2});ve.appendMenuItem(D.MenubarLayoutMenu,{group:"4_layouts",command:{id:LJe.ID,title:{...L(3994,"Single"),mnemonicTitle:d(3993,null)}},order:1});ve.appendMenuItem(D.MenubarLayoutMenu,{group:"4_layouts",command:{id:RJe.ID,title:{...L(4016,"Two Columns"),mnemonicTitle:d(4015,null)}},order:3});ve.appendMenuItem(D.MenubarLayoutMenu,{group:"4_layouts",command:{id:MJe.ID,title:{...L(4008,"Three Columns"),mnemonicTitle:d(4007,null)}},order:4});ve.appendMenuItem(D.MenubarLayoutMenu,{group:"4_layouts",command:{id:PJe.ID,title:{...L(4018,"Two Rows"),mnemonicTitle:d(4017,null)}},order:5});ve.appendMenuItem(D.MenubarLayoutMenu,{group:"4_layouts",command:{id:AJe.ID,title:{...L(4010,"Three Rows"),mnemonicTitle:d(4009,null)}},order:6});ve.appendMenuItem(D.MenubarLayoutMenu,{group:"4_layouts",command:{id:NJe.ID,title:{...L(4012,"Grid (2x2)"),mnemonicTitle:d(4011,null)}},order:7});ve.appendMenuItem(D.MenubarLayoutMenu,{group:"4_layouts",command:{id:FJe.ID,title:{...L(4020,"Two Rows Right"),mnemonicTitle:d(4019,null)}},order:8});ve.appendMenuItem(D.MenubarLayoutMenu,{group:"4_layouts",command:{id:OJe.ID,title:{...L(4014,"Two Columns Bottom"),mnemonicTitle:d(4013,null)}},order:9});ve.appendMenuItem(D.MenubarGoMenu,{group:"1_history_nav",command:{id:"workbench.action.navigateToLastEditLocation",title:d(3978,null),precondition:C.has("canNavigateToLastEditLocation")},order:3});ve.appendMenuItem(D.MenubarSwitchEditorMenu,{group:"1_sideBySide",command:{id:Vyi,title:d(3966,null)},when:C.or(VC,bS),order:1});ve.appendMenuItem(D.MenubarSwitchEditorMenu,{group:"1_sideBySide",command:{id:Byi,title:d(3991,null)},when:C.or(VC,bS),order:2});ve.appendMenuItem(D.MenubarSwitchEditorMenu,{group:"2_any",command:{id:"workbench.action.nextEditor",title:d(3980,null)},order:1});ve.appendMenuItem(D.MenubarSwitchEditorMenu,{group:"2_any",command:{id:"workbench.action.previousEditor",title:d(3985,null)},order:2});ve.appendMenuItem(D.MenubarSwitchEditorMenu,{group:"3_any_used",command:{id:"workbench.action.openNextRecentlyUsedEditor",title:d(3983,null)},order:1});ve.appendMenuItem(D.MenubarSwitchEditorMenu,{group:"3_any_used",command:{id:"workbench.action.openPreviousRecentlyUsedEditor",title:d(3988,null)},order:2});ve.appendMenuItem(D.MenubarSwitchEditorMenu,{group:"4_group",command:{id:"workbench.action.nextEditorInGroup",title:d(3981,null)},order:1});ve.appendMenuItem(D.MenubarSwitchEditorMenu,{group:"4_group",command:{id:"workbench.action.previousEditorInGroup",title:d(3986,null)},order:2});ve.appendMenuItem(D.MenubarSwitchEditorMenu,{group:"5_group_used",command:{id:"workbench.action.openNextRecentlyUsedEditorInGroup",title:d(3984,null)},order:1});ve.appendMenuItem(D.MenubarSwitchEditorMenu,{group:"5_group_used",command:{id:"workbench.action.openPreviousRecentlyUsedEditorInGroup",title:d(3989,null)},order:2});ve.appendMenuItem(D.MenubarGoMenu,{group:"2_editor_nav",title:d(4005,null),submenu:D.MenubarSwitchEditorMenu,order:1});ve.appendMenuItem(D.MenubarSwitchGroupMenu,{group:"1_focus_index",command:{id:"workbench.action.focusFirstEditorGroup",title:d(3970,null)},order:1});ve.appendMenuItem(D.MenubarSwitchGroupMenu,{group:"1_focus_index",command:{id:"workbench.action.focusSecondEditorGroup",title:d(3974,null)},order:2});ve.appendMenuItem(D.MenubarSwitchGroupMenu,{group:"1_focus_index",command:{id:"workbench.action.focusThirdEditorGroup",title:d(3975,null),precondition:SS},order:3});ve.appendMenuItem(D.MenubarSwitchGroupMenu,{group:"1_focus_index",command:{id:"workbench.action.focusFourthEditorGroup",title:d(3971,null),precondition:SS},order:4});ve.appendMenuItem(D.MenubarSwitchGroupMenu,{group:"1_focus_index",command:{id:"workbench.action.focusFifthEditorGroup",title:d(3969,null),precondition:SS},order:5});ve.appendMenuItem(D.MenubarSwitchGroupMenu,{group:"2_next_prev",command:{id:"workbench.action.focusNextGroup",title:d(3982,null),precondition:SS},order:1});ve.appendMenuItem(D.MenubarSwitchGroupMenu,{group:"2_next_prev",command:{id:"workbench.action.focusPreviousGroup",title:d(3987,null),precondition:SS},order:2});ve.appendMenuItem(D.MenubarSwitchGroupMenu,{group:"3_directional",command:{id:"workbench.action.focusLeftGroup",title:d(3972,null),precondition:SS},order:1});ve.appendMenuItem(D.MenubarSwitchGroupMenu,{group:"3_directional",command:{id:"workbench.action.focusRightGroup",title:d(3973,null),precondition:SS},order:2});ve.appendMenuItem(D.MenubarSwitchGroupMenu,{group:"3_directional",command:{id:"workbench.action.focusAboveGroup",title:d(3967,null),precondition:SS},order:3});ve.appendMenuItem(D.MenubarSwitchGroupMenu,{group:"3_directional",command:{id:"workbench.action.focusBelowGroup",title:d(3968,null),precondition:SS},order:4});ve.appendMenuItem(D.MenubarGoMenu,{group:"2_editor_nav",title:d(4006,null),submenu:D.MenubarSwitchGroupMenu,order:2});c9i(hSt);var RT=class extends I4{constructor(e,t,o,n,r){super(e,o,n);this.options=t;this.layoutService=r;this._onDidVisibilityChange=this._register(new E);this.onDidVisibilityChange=this._onDidVisibilityChange.event;this._onDidChange=this._register(new E);this._register(r.registerPart(this))}get dimension(){return this._dimension}get contentPosition(){return this._contentPosition}onThemeChange(e){this.parent&&super.onThemeChange(e)}create(e,t){this.parent=e,this.titleArea=this.createTitleArea(e,t),this.contentArea=this.createContentArea(e,t),this.partLayout=new Nwi(this.options,this.contentArea),this.updateStyles()}getContainer(){return this.parent}createTitleArea(e,t){}createContentArea(e,t){}setHeaderArea(e){if(this.headerArea)throw new Error("Header already exists");!this.parent||!this.titleArea||(KS(this.parent,e),e.classList.add("header-or-footer"),e.classList.add("header"),this.headerArea=e,this.partLayout?.setHeaderVisibility(!0),this.relayout())}setFooterArea(e){if(this.footerArea)throw new Error("Footer already exists");!this.parent||!this.titleArea||(this.parent.appendChild(e),e.classList.add("header-or-footer"),e.classList.add("footer"),this.footerArea=e,this.partLayout?.setFooterVisibility(!0),this.relayout())}removeHeaderArea(){this.headerArea&&(this.headerArea.remove(),this.headerArea=void 0,this.partLayout?.setHeaderVisibility(!1),this.relayout())}removeFooterArea(){this.footerArea&&(this.footerArea.remove(),this.footerArea=void 0,this.partLayout?.setFooterVisibility(!1),this.relayout())}relayout(){this.dimension&&this.contentPosition&&this.layout(this.dimension.width,this.dimension.height,this.contentPosition.top,this.contentPosition.left)}layoutContents(e,t){return Ci(this.partLayout).layout(e,t)}get onDidChange(){return this._onDidChange.event}layout(e,t,o,n){this._dimension=new si(e,t),this._contentPosition={top:o,left:n}}setVisible(e){this._onDidVisibilityChange.fire(e)}},Nwi=class a{constructor(i,e){this.options=i;this.contentArea=e;this.headerVisible=!1;this.footerVisible=!1}static{this.HEADER_HEIGHT=35}static{this.TITLE_HEIGHT=35}static{this.Footer_HEIGHT=35}layout(i,e){let t;this.options.hasTitle?t=new si(i,Math.min(e,a.TITLE_HEIGHT)):t=si.None;let o;this.headerVisible?o=new si(i,Math.min(e,a.HEADER_HEIGHT)):o=si.None;let n;this.footerVisible?n=new si(i,Math.min(e,a.Footer_HEIGHT)):n=si.None;let r=i;this.options&&typeof this.options.borderWidth=="function"&&(r-=this.options.borderWidth());let s=new si(r,e-t.height-o.height-n.height);return this.contentArea&&VL(this.contentArea,s.width,s.height),{headerSize:o,titleSize:t,contentSize:s,footerSize:n}}setFooterVisibility(i){this.footerVisible=i}setHeaderVisibility(i){this.headerVisible=i}},nee=class extends I4{constructor(){super(...arguments);this._parts=new Set}get parts(){return Array.from(this._parts)}registerPart(e){return this._parts.add(e),Z(()=>this.unregisterPart(e))}unregisterPart(e){this._parts.delete(e)}getPart(e){return this.getPartByDocument(e.ownerDocument)}getPartByDocument(e){if(this._parts.size>1){for(let t of this._parts)if(t.element?.ownerDocument===e)return t}return this.mainPart}get activePart(){return this.getPartByDocument(sm())}};var tRe=class extends x{constructor(e,t,o,n,r,s,l,c,u,p){super();this.editorGroupParent=e;this.editorPanesParent=t;this.groupView=o;this.layoutService=n;this.instantiationService=r;this.workspaceTrustService=l;this.logService=c;this.dialogService=u;this.hostService=p;this._onDidFocus=this._register(new E);this.onDidFocus=this._onDidFocus.event;this._onDidChangeSizeConstraints=this._register(new E);this.onDidChangeSizeConstraints=this._onDidChangeSizeConstraints.event;this._activeEditorPane=null;this.editorPanes=[];this.mapEditorPaneToPendingSetInput=new Map;this.activeEditorPaneDisposables=this._register(new N);this.editorPanesRegistry=ne.as(qo.EditorPane);this.editorOperation=this._register(new gCe(s)),this.registerListeners()}get minimumWidth(){return this._activeEditorPane?.minimumWidth??hT.width}get minimumHeight(){return this._activeEditorPane?.minimumHeight??hT.height}get maximumWidth(){return this._activeEditorPane?.maximumWidth??y4.width}get maximumHeight(){return this._activeEditorPane?.maximumHeight??y4.height}get activeEditorPane(){return this._activeEditorPane}registerListeners(){this._register(this.workspaceTrustService.onDidChangeTrust(()=>this.onDidChangeWorkspaceTrust()))}onDidChangeWorkspaceTrust(){let e=this._activeEditorPane?.input,t=this._activeEditorPane?.options;e?.hasCapability(16)&&this.groupView.openEditor(e,t)}async openEditor(e,t,o,n=Object.create(null)){try{return await this.doOpenEditor(this.getEditorPaneDescriptor(e),e,t,o,n)}catch(r){return t?.ignoreError?{error:r}:this.doShowError(r,e,t,o,n)}}async doShowError(e,t,o,n,r){this.logService.error(e);let s=!1;if(o?.source===1&&(!e4(e)||e.allowDialog)&&(s=await this.doShowErrorDialog(e,t)),s)return{error:e};let l={...o};return ao(e)||(l.error=e),{...await this.doOpenEditor(ZZ.DESCRIPTOR,t,l,n,r),error:e}}async doShowErrorDialog(e,t){let o=bt.Error,n,r=xn(e),s;e4(e)&&(s=e.actions,o=e.forceSeverity??bt.Error,e.forceMessage&&(n=e.message,r=void 0)),n||(n=d(4250,null,t.getName()));let l=[];if(s&&s.length>0)for(let h of s)l.push({label:h.label,run:()=>h});else l.push({label:d(4251,null),run:()=>{}});let c;l.length===1&&(c={run:()=>{u=!0}});let u=!1,{result:p}=await this.dialogService.prompt({type:o,message:n,detail:r,buttons:l,cancelButton:c});if(p){let h=p.run();h instanceof Promise&&h.catch(g=>this.dialogService.error(xn(g))),u=!0}return u}async doOpenEditor(e,t,o,n,r=Object.create(null)){let s=this.doShowEditorPane(e),l=Nn(),{changed:c,cancelled:u}=await this.doSetInput(s,t,o,r);return u||(!o?.preserveFocus&&this.shouldRestoreFocus(l)?s.focus():n?.preserveWindowOrder||this.hostService.moveTop(rb(this.groupView.windowId,!0).window)),{pane:s,changed:c,cancelled:u}}shouldRestoreFocus(e){if(!this.layoutService.isRestored()||!e)return!0;let t=Nn();return!!(!t||t===e.ownerDocument.body||e===t||!Kh(t)||ts(t,this.editorGroupParent))}getEditorPaneDescriptor(e){return e.hasCapability(16)&&!this.workspaceTrustService.isWorkspaceTrusted()?M3.DESCRIPTOR:Ci(this.editorPanesRegistry.getEditorPane(e))}doShowEditorPane(e){if(this._activeEditorPane&&e.describes(this._activeEditorPane))return this._activeEditorPane;this.doHideActiveEditorPane();let t=this.doCreateEditorPane(e);this.doSetActiveEditorPane(t);let o=Ci(t.getContainer());return this.editorPanesParent.appendChild(o),un(o),t.setVisible(!0),this.pagePosition&&t.layout(new si(this.pagePosition.width,this.pagePosition.height),{top:this.pagePosition.top,left:this.pagePosition.left}),this.boundarySashes&&t.setBoundarySashes(this.boundarySashes),t}doCreateEditorPane(e){let t=this.doInstantiateEditorPane(e);if(!t.getContainer()){let o=_(".editor-instance");this.editorPanesParent.appendChild(o);try{t.create(o)}catch(n){throw o.remove(),vo(o),n}}return t}doInstantiateEditorPane(e){let t=this.editorPanes.find(n=>e.describes(n));if(t)return t;let o=this._register(e.instantiate(this.instantiationService,this.groupView));return this.editorPanes.push(o),o}doSetActiveEditorPane(e){this._activeEditorPane=e,this.activeEditorPaneDisposables.clear(),e&&(this.activeEditorPaneDisposables.add(e.onDidChangeSizeConstraints(t=>this._onDidChangeSizeConstraints.fire(t))),this.activeEditorPaneDisposables.add(e.onDidFocus(()=>this._onDidFocus.fire()))),this._onDidChangeSizeConstraints.fire(void 0)}async doSetInput(e,t,o,n){let r=e.input?.matches(t);if(r&&!o?.forceReload)return this.mapEditorPaneToPendingSetInput.has(e)&&await this.mapEditorPaneToPendingSetInput.get(e),r=e.input?.matches(t),r&&e.setOptions(o),{changed:!1,cancelled:!r};let s=this.editorOperation.start(this.layoutService.isRestored()?800:3200),l=!1;try{e.clearInput();let c=e.setInput(t,o,n,s.token);this.mapEditorPaneToPendingSetInput.set(e,c),await c,s.isCurrent()||(l=!0)}catch(c){if(!s.isCurrent())l=!0;else throw c}finally{s.isCurrent()&&this.mapEditorPaneToPendingSetInput.delete(e),s.stop()}return{changed:!r,cancelled:l}}doHideActiveEditorPane(){if(!this._activeEditorPane)return;this.editorOperation.stop(),this.safeRun(()=>this._activeEditorPane?.clearInput()),this.safeRun(()=>this._activeEditorPane?.setVisible(!1)),this.mapEditorPaneToPendingSetInput.delete(this._activeEditorPane);let e=this._activeEditorPane.getContainer();e&&(e.remove(),vo(e)),this.doSetActiveEditorPane(null)}closeEditor(e){this._activeEditorPane?.input&&e.matches(this._activeEditorPane.input)&&this.doHideActiveEditorPane()}setVisible(e){this.safeRun(()=>this._activeEditorPane?.setVisible(e))}layout(e){this.pagePosition=e,this.safeRun(()=>this._activeEditorPane?.layout(new si(e.width,e.height),e))}setBoundarySashes(e){this.boundarySashes=e,this.safeRun(()=>this._activeEditorPane?.setBoundarySashes(e))}safeRun(e){try{e()}catch(t){this.logService.error(t)}}};tRe=I([m(3,yi),m(4,F),m(5,wd),m(6,Nr),m(7,se),m(8,at),m(9,Zt)],tRe);var Aco=C.and(C.equals("chatSetupHidden",!1),C.equals("chatSetupDisabled",!1)),B6o={text:d(4240,null),id:"workbench.action.chat.open",when:{native:Aco,web:Aco}},H6o={text:d(4247,null),id:"workbench.action.showCommands"},U6o={text:d(4246,null),id:"workbench.action.quickOpen"},z6o={text:d(4241,null),id:"workbench.action.files.openFile"},K6o={text:d(4243,null),id:"workbench.action.files.openFolder"},G6o={text:d(4242,null),id:"workbench.action.files.openFileFolder"},q6o={text:d(4244,null),id:"workbench.action.openRecent"},$6o={text:d(4239,null),id:"workbench.action.files.newUntitledFile"},j6o={text:d(4238,null),id:"workbench.action.findInFiles"},Q6o={text:d(4249,null),id:"workbench.action.terminal.toggleTerminal",when:{web:C.equals("terminalProcessSupported",!0)}},Y6o={text:d(4248,null),id:"workbench.action.debug.start",when:{web:C.equals("terminalProcessSupported",!0)}},X6o={text:d(4245,null),id:"workbench.action.openSettings"},Wco=[B6o,H6o],Nco=di([...Wco,q6o,...Ze&&!Wt?[G6o]:[z6o,K6o],Ze&&!Wt?$6o:void 0]),Oco=[...Wco],Fco=[U6o,j6o,Y6o,Q6o,X6o],lM=class extends x{constructor(e,t,o,n,r,s){super();this.keybindingService=t;this.contextService=o;this.contextKeyService=n;this.configurationService=r;this.storageService=s;this.transientDisposables=this._register(new N);this.keybindingLabels=this._register(new N);this.enabled=!1;this.cachedWhen=this.storageService.getObject(lM.CACHED_WHEN,0,Object.create(null)),this.workbenchState=this.contextService.getWorkbenchState();let l=ct(".editor-group-watermark",[ct(".watermark-container",[ct(".letterpress"),ct(".shortcuts@shortcuts")])]);M(e,l.root),this.shortcuts=l.shortcuts,this.registerListeners(),this.render()}static{this.CACHED_WHEN="editorGroupWatermark.whenConditions"}static{this.SETTINGS_KEY="workbench.tips.enabled"}static{this.MINIMUM_ENTRIES=3}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration(lM.SETTINGS_KEY)&&this.enabled!==this.configurationService.getValue(lM.SETTINGS_KEY)&&this.render()})),this._register(this.contextService.onDidChangeWorkbenchState(e=>{this.workbenchState!==e&&(this.workbenchState=e,this.render())})),this._register(this.storageService.onWillSaveState(e=>{if(e.reason===1){let t=[...Nco,...Oco,...Fco];for(let o of t){let n=Wt?o.when?.web:o.when?.native;n&&(this.cachedWhen[o.id]=this.contextKeyService.contextMatchesRules(n))}this.storageService.store(lM.CACHED_WHEN,JSON.stringify(this.cachedWhen),0,1)}}))}render(){if(this.enabled=this.configurationService.getValue(lM.SETTINGS_KEY),Rt(this.shortcuts),this.transientDisposables.clear(),!this.enabled)return;let e=this.filterEntries(this.workbenchState!==1?Oco:Nco);if(e.length<lM.MINIMUM_ENTRIES){let n=this.filterEntries(Fco);R9(n),e.push(...n.slice(0,lM.MINIMUM_ENTRIES-e.length))}let t=M(this.shortcuts,_(".watermark-box")),o=()=>{Rt(t),this.keybindingLabels.clear();for(let n of e){let r=this.keybindingService.lookupKeybinding(n.id);if(!r)continue;let s=M(t,_("dl")),l=M(s,_("dt"));l.textContent=n.text;let c=M(s,_("dd"));this.keybindingLabels.add(new Am(c,Po,{renderUnboundKeybindings:!0,...Jx})).set(r)}};o(),this.transientDisposables.add(this.keybindingService.onDidUpdateKeybindings(o))}filterEntries(e){return e.filter(o=>{if(this.cachedWhen[o.id])return!0;let n=Wt?o.when?.web:o.when?.native;return!n||this.contextKeyService.contextMatchesRules(n)}).filter(o=>!!$e.getCommand(o.id)).filter(o=>!!this.keybindingService.lookupKeybinding(o.id))}};lM=I([m(1,_e),m(2,Pe),m(3,X),m(4,B),m(5,ce)],lM);var ree=class{},K2=class{constructor(i,e,t=1,o,n){this._disposables=new N;this._onDidSelectItem=new E;this._onDidFocusItem=new E;this._onDidChangeFocus=new E;this.onDidSelectItem=this._onDidSelectItem.event;this.onDidFocusItem=this._onDidFocusItem.event;this.onDidChangeFocus=this._onDidChangeFocus.event;this._items=new Array;this._nodes=new Array;this._freeNodes=new Array;this._enabled=!0;this._focusedItemIdx=-1;this._selectedItemIdx=-1;this._domNode=document.createElement("div"),this._domNode.className="monaco-breadcrumbs",this._domNode.tabIndex=0,this._domNode.setAttribute("role","list"),this._scrollable=new ms(this._domNode,{vertical:2,horizontal:t,horizontalScrollbarSize:e,useShadows:!1,scrollYToX:!0}),this._separatorIcon=o,this._disposables.add(this._scrollable),this._disposables.add(Jo(this._domNode,"click",l=>this._onClick(l))),i.appendChild(this._scrollable.getDomNode());let r=Cr(this._domNode);this._style(r,n);let s=qn(this._domNode);this._disposables.add(s),this._disposables.add(s.onDidBlur(l=>this._onDidChangeFocus.fire(!1))),this._disposables.add(s.onDidFocus(l=>this._onDidChangeFocus.fire(!0)))}setHorizontalScrollbarSize(i){this._scrollable.updateOptions({horizontalScrollbarSize:i})}setHorizontalScrollbarVisibility(i){this._scrollable.updateOptions({horizontal:i})}dispose(){this._disposables.dispose(),this._pendingLayout?.dispose(),this._pendingDimLayout?.dispose(),this._onDidSelectItem.dispose(),this._onDidFocusItem.dispose(),this._onDidChangeFocus.dispose(),this._domNode.remove(),this._nodes.length=0,this._freeNodes.length=0}layout(i){i&&si.equals(i,this._dimension)||(i?(this._pendingDimLayout?.dispose(),this._pendingDimLayout=this._updateDimensions(i)):(this._pendingLayout?.dispose(),this._pendingLayout=this._updateScrollbar()))}_updateDimensions(i){let e=new N;return e.add(Q9(Re(this._domNode),()=>{this._dimension=i,this._domNode.style.width=`${i.width}px`,this._domNode.style.height=`${i.height}px`,e.add(this._updateScrollbar())})),e}_updateScrollbar(){return UJt(Re(this._domNode),()=>{UJt(Re(this._domNode),()=>{this._scrollable.setRevealOnScroll(!1),this._scrollable.scanDomNode(),this._scrollable.setRevealOnScroll(!0)})})}_style(i,e){let t="";e.breadcrumbsBackground&&(t+=`.monaco-breadcrumbs { background-color: ${e.breadcrumbsBackground}}`),e.breadcrumbsForeground&&(t+=`.monaco-breadcrumbs .monaco-breadcrumb-item { color: ${e.breadcrumbsForeground}}
`),e.breadcrumbsFocusForeground&&(t+=`.monaco-breadcrumbs .monaco-breadcrumb-item.focused { color: ${e.breadcrumbsFocusForeground}}
`),e.breadcrumbsFocusAndSelectionForeground&&(t+=`.monaco-breadcrumbs .monaco-breadcrumb-item.focused.selected { color: ${e.breadcrumbsFocusAndSelectionForeground}}
`),e.breadcrumbsHoverForeground&&(t+=`.monaco-breadcrumbs:not(.disabled	) .monaco-breadcrumb-item:hover:not(.focused):not(.selected) { color: ${e.breadcrumbsHoverForeground}}
`),i.textContent=t}setEnabled(i){this._enabled=i,this._domNode.classList.toggle("disabled",!this._enabled)}domFocus(){let i=this._focusedItemIdx>=0?this._focusedItemIdx:this._items.length-1;i>=0&&i<this._items.length?this._focus(i,void 0):this._domNode.focus()}isDOMFocused(){return Gr(this._domNode)}getFocused(){return this._items[this._focusedItemIdx]}setFocused(i,e){this._focus(this._items.indexOf(i),e)}focusPrev(i){this._focusedItemIdx>0&&this._focus(this._focusedItemIdx-1,i)}focusNext(i){this._focusedItemIdx+1<this._nodes.length&&this._focus(this._focusedItemIdx+1,i)}_focus(i,e){this._focusedItemIdx=-1;for(let t=0;t<this._nodes.length;t++){let o=this._nodes[t];t!==i?o.classList.remove("focused"):(this._focusedItemIdx=t,o.classList.add("focused"),o.focus())}this._reveal(this._focusedItemIdx,!0),this._onDidFocusItem.fire({type:"focus",item:this._items[this._focusedItemIdx],node:this._nodes[this._focusedItemIdx],payload:e})}reveal(i){let e=this._items.indexOf(i);e>=0&&this._reveal(e,!1)}revealLast(){this._reveal(this._items.length-1,!1)}_reveal(i,e){if(i<0||i>=this._nodes.length)return;let t=this._nodes[i];if(!t)return;let{width:o}=this._scrollable.getScrollDimensions(),{scrollLeft:n}=this._scrollable.getScrollPosition();(!e||t.offsetLeft>n+o||t.offsetLeft<n)&&(this._scrollable.setRevealOnScroll(!1),this._scrollable.setScrollPosition({scrollLeft:t.offsetLeft}),this._scrollable.setRevealOnScroll(!0))}getSelection(){return this._items[this._selectedItemIdx]}setSelection(i,e){this._select(this._items.indexOf(i),e)}_select(i,e){this._selectedItemIdx=-1;for(let t=0;t<this._nodes.length;t++){let o=this._nodes[t];t!==i?o.classList.remove("selected"):(this._selectedItemIdx=t,o.classList.add("selected"))}this._onDidSelectItem.fire({type:"select",item:this._items[this._selectedItemIdx],node:this._nodes[this._selectedItemIdx],payload:e})}getItems(){return this._items}setItems(i){let e,t=[];try{e=_2i(this._items,i,(o,n)=>o.equals(n)),t=this._items.splice(e,this._items.length-e,...i.slice(e)),this._render(e),Be(t),Be(i.slice(0,e)),this._focus(-1,void 0)}catch(o){let n=new Error(`BreadcrumbsItem#setItems: newItems: ${i.length}, prefix: ${e}, removed: ${t.length}`);throw n.name=o.name,n.stack=o.stack,n}}_render(i){let e=!1;for(;i<this._items.length&&i<this._nodes.length;i++){let t=this._items[i],o=this._nodes[i];this._renderItem(t,o),e=!0}for(;i<this._nodes.length;){let t=this._nodes.pop();t&&(this._freeNodes.push(t),t.remove(),e=!0)}for(;i<this._items.length;i++){let t=this._items[i],o=this._freeNodes.length>0?this._freeNodes.pop():document.createElement("div");o&&(this._renderItem(t,o),this._domNode.appendChild(o),this._nodes.push(o),e=!0)}e&&this.layout(void 0)}_renderItem(i,e){Rt(e),e.className="";try{i.render(e)}catch(o){e.textContent="<<RENDER ERROR>>",console.error(o)}e.tabIndex=-1,e.setAttribute("role","listitem"),e.classList.add("monaco-breadcrumb-item");let t=_(q.asCSSSelector(this._separatorIcon));e.appendChild(t)}_onClick(i){if(this._enabled)for(let e=i.target;e;e=e.parentElement){let t=this._nodes.indexOf(e);if(t>=0){this._focus(t,i),this._select(t,i);break}}}};var cM=le("IOutlineService");var fH=le("IEditorBreadcrumbsService"),Owi=class{constructor(){this._map=new Map}register(i,e){if(this._map.has(i))throw new Error(`group (${i}) has already a widget`);return this._map.set(i,e),{dispose:()=>this._map.delete(i)}}getWidget(i){return this._map.get(i)}};Ee(fH,Owi,1);var MT=class a{constructor(){}static{this.IsEnabled=a._stub("breadcrumbs.enabled")}static{this.UseQuickPick=a._stub("breadcrumbs.useQuickPick")}static{this.FilePath=a._stub("breadcrumbs.filePath")}static{this.SymbolPath=a._stub("breadcrumbs.symbolPath")}static{this.SymbolSortOrder=a._stub("breadcrumbs.symbolSortOrder")}static{this.SymbolPathSeparator=a._stub("breadcrumbs.symbolPathSeparator")}static{this.Icons=a._stub("breadcrumbs.icons")}static{this.TitleScrollbarSizing=a._stub("workbench.editor.titleScrollbarSizing")}static{this.TitleScrollbarVisibility=a._stub("workbench.editor.titleScrollbarVisibility")}static{this.FileExcludes=a._stub("files.exclude")}static _stub(i){return{bindTo(e){let t=new E,o=e.onDidChangeConfiguration(n=>{n.affectsConfiguration(i)&&t.fire(void 0)});return new class{constructor(){this.name=i;this.onDidChange=t.event}getValue(n){return n?e.getValue(i,n):e.getValue(i)}updateValue(n,r){return r?e.updateValue(i,n,r):e.updateValue(i,n)}dispose(){o.dispose(),t.dispose()}}}}}};ne.as(Jt.Configuration).registerConfiguration({id:"breadcrumbs",title:d(3908,null),order:101,type:"object",properties:{"breadcrumbs.enabled":{description:d(3867,null),type:"boolean",default:!0},"breadcrumbs.filePath":{description:d(3868,null),type:"string",default:"on",enum:["on","off","last"],enumDescriptions:[d(3871,null),d(3870,null),d(3869,null)]},"breadcrumbs.symbolPath":{description:d(3899,null),type:"string",default:"on",enum:["on","off","last"],enumDescriptions:[d(3902,null),d(3901,null),d(3900,null)]},"breadcrumbs.symbolSortOrder":{description:d(3904,null),type:"string",default:"position",scope:6,enum:["position","name","type"],enumDescriptions:[d(3906,null),d(3905,null),d(3907,null)]},"breadcrumbs.icons":{description:d(3898,null),type:"boolean",default:!0},"breadcrumbs.symbolPathSeparator":{description:d(3903,null),type:"string",default:".",scope:6},"breadcrumbs.showFiles":{type:"boolean",default:!0,scope:6,markdownDescription:d(3881,null)},"breadcrumbs.showModules":{type:"boolean",default:!0,scope:6,markdownDescription:d(3886,null)},"breadcrumbs.showNamespaces":{type:"boolean",default:!0,scope:6,markdownDescription:d(3887,null)},"breadcrumbs.showPackages":{type:"boolean",default:!0,scope:6,markdownDescription:d(3892,null)},"breadcrumbs.showClasses":{type:"boolean",default:!0,scope:6,markdownDescription:d(3874,null)},"breadcrumbs.showMethods":{type:"boolean",default:!0,scope:6,markdownDescription:d(3885,null)},"breadcrumbs.showProperties":{type:"boolean",default:!0,scope:6,markdownDescription:d(3893,null)},"breadcrumbs.showFields":{type:"boolean",default:!0,scope:6,markdownDescription:d(3880,null)},"breadcrumbs.showConstructors":{type:"boolean",default:!0,scope:6,markdownDescription:d(3876,null)},"breadcrumbs.showEnums":{type:"boolean",default:!0,scope:6,markdownDescription:d(3877,null)},"breadcrumbs.showInterfaces":{type:"boolean",default:!0,scope:6,markdownDescription:d(3883,null)},"breadcrumbs.showFunctions":{type:"boolean",default:!0,scope:6,markdownDescription:d(3882,null)},"breadcrumbs.showVariables":{type:"boolean",default:!0,scope:6,markdownDescription:d(3897,null)},"breadcrumbs.showConstants":{type:"boolean",default:!0,scope:6,markdownDescription:d(3875,null)},"breadcrumbs.showStrings":{type:"boolean",default:!0,scope:6,markdownDescription:d(3894,null)},"breadcrumbs.showNumbers":{type:"boolean",default:!0,scope:6,markdownDescription:d(3889,null)},"breadcrumbs.showBooleans":{type:"boolean",default:!0,scope:6,markdownDescription:d(3873,null)},"breadcrumbs.showArrays":{type:"boolean",default:!0,scope:6,markdownDescription:d(3872,null)},"breadcrumbs.showObjects":{type:"boolean",default:!0,scope:6,markdownDescription:d(3890,null)},"breadcrumbs.showKeys":{type:"boolean",default:!0,scope:6,markdownDescription:d(3884,null)},"breadcrumbs.showNull":{type:"boolean",default:!0,scope:6,markdownDescription:d(3888,null)},"breadcrumbs.showEnumMembers":{type:"boolean",default:!0,scope:6,markdownDescription:d(3878,null)},"breadcrumbs.showStructs":{type:"boolean",default:!0,scope:6,markdownDescription:d(3895,null)},"breadcrumbs.showEvents":{type:"boolean",default:!0,scope:6,markdownDescription:d(3879,null)},"breadcrumbs.showOperators":{type:"boolean",default:!0,scope:6,markdownDescription:d(3891,null)},"breadcrumbs.showTypeParameters":{type:"boolean",default:!0,scope:6,markdownDescription:d(3896,null)}}});var $pe=class{constructor(i,e){this.uri=i;this.kind=e}},oRe=class{constructor(i,e){this.element=i;this.outline=e}},iRe=class{constructor(i,e,t,o,n){this.resource=i;this.editor=e;this._workspaceService=o;this._outlineService=n;this._disposables=new N;this._currentOutline=new me;this._outlineDisposables=new N;this._onDidUpdate=new E;this.onDidUpdate=this._onDidUpdate.event;this._cfgFilePath=MT.FilePath.bindTo(t),this._cfgSymbolPath=MT.SymbolPath.bindTo(t),this._disposables.add(this._cfgFilePath.onDidChange(r=>this._onDidUpdate.fire(this))),this._disposables.add(this._cfgSymbolPath.onDidChange(r=>this._onDidUpdate.fire(this))),this._workspaceService.onDidChangeWorkspaceFolders(this._onDidChangeWorkspaceFolders,this,this._disposables),this._fileInfo=this._initFilePathInfo(i),e&&(this._bindToEditor(e),this._disposables.add(n.onDidChange(()=>this._bindToEditor(e))),this._disposables.add(e.onDidChangeControl(()=>this._bindToEditor(e)))),this._onDidUpdate.fire(this)}dispose(){this._disposables.dispose(),this._cfgFilePath.dispose(),this._cfgSymbolPath.dispose(),this._currentOutline.dispose(),this._outlineDisposables.dispose(),this._onDidUpdate.dispose()}isRelative(){return!!this._fileInfo.folder}getElements(){let i=[];if(this._cfgFilePath.getValue()==="on"?i=i.concat(this._fileInfo.path):this._cfgFilePath.getValue()==="last"&&this._fileInfo.path.length>0&&(i=i.concat(this._fileInfo.path.slice(-1))),this._cfgSymbolPath.getValue()==="off"||!this._currentOutline.value)return i;let e=this._currentOutline.value.config.breadcrumbsDataSource.getBreadcrumbElements();for(let t=this._cfgSymbolPath.getValue()==="last"&&e.length>0?e.length-1:0;t<e.length;t++)i.push(new oRe(e[t].element,this._currentOutline.value));return e.length===0&&!this._currentOutline.value.isEmpty&&i.push(new oRe(this._currentOutline.value,this._currentOutline.value)),i}_initFilePathInfo(i){if(mV(i,Q.untitled,Q.data))return{folder:void 0,path:[]};let e={folder:this._workspaceService.getWorkspaceFolder(i)??void 0,path:[]},t=i;for(;t&&t.path!=="/"&&!(e.folder&&Qe(e.folder.uri,t));){e.path.unshift(new $pe(t,e.path.length===0?0:1));let o=t.path.length;if(t=ci(t),t.path.length===o)break}return e.folder&&this._workspaceService.getWorkbenchState()===3&&e.path.unshift(new $pe(e.folder.uri,2)),e}_onDidChangeWorkspaceFolders(){this._fileInfo=this._initFilePathInfo(this.resource),this._onDidUpdate.fire(this)}_bindToEditor(i){let e=new Ye;this._currentOutline.clear(),this._outlineDisposables.clear(),this._outlineDisposables.add(Z(()=>e.dispose(!0))),this._outlineService.createOutline(i,2,e.token).then(t=>{e.token.isCancellationRequested&&(t?.dispose(),t=void 0),this._currentOutline.value=t,this._onDidUpdate.fire(this),t&&this._outlineDisposables.add(t.onDidChange(()=>this._onDidUpdate.fire(this)))}).catch(t=>{this._onDidUpdate.fire(this),mt(t)})}};iRe=I([m(2,B),m(3,Pe),m(4,cM)],iRe);var rRe=class{constructor(i,e,t,o,n){this.resource=e;this._instantiationService=t;this._themeService=o;this._configurationService=n;this._disposables=new N;this._fakeEvent=new UIEvent("fakeEvent");this._onWillPickElement=new E;this.onWillPickElement=this._onWillPickElement.event;this._previewDispoables=new me;this._domNode=document.createElement("div"),this._domNode.className="monaco-breadcrumbs-picker show-file-icons",i.appendChild(this._domNode)}dispose(){this._disposables.dispose(),this._previewDispoables.dispose(),this._onWillPickElement.dispose(),this._domNode.remove(),setTimeout(()=>this._tree.dispose(),0)}async show(i,e,t,o,n){let s=this._themeService.getColorTheme().getColor(Eti);this._arrow=document.createElement("div"),this._arrow.className="arrow",this._arrow.style.borderColor=`transparent transparent ${s?s.toString():""}`,this._domNode.appendChild(this._arrow),this._treeContainer=document.createElement("div"),this._treeContainer.style.background=s?s.toString():"",this._treeContainer.style.paddingTop="2px",this._treeContainer.style.borderRadius="3px",this._treeContainer.style.boxShadow="var(--vscode-shadow-lg)",this._treeContainer.style.border=`1px solid ${this._themeService.getColorTheme().getColor(E_)}`,this._domNode.appendChild(this._treeContainer),this._layoutInfo={maxHeight:e,width:t,arrowSize:o,arrowOffset:n,inputHeight:0},this._tree=this._createTree(this._treeContainer,i),this._disposables.add(this._tree.onDidOpen(async l=>{let{element:c,editorOptions:u,sideBySide:p}=l;await this._revealElement(c,{...u,preserveFocus:!1},p)})),this._disposables.add(this._tree.onDidChangeFocus(l=>{this._previewDispoables.value=this._previewElement(l.elements[0])})),this._disposables.add(this._tree.onDidChangeContentHeight(()=>{this._layout()})),this._domNode.focus();try{await this._setInput(i),this._layout()}catch(l){mt(l)}}_layout(){let i=2*this._layoutInfo.arrowSize,e=Math.min(this._layoutInfo.maxHeight-i,this._tree.contentHeight),t=e+i;this._domNode.style.height=`${t}px`,this._domNode.style.width=`${this._layoutInfo.width}px`,this._arrow.style.top=`-${2*this._layoutInfo.arrowSize}px`,this._arrow.style.borderWidth=`${this._layoutInfo.arrowSize}px`,this._arrow.style.marginLeft=`${this._layoutInfo.arrowOffset}px`,this._treeContainer.style.height=`${e}px`,this._treeContainer.style.width=`${this._layoutInfo.width}px`,this._tree.layout(e,this._layoutInfo.width)}restoreViewState(){}};rRe=I([m(2,F),m(3,Le),m(4,B)],rRe);var Fwi=class{getHeight(i){return 22}getTemplateId(i){return"FileStat"}},Wwi=class{getId(i){return A.isUri(i)?i.toString():Xj(i)?i.id:hw(i)?i.uri.toString():i.resource.toString()}},WJe=class{constructor(i){this._fileService=i}hasChildren(i){return A.isUri(i)||Xj(i)||hw(i)||i.isDirectory}async getChildren(i){if(Xj(i))return i.folders;let e;return hw(i)?e=i.uri:A.isUri(i)?e=i:e=i.resource,(await this._fileService.resolve(e)).children??[]}};WJe=I([m(0,fe)],WJe);var VJe=class{constructor(i,e){this._labels=i;this._configService=e;this.templateId="FileStat"}renderTemplate(i){return this._labels.create(i,{supportHighlights:!0})}renderElement(i,e,t){let o=this._configService.getValue("explorer.decorations"),{element:n}=i,r,s;hw(n)?(r=n.uri,s=2):(r=n.resource,s=n.isDirectory?1:0),t.setFile(r,{fileKind:s,hidePath:!0,fileDecorations:o,matches:xa(i.filterData),extraClasses:["picker-item"]})}disposeTemplate(i){i.dispose()}};VJe=I([m(1,B)],VJe);var Vwi=class{getKeyboardNavigationLabel(i){return i.name}},Bwi=class{getWidgetAriaLabel(){return d(3921,null)}getAriaLabel(i){return i.name}},BJe=class{constructor(i,e,t){this._workspaceService=i;this._cachedExpressions=new Map;this._disposables=new N;let o=MT.FileExcludes.bindTo(e),n=()=>{i.getWorkspace().folders.forEach(r=>{let s=o.getValue({resource:r.uri});if(!s)return;let l={};for(let u in s){if(typeof s[u]!="boolean")continue;let p=u.indexOf("**/")!==0?Oo.join(r.uri.path,u):u;l[p]=s[u]}let c=!t.hasCapability(r.uri,1024);this._cachedExpressions.set(r.uri.toString(),Ym(l,{ignoreCase:c}))})};n(),this._disposables.add(o),this._disposables.add(o.onDidChange(n)),this._disposables.add(i.onDidChangeWorkspaceFolders(n))}dispose(){this._disposables.dispose()}filter(i,e){if(hw(i))return!0;let t=this._workspaceService.getWorkspaceFolder(i.resource);return!t||!this._cachedExpressions.has(t.uri.toString())?!0:!this._cachedExpressions.get(t.uri.toString())(dP(t.uri.path,i.resource.path),He(i.resource))}};BJe=I([m(0,Pe),m(1,B),m(2,fe)],BJe);var Hwi=class{compare(i,e){return hw(i)&&hw(e)?i.index-e.index:i.isDirectory===e.isDirectory?DT(i.name,e.name):i.isDirectory?-1:1}},sRe=class extends rRe{constructor(e,t,o,n,r,s,l){super(e,t,o,n,r);this._workspaceService=s;this._editorService=l}_createTree(e){this._treeContainer.classList.add("file-icon-themable-tree"),this._treeContainer.classList.add("show-file-icons");let t=n=>{this._treeContainer.classList.toggle("align-icons-and-twisties",n.hasFileIcons&&!n.hasFolderIcons),this._treeContainer.classList.toggle("hide-arrows",n.hidesExplorerArrows===!0)};this._disposables.add(this._themeService.onDidFileIconThemeChange(t)),t(this._themeService.getFileIconTheme());let o=this._instantiationService.createInstance(Nl,qB);return this._disposables.add(o),this._instantiationService.createInstance(rp,"BreadcrumbsFilePicker",e,new Fwi,[this._instantiationService.createInstance(VJe,o)],this._instantiationService.createInstance(WJe),{multipleSelectionSupport:!1,sorter:new Hwi,filter:this._instantiationService.createInstance(BJe),identityProvider:new Wwi,keyboardNavigationLabelProvider:new Vwi,accessibilityProvider:this._instantiationService.createInstance(Bwi),showNotFoundMessage:!1,overrideStyles:{listBackground:Eti}})}async _setInput(e){let{uri:t,kind:o}=e,n;o===2?n=this._workspaceService.getWorkspace():n=ci(t);let r=this._tree;await r.setInput(n);let s;for(let{element:l}of r.getNode().children)if(hw(l)&&Qe(l.uri,t)){s=l;break}else if(Qe(l.resource,t)){s=l;break}s&&(r.reveal(s,.5),r.setFocus([s],this._fakeEvent)),r.domFocus()}_previewElement(e){return x.None}async _revealElement(e,t,o){return!hw(e)&&e.isFile?(this._onWillPickElement.fire(),await this._editorService.openEditor({resource:e.resource,options:t},o?In:void 0),!0):!1}};sRe=I([m(2,F),m(3,Le),m(4,B),m(5,Pe),m(6,ee)],sRe);var HJe=class{constructor(i,e,t){this.comparator=i;this._order=t.getValue(e,"breadcrumbs.symbolSortOrder")}compare(i,e){return this._order==="name"?this.comparator.compareByName(i,e):this._order==="type"?this.comparator.compareByType(i,e):this.comparator.compareByPosition(i,e)}};HJe=I([m(2,Fn)],HJe);var zWt=class extends rRe{_createTree(i,e){let{config:t}=e.outline;return this._instantiationService.createInstance(rF,"BreadcrumbsOutlinePicker",i,t.delegate,t.renderers,t.treeDataSource,{...t.options,sorter:this._instantiationService.createInstance(HJe,t.comparator,void 0),collapseByDefault:!0,expandOnlyOnTwistieClick:!0,multipleSelectionSupport:!1,showNotFoundMessage:!1})}_setInput(i){let e=i.outline.captureViewState();this.restoreViewState=()=>{e.dispose()};let t=this._tree;return t.setInput(i.outline),i.element!==i.outline&&(t.reveal(i.element,.5),t.setFocus([i.element],this._fakeEvent)),t.domFocus(),Promise.resolve()}_previewElement(i){return this._tree.getInput().preview(i)}async _revealElement(i,e,t){return this._onWillPickElement.fire(),await this._tree.getInput().reveal(i,e,t,!1),!0}};var see=class extends ree{constructor(e,t,o,n){super();this.model=e;this.element=t;this.options=o;this._instantiationService=n;this._disposables=new N}dispose(){this._disposables.dispose()}equals(e){return e instanceof see?this.element.element===e.element.element&&this.options.showFileIcons===e.options.showFileIcons&&this.options.showSymbolIcons===e.options.showSymbolIcons:!1}render(e){let{element:t,outline:o}=this.element;if(t===o){let l=_("span",void 0,"\u2026");e.appendChild(l);return}let n=o.config.delegate.getTemplateId(t),r=o.config.renderers.find(l=>l.templateId===n);if(!r){e.textContent="<<NO RENDERER>>";return}let s=r.renderTemplate(e);r.renderElement({element:t,children:[],depth:0,visibleChildrenCount:0,visibleChildIndex:0,collapsible:!1,collapsed:!1,visible:!0,filterData:void 0},0,s,void 0),this.options.showSymbolIcons||vo(s.iconClass),this._disposables.add(Z(()=>{r.disposeTemplate(s)})),t instanceof jf&&o.uri&&this._disposables.add(this._instantiationService.invokeFunction(l=>Vco(l,e,t.symbol.name,{symbol:t.symbol,uri:o.uri},this.model,this.options.dragEditor)))}};see=I([m(3,F)],see);var aee=class extends ree{constructor(e,t,o,n,r,s){super();this.model=e;this.element=t;this.options=o;this._labels=n;this._hoverDelegate=r;this._instantiationService=s;this._disposables=new N}dispose(){this._disposables.dispose()}equals(e){return e instanceof aee?ar.isEqual(this.element.uri,e.element.uri)&&this.options.showFileIcons===e.options.showFileIcons&&this.options.showSymbolIcons===e.options.showSymbolIcons:!1}render(e){let t=this._labels.create(e,{hoverDelegate:this._hoverDelegate});t.setFile(this.element.uri,{hidePath:!0,hideIcon:this.element.kind===1||!this.options.showFileIcons,fileKind:this.element.kind,fileDecorations:{colors:this.options.showDecorationColors,badges:!1}}),e.classList.add(Iu[this.element.kind].toLowerCase()),this._disposables.add(t),this._disposables.add(this._instantiationService.invokeFunction(o=>Vco(o,e,He(this.element.uri),this.element.uri,this.model,this.options.dragEditor)))}};aee=I([m(5,F)],aee);function Vco(a,i,e,t,o,n){let r=a.get(F);return i.draggable=!0,new Uh(i,{onDragStart:s=>{s.dataTransfer&&(s.dataTransfer.effectAllowed="copyMove",r.invokeFunction(l=>{A.isUri(t)?tv(l,[t],s):(tv(l,[{resource:t.uri,selection:t.symbol.range}],s),mwe([{name:t.symbol.name,fsPath:t.uri.fsPath,range:t.symbol.range,kind:t.symbol.kind}],s)),n&&o.editor?.input&&JI.getInstance().setData([new ev({editor:o.editor.input,groupId:o.editor.group.id})],ev.prototype)}),MP(s,i,e))}})}var J6o=Ae("breadcrumb-separator",R.chevronRight,d(3920,null)),Rc=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h){this._options=e;this._editorGroup=t;this._contextKeyService=o;this._contextViewService=n;this._instantiationService=r;this._quickInputService=s;this._fileService=l;this._editorService=c;this._labelService=u;this._disposables=new N;this._breadcrumbsDisposables=new N;this._model=new me;this._breadcrumbsPickerShowing=!1;this._onDidVisibilityChange=this._disposables.add(new E);this.domNode=document.createElement("div"),this.domNode.classList.add("breadcrumbs-control"),M(i,this.domNode),this._cfUseQuickPick=MT.UseQuickPick.bindTo(p),this._cfShowIcons=MT.Icons.bindTo(p),this._cfTitleScrollbarSizing=MT.TitleScrollbarSizing.bindTo(p),this._cfTitleScrollbarVisibility=MT.TitleScrollbarVisibility.bindTo(p),this._labels=this._instantiationService.createInstance(Nl,qB);let g=this._cfTitleScrollbarSizing.getValue()??"default",f=e.widgetStyles??Tz,v=this._cfTitleScrollbarVisibility?.getValue()??"auto";this._widget=new K2(this.domNode,Rc.SCROLLBAR_SIZES[g],Rc.SCROLLBAR_VISIBILITY[v],J6o,f),this._widget.onDidSelectItem(this._onSelectEvent,this,this._disposables),this._widget.onDidFocusItem(this._onFocusEvent,this,this._disposables),this._widget.onDidChangeFocus(this._updateCkBreadcrumbsActive,this,this._disposables),this._ckBreadcrumbsPossible=Rc.CK_BreadcrumbsPossible.bindTo(this._contextKeyService),this._ckBreadcrumbsVisible=Rc.CK_BreadcrumbsVisible.bindTo(this._contextKeyService),this._ckBreadcrumbsActive=Rc.CK_BreadcrumbsActive.bindTo(this._contextKeyService),this._hoverDelegate=Ri("mouse"),this._disposables.add(h.register(this._editorGroup.id,this._widget)),this.hide()}static{this.HEIGHT=22}static{this.SCROLLBAR_SIZES={default:3,large:8}}static{this.SCROLLBAR_VISIBILITY={auto:1,visible:3,hidden:2}}static{this.Payload_Reveal={}}static{this.Payload_RevealAside={}}static{this.Payload_Pick={}}static{this.CK_BreadcrumbsPossible=new Y("breadcrumbsPossible",!1,d(3910,null))}static{this.CK_BreadcrumbsVisible=new Y("breadcrumbsVisible",!1,d(3911,null))}static{this.CK_BreadcrumbsActive=new Y("breadcrumbsActive",!1,d(3909,null))}get onDidVisibilityChange(){return this._onDidVisibilityChange.event}dispose(){this._disposables.dispose(),this._breadcrumbsDisposables.dispose(),this._model.dispose(),this._ckBreadcrumbsPossible.reset(),this._ckBreadcrumbsVisible.reset(),this._ckBreadcrumbsActive.reset(),this._cfUseQuickPick.dispose(),this._cfShowIcons.dispose(),this._cfTitleScrollbarSizing.dispose(),this._cfTitleScrollbarVisibility.dispose(),this._widget.dispose(),this._labels.dispose(),this.domNode.remove()}get model(){return this._model.value}layout(i){this._widget.layout(i)}isHidden(){return this.domNode.classList.contains("hidden")}hide(){let i=this.isHidden();this._breadcrumbsDisposables.clear(),this._ckBreadcrumbsVisible.set(!1),this.domNode.classList.toggle("hidden",!0),i||this._onDidVisibilityChange.fire()}show(){let i=this.isHidden();this._ckBreadcrumbsVisible.set(!0),this.domNode.classList.toggle("hidden",!1),i&&this._onDidVisibilityChange.fire()}revealLast(){this._widget.revealLast()}update(){this._breadcrumbsDisposables.clear();let i=po.getCanonicalUri(this._editorGroup.activeEditor,{supportSideBySide:1}),e=this.isHidden();if(!i||!this._fileService.hasProvider(i))return this._ckBreadcrumbsPossible.set(!1),e?!1:(this.hide(),!0);let t=po.getOriginalUri(this._editorGroup.activeEditor,{supportSideBySide:1});this.show(),this._ckBreadcrumbsPossible.set(!0);let o=this._instantiationService.createInstance(iRe,t??i,this._editorGroup.activeEditorPane);this._model.value=o,this.domNode.classList.toggle("backslash-path",this._labelService.getSeparator(i.scheme,i.authority)==="\\");let n=()=>{this.domNode.classList.toggle("relative-path",o.isRelative());let p=this._cfShowIcons.getValue(),h={...this._options,showFileIcons:this._options.showFileIcons&&p,showSymbolIcons:this._options.showSymbolIcons&&p},g=o.getElements().map(f=>f instanceof $pe?this._instantiationService.createInstance(aee,o,f,h,this._labels,this._hoverDelegate):this._instantiationService.createInstance(see,o,f,h));g.length===0?(this._widget.setEnabled(!1),this._widget.setItems([new class extends ree{render(f){f.textContent=d(3918,null)}equals(f){return f===this}dispose(){}}])):(this._widget.setEnabled(!0),this._widget.setItems(g),this._widget.reveal(g[g.length-1]))},r=o.onDidUpdate(n),s=this._cfShowIcons.onDidChange(n);n(),this._breadcrumbsDisposables.clear(),this._breadcrumbsDisposables.add(r),this._breadcrumbsDisposables.add(Z(()=>this._model.clear())),this._breadcrumbsDisposables.add(s),this._breadcrumbsDisposables.add(Z(()=>this._widget.setItems([])));let l=()=>{let p=this._cfTitleScrollbarSizing.getValue()??"default",h=this._cfTitleScrollbarVisibility?.getValue()??"auto";this._widget.setHorizontalScrollbarSize(Rc.SCROLLBAR_SIZES[p]),this._widget.setHorizontalScrollbarVisibility(Rc.SCROLLBAR_VISIBILITY[h])};l();let c=this._cfTitleScrollbarSizing.onDidChange(l),u=this._cfTitleScrollbarVisibility.onDidChange(l);return this._breadcrumbsDisposables.add(c),this._breadcrumbsDisposables.add(u),this._breadcrumbsDisposables.add({dispose:()=>{this._breadcrumbsPickerShowing&&this._contextViewService.hideContextView({source:this})}}),e!==this.isHidden()}_onFocusEvent(i){i.item&&this._breadcrumbsPickerShowing&&(this._breadcrumbsPickerIgnoreOnceItem=void 0,this._widget.setSelection(i.item))}_onSelectEvent(i){if(!i.item)return;if(i.item===this._breadcrumbsPickerIgnoreOnceItem){this._breadcrumbsPickerIgnoreOnceItem=void 0,this._widget.setFocused(void 0),this._widget.setSelection(void 0);return}let{element:e}=i.item;this._editorGroup.focus();let t=this._getEditorGroup(i.payload);if(t!==void 0){this._widget.setFocused(void 0),this._widget.setSelection(void 0),this._revealInEditor(i,e,t);return}if(this._cfUseQuickPick.getValue()){this._widget.setFocused(void 0),this._widget.setSelection(void 0),this._quickInputService.quickAccess.show(e instanceof oRe?"@":"");return}let o,n;this._contextViewService.showContextView({render:r=>{i.item instanceof aee?o=this._instantiationService.createInstance(sRe,r,i.item.model.resource):i.item instanceof see&&(o=this._instantiationService.createInstance(zWt,r,i.item.model.resource));let s=o.onWillPickElement(()=>this._contextViewService.hideContextView({source:this,didPick:!0})),l=bu.getInstance(Re(this.domNode)).onDidChange(()=>this._contextViewService.hideContextView({source:this})),c=qn(r),u=c.onDidBlur(()=>{this._breadcrumbsPickerIgnoreOnceItem=this._widget.isDOMFocused()?i.item:void 0,this._contextViewService.hideContextView({source:this})});return this._breadcrumbsPickerShowing=!0,this._updateCkBreadcrumbsActive(),wn(o,s,l,c,u)},getAnchor:()=>{if(!n){let r=Re(this.domNode),s=r.innerWidth-8,l=Math.min(r.innerHeight*.7,300),c=Math.min(s,Math.max(240,s/4.17)),u=8,p,h=ir(i.node),g=h.top+h.height+u;g+l>=r.innerHeight&&(l=r.innerHeight-g-30);let f=h.left;if(f+c>=s&&(f=s-c),i.payload instanceof Cn){let v=c-2*u;p=i.payload.posx-f,p>v&&(f=Math.min(s-c,f+p-v),p=v)}else p=h.left+h.width*.3-f;o.show(e,l,c,u,Math.max(0,p)),n={x:f,y:g}}return n},onHide:r=>{r?.didPick||o.restoreViewState(),this._breadcrumbsPickerShowing=!1,this._updateCkBreadcrumbsActive(),r?.source===this&&(this._widget.setFocused(void 0),this._widget.setSelection(void 0)),o.dispose()}})}_updateCkBreadcrumbsActive(){let i=this._widget.isDOMFocused()||this._breadcrumbsPickerShowing;this._ckBreadcrumbsActive.set(i)}async _revealInEditor(i,e,t,o=!1){if(e instanceof $pe)if(e.kind===0)await this._editorService.openEditor({resource:e.uri,options:{pinned:o}},t);else{let n=this._widget.getItems(),r=n.indexOf(i.item);this._widget.setFocused(n[r+1]),this._widget.setSelection(n[r+1],Rc.Payload_Pick)}else e.outline.reveal(e,{pinned:o},t===In,!1)}_getEditorGroup(i){return i===Rc.Payload_RevealAside?In:i===Rc.Payload_Reveal?jn:void 0}};Rc=I([m(3,X),m(4,Wn),m(5,F),m(6,Ue),m(7,fe),m(8,ee),m(9,rt),m(10,B),m(11,fH)],Rc);var lee=class{constructor(i,e,t,o,n,r){this._container=i;this._editorGroup=e;this._options=t;this._instantiationService=n;this._disposables=new N;this._controlDisposables=new N;this._onDidEnablementChange=this._disposables.add(new E);this._onDidVisibilityChange=this._disposables.add(new E);let s=this._disposables.add(MT.IsEnabled.bindTo(o));this._disposables.add(s.onDidChange(()=>{let l=s.getValue();!l&&this._control?(this._controlDisposables.clear(),this._control=void 0,this._onDidEnablementChange.fire()):l&&!this._control&&(this._control=this.createControl(),this._control.update(),this._onDidEnablementChange.fire())})),s.getValue()&&(this._control=this.createControl()),this._disposables.add(r.onDidChangeFileSystemProviderRegistrations(l=>{this._control?.model&&this._control.model.resource.scheme!==l.scheme||this._control?.update()&&this._onDidEnablementChange.fire()}))}get control(){return this._control}get onDidEnablementChange(){return this._onDidEnablementChange.event}get onDidVisibilityChange(){return this._onDidVisibilityChange.event}createControl(){let i=this._controlDisposables.add(this._instantiationService.createInstance(Rc,this._container,this._options,this._editorGroup));return this._controlDisposables.add(i.onDidVisibilityChange(()=>this._onDidVisibilityChange.fire())),i}dispose(){this._disposables.dispose(),this._controlDisposables.dispose()}};lee=I([m(3,B),m(4,F),m(5,fe)],lee);W(class extends K{constructor(){super({id:"breadcrumbs.toggle",title:L(3915,"Toggle Breadcrumbs"),shortTitle:L(3916,"Breadcrumbs"),category:Ve.View,toggled:{condition:C.equals("config.breadcrumbs.enabled",!0),title:d(3917,null),mnemonicTitle:d(3919,null)},menu:[{id:D.CommandPalette},{id:D.MenubarAppearanceMenu,group:"4_editor",order:2},{id:D.NotebookToolbar,group:"notebookLayout",order:2},{id:D.StickyScrollContext},{id:D.NotebookStickyScrollContext,group:"notebookView",order:2},{id:D.NotebookToolbarContext,group:"notebookView",order:2}]})}run(i){let e=i.get(B),t=MT.IsEnabled.bindTo(e),o=t.getValue();t.updateValue(!o),t.dispose()}});function Uwi(a,i){let e=a.get(wt),o=a.get(fH).getWidget(e.activeGroup.id);if(o){let n=o.getItems().at(-1);o.setFocused(n),i&&o.setSelection(n,Rc.Payload_Pick)}}W(class extends K{constructor(){super({id:"breadcrumbs.focusAndSelect",title:L(3914,"Focus and Select Breadcrumbs"),precondition:Rc.CK_BreadcrumbsVisible,keybinding:{weight:200,primary:3161,when:Rc.CK_BreadcrumbsPossible},f1:!0})}run(i,...e){Uwi(i,!0)}});W(class extends K{constructor(){super({id:"breadcrumbs.focus",title:L(3913,"Focus Breadcrumbs"),precondition:Rc.CK_BreadcrumbsVisible,keybinding:{weight:200,primary:3157,when:Rc.CK_BreadcrumbsPossible},f1:!0})}run(i,...e){Uwi(i,!1)}});Ct.registerCommandAndKeybindingRule({id:"breadcrumbs.toggleToOn",weight:200,primary:3161,when:C.not("config.breadcrumbs.enabled"),handler:async a=>{let i=a.get(F),e=a.get(B),t=MT.IsEnabled.bindTo(e);return t.getValue()||(await t.updateValue(!0),await Li(50)),t.dispose(),i.invokeFunction(Uwi,!0)}});Ct.registerCommandAndKeybindingRule({id:"breadcrumbs.focusNext",weight:200,primary:17,secondary:[2065],mac:{primary:17,secondary:[529]},when:C.and(Rc.CK_BreadcrumbsVisible,Rc.CK_BreadcrumbsActive),handler(a){let i=a.get(wt),t=a.get(fH).getWidget(i.activeGroup.id);t&&t.focusNext()}});Ct.registerCommandAndKeybindingRule({id:"breadcrumbs.focusPrevious",weight:200,primary:15,secondary:[2063],mac:{primary:15,secondary:[527]},when:C.and(Rc.CK_BreadcrumbsVisible,Rc.CK_BreadcrumbsActive),handler(a){let i=a.get(wt),t=a.get(fH).getWidget(i.activeGroup.id);t&&t.focusPrev()}});Ct.registerCommandAndKeybindingRule({id:"breadcrumbs.focusNextWithPicker",weight:201,primary:2065,mac:{primary:529},when:C.and(Rc.CK_BreadcrumbsVisible,Rc.CK_BreadcrumbsActive,vc),handler(a){let i=a.get(wt),t=a.get(fH).getWidget(i.activeGroup.id);t&&t.focusNext()}});Ct.registerCommandAndKeybindingRule({id:"breadcrumbs.focusPreviousWithPicker",weight:201,primary:2063,mac:{primary:527},when:C.and(Rc.CK_BreadcrumbsVisible,Rc.CK_BreadcrumbsActive,vc),handler(a){let i=a.get(wt),t=a.get(fH).getWidget(i.activeGroup.id);t&&t.focusPrev()}});Ct.registerCommandAndKeybindingRule({id:"breadcrumbs.selectFocused",weight:200,primary:3,secondary:[18],when:C.and(Rc.CK_BreadcrumbsVisible,Rc.CK_BreadcrumbsActive),handler(a){let i=a.get(wt),t=a.get(fH).getWidget(i.activeGroup.id);t&&t.setSelection(t.getFocused(),Rc.Payload_Pick)}});Ct.registerCommandAndKeybindingRule({id:"breadcrumbs.revealFocused",weight:200,primary:10,secondary:[2051],when:C.and(Rc.CK_BreadcrumbsVisible,Rc.CK_BreadcrumbsActive),handler(a){let i=a.get(wt),t=a.get(fH).getWidget(i.activeGroup.id);t&&t.setSelection(t.getFocused(),Rc.Payload_Reveal)}});Ct.registerCommandAndKeybindingRule({id:"breadcrumbs.selectEditor",weight:201,primary:9,when:C.and(Rc.CK_BreadcrumbsVisible,Rc.CK_BreadcrumbsActive),handler(a){let i=a.get(wt),t=a.get(fH).getWidget(i.activeGroup.id);t&&(t.setFocused(void 0),t.setSelection(void 0),i.activeGroup.activeEditorPane?.focus())}});Ct.registerCommandAndKeybindingRule({id:"breadcrumbs.revealFocusedFromTreeAside",weight:200,primary:2051,when:C.and(Rc.CK_BreadcrumbsVisible,Rc.CK_BreadcrumbsActive,vc),handler(a){let i=a.get(ee),t=a.get(Io).lastFocusedList;if(!(t instanceof rF)&&!(t instanceof rp))return;let o=t.getFocus()[0];if(A.isUri(o?.resource))return i.openEditor({resource:o.resource,options:{pinned:!0}},In);let n=t.getInput();if(n&&typeof n.outlineKind=="string")return n.reveal(o,{pinned:!0,preserveFocus:!1},!0,!1)}});W(class extends K{constructor(){super({id:"breadcrumbs.copyPath",title:L(3912,"Copy Breadcrumbs Path"),category:Ve.View,precondition:Rc.CK_BreadcrumbsVisible,f1:!0,menu:[{id:D.EditorTitleContext,group:"1_cutcopypaste",order:100,when:Rc.CK_BreadcrumbsPossible}]})}async run(i){let e=i.get(wt),t=i.get(Fi),o=i.get(B),n=i.get(cM);if(!e.activeGroup.activeEditorPane)return;let r=await n.createOutline(e.activeGroup.activeEditorPane,2,Se.None);if(!r)return;let l=r.config.breadcrumbsDataSource.getBreadcrumbElements().map(g=>g.label).filter(Boolean);if(r.dispose(),l.length===0)return;let c=e.activeGroup.activeEditorPane.input.resource,u=MT.SymbolPathSeparator.bindTo(o),p=u.getValue(c&&{resource:c})??".";u.dispose();let h=l.join(p);await t.writeText(h)}});var jpe=class extends rs{constructor(e){super();this.context=e}run(e,t){let o=this.context;return t?.preserveFocus&&(o={...this.context,preserveFocus:!0}),super.run(e,o)}},WA=class extends yu{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super(g);this.parent=e;this.editorPartsView=t;this.groupsView=o;this.groupView=n;this.tabsModel=r;this.contextMenuService=s;this.instantiationService=l;this.contextKeyService=c;this.keybindingService=u;this.notificationService=p;this.quickInputService=h;this.editorResolverService=f;this.hostService=v;this.editorTransfer=JI.getInstance();this.groupTransfer=JI.getInstance();this.treeItemsTransfer=JI.getInstance();this.editorActionsToolbarDisposables=this._register(new N);this.editorActionsDisposables=this._register(new N);this.renderDropdownAsChildElement=!1;let b=this.create(e);this.contextMenuContextKeyService=this._register(this.contextKeyService.createScoped(b));let S=this._register(this.instantiationService.createChild(new _o([X,this.contextMenuContextKeyService])));this.resourceContext=this._register(S.createInstance(Wo)),this.editorPinnedContext=UEe.bindTo(this.contextMenuContextKeyService),this.editorIsFirstContext=FDt.bindTo(this.contextMenuContextKeyService),this.editorIsLastContext=$de.bindTo(this.contextMenuContextKeyService),this.editorStickyContext=VR.bindTo(this.contextMenuContextKeyService),this.editorAvailableEditorIds=MF.bindTo(this.contextMenuContextKeyService),this.editorCanSplitInGroupContext=wB.bindTo(this.contextMenuContextKeyService),this.sideBySideEditorContext=VC.bindTo(this.contextMenuContextKeyService),this.groupLockedContext=aT.bindTo(this.contextMenuContextKeyService)}static{this.EDITOR_TAB_HEIGHT={normal:35,compact:22}}create(e){return this.updateTabHeight(),e}get editorActionsEnabled(){return this.groupsView.partOptions.editorActionsLocation==="default"&&this.groupsView.partOptions.showTabs!=="none"}createEditorActionsToolBar(e,t){this.editorActionsToolbarContainer=_("div"),this.editorActionsToolbarContainer.classList.add(...t),e.appendChild(this.editorActionsToolbarContainer),this.handleEditorActionToolBarVisibility(this.editorActionsToolbarContainer)}handleEditorActionToolBarVisibility(e){let t=this.editorActionsEnabled,o=!!this.editorActionsToolbar;t&&!o?this.doCreateEditorActionsToolBar(e):!t&&o&&(this.editorActionsToolbar?.getElement().remove(),this.editorActionsToolbar=void 0,this.editorActionsToolbarDisposables.clear(),this.editorActionsDisposables.clear()),e.classList.toggle("hidden",!t)}doCreateEditorActionsToolBar(e){let t={groupId:this.groupView.id};this.editorActionsToolbar=this.editorActionsToolbarDisposables.add(this.instantiationService.createInstance(ol,e,{actionViewItemProvider:(o,n)=>this.actionViewItemProvider(o,n),orientation:0,ariaLabel:d(4328,null),getKeyBinding:o=>this.getKeybinding(o),actionRunner:this.editorActionsToolbarDisposables.add(new jpe(t)),anchorAlignmentProvider:()=>1,renderDropdownAsChildElement:this.renderDropdownAsChildElement,telemetrySource:"editorPart",resetMenu:D.EditorTitle,overflowBehavior:{maxItems:9,exempted:RFt},highlightToggledItems:!0})),this.editorActionsToolbar.context=t,this.editorActionsToolbarDisposables.add(this.editorActionsToolbar.actionRunner.onDidRun(o=>{o.error&&!ao(o.error)&&this.notificationService.error(o.error)}))}actionViewItemProvider(e,t){let o=this.groupView.activeEditorPane;if(o instanceof Ts){let n=o.getActionViewItem(e,t);if(n)return n}return Bs(this.instantiationService,e,{...t,menuAsChild:this.renderDropdownAsChildElement})}updateEditorActionsToolbar(){if(!this.editorActionsEnabled)return;this.editorActionsDisposables.clear();let e=this.groupView.createEditorActions(this.editorActionsDisposables);this.editorActionsDisposables.add(e.onDidChange(()=>this.updateEditorActionsToolbar()));let t=Ci(this.editorActionsToolbar),{primary:o,secondary:n}=this.prepareEditorActions(e.actions);t.setActions(B_(o),B_(n))}getEditorPaneAwareContextKeyService(){return this.groupView.activeEditorPane?.scopedContextKeyService??this.contextKeyService}clearEditorActionsToolbar(){if(!this.editorActionsEnabled)return;Ci(this.editorActionsToolbar).setActions([],[])}onGroupDragStart(e,t){if(e.target!==t)return!1;let o=this.isNewWindowOperation(e);this.groupTransfer.setData([new gI(this.groupView.id)],gI.prototype),e.dataTransfer&&(e.dataTransfer.effectAllowed="copyMove");let n=!1;if(this.groupsView.partOptions.showTabs==="multiple"?n=this.doFillResourceDataTransfers(this.groupView.getEditors(1),e,o):this.groupView.activeEditor&&(n=this.doFillResourceDataTransfers([this.groupView.activeEditor],e,o)),!n&&Ac&&e.dataTransfer?.setData(yl.TEXT,String(this.groupView.label)),this.groupView.activeEditor){let r=this.groupView.activeEditor.getName();this.groupsView.partOptions.showTabs==="multiple"&&this.groupView.count>1&&(r=d(4329,null,r,this.groupView.count-1)),MP(e,t,r)}return o}async onGroupDragEnd(e,t,o,n){if(this.groupTransfer.clearData(gI.prototype),e.target!==o||!n||AAt())return;let r=await this.maybeCreateAuxiliaryEditorPartAt(e,o);if(!r)return;let s=r.activeGroup;this.groupsView.mergeGroup(this.groupView,s.id,{mode:this.isMoveOperation(t??e,s.id)?1:0}),s.focus()}async maybeCreateAuxiliaryEditorPartAt(e,t){let{point:o,display:n}=await this.hostService.getCursorScreenPoint()??{point:{x:e.screenX,y:e.screenY}},r=Ki();if(r.document.visibilityState==="visible"&&r.document.hasFocus()&&o.x>=r.screenX&&o.x<=r.screenX+r.outerWidth&&o.y>=r.screenY&&o.y<=r.screenY+r.outerHeight)return;let s=t.offsetWidth/2,l=30+t.offsetHeight/2,c={x:o.x-s,y:o.y-l};return n&&(c.x<n.x&&(c.x=n.x),c.y<n.y&&(c.y=n.y)),this.editorPartsView.createAuxiliaryEditorPart({bounds:c})}isNewWindowOperation(e){return this.groupsView.partOptions.dragToOpenWindow?!e.altKey:e.altKey}isMoveOperation(e,t,o){return o?.hasCapability(8)?!0:!(e.ctrlKey&&!Ze||e.altKey&&Ze)||t===this.groupView.id}doFillResourceDataTransfers(e,t,o){return e.length?(this.instantiationService.invokeFunction(tv,e.map(n=>({editor:n,groupId:this.groupView.id})),t,{disableStandardTransfer:o}),!0):!1}onTabContextMenu(e,t,o){this.resourceContext.set(po.getOriginalUri(e,{supportSideBySide:1})),this.editorPinnedContext.set(this.tabsModel.isPinned(e)),this.editorIsFirstContext.set(this.tabsModel.isFirst(e)),this.editorIsLastContext.set(this.tabsModel.isLast(e)),this.editorStickyContext.set(this.tabsModel.isSticky(e)),this.groupLockedContext.set(this.tabsModel.isLocked),this.editorCanSplitInGroupContext.set(e.hasCapability(32)),this.sideBySideEditorContext.set(e.typeId===Ma.ID),$Dt(this.editorAvailableEditorIds,e,this.editorResolverService);let n=o;Ru(t)&&(n=new Cn(Re(o),t)),this.contextMenuService.showContextMenu({getAnchor:()=>n,menuId:D.EditorTitleContext,menuActionOptions:{shouldForwardArgs:!0,arg:this.resourceContext.get()},contextKeyService:this.contextMenuContextKeyService,getActionsContext:()=>({groupId:this.groupView.id,editorIndex:this.groupView.getIndexOfEditor(e)}),getKeyBinding:r=>this.keybindingService.lookupKeybinding(r.id,this.contextMenuContextKeyService),onHide:()=>this.groupsView.activeGroup.focus()})}getKeybinding(e){return this.keybindingService.lookupKeybinding(e.id,this.getEditorPaneAwareContextKeyService())}getKeybindingLabel(e){let t=this.getKeybinding(e);return t?t.getLabel()??void 0:void 0}get tabHeight(){return this.groupsView.partOptions.tabHeight!=="compact"?WA.EDITOR_TAB_HEIGHT.normal:WA.EDITOR_TAB_HEIGHT.compact}getHoverTitle(e){let t=e.getTitle(2);return this.tabsModel.isPinned(e)?t:{markdown:new Ie("",{supportThemeIcons:!0,isTrusted:!0}).appendText(t).appendMarkdown(' (_preview_ [$(gear)](command:workbench.action.openSettings?%5B%22workbench.editor.enablePreview%22%5D "Configure Preview Mode"))'),markdownNotSupportedFallback:t+" (preview)"}}updateTabHeight(){this.parent.style.setProperty("--editor-group-tab-height",`${this.tabHeight}px`)}updateOptions(e,t){e.tabHeight!==t.tabHeight&&this.updateTabHeight(),(e.editorActionsLocation!==t.editorActionsLocation||e.showTabs!==t.showTabs)&&this.editorActionsToolbarContainer&&(this.handleEditorActionToolBarVisibility(this.editorActionsToolbarContainer),this.updateEditorActionsToolbar())}};WA=I([m(5,Xe),m(6,F),m(7,X),m(8,_e),m(9,Ne),m(10,Ue),m(11,Le),m(12,Ka),m(13,Zt)],WA);var KWt=class extends x{constructor(e){super();this.model=e;this._onDidModelChange=this._register(new E);this.onDidModelChange=this._onDidModelChange.event;this._register(this.model.onDidModelChange(t=>{let o=t.editorIndex??t.editor;o!==void 0&&!this.filter(o)||this._onDidModelChange.fire(t)}))}get id(){return this.model.id}get isLocked(){return this.model.isLocked}get stickyCount(){return this.model.stickyCount}get activeEditor(){return this.model.activeEditor&&this.filter(this.model.activeEditor)?this.model.activeEditor:null}get previewEditor(){return this.model.previewEditor&&this.filter(this.model.previewEditor)?this.model.previewEditor:null}get selectedEditors(){return this.model.selectedEditors.filter(e=>this.filter(e))}isPinned(e){return this.model.isPinned(e)}isTransient(e){return this.model.isTransient(e)}isSticky(e){return this.model.isSticky(e)}isActive(e){return this.model.isActive(e)}isSelected(e){return this.model.isSelected(e)}isFirst(e){return this.model.isFirst(e,this.getEditors(1))}isLast(e){return this.model.isLast(e,this.getEditors(1))}getEditors(e,t){return this.model.getEditors(e,t).filter(n=>this.filter(n))}findEditor(e,t){let o=this.model.findEditor(e,t);if(o)return this.filter(o[1])?o:void 0}},aRe=class extends KWt{get count(){return this.model.stickyCount}getEditors(i,e){return e?.excludeSticky?[]:i===1?this.model.getEditors(1).slice(0,this.model.stickyCount):super.getEditors(i,e)}isSticky(i){return!0}getEditorByIndex(i){return i<this.count?this.model.getEditorByIndex(i):void 0}indexOf(i,e,t){let o=this.model.indexOf(i,e,t);return o<0||o>=this.model.stickyCount?-1:o}contains(i,e){let t=this.model.indexOf(i,void 0,e);return t>=0&&t<this.model.stickyCount}filter(i){return this.model.isSticky(i)}},lRe=class extends KWt{get count(){return this.model.count-this.model.stickyCount}get stickyCount(){return 0}isSticky(i){return!1}getEditors(i,e){return i===1?this.model.getEditors(1).slice(this.model.stickyCount):super.getEditors(i,e)}getEditorByIndex(i){return i>=0?this.model.getEditorByIndex(i+this.model.stickyCount):void 0}indexOf(i,e,t){let o=this.model.indexOf(i,e,t);return o<this.model.stickyCount||o>=this.model.count?-1:o-this.model.stickyCount}contains(i,e){let t=this.model.indexOf(i,void 0,e);return t>=this.model.stickyCount&&t<this.model.count}filter(i){return!this.model.isSticky(i)}};var vI=class extends WA{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super(e,t,o,n,r,s,l,c,u,p,h,g,S,y);this.editorService=f;this.pathService=v;this.treeViewsDragAndDropService=b;this.closeEditorAction=this._register(this.instantiationService.createInstance(iee,iee.ID,iee.LABEL));this.unpinEditorAction=this._register(this.instantiationService.createInstance(x0,x0.ID,x0.LABEL));this.tabResourceLabels=this._register(this.instantiationService.createInstance(Nl,qB));this.tabLabels=[];this.tabActionBars=[];this.tabDisposables=[];this.dimensions={container:si.None,available:si.None};this.layoutScheduler=this._register(new me);this.path=ei?$s:Oo;this.lastMouseWheelEventTime=0;this.isMouseOverTabs=!1;this.updateEditorLabelScheduler=this._register(new Dt(()=>this.doUpdateEditorLabels(),0));(async()=>this.path=await this.pathService.path)(),this._register(this.tabResourceLabels.onDidChangeDecorations(()=>this.doHandleDecorationsChange()))}static{this.SCROLLBAR_SIZES={default:3,large:10}}static{this.TAB_WIDTH={compact:38,shrink:80,fit:120}}static{this.DRAG_OVER_OPEN_TAB_THRESHOLD=1500}static{this.MOUSE_WHEEL_EVENT_THRESHOLD=150}static{this.MOUSE_WHEEL_DISTANCE_THRESHOLD=1.5}create(e){return super.create(e),this.titleContainer=e,this.tabsAndActionsContainer=_(".tabs-and-actions-container"),this.titleContainer.appendChild(this.tabsAndActionsContainer),this.tabsContainer=_(".tabs-container",{role:"tablist",draggable:!0}),this._register(Ms.addTarget(this.tabsContainer)),this.tabSizingFixedDisposables=this._register(new N),this.updateTabSizing(!1),this.tabsScrollbar=this.createTabsScrollbar(this.tabsContainer),this.tabsAndActionsContainer.appendChild(this.tabsScrollbar.getDomNode()),this.registerTabsContainerListeners(this.tabsContainer,this.tabsScrollbar),this.createEditorActionsToolBar(this.tabsAndActionsContainer,["editor-actions"]),this.updateTabsControlVisibility(),this.tabsAndActionsContainer}createTabsScrollbar(e){let t=this._register(new O7(e,{horizontal:this.getTabsScrollbarVisibility(),horizontalScrollbarSize:this.getTabsScrollbarSizing(),vertical:2,scrollYToX:!0,useShadows:!1}));return this._register(t.onScroll(o=>{o.scrollLeftChanged&&(e.scrollLeft=o.scrollLeft)})),t}updateTabsScrollbarSizing(){this.tabsScrollbar?.updateOptions({horizontalScrollbarSize:this.getTabsScrollbarSizing()})}updateTabsScrollbarVisibility(){this.tabsScrollbar?.updateOptions({horizontal:this.getTabsScrollbarVisibility()})}updateTabSizing(e){let[t,o]=jy(this.tabsContainer,this.tabSizingFixedDisposables);o.clear();let n=this.groupsView.partOptions;n.tabSizing==="fixed"?(t.style.setProperty("--tab-sizing-fixed-min-width",`${n.tabSizingFixedMinWidth}px`),t.style.setProperty("--tab-sizing-fixed-max-width",`${n.tabSizingFixedMaxWidth}px`),o.add(j(t,re.MOUSE_ENTER,()=>{this.isMouseOverTabs=!0})),o.add(j(t,re.MOUSE_LEAVE,()=>{this.isMouseOverTabs=!1,this.updateTabsFixedWidth(!1)}))):e&&(t.style.removeProperty("--tab-sizing-fixed-min-width"),t.style.removeProperty("--tab-sizing-fixed-max-width"),this.updateTabsFixedWidth(!1))}updateTabsFixedWidth(e){this.forEachTab((t,o,n)=>{if(e){let{width:r}=n.getBoundingClientRect();n.style.setProperty("--tab-sizing-current-width",`${r}px`)}else n.style.removeProperty("--tab-sizing-current-width")})}getTabsScrollbarSizing(){return this.groupsView.partOptions.titleScrollbarSizing!=="large"?vI.SCROLLBAR_SIZES.default:vI.SCROLLBAR_SIZES.large}getTabsScrollbarVisibility(){switch(this.groupsView.partOptions.titleScrollbarVisibility){case"visible":return 3;case"hidden":return 2;default:return 1}}registerTabsContainerListeners(e,t){this._register(j(e,re.SCROLL,()=>{e.classList.contains("scroll")&&t.setScrollPosition({scrollLeft:e.scrollLeft})}));for(let s of[Kn.Tap,re.DBLCLICK])this._register(j(e,s,l=>{if(s===re.DBLCLICK){if(l.target!==e)return}else if(l.tapCount!==2||l.initialTarget!==e)return;Xt.stop(l),this.editorService.openEditor({resource:void 0,options:{pinned:!0,index:this.groupView.count,override:la.id}},this.groupView.id)}));this._register(j(e,re.MOUSE_DOWN,s=>{s.button===1&&s.preventDefault()})),fn&&this._register(j(e,re.MOUSE_UP,s=>{s.button===1&&s.preventDefault()}));let o,n=!1;this._register(new Uh(e,{onDragStart:s=>{n=this.onGroupDragStart(s,e)},onDrag:s=>{o=s},onDragEnter:s=>{if(e.classList.add("scroll"),s.target===e){if(!this.isSupportedDropTransfer(s)){s.dataTransfer&&(s.dataTransfer.dropEffect="none");return}this.editorTransfer.hasData(ev.prototype)||s.dataTransfer&&(s.dataTransfer.dropEffect="copy"),this.updateDropFeedback(e,!0,s)}},onDragLeave:s=>{this.updateDropFeedback(e,!1,s),e.classList.remove("scroll")},onDragEnd:s=>{this.updateDropFeedback(e,!1,s),e.classList.remove("scroll"),this.onGroupDragEnd(s,o,e,n)},onDrop:s=>{if(this.updateDropFeedback(e,!1,s),e.classList.remove("scroll"),s.target===e){let l=this.groupTransfer.hasData(gI.prototype);this.onDrop(s,l?this.groupView.count:this.tabsModel.count,e)}}})),this._register(j(e,re.MOUSE_WHEEL,s=>{let l=this.groupView.activeEditor;if(!l||this.groupView.count<2)return;if(this.groupsView.partOptions.scrollToSwitchTabs===!0){if(s.shiftKey)return}else if(!s.shiftKey)return;let c=Date.now();if(c-this.lastMouseWheelEventTime<vI.MOUSE_WHEEL_EVENT_THRESHOLD-2*(Math.abs(s.deltaX)+Math.abs(s.deltaY)))return;this.lastMouseWheelEventTime=c;let u;if(s.deltaX+s.deltaY<-vI.MOUSE_WHEEL_DISTANCE_THRESHOLD)u=-1;else if(s.deltaX+s.deltaY>vI.MOUSE_WHEEL_DISTANCE_THRESHOLD)u=1;else return;let p=this.groupView.getEditorByIndex(this.groupView.getIndexOfEditor(l)+u);p&&(this.groupView.openEditor(p),Xt.stop(s,!0))}));let r=s=>{Xt.stop(s);let l=e;Ru(s)&&(l=new Cn(Re(this.parent),s)),this.contextMenuService.showContextMenu({getAnchor:()=>l,menuId:D.EditorTabsBarContext,contextKeyService:this.contextKeyService,menuActionOptions:{shouldForwardArgs:!0},getActionsContext:()=>({groupId:this.groupView.id}),getKeyBinding:c=>this.getKeybinding(c),onHide:()=>this.groupView.focus()})};this._register(j(e,Kn.Contextmenu,s=>r(s))),this._register(j(e,re.CONTEXT_MENU,s=>r(s)))}doHandleDecorationsChange(){this.layout(this.dimensions)}updateEditorActionsToolbar(){super.updateEditorActionsToolbar(),this.layout(this.dimensions)}openEditor(e,t){let o=this.handleOpenedEditors();return t?.focusTabControl&&this.withTab(e,(n,r,s)=>s.focus()),o}openEditors(e){return this.handleOpenedEditors()}handleOpenedEditors(){this.updateTabsControlVisibility();let[e,t]=jy(this.tabsContainer,this.tabsScrollbar);for(let s=e.children.length;s<this.tabsModel.count;s++)e.appendChild(this.createTab(s,e,t));let o=this.didActiveEditorChange(),n=this.tabLabels;this.computeTabLabels();let r=!1;return o||n.length!==this.tabLabels.length||n.some((s,l)=>!this.equalsEditorInputLabel(s,this.tabLabels.at(l)))?(this.redraw({forceRevealActiveTab:!0}),r=!0):this.layout(this.dimensions,{forceRevealActiveTab:!0}),r}didActiveEditorChange(){return!!(!this.activeTabLabel?.editor&&this.tabsModel.activeEditor||this.activeTabLabel?.editor&&!this.tabsModel.activeEditor||!this.activeTabLabel?.editor||!this.tabsModel.isActive(this.activeTabLabel.editor))}equalsEditorInputLabel(e,t){return e===t?!0:!e||!t?!1:e.name===t.name&&e.description===t.description&&e.forceDescription===t.forceDescription&&e.title===t.title&&e.ariaLabel===t.ariaLabel}beforeCloseEditor(e){if(this.isMouseOverTabs&&this.groupsView.partOptions.tabSizing==="fixed"){let t=this.tabsModel.isLast(e);this.updateTabsFixedWidth(!t)}}closeEditor(e){this.handleClosedEditors()}closeEditors(e){this.handleClosedEditors()}handleClosedEditors(){if(this.tabsModel.count){let e=Ci(this.tabsContainer);for(;e.children.length>this.tabsModel.count;)e.lastChild?.remove(),Be(this.tabDisposables.pop());this.computeTabLabels(),this.redraw({forceRevealActiveTab:!0})}else this.tabsContainer&&Rt(this.tabsContainer),this.tabDisposables=Be(this.tabDisposables),this.tabResourceLabels.clear(),this.tabLabels=[],this.activeTabLabel=void 0,this.tabActionBars=[],this.clearEditorActionsToolbar(),this.updateTabsControlVisibility()}moveEditor(e,t,o){let n=this.tabLabels[t];this.tabLabels.splice(t,1),this.tabLabels.splice(o,0,n),this.forEachTab((r,s,l,c,u,p)=>{this.redrawTab(r,s,l,c,u,p)},Math.min(t,o),Math.max(t,o)),this.layout(this.dimensions,{forceRevealActiveTab:!0})}pinEditor(e){this.withTab(e,(t,o,n,r,s)=>this.redrawTabLabel(t,o,n,r,s))}stickEditor(e){this.doHandleStickyEditorChange(e)}unstickEditor(e){this.doHandleStickyEditorChange(e)}doHandleStickyEditorChange(e){this.withTab(e,(t,o,n,r,s,l)=>this.redrawTab(t,o,n,r,s,l)),this.forEachTab((t,o,n,r,s)=>{this.redrawTabBorders(o,n)}),this.layout(this.dimensions,{forceRevealActiveTab:!0})}setActive(e){this.forEachTab((t,o,n,r,s,l)=>{this.redrawTabSelectedActiveAndDirty(e,t,n,l)}),this.updateEditorActionsToolbar(),this.layout(this.dimensions,{forceRevealActiveTab:!0})}updateEditorSelections(){this.forEachTab((e,t,o,n,r,s)=>{this.redrawTabSelectedActiveAndDirty(this.groupsView.activeGroup===this.groupView,e,o,s)})}updateEditorLabel(e){this.updateEditorLabelScheduler.schedule()}doUpdateEditorLabels(){this.computeTabLabels(),this.forEachTab((e,t,o,n,r)=>{this.redrawTabLabel(e,t,o,n,r)}),this.layout(this.dimensions)}updateEditorDirty(e){this.withTab(e,(t,o,n,r,s,l)=>this.redrawTabSelectedActiveAndDirty(this.groupsView.activeGroup===this.groupView,t,n,l))}updateOptions(e,t){super.updateOptions(e,t),e.labelFormat!==t.labelFormat&&this.computeTabLabels(),e.titleScrollbarSizing!==t.titleScrollbarSizing&&this.updateTabsScrollbarSizing(),e.titleScrollbarVisibility!==t.titleScrollbarVisibility&&this.updateTabsScrollbarVisibility(),e.alwaysShowEditorActions!==t.alwaysShowEditorActions&&this.updateEditorActionsToolbar(),(e.tabSizingFixedMinWidth!==t.tabSizingFixedMinWidth||e.tabSizingFixedMaxWidth!==t.tabSizingFixedMaxWidth||e.tabSizing!==t.tabSizing)&&this.updateTabSizing(!0),(e.labelFormat!==t.labelFormat||e.tabActionLocation!==t.tabActionLocation||e.tabActionCloseVisibility!==t.tabActionCloseVisibility||e.tabActionUnpinVisibility!==t.tabActionUnpinVisibility||e.tabSizing!==t.tabSizing||e.pinnedTabSizing!==t.pinnedTabSizing||e.showIcons!==t.showIcons||e.hasIcons!==t.hasIcons||e.highlightModifiedTabs!==t.highlightModifiedTabs||e.wrapTabs!==t.wrapTabs||e.showTabIndex!==t.showTabIndex||!eo(e.decorations,t.decorations))&&this.redraw()}updateStyles(){this.redraw()}forEachTab(e,t,o){this.tabsModel.getEditors(1).forEach((n,r)=>{typeof t=="number"&&t>r||typeof o=="number"&&o<r||this.doWithTab(r,n,e)})}withTab(e,t){this.doWithTab(this.tabsModel.indexOf(e),e,t)}doWithTab(e,t,o){let r=Ci(this.tabsContainer).children[e],s=this.tabResourceLabels.get(e),l=this.tabLabels[e],c=this.tabActionBars[e];r&&s&&l&&o(t,e,r,s,l,c)}createTab(e,t,o){let n=_(".tab",{draggable:!0,role:"tab"}),r=Ms.addTarget(n),s=_(".tab-border-top-container");n.appendChild(s);let l=this.tabResourceLabels.create(n,{hoverTargetOverride:n}),c=_(".tab-actions");n.appendChild(c);let u=this,p=new jpe({groupId:this.groupView.id,get editorIndex(){return u.toEditorIndex(e)}}),h=new Zi(c,{ariaLabel:d(4334,null),actionRunner:p}),g=h.onWillRun(y=>{y.action.id===this.closeEditorAction.id&&this.blockRevealActiveTabOnce()}),f=wn(p,h,g,Z(ah(this.tabActionBars,h))),v=_(".tab-fade-hider");n.appendChild(v);let b=_(".tab-border-bottom-container");n.appendChild(b);let S=this.registerTabListeners(n,e,t,o);return this.tabDisposables.push(wn(r,S,f,l)),n}toEditorIndex(e){let t=Ci(this.tabsModel.getEditorByIndex(e));return this.groupView.getIndexOfEditor(t)}registerTabListeners(e,t,o,n){let r=new N,s=async(p,h)=>{if(e.blur(),Ru(p)&&(p.button!==0||Ze&&p.ctrlKey)){p.button===1&&p.preventDefault();return}if(this.originatesFromTabActionBar(p))return;let g=this.tabsModel.getEditorByIndex(t);if(g)if(p.shiftKey){let f;if(this.lastSingleSelectSelectedEditor&&this.tabsModel.isSelected(this.lastSingleSelectSelectedEditor))f=this.lastSingleSelectSelectedEditor;else{let v=Ci(this.groupView.activeEditor);this.lastSingleSelectSelectedEditor=v,f=v}await this.selectEditorsBetween(g,f)}else if(p.ctrlKey&&!Ze||p.metaKey&&Ze)this.tabsModel.isSelected(g)?await this.unselectEditor(g):(await this.selectEditor(g),this.lastSingleSelectSelectedEditor=g);else{let f=this.tabsModel.isSelected(g)?this.groupView.selectedEditors.filter(v=>!v.matches(g)):[];await this.groupView.openEditor(g,{preserveFocus:h,activation:1},{inactiveSelection:f,focusTabControl:!0})}},l=p=>{Xt.stop(p);let h=this.tabsModel.getEditorByIndex(t);h&&this.onTabContextMenu(h,p,e)};r.add(j(e,re.MOUSE_DOWN,p=>s(p,!1))),r.add(j(e,Kn.Tap,p=>s(p,!0))),r.add(j(e,Kn.Change,p=>{n.setScrollPosition({scrollLeft:n.getScrollPosition().scrollLeft-p.translationX})})),r.add(j(e,re.MOUSE_UP,async p=>{if(Xt.stop(p),e.blur(),Ru(p)&&(p.button!==0||Ze&&p.ctrlKey)||this.originatesFromTabActionBar(p))return;!(p.ctrlKey&&!Ze||p.metaKey&&Ze)&&!p.shiftKey&&this.groupView.selectedEditors.length>1&&await this.unselectAllEditors()})),r.add(j(e,re.AUXCLICK,p=>{if(p.button===1){Xt.stop(p,!0);let h=this.tabsModel.getEditorByIndex(t);if(h){if(REe(this.tabsModel,h,2,this.groupsView.partOptions))return;this.blockRevealActiveTabOnce(),this.closeEditorAction.run({groupId:this.groupView.id,editorIndex:this.groupView.getIndexOfEditor(h)})}}})),r.add(j(e,re.KEY_DOWN,p=>{let h=new gi(p);h.shiftKey&&h.keyCode===68&&l(p)})),r.add(j(e,Kn.Contextmenu,p=>{l(p)})),r.add(j(e,re.KEY_UP,p=>{let h=new gi(p),g=!1;if(h.equals(3)||h.equals(10)){g=!0;let f=this.tabsModel.getEditorByIndex(t);f&&this.groupView.openEditor(f)}else if([15,17,16,18,14,13].some(f=>h.equals(f))){let f=this.toEditorIndex(t);h.equals(15)||h.equals(16)?f=f-1:h.equals(17)||h.equals(18)?f=f+1:h.equals(14)?f=0:f=this.groupView.count-1;let v=this.groupView.getEditorByIndex(f);v&&(g=!0,this.groupView.openEditor(v,{preserveFocus:!0},{focusTabControl:!0}))}g&&Xt.stop(p,!0),n.setScrollPosition({scrollLeft:o.scrollLeft})}));for(let p of[Kn.Tap,re.DBLCLICK])r.add(j(e,p,h=>{if(p===re.DBLCLICK)Xt.stop(h);else if(h.tapCount!==2)return;let g=this.tabsModel.getEditorByIndex(t);if(g&&this.tabsModel.isPinned(g))switch(this.groupsView.partOptions.doubleClickTabToToggleEditorGroupSizes){case"maximize":this.groupsView.toggleMaximizeGroup(this.groupView);break;case"expand":this.groupsView.toggleExpandGroup(this.groupView);break;case"off":break}else this.groupView.pinEditor(g)}));r.add(j(e,re.CONTEXT_MENU,p=>{Xt.stop(p,!0);let h=this.tabsModel.getEditorByIndex(t);h&&this.onTabContextMenu(h,p,e)},!0));let c,u=!1;return r.add(new Uh(e,{onDragStart:p=>{let h=this.tabsModel.getEditorByIndex(t);if(!h)return;u=this.isNewWindowOperation(p);let g=this.groupView.selectedEditors;if(this.editorTransfer.setData(g.map(f=>new ev({editor:f,groupId:this.groupView.id})),ev.prototype),p.dataTransfer)if(p.dataTransfer.effectAllowed="copyMove",g.length>1){let f=`${h.getName()} + ${g.length-1}`;MP(p,e,f)}else{let f=this.groupsView.partOptions,v=this.tabsModel.isSticky(t);f.tabSizing==="shrink"||v&&f.pinnedTabSizing==="shrink"?MP(p,e,h.getName()):p.dataTransfer.setDragImage(e,0,0)}this.doFillResourceDataTransfers(g,p,u),Wr(Re(this.parent),()=>this.updateDropFeedback(e,!1,p,t))},onDrag:p=>{c=p},onDragEnter:p=>{if(!this.isSupportedDropTransfer(p)){p.dataTransfer&&(p.dataTransfer.dropEffect="none");return}this.editorTransfer.hasData(ev.prototype)||p.dataTransfer&&(p.dataTransfer.dropEffect="copy"),this.updateDropFeedback(e,!0,p,t)},onDragOver:(p,h)=>{if(h>=vI.DRAG_OVER_OPEN_TAB_THRESHOLD){let g=this.tabsModel.getEditorByIndex(t);g&&this.tabsModel.activeEditor!==g&&this.groupView.openEditor(g,{preserveFocus:!0})}this.updateDropFeedback(e,!0,p,t)},onDragEnd:async p=>{this.updateDropFeedback(e,!1,p,t);let h=this.editorTransfer.getData(ev.prototype);if(this.editorTransfer.clearData(ev.prototype),!u||AAt()||!h||h.length===0)return;let g=await this.maybeCreateAuxiliaryEditorPartAt(p,e);if(!g)return;let f=g.activeGroup,v=yJ(this.groupView,h.map(b=>b.identifier.editor));this.isMoveOperation(c??p,f.id,h[0].identifier.editor)?this.groupView.moveEditors(v,f):this.groupView.copyEditors(v,f),f.focus()},onDrop:p=>{this.updateDropFeedback(e,!1,p,t);let h=t;this.getTabDragOverLocation(p,e)==="right"&&h++,this.onDrop(p,h,o)}})),r}isSupportedDropTransfer(e){if(this.groupTransfer.hasData(gI.prototype)){let t=this.groupTransfer.getData(gI.prototype);return!(Array.isArray(t)&&t.length>0&&t[0].identifier===this.groupView.id)}return!!(this.editorTransfer.hasData(ev.prototype)||e.dataTransfer&&e.dataTransfer.types.length>0)}updateDropFeedback(e,t,o,n){let r=typeof n=="number",s;t?r?s=this.computeDropTarget(o,n,e):s={leftElement:e.lastElementChild,rightElement:void 0}:s=void 0,this.updateDropTarget(s)}updateDropTarget(e){let t=this.dropTarget;if(t===e||t&&e&&t.leftElement===e.leftElement&&t.rightElement===e.rightElement)return;let o="drop-target-left",n="drop-target-right";t&&(t.leftElement?.classList.remove(o),t.rightElement?.classList.remove(n)),e&&(e.leftElement?.classList.add(o),e.rightElement?.classList.add(n)),this.dropTarget=e}getTabDragOverLocation(e,t){let o=t.getBoundingClientRect();return e.clientX-o.left<=o.width/2?"left":"right"}computeDropTarget(e,t,o){let n=this.getTabDragOverLocation(e,o)==="left",r=t===this.tabsModel.count-1;if(n&&t===0)return{leftElement:void 0,rightElement:o};if(!n&&r)return{leftElement:o,rightElement:void 0};let l=n?o.previousElementSibling:o,c=n?o:o.nextElementSibling;return{leftElement:l,rightElement:c}}async selectEditor(e){this.groupView.isActive(e)||await this.groupView.setSelection(e,this.groupView.selectedEditors)}async selectEditorsBetween(e,t){let o=this.groupView.getIndexOfEditor(e);if(o===-1)throw new li;let n=this.groupView.getIndexOfEditor(t);if(n===-1)throw new li;let r=this.groupView.selectedEditors,s=n;for(;s>=0&&s<=this.groupView.count-1;){s=n<o?s-1:s+1;let h=this.groupView.getEditorByIndex(s);if(!h||!this.groupView.isSelected(h))break;r=r.filter(g=>!g.matches(h))}let l=n<o?n:o,c=n<o?o:n,u=this.groupView.getEditors(1).slice(l,c+1);for(let h of u)this.groupView.isSelected(h)||r.push(h);let p=r.filter(h=>!h.matches(e));await this.groupView.setSelection(e,p)}async unselectEditor(e){let t=this.groupView.isActive(e);if(t&&this.groupView.selectedEditors.length===1)return;let o=Ci(this.groupView.activeEditor);if(t){let r=this.groupView.getEditors(0);for(let s=1;s<r.length;s++){let l=r[s];if(this.groupView.isSelected(l)){o=l;break}}}let n=this.groupView.selectedEditors.filter(r=>!r.matches(e)&&!r.matches(o));await this.groupView.setSelection(o,n)}async unselectAllEditors(){if(this.groupView.selectedEditors.length>1){let e=Ci(this.groupView.activeEditor);await this.groupView.setSelection(e,[])}}computeTabLabels(){let{labelFormat:e}=this.groupsView.partOptions,{verbosity:t,shortenDuplicates:o}=this.getLabelConfigFlags(e),n=[],r=-1;this.tabsModel.getEditors(1).forEach((s,l)=>{n.push({editor:s,name:s.getName(),description:s.getDescription(t),forceDescription:s.hasCapability(64),title:s.getTitle(2),ariaLabel:IJ(s,l,this.groupView,this.editorPartsView.count)}),s===this.tabsModel.activeEditor&&(r=l)}),o&&this.shortenTabLabels(n),this.tabLabels=n,this.activeTabLabel=n[r]}shortenTabLabels(e){let t=new Map;for(let o of e)typeof o.description=="string"?aV(t,o.name,[]).push(o):o.description="";for(let[,o]of t){if(o.length===1&&!o[0].forceDescription){o[0].description="";continue}let n=new Map;for(let c of o)aV(n,c.description,[]).push(c);let r=!1;for(let[,c]of n)if(!r&&c.length>1){let[u,...p]=c.map(({editor:h})=>h.getDescription(2));r=p.some(h=>h!==u)}if(r){n.clear();for(let c of o)c.description=c.editor.getDescription(2),aV(n,c.description,[]).push(c)}let s=[];for(let[c]of n)s.push(c);if(s.length===1){for(let c of n.get(s[0])||[])c.forceDescription||(c.description="");continue}let l=awe(s,this.path.sep);s.forEach((c,u)=>{for(let p of n.get(c)||[])p.description=l[u]})}}getLabelConfigFlags(e){switch(e){case"short":return{verbosity:0,shortenDuplicates:!1};case"medium":return{verbosity:1,shortenDuplicates:!1};case"long":return{verbosity:2,shortenDuplicates:!1};default:return{verbosity:1,shortenDuplicates:!0}}}redraw(e){if(this.tabsAndActionsContainer){let t=this.getColor(sZi);!t&&uf(this.theme.type)&&(t=this.getColor(a6e)||this.getColor(bi)),t?(this.tabsAndActionsContainer.classList.add("tabs-border-bottom"),this.tabsAndActionsContainer.style.setProperty("--tabs-border-bottom-color",t.toString())):(this.tabsAndActionsContainer.classList.remove("tabs-border-bottom"),this.tabsAndActionsContainer.style.removeProperty("--tabs-border-bottom-color"))}this.forEachTab((t,o,n,r,s,l)=>{this.redrawTab(t,o,n,r,s,l)}),this.updateEditorActionsToolbar(),this.layout(this.dimensions,e)}redrawTab(e,t,o,n,r,s){let l=this.tabsModel.isSticky(t),c=this.groupsView.partOptions;this.redrawTabLabel(e,t,o,n,r);let u=l&&c.tabActionUnpinVisibility,p=!u&&c.tabActionCloseVisibility,h=u||p,g;h?g=u?this.unpinEditorAction:this.closeEditorAction:g=l?this.unpinEditorAction:this.closeEditorAction,s.hasAction(g)||(s.isEmpty()||s.clear(),s.push(g,{icon:!0,label:!1,keybinding:this.getKeybindingLabel(g)})),o.classList.toggle("pinned-action-off",l&&!u),o.classList.toggle("close-action-off",!u&&!p);for(let v of["left","right"])o.classList.toggle(`tab-actions-${v}`,h&&c.tabActionLocation===v);let f=l&&c.pinnedTabSizing==="shrink"?"shrink":c.tabSizing;for(let v of["fit","shrink","fixed"])o.classList.toggle(`sizing-${v}`,f===v);o.classList.toggle("has-icon",c.showIcons&&c.hasIcons),o.classList.toggle("sticky",l);for(let v of["normal","compact","shrink"])o.classList.toggle(`sticky-${v}`,l&&c.pinnedTabSizing===v);if(!c.wrapTabs&&l&&c.pinnedTabSizing!=="normal"){let v=0;switch(c.pinnedTabSizing){case"compact":v=vI.TAB_WIDTH.compact;break;case"shrink":v=vI.TAB_WIDTH.shrink;break}o.style.left=`${t*v}px`}else o.style.left="auto";this.redrawTabBorders(t,o),this.redrawTabSelectedActiveAndDirty(this.groupsView.activeGroup===this.groupView,e,o,s)}redrawTabLabel(e,t,o,n,r){let s=this.groupsView.partOptions,l,c,u=!1,p=!!s.decorations?.badges,h=!!s.decorations?.colors,g;s.pinnedTabSizing==="compact"&&this.tabsModel.isSticky(t)?(l=s.showIcons&&s.hasIcons?"":r.name?.charAt(0).toUpperCase(),g="",u=!0,p=!1):(l=r.name,c=s.showTabIndex?`${this.toEditorIndex(t)+1}: `:void 0,g=r.description||""),r.ariaLabel&&(o.setAttribute("aria-label",r.ariaLabel),o.setAttribute("aria-description","")),n.setResource({name:l,description:g,resource:po.getOriginalUri(e,{supportSideBySide:3})},{title:this.getHoverTitle(e),extraClasses:di(["tab-label",p?"tab-label-has-badge":void 0].concat(e.getLabelExtraClasses())),italic:!this.tabsModel.isPinned(e),forceLabel:u,fileDecorations:{colors:h,badges:p},icon:e.getIcon(),hideIcon:s.showIcons===!1,namePrefix:c});let f=po.getOriginalUri(e,{supportSideBySide:1});f?o.setAttribute("data-resource-name",Ga(f)):o.removeAttribute("data-resource-name")}redrawTabSelectedActiveAndDirty(e,t,o,n){let r=this.tabsModel.isActive(t),s=this.doRedrawTabDirty(e,r,t,o);this.doRedrawTabActive(e,!s,t,o,n)}doRedrawTabActive(e,t,o,n,r){let s=this.tabsModel.isActive(o),l=this.tabsModel.isSelected(o);if(n.classList.toggle("active",s),n.classList.toggle("selected",l),n.setAttribute("aria-selected",s?"true":"false"),n.tabIndex=s?0:-1,r.setFocusable(s),s){let u=this.getColor(e?yEe:ZJi);n.classList.toggle("tab-border-bottom",!!u),n.style.setProperty("--tab-border-bottom-color",u??"")}let c=null;t&&(s&&(c=this.getColor(e?s6e:eZi)),c===null&&l&&(c=this.getColor(tZi))),n.classList.toggle("tab-border-top",!!c),n.style.setProperty("--tab-border-top-color",c??"")}doRedrawTabDirty(e,t,o,n){let r=!1;if(o.isDirty()&&!o.isSaving())if(n.classList.add("dirty"),this.groupsView.partOptions.highlightModifiedTabs){let s;e&&t?s=this.getColor(wEe):e&&!t?s=this.getColor(Y_t):!e&&t?s=this.getColor(oZi):s=this.getColor(nZi),s&&(r=!0,n.classList.add("dirty-border-top"),n.style.setProperty("--tab-dirty-border-top-color",s))}else n.classList.remove("dirty-border-top"),n.style.removeProperty("--tab-dirty-border-top-color");else n.classList.remove("dirty","dirty-border-top"),n.style.removeProperty("--tab-dirty-border-top-color");return r}redrawTabBorders(e,t){let n=this.tabsModel.isSticky(e)&&this.tabsModel.stickyCount===e+1,r=this.tabsModel.stickyCount!==this.tabsModel.count,s=(n&&r?this.getColor(JJi):void 0)||this.getColor(a6e)||this.getColor(bi);t.style.borderRight=s?`1px solid ${s}`:"",t.style.outlineColor=this.getColor(Ys)||""}prepareEditorActions(e){return this.groupsView.activeGroup===this.groupView?e:{primary:this.groupsView.partOptions.alwaysShowEditorActions?e.primary:e.primary.filter(o=>o.id===x3),secondary:e.secondary}}getHeight(){return this.dimensions.used?this.dimensions.used.height:this.computeHeight()}computeHeight(){let e;return this.visible?this.groupsView.partOptions.wrapTabs&&this.tabsAndActionsContainer?.classList.contains("wrapping")?e=this.tabsAndActionsContainer.offsetHeight:e=this.tabHeight:e=0,e}layout(e,t){if(Object.assign(this.dimensions,e),this.visible){if(!this.layoutScheduler.value){let o=Wr(Re(this.parent),()=>{this.doLayout(this.dimensions,this.layoutScheduler.value?.options),this.layoutScheduler.clear()});this.layoutScheduler.value={options:t,dispose:()=>o.dispose()}}t?.forceRevealActiveTab&&(this.layoutScheduler.value.options={...this.layoutScheduler.value.options,forceRevealActiveTab:!0})}return this.dimensions.used||(this.dimensions.used=new si(e.container.width,this.computeHeight())),this.dimensions.used}doLayout(e,t){e.container!==si.None&&e.available!==si.None&&this.doLayoutTabs(e,t);let o=this.dimensions.used,n=this.dimensions.used=new si(e.container.width,this.computeHeight());o&&o.height!==n.height&&this.groupView.relayout()}doLayoutTabs(e,t){this.doLayoutTabsWrapping(e)||this.doLayoutTabsNonWrapping(t)}doLayoutTabsWrapping(e){let[t,o,n,r]=jy(this.tabsAndActionsContainer,this.tabsContainer,this.editorActionsToolbarContainer,this.tabsScrollbar),s=t.classList.contains("wrapping"),l=s;function c(u){l=u,t.classList.toggle("wrapping",l),o.style.setProperty("--last-tab-margin-right",l?`${n.offsetWidth}px`:"0");for(let p of o.children)p.classList.remove("last-in-row")}if(this.groupsView.partOptions.wrapTabs){let u=o.offsetWidth,p=o.scrollWidth,h=()=>{let g=this.getLastTab();return g?!(g.offsetWidth+n.offsetWidth-e.available.width>1):!0};(l||p>u&&h())&&c(!0),l&&(o.offsetHeight>e.available.height||p===u&&o.offsetHeight===this.tabHeight||!h())&&c(!1)}else s&&c(!1);if(l&&!s){let u=o.offsetWidth;r.setScrollDimensions({width:u,scrollWidth:u})}if(l){let u=new Map,p,h;for(let g of o.children){let f=g,v=f.offsetTop;v!==p&&(p=v,h&&u.set(h,!0)),h=f,u.set(f,!1)}h&&u.set(h,!0);for(let[g,f]of u)g.classList.toggle("last-in-row",f)}return l}doLayoutTabsNonWrapping(e){let[t,o]=jy(this.tabsContainer,this.tabsScrollbar),n=t.offsetWidth,r=t.scrollWidth,s=0;if(this.tabsModel.stickyCount>0){let T=0;switch(this.groupsView.partOptions.pinnedTabSizing){case"compact":T=vI.TAB_WIDTH.compact;break;case"shrink":T=vI.TAB_WIDTH.shrink;break}s=this.tabsModel.stickyCount*T}let l=this.tabsModel.activeEditor?this.getTabAndIndex(this.tabsModel.activeEditor):void 0,[c,u]=l??[void 0,void 0],p=this.groupsView.partOptions.pinnedTabSizing!=="normal"&&typeof u=="number"&&this.tabsModel.isSticky(u),h=n-s;this.tabsModel.stickyCount>0&&h<vI.TAB_WIDTH.fit?(t.classList.add("disable-sticky-tabs"),h=n,s=0,p=!1):t.classList.remove("disable-sticky-tabs");let g,f;!this.blockRevealActiveTab&&c&&(g=c.offsetLeft,f=c.offsetWidth);let{width:v,scrollWidth:b}=o.getScrollDimensions();o.setScrollDimensions({width:n,scrollWidth:r});let S=v!==n||b!==r;if(this.blockRevealActiveTab||typeof g!="number"||typeof f!="number"||p||!S&&!e?.forceRevealActiveTab){this.blockRevealActiveTab=!1;return}let y=o.getScrollPosition().scrollLeft,w=f<=h,k=g-s;w&&y+h<k+f?o.setScrollPosition({scrollLeft:y+(k+f-(y+h))}):(y>k||!w)&&o.setScrollPosition({scrollLeft:k})}updateTabsControlVisibility(){Ci(this.tabsAndActionsContainer).classList.toggle("empty",!this.visible),!this.visible&&this.dimensions&&(this.dimensions.used=void 0)}get visible(){return this.tabsModel.count>0}getTabAndIndex(e){let t=this.tabsModel.indexOf(e),o=this.getTabAtIndex(t);if(o)return[o,t]}getTabAtIndex(e){if(e>=0)return Ci(this.tabsContainer).children[e]}getLastTab(){return this.getTabAtIndex(this.tabsModel.count-1)}blockRevealActiveTabOnce(){this.blockRevealActiveTab=!0}originatesFromTabActionBar(e){let t;return Ru(e)?t=e.target||e.srcElement:t=e.initialTarget,!!Cg(t,"action-item","tab")}async onDrop(e,t,o){Xt.stop(e,!0),this.updateDropFeedback(o,!1,e,t),o.classList.remove("scroll");let n=this.tabsModel instanceof lRe?t+this.groupView.stickyCount:t,r={sticky:this.tabsModel instanceof aRe&&this.tabsModel.stickyCount===n,index:n};if(this.groupTransfer.hasData(gI.prototype)){let s=this.groupTransfer.getData(gI.prototype);if(Array.isArray(s)&&s.length>0){let l=this.editorPartsView.getGroup(s[0].identifier);if(l){let c={index:n};this.isMoveOperation(e,l.id)||(c.mode=0),this.groupsView.mergeGroup(l,this.groupView,c)}this.groupView.focus(),this.groupTransfer.clearData(gI.prototype)}}else if(this.editorTransfer.hasData(ev.prototype)){let s=this.editorTransfer.getData(ev.prototype);if(Array.isArray(s)&&s.length>0){let l=this.editorPartsView.getGroup(s[0].identifier.groupId);if(l)for(let c of s){let u=c.identifier.editor;if(l.id!==c.identifier.groupId)continue;let p=l.getIndexOfEditor(u);l===this.groupView&&p<n&&n--,this.isMoveOperation(e,c.identifier.groupId,u)?l.moveEditor(u,this.groupView,{...r,index:n}):l.copyEditor(u,this.groupView,{...r,index:n}),n++}}this.groupView.focus(),this.editorTransfer.clearData(ev.prototype)}else if(this.treeItemsTransfer.hasData(PC.prototype)){let s=this.treeItemsTransfer.getData(PC.prototype);if(Array.isArray(s)&&s.length>0){let l=[];for(let c of s){let u=await this.treeViewsDragAndDropService.removeDragOperationTransfer(c.identifier);if(u){let p=await PAt(u);l.push(...p.map(h=>({...h,options:{...h.options,pinned:!0,index:n}})))}}this.editorService.openEditors(l,this.groupView,{validateTrust:!0})}this.treeItemsTransfer.clearData(PC.prototype)}else this.instantiationService.createInstance(a0,{allowWorkspaceOpen:!1}).handleDrop(e,Re(this.parent),()=>this.groupView,()=>this.groupView.focus(),r)}dispose(){super.dispose(),this.tabDisposables=Be(this.tabDisposables)}};vI=I([m(5,Xe),m(6,F),m(7,X),m(8,_e),m(9,Ne),m(10,Ue),m(11,Le),m(12,ee),m(13,An),m(14,v5),m(15,Ka),m(16,Zt)],vI);is((a,i)=>{let e=a.getColor(a6e);e&&i.addRule(`
			.monaco-workbench .part.editor > .content .editor-group-container > .title > .tabs-and-actions-container.wrapping .tabs-container > .tab {
				border-bottom: 1px solid ${e};
			}
		`);let t=a.getColor(Ys);t&&i.addRule(`
			.monaco-workbench .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab.active,
			.monaco-workbench .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab.active:hover  {
				outline: 1px solid;
				outline-offset: -5px;
			}

			.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.selected:not(.active):not(:hover)  {
				outline: 1px dotted;
				outline-offset: -5px;
			}

			.monaco-workbench .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab.active:focus {
				outline-style: dashed;
			}

			.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.active {
				outline: 1px dotted;
				outline-offset: -5px;
			}

			.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab:hover  {
				outline: 1px dashed;
				outline-offset: -5px;
			}

			.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.active > .tab-actions .action-label,
			.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.active:hover > .tab-actions .action-label,
			.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.dirty > .tab-actions .action-label,
			.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sticky > .tab-actions .action-label,
			.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab:hover > .tab-actions .action-label {
				opacity: 1 !important;
			}
		`);let o=a.getColor(bi);o&&i.addRule(`
			.monaco-workbench .part.editor > .content .editor-group-container > .title .editor-actions {
				outline: 1px solid ${o}
			}
		`);let n=a.getColor($_t);n&&i.addRule(`
			.monaco-workbench .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab:not(.selected):hover {
				background-color: ${n} !important;
			}
		`);let r=a.getColor(YJi);r&&i.addRule(`
			.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab:not(.selected):hover  {
				background-color: ${r} !important;
			}
		`);let s=a.getColor(j_t);s&&i.addRule(`
			.monaco-workbench .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab:not(.selected):hover  {
				color: ${s} !important;
			}
		`);let l=a.getColor(XJi);l&&i.addRule(`
			.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab:not(.selected):hover  {
				color: ${l} !important;
			}
		`);let c=a.getColor(Q_t);c&&i.addRule(`
			.monaco-workbench .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab:hover > .tab-border-bottom-container {
				display: block;
				position: absolute;
				left: 0;
				pointer-events: none;
				width: 100%;
				z-index: 10;
				bottom: 0;
				height: 1px;
				background-color: ${c};
			}
		`);let u=a.getColor(iZi);if(u&&i.addRule(`
			.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab:hover > .tab-border-bottom-container  {
				display: block;
				position: absolute;
				left: 0;
				pointer-events: none;
				width: 100%;
				z-index: 10;
				bottom: 0;
				height: 1px;
				background-color: ${u};
			}
		`),!uf(a.type)&&!Jb&&!t){let p=CF(a),h=a.getColor(Ho),g=a.getColor(J_t),f=a.getColor(oT),v;g&&h&&(v=g.flatten(h,h,p));let b;g&&h&&f&&h&&(b=g.flatten(h,f,h,p));let S=(O,V,H=!1)=>`
			.monaco-workbench .part.editor > .content:not(.dragged-over) .editor-group-container${H?".active":""} > .title .tabs-container > .tab.sizing-shrink:not(.dragged):not(.sticky-compact):hover > .tab-label > .monaco-icon-label-container::after,
			.monaco-workbench .part.editor > .content:not(.dragged-over) .editor-group-container${H?".active":""} > .title .tabs-container > .tab.sizing-fixed:not(.dragged):not(.sticky-compact):hover > .tab-label > .monaco-icon-label-container::after {
				background: linear-gradient(to left, ${O}, transparent) !important;
			}

			.monaco-workbench .part.editor > .content.dragged-over .editor-group-container${H?".active":""} > .title .tabs-container > .tab.sizing-shrink:not(.dragged):not(.sticky-compact):hover > .tab-label > .monaco-icon-label-container::after,
			.monaco-workbench .part.editor > .content.dragged-over .editor-group-container${H?".active":""} > .title .tabs-container > .tab.sizing-fixed:not(.dragged):not(.sticky-compact):hover > .tab-label > .monaco-icon-label-container::after {
				background: linear-gradient(to left, ${V}, transparent) !important;
			}
		`;if(n&&v&&b){let O=n.flatten(v),V=n.flatten(b);i.addRule(S(O,V,!0))}if(r&&v&&b){let O=r.flatten(v),V=r.flatten(b);i.addRule(S(O,V))}if(f&&b){let O=f.flatten(b);i.addRule(`
				.monaco-workbench .part.editor > .content.dragged-over .editor-group-container.active > .title .tabs-container > .tab.sizing-shrink.dragged-over:not(.active):not(.dragged):not(.sticky-compact) > .tab-label > .monaco-icon-label-container::after,
				.monaco-workbench .part.editor > .content.dragged-over .editor-group-container:not(.active) > .title .tabs-container > .tab.sizing-shrink.dragged-over:not(.dragged):not(.sticky-compact) > .tab-label > .monaco-icon-label-container::after,
				.monaco-workbench .part.editor > .content.dragged-over .editor-group-container.active > .title .tabs-container > .tab.sizing-fixed.dragged-over:not(.active):not(.dragged):not(.sticky-compact) > .tab-label > .monaco-icon-label-container::after,
				.monaco-workbench .part.editor > .content.dragged-over .editor-group-container:not(.active) > .title .tabs-container > .tab.sizing-fixed.dragged-over:not(.dragged):not(.sticky-compact) > .tab-label > .monaco-icon-label-container::after {
					background: linear-gradient(to left, ${O}, transparent) !important;
				}
		`)}let y=(O,V,H,G)=>`
				.monaco-workbench .part.editor > .content:not(.dragged-over) .editor-group-container${H?".active":":not(.active)"} > .title .tabs-container > .tab.sizing-shrink${G?".active":""}:not(.dragged):not(.sticky-compact) > .tab-label > .monaco-icon-label-container::after,
				.monaco-workbench .part.editor > .content:not(.dragged-over) .editor-group-container${H?".active":":not(.active)"} > .title .tabs-container > .tab.sizing-fixed${G?".active":""}:not(.dragged):not(.sticky-compact) > .tab-label > .monaco-icon-label-container::after {
					background: linear-gradient(to left, ${O}, transparent);
				}

				.monaco-workbench .part.editor > .content.dragged-over .editor-group-container${H?".active":":not(.active)"} > .title .tabs-container > .tab.sizing-shrink${G?".active":""}:not(.dragged):not(.sticky-compact) > .tab-label > .monaco-icon-label-container::after,
				.monaco-workbench .part.editor > .content.dragged-over .editor-group-container${H?".active":":not(.active)"} > .title .tabs-container > .tab.sizing-fixed${G?".active":""}:not(.dragged):not(.sticky-compact) > .tab-label > .monaco-icon-label-container::after {
					background: linear-gradient(to left, ${V}, transparent);
				}
		`,w=a.getColor(X_t);if(w&&v&&b){let O=w.flatten(v),V=w.flatten(b);i.addRule(y(O,V,!0,!0))}let k=a.getColor($Ji);if(k&&v&&b){let O=k.flatten(v),V=k.flatten(b);i.addRule(y(O,V,!1,!0))}let T=a.getColor(Vmi);if(T&&v&&b){let O=T.flatten(v),V=T.flatten(b);i.addRule(y(O,V,!0,!1))}let P=a.getColor(jJi);if(P&&v&&b){let O=P.flatten(v),V=P.flatten(b);i.addRule(y(O,V,!1,!1))}}});var GWt=class extends WA{constructor(){super(...arguments);this.activeLabel=Object.create(null)}get breadcrumbsControl(){return this.breadcrumbsControlFactory?.control}create(e){super.create(e);let t=this.titleContainer=e;t.draggable=!0,this.registerContainerListeners(t),this._register(Ms.addTarget(t));let o=_(".label-container");return t.appendChild(o),this.editorLabel=this._register(this.instantiationService.createInstance(Tk,o,{})).element,this._register(j(this.editorLabel.element,re.CLICK,n=>this.onTitleLabelClick(n))),this.breadcrumbsControlFactory=this._register(this.instantiationService.createInstance(lee,o,this.groupView,{showFileIcons:!1,showSymbolIcons:!0,showDecorationColors:!1,widgetStyles:{...Tz,breadcrumbsBackground:We.transparent.toString()},showPlaceholder:!1,dragEditor:!0})),this._register(this.breadcrumbsControlFactory.onDidEnablementChange(()=>this.handleBreadcrumbsEnablementChange())),t.classList.toggle("breadcrumbs",!!this.breadcrumbsControl),this._register(Z(()=>t.classList.remove("breadcrumbs"))),this.createEditorActionsToolBar(t,["title-actions"]),t}registerContainerListeners(e){let t,o=!1;this._register(new Uh(e,{onDragStart:n=>{o=this.onGroupDragStart(n,e)},onDrag:n=>{t=n},onDragEnd:n=>{this.onGroupDragEnd(n,t,e,o)}})),this._register(j(e,re.DBLCLICK,n=>this.onTitleDoubleClick(n))),this._register(j(e,re.AUXCLICK,n=>this.onTitleAuxClick(n))),this._register(j(e,Kn.Tap,n=>this.onTitleTap(n)));for(let n of[re.CONTEXT_MENU,Kn.Contextmenu])this._register(j(e,n,r=>{this.tabsModel.activeEditor&&this.onTabContextMenu(this.tabsModel.activeEditor,r,e)}))}onTitleLabelClick(e){Xt.stop(e,!1),setTimeout(()=>this.quickInputService.quickAccess.show())}onTitleDoubleClick(e){Xt.stop(e),this.groupView.pinEditor()}onTitleAuxClick(e){e.button===1&&this.tabsModel.activeEditor&&(Xt.stop(e,!0),REe(this.tabsModel,this.tabsModel.activeEditor,2,this.groupsView.partOptions)||this.groupView.closeEditor(this.tabsModel.activeEditor))}onTitleTap(e){let t=e.initialTarget;!Do(t)||!this.editorLabel||!ts(t,this.editorLabel.element)||setTimeout(()=>this.quickInputService.quickAccess.show(),50)}openEditor(e){return this.doHandleOpenEditor()}openEditors(e){return this.doHandleOpenEditor()}doHandleOpenEditor(){let e=this.ifActiveEditorChanged(()=>this.redraw());return e||this.ifActiveEditorPropertiesChanged(()=>this.redraw()),e}beforeCloseEditor(e){}closeEditor(e){this.ifActiveEditorChanged(()=>this.redraw())}closeEditors(e){this.ifActiveEditorChanged(()=>this.redraw())}moveEditor(e,t,o){this.ifActiveEditorChanged(()=>this.redraw())}pinEditor(e){this.ifEditorIsActive(e,()=>this.redraw())}stickEditor(e){}unstickEditor(e){}setActive(e){this.redraw()}updateEditorSelections(){}updateEditorLabel(e){this.ifEditorIsActive(e,()=>this.redraw())}updateEditorDirty(e){this.ifEditorIsActive(e,()=>{let t=Ci(this.titleContainer);e.isDirty()&&!e.isSaving()?t.classList.add("dirty"):t.classList.remove("dirty")})}updateOptions(e,t){super.updateOptions(e,t),(e.labelFormat!==t.labelFormat||!eo(e.decorations,t.decorations))&&this.redraw()}updateStyles(){this.redraw()}handleBreadcrumbsEnablementChange(){Ci(this.titleContainer).classList.toggle("breadcrumbs",!!this.breadcrumbsControl),this.redraw()}ifActiveEditorChanged(e){return!this.activeLabel.editor&&this.tabsModel.activeEditor||this.activeLabel.editor&&!this.tabsModel.activeEditor||!this.activeLabel.editor||!this.tabsModel.isActive(this.activeLabel.editor)?(e(),!0):!1}ifActiveEditorPropertiesChanged(e){!this.activeLabel.editor||!this.tabsModel.activeEditor||this.activeLabel.pinned!==this.tabsModel.isPinned(this.tabsModel.activeEditor)&&e()}ifEditorIsActive(e,t){this.tabsModel.isActive(e)&&t()}redraw(){let e=this.tabsModel.activeEditor??void 0,t=this.groupsView.partOptions,o=e?this.tabsModel.isPinned(e):!1,n=this.groupsView.activeGroup===this.groupView;this.activeLabel={editor:e,pinned:o},this.breadcrumbsControl&&(n?(this.breadcrumbsControl.update(),this.breadcrumbsControl.domNode.classList.toggle("preview",!o)):this.breadcrumbsControl.hide());let[r,s]=jy(this.titleContainer,this.editorLabel);if(!e)r.classList.remove("dirty"),s.clear(),this.clearEditorActionsToolbar();else{this.updateEditorDirty(e);let{labelFormat:l}=this.groupsView.partOptions,c;this.breadcrumbsControl&&!this.breadcrumbsControl.isHidden()||l==="default"&&!n?c="":c=e.getDescription(this.getVerbosity(l))||"",s.setResource({resource:po.getOriginalUri(e,{supportSideBySide:3}),name:e.getName(),description:c},{title:this.getHoverTitle(e),italic:!o,extraClasses:["single-tab","title-label"].concat(e.getLabelExtraClasses()),fileDecorations:{colors:!!t.decorations?.colors,badges:!!t.decorations?.badges},icon:e.getIcon(),hideIcon:t.showIcons===!1}),n?r.style.color=this.getColor(IB)||"":r.style.color=this.getColor(QJi)||"",this.updateEditorActionsToolbar()}}getVerbosity(e){switch(e){case"short":return 0;case"long":return 2;default:return 1}}prepareEditorActions(e){return this.groupsView.activeGroup===this.groupView?e:{primary:this.groupsView.partOptions.alwaysShowEditorActions?e.primary:e.primary.filter(o=>o.id===dx||o.id===x3),secondary:e.secondary}}getHeight(){return this.tabHeight}layout(e){return this.breadcrumbsControl?.layout(void 0),new si(e.container.width,this.getHeight())}};var cRe=class extends x{constructor(e,t,o,n,r,s){super();this.parent=e;this.groupsView=o;this.groupView=n;this.model=r;this.instantiationService=s;let l=this._register(new aRe(this.model)),c=this._register(new lRe(this.model));this.stickyEditorTabsControl=this._register(this.instantiationService.createInstance(vI,this.parent,t,this.groupsView,this.groupView,l)),this.unstickyEditorTabsControl=this._register(this.instantiationService.createInstance(vI,this.parent,t,this.groupsView,this.groupView,c)),this.handleTabBarsStateChange()}handleTabBarsStateChange(){this.activeControl=this.model.activeEditor?this.getEditorTabsController(this.model.activeEditor):void 0,this.handleTabBarsLayoutChange()}handleTabBarsLayoutChange(){if(this.groupView.count===0)return;let e=this.parent.classList.contains("two-tab-bars"),t=this.groupView.count!==this.groupView.stickyCount&&this.groupView.stickyCount>0;this.parent.classList.toggle("two-tab-bars",t),e!==t&&this.groupView.relayout()}didActiveControlChange(){return this.activeControl!==(this.model.activeEditor?this.getEditorTabsController(this.model.activeEditor):void 0)}getEditorTabsController(e){return this.model.isSticky(e)?this.stickyEditorTabsControl:this.unstickyEditorTabsControl}openEditor(e,t){let o=this.didActiveControlChange(),r=this.getEditorTabsController(e).openEditor(e,t)||o;return r&&this.handleOpenedEditors(),r}openEditors(e){let t=e.filter(c=>this.model.isSticky(c)),o=e.filter(c=>!this.model.isSticky(c)),n=this.didActiveControlChange(),r=this.stickyEditorTabsControl.openEditors(t),s=this.unstickyEditorTabsControl.openEditors(o),l=r||s||n;return l&&this.handleOpenedEditors(),l}handleOpenedEditors(){this.handleTabBarsStateChange()}beforeCloseEditor(e){this.getEditorTabsController(e).beforeCloseEditor(e)}closeEditor(e){this.stickyEditorTabsControl.closeEditor(e),this.unstickyEditorTabsControl.closeEditor(e),this.handleClosedEditors()}closeEditors(e){let t=e.filter(n=>this.model.isSticky(n)),o=e.filter(n=>!this.model.isSticky(n));this.stickyEditorTabsControl.closeEditors(t),this.unstickyEditorTabsControl.closeEditors(o),this.handleClosedEditors()}handleClosedEditors(){this.handleTabBarsStateChange()}moveEditor(e,t,o,n){n?(this.model.isSticky(e)?(this.stickyEditorTabsControl.openEditor(e),this.unstickyEditorTabsControl.closeEditor(e)):(this.stickyEditorTabsControl.closeEditor(e),this.unstickyEditorTabsControl.openEditor(e)),this.handleTabBarsStateChange()):this.model.isSticky(e)?this.stickyEditorTabsControl.moveEditor(e,t,o,n):this.unstickyEditorTabsControl.moveEditor(e,t-this.model.stickyCount,o-this.model.stickyCount,n)}pinEditor(e){this.getEditorTabsController(e).pinEditor(e)}stickEditor(e){this.unstickyEditorTabsControl.closeEditor(e),this.stickyEditorTabsControl.openEditor(e),this.handleTabBarsStateChange()}unstickEditor(e){this.stickyEditorTabsControl.closeEditor(e),this.unstickyEditorTabsControl.openEditor(e),this.handleTabBarsStateChange()}setActive(e){this.stickyEditorTabsControl.setActive(e),this.unstickyEditorTabsControl.setActive(e)}updateEditorSelections(){this.stickyEditorTabsControl.updateEditorSelections(),this.unstickyEditorTabsControl.updateEditorSelections()}updateEditorLabel(e){this.getEditorTabsController(e).updateEditorLabel(e)}updateEditorDirty(e){this.getEditorTabsController(e).updateEditorDirty(e)}updateOptions(e,t){this.stickyEditorTabsControl.updateOptions(e,t),this.unstickyEditorTabsControl.updateOptions(e,t)}layout(e){let t=this.stickyEditorTabsControl.layout(e),o={container:e.container,available:new si(e.available.width,e.available.height-t.height)},n=this.unstickyEditorTabsControl.layout(o);return new si(e.container.width,t.height+n.height)}getHeight(){return this.stickyEditorTabsControl.getHeight()+this.unstickyEditorTabsControl.getHeight()}dispose(){this.parent.classList.toggle("two-tab-bars",!1),super.dispose()}};cRe=I([m(5,F)],cRe);var qWt=class extends WA{constructor(){super(...arguments);this.activeEditor=null}prepareEditorActions(e){return{primary:[],secondary:[]}}openEditor(e){return this.handleOpenedEditors()}openEditors(e){return this.handleOpenedEditors()}handleOpenedEditors(){let e=this.activeEditorChanged();return this.activeEditor=this.tabsModel.activeEditor,e}activeEditorChanged(){return!!(!this.activeEditor&&this.tabsModel.activeEditor||this.activeEditor&&!this.tabsModel.activeEditor||!this.activeEditor||!this.tabsModel.isActive(this.activeEditor))}beforeCloseEditor(e){}closeEditor(e){this.handleClosedEditors()}closeEditors(e){this.handleClosedEditors()}handleClosedEditors(){this.activeEditor=this.tabsModel.activeEditor}moveEditor(e,t,o){}pinEditor(e){}stickEditor(e){}unstickEditor(e){}setActive(e){}updateEditorSelections(){}updateEditorLabel(e){}updateEditorDirty(e){}getHeight(){return 0}layout(e){return new si(e.container.width,this.getHeight())}};var dRe=class extends yu{constructor(e,t,o,n,r,s,l){super(l);this.parent=e;this.editorPartsView=t;this.groupsView=o;this.groupView=n;this.model=r;this.instantiationService=s;this.editorTabsControlDisposable=this._register(new N);this.breadcrumbsControlDisposables=this._register(new N);this.editorTabsControl=this.createEditorTabsControl(),this.breadcrumbsControlFactory=this.createBreadcrumbsControl()}get breadcrumbsControl(){return this.breadcrumbsControlFactory?.control}createEditorTabsControl(){let e;switch(this.groupsView.partOptions.showTabs){case"none":e=qWt;break;case"single":e=GWt;break;default:e=this.groupsView.partOptions.pinnedTabsOnSeparateRow?cRe:vI;break}let t=this.instantiationService.createInstance(e,this.parent,this.editorPartsView,this.groupsView,this.groupView,this.model);return this.editorTabsControlDisposable.add(t)}createBreadcrumbsControl(){if(this.groupsView.partOptions.showTabs==="single")return;let e=_(".breadcrumbs-below-tabs");this.parent.appendChild(e);let t=this.breadcrumbsControlDisposables.add(this.instantiationService.createInstance(lee,e,this.groupView,{showFileIcons:!0,showSymbolIcons:!0,showDecorationColors:!1,showPlaceholder:!0,dragEditor:!1}));return this.breadcrumbsControlDisposables.add(t.onDidEnablementChange(()=>this.groupView.relayout())),this.breadcrumbsControlDisposables.add(t.onDidVisibilityChange(()=>this.groupView.relayout())),t}openEditor(e,t){let o=this.editorTabsControl.openEditor(e,t);this.handleOpenedEditors(o)}openEditors(e){let t=this.editorTabsControl.openEditors(e);this.handleOpenedEditors(t)}handleOpenedEditors(e){e?this.breadcrumbsControl?.update():this.breadcrumbsControl?.revealLast()}beforeCloseEditor(e){return this.editorTabsControl.beforeCloseEditor(e)}closeEditor(e){this.editorTabsControl.closeEditor(e),this.handleClosedEditors()}closeEditors(e){this.editorTabsControl.closeEditors(e),this.handleClosedEditors()}handleClosedEditors(){this.groupView.activeEditor||this.breadcrumbsControl?.update()}moveEditor(e,t,o,n){return this.editorTabsControl.moveEditor(e,t,o,n)}pinEditor(e){return this.editorTabsControl.pinEditor(e)}stickEditor(e){return this.editorTabsControl.stickEditor(e)}unstickEditor(e){return this.editorTabsControl.unstickEditor(e)}setActive(e){return this.editorTabsControl.setActive(e)}updateEditorSelections(){this.editorTabsControl.updateEditorSelections()}updateEditorLabel(e){return this.editorTabsControl.updateEditorLabel(e)}updateEditorDirty(e){return this.editorTabsControl.updateEditorDirty(e)}updateOptions(e,t){e.showTabs!==t.showTabs||t.showTabs!=="single"&&e.pinnedTabsOnSeparateRow!==t.pinnedTabsOnSeparateRow?(this.editorTabsControlDisposable.clear(),this.breadcrumbsControlDisposables.clear(),Rt(this.parent),this.editorTabsControl=this.createEditorTabsControl(),this.breadcrumbsControlFactory=this.createBreadcrumbsControl()):this.editorTabsControl.updateOptions(e,t)}layout(e){let t=this.editorTabsControl.layout(e),o;return this.breadcrumbsControl?.isHidden()===!1&&(o=new si(e.container.width,Rc.HEIGHT),this.breadcrumbsControl.layout(o)),new si(e.container.width,t.height+(o?o.height:0))}getHeight(){let e=this.editorTabsControl.getHeight(),t=this.breadcrumbsControl?.isHidden()===!1?Rc.HEIGHT:0;return{total:e+t,offset:e}}};dRe=I([m(5,F),m(6,Le)],dRe);var Wb=class extends yu{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,P,O){super(u);this.editorPartsView=t;this.groupsView=o;this.groupsLabel=n;this._index=r;this.instantiationService=l;this.contextKeyService=c;this.telemetryService=p;this.keybindingService=h;this.menuService=g;this.contextMenuService=f;this.fileDialogService=v;this.editorService=b;this.filesConfigurationService=S;this.uriIdentityService=y;this.logService=w;this.editorResolverService=k;this.hostService=T;this.dialogService=P;this.fileService=O;this._onDidFocus=this._register(new E);this.onDidFocus=this._onDidFocus.event;this._onWillDispose=this._register(new E);this.onWillDispose=this._onWillDispose.event;this._onDidModelChange=this._register(new E);this.onDidModelChange=this._onDidModelChange.event;this._onDidActiveEditorChange=this._register(new E);this.onDidActiveEditorChange=this._onDidActiveEditorChange.event;this._onDidOpenEditorFail=this._register(new E);this.onDidOpenEditorFail=this._onDidOpenEditorFail.event;this._onWillCloseEditor=this._register(new E);this.onWillCloseEditor=this._onWillCloseEditor.event;this._onDidCloseEditor=this._register(new E);this.onDidCloseEditor=this._onDidCloseEditor.event;this._onWillMoveEditor=this._register(new E);this.onWillMoveEditor=this._onWillMoveEditor.event;this._onWillOpenEditor=this._register(new E);this.onWillOpenEditor=this._onWillOpenEditor.event;this.disposedEditorsWorker=this._register(new pP(e=>this.handleDisposedEditors(e),0));this.mapEditorToPendingConfirmation=new Map;this.containerToolBarMenuDisposable=this._register(new me);this.whenRestoredPromise=new Ko;this.whenRestored=this.whenRestoredPromise.p;this._disposed=!1;this.element=_("div");this._onDidChange=this._register(new Bh);this.onDidChange=this._onDidChange.event;e instanceof Wb?this.model=this._register(e.model.clone()):z9e(e)?this.model=this._register(l.createInstance(mA,e)):this.model=this._register(l.createInstance(mA,void 0)),this.scopedContextKeyService=this._register(this.contextKeyService.createScoped(this.element)),this.element.classList.add(...di(["editor-group-container",this.model.isLocked?"locked":void 0])),this.registerContainerListeners(),this.createContainerToolbar(),this.createContainerContextMenu(),this._register(this.instantiationService.createInstance(lM,this.element)),this.progressBar=this._register(new Zf(this.element,vw)),this.progressBar.hide(),this.scopedInstantiationService=this._register(this.instantiationService.createChild(new _o([X,this.scopedContextKeyService],[wd,this._register(new uAt(this.progressBar,this))]))),this.resourceContext=this._register(this.scopedInstantiationService.createInstance(Wo)),this.handleGroupContextKeys(),this.titleContainer=_(".title"),this.element.appendChild(this.titleContainer),this.titleControl=this._register(this.scopedInstantiationService.createInstance(dRe,this.titleContainer,this.editorPartsView,this.groupsView,this,this.model)),this.editorContainer=_(".editor-container"),this.element.appendChild(this.editorContainer),this.editorPane=this._register(this.scopedInstantiationService.createInstance(tRe,this.element,this.editorContainer,this)),this._onDidChange.input=this.editorPane.onDidChangeSizeConstraints,this.doTrackFocus(),this.updateTitleContainer(),this.updateContainer(),this.updateStyles(),(this.restoreEditors(e,s)??Promise.resolve()).finally(()=>{this.whenRestoredPromise.complete()}),this.registerListeners()}static createNew(e,t,o,n,r,s){return r.createInstance(Wb,null,e,t,o,n,s)}static createFromSerialized(e,t,o,n,r,s,l){return s.createInstance(Wb,e,t,o,n,r,l)}static createCopy(e,t,o,n,r,s,l){return s.createInstance(Wb,e,t,o,n,r,l)}handleGroupContextKeys(){let e=this.editorPartsView.bind(qde,this),t=this.editorPartsView.bind(UEe,this),o=this.editorPartsView.bind(FDt,this),n=this.editorPartsView.bind($de,this),r=this.editorPartsView.bind(VR,this),s=this.editorPartsView.bind(BDt,this),l=this.editorPartsView.bind(aT,this),c=o4.bindTo(this.scopedContextKeyService),u=HDt.bindTo(this.scopedContextKeyService),p=UDt.bindTo(this.scopedContextKeyService),h=this.editorPartsView.bind(fr,this),g=this.editorPartsView.bind(beo,this),f=this.editorPartsView.bind(VDt,this),v=this.editorPartsView.bind(WDt,this),b=this.editorPartsView.bind(zEe,this),S=this.editorPartsView.bind(T6e,this),y=this.editorPartsView.bind(bS,this),w=this.editorPartsView.bind(MF,this),k=this.editorPartsView.bind(wB,this),T=this.editorPartsView.bind(VC,this),P=this._register(new me),O=()=>{P.clear(),this.scopedContextKeyService.bufferChangeEvents(()=>{let H=this.activeEditor,G=this.activeEditorPane;if(this.resourceContext.set(po.getOriginalUri(H,{supportSideBySide:1})),$Dt(w,H,this.editorResolverService),H?(k.set(H.hasCapability(32)),T.set(H.typeId===Ma.ID),e.set(H.isDirty()&&!H.isSaving()),P.value=H.onDidChangeDirty(()=>{e.set(H.isDirty()&&!H.isSaving())})):(k.set(!1),T.set(!1),e.set(!1)),G){h.set(G.getId()),f.set(!G.input.hasCapability(4)),g.set(!!G.input.isReadonly());let $=po.getOriginalUri(G.input,{supportSideBySide:1}),J=po.getOriginalUri(G.input,{supportSideBySide:2});b.set(G.input instanceof Pa&&!G.input.original.isReadonly()&&!!$&&(this.fileService.hasProvider($)||$.scheme===Q.untitled)&&!!J&&(this.fileService.hasProvider(J)||J.scheme===Q.untitled)),v.set(!!$&&this.fileService.hasProvider($)&&!this.fileService.hasCapability($,2048));let ae=G?.getId()===WX;y.set(ae),S.set(ae)}else h.reset(),f.reset(),g.reset(),b.reset(),v.reset()})},V=H=>{switch(H.kind){case 3:l.set(this.isLocked);break;case 8:o.set(this.model.isFirst(this.model.activeEditor)),n.set(this.model.isLast(this.model.activeEditor)),t.set(this.model.activeEditor?this.model.isPinned(this.model.activeEditor):!1),r.set(this.model.activeEditor?this.model.isSticky(this.model.activeEditor):!1);break;case 6:t.set(this.model.activeEditor?this.model.isPinned(this.model.activeEditor):!1),r.set(this.model.activeEditor?this.model.isSticky(this.model.activeEditor):!1);break;case 5:case 7:o.set(this.model.isFirst(this.model.activeEditor)),n.set(this.model.isLast(this.model.activeEditor));break;case 11:H.editor&&H.editor===this.model.activeEditor&&t.set(this.model.isPinned(this.model.activeEditor));break;case 13:H.editor&&H.editor===this.model.activeEditor&&r.set(this.model.isSticky(this.model.activeEditor));break;case 4:c.set(this.model.selectedEditors.length>1),u.set(this.model.selectedEditors.length===2),p.set(this.model.selectedEditors.every(G=>G.resource&&(this.fileService.hasProvider(G.resource)||G.resource.scheme===Q.untitled)));break}s.set(this.count)};this._register(this.onDidModelChange(H=>V(H))),this._register(this.onDidActiveEditorChange(()=>O())),O(),V({kind:8}),V({kind:3})}registerContainerListeners(){this._register(j(this.element,re.DBLCLICK,e=>{this.isEmpty&&(Xt.stop(e),this.editorService.openEditor({resource:void 0,options:{pinned:!0,override:la.id}},this.id))})),this._register(j(this.element,re.AUXCLICK,e=>{this.isEmpty&&e.button===1&&(Xt.stop(e,!0),this.groupsView.removeGroup(this))}))}createContainerToolbar(){let e=_(".editor-group-container-toolbar");this.element.appendChild(e);let t=this._register(new Zi(e,{ariaLabel:d(4231,null),highlightToggledItems:!0})),o=this._register(this.menuService.createMenu(D.EmptyEditorGroup,this.scopedContextKeyService)),n=()=>{this.containerToolBarMenuDisposable.value=Z(()=>t.clear());let r=ml(o.getActions({arg:{groupId:this.id},shouldForwardArgs:!0}),"navigation");for(let s of[...r.primary,...r.secondary]){let l=this.keybindingService.lookupKeybinding(s.id);t.push(s,{icon:!0,label:!1,keybinding:l?.getLabel()})}};n(),this._register(o.onDidChange(n))}createContainerContextMenu(){this._register(j(this.element,re.CONTEXT_MENU,e=>this.onShowContainerContextMenu(e))),this._register(j(this.element,Kn.Contextmenu,()=>this.onShowContainerContextMenu()))}onShowContainerContextMenu(e){if(!this.isEmpty)return;let t=this.element;e&&(t=new Cn(Re(this.element),e)),this.contextMenuService.showContextMenu({menuId:D.EmptyEditorGroupContext,contextKeyService:this.contextKeyService,getAnchor:()=>t,onHide:()=>this.focus()})}doTrackFocus(){let e=this._register(qn(this.element));this._register(e.onDidFocus(()=>{this.isEmpty&&this._onDidFocus.fire()}));let t=o=>{let n;if(Ru(o)){if(o.button!==0||Ze&&o.ctrlKey)return;n=o.target}else n=o.initialTarget;Cg(n,"monaco-action-bar",this.titleContainer)||Cg(n,"monaco-breadcrumb-item",this.titleContainer)||setTimeout(()=>{this.focus()})};this._register(j(this.titleContainer,re.MOUSE_DOWN,o=>t(o))),this._register(j(this.titleContainer,Kn.Tap,o=>t(o))),this._register(this.editorPane.onDidFocus(()=>{this._onDidFocus.fire()}))}updateContainer(){this.isEmpty?(this.element.classList.add("empty"),this.element.tabIndex=0,this.element.setAttribute("aria-label",d(4232,null,this.ariaLabel))):(this.element.classList.remove("empty"),this.element.removeAttribute("tabIndex"),this.element.removeAttribute("aria-label")),this.updateStyles()}updateTitleContainer(){this.titleContainer.classList.toggle("tabs",this.groupsView.partOptions.showTabs==="multiple"),this.titleContainer.classList.toggle("show-file-icons",this.groupsView.partOptions.showIcons)}restoreEditors(e,t){if(this.count===0)return;let o;e instanceof Wb?o=dgi(e):o=Object.create(null);let n=this.model.activeEditor;if(!n)return;o.pinned=this.model.isPinned(n),o.sticky=this.model.isSticky(n),o.preserveFocus=!0;let r={preserveWindowOrder:!0,skipTitleUpdate:!0},s=Nn(),l=this.doShowEditor(n,{active:!0,isNew:!1},o,r).then(()=>{this.groupsView.activeGroup===this&&s&&wa(s)&&!t?.preserveFocus&&this.focus()});return this.titleControl.openEditors(this.editors),l}registerListeners(){this._register(this.model.onDidModelChange(e=>this.onDidGroupModelChange(e))),this._register(this.groupsView.onDidChangeEditorPartOptions(e=>this.onDidChangeEditorPartOptions(e))),this._register(this.groupsView.onDidVisibilityChange(e=>this.onDidVisibilityChange(e))),this._register(this.onDidFocus(()=>this.onDidGainFocus()))}onDidGroupModelChange(e){switch(this._onDidModelChange.fire(e),e.kind){case 3:this.element.classList.toggle("locked",this.isLocked);break;case 4:this.onDidChangeEditorSelection();break}if(e.editor)switch(e.kind){case 5:eio(e)&&this.onDidOpenEditor(e.editor,e.editorIndex);break;case 6:iio(e)&&this.handleOnDidCloseEditor(e.editor,e.editorIndex,e.context,e.sticky);break;case 15:this.onWillDisposeEditor(e.editor);break;case 14:this.onDidChangeEditorDirty(e.editor);break;case 12:this.onDidChangeEditorTransient(e.editor);break;case 9:this.onDidChangeEditorLabel(e.editor);break}}onDidOpenEditor(e,t){this.telemetryService.publicLog("editorOpened",this.toEditorTelemetryDescriptor(e)),this.updateContainer()}handleOnDidCloseEditor(e,t,o,n){this._onWillCloseEditor.fire({groupId:this.id,editor:e,context:o,index:t,sticky:n});let r=[e];e instanceof Ma&&r.push(e.primary,e.secondary);for(let s of r)this.canDispose(s)&&s.dispose();this.updateContainer(),this._onDidCloseEditor.fire({groupId:this.id,editor:e,context:o,index:t,sticky:n})}canDispose(e){for(let t of this.editorPartsView.groups)if(t instanceof Wb&&t.model.contains(e,{strictEquals:!0,supportSideBySide:4}))return!1;return!0}toResourceTelemetryDescriptor(e){if(!e)return;let t=e?e.scheme===Q.file?e.fsPath:e.path:void 0;if(!t)return;let o=es(e),n=o.indexOf("?");return o=n!==-1?o.substr(0,n):o,{mimeType:new sg(K_e(e).join(", ")),scheme:e.scheme,ext:o,path:_r(t)}}toEditorTelemetryDescriptor(e){let t=e.getTelemetryDescriptor(),o=po.getOriginalUri(e,{supportSideBySide:3});return A.isUri(o)?(t.resource=this.toResourceTelemetryDescriptor(o),t):(o&&(o.primary&&(t.resource=this.toResourceTelemetryDescriptor(o.primary)),o.secondary&&(t.resourceSecondary=this.toResourceTelemetryDescriptor(o.secondary))),t)}onWillDisposeEditor(e){this.disposedEditorsWorker.work(e)}handleDisposedEditors(e){let t,o=[];for(let n of e){let r=this.model.findEditor(n);if(!r)continue;let s=r[0];s.isDisposed()&&(this.model.isActive(s)?t=s:o.push(s))}for(let n of o)this.doCloseEditor(n,!0);t&&this.doCloseEditor(t,!0)}onDidChangeEditorPartOptions(e){this.updateTitleContainer(),this.titleControl.updateOptions(e.oldPartOptions,e.newPartOptions),(e.oldPartOptions.showTabs!==e.newPartOptions.showTabs||e.oldPartOptions.tabHeight!==e.newPartOptions.tabHeight||e.oldPartOptions.showTabs==="multiple"&&e.oldPartOptions.pinnedTabsOnSeparateRow!==e.newPartOptions.pinnedTabsOnSeparateRow)&&(this.relayout(),this.model.activeEditor&&this.titleControl.openEditors(this.model.getEditors(1))),this.updateStyles(),e.oldPartOptions.enablePreview&&!e.newPartOptions.enablePreview&&this.model.previewEditor&&this.pinEditor(this.model.previewEditor)}onDidChangeEditorDirty(e){this.pinEditor(e),this.titleControl.updateEditorDirty(e)}onDidChangeEditorTransient(e){!this.model.isTransient(e)&&!this.groupsView.partOptions.enablePreview&&this.pinEditor(e)}onDidChangeEditorLabel(e){this.titleControl.updateEditorLabel(e)}onDidChangeEditorSelection(){this.titleControl.updateEditorSelections()}onDidVisibilityChange(e){this.editorPane.setVisible(e)}onDidGainFocus(){this.activeEditor&&this.model.setTransient(this.activeEditor,!1)}get index(){return this._index}get label(){return this.groupsLabel?d(4236,null,this.groupsLabel,this._index+1):d(4235,null,this._index+1)}get ariaLabel(){return this.groupsLabel?d(4234,null,this.groupsLabel,this._index+1):d(4233,null,this._index+1)}get disposed(){return this._disposed}get isEmpty(){return this.count===0}get titleHeight(){return this.titleControl.getHeight()}notifyIndexChanged(e){this._index!==e&&(this._index=e,this.model.setIndex(e))}notifyLabelChanged(e){this.groupsLabel!==e&&(this.groupsLabel=e,this.model.setLabel(e))}setActive(e){this.active=e,!e&&this.activeEditor&&this.selectedEditors.length>1&&this.setSelection(this.activeEditor,[]),this.element.classList.toggle("active",e),this.element.classList.toggle("inactive",!e),this.titleControl.setActive(e),this.updateStyles(),this.model.setActive(void 0)}get id(){return this.model.id}get windowId(){return this.groupsView.windowId}get editors(){return this.model.getEditors(1)}get count(){return this.model.count}get stickyCount(){return this.model.stickyCount}get activeEditorPane(){return this.editorPane?this.editorPane.activeEditorPane??void 0:void 0}get activeEditor(){return this.model.activeEditor}get selectedEditors(){return this.model.selectedEditors}get previewEditor(){return this.model.previewEditor}isPinned(e){return this.model.isPinned(e)}isSticky(e){return this.model.isSticky(e)}isSelected(e){return this.model.isSelected(e)}isTransient(e){return this.model.isTransient(e)}isActive(e){return this.model.isActive(e)}async setSelection(e,t){this.isActive(e)?this.model.setSelection(e,t):await this.openEditor(e,{activation:1},{inactiveSelection:t})}contains(e,t){return this.model.contains(e,t)}getEditors(e,t){return this.model.getEditors(e,t)}findEditors(e,t){let o=this.uriIdentityService.asCanonicalUri(e);return this.getEditors(t?.order??1).filter(n=>{if(n.resource&&Qe(n.resource,o))return!0;if(t?.supportSideBySide===1||t?.supportSideBySide===4){let r=po.getCanonicalUri(n,{supportSideBySide:1});if(r&&Qe(r,o))return!0}if(t?.supportSideBySide===2||t?.supportSideBySide===4){let r=po.getCanonicalUri(n,{supportSideBySide:2});if(r&&Qe(r,o))return!0}return!1})}getEditorByIndex(e){return this.model.getEditorByIndex(e)}getIndexOfEditor(e){return this.model.indexOf(e)}isFirst(e){return this.model.isFirst(e)}isLast(e){return this.model.isLast(e)}focus(){this.activeEditorPane?this.activeEditorPane.focus():this.element.focus(),this._onDidFocus.fire()}pinEditor(e=this.activeEditor||void 0){if(e&&!this.model.isPinned(e)){let t=this.model.pin(e);t&&this.titleControl.pinEditor(t)}}stickEditor(e=this.activeEditor||void 0){this.doStickEditor(e,!0)}unstickEditor(e=this.activeEditor||void 0){this.doStickEditor(e,!1)}doStickEditor(e,t){if(e&&this.model.isSticky(e)!==t){let o=this.getIndexOfEditor(e),n=t?this.model.stick(e):this.model.unstick(e);if(!n)return;let r=this.getIndexOfEditor(n);r!==o&&this.titleControl.moveEditor(n,o,r,!0),t?this.titleControl.stickEditor(n):this.titleControl.unstickEditor(n)}}async openEditor(e,t,o){return this.doOpenEditor(e,t,{...o,supportSideBySide:3})}async doOpenEditor(e,t,o){if(!e||e.isDisposed())return;this._onWillOpenEditor.fire({editor:e,groupId:this.id});let n=t?.sticky||!this.groupsView.partOptions.enablePreview&&!t?.transient||e.isDirty()||(t?.pinned??typeof t?.index=="number")||typeof t?.index=="number"&&this.model.isSticky(t.index)||e.hasCapability(512),r={index:t?t.index:void 0,pinned:n,sticky:t?.sticky||typeof t?.index=="number"&&this.model.isSticky(t.index),transient:!!t?.transient,inactiveSelection:o?.inactiveSelection,active:this.count===0||!t?.inactive,supportSideBySide:o?.supportSideBySide};!r.active&&!r.pinned&&this.model.activeEditor&&!this.model.isPinned(this.model.activeEditor)&&(r.active=!0);let s=!1,l=!1;if(t?.activation===1?s=!0:t?.activation===2?l=!0:t?.activation===3?(s=!1,l=!1):r.active&&(s=!t?.preserveFocus,l=!s),typeof r.index=="number"){let h=this.model.indexOf(e);h!==-1&&h!==r.index&&this.doMoveEditorInsideGroup(e,r)}let{editor:c,isNew:u}=this.model.openEditor(e,r);u&&this.count===1&&this.editorPartsView.groups.length>1&&c.editorId&&this.groupsView.partOptions.autoLockGroups?.has(c.editorId)&&this.lock(!0);let p=this.doShowEditor(c,{active:!!r.active,isNew:u},t,o);return s?this.groupsView.activateGroup(this):l&&this.groupsView.restoreGroup(this),p}doShowEditor(e,t,o,n){let r;return t.active?r=(async()=>{let{pane:s,changed:l,cancelled:c,error:u}=await this.editorPane.openEditor(e,o,n,{newInGroup:t.isNew});if(!c)return l&&this._onDidActiveEditorChange.fire({editor:e}),u&&this._onDidOpenEditorFail.fire(e),!s&&this.activeEditor===e&&this.doCloseEditor(e,o?.preserveFocus,{fromError:!0}),s})():r=Promise.resolve(void 0),n?.skipTitleUpdate||this.titleControl.openEditor(e,n),r}async openEditors(e){let t=di(e).filter(({editor:l})=>!l.isDisposed()),o=t.at(0);if(!o)return;let n={supportSideBySide:3};await this.doOpenEditor(o.editor,o.options,n);let r=t.slice(1),s=this.getIndexOfEditor(o.editor)+1;return await dn.settled(r.map(({editor:l,options:c},u)=>this.doOpenEditor(l,{...c,inactive:!0,pinned:!0,index:s+u},{...n,skipTitleUpdate:!0}))),this.titleControl.openEditors(r.map(({editor:l})=>l)),this.editorPane.activeEditorPane??void 0}moveEditors(e,t){let o={skipTitleUpdate:this!==t},n=!1,r=new Set;for(let{editor:s,options:l}of e)this.moveEditor(s,t,l,o)?r.add(s):n=!0;return o.skipTitleUpdate&&(t.titleControl.openEditors(Array.from(r)),this.titleControl.closeEditors(Array.from(r))),!n}moveEditor(e,t,o,n){return this===t?(this.doMoveEditorInsideGroup(e,o),!0):this.doMoveOrCopyEditorAcrossGroups(e,t,o,{...n,keepCopy:!1})}doMoveEditorInsideGroup(e,t){let o=t?t.index:void 0;if(typeof o!="number")return;let n=this.model.indexOf(e),r=this.model.getEditorByIndex(n);if(r){if(n!==o){let s=this.model.stickyCount;this.model.moveEditor(r,o),this.model.pin(r),this.titleControl.moveEditor(r,n,o,s!==this.model.stickyCount),this.titleControl.pinEditor(r)}t?.sticky&&this.stickEditor(r)}}doMoveOrCopyEditorAcrossGroups(e,t,o,n){let r=n?.keepCopy;if(!r||e.hasCapability(8)){let l=e.canMove(this.id,t.id);if(typeof l=="string")return this.dialogService.error(l,d(4237,null)),!1}let s=dgi(this,e,{...o,pinned:!0,sticky:o?.sticky??(!r&&this.model.isSticky(e))});return r||this._onWillMoveEditor.fire({groupId:this.id,editor:e,target:t.id}),t.doOpenEditor(r?e.copy():e,s,n),r||this.doCloseEditor(e,!0,{...n,context:2}),!0}copyEditors(e,t){let o={skipTitleUpdate:this!==t};for(let{editor:n,options:r}of e)this.copyEditor(n,t,r,o);if(o.skipTitleUpdate){let n=e.map(({editor:r})=>r);t.titleControl.openEditors(n)}}copyEditor(e,t,o,n){this===t?this.doMoveEditorInsideGroup(e,o):this.doMoveOrCopyEditorAcrossGroups(e,t,o,{...n,keepCopy:!0})}async closeEditor(e=this.activeEditor||void 0,t){return this.doCloseEditorWithConfirmationHandling(e,t)}async doCloseEditorWithConfirmationHandling(e=this.activeEditor||void 0,t,o){return!e||await this.handleCloseConfirmation([e])?!1:(this.doCloseEditor(e,t?.preserveFocus,o),!0)}doCloseEditor(e,t=this.groupsView.activeGroup!==this,o){o?.skipTitleUpdate||this.titleControl.beforeCloseEditor(e),this.model.isActive(e)?this.doCloseActiveEditor(t,o):this.doCloseInactiveEditor(e,o),o?.skipTitleUpdate||this.titleControl.closeEditor(e)}doCloseActiveEditor(e=this.groupsView.activeGroup!==this,t){let o=this.activeEditor,n=!e&&this.shouldRestoreFocus(this.element),r=this.groupsView.partOptions.closeEmptyGroups;if(r&&this.active&&this.count===1){let c=this.groupsView.getGroups(1)[1];c&&(n?c.focus():this.groupsView.activateGroup(c,!0))}o&&this.model.closeEditor(o,t?.context);let s=this.model.activeEditor;if(s){let l;e&&this.groupsView.activeGroup!==this&&(l=3);let c={preserveFocus:e,activation:l,ignoreError:t?.fromError},u={preserveWindowOrder:!0};this.doOpenEditor(s,c,u)}else o&&this.editorPane.closeEditor(o),n&&!r&&this.focus(),this._onDidActiveEditorChange.fire({editor:void 0}),r&&this.groupsView.removeGroup(this,e)}shouldRestoreFocus(e){let t=Nn();return t===e.ownerDocument.body?!0:ts(t,e)}doCloseInactiveEditor(e,t){this.model.closeEditor(e,t?.context)}async handleCloseConfirmation(e){if(!e.length)return!1;let t=e.shift(),o=this.mapEditorToPendingConfirmation.get(t);o||(o=this.doHandleCloseConfirmation(t),this.mapEditorToPendingConfirmation.set(t,o));let n;try{n=await o}finally{this.mapEditorToPendingConfirmation.delete(t)}return n||this.handleCloseConfirmation(e)}async doHandleCloseConfirmation(e,t){if(!this.shouldConfirmClose(e)||e instanceof Ma&&this.model.contains(e.primary)||this.editorPartsView.groups.some(s=>{if(s===this)return!1;let l=s;return!!(l.contains(e,{supportSideBySide:3})||e instanceof Ma&&l.contains(e.primary))}))return!1;let o=2,n=1,r=!1;if(!e.hasCapability(4)&&!t?.skipAutoSave&&!e.closeHandler&&(this.filesConfigurationService.getAutoSaveMode(e).mode===3?(r=!0,o=0,n=3):Vr&&(ei||fn)&&this.filesConfigurationService.getAutoSaveMode(e).mode===4&&(r=!0,o=0,n=4)),!r){this.activeEditor?.matches(e)||await this.doOpenEditor(e),await this.hostService.focus(Re(this.element));let s=!1;if(typeof e.closeHandler?.confirm=="function")try{o=await e.closeHandler.confirm([{editor:e,groupId:this.id}])}catch(l){this.logService.error(l),s=!0}if(typeof e.closeHandler?.confirm!="function"||s){let l;e instanceof Ma?l=e.primary.getName():l=e.getName(),o=await this.fileDialogService.showSaveConfirm([l])}}if(!e.closeHandler&&!this.shouldConfirmClose(e))return o===2;switch(o){case 0:return!await e.save(this.id,{reason:n})&&r?this.doHandleCloseConfirmation(e,{skipAutoSave:!0}):e.isDirty();case 1:try{return await e.revert(this.id),e.isDirty()}catch(s){return this.logService.error(s),await e.revert(this.id,{soft:!0}),e.isDirty()}case 2:return!0}}shouldConfirmClose(e){if(e.closeHandler)try{return e.closeHandler.showConfirm()}catch(t){this.logService.error(t)}return e.isDirty()&&!e.isSaving()}async closeEditors(e,t){if(this.isEmpty)return!0;let o=this.doGetEditorsToClose(e);return await this.handleCloseConfirmation(o.slice(0))?!1:(this.doCloseEditors(o,t),!0)}doGetEditorsToClose(e){if(Array.isArray(e))return e;let t=e,o=typeof t.direction=="number",n=this.model.getEditors(o?1:0,t);return t.savedOnly?n=n.filter(r=>!r.isDirty()||r.isSaving()):o&&t.except?n=t.direction===0?n.slice(0,this.model.indexOf(t.except,n)):n.slice(this.model.indexOf(t.except,n)+1):t.except&&(n=n.filter(r=>t.except&&!r.matches(t.except))),n}doCloseEditors(e,t){let o=!1;for(let n of e)this.isActive(n)?o=!0:this.doCloseInactiveEditor(n);o&&this.doCloseActiveEditor(t?.preserveFocus),e.length&&this.titleControl.closeEditors(e)}closeAllEditors(e){return this.isEmpty?(this.groupsView.partOptions.closeEmptyGroups&&this.groupsView.removeGroup(this),!0):e?.excludeConfirming?(this.doCloseAllEditors(e),!0):this.handleCloseConfirmation(this.model.getEditors(0,e)).then(t=>t?!1:(this.doCloseAllEditors(e),!0))}doCloseAllEditors(e){let t=this.model.getEditors(1,e);e?.excludeConfirming&&(t=t.filter(n=>!this.shouldConfirmClose(n)));let o=[];for(let n of t)this.isActive(n)||this.doCloseInactiveEditor(n),o.push(n);this.activeEditor&&o.includes(this.activeEditor)&&this.doCloseActiveEditor(),o.length&&this.titleControl.closeEditors(o)}async replaceEditors(e){let t,o=[];for(let{editor:n,replacement:r,forceReplaceDirty:s,options:l}of e){let c=this.getIndexOfEditor(n);if(c>=0){let u=this.isActive(n);l?l.index=c:l={index:c},l.inactive=!u,l.pinned=l.pinned??!0;let p={editor:n,replacement:r,forceReplaceDirty:s,options:l};u?t=p:o.push(p)}}for(let{editor:n,replacement:r,forceReplaceDirty:s,options:l}of o)if(await this.doOpenEditor(r,l),!n.matches(r)){let c=!1;if(s?(this.doCloseEditor(n,!0,{context:1}),c=!0):c=await this.doCloseEditorWithConfirmationHandling(n,{preserveFocus:!0},{context:1}),!c)return}if(t){let n=this.doOpenEditor(t.replacement,t.options);t.editor.matches(t.replacement)||(t.forceReplaceDirty?this.doCloseEditor(t.editor,!0,{context:1}):await this.doCloseEditorWithConfirmationHandling(t.editor,{preserveFocus:!0},{context:1})),await n}}get isLocked(){return this.model.isLocked}lock(e){this.model.lock(e)}createEditorActions(e,t=D.EditorTitle){let o={primary:[],secondary:[]},n,r=this.activeEditorPane;if(r instanceof Ts){let s=r.scopedContextKeyService??this.scopedContextKeyService,l=e.add(this.menuService.createMenu(t,s,{emitEventsForSubmenuChanges:!0,eventDebounceDelay:0}));n=l.onDidChange;let c=(u,p)=>p==="navigation"&&u.actions.length<=1;o=ml(l.getActions({arg:this.resourceContext.get(),shouldForwardArgs:!0,renderShortTitle:!0}),"navigation",c)}else{let s=e.add(new E);n=s.event,e.add(this.onDidActiveEditorChange(()=>s.fire()))}return{actions:o,onDidChange:n}}updateStyles(){let e=this.isEmpty;e?this.element.style.backgroundColor=this.getColor(rZi)||"":this.element.style.backgroundColor="";let t=this.getColor(lZi)||this.getColor(bi);!e&&t?(this.titleContainer.classList.add("title-border-bottom"),this.titleContainer.style.setProperty("--title-border-bottom-color",t)):(this.titleContainer.classList.remove("title-border-bottom"),this.titleContainer.style.removeProperty("--title-border-bottom-color"));let{showTabs:o}=this.groupsView.partOptions;this.titleContainer.style.backgroundColor=this.getColor(o==="multiple"?J_t:aZi)||"",this.editorContainer.style.backgroundColor=this.getColor(Ho)||""}get minimumWidth(){return this.editorPane.minimumWidth}get minimumHeight(){return this.editorPane.minimumHeight}get maximumWidth(){return this.editorPane.maximumWidth}get maximumHeight(){return this.editorPane.maximumHeight}get proportionalLayout(){return this.lastLayout?!(this.lastLayout.width===this.minimumWidth||this.lastLayout.height===this.minimumHeight):!0}layout(e,t,o,n){this.lastLayout={width:e,height:t,top:o,left:n},this.element.classList.toggle("max-height-478px",t<=478);let r=this.titleControl.layout({container:new si(e,t),available:new si(e,t-this.editorPane.minimumHeight)});this.progressBar.getContainer().style.top=`${Math.max(this.titleHeight.offset-2,0)}px`;let s=Math.max(0,t-r.height);this.editorContainer.style.height=`${s}px`,this.editorPane.layout({width:e,height:s,top:o+r.height,left:n})}relayout(){if(this.lastLayout){let{width:e,height:t,top:o,left:n}=this.lastLayout;this.layout(e,t,o,n)}}setBoundarySashes(e){this.editorPane.setBoundarySashes(e)}toJSON(){return this.model.serialize()}dispose(){this._disposed=!0,this._onWillDispose.fire(),super.dispose()}};Wb=I([m(6,F),m(7,X),m(8,Le),m(9,Te),m(10,_e),m(11,Kt),m(12,Xe),m(13,rn),m(14,ee),m(15,gr),m(16,ht),m(17,se),m(18,Ka),m(19,Zt),m(20,at),m(21,fe)],Wb);function Hco(a){return a.getValue("editor.dropIntoEditor.enabled")}function Uco(a){return a.shiftKey}var Qpe=class extends yu{constructor(e,t,o,n,r,s,l,c){super(t);this.groupView=e;this.configurationService=o;this.instantiationService=n;this.editorService=r;this.editorGroupService=s;this.treeViewsDragAndDropService=l;this.contextService=c;this.editorTransfer=JI.getInstance();this.groupTransfer=JI.getInstance();this.treeItemsTransfer=JI.getInstance();this.cleanupOverlayScheduler=this._register(new Dt(()=>this.dispose(),300)),this.enableDropIntoEditor=Hco(this.configurationService)&&this.isDropIntoActiveEditorEnabled(),this.create()}static{this.OVERLAY_ID="monaco-workbench-editor-drop-overlay"}get disposed(){return!!this._disposed}create(){let e=this.getOverlayOffsetHeight(),t=this.container=_("div",{id:Qpe.OVERLAY_ID});t.style.top=`${e}px`,this.groupView.element.appendChild(t),this.groupView.element.classList.add("dragged-over"),this._register(Z(()=>{t.remove(),this.groupView.element.classList.remove("dragged-over")})),this.overlay=_(".editor-group-overlay-indicator"),t.appendChild(this.overlay),this.enableDropIntoEditor&&(this.dropIntoPromptElement=zE(d(4230,null,Ze?"\u21E7":"Shift"),{}),this.dropIntoPromptElement.classList.add("editor-group-overlay-drop-into-prompt"),this.overlay.appendChild(this.dropIntoPromptElement)),this.registerListeners(t),this.updateStyles()}updateStyles(){let e=Ci(this.overlay);e.style.backgroundColor=this.getColor(oT)||"";let t=this.getColor(Ys);if(e.style.outlineColor=t||"",e.style.outlineOffset=t?"-2px":"",e.style.outlineStyle=t?"dashed":"",e.style.outlineWidth=t?"2px":"",this.dropIntoPromptElement){this.dropIntoPromptElement.style.backgroundColor=this.getColor(dZi)??"",this.dropIntoPromptElement.style.color=this.getColor(cZi)??"";let o=this.getColor(uZi);o?(this.dropIntoPromptElement.style.borderWidth="1px",this.dropIntoPromptElement.style.borderStyle="solid",this.dropIntoPromptElement.style.borderColor=o):this.dropIntoPromptElement.style.borderWidth="0"}}registerListeners(e){this._register(new Uh(e,{onDragOver:t=>{if(this.enableDropIntoEditor&&Uco(t)){this.dispose();return}let o=this.groupTransfer.hasData(gI.prototype),n=this.editorTransfer.hasData(ev.prototype);!n&&!o&&t.dataTransfer&&(t.dataTransfer.dropEffect="copy");let r=!0;if(o)r=this.isCopyOperation(t);else if(n){let l=this.editorTransfer.getData(ev.prototype);Array.isArray(l)&&l.length>0&&(r=this.isCopyOperation(t,l[0].identifier))}if(!r){let l=this.findSourceGroupView();if(l===this.groupView&&(o||n&&l.count<2)){this.hideOverlay();return}}let s=!!this.groupView.groupsView.partOptions.splitOnDragAndDrop;this.isToggleSplitOperation(t)&&(s=!s),this.positionOverlay(t.offsetX,t.offsetY,o,s),this.cleanupOverlayScheduler.isScheduled()&&this.cleanupOverlayScheduler.cancel()},onDragLeave:t=>this.dispose(),onDragEnd:t=>this.dispose(),onDrop:t=>{Xt.stop(t,!0),this.dispose(),this.currentDropOperation&&this.handleDrop(t,this.currentDropOperation.splitDirection)}})),this._register(j(e,re.MOUSE_OVER,()=>{this.cleanupOverlayScheduler.isScheduled()||this.cleanupOverlayScheduler.schedule()}))}isDropIntoActiveEditorEnabled(){return!!this.groupView.activeEditor?.hasCapability(128)}findSourceGroupView(){if(this.groupTransfer.hasData(gI.prototype)){let e=this.groupTransfer.getData(gI.prototype);if(Array.isArray(e)&&e.length>0)return this.editorGroupService.getGroup(e[0].identifier)}else if(this.editorTransfer.hasData(ev.prototype)){let e=this.editorTransfer.getData(ev.prototype);if(Array.isArray(e)&&e.length>0)return this.editorGroupService.getGroup(e[0].identifier.groupId)}}async handleDrop(e,t){let o=()=>{let n;return typeof t=="number"?n=this.editorGroupService.addGroup(this.groupView,t):n=this.groupView,n};if(this.groupTransfer.hasData(gI.prototype)){let n=this.groupTransfer.getData(gI.prototype);if(Array.isArray(n)&&n.length>0){let r=this.editorGroupService.getGroup(n[0].identifier);if(r){if(typeof t!="number"&&r===this.groupView)return;let s;if(typeof t=="number")this.isCopyOperation(e)?s=this.editorGroupService.copyGroup(r,this.groupView,t):s=this.editorGroupService.moveGroup(r,this.groupView,t);else{let l;this.isCopyOperation(e)&&(l={mode:0}),this.editorGroupService.mergeGroup(r,this.groupView,l)}s&&this.editorGroupService.activateGroup(s)}this.groupTransfer.clearData(gI.prototype)}}else if(this.editorTransfer.hasData(ev.prototype)){let n=this.editorTransfer.getData(ev.prototype);if(Array.isArray(n)&&n.length>0){let r=n,s=n[0].identifier,l=this.editorGroupService.getGroup(s.groupId);if(l){let c=this.isCopyOperation(e,s),u;if(this.groupView.groupsView.partOptions.closeEmptyGroups&&l.count===1&&typeof t=="number"&&!c)u=this.editorGroupService.moveGroup(l,this.groupView,t);else{if(u=o(),l===u)return;let p=yJ(this.groupView,r.map(h=>h.identifier.editor));c?l.copyEditors(p,u):l.moveEditors(p,u)}u.focus()}this.editorTransfer.clearData(ev.prototype)}}else if(this.treeItemsTransfer.hasData(PC.prototype)){let n=this.treeItemsTransfer.getData(PC.prototype);if(Array.isArray(n)&&n.length>0){let r=[];for(let s of n){let l=await this.treeViewsDragAndDropService.removeDragOperationTransfer(s.identifier);if(l){let c=await PAt(l);r.push(...c.map(u=>({...u,options:{...u.options,pinned:!0}})))}}r.length&&this.editorService.openEditors(r,o(),{validateTrust:!0})}this.treeItemsTransfer.clearData(PC.prototype)}else this.instantiationService.createInstance(a0,{allowWorkspaceOpen:!Wt||gw(this.contextService.getWorkspace())}).handleDrop(e,Re(this.groupView.element),()=>o(),r=>r?.focus())}isCopyOperation(e,t){return t?.editor.hasCapability(8)?!1:e.ctrlKey&&!Ze||e.altKey&&Ze}isToggleSplitOperation(e){return e.altKey&&!Ze||e.shiftKey&&Ze}positionOverlay(e,t,o,n){let r=this.groupView.groupsView.partOptions.openSideBySideDirection==="right",s=this.groupView.element.clientWidth,l=this.groupView.element.clientHeight-this.getOverlayOffsetHeight(),c,u;n?(o?c=r?.3:.1:c=.1,o?u=r?.1:.3:u=.1):(c=0,u=0);let p=s*c,h=l*u,g=s/3,f=l/3,v;switch(e>p&&e<s-p&&t>h&&t<l-h?v=void 0:r?e<g?v=2:e>g*2?v=3:t<l/2?v=0:v=1:t<f?v=0:t>f*2?v=1:e<s/2?v=2:v=3,v){case 0:this.doPositionOverlay({top:"0",left:"0",width:"100%",height:"50%"}),this.toggleDropIntoPrompt(!1);break;case 1:this.doPositionOverlay({top:"50%",left:"0",width:"100%",height:"50%"}),this.toggleDropIntoPrompt(!1);break;case 2:this.doPositionOverlay({top:"0",left:"0",width:"50%",height:"100%"}),this.toggleDropIntoPrompt(!1);break;case 3:this.doPositionOverlay({top:"0",left:"50%",width:"50%",height:"100%"}),this.toggleDropIntoPrompt(!1);break;default:this.doPositionOverlay({top:"0",left:"0",width:"100%",height:"100%"}),this.toggleDropIntoPrompt(!0)}let b=Ci(this.overlay);b.style.opacity="1",setTimeout(()=>b.classList.add("overlay-move-transition"),0),this.currentDropOperation={splitDirection:v}}doPositionOverlay(e){let[t,o]=jy(this.container,this.overlay),n=this.getOverlayOffsetHeight();n?t.style.height=`calc(100% - ${n}px)`:t.style.height="100%",o.style.top=e.top,o.style.left=e.left,o.style.width=e.width,o.style.height=e.height}getOverlayOffsetHeight(){return!this.groupView.isEmpty&&this.groupView.groupsView.partOptions.showTabs==="multiple"?this.groupView.titleHeight.offset:0}hideOverlay(){let e=Ci(this.overlay);this.doPositionOverlay({top:"0",left:"0",width:"100%",height:"100%"}),e.style.opacity="0",e.classList.remove("overlay-move-transition"),this.currentDropOperation=void 0}toggleDropIntoPrompt(e){this.dropIntoPromptElement&&(this.dropIntoPromptElement.style.opacity=e?"1":"0")}contains(e){return e===this.container||e===this.overlay}dispose(){super.dispose(),this._disposed=!0}};Qpe=I([m(1,Le),m(2,B),m(3,F),m(4,ee),m(5,wt),m(6,v5),m(7,Pe)],Qpe);var uRe=class extends yu{constructor(e,t,o,n,r,s,l){super(r);this.groupsView=e;this.container=t;this.delegate=o;this.editorGroupService=n;this.configurationService=s;this.instantiationService=l;this.counter=0;this.editorTransfer=JI.getInstance();this.groupTransfer=JI.getInstance();this.registerListeners()}get overlay(){if(this._overlay&&!this._overlay.disposed)return this._overlay}registerListeners(){this._register(j(this.container,re.DRAG_ENTER,e=>this.onDragEnter(e))),this._register(j(this.container,re.DRAG_LEAVE,()=>this.onDragLeave()));for(let e of[this.container,Re(this.container)])this._register(j(e,re.DRAG_END,()=>this.onDragEnd()))}onDragEnter(e){if(Hco(this.configurationService)&&Uco(e))return;if(this.counter++,!this.editorTransfer.hasData(ev.prototype)&&!this.groupTransfer.hasData(gI.prototype)&&e.dataTransfer){let o=ne.as(OV.DragAndDropContribution).getAll(),n=Array.from(o).map(r=>r.dataFormatKey);if(!Ip(e,yl.FILES,hc.FILES,yl.RESOURCES,hc.EDITORS,...n)){e.dataTransfer.dropEffect="none";return}}if(!this.groupsView.partOptions.allowDropIntoGroup){e.dataTransfer&&(e.dataTransfer.dropEffect="none");return}this.updateContainer(!0);let t=e.target;if(t&&(this.overlay&&!this.overlay.contains(t)&&this.disposeOverlay(),!this.overlay)){let o=this.findTargetGroupView(t);o&&(this._overlay=this.instantiationService.createInstance(Qpe,o))}}onDragLeave(){this.counter--,this.counter===0&&this.updateContainer(!1)}onDragEnd(){this.counter=0,this.updateContainer(!1),this.disposeOverlay()}findTargetGroupView(e){return this.editorGroupService.groups.find(o=>ts(e,o.element)||this.delegate.containsGroup?.(o))}updateContainer(e){this.container.classList.toggle("dragged-over",e)}dispose(){super.dispose(),this.disposeOverlay()}disposeOverlay(){this.overlay&&(this.overlay.dispose(),this._overlay=void 0)}};uRe=I([m(3,wt),m(4,Le),m(5,B),m(6,F)],uRe);var UJe={targetWidth:900,leftMarginRatio:.1909,rightMarginRatio:.1909},zwi={type:"distribute"};function zco(a){let i=_(".centered-layout-margin");return i.style.height="100%",a&&(i.style.backgroundColor=a.toString()),{element:i,layout:()=>{},minimumSize:60,maximumSize:Number.POSITIVE_INFINITY,onDidChange:U.None}}function Z6o(a,i){return{element:a.element,get maximumSize(){return a.maximumWidth},get minimumSize(){return a.minimumWidth},onDidChange:U.map(a.onDidChange,e=>e&&e.width),layout:(e,t,o)=>a.layout(e,i(),o?.top??0,(o?.left??0)+t)}}var $Wt=class{constructor(i,e,t={...UJe},o=!1){this.container=i;this.view=e;this.state=t;this.centeredLayoutFixedWidth=o;this.lastLayoutPosition={width:0,height:0,left:0,top:0};this.didLayout=!1;this.splitViewDisposables=new N;this._boundarySashes={};this.container.appendChild(this.view.element),this.container.style.overflow="hidden"}get minimumWidth(){return this.splitView?this.splitView.minimumSize:this.view.minimumWidth}get maximumWidth(){return this.splitView?this.splitView.maximumSize:this.view.maximumWidth}get minimumHeight(){return this.view.minimumHeight}get maximumHeight(){return this.view.maximumHeight}get onDidChange(){return this.view.onDidChange}get boundarySashes(){return this._boundarySashes}set boundarySashes(i){this._boundarySashes=i,this.splitView&&(this.splitView.orthogonalStartSash=i.top,this.splitView.orthogonalEndSash=i.bottom)}layout(i,e,t,o){this.lastLayoutPosition={width:i,height:e,top:t,left:o},this.splitView?(this.splitView.layout(i,this.lastLayoutPosition),(!this.didLayout||this.centeredLayoutFixedWidth)&&this.resizeSplitViews()):this.view.layout(i,e,t,o),this.didLayout=!0}resizeSplitViews(){if(this.splitView)if(this.centeredLayoutFixedWidth){let i=Math.min(this.lastLayoutPosition.width,this.state.targetWidth),e=(this.lastLayoutPosition.width-i)/2;this.splitView.resizeView(0,Math.floor(e)),this.splitView.resizeView(1,i),this.splitView.resizeView(2,Math.ceil(e))}else{let i=this.state.leftMarginRatio*this.lastLayoutPosition.width,e=this.state.rightMarginRatio*this.lastLayoutPosition.width,t=this.lastLayoutPosition.width-i-e;this.splitView.resizeView(0,i),this.splitView.resizeView(1,t),this.splitView.resizeView(2,e)}}setFixedWidth(i){this.centeredLayoutFixedWidth=i,this.splitView&&(this.updateState(),this.resizeSplitViews())}updateState(){this.splitView&&(this.state.targetWidth=this.splitView.getViewSize(1),this.state.leftMarginRatio=this.splitView.getViewSize(0)/this.lastLayoutPosition.width,this.state.rightMarginRatio=this.splitView.getViewSize(2)/this.lastLayoutPosition.width)}isActive(){return!!this.splitView}styles(i){this.style=i,this.splitView&&this.emptyViews&&(this.splitView.style(this.style),this.emptyViews[0].element.style.backgroundColor=this.style.background.toString(),this.emptyViews[1].element.style.backgroundColor=this.style.background.toString())}activate(i){if(i!==this.isActive())if(i){this.view.element.remove(),this.splitView=new Ou(this.container,{inverseAltBehavior:!0,orientation:1,styles:this.style}),this.splitView.orthogonalStartSash=this.boundarySashes.top,this.splitView.orthogonalEndSash=this.boundarySashes.bottom,this.splitViewDisposables.add(this.splitView.onDidSashChange(()=>{this.splitView&&this.updateState()})),this.splitViewDisposables.add(this.splitView.onDidSashReset(()=>{this.state={...UJe},this.resizeSplitViews()})),this.splitView.layout(this.lastLayoutPosition.width,this.lastLayoutPosition);let e=this.style?this.style.background:void 0;this.emptyViews=[zco(e),zco(e)],this.splitView.addView(this.emptyViews[0],zwi,0),this.splitView.addView(Z6o(this.view,()=>this.lastLayoutPosition.height),zwi,1),this.splitView.addView(this.emptyViews[1],zwi,2),this.resizeSplitViews()}else this.splitView?.el.remove(),this.splitViewDisposables.clear(),this.splitView?.dispose(),this.splitView=void 0,this.emptyViews=void 0,this.container.appendChild(this.view.element),this.view.layout(this.lastLayoutPosition.width,this.lastLayoutPosition.height,this.lastLayoutPosition.top,this.lastLayoutPosition.left)}isDefault(i){return this.centeredLayoutFixedWidth?i.targetWidth===UJe.targetWidth:i.leftMarginRatio===UJe.leftMarginRatio&&i.rightMarginRatio===UJe.rightMarginRatio}dispose(){this.splitViewDisposables.dispose(),this.splitView&&(this.splitView.dispose(),this.splitView=void 0)}};function Ype(a,i,e){let t=a.get(wt),o=a.get(B),n=t9o(i,e,t,o);return n instanceof Promise?n.then(r=>Kco(r,i,e,t,o)):Kco(n,i,e,t,o)}function Kco(a,i,e,t,o){let n=t.activeModalEditorPart,r=o.getValue("workbench.editor.useModal"),s=EF(i)?i.editor:ka(i)?i:void 0,l=s instanceof ls&&s.hasCapability(2048);return n&&e!==OR&&r!=="all"&&!l?e9o(a,i,n,t,e):Gco(a,i,e,t)}async function e9o(a,i,e,t,o){let n=i.options;return e.groups.some(r=>r.id===a.id)&&(a=t.mainPart.activeGroup),n?.preserveFocus||await e.close(),Gco(a,i,o,t)}function Gco(a,i,e,t){let o;return t.activeGroup!==a&&i.options&&!i.options.inactive&&i.options.preserveFocus&&typeof i.options.activation!="number"&&e!==In&&(o=1),[a,o]}function t9o(a,i,e,t){let o,n=EF(a)?a.editor:a,r=a.options;if(ka(n)&&n.hasCapability(2048))o=e.createModalEditorPart(r?.modal).then(s=>s.activeGroup);else if(i&&typeof i!="number")o=i;else if(typeof i=="number"&&i>=0)o=e.getGroup(i);else if(i===In){let s=uy(t),l=e.findGroup({direction:s});(!l||jWt(l,n))&&(l=e.addGroup(e.activeGroup,s)),o=l}else if(i===Mg)o=e.createAuxiliaryEditorPart(r?.auxiliary).then(s=>s.activeGroup);else if(i===OR&&t.getValue("workbench.editor.useModal")!=="off")o=e.createModalEditorPart(r?.modal).then(s=>s.activeGroup);else if(!r||typeof r.index!="number"){let s=e.getGroups(1);if(r?.revealIfVisible){for(let l of s)if(i9o(l,n)){o=l;break}}if(!o&&(r?.revealIfOpened||t.getValue("workbench.editor.revealIfOpen")||ka(n)&&(n.hasCapability(1024)||n.hasCapability(8)))){let l,c;for(let u of s)if(qco(u,n)&&(c||(c=u),!l&&u.isActive(n)&&(l=u)),c&&l)break;o=l||c}}if(!o&&t.getValue("workbench.editor.useModal")==="all"&&(o=e.createModalEditorPart(r?.modal).then(s=>s.activeGroup)),!o){let s=e.activeGroup;if(jWt(s,n)){for(let l of e.getGroups(1))if(!jWt(l,n)){s=l;break}jWt(s,n)?o=e.addGroup(s,uy(t)):o=s}else o=s}return o}function jWt(a,i){return!(!a.isLocked||qco(a,i))}function i9o(a,i){return a.activeEditor?a.activeEditor.matches(i):!1}function qco(a,i){for(let e of a.editors)if(e.matches(i))return!0;return!1}var Kwi=class{constructor(){this.element=_(".grid-view-container");this._onDidChange=new Bh;this.onDidChange=this._onDidChange.event}get minimumWidth(){return this.gridWidget?this.gridWidget.minimumWidth:0}get maximumWidth(){return this.gridWidget?this.gridWidget.maximumWidth:Number.POSITIVE_INFINITY}get minimumHeight(){return this.gridWidget?this.gridWidget.minimumHeight:0}get maximumHeight(){return this.gridWidget?this.gridWidget.maximumHeight:Number.POSITIVE_INFINITY}get gridWidget(){return this._gridWidget}set gridWidget(i){this.element.textContent="",i?(this.element.appendChild(i.element),this._onDidChange.input=i.onDidChange):this._onDidChange.input=U.None,this._gridWidget=i}layout(i,e,t,o){this.gridWidget?.layout(i,e,t,o)}dispose(){this._onDidChange.dispose()}},Ak=class extends RT{constructor(e,t,o,n,r,s,l,c,u,p,h){super(t,{hasTitle:!1},s,c,u);this.editorPartsView=e;this.groupsLabel=o;this.windowId=n;this.instantiationService=r;this.configurationService=l;this.hostService=p;this.contextKeyService=h;this._onDidFocus=this._register(new E);this.onDidFocus=this._onDidFocus.event;this._onDidLayout=this._register(new E);this.onDidLayout=this._onDidLayout.event;this._onDidChangeActiveGroup=this._register(new E);this.onDidChangeActiveGroup=this._onDidChangeActiveGroup.event;this._onDidChangeGroupIndex=this._register(new E);this.onDidChangeGroupIndex=this._onDidChangeGroupIndex.event;this._onDidChangeGroupLabel=this._register(new E);this.onDidChangeGroupLabel=this._onDidChangeGroupLabel.event;this._onDidChangeGroupLocked=this._register(new E);this.onDidChangeGroupLocked=this._onDidChangeGroupLocked.event;this._onDidChangeGroupMaximized=this._register(new E);this.onDidChangeGroupMaximized=this._onDidChangeGroupMaximized.event;this._onDidActivateGroup=this._register(new E);this.onDidActivateGroup=this._onDidActivateGroup.event;this._onDidAddGroup=this._register(new Gm);this.onDidAddGroup=this._onDidAddGroup.event;this._onDidRemoveGroup=this._register(new Gm);this.onDidRemoveGroup=this._onDidRemoveGroup.event;this._onDidMoveGroup=this._register(new E);this.onDidMoveGroup=this._onDidMoveGroup.event;this.onDidSetGridWidget=this._register(new E);this._onDidChangeSizeConstraints=this._register(new Bh);this.onDidChangeSizeConstraints=U.any(this.onDidSetGridWidget.event,this._onDidChangeSizeConstraints.event);this._onDidScroll=this._register(new Bh);this.onDidScroll=U.any(this.onDidSetGridWidget.event,this._onDidScroll.event);this._onDidChangeEditorPartOptions=this._register(new E);this.onDidChangeEditorPartOptions=this._onDidChangeEditorPartOptions.event;this._onWillDispose=this._register(new E);this.onWillDispose=this._onWillDispose.event;this.workspaceMemento=this.getMemento(1,0);this.profileMemento=this.getMemento(0,1);this.groupViews=new Map;this.mostRecentActiveGroups=[];this.container=_(".content");this.gridWidgetDisposables=this._register(new N);this.gridWidgetView=this._register(new Kwi);this.enforcedPartOptions=[];this.top=0;this.left=0;this.sideGroup={openEditor:async(e,t)=>{let o=this.scopedInstantiationService.invokeFunction(r=>Ype(r,{editor:e,options:t},In)),n;return o instanceof Promise?[n]=await o:[n]=o,n.openEditor(e,t)}};this._isReady=!1;this.whenReadyPromise=new Ko;this.whenReady=this.whenReadyPromise.p;this.whenRestoredPromise=new Ko;this.whenRestored=this.whenRestoredPromise.p;this._willRestoreState=!1;this.priority=2;this.scopedContextKeyService=this._register(this.contextKeyService.createScoped(this.container)),this.scopedInstantiationService=this._register(this.instantiationService.createChild(new _o([X,this.scopedContextKeyService]))),this._partOptions=cgi(this.configurationService,this.themeService),this.registerListeners()}static{this.EDITOR_PART_UI_STATE_STORAGE_KEY="editorpart.state"}static{this.EDITOR_PART_CENTERED_VIEW_STORAGE_KEY="editorpart.centeredview"}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>this.onConfigurationUpdated(e))),this._register(this.themeService.onDidFileIconThemeChange(()=>this.handleChangedPartOptions())),this._register(this.onDidChangeMementoValue(1,this._store)(e=>this.onDidChangeMementoState(e)))}onConfigurationUpdated(e){Zto(e)&&this.handleChangedPartOptions()}handleChangedPartOptions(){let e=this._partOptions,t=cgi(this.configurationService,this.themeService);for(let o of this.enforcedPartOptions)Object.assign(t,o);this._partOptions=t,this._onDidChangeEditorPartOptions.fire({oldPartOptions:e,newPartOptions:t})}get partOptions(){return this._partOptions}enforcePartOptions(e){return this.enforcedPartOptions.push(e),this.handleChangedPartOptions(),Z(()=>{this.enforcedPartOptions.splice(this.enforcedPartOptions.indexOf(e),1),this.handleChangedPartOptions()})}get contentDimension(){return this._contentDimension}get activeGroup(){return this._activeGroup}get groups(){return Array.from(this.groupViews.values())}get count(){return this.groupViews.size}get orientation(){return this.gridWidget&&this.gridWidget.orientation===0?1:0}get isReady(){return this._isReady}get hasRestorableState(){return!!this.workspaceMemento[Ak.EDITOR_PART_UI_STATE_STORAGE_KEY]}get willRestoreState(){return this._willRestoreState}getGroups(e=0){switch(e){case 0:return this.groups;case 1:{let t=di(this.mostRecentActiveGroups.map(o=>this.getGroup(o)));return zo([...t,...this.groups])}case 2:{let t=[];return this.gridWidget&&this.fillGridNodes(t,this.gridWidget.getViews()),t}}}fillGridNodes(e,t){WZ(t)?t.children.forEach(o=>this.fillGridNodes(e,o)):e.push(t.view)}hasGroup(e){return this.groupViews.has(e)}getGroup(e){return this.groupViews.get(e)}findGroup(e,t=this.activeGroup,o){if(typeof e.direction=="number")return this.doFindGroupByDirection(e.direction,t,o);if(typeof e.location=="number")return this.doFindGroupByLocation(e.location,t,o);throw new Error("invalid arguments")}doFindGroupByDirection(e,t,o){let n=this.assertGroupView(t),r=this.gridWidget.getNeighborViews(n,this.toGridViewDirection(e),o);return r.sort(((s,l)=>this.mostRecentActiveGroups.indexOf(s.id)-this.mostRecentActiveGroups.indexOf(l.id))),r[0]}doFindGroupByLocation(e,t,o){let n=this.assertGroupView(t),r=this.getGroups(2),s=r.indexOf(n);switch(e){case 0:return r[0];case 1:return r[r.length-1];case 2:{let l=r[s+1];return!l&&o&&(l=this.doFindGroupByLocation(0,t)),l}case 3:{let l=r[s-1];return!l&&o&&(l=this.doFindGroupByLocation(1,t)),l}}}activateGroup(e,t,o){let n=this.assertGroupView(e);return this.doSetGroupActive(n,o),t||this.hostService.moveTop(Re(this.element)),n}restoreGroup(e){let t=this.assertGroupView(e);return this.doRestoreGroup(t),t}getSize(e){let t=this.assertGroupView(e);return this.gridWidget.getViewSize(t)}setSize(e,t){let o=this.assertGroupView(e);this.gridWidget.resizeView(o,t)}arrangeGroups(e,t=this.activeGroup){if(this.count<2||!this.gridWidget)return;let o=this.assertGroupView(t);switch(e){case 2:this.gridWidget.distributeViewSizes();break;case 0:if(this.groups.length<2)return;this.gridWidget.maximizeView(o),o.focus();break;case 1:this.gridWidget.expandView(o);break}}toggleMaximizeGroup(e=this.activeGroup){this.hasMaximizedGroup()?this.unmaximizeGroup():this.arrangeGroups(0,e)}toggleExpandGroup(e=this.activeGroup){this.isGroupExpanded(this.activeGroup)?this.arrangeGroups(2):this.arrangeGroups(1,e)}unmaximizeGroup(){this.gridWidget.exitMaximizedView(),this._activeGroup.focus()}hasMaximizedGroup(){return this.gridWidget.hasMaximizedView()}isGroupMaximized(e){return this.gridWidget.isViewMaximized(e)}isGroupExpanded(e){return this.gridWidget.isViewExpanded(e)}setGroupOrientation(e){if(!this.gridWidget)return;let t=e===0?1:0;this.gridWidget.orientation!==t&&(this.gridWidget.orientation=t)}applyLayout(e){let t=this.shouldRestoreFocus(this.container),o=0;function n(c){for(let u of c)Array.isArray(u.groups)?n(u.groups):o++}n(e.groups);let r=this.getGroups(2);if(o<r.length){let c=r[o-1];r.forEach((u,p)=>{p>=o&&this.mergeGroup(u,c)}),r=this.getGroups(2)}let s=this.activeGroup,l=tyi({orientation:this.toGridViewOrientation(e.orientation,this.isTwoDimensionalGrid()?this.gridWidget.orientation:AA(this.gridWidget.orientation)),groups:e.groups});this.doApplyGridState(l,s.id,r),t&&this._activeGroup.focus()}getLayout(){let e=this.gridWidget.serialize(),t=e.orientation===1?0:1,o=this.serializedNodeToGroupLayoutArgument(e.root);return{orientation:t,groups:o.groups}}serializedNodeToGroupLayoutArgument(e){return e.type==="branch"?{size:e.size,groups:e.data.map(t=>this.serializedNodeToGroupLayoutArgument(t))}:{size:e.size}}shouldRestoreFocus(e){return e?Nn()===e.ownerDocument.body?!0:Gr(e):!1}isTwoDimensionalGrid(){let e=this.gridWidget.getViews();return WZ(e)?e.children.some(t=>WZ(t)):!1}addGroup(e,t,o){let n=this.assertGroupView(e),r;if(n.groupsView===this){let s=this.shouldRestoreFocus(n.element),l=this.groupViews.size>1&&this.isGroupExpanded(n);r=this.doCreateGroupView(o),this.gridWidget.addView(r,this.getSplitSizingStyle(),n,this.toGridViewDirection(t)),this.updateContainer(),this._onDidAddGroup.fire(r),this.notifyGroupIndexChange(),l&&this.arrangeGroups(1,r),s&&n.focus()}else r=n.groupsView.addGroup(n,t,o);return r}getSplitSizingStyle(){switch(this._partOptions.splitSizing){case"distribute":return f0.Distribute;case"split":return f0.Split;default:return f0.Auto}}doCreateGroupView(e,t){let o;e instanceof Wb?o=Wb.createCopy(e,this.editorPartsView,this,this.groupsLabel,this.count,this.scopedInstantiationService,t):z9e(e)?o=Wb.createFromSerialized(e,this.editorPartsView,this,this.groupsLabel,this.count,this.scopedInstantiationService,t):o=Wb.createNew(this.editorPartsView,this,this.groupsLabel,this.count,this.scopedInstantiationService,t),this.groupViews.set(o.id,o);let n=new N;return n.add(o.onDidFocus(()=>{this.doSetGroupActive(o),this._onDidFocus.fire()})),n.add(o.onDidModelChange(r=>{switch(r.kind){case 3:this._onDidChangeGroupLocked.fire(o);break;case 1:this._onDidChangeGroupIndex.fire(o);break;case 2:this._onDidChangeGroupLabel.fire(o);break}})),n.add(o.onDidActiveEditorChange(()=>{this.updateContainer()})),U.once(o.onWillDispose)(()=>{Be(n),this.groupViews.delete(o.id),this.doUpdateMostRecentActive(o)}),o}doSetGroupActive(e,t=0){if(this._activeGroup!==e){let o=this._activeGroup;this._activeGroup=e,this.doUpdateMostRecentActive(e,!0),o&&!o.disposed&&o.setActive(!1),e.setActive(!0),this.doRestoreGroup(e),this._onDidChangeActiveGroup.fire(e)}this._onDidActivateGroup.fire({group:e,reason:t})}doRestoreGroup(e){if(this.gridWidget)try{this.hasMaximizedGroup()&&!this.isGroupMaximized(e)&&this.unmaximizeGroup();let t=this.gridWidget.getViewSize(e);(t.width===e.minimumWidth||t.height===e.minimumHeight)&&this.arrangeGroups(1,e)}catch{}}doUpdateMostRecentActive(e,t){let o=this.mostRecentActiveGroups.indexOf(e.id);o!==-1&&this.mostRecentActiveGroups.splice(o,1),t&&this.mostRecentActiveGroups.unshift(e.id)}toGridViewDirection(e){switch(e){case 0:return 0;case 1:return 1;case 2:return 2;case 3:return 3}}toGridViewOrientation(e,t){return typeof e=="number"?e===0?1:0:t}removeGroup(e,t){let o=this.assertGroupView(e);this.count!==1&&(o.isEmpty?this.doRemoveEmptyGroup(o,t):this.doRemoveGroupWithEditors(o))}doRemoveGroupWithEditors(e){let t=this.getGroups(1),o;this._activeGroup===e?o=t[1]:o=t[0],this.mergeGroup(e,o)}doRemoveEmptyGroup(e,t){let o=!t&&this.shouldRestoreFocus(this.container);if(this._activeGroup===e){let r=this.getGroups(1)[1];this.doSetGroupActive(r)}this.gridWidget.removeView(e,this.getSplitSizingStyle()),e.dispose(),o&&this._activeGroup.focus(),this.notifyGroupIndexChange(),this.updateContainer(),this._onDidRemoveGroup.fire(e)}moveGroup(e,t,o){let n=this.assertGroupView(e),r=this.assertGroupView(t);if(n.id===r.id)throw new Error("Cannot move group into its own");let s=this.shouldRestoreFocus(n.element),l;return n.groupsView===r.groupsView?(this.gridWidget.moveView(n,this.getSplitSizingStyle(),r,this.toGridViewDirection(o)),l=n):(l=r.groupsView.addGroup(r,o,n),n.closeAllEditors(),this.removeGroup(n,s)),s&&l.focus(),this._onDidMoveGroup.fire(l),this.notifyGroupIndexChange(),l}copyGroup(e,t,o){let n=this.assertGroupView(e),r=this.assertGroupView(t),s=this.shouldRestoreFocus(n.element),l=this.addGroup(r,o,n);return s&&l.focus(),l}mergeGroup(e,t,o){let n=this.assertGroupView(e),r=this.assertGroupView(t),s=[],l=o&&typeof o.index=="number"?o.index:r.count;for(let u of n.editors){let p=!n.isActive(u)||this._activeGroup!==n,h;r.contains(u)&&(r.isSticky(u)||o?.preserveExistingIndex)||(h=l,l++),s.push({editor:u,options:{index:h,inactive:p,preserveFocus:p}})}let c=!0;return o?.mode===0?n.copyEditors(s,r):c=n.moveEditors(s,r),n.isEmpty&&!n.disposed&&this.removeGroup(n,!0),c}mergeAllGroups(e,t){let o=this.assertGroupView(e),n=!0;for(let r of this.getGroups(1)){if(r===o)continue;this.mergeGroup(r,o,t)||(n=!1)}return n}assertGroupView(e){let t;if(typeof e=="number"?t=this.editorPartsView.getGroup(e):t=e,!t)throw new Error("Invalid editor group provided!");return t}createEditorDropTarget(e,t){return wo(Do(e)),this.scopedInstantiationService.createInstance(uRe,this,e,t)}get minimumWidth(){return Math.min(this.centeredLayoutWidget.minimumWidth,this.layoutService.getMaximumEditorDimensions(this.layoutService.getContainer(Re(this.container))).width)}get maximumWidth(){return this.centeredLayoutWidget.maximumWidth}get minimumHeight(){return Math.min(this.centeredLayoutWidget.minimumHeight,this.layoutService.getMaximumEditorDimensions(this.layoutService.getContainer(Re(this.container))).height)}get maximumHeight(){return this.centeredLayoutWidget.maximumHeight}get snap(){return this.layoutService.getPanelAlignment()==="center"}get onDidChange(){return U.any(this.centeredLayoutWidget.onDidChange,this.onDidSetGridWidget.event)}get gridSeparatorBorder(){return this.theme.getColor(Z_t)||this.theme.getColor(bi)||We.transparent}updateStyles(){this.container.style.backgroundColor=this.getColor(Ho)||"";let e={separatorBorder:this.gridSeparatorBorder,background:this.theme.getColor(l6e)||We.transparent};this.gridWidget.style(e),this.centeredLayoutWidget.styles(e)}createContentArea(e,t){return this.element=e,this.windowId!==ut.vscodeWindowId&&this.container.classList.add("auxiliary"),e.appendChild(this.container),this._willRestoreState=!t||t.restorePreviousState,this.doCreateGridControl(),this.centeredLayoutWidget=this._register(new $Wt(this.container,this.gridWidgetView,this.profileMemento[Ak.EDITOR_PART_CENTERED_VIEW_STORAGE_KEY],this._partOptions.centeredLayoutFixedWidth)),this._register(this.onDidChangeEditorPartOptions(o=>this.centeredLayoutWidget.setFixedWidth(o.newPartOptions.centeredLayoutFixedWidth??!1))),this.setupDragAndDropSupport(e,this.container),this.handleContextKeys(),this.whenReadyPromise.complete(),this._isReady=!0,dn.settled(this.groups.map(o=>o.whenRestored)).finally(()=>{this.whenRestoredPromise.complete()}),this.container}handleContextKeys(){let e=n4.bindTo(this.scopedContextKeyService),t=CB.bindTo(this.scopedContextKeyService),o=xK.bindTo(this.scopedContextKeyService),n=()=>{this.count>1?e.set(!0):e.reset(),this.hasMaximizedGroup()?t.set(!0):t.reset()},r=()=>{o.set(this.partOptions.showTabs==="multiple")};n(),r(),this._register(this.onDidAddGroup(()=>n())),this._register(this.onDidRemoveGroup(()=>n())),this._register(this.onDidChangeGroupMaximized(()=>n())),this._register(this.onDidChangeEditorPartOptions(()=>r()))}setupDragAndDropSupport(e,t){this._register(this.createEditorDropTarget(t,Object.create(null)));let o=_(".drop-block-overlay");e.appendChild(o),this._register(q$(o,()=>o.classList.remove("visible"))),this._register(ST.INSTANCE.registerTarget(this.element,{onDragStart:p=>o.classList.add("visible"),onDragEnd:p=>o.classList.remove("visible")}));let n,r,s,l,c=p=>{!this.layoutService.isVisible("workbench.parts.panel")&&p===this.layoutService.getPanelPosition()?this.layoutService.setPartHidden(!1,"workbench.parts.panel"):!this.layoutService.isVisible("workbench.parts.auxiliarybar")&&p===(this.layoutService.getSideBarPosition()===1?0:1)&&this.layoutService.setPartHidden(!1,"workbench.parts.auxiliarybar")},u=()=>{n&&(clearTimeout(n),n=void 0),r&&(clearTimeout(r),r=void 0)};this._register(ST.INSTANCE.registerTarget(o,{onDragOver:p=>{Xt.stop(p.eventData,!0),p.eventData.dataTransfer&&(p.eventData.dataTransfer.dropEffect="none");let h=o.getBoundingClientRect(),g,f,v=100;p.eventData.clientX<h.left+v&&(g=0),p.eventData.clientX>h.right-v&&(g=1),p.eventData.clientY>h.bottom-v&&(f=2),p.eventData.clientY<h.top+v&&(f=3),n&&g!==s&&(clearTimeout(n),n=void 0),r&&f!==l&&(clearTimeout(r),r=void 0),!n&&g!==void 0&&(s=g,n=setTimeout(()=>c(g),200)),!r&&f!==void 0&&(l=f,r=setTimeout(()=>c(f),200))},onDragLeave:()=>u(),onDragEnd:()=>u(),onDrop:()=>u()}))}centerLayout(e){this.centeredLayoutWidget.activate(e)}isLayoutCentered(){return this.centeredLayoutWidget?this.centeredLayoutWidget.isActive():!1}doCreateGridControl(){let e=!1;if(this._willRestoreState&&(e=!this.doCreateGridControlWithPreviousState()),!this.gridWidget||e){let t=this.doCreateGroupView();this.doSetGridWidget(new S3(t)),this.doSetGroupActive(t)}this.updateContainer(),this.notifyGroupIndexChange()}doCreateGridControlWithPreviousState(){let e=this.loadState();if(e?.serializedGrid)try{this.mostRecentActiveGroups=e.mostRecentActiveGroups,this.doCreateGridControlWithState(e.serializedGrid,e.activeGroup)}catch(t){return mt(new Error(`Error restoring editor grid widget: ${t} (with state: ${JSON.stringify(e)})`)),this.disposeGroups(),!1}return!0}doCreateGridControlWithState(e,t,o,n){let r;o?r=o.slice(0):r=[];let s=[],l=S3.deserialize(e,{fromJSON:c=>{let u;return r.length>0?u=r.shift():u=this.doCreateGroupView(c,n),s.push(u),u.id===t&&this.doSetGroupActive(u),u}},{styles:{separatorBorder:this.gridSeparatorBorder}});this._activeGroup||this.doSetGroupActive(s[0]),this.mostRecentActiveGroups.some(c=>!this.getGroup(c))&&(this.mostRecentActiveGroups=s.map(c=>c.id)),this.doSetGridWidget(l)}doSetGridWidget(e){let t={};this.gridWidget&&(t=this.gridWidget.boundarySashes,this.gridWidget.dispose()),this.gridWidget=e,this.gridWidget.boundarySashes=t,this.gridWidgetView.gridWidget=e,this._onDidChangeSizeConstraints.input=e.onDidChange,this._onDidScroll.input=e.onDidScroll,this.gridWidgetDisposables.clear(),this.gridWidgetDisposables.add(e.onDidChangeViewMaximized(o=>this._onDidChangeGroupMaximized.fire(o))),this.onDidSetGridWidget.fire(void 0)}updateContainer(){this.container.classList.toggle("empty",this.isEmpty)}notifyGroupIndexChange(){this.getGroups(2).forEach((e,t)=>e.notifyIndexChanged(t))}notifyGroupsLabelChange(e){for(let t of this.groups)t.notifyLabelChanged(e)}get isEmpty(){return this.count===1&&this._activeGroup.isEmpty}setBoundarySashes(e){this.gridWidget.boundarySashes=e,this.centeredLayoutWidget.boundarySashes=e}layout(e,t,o,n){this.top=o,this.left=n;let r=super.layoutContents(e,t).contentSize;this.doLayout(si.lift(r),o,n)}doLayout(e,t=this.top,o=this.left){this._contentDimension=e,this.centeredLayoutWidget.layout(this._contentDimension.width,this._contentDimension.height,t,o),this._onDidLayout.fire(e)}saveState(){if(this.gridWidget&&(this.isEmpty?delete this.workspaceMemento[Ak.EDITOR_PART_UI_STATE_STORAGE_KEY]:this.workspaceMemento[Ak.EDITOR_PART_UI_STATE_STORAGE_KEY]=this.createState()),this.centeredLayoutWidget){let e=this.centeredLayoutWidget.state;this.centeredLayoutWidget.isDefault(e)?delete this.profileMemento[Ak.EDITOR_PART_CENTERED_VIEW_STORAGE_KEY]:this.profileMemento[Ak.EDITOR_PART_CENTERED_VIEW_STORAGE_KEY]=e}super.saveState()}loadState(){return this.workspaceMemento[Ak.EDITOR_PART_UI_STATE_STORAGE_KEY]}createState(){return{serializedGrid:this.gridWidget.serialize(),activeGroup:this._activeGroup.id,mostRecentActiveGroups:this.mostRecentActiveGroups}}applyState(e,t){return e==="empty"?this.doApplyEmptyState():this.doApplyState(e,t)}async doApplyState(e,t){let o=await this.doPrepareApplyState();this._onDidAddGroup.pause(),this._onDidRemoveGroup.pause(),this.disposeGroups(),this.mostRecentActiveGroups=e.mostRecentActiveGroups;try{this.doApplyGridState(e.serializedGrid,e.activeGroup,void 0,t)}finally{this._onDidRemoveGroup.resume(),this._onDidAddGroup.resume()}await this.activeGroup.openEditors(o.flatMap(n=>n.editors).filter(n=>this.editorPartsView.groups.every(r=>!r.contains(n))).map(n=>({editor:n,options:{pinned:!0,preserveFocus:!0,inactive:!0}})))}async doApplyEmptyState(){await this.doPrepareApplyState(),this.mergeAllGroups(this.activeGroup)}async doPrepareApplyState(){let e=this.getGroups(1);for(let t of e)await t.closeAllEditors({excludeConfirming:!0});return e}doApplyGridState(e,t,o,n){this.doCreateGridControlWithState(e,t,o,n),this.doLayout(this._contentDimension),this.updateContainer();for(let r of this.getGroups(2))o?.includes(r)||this._onDidAddGroup.fire(r);this.notifyGroupIndexChange()}onDidChangeMementoState(e){if(e.external&&e.scope===1){this.reloadMemento(e.scope);let t=this.loadState();t&&this.applyState(t)}}toJSON(){return{type:"workbench.parts.editor"}}disposeGroups(){for(let e of this.groups)e.dispose(),this._onDidRemoveGroup.fire(e);this.groupViews.clear(),this.mostRecentActiveGroups=[]}dispose(){this._onWillDispose.fire(),this.disposeGroups(),this.gridWidget?.dispose(),super.dispose()}};Ak=I([m(4,F),m(5,Le),m(6,B),m(7,ce),m(8,yi),m(9,Zt),m(10,X)],Ak);var pRe=class extends Ak{constructor(i,e,t,o,n,r,s,l){super(i,"workbench.parts.editor","",ut.vscodeWindowId,e,t,o,n,r,s,l)}};pRe=I([m(1,F),m(2,Le),m(3,B),m(4,ce),m(5,yi),m(6,Zt),m(7,X)],pRe);async function $co(a){let i=navigator.usb;if(!i)return;let e=await i.requestDevice({filters:a?.filters??[]});if(e)return{deviceClass:e.deviceClass,deviceProtocol:e.deviceProtocol,deviceSubclass:e.deviceSubclass,deviceVersionMajor:e.deviceVersionMajor,deviceVersionMinor:e.deviceVersionMinor,deviceVersionSubminor:e.deviceVersionSubminor,manufacturerName:e.manufacturerName,productId:e.productId,productName:e.productName,serialNumber:e.serialNumber,usbVersionMajor:e.usbVersionMajor,usbVersionMinor:e.usbVersionMinor,usbVersionSubminor:e.usbVersionSubminor,vendorId:e.vendorId}}async function jco(a){let i=navigator.serial;if(!i)return;let e=await i.requestPort({filters:a?.filters??[]});if(!e)return;let t=e.getInfo();return{usbVendorId:t.usbVendorId,usbProductId:t.usbProductId}}async function Qco(a){let i=navigator.hid;if(!i)return;let e=await i.requestDevice({filters:a?.filters??[]});if(!e.length)return;let t=e[0];return{opened:t.opened,vendorId:t.vendorId,productId:t.productId,productName:t.productName,collections:t.collections}}var o9o=d(2181,null),n9o=d(2179,null),r9o=d(2180,null),QWt={open:o9o,close:n9o,find:r9o};async function Yco(a,i){let e=[];return await Xco(a,e,i.logsHome,i.logsHome),e}async function Xco(a,i,e,t){let o=await a.resolve(e);for(let{resource:n,isDirectory:r}of o.children||[])if(r)await Xco(a,i,n,t);else{let s=(await a.readFile(n)).value.toString();if(s){let l=Wd(t,n);l&&i.push({relativePath:l,contents:s})}}}var zJe=class{constructor(i,e,t,o){this.fileService=i;this.environmentService=e;this.lifecycleService=t;this.logService=o}async getLogs(){return Yco(this.fileService,this.environmentService)}async whenWorkbenchRestored(){this.logService.info("[driver] Waiting for restored lifecycle phase..."),await this.lifecycleService.when(3),this.logService.info("[driver] Restored lifecycle phase reached. Waiting for contributions..."),await ne.as(Qi.Workbench).whenRestored,this.logService.info("[driver] Workbench contributions created.")}async setValue(i,e){let t=ut.document.querySelector(i);if(!t)return Promise.reject(new Error(`Element not found: ${i}`));let o=t;o.value=e;let n=new Event("input",{bubbles:!0,cancelable:!0});o.dispatchEvent(n)}async isActiveElement(i){if(ut.document.querySelector(i)!==ut.document.activeElement){let t=[],o=ut.document.activeElement;for(;o;){let n=o.tagName,r=o.id?`#${o.id}`:"",s=di(o.className.split(/\s+/g).map(l=>l.trim())).map(l=>`.${l}`).join("");t.unshift(`${n}${r}${s}`),o=o.parentElement}throw new Error(`Active element not found. Current active element is '${t.join(" > ")}'. Looking for ${i}`)}return!0}async getElements(i,e){let t=ut.document.querySelectorAll(i),o=[];for(let n=0;n<t.length;n++){let r=t.item(n);o.push(this.serializeElement(r,e))}return o}serializeElement(i,e){let t=Object.create(null);for(let s=0;s<i.attributes.length;s++){let l=i.attributes.item(s);l&&(t[l.name]=l.value)}let o=[];if(e)for(let s=0;s<i.children.length;s++){let l=i.children.item(s);l&&o.push(this.serializeElement(l,!0))}let{left:n,top:r}=cO(i);return{tagName:i.tagName,className:i.className,textContent:i.textContent||"",attributes:t,children:o,left:n,top:r}}async getElementXY(i,e,t){let o=typeof e=="number"&&typeof t=="number"?{x:e,y:t}:void 0;return this._getElementXY(i,o)}async typeInEditor(i,e){let t=ut.document.querySelector(i);if(!t)throw new Error(`Editor not found: ${i}`);if(zJt(t)){let o=t.editContext;if(!o)throw new Error(`Edit context not found: ${i}`);let n=o.selectionStart,r=o.selectionEnd,s=new TextUpdateEvent("textupdate",{updateRangeStart:n,updateRangeEnd:r,text:e,selectionStart:n+e.length,selectionEnd:n+e.length,compositionStart:0,compositionEnd:0});o.dispatchEvent(s)}else if(J9(t)){let o=t.selectionStart,n=o+e.length,r=t.value,s=r.substr(0,o)+e+r.substr(o);t.value=s,t.setSelectionRange(n,n);let l=new Event("input",{bubbles:!0,cancelable:!0});t.dispatchEvent(l)}}async getEditorSelection(i){let e=ut.document.querySelector(i);if(!e)throw new Error(`Editor not found: ${i}`);if(zJt(e)){let t=e.editContext;if(!t)throw new Error(`Edit context not found: ${i}`);return{selectionStart:t.selectionStart,selectionEnd:t.selectionEnd}}else{if(J9(e))return{selectionStart:e.selectionStart,selectionEnd:e.selectionEnd};throw new Error(`Unknown type of element: ${i}`)}}async getTerminalBuffer(i){let e=ut.document.querySelector(i);if(!e)throw new Error(`Terminal not found: ${i}`);let t=e.xterm;if(!t)throw new Error(`Xterm not found: ${i}`);let o=[];for(let n=0;n<t.buffer.active.length;n++)o.push(t.buffer.active.getLine(n).translateToString(!0));return o}async writeInTerminal(i,e){let t=ut.document.querySelector(i);if(!t)throw new Error(`Element not found: ${i}`);let o=t.xterm;if(!o)throw new Error(`Xterm not found: ${i}`);o.input(e)}getLocaleInfo(){return Promise.resolve({language:wr,locale:GSe})}getLocalizedStrings(){return Promise.resolve({open:QWt.open,close:QWt.close,find:QWt.find})}async _getElementXY(i,e){let t=ut.document.querySelector(i);if(!t)return Promise.reject(new Error(`Element not found: ${i}`));let{left:o,top:n}=cO(t),{width:r,height:s}=$m(t),l,c;return e?(l=o+e.x,c=n+e.y):(l=o+r/2,c=n+s/2),l=Math.round(l),c=Math.round(c),{x:l,y:c}}};zJe=I([m(0,fe),m(1,Eo),m(2,ji),m(3,se)],zJe);function YWt(a){Object.assign(ut,{driver:a.createInstance(zJe)})}var ND=class extends x{constructor(e,t={getWindowsCount:_Ie,getWindows:SC},o,n,r,s){super();this.hostService=o;this.environmentService=n;this.contextMenuService=r;this.layoutService=s;this.enableWindowFocusOnElementFocus(e),this.enableMultiWindowAwareTimeout(e,t),this.registerFullScreenListeners(e.vscodeWindowId),this.registerContextMenuListeners(e)}static{this.TIMEOUT_HANDLES=Number.MIN_SAFE_INTEGER}static{this.TIMEOUT_DISPOSABLES=new Map}enableWindowFocusOnElementFocus(e){let t=e.HTMLElement.prototype.focus,o=this;e.HTMLElement.prototype.focus=function(n){o.onElementFocus(Re(this)),t.apply(this,[n])}}onElementFocus(e){!e.document.hasFocus()&&Bqi()&&(e.focus(),!this.environmentService.extensionTestsLocationURI&&!e.document.hasFocus()&&this.hostService.focus(e))}enableMultiWindowAwareTimeout(e,t={getWindowsCount:_Ie,getWindows:SC}){let o=e.setTimeout;Object.defineProperty(e,"vscodeOriginalSetTimeout",{get:()=>o});let n=e.clearTimeout;Object.defineProperty(e,"vscodeOriginalClearTimeout",{get:()=>n}),e.setTimeout=function(r,s=0,...l){if(t.getWindowsCount()===1||typeof r=="string"||s===0)return o.apply(this,[r,s,...l]);let c=new Set,u=ND.TIMEOUT_HANDLES++;ND.TIMEOUT_DISPOSABLES.set(u,c);let p=$c(r,()=>{Be(c),ND.TIMEOUT_DISPOSABLES.delete(u)});for(let{window:h,disposables:g}of t.getWindows()){if(zy(h)&&h.document.visibilityState==="hidden")continue;let f=!1,v=h.vscodeOriginalSetTimeout?.apply(this,[(...S)=>{f||p(...S)},s,...l]),b=Z(()=>{f=!0,h.vscodeOriginalClearTimeout?.apply(this,[v]),c.delete(b)});g.add(b),c.add(b)}return u},e.clearTimeout=function(r){let s=typeof r=="number"?ND.TIMEOUT_DISPOSABLES.get(r):void 0;s?(Be(s),ND.TIMEOUT_DISPOSABLES.delete(r)):n.apply(this,[r])}}static async confirmOnShutdown(e,t){let o=e.get(at),n=e.get(B),r=t===2?Ze?d(4564,null):d(4563,null):d(4554,null),s=t===2?Ze?d(4562,null):d(4556,null):d(4553,null),l=await o.confirm({message:r,primaryButton:s,checkbox:{label:d(4555,null)}});return l.confirmed&&l.checkboxChecked&&await n.updateValue("window.confirmBeforeClose","never"),l.confirmed}registerFullScreenListeners(e){this._register(this.hostService.onDidChangeFullScreen(({windowId:t,fullscreen:o})=>{if(t===e){let n=rb(e);n&&L$(o,n.window)}}))}registerContextMenuListeners(e){if(e!==ut)return;let t=o=>this.layoutService.activeContainer.classList.toggle("context-menu-visible",o);this._register(this.contextMenuService.onDidShowContextMenu(()=>t(!0))),this._register(this.contextMenuService.onDidHideContextMenu(()=>t(!1)))}};ND=I([m(2,Zt),m(3,At),m(4,Xe),m(5,yi)],ND);var XWt=class extends ND{constructor(e,t,o,n,r,s,l,c,u,p){super(ut,void 0,u,s,p,l);this.openerService=e;this.lifecycleService=t;this.dialogService=o;this.labelService=n;this.productService=r;this.browserEnvironmentService=s;this.instantiationService=c;this.registerListeners(),this.create()}registerListeners(){this._register(this.lifecycleService.onWillShutdown(()=>this.onWillShutdown()));let e=dc&&ut.visualViewport?ut.visualViewport:ut;this._register(j(e,re.RESIZE,()=>{this.layoutService.layout(),dc&&ut.scrollTo(0,0)})),this._register(j(this.layoutService.mainContainer,re.WHEEL,t=>t.preventDefault(),{passive:!1})),this._register(j(this.layoutService.mainContainer,re.CONTEXT_MENU,t=>Xt.stop(t,!0))),this._register(j(this.layoutService.mainContainer,re.DROP,t=>Xt.stop(t,!0)))}onWillShutdown(){U.toPromise(U.any(U.once(new Gn(ut.document.body,re.KEY_DOWN,!0).event),U.once(new Gn(ut.document.body,re.MOUSE_DOWN,!0).event))).then(async()=>{await Li(3e3),await this.dialogService.prompt({type:bt.Error,message:d(4567,null),detail:d(4568,null),buttons:[{label:d(4565,null),run:()=>ut.location.reload()}]})})}create(){this.setupOpenHandlers(),this.registerLabelFormatters(),this.registerCommands(),this.setupDriver()}setupDriver(){this.environmentService.enableSmokeTestDriver&&YWt(this.instantiationService)}setupOpenHandlers(){this.openerService.setDefaultExternalOpener({openExternal:async e=>{let t=!1;if(this.browserEnvironmentService.options?.openerAllowedExternalUrlPrefixes){for(let o of this.browserEnvironmentService.options.openerAllowedExternalUrlPrefixes)if(e.startsWith(o)){t=!0;break}}if(ec(e,Q.http)||ec(e,Q.https))Jb?Jqi(e,!t)||await this.dialogService.prompt({type:bt.Warning,message:d(4569,null),custom:{markdownDetails:[{markdown:new Ie(d(4570,null,"https://aka.ms/allow-vscode-popup"),!0)}]},buttons:[{label:d(4566,null),run:()=>t?GJt(e):V$e(e)}],cancelButton:!0}):t?GJt(e):V$e(e);else{let o=()=>{this.lifecycleService.withExpectedShutdown({disableShutdownHandling:!0},()=>ut.location.href=e)};o();let n=async()=>{let{downloadUrl:r}=this.productService,s,l=[{label:d(4558,null),run:()=>o()}];r!==void 0?(s=d(4559,null,this.productService.nameLong,this.productService.nameLong),l.push({label:d(4557,null),run:async()=>{await this.openerService.open(A.parse(r)),n()}})):s=d(4560,null,this.productService.nameLong,this.productService.nameLong),await this.hostService.withExpectedShutdown(()=>this.dialogService.prompt({type:bt.Info,message:d(4561,null),detail:s,buttons:l,cancelButton:!0}))};ec(e,this.productService.urlProtocol)&&await n()}return!0}})}registerLabelFormatters(){this._register(this.labelService.registerFormatter({scheme:Q.vscodeUserData,priority:!0,formatting:{label:"(Settings) ${path}",separator:"/"}}))}registerCommands(){$e.registerCommand("workbench.experimental.requestUsbDevice",async(e,t)=>$co(t)),$e.registerCommand("workbench.experimental.requestSerialPort",async(e,t)=>jco(t)),$e.registerCommand("workbench.experimental.requestHidDevice",async(e,t)=>Qco(t))}};XWt=I([m(0,Je),m(1,ji),m(2,at),m(3,rt),m(4,tt),m(5,cd),m(6,yi),m(7,F),m(8,Zt),m(9,Xe)],XWt);var OD=le("auxiliaryWindowService");var s9o=new si(vwt.width,vwt.height),Xpe=class extends ND{constructor(e,t,o,n,r,s,l,c){super(e,void 0,r,s,l,c);this.window=e;this.container=t;this.configurationService=n;this._onWillLayout=this._register(new E);this.onWillLayout=this._onWillLayout.event;this._onDidLayout=this._register(new E);this.onDidLayout=this._onDidLayout.event;this._onBeforeUnload=this._register(new E);this.onBeforeUnload=this._onBeforeUnload.event;this._onUnload=this._register(new E);this.onUnload=this._onUnload.event;this._onWillDispose=this._register(new E);this.onWillDispose=this._onWillDispose.event;this.compact=!1;this.whenStylesHaveLoaded=o.wait().then(()=>{}),this.registerListeners()}updateOptions(e){this.compact=e.compact}registerListeners(){this._register(j(this.window,re.BEFORE_UNLOAD,e=>this.handleBeforeUnload(e))),this._register(j(this.window,re.UNLOAD,()=>this.handleUnload())),this._register(j(this.window,"unhandledrejection",e=>{mt(e.reason),e.preventDefault()})),this._register(j(this.window,re.RESIZE,()=>this.layout())),this._register(j(this.container,re.SCROLL,()=>this.container.scrollTop=0)),Wt?(this._register(j(this.container,re.DROP,e=>Xt.stop(e,!0))),this._register(j(this.container,re.WHEEL,e=>e.preventDefault(),{passive:!1})),this._register(j(this.container,re.CONTEXT_MENU,e=>Xt.stop(e,!0)))):(this._register(j(this.window.document.body,re.DRAG_OVER,e=>Xt.stop(e))),this._register(j(this.window.document.body,re.DROP,e=>Xt.stop(e))))}handleBeforeUnload(e){let t;if(this._onBeforeUnload.fire({veto(r){r&&(t=r)}}),t){this.handleVetoBeforeClose(e,t);return}let o=this.configurationService.getValue("window.confirmBeforeClose");(o==="always"||o==="keyboardOnly"&&nb.getInstance().isModifierPressed)&&this.confirmBeforeClose(e)}handleVetoBeforeClose(e,t){this.preventUnload(e)}preventUnload(e){e.preventDefault(),e.returnValue=d(17396,null)}confirmBeforeClose(e){this.preventUnload(e)}handleUnload(){this._onUnload.fire()}layout(){let e=$m(this.window.document.body,s9o,this.container);this._onWillLayout.fire(e),this._onDidLayout.fire(e)}createState(){return{bounds:{x:this.window.screenX,y:this.window.screenY,width:this.window.outerWidth,height:this.window.outerHeight},zoomLevel:mC(this.window),compact:this.compact}}dispose(){this._store.isDisposed||(this._onWillDispose.fire(),super.dispose())}};Xpe=I([m(3,B),m(4,Zt),m(5,At),m(6,Xe),m(7,yi)],Xpe);var P3=class extends x{constructor(e,t,o,n,r,s,l){super();this.layoutService=e;this.dialogService=t;this.configurationService=o;this.telemetryService=n;this.hostService=r;this.environmentService=s;this.contextMenuService=l;this._onDidOpenAuxiliaryWindow=this._register(new E);this.onDidOpenAuxiliaryWindow=this._onDidOpenAuxiliaryWindow.event;this.windows=new Map}static{this.WINDOW_IDS=gv(ut)+1}async open(e){Mo("code/auxiliaryWindow/willOpen");let t=await this.openWindow(e);if(!t)throw new Error(d(17400,null));let o=await this.resolveWindowId(t);eht(t,o);let n=new N,{container:r,stylesLoaded:s}=this.createContainer(t,n,e),l=this.createAuxiliaryWindow(t,r,s);l.updateOptions({compact:e?.compact??!1});let c=new N;this.windows.set(t.vscodeWindowId,l),c.add(Z(()=>this.windows.delete(t.vscodeWindowId)));let u=new N;return U.once(l.onWillDispose)(()=>{t.close(),n.dispose(),c.dispose(),u.dispose()}),c.add(Oqi(t)),this._onDidOpenAuxiliaryWindow.fire({window:l,disposables:u}),Mo("code/auxiliaryWindow/didOpen"),this.telemetryService.publicLog2("auxiliaryWindowOpen",{bounds:!!e?.bounds}),l}createAuxiliaryWindow(e,t,o){return new Xpe(e,t,o,this.configurationService,this.hostService,this.environmentService,this.contextMenuService,this.layoutService)}async openWindow(e){let t=Ki(),o={x:t.screenX,y:t.screenY,width:t.outerWidth,height:t.outerHeight},n=vwt,r=Math.max(e?.bounds?.width??n.width,jCe.WIDTH),s=Math.max(e?.bounds?.height??n.height,jCe.HEIGHT),l={x:e?.bounds?.x??Math.max(o.x+o.width/2-r/2,0),y:e?.bounds?.y??Math.max(o.y+o.height/2-s/2,0),width:r,height:s};!e?.bounds&&l.x===o.x&&l.y===o.y&&(l={...l,x:l.x+30,y:l.y+30});let c=di(["popup=yes",`left=${l.x}`,`top=${l.y}`,`width=${l.width}`,`height=${l.height}`,e?.nativeTitlebar?"window-native-titlebar=yes":void 0,e?.disableFullscreen?"window-disable-fullscreen=yes":void 0,e?.alwaysOnTop?"window-always-on-top=yes":void 0,e?.mode===0?"window-maximized=yes":void 0,e?.mode===2?"window-fullscreen=yes":void 0]),u=ut.open(qSe?"":"about:blank",void 0,c.join(","));return!u&&Wt?(await this.dialogService.prompt({type:bt.Warning,message:d(17398,null),custom:{markdownDetails:[{markdown:new Ie(d(17399,null,"https://aka.ms/allow-vscode-popup"),!0)}]},buttons:[{label:d(17397,null),run:()=>this.openWindow(e)}],cancelButton:!0})).result:u?.window}async resolveWindowId(e){return P3.WINDOW_IDS++}createContainer(e,t,o){e.document.createElement=function(){throw new Error('Not allowed to create elements in child window JavaScript context. Always use the main window so that "xyz instanceof HTMLElement" continues to work.')},this.applyMeta(e);let{stylesLoaded:n}=this.applyCSS(e,t),r=this.applyHTML(e,t);return{stylesLoaded:n,container:r}}applyMeta(e){for(let o of['meta[charset="utf-8"]','meta[http-equiv="Content-Security-Policy"]','meta[name="viewport"]','meta[name="theme-color"]']){let n=ut.document.querySelector(o);if(n){let r=Cgt(e.document.head);if(_gt(n,r),o==='meta[http-equiv="Content-Security-Policy"]'){let s=r.getAttribute("content");s&&r.setAttribute("content",s.replace(/(script-src[^\;]*)/,"script-src 'none'"))}}}let t=ut.document.querySelector('link[rel="icon"]');if(t){let o=xgt(e.document.head);_gt(t,o)}}applyCSS(e,t){Mo("code/auxiliaryWindow/willApplyCSS");let o=new Map,n=new gp;n.wait().then(()=>Mo("code/auxiliaryWindow/didLoadCSSStyles"));let r=t.add(new N),s=0;function l(){--s===0&&(r.dispose(),n.open())}function c(u){if(n5i(u))return;let p=e.document.head.appendChild(u.cloneNode(!0));u.tagName.toLowerCase()==="link"&&(s++,r.add(j(p,"load",l)),r.add(j(p,"error",l))),o.set(u,p)}s++;try{for(let u of ut.document.head.querySelectorAll('link[rel="stylesheet"], style'))c(u)}finally{l()}return t.add(r5i(e)),t.add(F$e.observe(ut.document.head,t,{childList:!0,subtree:!0})(u=>{for(let p of u)if(!(p.type!=="childList"||p.target.nodeName.toLowerCase()==="title"||p.target.nodeName.toLowerCase()==="script"||p.target.nodeName.toLowerCase()==="meta")){for(let h of p.addedNodes)if(Do(h)&&(h.tagName.toLowerCase()==="style"||h.tagName.toLowerCase()==="link"))c(h);else if(h.nodeType===Node.TEXT_NODE&&h.parentNode){let g=o.get(h.parentNode);g&&(g.textContent=h.textContent)}for(let h of p.removedNodes){let g=o.get(h);g&&(g.parentNode?.removeChild(g),o.delete(h))}}})),Mo("code/auxiliaryWindow/didApplyCSS"),{stylesLoaded:n}}applyHTML(e,t){Mo("code/auxiliaryWindow/willApplyHTML");let o=_("div",{role:"application"});return Hqi(o,0,0,0,0,"relative"),o.style.display="flex",o.style.height="100%",o.style.flexDirection="column",e.document.body.append(o),t.add(Dgt(ut.document.documentElement,e.document.documentElement)),t.add(Dgt(ut.document.body,e.document.body)),t.add(Dgt(this.layoutService.mainContainer,o,["class"])),Mo("code/auxiliaryWindow/didApplyHTML"),o}getWindow(e){return this.windows.get(e)}};P3=I([m(0,yi),m(1,at),m(2,B),m(3,Te),m(4,Zt),m(5,At),m(6,Xe)],P3);Ee(OD,P3,1);var T0=le("titleService");var JWt=im(new E);W(class extends K{constructor(){super({id:"workbench.action.toggleCompactAuxiliaryWindow",title:L(3862,"Toggle Window Compact Mode"),category:Ve.View,f1:!0,precondition:Rw})}async run(){JWt.fire({windowId:Ki().vscodeWindowId,compact:"toggle"})}});W(class extends K{constructor(){super({id:"workbench.action.enableCompactAuxiliaryWindow",title:d(3861,null),icon:R.screenFull,menu:{id:D.LayoutControlMenu,when:C.and(PF.toNegated(),Cb),order:0}})}async run(){JWt.fire({windowId:Ki().vscodeWindowId,compact:!0})}});W(class extends K{constructor(){super({id:"workbench.action.disableCompactAuxiliaryWindow",title:d(3860,null),icon:R.screenNormal,menu:{id:D.LayoutControlMenu,when:C.and(PF,Cb),order:0}})}async run(){JWt.fire({windowId:Ki().vscodeWindowId,compact:!1})}});var vH=class{constructor(i,e,t,o,n,r,s,l,c){this.editorPartsView=i;this.instantiationService=e;this.auxiliaryWindowService=t;this.lifecycleService=o;this.configurationService=n;this.statusbarService=r;this.titleService=s;this.editorService=l;this.layoutService=c}static{this.STATUS_BAR_VISIBILITY="workbench.statusBar.visible"}async create(i,e){let t=this,o=new N,n=!!e?.compact;function r(){let T=0;return y&&(T+=S.height),f&&v&&(T+=f.height),T}function s(T){y?un(S.container):vo(S.container),T&&u.layout()}function l(T){f&&(v?un(f.container):vo(f.container),T&&u.layout())}function c(T){if(T===n)return;n=T,u.updateOptions({compact:n}),f?.updateOptions({compact:n}),h.updateOptions({compact:n});let P=y;y=!n&&t.configurationService.getValue(vH.STATUS_BAR_VISIBILITY)!==!1,P!==y&&s(!0)}let u=o.add(await this.auxiliaryWindowService.open(e)),p=_(".part.editor",{role:"main"});p.style.position="relative",u.container.appendChild(p);let h=o.add(this.instantiationService.createInstance(Jpe,u.window.vscodeWindowId,this.editorPartsView,e?.state,i));h.updateOptions({compact:n}),o.add(this.editorPartsView.registerPart(h)),h.create(p);let g=o.add(h.scopedInstantiationService.createChild(new _o([ee,this.editorService.createScoped(h,o)]))),f,v=!1;if(Vr&&jO(this.configurationService)){f=o.add(this.titleService.createAuxiliaryTitlebarPart(u.container,h,g)),f.updateOptions({compact:n}),v=MB(this.configurationService,u.window,void 0);let T=()=>{let P=v;v=MB(this.configurationService,u.window,void 0),P!==v&&l(!0)};o.add(f.onDidChange(()=>u.layout())),o.add(this.layoutService.onDidChangePartVisibility(()=>T())),o.add(YN(P=>{P===u.window.vscodeWindowId&&T()})),l(!1)}else o.add(g.createInstance(Mk,u.window));let S=o.add(this.statusbarService.createAuxiliaryStatusbarPart(u.container,g)),y=!n&&this.configurationService.getValue(vH.STATUS_BAR_VISIBILITY)!==!1;o.add(this.configurationService.onDidChangeConfiguration(T=>{T.affectsConfiguration(vH.STATUS_BAR_VISIBILITY)&&(y=!n&&this.configurationService.getValue(vH.STATUS_BAR_VISIBILITY)!==!1,s(!0))})),s(!1);let w=o.add(U.once(h.onWillClose)(()=>u.window.close()));o.add(U.once(u.onUnload)(()=>{o.isDisposed||(w.dispose(),h.close(),o.dispose())})),o.add(U.once(this.lifecycleService.onDidShutdown)(()=>o.dispose())),o.add(u.onBeforeUnload(T=>{for(let P of h.groups)for(let O of P.editors){let V=O.canMove(P.id,this.editorPartsView.mainPart.activeGroup.id);if(typeof V=="string"){P.openEditor(O),T.veto(V);return}}})),o.add(u.onWillLayout(T=>{let P=f?.height??0;f?.layout(T.width,P,0,0);let O=T.height-r();h.layout(T.width,O,P,0),S.layout(T.width,S.height,T.height-S.height,0)})),u.layout(),o.add(JWt.event(T=>{if(T.windowId===u.window.vscodeWindowId){let P;typeof T.compact=="boolean"?P=T.compact:P=!n,c(P)}})),o.add(h.onDidAddGroup(T=>{c(!1),o.add(T.onDidActiveEditorChange(()=>{T.count>1&&c(!1)}))})),o.add(h.activeGroup.onDidActiveEditorChange(()=>{h.activeGroup.count>1&&c(!1)}));let k=o.add(g.createChild(new _o([kr,this.statusbarService.createScoped(S,o)])));return{part:h,instantiationService:k,disposables:o}}};vH=I([m(1,F),m(2,OD),m(3,ji),m(4,B),m(5,kr),m(6,T0),m(7,ee),m(8,yi)],vH);var Jpe=class extends Ak{constructor(e,t,o,n,r,s,l,c,u,p,h){let g=Jpe.COUNTER++;super(t,`workbench.parts.auxiliaryEditor.${g}`,n,e,r,s,l,c,u,p,h);this.state=o;this._onWillClose=this._register(new E);this.onWillClose=this._onWillClose.event;this.optionsDisposable=this._register(new me);this.isCompact=!1}static{this.COUNTER=1}handleContextKeys(){Cb.bindTo(this.scopedContextKeyService).set(!0),super.handleContextKeys()}updateOptions(e){this.isCompact=e.compact,e.compact?this.optionsDisposable.value||(this.optionsDisposable.value=this.enforcePartOptions({showTabs:"none",closeEmptyGroups:!0})):this.optionsDisposable.clear()}addGroup(e,t,o){return this.isCompact&&(e=this.editorPartsView.mainPart.activeGroup),super.addGroup(e,t,o)}removeGroup(e,t){let o=this.assertGroupView(e);this.count===1&&this.activeGroup===o?this.doRemoveLastGroup(t):super.removeGroup(e,t)}doRemoveLastGroup(e){let t=!e&&this.shouldRestoreFocus(this.container),n=this.editorPartsView.getGroups(1)[1];n&&n.groupsView.activateGroup(n,void 0,1),n&&t&&(n.groupsView===this.editorPartsView.mainPart&&!this.layoutService.isVisible("workbench.parts.editor",ut)||n.focus()),this.doClose(!1)}loadState(){return this.state}saveState(){}close(){return this.doClose(!0)}doClose(e){let t=!0;if(e){for(let o of this.groups)o.closeAllEditors({excludeConfirming:!0});if(t=this.mergeGroupsToMainPart(),!t)return!1}return this._onWillClose.fire(),t}mergeGroupsToMainPart(){if(!this.groups.some(o=>o.count>0))return!0;let e;for(let o of this.editorPartsView.mainPart.getGroups(1))if(!o.isLocked){e=o;break}e||(e=this.editorPartsView.mainPart.addGroup(this.editorPartsView.mainPart.activeGroup,this.partOptions.openSideBySideDirection==="right"?3:1));let t=this.mergeAllGroups(e,{preserveExistingIndex:!0});return e.focus(),t}};Jpe=I([m(4,F),m(5,Le),m(6,B),m(7,ce),m(8,yi),m(9,Zt),m(10,X)],Jpe);var qwi=400,a9o=300,l9o=1400,c9o=900,mRe=2,hRe=33,Jco=20,Zco=16,ZWt=160,edo=220,d9o=new Set(["workbench.action.quit","workbench.action.reloadWindow","workbench.action.toggleFullScreen","workbench.action.gotoSymbol","workbench.action.gotoLine","workbench.action.zoomIn","workbench.action.zoomOut","workbench.action.zoomReset","workbench.action.files.save","workbench.action.files.saveAll","workbench.action.files.revert","workbench.action.closeActiveEditor","workbench.action.closeAllEditors","workbench.action.closeEditorsInGroup","workbench.action.closeUnmodifiedEditors","workbench.action.openSettings","workbench.action.openSettings2","workbench.action.openSettingsJson","workbench.action.openGlobalSettings","workbench.action.openApplicationSettingsJson","workbench.action.openRawDefaultSettings","workbench.action.openWorkspaceSettings","workbench.action.openWorkspaceSettingsFile","workbench.action.openFolderSettings","workbench.action.openFolderSettingsFile","workbench.action.openRemoteSettings","workbench.action.openRemoteSettingsFile","workbench.action.openAccessibilitySettings","workbench.action.configureLanguageBasedSettings","workbench.action.openGlobalKeybindings","workbench.action.openDefaultKeybindingsFile","workbench.action.openGlobalKeybindingsFile","workbench.action.openKeyboardLayoutPicker",Hyi,Uyi,zyi,Kyi,Gyi,qyi]),KJe="workbench.editor.useModal",gRe=class{constructor(i,e,t,o,n,r,s){this.editorPartsView=i;this.instantiationService=e;this.editorService=t;this.layoutService=o;this.keybindingService=n;this.hostService=r;this.configurationService=s}async create(i){let e=new N,t=_(".monaco-modal-editor-block");this.layoutService.mainContainer.appendChild(t),e.add(Z(()=>t.remove())),e.add(j(t,re.MOUSE_DOWN,pt=>{pt.target===t&&(Xt.stop(pt,!0),y.close())}));let o=this.configurationService.getValue(KJe);e.add(this.configurationService.onDidChangeConfiguration(pt=>{pt.affectsConfiguration(KJe)&&(o=this.configurationService.getValue(KJe))})),e.add(j(t,re.KEY_DOWN,pt=>{let et=new gi(pt);if(o!=="all"){let Ti=this.keybindingService.softDispatch(et,this.layoutService.mainContainer);Ti.kind===2&&Ti.commandId&&Ti.commandId.startsWith("workbench.")&&!d9o.has(Ti.commandId)&&Xt.stop(et,!0)}}));let n=new fR;e.add(Z(()=>n.dispose())),n.domNode.classList.add("modal-editor-resizable");let r=qwi+(i?.sidebar?ZWt:0);n.minSize=new si(r,a9o),t.appendChild(n.domNode);let s=n.domNode.appendChild(_(".modal-editor-shadow")),l="modal-editor-title",c=_(".part.editor.modal-editor-part",{role:"dialog","aria-modal":"true","aria-labelledby":l});s.appendChild(c);let u=c.appendChild(_(".modal-editor-header")),p=M(u,_("div.modal-editor-title.show-file-icons"));p.id=l,p.textContent="";let h=M(u,_("div.modal-editor-navigation"));vo(h),e.add(j(h,re.DBLCLICK,pt=>Xt.stop(pt,!0)));let g=e.add(new Wi(h,{title:d(4333,null)}));g.icon=R.chevronLeft,g.element.classList.add("modal-editor-nav-button"),e.add(g.onDidClick(()=>{let pt=y.navigation;pt&&pt.current>0&&pt.navigate(pt.current-1)}));let f=M(h,_("span.modal-editor-nav-label"));f.setAttribute("aria-live","polite");let v=e.add(new Wi(h,{title:d(4332,null)}));v.icon=R.chevronRight,v.element.classList.add("modal-editor-nav-button"),e.add(v.onDidClick(()=>{let pt=y.navigation;pt&&pt.current<pt.total-1&&pt.navigate(pt.current+1)}));let b=M(u,_("div.modal-editor-action-container")),S=this.createSidebar(c,i?.sidebar,e);S&&(c.classList.add("has-sidebar"),e.add(S.onDidResize(()=>Oe())));let y=e.add(this.instantiationService.createInstance(Zpe,ut.vscodeWindowId,this.editorPartsView,t,i));e.add(this.editorPartsView.registerPart(y)),y.create(c),e.add(U.once(y.onWillClose)(()=>e.dispose())),e.add(U.runAndSubscribe(y.onDidChangeNavigation,(pt=>{pt&&pt.total>1?(un(h),f.textContent=d(4331,null,pt.current+1,pt.total),g.enabled=pt.current>0,v.enabled=pt.current<pt.total-1):vo(h)}),y.navigation));let w=this.editorService.createScoped(y,e),k=e.add(y.scopedInstantiationService.createChild(new _o([ee,w]))),T=M(b,_("div.modal-editor-editor-actions")),P=e.add(k.createInstance(ol,T,{hiddenItemStrategy:-1,highlightToggledItems:!0})),O=M(b,_("div.modal-editor-action-separator")),V=e.add(new N),H=()=>{V.clear();let pt=y.activeGroup.createEditorActions(V,D.ModalEditorEditorTitle);V.add(pt.onDidChange(()=>H()));let{primary:et,secondary:Ti}=pt.actions;P.setActions(B_(et),B_(Ti));let Ht=et.length>0||Ti.length>0;hh(Ht,O)};e.add(U.runAndSubscribe(w.onDidActiveEditorChange,()=>H())),e.add(w.onDidEditorsChange(()=>y.enforceModalPartOptions())),e.add(k.createInstance(or,b,D.ModalEditorTitle,{hiddenItemStrategy:-1,highlightToggledItems:!0,menuOptions:{shouldForwardArgs:!0}}));let G=e.add(k.createInstance(Tk,p,{})),$=e.add(new me),J,ae=()=>{let pt=y.activeGroup.activeEditor;if(pt){let{labelFormat:et}=y.partOptions;G.element.setResource({resource:po.getOriginalUri(pt,{supportSideBySide:3}),name:pt.getName(),description:pt.getDescription(et==="short"?0:et==="long"?2:1)||""},{icon:pt.getIcon(),extraClasses:pt.getLabelExtraClasses()}),J!==pt&&(J=pt,$.value=pt.onDidChangeLabel(()=>ae()))}else G.element.clear(),J=void 0,$.clear()};e.add(U.runAndSubscribe(w.onDidActiveEditorChange,ae)),e.add(j(u,re.DBLCLICK,pt=>{Xt.stop(pt),y.handleHeaderDoubleClick()}));let he=e.add(new N),oe=!1;e.add(j(u,re.MOUSE_DOWN,pt=>{if(y.maximized||pt.button!==0)return;let et=pt.target;if(et.closest(".monaco-button")||et.closest(".action-item"))return;pt.preventDefault(),he.clear();let Ti=pt.clientX,Ht=pt.clientY,zi=parseFloat(n.domNode.style.left)||0,Vo=parseFloat(n.domNode.style.top)||0;oe=!1;let sn=mn=>{oe=!0,Xt.stop(mn,!0);let hn=this.layoutService.mainContainerDimension,yo=this.layoutService.mainContainerOffset.top,Mr=n.size.width,cn=n.size.height,er=0,Ns=yo,ua=Math.max(er,hn.width-Mr),xm=Math.max(Ns,hn.height-cn),tm=Math.max(er,Math.min(ua,zi+(mn.clientX-Ti))),Lu=Math.max(Ns,Math.min(xm,Vo+(mn.clientY-Ht))),jg=(hn.width-Mr)/2,Ir=Math.max(yo,(hn.height-cn)/2);Math.abs(tm-jg)<Jco&&Math.abs(Lu-Ir)<Jco&&(tm=jg,Lu=Ir),n.domNode.style.left=`${tm}px`,n.domNode.style.top=`${Lu}px`},_n=mn=>{if(Xt.stop(mn,!0),he.clear(),oe){let hn=parseFloat(n.domNode.style.left)||0,yo=parseFloat(n.domNode.style.top)||0,Mr=this.layoutService.mainContainerDimension,cn=this.layoutService.mainContainerOffset.top,er=(Mr.width-n.size.width)/2,Ns=Math.max(cn,(Mr.height-n.size.height)/2);Math.abs(hn-er)<1&&Math.abs(yo-Ns)<1?y.position=void 0:y.position={left:hn,top:yo}}};he.add(j(ut,re.MOUSE_MOVE,sn,!0)),he.add(j(ut,re.MOUSE_UP,_n,!0))})),e.add(j(u,re.CLICK,pt=>{let et=oe;oe=!1,!et&&(Xt.stop(pt),y.activeGroup.focus())}));let de=!1,Ce=0,xe=0,ze=si.None;e.add(n.onDidWillResize(()=>{de=!0,Ce=parseFloat(n.domNode.style.left)||0,xe=parseFloat(n.domNode.style.top)||0,ze=new si(n.size.width,n.size.height)})),e.add(n.onDidResize(pt=>{if(!pt.done){let Ht=this.layoutService.mainContainerDimension,zi=this.layoutService.mainContainerOffset.top,Vo=pt.dimension.width-ze.width,sn=pt.dimension.height-ze.height,_n=pt.west?Ce-Vo:Ce,mn=pt.north?xe-sn:xe,hn=pt.dimension.width,yo=pt.dimension.height;_n<0&&(hn+=_n,_n=0),mn<zi&&(yo+=mn-zi,mn=zi),_n+hn>Ht.width&&(hn=Ht.width-_n),mn+yo>Ht.height&&(yo=Ht.height-mn),(hn!==pt.dimension.width||yo!==pt.dimension.height)&&n.layout(yo,hn),pt.west&&(n.domNode.style.left=`${_n}px`),pt.north&&(n.domNode.style.top=`${mn}px`)}let et=n.size,Ti=S?.getWidth()??0;if(y.layout(Math.max(0,et.width-mRe-Ti),et.height-mRe-hRe,0,0),S?.layout(et.height-mRe-hRe),pt.done){de=!1;let Ht=De();et.width===Ht.width&&et.height===Ht.height?(y.size=void 0,y.position=void 0,Oe()):(y.size=new si(et.width,et.height),y.position={left:parseFloat(n.domNode.style.left)||0,top:parseFloat(n.domNode.style.top)||0})}}));let De=()=>{let pt=this.layoutService.mainContainerDimension,et=this.layoutService.mainContainerOffset.top,Ti=Math.max(pt.height-et,0),Ht=pt.width*.8,zi=Ti*.8,Vo=Math.min(Ht,l9o,pt.width),sn=Math.min(zi,c9o,Ti);return new si(Vo,sn)},Oe=()=>{if(de)return;let pt=this.layoutService.mainContainerDimension,et=this.layoutService.mainContainerOffset.top,Ti=Math.max(pt.height-et,0),Ht=De(),zi,Vo;if(y.maximized){let _n=Math.max(et,Zco);zi=Math.max(pt.width-Zco,0),Vo=Math.max(Ti-_n,0)}else y.size?(zi=Math.min(y.size.width,pt.width),Vo=Math.min(y.size.height,Ti)):(zi=Ht.width,Vo=Ht.height);Vo=Math.min(Vo,Ti),n.maxSize=new si(pt.width,Ti),n.preferredSize=Ht,n.layout(Vo,zi);let sn=!y.maximized;if(n.enableSashes(sn,sn,sn,sn),!y.maximized&&y.position){let _n=Math.max(0,Math.min(y.position.left,pt.width-zi)),mn=Math.max(et,Math.min(y.position.top,et+Ti-Vo));n.domNode.style.left=`${_n}px`,n.domNode.style.top=`${mn}px`}else{let _n=(pt.width-zi)/2,mn=Math.max(et,(pt.height-Vo)/2);n.domNode.style.left=`${_n}px`,n.domNode.style.top=`${mn}px`}y.layout(Math.max(0,zi-mRe-(S?.getWidth()??0)),Vo-mRe-hRe,0,0),S?.layout(Vo-mRe-hRe)};return e.add(U.runAndSubscribe(this.layoutService.onDidLayoutMainContainer,Oe)),e.add(y.onDidChangeMaximized(()=>Oe())),e.add(y.onDidRequestLayout(()=>Oe())),this.hostService.setWindowDimmed(ut,!0),e.add(Z(()=>this.hostService.setWindowDimmed(ut,!1))),y.activeGroup.focus(),{part:y,instantiationService:k,disposables:e}}createSidebar(i,e,t){if(!e)return;let o=edo,n=M(i,_("div.modal-editor-sidebar.show-file-icons"));n.style.width=`${o}px`;let r=t.add(new E),s=t.add(new me);s.value=e.render(n,r.event);let l=t.add(new Jh(i,{getVerticalSashLeft:()=>o,getVerticalSashTop:()=>hRe,getVerticalSashHeight:()=>i.clientHeight-hRe},{orientation:0})),c=t.add(new E),u;return t.add(l.onDidStart(()=>u=o)),t.add(l.onDidEnd(()=>u=void 0)),t.add(l.onDidChange(p=>{if(u===void 0)return;let h=p.currentX-p.startX,g=Math.max(ZWt,i.clientWidth-qwi);o=Math.min(g,Math.max(ZWt,u+h)),n.style.width=`${o}px`,l.layout(),c.fire()})),t.add(l.onDidReset(()=>{let p=Math.max(ZWt,i.clientWidth-qwi);o=Math.min(p,edo),n.style.width=`${o}px`,l.layout(),c.fire()})),{onDidResize:c.event,getWidth:()=>o,layout:p=>{r.fire({height:p,width:o}),l.layout()},updateContent:p=>{s.clear(),n.textContent="",s.value=p.render(n,r.event)}}}};gRe=I([m(1,F),m(2,ee),m(3,yi),m(4,_e),m(5,Zt),m(6,B)],gRe);var Zpe=class extends Ak{constructor(e,t,o,n,r,s,l,c,u,p,h){let g=Zpe.COUNTER++;super(t,`workbench.parts.modalEditor.${g}`,d(4330,null),e,r,s,l,c,u,p,h);this.modalElement=o;this._onWillClose=this._register(new E);this.onWillClose=this._onWillClose.event;this._onDidChangeMaximized=this._register(new E);this.onDidChangeMaximized=this._onDidChangeMaximized.event;this._onDidRequestLayout=this._register(new E);this.onDidRequestLayout=this._onDidRequestLayout.event;this._onDidChangeNavigation=this._register(new E);this.onDidChangeNavigation=this._onDidChangeNavigation.event;this.optionsDisposable=this._register(new me);this.previousMainWindowActiveElement=null;this._maximized=n?.maximized??!1,this._size=n?.size,this._position=n?.position,this._navigation=n?.navigation,this._maximized&&(this.savedSize=this._size,this.savedPosition=this._position),this.enforceModalPartOptions(),this._register(this.configurationService.onDidChangeConfiguration(f=>{f.affectsConfiguration(KJe)&&this.enforceModalPartOptions()}))}static{this.COUNTER=1}get maximized(){return this._maximized}get size(){return this._size}set size(e){this._size=e}get position(){return this._position}set position(e){this._position=e}get navigation(){return this._navigation}create(e,t){this.previousMainWindowActiveElement=ut.document.activeElement,super.create(e,t)}enforceModalPartOptions(){let e=this.configurationService.getValue(KJe)==="all",t=this.groups.reduce((n,r)=>n+r.count,0),o=e&&t>1?"multiple":"none";this.optionsDisposable.value=this.enforcePartOptions({showTabs:o,enablePreview:!0,closeEmptyGroups:!0,tabActionCloseVisibility:o!=="none",editorActionsLocation:"hidden",tabHeight:"default",wrapTabs:!1,allowDropIntoGroup:!1})}updateOptions(e){typeof e?.maximized=="boolean"&&e.maximized!==this._maximized&&this.toggleMaximized(),this._navigation=e?.navigation,this._onDidChangeNavigation.fire(e?.navigation)}toggleMaximized(){this._maximized=!this._maximized,this._maximized?(this.savedSize=this._size,this.savedPosition=this._position):(this._size=this.savedSize,this._position=this.savedPosition,this.savedSize=void 0,this.savedPosition=void 0),this._onDidChangeMaximized.fire(this._maximized)}handleHeaderDoubleClick(){this._maximized?(this.savedSize=void 0,this.savedPosition=void 0,this.toggleMaximized()):this._size?(this._size=void 0,this._position=void 0,this._onDidRequestLayout.fire()):this.toggleMaximized()}handleContextKeys(){xB.bindTo(this.scopedContextKeyService).set(!0);let t=zDt.bindTo(this.scopedContextKeyService);t.set(this._maximized),this._register(this.onDidChangeMaximized(n=>t.set(n)));let o=Qde.bindTo(this.scopedContextKeyService);o.set(!!this._navigation&&this._navigation.total>1),this._register(this.onDidChangeNavigation(n=>o.set(!!n&&n.total>1))),super.handleContextKeys()}removeGroup(e,t){let o=this.assertGroupView(e);this.count===1&&this.activeGroup===o?this.doRemoveLastGroup():super.removeGroup(e,t)}doRemoveLastGroup(){let e=this.editorPartsView.mainPart.activeGroup;this.editorPartsView.mainPart.activateGroup(e,void 0,1);let t=this.layoutService.getContainer(ut,"workbench.parts.editor");!Do(this.previousMainWindowActiveElement)||!this.previousMainWindowActiveElement.isConnected||t?.contains(this.previousMainWindowActiveElement)?e.focus():this.previousMainWindowActiveElement.focus(),this._onWillClose.fire()}saveState(){}async close(e){if(e?.mergeAllEditorsToMainPart){if(!this.mergeGroupsToMainPart())return!1}else for(let t of this.groups)if(!await t.closeAllEditors())return!1;return this._onWillClose.fire(),!0}mergeGroupsToMainPart(){if(!this.groups.some(o=>o.count>0))return!0;let e;for(let o of this.editorPartsView.mainPart.getGroups(1))if(!o.isLocked){e=o;break}e||(e=this.editorPartsView.mainPart.addGroup(this.editorPartsView.mainPart.activeGroup,this.partOptions.openSideBySideDirection==="right"?3:1));let t=this.mergeAllGroups(e,{preserveExistingIndex:!0});return e.focus(),t}dispose(){this._navigation=void 0,super.dispose()}};Zpe=I([m(4,F),m(5,Le),m(6,B),m(7,ce),m(8,yi),m(9,Zt),m(10,X)],Zpe);var dM=class extends nee{constructor(e,t,o,n,r){super("workbench.editorParts",o,t);this.instantiationService=e;this.storageService=t;this.auxiliaryWindowService=n;this.contextKeyService=r;this.mapPartToInstantiationService=new Map;this._onDidCreateAuxiliaryEditorPart=this._register(new E);this.onDidCreateAuxiliaryEditorPart=this._onDidCreateAuxiliaryEditorPart.event;this.modalEditorMaximized=!1;this.workspaceMemento=this.getMemento(1,0);this.profileMemento=this.getMemento(0,1);this._isReady=!1;this.whenReadyPromise=new Ko;this.whenReady=this.whenReadyPromise.p;this.whenRestoredPromise=new Ko;this.whenRestored=this.whenRestoredPromise.p;this._onDidActiveGroupChange=this._register(new E);this.onDidChangeActiveGroup=this._onDidActiveGroupChange.event;this._onDidAddGroup=this._register(new E);this.onDidAddGroup=this._onDidAddGroup.event;this._onDidRemoveGroup=this._register(new E);this.onDidRemoveGroup=this._onDidRemoveGroup.event;this._onDidMoveGroup=this._register(new E);this.onDidMoveGroup=this._onDidMoveGroup.event;this._onDidActivateGroup=this._register(new E);this.onDidActivateGroup=this._onDidActivateGroup.event;this._onDidChangeGroupIndex=this._register(new E);this.onDidChangeGroupIndex=this._onDidChangeGroupIndex.event;this._onDidChangeGroupLocked=this._register(new E);this.onDidChangeGroupLocked=this._onDidChangeGroupLocked.event;this._onDidChangeGroupMaximized=this._register(new E);this.onDidChangeGroupMaximized=this._onDidChangeGroupMaximized.event;this.globalContextKeys=new Map;this.scopedContextKeys=new Map;this.contextKeyProviders=new Map;this.registeredContextKeys=new Map;this.contextKeyProviderDisposables=this._register(new Vt);this.editorWorkingSets=(()=>{let l=this.storageService.get(dM.EDITOR_WORKING_SETS_STORAGE_KEY,1);return l?JSON.parse(l):[]})();let s=this.profileMemento[dM.MODAL_EDITOR_STATE_STORAGE_KEY];s&&(this.modalEditorMaximized=s.maximized,this.modalEditorSize=s.size,this.modalEditorPosition=s.position),this.mainPart=this._register(this.createMainEditorPart()),this._register(this.registerPart(this.mainPart)),this.mostRecentActiveParts=[this.mainPart],this.restoreParts(),this.registerListeners()}registerListeners(){this._register(this.onDidChangeMementoValue(1,this._store)(e=>this.onDidChangeMementoState(e))),this.whenReady.then(()=>this.registerGroupsContextKeyListeners())}createMainEditorPart(){return this.instantiationService.createInstance(pRe,this)}getScopedInstantiationService(e){if(e===this.mainPart){let t=this.mapPartToInstantiationService.get(e.windowId);return t||(t=this.instantiationService.invokeFunction(o=>{let n=o.get(ee),r=o.get(kr),s=this._register(this.mainPart.scopedInstantiationService.createChild(new _o([ee,n.createScoped(this.mainPart,this._store)],[kr,r.createScoped(r,this._store)])));return this.mapPartToInstantiationService.set(e.windowId,s),s})),t}return e===this.modalEditorPart&&this.modalPartInstantiationService?this.modalPartInstantiationService:this.mapPartToInstantiationService.get(e.windowId)??this.instantiationService}async createAuxiliaryEditorPart(e){let{part:t,instantiationService:o,disposables:n}=await this.instantiationService.createInstance(vH,this).create(this.getGroupsLabel(this._parts.size),e);return this.mapPartToInstantiationService.set(t.windowId,o),n.add(Z(()=>this.mapPartToInstantiationService.delete(t.windowId))),this._onDidAddGroup.fire(t.activeGroup),this._onDidCreateAuxiliaryEditorPart.fire(t),t}get activeModalEditorPart(){return this.modalEditorPart}async createModalEditorPart(e){if(this.modalEditorPart)return this.modalEditorPart.updateOptions(e),this.modalEditorPart;let{part:t,instantiationService:o,disposables:n}=await this.instantiationService.createInstance(gRe,this).create({...e,maximized:e?.maximized??this.modalEditorMaximized,size:e?.size??this.modalEditorSize,position:e?.position??this.modalEditorPosition});return this.modalEditorPart=t,this.modalPartInstantiationService=o,n.add(Z(()=>{this.modalEditorMaximized=t.maximized,this.modalEditorSize=t.size,this.modalEditorPosition=t.position,this.modalPartInstantiationService=void 0,this.modalEditorPart=void 0})),this._onDidAddGroup.fire(t.activeGroup),t}registerPart(e){let t=this._register(new N);return t.add(super.registerPart(e)),this.registerEditorPartListeners(e,t),t}unregisterPart(e){super.unregisterPart(e),this.parts.forEach((t,o)=>{t!==this.mainPart&&t.notifyGroupsLabelChange(this.getGroupsLabel(o))})}registerEditorPartListeners(e,t){t.add(e.onDidFocus(()=>{this.doUpdateMostRecentActive(e,!0),this._parts.size>1&&this._onDidActiveGroupChange.fire(this.activeGroup)})),t.add(Z(()=>{this.doUpdateMostRecentActive(e),e.windowId!==ut.vscodeWindowId&&this._onDidActiveGroupChange.fire(this.activeGroup)})),t.add(e.onDidChangeActiveGroup(o=>this._onDidActiveGroupChange.fire(o))),t.add(e.onDidAddGroup(o=>this._onDidAddGroup.fire(o))),t.add(e.onDidRemoveGroup(o=>this._onDidRemoveGroup.fire(o))),t.add(e.onDidMoveGroup(o=>this._onDidMoveGroup.fire(o))),t.add(e.onDidActivateGroup(o=>this._onDidActivateGroup.fire(o))),t.add(e.onDidChangeGroupMaximized(o=>this._onDidChangeGroupMaximized.fire(o))),t.add(e.onDidChangeGroupIndex(o=>this._onDidChangeGroupIndex.fire(o))),t.add(e.onDidChangeGroupLocked(o=>this._onDidChangeGroupLocked.fire(o)))}doUpdateMostRecentActive(e,t){let o=this.mostRecentActiveParts.indexOf(e);o!==-1&&this.mostRecentActiveParts.splice(o,1),t&&this.mostRecentActiveParts.unshift(e)}getGroupsLabel(e){return d(4252,null,e+1)}getPartByDocument(e){if(this._parts.size>1){let t=Nn();for(let o of this._parts)if(o!==this.mainPart&&o.element?.ownerDocument===e){let n=o.getContainer();if(n&&ts(t,n))return o}}return super.getPartByDocument(e)}getPart(e){if(this._parts.size>1)if(Do(e)){let t=e;return this.getPartByDocument(t.ownerDocument)}else{let t=e,o;typeof t=="number"?o=t:o=t.id;for(let n of this._parts)if(n.hasGroup(o))return n}return this.mainPart}static{this.EDITOR_PARTS_UI_STATE_STORAGE_KEY="editorparts.state"}static{this.MODAL_EDITOR_STATE_STORAGE_KEY="editorparts.modalState"}get isReady(){return this._isReady}async restoreParts(){if(await this.mainPart.whenReady,this.mainPart.willRestoreState){let t=this.loadState();t&&await this.restoreState(t)}this.mostRecentActiveParts.at(0)?.activeGroup.focus(),this._isReady=!0,this.whenReadyPromise.complete(),await Promise.allSettled(this.parts.map(t=>t.whenRestored)),this.whenRestoredPromise.complete()}loadState(){return this.workspaceMemento[dM.EDITOR_PARTS_UI_STATE_STORAGE_KEY]}saveState(){let e=this.createState();e.auxiliary.length===0?delete this.workspaceMemento[dM.EDITOR_PARTS_UI_STATE_STORAGE_KEY]:this.workspaceMemento[dM.EDITOR_PARTS_UI_STATE_STORAGE_KEY]=e,this.saveModalState()}saveModalState(){this.modalEditorPart&&(this.modalEditorMaximized=this.modalEditorPart.maximized,this.modalEditorSize=this.modalEditorPart.size,this.modalEditorPosition=this.modalEditorPart.position),this.modalEditorMaximized||this.modalEditorSize||this.modalEditorPosition?this.profileMemento[dM.MODAL_EDITOR_STATE_STORAGE_KEY]={maximized:this.modalEditorMaximized,size:this.modalEditorSize?{width:this.modalEditorSize.width,height:this.modalEditorSize.height}:void 0,position:this.modalEditorPosition}:delete this.profileMemento[dM.MODAL_EDITOR_STATE_STORAGE_KEY]}createState(){return{auxiliary:this.parts.map(e=>({part:e,auxiliaryWindow:this.auxiliaryWindowService.getWindow(e.windowId)})).filter(({auxiliaryWindow:e})=>e!==void 0).map(({part:e,auxiliaryWindow:t})=>({state:e.createState(),...t.createState()})),mru:this.mostRecentActiveParts.map(e=>this.parts.indexOf(e))}}async restoreState(e){if(e.auxiliary.length){let t=[];for(let o of e.auxiliary)t.push(this.createAuxiliaryEditorPart(o));await Promise.allSettled(t),e.mru.length===this.parts.length?this.mostRecentActiveParts=e.mru.map(o=>this.parts[o]):this.mostRecentActiveParts=[...this.parts],await Promise.allSettled(this.parts.map(o=>o.whenReady))}}get hasRestorableState(){return this.parts.some(e=>e.hasRestorableState)}onDidChangeMementoState(e){if(e.external&&e.scope===1){this.reloadMemento(e.scope);let t=this.loadState();t&&this.applyState(t)}}async applyState(e){for(let t of this.parts){if(t===this.mainPart)continue;for(let n of t.getGroups(1))await n.closeAllEditors({excludeConfirming:!0});if(!t.close())return!1}return e!=="empty"&&await this.restoreState(e),!0}static{this.EDITOR_WORKING_SETS_STORAGE_KEY="editor.workingSets"}saveWorkingSet(e){let t={id:xt(),name:e,main:this.mainPart.createState(),auxiliary:this.createState()};return this.editorWorkingSets.push(t),this.saveWorkingSets(),{id:t.id,name:t.name}}getWorkingSets(){return this.editorWorkingSets.map(e=>({id:e.id,name:e.name}))}deleteWorkingSet(e){let t=this.indexOfWorkingSet(e);typeof t=="number"&&(this.editorWorkingSets.splice(t,1),this.saveWorkingSets())}async applyWorkingSet(e,t){let o;if(e==="empty"?o="empty":o=this.editorWorkingSets[this.indexOfWorkingSet(e)??-1],!o||!await this.applyState(o==="empty"?o:o.auxiliary))return!1;if(await this.mainPart.applyState(o==="empty"?o:o.main,t),!t?.preserveFocus){let r=this.mostRecentActiveParts.at(0);r&&(await r.whenReady,r.activeGroup.focus())}return!0}indexOfWorkingSet(e){for(let t=0;t<this.editorWorkingSets.length;t++)if(this.editorWorkingSets[t].id===e.id)return t}saveWorkingSets(){this.storageService.store(dM.EDITOR_WORKING_SETS_STORAGE_KEY,JSON.stringify(this.editorWorkingSets),1,1)}get activeGroup(){return this.activePart.activeGroup}get sideGroup(){return this.activePart.sideGroup}get groups(){return this.getGroups()}get count(){return this.groups.length}getGroups(e=0){if(this._parts.size>1){let t;switch(e){case 2:case 0:t=this.parts;break;case 1:t=zo([...this.mostRecentActiveParts,...this.parts]);break}return t.flatMap(o=>o.getGroups(e))}return this.mainPart.getGroups(e)}getGroup(e){if(this._parts.size>1)for(let t of this._parts){let o=t.getGroup(e);if(o)return o}return this.mainPart.getGroup(e)}assertGroupView(e){let t;if(typeof e=="number"?t=this.getGroup(e):t=e,!t)throw new Error("Invalid editor group provided!");return t}activateGroup(e){return this.getPart(e).activateGroup(e)}getSize(e){return this.getPart(e).getSize(e)}setSize(e,t){this.getPart(e).setSize(e,t)}arrangeGroups(e,t=this.activePart.activeGroup){this.getPart(t).arrangeGroups(e,t)}toggleMaximizeGroup(e=this.activePart.activeGroup){this.getPart(e).toggleMaximizeGroup(e)}toggleExpandGroup(e=this.activePart.activeGroup){this.getPart(e).toggleExpandGroup(e)}restoreGroup(e){return this.getPart(e).restoreGroup(e)}applyLayout(e){this.activePart.applyLayout(e)}getLayout(){return this.activePart.getLayout()}get orientation(){return this.activePart.orientation}setGroupOrientation(e){this.activePart.setGroupOrientation(e)}findGroup(e,t=this.activeGroup,o){let n=this.getPart(t);if(this._parts.size>1){let r=this.getGroups(2);if(e.location===0||e.location===1)return e.location===0?r[0]:r[r.length-1];let s=n.findGroup(e,t,!1);if(s)return s;if(e.location===2||e.location===3){let l=this.assertGroupView(t),c=r.indexOf(l);if(e.location===2){let u=r[c+1];return!u&&o&&(u=r[0]),u}else{let u=r[c-1];return!u&&o&&(u=r[r.length-1]),u}}}return n.findGroup(e,t,o)}addGroup(e,t){return this.getPart(e).addGroup(e,t)}removeGroup(e){this.getPart(e).removeGroup(e)}moveGroup(e,t,o){return this.getPart(e).moveGroup(e,t,o)}mergeGroup(e,t,o){return this.getPart(e).mergeGroup(e,t,o)}mergeAllGroups(e,t){return this.activePart.mergeAllGroups(e,t)}copyGroup(e,t,o){return this.getPart(e).copyGroup(e,t,o)}createEditorDropTarget(e,t){return this.getPart(e).createEditorDropTarget(e,t)}registerGroupsContextKeyListeners(){this._register(this.onDidChangeActiveGroup(()=>this.updateGlobalContextKeys())),this.groups.forEach(e=>this.registerGroupContextKeyProvidersListeners(e)),this._register(this.onDidAddGroup(e=>this.registerGroupContextKeyProvidersListeners(e))),this._register(this.onDidRemoveGroup(e=>{this.scopedContextKeys.delete(e.id),this.registeredContextKeys.delete(e.id),this.contextKeyProviderDisposables.deleteAndDispose(e.id)}))}updateGlobalContextKeys(){let e=this.scopedContextKeys.get(this.activeGroup.id);if(e)for(let[t,o]of this.globalContextKeys){let n=e.get(t);n?o.set(n.get()):o.reset()}}bind(e,t){let o=this.globalContextKeys.get(e.key);o||(o=e.bindTo(this.contextKeyService),this.globalContextKeys.set(e.key,o));let n=this.scopedContextKeys.get(t.id);n||(n=new Map,this.scopedContextKeys.set(t.id,n));let r=n.get(e.key);r||(r=e.bindTo(t.scopedContextKeyService),n.set(e.key,r));let s=this;return{get(){return r.get()},set(l){s.activeGroup===t&&o.set(l),r.set(l)},reset(){s.activeGroup===t&&o.reset(),r.reset()}}}registerContextKeyProvider(e){if(this.contextKeyProviders.has(e.contextKey.key)||this.globalContextKeys.has(e.contextKey.key))throw new Error(`A context key provider for key ${e.contextKey.key} already exists.`);this.contextKeyProviders.set(e.contextKey.key,e);let t=()=>{for(let n of this.groups)this.updateRegisteredContextKey(n,e)};t();let o=e.onDidChange?.(()=>t());return Z(()=>{o?.dispose(),this.globalContextKeys.delete(e.contextKey.key),this.scopedContextKeys.forEach(n=>n.delete(e.contextKey.key)),this.contextKeyProviders.delete(e.contextKey.key),this.registeredContextKeys.forEach(n=>n.delete(e.contextKey.key))})}registerGroupContextKeyProvidersListeners(e){let t=e.onDidActiveEditorChange(()=>{for(let o of this.contextKeyProviders.values())this.updateRegisteredContextKey(e,o)});this.contextKeyProviderDisposables.set(e.id,t)}updateRegisteredContextKey(e,t){let o=this.registeredContextKeys.get(e.id);o||(o=new Map,this.registeredContextKeys.set(e.id,o));let n=o.get(t.contextKey.key);n||(n=this.bind(t.contextKey,e),o.set(t.contextKey.key,n)),n.set(t.getGroupContextKeyValue(e))}get partOptions(){return this.mainPart.partOptions}get onDidChangeEditorPartOptions(){return this.mainPart.onDidChangeEditorPartOptions}enforcePartOptions(e){return this.mainPart.enforcePartOptions(e)}};dM=I([m(0,F),m(1,ce),m(2,Le),m(3,OD),m(4,X)],dM);Ee(wt,dM,0);var eVt=class extends RT{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super(S,y,c,t,n);this.notificationService=e;this.storageService=t;this.contextMenuService=o;this.keybindingService=r;this.hoverService=s;this.instantiationService=l;this.registry=u;this.activeCompositeSettingsKey=p;this.defaultCompositeId=h;this.nameForTelemetry=g;this.compositeCSSClass=f;this.titleForegroundColor=v;this.titleBorderColor=b;this.onDidCompositeOpen=this._register(new E);this.onDidCompositeClose=this._register(new E);this.mapCompositeToCompositeContainer=new Map;this.mapActionsBindingToComposite=new Map;this.instantiatedCompositeItems=new Map;this.actionsListener=this._register(new me);this.lastActiveCompositeId=t.get(p,1,this.defaultCompositeId),this.toolbarHoverDelegate=this._register(Qh()),this.trailingSeparator=y.trailingSeparator??!1}openComposite(e,t){if(this.activeComposite?.getId()===e)return t&&this.activeComposite.focus(),this.activeComposite;if(this.element)return this.doOpenComposite(e,t)}doOpenComposite(e,t=!1){let o=Uj.nextId();this.currentCompositeOpenToken=o,this.activeComposite&&this.hideActiveComposite(),this.updateTitle(e);let n=this.createComposite(e,!0);if(!(this.currentCompositeOpenToken!==o||this.activeComposite&&this.activeComposite.getId()!==n.getId()))return this.activeComposite?.getId()===n.getId()?(t&&n.focus(),this.onDidCompositeOpen.fire({composite:n,focus:t}),n):(this.showComposite(n),t&&n.focus(),n&&this.onDidCompositeOpen.fire({composite:n,focus:t}),n)}createComposite(e,t){let o=this.instantiatedCompositeItems.get(e);if(o)return o.composite;let n=this.registry.getComposite(e);if(n){let r=this,s=new B_e(Ci(this.progressBar),this._register(new class extends H_e{constructor(){super(n.id,!!t),this._register(r.onDidCompositeOpen.event(p=>this.onScopeOpened(p.composite.getId()))),this._register(r.onDidCompositeClose.event(p=>this.onScopeClosed(p.getId())))}})),l=this._register(this.instantiationService.createChild(new _o([wd,s]))),c=n.instantiate(l),u=new N;return this.instantiatedCompositeItems.set(e,{composite:c,disposable:u,progress:s}),u.add(c.onTitleAreaUpdate(()=>this.onTitleAreaUpdate(c.getId()),this)),u.add(l),c}throw new Error(`Unable to find composite with id ${e}`)}showComposite(e){this.activeComposite=e;let t=this.activeComposite.getId();t!==this.defaultCompositeId?this.storageService.store(this.activeCompositeSettingsKey,t,1,1):this.storageService.remove(this.activeCompositeSettingsKey,1),this.lastActiveCompositeId=this.activeComposite.getId();let o=this.mapCompositeToCompositeContainer.get(e.getId());if(o||(o=_(".composite"),o.classList.add(...this.compositeCSSClass.split(" ")),o.id=e.getId(),e.create(o),e.updateStyles(),this.mapCompositeToCompositeContainer.set(e.getId(),o)),!this.activeComposite||e.getId()!==this.activeComposite.getId())return;this.contentArea?.appendChild(o),un(o),this.toolBar&&(this.toolBar.actionRunner=e.getActionRunner());let n=this.registry.getComposite(e.getId());n&&n.name!==e.getTitle()&&this.updateTitle(e.getId(),e.getTitle());let r=this.mapActionsBindingToComposite.get(e.getId());r||(r=this.collectCompositeActions(e),this.mapActionsBindingToComposite.set(e.getId(),r)),r(),this.toolBar&&(this.actionsListener.value=this.toolBar.actionRunner.onDidRun(s=>{s.error&&!ao(s.error)&&this.notificationService.error(s.error)})),e.setVisible(!0),!(!this.activeComposite||e.getId()!==this.activeComposite.getId())&&(this.contentAreaSize&&e.layout(this.contentAreaSize),this.boundarySashes&&e.setBoundarySashes(this.boundarySashes))}onTitleAreaUpdate(e){let t=this.instantiatedCompositeItems.get(e);if(t&&this.updateTitle(e,t.composite.getTitle()),this.activeComposite?.getId()===e){let o=this.collectCompositeActions(this.activeComposite);this.mapActionsBindingToComposite.set(this.activeComposite.getId(),o),o()}else this.mapActionsBindingToComposite.delete(e)}updateTitle(e,t){let o=this.registry.getComposite(e);if(!o||!this.titleLabel)return;t||(t=o.name);let n=this.keybindingService.lookupKeybinding(e);this.titleLabel.updateTitle(e,t,n?.getLabel()??void 0),this.toolBar?.setAriaLabel(d(3854,null,t))}collectCompositeActions(e){let t=e?.getMenuIds(),o=e?.getActions().slice(0)||[],n=e?.getSecondaryActions().slice(0)||[];return this.toolBar&&(this.toolBar.context=this.actionsContextProvider()),()=>{this.toolBar?.setActions(B_(o),B_(n),t),this.titleArea?.classList.toggle("has-actions",o.length>0||n.length>0)}}getActiveComposite(){return this.activeComposite}getLastActiveCompositeId(){return this.lastActiveCompositeId}hideActiveComposite(){if(!this.activeComposite)return;let e=this.activeComposite;this.activeComposite=void 0;let t=this.mapCompositeToCompositeContainer.get(e.getId());return e.setVisible(!1),t&&(t.remove(),vo(t)),this.progressBar?.stop().hide(),this.toolBar&&this.collectCompositeActions()(),this.onDidCompositeClose.fire(e),e}createTitleArea(e){if(!this.options.hasTitle)return;let t=M(e,_(".composite"));t.classList.add("title"),this.titleLabel=this.createTitleLabel(t);let o=M(t,_(".title-actions"));return this.toolBar=this._register(this.instantiationService.createInstance(ol,o,{actionViewItemProvider:(n,r)=>this.actionViewItemProvider(n,r),orientation:0,getKeyBinding:n=>this.keybindingService.lookupKeybinding(n.id),anchorAlignmentProvider:()=>this.getTitleAreaDropDownAnchorAlignment(),toggleMenuTitle:d(3856,null),telemetrySource:this.nameForTelemetry,hoverDelegate:this.toolbarHoverDelegate,trailingSeparator:this.trailingSeparator})),this.collectCompositeActions()(),t}createTitleLabel(e){let t=M(e,_(".title-label")),o=M(t,_("h2"));this.titleLabelElement=o;let n=this._register(this.hoverService.setupManagedHover(Ri("mouse"),o,"")),r=this;return{updateTitle:(s,l,c)=>{(!this.activeComposite||this.activeComposite.getId()===s)&&(o.textContent=l,n.update(c?d(3855,null,l,c):l))},updateStyles:()=>{o.style.color=r.titleForegroundColor&&r.getColor(r.titleForegroundColor)||"";let s=r.titleBorderColor?r.getColor(r.titleBorderColor):void 0;e.style.borderBottom=s?`1px solid ${s}`:""}}}createHeaderArea(){return _(".composite")}createFooterArea(){return _(".composite")}updateStyles(){super.updateStyles(),this.titleLabel?.updateStyles()}actionViewItemProvider(e,t){return this.activeComposite?this.activeComposite.getActionViewItem(e,t):Bs(this.instantiationService,e,t)}actionsContextProvider(){return this.activeComposite?this.activeComposite.getActionsContext():null}createContentArea(e){let t=M(e,_(".content"));return this.progressBar=this._register(new Zf(t,vw)),this.progressBar.hide(),t}getProgressIndicator(e){let t=this.instantiatedCompositeItems.get(e);return t?t.progress:void 0}getTitleAreaDropDownAnchorAlignment(){return 1}layout(e,t,o,n){super.layout(e,t,o,n),this.contentAreaSize=si.lift(super.layoutContents(e,t).contentSize),this.activeComposite?.layout(this.contentAreaSize)}setBoundarySashes(e){this.boundarySashes=e,this.activeComposite?.setBoundarySashes(e)}removeComposite(e){if(this.activeComposite?.getId()===e)return!1;this.mapCompositeToCompositeContainer.delete(e),this.mapActionsBindingToComposite.delete(e);let t=this.instantiatedCompositeItems.get(e);return t&&(t.composite.dispose(),Be(t.disposable),this.instantiatedCompositeItems.delete(e)),!0}dispose(){this.mapCompositeToCompositeContainer.clear(),this.mapActionsBindingToComposite.clear(),this.instantiatedCompositeItems.forEach(e=>{e.composite.dispose(),Be(e.disposable)}),this.instantiatedCompositeItems.clear(),super.dispose()}};var tVt=class{constructor(i,e,t,o,n,r){this.viewDescriptorService=i;this.targetContainerLocation=e;this.orientation=t;this.openComposite=o;this.moveComposite=n;this.getItems=r}drop(i,e,t,o){let n=i.getData();if(n.type==="composite"){let r=this.viewDescriptorService.getViewContainerById(n.id),s=this.viewDescriptorService.getViewContainerLocation(r),l=!1;s===this.targetContainerLocation?e&&(this.moveComposite(n.id,e,o),l=!0):(this.viewDescriptorService.moveViewContainerToLocation(r,this.targetContainerLocation,this.getTargetIndex(e,o),"dnd"),l=!0),l&&this.openComposite(r.id,!0)}if(n.type==="view"){let r=this.viewDescriptorService.getViewDescriptorById(n.id);if(r.canMoveView){this.viewDescriptorService.moveViewToLocation(r,this.targetContainerLocation,"dnd");let s=this.viewDescriptorService.getViewContainerByViewId(r.id);e&&this.moveComposite(s.id,e,o),this.openComposite(s.id,!0).then(l=>{l?.openView(r.id,!0)})}}}onDragEnter(i,e,t){return this.canDrop(i,e)}onDragOver(i,e,t){return this.canDrop(i,e)}getTargetIndex(i,e){if(!i)return;let t=this.getItems(),o=this.orientation===0?e?.horizontallyBefore:e?.verticallyBefore;return t.filter(n=>n.visible).findIndex(n=>n.id===i)+(o?0:1)}canDrop(i,e){let t=i.getData();if(t.type==="composite"){let o=this.viewDescriptorService.getViewContainerById(t.id);return this.viewDescriptorService.getViewContainerLocation(o)===this.targetContainerLocation?t.id!==e:!0}else return!!this.viewDescriptorService.getViewDescriptorById(t.id)?.canMoveView}},$wi=class{constructor(i,e,t,o,n){this.compositeBarContainer=i;this.actionBarContainer=e;this.compositeBarModel=t;this.dndHandler=o;this.orientation=n;this.insertDropBefore=void 0}onDragOver(i){let e=this.compositeBarModel.visibleItems;if(!e.length||i.eventData.target&&ts(i.eventData.target,this.actionBarContainer)){this.insertDropBefore=this.updateFromDragging(this.compositeBarContainer,!1,!1,!0);return}let t=this.insertAtFront(this.actionBarContainer,i.eventData),o=t?e[0]:e[e.length-1],n=this.dndHandler.onDragOver(i.dragAndDropData,o.id,i.eventData);X4(i.eventData.dataTransfer,"move",n),this.insertDropBefore=this.updateFromDragging(this.compositeBarContainer,n,t,!0)}onDragLeave(i){this.insertDropBefore=this.updateFromDragging(this.compositeBarContainer,!1,!1,!1)}onDragEnd(i){this.insertDropBefore=this.updateFromDragging(this.compositeBarContainer,!1,!1,!1)}onDrop(i){let e=this.compositeBarModel.visibleItems,t;e.length&&(t=this.insertAtFront(this.actionBarContainer,i.eventData)?e[0].id:e[e.length-1].id),this.dndHandler.drop(i.dragAndDropData,t,i.eventData,this.insertDropBefore),this.insertDropBefore=this.updateFromDragging(this.compositeBarContainer,!1,!1,!1)}insertAtFront(i,e){let t=i.getBoundingClientRect(),o=e.clientX,n=e.clientY;switch(this.orientation){case 0:return o<t.left;case 1:return n<t.top}}updateFromDragging(i,e,t,o){if(i.classList.toggle("dragged-over",o),i.classList.toggle("dragged-over-head",e&&t),i.classList.toggle("dragged-over-tail",e&&!t),!!e)return{verticallyBefore:t,horizontallyBefore:t}}},fRe=class extends ja{constructor(e,t,o,n,r){super();this.options=t;this.instantiationService=o;this.contextMenuService=n;this.viewDescriptorService=r;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this.compositeOverflowAction=this._register(new me);this.compositeOverflowActionViewItem=this._register(new me);this.model=new jwi(e,t),this.visibleComposites=[],this.compositeSizeInBar=new Map,this.computeSizes(this.model.visibleItems)}getCompositeBarItems(){return[...this.model.items]}setCompositeBarItems(e){this.model.setItems(e),this.updateCompositeSwitcher(!0)}getPinnedComposites(){return this.model.pinnedItems}getPinnedCompositeIds(){return this.getPinnedComposites().map(e=>e.id)}getVisibleComposites(){return this.model.visibleItems}create(e){let t=e.appendChild(_(".composite-bar"));this.compositeSwitcherBar=this._register(new Zi(t,{actionViewItemProvider:(n,r)=>{if(n instanceof NXe)return this.compositeOverflowActionViewItem.value;let s=this.model.findItem(n.id);return s&&this.instantiationService.createInstance(nLe,{...r,draggable:!0,colors:this.options.colors,icon:this.options.icon,hoverOptions:this.options.activityHoverOptions,compact:this.options.compact},n,s.pinnedAction,s.toggleBadgeAction,l=>this.options.getContextMenuActionsForComposite(l),()=>this.getContextMenuActions(),this.options.dndHandler,this)},orientation:this.options.orientation,ariaLabel:d(3844,null),ariaRole:"tablist",preventLoopNavigation:this.options.preventLoopNavigation,triggerKeys:{keyDown:!0}})),this._register(j(e,re.CONTEXT_MENU,n=>this.showContextMenu(Re(e),n))),this._register(Ms.addTarget(e)),this._register(j(e,Kn.Contextmenu,n=>this.showContextMenu(Re(e),n)));let o=new $wi(e,t,this.model,this.options.dndHandler,this.options.orientation);return this._register(ST.INSTANCE.registerTarget(e,o)),t}focus(e){this.compositeSwitcherBar?.focus(e)}recomputeSizes(){this.computeSizes(this.model.visibleItems),this.updateCompositeSwitcher()}layout(e){this.dimension=e,!(e.height===0||e.width===0)&&(this.compositeSizeInBar.size===0&&this.computeSizes(this.model.visibleItems),this.updateCompositeSwitcher())}addComposite({id:e,name:t,order:o,requestedIndex:n}){this.model.add(e,t,o,n)&&(this.computeSizes([this.model.findItem(e)]),this.updateCompositeSwitcher())}removeComposite(e){this.isPinned(e)&&this.unpin(e),this.model.remove(e)&&this.updateCompositeSwitcher()}hideComposite(e){this.model.hide(e)&&(this.resetActiveComposite(e),this.updateCompositeSwitcher())}activateComposite(e){let t=this.model.activeItem;this.model.activate(e)&&(this.visibleComposites.indexOf(e)===-1||this.model.activeItem&&!this.model.activeItem.pinned||t&&!t.pinned)&&this.updateCompositeSwitcher()}deactivateComposite(e){let t=this.model.activeItem;this.model.deactivate()&&t&&!t.pinned&&this.updateCompositeSwitcher()}async pin(e,t){this.model.setPinned(e,!0)&&(this.updateCompositeSwitcher(),t&&(await this.options.openComposite(e),this.activateComposite(e)))}unpin(e){this.model.setPinned(e,!1)&&(this.updateCompositeSwitcher(),this.resetActiveComposite(e))}areBadgesEnabled(e){return this.viewDescriptorService.getViewContainerBadgeEnablementState(e)}toggleBadgeEnablement(e){this.viewDescriptorService.setViewContainerBadgeEnablementState(e,!this.areBadgesEnabled(e)),this.updateCompositeSwitcher();let t=this.model.findItem(e);t&&(t.activityAction.activities=t.activityAction.activities)}resetActiveComposite(e){let t=this.options.getDefaultCompositeId();if(!(!this.model.activeItem||this.model.activeItem.id!==e))if(this.deactivateComposite(e),t&&t!==e&&this.isPinned(t))this.options.openComposite(t,!0);else{let o=this.visibleComposites.find(n=>n!==e);o&&this.options.openComposite(o)}}isPinned(e){return this.model.findItem(e)?.pinned}move(e,t,o){if(o!==void 0){let n=this.model.items.findIndex(s=>s.id===e),r=this.model.items.findIndex(s=>s.id===t);n>=0&&r>=0&&(!o&&n>r&&r++,o&&n<r&&r--,r<this.model.items.length&&r>=0&&r!==n&&this.model.move(this.model.items[n].id,this.model.items[r].id)&&setTimeout(()=>this.updateCompositeSwitcher(),0))}else this.model.move(e,t)&&setTimeout(()=>this.updateCompositeSwitcher(),0)}getAction(e){return this.model.findItem(e)?.activityAction}computeSizes(e){let t=this.options.compositeSize;if(t)e.forEach(o=>this.compositeSizeInBar.set(o.id,t));else{let o=this.compositeSwitcherBar;if(o&&this.dimension&&this.dimension.height!==0&&this.dimension.width!==0){let n=o.viewItems.length;o.push(e.map(r=>r.activityAction)),e.map((r,s)=>this.compositeSizeInBar.set(r.id,this.options.orientation===1?o.getHeight(n+s):o.getWidth(n+s))),e.forEach(()=>o.pull(o.viewItems.length-1))}}}updateCompositeSwitcher(e){let t=this.compositeSwitcherBar;if(!t||!this.dimension)return;let o=this.model.visibleItems.filter(u=>u.pinned||this.model.activeItem&&this.model.activeItem.id===u.id).map(u=>u.id),n=o.length,r=o.length,s=0,l=this.options.orientation===1?this.dimension.height:this.dimension.width;for(let u=0;u<o.length;u++){let p=this.compositeSizeInBar.get(o[u]);if(s+p>l){n=u;break}s+=p}for(r>n&&(o=o.slice(0,n)),this.model.activeItem&&o.every(u=>!!this.model.activeItem&&u!==this.model.activeItem.id)&&(s+=this.compositeSizeInBar.get(this.model.activeItem.id),o.push(this.model.activeItem.id));s>l&&o.length;){let u=o.length>1?o.splice(o.length-2,1)[0]:o.pop();s-=this.compositeSizeInBar.get(u)}for(r>o.length&&(s+=this.options.overflowActionSize);s>l&&o.length;){let u=o.length>1&&o[o.length-1]===this.model.activeItem?.id?o.splice(o.length-2,1)[0]:o.pop();s-=this.compositeSizeInBar.get(u)}r===o.length&&this.compositeOverflowAction.value&&(t.pull(t.length()-1),this.compositeOverflowAction.value=void 0,this.compositeOverflowActionViewItem.value=void 0);let c=[];this.visibleComposites.forEach((u,p)=>{o.includes(u)||c.push(p)}),c.reverse().forEach(u=>{t.pull(u),this.visibleComposites.splice(u,1)}),o.forEach((u,p)=>{let h=this.visibleComposites.indexOf(u);p!==h&&(h!==-1&&(t.pull(h),this.visibleComposites.splice(h,1)),t.push(this.model.findItem(u).activityAction,{label:!0,icon:this.options.icon,index:p}),this.visibleComposites.splice(p,0,u))}),r>o.length&&!this.compositeOverflowAction.value&&(this.compositeOverflowAction.value=this.instantiationService.createInstance(NXe,()=>{this.compositeOverflowActionViewItem.value?.showMenu()}),this.compositeOverflowActionViewItem.value=this.instantiationService.createInstance(oLe,this.compositeOverflowAction.value,()=>this.getOverflowingComposites(),()=>this.model.activeItem?this.model.activeItem.id:void 0,u=>this.model.findItem(u)?.activity[0]?.badge,this.options.getOnCompositeClickAction,this.options.colors,this.options.activityHoverOptions),t.push(this.compositeOverflowAction.value,{label:!1,icon:!0})),e||this._onDidChange.fire()}getOverflowingComposites(){let e=this.model.visibleItems.filter(t=>t.pinned).map(t=>t.id);return this.model.activeItem&&!this.model.activeItem.pinned&&e.push(this.model.activeItem.id),e=e.filter(t=>!this.visibleComposites.includes(t)),this.model.visibleItems.filter(t=>e.includes(t.id)).map(t=>({id:t.id,name:this.getAction(t.id)?.label||t.name}))}showContextMenu(e,t){Xt.stop(t,!0);let o=new Cn(e,t);this.contextMenuService.showContextMenu({getAnchor:()=>o,getActions:()=>this.getContextMenuActions(t)})}getContextMenuActions(e){let t=this.model.visibleItems.map(({id:o,name:n,activityAction:r})=>{let s=this.isPinned(o);return ii({id:o,label:this.getAction(o).label||n||o,checked:s,enabled:r.enabled&&(!s||this.getPinnedCompositeIds().length>1),run:()=>{this.isPinned(o)?this.unpin(o):this.pin(o,!0)}})});return this.options.fillExtraContextMenuActions(t,e),t}};fRe=I([m(2,F),m(3,Xe),m(4,Bi)],fRe);var jwi=class{constructor(i,e){this._items=[];this.options=e,this.setItems(i)}get items(){return this._items}setItems(i){this._items=[],this._items=i.map(e=>this.createCompositeBarItem(e.id,e.name,e.order,e.pinned,e.visible))}get visibleItems(){return this.items.filter(i=>i.visible)}get pinnedItems(){return this.items.filter(i=>i.visible&&i.pinned)}createCompositeBarItem(i,e,t,o,n){let r=this.options;return{id:i,name:e,pinned:o,order:t,visible:n,activity:[],get activityAction(){return r.getActivityAction(i)},get pinnedAction(){return r.getCompositePinnedAction(i)},get toggleBadgeAction(){return r.getCompositeBadgeAction(i)}}}add(i,e,t,o){let n=this.findItem(i);if(n){let r=!1;return n.name=e,nr(t)||(r=n.order!==t,n.order=t),n.visible||(n.visible=!0,r=!0),r}else{let r=this.createCompositeBarItem(i,e,t,!0,!0);if(nr(o))if(nr(t))this.items.push(r);else{let s=0;for(;s<this.items.length&&typeof this.items[s].order=="number"&&this.items[s].order<t;)s++;this.items.splice(s,0,r)}else{let s=0,l=o;for(;l>0&&s<this.items.length;)this.items[s++].visible&&l--;this.items.splice(s,0,r)}return!0}}remove(i){for(let e=0;e<this.items.length;e++)if(this.items[e].id===i)return this.items.splice(e,1),!0;return!1}hide(i){for(let e of this.items)if(e.id===i)return e.visible?(e.visible=!1,!0):!1;return!1}move(i,e){let t=this.findIndex(i),o=this.findIndex(e);if(t===-1||o===-1)return!1;let n=this.items.splice(t,1)[0];return this.items.splice(o,0,n),n.pinned=!0,!0}setPinned(i,e){for(let t of this.items)if(t.id===i)return t.pinned!==e?(t.pinned=e,!0):!1;return!1}activate(i){if(!this.activeItem||this.activeItem.id!==i){this.activeItem&&this.deactivate();for(let e of this.items)if(e.id===i)return this.activeItem=e,this.activeItem.activityAction.activate(),!0}return!1}deactivate(){return this.activeItem?(this.activeItem.activityAction.deactivate(),this.activeItem=void 0,!0):!1}findItem(i){return this.items.filter(e=>e.id===i)[0]}findIndex(i){for(let e=0;e<this.items.length;e++)if(this.items[e].id===i)return e;return-1}};var cee=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this.location=e;this.options=t;this.part=o;this.paneCompositePart=n;this.instantiationService=r;this.storageService=s;this.extensionService=l;this.viewDescriptorService=c;this.viewService=u;this.contextKeyService=p;this.environmentService=h;this.layoutService=g;this.viewContainerDisposables=this._register(new Vt);this.compositeActions=new Map;this.hasExtensionsRegistered=!1;this._cachedViewContainers=void 0;this.dndHandler=new tVt(this.viewDescriptorService,this.location,this.options.orientation,async(v,b)=>await this.paneCompositePart.openPaneComposite(v,b)??null,(v,b,S)=>this.compositeBar.move(v,b,this.options.orientation===1?S?.verticallyBefore:S?.horizontallyBefore),()=>this.compositeBar.getCompositeBarItems());let f=this.cachedViewContainers.map(v=>({id:v.id,name:v.name,visible:!this.shouldBeHidden(v.id,v),order:v.order,pinned:v.pinned}));this.compositeBar=this.createCompositeBar(f),this.onDidRegisterViewContainers(this.getViewContainers()),this.registerListeners()}createCompositeBar(e){return this._register(this.instantiationService.createInstance(fRe,e,{icon:this.options.icon,compact:this.options.compact,orientation:this.options.orientation,activityHoverOptions:this.options.activityHoverOptions,preventLoopNavigation:this.options.preventLoopNavigation,openComposite:async(t,o)=>await this.paneCompositePart.openPaneComposite(t,!o)??null,getActivityAction:t=>this.getCompositeActions(t).activityAction,getCompositePinnedAction:t=>this.getCompositeActions(t).pinnedAction,getCompositeBadgeAction:t=>this.getCompositeActions(t).badgeAction,getOnCompositeClickAction:t=>this.getCompositeActions(t).activityAction,fillExtraContextMenuActions:(t,o)=>this.options.fillExtraContextMenuActions(t,o),getContextMenuActionsForComposite:t=>this.getContextMenuActionsForComposite(t),getDefaultCompositeId:()=>this.viewDescriptorService.getDefaultViewContainer(this.location)?.id,dndHandler:this.dndHandler,compositeSize:this.options.compositeSize,overflowActionSize:this.options.overflowActionSize,colors:t=>this.options.colors(t)}))}getContextMenuActionsForComposite(e){let t=[new ri],o=this.viewDescriptorService.getViewContainerById(e),n=this.viewDescriptorService.getDefaultViewContainerLocation(o),r=this.viewDescriptorService.getViewContainerLocation(o),s=[];for(let l of[0,2,1])r!==l&&s.push(this.createMoveAction(o,l,n));if(t.push(new Fs("moveToMenu",d(4426,null),s)),n!==r)t.push(ii({id:"resetLocationAction",label:d(4428,null),run:()=>{this.viewDescriptorService.moveViewContainerToLocation(o,n,void 0,"resetLocationAction"),this.viewService.openViewContainer(o.id,!0)}}));else{let l=this.viewDescriptorService.getViewContainerModel(o);if(l.allViewDescriptors.length===1){let c=l.allViewDescriptors[0],u=this.viewDescriptorService.getDefaultContainerById(c.id);u!==o&&t.push(ii({id:"resetLocationAction",label:d(4428,null),run:()=>{this.viewDescriptorService.moveViewsToContainer([c],u,void 0,"resetLocationAction"),this.viewService.openViewContainer(o.id,!0)}}))}}return t}createMoveAction(e,t,o){return ii({id:`moveViewContainerTo${t}`,label:t===1?d(4427,null):t===0?d(4429,null):d(4425,null),run:()=>{let n;t!==o?n=this.viewDescriptorService.getViewContainersByLocation(t).length:n=void 0,this.viewDescriptorService.moveViewContainerToLocation(e,t,n),this.viewService.openViewContainer(e.id,!0)}})}registerListeners(){this._register(this.viewDescriptorService.onDidChangeViewContainers(({added:e,removed:t})=>this.onDidChangeViewContainers(e,t))),this._register(this.viewDescriptorService.onDidChangeContainerLocation(({viewContainer:e,from:t,to:o})=>this.onDidChangeViewContainerLocation(e,t,o))),this._register(this.paneCompositePart.onDidPaneCompositeOpen(e=>this.onDidChangeViewContainerVisibility(e.getId(),!0))),this._register(this.paneCompositePart.onDidPaneCompositeClose(e=>this.onDidChangeViewContainerVisibility(e.getId(),!1))),this.extensionService.whenInstalledExtensionsRegistered().then(()=>{this._store.isDisposed||(this.onDidRegisterExtensions(),this._register(this.compositeBar.onDidChange(()=>{this.updateCompositeBarItemsFromStorage(!0),this.saveCachedViewContainers()})),this._register(this.storageService.onDidChangeValue(0,this.options.pinnedViewContainersKey,this._store)(()=>this.updateCompositeBarItemsFromStorage(!1))))})}onDidChangeViewContainers(e,t){t.filter(({location:o})=>o===this.location).forEach(({container:o})=>this.onDidDeregisterViewContainer(o)),this.onDidRegisterViewContainers(e.filter(({location:o})=>o===this.location).map(({container:o})=>o))}onDidChangeViewContainerLocation(e,t,o){t===this.location&&this.onDidDeregisterViewContainer(e),o===this.location&&this.onDidRegisterViewContainers([e])}onDidChangeViewContainerVisibility(e,t){t?this.onDidViewContainerVisible(e):this.compositeBar.deactivateComposite(e)}onDidRegisterExtensions(){this.hasExtensionsRegistered=!0;for(let{id:e}of this.cachedViewContainers){let t=this.getViewContainer(e);t?this.showOrHideViewContainer(t):this.viewDescriptorService.isViewContainerRemovedPermanently(e)?this.removeComposite(e):this.hideComposite(e)}this.saveCachedViewContainers()}onDidViewContainerVisible(e){let t=this.getViewContainer(e);t&&(this.addComposite(t),this.compositeBar.activateComposite(t.id),this.shouldBeHidden(t)&&this.viewDescriptorService.getViewContainerModel(t).activeViewDescriptors.length===0&&this.hideComposite(t.id))}create(e){return this.compositeBar.create(e)}getCompositeActions(e){let t=this.compositeActions.get(e);if(!t){let o=this.getViewContainer(e);if(o){let n=this.viewDescriptorService.getViewContainerModel(o);t={activityAction:this._register(this.instantiationService.createInstance(dee,this.toCompositeBarActionItemFrom(n),this.part,this.paneCompositePart)),pinnedAction:this._register(new OXe(this.toCompositeBarActionItemFrom(n),this.compositeBar)),badgeAction:this._register(new FXe(this.toCompositeBarActionItemFrom(n),this.compositeBar))}}else{let n=this.cachedViewContainers.filter(r=>r.id===e)[0];t={activityAction:this._register(this.instantiationService.createInstance(Qwi,this.toCompositeBarActionItem(e,n?.name??e,n?.icon,void 0),this.part,this.paneCompositePart)),pinnedAction:this._register(new iVt(e,this.compositeBar)),badgeAction:this._register(new Ywi(e,this.compositeBar))}}this.compositeActions.set(e,t)}return t}onDidRegisterViewContainers(e){for(let t of e){this.addComposite(t),this.cachedViewContainers.filter(({id:l})=>l===t.id)[0]||this.compositeBar.pin(t.id),this.paneCompositePart.getActivePaneComposite()?.getId()===t.id&&this.compositeBar.activateComposite(t.id);let r=this.viewDescriptorService.getViewContainerModel(t);this.updateCompositeBarActionItem(t,r),this.showOrHideViewContainer(t);let s=new N;s.add(r.onDidChangeContainerInfo(()=>this.updateCompositeBarActionItem(t,r))),s.add(r.onDidChangeActiveViewDescriptors(()=>this.showOrHideViewContainer(t))),this.viewContainerDisposables.set(t.id,s)}}onDidDeregisterViewContainer(e){this.viewContainerDisposables.deleteAndDispose(e.id),this.removeComposite(e.id)}updateCompositeBarActionItem(e,t){let o=this.toCompositeBarActionItemFrom(t),{activityAction:n,pinnedAction:r}=this.getCompositeActions(e.id);n.updateCompositeBarActionItem(o),r instanceof iVt&&r.setActivity(o),this.options.recomputeSizes&&this.compositeBar.recomputeSizes(),this.saveCachedViewContainers()}toCompositeBarActionItemFrom(e){return this.toCompositeBarActionItem(e.viewContainer.id,e.title,e.icon,e.keybindingId)}toCompositeBarActionItem(e,t,o,n){let r,s;if(this.options.icon)if(A.isUri(o)){s=o;let l=Qa(o),c=new Yy;c.update(l);let u=`activity-${e.replace(/\./g,"-")}-${c.digest()}`,p=`.monaco-workbench .${this.options.partContainerClass} .monaco-action-bar .action-label.${u}`;r=[u,"uri-icon"],$h(p,`
				mask: ${l} no-repeat 50% 50%;
				mask-size: var(--activity-bar-icon-size, ${this.options.iconSize}px);
				-webkit-mask: ${l} no-repeat 50% 50%;
				-webkit-mask-size: var(--activity-bar-icon-size, ${this.options.iconSize}px);
				mask-origin: padding;
				-webkit-mask-origin: padding;
			`)}else q.isThemeIcon(o)&&(r=q.asClassNameArray(o));return{id:e,name:t,classNames:r,iconUrl:s,keybindingId:n}}showOrHideViewContainer(e){this.shouldBeHidden(e)?this.hideComposite(e.id):(this.addComposite(e),this.paneCompositePart.getActivePaneComposite()?.getId()===e.id&&this.compositeBar.activateComposite(e.id))}shouldBeHidden(e,t){let o=Fe(e)?this.getViewContainer(e):e,n=Fe(e)?e:e.id;if(o)if(o.hideIfEmpty){if(this.viewService.isViewContainerActive(n))return!1}else return!1;if(!this.hasExtensionsRegistered&&!(this.part==="workbench.parts.sidebar"&&this.environmentService.remoteAuthority&&Vr)){if(t=t||this.cachedViewContainers.find(({id:r})=>r===n),!o&&t?.isBuiltin&&t?.visible)return!1;if(t?.views?.length)return t.views.every(({when:r})=>!!r&&!this.contextKeyService.contextMatchesRules(C.deserialize(r)))}return!0}addComposite(e){this.compositeBar.addComposite({id:e.id,name:typeof e.title=="string"?e.title:e.title.value,order:e.order,requestedIndex:e.requestedIndex})}hideComposite(e){this.compositeBar.hideComposite(e);let t=this.compositeActions.get(e);t&&(t.activityAction.dispose(),t.pinnedAction.dispose(),this.compositeActions.delete(e))}removeComposite(e){this.compositeBar.removeComposite(e);let t=this.compositeActions.get(e);t&&(t.activityAction.dispose(),t.pinnedAction.dispose(),this.compositeActions.delete(e))}getPinnedPaneCompositeIds(){let e=this.compositeBar.getPinnedComposites().map(t=>t.id);return this.getViewContainers().filter(t=>this.compositeBar.isPinned(t.id)).sort((t,o)=>e.indexOf(t.id)-e.indexOf(o.id)).map(t=>t.id)}getVisiblePaneCompositeIds(){return this.compositeBar.getVisibleComposites().filter(e=>this.paneCompositePart.getActivePaneComposite()?.getId()===e.id||this.compositeBar.isPinned(e.id)).map(e=>e.id)}getPaneCompositeIds(){return this.compositeBar.getVisibleComposites().map(e=>e.id)}getContextMenuActions(){return this.compositeBar.getContextMenuActions()}focus(e){this.compositeBar.focus(e)}layout(e,t){this.compositeBar.layout(new si(e,t))}getViewContainer(e){let t=this.viewDescriptorService.getViewContainerById(e);return t&&this.viewDescriptorService.getViewContainerLocation(t)===this.location?t:void 0}getViewContainers(){return this.viewDescriptorService.getViewContainersByLocation(this.location)}updateCompositeBarItemsFromStorage(e){if(this.pinnedViewContainersValue===this.getStoredPinnedViewContainersValue())return;this._placeholderViewContainersValue=void 0,this._pinnedViewContainersValue=void 0,this._cachedViewContainers=void 0;let t=[],o=this.compositeBar.getCompositeBarItems();for(let n of this.cachedViewContainers)t.push({id:n.id,name:n.name,order:n.order,pinned:n.pinned,visible:n.visible&&!!this.getViewContainer(n.id)});for(let n of this.getViewContainers())if(!t.some(({id:r})=>r===n.id)){let r=o.findIndex(({id:s})=>s===n.id);if(r!==-1){let s=o[r];t.splice(r,0,{id:n.id,name:typeof n.title=="string"?n.title:n.title.value,order:s.order,pinned:s.pinned,visible:s.visible})}else t.push({id:n.id,name:typeof n.title=="string"?n.title:n.title.value,order:n.order,pinned:!0,visible:!this.shouldBeHidden(n)})}if(e)for(let n of o)t.find(({id:s})=>s===n.id)||t.push(n);this.compositeBar.setCompositeBarItems(t)}saveCachedViewContainers(){let e=[],t=this.compositeBar.getCompositeBarItems();for(let o of t){let n=this.getViewContainer(o.id);if(n){let r=this.viewDescriptorService.getViewContainerModel(n),s=[];for(let{when:l}of r.allViewDescriptors)s.push({when:l?l.serialize():void 0});e.push({id:o.id,name:r.title,icon:A.isUri(r.icon)&&this.environmentService.remoteAuthority?void 0:r.icon,views:s,pinned:o.pinned,order:o.order,visible:o.visible,isBuiltin:!n.extensionId})}else e.push({id:o.id,name:o.name,pinned:o.pinned,order:o.order,visible:!1,isBuiltin:!1})}this.storeCachedViewContainersState(e)}get cachedViewContainers(){if(this._cachedViewContainers===void 0){this._cachedViewContainers=this.getPinnedViewContainers();for(let e of this.getPlaceholderViewContainers()){let t=this._cachedViewContainers.find(o=>o.id===e.id);t&&(t.visible=e.visible??t.visible,t.name=e.name,t.icon=e.themeIcon?e.themeIcon:e.iconUrl?A.revive(e.iconUrl):void 0,A.isUri(t.icon)&&this.environmentService.remoteAuthority&&(t.icon=void 0),t.views=e.views,t.isBuiltin=e.isBuiltin)}for(let e of this.getViewContainersWorkspaceState()){let t=this._cachedViewContainers.find(o=>o.id===e.id);t&&(t.visible=e.visible??t.visible)}}return this._cachedViewContainers}storeCachedViewContainersState(e){let t=this.getPinnedViewContainers();this.setPinnedViewContainers(e.map(({id:o,pinned:n,order:r})=>({id:o,pinned:n,visible:!!t.find(({id:s})=>s===o)?.visible,order:r}))),this.setPlaceholderViewContainers(e.map(({id:o,icon:n,name:r,views:s,isBuiltin:l})=>({id:o,iconUrl:A.isUri(n)?n:void 0,themeIcon:q.isThemeIcon(n)?n:void 0,name:r,isBuiltin:l,views:s}))),this.setViewContainersWorkspaceState(e.map(({id:o,visible:n})=>({id:o,visible:n})))}getPinnedViewContainers(){return JSON.parse(this.pinnedViewContainersValue)}setPinnedViewContainers(e){this.pinnedViewContainersValue=JSON.stringify(e)}get pinnedViewContainersValue(){return this._pinnedViewContainersValue||(this._pinnedViewContainersValue=this.getStoredPinnedViewContainersValue()),this._pinnedViewContainersValue}set pinnedViewContainersValue(e){this.pinnedViewContainersValue!==e&&(this._pinnedViewContainersValue=e,this.setStoredPinnedViewContainersValue(e))}getStoredPinnedViewContainersValue(){return this.storageService.get(this.options.pinnedViewContainersKey,0,"[]")}setStoredPinnedViewContainersValue(e){this.storageService.store(this.options.pinnedViewContainersKey,e,0,0)}getPlaceholderViewContainers(){return JSON.parse(this.placeholderViewContainersValue)}setPlaceholderViewContainers(e){this.placeholderViewContainersValue=JSON.stringify(e)}get placeholderViewContainersValue(){return this._placeholderViewContainersValue||(this._placeholderViewContainersValue=this.getStoredPlaceholderViewContainersValue()),this._placeholderViewContainersValue}set placeholderViewContainersValue(e){this.placeholderViewContainersValue!==e&&(this._placeholderViewContainersValue=e,this.setStoredPlaceholderViewContainersValue(e))}getStoredPlaceholderViewContainersValue(){return this.storageService.get(this.options.placeholderViewContainersKey,0,"[]")}setStoredPlaceholderViewContainersValue(e){this.storageService.store(this.options.placeholderViewContainersKey,e,0,1)}getViewContainersWorkspaceState(){return JSON.parse(this.viewContainersWorkspaceStateValue)}setViewContainersWorkspaceState(e){this.viewContainersWorkspaceStateValue=JSON.stringify(e)}get viewContainersWorkspaceStateValue(){return this._viewContainersWorkspaceStateValue||(this._viewContainersWorkspaceStateValue=this.getStoredViewContainersWorkspaceStateValue()),this._viewContainersWorkspaceStateValue}set viewContainersWorkspaceStateValue(e){this.viewContainersWorkspaceStateValue!==e&&(this._viewContainersWorkspaceStateValue=e,this.setStoredViewContainersWorkspaceStateValue(e))}getStoredViewContainersWorkspaceStateValue(){return this.storageService.get(this.options.viewContainersWorkspaceStateKey,1,"[]")}setStoredViewContainersWorkspaceStateValue(e){this.storageService.store(this.options.viewContainersWorkspaceStateKey,e,1,1)}};cee=I([m(4,F),m(5,ce),m(6,lt),m(7,Bi),m(8,$t),m(9,X),m(10,At),m(11,yi)],cee);var dee=class extends _2{constructor(e,t,o,n,r,s){super(e);this.part=t;this.paneCompositePart=o;this.layoutService=n;this.configurationService=r;this.activityService=s;this.lastRun=0;this.updateActivity(),this._register(this.activityService.onDidChangeActivity(l=>{!Fe(l)&&l.id===this.compositeBarActionItem.id&&this.updateActivity()}))}static{this.preventDoubleClickDelay=300}updateCompositeBarActionItem(e){this.compositeBarActionItem=e}updateActivity(){this.activities=this.activityService.getViewContainerActivities(this.compositeBarActionItem.id)}async run(e){if(Ru(e)&&e.button===2)return;let t=Date.now();if(t>this.lastRun&&t-this.lastRun<dee.preventDoubleClickDelay)return;this.lastRun=t;let o=e&&"preserveFocus"in e?!e.preserveFocus:!0;if(this.part==="workbench.parts.activitybar"){let n=this.layoutService.isVisible("workbench.parts.sidebar"),r=this.paneCompositePart.getActivePaneComposite(),s=this.configurationService.getValue("workbench.activityBar.iconClickBehavior");if(n&&r?.getId()===this.compositeBarActionItem.id){s==="focus"?this.paneCompositePart.openPaneComposite(this.compositeBarActionItem.id,o):this.layoutService.setPartHidden(!0,"workbench.parts.sidebar");return}}return await this.paneCompositePart.openPaneComposite(this.compositeBarActionItem.id,o),this.activate()}};dee=I([m(3,yi),m(4,B),m(5,Sl)],dee);var Qwi=class extends dee{},iVt=class extends OXe{constructor(i,e){super({id:i,name:i,classNames:void 0},e)}setActivity(i){this.label=i.name}},Ywi=class extends FXe{constructor(i,e){super({id:i,name:i,classNames:void 0},e)}setCompositeBarActionItem(i){this.label=i.name}};var _0=class extends eVt{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,P,O,V,H,G){super(v,b,S,y,w,k,T,P,ne.as(h),o,O.getDefaultViewContainer(p)?.id||"",s,l,c,u,e,t);this.partId=e;this.activePaneContextKey=n;this.paneFocusContextKey=r;this.location=p;this.registryId=h;this.globalActionsMenuId=g;this.globalLeftActionsMenuId=f;this.viewDescriptorService=O;this.contextKeyService=V;this.extensionService=H;this.menuService=G;this.onDidPaneCompositeClose=this.onDidCompositeClose.event;this.headerFooterCompositeBarDispoables=this._register(new N);this.paneCompositeBar=this._register(new me);this.compositeBarPosition=void 0;this.blockOpening=void 0;this.registerListeners()}static{this.MIN_COMPOSITE_BAR_WIDTH=50}get snap(){return this.layoutService.isVisible(this.partId)||!!this.paneCompositeBar.value?.getVisiblePaneCompositeIds().length}get onDidPaneCompositeOpen(){return U.map(this.onDidCompositeOpen.event,e=>e.composite)}registerListeners(){this._register(this.onDidPaneCompositeOpen(e=>this.onDidOpen(e))),this._register(this.onDidPaneCompositeClose(this.onDidClose,this)),this._register(this.registry.onDidDeregister(e=>{let t=this.viewDescriptorService.getViewContainersByLocation(this.location).filter(o=>this.viewDescriptorService.getViewContainerModel(o).activeViewDescriptors.length>0);if(t.length){if(this.getActiveComposite()?.getId()===e.id){let o=this.viewDescriptorService.getDefaultViewContainer(this.location)?.id,n=t.filter(r=>r.id===o)[0]||t[0];this.doOpenPaneComposite(n.id)}}else this.layoutService.setPartHidden(!0,this.partId);this.removeComposite(e.id)})),this._register(this.extensionService.onDidRegisterExtensions(()=>{this.layoutCompositeBar()}))}onDidOpen(e){this.activePaneContextKey.set(e.getId())}onDidClose(e){let t=e.getId();this.activePaneContextKey.get()===t&&this.activePaneContextKey.reset()}showComposite(e){super.showComposite(e),this.layoutCompositeBar(),this.layoutEmptyMessage()}hideActiveComposite(){let e=super.hideActiveComposite();return this.layoutCompositeBar(),this.layoutEmptyMessage(),e}create(e){this.element=e,this.element.classList.add("pane-composite-part"),super.create(e),this.contentArea&&this.createEmptyPaneMessage(this.contentArea),this.updateCompositeBar();let t=this._register(qn(e));this._register(t.onDidFocus(()=>this.paneFocusContextKey.set(!0))),this._register(t.onDidBlur(()=>this.paneFocusContextKey.set(!1)))}createEmptyPaneMessage(e){this.emptyPaneMessageElement=_(".empty-pane-message-area");let t=_(".empty-pane-message");t.textContent=d(4431,null),this.emptyPaneMessageElement.appendChild(t),e.appendChild(this.emptyPaneMessageElement);let o=n=>{let r=!this.getActiveComposite()||!n,s=n&&this.theme.getColor(oT)?.toString()||"";this.titleContainer&&r&&(this.titleContainer.style.backgroundColor=s),this.headerFooterCompositeBarContainer&&r&&(this.headerFooterCompositeBarContainer.style.backgroundColor=s),this.emptyPaneMessageElement.style.backgroundColor=s};this.viewDescriptorService.canMoveViews()&&this._register(ST.INSTANCE.registerTarget(this.element,{onDragOver:n=>{if(Xt.stop(n.eventData,!0),this.paneCompositeBar.value){let r=this.paneCompositeBar.value.dndHandler.onDragEnter(n.dragAndDropData,void 0,n.eventData);X4(n.eventData.dataTransfer,"move",r)}},onDragEnter:n=>{if(Xt.stop(n.eventData,!0),this.paneCompositeBar.value){let r=this.paneCompositeBar.value.dndHandler.onDragEnter(n.dragAndDropData,void 0,n.eventData);o(r)}},onDragLeave:n=>{Xt.stop(n.eventData,!0),o(!1)},onDragEnd:n=>{Xt.stop(n.eventData,!0),o(!1)},onDrop:n=>{if(Xt.stop(n.eventData,!0),o(!1),this.paneCompositeBar.value)this.paneCompositeBar.value.dndHandler.drop(n.dragAndDropData,void 0,n.eventData);else{let r=n.dragAndDropData.getData();if(r.type==="composite"){let s=this.viewDescriptorService.getViewContainerById(r.id);this.viewDescriptorService.moveViewContainerToLocation(s,this.location,void 0,"dnd"),this.openPaneComposite(s.id,!0)}else if(r.type==="view"){let s=this.viewDescriptorService.getViewDescriptorById(r.id);if(s.canMoveView){this.viewDescriptorService.moveViewToLocation(s,this.location,"dnd");let l=this.viewDescriptorService.getViewContainerByViewId(s.id);this.openPaneComposite(l.id,!0).then(c=>{c?.openView(s.id,!0)})}}}}}))}createTitleArea(e){let t=super.createTitleArea(e);if(!t)return;if(this._register(j(t,re.CONTEXT_MENU,n=>{this.onTitleAreaContextMenu(new Cn(Re(t),n))})),this._register(Ms.addTarget(t)),this._register(j(t,Kn.Contextmenu,n=>{this.onTitleAreaContextMenu(new Cn(Re(t),n))})),this.globalLeftActionsMenuId){let n=t.appendChild(_(".global-actions-left"));this.globalLeftToolBar=this._register(this.instantiationService.createInstance(or,n,this.globalLeftActionsMenuId,{actionViewItemProvider:(r,s)=>this.actionViewItemProvider(r,s),orientation:0,getKeyBinding:r=>this.keybindingService.lookupKeybinding(r.id),anchorAlignmentProvider:()=>this.getTitleAreaDropDownAnchorAlignment(),hoverDelegate:this.toolbarHoverDelegate,hiddenItemStrategy:-1,highlightToggledItems:!1,telemetrySource:this.nameForTelemetry}))}let o=t.appendChild(_(".global-actions"));return this.globalToolBar=this._register(this.instantiationService.createInstance(or,o,this.globalActionsMenuId,{actionViewItemProvider:(n,r)=>this.actionViewItemProvider(n,r),orientation:0,getKeyBinding:n=>this.keybindingService.lookupKeybinding(n.id),anchorAlignmentProvider:()=>this.getTitleAreaDropDownAnchorAlignment(),toggleMenuTitle:d(4430,null),hoverDelegate:this.toolbarHoverDelegate,hiddenItemStrategy:-1,highlightToggledItems:!0,telemetrySource:this.nameForTelemetry})),t}createTitleLabel(e){this.titleContainer=e;let t=super.createTitleLabel(e);this.titleLabelElement.draggable=this.viewDescriptorService.canMoveViews();let o=()=>({type:"composite",id:this.getActivePaneComposite().getId()});return this._register(ST.INSTANCE.registerDraggable(this.titleLabelElement,o,{})),t}updateCompositeBar(e=!1){let t=this.compositeBarPosition!==void 0,o=this.shouldShowCompositeBar(),n=this.compositeBarPosition,r=o?this.getCompositeBarPosition():void 0;if(!e&&n===r)return;if(t){let l=n===1?this.titleContainer:this.headerFooterCompositeBarContainer;if(!this.paneCompositeBarContainer||!this.paneCompositeBar.value||!l)throw new Error("Composite bar containers should exist when removing the previous composite bar");this.paneCompositeBarContainer.remove(),this.paneCompositeBarContainer=void 0,this.paneCompositeBar.value=void 0,l.classList.remove("has-composite-bar"),n===0?this.removeFooterHeaderArea(!0):n===2&&this.removeFooterHeaderArea(!1)}let s;switch(r){case 0:s=this.createHeaderArea();break;case 1:s=this.titleContainer;break;case 2:s=this.createFooterArea();break}if(o){if(this.paneCompositeBarContainer||this.paneCompositeBar.value||!s)throw new Error("Invalid composite bar state when creating the new composite bar");s.classList.add("has-composite-bar"),this.paneCompositeBarContainer=KS(s,_(".composite-bar-container")),this.paneCompositeBar.value=this.createCompositeBar(),this.paneCompositeBar.value.create(this.paneCompositeBarContainer),r===0?this.setHeaderArea(s):r===2&&this.setFooterArea(s)}this.compositeBarPosition=r,e&&this.layoutCompositeBar()}createHeaderArea(){let e=super.createHeaderArea();return this.createHeaderFooterCompositeBarArea(e)}createFooterArea(){let e=super.createFooterArea();return this.createHeaderFooterCompositeBarArea(e)}createHeaderFooterCompositeBarArea(e){if(this.headerFooterCompositeBarContainer)throw new Error("Header or Footer composite bar already exists");return this.headerFooterCompositeBarContainer=e,this.headerFooterCompositeBarDispoables.add(j(e,re.CONTEXT_MENU,t=>{this.onCompositeBarAreaContextMenu(new Cn(Re(e),t))})),this.headerFooterCompositeBarDispoables.add(Ms.addTarget(e)),this.headerFooterCompositeBarDispoables.add(j(e,Kn.Contextmenu,t=>{this.onCompositeBarAreaContextMenu(new Cn(Re(e),t))})),e}removeFooterHeaderArea(e){this.headerFooterCompositeBarContainer=void 0,this.headerFooterCompositeBarDispoables.clear(),e?this.removeHeaderArea():this.removeFooterArea()}createCompositeBar(){return this.instantiationService.createInstance(cee,this.location,this.getCompositeBarOptions(),this.partId,this)}onTitleAreaUpdate(e){super.onTitleAreaUpdate(e),this.layoutCompositeBar()}async openPaneComposite(e,t){if(typeof e=="string"&&this.getPaneComposite(e))return this.doOpenPaneComposite(e,t);if(await this.extensionService.whenInstalledExtensionsRegistered(),typeof e=="string"&&this.getPaneComposite(e))return this.doOpenPaneComposite(e,t)}async doOpenPaneComposite(e,t){if(this.blockOpening)return this.blockOpening.p;let o;if(!this.layoutService.isVisible(this.partId))try{o=this.blockOpening=new Ko,this.layoutService.setPartHidden(!1,this.partId)}finally{this.blockOpening=void 0}try{let n=this.openComposite(e,t);return o?.complete(n),n}catch(n){throw o?.error(n),n}}getPaneComposite(e){return this.registry.getPaneComposite(e)}getPaneComposites(){return this.registry.getPaneComposites().sort((e,t)=>typeof e.order!="number"?1:typeof t.order!="number"?-1:e.order-t.order)}getPinnedPaneCompositeIds(){return this.paneCompositeBar.value?.getPinnedPaneCompositeIds()??[]}getVisiblePaneCompositeIds(){return this.paneCompositeBar.value?.getVisiblePaneCompositeIds()??[]}getPaneCompositeIds(){return this.paneCompositeBar.value?.getPaneCompositeIds()??[]}getActivePaneComposite(){return this.getActiveComposite()}getLastActivePaneCompositeId(){return this.getLastActiveCompositeId()}hideActivePaneComposite(){this.layoutService.isVisible(this.partId)&&this.layoutService.setPartHidden(!0,this.partId),this.hideActiveComposite()}focusCompositeBar(){this.paneCompositeBar.value?.focus()}layout(e,t,o,n){this.layoutService.isVisible(this.partId)&&(this.contentDimension=new si(e,t),super.layout(this.contentDimension.width,this.contentDimension.height,o,n),this.layoutCompositeBar(),this.layoutEmptyMessage())}layoutCompositeBar(){if(this.contentDimension&&this.dimension&&this.paneCompositeBar.value){let e=this.compositeBarPosition===1?16:8,t=this.partId==="workbench.parts.panel"?0:1,o=this.contentDimension.width-e-t;o=Math.max(_0.MIN_COMPOSITE_BAR_WIDTH,o-this.getToolbarWidth()),this.paneCompositeBar.value.layout(o,this.dimension.height)}}layoutEmptyMessage(){let e=!this.getActiveComposite();this.element.classList.toggle("empty",e),e&&this.titleLabel?.updateTitle("","")}getToolbarWidth(){if(!this.toolBar||this.compositeBarPosition!==1||!this.getActivePaneComposite())return 0;let t=this.toolBar.getItemsWidth()+this.toolBar.getItemsLength()*4,o=this.globalToolBar?this.globalToolBar.getItemsWidth()+this.globalToolBar.getItemsLength()*4:0,n=this.globalLeftToolBar?this.globalLeftToolBar.getItemsWidth()+this.globalLeftToolBar.getItemsLength()*4:0;return t+o+n+8}onTitleAreaContextMenu(e){if(this.shouldShowCompositeBar()&&this.getCompositeBarPosition()===1)return this.onCompositeBarContextMenu(e);{let t=this.getActivePaneComposite(),o=t?t.getContextMenuActions():[];o.length&&this.contextMenuService.showContextMenu({getAnchor:()=>e,getActions:()=>o,getActionViewItem:(n,r)=>this.actionViewItemProvider(n,r),actionRunner:t.getActionRunner(),skipTelemetry:!0})}}onCompositeBarAreaContextMenu(e){return this.onCompositeBarContextMenu(e)}onCompositeBarContextMenu(e){if(this.paneCompositeBar.value){let t=[...this.paneCompositeBar.value.getContextMenuActions()];t.length&&this.contextMenuService.showContextMenu({getAnchor:()=>e,getActions:()=>t,skipTelemetry:!0})}}getViewsSubmenuAction(){let e=this.getActivePaneComposite()?.getViewPaneContainer();if(e){let t=new N,o=t.add(this.contextKeyService.createScoped(this.element));o.createKey("viewContainer",e.viewContainer.id);let n=this.menuService.getMenuActions(J4,o,{shouldForwardArgs:!0,renderShortTitle:!0}),r=ml(n,()=>!0).primary;return t.dispose(),r.length>1&&r.some(s=>s.enabled)?new Fs("views",d(4432,null),r):void 0}}};_0=I([m(13,Ne),m(14,ce),m(15,Xe),m(16,yi),m(17,_e),m(18,nt),m(19,F),m(20,Le),m(21,Bi),m(22,X),m(23,lt),m(24,Kt)],_0);var uee=class extends x{constructor(e,t){super();this.location=e;this.viewDescriptorService=t;this.viewContainerModelListeners=this._register(new Vt);this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._visibleCount=0;this.registerListeners(),this.initializeViewContainerListeners(),this.updateVisibleCount()}get visibleCount(){return this._visibleCount}registerListeners(){this._register(this.viewDescriptorService.onDidChangeViewContainers(({added:e,removed:t})=>{for(let{container:n,location:r}of e)r===this.location&&this.addViewContainerModelListener(n.id);for(let{container:n,location:r}of t)r===this.location&&this.viewContainerModelListeners.deleteAndDispose(n.id);[...e,...t].some(({location:n})=>n===this.location)&&this.updateVisibleCount()})),this._register(this.viewDescriptorService.onDidChangeContainerLocation(({viewContainer:e,from:t,to:o})=>{t===this.location&&this.viewContainerModelListeners.deleteAndDispose(e.id),o===this.location&&this.addViewContainerModelListener(e.id),(t===this.location||o===this.location)&&this.updateVisibleCount()}))}initializeViewContainerListeners(){for(let e of this.viewDescriptorService.getViewContainersByLocation(this.location))this.addViewContainerModelListener(e.id)}addViewContainerModelListener(e){let t=this.viewDescriptorService.getViewContainerById(e);if(t){let n=this.viewDescriptorService.getViewContainerModel(t).onDidChangeActiveViewDescriptors(()=>this.updateVisibleCount());this.viewContainerModelListeners.set(e,n)}}updateVisibleCount(){let o=this.viewDescriptorService.getViewContainersByLocation(this.location).filter(n=>this.viewDescriptorService.getViewContainerModel(n).activeViewDescriptors.length>0).length;if(this._visibleCount!==o){let n=this._visibleCount;this._visibleCount=o,this._onDidChange.fire({before:n,after:o})}}};uee=I([m(1,Bi)],uee);var VA=class extends _0{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super("workbench.parts.auxiliarybar",{hasTitle:!0,trailingSeparator:!0,borderWidth:()=>this.getColor(wK)||this.getColor(bi)?1:0},VA.activeViewSettingsKey,Ceo.bindTo(p),xeo.bindTo(p),"auxiliarybar","auxiliarybar",void 0,uDt,2,S0.Auxiliary,D.AuxiliaryBarTitle,void 0,e,t,o,n,r,s,l,c,u,p,h,f);this.commandService=g;this.configurationService=v;this.minimumWidth=170;this.maximumWidth=Number.POSITIVE_INFINITY;this.minimumHeight=0;this.maximumHeight=Number.POSITIVE_INFINITY;this.priority=1;this.visibleViewContainersTracker=this._register(l.createInstance(uee,2)),this._register(this.visibleViewContainersTracker.onDidChange(b=>this.onDidChangeAutoHideViewContainers(b))),this.configuration=this.resolveConfiguration(),this._register(v.onDidChangeConfiguration(b=>{b.affectsConfiguration("workbench.activityBar.location")?(this.configuration=this.resolveConfiguration(),this.onDidChangeActivityBarLocation()):b.affectsConfiguration("workbench.secondarySideBar.showLabels")?(this.configuration=this.resolveConfiguration(),this.updateCompositeBar(!0)):b.affectsConfiguration("workbench.activityBar.autoHide")&&this.onDidChangeActivityBarLocation()}))}static{this.activeViewSettingsKey="workbench.auxiliarybar.activepanelid"}static{this.pinnedViewsKey="workbench.auxiliarybar.pinnedPanels"}static{this.placeholdeViewContainersKey="workbench.auxiliarybar.placeholderPanels"}static{this.viewContainersWorkspaceStateKey="workbench.auxiliarybar.viewContainersWorkspaceState"}get preferredHeight(){return this.layoutService.mainContainerDimension.height*.4}get preferredWidth(){let e=this.getActivePaneComposite();if(!e)return;let t=e.getOptimalWidth();if(typeof t=="number")return Math.max(t,300)}onDidChangeAutoHideViewContainers(e){if(this.configurationService.getValue("workbench.activityBar.autoHide")&&(this.configuration.position==="top"||this.configuration.position==="bottom")){let o=e.before>1,n=e.after>1;o!==n&&this.onDidChangeActivityBarLocation()}}resolveConfiguration(){let e=this.configurationService.getValue("workbench.activityBar.location"),t=e!=="top"&&e!=="bottom",o=t&&this.configurationService.getValue("workbench.secondarySideBar.showLabels")!==!1;return{position:e,canShowLabels:t,showLabels:o}}onDidChangeActivityBarLocation(){this.updateCompositeBar();let e=this.getActiveComposite()?.getId();e&&this.onTitleAreaUpdate(e)}updateStyles(){super.updateStyles();let e=Ci(this.getContainer());e.style.backgroundColor=this.getColor(bf)||"";let t=this.getColor(wK)||this.getColor(bi),o=this.layoutService.getSideBarPosition()===1;e.style.color=this.getColor(CK)||"",e.style.borderLeftColor=t??"",e.style.borderRightColor=t??"",e.style.borderLeftStyle=t&&!o?"solid":"none",e.style.borderRightStyle=t&&o?"solid":"none",e.style.borderLeftWidth=t&&!o?"1px":"0px",e.style.borderRightWidth=t&&o?"1px":"0px"}getCompositeBarOptions(){let e=this;return{partContainerClass:"auxiliarybar",pinnedViewContainersKey:VA.pinnedViewsKey,placeholderViewContainersKey:VA.placeholdeViewContainersKey,viewContainersWorkspaceStateKey:VA.viewContainersWorkspaceStateKey,icon:!this.configuration.showLabels,orientation:0,recomputeSizes:!0,activityHoverOptions:{position:()=>this.getCompositeBarPosition()===2?3:2},fillExtraContextMenuActions:t=>this.fillExtraContextMenuActions(t),compositeSize:0,iconSize:16,get overflowActionSize(){return e.getCompositeBarPosition()===1?40:30},colors:t=>({activeBackgroundColor:t.getColor(bf),inactiveBackgroundColor:t.getColor(bf),get activeBorderBottomColor(){return e.getCompositeBarPosition()===1?t.getColor(lDt):t.getColor(nDt)},get activeForegroundColor(){return e.getCompositeBarPosition()===1?t.getColor($5):t.getColor(q5)},get inactiveForegroundColor(){return e.getCompositeBarPosition()===1?t.getColor(aDt):t.getColor(rDt)},badgeBackground:t.getColor(xF),badgeForeground:t.getColor(kF),get dragAndDropBorder(){return e.getCompositeBarPosition()===1?t.getColor(cDt):t.getColor(sDt)}}),compact:!0}}fillExtraContextMenuActions(e){let t=this.layoutService.getSideBarPosition()===0;if(this.getCompositeBarPosition()===1){let s=this.getViewsSubmenuAction();s&&(e.push(new ri),e.push(s))}let o=this.menuService.getMenuActions(D.ActivityBarPositionMenu,this.contextKeyService,{shouldForwardArgs:!0,renderShortTitle:!0}),n=zp(o).secondary,r=ii({id:"workbench.action.auxiliarybar.toggleShowLabels",label:this.configuration.showLabels?d(3840,null):d(3841,null),enabled:this.configuration.canShowLabels,run:()=>this.configurationService.updateValue("workbench.secondarySideBar.showLabels",!this.configuration.showLabels)});e.push(new ri,new Fs("workbench.action.panel.position",d(3836,null),n),ii({id:kT.ID,label:t?d(3838,null):d(3839,null),run:()=>this.commandService.executeCommand(kT.ID)}),r,ii({id:g0.ID,label:d(3837,null),run:()=>this.commandService.executeCommand(g0.ID)}))}shouldShowCompositeBar(){return!(this.configuration.position==="hidden"||(this.configuration.position==="top"||this.configuration.position==="bottom")&&this.configurationService.getValue("workbench.activityBar.autoHide")&&this.visibleViewContainersTracker.visibleCount<=1)}getCompositeBarPosition(){switch(this.configuration.position){case"top":return 0;case"bottom":return 2;case"hidden":return 1;case"default":return 1;default:return 1}}toJSON(){return{type:"workbench.parts.auxiliarybar"}}};VA=I([m(0,Ne),m(1,ce),m(2,Xe),m(3,yi),m(4,_e),m(5,nt),m(6,F),m(7,Le),m(8,Bi),m(9,X),m(10,lt),m(11,ge),m(12,Kt),m(13,B)],VA);var G2=class extends _0{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super("workbench.parts.panel",{hasTitle:!0,trailingSeparator:!0},G2.activePanelSettingsKey,keo.bindTo(p),Xde.bindTo(p),"panel","panel",void 0,CZi,1,S0.Panels,D.PanelTitle,void 0,e,t,o,n,r,s,l,c,u,p,h,f);this.commandService=g;this.configurationService=v;this.minimumWidth=300;this.maximumWidth=Number.POSITIVE_INFINITY;this.minimumHeight=77;this.maximumHeight=Number.POSITIVE_INFINITY;this._register(this.configurationService.onDidChangeConfiguration(b=>{b.affectsConfiguration("workbench.panel.showLabels")&&this.updateCompositeBar(!0)}))}get preferredHeight(){return this.layoutService.mainContainerDimension.height*.4}get preferredWidth(){let e=this.getActivePaneComposite();if(!e)return;let t=e.getOptimalWidth();if(typeof t=="number")return Math.max(t,300)}static{this.activePanelSettingsKey="workbench.panelpart.activepanelid"}updateStyles(){super.updateStyles();let e=Ci(this.getContainer());e.style.backgroundColor=this.getColor(lI)||"";let t=this.getColor(vf)||this.getColor(bi)||"";e.style.borderLeftColor=t,e.style.borderRightColor=t,e.style.borderBottomColor=t,this.titleArea&&(this.titleArea.style.borderTopColor=this.getColor(vf)||this.getColor(bi)||"")}getCompositeBarOptions(){return{partContainerClass:"panel",pinnedViewContainersKey:"workbench.panel.pinnedPanels",placeholderViewContainersKey:"workbench.panel.placeholderPanels",viewContainersWorkspaceStateKey:"workbench.panel.viewContainersWorkspaceState",icon:this.configurationService.getValue("workbench.panel.showLabels")===!1,orientation:0,recomputeSizes:!0,activityHoverOptions:{position:()=>this.layoutService.getPanelPosition()===2&&!this.layoutService.isPanelMaximized()?3:2},fillExtraContextMenuActions:e=>this.fillExtraContextMenuActions(e),compositeSize:0,iconSize:16,compact:!0,overflowActionSize:44,colors:e=>({activeBackgroundColor:e.getColor(lI),inactiveBackgroundColor:e.getColor(lI),activeBorderBottomColor:e.getColor(lDt),activeForegroundColor:e.getColor($5),inactiveForegroundColor:e.getColor(aDt),badgeBackground:e.getColor(xZi),badgeForeground:e.getColor(kZi),dragAndDropBorder:e.getColor(cDt)})}}fillExtraContextMenuActions(e){if(this.getCompositeBarPosition()===1){let c=this.getViewsSubmenuAction();c&&(e.push(new ri),e.push(c))}let t=this.menuService.getMenuActions(D.PanelPositionMenu,this.contextKeyService,{shouldForwardArgs:!0}),o=this.menuService.getMenuActions(D.PanelAlignmentMenu,this.contextKeyService,{shouldForwardArgs:!0}),n=zp(t).secondary,r=zp(o).secondary,s=this.configurationService.getValue("workbench.panel.showLabels"),l=ii({id:"workbench.action.panel.toggleShowLabels",label:s?d(4474,null):d(4475,null),run:()=>this.configurationService.updateValue("workbench.panel.showLabels",!s)});e.push(new ri,new Fs("workbench.action.panel.position",d(4473,null),n),new Fs("workbench.action.panel.align",d(4471,null),r),l,ii({id:D2.ID,label:d(4472,null),run:()=>this.commandService.executeCommand(D2.ID)}))}layout(e,t,o,n){let r;switch(this.layoutService.getPanelPosition()){case 1:r=new si(e-1,t);break;case 3:r=new si(e,t-1);break;default:r=new si(e,t);break}super.layout(r.width,r.height,o,n)}shouldShowCompositeBar(){return!0}getCompositeBarPosition(){return 1}toJSON(){return{type:"workbench.parts.panel"}}};G2=I([m(0,Ne),m(1,ce),m(2,Xe),m(3,yi),m(4,_e),m(5,nt),m(6,F),m(7,Le),m(8,Bi),m(9,X),m(10,lt),m(11,ge),m(12,Kt),m(13,B)],G2);W(class extends K{constructor(){super({id:"workbench.action.closeSidebar",title:L(4476,"Close Primary Side Bar"),category:Ve.View,f1:!0,precondition:tA})}run(a){a.get(yi).setPartHidden(!0,"workbench.parts.sidebar")}});var Xwi=class extends K{constructor(){super({id:"workbench.action.focusSideBar",title:L(4477,"Focus into Primary Side Bar"),category:Ve.View,f1:!0,keybinding:{weight:200,when:null,primary:2069}})}async run(i){let e=i.get(yi),t=i.get(us);e.isVisible("workbench.parts.sidebar")||e.setPartHidden(!1,"workbench.parts.sidebar"),t.getActivePaneComposite(0)?.focus()}};W(Xwi);var vRe=/\(&([^\s&])\)|(^|[^&])&([^\s&])/,eme=/(&amp;)?(&amp;)([^\s&])/g;var odo={shadowColor:void 0,borderColor:void 0,foregroundColor:void 0,backgroundColor:void 0,selectionForegroundColor:void 0,selectionBackgroundColor:void 0,selectionBorderColor:void 0,separatorColor:void 0,scrollbarShadow:void 0,scrollbarSliderBackground:void 0,scrollbarSliderHoverBackground:void 0,scrollbarSliderActiveBackground:void 0},A3=class a extends Zi{constructor(e,t,o,n){e.classList.add("monaco-menu-container"),e.setAttribute("role","presentation");let r=document.createElement("div");r.classList.add("monaco-menu"),r.setAttribute("role","presentation");super(r,{orientation:1,actionViewItemProvider:u=>this.doGetActionViewItem(u,o,s),context:o.context,actionRunner:o.actionRunner,ariaLabel:o.ariaLabel,ariaRole:"menu",focusOnlyEnabledItems:!0,triggerKeys:{keys:[3,...Ze||fn?[10]:[]],keyDown:!0}});this.menuStyles=n;this.menuElement=r,this.actionsList.tabIndex=0,this.initializeOrUpdateStyleSheet(e,n),this._register(Ms.addTarget(r)),this._register(j(r,re.KEY_DOWN,u=>{new gi(u).equals(2)&&u.preventDefault()})),o.enableMnemonics&&this._register(j(r,re.KEY_DOWN,u=>{let p=u.key.toLocaleLowerCase(),h=this.mnemonics.get(p);if(h!==void 0&&(Xt.stop(u,!0),h.length===1&&(h[0]instanceof GJe&&h[0].container&&this.focusItemByElement(h[0].container),h[0].onClick(u)),h.length>1)){let g=h.shift();g&&g.container&&(this.focusItemByElement(g.container),h.push(g)),this.mnemonics.set(p,h)}})),fn&&this._register(j(r,re.KEY_DOWN,u=>{let p=new gi(u);p.equals(14)||p.equals(11)?(this.focusedItem=this.viewItems.length-1,this.focusNext(),Xt.stop(u,!0)):(p.equals(13)||p.equals(12))&&(this.focusedItem=0,this.focusPrevious(),Xt.stop(u,!0))})),this._register(j(this.domNode,re.MOUSE_OUT,u=>{let p=u.relatedTarget;ts(p,this.domNode)||(this.focusedItem=void 0,this.updateFocus(),u.stopPropagation())})),this._register(j(this.actionsList,re.MOUSE_OVER,u=>{let p=u.target;if(!(!p||!ts(p,this.actionsList)||p===this.actionsList)){for(;p.parentElement!==this.actionsList&&p.parentElement!==null;)p=p.parentElement;if(p.classList.contains("action-item")){let h=this.focusedItem;this.setFocusedItem(p),h!==this.focusedItem&&this.updateFocus()}}})),this._register(Ms.addTarget(this.actionsList)),this._register(j(this.actionsList,Kn.Tap,u=>{let p=u.initialTarget;if(!(!p||!ts(p,this.actionsList)||p===this.actionsList)){for(;p.parentElement!==this.actionsList&&p.parentElement!==null;)p=p.parentElement;if(p.classList.contains("action-item")){let h=this.focusedItem;this.setFocusedItem(p),h!==this.focusedItem&&this.updateFocus()}}}));let s={parent:this};this.mnemonics=new Map,this.scrollableElement=this._register(new ms(r,{alwaysConsumeMouseWheel:!0,horizontal:2,vertical:3,verticalScrollbarSize:7,handleMouseWheel:!0,useShadows:!0}));let l=this.scrollableElement.getDomNode();l.style.position="",this.styleScrollElement(l,n),this._register(j(r,Kn.Change,u=>{Xt.stop(u,!0);let p=this.scrollableElement.getScrollPosition().scrollTop;this.scrollableElement.setScrollPosition({scrollTop:p-u.translationY})})),this._register(j(l,re.MOUSE_UP,u=>{u.preventDefault()}));let c=Re(e);r.style.maxHeight=`${Math.max(10,c.innerHeight-e.getBoundingClientRect().top-35)}px`,t=t.filter((u,p)=>o.submenuIds?.has(u.id)?(console.warn(`Found submenu cycle: ${u.id}`),!1):!(u instanceof ri&&(p===t.length-1||p===0||t[p-1]instanceof ri))),this.push(t,{icon:!0,label:!0,isMenu:!0}),e.appendChild(this.scrollableElement.getDomNode()),this.scrollableElement.scanDomNode(),this.viewItems.filter(u=>!(u instanceof oVt)).forEach((u,p,h)=>{u.updatePositionInSet(p+1,h.length)})}initializeOrUpdateStyleSheet(e,t){this.styleSheet||($$(e)?this.styleSheet=Cr(e):(a.globalStyleSheet||(a.globalStyleSheet=Cr()),this.styleSheet=a.globalStyleSheet)),this.styleSheet.textContent=Jwi(t,$$(e))}styleScrollElement(e,t){let o=t.foregroundColor??"",n=t.backgroundColor??"",r=t.borderColor?`1px solid ${t.borderColor}`:"",s="var(--vscode-cornerRadius-large)";e.style.outline=r,e.style.borderRadius=s,e.style.color=o,e.style.backgroundColor=n}getContainer(){return this.scrollableElement.getDomNode()}get onScroll(){return this.scrollableElement.onScroll}get scrollOffset(){return this.menuElement.scrollTop}trigger(e){if(e<=this.viewItems.length&&e>=0){let t=this.viewItems[e];if(t instanceof GJe)super.focus(e),t.open(!0);else if(t instanceof qJe)super.run(t._action,t._context);else return}}focusItemByElement(e){let t=this.focusedItem;this.setFocusedItem(e),t!==this.focusedItem&&this.updateFocus()}setFocusedItem(e){for(let t=0;t<this.actionsList.children.length;t++){let o=this.actionsList.children[t];if(e===o){this.focusedItem=t;break}}}updateFocus(e){super.updateFocus(e,!0,!0),typeof this.focusedItem<"u"&&this.scrollableElement.setScrollPosition({scrollTop:Math.round(this.menuElement.scrollTop)})}doGetActionViewItem(e,t,o){if(e instanceof ri)return new oVt(t.context,e,{icon:!0},this.menuStyles);if(e instanceof Fs){let n=new GJe(e,e.actions,o,{...t,submenuIds:new Set([...t.submenuIds||[],e.id])},this.menuStyles);if(t.enableMnemonics){let r=n.getMnemonic();if(r&&n.isEnabled()){let s=this.mnemonics.get(r);s!==void 0?s.push(n):this.mnemonics.set(r,[n])}}return n}else{let n=t.getKeyBinding?.(e)?.getLabel(),r={enableMnemonics:t.enableMnemonics,useEventAsContext:t.useEventAsContext,keybinding:n},s=new qJe(t.context,e,r,this.menuStyles);if(t.enableMnemonics){let l=s.getMnemonic();if(l&&s.isEnabled()){let c=this.mnemonics.get(l);c!==void 0?c.push(s):this.mnemonics.set(l,[s])}}return s}}},qJe=class extends wl{constructor(e,t,o,n){o={...o,isMenu:!0,icon:o.icon!==void 0?o.icon:!1,label:o.label!==void 0?o.label:!0};super(t,t,o);this.menuStyle=n;if(this.options=o,this.cssClass="",this.options.label&&o.enableMnemonics){let r=this.action.label;if(r){let s=vRe.exec(r);s&&(this.mnemonic=(s[1]?s[1]:s[3]).toLocaleLowerCase())}}this.runOnceToEnableMouseUp=new Dt(()=>{this.element&&(this._register(j(this.element,re.MOUSE_UP,r=>{if(Xt.stop(r,!0),Ac){if(new Cn(Re(this.element),r).rightButton)return;this.onClick(r)}else setTimeout(()=>{this.onClick(r)},0)})),this._register(j(this.element,re.CONTEXT_MENU,r=>{Xt.stop(r,!0)})))},100),this._register(this.runOnceToEnableMouseUp)}render(e){super.render(e),this.element&&(this.container=e,this.item=M(this.element,_("a.action-menu-item")),this._action.id===ri.ID?this.item.setAttribute("role","presentation"):(this.item.setAttribute("role","menuitem"),this.mnemonic&&this.item.setAttribute("aria-keyshortcuts",`${this.mnemonic}`)),this.check=M(this.item,_("span.menu-item-check"+q.asCSSSelector(R.menuSelection))),this.check.setAttribute("role","none"),this.label=M(this.item,_("span.action-label")),this.options.label&&this.options.keybinding&&(M(this.item,_("span.keybinding")).textContent=this.options.keybinding),this.runOnceToEnableMouseUp.schedule(),this.updateClass(),this.updateLabel(),this.updateTooltip(),this.updateEnabled(),this.updateChecked(),this.applyStyle())}blur(){super.blur(),this.applyStyle()}focus(){super.focus(),this.item?.focus(),this.applyStyle()}updatePositionInSet(e,t){this.item&&(this.item.setAttribute("aria-posinset",`${e}`),this.item.setAttribute("aria-setsize",`${t}`))}updateLabel(){if(this.label&&this.options.label){Rt(this.label);let e=Nu(this.action.label);if(e){let t=nVt(e);this.options.enableMnemonics||(e=t),this.label.setAttribute("aria-label",t.replace(/&&/g,"&"));let o=vRe.exec(e);if(o){e=mr(e),eme.lastIndex=0;let n=eme.exec(e);for(;n&&n[1];)n=eme.exec(e);let r=s=>s.replace(/&amp;&amp;/g,"&amp;");n?this.label.append(fC(r(e.substr(0,n.index))," "),_("u",{"aria-hidden":"true"},n[3]),dh(r(e.substr(n.index+n[0].length))," ")):this.label.textContent=r(e).trim(),this.item?.setAttribute("aria-keyshortcuts",(o[1]?o[1]:o[3]).toLocaleLowerCase())}else this.label.textContent=e.replace(/&&/g,"&").trim()}}}updateTooltip(){}updateClass(){this.cssClass&&this.item&&this.item.classList.remove(...this.cssClass.split(" ")),this.options.icon&&this.label?(this.cssClass=this.action.class||"",this.label.classList.add("icon"),this.cssClass&&this.label.classList.add(...this.cssClass.split(" ")),this.updateEnabled()):this.label&&this.label.classList.remove("icon")}updateEnabled(){this.action.enabled?(this.element&&(this.element.classList.remove("disabled"),this.element.removeAttribute("aria-disabled")),this.item&&(this.item.classList.remove("disabled"),this.item.removeAttribute("aria-disabled"),this.item.tabIndex=0)):(this.element&&(this.element.classList.add("disabled"),this.element.setAttribute("aria-disabled","true")),this.item&&(this.item.classList.add("disabled"),this.item.setAttribute("aria-disabled","true")))}updateChecked(){if(!this.item)return;let e=this.action.checked;this.item.classList.toggle("checked",!!e),e!==void 0?(this.item.setAttribute("role","menuitemcheckbox"),this.item.setAttribute("aria-checked",e?"true":"false")):(this.item.setAttribute("role","menuitem"),this.item.setAttribute("aria-checked",""))}getMnemonic(){return this.mnemonic}applyStyle(){let e=this.element&&this.element.classList.contains("focused"),t=e&&this.menuStyle.selectionForegroundColor?this.menuStyle.selectionForegroundColor:this.menuStyle.foregroundColor,o=e&&this.menuStyle.selectionBackgroundColor?this.menuStyle.selectionBackgroundColor:void 0,n=e&&this.menuStyle.selectionBorderColor?`1px solid ${this.menuStyle.selectionBorderColor}`:"",r=e&&this.menuStyle.selectionBorderColor?"-1px":"";this.item&&(this.item.style.color=t??"",this.item.style.backgroundColor=o??"",this.item.style.outline=n,this.item.style.outlineOffset=r),this.check&&(this.check.style.color=t??"")}},GJe=class extends qJe{constructor(e,t,o,n,r){super(e,e,n,r);this.submenuActions=t;this.parentData=o;this.submenuOptions=n;this.mysubmenu=null;this.submenuDisposables=this._register(new N);this.mouseOver=!1;this.expandDirection=n&&n.expandDirection!==void 0?n.expandDirection:{horizontal:0,vertical:1},this.showScheduler=new Dt(()=>{this.mouseOver&&(this.cleanupExistingSubmenu(!1),this.createSubmenu(!1))},250),this.hideScheduler=new Dt(()=>{this.element&&!ts(Nn(),this.element)&&this.parentData.submenu===this.mysubmenu&&(this.parentData.parent.focus(!1),this.cleanupExistingSubmenu(!0))},750)}render(e){super.render(e),this.element&&(this.item&&(this.item.classList.add("monaco-submenu-item"),this.item.tabIndex=0,this.item.setAttribute("aria-haspopup","true"),this.updateAriaExpanded("false"),this.submenuIndicator=M(this.item,_("span.submenu-indicator"+q.asCSSSelector(R.menuSubmenu))),this.submenuIndicator.setAttribute("aria-hidden","true")),this._register(j(this.element,re.KEY_UP,t=>{let o=new gi(t);(o.equals(17)||o.equals(3))&&(Xt.stop(t,!0),this.createSubmenu(!0))})),this._register(j(this.element,re.KEY_DOWN,t=>{let o=new gi(t);Nn()===this.item&&(o.equals(17)||o.equals(3))&&Xt.stop(t,!0)})),this._register(j(this.element,re.MOUSE_OVER,t=>{this.mouseOver||(this.mouseOver=!0,this.showScheduler.schedule())})),this._register(j(this.element,re.MOUSE_LEAVE,t=>{this.mouseOver=!1})),this._register(j(this.element,re.FOCUS_OUT,t=>{this.element&&!ts(Nn(),this.element)&&this.hideScheduler.schedule()})),this._register(this.parentData.parent.onScroll(()=>{this.parentData.submenu===this.mysubmenu&&(this.parentData.parent.focus(!1),this.cleanupExistingSubmenu(!0))})))}updateEnabled(){}open(e){this.cleanupExistingSubmenu(!1),this.createSubmenu(e)}onClick(e){Xt.stop(e,!0),this.cleanupExistingSubmenu(!1),this.createSubmenu(!0)}cleanupExistingSubmenu(e){if(this.parentData.submenu&&(e||this.parentData.submenu!==this.mysubmenu)){try{this.parentData.submenu.dispose()}catch{}this.parentData.submenu=void 0,this.updateAriaExpanded("false"),this.submenuContainer&&(this.submenuDisposables.clear(),this.submenuContainer=void 0)}}calculateSubmenuMenuLayout(e,t,o,n){let r={top:0,left:0};return r.left=Xle(e.width,t.width,{position:n.horizontal===0?0:1,offset:o.left,size:o.width}).position,r.left>=o.left&&r.left<o.left+o.width&&(o.left+10+t.width<=e.width&&(r.left=o.left+10),o.top+=10,o.height=0),r.top=Xle(e.height,t.height,{position:0,offset:o.top,size:0}).position,r.top+t.height===o.top&&r.top+o.height+t.height<=e.height&&(r.top+=o.height),r}createSubmenu(e=!0){if(this.element)if(this.parentData.submenu)this.parentData.submenu.focus(!1);else{this.updateAriaExpanded("true"),this.submenuContainer=M(this.element,_("div.monaco-submenu")),this.submenuContainer.classList.add("menubar-menu-items-holder","context-view");let t=Re(this.parentData.parent.domNode).getComputedStyle(this.parentData.parent.domNode),o=parseFloat(t.paddingTop||"0")||0;this.submenuContainer.style.position="fixed",this.submenuContainer.style.top="0",this.submenuContainer.style.left="0",this.submenuContainer.style.zIndex="1",this.parentData.submenu=new A3(this.submenuContainer,this.submenuActions.length?this.submenuActions:[new Pgt],this.submenuOptions,this.menuStyle);let n=this.element.getBoundingClientRect(),r={top:n.top-o,left:n.left,height:n.height+2*o,width:n.width},s=this.submenuContainer.getBoundingClientRect(),l=Re(this.element),{top:c,left:u}=this.calculateSubmenuMenuLayout(new si(l.innerWidth,l.innerHeight),si.lift(s),r,this.expandDirection);this.submenuContainer.style.left=`${u-s.left}px`,this.submenuContainer.style.top=`${c-s.top}px`,this.submenuDisposables.add(j(this.submenuContainer,re.KEY_UP,p=>{new gi(p).equals(15)&&(Xt.stop(p,!0),this.parentData.parent.focus(),this.cleanupExistingSubmenu(!0))})),this.submenuDisposables.add(j(this.submenuContainer,re.KEY_DOWN,p=>{new gi(p).equals(15)&&Xt.stop(p,!0)})),this.submenuDisposables.add(this.parentData.submenu.onDidCancel(()=>{this.parentData.parent.focus(),this.cleanupExistingSubmenu(!0)})),this.parentData.submenu.focus(e),this.mysubmenu=this.parentData.submenu}}updateAriaExpanded(e){this.item&&this.item?.setAttribute("aria-expanded",e)}applyStyle(){super.applyStyle();let t=this.element&&this.element.classList.contains("focused")&&this.menuStyle.selectionForegroundColor?this.menuStyle.selectionForegroundColor:this.menuStyle.foregroundColor;this.submenuIndicator&&(this.submenuIndicator.style.color=t??"")}dispose(){super.dispose(),this.hideScheduler.dispose(),this.mysubmenu&&(this.mysubmenu.dispose(),this.mysubmenu=null),this.submenuContainer&&(this.submenuContainer=void 0)}},oVt=class extends hs{constructor(e,t,o,n){super(e,t,o);this.menuStyles=n}render(e){super.render(e),this.label&&(this.label.style.borderBottomColor=this.menuStyles.separatorColor?`${this.menuStyles.separatorColor}`:"")}};function nVt(a){let i=vRe,e=i.exec(a);if(!e)return a;let t=!e[1];return a.replace(i,t?"$2$3":"").trim()}function ido(a){let i=Agt()[a.id];return`.codicon-${a.id}:before { content: '\\${i.toString(16)}'; }`}function Jwi(a,i){let t=`
.monaco-menu {
	font-size: 13px;
	border-radius: var(--vscode-cornerRadius-large);
	border: 1px solid ${a.borderColor??"var(--vscode-menu-border)"};
	min-width: 160px;
}

${ido(R.menuSelection)}
${ido(R.menuSubmenu)}

.monaco-menu .monaco-action-bar {
	text-align: right;
	overflow: hidden;
	white-space: nowrap;
}

.monaco-menu .monaco-action-bar .actions-container {
	display: flex;
	margin: 0 auto;
	padding: 0;
	width: 100%;
	justify-content: flex-end;
}

.monaco-menu .monaco-action-bar.vertical .actions-container {
	display: inline-block;
}

.monaco-menu .monaco-action-bar.reverse .actions-container {
	flex-direction: row-reverse;
}

.monaco-menu .monaco-action-bar .action-item {
	cursor: pointer;
	display: inline-block;
	transition: transform 50ms ease;
	position: relative;  /* DO NOT REMOVE - this is the key to preventing the ghosting icon bug in Chrome 42 */
}

.monaco-menu .monaco-action-bar .action-item.disabled {
	cursor: default;
}

.monaco-menu .monaco-action-bar .action-item .icon,
.monaco-menu .monaco-action-bar .action-item .codicon {
	display: inline-block;
}

.monaco-menu .monaco-action-bar .action-item .codicon {
	display: flex;
	align-items: center;
}

.monaco-menu .monaco-action-bar .action-label {
	font-size: 11px;
	margin-right: 4px;
}

.monaco-menu .monaco-action-bar .action-item.disabled .action-label,
.monaco-menu .monaco-action-bar .action-item.disabled .action-label:hover {
	color: var(--vscode-disabledForeground);
}

/* Vertical actions */

.monaco-menu .monaco-action-bar.vertical {
	text-align: left;
}

.monaco-menu .monaco-action-bar.vertical .action-item {
	display: block;
}

.monaco-menu .monaco-action-bar.vertical .action-label.separator {
	display: block;
	border-bottom: 1px solid var(--vscode-menu-separatorBackground);
	padding-top: 1px;
	padding: 30px;
}

.monaco-menu .secondary-actions .monaco-action-bar .action-label {
	margin-left: 6px;
}

/* Action Items */
.monaco-menu .monaco-action-bar .action-item.select-container {
	overflow: hidden; /* somehow the dropdown overflows its container, we prevent it here to not push */
	flex: 1;
	max-width: 170px;
	min-width: 60px;
	display: flex;
	align-items: center;
	justify-content: center;
	margin-right: 10px;
}

.monaco-menu .monaco-action-bar.vertical {
	margin-left: 0;
	overflow: visible;
}

.monaco-menu .monaco-action-bar.vertical .actions-container {
	display: block;
}

.monaco-menu .monaco-action-bar.vertical .action-item {
	padding: 0;
	transform: none;
	display: flex;
}

.monaco-menu .monaco-action-bar.vertical .action-item.active {
	transform: none;
}

.monaco-menu .monaco-action-bar.vertical .action-menu-item {
	flex: 1 1 auto;
	display: flex;
	height: 24px;
	align-items: center;
	position: relative;
	margin: 0 4px;
	border-radius: var(--vscode-cornerRadius-medium);
}

.monaco-menu .monaco-action-bar.vertical .action-menu-item:hover .keybinding,
.monaco-menu .monaco-action-bar.vertical .action-menu-item:focus .keybinding {
	opacity: unset;
}

.monaco-menu .monaco-action-bar.vertical .action-label {
	flex: 1 1 auto;
	text-decoration: none;
	padding: 0 1em;
	background: none;
	font-size: 12px;
	line-height: 1;
}

.monaco-menu .monaco-action-bar.vertical .keybinding,
.monaco-menu .monaco-action-bar.vertical .submenu-indicator {
	display: inline-block;
	flex: 2 1 auto;
	padding: 0 1em;
	text-align: right;
	font-size: 12px;
	line-height: 1;
	opacity: 0.7;
}

.monaco-menu .monaco-action-bar.vertical .submenu-indicator {
	height: 100%;
}

.monaco-menu .monaco-action-bar.vertical .submenu-indicator.codicon {
	font-size: 16px !important;
	display: flex;
	align-items: center;
}

.monaco-menu .monaco-action-bar.vertical .submenu-indicator.codicon::before {
	margin-left: auto;
	margin-right: -20px;
}

.monaco-menu .monaco-action-bar.vertical .action-item.disabled .keybinding,
.monaco-menu .monaco-action-bar.vertical .action-item.disabled .submenu-indicator {
	opacity: 0.4;
}

.monaco-menu .monaco-action-bar.vertical .action-label:not(.separator) {
	display: inline-block;
	box-sizing: border-box;
	margin: 0;
}

.monaco-menu .monaco-action-bar.vertical .action-item {
	position: static;
	overflow: visible;
}

.monaco-menu .monaco-action-bar.vertical .action-item .monaco-submenu {
	position: absolute;
}

.monaco-menu .monaco-action-bar.vertical .action-label.separator {
	width: 100%;
	height: 0px !important;
	opacity: 1;
}

.monaco-menu .monaco-action-bar.vertical .action-label.separator.text {
	padding: 0.7em 1em 0.1em 1em;
	font-weight: bold;
	opacity: 1;
}

.monaco-menu .monaco-action-bar.vertical .action-label:hover {
	color: inherit;
}

.monaco-menu .monaco-action-bar.vertical .menu-item-check {
	position: absolute;
	visibility: hidden;
	width: 1em;
	height: 100%;
}

.monaco-menu .monaco-action-bar.vertical .action-menu-item.checked .menu-item-check {
	visibility: visible;
	display: flex;
	align-items: center;
	justify-content: center;
}

/* Context Menu */

.context-view.monaco-menu-container {
	outline: 0;
	border: none;
	animation: fadeIn 0.083s linear;
	-webkit-app-region: no-drag;
	box-shadow: var(--vscode-shadow-lg${a.shadowColor?`, 0 0 12px ${a.shadowColor}`:""});
	border-radius: var(--vscode-cornerRadius-large);
	overflow: hidden;
}

.context-view.monaco-menu-container :focus,
.context-view.monaco-menu-container .monaco-action-bar.vertical:focus,
.context-view.monaco-menu-container .monaco-action-bar.vertical :focus {
	outline: 0;
}

.hc-black .context-view.monaco-menu-container,
.hc-light .context-view.monaco-menu-container,
:host-context(.hc-black) .context-view.monaco-menu-container,
:host-context(.hc-light) .context-view.monaco-menu-container {
	box-shadow: none;
}

.hc-black .monaco-menu .monaco-action-bar.vertical .action-item.focused,
.hc-light .monaco-menu .monaco-action-bar.vertical .action-item.focused,
:host-context(.hc-black) .monaco-menu .monaco-action-bar.vertical .action-item.focused,
:host-context(.hc-light) .monaco-menu .monaco-action-bar.vertical .action-item.focused {
	background: none;
}

/* Vertical Action Bar Styles */

.monaco-menu .monaco-action-bar.vertical {
	padding: 4px 0;
}

.monaco-menu .monaco-action-bar.vertical .action-menu-item {
	height: 24px;
}

.monaco-menu .monaco-action-bar.vertical .action-label:not(.separator),
.monaco-menu .monaco-action-bar.vertical .keybinding {
	font-size: inherit;
	padding: 0 2em;
	max-height: 100%;
}

.monaco-menu .monaco-action-bar.vertical .menu-item-check {
	font-size: inherit;
	width: 2em;
}

.monaco-menu .monaco-action-bar.vertical .action-label.separator {
	font-size: inherit;
	margin: 5px 0 !important;
	padding: 0;
	border-radius: 0;
}

.linux .monaco-menu .monaco-action-bar.vertical .action-label.separator,
:host-context(.linux) .monaco-menu .monaco-action-bar.vertical .action-label.separator {
	margin-left: 0;
	margin-right: 0;
}

.monaco-menu .monaco-action-bar.vertical .submenu-indicator {
	font-size: 60%;
	padding: 0 1.8em;
}

.linux .monaco-menu .monaco-action-bar.vertical .submenu-indicator,
:host-context(.linux) .monaco-menu .monaco-action-bar.vertical .submenu-indicator {
	height: 100%;
	mask-size: 10px 10px;
	-webkit-mask-size: 10px 10px;
}

.monaco-menu .action-item {
	cursor: default;
}`;if(i){t+=`
			/* Arrows */
			.monaco-scrollable-element > .scrollbar > .scra {
				cursor: pointer;
				font-size: 11px !important;
			}

			.monaco-scrollable-element > .visible {
				opacity: 1;

				/* Background rule added for IE9 - to allow clicks on dom node */
				background:rgba(0,0,0,0);

				transition: opacity 100ms linear;
			}
			.monaco-scrollable-element > .invisible {
				opacity: 0;
				pointer-events: none;
			}
			.monaco-scrollable-element > .invisible.fade {
				transition: opacity 800ms linear;
			}

			/* Scrollable Content Inset Shadow */
			.monaco-scrollable-element > .shadow {
				position: absolute;
				display: none;
			}
			.monaco-scrollable-element > .shadow.top {
				display: block;
				top: 0;
				left: 3px;
				height: 3px;
				width: 100%;
			}
			.monaco-scrollable-element > .shadow.left {
				display: block;
				top: 3px;
				left: 0;
				height: 100%;
				width: 3px;
			}
			.monaco-scrollable-element > .shadow.top-left-corner {
				display: block;
				top: 0;
				left: 0;
				height: 3px;
				width: 3px;
			}
			/* Fix for https://github.com/microsoft/vscode/issues/103170 */
			.monaco-menu .action-item .monaco-submenu {
				z-index: 1;
			}
		`;let o=a.scrollbarShadow;o&&(t+=`
				.monaco-scrollable-element > .shadow.top {
					box-shadow: ${o} 0 6px 6px -6px inset;
				}

				.monaco-scrollable-element > .shadow.left {
					box-shadow: ${o} 6px 0 6px -6px inset;
				}

				.monaco-scrollable-element > .shadow.top.left {
					box-shadow: ${o} 6px 6px 6px -6px inset;
				}
			`);let n=a.scrollbarSliderBackground;n&&(t+=`
				.monaco-scrollable-element > .scrollbar > .slider {
					background: ${n};
				}
			`);let r=a.scrollbarSliderHoverBackground;r&&(t+=`
				.monaco-scrollable-element > .scrollbar > .slider:hover {
					background: ${r};
				}
			`);let s=a.scrollbarSliderActiveBackground;s&&(t+=`
				.monaco-scrollable-element > .scrollbar > .slider.active {
					background: ${s};
				}
			`)}return t}var bRe=_;var rVt=class a extends x{constructor(e,t,o){super();this.container=e;this.options=t;this.menuStyle=o;this._mnemonicsInUse=!1;this.openedViaKeyboard=!1;this.awaitingAltRelease=!1;this.ignoreNextMouseUp=!1;this.updatePending=!1;this.numMenusShown=0;this.overflowLayoutScheduled=void 0;this.menuDisposables=this._register(new N);this.container.setAttribute("role","menubar"),this.isCompact&&this.container.classList.add("compact"),this.menus=[],this.mnemonics=new Map,this._focusState=1,this._onVisibilityChange=this._register(new E),this._onFocusStateChange=this._register(new E),this.createOverflowMenu(),this.menuUpdater=this._register(new Dt(()=>this.update(),200)),this.actionRunner=this.options.actionRunner??this._register(new rs),this._register(this.actionRunner.onWillRun(()=>{this.setUnfocusedState()})),this._register(nb.getInstance().event(this.onModifierKeyToggled,this)),this._register(j(this.container,re.KEY_DOWN,r=>{let s=new gi(r),l=!0,c=r.key?r.key.toLocaleLowerCase():"",u=Ze&&!this.isCompact;if(s.equals(15)||u&&s.equals(1026))this.focusPrevious();else if(s.equals(17)||u&&s.equals(2))this.focusNext();else if(s.equals(9)&&this.isFocused&&!this.isOpen)this.setUnfocusedState();else if(!this.isOpen&&!s.ctrlKey&&this.options.enableMnemonics&&this.mnemonicsInUse&&this.mnemonics.has(c)){let p=this.mnemonics.get(c);this.onMenuTriggered(p,!1)}else l=!1;!this.isCompact&&(s.equals(1026)||s.equals(2))&&s.preventDefault(),l&&(s.preventDefault(),s.stopPropagation())}));let n=Re(this.container);this._register(j(n,re.MOUSE_DOWN,()=>{this.isFocused&&this.setUnfocusedState()})),this._register(j(this.container,re.FOCUS_IN,r=>{let s=r;s.relatedTarget&&(this.container.contains(s.relatedTarget)||(this.focusToReturn=s.relatedTarget))})),this._register(j(this.container,re.FOCUS_OUT,r=>{let s=r;s.relatedTarget?s.relatedTarget&&!this.container.contains(s.relatedTarget)&&(this.focusToReturn=void 0,this.setUnfocusedState()):this.setUnfocusedState()})),this._register(j(n,re.KEY_DOWN,r=>{if(!this.options.enableMnemonics||!r.altKey||r.ctrlKey||r.defaultPrevented)return;let s=r.key.toLocaleLowerCase();if(!this.mnemonics.has(s))return;this.mnemonicsInUse=!0,this.updateMnemonicVisibility(!0);let l=this.mnemonics.get(s);this.onMenuTriggered(l,!1)})),this.setUnfocusedState()}static{this.OVERFLOW_INDEX=-1}push(e){cc(e).forEach(o=>{let n=this.menus.length,r=nVt(o.label),s=vRe.exec(o.label);if(s){let l=s[1]?s[1]:s[3];this.registerMnemonic(this.menus.length,l)}if(this.isCompact)this.menus.push(o);else{let l=bRe("div.menubar-menu-button",{role:"menuitem",tabindex:-1,"aria-label":r,"aria-haspopup":!0}),c=bRe("div.menubar-menu-title",{role:"none","aria-hidden":!0});l.appendChild(c),this.container.insertBefore(l,this.overflowMenu.buttonElement),this.updateLabels(c,l,o.label),this._register(j(l,re.KEY_UP,u=>{let p=new gi(u),h=!0;(p.equals(18)||p.equals(3))&&!this.isOpen?(this.focusedMenu={index:n},this.openedViaKeyboard=!0,this.focusState=3):h=!1,h&&(p.preventDefault(),p.stopPropagation())})),this._register(Ms.addTarget(l)),this._register(j(l,Kn.Tap,u=>{this.isOpen&&this.focusedMenu&&this.focusedMenu.holder&&ts(u.initialTarget,this.focusedMenu.holder)||(this.ignoreNextMouseUp=!1,this.onMenuTriggered(n,!0),u.preventDefault(),u.stopPropagation())})),this._register(j(l,re.MOUSE_DOWN,u=>{if(!new Cn(Re(l),u).leftButton){u.preventDefault();return}this.isOpen?this.ignoreNextMouseUp=!1:(this.ignoreNextMouseUp=!0,this.onMenuTriggered(n,!0)),u.preventDefault(),u.stopPropagation()})),this._register(j(l,re.MOUSE_UP,u=>{u.defaultPrevented||(this.ignoreNextMouseUp?this.ignoreNextMouseUp=!1:this.isFocused&&this.onMenuTriggered(n,!0))})),this._register(j(l,re.MOUSE_ENTER,()=>{this.isOpen&&!this.isCurrentMenu(n)?(l.focus(),this.cleanupCustomMenu(),this.showCustomMenu(n,!1)):this.isFocused&&!this.isOpen&&(this.focusedMenu={index:n},l.focus())})),this.menus.push({label:o.label,actions:o.actions,buttonElement:l,titleElement:c})}})}createOverflowMenu(){let e=this.isCompact?d(26,null):d(27,null),t=bRe("div.menubar-menu-button",{role:"menuitem",tabindex:this.isCompact?0:-1,"aria-label":e,"aria-haspopup":!0}),o=bRe("div.menubar-menu-title.toolbar-toggle-more"+q.asCSSSelector(R.menuBarMore),{role:"none","aria-hidden":!0});t.appendChild(o),this.container.appendChild(t),t.style.visibility="hidden",this._register(j(t,re.KEY_UP,n=>{let r=new gi(n),s=!0,l=[3];this.isCompact?(l.push(10),this.options.compactMode?.horizontal===0?l.push(17):this.options.compactMode?.horizontal===1&&l.push(15)):l.push(18),l.some(c=>r.equals(c))&&!this.isOpen?(this.focusedMenu={index:a.OVERFLOW_INDEX},this.openedViaKeyboard=!0,this.focusState=3):s=!1,s&&(r.preventDefault(),r.stopPropagation())})),this._register(Ms.addTarget(t)),this._register(j(t,Kn.Tap,n=>{this.isOpen&&this.focusedMenu&&this.focusedMenu.holder&&ts(n.initialTarget,this.focusedMenu.holder)||(this.ignoreNextMouseUp=!1,this.onMenuTriggered(a.OVERFLOW_INDEX,!0),n.preventDefault(),n.stopPropagation())})),this._register(j(t,re.MOUSE_DOWN,n=>{if(!new Cn(Re(t),n).leftButton){n.preventDefault();return}this.isOpen?this.ignoreNextMouseUp=!1:(this.ignoreNextMouseUp=!0,this.onMenuTriggered(a.OVERFLOW_INDEX,!0)),n.preventDefault(),n.stopPropagation()})),this._register(j(t,re.MOUSE_UP,n=>{n.defaultPrevented||(this.ignoreNextMouseUp?this.ignoreNextMouseUp=!1:this.isFocused&&this.onMenuTriggered(a.OVERFLOW_INDEX,!0))})),this._register(j(t,re.MOUSE_ENTER,()=>{this.isOpen&&!this.isCurrentMenu(a.OVERFLOW_INDEX)?(this.overflowMenu.buttonElement.focus(),this.cleanupCustomMenu(),this.showCustomMenu(a.OVERFLOW_INDEX,!1)):this.isFocused&&!this.isOpen&&(this.focusedMenu={index:a.OVERFLOW_INDEX},t.focus())})),this.overflowMenu={buttonElement:t,titleElement:o,label:"More",actions:[]}}updateMenu(e){let t=this.menus.filter(o=>o.label===e.label);t&&t.length&&(t[0].actions=e.actions)}dispose(){super.dispose(),this.menus.forEach(e=>{e.titleElement?.remove(),e.buttonElement?.remove()}),this.overflowMenu.titleElement.remove(),this.overflowMenu.buttonElement.remove(),Be(this.overflowLayoutScheduled),this.overflowLayoutScheduled=void 0}blur(){this.setUnfocusedState()}getWidth(){if(!this.isCompact&&this.menus){let e=this.menus[0].buttonElement.getBoundingClientRect().left;return(this.hasOverflow?this.overflowMenu.buttonElement.getBoundingClientRect().right:this.menus[this.menus.length-1].buttonElement.getBoundingClientRect().right)-e}return 0}getHeight(){return this.container.clientHeight}toggleFocus(){!this.isFocused&&this.options.visibility!=="hidden"?(this.mnemonicsInUse=!0,this.focusedMenu={index:this.numMenusShown>0?0:a.OVERFLOW_INDEX},this.focusState=2):this.isOpen||this.setUnfocusedState()}updateOverflowAction(){if(!this.menus||!this.menus.length)return;let e="overflow-menu-only";this.container.classList.toggle(e,!1);let t=this.container.offsetWidth,o=0,n=this.isCompact,r=this.numMenusShown;this.numMenusShown=0;let s=this.menus.filter(l=>l.buttonElement!==void 0&&l.titleElement!==void 0);for(let l of s){if(!n){let c=l.buttonElement.offsetWidth;o+c>t?n=!0:(o+=c,this.numMenusShown++,this.numMenusShown>r&&(l.buttonElement.style.visibility="visible"))}n&&(l.buttonElement.style.visibility="hidden")}if(this.numMenusShown-1<=s.length/4){for(let l of s)l.buttonElement.style.visibility="hidden";n=!0,this.numMenusShown=0,o=0}if(this.isCompact){this.overflowMenu.actions=[];for(let c=this.numMenusShown;c<this.menus.length;c++)this.overflowMenu.actions.push(new Fs(`menubar.submenu.${this.menus[c].label}`,this.menus[c].label,this.menus[c].actions||[]));let l=this.options.getCompactMenuActions?.();l&&l.length&&(this.overflowMenu.actions.push(new ri),this.overflowMenu.actions.push(...l)),this.overflowMenu.buttonElement.style.visibility="visible"}else if(n){for(;o+this.overflowMenu.buttonElement.offsetWidth>t&&this.numMenusShown>0;){this.numMenusShown--;let l=s[this.numMenusShown].buttonElement.offsetWidth;s[this.numMenusShown].buttonElement.style.visibility="hidden",o-=l}this.overflowMenu.actions=[];for(let l=this.numMenusShown;l<s.length;l++)this.overflowMenu.actions.push(new Fs(`menubar.submenu.${s[l].label}`,s[l].label,s[l].actions||[]));this.overflowMenu.buttonElement.nextElementSibling!==s[this.numMenusShown].buttonElement&&(this.overflowMenu.buttonElement.remove(),this.container.insertBefore(this.overflowMenu.buttonElement,s[this.numMenusShown].buttonElement)),this.overflowMenu.buttonElement.style.visibility="visible"}else this.overflowMenu.buttonElement.remove(),this.container.appendChild(this.overflowMenu.buttonElement),this.overflowMenu.buttonElement.style.visibility="hidden";this.container.classList.toggle(e,this.numMenusShown===0)}updateLabels(e,t,o){let n=nVt(o);if(this.options.enableMnemonics){let s=mr(o);eme.lastIndex=0;let l=eme.exec(s);for(;l&&l[1];)l=eme.exec(s);let c=u=>u.replace(/&amp;&amp;/g,"&amp;");l?(e.textContent="",e.append(fC(c(s.substr(0,l.index))," "),bRe("mnemonic",{"aria-hidden":"true"},l[3]),dh(c(s.substr(l.index+l[0].length))," "))):e.textContent=c(s).trim()}else e.textContent=n.replace(/&&/g,"&");let r=vRe.exec(o);if(r){let s=r[1]?r[1]:r[3];this.options.enableMnemonics?t.setAttribute("aria-keyshortcuts","Alt+"+s.toLocaleLowerCase()):t.removeAttribute("aria-keyshortcuts")}}update(e){if(e&&(this.options=e),this.isFocused){this.updatePending=!0;return}this.menus.forEach(t=>{!t.buttonElement||!t.titleElement||this.updateLabels(t.titleElement,t.buttonElement,t.label)}),this.overflowLayoutScheduled||(this.overflowLayoutScheduled=Wr(Re(this.container),()=>{this.updateOverflowAction(),this.overflowLayoutScheduled=void 0})),this.setUnfocusedState()}registerMnemonic(e,t){this.mnemonics.set(t.toLocaleLowerCase(),e)}hideMenubar(){this.container.style.display!=="none"&&(this.container.style.display="none",this._onVisibilityChange.fire(!1))}showMenubar(){this.container.style.display!=="flex"&&(this.container.style.display="flex",this._onVisibilityChange.fire(!0),this.updateOverflowAction())}get focusState(){return this._focusState}set focusState(e){if(this._focusState>=2&&e<2&&this.updatePending&&(this.menuUpdater.schedule(),this.updatePending=!1),e===this._focusState)return;let t=this.isVisible,o=this.isOpen,n=this.isFocused;switch(this._focusState=e,e){case 0:t&&this.hideMenubar(),o&&this.cleanupCustomMenu(),n&&(this.focusedMenu=void 0,this.focusToReturn&&(this.focusToReturn.focus(),this.focusToReturn=void 0));break;case 1:t||this.showMenubar(),o&&this.cleanupCustomMenu(),n&&(this.focusedMenu&&(this.focusedMenu.index===a.OVERFLOW_INDEX?this.overflowMenu.buttonElement.blur():this.menus[this.focusedMenu.index].buttonElement?.blur()),this.focusedMenu=void 0,this.focusToReturn&&(this.focusToReturn.focus(),this.focusToReturn=void 0));break;case 2:t||this.showMenubar(),o&&this.cleanupCustomMenu(),this.focusedMenu&&(this.focusedMenu.index===0&&this.numMenusShown===0&&(this.focusedMenu.index=a.OVERFLOW_INDEX),this.focusedMenu.index===a.OVERFLOW_INDEX?this.overflowMenu.buttonElement.focus():this.menus[this.focusedMenu.index].buttonElement?.focus());break;case 3:t||this.showMenubar(),this.focusedMenu&&(this.cleanupCustomMenu(),this.showCustomMenu(this.focusedMenu.index,this.openedViaKeyboard));break}this._focusState=e,this._onFocusStateChange.fire(this.focusState>=2)}get isVisible(){return this.focusState>=1}get isFocused(){return this.focusState>=2}get isOpen(){return this.focusState>=3}get hasOverflow(){return this.isCompact||this.numMenusShown<this.menus.length}get isCompact(){return this.options.compactMode!==void 0}setUnfocusedState(){this.options.visibility==="toggle"||this.options.visibility==="hidden"?this.focusState=0:this.options.visibility==="classic"&&hC(ut)?this.focusState=0:this.focusState=1,this.ignoreNextMouseUp=!1,this.mnemonicsInUse=!1,this.updateMnemonicVisibility(!1)}focusPrevious(){if(!this.focusedMenu||this.numMenusShown===0)return;let e=(this.focusedMenu.index-1+this.numMenusShown)%this.numMenusShown;this.focusedMenu.index===a.OVERFLOW_INDEX?e=this.numMenusShown-1:this.focusedMenu.index===0&&this.hasOverflow&&(e=a.OVERFLOW_INDEX),e!==this.focusedMenu.index&&(this.isOpen?(this.cleanupCustomMenu(),this.showCustomMenu(e)):this.isFocused&&(this.focusedMenu.index=e,e===a.OVERFLOW_INDEX?this.overflowMenu.buttonElement.focus():this.menus[e].buttonElement?.focus()))}focusNext(){if(!this.focusedMenu||this.numMenusShown===0)return;let e=(this.focusedMenu.index+1)%this.numMenusShown;this.focusedMenu.index===a.OVERFLOW_INDEX?e=0:this.focusedMenu.index===this.numMenusShown-1&&(e=a.OVERFLOW_INDEX),e!==this.focusedMenu.index&&(this.isOpen?(this.cleanupCustomMenu(),this.showCustomMenu(e)):this.isFocused&&(this.focusedMenu.index=e,e===a.OVERFLOW_INDEX?this.overflowMenu.buttonElement.focus():this.menus[e].buttonElement?.focus()))}updateMnemonicVisibility(e){this.menus&&this.menus.forEach(t=>{if(t.titleElement&&t.titleElement.children.length){let o=t.titleElement.children.item(0);o&&(o.style.textDecoration=this.options.alwaysOnMnemonics||e?"underline":"")}})}get mnemonicsInUse(){return this._mnemonicsInUse}set mnemonicsInUse(e){this._mnemonicsInUse=e}get shouldAltKeyFocus(){return Ze?!1:!this.options.disableAltFocus||this.options.visibility==="toggle"}get onVisibilityChange(){return this._onVisibilityChange.event}get onFocusStateChange(){return this._onFocusStateChange.event}onMenuTriggered(e,t){this.isOpen?this.isCurrentMenu(e)?this.setUnfocusedState():(this.cleanupCustomMenu(),this.showCustomMenu(e,this.openedViaKeyboard)):(this.focusedMenu={index:e},this.openedViaKeyboard=!t,this.focusState=3)}onModifierKeyToggled(e){let t=!e.altKey&&!e.ctrlKey&&!e.shiftKey&&!e.metaKey;this.options.visibility!=="hidden"&&(e.event&&this.shouldAltKeyFocus&&Zb.toEnum(e.event.code)===159&&e.event.preventDefault(),this.isFocused&&e.lastKeyPressed==="alt"&&e.altKey&&(this.setUnfocusedState(),this.mnemonicsInUse=!1,this.awaitingAltRelease=!0),t&&e.lastKeyPressed==="alt"&&e.lastKeyReleased==="alt"&&(this.awaitingAltRelease||(!this.isFocused&&this.shouldAltKeyFocus?(this.mnemonicsInUse=!0,this.focusedMenu={index:this.numMenusShown>0?0:a.OVERFLOW_INDEX},this.focusState=2):this.isOpen||this.setUnfocusedState())),!e.altKey&&e.lastKeyReleased==="alt"&&(this.awaitingAltRelease=!1),this.options.enableMnemonics&&this.menus&&!this.isOpen&&this.updateMnemonicVisibility(!this.awaitingAltRelease&&e.altKey||this.mnemonicsInUse))}isCurrentMenu(e){return this.focusedMenu?this.focusedMenu.index===e:!1}cleanupCustomMenu(){this.focusedMenu&&(this.focusedMenu.index===a.OVERFLOW_INDEX?this.overflowMenu.buttonElement.focus():this.menus[this.focusedMenu.index].buttonElement?.focus(),this.focusedMenu.holder&&(this.focusedMenu.holder.parentElement?.classList.remove("open"),this.focusedMenu.holder.remove()),this.focusedMenu.widget?.dispose(),this.focusedMenu={index:this.focusedMenu.index}),this.menuDisposables.clear()}showCustomMenu(e,t=!0){let o=e>=this.numMenusShown?a.OVERFLOW_INDEX:e,n=o===a.OVERFLOW_INDEX?this.overflowMenu:this.menus[o];if(!n.actions||!n.buttonElement||!n.titleElement)return;let r=bRe("div.menubar-menu-items-holder",{title:""});n.buttonElement.classList.add("open");let s=n.titleElement.getBoundingClientRect(),l=Y9(n.titleElement);if(this.options.compactMode?.horizontal===0)r.style.left=`${s.left+this.container.clientWidth}px`;else if(this.options.compactMode?.horizontal===1){let p=Re(this.container).innerWidth;r.style.right=`${p-s.left}px`,r.style.left="auto"}else r.style.left=`${s.left*l}px`;this.options.compactMode?.vertical===0?r.style.top=`${s.top-this.menus.length*30+this.container.clientHeight}px`:this.options.compactMode?.vertical===1?r.style.top=`${s.top}px`:r.style.top=`${s.bottom*l}px`,n.buttonElement.appendChild(r);let c={getKeyBinding:this.options.getKeybinding,actionRunner:this.actionRunner,enableMnemonics:this.options.alwaysOnMnemonics||this.mnemonicsInUse&&this.options.enableMnemonics,ariaLabel:n.buttonElement.getAttribute("aria-label")??void 0,expandDirection:this.isCompact?this.options.compactMode:{horizontal:0,vertical:1},useEventAsContext:!0},u=this.menuDisposables.add(new A3(r,n.actions,c,this.menuStyle));this.menuDisposables.add(u.onDidCancel(()=>{this.focusState=2})),o!==e?u.trigger(e-this.numMenusShown):u.focus(t),this.focusedMenu={index:o,holder:r,widget:u}}};ve.appendMenuItem(D.MenubarMainMenu,{submenu:D.MenubarFileMenu,title:{value:"File",original:"File",mnemonicTitle:d(4499,null)},order:1});ve.appendMenuItem(D.MenubarMainMenu,{submenu:D.MenubarEditMenu,title:{value:"Edit",original:"Edit",mnemonicTitle:d(4497,null)},order:2});ve.appendMenuItem(D.MenubarMainMenu,{submenu:D.MenubarSelectionMenu,title:{value:"Selection",original:"Selection",mnemonicTitle:d(4503,null)},order:3});ve.appendMenuItem(D.MenubarMainMenu,{submenu:D.MenubarViewMenu,title:{value:"View",original:"View",mnemonicTitle:d(4505,null)},order:4});ve.appendMenuItem(D.MenubarMainMenu,{submenu:D.MenubarGoMenu,title:{value:"Go",original:"Go",mnemonicTitle:d(4500,null)},order:5});ve.appendMenuItem(D.MenubarMainMenu,{submenu:D.MenubarTerminalMenu,title:{value:"Terminal",original:"Terminal",mnemonicTitle:d(4504,null)},order:7});ve.appendMenuItem(D.MenubarMainMenu,{submenu:D.MenubarHelpMenu,title:{value:"Help",original:"Help",mnemonicTitle:d(4501,null)},order:8});ve.appendMenuItem(D.MenubarMainMenu,{submenu:D.MenubarPreferencesMenu,title:{value:"Preferences",original:"Preferences",mnemonicTitle:d(4502,null)},when:rk,order:9});var $Je=class a extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super();this.menuService=e;this.workspacesService=t;this.contextKeyService=o;this.keybindingService=n;this.configurationService=r;this.labelService=s;this.updateService=l;this.storageService=c;this.notificationService=u;this.preferencesService=p;this.environmentService=h;this.accessibilityService=g;this.hostService=f;this.commandService=v;this.keys=["window.menuBarVisibility","window.enableMenuBarMnemonics","window.customMenuBarAltFocus","workbench.sideBar.location","window.nativeTabs"];this.menus={};this.topLevelTitles={};this.recentlyOpened={files:[],workspaces:[]};this.mainMenu=this._register(this.menuService.createMenu(D.MenubarMainMenu,this.contextKeyService)),this.mainMenuDisposables=this._register(new N),this.setupMainMenu(),this.menuUpdater=this._register(new Dt(()=>this.doUpdateMenubar(!1),200)),this.notifyUserOfCustomMenubarAccessibility()}static{this.MAX_MENU_RECENT_ENTRIES=10}registerListeners(){this._register(this.hostService.onDidChangeFocus(e=>this.onDidChangeWindowFocus(e))),this._register(this.configurationService.onDidChangeConfiguration(e=>this.onConfigurationUpdated(e))),this._register(this.updateService.onStateChange(()=>this.onUpdateStateChange())),this._register(this.workspacesService.onDidChangeRecentlyOpened(()=>{this.onDidChangeRecentlyOpened()})),this._register(this.keybindingService.onDidUpdateKeybindings(()=>this.updateMenubar())),this._register(this.labelService.onDidChangeFormatters(()=>{this.onDidChangeRecentlyOpened()})),this._register(this.mainMenu.onDidChange(()=>{this.setupMainMenu(),this.doUpdateMenubar(!0)}))}setupMainMenu(){this.mainMenuDisposables.clear(),this.menus={},this.topLevelTitles={};let[,e]=this.mainMenu.getActions()[0];for(let t of e)t instanceof Nc&&typeof t.item.title!="string"&&(this.menus[t.item.title.original]=this.mainMenuDisposables.add(this.menuService.createMenu(t.item.submenu,this.contextKeyService,{emitEventsForSubmenuChanges:!0})),this.topLevelTitles[t.item.title.original]=t.item.title.mnemonicTitle??t.item.title.value)}updateMenubar(){this.menuUpdater.schedule()}calculateActionLabel(e){let t=e.label;switch(e.id){default:break}return t}onUpdateStateChange(){this.updateMenubar()}onUpdateKeybindings(){this.updateMenubar()}getOpenRecentActions(){if(!this.recentlyOpened)return[];let{workspaces:e,files:t}=this.recentlyOpened,o=[];if(e.length>0){for(let n=0;n<a.MAX_MENU_RECENT_ENTRIES&&n<e.length;n++)o.push(this.createOpenRecentMenuAction(e[n]));o.push(new ri)}if(t.length>0){for(let n=0;n<a.MAX_MENU_RECENT_ENTRIES&&n<t.length;n++)o.push(this.createOpenRecentMenuAction(t[n]));o.push(new ri)}return o}onDidChangeWindowFocus(e){e&&this.onDidChangeRecentlyOpened()}onConfigurationUpdated(e){this.keys.some(t=>e.affectsConfiguration(t))&&this.updateMenubar(),e.affectsConfiguration("editor.accessibilitySupport")&&this.notifyUserOfCustomMenubarAccessibility(),e.affectsConfiguration("window.menuBarVisibility")&&this.onDidChangeRecentlyOpened()}get menubarHidden(){return Ze&&Vr?!1:uR(this.configurationService)==="hidden"}onDidChangeRecentlyOpened(){this.menubarHidden||this.workspacesService.getRecentlyOpened().then(e=>{this.recentlyOpened=e,this.updateMenubar()})}createOpenRecentMenuAction(e){let t,o,n,r,s=e.remoteAuthority;ZR(e)?(o=e.folderUri,t=e.label||this.labelService.getWorkspaceLabel(o,{verbose:2}),n="openRecentFolder",r={folderUri:o}):EA(e)?(o=e.workspace.configPath,t=e.label||this.labelService.getWorkspaceLabel(e.workspace,{verbose:2}),n="openRecentWorkspace",r={workspaceUri:o}):(o=e.fileUri,t=e.label||this.labelService.getUriLabel(o,{appendWorkspaceSuffix:!0}),n="openRecentFile",r={fileUri:o});let l=ii({id:n,label:o5e(t),run:c=>{let u=c&&(!Ze&&(c.ctrlKey||c.shiftKey)||Ze&&(c.metaKey||c.altKey));return this.hostService.openWindow([r],{forceNewWindow:!!u,remoteAuthority:s||null})}});return Object.assign(l,{uri:o,remoteAuthority:s})}notifyUserOfCustomMenubarAccessibility(){if(Wt||Ze)return;let e=this.storageService.getBoolean("menubar/accessibleMenubarNotified",-1,!1),t=!$O(this.configurationService);if(e||t||!this.accessibilityService.isScreenReaderOptimized())return;let o=d(4498,null);this.notificationService.prompt(ft.Info,o,[{label:d(4494,null),run:()=>this.preferencesService.openUserSettings({query:"window.menuStyle"})}]),this.storageService.store("menubar/accessibleMenubarNotified",!0,-1,0)}},sVt;function m9o(){return sVt||(sVt=new E,W(class extends K{constructor(){super({id:"workbench.actions.menubar.focus",title:L(4493,"Focus Application Menu"),keybinding:{primary:580,weight:200,when:Fu},f1:!0})}async run(){sVt?.fire()}})),sVt}var pee=class extends $Je{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super(e,t,o,n,r,s,l,c,u,p,h,g,v,b);this.telemetryService=f;this.alwaysOnMnemonics=!1;this.focusInsideMenubar=!1;this.pendingFirstTimeUpdate=!1;this.visible=!0;this.webNavigationMenu=this._register(this.menuService.createMenu(D.MenubarHomeMenu,this.contextKeyService));this.reinstallDisposables=this._register(new N);this.updateActionsDisposables=this._register(new N);this._onVisibilityChange=this._register(new E),this._onFocusStateChange=this._register(new E),this.actionRunner=this._register(new rs),this._register(this.actionRunner.onDidRun(S=>{this.telemetryService.publicLog2("workbenchActionExecuted",{id:S.action.id,from:"menu"})})),this.workspacesService.getRecentlyOpened().then(S=>{this.recentlyOpened=S}),this.registerListeners()}doUpdateMenubar(e){this.focusInsideMenubar||this.setupCustomMenubar(e),e&&(this.pendingFirstTimeUpdate=!0)}getUpdateAction(){switch(this.updateService.state.type){case"idle":return ii({id:"update.check",label:d(4489,null),enabled:!0,run:()=>this.updateService.checkForUpdates(!0)});case"checking for updates":return ii({id:"update.checking",label:d(4490,null),enabled:!1,run:()=>{}});case"available for download":return ii({id:"update.downloadNow",label:d(4491,null),enabled:!0,run:()=>this.updateService.downloadUpdate(!0)});case"downloading":case"overwriting":return ii({id:"update.downloading",label:d(4492,null),enabled:!1,run:()=>{}});case"downloaded":return Ze?null:ii({id:"update.install",label:d(4496,null),enabled:!0,run:()=>this.updateService.applyUpdate()});case"updating":return ii({id:"update.updating",label:d(4495,null),enabled:!1,run:()=>{}});case"ready":return ii({id:"update.restart",label:d(4506,null),enabled:!0,run:()=>this.updateService.quitAndInstall()});default:return null}}get currentMenubarVisibility(){return uR(this.configurationService)}get currentDisableMenuBarAltFocus(){let e=this.configurationService.getValue("window.customMenuBarAltFocus"),t=!1;return typeof e=="boolean"&&(t=!e),t}insertActionsBefore(e,t){switch(e.id){case v0.ID:t.push(...this.getOpenRecentActions());break;case"workbench.action.showAboutDialog":if(!Ze&&!Wt){let o=this.getUpdateAction();o&&(o.label=fj(o.label),t.push(o),t.push(new ri))}break;default:break}}get currentEnableMenuBarMnemonics(){let e=this.configurationService.getValue("window.enableMenuBarMnemonics");return typeof e!="boolean"&&(e=!0),e&&(!Wt||hC(ut))}get currentCompactMenuMode(){if(this.currentMenubarVisibility!=="compact")return;let t=this.configurationService.getValue("workbench.sideBar.location")==="right"?1:0,n=this.configurationService.getValue("workbench.activityBar.location")==="bottom"?0:1;return{horizontal:t,vertical:n}}onDidVisibilityChange(e){this.visible=e,this.onDidChangeRecentlyOpened(),this._onVisibilityChange.fire(e)}toActionsArray(e){return tu(e.getActions({shouldForwardArgs:!0}))}setupCustomMenubar(e){if(!this.container)return;e?(this.menubar&&this.reinstallDisposables.clear(),this.menubar=this.reinstallDisposables.add(new rVt(this.container,this.getMenuBarOptions(),mwt)),this.accessibilityService.alwaysUnderlineAccessKeys().then(o=>{this.alwaysOnMnemonics=o,this.menubar?.update(this.getMenuBarOptions())}),this.reinstallDisposables.add(this.menubar.onFocusStateChange(o=>{this._onFocusStateChange.fire(o),o||(this.pendingFirstTimeUpdate?(this.setupCustomMenubar(!0),this.pendingFirstTimeUpdate=!1):this.updateMenubar(),this.focusInsideMenubar=!1)})),this.reinstallDisposables.add(this.menubar.onVisibilityChange(o=>this.onDidVisibilityChange(o))),this.reinstallDisposables.add(j(this.container,re.FOCUS_IN,()=>{this.focusInsideMenubar=!0})),this.reinstallDisposables.add(j(this.container,re.FOCUS_OUT,()=>{this.focusInsideMenubar=!1})),this.menubar.isVisible&&this.onDidVisibilityChange(!0)):this.menubar?.update(this.getMenuBarOptions());let t=(o,n,r,s)=>{n.splice(0);for(let l of o)if(this.insertActionsBefore(l,n),l instanceof ri)n.push(l);else if(l instanceof Nc||l instanceof Lo){let c=typeof l.item.title=="string"?l.item.title:l.item.title.mnemonicTitle??l.item.title.value;if(l instanceof Nc){let u=[];t(l.actions,u,r,s),u.length>0&&n.push(new Fs(l.id,fj(c),u))}else{zCe(l.item.toggled)&&(c=l.item.toggled.mnemonicTitle??l.item.toggled.title??c);let u=s.add(new it(l.id,fj(c),l.class,l.enabled,()=>this.commandService.executeCommand(l.id)));u.tooltip=l.tooltip,u.checked=l.checked,n.push(u)}}if(r==="File"&&this.currentCompactMenuMode===void 0){let l=this.getWebNavigationActions();l.length&&n.push(...l)}};for(let o of Object.keys(this.topLevelTitles)){let n=this.menus[o];if(e&&n){let s=this.reinstallDisposables.add(new N);if(this.reinstallDisposables.add(n.onDidChange(()=>{if(!this.focusInsideMenubar){let l=[];s.clear(),t(this.toActionsArray(n),l,o,s),this.menubar?.updateMenu({actions:l,label:fj(this.topLevelTitles[o])})}})),n===this.menus.File){let l=this.reinstallDisposables.add(new N);this.reinstallDisposables.add(this.webNavigationMenu.onDidChange(()=>{if(!this.focusInsideMenubar){let c=[];l.clear(),t(this.toActionsArray(n),c,o,l),this.menubar?.updateMenu({actions:c,label:fj(this.topLevelTitles[o])})}}))}}let r=[];n&&(this.updateActionsDisposables.clear(),t(this.toActionsArray(n),r,o,this.updateActionsDisposables)),this.menubar&&(e?this.menubar.push({actions:r,label:fj(this.topLevelTitles[o])}):this.menubar.updateMenu({actions:r,label:fj(this.topLevelTitles[o])}))}}getWebNavigationActions(){if(!Wt)return[];let e=[];for(let t of this.webNavigationMenu.getActions()){let[,o]=t;for(let n of o)if(n instanceof Lo){let r=typeof n.item.title=="string"?n.item.title:n.item.title.mnemonicTitle??n.item.title.value;e.push(ii({id:n.id,label:fj(r),class:n.class,enabled:n.enabled,run:async s=>{this.commandService.executeCommand(n.id,s)}}))}e.push(new ri)}return e.length&&e.pop(),e}getMenuBarOptions(){return{enableMnemonics:this.currentEnableMenuBarMnemonics,disableAltFocus:this.currentDisableMenuBarAltFocus,visibility:this.currentMenubarVisibility,actionRunner:this.actionRunner,getKeybinding:e=>this.keybindingService.lookupKeybinding(e.id),alwaysOnMnemonics:this.alwaysOnMnemonics,compactMode:this.currentCompactMenuMode,getCompactMenuActions:()=>Wt?this.getWebNavigationActions():[]}}onDidChangeWindowFocus(e){this.visible&&(super.onDidChangeWindowFocus(e),this.container&&(e?this.container.classList.remove("inactive"):(this.container.classList.add("inactive"),this.menubar?.blur())))}onUpdateStateChange(){this.visible&&super.onUpdateStateChange()}onDidChangeRecentlyOpened(){this.visible&&super.onDidChangeRecentlyOpened()}onUpdateKeybindings(){this.visible&&super.onUpdateKeybindings()}registerListeners(){super.registerListeners(),this._register(j(ut,re.RESIZE,()=>{this.menubar&&!(dc&&yg.pointerEvents)&&this.menubar.blur()})),Wt&&(this._register(YN(e=>{e===ut.vscodeWindowId&&this.updateMenubar()})),this._register(this.webNavigationMenu.onDidChange(()=>this.updateMenubar())),this._register(m9o().event(()=>this.menubar?.toggleFocus())))}get onVisibilityChange(){return this._onVisibilityChange.event}get onFocusStateChange(){return this._onFocusStateChange.event}getMenubarItemsDimensions(){return this.menubar?new si(this.menubar.getWidth(),this.menubar.getHeight()):new si(0,0)}create(e){return this.container=e,this.container&&this.doUpdateMenubar(!0),this.container}layout(e){this.menubar?.update(this.getMenuBarOptions())}toggleFocus(){this.menubar?.toggleFocus()}};pee=I([m(0,Kt),m(1,jp),m(2,X),m(3,_e),m(4,B),m(5,rt),m(6,zd),m(7,ce),m(8,Ne),m(9,Go),m(10,At),m(11,Oi),m(12,Te),m(13,Zt),m(14,ge)],pee);var bH="workbench.actions.manage",SH="workbench.actions.accounts";var O3=Ae("settings-view-bar-icon",R.settingsGear,d(18272,null)),ndo=[O3,R.vm,R.server,R.recordKeys,R.deviceMobile,R.watch,R.vr,R.piano,R.ruby,R.code,R.coffee,R.snake,R.project,R.window,R.library,R.extensions,R.terminal,R.terminalDebian,R.terminalLinux,R.terminalUbuntu,R.beaker,R.package,R.cloud,R.book,R.globe,R.database,R.notebook,R.robot,R.game,R.chip,R.music,R.remoteExplorer,R.github,R.azure,R.vscode,R.copilot,R.gift,R.send,R.bookmark,R.briefcase,R.megaphone,R.comment,R.telescope,R.creditCard,R.map,R.deviceCameraVideo,R.unmute,R.law,R.graphLine,R.heart,R.home,R.inbox,R.mortarBoard,R.rocket,R.magnet,R.lock,R.milestone,R.tag,R.pulse,R.radioTower,R.smiley,R.zap,R.squirrel,R.symbolColor,R.mail,R.key,R.pieChart,R.organization,R.preview,R.wand,R.starEmpty,R.lightbulb,R.symbolRuler,R.dashboard,R.calendar,R.shield,R.verified,R.debug,R.flame,R.compass,R.paintcan,R.archive,R.mic,R.jersey];var IH=class extends x{constructor(e,t,o,n,r,s,l){super();this.contextMenuActionsProvider=e;this.colors=t;this.activityHoverOptions=o;this.instantiationService=r;this.storageService=s;this.extensionService=l;this.globalActivityAction=this._register(new it(bH));this.accountAction=this._register(new it(SH));this.element=_("div");let c=()=>({anchorAlignment:n.getValue("workbench.sideBar.location")==="left"?1:0,anchorAxisAlignment:1});this.globalActivityActionBar=this._register(new Zi(this.element,{actionViewItemProvider:(u,p)=>{if(u.id===bH)return this.instantiationService.createInstance(IRe,this.contextMenuActionsProvider,{...p,colors:this.colors,hoverOptions:this.activityHoverOptions},c);if(u.id===SH)return this.instantiationService.createInstance(yH,this.contextMenuActionsProvider,{...p,colors:this.colors,hoverOptions:this.activityHoverOptions},c,h=>{h.unshift(ii({id:"hideAccounts",label:d(4344,null),run:()=>aVt(s,!1)}),new ri)});throw new Error(`No view item for action '${u.id}'`)},orientation:1,ariaLabel:d(4346,null),preventLoopNavigation:!0})),this.accountsVisibilityPreference&&this.globalActivityActionBar.push(this.accountAction,{index:IH.ACCOUNTS_ACTION_INDEX}),this.globalActivityActionBar.push(this.globalActivityAction),this.registerListeners()}static{this.ACCOUNTS_ACTION_INDEX=0}static{this.ACCOUNTS_ICON=Ae("accounts-view-bar-icon",R.account,d(4342,null))}registerListeners(){this.extensionService.whenInstalledExtensionsRegistered().then(()=>{this._store.isDisposed||this._register(this.storageService.onDidChangeValue(0,yH.ACCOUNTS_VISIBILITY_PREFERENCE_KEY,this._store)(()=>this.toggleAccountsActivity()))})}create(e){e.appendChild(this.element)}focus(){this.globalActivityActionBar.focus(!0)}size(){return this.globalActivityActionBar.viewItems.length}getContextMenuActions(){return[ii({id:"toggleAccountsVisibility",label:d(4341,null),checked:this.accountsVisibilityPreference,run:()=>this.accountsVisibilityPreference=!this.accountsVisibilityPreference})]}toggleAccountsActivity(){this.globalActivityActionBar.length()===2&&this.accountsVisibilityPreference||(this.globalActivityActionBar.length()===2?this.globalActivityActionBar.pull(IH.ACCOUNTS_ACTION_INDEX):this.globalActivityActionBar.push(this.accountAction,{index:IH.ACCOUNTS_ACTION_INDEX}))}get accountsVisibilityPreference(){return jJe(this.storageService)}set accountsVisibilityPreference(e){aVt(this.storageService,e)}};IH=I([m(3,B),m(4,F),m(5,ce),m(6,lt)],IH);var SRe=class extends PZ{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super(t,{draggable:!1,icon:!0,hasPopup:!0,...o},()=>!0,s,l,h,g);this.menuId=e;this.contextMenuActionsProvider=n;this.contextMenuAlignmentOptions=r;this.menuService=c;this.contextMenuService=u;this.contextKeyService=p;this.activityService=f;this.updateItemActivity(),this._register(this.activityService.onDidChangeActivity(v=>{Fe(v)&&v===this.compositeBarActionItem.id&&this.updateItemActivity()}))}updateItemActivity(){this.action.activities=this.activityService.getActivity(this.compositeBarActionItem.id)}render(e){super.render(e),this._register(j(this.container,re.MOUSE_DOWN,async t=>{Xt.stop(t,!0),t?.button!==2&&this.run()})),this._register(j(this.container,re.CONTEXT_MENU,async t=>{t.stopPropagation();let o=new N,n=await this.resolveContextMenuActions(o),r=new Cn(Re(this.container),t);this.contextMenuService.showContextMenu({getAnchor:()=>r,getActions:()=>n,onHide:()=>o.dispose()})})),this._register(j(this.container,re.KEY_UP,t=>{let o=new gi(t);(o.equals(3)||o.equals(10))&&(Xt.stop(t,!0),this.run())})),this._register(j(this.container,Kn.Tap,t=>{Xt.stop(t,!0),this.run()}))}async resolveContextMenuActions(e){return this.contextMenuActionsProvider()}async run(){let e=new N,t=e.add(this.menuService.createMenu(this.menuId,this.contextKeyService)),o=await this.resolveMainMenuActions(t,e),{anchorAlignment:n,anchorAxisAlignment:r}=this.contextMenuAlignmentOptions()??{anchorAlignment:void 0,anchorAxisAlignment:void 0};this.contextMenuService.showContextMenu({getAnchor:()=>this.label,anchorAlignment:n,anchorAxisAlignment:r,getActions:()=>o,onHide:()=>e.dispose(),menuActionOptions:{renderShortTitle:!0}})}async resolveMainMenuActions(e,t){return ml(e.getActions({renderShortTitle:!0})).secondary}};SRe=I([m(5,Le),m(6,nt),m(7,Kt),m(8,Xe),m(9,X),m(10,B),m(11,_e),m(12,Sl)],SRe);var yH=class extends SRe{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T){let P=k.createInstance(_2,{id:SH,name:d(4341,null),classNames:q.asClassNameArray(IH.ACCOUNTS_ICON)});super(D.AccountsContext,P,t,e,o,r,l,u,c,p,v,b,w);this.fillContextMenuActions=n;this.lifecycleService=s;this.authenticationService=h;this.productService=f;this.secretStorageService=S;this.logService=y;this.commandService=T;this.groupedAccounts=new Map;this.problematicProviders=new Set;this.initialized=!1;this.sessionFromEmbedder=new co(()=>bZ(this.secretStorageService,this.productService));this._register(P),this.registerListeners(),this.initialize()}static{this.ACCOUNTS_VISIBILITY_PREFERENCE_KEY="workbench.activity.showAccounts"}registerListeners(){this._register(this.authenticationService.onDidRegisterAuthenticationProvider(async e=>{await this.addAccountsFromProvider(e.id)})),this._register(this.authenticationService.onDidUnregisterAuthenticationProvider(e=>{this.groupedAccounts.delete(e.id),this.problematicProviders.delete(e.id)})),this._register(this.authenticationService.onDidChangeSessions(async e=>{if(e.event.removed)for(let t of e.event.removed)this.removeAccount(e.providerId,t.account);for(let t of[...e.event.changed??[],...e.event.added??[]])try{await this.addOrUpdateAccount(e.providerId,t.account)}catch(o){this.logService.error(o)}}))}async initialize(){if(await this.lifecycleService.when(3),this._store.isDisposed)return;let e=this._register(rf(Re(this.element),async()=>{await this.doInitialize(),e.dispose()}))}async doInitialize(){let e=this.authenticationService.getProviderIds(),t=await Promise.allSettled(e.map(o=>this.addAccountsFromProvider(o)));for(let o of t)o.status==="rejected"&&this.logService.error(o.reason);this.initialized=!0}async resolveMainMenuActions(e,t){await super.resolveMainMenuActions(e,t);let o=this.authenticationService.getProviderIds().filter(c=>!c.startsWith(oA)),n=e.getActions(),r=[],s=o.filter(c=>!this.authenticationService.isDynamicAuthenticationProvider(c)),l=o.filter(c=>this.authenticationService.isDynamicAuthenticationProvider(c));if(this.initialized){for(let c of s){let u=this.authenticationService.getProvider(c),p=this.groupedAccounts.get(c);if(!p){if(this.problematicProviders.has(c)){let g=t.add(new it("providerUnavailable",d(4343,null,u.label),void 0,!1));r.push(g);try{await this.addAccountsFromProvider(c)}catch(f){this.logService.error(f)}}continue}let h=!!u.authorizationServers?.length;for(let g of p){let v=[ii({id:`configureSessions${g.label}`,label:d(4349,null),enabled:!0,run:()=>this.commandService.executeCommand("_manageTrustedExtensionsForAccount",{providerId:c,accountLabel:g.label})})];if(h){let S=ii({id:`configureSessions${g.label}`,label:d(4350,null),enabled:!0,run:()=>this.commandService.executeCommand("_manageTrustedMCPServersForAccount",{providerId:c,accountLabel:g.label})});v.push(S)}g.canSignOut&&v.push(ii({id:"signOut",label:d(4351,null),enabled:!0,run:()=>this.commandService.executeCommand("_signOutOfAccount",{providerId:c,accountLabel:g.label})}));let b=new Fs("activitybar.submenu",`${g.label} (${u.label})`,v);r.push(b)}}l.length&&s.length&&r.push(new ri);for(let c of l){let u=this.authenticationService.getProvider(c),p=this.groupedAccounts.get(c),h=ii({id:"manageDynamicAuthProviders",label:d(4348,null),enabled:!0,run:()=>this.commandService.executeCommand("workbench.action.removeDynamicAuthenticationProviders")});if(!p){if(this.problematicProviders.has(c)){let g=t.add(new it("providerUnavailable",d(4343,null,u.label),void 0,!1));r.push(g);try{await this.addAccountsFromProvider(c)}catch(f){this.logService.error(f)}}r.push(h);continue}for(let g of p){let f=[],v=ii({id:`configureSessions${g.label}`,label:d(4350,null),enabled:!0,run:()=>this.commandService.executeCommand("_manageTrustedMCPServersForAccount",{providerId:c,accountLabel:g.label})});f.push(v),f.push(h),g.canSignOut&&f.push(ii({id:"signOut",label:d(4351,null),enabled:!0,run:()=>this.commandService.executeCommand("_signOutOfAccount",{providerId:c,accountLabel:g.label})}));let b=new Fs("activitybar.submenu",`${g.label} (${u.label})`,f);r.push(b)}}}else{let c=t.add(new it("noAccountsAvailable",d(4345,null),void 0,!1));r.push(c)}return r.length&&n.length&&r.push(new ri),n.forEach((c,u)=>{let p=c[1];r=r.concat(p),u!==n.length-1&&r.push(new ri)}),r}async resolveContextMenuActions(e){let t=await super.resolveContextMenuActions(e);return this.fillContextMenuActions(t),t}async addOrUpdateAccount(e,t){let o=this.groupedAccounts.get(e);o||(o=[],this.groupedAccounts.set(e,o));let n=await this.sessionFromEmbedder.value,r=!0;n&&!n.canSignOut&&(await this.authenticationService.getSessions(e)).some(l=>l.id===n.id&&l.account.id===t.id)&&(r=!1);let s=o.find(l=>l.label===t.label);s?r||(s.canSignOut=r):o.push({...t,canSignOut:r})}removeAccount(e,t){let o=this.groupedAccounts.get(e);if(!o)return;let n=o.findIndex(r=>r.id===t.id);n!==-1&&(o.splice(n,1),o.length===0&&this.groupedAccounts.delete(e))}async addAccountsFromProvider(e){try{let t=await this.authenticationService.getSessions(e);this.problematicProviders.delete(e);for(let o of t)try{await this.addOrUpdateAccount(e,o.account)}catch(n){this.logService.error(n)}}catch(t){this.logService.error(t),this.problematicProviders.add(e)}}};yH=I([m(4,Le),m(5,ji),m(6,nt),m(7,Xe),m(8,Kt),m(9,X),m(10,xs),m(11,At),m(12,tt),m(13,B),m(14,_e),m(15,Dw),m(16,se),m(17,Sl),m(18,F),m(19,ge)],yH);var IRe=class extends SRe{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){let b=f.createInstance(_2,{id:bH,name:d(4346,null),classNames:q.asClassNameArray(n.currentProfile.icon?q.fromId(n.currentProfile.icon):O3)});super(D.GlobalActivity,b,t,e,o,r,s,l,c,u,p,g,v);this.userDataProfileService=n;this._register(b),this._register(this.userDataProfileService.onDidChangeCurrentProfile(S=>{b.compositeBarActionItem={...b.compositeBarActionItem,classNames:q.asClassNameArray(n.currentProfile.icon?q.fromId(n.currentProfile.icon):O3)}}))}render(e){super.render(e),this.profileBadge=M(e,_(".profile-badge")),this.profileBadgeContent=M(this.profileBadge,_(".profile-badge-content")),this.updateProfileBadge()}updateProfileBadge(){!this.profileBadge||!this.profileBadgeContent||(Rt(this.profileBadgeContent),vo(this.profileBadge),!this.userDataProfileService.currentProfile.isDefault&&(this.userDataProfileService.currentProfile.icon&&this.userDataProfileService.currentProfile.icon!==O3.id||this.action.activities.length>0||(un(this.profileBadge),this.profileBadgeContent.classList.add("profile-text-overlay"),this.profileBadgeContent.textContent=this.userDataProfileService.currentProfile.name.substring(0,2).toUpperCase())))}updateActivity(){super.updateActivity(),this.updateProfileBadge()}computeTitle(){return this.userDataProfileService.currentProfile.isDefault?super.computeTitle():d(4347,null,this.userDataProfileService.currentProfile.name)}};IRe=I([m(3,ln),m(4,Le),m(5,nt),m(6,Kt),m(7,Xe),m(8,X),m(9,B),m(10,At),m(11,_e),m(12,F),m(13,Sl)],IRe);var yRe=class extends yH{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w){super(()=>rdo(v,!0),{...e,colors:k=>({badgeBackground:k.getColor(xF),badgeForeground:k.getColor(kF)}),hoverOptions:i,compact:!0},()=>{},k=>k,t,o,n,r,s,l,c,u,p,h,g,f,b,S,y,w)}};yRe=I([m(2,Le),m(3,ji),m(4,nt),m(5,Xe),m(6,Kt),m(7,X),m(8,xs),m(9,At),m(10,tt),m(11,B),m(12,_e),m(13,Dw),m(14,ce),m(15,se),m(16,Sl),m(17,F),m(18,ge)],yRe);var wRe=class extends IRe{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f){super(()=>rdo(f,!1),{...e,colors:v=>({badgeBackground:v.getColor(xF),badgeForeground:v.getColor(kF)}),hoverOptions:i,compact:!0},()=>{},t,o,n,r,s,l,c,u,p,h,g)}};wRe=I([m(2,ln),m(3,Le),m(4,nt),m(5,Kt),m(6,Xe),m(7,X),m(8,B),m(9,At),m(10,_e),m(11,F),m(12,Sl),m(13,ce)],wRe);function rdo(a,i){let e=[];return i&&e.push(ii({id:"hideAccounts",label:d(4344,null),run:()=>aVt(a,!1)}),new ri),[...e,ii({id:"toggle.hideAccounts",label:d(4341,null),checked:jJe(a),run:()=>aVt(a,!jJe(a))}),ii({id:"toggle.hideManage",label:d(4346,null),checked:!0,enabled:!1,run:()=>{throw new Error('"Manage" can not be hidden')}})]}function jJe(a){return a.getBoolean(yH.ACCOUNTS_VISIBILITY_PREFERENCE_KEY,0,!0)}function aVt(a,i){a.store(yH.ACCOUNTS_VISIBILITY_PREFERENCE_KEY,i,0,0)}var rv=class extends RT{constructor(e,t,o,n,r,s,l){super("workbench.parts.activitybar",{hasTitle:!1},r,s,n);this.location=e;this.paneCompositePart=t;this.instantiationService=o;this.configurationService=l;this.minimumHeight=0;this.maximumHeight=Number.POSITIVE_INFINITY;this.compositeBar=this._register(new me);this._isCompact=this.configurationService.getValue("workbench.activityBar.compact")??!1,this._register(this.configurationService.onDidChangeConfiguration(c=>{c.affectsConfiguration("workbench.activityBar.compact")&&(this._isCompact=this.configurationService.getValue("workbench.activityBar.compact")??!1,this.updateCompactStyle(),this.recreateCompositeBar(),this._onDidChange.fire(void 0))}))}static{this.ACTION_HEIGHT=48}static{this.COMPACT_ACTION_HEIGHT=32}static{this.ACTIVITYBAR_WIDTH=48}static{this.COMPACT_ACTIVITYBAR_WIDTH=36}static{this.ICON_SIZE=24}static{this.COMPACT_ICON_SIZE=16}static{this.pinnedViewContainersKey="workbench.activity.pinnedViewlets2"}static{this.placeholderViewContainersKey="workbench.activity.placeholderViewlets"}static{this.viewContainersWorkspaceStateKey="workbench.activity.viewletsWorkspaceState"}get minimumWidth(){return this._isCompact?rv.COMPACT_ACTIVITYBAR_WIDTH:rv.ACTIVITYBAR_WIDTH}get maximumWidth(){return this._isCompact?rv.COMPACT_ACTIVITYBAR_WIDTH:rv.ACTIVITYBAR_WIDTH}updateCompactStyle(){this.element&&(this.element.classList.toggle("compact",this._isCompact),this.element.style.setProperty("--activity-bar-width",`${this.minimumWidth}px`),this.element.style.setProperty("--activity-bar-action-height",`${this._isCompact?rv.COMPACT_ACTION_HEIGHT:rv.ACTION_HEIGHT}px`),this.element.style.setProperty("--activity-bar-icon-size",`${this._isCompact?rv.COMPACT_ICON_SIZE:rv.ICON_SIZE}px`))}recreateCompositeBar(){!this.content||!this.compositeBar.value||(this.compositeBar.clear(),Rt(this.content),this.compositeBar.value=this.createCompositeBar(),this.compositeBar.value.create(this.content),this.dimension&&this.layout(this.dimension.width,this.dimension.height))}createCompositeBar(){let e=this._isCompact?rv.COMPACT_ACTION_HEIGHT:rv.ACTION_HEIGHT,t=this._isCompact?rv.COMPACT_ICON_SIZE:rv.ICON_SIZE;return this.instantiationService.createInstance(tme,this.location,{partContainerClass:"activitybar",pinnedViewContainersKey:rv.pinnedViewContainersKey,placeholderViewContainersKey:rv.placeholderViewContainersKey,viewContainersWorkspaceStateKey:rv.viewContainersWorkspaceStateKey,orientation:1,icon:!0,iconSize:t,activityHoverOptions:{position:()=>this.layoutService.getSideBarPosition()===0?1:0},preventLoopNavigation:!0,recomputeSizes:!1,fillExtraContextMenuActions:(o,n)=>{},compositeSize:52,colors:o=>({activeForegroundColor:o.getColor(yK),inactiveForegroundColor:o.getColor(IZi),activeBorderColor:o.getColor(Hmi),activeBackground:o.getColor(Umi),badgeBackground:o.getColor(xF),badgeForeground:o.getColor(kF),dragAndDropBorder:o.getColor(wZi),activeBackgroundColor:void 0,inactiveBackgroundColor:void 0,activeBorderBottomColor:void 0}),overflowActionSize:e},"workbench.parts.activitybar",this.paneCompositePart,!0)}createContentArea(e){return this.element=e,this.content=M(this.element,_(".content")),this.updateCompactStyle(),this.layoutService.isVisible("workbench.parts.activitybar")&&this.show(),this.content}getPinnedPaneCompositeIds(){return this.compositeBar.value?.getPinnedPaneCompositeIds()??[]}getVisiblePaneCompositeIds(){return this.compositeBar.value?.getVisiblePaneCompositeIds()??[]}getPaneCompositeIds(){return this.compositeBar.value?.getPaneCompositeIds()??[]}focus(){this.compositeBar.value?.focus()}updateStyles(){super.updateStyles();let e=Ci(this.getContainer()),t=this.getColor(iDt)||"";e.style.backgroundColor=t;let o=this.getColor(oDt)||this.getColor(bi)||"";e.classList.toggle("bordered",!!o),e.style.borderColor=o||""}show(e){this.content&&(this.compositeBar.value||(this.compositeBar.value=this.createCompositeBar(),this.compositeBar.value.create(this.content),this.dimension&&this.layout(this.dimension.width,this.dimension.height)),e&&this.focus())}hide(){this.compositeBar.value&&(this.compositeBar.clear(),this.content&&Rt(this.content))}layout(e,t){if(super.layout(e,t,0,0),!this.compositeBar.value)return;let o=super.layoutContents(e,t).contentSize;this.compositeBar.value.layout(e,o.height)}toJSON(){return{type:"workbench.parts.activitybar"}}};rv=I([m(2,F),m(3,yi),m(4,Le),m(5,ce),m(6,B)],rv);var tme=class extends cee{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super(e,{...t,fillExtraContextMenuActions:(S,y)=>{t.fillExtraContextMenuActions(S,y),this.fillContextMenuActions(S,y)}},o,n,s,l,c,u,p,h,g,b);this.configurationService=f;this.menuService=v;this.menuBar=this._register(new me);this.keyboardNavigationDisposables=this._register(new N);r&&(this.globalCompositeBar=this._register(s.createInstance(IH,()=>this.getContextMenuActions(),S=>this.options.colors(S),this.options.activityHoverOptions))),this._register(this.configurationService.onDidChangeConfiguration(S=>{S.affectsConfiguration("window.menuBarVisibility")&&(uR(this.configurationService)==="compact"?this.installMenubar():this.uninstallMenubar())}))}fillContextMenuActions(e,t){let o=uR(this.configurationService);(o==="compact"||o==="hidden"||o==="toggle")&&e.unshift(ii({id:"toggleMenuVisibility",label:d(3800,null),checked:o==="compact",run:()=>this.configurationService.updateValue("window.menuBarVisibility",o==="compact"?"toggle":"compact")}),new ri),o==="compact"&&this.menuBarContainer&&t?.target&&ts(t.target,this.menuBarContainer)&&e.unshift(ii({id:"hideCompactMenu",label:d(3799,null),run:()=>this.configurationService.updateValue("window.menuBarVisibility","toggle")}),new ri),this.globalCompositeBar&&(e.push(new ri),e.push(...this.globalCompositeBar.getContextMenuActions())),e.push(new ri),e.push(...this.getActivityBarContextMenuActions())}uninstallMenubar(){this.menuBar.value&&(this.menuBar.value=void 0),this.menuBarContainer&&(this.menuBarContainer.remove(),this.menuBarContainer=void 0)}installMenubar(){if(this.menuBar.value)return;this.menuBarContainer=_(".menubar"),Ci(this.element).prepend(this.menuBarContainer),this.menuBar.value=this._register(this.instantiationService.createInstance(pee)),this.menuBar.value.create(this.menuBarContainer)}registerKeyboardNavigationListeners(){this.keyboardNavigationDisposables.clear(),this.menuBarContainer&&this.keyboardNavigationDisposables.add(j(this.menuBarContainer,re.KEY_DOWN,e=>{let t=new gi(e);(t.equals(18)||t.equals(17))&&this.focus()})),this.compositeBarContainer&&this.keyboardNavigationDisposables.add(j(this.compositeBarContainer,re.KEY_DOWN,e=>{let t=new gi(e);t.equals(18)||t.equals(17)?this.globalCompositeBar?.focus():(t.equals(16)||t.equals(15))&&this.menuBar.value?.toggleFocus()})),this.globalCompositeBar&&this.keyboardNavigationDisposables.add(j(this.globalCompositeBar.element,re.KEY_DOWN,e=>{let t=new gi(e);(t.equals(16)||t.equals(15))&&this.focus(this.getVisiblePaneCompositeIds().length-1)}))}create(e){return this.element=e,uR(this.configurationService)==="compact"&&this.installMenubar(),this.compositeBarContainer=super.create(this.element),this.globalCompositeBar&&this.globalCompositeBar.create(this.element),this.registerKeyboardNavigationListeners(),this.compositeBarContainer}layout(e,t){this.menuBarContainer&&(this.options.orientation===1?t-=this.menuBarContainer.clientHeight:e-=this.menuBarContainer.clientWidth),this.globalCompositeBar&&(this.options.orientation===1?t-=this.globalCompositeBar.size()*this.options.overflowActionSize:e-=this.globalCompositeBar.element.clientWidth),super.layout(e,t)}getActivityBarContextMenuActions(){let e=this.menuService.getMenuActions(D.ActivityBarPositionMenu,this.contextKeyService,{shouldForwardArgs:!0,renderShortTitle:!0}),t=zp(e).secondary,o=[new Fs("workbench.action.activityBar.position",d(3790,null),t)];if(this.configurationService.getValue("workbench.activityBar.location")==="default"){let r=this.configurationService.getValue("workbench.activityBar.compact")??!1,s=[ii({id:"workbench.action.activityBar.size.default",label:d(3793,null),checked:!r,run:()=>this.configurationService.updateValue("workbench.activityBar.compact",!1)}),ii({id:"workbench.action.activityBar.size.compact",label:d(3792,null),checked:r,run:()=>this.configurationService.updateValue("workbench.activityBar.compact",!0)})];o.push(new Fs("workbench.action.activityBar.size",d(3791,null),s))}return o.push(ii({id:kT.ID,label:kT.getLabel(this.layoutService),run:()=>this.instantiationService.invokeFunction(r=>new kT().run(r))})),this.part==="workbench.parts.sidebar"&&o.push(ii({id:aH.ID,label:aH.LABEL,run:()=>this.instantiationService.invokeFunction(r=>new aH().run(r))})),o}};tme=I([m(5,F),m(6,ce),m(7,lt),m(8,Bi),m(9,$t),m(10,X),m(11,At),m(12,B),m(13,Kt),m(14,yi)],tme);W(class extends K{constructor(){super({id:"workbench.action.activityBarLocation.default",title:{...L(3808,"Move Activity Bar to Side"),mnemonicTitle:d(3802,null)},shortTitle:d(3795,null),category:Ve.View,toggled:C.equals("config.workbench.activityBar.location","default"),menu:[{id:D.ActivityBarPositionMenu,order:1},{id:D.CommandPalette,when:C.notEquals("config.workbench.activityBar.location","default")}]})}run(a){a.get(B).updateValue("workbench.activityBar.location","default")}});W(class extends K{constructor(){super({id:"workbench.action.activityBarLocation.top",title:{...L(3809,"Move Activity Bar to Top"),mnemonicTitle:d(3804,null)},shortTitle:d(3811,null),category:Ve.View,toggled:C.equals("config.workbench.activityBar.location","top"),menu:[{id:D.ActivityBarPositionMenu,order:2},{id:D.CommandPalette,when:C.notEquals("config.workbench.activityBar.location","top")}]})}run(a){a.get(B).updateValue("workbench.activityBar.location","top")}});W(class extends K{constructor(){super({id:"workbench.action.activityBarLocation.bottom",title:{...L(3807,"Move Activity Bar to Bottom"),mnemonicTitle:d(3801,null)},shortTitle:d(3794,null),category:Ve.View,toggled:C.equals("config.workbench.activityBar.location","bottom"),menu:[{id:D.ActivityBarPositionMenu,order:3},{id:D.CommandPalette,when:C.notEquals("config.workbench.activityBar.location","bottom")}]})}run(a){a.get(B).updateValue("workbench.activityBar.location","bottom")}});W(class extends K{constructor(){super({id:"workbench.action.activityBarLocation.hide",title:{...L(3798,"Hide Activity Bar"),mnemonicTitle:d(3803,null)},shortTitle:d(3797,null),category:Ve.View,toggled:C.equals("config.workbench.activityBar.location","hidden"),menu:[{id:D.ActivityBarPositionMenu,order:4},{id:D.CommandPalette,when:C.notEquals("config.workbench.activityBar.location","hidden")}]})}run(a){a.get(B).updateValue("workbench.activityBar.location","hidden")}});ve.appendMenuItem(D.MenubarAppearanceMenu,{submenu:D.ActivityBarPositionMenu,title:d(3806,null),group:"3_workbench_layout_move",order:2});ve.appendMenuItem(D.ViewContainerTitleContext,{submenu:D.ActivityBarPositionMenu,title:d(3806,null),when:C.or(C.equals("viewContainerLocation",Pw(0)),C.equals("viewContainerLocation",Pw(2))),group:"3_workbench_layout_move",order:1});W(class extends rH{constructor(){super({id:"workbench.action.previousSideBarView",title:L(3810,"Previous Primary Side Bar View"),category:Ve.View,f1:!0},0,-1)}});W(class extends rH{constructor(){super({id:"workbench.action.nextSideBarView",title:L(3805,"Next Primary Side Bar View"),category:Ve.View,f1:!0},0,1)}});W(class extends K{constructor(){super({id:"workbench.action.focusActivityBar",title:L(3796,"Focus Activity Bar"),category:Ve.View,f1:!0})}async run(i){i.get(yi).focusPart("workbench.parts.activitybar")}});is((a,i)=>{let e=a.getColor(Hmi);e&&i.addRule(`
			.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item.checked .active-item-indicator:before {
				border-left-color: ${e};
			}
		`);let t=a.getColor(yZi);t&&i.addRule(`
			.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item.checked:focus::before {
				visibility: hidden;
			}

			.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item.checked:focus .active-item-indicator:before {
				visibility: visible;
				border-left-color: ${t};
			}
		`);let o=a.getColor(Umi);o&&i.addRule(`
			.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item.checked .active-item-indicator {
				z-index: 0;
				background-color: ${o};
			}
		`);let n=a.getColor(Ys);if(n)i.addRule(`
			.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item .action-label::before{
				padding: 6px;
			}

			.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item.active .action-label::before,
			.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item.active:hover .action-label::before,
			.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item.checked .action-label::before,
			.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item.checked:hover .action-label::before {
				outline: 1px solid ${n};
			}

			.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item:hover .action-label::before {
				outline: 1px dashed ${n};
			}

			.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item:focus .active-item-indicator:before {
				border-left-color: ${n};
			}
		`);else{let r=a.getColor(Sd);r&&i.addRule(`
				.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item:focus .active-item-indicator::before {
						border-left-color: ${r};
					}
				`)}});var q2=class extends _0{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super("workbench.parts.sidebar",{hasTitle:!0,trailingSeparator:!1,borderWidth:()=>this.getColor(wK)||this.getColor(bi)?1:0},q2.activeViewletSettingsKey,weo.bindTo(p),kB.bindTo(p),"sideBar","viewlet",NZi,uDt,0,S0.Viewlets,D.SidebarTitle,void 0,e,t,o,n,r,s,l,c,u,p,h,f);this.configurationService=g;this.minimumWidth=170;this.maximumWidth=Number.POSITIVE_INFINITY;this.minimumHeight=0;this.maximumHeight=Number.POSITIVE_INFINITY;this.priority=1;this.activityBarPart=this._register(this.instantiationService.createInstance(rv,this.location,this));this.visibleViewContainersTracker=this._register(l.createInstance(uee,0)),this._register(this.visibleViewContainersTracker.onDidChange(v=>this.onDidChangeAutoHideViewContainers(v))),this.rememberActivityBarVisiblePosition(),this._register(g.onDidChangeConfiguration(v=>{v.affectsConfiguration("workbench.activityBar.location")&&this.onDidChangeActivityBarLocation(),v.affectsConfiguration("workbench.activityBar.autoHide")&&this.onDidChangeActivityBarLocation()})),this.registerActions()}static{this.activeViewletSettingsKey="workbench.sidebar.activeviewletid"}get snap(){return!0}get preferredWidth(){let e=this.getActivePaneComposite();if(!e)return;let t=e.getOptimalWidth();if(typeof t=="number")return Math.max(t,300)}onDidChangeAutoHideViewContainers(e){let t=this.configurationService.getValue("workbench.activityBar.location");if(this.configurationService.getValue("workbench.activityBar.autoHide")&&(t==="top"||t==="bottom")){let n=e.before>1,r=e.after>1;n!==r&&this.onDidChangeActivityBarLocation()}}onDidChangeActivityBarLocation(){this.activityBarPart.hide(),this.updateCompositeBar();let e=this.getActiveComposite()?.getId();e&&this.onTitleAreaUpdate(e),this.shouldShowActivityBar()&&this.activityBarPart.show(),this.rememberActivityBarVisiblePosition()}updateStyles(){super.updateStyles();let e=Ci(this.getContainer());e.style.backgroundColor=this.getColor(bf)||"",e.style.color=this.getColor(CK)||"";let t=this.getColor(wK)||this.getColor(bi),o=this.layoutService.getSideBarPosition()===0;e.style.borderRightWidth=t&&o?"1px":"",e.style.borderRightStyle=t&&o?"solid":"",e.style.borderRightColor=o&&t||"",e.style.borderLeftWidth=t&&!o?"1px":"",e.style.borderLeftStyle=t&&!o?"solid":"",e.style.borderLeftColor=o?"":t||"",e.style.outlineColor=this.getColor(j5)??""}layout(e,t,o,n){this.layoutService.isVisible("workbench.parts.sidebar")&&super.layout(e,t,o,n)}getTitleAreaDropDownAnchorAlignment(){return this.layoutService.getSideBarPosition()===0?0:1}createCompositeBar(){return this.instantiationService.createInstance(tme,0,this.getCompositeBarOptions(),this.partId,this,!1)}getCompositeBarOptions(){return{partContainerClass:"sidebar",pinnedViewContainersKey:rv.pinnedViewContainersKey,placeholderViewContainersKey:rv.placeholderViewContainersKey,viewContainersWorkspaceStateKey:rv.viewContainersWorkspaceStateKey,icon:!0,orientation:0,recomputeSizes:!0,activityHoverOptions:{position:()=>this.getCompositeBarPosition()===2?3:2},fillExtraContextMenuActions:e=>{if(this.getCompositeBarPosition()===1){let t=this.getViewsSubmenuAction();t&&(e.push(new ri),e.push(t))}},compositeSize:0,iconSize:16,overflowActionSize:30,colors:e=>({activeBackgroundColor:e.getColor(bf),inactiveBackgroundColor:e.getColor(bf),activeBorderBottomColor:e.getColor(nDt),activeForegroundColor:e.getColor(q5),inactiveForegroundColor:e.getColor(rDt),badgeBackground:e.getColor(xF),badgeForeground:e.getColor(kF),dragAndDropBorder:e.getColor(sDt)}),compact:!0}}shouldShowCompositeBar(){let e=this.configurationService.getValue("workbench.activityBar.location");return!(e!=="top"&&e!=="bottom"||this.configurationService.getValue("workbench.activityBar.autoHide")&&this.visibleViewContainersTracker.visibleCount<=1)}shouldShowActivityBar(){return this.shouldShowCompositeBar()?!1:this.configurationService.getValue("workbench.activityBar.location")!=="hidden"}getCompositeBarPosition(){switch(this.configurationService.getValue("workbench.activityBar.location")){case"top":return 0;case"bottom":return 2;case"hidden":case"default":default:return 1}}rememberActivityBarVisiblePosition(){let e=this.configurationService.getValue("workbench.activityBar.location");e!=="hidden"&&this.storageService.store("workbench.activityBar.location",e,0,0)}getRememberedActivityBarVisiblePosition(){switch(this.storageService.get("workbench.activityBar.location",0)){case"top":return"top";case"bottom":return"bottom";default:return"default"}}getPinnedPaneCompositeIds(){return this.shouldShowCompositeBar()?super.getPinnedPaneCompositeIds():this.activityBarPart.getPinnedPaneCompositeIds()}getVisiblePaneCompositeIds(){return this.shouldShowCompositeBar()?super.getVisiblePaneCompositeIds():this.activityBarPart.getVisiblePaneCompositeIds()}getPaneCompositeIds(){return this.shouldShowCompositeBar()?super.getPaneCompositeIds():this.activityBarPart.getPaneCompositeIds()}async focusActivityBar(){this.configurationService.getValue("workbench.activityBar.location")==="hidden"&&(await this.configurationService.updateValue("workbench.activityBar.location",this.getRememberedActivityBarVisiblePosition()),this.onDidChangeActivityBarLocation()),this.shouldShowCompositeBar()?this.focusCompositeBar():(this.layoutService.isVisible("workbench.parts.activitybar")||this.layoutService.setPartHidden(!1,"workbench.parts.activitybar"),this.activityBarPart.show(!0))}registerActions(){let e=this;this._register(W(class extends K{constructor(){super({id:$Ii,title:L(4478,"Toggle Activity Bar Visibility")})}run(){let t=e.configurationService.getValue("workbench.activityBar.location")==="hidden"?e.getRememberedActivityBarVisiblePosition():"hidden";return e.configurationService.updateValue("workbench.activityBar.location",t)}}))}toJSON(){return{type:"workbench.parts.sidebar"}}};q2=I([m(0,Ne),m(1,ce),m(2,Xe),m(3,yi),m(4,_e),m(5,nt),m(6,F),m(7,Le),m(8,Bi),m(9,X),m(10,lt),m(11,B),m(12,Kt)],q2);var QJe=class extends x{constructor(e){super();this.paneCompositeParts=new Map;let t=e.createInstance(G2),o=e.createInstance(q2),n=e.createInstance(VA);this.paneCompositeParts.set(1,t),this.paneCompositeParts.set(0,o),this.paneCompositeParts.set(2,n);let r=[0,1,2],s=this._register(new N);this.onDidPaneCompositeOpen=U.any(...r.map(l=>U.map(this.paneCompositeParts.get(l).onDidPaneCompositeOpen,c=>({composite:c,viewContainerLocation:l}),s))),this.onDidPaneCompositeClose=U.any(...r.map(l=>U.map(this.paneCompositeParts.get(l).onDidPaneCompositeClose,c=>({composite:c,viewContainerLocation:l}),s)))}getRegistryId(e){return this.getPartByLocation(e).registryId}getPartId(e){return this.getPartByLocation(e).partId}openPaneComposite(e,t,o){return this.getPartByLocation(t).openPaneComposite(e,o)}getActivePaneComposite(e){return this.getPartByLocation(e).getActivePaneComposite()}getPaneComposite(e,t){return this.getPartByLocation(t).getPaneComposite(e)}getPaneComposites(e){return this.getPartByLocation(e).getPaneComposites()}getPinnedPaneCompositeIds(e){return this.getPartByLocation(e).getPinnedPaneCompositeIds()}getVisiblePaneCompositeIds(e){return this.getPartByLocation(e).getVisiblePaneCompositeIds()}getPaneCompositeIds(e){return this.getPartByLocation(e).getPaneCompositeIds()}getProgressIndicator(e,t){return this.getPartByLocation(t).getProgressIndicator(e)}hideActivePaneComposite(e){this.getPartByLocation(e).hideActivePaneComposite()}getLastActivePaneCompositeId(e){return this.getPartByLocation(e).getLastActivePaneCompositeId()}getPartByLocation(e){return Ci(this.paneCompositeParts.get(e))}};QJe=I([m(0,F)],QJe);Ee(us,QJe,1);var FD=le("bannerService");var YJe=class extends RT{constructor(e,t,o,n,r,s){super("workbench.parts.banner",{hasTitle:!1},e,o,t);this.contextKeyService=n;this.instantiationService=r;this.markdownRendererService=s;this.height=26;this.minimumWidth=0;this.maximumWidth=Number.POSITIVE_INFINITY;this._onDidChangeSize=this._register(new E);this.visible=!1;this.focusedActionIndex=-1}get minimumHeight(){return this.visible?this.height:0}get maximumHeight(){return this.visible?this.height:0}get onDidChange(){return this._onDidChangeSize.event}createContentArea(e){this.element=e,this.element.tabIndex=0,this._register(j(this.element,re.FOCUS,()=>{this.focusedActionIndex!==-1&&this.focusActionLink()}));let t=this._register(this.contextKeyService.createScoped(this.element));return D6e.bindTo(t).set(!0),this.element}close(e){this.setVisibility(!1),Rt(this.element),typeof e.onClose=="function"&&e.onClose(),this.item=void 0}focusActionLink(){let e=this.item?.actions?.length??0;if(this.focusedActionIndex<e){let t=this.messageActionsContainer?.children[this.focusedActionIndex];Do(t)&&(this.actionBar?.setFocusable(!1),t.focus())}else this.actionBar?.focus(0)}getAriaLabel(e){if(e.ariaLabel)return e.ariaLabel;if(typeof e.message=="string")return e.message}getBannerMessage(e){if(typeof e=="string"){let t=_("span");return t.textContent=e,t}return this.markdownRendererService.render(e).element}setVisibility(e){e!==this.visible&&(this.visible=e,this.focusedActionIndex=-1,this.layoutService.setPartHidden(!e,"workbench.parts.banner"),this._onDidChangeSize.fire(void 0))}focus(){this.focusedActionIndex=-1,this.element.focus()}focusNextAction(){let e=this.item?.actions?.length??0;this.focusedActionIndex=this.focusedActionIndex<e?this.focusedActionIndex+1:0,this.focusActionLink()}focusPreviousAction(){let e=this.item?.actions?.length??0;this.focusedActionIndex=this.focusedActionIndex>0?this.focusedActionIndex-1:e,this.focusActionLink()}hide(e){this.item?.id===e&&this.setVisibility(!1)}show(e){if(e.id===this.item?.id){this.setVisibility(!0);return}Rt(this.element);let t=this.getAriaLabel(e);t&&this.element.setAttribute("aria-label",t);let o=M(this.element,_("div.icon-container"));o.setAttribute("aria-hidden","true"),q.isThemeIcon(e.icon)?o.appendChild(_(`div${q.asCSSSelector(e.icon)}`)):(o.classList.add("custom-icon"),A.isUri(e.icon)&&(o.style.backgroundImage=Qa(e.icon)));let n=M(this.element,_("div.message-container"));if(n.setAttribute("aria-hidden","true"),n.appendChild(this.getBannerMessage(e.message)),this.messageActionsContainer=M(this.element,_("div.message-actions-container")),e.actions)for(let c of e.actions)this._register(this.instantiationService.createInstance(rg,this.messageActionsContainer,{...c,tabIndex:-1},{}));let r=M(this.element,_("div.action-container"));this.actionBar=this._register(new Zi(r));let s=e.closeLabel??d(3842,null),l=this._register(new it("banner.close",s,q.asClassName(PE),!0,()=>this.close(e)));this.actionBar.push(l,{icon:!0,label:!1}),this.actionBar.setFocusable(!1),this.setVisibility(!0),this.item=e}toJSON(){return{type:"workbench.parts.banner"}}};YJe=I([m(0,Le),m(1,yi),m(2,ce),m(3,X),m(4,F),m(5,On)],YJe);Ee(FD,YJe,0);Ct.registerCommandAndKeybindingRule({id:"workbench.banner.focusBanner",weight:200,primary:9,when:D6e,handler:a=>{a.get(FD).focus()}});Ct.registerCommandAndKeybindingRule({id:"workbench.banner.focusNextAction",weight:200,primary:17,secondary:[18],when:D6e,handler:a=>{a.get(FD).focusNextAction()}});Ct.registerCommandAndKeybindingRule({id:"workbench.banner.focusPreviousAction",weight:200,primary:15,secondary:[16],when:D6e,handler:a=>{a.get(FD).focusPreviousAction()}});var Zwi=class a extends K{static{this.ID="workbench.action.focusBanner"}static{this.LABEL=L(3843,"Focus Banner")}constructor(){super({id:a.ID,title:a.LABEL,category:Ve.View,f1:!0})}async run(i){i.get(yi).focusPart("workbench.parts.banner")}};W(Zwi);var lVt=class extends it{constructor(e,t,o){super(e,t,void 0,!0);this.model=o;this.checked=!o.isHidden(e)}async run(){this.model.isHidden(this.id)?this.model.show(this.id):this.model.hide(this.id)}},cVt=class extends it{constructor(e,t,o){super(e,d(4480,null,t),void 0,!0);this.model=o}async run(){this.model.hide(this.id)}},CRe=class extends it{constructor(e,t){super("statusbar.manage.extension",d(4481,null));this.extensionId=e;this.commandService=t}run(){return this.commandService.executeCommand("_extensions.manage",this.extensionId)}};CRe=I([m(1,ge)],CRe);Ct.registerCommandAndKeybindingRule({id:"workbench.statusBar.focusPrevious",weight:200,primary:15,secondary:[16],when:KX,handler:a=>{a.get(kr).focusPreviousEntry()}});Ct.registerCommandAndKeybindingRule({id:"workbench.statusBar.focusNext",weight:200,primary:17,secondary:[18],when:KX,handler:a=>{a.get(kr).focusNextEntry()}});Ct.registerCommandAndKeybindingRule({id:"workbench.statusBar.focusFirst",weight:200,primary:14,when:KX,handler:a=>{let i=a.get(kr);i.focus(!1),i.focusNextEntry()}});Ct.registerCommandAndKeybindingRule({id:"workbench.statusBar.focusLast",weight:200,primary:13,when:KX,handler:a=>{let i=a.get(kr);i.focus(!1),i.focusPreviousEntry()}});Ct.registerCommandAndKeybindingRule({id:"workbench.statusBar.clearFocus",weight:200,primary:9,when:KX,handler:a=>{let i=a.get(kr),e=a.get(ee);i.isEntryFocused()?i.focus(!1):e.activeEditorPane&&e.activeEditorPane.focus()}});var eCi=class extends K{constructor(){super({id:"workbench.action.focusStatusBar",title:L(4479,"Focus Status Bar"),category:Ve.View,f1:!0})}async run(i){i.get(yi).focusPart("workbench.parts.statusbar",Ki())}};W(eCi);var dVt=class a extends x{constructor(e){super();this.storageService=e;this._onDidChangeEntryVisibility=this._register(new E);this.onDidChangeEntryVisibility=this._onDidChangeEntryVisibility.event;this._entries=[];this.hidden=new Set;this.restoreState(),this.registerListeners()}static{this.HIDDEN_ENTRIES_KEY="workbench.statusbar.hidden"}get entries(){return this._entries.slice(0)}get lastFocusedEntry(){return this._lastFocusedEntry&&!this.isHidden(this._lastFocusedEntry.id)?this._lastFocusedEntry:void 0}restoreState(){let e=this.storageService.get(a.HIDDEN_ENTRIES_KEY,0);if(e)try{this.hidden=new Set(JSON.parse(e))}catch{}}registerListeners(){this._register(this.storageService.onDidChangeValue(0,a.HIDDEN_ENTRIES_KEY,this._store)(()=>this.onDidStorageValueChange()))}onDidStorageValueChange(){let e=new Set(this.hidden);this.hidden.clear(),this.restoreState();let t=new Set;for(let o of e)this.hidden.has(o)||t.add(o);for(let o of this.hidden)e.has(o)||t.add(o);if(t.size>0)for(let o of this._entries)t.has(o.id)&&(this.updateVisibility(o.id,!0),t.delete(o.id))}add(e){this._entries.push(e),this.updateVisibility(e,!1),this.sort(),this.markFirstLastVisibleEntry()}remove(e){let t=this._entries.indexOf(e);t>=0&&(this._entries.splice(t,1),this._entries.some(o=>Tde(o.priority.primary)&&o.priority.primary.location.id===e.id)&&this.sort(),this.markFirstLastVisibleEntry())}isHidden(e){return this.hidden.has(e)}hide(e){this.hidden.has(e)||(this.hidden.add(e),this.updateVisibility(e,!0),this.saveState())}show(e){this.hidden.delete(e)&&(this.updateVisibility(e,!0),this.saveState())}findEntry(e){return this._entries.find(t=>t.container===e)}getEntries(e){return this._entries.filter(t=>t.alignment===e)}focusNextEntry(){this.focusEntry(1,0)}focusPreviousEntry(){this.focusEntry(-1,this.entries.length-1)}isEntryFocused(){return!!this.getFocusedEntry()}getFocusedEntry(){return this._entries.find(e=>Gr(e.container))}focusEntry(e,t){let o=s=>{let l=s,c=l>=0&&l<this._entries.length?this._entries[l]:void 0;for(;c&&this.isHidden(c.id);)l+=e,c=l>=0&&l<this._entries.length?this._entries[l]:void 0;return c},n=this.getFocusedEntry();if(n){let s=o(this._entries.indexOf(n)+e);if(s){this._lastFocusedEntry=s,s.labelContainer.focus();return}}let r=o(t);r&&(this._lastFocusedEntry=r,r.labelContainer.focus())}updateVisibility(e,t){if(typeof e=="string"){let o=e;for(let n of this._entries)n.id===o&&this.updateVisibility(n,t)}else{let o=e,n=this.isHidden(o.id);n?vo(o.container):un(o.container),t&&this._onDidChangeEntryVisibility.fire({id:o.id,visible:!n}),this.markFirstLastVisibleEntry()}}saveState(){this.hidden.size>0?this.storageService.store(a.HIDDEN_ENTRIES_KEY,JSON.stringify(Array.from(this.hidden.values())),0,0):this.storageService.remove(a.HIDDEN_ENTRIES_KEY,0)}sort(){let e=new Set(this._entries.map(s=>s.id)),t=new Map,o=new Map;for(let s=0;s<this._entries.length;s++){let l=this._entries[s];if(typeof l.priority.primary=="number"||!e.has(l.priority.primary.location.id))t.set(l,s);else{let c=l.priority.primary.location.id,u=o.get(c);if(!u){for(let p of o.values())if(p.has(c)){u=p;break}u||(u=new Map,o.set(c,u))}u.set(l.id,l)}}let n=Array.from(t.keys());n.sort((s,l)=>{if(s.alignment===l.alignment){let c=typeof s.priority.primary=="number"?s.priority.primary:s.priority.primary.location.priority,u=typeof l.priority.primary=="number"?l.priority.primary:l.priority.primary.location.priority;return c!==u?u-c:s.priority.secondary!==l.priority.secondary?l.priority.secondary-s.priority.secondary:t.get(s)-t.get(l)}return s.alignment===0?-1:l.alignment===0?1:0});let r;if(o.size>0){r=[];for(let s of n){let l=o.get(s.id),c=l?Array.from(l.values()):void 0;c&&r.push(...c.filter(u=>Tde(u.priority.primary)&&u.priority.primary.alignment===0).sort((u,p)=>p.priority.secondary-u.priority.secondary)),r.push(s),c&&r.push(...c.filter(u=>Tde(u.priority.primary)&&u.priority.primary.alignment===1).sort((u,p)=>p.priority.secondary-u.priority.secondary)),o.delete(s.id)}for(let[,s]of o)r.push(...Array.from(s.values()).sort((l,c)=>c.priority.secondary-l.priority.secondary))}else r=n;this._entries=r}markFirstLastVisibleEntry(){this.doMarkFirstLastVisibleStatusbarItem(this.getEntries(0)),this.doMarkFirstLastVisibleStatusbarItem(this.getEntries(1))}doMarkFirstLastVisibleStatusbarItem(e){let t,o;for(let n of e)n.container.classList.remove("first-visible-item","last-visible-item"),!this.isHidden(n.id)&&(t||(t=n),o=n);t?.container.classList.add("first-visible-item"),o?.container.classList.add("last-visible-item")}};var xRe=class extends x{constructor(e,t,o,n,r,s,l,c){super();this.container=e;this.hoverDelegate=o;this.commandService=n;this.hoverService=r;this.notificationService=s;this.telemetryService=l;this.themeService=c;this.entry=void 0;this.foregroundListener=this._register(new me);this.backgroundListener=this._register(new me);this.commandMouseListener=this._register(new me);this.commandTouchListener=this._register(new me);this.commandKeyboardListener=this._register(new me);this.hover=void 0;this.labelContainer=_("a.statusbar-item-label",{role:"button",tabIndex:-1}),this._register(Ms.addTarget(this.labelContainer)),this.label=this._register(new tCi(this.labelContainer)),this.container.appendChild(this.labelContainer),this.beakContainer=_(".status-bar-item-beak-container"),this.container.appendChild(this.beakContainer),t.content&&this.container.appendChild(t.content),this.update(t)}get name(){return Ci(this.entry).name}get hasCommand(){return typeof this.entry?.command<"u"}update(e){if(this.label.showProgress=e.showProgress??!1,(!this.entry||e.text!==this.entry.text)&&(this.label.text=e.text,e.text?un(this.labelContainer):vo(this.labelContainer)),(!this.entry||e.ariaLabel!==this.entry.ariaLabel)&&(this.container.setAttribute("aria-label",e.ariaLabel),this.labelContainer.setAttribute("aria-label",e.ariaLabel)),(!this.entry||e.role!==this.entry.role)&&this.labelContainer.setAttribute("role",e.role||"button"),!this.entry||!this.isEqualTooltip(this.entry,e)){let o,n;DJi(e.tooltip)?(n=e.tooltip.content,o={actions:e.tooltip.commands.map(s=>({commandId:s.id,label:s.title,run:()=>this.executeCommand(s)}))}):n=e.tooltip;let r=Ar(n)?{markdown:n,markdownNotSupportedFallback:void 0}:n;this.hover?this.hover.update(r,o):this.hover=this._register(this.hoverService.setupManagedHover(this.hoverDelegate,this.container,r,o))}if(!this.entry||e.command!==this.entry.command){this.commandMouseListener.clear(),this.commandTouchListener.clear(),this.commandKeyboardListener.clear();let o=e.command;o&&(o!==LR||this.hover)?(this.commandMouseListener.value=j(this.labelContainer,re.CLICK,()=>this.executeCommand(o)),this.commandTouchListener.value=j(this.labelContainer,Kn.Tap,()=>this.executeCommand(o)),this.commandKeyboardListener.value=j(this.labelContainer,re.KEY_DOWN,n=>{let r=new gi(n);r.equals(10)||r.equals(3)?(Xt.stop(n),this.executeCommand(o)):(r.equals(9)||r.equals(15)||r.equals(17))&&(Xt.stop(n),this.hover?.hide())}),this.labelContainer.classList.remove("disabled")):this.labelContainer.classList.add("disabled")}(!this.entry||e.showBeak!==this.entry.showBeak)&&(e.showBeak?this.container.classList.add("has-beak"):this.container.classList.remove("has-beak"));let t=!!e.backgroundColor||e.kind&&e.kind!=="standard";if(!this.entry||e.kind!==this.entry.kind){for(let o of _Ji)this.container.classList.remove(`${o}-kind`);e.kind&&e.kind!=="standard"&&this.container.classList.add(`${e.kind}-kind`),this.container.classList.toggle("has-background-color",t)}(!this.entry||e.color!==this.entry.color)&&this.applyColor(this.labelContainer,e.color),(!this.entry||e.backgroundColor!==this.entry.backgroundColor)&&(this.container.classList.toggle("has-background-color",t),this.applyColor(this.container,e.backgroundColor,!0)),this.entry=e}isEqualTooltip({tooltip:e},{tooltip:t}){return e===void 0?t===void 0:Ar(e)?Ar(t)&&Gle(e,t):e===t}async executeCommand(e){if(e===LR)this.hover?.show(!0);else{let t=typeof e=="string"?e:e.id,o=typeof e=="string"?[]:e.arguments??[];this.telemetryService.publicLog2("workbenchActionExecuted",{id:t,from:"status bar"});try{await this.commandService.executeCommand(t,...o)}catch(n){this.notificationService.error(xn(n))}}}applyColor(e,t,o){let n;if(o?this.backgroundListener.clear():this.foregroundListener.clear(),t)if(lye(t)){n=this.themeService.getColorTheme().getColor(t.id)?.toString();let r=this.themeService.onDidColorThemeChange(s=>{let l=s.getColor(t.id)?.toString();o?e.style.backgroundColor=l??"":e.style.color=l??""});o?this.backgroundListener.value=r:this.foregroundListener.value=r}else n=t;o?e.style.backgroundColor=n??"":e.style.color=n??""}};xRe=I([m(3,ge),m(4,nt),m(5,Ne),m(6,Te),m(7,Le)],xRe);var tCi=class extends hx{constructor(e){super(e);this.container=e;this.progressCodicon=Sn(I4e);this.currentText="";this.currentShowProgress=!1}set showProgress(e){this.currentShowProgress!==e&&(this.currentShowProgress=e,this.progressCodicon=Sn(e==="syncing"?I4e:AE),this.text=this.currentText)}set text(e){if(this.currentShowProgress){this.container.firstChild!==this.progressCodicon&&this.container.appendChild(this.progressCodicon);for(let o of Array.from(this.container.childNodes))o!==this.progressCodicon&&o.remove();let t=e??"";t&&(t=`\xA0${t}`),M(this.container,...Un(t))}else super.text=e}};var $2=class extends RT{constructor(e,t,o,n,r,s,l,c){super(e,{hasTitle:!1},o,r,s);this.instantiationService=t;this.contextService=n;this.contextMenuService=l;this.contextKeyService=c;this.minimumWidth=0;this.maximumWidth=Number.POSITIVE_INFINITY;this.minimumHeight=$2.HEIGHT;this.maximumHeight=$2.HEIGHT;this.pendingEntries=[];this._onWillDispose=this._register(new E);this.onWillDispose=this._onWillDispose.event;this.onDidOverrideEntry=this._register(new E);this.entryOverrides=new Map;this.compactEntriesDisposable=this._register(new me);this.styleOverrides=new Set;this.viewModel=this._register(new dVt(r)),this.onDidChangeEntryVisibility=this.viewModel.onDidChangeEntryVisibility,this.hoverDelegate=this._register(this.instantiationService.createInstance(mf,"element",{instantHover:!0,dynamicDelay(u){if(typeof u=="function"||Do(u)||Ixe(u)&&typeof u.markdown=="function"||$9i(u))return 500}},(u,p)=>({persistence:{hideOnKeyDown:!0,sticky:p},appearance:{maxHeightRatio:.9}}))),this.registerListeners()}static{this.HEIGHT=22}registerListeners(){this._register(this.onDidChangeEntryVisibility(()=>this.updateCompactEntries())),this._register(this.contextService.onDidChangeWorkbenchState(()=>this.updateStyles()))}overrideEntry(e,t){return this.entryOverrides.set(e,t),this.onDidOverrideEntry.fire(e),Z(()=>{this.entryOverrides.get(e)===t&&(this.entryOverrides.delete(e),this.onDidOverrideEntry.fire(e))})}withEntryOverride(e,t){let o=this.entryOverrides.get(t);return o&&(e={...e,...o}),e}addEntry(e,t,o,n=0){let r;return TJi(n)?r=n:r={primary:n,secondary:_r(t)},this.element?this.doAddEntry(e,t,o,r):this.doAddPendingEntry(e,t,o,r)}doAddPendingEntry(e,t,o,n){let r={entry:e,id:t,alignment:o,priority:n};return this.pendingEntries.push(r),{update:l=>{r.accessor?r.accessor.update(l):r.entry=l},dispose:()=>{r.accessor?r.accessor.dispose():this.pendingEntries=this.pendingEntries.filter(l=>l!==r)}}}doAddEntry(e,t,o,n){let r=new N,s=this.doCreateStatusItem(t,o),l=r.add(this.instantiationService.createInstance(xRe,s,this.withEntryOverride(e,t),this.hoverDelegate)),c=new class{constructor(){this.id=t;this.extensionId=e.extensionId;this.alignment=o;this.priority=n;this.container=s;this.labelContainer=l.labelContainer}get name(){return l.name}get hasCommand(){return l.hasCommand}},{needsFullRefresh:u}=this.doAddOrRemoveModelEntry(c,!0);u?this.appendStatusbarEntries():this.appendStatusbarEntry(c);let p=e,h={update:g=>{p=g,l.update(this.withEntryOverride(g,t))},dispose:()=>{let{needsFullRefresh:g}=this.doAddOrRemoveModelEntry(c,!1);g?this.appendStatusbarEntries():(s.remove(),this.updateCompactEntries()),r.dispose()}};return r.add(this.onDidOverrideEntry.event(g=>{g===t&&h.update(p)})),h}doCreateStatusItem(e,t,...o){let n=_(".statusbar-item",{id:e});return o&&n.classList.add(...o),t===1?n.classList.add("right"):n.classList.add("left"),n}doAddOrRemoveModelEntry(e,t){let o=this.viewModel.entries;t?this.viewModel.add(e):this.viewModel.remove(e);let n=this.viewModel.entries;return t?o.splice(n.indexOf(e),0,e):o.splice(o.indexOf(e),1),{needsFullRefresh:!$i(o,n)}}isEntryVisible(e){return!this.viewModel.isHidden(e)}updateEntryVisibility(e,t){t?this.viewModel.show(e):this.viewModel.hide(e)}focusNextEntry(){this.viewModel.focusNextEntry()}focusPreviousEntry(){this.viewModel.focusPreviousEntry()}isEntryFocused(){return this.viewModel.isEntryFocused()}focus(e=!0){this.getContainer()?.focus();let t=this.viewModel.lastFocusedEntry;e&&t&&setTimeout(()=>t.labelContainer.focus(),0)}createContentArea(e){this.element=e;let t=this._register(this.contextKeyService.createScoped(this.element));return KX.bindTo(t).set(!0),this.leftItemsContainer=_(".left-items.items-container"),this.element.appendChild(this.leftItemsContainer),this.element.tabIndex=0,this.rightItemsContainer=_(".right-items.items-container"),this.element.appendChild(this.rightItemsContainer),this._register(j(e,re.CONTEXT_MENU,o=>this.showContextMenu(o))),this._register(Ms.addTarget(e)),this._register(j(e,Kn.Contextmenu,o=>this.showContextMenu(o))),this.createInitialStatusbarEntries(),this.element}createInitialStatusbarEntries(){for(this.appendStatusbarEntries();this.pendingEntries.length;){let e=this.pendingEntries.shift();e&&(e.accessor=this.addEntry(e.entry,e.id,e.alignment,e.priority.primary))}}appendStatusbarEntries(){let e=Ci(this.leftItemsContainer),t=Ci(this.rightItemsContainer);Rt(e),Rt(t);for(let o of[...this.viewModel.getEntries(0),...this.viewModel.getEntries(1).reverse()])(o.alignment===0?e:t).appendChild(o.container);this.updateCompactEntries()}appendStatusbarEntry(e){let t=this.viewModel.getEntries(e.alignment);e.alignment===1&&t.reverse();let o=Ci(e.alignment===0?this.leftItemsContainer:this.rightItemsContainer),n=t.indexOf(e);n+1===t.length?o.appendChild(e.container):o.insertBefore(e.container,t[n+1].container),this.updateCompactEntries()}updateCompactEntries(){let e=this.viewModel.entries,t=new Map;for(let s of e)this.viewModel.isHidden(s.id)||t.set(s.id,s),s.container.classList.remove("compact-left","compact-right");let o=new Map;for(let s of t.values())if(Tde(s.priority.primary)&&s.priority.primary.compact){let l=s.priority.primary.location.id,c=t.get(l);if(!c)continue;let u=o.get(l);if(!u){for(let p of o.values())if(p.has(l)){u=p;break}u||(u=new Map,o.set(l,u))}u.set(s.id,s),u.set(c.id,c),s.priority.primary.alignment===0?(c.container.classList.add("compact-left"),s.container.classList.add("compact-right")):(c.container.classList.add("compact-right"),s.container.classList.add("compact-left"))}let n=this.getColor(SB),r=this.getColor(bZi);if(this.compactEntriesDisposable.value=new N,n&&r&&!uf(this.theme.type))for(let[,s]of o)for(let l of s.values())l.hasCommand&&(this.compactEntriesDisposable.value.add(j(l.labelContainer,re.MOUSE_OVER,()=>{s.forEach(c=>c.labelContainer.style.backgroundColor=n),l.labelContainer.style.backgroundColor=r})),this.compactEntriesDisposable.value.add(j(l.labelContainer,re.MOUSE_OUT,()=>{s.forEach(c=>c.labelContainer.style.backgroundColor="")})))}showContextMenu(e){Xt.stop(e,!0);let t=new Cn(Re(this.element),e),o;this.contextMenuService.showContextMenu({getAnchor:()=>t,getActions:()=>(o=this.getContextMenuActions(t),o),onHide:()=>{o&&a1(o)}})}getContextMenuActions(e){let t=[];t.push(ii({id:Mpe.ID,label:d(4482,null),run:()=>this.instantiationService.invokeFunction(r=>new Mpe().run(r))})),t.push(new ri);let o=new Set;for(let r of this.viewModel.entries)o.has(r.id)||(t.push(new lVt(r.id,r.name,this.viewModel)),o.add(r.id));let n;for(let r=e.target;r;r=r.parentElement){let s=this.viewModel.findEntry(r);if(s){n=s;break}}return n&&(t.push(new ri),n.extensionId&&t.push(this.instantiationService.createInstance(CRe,n.extensionId)),t.push(new cVt(n.id,n.name,this.viewModel))),t}updateStyles(){super.updateStyles();let e=Ci(this.getContainer()),t=[...this.styleOverrides].sort((c,u)=>c.priority-u.priority)[0],o=this.getColor(t?.background??(this.contextService.getWorkbenchState()!==1?eDt:tDt))||"";e.style.backgroundColor=o;let n=this.getColor(t?.foreground??(this.contextService.getWorkbenchState()!==1?PR:hZi))||"";e.style.color=n;let r=this.getColor(vZi);this.updateCompactEntries();let s=this.getColor(t?.border??(this.contextService.getWorkbenchState()!==1?Vde:fZi))||this.getColor(bi);s?(e.classList.add("status-border-top"),e.style.setProperty("--status-border-top-color",s)):(e.classList.remove("status-border-top"),e.style.removeProperty("--status-border-top-color"));let l=this.getColor(gZi);this.styleElement||(this.styleElement=Cr(e,void 0,this._store)),this.styleElement.textContent=`

				/* Status bar focus outline */
				.monaco-workbench .part.statusbar:focus {
					outline-color: ${l};
				}

				/* Status bar item focus outline */
				.monaco-workbench .part.statusbar > .items-container > .statusbar-item a:focus-visible {
					outline: 1px solid ${this.getColor(Ys)??r};
					outline-offset: ${s?"-2px":"-1px"};
				}

				/* Notification Beak */
				.monaco-workbench .part.statusbar > .items-container > .statusbar-item.has-beak > .status-bar-item-beak-container:before {
					border-bottom-color: ${s??o};
				}
			`}layout(e,t,o,n){super.layout(e,t,o,n),super.layoutContents(e,t)}overrideStyle(e){return this.styleOverrides.add(e),this.updateStyles(),Z(()=>{this.styleOverrides.delete(e),this.updateStyles()})}toJSON(){return{type:"workbench.parts.statusbar"}}dispose(){this._onWillDispose.fire(),super.dispose()}};$2=I([m(1,F),m(2,Le),m(3,Pe),m(4,ce),m(5,yi),m(6,Xe),m(7,X)],$2);var XJe=class extends $2{constructor(i,e,t,o,n,r,s){super("workbench.parts.statusbar",i,e,t,o,n,r,s)}};XJe=I([m(0,F),m(1,Le),m(2,Pe),m(3,ce),m(4,yi),m(5,Xe),m(6,X)],XJe);var ime=class extends $2{constructor(e,t,o,n,r,s,l,c){let u=ime.COUNTER++;super(`workbench.parts.auxiliaryStatus.${u}`,t,o,n,r,s,l,c);this.container=e;this.height=$2.HEIGHT}static{this.COUNTER=1}};ime=I([m(1,F),m(2,Le),m(3,Pe),m(4,ce),m(5,yi),m(6,Xe),m(7,X)],ime);var JJe=class extends nee{constructor(e,t,o){super("workbench.statusBarService",o,t);this.instantiationService=e;this._onDidCreateAuxiliaryStatusbarPart=this._register(new E);this.onDidCreateAuxiliaryStatusbarPart=this._onDidCreateAuxiliaryStatusbarPart.event;this.mainPart=this._register(this.instantiationService.createInstance(XJe)),this._register(this.registerPart(this.mainPart)),this.onDidChangeEntryVisibility=this.mainPart.onDidChangeEntryVisibility}createAuxiliaryStatusbarPart(e,t){let o=_("footer.part.statusbar",{role:"status","aria-live":"off",tabIndex:"0"});o.style.position="relative",e.appendChild(o);let n=t.createInstance(ime,o),r=this.registerPart(n);return n.create(o),U.once(n.onWillDispose)(()=>r.dispose()),this._onDidCreateAuxiliaryStatusbarPart.fire(n),n}createScoped(e,t){return t.add(this.instantiationService.createInstance(ZJe,e))}addEntry(e,t,o,n=0){return e.showInAllWindows?this.doAddEntryToAllWindows(e,t,o,n):this.mainPart.addEntry(e,t,o,n)}doAddEntryToAllWindows(e,t,o,n=0){let r=new N,s=new Set,l=e;function c(u){let p=new N;p.add(u.onWillDispose(()=>p.dispose()));let h=p.add(u.addEntry(l,t,o,n));s.add(h),p.add(Z(()=>s.delete(h))),r.add(p),p.add(Z(()=>r.delete(p)))}for(let u of this.parts)c(u);return r.add(this.onDidCreateAuxiliaryStatusbarPart(u=>c(u))),{update:u=>{l=u;for(let p of s)p.update(u)},dispose:()=>r.dispose()}}isEntryVisible(e){return this.mainPart.isEntryVisible(e)}updateEntryVisibility(e,t){for(let o of this.parts)o.updateEntryVisibility(e,t)}overrideEntry(e,t){let o=new N;for(let n of this.parts)o.add(n.overrideEntry(e,t));return o}focus(e){this.activePart.focus(e)}focusNextEntry(){this.activePart.focusNextEntry()}focusPreviousEntry(){this.activePart.focusPreviousEntry()}isEntryFocused(){return this.activePart.isEntryFocused()}overrideStyle(e){let t=new N;for(let o of this.parts)t.add(o.overrideStyle(e));return t}};JJe=I([m(0,F),m(1,ce),m(2,Le)],JJe);var ZJe=class extends x{constructor(e,t){super();this.statusbarEntryContainer=e;this.statusbarService=t;this.onDidChangeEntryVisibility=this.statusbarEntryContainer.onDidChangeEntryVisibility}createAuxiliaryStatusbarPart(e,t){return this.statusbarService.createAuxiliaryStatusbarPart(e,t)}createScoped(e,t){return this.statusbarService.createScoped(e,t)}getPart(){return this.statusbarEntryContainer}addEntry(e,t,o,n=0){return this.statusbarEntryContainer.addEntry(e,t,o,n)}isEntryVisible(e){return this.statusbarEntryContainer.isEntryVisible(e)}updateEntryVisibility(e,t){this.statusbarEntryContainer.updateEntryVisibility(e,t)}overrideEntry(e,t){return this.statusbarEntryContainer.overrideEntry(e,t)}focus(e){this.statusbarEntryContainer.focus(e)}focusNextEntry(){this.statusbarEntryContainer.focusNextEntry()}focusPreviousEntry(){this.statusbarEntryContainer.focusPreviousEntry()}isEntryFocused(){return this.statusbarEntryContainer.isEntryFocused()}overrideStyle(e){return this.statusbarEntryContainer.overrideStyle(e)}};ZJe=I([m(1,kr)],ZJe);Ee(kr,JJe,0);var uVt=class extends K{constructor(){super({id:"menu.resetHiddenStates",title:L(1814,"Reset All Menus"),category:Ve.View,f1:!0})}run(i){i.get(Kt).resetHiddenStates(),i.get(se).info("did RESET all menu hidden states")}};Ee(Kt,XCe,1);W(uVt);var kRe=!1;function pVt(a){return a.scheme===Q.file?a.fsPath:a.path}var sdo=0,ERe=class{constructor(i,e,t,o,n,r,s){this.id=++sdo;this.type=0;this.actual=i,this.label=i.label,this.confirmBeforeUndo=i.confirmBeforeUndo||!1,this.resourceLabel=e,this.strResource=t,this.resourceLabels=[this.resourceLabel],this.strResources=[this.strResource],this.groupId=o,this.groupOrder=n,this.sourceId=r,this.sourceOrder=s,this.isValid=!0}setValid(i){this.isValid=i}toString(){return`[id:${this.id}] [group:${this.groupId}] [${this.isValid?"  VALID":"INVALID"}] ${this.actual.constructor.name} - ${this.actual}`}};var mVt=class{constructor(i,e){this.resourceLabel=i;this.reason=e}},hVt=class{constructor(){this.elements=new Map}createMessage(){let i=[],e=[];for(let[,o]of this.elements)(o.reason===0?i:e).push(o.resourceLabel);let t=[];return i.length>0&&t.push(d(2737,null,i.join(", "))),e.length>0&&t.push(d(2739,null,e.join(", "))),t.join(`
`)}get size(){return this.elements.size}has(i){return this.elements.has(i)}set(i,e){this.elements.set(i,e)}delete(i){return this.elements.delete(i)}},iCi=class{constructor(i,e,t,o,n,r,s){this.id=++sdo;this.type=1;this.actual=i,this.label=i.label,this.confirmBeforeUndo=i.confirmBeforeUndo||!1,this.resourceLabels=e,this.strResources=t,this.groupId=o,this.groupOrder=n,this.sourceId=r,this.sourceOrder=s,this.removedResources=null,this.invalidatedResources=null}canSplit(){return typeof this.actual.split=="function"}removeResource(i,e,t){this.removedResources||(this.removedResources=new hVt),this.removedResources.has(e)||this.removedResources.set(e,new mVt(i,t))}setValid(i,e,t){t?this.invalidatedResources&&(this.invalidatedResources.delete(e),this.invalidatedResources.size===0&&(this.invalidatedResources=null)):(this.invalidatedResources||(this.invalidatedResources=new hVt),this.invalidatedResources.has(e)||this.invalidatedResources.set(e,new mVt(i,0)))}toString(){return`[id:${this.id}] [group:${this.groupId}] [${this.invalidatedResources?"INVALID":"  VALID"}] ${this.actual.constructor.name} - ${this.actual}`}},gVt=class{constructor(i,e){this.resourceLabel=i,this.strResource=e,this._past=[],this._future=[],this.locked=!1,this.versionId=1}dispose(){for(let i of this._past)i.type===1&&i.removeResource(this.resourceLabel,this.strResource,0);for(let i of this._future)i.type===1&&i.removeResource(this.resourceLabel,this.strResource,0);this.versionId++}toString(){let i=[];i.push(`* ${this.strResource}:`);for(let e=0;e<this._past.length;e++)i.push(`   * [UNDO] ${this._past[e]}`);for(let e=this._future.length-1;e>=0;e--)i.push(`   * [REDO] ${this._future[e]}`);return i.join(`
`)}flushAllElements(){this._past=[],this._future=[],this.versionId++}setElementsIsValid(i){for(let e of this._past)e.type===1?e.setValid(this.resourceLabel,this.strResource,i):e.setValid(i);for(let e of this._future)e.type===1?e.setValid(this.resourceLabel,this.strResource,i):e.setValid(i)}_setElementValidFlag(i,e){i.type===1?i.setValid(this.resourceLabel,this.strResource,e):i.setValid(e)}setElementsValidFlag(i,e){for(let t of this._past)e(t.actual)&&this._setElementValidFlag(t,i);for(let t of this._future)e(t.actual)&&this._setElementValidFlag(t,i)}pushElement(i){for(let e of this._future)e.type===1&&e.removeResource(this.resourceLabel,this.strResource,1);this._future=[],this._past.push(i),this.versionId++}createSnapshot(i){let e=[];for(let t=0,o=this._past.length;t<o;t++)e.push(this._past[t].id);for(let t=this._future.length-1;t>=0;t--)e.push(this._future[t].id);return new v5e(i,e)}restoreSnapshot(i){let e=i.elements.length,t=!0,o=0,n=-1;for(let s=0,l=this._past.length;s<l;s++,o++){let c=this._past[s];t&&(o>=e||c.id!==i.elements[o])&&(t=!1,n=s),!t&&c.type===1&&c.removeResource(this.resourceLabel,this.strResource,0)}let r=-1;for(let s=this._future.length-1;s>=0;s--,o++){let l=this._future[s];t&&(o>=e||l.id!==i.elements[o])&&(t=!1,r=s),!t&&l.type===1&&l.removeResource(this.resourceLabel,this.strResource,0)}n!==-1&&(this._past=this._past.slice(0,n)),r!==-1&&(this._future=this._future.slice(r+1)),this.versionId++}getElements(){let i=[],e=[];for(let t of this._past)i.push(t.actual);for(let t of this._future)e.push(t.actual);return{past:i,future:e}}getClosestPastElement(){return this._past.length===0?null:this._past[this._past.length-1]}getSecondClosestPastElement(){return this._past.length<2?null:this._past[this._past.length-2]}getClosestFutureElement(){return this._future.length===0?null:this._future[this._future.length-1]}hasPastElements(){return this._past.length>0}hasFutureElements(){return this._future.length>0}splitPastWorkspaceElement(i,e){for(let t=this._past.length-1;t>=0;t--)if(this._past[t]===i){e.has(this.strResource)?this._past[t]=e.get(this.strResource):this._past.splice(t,1);break}this.versionId++}splitFutureWorkspaceElement(i,e){for(let t=this._future.length-1;t>=0;t--)if(this._future[t]===i){e.has(this.strResource)?this._future[t]=e.get(this.strResource):this._future.splice(t,1);break}this.versionId++}moveBackward(i){this._past.pop(),this._future.push(i),this.versionId++}moveForward(i){this._future.pop(),this._past.push(i),this.versionId++}},tZe=class{constructor(i){this.editStacks=i,this._versionIds=[];for(let e=0,t=this.editStacks.length;e<t;e++)this._versionIds[e]=this.editStacks[e].versionId}isValid(){for(let i=0,e=this.editStacks.length;i<e;i++)if(this._versionIds[i]!==this.editStacks[i].versionId)return!1;return!0}},ado=new gVt("","");ado.locked=!0;var eZe=class{constructor(i,e){this._dialogService=i;this._notificationService=e;this._editStacks=new Map,this._uriComparisonKeyComputers=[]}registerUriComparisonKeyComputer(i,e){return this._uriComparisonKeyComputers.push([i,e]),{dispose:()=>{for(let t=0,o=this._uriComparisonKeyComputers.length;t<o;t++)if(this._uriComparisonKeyComputers[t][1]===e){this._uriComparisonKeyComputers.splice(t,1);return}}}}getUriComparisonKey(i){for(let e of this._uriComparisonKeyComputers)if(e[0]===i.scheme)return e[1].getComparisonKey(i);return i.toString()}_print(i){console.log("------------------------------------"),console.log(`AFTER ${i}: `);let e=[];for(let t of this._editStacks)e.push(t[1].toString());console.log(e.join(`
`))}pushElement(i,e=Q7.None,t=iz.None){if(i.type===0){let o=pVt(i.resource),n=this.getUriComparisonKey(i.resource);this._pushElement(new ERe(i,o,n,e.id,e.nextOrder(),t.id,t.nextOrder()))}else{let o=new Set,n=[],r=[];for(let s of i.resources){let l=pVt(s),c=this.getUriComparisonKey(s);o.has(c)||(o.add(c),n.push(l),r.push(c))}n.length===1?this._pushElement(new ERe(i,n[0],r[0],e.id,e.nextOrder(),t.id,t.nextOrder())):this._pushElement(new iCi(i,n,r,e.id,e.nextOrder(),t.id,t.nextOrder()))}kRe&&this._print("pushElement")}_pushElement(i){for(let e=0,t=i.strResources.length;e<t;e++){let o=i.resourceLabels[e],n=i.strResources[e],r;this._editStacks.has(n)?r=this._editStacks.get(n):(r=new gVt(o,n),this._editStacks.set(n,r)),r.pushElement(i)}}getLastElement(i){let e=this.getUriComparisonKey(i);if(this._editStacks.has(e)){let t=this._editStacks.get(e);if(t.hasFutureElements())return null;let o=t.getClosestPastElement();return o?o.actual:null}return null}_splitPastWorkspaceElement(i,e){let t=i.actual.split(),o=new Map;for(let n of t){let r=pVt(n.resource),s=this.getUriComparisonKey(n.resource),l=new ERe(n,r,s,0,0,0,0);o.set(l.strResource,l)}for(let n of i.strResources){if(e&&e.has(n))continue;this._editStacks.get(n).splitPastWorkspaceElement(i,o)}}_splitFutureWorkspaceElement(i,e){let t=i.actual.split(),o=new Map;for(let n of t){let r=pVt(n.resource),s=this.getUriComparisonKey(n.resource),l=new ERe(n,r,s,0,0,0,0);o.set(l.strResource,l)}for(let n of i.strResources){if(e&&e.has(n))continue;this._editStacks.get(n).splitFutureWorkspaceElement(i,o)}}removeElements(i){let e=typeof i=="string"?i:this.getUriComparisonKey(i);this._editStacks.has(e)&&(this._editStacks.get(e).dispose(),this._editStacks.delete(e)),kRe&&this._print("removeElements")}setElementsValidFlag(i,e,t){let o=this.getUriComparisonKey(i);this._editStacks.has(o)&&this._editStacks.get(o).setElementsValidFlag(e,t),kRe&&this._print("setElementsValidFlag")}hasElements(i){let e=this.getUriComparisonKey(i);if(this._editStacks.has(e)){let t=this._editStacks.get(e);return t.hasPastElements()||t.hasFutureElements()}return!1}createSnapshot(i){let e=this.getUriComparisonKey(i);return this._editStacks.has(e)?this._editStacks.get(e).createSnapshot(i):new v5e(i,[])}restoreSnapshot(i){let e=this.getUriComparisonKey(i.resource);if(this._editStacks.has(e)){let t=this._editStacks.get(e);t.restoreSnapshot(i),!t.hasPastElements()&&!t.hasFutureElements()&&(t.dispose(),this._editStacks.delete(e))}kRe&&this._print("restoreSnapshot")}getElements(i){let e=this.getUriComparisonKey(i);return this._editStacks.has(e)?this._editStacks.get(e).getElements():{past:[],future:[]}}_findClosestUndoElementWithSource(i){if(!i)return[null,null];let e=null,t=null;for(let[o,n]of this._editStacks){let r=n.getClosestPastElement();r&&r.sourceId===i&&(!e||r.sourceOrder>e.sourceOrder)&&(e=r,t=o)}return[e,t]}canUndo(i){if(i instanceof iz){let[,t]=this._findClosestUndoElementWithSource(i.id);return!!t}let e=this.getUriComparisonKey(i);return this._editStacks.has(e)?this._editStacks.get(e).hasPastElements():!1}_onError(i,e){mt(i);for(let t of e.strResources)this.removeElements(t);this._notificationService.error(i)}_acquireLocks(i){for(let e of i.editStacks)if(e.locked)throw new Error("Cannot acquire edit stack lock");for(let e of i.editStacks)e.locked=!0;return()=>{for(let e of i.editStacks)e.locked=!1}}_safeInvokeWithLocks(i,e,t,o,n){let r=this._acquireLocks(t),s;try{s=e()}catch(l){return r(),o.dispose(),this._onError(l,i)}return s?s.then(()=>(r(),o.dispose(),n()),l=>(r(),o.dispose(),this._onError(l,i))):(r(),o.dispose(),n())}async _invokeWorkspacePrepare(i){if(typeof i.actual.prepareUndoRedo>"u")return x.None;let e=i.actual.prepareUndoRedo();return typeof e>"u"?x.None:e}_invokeResourcePrepare(i,e){if(i.actual.type!==1||typeof i.actual.prepareUndoRedo>"u")return e(x.None);let t=i.actual.prepareUndoRedo();return t?jc(t)?e(t):t.then(o=>e(o)):e(x.None)}_getAffectedEditStacks(i){let e=[];for(let t of i.strResources)e.push(this._editStacks.get(t)||ado);return new tZe(e)}_tryToSplitAndUndo(i,e,t,o){if(e.canSplit())return this._splitPastWorkspaceElement(e,t),this._notificationService.warn(o),new TRe(this._undo(i,0,!0));for(let n of e.strResources)this.removeElements(n);return this._notificationService.warn(o),new TRe}_checkWorkspaceUndo(i,e,t,o){if(e.removedResources)return this._tryToSplitAndUndo(i,e,e.removedResources,d(2729,null,e.label,e.removedResources.createMessage()));if(o&&e.invalidatedResources)return this._tryToSplitAndUndo(i,e,e.invalidatedResources,d(2729,null,e.label,e.invalidatedResources.createMessage()));let n=[];for(let s of t.editStacks)s.getClosestPastElement()!==e&&n.push(s.resourceLabel);if(n.length>0)return this._tryToSplitAndUndo(i,e,null,d(2730,null,e.label,n.join(", ")));let r=[];for(let s of t.editStacks)s.locked&&r.push(s.resourceLabel);return r.length>0?this._tryToSplitAndUndo(i,e,null,d(2732,null,e.label,r.join(", "))):t.isValid()?null:this._tryToSplitAndUndo(i,e,null,d(2731,null,e.label))}_workspaceUndo(i,e,t){let o=this._getAffectedEditStacks(e),n=this._checkWorkspaceUndo(i,e,o,!1);return n?n.returnValue:this._confirmAndExecuteWorkspaceUndo(i,e,o,t)}_isPartOfUndoGroup(i){if(!i.groupId)return!1;for(let[,e]of this._editStacks){let t=e.getClosestPastElement();if(t){if(t===i){let o=e.getSecondClosestPastElement();if(o&&o.groupId===i.groupId)return!0}if(t.groupId===i.groupId)return!0}}return!1}async _confirmAndExecuteWorkspaceUndo(i,e,t,o){if(e.canSplit()&&!this._isPartOfUndoGroup(e)){let s;(g=>(g[g.All=0]="All",g[g.This=1]="This",g[g.Cancel=2]="Cancel"))(s||={});let{result:l}=await this._dialogService.prompt({type:bt.Info,message:d(2736,null,e.label),buttons:[{label:d(2740,null,t.editStacks.length),run:()=>0},{label:d(2738,null),run:()=>1}],cancelButton:{run:()=>2}});if(l===2)return;if(l===1)return this._splitPastWorkspaceElement(e,null),this._undo(i,0,!0);let c=this._checkWorkspaceUndo(i,e,t,!1);if(c)return c.returnValue;o=!0}let n;try{n=await this._invokeWorkspacePrepare(e)}catch(s){return this._onError(s,e)}let r=this._checkWorkspaceUndo(i,e,t,!0);if(r)return n.dispose(),r.returnValue;for(let s of t.editStacks)s.moveBackward(e);return this._safeInvokeWithLocks(e,()=>e.actual.undo(),t,n,()=>this._continueUndoInGroup(e.groupId,o))}_resourceUndo(i,e,t){if(!e.isValid){i.flushAllElements();return}if(i.locked){let o=d(2724,null,e.label);this._notificationService.warn(o);return}return this._invokeResourcePrepare(e,o=>(i.moveBackward(e),this._safeInvokeWithLocks(e,()=>e.actual.undo(),new tZe([i]),o,()=>this._continueUndoInGroup(e.groupId,t))))}_findClosestUndoElementInGroup(i){if(!i)return[null,null];let e=null,t=null;for(let[o,n]of this._editStacks){let r=n.getClosestPastElement();r&&r.groupId===i&&(!e||r.groupOrder>e.groupOrder)&&(e=r,t=o)}return[e,t]}_continueUndoInGroup(i,e){if(!i)return;let[,t]=this._findClosestUndoElementInGroup(i);if(t)return this._undo(t,0,e)}undo(i){if(i instanceof iz){let[,e]=this._findClosestUndoElementWithSource(i.id);return e?this._undo(e,i.id,!1):void 0}return typeof i=="string"?this._undo(i,0,!1):this._undo(this.getUriComparisonKey(i),0,!1)}_undo(i,e=0,t){if(!this._editStacks.has(i))return;let o=this._editStacks.get(i),n=o.getClosestPastElement();if(!n)return;if(n.groupId){let[s,l]=this._findClosestUndoElementInGroup(n.groupId);if(n!==s&&l)return this._undo(l,e,t)}if((n.sourceId!==e||n.confirmBeforeUndo)&&!t)return this._confirmAndContinueUndo(i,e,n);try{return n.type===1?this._workspaceUndo(i,n,t):this._resourceUndo(o,n,t)}finally{kRe&&this._print("undo")}}async _confirmAndContinueUndo(i,e,t){if((await this._dialogService.confirm({message:d(2733,null,t.label),primaryButton:d(2735,null),cancelButton:d(2734,null)})).confirmed)return this._undo(i,e,!0)}_findClosestRedoElementWithSource(i){if(!i)return[null,null];let e=null,t=null;for(let[o,n]of this._editStacks){let r=n.getClosestFutureElement();r&&r.sourceId===i&&(!e||r.sourceOrder<e.sourceOrder)&&(e=r,t=o)}return[e,t]}canRedo(i){if(i instanceof iz){let[,t]=this._findClosestRedoElementWithSource(i.id);return!!t}let e=this.getUriComparisonKey(i);return this._editStacks.has(e)?this._editStacks.get(e).hasFutureElements():!1}_tryToSplitAndRedo(i,e,t,o){if(e.canSplit())return this._splitFutureWorkspaceElement(e,t),this._notificationService.warn(o),new TRe(this._redo(i));for(let n of e.strResources)this.removeElements(n);return this._notificationService.warn(o),new TRe}_checkWorkspaceRedo(i,e,t,o){if(e.removedResources)return this._tryToSplitAndRedo(i,e,e.removedResources,d(2725,null,e.label,e.removedResources.createMessage()));if(o&&e.invalidatedResources)return this._tryToSplitAndRedo(i,e,e.invalidatedResources,d(2725,null,e.label,e.invalidatedResources.createMessage()));let n=[];for(let s of t.editStacks)s.getClosestFutureElement()!==e&&n.push(s.resourceLabel);if(n.length>0)return this._tryToSplitAndRedo(i,e,null,d(2726,null,e.label,n.join(", ")));let r=[];for(let s of t.editStacks)s.locked&&r.push(s.resourceLabel);return r.length>0?this._tryToSplitAndRedo(i,e,null,d(2728,null,e.label,r.join(", "))):t.isValid()?null:this._tryToSplitAndRedo(i,e,null,d(2727,null,e.label))}_workspaceRedo(i,e){let t=this._getAffectedEditStacks(e),o=this._checkWorkspaceRedo(i,e,t,!1);return o?o.returnValue:this._executeWorkspaceRedo(i,e,t)}async _executeWorkspaceRedo(i,e,t){let o;try{o=await this._invokeWorkspacePrepare(e)}catch(r){return this._onError(r,e)}let n=this._checkWorkspaceRedo(i,e,t,!0);if(n)return o.dispose(),n.returnValue;for(let r of t.editStacks)r.moveForward(e);return this._safeInvokeWithLocks(e,()=>e.actual.redo(),t,o,()=>this._continueRedoInGroup(e.groupId))}_resourceRedo(i,e){if(!e.isValid){i.flushAllElements();return}if(i.locked){let t=d(2723,null,e.label);this._notificationService.warn(t);return}return this._invokeResourcePrepare(e,t=>(i.moveForward(e),this._safeInvokeWithLocks(e,()=>e.actual.redo(),new tZe([i]),t,()=>this._continueRedoInGroup(e.groupId))))}_findClosestRedoElementInGroup(i){if(!i)return[null,null];let e=null,t=null;for(let[o,n]of this._editStacks){let r=n.getClosestFutureElement();r&&r.groupId===i&&(!e||r.groupOrder<e.groupOrder)&&(e=r,t=o)}return[e,t]}_continueRedoInGroup(i){if(!i)return;let[,e]=this._findClosestRedoElementInGroup(i);if(e)return this._redo(e)}redo(i){if(i instanceof iz){let[,e]=this._findClosestRedoElementWithSource(i.id);return e?this._redo(e):void 0}return typeof i=="string"?this._redo(i):this._redo(this.getUriComparisonKey(i))}_redo(i){if(!this._editStacks.has(i))return;let e=this._editStacks.get(i),t=e.getClosestFutureElement();if(t){if(t.groupId){let[o,n]=this._findClosestRedoElementInGroup(t.groupId);if(t!==o&&n)return this._redo(n)}try{return t.type===1?this._workspaceRedo(i,t):this._resourceRedo(e,t)}finally{kRe&&this._print("redo")}}}};eZe=I([m(0,at),m(1,Ne)],eZe);var TRe=class{constructor(i){this.returnValue=i}};Ee(Ml,eZe,1);var mee=le("IMcpResourceScannerService"),iZe=class extends x{constructor(e,t){super();this.fileService=e;this.uriIdentityService=t;this.resourcesAccessQueueMap=new gt}async scanMcpServers(e,t){return this.withProfileMcpServers(e,t)}async addMcpServers(e,t,o){await this.withProfileMcpServers(t,o,n=>{let r=n.inputs??[],s=n.servers??{};for(let{name:l,config:c,inputs:u}of e)if(s[l]=c,u){let p=new Set(r.map(g=>g.id)),h=u.filter(g=>!p.has(g.id));r=[...r,...h]}return{servers:s,inputs:r,sandbox:n.sandbox}})}async updateSandboxConfig(e,t,o){await this.withProfileMcpServers(t,o,e)}async removeMcpServers(e,t,o){await this.withProfileMcpServers(t,o,n=>{for(let r of e)n.servers?.[r]&&delete n.servers[r];return n})}async withProfileMcpServers(e,t,o){return this.getResourceAccessQueue(e).queue(async()=>{t=t??2;let n={};try{let r=await this.fileService.readFile(e),s=[],l=jr(r.value.toString(),s,{allowTrailingComma:!0,allowEmptyContent:!0})||{};if(s.length>0)throw new Error("Failed to parse scanned MCP servers: "+s.join(", "));if(t===2)n=this.fromUserMcpServers(l);else if(t===6)n=this.fromWorkspaceFolderMcpServers(l);else if(t===5){let c=l;c.settings?.mcp&&(n=this.fromWorkspaceFolderMcpServers(c.settings?.mcp))}}catch(r){if(Au(r)!==1)throw r}return o&&(n=o(n??{}),t===2?await this.writeScannedMcpServers(e,n):t===6?await this.writeScannedMcpServersToWorkspaceFolder(e,n):t===5?await this.writeScannedMcpServersToWorkspace(e,n):os(t,`Invalid Target: ${p7(t)}`)),n})}async writeScannedMcpServers(e,t){t.servers&&Object.keys(t.servers).length>0||t.inputs&&t.inputs.length>0||t.sandbox!==void 0?await this.fileService.writeFile(e,qe.fromString(JSON.stringify(t,null,"	"))):await this.fileService.del(e)}async writeScannedMcpServersToWorkspaceFolder(e,t){await this.fileService.writeFile(e,qe.fromString(JSON.stringify(t,null,"	")))}async writeScannedMcpServersToWorkspace(e,t){let o;try{let n=await this.fileService.readFile(e),r=[];if(o=jr(n.value.toString(),r,{allowTrailingComma:!0,allowEmptyContent:!0}),r.length>0)throw new Error("Failed to parse scanned MCP servers: "+r.join(", "))}catch(n){if(Au(n)!==1)throw n;o={settings:{}}}o.settings||(o.settings={}),o.settings.mcp=t,await this.fileService.writeFile(e,qe.fromString(JSON.stringify(o,null,"	")))}fromUserMcpServers(e){let t={inputs:e.inputs,sandbox:e.sandbox},o=Object.entries(e.servers??{});if(o.length>0){t.servers={};for(let[n,r]of o)t.servers[n]=this.sanitizeServer(r)}return t}fromWorkspaceFolderMcpServers(e){let t={inputs:e.inputs,sandbox:e.sandbox},o=Object.entries(e.servers??{});if(o.length>0){t.servers={};for(let[n,r]of o){let s=this.sanitizeServer(r);t.servers[n]=s}}return t}sanitizeServer(e){let t;if(e.config){let o=e;t={...o.config,version:o.version,gallery:o.gallery}}else t=e;return(t.type===void 0||t.type!=="http"&&t.type!=="stdio")&&(t.type=t.command?"stdio":"http"),t}getResourceAccessQueue(e){let t=this.resourcesAccessQueueMap.get(e);return t||(t=new uh,this.resourcesAccessQueueMap.set(e,t)),t}};iZe=I([m(0,fe),m(1,ht)],iZe);Ee(mee,iZe,1);var oZe=class{constructor(i,e){this._extensionService=i;this._logService=e;this._editSessionIdentifierProviders=new Map;this._participants=[]}registerEditSessionIdentityProvider(i){if(this._editSessionIdentifierProviders.get(i.scheme))throw new Error(`A provider has already been registered for scheme ${i.scheme}`);return this._editSessionIdentifierProviders.set(i.scheme,i),Z(()=>{this._editSessionIdentifierProviders.delete(i.scheme)})}async getEditSessionIdentifier(i,e){let{scheme:t}=i.uri,o=await this.activateProvider(t);return this._logService.trace(`EditSessionIdentityProvider for scheme ${t} available: ${!!o}`),o?.getEditSessionIdentifier(i,e)}async provideEditSessionIdentityMatch(i,e,t,o){let{scheme:n}=i.uri,r=await this.activateProvider(n);return this._logService.trace(`EditSessionIdentityProvider for scheme ${n} available: ${!!r}`),r?.provideEditSessionIdentityMatch?.(i,e,t,o)}async onWillCreateEditSessionIdentity(i,e){this._logService.debug("Running onWillCreateEditSessionIdentity participants...");for(let t of this._participants)await t.participate(i,e);this._logService.debug(`Done running ${this._participants.length} onWillCreateEditSessionIdentity participants.`)}addEditSessionIdentityCreateParticipant(i){let e=ah(this._participants,i);return Z(()=>e())}async activateProvider(i){let e=i==="vscode-remote"?"file":i,t=this._editSessionIdentifierProviders.get(i);return t||(await this._extensionService.activateByEvent(`onEditSession:${e}`),this._editSessionIdentifierProviders.get(i))}};oZe=I([m(0,lt),m(1,se)],oZe);Ee(s2,oZe,1);var oCi=class{constructor(){this._providers=new Map}registerCanonicalUriProvider(i){return this._providers.set(i.scheme,i),{dispose:()=>this._providers.delete(i.scheme)}}async provideCanonicalUri(i,e,t){let o=this._providers.get(i.scheme);if(o)return o.provideCanonicalUri(i,e,t)}};Ee(oAt,oCi,1);var nCi=le("keybindingEditingService"),nZe=class extends x{constructor(e,t,o,n){super();this.textModelResolverService=e;this.textFileService=t;this.fileService=o;this.userDataProfileService=n;this.queue=new uh}addKeybinding(e,t,o){return this.queue.queue(()=>this.doEditKeybinding(e,t,o,!0))}editKeybinding(e,t,o){return this.queue.queue(()=>this.doEditKeybinding(e,t,o,!1))}resetKeybinding(e){return this.queue.queue(()=>this.doResetKeybinding(e))}removeKeybinding(e){return this.queue.queue(()=>this.doRemoveKeybinding(e))}async doEditKeybinding(e,t,o,n){let r=await this.resolveAndValidate(),s=r.object.textEditorModel;if(n)this.updateKeybinding(e,t,o,s,-1);else{let l=jr(s.getValue()),c=this.findUserKeybindingEntryIndex(e,l);this.updateKeybinding(e,t,o,s,c),e.isDefault&&e.resolvedKeybinding&&this.removeDefaultKeybinding(e,s)}try{await this.save()}finally{r.dispose()}}async doRemoveKeybinding(e){let t=await this.resolveAndValidate(),o=t.object.textEditorModel;e.isDefault?this.removeDefaultKeybinding(e,o):this.removeUserKeybinding(e,o);try{return await this.save()}finally{t.dispose()}}async doResetKeybinding(e){let t=await this.resolveAndValidate(),o=t.object.textEditorModel;e.isDefault||(this.removeUserKeybinding(e,o),this.removeUnassignedDefaultKeybinding(e,o));try{return await this.save()}finally{t.dispose()}}save(){return this.textFileService.save(this.userDataProfileService.currentProfile.keybindingsResource)}updateKeybinding(e,t,o,n,r){let{tabSize:s,insertSpaces:l}=n.getOptions(),c=n.getEOL();if(r!==-1){this.applyEditsToBuffer(Mb(n.getValue(),[r,"key"],t,{tabSize:s,insertSpaces:l,eol:c})[0],n);let u=Mb(n.getValue(),[r,"when"],o,{tabSize:s,insertSpaces:l,eol:c});u.length>0&&this.applyEditsToBuffer(u[0],n)}else this.applyEditsToBuffer(Mb(n.getValue(),[-1],this.asObject(t,e.command,o,!1),{tabSize:s,insertSpaces:l,eol:c})[0],n)}removeUserKeybinding(e,t){let{tabSize:o,insertSpaces:n}=t.getOptions(),r=t.getEOL(),s=jr(t.getValue()),l=this.findUserKeybindingEntryIndex(e,s);l!==-1&&this.applyEditsToBuffer(Mb(t.getValue(),[l],void 0,{tabSize:o,insertSpaces:n,eol:r})[0],t)}removeDefaultKeybinding(e,t){let{tabSize:o,insertSpaces:n}=t.getOptions(),r=t.getEOL(),s=e.resolvedKeybinding?e.resolvedKeybinding.getUserSettingsLabel():null;if(s){let l=this.asObject(s,e.command,e.when?e.when.serialize():void 0,!0);jr(t.getValue()).every(u=>!this.areSame(u,l))&&this.applyEditsToBuffer(Mb(t.getValue(),[-1],l,{tabSize:o,insertSpaces:n,eol:r})[0],t)}}removeUnassignedDefaultKeybinding(e,t){let{tabSize:o,insertSpaces:n}=t.getOptions(),r=t.getEOL(),s=jr(t.getValue()),l=this.findUnassignedDefaultKeybindingEntryIndex(e,s).reverse();for(let c of l)this.applyEditsToBuffer(Mb(t.getValue(),[c],void 0,{tabSize:o,insertSpaces:n,eol:r})[0],t)}findUserKeybindingEntryIndex(e,t){for(let o=0;o<t.length;o++){let n=t[o];if(n.command===e.command){if(!n.when&&!e.when)return o;if(n.when&&e.when){let r=C.deserialize(n.when);if(r&&r.serialize()===e.when.serialize())return o}}}return-1}findUnassignedDefaultKeybindingEntryIndex(e,t){let o=[];for(let n=0;n<t.length;n++)t[n].command===`-${e.command}`&&o.push(n);return o}asObject(e,t,o,n){let r={key:e};return t&&(r.command=n?`-${t}`:t),o&&(r.when=o),r}areSame(e,t){if(e.command!==t.command||e.key!==t.key)return!1;let o=C.deserialize(e.when),n=C.deserialize(t.when);return!(o&&!n||!o&&n||o&&n&&!o.equals(n)||!eo(e.args,t.args))}applyEditsToBuffer(e,t){let o=t.getPositionAt(e.offset),n=t.getPositionAt(e.offset+e.length),r=new z(o.lineNumber,o.column,n.lineNumber,n.column),l=t.getValueInRange(r)?Hn.replace(r,e.content):Hn.insert(o,e.content);t.pushEditOperations([new ti(o.lineNumber,o.column,o.lineNumber,o.column)],[l],()=>[])}async resolveModelReference(){return await this.fileService.exists(this.userDataProfileService.currentProfile.keybindingsResource)||await this.textFileService.write(this.userDataProfileService.currentProfile.keybindingsResource,this.getEmptyContent(),{encoding:"utf8"}),this.textModelResolverService.createModelReference(this.userDataProfileService.currentProfile.keybindingsResource)}async resolveAndValidate(){if(this.textFileService.isDirty(this.userDataProfileService.currentProfile.keybindingsResource))throw new Error(d(17824,null));let e=await this.resolveModelReference(),t=e.object.textEditorModel,o=t.getEOL();if(t.getValue()){let n=this.parse(t);if(n.parseErrors.length)throw e.dispose(),new Error(d(17825,null));if(n.result){if(!Array.isArray(n.result))throw e.dispose(),new Error(d(17823,null))}else{let r=o+"[]";this.applyEditsToBuffer({content:r,length:r.length,offset:t.getValue().length},t)}}else{let n=this.getEmptyContent();this.applyEditsToBuffer({content:n,length:n.length,offset:0},t)}return e}parse(e){let t=[];return{result:jr(e.getValue(),t,{allowTrailingComma:!0,allowEmptyContent:!0}),parseErrors:t}}getEmptyContent(){return"// "+d(17822,null)+`
[
]`}};nZe=I([m(0,Bt),m(1,Uo),m(2,fe),m(3,ln)],nZe);Ee(nCi,nZe,1);var fVt=class a{constructor(i,e,t){this.themeService=i;this._refCounter=0;this.data=e;let o=_r(t).toString(36);this.itemColorClassName=`${a._classNamesPrefix}-itemColor-${o}`,this.itemBadgeClassName=`${a._classNamesPrefix}-itemBadge-${o}`,this.bubbleBadgeClassName=`${a._classNamesPrefix}-bubbleBadge-${o}`,this.iconBadgeClassName=`${a._classNamesPrefix}-iconBadge-${o}`}static keyOf(i){if(Array.isArray(i))return i.map(a.keyOf).join(",");{let{color:e,letter:t}=i;return q.isThemeIcon(t)?`${e}+${t.id}`:`${e}/${t}`}}static{this._classNamesPrefix="monaco-decoration"}acquire(){this._refCounter+=1}release(){return--this._refCounter===0}appendCSSRules(i){Array.isArray(this.data)?this._appendForMany(this.data,i):this._appendForOne(this.data,i)}_appendForOne(i,e){let{color:t,letter:o}=i;$h(`.${this.itemColorClassName}`,`color: ${nme(t)};`,e),q.isThemeIcon(o)?this._createIconCSSRule(o,t,e):o&&$h(`.${this.itemBadgeClassName}::after`,`content: "${o}"; color: ${nme(t)};`,e)}_appendForMany(i,e){let{color:t}=i.find(r=>!!r.color)??i[0];$h(`.${this.itemColorClassName}`,`color: ${nme(t)};`,e);let o=[],n;for(let r of i)if(q.isThemeIcon(r.letter)){n=r.letter;break}else r.letter&&o.push(r.letter);n?this._createIconCSSRule(n,t,e):(o.length&&$h(`.${this.itemBadgeClassName}::after`,`content: "${o.join(", ")}"; color: ${nme(t)};`,e),$h(`.${this.bubbleBadgeClassName}::after`,`content: "\uEA71"; color: ${nme(t)}; font-family: codicon; font-size: 14px; margin-right: 14px; opacity: 0.4;`,e))}_createIconCSSRule(i,e,t){let o=q.getModifier(i);o&&(i=q.modify(i,void 0));let n=mw().getIcon(i.id);if(!n)return;let r=this.themeService.getProductIconTheme().getIcon(n);r&&$h(`.${this.iconBadgeClassName}::after`,`content: '${r.fontCharacter}';
			color: ${i.color?nme(i.color.id):nme(e)};
			font-family: ${tI(r.font?.id??"codicon")};
			font-size: 16px;
			margin-right: 14px;
			font-weight: normal;
			${o==="spin"?"animation: codicon-spin 1.5s steps(30) infinite; font-style: normal !important; transform-origin: center center;":""};
			`,t)}removeCSSRules(i){IO(this.itemColorClassName,i),IO(this.itemBadgeClassName,i),IO(this.bubbleBadgeClassName,i),IO(this.iconBadgeClassName,i)}},rCi=class{constructor(i){this._themeService=i;this._dispoables=new N;this._styleElement=Cr(void 0,void 0,this._dispoables);this._decorationRules=new Map}dispose(){this._dispoables.dispose()}asDecoration(i,e){i.sort((u,p)=>(p.weight||0)-(u.weight||0));let t=fVt.keyOf(i),o=this._decorationRules.get(t);o||(o=new fVt(this._themeService,i,t),this._decorationRules.set(t,o),o.appendCSSRules(this._styleElement)),o.acquire();let n=o.itemColorClassName,r=o.itemBadgeClassName,s=o.iconBadgeClassName,l=zo(i.filter(u=>!uc(u.tooltip)).map(u=>u.tooltip)).join(" \u2022 "),c=i.some(u=>u.strikethrough);return e&&(r=o.bubbleBadgeClassName,l=d(17500,null)),{labelClassName:n,badgeClassName:r,iconClassName:s,strikethrough:c,tooltip:l,dispose:()=>{o?.release()&&(this._decorationRules.delete(t),o.removeCSSRules(this._styleElement),o=void 0)}}}},sCi=class{constructor(i){this._data=Sp.forUris(i=>!0);this._data.fill(!0,cc(i))}affectsResource(i){return this._data.hasElementOrSubtree(i)}},_Re=class{constructor(i,e){this.source=i;this.thenable=e}};function nme(a){return a?kt(a):"inherit"}var rZe=class{constructor(i,e){this._store=new N;this._onDidChangeDecorationsDelayed=this._store.add(new ZSe({merge:i=>i.flat()}));this._onDidChangeDecorations=this._store.add(new E);this.onDidChangeDecorations=this._onDidChangeDecorations.event;this._provider=new qs;this._decorationStyles=new rCi(e),this._data=Sp.forUris(t=>i.extUri.ignorePathCasing(t)),this._store.add(this._onDidChangeDecorationsDelayed.event(t=>{this._onDidChangeDecorations.fire(new sCi(t))}))}dispose(){this._store.dispose(),this._data.clear()}registerDecorationsProvider(i){let e=this._provider.unshift(i);this._onDidChangeDecorations.fire({affectsResource(){return!0}});let t=()=>{let n=[];for(let[r,s]of this._data)s.delete(i)&&n.push(r);n.length>0&&this._onDidChangeDecorationsDelayed.fire(n)},o=i.onDidChange(n=>{if(!n)t();else for(let r of n){let s=this._ensureEntry(r);this._fetchData(s,r,i)}});return Z(()=>{e(),o.dispose(),t()})}_ensureEntry(i){let e=this._data.get(i);return e||(e=new Map,this._data.set(i,e)),e}getDecoration(i,e){let t=[],o=!1,n=this._ensureEntry(i);for(let r of this._provider){let s=n.get(r);s===void 0&&(s=this._fetchData(n,i,r)),s&&!(s instanceof _Re)&&t.push(s)}if(e){let r=this._data.findSuperstr(i);if(r)for(let s of r)for(let l of s[1].values())l&&!(l instanceof _Re)&&l.bubble&&(t.push(l),o=!0)}return t.length===0?void 0:this._decorationStyles.asDecoration(t,o)}_fetchData(i,e,t){let o=i.get(t);o instanceof _Re&&(o.source.cancel(),i.delete(t));let n=new Ye,r=t.provideDecorations(e,n.token);if(f_(r)){let s=new _Re(n,Promise.resolve(r).then(l=>{i.get(t)===s&&this._keepItem(i,t,e,l)}).catch(l=>{!ao(l)&&i.get(t)===s&&i.delete(t)}).finally(()=>{n.dispose()}));return i.set(t,s),null}else return n.dispose(),this._keepItem(i,t,e,r)}_keepItem(i,e,t,o){let n=o||null,r=i.get(e);return i.set(e,n),(n||r)&&this._onDidChangeDecorationsDelayed.fire(t),n}};rZe=I([m(0,ht),m(1,Le)],rZe);Ee(Ov,rZe,1);var vVt=class extends x{constructor(){super(...arguments);this.dialogs=[];this._onWillShowDialog=this._register(new E);this.onWillShowDialog=this._onWillShowDialog.event;this._onDidShowDialog=this._register(new E);this.onDidShowDialog=this._onDidShowDialog.event}show(e){let t=new Ko,o={args:e,close:n=>{this.dialogs.splice(0,1),n instanceof Error?t.error(n):t.complete(n),this._onDidShowDialog.fire()}};return this.dialogs.push(o),this._onWillShowDialog.fire(),{item:o,result:t.p}}};var sZe=class extends x{constructor(e,t){super();this.environmentService=e;this.logService=t;this.model=this._register(new vVt);this.onWillShowDialog=this.model.onWillShowDialog;this.onDidShowDialog=this.model.onDidShowDialog}skipDialogs(){return this.environmentService.enableSmokeTestDriver&&this.logService.warn("DialogService: Dialog requested during smoke test."),this.environmentService.isExtensionDevelopment&&!!this.environmentService.extensionTestsLocationURI}async confirm(e){return this.skipDialogs()?(this.logService.trace("DialogService: refused to show confirmation dialog in tests."),{confirmed:!0}):await this.model.show({confirmArgs:{confirmation:e}}).result}async prompt(e){if(this.skipDialogs())throw new Error(`DialogService: refused to show dialog in tests. Contents: ${e.message}`);let o=await this.model.show({promptArgs:{prompt:e}}).result;return{result:await o.result,checkboxChecked:o.checkboxChecked}}async input(e){if(this.skipDialogs())throw new Error("DialogService: refused to show input dialog in tests.");return await this.model.show({inputArgs:{input:e}}).result}async info(e,t){await this.prompt({type:bt.Info,message:e,detail:t})}async warn(e,t){await this.prompt({type:bt.Warning,message:e,detail:t})}async error(e,t){await this.prompt({type:bt.Error,message:e,detail:t})}async about(){if(this.skipDialogs())throw new Error("DialogService: refused to show about dialog in tests.");await this.model.show({}).result}};sZe=I([m(0,At),m(1,se)],sZe);Ee(at,sZe,1);var hee=class extends x{constructor(e,t,o,n){super();this.container=e;this.message=t;this.options=n;if(this.modalElement=this.container.appendChild(_(".monaco-dialog-modal-block.dimmed")),this._register(Jo(this.modalElement,re.CLICK,c=>{c.target===this.modalElement&&this.element.focus()})),this.shadowElement=this.modalElement.appendChild(_(".dialog-shadow")),this.element=this.shadowElement.appendChild(_(".monaco-dialog-box")),n.alignment===1&&this.element.classList.add("align-vertical"),n.extraClasses&&this.element.classList.add(...n.extraClasses),this.element.setAttribute("role","dialog"),this.element.tabIndex=-1,vo(this.element),this.options.renderFooter){this.footerContainer=this.element.appendChild(_(".dialog-footer-row"));let c=this.footerContainer.appendChild(_("#monaco-dialog-footer.dialog-footer"));this.options.renderFooter(c);for(let u of this.footerContainer.querySelectorAll("a"))u.tabIndex=0}this.buttonStyles=n.buttonStyles,Array.isArray(o)&&o.length>0?this.buttons=o:this.options.disableDefaultAction?this.buttons=[]:this.buttons=[d(7,null)];let r=this.element.appendChild(_(".dialog-buttons-row"));this.buttonsContainer=r.appendChild(_(".dialog-buttons"));let s=this.element.appendChild(_(".dialog-message-row"));if(this.iconElement=s.appendChild(_("#monaco-dialog-icon.dialog-icon")),this.iconElement.setAttribute("aria-label",this.getIconAriaLabel()),this.messageContainer=s.appendChild(_(".dialog-message-container")),this.options.detail||this.options.renderBody){let u=this.messageContainer.appendChild(_(".dialog-message")).appendChild(_("#monaco-dialog-message-text.dialog-message-text"));u.innerText=this.message}if(this.messageDetailElement=this.messageContainer.appendChild(_("#monaco-dialog-message-detail.dialog-message-detail")),this.options.detail||!this.options.renderBody?this.messageDetailElement.innerText=this.options.detail?this.options.detail:t:this.messageDetailElement.style.display="none",this.options.renderBody){let c=this.messageContainer.appendChild(_("#monaco-dialog-message-body.dialog-message-body"));this.options.renderBody(c);for(let u of this.messageContainer.querySelectorAll("a"))u.tabIndex=0}if(this.options.inputs?this.inputs=this.options.inputs.map(c=>{let u=this.messageContainer.appendChild(_(".dialog-message-input")),p=this._register(new Vc(u,void 0,{placeholder:c.placeholder,type:c.type??"text",inputBoxStyles:n.inputBoxStyles}));return c.value&&(p.value=c.value),p}):this.inputs=[],this.options.checkboxLabel){let c=this.messageContainer.appendChild(_(".dialog-checkbox-row")),u=this.checkbox=this._register(new Ev(this.options.checkboxLabel,!!this.options.checkboxChecked,n.checkboxStyles));c.appendChild(u.domNode);let p=c.appendChild(_(".dialog-checkbox-message"));p.innerText=this.options.checkboxLabel,this._register(j(p,re.CLICK,()=>u.checked=!u.checked))}let l=this.element.appendChild(_(".dialog-toolbar-row"));this.toolbarContainer=l.appendChild(_(".dialog-toolbar")),this.applyStyles()}getIconAriaLabel(){let e=d(4,null);switch(this.options.type){case"error":e=d(3,null);break;case"warning":e=d(6,null);break;case"pending":e=d(5,null);break;default:break}return e}updateMessage(e){this.messageDetailElement.innerText=e}async show(){return this.focusToReturn=this.container.ownerDocument.activeElement,new Promise(e=>{Rt(this.buttonsContainer);let t=()=>{e({button:this.options.cancelId||0,checkboxChecked:this.checkbox?this.checkbox.checked:void 0})};this._register(Z(t));let o=this.buttonBar=this._register(new Sw(this.buttonsContainer,{alignment:this.options?.alignment===1?1:0})),n=this.rearrangeButtons(this.buttons,this.options.cancelId),r=u=>{e({button:n[u].index,checkboxChecked:this.checkbox?this.checkbox.checked:void 0,values:this.inputs.length>0?this.inputs.map(p=>p.value):void 0})};n.forEach((u,p)=>{let h=n[p].index===0,g,f=this.options.buttonOptions?.[n[p]?.index];if(h&&this.options?.primaryButtonDropdown){let v=A6i(this.options.primaryButtonDropdown.actions)?this.options.primaryButtonDropdown.actions.getActions():this.options.primaryButtonDropdown.actions;g=this._register(o.addButtonWithDropdown({...this.options.primaryButtonDropdown,...this.buttonStyles,dropdownLayer:2600,actions:v.map(b=>ii({...b,run:async()=>{await b.run(),r(p)}}))}))}else f?.sublabel?g=this._register(o.addButtonWithDescription({secondary:!h,...this.buttonStyles})):g=this._register(o.addButton({secondary:!h,...this.buttonStyles}));f?.styleButton&&f.styleButton(g),g.label=vj(n[p].label,!0),g instanceof $4e&&f?.sublabel&&(g.description=f?.sublabel),this._register(g.onDidClick(v=>{v&&Xt.stop(v),r(p)}))});let s=Re(this.container),l=!1;this._register(j(s,"keydown",u=>{let p=new gi(u);if(p.equals(9)&&(l=!0),p.equals(512)&&p.preventDefault(),p.equals(3)){this.inputs.some(g=>g.hasFocus())&&(Xt.stop(u),e({button:n.find(g=>g.index!==this.options.cancelId)?.index??0,checkboxChecked:this.checkbox?this.checkbox.checked:void 0,values:this.inputs.length>0?this.inputs.map(g=>g.value):void 0}));return}if(Ze&&p.equals(2082)){Xt.stop(u);let g=n.find(f=>f.index===1&&f.index!==this.options.cancelId);g&&e({button:g.index,checkboxChecked:this.checkbox?this.checkbox.checked:void 0,values:this.inputs.length>0?this.inputs.map(f=>f.value):void 0});return}if(p.equals(10))return;let h=!1;if(p.equals(2)||p.equals(17)||p.equals(1026)||p.equals(15)){let g=[],f=-1;if(this.messageContainer){let v=this.messageContainer.querySelectorAll("a");for(let b of v)g.push(b),wa(b)&&(f=g.length-1)}for(let v of this.inputs)g.push(v),v.hasFocus()&&(f=g.length-1);if(this.checkbox&&(g.push(this.checkbox),this.checkbox.hasFocus()&&(f=g.length-1)),this.buttonBar)for(let v of this.buttonBar.buttons)v instanceof ry?(g.push(v.primaryButton),v.primaryButton.hasFocus()&&(f=g.length-1),g.push(v.dropdownButton),v.dropdownButton.hasFocus()&&(f=g.length-1)):(g.push(v),v.hasFocus()&&(f=g.length-1));if(this.footerContainer){let v=this.footerContainer.querySelectorAll("a");for(let b of v)g.push(b),wa(b)&&(f=g.length-1)}if(p.equals(2)||p.equals(17)){let v=(f+1)%g.length;g[v].focus()}else{f===-1&&(f=g.length);let v=f-1;v===-1&&(v=g.length-1),g[v].focus()}h=!0}h?Xt.stop(u,!0):this.options.keyEventProcessor&&this.options.keyEventProcessor(p)},!0)),this._register(j(s,"keyup",u=>{Xt.stop(u,!0);let p=new gi(u);!this.options.disableCloseAction&&p.equals(9)&&l&&t()},!0)),this._register(j(this.element,"focusout",u=>{u.relatedTarget&&this.element&&(ts(u.relatedTarget,this.element)||(this.focusToReturn=u.relatedTarget,u.target&&(u.target.focus(),Xt.stop(u,!0))))},!1));let c="codicon-modifier-spin";if(this.iconElement.classList.remove(...q.asClassNameArray(R.dialogError),...q.asClassNameArray(R.dialogWarning),...q.asClassNameArray(R.dialogInfo),...q.asClassNameArray(R.loading),c),this.options.icon)this.iconElement.classList.add(...q.asClassNameArray(this.options.icon));else switch(this.options.type){case"error":this.iconElement.classList.add(...q.asClassNameArray(R.dialogError));break;case"warning":this.iconElement.classList.add(...q.asClassNameArray(R.dialogWarning));break;case"pending":this.iconElement.classList.add(...q.asClassNameArray(R.loading),c);break;case"none":this.iconElement.classList.add("no-codicon");break;default:this.iconElement.classList.add(...q.asClassNameArray(R.dialogInfo));break}if(!this.options.disableCloseAction&&!this.options.disableCloseButton){let u=this._register(new Zi(this.toolbarContainer,{})),p=this._register(new it("dialog.close",d(2,null),q.asClassName(R.dialogClose),!0,async()=>{e({button:this.options.cancelId||0,checkboxChecked:this.checkbox?this.checkbox.checked:void 0})}));u.push(p,{icon:!0,label:!1})}this.applyStyles(),this.element.setAttribute("aria-modal","true"),this.element.setAttribute("aria-labelledby","monaco-dialog-icon monaco-dialog-message-text"),this.element.setAttribute("aria-describedby","monaco-dialog-icon monaco-dialog-message-text monaco-dialog-message-detail monaco-dialog-message-body monaco-dialog-footer"),un(this.element),this.options.onVisibilityChange?.(s,!0),this._register(Z(()=>this.options.onVisibilityChange?.(s,!1))),this.inputs.length>0?(this.inputs[0].focus(),this.inputs[0].select()):n.forEach((u,p)=>{u.index===0&&o.buttons[p].focus()})})}applyStyles(){let e=this.options.dialogStyles,t=e.dialogForeground,o=e.dialogBackground,n=e.dialogShadow?`0 0px 8px ${e.dialogShadow}`:"",r=e.dialogBorder?`1px solid ${e.dialogBorder}`:"",s=e.textLinkForeground;if(this.shadowElement.style.boxShadow=n,this.element.style.color=t??"",this.element.style.backgroundColor=o??"",this.element.style.border=r,s)for(let c of[...this.messageContainer.getElementsByTagName("a"),...this.footerContainer?.getElementsByTagName("a")??[]])c.style.color=s;let l;switch(this.options.type){case"none":break;case"error":l=e.errorIconForeground;break;case"warning":l=e.warningIconForeground;break;default:l=e.infoIconForeground;break}l&&(this.iconElement.style.color=l)}dispose(){super.dispose(),this.modalElement&&(this.modalElement.remove(),this.modalElement=void 0),this.focusToReturn&&ts(this.focusToReturn,this.container.ownerDocument.body)&&(this.focusToReturn.focus(),this.focusToReturn=void 0)}rearrangeButtons(e,t){let o=e.map((n,r)=>({label:n,index:r}));if(e.length<2||this.options.alignment===1)return o;if(Ze||fn){if(typeof t=="number"&&o[t]){let n=o.splice(t,1)[0];o.splice(1,0,n)}o.reverse()}else if(ei&&typeof t=="number"&&o[t]){let n=o.splice(t,1)[0];o.push(n)}return o}};var h9o=new Set(["workbench.action.quit","workbench.action.reloadWindow","copy","cut","editor.action.selectAll","editor.action.clipboardCopyAction","editor.action.clipboardCutAction","editor.action.clipboardPasteAction"]);function DRe(a,i,e,t,o=h9o){return{keyEventProcessor:n=>{let r=i.softDispatch(n,e.activeContainer);r.kind===2&&r.commandId&&(o.has(r.commandId)||Xt.stop(n,!0))},buttonStyles:Qo,checkboxStyles:qf,inputBoxStyles:Cl,dialogStyles:z6i,onVisibilityChange:(n,r)=>t.setWindowDimmed(n,r),...a}}var aZe=class extends x{constructor(e,t,o,n,r,s,l,c,u,p){super();this.activityService=e;this.paneCompositeService=t;this.viewDescriptorService=o;this.viewsService=n;this.notificationService=r;this.statusbarService=s;this.layoutService=l;this.keybindingService=c;this.userActivityService=u;this.hostService=p;this.windowProgressStack=[];this.windowProgressStatusEntry=void 0}async withProgress(e,t,o){let{location:n}=e,r=async l=>{let c=this.userActivityService.markActive({extendOnly:!0,whenHeldFor:15e3});try{return await t(l)}finally{c.dispose()}},s=l=>{let c=this.viewDescriptorService.getViewContainerById(l);if(c){let u=this.viewDescriptorService.getViewContainerLocation(c);if(u!==null)return this.withPaneCompositeProgress(l,u,r,{...e,location:l})}if(this.viewDescriptorService.getViewDescriptorById(l)!==null)return this.withViewProgress(l,r,{...e,location:l});throw new Error(`Bad progress location: ${l}`)};if(typeof n=="string")return s(n);switch(n){case 15:{let l=e.priority;return l!==3&&(this.notificationService.getFilter()===1?l=2:H7(e.source)&&this.notificationService.getFilter(e.source)===1&&(l=2)),this.withNotificationProgress({...e,location:n,priority:l},r,o)}case 10:{let l=e.type;return e.command?this.withWindowProgress({...e,location:n,type:l},r):this.withNotificationProgress({delay:150,...e,priority:2,location:15,type:l},r,o)}case 1:return this.withPaneCompositeProgress("workbench.view.explorer",0,r,{...e,location:n});case 3:return s("workbench.scm");case 5:return this.withPaneCompositeProgress("workbench.view.extensions",0,r,{...e,location:n});case 20:return this.withDialogProgress(e,r,o);default:throw new Error(`Bad progress location: ${n}`)}}withWindowProgress(e,t){let o=[e,new Mm(()=>this.updateWindowProgress())],n=t(o[1]),r=setTimeout(()=>{r=void 0,this.windowProgressStack.unshift(o),this.updateWindowProgress(),Promise.all([Li(150),n]).finally(()=>{let s=this.windowProgressStack.indexOf(o);this.windowProgressStack.splice(s,1),this.updateWindowProgress()})},150);return n.finally(()=>clearTimeout(r))}updateWindowProgress(e=0){if(e<this.windowProgressStack.length){let[t,o]=this.windowProgressStack[e],n=t.title,r=o.value?.message,s=t.command,l,c,u=t.source&&typeof t.source!="string"?t.source.label:t.source;if(n&&r)l=d(17925,null,n,r),c=u?d(17927,null,u,n,r):l;else if(n)l=n,c=u?d(17926,null,u,n):l;else if(r)l=r,c=u?d(17926,null,u,r):l;else{this.updateWindowProgress(e+1);return}let p={name:d(17928,null),text:l,showProgress:t.type||!0,ariaLabel:l,tooltip:Nu(c).trim(),command:s};this.windowProgressStatusEntry?this.windowProgressStatusEntry.update(p):this.windowProgressStatusEntry=this.statusbarService.addEntry(p,"status.progress",0,-Number.MAX_VALUE)}else this.windowProgressStatusEntry?.dispose(),this.windowProgressStatusEntry=void 0}withNotificationProgress(e,t,o){let n=new class extends x{constructor(){super();this._onDidReport=this._register(new E);this.onDidReport=this._onDidReport.event;this._onWillDispose=this._register(new E);this.onWillDispose=this._onWillDispose.event;this._step=void 0;this._done=!1;this.promise=t(this),this.promise.finally(()=>{this.dispose()})}get step(){return this._step}get done(){return this._done}report(v){this._step=v,this._onDidReport.fire(v)}cancel(v){o?.(v),this.dispose()}dispose(){this._done=!0,this._onWillDispose.fire(),super.dispose()}},r=()=>{let f=new Ko;return this.withWindowProgress({location:10,title:e.title?ES(e.title).toString():void 0,command:"notifications.showList",type:e.type},v=>{function b(y){y.message&&v.report({message:ES(y.message).toString()})}n.step&&b(n.step);let S=n.onDidReport(y=>b(y));return f.p.finally(()=>S.dispose()),U.once(n.onWillDispose)(()=>f.complete()),f.p}),Z(()=>f.complete())},s=(f,v,b)=>{let S=new N,y=e.primaryActions?Array.from(e.primaryActions):[],w=e.secondaryActions?Array.from(e.secondaryActions):[];if(e.buttons&&e.buttons.forEach((O,V)=>{let H=new class extends it{constructor(){super(`progress.button.${O}`,O,void 0,!0)}async run(){n.cancel(V)}};S.add(H),y.push(H)}),e.cancellable){let O=new class extends it{constructor(){super("progress.cancel",typeof e.cancellable=="string"?e.cancellable:d(17923,null),void 0,!0)}async run(){n.cancel()}};S.add(O),y.push(O)}let k=this.notificationService.notify({severity:ft.Info,message:Nu(f),source:e.source,actions:{primary:y,secondary:w},progress:typeof b=="number"&&b>=0?{total:100,worked:b}:{infinite:!0},priority:v}),T,P=O=>{Be(T),!O&&!n.done&&(T=r())};return S.add(k.onDidChangeVisibility(P)),v===2&&P(!1),U.once(k.onDidClose)(()=>{S.dispose(),Be(T)}),k},l=(f,v)=>{typeof v=="number"&&v>=0?(f.progress.total(100),f.progress.worked(v)):f.progress.infinite()},c,u,p,h=f=>{f?.message&&e.title?p=`${e.title}: ${f.message}`:p=e.title||f?.message,!c&&p&&(typeof e.delay=="number"&&e.delay>0?u===void 0&&(u=setTimeout(()=>c=s(p,e.priority,f?.increment),e.delay)):c=s(p,e.priority,f?.increment)),c&&(p&&c.updateMessage(p),typeof f?.increment=="number"&&l(c,f.increment))};h(n.step);let g=n.onDidReport(f=>h(f));return U.once(n.onWillDispose)(()=>g.dispose()),(async()=>{try{typeof e.delay=="number"&&e.delay>0?await n.promise:await Promise.all([Li(800),n.promise])}finally{clearTimeout(u),c?.close()}})(),n.promise}withPaneCompositeProgress(e,t,o,n){let r=this.paneCompositeService.getProgressIndicator(e,t),s=r?this.withCompositeProgress(r,o,n):o({report:()=>{}});return t===0&&this.showOnActivityBar(e,n,s),s}withViewProgress(e,t,o){let n=this.viewsService.getViewProgressIndicator(e),r=n?this.withCompositeProgress(n,t,o):t({report:()=>{}}),s=this.viewDescriptorService.getViewContainerByViewId(e)?.id;return s===void 0||this.showOnActivityBar(s,o,r),r}showOnActivityBar(e,t,o){let n,r=setTimeout(()=>{r=void 0;let s=this.activityService.showViewContainerActivity(e,{badge:new sx(()=>"")}),l=Date.now(),c=300;n={dispose(){let u=Date.now()-l;u<c?setTimeout(()=>s.dispose(),c-u):s.dispose()}}},t.delay||300);o.finally(()=>{clearTimeout(r),Be(n)})}withCompositeProgress(e,t,o){let n;function r(l){let c,u;return typeof l<"u"&&(typeof l=="number"?c=l:typeof l.increment=="number"&&(c=l.total??100,u=l.increment)),typeof c=="number"?(n||(n=e.show(c,o.delay),s.catch(()=>{}).finally(()=>n?.done())),typeof u=="number"&&n.worked(u)):(n?.done(),e.showWhile(s,o.delay)),n}let s=t({report:l=>{r(l)}});return r(o.total),s}withDialogProgress(e,t,o){let n=new N,r,s=!1,l=f=>{let v=e.buttons||[];return e.sticky||v.push(e.cancellable?typeof e.cancellable=="boolean"?d(17923,null):e.cancellable:d(17924,null)),r=new hee(this.layoutService.activeContainer,f,v,DRe({type:"pending",detail:e.detail,cancelId:v.length-1,disableCloseAction:e.sticky,disableDefaultAction:e.sticky},this.keybindingService,this.layoutService,this.hostService)),n.add(r),r.show().then(b=>{s||o?.(b.button),Be(r)}),r},c=e.delay??0,u,p=n.add(new Dt(()=>{c=0,u&&!r?r=l(u):u&&r.updateMessage(u)},0)),h=function(f){u=f,p.isScheduled()||p.schedule(c)},g=t({report:f=>{h(f.message)}});return g.finally(()=>{s=!0,Be(n)}),e.title&&h(e.title),g}};aZe=I([m(0,Sl),m(1,us),m(2,Bi),m(3,$t),m(4,Ne),m(5,kr),m(6,Kl),m(7,_e),m(8,$ue),m(9,Zt)],aZe);Ee(Fo,aZe,1);var LRe=class extends x{constructor(e){super();this._themeService=e;this._onWillCreateCodeEditor=this._register(new E);this.onWillCreateCodeEditor=this._onWillCreateCodeEditor.event;this._onCodeEditorAdd=this._register(new E);this.onCodeEditorAdd=this._onCodeEditorAdd.event;this._onCodeEditorRemove=this._register(new E);this.onCodeEditorRemove=this._onCodeEditorRemove.event;this._onWillCreateDiffEditor=this._register(new E);this.onWillCreateDiffEditor=this._onWillCreateDiffEditor.event;this._onDiffEditorAdd=this._register(new E);this.onDiffEditorAdd=this._onDiffEditorAdd.event;this._onDiffEditorRemove=this._register(new E);this.onDiffEditorRemove=this._onDiffEditorRemove.event;this._onDidChangeTransientModelProperty=this._register(new E);this.onDidChangeTransientModelProperty=this._onDidChangeTransientModelProperty.event;this._onDecorationTypeRegistered=this._register(new E);this.onDecorationTypeRegistered=this._onDecorationTypeRegistered.event;this._decorationOptionProviders=new Map;this._editorStyleSheets=new Map;this._codeEditorOpenHandlers=new qs;this._transientWatchers=this._register(new Vt);this._modelProperties=new Map;this._codeEditors=Object.create(null),this._diffEditors=Object.create(null),this._globalStyleSheet=null}willCreateCodeEditor(){this._onWillCreateCodeEditor.fire()}addCodeEditor(e){this._codeEditors[e.getId()]=e,this._onCodeEditorAdd.fire(e)}removeCodeEditor(e){delete this._codeEditors[e.getId()]&&this._onCodeEditorRemove.fire(e)}listCodeEditors(){return Object.keys(this._codeEditors).map(e=>this._codeEditors[e])}willCreateDiffEditor(){this._onWillCreateDiffEditor.fire()}addDiffEditor(e){this._diffEditors[e.getId()]=e,this._onDiffEditorAdd.fire(e)}removeDiffEditor(e){delete this._diffEditors[e.getId()]&&this._onDiffEditorRemove.fire(e)}listDiffEditors(){return Object.keys(this._diffEditors).map(e=>this._diffEditors[e])}getFocusedCodeEditor(){let e=null,t=this.listCodeEditors();for(let o of t){if(o.hasTextFocus())return o;o.hasWidgetFocus()&&(e=o)}return e}_getOrCreateGlobalStyleSheet(){return this._globalStyleSheet||(this._globalStyleSheet=this._createGlobalStyleSheet()),this._globalStyleSheet}_createGlobalStyleSheet(){return new cCi(Cr())}_getOrCreateStyleSheet(e){if(!e)return this._getOrCreateGlobalStyleSheet();let t=e.getContainerDomNode();if(!$$(t))return this._getOrCreateGlobalStyleSheet();let o=e.getId();if(!this._editorStyleSheets.has(o)){let n=new lCi(this,o,Cr(t));this._editorStyleSheets.set(o,n)}return this._editorStyleSheets.get(o)}_removeEditorStyleSheets(e){this._editorStyleSheets.delete(e)}registerDecorationType(e,t,o,n,r){let s=this._decorationOptionProviders.get(t);if(!s){let l=this._getOrCreateStyleSheet(r),c={styleSheet:l,key:t,parentTypeKey:n,options:o||Object.create(null)};n?s=new dCi(this._themeService,l,c):s=new uCi(e,this._themeService,l,c),this._decorationOptionProviders.set(t,s),this._onDecorationTypeRegistered.fire(t)}return s.refCount++,{dispose:()=>{this.removeDecorationType(t)}}}listDecorationTypes(){return Array.from(this._decorationOptionProviders.keys())}removeDecorationType(e){let t=this._decorationOptionProviders.get(e);t&&(t.refCount--,t.refCount<=0&&(this._decorationOptionProviders.delete(e),t.dispose(),this.listCodeEditors().forEach(o=>o.removeDecorationsByType(e))))}resolveDecorationOptions(e,t){let o=this._decorationOptionProviders.get(e);if(!o)throw new Error("Unknown decoration type key: "+e);return o.getOptions(this,t)}resolveDecorationCSSRules(e){let t=this._decorationOptionProviders.get(e);return t?t.resolveDecorationCSSRules():null}setModelProperty(e,t,o){let n=e.toString(),r;this._modelProperties.has(n)?r=this._modelProperties.get(n):(r=new Map,this._modelProperties.set(n,r)),r.set(t,o)}getModelProperty(e,t){let o=e.toString();if(this._modelProperties.has(o))return this._modelProperties.get(o).get(t)}setTransientModelProperty(e,t,o){let n=e.uri.toString(),r=this._transientWatchers.get(n);r||(r=new aCi(n,e,this),this._transientWatchers.set(n,r)),r.get(t)!==o&&(r.set(t,o),this._onDidChangeTransientModelProperty.fire(e))}getTransientModelProperty(e,t){let o=e.uri.toString(),n=this._transientWatchers.get(o);if(n)return n.get(t)}getTransientModelProperties(e){let t=e.uri.toString(),o=this._transientWatchers.get(t);if(o)return o.keys().map(n=>[n,o.get(n)])}_removeWatcher(e){this._transientWatchers.deleteAndDispose(e.uri)}async openCodeEditor(e,t,o){for(let n of this._codeEditorOpenHandlers){let r=await n(e,t,o);if(r!==null)return r}return null}registerCodeEditorOpenHandler(e){let t=this._codeEditorOpenHandlers.unshift(e);return Z(t)}};LRe=I([m(0,Le)],LRe);var aCi=class extends x{constructor(i,e,t){super(),this.uri=i,this._values={},this._register(e.onWillDispose(()=>t._removeWatcher(this)))}set(i,e){this._values[i]=e}get(i){return this._values[i]}keys(){return Object.keys(this._values)}},lCi=class{get sheet(){return this._styleSheet.sheet}constructor(i,e,t){this._parent=i,this._editorId=e,this._styleSheet=t,this._refCount=0}ref(){this._refCount++}unref(){this._refCount--,this._refCount===0&&(this._styleSheet.remove(),this._parent._removeEditorStyleSheets(this._editorId))}insertRule(i,e){$h(i,e,this._styleSheet)}removeRulesContainingSelector(i){IO(i,this._styleSheet)}},cCi=class{get sheet(){return this._styleSheet.sheet}constructor(i){this._styleSheet=i}ref(){}unref(){}insertRule(i,e){$h(i,e,this._styleSheet)}removeRulesContainingSelector(i){IO(i,this._styleSheet)}},dCi=class{constructor(i,e,t){this._styleSheet=e,this._styleSheet.ref(),this._parentTypeKey=t.parentTypeKey,this.refCount=0,this._beforeContentRules=new RRe(3,t,i),this._afterContentRules=new RRe(4,t,i)}getOptions(i,e){let t=i.resolveDecorationOptions(this._parentTypeKey,!0);return this._beforeContentRules&&(t.beforeContentClassName=this._beforeContentRules.className),this._afterContentRules&&(t.afterContentClassName=this._afterContentRules.className),t}resolveDecorationCSSRules(){return this._styleSheet.sheet.cssRules}dispose(){this._beforeContentRules&&(this._beforeContentRules.dispose(),this._beforeContentRules=null),this._afterContentRules&&(this._afterContentRules.dispose(),this._afterContentRules=null),this._styleSheet.unref()}},uCi=class{constructor(i,e,t,o){this._disposables=new N;this.description=i,this._styleSheet=t,this._styleSheet.ref(),this.refCount=0;let n=p=>{let h=new RRe(p,o,e);if(this._disposables.add(h),h.hasContent)return h.className},r=p=>{let h=new RRe(p,o,e);return this._disposables.add(h),h.hasContent?{className:h.className,hasLetterSpacing:h.hasLetterSpacing}:null};this.className=n(0);let s=r(1);if(s&&(this.inlineClassName=s.className,this.inlineClassNameAffectsLetterSpacing=s.hasLetterSpacing),this.beforeContentClassName=n(3),this.afterContentClassName=n(4),o.options.beforeInjectedText&&o.options.beforeInjectedText.contentText){let p=r(5);this.beforeInjectedText={content:o.options.beforeInjectedText.contentText,inlineClassName:p?.className,inlineClassNameAffectsLetterSpacing:p?.hasLetterSpacing||o.options.beforeInjectedText.affectsLetterSpacing}}if(o.options.afterInjectedText&&o.options.afterInjectedText.contentText){let p=r(6);this.afterInjectedText={content:o.options.afterInjectedText.contentText,inlineClassName:p?.className,inlineClassNameAffectsLetterSpacing:p?.hasLetterSpacing||o.options.afterInjectedText.affectsLetterSpacing}}this.glyphMarginClassName=n(2);let l=o.options;this.isWholeLine=!!l.isWholeLine,this.lineHeight=l.lineHeight,this.fontFamily=l.fontFamily,this.fontSize=l.fontSize,this.fontWeight=l.fontWeight,this.fontStyle=l.fontStyle,this.stickiness=l.rangeBehavior;let c=l.light&&l.light.overviewRulerColor||l.overviewRulerColor,u=l.dark&&l.dark.overviewRulerColor||l.overviewRulerColor;(typeof c<"u"||typeof u<"u")&&(this.overviewRuler={color:c||u,darkColor:u||c,position:l.overviewRulerLane||2})}getOptions(i,e){return e?{description:this.description,inlineClassName:this.inlineClassName,beforeContentClassName:this.beforeContentClassName,afterContentClassName:this.afterContentClassName,className:this.className,glyphMarginClassName:this.glyphMarginClassName,isWholeLine:this.isWholeLine,lineHeight:this.lineHeight,fontFamily:this.fontFamily,fontSize:this.fontSize,fontWeight:this.fontWeight,fontStyle:this.fontStyle,overviewRuler:this.overviewRuler,stickiness:this.stickiness,before:this.beforeInjectedText,after:this.afterInjectedText}:this}resolveDecorationCSSRules(){return this._styleSheet.sheet.rules}dispose(){this._disposables.dispose(),this._styleSheet.unref()}},lZe={color:"color:{0} !important;",opacity:"opacity:{0};",backgroundColor:"background-color:{0};",outline:"outline:{0};",outlineColor:"outline-color:{0};",outlineStyle:"outline-style:{0};",outlineWidth:"outline-width:{0};",border:"border:{0};",borderColor:"border-color:{0};",borderRadius:"border-radius:{0};",borderSpacing:"border-spacing:{0};",borderStyle:"border-style:{0};",borderWidth:"border-width:{0};",fontStyle:"font-style:{0};",fontWeight:"font-weight:{0};",fontSize:"font-size:{0};",fontFamily:"font-family:{0};",textDecoration:"text-decoration:{0};",cursor:"cursor:{0};",letterSpacing:"letter-spacing:{0};",gutterIconPath:"background:{0} center center no-repeat;",gutterIconSize:"background-size:{0};",contentText:"content:'{0}';",contentIconPath:"content:{0};",margin:"margin:{0};",padding:"padding:{0};",width:"width:{0};",height:"height:{0};",verticalAlign:"vertical-align:{0};"},RRe=class{constructor(i,e,t){this._theme=t.getColorTheme(),this._ruleType=i,this._providerArgs=e,this._usesThemeColors=!1,this._hasContent=!1,this._hasLetterSpacing=!1;let o=cZe.getClassName(this._providerArgs.key,i);this._providerArgs.parentTypeKey&&(o=o+" "+cZe.getClassName(this._providerArgs.parentTypeKey,i)),this._className=o,this._unThemedSelector=cZe.getSelector(this._providerArgs.key,this._providerArgs.parentTypeKey,i),this._buildCSS(),this._usesThemeColors?this._themeListener=t.onDidColorThemeChange(n=>{this._theme=t.getColorTheme(),this._removeCSS(),this._buildCSS()}):this._themeListener=null}dispose(){this._hasContent&&(this._removeCSS(),this._hasContent=!1),this._themeListener&&(this._themeListener.dispose(),this._themeListener=null)}get hasContent(){return this._hasContent}get hasLetterSpacing(){return this._hasLetterSpacing}get className(){return this._className}_buildCSS(){let i=this._providerArgs.options,e,t,o;switch(this._ruleType){case 0:e=this.getCSSTextForModelDecorationClassName(i),t=this.getCSSTextForModelDecorationClassName(i.light),o=this.getCSSTextForModelDecorationClassName(i.dark);break;case 1:e=this.getCSSTextForModelDecorationInlineClassName(i),t=this.getCSSTextForModelDecorationInlineClassName(i.light),o=this.getCSSTextForModelDecorationInlineClassName(i.dark);break;case 2:e=this.getCSSTextForModelDecorationGlyphMarginClassName(i),t=this.getCSSTextForModelDecorationGlyphMarginClassName(i.light),o=this.getCSSTextForModelDecorationGlyphMarginClassName(i.dark);break;case 3:e=this.getCSSTextForModelDecorationContentClassName(i.before),t=this.getCSSTextForModelDecorationContentClassName(i.light&&i.light.before),o=this.getCSSTextForModelDecorationContentClassName(i.dark&&i.dark.before);break;case 4:e=this.getCSSTextForModelDecorationContentClassName(i.after),t=this.getCSSTextForModelDecorationContentClassName(i.light&&i.light.after),o=this.getCSSTextForModelDecorationContentClassName(i.dark&&i.dark.after);break;case 5:e=this.getCSSTextForModelDecorationContentClassName(i.beforeInjectedText),t=this.getCSSTextForModelDecorationContentClassName(i.light&&i.light.beforeInjectedText),o=this.getCSSTextForModelDecorationContentClassName(i.dark&&i.dark.beforeInjectedText);break;case 6:e=this.getCSSTextForModelDecorationContentClassName(i.afterInjectedText),t=this.getCSSTextForModelDecorationContentClassName(i.light&&i.light.afterInjectedText),o=this.getCSSTextForModelDecorationContentClassName(i.dark&&i.dark.afterInjectedText);break;default:throw new Error("Unknown rule type: "+this._ruleType)}let n=this._providerArgs.styleSheet,r=!1;e.length>0&&(n.insertRule(this._unThemedSelector,e),r=!0),t.length>0&&(n.insertRule(`.vs${this._unThemedSelector}, .hc-light${this._unThemedSelector}`,t),r=!0),o.length>0&&(n.insertRule(`.vs-dark${this._unThemedSelector}, .hc-black${this._unThemedSelector}`,o),r=!0),this._hasContent=r}_removeCSS(){this._providerArgs.styleSheet.removeRulesContainingSelector(this._unThemedSelector)}getCSSTextForModelDecorationClassName(i){if(!i)return"";let e=[];return this.collectCSSText(i,["backgroundColor"],e),this.collectCSSText(i,["outline","outlineColor","outlineStyle","outlineWidth"],e),this.collectBorderSettingsCSSText(i,e),e.join("")}getCSSTextForModelDecorationInlineClassName(i){if(!i)return"";let e=[];return this.collectCSSText(i,["fontStyle","fontWeight","fontFamily","fontSize","textDecoration","cursor","color","opacity","letterSpacing"],e),i.letterSpacing&&(this._hasLetterSpacing=!0),e.join("")}getCSSTextForModelDecorationContentClassName(i){if(!i)return"";let e=[];if(typeof i<"u"){if(this.collectBorderSettingsCSSText(i,e),typeof i.contentIconPath<"u"&&e.push(vd(lZe.contentIconPath,Qa(A.revive(i.contentIconPath)))),typeof i.contentText=="string"){let o=i.contentText.match(/^.*$/m)[0].replace(/['\\]/g,"\\$&");e.push(vd(lZe.contentText,o))}this.collectCSSText(i,["verticalAlign","fontStyle","fontWeight","fontSize","fontFamily","textDecoration","color","opacity","backgroundColor","margin","padding"],e),this.collectCSSText(i,["width","height"],e)&&e.push("display:inline-block;")}return e.join("")}getCSSTextForModelDecorationGlyphMarginClassName(i){if(!i)return"";let e=[];return typeof i.gutterIconPath<"u"&&(e.push(vd(lZe.gutterIconPath,Qa(A.revive(i.gutterIconPath)))),typeof i.gutterIconSize<"u"&&e.push(vd(lZe.gutterIconSize,i.gutterIconSize))),e.join("")}collectBorderSettingsCSSText(i,e){return this.collectCSSText(i,["border","borderColor","borderRadius","borderSpacing","borderStyle","borderWidth"],e)?(e.push(vd("box-sizing: border-box;")),!0):!1}collectCSSText(i,e,t){let o=t.length;for(let n of e){let r=this.resolveValue(i[n]);typeof r=="string"&&t.push(vd(lZe[n],r))}return t.length!==o}resolveValue(i){if(lye(i)){this._usesThemeColors=!0;let e=this._theme.getColor(i.id);return e?e.toString():"transparent"}return i}};var cZe=class{static getClassName(i,e){return"ced-"+i+"-"+e}static getSelector(i,e,t){let o=".monaco-editor ."+this.getClassName(i,t);return e&&(o=o+"."+this.getClassName(e,t)),t===3?o+="::before":t===4&&(o+="::after"),o}};var dZe=class extends LRe{constructor(e,t,o){super(t);this.editorService=e;this.configurationService=o;this._register(this.registerCodeEditorOpenHandler(this.doOpenCodeEditor.bind(this))),this._register(this.registerCodeEditorOpenHandler(this.doOpenCodeEditorFromDiff.bind(this)))}getActiveCodeEditor(){let e=this.editorService.activeTextEditorControl;if(pn(e))return e;if(mc(e))return e.getModifiedEditor();let t=this.editorService.activeEditorPane?.getControl();return SO(t)&&pn(t.activeCodeEditor)?t.activeCodeEditor:null}async doOpenCodeEditorFromDiff(e,t,o){let n=this.editorService.activeTextEditorControl;if(!o&&mc(n)&&e.options&&e.resource&&t===n.getModifiedEditor()&&n.getModel()&&Qe(e.resource,n.getModel()?.modified.uri)){let r=n.getModifiedEditor();return LT(e.options,r,0),r}return null}async doOpenCodeEditor(e,t,o){if(!this.configurationService.getValue().workbench?.editor?.enablePreviewFromCodeNavigation&&t&&!e.options?.pinned&&!o&&!Qe(t.getModel()?.uri,e.resource)){for(let s of this.editorService.visibleEditorPanes)if(ha(s.getControl())===t){s.group.pinEditor();break}}let r=await this.editorService.openEditor(e,o?In:jn);if(r){let s=r.getControl();if(pn(s))return s;if(SO(s)&&pn(s.activeCodeEditor))return s.activeCodeEditor}return null}};dZe=I([m(0,ee),m(1,Le),m(2,B)],dZe);Ee(qt,dZe,1);var bg=le("jsonEditingService");var bVt=class extends Error{constructor(e,t){super(e);this.code=t}};var BA=class{constructor(i,e,t,o,n,r,s){this._resolvedKeybindingItemBrand=void 0;this.resolvedKeybinding=i,this.chords=i?MRe(i.getDispatchChords()):[],i&&this.chords.length===0&&(this.chords=MRe(i.getSingleModifierDispatchChords())),this.bubble=e?e.charCodeAt(0)===94:!1,this.command=this.bubble?e.substr(1):e,this.commandArgs=t,this.when=o,this.isDefault=n,this.extensionId=r,this.isBuiltinExtension=s}};function MRe(a){let i=[];for(let e=0,t=a.length;e<t;e++){let o=a[e];if(!o)return[];i.push(o)}return i}function PRe(a){let i=[],e=new Map,t=(o,n)=>{if(!e.has(o)&&(e.set(o,!0),!(o[0]==="_"||o.indexOf("vscode.")===0)&&a.get(o)!==!0)){if(!n){let r=$e.getCommand(o);if(r&&typeof r.metadata=="object"&&yr(r.metadata.args))return}i.push(o)}};for(let o of ve.getMenuItems(D.CommandPalette))gE(o)&&t(o.command.id,!0);for(let o of Ba.getEditorActions())t(o.id,!0);for(let o of $e.getCommands().keys())t(o,!1);return i}var F3="keybinding.entry.template",ldo=d(17878,null),cdo=d(17879,null),ddo=d(17882,null);function mdo(a,i){let e=i?` +when:${i}`:"";return`@command:${a}${e}`}var g9o=VO(aY,dw),f9o=/@command:\s*([^\+]+)/i,v9o=/\+when:\s*(.+)/i,udo=/@source:\s*(user|default|system|extension)/i,pdo=/@ext:\s*((".+")|([^\s]+))/i,b9o=/@keybinding:\s*((\".+\")|(\S+))/i,Nk=class extends wh{constructor(e,t,o){super();this.keybindingsService=t;this.extensionService=o;this._keybindingItems=[],this._keybindingItemsSortedByPrecedence=[],this.modifierLabels={ui:cR.modifierLabels[e],aria:swt.modifierLabels[e],user:UCe.modifierLabels[e]}}fetch(e,t=!1){let o=t?this._keybindingItemsSortedByPrecedence:this._keybindingItems,n=f9o.exec(e);if(n&&n[1]){let r=n[1].trim(),s=o.filter(l=>l.command===r);if(s.length){let l=v9o.exec(e);if(l&&l[1]){let c=l[1].trim();s=this.filterByWhen(s,r,c)}}return s.map(l=>({id:Nk.getId(l),keybindingItem:l,templateId:F3}))}if(udo.test(e))o=this.filterBySource(o,e),e=e.replace(udo,"");else{let r=pdo.exec(e);if(r&&(r[2]||r[3])){let s=r[2]?r[2].substring(1,r[2].length-1):r[3];o=this.filterByExtension(o,s),e=e.replace(pdo,"")}else{let s=b9o.exec(e);s&&(s[2]||s[3])&&(e=s[2]||`"${s[3]}"`)}}return e=e.trim(),e?this.filterByText(o,e):o.map(r=>({id:Nk.getId(r),keybindingItem:r,templateId:F3}))}filterBySource(e,t){return/@source:\s*default/i.test(t)||/@source:\s*system/i.test(t)?e.filter(o=>o.source===ldo):/@source:\s*user/i.test(t)?e.filter(o=>o.source===ddo):/@source:\s*extension/i.test(t)?e.filter(o=>!Fe(o.source)||o.source===cdo):e}filterByExtension(e,t){return t=t.toLowerCase().trim(),e.filter(o=>!Fe(o.source)&&(Ii.equals(o.source.identifier,t)||o.source.displayName?.toLowerCase()===t.toLowerCase()))}filterByText(e,t){let o=t.charAt(0)==='"',n=t.charAt(t.length-1)==='"',r=o&&n;o&&(t=t.substring(1)),n&&(t=t.substring(0,t.length-1)),t=t.trim();let s=[],l=t.split(" "),c=this.splitKeybindingWords(l);for(let u of e){let p=new pCi(this.modifierLabels,u,t,l,c,r);(p.commandIdMatches||p.commandLabelMatches||p.commandDefaultLabelMatches||p.sourceMatches||p.whenMatches||p.keybindingMatches||p.extensionIdMatches||p.extensionLabelMatches)&&s.push({id:Nk.getId(u),templateId:F3,commandLabelMatches:p.commandLabelMatches||void 0,commandDefaultLabelMatches:p.commandDefaultLabelMatches||void 0,keybindingItem:u,keybindingMatches:p.keybindingMatches||void 0,commandIdMatches:p.commandIdMatches||void 0,sourceMatches:p.sourceMatches||void 0,whenMatches:p.whenMatches||void 0,extensionIdMatches:p.extensionIdMatches||void 0,extensionLabelMatches:p.extensionLabelMatches||void 0})}return s}filterByWhen(e,t,o){if(e.length===0)return[];let n=e.filter(c=>c.when===o);if(n.length)return n;let r=e[0].commandLabel,s=new BA(void 0,t,null,C.deserialize(o),!1,null,!1),l=new Map([[t,r]]);return[Nk.toKeybindingEntry(t,s,l,this.getExtensionsMapping())]}splitKeybindingWords(e){let t=[];for(let o of e)t.push(...di(o.split("+")));return t}async resolve(e=new Map){let t=this.getExtensionsMapping();this._keybindingItemsSortedByPrecedence=[];let o=new Map;for(let r of this.keybindingsService.getKeybindings())r.command&&(this._keybindingItemsSortedByPrecedence.push(Nk.toKeybindingEntry(r.command,r,e,t)),o.set(r.command,!0));let n=this.keybindingsService.getDefaultKeybindings().map(r=>r.command);for(let r of PRe(o)){let s=new BA(void 0,r,null,void 0,n.indexOf(r)===-1,null,!1);this._keybindingItemsSortedByPrecedence.push(Nk.toKeybindingEntry(r,s,e,t))}return this._keybindingItemsSortedByPrecedence=zo(this._keybindingItemsSortedByPrecedence,r=>Nk.getId(r)),this._keybindingItems=this._keybindingItemsSortedByPrecedence.slice(0).sort((r,s)=>Nk.compareKeybindingData(r,s)),super.resolve()}static getId(e){return e.command+(e?.keybinding?.getAriaLabel()??"")+e.when+(Fe(e.source)?e.source:e.source.identifier.value)}getExtensionsMapping(){let e=new iu;for(let t of this.extensionService.extensions)e.set(t.identifier,t);return e}static compareKeybindingData(e,t){return e.keybinding&&!t.keybinding?-1:t.keybinding&&!e.keybinding?1:e.commandLabel&&!t.commandLabel?-1:t.commandLabel&&!e.commandLabel?1:e.commandLabel&&t.commandLabel&&e.commandLabel!==t.commandLabel?e.commandLabel.localeCompare(t.commandLabel):e.command===t.command?e.keybindingItem.isDefault?1:-1:e.command.localeCompare(t.command)}static toKeybindingEntry(e,t,o,n){let r=ve.getCommand(e),s=o.get(e),l=ddo;if(t.isDefault){let c=t.extensionId??(t.resolvedKeybinding?void 0:r?.source?.id);l=c?n.get(c)??cdo:ldo}return{keybinding:t.resolvedKeybinding,keybindingItem:t,command:e,commandLabel:Nk.getCommandLabel(r,s),commandDefaultLabel:Nk.getCommandDefaultLabel(r),when:t.when?t.when.serialize():"",source:l}}static getCommandDefaultLabel(e){if(!US.isDefaultVariant()&&e&&e.title&&e.title.original){let t=e.category?e.category.original:void 0,o=e.title.original;return t?d(17877,null,t,o):o}return null}static getCommandLabel(e,t){if(e){let o=e.category?typeof e.category=="string"?e.category:e.category.value:void 0,n=typeof e.title=="string"?e.title:e.title.value;return o?d(17877,null,o,n):n}return t||""}};Nk=I([m(1,_e),m(2,lt)],Nk);var pCi=class{constructor(i,e,t,o,n,r){this.modifierLabels=i;this.commandIdMatches=null;this.commandLabelMatches=null;this.commandDefaultLabelMatches=null;this.sourceMatches=null;this.whenMatches=null;this.keybindingMatches=null;this.extensionIdMatches=null;this.extensionLabelMatches=null;r||(this.commandIdMatches=this.matches(t,e.command,VO(dw,lY),o),this.commandLabelMatches=e.commandLabel?this.matches(t,e.commandLabel,(s,l)=>dw(s,e.commandLabel,!0),o):null,this.commandDefaultLabelMatches=e.commandDefaultLabel?this.matches(t,e.commandDefaultLabel,(s,l)=>dw(s,e.commandDefaultLabel,!0),o):null,this.whenMatches=e.when?this.matches(null,e.when,VO(dw,lY),o):null,Fe(e.source)?this.sourceMatches=this.matches(t,e.source,(s,l)=>dw(s,e.source,!0),o):this.extensionLabelMatches=e.source.displayName?this.matches(t,e.source.displayName,(s,l)=>dw(s,e.commandLabel,!0),o):null),this.keybindingMatches=e.keybinding?this.matchesKeybinding(e.keybinding,t,n,r):null}matches(i,e,t,o){let n=i?g9o(i,e):null;return n||(n=this.matchesWords(o,e,t)),n&&(n=this.filterAndSort(n)),n}matchesWords(i,e,t){let o=[];for(let n of i){let r=t(n,e);if(r)o=[...o||[],...r];else{o=null;break}}return o}filterAndSort(i){return zo(i,(e=>e.start+"."+e.end)).filter(e=>!i.some(t=>!(t.start===e.start&&t.end===e.end)&&t.start<=e.start&&t.end>=e.end)).sort((e,t)=>e.start-t.start)}matchesKeybinding(i,e,t,o){let[n,r]=i.getChords(),s=i.getUserSettingsLabel(),l=i.getAriaLabel(),c=i.getLabel();if(s&&OI(e,s)===0||l&&OI(e,l)===0||c&&OI(e,c)===0)return{firstPart:this.createCompleteMatch(n),chordPart:this.createCompleteMatch(r)};let u={},p={},h=[],g=[],f=[],v=!0;for(let b=0;b<t.length;b++){let S=t[b],y=!1,w=!1;v=v&&!u.keyCode;let k=!p.keyCode;if(v&&(y=this.matchPart(n,u,S,o),u.keyCode)){for(let T of f)g.indexOf(T)===-1&&h.splice(h.indexOf(T),1);p={},f=[],k=!1}k&&(w=this.matchPart(r,p,S,o)),y&&g.push(b),w&&f.push(b),(y||w)&&h.push(b),v=v&&this.isModifier(S)}return h.length!==t.length||o&&(!this.isCompleteMatch(n,u)||!Of(p)&&!this.isCompleteMatch(r,p))?null:this.hasAnyMatch(u)||this.hasAnyMatch(p)?{firstPart:u,chordPart:p}:null}matchPart(i,e,t,o){let n=!1;return this.matchesMetaModifier(i,t)&&(n=!0,e.metaKey=!0),this.matchesCtrlModifier(i,t)&&(n=!0,e.ctrlKey=!0),this.matchesShiftModifier(i,t)&&(n=!0,e.shiftKey=!0),this.matchesAltModifier(i,t)&&(n=!0,e.altKey=!0),this.matchesKeyCode(i,t,o)&&(e.keyCode=!0,n=!0),n}matchesKeyCode(i,e,t){if(!i)return!1;let o=i.keyAriaLabel||"";if(t||o.length===1||e.length===1){if(OI(o,e)===0)return!0}else if(BO(e,o))return!0;return!1}matchesMetaModifier(i,e){return!i||!i.metaKey?!1:this.wordMatchesMetaModifier(e)}matchesCtrlModifier(i,e){return!i||!i.ctrlKey?!1:this.wordMatchesCtrlModifier(e)}matchesShiftModifier(i,e){return!i||!i.shiftKey?!1:this.wordMatchesShiftModifier(e)}matchesAltModifier(i,e){return!i||!i.altKey?!1:this.wordMatchesAltModifier(e)}hasAnyMatch(i){return!!i.altKey||!!i.ctrlKey||!!i.metaKey||!!i.shiftKey||!!i.keyCode}isCompleteMatch(i,e){return i?!(!e.keyCode||i.metaKey&&!e.metaKey||i.altKey&&!e.altKey||i.ctrlKey&&!e.ctrlKey||i.shiftKey&&!e.shiftKey):!0}createCompleteMatch(i){let e={};return i&&(e.keyCode=!0,i.metaKey&&(e.metaKey=!0),i.altKey&&(e.altKey=!0),i.ctrlKey&&(e.ctrlKey=!0),i.shiftKey&&(e.shiftKey=!0)),e}isModifier(i){return!!(this.wordMatchesAltModifier(i)||this.wordMatchesCtrlModifier(i)||this.wordMatchesMetaModifier(i)||this.wordMatchesShiftModifier(i))}wordMatchesAltModifier(i){return!!(vr(this.modifierLabels.ui.altKey,i)||vr(this.modifierLabels.aria.altKey,i)||vr(this.modifierLabels.user.altKey,i)||vr(d(17881,null),i))}wordMatchesCtrlModifier(i){return!!(vr(this.modifierLabels.ui.ctrlKey,i)||vr(this.modifierLabels.aria.ctrlKey,i)||vr(this.modifierLabels.user.ctrlKey,i))}wordMatchesMetaModifier(i){return!!(vr(this.modifierLabels.ui.metaKey,i)||vr(this.modifierLabels.aria.metaKey,i)||vr(this.modifierLabels.user.metaKey,i)||vr(d(17880,null),i))}wordMatchesShiftModifier(i){return!!(vr(this.modifierLabels.ui.shiftKey,i)||vr(this.modifierLabels.aria.shiftKey,i)||vr(this.modifierLabels.user.shiftKey,i))}};var S9o=Ae("keybindings-editor-label-icon",R.keyboard,d(17875,null)),WD=class extends ls{constructor(e){super();this.searchOptions=null;this.resource=void 0;this.keybindingsModel=e.createInstance(Nk,Po)}static{this.ID="workbench.input.keybindings"}get typeId(){return WD.ID}getName(){return d(17876,null)}getIcon(){return S9o}async resolve(){return this.keybindingsModel}matches(e){return e instanceof WD}dispose(){this.keybindingsModel.dispose(),super.dispose()}};WD=I([m(0,F)],WD);var I9o=Ae("settings-editor-label-icon",R.settings,d(17890,null)),VD=class extends ls{constructor(e){super();this.resource=A.from({scheme:Q.vscodeSettings,path:"settingseditor"});this._settingsModel=e.createSettings2EditorModel()}static{this.ID="workbench.input.settings2"}matches(e){return super.matches(e)||e instanceof VD}get typeId(){return VD.ID}getName(){return d(17889,null)}getIcon(){return I9o}async resolve(){return this._settingsModel}dispose(){this._settingsModel.dispose(),super.dispose()}};VD=I([m(0,Go)],VD);var y9o=Ae("preferences-editor-label-icon",R.settings,d(17888,null)),gee=class a extends ls{constructor(){super(...arguments);this.resource=A.from({scheme:Q.vscodeSettings,path:"preferenceseditor"})}static{this.ID="workbench.input.preferences"}matches(e){return super.matches(e)||e instanceof a}get typeId(){return a.ID}getName(){return d(17887,null)}getIcon(){return y9o}async resolve(){return null}};function ARe(a,...i){return i.some(e=>a.includes(e))}function hdo(a){return a===""||nr(a)}function mCi(a){let i=Array.isArray(a.type)?a.type:[a.type],e=ARe(i,"null"),t=(ARe(i,"number")||ARe(i,"integer"))&&(i.length===1||i.length===2&&e),o=x9o(a),n=C9o(a),r=k9o(a),s=E9o(a);return l=>{if(e&&hdo(l))return"";let c=[];if(r){let u=r(l);u&&c.push(u)}if(s){let u=s(l);u&&c.push(u)}return a.type==="boolean"&&l!==!0&&l!==!1&&c.push(d(17896,null)),t&&(hdo(l)||typeof l=="boolean"||Array.isArray(l)||isNaN(+l)?c.push(d(17901,null)):c.push(...o.filter(u=>!u.isValid(+l)).map(u=>u.message))),a.type==="string"&&(a.enum&&!HS(a.enum)?c.push(d(17918,null)):Fe(l)?c.push(...n.filter(u=>!u.isValid(l)).map(u=>u.message)):c.push(d(17919,null))),c.length?a.errorMessage?[a.errorMessage,...c].join(" "):c.join(" "):""}}function hCi(a,i){if(typeof i>"u")return;if(!(Array.isArray(i)?i:[i]).some(t=>w9o(a,t)))return d(17893,null,JSON.stringify(i))}function w9o(a,i){let e=typeof a;return i==="boolean"?e==="boolean":i==="object"?a&&!Array.isArray(a)&&e==="object":i==="null"?a===null:i==="array"?Array.isArray(a):i==="string"?e==="string":i==="number"||i==="integer"?e==="number":!0}function IVt(a){try{return new RegExp(a,"u")}catch{try{return new RegExp(a)}catch{return console.error(d(17894,null),a),/.*/}}}function C9o(a){let i=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/,e;return typeof a.pattern=="string"&&(e=IVt(a.pattern)),[{enabled:a.maxLength!==void 0,isValid:(t=>t.length<=a.maxLength),message:d(17904,null,a.maxLength)},{enabled:a.minLength!==void 0,isValid:(t=>t.length>=a.minLength),message:d(17906,null,a.minLength)},{enabled:e!==void 0,isValid:(t=>e.test(t)),message:a.patternErrorMessage||d(17911,null,a.pattern)},{enabled:a.format==="color-hex",isValid:(t=>We.Format.CSS.parseHex(t)),message:d(17897,null)},{enabled:a.format==="uri"||a.format==="uri-reference",isValid:(t=>!!t.length),message:d(17920,null)},{enabled:a.format==="uri"||a.format==="uri-reference",isValid:(t=>i.test(t)),message:d(17921,null)},{enabled:a.format==="uri",isValid:(t=>{let o=t.match(i);return!!(o&&o[2])}),message:d(17922,null)},{enabled:a.enum!==void 0,isValid:(t=>a.enum.includes(t)),message:d(17902,null,a.enum?a.enum.map(t=>`"${t}"`).join(", "):"[]")}].filter(t=>t.enabled)}function x9o(a){let i=Array.isArray(a.type)?a.type:[a.type],e=ARe(i,"null"),t=ARe(i,"integer")&&(i.length===1||i.length===2&&e);if(!(ARe(i,"number","integer")&&(i.length===1||i.length===2&&e)))return[];let n,r;return typeof a.exclusiveMaximum=="boolean"?n=a.exclusiveMaximum?a.maximum:void 0:n=a.exclusiveMaximum,typeof a.exclusiveMinimum=="boolean"?r=a.exclusiveMinimum?a.minimum:void 0:r=a.exclusiveMinimum,[{enabled:n!==void 0&&(a.maximum===void 0||n<=a.maximum),isValid:(s=>s<n),message:d(17898,null,n)},{enabled:r!==void 0&&(a.minimum===void 0||r>=a.minimum),isValid:(s=>s>r),message:d(17899,null,r)},{enabled:a.maximum!==void 0&&(n===void 0||n>a.maximum),isValid:(s=>s<=a.maximum),message:d(17903,null,a.maximum)},{enabled:a.minimum!==void 0&&(r===void 0||r<a.minimum),isValid:(s=>s>=a.minimum),message:d(17905,null,a.minimum)},{enabled:a.multipleOf!==void 0,isValid:(s=>s%a.multipleOf===0),message:d(17907,null,a.multipleOf)},{enabled:t,isValid:(s=>s%1===0),message:d(17900,null)}].filter(s=>s.enabled)}function k9o(a){if(a.type==="array"&&a.items&&!Array.isArray(a.items)){let i=a.items;if(i&&!Array.isArray(i.type)){let e=t=>"'"+t+"'";return t=>{if(!t)return null;let o="";if(!Array.isArray(t))return o+=d(17895,null),o+=`
`,o;let n=t;if(a.uniqueItems&&new Set(n).size<n.length&&(o+=d(17917,null),o+=`
`),a.minItems&&n.length<a.minItems&&(o+=d(17916,null,a.minItems),o+=`
`),a.maxItems&&n.length>a.maxItems&&(o+=d(17915,null,a.maxItems),o+=`
`),i.type==="string"){if(!HS(n))return o+=d(17912,null),o+=`
`,o;if(typeof i.pattern=="string"){let s=IVt(i.pattern);n.forEach(l=>{s.test(l)||(o+=i.patternErrorMessage||d(17914,null,e(l),e(i.pattern)))})}let r=i.enum;r&&n.forEach(s=>{r.indexOf(s)===-1&&(o+=d(17913,null,e(s),"["+r.map(e).join(", ")+"]"),o+=`
`)})}else(i.type==="integer"||i.type==="number")&&n.forEach(r=>{let s=SVt(i,r);s&&(o+=`${r}: ${s}
`)});return o}}}return null}function E9o(a){if(a.type==="object"){let{properties:i,patternProperties:e,additionalProperties:t,propertyNames:o}=a;return n=>{if(!n)return null;let r=[],s=!1;return xi(n)?Object.keys(n).forEach(l=>{let c=n[l];if(o?.pattern&&!s&&!IVt(o.pattern).test(l)){let p=o.patternErrorMessage||d(17910,null,o.pattern);r.push(p+`
`),s=!0}if(i&&l in i){let u=SVt(i[l],c);u&&r.push(`${l}: ${u}
`);return}if(e){for(let u in e)if(RegExp(u).test(l)){let p=SVt(e[u],c);p&&r.push(`${l}: ${p}
`);return}}if(t===!1)r.push(d(17909,null,l));else if(typeof t=="object"){let u=SVt(t,c);u&&r.push(`${l}: ${u}
`)}}):r.push(d(17908,null)),r.length?a.errorMessage?[a.errorMessage,...r].join(" "):r.join(" "):""}}return null}function gdo(a,i){return a?.pattern?IVt(a.pattern).test(i):!0}function SVt(a,i){return mCi(a)(i)}var Wg={startLineNumber:-1,startColumn:-1,endLineNumber:-1,endColumn:-1};function gCi(a){return a.startLineNumber===-1&&a.startColumn===-1&&a.endLineNumber===-1&&a.endColumn===-1}function yVt(a){return a.replace(/`#([^#`]*)#`/g,(i,e)=>`\`${e}\``)}var uZe=class extends wh{constructor(){super(...arguments);this._currentResultGroups=new Map}updateResultGroup(e,t){return t?this._currentResultGroups.set(e,t):this._currentResultGroups.delete(e),this.removeDuplicateResults(),this.update()}removeDuplicateResults(){let e=new Set;[...this._currentResultGroups.keys()].sort((t,o)=>this._currentResultGroups.get(t).order-this._currentResultGroups.get(o).order).forEach(t=>{let o=this._currentResultGroups.get(t);o.result.filterMatches=o.result.filterMatches.filter(n=>!e.has(n.setting.key)),o.result.filterMatches.forEach(n=>e.add(n.setting.key))})}filterSettings(e,t,o){let n=this.filterGroups,r=[];for(let s of n){let l=t(s);for(let c of s.sections)for(let u of c.settings){let p=o(u,s);(l||p)&&r.push({setting:u,matches:p&&p.matches,matchType:p?.matchType??0,keyMatchScore:p?.keyMatchScore??0,score:p?.score??0})}}return r}getPreference(e){for(let t of this.settingsGroups)for(let o of t.sections)for(let n of o.settings)if(e===n.key)return n}collectMetadata(e){let t=Object.create(null),o=!1;return e.forEach(n=>{n.result.metadata&&(t[n.id]=n.result.metadata,o=!0)}),o?t:null}get filterGroups(){return this.settingsGroups}},rme=class extends uZe{constructor(e,t){super();this._configurationTarget=t;this._onDidChangeGroups=this._register(new E);this.onDidChangeGroups=this._onDidChangeGroups.event;this.settingsModel=e.object.textEditorModel,this._register(this.onWillDispose(()=>e.dispose())),this._register(this.settingsModel.onDidChangeContent(()=>{this._settingsGroups=void 0,this._onDidChangeGroups.fire()}))}get uri(){return this.settingsModel.uri}get configurationTarget(){return this._configurationTarget}get settingsGroups(){return this._settingsGroups||this.parse(),this._settingsGroups}get content(){return this.settingsModel.getValue()}isSettingsProperty(e,t){return t.length===0}parse(){this._settingsGroups=fdo(this.settingsModel,(e,t)=>this.isSettingsProperty(e,t))}update(){let e=[...this._currentResultGroups.values()];if(!e.length)return;let t=[],o=[];e.forEach(l=>{l.result.filterMatches.forEach(c=>{t.push(c.setting),c.matches&&o.push(...c.matches)})});let n,r=this.settingsGroups[0];r&&(n={id:r.id,range:r.range,sections:[{settings:t}],title:r.title,titleRange:r.titleRange,order:r.order,extensionInfo:r.extensionInfo});let s=this.collectMetadata(e);return{allGroups:this.settingsGroups,filteredGroups:n?[n]:[],matches:o,metadata:s??void 0}}},fee=class extends uZe{constructor(e,t){super();this._defaultSettings=e;this._onDidChangeGroups=this._register(new E);this.onDidChangeGroups=this._onDidChangeGroups.event;this.additionalGroups=[];this.dirty=!1;this._register(t.onDidChangeConfiguration(o=>{o.source===7&&(this.dirty=!0,this._onDidChangeGroups.fire())})),this._register(ne.as(Jt.Configuration).onDidSchemaChange(o=>{this.dirty=!0,this._onDidChangeGroups.fire()}))}get filterGroups(){return this.settingsGroups.slice(1)}get settingsGroups(){let e=this._defaultSettings.getSettingsGroups(this.dirty);return this.dirty=!1,[...e,...this.additionalGroups]}setAdditionalGroups(e){this.additionalGroups=e}update(){throw new Error("Not supported")}};fee=I([m(1,B)],fee);function fdo(a,i){let e=[],t=null,o=null,n=[],r=[],s=-1,l={startLineNumber:0,startColumn:0,endLineNumber:0,endColumn:0};function c(p,h,g){if(Array.isArray(n)?n.push(p):o&&(n[o]=p),r.length===s+1||r.length===s+2&&t!==null){let f=r.length===s+1?e[e.length-1]:t.overrides[t.overrides.length-1];if(f){let v=a.getPositionAt(h),b=a.getPositionAt(h+g);f.value=p,f.valueRange={startLineNumber:v.lineNumber,startColumn:v.column,endLineNumber:b.lineNumber,endColumn:b.column},f.range=Object.assign(f.range,{endLineNumber:b.lineNumber,endColumn:b.column})}}}let u={onObjectBegin:(p,h)=>{if(i(o,r)){s=r.length;let f=a.getPositionAt(p);l.startLineNumber=f.lineNumber,l.startColumn=f.column}let g={};c(g,p,h),n=g,o=null,r.push(n)},onObjectProperty:(p,h,g)=>{if(o=p,r.length===s+1||r.length===s+2&&t!==null){let f=a.getPositionAt(h),v={description:[],descriptionIsMarkdown:!1,key:p,keyRange:{startLineNumber:f.lineNumber,startColumn:f.column+1,endLineNumber:f.lineNumber,endColumn:f.column+g},range:{startLineNumber:f.lineNumber,startColumn:f.column,endLineNumber:0,endColumn:0},value:null,valueRange:Wg,descriptionRanges:[],overrides:[],overrideOf:t??void 0};r.length===s+1?(e.push(v),kg.test(p)&&(t=v)):t.overrides.push(v)}},onObjectEnd:(p,h)=>{if(n=r.pop(),s!==-1&&(r.length===s+1||r.length===s+2&&t!==null)){let g=r.length===s+1?e[e.length-1]:t.overrides[t.overrides.length-1];if(g){let f=a.getPositionAt(p+h);g.valueRange=Object.assign(g.valueRange,{endLineNumber:f.lineNumber,endColumn:f.column}),g.range=Object.assign(g.range,{endLineNumber:f.lineNumber,endColumn:f.column})}r.length===s+1&&(t=null)}if(r.length===s){let g=a.getPositionAt(p);l.endLineNumber=g.lineNumber,l.endColumn=g.column,s=-1}},onArrayBegin:(p,h)=>{let g=[];c(g,p,h),r.push(n),n=g,o=null},onArrayEnd:(p,h)=>{if(n=r.pop(),r.length===s+1||r.length===s+2&&t!==null){let g=r.length===s+1?e[e.length-1]:t.overrides[t.overrides.length-1];if(g){let f=a.getPositionAt(p+h);g.valueRange=Object.assign(g.valueRange,{endLineNumber:f.lineNumber,endColumn:f.column}),g.range=Object.assign(g.range,{endLineNumber:f.lineNumber,endColumn:f.column})}}},onLiteralValue:c,onError:p=>{let h=e[e.length-1];h&&(gCi(h.range)||gCi(h.keyRange)||gCi(h.valueRange))&&e.pop()}};return a.isDisposed()||uk(a.getValue(),u),e.length>0?[{id:a.isDisposed()?"":a.id,sections:[{settings:e}],title:"",titleRange:Wg,range:l}]:[]}var sme=class extends rme{constructor(){super(...arguments);this._configurationGroups=[]}get configurationGroups(){return this._configurationGroups}parse(){super.parse(),this._configurationGroups=fdo(this.settingsModel,(e,t)=>t.length===0)}isSettingsProperty(e,t){return e==="settings"&&t.length===1}},ORe=class extends x{constructor(e,t,o){super();this._mostCommonlyUsedSettingsKeys=e;this.target=t;this.configurationService=o;this._settingsByName=new Map;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._register(o.onDidChangeConfiguration(n=>{n.source===7&&(this.reset(),this._onDidChange.fire())}))}getContent(e=!1){return(!this._content||e)&&this.initialize(),this._content}getContentWithoutMostCommonlyUsed(e=!1){return(!this._contentWithoutMostCommonlyUsed||e)&&this.initialize(),this._contentWithoutMostCommonlyUsed}getSettingsGroups(e=!1){return(!this._allSettingsGroups||e)&&this.initialize(),this._allSettingsGroups}initialize(){this._allSettingsGroups=this.parse(),this._content=this.toContent(this._allSettingsGroups,0),this._contentWithoutMostCommonlyUsed=this.toContent(this._allSettingsGroups,1)}reset(){this._content=void 0,this._contentWithoutMostCommonlyUsed=void 0,this._allSettingsGroups=void 0}parse(){let e=this.getRegisteredGroups();return this.initAllSettingsMap(e),[this.getMostCommonlyUsedSettings(),...e]}getRegisteredGroups(){let e=ne.as(Jt.Configuration),t={...e.getConfigurationProperties()},o=e.getExcludedConfigurationProperties();for(let r of this.configurationService.keys().policy??[]){let s=o[r];s&&(t[r]=s)}let n=this.removeEmptySettingsGroups(this.parseProperties(t).sort(this.compareGroups));return this.sortGroups(n)}sortGroups(e){return e.forEach(t=>{t.sections.forEach(o=>{o.settings.sort((n,r)=>n.key.localeCompare(r.key))})}),e}initAllSettingsMap(e){this._settingsByName=new Map;for(let t of e)for(let o of t.sections)for(let n of o.settings)this._settingsByName.set(n.key,n)}getMostCommonlyUsedSettings(){let e=di(this._mostCommonlyUsedSettingsKeys.map(t=>{let o=this._settingsByName.get(t);return o?{description:o.description,key:o.key,value:o.value,keyRange:Wg,range:Wg,valueRange:Wg,overrides:[],scope:5,type:o.type,enum:o.enum,enumDescriptions:o.enumDescriptions,descriptionRanges:[]}:null}));return{id:"mostCommonlyUsed",range:Wg,title:d(17891,null),titleRange:Wg,sections:[{settings:e}]}}parseProperties(e){let t=[],o=new Map,n=new Map;for(let[r,s]of Object.entries(e)){if(!s.section)continue;let l;if(s.section.title){let u=o.get(s.section.title);if(u){let p=s.section.extensionInfo?.id;l=u.find(h=>h.extensionInfo?.id===p)}}if(!l&&s.section.id){let u=n.get(s.section.id);if(u){let p=s.section.extensionInfo?.id;l=u.find(h=>h.extensionInfo?.id===p&&!h.title)}if(l&&!l?.title&&s.section.title){l.title=s.section.title;let p=o.get(s.section.title);p?p.push(l):o.set(s.section.title,[l])}}if(!l){if(l={sections:[{title:s.section.title,settings:[]}],id:s.section.id||"",title:s.section.title??"",titleRange:Wg,order:s.section.order,range:Wg,extensionInfo:Fe(s.source)?void 0:s.source},t.push(l),s.section.title){let u=o.get(s.section.title);u?u.push(l):o.set(s.section.title,[l])}if(s.section.id){let u=n.get(s.section.id);u?u.push(l):n.set(s.section.id,[l])}}let c=this.parseSetting(r,s);c&&l.sections[0].settings.push(c)}return t}removeEmptySettingsGroups(e){let t=[];for(let o of e)o.sections=o.sections.filter(n=>n.settings.length>0),o.sections.length&&t.push(o);return t}parseSetting(e,t){if(!this.matchesScope(t))return;let o=t.default,n=t.markdownDescription||t.description||"";typeof n!="string"&&(n="");let r=n.split(`
`),s=kg.test(e)?this.parseOverrideSettings(t.default):[],l;t.type==="array"&&t.items&&!Array.isArray(t.items)&&t.items.type&&(t.items.enum?l="enum":Array.isArray(t.items.type)||(l=t.items.type));let c=t.type==="object"?t.properties:void 0,u=t.type==="object"?t.patternProperties:void 0,p=t.type==="object"?t.additionalProperties:void 0,h=t.type==="object"?t.propertyNames:void 0,g=t.enum,f=t.markdownEnumDescriptions??t.enumDescriptions,v=!!t.markdownEnumDescriptions;l==="enum"&&!Array.isArray(t.items)&&(g=t.items.enum,f=t.items.markdownEnumDescriptions??t.items.enumDescriptions,v=!!t.items.markdownEnumDescriptions);let b=!1;t.type==="object"&&!t.additionalProperties&&t.properties&&Object.keys(t.properties).length&&(b=Object.keys(t.properties).every(w=>t.properties[w].type==="boolean"));let S=!1;kg.test(e)&&(S=!0);let y;if(!S){let w=t;w&&w.defaultValueSource&&(y=w.defaultValueSource)}return!g&&(t.enumItemLabels||f||v)&&console.error(`The setting ${e} has enum-related fields, but doesn't have an enum field. This setting may render improperly in the Settings editor.`),{key:e,value:o,description:r,descriptionIsMarkdown:!!t.markdownDescription,keywords:t.keywords,range:Wg,keyRange:Wg,valueRange:Wg,descriptionRanges:[],overrides:s,scope:t.scope,type:t.type,arrayItemType:l,objectProperties:c,objectPatternProperties:u,objectAdditionalProperties:p,propertyNames:h,enum:g,enumDescriptions:f,enumDescriptionsAreMarkdown:v,enumItemLabels:t.enumItemLabels,uniqueItems:t.uniqueItems,tags:t.tags,disallowSyncIgnore:t.disallowSyncIgnore,restricted:t.restricted,extensionInfo:Fe(t.source)?void 0:t.source,deprecationMessage:t.markdownDeprecationMessage||t.deprecationMessage,deprecationMessageIsMarkdown:!!t.markdownDeprecationMessage,validator:mCi(t),allKeysAreBoolean:b,editPresentation:t.editPresentation,order:t.order,nonLanguageSpecificDefaultValueSource:y,isLanguageTagSetting:S,categoryLabel:(Fe(t.source)?void 0:t.source?.id)===t.section?.id?t.title:t.section?.id}}parseOverrideSettings(e){return Object.keys(e).map(t=>({key:t,value:e[t],description:[],descriptionIsMarkdown:!1,range:Wg,keyRange:Wg,valueRange:Wg,descriptionRanges:[],overrides:[]}))}matchesScope(e){return e.scope?this.target===6?UZ.indexOf(e.scope)!==-1:this.target===5?y3.indexOf(e.scope)!==-1:!0:!0}compareGroups(e,t){if(typeof e?.order!="number")return 1;if(typeof t?.order!="number")return-1;if(e.order===t.order){let o=e.title||"",n=t.title||"";return o.localeCompare(n)}return e.order-t.order}toContent(e,t){let o=new pZe;for(let n=t;n<e.length;n++)o.pushGroup(e[n],n===t,n===e.length-1);return o.getContent()}},FRe=class extends uZe{constructor(e,t,o){super();this._uri=e;this.defaultSettings=o;this._onDidChangeGroups=this._register(new E);this.onDidChangeGroups=this._onDidChangeGroups.event;this._register(o.onDidChange(()=>this._onDidChangeGroups.fire())),this._model=t.object.textEditorModel,this._register(this.onWillDispose(()=>t.dispose()))}get uri(){return this._uri}get target(){return this.defaultSettings.target}get settingsGroups(){return this.defaultSettings.getSettingsGroups()}get filterGroups(){return this.settingsGroups.slice(1)}update(){if(this._model.isDisposed())return;let e=[...this._currentResultGroups.values()].sort((l,c)=>l.order-c.order),t=e.filter(l=>l.result.filterMatches.length),o=this.settingsGroups.at(-1).range.endLineNumber+2,{settingsGroups:n,matches:r}=this.writeResultGroups(t,o),s=this.collectMetadata(e);return e.length?{allGroups:this.settingsGroups,filteredGroups:n,matches:r,metadata:s??void 0}:void 0}writeResultGroups(e,t){let o=t-1,n=new pZe(o),r=[],s=[];e.length&&(n.pushLine(","),e.forEach(g=>{let f=this.getGroup(g);r.push(f),s.push(...this.writeSettingsGroupToBuilder(n,f,g.result.filterMatches))}));let l=n.getContent()+`
`,c=this._model.getLineCount(),u=new ti(t,1,t,1),p={text:l,forceMoveMarkers:!0,range:new z(t,1,c,1)};this._model.pushEditOperations([u],[p],()=>[u]);let h=Math.min(t+60,this._model.getLineCount());return this._model.tokenization.forceTokenization(h),{matches:s,settingsGroups:r}}writeSettingsGroupToBuilder(e,t,o){return o=o.map(r=>({setting:r.setting,score:r.score,matchType:r.matchType,keyMatchScore:r.keyMatchScore,matches:r.matches&&r.matches.map(s=>new z(s.startLineNumber-r.setting.range.startLineNumber,s.startColumn,s.endLineNumber-r.setting.range.startLineNumber,s.endColumn))})),e.pushGroup(t),o.map(r=>r.matches||[]).flatMap((r,s)=>{let l=t.sections[0].settings[s];return r.map(c=>new z(c.startLineNumber+l.range.startLineNumber,c.startColumn,c.endLineNumber+l.range.startLineNumber,c.endColumn))})}copySetting(e){return{description:e.description,scope:e.scope,type:e.type,enum:e.enum,enumDescriptions:e.enumDescriptions,key:e.key,value:e.value,range:e.range,overrides:[],overrideOf:e.overrideOf,tags:e.tags,deprecationMessage:e.deprecationMessage,keyRange:Wg,valueRange:Wg,descriptionIsMarkdown:void 0,descriptionRanges:[]}}getPreference(e){for(let t of this.settingsGroups)for(let o of t.sections)for(let n of o.settings)if(n.key===e)return n}getGroup(e){return{id:e.id,range:Wg,title:e.label,titleRange:Wg,sections:[{settings:e.result.filterMatches.map(t=>this.copySetting(t.setting))}]}}},pZe=class{constructor(i=0){this._rangeOffset=i;this._contentByLines=[]}get lineCountWithOffset(){return this._contentByLines.length+this._rangeOffset}get lastLine(){return this._contentByLines[this._contentByLines.length-1]||""}pushLine(...i){this._contentByLines.push(...i)}pushGroup(i,e,t){this._contentByLines.push(e?"[{":"{");let o=this._pushGroup(i,"  ");if(o){let n=o.range.endLineNumber-this._rangeOffset,r=this._contentByLines[n-2];this._contentByLines[n-2]=r.substring(0,r.length-1)}this._contentByLines.push(t?"}]":"},")}_pushGroup(i,e){let t=null,o=this.lineCountWithOffset+1;for(let n of i.sections)if(n.title&&this.addDescription([n.title],e,this._contentByLines),n.settings.length)for(let r of n.settings)this.pushSetting(r,e),t=r;return i.range={startLineNumber:o,startColumn:1,endLineNumber:this.lineCountWithOffset,endColumn:this.lastLine.length},t}getContent(){return this._contentByLines.join(`
`)}pushSetting(i,e){let t=this.lineCountWithOffset+1;this.pushSettingDescription(i,e);let o=e,n=JSON.stringify(i.key);o+=n,i.keyRange={startLineNumber:this.lineCountWithOffset+1,startColumn:o.indexOf(i.key)+1,endLineNumber:this.lineCountWithOffset+1,endColumn:i.key.length},o+=": ";let r=this.lineCountWithOffset+1;this.pushValue(i,o,e),i.valueRange={startLineNumber:r,startColumn:o.length+1,endLineNumber:this.lineCountWithOffset,endColumn:this.lastLine.length+1},this._contentByLines[this._contentByLines.length-1]+=",",this._contentByLines.push(""),i.range={startLineNumber:t,startColumn:1,endLineNumber:this.lineCountWithOffset,endColumn:this.lastLine.length}}pushSettingDescription(i,e){i.descriptionRanges=[];let t=e+"// ",o=i.deprecationMessage?.split(/\n/g)??[];for(let n of[...o,...i.description])n=yVt(n),this._contentByLines.push(t+n),i.descriptionRanges.push({startLineNumber:this.lineCountWithOffset,startColumn:this.lastLine.indexOf(n)+1,endLineNumber:this.lineCountWithOffset,endColumn:this.lastLine.length});i.enum&&i.enumDescriptions?.some(n=>!!n)&&i.enumDescriptions.forEach((n,r)=>{let s=T9o(String(i.enum[r])),l=n?`${s}: ${yVt(n)}`:s,c=l.split(/\n/g);c[0]=" - "+c[0],this._contentByLines.push(...c.map(u=>`${e}// ${u}`)),i.descriptionRanges.push({startLineNumber:this.lineCountWithOffset,startColumn:this.lastLine.indexOf(l)+1,endLineNumber:this.lineCountWithOffset,endColumn:this.lastLine.length})})}pushValue(i,e,t){let o=JSON.stringify(i.value,null,t);if(o&&typeof i.value=="object")if(i.overrides&&i.overrides.length){this._contentByLines.push(e+" {");for(let s of i.overrides)this.pushSetting(s,t+t),this._contentByLines.pop();let n=i.overrides[i.overrides.length-1],r=this._contentByLines[n.range.endLineNumber-2];this._contentByLines[n.range.endLineNumber-2]=r.substring(0,r.length-1),this._contentByLines.push(t+"}")}else{let n=o.split(`
`);this._contentByLines.push(e+n[0]);for(let r=1;r<n.length;r++)this._contentByLines.push(t+n[r])}else this._contentByLines.push(e+o)}addDescription(i,e,t){for(let o of i)t.push(e+"// "+o)}},fCi=class extends pZe{constructor(e="	"){super(0);this.indent=e}pushGroup(e){this._pushGroup(e,this.indent)}},wVt=class extends x{constructor(e){super();this.defaultSettings=e;this._content=null;this._onDidContentChanged=this._register(new E);this.onDidContentChanged=this._onDidContentChanged.event;this._register(e.onDidChange(()=>{this._content=null,this._onDidContentChanged.fire()}))}get content(){if(this._content===null){let e=new fCi;e.pushLine("{");for(let t of this.defaultSettings.getRegisteredGroups())e.pushGroup(t);e.pushLine("}"),this._content=e.getContent()}return this._content}};function T9o(a){return a&&a.replace(/\n/g,"\\n").replace(/\r/g,"\\r")}function bCi(a){return"// "+d(17892,null)+`
`+a.getDefaultKeybindingsContent()}var NRe=class{constructor(i,e){this._uri=i;this.keybindingService=e}get uri(){return this._uri}get content(){return this._content||(this._content=bCi(this.keybindingService)),this._content}getPreference(){return null}dispose(){}};NRe=I([m(1,_e)],NRe);var _9o=`{
}`,mZe=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T){super();this.editorService=e;this.editorGroupService=t;this.textFileService=o;this.configurationService=n;this.notificationService=r;this.contextService=s;this.instantiationService=l;this.userDataProfileService=c;this.userDataProfilesService=u;this.textModelResolverService=p;this.jsonEditingService=f;this.labelService=v;this.remoteAgentService=b;this.textEditorService=S;this.extensionService=w;this.progressService=k;this.environmentService=T;this._onDispose=this._register(new E);this._onDidDefaultSettingsContentChanged=this._register(new E);this.onDidDefaultSettingsContentChanged=this._onDidDefaultSettingsContentChanged.event;this._requestedDefaultSettings=new En;this._settingsGroups=void 0;this._cachedSettingsEditor2Input=void 0;this.defaultKeybindingsResource=A.from({scheme:Q.vscode,authority:"defaultsettings",path:"/keybindings.json"});this.defaultSettingsRawResource=A.from({scheme:Q.vscode,authority:"defaultsettings",path:"/defaultSettings.jsonc"});this._register(h.onDidUpdateKeybindings(()=>{let P=g.getModel(this.defaultKeybindingsResource);P&&g.updateModel(P,bCi(h))})),this._register(y.registerHandler(this))}get userSettingsResource(){return this.userDataProfileService.currentProfile.settingsResource}get workspaceSettingsResource(){if(this.contextService.getWorkbenchState()===1)return null;let e=this.contextService.getWorkspace();return e.configuration||e.folders[0].toResource(k_e)}createOrGetCachedSettingsEditor2Input(){return(!this._cachedSettingsEditor2Input||this._cachedSettingsEditor2Input.isDisposed())&&(this._cachedSettingsEditor2Input=new VD(this)),this._cachedSettingsEditor2Input}getFolderSettingsResource(e){let t=this.contextService.getWorkspaceFolder(e);return t?t.toResource(k_e):null}hasDefaultSettingsContent(e){return this.isDefaultSettingsResource(e)||Qe(e,this.defaultSettingsRawResource)||Qe(e,this.defaultKeybindingsResource)}getDefaultSettingsContent(e){if(this.isDefaultSettingsResource(e)){let t=this.getConfigurationTargetFromDefaultSettingsResource(e),o=this.getDefaultSettings(t);return this._requestedDefaultSettings.has(e)||(this._register(o.onDidChange(()=>this._onDidDefaultSettingsContentChanged.fire(e))),this._requestedDefaultSettings.add(e)),o.getContentWithoutMostCommonlyUsed(!0)}if(Qe(e,this.defaultSettingsRawResource))return this._defaultRawSettingsEditorModel||(this._defaultRawSettingsEditorModel=this._register(this.instantiationService.createInstance(wVt,this.getDefaultSettings(3))),this._register(this._defaultRawSettingsEditorModel.onDidContentChanged(()=>this._onDidDefaultSettingsContentChanged.fire(e)))),this._defaultRawSettingsEditorModel.content;if(Qe(e,this.defaultKeybindingsResource))return this.instantiationService.createInstance(NRe,e).content}async createPreferencesEditorModel(e){if(this.isDefaultSettingsResource(e))return this.createDefaultSettingsEditorModel(e);if(this.userSettingsResource.toString()===e.toString()||this.userDataProfilesService.defaultProfile.settingsResource.toString()===e.toString())return this.createEditableSettingsEditorModel(3,e);let t=await this.getEditableSettingsURI(5);if(t&&t.toString()===e.toString())return this.createEditableSettingsEditorModel(5,t);if(this.contextService.getWorkbenchState()===3){let r=await this.getEditableSettingsURI(6,e);if(r&&r.toString()===e.toString())return this.createEditableSettingsEditorModel(6,e)}let o=await this.remoteAgentService.getEnvironment(),n=o?o.settingsPath:null;return n&&n.toString()===e.toString()?this.createEditableSettingsEditorModel(4,e):null}openRawDefaultSettings(){return this.editorService.openEditor({resource:this.defaultSettingsRawResource})}openRawUserSettings(){return this.editorService.openEditor({resource:this.userSettingsResource})}shouldOpenJsonByDefault(){return this.configurationService.getValue("workbench.settings.editor")==="json"}async openPreferences(){await this.editorService.openEditor(this.instantiationService.createInstance(gee),void 0,OR)}openSettings(e={}){return e={...e,target:3},e.query&&(e.jsonEditor=!1),this.open(this.userSettingsResource,e)}openLanguageSpecificSettings(e,t={}){return this.shouldOpenJsonByDefault()?(t.query=void 0,t.revealSetting={key:`[${e}]`,edit:!0}):t.query=`@lang:${e}${t.query?` ${t.query}`:""}`,t.target=t.target??3,this.open(this.userSettingsResource,t)}open(e,t){if(t={...t,jsonEditor:t.jsonEditor??this.shouldOpenJsonByDefault()},t.jsonEditor&&t.query&&!t.revealSetting){let o=t.query.trim(),n=o.match(/^@id:(.+)$/),r;n?r=n[1].trim():ne.as(Jt.Configuration).getConfigurationProperties()[o.trim()]&&(r=o.trim()),t.query=void 0,r&&(t.revealSetting={key:r})}return t.jsonEditor?this.openSettingsJson(e,t):this.openSettings2(t)}async openSettings2(e){let t=this.createOrGetCachedSettingsEditor2Input();e={...e,focusSearch:!0};let o=this.getEditorGroupFromOptions(e);return this.editorService.openEditor(t,x_e(e),o)}openApplicationSettings(e={}){return e={...e,target:3},this.open(this.userDataProfilesService.defaultProfile.settingsResource,e)}openUserSettings(e={}){return e={...e,target:3},this.open(this.userSettingsResource,e)}async openRemoteSettings(e={}){let t=await this.remoteAgentService.getEnvironment();t&&(e={...e,target:4},this.open(t.settingsPath,e))}openWorkspaceSettings(e={}){return this.workspaceSettingsResource?(e={...e,target:5},this.open(this.workspaceSettingsResource,e)):(this.notificationService.info(d(17886,null)),Promise.reject(null))}async openFolderSettings(e={}){if(e={...e,target:6},!e.folderUri)throw new Error("Missing folder URI");let t=await this.getEditableSettingsURI(6,e.folderUri);if(!t)throw new Error(`Invalid folder URI - ${e.folderUri.toString()}`);return this.open(t,e)}async openGlobalKeybindingSettings(e,t){if(t={pinned:!0,revealIfOpened:!0,...t},e){let o="// "+d(17884,null)+`
[
]`,n=this.userDataProfileService.currentProfile.keybindingsResource,r=!!this.configurationService.getValue("workbench.settings.openDefaultKeybindings");if(await this.createIfNotExists(n,o),r){let s=t.groupId??this.editorGroupService.activeGroup.id,l=this.editorGroupService.addGroup(s,3);await Promise.all([this.editorService.openEditor({resource:this.defaultKeybindingsResource,options:{pinned:!0,preserveFocus:!0,revealIfOpened:!0,override:la.id},label:d(17883,null),description:""},s),this.editorService.openEditor({resource:n,options:t},l.id)])}else await this.editorService.openEditor({resource:n,options:t},this.getEditorGroupFromOptions(t))}else{let o=this.getEditorGroupFromOptions(t),n=await this.editorService.openEditor(this.instantiationService.createInstance(WD),{...t},o);t.query&&n.search(t.query)}}openDefaultKeybindingsFile(){return this.editorService.openEditor({resource:this.defaultKeybindingsResource,label:d(17883,null)})}getEditorGroupFromOptions(e){return this.configurationService.getValue("workbench.editor.useModal")!=="off"&&!this.environmentService.enableSmokeTestDriver&&!this.environmentService.extensionTestsLocationURI?OR:e.openToSide?In:e?.groupId!==void 0?this.editorGroupService.getGroup(e.groupId)??this.editorGroupService.activeGroup:jn}async openSettingsJson(e,t){let o=this.getEditorGroupFromOptions(t),n=await this.doOpenSettingsJson(e,t,o);return n&&t?.revealSetting&&await this.revealSetting(t.revealSetting.key,!!t.revealSetting.edit,n,e),n}async doOpenSettingsJson(e,t,o){let n=!!this.configurationService.getValue(pYe),r=!!this.configurationService.getValue(uYe);if(n||r)return this.doOpenSplitJSON(e,t,o);let s=t?.target??2,l=await this.getOrCreateEditableSettingsEditorInput(s,e);return t={...t,pinned:!0},await this.editorService.openEditor(l,{...x_e(t)},o)}async doOpenSplitJSON(e,t={},o){let n=t.target??2;await this.createSettingsIfNotExists(n,e);let r=this.createSplitJsonEditorInput(n,e);return t={...t,pinned:!0},this.editorService.openEditor(r,x_e(t),o)}createSplitJsonEditorInput(e,t){let o=this.textEditorService.createTextEditor({resource:t}),n=this.textEditorService.createTextEditor({resource:this.getDefaultSettingsResource(e)});return this.instantiationService.createInstance(Ma,o.getName(),void 0,n,o)}createSettings2EditorModel(){return this.instantiationService.createInstance(fee,this.getDefaultSettings(3))}getConfigurationTargetFromDefaultSettingsResource(e){return this.isDefaultWorkspaceSettingsResource(e)?5:this.isDefaultFolderSettingsResource(e)?6:3}isDefaultSettingsResource(e){return this.isDefaultUserSettingsResource(e)||this.isDefaultWorkspaceSettingsResource(e)||this.isDefaultFolderSettingsResource(e)}isDefaultUserSettingsResource(e){return e.authority==="defaultsettings"&&e.scheme===Q.vscode&&!!e.path.match(/\/(\d+\/)?settings\.json$/)}isDefaultWorkspaceSettingsResource(e){return e.authority==="defaultsettings"&&e.scheme===Q.vscode&&!!e.path.match(/\/(\d+\/)?workspaceSettings\.json$/)}isDefaultFolderSettingsResource(e){return e.authority==="defaultsettings"&&e.scheme===Q.vscode&&!!e.path.match(/\/(\d+\/)?resourceSettings\.json$/)}getDefaultSettingsResource(e){switch(e){case 5:return A.from({scheme:Q.vscode,authority:"defaultsettings",path:"/workspaceSettings.json"});case 6:return A.from({scheme:Q.vscode,authority:"defaultsettings",path:"/resourceSettings.json"})}return A.from({scheme:Q.vscode,authority:"defaultsettings",path:"/settings.json"})}async getOrCreateEditableSettingsEditorInput(e,t){return await this.createSettingsIfNotExists(e,t),this.textEditorService.createTextEditor({resource:t})}async createEditableSettingsEditorModel(e,t){let o=this.contextService.getWorkspace();if(o.configuration&&o.configuration.toString()===t.toString()){let r=await this.textModelResolverService.createModelReference(t);return this.instantiationService.createInstance(sme,r,e)}let n=await this.textModelResolverService.createModelReference(t);return this.instantiationService.createInstance(rme,n,e)}async createDefaultSettingsEditorModel(e){let t=await this.textModelResolverService.createModelReference(e),o=this.getConfigurationTargetFromDefaultSettingsResource(e);return this.instantiationService.createInstance(FRe,e,t,this.getDefaultSettings(o))}getDefaultSettings(e){return e===5?(this._defaultWorkspaceSettingsContentModel??=this._register(new ORe(this.getMostCommonlyUsedSettings(),e,this.configurationService)),this._defaultWorkspaceSettingsContentModel):e===6?(this._defaultFolderSettingsContentModel??=this._register(new ORe(this.getMostCommonlyUsedSettings(),e,this.configurationService)),this._defaultFolderSettingsContentModel):(this._defaultUserSettingsContentModel??=this._register(new ORe(this.getMostCommonlyUsedSettings(),e,this.configurationService)),this._defaultUserSettingsContentModel)}async getEditableSettingsURI(e,t){switch(e){case 1:return this.userDataProfilesService.defaultProfile.settingsResource;case 2:case 3:return this.userSettingsResource;case 4:{let o=await this.remoteAgentService.getEnvironment();return o?o.settingsPath:null}case 5:return this.workspaceSettingsResource;case 6:if(t)return this.getFolderSettingsResource(t)}return null}async createSettingsIfNotExists(e,t){if(this.contextService.getWorkbenchState()===3&&e===5){let o=this.contextService.getWorkspace().configuration;if(!o)return;let n=await this.textFileService.read(o);Object.keys(jr(n.value)).indexOf("settings")===-1&&await this.jsonEditingService.write(t,[{path:["settings"],value:{}}],!0);return}await this.createIfNotExists(t,_9o)}async createIfNotExists(e,t){try{await this.textFileService.read(e,{acceptTextOnly:!0})}catch(o){if(o.fileOperationResult===1)try{await this.textFileService.write(e,t);return}catch(n){throw new Error(d(17885,null,this.labelService.getUriLabel(e,{relative:!0}),Pn(n)))}else throw o}}getMostCommonlyUsedSettings(){return["editor.fontSize","editor.formatOnSave","files.autoSave","editor.defaultFormatter","editor.fontFamily","editor.wordWrap","chat.agent.maxRequests","files.exclude","workbench.colorTheme","editor.tabSize","editor.mouseWheelZoom","editor.formatOnPaste"]}async revealSetting(e,t,o,n){let r=o?ha(o.getControl()):null;if(!r)return;let s=await this.createPreferencesEditorModel(n);if(!s)return;let l=await this.getPositionToReveal(e,t,s,r);l&&(r.setPosition(l),r.revealPositionNearTop(l),r.focus(),t&&nc.get(r)?.triggerSuggest())}async getPositionToReveal(e,t,o,n){let r=n.getModel();if(!r)return null;let s=ne.as(Jt.Configuration).getConfigurationProperties()[e],l=kg.test(e);if(!s&&!l)return null;let c=null,u=s?.type??"object",p=o.getPreference(e);if(!p&&t){let h=u==="object"||u==="array"?this.configurationService.inspect(e).defaultValue:lje(u);if(h=h===void 0&&l?{}:h,h!==void 0){let g=o instanceof sme?["settings",e]:[e];await this.jsonEditingService.write(o.uri,[{path:g,value:h}],!1),p=o.getPreference(e)}}if(p)if(t)if(xi(p.value)||Array.isArray(p.value)){c={lineNumber:p.valueRange.startLineNumber,column:p.valueRange.startColumn+1},n.setPosition(c),await this.instantiationService.invokeFunction(g=>zL.LineBreakInsert.runEditorCommand(g,n,null)),c={lineNumber:c.lineNumber+1,column:r.getLineMaxColumn(c.lineNumber+1)};let h=r.getLineFirstNonWhitespaceColumn(c.lineNumber);h&&(n.setPosition({lineNumber:c.lineNumber,column:h}),await this.instantiationService.invokeFunction(g=>zL.LineBreakInsert.runEditorCommand(g,n,null)),c={lineNumber:c.lineNumber,column:r.getLineMaxColumn(c.lineNumber)})}else c={lineNumber:p.valueRange.startLineNumber,column:p.valueRange.endColumn};else c={lineNumber:p.keyRange.startLineNumber,column:p.keyRange.startColumn};return c}getSetting(e){if(!this._settingsGroups){let t=this.getDefaultSettings(2),o=this._register(new me);o.value=t.onDidChange(()=>{this._settingsGroups=void 0,o.clear()}),this._settingsGroups=t.getSettingsGroups()}for(let t of this._settingsGroups)for(let o of t.sections)for(let n of o.settings)if(OI(n.key,e)===0)return n}async handleURL(e){if(OI(e.authority,E_e)!==0)return!1;let t=e.path.split("/").filter(s=>!!s),o=t.length>0?t[0]:void 0;if(!o)return this.openSettings(),!0;let n=this.getSetting(o);!n&&this.extensionService.extensions.length===0&&(await this.progressService.withProgress({location:10},()=>U.toPromise(this.extensionService.onDidRegisterExtensions)),n=this.getSetting(o));let r={};return n&&(r.query=o),this.openSettings(r),!0}dispose(){this._cachedSettingsEditor2Input&&!this._cachedSettingsEditor2Input.isDisposed()&&this._cachedSettingsEditor2Input.dispose(),this._onDispose.fire(),super.dispose()}};mZe=I([m(0,ee),m(1,wt),m(2,Uo),m(3,B),m(4,Ne),m(5,Pe),m(6,F),m(7,ln),m(8,an),m(9,Bt),m(10,_e),m(11,Tt),m(12,bg),m(13,rt),m(14,bo),m(15,Pk),m(16,_b),m(17,lt),m(18,Fo),m(19,At)],mZe);Ee(Go,mZe,1);var hZe=class{constructor(i,e,t,o){this.fileService=i;this.textModelResolverService=e;this.textFileService=t;this.filesConfigurationService=o;this.queue=new uh}write(i,e){return Promise.resolve(this.queue.queue(()=>this.doWriteConfiguration(i,e)))}async doWriteConfiguration(i,e){let t=await this.resolveAndValidate(i,!0);try{await this.writeToBuffer(t.object.textEditorModel,e)}finally{t.dispose()}}async writeToBuffer(i,e){let t;try{t=this.filesConfigurationService.enableAutoSaveAfterShortDelay(i.uri);let o=!1;for(let n of e){let r=this.getEdits(i,n)[0];o=!!r&&this.applyEditsToBuffer(r,i)||o}if(o)return this.textFileService.save(i.uri)}finally{t?.dispose()}}applyEditsToBuffer(i,e){let t=e.getPositionAt(i.offset),o=e.getPositionAt(i.offset+i.length),n=new z(t.lineNumber,t.column,o.lineNumber,o.column),r=e.getValueInRange(n);if(i.content!==r){let s=r?Hn.replace(n,i.content):Hn.insert(t,i.content);return e.pushEditOperations([new ti(t.lineNumber,t.column,t.lineNumber,t.column)],[s],()=>[]),!0}return!1}getEdits(i,e){let{tabSize:t,insertSpaces:o}=i.getOptions(),n=i.getEOL(),{path:r,value:s}=e;if(!r.length){let l=JSON.stringify(s,null,o?" ".repeat(t):"	");return[{content:l,length:l.length,offset:0}]}return Mb(i.getValue(),r,s,{tabSize:t,insertSpaces:o,eol:n})}async resolveModelReference(i){return await this.fileService.exists(i)||await this.textFileService.write(i,"{}",{encoding:"utf8"}),this.textModelResolverService.createModelReference(i)}hasParseErrors(i){let e=[];return jr(i.getValue(),e,{allowTrailingComma:!0,allowEmptyContent:!0}),e.length>0}async resolveAndValidate(i,e){let t=await this.resolveModelReference(i),o=t.object.textEditorModel;return this.hasParseErrors(o)?(t.dispose(),this.reject(0)):t}reject(i){let e=this.toErrorMessage(i);return Promise.reject(new bVt(e,i))}toErrorMessage(i){if(i===0)return d(17461,null)}};hZe=I([m(0,fe),m(1,Bt),m(2,Uo),m(3,gr)],hZe);Ee(bg,hZe,1);var D0=class extends Lw{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super(r,n,f,v);this.resource=e;this.preferredEncoding=t;this.preferredLanguageId=o;this.fileService=s;this.textFileService=l;this.workingCopyBackupService=c;this.logService=u;this.workingCopyService=p;this.filesConfigurationService=h;this.labelService=g;this.pathService=b;this.extensionService=S;this.progressService=y;this._onDidChangeContent=this._register(new E);this.onDidChangeContent=this._onDidChangeContent.event;this._onDidResolve=this._register(new E);this.onDidResolve=this._onDidResolve.event;this._onDidChangeDirty=this._register(new E);this.onDidChangeDirty=this._onDidChangeDirty.event;this._onDidSaveError=this._register(new E);this.onDidSaveError=this._onDidSaveError.event;this._onDidSave=this._register(new E);this.onDidSave=this._onDidSave.event;this._onDidRevert=this._register(new E);this.onDidRevert=this._onDidRevert.event;this._onDidChangeEncoding=this._register(new E);this.onDidChangeEncoding=this._onDidChangeEncoding.event;this._onDidChangeOrphaned=this._register(new E);this.onDidChangeOrphaned=this._onDidChangeOrphaned.event;this._onDidChangeReadonly=this._register(new E);this.onDidChangeReadonly=this._onDidChangeReadonly.event;this.typeId=gA;this.capabilities=0;this.versionId=0;this.ignoreDirtyOnModelContentChange=!1;this.ignoreSaveFromSaveParticipants=!1;this.lastModelContentChangeFromUndoRedo=void 0;this.saveSequentializer=new bIe;this.dirty=!1;this.inConflictMode=!1;this.inOrphanMode=!1;this.inErrorMode=!1;this.hasEncodingSetExplicitly=!1;this.name=jo(this.labelService.getUriLabel(this.resource)),this.resourceHasExtension=!!ar.extname(this.resource),this._register(this.workingCopyService.registerWorkingCopy(this)),this.registerListeners()}static{this.TEXTFILE_SAVE_ENCODING_SOURCE=Ih.registerSource("textFileEncoding.source",d(17982,null))}static{this.UNDO_REDO_SAVE_PARTICIPANTS_AUTO_SAVE_THROTTLE_THRESHOLD=500}registerListeners(){this._register(this.fileService.onDidFilesChange(e=>this.onDidFilesChange(e))),this._register(this.filesConfigurationService.onDidChangeFilesAssociation(()=>this.onDidChangeFilesAssociation())),this._register(this.filesConfigurationService.onDidChangeReadonly(()=>this._onDidChangeReadonly.fire()))}async onDidFilesChange(e){let t=!1,o;if(this.inOrphanMode?e.contains(this.resource,1)&&(o=!1,t=!0):e.contains(this.resource,2)&&(o=!0,t=!0),t&&this.inOrphanMode!==o){let n=!1;o&&(await Li(100,Se.None),this.isDisposed()?n=!0:n=!await this.fileService.exists(this.resource)),this.inOrphanMode!==n&&!this.isDisposed()&&this.setOrphaned(n)}}setOrphaned(e){this.inOrphanMode!==e&&(this.inOrphanMode=e,this._onDidChangeOrphaned.fire())}onDidChangeFilesAssociation(){if(!this.isResolved())return;let e=this.getFirstLineText(this.textEditorModel),t=this.getOrCreateLanguage(this.resource,this.languageService,this.preferredLanguageId,e);this.textEditorModel.setLanguage(t)}setLanguageId(e,t){super.setLanguageId(e,t),this.preferredLanguageId=e}async backup(e){let t;this.lastResolvedFileStat&&(t={mtime:this.lastResolvedFileStat.mtime,ctime:this.lastResolvedFileStat.ctime,size:this.lastResolvedFileStat.size,etag:this.lastResolvedFileStat.etag,orphaned:this.inOrphanMode});let o=await this.textFileService.getEncodedReadable(this.resource,this.createSnapshot()??void 0,{encoding:kb});return{meta:t,content:o}}async revert(e){if(!this.isResolved())return;let t=this.dirty,o=this.doSetDirty(!1);if(!e?.soft)try{await this.forceResolveFromFile()}catch(r){if(r.fileOperationResult!==1)throw o(),r}this._onDidRevert.fire(),t&&this._onDidChangeDirty.fire()}async resolve(e){if(this.trace("resolve() - enter"),Mo("code/willResolveTextFileEditorModel"),this.isDisposed()){this.trace("resolve() - exit - without resolving because model is disposed");return}if(!e?.contents&&(this.dirty||this.saveSequentializer.isRunning())){this.trace("resolve() - exit - without resolving because model is dirty or being saved");return}await this.doResolve(e),Mo("code/didResolveTextFileEditorModel")}async doResolve(e){if(e?.contents)return this.resolveFromBuffer(e.contents,e);if(!(!this.isResolved()&&await this.resolveFromBackup(e)))return this.resolveFromFile(e)}async resolveFromBuffer(e,t){this.trace("resolveFromBuffer()");let o,n,r,s;try{let c=await this.fileService.stat(this.resource);o=c.mtime,n=c.ctime,r=c.size,s=c.etag,this.setOrphaned(!1)}catch(c){o=Date.now(),n=Date.now(),r=0,s=JL,this.setOrphaned(c.fileOperationResult===1)}let l=await this.textFileService.encoding.getPreferredWriteEncoding(this.resource,this.preferredEncoding);this.resolveFromContent({resource:this.resource,name:this.name,mtime:o,ctime:n,size:r,etag:s,value:e,encoding:l.encoding,readonly:!1,locked:!1,executable:!1},!0,t)}async resolveFromBackup(e){let t=await this.workingCopyBackupService.resolve(this),o=kb;return t&&(o=(await this.textFileService.encoding.getPreferredWriteEncoding(this.resource,this.preferredEncoding)).encoding),!this.isResolved()?t?(await this.doResolveFromBackup(t,o,e),!0):!1:(this.trace("resolveFromBackup() - exit - without resolving because previously new model got created meanwhile"),!0)}async doResolveFromBackup(e,t,o){this.trace("doResolveFromBackup()"),this.resolveFromContent({resource:this.resource,name:this.name,mtime:e.meta?e.meta.mtime:Date.now(),ctime:e.meta?e.meta.ctime:Date.now(),size:e.meta?e.meta.size:0,etag:e.meta?e.meta.etag:JL,value:await iY(await this.textFileService.getDecodedStream(this.resource,e.value,{encoding:kb})),encoding:t,readonly:!1,locked:!1,executable:!1},!0,o),e.meta?.orphaned&&this.setOrphaned(!0)}async resolveFromFile(e){this.trace("resolveFromFile()");let t=e?.forceReadFromFile,o=this.isResolved()||e?.allowBinary,n;t?n=JL:this.lastResolvedFileStat&&(n=this.lastResolvedFileStat.etag);let r=this.versionId;try{let s=await this.textFileService.readStream(this.resource,{acceptTextOnly:!o,etag:n,encoding:this.preferredEncoding,limits:e?.limits});if(this.setOrphaned(!1),r!==this.versionId){this.trace("resolveFromFile() - exit - without resolving because model content changed");return}return this.resolveFromContent(s,!1,e)}catch(s){let l=s.fileOperationResult;if(this.setOrphaned(l===1),this.isResolved()&&l===2){s instanceof J1&&this.updateLastResolvedFileStat(s.stat);return}if(this.isResolved()&&l===1&&!t)return;throw s}}resolveFromContent(e,t,o){if(this.trace("resolveFromContent() - enter"),this.isDisposed()){this.trace("resolveFromContent() - exit - because model is disposed");return}this.updateLastResolvedFileStat({resource:this.resource,name:e.name,mtime:e.mtime,ctime:e.ctime,size:e.size,etag:e.etag,readonly:e.readonly,locked:e.locked,executable:!1,isFile:!0,isDirectory:!1,isSymbolicLink:!1,children:void 0});let n=this.contentEncoding;this.contentEncoding=e.encoding,this.preferredEncoding?this.updatePreferredEncoding(this.contentEncoding):n!==this.contentEncoding&&this._onDidChangeEncoding.fire(),this.textEditorModel?this.doUpdateTextModel(e.value,Wc.reloadFromDisk()):this.doCreateTextModel(e.resource,e.value),this.setDirty(!!t),this._onDidResolve.fire(o?.reason??3)}doCreateTextModel(e,t){this.trace("doCreateTextModel()");let o=this.createTextEditorModel(t,e,this.preferredLanguageId);this.installModelListeners(o),this.autoDetectLanguage()}doUpdateTextModel(e,t){this.trace("doUpdateTextModel()"),this.ignoreDirtyOnModelContentChange=!0;try{this.updateTextEditorModel(e,this.preferredLanguageId,t)}finally{this.ignoreDirtyOnModelContentChange=!1}}installModelListeners(e){this._register(e.onDidChangeContent(t=>this.onModelContentChanged(e,t.isUndoing||t.isRedoing))),this._register(e.onDidChangeLanguage(()=>this.onMaybeShouldChangeEncoding())),super.installModelListeners(e)}onModelContentChanged(e,t){if(this.trace("onModelContentChanged() - enter"),this.versionId++,this.trace(`onModelContentChanged() - new versionId ${this.versionId}`),t&&(this.lastModelContentChangeFromUndoRedo=Date.now()),!this.ignoreDirtyOnModelContentChange&&!this.isReadonly())if(e.getAlternativeVersionId()===this.bufferSavedVersionId){this.trace("onModelContentChanged() - model content changed back to last saved version");let o=this.dirty;this.setDirty(!1),o&&this._onDidRevert.fire()}else this.trace("onModelContentChanged() - model content changed and marked as dirty"),this.setDirty(!0);this._onDidChangeContent.fire(),this.autoDetectLanguage()}async autoDetectLanguage(){await this.extensionService?.whenInstalledExtensionsRegistered();let e=this.getLanguageId();if(this.resource.scheme===this.pathService.defaultUriScheme&&(!e||e===$r)&&!this.resourceHasExtension)return super.autoDetectLanguage()}async forceResolveFromFile(){this.isDisposed()||await this.textFileService.files.resolve(this.resource,{reload:{async:!1},forceReadFromFile:!0})}isDirty(){return this.dirty}isModified(){return this.isDirty()}setDirty(e){if(!this.isResolved())return;let t=this.dirty;this.doSetDirty(e),e!==t&&this._onDidChangeDirty.fire()}doSetDirty(e){let t=this.dirty,o=this.inConflictMode,n=this.inErrorMode,r=this.bufferSavedVersionId;return e?this.dirty=!0:(this.dirty=!1,this.inConflictMode=!1,this.inErrorMode=!1,this.updateSavedVersionId()),()=>{this.dirty=t,this.inConflictMode=o,this.inErrorMode=n,this.bufferSavedVersionId=r}}async save(e=Object.create(null)){return this.isResolved()?this.isReadonly()?(this.trace("save() - ignoring request for readonly resource"),!1):(this.hasState(3)||this.hasState(5))&&(e.reason===2||e.reason===3||e.reason===4)?(this.trace("save() - ignoring auto save request for model that is in conflict or error"),!1):(this.trace("save() - enter"),await this.doSave(e),this.trace("save() - exit"),this.hasState(0)):!1}async doSave(e){typeof e.reason!="number"&&(e.reason=1);let t=this.versionId;if(this.trace(`doSave(${t}) - enter with versionId ${t}`),this.ignoreSaveFromSaveParticipants){this.trace(`doSave(${t}) - exit - refusing to save() recursively from save participant`);return}if(this.saveSequentializer.isRunning(t))return this.trace(`doSave(${t}) - exit - found a running save for versionId ${t}`),this.saveSequentializer.running;if(!e.force&&!this.dirty){this.trace(`doSave(${t}) - exit - because not dirty and/or versionId is different (this.isDirty: ${this.dirty}, this.versionId: ${this.versionId})`);return}if(this.saveSequentializer.isRunning())return this.trace(`doSave(${t}) - exit - because busy saving`),this.saveSequentializer.cancelRunning(),this.saveSequentializer.queue(()=>this.doSave(e));this.isResolved()&&this.textEditorModel.pushStackElement();let o=new Ye;return this.progressService.withProgress({title:d(17980,null,this.name),location:10,cancellable:!0,delay:this.isDirty()?3e3:5e3},n=>this.doSaveSequential(t,e,n,o),()=>{o.cancel()}).finally(()=>{o.dispose()})}doSaveSequential(e,t,o,n){return this.saveSequentializer.run(e,(async()=>{if(this.isResolved()&&!t.skipSaveParticipants)try{if(t.reason===2&&typeof this.lastModelContentChangeFromUndoRedo=="number"){let l=Date.now()-this.lastModelContentChangeFromUndoRedo;l<D0.UNDO_REDO_SAVE_PARTICIPANTS_AUTO_SAVE_THROTTLE_THRESHOLD&&await Li(D0.UNDO_REDO_SAVE_PARTICIPANTS_AUTO_SAVE_THROTTLE_THRESHOLD-l)}if(!n.token.isCancellationRequested){this.ignoreSaveFromSaveParticipants=!0;try{await this.textFileService.files.runSaveParticipants(this,{reason:t.reason??1,savedFrom:t.from},o,n.token)}catch(l){ao(l)&&!n.token.isCancellationRequested&&n.cancel()}finally{this.ignoreSaveFromSaveParticipants=!1}}}catch(l){this.logService.error(`[text file model] runSaveParticipants(${e}) - resulted in an error: ${l.toString()}`,this.resource.toString())}if(n.token.isCancellationRequested||(n.dispose(),this.isDisposed())||!this.isResolved())return;e=this.versionId,this.inErrorMode=!1,o.report({message:d(17981,null)}),this.trace(`doSave(${e}) - before write()`);let r=Ci(this.lastResolvedFileStat),s=this;return this.saveSequentializer.run(e,(async()=>{try{let l=await this.textFileService.write(r.resource,s.createSnapshot(),{mtime:r.mtime,encoding:this.getEncoding(),etag:t.ignoreModifiedSince||!this.filesConfigurationService.preventSaveConflicts(r.resource,s.getLanguageId())?JL:r.etag,unlock:t.writeUnlock,writeElevated:t.writeElevated});this.handleSaveSuccess(l,e,t)}catch(l){this.handleSaveError(l,e,t)}})())})(),()=>n.cancel())}handleSaveSuccess(e,t,o){this.updateLastResolvedFileStat(e),t===this.versionId?(this.trace(`handleSaveSuccess(${t}) - setting dirty to false because versionId did not change`),this.setDirty(!1)):this.trace(`handleSaveSuccess(${t}) - not setting dirty to false because versionId did change meanwhile`),this.setOrphaned(!1),this._onDidSave.fire({reason:o.reason,stat:e,source:o.source})}handleSaveError(e,t,o){if((o.ignoreErrorHandler?this.logService.trace:this.logService.error).apply(this.logService,[`[text file model] handleSaveError(${t}) - exit - resulted in a save error: ${e.toString()}`,this.resource.toString()]),o.ignoreErrorHandler)throw e;this.setDirty(!0),this.inErrorMode=!0,e.fileOperationResult===3&&(this.inConflictMode=!0),this.textFileService.files.saveErrorHandler.onSaveError(e,this,o),this._onDidSaveError.fire()}updateSavedVersionId(){this.isResolved()&&(this.bufferSavedVersionId=this.textEditorModel.getAlternativeVersionId())}updateLastResolvedFileStat(e){let t=this.isReadonly();this.lastResolvedFileStat?this.lastResolvedFileStat.mtime<=e.mtime?this.lastResolvedFileStat=e:this.lastResolvedFileStat={...this.lastResolvedFileStat,readonly:e.readonly,locked:e.locked}:this.lastResolvedFileStat=e,this.isReadonly()!==t&&this._onDidChangeReadonly.fire()}hasState(e){switch(e){case 3:return this.inConflictMode;case 1:return this.dirty;case 5:return this.inErrorMode;case 4:return this.inOrphanMode;case 2:return this.saveSequentializer.isRunning();case 0:return!this.dirty}}async joinState(e){return this.saveSequentializer.running}getLanguageId(){return this.textEditorModel?this.textEditorModel.getLanguageId():this.preferredLanguageId}async onMaybeShouldChangeEncoding(){if(this.hasEncodingSetExplicitly){this.trace("onMaybeShouldChangeEncoding() - ignoring because encoding was set explicitly");return}if(this.contentEncoding===PB||this.contentEncoding===E4||this.contentEncoding===T4){this.trace("onMaybeShouldChangeEncoding() - ignoring because content encoding has a BOM");return}let{encoding:e}=await this.textFileService.encoding.getPreferredReadEncoding(this.resource);if(typeof e!="string"||!this.isNewEncoding(e)){this.trace(`onMaybeShouldChangeEncoding() - ignoring because preferred encoding ${e} is not new`);return}if(this.isDirty()){this.trace("onMaybeShouldChangeEncoding() - ignoring because model is dirty");return}return this.logService.info(`Adjusting encoding based on configured language override to '${e}' for ${this.resource.toString(!0)}.`),this.forceResolveFromFile()}setEncoding(e,t){return this.hasEncodingSetExplicitly=!0,this.setEncodingInternal(e,t)}async setEncodingInternal(e,t){if(t===0)this.updatePreferredEncoding(e),this.isDirty()||(this.versionId++,this.setDirty(!0)),this.inConflictMode||await this.save({source:D0.TEXTFILE_SAVE_ENCODING_SOURCE});else{if(!this.isNewEncoding(e))return;if(this.isDirty())throw new Error("Cannot re-open a dirty text document with different encoding. Save it first.");this.updatePreferredEncoding(e),await this.forceResolveFromFile()}}updatePreferredEncoding(e){this.isNewEncoding(e)&&(this.preferredEncoding=e,this._onDidChangeEncoding.fire())}isNewEncoding(e){return!(this.preferredEncoding===e||!this.preferredEncoding&&this.contentEncoding===e)}getEncoding(){return this.preferredEncoding||this.contentEncoding}trace(e){this.logService.trace(`[text file model] ${e}`,this.resource.toString())}isResolved(){return!!this.textEditorModel}isReadonly(){return this.filesConfigurationService.isReadonly(this.resource,this.lastResolvedFileStat)}dispose(){this.trace("dispose()"),this.inConflictMode=!1,this.inOrphanMode=!1,this.inErrorMode=!1,super.dispose()}};D0=I([m(3,_t),m(4,Tt),m(5,fe),m(6,Uo),m(7,hm),m(8,se),m(9,Xa),m(10,gr),m(11,rt),m(12,vS),m(13,Oi),m(14,An),m(15,lt),m(16,Fo)],D0);var WRe=class extends x{constructor(e,t,o){super();this._modelService=e;this._textModelService=t;this._undoRedoService=o;this._register(this._modelService.onModelRemoved(n=>{let r=this._undoRedoService.getElements(n.uri);if(!(r.past.length===0&&r.future.length===0)){for(let s of r.past)s instanceof BV&&s.setDelegate(this);for(let s of r.future)s instanceof BV&&s.setDelegate(this)}}))}prepareUndoRedo(e){let t=e.getMissingModels();if(t.length===0)return x.None;let o=t.map(async n=>{try{return await this._textModelService.createModelReference(n)}catch{return x.None}});return Promise.all(o).then(n=>({dispose:()=>Be(n)}))}};WRe=I([m(0,Tt),m(1,Bt),m(2,Ml)],WRe);var gZe=class extends uC{constructor(e,t,o,n){super();this.instantiationService=e;this.textFileService=t;this.fileService=o;this.modelService=n;this.providers=new Map;this.modelsToDispose=new Map}createReferencedObject(e){return this.doCreateReferencedObject(e)}async doCreateReferencedObject(e,t){let o=A.parse(e),n=this.modelsToDispose.get(e);if(this.modelsToDispose.delete(e),o.scheme===Q.untitled){let r=await this.textFileService.untitled.resolve({untitledResource:o});if(this.ensureResolvedModel(r,e))return r}if(this.fileService.hasProvider(o)){let r=await this.textFileService.files.resolve(o,{reason:2});if(this.ensureResolvedModel(r,e))return r}if(o.scheme===Q.inMemory||this.providers.has(o.scheme)){await this.ensureResolvedTextModelContent(o);let r;if(n)try{r=await n}catch{}if(r||(r=this.instantiationService.createInstance(wJ,o)),this.ensureResolvedModel(r,e))return r}if(!t)return await this.fileService.activateProvider(o.scheme),this.doCreateReferencedObject(e,!0);throw new Error(`Unable to resolve resource ${e}`)}ensureResolvedModel(e,t){if(c$i(e))return!0;throw new Error(`Unable to resolve resource ${t}`)}destroyReferencedObject(e,t){this.modelsToDispose.set(e,t),(async()=>{try{let o=await t;if(!this.modelsToDispose.has(e)||(o instanceof D0?await this.textFileService.files.canDispose(o):o instanceof gD&&await this.textFileService.untitled.canDispose(o),!this.modelsToDispose.has(e)))return;o.dispose()}catch{}finally{this.modelsToDispose.delete(e)}})()}registerTextModelContentProvider(e,t){let o=this.providers.get(e);return o||(o=[],this.providers.set(e,o)),o.unshift(t),Z(()=>{let n=this.providers.get(e);if(!n)return;let r=n.indexOf(t);r!==-1&&(n.splice(r,1),n.length===0&&this.providers.delete(e))})}hasTextModelContentProvider(e){return this.providers.get(e)!==void 0}async ensureResolvedTextModelContent(e){if(e.scheme===Q.inMemory&&this.modelService.getModel(e))return;let t=this.providers.get(e.scheme)||[];for(let o of t)if(await o.provideTextContent(e))return;throw new Error(`Unable to resolve text model content for resource ${e.toString()}`)}};gZe=I([m(0,F),m(1,Uo),m(2,fe),m(3,Tt)],gZe);var fZe=class extends x{constructor(e,t,o,n,r){super();this.instantiationService=e;this.fileService=t;this.undoRedoService=o;this.modelService=n;this.uriIdentityService=r;this._resourceModelCollection=void 0;this._asyncModelCollection=void 0;this._register(new WRe(this.modelService,this,this.undoRedoService))}get resourceModelCollection(){return this._resourceModelCollection||(this._resourceModelCollection=this.instantiationService.createInstance(gZe)),this._resourceModelCollection}get asyncModelCollection(){return this._asyncModelCollection||(this._asyncModelCollection=new VSe(this.resourceModelCollection)),this._asyncModelCollection}async createModelReference(e){return e=this.uriIdentityService.asCanonicalUri(e),await this.asyncModelCollection.acquire(e.toString())}registerTextModelContentProvider(e,t){return this.resourceModelCollection.registerTextModelContentProvider(e,t)}canHandleResource(e){return this.fileService.hasProvider(e)||e.scheme===Q.untitled||e.scheme===Q.inMemory?!0:this.resourceModelCollection.hasTextModelContentProvider(e.scheme)}};fZe=I([m(0,F),m(1,fe),m(2,Ml),m(3,Tt),m(4,ht)],fZe);Ee(Bt,fZe,1);var j2=class extends x{constructor(e,t,o){super();this.editorGroupService=t;this.storageService=o;this.keyMap=new Map;this.mostRecentEditorsMap=new o1;this.editorsPerResourceCounter=new gt;this._onDidMostRecentlyActiveEditorsChange=this._register(new E);this.onDidMostRecentlyActiveEditorsChange=this._onDidMostRecentlyActiveEditorsChange.event;this.editorGroupsContainer=e??t,this.isScoped=!!e,this.registerListeners(),this.loadState()}static{this.STORAGE_KEY="editors.mru"}get count(){return this.mostRecentEditorsMap.size}get editors(){return[...this.mostRecentEditorsMap.values()]}hasEditor(e){return this.editorsPerResourceCounter.get(e.resource)?.has(this.toIdentifier(e))??!1}hasEditors(e){return this.editorsPerResourceCounter.has(e)}toIdentifier(e,t){return typeof e!="string"?this.toIdentifier(e.typeId,e.editorId):t?`${e}/${t}`:e}registerListeners(){this._register(this.editorGroupsContainer.onDidAddGroup(e=>this.onGroupAdded(e))),this._register(this.editorGroupService.onDidChangeEditorPartOptions(e=>this.onDidChangeEditorPartOptions(e))),this._register(this.storageService.onWillSaveState(()=>this.saveState()))}onGroupAdded(e){let t=e.getEditors(0);for(let o=t.length-1;o>=0;o--)this.addMostRecentEditor(e,t[o],!1,!0);this.editorGroupsContainer.activeGroup===e&&e.activeEditor&&this.addMostRecentEditor(e,e.activeEditor,!0,!1),this.registerGroupListeners(e)}registerGroupListeners(e){let t=new N;t.add(e.onDidModelChange(o=>{switch(o.kind){case 0:{this.editorGroupsContainer.activeGroup===e&&e.activeEditor&&this.addMostRecentEditor(e,e.activeEditor,!0,!1);break}case 5:{o.editor&&(this.addMostRecentEditor(e,o.editor,!1,!0),this.ensureOpenedEditorsLimit({groupId:e.id,editor:o.editor},e.id));break}}})),t.add(e.onDidCloseEditor(o=>{this.removeMostRecentEditor(e,o.editor)})),t.add(e.onDidActiveEditorChange(o=>{o.editor&&this.addMostRecentEditor(e,o.editor,this.editorGroupsContainer.activeGroup===e,!1)})),U.once(e.onWillDispose)(()=>Be(t))}onDidChangeEditorPartOptions(e){if(!eo(e.newPartOptions.limit,e.oldPartOptions.limit)){let t=this.editorGroupsContainer.activeGroup,o;t.activeEditor&&(o={editor:t.activeEditor,groupId:t.id}),this.ensureOpenedEditorsLimit(o)}}addMostRecentEditor(e,t,o,n){let r=this.ensureKey(e,t),s=this.mostRecentEditorsMap.first;o||!s?this.mostRecentEditorsMap.set(r,r,s?1:void 0):(this.mostRecentEditorsMap.set(r,r,1),this.mostRecentEditorsMap.set(s,s,1)),n&&this.updateEditorResourcesMap(t,!0),this._onDidMostRecentlyActiveEditorsChange.fire()}updateEditorResourcesMap(e,t){let o,n,r;if(e instanceof Ma?(o=e.primary.resource,n=e.primary.typeId,r=e.primary.editorId):(o=e.resource,n=e.typeId,r=e.editorId),!o)return;let s=this.toIdentifier(n,r);if(t){let l=this.editorsPerResourceCounter.get(o);l||(l=new Map,this.editorsPerResourceCounter.set(o,l)),l.set(s,(l.get(s)??0)+1)}else{let l=this.editorsPerResourceCounter.get(o);if(l){let c=l.get(s)??0;c>1?l.set(s,c-1):(l.delete(s),l.size===0&&this.editorsPerResourceCounter.delete(o))}}}removeMostRecentEditor(e,t){this.updateEditorResourcesMap(t,!1);let o=this.findKey(e,t);if(o){this.mostRecentEditorsMap.delete(o);let n=this.keyMap.get(e.id);n?.delete(o.editor)&&n.size===0&&this.keyMap.delete(e.id),this._onDidMostRecentlyActiveEditorsChange.fire()}}findKey(e,t){let o=this.keyMap.get(e.id);if(o)return o.get(t)}ensureKey(e,t){let o=this.keyMap.get(e.id);o||(o=new Map,this.keyMap.set(e.id,o));let n=o.get(t);return n||(n={groupId:e.id,editor:t},o.set(t,n)),n}async ensureOpenedEditorsLimit(e,t){if(!this.editorGroupService.partOptions.limit?.enabled||typeof this.editorGroupService.partOptions.limit.value!="number"||this.editorGroupService.partOptions.limit.value<=0)return;let o=this.editorGroupService.partOptions.limit.value;if(this.editorGroupService.partOptions.limit?.perEditorGroup)if(typeof t=="number"){let n=this.editorGroupsContainer.getGroup(t);n&&await this.doEnsureOpenedEditorsLimit(o,n.getEditors(0).map(r=>({editor:r,groupId:t})),e)}else for(let n of this.editorGroupsContainer.groups)await this.ensureOpenedEditorsLimit(e,n.id);else await this.doEnsureOpenedEditorsLimit(o,[...this.mostRecentEditorsMap.values()],e)}async doEnsureOpenedEditorsLimit(e,t,o){let n;if(this.editorGroupService.partOptions.limit?.excludeDirty?n=t.filter(({editor:c})=>!(c.isDirty()&&!c.isSaving()||c.hasCapability(512))):n=t,e>=n.length)return;let r=n.reverse().filter(({editor:c,groupId:u})=>!(c.isDirty()&&!c.isSaving()||c.hasCapability(512)||o&&c===o.editor&&u===o.groupId||this.editorGroupsContainer.getGroup(u)?.isSticky(c))),s=n.length-e,l=new Map;for(let{groupId:c,editor:u}of r){let p=l.get(c);if(p||(p=[],l.set(c,p)),p.push(u),s--,s===0)break}for(let[c,u]of l){let p=this.editorGroupsContainer.getGroup(c);p&&await p.closeEditors(u,{preserveFocus:!0})}}saveState(){this.isScoped||(this.mostRecentEditorsMap.isEmpty()?this.storageService.remove(j2.STORAGE_KEY,1):this.storageService.store(j2.STORAGE_KEY,JSON.stringify(this.serialize()),1,1))}serialize(){let e=ne.as(qo.EditorFactory),t=[...this.mostRecentEditorsMap.values()],o=new Map;return{entries:di(t.map(({editor:n,groupId:r})=>{let s=this.editorGroupsContainer.getGroup(r);if(!s)return;let l=o.get(s);l||(l=s.getEditors(1).filter(u=>e.getEditorSerializer(u)?.canSerialize(u)),o.set(s,l));let c=l.indexOf(n);if(c!==-1)return{groupId:r,index:c}}))}}async loadState(){(this.editorGroupsContainer===this.editorGroupService.mainPart||this.editorGroupsContainer===this.editorGroupService)&&await this.editorGroupService.whenReady;let e=!1;if(!this.isScoped){let t=this.storageService.get(j2.STORAGE_KEY,1);t&&(e=!0,this.deserialize(JSON.parse(t)))}if(!e){let t=this.editorGroupsContainer.getGroups(1);for(let o=t.length-1;o>=0;o--){let n=t[o],r=n.getEditors(0);for(let s=r.length-1;s>=0;s--)this.addMostRecentEditor(n,r[s],!0,!0)}}for(let t of this.editorGroupsContainer.groups)this.registerGroupListeners(t)}deserialize(e){let t=[];for(let{groupId:o,index:n}of e.entries){let r=this.editorGroupsContainer.getGroup(o);if(!r)continue;let s=r.getEditorByIndex(n);if(!s)continue;let l=this.ensureKey(r,s);t.push([l,l]),this.updateEditorResourcesMap(s,!0)}this.mostRecentEditorsMap.fromJSON(t)}};j2=I([m(1,wt),m(2,ce)],j2);var ame=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this.editorGroupService=t;this.instantiationService=o;this.fileService=n;this.configurationService=r;this.contextService=s;this.uriIdentityService=l;this.editorResolverService=c;this.workspaceTrustRequestService=u;this.hostService=p;this.textEditorService=h;this._onDidActiveEditorChange=this._register(new E);this.onDidActiveEditorChange=this._onDidActiveEditorChange.event;this._onDidVisibleEditorsChange=this._register(new E);this.onDidVisibleEditorsChange=this._onDidVisibleEditorsChange.event;this._onDidEditorsChange=this._register(new E);this.onDidEditorsChange=this._onDidEditorsChange.event;this._onWillOpenEditor=this._register(new E);this.onWillOpenEditor=this._onWillOpenEditor.event;this._onDidCloseEditor=this._register(new E);this.onDidCloseEditor=this._onDidCloseEditor.event;this._onDidOpenEditorFail=this._register(new E);this.onDidOpenEditorFail=this._onDidOpenEditorFail.event;this._onDidMostRecentlyActiveEditorsChange=this._register(new E);this.onDidMostRecentlyActiveEditorsChange=this._onDidMostRecentlyActiveEditorsChange.event;this.lastActiveEditor=void 0;this.activeOutOfWorkspaceWatchers=new gt;this.closeOnFileDelete=!1;this.editorGroupsContainer=e??t,this.editorsObserver=this._register(this.instantiationService.createInstance(j2,this.editorGroupsContainer)),this.onConfigurationUpdated(),this.registerListeners()}createScoped(e,t){return t.add(new ame(e,this.editorGroupService,this.instantiationService,this.fileService,this.configurationService,this.contextService,this.uriIdentityService,this.editorResolverService,this.workspaceTrustRequestService,this.hostService,this.textEditorService))}registerListeners(){this.editorGroupsContainer===this.editorGroupService.mainPart||this.editorGroupsContainer===this.editorGroupService?this.editorGroupService.whenReady.then(()=>this.onEditorGroupsReady()):this.onEditorGroupsReady(),this._register(this.editorGroupsContainer.onDidChangeActiveGroup(e=>this.handleActiveEditorChange(e))),this._register(this.editorGroupsContainer.onDidAddGroup(e=>this.registerGroupListeners(e))),this._register(this.editorsObserver.onDidMostRecentlyActiveEditorsChange(()=>this._onDidMostRecentlyActiveEditorsChange.fire())),this._register(this.onDidVisibleEditorsChange(()=>this.handleVisibleEditorsChange())),this._register(this.fileService.onDidRunOperation(e=>this.onDidRunFileOperation(e))),this._register(this.fileService.onDidFilesChange(e=>this.onDidFilesChange(e))),this._register(this.configurationService.onDidChangeConfiguration(e=>this.onConfigurationUpdated(e)))}onEditorGroupsReady(){for(let e of this.editorGroupsContainer.groups)this.registerGroupListeners(e);this.activeEditor&&(this.doHandleActiveEditorChangeEvent(),this._onDidVisibleEditorsChange.fire())}handleActiveEditorChange(e){e===this.editorGroupsContainer.activeGroup&&(!this.lastActiveEditor&&!e.activeEditor||this.doHandleActiveEditorChangeEvent())}doHandleActiveEditorChangeEvent(){let e=this.editorGroupsContainer.activeGroup;this.lastActiveEditor=e.activeEditor??void 0,this._onDidActiveEditorChange.fire()}registerGroupListeners(e){let t=new N;t.add(e.onDidModelChange(o=>{this._onDidEditorsChange.fire({groupId:e.id,event:o})})),t.add(e.onDidActiveEditorChange(()=>{this.handleActiveEditorChange(e),this._onDidVisibleEditorsChange.fire()})),t.add(e.onWillOpenEditor(o=>{this._onWillOpenEditor.fire(o)})),t.add(e.onDidCloseEditor(o=>{this._onDidCloseEditor.fire(o)})),t.add(e.onDidOpenEditorFail(o=>{this._onDidOpenEditorFail.fire({editor:o,groupId:e.id})})),U.once(e.onWillDispose)(()=>{Be(t)})}handleVisibleEditorsChange(){let e=new En;for(let t of this.visibleEditors){let o=zo(di([po.getCanonicalUri(t,{supportSideBySide:1}),po.getCanonicalUri(t,{supportSideBySide:2})]),n=>n.toString());for(let n of o)this.fileService.hasProvider(n)&&!this.contextService.isInsideWorkspace(n)&&e.add(n)}for(let t of this.activeOutOfWorkspaceWatchers.keys())e.has(t)||(Be(this.activeOutOfWorkspaceWatchers.get(t)),this.activeOutOfWorkspaceWatchers.delete(t));for(let t of e.keys())if(!this.activeOutOfWorkspaceWatchers.get(t)){let o=this.fileService.watch(t);this.activeOutOfWorkspaceWatchers.set(t,o)}}async onDidRunFileOperation(e){e.isOperation(2)&&this.handleMovedFile(e.resource,e.target.resource),(e.isOperation(1)||e.isOperation(2))&&this.handleDeletedFile(e.resource,!1,e.target?e.target.resource:void 0)}onDidFilesChange(e){e.gotDeleted()&&this.handleDeletedFile(e,!0)}async handleMovedFile(e,t){for(let o of this.editorGroupsContainer.groups){let n=[];for(let r of o.editors){let s=r.resource;if(!s||!this.uriIdentityService.extUri.isEqualOrParent(s,e))continue;let l;if(this.uriIdentityService.extUri.isEqual(e,s))l=t;else{let p=hIe(s.path,e.path,this.uriIdentityService.extUri.ignorePathCasing(s));l=Ge(t,s.path.substr(p+e.path.length+1))}let c=await r.rename(o.id,l);if(!c)return;let u={preserveFocus:!0,pinned:o.isPinned(r),sticky:o.isSticky(r),index:o.getIndexOfEditor(r),inactive:!o.isActive(r)};ka(c.editor)?n.push({editor:r,replacement:c.editor,options:{...c.options,...u}}):n.push({editor:r,replacement:{...c.editor,options:{...c.editor.options,...u}}})}n.length&&this.replaceEditors(n,o)}}onConfigurationUpdated(e){if(e&&!e.affectsConfiguration("workbench.editor.closeOnFileDelete"))return;let t=this.configurationService.getValue();typeof t.workbench?.editor?.closeOnFileDelete=="boolean"?this.closeOnFileDelete=t.workbench.editor.closeOnFileDelete:this.closeOnFileDelete=!1}handleDeletedFile(e,t,o){for(let n of this.getAllNonDirtyEditors({includeUntitled:!1,supportSideBySide:!0}))(async()=>{let r=n.resource;if(r&&(this.closeOnFileDelete||!t)){if(o&&this.uriIdentityService.extUri.isEqualOrParent(r,o))return;let s=!1;if(e instanceof RO?s=e.contains(r,2):s=this.uriIdentityService.extUri.isEqualOrParent(r,e),!s)return;let l=!1;t&&this.fileService.hasProvider(r)&&(await Li(100),l=await this.fileService.exists(r)),!l&&!n.isDisposed()&&n.dispose()}})()}getAllNonDirtyEditors(e){let t=[];function o(n){n.hasCapability(4)&&!e.includeUntitled||n.isDirty()||t.push(n)}for(let n of this.editors)e.supportSideBySide&&n instanceof Ma?(o(n.primary),o(n.secondary)):o(n);return t}get activeEditorPane(){return this.editorGroupsContainer.activeGroup?.activeEditorPane}get activeTextEditorControl(){let e=this.activeEditorPane;if(e){let t=e.getControl();if(pn(t)||mc(t))return t;if(SO(t)&&pn(t.activeCodeEditor))return t.activeCodeEditor}}get activeTextEditorLanguageId(){let e,t=this.activeTextEditorControl;return mc(t)?e=t.getModifiedEditor():e=t,e?.getModel()?.getLanguageId()}get count(){return this.editorsObserver.count}get editors(){return this.getEditors(1).map(({editor:e})=>e)}getEditors(e,t){switch(e){case 0:return t?.excludeSticky?this.editorsObserver.editors.filter(({groupId:o,editor:n})=>!this.editorGroupsContainer.getGroup(o)?.isSticky(n)):this.editorsObserver.editors;case 1:{let o=[];for(let n of this.editorGroupsContainer.getGroups(2))o.push(...n.getEditors(1,t).map(r=>({editor:r,groupId:n.id})));return o}}}get activeEditor(){let e=this.editorGroupsContainer.activeGroup;return e?e.activeEditor??void 0:void 0}get visibleEditorPanes(){return di(this.editorGroupsContainer.groups.map(e=>e.activeEditorPane))}get visibleTextEditorControls(){return this.doGetVisibleTextEditorControls(this.visibleEditorPanes)}doGetVisibleTextEditorControls(e){let t=[];for(let o of e){let n=[];o instanceof _f?(n.push(o.getPrimaryEditorPane()?.getControl()),n.push(o.getSecondaryEditorPane()?.getControl())):n.push(o.getControl());for(let r of n)(pn(r)||mc(r))&&t.push(r)}return t}getVisibleTextEditorControls(e){return this.doGetVisibleTextEditorControls(di(this.editorGroupsContainer.getGroups(e===1?2:1).map(t=>t.activeEditorPane)))}get visibleEditors(){return di(this.editorGroupsContainer.groups.map(e=>e.activeEditor))}async openEditor(e,t,o){let n,r=ka(e)?t:e.options,s;if(oeo(t)&&(o=t),!ka(e)){let l=await this.editorResolverService.resolveEditor(e,o);if(l===1)return;J5(l)&&(n=l.editor,r=l.options,s=l.group)}if(n||(n=ka(e)?e:await this.textEditorService.resolveTextEditor(e)),!s){let l,c=this.instantiationService.invokeFunction(Ype,{editor:n,options:r},o);c instanceof Promise?[s,l]=await c:[s,l]=c,l&&(r={...r,activation:l})}return r?.preserveFocus&&this.editorGroupService.activeModalEditorPart?.groups.some(l=>l.id===s.id)&&this.editorGroupService.activeModalEditorPart.count===1&&this.editorGroupService.activeModalEditorPart.groups[0].isEmpty&&(r={...r,preserveFocus:!1}),s.openEditor(n,r)}async openEditors(e,t,o){if(o?.validateTrust&&!await this.handleWorkspaceTrust(e))return[];let n=new Map;for(let s of e){let l,c;if(!EF(s)){let p=await this.editorResolverService.resolveEditor(s,t);if(p===1)continue;J5(p)&&(l=p,c=p.group)}if(l||(l=EF(s)?s:{editor:await this.textEditorService.resolveTextEditor(s),options:s.options}),!c){let p=this.instantiationService.invokeFunction(Ype,l,t);p instanceof Promise?[c]=await p:[c]=p}l.options?.preserveFocus&&this.editorGroupService.activeModalEditorPart?.groups.some(p=>p.id===c.id)&&this.editorGroupService.activeModalEditorPart.count===1&&this.editorGroupService.activeModalEditorPart.groups[0].isEmpty&&(l={...l,options:{...l.options,preserveFocus:!1}});let u=n.get(c);u||(u=[],n.set(c,u)),u.push(l)}let r=[];for(let[s,l]of n)r.push(s.openEditors(l));return di(await dn.settled(r))}async handleWorkspaceTrust(e){let{resources:t,diffMode:o,mergeMode:n}=this.extractEditorResources(e);switch(await this.workspaceTrustRequestService.requestOpenFilesTrust(t)){case 1:return!0;case 2:return await this.hostService.openWindow(t.map(s=>({fileUri:s})),{forceNewWindow:!0,diffMode:o,mergeMode:n}),!1;case 3:return!1}}extractEditorResources(e){let t=new En,o=!1,n=!1;for(let r of e)if(EF(r)){let s=po.getOriginalUri(r.editor,{supportSideBySide:3});A.isUri(s)?t.add(s):s&&(s.primary&&t.add(s.primary),s.secondary&&t.add(s.secondary),o=r.editor instanceof Pa)}else WC(r)&&(A.isUri(r.input1)&&t.add(r.input1.resource),A.isUri(r.input2)&&t.add(r.input2.resource),A.isUri(r.base)&&t.add(r.base.resource),A.isUri(r.result)&&t.add(r.result.resource),n=!0),Ib(r)?(A.isUri(r.original.resource)&&t.add(r.original.resource),A.isUri(r.modified.resource)&&t.add(r.modified.resource),o=!0):Sf(r)&&t.add(r.resource);return{resources:Array.from(t.keys()),diffMode:o,mergeMode:n}}isOpened(e){return this.editorsObserver.hasEditor({resource:this.uriIdentityService.asCanonicalUri(e.resource),typeId:e.typeId,editorId:e.editorId})}isVisible(e){for(let t of this.editorGroupsContainer.groups)if(t.activeEditor?.matches(e))return!0;return!1}async closeEditor({editor:e,groupId:t},o){await this.editorGroupsContainer.getGroup(t)?.closeEditor(e,o)}async closeEditors(e,t){let o=new Map;for(let{editor:n,groupId:r}of e){let s=this.editorGroupsContainer.getGroup(r);if(!s)continue;let l=o.get(s);l||(l=[],o.set(s,l)),l.push(n)}for(let[n,r]of o)await n.closeEditors(r,t)}findEditors(e,t,o){let n=A.isUri(e)?e:e.resource,r=A.isUri(e)?void 0:e.typeId;if(t?.supportSideBySide!==4&&t?.supportSideBySide!==2&&!this.editorsObserver.hasEditors(n))return A.isUri(e)||gn(o)?[]:void 0;if(gn(o)){let s=[];for(let l of this.editorGroupsContainer.getGroups(t?.order===1?2:1)){let c=[];if(A.isUri(e))c.push(...this.findEditors(e,t,l));else{let u=this.findEditors(e,t,l);u&&c.push(u)}s.push(...c.map(u=>({editor:u,groupId:l.id})))}return s}else{let s=typeof o=="number"?this.editorGroupsContainer.getGroup(o):o;if(A.isUri(e))return s?s.findEditors(n,t):[];{if(!s)return;let l=s.findEditors(n,t);for(let c of l)if(c.typeId===r)return c;return}}}async replaceEditors(e,t){let o=typeof t=="number"?this.editorGroupsContainer.getGroup(t):t,n=[];for(let r of e){let s;if(!ka(r.replacement)){let l=await this.editorResolverService.resolveEditor(r.replacement,o);if(l===1)continue;J5(l)&&(s={editor:r.editor,replacement:l.editor,options:l.options,forceReplaceDirty:r.forceReplaceDirty})}s||(s={editor:r.editor,replacement:Xmi(r)?r.replacement:await this.textEditorService.resolveTextEditor(r.replacement),options:Xmi(r)?r.options:r.replacement.options,forceReplaceDirty:r.forceReplaceDirty}),n.push(s)}return o?.replaceEditors(n)}async save(e,t){Array.isArray(e)||(e=[e]);let o=this.getUniqueEditors(e),n=[],r=[];if(t?.saveAs)r.push(...o);else for(let{groupId:l,editor:c}of o)c.hasCapability(4)?r.push({groupId:l,editor:c}):n.push({groupId:l,editor:c});let s=await dn.settled(n.map(({groupId:l,editor:c})=>(t?.reason===1&&this.editorGroupsContainer.getGroup(l)?.pinEditor(c),c.save(l,t))));for(let{groupId:l,editor:c}of r){if(c.isDisposed())continue;let p={pinned:!0,viewState:(await this.openEditor(c,l))?.getViewState()},h=t?.saveAs?await c.saveAs(l,t):await c.save(l,t);if(s.push(h),!h)break;if(!c.matches(h)){let g=c.hasCapability(4)?this.editorGroupsContainer.groups.map(f=>f.id):[l];for(let f of g)h instanceof ls?await this.replaceEditors([{editor:c,replacement:h,options:p}],f):await this.replaceEditors([{editor:c,replacement:{...h,options:p}}],f)}}return{success:s.every(l=>!!l),editors:di(s)}}saveAll(e){return this.save(this.getAllModifiedEditors(e),e)}async revert(e,t){Array.isArray(e)||(e=[e]);let o=this.getUniqueEditors(e);return await dn.settled(o.map(async({groupId:n,editor:r})=>(this.editorGroupsContainer.getGroup(n)?.pinEditor(r),r.revert(n,t)))),!o.some(({editor:n})=>n.isDirty())}async revertAll(e){return this.revert(this.getAllModifiedEditors(e),e)}getAllModifiedEditors(e){let t=[];for(let o of this.editorGroupsContainer.getGroups(1))for(let n of o.getEditors(0))n.isModified()&&((typeof e?.includeUntitled=="boolean"||!e?.includeUntitled?.includeScratchpad)&&n.hasCapability(512)||!e?.includeUntitled&&n.hasCapability(4)||e?.excludeSticky&&o.isSticky(n)||t.push({groupId:o.id,editor:n}));return t}getUniqueEditors(e){let t=[];for(let{editor:o,groupId:n}of e)t.some(r=>r.editor.matches(o))||t.push({editor:o,groupId:n});return t}dispose(){super.dispose(),this.activeOutOfWorkspaceWatchers.forEach(e=>Be(e)),this.activeOutOfWorkspaceWatchers.clear()}};ame=I([m(1,wt),m(2,F),m(3,fe),m(4,B),m(5,Pe),m(6,ht),m(7,Ka),m(8,Vu),m(9,Zt),m(10,Pk)],ame);Ee(ee,new Ft(ame,[void 0],!1));var HA=class extends x{constructor(e,t,o,n,r,s,l,c){super();this.editorGroupService=e;this.instantiationService=t;this.configurationService=o;this.quickInputService=n;this.notificationService=r;this.storageService=s;this.extensionService=l;this.logService=c;this._onDidChangeEditorRegistrations=this._register(new Gm);this.onDidChangeEditorRegistrations=this._onDidChangeEditorRegistrations.event;this._editors=new Map;this._flattenedEditors=new Map;this._shouldReFlattenEditors=!0;this.cache=new Set(JSON.parse(this.storageService.get(HA.cacheStorageID,0,JSON.stringify([])))),this.storageService.remove(HA.cacheStorageID,0),this._register(this.storageService.onWillSaveState(()=>{this.cacheEditors()})),this._register(this.extensionService.onDidRegisterExtensions(()=>{this.cache=void 0}))}static{this.configureDefaultID="promptOpenWith.configureDefault"}static{this.cacheStorageID="editorOverrideService.cache"}static{this.conflictingDefaultsStorageID="editorOverrideService.conflictingDefaults"}resolveUntypedInputAndGroup(e,t){let o=e,n=this.instantiationService.invokeFunction(Ype,o,t);if(n instanceof Promise)return n.then(([r,s])=>[o,r,s]);{let[r,s]=n;return[o,r,s]}}async resolveEditor(e,t){if(this._flattenedEditors=this._flattenEditorsMap(),Z_(e))return this.doResolveSideBySideEditor(e,t);let o,n=this.resolveUntypedInputAndGroup(e,t);if(n instanceof Promise?o=await n:o=n,!o)return 2;let[r,s,l]=o;l&&(r.options={...r.options,activation:l});let c=po.getCanonicalUri(r,{supportSideBySide:1});if(this.cache&&c&&this.resourceMatchesCache(c)&&await this.extensionService.whenInstalledExtensionsRegistered(),c===void 0)c=A.from({scheme:Q.untitled});else if(c.scheme===void 0||c===null)return 2;if(r.options?.override===0){let g=await this.doPickEditor(r);if(!g)return 1;r.options=g}let{editor:u,conflictingDefault:p}=this.getEditor(c,r.options?.override);if(!u&&(r.options?.override||EF(e)))return 2;if(!u){let g=this.getEditor(c,la.id);if(u=g?.editor,p=g?.conflictingDefault,!u)return 2}if(Ib(r)&&r.options?.override===void 0){let g=po.getCanonicalUri(r,{supportSideBySide:2});g||(g=A.from({scheme:Q.untitled}));let{editor:f}=this.getEditor(g,void 0);if(!f||u.editorInfo.id!==f.editorInfo.id){let{editor:v,conflictingDefault:b}=this.getEditor(c,la.id);u=v,p=b}if(!u)return 2}if(r.options={override:u.editorInfo.id,...r.options},u.editorFactoryObject.createDiffEditorInput===void 0&&Ib(r))return 2;let h=await this.doResolveEditor(r,s,u);return p&&h&&await this.doHandleConflictingDefaults(c,u.editorInfo.label,r,h.editor,s),h?(h.editor.editorId!==u.editorInfo.id&&this.logService.warn(`Editor ID Mismatch: ${h.editor.editorId} !== ${u.editorInfo.id}. This will cause bugs. Please ensure editorInput.editorId matches the registered id`),{...h,group:s}):1}async doResolveSideBySideEditor(e,t){let o=await this.resolveEditor(e.primary,t);if(!J5(o))return 2;let n=await this.resolveEditor(e.secondary,o.group??t);return J5(n)?{group:o.group??n.group,editor:this.instantiationService.createInstance(Ma,e.label,e.description,n.editor,o.editor),options:e.options}:2}bufferChangeEvents(e){this._onDidChangeEditorRegistrations.pause();try{e()}finally{this._onDidChangeEditorRegistrations.resume()}}registerEditor(e,t,o,n){let r=this._editors.get(e);r===void 0&&(r=new Map,this._editors.set(e,r));let s=r.get(t.id);s===void 0&&(s=[]);let l=ah(s,{globPattern:e,editorInfo:t,options:o,editorFactoryObject:n});return r.set(t.id,s),this._shouldReFlattenEditors=!0,this._onDidChangeEditorRegistrations.fire(),Z(()=>{l(),s&&s.length===0&&r?.delete(t.id),this._shouldReFlattenEditors=!0,this._onDidChangeEditorRegistrations.fire()})}getAssociationsForResource(e){let o=this.getAllUserAssociations().filter(r=>r.filenamePattern&&CJ(r.filenamePattern,e));o=o.sort((r,s)=>(s.filenamePattern?.length??0)-(r.filenamePattern?.length??0));let n=this._registeredEditors;return o.filter(r=>n.find(s=>s.editorInfo.id===r.viewType))}getAllUserAssociations(){let e=this.configurationService.inspect(ygi)||{},t=e.defaultValue??{},o=e.workspaceValue??{},n=e.userValue??{},r={...o};for(let[l,c]of Object.entries({...t,...n}))r[l]===void 0&&(r[l]=c);let s=[];for(let[l,c]of Object.entries(r)){let u={filenamePattern:l,viewType:c};s.push(u)}return s}_flattenEditorsMap(){if(!this._shouldReFlattenEditors)return this._flattenedEditors;this._shouldReFlattenEditors=!1;let e=new Map;for(let[t,o]of this._editors){let n=[];for(let r of o.values()){let s;for(let l of r)s||(s={editorInfo:l.editorInfo,globPattern:l.globPattern,options:{},editorFactoryObject:{}}),s.options={...s.options,...l.options},s.editorFactoryObject={...s.editorFactoryObject,...l.editorFactoryObject};s&&n.push(s)}e.set(t,n)}return e}get _registeredEditors(){return Array.from(this._flattenedEditors.values()).flat()}updateUserAssociations(e,t){let o={viewType:t,filenamePattern:e},n=this.getAllUserAssociations(),r=Object.create(null);for(let s of[...n,o])s.filenamePattern&&(r[s.filenamePattern]=s.viewType);this.configurationService.updateValue(ygi,r)}findMatchingEditors(e){let t=this.getAssociationsForResource(e),o=[];for(let[n,r]of this._flattenedEditors)for(let s of r)(t.find(c=>c.viewType===s.editorInfo.id)&&s.editorInfo.priority!=="exclusive"||CJ(n,e))&&o.push(s);return o.sort((n,r)=>jR(r.editorInfo.priority)===jR(n.editorInfo.priority)&&typeof r.globPattern=="string"&&typeof n.globPattern=="string"?r.globPattern.length-n.globPattern.length:jR(r.editorInfo.priority)-jR(n.editorInfo.priority))}getEditors(e){if(this._flattenedEditors=this._flattenEditorsMap(),A.isUri(e)){let t=this.findMatchingEditors(e);return t.find(o=>o.editorInfo.priority==="exclusive")?[]:t.map(o=>o.editorInfo)}return zo(this._registeredEditors.map(t=>t.editorInfo),t=>t.id)}getEditor(e,t){let o=(p,h)=>p.find(g=>g.options?.canSupportResource!==void 0?g.editorInfo.id===h&&g.options.canSupportResource(e):g.editorInfo.id===h);if(t&&t!==1){let p=this._registeredEditors;return{editor:o(p,t),conflictingDefault:!1}}let n=this.findMatchingEditors(e),r=this.getAssociationsForResource(e),s=t===1?"exclusive":"builtin",l=n.filter(p=>jR(p.editorInfo.priority)>=jR(s)&&p.editorInfo.id!==la.id);if(l.length===0)return{editor:r[0]&&s!=="exclusive"?o(n,r[0].viewType):void 0,conflictingDefault:!1};let c=l[0].editorInfo.priority==="exclusive"?l[0].editorInfo.id:r[0]?.viewType||l.find(p=>!p.options?.canSupportResource||p.options.canSupportResource(e))?.editorInfo.id||l[0].editorInfo.id,u=!1;return l=l.filter(p=>p.editorInfo.priority!=="exclusive").filter(p=>!p.options?.canSupportResource||p.options.canSupportResource(e)),r.length===0&&l.length>1&&(u=!0),{editor:o(n,c),conflictingDefault:u}}async doResolveEditor(e,t,o){let n=e.options,r=po.getCanonicalUri(e,{supportSideBySide:1});if(n&&typeof n.activation>"u"&&(n={...n,activation:n.preserveFocus?2:void 0}),WC(e)){if(!o.editorFactoryObject.createMergeEditorInput)return;let u=await o.editorFactoryObject.createMergeEditorInput(e,t);return{editor:u.editor,options:u.options??n}}if(Ib(e)){if(!o.editorFactoryObject.createDiffEditorInput)return;let u=await o.editorFactoryObject.createDiffEditorInput(e,t);return{editor:u.editor,options:u.options??n}}if(FX(e)){if(!o.editorFactoryObject.createMultiDiffEditorInput)return;let u=await o.editorFactoryObject.createMultiDiffEditorInput(e,t);return{editor:u.editor,options:u.options??n}}if(Z_(e))throw new Error("Untyped side by side editor input not supported here.");if(DEe(e)){if(!o.editorFactoryObject.createUntitledEditorInput)return;let u=await o.editorFactoryObject.createUntitledEditorInput(e,t);return{editor:u.editor,options:u.options??n}}if(r===void 0)throw new Error("Undefined resource on non untitled editor input.");if(typeof o.options?.singlePerResource=="function"?o.options.singlePerResource():o.options?.singlePerResource){let u=this.findExistingEditorsForResource(r,o.editorInfo.id);if(u.length){let p=await this.moveExistingEditorForResource(u,t);return p?{editor:p,options:n}:void 0}}if(!o.editorFactoryObject.createEditorInput)return;let l=await o.editorFactoryObject.createEditorInput(e,t);return n=l.options??n,{editor:l.editor,options:n}}async moveExistingEditorForResource(e,t){let o=e[0];for(let{editor:n,group:r}of e)if(n!==o.editor&&!await r.closeEditor(n))return;if(!(t.id!==o.group.id&&!o.group.moveEditor(o.editor,t)))return o.editor}findExistingEditorsForResource(e,t){let o=[],n=zo([...this.editorGroupService.groups]);for(let r of n)for(let s of r.editors)Qe(s.resource,e)&&s.editorId===t&&o.push({editor:s,group:r});return o}async doHandleConflictingDefaults(e,t,o,n,r){let s=this.findMatchingEditors(e),l=JSON.parse(this.storageService.get(HA.conflictingDefaultsStorageID,0,"{}")),c=`*${es(e)}`,u=()=>{l[c]=[],s.forEach(g=>l[c].push(g.editorInfo.id)),this.storageService.store(HA.conflictingDefaultsStorageID,JSON.stringify(l),0,1)};if(l[c]?.find(g=>g===n.editorId))return;let h=this.notificationService.prompt(ft.Warning,d(17538,null),[{label:d(17537,null),run:async()=>{let g=await this.doPickEditor(o,!0);if(!g)return;o.options=g;let f=await this.resolveEditor(o,r);f===1||f===2||r.replaceEditors([{editor:n,replacement:f.editor,options:f.options??g}])}},{label:d(17539,null,t),run:u}]).onDidClose(()=>{u(),h.dispose()})}mapEditorsToQuickPickEntry(e,t){let o=this.editorGroupService.activeGroup.findEditors(e).at(0),n=e.scheme===Q.untitled?this._registeredEditors.filter(h=>h.editorInfo.priority!=="exclusive"):this.findMatchingEditors(e);n=zo(n,h=>h.editorInfo.id);let r=this.getAssociationsForResource(e)[0]?.viewType;n=n.sort((h,g)=>h.editorInfo.id===la.id?-1:g.editorInfo.id===la.id?1:jR(g.editorInfo.priority)-jR(h.editorInfo.priority));let s=[],l=d(17543,null),c=d(17541,null),u=d(17542,null),p=r;if(!p&&n.length>2&&n[1]?.editorInfo.priority!=="option"&&(p=n[1]?.editorInfo.id),p||(p=la.id),n.forEach(h=>{let g=o?.editorId??la.id,f=o?h.editorInfo.id===g:!1,v=h.editorInfo.id===p,b={id:h.editorInfo.id,label:h.editorInfo.label,description:f&&v?u:f?l:v?c:void 0,detail:h.editorInfo.detail??h.editorInfo.priority};s.push(b)}),!t&&es(e)!==""){let h={type:"separator"};s.push(h);let g={id:HA.configureDefaultID,label:d(17540,null,`*${es(e)}`)};s.push(g)}return s}async doPickEditor(e,t){let o=po.getOriginalUri(e,{supportSideBySide:1});o===void 0&&(o=A.from({scheme:Q.untitled}));let n=this.mapEditorsToQuickPickEntry(o,t),r=new N,s=r.add(this.quickInputService.createQuickPick({useSeparators:!0})),l=t?d(17545,null,`*${es(o)}`):d(17544,null,He(o));s.placeholder=l,s.canAcceptInBackground=!0,s.items=n;let c=s.items.find(p=>p.type==="item");c&&(s.selectedItems=[c]);let u=await new Promise(p=>{r.add(s.onDidAccept(h=>{let g;s.selectedItems.length===1&&(g={item:s.selectedItems[0],keyMods:s.keyMods,openInBackground:h.inBackground}),o&&t&&g?.item.id&&this.updateUserAssociations(`*${es(o)}`,g.item.id),p(g)})),r.add(s.onDidHide(()=>{r.dispose(),p(void 0)})),r.add(s.onDidTriggerItemButton(h=>{p({item:h.item,openInBackground:!1}),o&&h.item?.id&&this.updateUserAssociations(`*${es(o)}`,h.item.id)})),s.show()});if(s.dispose(),u)return u.item.id===HA.configureDefaultID?this.doPickEditor(e,!0):{...e.options,override:u.item.id,preserveFocus:u.openInBackground||e.options?.preserveFocus}}cacheEditors(){let e=new Set;for(let[o,n]of this._flattenedEditors)n.find(s=>s.editorInfo.priority!=="option"&&s.editorInfo.id!==la.id)&&(qP(o)?e.add(`${o.pattern}`):e.add(o));let t=this.getAllUserAssociations();for(let o of t)o.filenamePattern&&e.add(o.filenamePattern);this.storageService.store(HA.cacheStorageID,JSON.stringify(Array.from(e)),0,1)}resourceMatchesCache(e){if(!this.cache)return!1;for(let t of this.cache)if(CJ(t,e))return!0;return!1}};HA=I([m(0,wt),m(1,F),m(2,B),m(3,Ue),m(4,Ne),m(5,ce),m(6,lt),m(7,se)],HA);Ee(Ka,HA,0);var lme=class{constructor(i){this.logService=i;this._providers=new Map}static{this.DEFAULT_TIMEOUT=1e3*10}isEnabled(){return this._providers.size>0}registerAiRelatedInformationProvider(i,e){let t=this._providers.get(i)??[];return t.push(e),this._providers.set(i,t),{dispose:()=>{let o=this._providers.get(i)??[],n=o.indexOf(e);n!==-1&&o.splice(n,1),o.length===0&&this._providers.delete(i)}}}async getRelatedInformation(i,e,t){if(this._providers.size===0)throw new Error("No related information providers registered");let o=[];for(let s of e){let l=this._providers.get(s);l&&o.push(...l)}if(o.length===0)throw new Error("No related information providers registered for the given types");let n=Dn.create(),r=o.map(s=>Ln(async l=>{try{return(await s.provideAiRelatedInformation(i,l)).filter(u=>e.includes(u.type))}catch{}return[]}));try{let s=await vp(Promise.allSettled(r),lme.DEFAULT_TIMEOUT,()=>{r.forEach(c=>c.cancel()),this.logService.warn("[AiRelatedInformationService]: Related information provider timed out")});return s?s.filter(c=>c.status==="fulfilled").flatMap(c=>c.value):[]}finally{n.stop(),this.logService.trace(`[AiRelatedInformationService]: getRelatedInformation took ${n.elapsed()}ms`)}}};lme=I([m(0,se)],lme);Ee(TDe,lme,1);var SCi=class a extends x{constructor(){super(...arguments);this._providers=[];this._llmRankedResultsPromises=new Map;this._embeddingsResultsPromises=new Map;this._onProviderRegistered=this._register(new E);this.onProviderRegistered=this._onProviderRegistered.event}static{this.MAX_PICKS=5}isEnabled(){return this._providers.length>0}registerSettingsSearchProvider(e){return this._providers.push(e),this._onProviderRegistered.fire(),{dispose:()=>{let t=this._providers.indexOf(e);t!==-1&&this._providers.splice(t,1)}}}startSearch(e,t){if(!this.isEnabled())throw new Error("No settings search providers registered");this._embeddingsResultsPromises.delete(e),this._llmRankedResultsPromises.delete(e),this._providers.forEach(o=>o.searchSettings(e,{limit:a.MAX_PICKS,embeddingsOnly:!1},t))}async getEmbeddingsResults(e,t){if(!this.isEnabled())throw new Error("No settings search providers registered");let o=this._embeddingsResultsPromises.get(e);if(o)return await o.p??null;let n=new Ko;return this._embeddingsResultsPromises.set(e,n),await Va(n.p,t)??null}async getLLMRankedResults(e,t){if(!this.isEnabled())throw new Error("No settings search providers registered");let o=this._llmRankedResultsPromises.get(e);if(o)return await o.p??null;let n=new Ko;return this._llmRankedResultsPromises.set(e,n),await Va(n.p,t)??null}handleSearchResult(e){if(this.isEnabled()){if(e.kind===1){let t=this._embeddingsResultsPromises.get(e.query);if(t)t.complete(e.settings);else{let o=new Ko;o.complete(e.settings),this._embeddingsResultsPromises.set(e.query,o)}}else if(e.kind===2){let t=this._llmRankedResultsPromises.get(e.query);if(t)t.complete(e.settings);else{let o=new Ko;o.complete(e.settings),this._llmRankedResultsPromises.set(e.query,o)}}}}};Ee(o_e,SCi,1);var uM=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this.editorService=e;this.editorGroupService=t;this.contextService=o;this.storageService=n;this.configurationService=r;this.fileService=s;this.workspacesService=l;this.instantiationService=c;this.layoutService=u;this.contextKeyService=p;this.logService=h;this.activeEditorListeners=this._register(new N);this.lastActiveEditor=void 0;this._onDidChangeEditorNavigationStack=this._register(new E);this.onDidChangeEditorNavigationStack=this._onDidChangeEditorNavigationStack.event;this.defaultScopedEditorNavigationStack=void 0;this.editorGroupScopedNavigationStacks=new Map;this.editorScopedNavigationStacks=new Map;this.editorNavigationScope=0;this.recentlyUsedEditorsStack=void 0;this.recentlyUsedEditorsStackIndex=0;this.recentlyUsedEditorsInGroupStack=void 0;this.recentlyUsedEditorsInGroupStackIndex=0;this.navigatingInRecentlyUsedEditorsStack=!1;this.navigatingInRecentlyUsedEditorsInGroupStack=!1;this.recentlyClosedEditors=[];this.ignoreEditorCloseEvent=!1;this.history=void 0;this.editorHistoryListeners=this._register(new Vt);this.resourceExcludeMatcher=this._register(new lO(ut,()=>{let e=this._register(this.instantiationService.createInstance(cI,t=>KB(t?this.configurationService.getValue({resource:t}):this.configurationService.getValue())||Object.create(null),t=>t.affectsConfiguration(_bt)||t.affectsConfiguration(_Pt)));return this._register(e.onExpressionChange(()=>this.removeExcludedFromHistory())),e}));this.editorHelper=this.instantiationService.createInstance(VRe),this.canNavigateBackContextKey=new Y("canNavigateBack",!1,d(17790,null)).bindTo(this.contextKeyService),this.canNavigateForwardContextKey=new Y("canNavigateForward",!1,d(17793,null)).bindTo(this.contextKeyService),this.canNavigateBackInNavigationsContextKey=new Y("canNavigateBackInNavigationLocations",!1,d(17792,null)).bindTo(this.contextKeyService),this.canNavigateForwardInNavigationsContextKey=new Y("canNavigateForwardInNavigationLocations",!1,d(17795,null)).bindTo(this.contextKeyService),this.canNavigateToLastNavigationLocationContextKey=new Y("canNavigateToLastNavigationLocation",!1,d(17797,null)).bindTo(this.contextKeyService),this.canNavigateBackInEditsContextKey=new Y("canNavigateBackInEditLocations",!1,d(17791,null)).bindTo(this.contextKeyService),this.canNavigateForwardInEditsContextKey=new Y("canNavigateForwardInEditLocations",!1,d(17794,null)).bindTo(this.contextKeyService),this.canNavigateToLastEditLocationContextKey=new Y("canNavigateToLastEditLocation",!1,d(17796,null)).bindTo(this.contextKeyService),this.canReopenClosedEditorContextKey=new Y("canReopenClosedEditor",!1,d(17798,null)).bindTo(this.contextKeyService),this.registerListeners(),this.editorService.activeEditorPane&&this.onDidActiveEditorChange()}static{this.MOUSE_NAVIGATION_SETTING="workbench.editor.mouseBackForwardToNavigate"}static{this.NAVIGATION_SCOPE_SETTING="workbench.editor.navigationScope"}registerListeners(){this.registerMouseNavigationListener(),this._register(this.editorService.onDidActiveEditorChange(()=>this.onDidActiveEditorChange())),this._register(this.editorService.onDidOpenEditorFail(e=>this.remove(e.editor))),this._register(this.editorService.onDidCloseEditor(e=>this.onDidCloseEditor(e))),this._register(this.editorService.onDidMostRecentlyActiveEditorsChange(()=>this.handleEditorEventInRecentEditorsStack())),this._register(this.editorGroupService.onDidRemoveGroup(e=>this.onDidRemoveGroup(e))),this._register(this.fileService.onDidFilesChange(e=>this.onDidFilesChange(e))),this._register(this.fileService.onDidRunOperation(e=>this.onDidFilesChange(e))),this._register(this.storageService.onWillSaveState(()=>this.saveState())),this.registerEditorNavigationScopeChangeListener(),this._register(this.onDidChangeEditorNavigationStack(()=>this.updateContextKeys())),this._register(this.editorGroupService.onDidChangeActiveGroup(()=>this.updateContextKeys()))}onDidCloseEditor(e){this.handleEditorCloseEventInHistory(e),this.handleEditorCloseEventInReopen(e)}registerMouseNavigationListener(){let e=this._register(new N),t=()=>{e.clear(),this.configurationService.getValue(uM.MOUSE_NAVIGATION_SETTING)&&this._register(U.runAndSubscribe(this.layoutService.onDidAddContainer,({container:o,disposables:n})=>{let r=n.add(new N);r.add(j(o,re.MOUSE_DOWN,s=>this.onMouseDownOrUp(s,!0))),r.add(j(o,re.MOUSE_UP,s=>this.onMouseDownOrUp(s,!1))),e.add(r)},{container:this.layoutService.mainContainer,disposables:this._store}))};this._register(this.configurationService.onDidChangeConfiguration(o=>{o.affectsConfiguration(uM.MOUSE_NAVIGATION_SETTING)&&t()})),t()}onMouseDownOrUp(e,t){switch(e.button){case 3:Xt.stop(e),t&&this.goBack();break;case 4:Xt.stop(e),t&&this.goForward();break}}onDidRemoveGroup(e){this.handleEditorGroupRemoveInNavigationStacks(e)}onDidActiveEditorChange(){let e=this.editorGroupService.activeGroup,t=e.activeEditorPane;if(!(this.lastActiveEditor&&this.editorHelper.matchesEditorIdentifier(this.lastActiveEditor,t))){if(this.lastActiveEditor=t?.input?{editor:t.input,groupId:t.group.id}:void 0,this.activeEditorListeners.clear(),!t?.group.isTransient(t.input))this.handleActiveEditorChange(e,t);else{this.logService.trace(`[History]: ignoring transient editor change until becoming non-transient (editor: ${t.input?.resource?.toString()}})`);let o=e.onDidModelChange(n=>{n.kind===12&&n.editor===t.input&&!t.group.isTransient(t.input)&&(o.dispose(),this.handleActiveEditorChange(e,t))});this.activeEditorListeners.add(o)}Hde(t)&&this.activeEditorListeners.add(t.onDidChangeSelection(o=>{t.group.isTransient(t.input)?this.logService.trace(`[History]: ignoring transient editor selection change (editor: ${t.input?.resource?.toString()}})`):this.handleActiveEditorSelectionChangeEvent(e,t,o)})),this.updateContextKeys()}}onDidFilesChange(e){e instanceof RO?e.gotDeleted()&&this.remove(e):e.isOperation(1)?this.remove(e):e.isOperation(2)&&e.target.isFile&&this.move(e)}handleActiveEditorChange(e,t){this.handleActiveEditorChangeInHistory(t),this.handleActiveEditorChangeInNavigationStacks(e,t)}handleActiveEditorSelectionChangeEvent(e,t,o){this.handleActiveEditorSelectionChangeInNavigationStacks(e,t,o)}move(e){this.moveInHistory(e),this.moveInEditorNavigationStacks(e)}remove(e){this.removeFromHistory(e),this.removeFromEditorNavigationStacks(e),this.removeFromRecentlyClosedEditors(e),this.removeFromRecentlyOpened(e)}removeFromRecentlyOpened(e){let t;ka(e)?t=po.getOriginalUri(e):e instanceof RO||(t=e.resource),t&&this.workspacesService.removeRecentlyOpened([t])}clear(){this.clearRecentlyOpened(),this.clearEditorNavigationStacks(),this.recentlyClosedEditors=[],this.updateContextKeys()}updateContextKeys(){this.contextKeyService.bufferChangeEvents(()=>{let e=this.getStack();this.canNavigateBackContextKey.set(e.canGoBack(0)),this.canNavigateForwardContextKey.set(e.canGoForward(0)),this.canNavigateBackInNavigationsContextKey.set(e.canGoBack(2)),this.canNavigateForwardInNavigationsContextKey.set(e.canGoForward(2)),this.canNavigateToLastNavigationLocationContextKey.set(e.canGoLast(2)),this.canNavigateBackInEditsContextKey.set(e.canGoBack(1)),this.canNavigateForwardInEditsContextKey.set(e.canGoForward(1)),this.canNavigateToLastEditLocationContextKey.set(e.canGoLast(1)),this.canReopenClosedEditorContextKey.set(this.recentlyClosedEditors.length>0)})}registerEditorNavigationScopeChangeListener(){let e=()=>{this.disposeEditorNavigationStacks();let t=this.configurationService.getValue(uM.NAVIGATION_SCOPE_SETTING);t==="editorGroup"?this.editorNavigationScope=1:t==="editor"?this.editorNavigationScope=2:this.editorNavigationScope=0};this._register(this.configurationService.onDidChangeConfiguration(t=>{t.affectsConfiguration(uM.NAVIGATION_SCOPE_SETTING)&&e()})),e()}getStack(e=this.editorGroupService.activeGroup,t=e.activeEditor){switch(this.editorNavigationScope){case 2:{if(!t)return new ICi;let o=this.editorScopedNavigationStacks.get(e.id);o||(o=new Map,this.editorScopedNavigationStacks.set(e.id,o));let n=o.get(t)?.stack;if(!n){let r=new N;n=r.add(this.instantiationService.createInstance(cme,2)),r.add(n.onDidChange(()=>this._onDidChangeEditorNavigationStack.fire())),o.set(t,{stack:n,disposable:r})}return n}case 1:{let o=this.editorGroupScopedNavigationStacks.get(e.id)?.stack;if(!o){let n=new N;o=n.add(this.instantiationService.createInstance(cme,1)),n.add(o.onDidChange(()=>this._onDidChangeEditorNavigationStack.fire())),this.editorGroupScopedNavigationStacks.set(e.id,{stack:o,disposable:n})}return o}case 0:return this.defaultScopedEditorNavigationStack||(this.defaultScopedEditorNavigationStack=this._register(this.instantiationService.createInstance(cme,0)),this._register(this.defaultScopedEditorNavigationStack.onDidChange(()=>this._onDidChangeEditorNavigationStack.fire()))),this.defaultScopedEditorNavigationStack}}goForward(e){return this.getStack().goForward(e)}goBack(e){return this.getStack().goBack(e)}goPrevious(e){return this.getStack().goPrevious(e)}goLast(e){return this.getStack().goLast(e)}handleActiveEditorChangeInNavigationStacks(e,t){this.getStack(e,t?.input).handleActiveEditorChange(t)}handleActiveEditorSelectionChangeInNavigationStacks(e,t,o){this.getStack(e,t.input).handleActiveEditorSelectionChange(t,o)}handleEditorCloseEventInHistory(e){let t=this.editorScopedNavigationStacks.get(e.groupId);if(t){let o=t.get(e.editor);o&&(o.disposable.dispose(),t.delete(e.editor)),t.size===0&&this.editorScopedNavigationStacks.delete(e.groupId)}}handleEditorGroupRemoveInNavigationStacks(e){this.defaultScopedEditorNavigationStack?.remove(e.id);let t=this.editorGroupScopedNavigationStacks.get(e.id);t&&(t.disposable.dispose(),this.editorGroupScopedNavigationStacks.delete(e.id))}clearEditorNavigationStacks(){this.withEachEditorNavigationStack(e=>e.clear())}removeFromEditorNavigationStacks(e){this.withEachEditorNavigationStack(t=>t.remove(e))}moveInEditorNavigationStacks(e){this.withEachEditorNavigationStack(t=>t.move(e))}withEachEditorNavigationStack(e){this.defaultScopedEditorNavigationStack&&e(this.defaultScopedEditorNavigationStack);for(let[,t]of this.editorGroupScopedNavigationStacks)e(t.stack);for(let[,t]of this.editorScopedNavigationStacks)for(let[,o]of t)e(o.stack)}disposeEditorNavigationStacks(){this.defaultScopedEditorNavigationStack?.dispose(),this.defaultScopedEditorNavigationStack=void 0;for(let[,e]of this.editorGroupScopedNavigationStacks)e.disposable.dispose();this.editorGroupScopedNavigationStacks.clear();for(let[,e]of this.editorScopedNavigationStacks)for(let[,t]of e)t.disposable.dispose();this.editorScopedNavigationStacks.clear()}openNextRecentlyUsedEditor(e){let[t,o]=this.ensureRecentlyUsedStack(n=>n-1,e);return this.doNavigateInRecentlyUsedEditorsStack(t[o],e)}openPreviouslyUsedEditor(e){let[t,o]=this.ensureRecentlyUsedStack(n=>n+1,e);return this.doNavigateInRecentlyUsedEditorsStack(t[o],e)}async doNavigateInRecentlyUsedEditorsStack(e,t){if(e){let o=typeof t!="number"||!this.editorGroupService.getGroup(t);o?this.navigatingInRecentlyUsedEditorsStack=!0:this.navigatingInRecentlyUsedEditorsInGroupStack=!0;let n=this.editorGroupService.getGroup(e.groupId)??this.editorGroupService.activeGroup;try{await n.openEditor(e.editor)}finally{o?this.navigatingInRecentlyUsedEditorsStack=!1:this.navigatingInRecentlyUsedEditorsInGroupStack=!1}}}ensureRecentlyUsedStack(e,t){let o,n,r=typeof t=="number"?this.editorGroupService.getGroup(t):void 0;r?(o=this.recentlyUsedEditorsInGroupStack||r.getEditors(0).map(l=>({groupId:r.id,editor:l})),n=this.recentlyUsedEditorsInGroupStackIndex):(o=this.recentlyUsedEditorsStack||this.editorService.getEditors(0),n=this.recentlyUsedEditorsStackIndex);let s=e(n);return s<0?s=0:s>o.length-1&&(s=o.length-1),r?(this.recentlyUsedEditorsInGroupStack=o,this.recentlyUsedEditorsInGroupStackIndex=s):(this.recentlyUsedEditorsStack=o,this.recentlyUsedEditorsStackIndex=s),[o,s]}handleEditorEventInRecentEditorsStack(){this.navigatingInRecentlyUsedEditorsStack||(this.recentlyUsedEditorsStack=void 0,this.recentlyUsedEditorsStackIndex=0),this.navigatingInRecentlyUsedEditorsInGroupStack||(this.recentlyUsedEditorsInGroupStack=void 0,this.recentlyUsedEditorsInGroupStackIndex=0)}static{this.MAX_RECENTLY_CLOSED_EDITORS=20}handleEditorCloseEventInReopen(e){if(this.ignoreEditorCloseEvent)return;let{editor:t,context:o}=e;if(o===1||o===2||!t.canReopen())return;let n=t.toUntyped();if(!n)return;let r=[],s=po.getOriginalUri(t,{supportSideBySide:3});A.isUri(s)?r.push(s):s&&r.push(...di([s.primary,s.secondary])),this.removeFromRecentlyClosedEditors(t),this.recentlyClosedEditors.push({editorId:t.editorId,editor:n,resource:po.getOriginalUri(t),associatedResources:r,index:e.index,sticky:e.sticky}),this.recentlyClosedEditors.length>uM.MAX_RECENTLY_CLOSED_EDITORS&&this.recentlyClosedEditors.shift(),this.canReopenClosedEditorContextKey.set(!0)}async reopenLastClosedEditor(){let e=this.recentlyClosedEditors.pop(),t;return e&&(t=this.doReopenLastClosedEditor(e)),this.canReopenClosedEditorContextKey.set(this.recentlyClosedEditors.length>0),t}async doReopenLastClosedEditor(e){let t={pinned:!0,sticky:e.sticky,index:e.index,ignoreError:!0};(e.sticky&&!this.editorGroupService.activeGroup.isSticky(e.index)||!e.sticky&&this.editorGroupService.activeGroup.isSticky(e.index))&&(t.index=void 0);let o;if(!this.editorGroupService.activeGroup.contains(e.editor)){this.ignoreEditorCloseEvent=!0;try{o=await this.editorService.openEditor({...e.editor,options:{...e.editor.options,...t}})}finally{this.ignoreEditorCloseEvent=!1}}o||(s$e(this.recentlyClosedEditors,e),this.reopenLastClosedEditor())}removeFromRecentlyClosedEditors(e){this.recentlyClosedEditors=this.recentlyClosedEditors.filter(t=>ka(e)&&t.editorId!==e.editorId?!0:!(t.resource&&this.editorHelper.matchesFile(t.resource,e)||t.associatedResources.some(o=>this.editorHelper.matchesFile(o,e)))),this.canReopenClosedEditorContextKey.set(this.recentlyClosedEditors.length>0)}static{this.MAX_HISTORY_ITEMS=200}static{this.HISTORY_STORAGE_KEY="history.entries"}handleActiveEditorChangeInHistory(e){let t=e?.input;!t||t.isDisposed()||!this.includeInHistory(t)||(this.removeFromHistory(t),this.addToHistory(t))}addToHistory(e,t=!0){this.ensureHistoryLoaded(this.history);let o=this.editorHelper.preferResourceEditorInput(e);o&&(t?this.history.unshift(o):this.history.push(o),this.history.length>uM.MAX_HISTORY_ITEMS&&this.editorHelper.clearOnEditorDispose(this.history.pop(),this.editorHistoryListeners),ka(e)&&this.editorHelper.onEditorDispose(e,()=>this.updateHistoryOnEditorDispose(o),this.editorHistoryListeners))}updateHistoryOnEditorDispose(e){if(ka(e))if(!Ymi(e))this.removeFromHistory(e);else{let t=[],o=e.primary.matches(e.secondary)?[e.primary]:[e.primary,e.secondary];for(let n of o){let r=this.editorHelper.preferResourceEditorInput(n);Sf(r)&&this.includeInHistory(r)&&t.push(r)}this.replaceInHistory(e,...t)}else this.includeInHistory(e)||this.removeFromHistory(e)}includeInHistory(e){return ka(e)?!0:!this.resourceExcludeMatcher.value.matches(e.resource)}removeExcludedFromHistory(){this.ensureHistoryLoaded(this.history),this.history=this.history.filter(e=>{let t=this.includeInHistory(e);return t||this.editorHelper.clearOnEditorDispose(e,this.editorHistoryListeners),t})}moveInHistory(e){e.isOperation(2)&&this.removeFromHistory(e)&&this.addToHistory({resource:e.target.resource})}removeFromHistory(e){let t=!1;return this.ensureHistoryLoaded(this.history),this.history=this.history.filter(o=>{let n=this.editorHelper.matchesEditor(e,o);return n&&(this.editorHelper.clearOnEditorDispose(e,this.editorHistoryListeners),t=!0),!n}),t}replaceInHistory(e,...t){this.ensureHistoryLoaded(this.history);let o=!1,n=[];for(let r of this.history)this.editorHelper.matchesEditor(e,r)?(this.editorHelper.clearOnEditorDispose(e,this.editorHistoryListeners),o||(n.push(...t),o=!0)):t.some(s=>this.editorHelper.matchesEditor(s,r))||n.push(r);o||n.push(...t),this.history=n}clearRecentlyOpened(){this.history=[],this.editorHistoryListeners.clearAndDisposeAll()}getHistory(){return this.ensureHistoryLoaded(this.history),this.history}ensureHistoryLoaded(e){this.history||(this.history=[],this.editorGroupService.isReady?this.loadHistory():(async()=>(await this.editorGroupService.whenReady,this.loadHistory()))())}loadHistory(){this.history=[];let e=this.loadHistoryFromStorage(),t=[...this.editorService.getEditors(0)].reverse(),o=new Set;for(let{editor:n}of t)if(this.includeInHistory(n)){if(n.resource){let r=`${n.resource.toString()}/${n.editorId}`;if(o.has(r))continue;o.add(r)}this.addToHistory(n)}for(let n of e){let r=`${n.resource.toString()}/${n.options?.override}`;!o.has(r)&&this.includeInHistory(n)&&(o.add(r),this.addToHistory(n,!1))}}loadHistoryFromStorage(){let e=[],t=this.storageService.get(uM.HISTORY_STORAGE_KEY,1);if(t)try{let o=JSON.parse(t);for(let n of o)if(!(!n.editor||!n.editor.resource))try{e.push({...n.editor,resource:typeof n.editor.resource=="string"?A.parse(n.editor.resource):A.from(n.editor.resource)})}catch(r){mt(r)}}catch(o){mt(o)}return e}saveState(){if(!this.history)return;let e=[];for(let t of this.history)ka(t)||!Sf(t)||e.push({editor:{...t,resource:t.resource.toString()}});this.storageService.store(uM.HISTORY_STORAGE_KEY,JSON.stringify(e),1,1)}getLastActiveWorkspaceRoot(e,t){let o=this.contextService.getWorkspace().folders;if(o.length!==0){if(o.length===1){let n=o[0].uri;return(!e||n.scheme===e)&&(!t||n.authority===t)?n:void 0}for(let n of this.getHistory()){if(ka(n)||e&&n.resource.scheme!==e||t&&n.resource.authority!==t)continue;let r=this.contextService.getWorkspaceFolder(n.resource);if(r)return r.uri}for(let n of o){let r=n.uri;if((!e||r.scheme===e)&&(!t||r.authority===t))return r}}}getLastActiveFile(e,t){for(let o of this.getHistory()){let n;if(ka(o)?n=po.getOriginalUri(o,{filterByScheme:e}):n=o.resource,n&&n.scheme===e&&(!t||n.authority===t))return n}}dispose(){super.dispose();for(let[,e]of this.editorGroupScopedNavigationStacks)e.disposable.dispose();for(let[,e]of this.editorScopedNavigationStacks)for(let[,t]of e)t.disposable.dispose();for(let[,e]of this.editorHistoryListeners)e.dispose()}};uM=I([m(0,ee),m(1,wt),m(2,Pe),m(3,ce),m(4,B),m(5,fe),m(6,jp),m(7,F),m(8,yi),m(9,X),m(10,se)],uM);Ee(na,uM,0);var CVt=class{constructor(i,e,t){this.editorIdentifier=i;this.selection=e;this.reason=t}justifiesNewNavigationEntry(i){if(this.editorIdentifier.groupId!==i.editorIdentifier.groupId||!this.editorIdentifier.editor.matches(i.editorIdentifier.editor)||!this.selection||!i.selection)return!0;let e=this.selection.compare(i.selection);return e===2&&(i.reason===4||i.reason===5)?!0:e===3}},cme=class extends x{constructor(e,t){super();this.scope=e;this.instantiationService=t;this.selectionsStack=this._register(this.instantiationService.createInstance(W3,0,this.scope)),this.editsStack=this._register(this.instantiationService.createInstance(W3,1,this.scope)),this.navigationsStack=this._register(this.instantiationService.createInstance(W3,2,this.scope)),this.stacks=[this.selectionsStack,this.editsStack,this.navigationsStack],this.onDidChange=U.any(this.selectionsStack.onDidChange,this.editsStack.onDidChange,this.navigationsStack.onDidChange)}canGoForward(e){return this.getStack(e).canGoForward()}goForward(e){return this.getStack(e).goForward()}canGoBack(e){return this.getStack(e).canGoBack()}goBack(e){return this.getStack(e).goBack()}goPrevious(e){return this.getStack(e).goPrevious()}canGoLast(e){return this.getStack(e).canGoLast()}goLast(e){return this.getStack(e).goLast()}getStack(e=0){switch(e){case 0:return this.selectionsStack;case 1:return this.editsStack;case 2:return this.navigationsStack}}handleActiveEditorChange(e){this.selectionsStack.notifyNavigation(e)}handleActiveEditorSelectionChange(e,t){let o=this.selectionsStack.current;this.selectionsStack.notifyNavigation(e,t),t.reason===3?this.editsStack.notifyNavigation(e,t):(t.reason===4||t.reason===5)&&!this.selectionsStack.isNavigating()&&(t.reason===5&&!this.navigationsStack.isNavigating()&&o&&this.navigationsStack.addOrReplace(o.groupId,o.editor,o.selection),this.navigationsStack.notifyNavigation(e,t))}clear(){for(let e of this.stacks)e.clear()}remove(e){for(let t of this.stacks)t.remove(e)}move(e){for(let t of this.stacks)t.move(e)}};cme=I([m(1,F)],cme);var ICi=class{constructor(){this.onDidChange=U.None}canGoForward(){return!1}async goForward(){}canGoBack(){return!1}async goBack(){}async goPrevious(){}canGoLast(){return!1}async goLast(){}handleActiveEditorChange(){}handleActiveEditorSelectionChange(){}clear(){}remove(){}move(){}dispose(){}},W3=class extends x{constructor(e,t,o,n,r,s){super();this.filter=e;this.scope=t;this.editorService=n;this.editorGroupService=r;this.logService=s;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this.mapEditorToDisposable=this._register(new Vt);this.mapGroupToDisposable=this._register(new Vt);this.stack=[];this.index=-1;this.previousIndex=-1;this.navigating=!1;this.currentSelectionState=void 0;this.editorHelper=o.createInstance(VRe),this.registerListeners()}static{this.MAX_STACK_SIZE=50}get current(){return this.stack[this.index]}set current(e){e&&(this.stack[this.index]=e)}registerListeners(){this._register(this.onDidChange(()=>this.traceStack())),this._register(this.logService.onDidChangeLogLevel(()=>this.traceStack())),this._register(this.editorGroupService.onDidRemoveGroup(e=>{this.mapGroupToDisposable.deleteAndDispose(e.id)}))}traceStack(){if(this.logService.getLevel()!==1)return;let e=[];for(let t of this.stack)typeof t.selection?.log=="function"?e.push(`- group: ${t.groupId}, editor: ${t.editor.resource?.toString()}, selection: ${t.selection.log()}`):e.push(`- group: ${t.groupId}, editor: ${t.editor.resource?.toString()}, selection: <none>`);e.length===0?this.trace(`index: ${this.index}, navigating: ${this.isNavigating()}: <empty>`):this.trace(`index: ${this.index}, navigating: ${this.isNavigating()}
${e.join(`
`)}
			`)}trace(e,t=null,o){if(this.logService.getLevel()!==1)return;let n;switch(this.filter){case 0:n="global";break;case 1:n="edits";break;case 2:n="navigation";break}let r;switch(this.scope){case 0:r="default";break;case 1:r="editorGroup";break;case 2:r="editor";break}t!==null?this.logService.trace(`[History stack ${n}-${r}]: ${e} (editor: ${t?.resource?.toString()}, event: ${this.traceEvent(o)})`):this.logService.trace(`[History stack ${n}-${r}]: ${e}`)}traceEvent(e){if(!e)return"<none>";switch(e.reason){case 3:return"edit";case 4:return"navigation";case 5:return"jump";case 1:return"programmatic";case 2:return"user"}}registerGroupListeners(e){if(!this.mapGroupToDisposable.has(e)){let t=this.editorGroupService.getGroup(e);t&&this.mapGroupToDisposable.set(e,t.onWillMoveEditor(o=>this.onWillMoveEditor(o)))}}onWillMoveEditor(e){if(this.trace("onWillMoveEditor()",e.editor),this.scope!==1)for(let t of this.stack)t.groupId===e.groupId&&this.editorHelper.matchesEditor(e.editor,t.editor)&&(t.groupId=e.target)}notifyNavigation(e,t){this.trace("notifyNavigation()",e?.input,t);let o=Hde(e),n=e?.input&&!e.input.isDisposed();this.navigating?(this.trace("notifyNavigation() ignoring (navigating)",e?.input,t),o&&n?(this.trace("notifyNavigation() updating current selection state",e?.input,t),this.currentSelectionState=new CVt({groupId:e.group.id,editor:e.input},e.getSelection(),t?.reason)):(this.trace("notifyNavigation() dropping current selection state",e?.input,t),this.currentSelectionState=void 0)):(this.trace("notifyNavigation() not ignoring",e?.input,t),o&&n?this.onSelectionAwareEditorNavigation(e.group.id,e.input,e.getSelection(),t):(this.currentSelectionState=void 0,n&&this.onNonSelectionAwareEditorNavigation(e.group.id,e.input)))}onSelectionAwareEditorNavigation(e,t,o,n){if(this.current?.groupId===e&&!o&&this.editorHelper.matchesEditor(this.current.editor,t))return;this.trace("onSelectionAwareEditorNavigation()",t,n);let r=new CVt({groupId:e,editor:t},o,n?.reason);!this.currentSelectionState||this.currentSelectionState.justifiesNewNavigationEntry(r)?this.doAdd(e,t,r.selection):this.doReplace(e,t,r.selection),this.currentSelectionState=r}onNonSelectionAwareEditorNavigation(e,t){this.current?.groupId===e&&this.editorHelper.matchesEditor(this.current.editor,t)||(this.trace("onNonSelectionAwareEditorNavigation()",t),this.doAdd(e,t))}doAdd(e,t,o){this.navigating||this.addOrReplace(e,t,o)}doReplace(e,t,o){this.navigating||this.addOrReplace(e,t,o,!0)}addOrReplace(e,t,o,n){this.registerGroupListeners(e);let r=!1;this.current&&(n||this.shouldReplaceStackEntry(this.current,{groupId:e,editor:t,selection:o}))&&(r=!0);let s=this.editorHelper.preferResourceEditorInput(t);if(!s)return;r?this.trace("replace()",s):this.trace("add()",s);let l={groupId:e,editor:s,selection:o},c=[];if(r)this.current&&c.push(this.current),this.current=l;else{if(this.stack.length>this.index+1){for(let u=this.index+1;u<this.stack.length;u++)c.push(this.stack[u]);this.stack=this.stack.slice(0,this.index+1)}this.stack.splice(this.index+1,0,l),this.stack.length>W3.MAX_STACK_SIZE?(c.push(this.stack.shift()),this.previousIndex>=0&&this.previousIndex--):this.setIndex(this.index+1,!0)}for(let u of c)this.editorHelper.clearOnEditorDispose(u.editor,this.mapEditorToDisposable);ka(s)&&this.editorHelper.onEditorDispose(s,()=>this.remove(s),this.mapEditorToDisposable),this._onDidChange.fire()}shouldReplaceStackEntry(e,t){return e.groupId!==t.groupId||!this.editorHelper.matchesEditor(e.editor,t.editor)?!1:e.selection?t.selection?e.selection.compare(t.selection)===1:!1:!0}move(e){if(e.isOperation(2))for(let t of this.stack)this.editorHelper.matchesEditor(e,t.editor)&&(t.editor={resource:e.target.resource})}remove(e){let t=this.stack.length;this.stack=this.stack.filter(o=>{let n=typeof e=="number"?o.groupId===e:this.editorHelper.matchesEditor(e,o.editor);return n&&this.editorHelper.clearOnEditorDispose(o.editor,this.mapEditorToDisposable),!n}),t!==this.stack.length&&(this.flatten(),this.index=this.stack.length-1,this.previousIndex=-1,typeof e=="number"&&this.mapGroupToDisposable.deleteAndDispose(e),this._onDidChange.fire())}flatten(){let e=[],t;for(let o of this.stack)t&&this.shouldReplaceStackEntry(o,t)||(t=o,e.push(o));this.stack=e}clear(){this.index=-1,this.previousIndex=-1,this.stack.splice(0),this.mapEditorToDisposable.clearAndDisposeAll(),this.mapGroupToDisposable.clearAndDisposeAll()}dispose(){this.clear(),super.dispose()}canGoForward(){return this.stack.length>this.index+1}async goForward(){if(!await this.maybeGoCurrent()&&this.canGoForward())return this.setIndex(this.index+1),this.navigate()}canGoBack(){return this.index>0}async goBack(){if(!await this.maybeGoCurrent()&&this.canGoBack())return this.setIndex(this.index-1),this.navigate()}async goPrevious(){if(!await this.maybeGoCurrent())return this.previousIndex===-1?this.goBack():(this.setIndex(this.previousIndex),this.navigate())}canGoLast(){return this.stack.length>0}async goLast(){if(this.canGoLast())return this.setIndex(this.stack.length-1),this.navigate()}async maybeGoCurrent(){return this.filter===0||this.isCurrentSelectionActive()?!1:(await this.navigate(),!0)}isCurrentSelectionActive(){if(!this.current?.selection)return!1;let e=this.editorService.activeEditorPane;if(!Hde(e)||e.group.id!==this.current.groupId||!e.input||!this.editorHelper.matchesEditor(e.input,this.current.editor))return!1;let t=e.getSelection();return t?t.compare(this.current.selection)===1:!1}setIndex(e,t){this.previousIndex=this.index,this.index=e,t||this._onDidChange.fire()}async navigate(){this.navigating=!0;try{this.current&&await this.doNavigate(this.current)}finally{this.navigating=!1}}doNavigate(e){let t=Object.create(null);return e.selection&&(t=e.selection.restore(t)),ka(e.editor)?this.editorService.openEditor(e.editor,t,e.groupId):this.editorService.openEditor({...e.editor,options:{...e.editor.options,...t}},e.groupId)}isNavigating(){return this.navigating}};W3=I([m(2,F),m(3,ee),m(4,wt),m(5,se)],W3);var VRe=class{constructor(i,e,t,o){this.uriIdentityService=i;this.lifecycleService=e;this.fileService=t;this.pathService=o}preferResourceEditorInput(i){let e=po.getOriginalUri(i);if(e?.scheme===Q.file||e?.scheme===Q.vscodeRemote||e?.scheme===Q.vscodeUserData||e?.scheme===this.pathService.defaultUriScheme){if(ka(i)){let o=i.toUntyped();if(Sf(o))return o}return i}else return ka(i)?i:void 0}matchesEditor(i,e){return i instanceof RO||i instanceof LO?ka(e)?!1:i instanceof RO?i.contains(e.resource,2):this.matchesFile(e.resource,i):ka(i)?ka(e)?i.matches(e):this.matchesFile(e.resource,i):ka(e)?this.matchesFile(i.resource,e):i&&e&&this.uriIdentityService.extUri.isEqual(i.resource,e.resource)}matchesFile(i,e){if(e instanceof RO)return e.contains(i,2);if(e instanceof LO)return this.uriIdentityService.extUri.isEqualOrParent(i,e.resource);if(ka(e)){let t=e.resource;return!t||this.lifecycleService.phase>=3&&!this.fileService.hasProvider(t)?!1:this.uriIdentityService.extUri.isEqual(t,i)}return this.uriIdentityService.extUri.isEqual(e?.resource,i)}matchesEditorIdentifier(i,e){return!e?.group||i.groupId!==e.group.id?!1:e.input?i.editor.matches(e.input):!1}onEditorDispose(i,e,t){let o=U.once(i.onWillDispose)(()=>e()),n=t.get(i);n||(n=new N,t.set(i,n)),n.add(o)}clearOnEditorDispose(i,e){ka(i)&&e.deleteAndDispose(i)}};VRe=I([m(0,ht),m(1,ji),m(2,fe),m(3,An)],VRe);var vZe=class extends x{constructor(e,t,o){super();this.viewId=e;this.viewDescriptorService=t;this.activityService=o;this.activity=void 0;this.activityDisposable=x.None;this._register(U.filter(this.viewDescriptorService.onDidChangeContainer,n=>n.views.some(r=>r.id===e))(()=>this.update())),this._register(U.filter(this.viewDescriptorService.onDidChangeLocation,n=>n.views.some(r=>r.id===e))(()=>this.update()))}setActivity(e){this.activity=e,this.update()}clearActivity(){this.activity=void 0,this.update()}update(){this.activityDisposable.dispose();let e=this.viewDescriptorService.getViewContainerByViewId(this.viewId);e&&this.activity&&(this.activityDisposable=this.activityService.showViewContainerActivity(e.id,this.activity))}dispose(){this.activityDisposable.dispose(),super.dispose()}};vZe=I([m(1,Bi),m(2,Sl)],vZe);var bZe=class extends x{constructor(e,t){super();this.viewDescriptorService=e;this.instantiationService=t;this.viewActivities=new Map;this._onDidChangeActivity=this._register(new E);this.onDidChangeActivity=this._onDidChangeActivity.event;this.viewContainerActivities=new Map;this.globalActivities=new Map}showViewContainerActivity(e,t){let o=this.viewDescriptorService.getViewContainerById(e);if(!o)return x.None;let n=this.viewContainerActivities.get(e);return n||(n=[],this.viewContainerActivities.set(e,n)),n.push(t),this._onDidChangeActivity.fire(o),Z(()=>{n.splice(n.indexOf(t),1),n.length===0&&this.viewContainerActivities.delete(e),this._onDidChangeActivity.fire(o)})}getViewContainerActivities(e){return this.viewDescriptorService.getViewContainerById(e)?this.viewContainerActivities.get(e)??[]:[]}showViewActivity(e,t){let o=this.viewActivities.get(e);o?o.id++:(o={id:1,activity:this.instantiationService.createInstance(vZe,e)},this.viewActivities.set(e,o));let n=o.id;o.activity.setActivity(t);let r=o;return Z(()=>{r.id===n&&(r.activity.dispose(),this.viewActivities.delete(e))})}showAccountsActivity(e){return this.showActivity(SH,e)}showGlobalActivity(e){return this.showActivity(bH,e)}getActivity(e){return this.globalActivities.get(e)??[]}showActivity(e,t){let o=this.globalActivities.get(e);return o||(o=[],this.globalActivities.set(e,o)),o.push(t),this._onDidChangeActivity.fire(e),Z(()=>{o.splice(o.indexOf(t),1),o.length===0&&this.globalActivities.delete(e),this._onDidChangeActivity.fire(e)})}};bZe=I([m(0,Bi),m(1,F)],bZe);Ee(Sl,bZe,1);var L0=class{static _readModifiers(i){i=i.toLowerCase().trim();let e=!1,t=!1,o=!1,n=!1,r;do r=!1,/^ctrl(\+|\-)/.test(i)&&(e=!0,i=i.substr(5),r=!0),/^shift(\+|\-)/.test(i)&&(t=!0,i=i.substr(6),r=!0),/^alt(\+|\-)/.test(i)&&(o=!0,i=i.substr(4),r=!0),/^meta(\+|\-)/.test(i)&&(n=!0,i=i.substr(5),r=!0),/^win(\+|\-)/.test(i)&&(n=!0,i=i.substr(4),r=!0),/^cmd(\+|\-)/.test(i)&&(n=!0,i=i.substr(4),r=!0);while(r);let s,l=i.indexOf(" ");return l>0?(s=i.substring(0,l),i=i.substring(l)):(s=i,i=""),{remains:i,ctrl:e,shift:t,alt:o,meta:n,key:s}}static parseChord(i){let e=this._readModifiers(i),t=e.key.match(/^\[([^\]]+)\]$/);if(t){let n=t[1],r=Zb.lowerCaseToEnum(n);return[new EL(e.ctrl,e.shift,e.alt,e.meta,r),e.remains]}let o=Fp.fromUserSettings(e.key);return[new eS(e.ctrl,e.shift,e.alt,e.meta,o),e.remains]}static parseKeybinding(i){if(!i)return null;let e=[],t;for(;i.length>0;)[t,i]=this.parseChord(i),e.push(t);return e.length>0?new m1(e):null}};var L9o=/^(cursor|delete|undo|redo|tab|editor\.action\.clipboard)/,xVt=class extends x{constructor(e,t,o,n,r){super();this._contextKeyService=e;this._commandService=t;this._telemetryService=o;this._notificationService=n;this._logService=r;this._onDidUpdateKeybindings=this._register(new E);this._currentChords=[],this._currentChordChecker=new FI,this._currentChordStatusMessage=null,this._ignoreSingleModifiers=BRe.EMPTY,this._currentSingleModifier=null,this._currentSingleModifierClearTimeout=new Ul,this._currentlyDispatchingCommandId=null,this._logging=!1}get onDidUpdateKeybindings(){return this._onDidUpdateKeybindings?this._onDidUpdateKeybindings.event:U.None}get inChordMode(){return this._currentChords.length>0}dispose(){super.dispose()}getDefaultKeybindingsContent(){return""}toggleLogging(){return this._logging=!this._logging,this._logging}_log(e){this._logging&&this._logService.info(`[KeybindingService]: ${e}`)}getDefaultKeybindings(){return this._getResolver().getDefaultKeybindings()}getKeybindings(){return this._getResolver().getKeybindings()}customKeybindingsCount(){return 0}lookupKeybindings(e){return di(this._getResolver().lookupKeybindings(e).map(t=>t.resolvedKeybinding))}lookupKeybinding(e,t,o=!1){let n=this._getResolver().lookupPrimaryKeybinding(e,t||this._contextKeyService,o);if(n)return n.resolvedKeybinding}dispatchEvent(e,t){return this._dispatch(e,t)}softDispatch(e,t){this._log("/ Soft dispatching keyboard event");let o=this.resolveKeyboardEvent(e);if(o.hasMultipleChords())return console.warn("keyboard event should not be mapped to multiple chords"),s3e;let[n]=o.getDispatchChords();if(n===null)return this._log("\\ Keyboard event cannot be dispatched"),s3e;let r=this._contextKeyService.getContext(t),s=this._currentChords.map((({keypress:l})=>l));return this._getResolver().resolve(r,s,n)}_scheduleLeaveChordMode(){let e=Date.now();this._currentChordChecker.cancelAndSet(()=>{if(!this._documentHasFocus()){this._leaveChordMode();return}Date.now()-e>5e3&&this._leaveChordMode()},500)}_expectAnotherChord(e,t){switch(this._currentChords.push({keypress:e,label:t}),this._currentChords.length){case 0:throw NSe("impossible");case 1:this._currentChordStatusMessage=this._notificationService.status(d(2171,null,t));break;default:{let o=this._currentChords.map(({label:n})=>n).join(", ");this._currentChordStatusMessage=this._notificationService.status(d(2174,null,o))}}this._scheduleLeaveChordMode(),M_.enabled&&M_.disable()}_leaveChordMode(){this._currentChordStatusMessage&&(this._currentChordStatusMessage.close(),this._currentChordStatusMessage=null),this._currentChordChecker.cancel(),this._currentChords=[],M_.enable()}dispatchByUserSettingsLabel(e,t){this._log(`/ Dispatching keybinding triggered via menu entry accelerator - ${e}`);let o=this.resolveUserBinding(e);o.length===0?this._log(`\\ Could not resolve - ${e}`):this._doDispatch(o[0],t,!1)}_dispatch(e,t){return this._doDispatch(this.resolveKeyboardEvent(e),t,!1)}_singleModifierDispatch(e,t){let o=this.resolveKeyboardEvent(e),[n]=o.getSingleModifierDispatchChords();if(n)return this._ignoreSingleModifiers.has(n)?(this._log(`+ Ignoring single modifier ${n} due to it being pressed together with other keys.`),this._ignoreSingleModifiers=BRe.EMPTY,this._currentSingleModifierClearTimeout.cancel(),this._currentSingleModifier=null,!1):(this._ignoreSingleModifiers=BRe.EMPTY,this._currentSingleModifier===null?(this._log(`+ Storing single modifier for possible chord ${n}.`),this._currentSingleModifier=n,this._currentSingleModifierClearTimeout.cancelAndSet(()=>{this._log("+ Clearing single modifier due to 300ms elapsed."),this._currentSingleModifier=null},300),!1):n===this._currentSingleModifier?(this._log(`/ Dispatching single modifier chord ${n} ${n}`),this._currentSingleModifierClearTimeout.cancel(),this._currentSingleModifier=null,this._doDispatch(o,t,!0)):(this._log(`+ Clearing single modifier due to modifier mismatch: ${this._currentSingleModifier} ${n}`),this._currentSingleModifierClearTimeout.cancel(),this._currentSingleModifier=null,!1));let[r]=o.getChords();return this._ignoreSingleModifiers=new BRe(r),this._currentSingleModifier!==null&&this._log("+ Clearing single modifier due to other key up."),this._currentSingleModifierClearTimeout.cancel(),this._currentSingleModifier=null,!1}_doDispatch(e,t,o=!1){let n=!1;if(e.hasMultipleChords())return console.warn("Unexpected keyboard event mapped to multiple chords"),!1;let r=null,s=null;if(o){let[p]=e.getSingleModifierDispatchChords();r=p,s=p?[p]:[]}else[r]=e.getDispatchChords(),s=this._currentChords.map(({keypress:p})=>p);if(r===null)return this._log("\\ Keyboard event cannot be dispatched in keydown phase."),n;let l=this._contextKeyService.getContext(t),c=e.getLabel(),u=this._getResolver().resolve(l,s,r);switch(u.kind){case 0:{if(this._logService.trace("KeybindingService#dispatch",c,"[ No matching keybinding ]"),this.inChordMode){let p=this._currentChords.map(({label:h})=>h).join(", ");this._log(`+ Leaving multi-chord mode: Nothing bound to "${p}, ${c}".`),this._notificationService.status(d(2173,null,p,c),{hideAfter:10*1e3}),this._leaveChordMode(),n=!0}return n}case 1:return this._logService.trace("KeybindingService#dispatch",c,"[ Several keybindings match - more chords needed ]"),n=!0,this._expectAnotherChord(r,c),this._log(this._currentChords.length===1?"+ Entering multi-chord mode...":"+ Continuing multi-chord mode..."),n;case 2:{if(this._logService.trace("KeybindingService#dispatch",c,`[ Will dispatch command ${u.commandId} ]`),u.commandId===null||u.commandId===""){if(this.inChordMode){let p=this._currentChords.map(({label:h})=>h).join(", ");this._log(`+ Leaving chord mode: Nothing bound to "${p}, ${c}".`),this._notificationService.status(d(2173,null,p,c),{hideAfter:10*1e3}),this._leaveChordMode(),n=!0}}else{this.inChordMode&&this._leaveChordMode(),u.isBubble||(n=!0),this._log(`+ Invoking command ${u.commandId}.`),this._currentlyDispatchingCommandId=u.commandId;try{typeof u.commandArgs>"u"?this._commandService.executeCommand(u.commandId).then(void 0,p=>this._notificationService.warn(p)):this._commandService.executeCommand(u.commandId,u.commandArgs).then(void 0,p=>this._notificationService.warn(p))}finally{this._currentlyDispatchingCommandId=null}L9o.test(u.commandId)||this._telemetryService.publicLog2("workbenchActionExecuted",{id:u.commandId,from:"keybinding",detail:e.getUserSettingsLabel()??void 0})}return n}}}mightProducePrintableCharacter(e){return e.ctrlKey||e.metaKey?!1:e.keyCode>=31&&e.keyCode<=56||e.keyCode>=21&&e.keyCode<=30}appendKeybinding(e,t,o,n){if(t){let r=this.lookupKeybinding(t,o,n)?.getLabel();if(r)return d(2172,null,e,r)}return e}},BRe=class a{static{this.EMPTY=new a(null)}constructor(i){this._ctrlKey=i?i.ctrlKey:!1,this._shiftKey=i?i.shiftKey:!1,this._altKey=i?i.altKey:!1,this._metaKey=i?i.metaKey:!1}has(i){switch(i){case"ctrl":return this._ctrlKey;case"shift":return this._shiftKey;case"alt":return this._altKey;case"meta":return this._metaKey}}};var kVt=le("keyboardLayoutService");function yCi(a){return a.name?a.name:a.id?a.id:a.layout}function R9o(a,i){return!a&&!i?!0:!a||!i?!1:a.vkey===i.vkey&&a.value===i.value&&a.withShift===i.withShift&&a.withAltGr===i.withAltGr&&a.withShiftAltGr===i.withShiftAltGr}function bdo(a,i){if(!a&&!i)return!0;if(!a||!i)return!1;for(let e=0;e<193;e++){let t=Zb.toString(e),o=a[t],n=i[t];if(!R9o(o,n))return!1}return!0}function M9o(a,i){return!a&&!i?!0:!a||!i?!1:a.value===i.value&&a.withShift===i.withShift&&a.withAltGr===i.withAltGr&&a.withShiftAltGr===i.withShiftAltGr}function Sdo(a,i){if(!a&&!i)return!0;if(!a||!i)return!1;for(let e=0;e<193;e++){let t=Zb.toString(e),o=a[t],n=i[t];if(!M9o(o,n))return!1}return!0}var dme=class{static writeKeybindingItem(i,e){if(!e.resolvedKeybinding)return;let t=JSON.stringify(e.resolvedKeybinding.getUserSettingsLabel());i.write(`{ "key": ${P9o(t+",",25)} "command": `);let o=e.when?JSON.stringify(e.when.serialize()):"",n=JSON.stringify(e.command);o.length>0?(i.write(`${n},`),i.writeLine(),i.write(`                                     "when": ${o}`)):i.write(`${n}`),e.commandArgs&&(i.write(","),i.writeLine(),i.write(`                                     "args": ${JSON.stringify(e.commandArgs)}`)),i.write(" }")}static readUserKeybindingItem(i){let e="key"in i&&typeof i.key=="string"?L0.parseKeybinding(i.key):null,t="when"in i&&typeof i.when=="string"?C.deserialize(i.when):void 0,o="command"in i&&typeof i.command=="string"?i.command:null,n="args"in i&&typeof i.args<"u"?i.args:void 0;return{keybinding:e,command:o,commandArgs:n,when:t,_sourceKey:"key"in i&&typeof i.key=="string"?i.key:void 0}}};function P9o(a,i){return a.length<i?a+new Array(i-a.length).join(" "):a}var HRe=class{constructor(){this._lines=[];this._currentLine=""}write(i){this._currentLine+=i}writeLine(i=""){this._lines.push(this._currentLine+i),this._currentLine=""}toString(){return this.writeLine(),this._lines.join(`
`)}};function A9o(a,i){return a?typeof a.command!="string"?(i.push(d(17812,null,"command")),!1):a.key&&typeof a.key!="string"?(i.push(d(17811,null,"key")),!1):a.when&&typeof a.when!="string"?(i.push(d(17811,null,"when")),!1):a.mac&&typeof a.mac!="string"?(i.push(d(17811,null,"mac")),!1):a.linux&&typeof a.linux!="string"?(i.push(d(17811,null,"linux")),!1):a.win&&typeof a.win!="string"?(i.push(d(17811,null,"win")),!1):!0:(i.push(d(17810,null)),!1)}var Ido={type:"object",default:{command:"",key:""},required:["command","key"],properties:{command:{description:d(17816,null),type:"string"},args:{description:d(17815,null)},key:{description:d(17817,null),type:"string"},mac:{description:d(17819,null),type:"string"},linux:{description:d(17818,null),type:"string"},win:{description:d(17821,null),type:"string"},when:{description:d(17820,null),type:"string"}}},ydo=Rn.registerExtensionPoint({extensionPoint:"keybindings",deps:[vyi],jsonSchema:{description:d(17814,null),oneOf:[Ido,{type:"array",items:Ido}]}}),N9o=[90,91,92,93,95,96,97,98,99,100,101,102,103,104,105],wH=new Map;wH.set(95,22);wH.set(96,23);wH.set(97,24);wH.set(98,25);wH.set(99,26);wH.set(100,27);wH.set(101,28);wH.set(102,29);wH.set(103,30);wH.set(104,21);var V3=class extends xVt{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,t,o,n,p);this.hostService=s;this.keyboardLayoutService=h;this._contributions=[];this.isComposingGlobalContextKey=e.createKey(pe.isComposing.key,!1),this.kbsJsonSchema=new CCi,this.updateKeybindingsJsonSchema(),this._keyboardMapper=this.keyboardLayoutService.getKeyboardMapper(),this._register(this.keyboardLayoutService.onDidChangeKeyboardLayout(()=>{this._keyboardMapper=this.keyboardLayoutService.getKeyboardMapper(),this.updateResolver()})),this._keybindingHoldMode=null,this._cachedResolver=null,this.userKeybindings=this._register(new wCi(r,u,c,p)),this.userKeybindings.initialize().then(()=>{this.userKeybindings.keybindings.length&&this.updateResolver()}),this._register(this.userKeybindings.onDidChange(()=>{p.debug("User keybindings changed"),this.updateResolver()})),ydo.setHandler(g=>{let f=[];for(let v of g)this._handleKeybindingsExtensionPointUser(v.description.identifier,v.description.isBuiltin,v.value,v.collector,f);Ct.setExtensionKeybindings(f),this.updateResolver()}),this.updateKeybindingsJsonSchema(),this._register(l.onDidRegisterExtensions(()=>this.updateKeybindingsJsonSchema())),this._register(U.runAndSubscribe(nf,({window:g,disposables:f})=>f.add(this._registerKeyListeners(g)),{window:ut,disposables:this._store})),this._register(YN(g=>{if(g!==ut.vscodeWindowId)return;let f=navigator.keyboard;yg.keyboard!==2&&(hC(ut)?f?.lock(["Escape"]):f?.unlock(),this._cachedResolver=null,this._onDidUpdateKeybindings.fire())}))}dispose(){this._contributions.forEach(e=>e.listener?.dispose()),this._contributions.length=0,super.dispose()}_registerKeyListeners(e){let t=new N;return t.add(j(e,re.KEY_DOWN,o=>{if(this._keybindingHoldMode)return;this.isComposingGlobalContextKey.set(o.isComposing);let n=new gi(o);this._log(`/ Received  keydown event - ${vGi(o)}`),this._log(`| Converted keydown event - ${bGi(n)}`),this._dispatch(n,n.target)&&n.preventDefault(),this.isComposingGlobalContextKey.set(!1)})),t.add(j(e,re.KEY_UP,o=>{this._resetKeybindingHoldMode(),this.isComposingGlobalContextKey.set(o.isComposing);let n=new gi(o);this._singleModifierDispatch(n,n.target)&&n.preventDefault(),this.isComposingGlobalContextKey.set(!1)})),t}registerSchemaContribution(e){let t=e.onDidChange?.(()=>this.updateKeybindingsJsonSchema()),o={listener:t,contribution:e};return this._contributions.push(o),this.updateKeybindingsJsonSchema(),Z(()=>{t?.dispose(),s$e(this._contributions,o),this.updateKeybindingsJsonSchema()})}updateKeybindingsJsonSchema(){this.kbsJsonSchema.updateSchema(this._contributions.flatMap(e=>e.contribution.getSchemaAdditions()))}_printKeybinding(e){return UCe.toLabel(Po,e.chords,t=>t instanceof eS?Fp.toString(t.keyCode):Zb.toString(t.scanCode))||"[null]"}_printResolvedKeybinding(e){return e.getDispatchChords().map(t=>t||"[null]").join(" ")}_printResolvedKeybindings(e,t,o){let r=`${t.padStart(35," ")} => `;if(o.length===0){e.push(`${r}${"[NO BINDING]".padStart(35," ")}`);return}let s=r.length,l=!0;for(let c of o)l?e.push(`${r}${this._printResolvedKeybinding(c).padStart(35," ")}`):e.push(`${" ".repeat(s)}${this._printResolvedKeybinding(c).padStart(35," ")}`)}_dumpResolveKeybindingDebugInfo(){let e=new Set,t=[];t.push("Default Resolved Keybindings (unique only):");for(let o of Ct.getDefaultKeybindings()){if(!o.keybinding)continue;let n=this._printKeybinding(o.keybinding);if(e.has(n))continue;e.add(n);let r=this._keyboardMapper.resolveKeybinding(o.keybinding);this._printResolvedKeybindings(t,n,r)}t.push("User Resolved Keybindings (unique only):");for(let o of this.userKeybindings.keybindings){if(!o.keybinding)continue;let n=o._sourceKey??"Impossible: missing source key, but has keybinding";if(e.has(n))continue;e.add(n);let r=this._keyboardMapper.resolveKeybinding(o.keybinding);this._printResolvedKeybindings(t,n,r)}return t.join(`
`)}_dumpDebugInfo(){let e=JSON.stringify(this.keyboardLayoutService.getCurrentKeyboardLayout(),null,"	"),t=this._keyboardMapper.dumpDebugInfo(),o=this._dumpResolveKeybindingDebugInfo(),n=JSON.stringify(this.keyboardLayoutService.getRawKeyboardMapping(),null,"	");return`Layout info:
${e}

${o}

${t}

Raw mapping:
${n}`}_dumpDebugInfoJSON(){let e={layout:this.keyboardLayoutService.getCurrentKeyboardLayout(),rawMapping:this.keyboardLayoutService.getRawKeyboardMapping()};return JSON.stringify(e,null,"	")}enableKeybindingHoldMode(e){if(this._currentlyDispatchingCommandId!==e)return;this._keybindingHoldMode=new Ko;let t=qn(Re(void 0)),o=t.onDidBlur(()=>this._resetKeybindingHoldMode());return this._keybindingHoldMode.p.finally(()=>{o.dispose(),t.dispose()}),this._log(`+ Enabled hold-mode for ${e}.`),this._keybindingHoldMode.p}_resetKeybindingHoldMode(){this._keybindingHoldMode&&(this._keybindingHoldMode?.complete(),this._keybindingHoldMode=null)}customKeybindingsCount(){return this.userKeybindings.keybindings.length}updateResolver(){this._cachedResolver=null,this._onDidUpdateKeybindings.fire()}_getResolver(){if(!this._cachedResolver){let e=this._resolveKeybindingItems(Ct.getDefaultKeybindings(),!0),t=this._resolveUserKeybindingItems(this.userKeybindings.keybindings,!1);this._cachedResolver=new vxe(e,t,o=>this._log(o))}return this._cachedResolver}_documentHasFocus(){return this.hostService.hasFocus}_resolveKeybindingItems(e,t){let o=[],n=0;for(let r of e){let s=r.when||void 0,l=r.keybinding;if(!l)o[n++]=new BA(void 0,r.command,r.commandArgs,s,t,r.extensionId,r.isBuiltinExtension);else{if(this._assertBrowserConflicts(l))continue;let c=this._keyboardMapper.resolveKeybinding(l);for(let u=c.length-1;u>=0;u--){let p=c[u];o[n++]=new BA(p,r.command,r.commandArgs,s,t,r.extensionId,r.isBuiltinExtension)}}}return o}_resolveUserKeybindingItems(e,t){let o=[],n=0;for(let r of e){let s=r.when||void 0;if(!r.keybinding)o[n++]=new BA(void 0,r.command,r.commandArgs,s,t,null,!1);else{let l=this._keyboardMapper.resolveKeybinding(r.keybinding);for(let c of l)o[n++]=new BA(c,r.command,r.commandArgs,s,t,null,!1)}}return o}_assertBrowserConflicts(e){if(yg.keyboard===0||yg.keyboard===1&&hC(ut))return!1;for(let t of e.chords){if(!t.metaKey&&!t.altKey&&!t.ctrlKey&&!t.shiftKey)continue;let o=3584,n=0;if(t.metaKey&&(n|=2048),t.shiftKey&&(n|=1024),t.altKey&&(n|=512),t.ctrlKey&&Po===2&&(n|=256),(n&o)===2560&&(t instanceof EL&&(t.scanCode===86||t.scanCode===85)||t instanceof eS&&(t.keyCode===15||t.keyCode===17))||(n&o)===2048&&(t instanceof EL&&t.scanCode>=36&&t.scanCode<=45||t instanceof eS&&t.keyCode>=21&&t.keyCode<=30))return!0}return!1}resolveKeybinding(e){return this._keyboardMapper.resolveKeybinding(e)}resolveKeyboardEvent(e){return this.keyboardLayoutService.validateCurrentKeyboardMapping(e),this._keyboardMapper.resolveKeyboardEvent(e)}resolveUserBinding(e){let t=L0.parseKeybinding(e);return t?this._keyboardMapper.resolveKeybinding(t):[]}_handleKeybindingsExtensionPointUser(e,t,o,n,r){if(Array.isArray(o))for(let s=0,l=o.length;s<l;s++)this._handleKeybinding(e,t,s+1,o[s],n,r);else this._handleKeybinding(e,t,1,o,n,r)}_handleKeybinding(e,t,o,n,r,s){let l=[];if(A9o(n,l)){let c=this._asCommandRule(e,t,o++,n);c&&s.push(c)}l.length>0&&r.error(d(17802,null,ydo.name,l.join(`
`)))}static bindToCurrentPlatform(e,t,o,n){if(Po===1&&n){if(n)return n}else if(Po===2){if(t)return t}else if(o)return o;return e}_asCommandRule(e,t,o,n){let{command:r,args:s,when:l,key:c,mac:u,linux:p,win:h}=n,g=V3.bindToCurrentPlatform(c,u,p,h);if(!g)return;let f;t?f=300+o:f=400+o;let v=ve.getCommand(r),b=v&&v.precondition,S;return l&&b?S=C.and(b,C.deserialize(l)):l?S=C.deserialize(l):b&&(S=b),{id:r,args:s,when:S,weight:f,keybinding:L0.parseKeybinding(g),extensionId:e.value,isBuiltinExtension:t}}getDefaultKeybindingsContent(){let e=this._getResolver(),t=e.getDefaultKeybindings(),o=e.getDefaultBoundCommands();return V3._getDefaultKeybindings(t)+`

`+V3._getAllCommandsAsComment(o)}static _getDefaultKeybindings(e){let t=new HRe;t.writeLine("[");let o=e.length-1;return e.forEach((n,r)=>{dme.writeKeybindingItem(t,n),r!==o?t.writeLine(","):t.writeLine()}),t.writeLine("]"),t.toString()}static _getAllCommandsAsComment(e){let o=PRe(e).sort().join(`
// - `);return"// "+d(17813,null)+`
// - `+o}mightProducePrintableCharacter(e){if(e.ctrlKey||e.metaKey||e.altKey)return!1;let t=Zb.toEnum(e.code);if(N9o.indexOf(t)!==-1)return!!(e.keyCode===Qy[t]||Ze&&e.keyCode===wH.get(t));if(Qy[t]!==-1)return!1;let n=this.keyboardLayoutService.getRawKeyboardMapping();if(!n)return!1;let r=n[e.code];return!(!r||!r.value||/\s/.test(r.value))}};V3=I([m(0,X),m(1,ge),m(2,Te),m(3,Ne),m(4,ln),m(5,Zt),m(6,lt),m(7,fe),m(8,ht),m(9,se),m(10,kVt)],V3);var wCi=class extends x{constructor(e,t,o,n){super();this.userDataProfileService=e;this.uriIdentityService=t;this.fileService=o;this._rawKeybindings=[];this._keybindings=[];this.watchDisposables=this._register(new N);this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this.watch(),this.reloadConfigurationScheduler=this._register(new Dt(()=>this.reload().then(r=>{r&&this._onDidChange.fire()}),50)),this._register(U.filter(this.fileService.onDidFilesChange,r=>r.contains(this.userDataProfileService.currentProfile.keybindingsResource))(()=>{n.debug("Keybindings file changed"),this.reloadConfigurationScheduler.schedule()})),this._register(this.fileService.onDidRunOperation(r=>{r.operation===4&&r.resource.toString()===this.userDataProfileService.currentProfile.keybindingsResource.toString()&&(n.debug("Keybindings file written"),this.reloadConfigurationScheduler.schedule())})),this._register(e.onDidChangeCurrentProfile(r=>{this.uriIdentityService.extUri.isEqual(r.previous.keybindingsResource,r.profile.keybindingsResource)||r.join(this.whenCurrentProfileChanged())}))}get keybindings(){return this._keybindings}async whenCurrentProfileChanged(){this.watch(),this.reloadConfigurationScheduler.schedule()}watch(){this.watchDisposables.clear(),this.watchDisposables.add(this.fileService.watch(ci(this.userDataProfileService.currentProfile.keybindingsResource))),this.watchDisposables.add(this.fileService.watch(this.userDataProfileService.currentProfile.keybindingsResource))}async initialize(){await this.reload()}async reload(){let e=await this.readUserKeybindings();return eo(this._rawKeybindings,e)?!1:(this._rawKeybindings=e,this._keybindings=this._rawKeybindings.map(t=>dme.readUserKeybindingItem(t)),!0)}async readUserKeybindings(){try{let e=await this.fileService.readFile(this.userDataProfileService.currentProfile.keybindingsResource),t=jr(e.value.toString());return Array.isArray(t)?t.filter(o=>o&&typeof o=="object"):[]}catch{return[]}}},CCi=class a{constructor(){this.commandsSchemas=[];this.commandsEnum=[];this.removalCommandsEnum=[];this.commandsEnumDescriptions=[];this.schema={id:a.schemaId,type:"array",title:d(17808,null),allowTrailingCommas:!0,allowComments:!0,definitions:{editorGroupsSchema:{type:"array",items:{type:"object",properties:{groups:{$ref:"#/definitions/editorGroupsSchema",default:[{},{}]},size:{type:"number",default:.5}}}},commandNames:{type:"string",enum:this.commandsEnum,enumDescriptions:this.commandsEnumDescriptions,description:d(17805,null)},commandType:{anyOf:[{$ref:"#/definitions/commandNames"},{type:"string",enum:this.removalCommandsEnum,enumDescriptions:this.commandsEnumDescriptions,description:d(17807,null)},{type:"string"}]},commandsSchemas:{allOf:this.commandsSchemas}},items:{required:["key"],type:"object",defaultSnippets:[{body:{key:"$1",command:"$2",when:"$3"}}],properties:{key:{type:"string",description:d(17806,null)},command:{anyOf:[{if:{type:"array"},then:{not:{type:"array"},errorMessage:d(17803,null,"string")},else:{$ref:"#/definitions/commandType"}},{$ref:"#/definitions/commandType"}]},when:{type:"string",description:d(17809,null)},args:{description:d(17804,null)}},$ref:"#/definitions/commandsSchemas"}};this.schemaRegistry=ne.as(ma.JSONContribution);this.schemaRegistry.registerSchema(a.schemaId,this.schema)}static{this.schemaId="vscode://schemas/keybindings"}updateSchema(i){this.commandsSchemas.length=0,this.commandsEnum.length=0,this.removalCommandsEnum.length=0,this.commandsEnumDescriptions.length=0;let e=new Set,t=(r,s)=>{/^_/.test(r)||e.has(r)||(e.add(r),this.commandsEnum.push(r),this.commandsEnumDescriptions.push(s===void 0?"":Qj(s)?s.value:s),this.removalCommandsEnum.push(`-${r}`))},o=$e.getCommands();for(let[r,s]of o){let l=s.metadata;if(t(r,l?.description??ve.getCommand(r)?.title),!l||!l.args||l.args.length!==1||!l.args[0].schema)continue;let c=l.args[0].schema,u=typeof l.args[0].isOptional<"u"?!l.args[0].isOptional:Array.isArray(c.required)&&c.required.length>0,p={if:{required:["command"],properties:{command:{const:r}}},then:{required:[].concat(u?["args"]:[]),properties:{args:c}}};this.commandsSchemas.push(p)}let n=ve.getCommands();for(let r of n.keys())t(r);this.commandsSchemas.push(...i),this.schemaRegistry.notifySchemaChanged(a.schemaId)}};Ee(_e,V3,0);var SZe=class{constructor(i,e,t,o){this.configurationService=i;this.environmentService=t;this.storageService=o;this.remoteEnvironment=null;e.getEnvironment().then(n=>this.remoteEnvironment=n)}getEOL(i,e){let t=this.configurationService.getValue("files.eol",{overrideIdentifier:e,resource:i});if(t&&typeof t=="string"&&t!=="auto")return t;let o=this.getOS(i);return o===3||o===2?`
`:`\r
`}getOS(i){let e=Po,t=this.environmentService.remoteAuthority;if(t&&i&&i.scheme!==Q.file){let o=`resource.authority.os.${t}`;e=this.remoteEnvironment?this.remoteEnvironment.os:this.storageService.getNumber(o,1,Po),this.storageService.store(o,e,1,1)}return e}};SZe=I([m(0,B),m(1,bo),m(2,At),m(3,ce)],SZe);Ee(KL,SZe,1);function vee(a){return a.toString()}var xCi=class{constructor(i,e,t){this.model=i;this._modelEventListeners=new N;this.model=i,this._modelEventListeners.add(i.onWillDispose(()=>e(i))),this._modelEventListeners.add(i.onDidChangeLanguage(o=>t(i,o)))}dispose(){this._modelEventListeners.dispose()}},O9o=fn||Ze?1:2,kCi=class{constructor(i,e,t,o,n,r,s,l){this.uri=i;this.initialUndoRedoSnapshot=e;this.time=t;this.sharesUndoRedoStack=o;this.heapSize=n;this.sha1=r;this.versionId=s;this.alternativeVersionId=l}},R0=class extends x{constructor(e,t,o,n){super();this._configurationService=e;this._resourcePropertiesService=t;this._undoRedoService=o;this._instantiationService=n;this._onModelAdded=this._register(new E);this.onModelAdded=this._onModelAdded.event;this._onModelRemoved=this._register(new E);this.onModelRemoved=this._onModelRemoved.event;this._onModelModeChanged=this._register(new E);this.onModelLanguageChanged=this._onModelModeChanged.event;this._modelCreationOptionsByLanguageAndResource=Object.create(null),this._models={},this._disposedModels=new Map,this._disposedModelsHeapSize=0,this._register(this._configurationService.onDidChangeConfiguration(r=>this._updateModelOptions(r))),this._updateModelOptions(void 0)}static{this.MAX_MEMORY_FOR_CLOSED_FILES_UNDO_STACK=20*1024*1024}static _readModelOptions(e,t){let o=fv.tabSize;e.editor&&typeof e.editor.tabSize<"u"&&(o=EV(e.editor.tabSize,fv.tabSize,1,100));let n="tabSize";e.editor&&typeof e.editor.indentSize<"u"&&e.editor.indentSize!=="tabSize"&&(n=EV(e.editor.indentSize,"tabSize",1,100));let r=fv.insertSpaces;e.editor&&typeof e.editor.insertSpaces<"u"&&(r=e.editor.insertSpaces==="false"?!1:!!e.editor.insertSpaces);let s=O9o,l=e.eol;l===`\r
`?s=2:l===`
`&&(s=1);let c=fv.trimAutoWhitespace;e.editor&&typeof e.editor.trimAutoWhitespace<"u"&&(c=e.editor.trimAutoWhitespace==="false"?!1:!!e.editor.trimAutoWhitespace);let u=fv.detectIndentation;e.editor&&typeof e.editor.detectIndentation<"u"&&(u=e.editor.detectIndentation==="false"?!1:!!e.editor.detectIndentation);let p=fv.largeFileOptimizations;e.editor&&typeof e.editor.largeFileOptimizations<"u"&&(p=e.editor.largeFileOptimizations==="false"?!1:!!e.editor.largeFileOptimizations);let h=fv.bracketPairColorizationOptions;if(e.editor?.bracketPairColorization&&typeof e.editor.bracketPairColorization=="object"){let g=e.editor.bracketPairColorization;h={enabled:!!g.enabled,independentColorPoolPerBracketType:!!g.independentColorPoolPerBracketType}}return{isForSimpleWidget:t,tabSize:o,indentSize:n,insertSpaces:r,detectIndentation:u,defaultEOL:s,trimAutoWhitespace:c,largeFileOptimizations:p,bracketPairColorizationOptions:h}}_getEOL(e,t){if(e)return this._resourcePropertiesService.getEOL(e,t);let o=this._configurationService.getValue("files.eol",{overrideIdentifier:t});return o&&typeof o=="string"&&o!=="auto"?o:Po===3||Po===2?`
`:`\r
`}_shouldRestoreUndoStack(){let e=this._configurationService.getValue("files.restoreUndoStack");return typeof e=="boolean"?e:!0}getCreationOptions(e,t,o){let n=typeof e=="string"?e:e.languageId,r=this._modelCreationOptionsByLanguageAndResource[n+t];if(!r){let s=this._configurationService.getValue("editor",{overrideIdentifier:n,resource:t}),l=this._getEOL(t,n);r=R0._readModelOptions({editor:s,eol:l},o),this._modelCreationOptionsByLanguageAndResource[n+t]=r}return r}_updateModelOptions(e){let t=this._modelCreationOptionsByLanguageAndResource;this._modelCreationOptionsByLanguageAndResource=Object.create(null);let o=Object.keys(this._models);for(let n=0,r=o.length;n<r;n++){let s=o[n],l=this._models[s],c=l.model.getLanguageId(),u=l.model.uri;if(e&&!e.affectsConfiguration("editor",{overrideIdentifier:c,resource:u})&&!e.affectsConfiguration("files.eol",{overrideIdentifier:c,resource:u}))continue;let p=t[c+u],h=this.getCreationOptions(c,u,l.model.isForSimpleWidget);R0._setModelOptionsForModel(l.model,h,p)}}static _setModelOptionsForModel(e,t,o){o&&o.defaultEOL!==t.defaultEOL&&e.getLineCount()===1&&e.setEOL(t.defaultEOL===1?0:1),!(o&&o.detectIndentation===t.detectIndentation&&o.insertSpaces===t.insertSpaces&&o.tabSize===t.tabSize&&o.indentSize===t.indentSize&&o.trimAutoWhitespace===t.trimAutoWhitespace&&eo(o.bracketPairColorizationOptions,t.bracketPairColorizationOptions))&&(t.detectIndentation?(e.detectIndentation(t.insertSpaces,t.tabSize),e.updateOptions({trimAutoWhitespace:t.trimAutoWhitespace,bracketColorizationOptions:t.bracketPairColorizationOptions})):e.updateOptions({insertSpaces:t.insertSpaces,tabSize:t.tabSize,indentSize:t.indentSize,trimAutoWhitespace:t.trimAutoWhitespace,bracketColorizationOptions:t.bracketPairColorizationOptions}))}_insertDisposedModel(e){this._disposedModels.set(vee(e.uri),e),this._disposedModelsHeapSize+=e.heapSize}_removeDisposedModel(e){let t=this._disposedModels.get(vee(e));return t&&(this._disposedModelsHeapSize-=t.heapSize),this._disposedModels.delete(vee(e)),t}_ensureDisposedModelsHeapSize(e){if(this._disposedModelsHeapSize>e){let t=[];for(this._disposedModels.forEach(o=>{o.sharesUndoRedoStack||t.push(o)}),t.sort((o,n)=>o.time-n.time);t.length>0&&this._disposedModelsHeapSize>e;){let o=t.shift();this._removeDisposedModel(o.uri),o.initialUndoRedoSnapshot!==null&&this._undoRedoService.restoreSnapshot(o.initialUndoRedoSnapshot)}}}_createModelData(e,t,o,n){let r=this.getCreationOptions(t,o,n),s=this._instantiationService.createInstance(ip,e,t,r,o);if(o&&this._disposedModels.has(vee(o))){let u=this._removeDisposedModel(o),p=this._undoRedoService.getElements(o),h=this._getSHA1Computer(),g=h.canComputeSHA1(s)?h.computeSHA1(s)===u.sha1:!1;if(g||u.sharesUndoRedoStack){for(let f of p.past)nz(f)&&f.matchesResource(o)&&f.setModel(s);for(let f of p.future)nz(f)&&f.matchesResource(o)&&f.setModel(s);this._undoRedoService.setElementsValidFlag(o,!0,f=>nz(f)&&f.matchesResource(o)),g&&(s._overwriteVersionId(u.versionId),s._overwriteAlternativeVersionId(u.alternativeVersionId),s._overwriteInitialUndoRedoSnapshot(u.initialUndoRedoSnapshot))}else u.initialUndoRedoSnapshot!==null&&this._undoRedoService.restoreSnapshot(u.initialUndoRedoSnapshot)}let l=vee(s.uri);if(this._models[l])throw new Error("ModelService: Cannot add model because it already exists!");let c=new xCi(s,u=>this._onWillDispose(u),(u,p)=>this._onDidChangeLanguage(u,p));return this._models[l]=c,c}updateModel(e,t,o=Wc.unknown({name:"updateModel"})){let n=this.getCreationOptions(e.getLanguageId(),e.uri,e.isForSimpleWidget),{textBuffer:r,disposable:s}=hz(t,n.defaultEOL);if(e.equalsTextBuffer(r)){s.dispose();return}e.pushStackElement(),e.pushEOL(r.getEOL()===`\r
`?1:0),e.pushEditOperations([],R0._computeEdits(e,r),()=>[],void 0,o),e.pushStackElement(),s.dispose()}static _commonPrefix(e,t,o,n,r,s){let l=Math.min(t,r),c=0;for(let u=0;u<l&&e.getLineContent(o+u)===n.getLineContent(s+u);u++)c++;return c}static _commonSuffix(e,t,o,n,r,s){let l=Math.min(t,r),c=0;for(let u=0;u<l&&e.getLineContent(o+t-u)===n.getLineContent(s+r-u);u++)c++;return c}static _computeEdits(e,t){let o=e.getLineCount(),n=t.getLineCount(),r=this._commonPrefix(e,o,1,t,n,1);if(o===n&&r===o)return[];let s=this._commonSuffix(e,o-r,r,t,n-r,r),l,c;return s>0?(l=new z(r+1,1,o-s+1,1),c=new z(r+1,1,n-s+1,1)):r>0?(l=new z(r,e.getLineMaxColumn(r),o,e.getLineMaxColumn(o)),c=new z(r,1+t.getLineLength(r),n,1+t.getLineLength(n))):(l=new z(1,1,o,e.getLineMaxColumn(o)),c=new z(1,1,n,1+t.getLineLength(n))),[Hn.replaceMove(l,t.getValueInRange(c,0))]}createModel(e,t,o,n=!1){let r;return t?r=this._createModelData(e,t,o,n):r=this._createModelData(e,$r,o,n),this._onModelAdded.fire(r.model),r.model}destroyModel(e){let t=this._models[vee(e)];t&&t.model.dispose()}getModels(){let e=[],t=Object.keys(this._models);for(let o=0,n=t.length;o<n;o++){let r=t[o];e.push(this._models[r].model)}return e}getModel(e){let t=vee(e),o=this._models[t];return o?o.model:null}_schemaShouldMaintainUndoRedoElements(e){return e.scheme===Q.file||e.scheme===Q.vscodeRemote||e.scheme===Q.vscodeUserData||e.scheme===Q.vscodeNotebookCell||e.scheme==="fake-fs"}_onWillDispose(e){let t=vee(e.uri),o=this._models[t],n=this._undoRedoService.getUriComparisonKey(e.uri)!==e.uri.toString(),r=!1,s=0;if(n||this._shouldRestoreUndoStack()&&this._schemaShouldMaintainUndoRedoElements(e.uri)){let u=this._undoRedoService.getElements(e.uri);if(u.past.length>0||u.future.length>0){for(let p of u.past)nz(p)&&p.matchesResource(e.uri)&&(r=!0,s+=p.heapSize(e.uri),p.setModel(e.uri));for(let p of u.future)nz(p)&&p.matchesResource(e.uri)&&(r=!0,s+=p.heapSize(e.uri),p.setModel(e.uri))}}let l=R0.MAX_MEMORY_FOR_CLOSED_FILES_UNDO_STACK,c=this._getSHA1Computer();if(r)if(!n&&(s>l||!c.canComputeSHA1(e))){let u=o.model.getInitialUndoRedoSnapshot();u!==null&&this._undoRedoService.restoreSnapshot(u)}else this._ensureDisposedModelsHeapSize(l-s),this._undoRedoService.setElementsValidFlag(e.uri,!1,u=>nz(u)&&u.matchesResource(e.uri)),this._insertDisposedModel(new kCi(e.uri,o.model.getInitialUndoRedoSnapshot(),Date.now(),n,s,c.computeSHA1(e),e.getVersionId(),e.getAlternativeVersionId()));else if(!n){let u=o.model.getInitialUndoRedoSnapshot();u!==null&&this._undoRedoService.restoreSnapshot(u)}delete this._models[t],o.dispose(),delete this._modelCreationOptionsByLanguageAndResource[e.getLanguageId()+e.uri],this._onModelRemoved.fire(e)}_onDidChangeLanguage(e,t){let o=t.oldLanguage,n=e.getLanguageId(),r=this.getCreationOptions(o,e.uri,e.isForSimpleWidget),s=this.getCreationOptions(n,e.uri,e.isForSimpleWidget);R0._setModelOptionsForModel(e,s,r),this._onModelModeChanged.fire({model:e,oldLanguageId:o})}_getSHA1Computer(){return new ume}};R0=I([m(0,B),m(1,KL),m(2,Ml),m(3,F)],R0);var ume=class a{static{this.MAX_MODEL_SIZE=10*1024*1024}canComputeSHA1(i){return i.getValueLength()<=a.MAX_MODEL_SIZE}computeSHA1(i){let e=new Yy,t=i.createSnapshot(),o;for(;o=t.read();)e.update(o);return e.digest()}};var IZe=class extends R0{constructor(e,t,o,n,r){super(e,t,o,r);this._pathService=n}_schemaShouldMaintainUndoRedoElements(e){return super._schemaShouldMaintainUndoRedoElements(e)||e.scheme===this._pathService.defaultUriScheme}};IZe=I([m(0,B),m(1,KL),m(2,Ml),m(3,An),m(4,F)],IZe);Ee(Tt,IZe,1);var yZe=class extends x{constructor(e,t,o){super();this._instantiationService=e;this._extensionService=t;this._logService=o;this._extensionHostIsReady=!1;this._onWillExecuteCommand=this._register(new E);this.onWillExecuteCommand=this._onWillExecuteCommand.event;this._onDidExecuteCommand=this._register(new E);this.onDidExecuteCommand=this._onDidExecuteCommand.event;this._extensionService.whenInstalledExtensionsRegistered().then(n=>this._extensionHostIsReady=n),this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=oae([this._extensionService.activateByEvent("*"),Li(3e4)])),jGi(this._starActivation)}async executeCommand(e,...t){this._logService.trace("CommandService#executeCommand",e);let o=`onCommand:${e}`;return $e.getCommand(e)?this._extensionService.activationEventIsDone(o)?this._tryExecuteCommand(e,t):this._extensionHostIsReady?(await this._extensionService.activateByEvent(o),this._tryExecuteCommand(e,t)):(this._extensionService.activateByEvent(o),this._tryExecuteCommand(e,t)):(await Promise.all([this._extensionService.activateByEvent(o),oae([this._activateStar(),U.toPromise(U.filter($e.onDidRegisterCommand,r=>r===e))])]),this._tryExecuteCommand(e,t))}_tryExecuteCommand(e,t){let o=$e.getCommand(e);if(!o)return Promise.reject(new Error(`command '${e}' not found`));try{this._onWillExecuteCommand.fire({commandId:e,args:t});let n=this._instantiationService.invokeFunction(o.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),Promise.resolve(n)}catch(n){return Promise.reject(n)}}dispose(){super.dispose(),this._starActivation?.cancel()}};yZe=I([m(0,F),m(1,lt),m(2,se)],yZe);Ee(ge,yZe,1);var ECi={};function _y(a,i){let e=ECi[a];e||(ECi[a]=e=[]),e.push(i)}function TCi(a,i){for(let e of a)if(i.textMateRules.push(e),!e.scope){let t=e.settings;if(!t)e.settings={};else for(let o in t){let n=o,r=ECi[n];if(r){let s=t[n];if(typeof s=="string"){let l=We.fromHex(s);for(let c of r)i.colors[c]=l}}n!=="foreground"&&n!=="background"&&n!=="fontStyle"&&delete t[n]}}}_y("background",Ho);_y("foreground",Id);_y("selection",Sv);_y("inactiveSelection",k5i);_y("selectionHighlightColor",Aye);_y("findMatchHighlight",rS);_y("currentFindMatchHighlight",lle);_y("hoverHighlight",Pvt);_y("wordHighlight","editor.wordHighlightBackground");_y("wordHighlightStrong","editor.wordHighlightStrongBackground");_y("findRangeHighlight",_5i);_y("findMatchHighlight","peekViewResult.matchHighlightBackground");_y("referenceHighlight","peekViewEditor.matchHighlightBackground");_y("lineHighlight",bwe);_y("rangeHighlight",p3i);_y("caret",B7);_y("invisibles",Swe);_y("guide",$bt);_y("activeGuide",jbt);var F9o=["ansiBlack","ansiRed","ansiGreen","ansiYellow","ansiBlue","ansiMagenta","ansiCyan","ansiWhite","ansiBrightBlack","ansiBrightRed","ansiBrightGreen","ansiBrightYellow","ansiBrightBlue","ansiBrightMagenta","ansiBrightCyan","ansiBrightWhite"];for(let a of F9o)_y(a,"terminal."+a);function wdo(a){return W9o(a,null,null)}function W9o(a,i,e){let t=a.length,o=0,n=1,r=0;t>0&&a.charCodeAt(0)===65279&&(o=1);function s(Oe){if(e===null)o=o+Oe;else for(;Oe>0;)a.charCodeAt(o)===10?(o++,n++,r=0):(o++,r++),Oe--}function l(Oe){e===null?o=Oe:s(Oe-o)}function c(){for(;o<t;){let Oe=a.charCodeAt(o);if(Oe!==32&&Oe!==9&&Oe!==13&&Oe!==10)break;s(1)}}function u(Oe){return a.substr(o,Oe.length)===Oe?(s(Oe.length),!0):!1}function p(Oe){let pt=a.indexOf(Oe,o);l(pt!==-1?pt+Oe.length:t)}function h(Oe){let pt=a.indexOf(Oe,o);if(pt!==-1){let et=a.substring(o,pt);return l(pt+Oe.length),et}else{let et=a.substr(o);return l(t),et}}let g=0,f=null,v=[],b=[],S=null;function y(Oe,pt){v.push(g),b.push(f),g=Oe,f=pt}function w(){if(v.length===0)return k("illegal state stack");g=v.pop(),f=b.pop()}function k(Oe){throw new Error("Near offset "+o+": "+Oe+" ~~~"+a.substr(o,50)+"~~~")}let T={enterDict:function(){if(S===null)return k("missing <key>");let Oe={};e!==null&&(Oe[e]={filename:i,line:n,char:r}),f[S]=Oe,S=null,y(1,Oe)},enterArray:function(){if(S===null)return k("missing <key>");let Oe=[];f[S]=Oe,S=null,y(2,Oe)}},P={enterDict:function(){let Oe={};e!==null&&(Oe[e]={filename:i,line:n,char:r}),f.push(Oe),y(1,Oe)},enterArray:function(){let Oe=[];f.push(Oe),y(2,Oe)}};function O(){g===1?T.enterDict():g===2?P.enterDict():(f={},e!==null&&(f[e]={filename:i,line:n,char:r}),y(1,f))}function V(){if(g===1)w();else return k("unexpected </dict>")}function H(){g===1?T.enterArray():g===2?P.enterArray():(f=[],y(2,f))}function G(){if(g===1)return k("unexpected </array>");if(g===2)w();else return k("unexpected </array>")}function $(Oe){if(g===1){if(S!==null)return k("too many <key>");S=Oe}else return k("unexpected <key>")}function J(Oe){if(g===1){if(S===null)return k("missing <key>");f[S]=Oe,S=null}else g===2?f.push(Oe):f=Oe}function ae(Oe){if(isNaN(Oe))return k("cannot parse float");if(g===1){if(S===null)return k("missing <key>");f[S]=Oe,S=null}else g===2?f.push(Oe):f=Oe}function he(Oe){if(isNaN(Oe))return k("cannot parse integer");if(g===1){if(S===null)return k("missing <key>");f[S]=Oe,S=null}else g===2?f.push(Oe):f=Oe}function oe(Oe){if(g===1){if(S===null)return k("missing <key>");f[S]=Oe,S=null}else g===2?f.push(Oe):f=Oe}function de(Oe){if(g===1){if(S===null)return k("missing <key>");f[S]=Oe,S=null}else g===2?f.push(Oe):f=Oe}function Ce(Oe){if(g===1){if(S===null)return k("missing <key>");f[S]=Oe,S=null}else g===2?f.push(Oe):f=Oe}function xe(Oe){return Oe.replace(/&#([0-9]+);/g,function(pt,et){return String.fromCodePoint(parseInt(et,10))}).replace(/&#x([0-9a-f]+);/g,function(pt,et){return String.fromCodePoint(parseInt(et,16))}).replace(/&amp;|&lt;|&gt;|&quot;|&apos;/g,function(pt){switch(pt){case"&amp;":return"&";case"&lt;":return"<";case"&gt;":return">";case"&quot;":return'"';case"&apos;":return"'"}return pt})}function ze(){let Oe=h(">"),pt=!1;return Oe.charCodeAt(Oe.length-1)===47&&(pt=!0,Oe=Oe.substring(0,Oe.length-1)),{name:Oe.trim(),isClosed:pt}}function De(Oe){if(Oe.isClosed)return"";let pt=h("</");return p(">"),xe(pt)}for(;o<t&&(c(),!(o>=t));){let Oe=a.charCodeAt(o);if(s(1),Oe!==60)return k("expected <");if(o>=t)return k("unexpected end of input");let pt=a.charCodeAt(o);if(pt===63){s(1),p("?>");continue}if(pt===33){if(s(1),u("--")){p("-->");continue}p(">");continue}if(pt===47){if(s(1),c(),u("plist")){p(">");continue}if(u("dict")){p(">"),V();continue}if(u("array")){p(">"),G();continue}return k("unexpected closed tag")}let et=ze();switch(et.name){case"dict":O(),et.isClosed&&V();continue;case"array":H(),et.isClosed&&G();continue;case"key":$(De(et));continue;case"string":J(De(et));continue;case"real":ae(parseFloat(De(et)));continue;case"integer":he(parseInt(De(et),10));continue;case"date":oe(new Date(De(et)));continue;case"data":de(De(et));continue;case"true":De(et),Ce(!0);continue;case"false":De(et),Ce(!1);continue}if(!/^plist/.test(et.name))return k("unexpected opened tag "+et.name)}return f}function _Ci(a,i,e){let t=V9o(a),o=t.next();for(;o!==null;){let l=0;if(o.length===2&&o.charAt(1)===":"){switch(o.charAt(0)){case"R":l=1;break;case"L":l=-1;break;default:console.log(`Unknown priority ${o} in scope selector`)}o=t.next()}let c=r();if(c&&e.push({matcher:c,priority:l}),o!==",")break;o=t.next()}function n(){if(o==="-"){o=t.next();let l=n();return l?c=>l(c)<0?0:-1:null}if(o==="("){o=t.next();let l=s();return o===")"&&(o=t.next()),l}if(Cdo(o)){let l=[];do l.push(o),o=t.next();while(Cdo(o));return c=>i(l,c)}return null}function r(){let l=n();if(!l)return null;let c=[];for(;l;)c.push(l),l=n();return u=>{let p=c[0](u);for(let h=1;p>=0&&h<c.length;h++)p=Math.min(p,c[h](u));return p}}function s(){let l=r();if(!l)return null;let c=[];for(;l&&(c.push(l),o==="|"||o===",");){do o=t.next();while(o==="|"||o===",");l=r()}return u=>{let p=c[0](u);for(let h=1;h<c.length;h++)p=Math.max(p,c[h](u));return p}}}function Cdo(a){return!!a&&!!a.match(/[\w\.:]+/)}function V9o(a){let i=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,e=i.exec(a);return{next:()=>{if(!e)return null;let t=e[0];return e=i.exec(a),t}}}var B9o=ne.as(ile.ColorContribution),EVt=ETt(),xdo={comments:["comment","punctuation.definition.comment"],strings:["string","meta.embedded.assembly"],keywords:["keyword - keyword.operator","keyword.control","storage","storage.type"],numbers:["constant.numeric"],types:["entity.name.type","entity.name.class","support.type","support.class"],functions:["entity.name.function","support.function"],variables:["variable","entity.name.variable"]},B3=class a{constructor(i,e,t){this.themeTokenColors=[];this.customTokenColors=[];this.colorMap={};this.customColorMap={};this.semanticTokenRules=[];this.customSemanticTokenRules=[];this.textMateThemingRules=void 0;this.tokenColorIndex=void 0;this.tokenFontIndex=void 0;this.id=i,this.label=e,this.settingsId=t,this.isLoaded=!1}static{this.STORAGE_KEY="colorThemeData"}get semanticHighlighting(){return this.customSemanticHighlighting!==void 0?this.customSemanticHighlighting:this.customSemanticHighlightingDeprecated!==void 0?this.customSemanticHighlightingDeprecated:!!this.themeSemanticHighlighting}get tokenColors(){if(!this.textMateThemingRules){let n=function(r){if(r.scope&&r.settings){r.scope==="token.info-token"&&(o=!0);let s=r.settings;i.push({scope:r.scope,settings:{foreground:URe(s.foreground),background:URe(s.background),fontStyle:s.fontStyle,fontSize:s.fontSize,fontFamily:s.fontFamily,lineHeight:s.lineHeight}})}},i=[],e=this.getColor(Id)||this.getDefault(Id),t=this.getColor(Ho)||this.getDefault(Ho);i.push({settings:{foreground:URe(e),background:URe(t)}});let o=!1;this.themeTokenColors.forEach(n),this.customTokenColors.forEach(n),o||U9o[this.type].forEach(n),this.textMateThemingRules=i}return this.textMateThemingRules}getColor(i,e){let t=this.customColorMap[i];if(t instanceof We)return t;if(t===void 0){let o=this.colorMap[i];if(o!==void 0)return o}if(e!==!1)return this.getDefault(i)}getTokenStyle(i,e,t,o=!0,n={}){let r={foreground:void 0,bold:void 0,underline:void 0,strikethrough:void 0,italic:void 0},s={foreground:-1,bold:-1,underline:-1,strikethrough:-1,italic:-1,fontFamily:-1,fontSize:-1,lineHeight:-1};function l(p,h,g){h.foreground&&s.foreground<=p&&(s.foreground=p,r.foreground=h.foreground,n.foreground=g);for(let f of["bold","underline","strikethrough","italic"]){let v=f,b=h[v];b!==void 0&&s[v]<=p&&(s[v]=p,r[v]=b,n[v]=g)}}function c(p){let h=p.selector.match(i,e,t);h>=0&&l(h,p.style,p)}this.semanticTokenRules.forEach(c),this.customSemanticTokenRules.forEach(c);let u=!1;for(let p in s){let h=p;s[h]===-1?u=!0:s[h]=Number.MAX_VALUE}if(u)for(let p of EVt.getTokenStylingDefaultRules()){let h=p.selector.match(i,e,t);if(h>=0){let g;if(p.defaults.scopesToProbe&&(g=this.resolveScopes(p.defaults.scopesToProbe),g&&l(h,g,p.defaults.scopesToProbe)),!g&&o!==!1){let f=p.defaults[this.type];g=this.resolveTokenStyleValue(f),g&&l(h,g,f)}}}return $P.fromData(r)}resolveTokenStyleValue(i){if(i!==void 0){if(typeof i=="string"){let{type:e,modifiers:t,language:o}=xTt(i,"");return this.getTokenStyle(e,t,o)}else if(typeof i=="object")return i}}getTokenColorIndex(){if(!this.tokenColorIndex){let i=new DCi;this.tokenColors.forEach(e=>{i.add(e.settings.foreground),i.add(e.settings.background)}),this.semanticTokenRules.forEach(e=>i.add(e.style.foreground)),EVt.getTokenStylingDefaultRules().forEach(e=>{let t=e.defaults[this.type];t&&typeof t=="object"&&i.add(t.foreground)}),this.customSemanticTokenRules.forEach(e=>i.add(e.style.foreground)),this.tokenColorIndex=i}return this.tokenColorIndex}getTokenFontIndex(){if(!this.tokenFontIndex){let i=new LCi;this.tokenColors.forEach(e=>i.add(e.settings.fontFamily,e.settings.fontSize,e.settings.lineHeight)),this.tokenFontIndex=i}return this.tokenFontIndex}get tokenColorMap(){return this.getTokenColorIndex().asArray()}get tokenFontMap(){return this.getTokenFontIndex().asArray()}getTokenStyleMetadata(i,e,t,o=!0,n={}){let{type:r,language:s}=xTt(i,t),l=this.getTokenStyle(r,e,s,o,n);if(l)return{foreground:this.getTokenColorIndex().get(l.foreground),bold:l.bold,underline:l.underline,strikethrough:l.strikethrough,italic:l.italic}}getTokenStylingRuleScope(i){if(this.customSemanticTokenRules.indexOf(i)!==-1)return"setting";if(this.semanticTokenRules.indexOf(i)!==-1)return"theme"}getDefault(i){return B9o.resolveDefaultColor(i,this)}resolveScopes(i,e){this.themeTokenScopeMatchers||(this.themeTokenScopeMatchers=this.themeTokenColors.map(_do)),this.customTokenScopeMatchers||(this.customTokenScopeMatchers=this.customTokenColors.map(_do));for(let t of i){let u=function(p,h){for(let g=0;g<p.length;g++){let f=p[g](t);if(f>=0){let v=h[g],b=h[g].settings;f>=r&&b.foreground&&(o=b.foreground,r=f,c=v),f>=s&&Fe(b.fontStyle)&&(n=b.fontStyle,s=f,l=v)}}},o,n,r=-1,s=-1,l,c;if(u(this.themeTokenScopeMatchers,this.themeTokenColors),u(this.customTokenScopeMatchers,this.customTokenColors),o!==void 0||n!==void 0)return e&&(e.foreground=c,e.bold=e.italic=e.underline=e.strikethrough=l,e.scope=t),$P.fromSettings(o,n)}}defines(i){let e=this.customColorMap[i];return e instanceof We?!0:e===void 0&&this.colorMap.hasOwnProperty(i)}setCustomizations(i){this.setCustomColors(i.colorCustomizations),this.setCustomTokenColors(i.tokenColorCustomizations),this.setCustomSemanticTokenColors(i.semanticTokenColorCustomizations)}setCustomColors(i){this.customColorMap={},this.overwriteCustomColors(i);let e=this.getThemeSpecificColors(i);xi(e)&&this.overwriteCustomColors(e),this.tokenColorIndex=void 0,this.tokenFontIndex=void 0,this.textMateThemingRules=void 0,this.customTokenScopeMatchers=void 0}overwriteCustomColors(i){for(let e in i){let t=i[e];t===Nje?this.customColorMap[e]=Nje:typeof t=="string"&&(this.customColorMap[e]=We.fromHex(t))}}setCustomTokenColors(i){this.customTokenColors=[],this.customSemanticHighlightingDeprecated=void 0,this.addCustomTokenColors(i);let e=this.getThemeSpecificColors(i);xi(e)&&this.addCustomTokenColors(e),this.tokenColorIndex=void 0,this.tokenFontIndex=void 0,this.textMateThemingRules=void 0,this.customTokenScopeMatchers=void 0}setCustomSemanticTokenColors(i){if(this.customSemanticTokenRules=[],this.customSemanticHighlighting=void 0,i){this.customSemanticHighlighting=i.enabled,i.rules&&this.readSemanticTokenRules(i.rules);let e=this.getThemeSpecificColors(i);xi(e)&&(e.enabled!==void 0&&(this.customSemanticHighlighting=e.enabled),e.rules&&this.readSemanticTokenRules(e.rules))}this.tokenColorIndex=void 0,this.tokenFontIndex=void 0,this.textMateThemingRules=void 0}isThemeScope(i){return i.charAt(0)===jZi&&i.charAt(i.length-1)===QZi}isThemeScopeMatch(i){let e=i.charAt(0),t=i.charAt(i.length-1),o=i.slice(0,-1),n=i.slice(1,-1),r=i.slice(1);return i===this.settingsId||this.settingsId.includes(n)&&e===p6e&&t===p6e||this.settingsId.startsWith(o)&&t===p6e||this.settingsId.endsWith(r)&&e===p6e}getThemeSpecificColors(i){let e;for(let t in i){let o=i[t];if(this.isThemeScope(t)&&o instanceof Object&&!Array.isArray(o)){let n=t.match(YZi)||[];for(let r of n){let s=r.substring(1,r.length-1);if(this.isThemeScopeMatch(s)){e||(e={});let l=o;for(let c in l){let u=e[c],p=l[c];Array.isArray(u)&&Array.isArray(p)?e[c]=u.concat(p):p&&(e[c]=p)}}}}}return e}readSemanticTokenRules(i){for(let e in i)if(!this.isThemeScope(e))try{let t=Ldo(e,i[e]);t&&this.customSemanticTokenRules.push(t)}catch{}}addCustomTokenColors(i){for(let e in xdo){let t=e,o=i[t];if(o){let n=typeof o=="string"?{foreground:o}:o,r=xdo[t];for(let s of r)this.customTokenColors.push({scope:s,settings:n})}}if(Array.isArray(i.textMateRules))for(let e of i.textMateRules)e.scope&&e.settings&&this.customTokenColors.push(e);i.semanticHighlighting!==void 0&&(this.customSemanticHighlightingDeprecated=i.semanticHighlighting)}ensureLoaded(i){return this.isLoaded?Promise.resolve(void 0):this.load(i)}reload(i){return this.load(i)}load(i){if(!this.location)return Promise.resolve(void 0);this.themeTokenColors=[],this.clearCaches();let e={colors:{},textMateRules:[],semanticTokenRules:[],semanticHighlighting:!1};return Ddo(i,this.location,e).then(t=>{this.isLoaded=!0,this.semanticTokenRules=e.semanticTokenRules,this.colorMap=e.colors,this.themeTokenColors=e.textMateRules,this.themeSemanticHighlighting=e.semanticHighlighting})}clearCaches(){this.tokenColorIndex=void 0,this.tokenFontIndex=void 0,this.textMateThemingRules=void 0,this.themeTokenScopeMatchers=void 0,this.customTokenScopeMatchers=void 0}toStorage(i){let e={};for(let o in this.colorMap)e[o]=We.Format.CSS.formatHexA(this.colorMap[o],!0);let t=JSON.stringify({id:this.id,label:this.label,settingsId:this.settingsId,themeTokenColors:this.themeTokenColors.map(o=>({settings:o.settings,scope:o.scope})),semanticTokenRules:this.semanticTokenRules.map(Yke.toJSONObject),extensionData:nT.toJSONObject(this.extensionData),themeSemanticHighlighting:this.themeSemanticHighlighting,colorMap:e,watch:this.watch});i.store(a.STORAGE_KEY,t,0,0)}get themeTypeSelector(){return this.classNames[0]}get classNames(){return this.id.split(" ")}get type(){switch(this.themeTypeSelector){case"vs":return"light";case"hc-black":return"hcDark";case"hc-light":return"hcLight";default:return"dark"}}static createUnloadedThemeForThemeType(i,e){return a.createUnloadedTheme(Cj(i),e)}static createUnloadedTheme(i,e){let t=new a(i,"","__"+i);if(t.isLoaded=!1,t.themeTokenColors=[],t.watch=!1,e)for(let o in e)t.colorMap[o]=We.fromHex(e[o]);return t}static createLoadedEmptyTheme(i,e){let t=new a(i,"",e);return t.isLoaded=!0,t.themeTokenColors=[],t.watch=!1,t}static fromStorageData(i){let e=i.get(a.STORAGE_KEY,0);if(e)try{let t=JSON.parse(e),o=new a("","","");for(let n in t)switch(n){case"colorMap":{let r=t[n];for(let s in r)o.colorMap[s]=We.fromHex(r[s]);break}case"themeTokenColors":case"id":case"label":case"settingsId":case"watch":case"themeSemanticHighlighting":o[n]=t[n];break;case"semanticTokenRules":{let r=t[n];if(Array.isArray(r))for(let s of r){let l=Yke.fromJSONObject(EVt,s);l&&o.semanticTokenRules.push(l)}break}case"location":break;case"extensionData":o.extensionData=nT.fromJSONObject(t.extensionData);break}return!o.id||!o.settingsId?void 0:o}catch{return}}static fromExtensionTheme(i,e,t){let o=i.uiTheme||"vs-dark",n=H9o(t.extensionId,i.path),r=`${o} ${n}`,s=i.label||jo(i.path),l=i.id||s,c=new a(r,s,l);return c.description=i.description,c.watch=i._watch===!0,c.location=e,c.extensionData=t,c.isLoaded=!1,c}};function H9o(a,i){i.startsWith("./")&&(i=i.substr(2));let e=`${a}-${i}`;return e=e.replace(/[^_a-zA-Z0-9-]/g,"-"),e.charAt(0).match(/[0-9-]/)&&(e="_"+e),e}async function Ddo(a,i,e){if(es(i)===".json"){let t=await a.readExtensionResource(i),o=[],n=jr(t,o);if(o.length>0)return Promise.reject(new Error(d(18054,null,o.map(c=>SF(c.error)).join(", "))));if(pk(n)!=="object")return Promise.reject(new Error(d(18055,null)));if(n.include&&await Ddo(a,Ge(ci(i),n.include),e),Array.isArray(n.settings))return TCi(n.settings,e),null;e.semanticHighlighting=e.semanticHighlighting||n.semanticHighlighting;let r=n.colors;if(r){if(typeof r!="object")return Promise.reject(new Error(d(18056,null,i.toString())));for(let c in r){let u=r[c];u===Nje?delete e.colors[c]:typeof u=="string"&&(e.colors[c]=We.fromHex(r[c]))}}let s=n.tokenColors;if(s)if(Array.isArray(s))e.textMateRules.push(...s);else if(typeof s=="string")await kdo(a,Ge(ci(i),s),e);else return Promise.reject(new Error(d(18058,null,i.toString())));let l=n.semanticTokenColors;if(l&&typeof l=="object")for(let c in l)try{let u=Ldo(c,l[c]);u&&e.semanticTokenRules.push(u)}catch{return Promise.reject(new Error(d(18057,null,i.toString())))}}else return kdo(a,i,e)}function kdo(a,i,e){return a.readExtensionResource(i).then(t=>{try{let n=wdo(t).settings;return Array.isArray(n)?(TCi(n,e),Promise.resolve(null)):Promise.reject(new Error(d(18059,null)))}catch(o){return Promise.reject(new Error(d(18053,null,o.message)))}},t=>Promise.reject(new Error(d(18052,null,i.toString(),t.message))))}var U9o={light:[{scope:"token.info-token",settings:{foreground:"#316bcd"}},{scope:"token.warn-token",settings:{foreground:"#cd9731"}},{scope:"token.error-token",settings:{foreground:"#cd3131"}},{scope:"token.debug-token",settings:{foreground:"#800080"}}],dark:[{scope:"token.info-token",settings:{foreground:"#6796e6"}},{scope:"token.warn-token",settings:{foreground:"#cd9731"}},{scope:"token.error-token",settings:{foreground:"#f44747"}},{scope:"token.debug-token",settings:{foreground:"#b267e6"}}],hcLight:[{scope:"token.info-token",settings:{foreground:"#316bcd"}},{scope:"token.warn-token",settings:{foreground:"#cd9731"}},{scope:"token.error-token",settings:{foreground:"#cd3131"}},{scope:"token.debug-token",settings:{foreground:"#800080"}}],hcDark:[{scope:"token.info-token",settings:{foreground:"#6796e6"}},{scope:"token.warn-token",settings:{foreground:"#008000"}},{scope:"token.error-token",settings:{foreground:"#FF0000"}},{scope:"token.debug-token",settings:{foreground:"#b267e6"}}]},Edo=a=>-1;function Tdo(a,i){if(i.length<a.length)return-1;let e;return a.every(o=>{for(let n=i.length-1;n>=0;n--)if(z9o(i[n],o))return e=(n+1)*65536+o.length,!0;return!1})&&e!==void 0?e:-1}function z9o(a,i){if(!a)return!1;if(a===i)return!0;let e=i.length;return a.length>e&&a.substr(0,e)===i&&a[e]==="."}function _do(a){let i=a.scope;if(!i||!a.settings)return Edo;let e=[];if(Array.isArray(i))for(let t of i)_Ci(t,Tdo,e);else _Ci(i,Tdo,e);return e.length===0?Edo:t=>{let o=e[0].matcher(t);for(let n=1;n<e.length;n++)o=Math.max(o,e[n].matcher(t));return o}}function Ldo(a,i){let e=EVt.parseTokenSelector(a),t;if(typeof i=="string"?t=$P.fromSettings(i,void 0):K9o(i)&&(t=$P.fromSettings(i.foreground,i.fontStyle,i.bold,i.underline,i.strikethrough,i.italic)),t)return{selector:e,style:t}}function K9o(a){return a&&(Fe(a.foreground)||Fe(a.fontStyle)||Wa(a.italic)||Wa(a.underline)||Wa(a.strikethrough)||Wa(a.bold))}function TVt(a,i,e,t){let o=0;o|=e<<0;let n={},r=a.resolveScopes([i],n);if(i.length>0){let u=R8i(i[i.length-1]);o|=u<<8}let s=n.foreground?.settings.fontStyle||n.bold?.settings.fontStyle;s?.includes("italic")&&(o|=2049),s?.includes("bold")&&(o|=4098),s?.includes("underline")&&(o|=8196),s?.includes("strikethrough")&&(o|=16392);let l=r?.foreground,c=l!==void 0?a.getTokenColorIndex().get(l):1;return o|=c<<15,t&&(o|=1024),o}var DCi=class{constructor(){this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null)}add(i){if(i=URe(i),i===void 0)return 0;let e=this._color2id[i];return e||(e=++this._lastColorId,this._color2id[i]=e,this._id2color[e]=i,e)}get(i){if(i=URe(i),i===void 0)return 0;let e=this._color2id[i];return e||(console.log(`Color ${i} not in index.`),0)}asArray(){return this._id2color.slice(0)}},LCi=class{constructor(){this._lastFontId=0,this._id2font=[],this._font2id=new Map}add(i,e,t){let o={fontFamily:i,fontSizeMultiplier:e,lineHeightMultiplier:t},n=this._font2id.get(o);return n||(n=++this._lastFontId,this._font2id.set(o,n),this._id2font[n]=o,n)}get(i){let e=this._font2id.get(i);return e||0}asArray(){return this._id2font.slice(0)}};function URe(a){if(!a)return;typeof a!="string"&&(a=We.Format.CSS.formatHexA(a,!0));let i=a.length;if(a.charCodeAt(0)!==35||i!==4&&i!==5&&i!==7&&i!==9)return;let e=[35];for(let t=1;t<i;t++){let o=G9o(a.charCodeAt(t));if(!o)return;e.push(o),(i===4||i===5)&&e.push(o)}return e.length===9&&e[7]===70&&e[8]===70&&(e.length=7),String.fromCharCode(...e)}function G9o(a){return a>=48&&a<=57||a>=65&&a<=70?a:a>=97&&a<=102?a-97+65:0}var q9o="vscode://schemas/icon-theme",$9o={type:"object",allowComments:!0,allowTrailingCommas:!0,definitions:{folderExpanded:{type:"string",description:d(18082,null)},folder:{type:"string",description:d(18081,null)},file:{type:"string",description:d(18076,null)},rootFolder:{type:"string",description:d(18106,null)},rootFolderExpanded:{type:"string",description:d(18107,null)},rootFolderNames:{type:"object",description:d(18109,null),additionalProperties:{type:"string",description:d(18083,null)}},rootFolderNamesExpanded:{type:"object",description:d(18110,null),additionalProperties:{type:"string",description:d(18108,null)}},folderNames:{type:"object",description:d(18085,null),additionalProperties:{type:"string",description:d(18083,null)}},folderNamesExpanded:{type:"object",description:d(18086,null),additionalProperties:{type:"string",description:d(18084,null)}},fileExtensions:{type:"object",description:d(18078,null),additionalProperties:{type:"string",description:d(18077,null)}},fileNames:{type:"object",description:d(18080,null),additionalProperties:{type:"string",description:d(18079,null)}},languageIds:{type:"object",description:d(18104,null),additionalProperties:{type:"string",description:d(18103,null)}},associations:{type:"object",properties:{folderExpanded:{$ref:"#/definitions/folderExpanded"},folder:{$ref:"#/definitions/folder"},file:{$ref:"#/definitions/file"},folderNames:{$ref:"#/definitions/folderNames"},folderNamesExpanded:{$ref:"#/definitions/folderNamesExpanded"},rootFolder:{$ref:"#/definitions/rootFolder"},rootFolderExpanded:{$ref:"#/definitions/rootFolderExpanded"},rootFolderNames:{$ref:"#/definitions/rootFolderNames"},rootFolderNamesExpanded:{$ref:"#/definitions/rootFolderNamesExpanded"},fileExtensions:{$ref:"#/definitions/fileExtensions"},fileNames:{$ref:"#/definitions/fileNames"},languageIds:{$ref:"#/definitions/languageIds"}}}},properties:{fonts:{type:"array",description:d(18095,null),items:{type:"object",properties:{id:{type:"string",description:d(18102,null),pattern:mY.source,patternErrorMessage:PCe},src:{type:"array",description:d(18112,null),items:{type:"object",properties:{path:{type:"string",description:d(18088,null)},format:{type:"string",description:d(18087,null),enum:["woff","woff2","truetype","opentype","embedded-opentype","svg"]}},required:["path","format"]}},weight:{type:"string",description:d(18091,null),pattern:MCe.source},style:{type:"string",description:d(18090,null),pattern:RCe.source},size:{type:"string",description:d(18089,null),pattern:S4e.source}},required:["id","src"]}},iconDefinitions:{type:"object",description:d(18100,null),additionalProperties:{type:"object",description:d(18099,null),properties:{iconPath:{type:"string",description:d(18101,null)},fontCharacter:{type:"string",description:d(18092,null)},fontColor:{type:"string",format:"color-hex",description:d(18093,null),pattern:$yt.source},fontSize:{type:"string",description:d(18096,null),pattern:S4e.source},fontId:{type:"string",description:d(18094,null),pattern:mY.source,patternErrorMessage:PCe}}}},folderExpanded:{$ref:"#/definitions/folderExpanded"},folder:{$ref:"#/definitions/folder"},file:{$ref:"#/definitions/file"},folderNames:{$ref:"#/definitions/folderNames"},folderNamesExpanded:{$ref:"#/definitions/folderNamesExpanded"},rootFolder:{$ref:"#/definitions/rootFolder"},rootFolderExpanded:{$ref:"#/definitions/rootFolderExpanded"},rootFolderNames:{$ref:"#/definitions/rootFolderNames"},rootFolderNamesExpanded:{$ref:"#/definitions/rootFolderNamesExpanded"},fileExtensions:{$ref:"#/definitions/fileExtensions"},fileNames:{$ref:"#/definitions/fileNames"},languageIds:{$ref:"#/definitions/languageIds"},light:{$ref:"#/definitions/associations",description:d(18105,null)},highContrast:{$ref:"#/definitions/associations",description:d(18098,null)},hidesExplorerArrows:{type:"boolean",description:d(18097,null)},showLanguageModeIcons:{type:"boolean",description:d(18111,null)}}};function Rdo(){ne.as(ma.JSONContribution).registerSchema(q9o,$9o)}var CH=class a{static{this.STORAGE_KEY="iconThemeData"}constructor(i,e,t){this.id=i,this.label=e,this.settingsId=t,this.isLoaded=!1,this.hasFileIcons=!1,this.hasFolderIcons=!1,this.hidesExplorerArrows=!1}ensureLoaded(i){return this.isLoaded?Promise.resolve(this.styleSheetContent):this.load(i)}reload(i){return this.load(i)}load(i){return i.load(this)}static fromExtensionTheme(i,e,t){let o=t.extensionId+"-"+i.id,n=i.label||jo(i.path),r=i.id,s=new a(o,n,r);return s.description=i.description,s.location=e,s.extensionData=t,s.watch=i._watch,s.isLoaded=!1,s}static{this._noIconTheme=null}static get noIconTheme(){let i=a._noIconTheme;return i||(i=a._noIconTheme=new a("","",null),i.hasFileIcons=!1,i.hasFolderIcons=!1,i.hidesExplorerArrows=!1,i.isLoaded=!0,i.extensionData=void 0,i.watch=!1),i}static createUnloadedTheme(i){let e=new a(i,"","__"+i);return e.isLoaded=!1,e.hasFileIcons=!1,e.hasFolderIcons=!1,e.hidesExplorerArrows=!1,e.extensionData=void 0,e.watch=!1,e}static fromStorageData(i){let e=i.get(a.STORAGE_KEY,0);if(e)try{let t=JSON.parse(e),o=new a("","",null);for(let n in t)switch(n){case"id":case"label":case"description":case"settingsId":case"styleSheetContent":case"hasFileIcons":case"hidesExplorerArrows":case"hasFolderIcons":case"watch":o[n]=t[n];break;case"location":break;case"extensionData":o.extensionData=nT.fromJSONObject(t.extensionData);break}return o}catch{return}}toStorage(i){let e=JSON.stringify({id:this.id,label:this.label,description:this.description,settingsId:this.settingsId,styleSheetContent:this.styleSheetContent,hasFileIcons:this.hasFileIcons,hasFolderIcons:this.hasFolderIcons,hidesExplorerArrows:this.hidesExplorerArrows,extensionData:nT.toJSONObject(this.extensionData),watch:this.watch});i.store(a.STORAGE_KEY,e,0,1)}},DVt=class{constructor(i,e){this.fileService=i;this.languageService=e}load(i){return i.location?this.loadIconThemeDocument(i.location).then(e=>{let t=this.processIconThemeDocument(i.id,i.location,e);return i.styleSheetContent=t.content,i.hasFileIcons=t.hasFileIcons,i.hasFolderIcons=t.hasFolderIcons,i.hidesExplorerArrows=t.hidesExplorerArrows,i.isLoaded=!0,i.styleSheetContent}):Promise.resolve(i.styleSheetContent)}loadIconThemeDocument(i){return this.fileService.readExtensionResource(i).then(e=>{let t=[],o=jr(e,t);return t.length>0?Promise.reject(new Error(d(18012,null,t.map(n=>SF(n.error)).join(", ")))):pk(o)!=="object"?Promise.reject(new Error(d(18013,null))):Promise.resolve(o)})}processIconThemeDocument(i,e,t){let o={content:"",hasFileIcons:!1,hasFolderIcons:!1,hidesExplorerArrows:!!t.hidesExplorerArrows},n=!1;if(!t.iconDefinitions)return o;let r={},s={},l=ci(e);function c(b){return Ge(l,b)}function u(b,S){function y(w,k){if(k){let T=r[k];T||(T=r[k]=new N_),T.push(w)}}if(b){let w=ia`.show-file-icons`;S&&(w=ia`${S} ${w}`);let k=ia`.monaco-tl-twistie.collapsible:not(.collapsed) + .monaco-tl-contents`;b.folder&&(y(ia`${w} .folder-icon::before`,b.folder),o.hasFolderIcons=!0),b.folderExpanded&&(y(ia`${w} ${k} .folder-icon::before`,b.folderExpanded),o.hasFolderIcons=!0);let T=b.rootFolder||b.folder,P=b.rootFolderExpanded||b.folderExpanded;T&&(y(ia`${w} .rootfolder-icon::before`,T),o.hasFolderIcons=!0),P&&(y(ia`${w} ${k} .rootfolder-icon::before`,P),o.hasFolderIcons=!0),b.file&&(y(ia`${w} .file-icon::before`,b.file),o.hasFileIcons=!0);let O=b.folderNames;if(O)for(let he in O){let oe=new N_,de=_Vt(he.toLowerCase(),oe);oe.push(ia`.${Q2(de)}-name-folder-icon`),y(ia`${w} ${oe.join("")}.folder-icon::before`,O[he]),o.hasFolderIcons=!0}let V=b.folderNamesExpanded;if(V)for(let he in V){let oe=new N_,de=_Vt(he.toLowerCase(),oe);oe.push(ia`.${Q2(de)}-name-folder-icon`),y(ia`${w} ${k} ${oe.join("")}.folder-icon::before`,V[he]),o.hasFolderIcons=!0}let H=b.rootFolderNames;if(H)for(let he in H){let oe=he.toLowerCase();y(ia`${w} .${Q2(oe)}-root-name-folder-icon.rootfolder-icon::before`,H[he]),o.hasFolderIcons=!0}let G=b.rootFolderNamesExpanded;if(G)for(let he in G){let oe=he.toLowerCase();y(ia`${w} ${k} .${Q2(oe)}-root-name-folder-icon.rootfolder-icon::before`,G[he]),o.hasFolderIcons=!0}let $=b.languageIds;if($){!$.jsonc&&$.json&&($.jsonc=$.json);for(let he in $)y(ia`${w} .${Q2(he)}-lang-file-icon.file-icon::before`,$[he]),o.hasFileIcons=!0,n=!0,s[he]=!0}let J=b.fileExtensions;if(J)for(let he in J){let oe=new N_,Ce=_Vt(he.toLowerCase(),oe).split(".");if(Ce.length){for(let xe=0;xe<Ce.length;xe++)oe.push(ia`.${Q2(Ce.slice(xe).join("."))}-ext-file-icon`);oe.push(ia`.ext-file-icon`)}y(ia`${w} ${oe.join("")}.file-icon::before`,J[he]),o.hasFileIcons=!0,n=!0}let ae=b.fileNames;if(ae)for(let he in ae){let oe=new N_,de=_Vt(he.toLowerCase(),oe);oe.push(ia`.${Q2(de)}-name-file-icon`),oe.push(ia`.name-file-icon`);let Ce=de.split(".");if(Ce.length){for(let xe=1;xe<Ce.length;xe++)oe.push(ia`.${Q2(Ce.slice(xe).join("."))}-ext-file-icon`);oe.push(ia`.ext-file-icon`)}y(ia`${w} ${oe.join("")}.file-icon::before`,ae[he]),o.hasFileIcons=!0,n=!0}}}if(u(t),u(t.light,ia`.vs`),u(t.highContrast,ia`.hc-black`),u(t.highContrast,ia`.hc-light`),!o.hasFileIcons&&!o.hasFolderIcons)return o;let p=t.showLanguageModeIcons===!0||n&&t.showLanguageModeIcons!==!1,h=new N_,g=t.fonts,f=new Map;if(Array.isArray(g)){let b=this.tryNormalizeFontSize(g[0].size)||"150%";g.forEach(S=>{let y=new N_;y.push(...S.src.map(k=>ia`${Qa(c(k.path))} format(${tI(k.format)})`)),h.push(ia`@font-face { src: ${y.join(", ")}; font-family: ${tI(S.id)}; font-weight: ${fCe(S.weight)}; font-style: ${fCe(S.style)}; font-display: block; }`);let w=this.tryNormalizeFontSize(S.size);w!==void 0&&w!==b&&f.set(S.id,w)}),h.push(ia`.show-file-icons .file-icon::before, .show-file-icons .folder-icon::before, .show-file-icons .rootfolder-icon::before { font-family: ${tI(g[0].id)}; font-size: ${Cni(b)}; }`)}let v=tI("\\2001");for(let b in r){let S=r[b],y=t.iconDefinitions[b];if(y){if(y.iconPath)h.push(ia`${S.join(", ")} { content: ${v}; background-image: ${Qa(c(y.iconPath))}; }`);else if(y.fontCharacter||y.fontColor){let w=new N_;y.fontColor&&y.fontColor.match($yt)&&w.push(ia`color: ${eQi(y.fontColor)};`),y.fontCharacter&&w.push(ia`content: ${tI(y.fontCharacter)};`);let k=y.fontSize??(y.fontId?f.get(y.fontId):void 0);k&&k.match(S4e)&&w.push(ia`font-size: ${Cni(k)};`),y.fontId&&w.push(ia`font-family: ${tI(y.fontId)};`),p&&w.push(ia`background-image: unset;`),h.push(ia`${S.join(", ")} { ${w.join(" ")} }`)}}}if(p){for(let b of this.languageService.getRegisteredLanguageIds())if(!s[b]){let S=this.languageService.getIcon(b);if(S){let y=ia`.show-file-icons .${Q2(b)}-lang-file-icon.file-icon::before`;h.push(ia`${y} { content: ${v}; background-image: ${Qa(S.dark)}; }`),h.push(ia`.vs ${y} { content: ${v}; background-image: ${Qa(S.light)}; }`)}}}return o.content=h.join(`
`),o}tryNormalizeFontSize(i){if(!i)return;let e=13;if(i.endsWith("px")){let t=parseInt(i,10);if(!isNaN(t))return Math.round(t/e*100)+"%"}return i}};function _Vt(a,i){let e=a.lastIndexOf("/");if(e>=0){let t=a.substring(0,e);return i.push(ia`.${Q2(t)}-name-dir-icon`),a.substring(e+1)}return a}function Q2(a){return a=nde(a),bz(a,!0)}var Mdo=["comment","comment.block","comment.block.documentation","comment.line","constant","constant.character","constant.character.escape","constant.numeric","constant.numeric.integer","constant.numeric.float","constant.numeric.hex","constant.numeric.octal","constant.other","constant.regexp","constant.rgb-value","emphasis","entity","entity.name","entity.name.class","entity.name.function","entity.name.method","entity.name.section","entity.name.selector","entity.name.tag","entity.name.type","entity.other","entity.other.attribute-name","entity.other.inherited-class","invalid","invalid.deprecated","invalid.illegal","keyword","keyword.control","keyword.operator","keyword.operator.new","keyword.operator.assignment","keyword.operator.arithmetic","keyword.operator.logical","keyword.other","markup","markup.bold","markup.changed","markup.deleted","markup.heading","markup.inline.raw","markup.inserted","markup.italic","markup.list","markup.list.numbered","markup.list.unnumbered","markup.other","markup.quote","markup.raw","markup.underline","markup.underline.link","meta","meta.block","meta.cast","meta.class","meta.function","meta.function-call","meta.preprocessor","meta.return-type","meta.selector","meta.tag","meta.type.annotation","meta.type","punctuation.definition.string.begin","punctuation.definition.string.end","punctuation.separator","punctuation.separator.continuation","punctuation.terminator","storage","storage.modifier","storage.type","string","string.interpolated","string.other","string.quoted","string.quoted.double","string.quoted.other","string.quoted.single","string.quoted.triple","string.regexp","string.unquoted","strong","support","support.class","support.constant","support.function","support.other","support.type","support.type.property-name","support.variable","variable","variable.language","variable.name","variable.other","variable.other.readwrite","variable.parameter"],wZe="vscode://schemas/textmate-colors",Pdo=`${wZe}#/definitions/colorGroup`,j9o={type:"array",definitions:{colorGroup:{default:"#FF0000",anyOf:[{type:"string",format:"color-hex"},{$ref:"#/definitions/settings"}]},settings:{type:"object",description:d(18073,null),properties:{foreground:{type:"string",description:d(18071,null),format:"color-hex",default:"#ff0000"},background:{type:"string",deprecationMessage:d(18066,null)},fontStyle:{type:"string",description:d(18069,null),pattern:"^(\\s*\\b(italic|bold|underline|strikethrough))*\\s*$",patternErrorMessage:d(18061,null),defaultSnippets:[{label:d(18070,null),bodyText:'""'},{body:"italic"},{body:"bold"},{body:"underline"},{body:"strikethrough"},{body:"italic bold"},{body:"italic underline"},{body:"italic strikethrough"},{body:"bold underline"},{body:"bold strikethrough"},{body:"underline strikethrough"},{body:"italic bold underline"},{body:"italic bold strikethrough"},{body:"italic underline strikethrough"},{body:"bold underline strikethrough"},{body:"italic bold underline strikethrough"}]},fontFamily:{type:"string",description:d(18067,null)},fontSize:{type:"number",description:d(18068,null)},lineHeight:{type:"number",description:d(18072,null)}},additionalProperties:!1,defaultSnippets:[{body:{foreground:"${1:#FF0000}",fontStyle:"${2:bold}"}}]}},items:{type:"object",defaultSnippets:[{body:{scope:"${1:keyword.operator}",settings:{foreground:"${2:#FF0000}"}}}],properties:{name:{type:"string",description:d(18062,null)},scope:{description:d(18063,null),anyOf:[{enum:Mdo},{type:"string"},{type:"array",items:{enum:Mdo}},{type:"array",items:{type:"string"}}]},settings:{$ref:"#/definitions/settings"}},required:["settings"],additionalProperties:!1}},RCi="vscode://schemas/color-theme",Q9o={type:"object",allowComments:!0,allowTrailingCommas:!0,properties:{colors:{description:d(18075,null),$ref:rle,additionalProperties:!1},tokenColors:{anyOf:[{type:"string",description:d(18074,null)},{description:d(18060,null),$ref:wZe}]},semanticHighlighting:{type:"boolean",description:d(18065,null)},semanticTokenColors:{type:"object",description:d(18064,null),$ref:Xke}}};function Ado(){let a=ne.as(ma.JSONContribution);a.registerSchema(RCi,Q9o),a.registerSchema(wZe,j9o)}function Ndo(){return Rn.registerExtensionPoint({extensionPoint:"themes",jsonSchema:{description:d(18181,null),type:"array",items:{type:"object",defaultSnippets:[{body:{label:"${1:label}",id:"${2:id}",uiTheme:"vs-dark",path:"./themes/${3:id}.tmTheme."}}],properties:{id:{description:d(18182,null),type:"string"},label:{description:d(18183,null),type:"string"},uiTheme:{markdownDescription:d(18185,null),enum:["vs","vs-dark","hc-black","hc-light"]},path:{markdownDescription:d(18184,null),type:"string"}},required:["path","uiTheme"]}}})}function Odo(){return Rn.registerExtensionPoint({extensionPoint:"iconThemes",jsonSchema:{description:d(18173,null),type:"array",items:{type:"object",defaultSnippets:[{body:{id:"${1:id}",label:"${2:label}",path:"./fileicons/${3:id}-icon-theme.json"}}],properties:{id:{description:d(18174,null),type:"string"},label:{description:d(18175,null),type:"string"},path:{description:d(18176,null),type:"string"}},required:["path","id"]}}})}function Fdo(){return Rn.registerExtensionPoint({extensionPoint:"productIconThemes",jsonSchema:{description:d(18177,null),type:"array",items:{type:"object",defaultSnippets:[{body:{id:"${1:id}",label:"${2:label}",path:"./producticons/${3:id}-product-icon-theme.json"}}],properties:{id:{description:d(18178,null),type:"string"},label:{description:d(18179,null),type:"string"},path:{description:d(18180,null),type:"string"}},required:["path","id"]}}})}var MCi=class extends x{constructor(){super(...arguments);this.type="markdown"}shouldRender(e){return!!e.contributes?.themes||!!e.contributes?.iconThemes||!!e.contributes?.productIconThemes}render(e){let t=new Ie;if(e.contributes?.themes){t.appendMarkdown(`### ${d(18165,null)}

`);for(let o of e.contributes.themes)t.appendMarkdown(`- ${o.label}
`)}if(e.contributes?.iconThemes){t.appendMarkdown(`### ${d(18166,null)}

`);for(let o of e.contributes.iconThemes)t.appendMarkdown(`- ${o.label}
`)}if(e.contributes?.productIconThemes){t.appendMarkdown(`### ${d(18168,null)}

`);for(let o of e.contributes.productIconThemes)t.appendMarkdown(`- ${o.label}
`)}return{data:t,dispose:()=>{}}}};ne.as(As.ExtensionFeaturesRegistry).registerExtensionFeature({id:"themes",label:d(18172,null),access:{canToggle:!1},renderer:new Ft(MCi)});var zRe=class{constructor(i,e,t=!1,o=void 0){this.themesExtPoint=i;this.create=e;this.idRequired=t;this.builtInTheme=o;this.onDidChangeEmitter=new E;this.onDidChange=this.onDidChangeEmitter.event;this.extensionThemes=[],this.initialize()}dispose(){this.themesExtPoint.setHandler(()=>{}),this.onDidChangeEmitter.dispose()}initialize(){this.themesExtPoint.setHandler((i,e)=>{let t={},o=[];for(let r of this.extensionThemes)t[r.id]=r;this.extensionThemes.length=0;for(let r of i){let s=nT.fromName(r.description.publisher,r.description.name,r.description.isBuiltin);this.onThemes(s,r.description.extensionLocation,r.value,this.extensionThemes,r.collector)}for(let r of this.extensionThemes)t[r.id]?delete t[r.id]:o.push(r);let n=Object.values(t);this.onDidChangeEmitter.fire({themes:this.extensionThemes,added:o,removed:n})})}onThemes(i,e,t,o=[],n){return Array.isArray(t)?(t.forEach(r=>{if(!r.path||!Fe(r.path)){n?.error(d(18171,null,this.themesExtPoint.name,String(r.path)));return}if(this.idRequired&&(!r.id||!Fe(r.id))){n?.error(d(18170,null,this.themesExtPoint.name,String(r.id)));return}let s=Ge(e,r.path);ws(s,e)||n?.warn(d(18167,null,this.themesExtPoint.name,s.path,e.path));let l=this.create(r,s,i);o.push(l)}),o):(n?.error(d(18169,null,this.themesExtPoint.name)),o)}findThemeById(i){if(this.builtInTheme&&this.builtInTheme.id===i)return this.builtInTheme;let e=this.getThemes();for(let t of e)if(t.id===i)return t}findThemeBySettingsId(i,e){let t=i&&m6e(i);if(this.builtInTheme&&this.builtInTheme.settingsId===t)return this.builtInTheme;let o=this.getThemes(),n;for(let r of o){if(r.settingsId===t)return r;r.settingsId===e&&(n=r)}return n}findThemeByExtensionLocation(i){return i?this.getThemes().filter(e=>e.location&&ws(e.location,i)):[]}getThemes(){return this.extensionThemes}getMarketplaceThemes(i,e,t){let o=i?.contributes?.[this.themesExtPoint.name];return Array.isArray(o)?this.onThemes(t,e,o):[]}};var KRe=ne.as(Jt.Configuration),mme=[],hme=[],gme=[];function UA(a){return`\`#${a}#\``}var H3="colorThemeConfiguration",Y9o={type:"string",markdownDescription:d(18134,null,UA("window.autoDetectColorScheme")),default:Wt?rl.COLOR_THEME_LIGHT:rl.COLOR_THEME_DARK,tags:[H3],enum:mme,enumDescriptions:gme,enumItemLabels:hme,errorMessage:d(18135,null)},X9o={type:"string",markdownDescription:d(18157,null,UA("window.autoDetectColorScheme")),default:rl.COLOR_THEME_DARK,tags:[H3],enum:mme,enumDescriptions:gme,enumItemLabels:hme,errorMessage:d(18135,null)},J9o={type:"string",markdownDescription:d(18160,null,UA("window.autoDetectColorScheme")),default:rl.COLOR_THEME_LIGHT,tags:[H3],enum:mme,enumDescriptions:gme,enumItemLabels:hme,errorMessage:d(18135,null)},Z9o={type:"string",markdownDescription:d(18158,null,UA("window.autoDetectHighContrast")),default:rl.COLOR_THEME_HC_DARK,tags:[H3],enum:mme,enumDescriptions:gme,enumItemLabels:hme,errorMessage:d(18135,null)},e7o={type:"string",markdownDescription:d(18159,null,UA("window.autoDetectHighContrast")),default:rl.COLOR_THEME_HC_LIGHT,tags:[H3],enum:mme,enumDescriptions:gme,enumItemLabels:hme,errorMessage:d(18135,null)},t7o={type:"boolean",markdownDescription:d(18138,null,UA("workbench.preferredDarkColorTheme"),UA("workbench.preferredLightColorTheme")),default:!1,tags:[H3]},Wdo={type:"object",description:d(18164,null),allOf:[{$ref:rle}],default:{},defaultSnippets:[{body:{}}]},LVt={type:["string","null"],default:rl.FILE_ICON_THEME,description:d(18153,null),enum:[null],enumItemLabels:[d(18156,null)],enumDescriptions:[d(18155,null)],errorMessage:d(18154,null)},RVt={type:["string","null"],default:rl.PRODUCT_ICON_THEME,description:d(18161,null),enum:[rl.PRODUCT_ICON_THEME],enumItemLabels:[d(18137,null)],enumDescriptions:[d(18136,null)],errorMessage:d(18162,null)},i7o={type:"boolean",default:!0,markdownDescription:d(18133,null,UA("workbench.preferredHighContrastColorTheme"),UA("workbench.preferredHighContrastLightColorTheme")),scope:1,tags:[H3]},PVt={id:"workbench",order:7.1,type:"object",properties:{"workbench.colorTheme":Y9o,"workbench.preferredDarkColorTheme":X9o,"workbench.preferredLightColorTheme":J9o,"workbench.preferredHighContrastColorTheme":Z9o,"workbench.preferredHighContrastLightColorTheme":e7o,"workbench.iconTheme":LVt,"workbench.colorCustomizations":Wdo,"workbench.productIconTheme":RVt}};KRe.registerConfiguration(PVt);var o7o={id:"window",order:8.1,type:"object",properties:{"window.autoDetectHighContrast":i7o,"window.autoDetectColorScheme":t7o}};KRe.registerConfiguration(o7o);function pme(a){return{description:a,$ref:Pdo}}var PCi="^\\[[^\\]]*(\\]\\s*\\[[^\\]]*)*\\]$",Vdo={type:"object",properties:{comments:pme(d(18140,null)),strings:pme(d(18149,null)),keywords:pme(d(18142,null)),numbers:pme(d(18143,null)),types:pme(d(18151,null)),functions:pme(d(18141,null)),variables:pme(d(18152,null)),textMateRules:{description:d(18150,null),$ref:wZe},semanticHighlighting:{description:d(18144,null),deprecationMessage:d(18145,null),markdownDeprecationMessage:d(18146,null,UA("editor.semanticTokenColorCustomizations")),type:"boolean"}},additionalProperties:!1},Bdo={description:d(18139,null),default:{},allOf:[{...Vdo,patternProperties:{"^\\[":{}}}]},ACi={type:"object",properties:{enabled:{type:"boolean",description:d(18147,null),suggestSortText:"0_enabled"},rules:{$ref:Xke,description:d(18148,null),suggestSortText:"0_rules"}},additionalProperties:!1},Hdo={description:d(18163,null),default:{},allOf:[{...ACi,patternProperties:{"^\\[":{}}}]},Udo={id:"editor",order:7.2,type:"object",properties:{"editor.tokenColorCustomizations":Bdo,"editor.semanticTokenColorCustomizations":Hdo}};KRe.registerConfiguration(Udo);function OCi(a){a.sort((r,s)=>r.label.localeCompare(s.label)),mme.splice(0,mme.length,...a.map(r=>r.settingsId)),gme.splice(0,gme.length,...a.map(r=>r.description||"")),hme.splice(0,hme.length,...a.map(r=>r.label||""));let i={properties:{}},e={properties:{}},t={properties:{}},o={$ref:rle,additionalProperties:!1},n={properties:Vdo.properties,additionalProperties:!1};for(let r of a){let s=`[${r.settingsId}]`;i.properties[s]=o,e.properties[s]=n,t.properties[s]=ACi}i.patternProperties={[PCi]:o},e.patternProperties={[PCi]:n},t.patternProperties={[PCi]:ACi},Wdo.allOf[1]=i,Bdo.allOf[1]=e,Hdo.allOf[1]=t,KRe.notifyConfigurationSchemaUpdated(PVt,Udo)}function FCi(a){LVt.enum.splice(1,Number.MAX_VALUE,...a.map(i=>i.settingsId)),LVt.enumItemLabels.splice(1,Number.MAX_VALUE,...a.map(i=>i.label)),LVt.enumDescriptions.splice(1,Number.MAX_VALUE,...a.map(i=>i.description||"")),KRe.notifyConfigurationSchemaUpdated(PVt)}function WCi(a){RVt.enum.splice(1,Number.MAX_VALUE,...a.map(i=>i.settingsId)),RVt.enumItemLabels.splice(1,Number.MAX_VALUE,...a.map(i=>i.label)),RVt.enumDescriptions.splice(1,Number.MAX_VALUE,...a.map(i=>i.description||"")),KRe.notifyConfigurationSchemaUpdated(PVt)}var n7o={dark:"workbench.preferredDarkColorTheme",light:"workbench.preferredLightColorTheme",hcDark:"workbench.preferredHighContrastColorTheme",hcLight:"workbench.preferredHighContrastLightColorTheme"},MVt=class{constructor(i,e){this.configurationService=i;this.hostColorService=e}get colorTheme(){return this.configurationService.getValue(this.getColorThemeSettingId())}get fileIconTheme(){return this.configurationService.getValue("workbench.iconTheme")}get productIconTheme(){return this.configurationService.getValue("workbench.productIconTheme")}get colorCustomizations(){return this.configurationService.getValue("workbench.colorCustomizations")||{}}get tokenColorCustomizations(){let i=this.configurationService.getValue("editor.tokenColorCustomizations")||{},e=i.textMateRules;if(!e)return i;let t=e.map(n=>{let r=n.settings?.fontSize,s=n.settings?.lineHeight;return r!==void 0&&s===void 0?{...n,settings:{...n.settings,lineHeight:r}}:n});return{...i,textMateRules:t}}get semanticTokenColorCustomizations(){return this.configurationService.getValue("editor.semanticTokenColorCustomizations")}getPreferredColorScheme(){if(this.configurationService.getValue("window.autoDetectHighContrast")&&this.hostColorService.highContrast)return this.hostColorService.dark?"hcDark":"hcLight";if(this.isDetectingColorScheme())return this.hostColorService.dark?"dark":"light"}isDetectingColorScheme(){return this.configurationService.getValue("window.autoDetectColorScheme")}getColorThemeSettingId(){let i=this.getPreferredColorScheme();return i?n7o[i]:"workbench.colorTheme"}async setColorTheme(i,e){return await this.writeConfiguration(this.getColorThemeSettingId(),i.settingsId,e),i}async setFileIconTheme(i,e){return await this.writeConfiguration("workbench.iconTheme",i.settingsId,e),i}async setProductIconTheme(i,e){return await this.writeConfiguration("workbench.productIconTheme",i.settingsId,e),i}isDefaultColorTheme(){let i=this.configurationService.inspect(this.getColorThemeSettingId());return i&&i.default?.value===i.value}findAutoConfigurationTarget(i){let e=this.configurationService.inspect(i);if(gn(e.workspaceFolderValue))if(gn(e.workspaceValue)){if(!gn(e.userRemote))return 4}else return 5;else return 6;return 2}async writeConfiguration(i,e,t){if(t===void 0||t==="preview")return;let o=this.configurationService.inspect(i);if(t==="auto")return this.configurationService.updateValue(i,e);if(t===2){if(e===o.userValue)return Promise.resolve(void 0);if(e===o.defaultValue){if(gn(o.userValue))return Promise.resolve(void 0);e=void 0}}else if((t===5||t===6||t===4)&&e===o.value)return Promise.resolve(void 0);return this.configurationService.updateValue(i,e,t)}};var fme="",xH=class a{constructor(i,e,t){this.iconThemeDocument={iconDefinitions:new Map};this.id=i,this.label=e,this.settingsId=t,this.isLoaded=!1}static{this.STORAGE_KEY="productIconThemeData"}getIcon(i){return a7o(i,this.iconThemeDocument)}ensureLoaded(i,e){return this.isLoaded?Promise.resolve(this.styleSheetContent):this.load(i,e)}reload(i,e){return this.load(i,e)}async load(i,e){let t=this.location;if(!t)return Promise.resolve(this.styleSheetContent);let o=[];return this.iconThemeDocument=await r7o(i,t,o),this.isLoaded=!0,o.length&&e.error(d(18025,null,t.toString(),o.join(`
`))),this.styleSheetContent}static fromExtensionTheme(i,e,t){let o=t.extensionId+"-"+i.id,n=i.label||jo(i.path),r=i.id,s=new a(o,n,r);return s.description=i.description,s.location=e,s.extensionData=t,s.watch=i._watch,s.isLoaded=!1,s}static createUnloadedTheme(i){let e=new a(i,"","__"+i);return e.isLoaded=!1,e.extensionData=void 0,e.watch=!1,e}static{this._defaultProductIconTheme=null}static get defaultTheme(){let i=a._defaultProductIconTheme;return i||(i=a._defaultProductIconTheme=new a(fme,d(18014,null),rl.PRODUCT_ICON_THEME),i.isLoaded=!0,i.extensionData=void 0,i.watch=!1),i}static fromStorageData(i){let e=i.get(a.STORAGE_KEY,0);if(e)try{let t=JSON.parse(e),o=new a("","","");for(let s in t)switch(s){case"id":case"label":case"description":case"settingsId":case"styleSheetContent":case"watch":o[s]=t[s];break;case"location":break;case"extensionData":o.extensionData=nT.fromJSONObject(t.extensionData);break}let{iconDefinitions:n,iconFontDefinitions:r}=t;if(Array.isArray(n)&&xi(r)){let s=new Map;for(let l of n){let{id:c,fontCharacter:u,fontId:p}=l;if(Fe(c)&&Fe(u))if(Fe(p)){let h=qyt.fromJSONObject(r[p]);h&&s.set(c,{fontCharacter:u,font:{id:p,definition:h}})}else s.set(c,{fontCharacter:u})}o.iconThemeDocument={iconDefinitions:s}}return o}catch{return}}toStorage(i){let e=[],t={};for(let n of this.iconThemeDocument.iconDefinitions.entries()){let r=n[1].font;e.push({id:n[0],fontCharacter:n[1].fontCharacter,fontId:r?.id}),r&&t[r.id]===void 0&&(t[r.id]=qyt.toJSONObject(r.definition))}let o=JSON.stringify({id:this.id,label:this.label,description:this.description,settingsId:this.settingsId,styleSheetContent:this.styleSheetContent,watch:this.watch,extensionData:nT.toJSONObject(this.extensionData),iconDefinitions:e,iconFontDefinitions:t});i.store(a.STORAGE_KEY,o,0,1)}};function r7o(a,i,e){return a.readExtensionResource(i).then(t=>{let o=[],n=jr(t,o);if(o.length>0)return Promise.reject(new Error(d(18015,null,o.map(u=>SF(u.error)).join(", "))));if(pk(n)!=="object")return Promise.reject(new Error(d(18022,null)));if(!n.iconDefinitions||!Array.isArray(n.fonts)||!n.fonts.length)return Promise.reject(new Error(d(18023,null)));let r=ci(i),s=new Map;for(let u of n.fonts){let p=u.id;if(Fe(p)&&p.match(mY)){let h;Fe(u.weight)&&u.weight.match(MCe)?h=u.weight:e.push(d(18019,null,u.id));let g;Fe(u.style)&&u.style.match(RCe)?g=u.style:e.push(d(18018,null,u.id));let f=[];if(Array.isArray(u.src))for(let v of u.src)if(Fe(v.path)&&Fe(v.format)&&v.format.match(h6i)){let b=Ge(r,v.path);f.push({location:b,format:v.format})}else e.push(d(18017,null,u.id));f.length?s.set(p,{weight:h,style:g,src:f}):e.push(d(18024,null,u.id))}else e.push(d(18016,null,u.id))}let l=new Map,c=n.fonts[0].id;for(let u in n.iconDefinitions){let p=n.iconDefinitions[u];if(Fe(p.fontCharacter)){let h=p.fontId??c,g=s.get(h);if(g){let f={id:`pi-${h}`,definition:g};l.set(u,{fontCharacter:p.fontCharacter,font:f})}else e.push(d(18020,null,u))}else e.push(d(18021,null,u))}return{iconDefinitions:l}})}var s7o=mw();function a7o(a,i){let e=i.iconDefinitions,t=e.get(a.id),o=a.defaults;for(;!t&&q.isThemeIcon(o);){let n=s7o.getIcon(o.id);if(n)t=e.get(n.id),o=n.defaults;else return}if(t)return t;if(!q.isThemeIcon(o))return o}var l7o="vscode://schemas/product-icon-theme",c7o={type:"object",allowComments:!0,allowTrailingCommas:!0,properties:{fonts:{type:"array",items:{type:"object",properties:{id:{type:"string",description:d(18131,null),pattern:mY.source,patternErrorMessage:PCe},src:{type:"array",description:d(18132,null),items:{type:"object",properties:{path:{type:"string",description:d(18127,null)},format:{type:"string",description:d(18126,null),enum:["woff","woff2","truetype","opentype","embedded-opentype","svg"]}},required:["path","format"]}},weight:{type:"string",description:d(18129,null),anyOf:[{enum:["normal","bold","lighter","bolder"]},{type:"string",pattern:MCe.source}]},style:{type:"string",description:d(18128,null),anyOf:[{enum:["normal","italic","oblique"]},{type:"string",pattern:RCe.source}]}},required:["id","src"]}},iconDefinitions:{description:d(18130,null),$ref:jyt}}};function zdo(){ne.as(ma.JSONContribution).registerSchema(l7o,c7o)}var AVt=le("hostColorSchemeService");var U3=le("IUserDataInitializationService"),NVt=class{constructor(i=[]){this.initializers=i}async whenInitializationFinished(){await this.requiresInitialization()&&await Promise.all(this.initializers.map(i=>i.whenInitializationFinished()))}async requiresInitialization(){return(await Promise.all(this.initializers.map(i=>i.requiresInitialization()))).some(i=>i)}async initializeRequiredResources(){await this.requiresInitialization()&&await Promise.all(this.initializers.map(i=>i.initializeRequiredResources()))}async initializeOtherResources(i){await this.requiresInitialization()&&await Promise.all(this.initializers.map(e=>e.initializeOtherResources(i)))}async initializeInstalledExtensions(i){await this.requiresInitialization()&&await Promise.all(this.initializers.map(e=>e.initializeInstalledExtensions(i)))}},CZe=class{constructor(i,e,t){t.whenInstalledExtensionsRegistered().then(()=>this.initializeOtherResource(i,e))}async initializeOtherResource(i,e){await i.requiresInitialization()&&(Mo("code/willInitOtherUserData"),await i.initializeOtherResources(e),Mo("code/didInitOtherUserData"))}};CZe=I([m(0,U3),m(1,F),m(2,lt)],CZe);Wt&&ne.as(Qi.Workbench).registerWorkbenchContribution(CZe,3);function OVt(a){let i=new N,e=i.add(new E),t=mw();return i.add(t.onDidChange(()=>e.fire())),a&&i.add(a.onDidProductIconThemeChange(()=>e.fire())),{dispose:()=>i.dispose(),onDidChange:e.event,getCSS(){let o=a?a.getProductIconTheme():new VCi,n={},r=new N_,s=new N_;for(let l of t.getIcons()){let c=o.getIcon(l);if(!c)continue;let u=c.font,p=ia`--vscode-icon-${bz(l.id)}-font-family`,h=ia`--vscode-icon-${bz(l.id)}-content`;u?(n[u.id]=u.definition,s.push(ia`${p}: ${tI(u.id)};`,ia`${h}: ${tI(c.fontCharacter)};`),r.push(ia`.codicon-${bz(l.id)}:before { content: ${tI(c.fontCharacter)}; font-family: ${tI(u.id)}; }`)):(s.push(ia`${h}: ${tI(c.fontCharacter)}; ${p}: 'codicon';`),r.push(ia`.codicon-${bz(l.id)}:before { content: ${tI(c.fontCharacter)}; }`))}for(let l in n){let c=n[l],u=c.weight?ia`font-weight: ${fCe(c.weight)};`:ia``,p=c.style?ia`font-style: ${fCe(c.style)};`:ia``,h=new N_;for(let g of c.src)h.push(ia`${Qa(g.location)} format(${tI(g.format)})`);r.push(ia`@font-face { src: ${h.join(", ")}; font-family: ${tI(l)};${u}${p} font-display: block; }`)}return r.push(ia`:root { ${s.join(" ")} }`),r.join(`
`)}}}var VCi=class{getIcon(i){let e=mw(),t=i.defaults;for(;q.isThemeIcon(t);){let o=e.getIcon(t.id);if(!o)return;t=o.defaults}return t}};function Gdo(a){return`--vscode-${a.replace(/\./g,"-")}`}function d7o(a){return a!==null&&typeof a=="object"&&"light"in a&&"dark"in a}function u7o(a,i="px"){return{value:a,unit:i}}function M0(a,i="px"){let e=u7o(a,i);return{light:e,dark:e,hcDark:e,hcLight:e}}function xZe(a){return`${a.value}${a.unit}`}var p7o={SizeContribution:"base.contributions.sizes"};var BCi=class extends x{constructor(){super();this._onDidChangeSchema=this._register(new E);this.onDidChangeSchema=this._onDidChangeSchema.event;this.sizeSchema={type:"object",properties:{}};this.sizeReferenceSchema={type:"string",enum:[],enumDescriptions:[]};this.sizesById={}}notifyThemeUpdate(e){for(let t of Object.keys(this.sizesById)){let o=this.resolveDefaultSize(t,e);o&&(this.sizeSchema.properties[t].default=xZe(o))}this._onDidChangeSchema.fire()}registerSize(e,t,o,n){let r={id:e,description:o,defaults:t,deprecationMessage:n};this.sizesById[e]=r;let s={type:"string",pattern:"^(\\d+(\\.\\d+)?(px|rem|em|%))|default$",patternErrorMessage:'Size must be a number followed by px, rem, em, or % (e.g., "12px", "1.5rem") or "default"'};return n&&(s.deprecationMessage=n),this.sizeSchema.properties[e]={description:o,...s},this.sizeReferenceSchema.enum.push(e),this.sizeReferenceSchema.enumDescriptions.push(o),this._onDidChangeSchema.fire(),e}deregisterSize(e){delete this.sizesById[e],delete this.sizeSchema.properties[e];let t=this.sizeReferenceSchema.enum.indexOf(e);t!==-1&&(this.sizeReferenceSchema.enum.splice(t,1),this.sizeReferenceSchema.enumDescriptions.splice(t,1)),this._onDidChangeSchema.fire()}getSizes(){return Object.keys(this.sizesById).map(e=>this.sizesById[e])}resolveDefaultSize(e,t){let o=this.sizesById[e];if(o?.defaults)return(d7o(o.defaults)?o.defaults[t.type]:o.defaults)??void 0}getSizeSchema(){return this.sizeSchema}getSizeReferenceSchema(){return this.sizeReferenceSchema}toString(){let e=(t,o)=>{let n=t.indexOf(".")===-1?0:1,r=o.indexOf(".")===-1?0:1;return n!==r?n-r:t.localeCompare(o)};return Object.keys(this.sizesById).sort(e).map(t=>`- \`${t}\`: ${this.sizesById[t].description}`).join(`
`)}},kZe=new BCi;ne.add(p7o.SizeContribution,kZe);function P0(a,i,e,t){return kZe.registerSize(a,i,e,t)}function EZe(){return kZe}var qdo="vscode://schemas/workbench-sizes",$do=ne.as(ma.JSONContribution);$do.registerSchema(qdo,kZe.getSizeSchema());var Kdo=new Dt(()=>$do.notifySchemaChanged(qdo),200);kZe.onDidChangeSchema(()=>{Kdo.isScheduled()||Kdo.schedule()});var $dd=P0("bodyFontSize",M0(13,"px"),d(2670,null)),jdd=P0("bodyFontSize.small",M0(12,"px"),d(2671,null)),Qdd=P0("bodyFontSize.xSmall",M0(11,"px"),d(2672,null)),Ydd=P0("codiconFontSize",M0(16,"px"),d(2673,null)),Xdd=P0("cornerRadius.medium",M0(6,"px"),d(2676,null)),Jdd=P0("cornerRadius.xSmall",M0(2,"px"),d(2679,null)),Zdd=P0("cornerRadius.small",M0(4,"px"),d(2677,null)),eud=P0("cornerRadius.large",M0(8,"px"),d(2675,null)),tud=P0("cornerRadius.xLarge",M0(12,"px"),d(2678,null)),iud=P0("cornerRadius.circle",M0(9999,"px"),d(2674,null)),oud=P0("strokeThickness",M0(1,"px"),d(2680,null));function jdo(a,i,e,t){let o=new Set,n={addRule:s=>{o.has(s)||o.add(s)}};if(n.addRule(`${i} { forced-color-adjust: none; }`),e&&t)for(let s of e)s(a,n,t);let r=[];for(let s of Dye().getColors()){let l=a.getColor(s.id,!0);l&&r.push(`${yO(s.id)}: ${l.toString()};`)}for(let s of EZe().getSizes()){let l=EZe().resolveDefaultSize(s.id,a);l&&r.push(`${Gdo(s.id)}: ${xZe(l)};`)}return n.addRule(`${i} { ${r.join(`
`)} }`),new HCi([...o].join(`
`))}var HCi=class{constructor(i){this.code=i}};var FVt="vscode-theme-defaults",UCi="vscode.vscode-theme-seti-vs-seti",Qdo="file-icons-enabled",m7o="contributedColorTheme",h7o="contributedFileIconTheme",g7o="contributedProductIconTheme",Ydo=ne.as(hii.ThemingContribution);function f7o(a){switch(a){case"vs":return`vs ${FVt}-themes-light_vs-json`;case"vs-dark":return`vs-dark ${FVt}-themes-dark_vs-json`;case"hc-black":return`hc-black ${FVt}-themes-hc_black-json`;case"hc-light":return`hc-light ${FVt}-themes-hc_light-json`}return a}var v7o=Ndo(),b7o=Odo(),S7o=Fdo(),bee=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super();this.storageService=t;this.configurationService=o;this.telemetryService=n;this.environmentService=r;this.extensionResourceLoaderService=l;this.logService=u;this.hostColorService=p;this.userDataInitializationService=h;this.languageService=g;this.notificationService=f;this.hostService=v;this.themeExtensionsActivated=new Map;this.container=c.mainContainer,this.settings=new MVt(o,p),this.colorThemeRegistry=this._register(new zRe(v7o,B3.fromExtensionTheme)),this.colorThemeWatcher=this._register(new TZe(s,r,this.reloadCurrentColorTheme.bind(this))),this.onColorThemeChange=this._register(new E({leakWarningThreshold:400})),this.currentColorTheme=B3.createUnloadedTheme(""),this.colorThemeSequencer=new rm,this.fileIconThemeWatcher=this._register(new TZe(s,r,this.reloadCurrentFileIconTheme.bind(this))),this.fileIconThemeRegistry=this._register(new zRe(b7o,CH.fromExtensionTheme,!0,CH.noIconTheme)),this.fileIconThemeLoader=new DVt(l,g),this.onFileIconThemeChange=this._register(new E({leakWarningThreshold:400})),this.currentFileIconTheme=CH.createUnloadedTheme(""),this.fileIconThemeSequencer=new rm,this.productIconThemeWatcher=this._register(new TZe(s,r,this.reloadCurrentProductIconTheme.bind(this))),this.productIconThemeRegistry=this._register(new zRe(S7o,xH.fromExtensionTheme,!0,xH.defaultTheme)),this.onProductIconThemeChange=this._register(new E),this.currentProductIconTheme=xH.createUnloadedTheme(""),this.productIconThemeSequencer=new rm,this._register(this.onDidColorThemeChange(G=>Dye().notifyThemeUpdate(G)));let b=B3.fromStorageData(this.storageService),S=b?.settingsId,y=this.settings.colorTheme;b&&y!==b.settingsId&&(b=void 0);let w=y===rl.COLOR_THEME_LIGHT?JZi:y===rl.COLOR_THEME_DARK?XZi:void 0;if(!b){let G=r.options?.initialColorTheme;G&&(b=B3.createUnloadedThemeForThemeType(G.themeType,G.colors??w))}if(!b){let G=this.settings.getPreferredColorScheme()??(Wt?"light":"dark");b=B3.createUnloadedThemeForThemeType(G,w)}b.setCustomizations(this.settings),this.applyTheme(b,void 0,!0);let k=CH.fromStorageData(this.storageService);k&&this.applyAndSetFileIconTheme(k,!0);let T=xH.fromStorageData(this.storageService);T&&this.applyAndSetProductIconTheme(T,!0),e.whenInstalledExtensionsRegistered().then(G=>{this.installConfigurationListener(),this.installPreferredSchemeListener(),this.installRegistryListeners(),this.initialize(S).catch(mt)});let P=Cr();P.id="codiconStyles";let O=this._register(OVt(this));function V(){P.textContent=O.getCSS()}let H=this._register(new Dt(V,0));this._register(O.onDidChange(()=>H.schedule())),H.schedule()}async initialize(e){let t=this.environmentService.extensionDevelopmentLocationURI,o=t&&t.length===1?t[0]:void 0,n=async()=>{let c=this.colorThemeRegistry.findThemeByExtensionLocation(o);if(c.length){let p=c.find(h=>h.type===this.currentColorTheme.type);return this.setColorTheme(p?p.id:c[0].id,void 0)}let u=this.colorThemeRegistry.findThemeBySettingsId(this.settings.colorTheme,void 0);if(!u){await this.userDataInitializationService.whenInitializationFinished();let p=this.currentColorTheme.type==="light"?rl.COLOR_THEME_LIGHT:rl.COLOR_THEME_DARK;u=this.colorThemeRegistry.findThemeBySettingsId(this.settings.colorTheme,p)}return this.setColorTheme(u&&u.id,void 0)},r=async()=>{let c=this.fileIconThemeRegistry.findThemeByExtensionLocation(o);if(c.length)return this.setFileIconTheme(c[0].id,8);let u=this.fileIconThemeRegistry.findThemeBySettingsId(this.settings.fileIconTheme);return u||(await this.userDataInitializationService.whenInitializationFinished(),u=this.fileIconThemeRegistry.findThemeBySettingsId(this.settings.fileIconTheme)),this.setFileIconTheme(u?u.id:UCi,void 0)},s=async()=>{let c=this.productIconThemeRegistry.findThemeByExtensionLocation(o);if(c.length)return this.setProductIconTheme(c[0].id,8);let u=this.productIconThemeRegistry.findThemeBySettingsId(this.settings.productIconTheme);return u||(await this.userDataInitializationService.whenInitializationFinished(),u=this.productIconThemeRegistry.findThemeBySettingsId(this.settings.productIconTheme)),this.setProductIconTheme(u?u.id:fme,void 0)};this.migrateColorThemeSettings();let l=await Promise.all([n(),r(),s()]);return await this.showNewDefaultThemeNotification(e),l}static{this.NEW_THEME_NOTIFICATION_KEY="workbench.newDefaultThemeNotification"}async showNewDefaultThemeNotification(e){if(this.storageService.getBoolean(bee.NEW_THEME_NOTIFICATION_KEY,-1)||!await this.hostService.hadLastFocus()||this.environmentService.isSessionsWindow)return;try{if(!this.settings.isDefaultColorTheme()||!e||(e=m6e(e),!["Dark Modern","Light Modern"].includes(e))||![rl.COLOR_THEME_DARK,rl.COLOR_THEME_LIGHT].includes(this.settings.colorTheme))return}finally{this.storageService.store(bee.NEW_THEME_NOTIFICATION_KEY,!0,-1,0)}if(!await new Promise(o=>{this.notificationService.prompt(ft.Info,d(18028,null,this.getColorTheme().label),[ii({id:"themeUpdated.tryItOut",label:d(18029,null),run:()=>o(!0)}),ii({id:"themeUpdated.noThanks",label:d(18027,null),run:()=>o(!1)})],{onCancel:()=>o(!1)})})){let o=this.colorThemeRegistry.findThemeBySettingsId(e);o&&this.setColorTheme(o.id,"auto")}}migrateColorThemeSettings(){let e=["workbench.colorTheme","workbench.preferredDarkColorTheme","workbench.preferredLightColorTheme","workbench.preferredHighContrastColorTheme","workbench.preferredHighContrastLightColorTheme"];for(let t of e){let o=this.configurationService.inspect(t);for(let[n,r]of[[2,o.userValue],[4,o.userRemoteValue],[5,o.workspaceValue]])if(r){let s=m6e(r);s!==r&&this.configurationService.updateValue(t,s,n)}}}installConfigurationListener(){this._register(this.configurationService.onDidChangeConfiguration(e=>{if((e.affectsConfiguration("workbench.colorTheme")||e.affectsConfiguration("workbench.preferredDarkColorTheme")||e.affectsConfiguration("workbench.preferredLightColorTheme")||e.affectsConfiguration("workbench.preferredHighContrastColorTheme")||e.affectsConfiguration("workbench.preferredHighContrastLightColorTheme")||e.affectsConfiguration("window.autoDetectColorScheme")||e.affectsConfiguration("window.autoDetectHighContrast")||e.affectsConfiguration("window.systemColorTheme"))&&this.restoreColorTheme(),e.affectsConfiguration("workbench.iconTheme")&&this.restoreFileIconTheme(),e.affectsConfiguration("workbench.productIconTheme")&&this.restoreProductIconTheme(),this.currentColorTheme){let t=!1;e.affectsConfiguration("workbench.colorCustomizations")&&(this.currentColorTheme.setCustomColors(this.settings.colorCustomizations),t=!0),e.affectsConfiguration("editor.tokenColorCustomizations")&&(this.currentColorTheme.setCustomTokenColors(this.settings.tokenColorCustomizations),t=!0),e.affectsConfiguration("editor.semanticTokenColorCustomizations")&&(this.currentColorTheme.setCustomSemanticTokenColors(this.settings.semanticTokenColorCustomizations),t=!0),t&&(this.updateDynamicCSSRules(this.currentColorTheme),this.onColorThemeChange.fire(this.currentColorTheme))}}))}installRegistryListeners(){let e;this._register(this.colorThemeRegistry.onDidChange(async n=>{if(OCi(n.themes),await this.restoreColorTheme())this.currentColorTheme.settingsId===rl.COLOR_THEME_DARK&&!gn(e)&&await this.colorThemeRegistry.findThemeById(e)?(await this.setColorTheme(e,"auto"),e=void 0):n.added.some(r=>r.settingsId===this.currentColorTheme.settingsId)&&await this.reloadCurrentColorTheme();else if(n.removed.some(r=>r.settingsId===this.currentColorTheme.settingsId)){e=this.currentColorTheme.id;let r=this.colorThemeRegistry.findThemeBySettingsId(rl.COLOR_THEME_DARK);await this.setColorTheme(r,"auto")}}));let t;this._register(this._register(this.fileIconThemeRegistry.onDidChange(async n=>{FCi(n.themes),await this.restoreFileIconTheme()?this.currentFileIconTheme.id===UCi&&!gn(t)&&this.fileIconThemeRegistry.findThemeById(t)?(await this.setFileIconTheme(t,"auto"),t=void 0):n.added.some(r=>r.settingsId===this.currentFileIconTheme.settingsId)&&await this.reloadCurrentFileIconTheme():n.removed.some(r=>r.settingsId===this.currentFileIconTheme.settingsId)&&(t=this.currentFileIconTheme.id,await this.setFileIconTheme(UCi,"auto"))})));let o;return this._register(this.productIconThemeRegistry.onDidChange(async n=>{WCi(n.themes),await this.restoreProductIconTheme()?this.currentProductIconTheme.id===fme&&!gn(o)&&this.productIconThemeRegistry.findThemeById(o)?(await this.setProductIconTheme(o,"auto"),o=void 0):n.added.some(r=>r.settingsId===this.currentProductIconTheme.settingsId)&&await this.reloadCurrentProductIconTheme():n.removed.some(r=>r.settingsId===this.currentProductIconTheme.settingsId)&&(o=this.currentProductIconTheme.id,await this.setProductIconTheme(fme,"auto"))})),this._register(this.languageService.onDidChange(()=>this.reloadCurrentFileIconTheme())),Promise.all([this.getColorThemes(),this.getFileIconThemes(),this.getProductIconThemes()]).then(([n,r,s])=>{OCi(n),FCi(r),WCi(s)})}installPreferredSchemeListener(){this._register(this.hostColorService.onDidChangeColorScheme(()=>{this.settings.isDetectingColorScheme()&&this.restoreColorTheme()}))}getColorTheme(){return this.currentColorTheme}async getColorThemes(){return this.colorThemeRegistry.getThemes()}getPreferredColorScheme(){return this.settings.getPreferredColorScheme()}async getMarketplaceColorThemes(e,t,o){let n=await this.extensionResourceLoaderService.getExtensionGalleryResourceURL({publisher:e,name:t,version:o},"extension");if(n)try{let r=await this.extensionResourceLoaderService.readExtensionResource(Ge(n,"package.json"));return this.colorThemeRegistry.getMarketplaceThemes(JSON.parse(r),n,nT.fromName(e,t))}catch(r){this.logService.error("Problem loading themes from marketplace",r)}return[]}get onDidColorThemeChange(){return this.onColorThemeChange.event}setColorTheme(e,t){return this.colorThemeSequencer.queue(async()=>this.internalSetColorTheme(e,t))}async internalSetColorTheme(e,t){if(!e)return null;let o=Fe(e)?f7o(e):e.id;if(this.currentColorTheme.isLoaded&&o===this.currentColorTheme.id)return t!=="preview"&&this.currentColorTheme.toStorage(this.storageService),this.settings.setColorTheme(this.currentColorTheme,t);let n=this.colorThemeRegistry.findThemeById(o);if(!n)if(e instanceof B3)n=e;else return null;try{return await n.ensureLoaded(this.extensionResourceLoaderService),n.setCustomizations(this.settings),this.applyTheme(n,t)}catch(r){throw new Error(d(18026,null,n.location?.toString(),r.message))}}reloadCurrentColorTheme(){return this.colorThemeSequencer.queue(async()=>{try{let e=this.colorThemeRegistry.findThemeBySettingsId(this.currentColorTheme.settingsId)||this.currentColorTheme;await e.reload(this.extensionResourceLoaderService),e.setCustomizations(this.settings),await this.applyTheme(e,void 0,!1)}catch{this.logService.info("Unable to reload {0}: {1}",this.currentColorTheme.location?.toString())}})}async restoreColorTheme(){return this.colorThemeSequencer.queue(async()=>{let e=this.settings.colorTheme,t=this.colorThemeRegistry.findThemeBySettingsId(e);return t?(e!==this.currentColorTheme.settingsId?await this.internalSetColorTheme(t.id,void 0):t!==this.currentColorTheme&&(await t.ensureLoaded(this.extensionResourceLoaderService),t.setCustomizations(this.settings),await this.applyTheme(t,void 0,!0)),!0):!1})}updateDynamicCSSRules(e){let t=jdo(e,".monaco-workbench",Ydo.getThemingParticipants(),this.environmentService);zCi(t.code,m7o)}applyTheme(e,t,o=!1){return this.updateDynamicCSSRules(e),this.currentColorTheme.id?this.container.classList.remove(...this.currentColorTheme.classNames):this.container.classList.remove("vs","vs-dark","hc-black","hc-light"),this.container.classList.add(...e.classNames),this.currentColorTheme.clearCaches(),this.currentColorTheme=e,this.colorThemingParticipantChangeListener||(this.colorThemingParticipantChangeListener=Ydo.onThemingParticipantAdded(n=>this.updateDynamicCSSRules(this.currentColorTheme))),this.colorThemeWatcher.update(e),this.sendTelemetry(e.id,e.extensionData,"color"),o?Promise.resolve(null):(this.onColorThemeChange.fire(this.currentColorTheme),e.isLoaded&&t!=="preview"&&e.toStorage(this.storageService),this.settings.setColorTheme(this.currentColorTheme,t))}sendTelemetry(e,t,o){if(t){let n=o+t.extensionId;this.themeExtensionsActivated.get(n)||(this.telemetryService.publicLog2("activateThemeExtension",{id:t.extensionId,name:t.extensionName,isBuiltin:t.extensionIsBuiltin,publisherDisplayName:t.extensionPublisher,themeId:e}),this.themeExtensionsActivated.set(n,!0))}}async getFileIconThemes(){return this.fileIconThemeRegistry.getThemes()}getFileIconTheme(){return this.currentFileIconTheme}get onDidFileIconThemeChange(){return this.onFileIconThemeChange.event}async setFileIconTheme(e,t){return this.fileIconThemeSequencer.queue(async()=>this.internalSetFileIconTheme(e,t))}async internalSetFileIconTheme(e,t){e===void 0&&(e="");let o=Fe(e)?e:e.id;if(o!==this.currentFileIconTheme.id||!this.currentFileIconTheme.isLoaded){let r=this.fileIconThemeRegistry.findThemeById(o);!r&&e instanceof CH&&(r=e),r||(r=CH.noIconTheme),await r.ensureLoaded(this.fileIconThemeLoader),this.applyAndSetFileIconTheme(r)}let n=this.currentFileIconTheme;return n.isLoaded&&t!=="preview"&&(!n.location||!b5(n.location))&&n.toStorage(this.storageService),await this.settings.setFileIconTheme(this.currentFileIconTheme,t),n}async getMarketplaceFileIconThemes(e,t,o){let n=await this.extensionResourceLoaderService.getExtensionGalleryResourceURL({publisher:e,name:t,version:o},"extension");if(n)try{let r=await this.extensionResourceLoaderService.readExtensionResource(Ge(n,"package.json"));return this.fileIconThemeRegistry.getMarketplaceThemes(JSON.parse(r),n,nT.fromName(e,t))}catch(r){this.logService.error("Problem loading themes from marketplace",r)}return[]}async reloadCurrentFileIconTheme(){return this.fileIconThemeSequencer.queue(async()=>{await this.currentFileIconTheme.reload(this.fileIconThemeLoader),this.applyAndSetFileIconTheme(this.currentFileIconTheme)})}async restoreFileIconTheme(){return this.fileIconThemeSequencer.queue(async()=>{let e=this.settings.fileIconTheme,t=this.fileIconThemeRegistry.findThemeBySettingsId(e);return t?(e!==this.currentFileIconTheme.settingsId?await this.internalSetFileIconTheme(t.id,void 0):t!==this.currentFileIconTheme&&(await t.ensureLoaded(this.fileIconThemeLoader),this.applyAndSetFileIconTheme(t,!0)),!0):!1})}applyAndSetFileIconTheme(e,t=!1){this.currentFileIconTheme=e,zCi(e.styleSheetContent,h7o),e.id?this.container.classList.add(Qdo):this.container.classList.remove(Qdo),this.fileIconThemeWatcher.update(e),e.id&&this.sendTelemetry(e.id,e.extensionData,"fileIcon"),t||this.onFileIconThemeChange.fire(this.currentFileIconTheme)}async getProductIconThemes(){return this.productIconThemeRegistry.getThemes()}getProductIconTheme(){return this.currentProductIconTheme}get onDidProductIconThemeChange(){return this.onProductIconThemeChange.event}async setProductIconTheme(e,t){return this.productIconThemeSequencer.queue(async()=>this.internalSetProductIconTheme(e,t))}async internalSetProductIconTheme(e,t){e===void 0&&(e="");let o=Fe(e)?e:e.id;if(o!==this.currentProductIconTheme.id||!this.currentProductIconTheme.isLoaded){let r=this.productIconThemeRegistry.findThemeById(o);!r&&e instanceof xH&&(r=e),r||(r=xH.defaultTheme),await r.ensureLoaded(this.extensionResourceLoaderService,this.logService),this.applyAndSetProductIconTheme(r)}let n=this.currentProductIconTheme;return n.isLoaded&&t!=="preview"&&(!n.location||!b5(n.location))&&n.toStorage(this.storageService),await this.settings.setProductIconTheme(this.currentProductIconTheme,t),n}async getMarketplaceProductIconThemes(e,t,o){let n=await this.extensionResourceLoaderService.getExtensionGalleryResourceURL({publisher:e,name:t,version:o},"extension");if(n)try{let r=await this.extensionResourceLoaderService.readExtensionResource(Ge(n,"package.json"));return this.productIconThemeRegistry.getMarketplaceThemes(JSON.parse(r),n,nT.fromName(e,t))}catch(r){this.logService.error("Problem loading themes from marketplace",r)}return[]}async reloadCurrentProductIconTheme(){return this.productIconThemeSequencer.queue(async()=>{await this.currentProductIconTheme.reload(this.extensionResourceLoaderService,this.logService),this.applyAndSetProductIconTheme(this.currentProductIconTheme)})}async restoreProductIconTheme(){return this.productIconThemeSequencer.queue(async()=>{let e=this.settings.productIconTheme,t=this.productIconThemeRegistry.findThemeBySettingsId(e);return t?(e!==this.currentProductIconTheme.settingsId?await this.internalSetProductIconTheme(t.id,void 0):t!==this.currentProductIconTheme&&(await t.ensureLoaded(this.extensionResourceLoaderService,this.logService),this.applyAndSetProductIconTheme(t,!0)),!0):!1})}applyAndSetProductIconTheme(e,t=!1){this.currentProductIconTheme=e,zCi(e.styleSheetContent,g7o),this.productIconThemeWatcher.update(e),e.id&&this.sendTelemetry(e.id,e.extensionData,"productIcon"),t||this.onProductIconThemeChange.fire(this.currentProductIconTheme)}};bee=I([m(0,lt),m(1,ce),m(2,B),m(3,Te),m(4,cd),m(5,fe),m(6,mk),m(7,yi),m(8,se),m(9,AVt),m(10,U3),m(11,_t),m(12,Ne),m(13,Zt)],bee);var TZe=class{constructor(i,e,t){this.fileService=i;this.environmentService=e;this.onUpdate=t;this.watcherDisposables=new N}update(i){Qe(i.location,this.watchedLocation)||(this.watchedLocation=void 0,this.watcherDisposables.clear(),i.location&&(i.watch||this.environmentService.isExtensionDevelopment)&&(this.watchedLocation=i.location,this.watcherDisposables.add(this.fileService.watch(i.location)),this.watcherDisposables.add(this.fileService.onDidFilesChange(e=>{this.watchedLocation&&e.contains(this.watchedLocation,0)&&this.onUpdate()}))))}dispose(){this.watcherDisposables.dispose(),this.watchedLocation=void 0}};function zCi(a,i){let e=ut.document.head.getElementsByClassName(i);if(e.length===0){let t=Cr();t.className=i,t.textContent=a}else e[0].textContent=a}Ado();Rdo();zdo();Ee(sp,bee,0);var I7o=Rn.registerExtensionPoint({extensionPoint:"resourceLabelFormatters",jsonSchema:{description:d(17828,null),type:"array",items:{type:"object",required:["scheme","formatting"],properties:{scheme:{type:"string",description:d(17833,null)},authority:{type:"string",description:d(17829,null)},formatting:{description:d(17830,null),type:"object",properties:{label:{type:"string",description:d(17832,null)},separator:{type:"string",description:d(17834,null)},stripPathStartingSeparator:{type:"boolean",description:d(17835,null)},tildify:{type:"boolean",description:d(17836,null)},workspaceSuffix:{type:"string",description:d(17831,null)}}}}}}}),y7o=/\//g,w7o=/[\\\/]/g,C7o=/\$\{(scheme|authoritySuffix|authority|path|(query)\.(.+?))\}/g;function x7o(a){return!!(a&&a[2]===":")}var _Ze=class{constructor(i){this.formattersDisposables=new Map;I7o.setHandler((e,t)=>{for(let o of t.added)for(let n of o.value){let r={...n};typeof r.formatting.label!="string"&&(r.formatting.label="${authority}${path}"),typeof r.formatting.separator!="string"&&(r.formatting.separator=Qd),!Ua(o.description,"contribLabelFormatterWorkspaceTooltip")&&r.formatting.workspaceTooltip&&(r.formatting.workspaceTooltip=void 0),this.formattersDisposables.set(r,i.registerFormatter(r))}for(let o of t.removed)for(let n of o.value)Be(this.formattersDisposables.get(n))})}};_Ze=I([m(0,rt)],_Ze);ne.as(Qi.Workbench).registerWorkbenchContribution(_Ze,3);var Xdo=50,DZe=class extends x{constructor(e,t,o,n,r,s){super();this.environmentService=e;this.contextService=t;this.pathService=o;this.remoteAgentService=n;this._onDidChangeFormatters=this._register(new E({leakWarningThreshold:400}));this.onDidChangeFormatters=this._onDidChangeFormatters.event;this.os=Po,this.userHome=o.defaultUriScheme===Q.file?this.pathService.userHome({preferLocal:!0}):void 0;let l=this.storedFormattersMemento=new Al("cachedResourceLabelFormatters2",r);this.storedFormatters=l.getMemento(0,1),this.formatters=this.storedFormatters?.formatters?.slice()||[],this.resolveRemoteEnvironment()}async resolveRemoteEnvironment(){let e=await this.remoteAgentService.getEnvironment();this.os=e?.os??Po,this.userHome=await this.pathService.userHome()}findFormatting(e){let t;for(let o of this.formatters)if(o.scheme===e.scheme){if(!o.authority&&(!t||o.priority)){t=o;continue}if(!o.authority)continue;Ed(o.authority,e.authority,{ignoreCase:!0})&&(!t?.authority||o.authority.length>t.authority.length||o.authority.length===t.authority.length&&o.priority)&&(t=o)}return t?t.formatting:void 0}getUriLabel(e,t={}){let o=this.findFormatting(e);o&&t.separator&&(o={...o,separator:t.separator});let n=this.doGetUriLabel(e,o,t);return!o&&t.separator&&(n=this.adjustPathSeparators(n,t.separator)),t.appendWorkspaceSuffix&&o?.workspaceSuffix&&(n=this.appendWorkspaceSuffix(n,e)),n}doGetUriLabel(e,t,o={}){if(!t)return $4i(e,{os:this.os,tildify:this.userHome?{userHome:this.userHome}:void 0,relative:o.relative?{noPrefix:o.noPrefix,getWorkspace:()=>this.contextService.getWorkspace(),getWorkspaceFolder:n=>this.contextService.getWorkspaceFolder(n)}:void 0});if(o.relative&&this.contextService){let n=this.contextService.getWorkspaceFolder(e);if(!n){let s=this.contextService.getWorkspace().folders.at(0);s&&e.scheme!==s.uri.scheme&&e.path.startsWith(Oo.sep)&&(n=this.contextService.getWorkspaceFolder(s.uri.with({path:e.path})))}if(n){let r=this.formatUri(n.uri,t,o.noPrefix),s=this.formatUri(e,t,o.noPrefix),l=0;for(;s[l]&&s[l]===r[l];)l++;if(!s[l]||s[l]===t.separator?s=s.substring(1+l):l===r.length&&n.uri.path===Oo.sep&&(s=s.substring(l)),this.contextService.getWorkspace().folders.length>1&&!o.noPrefix){let u=n?.name??Ga(n.uri);s=s?`${u} \u2022 ${s}`:u}return s}}return this.formatUri(e,t,o.noPrefix)}getUriBasenameLabel(e){let t=this.findFormatting(e),o=this.doGetUriLabel(e,t),n;return t?.separator===$s.sep?n=$s:t?.separator===Oo.sep?n=Oo:n=this.os===1?$s:Oo,n.basename(o)}getWorkspaceLabel(e,t){if(Xj(e)){let o=Dg(e);return Zh(o)||ny(o)?this.getWorkspaceLabel(o,t):""}return A.isUri(e)?this.doGetSingleFolderWorkspaceLabel(e,t):Zh(e)?this.doGetSingleFolderWorkspaceLabel(e.uri,t):ny(e)?this.doGetWorkspaceLabel(e.configPath,t):""}doGetWorkspaceLabel(e,t){if(dR(e,this.environmentService))return d(17827,null);if(gw(e))return d(17826,null);let o=He(e);o.endsWith(FE)&&(o=o.substr(0,o.length-FE.length-1));let n;switch(t?.verbose){case 0:n=o;break;case 2:n=d(17838,null,this.getUriLabel(Ge(ci(e),o)));break;case 1:default:n=d(17837,null,o);break}return t?.verbose===0?n:this.appendWorkspaceSuffix(n,e)}doGetSingleFolderWorkspaceLabel(e,t){let o;switch(t?.verbose){case 2:o=this.getUriLabel(e);break;case 0:case 1:default:o=He(e)||Oo.sep;break}return t?.verbose===0?o:this.appendWorkspaceSuffix(o,e)}getSeparator(e,t){return this.findFormatting(A.from({scheme:e,authority:t}))?.separator||Oo.sep}getHostLabel(e,t){return this.findFormatting(A.from({scheme:e,authority:t}))?.workspaceSuffix||t||""}getHostTooltip(e,t){return this.findFormatting(A.from({scheme:e,authority:t}))?.workspaceTooltip}registerCachedFormatter(e){let t=this.storedFormatters.formatters??=[],o=t.findIndex(n=>n.scheme===e.scheme&&n.authority===e.authority);if(o===-1&&t.length>=Xdo&&(o=Xdo-1),o===-1)t.unshift(e);else{for(let n=o;n>0;n--)t[n]=t[n-1];t[0]=e}return this.storedFormattersMemento.saveMemento(),this.registerFormatter(e)}registerFormatter(e){return this.formatters.push(e),this._onDidChangeFormatters.fire({scheme:e.scheme}),{dispose:()=>{this.formatters=this.formatters.filter(t=>t!==e),this._onDidChangeFormatters.fire({scheme:e.scheme})}}}formatUri(e,t,o){let n=t.label.replace(C7o,(r,s,l,c)=>{switch(s){case"scheme":return e.scheme;case"authority":return e.authority;case"authoritySuffix":{let u=e.authority.indexOf("+");return u===-1?e.authority:e.authority.slice(u+1)}case"path":{let u=e.path;if(t.stripPathSegments){let p=0;for(let h=0;h<t.stripPathSegments;h++){let g=u.indexOf("/",p+1);if(g===-1)break;p=g}u=u.substring(p)}return t.stripPathStartingSeparator?u.slice(u[0]===t.separator?1:0):u}default:{if(l==="query"){let{query:u}=e;if(u&&u[0]==="{"&&u[u.length-1]==="}")try{return JSON.parse(u)[c]||""}catch{}}return""}}});return t.normalizeDriveLetter&&x7o(n)&&(n=n.charAt(1).toUpperCase()+n.substr(2)),t.tildify&&!o&&this.userHome&&(n=i5e(n,this.userHome.fsPath,this.os)),t.authorityPrefix&&e.authority&&(n=t.authorityPrefix+n),this.adjustPathSeparators(n,t.separator)}adjustPathSeparators(e,t){return e.replace(this.os===1?w7o:y7o,t)}appendWorkspaceSuffix(e,t){let o=this.findFormatting(t),n=o&&typeof o.workspaceSuffix=="string"?o.workspaceSuffix:void 0;return n?`${e} [${n}]`:e}};DZe=I([m(0,At),m(1,Pe),m(2,An),m(3,bo),m(4,ce),m(5,ji)],DZe);Ee(rt,DZe,1);var KCi="Offline";function RZe(a){return a instanceof LZe?!0:a instanceof Error&&a.name===KCi&&a.message===KCi}var LZe=class extends Error{constructor(){super(KCi),this.name=this.message}};var Jdo=/^(\^|>=)?((\d+)|x)\.((\d+)|x)\.((\d+)|x)(\-.*)?$/,k7o=/^-(\d{4})(\d{2})(\d{2})(\d{2})?(\d{2})?$/;function E7o(a){return a=a.trim(),a==="*"||Jdo.test(a)}function qCi(a){if(!E7o(a))return null;if(a=a.trim(),a==="*")return{hasCaret:!1,hasGreaterEquals:!1,majorBase:0,majorMustEqual:!1,minorBase:0,minorMustEqual:!1,patchBase:0,patchMustEqual:!1,preRelease:null};let i=a.match(Jdo);return i?{hasCaret:i[1]==="^",hasGreaterEquals:i[1]===">=",majorBase:i[2]==="x"?0:parseInt(i[2],10),majorMustEqual:i[2]!=="x",minorBase:i[4]==="x"?0:parseInt(i[4],10),minorMustEqual:i[4]!=="x",patchBase:i[6]==="x"?0:parseInt(i[6],10),patchMustEqual:i[6]!=="x",preRelease:i[8]||null}:null}function $Ci(a){if(!a)return null;let i=a.majorBase,e=a.majorMustEqual,t=a.minorBase,o=a.minorMustEqual,n=a.patchBase,r=a.patchMustEqual;a.hasCaret&&(i===0||(o=!1),r=!1);let s=0;if(a.preRelease){let l=k7o.exec(a.preRelease);if(l){let[,c,u,p,h,g]=l;s=Date.UTC(Number(c),Number(u)-1,Number(p),Number(h)||0,Number(g)||0)}}return{majorBase:i,majorMustEqual:e,minorBase:t,minorMustEqual:o,patchBase:n,patchMustEqual:r,isMinimum:a.hasGreaterEquals,notBefore:s}}function T7o(a,i,e){let t;typeof a=="string"?t=$Ci(qCi(a)):t=a;let o;i instanceof Date?o=i.getTime():typeof i=="string"&&(o=new Date(i).getTime());let n;if(typeof e=="string"?n=$Ci(qCi(e)):n=e,!t||!n)return!1;let r=t.majorBase,s=t.minorBase,l=t.patchBase,c=n.majorBase,u=n.minorBase,p=n.patchBase,h=n.notBefore,g=n.majorMustEqual,f=n.minorMustEqual,v=n.patchMustEqual;return n.isMinimum?r>c?!0:r<c?!1:s>u?!0:s<u||o&&o<h?!1:l>=p:(r===1&&c===0&&(!g||!f||!v)&&(c=1,u=0,p=0,g=!0,f=!1,v=!1),r<c?!1:r>c?!g:s<u?!1:s>u?!f:l<p?!1:l>p?!v:!(o&&o<h))}function Zdo(a,i,e,t,o,n){let r=[];if(typeof t.publisher<"u"&&typeof t.publisher!="string")return r.push([bt.Error,d(2111,null)]),r;if(typeof t.name!="string")return r.push([bt.Error,d(2110,null,"name")]),r;if(typeof t.version!="string")return r.push([bt.Error,d(2112,null,"version")]),r;if(!t.engines)return r.push([bt.Error,d(2103,null,"engines")]),r;if(typeof t.engines.vscode!="string")return r.push([bt.Error,d(2104,null,"engines.vscode")]),r;if(typeof t.extensionDependencies<"u"&&!GCi(t.extensionDependencies))return r.push([bt.Error,d(2106,null,"extensionDependencies")]),r;if(typeof t.extensionAffinity<"u"&&!GCi(t.extensionAffinity))return r.push([bt.Error,d(2105,null,"extensionAffinity")]),r;if(typeof t.activationEvents<"u"){if(!GCi(t.activationEvents))return r.push([bt.Error,d(2099,null,"activationEvents")]),r;if(typeof t.main>"u"&&typeof t.browser>"u")return r.push([bt.Error,d(2100,null,"activationEvents","main","browser")]),r}if(typeof t.extensionKind<"u"&&typeof t.main>"u"&&r.push([bt.Warning,d(2107,null,"extensionKind")]),typeof t.main<"u"){if(typeof t.main!="string")return r.push([bt.Error,d(2108,null,"main")]),r;{let c=Ge(e,t.main);ws(c,e)||r.push([bt.Warning,d(2109,null,c.path,e.path)])}}if(typeof t.browser<"u"){if(typeof t.browser!="string")return r.push([bt.Error,d(2101,null,"browser")]),r;{let c=Ge(e,t.browser);ws(c,e)||r.push([bt.Warning,d(2102,null,c.path,e.path)])}}if(!dTe(t.version))return r.push([bt.Error,d(2113,null)]),r;let s=[];if(!_7o(a,i,t,o,s))for(let c of s)r.push([bt.Error,c]);if(n&&t.enabledApiProposals?.length){let c=[];if(!z3([...t.enabledApiProposals],c))for(let u of c)r.push([bt.Error,u])}return r}function _7o(a,i,e,t,o){return t||typeof e.main>"u"&&typeof e.browser>"u"?!0:euo(a,i,e.engines.vscode,o)}function vme(a,i,e){return a==="*"||euo(i,e,a)}function z3(a,i){if(a.length===0)return!0;let e=Array.isArray(i)?i:void 0,t=(Array.isArray(i)?void 0:i)??vK,o=[],n=oYi(a);for(let{proposalName:r,version:s}of n){if(!s)continue;t[r]?.version!==s&&o.push(r)}return o.length?(e&&(o.length===1?e.push(d(2097,null,o[0])):e.push(d(2098,null,o.slice(0,o.length-1).map(r=>`'${r}'`).join(", "),o[o.length-1]))),!1):!0}function euo(a,i,e,t=[]){let o=$Ci(qCi(e));if(!o)return t.push(d(2117,null,e)),!1;if(o.majorBase===0){if(!o.majorMustEqual||!o.minorMustEqual)return t.push(d(2115,null,e)),!1}else if(!o.majorMustEqual)return t.push(d(2116,null,e)),!1;return T7o(a,i,o)?!0:(t.push(d(2114,null,a,e)),!1)}function GCi(a){if(!Array.isArray(a))return!1;for(let i=0,e=a.length;i<e;i++)if(typeof a[i]!="string")return!1;return!0}async function WVt(a,i,e,t,o,n,r){let s={"X-Market-Client-Id":`VSCode ${a}`,"User-Agent":`VSCode ${a} (${i.nameShort})`};if(DR(i,e)&&JE(t)===3){let l=await IF(e,o,n);s["X-Market-User-Id"]=l,s["VSCode-SessionId"]=r.machineId||l}return s}var VVt=Wt?"web":fTt(om,QSe),zVt="X-Market-Search-Activity-Id",jCi="Activityid",QCi="Server",YCi="X-Vss-E2eid",qw={Icon:"Microsoft.VisualStudio.Services.Icons.Default",Details:"Microsoft.VisualStudio.Services.Content.Details",Changelog:"Microsoft.VisualStudio.Services.Content.Changelog",Manifest:"Microsoft.VisualStudio.Code.Manifest",VSIX:"Microsoft.VisualStudio.Services.VSIXPackage",License:"Microsoft.VisualStudio.Services.Content.License",Repository:"Microsoft.VisualStudio.Services.Links.Source",Signature:"Microsoft.VisualStudio.Services.VsixSignature"},EH={Dependency:"Microsoft.VisualStudio.Code.ExtensionDependencies",ExtensionPack:"Microsoft.VisualStudio.Code.ExtensionPack",Engine:"Microsoft.VisualStudio.Code.Engine",PreRelease:"Microsoft.VisualStudio.Code.PreRelease",EnabledApiProposals:"Microsoft.VisualStudio.Code.EnabledApiProposals",LocalizedLanguages:"Microsoft.VisualStudio.Code.LocalizedLanguages",WebExtension:"Microsoft.VisualStudio.Code.WebExtension",SponsorLink:"Microsoft.VisualStudio.Code.SponsorLink",SupportLink:"Microsoft.VisualStudio.Services.Links.Support",ExecutesCode:"Microsoft.VisualStudio.Code.ExecutesCode",Private:"PrivateMarketplace"},R7o=10,M7o={pageNumber:1,pageSize:R7o,sortBy:"NoneOrRelevance",sortOrder:0,flags:[],criteria:[],assetTypes:[]};var GRe=class a{constructor(i=M7o){this.state=i}get pageNumber(){return this.state.pageNumber}get pageSize(){return this.state.pageSize}get sortBy(){return this.state.sortBy}get sortOrder(){return this.state.sortOrder}get flags(){return this.state.flags}get criteria(){return this.state.criteria}get assetTypes(){return this.state.assetTypes}get source(){return this.state.source}get searchText(){let i=this.state.criteria.filter(e=>e.filterType==="SearchText")[0];return i&&i.value?i.value:""}withPage(i,e=this.state.pageSize){return new a({...this.state,pageNumber:i,pageSize:e})}withFilter(i,...e){let t=[...this.state.criteria,...e.length?e.map(o=>({filterType:i,value:o})):[{filterType:i}]];return new a({...this.state,criteria:t})}withSortBy(i){return new a({...this.state,sortBy:i})}withSortOrder(i){return new a({...this.state,sortOrder:i})}withFlags(...i){return new a({...this.state,flags:zo(i)})}withAssetTypes(...i){return new a({...this.state,assetTypes:i})}withSource(i){return new a({...this.state,source:i})}};function XCi(a,i){let e=(a||[]).filter(t=>t.statisticName===i)[0];return e?e.value:0}function P7o(a){let i="Microsoft.VisualStudio.Code.Translation.";return a.files.filter(t=>t.assetType.indexOf(i)===0).reduce((t,o)=>{let n=kH(a,o.assetType);return n&&t.push([o.assetType.substring(i.length),n]),t},[])}function A7o(a){if(a.properties){let i=a.properties.filter(o=>o.key===qw.Repository),e=new RegExp("((git|ssh|http(s)?)|(git@[\\w.]+))(:(//)?)([\\w.@:/\\-~]+)(.git)(/)?"),t=i.filter(o=>e.test(o.value))[0];return t?{uri:t.value,fallbackUri:t.value}:null}return kH(a,qw.Repository)}function N7o(a){return{uri:`${a.fallbackAssetUri}/${qw.VSIX}?redirect=true${a.targetPlatform?`&targetPlatform=${a.targetPlatform}`:""}`,fallbackUri:`${a.fallbackAssetUri}/${qw.VSIX}${a.targetPlatform?`?targetPlatform=${a.targetPlatform}`:""}`}}function kH(a,i){return a.files.filter(t=>t.assetType===i)[0]?{uri:`${a.assetUri}/${i}${a.targetPlatform?`?targetPlatform=${a.targetPlatform}`:""}`,fallbackUri:`${a.fallbackAssetUri}/${i}${a.targetPlatform?`?targetPlatform=${a.targetPlatform}`:""}`}:null}function tuo(a,i){let e=a.properties?a.properties.filter(o=>o.key===i):[],t=e.length>0&&e[0].value;return t?t.split(",").map(o=>Cde(o)):[]}function KVt(a){let i=a.properties?a.properties.filter(e=>e.key===EH.Engine):[];return i.length>0&&i[0].value||""}function O7o(a,i){a.properties=a.properties??[],a.properties.push({key:EH.Engine,value:i})}function qRe(a){let i=a.properties?a.properties.filter(e=>e.key===EH.PreRelease):[];return i.length>0&&i[0].value==="true"}function ruo(a,i){return i.extensionProperties?.[a.toLowerCase()]?.hasPrereleaseVersion}function F7o(a,i){return i.extensionProperties?.[a.toLowerCase()]?.excludeVersionRange}function W7o(a){let i=a.properties?a.properties.filter(e=>e.key===EH.Private):[];return i.length>0&&i[0].value==="true"}function V7o(a){let i=a.properties?a.properties.filter(e=>e.key===EH.ExecutesCode):[];return i.length>0?i[0].value==="true":void 0}function ZCi(a){let i=a.properties?a.properties.filter(t=>t.key===EH.EnabledApiProposals):[],e=i.length>0&&i[0].value||"";return e?e.split(","):[]}function B7o(a){let i=a.properties?a.properties.filter(t=>t.key===EH.LocalizedLanguages):[],e=i.length>0&&i[0].value||"";return e?e.split(","):[]}function H7o(a){return a.properties?.find(i=>i.key===EH.SponsorLink)?.value}function U7o(a){return a.properties?.find(i=>i.key===EH.SupportLink)?.value}function z7o(a){return a.indexOf("preview")!==-1}function bme(a){return a.targetPlatform?nJi(a.targetPlatform):"undefined"}function BVt(a){let i=zo(a.versions.map(bme)),e=!!a.tags?.includes(hTt),t=i.indexOf("web");return e?t===-1&&i.push("web"):t!==-1&&i.splice(t,1),i}function iuo(a,i){for(let e=0;e<a.length;e++){let t=a[e];if(t.version===a[e-1]?.version){let o=e;if(bme(t)===i)for(;o>0&&a[o-1].version===t.version;)o--;o!==e&&(a.splice(e,1),a.splice(o,0,t))}}return a}function K7o(a,i,e){let t=[],o=-1,n=-1;for(let r of a){let s=bme(r);if(!Sde(s,e,i)){t.push(r);continue}qRe(r)?o===-1?(o=t.length,t.push(r)):s===i&&t[o].version===r.version&&(t[o]=r):n===-1?(n=t.length,t.push(r)):s===i&&t[n].version===r.version&&(t[n]=r)}return t}function ouo(a,i,e){a.telemetryData={index:i,querySource:e,queryActivityId:a.queryContext?.[zVt]}}function JCi(a,i,e,t,o,n){let r=a.versions[0],s={manifest:kH(i,qw.Manifest),readme:kH(i,qw.Details),changelog:kH(i,qw.Changelog),license:kH(i,qw.License),repository:A7o(i),download:N7o(i),icon:kH(i,qw.Icon),signature:kH(i,qw.Signature),coreTranslations:P7o(i)},l=YP(t,a.linkType??"ExtensionDetailsViewUriTemplate"),c=YP(t,a.publisher.linkType??"PublisherViewUriTemplate"),u=YP(t,a.ratingLinkType??"ExtensionRatingViewUriTemplate"),p=Qf(a.publisher.publisherName,a.extensionName);return{type:"gallery",identifier:{id:p,uuid:a.extensionId},name:a.extensionName,version:i.version,displayName:a.displayName,publisherId:a.publisher.publisherId,publisher:a.publisher.publisherName,publisherDisplayName:a.publisher.displayName,publisherDomain:a.publisher.domain?{link:a.publisher.domain,verified:!!a.publisher.isDomainVerified}:void 0,publisherSponsorLink:H7o(r),description:a.shortDescription??"",installCount:XCi(a.statistics,"install"),rating:XCi(a.statistics,"averagerating"),ratingCount:XCi(a.statistics,"ratingcount"),categories:a.categories||[],tags:a.tags||[],releaseDate:Date.parse(a.releaseDate),lastUpdated:Date.parse(a.lastUpdated),allTargetPlatforms:e,assets:s,properties:{dependencies:tuo(i,EH.Dependency),extensionPack:tuo(i,EH.ExtensionPack),engine:KVt(i),enabledApiProposals:ZCi(i),localizedLanguages:B7o(i),targetPlatform:bme(i),isPreReleaseVersion:qRe(i),executesCode:V7o(i)},hasPreReleaseVersion:ruo(p,o)??qRe(r),hasReleaseVersion:!0,private:W7o(r),preview:z7o(a.flags),isSigned:!!s.signature,queryContext:n,supportLink:U7o(r),detailsLink:l?m_(l,{publisher:a.publisher.publisherName,name:a.extensionName}):void 0,publisherLink:c?m_(c,{publisher:a.publisher.publisherName}):void 0,ratingLink:u?m_(u,{publisher:a.publisher.publisherName,name:a.extensionName}):void 0}}var See=class{constructor(i,e,t,o,n,r,s,l,c,u){this.requestService=e;this.logService=t;this.environmentService=o;this.telemetryService=n;this.fileService=r;this.productService=s;this.configurationService=l;this.allowedExtensionsService=c;this.extensionGalleryManifestService=u;this.extensionsControlUrl=s.extensionsGallery?.controlUrl,this.unpkgResourceApi=s.extensionsGallery?.extensionUrlTemplate,this.extensionsEnabledWithApiProposalVersion=s.extensionsEnabledWithApiProposalVersion?.map(p=>p.toLowerCase())??[],this.commonHeadersPromise=WVt(s.version,s,this.environmentService,this.configurationService,this.fileService,i,this.telemetryService)}isEnabled(){return this.extensionGalleryManifestService.extensionGalleryManifestStatus==="available"}async getExtensions(i,e,t){let o=await this.extensionGalleryManifestService.getExtensionGalleryManifest();if(!o)throw new Error("No extension gallery service configured.");let n=Se.isCancellationToken(e)?{}:e,r=Se.isCancellationToken(e)?e:t,s=this.getResourceApi(o),l=s?await this.getExtensionsUsingResourceApi(i,n,s,o,r):await this.getExtensionsUsingQueryApi(i,n,o,r),c=l.map(p=>p.identifier.uuid),u=[];for(let p of i)p.uuid&&!c.includes(p.uuid)&&u.push({...p,uuid:void 0});if(u.length){this.telemetryService.publicLog2("galleryService:additionalQueryByName",{count:u.length});let p=await this.getExtensionsUsingQueryApi(u,n,o,r);l.push(...p)}return l}getResourceApi(i){let e=YP(i,"ExtensionLatestVersionUriTemplate");if(e)return{uri:e,fallback:this.unpkgResourceApi}}async getExtensionsUsingQueryApi(i,e,t,o){let n=[],r=[],s=[],l=[],c=!0;for(let h of i)h.uuid?r.push(h.uuid):n.push(h.id),h.version?l.push({id:h.id,uuid:h.uuid,version:h.version}):s.push({id:h.id,uuid:h.uuid,includePreRelease:!!h.preRelease}),c=c&&!!h.hasPreRelease&&!h.preRelease;if(!r.length&&!n.length)return[];let u=new GRe().withPage(1,i.length);r.length&&(u=u.withFilter("ExtensionId",...r)),n.length&&(u=u.withFilter("ExtensionName",...n)),e.queryAllVersions&&(u=u.withFlags(...u.flags,"IncludeVersions")),e.source&&(u=u.withSource(e.source));let{extensions:p}=await this.queryGalleryExtensions(u,{targetPlatform:e.targetPlatform??VVt,includePreRelease:s,versions:l,compatible:!!e.compatible,productVersion:e.productVersion??{version:this.productService.version,date:this.productService.date},isQueryForReleaseVersionFromPreReleaseVersion:c},t,o);return e.source&&p.forEach((h,g)=>ouo(h,g,e.source)),p}async getExtensionsUsingResourceApi(i,e,t,o,n){let r=[],s=[],l=[];for(let c of i)N5.test(c.id)&&(c.version?s.push(c):l.push(c));if(await Promise.all(l.map(async c=>{let u;try{u=await this.getLatestGalleryExtension(c,e,t,o,n),Fe(u)?(this.telemetryService.publicLog2("galleryService:fallbacktoquery",{extension:c.id,preRelease:!!c.preRelease,compatible:!!e.compatible,errorCode:u}),s.push(c)):r.push(u)}catch(p){if(p instanceof XE)switch(p.code){case"Offline":case"Cancelled":case"Timeout":throw p}this.logService.error(`Error while getting the latest version for the extension ${c.id}.`,Pn(p)),this.telemetryService.publicLog2("galleryService:fallbacktoquery",{extension:c.id,preRelease:!!c.preRelease,compatible:!!e.compatible,errorCode:p instanceof XE?p.code:"Unknown"}),s.push(c)}})),s.length){let c=await this.getExtensionsUsingQueryApi(s,e,o,n);r.push(...c)}return r}async getLatestGalleryExtension(i,e,t,o,n){let r=await this.getLatestRawGalleryExtensionWithFallback(i,t,n);if(!r)return"NOT_FOUND";let s=BVt(r),l=await this.getValidRawGalleryExtensionVersionFromLatestVersions(r,r.versions,i,e,s);return l?JCi(r,l,s,o,this.productService):"NOT_COMPATIBLE"}async getValidRawGalleryExtensionVersionFromLatestVersions(i,e,t,o,n){let r=o.targetPlatform??VVt,s=K7o(e,r,n),l=await this.getValidRawGalleryExtensionVersion(i,s,{targetPlatform:r,compatible:!!o.compatible,productVersion:o.productVersion??{version:this.productService.version,date:this.productService.date},version:t.preRelease?1:0},n);if(!t.preRelease)return l;let c=l,u=await this.getValidRawGalleryExtensionVersion(i,s,{targetPlatform:r,compatible:!!o.compatible,productVersion:o.productVersion??{version:this.productService.version,date:this.productService.date},version:0},n);if(c&&u)return zR(u.version,c.version)?u:c;if(o.compatible){if(u){let p=await this.getValidRawGalleryExtensionVersion(i,s,{targetPlatform:r,compatible:!1,productVersion:o.productVersion??{version:this.productService.version,date:this.productService.date},version:1},n);if(!p||zR(u.version,p.version))return u}return c}return c??u??null}async getCompatibleExtension(i,e,t,o={version:this.productService.version,date:this.productService.date}){return $ke(i.allTargetPlatforms,t)?null:await this.isExtensionCompatible(i,e,t)?i:this.allowedExtensionsService.isAllowed({id:i.identifier.id,publisherDisplayName:i.publisherDisplayName})!==!0?null:(await this.getExtensions([{...i.identifier,preRelease:e,hasPreRelease:i.hasPreReleaseVersion}],{compatible:!0,productVersion:o,queryAllVersions:!0,targetPlatform:t},Se.None))[0]??null}async isExtensionCompatible(i,e,t,o={version:this.productService.version,date:this.productService.date}){return this.isValidVersion({id:i.identifier.id,version:i.version,isPreReleaseVersion:i.properties.isPreReleaseVersion,targetPlatform:i.properties.targetPlatform,manifestAsset:i.assets.manifest,engine:i.properties.engine,enabledApiProposals:i.properties.enabledApiProposals},{targetPlatform:t,compatible:!0,productVersion:o,version:e?2:0},i.publisherDisplayName,i.allTargetPlatforms)}async isValidVersion(i,{targetPlatform:e,compatible:t,productVersion:o,version:n},r,s){let l=ruo(i.id,this.productService),c=F7o(i.id,this.productService);if(i.isPreReleaseVersion&&l===!1||c&&n9e(i.version,c))return!1;if(Fe(n)){if(i.version!==n)return!1}else if((n===0||n===1)&&i.isPreReleaseVersion!==(n===1))return!1;return!(e&&!Sde(i.targetPlatform,s,e)||t&&(this.allowedExtensionsService.isAllowed({id:i.id,publisherDisplayName:r,version:i.version,prerelease:i.isPreReleaseVersion,targetPlatform:i.targetPlatform})!==!0||!this.areApiProposalsCompatible(i.id,i.enabledApiProposals)||!await this.isEngineValid(i.id,i.version,i.engine,i.manifestAsset,o)))}areApiProposalsCompatible(i,e){return!e||!this.extensionsEnabledWithApiProposalVersion.includes(i.toLowerCase())?!0:z3(e)}async isEngineValid(i,e,t,o,n){if(!t)try{t=await this.getEngine(i,e,o)}catch(r){return this.logService.error(`Error while getting the engine for the version ${e}.`,Pn(r)),!1}return t?vme(t,n.version,n.date):(this.logService.error(`Missing engine for the extension ${i} with version ${e}`),!1)}async getEngine(i,e,t){if(!t){this.logService.error(`Missing engine and manifest asset for the extension ${i} with version ${e}`);return}try{this.telemetryService.publicLog2("galleryService:engineFallback",{extension:i,extensionVersion:e});let o={"Accept-Encoding":"gzip"},n=await this.getAsset(i,t,qw.Manifest,e,"extensionGalleryService.engineVersion",{headers:o}),r=await If(n);if(!r){this.logService.error(`Manifest was not found for the extension ${i} with version ${e}`);return}return r.engines.vscode}catch(o){this.logService.error(`Error while getting the engine for the version ${e}.`,Pn(o));return}}async query(i,e){let t=await this.extensionGalleryManifestService.getExtensionGalleryManifest();if(!t)throw new Error("No extension gallery service configured.");let o=i.text||"",n=i.pageSize??50,r=new GRe().withPage(1,n);o?(o=o.replace(/\bcategory:("([^"]*)"|([^"]\S*))(\s+|\b|$)/g,(p,h,g)=>(r=r.withFilter("Category",g||h),"")),o=o.replace(/\btag:("([^"]*)"|([^"]\S*))(\s+|\b|$)/g,(p,h,g)=>(r=r.withFilter("Tag",g||h),"")),o=o.replace(/\bfeatured(\s+|\b|$)/g,()=>(r=r.withFilter("Featured"),"")),o=o.trim(),o&&(o=o.length<200?o:o.substring(0,200),r=r.withFilter("SearchText",o)),t.capabilities.extensionQuery.sorting?.some(p=>p.name==="NoneOrRelevance")&&(r=r.withSortBy("NoneOrRelevance"))):t.capabilities.extensionQuery.sorting?.some(p=>p.name==="InstallCount")&&(r=r.withSortBy("InstallCount")),i.sortBy&&t.capabilities.extensionQuery.sorting?.some(p=>p.name===i.sortBy)&&(r=r.withSortBy(i.sortBy)),typeof i.sortOrder=="number"&&(r=r.withSortOrder(i.sortOrder)),i.source&&(r=r.withSource(i.source));let s=async(p,h)=>{let{extensions:g,total:f}=await this.queryGalleryExtensions(p,{targetPlatform:VVt,compatible:!1,includePreRelease:!!i.includePreRelease,productVersion:i.productVersion??{version:this.productService.version,date:this.productService.date}},t,h),v=[],b;for(let S=0;S<g.length;S++){let y=g[S];ouo(y,(p.pageNumber-1)*p.pageSize+S,i.source),Ut(y.identifier,{id:this.productService.defaultChatAgent.extensionId})?b=y:v.push(y)}return b&&v.push(b),{extensions:v,total:f}},{extensions:l,total:c}=await s(r,e),u=async(p,h)=>{if(h.isCancellationRequested)throw new go;let{extensions:g}=await s(r.withPage(p+1),h);return g};return{firstPage:l,total:c,pageSize:r.pageSize,getPage:u}}async queryGalleryExtensions(i,e,t,o){let n=i.flags;i.flags.includes("IncludeLatestVersionOnly")&&i.flags.includes("IncludeVersions")&&(i=i.withFlags(...i.flags.filter(h=>h!=="IncludeVersions"))),!i.flags.includes("IncludeLatestVersionOnly")&&!i.flags.includes("IncludeVersions")&&(i=i.withFlags(...i.flags,"IncludeLatestVersionOnly")),(e.versions?.length||e.isQueryForReleaseVersionFromPreReleaseVersion)&&(i=i.withFlags(...i.flags.filter(h=>h!=="IncludeLatestVersionOnly"),"IncludeVersions")),i=i.withFlags(...i.flags,"IncludeAssetUri","IncludeCategoryAndTags","IncludeFiles","IncludeStatistics","IncludeVersionProperties");let{galleryExtensions:r,total:s,context:l}=await this.queryRawGalleryExtensions(i,t,o);if(!i.flags.includes("IncludeLatestVersionOnly")){let h=[];for(let g of r){let f=BVt(g),v={id:Qf(g.publisher.publisherName,g.extensionName),uuid:g.extensionId},b=Wa(e.includePreRelease)?e.includePreRelease:!!e.includePreRelease.find(y=>Ut(y,v))?.includePreRelease,S=await this.getValidRawGalleryExtensionVersion(g,g.versions,{compatible:e.compatible,targetPlatform:e.targetPlatform,productVersion:e.productVersion,version:e.versions?.find(y=>Ut(y,v))?.version??(b?2:0)},f);S&&h.push(JCi(g,S,f,t,this.productService,l))}return{extensions:h,total:s}}let u=[],p=new Map;for(let h=0;h<r.length;h++){let g=r[h],f={id:Qf(g.publisher.publisherName,g.extensionName),uuid:g.extensionId},v=Wa(e.includePreRelease)?e.includePreRelease:!!e.includePreRelease.find(w=>Ut(w,f))?.includePreRelease,b=BVt(g);if(e.compatible&&($ke(b,e.targetPlatform)||this.allowedExtensionsService.isAllowed({id:f.id,publisherDisplayName:g.publisher.displayName})!==!0))continue;let S=await this.getValidRawGalleryExtensionVersion(g,g.versions,{compatible:e.compatible,targetPlatform:e.targetPlatform,productVersion:e.productVersion,version:e.versions?.find(w=>Ut(w,f))?.version??(v?2:0)},b),y=S?JCi(g,S,b,t,this.productService,l):null;!y||y.properties.isPreReleaseVersion&&(!v||!y.hasReleaseVersion)||!y.properties.isPreReleaseVersion&&y.properties.targetPlatform!==e.targetPlatform&&y.hasPreReleaseVersion?p.set(g.extensionId,h):u.push([h,y])}if(p.size){let h=new Dn,g=new GRe().withFlags(...n.filter(v=>v!=="IncludeLatestVersionOnly"),"IncludeVersions").withPage(1,p.size).withFilter("ExtensionId",...p.keys()),{extensions:f}=await this.queryGalleryExtensions(g,e,t,o);this.telemetryService.publicLog2("galleryService:additionalQuery",{duration:h.elapsed(),count:p.size});for(let v of f){let b=p.get(v.identifier.uuid);u.push([b,v])}}return{extensions:u.sort((h,g)=>h[0]-g[0]).map(([,h])=>h),total:s}}async getValidRawGalleryExtensionVersion(i,e,t,o){let n={id:Qf(i.publisher.publisherName,i.extensionName),uuid:i.extensionId},r=iuo(e,t.targetPlatform);if(t.compatible&&$ke(o,t.targetPlatform))return null;let s=Fe(t.version)?t.version:void 0;for(let l=0;l<r.length;l++){let c=r[l];if(t.compatible&&await this.setEngineIfNotExists(n.id,c),await this.isValidVersion({id:n.id,version:c.version,isPreReleaseVersion:qRe(c),targetPlatform:bme(c),engine:KVt(c),manifestAsset:kH(c,qw.Manifest),enabledApiProposals:ZCi(c)},t,i.publisher.displayName,o))return c;if(s&&c.version===s)return null}return s||t.compatible?null:i.versions[0]}async setEngineIfNotExists(i,e){if(!KVt(e))try{let t=await this.getEngine(i,e.version,kH(e,qw.Manifest));t&&O7o(e,t)}catch(t){this.logService.error(`Error while getting the engine for the version ${e.version}.`,Pn(t))}}async queryRawGalleryExtensions(i,e,t){let o=YP(e,"ExtensionQueryService");if(!o)throw new Error("No extension gallery query service configured.");i=i.withFlags(...i.flags,"ExcludeNonValidated").withFilter("Target","Microsoft.VisualStudio.Code");let n=e.capabilities.extensionQuery.flags?.find(g=>g.name==="Unpublished");n&&(i=i.withFilter("ExcludeWithFlags",String(n.value)));let r=JSON.stringify({filters:[{criteria:i.criteria.reduce((g,f)=>{let v=e.capabilities.extensionQuery.filtering?.find(b=>b.name===f.filterType);return v&&g.push({filterType:v.value,value:f.value}),g},[]),pageNumber:i.pageNumber,pageSize:i.pageSize,sortBy:e.capabilities.extensionQuery.sorting?.find(g=>g.name===i.sortBy)?.value,sortOrder:i.sortOrder}],assetTypes:i.assetTypes,flags:i.flags.reduce((g,f)=>{let v=e.capabilities.extensionQuery.flags?.find(b=>b.name===f);return v&&(g|=v.value),g},0)}),l={...await this.commonHeadersPromise,"Content-Type":"application/json",Accept:"application/json;api-version=3.0-preview.1","Accept-Encoding":"gzip","Content-Length":String(r.length)},c=new Dn,u,p,h=0;try{if(u=await this.requestService.request({type:"POST",url:o,data:r,headers:l,callSite:"extensionGalleryService.queryRawGalleryExtensions"},t),u.res.statusCode&&u.res.statusCode>=400&&u.res.statusCode<500)return{galleryExtensions:[],total:h};let g=await If(u);if(g){let f=g.results[0],v=f.extensions,b=f.resultMetadata&&f.resultMetadata.filter(S=>S.metadataType==="ResultCount")[0];return h=b&&b.metadataItems.filter(S=>S.name==="TotalCount")[0].count||0,{galleryExtensions:v,total:h,context:u.res.headers.activityid?{[zVt]:u.res.headers.activityid}:{}}}return{galleryExtensions:[],total:h}}catch(g){if(ao(g))throw p="Cancelled",g;{let f=Pn(g);throw p=RZe(g)?"Offline":f.startsWith("XHR timeout")?"Timeout":"Failed",new XE(f,p)}}finally{this.telemetryService.publicLog2("galleryService:query",{filterTypes:i.criteria.map(g=>g.filterType),flags:i.flags,sortBy:i.sortBy,sortOrder:String(i.sortOrder),pageNumber:String(i.pageNumber),source:i.source,searchTextLength:i.searchText.length,requestBodySize:String(r.length),duration:c.elapsed(),success:!!u&&ZP(u),responseBodySize:u?.res.headers["Content-Length"],statusCode:u?String(u.res.statusCode):void 0,errorCode:p,count:String(h),server:this.getHeaderValue(u?.res.headers,QCi),activityId:this.getHeaderValue(u?.res.headers,jCi),endToEndId:this.getHeaderValue(u?.res.headers,YCi)})}}getHeaderValue(i,e){let t=i?.[e.toLowerCase()],o=Array.isArray(t)?t[0]:t;return o?new sg(o):void 0}async getLatestRawGalleryExtensionWithFallback(i,e,t){let[o,n]=i.id.split("."),r;try{let s=A.parse(m_(e.uri,{publisher:o,name:n}));return await this.getLatestRawGalleryExtension(i.id,s,t)}catch(s){if(s instanceof XE)switch(r=s.code,s.code){case"Offline":case"Cancelled":case"Timeout":case"ClientError":throw s}else r="Unknown";if(!e.fallback)throw s}finally{this.telemetryService.publicLog2("galleryService:getmarketplacelatest",{extension:i.id,errorCode:r})}this.logService.error(`Error while getting the latest version for the extension ${i.id} from ${e.uri}. Trying the fallback ${e.fallback}`,r);try{let s=A.parse(m_(e.fallback,{publisher:o,name:n}));return await this.getLatestRawGalleryExtension(i.id,s,t)}catch(s){throw r=s instanceof XE?s.code:"Unknown",s}finally{this.telemetryService.publicLog2("galleryService:fallbacktounpkg",{extension:i.id,errorCode:r})}}async getLatestRawGalleryExtension(i,e,t){let o,n,r=new Dn;try{let l={...await this.commonHeadersPromise,"Content-Type":"application/json",Accept:"application/json;api-version=7.2-preview","Accept-Encoding":"gzip"};if(o=await this.requestService.request({type:"GET",url:e.toString(!0),headers:l,timeout:this.getRequestTimeout(),callSite:"extensionGalleryService.getLatestRawGalleryExtension"},t),o.res.statusCode===404)return n="NotFound",null;if(o.res.statusCode&&o.res.statusCode!==200)throw new Error("Unexpected HTTP response: "+o.res.statusCode);let c=await If(o);return c||(n="NoData"),c}catch(s){let l;throw ao(s)?l="Cancelled":RZe(s)?l="Offline":Pn(s).startsWith("XHR timeout")?l="Timeout":o&&LDt(o)?l="ClientError":o&&ueo(o)?l="ServerError":l="Failed",n=l,new XE(s,l)}finally{this.telemetryService.publicLog2("galleryService:getLatest",{extension:i,host:e.authority,duration:r.elapsed(),errorCode:n,statusCode:o?.res.statusCode&&o?.res.statusCode!==200?`${o.res.statusCode}`:void 0,server:this.getHeaderValue(o?.res.headers,QCi),activityId:this.getHeaderValue(o?.res.headers,jCi),endToEndId:this.getHeaderValue(o?.res.headers,YCi)})}}async reportStatistic(i,e,t,o){if(Wt){this.logService.info("ExtensionGalleryService#reportStatistic: Skipped in web");return}let n=await this.extensionGalleryManifestService.getExtensionGalleryManifest();if(!n)return;let r=YP(n,"ExtensionStatisticsUriTemplate");if(!r)return;let s=m_(r,{publisher:i,name:e,version:t,statTypeName:o}),u={...await this.commonHeadersPromise,Accept:"*/*;api-version=4.0-preview.1"};try{await this.requestService.request({type:"POST",url:s,headers:u,callSite:"extensionGalleryService.reportStatistic"},Se.None)}catch{}}async download(i,e,t){this.logService.trace("ExtensionGalleryService#download",i.identifier.id);let o=xde(i),n=new Date().getTime(),r=t===2?"install":t===3?"update":"",s=r?{uri:`${i.assets.download.uri}${A.parse(i.assets.download.uri).query?"&":"?"}${r}=true`,fallbackUri:`${i.assets.download.fallbackUri}${A.parse(i.assets.download.fallbackUri).query?"&":"?"}${r}=true`}:i.assets.download,l=i.queryContext?.[zVt],c=l&&typeof l=="string"?{[zVt]:l}:void 0,u=await this.getAsset(i.identifier.id,s,qw.VSIX,i.version,"extensionGalleryService.download",c?{headers:c}:void 0);try{await this.fileService.writeFile(e,u.stream)}catch(p){try{await this.fileService.del(e)}catch(h){this.logService.warn(`Error while deleting the file ${e.toString()}`,Pn(h))}throw new XE(Pn(p),"DownloadFailedWriting")}this.telemetryService.publicLog("galleryService:downloadVSIX",{...o,duration:new Date().getTime()-n})}async downloadSignatureArchive(i,e){if(!i.assets.signature)throw new Error("No signature asset found");this.logService.trace("ExtensionGalleryService#downloadSignatureArchive",i.identifier.id);let t=await this.getAsset(i.identifier.id,i.assets.signature,qw.Signature,i.version,"extensionGalleryService.signature");try{await this.fileService.writeFile(e,t.stream)}catch(o){try{await this.fileService.del(e)}catch(n){this.logService.warn(`Error while deleting the file ${e.toString()}`,Pn(n))}throw new XE(Pn(o),"DownloadFailedWriting")}}async getReadme(i,e){if(i.assets.readme){let t=await this.getAsset(i.identifier.id,i.assets.readme,qw.Details,i.version,"extensionGalleryService.readme",{},e);return await _w(t)||""}return""}async getManifest(i,e){if(i.assets.manifest){let t=await this.getAsset(i.identifier.id,i.assets.manifest,qw.Manifest,i.version,"extensionGalleryService.manifest",{},e),o=await _w(t);return o?JSON.parse(o):null}return null}async getCoreTranslation(i,e){let t=i.assets.coreTranslations.filter(o=>o[0]===e.toUpperCase())[0];if(t){let o=await this.getAsset(i.identifier.id,t[1],t[0],i.version,"extensionGalleryService.coreTranslation"),n=await _w(o);return n?JSON.parse(n):null}return null}async getChangelog(i,e){if(i.assets.changelog){let t=await this.getAsset(i.identifier.id,i.assets.changelog,qw.Changelog,i.version,"extensionGalleryService.changelog",{},e);return await _w(t)||""}return""}async getAllVersions(i){return this.getVersions(i)}async getAllCompatibleVersions(i,e,t){return this.getVersions(i,{version:e?2:0,targetPlatform:t})}async getVersions(i,e){let t=await this.extensionGalleryManifestService.getExtensionGalleryManifest();if(!t)throw new Error("No extension gallery service configured.");let o=new GRe().withFlags("IncludeVersions","IncludeCategoryAndTags","IncludeFiles","IncludeVersionProperties").withPage(1,1);i.uuid?o=o.withFilter("ExtensionId",i.uuid):o=o.withFilter("ExtensionName",i.id);let{galleryExtensions:n}=await this.queryRawGalleryExtensions(o,t,Se.None);if(!n.length)return[];let r=BVt(n[0]);if(e&&$ke(r,e.targetPlatform))return[];let s=[],l={version:this.productService.version,date:this.productService.date};await Promise.all(n[0].versions.map(async p=>{try{await this.isValidVersion({id:i.id,version:p.version,isPreReleaseVersion:qRe(p),targetPlatform:bme(p),engine:KVt(p),manifestAsset:kH(p,qw.Manifest),enabledApiProposals:ZCi(p)},{compatible:!!e,productVersion:l,targetPlatform:e?.targetPlatform,version:e?.version??p.version},n[0].publisher.displayName,r)&&s.push(p)}catch{}}));let c=[],u=new Map;for(let p of iuo(s,e?.targetPlatform??VVt)){let h=u.get(p.version),g=h!==void 0?c[h]:void 0,f=bme(p);g?g.targetPlatforms.push(f):(u.set(p.version,c.length),c.push({version:p.version,date:p.lastUpdated,isPreReleaseVersion:qRe(p),targetPlatforms:[f]}))}return c}async getAsset(i,e,t,o,n,r={},s=Se.None){let l=await this.commonHeadersPromise,c={type:"GET"},u={...l,...r.headers||{}};r={...r,...c,headers:u};let p=e.uri,h=e.fallbackUri,g={...r,url:p,timeout:this.getRequestTimeout(),callSite:n},f;try{if(f=await this.requestService.request(g,s),f.res.statusCode===200)return f;let v=await _w(f);throw new Error(`Expected 200, got back ${f.res.statusCode} instead.

${v}`)}catch(v){if(ao(v))throw v;let b=Pn(v);this.telemetryService.publicLog2("galleryService:cdnFallback",{extension:i,assetType:t,message:b,extensionVersion:o,server:this.getHeaderValue(f?.res.headers,QCi),activityId:this.getHeaderValue(f?.res.headers,jCi),endToEndId:this.getHeaderValue(f?.res.headers,YCi)});let S={...r,url:h,timeout:this.getRequestTimeout(),callSite:`${n}.fallback`};return this.requestService.request(S,s)}}async getExtensionsControlManifest(){if(!await this.extensionGalleryManifestService.getExtensionGalleryManifest())throw new Error("No extension gallery service configured.");if(!this.extensionsControlUrl)return{malicious:[],deprecated:{},search:[],autoUpdate:{}};let e=await this.requestService.request({type:"GET",url:this.extensionsControlUrl,timeout:this.getRequestTimeout(),callSite:"extensionGalleryService.getExtensionsControlManifest"},Se.None);if(e.res.statusCode!==200)throw new Error("Could not get extensions report.");let t=await If(e),o=[],n={},r=[],s=t?.autoUpdate??{};if(t){for(let l of t.malicious){if(!Fe(l))continue;let c=N5.test(l)?{id:l}:l;o.push({extensionOrPublisher:c,learnMoreLink:t.learnMoreLinks?.[l]})}if(t.migrateToPreRelease)for(let[l,c]of Object.entries(t.migrateToPreRelease))(!c.engine||vme(c.engine,this.productService.version,this.productService.date))&&(n[l.toLowerCase()]={disallowInstall:!0,extension:{id:c.id,displayName:c.displayName,autoMigrate:{storage:!!c.migrateStorage},preRelease:!0}});if(t.deprecated)for(let[l,c]of Object.entries(t.deprecated))c&&(n[l.toLowerCase()]=Wa(c)?{}:c);if(t.search)for(let l of t.search)r.push(l)}return n[this.productService.defaultChatAgent.extensionId.toLowerCase()]={disallowInstall:!0,extension:{id:this.productService.defaultChatAgent.chatExtensionId,displayName:"GitHub Copilot Chat",autoMigrate:{storage:!1,donotDisable:!0},preRelease:this.productService.quality!=="stable"}},{malicious:o,deprecated:n,search:r,autoUpdate:s}}getRequestTimeout(){let i=this.configurationService.getValue(vTt);return Yo(i)&&i>=0?i:6e4}};See=I([m(1,Ea),m(2,se),m(3,Eo),m(4,Te),m(5,fe),m(6,tt),m(7,B),m(8,dm),m(9,Dv)],See);var HVt=class extends See{constructor(i,e,t,o,n,r,s,l,c,u){super(i,e,t,o,n,r,s,l,c,u)}};HVt=I([m(0,ce),m(1,Ea),m(2,se),m(3,Eo),m(4,Te),m(5,fe),m(6,tt),m(7,B),m(8,dm),m(9,Dv)],HVt);var UVt=class extends See{constructor(i,e,t,o,n,r,s,l,c){super(void 0,i,e,t,o,n,r,s,l,c)}};UVt=I([m(0,Ea),m(1,se),m(2,Eo),m(3,Te),m(4,fe),m(5,tt),m(6,B),m(7,dm),m(8,Dv)],UVt);var PZe=class extends See{constructor(i,e,t,o,n,r,s,l,c,u){super(i,e,t,o,n,r,s,l,c,u)}};PZe=I([m(0,ce),m(1,Ea),m(2,se),m(3,Eo),m(4,Te),m(5,fe),m(6,tt),m(7,B),m(8,dm),m(9,Dv)],PZe);Ee(fa,PZe,1);var Y2=class extends x{constructor(e,t){super();this._onDidChangeEnablement=this._register(new E);this.onDidChangeEnablement=this._onDidChangeEnablement.event;this.storageManager=this._register(new AZe(e)),this._register(this.storageManager.onDidChange(o=>this._onDidChangeEnablement.fire({extensions:o,source:"storage"}))),this._register(t.onDidInstallExtensions(o=>o.forEach(({local:n,operation:r})=>{n&&r===4&&this._removeFromDisabledExtensions(n.identifier)})))}async enableExtension(e,t){return this._removeFromDisabledExtensions(e)?(this._onDidChangeEnablement.fire({extensions:[e],source:t}),!0):!1}async disableExtension(e,t){return this._addToDisabledExtensions(e)?(this._onDidChangeEnablement.fire({extensions:[e],source:t}),!0):!1}getDisabledExtensions(){return this._getExtensions(wX)}async getDisabledExtensionsAsync(){return this.getDisabledExtensions()}_addToDisabledExtensions(e){let t=this.getDisabledExtensions();return t.every(o=>!Ut(o,e))?(t.push(e),this._setDisabledExtensions(t),!0):!1}_removeFromDisabledExtensions(e){let t=this.getDisabledExtensions();for(let o=0;o<t.length;o++){let n=t[o];if(Ut(n,e))return t.splice(o,1),this._setDisabledExtensions(t),!0}return!1}_setDisabledExtensions(e){this._setExtensions(wX,e)}_getExtensions(e){return this.storageManager.get(e,0)}_setExtensions(e,t){this.storageManager.set(e,t,0)}};Y2=I([m(0,ce),m(1,Cs)],Y2);var AZe=class extends x{constructor(e){super();this.storageService=e;this.storage=Object.create(null);this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._register(e.onDidChangeValue(0,void 0,this._store)(t=>this.onDidStorageChange(t)))}get(e,t){let o;return t===0?(nr(this.storage[e])&&(this.storage[e]=this._get(e,t)),o=this.storage[e]):o=this._get(e,t),JSON.parse(o)}set(e,t,o){let n=JSON.stringify(t.map(({id:s,uuid:l})=>({id:s,uuid:l})));this._get(e,o)!==n&&(o===0&&(t.length?this.storage[e]=n:delete this.storage[e]),this._set(e,t.length?n:void 0,o))}onDidStorageChange(e){if(!nr(this.storage[e.key])&&this._get(e.key,e.scope)!==this.storage[e.key]){let o=this.get(e.key,e.scope);delete this.storage[e.key];let n=this.get(e.key,e.scope),r=o.filter(l=>!n.some(c=>Ut(l,c))),s=n.filter(l=>!o.some(c=>Ut(c,l)));(r.length||s.length)&&this._onDidChange.fire([...r,...s])}}_get(e,t){return this.storageService.get(e,t,"[]")}_set(e,t,o){t?this.storageService.store(e,t,o,1):this.storageService.remove(e,o)}};function qVt(){let a=ne.as(Jt.Configuration).getConfigurationProperties();return Object.keys(a).filter(i=>!!a[i].disallowSyncIgnore)}function Iee(a=!1){let i=ne.as(Jt.Configuration).getConfigurationProperties(),e=G7o(i,a),t=qVt();return zo([...e,...t])}function G7o(a,i){let e=new Set;for(let t in a){if(i&&a[t].source)continue;let o=Fe(a[t].scope)?Cft(a[t].scope):a[t].scope;(a[t].ignoreSync||o===2||o===7)&&e.add(t)}return[...e.values()]}var suo="settingsSync",q7o="settingsSync.keybindingsPerPlatform";function auo(){let a="vscode://schemas/ignoredSettings",i=ne.as(Jt.Configuration);i.registerConfiguration({id:"settingsSync",order:30,title:d(2771,null),type:"object",properties:{[q7o]:{type:"boolean",description:d(2774,null),default:!0,scope:1,tags:["sync","usesOnlineServices"]},"settingsSync.ignoredExtensions":{type:"array",markdownDescription:d(2772,null),items:[{type:"string",pattern:vF,errorMessage:d(2770,null)}],default:[],scope:1,uniqueItems:!0,disallowSyncIgnore:!0,tags:["sync","usesOnlineServices"]},"settingsSync.ignoredSettings":{type:"array",description:d(2773,null),default:[],scope:1,$ref:a,additionalProperties:!0,uniqueItems:!0,disallowSyncIgnore:!0,tags:["sync","usesOnlineServices"]}}});let e=ne.as(ma.JSONContribution),t=()=>{let o=qVt(),n=Iee(),r=Object.keys(qI.properties).filter(c=>!n.includes(c)),s=n.filter(c=>!o.includes(c)),l={items:{type:"string",enum:[...r,...s.map(c=>`-${c}`)]}};e.registerSchema(a,l)};return i.onDidUpdateConfiguration(()=>t())}var luo="0";function cuo(a){return a&&xi(a)&&Fe(a.id)&&Array.isArray(a.scopes)}var Sme=["settings","keybindings","snippets","prompts","tasks","extensions","globalState","profiles","mcp"];function exi(a,...i){return a?[a,...i]:i}function NZe(a,i,e,t){return t.joinPath(e.userDataSyncHome,...exi(a,i,`lastSync${i}.json`))}var pM=le("IUserDataSyncStoreManagementService"),A0=le("IUserDataSyncStoreService"),yee=le("IUserDataSyncLocalStoreService"),TH="x-operation-id",txi="X-Execution-Id";function OZe(a){let i={};return i[txi]=a,i}var Vg=class extends Error{constructor(e,t,o,n){super(e);this.code=t;this.resource=o;this.operationId=n;this.name=`${this.code} (UserDataSyncError) syncResource:${this.resource||"unknown"} operationId:${this.operationId||"unknown"}`}},Fm=class extends Vg{constructor(e,t,o,n,r){super(e,o,void 0,r);this.url=t;this.serverCode=n}};(i=>{function a(e){if(e instanceof i)return e;let t=/^(.+) \(UserDataSyncError\) syncResource:(.+) operationId:(.+)$/.exec(e.name);if(t&&t[1]){let o=t[2]==="unknown"?void 0:t[2],n=t[3]==="unknown"?void 0:t[3];return new i(e.message,t[1],o,n)}return new i(e.message,"Unknown")}i.toUserDataSyncError=a})(Vg||={});var _H="sync.store.url.type";function Ime(a){return`sync.enable.${a}`}var Fl=le("IUserDataSyncEnablementService"),bI=le("IUserDataSyncService"),$Re=le("IUserDataSyncResourceProviderService"),PT=le("IUserDataAutoSyncService"),wee=le("IUserDataSyncUtilService"),Dy=le("IUserDataSyncLogService"),yme="userDataSync",gx="vscode-userdata-sync",duo="preview";var jRe=le("IUserDataSyncAccountService"),$Vt=class extends x{constructor(e,t){super();this.userDataSyncStoreService=e;this.logService=t;this._onDidChangeAccount=this._register(new E);this.onDidChangeAccount=this._onDidChangeAccount.event;this._onTokenFailed=this._register(new E);this.onTokenFailed=this._onTokenFailed.event;this.wasTokenFailed=!1;this._register(e.onTokenFailed(o=>{this.logService.info("Settings Sync auth token failed",this.account?.authenticationProviderId,this.wasTokenFailed,o),this.updateAccount(void 0),o==="Forbidden"?this._onTokenFailed.fire(!0):this._onTokenFailed.fire(this.wasTokenFailed),this.wasTokenFailed=!0})),this._register(e.onTokenSucceed(()=>this.wasTokenFailed=!1))}get account(){return this._account}async updateAccount(e){(e&&this._account?e.token!==this._account.token||e.authenticationProviderId!==this._account.authenticationProviderId:e!==this._account)&&(this._account=e,this._account&&this.userDataSyncStoreService.setAuthToken(this._account.token,this._account.authenticationProviderId),this._onDidChangeAccount.fire(e))}};$Vt=I([m(0,A0),m(1,Dy)],$Vt);var K3=le("IExtensionBisectService"),FZe=class a{constructor(i,e,t,o=(e+t)/2|0){this.extensions=i;this.low=e;this.high=t;this.mid=o}static fromJSON(i){if(i)try{let e=JSON.parse(i);return new a(e.extensions,e.low,e.high,e.mid)}catch{return}}},X2=class{constructor(i,e,t){this._storageService=e;this._envService=t;this._disabled=new Map;let o=e.get(X2._storageKey,-1);if(this._state=FZe.fromJSON(o),this._state){let{mid:n,high:r}=this._state;for(let s=0;s<this._state.extensions.length;s++){let l=s>=n&&s<r;this._disabled.set(this._state.extensions[s],l)}i.warn("extension BISECT active",[...this._disabled])}}static{this._storageKey="extensionBisectState"}get isActive(){return!!this._state}get disabledCount(){return this._state?this._state.high-this._state.mid:-1}isDisabledByBisect(i){return!this._state||Zxe(i.manifest,this._envService.remoteAuthority)||this._isEnabledInEnv(i)?!1:this._disabled.get(i.identifier.id)??!1}_isEnabledInEnv(i){return Array.isArray(this._envService.enableExtensions)&&this._envService.enableExtensions.some(e=>Ut({id:e},i.identifier))}async start(i){if(this._state)throw new Error("invalid state");let e=i.map(o=>o.identifier.id),t=new FZe(e,0,e.length,0);this._storageService.store(X2._storageKey,JSON.stringify(t),-1,1),await this._storageService.flush()}async next(i){if(!this._state)throw new Error("invalid state");if(i&&this._state.mid===0&&this._state.high===this._state.extensions.length)return{bad:!0,id:""};if(this._state.low===this._state.high-1)return await this.reset(),{id:this._state.extensions[this._state.low],bad:i};let e=new FZe(this._state.extensions,i?this._state.low:this._state.mid,i?this._state.mid:this._state.high);this._storageService.store(X2._storageKey,JSON.stringify(e),-1,1),await this._storageService.flush()}async reset(){this._storageService.remove(X2._storageKey,-1),await this._storageService.flush()}};X2=I([m(0,se),m(1,ce),m(2,At)],X2);Ee(K3,X2,1);var J2=class{constructor(i,e,t,o){this._extensionBisectService=e;this._notificationService=t;this._commandService=o;e.isActive&&(J2.ctxIsBisectActive.bindTo(i).set(!0),this._showBisectPrompt())}static{this.ctxIsBisectActive=new Y("isExtensionBisectActive",!1)}_showBisectPrompt(){let i={label:d(17556,null),run:()=>this._commandService.executeCommand("extension.bisect.next",!1)},e={label:d(17565,null),run:()=>this._commandService.executeCommand("extension.bisect.next",!0)},t={label:"Stop Bisect",run:()=>this._commandService.executeCommand("extension.bisect.stop")},o=this._extensionBisectService.disabledCount===1?d(17549,null):d(17548,null,this._extensionBisectService.disabledCount);this._notificationService.prompt(ft.Info,o,[i,e,t],{sticky:!0,priority:3})}};J2=I([m(0,X),m(1,K3),m(2,Ne),m(3,ge)],J2);ne.as(Qi.Workbench).registerWorkbenchContribution(J2,3);W(class extends K{constructor(){super({id:"extension.bisect.start",title:L(17567,"Start Extension Bisect"),category:Ve.Help,f1:!0,precondition:J2.ctxIsBisectActive.negate(),menu:{id:D.ViewContainerTitle,when:C.equals("viewContainer","workbench.view.extensions"),group:"2_enablement",order:4}})}async run(a){let i=a.get(at),e=a.get(Zt),t=a.get(Cs),o=a.get(Js),n=a.get(K3),r=(await t.getInstalled(1)).filter(l=>o.isEnabled(l));(await i.confirm({message:d(17558,null),detail:d(17551,null,2+Math.log2(r.length)|0),primaryButton:d(17559,null)})).confirmed&&(await n.start(r),e.reload())}});W(class extends K{constructor(){super({id:"extension.bisect.next",title:L(17566,"Continue Extension Bisect"),category:Ve.Help,f1:!0,precondition:J2.ctxIsBisectActive})}async run(a,i){let e=a.get(at),t=a.get(Zt),o=a.get(K3),n=a.get(tt),r=a.get(fK),s=a.get(ge);if(!o.isActive)return;if(i===void 0){let c=await this._checkForBad(e,o);if(c===null)return;i=c}if(i===void 0){await o.reset(),t.reload();return}let l=await o.next(i);if(!l){t.reload();return}if(l.bad)await e.info(d(17555,null),d(17553,null,n.nameShort));else{let c=await e.confirm({type:ft.Info,message:d(17555,null),primaryButton:d(17564,null),cancelButton:d(17550,null),detail:d(17552,null,l.id),checkbox:{label:d(17554,null),checked:!0}});c.checkboxChecked&&await r.disableExtension({id:l.id},void 0),c.confirmed&&await s.executeCommand("workbench.action.openIssueReporter",l.id)}await o.reset(),t.reload()}async _checkForBad(a,i){let{result:e}=await a.prompt({type:ft.Info,message:d(17557,null),detail:d(17547,null,i.disabledCount),buttons:[{label:d(17562,null),run:()=>!1},{label:d(17560,null),run:()=>!0},{label:d(17563,null),run:()=>{}}],cancelButton:{label:d(17561,null),run:()=>null}});return e}});W(class extends K{constructor(){super({id:"extension.bisect.stop",title:L(17568,"Stop Extension Bisect"),category:Ve.Help,f1:!0,precondition:J2.ctxIsBisectActive})}async run(a){let i=a.get(K3),e=a.get(Zt);await i.reset(),e.reload()}});var ixi="IWorkbenchExtensionEnablementService",oxi="chat.extensionUnification.enabled",WZe=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T){super();this.storageService=e;this.globalExtensionEnablementService=t;this.contextService=o;this.environmentService=n;this.extensionManagementService=r;this.configurationService=s;this.extensionManagementServerService=l;this.userDataSyncEnablementService=c;this.userDataSyncAccountService=u;this.lifecycleService=p;this.notificationService=h;this.extensionBisectService=f;this.allowedExtensionsService=v;this.workspaceTrustManagementService=b;this.workspaceTrustRequestService=S;this.extensionManifestPropertiesService=y;this.logService=k;this._onEnablementChanged=this._register(new E);this.onEnablementChanged=this._onEnablementChanged.event;this.extensionsDisabledExtensions=[];this.delayer=this._register(new Xo(0));this.storageManager=this._register(new AZe(e));let P=this._register(U.filter(r.onDidUninstallExtension,H=>!H.error)(({identifier:H})=>this._reset(H))),O=!1;this._register(Z(()=>O=!0)),this.extensionsManager=this._register(w.createInstance(VZe)),this.extensionsManager.whenInitialized().then(()=>{O||(P.dispose(),this._onDidChangeExtensions([],[],!1),this._register(this.extensionsManager.onDidChangeExtensions(({added:H,removed:G,isProfileSwitch:$})=>this._onDidChangeExtensions(H,G,$))),this.loopCheckForMaliciousExtensions())}),this._register(this.globalExtensionEnablementService.onDidChangeEnablement(({extensions:H,source:G})=>this._onDidChangeGloballyDisabledExtensions(H,G))),this._register(v.onDidChangeAllowedExtensionsConfigValue(()=>this._onDidChangeExtensions([],[],!1))),this._completionsExtensionId=T.defaultChatAgent?.extensionId.toLowerCase(),this._chatExtensionId=T.defaultChatAgent?.chatExtensionId.toLowerCase();let V=[this._completionsExtensionId,this._chatExtensionId].filter(H=>!!H);Wt&&this.environmentService.remoteAuthority===void 0?this._extensionUnificationEnabled=!1:this._extensionUnificationEnabled=this.configurationService.getValue(oxi),this._register(this.configurationService.onDidChangeConfiguration(H=>{H.affectsConfiguration(oxi)&&(this.configurationService.getValue(oxi)||(this._extensionUnificationEnabled=!1,this._onEnablementChanged.fire(this.extensionsManager.extensions.filter($=>V.includes($.identifier.id.toLowerCase())))))})),this.allUserExtensionsDisabled&&this.lifecycleService.when(4).then(()=>{this.notificationService.prompt(ft.Info,d(17580,null),[{label:d(17582,null),run:()=>g.reload({disableExtensions:!1})}],{sticky:!0,priority:3})})}get hasWorkspace(){return this.contextService.getWorkbenchState()!==1}get allUserExtensionsDisabled(){return this.environmentService.disableExtensions===!0}getEnablementState(e){return this._computeEnablementState(e,this.extensionsManager.extensions,this.getWorkspaceType())}getEnablementStates(e,t={}){let o=new Map,n={...this.getWorkspaceType(),...t};return e.map(r=>this._computeEnablementState(r,e,n,o))}getDependenciesEnablementStates(e){return kde(this.extensionsManager.extensions,e).map(t=>[t,this.getEnablementState(t)])}canChangeEnablement(e){try{return this.throwErrorIfCannotChangeEnablement(e),!0}catch{return!1}}canChangeWorkspaceEnablement(e){if(!this.canChangeEnablement(e))return!1;try{return this.throwErrorIfCannotChangeWorkspaceEnablement(e),!0}catch{return!1}}throwErrorIfCannotChangeEnablement(e,t){if(IR(e.manifest))throw new Error(d(17579,null,e.manifest.displayName||e.identifier.id));if(this.userDataSyncEnablementService.isEnabled()&&this.userDataSyncAccountService.account&&Lci(e.manifest)&&e.manifest.contributes.authentication.some(o=>o.id===this.userDataSyncAccountService.account.authenticationProviderId))throw new Error(d(17577,null,e.manifest.displayName||e.identifier.id));if(this._isEnabledInEnv(e))throw new Error(d(17572,null,e.manifest.displayName||e.identifier.id));this.throwErrorIfEnablementStateCannotBeChanged(e,this.getEnablementState(e),t)}throwErrorIfEnablementStateCannotBeChanged(e,t,o){switch(t){case 2:throw new Error(d(17569,null,e.manifest.displayName||e.identifier.id));case 4:throw new Error(d(17574,null,e.manifest.displayName||e.identifier.id));case 5:throw new Error(d(17575,null,e.manifest.displayName||e.identifier.id));case 1:throw new Error(d(17573,null,e.manifest.displayName||e.identifier.id));case 7:throw new Error(d(17570,null,e.manifest.displayName||e.identifier.id));case 6:throw new Error(d(17576,null,e.manifest.displayName||e.identifier.id));case 8:if(o)break;for(let n of kde(this.extensionsManager.extensions,e))if(!this.isEnabled(n))throw new Error(d(17571,null,e.manifest.displayName||e.identifier.id,n.manifest.displayName||n.identifier.id))}}throwErrorIfCannotChangeWorkspaceEnablement(e){if(!this.hasWorkspace)throw new Error(d(17581,null));if(Lci(e.manifest))throw new Error(d(17578,null,e.manifest.displayName||e.identifier.id))}async setEnablement(e,t){await this.extensionsManager.whenInitialized(),(t===12||t===13)&&e.push(...this.getExtensionsToEnableRecursively(e,this.extensionsManager.extensions,t,{dependencies:!0,pack:!0}));let o=t===11||t===13;for(let s of e)o?this.throwErrorIfCannotChangeWorkspaceEnablement(s):this.throwErrorIfCannotChangeEnablement(s);let n=[];for(let s of e){let l=this.getEnablementState(s);if(l===0||l===8&&this.getDependenciesEnablementStates(s).every(([,c])=>this.isEnabledEnablementState(c)||c===0)){let c=await this.workspaceTrustRequestService.requestWorkspaceTrust();n.push(c??!1)}else n.push(await this._setUserEnablementState(s,t))}let r=e.filter((s,l)=>n[l]);return r.length&&this._onEnablementChanged.fire(r),n}getExtensionsToEnableRecursively(e,t,o,n,r=[]){if(!n.dependencies&&!n.pack)return[];let s=e.filter(c=>r.indexOf(c)===-1);if(!s.length)return[];for(let c of s)r.push(c);let l=[];for(let c of t){if(r.some(p=>Ut(p.identifier,c.identifier)))continue;let u=this.getEnablementState(c);if(!this.isEnabledEnablementState(u)&&u!==1&&e.some(p=>n.dependencies&&p.manifest.extensionDependencies?.some(h=>Ut({id:h},c.identifier))||n.pack&&p.manifest.extensionPack?.some(h=>Ut({id:h},c.identifier)))){let p=l.findIndex(h=>Ut(h.identifier,c.identifier));if(p===-1)l.push(c);else try{this.throwErrorIfEnablementStateCannotBeChanged(c,u,!0),l.splice(p,1,c)}catch{}}}return l.length&&l.push(...this.getExtensionsToEnableRecursively(l,t,o,n,r)),l}_setUserEnablementState(e,t){if(this._getUserEnablementState(e.identifier)===t)return Promise.resolve(!1);switch(t){case 12:this._enableExtension(e.identifier);break;case 10:this._disableExtension(e.identifier);break;case 13:this._enableExtensionInWorkspace(e.identifier);break;case 11:this._disableExtensionInWorkspace(e.identifier);break}return Promise.resolve(!0)}isEnabled(e){let t=this.getEnablementState(e);return this.isEnabledEnablementState(t)}isEnabledEnablementState(e){return e===3||e===13||e===12}isDisabledGlobally(e){return this._isDisabledGlobally(e.identifier)}_computeEnablementState(e,t,o,n){n=n??new Map;let r=n.get(e);if(r!==void 0)return r;r=this._getUserEnablementState(e.identifier);let s=this.isEnabledEnablementState(r);return NTt(e.identifier,this.getMaliciousExtensions().map(l=>({extensionOrPublisher:l})))?r=4:s&&e.type===1&&this.allowedExtensionsService.isAllowed(e)!==!0?r=7:s&&!e.isValid?r=6:this.extensionBisectService.isDisabledByBisect(e)?r=2:this._isDisabledInEnv(e)?r=2:this._isDisabledByVirtualWorkspace(e,o)?r=5:s&&this._isDisabledByWorkspaceTrust(e,o)?r=0:this._isDisabledByExtensionKind(e)?r=1:s&&this._isDisabledByExtensionDependency(e,t,o,n)?r=8:this._isDisabledByUnification(e.identifier)?r=9:!s&&this._isEnabledInEnv(e)&&(r=3),n.set(e,r),r}_isDisabledInEnv(e){if(this.allUserExtensionsDisabled)return!e.isBuiltin&&!Zxe(e.manifest,this.environmentService.remoteAuthority);let t=this.environmentService.disableExtensions;return Array.isArray(t)?t.some(o=>Ut({id:o},e.identifier)):!!Ut({id:xJi.value},e.identifier)}_isEnabledInEnv(e){let t=this.environmentService.enableExtensions;return Array.isArray(t)?t.some(o=>Ut({id:o},e.identifier)):!1}_isDisabledByVirtualWorkspace(e,t){return!(!t.virtual||this.extensionManifestPropertiesService.getExtensionVirtualWorkspaceSupportType(e.manifest)!==!1||this.extensionManagementServerService.getExtensionManagementServer(e)===this.extensionManagementServerService.webExtensionManagementServer&&this.extensionManifestPropertiesService.canExecuteOnWeb(e.manifest))}_isDisabledByExtensionKind(e){if(this.extensionManagementServerService.remoteExtensionManagementServer||this.extensionManagementServerService.webExtensionManagementServer){let t=this.extensionManagementServerService.getExtensionInstallLocation(e);for(let o of this.extensionManifestPropertiesService.getExtensionKind(e.manifest)){if(o==="ui"&&t===1||o==="workspace"&&t===2)return!1;if(o==="web"){if(this.extensionManagementServerService.webExtensionManagementServer){if(t===3||t===2)return!1}else if(t===1){let n=this.configurationService.getValue(VTt);if(n===!0||n==="auto")return!1}}}return!0}return!1}_isDisabledByWorkspaceTrust(e,t){return t.trusted?!1:this.contextService.isInsideWorkspace(e.location)?!0:this.extensionManifestPropertiesService.getExtensionUntrustedWorkspaceSupportType(e.manifest)===!1}_isDisabledByExtensionDependency(e,t,o,n){if(!e.manifest.extensionDependencies)return!1;let r=t.filter(l=>e.manifest.extensionDependencies?.some(c=>Ut(l.identifier,{id:c})&&(this.extensionManagementServerService.getExtensionManagementServer(l)===this.extensionManagementServerService.getExtensionManagementServer(e)||(l.manifest.main||l.manifest.browser)&&l.manifest.api==="none")));if(!r.length)return!1;let s=n.has(e);s||n.set(e,12);try{for(let l of r){let c=this._computeEnablementState(l,t,o,n);if(!this.isEnabledEnablementState(c)&&c!==1)return!0}}finally{s||n.delete(e)}return!1}_getUserEnablementState(e){if(this.hasWorkspace){if(this._getWorkspaceEnabledExtensions().filter(t=>Ut(t,e))[0])return 13;if(this._getWorkspaceDisabledExtensions().filter(t=>Ut(t,e))[0])return 11}return this._isDisabledGlobally(e)?10:12}_isDisabledGlobally(e){return this.globalExtensionEnablementService.getDisabledExtensions().some(t=>Ut(t,e))}_isDisabledByUnification(e){return this._extensionUnificationEnabled&&e.id.toLowerCase()===this._completionsExtensionId}_enableExtension(e){return this._removeFromWorkspaceDisabledExtensions(e),this._removeFromWorkspaceEnabledExtensions(e),this.globalExtensionEnablementService.enableExtension(e,ixi)}_disableExtension(e){return this._removeFromWorkspaceDisabledExtensions(e),this._removeFromWorkspaceEnabledExtensions(e),this.globalExtensionEnablementService.disableExtension(e,ixi)}_enableExtensionInWorkspace(e){this._removeFromWorkspaceDisabledExtensions(e),this._addToWorkspaceEnabledExtensions(e)}_disableExtensionInWorkspace(e){this._addToWorkspaceDisabledExtensions(e),this._removeFromWorkspaceEnabledExtensions(e)}_addToWorkspaceDisabledExtensions(e){if(!this.hasWorkspace)return Promise.resolve(!1);let t=this._getWorkspaceDisabledExtensions();return t.every(o=>!Ut(o,e))?(t.push(e),this._setDisabledExtensions(t),Promise.resolve(!0)):Promise.resolve(!1)}async _removeFromWorkspaceDisabledExtensions(e){if(!this.hasWorkspace)return!1;let t=this._getWorkspaceDisabledExtensions();for(let o=0;o<t.length;o++){let n=t[o];if(Ut(n,e))return t.splice(o,1),this._setDisabledExtensions(t),!0}return!1}_addToWorkspaceEnabledExtensions(e){if(!this.hasWorkspace)return!1;let t=this._getWorkspaceEnabledExtensions();return t.every(o=>!Ut(o,e))?(t.push(e),this._setEnabledExtensions(t),!0):!1}_removeFromWorkspaceEnabledExtensions(e){if(!this.hasWorkspace)return!1;let t=this._getWorkspaceEnabledExtensions();for(let o=0;o<t.length;o++){let n=t[o];if(Ut(n,e))return t.splice(o,1),this._setEnabledExtensions(t),!0}return!1}_getWorkspaceEnabledExtensions(){return this._getExtensions(cmi)}_setEnabledExtensions(e){this._setExtensions(cmi,e)}_getWorkspaceDisabledExtensions(){return this._getExtensions(wX)}_setDisabledExtensions(e){this._setExtensions(wX,e)}_getExtensions(e){return this.hasWorkspace?this.storageManager.get(e,1):[]}_setExtensions(e,t){this.storageManager.set(e,t,1)}async _onDidChangeGloballyDisabledExtensions(e,t){if(t!==ixi){await this.extensionsManager.whenInitialized();let o=this.extensionsManager.extensions.filter(n=>e.some(r=>Ut(r,n.identifier)));this._onEnablementChanged.fire(o)}}_onDidChangeExtensions(e,t,o){let n=e.filter(s=>!this.isEnabledEnablementState(this.getEnablementState(s))),r=this.extensionsDisabledExtensions;this.extensionsDisabledExtensions=this.extensionsManager.extensions.filter(s=>{let l=this.getEnablementState(s);return l===8||l===7||l===4});for(let s of r)this.extensionsDisabledExtensions.every(l=>!Ut(l.identifier,s.identifier))&&n.push(s);for(let s of this.extensionsDisabledExtensions)r.every(l=>!Ut(l.identifier,s.identifier))&&n.push(s);n.length&&this._onEnablementChanged.fire(n),o||t.forEach(({identifier:s})=>this._reset(s))}async updateExtensionsEnablementsWhenWorkspaceTrustChanges(){await this.extensionsManager.whenInitialized();let e=s=>{let l=new Map;return this.extensionsManager.extensions.map(c=>[c,this._computeEnablementState(c,this.extensionsManager.extensions,s,l)])},t=this.getWorkspaceType(),o=e({...t,trusted:!0}),n=e({...t,trusted:!1}),r=o.filter(([,s],l)=>s!==n[l][1]).map(([s])=>s);r.length&&this._onEnablementChanged.fire(r)}getWorkspaceType(){return{trusted:this.workspaceTrustManagementService.isWorkspaceTrusted(),virtual:_F(this.contextService.getWorkspace())}}_reset(e){this._removeFromWorkspaceDisabledExtensions(e),this._removeFromWorkspaceEnabledExtensions(e),this.globalExtensionEnablementService.enableExtension(e)}loopCheckForMaliciousExtensions(){this.checkForMaliciousExtensions().then(()=>this.delayer.trigger(()=>{},1e3*60*5)).then(()=>this.loopCheckForMaliciousExtensions())}async checkForMaliciousExtensions(){try{let e=await this.extensionManagementService.getExtensionsControlManifest();this.storeMaliciousExtensions(e.malicious.map(({extensionOrPublisher:o})=>o))&&this._onDidChangeExtensions([],[],!1)}catch(e){this.logService.error(e)}}getMaliciousExtensions(){return this.storageService.getObject("extensionsEnablement/malicious",-1,[])}storeMaliciousExtensions(e){let t=this.getMaliciousExtensions();return $i(t,e,(o,n)=>!Fe(o)&&!Fe(n)?Ut(o,n):o===n)?!1:(this.storageService.store("extensionsEnablement/malicious",JSON.stringify(e),-1,1),!0)}};WZe=I([m(0,ce),m(1,fK),m(2,Pe),m(3,At),m(4,Cs),m(5,B),m(6,Ec),m(7,Fl),m(8,jRe),m(9,ji),m(10,Ne),m(11,Zt),m(12,K3),m(13,dm),m(14,Nr),m(15,Vu),m(16,Gp),m(17,F),m(18,se),m(19,tt)],WZe);var VZe=class extends x{constructor(e,t,o){super();this.extensionManagementService=e;this.extensionManagementServerService=t;this.logService=o;this._extensions=[];this._onDidChangeExtensions=this._register(new E);this.onDidChangeExtensions=this._onDidChangeExtensions.event;this.disposed=!1;this._register(Z(()=>this.disposed=!0)),this.initializePromise=this.initialize()}get extensions(){return this._extensions}whenInitialized(){return this.initializePromise}async initialize(){try{if(this._extensions=[...await this.extensionManagementService.getInstalled(),...await this.extensionManagementService.getInstalledWorkspaceExtensions(!0)],this.disposed)return;this._onDidChangeExtensions.fire({added:this.extensions,removed:[],isProfileSwitch:!1})}catch(e){this.logService.error(e)}this._register(this.extensionManagementService.onDidInstallExtensions(e=>this.updateExtensions(e.reduce((t,{local:o,operation:n})=>(o&&n!==4&&t.push(o),t),[]),[],void 0,!1))),this._register(U.filter(this.extensionManagementService.onDidUninstallExtension,(e=>!e.error))(e=>this.updateExtensions([],[e.identifier],e.server,!1))),this._register(this.extensionManagementService.onDidChangeProfile(({added:e,removed:t,server:o})=>{this.updateExtensions(e,t.map(({identifier:n})=>n),o,!0)}))}updateExtensions(e,t,o,n){if(e.length){for(let s of e){let l=this.extensionManagementServerService.getExtensionManagementServer(s),c=this._extensions.findIndex(u=>Ut(u.identifier,s.identifier)&&this.extensionManagementServerService.getExtensionManagementServer(u)===l);c!==-1&&this._extensions.splice(c,1)}this._extensions.push(...e)}let r=[];for(let s of t){let l=this._extensions.findIndex(c=>Ut(c.identifier,s)&&this.extensionManagementServerService.getExtensionManagementServer(c)===o);l!==-1&&r.push(...this._extensions.splice(l,1))}(e.length||r.length)&&this._onDidChangeExtensions.fire({added:e,removed:r,isProfileSwitch:n})}};VZe=I([m(0,ru),m(1,Ec),m(2,se)],VZe);Ee(Js,WZe,1);function QRe(a,i,e,t){try{j7o(a,i,e,t)}catch(o){a.error(o?.message??o)}return i}function j7o(a,i,e,t){let o=(n,r,s)=>{let l=n[r];if(Fe(l)){let c=l,u=c.length;if(u>1&&c[0]==="%"&&c[u-1]==="%"){let p=c.substr(1,u-2),h=e[p];h===void 0&&t&&(h=t[p]);let g=typeof h=="string"?h:h?.message,f=t?.[p],v=typeof f=="string"?f:f?.message;if(!g){v||a.warn(`[${i.name}]: ${d(2082,null,p)}`);return}if(s&&(r==="title"||r==="category")&&v&&v!==g){let b={value:g,original:v};n[r]=b}else n[r]=g}}else if(xi(l))for(let c in l)l.hasOwnProperty(c)&&(c==="commands"?o(l,c,!0):o(l,c,s));else if(Array.isArray(l))for(let c=0;c<l.length;c++)o(l,c,s)};for(let n in i)i.hasOwnProperty(n)&&o(i,n)}var BZe=class{constructor(i,e,t,o,n){this.extensionResourceLoaderService=t;this.logService=n;this.builtinExtensionsPromises=[];if(Wt){let r=o.extensionsGallery?.nlsBaseUrl;r&&o.commit&&!US.isDefaultVariant()&&(this.nlsUrl=A.joinPath(A.parse(r),o.commit,o.version,US.value()));let s=vn.asBrowserUri($Gi);if(s){let l=[];if(i.isBuilt)l=[{extensionPath:"bat",packageJSON:{name:"bat",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"^1.52.0"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin mmims/language-batchfile grammars/batchfile.cson ./syntaxes/batchfile.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"bat",extensions:[".bat",".cmd"],aliases:["Batch","bat"],configuration:"./language-configuration.json"}],grammars:[{language:"bat",scopeName:"source.batchfile",path:"./syntaxes/batchfile.tmLanguage.json"}],snippets:[{language:"bat",path:"./snippets/batchfile.code-snippets"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Windows Bat Language Basics",description:"Provides snippets, syntax highlighting, bracket matching and folding in Windows batch files."}},{extensionPath:"clojure",packageJSON:{name:"clojure",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin atom/language-clojure grammars/clojure.cson ./syntaxes/clojure.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"clojure",aliases:["Clojure","clojure"],extensions:[".clj",".cljs",".cljc",".cljx",".clojure",".edn"],configuration:"./language-configuration.json"}],grammars:[{language:"clojure",scopeName:"source.clojure",path:"./syntaxes/clojure.tmLanguage.json"}],configurationDefaults:{"[clojure]":{"diffEditor.ignoreTrimWhitespace":!1}}},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Clojure Language Basics",description:"Provides syntax highlighting and bracket matching in Clojure files."}},{extensionPath:"coffeescript",packageJSON:{name:"coffeescript",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin atom/language-coffee-script grammars/coffeescript.cson ./syntaxes/coffeescript.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"coffeescript",extensions:[".coffee",".cson",".iced"],aliases:["CoffeeScript","coffeescript","coffee"],configuration:"./language-configuration.json"}],grammars:[{language:"coffeescript",scopeName:"source.coffee",path:"./syntaxes/coffeescript.tmLanguage.json"}],breakpoints:[{language:"coffeescript"}],snippets:[{language:"coffeescript",path:"./snippets/coffeescript.code-snippets"}],configurationDefaults:{"[coffeescript]":{"diffEditor.ignoreTrimWhitespace":!1,"editor.defaultColorDecorators":"never"}}},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"CoffeeScript Language Basics",description:"Provides snippets, syntax highlighting, bracket matching and folding in CoffeeScript files."}},{extensionPath:"configuration-editing",packageJSON:{name:"configuration-editing",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"^1.0.0"},icon:"images/icon.png",activationEvents:["onProfile","onProfile:github","onLanguage:json","onLanguage:jsonc"],enabledApiProposals:["profileContentHandlers"],main:"./dist/configurationEditingMain",browser:"./dist/browser/configurationEditingMain",capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:!0}},contributes:{languages:[{id:"jsonc",extensions:[".code-workspace","language-configuration.json","icon-theme.json","color-theme.json"],filenames:["settings.json","launch.json","tasks.json","mcp.json","keybindings.json","extensions.json","argv.json","profiles.json","devcontainer.json",".devcontainer.json"]},{id:"json",extensions:[".code-profile"]}],jsonValidation:[{fileMatch:"vscode://defaultsettings/keybindings.json",url:"vscode://schemas/keybindings"},{fileMatch:"%APP_SETTINGS_HOME%/keybindings.json",url:"vscode://schemas/keybindings"},{fileMatch:"%APP_SETTINGS_HOME%/profiles/*/keybindings.json",url:"vscode://schemas/keybindings"},{fileMatch:"vscode://defaultsettings/*.json",url:"vscode://schemas/settings/default"},{fileMatch:"%APP_SETTINGS_HOME%/settings.json",url:"vscode://schemas/settings/user"},{fileMatch:"%APP_SETTINGS_HOME%/profiles/*/settings.json",url:"vscode://schemas/settings/profile"},{fileMatch:"%MACHINE_SETTINGS_HOME%/settings.json",url:"vscode://schemas/settings/machine"},{fileMatch:"%APP_WORKSPACES_HOME%/*/workspace.json",url:"vscode://schemas/workspaceConfig"},{fileMatch:"**/*.code-workspace",url:"vscode://schemas/workspaceConfig"},{fileMatch:"**/argv.json",url:"vscode://schemas/argv"},{fileMatch:"/.vscode/settings.json",url:"vscode://schemas/settings/folder"},{fileMatch:"/.vscode/launch.json",url:"vscode://schemas/launch"},{fileMatch:"/.vscode/tasks.json",url:"vscode://schemas/tasks"},{fileMatch:"/.vscode/mcp.json",url:"vscode://schemas/mcp"},{fileMatch:"%APP_SETTINGS_HOME%/tasks.json",url:"vscode://schemas/tasks"},{fileMatch:"%APP_SETTINGS_HOME%/snippets/*.json",url:"vscode://schemas/snippets"},{fileMatch:"%APP_SETTINGS_HOME%/prompts/*.toolsets.jsonc",url:"vscode://schemas/toolsets"},{fileMatch:"%APP_SETTINGS_HOME%/profiles/*/snippets/.json",url:"vscode://schemas/snippets"},{fileMatch:"%APP_SETTINGS_HOME%/sync/snippets/preview/*.json",url:"vscode://schemas/snippets"},{fileMatch:"**/*.code-snippets",url:"vscode://schemas/global-snippets"},{fileMatch:"/.vscode/extensions.json",url:"vscode://schemas/extensions"},{fileMatch:"devcontainer.json",url:"https://raw.githubusercontent.com/devcontainers/spec/main/schemas/devContainer.schema.json"},{fileMatch:".devcontainer.json",url:"https://raw.githubusercontent.com/devcontainers/spec/main/schemas/devContainer.schema.json"},{fileMatch:"%APP_SETTINGS_HOME%/globalStorage/ms-vscode-remote.remote-containers/nameConfigs/*.json",url:"./schemas/attachContainer.schema.json"},{fileMatch:"%APP_SETTINGS_HOME%/globalStorage/ms-vscode-remote.remote-containers/imageConfigs/*.json",url:"./schemas/attachContainer.schema.json"},{fileMatch:"**/quality/*/product.json",url:"vscode://schemas/vscode-product"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Configuration Editing",description:"Provides capabilities (advanced IntelliSense, auto-fixing) in configuration files like settings, launch, and extension recommendation files."}},{extensionPath:"cpp",packageJSON:{name:"cpp",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ./build/update-grammars.js"},categories:["Programming Languages"],contributes:{languages:[{id:"c",extensions:[".c",".i"],aliases:["C","c"],configuration:"./language-configuration.json"},{id:"cpp",extensions:[".cpp",".cppm",".cc",".ccm",".cxx",".cxxm",".c++",".c++m",".hpp",".hh",".hxx",".h++",".h",".ii",".ino",".inl",".ipp",".ixx",".tpp",".txx",".hpp.in",".h.in"],aliases:["C++","Cpp","cpp"],configuration:"./language-configuration.json"},{id:"cuda-cpp",extensions:[".cu",".cuh"],aliases:["CUDA C++"],configuration:"./language-configuration.json"}],grammars:[{language:"c",scopeName:"source.c",path:"./syntaxes/c.tmLanguage.json"},{language:"cpp",scopeName:"source.cpp.embedded.macro",path:"./syntaxes/cpp.embedded.macro.tmLanguage.json"},{language:"cpp",scopeName:"source.cpp",path:"./syntaxes/cpp.tmLanguage.json"},{scopeName:"source.c.platform",path:"./syntaxes/platform.tmLanguage.json"},{language:"cuda-cpp",scopeName:"source.cuda-cpp",path:"./syntaxes/cuda-cpp.tmLanguage.json"}],problemPatterns:[{name:"nvcc-location",regexp:"^(.*)\\((\\d+)\\):\\s+(warning|error):\\s+(.*)",kind:"location",file:1,location:2,severity:3,message:4}],problemMatchers:[{name:"nvcc",owner:"cuda-cpp",fileLocation:["relative","${workspaceFolder}"],pattern:"$nvcc-location"}],snippets:[{language:"c",path:"./snippets/c.code-snippets"},{language:"cpp",path:"./snippets/cpp.code-snippets"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"C/C++ Language Basics",description:"Provides snippets, syntax highlighting, bracket matching and folding in C/C++ files."}},{extensionPath:"csharp",packageJSON:{name:"csharp",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"0.10.x"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin dotnet/csharp-tmLanguage grammars/csharp.tmLanguage ./syntaxes/csharp.tmLanguage.json"},categories:["Programming Languages"],contributes:{configurationDefaults:{"[csharp]":{"editor.maxTokenizationLineLength":2500}},languages:[{id:"csharp",extensions:[".cs",".csx",".cake"],aliases:["C#","csharp"],configuration:"./language-configuration.json"}],grammars:[{language:"csharp",scopeName:"source.cs",path:"./syntaxes/csharp.tmLanguage.json",tokenTypes:{"meta.interpolation":"other"},unbalancedBracketScopes:["keyword.operator.relational.cs","keyword.operator.arrow.cs","punctuation.accessor.pointer.cs","keyword.operator.bitwise.shift.cs","keyword.operator.assignment.compound.bitwise.cs"]}],snippets:[{language:"csharp",path:"./snippets/csharp.code-snippets"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"C# Language Basics",description:"Provides snippets, syntax highlighting, bracket matching and folding in C# files."}},{extensionPath:"css",packageJSON:{name:"css",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"0.10.x"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin microsoft/vscode-css grammars/css.cson ./syntaxes/css.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"css",aliases:["CSS","css"],extensions:[".css"],mimetypes:["text/css"],configuration:"./language-configuration.json"}],grammars:[{language:"css",scopeName:"source.css",path:"./syntaxes/css.tmLanguage.json",tokenTypes:{"meta.function.url string.quoted":"other"}}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"CSS Language Basics",description:"Provides syntax highlighting and bracket matching for CSS, LESS and SCSS files."}},{extensionPath:"css-language-features",packageJSON:{name:"css-language-features",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"^1.77.0"},icon:"icons/css.png",activationEvents:["onLanguage:css","onLanguage:less","onLanguage:scss","onCommand:_css.applyCodeAction"],main:"./client/dist/node/cssClientMain",browser:"./client/dist/browser/cssClientMain",capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:!0}},categories:["Programming Languages"],contributes:{configuration:[{order:22,id:"css",title:"%css.title%",properties:{"css.customData":{type:"array",markdownDescription:"%css.customData.desc%",default:[],items:{type:"string"},scope:"resource"},"css.completion.triggerPropertyValueCompletion":{type:"boolean",scope:"resource",default:!0,description:"%css.completion.triggerPropertyValueCompletion.desc%"},"css.completion.completePropertyWithSemicolon":{type:"boolean",scope:"resource",default:!0,description:"%css.completion.completePropertyWithSemicolon.desc%"},"css.validate":{type:"boolean",scope:"resource",default:!0,description:"%css.validate.desc%"},"css.hover.documentation":{type:"boolean",scope:"resource",default:!0,description:"%css.hover.documentation%"},"css.hover.references":{type:"boolean",scope:"resource",default:!0,description:"%css.hover.references%"},"css.lint.compatibleVendorPrefixes":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%css.lint.compatibleVendorPrefixes.desc%"},"css.lint.vendorPrefix":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",description:"%css.lint.vendorPrefix.desc%"},"css.lint.duplicateProperties":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%css.lint.duplicateProperties.desc%"},"css.lint.emptyRules":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",description:"%css.lint.emptyRules.desc%"},"css.lint.importStatement":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%css.lint.importStatement.desc%"},"css.lint.boxModel":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",markdownDescription:"%css.lint.boxModel.desc%"},"css.lint.universalSelector":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",markdownDescription:"%css.lint.universalSelector.desc%"},"css.lint.zeroUnits":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%css.lint.zeroUnits.desc%"},"css.lint.fontFaceProperties":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",markdownDescription:"%css.lint.fontFaceProperties.desc%"},"css.lint.hexColorLength":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"error",description:"%css.lint.hexColorLength.desc%"},"css.lint.argumentsInColorFunction":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"error",description:"%css.lint.argumentsInColorFunction.desc%"},"css.lint.unknownProperties":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",description:"%css.lint.unknownProperties.desc%"},"css.lint.validProperties":{type:"array",uniqueItems:!0,items:{type:"string"},scope:"resource",default:[],markdownDescription:"%css.lint.validProperties.desc%"},"css.lint.ieHack":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%css.lint.ieHack.desc%"},"css.lint.unknownVendorSpecificProperties":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%css.lint.unknownVendorSpecificProperties.desc%"},"css.lint.propertyIgnoredDueToDisplay":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",markdownDescription:"%css.lint.propertyIgnoredDueToDisplay.desc%"},"css.lint.important":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",markdownDescription:"%css.lint.important.desc%"},"css.lint.float":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",markdownDescription:"%css.lint.float.desc%"},"css.lint.idSelector":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%css.lint.idSelector.desc%"},"css.lint.unknownAtRules":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",description:"%css.lint.unknownAtRules.desc%"},"css.trace.server":{type:"string",scope:"window",enum:["off","messages","verbose"],default:"off",description:"%css.trace.server.desc%"},"css.format.enable":{type:"boolean",scope:"window",default:!0,description:"%css.format.enable.desc%"},"css.format.newlineBetweenSelectors":{type:"boolean",scope:"resource",default:!0,markdownDescription:"%css.format.newlineBetweenSelectors.desc%"},"css.format.newlineBetweenRules":{type:"boolean",scope:"resource",default:!0,markdownDescription:"%css.format.newlineBetweenRules.desc%"},"css.format.spaceAroundSelectorSeparator":{type:"boolean",scope:"resource",default:!1,markdownDescription:"%css.format.spaceAroundSelectorSeparator.desc%"},"css.format.braceStyle":{type:"string",scope:"resource",default:"collapse",enum:["collapse","expand"],markdownDescription:"%css.format.braceStyle.desc%"},"css.format.preserveNewLines":{type:"boolean",scope:"resource",default:!0,markdownDescription:"%css.format.preserveNewLines.desc%"},"css.format.maxPreserveNewLines":{type:["number","null"],scope:"resource",default:null,markdownDescription:"%css.format.maxPreserveNewLines.desc%"}}},{id:"scss",order:24,title:"%scss.title%",properties:{"scss.completion.triggerPropertyValueCompletion":{type:"boolean",scope:"resource",default:!0,description:"%scss.completion.triggerPropertyValueCompletion.desc%"},"scss.completion.completePropertyWithSemicolon":{type:"boolean",scope:"resource",default:!0,description:"%scss.completion.completePropertyWithSemicolon.desc%"},"scss.validate":{type:"boolean",scope:"resource",default:!0,description:"%scss.validate.desc%"},"scss.hover.documentation":{type:"boolean",scope:"resource",default:!0,description:"%scss.hover.documentation%"},"scss.hover.references":{type:"boolean",scope:"resource",default:!0,description:"%scss.hover.references%"},"scss.lint.compatibleVendorPrefixes":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%scss.lint.compatibleVendorPrefixes.desc%"},"scss.lint.vendorPrefix":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",description:"%scss.lint.vendorPrefix.desc%"},"scss.lint.duplicateProperties":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%scss.lint.duplicateProperties.desc%"},"scss.lint.emptyRules":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",description:"%scss.lint.emptyRules.desc%"},"scss.lint.importStatement":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%scss.lint.importStatement.desc%"},"scss.lint.boxModel":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",markdownDescription:"%scss.lint.boxModel.desc%"},"scss.lint.universalSelector":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",markdownDescription:"%scss.lint.universalSelector.desc%"},"scss.lint.zeroUnits":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%scss.lint.zeroUnits.desc%"},"scss.lint.fontFaceProperties":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",markdownDescription:"%scss.lint.fontFaceProperties.desc%"},"scss.lint.hexColorLength":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"error",description:"%scss.lint.hexColorLength.desc%"},"scss.lint.argumentsInColorFunction":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"error",description:"%scss.lint.argumentsInColorFunction.desc%"},"scss.lint.unknownProperties":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",description:"%scss.lint.unknownProperties.desc%"},"scss.lint.validProperties":{type:"array",uniqueItems:!0,items:{type:"string"},scope:"resource",default:[],markdownDescription:"%scss.lint.validProperties.desc%"},"scss.lint.ieHack":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%scss.lint.ieHack.desc%"},"scss.lint.unknownVendorSpecificProperties":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%scss.lint.unknownVendorSpecificProperties.desc%"},"scss.lint.propertyIgnoredDueToDisplay":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",markdownDescription:"%scss.lint.propertyIgnoredDueToDisplay.desc%"},"scss.lint.important":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",markdownDescription:"%scss.lint.important.desc%"},"scss.lint.float":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",markdownDescription:"%scss.lint.float.desc%"},"scss.lint.idSelector":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%scss.lint.idSelector.desc%"},"scss.lint.unknownAtRules":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",description:"%scss.lint.unknownAtRules.desc%"},"scss.format.enable":{type:"boolean",scope:"window",default:!0,description:"%scss.format.enable.desc%"},"scss.format.newlineBetweenSelectors":{type:"boolean",scope:"resource",default:!0,markdownDescription:"%scss.format.newlineBetweenSelectors.desc%"},"scss.format.newlineBetweenRules":{type:"boolean",scope:"resource",default:!0,markdownDescription:"%scss.format.newlineBetweenRules.desc%"},"scss.format.spaceAroundSelectorSeparator":{type:"boolean",scope:"resource",default:!1,markdownDescription:"%scss.format.spaceAroundSelectorSeparator.desc%"},"scss.format.braceStyle":{type:"string",scope:"resource",default:"collapse",enum:["collapse","expand"],markdownDescription:"%scss.format.braceStyle.desc%"},"scss.format.preserveNewLines":{type:"boolean",scope:"resource",default:!0,markdownDescription:"%scss.format.preserveNewLines.desc%"},"scss.format.maxPreserveNewLines":{type:["number","null"],scope:"resource",default:null,markdownDescription:"%scss.format.maxPreserveNewLines.desc%"}}},{id:"less",order:23,type:"object",title:"%less.title%",properties:{"less.completion.triggerPropertyValueCompletion":{type:"boolean",scope:"resource",default:!0,description:"%less.completion.triggerPropertyValueCompletion.desc%"},"less.completion.completePropertyWithSemicolon":{type:"boolean",scope:"resource",default:!0,description:"%less.completion.completePropertyWithSemicolon.desc%"},"less.validate":{type:"boolean",scope:"resource",default:!0,description:"%less.validate.desc%"},"less.hover.documentation":{type:"boolean",scope:"resource",default:!0,description:"%less.hover.documentation%"},"less.hover.references":{type:"boolean",scope:"resource",default:!0,description:"%less.hover.references%"},"less.lint.compatibleVendorPrefixes":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%less.lint.compatibleVendorPrefixes.desc%"},"less.lint.vendorPrefix":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",description:"%less.lint.vendorPrefix.desc%"},"less.lint.duplicateProperties":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%less.lint.duplicateProperties.desc%"},"less.lint.emptyRules":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",description:"%less.lint.emptyRules.desc%"},"less.lint.importStatement":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%less.lint.importStatement.desc%"},"less.lint.boxModel":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",markdownDescription:"%less.lint.boxModel.desc%"},"less.lint.universalSelector":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",markdownDescription:"%less.lint.universalSelector.desc%"},"less.lint.zeroUnits":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%less.lint.zeroUnits.desc%"},"less.lint.fontFaceProperties":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",markdownDescription:"%less.lint.fontFaceProperties.desc%"},"less.lint.hexColorLength":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"error",description:"%less.lint.hexColorLength.desc%"},"less.lint.argumentsInColorFunction":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"error",description:"%less.lint.argumentsInColorFunction.desc%"},"less.lint.unknownProperties":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",description:"%less.lint.unknownProperties.desc%"},"less.lint.validProperties":{type:"array",uniqueItems:!0,items:{type:"string"},scope:"resource",default:[],markdownDescription:"%less.lint.validProperties.desc%"},"less.lint.ieHack":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%less.lint.ieHack.desc%"},"less.lint.unknownVendorSpecificProperties":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%less.lint.unknownVendorSpecificProperties.desc%"},"less.lint.propertyIgnoredDueToDisplay":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",markdownDescription:"%less.lint.propertyIgnoredDueToDisplay.desc%"},"less.lint.important":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",markdownDescription:"%less.lint.important.desc%"},"less.lint.float":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",markdownDescription:"%less.lint.float.desc%"},"less.lint.idSelector":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%less.lint.idSelector.desc%"},"less.lint.unknownAtRules":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",description:"%less.lint.unknownAtRules.desc%"},"less.format.enable":{type:"boolean",scope:"window",default:!0,description:"%less.format.enable.desc%"},"less.format.newlineBetweenSelectors":{type:"boolean",scope:"resource",default:!0,markdownDescription:"%less.format.newlineBetweenSelectors.desc%"},"less.format.newlineBetweenRules":{type:"boolean",scope:"resource",default:!0,markdownDescription:"%less.format.newlineBetweenRules.desc%"},"less.format.spaceAroundSelectorSeparator":{type:"boolean",scope:"resource",default:!1,markdownDescription:"%less.format.spaceAroundSelectorSeparator.desc%"},"less.format.braceStyle":{type:"string",scope:"resource",default:"collapse",enum:["collapse","expand"],markdownDescription:"%less.format.braceStyle.desc%"},"less.format.preserveNewLines":{type:"boolean",scope:"resource",default:!0,markdownDescription:"%less.format.preserveNewLines.desc%"},"less.format.maxPreserveNewLines":{type:["number","null"],scope:"resource",default:null,markdownDescription:"%less.format.maxPreserveNewLines.desc%"}}}],configurationDefaults:{"[css]":{"editor.suggest.insertMode":"replace"},"[scss]":{"editor.suggest.insertMode":"replace"},"[less]":{"editor.suggest.insertMode":"replace"}},jsonValidation:[{fileMatch:"*.css-data.json",url:"https://raw.githubusercontent.com/microsoft/vscode-css-languageservice/master/docs/customData.schema.json"},{fileMatch:"package.json",url:"./schemas/package.schema.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"CSS Language Features",description:"Provides rich language support for CSS, LESS and SCSS files.","css.title":"CSS","css.customData.desc":`A list of relative file paths pointing to JSON files following the [custom data format](https://github.com/microsoft/vscode-css-languageservice/blob/master/docs/customData.md).

VS Code loads custom data on startup to enhance its CSS support for CSS custom properties (variables), at-rules, pseudo-classes, and pseudo-elements you specify in the JSON files.

The file paths are relative to workspace and only workspace folder settings are considered.`,"css.completion.triggerPropertyValueCompletion.desc":"By default, VS Code triggers property value completion after selecting a CSS property. Use this setting to disable this behavior.","css.completion.completePropertyWithSemicolon.desc":"Insert semicolon at end of line when completing CSS properties.","css.lint.argumentsInColorFunction.desc":"Invalid number of parameters.","css.lint.boxModel.desc":"Do not use `width` or `height` when using `padding` or `border`.","css.lint.compatibleVendorPrefixes.desc":"When using a vendor-specific prefix make sure to also include all other vendor-specific properties.","css.lint.duplicateProperties.desc":"Do not use duplicate style definitions.","css.lint.emptyRules.desc":"Do not use empty rulesets.","css.lint.float.desc":"Avoid using `float`. Floats lead to fragile CSS that is easy to break if one aspect of the layout changes.","css.lint.fontFaceProperties.desc":"`@font-face` rule must define `src` and `font-family` properties.","css.lint.hexColorLength.desc":"Hex colors must consist of 3, 4, 6 or 8 hex numbers.","css.lint.idSelector.desc":"Selectors should not contain IDs because these rules are too tightly coupled with the HTML.","css.lint.ieHack.desc":"IE hacks are only necessary when supporting IE7 and older.","css.lint.important.desc":"Avoid using `!important`. It is an indication that the specificity of the entire CSS has gotten out of control and needs to be refactored.","css.lint.importStatement.desc":"Import statements do not load in parallel.","css.lint.propertyIgnoredDueToDisplay.desc":"Property is ignored due to the display. E.g. with `display: inline`, the `width`, `height`, `margin-top`, `margin-bottom`, and `float` properties have no effect.","css.lint.universalSelector.desc":"The universal selector (`*`) is known to be slow.","css.lint.unknownAtRules.desc":"Unknown at-rule.","css.lint.unknownProperties.desc":"Unknown property.","css.lint.validProperties.desc":"A list of properties that are not validated against the `unknownProperties` rule.","css.lint.unknownVendorSpecificProperties.desc":"Unknown vendor specific property.","css.lint.vendorPrefix.desc":"When using a vendor-specific prefix, also include the standard property.","css.lint.zeroUnits.desc":"No unit for zero needed.","css.trace.server.desc":"Traces the communication between VS Code and the CSS language server.","css.validate.title":"Controls CSS validation and problem severities.","css.validate.desc":"Enables or disables all validations.","css.hover.documentation":"Show property and value documentation in CSS hovers.","css.hover.references":"Show references to MDN in CSS hovers.","css.format.enable.desc":"Enable/disable default CSS formatter.","css.format.newlineBetweenSelectors.desc":"Separate selectors with a new line.","css.format.newlineBetweenRules.desc":"Separate rulesets by a blank line.","css.format.spaceAroundSelectorSeparator.desc":"Ensure a space character around selector separators `>`, `+`, `~` (e.g. `a > b`).","css.format.braceStyle.desc":"Put braces on the same line as rules (`collapse`) or put braces on own line (`expand`).","css.format.preserveNewLines.desc":"Whether existing line breaks before rules and declarations should be preserved.","css.format.maxPreserveNewLines.desc":"Maximum number of line breaks to be preserved in one chunk, when `#css.format.preserveNewLines#` is enabled.","less.title":"LESS","less.completion.triggerPropertyValueCompletion.desc":"By default, VS Code triggers property value completion after selecting a CSS property. Use this setting to disable this behavior.","less.completion.completePropertyWithSemicolon.desc":"Insert semicolon at end of line when completing CSS properties.","less.lint.argumentsInColorFunction.desc":"Invalid number of parameters.","less.lint.boxModel.desc":"Do not use `width` or `height` when using `padding` or `border`.","less.lint.compatibleVendorPrefixes.desc":"When using a vendor-specific prefix make sure to also include all other vendor-specific properties.","less.lint.duplicateProperties.desc":"Do not use duplicate style definitions.","less.lint.emptyRules.desc":"Do not use empty rulesets.","less.lint.float.desc":"Avoid using `float`. Floats lead to fragile CSS that is easy to break if one aspect of the layout changes.","less.lint.fontFaceProperties.desc":"`@font-face` rule must define `src` and `font-family` properties.","less.lint.hexColorLength.desc":"Hex colors must consist of 3, 4, 6 or 8 hex numbers.","less.lint.idSelector.desc":"Selectors should not contain IDs because these rules are too tightly coupled with the HTML.","less.lint.ieHack.desc":"IE hacks are only necessary when supporting IE7 and older.","less.lint.important.desc":"Avoid using `!important`. It is an indication that the specificity of the entire CSS has gotten out of control and needs to be refactored.","less.lint.importStatement.desc":"Import statements do not load in parallel.","less.lint.propertyIgnoredDueToDisplay.desc":"Property is ignored due to the display. E.g. with `display: inline`, the `width`, `height`, `margin-top`, `margin-bottom`, and `float` properties have no effect.","less.lint.universalSelector.desc":"The universal selector (`*`) is known to be slow.","less.lint.unknownAtRules.desc":"Unknown at-rule.","less.lint.unknownProperties.desc":"Unknown property.","less.lint.validProperties.desc":"A list of properties that are not validated against the `unknownProperties` rule.","less.lint.unknownVendorSpecificProperties.desc":"Unknown vendor specific property.","less.lint.vendorPrefix.desc":"When using a vendor-specific prefix, also include the standard property.","less.lint.zeroUnits.desc":"No unit for zero needed.","less.validate.title":"Controls LESS validation and problem severities.","less.validate.desc":"Enables or disables all validations.","less.hover.documentation":"Show property and value documentation in LESS hovers.","less.hover.references":"Show references to MDN in LESS hovers.","less.format.enable.desc":"Enable/disable default LESS formatter.","less.format.newlineBetweenSelectors.desc":"Separate selectors with a new line.","less.format.newlineBetweenRules.desc":"Separate rulesets by a blank line.","less.format.spaceAroundSelectorSeparator.desc":"Ensure a space character around selector separators `>`, `+`, `~` (e.g. `a > b`).","less.format.braceStyle.desc":"Put braces on the same line as rules (`collapse`) or put braces on own line (`expand`).","less.format.preserveNewLines.desc":"Whether existing line breaks before rules and declarations should be preserved.","less.format.maxPreserveNewLines.desc":"Maximum number of line breaks to be preserved in one chunk, when `#less.format.preserveNewLines#` is enabled.","scss.title":"SCSS (Sass)","scss.completion.triggerPropertyValueCompletion.desc":"By default, VS Code triggers property value completion after selecting a CSS property. Use this setting to disable this behavior.","scss.completion.completePropertyWithSemicolon.desc":"Insert semicolon at end of line when completing CSS properties.","scss.lint.argumentsInColorFunction.desc":"Invalid number of parameters.","scss.lint.boxModel.desc":"Do not use `width` or `height` when using `padding` or `border`.","scss.lint.compatibleVendorPrefixes.desc":"When using a vendor-specific prefix make sure to also include all other vendor-specific properties.","scss.lint.duplicateProperties.desc":"Do not use duplicate style definitions.","scss.lint.emptyRules.desc":"Do not use empty rulesets.","scss.lint.float.desc":"Avoid using `float`. Floats lead to fragile CSS that is easy to break if one aspect of the layout changes.","scss.lint.fontFaceProperties.desc":"`@font-face` rule must define `src` and `font-family` properties.","scss.lint.hexColorLength.desc":"Hex colors must consist of 3, 4, 6 or 8 hex numbers.","scss.lint.idSelector.desc":"Selectors should not contain IDs because these rules are too tightly coupled with the HTML.","scss.lint.ieHack.desc":"IE hacks are only necessary when supporting IE7 and older.","scss.lint.important.desc":"Avoid using `!important`. It is an indication that the specificity of the entire CSS has gotten out of control and needs to be refactored.","scss.lint.importStatement.desc":"Import statements do not load in parallel.","scss.lint.propertyIgnoredDueToDisplay.desc":"Property is ignored due to the display. E.g. with `display: inline`, the `width`, `height`, `margin-top`, `margin-bottom`, and `float` properties have no effect.","scss.lint.universalSelector.desc":"The universal selector (`*`) is known to be slow.","scss.lint.unknownAtRules.desc":"Unknown at-rule.","scss.lint.unknownProperties.desc":"Unknown property.","scss.lint.validProperties.desc":"A list of properties that are not validated against the `unknownProperties` rule.","scss.lint.unknownVendorSpecificProperties.desc":"Unknown vendor specific property.","scss.lint.vendorPrefix.desc":"When using a vendor-specific prefix, also include the standard property.","scss.lint.zeroUnits.desc":"No unit for zero needed.","scss.validate.title":"Controls SCSS validation and problem severities.","scss.validate.desc":"Enables or disables all validations.","scss.hover.documentation":"Show property and value documentation in SCSS hovers.","scss.hover.references":"Show references to MDN in SCSS hovers.","scss.format.enable.desc":"Enable/disable default SCSS formatter.","scss.format.newlineBetweenSelectors.desc":"Separate selectors with a new line.","scss.format.newlineBetweenRules.desc":"Separate rulesets by a blank line.","scss.format.spaceAroundSelectorSeparator.desc":"Ensure a space character around selector separators `>`, `+`, `~` (e.g. `a > b`).","scss.format.braceStyle.desc":"Put braces on the same line as rules (`collapse`) or put braces on own line (`expand`).","scss.format.preserveNewLines.desc":"Whether existing line breaks before rules and declarations should be preserved.","scss.format.maxPreserveNewLines.desc":"Maximum number of line breaks to be preserved in one chunk, when `#scss.format.preserveNewLines#` is enabled.","css.colorDecorators.enable.deprecationMessage":"The setting `css.colorDecorators.enable` has been deprecated in favor of `editor.colorDecorators`.","scss.colorDecorators.enable.deprecationMessage":"The setting `scss.colorDecorators.enable` has been deprecated in favor of `editor.colorDecorators`.","less.colorDecorators.enable.deprecationMessage":"The setting `less.colorDecorators.enable` has been deprecated in favor of `editor.colorDecorators`."},readmePath:"css-language-features/README.md"},{extensionPath:"dart",packageJSON:{name:"dart",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"0.10.x"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin dart-lang/dart-syntax-highlight grammars/dart.json ./syntaxes/dart.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"dart",extensions:[".dart"],aliases:["Dart"],configuration:"./language-configuration.json"}],grammars:[{language:"dart",scopeName:"source.dart",path:"./syntaxes/dart.tmLanguage.json"}]}},packageNLS:{displayName:"Dart Language Basics",description:"Provides syntax highlighting & bracket matching in Dart files."}},{extensionPath:"diff",packageJSON:{name:"diff",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"0.10.x"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin textmate/diff.tmbundle Syntaxes/Diff.plist ./syntaxes/diff.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"diff",aliases:["Diff","diff"],extensions:[".diff",".patch",".rej"],configuration:"./language-configuration.json"}],grammars:[{language:"diff",scopeName:"source.diff",path:"./syntaxes/diff.tmLanguage.json"}]}},packageNLS:{displayName:"Diff Language Basics",description:"Provides syntax highlighting & bracket matching in Diff files."}},{extensionPath:"docker",packageJSON:{name:"docker",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{},categories:["Programming Languages"],contributes:{languages:[{id:"dockerfile",extensions:[".dockerfile",".containerfile"],filenames:["Dockerfile","Containerfile"],filenamePatterns:["Dockerfile.*","Containerfile.*"],aliases:["Docker","Dockerfile","Containerfile"],configuration:"./language-configuration.json"}],grammars:[{language:"dockerfile",scopeName:"source.dockerfile",path:"./syntaxes/docker.tmLanguage.json"}],configurationDefaults:{"[dockerfile]":{"editor.quickSuggestions":{strings:!0}}}},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Docker Language Basics",description:"Provides syntax highlighting and bracket matching in Docker files."}},{extensionPath:"dotenv",packageJSON:{name:"dotenv",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin dotenv-org/dotenv-vscode syntaxes/dotenv.tmLanguage.json ./syntaxes/dotenv.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"dotenv",extensions:[".env"],filenames:[".env",".flaskenv","user-dirs.dirs"],filenamePatterns:[".env.*"],aliases:["Dotenv"],configuration:"./language-configuration.json"}],grammars:[{language:"dotenv",scopeName:"source.dotenv",path:"./syntaxes/dotenv.tmLanguage.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Dotenv Language Basics",description:"Provides syntax highlighting and bracket matching in dotenv files."}},{extensionPath:"emmet",packageJSON:{name:"emmet",displayName:"Emmet",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"^1.13.0"},icon:"images/icon.png",categories:["Other"],repository:{type:"git",url:"https://github.com/microsoft/vscode.git"},activationEvents:["onCommand:emmet.expandAbbreviation","onLanguage"],main:"./dist/node/emmetNodeMain",browser:"./dist/browser/emmetBrowserMain",contributes:{configuration:{type:"object",title:"Emmet",properties:{"emmet.showExpandedAbbreviation":{type:["string"],enum:["never","always","inMarkupAndStylesheetFilesOnly"],default:"always",markdownDescription:"%emmetShowExpandedAbbreviation%"},"emmet.showAbbreviationSuggestions":{type:"boolean",default:!0,scope:"language-overridable",markdownDescription:"%emmetShowAbbreviationSuggestions%"},"emmet.includeLanguages":{type:"object",additionalProperties:{type:"string"},default:{},markdownDescription:"%emmetIncludeLanguages%"},"emmet.variables":{type:"object",properties:{lang:{type:"string",default:"en"},charset:{type:"string",default:"UTF-8"}},additionalProperties:{type:"string"},default:{},markdownDescription:"%emmetVariables%"},"emmet.syntaxProfiles":{type:"object",default:{},markdownDescription:"%emmetSyntaxProfiles%"},"emmet.excludeLanguages":{type:"array",items:{type:"string"},default:["markdown"],markdownDescription:"%emmetExclude%"},"emmet.extensionsPath":{type:"array",items:{type:"string",markdownDescription:"%emmetExtensionsPathItem%"},default:[],scope:"machine-overridable",markdownDescription:"%emmetExtensionsPath%"},"emmet.triggerExpansionOnTab":{type:"boolean",default:!1,scope:"language-overridable",markdownDescription:"%emmetTriggerExpansionOnTab%"},"emmet.useInlineCompletions":{type:"boolean",default:!1,markdownDescription:"%emmetUseInlineCompletions%"},"emmet.preferences":{type:"object",default:{},markdownDescription:"%emmetPreferences%",properties:{"css.intUnit":{type:"string",default:"px",markdownDescription:"%emmetPreferencesIntUnit%"},"css.floatUnit":{type:"string",default:"em",markdownDescription:"%emmetPreferencesFloatUnit%"},"css.propertyEnd":{type:"string",default:";",markdownDescription:"%emmetPreferencesCssAfter%"},"sass.propertyEnd":{type:"string",default:"",markdownDescription:"%emmetPreferencesSassAfter%"},"stylus.propertyEnd":{type:"string",default:"",markdownDescription:"%emmetPreferencesStylusAfter%"},"css.valueSeparator":{type:"string",default:": ",markdownDescription:"%emmetPreferencesCssBetween%"},"sass.valueSeparator":{type:"string",default:": ",markdownDescription:"%emmetPreferencesSassBetween%"},"stylus.valueSeparator":{type:"string",default:" ",markdownDescription:"%emmetPreferencesStylusBetween%"},"bem.elementSeparator":{type:"string",default:"__",markdownDescription:"%emmetPreferencesBemElementSeparator%"},"bem.modifierSeparator":{type:"string",default:"_",markdownDescription:"%emmetPreferencesBemModifierSeparator%"},"filter.commentBefore":{type:"string",default:"",markdownDescription:"%emmetPreferencesFilterCommentBefore%"},"filter.commentAfter":{type:"string",default:`
<!-- /[#ID][.CLASS] -->`,markdownDescription:"%emmetPreferencesFilterCommentAfter%"},"filter.commentTrigger":{type:"array",default:["id","class"],markdownDescription:"%emmetPreferencesFilterCommentTrigger%"},"format.noIndentTags":{type:"array",default:["html"],markdownDescription:"%emmetPreferencesFormatNoIndentTags%"},"format.forceIndentationForTags":{type:"array",default:["body"],markdownDescription:"%emmetPreferencesFormatForceIndentTags%"},"profile.allowCompactBoolean":{type:"boolean",default:!1,markdownDescription:"%emmetPreferencesAllowCompactBoolean%"},"css.webkitProperties":{type:"string",default:null,markdownDescription:"%emmetPreferencesCssWebkitProperties%"},"css.mozProperties":{type:"string",default:null,markdownDescription:"%emmetPreferencesCssMozProperties%"},"css.oProperties":{type:"string",default:null,markdownDescription:"%emmetPreferencesCssOProperties%"},"css.msProperties":{type:"string",default:null,markdownDescription:"%emmetPreferencesCssMsProperties%"},"css.fuzzySearchMinScore":{type:"number",default:.3,markdownDescription:"%emmetPreferencesCssFuzzySearchMinScore%"},"output.inlineBreak":{type:"number",default:0,markdownDescription:"%emmetPreferencesOutputInlineBreak%"},"output.reverseAttributes":{type:"boolean",default:!1,markdownDescription:"%emmetPreferencesOutputReverseAttributes%"},"output.selfClosingStyle":{type:"string",enum:["html","xhtml","xml"],default:"html",markdownDescription:"%emmetPreferencesOutputSelfClosingStyle%"},"css.color.short":{type:"boolean",default:!0,markdownDescription:"%emmetPreferencesCssColorShort%"}}},"emmet.showSuggestionsAsSnippets":{type:"boolean",default:!1,markdownDescription:"%emmetShowSuggestionsAsSnippets%"},"emmet.optimizeStylesheetParsing":{type:"boolean",default:!0,markdownDescription:"%emmetOptimizeStylesheetParsing%"}}},commands:[{command:"editor.emmet.action.wrapWithAbbreviation",title:"%command.wrapWithAbbreviation%",category:"Emmet"},{command:"editor.emmet.action.removeTag",title:"%command.removeTag%",category:"Emmet"},{command:"editor.emmet.action.updateTag",title:"%command.updateTag%",category:"Emmet"},{command:"editor.emmet.action.matchTag",title:"%command.matchTag%",category:"Emmet"},{command:"editor.emmet.action.balanceIn",title:"%command.balanceIn%",category:"Emmet"},{command:"editor.emmet.action.balanceOut",title:"%command.balanceOut%",category:"Emmet"},{command:"editor.emmet.action.prevEditPoint",title:"%command.prevEditPoint%",category:"Emmet"},{command:"editor.emmet.action.nextEditPoint",title:"%command.nextEditPoint%",category:"Emmet"},{command:"editor.emmet.action.mergeLines",title:"%command.mergeLines%",category:"Emmet"},{command:"editor.emmet.action.selectPrevItem",title:"%command.selectPrevItem%",category:"Emmet"},{command:"editor.emmet.action.selectNextItem",title:"%command.selectNextItem%",category:"Emmet"},{command:"editor.emmet.action.splitJoinTag",title:"%command.splitJoinTag%",category:"Emmet"},{command:"editor.emmet.action.toggleComment",title:"%command.toggleComment%",category:"Emmet"},{command:"editor.emmet.action.evaluateMathExpression",title:"%command.evaluateMathExpression%",category:"Emmet"},{command:"editor.emmet.action.updateImageSize",title:"%command.updateImageSize%",category:"Emmet"},{command:"editor.emmet.action.incrementNumberByOneTenth",title:"%command.incrementNumberByOneTenth%",category:"Emmet"},{command:"editor.emmet.action.incrementNumberByOne",title:"%command.incrementNumberByOne%",category:"Emmet"},{command:"editor.emmet.action.incrementNumberByTen",title:"%command.incrementNumberByTen%",category:"Emmet"},{command:"editor.emmet.action.decrementNumberByOneTenth",title:"%command.decrementNumberByOneTenth%",category:"Emmet"},{command:"editor.emmet.action.decrementNumberByOne",title:"%command.decrementNumberByOne%",category:"Emmet"},{command:"editor.emmet.action.decrementNumberByTen",title:"%command.decrementNumberByTen%",category:"Emmet"},{command:"editor.emmet.action.reflectCSSValue",title:"%command.reflectCSSValue%",category:"Emmet"},{command:"workbench.action.showEmmetCommands",title:"%command.showEmmetCommands%",category:""}],menus:{commandPalette:[{command:"editor.emmet.action.wrapWithAbbreviation",when:"!activeEditorIsReadonly"},{command:"editor.emmet.action.removeTag",when:"!activeEditorIsReadonly"},{command:"editor.emmet.action.updateTag",when:"!activeEditorIsReadonly"},{command:"editor.emmet.action.matchTag",when:"!activeEditorIsReadonly"},{command:"editor.emmet.action.balanceIn",when:"!activeEditorIsReadonly"},{command:"editor.emmet.action.balanceOut",when:"!activeEditorIsReadonly"},{command:"editor.emmet.action.prevEditPoint",when:"!activeEditorIsReadonly"},{command:"editor.emmet.action.nextEditPoint",when:"!activeEditorIsReadonly"},{command:"editor.emmet.action.mergeLines",when:"!activeEditorIsReadonly"},{command:"editor.emmet.action.selectPrevItem",when:"!activeEditorIsReadonly"},{command:"editor.emmet.action.selectNextItem",when:"!activeEditorIsReadonly"},{command:"editor.emmet.action.splitJoinTag",when:"!activeEditorIsReadonly"},{command:"editor.emmet.action.toggleComment",when:"!activeEditorIsReadonly"},{command:"editor.emmet.action.evaluateMathExpression",when:"!activeEditorIsReadonly"},{command:"editor.emmet.action.updateImageSize",when:"!activeEditorIsReadonly"},{command:"editor.emmet.action.incrementNumberByOneTenth",when:"!activeEditorIsReadonly"},{command:"editor.emmet.action.incrementNumberByOne",when:"!activeEditorIsReadonly"},{command:"editor.emmet.action.incrementNumberByTen",when:"!activeEditorIsReadonly"},{command:"editor.emmet.action.decrementNumberByOneTenth",when:"!activeEditorIsReadonly"},{command:"editor.emmet.action.decrementNumberByOne",when:"!activeEditorIsReadonly"},{command:"editor.emmet.action.decrementNumberByTen",when:"!activeEditorIsReadonly"},{command:"editor.emmet.action.reflectCSSValue",when:"!activeEditorIsReadonly"}]}},capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:!0}}},packageNLS:{description:"Emmet support for VS Code","command.wrapWithAbbreviation":"Wrap with Abbreviation","command.removeTag":"Remove Tag","command.updateTag":"Update Tag","command.matchTag":"Go to Matching Pair","command.balanceIn":"Balance (inward)","command.balanceOut":"Balance (outward)","command.prevEditPoint":"Go to Previous Edit Point","command.nextEditPoint":"Go to Next Edit Point","command.mergeLines":"Merge Lines","command.selectPrevItem":"Select Previous Item","command.selectNextItem":"Select Next Item","command.splitJoinTag":"Split/Join Tag","command.toggleComment":"Toggle Comment","command.evaluateMathExpression":"Evaluate Math Expression","command.updateImageSize":"Update Image Size","command.reflectCSSValue":"Reflect CSS Value","command.incrementNumberByOne":"Increment by 1","command.decrementNumberByOne":"Decrement by 1","command.incrementNumberByOneTenth":"Increment by 0.1","command.decrementNumberByOneTenth":"Decrement by 0.1","command.incrementNumberByTen":"Increment by 10","command.decrementNumberByTen":"Decrement by 10","command.showEmmetCommands":"Show Emmet Commands",emmetSyntaxProfiles:"Define profile for specified syntax or use your own profile with specific rules.",emmetExclude:"An array of languages where Emmet abbreviations should not be expanded.",emmetExtensionsPath:`An array of paths, where each path can contain Emmet syntaxProfiles and/or snippet files.
In case of conflicts, the profiles/snippets of later paths will override those of earlier paths.
See https://code.visualstudio.com/docs/editor/emmet for more information and an example snippet file.`,emmetExtensionsPathItem:"A path containing Emmet syntaxProfiles and/or snippets.",emmetShowExpandedAbbreviation:'Shows expanded Emmet abbreviations as suggestions.\nThe option `"inMarkupAndStylesheetFilesOnly"` applies to html, haml, jade, slim, xml, xsl, css, scss, sass, less and stylus.\nThe option `"always"` applies to all parts of the file regardless of markup/css.',emmetShowAbbreviationSuggestions:'Shows possible Emmet abbreviations as suggestions. Not applicable in stylesheets or when emmet.showExpandedAbbreviation is set to `"never"`.',emmetIncludeLanguages:'Enable Emmet abbreviations in languages that are not supported by default. Add a mapping here between the language and Emmet supported language.\n For example: `{"vue-html": "html", "javascript": "javascriptreact"}`',emmetVariables:"Variables to be used in Emmet snippets.",emmetTriggerExpansionOnTab:"When enabled, Emmet abbreviations are expanded when pressing TAB, even when completions do not show up. When disabled, completions that show up can still be accepted by pressing TAB.",emmetPreferences:"Preferences used to modify behavior of some actions and resolvers of Emmet.",emmetPreferencesIntUnit:"Default unit for integer values.",emmetPreferencesFloatUnit:"Default unit for float values.",emmetPreferencesCssAfter:"Symbol to be placed at the end of CSS property when expanding CSS abbreviations.",emmetPreferencesSassAfter:"Symbol to be placed at the end of CSS property when expanding CSS abbreviations in Sass files.",emmetPreferencesStylusAfter:"Symbol to be placed at the end of CSS property when expanding CSS abbreviations in Stylus files.",emmetPreferencesCssBetween:"Symbol to be placed at the between CSS property and value when expanding CSS abbreviations.",emmetPreferencesSassBetween:"Symbol to be placed at the between CSS property and value when expanding CSS abbreviations in Sass files.",emmetPreferencesStylusBetween:"Symbol to be placed at the between CSS property and value when expanding CSS abbreviations in Stylus files.",emmetShowSuggestionsAsSnippets:"If `true`, then Emmet suggestions will show up as snippets allowing you to order them as per `#editor.snippetSuggestions#` setting.",emmetPreferencesBemElementSeparator:"Element separator used for classes when using the BEM filter.",emmetPreferencesBemModifierSeparator:"Modifier separator used for classes when using the BEM filter.",emmetPreferencesFilterCommentBefore:"A definition of comment that should be placed before matched element when comment filter is applied.",emmetPreferencesFilterCommentAfter:"A definition of comment that should be placed after matched element when comment filter is applied.",emmetPreferencesFilterCommentTrigger:"A comma-separated list of attribute names that should exist in the abbreviation for the comment filter to be applied.",emmetPreferencesFormatNoIndentTags:"An array of tag names that should never get inner indentation.",emmetPreferencesFormatForceIndentTags:"An array of tag names that should always get inner indentation.",emmetPreferencesAllowCompactBoolean:"If `true`, compact notation of boolean attributes are produced.",emmetPreferencesCssWebkitProperties:"Comma separated CSS properties that get the `webkit` vendor prefix when used in Emmet abbreviation that starts with `-`. Set to empty string to always avoid the `webkit` prefix.",emmetPreferencesCssMozProperties:"Comma separated CSS properties that get the `moz` vendor prefix when used in Emmet abbreviation that starts with `-`. Set to empty string to always avoid the `moz` prefix.",emmetPreferencesCssOProperties:"Comma separated CSS properties that get the `o` vendor prefix when used in Emmet abbreviation that starts with `-`. Set to empty string to always avoid the `o` prefix.",emmetPreferencesCssMsProperties:"Comma separated CSS properties that get the `ms` vendor prefix when used in Emmet abbreviation that starts with `-`. Set to empty string to always avoid the `ms` prefix.",emmetPreferencesCssFuzzySearchMinScore:"The minimum score (from 0 to 1) that fuzzy-matched abbreviation should achieve. Lower values may produce many false-positive matches, higher values may reduce possible matches.",emmetOptimizeStylesheetParsing:"When set to `false`, the whole file is parsed to determine if current position is valid for expanding Emmet abbreviations. When set to `true`, only the content around the current position in CSS/SCSS/Less files is parsed.",emmetPreferencesOutputInlineBreak:"The number of sibling inline elements needed for line breaks to be placed between those elements. If `0`, inline elements are always expanded onto a single line.",emmetPreferencesOutputReverseAttributes:"If `true`, reverses attribute merging directions when resolving snippets.",emmetPreferencesOutputSelfClosingStyle:"Style of self-closing tags: html (`<br>`), xml (`<br/>`) or xhtml (`<br />`).",emmetPreferencesCssColorShort:"If `true`, color values like `#f` will be expanded to `#fff` instead of `#ffffff`.",emmetUseInlineCompletions:"If `true`, Emmet will use inline completions to suggest expansions. To prevent the non-inline completion item provider from showing up as often while this setting is `true`, turn `#editor.quickSuggestions#` to `inline` or `off` for the `other` item."},readmePath:"emmet/README.md"},{extensionPath:"extension-editing",packageJSON:{name:"extension-editing",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"^1.4.0"},icon:"images/icon.png",activationEvents:["onLanguage:json","onLanguage:markdown"],main:"./dist/extensionEditingMain",browser:"./dist/browser/extensionEditingBrowserMain",capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:!0}},contributes:{jsonValidation:[{fileMatch:"package.json",url:"vscode://schemas/vscode-extensions"},{fileMatch:"*language-configuration.json",url:"vscode://schemas/language-configuration"},{fileMatch:["*icon-theme.json","!*product-icon-theme.json"],url:"vscode://schemas/icon-theme"},{fileMatch:"*product-icon-theme.json",url:"vscode://schemas/product-icon-theme"},{fileMatch:"*color-theme.json",url:"vscode://schemas/color-theme"}],languages:[{id:"ignore",filenames:[".vscodeignore"]}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Extension Authoring",description:"Provides linting capabilities for authoring extensions."}},{extensionPath:"fsharp",packageJSON:{name:"fsharp",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin ionide/ionide-fsgrammar grammars/fsharp.json ./syntaxes/fsharp.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"fsharp",extensions:[".fs",".fsi",".fsx",".fsscript"],aliases:["F#","FSharp","fsharp"],configuration:"./language-configuration.json"}],grammars:[{language:"fsharp",scopeName:"source.fsharp",path:"./syntaxes/fsharp.tmLanguage.json"}],snippets:[{language:"fsharp",path:"./snippets/fsharp.code-snippets"}],configurationDefaults:{"[fsharp]":{"diffEditor.ignoreTrimWhitespace":!1}}},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"F# Language Basics",description:"Provides snippets, syntax highlighting, bracket matching and folding in F# files."}},{extensionPath:"git-base",packageJSON:{name:"git-base",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"0.10.x"},categories:["Other"],activationEvents:["*"],main:"./dist/extension.js",browser:"./dist/browser/extension.js",icon:"resources/icons/git.png",capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:!0}},contributes:{commands:[{command:"git-base.api.getRemoteSources",title:"%command.api.getRemoteSources%",category:"Git Base API"}],menus:{commandPalette:[{command:"git-base.api.getRemoteSources",when:"false"}]},languages:[{id:"git-commit",aliases:["Git Commit Message","git-commit"],filenames:["COMMIT_EDITMSG","MERGE_MSG"],configuration:"./languages/git-commit.language-configuration.json"},{id:"git-rebase",aliases:["Git Rebase Message","git-rebase"],filenames:["git-rebase-todo"],filenamePatterns:["**/rebase-merge/done"],configuration:"./languages/git-rebase.language-configuration.json"},{id:"ignore",aliases:["Ignore","ignore"],extensions:[".gitignore_global",".gitignore",".git-blame-ignore-revs"],configuration:"./languages/ignore.language-configuration.json"}],grammars:[{language:"git-commit",scopeName:"text.git-commit",path:"./syntaxes/git-commit.tmLanguage.json"},{language:"git-rebase",scopeName:"text.git-rebase",path:"./syntaxes/git-rebase.tmLanguage.json"},{language:"ignore",scopeName:"source.ignore",path:"./syntaxes/ignore.tmLanguage.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Git Base",description:"Git static contributions and pickers.","command.api.getRemoteSources":"Get Remote Sources"},readmePath:"git-base/README.md"},{extensionPath:"github-authentication",packageJSON:{name:"github-authentication",displayName:"%displayName%",description:"%description%",publisher:"vscode",license:"MIT",version:"0.0.2",engines:{vscode:"^1.41.0"},icon:"images/icon.png",categories:["Other"],api:"none",extensionKind:["ui","workspace"],enabledApiProposals:["authIssuers","authProviderSpecific","agentSessionsWorkspace"],activationEvents:[],capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:"limited",restrictedConfigurations:["github-enterprise.uri"]}},contributes:{authentication:[{label:"GitHub",id:"github",authorizationServerGlobs:["https://github.com/login/oauth"]},{label:"GitHub Enterprise Server",id:"github-enterprise",authorizationServerGlobs:["*"]}],configuration:[{title:"%config.github-enterprise.title%",properties:{"github-enterprise.uri":{type:"string",markdownDescription:"%config.github-enterprise.uri.description%",pattern:"^(?:$|(https?)://(?!github\\.com).*)"},"github-authentication.useElectronFetch":{type:"boolean",default:!0,scope:"application",markdownDescription:"%config.github-authentication.useElectronFetch.description%"},"github-authentication.preferDeviceCodeFlow":{type:"boolean",default:!1,scope:"application",markdownDescription:"%config.github-authentication.preferDeviceCodeFlow.description%"}}}]},aiKey:"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",main:"./dist/extension.js",browser:"./dist/browser/extension.js",repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"GitHub Authentication",description:"GitHub Authentication Provider","config.github-enterprise.title":"GHE.com & GitHub Enterprise Server Authentication","config.github-enterprise.uri.description":`The URI for your GHE.com or GitHub Enterprise Server instance.

Examples:
* GHE.com: \`https://octocat.ghe.com\`
* GitHub Enterprise Server: \`https://github.octocat.com\`

> **Note:** This should _not_ be set to a GitHub.com URI. If your account exists on GitHub.com or is a GitHub Enterprise Managed User, you do not need any additional configuration and can simply log in to GitHub.`,"config.github-authentication.useElectronFetch.description":"When true, uses Electron's built-in fetch function for HTTP requests. When false, uses the Node.js global fetch function. This setting only applies when running in the Electron environment. **Note:** A restart is required for this setting to take effect.","config.github-authentication.preferDeviceCodeFlow.description":"When true, prioritize the device code flow for authentication instead of other available flows. This is useful for environments like WSL where the local server or URL handler flows may not work as expected."},readmePath:"github-authentication/README.md"},{extensionPath:"go",packageJSON:{name:"go",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin worlpaker/go-syntax syntaxes/go.tmLanguage.json ./syntaxes/go.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"go",extensions:[".go"],aliases:["Go"],configuration:"./language-configuration.json"}],grammars:[{language:"go",scopeName:"source.go",path:"./syntaxes/go.tmLanguage.json"}],configurationDefaults:{"[go]":{"editor.insertSpaces":!1}}},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Go Language Basics",description:"Provides syntax highlighting and bracket matching in Go files."}},{extensionPath:"groovy",packageJSON:{name:"groovy",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin textmate/groovy.tmbundle Syntaxes/Groovy.tmLanguage ./syntaxes/groovy.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"groovy",aliases:["Groovy","groovy"],extensions:[".groovy",".gvy",".gradle",".jenkinsfile",".nf"],filenames:["Jenkinsfile"],filenamePatterns:["Jenkinsfile*"],firstLine:"^#!.*\\bgroovy\\b",configuration:"./language-configuration.json"}],grammars:[{language:"groovy",scopeName:"source.groovy",path:"./syntaxes/groovy.tmLanguage.json"}],snippets:[{language:"groovy",path:"./snippets/groovy.code-snippets"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Groovy Language Basics",description:"Provides snippets, syntax highlighting and bracket matching in Groovy files."}},{extensionPath:"handlebars",packageJSON:{name:"handlebars",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"0.10.x"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin daaain/Handlebars grammars/Handlebars.json ./syntaxes/Handlebars.tmLanguage.json"},categories:["Programming Languages"],extensionKind:["ui","workspace"],contributes:{languages:[{id:"handlebars",extensions:[".handlebars",".hbs",".hjs"],aliases:["Handlebars","handlebars"],mimetypes:["text/x-handlebars-template"],configuration:"./language-configuration.json"}],grammars:[{language:"handlebars",scopeName:"text.html.handlebars",path:"./syntaxes/Handlebars.tmLanguage.json"}],htmlLanguageParticipants:[{languageId:"handlebars",autoInsert:!0}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Handlebars Language Basics",description:"Provides syntax highlighting and bracket matching in Handlebars files."}},{extensionPath:"hlsl",packageJSON:{name:"hlsl",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin tgjones/shaders-tmLanguage grammars/hlsl.json ./syntaxes/hlsl.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"hlsl",extensions:[".hlsl",".hlsli",".fx",".fxh",".vsh",".psh",".cginc",".compute"],aliases:["HLSL","hlsl"],configuration:"./language-configuration.json"}],grammars:[{language:"hlsl",path:"./syntaxes/hlsl.tmLanguage.json",scopeName:"source.hlsl"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"HLSL Language Basics",description:"Provides syntax highlighting and bracket matching in HLSL files."}},{extensionPath:"html",packageJSON:{name:"html",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"0.10.x"},scripts:{"update-grammar":"node ./build/update-grammar.mjs"},categories:["Programming Languages"],contributes:{languages:[{id:"html",extensions:[".html",".htm",".shtml",".xhtml",".xht",".mdoc",".jsp",".asp",".aspx",".jshtm",".volt",".ejs",".rhtml"],aliases:["HTML","htm","html","xhtml"],mimetypes:["text/html","text/x-jshtm","text/template","text/ng-template","application/xhtml+xml"],configuration:"./language-configuration.json"}],grammars:[{scopeName:"text.html.basic",path:"./syntaxes/html.tmLanguage.json",embeddedLanguages:{"text.html":"html","source.css":"css","source.js":"javascript","source.python":"python","source.smarty":"smarty"},tokenTypes:{"meta.tag string.quoted":"other"}},{language:"html",scopeName:"text.html.derivative",path:"./syntaxes/html-derivative.tmLanguage.json",embeddedLanguages:{"text.html":"html","source.css":"css","source.js":"javascript","source.python":"python","source.smarty":"smarty"},tokenTypes:{"meta.tag string.quoted":"other"}}],snippets:[{language:"html",path:"./snippets/html.code-snippets"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"HTML Language Basics",description:"Provides syntax highlighting, bracket matching & snippets in HTML files."}},{extensionPath:"html-language-features",packageJSON:{name:"html-language-features",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",aiKey:"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",engines:{vscode:"^1.77.0"},icon:"icons/html.png",activationEvents:["onLanguage:html","onLanguage:handlebars"],enabledApiProposals:["extensionsAny"],main:"./client/dist/node/htmlClientMain",browser:"./client/dist/browser/htmlClientMain",capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:!0}},categories:["Programming Languages"],contributes:{configuration:{id:"html",order:20,type:"object",title:"HTML",properties:{"html.completion.attributeDefaultValue":{type:"string",scope:"resource",enum:["doublequotes","singlequotes","empty"],enumDescriptions:["%html.completion.attributeDefaultValue.doublequotes%","%html.completion.attributeDefaultValue.singlequotes%","%html.completion.attributeDefaultValue.empty%"],default:"doublequotes",markdownDescription:"%html.completion.attributeDefaultValue%"},"html.customData":{type:"array",markdownDescription:"%html.customData.desc%",default:[],items:{type:"string"},scope:"resource"},"html.format.enable":{type:"boolean",scope:"window",default:!0,description:"%html.format.enable.desc%"},"html.format.wrapLineLength":{type:"integer",scope:"resource",default:120,description:"%html.format.wrapLineLength.desc%"},"html.format.unformatted":{type:["string","null"],scope:"resource",default:"wbr",markdownDescription:"%html.format.unformatted.desc%"},"html.format.contentUnformatted":{type:["string","null"],scope:"resource",default:"pre,code,textarea",markdownDescription:"%html.format.contentUnformatted.desc%"},"html.format.indentInnerHtml":{type:"boolean",scope:"resource",default:!1,markdownDescription:"%html.format.indentInnerHtml.desc%"},"html.format.preserveNewLines":{type:"boolean",scope:"resource",default:!0,description:"%html.format.preserveNewLines.desc%"},"html.format.maxPreserveNewLines":{type:["number","null"],scope:"resource",default:null,markdownDescription:"%html.format.maxPreserveNewLines.desc%"},"html.format.indentHandlebars":{type:"boolean",scope:"resource",default:!1,markdownDescription:"%html.format.indentHandlebars.desc%"},"html.format.extraLiners":{type:["string","null"],scope:"resource",default:"head, body, /html",markdownDescription:"%html.format.extraLiners.desc%"},"html.format.wrapAttributes":{type:"string",scope:"resource",default:"auto",enum:["auto","force","force-aligned","force-expand-multiline","aligned-multiple","preserve","preserve-aligned"],enumDescriptions:["%html.format.wrapAttributes.auto%","%html.format.wrapAttributes.force%","%html.format.wrapAttributes.forcealign%","%html.format.wrapAttributes.forcemultiline%","%html.format.wrapAttributes.alignedmultiple%","%html.format.wrapAttributes.preserve%","%html.format.wrapAttributes.preservealigned%"],description:"%html.format.wrapAttributes.desc%"},"html.format.wrapAttributesIndentSize":{type:["number","null"],scope:"resource",default:null,markdownDescription:"%html.format.wrapAttributesIndentSize.desc%"},"html.format.templating":{type:"boolean",scope:"resource",default:!1,description:"%html.format.templating.desc%"},"html.format.unformattedContentDelimiter":{type:"string",scope:"resource",default:"",markdownDescription:"%html.format.unformattedContentDelimiter.desc%"},"html.suggest.html5":{type:"boolean",scope:"resource",default:!0,description:"%html.suggest.html5.desc%"},"html.suggest.hideEndTagSuggestions":{type:"boolean",scope:"resource",default:!1,description:"%html.suggest.hideEndTagSuggestions.desc%"},"html.validate.scripts":{type:"boolean",scope:"resource",default:!0,description:"%html.validate.scripts%"},"html.validate.styles":{type:"boolean",scope:"resource",default:!0,description:"%html.validate.styles%"},"html.autoCreateQuotes":{type:"boolean",scope:"resource",default:!0,markdownDescription:"%html.autoCreateQuotes%"},"html.autoClosingTags":{type:"boolean",scope:"resource",default:!0,description:"%html.autoClosingTags%"},"html.hover.documentation":{type:"boolean",scope:"resource",default:!0,description:"%html.hover.documentation%"},"html.hover.references":{type:"boolean",scope:"resource",default:!0,description:"%html.hover.references%"},"html.mirrorCursorOnMatchingTag":{type:"boolean",scope:"resource",default:!1,description:"%html.mirrorCursorOnMatchingTag%",deprecationMessage:"%html.mirrorCursorOnMatchingTagDeprecationMessage%"},"html.trace.server":{type:"string",scope:"window",enum:["off","messages","verbose"],default:"off",description:"%html.trace.server.desc%"}}},configurationDefaults:{"[html]":{"editor.suggest.insertMode":"replace"},"[handlebars]":{"editor.suggest.insertMode":"replace"}},jsonValidation:[{fileMatch:"*.html-data.json",url:"https://raw.githubusercontent.com/microsoft/vscode-html-languageservice/master/docs/customData.schema.json"},{fileMatch:"package.json",url:"./schemas/package.schema.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"HTML Language Features",description:"Provides rich language support for HTML and Handlebar files","html.customData.desc":`A list of relative file paths pointing to JSON files following the [custom data format](https://github.com/microsoft/vscode-html-languageservice/blob/master/docs/customData.md).

VS Code loads custom data on startup to enhance its HTML support for the custom HTML tags, attributes and attribute values you specify in the JSON files.

The file paths are relative to workspace and only workspace folder settings are considered.`,"html.format.enable.desc":"Enable/disable default HTML formatter.","html.format.wrapLineLength.desc":"Maximum amount of characters per line (0 = disable).","html.format.unformatted.desc":"List of tags, comma separated, that shouldn't be reformatted. `null` defaults to all tags listed at https://www.w3.org/TR/html5/dom.html#phrasing-content.","html.format.contentUnformatted.desc":"List of tags, comma separated, where the content shouldn't be reformatted. `null` defaults to the `pre` tag.","html.format.indentInnerHtml.desc":"Indent `<head>` and `<body>` sections.","html.format.preserveNewLines.desc":"Controls whether existing line breaks before elements should be preserved. Only works before elements, not inside tags or for text.","html.format.maxPreserveNewLines.desc":"Maximum number of line breaks to be preserved in one chunk. Use `null` for unlimited.","html.format.indentHandlebars.desc":"Format and indent `{{#foo}}` and `{{/foo}}`.","html.format.extraLiners.desc":'List of tags, comma separated, that should have an extra newline before them. `null` defaults to `"head, body, /html"`.',"html.format.wrapAttributes.desc":"Wrap attributes.","html.format.wrapAttributes.auto":"Wrap attributes only when line length is exceeded.","html.format.wrapAttributes.force":"Wrap each attribute except first.","html.format.wrapAttributes.forcealign":"Wrap each attribute except first and keep aligned.","html.format.wrapAttributes.forcemultiline":"Wrap each attribute.","html.format.wrapAttributes.alignedmultiple":"Wrap when line length is exceeded, align attributes vertically.","html.format.wrapAttributes.preserve":"Preserve wrapping of attributes.","html.format.wrapAttributes.preservealigned":"Preserve wrapping of attributes but align.","html.format.templating.desc":"Honor django, erb, handlebars and php templating language tags.","html.format.unformattedContentDelimiter.desc":"Keep text content together between this string.","html.format.wrapAttributesIndentSize.desc":"Indent wrapped attributes to after N characters. Use `null` to use the default indent size. Ignored if `#html.format.wrapAttributes#` is set to `aligned`.","html.suggest.html5.desc":"Controls whether the built-in HTML language support suggests HTML5 tags, properties and values.","html.suggest.hideEndTagSuggestions.desc":"Controls whether the built-in HTML language support suggests closing tags. When disabled, end tag completions like `</div>` will not be shown.","html.trace.server.desc":"Traces the communication between VS Code and the HTML language server.","html.validate.scripts":"Controls whether the built-in HTML language support validates embedded scripts.","html.validate.styles":"Controls whether the built-in HTML language support validates embedded styles.","html.autoCreateQuotes":"Enable/disable auto creation of quotes for HTML attribute assignment. The type of quotes can be configured by `#html.completion.attributeDefaultValue#`.","html.autoClosingTags":"Enable/disable autoclosing of HTML tags.","html.completion.attributeDefaultValue":"Controls the default value for attributes when completion is accepted.","html.completion.attributeDefaultValue.doublequotes":'Attribute value is set to "".',"html.completion.attributeDefaultValue.singlequotes":"Attribute value is set to ''.","html.completion.attributeDefaultValue.empty":"Attribute value is not set.","html.mirrorCursorOnMatchingTag":"Enable/disable mirroring cursor on matching HTML tag.","html.mirrorCursorOnMatchingTagDeprecationMessage":"Deprecated in favor of `editor.linkedEditing`","html.hover.documentation":"Show tag and attribute documentation in hover.","html.hover.references":"Show references to MDN in hover."},readmePath:"html-language-features/README.md"},{extensionPath:"ini",packageJSON:{name:"ini",displayName:"%displayName%",description:"%description%",version:"10.0.0",private:!0,publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin textmate/ini.tmbundle Syntaxes/Ini.plist ./syntaxes/ini.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"ini",extensions:[".ini"],aliases:["Ini","ini"],configuration:"./ini.language-configuration.json"},{id:"properties",extensions:[".conf",".properties",".cfg",".directory",".gitattributes",".gitconfig",".gitmodules",".editorconfig",".repo"],filenames:["gitconfig"],filenamePatterns:["**/.config/git/config","**/.git/config"],aliases:["Properties","properties"],configuration:"./properties.language-configuration.json"}],grammars:[{language:"ini",scopeName:"source.ini",path:"./syntaxes/ini.tmLanguage.json"},{language:"properties",scopeName:"source.ini",path:"./syntaxes/ini.tmLanguage.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Ini Language Basics",description:"Provides syntax highlighting and bracket matching in Ini files."}},{extensionPath:"ipynb",packageJSON:{name:"ipynb",displayName:"%displayName%",description:"%description%",publisher:"vscode",version:"10.0.0",license:"MIT",icon:"media/icon.png",engines:{vscode:"^1.57.0"},enabledApiProposals:["diffContentOptions"],activationEvents:["onNotebook:jupyter-notebook","onNotebookSerializer:interactive","onNotebookSerializer:repl"],extensionKind:["workspace","ui"],main:"./dist/ipynbMain.node.js",browser:"./dist/browser/ipynbMain.browser.js",capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:!0}},contributes:{configuration:[{properties:{"ipynb.pasteImagesAsAttachments.enabled":{type:"boolean",scope:"resource",markdownDescription:"%ipynb.pasteImagesAsAttachments.enabled%",default:!0},"ipynb.experimental.serialization":{type:"boolean",scope:"resource",markdownDescription:"%ipynb.experimental.serialization%",default:!0,tags:["experimental"]}}}],commands:[{command:"ipynb.newUntitledIpynb",title:"%newUntitledIpynb.title%",shortTitle:"%newUntitledIpynb.shortTitle%",category:"Create"},{command:"ipynb.openIpynbInNotebookEditor",title:"%openIpynbInNotebookEditor.title%"},{command:"ipynb.cleanInvalidImageAttachment",title:"%cleanInvalidImageAttachment.title%"},{command:"notebook.cellOutput.copy",title:"%copyCellOutput.title%",category:"Notebook"},{command:"notebook.cellOutput.addToChat",title:"%addCellOutputToChat.title%",category:"Notebook",enablement:"chatIsEnabled"},{command:"notebook.cellOutput.openInTextEditor",title:"%openCellOutput.title%",category:"Notebook"}],notebooks:[{type:"jupyter-notebook",displayName:"Jupyter Notebook",selector:[{filenamePattern:"*.ipynb"}],priority:"default"}],notebookRenderer:[{id:"vscode.markdown-it-cell-attachment-renderer",displayName:"%markdownAttachmentRenderer.displayName%",entrypoint:{extends:"vscode.markdown-it-renderer",path:"./notebook-out/cellAttachmentRenderer.js"}}],menus:{"file/newFile":[{command:"ipynb.newUntitledIpynb",group:"notebook"}],commandPalette:[{command:"ipynb.newUntitledIpynb"},{command:"ipynb.openIpynbInNotebookEditor",when:"false"},{command:"ipynb.cleanInvalidImageAttachment",when:"false"},{command:"notebook.cellOutput.copy",when:"notebookCellHasOutputs"},{command:"notebook.cellOutput.openInTextEditor",when:"false"}],"webview/context":[{command:"notebook.cellOutput.copy",when:"webviewId == 'notebook.output' && webviewSection == 'image'",group:"context@1"},{command:"notebook.cellOutput.copy",when:"webviewId == 'notebook.output' && webviewSection == 'text'"},{command:"notebook.cellOutput.addToChat",when:"webviewId == 'notebook.output' && (webviewSection == 'text' || webviewSection == 'image')",group:"context@2"},{command:"notebook.cellOutput.openInTextEditor",when:"webviewId == 'notebook.output' && webviewSection == 'text'"}]}},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:".ipynb Support",description:"Provides basic support for opening and reading Jupyter's .ipynb notebook files","ipynb.pasteImagesAsAttachments.enabled":"Enable/disable pasting of images into Markdown cells in ipynb notebook files. Pasted images are inserted as attachments to the cell.","ipynb.experimental.serialization":"Experimental feature to serialize the Jupyter notebook in a worker thread.","newUntitledIpynb.title":"New Jupyter Notebook","newUntitledIpynb.shortTitle":"Jupyter Notebook","openIpynbInNotebookEditor.title":"Open IPYNB File In Notebook Editor","cleanInvalidImageAttachment.title":"Clean Invalid Image Attachment Reference","copyCellOutput.title":"Copy Cell Output","addCellOutputToChat.title":"Add Cell Output to Chat","openCellOutput.title":"Open Cell Output in Text Editor","markdownAttachmentRenderer.displayName":{message:"Markdown-It ipynb Cell Attachment renderer",comment:["Markdown-It is a product name and should not be translated"]}},readmePath:"ipynb/README.md"},{extensionPath:"java",packageJSON:{name:"java",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin redhat-developer/vscode-java language-support/java/java.tmLanguage.json ./syntaxes/java.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"java",extensions:[".java",".jav"],aliases:["Java","java"],configuration:"./language-configuration.json"}],grammars:[{language:"java",scopeName:"source.java",path:"./syntaxes/java.tmLanguage.json"}],snippets:[{language:"java",path:"./snippets/java.code-snippets"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Java Language Basics",description:"Provides snippets, syntax highlighting, bracket matching and folding in Java files."}},{extensionPath:"javascript",packageJSON:{name:"javascript",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"0.10.x"},categories:["Programming Languages"],contributes:{configurationDefaults:{"[javascript]":{"editor.maxTokenizationLineLength":2500}},languages:[{id:"javascriptreact",aliases:["JavaScript JSX","JavaScript React","jsx"],extensions:[".jsx"],configuration:"./javascript-language-configuration.json"},{id:"javascript",aliases:["JavaScript","javascript","js"],extensions:[".js",".es6",".mjs",".cjs",".pac"],filenames:["jakefile"],firstLine:"^#!.*\\bnode",mimetypes:["text/javascript"],configuration:"./javascript-language-configuration.json"},{id:"jsx-tags",aliases:[],configuration:"./tags-language-configuration.json"}],grammars:[{language:"javascriptreact",scopeName:"source.js.jsx",path:"./syntaxes/JavaScriptReact.tmLanguage.json",embeddedLanguages:{"meta.tag.js":"jsx-tags","meta.tag.without-attributes.js":"jsx-tags","meta.tag.attributes.js.jsx":"javascriptreact","meta.embedded.expression.js":"javascriptreact"},tokenTypes:{"punctuation.definition.template-expression":"other","entity.name.type.instance.jsdoc":"other","entity.name.function.tagged-template":"other","meta.import string.quoted":"other","variable.other.jsdoc":"other"}},{language:"javascript",scopeName:"source.js",path:"./syntaxes/JavaScript.tmLanguage.json",embeddedLanguages:{"meta.tag.js":"jsx-tags","meta.tag.without-attributes.js":"jsx-tags","meta.tag.attributes.js":"javascript","meta.embedded.expression.js":"javascript"},tokenTypes:{"punctuation.definition.template-expression":"other","entity.name.type.instance.jsdoc":"other","entity.name.function.tagged-template":"other","meta.import string.quoted":"other","variable.other.jsdoc":"other"}},{scopeName:"source.js.regexp",path:"./syntaxes/Regular Expressions (JavaScript).tmLanguage"}],semanticTokenScopes:[{language:"javascript",scopes:{property:["variable.other.property.js"],"property.readonly":["variable.other.constant.property.js"],variable:["variable.other.readwrite.js"],"variable.readonly":["variable.other.constant.object.js"],function:["entity.name.function.js"],namespace:["entity.name.type.module.js"],"variable.defaultLibrary":["support.variable.js"],"function.defaultLibrary":["support.function.js"]}},{language:"javascriptreact",scopes:{property:["variable.other.property.jsx"],"property.readonly":["variable.other.constant.property.jsx"],variable:["variable.other.readwrite.jsx"],"variable.readonly":["variable.other.constant.object.jsx"],function:["entity.name.function.jsx"],namespace:["entity.name.type.module.jsx"],"variable.defaultLibrary":["support.variable.js"],"function.defaultLibrary":["support.function.js"]}}],snippets:[{language:"javascript",path:"./snippets/javascript.code-snippets"},{language:"javascriptreact",path:"./snippets/javascript.code-snippets"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"JavaScript Language Basics",description:"Provides snippets, syntax highlighting, bracket matching and folding in JavaScript files."}},{extensionPath:"json",packageJSON:{name:"json",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"0.10.x"},scripts:{"update-grammar":"node ./build/update-grammars.js"},categories:["Programming Languages"],contributes:{languages:[{id:"json",aliases:["JSON","json"],extensions:[".json",".bowerrc",".jscsrc",".webmanifest",".js.map",".css.map",".ts.map",".har",".jslintrc",".jsonld",".geojson",".ipynb",".vuerc"],filenames:["composer.lock",".watchmanconfig"],mimetypes:["application/json","application/manifest+json"],configuration:"./language-configuration.json"},{id:"jsonc",aliases:["JSON with Comments"],extensions:[".jsonc",".eslintrc",".eslintrc.json",".jsfmtrc",".jshintrc",".swcrc",".hintrc",".babelrc",".toolset.jsonc"],filenames:["babel.config.json","bun.lock",".babelrc.json",".ember-cli","typedoc.json"],filenamePatterns:["**/.github/hooks/*.json"],configuration:"./language-configuration.json"},{id:"jsonl",aliases:["JSON Lines"],extensions:[".jsonl",".ndjson"],filenames:[],configuration:"./language-configuration.json"},{id:"snippets",aliases:["Code Snippets"],extensions:[".code-snippets"],filenamePatterns:["**/User/snippets/*.json","**/User/profiles/*/snippets/*.json","**/snippets*.json"],configuration:"./language-configuration.json"}],grammars:[{language:"json",scopeName:"source.json",path:"./syntaxes/JSON.tmLanguage.json"},{language:"jsonc",scopeName:"source.json.comments",path:"./syntaxes/JSONC.tmLanguage.json"},{language:"jsonl",scopeName:"source.json.lines",path:"./syntaxes/JSONL.tmLanguage.json"},{language:"snippets",scopeName:"source.json.comments.snippets",path:"./syntaxes/snippets.tmLanguage.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"JSON Language Basics",description:"Provides syntax highlighting & bracket matching in JSON files."}},{extensionPath:"json-language-features",packageJSON:{name:"json-language-features",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",aiKey:"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",engines:{vscode:"^1.77.0"},enabledApiProposals:["extensionsAny"],icon:"icons/json.png",activationEvents:["onLanguage:json","onLanguage:jsonc","onLanguage:snippets","onCommand:json.validate"],main:"./client/dist/node/jsonClientMain",browser:"./client/dist/browser/jsonClientMain",capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:"limited",description:"%json.workspaceTrust%"}},categories:["Programming Languages"],contributes:{configuration:{id:"json",order:20,type:"object",title:"JSON",properties:{"json.schemas":{type:"array",scope:"resource",description:"%json.schemas.desc%",items:{type:"object",default:{fileMatch:["/myfile"],url:"schemaURL"},properties:{url:{type:"string",default:"/user.schema.json",markdownDescription:"%json.schemas.url.desc%"},fileMatch:{type:"array",items:{type:"string",default:"MyFile.json",markdownDescription:"%json.schemas.fileMatch.item.desc%"},minItems:1,markdownDescription:"%json.schemas.fileMatch.desc%"},schema:{$ref:"http://json-schema.org/draft-07/schema#",description:"%json.schemas.schema.desc%"}}}},"json.validate.enable":{type:"boolean",scope:"window",default:!0,description:"%json.validate.enable.desc%"},"json.format.enable":{type:"boolean",scope:"window",default:!0,description:"%json.format.enable.desc%"},"json.format.keepLines":{type:"boolean",scope:"window",default:!1,description:"%json.format.keepLines.desc%"},"json.trace.server":{type:"string",scope:"window",enum:["off","messages","verbose"],default:"off",description:"%json.tracing.desc%"},"json.colorDecorators.enable":{type:"boolean",scope:"window",default:!0,description:"%json.colorDecorators.enable.desc%",deprecationMessage:"%json.colorDecorators.enable.deprecationMessage%"},"json.maxItemsComputed":{type:"number",default:5e3,description:"%json.maxItemsComputed.desc%"},"json.schemaDownload.enable":{type:"boolean",default:!0,description:"%json.enableSchemaDownload.desc%",tags:["usesOnlineServices"]},"json.schemaDownload.trustedDomains":{type:"object",default:{"https://schemastore.azurewebsites.net/":!0,"https://raw.githubusercontent.com/microsoft/vscode/":!0,"https://raw.githubusercontent.com/devcontainers/spec/":!0,"https://www.schemastore.org/":!0,"https://json.schemastore.org/":!0,"https://json-schema.org/":!0,"https://developer.microsoft.com/json-schemas/":!0},additionalProperties:{type:"boolean"},markdownDescription:"%json.schemaDownload.trustedDomains.desc%",tags:["usesOnlineServices"]}}},configurationDefaults:{"[json]":{"editor.quickSuggestions":{strings:!0},"editor.suggest.insertMode":"replace"},"[jsonc]":{"editor.quickSuggestions":{strings:!0},"editor.suggest.insertMode":"replace"},"[snippets]":{"editor.quickSuggestions":{strings:!0},"editor.suggest.insertMode":"replace"}},jsonValidation:[{fileMatch:"*.schema.json",url:"http://json-schema.org/draft-07/schema#"}],commands:[{command:"json.clearCache",title:"%json.command.clearCache%",category:"JSON"},{command:"json.sort",title:"%json.command.sort%",category:"JSON"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"JSON Language Features",description:"Provides rich language support for JSON files.","json.schemas.desc":"Associate schemas to JSON files in the current project.","json.schemas.url.desc":"A URL or absolute file path to a schema. Can be a relative path (starting with `./`) in workspace and workspace folder settings.","json.schemas.fileMatch.desc":"An array of file patterns to match against when resolving JSON files to schemas. `*` and `**` can be used as a wildcard. Exclusion patterns can also be defined and start with `!`. A file matches when there is at least one matching pattern and the last matching pattern is not an exclusion pattern.","json.schemas.fileMatch.item.desc":"A file pattern that can contain `*` and `**` to match against when resolving JSON files to schemas. When beginning with `!`, it defines an exclusion pattern.","json.schemas.schema.desc":"The schema definition for the given URL. The schema only needs to be provided to avoid accesses to the schema URL.","json.format.enable.desc":"Enable/disable default JSON formatter","json.format.keepLines.desc":"Keep all existing new lines when formatting.","json.validate.enable.desc":"Enable/disable JSON validation.","json.tracing.desc":"Traces the communication between VS Code and the JSON language server.","json.colorDecorators.enable.desc":"Enables or disables color decorators","json.colorDecorators.enable.deprecationMessage":"The setting `json.colorDecorators.enable` has been deprecated in favor of `editor.colorDecorators`.","json.schemaResolutionErrorMessage":"Unable to resolve schema.","json.clickToRetry":"Click to retry.","json.maxItemsComputed.desc":"The maximum number of outline symbols and folding regions computed (limited for performance reasons).","json.maxItemsExceededInformation.desc":"Show notification when exceeding the maximum number of outline symbols and folding regions.","json.enableSchemaDownload.desc":"When enabled, JSON schemas can be fetched from http and https locations.","json.command.clearCache":"Clear Schema Cache","json.command.sort":"Sort Document","json.workspaceTrust":"The extension requires workspace trust to load schemas from http and https.","json.schemaDownload.trustedDomains.desc":"List of trusted domains for downloading JSON schemas over http(s). Use `*` to trust all domains. `*` can also be used as a wildcard in domain names."},readmePath:"json-language-features/README.md"},{extensionPath:"julia",packageJSON:{name:"julia",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"0.10.x"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin JuliaEditorSupport/atom-language-julia variants/julia_vscode.json ./syntaxes/julia.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"julia",aliases:["Julia","julia"],extensions:[".jl"],firstLine:"^#!\\s*/.*\\bjulia[0-9.-]*\\b",configuration:"./language-configuration.json"},{id:"juliamarkdown",aliases:["Julia Markdown","juliamarkdown"],extensions:[".jmd"]}],grammars:[{language:"julia",scopeName:"source.julia",path:"./syntaxes/julia.tmLanguage.json",embeddedLanguages:{"meta.embedded.inline.cpp":"cpp","meta.embedded.inline.javascript":"javascript","meta.embedded.inline.python":"python","meta.embedded.inline.r":"r","meta.embedded.inline.sql":"sql"}}],configurationDefaults:{"[julia]":{"editor.defaultColorDecorators":"never"}}}},packageNLS:{displayName:"Julia Language Basics",description:"Provides syntax highlighting & bracket matching in Julia files."}},{extensionPath:"latex",packageJSON:{name:"latex",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ./build/update-grammars.js"},categories:["Programming Languages"],contributes:{languages:[{id:"tex",aliases:["TeX","tex"],extensions:[".sty",".cls",".bbx",".cbx"],configuration:"latex-language-configuration.json"},{id:"latex",aliases:["LaTeX","latex"],extensions:[".tex",".ltx",".ctx"],configuration:"latex-language-configuration.json"},{id:"bibtex",aliases:["BibTeX","bibtex"],extensions:[".bib"]},{id:"cpp_embedded_latex",configuration:"latex-cpp-embedded-language-configuration.json",aliases:[]},{id:"markdown_latex_combined",configuration:"markdown-latex-combined-language-configuration.json",aliases:[]}],grammars:[{language:"tex",scopeName:"text.tex",path:"./syntaxes/TeX.tmLanguage.json",unbalancedBracketScopes:["keyword.control.ifnextchar.tex","punctuation.math.operator.tex"]},{language:"latex",scopeName:"text.tex.latex",path:"./syntaxes/LaTeX.tmLanguage.json",unbalancedBracketScopes:["keyword.control.ifnextchar.tex","punctuation.math.operator.tex"],embeddedLanguages:{"source.cpp":"cpp_embedded_latex","source.css":"css","text.html":"html","source.java":"java","source.js":"javascript","source.julia":"julia","source.lua":"lua","source.python":"python","source.ruby":"ruby","source.ts":"typescript","text.xml":"xml","source.yaml":"yaml","meta.embedded.markdown_latex_combined":"markdown_latex_combined"}},{language:"bibtex",scopeName:"text.bibtex",path:"./syntaxes/Bibtex.tmLanguage.json"},{language:"markdown_latex_combined",scopeName:"text.tex.markdown_latex_combined",path:"./syntaxes/markdown-latex-combined.tmLanguage.json"},{language:"cpp_embedded_latex",scopeName:"source.cpp.embedded.latex",path:"./syntaxes/cpp-grammar-bailout.tmLanguage.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"LaTeX Language Basics",description:"Provides syntax highlighting and bracket matching for TeX, LaTeX and BibTeX."}},{extensionPath:"less",packageJSON:{name:"less",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ./build/update-grammar.js"},categories:["Programming Languages"],contributes:{languages:[{id:"less",aliases:["Less","less"],extensions:[".less"],mimetypes:["text/x-less","text/less"],configuration:"./language-configuration.json"}],grammars:[{language:"less",scopeName:"source.css.less",path:"./syntaxes/less.tmLanguage.json"}],problemMatchers:[{name:"lessc",label:"Lessc compiler",owner:"lessc",source:"less",fileLocation:"absolute",pattern:{regexp:"(.*)\\sin\\s(.*)\\son line\\s(\\d+),\\scolumn\\s(\\d+)",message:1,file:2,line:3,column:4}}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Less Language Basics",description:"Provides syntax highlighting, bracket matching and folding in Less files."}},{extensionPath:"log",packageJSON:{name:"log",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin emilast/vscode-logfile-highlighter syntaxes/log.tmLanguage ./syntaxes/log.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"log",extensions:[".log","*.log.?"],aliases:["Log"]}],grammars:[{language:"log",scopeName:"text.log",path:"./syntaxes/log.tmLanguage.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Log",description:"Provides syntax highlighting for files with .log extension."}},{extensionPath:"lua",packageJSON:{name:"lua",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin sumneko/lua.tmbundle Syntaxes/Lua.plist ./syntaxes/lua.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"lua",extensions:[".lua"],aliases:["Lua","lua"],configuration:"./language-configuration.json"}],grammars:[{language:"lua",scopeName:"source.lua",path:"./syntaxes/lua.tmLanguage.json",tokenTypes:{"comment.line.double-dash.doc.lua":"other"}}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Lua Language Basics",description:"Provides syntax highlighting and bracket matching in Lua files."}},{extensionPath:"make",packageJSON:{name:"make",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin fadeevab/make.tmbundle Syntaxes/Makefile.plist ./syntaxes/make.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"makefile",aliases:["Makefile","makefile"],extensions:[".mak",".mk"],filenames:["Makefile","makefile","GNUmakefile","OCamlMakefile"],firstLine:"^#!\\s*/usr/bin/make",configuration:"./language-configuration.json"}],grammars:[{language:"makefile",scopeName:"source.makefile",path:"./syntaxes/make.tmLanguage.json",tokenTypes:{"string.interpolated":"other"}}],configurationDefaults:{"[makefile]":{"editor.insertSpaces":!1}}},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Make Language Basics",description:"Provides syntax highlighting and bracket matching in Make files."}},{extensionPath:"markdown-basics",packageJSON:{name:"markdown",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"^1.20.0"},categories:["Programming Languages"],contributes:{languages:[{id:"markdown",aliases:["Markdown","markdown"],extensions:[".md",".mkd",".mkdn",".mdwn",".mdown",".markdown",".markdn",".mdtxt",".mdtext",".litcoffee",".ron",".ronn",".workbook"],filenamePatterns:["**/.cursor/**/*.mdc"],configuration:"./language-configuration.json"}],grammars:[{language:"markdown",scopeName:"text.html.markdown",path:"./syntaxes/markdown.tmLanguage.json",embeddedLanguages:{"meta.embedded.block.html":"html","source.js":"javascript","source.css":"css","meta.embedded.block.frontmatter":"yaml","meta.embedded.block.css":"css","meta.embedded.block.ini":"ini","meta.embedded.block.java":"java","meta.embedded.block.lua":"lua","meta.embedded.block.makefile":"makefile","meta.embedded.block.perl":"perl","meta.embedded.block.r":"r","meta.embedded.block.ruby":"ruby","meta.embedded.block.php":"php","meta.embedded.block.sql":"sql","meta.embedded.block.vs_net":"vs_net","meta.embedded.block.xml":"xml","meta.embedded.block.xsl":"xsl","meta.embedded.block.yaml":"yaml","meta.embedded.block.dosbatch":"dosbatch","meta.embedded.block.clojure":"clojure","meta.embedded.block.coffee":"coffee","meta.embedded.block.c":"c","meta.embedded.block.cpp":"cpp","meta.embedded.block.diff":"diff","meta.embedded.block.dockerfile":"dockerfile","meta.embedded.block.go":"go","meta.embedded.block.groovy":"groovy","meta.embedded.block.pug":"jade","meta.embedded.block.ignore":"ignore","meta.embedded.block.javascript":"javascript","meta.embedded.block.json":"json","meta.embedded.block.jsonc":"jsonc","meta.embedded.block.jsonl":"jsonl","meta.embedded.block.latex":"latex","meta.embedded.block.less":"less","meta.embedded.block.objc":"objc","meta.embedded.block.scss":"scss","meta.embedded.block.perl6":"perl6","meta.embedded.block.powershell":"powershell","meta.embedded.block.python":"python","meta.embedded.block.restructuredtext":"restructuredtext","meta.embedded.block.rust":"rust","meta.embedded.block.scala":"scala","meta.embedded.block.shellscript":"shellscript","meta.embedded.block.typescript":"typescript","meta.embedded.block.typescriptreact":"typescriptreact","meta.embedded.block.csharp":"csharp","meta.embedded.block.fsharp":"fsharp"},unbalancedBracketScopes:["markup.underline.link.markdown","punctuation.definition.list.begin.markdown"]}],snippets:[{language:"markdown",path:"./snippets/markdown.code-snippets"}],configurationDefaults:{"[markdown]":{"editor.unicodeHighlight.ambiguousCharacters":!1,"editor.unicodeHighlight.invisibleCharacters":!1,"diffEditor.ignoreTrimWhitespace":!1}}},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin microsoft/vscode-markdown-tm-grammar syntaxes/markdown.tmLanguage ./syntaxes/markdown.tmLanguage.json"},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Markdown Language Basics",description:"Provides snippets and syntax highlighting for Markdown."}},{extensionPath:"markdown-language-features",packageJSON:{name:"markdown-language-features",displayName:"%displayName%",description:"%description%",version:"10.0.0",icon:"icon.png",publisher:"vscode",license:"MIT",aiKey:"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",engines:{vscode:"^1.70.0"},main:"./dist/extension",browser:"./dist/browser/extension",categories:["Programming Languages"],activationEvents:["onLanguage:markdown","onLanguage:prompt","onLanguage:instructions","onLanguage:chatagent","onLanguage:skill","onCommand:markdown.api.render","onCommand:markdown.api.reloadPlugins","onWebviewPanel:markdown.preview"],capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:"limited",description:"%workspaceTrust%",restrictedConfigurations:["markdown.styles"]}},contributes:{notebookRenderer:[{id:"vscode.markdown-it-renderer",displayName:"Markdown it renderer",entrypoint:"./notebook-out/index.js",mimeTypes:["text/markdown","text/latex","text/x-css","text/x-html","text/x-json","text/x-typescript","text/x-abap","text/x-apex","text/x-azcli","text/x-bat","text/x-cameligo","text/x-clojure","text/x-coffee","text/x-cpp","text/x-csharp","text/x-csp","text/x-css","text/x-dart","text/x-dockerfile","text/x-ecl","text/x-fsharp","text/x-go","text/x-graphql","text/x-handlebars","text/x-hcl","text/x-html","text/x-ini","text/x-java","text/x-javascript","text/x-julia","text/x-kotlin","text/x-less","text/x-lexon","text/x-lua","text/x-m3","text/x-markdown","text/x-mips","text/x-msdax","text/x-mysql","text/x-objective-c/objective","text/x-pascal","text/x-pascaligo","text/x-perl","text/x-pgsql","text/x-php","text/x-postiats","text/x-powerquery","text/x-powershell","text/x-pug","text/x-python","text/x-r","text/x-razor","text/x-redis","text/x-redshift","text/x-restructuredtext","text/x-ruby","text/x-rust","text/x-sb","text/x-scala","text/x-scheme","text/x-scss","text/x-shell","text/x-solidity","text/x-sophia","text/x-sql","text/x-st","text/x-swift","text/x-systemverilog","text/x-tcl","text/x-twig","text/x-typescript","text/x-vb","text/x-xml","text/x-yaml","application/json"]}],commands:[{command:"_markdown.copyImage",title:"%markdown.copyImage.title%",category:"Markdown"},{command:"_markdown.openImage",title:"%markdown.openImage.title%",category:"Markdown"},{command:"markdown.showPreview",title:"%markdown.preview.title%",category:"Markdown",icon:{light:"./media/preview-light.svg",dark:"./media/preview-dark.svg"}},{command:"markdown.showPreviewToSide",title:"%markdown.previewSide.title%",category:"Markdown",icon:"$(open-preview)"},{command:"markdown.showLockedPreviewToSide",title:"%markdown.showLockedPreviewToSide.title%",category:"Markdown",icon:"$(open-preview)"},{command:"markdown.showSource",title:"%markdown.showSource.title%",category:"Markdown",icon:"$(go-to-file)"},{command:"markdown.showPreviewSecuritySelector",title:"%markdown.showPreviewSecuritySelector.title%",category:"Markdown"},{command:"markdown.preview.refresh",title:"%markdown.preview.refresh.title%",category:"Markdown"},{command:"markdown.preview.toggleLock",title:"%markdown.preview.toggleLock.title%",category:"Markdown"},{command:"markdown.findAllFileReferences",title:"%markdown.findAllFileReferences%",category:"Markdown"},{command:"markdown.editor.insertLinkFromWorkspace",title:"%markdown.editor.insertLinkFromWorkspace%",category:"Markdown",enablement:"editorLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/ && !activeEditorIsReadonly"},{command:"markdown.editor.insertImageFromWorkspace",title:"%markdown.editor.insertImageFromWorkspace%",category:"Markdown",enablement:"editorLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/ && !activeEditorIsReadonly"}],menus:{"webview/context":[{command:"_markdown.copyImage",when:"webviewId == 'markdown.preview' && (webviewSection == 'image' || webviewSection == 'localImage')"},{command:"_markdown.openImage",when:"webviewId == 'markdown.preview' && webviewSection == 'localImage'"}],"editor/title":[{command:"markdown.showPreviewToSide",when:"editorLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/ && !notebookEditorFocused && !hasCustomMarkdownPreview",alt:"markdown.showPreview",group:"navigation"},{command:"markdown.showSource",when:"activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",group:"navigation"},{command:"markdown.preview.refresh",when:"activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",group:"1_markdown"},{command:"markdown.preview.toggleLock",when:"activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",group:"1_markdown"},{command:"markdown.showPreviewSecuritySelector",when:"activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",group:"1_markdown"}],"modalEditor/editorTitle":[{command:"markdown.showPreviewToSide",when:"editorLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/ && !notebookEditorFocused && !hasCustomMarkdownPreview",alt:"markdown.showPreview",group:"navigation"}],"explorer/context":[{command:"markdown.showPreview",when:"resourceLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/ && !hasCustomMarkdownPreview",group:"navigation"},{command:"markdown.findAllFileReferences",when:"resourceLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/",group:"4_search"}],"editor/title/context":[{command:"markdown.showPreview",when:"resourceLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/ && !hasCustomMarkdownPreview",group:"1_open"},{command:"markdown.findAllFileReferences",when:"resourceLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/"}],commandPalette:[{command:"_markdown.openImage",when:"false"},{command:"_markdown.copyImage",when:"false"},{command:"markdown.showPreview",when:"editorLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/ && !notebookEditorFocused",group:"navigation"},{command:"markdown.showPreviewToSide",when:"editorLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/ && !notebookEditorFocused",group:"navigation"},{command:"markdown.showLockedPreviewToSide",when:"editorLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/ && !notebookEditorFocused",group:"navigation"},{command:"markdown.showSource",when:"activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",group:"navigation"},{command:"markdown.showPreviewSecuritySelector",when:"editorLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/ && !notebookEditorFocused"},{command:"markdown.showPreviewSecuritySelector",when:"activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'"},{command:"markdown.preview.toggleLock",when:"activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'"},{command:"markdown.preview.refresh",when:"editorLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/ && !notebookEditorFocused"},{command:"markdown.preview.refresh",when:"activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'"},{command:"markdown.findAllFileReferences",when:"editorLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/"}]},keybindings:[{command:"markdown.showPreview",key:"shift+ctrl+v",mac:"shift+cmd+v",when:"editorLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/ && !notebookEditorFocused"},{command:"markdown.showPreviewToSide",key:"ctrl+k v",mac:"cmd+k v",when:"editorLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/ && !notebookEditorFocused"}],configuration:{type:"object",title:"Markdown",order:20,properties:{"markdown.styles":{type:"array",items:{type:"string"},default:[],description:"%markdown.styles.dec%",scope:"resource"},"markdown.preview.breaks":{type:"boolean",default:!1,markdownDescription:"%markdown.preview.breaks.desc%",scope:"resource"},"markdown.preview.linkify":{type:"boolean",default:!0,description:"%markdown.preview.linkify%",scope:"resource"},"markdown.preview.typographer":{type:"boolean",default:!1,description:"%markdown.preview.typographer%",scope:"resource"},"markdown.preview.fontFamily":{type:"string",default:"-apple-system, BlinkMacSystemFont, 'Segoe WPC', 'Segoe UI', system-ui, 'Ubuntu', 'Droid Sans', sans-serif",description:"%markdown.preview.fontFamily.desc%",scope:"resource"},"markdown.preview.fontSize":{type:"number",default:14,description:"%markdown.preview.fontSize.desc%",scope:"resource"},"markdown.preview.lineHeight":{type:"number",default:1.6,description:"%markdown.preview.lineHeight.desc%",scope:"resource"},"markdown.preview.scrollPreviewWithEditor":{type:"boolean",default:!0,description:"%markdown.preview.scrollPreviewWithEditor.desc%",scope:"resource"},"markdown.preview.markEditorSelection":{type:"boolean",default:!0,description:"%markdown.preview.markEditorSelection.desc%",scope:"resource"},"markdown.preview.scrollEditorWithPreview":{type:"boolean",default:!0,description:"%markdown.preview.scrollEditorWithPreview.desc%",scope:"resource"},"markdown.preview.doubleClickToSwitchToEditor":{type:"boolean",default:!0,description:"%markdown.preview.doubleClickToSwitchToEditor.desc%",scope:"resource"},"markdown.preview.openMarkdownLinks":{type:"string",default:"inPreview",description:"%configuration.markdown.preview.openMarkdownLinks.description%",scope:"resource",enum:["inPreview","inEditor"],enumDescriptions:["%configuration.markdown.preview.openMarkdownLinks.inPreview%","%configuration.markdown.preview.openMarkdownLinks.inEditor%"]},"markdown.links.openLocation":{type:"string",default:"currentGroup",description:"%configuration.markdown.links.openLocation.description%",scope:"resource",enum:["currentGroup","beside"],enumDescriptions:["%configuration.markdown.links.openLocation.currentGroup%","%configuration.markdown.links.openLocation.beside%"]},"markdown.suggest.paths.enabled":{type:"boolean",default:!0,description:"%configuration.markdown.suggest.paths.enabled.description%",scope:"resource"},"markdown.suggest.paths.includeWorkspaceHeaderCompletions":{type:"string",default:"onDoubleHash",scope:"resource",markdownDescription:"%configuration.markdown.suggest.paths.includeWorkspaceHeaderCompletions%",enum:["never","onDoubleHash","onSingleOrDoubleHash"],markdownEnumDescriptions:["%configuration.markdown.suggest.paths.includeWorkspaceHeaderCompletions.never%","%configuration.markdown.suggest.paths.includeWorkspaceHeaderCompletions.onDoubleHash%","%configuration.markdown.suggest.paths.includeWorkspaceHeaderCompletions.onSingleOrDoubleHash%"]},"markdown.trace.server":{type:"string",scope:"window",enum:["off","messages","verbose"],default:"off",description:"%markdown.trace.server.desc%"},"markdown.server.log":{type:"string",scope:"window",enum:["off","debug","trace"],default:"off",description:"%markdown.server.log.desc%"},"markdown.editor.drop.enabled":{type:"string",scope:"resource",markdownDescription:"%configuration.markdown.editor.drop.enabled%",default:"smart",enum:["always","smart","never"],markdownEnumDescriptions:["%configuration.markdown.editor.drop.enabled.always%","%configuration.markdown.editor.drop.enabled.smart%","%configuration.markdown.editor.drop.enabled.never%"]},"markdown.editor.drop.copyIntoWorkspace":{type:"string",markdownDescription:"%configuration.markdown.editor.drop.copyIntoWorkspace%",default:"mediaFiles",enum:["mediaFiles","never"],markdownEnumDescriptions:["%configuration.copyIntoWorkspace.mediaFiles%","%configuration.copyIntoWorkspace.never%"]},"markdown.editor.filePaste.enabled":{type:"string",scope:"resource",markdownDescription:"%configuration.markdown.editor.filePaste.enabled%",default:"smart",enum:["always","smart","never"],markdownEnumDescriptions:["%configuration.markdown.editor.filePaste.enabled.always%","%configuration.markdown.editor.filePaste.enabled.smart%","%configuration.markdown.editor.filePaste.enabled.never%"]},"markdown.editor.filePaste.copyIntoWorkspace":{type:"string",markdownDescription:"%configuration.markdown.editor.filePaste.copyIntoWorkspace%",default:"mediaFiles",enum:["mediaFiles","never"],markdownEnumDescriptions:["%configuration.copyIntoWorkspace.mediaFiles%","%configuration.copyIntoWorkspace.never%"]},"markdown.editor.filePaste.videoSnippet":{type:"string",markdownDescription:"%configuration.markdown.editor.filePaste.videoSnippet%",default:'<video controls src="${src}" title="${title}"></video>'},"markdown.editor.filePaste.audioSnippet":{type:"string",markdownDescription:"%configuration.markdown.editor.filePaste.audioSnippet%",default:'<audio controls src="${src}" title="${title}"></audio>'},"markdown.editor.pasteUrlAsFormattedLink.enabled":{type:"string",scope:"resource",markdownDescription:"%configuration.markdown.editor.pasteUrlAsFormattedLink.enabled%",default:"smartWithSelection",enum:["always","smart","smartWithSelection","never"],markdownEnumDescriptions:["%configuration.pasteUrlAsFormattedLink.always%","%configuration.pasteUrlAsFormattedLink.smart%","%configuration.pasteUrlAsFormattedLink.smartWithSelection%","%configuration.pasteUrlAsFormattedLink.never%"]},"markdown.validate.enabled":{type:"boolean",scope:"resource",description:"%configuration.markdown.validate.enabled.description%",default:!1},"markdown.validate.referenceLinks.enabled":{type:"string",scope:"resource",markdownDescription:"%configuration.markdown.validate.referenceLinks.enabled.description%",default:"warning",enum:["ignore","warning","error"]},"markdown.validate.fragmentLinks.enabled":{type:"string",scope:"resource",markdownDescription:"%configuration.markdown.validate.fragmentLinks.enabled.description%",default:"warning",enum:["ignore","warning","error"]},"markdown.validate.fileLinks.enabled":{type:"string",scope:"resource",markdownDescription:"%configuration.markdown.validate.fileLinks.enabled.description%",default:"warning",enum:["ignore","warning","error"]},"markdown.validate.fileLinks.markdownFragmentLinks":{type:"string",scope:"resource",markdownDescription:"%configuration.markdown.validate.fileLinks.markdownFragmentLinks.description%",default:"inherit",enum:["inherit","ignore","warning","error"]},"markdown.validate.ignoredLinks":{type:"array",scope:"resource",markdownDescription:"%configuration.markdown.validate.ignoredLinks.description%",items:{type:"string"}},"markdown.validate.unusedLinkDefinitions.enabled":{type:"string",scope:"resource",markdownDescription:"%configuration.markdown.validate.unusedLinkDefinitions.description%",default:"hint",enum:["ignore","hint","warning","error"]},"markdown.validate.duplicateLinkDefinitions.enabled":{type:"string",scope:"resource",markdownDescription:"%configuration.markdown.validate.duplicateLinkDefinitions.description%",default:"warning",enum:["ignore","warning","error"]},"markdown.updateLinksOnFileMove.enabled":{type:"string",enum:["prompt","always","never"],markdownEnumDescriptions:["%configuration.markdown.updateLinksOnFileMove.enabled.prompt%","%configuration.markdown.updateLinksOnFileMove.enabled.always%","%configuration.markdown.updateLinksOnFileMove.enabled.never%"],default:"never",markdownDescription:"%configuration.markdown.updateLinksOnFileMove.enabled%",scope:"window"},"markdown.updateLinksOnFileMove.include":{type:"array",markdownDescription:"%configuration.markdown.updateLinksOnFileMove.include%",scope:"window",items:{type:"string",description:"%configuration.markdown.updateLinksOnFileMove.include.property%"},default:["**/*.{md,mkd,mdwn,mdown,markdown,markdn,mdtxt,mdtext,workbook}","**/*.{jpg,jpe,jpeg,png,bmp,gif,ico,webp,avif,tiff,svg,mp4}"]},"markdown.updateLinksOnFileMove.enableForDirectories":{type:"boolean",default:!0,description:"%configuration.markdown.updateLinksOnFileMove.enableForDirectories%",scope:"window"},"markdown.occurrencesHighlight.enabled":{type:"boolean",default:!1,description:"%configuration.markdown.occurrencesHighlight.enabled%",scope:"resource"},"markdown.copyFiles.destination":{type:"object",markdownDescription:"%configuration.markdown.copyFiles.destination%",additionalProperties:{type:"string"}},"markdown.copyFiles.overwriteBehavior":{type:"string",markdownDescription:"%configuration.markdown.copyFiles.overwriteBehavior%",default:"nameIncrementally",enum:["nameIncrementally","overwrite"],markdownEnumDescriptions:["%configuration.markdown.copyFiles.overwriteBehavior.nameIncrementally%","%configuration.markdown.copyFiles.overwriteBehavior.overwrite%"]},"markdown.preferredMdPathExtensionStyle":{type:"string",default:"auto",markdownDescription:"%configuration.markdown.preferredMdPathExtensionStyle%",enum:["auto","includeExtension","removeExtension"],markdownEnumDescriptions:["%configuration.markdown.preferredMdPathExtensionStyle.auto%","%configuration.markdown.preferredMdPathExtensionStyle.includeExtension%","%configuration.markdown.preferredMdPathExtensionStyle.removeExtension%"]},"markdown.editor.updateLinksOnPaste.enabled":{type:"boolean",markdownDescription:"%configuration.markdown.editor.updateLinksOnPaste.enabled%",scope:"resource",default:!0}}},configurationDefaults:{"[markdown]":{"editor.wordWrap":"on","editor.quickSuggestions":{comments:"off",strings:"off",other:"off"}}},jsonValidation:[{fileMatch:"package.json",url:"./schemas/package.schema.json"}],"markdown.previewStyles":["./media/markdown.css","./media/highlight.css"],"markdown.previewScripts":["./media/index.js"],customEditors:[{viewType:"vscode.markdown.preview.editor",displayName:"Markdown Preview",priority:"option",selector:[{filenamePattern:"*.md"}]}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Markdown Language Features",description:"Provides rich language support for Markdown.","markdown.copyImage.title":"Copy Image","markdown.openImage.title":"Open Image","markdown.preview.breaks.desc":"Sets how line-breaks are rendered in the Markdown preview. Setting it to `true` creates a `<br>` for newlines inside paragraphs.","markdown.preview.linkify":"Convert URL-like text to links in the Markdown preview.","markdown.preview.typographer":"Enable some language-neutral replacement and quotes beautification in the Markdown preview.","markdown.preview.doubleClickToSwitchToEditor.desc":"Double-click in the Markdown preview to switch to the editor.","markdown.preview.fontFamily.desc":"Controls the font family used in the Markdown preview.","markdown.preview.fontSize.desc":"Controls the font size in pixels used in the Markdown preview.","markdown.preview.lineHeight.desc":"Controls the line height used in the Markdown preview. This number is relative to the font size.","markdown.preview.markEditorSelection.desc":"Mark the current editor selection in the Markdown preview.","markdown.preview.scrollEditorWithPreview.desc":"When a Markdown preview is scrolled, update the view of the editor.","markdown.preview.scrollPreviewWithEditor.desc":"When a Markdown editor is scrolled, update the view of the preview.","markdown.preview.title":"Open Preview","markdown.previewSide.title":"Open Preview to the Side","markdown.showLockedPreviewToSide.title":"Open Locked Preview to the Side","markdown.showSource.title":"Show Source","markdown.styles.dec":"A list of URLs or local paths to CSS style sheets to use from the Markdown preview. Relative paths are interpreted relative to the folder open in the Explorer. If there is no open folder, they are interpreted relative to the location of the Markdown file. All '\\' need to be written as '\\\\'.","markdown.showPreviewSecuritySelector.title":"Change Preview Security Settings","markdown.trace.extension.desc":"Enable debug logging for the Markdown extension.","markdown.trace.server.desc":"Traces the communication between VS Code and the Markdown language server.","markdown.server.log.desc":"Controls the logging level of the Markdown language server.","markdown.preview.refresh.title":"Refresh Preview","markdown.preview.toggleLock.title":"Toggle Preview Locking","markdown.findAllFileReferences":"Find File References","markdown.editor.insertLinkFromWorkspace":"Insert Link to File in Workspace","markdown.editor.insertImageFromWorkspace":"Insert Image from Workspace","configuration.markdown.preview.openMarkdownLinks.description":"Controls how links to other Markdown files in the Markdown preview should be opened.","configuration.markdown.preview.openMarkdownLinks.inEditor":"Try to open links in the editor.","configuration.markdown.preview.openMarkdownLinks.inPreview":"Try to open links in the Markdown preview.","configuration.markdown.links.openLocation.description":"Controls where links in Markdown files should be opened.","configuration.markdown.links.openLocation.currentGroup":"Open links in the active editor group.","configuration.markdown.links.openLocation.beside":"Open links beside the active editor.","configuration.markdown.suggest.paths.enabled.description":"Enable path suggestions while writing links in Markdown files.","configuration.markdown.suggest.paths.includeWorkspaceHeaderCompletions":"Enable suggestions for headers in other Markdown files in the current workspace. Accepting one of these suggestions inserts the full path to header in that file, for example: `[link text](/path/to/file.md#header)`.","configuration.markdown.suggest.paths.includeWorkspaceHeaderCompletions.never":"Disable workspace header suggestions.","configuration.markdown.suggest.paths.includeWorkspaceHeaderCompletions.onDoubleHash":"Enable workspace header suggestions after typing `##` in a path, for example: `[link text](##`.","configuration.markdown.suggest.paths.includeWorkspaceHeaderCompletions.onSingleOrDoubleHash":"Enable workspace header suggestions after typing either `##` or `#` in a path, for example: `[link text](#` or `[link text](##`.","configuration.markdown.editor.drop.enabled":"Enable dropping files into a Markdown editor while holding Shift. Requires enabling `#editor.dropIntoEditor.enabled#`.","configuration.markdown.editor.drop.enabled.always":"Always insert Markdown links.","configuration.markdown.editor.drop.enabled.smart":"Smartly create Markdown links by default when not dropping into a code block or other special element. Use the drop widget to switch between pasting as plain text or as Markdown links.","configuration.markdown.editor.drop.enabled.never":"Never create Markdown links.","configuration.markdown.editor.drop.copyIntoWorkspace":"Controls if files outside of the workspace that are dropped into a Markdown editor should be copied into the workspace.\n\nUse `#markdown.copyFiles.destination#` to configure where copied dropped files should be created","configuration.markdown.editor.filePaste.enabled":"Enable pasting files into a Markdown editor to create Markdown links. Requires enabling `#editor.pasteAs.enabled#`.","configuration.markdown.editor.filePaste.enabled.always":"Always insert Markdown links.","configuration.markdown.editor.filePaste.enabled.smart":"Smartly create Markdown links by default when not pasting into a code block or other special element. Use the paste widget to switch between pasting as plain text or as Markdown links.","configuration.markdown.editor.filePaste.enabled.never":"Never create Markdown links.","configuration.markdown.editor.filePaste.copyIntoWorkspace":"Controls if files outside of the workspace that are pasted into a Markdown editor should be copied into the workspace.\n\nUse `#markdown.copyFiles.destination#` to configure where copied files should be created.","configuration.copyIntoWorkspace.mediaFiles":"Try to copy external image and video files into the workspace.","configuration.copyIntoWorkspace.never":"Do not copy external files into the workspace.","configuration.markdown.editor.pasteUrlAsFormattedLink.enabled":"Controls if Markdown links are created when URLs are pasted into a Markdown editor. Requires enabling `#editor.pasteAs.enabled#`.","configuration.pasteUrlAsFormattedLink.always":"Always insert Markdown links.","configuration.pasteUrlAsFormattedLink.smart":"Smartly create Markdown links by default when not pasting into a code block or other special element. Use the paste widget to switch between pasting as plain text or as Markdown links.","configuration.pasteUrlAsFormattedLink.smartWithSelection":"Smartly create Markdown links by default when you have selected text and are not pasting into a code block or other special element. Use the paste widget to switch between pasting as plain text or as Markdown links.","configuration.pasteUrlAsFormattedLink.never":"Never create Markdown links.","configuration.markdown.validate.enabled.description":"Enable all error reporting in Markdown files.","configuration.markdown.validate.referenceLinks.enabled.description":"Validate reference links in Markdown files, for example: `[link][ref]`. Requires enabling `#markdown.validate.enabled#`.","configuration.markdown.validate.fragmentLinks.enabled.description":"Validate fragment links to headers in the current Markdown file, for example: `[link](#header)`. Requires enabling `#markdown.validate.enabled#`.","configuration.markdown.validate.fileLinks.enabled.description":"Validate links to other files in Markdown files, for example `[link](/path/to/file.md)`. This checks that the target files exists. Requires enabling `#markdown.validate.enabled#`.","configuration.markdown.validate.fileLinks.markdownFragmentLinks.description":"Validate the fragment part of links to headers in other files in Markdown files, for example: `[link](/path/to/file.md#header)`. Inherits the setting value from `#markdown.validate.fragmentLinks.enabled#` by default.","configuration.markdown.validate.ignoredLinks.description":"Configure links that should not be validated. For example adding `/about` would not validate the link `[about](/about)`, while the glob `/assets/**/*.svg` would let you skip validation for any link to `.svg` files under the `assets` directory.","configuration.markdown.validate.unusedLinkDefinitions.description":"Validate link definitions that are unused in the current file.","configuration.markdown.validate.duplicateLinkDefinitions.description":"Validate duplicated definitions in the current file.","configuration.markdown.updateLinksOnFileMove.enabled":"Try to update links in Markdown files when a file is renamed/moved in the workspace. Use `#markdown.updateLinksOnFileMove.include#` to configure which files trigger link updates.","configuration.markdown.updateLinksOnFileMove.enabled.prompt":"Prompt on each file move.","configuration.markdown.updateLinksOnFileMove.enabled.always":"Always update links automatically.","configuration.markdown.updateLinksOnFileMove.enabled.never":"Never try to update link and don't prompt.","configuration.markdown.updateLinksOnFileMove.include":"Glob patterns that specifies files that trigger automatic link updates. See `#markdown.updateLinksOnFileMove.enabled#` for details about this feature.","configuration.markdown.updateLinksOnFileMove.include.property":"The glob pattern to match file paths against. Set to true to enable the pattern.","configuration.markdown.updateLinksOnFileMove.enableForDirectories":"Enable updating links when a directory is moved or renamed in the workspace.","configuration.markdown.occurrencesHighlight.enabled":"Enable highlighting link occurrences in the current document.","configuration.markdown.copyFiles.destination":{message:"Configures the path and file name of files created by copy/paste or drag and drop. This is a map of globs that match against a Markdown document path to the destination path where the new file should be created.\n\nThe destination path may use the following variables:\n\n- `${documentDirName}` \u2014 Absolute parent directory path of the Markdown document, e.g. `/Users/me/myProject/docs`.\n- `${documentRelativeDirName}` \u2014 Relative parent directory path of the Markdown document, e.g. `docs`. This is the same as `${documentDirName}` if the file is not part of a workspace.\n- `${documentFileName}` \u2014 The full filename of the Markdown document, e.g. `README.md`.\n- `${documentBaseName}` \u2014 The basename of the Markdown document, e.g. `README`.\n- `${documentExtName}` \u2014 The extension of the Markdown document, e.g. `md`.\n- `${documentFilePath}` \u2014 Absolute path of the Markdown document, e.g. `/Users/me/myProject/docs/README.md`.\n- `${documentRelativeFilePath}` \u2014 Relative path of the Markdown document, e.g. `docs/README.md`. This is the same as `${documentFilePath}` if the file is not part of a workspace.\n- `${documentWorkspaceFolder}` \u2014 The workspace folder for the Markdown document, e.g. `/Users/me/myProject`. This is the same as `${documentDirName}` if the file is not part of a workspace.\n- `${fileName}` \u2014 The file name of the dropped file, e.g. `image.png`.\n- `${fileExtName}` \u2014 The extension of the dropped file, e.g. `png`.\n- `${unixTime}` \u2014 The current Unix timestamp in milliseconds.\n- `${isoTime}` \u2014 The current time in ISO 8601 format, e.g. '2025-06-06T08:40:32.123Z'.",comment:["This setting is use the user drops or pastes image data into the editor. In this case, VS Code automatically creates a new image file in the workspace containing the dropped/pasted image.","It's easier to explain this setting with an example. For example, let's say the setting value was:","","{ 'docs/*.md': '${documentDirName}/images/${fileName}' }","","Here the setting is an object mapping from a set of globs to a set of file destinations.","The left hand side ('docs/*.md') is a glob that matches against a markdown document. If the glob, matches then we use the right hand side to compute the new file's path and name. The right hand side can also use the special variables document in this setting description."]},"configuration.markdown.copyFiles.overwriteBehavior":"Controls if files created by drop or paste should overwrite existing files.","configuration.markdown.copyFiles.overwriteBehavior.nameIncrementally":"If a file with the same name already exists, append a number to the file name, for example: `image.png` becomes `image-1.png`.","configuration.markdown.copyFiles.overwriteBehavior.overwrite":"If a file with the same name already exists, overwrite it.","configuration.markdown.preferredMdPathExtensionStyle":"Controls if file extensions (for example `.md`) are added or not for links to Markdown files. This setting is used when file paths are added by tooling such as path completions or file renames.","configuration.markdown.preferredMdPathExtensionStyle.auto":"For existing paths, try to maintain the file extension style. For new paths, add file extensions.","configuration.markdown.preferredMdPathExtensionStyle.includeExtension":"Prefer including the file extension. For example, path completions to a file named `file.md` will insert `file.md`.","configuration.markdown.preferredMdPathExtensionStyle.removeExtension":"Prefer removing the file extension. For example, path completions to a file named `file.md` will insert `file` without the `.md`.","configuration.markdown.editor.filePaste.videoSnippet":"Snippet used when adding videos to Markdown. This snippet can use the following variables:\n- `${src}` \u2014 The resolved path of the video file.\n- `${title}` \u2014 The title used for the video. A snippet placeholder will automatically be created for this variable.","configuration.markdown.editor.filePaste.audioSnippet":"Snippet used when adding audio to Markdown. This snippet can use the following variables:\n- `${src}` \u2014 The resolved path of the audio  file.\n- `${title}` \u2014 The title used for the audio. A snippet placeholder will automatically be created for this variable.","configuration.markdown.editor.updateLinksOnPaste.enabled":"Enable/disable a paste option that updates links and reference in text that is copied and pasted between Markdown editors.\n\nTo use this feature, after pasting text that contains updatable links, just click on the Paste Widget and select `Paste and update pasted links`.",workspaceTrust:"Required for loading styles configured in the workspace."},readmePath:"markdown-language-features/README.md"},{extensionPath:"markdown-math",packageJSON:{name:"markdown-math",displayName:"%displayName%",description:"%description%",version:"10.0.0",icon:"icon.png",publisher:"vscode",license:"MIT",aiKey:"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",engines:{vscode:"^1.54.0"},categories:["Other","Programming Languages"],capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:!0}},main:"./dist/extension",browser:"./dist/browser/extension",activationEvents:[],contributes:{languages:[{id:"markdown-math",aliases:[]}],grammars:[{language:"markdown-math",scopeName:"text.html.markdown.math",path:"./syntaxes/md-math.tmLanguage.json"},{scopeName:"markdown.math.block",path:"./syntaxes/md-math-block.tmLanguage.json",injectTo:["text.html.markdown"],embeddedLanguages:{"meta.embedded.math.markdown":"latex"}},{scopeName:"markdown.math.inline",path:"./syntaxes/md-math-inline.tmLanguage.json",injectTo:["text.html.markdown"],embeddedLanguages:{"meta.embedded.math.markdown":"latex","punctuation.definition.math.end.markdown":"latex"}},{scopeName:"markdown.math.codeblock",path:"./syntaxes/md-math-fence.tmLanguage.json",injectTo:["text.html.markdown"],embeddedLanguages:{"meta.embedded.math.markdown":"latex"}}],notebookRenderer:[{id:"vscode.markdown-it-katex-extension",displayName:"Markdown it KaTeX renderer",entrypoint:{extends:"vscode.markdown-it-renderer",path:"./notebook-out/katex.js"}}],"markdown.markdownItPlugins":!0,"markdown.previewStyles":["./notebook-out/katex.min.css","./preview-styles/index.css"],configuration:[{title:"Markdown Math",properties:{"markdown.math.enabled":{type:"boolean",default:!0,description:"%config.markdown.math.enabled%"},"markdown.math.macros":{type:"object",additionalProperties:{type:"string"},default:{},description:"%config.markdown.math.macros%",scope:"resource"}}}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Markdown Math",description:"Adds math support to Markdown in notebooks.","config.markdown.math.enabled":"Enable/disable rendering math in the built-in Markdown preview.","config.markdown.math.macros":"A collection of custom macros. Each macro is a key-value pair where the key is a new command name and the value is the expansion of the macro."},readmePath:"markdown-math/README.md"},{extensionPath:"media-preview",packageJSON:{name:"media-preview",displayName:"%displayName%",description:"%description%",extensionKind:["ui","workspace"],version:"10.0.0",publisher:"vscode",icon:"icon.png",license:"MIT",aiKey:"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",engines:{vscode:"^1.70.0"},main:"./dist/extension",browser:"./dist/browser/extension.js",categories:["Other"],activationEvents:[],capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:!0}},contributes:{configuration:{type:"object",title:"Media Previewer",properties:{"mediaPreview.video.autoPlay":{type:"boolean",default:!1,markdownDescription:"%videoPreviewerAutoPlay%"},"mediaPreview.video.loop":{type:"boolean",default:!1,markdownDescription:"%videoPreviewerLoop%"}}},customEditors:[{viewType:"imagePreview.previewEditor",displayName:"%customEditor.imagePreview.displayName%",priority:"builtin",selector:[{filenamePattern:"*.{jpg,jpe,jpeg,png,bmp,gif,ico,webp,avif,svg}"}]},{viewType:"vscode.audioPreview",displayName:"%customEditor.audioPreview.displayName%",priority:"builtin",selector:[{filenamePattern:"*.{mp3,wav,ogg,oga}"}]},{viewType:"vscode.videoPreview",displayName:"%customEditor.videoPreview.displayName%",priority:"builtin",selector:[{filenamePattern:"*.{mp4,webm}"}]}],commands:[{command:"imagePreview.zoomIn",title:"%command.zoomIn%",category:"Image Preview"},{command:"imagePreview.zoomOut",title:"%command.zoomOut%",category:"Image Preview"},{command:"imagePreview.copyImage",title:"%command.copyImage%",category:"Image Preview"},{command:"imagePreview.reopenAsPreview",title:"%command.reopenAsPreview%",category:"Image Preview",icon:"$(preview)"},{command:"imagePreview.reopenAsText",title:"%command.reopenAsText%",category:"Image Preview",icon:"$(go-to-file)"}],menus:{commandPalette:[{command:"imagePreview.zoomIn",when:"activeCustomEditorId == 'imagePreview.previewEditor'",group:"1_imagePreview"},{command:"imagePreview.zoomOut",when:"activeCustomEditorId == 'imagePreview.previewEditor'",group:"1_imagePreview"},{command:"imagePreview.copyImage",when:"false"},{command:"imagePreview.reopenAsPreview",when:"activeEditor == workbench.editors.files.textFileEditor && resourceExtname == '.svg'",group:"navigation"},{command:"imagePreview.reopenAsText",when:"activeCustomEditorId == 'imagePreview.previewEditor' && resourceExtname == '.svg'",group:"navigation"}],"webview/context":[{command:"imagePreview.copyImage",when:"webviewId == 'imagePreview.previewEditor'"}],"editor/title":[{command:"imagePreview.reopenAsPreview",when:"editorFocus && resourceExtname == '.svg'",group:"navigation"},{command:"imagePreview.reopenAsText",when:"activeCustomEditorId == 'imagePreview.previewEditor' && resourceExtname == '.svg'",group:"navigation"}]}},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Media Preview",description:"Provides VS Code's built-in previews for images, audio, and video","customEditor.audioPreview.displayName":"Audio Preview","customEditor.imagePreview.displayName":"Image Preview","customEditor.videoPreview.displayName":"Video Preview",videoPreviewerAutoPlay:"Start playing videos on mute automatically.",videoPreviewerLoop:"Loop videos over again automatically.","command.zoomIn":"Zoom in","command.zoomOut":"Zoom out","command.copyImage":"Copy","command.reopenAsPreview":"Reopen as image preview","command.reopenAsText":"Reopen as source text"},readmePath:"media-preview/README.md"},{extensionPath:"merge-conflict",packageJSON:{name:"merge-conflict",publisher:"vscode",displayName:"%displayName%",description:"%description%",icon:"media/icon.png",version:"10.0.0",license:"MIT",aiKey:"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",engines:{vscode:"^1.5.0"},categories:["Other"],capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:!0}},activationEvents:["onStartupFinished"],main:"./dist/mergeConflictMain",browser:"./dist/browser/mergeConflictMain",contributes:{commands:[{category:"%command.category%",title:"%command.accept.all-current%",original:"Accept All Current",command:"merge-conflict.accept.all-current",enablement:"!isMergeEditor"},{category:"%command.category%",title:"%command.accept.all-incoming%",original:"Accept All Incoming",command:"merge-conflict.accept.all-incoming",enablement:"!isMergeEditor"},{category:"%command.category%",title:"%command.accept.all-both%",original:"Accept All Both",command:"merge-conflict.accept.all-both",enablement:"!isMergeEditor"},{category:"%command.category%",title:"%command.accept.current%",original:"Accept Current",command:"merge-conflict.accept.current",enablement:"!isMergeEditor"},{category:"%command.category%",title:"%command.accept.incoming%",original:"Accept Incoming",command:"merge-conflict.accept.incoming",enablement:"!isMergeEditor"},{category:"%command.category%",title:"%command.accept.selection%",original:"Accept Selection",command:"merge-conflict.accept.selection",enablement:"!isMergeEditor"},{category:"%command.category%",title:"%command.accept.both%",original:"Accept Both",command:"merge-conflict.accept.both",enablement:"!isMergeEditor"},{category:"%command.category%",title:"%command.next%",original:"Next Conflict",command:"merge-conflict.next",enablement:"!isMergeEditor",icon:"$(arrow-down)"},{category:"%command.category%",title:"%command.previous%",original:"Previous Conflict",command:"merge-conflict.previous",enablement:"!isMergeEditor",icon:"$(arrow-up)"},{category:"%command.category%",title:"%command.compare%",original:"Compare Current Conflict",command:"merge-conflict.compare",enablement:"!isMergeEditor"}],menus:{"scm/resourceState/context":[{command:"merge-conflict.accept.all-current",when:"scmProvider == git && scmResourceGroup == merge",group:"1_modification"},{command:"merge-conflict.accept.all-incoming",when:"scmProvider == git && scmResourceGroup == merge",group:"1_modification"}],"editor/title":[{command:"merge-conflict.previous",group:"navigation@1",when:"!isMergeEditor && mergeConflictsCount && mergeConflictsCount != 0"},{command:"merge-conflict.next",group:"navigation@2",when:"!isMergeEditor && mergeConflictsCount && mergeConflictsCount != 0"}]},configuration:{title:"%config.title%",properties:{"merge-conflict.codeLens.enabled":{type:"boolean",description:"%config.codeLensEnabled%",default:!0},"merge-conflict.decorators.enabled":{type:"boolean",description:"%config.decoratorsEnabled%",default:!0},"merge-conflict.autoNavigateNextConflict.enabled":{type:"boolean",description:"%config.autoNavigateNextConflictEnabled%",default:!1},"merge-conflict.diffViewPosition":{type:"string",enum:["Current","Beside","Below"],description:"%config.diffViewPosition%",enumDescriptions:["%config.diffViewPosition.current%","%config.diffViewPosition.beside%","%config.diffViewPosition.below%"],default:"Current"}}}},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Merge Conflict",description:"Highlighting and commands for inline merge conflicts.","command.category":"Merge Conflict","command.accept.all-current":"Accept All Current","command.accept.all-incoming":"Accept All Incoming","command.accept.all-both":"Accept All Both","command.accept.current":"Accept Current","command.accept.incoming":"Accept Incoming","command.accept.selection":"Accept Selection","command.accept.both":"Accept Both","command.next":"Next Conflict","command.previous":"Previous Conflict","command.compare":"Compare Current Conflict","config.title":"Merge Conflict","config.autoNavigateNextConflictEnabled":"Whether to automatically navigate to the next merge conflict after resolving a merge conflict.","config.codeLensEnabled":"Create a CodeLens for merge conflict blocks within editor.","config.decoratorsEnabled":"Create decorators for merge conflict blocks within editor.","config.diffViewPosition":"Controls where the diff view should be opened when comparing changes in merge conflicts.","config.diffViewPosition.current":"Open the diff view in the current editor group.","config.diffViewPosition.beside":"Open the diff view next to the current editor group.","config.diffViewPosition.below":"Open the diff view below the current editor group."},readmePath:"merge-conflict/README.md"},{extensionPath:"mermaid-chat-features",packageJSON:{name:"mermaid-chat-features",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",repository:{type:"git",url:"https://github.com/microsoft/vscode.git"},aiKey:"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",engines:{vscode:"^1.104.0"},enabledApiProposals:["chatOutputRenderer"],capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:!0}},main:"./dist/extension",browser:"./dist/browser/extension",activationEvents:["onWebviewPanel:vscode.chat-mermaid-features.preview"],contributes:{commands:[{command:"_mermaid-chat.resetPanZoom",title:"Reset Pan and Zoom"},{command:"_mermaid-chat.openInEditor",title:"Open Diagram in Editor"},{command:"_mermaid-chat.copySource",title:"Copy Diagram Source"}],menus:{commandPalette:[{command:"_mermaid-chat.resetPanZoom",when:"false"},{command:"_mermaid-chat.openInEditor",when:"false"},{command:"_mermaid-chat.copySource",when:"false"}],"webview/context":[{command:"_mermaid-chat.resetPanZoom",when:"webviewId == 'vscode.chat-mermaid-features.chatOutputItem'"},{command:"_mermaid-chat.copySource",when:"webviewId == 'vscode.chat-mermaid-features.chatOutputItem' || webviewId == 'vscode.chat-mermaid-features.preview'"}]},configuration:{title:"Mermaid Chat Features",properties:{"mermaid-chat.enabled":{type:"boolean",default:!0,description:"%config.enabled.description%",scope:"application"}}},chatOutputRenderers:[{viewType:"vscode.chat-mermaid-features.chatOutputItem",mimeTypes:["text/vnd.mermaid"]}],languageModelTools:[{name:"renderMermaidDiagram",displayName:"Mermaid Renderer",toolReferenceName:"renderMermaidDiagram",canBeReferencedInPrompt:!0,modelDescription:"Renders a Mermaid diagram from Mermaid.js markup.",userDescription:"Render a Mermaid.js diagrams from markup.",when:"config.mermaid-chat.enabled",inputSchema:{type:"object",properties:{markup:{type:"string",description:"The mermaid diagram markup to render as a Mermaid diagram. This should only be the markup of the diagram. Do not include a wrapping code block."},title:{type:"string",description:"A short title that describes the diagram."}}}}]}},packageNLS:{displayName:"Mermaid Chat Features",description:"Adds Mermaid diagram support to built-in chats.","config.enabled.description":"Enable a tool for Mermaid diagram rendering in chat responses."},readmePath:"mermaid-chat-features/README.md"},{extensionPath:"ms-vscode.vscode-js-profile-table",packageJSON:{name:"vscode-js-profile-table",version:"1.0.10",displayName:"Table Visualizer for JavaScript Profiles",description:"Text visualizer for profiles taken from the JavaScript debugger",author:"Connor Peet <connor@peet.io>",homepage:"https://github.com/microsoft/vscode-js-profile-visualizer#readme",license:"MIT",main:"out/extension.js",browser:"out/extension.web.js",repository:{type:"git",url:"https://github.com/microsoft/vscode-js-profile-visualizer.git"},capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:!0}},icon:"resources/icon.png",publisher:"ms-vscode",sideEffects:!1,engines:{vscode:"^1.74.0"},contributes:{customEditors:[{viewType:"jsProfileVisualizer.cpuprofile.table",displayName:"CPU Profile Table Visualizer",priority:"default",selector:[{filenamePattern:"*.cpuprofile"}]},{viewType:"jsProfileVisualizer.heapprofile.table",displayName:"Heap Profile Table Visualizer",priority:"default",selector:[{filenamePattern:"*.heapprofile"}]},{viewType:"jsProfileVisualizer.heapsnapshot.table",displayName:"Heap Snapshot Table Visualizer",priority:"default",selector:[{filenamePattern:"*.heapsnapshot"}]}],commands:[{command:"extension.jsProfileVisualizer.table.clearCodeLenses",title:"Clear Profile Code Lenses"}],menus:{commandPalette:[{command:"extension.jsProfileVisualizer.table.clearCodeLenses",when:"jsProfileVisualizer.hasCodeLenses == true"}]}},bugs:{url:"https://github.com/microsoft/vscode-js-profile-visualizer/issues"},__metadata:{id:"7e52b41b-71ad-457b-ab7e-0620f1fc4feb",publisherId:{publisherId:"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee",publisherName:"ms-vscode",displayName:"Microsoft",flags:"verified"},publisherDisplayName:"Microsoft"}},readmePath:"ms-vscode.vscode-js-profile-table/README.md"},{extensionPath:"notebook-renderers",packageJSON:{name:"builtin-notebook-renderers",displayName:"%displayName%",description:"%description%",publisher:"vscode",version:"10.0.0",license:"MIT",icon:"media/icon.png",engines:{vscode:"^1.57.0"},capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:!0}},contributes:{notebookRenderer:[{id:"vscode.builtin-renderer",entrypoint:"./renderer-out/index.js",displayName:"VS Code Builtin Notebook Output Renderer",requiresMessaging:"never",mimeTypes:["image/gif","image/png","image/jpeg","image/git","image/svg+xml","text/html","application/javascript","application/vnd.code.notebook.error","application/vnd.code.notebook.stdout","application/x.notebook.stdout","application/x.notebook.stream","application/vnd.code.notebook.stderr","application/x.notebook.stderr","text/plain"]}]},scripts:{compile:"npx gulp compile-extension:notebook-renderers && npm run build-notebook",watch:"npx gulp compile-watch:notebook-renderers","build-notebook":"node ./esbuild.notebook.mts"},devDependencies:{"@types/jsdom":"^21.1.0","@types/node":"^22.18.10","@types/vscode-notebook-renderer":"^1.60.0",jsdom:"^28.1.0"},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Builtin Notebook Output Renderers",description:"Provides basic output renderers for notebooks"},readmePath:"notebook-renderers/README.md"},{extensionPath:"npm",packageJSON:{name:"npm",publisher:"vscode",displayName:"%displayName%",description:"%description%",version:"1.0.1",private:!0,license:"MIT",engines:{vscode:"0.10.x"},icon:"images/npm_icon.png",categories:["Other"],enabledApiProposals:["terminalQuickFixProvider"],main:"./dist/npmMain",browser:"./dist/browser/npmBrowserMain",activationEvents:["onTaskType:npm","onLanguage:json","workspaceContains:package.json"],capabilities:{virtualWorkspaces:{supported:"limited",description:"%virtualWorkspaces%"},untrustedWorkspaces:{supported:"limited",description:"%workspaceTrust%"}},contributes:{languages:[{id:"ignore",extensions:[".npmignore"]},{id:"properties",extensions:[".npmrc"]}],views:{explorer:[{id:"npm",name:"%view.name%",when:"npm:showScriptExplorer",icon:"$(json)",visibility:"hidden",contextualTitle:"%view.name%"}]},commands:[{command:"npm.runScript",title:"%command.run%",icon:"$(run)"},{command:"npm.debugScript",title:"%command.debug%",icon:"$(debug)"},{command:"npm.openScript",title:"%command.openScript%"},{command:"npm.runInstall",title:"%command.runInstall%"},{command:"npm.refresh",title:"%command.refresh%",icon:"$(refresh)"},{command:"npm.runSelectedScript",title:"%command.runSelectedScript%"},{command:"npm.runScriptFromFolder",title:"%command.runScriptFromFolder%"},{command:"npm.packageManager",title:"%command.packageManager%"}],menus:{commandPalette:[{command:"npm.refresh",when:"false"},{command:"npm.runScript",when:"false"},{command:"npm.debugScript",when:"false"},{command:"npm.openScript",when:"false"},{command:"npm.runInstall",when:"false"},{command:"npm.runSelectedScript",when:"false"},{command:"npm.runScriptFromFolder",when:"false"},{command:"npm.packageManager",when:"false"}],"editor/context":[{command:"npm.runSelectedScript",when:"resourceFilename == 'package.json' && resourceScheme == file",group:"navigation@+1"}],"view/title":[{command:"npm.refresh",when:"view == npm",group:"navigation"}],"view/item/context":[{command:"npm.openScript",when:"view == npm && viewItem == packageJSON",group:"navigation@1"},{command:"npm.runInstall",when:"view == npm && viewItem == packageJSON",group:"navigation@2"},{command:"npm.openScript",when:"view == npm && viewItem == script",group:"navigation@1"},{command:"npm.runScript",when:"view == npm && viewItem == script",group:"navigation@2"},{command:"npm.runScript",when:"view == npm && viewItem == script",group:"inline"},{command:"npm.debugScript",when:"view == npm && viewItem == script",group:"inline"},{command:"npm.debugScript",when:"view == npm && viewItem == script",group:"navigation@3"}],"explorer/context":[{when:"config.npm.enableRunFromFolder && explorerViewletVisible && explorerResourceIsFolder && resourceScheme == file",command:"npm.runScriptFromFolder",group:"2_workspace"}]},configuration:{id:"npm",type:"object",title:"Npm",properties:{"npm.autoDetect":{type:"string",enum:["off","on"],default:"on",scope:"resource",description:"%config.npm.autoDetect%"},"npm.runSilent":{type:"boolean",default:!1,scope:"resource",markdownDescription:"%config.npm.runSilent%"},"npm.packageManager":{scope:"resource",type:"string",enum:["auto","npm","yarn","pnpm","bun"],enumDescriptions:["%config.npm.packageManager.auto%","%config.npm.packageManager.npm%","%config.npm.packageManager.yarn%","%config.npm.packageManager.pnpm%","%config.npm.packageManager.bun%"],default:"auto",description:"%config.npm.packageManager%"},"npm.scriptRunner":{scope:"resource",type:"string",enum:["auto","npm","yarn","pnpm","bun","node"],enumDescriptions:["%config.npm.scriptRunner.auto%","%config.npm.scriptRunner.npm%","%config.npm.scriptRunner.yarn%","%config.npm.scriptRunner.pnpm%","%config.npm.scriptRunner.bun%","%config.npm.scriptRunner.node%"],default:"auto",description:"%config.npm.scriptRunner%"},"npm.exclude":{type:["string","array"],items:{type:"string"},description:"%config.npm.exclude%",scope:"resource"},"npm.enableScriptExplorer":{type:"boolean",default:!1,scope:"resource",deprecationMessage:"The NPM Script Explorer is now available in 'Views' menu in the Explorer in all folders.",markdownDescription:"%config.npm.enableScriptExplorer%"},"npm.enableRunFromFolder":{type:"boolean",default:!1,scope:"resource",description:"%config.npm.enableRunFromFolder%"},"npm.scriptExplorerAction":{type:"string",enum:["open","run"],markdownDescription:"%config.npm.scriptExplorerAction%",scope:"window",default:"open"},"npm.scriptExplorerExclude":{type:"array",items:{type:"string"},markdownDescription:"%config.npm.scriptExplorerExclude%",scope:"resource",default:[]},"npm.fetchOnlinePackageInfo":{type:"boolean",description:"%config.npm.fetchOnlinePackageInfo%",default:!0,scope:"window",tags:["usesOnlineServices"]},"npm.scriptHover":{type:"boolean",markdownDescription:"%config.npm.scriptHover%",default:!0,scope:"window"}}},jsonValidation:[{fileMatch:"package.json",url:"https://www.schemastore.org/package"},{fileMatch:"bower.json",url:"https://www.schemastore.org/bower"}],taskDefinitions:[{type:"npm",required:["script"],properties:{script:{type:"string",description:"%taskdef.script%"},path:{type:"string",description:"%taskdef.path%"}},when:"shellExecutionSupported"}],terminalQuickFixes:[{id:"ms-vscode.npm-command",commandLineMatcher:"npm",commandExitResult:"error",outputMatcher:{anchor:"bottom",length:8,lineMatcher:"Did you mean (?:this|one of these)\\?((?:\\n.+?npm .+ #.+)+)",offset:2}}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{description:"Extension to add task support for npm scripts.",displayName:"NPM support for VS Code",workspaceTrust:"This extension executes tasks, which require trust to run.",virtualWorkspaces:"Functionality that requires running the 'npm' command is not available in virtual workspaces.","config.npm.autoDetect":"Controls whether npm scripts should be automatically detected.","config.npm.runSilent":"Run npm commands with the `--silent` option.","config.npm.packageManager":"The package manager used to install dependencies.","config.npm.packageManager.npm":"Use npm as the package manager.","config.npm.packageManager.yarn":"Use yarn as the package manager.","config.npm.packageManager.pnpm":"Use pnpm as the package manager.","config.npm.packageManager.bun":"Use bun as the package manager.","config.npm.packageManager.auto":"Auto-detect which package manager to use based on lock files and installed package managers.","config.npm.scriptRunner":"The script runner used to run scripts.","config.npm.scriptRunner.npm":"Use npm as the script runner.","config.npm.scriptRunner.yarn":"Use yarn as the script runner.","config.npm.scriptRunner.pnpm":"Use pnpm as the script runner.","config.npm.scriptRunner.bun":"Use bun as the script runner.","config.npm.scriptRunner.node":"Use Node.js as the script runner.","config.npm.scriptRunner.auto":"Auto-detect which script runner to use based on lock files and installed package managers.","config.npm.exclude":"Configure glob patterns for folders that should be excluded from automatic script detection.","config.npm.enableScriptExplorer":"Enable an explorer view for npm scripts when there is no top-level `package.json` file.","config.npm.scriptExplorerAction":"The default click action used in the NPM Scripts Explorer: `open` or `run`, the default is `open`.","config.npm.scriptExplorerExclude":"An array of regular expressions that indicate which scripts should be excluded from the NPM Scripts view.","config.npm.enableRunFromFolder":"Enable running npm scripts contained in a folder from the Explorer context menu.","config.npm.fetchOnlinePackageInfo":"Fetch data from https://registry.npmjs.org and https://registry.bower.io to provide auto-completion and information on hover features on npm dependencies.","config.npm.scriptHover":"Display hover with `Run` and `Debug` commands for scripts.","npm.parseError":"Npm task detection: failed to parse the file {0}","taskdef.script":"The npm script to customize.","taskdef.path":"The path to the folder of the package.json file that provides the script. Can be omitted.","view.name":"NPM Scripts","command.refresh":"Refresh","command.run":"Run","command.debug":"Debug","command.openScript":"Open","command.runInstall":"Run Install","command.runSelectedScript":"Run Script","command.runScriptFromFolder":"Run NPM Script in Folder...","command.packageManager":"Get Configured Package Manager"},readmePath:"npm/README.md"},{extensionPath:"objective-c",packageJSON:{name:"objective-c",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ./build/update-grammars.js"},categories:["Programming Languages"],contributes:{languages:[{id:"objective-c",extensions:[".m"],aliases:["Objective-C"],configuration:"./language-configuration.json"},{id:"objective-cpp",extensions:[".mm"],aliases:["Objective-C++"],configuration:"./language-configuration.json"}],grammars:[{language:"objective-c",scopeName:"source.objc",path:"./syntaxes/objective-c.tmLanguage.json"},{language:"objective-cpp",scopeName:"source.objcpp",path:"./syntaxes/objective-c++.tmLanguage.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Objective-C Language Basics",description:"Provides syntax highlighting and bracket matching in Objective-C files."}},{extensionPath:"perl",packageJSON:{name:"perl",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin textmate/perl.tmbundle Syntaxes/Perl.plist ./syntaxes/perl.tmLanguage.json Syntaxes/Perl%206.tmLanguage ./syntaxes/perl6.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"perl",aliases:["Perl","perl"],extensions:[".pl",".pm",".pod",".t",".PL",".psgi"],firstLine:"^#!.*\\bperl\\b",configuration:"./perl.language-configuration.json"},{id:"raku",aliases:["Raku","Perl6","perl6"],extensions:[".raku",".rakumod",".rakutest",".rakudoc",".nqp",".p6",".pl6",".pm6"],firstLine:"(^#!.*\\bperl6\\b)|use\\s+v6|raku|=begin\\spod|my\\sclass",configuration:"./perl6.language-configuration.json"}],grammars:[{language:"perl",scopeName:"source.perl",path:"./syntaxes/perl.tmLanguage.json",unbalancedBracketScopes:["variable.other.predefined.perl"]},{language:"raku",scopeName:"source.perl.6",path:"./syntaxes/perl6.tmLanguage.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Perl Language Basics",description:"Provides syntax highlighting and bracket matching in Perl files."}},{extensionPath:"php",packageJSON:{name:"php",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"0.10.x"},categories:["Programming Languages"],contributes:{languages:[{id:"php",extensions:[".php",".php4",".php5",".phtml",".ctp"],aliases:["PHP","php"],firstLine:"^#!\\s*/.*\\bphp\\b",mimetypes:["application/x-php"],configuration:"./language-configuration.json"}],grammars:[{language:"php",scopeName:"source.php",path:"./syntaxes/php.tmLanguage.json"},{language:"php",scopeName:"text.html.php",path:"./syntaxes/html.tmLanguage.json",embeddedLanguages:{"text.html":"html","source.php":"php","source.sql":"sql","text.xml":"xml","source.js":"javascript","source.json":"json","source.css":"css"}}],snippets:[{language:"php",path:"./snippets/php.code-snippets"}]},scripts:{"update-grammar":"node ./build/update-grammar.mjs"},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"PHP Language Basics",description:"Provides syntax highlighting and bracket matching for PHP files."}},{extensionPath:"powershell",packageJSON:{name:"powershell",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},categories:["Programming Languages"],contributes:{languages:[{id:"powershell",extensions:[".ps1",".psm1",".psd1",".pssc",".psrc"],aliases:["PowerShell","powershell","ps","ps1","pwsh"],firstLine:"^#!\\s*/.*\\bpwsh\\b",configuration:"./language-configuration.json"}],grammars:[{language:"powershell",scopeName:"source.powershell",path:"./syntaxes/powershell.tmLanguage.json"}]},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin PowerShell/EditorSyntax PowerShellSyntax.tmLanguage ./syntaxes/powershell.tmLanguage.json"},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Powershell Language Basics",description:"Provides snippets, syntax highlighting, bracket matching and folding in Powershell files."}},{extensionPath:"prompt-basics",packageJSON:{name:"prompt",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"^1.20.0"},categories:["Programming Languages"],contributes:{languages:[{id:"prompt",aliases:["Prompt","prompt"],extensions:[".prompt.md"],configuration:"./language-configuration.json"},{id:"instructions",aliases:["Instructions","instructions"],extensions:[".instructions.md","copilot-instructions.md"],filenamePatterns:["**/.claude/rules/**/*.md"],configuration:"./language-configuration.json"},{id:"chatagent",aliases:["Agent","chat agent"],extensions:[".agent.md",".chatmode.md"],filenamePatterns:["**/.github/agents/*.md","**/.claude/agents/*.md"],configuration:"./language-configuration.json"},{id:"skill",aliases:["Skill","skill"],filenames:["SKILL.md"],configuration:"./language-configuration.json"}],grammars:[{language:"prompt",path:"./syntaxes/prompt.tmLanguage.json",scopeName:"text.html.markdown.prompt",unbalancedBracketScopes:["markup.underline.link.markdown","punctuation.definition.list.begin.markdown"]},{language:"instructions",path:"./syntaxes/prompt.tmLanguage.json",scopeName:"text.html.markdown.prompt",unbalancedBracketScopes:["markup.underline.link.markdown","punctuation.definition.list.begin.markdown"]},{language:"chatagent",path:"./syntaxes/prompt.tmLanguage.json",scopeName:"text.html.markdown.prompt",unbalancedBracketScopes:["markup.underline.link.markdown","punctuation.definition.list.begin.markdown"]},{language:"skill",path:"./syntaxes/prompt.tmLanguage.json",scopeName:"text.html.markdown.prompt",unbalancedBracketScopes:["markup.underline.link.markdown","punctuation.definition.list.begin.markdown"]}],configurationDefaults:{"[prompt]":{"editor.insertSpaces":!0,"editor.tabSize":2,"editor.autoIndent":"advanced","editor.unicodeHighlight.ambiguousCharacters":!1,"editor.unicodeHighlight.invisibleCharacters":!1,"diffEditor.ignoreTrimWhitespace":!1,"editor.wordWrap":"on","editor.quickSuggestions":{comments:"off",strings:"on",other:"on"},"editor.wordBasedSuggestions":"off"},"[instructions]":{"editor.insertSpaces":!0,"editor.tabSize":2,"editor.autoIndent":"advanced","editor.unicodeHighlight.ambiguousCharacters":!1,"editor.unicodeHighlight.invisibleCharacters":!1,"diffEditor.ignoreTrimWhitespace":!1,"editor.wordWrap":"on","editor.quickSuggestions":{comments:"off",strings:"on",other:"on"},"editor.wordBasedSuggestions":"off"},"[chatagent]":{"editor.insertSpaces":!0,"editor.tabSize":2,"editor.autoIndent":"advanced","editor.unicodeHighlight.ambiguousCharacters":!1,"editor.unicodeHighlight.invisibleCharacters":!1,"diffEditor.ignoreTrimWhitespace":!1,"editor.wordWrap":"on","editor.quickSuggestions":{comments:"off",strings:"on",other:"on"},"editor.wordBasedSuggestions":"off"},"[skill]":{"editor.insertSpaces":!0,"editor.tabSize":2,"editor.autoIndent":"advanced","editor.unicodeHighlight.ambiguousCharacters":!1,"editor.unicodeHighlight.invisibleCharacters":!1,"diffEditor.ignoreTrimWhitespace":!1,"editor.wordWrap":"on","editor.quickSuggestions":{comments:"off",strings:"on",other:"on"},"editor.wordBasedSuggestions":"off"}}},scripts:{},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Prompt Language Basics",description:"Syntax highlighting for Prompt and Instructions documents."}},{extensionPath:"pug",packageJSON:{name:"pug",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin davidrios/pug-tmbundle Syntaxes/Pug.JSON-tmLanguage ./syntaxes/pug.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"jade",extensions:[".pug",".jade"],aliases:["Pug","Jade","jade"],configuration:"./language-configuration.json"}],grammars:[{language:"jade",scopeName:"text.pug",path:"./syntaxes/pug.tmLanguage.json"}],configurationDefaults:{"[jade]":{"diffEditor.ignoreTrimWhitespace":!1}}},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Pug Language Basics",description:"Provides syntax highlighting and bracket matching in Pug files."}},{extensionPath:"python",packageJSON:{name:"python",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},categories:["Programming Languages"],contributes:{languages:[{id:"python",extensions:[".py",".rpy",".pyw",".cpy",".gyp",".gypi",".pyi",".ipy",".pyt"],aliases:["Python","py"],filenames:["SConstruct","SConscript"],firstLine:"^#!\\s*/?.*\\bpython[0-9.-]*\\b",configuration:"./language-configuration.json"}],grammars:[{language:"python",scopeName:"source.python",path:"./syntaxes/MagicPython.tmLanguage.json"},{scopeName:"source.regexp.python",path:"./syntaxes/MagicRegExp.tmLanguage.json"}],configurationDefaults:{"[python]":{"diffEditor.ignoreTrimWhitespace":!1,"editor.defaultColorDecorators":"never"}}},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin MagicStack/MagicPython grammars/MagicPython.tmLanguage ./syntaxes/MagicPython.tmLanguage.json grammars/MagicRegExp.tmLanguage ./syntaxes/MagicRegExp.tmLanguage.json"},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Python Language Basics",description:"Provides syntax highlighting, bracket matching and folding in Python files."}},{extensionPath:"r",packageJSON:{name:"r",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin REditorSupport/vscode-R-syntax syntaxes/r.json ./syntaxes/r.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"r",extensions:[".R",".Rhistory",".Rprofile",".rt"],aliases:["R","r"],configuration:"./language-configuration.json"}],grammars:[{language:"r",scopeName:"source.r",path:"./syntaxes/r.tmLanguage.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"R Language Basics",description:"Provides syntax highlighting and bracket matching in R files."}},{extensionPath:"razor",packageJSON:{name:"razor",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"0.10.x"},scripts:{"update-grammar":"node ./build/update-grammar.mjs"},categories:["Programming Languages"],contributes:{languages:[{id:"razor",extensions:[".cshtml",".razor"],aliases:["Razor","razor"],mimetypes:["text/x-cshtml"],configuration:"./language-configuration.json"}],grammars:[{language:"razor",scopeName:"text.html.cshtml",path:"./syntaxes/cshtml.tmLanguage.json",embeddedLanguages:{"section.embedded.source.cshtml":"csharp","source.css":"css","source.js":"javascript"}}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Razor Language Basics",description:"Provides syntax highlighting, bracket matching and folding in Razor files."}},{extensionPath:"references-view",packageJSON:{name:"references-view",displayName:"%displayName%",description:"%description%",icon:"media/icon.png",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"^1.67.0"},capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:!0}},repository:{type:"git",url:"https://github.com/Microsoft/vscode-references-view"},bugs:{url:"https://github.com/Microsoft/vscode-references-view/issues"},activationEvents:["onCommand:references-view.find","onCommand:editor.action.showReferences"],main:"./dist/extension",browser:"./dist/browser/extension",contributes:{configuration:{properties:{"references.preferredLocation":{description:"%config.references.preferredLocation%",type:"string",default:"peek",enum:["peek","view"],enumDescriptions:["%config.references.preferredLocation.peek%","%config.references.preferredLocation.view%"]}}},viewsContainers:{activitybar:[{id:"references-view",icon:"$(references)",title:"%container.title%"}]},views:{"references-view":[{id:"references-view.tree",name:"%view.title%",when:"reference-list.isActive"}]},commands:[{command:"references-view.findReferences",title:"%cmd.references-view.findReferences%",category:"%cmd.category.references%"},{command:"references-view.findImplementations",title:"%cmd.references-view.findImplementations%",category:"%cmd.category.references%"},{command:"references-view.clearHistory",title:"%cmd.references-view.clearHistory%",category:"%cmd.category.references%",icon:"$(clear-all)"},{command:"references-view.clear",title:"%cmd.references-view.clear%",category:"%cmd.category.references%",icon:"$(clear-all)"},{command:"references-view.refresh",title:"%cmd.references-view.refresh%",category:"%cmd.category.references%",icon:"$(refresh)"},{command:"references-view.pickFromHistory",title:"%cmd.references-view.pickFromHistory%",category:"%cmd.category.references%"},{command:"references-view.removeReferenceItem",title:"%cmd.references-view.removeReferenceItem%",icon:"$(close)"},{command:"references-view.copy",title:"%cmd.references-view.copy%"},{command:"references-view.copyAll",title:"%cmd.references-view.copyAll%"},{command:"references-view.copyPath",title:"%cmd.references-view.copyPath%"},{command:"references-view.refind",title:"%cmd.references-view.refind%",icon:"$(refresh)"},{command:"references-view.showCallHierarchy",title:"%cmd.references-view.showCallHierarchy%",category:"Calls"},{command:"references-view.showOutgoingCalls",title:"%cmd.references-view.showOutgoingCalls%",category:"Calls",icon:"$(call-incoming)"},{command:"references-view.showIncomingCalls",title:"%cmd.references-view.showIncomingCalls%",category:"Calls",icon:"$(call-outgoing)"},{command:"references-view.removeCallItem",title:"%cmd.references-view.removeCallItem%",icon:"$(close)"},{command:"references-view.next",title:"%cmd.references-view.next%",enablement:"references-view.canNavigate"},{command:"references-view.prev",title:"%cmd.references-view.prev%",enablement:"references-view.canNavigate"},{command:"references-view.showTypeHierarchy",title:"%cmd.references-view.showTypeHierarchy%",category:"Types"},{command:"references-view.showSupertypes",title:"%cmd.references-view.showSupertypes%",category:"Types",icon:"$(type-hierarchy-super)"},{command:"references-view.showSubtypes",title:"%cmd.references-view.showSubtypes%",category:"Types",icon:"$(type-hierarchy-sub)"},{command:"references-view.removeTypeItem",title:"%cmd.references-view.removeTypeItem%",icon:"$(close)"}],menus:{"editor/context":[{command:"references-view.findReferences",when:"editorHasReferenceProvider",group:"0_navigation@1"},{command:"references-view.findImplementations",when:"editorHasImplementationProvider",group:"0_navigation@2"},{command:"references-view.showCallHierarchy",when:"editorHasCallHierarchyProvider",group:"0_navigation@3"},{command:"references-view.showTypeHierarchy",when:"editorHasTypeHierarchyProvider",group:"0_navigation@4"}],"view/title":[{command:"references-view.clear",group:"navigation@3",when:"view == references-view.tree && reference-list.hasResult"},{command:"references-view.clearHistory",group:"navigation@3",when:"view == references-view.tree && reference-list.hasHistory && !reference-list.hasResult"},{command:"references-view.refresh",group:"navigation@2",when:"view == references-view.tree && reference-list.hasResult"},{command:"references-view.showOutgoingCalls",group:"navigation@1",when:"view == references-view.tree && reference-list.hasResult && reference-list.source == callHierarchy &&  references-view.callHierarchyMode == showIncoming"},{command:"references-view.showIncomingCalls",group:"navigation@1",when:"view == references-view.tree && reference-list.hasResult && reference-list.source == callHierarchy &&  references-view.callHierarchyMode == showOutgoing"},{command:"references-view.showSupertypes",group:"navigation@1",when:"view == references-view.tree && reference-list.hasResult && reference-list.source == typeHierarchy &&  references-view.typeHierarchyMode != supertypes"},{command:"references-view.showSubtypes",group:"navigation@1",when:"view == references-view.tree && reference-list.hasResult && reference-list.source == typeHierarchy &&  references-view.typeHierarchyMode != subtypes"}],"view/item/context":[{command:"references-view.removeReferenceItem",group:"inline",when:"view == references-view.tree && viewItem == file-item || view == references-view.tree && viewItem == reference-item"},{command:"references-view.removeCallItem",group:"inline",when:"view == references-view.tree && viewItem == call-item"},{command:"references-view.removeTypeItem",group:"inline",when:"view == references-view.tree && viewItem == type-item"},{command:"references-view.refind",group:"inline",when:"view == references-view.tree && viewItem == history-item"},{command:"references-view.removeReferenceItem",group:"1",when:"view == references-view.tree && viewItem == file-item || view == references-view.tree && viewItem == reference-item"},{command:"references-view.removeCallItem",group:"1",when:"view == references-view.tree && viewItem == call-item"},{command:"references-view.removeTypeItem",group:"1",when:"view == references-view.tree && viewItem == type-item"},{command:"references-view.refind",group:"1",when:"view == references-view.tree && viewItem == history-item"},{command:"references-view.copy",group:"2@1",when:"view == references-view.tree && viewItem == file-item || view == references-view.tree && viewItem == reference-item"},{command:"references-view.copyPath",group:"2@2",when:"view == references-view.tree && viewItem == file-item"},{command:"references-view.copyAll",group:"2@3",when:"view == references-view.tree && viewItem == file-item || view == references-view.tree && viewItem == reference-item"},{command:"references-view.showOutgoingCalls",group:"1",when:"view == references-view.tree && viewItem == call-item"},{command:"references-view.showIncomingCalls",group:"1",when:"view == references-view.tree && viewItem == call-item"},{command:"references-view.showSupertypes",group:"1",when:"view == references-view.tree && viewItem == type-item"},{command:"references-view.showSubtypes",group:"1",when:"view == references-view.tree && viewItem == type-item"}],commandPalette:[{command:"references-view.removeReferenceItem",when:"never"},{command:"references-view.removeCallItem",when:"never"},{command:"references-view.removeTypeItem",when:"never"},{command:"references-view.copy",when:"never"},{command:"references-view.copyAll",when:"never"},{command:"references-view.copyPath",when:"never"},{command:"references-view.refind",when:"never"},{command:"references-view.findReferences",when:"editorHasReferenceProvider"},{command:"references-view.clear",when:"reference-list.hasResult"},{command:"references-view.clearHistory",when:"reference-list.isActive && !reference-list.hasResult"},{command:"references-view.refresh",when:"reference-list.hasResult"},{command:"references-view.pickFromHistory",when:"reference-list.isActive"},{command:"references-view.next",when:"never"},{command:"references-view.prev",when:"never"}]},keybindings:[{command:"references-view.findReferences",when:"editorHasReferenceProvider",key:"shift+alt+f12"},{command:"references-view.next",when:"reference-list.hasResult",key:"f4"},{command:"references-view.prev",when:"reference-list.hasResult",key:"shift+f4"},{command:"references-view.showCallHierarchy",when:"editorHasCallHierarchyProvider",key:"shift+alt+h"}]}},packageNLS:{displayName:"Reference Search View",description:"Reference Search results as separate, stable view in the sidebar","config.references.preferredLocation":"Controls whether 'Peek References' or 'Find References' is invoked when selecting CodeLens references.","config.references.preferredLocation.peek":"Show references in peek editor.","config.references.preferredLocation.view":"Show references in separate view.","container.title":"References","view.title":"Reference Search Results","cmd.category.references":"References","cmd.references-view.findReferences":"Find All References","cmd.references-view.findImplementations":"Find All Implementations","cmd.references-view.clearHistory":"Clear History","cmd.references-view.clear":"Clear","cmd.references-view.refresh":"Refresh","cmd.references-view.pickFromHistory":"Show History","cmd.references-view.removeReferenceItem":"Dismiss","cmd.references-view.copy":"Copy","cmd.references-view.copyAll":"Copy All","cmd.references-view.copyPath":"Copy Path","cmd.references-view.refind":"Rerun","cmd.references-view.showCallHierarchy":"Show Call Hierarchy","cmd.references-view.showOutgoingCalls":"Show Outgoing Calls","cmd.references-view.showIncomingCalls":"Show Incoming Calls","cmd.references-view.removeCallItem":"Dismiss","cmd.references-view.next":"Go to Next Reference","cmd.references-view.prev":"Go to Previous Reference","cmd.references-view.showTypeHierarchy":"Show Type Hierarchy","cmd.references-view.showSupertypes":"Show Supertypes","cmd.references-view.showSubtypes":"Show Subtypes","cmd.references-view.removeTypeItem":"Dismiss"},readmePath:"references-view/README.md"},{extensionPath:"restructuredtext",packageJSON:{name:"restructuredtext",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin trond-snekvik/vscode-rst syntaxes/rst.tmLanguage.json ./syntaxes/rst.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"restructuredtext",aliases:["reStructuredText"],configuration:"./language-configuration.json",extensions:[".rst"]}],grammars:[{language:"restructuredtext",scopeName:"source.rst",path:"./syntaxes/rst.tmLanguage.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"reStructuredText Language Basics",description:"Provides syntax highlighting in reStructuredText files."}},{extensionPath:"ruby",packageJSON:{name:"ruby",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin Shopify/ruby-lsp vscode/grammars/ruby.cson.json ./syntaxes/ruby.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"ruby",extensions:[".rb",".rbx",".rjs",".gemspec",".rake",".ru",".erb",".podspec",".rbi"],filenames:["rakefile","gemfile","guardfile","podfile","capfile","cheffile","hobofile","vagrantfile","appraisals","rantfile","berksfile","berksfile.lock","thorfile","puppetfile","dangerfile","brewfile","fastfile","appfile","deliverfile","matchfile","scanfile","snapfile","gymfile"],aliases:["Ruby","rb"],firstLine:"^#!\\s*/.*\\bruby\\b",configuration:"./language-configuration.json"}],grammars:[{language:"ruby",scopeName:"source.ruby",path:"./syntaxes/ruby.tmLanguage.json"}],configurationDefaults:{"[ruby]":{"editor.defaultColorDecorators":"never"}}},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Ruby Language Basics",description:"Provides syntax highlighting and bracket matching in Ruby files."}},{extensionPath:"rust",packageJSON:{name:"rust",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ./build/update-grammar.mjs"},categories:["Programming Languages"],contributes:{languages:[{id:"rust",extensions:[".rs"],aliases:["Rust","rust"],configuration:"./language-configuration.json"}],grammars:[{language:"rust",path:"./syntaxes/rust.tmLanguage.json",scopeName:"source.rust"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Rust Language Basics",description:"Provides syntax highlighting and bracket matching in Rust files."}},{extensionPath:"scss",packageJSON:{name:"scss",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin atom/language-sass grammars/scss.cson ./syntaxes/scss.tmLanguage.json grammars/sassdoc.cson ./syntaxes/sassdoc.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"scss",aliases:["SCSS","scss"],extensions:[".scss"],mimetypes:["text/x-scss","text/scss"],configuration:"./language-configuration.json"}],grammars:[{language:"scss",scopeName:"source.css.scss",path:"./syntaxes/scss.tmLanguage.json"},{scopeName:"source.sassdoc",path:"./syntaxes/sassdoc.tmLanguage.json"}],problemMatchers:[{name:"node-sass",label:"Node Sass Compiler",owner:"node-sass",fileLocation:"absolute",pattern:[{regexp:"^{$"},{regexp:'\\s*"status":\\s\\d+,'},{regexp:'\\s*"file":\\s"(.*)",',file:1},{regexp:'\\s*"line":\\s(\\d+),',line:1},{regexp:'\\s*"column":\\s(\\d+),',column:1},{regexp:'\\s*"message":\\s"(.*)",',message:1},{regexp:'\\s*"formatted":\\s(.*)'},{regexp:"^}$"}]}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"SCSS Language Basics",description:"Provides syntax highlighting, bracket matching and folding in SCSS files."}},{extensionPath:"search-result",packageJSON:{name:"search-result",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",icon:"images/icon.png",engines:{vscode:"^1.39.0"},main:"./dist/extension.js",browser:"./dist/browser/extension",activationEvents:["onLanguage:search-result"],capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:!0}},enabledApiProposals:["documentFiltersExclusive"],contributes:{configurationDefaults:{"[search-result]":{"editor.lineNumbers":"off"}},languages:[{id:"search-result",extensions:[".code-search"],aliases:["Search Result"]}],grammars:[{language:"search-result",scopeName:"text.searchResult",path:"./syntaxes/searchResult.tmLanguage.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Search Result",description:"Provides syntax highlighting and language features for tabbed search results."},readmePath:"search-result/README.md"},{extensionPath:"shaderlab",packageJSON:{name:"shaderlab",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin tgjones/shaders-tmLanguage grammars/shaderlab.json ./syntaxes/shaderlab.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"shaderlab",extensions:[".shader"],aliases:["ShaderLab","shaderlab"],configuration:"./language-configuration.json"}],grammars:[{language:"shaderlab",path:"./syntaxes/shaderlab.tmLanguage.json",scopeName:"source.shaderlab"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Shaderlab Language Basics",description:"Provides syntax highlighting and bracket matching in Shaderlab files."}},{extensionPath:"shellscript",packageJSON:{name:"shellscript",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin jeff-hykin/better-shell-syntax autogenerated/shell.tmLanguage.json ./syntaxes/shell-unix-bash.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"shellscript",aliases:["Shell Script","shellscript","bash","fish","sh","zsh","ksh","csh"],extensions:[".sh",".bash",".bashrc",".bash_aliases",".bash_profile",".bash_login",".ebuild",".eclass",".profile",".bash_logout",".xprofile",".xsession",".xsessionrc",".Xsession",".zsh",".zshrc",".zprofile",".zlogin",".zlogout",".zshenv",".zsh-theme",".fish",".ksh",".csh",".cshrc",".tcshrc",".yashrc",".yash_profile"],filenames:["APKBUILD","PKGBUILD",".envrc",".hushlogin","zshrc","zshenv","zlogin","zprofile","zlogout","bashrc_Apple_Terminal","zshrc_Apple_Terminal"],firstLine:"^#!.*\\b(bash|fish|zsh|sh|ksh|dtksh|pdksh|mksh|ash|dash|yash|sh|csh|jcsh|tcsh|itcsh).*|^#\\s*-\\*-[^*]*mode:\\s*shell-script[^*]*-\\*-",configuration:"./language-configuration.json",mimetypes:["text/x-shellscript"]}],grammars:[{language:"shellscript",scopeName:"source.shell",path:"./syntaxes/shell-unix-bash.tmLanguage.json",balancedBracketScopes:["*"],unbalancedBracketScopes:["meta.scope.case-pattern.shell"]}],configurationDefaults:{"[shellscript]":{"files.eol":`
`,"editor.defaultColorDecorators":"never"}}},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Shell Script Language Basics",description:"Provides syntax highlighting and bracket matching in Shell Script files."}},{extensionPath:"simple-browser",packageJSON:{name:"simple-browser",displayName:"%displayName%",description:"%description%",enabledApiProposals:["externalUriOpener"],version:"10.0.0",icon:"media/icon.png",publisher:"vscode",license:"MIT",aiKey:"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",engines:{vscode:"^1.70.0"},main:"./dist/extension",browser:"./dist/browser/extension",categories:["Other"],extensionKind:["ui","workspace"],activationEvents:["onCommand:simpleBrowser.api.open","onOpenExternalUri:http","onOpenExternalUri:https","onWebviewPanel:simpleBrowser.view"],capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:!0}},contributes:{commands:[{command:"simpleBrowser.show",title:"Show",category:"Simple Browser"}],menus:{commandPalette:[{command:"simpleBrowser.show",when:"isWeb"}]},configuration:[{title:"Simple Browser",properties:{"simpleBrowser.focusLockIndicator.enabled":{type:"boolean",default:!0,title:"Focus Lock Indicator Enabled",description:"%configuration.focusLockIndicator.enabled.description%"}}}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Simple Browser",description:"A very basic built-in webview for displaying web content.","configuration.focusLockIndicator.enabled.description":"Enable/disable the floating indicator that shows when focused in the simple browser."},readmePath:"simple-browser/README.md"},{extensionPath:"sql",packageJSON:{name:"sql",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ./build/update-grammar.mjs"},categories:["Programming Languages"],contributes:{languages:[{id:"sql",extensions:[".sql",".dsql"],aliases:["MS SQL","T-SQL"],configuration:"./language-configuration.json"}],grammars:[{language:"sql",scopeName:"source.sql",path:"./syntaxes/sql.tmLanguage.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"SQL Language Basics",description:"Provides syntax highlighting and bracket matching in SQL files."}},{extensionPath:"swift",packageJSON:{name:"swift",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin jtbandes/swift-tmlanguage Swift.tmLanguage.json ./syntaxes/swift.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"swift",aliases:["Swift","swift"],extensions:[".swift"],configuration:"./language-configuration.json"}],grammars:[{language:"swift",scopeName:"source.swift",path:"./syntaxes/swift.tmLanguage.json"}],snippets:[{language:"swift",path:"./snippets/swift.code-snippets"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Swift Language Basics",description:"Provides snippets, syntax highlighting and bracket matching in Swift files."}},{extensionPath:"theme-abyss",packageJSON:{name:"theme-abyss",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},categories:["Themes"],contributes:{themes:[{id:"Abyss",label:"%themeLabel%",uiTheme:"vs-dark",path:"./themes/abyss-color-theme.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Abyss Theme",description:"Abyss theme for Visual Studio Code",themeLabel:"Abyss"}},{extensionPath:"theme-defaults",packageJSON:{name:"theme-defaults",displayName:"%displayName%",description:"%description%",categories:["Themes"],version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},contributes:{themes:[{id:"Light 2026",label:"%light2026ThemeLabel%",uiTheme:"vs",path:"./themes/2026-light.json"},{id:"Dark 2026",label:"%dark2026ThemeLabel%",uiTheme:"vs-dark",path:"./themes/2026-dark.json"},{id:"Dark+",label:"%darkPlusColorThemeLabel%",uiTheme:"vs-dark",path:"./themes/dark_plus.json"},{id:"Dark Modern",label:"%darkModernThemeLabel%",uiTheme:"vs-dark",path:"./themes/dark_modern.json"},{id:"Light+",label:"%lightPlusColorThemeLabel%",uiTheme:"vs",path:"./themes/light_plus.json"},{id:"Light Modern",label:"%lightModernThemeLabel%",uiTheme:"vs",path:"./themes/light_modern.json"},{id:"Visual Studio Dark",label:"%darkColorThemeLabel%",uiTheme:"vs-dark",path:"./themes/dark_vs.json"},{id:"Visual Studio Light",label:"%lightColorThemeLabel%",uiTheme:"vs",path:"./themes/light_vs.json"},{id:"Default High Contrast",label:"%hcColorThemeLabel%",uiTheme:"hc-black",path:"./themes/hc_black.json"},{id:"Default High Contrast Light",label:"%lightHcColorThemeLabel%",uiTheme:"hc-light",path:"./themes/hc_light.json"}],iconThemes:[{id:"vs-minimal",label:"%minimalIconThemeLabel%",path:"./fileicons/vs_minimal-icon-theme.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Default Themes",description:"The default Visual Studio light and dark themes",light2026ThemeLabel:"Light 2026",dark2026ThemeLabel:"Dark 2026",darkPlusColorThemeLabel:"Dark+",darkModernThemeLabel:"Dark Modern",lightPlusColorThemeLabel:"Light+",lightModernThemeLabel:"Light Modern",darkColorThemeLabel:"Dark (Visual Studio)",lightColorThemeLabel:"Light (Visual Studio)",hcColorThemeLabel:"Dark High Contrast",lightHcColorThemeLabel:"Light High Contrast",minimalIconThemeLabel:"Minimal (Visual Studio Code)"}},{extensionPath:"theme-kimbie-dark",packageJSON:{name:"theme-kimbie-dark",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},categories:["Themes"],contributes:{themes:[{id:"Kimbie Dark",label:"%themeLabel%",uiTheme:"vs-dark",path:"./themes/kimbie-dark-color-theme.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Kimbie Dark Theme",description:"Kimbie dark theme for Visual Studio Code",themeLabel:"Kimbie Dark"}},{extensionPath:"theme-monokai",packageJSON:{name:"theme-monokai",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},categories:["Themes"],contributes:{themes:[{id:"Monokai",label:"%themeLabel%",uiTheme:"vs-dark",path:"./themes/monokai-color-theme.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Monokai Theme",description:"Monokai theme for Visual Studio Code",themeLabel:"Monokai"}},{extensionPath:"theme-monokai-dimmed",packageJSON:{name:"theme-monokai-dimmed",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},categories:["Themes"],contributes:{themes:[{id:"Monokai Dimmed",label:"%themeLabel%",uiTheme:"vs-dark",path:"./themes/dimmed-monokai-color-theme.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Monokai Dimmed Theme",description:"Monokai dimmed theme for Visual Studio Code",themeLabel:"Monokai Dimmed"}},{extensionPath:"theme-quietlight",packageJSON:{name:"theme-quietlight",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},categories:["Themes"],contributes:{themes:[{id:"Quiet Light",label:"%themeLabel%",uiTheme:"vs",path:"./themes/quietlight-color-theme.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Quiet Light Theme",description:"Quiet light theme for Visual Studio Code",themeLabel:"Quiet Light"}},{extensionPath:"theme-red",packageJSON:{name:"theme-red",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},categories:["Themes"],contributes:{themes:[{id:"Red",label:"%themeLabel%",uiTheme:"vs-dark",path:"./themes/Red-color-theme.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Red Theme",description:"Red theme for Visual Studio Code",themeLabel:"Red"}},{extensionPath:"theme-seti",packageJSON:{name:"vscode-theme-seti",private:!0,version:"10.0.0",displayName:"%displayName%",description:"%description%",publisher:"vscode",license:"MIT",icon:"icons/seti-circular-128x128.png",scripts:{update:"node ./build/update-icon-theme.js"},engines:{vscode:"*"},categories:["Themes"],contributes:{iconThemes:[{id:"vs-seti",label:"%themeLabel%",path:"./icons/vs-seti-icon-theme.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Seti File Icon Theme",description:"A file icon theme made out of the Seti UI file icons",themeLabel:"Seti (Visual Studio Code)"},readmePath:"theme-seti/README.md"},{extensionPath:"theme-solarized-dark",packageJSON:{name:"theme-solarized-dark",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},categories:["Themes"],contributes:{themes:[{id:"Solarized Dark",label:"%themeLabel%",uiTheme:"vs-dark",path:"./themes/solarized-dark-color-theme.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Solarized Dark Theme",description:"Solarized dark theme for Visual Studio Code",themeLabel:"Solarized Dark"}},{extensionPath:"theme-solarized-light",packageJSON:{name:"theme-solarized-light",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},categories:["Themes"],contributes:{themes:[{id:"Solarized Light",label:"%themeLabel%",uiTheme:"vs",path:"./themes/solarized-light-color-theme.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Solarized Light Theme",description:"Solarized light theme for Visual Studio Code",themeLabel:"Solarized Light"}},{extensionPath:"theme-tomorrow-night-blue",packageJSON:{name:"theme-tomorrow-night-blue",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},categories:["Themes"],contributes:{themes:[{id:"Tomorrow Night Blue",label:"%themeLabel%",uiTheme:"vs-dark",path:"./themes/tomorrow-night-blue-color-theme.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Tomorrow Night Blue Theme",description:"Tomorrow night blue theme for Visual Studio Code",themeLabel:"Tomorrow Night Blue"}},{extensionPath:"typescript-basics",packageJSON:{name:"typescript",description:"%description%",displayName:"%displayName%",version:"10.0.0",author:"vscode",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ./build/update-grammars.mjs"},categories:["Programming Languages"],contributes:{languages:[{id:"typescript",aliases:["TypeScript","ts","typescript"],extensions:[".ts",".cts",".mts"],firstLine:"^#!.*\\b(deno|bun|ts-node)\\b",configuration:"./language-configuration.json"},{id:"typescriptreact",aliases:["TypeScript JSX","TypeScript React","tsx"],extensions:[".tsx"],configuration:"./language-configuration.json"},{id:"jsonc",filenames:["tsconfig.json","jsconfig.json"],filenamePatterns:["tsconfig.*.json","jsconfig.*.json","tsconfig-*.json","jsconfig-*.json"]},{id:"json",extensions:[".tsbuildinfo"]}],grammars:[{language:"typescript",scopeName:"source.ts",path:"./syntaxes/TypeScript.tmLanguage.json",unbalancedBracketScopes:["keyword.operator.relational","storage.type.function.arrow","keyword.operator.bitwise.shift","meta.brace.angle","punctuation.definition.tag","keyword.operator.assignment.compound.bitwise.ts"],tokenTypes:{"punctuation.definition.template-expression":"other","entity.name.type.instance.jsdoc":"other","entity.name.function.tagged-template":"other","meta.import string.quoted":"other","variable.other.jsdoc":"other"}},{language:"typescriptreact",scopeName:"source.tsx",path:"./syntaxes/TypeScriptReact.tmLanguage.json",unbalancedBracketScopes:["keyword.operator.relational","storage.type.function.arrow","keyword.operator.bitwise.shift","punctuation.definition.tag","keyword.operator.assignment.compound.bitwise.ts"],embeddedLanguages:{"meta.tag.tsx":"jsx-tags","meta.tag.without-attributes.tsx":"jsx-tags","meta.tag.attributes.tsx":"typescriptreact","meta.embedded.expression.tsx":"typescriptreact"},tokenTypes:{"punctuation.definition.template-expression":"other","entity.name.type.instance.jsdoc":"other","entity.name.function.tagged-template":"other","meta.import string.quoted":"other","variable.other.jsdoc":"other"}},{scopeName:"documentation.injection.ts",path:"./syntaxes/jsdoc.ts.injection.tmLanguage.json",injectTo:["source.ts","source.tsx"]},{scopeName:"documentation.injection.js.jsx",path:"./syntaxes/jsdoc.js.injection.tmLanguage.json",injectTo:["source.js","source.js.jsx"]}],semanticTokenScopes:[{language:"typescript",scopes:{property:["variable.other.property.ts"],"property.readonly":["variable.other.constant.property.ts"],variable:["variable.other.readwrite.ts"],"variable.readonly":["variable.other.constant.object.ts"],function:["entity.name.function.ts"],namespace:["entity.name.type.module.ts"],"variable.defaultLibrary":["support.variable.ts"],"function.defaultLibrary":["support.function.ts"]}},{language:"typescriptreact",scopes:{property:["variable.other.property.tsx"],"property.readonly":["variable.other.constant.property.tsx"],variable:["variable.other.readwrite.tsx"],"variable.readonly":["variable.other.constant.object.tsx"],function:["entity.name.function.tsx"],namespace:["entity.name.type.module.tsx"],"variable.defaultLibrary":["support.variable.tsx"],"function.defaultLibrary":["support.function.tsx"]}}],snippets:[{language:"typescript",path:"./snippets/typescript.code-snippets"},{language:"typescriptreact",path:"./snippets/typescript.code-snippets"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"TypeScript Language Basics",description:"Provides snippets, syntax highlighting, bracket matching and folding in TypeScript files."}},{extensionPath:"typescript-language-features",packageJSON:{name:"typescript-language-features",description:"%description%",displayName:"%displayName%",version:"10.0.0",author:"vscode",publisher:"vscode",license:"MIT",aiKey:"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",enabledApiProposals:["workspaceTrust","multiDocumentHighlightProvider","codeActionAI","codeActionRanges","editorHoverVerbosityLevel"],capabilities:{virtualWorkspaces:{supported:"limited",description:"%virtualWorkspaces%"},untrustedWorkspaces:{supported:"limited",description:"%workspaceTrust%",restrictedConfigurations:["typescript.tsdk","js/ts.tsdk.path","typescript.tsserver.pluginPaths","js/ts.tsserver.pluginPaths","typescript.npm","js/ts.tsserver.npm.path","typescript.tsserver.nodePath","js/ts.tsserver.node.path","js/ts.tsserver.diagnosticDir","js/ts.tsserver.heapProfile"]}},engines:{vscode:"^1.30.0"},icon:"media/icon.png",categories:["Programming Languages"],activationEvents:["onLanguage:javascript","onLanguage:javascriptreact","onLanguage:typescript","onLanguage:typescriptreact","onLanguage:jsx-tags","onCommand:typescript.tsserverRequest","onCommand:_typescript.configurePlugin","onCommand:_typescript.learnMoreAboutRefactorings","onCommand:typescript.fileReferences","onTaskType:typescript","onLanguage:jsonc","onWalkthrough:nodejsWelcome"],main:"./dist/extension",browser:"./dist/browser/extension",contributes:{jsonValidation:[{fileMatch:"package.json",url:"./schemas/package.schema.json"},{fileMatch:"tsconfig.json",url:"https://www.schemastore.org/tsconfig"},{fileMatch:"tsconfig.json",url:"./schemas/tsconfig.schema.json"},{fileMatch:"tsconfig.*.json",url:"https://www.schemastore.org/tsconfig"},{fileMatch:"tsconfig-*.json",url:"./schemas/tsconfig.schema.json"},{fileMatch:"tsconfig-*.json",url:"https://www.schemastore.org/tsconfig"},{fileMatch:"tsconfig.*.json",url:"./schemas/tsconfig.schema.json"},{fileMatch:"typings.json",url:"https://www.schemastore.org/typings"},{fileMatch:".bowerrc",url:"https://www.schemastore.org/bowerrc"},{fileMatch:".babelrc",url:"https://www.schemastore.org/babelrc"},{fileMatch:".babelrc.json",url:"https://www.schemastore.org/babelrc"},{fileMatch:"babel.config.json",url:"https://www.schemastore.org/babelrc"},{fileMatch:"jsconfig.json",url:"https://www.schemastore.org/jsconfig"},{fileMatch:"jsconfig.json",url:"./schemas/jsconfig.schema.json"},{fileMatch:"jsconfig.*.json",url:"https://www.schemastore.org/jsconfig"},{fileMatch:"jsconfig.*.json",url:"./schemas/jsconfig.schema.json"},{fileMatch:".swcrc",url:"https://swc.rs/schema.json"},{fileMatch:"typedoc.json",url:"https://typedoc.org/schema.json"}],configuration:[{type:"object",properties:{"js/ts.tsdk.path":{type:"string",markdownDescription:"%typescript.tsdk.desc%",scope:"window",order:1,keywords:["TypeScript"]},"typescript.tsdk":{type:"string",markdownDescription:"%typescript.tsdk.desc%",markdownDeprecationMessage:"%typescript.tsdk.unifiedDeprecationMessage%",scope:"window",order:1},"js/ts.experimental.useTsgo":{type:"boolean",default:!1,markdownDescription:"%typescript.useTsgo%",scope:"window",order:2,keywords:["TypeScript","experimental"]},"typescript.experimental.useTsgo":{type:"boolean",default:!1,markdownDescription:"%typescript.useTsgo%",markdownDeprecationMessage:"%typescript.useTsgo.unifiedDeprecationMessage%",scope:"window",order:2,keywords:["experimental"]},"js/ts.locale":{type:"string",default:"auto",enum:["auto","de","es","en","fr","it","ja","ko","ru","zh-CN","zh-TW"],enumDescriptions:["%typescript.locale.auto%","Deutsch","espa\xF1ol","English","fran\xE7ais","italiano","\u65E5\u672C\u8A9E","\uD55C\uAD6D\uC5B4","\u0440\u0443\u0441\u0441\u043A\u0438\u0439","\u4E2D\u6587(\u7B80\u4F53)","\u4E2D\u6587(\u7E41\u9AD4)"],markdownDescription:"%typescript.locale%",scope:"window",order:3,keywords:["TypeScript"]},"typescript.locale":{type:"string",default:"auto",enum:["auto","de","es","en","fr","it","ja","ko","ru","zh-CN","zh-TW"],enumDescriptions:["%typescript.locale.auto%","Deutsch","espa\xF1ol","English","fran\xE7ais","italiano","\u65E5\u672C\u8A9E","\uD55C\uAD6D\uC5B4","\u0440\u0443\u0441\u0441\u043A\u0438\u0439","\u4E2D\u6587(\u7B80\u4F53)","\u4E2D\u6587(\u7E41\u9AD4)"],markdownDescription:"%typescript.locale%",markdownDeprecationMessage:"%typescript.locale.unifiedDeprecationMessage%",scope:"window",order:3},"js/ts.tsc.autoDetect":{type:"string",default:"on",enum:["on","off","build","watch"],markdownEnumDescriptions:["%typescript.tsc.autoDetect.on%","%typescript.tsc.autoDetect.off%","%typescript.tsc.autoDetect.build%","%typescript.tsc.autoDetect.watch%"],description:"%typescript.tsc.autoDetect%",scope:"window",order:4,keywords:["TypeScript"]},"typescript.tsc.autoDetect":{type:"string",default:"on",enum:["on","off","build","watch"],markdownEnumDescriptions:["%typescript.tsc.autoDetect.on%","%typescript.tsc.autoDetect.off%","%typescript.tsc.autoDetect.build%","%typescript.tsc.autoDetect.watch%"],description:"%typescript.tsc.autoDetect%",markdownDeprecationMessage:"%typescript.tsc.autoDetect.unifiedDeprecationMessage%",scope:"window",order:4}}},{type:"object",title:"%configuration.preferences%",properties:{"js/ts.preferences.quoteStyle":{type:"string",enum:["auto","single","double"],default:"auto",markdownDescription:"%typescript.preferences.quoteStyle%",markdownEnumDescriptions:["%typescript.preferences.quoteStyle.auto%","%typescript.preferences.quoteStyle.single%","%typescript.preferences.quoteStyle.double%"],scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.preferences.quoteStyle":{type:"string",enum:["auto","single","double"],default:"auto",markdownDescription:"%typescript.preferences.quoteStyle%",markdownEnumDescriptions:["%typescript.preferences.quoteStyle.auto%","%typescript.preferences.quoteStyle.single%","%typescript.preferences.quoteStyle.double%"],markdownDeprecationMessage:"%configuration.preferences.quoteStyle.unifiedDeprecationMessage%",scope:"language-overridable"},"typescript.preferences.quoteStyle":{type:"string",enum:["auto","single","double"],default:"auto",markdownDescription:"%typescript.preferences.quoteStyle%",markdownEnumDescriptions:["%typescript.preferences.quoteStyle.auto%","%typescript.preferences.quoteStyle.single%","%typescript.preferences.quoteStyle.double%"],markdownDeprecationMessage:"%configuration.preferences.quoteStyle.unifiedDeprecationMessage%",scope:"language-overridable"},"js/ts.preferences.importModuleSpecifier":{type:"string",enum:["shortest","relative","non-relative","project-relative"],markdownEnumDescriptions:["%typescript.preferences.importModuleSpecifier.shortest%","%typescript.preferences.importModuleSpecifier.relative%","%typescript.preferences.importModuleSpecifier.nonRelative%","%typescript.preferences.importModuleSpecifier.projectRelative%"],default:"shortest",description:"%typescript.preferences.importModuleSpecifier%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.preferences.importModuleSpecifier":{type:"string",enum:["shortest","relative","non-relative","project-relative"],markdownEnumDescriptions:["%typescript.preferences.importModuleSpecifier.shortest%","%typescript.preferences.importModuleSpecifier.relative%","%typescript.preferences.importModuleSpecifier.nonRelative%","%typescript.preferences.importModuleSpecifier.projectRelative%"],default:"shortest",description:"%typescript.preferences.importModuleSpecifier%",markdownDeprecationMessage:"%configuration.preferences.importModuleSpecifier.unifiedDeprecationMessage%",scope:"language-overridable"},"typescript.preferences.importModuleSpecifier":{type:"string",enum:["shortest","relative","non-relative","project-relative"],markdownEnumDescriptions:["%typescript.preferences.importModuleSpecifier.shortest%","%typescript.preferences.importModuleSpecifier.relative%","%typescript.preferences.importModuleSpecifier.nonRelative%","%typescript.preferences.importModuleSpecifier.projectRelative%"],default:"shortest",description:"%typescript.preferences.importModuleSpecifier%",markdownDeprecationMessage:"%configuration.preferences.importModuleSpecifier.unifiedDeprecationMessage%",scope:"language-overridable"},"js/ts.preferences.importModuleSpecifierEnding":{type:"string",enum:["auto","minimal","index","js"],enumItemLabels:[null,null,null,"%typescript.preferences.importModuleSpecifierEnding.label.js%"],markdownEnumDescriptions:["%typescript.preferences.importModuleSpecifierEnding.auto%","%typescript.preferences.importModuleSpecifierEnding.minimal%","%typescript.preferences.importModuleSpecifierEnding.index%","%typescript.preferences.importModuleSpecifierEnding.js%"],default:"auto",description:"%typescript.preferences.importModuleSpecifierEnding%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.preferences.importModuleSpecifierEnding":{type:"string",enum:["auto","minimal","index","js"],enumItemLabels:[null,null,null,"%typescript.preferences.importModuleSpecifierEnding.label.js%"],markdownEnumDescriptions:["%typescript.preferences.importModuleSpecifierEnding.auto%","%typescript.preferences.importModuleSpecifierEnding.minimal%","%typescript.preferences.importModuleSpecifierEnding.index%","%typescript.preferences.importModuleSpecifierEnding.js%"],default:"auto",description:"%typescript.preferences.importModuleSpecifierEnding%",markdownDeprecationMessage:"%configuration.preferences.importModuleSpecifierEnding.unifiedDeprecationMessage%",scope:"language-overridable"},"typescript.preferences.importModuleSpecifierEnding":{type:"string",enum:["auto","minimal","index","js"],enumItemLabels:[null,null,null,"%typescript.preferences.importModuleSpecifierEnding.label.js%"],markdownEnumDescriptions:["%typescript.preferences.importModuleSpecifierEnding.auto%","%typescript.preferences.importModuleSpecifierEnding.minimal%","%typescript.preferences.importModuleSpecifierEnding.index%","%typescript.preferences.importModuleSpecifierEnding.js%"],default:"auto",description:"%typescript.preferences.importModuleSpecifierEnding%",markdownDeprecationMessage:"%configuration.preferences.importModuleSpecifierEnding.unifiedDeprecationMessage%",scope:"language-overridable"},"js/ts.preferences.jsxAttributeCompletionStyle":{type:"string",enum:["auto","braces","none"],markdownEnumDescriptions:["%configuration.preferences.jsxAttributeCompletionStyle.auto%","%typescript.preferences.jsxAttributeCompletionStyle.braces%","%typescript.preferences.jsxAttributeCompletionStyle.none%"],default:"auto",description:"%typescript.preferences.jsxAttributeCompletionStyle%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.preferences.jsxAttributeCompletionStyle":{type:"string",enum:["auto","braces","none"],markdownEnumDescriptions:["%javascript.preferences.jsxAttributeCompletionStyle.auto%","%typescript.preferences.jsxAttributeCompletionStyle.braces%","%typescript.preferences.jsxAttributeCompletionStyle.none%"],default:"auto",description:"%typescript.preferences.jsxAttributeCompletionStyle%",markdownDeprecationMessage:"%configuration.preferences.jsxAttributeCompletionStyle.unifiedDeprecationMessage%",scope:"language-overridable"},"typescript.preferences.jsxAttributeCompletionStyle":{type:"string",enum:["auto","braces","none"],markdownEnumDescriptions:["%typescript.preferences.jsxAttributeCompletionStyle.auto%","%typescript.preferences.jsxAttributeCompletionStyle.braces%","%typescript.preferences.jsxAttributeCompletionStyle.none%"],default:"auto",description:"%typescript.preferences.jsxAttributeCompletionStyle%",markdownDeprecationMessage:"%configuration.preferences.jsxAttributeCompletionStyle.unifiedDeprecationMessage%",scope:"language-overridable"},"js/ts.preferences.includePackageJsonAutoImports":{type:"string",enum:["auto","on","off"],enumDescriptions:["%typescript.preferences.includePackageJsonAutoImports.auto%","%typescript.preferences.includePackageJsonAutoImports.on%","%typescript.preferences.includePackageJsonAutoImports.off%"],default:"auto",markdownDescription:"%typescript.preferences.includePackageJsonAutoImports%",scope:"window",keywords:["TypeScript"]},"typescript.preferences.includePackageJsonAutoImports":{type:"string",enum:["auto","on","off"],enumDescriptions:["%typescript.preferences.includePackageJsonAutoImports.auto%","%typescript.preferences.includePackageJsonAutoImports.on%","%typescript.preferences.includePackageJsonAutoImports.off%"],default:"auto",markdownDescription:"%typescript.preferences.includePackageJsonAutoImports%",markdownDeprecationMessage:"%configuration.preferences.includePackageJsonAutoImports.unifiedDeprecationMessage%",scope:"window"},"js/ts.preferences.autoImportFileExcludePatterns":{type:"array",items:{type:"string"},markdownDescription:"%typescript.preferences.autoImportFileExcludePatterns%",scope:"resource",keywords:["JavaScript","TypeScript"]},"javascript.preferences.autoImportFileExcludePatterns":{type:"array",items:{type:"string"},markdownDescription:"%typescript.preferences.autoImportFileExcludePatterns%",markdownDeprecationMessage:"%configuration.preferences.autoImportFileExcludePatterns.unifiedDeprecationMessage%",scope:"resource"},"typescript.preferences.autoImportFileExcludePatterns":{type:"array",items:{type:"string"},markdownDescription:"%typescript.preferences.autoImportFileExcludePatterns%",markdownDeprecationMessage:"%configuration.preferences.autoImportFileExcludePatterns.unifiedDeprecationMessage%",scope:"resource"},"js/ts.preferences.autoImportSpecifierExcludeRegexes":{type:"array",items:{type:"string"},markdownDescription:"%typescript.preferences.autoImportSpecifierExcludeRegexes%",scope:"resource",keywords:["JavaScript","TypeScript"]},"javascript.preferences.autoImportSpecifierExcludeRegexes":{type:"array",items:{type:"string"},markdownDescription:"%typescript.preferences.autoImportSpecifierExcludeRegexes%",markdownDeprecationMessage:"%configuration.preferences.autoImportSpecifierExcludeRegexes.unifiedDeprecationMessage%",scope:"resource"},"typescript.preferences.autoImportSpecifierExcludeRegexes":{type:"array",items:{type:"string"},markdownDescription:"%typescript.preferences.autoImportSpecifierExcludeRegexes%",markdownDeprecationMessage:"%configuration.preferences.autoImportSpecifierExcludeRegexes.unifiedDeprecationMessage%",scope:"resource"},"js/ts.preferences.preferTypeOnlyAutoImports":{type:"boolean",default:!1,markdownDescription:"%typescript.preferences.preferTypeOnlyAutoImports%",scope:"resource",keywords:["TypeScript"]},"typescript.preferences.preferTypeOnlyAutoImports":{type:"boolean",default:!1,markdownDescription:"%typescript.preferences.preferTypeOnlyAutoImports%",markdownDeprecationMessage:"%configuration.preferences.preferTypeOnlyAutoImports.unifiedDeprecationMessage%",scope:"resource"},"js/ts.preferences.useAliasesForRenames":{type:"boolean",default:!0,description:"%typescript.preferences.useAliasesForRenames%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.preferences.useAliasesForRenames":{type:"boolean",default:!0,description:"%typescript.preferences.useAliasesForRenames%",markdownDeprecationMessage:"%configuration.preferences.useAliasesForRenames.unifiedDeprecationMessage%",scope:"language-overridable"},"typescript.preferences.useAliasesForRenames":{type:"boolean",default:!0,description:"%typescript.preferences.useAliasesForRenames%",markdownDeprecationMessage:"%configuration.preferences.useAliasesForRenames.unifiedDeprecationMessage%",scope:"language-overridable"},"js/ts.preferences.renameMatchingJsxTags":{type:"boolean",default:!0,description:"%typescript.preferences.renameMatchingJsxTags%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.preferences.renameMatchingJsxTags":{type:"boolean",default:!0,description:"%typescript.preferences.renameMatchingJsxTags%",markdownDeprecationMessage:"%configuration.preferences.renameMatchingJsxTags.unifiedDeprecationMessage%",scope:"language-overridable"},"typescript.preferences.renameMatchingJsxTags":{type:"boolean",default:!0,description:"%typescript.preferences.renameMatchingJsxTags%",markdownDeprecationMessage:"%configuration.preferences.renameMatchingJsxTags.unifiedDeprecationMessage%",scope:"language-overridable"},"js/ts.preferences.organizeImports":{type:"object",markdownDescription:"%typescript.preferences.organizeImports%",properties:{caseSensitivity:{type:"string",markdownDescription:"%typescript.preferences.organizeImports.caseSensitivity%",enum:["auto","caseInsensitive","caseSensitive"],markdownEnumDescriptions:["%typescript.preferences.organizeImports.caseSensitivity.auto%","%typescript.preferences.organizeImports.caseSensitivity.insensitive%","%typescript.preferences.organizeImports.caseSensitivity.sensitive%"],default:"auto"},typeOrder:{type:"string",markdownDescription:"%typescript.preferences.organizeImports.typeOrder%",enum:["auto","last","inline","first"],default:"auto",markdownEnumDescriptions:["%typescript.preferences.organizeImports.typeOrder.auto%","%typescript.preferences.organizeImports.typeOrder.last%","%typescript.preferences.organizeImports.typeOrder.inline%","%typescript.preferences.organizeImports.typeOrder.first%"]},unicodeCollation:{type:"string",markdownDescription:"%typescript.preferences.organizeImports.unicodeCollation%",enum:["ordinal","unicode"],markdownEnumDescriptions:["%typescript.preferences.organizeImports.unicodeCollation.ordinal%","%typescript.preferences.organizeImports.unicodeCollation.unicode%"],default:"ordinal"},locale:{type:"string",markdownDescription:"%typescript.preferences.organizeImports.locale%"},numericCollation:{type:"boolean",markdownDescription:"%typescript.preferences.organizeImports.numericCollation%"},accentCollation:{type:"boolean",markdownDescription:"%typescript.preferences.organizeImports.accentCollation%"},caseFirst:{type:"string",markdownDescription:"%typescript.preferences.organizeImports.caseFirst%",enum:["default","upper","lower"],markdownEnumDescriptions:["%typescript.preferences.organizeImports.caseFirst.default%","%typescript.preferences.organizeImports.caseFirst.upper%","%typescript.preferences.organizeImports.caseFirst.lower%"],default:"default"}},keywords:["JavaScript","TypeScript"]},"javascript.preferences.organizeImports":{type:"object",markdownDescription:"%typescript.preferences.organizeImports%",markdownDeprecationMessage:"%configuration.preferences.organizeImports.unifiedDeprecationMessage%",properties:{caseSensitivity:{type:"string",markdownDescription:"%typescript.preferences.organizeImports.caseSensitivity%",enum:["auto","caseInsensitive","caseSensitive"],markdownEnumDescriptions:["%typescript.preferences.organizeImports.caseSensitivity.auto%","%typescript.preferences.organizeImports.caseSensitivity.insensitive%","%typescript.preferences.organizeImports.caseSensitivity.sensitive%"],default:"auto"},typeOrder:{type:"string",markdownDescription:"%typescript.preferences.organizeImports.typeOrder%",enum:["auto","last","inline","first"],default:"auto",markdownEnumDescriptions:["%typescript.preferences.organizeImports.typeOrder.auto%","%typescript.preferences.organizeImports.typeOrder.last%","%typescript.preferences.organizeImports.typeOrder.inline%","%typescript.preferences.organizeImports.typeOrder.first%"]},unicodeCollation:{type:"string",markdownDescription:"%typescript.preferences.organizeImports.unicodeCollation%",enum:["ordinal","unicode"],markdownEnumDescriptions:["%typescript.preferences.organizeImports.unicodeCollation.ordinal%","%typescript.preferences.organizeImports.unicodeCollation.unicode%"],default:"ordinal"},locale:{type:"string",markdownDescription:"%typescript.preferences.organizeImports.locale%"},numericCollation:{type:"boolean",markdownDescription:"%typescript.preferences.organizeImports.numericCollation%"},accentCollation:{type:"boolean",markdownDescription:"%typescript.preferences.organizeImports.accentCollation%"},caseFirst:{type:"string",markdownDescription:"%typescript.preferences.organizeImports.caseFirst%",enum:["default","upper","lower"],markdownEnumDescriptions:["%typescript.preferences.organizeImports.caseFirst.default%","%typescript.preferences.organizeImports.caseFirst.upper%","%typescript.preferences.organizeImports.caseFirst.lower%"],default:"default"}}},"typescript.preferences.organizeImports":{type:"object",markdownDescription:"%typescript.preferences.organizeImports%",markdownDeprecationMessage:"%configuration.preferences.organizeImports.unifiedDeprecationMessage%",properties:{caseSensitivity:{type:"string",markdownDescription:"%typescript.preferences.organizeImports.caseSensitivity%",enum:["auto","caseInsensitive","caseSensitive"],markdownEnumDescriptions:["%typescript.preferences.organizeImports.caseSensitivity.auto%","%typescript.preferences.organizeImports.caseSensitivity.insensitive","%typescript.preferences.organizeImports.caseSensitivity.sensitive%"],default:"auto"},typeOrder:{type:"string",markdownDescription:"%typescript.preferences.organizeImports.typeOrder%",enum:["auto","last","inline","first"],default:"auto",markdownEnumDescriptions:["%typescript.preferences.organizeImports.typeOrder.auto%","%typescript.preferences.organizeImports.typeOrder.last%","%typescript.preferences.organizeImports.typeOrder.inline%","%typescript.preferences.organizeImports.typeOrder.first%"]},unicodeCollation:{type:"string",markdownDescription:"%typescript.preferences.organizeImports.unicodeCollation%",enum:["ordinal","unicode"],markdownEnumDescriptions:["%typescript.preferences.organizeImports.unicodeCollation.ordinal%","%typescript.preferences.organizeImports.unicodeCollation.unicode%"],default:"ordinal"},locale:{type:"string",markdownDescription:"%typescript.preferences.organizeImports.locale%"},numericCollation:{type:"boolean",markdownDescription:"%typescript.preferences.organizeImports.numericCollation%"},accentCollation:{type:"boolean",markdownDescription:"%typescript.preferences.organizeImports.accentCollation%"},caseFirst:{type:"string",markdownDescription:"%typescript.preferences.organizeImports.caseFirst%",enum:["default","upper","lower"],markdownEnumDescriptions:["%typescript.preferences.organizeImports.caseFirst.default%","%typescript.preferences.organizeImports.caseFirst.upper%","%typescript.preferences.organizeImports.caseFirst.lower%"],default:"default"}}}}},{type:"object",title:"%configuration.format%",properties:{"js/ts.format.enabled":{type:"boolean",default:!0,description:"%format.enable%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.enable":{type:"boolean",default:!0,description:"%javascript.format.enable%",markdownDeprecationMessage:"%configuration.format.enable.unifiedDeprecationMessage%",scope:"window"},"typescript.format.enable":{type:"boolean",default:!0,description:"%typescript.format.enable%",markdownDeprecationMessage:"%configuration.format.enable.unifiedDeprecationMessage%",scope:"window"},"js/ts.format.insertSpaceAfterCommaDelimiter":{type:"boolean",default:!0,description:"%format.insertSpaceAfterCommaDelimiter%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.insertSpaceAfterCommaDelimiter":{type:"boolean",default:!0,description:"%format.insertSpaceAfterCommaDelimiter%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterCommaDelimiter.unifiedDeprecationMessage%",scope:"resource"},"typescript.format.insertSpaceAfterCommaDelimiter":{type:"boolean",default:!0,description:"%format.insertSpaceAfterCommaDelimiter%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterCommaDelimiter.unifiedDeprecationMessage%",scope:"resource"},"js/ts.format.insertSpaceAfterConstructor":{type:"boolean",default:!1,description:"%format.insertSpaceAfterConstructor%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.insertSpaceAfterConstructor":{type:"boolean",default:!1,description:"%format.insertSpaceAfterConstructor%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterConstructor.unifiedDeprecationMessage%",scope:"resource"},"typescript.format.insertSpaceAfterConstructor":{type:"boolean",default:!1,description:"%format.insertSpaceAfterConstructor%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterConstructor.unifiedDeprecationMessage%",scope:"resource"},"js/ts.format.insertSpaceAfterSemicolonInForStatements":{type:"boolean",default:!0,description:"%format.insertSpaceAfterSemicolonInForStatements%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.insertSpaceAfterSemicolonInForStatements":{type:"boolean",default:!0,description:"%format.insertSpaceAfterSemicolonInForStatements%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterSemicolonInForStatements.unifiedDeprecationMessage%",scope:"resource"},"typescript.format.insertSpaceAfterSemicolonInForStatements":{type:"boolean",default:!0,description:"%format.insertSpaceAfterSemicolonInForStatements%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterSemicolonInForStatements.unifiedDeprecationMessage%",scope:"resource"},"js/ts.format.insertSpaceBeforeAndAfterBinaryOperators":{type:"boolean",default:!0,description:"%format.insertSpaceBeforeAndAfterBinaryOperators%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.insertSpaceBeforeAndAfterBinaryOperators":{type:"boolean",default:!0,description:"%format.insertSpaceBeforeAndAfterBinaryOperators%",markdownDeprecationMessage:"%configuration.format.insertSpaceBeforeAndAfterBinaryOperators.unifiedDeprecationMessage%",scope:"resource"},"typescript.format.insertSpaceBeforeAndAfterBinaryOperators":{type:"boolean",default:!0,description:"%format.insertSpaceBeforeAndAfterBinaryOperators%",markdownDeprecationMessage:"%configuration.format.insertSpaceBeforeAndAfterBinaryOperators.unifiedDeprecationMessage%",scope:"resource"},"js/ts.format.insertSpaceAfterKeywordsInControlFlowStatements":{type:"boolean",default:!0,description:"%format.insertSpaceAfterKeywordsInControlFlowStatements%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.insertSpaceAfterKeywordsInControlFlowStatements":{type:"boolean",default:!0,description:"%format.insertSpaceAfterKeywordsInControlFlowStatements%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterKeywordsInControlFlowStatements.unifiedDeprecationMessage%",scope:"resource"},"typescript.format.insertSpaceAfterKeywordsInControlFlowStatements":{type:"boolean",default:!0,description:"%format.insertSpaceAfterKeywordsInControlFlowStatements%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterKeywordsInControlFlowStatements.unifiedDeprecationMessage%",scope:"resource"},"js/ts.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions":{type:"boolean",default:!0,description:"%format.insertSpaceAfterFunctionKeywordForAnonymousFunctions%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions":{type:"boolean",default:!0,description:"%format.insertSpaceAfterFunctionKeywordForAnonymousFunctions%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions.unifiedDeprecationMessage%",scope:"resource"},"typescript.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions":{type:"boolean",default:!0,description:"%format.insertSpaceAfterFunctionKeywordForAnonymousFunctions%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions.unifiedDeprecationMessage%",scope:"resource"},"js/ts.format.insertSpaceBeforeFunctionParenthesis":{type:"boolean",default:!1,description:"%format.insertSpaceBeforeFunctionParenthesis%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.insertSpaceBeforeFunctionParenthesis":{type:"boolean",default:!1,description:"%format.insertSpaceBeforeFunctionParenthesis%",markdownDeprecationMessage:"%configuration.format.insertSpaceBeforeFunctionParenthesis.unifiedDeprecationMessage%",scope:"resource"},"typescript.format.insertSpaceBeforeFunctionParenthesis":{type:"boolean",default:!1,description:"%format.insertSpaceBeforeFunctionParenthesis%",markdownDeprecationMessage:"%configuration.format.insertSpaceBeforeFunctionParenthesis.unifiedDeprecationMessage%",scope:"resource"},"js/ts.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis":{type:"boolean",default:!1,description:"%format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis":{type:"boolean",default:!1,description:"%format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis.unifiedDeprecationMessage%",scope:"resource"},"typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis":{type:"boolean",default:!1,description:"%format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis.unifiedDeprecationMessage%",scope:"resource"},"js/ts.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets":{type:"boolean",default:!1,description:"%format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets":{type:"boolean",default:!1,description:"%format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets.unifiedDeprecationMessage%",scope:"resource"},"typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets":{type:"boolean",default:!1,description:"%format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets.unifiedDeprecationMessage%",scope:"resource"},"js/ts.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces":{type:"boolean",default:!0,description:"%format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces":{type:"boolean",default:!0,description:"%format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces.unifiedDeprecationMessage%",scope:"resource"},"typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces":{type:"boolean",default:!0,description:"%format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces.unifiedDeprecationMessage%",scope:"resource"},"js/ts.format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces":{type:"boolean",default:!0,description:"%format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces":{type:"boolean",default:!0,description:"%format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces.unifiedDeprecationMessage%",scope:"resource"},"typescript.format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces":{type:"boolean",default:!0,description:"%format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces.unifiedDeprecationMessage%",scope:"resource"},"js/ts.format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces":{type:"boolean",default:!1,description:"%format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces":{type:"boolean",default:!1,description:"%format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces.unifiedDeprecationMessage%",scope:"resource"},"typescript.format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces":{type:"boolean",default:!1,description:"%format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces.unifiedDeprecationMessage%",scope:"resource"},"js/ts.format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces":{type:"boolean",default:!1,description:"%format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces":{type:"boolean",default:!1,description:"%format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces.unifiedDeprecationMessage%",scope:"resource"},"typescript.format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces":{type:"boolean",default:!1,description:"%format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces.unifiedDeprecationMessage%",scope:"resource"},"js/ts.format.insertSpaceAfterTypeAssertion":{type:"boolean",default:!1,description:"%format.insertSpaceAfterTypeAssertion%",scope:"language-overridable",keywords:["TypeScript"]},"typescript.format.insertSpaceAfterTypeAssertion":{type:"boolean",default:!1,description:"%format.insertSpaceAfterTypeAssertion%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterTypeAssertion.unifiedDeprecationMessage%",scope:"resource"},"js/ts.format.placeOpenBraceOnNewLineForFunctions":{type:"boolean",default:!1,description:"%format.placeOpenBraceOnNewLineForFunctions%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.placeOpenBraceOnNewLineForFunctions":{type:"boolean",default:!1,description:"%format.placeOpenBraceOnNewLineForFunctions%",markdownDeprecationMessage:"%configuration.format.placeOpenBraceOnNewLineForFunctions.unifiedDeprecationMessage%",scope:"resource"},"typescript.format.placeOpenBraceOnNewLineForFunctions":{type:"boolean",default:!1,description:"%format.placeOpenBraceOnNewLineForFunctions%",markdownDeprecationMessage:"%configuration.format.placeOpenBraceOnNewLineForFunctions.unifiedDeprecationMessage%",scope:"resource"},"js/ts.format.placeOpenBraceOnNewLineForControlBlocks":{type:"boolean",default:!1,description:"%format.placeOpenBraceOnNewLineForControlBlocks%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.placeOpenBraceOnNewLineForControlBlocks":{type:"boolean",default:!1,description:"%format.placeOpenBraceOnNewLineForControlBlocks%",markdownDeprecationMessage:"%configuration.format.placeOpenBraceOnNewLineForControlBlocks.unifiedDeprecationMessage%",scope:"resource"},"typescript.format.placeOpenBraceOnNewLineForControlBlocks":{type:"boolean",default:!1,description:"%format.placeOpenBraceOnNewLineForControlBlocks%",markdownDeprecationMessage:"%configuration.format.placeOpenBraceOnNewLineForControlBlocks.unifiedDeprecationMessage%",scope:"resource"},"js/ts.format.semicolons":{type:"string",default:"ignore",description:"%format.semicolons%",scope:"language-overridable",enum:["ignore","insert","remove"],enumDescriptions:["%format.semicolons.ignore%","%format.semicolons.insert%","%format.semicolons.remove%"],keywords:["JavaScript","TypeScript"]},"javascript.format.semicolons":{type:"string",default:"ignore",description:"%format.semicolons%",markdownDeprecationMessage:"%configuration.format.semicolons.unifiedDeprecationMessage%",scope:"resource",enum:["ignore","insert","remove"],enumDescriptions:["%format.semicolons.ignore%","%format.semicolons.insert%","%format.semicolons.remove%"]},"typescript.format.semicolons":{type:"string",default:"ignore",description:"%format.semicolons%",markdownDeprecationMessage:"%configuration.format.semicolons.unifiedDeprecationMessage%",scope:"resource",enum:["ignore","insert","remove"],enumDescriptions:["%format.semicolons.ignore%","%format.semicolons.insert%","%format.semicolons.remove%"]},"js/ts.format.indentSwitchCase":{type:"boolean",default:!0,description:"%format.indentSwitchCase%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.indentSwitchCase":{type:"boolean",default:!0,description:"%format.indentSwitchCase%",markdownDeprecationMessage:"%configuration.format.indentSwitchCase.unifiedDeprecationMessage%",scope:"resource"},"typescript.format.indentSwitchCase":{type:"boolean",default:!0,description:"%format.indentSwitchCase%",markdownDeprecationMessage:"%configuration.format.indentSwitchCase.unifiedDeprecationMessage%",scope:"resource"}}},{type:"object",title:"%configuration.validation%",properties:{"js/ts.validate.enabled":{type:"boolean",default:!0,description:"%configuration.validate.enable%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"typescript.validate.enable":{type:"boolean",default:!0,description:"%typescript.validate.enable%",markdownDeprecationMessage:"%configuration.validate.enable.unifiedDeprecationMessage%",scope:"window"},"javascript.validate.enable":{type:"boolean",default:!0,description:"%javascript.validate.enable%",markdownDeprecationMessage:"%configuration.validate.enable.unifiedDeprecationMessage%",scope:"window"},"js/ts.reportStyleChecksAsWarnings":{type:"boolean",default:!0,description:"%typescript.reportStyleChecksAsWarnings%",scope:"window",keywords:["TypeScript"]},"typescript.reportStyleChecksAsWarnings":{type:"boolean",default:!0,description:"%typescript.reportStyleChecksAsWarnings%",markdownDeprecationMessage:"%configuration.reportStyleChecksAsWarnings.unifiedDeprecationMessage%",scope:"window"},"js/ts.suggestionActions.enabled":{type:"boolean",default:!0,description:"%configuration.suggestionActions.enabled%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.suggestionActions.enabled":{type:"boolean",default:!0,description:"%javascript.suggestionActions.enabled%",markdownDeprecationMessage:"%configuration.suggestionActions.enabled.unifiedDeprecationMessage%",scope:"resource"},"typescript.suggestionActions.enabled":{type:"boolean",default:!0,description:"%typescript.suggestionActions.enabled%",markdownDeprecationMessage:"%configuration.suggestionActions.enabled.unifiedDeprecationMessage%",scope:"resource"},"js/ts.tsserver.experimental.enableProjectDiagnostics":{type:"boolean",default:!1,description:"%configuration.tsserver.experimental.enableProjectDiagnostics%",scope:"window",keywords:["JavaScript","TypeScript","experimental"]},"typescript.tsserver.experimental.enableProjectDiagnostics":{type:"boolean",default:!1,description:"%configuration.tsserver.experimental.enableProjectDiagnostics%",markdownDeprecationMessage:"%configuration.tsserver.experimental.enableProjectDiagnostics.unifiedDeprecationMessage%",scope:"window",keywords:["experimental"]}}},{type:"object",title:"%configuration.implicitProjectConfig%",properties:{"js/ts.implicitProjectConfig.module":{type:"string",markdownDescription:"%configuration.implicitProjectConfig.module%",default:"ESNext",enum:["CommonJS","AMD","System","UMD","ES6","ES2015","ES2020","ESNext","None","ES2022","Node12","NodeNext"],scope:"window"},"js/ts.implicitProjectConfig.target":{type:"string",default:"ES2024",markdownDescription:"%configuration.implicitProjectConfig.target%",enum:["ES3","ES5","ES6","ES2015","ES2016","ES2017","ES2018","ES2019","ES2020","ES2021","ES2022","ES2023","ES2024","ESNext"],scope:"window"},"js/ts.implicitProjectConfig.checkJs":{type:"boolean",default:!1,markdownDescription:"%configuration.implicitProjectConfig.checkJs%",scope:"window"},"js/ts.implicitProjectConfig.experimentalDecorators":{type:"boolean",default:!1,markdownDescription:"%configuration.implicitProjectConfig.experimentalDecorators%",scope:"window"},"js/ts.implicitProjectConfig.strictNullChecks":{type:"boolean",default:!0,markdownDescription:"%configuration.implicitProjectConfig.strictNullChecks%",scope:"window"},"js/ts.implicitProjectConfig.strictFunctionTypes":{type:"boolean",default:!0,markdownDescription:"%configuration.implicitProjectConfig.strictFunctionTypes%",scope:"window"},"js/ts.implicitProjectConfig.strict":{type:"boolean",default:!0,markdownDescription:"%configuration.implicitProjectConfig.strict%",scope:"window"}}},{type:"object",title:"%configuration.languageFeatures%",properties:{"js/ts.updateImportsOnFileMove.enabled":{type:"string",enum:["prompt","always","never"],markdownEnumDescriptions:["%typescript.updateImportsOnFileMove.enabled.prompt%","%typescript.updateImportsOnFileMove.enabled.always%","%typescript.updateImportsOnFileMove.enabled.never%"],default:"prompt",description:"%typescript.updateImportsOnFileMove.enabled%",scope:"resource",keywords:["JavaScript","TypeScript"]},"typescript.updateImportsOnFileMove.enabled":{type:"string",enum:["prompt","always","never"],markdownEnumDescriptions:["%typescript.updateImportsOnFileMove.enabled.prompt%","%typescript.updateImportsOnFileMove.enabled.always%","%typescript.updateImportsOnFileMove.enabled.never%"],default:"prompt",description:"%typescript.updateImportsOnFileMove.enabled%",markdownDeprecationMessage:"%configuration.updateImportsOnFileMove.enabled.unifiedDeprecationMessage%",scope:"resource"},"javascript.updateImportsOnFileMove.enabled":{type:"string",enum:["prompt","always","never"],markdownEnumDescriptions:["%typescript.updateImportsOnFileMove.enabled.prompt%","%typescript.updateImportsOnFileMove.enabled.always%","%typescript.updateImportsOnFileMove.enabled.never%"],default:"prompt",description:"%typescript.updateImportsOnFileMove.enabled%",markdownDeprecationMessage:"%configuration.updateImportsOnFileMove.enabled.unifiedDeprecationMessage%",scope:"resource"},"js/ts.autoClosingTags.enabled":{type:"boolean",default:!0,description:"%typescript.autoClosingTags%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"typescript.autoClosingTags":{type:"boolean",default:!0,description:"%typescript.autoClosingTags%",markdownDeprecationMessage:"%configuration.autoClosingTags.enabled.unifiedDeprecationMessage%",scope:"language-overridable"},"javascript.autoClosingTags":{type:"boolean",default:!0,description:"%typescript.autoClosingTags%",markdownDeprecationMessage:"%configuration.autoClosingTags.enabled.unifiedDeprecationMessage%",scope:"language-overridable"},"js/ts.workspaceSymbols.scope":{type:"string",enum:["allOpenProjects","currentProject"],enumDescriptions:["%typescript.workspaceSymbols.scope.allOpenProjects%","%typescript.workspaceSymbols.scope.currentProject%"],default:"allOpenProjects",markdownDescription:"%typescript.workspaceSymbols.scope%",scope:"window",keywords:["TypeScript"]},"typescript.workspaceSymbols.scope":{type:"string",enum:["allOpenProjects","currentProject"],enumDescriptions:["%typescript.workspaceSymbols.scope.allOpenProjects%","%typescript.workspaceSymbols.scope.currentProject%"],default:"allOpenProjects",markdownDescription:"%typescript.workspaceSymbols.scope%",markdownDeprecationMessage:"%configuration.workspaceSymbols.scope.unifiedDeprecationMessage%",scope:"window"},"js/ts.preferGoToSourceDefinition":{type:"boolean",default:!1,description:"%configuration.preferGoToSourceDefinition%",scope:"window",keywords:["JavaScript","TypeScript"]},"typescript.preferGoToSourceDefinition":{type:"boolean",default:!1,description:"%configuration.preferGoToSourceDefinition%",markdownDeprecationMessage:"%configuration.preferGoToSourceDefinition.unifiedDeprecationMessage%",scope:"window"},"javascript.preferGoToSourceDefinition":{type:"boolean",default:!1,description:"%configuration.preferGoToSourceDefinition%",markdownDeprecationMessage:"%configuration.preferGoToSourceDefinition.unifiedDeprecationMessage%",scope:"window"},"js/ts.workspaceSymbols.excludeLibrarySymbols":{type:"boolean",default:!0,markdownDescription:"%typescript.workspaceSymbols.excludeLibrarySymbols%",scope:"window",keywords:["TypeScript"]},"typescript.workspaceSymbols.excludeLibrarySymbols":{type:"boolean",default:!0,markdownDescription:"%typescript.workspaceSymbols.excludeLibrarySymbols%",markdownDeprecationMessage:"%configuration.workspaceSymbols.excludeLibrarySymbols.unifiedDeprecationMessage%",scope:"window"},"js/ts.updateImportsOnPaste.enabled":{scope:"window",type:"boolean",default:!0,markdownDescription:"%configuration.updateImportsOnPaste%",keywords:["JavaScript","TypeScript"]},"javascript.updateImportsOnPaste.enabled":{scope:"window",type:"boolean",default:!0,markdownDescription:"%configuration.updateImportsOnPaste%",markdownDeprecationMessage:"%configuration.updateImportsOnPaste.enabled.unifiedDeprecationMessage%"},"typescript.updateImportsOnPaste.enabled":{scope:"window",type:"boolean",default:!0,markdownDescription:"%configuration.updateImportsOnPaste%",markdownDeprecationMessage:"%configuration.updateImportsOnPaste.enabled.unifiedDeprecationMessage%"},"js/ts.hover.maximumLength":{type:"number",default:500,description:"%configuration.hover.maximumLength%",scope:"resource"}}},{type:"object",title:"%configuration.suggest%",properties:{"js/ts.suggest.enabled":{type:"boolean",default:!0,description:"%typescript.suggest.enabled%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.suggest.enabled":{type:"boolean",default:!0,description:"%typescript.suggest.enabled%",markdownDeprecationMessage:"%configuration.suggest.enabled.unifiedDeprecationMessage%",scope:"language-overridable"},"typescript.suggest.enabled":{type:"boolean",default:!0,description:"%typescript.suggest.enabled%",markdownDeprecationMessage:"%configuration.suggest.enabled.unifiedDeprecationMessage%",scope:"language-overridable"},"js/ts.suggest.autoImports":{type:"boolean",default:!0,description:"%configuration.suggest.autoImports%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.suggest.autoImports":{type:"boolean",default:!0,description:"%configuration.suggest.autoImports%",markdownDeprecationMessage:"%configuration.suggest.autoImports.unifiedDeprecationMessage%",scope:"resource"},"typescript.suggest.autoImports":{type:"boolean",default:!0,description:"%configuration.suggest.autoImports%",markdownDeprecationMessage:"%configuration.suggest.autoImports.unifiedDeprecationMessage%",scope:"resource"},"js/ts.suggest.names":{type:"boolean",default:!0,markdownDescription:"%configuration.suggest.names%",scope:"language-overridable",keywords:["JavaScript"]},"javascript.suggest.names":{type:"boolean",default:!0,markdownDescription:"%configuration.suggest.names%",markdownDeprecationMessage:"%configuration.suggest.names.unifiedDeprecationMessage%",scope:"resource"},"js/ts.suggest.completeFunctionCalls":{type:"boolean",default:!1,description:"%configuration.suggest.completeFunctionCalls%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.suggest.completeFunctionCalls":{type:"boolean",default:!1,description:"%configuration.suggest.completeFunctionCalls%",markdownDeprecationMessage:"%configuration.suggest.completeFunctionCalls.unifiedDeprecationMessage%",scope:"resource"},"typescript.suggest.completeFunctionCalls":{type:"boolean",default:!1,description:"%configuration.suggest.completeFunctionCalls%",markdownDeprecationMessage:"%configuration.suggest.completeFunctionCalls.unifiedDeprecationMessage%",scope:"resource"},"js/ts.suggest.paths":{type:"boolean",default:!0,description:"%configuration.suggest.paths%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.suggest.paths":{type:"boolean",default:!0,description:"%configuration.suggest.paths%",markdownDeprecationMessage:"%configuration.suggest.paths.unifiedDeprecationMessage%",scope:"resource"},"typescript.suggest.paths":{type:"boolean",default:!0,description:"%configuration.suggest.paths%",markdownDeprecationMessage:"%configuration.suggest.paths.unifiedDeprecationMessage%",scope:"resource"},"js/ts.suggest.jsdoc.enabled":{type:"boolean",default:!0,description:"%configuration.suggest.jsdoc.enabled%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.suggest.completeJSDocs":{type:"boolean",default:!0,description:"%configuration.suggest.jsdoc.enabled%",markdownDeprecationMessage:"%configuration.suggest.completeJSDocs.unifiedDeprecationMessage%",scope:"language-overridable"},"typescript.suggest.completeJSDocs":{type:"boolean",default:!0,description:"%configuration.suggest.jsdoc.enabled%",markdownDeprecationMessage:"%configuration.suggest.completeJSDocs.unifiedDeprecationMessage%",scope:"language-overridable"},"js/ts.suggest.jsdoc.generateReturns":{type:"boolean",default:!0,markdownDescription:"%configuration.suggest.jsdoc.generateReturns%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.suggest.jsdoc.generateReturns":{type:"boolean",default:!0,markdownDescription:"%configuration.suggest.jsdoc.generateReturns%",markdownDeprecationMessage:"%configuration.suggest.jsdoc.generateReturns.unifiedDeprecationMessage%",scope:"language-overridable"},"typescript.suggest.jsdoc.generateReturns":{type:"boolean",default:!0,markdownDescription:"%configuration.suggest.jsdoc.generateReturns%",markdownDeprecationMessage:"%configuration.suggest.jsdoc.generateReturns.unifiedDeprecationMessage%",scope:"language-overridable"},"js/ts.suggest.includeAutomaticOptionalChainCompletions":{type:"boolean",default:!0,description:"%configuration.suggest.includeAutomaticOptionalChainCompletions%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.suggest.includeAutomaticOptionalChainCompletions":{type:"boolean",default:!0,description:"%configuration.suggest.includeAutomaticOptionalChainCompletions%",markdownDeprecationMessage:"%configuration.suggest.includeAutomaticOptionalChainCompletions.unifiedDeprecationMessage%",scope:"resource"},"typescript.suggest.includeAutomaticOptionalChainCompletions":{type:"boolean",default:!0,description:"%configuration.suggest.includeAutomaticOptionalChainCompletions%",markdownDeprecationMessage:"%configuration.suggest.includeAutomaticOptionalChainCompletions.unifiedDeprecationMessage%",scope:"resource"},"js/ts.suggest.includeCompletionsForImportStatements":{type:"boolean",default:!0,description:"%configuration.suggest.includeCompletionsForImportStatements%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.suggest.includeCompletionsForImportStatements":{type:"boolean",default:!0,description:"%configuration.suggest.includeCompletionsForImportStatements%",markdownDeprecationMessage:"%configuration.suggest.includeCompletionsForImportStatements.unifiedDeprecationMessage%",scope:"resource"},"typescript.suggest.includeCompletionsForImportStatements":{type:"boolean",default:!0,description:"%configuration.suggest.includeCompletionsForImportStatements%",markdownDeprecationMessage:"%configuration.suggest.includeCompletionsForImportStatements.unifiedDeprecationMessage%",scope:"resource"},"js/ts.suggest.classMemberSnippets.enabled":{type:"boolean",default:!0,description:"%configuration.suggest.classMemberSnippets.enabled%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.suggest.classMemberSnippets.enabled":{type:"boolean",default:!0,description:"%configuration.suggest.classMemberSnippets.enabled%",markdownDeprecationMessage:"%configuration.suggest.classMemberSnippets.enabled.unifiedDeprecationMessage%",scope:"resource"},"typescript.suggest.classMemberSnippets.enabled":{type:"boolean",default:!0,description:"%configuration.suggest.classMemberSnippets.enabled%",markdownDeprecationMessage:"%configuration.suggest.classMemberSnippets.enabled.unifiedDeprecationMessage%",scope:"resource"},"js/ts.suggest.objectLiteralMethodSnippets.enabled":{type:"boolean",default:!0,description:"%configuration.suggest.objectLiteralMethodSnippets.enabled%",scope:"language-overridable",keywords:["TypeScript"]},"typescript.suggest.objectLiteralMethodSnippets.enabled":{type:"boolean",default:!0,description:"%configuration.suggest.objectLiteralMethodSnippets.enabled%",markdownDeprecationMessage:"%configuration.suggest.objectLiteralMethodSnippets.enabled.unifiedDeprecationMessage%",scope:"resource"}}},{type:"object",title:"%configuration.codeLens%",properties:{"js/ts.referencesCodeLens.enabled":{type:"boolean",default:!1,description:"%configuration.referencesCodeLens.enabled%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.referencesCodeLens.enabled":{type:"boolean",default:!1,description:"%configuration.referencesCodeLens.enabled%",markdownDeprecationMessage:"%configuration.referencesCodeLens.enabled.unifiedDeprecationMessage%",scope:"window"},"typescript.referencesCodeLens.enabled":{type:"boolean",default:!1,description:"%configuration.referencesCodeLens.enabled%",markdownDeprecationMessage:"%configuration.referencesCodeLens.enabled.unifiedDeprecationMessage%",scope:"window"},"js/ts.referencesCodeLens.showOnAllFunctions":{type:"boolean",default:!1,markdownDescription:"%configuration.referencesCodeLens.showOnAllFunctions%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.referencesCodeLens.showOnAllFunctions":{type:"boolean",default:!1,markdownDescription:"%configuration.referencesCodeLens.showOnAllFunctions%",markdownDeprecationMessage:"%configuration.referencesCodeLens.showOnAllFunctions.unifiedDeprecationMessage%",scope:"window"},"typescript.referencesCodeLens.showOnAllFunctions":{type:"boolean",default:!1,markdownDescription:"%configuration.referencesCodeLens.showOnAllFunctions%",markdownDeprecationMessage:"%configuration.referencesCodeLens.showOnAllFunctions.unifiedDeprecationMessage%",scope:"window"},"js/ts.implementationsCodeLens.enabled":{type:"boolean",default:!1,description:"%configuration.implementationsCodeLens.enabled%",scope:"language-overridable",keywords:["TypeScript"]},"typescript.implementationsCodeLens.enabled":{type:"boolean",default:!1,description:"%configuration.implementationsCodeLens.enabled%",markdownDeprecationMessage:"%configuration.implementationsCodeLens.enabled.unifiedDeprecationMessage%",scope:"window"},"js/ts.implementationsCodeLens.showOnInterfaceMethods":{type:"boolean",default:!1,markdownDescription:"%configuration.implementationsCodeLens.showOnInterfaceMethods%",scope:"language-overridable",keywords:["TypeScript"]},"typescript.implementationsCodeLens.showOnInterfaceMethods":{type:"boolean",default:!1,markdownDescription:"%configuration.implementationsCodeLens.showOnInterfaceMethods%",markdownDeprecationMessage:"%configuration.implementationsCodeLens.showOnInterfaceMethods.unifiedDeprecationMessage%",scope:"window"},"js/ts.implementationsCodeLens.showOnAllClassMethods":{type:"boolean",default:!1,markdownDescription:"%configuration.implementationsCodeLens.showOnAllClassMethods%",scope:"language-overridable",keywords:["TypeScript"]},"typescript.implementationsCodeLens.showOnAllClassMethods":{type:"boolean",default:!1,markdownDescription:"%configuration.implementationsCodeLens.showOnAllClassMethods%",markdownDeprecationMessage:"%configuration.implementationsCodeLens.showOnAllClassMethods.unifiedDeprecationMessage%",scope:"window"}}},{type:"object",title:"%configuration.inlayHints%",properties:{"js/ts.inlayHints.parameterNames.enabled":{type:"string",enum:["none","literals","all"],enumDescriptions:["%inlayHints.parameterNames.none%","%inlayHints.parameterNames.literals%","%inlayHints.parameterNames.all%"],default:"none",markdownDescription:"%configuration.inlayHints.parameterNames.enabled%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.inlayHints.parameterNames.enabled":{type:"string",enum:["none","literals","all"],enumDescriptions:["%inlayHints.parameterNames.none%","%inlayHints.parameterNames.literals%","%inlayHints.parameterNames.all%"],default:"none",markdownDescription:"%configuration.inlayHints.parameterNames.enabled%",markdownDeprecationMessage:"%configuration.inlayHints.parameterNames.enabled.unifiedDeprecationMessage%",scope:"resource"},"typescript.inlayHints.parameterNames.enabled":{type:"string",enum:["none","literals","all"],enumDescriptions:["%inlayHints.parameterNames.none%","%inlayHints.parameterNames.literals%","%inlayHints.parameterNames.all%"],default:"none",markdownDescription:"%configuration.inlayHints.parameterNames.enabled%",markdownDeprecationMessage:"%configuration.inlayHints.parameterNames.enabled.unifiedDeprecationMessage%",scope:"resource"},"js/ts.inlayHints.parameterNames.suppressWhenArgumentMatchesName":{type:"boolean",default:!0,markdownDescription:"%configuration.inlayHints.parameterNames.suppressWhenArgumentMatchesName%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.inlayHints.parameterNames.suppressWhenArgumentMatchesName":{type:"boolean",default:!0,markdownDescription:"%configuration.inlayHints.parameterNames.suppressWhenArgumentMatchesName%",markdownDeprecationMessage:"%configuration.inlayHints.parameterNames.suppressWhenArgumentMatchesName.unifiedDeprecationMessage%",scope:"resource"},"typescript.inlayHints.parameterNames.suppressWhenArgumentMatchesName":{type:"boolean",default:!0,markdownDescription:"%configuration.inlayHints.parameterNames.suppressWhenArgumentMatchesName%",markdownDeprecationMessage:"%configuration.inlayHints.parameterNames.suppressWhenArgumentMatchesName.unifiedDeprecationMessage%",scope:"resource"},"js/ts.inlayHints.parameterTypes.enabled":{type:"boolean",default:!1,markdownDescription:"%configuration.inlayHints.parameterTypes.enabled%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.inlayHints.parameterTypes.enabled":{type:"boolean",default:!1,markdownDescription:"%configuration.inlayHints.parameterTypes.enabled%",markdownDeprecationMessage:"%configuration.inlayHints.parameterTypes.enabled.unifiedDeprecationMessage%",scope:"resource"},"typescript.inlayHints.parameterTypes.enabled":{type:"boolean",default:!1,markdownDescription:"%configuration.inlayHints.parameterTypes.enabled%",markdownDeprecationMessage:"%configuration.inlayHints.parameterTypes.enabled.unifiedDeprecationMessage%",scope:"resource"},"js/ts.inlayHints.variableTypes.enabled":{type:"boolean",default:!1,markdownDescription:"%configuration.inlayHints.variableTypes.enabled%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.inlayHints.variableTypes.enabled":{type:"boolean",default:!1,markdownDescription:"%configuration.inlayHints.variableTypes.enabled%",markdownDeprecationMessage:"%configuration.inlayHints.variableTypes.enabled.unifiedDeprecationMessage%",scope:"resource"},"typescript.inlayHints.variableTypes.enabled":{type:"boolean",default:!1,markdownDescription:"%configuration.inlayHints.variableTypes.enabled%",markdownDeprecationMessage:"%configuration.inlayHints.variableTypes.enabled.unifiedDeprecationMessage%",scope:"resource"},"js/ts.inlayHints.variableTypes.suppressWhenTypeMatchesName":{type:"boolean",default:!0,markdownDescription:"%configuration.inlayHints.variableTypes.suppressWhenTypeMatchesName%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.inlayHints.variableTypes.suppressWhenTypeMatchesName":{type:"boolean",default:!0,markdownDescription:"%configuration.inlayHints.variableTypes.suppressWhenTypeMatchesName%",markdownDeprecationMessage:"%configuration.inlayHints.variableTypes.suppressWhenTypeMatchesName.unifiedDeprecationMessage%",scope:"resource"},"typescript.inlayHints.variableTypes.suppressWhenTypeMatchesName":{type:"boolean",default:!0,markdownDescription:"%configuration.inlayHints.variableTypes.suppressWhenTypeMatchesName%",markdownDeprecationMessage:"%configuration.inlayHints.variableTypes.suppressWhenTypeMatchesName.unifiedDeprecationMessage%",scope:"resource"},"js/ts.inlayHints.propertyDeclarationTypes.enabled":{type:"boolean",default:!1,markdownDescription:"%configuration.inlayHints.propertyDeclarationTypes.enabled%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.inlayHints.propertyDeclarationTypes.enabled":{type:"boolean",default:!1,markdownDescription:"%configuration.inlayHints.propertyDeclarationTypes.enabled%",markdownDeprecationMessage:"%configuration.inlayHints.propertyDeclarationTypes.enabled.unifiedDeprecationMessage%",scope:"resource"},"typescript.inlayHints.propertyDeclarationTypes.enabled":{type:"boolean",default:!1,markdownDescription:"%configuration.inlayHints.propertyDeclarationTypes.enabled%",markdownDeprecationMessage:"%configuration.inlayHints.propertyDeclarationTypes.enabled.unifiedDeprecationMessage%",scope:"resource"},"js/ts.inlayHints.functionLikeReturnTypes.enabled":{type:"boolean",default:!1,markdownDescription:"%configuration.inlayHints.functionLikeReturnTypes.enabled%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.inlayHints.functionLikeReturnTypes.enabled":{type:"boolean",default:!1,markdownDescription:"%configuration.inlayHints.functionLikeReturnTypes.enabled%",markdownDeprecationMessage:"%configuration.inlayHints.functionLikeReturnTypes.enabled.unifiedDeprecationMessage%",scope:"resource"},"typescript.inlayHints.functionLikeReturnTypes.enabled":{type:"boolean",default:!1,markdownDescription:"%configuration.inlayHints.functionLikeReturnTypes.enabled%",markdownDeprecationMessage:"%configuration.inlayHints.functionLikeReturnTypes.enabled.unifiedDeprecationMessage%",scope:"resource"},"js/ts.inlayHints.enumMemberValues.enabled":{type:"boolean",default:!1,markdownDescription:"%configuration.inlayHints.enumMemberValues.enabled%",scope:"language-overridable",keywords:["TypeScript"]},"typescript.inlayHints.enumMemberValues.enabled":{type:"boolean",default:!1,markdownDescription:"%configuration.inlayHints.enumMemberValues.enabled%",markdownDeprecationMessage:"%configuration.inlayHints.enumMemberValues.enabled.unifiedDeprecationMessage%",scope:"resource"}}},{type:"object",title:"%configuration.serverAdvanced%",properties:{"js/ts.tsdk.promptToUseWorkspaceVersion":{type:"boolean",default:!1,description:"%typescript.enablePromptUseWorkspaceTsdk%",scope:"window",keywords:["TypeScript"]},"typescript.enablePromptUseWorkspaceTsdk":{type:"boolean",default:!1,description:"%typescript.enablePromptUseWorkspaceTsdk%",markdownDeprecationMessage:"%typescript.enablePromptUseWorkspaceTsdk.unifiedDeprecationMessage%",scope:"window"},"js/ts.tsserver.automaticTypeAcquisition.enabled":{type:"boolean",default:!0,markdownDescription:"%configuration.automaticTypeAcquisition.enabled%",scope:"window",keywords:["TypeScript","usesOnlineServices"]},"typescript.disableAutomaticTypeAcquisition":{type:"boolean",default:!1,markdownDescription:"%typescript.disableAutomaticTypeAcquisition%",markdownDeprecationMessage:"%typescript.disableAutomaticTypeAcquisition.unifiedDeprecationMessage%",scope:"window",keywords:["usesOnlineServices"]},"js/ts.tsserver.node.path":{type:"string",markdownDescription:"%configuration.tsserver.nodePath%",scope:"window",keywords:["TypeScript"]},"typescript.tsserver.nodePath":{type:"string",markdownDescription:"%configuration.tsserver.nodePath%",markdownDeprecationMessage:"%configuration.tsserver.nodePath.unifiedDeprecationMessage%",scope:"window"},"js/ts.tsserver.npm.path":{type:"string",markdownDescription:"%typescript.npm%",scope:"machine",keywords:["TypeScript"]},"typescript.npm":{type:"string",markdownDescription:"%typescript.npm%",markdownDeprecationMessage:"%typescript.npm.unifiedDeprecationMessage%",scope:"machine"},"js/ts.tsserver.checkNpmIsInstalled":{type:"boolean",default:!0,markdownDescription:"%typescript.check.npmIsInstalled%",scope:"window",keywords:["TypeScript"]},"typescript.check.npmIsInstalled":{type:"boolean",default:!0,markdownDescription:"%typescript.check.npmIsInstalled%",markdownDeprecationMessage:"%typescript.check.npmIsInstalled.unifiedDeprecationMessage%",scope:"window"},"js/ts.tsserver.web.projectWideIntellisense.enabled":{type:"boolean",default:!0,description:"%configuration.tsserver.web.projectWideIntellisense.enabled%",scope:"window",keywords:["TypeScript"]},"typescript.tsserver.web.projectWideIntellisense.enabled":{type:"boolean",default:!0,description:"%configuration.tsserver.web.projectWideIntellisense.enabled%",markdownDeprecationMessage:"%configuration.tsserver.web.projectWideIntellisense.enabled.unifiedDeprecationMessage%",scope:"window"},"js/ts.tsserver.web.projectWideIntellisense.suppressSemanticErrors":{type:"boolean",default:!1,description:"%configuration.tsserver.web.projectWideIntellisense.suppressSemanticErrors%",scope:"window",keywords:["TypeScript"]},"typescript.tsserver.web.projectWideIntellisense.suppressSemanticErrors":{type:"boolean",default:!1,description:"%configuration.tsserver.web.projectWideIntellisense.suppressSemanticErrors%",markdownDeprecationMessage:"%configuration.tsserver.web.projectWideIntellisense.suppressSemanticErrors.unifiedDeprecationMessage%",scope:"window"},"js/ts.tsserver.web.typeAcquisition.enabled":{type:"boolean",default:!0,description:"%configuration.tsserver.web.typeAcquisition.enabled%",scope:"window",keywords:["TypeScript"]},"typescript.tsserver.web.typeAcquisition.enabled":{type:"boolean",default:!0,description:"%configuration.tsserver.web.typeAcquisition.enabled%",markdownDeprecationMessage:"%configuration.tsserver.web.typeAcquisition.enabled.unifiedDeprecationMessage%",scope:"window"},"js/ts.tsserver.useSyntaxServer":{type:"string",scope:"window",description:"%configuration.tsserver.useSyntaxServer%",default:"auto",enum:["always","never","auto"],enumDescriptions:["%configuration.tsserver.useSyntaxServer.always%","%configuration.tsserver.useSyntaxServer.never%","%configuration.tsserver.useSyntaxServer.auto%"],keywords:["TypeScript"]},"typescript.tsserver.useSyntaxServer":{type:"string",scope:"window",description:"%configuration.tsserver.useSyntaxServer%",default:"auto",enum:["always","never","auto"],enumDescriptions:["%configuration.tsserver.useSyntaxServer.always%","%configuration.tsserver.useSyntaxServer.never%","%configuration.tsserver.useSyntaxServer.auto%"],markdownDeprecationMessage:"%configuration.tsserver.useSyntaxServer.unifiedDeprecationMessage%"},"js/ts.tsserver.maxMemory":{type:"number",default:3072,markdownDescription:"%configuration.tsserver.maxMemory%",scope:"window",keywords:["TypeScript"]},"js/ts.tsserver.diagnosticDir":{type:"string",markdownDescription:"%configuration.tsserver.diagnosticDir%",scope:"machine",keywords:["TypeScript","diagnostic","memory"]},"typescript.tsserver.maxTsServerMemory":{type:"number",default:3072,markdownDescription:"%configuration.tsserver.maxTsServerMemory%",markdownDeprecationMessage:"%configuration.tsserver.maxTsServerMemory.unifiedDeprecationMessage%",scope:"window"},"js/ts.tsserver.heapSnapshot":{type:"number",default:0,minimum:0,markdownDescription:"%configuration.tsserver.heapSnapshot%",scope:"window",keywords:["TypeScript","memory","diagnostics"]},"js/ts.tsserver.heapProfile":{type:"object",default:{enabled:!1},markdownDescription:"%configuration.tsserver.heapProfile%",scope:"machine",properties:{enabled:{type:"boolean",default:!1,description:"%configuration.tsserver.heapProfile.enabled%"},dir:{type:"string",description:"%configuration.tsserver.heapProfile.dir%"},interval:{type:"number",minimum:1,description:"%configuration.tsserver.heapProfile.interval%"}},keywords:["TypeScript","memory","heap","profile"]},"js/ts.tsserver.watchOptions":{description:"%configuration.tsserver.watchOptions%",scope:"window",default:"vscode",oneOf:[{type:"string",const:"vscode",description:"%configuration.tsserver.watchOptions.vscode%"},{type:"object",properties:{watchFile:{type:"string",description:"%configuration.tsserver.watchOptions.watchFile%",enum:["fixedChunkSizePolling","fixedPollingInterval","priorityPollingInterval","dynamicPriorityPolling","useFsEvents","useFsEventsOnParentDirectory"],enumDescriptions:["%configuration.tsserver.watchOptions.watchFile.fixedChunkSizePolling%","%configuration.tsserver.watchOptions.watchFile.fixedPollingInterval%","%configuration.tsserver.watchOptions.watchFile.priorityPollingInterval%","%configuration.tsserver.watchOptions.watchFile.dynamicPriorityPolling%","%configuration.tsserver.watchOptions.watchFile.useFsEvents%","%configuration.tsserver.watchOptions.watchFile.useFsEventsOnParentDirectory%"],default:"useFsEvents"},watchDirectory:{type:"string",description:"%configuration.tsserver.watchOptions.watchDirectory%",enum:["fixedChunkSizePolling","fixedPollingInterval","dynamicPriorityPolling","useFsEvents"],enumDescriptions:["%configuration.tsserver.watchOptions.watchDirectory.fixedChunkSizePolling%","%configuration.tsserver.watchOptions.watchDirectory.fixedPollingInterval%","%configuration.tsserver.watchOptions.watchDirectory.dynamicPriorityPolling%","%configuration.tsserver.watchOptions.watchDirectory.useFsEvents%"],default:"useFsEvents"},fallbackPolling:{type:"string",description:"%configuration.tsserver.watchOptions.fallbackPolling%",enum:["fixedPollingInterval","priorityPollingInterval","dynamicPriorityPolling"],enumDescriptions:["configuration.tsserver.watchOptions.fallbackPolling.fixedPollingInterval","configuration.tsserver.watchOptions.fallbackPolling.priorityPollingInterval","configuration.tsserver.watchOptions.fallbackPolling.dynamicPriorityPolling"]},synchronousWatchDirectory:{type:"boolean",description:"%configuration.tsserver.watchOptions.synchronousWatchDirectory%"}}}],keywords:["TypeScript"]},"typescript.tsserver.watchOptions":{description:"%configuration.tsserver.watchOptions%",scope:"window",default:"vscode",markdownDeprecationMessage:"%configuration.tsserver.watchOptions.unifiedDeprecationMessage%",oneOf:[{type:"string",const:"vscode",description:"%configuration.tsserver.watchOptions.vscode%"},{type:"object",properties:{watchFile:{type:"string",description:"%configuration.tsserver.watchOptions.watchFile%",enum:["fixedChunkSizePolling","fixedPollingInterval","priorityPollingInterval","dynamicPriorityPolling","useFsEvents","useFsEventsOnParentDirectory"],enumDescriptions:["%configuration.tsserver.watchOptions.watchFile.fixedChunkSizePolling%","%configuration.tsserver.watchOptions.watchFile.fixedPollingInterval%","%configuration.tsserver.watchOptions.watchFile.priorityPollingInterval%","%configuration.tsserver.watchOptions.watchFile.dynamicPriorityPolling%","%configuration.tsserver.watchOptions.watchFile.useFsEvents%","%configuration.tsserver.watchOptions.watchFile.useFsEventsOnParentDirectory%"],default:"useFsEvents"},watchDirectory:{type:"string",description:"%configuration.tsserver.watchOptions.watchDirectory%",enum:["fixedChunkSizePolling","fixedPollingInterval","dynamicPriorityPolling","useFsEvents"],enumDescriptions:["%configuration.tsserver.watchOptions.watchDirectory.fixedChunkSizePolling%","%configuration.tsserver.watchOptions.watchDirectory.fixedPollingInterval%","%configuration.tsserver.watchOptions.watchDirectory.dynamicPriorityPolling%","%configuration.tsserver.watchOptions.watchDirectory.useFsEvents%"],default:"useFsEvents"},fallbackPolling:{type:"string",description:"%configuration.tsserver.watchOptions.fallbackPolling%",enum:["fixedPollingInterval","priorityPollingInterval","dynamicPriorityPolling"],enumDescriptions:["configuration.tsserver.watchOptions.fallbackPolling.fixedPollingInterval","configuration.tsserver.watchOptions.fallbackPolling.priorityPollingInterval","configuration.tsserver.watchOptions.fallbackPolling.dynamicPriorityPolling"]},synchronousWatchDirectory:{type:"boolean",description:"%configuration.tsserver.watchOptions.synchronousWatchDirectory%"}}}]},"js/ts.tsserver.tracing.enabled":{type:"boolean",default:!1,description:"%typescript.tsserver.enableTracing%",scope:"window",keywords:["TypeScript"]},"typescript.tsserver.enableTracing":{type:"boolean",default:!1,description:"%typescript.tsserver.enableTracing%",markdownDeprecationMessage:"%typescript.tsserver.enableTracing.unifiedDeprecationMessage%",scope:"window"},"js/ts.tsserver.log":{type:"string",enum:["off","terse","normal","verbose","requestTime"],default:"off",description:"%typescript.tsserver.log%",scope:"window",keywords:["TypeScript"]},"typescript.tsserver.log":{type:"string",enum:["off","terse","normal","verbose","requestTime"],default:"off",description:"%typescript.tsserver.log%",markdownDeprecationMessage:"%typescript.tsserver.log.unifiedDeprecationMessage%",scope:"window"},"js/ts.tsserver.pluginPaths":{type:"array",items:{type:"string",description:"%typescript.tsserver.pluginPaths.item%"},default:[],description:"%typescript.tsserver.pluginPaths%",scope:"machine",keywords:["TypeScript"]},"typescript.tsserver.pluginPaths":{type:"array",items:{type:"string",description:"%typescript.tsserver.pluginPaths.item%"},default:[],description:"%typescript.tsserver.pluginPaths%",markdownDeprecationMessage:"%typescript.tsserver.pluginPaths.unifiedDeprecationMessage%",scope:"machine"}}}],commands:[{command:"typescript.reloadProjects",title:"%reloadProjects.title%",category:"TypeScript"},{command:"javascript.reloadProjects",title:"%reloadProjects.title%",category:"JavaScript"},{command:"typescript.selectTypeScriptVersion",title:"%typescript.selectTypeScriptVersion.title%",category:"TypeScript"},{command:"typescript.goToProjectConfig",title:"%typescript.goToProjectConfig.title%",category:"TypeScript"},{command:"javascript.goToProjectConfig",title:"%javascript.goToProjectConfig.title%",category:"JavaScript"},{command:"typescript.openTsServerLog",title:"%typescript.openTsServerLog.title%",category:"TypeScript"},{command:"typescript.restartTsServer",title:"%typescript.restartTsServer%",category:"TypeScript"},{command:"typescript.findAllFileReferences",title:"%typescript.findAllFileReferences%",category:"TypeScript"},{command:"typescript.goToSourceDefinition",title:"%typescript.goToSourceDefinition%",category:"TypeScript"},{command:"typescript.sortImports",title:"%typescript.sortImports%",category:"TypeScript"},{command:"javascript.sortImports",title:"%typescript.sortImports%",category:"JavaScript"},{command:"typescript.removeUnusedImports",title:"%typescript.removeUnusedImports%",category:"TypeScript"},{command:"javascript.removeUnusedImports",title:"%typescript.removeUnusedImports%",category:"JavaScript"},{command:"typescript.experimental.enableTsgo",title:"Use TypeScript Go (Experimental)",category:"TypeScript",enablement:"!config.js/ts.experimental.useTsgo && !config.typescript.experimental.useTsgo && config.typescript-go.executablePath"},{command:"typescript.experimental.disableTsgo",title:"Stop using TypeScript Go (Experimental)",category:"TypeScript",enablement:"config.js/ts.experimental.useTsgo || config.typescript.experimental.useTsgo"}],menus:{commandPalette:[{command:"typescript.reloadProjects",when:"editorLangId == typescript && typescript.isManagedFile"},{command:"typescript.reloadProjects",when:"editorLangId == typescriptreact && typescript.isManagedFile"},{command:"javascript.reloadProjects",when:"editorLangId == javascript && typescript.isManagedFile"},{command:"javascript.reloadProjects",when:"editorLangId == javascriptreact && typescript.isManagedFile"},{command:"typescript.goToProjectConfig",when:"editorLangId == typescript && typescript.isManagedFile"},{command:"typescript.goToProjectConfig",when:"editorLangId == typescriptreact && typescript.isManagedFile"},{command:"javascript.goToProjectConfig",when:"editorLangId == javascript && typescript.isManagedFile"},{command:"javascript.goToProjectConfig",when:"editorLangId == javascriptreact && typescript.isManagedFile"},{command:"typescript.selectTypeScriptVersion",when:"typescript.isManagedFile"},{command:"typescript.openTsServerLog",when:"typescript.isManagedFile"},{command:"typescript.restartTsServer",when:"typescript.isManagedFile"},{command:"typescript.findAllFileReferences",when:"tsSupportsFileReferences && typescript.isManagedFile"},{command:"typescript.goToSourceDefinition",when:"tsSupportsSourceDefinition && typescript.isManagedFile"},{command:"typescript.sortImports",when:"supportedCodeAction =~ /(\\s|^)source\\.sortImports\\b/ && editorLangId =~ /^typescript(react)?$/"},{command:"javascript.sortImports",when:"supportedCodeAction =~ /(\\s|^)source\\.sortImports\\b/ && editorLangId =~ /^javascript(react)?$/"},{command:"typescript.removeUnusedImports",when:"supportedCodeAction =~ /(\\s|^)source\\.removeUnusedImports\\b/ && editorLangId =~ /^typescript(react)?$/"},{command:"javascript.removeUnusedImports",when:"supportedCodeAction =~ /(\\s|^)source\\.removeUnusedImports\\b/ && editorLangId =~ /^javascript(react)?$/"}],"editor/context":[{command:"typescript.goToSourceDefinition",when:"!config.js/ts.experimental.useTsgo && !config.typescript.experimental.useTsgo && tsSupportsSourceDefinition && (resourceLangId == typescript || resourceLangId == typescriptreact || resourceLangId == javascript || resourceLangId == javascriptreact)",group:"navigation@1.41"}],"explorer/context":[{command:"typescript.findAllFileReferences",when:"tsSupportsFileReferences && resourceLangId == typescript",group:"4_search"},{command:"typescript.findAllFileReferences",when:"tsSupportsFileReferences && resourceLangId == typescriptreact",group:"4_search"},{command:"typescript.findAllFileReferences",when:"tsSupportsFileReferences && resourceLangId == javascript",group:"4_search"},{command:"typescript.findAllFileReferences",when:"tsSupportsFileReferences && resourceLangId == javascriptreact",group:"4_search"}],"editor/title/context":[{command:"typescript.findAllFileReferences",when:"tsSupportsFileReferences && resourceLangId == javascript"},{command:"typescript.findAllFileReferences",when:"tsSupportsFileReferences && resourceLangId == javascriptreact"},{command:"typescript.findAllFileReferences",when:"tsSupportsFileReferences && resourceLangId == typescript"},{command:"typescript.findAllFileReferences",when:"tsSupportsFileReferences && resourceLangId == typescriptreact"}]},breakpoints:[{language:"typescript"},{language:"typescriptreact"}],taskDefinitions:[{type:"typescript",required:["tsconfig"],properties:{tsconfig:{type:"string",description:"%taskDefinition.tsconfig.description%"},option:{type:"string"}},when:"shellExecutionSupported"}],problemPatterns:[{name:"tsc",regexp:"^([^\\s].*)[\\(:](\\d+)[,:](\\d+)(?:\\):\\s+|\\s+-\\s+)(error|warning|info)\\s+TS(\\d+)\\s*:\\s*(.*)$",file:1,line:2,column:3,severity:4,code:5,message:6}],problemMatchers:[{name:"tsc",label:"%typescript.problemMatchers.tsc.label%",owner:"typescript",source:"ts",applyTo:"closedDocuments",fileLocation:["relative","${cwd}"],pattern:"$tsc"},{name:"tsgo-watch",label:"%typescript.problemMatchers.tsgo-watch.label%",owner:"typescript",source:"ts",applyTo:"closedDocuments",fileLocation:["relative","${cwd}"],pattern:"$tsc",background:{activeOnStart:!0,beginsPattern:{regexp:"^build starting at .*$"},endsPattern:{regexp:"^build finished in .*$"}}},{name:"tsc-watch",label:"%typescript.problemMatchers.tscWatch.label%",owner:"typescript",source:"ts",applyTo:"closedDocuments",fileLocation:["relative","${cwd}"],pattern:"$tsc",background:{activeOnStart:!0,beginsPattern:{regexp:"^\\s*(?:message TS6032:|\\[?\\D*.{1,2}[:.].{1,2}[:.].{1,2}\\D*(\u251C\\D*\\d{1,2}\\D+\u2524)?(?:\\]| -)) (Starting compilation in watch mode|File change detected\\. Starting incremental compilation)\\.\\.\\."},endsPattern:{regexp:"^\\s*(?:message TS6042:|\\[?\\D*.{1,2}[:.].{1,2}[:.].{1,2}\\D*(\u251C\\D*\\d{1,2}\\D+\u2524)?(?:\\]| -)) (?:Compilation complete\\.|Found \\d+ errors?\\.) Watching for file changes\\."}}}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"JavaScript and TypeScript Language Features",description:"Provides rich language support for JavaScript and TypeScript.",workspaceTrust:"The extension requires workspace trust when the workspace version is used because it executes code specified by the workspace.",virtualWorkspaces:"In virtual workspaces, resolving and finding references across files is not supported.","reloadProjects.title":"Reload Project","configuration.codeLens":"CodeLens","configuration.format":"Formatting","configuration.languageFeatures":"Language Features","configuration.implicitProjectConfig":"Implicit Project Config","configuration.inlayHints":"Inlay Hints","configuration.preferences":"Preferences","configuration.serverAdvanced":"TS Server Advanced Settings","configuration.suggest":"Suggestions","configuration.validation":"Validation","configuration.suggest.completeFunctionCalls":"Complete functions with their parameter signature.","configuration.suggest.completeFunctionCalls.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.suggest.completeFunctionCalls#` instead.","configuration.suggest.includeAutomaticOptionalChainCompletions":"Enable/disable showing completions on potentially undefined values that insert an optional chain call. Requires strict null checks to be enabled.","configuration.suggest.includeAutomaticOptionalChainCompletions.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.suggest.includeAutomaticOptionalChainCompletions#` instead.","configuration.suggest.includeCompletionsForImportStatements":"Enable/disable auto-import-style completions on partially-typed import statements.","configuration.suggest.includeCompletionsForImportStatements.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.suggest.includeCompletionsForImportStatements#` instead.","typescript.useTsgo":"Disables TypeScript and JavaScript language features to allow usage of the TypeScript Go experimental extension. Requires TypeScript Go to be installed and configured. Requires reloading extensions after changing this setting.","typescript.useTsgo.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.experimental.useTsgo#` instead.","typescript.tsdk.desc":"Specifies the folder path to the tsserver and `lib*.d.ts` files under a TypeScript install to use for IntelliSense, for example: `./node_modules/typescript/lib`.\n\n- When specified as a user setting, the TypeScript version from `typescript.tsdk` automatically replaces the built-in TypeScript version.\n- When specified as a workspace setting, `typescript.tsdk` allows you to switch to use that workspace version of TypeScript for IntelliSense with the `TypeScript: Select TypeScript version` command.\n\nSee the [TypeScript documentation](https://code.visualstudio.com/docs/typescript/typescript-compiling#_using-newer-typescript-versions) for more detail about managing TypeScript versions.","typescript.tsdk.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsdk.path#` instead.","typescript.disableAutomaticTypeAcquisition":"Disables [automatic type acquisition](https://code.visualstudio.com/docs/nodejs/working-with-javascript#_typings-and-automatic-type-acquisition). Automatic type acquisition fetches `@types` packages from npm to improve IntelliSense for external libraries.","typescript.disableAutomaticTypeAcquisition.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsserver.automaticTypeAcquisition.enabled#` instead.","configuration.automaticTypeAcquisition.enabled":"Enable [automatic type acquisition](https://code.visualstudio.com/docs/nodejs/working-with-javascript#_typings-and-automatic-type-acquisition). Automatic type acquisition fetches `@types` packages from npm to improve IntelliSense for external libraries.","typescript.enablePromptUseWorkspaceTsdk":"Enables prompting of users to use the TypeScript version configured in the workspace for Intellisense.","typescript.enablePromptUseWorkspaceTsdk.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsdk.promptToUseWorkspaceVersion#` instead.","typescript.tsserver.enableTracing":"Enables tracing TS server performance to a directory. These trace files can be used to diagnose TS Server performance issues. The log may contain file paths, source code, and other potentially sensitive information from your project.","typescript.tsserver.enableTracing.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsserver.tracing.enabled#` instead.","typescript.tsserver.log":"Enables logging of the TS server to a file. This log can be used to diagnose TS Server issues. The log may contain file paths, source code, and other potentially sensitive information from your project.","typescript.tsserver.log.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsserver.log#` instead.","typescript.tsserver.pluginPaths":"Additional paths to discover TypeScript Language Service plugins.","typescript.tsserver.pluginPaths.item":"Either an absolute or relative path. Relative path will be resolved against workspace folder(s).","typescript.tsserver.pluginPaths.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsserver.pluginPaths#` instead.","typescript.tsserver.trace":"Enables tracing of messages sent to the TS server. This trace can be used to diagnose TS Server issues. The trace may contain file paths, source code, and other potentially sensitive information from your project.","typescript.validate.enable":"Enable/disable TypeScript validation.","javascript.validate.enable":"Enable/disable JavaScript validation.","configuration.validate.enable":"Enable/disable JavaScript and TypeScript validation.","configuration.validate.enable.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.validate.enabled#` instead.","typescript.format.enable":"Enable/disable default TypeScript formatter.","javascript.format.enable":"Enable/disable default JavaScript formatter.","format.insertSpaceAfterCommaDelimiter":"Defines space handling after a comma delimiter.","format.insertSpaceAfterConstructor":"Defines space handling after the constructor keyword.","format.insertSpaceAfterSemicolonInForStatements":"Defines space handling after a semicolon in a for statement.","format.insertSpaceBeforeAndAfterBinaryOperators":"Defines space handling after a binary operator.","format.insertSpaceAfterKeywordsInControlFlowStatements":"Defines space handling after keywords in a control flow statement.","format.insertSpaceAfterFunctionKeywordForAnonymousFunctions":"Defines space handling after function keyword for anonymous functions.","format.insertSpaceBeforeFunctionParenthesis":"Defines space handling before function argument parentheses.","format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis":"Defines space handling after opening and before closing non-empty parenthesis.","format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets":"Defines space handling after opening and before closing non-empty brackets.","format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces":"Defines space handling after opening and before closing non-empty braces.","format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces":"Defines space handling after opening and before closing empty braces.","format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces":"Defines space handling after opening and before closing template string braces.","format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces":"Defines space handling after opening and before closing JSX expression braces.","format.insertSpaceAfterTypeAssertion":"Defines space handling after type assertions in TypeScript.","format.placeOpenBraceOnNewLineForFunctions":"Defines whether an open brace is put onto a new line for functions or not.","format.placeOpenBraceOnNewLineForControlBlocks":"Defines whether an open brace is put onto a new line for control blocks or not.","format.semicolons":"Defines handling of optional semicolons.","format.semicolons.ignore":"Don't insert or remove any semicolons.","format.semicolons.insert":"Insert semicolons at statement ends.","format.semicolons.remove":"Remove unnecessary semicolons.","format.indentSwitchCase":"Indent case clauses in switch statements. Requires using TypeScript 5.1+ in the workspace.","format.enable":"Enable/disable the default JavaScript and TypeScript formatter.","configuration.format.enable.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.enabled#` instead.","configuration.format.insertSpaceAfterCommaDelimiter.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.insertSpaceAfterCommaDelimiter#` instead.","configuration.format.insertSpaceAfterConstructor.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.insertSpaceAfterConstructor#` instead.","configuration.format.insertSpaceAfterSemicolonInForStatements.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.insertSpaceAfterSemicolonInForStatements#` instead.","configuration.format.insertSpaceBeforeAndAfterBinaryOperators.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.insertSpaceBeforeAndAfterBinaryOperators#` instead.","configuration.format.insertSpaceAfterKeywordsInControlFlowStatements.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.insertSpaceAfterKeywordsInControlFlowStatements#` instead.","configuration.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions#` instead.","configuration.format.insertSpaceBeforeFunctionParenthesis.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.insertSpaceBeforeFunctionParenthesis#` instead.","configuration.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis#` instead.","configuration.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets#` instead.","configuration.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces#` instead.","configuration.format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces#` instead.","configuration.format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces#` instead.","configuration.format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces#` instead.","configuration.format.insertSpaceAfterTypeAssertion.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.insertSpaceAfterTypeAssertion#` instead.","configuration.format.placeOpenBraceOnNewLineForFunctions.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.placeOpenBraceOnNewLineForFunctions#` instead.","configuration.format.placeOpenBraceOnNewLineForControlBlocks.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.placeOpenBraceOnNewLineForControlBlocks#` instead.","configuration.format.semicolons.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.semicolons#` instead.","configuration.format.indentSwitchCase.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.indentSwitchCase#` instead.","javascript.goToProjectConfig.title":"Go to Project Configuration (jsconfig / tsconfig)","typescript.goToProjectConfig.title":"Go to Project Configuration (tsconfig)","configuration.referencesCodeLens.enabled":"Enable/disable references CodeLens in JavaScript and TypeScript files. This CodeLens shows the number of references for classes and exported functions and allows you to peek or navigate to them.","configuration.referencesCodeLens.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.referencesCodeLens.enabled#` instead.","configuration.referencesCodeLens.showOnAllFunctions":"Enable/disable the [references CodeLens](#js/ts.referencesCodeLens.enabled) on all functions in JavaScript and TypeScript files.","configuration.referencesCodeLens.showOnAllFunctions.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.referencesCodeLens.showOnAllFunctions#` instead.","configuration.implementationsCodeLens.enabled":"Enable/disable implementations CodeLens in TypeScript files. This CodeLens shows the implementers of TypeScript interfaces.","configuration.implementationsCodeLens.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.implementationsCodeLens.enabled#` instead.","configuration.implementationsCodeLens.showOnInterfaceMethods":"Enable/disable [implementations CodeLens](#js/ts.implementationsCodeLens.enabled) on TypeScript interface methods.","configuration.implementationsCodeLens.showOnInterfaceMethods.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.implementationsCodeLens.showOnInterfaceMethods#` instead.","configuration.implementationsCodeLens.showOnAllClassMethods":"Enable/disable showing [implementations CodeLens](#js/ts.implementationsCodeLens.enabled) above all TypeScript class methods instead of only on abstract methods.","configuration.implementationsCodeLens.showOnAllClassMethods.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.implementationsCodeLens.showOnAllClassMethods#` instead.","typescript.openTsServerLog.title":"Open TS Server log","typescript.restartTsServer":"Restart TS Server","typescript.selectTypeScriptVersion.title":"Select TypeScript Version...","typescript.reportStyleChecksAsWarnings":"Report style checks as warnings.","configuration.reportStyleChecksAsWarnings.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.reportStyleChecksAsWarnings#` instead.","typescript.npm":"Specifies the path to the npm executable used for [Automatic Type Acquisition](https://code.visualstudio.com/docs/nodejs/working-with-javascript#_typings-and-automatic-type-acquisition).","typescript.npm.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsserver.npm.path#` instead.","typescript.check.npmIsInstalled":"Check if npm is installed for [Automatic Type Acquisition](https://code.visualstudio.com/docs/nodejs/working-with-javascript#_typings-and-automatic-type-acquisition).","typescript.check.npmIsInstalled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsserver.checkNpmIsInstalled#` instead.","configuration.suggest.names":"Enable/disable including unique names from the file in JavaScript suggestions. Note that name suggestions are always disabled in JavaScript code that is semantically checked using `@ts-check` or `checkJs`.","configuration.suggest.names.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.suggest.names#` instead.","typescript.tsc.autoDetect":"Controls auto detection of tsc tasks.","typescript.tsc.autoDetect.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsc.autoDetect#` instead.","typescript.tsc.autoDetect.off":"Disable this feature.","typescript.tsc.autoDetect.on":"Create both build and watch tasks.","typescript.tsc.autoDetect.build":"Only create single run compile tasks.","typescript.tsc.autoDetect.watch":"Only create compile and watch tasks.","typescript.problemMatchers.tsc.label":"TypeScript problems","typescript.problemMatchers.tsgo-watch.label":"TypeScript problems (watch mode)","typescript.problemMatchers.tscWatch.label":"TypeScript problems (watch mode)","configuration.suggest.paths":"Enable/disable suggestions for paths in import statements and require calls.","configuration.suggest.paths.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.suggest.paths#` instead.","configuration.tsserver.useSeparateSyntaxServer":"Enable/disable spawning a separate TypeScript server that can more quickly respond to syntax related operations, such as calculating folding or computing document symbols.","configuration.tsserver.useSyntaxServer":"Controls if TypeScript launches a dedicated server to more quickly handle syntax related operations, such as computing code folding.","configuration.tsserver.useSyntaxServer.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsserver.useSyntaxServer#` instead.","configuration.tsserver.useSyntaxServer.always":"Use a lighter weight syntax server to handle all IntelliSense operations. This disables project-wide features including auto-imports, cross-file completions, and go to definition for symbols in other files. Only use this for very large projects where performance is critical.","configuration.tsserver.useSyntaxServer.never":"Don't use a dedicated syntax server. Use a single server to handle all IntelliSense operations.","configuration.tsserver.useSyntaxServer.auto":"Spawn both a full server and a lighter weight server dedicated to syntax operations. The syntax server is used to speed up syntax operations and provide IntelliSense while projects are loading.","configuration.tsserver.maxTsServerMemory":"The maximum amount of memory (in MB) to allocate to the TypeScript server process. To use a memory limit greater than 4 GB, use `#js/ts.tsserver.node.path#` to run TS Server with a custom Node installation.","configuration.tsserver.maxTsServerMemory.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsserver.maxMemory#` instead.","configuration.tsserver.maxMemory":"The maximum amount of memory (in MB) to allocate to the TypeScript server process. To use a memory limit greater than 4 GB, use `#js/ts.tsserver.node.path#` to run TS Server with a custom Node installation.","configuration.tsserver.diagnosticDir":"Directory where TypeScript server writes Node diagnostic output by passing `--diagnostic-dir`.","configuration.tsserver.heapSnapshot":"Controls how many near-heap-limit snapshots TypeScript server writes by passing `--heapsnapshot-near-heap-limit`. Set to `0` to disable.","configuration.tsserver.heapProfile":"Configures heap profiling for TypeScript server.","configuration.tsserver.heapProfile.enabled":"Enable heap profiling for TypeScript server by passing `--heap-prof`.","configuration.tsserver.heapProfile.dir":"Directory where TypeScript server writes heap profiles by passing `--heap-prof-dir`.","configuration.tsserver.heapProfile.interval":"Sampling interval in bytes for TypeScript server heap profiling by passing `--heap-prof-interval`.","configuration.tsserver.experimental.enableProjectDiagnostics":"Enables project wide error reporting.","configuration.tsserver.experimental.enableProjectDiagnostics.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsserver.experimental.enableProjectDiagnostics#` instead.","typescript.locale":"Sets the locale used to report JavaScript and TypeScript errors. Defaults to use VS Code's locale.","typescript.locale.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.locale#` instead.","typescript.locale.auto":"Use VS Code's configured display language.","configuration.implicitProjectConfig.module":"Sets the module system for the program. See more: https://www.typescriptlang.org/tsconfig#module.","configuration.implicitProjectConfig.target":"Set target JavaScript language version for emitted JavaScript and include library declarations. See more: https://www.typescriptlang.org/tsconfig#target.","configuration.implicitProjectConfig.checkJs":"Enable/disable semantic checking of JavaScript files. Existing `jsconfig.json` or `tsconfig.json` files override this setting.","configuration.implicitProjectConfig.experimentalDecorators":"Enable/disable `experimentalDecorators` in JavaScript files that are not part of a project. Existing `jsconfig.json` or `tsconfig.json` files override this setting.","configuration.implicitProjectConfig.strictNullChecks":"Enable/disable [strict null checks](https://www.typescriptlang.org/tsconfig#strictNullChecks) in JavaScript and TypeScript files that are not part of a project. Existing `jsconfig.json` or `tsconfig.json` files override this setting.","configuration.implicitProjectConfig.strictFunctionTypes":"Enable/disable [strict function types](https://www.typescriptlang.org/tsconfig#strictFunctionTypes) in JavaScript and TypeScript files that are not part of a project. Existing `jsconfig.json` or `tsconfig.json` files override this setting.","configuration.implicitProjectConfig.strict":"Enable/disable [strict mode](https://www.typescriptlang.org/tsconfig#strict) in JavaScript and TypeScript files that are not part of a project. Existing `jsconfig.json` or `tsconfig.json` files override this setting.","configuration.suggest.jsdoc.generateReturns":"Enable/disable generating `@returns` annotations for JSDoc templates.","configuration.suggest.jsdoc.generateReturns.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.suggest.jsdoc.generateReturns#` instead.","configuration.suggest.autoImports":"Enable/disable auto import suggestions.","configuration.suggest.autoImports.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.suggest.autoImports#` instead.","configuration.preferGoToSourceDefinition":"Makes `Go to Definition` avoid type declaration files when possible by triggering `Go to Source Definition` instead. This allows `Go to Source Definition` to be triggered with the mouse gesture.","configuration.preferGoToSourceDefinition.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.preferGoToSourceDefinition#` instead.","inlayHints.parameterNames.none":"Disable parameter name hints.","inlayHints.parameterNames.literals":"Enable parameter name hints only for literal arguments.","inlayHints.parameterNames.all":"Enable parameter name hints for literal and non-literal arguments.","configuration.inlayHints.parameterNames.enabled":{message:"Enable/disable inlay hints for parameter names:\n```typescript\n\nparseInt(/* str: */ '123', /* radix: */ 8)\n \n```",comment:["The text inside the ``` block is code and should not be localized."]},"configuration.inlayHints.parameterNames.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.inlayHints.parameterNames.enabled#` instead.","configuration.inlayHints.parameterNames.suppressWhenArgumentMatchesName":"Suppress parameter name hints on arguments whose text is identical to the parameter name.","configuration.inlayHints.parameterNames.suppressWhenArgumentMatchesName.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.inlayHints.parameterNames.suppressWhenArgumentMatchesName#` instead.","configuration.inlayHints.parameterTypes.enabled":{message:"Enable/disable inlay hints for implicit parameter types:\n```typescript\n\nel.addEventListener('click', e /* :MouseEvent */ => ...)\n \n```",comment:["The text inside the ``` block is code and should not be localized."]},"configuration.inlayHints.parameterTypes.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.inlayHints.parameterTypes.enabled#` instead.","configuration.inlayHints.variableTypes.enabled":{message:"Enable/disable inlay hints for implicit variable types:\n```typescript\n\nconst foo /* :number */ = Date.now();\n \n```",comment:["The text inside the ``` block is code and should not be localized."]},"configuration.inlayHints.variableTypes.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.inlayHints.variableTypes.enabled#` instead.","configuration.inlayHints.variableTypes.suppressWhenTypeMatchesName":"Suppress type hints on variables whose name is identical to the type name.","configuration.inlayHints.variableTypes.suppressWhenTypeMatchesName.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.inlayHints.variableTypes.suppressWhenTypeMatchesName#` instead.","configuration.inlayHints.propertyDeclarationTypes.enabled":{message:`Enable/disable inlay hints for implicit types on property declarations:
\`\`\`typescript

class Foo {
	prop /* :number */ = Date.now();
}
 
\`\`\``,comment:["The text inside the ``` block is code and should not be localized."]},"configuration.inlayHints.propertyDeclarationTypes.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.inlayHints.propertyDeclarationTypes.enabled#` instead.","configuration.inlayHints.functionLikeReturnTypes.enabled":{message:`Enable/disable inlay hints for implicit return types on function signatures:
\`\`\`typescript

function foo() /* :number */ {
	return Date.now();
} 
 
\`\`\``,comment:["The text inside the ``` block is code and should not be localized."]},"configuration.inlayHints.functionLikeReturnTypes.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.inlayHints.functionLikeReturnTypes.enabled#` instead.","configuration.inlayHints.enumMemberValues.enabled":{message:`Enable/disable inlay hints for member values in enum declarations:
\`\`\`typescript

enum MyValue {
	A /* = 0 */;
	B /* = 1 */;
}
 
\`\`\``,comment:["The text inside the ``` block is code and should not be localized."]},"configuration.inlayHints.enumMemberValues.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.inlayHints.enumMemberValues.enabled#` instead.","taskDefinition.tsconfig.description":"The tsconfig file that defines the TS build.","javascript.suggestionActions.enabled":"Enable/disable suggestion diagnostics for JavaScript files in the editor.","typescript.suggestionActions.enabled":"Enable/disable suggestion diagnostics for TypeScript files in the editor.","configuration.suggestionActions.enabled":"Enable/disable suggestion diagnostics for JavaScript and TypeScript files in the editor.","configuration.suggestionActions.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.suggestionActions.enabled#` instead.","configuration.preferences.quoteStyle.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.preferences.quoteStyle#` instead.","configuration.preferences.importModuleSpecifier.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.preferences.importModuleSpecifier#` instead.","configuration.preferences.importModuleSpecifierEnding.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.preferences.importModuleSpecifierEnding#` instead.","configuration.preferences.jsxAttributeCompletionStyle.auto":'Insert `={}` or `=""` after attribute names based on the prop type. See `#js/ts.preferences.quoteStyle#` to control the type of quotes used for string attributes.',"configuration.preferences.jsxAttributeCompletionStyle.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.preferences.jsxAttributeCompletionStyle#` instead.","configuration.preferences.includePackageJsonAutoImports.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.preferences.includePackageJsonAutoImports#` instead.","configuration.preferences.autoImportFileExcludePatterns.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.preferences.autoImportFileExcludePatterns#` instead.","configuration.preferences.autoImportSpecifierExcludeRegexes.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.preferences.autoImportSpecifierExcludeRegexes#` instead.","configuration.preferences.preferTypeOnlyAutoImports.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.preferences.preferTypeOnlyAutoImports#` instead.","configuration.preferences.useAliasesForRenames.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.preferences.useAliasesForRenames#` instead.","configuration.preferences.renameMatchingJsxTags.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.preferences.renameMatchingJsxTags#` instead.","configuration.preferences.organizeImports.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.preferences.organizeImports#` instead.","typescript.preferences.quoteStyle":"Preferred quote style to use for Quick Fixes.","typescript.preferences.quoteStyle.single":"Always use single quotes: `'`","typescript.preferences.quoteStyle.double":'Always use double quotes: `"`',"typescript.preferences.quoteStyle.auto":"Infer quote type from existing code","typescript.preferences.importModuleSpecifier":"Preferred path style for auto imports.","typescript.preferences.importModuleSpecifier.shortest":"Prefers a non-relative import only if one is available that has fewer path segments than a relative import.","typescript.preferences.importModuleSpecifier.relative":"Prefers a relative path to the imported file location.","typescript.preferences.importModuleSpecifier.nonRelative":"Prefers a non-relative import based on the `baseUrl` or `paths` configured in your `jsconfig.json` / `tsconfig.json`.","typescript.preferences.importModuleSpecifier.projectRelative":"Prefers a non-relative import only if the relative import path would leave the package or project directory.","typescript.preferences.importModuleSpecifierEnding":"Preferred path ending for auto imports.","typescript.preferences.importModuleSpecifierEnding.label.js":".js / .ts","typescript.preferences.importModuleSpecifierEnding.auto":"Use project settings to select a default.","typescript.preferences.importModuleSpecifierEnding.minimal":"Shorten `./component/index.js` to `./component`.","typescript.preferences.importModuleSpecifierEnding.index":"Shorten `./component/index.js` to `./component/index`.","typescript.preferences.importModuleSpecifierEnding.js":"Do not shorten path endings; include the `.js` or `.ts` extension.","typescript.preferences.jsxAttributeCompletionStyle":"Preferred style for JSX attribute completions.","javascript.preferences.jsxAttributeCompletionStyle.auto":'Insert `={}` or `=""` after attribute names based on the prop type. See `#javascript.preferences.quoteStyle#` to control the type of quotes used for string attributes.',"typescript.preferences.jsxAttributeCompletionStyle.auto":'Insert `={}` or `=""` after attribute names based on the prop type. See `#typescript.preferences.quoteStyle#` to control the type of quotes used for string attributes.',"typescript.preferences.jsxAttributeCompletionStyle.braces":"Insert `={}` after attribute names.","typescript.preferences.jsxAttributeCompletionStyle.none":"Only insert attribute names.","typescript.preferences.includePackageJsonAutoImports":"Enable/disable searching `package.json` dependencies for available auto imports.","typescript.preferences.includePackageJsonAutoImports.auto":"Search dependencies based on estimated performance impact.","typescript.preferences.includePackageJsonAutoImports.on":"Always search dependencies.","typescript.preferences.includePackageJsonAutoImports.off":"Never search dependencies.","typescript.preferences.autoImportFileExcludePatterns":"Specify glob patterns of files to exclude from auto imports. Relative paths are resolved relative to the workspace root. Patterns are evaluated using tsconfig.json [`exclude`](https://www.typescriptlang.org/tsconfig#exclude) semantics.","typescript.preferences.autoImportSpecifierExcludeRegexes":"Specify regular expressions to exclude auto imports with matching import specifiers. Examples:\n\n- `^node:`\n- `lib/internal` (slashes don't need to be escaped...)\n- `/lib\\/internal/i` (...unless including surrounding slashes for `i` or `u` flags)\n- `^lodash$` (only allow subpath imports from lodash)","typescript.preferences.preferTypeOnlyAutoImports":"Include the `type` keyword in auto-imports whenever possible. Requires using TypeScript 5.3+ in the workspace.","typescript.workspaceSymbols.excludeLibrarySymbols":"Exclude symbols that come from library files in `Go to Symbol in Workspace` results. Requires using TypeScript 5.3+ in the workspace.","configuration.workspaceSymbols.excludeLibrarySymbols.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.workspaceSymbols.excludeLibrarySymbols#` instead.","typescript.updateImportsOnFileMove.enabled":"Enable/disable automatic updating of import paths when you rename or move a file in VS Code.","typescript.updateImportsOnFileMove.enabled.prompt":"Prompt on each rename.","typescript.updateImportsOnFileMove.enabled.always":"Always update paths automatically.","typescript.updateImportsOnFileMove.enabled.never":"Never rename paths and don't prompt.","configuration.updateImportsOnFileMove.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.updateImportsOnFileMove.enabled#` instead.","typescript.autoClosingTags":"Enable/disable automatic closing of JSX tags.","configuration.autoClosingTags.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.autoClosingTags.enabled#` instead.","typescript.suggest.enabled":"Enable/disable autocomplete suggestions.","configuration.suggest.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.suggest.enabled#` instead.","configuration.suggest.jsdoc.enabled":"Enable/disable suggestion to complete JSDoc comments.","configuration.suggest.completeJSDocs.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.suggest.jsdoc.enabled#` instead.","configuration.tsserver.useVsCodeWatcher":"Use VS Code's file watchers instead of TypeScript's. Requires using TypeScript 5.4+ in the workspace.","configuration.tsserver.watchOptions":"Configure which watching strategies should be used to keep track of files and directories.","configuration.tsserver.watchOptions.vscode":"Use VS Code's file watchers instead of TypeScript's. Requires using TypeScript 5.4+ in the workspace.","configuration.tsserver.watchOptions.watchFile":"Strategy for how individual files are watched.","configuration.tsserver.watchOptions.watchFile.fixedChunkSizePolling":"Polls files in chunks at regular interval.","configuration.tsserver.watchOptions.watchFile.fixedPollingInterval":"Check every file for changes several times a second at a fixed interval.","configuration.tsserver.watchOptions.watchFile.priorityPollingInterval":"Check every file for changes several times a second, but use heuristics to check certain types of files less frequently than others.","configuration.tsserver.watchOptions.watchFile.dynamicPriorityPolling":"Use a dynamic queue where less-frequently modified files will be checked less often.","configuration.tsserver.watchOptions.watchFile.useFsEvents":"Attempt to use the operating system/file system's native events for file changes.","configuration.tsserver.watchOptions.watchFile.useFsEventsOnParentDirectory":"Attempt to use the operating system/file system's native events to listen for changes on a file's containing directories. This can use fewer file watchers, but might be less accurate.","configuration.tsserver.watchOptions.watchDirectory":"Strategy for how entire directory trees are watched under systems that lack recursive file-watching functionality.","configuration.tsserver.watchOptions.watchDirectory.fixedChunkSizePolling":"Polls directories in chunks at regular interval.","configuration.tsserver.watchOptions.watchDirectory.fixedPollingInterval":"Check every directory for changes several times a second at a fixed interval.","configuration.tsserver.watchOptions.watchDirectory.dynamicPriorityPolling":"Use a dynamic queue where less-frequently modified directories will be checked less often.","configuration.tsserver.watchOptions.watchDirectory.useFsEvents":"Attempt to use the operating system/file system's native events for directory changes.","configuration.tsserver.watchOptions.fallbackPolling":"When using file system events, this option specifies the polling strategy that gets used when the system runs out of native file watchers and/or doesn't support native file watchers.","configuration.tsserver.watchOptions.fallbackPolling.fixedPollingInterval":"Check every file for changes several times a second at a fixed interval.","configuration.tsserver.watchOptions.fallbackPolling.priorityPollingInterval":"Check every file for changes several times a second, but use heuristics to check certain types of files less frequently than others.","configuration.tsserver.watchOptions.fallbackPolling.dynamicPriorityPolling ":"Use a dynamic queue where less-frequently modified files will be checked less often.","configuration.tsserver.watchOptions.synchronousWatchDirectory":"Disable deferred watching on directories. Deferred watching is useful when lots of file changes might occur at once (e.g. a change in node_modules from running npm install), but you might want to disable it with this flag for some less-common setups.","typescript.preferences.useAliasesForRenames":"Enable/disable introducing aliases for object shorthand properties during renames.","typescript.preferences.renameMatchingJsxTags":"When on a JSX tag, try to rename the matching tag instead of renaming the symbol. Requires using TypeScript 5.1+ in the workspace.","typescript.preferences.organizeImports":"Advanced preferences that control how imports are ordered.","javascript.preferences.organizeImports":"Advanced preferences that control how imports are ordered.","typescript.preferences.organizeImports.caseSensitivity":"Specifies how imports should be sorted with regards to case-sensitivity. If `auto` or unspecified, we will detect the case-sensitivity per file","typescript.preferences.organizeImports.caseSensitivity.auto":"Detect case-sensitivity for import sorting.","typescript.preferences.organizeImports.caseSensitivity.insensitive":"Sort imports case-insensitively.","typescript.preferences.organizeImports.caseSensitivity.sensitive":"Sort imports case-sensitively.","typescript.preferences.organizeImports.typeOrder":"Specify how type-only named imports should be sorted.","typescript.preferences.organizeImports.typeOrder.auto":"Detect where type-only named imports should be sorted.","typescript.preferences.organizeImports.typeOrder.last":"Type only named imports are sorted to the end of the import list. E.g. `import { B, Z, type A, type Y } from 'module';`","typescript.preferences.organizeImports.typeOrder.inline":"Named imports are sorted by name only. E.g. `import { type A, B, type Y, Z } from 'module';`","typescript.preferences.organizeImports.typeOrder.first":"Type only named imports are sorted to the beginning of the import list. E.g. `import { type A, type Y, B, Z } from 'module';`","typescript.preferences.organizeImports.unicodeCollation":"Specify whether to sort imports using Unicode or Ordinal collation.","typescript.preferences.organizeImports.unicodeCollation.ordinal":"Sort imports using the numeric value of each code point.","typescript.preferences.organizeImports.unicodeCollation.unicode":"Sort imports using the Unicode code collation.","typescript.preferences.organizeImports.locale":"Requires `organizeImports.unicodeCollation: 'unicode'`. Overrides the locale used for collation. Specify `auto` to use the UI locale.","typescript.preferences.organizeImports.caseFirst":"Requires `organizeImports.unicodeCollation: 'unicode'`, and `organizeImports.caseSensitivity` is not `caseInsensitive`. Indicates whether upper-case will sort before lower-case.","typescript.preferences.organizeImports.caseFirst.default":"Default order given by `locale`.","typescript.preferences.organizeImports.caseFirst.lower":"Lower-case comes before upper-case. E.g.` a, A, z, Z`.","typescript.preferences.organizeImports.caseFirst.upper":"Upper-case comes before lower-case. E.g. ` A, a, B, b`.","typescript.preferences.organizeImports.numericCollation":"Requires `organizeImports.unicodeCollation: 'unicode'`. Sort numeric strings by integer value.","typescript.preferences.organizeImports.accentCollation":"Requires `organizeImports.unicodeCollation: 'unicode'`. Compare characters with diacritical marks as unequal to base character.","typescript.workspaceSymbols.scope":"Controls which files are searched by [Go to Symbol in Workspace](https://code.visualstudio.com/docs/editor/editingevolved#_open-symbol-by-name).","typescript.workspaceSymbols.scope.allOpenProjects":"Search all open JavaScript or TypeScript projects for symbols.","typescript.workspaceSymbols.scope.currentProject":"Only search for symbols in the current JavaScript or TypeScript project.","configuration.workspaceSymbols.scope.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.workspaceSymbols.scope#` instead.","typescript.sortImports":"Sort Imports","typescript.removeUnusedImports":"Remove Unused Imports","typescript.findAllFileReferences":"Find File References","typescript.goToSourceDefinition":"Go to Source Definition","configuration.suggest.classMemberSnippets.enabled":"Enable/disable snippet completions for class members.","configuration.suggest.classMemberSnippets.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.suggest.classMemberSnippets.enabled#` instead.","configuration.suggest.objectLiteralMethodSnippets.enabled":"Enable/disable snippet completions for methods in object literals.","configuration.suggest.objectLiteralMethodSnippets.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.suggest.objectLiteralMethodSnippets.enabled#` instead.","configuration.tsserver.web.projectWideIntellisense.enabled":"Enable/disable project-wide IntelliSense on web. Requires that VS Code is running in a trusted context.","configuration.tsserver.web.projectWideIntellisense.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsserver.web.projectWideIntellisense.enabled#` instead.","configuration.tsserver.web.projectWideIntellisense.suppressSemanticErrors":"Suppresses semantic errors on web even when project wide IntelliSense is enabled. This is always on when project wide IntelliSense is not enabled or available. See `#js/ts.tsserver.web.projectWideIntellisense.enabled#`","configuration.tsserver.web.projectWideIntellisense.suppressSemanticErrors.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsserver.web.projectWideIntellisense.suppressSemanticErrors#` instead.","configuration.tsserver.web.typeAcquisition.enabled":"Enable/disable package acquisition on the web. This enables IntelliSense for imported packages. Requires `#js/ts.tsserver.web.projectWideIntellisense.enabled#`. Currently not supported for Safari.","configuration.tsserver.web.typeAcquisition.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsserver.web.typeAcquisition.enabled#` instead.","configuration.tsserver.nodePath":"Run TS Server on a custom Node installation. This can be a path to a Node executable, or `node` if you want VS Code to detect a Node installation.","configuration.tsserver.nodePath.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsserver.node.path#` instead.","configuration.tsserver.watchOptions.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsserver.watchOptions#` instead.","configuration.updateImportsOnPaste":"Automatically update imports when pasting code. Requires TypeScript 5.6+.","configuration.updateImportsOnPaste.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.updateImportsOnPaste.enabled#` instead.","configuration.hover.maximumLength":"The maximum number of characters in a hover. If the hover is longer than this, it will be truncated. Requires TypeScript 5.9+.","walkthroughs.nodejsWelcome.title":"Get started with JavaScript and Node.js","walkthroughs.nodejsWelcome.description":"Make the most of Visual Studio Code's first-class JavaScript experience.","walkthroughs.nodejsWelcome.downloadNode.forMacOrWindows.title":"Install Node.js","walkthroughs.nodejsWelcome.downloadNode.forMacOrWindows.description":`Node.js is an easy way to run JavaScript code. You can use it to quickly build command-line apps and servers. It also comes with npm, a package manager which makes reusing and sharing JavaScript code easy.
[Install Node.js](https://nodejs.org/en/download/)`,"walkthroughs.nodejsWelcome.downloadNode.forLinux.title":"Install Node.js","walkthroughs.nodejsWelcome.downloadNode.forLinux.description":`Node.js is an easy way to run JavaScript code. You can use it to quickly build command-line apps and servers. It also comes with npm, a package manager which makes reusing and sharing JavaScript code easy.
[Install Node.js](https://nodejs.org/en/download/package-manager/)`,"walkthroughs.nodejsWelcome.makeJsFile.title":"Create a JavaScript File","walkthroughs.nodejsWelcome.makeJsFile.description":"Let's write our first JavaScript file. We'll have to create a new file and save it with the ``.js`` extension at the end of the file name.\n[Create a JavaScript File](command:javascript-walkthrough.commands.createJsFile)","walkthroughs.nodejsWelcome.debugJsFile.title":"Run and Debug your JavaScript","walkthroughs.nodejsWelcome.debugJsFile.description":"Once you've installed Node.js, you can run JavaScript programs at a terminal by entering ``node your-file-name.js``\nAnother easy way to run Node.js programs is by using VS Code's debugger which lets you run your code, pause at different points, and help you understand what's going on step-by-step.\n[Start Debugging](command:javascript-walkthrough.commands.debugJsFile)","walkthroughs.nodejsWelcome.debugJsFile.altText":"Debug and run your JavaScript code in Node.js with Visual Studio Code.","walkthroughs.nodejsWelcome.learnMoreAboutJs.title":"Explore More","walkthroughs.nodejsWelcome.learnMoreAboutJs.description":`Want to get more comfortable with JavaScript, Node.js, and VS Code? Be sure to check out our docs!
We've got lots of resources for learning [JavaScript](https://code.visualstudio.com/docs/nodejs/working-with-javascript) and [Node.js](https://code.visualstudio.com/docs/nodejs/nodejs-tutorial).

[Learn More](https://code.visualstudio.com/docs/nodejs/nodejs-tutorial)`,"walkthroughs.nodejsWelcome.learnMoreAboutJs.altText":"Learn more about JavaScript and Node.js in Visual Studio Code."},readmePath:"typescript-language-features/README.md"},{extensionPath:"vb",packageJSON:{name:"vb",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin textmate/asp.vb.net.tmbundle Syntaxes/ASP%20VB.net.plist ./syntaxes/asp-vb-net.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"vb",extensions:[".vb",".brs",".vbs",".bas",".vba"],aliases:["Visual Basic","vb"],configuration:"./language-configuration.json"}],grammars:[{language:"vb",scopeName:"source.asp.vb.net",path:"./syntaxes/asp-vb-net.tmLanguage.json"}],snippets:[{language:"vb",path:"./snippets/vb.code-snippets"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Visual Basic Language Basics",description:"Provides snippets, syntax highlighting, bracket matching and folding in Visual Basic files."}},{extensionPath:"xml",packageJSON:{name:"xml",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},categories:["Programming Languages"],contributes:{languages:[{id:"xml",extensions:[".xml",".xsd",".ascx",".atom",".axml",".axaml",".bpmn",".cpt",".csl",".csproj",".csproj.user",".dita",".ditamap",".dtd",".ent",".mod",".dtml",".fsproj",".fxml",".iml",".isml",".jmx",".launch",".menu",".mxml",".nuspec",".opml",".owl",".proj",".props",".pt",".publishsettings",".pubxml",".pubxml.user",".rbxlx",".rbxmx",".rdf",".rng",".rss",".shproj",".slnx",".storyboard",".svg",".targets",".tld",".tmx",".vbproj",".vbproj.user",".vcxproj",".vcxproj.filters",".wsdl",".wxi",".wxl",".wxs",".xaml",".xbl",".xib",".xlf",".xliff",".xpdl",".xul",".xoml"],firstLine:"(\\<\\?xml.*)|(\\<svg)|(\\<\\!doctype\\s+svg)",aliases:["XML","xml"],configuration:"./xml.language-configuration.json"},{id:"xsl",extensions:[".xsl",".xslt"],aliases:["XSL","xsl"],configuration:"./xsl.language-configuration.json"}],grammars:[{language:"xml",scopeName:"text.xml",path:"./syntaxes/xml.tmLanguage.json"},{language:"xsl",scopeName:"text.xml.xsl",path:"./syntaxes/xsl.tmLanguage.json"}]},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin atom/language-xml grammars/xml.cson ./syntaxes/xml.tmLanguage.json grammars/xsl.cson ./syntaxes/xsl.tmLanguage.json"},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"XML Language Basics",description:"Provides syntax highlighting and bracket matching in XML files."}},{extensionPath:"yaml",packageJSON:{name:"yaml",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ./build/update-grammar.js"},categories:["Programming Languages"],contributes:{languages:[{id:"dockercompose",aliases:["Compose","compose"],filenamePatterns:["compose.yml","compose.yaml","compose.*.yml","compose.*.yaml","*docker*compose*.yml","*docker*compose*.yaml"],configuration:"./language-configuration.json"},{id:"yaml",aliases:["YAML","yaml"],extensions:[".yaml",".yml",".eyaml",".eyml",".cff",".yaml-tmlanguage",".yaml-tmpreferences",".yaml-tmtheme",".winget"],firstLine:"^#cloud-config",configuration:"./language-configuration.json"}],grammars:[{language:"dockercompose",scopeName:"source.yaml",path:"./syntaxes/yaml.tmLanguage.json"},{scopeName:"source.yaml.1.3",path:"./syntaxes/yaml-1.3.tmLanguage.json"},{scopeName:"source.yaml.1.2",path:"./syntaxes/yaml-1.2.tmLanguage.json"},{scopeName:"source.yaml.1.1",path:"./syntaxes/yaml-1.1.tmLanguage.json"},{scopeName:"source.yaml.1.0",path:"./syntaxes/yaml-1.0.tmLanguage.json"},{scopeName:"source.yaml.embedded",path:"./syntaxes/yaml-embedded.tmLanguage.json"},{language:"yaml",scopeName:"source.yaml",path:"./syntaxes/yaml.tmLanguage.json",unbalancedBracketScopes:["invalid.illegal","meta.scalar.yaml","storage.type.tag.shorthand.yaml","keyword.control.flow"]}],configurationDefaults:{"[yaml]":{"editor.insertSpaces":!0,"editor.tabSize":2,"editor.autoIndent":"advanced","diffEditor.ignoreTrimWhitespace":!1,"editor.defaultColorDecorators":"never","editor.quickSuggestions":{strings:"on"}},"[dockercompose]":{"editor.insertSpaces":!0,"editor.tabSize":2,"editor.autoIndent":"advanced"}}},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"YAML Language Basics",description:"Provides syntax highlighting and bracket matching in YAML files."}}];else{let c=ut.document.getElementById("vscode-workbench-builtin-extensions"),u=c?c.getAttribute("data-settings"):void 0;if(u)try{l=JSON.parse(u)}catch{}}this.builtinExtensionsPromises=l.map(async c=>{let u=Qf(c.packageJSON.publisher,c.packageJSON.name);return{identifier:{id:u},location:e.extUri.joinPath(s,c.extensionPath),type:0,isBuiltin:!0,manifest:c.packageNLS?await this.localizeManifest(u,c.packageJSON,c.packageNLS):c.packageJSON,readmeUrl:c.readmePath?e.extUri.joinPath(s,c.readmePath):void 0,changelogUrl:c.changelogPath?e.extUri.joinPath(s,c.changelogPath):void 0,targetPlatform:"web",validations:[],isValid:!0,preRelease:!1}})}}}async scanBuiltinExtensions(){return[...await Promise.all(this.builtinExtensionsPromises)]}async localizeManifest(i,e,t){if(!this.nlsUrl)return QRe(this.logService,e,t);let o=A.joinPath(this.nlsUrl,i,"package");try{let n=await this.extensionResourceLoaderService.readExtensionResource(o),r=JSON.parse(n.toString());return QRe(this.logService,e,r,t)}catch(n){return this.logService.error(n),QRe(this.logService,e,t)}}};BZe=I([m(0,At),m(1,ht),m(2,mk),m(3,tt),m(4,se)],BZe);Ee(rYi,BZe,1);var BD=le("extensionRecommendationsService"),Ok=le("IExtensionIgnoredRecommendationsService");var Cme=".vscode/extensions.json",Z2=le("IWorkspaceExtensionsConfigService"),HZe=class extends x{constructor(e,t,o,n,r,s){super();this.workspaceContextService=e;this.fileService=t;this.quickInputService=o;this.modelService=n;this.languageService=r;this.jsonEditingService=s;this._onDidChangeExtensionsConfigs=this._register(new E);this.onDidChangeExtensionsConfigs=this._onDidChangeExtensionsConfigs.event;this._register(e.onDidChangeWorkspaceFolders(l=>this._onDidChangeExtensionsConfigs.fire())),this._register(t.onDidFilesChange(l=>{let c=e.getWorkspace();(c.configuration&&l.affects(c.configuration)||c.folders.some(u=>l.affects(u.toResource(Cme))))&&this._onDidChangeExtensionsConfigs.fire()}))}async getExtensionsConfigs(){let e=this.workspaceContextService.getWorkspace(),t=[],o=e.configuration?await this.resolveWorkspaceExtensionConfig(e.configuration):void 0;return o&&t.push(o),t.push(...await Promise.all(e.folders.map(n=>this.resolveWorkspaceFolderExtensionConfig(n)))),t}async getRecommendations(){let e=await this.getExtensionsConfigs();return zo(e.flatMap(t=>t.recommendations?t.recommendations.map(o=>o.toLowerCase()):[]))}async getUnwantedRecommendations(){let e=await this.getExtensionsConfigs();return zo(e.flatMap(t=>t.unwantedRecommendations?t.unwantedRecommendations.map(o=>o.toLowerCase()):[]))}async toggleRecommendation(e){e=e.toLowerCase();let t=this.workspaceContextService.getWorkspace(),o=t.configuration?await this.resolveWorkspaceExtensionConfig(t.configuration):void 0,n=new gt;await Promise.all(t.folders.map(async u=>{let p=await this.resolveWorkspaceFolderExtensionConfig(u);n.set(u.uri,p)}));let r=o&&o.recommendations?.some(u=>u.toLowerCase()===e),s=t.folders.filter(u=>n.get(u.uri)?.recommendations?.some(p=>p.toLowerCase()===e)),l=r||s.length>0,c=l?await this.pickWorkspaceOrFolders(s,r?t:void 0,d(17640,null)):await this.pickWorkspaceOrFolders(t.folders,t.configuration?t:void 0,d(17639,null));for(let u of c)Xj(u)?await this.addOrRemoveWorkspaceRecommendation(e,u,o,!l):await this.addOrRemoveWorkspaceFolderRecommendation(e,u,n.get(u.uri),!l)}async toggleUnwantedRecommendation(e){let t=this.workspaceContextService.getWorkspace(),o=t.configuration?await this.resolveWorkspaceExtensionConfig(t.configuration):void 0,n=new gt;await Promise.all(t.folders.map(async u=>{let p=await this.resolveWorkspaceFolderExtensionConfig(u);n.set(u.uri,p)}));let r=o&&o.unwantedRecommendations?.some(u=>u===e),s=t.folders.filter(u=>n.get(u.uri)?.unwantedRecommendations?.some(p=>p===e)),l=r||s.length>0,c=l?await this.pickWorkspaceOrFolders(s,r?t:void 0,d(17640,null)):await this.pickWorkspaceOrFolders(t.folders,t.configuration?t:void 0,d(17639,null));for(let u of c)Xj(u)?await this.addOrRemoveWorkspaceUnwantedRecommendation(e,u,o,!l):await this.addOrRemoveWorkspaceFolderUnwantedRecommendation(e,u,n.get(u.uri),!l)}async addOrRemoveWorkspaceFolderRecommendation(e,t,o,n){let r=[];if(n){Array.isArray(o.recommendations)?r.push({path:["recommendations",-1],value:e}):r.push({path:["recommendations"],value:[e]});let s=this.getEditToRemoveValueFromArray(["unwantedRecommendations"],o.unwantedRecommendations,e);s&&r.push(s)}else if(o.recommendations){let s=this.getEditToRemoveValueFromArray(["recommendations"],o.recommendations,e);s&&r.push(s)}if(r.length)return this.jsonEditingService.write(t.toResource(Cme),r,!0)}async addOrRemoveWorkspaceRecommendation(e,t,o,n){let r=[];if(o){if(n){let s=["extensions","recommendations"];Array.isArray(o.recommendations)?r.push({path:[...s,-1],value:e}):r.push({path:s,value:[e]});let l=this.getEditToRemoveValueFromArray(["extensions","unwantedRecommendations"],o.unwantedRecommendations,e);l&&r.push(l)}else if(o.recommendations){let s=this.getEditToRemoveValueFromArray(["extensions","recommendations"],o.recommendations,e);s&&r.push(s)}}else n&&r.push({path:["extensions"],value:{recommendations:[e]}});if(r.length)return this.jsonEditingService.write(t.configuration,r,!0)}async addOrRemoveWorkspaceFolderUnwantedRecommendation(e,t,o,n){let r=[];if(n){let s=["unwantedRecommendations"];Array.isArray(o.unwantedRecommendations)?r.push({path:[...s,-1],value:e}):r.push({path:s,value:[e]});let l=this.getEditToRemoveValueFromArray(["recommendations"],o.recommendations,e);l&&r.push(l)}else if(o.unwantedRecommendations){let s=this.getEditToRemoveValueFromArray(["unwantedRecommendations"],o.unwantedRecommendations,e);s&&r.push(s)}if(r.length)return this.jsonEditingService.write(t.toResource(Cme),r,!0)}async addOrRemoveWorkspaceUnwantedRecommendation(e,t,o,n){let r=[];if(o){if(n){let s=["extensions","unwantedRecommendations"];Array.isArray(o.recommendations)?r.push({path:[...s,-1],value:e}):r.push({path:s,value:[e]});let l=this.getEditToRemoveValueFromArray(["extensions","recommendations"],o.recommendations,e);l&&r.push(l)}else if(o.unwantedRecommendations){let s=this.getEditToRemoveValueFromArray(["extensions","unwantedRecommendations"],o.unwantedRecommendations,e);s&&r.push(s)}}else n&&r.push({path:["extensions"],value:{unwantedRecommendations:[e]}});if(r.length)return this.jsonEditingService.write(t.configuration,r,!0)}async pickWorkspaceOrFolders(e,t,o){let n=t?[...e,t]:[...e];if(n.length===1)return n;let r=e.map(l=>({label:l.name,description:d(17642,null),workspaceOrFolder:l,iconClasses:aa(this.modelService,this.languageService,l.uri,2)}));return t&&(r.push({type:"separator"}),r.push({label:d(17641,null),workspaceOrFolder:t})),(await this.quickInputService.pick(r,{placeHolder:o,canPickMany:!0})||[]).map(l=>l.workspaceOrFolder)}async resolveWorkspaceExtensionConfig(e){try{let t=await this.fileService.readFile(e),o=jr(t.value.toString()).extensions;return o?this.parseExtensionConfig(o):void 0}catch{}}async resolveWorkspaceFolderExtensionConfig(e){try{let t=await this.fileService.readFile(e.toResource(Cme)),o=jr(t.value.toString());return this.parseExtensionConfig(o)}catch{}return{}}parseExtensionConfig(e){return{recommendations:zo((e.recommendations||[]).map(t=>t.toLowerCase())),unwantedRecommendations:zo((e.unwantedRecommendations||[]).map(t=>t.toLowerCase()))}}getEditToRemoveValueFromArray(e,t,o){let n=t?.indexOf(o);if(n!==void 0&&n!==-1)return{path:[...e,n],value:void 0}}};HZe=I([m(0,Pe),m(1,fe),m(2,Ue),m(3,Tt),m(4,_t),m(5,bg)],HZe);Ee(Z2,HZe,1);var nxi="extensionsAssistant/ignored_recommendations",UZe=class extends x{constructor(e,t){super();this.workspaceExtensionsConfigService=e;this.storageService=t;this._onDidChangeIgnoredRecommendations=this._register(new E);this.onDidChangeIgnoredRecommendations=this._onDidChangeIgnoredRecommendations.event;this._globalIgnoredRecommendations=[];this._onDidChangeGlobalIgnoredRecommendation=this._register(new E);this.onDidChangeGlobalIgnoredRecommendation=this._onDidChangeGlobalIgnoredRecommendation.event;this.ignoredWorkspaceRecommendations=[];this._globalIgnoredRecommendations=this.getCachedIgnoredRecommendations(),this._register(this.storageService.onDidChangeValue(0,nxi,this._store)(()=>this.onDidStorageChange())),this.initIgnoredWorkspaceRecommendations()}get globalIgnoredRecommendations(){return[...this._globalIgnoredRecommendations]}get ignoredRecommendations(){return zo([...this.globalIgnoredRecommendations,...this.ignoredWorkspaceRecommendations])}async initIgnoredWorkspaceRecommendations(){this.ignoredWorkspaceRecommendations=await this.workspaceExtensionsConfigService.getUnwantedRecommendations(),this._onDidChangeIgnoredRecommendations.fire(),this._register(this.workspaceExtensionsConfigService.onDidChangeExtensionsConfigs(async()=>{this.ignoredWorkspaceRecommendations=await this.workspaceExtensionsConfigService.getUnwantedRecommendations(),this._onDidChangeIgnoredRecommendations.fire()}))}toggleGlobalIgnoredRecommendation(e,t){e=e.toLowerCase(),this._globalIgnoredRecommendations.indexOf(e)!==-1!==t&&(this._globalIgnoredRecommendations=t?[...this._globalIgnoredRecommendations,e]:this._globalIgnoredRecommendations.filter(n=>n!==e),this.storeCachedIgnoredRecommendations(this._globalIgnoredRecommendations),this._onDidChangeGlobalIgnoredRecommendation.fire({extensionId:e,isRecommended:!t}),this._onDidChangeIgnoredRecommendations.fire())}getCachedIgnoredRecommendations(){return JSON.parse(this.ignoredRecommendationsValue).map(t=>t.toLowerCase())}onDidStorageChange(){this.ignoredRecommendationsValue!==this.getStoredIgnoredRecommendationsValue()&&(this._ignoredRecommendationsValue=void 0,this._globalIgnoredRecommendations=this.getCachedIgnoredRecommendations(),this._onDidChangeIgnoredRecommendations.fire())}storeCachedIgnoredRecommendations(e){this.ignoredRecommendationsValue=JSON.stringify(e)}get ignoredRecommendationsValue(){return this._ignoredRecommendationsValue||(this._ignoredRecommendationsValue=this.getStoredIgnoredRecommendationsValue()),this._ignoredRecommendationsValue}set ignoredRecommendationsValue(e){this.ignoredRecommendationsValue!==e&&(this._ignoredRecommendationsValue=e,this.setStoredIgnoredRecommendationsValue(e))}getStoredIgnoredRecommendationsValue(){return this.storageService.get(nxi,0,"[]")}setStoredIgnoredRecommendationsValue(e){this.storageService.store(nxi,e,0,0)}};UZe=I([m(0,Z2),m(1,ce)],UZe);Ee(Ok,UZe,1);var rxi="extension.features.state",zZe=class extends x{constructor(e,t,o){super();this.storageService=e;this.dialogService=t;this.extensionService=o;this._onDidChangeEnablement=this._register(new E);this.onDidChangeEnablement=this._onDidChangeEnablement.event;this._onDidChangeAccessData=this._register(new E);this.onDidChangeAccessData=this._onDidChangeAccessData.event;this.extensionFeaturesState=new Map;this.registry=ne.as(As.ExtensionFeaturesRegistry),this.extensionFeaturesState=this.loadState(),this.garbageCollectOldRequests(),this._register(e.onDidChangeValue(0,rxi,this._store)(n=>this.onDidStorageChange(n)))}isEnabled(e,t){let o=this.registry.getExtensionFeature(t);if(!o)return!1;let n=this.getExtensionFeatureState(e,t)?.disabled;if(Wa(n))return!n;let r=o.access.extensionsList?.[e._lower];return Wa(r)?r:!o.access.requireUserConsent}setEnablement(e,t,o){if(!this.registry.getExtensionFeature(t))throw new Error(`No feature with id '${t}'`);let r=this.getAndSetIfNotExistsExtensionFeatureState(e,t);r.disabled!==!o&&(r.disabled=!o,this._onDidChangeEnablement.fire({extension:e,featureId:t,enabled:o}),this.saveState())}getEnablementData(e){let t=[];if(this.registry.getExtensionFeature(e))for(let[n,r]of this.extensionFeaturesState){let s=r.get(e);s?.disabled!==void 0&&t.push({extension:new Ii(n),enabled:!s.disabled})}return t}async getAccess(e,t,o){let n=this.registry.getExtensionFeature(t);if(!n)return!1;let r=this.getAndSetIfNotExistsExtensionFeatureState(e,t);if(r.disabled)return!1;if(r.disabled===void 0){let l=!0;if(n.access.requireUserConsent){let c=this.extensionService.extensions.find(p=>Ii.equals(p.identifier,e));l=(await this.dialogService.confirm({title:d(17583,null,n.label),message:d(17584,null,c?.displayName??e._lower,n.label),detail:o??n.description,custom:!0,primaryButton:d(17585,null),cancelButton:d(17586,null)})).confirmed}if(this.setEnablement(e,t,l),!l)return!1}let s=new Date;return r.accessData.current={accessTimes:[s].concat(r.accessData.current?.accessTimes??[]),lastAccessed:s,status:r.accessData.current?.status},r.accessData.accessTimes=(r.accessData.accessTimes??[]).concat(s),this.saveState(),this._onDidChangeAccessData.fire({extension:e,featureId:t,accessData:r.accessData}),!0}getAllAccessDataForExtension(e){let t=new Map,o=this.extensionFeaturesState.get(e._lower);if(o)for(let[n,r]of o)t.set(n,r.accessData);return t}getAccessData(e,t){if(this.registry.getExtensionFeature(t))return this.getExtensionFeatureState(e,t)?.accessData}setStatus(e,t,o){if(!this.registry.getExtensionFeature(t))throw new Error(`No feature with id '${t}'`);let r=this.getAndSetIfNotExistsExtensionFeatureState(e,t);r.accessData.current={accessTimes:r.accessData.current?.accessTimes??[],lastAccessed:r.accessData.current?.lastAccessed??new Date,status:o},this._onDidChangeAccessData.fire({extension:e,featureId:t,accessData:this.getAccessData(e,t)})}getExtensionFeatureState(e,t){return this.extensionFeaturesState.get(e._lower)?.get(t)}getAndSetIfNotExistsExtensionFeatureState(e,t){let o=this.extensionFeaturesState.get(e._lower);o||(o=new Map,this.extensionFeaturesState.set(e._lower,o));let n=o.get(t);return n||(n={accessData:{accessTimes:[]}},o.set(t,n)),n}onDidStorageChange(e){if(e.external){let t=this.extensionFeaturesState;this.extensionFeaturesState=this.loadState();for(let o of zo([...t.keys(),...this.extensionFeaturesState.keys()])){let n=new Ii(o),r=t.get(o),s=this.extensionFeaturesState.get(o);for(let l of zo([...r?.keys()??[],...s?.keys()??[]])){let c=this.isEnabled(n,l),u=!r?.get(l)?.disabled;c!==u&&this._onDidChangeEnablement.fire({extension:n,featureId:l,enabled:c});let p=this.getAccessData(n,l),h=r?.get(l)?.accessData;eo(p,h)||this._onDidChangeAccessData.fire({extension:n,featureId:l,accessData:p??{accessTimes:[]}})}}}}loadState(){let e={},t=this.storageService.get(rxi,0,"{}");try{e=JSON.parse(t)}catch{}let o=new Map;for(let n in e){let r=new Map,s=e[n];for(let l in s){let c=s[l];r.set(l,{disabled:c.disabled,accessData:{accessTimes:(c.accessTimes??[]).map(u=>new Date(u))}})}o.set(n.toLowerCase(),r)}return o}saveState(){let e={};this.extensionFeaturesState.forEach((t,o)=>{let n={};t.forEach((r,s)=>{n[s]={disabled:r.disabled,accessTimes:r.accessData.accessTimes.map(l=>l.getTime())}}),e[o]=n}),this.storageService.store(rxi,JSON.stringify(e),0,0)}garbageCollectOldRequests(){let e=new Date,t=new Date(e.setDate(e.getDate()-30)),o=!1;for(let[,n]of this.extensionFeaturesState)for(let[,r]of n){let s=r.accessData.accessTimes.length;r.accessData.accessTimes=r.accessData.accessTimes.filter(l=>l>t),r.accessData.accessTimes.length!==s&&(o=!0)}o&&this.saveState()}};zZe=I([m(0,ce),m(1,at),m(2,lt)],zZe);Ee(cy,zZe,1);var eG=class extends x{constructor(e){super();this.storageService=e;this.model=this._register(new COt);this._onDidChangeFilter=this._register(new E);this.onDidChangeFilter=this._onDidChangeFilter.event;this.mapSourceToFilter=(()=>{let t=new Map;for(let o of this.storageService.getObject(eG.PER_SOURCE_FILTER_SETTINGS_KEY,-1,[]))t.set(o.id,o);return t})(),this.globalFilterEnabled=this.storageService.getBoolean(eG.GLOBAL_FILTER_SETTINGS_KEY,-1,!1),this.updateFilters(),this.registerListeners()}registerListeners(){this._register(this.model.onDidChangeNotification(e=>{if(e.kind===0){let t=typeof e.item.sourceId=="string"&&typeof e.item.source=="string"?{id:e.item.sourceId,label:e.item.source}:e.item.source;H7(t)&&(this.mapSourceToFilter.has(t.id)?this.updateSourceFilter(t):this.setFilter({...t,filter:0}))}}))}static{this.GLOBAL_FILTER_SETTINGS_KEY="notifications.doNotDisturbMode"}static{this.PER_SOURCE_FILTER_SETTINGS_KEY="notifications.perSourceDoNotDisturbMode"}setFilter(e){if(typeof e=="number"){if(this.globalFilterEnabled===(e===1))return;this.globalFilterEnabled=e===1,this.storageService.store(eG.GLOBAL_FILTER_SETTINGS_KEY,this.globalFilterEnabled,-1,1),this.updateFilters(),this._onDidChangeFilter.fire()}else{let t=this.mapSourceToFilter.get(e.id);if(t?.filter===e.filter&&t.label===e.label)return;this.mapSourceToFilter.set(e.id,{id:e.id,label:e.label,filter:e.filter}),this.saveSourceFilters(),this.updateFilters()}}getFilter(e){return e?this.mapSourceToFilter.get(e.id)?.filter??0:this.globalFilterEnabled?1:0}updateSourceFilter(e){let t=this.mapSourceToFilter.get(e.id);t&&t.label!==e.label&&(this.mapSourceToFilter.set(e.id,{id:e.id,label:e.label,filter:t.filter}),this.saveSourceFilters())}saveSourceFilters(){this.storageService.store(eG.PER_SOURCE_FILTER_SETTINGS_KEY,JSON.stringify([...this.mapSourceToFilter.values()]),-1,1)}getFilters(){return[...this.mapSourceToFilter.values()]}updateFilters(){this.model.setFilter({global:this.globalFilterEnabled?1:0,sources:new Map([...this.mapSourceToFilter.values()].map(e=>[e.id,e.filter]))})}removeFilter(e){this.mapSourceToFilter.delete(e)&&(this.saveSourceFilters(),this.updateFilters())}info(e){if(Array.isArray(e)){for(let t of e)this.info(t);return}this.model.addNotification({severity:ft.Info,message:e})}warn(e){if(Array.isArray(e)){for(let t of e)this.warn(t);return}this.model.addNotification({severity:ft.Warning,message:e})}error(e){if(Array.isArray(e)){for(let t of e)this.error(t);return}this.model.addNotification({severity:ft.Error,message:e})}notify(e){let t=new N;if(e.neverShowAgain){let n=this.toStorageScope(e.neverShowAgain),r=e.neverShowAgain.id;if(this.storageService.getBoolean(r,n))return new Lle;let s=t.add(new it("workbench.notification.neverShowAgain",d(17874,null),void 0,!0,async()=>{o.close(),this.storageService.store(r,!0,n,0)})),l={primary:e.actions?.primary||[],secondary:e.actions?.secondary||[]};e.neverShowAgain.isSecondary?l.secondary=[...l.secondary,s]:l.primary=[s,...l.primary],e.actions=l}let o=this.model.addNotification(e);return U.once(o.onDidClose)(()=>t.dispose()),o}toStorageScope(e){switch(e.scope){case 2:return-1;case 1:return 0;case 0:return 1;default:return-1}}prompt(e,t,o,n){if(n?.neverShowAgain){let h=this.toStorageScope(n.neverShowAgain),g=n.neverShowAgain.id;if(this.storageService.getBoolean(g,h))return new Lle;let f={label:d(17874,null),run:()=>this.storageService.store(g,!0,h,0),isSecondary:n.neverShowAgain.isSecondary};n.neverShowAgain.isSecondary?o=[...o,f]:o=[f,...o]}let r=!1,s=new N,l=[],c=[];o.forEach((h,g)=>{let f=new kpe(`workbench.dialog.choice.${g}`,h);h.isSecondary?c.push(f):l.push(f),s.add(f.onDidRun(()=>{r=!0,h.keepOpen||p.close()})),s.add(f)});let u={primary:l,secondary:c},p=this.notify({severity:e,message:t,actions:u,sticky:n?.sticky,priority:n?.priority});return U.once(p.onDidClose)(()=>{s.dispose(),n&&typeof n.onCancel=="function"&&!r&&n.onCancel()}),p}status(e,t){return this.model.showStatusMessage(e,t)}};eG=I([m(0,ce)],eG);Ee(Ne,eG,1);var KZe=class{constructor(i,e,t,o){this.keybindingsService=i;this.textModelService=e;this.textResourcePropertiesService=t;this.textResourceConfigurationService=o}async resolveDefaultCoreIgnoredSettings(){return Iee(!0)}async resolveUserBindings(i){let e={};for(let t of i)e[t]=this.keybindingsService.resolveUserBinding(t).map(o=>o.getUserSettingsLabel()).join(" ");return e}async resolveFormattingOptions(i){try{let e=await this.textModelService.createModelReference(i),{insertSpaces:t,tabSize:o}=e.object.textEditorModel.getOptions(),n=e.object.textEditorModel.getEOL();return e.dispose(),{eol:n,insertSpaces:t,tabSize:o}}catch{}return{eol:this.textResourcePropertiesService.getEOL(i),insertSpaces:!!this.textResourceConfigurationService.getValue(i,"editor.insertSpaces"),tabSize:this.textResourceConfigurationService.getValue(i,"editor.tabSize")}}};KZe=I([m(0,_e),m(1,Bt),m(2,KL),m(3,Fn)],KZe);Ee(wee,KZe,1);function YRe(a,i,e,t){let o=Mb(a,i,e,t)[0];return o&&(a=a.substring(0,o.offset)+o.content+a.substring(o.offset+o.length)),a}function XVt(a,i,e){let t=[];e?t=X7o(e):t=Y7o(i);let o=[],n=[...qVt()];if(Array.isArray(t))for(let r of t)r.startsWith("-")?n.push(r.substring(1)):o.push(r);return zo([...a,...o].filter(r=>!n.includes(r)))}function Y7o(a){let i=a.inspect("settingsSync.ignoredSettings").userValue;return i!==void 0||(i=a.inspect("sync.ignoredSettings").userValue,i!==void 0)?i:a.getValue("settingsSync.ignoredSettings")||[]}function X7o(a){let i=jr(a);return i?i["settingsSync.ignoredSettings"]||i["sync.ignoredSettings"]||[]:[]}function lxi(a,i,e,t){if(e.length){let o=axi(i),n=jr(i)||{},r=jr(a);if(!r)return a;let s=[];for(let l of e){let c=n[l],u=r[l];c===void 0?a=YRe(a,[l],void 0,t):u!==void 0?a=YRe(a,[l],c,t):s.push(GZe(l,o))}s.sort((l,c)=>l.startOffset-c.startOffset),s.forEach(l=>a=J7o(l.setting.key,i,a,t))}return a}function J7o(a,i,e,t){let o=jr(i),n=axi(i),r=axi(e),s=Z7o(a,n,r);return eYo(e,a,o[a],s,r,t)}function Z7o(a,i,e){let t=i.findIndex(n=>n.setting?.key===a),o=i[t-1];if(o){if(o.setting){let r=GZe(o.setting.key,e);if(r)return{index:e.indexOf(r),insertAfter:!0}}else{let r=sxi(t,i);if(r){let s=GZe(r.setting.key,e);if(s){let l=YVt(e.indexOf(s),e),c=XRe(i,r,i[t]);if(l){let u=XRe(e,s,l),p=QVt(c,u);return p?{index:e.indexOf(p),insertAfter:!0}:{index:e.indexOf(l),insertAfter:!1}}else{let u=XRe(e,s,e[e.length-1]),p=QVt(c,u);return p?{index:e.indexOf(p),insertAfter:!0}:{index:e.length-1,insertAfter:!0}}}}}let n=i[t+1];if(n)if(n.setting){let r=GZe(n.setting.key,e);if(r)return{index:e.indexOf(r),insertAfter:!1}}else{let r=YVt(t,i);if(r){let s=GZe(r.setting.key,e);if(s){let l=sxi(e.indexOf(s),e),c=XRe(i,i[t],r);if(l){let u=XRe(e,l,s),p=QVt(c.reverse(),u.reverse());return p?{index:e.indexOf(p),insertAfter:!1}:{index:e.indexOf(l),insertAfter:!0}}else{let u=XRe(e,e[0],s),p=QVt(c.reverse(),u.reverse());return p?{index:e.indexOf(p),insertAfter:!1}:{index:0,insertAfter:!1}}}}}}return{index:e.length-1,insertAfter:!0}}function eYo(a,i,e,t,o,n){let r;return t.index===-1?r=Mb(a,[i],e,n):r=tYo(a,i,e,t,o,n).map(s=>hZ(a,s,n)[0]),rpe(a,r)}function tYo(a,i,e,t,o,n){let r=`${JSON.stringify(i)}: ${JSON.stringify(e)}`,s=Abi(n,a),l=o[t.index];if(t.insertAfter){let c=[];if(l.setting)c.push({offset:l.endOffset,length:0,content:","+r});else{let u=YVt(t.index,o),p=sxi(t.index,o),h=p?.setting?.commaOffset;p&&h===void 0&&c.push({offset:p.endOffset,length:0,content:","});let g=h!==void 0&&h>l.endOffset;c.push({offset:g?h+1:l.endOffset,length:0,content:u?s+r+",":s+r})}return c}else{if(l.setting)return[{offset:l.startOffset,length:0,content:r+","}];let c=(o[t.index-1]&&!o[t.index-1].setting?s:"")+r+(YVt(t.index,o)?",":"")+s;return[{offset:l.startOffset,length:0,content:c}]}}function GZe(a,i){return i.filter(e=>e.setting?.key===a)[0]}function sxi(a,i){for(let e=a-1;e>=0;e--)if(i[e].setting)return i[e]}function YVt(a,i){for(let e=a+1;e<i.length;e++)if(i[e].setting)return i[e]}function XRe(a,i,e){let t=a.indexOf(i),o=a.indexOf(e);return a.filter((n,r)=>t<r&&r<o)}function QVt(a,i){if(a.length&&i.length){let e=0;for(;e<i.length&&e<a.length;e++)if(a[e].value!==i[e].value)return i[e-1];return i[e-1]}}function axi(a){let i=[],e=-1,t,o;return uk(a,{onObjectBegin:r=>{e++},onObjectProperty:(r,s,l)=>{e===0&&(t=s,o=r)},onObjectEnd:(r,s)=>{e--,e===0&&i.push({startOffset:t,endOffset:r+s,value:a.substring(t,r+s),setting:{key:o,commaOffset:void 0}})},onArrayBegin:(r,s)=>{e++},onArrayEnd:(r,s)=>{e--,e===0&&i.push({startOffset:t,endOffset:r+s,value:a.substring(t,r+s),setting:{key:o,commaOffset:void 0}})},onLiteralValue:(r,s,l)=>{e===0&&i.push({startOffset:t,endOffset:s+l,value:a.substring(t,s+l),setting:{key:o,commaOffset:void 0}})},onSeparator:(r,s,l)=>{if(e===0&&r===","){let c=i.length-1;for(;c>=0&&!i[c].setting;c--);let u=i[c];u&&i.splice(c,1,{startOffset:u.startOffset,endOffset:u.endOffset,value:u.value,setting:{key:u.setting.key,commaOffset:s}})}},onComment:(r,s)=>{e===0&&i.push({startOffset:r,endOffset:r+s,value:a.substring(r,r+s)})}}),i}var JVt=class{constructor(i,e,t){this.userDataProfileService=i;this.fileService=e;this.logService=t}async initialize(i){let e=JSON.parse(i);if(e.settings===null){this.logService.info("Initializing Profile: No settings to apply...");return}await this.fileService.writeFile(this.userDataProfileService.currentProfile.settingsResource,qe.fromString(e.settings))}};JVt=I([m(0,ln),m(1,fe),m(2,se)],JVt);var N0=class{constructor(i,e,t){this.fileService=i;this.userDataSyncUtilService=e;this.logService=t}async getContent(i){let e=await this.getSettingsContent(i);return JSON.stringify(e)}async getSettingsContent(i){let e=await this.getLocalFileContent(i);if(e===null)return{settings:null};{let t=this.getIgnoredSettings(),o=await this.userDataSyncUtilService.resolveFormattingOptions(i.settingsResource);return{settings:lxi(e||"{}","{}",t,o)}}}async apply(i,e){let t=JSON.parse(i);if(t.settings===null){this.logService.info(`Importing Profile (${e.name}): No settings to apply...`);return}let o=await this.getLocalFileContent(e),n=await this.userDataSyncUtilService.resolveFormattingOptions(e.settingsResource),r=lxi(t.settings,o||"{}",this.getIgnoredSettings(),n);await this.fileService.writeFile(e.settingsResource,qe.fromString(r))}getIgnoredSettings(){let i=ne.as(Jt.Configuration).getConfigurationProperties();return Object.keys(i).filter(t=>i[t]?.scope===2||i[t]?.scope===3||i[t]?.scope===7)}async getLocalFileContent(i){try{return(await this.fileService.readFile(i.settingsResource)).value.toString()}catch(e){if(e instanceof ta&&e.fileOperationResult===1)return null;throw e}}};N0=I([m(0,fe),m(1,wee),m(2,se)],N0);var G3=class{constructor(i,e,t){this.profile=i;this.uriIdentityService=e;this.instantiationService=t;this.type="settings";this.handle="settings";this.label={label:d(18222,null)};this.collapsibleState=2}async getChildren(){return[{handle:this.profile.settingsResource.toString(),resourceUri:this.profile.settingsResource,collapsibleState:0,parent:this,accessibilityInformation:{label:this.uriIdentityService.extUri.basename(this.profile.settingsResource)},command:{id:vg,title:"",arguments:[this.profile.settingsResource,void 0,void 0]}}]}async hasContent(){return(await this.instantiationService.createInstance(N0).getSettingsContent(this.profile)).settings!==null}async getContent(){return this.instantiationService.createInstance(N0).getContent(this.profile)}isFromDefaultProfile(){return!this.profile.isDefault&&!!this.profile.useDefaultFlags?.settings}};G3=I([m(1,ht),m(2,F)],G3);var ZVt=class{constructor(i,e,t){this.userDataProfileService=i;this.fileService=e;this.logService=t}async initialize(i){let e=JSON.parse(i);if(e.keybindings===null){this.logService.info("Initializing Profile: No keybindings to apply...");return}await this.fileService.writeFile(this.userDataProfileService.currentProfile.keybindingsResource,qe.fromString(e.keybindings))}};ZVt=I([m(0,ln),m(1,fe),m(2,se)],ZVt);var O0=class{constructor(i,e){this.fileService=i;this.logService=e}async getContent(i){let e=await this.getKeybindingsResourceContent(i);return JSON.stringify(e)}async getKeybindingsResourceContent(i){return{keybindings:await this.getKeybindingsContent(i),platform:om}}async apply(i,e){let t=JSON.parse(i);if(t.keybindings===null){this.logService.info(`Importing Profile (${e.name}): No keybindings to apply...`);return}await this.fileService.writeFile(e.keybindingsResource,qe.fromString(t.keybindings))}async getKeybindingsContent(i){try{return(await this.fileService.readFile(i.keybindingsResource)).value.toString()}catch(e){if(e instanceof ta&&e.fileOperationResult===1)return null;throw e}}};O0=I([m(0,fe),m(1,se)],O0);var q3=class{constructor(i,e,t){this.profile=i;this.uriIdentityService=e;this.instantiationService=t;this.type="keybindings";this.handle="keybindings";this.label={label:d(18220,null)};this.collapsibleState=2}isFromDefaultProfile(){return!this.profile.isDefault&&!!this.profile.useDefaultFlags?.keybindings}async getChildren(){return[{handle:this.profile.keybindingsResource.toString(),resourceUri:this.profile.keybindingsResource,collapsibleState:0,parent:this,accessibilityInformation:{label:this.uriIdentityService.extUri.basename(this.profile.settingsResource)},command:{id:vg,title:"",arguments:[this.profile.keybindingsResource,void 0,void 0]}}]}async hasContent(){return(await this.instantiationService.createInstance(O0).getKeybindingsResourceContent(this.profile)).keybindings!==null}async getContent(){return this.instantiationService.createInstance(O0).getContent(this.profile)}};q3=I([m(1,ht),m(2,F)],q3);var eBt=class{constructor(i,e,t){this.userDataProfileService=i;this.fileService=e;this.uriIdentityService=t}async initialize(i){let e=JSON.parse(i);for(let t in e.snippets){let o=this.uriIdentityService.extUri.joinPath(this.userDataProfileService.currentProfile.snippetsHome,t);await this.fileService.writeFile(o,qe.fromString(e.snippets[t]))}}};eBt=I([m(0,ln),m(1,fe),m(2,ht)],eBt);var zA=class{constructor(i,e){this.fileService=i;this.uriIdentityService=e}async getContent(i,e){let t=await this.getSnippets(i,e);return JSON.stringify({snippets:t})}async apply(i,e){let t=JSON.parse(i);for(let o in t.snippets){let n=this.uriIdentityService.extUri.joinPath(e.snippetsHome,o);await this.fileService.writeFile(n,qe.fromString(t.snippets[o]))}}async getSnippets(i,e){let t={},o=await this.getSnippetsResources(i,e);for(let n of o){let r=this.uriIdentityService.extUri.relativePath(i.snippetsHome,n),s=await this.fileService.readFile(n);t[r]=s.value.toString()}return t}async getSnippetsResources(i,e){let t=[],o;try{o=await this.fileService.resolve(i.snippetsHome)}catch(n){if(n instanceof ta&&n.fileOperationResult===1)return t;throw n}for(let{resource:n}of o.children||[]){if(e?.has(n))continue;let r=this.uriIdentityService.extUri.extname(n);(r===".json"||r===".code-snippets")&&t.push(n)}return t}};zA=I([m(0,fe),m(1,ht)],zA);var $3=class{constructor(i,e,t){this.profile=i;this.instantiationService=e;this.uriIdentityService=t;this.type="snippets";this.label={label:d(18224,null)};this.collapsibleState=1;this.excludedSnippets=new En;this.handle=this.profile.snippetsHome.toString()}async getChildren(){let i=await this.instantiationService.createInstance(zA).getSnippetsResources(this.profile),e=this;return i.map(t=>({handle:t.toString(),parent:e,resourceUri:t,collapsibleState:0,accessibilityInformation:{label:this.uriIdentityService.extUri.basename(t)},checkbox:e.checkbox?{get isChecked(){return!e.excludedSnippets.has(t)},set isChecked(o){o?e.excludedSnippets.delete(t):e.excludedSnippets.add(t)},accessibilityInformation:{label:d(18223,null,this.uriIdentityService.extUri.basename(t))}}:void 0,command:{id:vg,title:"",arguments:[t,void 0,void 0]}}))}async hasContent(){return(await this.instantiationService.createInstance(zA).getSnippetsResources(this.profile)).length>0}async getContent(){return this.instantiationService.createInstance(zA).getContent(this.profile,this.excludedSnippets)}isFromDefaultProfile(){return!this.profile.isDefault&&!!this.profile.useDefaultFlags?.snippets}};$3=I([m(1,F),m(2,ht)],$3);var tBt=class{constructor(i,e,t){this.userDataProfileService=i;this.fileService=e;this.logService=t}async initialize(i){let e=JSON.parse(i);if(!e.tasks){this.logService.info("Initializing Profile: No tasks to apply...");return}await this.fileService.writeFile(this.userDataProfileService.currentProfile.tasksResource,qe.fromString(e.tasks))}};tBt=I([m(0,ln),m(1,fe),m(2,se)],tBt);var F0=class{constructor(i,e){this.fileService=i;this.logService=e}async getContent(i){let e=await this.getTasksResourceContent(i);return JSON.stringify(e)}async getTasksResourceContent(i){return{tasks:await this.getTasksContent(i)}}async apply(i,e){let t=JSON.parse(i);if(!t.tasks){this.logService.info(`Importing Profile (${e.name}): No tasks to apply...`);return}await this.fileService.writeFile(e.tasksResource,qe.fromString(t.tasks))}async getTasksContent(i){try{return(await this.fileService.readFile(i.tasksResource)).value.toString()}catch(e){if(e instanceof ta&&e.fileOperationResult===1)return null;throw e}}};F0=I([m(0,fe),m(1,se)],F0);var j3=class{constructor(i,e,t){this.profile=i;this.uriIdentityService=e;this.instantiationService=t;this.type="tasks";this.handle="tasks";this.label={label:d(18225,null)};this.collapsibleState=2}async getChildren(){return[{handle:this.profile.tasksResource.toString(),resourceUri:this.profile.tasksResource,collapsibleState:0,parent:this,accessibilityInformation:{label:this.uriIdentityService.extUri.basename(this.profile.settingsResource)},command:{id:vg,title:"",arguments:[this.profile.tasksResource,void 0,void 0]}}]}async hasContent(){return(await this.instantiationService.createInstance(F0).getTasksResourceContent(this.profile)).tasks!==null}async getContent(){return this.instantiationService.createInstance(F0).getContent(this.profile)}isFromDefaultProfile(){return!this.profile.isDefault&&!!this.profile.useDefaultFlags?.tasks}};j3=I([m(1,ht),m(2,F)],j3);var iBt=class extends x{constructor(e,t,o){super();this.channel=e;this.profile=t;this.workspace=o}async getItems(){let e={profile:this.profile,workspace:this.workspace},t=await this.channel.call("getItems",e);return new Map(t)}updateItems(e){let t={profile:this.profile,workspace:this.workspace};return e.insert&&(t.insert=Array.from(e.insert.entries())),e.delete&&(t.delete=Array.from(e.delete.values())),this.channel.call("updateItems",t)}optimize(){let e={profile:this.profile,workspace:this.workspace};return this.channel.call("optimize",e)}},oBt=class extends iBt{constructor(e,t){super(e,t,void 0);this._onDidChangeItemsExternal=this._register(new E);this.onDidChangeItemsExternal=this._onDidChangeItemsExternal.event;this.registerListeners()}registerListeners(){this._register(this.channel.listen("onDidChangeStorage",{profile:this.profile})(e=>this.onDidChangeStorage(e)))}onDidChangeStorage(e){(Array.isArray(e.changed)||Array.isArray(e.deleted))&&this._onDidChangeItemsExternal.fire({changed:e.changed?new Map(e.changed):void 0,deleted:e.deleted?new Set(e.deleted):void 0})}},JRe=class extends oBt{constructor(i){super(i,void 0)}async close(){this.dispose()}},ZRe=class extends oBt{async close(){this.dispose()}},nBt=class extends iBt{constructor(e,t){super(e,void 0,t);this.onDidChangeItemsExternal=U.None}async close(){this.dispose()}};var W0=le("IUserDataProfileStorageService"),qZe=class extends x{constructor(e,t){super();this.storageService=t;e&&(this.storageServicesMap=this._register(new Vt))}async readStorageData(e){return this.withProfileScopedStorageService(e,async t=>this.getItems(t))}async updateStorageData(e,t,o){return this.withProfileScopedStorageService(e,async n=>this.writeItems(n,t,o))}async withProfileScopedStorageService(e,t){if(this.storageService.hasScope(e))return t(this.storageService);let o=this.storageServicesMap?.get(e.id);if(!o){o=new cxi(this.createStorageDatabase(e)),this.storageServicesMap?.set(e.id,o);try{await o.initialize()}catch(n){throw this.storageServicesMap?.has(e.id)?this.storageServicesMap.deleteAndDispose(e.id):o.dispose(),n}}try{let n=await t(o);return await o.flush(),n}finally{this.storageServicesMap?.has(e.id)||o.dispose()}}getItems(e){let t=new Map,o=n=>{for(let r of e.keys(0,n))t.set(r,{value:e.get(r,0),target:n})};return o(0),o(1),t}writeItems(e,t,o){e.storeAll(Array.from(t.entries()).map(([n,r])=>({key:n,value:r,scope:0,target:o})),!0)}};qZe=I([m(1,ce)],qZe);var rBt=class extends qZe{constructor(e,t,o,n,r){super(e,n);this.remoteService=t;let s=t.getChannel("profileStorageListener"),l=this._register(new me);this._onDidChange=this._register(new E({onWillAddFirstListener:()=>{l.value=s.listen("onDidChange")(c=>{r.trace("profile storage changes",c),this._onDidChange.fire({targetChanges:c.targetChanges.map(u=>fw(u,o.profilesHome.scheme)),valueChanges:c.valueChanges.map(u=>({...u,profile:fw(u.profile,o.profilesHome.scheme)}))})})},onDidRemoveLastListener:()=>l.value=void 0})),this.onDidChange=this._onDidChange.event}async createStorageDatabase(e){let t=this.remoteService.getChannel("storage");return $Ce(e)?new JRe(t):new ZRe(t,e)}},cxi=class extends ace{constructor(e){super({flushInterval:100});this.profileStorageDatabase=e}async doInitialize(){let e=await this.profileStorageDatabase,t=new KO(e);return this._register(t.onDidChangeStorage(o=>{this.emitDidChangeValue(0,o)})),this._register(Z(()=>{t.close(),t.dispose(),jc(e)&&e.dispose()})),this.profileStorage=t,this.profileStorage.init()}getStorage(e){return e===0?this.profileStorage:void 0}getLogDetails(){}async switchToProfile(){}async switchToWorkspace(){}hasScope(){return!1}};var sBt=class{constructor(i,e,t,o,n){this.userDataProfileService=i;this.extensionManagementService=e;this.extensionGalleryService=t;this.extensionEnablementService=o;this.logService=n}async initialize(i){let e=JSON.parse(i),t=await this.extensionManagementService.getInstalled(void 0,this.userDataProfileService.currentProfile.extensionsResource),o=[],n=[];for(let s of e){let l=this.extensionEnablementService.getDisabledExtensions().some(u=>Ut(u,s.identifier)),c=t.find(u=>Ut(u.identifier,s.identifier));(!c||!c.isBuiltin&&c.preRelease!==s.preRelease)&&n.push(s),l!==!!s.disabled&&o.push({extension:s.identifier,enable:!s.disabled})}let r=t.filter(s=>!s.isBuiltin&&!e.some(({identifier:l})=>Ut(l,s.identifier)));for(let{extension:s,enable:l}of o)l?(this.logService.trace("Initializing Profile: Enabling extension...",s.id),await this.extensionEnablementService.enableExtension(s),this.logService.info("Initializing Profile: Enabled extension...",s.id)):(this.logService.trace("Initializing Profile: Disabling extension...",s.id),await this.extensionEnablementService.disableExtension(s),this.logService.info("Initializing Profile: Disabled extension...",s.id));if(n.length){let s=await this.extensionGalleryService.getExtensions(n.map(l=>({...l.identifier,version:l.version,hasPreRelease:l.version?void 0:l.preRelease})),Se.None);await Promise.all(n.map(async l=>{let c=s.find(u=>Ut(u.identifier,l.identifier));c&&(await this.extensionManagementService.canInstall(c)===!0?(this.logService.trace("Initializing Profile: Installing extension...",c.identifier.id,c.version),await this.extensionManagementService.installFromGallery(c,{isMachineScoped:!1,donotIncludePackAndDependencies:!0,installGivenVersion:!!l.version,installPreReleaseVersion:l.preRelease,profileLocation:this.userDataProfileService.currentProfile.extensionsResource,context:{[O5]:!0,[TR]:!0}}),this.logService.info("Initializing Profile: Installed extension...",c.identifier.id,c.version)):this.logService.info("Initializing Profile: Skipped installing extension because it cannot be installed.",c.identifier.id))}))}r.length&&await Promise.all(r.map(s=>this.extensionManagementService.uninstall(s)))}};sBt=I([m(0,ln),m(1,Cs),m(2,fa),m(3,fK),m(4,se)],sBt);var KA=class{constructor(i,e,t,o,n){this.extensionManagementService=i;this.extensionGalleryService=e;this.userDataProfileStorageService=t;this.instantiationService=o;this.logService=n}async getContent(i,e){let t=await this.getLocalExtensions(i);return this.toContent(t,e)}toContent(i,e){return JSON.stringify(e?.length?i.filter(t=>!e.includes(t.identifier.id.toLowerCase())):i)}async apply(i,e,t,o){return this.withProfileScopedServices(e,async n=>{let r=await this.getProfileExtensions(i),s=await this.extensionManagementService.getInstalled(void 0,e.extensionsResource),l=[],c=[];for(let p of r){let h=n.getDisabledExtensions().some(f=>Ut(f,p.identifier)),g=s.find(f=>Ut(f.identifier,p.identifier));(!g||!g.isBuiltin&&g.preRelease!==p.preRelease)&&c.push(p),h!==!!p.disabled&&l.push({extension:p.identifier,enable:!p.disabled})}let u=s.filter(p=>!p.isBuiltin&&!r.some(({identifier:h})=>Ut(h,p.identifier))&&!p.isApplicationScoped);for(let{extension:p,enable:h}of l)h?(this.logService.trace(`Importing Profile (${e.name}): Enabling extension...`,p.id),await n.enableExtension(p),this.logService.info(`Importing Profile (${e.name}): Enabled extension...`,p.id)):(this.logService.trace(`Importing Profile (${e.name}): Disabling extension...`,p.id),await n.disableExtension(p),this.logService.info(`Importing Profile (${e.name}): Disabled extension...`,p.id));if(c.length){this.logService.info(`Importing Profile (${e.name}): Started installing extensions.`);let p=await this.extensionGalleryService.getExtensions(c.map(g=>({...g.identifier,version:g.version,hasPreRelease:g.version?void 0:g.preRelease})),Se.None),h=[];if(await Promise.all(c.map(async g=>{let f=p.find(v=>Ut(v.identifier,g.identifier));f&&(await this.extensionManagementService.canInstall(f)===!0?h.push({extension:f,options:{isMachineScoped:!1,donotIncludePackAndDependencies:!0,installGivenVersion:!!g.version,installPreReleaseVersion:g.preRelease,profileLocation:e.extensionsResource,context:{[O5]:!0}}}):this.logService.info(`Importing Profile (${e.name}): Skipped installing extension because it cannot be installed.`,f.identifier.id))})),h.length)if(o){await this.extensionManagementService.requestPublisherTrust(h);for(let g of h){if(o.isCancellationRequested)return;t?.(d(18218,null,g.extension.displayName??g.extension.identifier.id)),await this.extensionManagementService.installFromGallery(g.extension,g.options)}}else await this.extensionManagementService.installGalleryExtensions(h);this.logService.info(`Importing Profile (${e.name}): Finished installing extensions.`)}u.length&&await Promise.all(u.map(p=>this.extensionManagementService.uninstall(p)))})}async copy(i,e,t){await this.extensionManagementService.copyExtensions(i.extensionsResource,e.extensionsResource);let o=await this.withProfileScopedServices(i,async n=>n.getDisabledExtensions());if(t){let n=await this.extensionManagementService.getInstalled(1,e.extensionsResource);for(let r of n)o.push(r.identifier)}await this.withProfileScopedServices(e,async n=>Promise.all(o.map(r=>n.disableExtension(r))))}async getLocalExtensions(i){return this.withProfileScopedServices(i,async e=>{let t=new Map,o=await this.extensionManagementService.getInstalled(void 0,i.extensionsResource),n=e.getDisabledExtensions();for(let r of o){let{identifier:s,preRelease:l}=r,c=n.some(h=>Ut(h,s));if(r.isBuiltin&&!c||!r.isBuiltin&&!r.identifier.uuid)continue;t.get(s.id.toLowerCase())?.disabled&&t.delete(s.id.toLowerCase());let p={identifier:s,displayName:r.manifest.displayName};c&&(p.disabled=!0),!r.isBuiltin&&r.pinned&&(p.version=r.manifest.version),!p.version&&l&&(p.preRelease=!0),p.applicationScoped=r.isApplicationScoped,t.set(p.identifier.id.toLowerCase(),p)}return[...t.values()]})}async getProfileExtensions(i){return JSON.parse(i)}async withProfileScopedServices(i,e){return this.userDataProfileStorageService.withProfileScopedStorageService(i,async t=>{let o=new N,n=o.add(this.instantiationService.createChild(new _o([ce,t]))),r=o.add(n.createInstance(Y2));try{return await e(r)}finally{o.dispose()}})}};KA=I([m(0,ru),m(1,fa),m(2,W0),m(3,F),m(4,se)],KA);var tMe=class{constructor(){this.type="extensions";this.handle="extensions";this.label={label:d(18217,null)};this.collapsibleState=2;this.contextValue="extensions";this.excludedExtensions=new Set}async getChildren(){let i=(await this.getExtensions()).sort((t,o)=>(t.displayName??t.identifier.id).localeCompare(o.displayName??o.identifier.id)),e=this;return i.map(t=>({...t,handle:t.identifier.id.toLowerCase(),parent:this,label:{label:t.displayName||t.identifier.id},description:t.applicationScoped?d(18215,null):void 0,collapsibleState:0,checkbox:e.checkbox?{get isChecked(){return!e.excludedExtensions.has(t.identifier.id.toLowerCase())},set isChecked(o){o?e.excludedExtensions.delete(t.identifier.id.toLowerCase()):e.excludedExtensions.add(t.identifier.id.toLowerCase())},tooltip:d(18216,null,t.displayName||t.identifier.id),accessibilityInformation:{label:d(18216,null,t.displayName||t.identifier.id)}}:void 0,themeIcon:R.extensions,command:{id:"extension.open",title:"",arguments:[t.identifier.id,void 0,!0]}}))}async hasContent(){return(await this.getExtensions()).length>0}},Q3=class extends tMe{constructor(e,t){super();this.profile=e;this.instantiationService=t}isFromDefaultProfile(){return!this.profile.isDefault&&!!this.profile.useDefaultFlags?.extensions}getExtensions(){return this.instantiationService.createInstance(KA).getLocalExtensions(this.profile)}async getContent(){return this.instantiationService.createInstance(KA).getContent(this.profile,[...this.excludedExtensions.values()])}};Q3=I([m(1,F)],Q3);var eMe=class extends tMe{constructor(e,t){super();this.content=e;this.instantiationService=t}isFromDefaultProfile(){return!1}getExtensions(){return this.instantiationService.createInstance(KA).getProfileExtensions(this.content)}async getContent(){let e=this.instantiationService.createInstance(KA),t=await e.getProfileExtensions(this.content);return e.toContent(t,[...this.excludedExtensions.values()])}};eMe=I([m(1,F)],eMe);var aBt=class{constructor(i){this.storageService=i}async initialize(i){let e=JSON.parse(i),t=Object.keys(e.storage);if(t.length){let o=[];for(let n of t)o.push({key:n,value:e.storage[n],scope:0,target:0});this.storageService.storeAll(o,!0)}}};aBt=I([m(0,ce)],aBt);var Y3=class{constructor(i,e,t){this.storageService=i;this.userDataProfileStorageService=e;this.logService=t}async getContent(i){let e=await this.getGlobalState(i);return JSON.stringify(e)}async apply(i,e){let t=JSON.parse(i);await this.writeGlobalState(t,e)}async getGlobalState(i){let e={},t=await this.userDataProfileStorageService.readStorageData(i);for(let[o,n]of t)n.value!==void 0&&n.target===0&&(e[o]=n.value);return{storage:e}}async writeGlobalState(i,e){let t=Object.keys(i.storage);if(t.length){let o=new Map,n=[...this.storageService.keys(-1,1),...this.storageService.keys(1,0),...this.storageService.keys(1,1)];for(let r of t)n.includes(r)?this.logService.info(`Importing Profile (${e.name}): Ignoring global state key '${r}' because it is not a profile key.`):o.set(r,i.storage[r]);await this.userDataProfileStorageService.updateStorageData(e,o,0)}}};Y3=I([m(0,ce),m(1,W0),m(2,se)],Y3);var oMe=class{constructor(i,e){this.resource=i;this.uriIdentityService=e;this.type="globalState";this.handle="globalState";this.label={label:d(18219,null)};this.collapsibleState=1}async getChildren(){return[{handle:this.resource.toString(),resourceUri:this.resource,collapsibleState:0,accessibilityInformation:{label:this.uriIdentityService.extUri.basename(this.resource)},parent:this,command:{id:vg,title:"",arguments:[this.resource,void 0,void 0]}}]}},iMe=class extends oMe{constructor(e,t,o,n){super(t,o);this.profile=e;this.instantiationService=n}async hasContent(){let e=await this.instantiationService.createInstance(Y3).getGlobalState(this.profile);return Object.keys(e.storage).length>0}async getContent(){return this.instantiationService.createInstance(Y3).getContent(this.profile)}isFromDefaultProfile(){return!this.profile.isDefault&&!!this.profile.useDefaultFlags?.globalState}};iMe=I([m(2,ht),m(3,F)],iMe);var lBt=class extends oMe{constructor(e,t,o){super(t,o);this.content=e}async getContent(){return this.content}isFromDefaultProfile(){return!1}};lBt=I([m(2,ht)],lBt);var $Ze=class{constructor(i){this.type=1,this.ctime=Date.now(),this.mtime=Date.now(),this.size=0,this.name=i}},xee=class{constructor(i){this.type=2,this.ctime=Date.now(),this.mtime=Date.now(),this.size=0,this.name=i,this.entries=new Map}},kme=class extends x{constructor(){super(...arguments);this.memoryFdCounter=0;this.fdMemory=new Map;this._onDidChangeCapabilities=this._register(new E);this.onDidChangeCapabilities=this._onDidChangeCapabilities.event;this._capabilities=525318;this.root=new xee("");this._onDidChangeFile=this._register(new E);this.onDidChangeFile=this._onDidChangeFile.event;this._bufferedChanges=[]}get capabilities(){return this._capabilities}setReadOnly(e){let t=!!(this._capabilities&2048);e!==t&&(this._capabilities=525314|(e?2048:0),this._onDidChangeCapabilities.fire())}async stat(e){return this._lookup(e,!1)}async readdir(e){let t=this._lookupAsDirectory(e,!1),o=[];return t.entries.forEach((n,r)=>o.push([r,n.type])),o}async readFile(e){let t=this._lookupAsFile(e,!1).data;if(t)return t;throw Ps("file not found","EntryNotFound")}readFileStream(e){let t=this._lookupAsFile(e,!1).data,o=VI(n=>qe.concat(n.map(r=>qe.wrap(r))).buffer);return o.end(t),o}async writeFile(e,t,o){let n=He(e),r=this._lookupParentDirectory(e),s=r.entries.get(n);if(s instanceof xee)throw Ps("file is directory","EntryIsADirectory");if(!s&&!o.create)throw Ps("file not found","EntryNotFound");if(s&&o.create&&!o.overwrite)throw Ps("file exists already","EntryExists");if(s||(s=new $Ze(n),r.entries.set(n,s),this._fireSoon({type:1,resource:e})),s.mtime=Date.now(),o.append){s.size+=t.byteLength;let l=s.data??new Uint8Array(0),c=new Uint8Array(l.byteLength+t.byteLength);c.set(l,0),c.set(t,l.byteLength),s.data=c}else s.size=t.byteLength,s.data=t;this._fireSoon({type:0,resource:e})}open(e,t){let o=this._lookup(e,!0),n=j4i(t),r=n&&!!t.append;if(o){if(o instanceof xee)throw Ps("file is directory","EntryIsADirectory")}else{if(!n)throw Ps("file not found","EntryNotFound");let l=He(e),c=this._lookupParentDirectory(e);o=new $Ze(l),o.data=new Uint8Array(0),c.entries.set(l,o),this._fireSoon({type:1,resource:e})}o.data||(o.data=new Uint8Array(0));let s=this.memoryFdCounter++;return this.fdMemory.set(s,{file:o,resource:e,write:n,append:r}),Promise.resolve(s)}close(e){let t=this.fdMemory.get(e);return t?.write&&(t.file.mtime=Date.now(),t.file.size=t.file.data?.byteLength??0,this._fireSoon({type:0,resource:t.resource})),this.fdMemory.delete(e),Promise.resolve()}read(e,t,o,n,r){let s=this.fdMemory.get(e);if(!s)throw Ps("No file with that descriptor open","Unavailable");if(!s.file.data)return Promise.resolve(0);let l=qe.wrap(s.file.data).slice(t,t+r);return o.set(l.buffer,n),Promise.resolve(l.byteLength)}write(e,t,o,n,r){let s=this.fdMemory.get(e);if(!s)throw Ps("No file with that descriptor open","Unavailable");let l=qe.wrap(o).slice(n,n+r);s.file.data??=new Uint8Array(0);let c=s.append?s.file.data.byteLength:t,u=c+l.byteLength;if(u>s.file.data.byteLength){let p=new Uint8Array(u);p.set(s.file.data,0),s.file.data=p}return s.file.data.set(l.buffer,c),Promise.resolve(l.byteLength)}async rename(e,t,o){if(!o.overwrite&&this._lookup(t,!0))throw Ps("file exists already","EntryExists");let n=this._lookup(e,!1),r=this._lookupParentDirectory(e),s=this._lookupParentDirectory(t),l=He(t);r.entries.delete(n.name),n.name=l,s.entries.set(l,n),this._fireSoon({type:2,resource:e},{type:1,resource:t})}async delete(e,t){let o=ci(e),n=He(e),r=this._lookupAsDirectory(o,!1);r.entries.delete(n)&&(r.mtime=Date.now(),r.size-=1,this._fireSoon({type:0,resource:o},{resource:e,type:2}))}async mkdir(e){if(this._lookup(e,!0))throw Ps("file exists already","EntryExists");let t=He(e),o=ci(e),n=this._lookupAsDirectory(o,!1),r=new xee(t);n.entries.set(r.name,r),n.mtime=Date.now(),n.size+=1,this._fireSoon({type:0,resource:o},{type:1,resource:e})}_lookup(e,t){let o=e.path.split("/"),n=this.root;for(let r of o){if(!r)continue;let s;if(n instanceof xee&&(s=n.entries.get(r)),!s){if(t)return;throw Ps("file not found","EntryNotFound")}n=s}return n}_lookupAsDirectory(e,t){let o=this._lookup(e,t);if(o instanceof xee)return o;throw Ps("file not a directory","EntryNotADirectory")}_lookupAsFile(e,t){let o=this._lookup(e,t);if(o instanceof $Ze)return o;throw Ps("file is a directory","EntryIsADirectory")}_lookupParentDirectory(e){let t=ci(e);return this._lookupAsDirectory(t,!1)}watch(e,t){return x.None}_fireSoon(...e){this._bufferedChanges.push(...e),this._fireSoonHandle&&clearTimeout(this._fireSoonHandle),this._fireSoonHandle=setTimeout(()=>{this._onDidChangeFile.fire(this._bufferedChanges),this._bufferedChanges.length=0},5)}dispose(){super.dispose(),this.fdMemory.clear()}};function iYo(a){let i=a;return!!(i&&typeof i=="object"&&i.name&&typeof i.name=="string"&&(gn(i.icon)||typeof i.icon=="string")&&(gn(i.settings)||typeof i.settings=="string")&&(gn(i.globalState)||typeof i.globalState=="string")&&(gn(i.extensions)||typeof i.extensions=="string"))}var jZe=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.instantiationService=e;this.userDataProfileService=t;this.userDataProfileManagementService=o;this.userDataProfilesService=n;this.extensionService=r;this.quickInputService=s;this.progressService=l;this.dialogService=c;this.clipboardService=u;this.openerService=p;this.requestService=h;this.productService=g;this.uriIdentityService=f;this.profileContentHandlers=new Map;this.registerProfileContentHandler(Q.file,this.fileUserDataProfileContentHandler=e.createInstance(QZe))}registerProfileContentHandler(e,t){if(this.profileContentHandlers.has(e))throw new Error(`Profile content handler with id '${e}' already registered.`);return this.profileContentHandlers.set(e,t),Z(()=>this.unregisterProfileContentHandler(e))}unregisterProfileContentHandler(e){this.profileContentHandlers.delete(e)}async createFromProfile(e,t,o){let n=new N,r;n.add(o.onCancellationRequested(()=>r.cancel()));let s;return this.progressService.withProgress({location:15,delay:500,sticky:!0,cancellable:!0},async l=>{let c=u=>l.report({message:d(18229,null,u)});r=Ln(async u=>{let h=await n.add(this.instantiationService.createInstance(Tme,e,{...t?.resourceTypeFlags,extensions:!1})).getProfileTemplate(t.name??e.name,t?.icon);s=await this.getProfileToImport({...h,name:t.name??h.name},!!t.transient,t),s&&(u.isCancellationRequested||await this.applyProfileTemplate(h,s,t,c,u))});try{await r,s&&(t?.resourceTypeFlags?.extensions??!0)&&(c(d(18240,null)),await this.instantiationService.createInstance(KA).copy(e,s,!1))}catch{s&&(await this.userDataProfilesService.removeProfile(s),s=void 0)}return s},()=>r.cancel()).finally(()=>n.dispose())}async createProfileFromTemplate(e,t,o){let n=new N,r;n.add(o.onCancellationRequested(()=>r.cancel()));let s;return this.progressService.withProgress({location:15,delay:500,sticky:!0,cancellable:!0},async l=>{let c=u=>l.report({message:d(18229,null,u)});r=Ln(async u=>{s=await this.getProfileToImport({...e,name:t.name??e.name},!!t.transient,t),s&&(u.isCancellationRequested||await this.applyProfileTemplate(e,s,t,c,u))});try{await r}catch{s&&(await this.userDataProfilesService.removeProfile(s),s=void 0)}return s},()=>r.cancel()).finally(()=>n.dispose())}async applyProfileTemplate(e,t,o,n,r){e.settings&&(o.resourceTypeFlags?.settings??!0)&&!t.useDefaultFlags?.settings&&(n(d(18233,null)),await this.instantiationService.createInstance(N0).apply(e.settings,t)),!r.isCancellationRequested&&(e.keybindings&&(o.resourceTypeFlags?.keybindings??!0)&&!t.useDefaultFlags?.keybindings&&(n(d(18230,null)),await this.instantiationService.createInstance(O0).apply(e.keybindings,t)),!r.isCancellationRequested&&(e.tasks&&(o.resourceTypeFlags?.tasks??!0)&&!t.useDefaultFlags?.tasks&&(n(d(18232,null)),await this.instantiationService.createInstance(F0).apply(e.tasks,t)),!r.isCancellationRequested&&(e.snippets&&(o.resourceTypeFlags?.snippets??!0)&&!t.useDefaultFlags?.snippets&&(n(d(18231,null)),await this.instantiationService.createInstance(zA).apply(e.snippets,t)),!r.isCancellationRequested&&(e.globalState&&!t.useDefaultFlags?.globalState&&(n(d(18226,null)),await this.instantiationService.createInstance(Y3).apply(e.globalState,t)),!r.isCancellationRequested&&e.extensions&&(o.resourceTypeFlags?.extensions??!0)&&!t.useDefaultFlags?.extensions&&(n(d(18240,null)),await this.instantiationService.createInstance(KA).apply(e.extensions,t,n,r))))))}async exportProfile(e,t){let o=new N;try{let n=o.add(this.instantiationService.createInstance(Tme,e,t));await this.doExportProfile(n,15)}finally{o.dispose()}}async createTroubleshootProfile(){let e=this.instantiationService.createInstance(Tme,this.userDataProfileService.currentProfile,void 0);try{let t=await e.getProfileTemplate(d(18259,null),void 0);await this.progressService.withProgress({location:15,delay:1e3,sticky:!0},async o=>{let n=s=>o.report({message:d(18260,null,s)}),r=await this.doCreateProfile(t,!0,!1,{useDefaultFlags:this.userDataProfileService.currentProfile.useDefaultFlags},n);r&&(n(d(18249,null)),await this.instantiationService.createInstance(KA).copy(this.userDataProfileService.currentProfile,r,!0),n(d(18258,null)),await this.userDataProfileManagementService.switchProfile(r))})}finally{e.dispose()}}async doExportProfile(e,t){let o=await e.getProfileToExport();if(!o)return;let n=new N;try{await this.progressService.withProgress({location:t,title:d(18248,null,n0.value)},async r=>{let s=await this.pickProfileContentHandler(o.name);if(!s)return;let l=this.profileContentHandlers.get(s);if(!l)return;let c=await l.saveProfile(o.name.replace("/","-"),JSON.stringify(o),Se.None);if(!c)return;let u=d(18237,null,o.name);if(l.extensionId){let p=[],h=this.productService.webUrl?`${this.productService.webUrl}/${EYe}/${s}/${c.id}`:Uro(`/${s}/${c.id}`,this.productService).toString();p.push({label:d(18228,null),run:()=>this.clipboardService.writeText(h)}),this.productService.webUrl?p.push({label:d(18243,null),run:async()=>{await this.openerService.open(h)}}):p.push({label:d(18244,null,l.name),run:async()=>{await this.openerService.open(c.link.toString())}}),await this.dialogService.prompt({type:bt.Info,message:u,buttons:p,cancelButton:d(18227,null)})}else await this.dialogService.info(u)})}finally{n.dispose()}}async resolveProfileTemplate(e,t){let o=await this.resolveProfileContent(e);if(o===null)return null;let n;try{n=JSON.parse(o)}catch{throw new Error(d(18241,null))}return iYo(n)?(t?.name&&(n.name=t.name),t?.icon&&(n.icon=t.icon),t?.resourceTypeFlags?.settings===!1&&(n.settings=void 0),t?.resourceTypeFlags?.keybindings===!1&&(n.keybindings=void 0),t?.resourceTypeFlags?.snippets===!1&&(n.snippets=void 0),t?.resourceTypeFlags?.tasks===!1&&(n.tasks=void 0),t?.resourceTypeFlags?.globalState===!1&&(n.globalState=void 0),t?.resourceTypeFlags?.extensions===!1&&(n.extensions=void 0),n):null}async doCreateProfile(e,t,o,n,r){let s=await this.getProfileToImport(e,t,n);if(s)return e.settings&&!s.useDefaultFlags?.settings&&(r(d(18252,null)),await this.instantiationService.createInstance(N0).apply(e.settings,s)),e.keybindings&&!s.useDefaultFlags?.keybindings&&(r(d(18251,null)),await this.instantiationService.createInstance(O0).apply(e.keybindings,s)),e.tasks&&!s.useDefaultFlags?.tasks&&(r(d(18254,null)),await this.instantiationService.createInstance(F0).apply(e.tasks,s)),e.snippets&&!s.useDefaultFlags?.snippets&&(r(d(18253,null)),await this.instantiationService.createInstance(zA).apply(e.snippets,s)),e.globalState&&!s.useDefaultFlags?.globalState&&(r(d(18250,null)),await this.instantiationService.createInstance(Y3).apply(e.globalState,s)),e.extensions&&o&&!s.useDefaultFlags?.extensions&&(r(d(18249,null)),await this.instantiationService.createInstance(KA).apply(e.extensions,s)),s}async resolveProfileContent(e){if(await this.fileUserDataProfileContentHandler.canHandle(e))return this.fileUserDataProfileContentHandler.readProfile(e,Se.None);if(q_e(e)){let o,n;e.authority===EYe?(n=this.uriIdentityService.extUri.basename(e),o=this.uriIdentityService.extUri.basename(this.uriIdentityService.extUri.dirname(e))):(o=e.authority.substring(pbi.length),n=A.parse(e.path.substring(1))),await this.extensionService.activateByEvent(`onProfile:${o}`);let r=this.profileContentHandlers.get(o);if(r)return r.readProfile(n,Se.None)}await this.extensionService.activateByEvent("onProfile");for(let o of this.profileContentHandlers.values()){let n=await o.readProfile(e,Se.None);if(n!==null)return n}let t=await this.requestService.request({type:"GET",url:e.toString(!0),callSite:"userDataProfileImportExportService.resolveContent"},Se.None);if(t.res.statusCode===200)return await tD(t);{let o=await tD(t);throw new Error(`Failed to get profile from URL: ${e.toString()}. Status code: ${t.res.statusCode}. Message: ${o}`)}}async pickProfileContentHandler(e){if(await this.extensionService.activateByEvent("onProfile"),this.profileContentHandlers.size===1)return this.profileContentHandlers.keys().next().value;let t=[];for(let[n,r]of this.profileContentHandlers)t.push({id:n,label:r.name,description:r.description});return(await this.quickInputService.pick(t.reverse(),{title:d(18257,null,e),hideInput:!0}))?.id}async getProfileToImport(e,t,o){let n=e.name,r=this.userDataProfilesService.profiles.find(s=>s.name===n);if(r){if(t)return this.userDataProfilesService.createNamedProfile(`${n} ${this.getProfileNameIndex(n)}`,{...o,transient:t});let{confirmed:s}=await this.dialogService.confirm({type:bt.Info,message:d(18246,null,n),primaryButton:d(18245,null)});return s?r.isDefault?r:this.userDataProfilesService.updateProfile(r,o):void 0}else return this.userDataProfilesService.createNamedProfile(n,{...o,transient:t})}getProfileNameIndex(e){let t=new RegExp(`${ns(e)}\\s(\\d+)`),o=0;for(let n of this.userDataProfilesService.profiles){let r=t.exec(n.name),s=r?parseInt(r[1]):0;o=s>o?s:o}return o+1}};jZe=I([m(0,F),m(1,ln),m(2,vT),m(3,an),m(4,lt),m(5,Ue),m(6,Fo),m(7,at),m(8,Fi),m(9,Je),m(10,Ea),m(11,tt),m(12,ht)],jZe);var QZe=class{constructor(i,e,t,o,n){this.fileDialogService=i;this.uriIdentityService=e;this.fileService=t;this.productService=o;this.textFileService=n;this.name=d(18242,null);this.description=d(18238,null)}async saveProfile(i,e,t){let o=await this.fileDialogService.showSaveDialog({title:d(18234,null),filters:_Ye,defaultUri:this.uriIdentityService.extUri.joinPath(await this.fileDialogService.defaultFilePath(),`${i}.${TYe}`)});return o?(await this.textFileService.create([{resource:o,value:e,options:{overwrite:!0}}]),{link:o,id:o.toString()}):null}async canHandle(i){return i.scheme!==Q.http&&i.scheme!==Q.https&&i.scheme!==this.productService.urlProtocol&&await this.fileService.canHandleResource(i)}async readProfile(i,e){return await this.canHandle(i)?(await this.fileService.readFile(i,void 0,e)).value.toString():null}async selectProfile(){let i=await this.fileDialogService.showOpenDialog({canSelectFolders:!1,canSelectFiles:!0,canSelectMany:!1,filters:_Ye,title:d(18256,null)});return i?i[0]:null}};QZe=I([m(0,rn),m(1,ht),m(2,fe),m(3,tt),m(4,Uo)],QZe);var Eme="userdataprofileexport",uuo="userdataprofileexportpreview",YZe=class extends x{constructor(e){super();this.quickInputService=e;this._onDidChangeRoots=this._register(new E);this.onDidChangeRoots=this._onDidChangeRoots.event;this.roots=[]}async getChildren(e){if(e){let t=await e.getChildren();if(t)for(let o of t)o.parent.checkbox&&o.checkbox&&(o.checkbox.isChecked=o.parent.checkbox.isChecked&&o.checkbox.isChecked);return t}else return this.rootsPromise=void 0,this._onDidChangeRoots.fire(),this.getRoots()}getRoots(){return this.rootsPromise||(this.rootsPromise=(async()=>{this.roots=await this.fetchRoots();for(let e of this.roots){let t=Ar(e.label.label)?e.label.label.value:e.label.label;e.checkbox={isChecked:!e.isFromDefaultProfile(),tooltip:d(18255,null,t),accessibilityInformation:{label:d(18255,null,t)}},e.isFromDefaultProfile()&&(e.description=d(18239,null))}return this.roots})()),this.rootsPromise}isEnabled(e){return e!==void 0?this.roots.some(t=>t.type===e&&this.isSelected(t)):this.roots.some(t=>this.isSelected(t))}async getProfileTemplate(e,t){let o=await this.getRoots(),n,r,s,l,c,u;for(let p of o)this.isSelected(p)&&(p instanceof G3?n=await p.getContent():p instanceof q3?r=await p.getContent():p instanceof j3?s=await p.getContent():p instanceof $3?l=await p.getContent():p instanceof tMe?c=await p.getContent():p instanceof oMe&&(u=await p.getContent()));return{name:e,icon:t,settings:n,keybindings:r,tasks:s,snippets:l,extensions:c,globalState:u}}isSelected(e){return e.checkbox?e.checkbox.isChecked||!!e.children?.some(t=>t.checkbox?.isChecked):!0}};YZe=I([m(0,Ue)],YZe);var Tme=class extends YZe{constructor(e,t,o,n,r){super(o);this.profile=e;this.exportFlags=t;this.fileService=n;this.instantiationService=r;this.disposables=this._register(new N)}async fetchRoots(){this.disposables.clear(),this.disposables.add(this.fileService.registerProvider(Eme,this._register(new kme)));let e=this._register(new kme);this.disposables.add(this.fileService.registerProvider(uuo,e));let t=[],o=this.createExportPreviewProfile(this.profile);if(this.exportFlags?.settings??!0){let n=this.instantiationService.createInstance(N0),r=await n.getContent(this.profile);await n.apply(r,o);let s=this.instantiationService.createInstance(G3,o);await s.hasContent()&&t.push(s)}if(this.exportFlags?.keybindings??!0){let n=this.instantiationService.createInstance(O0),r=await n.getContent(this.profile);await n.apply(r,o);let s=this.instantiationService.createInstance(q3,o);await s.hasContent()&&t.push(s)}if(this.exportFlags?.snippets??!0){let n=this.instantiationService.createInstance(zA),r=await n.getContent(this.profile);await n.apply(r,o);let s=this.instantiationService.createInstance($3,o);await s.hasContent()&&t.push(s)}if(this.exportFlags?.tasks??!0){let n=this.instantiationService.createInstance(F0),r=await n.getContent(this.profile);await n.apply(r,o);let s=this.instantiationService.createInstance(j3,o);await s.hasContent()&&t.push(s)}if(this.exportFlags?.globalState??!0){let n=Ge(o.globalStorageHome,"globalState.json").with({scheme:uuo}),r=this.instantiationService.createInstance(iMe,o,n),s=await r.getContent();s&&(await this.fileService.writeFile(n,qe.fromString(JSON.stringify(JSON.parse(s),null,"	"))),t.push(r))}if(this.exportFlags?.extensions??!0){let n=this.instantiationService.createInstance(Q3,o);await n.hasContent()&&t.push(n)}return e.setReadOnly(!0),t}createExportPreviewProfile(e){return{id:e.id,name:e.name,location:e.location,isDefault:e.isDefault,icon:e.icon,globalStorageHome:e.globalStorageHome,settingsResource:e.settingsResource.with({scheme:Eme}),keybindingsResource:e.keybindingsResource.with({scheme:Eme}),tasksResource:e.tasksResource.with({scheme:Eme}),mcpResource:e.mcpResource.with({scheme:Eme}),snippetsHome:e.snippetsHome.with({scheme:Eme}),promptsHome:e.promptsHome.with({scheme:Eme}),extensionsResource:e.extensionsResource,cacheHome:e.cacheHome,useDefaultFlags:e.useDefaultFlags,isTransient:e.isTransient}}async getProfileToExport(){let e=this.profile.name;return this.profile.isDefault&&(e=await this.quickInputService.input({placeHolder:d(18235,null),title:d(18236,null),async validateInput(t){if(!t.trim())return d(18247,null)}}),!e)?null:super.getProfileTemplate(e,this.profile.icon)}};Tme=I([m(2,Ue),m(3,fe),m(4,F)],Tme);Ee(YB,jZe,1);var XZe=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this.userDataProfilesService=e;this.userDataProfileService=t;this.hostService=o;this.dialogService=n;this.workspaceContextService=r;this.extensionService=s;this.environmentService=l;this.productService=c;this.requestService=u;this.configurationService=p;this.uriIdentityService=h;this.logService=g;this._register(t.onDidChangeCurrentProfile(f=>this.onDidChangeCurrentProfile(f))),this._register(e.onDidChangeProfiles(f=>{if(f.removed.some(b=>b.id===this.userDataProfileService.currentProfile.id)){let b=this.getProfileToUseForCurrentWorkspace();this.switchProfile(b),this.changeCurrentProfile(b,d(18265,null));return}let v=f.updated.find(b=>this.userDataProfileService.currentProfile.id===b.id);if(v){let b=this.getProfileToUseForCurrentWorkspace();b?.id!==v.id?(this.switchProfile(b),this.changeCurrentProfile(b,d(18266,null))):this.changeCurrentProfile(v,d(18267,null))}}))}async onDidChangeCurrentProfile(e){e.previous.isTransient&&await this.userDataProfilesService.cleanUpTransientProfiles()}getWorkspaceUri(){let e=this.workspaceContextService.getWorkspace();return e.configuration??e.folders[0]?.uri}getProfileToUseForCurrentWorkspace(){let e=this.getWorkspaceUri();if(e){let t=this.userDataProfilesService.profiles.find(o=>o.workspaces?.some(n=>this.uriIdentityService.extUri.isEqual(n,e)));if(t)return t}else{let t=this.userDataProfilesService.profiles.find(o=>o.id===this.userDataProfileService.currentProfile.id);if(t)return t}return this.getDefaultProfileToUse()}getDefaultProfileToUse(){let e=this.configurationService.getValue(hA);if(e){let t=this.userDataProfilesService.profiles.find(o=>o.name===e);if(t)return t}return this.userDataProfilesService.defaultProfile}async createProfile(e,t){return this.userDataProfilesService.createNamedProfile(e,t)}async createAndEnterProfile(e,t){let o=await this.userDataProfilesService.createNamedProfile(e,t,Dg(this.workspaceContextService.getWorkspace()));return await this.changeCurrentProfile(o),o}async createAndEnterTransientProfile(){let e=await this.userDataProfilesService.createTransientProfile(Dg(this.workspaceContextService.getWorkspace()));return await this.changeCurrentProfile(e),e}async updateProfile(e,t){if(!this.userDataProfilesService.profiles.some(n=>n.id===e.id))throw new Error(`Profile ${e.name} does not exist`);if(e.isDefault)throw new Error(d(18262,null));return await this.userDataProfilesService.updateProfile(e,t)}async removeProfile(e){if(!this.userDataProfilesService.profiles.some(t=>t.id===e.id))throw new Error(`Profile ${e.name} does not exist`);if(e.isDefault)throw new Error(d(18261,null));await this.userDataProfilesService.removeProfile(e)}async switchProfile(e){if(!this.userDataProfilesService.profiles.some(n=>n.id===e.id))throw new Error(`Profile ${e.name} does not exist`);if(this.userDataProfileService.currentProfile.id===e.id)return;let t=this.getWorkspaceUri();if(t&&e.workspaces?.some(n=>this.uriIdentityService.extUri.isEqual(n,t)))return;let o=Dg(this.workspaceContextService.getWorkspace());await this.userDataProfilesService.setProfileForWorkspace(o,e),Yj(o)&&await this.changeCurrentProfile(e)}async getBuiltinProfileTemplates(){if(this.productService.profileTemplatesUrl)try{let e=await this.requestService.request({type:"GET",url:this.productService.profileTemplatesUrl,callSite:"userDataProfileManagement.getProfileTemplates"},Se.None);if(e.res.statusCode===200)return await If(e)||[];this.logService.error("Could not get profile templates.",e.res.statusCode)}catch(e){this.logService.error(e)}return[]}async changeCurrentProfile(e,t){let o=!!this.environmentService.remoteAuthority,n=this.userDataProfileService.currentProfile.id!==e.id||!eo(this.userDataProfileService.currentProfile.useDefaultFlags,e.useDefaultFlags);if(n&&!o&&!await this.extensionService.stopExtensionHosts(d(18268,null)))throw this.userDataProfilesService.profiles.some(r=>r.id===this.userDataProfileService.currentProfile.id)&&await this.userDataProfilesService.setProfileForWorkspace(Dg(this.workspaceContextService.getWorkspace()),this.userDataProfileService.currentProfile),new go;if(await this.userDataProfileService.updateCurrentProfile(e),n)if(o){let{confirmed:r}=await this.dialogService.confirm({message:t??d(18264,null),primaryButton:d(18263,null)});r&&await this.hostService.reload()}else await this.extensionService.startExtensionHosts()}};XZe=I([m(0,an),m(1,ln),m(2,Zt),m(3,at),m(4,Pe),m(5,lt),m(6,At),m(7,tt),m(8,Ea),m(9,B),m(10,ht),m(11,se)],XZe);Ee(vT,XZe,0);function puo(a){return a.toJSON()}var cBt=class{constructor(i){this._uriTransformer=i}transformIncoming(i){let e=this._uriTransformer.transformIncoming(i);return e===i?i:puo(A.from(e))}transformOutgoing(i){let e=this._uriTransformer.transformOutgoing(i);return e===i?i:puo(A.from(e))}transformOutgoingURI(i){let e=this._uriTransformer.transformOutgoing(i);return e===i?i:A.from(e)}transformOutgoingScheme(i){return this._uriTransformer.transformOutgoingScheme(i)}},dBt=new class{transformIncoming(a){return a}transformOutgoing(a){return a}transformOutgoingURI(a){return a}transformOutgoingScheme(a){return a}};function dxi(a,i,e,t){if(!a||t>200)return null;if(typeof a=="object"){if(a.$mid===1)return e?A.revive(i.transformIncoming(a)):i.transformIncoming(a);if(a instanceof qe)return null;for(let o in a)if(Object.hasOwnProperty.call(a,o)){let n=dxi(a[o],i,e,t+1);n!==null&&(a[o]=n)}}return null}function _me(a,i){let e=dxi(a,i,!1,0);return e===null?a:e}function uBt(a,i){let e=dxi(a,i,!0,0);return e===null?a:e}var nMe=class extends x{constructor(e,t,o){super();this.profilesHome=t;this.channel=o;this._profiles=[];this._onDidChangeProfiles=this._register(new E);this.onDidChangeProfiles=this._onDidChangeProfiles.event;this._profiles=e.map(n=>fw(n,this.profilesHome.scheme)),this._register(this.channel.listen("onDidChangeProfiles")(n=>{let r=n.added.map(c=>fw(c,this.profilesHome.scheme)),s=n.removed.map(c=>fw(c,this.profilesHome.scheme)),l=n.updated.map(c=>fw(c,this.profilesHome.scheme));this._profiles=n.all.map(c=>fw(c,this.profilesHome.scheme)),this._onDidChangeProfiles.fire({added:r,removed:s,updated:l,all:this.profiles})})),this.onDidResetWorkspaces=this.channel.listen("onDidResetWorkspaces")}get defaultProfile(){return this.profiles[0]}get profiles(){return this._profiles}async createNamedProfile(e,t,o){let n=await this.channel.call("createNamedProfile",[e,t,o]);return fw(n,this.profilesHome.scheme)}async createProfile(e,t,o,n){let r=await this.channel.call("createProfile",[e,t,o,n]);return fw(r,this.profilesHome.scheme)}async createTransientProfile(e){let t=await this.channel.call("createTransientProfile",[e]);return fw(t,this.profilesHome.scheme)}async setProfileForWorkspace(e,t){await this.channel.call("setProfileForWorkspace",[e,t])}removeProfile(e){return this.channel.call("removeProfile",[e])}async updateProfile(e,t){let o=await this.channel.call("updateProfile",[e,t]);return fw(o,this.profilesHome.scheme)}resetWorkspaces(){return this.channel.call("resetWorkspaces")}cleanUp(){return this.channel.call("cleanUp")}cleanUpTransientProfiles(){return this.channel.call("cleanUpTransientProfiles")}};var uxi="associatedRemoteProfiles",GA=le("IRemoteUserDataProfilesService"),JZe=class extends x{constructor(e,t,o,n,r,s){super();this.environmentService=e;this.remoteAgentService=t;this.userDataProfilesService=o;this.userDataProfileService=n;this.storageService=r;this.logService=s;this.initPromise=this.init()}async init(){let e=this.remoteAgentService.getConnection();if(!e)return;let t=await this.remoteAgentService.getEnvironment();if(!t)return;this.remoteUserDataProfilesService=new nMe(t.profiles.all,t.profiles.home,e.getChannel("userDataProfiles")),this._register(this.userDataProfilesService.onDidChangeProfiles(n=>this.onDidChangeLocalProfiles(n)));let o=await this.getAssociatedRemoteProfile(this.userDataProfileService.currentProfile,this.remoteUserDataProfilesService);o.isDefault||this.setAssociatedRemoteProfiles([...this.getAssociatedRemoteProfiles(),o.id]),this.cleanUp()}async onDidChangeLocalProfiles(e){for(let t of e.removed){let o=this.remoteUserDataProfilesService?.profiles.find(n=>n.id===t.id);o&&await this.remoteUserDataProfilesService?.removeProfile(o)}}async getRemoteProfiles(){if(await this.initPromise,!this.remoteUserDataProfilesService)throw new pa("Remote profiles service not available in the current window");return this.remoteUserDataProfilesService.profiles}async getRemoteProfile(e){if(await this.initPromise,!this.remoteUserDataProfilesService)throw new pa("Remote profiles service not available in the current window");return this.getAssociatedRemoteProfile(e,this.remoteUserDataProfilesService)}async getAssociatedRemoteProfile(e,t){if(e.isDefault)return t.defaultProfile;let o=t.profiles.find(n=>n.id===e.id);return o||(o=await t.createProfile(e.id,e.name,{transient:e.isTransient,useDefaultFlags:e.useDefaultFlags}),this.setAssociatedRemoteProfiles([...this.getAssociatedRemoteProfiles(),this.userDataProfileService.currentProfile.id])),o}getAssociatedRemoteProfiles(){return this.environmentService.remoteAuthority?this.parseAssociatedRemoteProfiles()[this.environmentService.remoteAuthority]??[]:[]}setAssociatedRemoteProfiles(e){if(this.environmentService.remoteAuthority){let t=this.parseAssociatedRemoteProfiles();e=zo(e),e.length?t[this.environmentService.remoteAuthority]=e:delete t[this.environmentService.remoteAuthority],Object.keys(t).length?this.storageService.store(uxi,JSON.stringify(t),-1,1):this.storageService.remove(uxi,-1)}}parseAssociatedRemoteProfiles(){if(this.environmentService.remoteAuthority){let e=this.storageService.get(uxi,-1);try{return e?JSON.parse(e):{}}catch(t){this.logService.error(t)}}return{}}async cleanUp(){let e=[];for(let t of this.getAssociatedRemoteProfiles()){let o=this.remoteUserDataProfilesService?.profiles.find(r=>r.id===t);if(!o)continue;let n=this.userDataProfilesService.profiles.find(r=>r.id===t);if(n){n.name!==o.name&&await this.remoteUserDataProfilesService?.updateProfile(o,{name:n.name}),e.push(t);continue}o&&await this.remoteUserDataProfilesService?.removeProfile(o)}this.setAssociatedRemoteProfiles(e)}};JZe=I([m(0,At),m(1,bo),m(2,an),m(3,ln),m(4,ce),m(5,se)],JZe);Ee(GA,JZe,1);var tG=le("IRemoteExtensionsScannerService"),muo="remoteExtensionsScanner";var DH=le("localizationService"),pBt=le("activeLanguageService");var ZZe=class{constructor(i,e,t,o,n,r,s){this.remoteAgentService=i;this.environmentService=e;this.userDataProfileService=t;this.remoteUserDataProfilesService=o;this.activeLanguagePackService=n;this.extensionManagementService=r;this.logService=s}whenExtensionsReady(){return this.withChannel(i=>i.call("whenExtensionsReady"),{failed:[]})}async scanExtensions(){try{let i=await this.activeLanguagePackService.getExtensionIdProvidingCurrentLocale();return await this.withChannel(async e=>{let t=this.userDataProfileService.currentProfile.isDefault?void 0:(await this.remoteUserDataProfilesService.getRemoteProfile(this.userDataProfileService.currentProfile)).extensionsResource,o=await e.call("scanExtensions",[wr,t,this.extensionManagementService.getInstalledWorkspaceExtensionLocations(),this.environmentService.extensionDevelopmentLocationURI,i]);return o.forEach(n=>{n.extensionLocation=A.revive(n.extensionLocation)}),o},[])}catch(i){return this.logService.error(i),[]}}withChannel(i,e){let t=this.remoteAgentService.getConnection();return t?t.withChannel(muo,o=>i(o)):Promise.resolve(e)}};ZZe=I([m(0,bo),m(1,At),m(2,ln),m(3,GA),m(4,pBt),m(5,ru),m(6,se)],ZZe);Ee(tG,ZZe,1);var hxi=le("embedderTerminalService"),pxi=class{constructor(){this._onDidCreateTerminal=new E;this.onDidCreateTerminal=U.buffer(this._onDidCreateTerminal.event,"onDidCreateTerminal")}createTerminal(i){let e={name:i.name,isFeatureTerminal:!0,customPtyImplementation(t,o,n){return new mxi(t,i.pty)}};this._onDidCreateTerminal.fire(e)}},mxi=class extends x{constructor(e,t){super();this.id=e;this.shouldPersist=!1;this._onProcessReady=this._register(new E);this.onProcessReady=this._onProcessReady.event;this._onDidChangeProperty=this._register(new E);this.onDidChangeProperty=this._onDidChangeProperty.event;this._onProcessExit=this._register(new E);this.onProcessExit=this._onProcessExit.event;this._pty=t,this.onProcessData=this._pty.onDidWrite,this._pty.onDidClose&&this._register(this._pty.onDidClose(o=>this._onProcessExit.fire(o||void 0))),this._pty.onDidChangeName&&this._register(this._pty.onDidChangeName(o=>this._onDidChangeProperty.fire({type:"title",value:o})))}async start(){this._onProcessReady.fire({pid:-1,cwd:"",windowsPty:void 0}),this._pty.open()}shutdown(){this._pty.close()}input(){}sendSignal(){}async processBinary(){}resize(){}clearBuffer(){}acknowledgeDataEvent(){}async setUnicodeVersion(){}async getInitialCwd(){return""}async getCwd(){return""}refreshProperty(e){throw new Error(`refreshProperty is not suppported in EmbedderTerminalProcess. property: ${e}`)}updateProperty(e,t){throw new Error(`updateProperty is not suppported in EmbedderTerminalProcess. property: ${e}, value: ${t}`)}};Ee(hxi,pxi,1);function gxi(a){return`${a}.hidden`}var eet=class extends x{constructor(e,t,o,n){super();this.viewContainerName=t;this.storageService=o;this._onDidChangeStoredState=this._register(new E);this.onDidChangeStoredState=this._onDidChangeStoredState.event;this.logger=new co(()=>n.createLogger(W9e,{name:V9e,group:oM})),this.globalViewsStateStorageId=gxi(e),this.workspaceViewsStateStorageId=e,this._register(this.storageService.onDidChangeValue(0,this.globalViewsStateStorageId,this._store)(()=>this.onDidStorageChange())),this.state=this.initialize()}set(e,t){this.state.set(e,t)}get(e){return this.state.get(e)}updateState(e){this.updateWorkspaceState(e),this.updateGlobalState(e)}updateWorkspaceState(e){let t=this.getStoredWorkspaceState();for(let o of e){let n=this.get(o.id);n&&(t[o.id]={collapsed:!!n.collapsed,isHidden:!n.visibleWorkspace,size:n.size,order:o.workspace&&n?n.order:void 0})}Object.keys(t).length>0?this.storageService.store(this.workspaceViewsStateStorageId,JSON.stringify(t),1,1):this.storageService.remove(this.workspaceViewsStateStorageId,1)}updateGlobalState(e){let t=this.getStoredGlobalState();for(let o of e){let n=this.get(o.id);t.set(o.id,{id:o.id,isHidden:n&&o.canToggleVisibility?!n.visibleGlobal:!1,order:!o.workspace&&n?n.order:void 0})}this.setStoredGlobalState(t)}onDidStorageChange(){if(this.globalViewsStatesValue!==this.getStoredGlobalViewsStatesValue()){this._globalViewsStatesValue=void 0;let e=this.getStoredGlobalState(),t=this.getStoredWorkspaceState(),o=[];for(let[n,r]of e){let s=this.get(n);if(s)s.visibleGlobal!==!r.isHidden&&(r.isHidden||this.logger.value.trace(`View visibility state changed: ${n} is now visible`,this.viewContainerName),o.push({id:n,visible:!r.isHidden}));else{let l=t[n];this.set(n,{active:!1,visibleGlobal:!r.isHidden,visibleWorkspace:gn(l?.isHidden)?void 0:!l?.isHidden,collapsed:l?.collapsed,order:l?.order,size:l?.size})}}if(o.length){this._onDidChangeStoredState.fire(o);for(let n of o){let r=this.get(n.id);r&&(r.visibleGlobal=n.visible)}}}}initialize(){let e=new Map,t=this.getStoredWorkspaceState();for(let l of Object.keys(t)){let c=t[l];e.set(l,{active:!1,visibleGlobal:void 0,visibleWorkspace:gn(c.isHidden)?void 0:!c.isHidden,collapsed:c.collapsed,order:c.order,size:c.size})}let o=this.storageService.get(this.globalViewsStateStorageId,1,"[]"),{state:n}=this.parseStoredGlobalState(o);if(n.size>0){for(let{id:l,isHidden:c}of n.values()){let u=e.get(l);u?gn(u.visibleWorkspace)&&(u.visibleWorkspace=!c):e.set(l,{active:!1,collapsed:void 0,visibleGlobal:void 0,visibleWorkspace:!c})}this.storageService.remove(this.globalViewsStateStorageId,1)}let{state:r,hasDuplicates:s}=this.parseStoredGlobalState(this.globalViewsStatesValue);s&&this.setStoredGlobalState(r);for(let{id:l,isHidden:c,order:u}of r.values()){let p=e.get(l);p?(p.visibleGlobal=!c,gn(u)||(p.order=u)):e.set(l,{active:!1,visibleGlobal:!c,order:u,collapsed:void 0,visibleWorkspace:void 0})}return e}getStoredWorkspaceState(){return JSON.parse(this.storageService.get(this.workspaceViewsStateStorageId,1,"{}"))}getStoredGlobalState(){return this.parseStoredGlobalState(this.globalViewsStatesValue).state}setStoredGlobalState(e){this.globalViewsStatesValue=JSON.stringify([...e.values()])}parseStoredGlobalState(e){let t=JSON.parse(e),o=!1;return{state:t.reduce((r,s)=>(typeof s=="string"?(o=o||r.has(s),r.set(s,{id:s,isHidden:!0})):(o=o||r.has(s.id),r.set(s.id,s)),r),new Map),hasDuplicates:o}}get globalViewsStatesValue(){return this._globalViewsStatesValue||(this._globalViewsStatesValue=this.getStoredGlobalViewsStatesValue()),this._globalViewsStatesValue}set globalViewsStatesValue(e){this.globalViewsStatesValue!==e&&(this._globalViewsStatesValue=e,this.setStoredGlobalViewsStatesValue(e))}getStoredGlobalViewsStatesValue(){return this.storageService.get(this.globalViewsStateStorageId,0,"[]")}setStoredGlobalViewsStatesValue(e){this.storageService.store(this.globalViewsStateStorageId,e,0,0)}};eet=I([m(2,ce),m(3,Il)],eet);var rMe=class extends x{constructor(e,t,o,n){super();this.viewContainer=e;this.contextKeyService=o;this.contextKeys=new WSe;this.viewDescriptorItems=[];this._onDidChangeContainerInfo=this._register(new E);this.onDidChangeContainerInfo=this._onDidChangeContainerInfo.event;this._onDidChangeAllViewDescriptors=this._register(new E);this.onDidChangeAllViewDescriptors=this._onDidChangeAllViewDescriptors.event;this._onDidChangeActiveViewDescriptors=this._register(new E);this.onDidChangeActiveViewDescriptors=this._onDidChangeActiveViewDescriptors.event;this._onDidAddVisibleViewDescriptors=this._register(new E);this.onDidAddVisibleViewDescriptors=this._onDidAddVisibleViewDescriptors.event;this._onDidRemoveVisibleViewDescriptors=this._register(new E);this.onDidRemoveVisibleViewDescriptors=this._onDidRemoveVisibleViewDescriptors.event;this._onDidMoveVisibleViewDescriptors=this._register(new E);this.onDidMoveVisibleViewDescriptors=this._onDidMoveVisibleViewDescriptors.event;this.logger=new co(()=>n.createLogger(W9e,{name:V9e,group:oM})),this._register(U.filter(o.onDidChangeContext,r=>r.affectsSome(this.contextKeys))(()=>this.onDidChangeContext())),this.viewDescriptorsState=this._register(t.createInstance(eet,e.storageId||`${e.id}.state`,typeof e.title=="string"?e.title:e.title.original)),this._register(this.viewDescriptorsState.onDidChangeStoredState(r=>this.updateVisibility(r))),this.updateContainerInfo()}get title(){return this._title}get icon(){return this._icon}get keybindingId(){return this._keybindingId}get allViewDescriptors(){return this.viewDescriptorItems.map(e=>e.viewDescriptor)}get activeViewDescriptors(){return this.viewDescriptorItems.filter(e=>e.state.active).map(e=>e.viewDescriptor)}get visibleViewDescriptors(){return this.viewDescriptorItems.filter(e=>this.isViewDescriptorVisible(e)).map(e=>e.viewDescriptor)}updateContainerInfo(){let e=this.viewContainer.alwaysUseContainerInfo||this.visibleViewDescriptors.length===0||this.visibleViewDescriptors.some(c=>ne.as(Mn.ViewsRegistry).getViewContainer(c.id)===this.viewContainer),t=e?typeof this.viewContainer.title=="string"?this.viewContainer.title:this.viewContainer.title.value:this.visibleViewDescriptors[0]?.containerTitle||this.visibleViewDescriptors[0]?.name?.value||"",o=!1;this._title!==t&&(this._title=t,o=!0);let n=e?this.viewContainer.icon:this.visibleViewDescriptors[0]?.containerIcon||PTe,r=!1;this.isEqualIcon(n)||(this._icon=n,r=!0);let s=this.viewContainer.openCommandActionDescriptor?.id??this.activeViewDescriptors.find(c=>c.openCommandActionDescriptor)?.openCommandActionDescriptor?.id,l=!1;this._keybindingId!==s&&(this._keybindingId=s,l=!0),(o||r||l)&&this._onDidChangeContainerInfo.fire({title:o,icon:r,keybindingId:l})}isEqualIcon(e){return A.isUri(e)?A.isUri(this._icon)&&Qe(e,this._icon):q.isThemeIcon(e)?q.isThemeIcon(this._icon)&&q.isEqual(e,this._icon):e===this._icon}isVisible(e){let t=this.viewDescriptorItems.find(o=>o.viewDescriptor.id===e);if(!t)throw new Error(`Unknown view ${e}`);return this.isViewDescriptorVisible(t)}setVisible(e,t){this.updateVisibility([{id:e,visible:t}])}updateVisibility(e){let t=di(e.filter(({visible:r})=>!r).map(({id:r})=>this.findAndIgnoreIfNotFound(r))),o=[];for(let{viewDescriptorItem:r,visibleIndex:s}of t)this.updateViewDescriptorItemVisibility(r,!1)&&o.push({viewDescriptor:r.viewDescriptor,index:s});o.length&&this.broadCastRemovedVisibleViewDescriptors(o);let n=[];for(let{id:r,visible:s}of e){if(!s)continue;let l=this.findAndIgnoreIfNotFound(r);if(!l)continue;let{viewDescriptorItem:c,visibleIndex:u}=l;this.updateViewDescriptorItemVisibility(c,!0)&&n.push({index:u,viewDescriptor:c.viewDescriptor,size:c.state.size,collapsed:!!c.state.collapsed})}n.length&&this.broadCastAddedVisibleViewDescriptors(n)}updateViewDescriptorItemVisibility(e,t){return!e.viewDescriptor.canToggleVisibility||this.isViewDescriptorVisibleWhenActive(e)===t?!1:(e.viewDescriptor.workspace?e.state.visibleWorkspace=t:(e.state.visibleGlobal=t,t&&this.logger.value.trace(`Showing view ${e.viewDescriptor.id} in the container ${this.viewContainer.id}`)),this.isViewDescriptorVisible(e)===t)}isCollapsed(e){return!!this.find(e).viewDescriptorItem.state.collapsed}setCollapsed(e,t){let{viewDescriptorItem:o}=this.find(e);o.state.collapsed!==t&&(o.state.collapsed=t),this.viewDescriptorsState.updateState(this.allViewDescriptors)}getSize(e){return this.find(e).viewDescriptorItem.state.size}setSizes(e){for(let{id:t,size:o}of e){let{viewDescriptorItem:n}=this.find(t);n.state.size!==o&&(n.state.size=o)}this.viewDescriptorsState.updateState(this.allViewDescriptors)}move(e,t){let o=this.viewDescriptorItems.findIndex(l=>l.viewDescriptor.id===e),n=this.viewDescriptorItems.findIndex(l=>l.viewDescriptor.id===t),r=this.viewDescriptorItems[o],s=this.viewDescriptorItems[n];E2i(this.viewDescriptorItems,o,n);for(let l=0;l<this.viewDescriptorItems.length;l++)this.viewDescriptorItems[l].state.order=l;this.broadCastMovedViewDescriptors({index:o,viewDescriptor:r.viewDescriptor},{index:n,viewDescriptor:s.viewDescriptor})}add(e){let t=[];for(let r of e){let s=r.viewDescriptor;if(s.when)for(let c of s.when.keys())this.contextKeys.add(c);let l=this.viewDescriptorsState.get(s.id);if(l){if(s.workspace)l.visibleWorkspace=nr(r.visible)?nr(l.visibleWorkspace)?!s.hideByDefault:l.visibleWorkspace:r.visible;else{let c=l.visibleGlobal;l.visibleGlobal=nr(r.visible)?nr(l.visibleGlobal)?!s.hideByDefault:l.visibleGlobal:r.visible,l.visibleGlobal&&!c&&this.logger.value.trace(`Added view ${s.id} in the container ${this.viewContainer.id} and showing it.`,`${c}`,`${s.hideByDefault}`,`${r.visible}`)}l.collapsed=nr(r.collapsed)?nr(l.collapsed)?!!s.collapsed:l.collapsed:r.collapsed}else l={active:!1,visibleGlobal:nr(r.visible)?!s.hideByDefault:r.visible,visibleWorkspace:nr(r.visible)?!s.hideByDefault:r.visible,collapsed:nr(r.collapsed)?!!s.collapsed:r.collapsed};this.viewDescriptorsState.set(s.id,l),l.active=this.contextKeyService.contextMatchesRules(s.when),t.push({viewDescriptor:s,state:l})}this.viewDescriptorItems.push(...t),this.viewDescriptorItems.sort(this.compareViewDescriptors.bind(this)),this._onDidChangeAllViewDescriptors.fire({added:t.map(({viewDescriptor:r})=>r),removed:[]});let o=[];for(let r of t)r.state.active&&o.push({viewDescriptorItem:r,visible:this.isViewDescriptorVisible(r)});o.length&&this._onDidChangeActiveViewDescriptors.fire({added:o.map(({viewDescriptorItem:r})=>r.viewDescriptor),removed:[]});let n=[];for(let{viewDescriptorItem:r,visible:s}of o)if(s&&this.isViewDescriptorVisible(r)){let{visibleIndex:l}=this.find(r.viewDescriptor.id);n.push({index:l,viewDescriptor:r.viewDescriptor,size:r.state.size,collapsed:!!r.state.collapsed})}this.broadCastAddedVisibleViewDescriptors(n)}remove(e){let t=[],o=[],n=[],r=[];for(let s of e){if(s.when)for(let c of s.when.keys())this.contextKeys.delete(c);let l=this.viewDescriptorItems.findIndex(c=>c.viewDescriptor.id===s.id);if(l!==-1){t.push(s);let c=this.viewDescriptorItems[l];if(c.state.active&&n.push(c.viewDescriptor),this.isViewDescriptorVisible(c)){let{visibleIndex:u}=this.find(c.viewDescriptor.id);r.push({index:u,viewDescriptor:c.viewDescriptor})}o.push(c)}}o.forEach(s=>this.viewDescriptorItems.splice(this.viewDescriptorItems.indexOf(s),1)),this.broadCastRemovedVisibleViewDescriptors(r),n.length&&this._onDidChangeActiveViewDescriptors.fire({added:[],removed:n}),t.length&&this._onDidChangeAllViewDescriptors.fire({added:[],removed:t})}onDidChangeContext(){let e=[],t=[];for(let r of this.viewDescriptorItems){let s=r.state.active,l=this.contextKeyService.contextMatchesRules(r.viewDescriptor.when);s!==l&&(l?e.push({item:r,visibleWhenActive:this.isViewDescriptorVisibleWhenActive(r)}):t.push(r))}let o=[];for(let r of t)if(this.isViewDescriptorVisible(r)){let{visibleIndex:s}=this.find(r.viewDescriptor.id);o.push({index:s,viewDescriptor:r.viewDescriptor})}t.forEach(r=>r.state.active=!1),e.forEach(({item:r})=>r.state.active=!0),this.broadCastRemovedVisibleViewDescriptors(o),(e.length||t.length)&&this._onDidChangeActiveViewDescriptors.fire({added:e.map(({item:r})=>r.viewDescriptor),removed:t.map(r=>r.viewDescriptor)});let n=[];for(let{item:r,visibleWhenActive:s}of e)if(s&&this.isViewDescriptorVisible(r)){let{visibleIndex:l}=this.find(r.viewDescriptor.id);n.push({index:l,viewDescriptor:r.viewDescriptor,size:r.state.size,collapsed:!!r.state.collapsed})}this.broadCastAddedVisibleViewDescriptors(n)}broadCastAddedVisibleViewDescriptors(e){e.length&&(this._onDidAddVisibleViewDescriptors.fire(e.sort((t,o)=>t.index-o.index)),this.updateState(`Added views:${e.map(t=>t.viewDescriptor.id).join(",")} in ${this.viewContainer.id}`))}broadCastRemovedVisibleViewDescriptors(e){e.length&&(this._onDidRemoveVisibleViewDescriptors.fire(e.sort((t,o)=>o.index-t.index)),this.updateState(`Removed views:${e.map(t=>t.viewDescriptor.id).join(",")} from ${this.viewContainer.id}`))}broadCastMovedViewDescriptors(e,t){this._onDidMoveVisibleViewDescriptors.fire({from:e,to:t}),this.updateState(`Moved view ${e.viewDescriptor.id} to ${t.viewDescriptor.id} in ${this.viewContainer.id}`)}updateState(e){this.logger.value.trace(e),this.viewDescriptorsState.updateState(this.allViewDescriptors),this.updateContainerInfo()}isViewDescriptorVisible(e){return e.state.active?this.isViewDescriptorVisibleWhenActive(e):!1}isViewDescriptorVisibleWhenActive(e){return e.viewDescriptor.workspace?!!e.state.visibleWorkspace:!!e.state.visibleGlobal}find(e){let t=this.findAndIgnoreIfNotFound(e);if(t)return t;throw new Error(`view descriptor ${e} not found`)}findAndIgnoreIfNotFound(e){for(let t=0,o=0;t<this.viewDescriptorItems.length;t++){let n=this.viewDescriptorItems[t];if(n.viewDescriptor.id===e)return{index:t,visibleIndex:o,viewDescriptorItem:n};this.isViewDescriptorVisible(n)&&o++}}compareViewDescriptors(e,t){return e.viewDescriptor.id===t.viewDescriptor.id?0:this.getViewOrder(e)-this.getViewOrder(t)||this.getGroupOrderResult(e.viewDescriptor,t.viewDescriptor)}getViewOrder(e){let t=typeof e.state.order=="number"?e.state.order:e.viewDescriptor.order;return typeof t=="number"?t:Number.MAX_VALUE}getGroupOrderResult(e,t){return!e.group||!t.group||e.group===t.group?0:e.group<t.group?-1:1}};rMe=I([m(1,F),m(2,X),m(3,Il)],rMe);function huo(a){return`${a}.state`}var mM=class extends x{constructor(e,t,o,n,r,s,l){super();this.instantiationService=e;this.contextKeyService=t;this.storageService=o;this.extensionService=n;this.telemetryService=r;this._onDidChangeContainer=this._register(new E);this.onDidChangeContainer=this._onDidChangeContainer.event;this._onDidChangeLocation=this._register(new E);this.onDidChangeLocation=this._onDidChangeLocation.event;this._onDidChangeContainerLocation=this._register(new E);this.onDidChangeContainerLocation=this._onDidChangeContainerLocation.event;this.viewContainerModels=this._register(new Vt);this.viewsVisibilityActionDisposables=this._register(new Vt);this.canRegisterViewsVisibilityActions=!1;this._onDidChangeViewContainers=this._register(new E);this.onDidChangeViewContainers=this._onDidChangeViewContainers.event;this.logger=new co(()=>s.createLogger(W9e,{name:V9e,group:oM})),this.isSessionsWindow=l.isSessionsWindow,this.activeViewContextKeys=new Map,this.movableViewContextKeys=new Map,this.defaultViewLocationContextKeys=new Map,this.defaultViewContainerLocationContextKeys=new Map,this.viewContainersRegistry=ne.as(Mn.ViewContainersRegistry),this.viewsRegistry=ne.as(Mn.ViewsRegistry),this.migrateToViewsCustomizationsStorage(),this.viewContainersCustomLocations=new Map(Object.entries(this.viewCustomizations.viewContainerLocations)),this.viewDescriptorsCustomLocations=new Map(Object.entries(this.viewCustomizations.viewLocations)),this.viewContainerBadgeEnablementStates=new Map(Object.entries(this.viewCustomizations.viewContainerBadgeEnablementStates)),this.viewContainers.forEach(c=>this.onDidRegisterViewContainer(c)),this._register(this.viewsRegistry.onViewsRegistered(c=>this.onDidRegisterViews(c))),this._register(this.viewsRegistry.onViewsDeregistered(({views:c,viewContainer:u})=>this.onDidDeregisterViews(c,u))),this._register(this.viewsRegistry.onDidChangeContainer(({views:c,from:u,to:p})=>this.onDidChangeDefaultContainer(c,u,p))),this._register(this.viewContainersRegistry.onDidRegister(({viewContainer:c})=>{this.onDidRegisterViewContainer(c),this._onDidChangeViewContainers.fire({added:[{container:c,location:this.getViewContainerLocation(c)}],removed:[]})})),this._register(this.viewContainersRegistry.onDidDeregister(({viewContainer:c,viewContainerLocation:u})=>{this.onDidDeregisterViewContainer(c),this._onDidChangeViewContainers.fire({removed:[{container:c,location:u}],added:[]})})),this._register(this.storageService.onDidChangeValue(0,mM.VIEWS_CUSTOMIZATIONS,this._store)(()=>this.onDidStorageChange())),this.extensionService.whenInstalledExtensionsRegistered().then(()=>this.whenExtensionsRegistered())}static{this.VIEWS_CUSTOMIZATIONS="views.customizations"}static{this.COMMON_CONTAINER_ID_PREFIX="workbench.views.service"}get viewContainers(){return this.viewContainersRegistry.all}migrateToViewsCustomizationsStorage(){if(this.storageService.get(mM.VIEWS_CUSTOMIZATIONS,0))return;let e=this.storageService.get("views.cachedViewContainerLocations",0),t=this.storageService.get("views.cachedViewPositions",0);if(!e&&!t)return;let o=e?JSON.parse(e):[],n=t?JSON.parse(t):[],r={viewContainerLocations:o.reduce((s,[l,c])=>(s[l]=c,s),{}),viewLocations:n.reduce((s,[l,{containerId:c}])=>(s[l]=c,s),{}),viewContainerBadgeEnablementStates:{}};this.storageService.store(mM.VIEWS_CUSTOMIZATIONS,JSON.stringify(r),0,0),this.storageService.remove("views.cachedViewContainerLocations",0),this.storageService.remove("views.cachedViewPositions",0)}registerGroupedViews(e){for(let[t,o]of e.entries()){let n=this.viewContainersRegistry.get(t);if(!n||!this.viewContainerModels.has(n)){if(this.isGeneratedContainerId(t)){let s=this.viewContainersCustomLocations.get(t);s!==void 0&&this.registerGeneratedViewContainer(s,t)}continue}let r=o.filter(s=>this.getViewContainerModel(n).allViewDescriptors.filter(l=>l.id===s.id).length===0);this.addViews(n,r)}}deregisterGroupedViews(e){for(let[t,o]of e.entries()){let n=this.viewContainersRegistry.get(t);!n||!this.viewContainerModels.has(n)||this.removeViews(n,o)}}moveOrphanViewsToDefaultLocation(){for(let[e,t]of this.viewDescriptorsCustomLocations.entries()){if(this.viewContainersRegistry.get(t))continue;let o=this.viewsRegistry.getViewContainer(e),n=this.getViewDescriptorById(e);o&&n&&this.addViews(o,[n])}}whenExtensionsRegistered(){this.moveOrphanViewsToDefaultLocation();for(let e of[...this.viewContainersCustomLocations.keys()])this.cleanUpGeneratedViewContainer(e);this.saveViewCustomizations();for(let[e,t]of this.viewContainerModels)this.registerViewsVisibilityActions(e,t);this.canRegisterViewsVisibilityActions=!0}onDidRegisterViews(e){this.contextKeyService.bufferChangeEvents(()=>{e.forEach(({views:t,viewContainer:o})=>{let n=this.regroupViews(o.id,t);this.registerGroupedViews(n),t.forEach(r=>this.getOrCreateMovableViewContextKey(r).set(!!r.canMoveView))})})}isGeneratedContainerId(e){return e.startsWith(mM.COMMON_CONTAINER_ID_PREFIX)}onDidDeregisterViews(e,t){let o=this.regroupViews(t.id,e);this.deregisterGroupedViews(o),this.contextKeyService.bufferChangeEvents(()=>{e.forEach(n=>this.getOrCreateMovableViewContextKey(n).set(!1))})}regroupViews(e,t){let o=new Map;for(let n of t){let r=this.viewDescriptorsCustomLocations.get(n.id)??e,s=o.get(r);s||o.set(r,s=[]),s.push(n)}return o}getViewDescriptorById(e){let t=this.viewsRegistry.getView(e);return t&&!this.isViewVisible(t)?null:t}getViewLocationById(e){let t=this.getViewContainerByViewId(e);return t===null?null:this.getViewContainerLocation(t)}getViewContainerByViewId(e){let t=this.viewsRegistry.getView(e);if(t&&!this.isViewVisible(t))return null;let o=this.viewDescriptorsCustomLocations.get(e);return o?this.viewContainersRegistry.get(o)??null:this.getDefaultContainerById(e)}getViewContainerLocation(e){let t=this.viewContainersCustomLocations.get(e.id)??this.getDefaultViewContainerLocation(e);return this.getEffectiveViewContainerLocation(t)}getDefaultViewContainerLocation(e){return this.getEffectiveViewContainerLocation(this.viewContainersRegistry.getViewContainerLocation(e))}getEffectiveViewContainerLocation(e){return!this.isSessionsWindow&&e===3?2:e}getDefaultContainerById(e){return this.viewsRegistry.getViewContainer(e)??null}getViewContainerModel(e){return this.getOrRegisterViewContainerModel(e)}getViewContainerById(e){let t=this.viewContainersRegistry.get(e)||null;return t&&!this.isViewContainerVisible(t)?null:t}getViewContainersByLocation(e){return this.viewContainers.filter(t=>this.getViewContainerLocation(t)===e&&this.isViewContainerVisible(t))}isViewContainerVisible(e){let t=e.windowVisibility;return this.isSessionsWindow?t===2||t===3:!t||t===1||t===3}isViewVisible(e){let t=e.windowVisibility;return this.isSessionsWindow?t===2||t===3:!t||t===1||t===3}getDefaultViewContainer(e){return this.viewContainersRegistry.getDefaultViewContainers(e).find(o=>this.isViewContainerVisible(o))}canMoveViews(){return!this.isSessionsWindow}moveViewContainerToLocation(e,t,o,n){this.canMoveViews()&&(this.logger.value.trace(`moveViewContainerToLocation: viewContainer:${e.id} location:${t} reason:${n}`),this.moveViewContainerToLocationWithoutSaving(e,t,o),this.saveViewCustomizations())}getViewContainerBadgeEnablementState(e){return this.viewContainerBadgeEnablementStates.get(e)??!0}setViewContainerBadgeEnablementState(e,t){this.viewContainerBadgeEnablementStates.set(e,t),this.saveViewCustomizations()}moveViewToLocation(e,t,o){if(!this.canMoveViews())return;this.logger.value.trace(`moveViewToLocation: view:${e.id} location:${t} reason:${o}`);let n=this.registerGeneratedViewContainer(t);this.moveViewsToContainer([e],n)}moveViewsToContainer(e,t,o,n){if(!e.length||!this.canMoveViews())return;this.logger.value.trace(`moveViewsToContainer: views:${e.map(l=>l.id).join(",")} viewContainer:${t.id} reason:${n}`);let r=this.getViewContainerByViewId(e[0].id),s=t;r&&s&&r!==s&&(this.moveViewsWithoutSaving(e,r,s,o),this.cleanUpGeneratedViewContainer(r.id),this.saveViewCustomizations(),this.reportMovedViews(e,r,s))}reset(){for(let e of this.viewContainers){let t=this.getViewContainerModel(e);for(let r of t.allViewDescriptors){let s=this.getDefaultContainerById(r.id),l=this.getViewContainerByViewId(r.id);l&&s&&l!==s&&this.moveViewsWithoutSaving([r],l,s)}let o=this.getDefaultViewContainerLocation(e),n=this.getViewContainerLocation(e);o!==null&&n!==o&&this.moveViewContainerToLocationWithoutSaving(e,o),this.cleanUpGeneratedViewContainer(e.id)}this.viewContainersCustomLocations.clear(),this.viewDescriptorsCustomLocations.clear(),this.saveViewCustomizations()}isViewContainerRemovedPermanently(e){return this.isGeneratedContainerId(e)&&!this.viewContainersCustomLocations.has(e)}onDidChangeDefaultContainer(e,t,o){let n=e.filter(r=>!this.viewDescriptorsCustomLocations.has(r.id)||!this.viewContainers.includes(t)&&this.viewDescriptorsCustomLocations.get(r.id)===t.id);n.length&&this.moveViewsWithoutSaving(n,t,o)}reportMovedViews(e,t,o){let n=g=>g.id.startsWith(mM.COMMON_CONTAINER_ID_PREFIX)?"custom":g.extensionId?"extension":g.id,r=this.getViewContainerLocation(t),s=this.getViewContainerLocation(o),l=e.length,c=n(t),u=n(o),p=r===1?"panel":"sidebar",h=s===1?"panel":"sidebar";this.telemetryService.publicLog2("viewDescriptorService.moveViews",{viewCount:l,fromContainer:c,toContainer:u,fromLocation:p,toLocation:h})}moveViewsWithoutSaving(e,t,o,n=1){this.removeViews(t,e),this.addViews(o,e,n);let r=this.getViewContainerLocation(t),s=this.getViewContainerLocation(o);r!==s&&this._onDidChangeLocation.fire({views:e,from:r,to:s}),this._onDidChangeContainer.fire({views:e,from:t,to:o})}moveViewContainerToLocationWithoutSaving(e,t,o){let n=this.getViewContainerLocation(e),r=t;if(n!==r){let s=this.isGeneratedContainerId(e.id),l=r===this.getDefaultViewContainerLocation(e);s||!l?this.viewContainersCustomLocations.set(e.id,r):this.viewContainersCustomLocations.delete(e.id),this.getOrCreateDefaultViewContainerLocationContextKey(e).set(s||l),e.requestedIndex=o,this._onDidChangeContainerLocation.fire({viewContainer:e,from:n,to:r});let c=this.getViewsByContainer(e);this._onDidChangeLocation.fire({views:c,from:n,to:r})}}cleanUpGeneratedViewContainer(e){if(!this.isGeneratedContainerId(e))return;let t=this.getViewContainerById(e);t&&this.getViewContainerModel(t)?.allViewDescriptors.length||[...this.viewDescriptorsCustomLocations.values()].includes(e)||(t&&this.viewContainersRegistry.deregisterViewContainer(t),this.viewContainersCustomLocations.delete(e),this.viewContainerBadgeEnablementStates.delete(e),this.storageService.remove(gxi(t?.storageId||huo(e)),0))}registerGeneratedViewContainer(e,t){let o=t||this.generateContainerId(e),n=this.viewContainersRegistry.registerViewContainer({id:o,ctorDescriptor:new Ft(Dc,[o,{mergeViewWithContainerWhenSingleView:!0}]),title:{value:d(18319,null),original:"User View Container"},icon:e===0?PTe:void 0,storageId:huo(o),hideIfEmpty:!0},e,{doNotRegisterOpenCommand:!0});return this.viewContainersCustomLocations.get(n.id)!==e&&this.viewContainersCustomLocations.set(n.id,e),this.getOrCreateDefaultViewContainerLocationContextKey(n).set(!0),n}onDidStorageChange(){JSON.stringify(this.viewCustomizations)!==this.getStoredViewCustomizationsValue()&&this.onDidViewCustomizationsStorageChange()}onDidViewCustomizationsStorageChange(){this._viewCustomizations=void 0;let e=new Map(Object.entries(this.viewCustomizations.viewContainerLocations)),t=new Map(Object.entries(this.viewCustomizations.viewLocations)),o=[],n=[];for(let[r,s]of e.entries()){let l=this.getViewContainerById(r);l?s!==this.getViewContainerLocation(l)&&o.push([l,s]):this.isGeneratedContainerId(r)&&this.registerGeneratedViewContainer(s,r)}for(let r of this.viewContainers)if(!e.has(r.id)){let s=this.getViewContainerLocation(r),l=this.getDefaultViewContainerLocation(r);s!==l&&o.push([r,l])}for(let[r,s]of t.entries()){let l=this.getViewDescriptorById(r);if(l){let c=this.getViewContainerByViewId(r),u=this.viewContainersRegistry.get(s);c&&u&&u!==c&&n.push({views:[l],from:c,to:u})}}for(let r of this.viewContainers){let s=this.getViewContainerModel(r);for(let l of s.allViewDescriptors)if(!t.has(l.id)){let c=this.getViewContainerByViewId(l.id),u=this.getDefaultContainerById(l.id);c&&u&&c!==u&&n.push({views:[l],from:c,to:u})}}for(let[r,s]of o)this.moveViewContainerToLocationWithoutSaving(r,s);for(let{views:r,from:s,to:l}of n)this.moveViewsWithoutSaving(r,s,l,0);this.viewContainersCustomLocations=e,this.viewDescriptorsCustomLocations=t}generateContainerId(e){return`${mM.COMMON_CONTAINER_ID_PREFIX}.${Pw(e)}.${xt()}`}saveViewCustomizations(){let e={viewContainerLocations:{},viewLocations:{},viewContainerBadgeEnablementStates:{}};for(let[t,o]of this.viewContainersCustomLocations){let n=this.getViewContainerById(t);n&&!this.isGeneratedContainerId(t)&&o===this.getDefaultViewContainerLocation(n)||(e.viewContainerLocations[t]=o)}for(let[t,o]of this.viewDescriptorsCustomLocations){let n=this.getViewContainerById(o);n&&this.getDefaultContainerById(t)?.id===n.id||(e.viewLocations[t]=o)}for(let[t,o]of this.viewContainerBadgeEnablementStates)o===!1&&(e.viewContainerBadgeEnablementStates[t]=o);this.viewCustomizations=e}get viewCustomizations(){return this._viewCustomizations||(this._viewCustomizations=JSON.parse(this.getStoredViewCustomizationsValue()),this._viewCustomizations.viewContainerLocations=this._viewCustomizations.viewContainerLocations??{},this._viewCustomizations.viewLocations=this._viewCustomizations.viewLocations??{},this._viewCustomizations.viewContainerBadgeEnablementStates=this._viewCustomizations.viewContainerBadgeEnablementStates??{}),this._viewCustomizations}set viewCustomizations(e){let t=JSON.stringify(e);JSON.stringify(this.viewCustomizations)!==t&&(this._viewCustomizations=e,this.setStoredViewCustomizationsValue(t))}getStoredViewCustomizationsValue(){return this.isSessionsWindow?"{}":this.storageService.get(mM.VIEWS_CUSTOMIZATIONS,0,"{}")}setStoredViewCustomizationsValue(e){this.isSessionsWindow||this.storageService.store(mM.VIEWS_CUSTOMIZATIONS,e,0,0)}getViewsByContainer(e){let t=this.viewsRegistry.getViews(e).filter(o=>(this.viewDescriptorsCustomLocations.get(o.id)??e.id)===e.id);for(let[o,n]of this.viewDescriptorsCustomLocations.entries()){if(n!==e.id||this.viewsRegistry.getViewContainer(o)===e)continue;let r=this.getViewDescriptorById(o);r&&t.push(r)}return t}onDidRegisterViewContainer(e){let t=this.isGeneratedContainerId(e.id)?!0:this.getViewContainerLocation(e)===this.getDefaultViewContainerLocation(e);this.getOrCreateDefaultViewContainerLocationContextKey(e).set(t),this.getOrRegisterViewContainerModel(e)}getOrRegisterViewContainerModel(e){let t=this.viewContainerModels.get(e)?.viewContainerModel;if(!t){let o=new N;t=o.add(this.instantiationService.createInstance(rMe,e)),this.onDidChangeActiveViews({added:t.activeViewDescriptors,removed:[]}),t.onDidChangeActiveViewDescriptors(s=>this.onDidChangeActiveViews(s),this,o),this.onDidChangeVisibleViews({added:[...t.visibleViewDescriptors],removed:[]}),t.onDidAddVisibleViewDescriptors(s=>this.onDidChangeVisibleViews({added:s.map(({viewDescriptor:l})=>l),removed:[]}),this,o),t.onDidRemoveVisibleViewDescriptors(s=>this.onDidChangeVisibleViews({added:[],removed:s.map(({viewDescriptor:l})=>l)}),this,o),o.add(Z(()=>this.viewsVisibilityActionDisposables.deleteAndDispose(e))),o.add(this.registerResetViewContainerAction(e));let n={viewContainerModel:t,disposables:o,dispose:()=>o.dispose()};this.viewContainerModels.set(e,n),this.onDidRegisterViews([{views:this.viewsRegistry.getViews(e),viewContainer:e}]);let r=this.getViewsByContainer(e).filter(s=>this.getDefaultContainerById(s.id)!==e);r.length&&(this.addViews(e,r),this.contextKeyService.bufferChangeEvents(()=>{r.forEach(s=>this.getOrCreateMovableViewContextKey(s).set(!!s.canMoveView))})),this.canRegisterViewsVisibilityActions&&this.registerViewsVisibilityActions(e,n)}return t}onDidDeregisterViewContainer(e){this.viewContainerModels.deleteAndDispose(e),this.viewsVisibilityActionDisposables.deleteAndDispose(e)}onDidChangeActiveViews({added:e,removed:t}){this.contextKeyService.bufferChangeEvents(()=>{e.forEach(o=>this.getOrCreateActiveViewContextKey(o).set(!0)),t.forEach(o=>this.getOrCreateActiveViewContextKey(o).set(!1))})}onDidChangeVisibleViews({added:e,removed:t}){this.contextKeyService.bufferChangeEvents(()=>{e.forEach(o=>this.getOrCreateVisibleViewContextKey(o).set(!0)),t.forEach(o=>this.getOrCreateVisibleViewContextKey(o).set(!1))})}registerViewsVisibilityActions(e,{viewContainerModel:t,disposables:o}){this.viewsVisibilityActionDisposables.deleteAndDispose(e),this.viewsVisibilityActionDisposables.set(e,this.registerViewsVisibilityActionsForContainer(t)),o.add(U.any(t.onDidChangeActiveViewDescriptors,t.onDidAddVisibleViewDescriptors,t.onDidRemoveVisibleViewDescriptors,t.onDidMoveVisibleViewDescriptors)(n=>{this.viewsVisibilityActionDisposables.deleteAndDispose(e),this.viewsVisibilityActionDisposables.set(e,this.registerViewsVisibilityActionsForContainer(t))}))}registerViewsVisibilityActionsForContainer(e){let t=new N;return e.activeViewDescriptors.forEach((o,n)=>{o.remoteAuthority||(t.add(W(class extends VYe{constructor(){super({id:`${o.id}.toggleVisibility`,viewPaneContainerId:e.viewContainer.id,precondition:o.canToggleVisibility&&(!e.isVisible(o.id)||e.visibleViewDescriptors.length>1)?C.true():C.false(),toggled:C.has(`${o.id}.visible`),title:o.name,metadata:{description:L(18318,"Toggles the visibility of the {0} view if the view container it is located in is visible",o.name.value)},menu:[{id:J4,when:C.equals("viewContainer",e.viewContainer.id),order:n},{id:D.ViewContainerTitleContext,when:C.equals("viewContainer",e.viewContainer.id),order:n,group:"1_toggleVisibility"},{id:D.ViewTitleContext,when:C.or(...e.visibleViewDescriptors.map(r=>C.equals("view",r.id))),order:n,group:"2_toggleVisibility"}]})}async runInViewPaneContainer(r,s){s.toggleViewVisibility(o.id)}})),t.add(W(class extends VYe{constructor(){super({id:`${o.id}.removeView`,viewPaneContainerId:e.viewContainer.id,title:d(18315,null,o.name.value),metadata:{description:L(18316,"Hides the {0} view if it is visible and the view container it is located in is visible",o.name.value)},precondition:o.canToggleVisibility&&(!e.isVisible(o.id)||e.visibleViewDescriptors.length>1)?C.true():C.false(),menu:[{id:D.ViewTitleContext,when:C.and(C.equals("view",o.id),C.has(`${o.id}.visible`)),group:"1_hide",order:1}]})}async runInViewPaneContainer(r,s){s.getView(o.id)?.isVisible()&&s.toggleViewVisibility(o.id)}})))}),t}registerResetViewContainerAction(e){let t=this;return W(class extends K{constructor(){super({id:`${e.id}.resetViewContainerLocation`,title:L(18317,"Reset Location"),menu:[{id:D.ViewContainerTitleContext,group:"1_viewActions",when:C.or(C.and(C.equals("viewContainer",e.id),C.equals(`${e.id}.defaultViewContainerLocation`,!1)))}]})}run(n){t.moveViewContainerToLocation(e,t.getDefaultViewContainerLocation(e),void 0,this.desc.id),n.get($t).openViewContainer(e.id,!0)}})}addViews(e,t,o=0){this.contextKeyService.bufferChangeEvents(()=>{t.forEach(n=>{let r=this.getDefaultContainerById(n.id)===e;this.getOrCreateDefaultViewLocationContextKey(n).set(r),r?this.viewDescriptorsCustomLocations.delete(n.id):this.viewDescriptorsCustomLocations.set(n.id,e.id)})}),this.getViewContainerModel(e).add(t.map(n=>({viewDescriptor:n,collapsed:o===0?void 0:!1,visible:o===0?void 0:!0})))}removeViews(e,t){this.contextKeyService.bufferChangeEvents(()=>{t.forEach(o=>{this.viewDescriptorsCustomLocations.get(o.id)===e.id&&this.viewDescriptorsCustomLocations.delete(o.id),this.getOrCreateDefaultViewLocationContextKey(o).set(!1)})}),this.getViewContainerModel(e).remove(t)}getOrCreateActiveViewContextKey(e){let t=`${e.id}.active`,o=this.activeViewContextKeys.get(t);return o||(o=new Y(t,!1).bindTo(this.contextKeyService),this.activeViewContextKeys.set(t,o)),o}getOrCreateVisibleViewContextKey(e){let t=`${e.id}.visible`,o=this.activeViewContextKeys.get(t);return o||(o=new Y(t,!1).bindTo(this.contextKeyService),this.activeViewContextKeys.set(t,o)),o}getOrCreateMovableViewContextKey(e){let t=`${e.id}.canMove`,o=this.movableViewContextKeys.get(t);return o||(o=new Y(t,!1).bindTo(this.contextKeyService),this.movableViewContextKeys.set(t,o)),o}getOrCreateDefaultViewLocationContextKey(e){let t=`${e.id}.defaultViewLocation`,o=this.defaultViewLocationContextKeys.get(t);return o||(o=new Y(t,!1).bindTo(this.contextKeyService),this.defaultViewLocationContextKeys.set(t,o)),o}getOrCreateDefaultViewContainerLocationContextKey(e){let t=`${e.id}.defaultViewContainerLocation`,o=this.defaultViewContainerLocationContextKeys.get(t);return o||(o=new Y(t,!1).bindTo(this.contextKeyService),this.defaultViewContainerLocationContextKeys.set(t,o)),o}};mM=I([m(0,F),m(1,X),m(2,ce),m(3,lt),m(4,Te),m(5,Il),m(6,At)],mM);Ee(Bi,mM,1);var kee=class extends Dc{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super(e,{mergeViewWithContainerWhenSingleView:!1},l,o,n,u,r,p,c,s,h,g,f);this.constantViewDescriptors=new Map;this.allViews=new Map;this._register(t(v=>{this.filterValue=v,this.onFilterChanged(v)})),this._register(this.viewContainerModel.onDidChangeActiveViewDescriptors(()=>{this.updateAllViews(this.viewContainerModel.activeViewDescriptors)}))}updateAllViews(e){e.forEach(t=>{let o=this.getFilterOn(t);o&&(this.allViews.has(o)||this.allViews.set(o,new Map),this.allViews.get(o).set(t.id,t),this.filterValue&&!this.filterValue.includes(o)&&this.panes.find(n=>n.id===t.id)&&this.viewContainerModel.setVisible(t.id,!1))})}addConstantViewDescriptors(e){e.forEach(t=>this.constantViewDescriptors.set(t.id,t))}onFilterChanged(e){this.allViews.size===0&&this.updateAllViews(this.viewContainerModel.activeViewDescriptors),this.getViewsNotForTarget(e).forEach(t=>this.viewContainerModel.setVisible(t.id,!1)),this.getViewsForTarget(e).forEach(t=>this.viewContainerModel.setVisible(t.id,!0))}getViewsForTarget(e){let t=[];for(let o=0;o<e.length;o++)this.allViews.has(e[o])&&t.push(...Array.from(this.allViews.get(e[o]).values()));return t}getViewsNotForTarget(e){let t=this.allViews.keys(),o=t.next(),n=[];for(;!o.done;){let r=!1;e.forEach(s=>{o.value===s&&(r=!0)}),r||(n=n.concat(this.getViewsForTarget([o.value]))),o=t.next()}return n}onDidAddViewDescriptors(e){let t=super.onDidAddViewDescriptors(e);for(let o=0;o<e.length;o++)this.constantViewDescriptors.has(e[o].viewDescriptor.id)&&t[o].setExpanded(!1);return this.allViews.size===0&&this.updateAllViews(this.viewContainerModel.activeViewDescriptors),t}openView(e,t){let o=super.openView(e,t);if(o){let n=Array.from(this.allViews.entries()).find(r=>r[1].has(e));n&&!this.filterValue?.includes(n[0])&&this.setFilter(n[1].get(e))}return o}};kee=I([m(2,B),m(3,yi),m(4,Te),m(5,ce),m(6,F),m(7,Le),m(8,Xe),m(9,lt),m(10,Pe),m(11,Bi),m(12,se)],kee);var tet=class extends x{constructor(e,t,o,n,r){super();this.viewDescriptorService=e;this.paneCompositeService=t;this.contextKeyService=o;this.layoutService=n;this.editorService=r;this._onDidChangeViewVisibility=this._register(new E);this.onDidChangeViewVisibility=this._onDidChangeViewVisibility.event;this._onDidChangeViewContainerVisibility=this._register(new E);this.onDidChangeViewContainerVisibility=this._onDidChangeViewContainerVisibility.event;this._onDidChangeFocusedView=this._register(new E);this.onDidChangeFocusedView=this._onDidChangeFocusedView.event;this.viewContainerDisposables=this._register(new Vt);this.viewDisposable=new Map,this.enabledViewContainersContextKeys=new Map,this.visibleViewContextKeys=new Map,this.viewPaneContainers=new Map,this._register(Z(()=>{this.viewDisposable.forEach(s=>s.dispose()),this.viewDisposable.clear()})),this.viewDescriptorService.viewContainers.forEach(s=>this.onDidRegisterViewContainer(s,this.viewDescriptorService.getViewContainerLocation(s))),this._register(this.viewDescriptorService.onDidChangeViewContainers(({added:s,removed:l})=>this.onDidChangeContainers(s,l))),this._register(this.viewDescriptorService.onDidChangeContainerLocation(({viewContainer:s,from:l,to:c})=>this.onDidChangeContainerLocation(s,l,c))),this._register(this.paneCompositeService.onDidPaneCompositeOpen(s=>this._onDidChangeViewContainerVisibility.fire({id:s.composite.getId(),visible:!0,location:s.viewContainerLocation}))),this._register(this.paneCompositeService.onDidPaneCompositeClose(s=>this._onDidChangeViewContainerVisibility.fire({id:s.composite.getId(),visible:!1,location:s.viewContainerLocation}))),this.focusedViewContextKey=ql.bindTo(o)}onViewsAdded(e){for(let t of e)this.onViewsVisibilityChanged(t,t.isBodyVisible())}onViewsVisibilityChanged(e,t){this.getOrCreateActiveViewContextKey(e).set(t),this._onDidChangeViewVisibility.fire({id:e.id,visible:t})}onViewsRemoved(e){for(let t of e)this.onViewsVisibilityChanged(t,!1)}getOrCreateActiveViewContextKey(e){let t=R6e(e.id),o=this.visibleViewContextKeys.get(t);return o||(o=new Y(t,!1).bindTo(this.contextKeyService),this.visibleViewContextKeys.set(t,o)),o}onDidChangeContainers(e,t){for(let{container:o,location:n}of t)this.onDidDeregisterViewContainer(o,n);for(let{container:o,location:n}of e)this.onDidRegisterViewContainer(o,n)}onDidRegisterViewContainer(e,t){this.registerPaneComposite(e,t);let o=new N,n=this.viewDescriptorService.getViewContainerModel(e);this.onViewDescriptorsAdded(n.allViewDescriptors,e),o.add(n.onDidChangeAllViewDescriptors(({added:r,removed:s})=>{this.onViewDescriptorsAdded(r,e),this.onViewDescriptorsRemoved(s)})),this.updateViewContainerEnablementContextKey(e),o.add(n.onDidChangeActiveViewDescriptors(()=>this.updateViewContainerEnablementContextKey(e))),o.add(this.registerOpenViewContainerAction(e)),this.viewContainerDisposables.set(e.id,o)}onDidDeregisterViewContainer(e,t){this.deregisterPaneComposite(e,t),this.viewContainerDisposables.deleteAndDispose(e.id)}onDidChangeContainerLocation(e,t,o){this.deregisterPaneComposite(e,t),this.registerPaneComposite(e,o),this.layoutService.isVisible(this.paneCompositeService.getPartId(o))&&this.viewDescriptorService.getViewContainersByLocation(o).filter(n=>this.isViewContainerActive(n.id)).length===1&&this.openViewContainer(e.id)}onViewDescriptorsAdded(e,t){if(this.viewDescriptorService.getViewContainerLocation(t)!==null)for(let n of e){let r=new N;r.add(this.registerOpenViewAction(n)),r.add(this.registerFocusViewAction(n,t.title)),r.add(this.registerResetViewLocationAction(n)),this.viewDisposable.set(n,r)}}onViewDescriptorsRemoved(e){for(let t of e){let o=this.viewDisposable.get(t);o&&(o.dispose(),this.viewDisposable.delete(t))}}updateViewContainerEnablementContextKey(e){let t=this.enabledViewContainersContextKeys.get(e.id);t||(t=this.contextKeyService.createKey(fxi(e.id),!1),this.enabledViewContainersContextKeys.set(e.id,t)),t.set(!(e.hideIfEmpty&&this.viewDescriptorService.getViewContainerModel(e).activeViewDescriptors.length===0))}async openComposite(e,t,o){return this.paneCompositeService.openPaneComposite(e,t,o)}getComposite(e,t){return this.paneCompositeService.getPaneComposite(e,t)}isViewContainerVisible(e){let t=this.viewDescriptorService.getViewContainerById(e);if(!t)return!1;let o=this.viewDescriptorService.getViewContainerLocation(t);return o===null?!1:this.paneCompositeService.getActivePaneComposite(o)?.getId()===e}isViewContainerActive(e){let t=this.viewDescriptorService.getViewContainerById(e);return t?t.hideIfEmpty?this.viewDescriptorService.getViewContainerModel(t).activeViewDescriptors.length>0:!0:!1}getVisibleViewContainer(e){let t=this.paneCompositeService.getActivePaneComposite(e)?.getId();return t?this.viewDescriptorService.getViewContainerById(t):null}getActiveViewPaneContainerWithId(e){let t=this.viewDescriptorService.getViewContainerById(e);return t?this.getActiveViewPaneContainer(t):null}async openViewContainer(e,t){let o=this.viewDescriptorService.getViewContainerById(e);if(o){let n=this.viewDescriptorService.getViewContainerLocation(o);if(n!==null)return await this.paneCompositeService.openPaneComposite(e,n,t)||null}return null}async closeViewContainer(e){let t=this.viewDescriptorService.getViewContainerById(e);if(t){let o=this.viewDescriptorService.getViewContainerLocation(t),n=o!==null&&this.paneCompositeService.getActivePaneComposite(o);if(o!==null)return n?this.layoutService.setPartHidden(!0,this.paneCompositeService.getPartId(o)):void 0}}isViewVisible(e){return this.getActiveViewWithId(e)?.isBodyVisible()||!1}getActiveViewWithId(e){let t=this.viewDescriptorService.getViewContainerByViewId(e);if(t){let o=this.getActiveViewPaneContainer(t);if(o)return o.getView(e)}return null}getViewWithId(e){let t=this.viewDescriptorService.getViewContainerByViewId(e);if(t){let o=this.viewPaneContainers.get(t.id);if(o)return o.getView(e)}return null}getFocusedView(){let e=this.contextKeyService.getContextKeyValue(ql.key)??"";return this.viewDescriptorService.getViewDescriptorById(e.toString())}getFocusedViewName(){let e=this.editorService.activeTextEditorControl?.hasTextFocus()?d(18320,null):void 0;return this.getFocusedView()?.name?.value??e??""}async openView(e,t){let o=this.viewDescriptorService.getViewContainerByViewId(e);if(!o||!this.viewDescriptorService.getViewContainerModel(o).activeViewDescriptors.some(s=>s.id===e))return null;let n=this.viewDescriptorService.getViewContainerLocation(o),r=this.getComposite(o.id,n);if(r){let s=await this.openComposite(r.id,n);if(s?.openView)return s.openView(e,t)||null;t&&s?.focus()}return null}closeView(e){let t=this.viewDescriptorService.getViewContainerByViewId(e);if(t){let o=this.getActiveViewPaneContainer(t);if(o){let n=o.getView(e);if(n)if(o.views.length===1){let r=this.viewDescriptorService.getViewContainerLocation(t);r===0?this.layoutService.setPartHidden(!0,"workbench.parts.sidebar"):(r===1||r===2)&&this.paneCompositeService.hideActivePaneComposite(r),this.focusedViewContextKey.get()===e&&this.focusedViewContextKey.reset()}else n.setExpanded(!1)}}}getActiveViewPaneContainer(e){let t=this.viewDescriptorService.getViewContainerLocation(e);if(t===null)return null;let o=this.paneCompositeService.getActivePaneComposite(t);return o?.getId()===e.id&&o.getViewPaneContainer()||null}getViewProgressIndicator(e){let t=this.viewDescriptorService.getViewContainerByViewId(e);if(!t)return;let o=this.viewPaneContainers.get(t.id);if(!o)return;let n=o.getView(e);if(n)return o.isViewMergedWithContainer()?this.getViewContainerProgressIndicator(t):n.getProgressIndicator()}getViewContainerProgressIndicator(e){let t=this.viewDescriptorService.getViewContainerLocation(e);if(t!==null)return this.paneCompositeService.getProgressIndicator(e.id,t)}registerOpenViewContainerAction(e){let t=new N;if(e.openCommandActionDescriptor){let{id:o,mnemonicTitle:n,keybindings:r,order:s}=e.openCommandActionDescriptor??{id:e.id},l=e.openCommandActionDescriptor.title??e.title,c=this;if(t.add(W(class extends K{constructor(){super({id:o,get title(){let p=c.viewDescriptorService.getViewContainerLocation(e),h=typeof l=="string"?l:l.value,g=typeof l=="string"?l:l.original;return p===0?{value:d(18325,null,h),original:`Show ${g}`}:{value:d(18326,null,h),original:`Toggle ${g}`}},category:Ve.View,precondition:C.has(fxi(e.id)),keybinding:r?{...r,weight:200}:void 0,f1:!0})}async run(p){let h=p.get(wt),g=p.get(Bi),f=p.get(yi),v=p.get($t),b=g.getViewContainerLocation(e);switch(b){case 2:case 0:{let S=b===0?"workbench.parts.sidebar":"workbench.parts.auxiliarybar";!v.isViewContainerVisible(e.id)||!f.hasFocus(S)?await v.openViewContainer(e.id,!0):h.activeGroup.focus();break}case 1:!v.isViewContainerVisible(e.id)||!f.hasFocus("workbench.parts.panel")?await v.openViewContainer(e.id,!0):v.closeViewContainer(e.id);break}}})),n){let u=this.viewDescriptorService.getDefaultViewContainerLocation(e);t.add(ve.appendMenuItem(D.MenubarViewMenu,{command:{id:o,title:n},group:u===0?"3_sidebar":u===2?"4_auxbar":"5_panel",when:C.has(fxi(e.id)),order:s??Number.MAX_VALUE}))}}return t}registerOpenViewAction(e){let t=new N,o=e.openCommandActionDescriptor?.title??e.name,n=e.openCommandActionDescriptor?.id??`${e.id}.open`,r=this;if(t.add(W(class extends K{constructor(){super({id:n,get title(){let l=r.viewDescriptorService.getViewLocationById(e.id),c=typeof o=="string"?o:o.value,u=typeof o=="string"?o:o.original;return l===0?{value:d(18325,null,c),original:`Show ${u}`}:{value:d(18326,null,c),original:`Toggle ${u}`}},category:Ve.View,precondition:C.has(`${e.id}.active`),keybinding:e.openCommandActionDescriptor?.keybindings?{...e.openCommandActionDescriptor.keybindings,weight:200}:void 0,f1:e.openCommandActionDescriptor?!0:void 0,metadata:{description:d(18322,null,e.name.value),args:[{name:"options",schema:{type:"object",properties:{preserveFocus:{type:"boolean",default:!1,description:d(18323,null)}}}}]}})}async run(l,c){let u=l.get(wt),p=l.get(Bi),h=l.get(yi),g=l.get($t),f=l.get(X);if(ql.getValue(f)===e.id&&!c?.preserveFocus){let b=p.getViewLocationById(e.id);p.getViewLocationById(e.id)===0?u.activeGroup.focus():b!==null&&h.setPartHidden(!0,r.paneCompositeService.getPartId(b))}else await g.openView(e.id,!c?.preserveFocus)}})),e.openCommandActionDescriptor?.mnemonicTitle){let s=this.viewDescriptorService.getDefaultContainerById(e.id);if(s){let l=this.viewDescriptorService.getDefaultViewContainerLocation(s);t.add(ve.appendMenuItem(D.MenubarViewMenu,{command:{id:n,title:e.openCommandActionDescriptor.mnemonicTitle},group:l===0?"3_sidebar":l===2?"4_auxbar":"5_panel",when:C.has(`${e.id}.active`),order:e.openCommandActionDescriptor.order??Number.MAX_VALUE}))}}return t}registerFocusViewAction(e,t){return W(class extends K{constructor(){let n=L(18321,"Focus on {0} View",e.name.value);super({id:e.focusCommand?e.focusCommand.id:`${e.id}.focus`,title:n,category:t,menu:[{id:D.CommandPalette,when:e.when}],keybinding:{when:C.has(`${e.id}.active`),weight:200,primary:e.focusCommand?.keybindings?.primary,secondary:e.focusCommand?.keybindings?.secondary,linux:e.focusCommand?.keybindings?.linux,mac:e.focusCommand?.keybindings?.mac,win:e.focusCommand?.keybindings?.win},metadata:{description:n.value,args:[{name:"focusOptions",description:"Focus Options",schema:{type:"object",properties:{preserveFocus:{type:"boolean",default:!1}}}}]}})}run(n,r){n.get($t).openView(e.id,!r?.preserveFocus)}})}registerResetViewLocationAction(e){return W(class extends K{constructor(){super({id:`${e.id}.resetViewLocation`,title:L(18324,"Reset Location"),menu:[{id:D.ViewTitleContext,when:C.or(C.and(C.equals("view",e.id),C.equals(`${e.id}.defaultViewLocation`,!1))),group:"1_hide",order:2}]})}run(o){let n=o.get(Bi),r=n.getDefaultContainerById(e.id),s=n.getViewContainerModel(r);if(r.hideIfEmpty&&s.visibleViewDescriptors.length===0){let l=n.getDefaultViewContainerLocation(r);n.moveViewContainerToLocation(r,l,void 0,this.desc.id)}n.moveViewsToContainer([e],r,void 0,this.desc.id),o.get($t).openView(e.id,!0)}})}registerPaneComposite(e,t){let o=this,n=class extends wLe{constructor(s,l,c,u,p,h,g){super(e.id,s,c,u,p,h,g,l)}createViewPaneContainer(s){let l=this._register(new N),c=o.createViewPaneContainer(s,e,t,l,this.instantiationService);return c instanceof kee||l.add(U.any(c.onDidAddViews,c.onDidRemoveViews,c.onTitleAreaUpdate)(()=>{this.updateTitleArea()})),c}};n=I([m(0,Te),m(1,Pe),m(2,ce),m(3,F),m(4,Le),m(5,Xe),m(6,lt)],n),ne.as(this.paneCompositeService.getRegistryId(t)).registerPaneComposite(cFt.create(n,e.id,typeof e.title=="string"?e.title:e.title.value,Fe(e.icon)?e.icon:void 0,e.order,e.requestedIndex,e.icon instanceof A?e.icon:void 0))}deregisterPaneComposite(e,t){ne.as(this.paneCompositeService.getRegistryId(t)).deregisterPaneComposite(e.id)}createViewPaneContainer(e,t,o,n,r){let s=r.createInstance(t.ctorDescriptor.ctor,...t.ctorDescriptor.staticArguments||[]);return this.viewPaneContainers.set(s.getId(),s),n.add(Z(()=>this.viewPaneContainers.delete(s.getId()))),n.add(s.onDidAddViews(l=>this.onViewsAdded(l))),n.add(s.onDidChangeViewVisibility(l=>this.onViewsVisibilityChanged(l,l.isBodyVisible()))),n.add(s.onDidRemoveViews(l=>this.onViewsRemoved(l))),n.add(s.onDidFocusView(l=>{this.focusedViewContextKey.get()!==l.id&&(this.focusedViewContextKey.set(l.id),this._onDidChangeFocusedView.fire())})),n.add(s.onDidBlurView(l=>{this.focusedViewContextKey.get()===l.id&&(this.focusedViewContextKey.reset(),this._onDidChangeFocusedView.fire())})),s}};tet=I([m(0,Bi),m(1,us),m(2,X),m(3,yi),m(4,ee)],tet);function fxi(a){return`viewContainer.${a}.enabled`}Ee($t,tet,0);var sMe=class extends x{constructor(e,t,o){super();this.quickInputService=e;this.instantiationService=t;this.contextKeyService=o;this.registry=ne.as(Ku.Quickaccess);this.mapProviderToDescriptor=new Map;this.lastAcceptedPickerValues=new Map;this.visibleQuickAccess=void 0;this._register(Z(()=>{for(let n of this.mapProviderToDescriptor.values())jc(n)&&n.dispose();this.visibleQuickAccess?.picker.dispose()}))}pick(e="",t){return this.doShowOrPick(e,!0,t)}show(e="",t){this.doShowOrPick(e,!1,t)}doShowOrPick(e,t,o){let[n,r]=this.getOrInstantiateProvider(e,o?.enabledProviderPrefixes),s=this.visibleQuickAccess,l=s?.descriptor;if(s&&r&&l===r){e!==r.prefix&&!o?.preserveValue&&(s.picker.value=e),this.adjustValueSelection(s.picker,r,o);return}if(r&&!o?.preserveValue){let v;if(s&&l&&l!==r){let b=s.value.substr(l.prefix.length);b&&(v=`${r.prefix}${b}`)}if(!v){let b=n?.defaultFilterValue;b===1?v=this.lastAcceptedPickerValues.get(r):typeof b=="string"&&(v=`${r.prefix}${b}`)}typeof v=="string"&&(e=v)}let c=s?.picker?.valueSelection,u=s?.picker?.value,p=new N,h=p.add(this.quickInputService.createQuickPick({useSeparators:!0}));h.value=e,this.adjustValueSelection(h,r,o),h.placeholder=o?.placeholder??r?.placeholder,h.quickNavigate=o?.quickNavigateConfiguration,h.hideInput=!!h.quickNavigate&&!s,(typeof o?.itemActivation=="number"||o?.quickNavigateConfiguration)&&(h.itemActivation=o?.itemActivation??2),h.contextKey=r?.contextKey,h.filterValue=v=>v.substring(r?r.prefix.length:0);let g;t&&(g=new Ko,p.add(U.once(h.onWillAccept)(v=>{v.veto(),h.hide()}))),p.add(this.registerPickerListeners(h,n,r,e,o));let f=p.add(new Ye);if(n&&p.add(n.provide(h,f.token,o?.providerOptions)),U.once(h.onDidHide)(()=>{h.selectedItems.length===0&&f.cancel(),p.dispose(),g?.complete(h.selectedItems.slice(0))}),h.show(),c&&u===e&&(h.valueSelection=c),t)return g?.p}adjustValueSelection(e,t,o){let n;o?.preserveValue?n=[e.value.length,e.value.length]:n=[t?.prefix.length??0,e.value.length],e.valueSelection=n}registerPickerListeners(e,t,o,n,r){let s=new N,l=this.visibleQuickAccess={picker:e,descriptor:o,value:n};return s.add(Z(()=>{l===this.visibleQuickAccess&&(this.visibleQuickAccess=void 0)})),s.add(e.onDidChangeValue(c=>{let[u]=this.getOrInstantiateProvider(c,r?.enabledProviderPrefixes);u!==t?this.show(c,{enabledProviderPrefixes:r?.enabledProviderPrefixes,preserveValue:!0,providerOptions:r?.providerOptions}):l.value=c})),o&&s.add(e.onDidAccept(()=>{this.lastAcceptedPickerValues.set(o,e.value)})),s}getOrInstantiateProvider(e,t){let o=this.registry.getQuickAccessProvider(e,this.contextKeyService);if(!o||t&&!t?.includes(o.prefix))return[void 0,void 0];let n=this.mapProviderToDescriptor.get(o);return n||(n=this.instantiationService.createInstance(o.ctor),this.mapProviderToDescriptor.set(o,n)),[n,o]}};sMe=I([m(0,Ue),m(1,F),m(2,X)],sMe);var nYo=_,hBt=class extends x{constructor(e,t,o){super();this.parent=e;this._listFocusMode=!1;this.onDidChange=e=>this.findInput.onDidChange(e);this.container=M(this.parent,nYo(".quick-input-box")),this.findInput=this._register(new Vz(this.container,void 0,{label:"",inputBoxStyles:t,toggleStyles:o,actionViewItemProvider:Wz(o),hideHoverOnValueChange:!0}))}get onKeyDown(){return this.findInput.onKeyDown}get onMouseDown(){return this.findInput.onMouseDown}get value(){return this.findInput.getValue()}set value(e){this.findInput.setValue(e)}select(e=null){this.findInput.inputBox.select(e)}getSelection(){return this.findInput.inputBox.getSelection()}isSelectionAtEnd(){return this.findInput.inputBox.isSelectionAtEnd()}setPlaceholder(e){this.findInput.inputBox.setPlaceHolder(e)}get placeholder(){return this.findInput.inputBox.inputElement.getAttribute("placeholder")||""}set placeholder(e){this.findInput.inputBox.setPlaceHolder(e)}get password(){return this.findInput.inputBox.inputElement.type==="password"}set password(e){this.findInput.inputBox.inputElement.type=e?"password":"text"}set enabled(e){this.findInput.inputBox.inputElement.toggleAttribute("readonly",!e)}set toggles(e){this.findInput.setAdditionalToggles(e)}set actions(e){this.setActions(e)}setActions(e,t){this.findInput.setActions(e,t)}get ariaLabel(){return this.findInput.inputBox.inputElement.getAttribute("aria-label")||""}set ariaLabel(e){this.findInput.inputBox.inputElement.setAttribute("aria-label",e)}hasFocus(){return this.findInput.inputBox.hasFocus()}setAttribute(e,t){this.findInput.inputBox.inputElement.setAttribute(e,t)}removeAttribute(e){this.findInput.inputBox.inputElement.removeAttribute(e)}setListFocusMode(e){if(this._listFocusMode===e)return;this._listFocusMode=e;let t=this.findInput.inputBox.inputElement;e?(t.setAttribute("aria-haspopup","listbox"),t.setAttribute("aria-autocomplete","list")):(t.removeAttribute("aria-haspopup"),t.removeAttribute("aria-autocomplete"))}showDecoration(e){e===bt.Ignore?this.findInput.clearMessage():this.findInput.showMessage({type:e===bt.Info?1:e===bt.Warning?2:3,content:""})}stylesForType(e){return this.findInput.inputBox.stylesForType(e===bt.Info?1:e===bt.Warning?2:3)}setFocus(){this.findInput.focus()}layout(){this.findInput.inputBox.layout()}};var iG=_,gBt=class{constructor(i,e,t){this.index=i;this.hasCheckbox=e;this._hidden=!1;this._init=new co(()=>{let o=t.label??"",n=HV(o).text.trim(),r=t.ariaLabel||[o,this.saneDescription,this.saneDetail].map(s=>xz(s)).filter(s=>!!s).join(", ");return{saneLabel:o,saneSortLabel:n,saneAriaLabel:r}}),this._saneDescription=t.description,this._saneTooltip=t.tooltip}get saneLabel(){return this._init.value.saneLabel}get saneSortLabel(){return this._init.value.saneSortLabel}get saneAriaLabel(){return this._init.value.saneAriaLabel}get element(){return this._element}set element(i){this._element=i}get hidden(){return this._hidden}set hidden(i){this._hidden=i}get saneDescription(){return this._saneDescription}set saneDescription(i){this._saneDescription=i}get saneDetail(){return this._saneDetail}set saneDetail(i){this._saneDetail=i}get saneTooltip(){return this._saneTooltip}set saneTooltip(i){this._saneTooltip=i}get labelHighlights(){return this._labelHighlights}set labelHighlights(i){this._labelHighlights=i}get descriptionHighlights(){return this._descriptionHighlights}set descriptionHighlights(i){this._descriptionHighlights=i}get detailHighlights(){return this._detailHighlights}set detailHighlights(i){this._detailHighlights=i}},MS=class extends gBt{constructor(e,t,o,n,r,s,l){super(e,o,s);this.childIndex=t;this.fireButtonTriggered=n;this._onChecked=r;this.item=s;this._separator=l;this._checked=!1;this.onChecked=o?U.map(U.filter(this._onChecked.event,c=>c.element===this),c=>c.checked):U.None,this._saneDetail=s.detail,this._labelHighlights=s.highlights?.label,this._descriptionHighlights=s.highlights?.description,this._detailHighlights=s.highlights?.detail}get separator(){return this._separator}set separator(e){this._separator=e}get checked(){return this._checked}set checked(e){e!==this._checked&&(this._checked=e,this._onChecked.fire({element:this,checked:e}))}get checkboxDisabled(){return!!this.item.disabled}};var X3=class extends gBt{constructor(e,t,o){super(e,!1,o);this.fireSeparatorButtonTriggered=t;this.separator=o;this.children=new Array;this.focusInsideSeparator=0}},vxi=class{getHeight(i){return i instanceof X3?30:i.saneDetail?44:22}getTemplateId(i){return i instanceof MS?Tee.ID:_ee.ID}},bxi=class{getWidgetAriaLabel(){return d(2317,null)}getAriaLabel(i){return i.separator?.label?`${i.saneAriaLabel}, ${i.separator.label}`:i.saneAriaLabel}getWidgetRole(){return"listbox"}getRole(i){return i.hasCheckbox?"checkbox":"option"}isChecked(i){if(!(!i.hasCheckbox||!(i instanceof MS)))return{get value(){return i.checked},onDidChange:e=>i.onChecked(()=>e())}}},fBt=class extends x{constructor(e,t,o){super();this.hoverDelegate=e;this.toggleStyles=t;this.contextMenuService=o;this._onDidDisposeFocusedElement=this._register(new E);this.onDidDisposeFocusedElement=this._onDidDisposeFocusedElement.event}renderTemplate(e){let t=Object.create(null);t.toDisposeElement=new N,t.toDisposeTemplate=new N,t.entry=M(e,iG(".quick-input-list-entry"));let o=M(t.entry,iG("label.quick-input-list-label"));t.outerLabel=o,t.checkbox=t.toDisposeTemplate.add(new me),t.toDisposeTemplate.add(Jo(o,re.CLICK,u=>{if(t.checkbox.value&&!u.defaultPrevented&&t.checkbox.value.enabled){let p=!t.checkbox.value.checked;t.checkbox.value.checked=p,t.element.checked=p}}));let n=M(o,iG(".quick-input-list-rows")),r=M(n,iG(".quick-input-list-row")),s=M(n,iG(".quick-input-list-row"));t.label=new Bc(r,{supportHighlights:!0,supportDescriptionHighlights:!0,supportIcons:!0,hoverDelegate:this.hoverDelegate}),t.toDisposeTemplate.add(t.label),t.icon=KS(t.label.element,iG(".quick-input-list-icon"));let l=M(r,iG(".quick-input-list-entry-keybinding"));t.keybinding=new Am(l,Po),t.toDisposeTemplate.add(t.keybinding);let c=M(s,iG(".quick-input-list-label-meta"));return t.detail=new Bc(c,{supportHighlights:!0,supportIcons:!0,hoverDelegate:this.hoverDelegate}),t.toDisposeTemplate.add(t.detail),t.separator=M(t.entry,iG(".quick-input-list-separator")),t.toolBar=new wp(t.entry,this.contextMenuService,{...this.hoverDelegate?{hoverDelegate:this.hoverDelegate}:void 0,actionViewItemProvider:Wz(this.toggleStyles),icon:!0,label:!1}),t.toolBar.getElement().classList.add("quick-input-list-entry-action-bar"),t.toDisposeTemplate.add(t.toolBar),t}disposeTemplate(e){e.toDisposeElement.dispose(),e.toDisposeTemplate.dispose()}disposeElement(e,t,o){Gr(o.entry)&&this._onDidDisposeFocusedElement.fire(),o.toDisposeElement.clear(),o.toolBar.setActions([])}},Tee=class extends fBt{constructor(e,t,o,n){super(e,t,o);this.themeService=n;this._itemsWithSeparatorsFrequency=new Map}static{this.ID="quickpickitem"}get templateId(){return Tee.ID}ensureCheckbox(e,t){if(!e.hasCheckbox){t.checkbox.value?.domNode.remove(),t.checkbox.clear();return}let o=t.checkbox.value;o?o.setTitle(e.saneLabel):(o=new Ev(e.saneLabel,e.checked,{...qf,size:15}),t.checkbox.value=o,t.outerLabel.prepend(o.domNode),o.domNode.tabIndex=-1),e.checkboxDisabled?o.disable():o.enable(),o.checked=e.checked,t.toDisposeElement.add(e.onChecked(n=>o.checked=n)),t.toDisposeElement.add(o.onChange(()=>e.checked=o.checked))}renderElement(e,t,o){let n=e.element;o.element=n,n.element=o.entry??void 0;let r=n.item;n.element.classList.toggle("not-pickable",n.item.pickable===!1),this.ensureCheckbox(n,o);let{labelHighlights:s,descriptionHighlights:l,detailHighlights:c}=n;if(r.iconPath){let g=Bp(this.themeService.getColorTheme().type)?r.iconPath.dark:r.iconPath.light??r.iconPath.dark,f=A.revive(g);o.icon.className="quick-input-list-icon",o.icon.style.backgroundImage=Qa(f)}else o.icon.style.backgroundImage="",o.icon.className=r.iconClass?`quick-input-list-icon ${r.iconClass}`:"";let u;!n.saneTooltip&&n.saneDescription&&(u={markdown:{value:mr(n.saneDescription),supportThemeIcons:!0},markdownNotSupportedFallback:n.saneDescription});let p={matches:s||[],descriptionTitle:u,descriptionMatches:l||[],labelEscapeNewLines:!0};if(p.extraClasses=r.iconClasses,p.italic=r.italic,p.strikethrough=r.strikethrough,o.entry.classList.remove("quick-input-list-separator-as-item"),o.label.setLabel(n.saneLabel,n.saneDescription,p),o.keybinding.set(r.keybinding),n.saneDetail){let g;n.saneTooltip||(g={markdown:{value:mr(n.saneDetail),supportThemeIcons:!0},markdownNotSupportedFallback:n.saneDetail}),o.detail.element.style.display="",o.detail.setLabel(n.saneDetail,void 0,{matches:c,title:g,labelEscapeNewLines:!0})}else o.detail.element.style.display="none";n.separator?.label?(o.separator.textContent=n.separator.label,o.separator.style.display="",this.addItemWithSeparator(n)):o.separator.style.display="none",o.entry.classList.toggle("quick-input-list-separator-border",!!n.separator&&n.childIndex!==0);let h=r.buttons;if(h&&h.length){let{primary:g,secondary:f}=b3(h,"quick-input-item",v=>n.fireButtonTriggered({button:v,item:n.item}));o.toolBar.setActions(g,f),o.entry.classList.add("has-actions")}else o.toolBar.setActions([]),o.entry.classList.remove("has-actions")}disposeElement(e,t,o){this.removeItemWithSeparator(e.element),super.disposeElement(e,t,o)}isItemWithSeparatorVisible(e){return this._itemsWithSeparatorsFrequency.has(e)}addItemWithSeparator(e){this._itemsWithSeparatorsFrequency.set(e,(this._itemsWithSeparatorsFrequency.get(e)||0)+1)}removeItemWithSeparator(e){let t=this._itemsWithSeparatorsFrequency.get(e)||0;t>1?this._itemsWithSeparatorsFrequency.set(e,t-1):this._itemsWithSeparatorsFrequency.delete(e)}};Tee=I([m(2,Xe),m(3,Le)],Tee);var _ee=class extends fBt{constructor(e,t,o){super(e,t,o);this._visibleSeparatorsFrequency=new Map}static{this.ID="quickpickseparator"}get templateId(){return _ee.ID}get visibleSeparators(){return[...this._visibleSeparatorsFrequency.keys()]}isSeparatorVisible(e){return this._visibleSeparatorsFrequency.has(e)}renderElement(e,t,o){let n=e.element;o.element=n,n.element=o.entry??void 0,n.element.classList.toggle("focus-inside",!!n.focusInsideSeparator);let r=n.separator,{labelHighlights:s,descriptionHighlights:l}=n;o.icon.style.backgroundImage="",o.icon.className="";let c;!n.saneTooltip&&n.saneDescription&&(c={markdown:{value:mr(n.saneDescription),supportThemeIcons:!0},markdownNotSupportedFallback:n.saneDescription});let u={matches:s||[],descriptionTitle:c,descriptionMatches:l||[],labelEscapeNewLines:!0};o.entry.classList.add("quick-input-list-separator-as-item"),o.label.setLabel(n.saneLabel,n.saneDescription,u),o.separator.style.display="none",o.entry.classList.add("quick-input-list-separator-border");let p=r.buttons;if(p&&p.length){let{primary:h,secondary:g}=b3(p,"quick-input-separator",f=>n.fireSeparatorButtonTriggered({button:f,separator:n.separator}));o.toolBar.setActions(h,g),o.entry.classList.add("has-actions")}else o.toolBar.setActions([]),o.entry.classList.remove("has-actions");this.addSeparator(n)}disposeElement(e,t,o){this.removeSeparator(e.element),this.isSeparatorVisible(e.element)||e.element.element?.classList.remove("focus-inside"),super.disposeElement(e,t,o)}addSeparator(e){this._visibleSeparatorsFrequency.set(e,(this._visibleSeparatorsFrequency.get(e)||0)+1)}removeSeparator(e){let t=this._visibleSeparatorsFrequency.get(e)||0;t>1?this._visibleSeparatorsFrequency.set(e,t-1):this._visibleSeparatorsFrequency.delete(e)}};_ee=I([m(2,Xe)],_ee);var Eee=class extends x{constructor(e,t,o,n,r,s,l){super();this.parent=e;this.hoverDelegate=t;this.linkOpenerDelegate=o;this.styles=r;this.accessibilityService=l;this._onKeyDown=this._register(new E);this.onKeyDown=this._onKeyDown.event;this._onLeave=this._register(new E);this.onLeave=this._onLeave.event;this._visibleCountObservable=Me("VisibleCount",0);this.onChangedVisibleCount=U.fromObservable(this._visibleCountObservable,this._store);this._allVisibleCheckedObservable=Me("AllVisibleChecked",!1);this.onChangedAllVisibleChecked=U.fromObservable(this._allVisibleCheckedObservable,this._store);this._checkedCountObservable=Me("CheckedCount",0);this.onChangedCheckedCount=U.fromObservable(this._checkedCountObservable,this._store);this._checkedElementsObservable=ph({equalsFn:$i},new Array);this.onChangedCheckedElements=U.fromObservable(this._checkedElementsObservable,this._store);this._onButtonTriggered=this._register(new E);this.onButtonTriggered=this._onButtonTriggered.event;this._onSeparatorButtonTriggered=this._register(new E);this.onSeparatorButtonTriggered=this._onSeparatorButtonTriggered.event;this._elementChecked=this._register(new E);this._elementCheckedEventBufferer=new QN;this._hasCheckboxes=!1;this._inputElements=new Array;this._elementTree=new Array;this._itemElements=new Array;this._elementDisposable=this._register(new N);this._matchOnDescription=!1;this._matchOnDetail=!1;this._matchOnLabel=!0;this._matchOnLabelMode="fuzzy";this._matchOnMeta=!0;this._sortByLabel=!0;this._shouldLoop=!0;this._container=M(this.parent,iG(".quick-input-list")),this._separatorRenderer=this._register(s.createInstance(_ee,t,this.styles.toggle)),this._itemRenderer=this._register(s.createInstance(Tee,t,this.styles.toggle)),this._tree=this._register(s.createInstance(Rg,"QuickInput",this._container,new vxi,[this._itemRenderer,this._separatorRenderer],{filter:{filter(c){return c.hidden?0:c instanceof X3?2:1}},sorter:{compare:(c,u)=>{if(!this.sortByLabel||!this._lastQueryString)return 0;let p=this._lastQueryString.toLowerCase();return sYo(c,u,p)}},accessibilityProvider:new bxi,setRowLineHeight:!1,multipleSelectionSupport:!1,hideTwistiesOfChildlessElements:!0,renderIndentGuides:"none",findWidgetEnabled:!1,indent:0,horizontalScrolling:!1,allowNonCollapsibleParents:!0,alwaysConsumeMouseWheel:!0})),this._tree.getHTMLElement().id=n,this._register(this._itemRenderer.onDidDisposeFocusedElement(()=>this._tree.domFocus())),this._register(this._separatorRenderer.onDidDisposeFocusedElement(()=>this._tree.domFocus())),this._registerListeners()}get onDidChangeFocus(){return U.map(this._tree.onDidChangeFocus,e=>e.elements.filter(t=>t instanceof MS).map(t=>t.item),this._store)}get onDidChangeSelection(){return U.map(this._tree.onDidChangeSelection,e=>({items:e.elements.filter(t=>t instanceof MS).map(t=>t.item),event:e.browserEvent}),this._store)}get displayed(){return this._container.style.display!=="none"}set displayed(e){this._container.style.display=e?"":"none"}get scrollTop(){return this._tree.scrollTop}set scrollTop(e){this._tree.scrollTop=e}get ariaLabel(){return this._tree.ariaLabel}set ariaLabel(e){this._tree.ariaLabel=e??""}set enabled(e){this._tree.getHTMLElement().style.pointerEvents=e?"":"none"}get matchOnDescription(){return this._matchOnDescription}set matchOnDescription(e){this._matchOnDescription=e}get matchOnDetail(){return this._matchOnDetail}set matchOnDetail(e){this._matchOnDetail=e}get matchOnLabel(){return this._matchOnLabel}set matchOnLabel(e){this._matchOnLabel=e}get matchOnLabelMode(){return this._matchOnLabelMode}set matchOnLabelMode(e){this._matchOnLabelMode=e}get matchOnMeta(){return this._matchOnMeta}set matchOnMeta(e){this._matchOnMeta=e}get sortByLabel(){return this._sortByLabel}set sortByLabel(e){this._sortByLabel=e}get shouldLoop(){return this._shouldLoop}set shouldLoop(e){this._shouldLoop=e}_registerListeners(){this._registerOnContainerClick(),this._registerOnMouseMiddleClick(),this._registerOnTreeModelChanged(),this._registerOnElementChecked(),this._registerOnContextMenu(),this._registerHoverListeners(),this._registerSelectionChangeListener(),this._registerSeparatorActionShowingListeners()}_registerOnContainerClick(){this._register(j(this._container,re.CLICK,e=>{(e.x||e.y)&&this._onLeave.fire()}))}_registerOnMouseMiddleClick(){this._register(j(this._container,re.AUXCLICK,e=>{e.button===1&&this._onLeave.fire()}))}_registerOnTreeModelChanged(){this._register(this._tree.onDidChangeModel(()=>{let e=this._itemElements.filter(t=>!t.hidden).length;this._visibleCountObservable.set(e,void 0),this._hasCheckboxes&&this._updateCheckedObservables()}))}_registerOnElementChecked(){this._register(this._elementCheckedEventBufferer.wrapEvent(this._elementChecked.event,(e,t)=>t)(e=>this._updateCheckedObservables()))}_registerOnContextMenu(){this._register(this._tree.onContextMenu(e=>{e.element&&(e.browserEvent.preventDefault(),this._tree.setSelection([e.element]))}))}_registerHoverListeners(){let e=this._register(new ya(typeof this.hoverDelegate.delay=="function"?this.hoverDelegate.delay():this.hoverDelegate.delay));this._register(this._tree.onMouseOver(async t=>{if(W$e(t.browserEvent.target)){e.cancel();return}if(!(!W$e(t.browserEvent.relatedTarget)&&ts(t.browserEvent.relatedTarget,t.element?.element)))try{await e.trigger(async()=>{t.element instanceof MS&&this.showHover(t.element)})}catch(o){if(!ao(o))throw o}})),this._register(this._tree.onMouseOut(t=>{ts(t.browserEvent.relatedTarget,t.element?.element)||e.cancel()}))}_registerSeparatorActionShowingListeners(){this._register(this._tree.onDidChangeFocus(e=>{let t=e.elements[0]?this._tree.getParentElement(e.elements[0]):null;for(let o of this._separatorRenderer.visibleSeparators){let n=o===t;!!(o.focusInsideSeparator&2)!==n&&(n?o.focusInsideSeparator|=2:o.focusInsideSeparator&=-3,this._tree.rerender(o))}})),this._register(this._tree.onMouseOver(e=>{let t=e.element?this._tree.getParentElement(e.element):null;for(let o of this._separatorRenderer.visibleSeparators){if(o!==t)continue;o.focusInsideSeparator&1||(o.focusInsideSeparator|=1,this._tree.rerender(o))}})),this._register(this._tree.onMouseOut(e=>{let t=e.element?this._tree.getParentElement(e.element):null;for(let o of this._separatorRenderer.visibleSeparators){if(o!==t)continue;o.focusInsideSeparator&1&&(o.focusInsideSeparator&=-2,this._tree.rerender(o))}}))}_registerSelectionChangeListener(){this._register(this._tree.onDidChangeSelection(e=>{let t=e.elements.filter(o=>o instanceof MS);t.length!==e.elements.length&&(e.elements.length===1&&e.elements[0]instanceof X3&&(this._tree.setFocus([e.elements[0].children[0]]),this._tree.reveal(e.elements[0],0)),this._tree.setSelection(t))}))}setAllVisibleChecked(e){this._elementCheckedEventBufferer.bufferEvents(()=>{this._itemElements.forEach(t=>{!t.hidden&&!t.checkboxDisabled&&t.item.pickable!==!1&&(t.checked=e)})})}setElements(e){this._elementDisposable.clear(),this._lastQueryString=void 0,this._inputElements=e,this._hasCheckboxes=this.parent.classList.contains("show-checkboxes");let t;this._itemElements=new Array,this._elementTree=e.reduce((o,n,r)=>{let s;if(n.type==="separator"){if(!n.buttons)return o;t=new X3(r,l=>this._onSeparatorButtonTriggered.fire(l),n),s=t}else{let l=r>0?e[r-1]:void 0,c;l&&l.type==="separator"&&!l.buttons&&(c=l);let u=new MS(r,t?.children?t.children.length:r,this._hasCheckboxes&&n.pickable!==!1,p=>this._onButtonTriggered.fire(p),this._elementChecked,n,c);if(this._itemElements.push(u),t)return t.children.push(u),o;s=u}return o.push(s),o},new Array),this._setElementsToTree(this._elementTree),this.accessibilityService.isScreenReaderOptimized()&&setTimeout(()=>{let o=this._tree.getHTMLElement().querySelector(".monaco-list-row.focused"),n=o?.parentNode;if(o&&n){let r=o.nextSibling;o.remove(),n.insertBefore(o,r)}},0)}setFocusedElements(e){let t=e.map(o=>this._itemElements.find(n=>n.item===o)).filter(o=>!!o).filter(o=>!o.hidden);if(this._tree.setFocus(t),e.length>0){let o=this._tree.getFocus()[0];o&&this._tree.reveal(o)}}getActiveDescendant(){return this._tree.getHTMLElement().getAttribute("aria-activedescendant")}setSelectedElements(e){let t=e.map(o=>this._itemElements.find(n=>n.item===o)).filter(o=>!!o);this._tree.setSelection(t)}getCheckedElements(){return this._itemElements.filter(e=>e.checked).map(e=>e.item)}setCheckedElements(e){this._elementCheckedEventBufferer.bufferEvents(()=>{let t=new Set;for(let o of e)t.add(o);for(let o of this._itemElements)o.checked=t.has(o.item)})}focus(e){if(this._itemElements.length)switch(e===2&&this._itemElements.length<2&&(e=1),e){case 1:this._tree.scrollTop=0,this._tree.focusFirst(void 0,t=>t.element instanceof MS);break;case 2:{this._tree.scrollTop=0;let t=!1;this._tree.focusFirst(void 0,o=>o.element instanceof MS?t?!0:(t=!t,!1):!1);break}case 3:this._tree.scrollTop=this._tree.scrollHeight,this._tree.focusLast(void 0,t=>t.element instanceof MS);break;case 4:{let t=this._tree.getFocus();this._tree.focusNext(void 0,this._shouldLoop,void 0,n=>n.element instanceof MS?(this._tree.reveal(n.element),!0):!1);let o=this._tree.getFocus();t.length&&t[0]===o[0]&&this._onLeave.fire();break}case 5:{let t=this._tree.getFocus();this._tree.focusPrevious(void 0,this._shouldLoop,void 0,n=>{if(!(n.element instanceof MS))return!1;let r=this._tree.getParentElement(n.element);return r===null||r.children[0]!==n.element?this._tree.reveal(n.element):this._tree.reveal(r),!0});let o=this._tree.getFocus();t.length&&t[0]===o[0]&&this._onLeave.fire();break}case 6:this._tree.focusNextPage(void 0,t=>t.element instanceof MS?(this._tree.reveal(t.element),!0):!1);break;case 7:this._tree.focusPreviousPage(void 0,t=>{if(!(t.element instanceof MS))return!1;let o=this._tree.getParentElement(t.element);return o===null||o.children[0]!==t.element?this._tree.reveal(t.element):this._tree.reveal(o),!0});break;case 8:{let t=!1,o=this._tree.getFocus()[0];this._tree.focusNext(void 0,!0,void 0,r=>{if(t)return!0;if(r.element instanceof X3)t=!0,this._separatorRenderer.isSeparatorVisible(r.element)?this._tree.reveal(r.element.children[0]):this._tree.reveal(r.element,0);else if(r.element instanceof MS){if(r.element.separator)return this._itemRenderer.isItemWithSeparatorVisible(r.element)?this._tree.reveal(r.element):this._tree.reveal(r.element,0),!0;if(r.element===this._elementTree[0])return this._tree.reveal(r.element,0),!0}return!1});let n=this._tree.getFocus()[0];o===n&&(this._tree.scrollTop=this._tree.scrollHeight,this._tree.focusLast(void 0,r=>r.element instanceof MS));break}case 9:{let t,o=!!this._tree.getFocus()[0]?.separator;this._tree.focusPrevious(void 0,!0,void 0,n=>{if(n.element instanceof X3)o?t||(this._separatorRenderer.isSeparatorVisible(n.element)?this._tree.reveal(n.element):this._tree.reveal(n.element,0),t=n.element.children[0]):o=!0;else if(n.element instanceof MS&&!t){if(n.element.separator)this._itemRenderer.isItemWithSeparatorVisible(n.element)?this._tree.reveal(n.element):this._tree.reveal(n.element,0),t=n.element;else if(n.element===this._elementTree[0])return this._tree.reveal(n.element,0),!0}return!1}),t&&this._tree.setFocus([t]);break}}}clearFocus(){this._tree.setFocus([])}domFocus(){this._tree.domFocus()}layout(e){this._tree.getHTMLElement().style.maxHeight=e?`${Math.floor(e/44)*44+6}px`:"",this._tree.layout()}filter(e){if(this._lastQueryString=e,!(this._sortByLabel||this._matchOnLabel||this._matchOnDescription||this._matchOnDetail))return this._tree.layout(),!1;let t=e;if(e=e.trim(),!e||!(this.matchOnLabel||this.matchOnDescription||this.matchOnDetail))this._itemElements.forEach(o=>{o.labelHighlights=void 0,o.descriptionHighlights=void 0,o.detailHighlights=void 0,o.hidden=!1;let n=o.index&&this._inputElements[o.index-1];o.item&&(o.separator=n&&n.type==="separator"&&!n.buttons?n:void 0)});else{let o;this._itemElements.forEach(n=>{let r;this.matchOnLabelMode==="fuzzy"?r=this.matchOnLabel?Hj(e,HV(n.saneLabel))??void 0:void 0:r=this.matchOnLabel?rYo(t,HV(n.saneLabel))??void 0:void 0;let s=this.matchOnDescription?Hj(e,HV(n.saneDescription||""))??void 0:void 0,l=this.matchOnDetail?Hj(e,HV(n.saneDetail||""))??void 0:void 0;if(r||s||l?(n.labelHighlights=r,n.descriptionHighlights=s,n.detailHighlights=l,n.hidden=!1):(n.labelHighlights=void 0,n.descriptionHighlights=void 0,n.detailHighlights=void 0,n.hidden=n.item?!n.item.alwaysShow:!0),n.item?n.separator=void 0:n.separator&&(n.hidden=!0),!this.sortByLabel){let c=n.index&&this._inputElements[n.index-1]||void 0;c?.type==="separator"&&!c.buttons&&(o=c),o&&!n.hidden&&(n.separator=o,o=void 0)}})}return this._setElementsToTree(this._sortByLabel&&e?this._itemElements:this._elementTree),this._tree.layout(),!0}toggleCheckbox(){this._elementCheckedEventBufferer.bufferEvents(()=>{let e=this._tree.getFocus().filter(o=>o instanceof MS),t=this._allVisibleChecked(e);for(let o of e)o.checkboxDisabled||(o.checked=!t)})}style(e){this._tree.style(e)}toggleHover(){let e=this._tree.getFocus()[0];if(!e?.saneTooltip||!(e instanceof MS))return;if(this._lastHover&&!this._lastHover.isDisposed){this._lastHover.dispose();return}this.showHover(e);let t=new N;t.add(this._tree.onDidChangeFocus(o=>{o.elements[0]instanceof MS&&this.showHover(o.elements[0])})),this._lastHover&&t.add(this._lastHover),this._elementDisposable.add(t)}_setElementsToTree(e){let t=new Array;for(let o of e)o instanceof X3?t.push({element:o,collapsible:!1,collapsed:!1,children:o.children.map(n=>({element:n,collapsible:!1,collapsed:!1}))}):t.push({element:o,collapsible:!1,collapsed:!1});this._tree.setChildren(null,t)}_allVisibleChecked(e,t=!0){for(let o=0,n=e.length;o<n;o++){let r=e[o];if(!r.hidden&&r.item.pickable!==!1)if(r.checked)t=!0;else return!1}return t}_updateCheckedObservables(){Gi(e=>{this._allVisibleCheckedObservable.set(this._allVisibleChecked(this._itemElements,!1),e);let t=this._itemElements.filter(o=>o.checked).length;this._checkedCountObservable.set(t,e),this._checkedElementsObservable.set(this.getCheckedElements(),e)})}showHover(e){this._lastHover&&!this._lastHover.isDisposed&&(this.hoverDelegate.onDidHideHover?.(),this._lastHover?.dispose()),!(!e.element||!e.saneTooltip)&&(this._lastHover=this.hoverDelegate.showHover({content:e.saneTooltip,target:e.element,linkHandler:t=>{this.linkOpenerDelegate(t)},appearance:{showPointer:!0},container:this._container,position:{hoverPosition:1}},!1))}};I([hi],Eee.prototype,"onDidChangeFocus",1),I([hi],Eee.prototype,"onDidChangeSelection",1),Eee=I([m(5,F),m(6,Oi)],Eee);function rYo(a,i){let{text:e,iconOffsets:t}=i;if(!t||t.length===0)return guo(a,e);let o=fC(e," "),n=e.length-o.length,r=guo(a,o);if(r)for(let s of r){let l=t[s.start+n]+n;s.start+=l,s.end+=l}return r}function guo(a,i){let e=i.toLowerCase().indexOf(a.toLowerCase());return e!==-1?[{start:e,end:e+a.length}]:null}function sYo(a,i,e){let t=a.labelHighlights||[],o=i.labelHighlights||[];return t.length&&!o.length?-1:!t.length&&o.length?1:t.length===0&&o.length===0?0:ELe(a.saneSortLabel,i.saneSortLabel,e)}function aYo(a,i={}){Ct.registerCommandAndKeybindingRule({weight:200,when:lLe,metadata:{description:d(2306,null)},...a,secondary:Sxi(a.primary,a.secondary??[],i)})}function Fk(a,i={}){Ct.registerCommandAndKeybindingRule({weight:200,when:C.and(C.or(C.equals(OZ,"quickPick"),C.equals(OZ,"quickTree")),lLe),metadata:{description:d(2309,null)},...a,secondary:Sxi(a.primary,a.secondary??[],i)})}var Dme=Ze?256:2048;function Sxi(a,i,e={}){return e.withAltMod&&i.push(512+a),e.withCtrlMod&&(i.push(Dme+a),e.withAltMod&&i.push(512+Dme+a)),e.withShiftMod&&(i.push(1024+a),e.withAltMod&&i.push(1536+a),e.withCtrlMod&&(i.push(Dme+1024+a),e.withAltMod&&i.push(512+Dme+1024+a))),e.withCmdMod&&Ze&&(i.push(2048+a),e.withCtrlMod&&i.push(2304+a),e.withAltMod&&(i.push(2560+a),e.withCtrlMod&&i.push(2816+a))),i}function hM(a,i){return e=>{let t=e.get(Ue).currentQuickInput;if(t)return i&&t.quickNavigate?t.focus(i):t.focus(a)}}Fk({id:"quickInput.pageNext",primary:12,handler:hM(6)},{withAltMod:!0,withCtrlMod:!0,withCmdMod:!0});Fk({id:"quickInput.pagePrevious",primary:11,handler:hM(7)},{withAltMod:!0,withCtrlMod:!0,withCmdMod:!0});Fk({id:"quickInput.first",primary:Dme+14,handler:hM(1)},{withAltMod:!0,withCmdMod:!0});Fk({id:"quickInput.last",primary:Dme+13,handler:hM(3)},{withAltMod:!0,withCmdMod:!0});Fk({id:"quickInput.next",primary:18,handler:hM(4)},{withCtrlMod:!0});Fk({id:"quickInput.previous",primary:16,handler:hM(5)},{withCtrlMod:!0});var fuo=d(2307,null),vuo=d(2308,null);Ze?(Fk({id:"quickInput.nextSeparatorWithQuickAccessFallback",primary:2066,handler:hM(8,4),metadata:{description:fuo}}),Fk({id:"quickInput.nextSeparator",primary:2578,secondary:[2322],handler:hM(8)},{withCtrlMod:!0}),Fk({id:"quickInput.previousSeparatorWithQuickAccessFallback",primary:2064,handler:hM(9,5),metadata:{description:vuo}}),Fk({id:"quickInput.previousSeparator",primary:2576,secondary:[2320],handler:hM(9)},{withCtrlMod:!0})):(Fk({id:"quickInput.nextSeparatorWithQuickAccessFallback",primary:530,handler:hM(8,4),metadata:{description:fuo}}),Fk({id:"quickInput.nextSeparator",primary:2578,handler:hM(8)}),Fk({id:"quickInput.previousSeparatorWithQuickAccessFallback",primary:528,handler:hM(9,5),metadata:{description:vuo}}),Fk({id:"quickInput.previousSeparator",primary:2576,handler:hM(9)}));Ct.registerCommandAndKeybindingRule({id:"quickInput.accept",primary:3,weight:200,when:C.and(C.notEquals(OZ,"quickWidget"),lLe,C.not("isComposing")),metadata:{description:d(2305,null)},handler:a=>{a.get(Ue).currentQuickInput?.accept()},secondary:Sxi(3,[],{withAltMod:!0,withCtrlMod:!0,withCmdMod:!0,withShiftMod:!0})});Fk({id:"quickInput.acceptInBackground",when:C.and(lLe,C.equals(OZ,"quickPick"),C.or(ig.negate(),Oao)),primary:17,weight:250,handler:a=>{a.get(Ue).currentQuickInput?.accept(!0)}},{withAltMod:!0,withCtrlMod:!0,withCmdMod:!0});aYo({id:"quickInput.hide",primary:9,handler:a=>{a.get(Ue).currentQuickInput?.hide()}},{withAltMod:!0,withCtrlMod:!0,withCmdMod:!0});Fk({id:"quickInput.toggleCheckbox",when:C.and(lLe,C.or(C.equals(OZ,"quickPick"),C.equals(OZ,"quickTree")),ig.negate()),primary:10,handler:a=>{a.get(Ue).toggle()}});Fk({id:"quickInput.toggleHover",primary:Dme|10,handler:a=>{a.get(Ue).toggleHover()}});var iet=_,vBt=class extends x{constructor(){super(...arguments);this._onDidChangeCheckboxState=this._register(new E);this.onDidChangeCheckboxState=this._onDidChangeCheckboxState.event}setCheckboxState(e,t){this._onDidChangeCheckboxState.fire({item:e,checked:t})}},oG=class extends x{constructor(e,t,o,n,r,s,l){super();this._hoverDelegate=e;this._buttonTriggeredEmitter=t;this.onCheckedEvent=o;this._checkboxStateHandler=n;this._toggleStyles=r;this._contextMenuService=s;this._themeService=l;this.templateId=oG.ID;this._onDidDisposeFocusedElement=this._register(new E);this.onDidDisposeFocusedElement=this._onDidDisposeFocusedElement.event}static{this.ID="quickInputTreeElement"}renderTemplate(e){let t=new N,o=M(e,iet(".quick-input-tree-entry")),n=t.add(new FY("",!1,{...qf,size:15}));o.appendChild(n.domNode);let r=M(o,iet("label.quick-input-tree-label")),s=M(r,iet(".quick-input-tree-rows")),l=M(s,iet(".quick-input-tree-row")),c=KS(l,iet(".quick-input-tree-icon")),u=t.add(new Bc(l,{supportHighlights:!0,supportDescriptionHighlights:!0,supportIcons:!0,hoverDelegate:this._hoverDelegate})),p=t.add(new wp(o,this._contextMenuService,{actionViewItemProvider:Wz(this._toggleStyles),hoverDelegate:this._hoverDelegate,icon:!0,label:!1}));return p.getElement().classList.add("quick-input-tree-entry-action-bar"),{toDisposeTemplate:t,entry:o,checkbox:n,icon:c,label:u,actionBar:p,toDisposeElement:new N}}renderElement(e,t,o,n){let r=o.toDisposeElement,s=e.element;if(s.pickable===!1)o.checkbox.domNode.style.display="none";else{let h=o.checkbox;h.domNode.style.display="",h.checked=s.checked??!1,r.add(U.filter(this.onCheckedEvent,g=>g.item===s)(g=>h.checked=g.checked)),s.disabled&&h.disable(),r.add(h.onChange(g=>this._checkboxStateHandler.setCheckboxState(s,h.checked)))}if(s.iconPath){let h=Bp(this._themeService.getColorTheme().type)?s.iconPath.dark:s.iconPath.light??s.iconPath.dark,g=A.revive(h);o.icon.className="quick-input-tree-icon",o.icon.style.backgroundImage=Qa(g)}else o.icon.style.backgroundImage="",o.icon.className=s.iconClass?`quick-input-tree-icon ${s.iconClass}`:"";let{labelHighlights:l,descriptionHighlights:c}=e.filterData||{},u;s.description&&(u={markdown:{value:mr(s.description),supportThemeIcons:!0},markdownNotSupportedFallback:s.description}),o.label.setLabel(s.label,s.description,{matches:l,descriptionMatches:c,extraClasses:s.iconClasses,italic:s.italic,strikethrough:s.strikethrough,labelEscapeNewLines:!0,descriptionTitle:u});let p=s.buttons;if(p&&p.length){let{primary:h,secondary:g}=b3(p,"quick-input-tree",f=>this._buttonTriggeredEmitter.fire({item:s,button:f}));o.actionBar.setActions(h,g),o.entry.classList.add("has-actions")}else o.actionBar.setActions([]),o.entry.classList.remove("has-actions")}disposeElement(e,t,o,n){Gr(o.entry)&&this._onDidDisposeFocusedElement.fire(),o.toDisposeElement.clear(),o.actionBar.setActions([])}disposeTemplate(e){e.toDisposeElement.dispose(),e.toDisposeTemplate.dispose()}};oG=I([m(5,Xe),m(6,Le)],oG);var bBt=class{getHeight(i){return 22}getTemplateId(i){return oG.ID}};function lMe(a){let i=!1,e=!1,t=!1;for(let n of a){switch(n.element?.checked){case"mixed":t=!0;break;case!0:i=!0;break;default:e=!0;break}if(i&&e&&t)break}return e?t||i?"mixed":!1:t?"mixed":i}var SBt=class{constructor(i){this.onCheckedEvent=i}getWidgetAriaLabel(){return d(2322,null)}getAriaLabel(i){return i.ariaLabel||[i.label,i.description].map(e=>xz(e)).filter(e=>!!e).join(", ")}getWidgetRole(){return"tree"}getRole(i){return"checkbox"}isChecked(i){return{get value(){return i.checked==="mixed"?"mixed":!!i.checked},onDidChange:e=>U.filter(this.onCheckedEvent,t=>t.item===i)(t=>e())}}};var IBt=class{constructor(){this.filterValue="";this.matchOnLabel=!0;this.matchOnDescription=!1}filter(i,e){if(!this.filterValue||!(this.matchOnLabel||this.matchOnDescription))return i.children?{visibility:2,data:{}}:{visibility:1,data:{}};let t=this.matchOnLabel?Hj(this.filterValue,HV(i.label))??void 0:void 0,o=this.matchOnDescription?Hj(this.filterValue,HV(i.description||""))??void 0:void 0;return{visibility:e===1?1:t||o?1:i.children?2:0,data:{labelHighlights:t,descriptionHighlights:o}}}};var yBt=class extends x{constructor(){super(...arguments);this._sortByLabel=!0}get sortByLabel(){return this._sortByLabel}set sortByLabel(e){this._sortByLabel=e}compare(e,t){if(!this._sortByLabel)return 0;if(e.label<t.label)return-1;if(e.label>t.label)return 1;if(e.description&&t.description){if(e.description<t.description)return-1;if(e.description>t.description)return 1}else{if(e.description)return-1;if(t.description)return 1}return 0}};var lYo=_,cYo="quick-input-tree-flat",Ixi=class{constructor(){this._elementIds=new WeakMap;this._counter=0}getId(i){let e=i.id;return e!==void 0||(e=this._elementIds.get(i),e!==void 0)||(e=`__generated_${this._counter++}`,this._elementIds.set(i,e)),e}},cMe=class extends x{constructor(e,t,o,n){super();this.instantiationService=n;this._onDidTriggerButton=this._register(new E);this.onDidTriggerButton=this._onDidTriggerButton.event;this._onDidChangeCheckboxState=this._register(new E);this.onDidChangeCheckboxState=this._onDidChangeCheckboxState.event;this._onDidCheckedLeafItemsChange=this._register(new E);this.onDidChangeCheckedLeafItems=this._onDidCheckedLeafItemsChange.event;this._onLeave=this._register(new E);this.onLeave=this._onLeave.event;this._onDidAccept=this._register(new E);this.onDidAccept=this._onDidAccept.event;this._container=M(e,lYo(".quick-input-tree")),this._checkboxStateHandler=this._register(new vBt),this._renderer=this._register(this.instantiationService.createInstance(oG,t,this._onDidTriggerButton,this.onDidChangeCheckboxState,this._checkboxStateHandler,o.toggle)),this._filter=this.instantiationService.createInstance(IBt),this._sorter=this._register(new yBt),this._tree=this._register(this.instantiationService.createInstance(Rg,"QuickInputTree",this._container,new bBt,[this._renderer],{accessibilityProvider:new SBt(this.onDidChangeCheckboxState),horizontalScrolling:!1,multipleSelectionSupport:!1,findWidgetEnabled:!1,alwaysConsumeMouseWheel:!0,hideTwistiesOfChildlessElements:!0,renderIndentGuides:"none",expandOnDoubleClick:!0,expandOnlyOnTwistieClick:!0,disableExpandOnSpacebar:!0,sorter:this._sorter,filter:this._filter,identityProvider:new Ixi})),this._register(this._renderer.onDidDisposeFocusedElement(()=>{this._tree.domFocus()})),this.registerCheckboxStateListeners(),this.registerOnDidChangeFocus()}get tree(){return this._tree}get renderer(){return this._renderer}get displayed(){return this._container.style.display!=="none"}set displayed(e){this._container.style.display=e?"":"none"}get sortByLabel(){return this._sorter.sortByLabel}set sortByLabel(e){this._sorter.sortByLabel=e,this._tree.resort(null,!0)}getActiveDescendant(){return this._tree.getHTMLElement().getAttribute("aria-activedescendant")}filter(e){this._filter.filterValue=e,this._tree.refilter()}updateFilterOptions(e){e.matchOnLabel!==void 0&&(this._filter.matchOnLabel=e.matchOnLabel),e.matchOnDescription!==void 0&&(this._filter.matchOnDescription=e.matchOnDescription),this._tree.refilter()}setTreeData(e){let t=!1,o=r=>{let s;return r.children&&r.children.length>0&&(t=!0,s=r.children.map(l=>o(l)),r.checked=lMe(s)),{element:r,children:s,collapsible:!!s,collapsed:r.collapsed?3:2}},n=e.map(r=>o(r));this._tree.setChildren(null,n),this._container.classList.toggle(cYo,!t)}layout(e){this._tree.getHTMLElement().style.maxHeight=e?`${Math.floor(e/44)*44+6}px`:"",this._tree.layout()}focus(e){switch(e){case 1:this._tree.scrollTop=0,this._tree.focusFirst();break;case 2:{this._tree.scrollTop=0;let t=!1;this._tree.focusFirst(void 0,o=>t?!0:(t=!t,!1));break}case 3:this._tree.scrollTop=this._tree.scrollHeight,this._tree.focusLast();break;case 4:{let t=this._tree.getFocus();this._tree.focusNext(void 0,!1,void 0,n=>(this._tree.reveal(n.element),!0));let o=this._tree.getFocus();t.length&&t[0]===o[0]&&this._onLeave.fire();break}case 5:{let t=this._tree.getFocus();this._tree.focusPrevious(void 0,!1,void 0,n=>(this._tree.reveal(n.element),!0));let o=this._tree.getFocus();t.length&&t[0]===o[0]&&this._onLeave.fire();break}case 6:this._tree.focusNextPage(void 0,t=>(this._tree.reveal(t.element),!0));break;case 7:this._tree.focusPreviousPage(void 0,t=>(this._tree.reveal(t.element),!0));break;case 8:case 9:return}}registerCheckboxStateListeners(){this._register(this._tree.onDidOpen(e=>{let t=e.element;if(!t||t.disabled)return;if(t.pickable===!1){this._tree.setFocus([t]),this._onDidAccept.fire();return}let o=e.browserEvent?.target;o&&o.classList.contains(Ev.CLASS_NAME)||this.updateCheckboxState(t,t.checked===!0)})),this._register(this._checkboxStateHandler.onDidChangeCheckboxState(e=>{this.updateCheckboxState(e.item,e.checked===!0,!0),this._tree.setFocus([e.item]),this._tree.setSelection([e.item])}))}updateCheckboxState(e,t,o=!1){if((e.checked??!1)===t)return;e.checked=t,o||this._tree.rerender(e);let n=new Set,r=[...this._tree.getNode(e).children];for(;r.length;){let l=r.shift();l?.element&&!n.has(l.element)&&(n.add(l.element),(l.element.checked??!1)!==e.checked&&(l.element.checked=e.checked,this._tree.rerender(l.element)),r.push(...l.children))}let s=this._tree.getParentElement(e);for(;s;){let l=[...this._tree.getNode(s).children],c=lMe(l);(s.checked??!1)!==c&&(s.checked=c,this._tree.rerender(s)),s=this._tree.getParentElement(s)}this._onDidChangeCheckboxState.fire({item:e,checked:e.checked??!1}),this._onDidCheckedLeafItemsChange.fire(this.getCheckedLeafItems())}registerOnDidChangeFocus(){this._register(this._tree.onDidChangeFocus(e=>{let t=this._tree.getFocus().findLast(o=>o!==null);this._tree.setSelection(t?[t]:[],e.browserEvent)}))}getCheckedLeafItems(){let e=new Set,t=[...this._tree.getNode().children],o=new Array;for(;t.length;){let n=t.shift();!n?.element||e.has(n.element)||n.element.checked&&(e.add(n.element),t.push(...n.children),n.element.children||o.push(n.element))}return o}getActiveItems(){return this._tree.getFocus().filter(e=>e!==null)}toggleCheckbox(){for(let e of this.getActiveItems())e.pickable!==!1&&!e.disabled&&this.updateCheckboxState(e,e.checked!==!0)}checkAll(e){let t=new Set,o=[...this._tree.getNode().children],n=!1;for(;o.length;){let r=o.shift();!r?.element||t.has(r.element)||r.element.checked!==e&&(n=!0,r.element.checked=e,o.push(...r.children),t.add(r.element),this._tree.rerender(r.element),this._onDidChangeCheckboxState.fire({item:r.element,checked:r.element.checked}))}n&&this._onDidCheckedLeafItemsChange.fire(this.getCheckedLeafItems())}};cMe=I([m(3,F)],cMe);var oet=class a extends AZ{constructor(e){super(e);this.type="quickTree";this._value=Me("value","");this._ariaLabel=Me("ariaLabel",void 0);this._placeholder=Me("placeholder",void 0);this._matchOnDescription=Me("matchOnDescription",!1);this._matchOnLabel=Me("matchOnLabel",!0);this._sortByLabel=Me("sortByLabel",!0);this._activeItems=Me("activeItems",[]);this._itemTree=Me("itemTree",[]);this.onDidChangeValue=U.fromObservable(this._value,this._store);this.onDidChangeActive=U.fromObservable(this._activeItems,this._store);this._onDidChangeCheckedLeafItems=this._register(new E);this.onDidChangeCheckedLeafItems=this._onDidChangeCheckedLeafItems.event;this._onDidChangeCheckboxState=this._register(new E);this.onDidChangeCheckboxState=this._onDidChangeCheckboxState.event;this._onDidAcceptEmitter=this._register(new E);this.onDidAccept=U.any(e.onDidAccept,this._onDidAcceptEmitter.event),this._registerAutoruns(),this._register(e.tree.onDidChangeCheckedLeafItems(t=>this._onDidChangeCheckedLeafItems.fire(t))),this._register(e.tree.onDidChangeCheckboxState(t=>this._onDidChangeCheckboxState.fire(t.item))),this._register(e.tree.tree.onDidChangeFocus(t=>{this._activeItems.set(e.tree.getActiveItems(),void 0)}))}static{this.DEFAULT_ARIA_LABEL=d(2323,null)}get value(){return this._value.get()}set value(e){this._value.set(e,void 0)}get ariaLabel(){return this._ariaLabel.get()}set ariaLabel(e){this._ariaLabel.set(e,void 0)}get placeholder(){return this._placeholder.get()}set placeholder(e){this._placeholder.set(e,void 0)}get matchOnDescription(){return this._matchOnDescription.get()}set matchOnDescription(e){this._matchOnDescription.set(e,void 0)}get matchOnLabel(){return this._matchOnLabel.get()}set matchOnLabel(e){this._matchOnLabel.set(e,void 0)}get sortByLabel(){return this._sortByLabel.get()}set sortByLabel(e){this._sortByLabel.set(e,void 0)}get activeItems(){return this._activeItems.get()}set activeItems(e){this._activeItems.set(e,void 0)}get itemTree(){return this._itemTree.get()}get onDidTriggerItemButton(){return this.ui.tree.onDidTriggerButton}get checkedLeafItems(){return this.ui.tree.getCheckedLeafItems()}setItemTree(e){this._itemTree.set(e,void 0)}getParent(e){return this.ui.tree.tree.getParentElement(e)??void 0}expand(e){this.ui.tree.tree.expand(e)}collapse(e){this.ui.tree.tree.collapse(e)}isCollapsed(e){return this.ui.tree.tree.isCollapsed(e)}focusOnInput(){this.ui.inputBox.setFocus()}reveal(e){this.ui.tree.tree.reveal(e),this.ui.tree.tree.setFocus([e])}show(){if(!this.visible){let t={title:!!this.title||!!this.step||!!this.titleButtons.length,description:!!this.description,checkAll:!0,checkBox:!0,inputBox:!0,progressBar:!0,visibleCount:!0,count:!0,ok:!0,list:!1,tree:!0,message:!!this.validationMessage,customButton:!1};this.ui.setVisibilities(t),this.visibleDisposables.add(this.ui.inputBox.onDidChange(o=>{this._value.set(o,void 0)})),this.visibleDisposables.add(this.ui.tree.onDidChangeCheckboxState(o=>{let n=lMe([...this.ui.tree.tree.getNode().children]);this.ui.checkAll.checked!==n&&(this.ui.checkAll.checked=n)})),this.visibleDisposables.add(this.ui.checkAll.onChange(o=>{let n=this.ui.checkAll.checked;this.ui.tree.checkAll(n)})),this.visibleDisposables.add(this.ui.tree.onDidChangeCheckedLeafItems(o=>{this.ui.count.setCount(o.length)}))}super.show(),pC(()=>this.ui.count.setCount(this.ui.tree.getCheckedLeafItems().length));let e=lMe([...this.ui.tree.tree.getNode().children]);this.ui.checkAll.checked!==e&&(this.ui.checkAll.checked=e)}update(){if(!this.visible)return;let e={title:!!this.title||!!this.step||!!this.titleButtons.length,description:!!this.description,checkAll:!0,checkBox:!0,inputBox:!0,progressBar:!0,visibleCount:!0,count:!0,ok:!0,tree:!0,message:!!this.validationMessage};this.ui.setVisibilities(e),super.update()}_registerListeners(){}_registerAutoruns(){this.registerVisibleAutorun(e=>{let t=this._value.read(e);this.ui.inputBox.value=t,this.ui.tree.filter(t)}),this.registerVisibleAutorun(e=>{let t=this._ariaLabel.read(e);t||(t=this.placeholder||a.DEFAULT_ARIA_LABEL,this.title&&(t+=` - ${this.title}`)),this.ui.list.ariaLabel!==t&&(this.ui.list.ariaLabel=t??null),this.ui.inputBox.ariaLabel!==t&&(this.ui.inputBox.ariaLabel=t??"input")}),this.registerVisibleAutorun(e=>{let t=this._placeholder.read(e);this.ui.inputBox.placeholder!==t&&(this.ui.inputBox.placeholder=t??"")}),this.registerVisibleAutorun(e=>{let t=this._matchOnLabel.read(e),o=this._matchOnDescription.read(e);this.ui.tree.updateFilterOptions({matchOnLabel:t,matchOnDescription:o})}),this.registerVisibleAutorun(e=>{let t=this._sortByLabel.read(e);this.ui.tree.sortByLabel=t}),this.registerVisibleAutorun(e=>{let t=this._itemTree.read(e);this.ui.tree.setTreeData(t)})}registerVisibleAutorun(e){this._register(be(t=>{this._visible.read(t)&&e(t)}))}focus(e){this.ui.tree.focus(e),this.ui.tree.tree.domFocus()}accept(e){this._onDidAcceptEmitter.fire()}};var gM=_,yxi="workbench.quickInput.viewState",Dee=class extends x{constructor(e,t,o,n,r,s){super();this.options=e;this.layoutService=t;this.instantiationService=o;this.storageService=r;this.contextMenuService=s;this.enabled=!0;this.onDidAcceptEmitter=this._register(new E);this.onDidCustomEmitter=this._register(new E);this.onDidTriggerButtonEmitter=this._register(new E);this.keyMods={ctrlCmd:!1,alt:!1,shift:!1};this.controller=null;this.onShowEmitter=this._register(new E);this.onShow=this.onShowEmitter.event;this.onHideEmitter=this._register(new E);this.onHide=this.onHideEmitter.event;this.backButton=GOt;this.inQuickInputContext=Mao.bindTo(n),this.quickInputTypeContext=Pao.bindTo(n),this.endOfQuickInputBoxContext=Nao.bindTo(n),this.idPrefix=e.idPrefix,this._container=e.container,this.styles=e.styles,this._register(U.runAndSubscribe(nf,({window:l,disposables:c})=>this.registerKeyModsListeners(l,c),{window:ut,disposables:this._store})),this._register(Fqi(l=>{this.ui&&Re(this.ui.container)===l&&(this.reparentUI(this.layoutService.mainContainer),this.layout(this.layoutService.mainContainerDimension,this.layoutService.mainContainerOffset.quickPickTop))})),this.viewState=this.loadViewState()}static{this.MAX_WIDTH=600}get currentQuickInput(){return this.controller??void 0}get container(){return this._container}registerKeyModsListeners(e,t){let o=n=>{this.keyMods.ctrlCmd=n.ctrlKey||n.metaKey,this.keyMods.alt=n.altKey,this.keyMods.shift=n.shiftKey};for(let n of[re.KEY_DOWN,re.KEY_UP,re.MOUSE_DOWN])t.add(j(e,n,o,!0))}getUI(e){if(this.ui)return e&&Re(this._container)!==Re(this.layoutService.activeContainer)&&(this.reparentUI(this.layoutService.activeContainer),this.layout(this.layoutService.activeContainerDimension,this.layoutService.activeContainerOffset.quickPickTop)),this.ui;let t=M(this._container,gM(".quick-input-widget.show-file-icons"));t.tabIndex=-1,t.style.display="none";let o=Cr(t),n=M(t,gM(".quick-input-titlebar")),r=this._register(new wp(n,this.contextMenuService,{hoverDelegate:this.options.hoverDelegate,actionViewItemProvider:Wz(this.styles.toggle),icon:!0,label:!1}));r.getElement().classList.add("quick-input-left-action-bar");let s=M(n,gM(".quick-input-title")),l=this._register(new wp(n,this.contextMenuService,{hoverDelegate:this.options.hoverDelegate,actionViewItemProvider:Wz(this.styles.toggle),icon:!0,label:!1}));l.getElement().classList.add("quick-input-right-action-bar");let c=M(t,gM(".quick-input-header")),u=this._register(new FY(d(2314,null),!1,{...qf,size:15}));M(c,u.domNode),this._register(u.onChange(()=>{let de=u.checked;ae.setAllVisibleChecked(de===!0)})),this._register(j(u.domNode,re.CLICK,de=>{(de.x||de.y)&&f.setFocus()}));let p=M(c,gM(".quick-input-description")),h=M(c,gM(".quick-input-and-message")),g=M(h,gM(".quick-input-filter")),f=this._register(new hBt(g,this.styles.inputBox,this.styles.toggle));f.setAttribute("aria-describedby",`${this.idPrefix}message`);let v=M(g,gM(".quick-input-visible-count"));v.setAttribute("aria-live","polite"),v.setAttribute("aria-atomic","true");let b=this._register(new _v(v,{countFormat:d(2316,null)},this.styles.countBadge)),S=M(g,gM(".quick-input-count"));S.setAttribute("aria-live","polite");let y=this._register(new _v(S,{countFormat:d(2315,null)},this.styles.countBadge)),w=this._register(new wp(c,this.contextMenuService,{hoverDelegate:this.options.hoverDelegate,actionViewItemProvider:Wz(this.styles.toggle),icon:!0,label:!1}));w.getElement().classList.add("quick-input-inline-action-bar");let k=M(c,gM(".quick-input-action")),T=this._register(new Wi(k,this.styles.button));T.label=d(2311,null),this._register(T.onDidClick(de=>{this.onDidAcceptEmitter.fire()}));let P=M(c,gM(".quick-input-action")),O=this._register(new Wi(P,{...this.styles.button,supportIcons:!0}));O.label=d(2310,null),this._register(O.onDidClick(de=>{this.onDidCustomEmitter.fire()}));let V=M(h,gM(`#${this.idPrefix}message.quick-input-message`)),H=this._register(new Zf(t,this.styles.progressBar));H.getContainer().classList.add("quick-input-progress");let G=M(t,gM(".quick-input-html-widget"));G.tabIndex=-1;let $=M(t,gM(".quick-input-description")),J=this.idPrefix+"list",ae=this._register(this.instantiationService.createInstance(Eee,t,this.options.hoverDelegate,this.options.linkOpenerDelegate,J,this.styles));f.setAttribute("aria-controls",J),this._register(ae.onDidChangeFocus(()=>{if(f.hasFocus()){let de=ae.getActiveDescendant();de?(f.setAttribute("aria-activedescendant",de),f.setListFocusMode(!0)):(f.removeAttribute("aria-activedescendant"),f.setListFocusMode(!1))}})),this._register(ae.onChangedAllVisibleChecked(de=>{u.checked=de})),this._register(ae.onChangedVisibleCount(de=>{b.setCount(de)})),this._register(ae.onChangedCheckedCount(de=>{pC(()=>y.setCount(de))})),this._register(ae.onLeave(()=>{setTimeout(()=>{this.controller&&(f.setFocus(),this.controller instanceof NZ&&this.controller.canSelectMany&&ae.clearFocus())},0)}));let he=this._register(this.instantiationService.createInstance(cMe,t,this.options.hoverDelegate,this.styles));this._register(he.tree.onDidChangeFocus(()=>{if(f.hasFocus()){let de=he.getActiveDescendant();de?(f.setAttribute("aria-activedescendant",de),f.setListFocusMode(!0)):(f.removeAttribute("aria-activedescendant"),f.setListFocusMode(!1))}})),this._register(he.onLeave(()=>{setTimeout(()=>{this.controller&&(f.setFocus(),he.tree.setFocus([]))},0)})),this._register(he.onDidAccept(()=>{this.onDidAcceptEmitter.fire()})),this._register(he.tree.onDidChangeContentHeight(()=>this.updateLayout()));let oe=qn(t);return this._register(oe),this._register(j(t,re.FOCUS,de=>{let Ce=this.getUI();if(ts(de.relatedTarget,Ce.inputContainer)){let xe=Ce.inputBox.isSelectionAtEnd();this.endOfQuickInputBoxContext.get()!==xe&&this.endOfQuickInputBoxContext.set(xe)}ts(de.relatedTarget,Ce.container)||(this.inQuickInputContext.set(!0),this.previousFocusElement=Do(de.relatedTarget)?de.relatedTarget:void 0)},!0)),this._register(oe.onDidBlur(()=>{!this.getUI().ignoreFocusOut&&!this.options.ignoreFocusOut()&&this.hide(1),this.inQuickInputContext.set(!1),this.endOfQuickInputBoxContext.set(!1),this.previousFocusElement=void 0})),this._register(f.onKeyDown(de=>{let Ce=this.getUI().inputBox.isSelectionAtEnd();this.endOfQuickInputBoxContext.get()!==Ce&&this.endOfQuickInputBoxContext.set(Ce),XN(de.keyCode)||(f.removeAttribute("aria-activedescendant"),f.setListFocusMode(!1))})),this._register(j(t,re.FOCUS,de=>{f.setFocus()})),this.dndController=this._register(this.instantiationService.createInstance(net,this._container,t,[{node:n,includeChildren:!0,excludeNodes:[r.getElement(),l.getElement()]},{node:c,includeChildren:!1}],this.viewState)),this._register(be(de=>{let Ce=this.dndController?.dndViewState.read(de);Ce&&(Ce.top!==void 0&&Ce.left!==void 0?this.viewState={...this.viewState,top:Ce.top,left:Ce.left}:this.viewState=void 0,this.updateLayout(),Ce.done&&this.saveViewState(this.viewState))})),this.ui={container:t,styleSheet:o,leftActionBar:r,titleBar:n,title:s,description1:$,description2:p,widget:G,rightActionBar:l,inlineActionBar:w,checkAll:u,inputContainer:h,filterContainer:g,inputBox:f,visibleCountContainer:v,visibleCount:b,countContainer:S,count:y,okContainer:k,ok:T,message:V,customButtonContainer:P,customButton:O,list:ae,tree:he,progressBar:H,onDidAccept:this.onDidAcceptEmitter.event,onDidCustom:this.onDidCustomEmitter.event,onDidTriggerButton:this.onDidTriggerButtonEmitter.event,ignoreFocusOut:!1,keyMods:this.keyMods,show:de=>this.show(de),hide:()=>this.hide(),setVisibilities:de=>this.setVisibilities(de),setEnabled:de=>this.setEnabled(de),setContextKey:de=>this.options.setContextKey(de),linkOpenerDelegate:de=>this.options.linkOpenerDelegate(de)},this.updateStyles(),this.ui}reparentUI(e){this.ui&&(this._container=e,M(this._container,this.ui.container),this.dndController?.reparentUI(this._container))}pick(e,t={},o=Se.None){return new Promise((n,r)=>{let s=p=>{s=n,t.onKeyMods?.(l.keyMods),n(p)};if(o.isCancellationRequested){s(void 0);return}let l=this.createQuickPick({useSeparators:!0}),c,u=[l,l.onDidAccept(()=>{if(l.canSelectMany)s(l.selectedItems.slice()),l.hide();else{let p=l.activeItems[0];p&&(s(p),l.hide())}}),l.onDidChangeActive(p=>{let h=p[0];h&&t.onDidFocus&&t.onDidFocus(h)}),l.onDidChangeSelection(p=>{if(!l.canSelectMany){let h=p[0];h&&(s(h),l.hide())}}),l.onDidTriggerItemButton(p=>t.onDidTriggerItemButton&&t.onDidTriggerItemButton({...p,removeItem:()=>{let h=l.items.indexOf(p.item);if(h!==-1){let g=l.items.slice(),f=g.splice(h,1),v=l.activeItems.filter(S=>S!==f[0]),b=l.keepScrollPosition;l.keepScrollPosition=!0,l.items=g,v&&(l.activeItems=v),l.keepScrollPosition=b}}})),l.onDidTriggerSeparatorButton(p=>t.onDidTriggerSeparatorButton?.(p)),l.onDidChangeValue(p=>{c&&!p&&(l.activeItems.length!==1||l.activeItems[0]!==c)&&(l.activeItems=[c])}),o.onCancellationRequested(()=>{l.hide()}),l.onDidHide(()=>{Be(u),s(void 0)})];l.title=t.title,t.value&&(l.value=t.value),l.canSelectMany=!!t.canPickMany,l.placeholder=t.placeHolder,l.prompt=t.prompt,l.ignoreFocusOut=!!t.ignoreFocusLost,l.matchOnDescription=!!t.matchOnDescription,l.matchOnDetail=!!t.matchOnDetail,t.sortByLabel!==void 0&&(l.sortByLabel=t.sortByLabel),l.matchOnLabel=t.matchOnLabel===void 0||t.matchOnLabel,l.quickNavigate=t.quickNavigate,l.hideInput=!!t.hideInput,l.contextKey=t.contextKey,l.anchor=t.anchor,l.busy=!0,Promise.all([e,t.activeItem]).then(([p,h])=>{c=h,l.busy=!1,l.items=p,l.canSelectMany&&(l.selectedItems=p.filter(g=>g.type!=="separator"&&g.picked)),c&&(l.activeItems=[c])}),l.show(),Promise.resolve(e).then(void 0,p=>{r(p),l.hide()})})}setValidationOnInput(e,t){t&&Fe(t)?(e.severity=bt.Error,e.validationMessage=t):t&&!Fe(t)?(e.severity=t.severity,e.validationMessage=t.content):(e.severity=bt.Ignore,e.validationMessage=void 0)}input(e={},t=Se.None){return new Promise(o=>{if(t.isCancellationRequested){o(void 0);return}let n=this.createInputBox(),r=e.validateInput||(()=>Promise.resolve(void 0)),s=U.debounce(n.onDidChangeValue,(p,h)=>h,100),l=e.value||"",c=Promise.resolve(r(l)),u=[n,s(p=>{p!==l&&(c=Promise.resolve(r(p)),l=p),c.then(h=>{p===l&&this.setValidationOnInput(n,h)})}),n.onDidAccept(()=>{let p=n.value;p!==l&&(c=Promise.resolve(r(p)),l=p),c.then(h=>{!h||!Fe(h)&&h.severity!==bt.Error?(o(p),n.hide()):p===l&&this.setValidationOnInput(n,h)})}),t.onCancellationRequested(()=>{n.hide()}),n.onDidHide(()=>{Be(u),o(void 0)})];n.title=e.title,n.value=e.value||"",n.valueSelection=e.valueSelection,n.prompt=e.prompt,n.placeholder=e.placeHolder,n.password=!!e.password,n.ignoreFocusOut=!!e.ignoreFocusLost,n.show()})}createQuickPick(e={useSeparators:!1}){let t=this.getUI(!0);return new NZ(t)}createInputBox(){let e=this.getUI(!0);return new UOt(e)}setAlignment(e){this.dndController?.setAlignment(e)}createQuickWidget(){let e=this.getUI(!0);return new zOt(e)}createQuickTree(){let e=this.getUI(!0);return new oet(e)}show(e){let t=this.getUI(!0);this.onShowEmitter.fire();let o=this.controller;this.controller=e,o?.didHide(),this.setEnabled(!0),t.leftActionBar.setActions([]),t.title.textContent="",t.description1.textContent="",t.description2.textContent="",vi(t.widget),t.rightActionBar.setActions([]),t.inlineActionBar.setActions([]),t.checkAll.checked=!1,t.inputBox.placeholder="",t.inputBox.password=!1,t.inputBox.showDecoration(bt.Ignore),t.visibleCount.setCount(0),t.count.setCount(0),t.countContainer.style.right="4px",vi(t.message),t.progressBar.stop(),t.progressBar.getContainer().setAttribute("aria-hidden","true"),t.list.setElements([]),t.list.matchOnDescription=!1,t.list.matchOnDetail=!1,t.list.matchOnLabel=!0,t.list.sortByLabel=!0,t.tree.updateFilterOptions({matchOnDescription:!1,matchOnLabel:!0}),t.tree.sortByLabel=!0,t.ignoreFocusOut=!1,t.inputBox.toggles=void 0,t.inputBox.actions=void 0;let n=this.options.backKeybindingLabel();GOt.tooltip=n?d(2313,null,n):d(2312,null),t.container.style.display="",this.updateLayout(),this.dndController?.setEnabled(!e.anchor),this.dndController?.layoutContainer(),t.inputBox.setFocus(),this.quickInputTypeContext.set(e.type)}isVisible(){return!!this.ui&&this.ui.container.style.display!=="none"}setVisibilities(e){let t=this.getUI();t.title.style.display=e.title?"":"none",t.description1.style.display=e.description&&(e.inputBox||e.checkAll)?"":"none",t.description2.style.display=e.description&&!(e.inputBox||e.checkAll)?"":"none",t.checkAll.domNode.style.display=e.checkAll?"":"none",t.inputContainer.style.display=e.inputBox?"":"none",t.filterContainer.style.display=e.inputBox?"":"none",t.visibleCountContainer.style.display=e.visibleCount?"":"none",t.countContainer.style.display=e.count?"":"none",t.okContainer.style.display=e.ok?"":"none",t.customButtonContainer.style.display=e.customButton?"":"none",t.message.style.display=e.message?"":"none",t.progressBar.getContainer().style.display=e.progressBar?"":"none",t.list.displayed=!!e.list,t.tree.displayed=!!e.tree,t.container.classList.toggle("show-checkboxes",!!e.checkBox),t.container.classList.toggle("hidden-input",!e.inputBox&&!e.description),this.updateLayout()}setEnabled(e){if(e!==this.enabled){this.enabled=e;let t=this.getUI();for(let o=0;o<t.leftActionBar.getItemsLength();o++){let n=t.leftActionBar.getItemAction(o);n&&(n.enabled=e)}for(let o=0;o<t.rightActionBar.getItemsLength();o++){let n=t.rightActionBar.getItemAction(o);n&&(n.enabled=e)}e?t.checkAll.enable():t.checkAll.disable(),t.inputBox.enabled=e,t.ok.enabled=e,t.list.enabled=e}}hide(e){let t=this.controller;if(!t)return;t.willHide(e);let o=this.ui?.container,n=o&&!Gr(o);if(this.controller=null,this.onHideEmitter.fire(),o&&(o.style.display="none"),!n){let r=this.previousFocusElement;for(;r&&!r.offsetParent;)r=r.parentElement??void 0;r?.offsetParent?(r.focus(),this.previousFocusElement=void 0):this.options.returnFocus()}t.didHide(e)}focus(){if(this.isVisible()){let e=this.getUI();e.inputBox.enabled?e.inputBox.setFocus():e.list.domFocus()}}toggle(){this.isVisible()&&(this.controller instanceof NZ&&this.controller.canSelectMany?this.getUI().list.toggleCheckbox():this.controller instanceof oet&&this.getUI().tree.toggleCheckbox())}toggleHover(){this.isVisible()&&this.controller instanceof NZ&&this.getUI().list.toggleHover()}navigate(e,t){this.isVisible()&&this.getUI().list.displayed&&(this.getUI().list.focus(e?4:5),t&&this.controller instanceof NZ&&(this.controller.quickNavigate=t))}async accept(e={alt:!1,ctrlCmd:!1,shift:!1}){this.keyMods.alt=e.alt,this.keyMods.ctrlCmd=e.ctrlCmd,this.keyMods.shift=e.shift,this.onDidAcceptEmitter.fire()}async back(){this.onDidTriggerButtonEmitter.fire(this.backButton)}async cancel(e){this.hide(e)}layout(e,t){this.dimension=e,this.titleBarOffset=t,this.updateLayout()}updateLayout(){if(this.ui&&this.isVisible()){let e=this.ui.container.style,t=Math.min(this.dimension.width*.62,Dee.MAX_WIDTH);e.width=t+"px";let o=this.dimension&&this.dimension.height*.4;if(this.controller?.anchor){let n=this.layoutService.getContainer(Ki()).getBoundingClientRect(),r=v4e(this.controller.anchor);t=380,o=this.dimension?Math.min(this.dimension.height*.2,200):200;let s=Math.floor(o)+6+26+16,{top:l,left:c,right:u,bottom:p,anchorAlignment:h,anchorPosition:g}=Uyt(n,{width:t,height:s},r,{anchorPosition:1});h===1?(e.right=`${u}px`,e.left="initial"):(e.left=`${c}px`,e.right="initial"),g===1?(e.bottom=`${p}px`,e.top="initial"):(e.top=`${l}px`,e.bottom="initial"),e.width=`${t}px`,e.height=""}else e.top=`${this.viewState?.top?Math.round(this.dimension.height*this.viewState.top):this.titleBarOffset}px`,e.left=`${Math.round(this.dimension.width*(this.viewState?.left??.5)-t/2)}px`,e.right="",e.bottom="",e.height="";this.ui.inputBox.layout(),this.ui.list.layout(o),this.ui.tree.layout(o)}}applyStyles(e){this.styles=e,this.updateStyles()}updateStyles(){if(this.ui){let{quickInputTitleBackground:e,quickInputBackground:t,quickInputForeground:o,widgetBorder:n}=this.styles.widget;this.ui.titleBar.style.backgroundColor=e??"",this.ui.container.style.backgroundColor=t??"",this.ui.container.style.color=o??"",this.ui.container.style.border=n?`1px solid ${n}`:"",this.ui.list.style(this.styles.list),this.ui.tree.tree.style(this.styles.list);let r=[];this.styles.pickerGroup.pickerGroupBorder&&r.push(`.quick-input-list .quick-input-list-entry { border-top-color:  ${this.styles.pickerGroup.pickerGroupBorder}; }`),this.styles.pickerGroup.pickerGroupForeground&&r.push(`.quick-input-list .quick-input-list-separator { color:  ${this.styles.pickerGroup.pickerGroupForeground}; }`),this.styles.pickerGroup.pickerGroupForeground&&r.push(".quick-input-list .quick-input-list-separator-as-item { color: var(--vscode-descriptionForeground); }"),(this.styles.keybindingLabel.keybindingLabelBackground||this.styles.keybindingLabel.keybindingLabelBorder||this.styles.keybindingLabel.keybindingLabelBottomBorder||this.styles.keybindingLabel.keybindingLabelShadow||this.styles.keybindingLabel.keybindingLabelForeground)&&(r.push(".quick-input-list .monaco-keybinding > .monaco-keybinding-key {"),this.styles.keybindingLabel.keybindingLabelBackground&&r.push(`background-color: ${this.styles.keybindingLabel.keybindingLabelBackground};`),this.styles.keybindingLabel.keybindingLabelBorder&&r.push(`border-color: ${this.styles.keybindingLabel.keybindingLabelBorder};`),this.styles.keybindingLabel.keybindingLabelBottomBorder&&r.push(`border-bottom-color: ${this.styles.keybindingLabel.keybindingLabelBottomBorder};`),this.styles.keybindingLabel.keybindingLabelShadow&&r.push(`box-shadow: inset 0 -1px 0 ${this.styles.keybindingLabel.keybindingLabelShadow};`),this.styles.keybindingLabel.keybindingLabelForeground&&r.push(`color: ${this.styles.keybindingLabel.keybindingLabelForeground};`),r.push("}"));let s=r.join(`
`);s!==this.ui.styleSheet.textContent&&(this.ui.styleSheet.textContent=s)}}loadViewState(){try{let e=JSON.parse(this.storageService.get(yxi,-1,"{}"));if(e.top!==void 0||e.left!==void 0)return e}catch{}}saveViewState(e){this.layoutService.activeContainer===this.layoutService.mainContainer&&(e!==void 0?this.storageService.store(yxi,JSON.stringify(e),-1,1):this.storageService.remove(yxi,-1))}};Dee=I([m(1,Kl),m(2,F),m(3,X),m(4,ce),m(5,Xe)],Dee);var net=class extends x{constructor(e,t,o,n,r,s,l){super();this._container=e;this._quickInputContainer=t;this._quickInputDragAreas=o;this._layoutService=r;this.configurationService=l;this.dndViewState=Me(this,void 0);this._enabled=!0;this._snapThreshold=20;this._snapLineHorizontalRatio=.25;this._quickInputAlignmentContext=WXe.bindTo(s);let c=N4e(this.configurationService)==="custom";this._controlsOnLeft=c&&om===1,this._controlsOnRight=c&&(om===3||om===2),this._registerLayoutListener(),this.registerMouseListeners(),this.dndViewState.set({...n,done:!0},void 0)}reparentUI(e){this._container=e}layoutContainer(e=this._layoutService.activeContainerDimension){if(!this._enabled)return;let t=this.dndViewState.get(),o=this._quickInputContainer.getBoundingClientRect();if(t?.top&&t?.left){let n=Math.round(t.left*100)/100,r=e.width,s=o.width,l=n*r-s/2;this._layout(t.top*e.height,l)}}setEnabled(e){this._enabled=e,this._quickInputContainer.classList.toggle("no-drag",!e)}setAlignment(e,t=!0){e==="top"?(this.dndViewState.set({top:this._getTopSnapValue()/this._container.clientHeight,left:(this._getCenterXSnapValue()+this._quickInputContainer.clientWidth/2)/this._container.clientWidth,done:t},void 0),this._quickInputAlignmentContext.set("top")):e==="center"?(this.dndViewState.set({top:this._getCenterYSnapValue()/this._container.clientHeight,left:(this._getCenterXSnapValue()+this._quickInputContainer.clientWidth/2)/this._container.clientWidth,done:t},void 0),this._quickInputAlignmentContext.set("center")):(this.dndViewState.set({top:e.top,left:e.left,done:t},void 0),this._quickInputAlignmentContext.set(void 0))}_registerLayoutListener(){this._register(U.filter(this._layoutService.onDidLayoutContainer,e=>e.container===this._container)(e=>this.layoutContainer(e.dimension)))}registerMouseListeners(){let e=this._quickInputContainer;this._register(pae(e,t=>{if(!this._enabled)return;let o=new Cn(Re(e),t);if(o.detail!==2)return;let n=this._quickInputDragAreas.find(({node:r,includeChildren:s})=>s?ts(o.target,r):o.target===r);!n||n.excludeNodes?.some(r=>ts(o.target,r))||this.dndViewState.set({top:void 0,left:void 0,done:!0},void 0)})),this._register(q$(e,t=>{if(!this._enabled)return;let o=Re(this._layoutService.activeContainer),n=new Cn(o,t),r=this._quickInputDragAreas.find(({node:g,includeChildren:f})=>f?ts(n.target,g):n.target===g);if(!r||r.excludeNodes?.some(g=>ts(n.target,g)))return;let s=this._quickInputContainer.getBoundingClientRect(),l=n.browserEvent.clientX-s.left,c=n.browserEvent.clientY-s.top,u=!1,p=LIe(o,g=>{new Cn(o,g).preventDefault(),u||(u=!0),this._layout(g.clientY-c,g.clientX-l)}),h=pae(o,g=>{if(u){let f=this.dndViewState.get();this.dndViewState.set({top:f?.top,left:f?.left,done:!0},void 0)}p.dispose(),h.dispose()})}))}_layout(e,t){let o=this._getTopSnapValue(),n=this._getCenterYSnapValue(),r=this._getCenterXSnapValue();e=Math.max(0,Math.min(e,this._container.clientHeight-this._quickInputContainer.clientHeight)),e<this._layoutService.activeContainerOffset.top&&(this._controlsOnLeft?t=Math.max(t,80/Zv(Ki())):this._controlsOnRight&&(t=Math.min(t,this._container.clientWidth-this._quickInputContainer.clientWidth-140/Zv(Ki()))));let s=Math.abs(e-o)<this._snapThreshold;e=s?o:e;let l=Math.abs(e-n)<this._snapThreshold;e=l?n:e;let c=e/this._container.clientHeight;t=Math.max(0,Math.min(t,this._container.clientWidth-this._quickInputContainer.clientWidth));let u=Math.abs(t-r)<this._snapThreshold;t=u?r:t;let p=this._container.clientWidth,h=this._quickInputContainer.clientWidth,f=(t+h/2)/p;if(this.dndViewState.set({top:c,left:f,done:!1},void 0),u){if(s){this._quickInputAlignmentContext.set("top");return}else if(l){this._quickInputAlignmentContext.set("center");return}}this._quickInputAlignmentContext.set(void 0)}_getTopSnapValue(){return this._layoutService.activeContainerOffset.quickPickTop}_getCenterYSnapValue(){return Math.round(this._container.clientHeight*this._snapLineHorizontalRatio)}_getCenterXSnapValue(){return Math.round(this._container.clientWidth/2)-Math.round(this._quickInputContainer.clientWidth/2)}};net=I([m(4,Kl),m(5,X),m(6,B)],net);var dMe=class extends yu{constructor(e,t,o,n,r){super(o);this.instantiationService=e;this.contextKeyService=t;this.layoutService=n;this.configurationService=r;this._onShow=this._register(new E);this.onShow=this._onShow.event;this._onHide=this._register(new E);this.onHide=this._onHide.event;this.contexts=new Map}get backButton(){return this.controller.backButton}get controller(){return this._controller||(this._controller=this._register(this.createController())),this._controller}get hasController(){return!!this._controller}get currentQuickInput(){return this.controller.currentQuickInput}get quickAccess(){return this._quickAccess||(this._quickAccess=this._register(this.instantiationService.createInstance(sMe))),this._quickAccess}createController(e=this.layoutService,t){let o={idPrefix:"quickInput_",container:e.activeContainer,ignoreFocusOut:()=>!1,backKeybindingLabel:()=>{},setContextKey:r=>this.setContextKey(r),linkOpenerDelegate:r=>{this.instantiationService.invokeFunction(s=>{s.get(Je).open(r,{allowCommands:!0,fromUserGesture:!0})})},returnFocus:()=>e.focus(),styles:this.computeStyles(),hoverDelegate:this._register(this.instantiationService.createInstance(sLe))},n=this._register(this.instantiationService.createInstance(Dee,{...o,...t}));return n.layout(e.activeContainerDimension,e.activeContainerOffset.quickPickTop),this._register(e.onDidLayoutActiveContainer(r=>{Re(e.activeContainer)===Re(n.container)&&n.layout(r,e.activeContainerOffset.quickPickTop)})),this._register(e.onDidChangeActiveContainer(()=>{n.isVisible()||n.layout(e.activeContainerDimension,e.activeContainerOffset.quickPickTop)})),this._register(n.onShow(()=>{this.resetContextKeys(),this._onShow.fire()})),this._register(n.onHide(()=>{this.resetContextKeys(),this._onHide.fire()})),n}setContextKey(e){let t;e&&(t=this.contexts.get(e),t||(t=new Y(e,!1).bindTo(this.contextKeyService),this.contexts.set(e,t))),!(t&&t.get())&&(this.resetContextKeys(),t?.set(!0))}resetContextKeys(){this.contexts.forEach(e=>{e.get()&&e.reset()})}pick(e,t,o=Se.None){return this.controller.pick(e,t,o)}input(e={},t=Se.None){return this.controller.input(e,t)}createQuickPick(e={useSeparators:!1}){return this.controller.createQuickPick(e)}createInputBox(){return this.controller.createInputBox()}createQuickWidget(){return this.controller.createQuickWidget()}createQuickTree(){return this.controller.createQuickTree()}focus(){this.controller.focus()}toggle(){this.controller.toggle()}navigate(e,t){this.controller.navigate(e,t)}accept(e){return this.controller.accept(e)}back(){return this.controller.back()}cancel(e){return this.controller.cancel(e)}setAlignment(e){this.controller.setAlignment(e)}toggleHover(){this.hasController&&this.controller.toggleHover()}updateStyles(){this.hasController&&this.controller.applyStyles(this.computeStyles())}computeStyles(){return{widget:{quickInputBackground:kt(Gye),quickInputForeground:kt(Qvt),quickInputTitleBackground:kt(M4i),widgetBorder:kt(E_),widgetShadow:kt(kO)},inputBox:Cl,toggle:gh,countBadge:iI,button:Qo,progressBar:vw,keybindingLabel:Jx,list:uS({listBackground:Gye,listFocusBackground:Q1,listFocusForeground:j1,listInactiveFocusForeground:j1,listInactiveSelectionIconForeground:qye,listInactiveFocusBackground:Q1,listInactiveSelectionBackground:Q1,listInactiveSelectionForeground:j1,listFocusOutline:Ys,listInactiveFocusOutline:Ys,treeStickyScrollBackground:Gye}),pickerGroup:{pickerGroupBorder:kt(P4i),pickerGroupForeground:kt(Yvt)}}}};dMe=I([m(0,F),m(1,X),m(2,Le),m(3,Kl),m(4,B)],dMe);var ret=class extends dMe{constructor(e,t,o,n,r,s){super(t,n,r,s,e);this.keybindingService=o;this.inQuickInputContext=ilo.bindTo(this.contextKeyService);this.registerListeners()}registerListeners(){this._register(this.onShow(()=>this.inQuickInputContext.set(!0))),this._register(this.onHide(()=>this.inQuickInputContext.set(!1)))}createController(){return super.createController(this.layoutService,{ignoreFocusOut:()=>!this.configurationService.getValue("workbench.quickOpen.closeOnFocusLost"),backKeybindingLabel:()=>this.keybindingService.lookupKeybinding("workbench.action.quickInputBack")?.getLabel()||void 0})}};ret=I([m(0,B),m(1,F),m(2,_e),m(3,X),m(4,Le),m(5,Kl)],ret);Ee(Ue,ret,1);var SI=le("IUserDataSyncWorkbenchService");function Kv(a){switch(a){case"settings":return d(18308,null);case"keybindings":return d(18304,null);case"snippets":return d(18309,null);case"prompts":return d(18307,null);case"tasks":return d(18312,null);case"mcp":return d(18305,null);case"extensions":return d(18303,null);case"globalState":return d(18313,null);case"profiles":return d(18306,null);case"workspaceState":return d(18314,null)}}var Mh=L(18310,"Settings Sync"),buo=Ae("settings-sync-view-icon",R.sync,d(18311,null)),Ly=new Y("syncStatus","uninitialized"),HD=new Y("syncEnabled",!1),LH=new Y("userDataSyncAccountStatus","uninitialized"),Lme=new Y("enableSyncActivityViews",!1),wBt=new Y("enableSyncConflictsView",!1),Lee=new Y("hasConflicts",!1),set="workbench.userDataSync.actions.configure",B0="workbench.userDataSync.actions.showLog",RH="workbench.view.sync",Ree="workbench.views.sync.conflicts",CBt={id:"workbench.userDataSync.actions.downloadSyncActivity",title:L(18302,"Download Settings Sync Activity"),category:Ve.Developer,f1:!0,precondition:C.and(LH.isEqualTo("available"),Ly.notEqualsTo("uninitialized"))};var Suo="configurationSync.store",wxi="sync.previous.store",Cxi="sync.donot-make-requests-until",xBt="sync.user-session-id",xxi="sync.machine-session-id",uYo=100,pYo=1e3*60*5,Rme=class extends x{constructor(e,t,o){super();this.productService=e;this.configurationService=t;this.storageService=o;this._onDidChangeUserDataSyncStore=this._register(new E);this.onDidChangeUserDataSyncStore=this._onDidChangeUserDataSyncStore.event;this.updateUserDataSyncStore();let n=this._register(new N);this._register(U.filter(o.onDidChangeValue(-1,_H,n),()=>this.userDataSyncStoreType!==this.userDataSyncStore?.type,n)(()=>this.updateUserDataSyncStore()))}get userDataSyncStore(){return this._userDataSyncStore}get userDataSyncStoreType(){return this.storageService.get(_H,-1)}set userDataSyncStoreType(e){this.storageService.store(_H,e,-1,Wt?0:1)}updateUserDataSyncStore(){this._userDataSyncStore=this.toUserDataSyncStore(this.productService[Suo]),this._onDidChangeUserDataSyncStore.fire()}toUserDataSyncStore(e){if(e&&(e=Wt&&e.web?{...e,...e.web}:e,Fe(e.url)&&xi(e.authenticationProviders)&&Object.keys(e.authenticationProviders).every(t=>Array.isArray(e.authenticationProviders[t].scopes)))){let t=e,o=!!t.canSwitch,n=t.url===t.insidersUrl?"insiders":"stable",r=(o?this.userDataSyncStoreType:void 0)||n,s=r==="insiders"?t.insidersUrl:r==="stable"?t.stableUrl:t.url;return{url:A.parse(s),type:r,defaultType:n,defaultUrl:A.parse(t.url),stableUrl:A.parse(t.stableUrl),insidersUrl:A.parse(t.insidersUrl),canSwitch:o,authenticationProviders:Object.keys(t.authenticationProviders).reduce((l,c)=>(l.push({id:c,scopes:t.authenticationProviders[c].scopes}),l),[])}}}};Rme=I([m(0,tt),m(1,B),m(2,ce)],Rme);var kBt=class extends Rme{constructor(i,e,t){super(i,e,t);let o=this.storageService.get(wxi,-1);o&&(this.previousConfigurationSyncStore=JSON.parse(o));let n=this.productService[Suo];n?this.storageService.store(wxi,JSON.stringify(n),-1,1):this.storageService.remove(wxi,-1)}async switch(i){i!==this.userDataSyncStoreType&&(this.userDataSyncStoreType=i,this.updateUserDataSyncStore())}async getPreviousUserDataSyncStore(){return this.toUserDataSyncStore(this.previousConfigurationSyncStore)}};kBt=I([m(0,tt),m(1,B),m(2,ce)],kBt);var MH=class extends x{constructor(e,t,o,n,r,s,l){super();this.requestService=o;this.logService=n;this.storageService=l;this._onTokenFailed=this._register(new E);this.onTokenFailed=this._onTokenFailed.event;this._onTokenSucceed=this._register(new E);this.onTokenSucceed=this._onTokenSucceed.event;this._donotMakeRequestsUntil=void 0;this._onDidChangeDonotMakeRequestsUntil=this._register(new E);this.onDidChangeDonotMakeRequestsUntil=this._onDidChangeDonotMakeRequestsUntil.event;this.resetDonotMakeRequestsUntilPromise=void 0;this.updateUserDataSyncStoreUrl(e),this.commonHeadersPromise=IF(r,s,l).then(c=>{let u={"X-Client-Name":`${t.applicationName}${Wt?"-web":""}`,"X-Client-Version":t.version};return t.commit&&(u["X-Client-Commit"]=t.commit),u}),this.session=new kxi(uYo,pYo,this.requestService,this.logService),this.initDonotMakeRequestsUntil(),this._register(Z(()=>{this.resetDonotMakeRequestsUntilPromise&&(this.resetDonotMakeRequestsUntilPromise.cancel(),this.resetDonotMakeRequestsUntilPromise=void 0)}))}get donotMakeRequestsUntil(){return this._donotMakeRequestsUntil}setAuthToken(e,t){this.authToken={token:e,type:t}}updateUserDataSyncStoreUrl(e){this.userDataSyncStoreUrl=e?Ge(e,"v1"):void 0}initDonotMakeRequestsUntil(){let e=this.storageService.getNumber(Cxi,-1);e&&Date.now()<e&&this.setDonotMakeRequestsUntil(new Date(e))}setDonotMakeRequestsUntil(e){this._donotMakeRequestsUntil?.getTime()!==e?.getTime()&&(this._donotMakeRequestsUntil=e,this.resetDonotMakeRequestsUntilPromise&&(this.resetDonotMakeRequestsUntilPromise.cancel(),this.resetDonotMakeRequestsUntilPromise=void 0),this._donotMakeRequestsUntil?(this.storageService.store(Cxi,this._donotMakeRequestsUntil.getTime(),-1,1),this.resetDonotMakeRequestsUntilPromise=Ln(t=>Li(this._donotMakeRequestsUntil.getTime()-Date.now(),t).then(()=>this.setDonotMakeRequestsUntil(void 0))),this.resetDonotMakeRequestsUntilPromise.then(null,t=>null)):this.storageService.remove(Cxi,-1),this._onDidChangeDonotMakeRequestsUntil.fire())}async getAllCollections(e={}){if(!this.userDataSyncStoreUrl)throw new Error("No settings sync store url configured.");let t=Ge(this.userDataSyncStoreUrl,"collection").toString();e={...e},e["Content-Type"]="application/json";let o=await this.request(t,{type:"GET",headers:e,callSite:"userDataSync.getAllCollections"},[],Se.None);return(await If(o))?.map(({id:n})=>n)||[]}async createCollection(e={}){if(!this.userDataSyncStoreUrl)throw new Error("No settings sync store url configured.");let t=Ge(this.userDataSyncStoreUrl,"collection").toString();e={...e},e["Content-Type"]=tr.text;let o=await this.request(t,{type:"POST",headers:e,callSite:"userDataSync.createCollection"},[],Se.None),n=await _w(o);if(!n)throw new Fm("Server did not return the collection id",t,"NoCollection",o.res.statusCode,o.res.headers[TH]);return n}async deleteCollection(e,t={}){if(!this.userDataSyncStoreUrl)throw new Error("No settings sync store url configured.");let o=e?Ge(this.userDataSyncStoreUrl,"collection",e).toString():Ge(this.userDataSyncStoreUrl,"collection").toString();t={...t},await this.request(o,{type:"DELETE",headers:t,callSite:"userDataSync.deleteCollection"},[],Se.None)}async getAllResourceRefs(e,t){if(!this.userDataSyncStoreUrl)throw new Error("No settings sync store url configured.");let o=this.getResourceUrl(this.userDataSyncStoreUrl,t,e),n={},r=await this.request(o.toString(),{type:"GET",headers:n,callSite:"userDataSync.getAllResourceRefs"},[],Se.None);return(await If(r)||[]).map(({url:l,created:c})=>({ref:Wd(o,o.with({path:l})),created:c*1e3}))}async resolveResourceContent(e,t,o,n={}){if(!this.userDataSyncStoreUrl)throw new Error("No settings sync store url configured.");let r=Ge(this.getResourceUrl(this.userDataSyncStoreUrl,o,e),t).toString();n={...n},n["Cache-Control"]="no-cache";let s=await this.request(r,{type:"GET",headers:n,callSite:"userDataSync.resolveResourceContent"},[],Se.None);return await _w(s)}async deleteResource(e,t,o){if(!this.userDataSyncStoreUrl)throw new Error("No settings sync store url configured.");let n=t!==null?Ge(this.getResourceUrl(this.userDataSyncStoreUrl,o,e),t).toString():this.getResourceUrl(this.userDataSyncStoreUrl,o,e).toString(),r={};await this.request(n,{type:"DELETE",headers:r,callSite:"userDataSync.deleteResource"},[],Se.None)}async deleteResources(){if(!this.userDataSyncStoreUrl)throw new Error("No settings sync store url configured.");let e=Ge(this.userDataSyncStoreUrl,"resource").toString(),t={"Content-Type":tr.text};await this.request(e,{type:"DELETE",headers:t,callSite:"userDataSync.deleteResources"},[],Se.None)}async readResource(e,t,o,n={}){if(!this.userDataSyncStoreUrl)throw new Error("No settings sync store url configured.");let r=Ge(this.getResourceUrl(this.userDataSyncStoreUrl,o,e),"latest").toString();n={...n},n["Cache-Control"]="no-cache",t&&(n["If-None-Match"]=t.ref);let s=await this.request(r,{type:"GET",headers:n,callSite:"userDataSync.readResource"},[304],Se.None),l=null;if(s.res.statusCode===304&&(l=t),l===null){let c=s.res.headers.etag;if(!c)throw new Fm("Server did not return the ref",r,"NoRef",s.res.statusCode,s.res.headers[TH]);let u=await _w(s);if(!u&&s.res.statusCode===304)throw new Fm("Empty response",r,"EmptyResponse",s.res.statusCode,s.res.headers[TH]);l={ref:c,content:u}}return l}async writeResource(e,t,o,n,r={}){if(!this.userDataSyncStoreUrl)throw new Error("No settings sync store url configured.");let s=this.getResourceUrl(this.userDataSyncStoreUrl,n,e).toString();r={...r},r["Content-Type"]=tr.text,o&&(r["If-Match"]=o);let l=await this.request(s,{type:"POST",data:t,headers:r,callSite:"userDataSync.writeResource"},[],Se.None),c=l.res.headers.etag;if(!c)throw new Fm("Server did not return the ref",s,"NoRef",l.res.statusCode,l.res.headers[TH]);return c}async manifest(e,t={}){if(!this.userDataSyncStoreUrl)throw new Error("No settings sync store url configured.");let o=Ge(this.userDataSyncStoreUrl,"manifest").toString();t={...t},t["Content-Type"]="application/json",e&&(t["If-None-Match"]=e.ref);let n=await this.request(o,{type:"GET",headers:t,callSite:"userDataSync.manifest"},[304],Se.None),r=null;if(n.res.statusCode===304&&(r=e),!r){let l=n.res.headers.etag;if(!l)throw new Fm("Server did not return the ref",o,"NoRef",n.res.statusCode,n.res.headers[TH]);let c=await _w(n);if(!c&&n.res.statusCode===304)throw new Fm("Empty response",o,"EmptyResponse",n.res.statusCode,n.res.headers[TH]);c&&(r={...JSON.parse(c),ref:l})}let s=this.storageService.get(xBt,-1);return s&&r&&s!==r.session&&this.clearSession(),r===null&&s&&this.clearSession(),r&&this.storageService.store(xBt,r.session,-1,1),r}async clear(){if(!this.userDataSyncStoreUrl)throw new Error("No settings sync store url configured.");await this.deleteCollection(),await this.deleteResources(),this.clearSession()}async getLatestData(e={}){if(!this.userDataSyncStoreUrl)throw new Error("No settings sync store url configured.");let t=Ge(this.userDataSyncStoreUrl,"download","latest").toString();e={...e},e["Content-Type"]="application/json";let o=await this.request(t,{type:"GET",headers:e,callSite:"userDataSync.getLatestData"},[],Se.None);if(!ZP(o))throw new Fm("Server returned "+o.res.statusCode,t,"EmptyResponse",o.res.statusCode,o.res.headers[TH]);let n=await If(o);if(!n)return null;let r={};if(n.resources){r.resources={};for(let s in n.resources){let[l]=n.resources[s];r.resources[s]={content:l.content,ref:l.ref}}}if(n.collections){r.collections={};for(let s in n.collections){let l={};r.collections[s]={resources:l};for(let c in n.collections[s].resources){let[u]=n.collections[s].resources[c];l[c]={content:u.content,ref:u.ref}}}}return r}async getActivityData(){if(!this.userDataSyncStoreUrl)throw new Error("No settings sync store url configured.");let e=Ge(this.userDataSyncStoreUrl,"download").toString(),t={},o=await this.request(e,{type:"GET",headers:t,callSite:"userDataSync.getActivityData"},[],Se.None);if(!ZP(o))throw new Fm("Server returned "+o.res.statusCode,e,"EmptyResponse",o.res.statusCode,o.res.headers[TH]);if(RDt(o))throw new Fm("Empty response",e,"EmptyResponse",o.res.statusCode,o.res.headers[TH]);return o.stream}getResourceUrl(e,t,o){return t?Ge(e,"collection",t,"resource",o):Ge(e,"resource",o)}clearSession(){this.storageService.remove(xBt,-1),this.storageService.remove(xxi,-1)}async request(e,t,o,n){if(!this.authToken)throw new Fm("No Auth Token Available",e,"Unauthorized",void 0,void 0);if(this._donotMakeRequestsUntil&&Date.now()<this._donotMakeRequestsUntil.getTime())throw new Fm(`${t.type} request '${e}' failed because of too many requests (429).`,e,"TooManyRequestsAndRetryAfter",void 0,void 0);this.setDonotMakeRequestsUntil(void 0);let r=await this.commonHeadersPromise;t.headers={...t.headers||{},...r,"X-Account-Type":this.authToken.type,authorization:`Bearer ${this.authToken.token}`},this.addSessionHeaders(t.headers),this.logService.trace("Sending request to server",{url:e,type:t.type,headers:{...t.headers,authorization:void 0}});let s;try{s=await this.session.request(e,t,n)}catch(h){if(!(h instanceof Fm)){let g="RequestFailed",f=Pn(h).toLowerCase();f.includes("xhr timeout")?g="RequestTimeout":f.includes("protocol")&&f.includes("not supported")?g="RequestProtocolNotSupported":f.includes("request path contains unescaped characters")?g="RequestPathNotEscaped":f.includes("headers must be an object")?g="RequestHeadersNotObject":ao(h)&&(g="RequestCanceled"),h=new Fm(`Connection refused for the request '${e}'.`,e,g,void 0,void 0)}throw this.logService.info("Request failed",e),h}let l=s.res.headers[TH],c={url:e,status:s.res.statusCode,"execution-id":t.headers[txi],"operation-id":l},u=ZP(s)||s.res.statusCode&&o.includes(s.res.statusCode),p="";if(u?this.logService.trace("Request succeeded",c):(p=await tD(s)||"",this.logService.info("Request failed",c,p)),s.res.statusCode===401||s.res.statusCode===403){if(this.authToken=void 0,s.res.statusCode===401)throw this._onTokenFailed.fire("Unauthorized"),new Fm(`${t.type} request '${e}' failed because of Unauthorized (401).`,e,"Unauthorized",s.res.statusCode,l);if(s.res.statusCode===403)throw this._onTokenFailed.fire("Forbidden"),new Fm(`${t.type} request '${e}' failed because the access is forbidden (403).`,e,"Forbidden",s.res.statusCode,l)}if(this._onTokenSucceed.fire(),s.res.statusCode===404)throw new Fm(`${t.type} request '${e}' failed because the requested resource is not found (404).`,e,"NotFound",s.res.statusCode,l);if(s.res.statusCode===405)throw new Fm(`${t.type} request '${e}' failed because the requested endpoint is not found (405). ${p}`,e,"MethodNotFound",s.res.statusCode,l);if(s.res.statusCode===409)throw new Fm(`${t.type} request '${e}' failed because of Conflict (409). There is new data for this resource. Make the request again with latest data.`,e,"Conflict",s.res.statusCode,l);if(s.res.statusCode===410)throw new Fm(`${t.type} request '${e}' failed because the requested resource is not longer available (410).`,e,"Gone",s.res.statusCode,l);if(s.res.statusCode===412)throw new Fm(`${t.type} request '${e}' failed because of Precondition Failed (412). There is new data for this resource. Make the request again with latest data.`,e,"PreconditionFailed",s.res.statusCode,l);if(s.res.statusCode===413)throw new Fm(`${t.type} request '${e}' failed because of too large payload (413).`,e,"TooLarge",s.res.statusCode,l);if(s.res.statusCode===426)throw new Fm(`${t.type} request '${e}' failed with status Upgrade Required (426). Please upgrade the client and try again.`,e,"UpgradeRequired",s.res.statusCode,l);if(s.res.statusCode===429){let h=s.res.headers["retry-after"];throw h?(this.setDonotMakeRequestsUntil(new Date(Date.now()+parseInt(h)*1e3)),new Fm(`${t.type} request '${e}' failed because of too many requests (429).`,e,"TooManyRequestsAndRetryAfter",s.res.statusCode,l)):new Fm(`${t.type} request '${e}' failed because of too many requests (429).`,e,"RemoteTooManyRequests",s.res.statusCode,l)}if(!u)throw new Fm("Server returned "+s.res.statusCode,e,"Unknown",s.res.statusCode,l);return s}addSessionHeaders(e){let t=this.storageService.get(xxi,-1);t===void 0&&(t=xt(),this.storageService.store(xxi,t,-1,1)),e["X-Machine-Session-Id"]=t;let o=this.storageService.get(xBt,-1);o!==void 0&&(e["X-User-Session-Id"]=o)}};MH=I([m(1,tt),m(2,Ea),m(3,Dy),m(4,Eo),m(5,fe),m(6,ce)],MH);var EBt=class extends MH{constructor(i,e,t,o,n,r,s){super(i.userDataSyncStore?.url,e,t,o,n,r,s),this._register(i.onDidChangeUserDataSyncStore(()=>this.updateUserDataSyncStoreUrl(i.userDataSyncStore?.url)))}};EBt=I([m(0,pM),m(1,tt),m(2,Ea),m(3,Dy),m(4,Eo),m(5,fe),m(6,ce)],EBt);var kxi=class{constructor(i,e,t,o){this.limit=i;this.interval=e;this.requestService=t;this.logService=o;this.requests=[];this.startTime=void 0}request(i,e,t){if(this.isExpired()&&this.reset(),e.url=i,this.requests.length>=this.limit)throw this.logService.info("Too many requests",...this.requests),new Fm(`Too many requests. Only ${this.limit} requests allowed in ${this.interval/(1e3*60)} minutes.`,i,"LocalTooManyRequests",void 0,void 0);return this.startTime=this.startTime||new Date,this.requests.push(i),this.requestService.request(e,t)}isExpired(){return this.startTime!==void 0&&new Date().getTime()-this.startTime.getTime()>this.interval}reset(){this.requests=[],this.startTime=void 0}};function hYo(a){return!!(a&&a.ref!==void 0&&typeof a.ref=="string"&&a.ref!==""&&a.syncData!==void 0&&(a.syncData===null||cet(a.syncData)))}function cet(a){return!!(a&&a.version!==void 0&&typeof a.version=="number"&&a.content!==void 0&&typeof a.content=="string"&&(Object.keys(a).length===2||Object.keys(a).length===3&&a.machineId!==void 0&&typeof a.machineId=="string"))}function uMe(a,i){return`${Qse(a)}${i.isDefault?"":` (${i.name})`}`}var PH=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this.syncResource=e;this.collection=t;this.fileService=o;this.environmentService=n;this.storageService=r;this.userDataSyncStoreService=s;this.userDataSyncLocalStoreService=l;this.userDataSyncEnablementService=c;this.telemetryService=u;this.logService=p;this.configurationService=h;this.syncPreviewPromise=null;this._status="idle";this._onDidChangStatus=this._register(new E);this.onDidChangeStatus=this._onDidChangStatus.event;this._conflicts=[];this._onDidChangeConflicts=this._register(new E);this.onDidChangeConflicts=this._onDidChangeConflicts.event;this.localChangeTriggerThrottler=this._register(new ya(50));this._onDidChangeLocal=this._register(new E);this.onDidChangeLocal=this._onDidChangeLocal.event;this.hasSyncResourceStateVersionChanged=!1;this.syncHeaders={};this.lastSyncUserDataStateKey=`${t?`${t}.`:""}${e.syncResource}.lastSyncUserData`,this.resource=e.syncResource,this.syncResourceLogLabel=uMe(e.syncResource,e.profile),this.extUri=g.extUri,this.syncFolder=this.extUri.joinPath(n.userDataSyncHome,...exi(e.profile.isDefault?void 0:e.profile.id,e.syncResource)),this.syncPreviewFolder=this.extUri.joinPath(this.syncFolder,duo),this.lastSyncResource=NZe(e.profile.isDefault?void 0:e.profile.id,e.syncResource,n,this.extUri),this.currentMachineIdPromise=IF(n,o,r)}get status(){return this._status}get conflicts(){return{...this.syncResource,conflicts:this._conflicts}}triggerLocalChange(){this.localChangeTriggerThrottler.trigger(()=>this.doTriggerLocalChange())}async doTriggerLocalChange(){if(this.status==="hasConflicts"){this.logService.info(`${this.syncResourceLogLabel}: In conflicts state and local change detected. Syncing again...`);let e=await this.syncPreviewPromise;this.syncPreviewPromise=null;let t=await this.performSync(e.remoteUserData,e.lastSyncUserData,"merge",this.getUserDataSyncConfiguration());this.setStatus(t)}else{this.logService.trace(`${this.syncResourceLogLabel}: Checking for local changes...`);let e=await this.getLastSyncUserData();(!e||await this.hasRemoteChanged(e))&&this._onDidChangeLocal.fire()}}setStatus(e){this._status!==e&&(this._status=e,this._onDidChangStatus.fire(e))}async sync(e,t=!1,o=this.getUserDataSyncConfiguration(),n={}){try{if(this.syncHeaders={...n},this.status==="hasConflicts")return this.logService.info(`${this.syncResourceLogLabel}: Skipped synchronizing ${this.resource.toLowerCase()} as there are conflicts.`),this.syncPreviewPromise;if(this.status==="syncing")return this.logService.info(`${this.syncResourceLogLabel}: Skipped synchronizing ${this.resource.toLowerCase()} as it is running already.`),this.syncPreviewPromise;this.logService.trace(`${this.syncResourceLogLabel}: Started synchronizing ${this.resource.toLowerCase()}...`),this.setStatus("syncing");let r="idle";try{let s=await this.getLastSyncUserData(),l=await this.getLatestRemoteUserData(e,s);return r=await this.performSync(l,s,t?"preview":"merge",o),r==="hasConflicts"?this.logService.info(`${this.syncResourceLogLabel}: Detected conflicts while synchronizing ${this.resource.toLowerCase()}.`):r==="idle"&&this.logService.trace(`${this.syncResourceLogLabel}: Finished synchronizing ${this.resource.toLowerCase()}.`),this.syncPreviewPromise||null}finally{this.setStatus(r)}}finally{this.syncHeaders={}}}async apply(e,t={}){try{this.syncHeaders={...t};let o=await this.doApply(e);return this.setStatus(o),this.syncPreviewPromise}finally{this.syncHeaders={}}}async replace(e){let t=this.parseSyncData(e);if(!t)return!1;await this.stop();try{this.logService.trace(`${this.syncResourceLogLabel}: Started resetting ${this.resource.toLowerCase()}...`),this.setStatus("syncing");let o=await this.getLastSyncUserData(),n=await this.getLatestRemoteUserData(null,o),r=await this.isRemoteDataFromCurrentMachine(n),s=await this.generateSyncPreview({ref:n.ref,syncData:t},o,r,this.getUserDataSyncConfiguration(),Se.None),l=[];for(let c of s){let u=await this.getAcceptResult(c,c.remoteResource,void 0,Se.None),{remoteChange:p}=await this.getAcceptResult(c,c.previewResource,c.remoteContent,Se.None);l.push([c,{...u,remoteChange:p!==0?p:2}])}await this.applyResult(n,o,l,!1),this.logService.info(`${this.syncResourceLogLabel}: Finished resetting ${this.resource.toLowerCase()}.`)}finally{this.setStatus("idle")}return!0}async isRemoteDataFromCurrentMachine(e){let t=await this.currentMachineIdPromise;return!!e.syncData?.machineId&&e.syncData.machineId===t}async getLatestRemoteUserData(e,t){return e===null?{ref:luo,syncData:null}:Fe(e)?t?.ref===e?t:this.getRemoteUserData(t):this.toRemoteUserData(e)}async performSync(e,t,o,n){if(e.syncData&&e.syncData.version>this.version)throw new Vg(d(2761,null,this.resource,this.version,e.syncData.version),"IncompatibleLocalContent",this.resource);try{return await this.doSync(e,t,o,n)}catch(r){if(r instanceof Vg)switch(r.code){case"LocalPreconditionFailed":return this.logService.info(`${this.syncResourceLogLabel}: Failed to synchronize ${this.syncResourceLogLabel} as there is a new local version available. Synchronizing again...`),this.performSync(e,t,o,n);case"Conflict":case"PreconditionFailed":return this.logService.info(`${this.syncResourceLogLabel}: Failed to synchronize as there is a new remote version available. Synchronizing again...`),e=await this.getRemoteUserData(null),t=await this.getLastSyncUserData(),this.performSync(e,t,"merge",n)}throw r}}async doSync(e,t,o,n){try{let r=await this.isRemoteDataFromCurrentMachine(e),s=!r&&t===null&&this.getStoredLastSyncUserDataStateContent()!==void 0,l=o==="preview"||o==="merge"&&!s,c=o==="merge"||o==="pull-push";this.syncPreviewPromise||(this.syncPreviewPromise=Ln(p=>this.doGenerateSyncResourcePreview(e,t,r,l,n,p)));let u=await this.syncPreviewPromise;if(o==="merge"&&s){this.logService.info(`${this.syncResourceLogLabel}: Accepting remote because it was synced before and the last sync data is not available.`);for(let p of u.resourcePreviews)u=await this.accept(p.remoteResource)||u}else if(o==="pull-push")for(let p of u.resourcePreviews)p.mergeState!=="accepted"&&(e.ref===t?.ref||r?u=await this.accept(p.localResource)??u:u=await this.accept(p.remoteResource)??u);return this.updateConflicts(u.resourcePreviews),u.resourcePreviews.some(({mergeState:p})=>p==="conflict")?"hasConflicts":c?await this.doApply(!1):"syncing"}catch(r){throw this.syncPreviewPromise=null,r}}async accept(e,t){return await this.updateSyncResourcePreview(e,async o=>{let n=await this.getAcceptResult(o,e,t,Se.None);return o.acceptResult=n,o.mergeState="accepted",o.localChange=n.localChange,o.remoteChange=n.remoteChange,o}),this.syncPreviewPromise}async discard(e){return await this.updateSyncResourcePreview(e,async t=>{let o=await this.getMergeResult(t,Se.None);return await this.fileService.writeFile(t.previewResource,qe.fromString(o.content||"")),t.acceptResult=void 0,t.mergeState="preview",t.localChange=o.localChange,t.remoteChange=o.remoteChange,t}),this.syncPreviewPromise}async updateSyncResourcePreview(e,t){if(!this.syncPreviewPromise)return;let o=await this.syncPreviewPromise,n=o.resourcePreviews.findIndex(({localResource:r,remoteResource:s,previewResource:l})=>this.extUri.isEqual(r,e)||this.extUri.isEqual(s,e)||this.extUri.isEqual(l,e));n!==-1&&(this.syncPreviewPromise=Ln(async r=>{let s=[...o.resourcePreviews];return s[n]=await t(s[n]),{...o,resourcePreviews:s}}),o=await this.syncPreviewPromise,this.updateConflicts(o.resourcePreviews),o.resourcePreviews.some(({mergeState:r})=>r==="conflict")?this.setStatus("hasConflicts"):this.setStatus("syncing"))}async doApply(e){if(!this.syncPreviewPromise)return"idle";let t=await this.syncPreviewPromise;return t.resourcePreviews.some(({mergeState:o})=>o==="conflict")?"hasConflicts":t.resourcePreviews.some(({mergeState:o})=>o!=="accepted")?"syncing":(await this.applyResult(t.remoteUserData,t.lastSyncUserData,t.resourcePreviews.map(o=>[o,o.acceptResult]),e),this.syncPreviewPromise=null,await this.clearPreviewFolder(),"idle")}async clearPreviewFolder(){try{await this.fileService.del(this.syncPreviewFolder,{recursive:!0})}catch{}}updateConflicts(e){let t=e.filter(({mergeState:o})=>o==="conflict");$i(this._conflicts,t,(o,n)=>this.extUri.isEqual(o.previewResource,n.previewResource))||(this._conflicts=t,this._onDidChangeConflicts.fire(this.conflicts))}async hasPreviouslySynced(){let e=await this.getLastSyncUserData();return!!e&&e.syncData!==null}async resolvePreviewContent(e){let t=this.syncPreviewPromise?await this.syncPreviewPromise:null;if(t)for(let o of t.resourcePreviews){if(this.extUri.isEqual(o.acceptedResource,e))return o.acceptResult?o.acceptResult.content:null;if(this.extUri.isEqual(o.remoteResource,e))return o.remoteContent;if(this.extUri.isEqual(o.localResource,e))return o.localContent;if(this.extUri.isEqual(o.baseResource,e))return o.baseContent}return null}async resetLocal(){this.storageService.remove(this.lastSyncUserDataStateKey,-1);try{await this.fileService.del(this.lastSyncResource)}catch(e){Au(e)!==1&&this.logService.error(e)}}async doGenerateSyncResourcePreview(e,t,o,n,r,s){let l=await this.generateSyncPreview(e,t,o,r,s),c=[];for(let u of l){let p=u.previewResource.with({scheme:gx,authority:"accepted"});if(u.localChange===0&&u.remoteChange===0)c.push({...u,acceptedResource:p,acceptResult:{content:null,localChange:0,remoteChange:0},mergeState:"accepted"});else{let h=n?await this.getMergeResult(u,s):void 0;if(s.isCancellationRequested)break;await this.fileService.writeFile(u.previewResource,qe.fromString(h?.content||""));let g=h&&!h.hasConflicts?await this.getAcceptResult(u,u.previewResource,void 0,s):void 0;c.push({...u,acceptResult:g,mergeState:h?.hasConflicts?"conflict":g?"accepted":"preview",localChange:g?g.localChange:h?h.localChange:u.localChange,remoteChange:g?g.remoteChange:h?h.remoteChange:u.remoteChange})}}return{syncResource:this.resource,profile:this.syncResource.profile,remoteUserData:e,lastSyncUserData:t,resourcePreviews:c,isLastSyncFromCurrentMachine:o}}async getLastSyncUserData(){let e=this.getStoredLastSyncUserDataStateContent();if(!e)return this.logService.info(`${this.syncResourceLogLabel}: Last sync data state does not exist.`),null;let t=JSON.parse(e),o=this.userDataSyncEnablementService.getResourceSyncStateVersion(this.resource);if(this.hasSyncResourceStateVersionChanged=!!t.version&&!!o&&t.version!==o,this.hasSyncResourceStateVersionChanged)return this.logService.info(`${this.syncResourceLogLabel}: Reset last sync state because last sync state version ${t.version} is not compatible with current sync state version ${o}.`),await this.resetLocal(),null;let n,r=1;for(;n===void 0&&r++<6;)try{let s=await this.readLastSyncStoredRemoteUserData();s&&(s.ref===t.ref?n=s.syncData:this.logService.info(`${this.syncResourceLogLabel}: Last sync data stored locally is not same as the last sync state.`));break}catch(s){if(s instanceof ta&&s.fileOperationResult===1){this.logService.info(`${this.syncResourceLogLabel}: Last sync resource does not exist locally.`);break}else{if(s instanceof Vg)throw s;this.logService.error(s,r)}}if(n===void 0)try{let s=await this.userDataSyncStoreService.resolveResourceContent(this.resource,t.ref,this.collection,this.syncHeaders);n=s===null?null:this.parseSyncData(s),await this.writeLastSyncStoredRemoteUserData({ref:t.ref,syncData:n})}catch(s){if(s instanceof Vg&&s.code==="NotFound")this.logService.info(`${this.syncResourceLogLabel}: Last sync resource does not exist remotely.`);else throw s}return n===void 0?null:{...t,syncData:n}}async updateLastSyncUserData(e,t={}){if(t.ref||t.version)throw new Error("Cannot have core properties as additional");let o=this.userDataSyncEnablementService.getResourceSyncStateVersion(this.resource),n={ref:e.ref,version:o,...t};this.storageService.store(this.lastSyncUserDataStateKey,JSON.stringify(n),-1,1),await this.writeLastSyncStoredRemoteUserData(e)}getStoredLastSyncUserDataStateContent(){return this.storageService.get(this.lastSyncUserDataStateKey,-1)}async readLastSyncStoredRemoteUserData(){let e=(await this.fileService.readFile(this.lastSyncResource)).value.toString();try{let t=e?JSON.parse(e):void 0;if(hYo(t))return t}catch(t){this.logService.error(t)}}async writeLastSyncStoredRemoteUserData(e){await this.fileService.writeFile(this.lastSyncResource,qe.fromString(JSON.stringify(e)))}async getRemoteUserData(e){let t=await this.getUserData(e);return this.toRemoteUserData(t)}toRemoteUserData({ref:e,content:t}){let o=null;return t!==null&&(o=this.parseSyncData(t)),{ref:e,syncData:o}}parseSyncData(e){try{let t=JSON.parse(e);if(cet(t))return t}catch(t){this.logService.error(t)}throw new Vg(d(2762,null),"IncompatibleRemoteContent",this.resource)}async getUserData(e){let t=e?{ref:e.ref,content:e.syncData?JSON.stringify(e.syncData):null}:null;return this.userDataSyncStoreService.readResource(this.resource,t,this.collection,this.syncHeaders)}async updateRemoteUserData(e,t){let o=await this.currentMachineIdPromise,n={version:this.version,machineId:o,content:e};try{return t=await this.userDataSyncStoreService.writeResource(this.resource,JSON.stringify(n),t,this.collection,this.syncHeaders),{ref:t,syncData:n}}catch(r){throw r instanceof Vg&&r.code==="TooLarge"&&(r=new Vg(r.message,r.code,this.resource)),r}}async backupLocal(e){let t={version:this.version,content:e};return this.userDataSyncLocalStoreService.writeResource(this.resource,JSON.stringify(t),new Date,this.syncResource.profile.isDefault?void 0:this.syncResource.profile.id)}async stop(){this.status!=="idle"&&(this.logService.trace(`${this.syncResourceLogLabel}: Stopping synchronizing ${this.resource.toLowerCase()}.`),this.syncPreviewPromise&&(this.syncPreviewPromise.cancel(),this.syncPreviewPromise=null),this.updateConflicts([]),await this.clearPreviewFolder(),this.setStatus("idle"),this.logService.info(`${this.syncResourceLogLabel}: Stopped synchronizing ${this.resource.toLowerCase()}.`))}getUserDataSyncConfiguration(){return this.configurationService.getValue(suo)}};PH=I([m(2,fe),m(3,Eo),m(4,ce),m(5,A0),m(6,yee),m(7,Fl),m(8,Te),m(9,Dy),m(10,B),m(11,ht)],PH);var aet=class extends PH{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super(t,o,n,r,s,l,c,u,p,h,g,f);this.file=e;this._register(this.fileService.watch(this.extUri.dirname(e))),this._register(this.fileService.onDidFilesChange(v=>this.onFileChanges(v)))}async getLocalFileContent(){try{return await this.fileService.readFile(this.file)}catch{return null}}async updateLocalFileContent(e,t,o){try{t?await this.fileService.writeFile(this.file,qe.fromString(e),o?void 0:t):await this.fileService.createFile(this.file,qe.fromString(e),{overwrite:o})}catch(n){throw n instanceof ta&&n.fileOperationResult===1||n instanceof ta&&n.fileOperationResult===3?new Vg(n.message,"LocalPreconditionFailed"):n}}async deleteLocalFile(){try{await this.fileService.del(this.file)}catch(e){if(!(e instanceof ta&&e.fileOperationResult===1))throw e}}onFileChanges(e){e.contains(this.file)&&this.triggerLocalChange()}};aet=I([m(3,fe),m(4,Eo),m(5,ce),m(6,A0),m(7,yee),m(8,Fl),m(9,Te),m(10,Dy),m(11,B),m(12,ht)],aet);var TBt=class extends aet{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super(e,t,o,n,r,s,l,c,u,p,h,f,v);this.userDataSyncUtilService=g;this._formattingOptions=void 0}hasErrors(e,t){let o=[],n=jr(e,o,{allowEmptyContent:!0,allowTrailingComma:!0});return o.length>0||!gn(n)&&t!==Array.isArray(n)}getFormattingOptions(){return this._formattingOptions||(this._formattingOptions=this.userDataSyncUtilService.resolveFormattingOptions(this.file)),this._formattingOptions}};TBt=I([m(3,fe),m(4,Eo),m(5,ce),m(6,A0),m(7,yee),m(8,Fl),m(9,Te),m(10,Dy),m(11,wee),m(12,B),m(13,ht)],TBt);var Mee=class{constructor(i,e,t,o,n,r,s){this.resource=i;this.userDataProfilesService=e;this.environmentService=t;this.logService=o;this.fileService=n;this.storageService=r;this.extUri=s.extUri,this.lastSyncResource=NZe(void 0,this.resource,t,this.extUri)}async initialize({ref:i,content:e}){if(!e){this.logService.info("Remote content does not exist.",this.resource);return}let t=this.parseSyncData(e);if(t)try{await this.doInitialize({ref:i,syncData:t})}catch(o){this.logService.error(o)}}parseSyncData(i){try{let e=JSON.parse(i);if(cet(e))return e}catch(e){this.logService.error(e)}this.logService.info("Cannot parse sync data as it is not compatible with the current version.",this.resource)}async updateLastSyncUserData(i,e={}){if(e.ref||e.version)throw new Error("Cannot have core properties as additional");let t={ref:i.ref,version:void 0,...e};this.storageService.store(`${this.resource}.lastSyncUserData`,JSON.stringify(t),-1,1),await this.fileService.writeFile(this.lastSyncResource,qe.fromString(JSON.stringify(i)))}};Mee=I([m(1,an),m(2,Eo),m(3,se),m(4,fe),m(5,ce),m(6,ht)],Mee);function det(a,i,e,t,o){if(!i)return{remote:{added:Object.keys(a),removed:[],updated:[],all:Object.keys(a).length>0?a:null},local:{added:{},removed:[],updated:{}}};let n=_Bt(a,i);if(n.added.size===0&&n.removed.size===0&&n.updated.size===0)return{remote:{added:[],removed:[],updated:[],all:null},local:{added:{},removed:[],updated:{}}};let r=e?_Bt(e,i):{added:Object.keys(i).reduce((h,g)=>(h.add(g),h),new Set),removed:new Set,updated:new Set},s=e?_Bt(e,a):{added:Object.keys(a).reduce((h,g)=>(h.add(g),h),new Set),removed:new Set,updated:new Set},l={added:{},removed:[],updated:{}},c=Ji(i),u=!e;for(let h of s.added.values())h!==_H&&u&&r.added.has(h)||(c[h]=a[h]);for(let h of s.updated.values())c[h]=a[h];for(let h of s.removed.values())t.unregistered.includes(h)||delete c[h];for(let h of r.added.values()){let g=i[h];if(t.machine.includes(h)){o.info(`GlobalState: Skipped adding ${h} in local storage because it is declared as machine scoped.`);continue}if(e&&s.added.has(h))continue;let f=a[h];f&&f.value===g.value||h===_H&&u&&s.added.has(h)||(f?l.updated[h]=g:l.added[h]=g)}for(let h of r.updated.values()){let g=i[h];if(t.machine.includes(h)){o.info(`GlobalState: Skipped updating ${h} in local storage because it is declared as machine scoped.`);continue}if(s.updated.has(h)||s.removed.has(h))continue;let f=a[h];f&&f.value===g.value||(l.updated[h]=g)}for(let h of r.removed.values()){if(t.machine.includes(h)){o.trace(`GlobalState: Skipped removing ${h} in local storage because it is declared as machine scoped.`);continue}s.updated.has(h)||s.removed.has(h)||l.removed.push(h)}let p=_Bt(i,c);return{local:l,remote:{added:[...p.added],updated:[...p.updated],removed:[...p.removed],all:p.added.size===0&&p.removed.size===0&&p.updated.size===0?null:c}}}function _Bt(a,i){let e=Object.keys(a),t=Object.keys(i),o=t.filter(s=>!e.includes(s)).reduce((s,l)=>(s.add(l),s),new Set),n=e.filter(s=>!t.includes(s)).reduce((s,l)=>(s.add(l),s),new Set),r=new Set;for(let s of e){if(n.has(s))continue;let l=a[s],c=i[s];eo(l,c)||r.add(s)}return{added:o,removed:n,updated:r}}var Mme="globalState.argv.",gYo=["locale"];function uet(a,i){let e=a.storage?Object.keys(a.storage).sort():[],t={};return e.forEach(o=>t[o]=a.storage[o]),a.storage=t,i?s0(a,{}):JSON.stringify(a)}var Txi=1,DBt=class extends PH{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super({syncResource:"globalState",profile:e},t,n,c,g,r,s,u,p,l,h,f);this.userDataProfileStorageService=o;this.version=Txi;this.previewResource=this.extUri.joinPath(this.syncPreviewFolder,"globalState.json");this.baseResource=this.previewResource.with({scheme:gx,authority:"base"});this.localResource=this.previewResource.with({scheme:gx,authority:"local"});this.remoteResource=this.previewResource.with({scheme:gx,authority:"remote"});this.acceptedResource=this.previewResource.with({scheme:gx,authority:"accepted"});this.localGlobalStateProvider=v.createInstance(pet),this._register(n.watch(this.extUri.dirname(this.environmentService.argvResource))),this._register(U.any(U.filter(n.onDidFilesChange,b=>b.contains(this.environmentService.argvResource)),U.filter(o.onDidChange,b=>!!(b.targetChanges.some(S=>this.syncResource.profile.id===S.id)||b.valueChanges.some(({profile:S,changes:y})=>this.syncResource.profile.id===S.id&&y.some(w=>w.target===0)))))((()=>this.triggerLocalChange())))}async generateSyncPreview(e,t,o){let n=e.syncData?JSON.parse(e.syncData.content):null;t=t===null&&o?e:t;let r=t&&t.syncData?JSON.parse(t.syncData.content):null,s=await this.localGlobalStateProvider.getLocalGlobalState(this.syncResource.profile);n?this.logService.trace(`${this.syncResourceLogLabel}: Merging remote ui state with local ui state...`):this.logService.trace(`${this.syncResourceLogLabel}: Remote ui state does not exist. Synchronizing ui state for the first time.`);let l=await this.getStorageKeys(r),{local:c,remote:u}=det(s.storage,n?n.storage:null,r?r.storage:null,l,this.logService),p={content:null,local:c,remote:u,localChange:Object.keys(c.added).length>0||Object.keys(c.updated).length>0||c.removed.length>0?2:0,remoteChange:u.all!==null?2:0},h=uet(s,!1);return[{baseResource:this.baseResource,baseContent:r?uet(r,!1):h,localResource:this.localResource,localContent:h,localUserData:s,remoteResource:this.remoteResource,remoteContent:n?uet(n,!1):null,previewResource:this.previewResource,previewResult:p,localChange:p.localChange,remoteChange:p.remoteChange,acceptedResource:this.acceptedResource,storageKeys:l}]}async hasRemoteChanged(e){let t=e.syncData?JSON.parse(e.syncData.content):null;if(t===null)return!0;let o=await this.localGlobalStateProvider.getLocalGlobalState(this.syncResource.profile),n=await this.getStorageKeys(t),{remote:r}=det(o.storage,t.storage,t.storage,n,this.logService);return r.all!==null}async getMergeResult(e,t){return{...e.previewResult,hasConflicts:!1}}async getAcceptResult(e,t,o,n){if(this.extUri.isEqual(t,this.localResource))return this.acceptLocal(e);if(this.extUri.isEqual(t,this.remoteResource))return this.acceptRemote(e);if(this.extUri.isEqual(t,this.previewResource))return e.previewResult;throw new Error(`Invalid Resource: ${t.toString()}`)}async acceptLocal(e){if(e.remoteContent!==null){let t=JSON.parse(e.remoteContent),{local:o,remote:n}=det(e.localUserData.storage,t.storage,t.storage,e.storageKeys,this.logService);return{content:e.remoteContent,local:o,remote:n,localChange:0,remoteChange:n.all!==null?2:0}}else return{content:e.localContent,local:{added:{},removed:[],updated:{}},remote:{added:Object.keys(e.localUserData.storage),removed:[],updated:[],all:e.localUserData.storage},localChange:0,remoteChange:2}}async acceptRemote(e){if(e.remoteContent!==null){let t=JSON.parse(e.remoteContent),{local:o,remote:n}=det(e.localUserData.storage,t.storage,e.localUserData.storage,e.storageKeys,this.logService);return{content:e.remoteContent,local:o,remote:n,localChange:Object.keys(o.added).length>0||Object.keys(o.updated).length>0||o.removed.length>0?2:0,remoteChange:0}}else return{content:e.remoteContent,local:{added:{},removed:[],updated:{}},remote:{added:[],removed:[],updated:[],all:null},localChange:0,remoteChange:0}}async applyResult(e,t,o,n){let{localUserData:r}=o[0][0],{local:s,remote:l,localChange:c,remoteChange:u}=o[0][1];if(c===0&&u===0&&this.logService.info(`${this.syncResourceLogLabel}: No changes found during synchronizing ui state.`),c!==0&&(this.logService.trace(`${this.syncResourceLogLabel}: Updating local ui state...`),await this.backupLocal(JSON.stringify(r)),await this.localGlobalStateProvider.writeLocalGlobalState(s,this.syncResource.profile),this.logService.info(`${this.syncResourceLogLabel}: Updated local ui state`)),u!==0){this.logService.trace(`${this.syncResourceLogLabel}: Updating remote ui state...`);let p=JSON.stringify({storage:l.all});e=await this.updateRemoteUserData(p,n?null:e.ref),this.logService.info(`${this.syncResourceLogLabel}: Updated remote ui state.${l.added.length?` Added: ${l.added}.`:""}${l.updated.length?` Updated: ${l.updated}.`:""}${l.removed.length?` Removed: ${l.removed}.`:""}`)}t?.ref!==e.ref&&(this.logService.trace(`${this.syncResourceLogLabel}: Updating last synchronized ui state...`),await this.updateLastSyncUserData(e),this.logService.info(`${this.syncResourceLogLabel}: Updated last synchronized ui state`))}async resolveContent(e){if(this.extUri.isEqual(this.remoteResource,e)||this.extUri.isEqual(this.baseResource,e)||this.extUri.isEqual(this.localResource,e)||this.extUri.isEqual(this.acceptedResource,e)){let t=await this.resolvePreviewContent(e);return t&&uet(JSON.parse(t),!0)}return null}async hasLocalData(){try{let{storage:e}=await this.localGlobalStateProvider.getLocalGlobalState(this.syncResource.profile);if(Object.keys(e).length>1||e[`${Mme}.locale`]?.value!=="en")return!0}catch{}return!1}async getStorageKeys(e){let t=await this.userDataProfileStorageService.readStorageData(this.syncResource.profile),o=[],n=[];for(let[l,c]of t)c.target===0?o.push(l):c.target===1&&n.push(l);let r=[...o,...n],s=e?.storage?Object.keys(e.storage).filter(l=>!l.startsWith(Mme)&&!r.includes(l)&&t.get(l)!==void 0):[];if(!Wt){let l=[...Sme.map(c=>Ime(c)),_H];s.push(...l),n.push(...l)}return{user:o,machine:n,unregistered:s}}};DBt=I([m(2,W0),m(3,fe),m(4,A0),m(5,yee),m(6,Dy),m(7,Eo),m(8,Fl),m(9,Te),m(10,B),m(11,ce),m(12,ht),m(13,F)],DBt);var pet=class{constructor(i,e,t,o){this.fileService=i;this.environmentService=e;this.userDataProfileStorageService=t;this.logService=o}async getLocalGlobalState(i){let e={};if(i.isDefault){let o=await this.getLocalArgvContent(),n=jr(o);for(let r of gYo)n[r]!==void 0&&(e[`${Mme}${r}`]={version:1,value:n[r]})}let t=await this.userDataProfileStorageService.readStorageData(i);for(let[o,n]of t)n.value&&n.target===0&&(e[o]={version:1,value:n.value});return{storage:e}}async getLocalArgvContent(){try{this.logService.debug("GlobalStateSync#getLocalArgvContent",this.environmentService.argvResource);let i=await this.fileService.readFile(this.environmentService.argvResource);return this.logService.debug("GlobalStateSync#getLocalArgvContent - Resolved",this.environmentService.argvResource),i.value.toString()}catch(i){this.logService.debug(Pn(i))}return"{}"}async writeLocalGlobalState({added:i,removed:e,updated:t},o){let n=uMe("globalState",o),r={},s=new Map,l=await this.userDataProfileStorageService.readStorageData(o),c=(u,p)=>{for(let h of u){if(h.startsWith(Mme)){r[h.substring(Mme.length)]=p?p[h].value:void 0;continue}if(p){let g=p[h];g.value!==l.get(h)?.value&&s.set(h,g.value)}else l.get(h)!==void 0&&s.set(h,void 0)}};if(c(Object.keys(i),i),c(Object.keys(t),t),c(e),Object.keys(r).length){this.logService.trace(`${n}: Updating locale...`);let u=await this.getLocalArgvContent(),p=u;for(let h of Object.keys(r))p=YRe(p,[h],r[h],{});u!==p&&(this.logService.trace(`${n}: Updating locale...`),await this.fileService.writeFile(this.environmentService.argvResource,qe.fromString(p)),this.logService.info(`${n}: Updated locale.`)),this.logService.info(`${n}: Updated locale`)}s.size&&(this.logService.trace(`${n}: Updating global state...`),await this.userDataProfileStorageService.updateStorageData(o,s,0),this.logService.info(`${n}: Updated global state`,[...s.keys()]))}};pet=I([m(0,fe),m(1,Eo),m(2,W0),m(3,Dy)],pet);var LBt=class extends Mee{constructor(i,e,t,o,n,r){super("globalState",t,o,n,e,i,r)}async doInitialize(i){let e=i.syncData?JSON.parse(i.syncData.content):null;if(!e){this.logService.info("Skipping initializing global state because remote global state does not exist.");return}let t={},o={};for(let n of Object.keys(e.storage))n.startsWith(Mme)?t[n.substring(Mme.length)]=e.storage[n].value:this.storageService.get(n,0)===void 0&&(o[n]=e.storage[n].value);if(Object.keys(t).length){let n="{}";try{n=(await this.fileService.readFile(this.environmentService.argvResource)).value.toString()}catch{}for(let r of Object.keys(t))n=YRe(n,[r],t[r],{});await this.fileService.writeFile(this.environmentService.argvResource,qe.fromString(n))}if(Object.keys(o).length){let n=[];for(let r of Object.keys(o))n.push({key:r,value:o[r],scope:0,target:0});this.storageService.storeAll(n,!0)}}};LBt=I([m(0,ce),m(1,fe),m(2,an),m(3,Eo),m(4,Dy),m(5,ht)],LBt);var pMe=class{constructor(i,e,t,o,n){this.userDataSyncStoreClient=i;this.storageService=e;this.environmentService=t;this.fileService=o;this.logService=n}getSyncStoreType(i){return this.parseGlobalState(i)?.storage[_H]?.value}async sync(i){let e=OZe(xt());try{return await this.doSync(i,e)}catch(t){if(t instanceof Vg&&t.code==="PreconditionFailed")return this.logService.info("Failed to synchronize UserDataSyncStoreType as there is a new remote version available. Synchronizing again..."),this.doSync(i,e);throw t}}async doSync(i,e){let t=await this.userDataSyncStoreClient.readResource("globalState",null,void 0,e),o=this.parseGlobalState(t)||{storage:{}};o.storage[_H]={value:i,version:Txi};let n=await IF(this.environmentService,this.fileService,this.storageService),r={version:Txi,machineId:n,content:uet(o,!1)};await this.userDataSyncStoreClient.writeResource("globalState",JSON.stringify(r),t.ref,void 0,e)}parseGlobalState({content:i}){if(!i)return null;let e=JSON.parse(i);if(cet(e))return e?JSON.parse(e.content):null;throw new Error("Invalid remote data")}};pMe=I([m(1,ce),m(2,Eo),m(3,fe),m(4,se)],pMe);var Pee=le("IUserDataSyncMachinesService"),_xi="sync.currentMachineName",yuo="Safari",wuo="Chrome",Cuo="Edge",xuo="Firefox",kuo="Android";function Euo(a){switch(a){case yuo:case wuo:case Cuo:case xuo:case kuo:case u_(0):return!0}return!1}function Iuo(){return $Se?yuo:d1?wuo:jSe?Cuo:qSe?xuo:xht?kuo:u_(Wt?0:om)}var H0=class extends x{constructor(e,t,o,n,r,s){super();this.storageService=o;this.userDataSyncStoreService=n;this.logService=r;this.productService=s;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this.userData=null;this.currentMachineIdPromise=IF(e,t,o)}static{this.VERSION=1}static{this.RESOURCE="machines"}async getMachines(e){let t=await this.currentMachineIdPromise;return(await this.readMachinesData(e)).machines.map(n=>({...n,isCurrent:n.id===t}))}async addCurrentMachine(e){let t=await this.currentMachineIdPromise,o=await this.readMachinesData(e);o.machines.some(({id:n})=>n===t)||(o.machines.push({id:t,name:this.computeCurrentMachineName(o.machines),platform:Iuo()}),await this.writeMachinesData(o))}async removeCurrentMachine(e){let t=await this.currentMachineIdPromise,o=await this.readMachinesData(e),n=o.machines.filter(({id:r})=>r!==t);n.length!==o.machines.length&&(o.machines=n,await this.writeMachinesData(o))}async renameMachine(e,t,o){let n=await this.readMachinesData(o),r=n.machines.find(({id:s})=>s===e);if(r){r.name=t,await this.writeMachinesData(n);let s=await this.currentMachineIdPromise;e===s&&this.storageService.store(_xi,t,-1,1)}}async setEnablements(e){let t=await this.readMachinesData();for(let[o,n]of e){let r=t.machines.find(s=>s.id===o);r&&(r.disabled=n?void 0:!0)}await this.writeMachinesData(t)}computeCurrentMachineName(e){let t=this.storageService.get(_xi,-1);if(t){if(!e.some(s=>s.name===t))return t;this.storageService.remove(_xi,-1)}let o=`${this.productService.embedderIdentifier?`${this.productService.embedderIdentifier} - `:""}${Iuo()} (${this.productService.nameShort})`,n=new RegExp(`${ns(o)}\\s#(\\d+)`),r=0;for(let s of e){let l=n.exec(s.name),c=l?parseInt(l[1]):0;r=c>r?c:r}return`${o} #${r+1}`}async readMachinesData(e){this.userData=await this.readUserData(e);let t=this.parse(this.userData);if(t.version!==H0.VERSION)throw new Error(d(2776,null,this.productService.nameLong));return t}async writeMachinesData(e){let t=JSON.stringify(e),o=await this.userDataSyncStoreService.writeResource(H0.RESOURCE,t,this.userData?.ref||null);this.userData={ref:o,content:t},this._onDidChange.fire()}async readUserData(e){if(this.userData){let t=e&&e.latest?e.latest[H0.RESOURCE]:void 0;if(this.userData.ref===t)return this.userData;if(t===void 0&&this.userData.content===null)return this.userData}return this.userDataSyncStoreService.readResource(H0.RESOURCE,this.userData)}parse(e){if(e.content!==null)try{return JSON.parse(e.content)}catch(t){this.logService.error(t)}return{version:H0.VERSION,machines:[]}}};H0=I([m(0,Eo),m(1,fe),m(2,ce),m(3,A0),m(4,Dy),m(5,tt)],H0);var RBt=class{constructor(i,e){this.authenticationProviderId=i;this.session=e}get sessionId(){return this.session.id}get accountName(){return this.session.account.label}get accountId(){return this.session.account.id}get token(){return this.session.idToken||this.session.accessToken}};function fYo(a){let i=a;return A.isUri(i?.base)&&A.isUri(i?.input1?.uri)&&A.isUri(i?.input2?.uri)&&A.isUri(i?.result)}var UD=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,P,O,V,H,G,$,J){super();this.userDataSyncService=e;this.uriIdentityService=t;this.authenticationService=o;this.userDataSyncAccountService=n;this.quickInputService=r;this.storageService=s;this.userDataSyncEnablementService=l;this.userDataAutoSyncService=c;this.logService=u;this.productService=p;this.extensionService=h;this.environmentService=g;this.secretStorageService=f;this.notificationService=v;this.progressService=b;this.dialogService=S;this.viewsService=w;this.viewDescriptorService=k;this.userDataSyncStoreManagementService=T;this.lifecycleService=P;this.instantiationService=O;this.editorService=V;this.userDataInitializationService=H;this.fileService=G;this.fileDialogService=$;this.userDataSyncMachinesService=J;this._authenticationProviders=[];this._accountStatus="uninitialized";this._onDidChangeAccountStatus=this._register(new E);this.onDidChangeAccountStatus=this._onDidChangeAccountStatus.event;this._onDidTurnOnSync=this._register(new E);this.onDidTurnOnSync=this._onDidTurnOnSync.event;this.turnOnSyncCancellationToken=void 0;this._cachedCurrentAuthenticationProviderId=null;this._cachedCurrentSessionId=null;this.syncEnablementContext=HD.bindTo(y),this.syncStatusContext=Ly.bindTo(y),this.accountStatusContext=LH.bindTo(y),this.activityViewsEnablementContext=Lme.bindTo(y),this.hasConflicts=Lee.bindTo(y),this.enableConflictsViewContext=wBt.bindTo(y),this.userDataSyncStoreManagementService.userDataSyncStore&&(this.syncStatusContext.set(this.userDataSyncService.status),this._register(e.onDidChangeStatus(ae=>this.syncStatusContext.set(ae))),this.syncEnablementContext.set(l.isEnabled()),this._register(l.onDidChangeEnablement(ae=>this.syncEnablementContext.set(ae))),this.waitAndInitialize())}static{this.DONOT_USE_WORKBENCH_SESSION_STORAGE_KEY="userDataSyncAccount.donotUseWorkbenchSession"}static{this.CACHED_AUTHENTICATION_PROVIDER_KEY="userDataSyncAccountProvider"}static{this.CACHED_SESSION_STORAGE_KEY="userDataSyncAccountPreference"}get enabled(){return!!this.userDataSyncStoreManagementService.userDataSyncStore}get authenticationProviders(){return this._authenticationProviders}get accountStatus(){return this._accountStatus}get current(){return this._current}updateAuthenticationProviders(){let e=this._authenticationProviders;return this._authenticationProviders=(this.userDataSyncStoreManagementService.userDataSyncStore?.authenticationProviders||[]).filter(({id:t})=>this.authenticationService.declaredProviders.some(o=>o.id===t)),this.logService.trace("Settings Sync: Authentication providers updated",this._authenticationProviders.map(({id:t})=>t)),$i(e,this._authenticationProviders,(t,o)=>t.id===o.id)}isSupportedAuthenticationProviderId(e){return this.authenticationProviders.some(({id:t})=>t===e)}async waitAndInitialize(){try{await Promise.all([this.extensionService.whenInstalledExtensionsRegistered(),this.userDataInitializationService.whenInitializationFinished()]),await this.initialize()}catch(e){this.environmentService.extensionTestsLocationURI||this.logService.error(e)}}async initialize(){if(Wt){let t=await bZ(this.secretStorageService,this.productService);this.currentSessionId===void 0&&t?.id&&(this.environmentService.options?.settingsSyncOptions?.authenticationProvider&&this.environmentService.options.settingsSyncOptions.enabled?this.currentSessionId=t.id:this.useWorkbenchSessionId&&(this.currentSessionId=t.id),this.useWorkbenchSessionId=!1)}let e=this.update("initialize");this._register(this.authenticationService.onDidChangeDeclaredProviders(()=>{this.updateAuthenticationProviders()&&e.finally(()=>this.update("declared authentication providers changed"))})),await e,this._register(U.filter(U.any(this.authenticationService.onDidRegisterAuthenticationProvider,this.authenticationService.onDidUnregisterAuthenticationProvider),t=>this.isSupportedAuthenticationProviderId(t.id))(()=>this.update("authentication provider change"))),this._register(U.filter(this.userDataSyncAccountService.onTokenFailed,t=>!t)(()=>this.update("token failure"))),this._register(U.filter(this.authenticationService.onDidChangeSessions,t=>this.isSupportedAuthenticationProviderId(t.providerId))(({event:t})=>this.onDidChangeSessions(t))),this._register(this.storageService.onDidChangeValue(-1,UD.CACHED_SESSION_STORAGE_KEY,this._store)(()=>this.onDidChangeStorage())),this._register(U.filter(this.userDataSyncAccountService.onTokenFailed,t=>t)(()=>this.onDidAuthFailure())),this.hasConflicts.set(this.userDataSyncService.conflicts.length>0),this._register(this.userDataSyncService.onDidChangeConflicts(t=>{this.hasConflicts.set(t.length>0),t.length||this.enableConflictsViewContext.reset(),this.editorService.editors.filter(o=>(X5(o)?o.original.resource:fYo(o)?o.input1.uri:void 0)?.scheme!==gx?!1:!this.userDataSyncService.conflicts.some(({conflicts:r})=>r.some(({previewResource:s})=>this.uriIdentityService.extUri.isEqual(s,o.resource)))).forEach(o=>o.dispose())}))}async update(e){this.logService.trace(`Settings Sync: Updating due to ${e}`),this.updateAuthenticationProviders(),await this.updateCurrentAccount(),this._current&&(this.currentAuthenticationProviderId=this._current.authenticationProviderId),await this.updateToken(this._current),this.updateAccountStatus(this._current?"available":"unavailable")}async updateCurrentAccount(){this.logService.trace("Settings Sync: Updating the current account");let e=this.currentSessionId,t=this.currentAuthenticationProviderId;if(e){let o=t?this.authenticationProviders.filter(({id:n})=>n===t):this.authenticationProviders;for(let{id:n,scopes:r}of o){let s=await this.authenticationService.getSessions(n,r)||[];for(let l of s)if(l.id===e){this._current=new RBt(n,l),this.logService.trace("Settings Sync: Updated the current account",this._current.accountName);return}}}this._current=void 0}async updateToken(e){let t;if(e)try{t={token:e.token,authenticationProviderId:e.authenticationProviderId}}catch(o){this.logService.error(o)}await this.userDataSyncAccountService.updateAccount(t)}updateAccountStatus(e){if(this.logService.trace(`Settings Sync: Updating the account status to ${e}`),this._accountStatus!==e){let o=`Settings Sync: Account status changed from ${this._accountStatus} to ${e}`;$u.VSCODE_DEV?this.logService.trace(o):this.logService.info(o),this._accountStatus=e,this.accountStatusContext.set(e),this._onDidChangeAccountStatus.fire(e)}}async turnOn(){if(!this.authenticationProviders.length)throw new Error(d(18281,null));if(this.userDataSyncEnablementService.isEnabled())return;if(this.userDataSyncService.status!=="idle")throw new Error("Cannot turn on sync while syncing");if(!await this.pick())throw new go;if(this.accountStatus!=="available")throw new Error(d(18280,null));let t=this.turnOnSyncCancellationToken=new Ye,o=Wt?x.None:this.lifecycleService.onBeforeShutdown(n=>n.veto((async()=>{let{confirmed:r}=await this.dialogService.confirm({type:"warning",message:d(18297,null),title:d(18293,null),primaryButton:d(18301,null),cancelButton:d(18279,null)});return r&&t.cancel(),!r})(),"veto.settingsSync"));try{await this.doTurnOnSync(t.token)}finally{o.dispose(),this.turnOnSyncCancellationToken=void 0}await this.userDataAutoSyncService.turnOn(),this.userDataSyncStoreManagementService.userDataSyncStore?.canSwitch&&await this.synchroniseUserDataSyncStoreType(),this.currentAuthenticationProviderId=this.current?.authenticationProviderId,this.environmentService.options?.settingsSyncOptions?.enablementHandler&&this.currentAuthenticationProviderId&&this.environmentService.options.settingsSyncOptions.enablementHandler(!0,this.currentAuthenticationProviderId),this.notificationService.info(d(18298,null,Mh.value)),this._onDidTurnOnSync.fire()}async turnoff(e){this.userDataSyncEnablementService.isEnabled()&&(await this.userDataAutoSyncService.turnOff(e),this.environmentService.options?.settingsSyncOptions?.enablementHandler&&this.currentAuthenticationProviderId&&this.environmentService.options.settingsSyncOptions.enablementHandler(!1,this.currentAuthenticationProviderId)),this.turnOnSyncCancellationToken&&this.turnOnSyncCancellationToken.cancel()}async synchroniseUserDataSyncStoreType(){if(!this.userDataSyncAccountService.account)throw new Error("Cannot update because you are signed out from settings sync. Please sign in and try again.");if(!Wt||!this.userDataSyncStoreManagementService.userDataSyncStore)return;let e=this.userDataSyncStoreManagementService.userDataSyncStore.type==="insiders"?this.userDataSyncStoreManagementService.userDataSyncStore.stableUrl:this.userDataSyncStoreManagementService.userDataSyncStore.insidersUrl,t=this.instantiationService.createInstance(MH,e);t.setAuthToken(this.userDataSyncAccountService.account.token,this.userDataSyncAccountService.account.authenticationProviderId),await this.instantiationService.createInstance(pMe,t).sync(this.userDataSyncStoreManagementService.userDataSyncStore.type)}syncNow(){return this.userDataAutoSyncService.triggerSync(["Sync Now"],{immediately:!0,disableCache:!0})}async doTurnOnSync(e){let t=new N,o=await this.userDataSyncService.createManualSyncTask();try{await this.progressService.withProgress({location:10,title:Mh.value,command:B0,delay:500},async n=>{n.report({message:d(18300,null)}),t.add(this.userDataSyncService.onDidChangeStatus(r=>{r==="hasConflicts"?n.report({message:d(18292,null)}):n.report({message:d(18299,null)})})),await o.merge(),this.userDataSyncService.status==="hasConflicts"&&await this.handleConflictsWhileTurningOn(e),await o.apply()})}catch(n){throw await o.stop(),n}finally{t.dispose()}}async handleConflictsWhileTurningOn(e){let t=this.userDataSyncService.conflicts,o=d(18273,null),n="";for(let s=0;s<t.length;s++)s===t.length-1&&s!==0?n+=o:s!==0&&(n+=", "),n+=Kv(t[s].syncResource);let r=t.length===1?Kv(t[0].syncResource):void 0;await this.dialogService.prompt({type:ft.Warning,message:d(18275,null,n),detail:d(18291,null),buttons:[{label:d(18294,null),run:async()=>{let s=Wp(U.toPromise(U.filter(this.userDataSyncService.onDidChangeConflicts,l=>l.length===0)),e);await this.showConflicts(this.userDataSyncService.conflicts[0]?.conflicts[0]),await s}},{label:r?d(18285,null,r):d(18284,null),run:async()=>this.replace(!0)},{label:r?d(18287,null,r):d(18286,null),run:()=>this.replace(!1)}],cancelButton:{run:()=>{throw new go}}})}async replace(e){for(let t of this.userDataSyncService.conflicts)for(let o of t.conflicts)await this.accept({syncResource:t.syncResource,profile:t.profile},e?o.remoteResource:o.localResource,void 0,{force:!0})}async accept(e,t,o,n){return this.userDataSyncService.accept(e,t,o,n)}async showConflicts(e){if(!this.userDataSyncService.conflicts.length)return;this.enableConflictsViewContext.set(!0);let t=await this.viewsService.openView(Ree);t&&e&&await t.open(e)}async resetSyncedData(){let{confirmed:e}=await this.dialogService.confirm({type:"info",message:d(18288,null),title:d(18289,null),primaryButton:d(18290,null)});e&&await this.userDataSyncService.resetRemote()}async getAllLogResources(){let e=[],t=await this.fileService.resolve(this.uriIdentityService.extUri.dirname(this.environmentService.logsHome));t.children&&e.push(...t.children.filter(n=>n.isDirectory&&/^\d{8}T\d{6}$/.test(n.name)).sort().reverse().map(n=>n.resource));let o=[];for(let n of e){let s=(await this.fileService.resolve(n)).children?.find(l=>this.uriIdentityService.extUri.basename(l.resource).startsWith(`${yme}.`));s&&o.push(s.resource)}return o}async showSyncActivity(){this.activityViewsEnablementContext.set(!0),await this.waitForActiveSyncViews(),await this.viewsService.openViewContainer(RH)}async downloadSyncActivity(){let e=await this.fileDialogService.showOpenDialog({title:d(18277,null),canSelectFiles:!1,canSelectFolders:!0,canSelectMany:!1,openLabel:d(18276,null)});if(e?.[0])return this.progressService.withProgress({location:10},async()=>{let o=(await this.userDataSyncMachinesService.getMachines()).find(u=>u.isCurrent),n=(o?o.name+" - ":"")+"Settings Sync Activity",r=await this.fileService.resolve(e[0]),s=new RegExp(`${ns(n)}\\s(\\d+)`),l=[];for(let u of r.children??[])if(u.name===n)l.push(0);else{let p=s.exec(u.name);p&&l.push(parseInt(p[1]))}l.sort((u,p)=>u-p);let c=this.uriIdentityService.extUri.joinPath(e[0],l[0]!==0?n:`${n} ${l[l.length-1]+1}`);return await Promise.all([this.userDataSyncService.saveRemoteActivityData(this.uriIdentityService.extUri.joinPath(c,"remoteActivity.json")),(async()=>{let u=await this.getAllLogResources();await Promise.all(u.map(async p=>this.fileService.copy(p,this.uriIdentityService.extUri.joinPath(c,"logs",`${this.uriIdentityService.extUri.basename(this.uriIdentityService.extUri.dirname(p))}.log`))))})(),this.fileService.copy(this.environmentService.userDataSyncHome,this.uriIdentityService.extUri.joinPath(c,"localActivity"))]),c})}async waitForActiveSyncViews(){let e=this.viewDescriptorService.getViewContainerById(RH);if(e){let t=this.viewDescriptorService.getViewContainerModel(e);t.activeViewDescriptors.length||await U.toPromise(U.filter(t.onDidChangeActiveViewDescriptors,o=>t.activeViewDescriptors.length>0))}}async signIn(){let e=this.currentAuthenticationProviderId,t=e?this.authenticationProviders.find(o=>o.id===e):void 0;if(t)await this.doSignIn(t);else{if(!this.authenticationProviders.length)throw new Error(d(18282,null));await this.pick()}}async pick(){let e=await this.doPick();return e?(await this.doSignIn(e),!0):!1}async doPick(){if(this.authenticationProviders.length===0)return;let e=[...this.authenticationProviders].sort(({id:l})=>l===this.currentAuthenticationProviderId?-1:1),t=new Map;if(e.length===1){let l=await this.getAccounts(e[0].id,e[0].scopes);if(l.length)t.set(e[0].id,l);else return e[0]}let o,n=new N,r=n.add(this.quickInputService.createQuickPick({useSeparators:!0})),s=new Promise(l=>{n.add(r.onDidHide(()=>{n.dispose(),l(o)}))});if(r.title=Mh.value,r.ok=!1,r.ignoreFocusOut=!0,r.placeholder=d(18274,null),r.show(),e.length>1){r.busy=!0;for(let{id:l,scopes:c}of e){let u=await this.getAccounts(l,c);u.length&&t.set(l,u)}r.busy=!1}return r.items=this.createQuickpickItems(e,t),n.add(r.onDidAccept(()=>{o=r.selectedItems[0]?.account?r.selectedItems[0]?.account:r.selectedItems[0]?.authenticationProvider,r.hide()})),s}async getAccounts(e,t){let o=new Map,n=null,r=await this.authenticationService.getSessions(e,t)||[];for(let s of r){let l=new RBt(e,s);o.set(l.accountId,l),l.sessionId===this.currentSessionId&&(n=l)}return n&&o.set(n.accountId,n),n?[...o.values()]:[...o.values()].sort(({sessionId:s})=>s===this.currentSessionId?-1:1)}createQuickpickItems(e,t){let o=[];if(t.size){o.push({type:"separator",label:d(18296,null)});for(let n of e){let r=(t.get(n.id)||[]).sort(({sessionId:l})=>l===this.currentSessionId?-1:1),s=this.authenticationService.getProvider(n.id).label;for(let l of r)o.push({label:`${l.accountName} (${s})`,description:l.sessionId===this.current?.sessionId?d(18278,null):void 0,account:l,authenticationProvider:n})}o.push({type:"separator",label:d(18283,null)})}for(let n of e){let r=this.authenticationService.getProvider(n.id);if(!t.has(n.id)||r.supportsMultipleAccounts){let s=r.label;o.push({label:d(18295,null,s),authenticationProvider:n})}}return o}async doSignIn(e){let t;cuo(e)?(this.environmentService.options?.settingsSyncOptions?.authenticationProvider?.id===e.id?t=await this.environmentService.options?.settingsSyncOptions?.authenticationProvider?.signIn():t=(await this.authenticationService.createSession(e.id,e.scopes)).id,this.currentAuthenticationProviderId=e.id):(this.environmentService.options?.settingsSyncOptions?.authenticationProvider?.id===e.authenticationProviderId?t=await this.environmentService.options?.settingsSyncOptions?.authenticationProvider?.signIn():t=e.sessionId,this.currentAuthenticationProviderId=e.authenticationProviderId),this.currentSessionId=t,await this.update("sign in")}async onDidAuthFailure(){this.currentSessionId=void 0,await this.update("auth failure")}onDidChangeSessions(e){this.currentSessionId&&e.removed?.find(t=>t.id===this.currentSessionId)&&(this.currentSessionId=void 0),this.update("change in sessions")}onDidChangeStorage(){this.currentSessionId!==this.getStoredCachedSessionId()&&(this._cachedCurrentSessionId=null,this.update("change in storage"))}get currentAuthenticationProviderId(){return this._cachedCurrentAuthenticationProviderId===null&&(this._cachedCurrentAuthenticationProviderId=this.storageService.get(UD.CACHED_AUTHENTICATION_PROVIDER_KEY,-1)),this._cachedCurrentAuthenticationProviderId}set currentAuthenticationProviderId(e){this._cachedCurrentAuthenticationProviderId!==e&&(this._cachedCurrentAuthenticationProviderId=e,e===void 0?this.storageService.remove(UD.CACHED_AUTHENTICATION_PROVIDER_KEY,-1):this.storageService.store(UD.CACHED_AUTHENTICATION_PROVIDER_KEY,e,-1,1))}get currentSessionId(){return this._cachedCurrentSessionId===null&&(this._cachedCurrentSessionId=this.getStoredCachedSessionId()),this._cachedCurrentSessionId}set currentSessionId(e){this._cachedCurrentSessionId!==e&&(this._cachedCurrentSessionId=e,e===void 0?(this.logService.info("Settings Sync: Reset current session"),this.storageService.remove(UD.CACHED_SESSION_STORAGE_KEY,-1)):(this.logService.info("Settings Sync: Updated current session",e),this.storageService.store(UD.CACHED_SESSION_STORAGE_KEY,e,-1,1)))}getStoredCachedSessionId(){return this.storageService.get(UD.CACHED_SESSION_STORAGE_KEY,-1)}get useWorkbenchSessionId(){return!this.storageService.getBoolean(UD.DONOT_USE_WORKBENCH_SESSION_STORAGE_KEY,-1,!1)}set useWorkbenchSessionId(e){this.storageService.store(UD.DONOT_USE_WORKBENCH_SESSION_STORAGE_KEY,!e,-1,1)}};UD=I([m(0,bI),m(1,ht),m(2,xs),m(3,jRe),m(4,Ue),m(5,ce),m(6,Fl),m(7,PT),m(8,se),m(9,tt),m(10,lt),m(11,cd),m(12,Dw),m(13,Ne),m(14,Fo),m(15,at),m(16,X),m(17,$t),m(18,Bi),m(19,pM),m(20,ji),m(21,F),m(22,ee),m(23,U3),m(24,fe),m(25,rn),m(26,Pee)],UD);Ee(SI,UD,0);var mMe=" ",met=class extends x{constructor(e,t,o,n,r,s,l,c){super();this.activityService=e;this.storageService=t;this.dialogService=o;this.quickInputService=n;this._productService=r;this._authenticationService=s;this._authenticationUsageService=l;this._authenticationAccessService=c;this._signInRequestItems=new Map;this._sessionAccessRequestItems=new Map;this._accountBadgeDisposable=this._register(new me);this._onDidAccountPreferenceChange=this._register(new E);this.onDidChangeAccountPreference=this._onDidAccountPreferenceChange.event;this._inheritAuthAccountPreferenceParentToChildren=this._productService.inheritAuthAccountPreference||{},this._inheritAuthAccountPreferenceChildToParent=Object.entries(this._inheritAuthAccountPreferenceParentToChildren).reduce((u,[p,h])=>(h.forEach(g=>{u[g]=p}),u),{}),this.registerListeners()}registerListeners(){this._register(this._authenticationService.onDidChangeSessions(e=>{e.event.added?.length&&this.updateNewSessionRequests(e.providerId,e.event.added),e.event.removed?.length&&this.updateAccessRequests(e.providerId,e.event.removed)})),this._register(this._authenticationService.onDidUnregisterAuthenticationProvider(e=>{let t=this._sessionAccessRequestItems.get(e.id)||{};Object.keys(t).forEach(o=>{this.removeAccessRequest(e.id,o)})}))}updateNewSessionRequests(e,t){let o=this._signInRequestItems.get(e);o&&Object.keys(o).forEach(n=>{let r=n.split(mMe);t.some(s=>uNt(s.scopes,r))&&(o[n]?.disposables.forEach(l=>l.dispose()),delete o[n],Object.keys(o).length===0?this._signInRequestItems.delete(e):this._signInRequestItems.set(e,o),this.updateBadgeCount())})}updateAccessRequests(e,t){let o=this._sessionAccessRequestItems.get(e);o&&Object.keys(o).forEach(n=>{t.forEach(r=>{let s=o[n].possibleSessions.findIndex(l=>l.id===r.id);s&&o[n].possibleSessions.splice(s,1)}),o[n].possibleSessions.length||this.removeAccessRequest(e,n)})}updateBadgeCount(){this._accountBadgeDisposable.clear();let e=0;if(this._signInRequestItems.forEach(t=>{Object.keys(t).forEach(o=>{e+=t[o].requestingExtensionIds.length})}),this._sessionAccessRequestItems.forEach(t=>{e+=Object.keys(t).length}),e>0){let t=new Rd(e,()=>d(17376,null));this._accountBadgeDisposable.value=this.activityService.showAccountsActivity({badge:t})}}removeAccessRequest(e,t){let o=this._sessionAccessRequestItems.get(e)||{};o[t]&&(Be(o[t].disposables),delete o[t],this.updateBadgeCount())}updateAccountPreference(e,t,o){let n=Ii.toKey(e),r=this._inheritAuthAccountPreferenceChildToParent[n]??n,s=this._getKey(r,t);this.storageService.store(s,o.label,1,1),this.storageService.store(s,o.label,-1,1);let l=this._inheritAuthAccountPreferenceParentToChildren[r],c=l?[r,...l]:[r];this._onDidAccountPreferenceChange.fire({extensionIds:c,providerId:t})}getAccountPreference(e,t){let o=Ii.toKey(e),n=this._getKey(this._inheritAuthAccountPreferenceChildToParent[o]??o,t);return this.storageService.get(n,1)??this.storageService.get(n,-1)}removeAccountPreference(e,t){let o=Ii.toKey(e),n=this._getKey(this._inheritAuthAccountPreferenceChildToParent[o]??o,t);this.storageService.remove(n,1),this.storageService.remove(n,-1)}_getKey(e,t){return`${e}-${t}`}updateSessionPreference(e,t,o){let r=`${Ii.toKey(t)}-${e}-${o.scopes.join(mMe)}`;this.storageService.store(r,o.id,1,1),this.storageService.store(r,o.id,-1,1)}getSessionPreference(e,t,o){let r=`${Ii.toKey(t)}-${e}-${o.join(mMe)}`;return this.storageService.get(r,1)??this.storageService.get(r,-1)}removeSessionPreference(e,t,o){let r=`${Ii.toKey(t)}-${e}-${o.join(mMe)}`;this.storageService.remove(r,1),this.storageService.remove(r,-1)}_updateAccountAndSessionPreferences(e,t,o){this.updateAccountPreference(t,e,o.account),this.updateSessionPreference(e,t,o)}async showGetSessionPrompt(e,t,o,n){let r;(p=>(p[p.Allow=0]="Allow",p[p.Deny=1]="Deny",p[p.Cancel=2]="Cancel"))(r||={});let{result:s}=await this.dialogService.prompt({type:ft.Info,message:d(17372,null,n,e.label,t),buttons:[{label:d(17371,null),run:()=>0},{label:d(17373,null),run:()=>1}],cancelButton:{run:()=>2}});return s!==2&&(this._authenticationAccessService.updateAllowedExtensions(e.id,t,[{id:o,name:n,allowed:s===0}]),this.removeAccessRequest(e.id,o)),s===0}async selectSession(e,t,o,n,r){let s=await this._authenticationService.getAccounts(e);if(!s.length)throw new Error("No accounts available");let l=new N,c=l.add(this.quickInputService.createQuickPick());c.ignoreFocusOut=!0;let u=new Set,p=r.filter(h=>!u.has(h.account.label)&&u.add(h.account.label)).map(h=>({label:h.account.label,session:h}));return s.forEach(h=>{u.has(h.label)||p.push({label:h.label,account:h})}),p.push({label:d(17378,null)}),c.items=p,c.title=d(17375,null,o,this._authenticationService.getProvider(e).label),c.placeholder=d(17374,null,o),await new Promise((h,g)=>{l.add(c.onDidAccept(async f=>{c.dispose();let v=c.selectedItems[0].session;if(!v){let S=c.selectedItems[0].account;try{v=await this._authenticationService.createSession(e,n,{account:S})}catch(y){g(y);return}}let b=v.account.label;this._authenticationAccessService.updateAllowedExtensions(e,b,[{id:t,name:o,allowed:!0}]),this._updateAccountAndSessionPreferences(e,t,v),this.removeAccessRequest(e,t),h(v)})),l.add(c.onDidHide(f=>{c.selectedItems[0]||g("User did not consent to account access"),l.dispose()})),c.show()})}async completeSessionAccessRequest(e,t,o,n){let s=(this._sessionAccessRequestItems.get(e.id)||{})[t];if(!s||!e)return;let l=s.possibleSessions,c;if(e.supportsMultipleAccounts)try{c=await this.selectSession(e.id,t,o,n,l)}catch{}else await this.showGetSessionPrompt(e,l[0].account.label,t,o)&&(c=l[0]);c&&this._authenticationUsageService.addAccountUsage(e.id,c.account.label,c.scopes,t,o)}requestSessionAccess(e,t,o,n,r){let s=this._sessionAccessRequestItems.get(e)||{};if(s[t])return;let c=this._authenticationService.getProvider(e),u=ve.appendMenuItem(D.AccountsContext,{group:"3_accessRequests",command:{id:`${e}${t}Access`,title:d(17370,null,c.label,o)}}),p=$e.registerCommand({id:`${e}${t}Access`,handler:async h=>{this.completeSessionAccessRequest(c,t,o,n)}});s[t]={possibleSessions:r,disposables:[u,p]},this._sessionAccessRequestItems.set(e,s),this.updateBadgeCount()}async requestNewSession(e,t,o,n){this._authenticationService.isAuthenticationProviderRegistered(e)||await new Promise((g,f)=>{let v=this._authenticationService.onDidRegisterAuthenticationProvider(b=>{b.id===e&&(v.dispose(),g())})});let r;try{r=this._authenticationService.getProvider(e)}catch{return}let s=this._signInRequestItems.get(e),l=Jde(t)?`${t.wwwAuthenticate}:${t.fallbackScopes?.join(mMe)??""}`:`${t.join(mMe)}`;if(s&&s[l]&&s[l].requestingExtensionIds.includes(o))return;let u=`${e}:${o}:signIn${Object.keys(s||[]).length}`,p=ve.appendMenuItem(D.AccountsContext,{group:"2_signInRequests",command:{id:u,title:d(17377,null,r.label,n)}}),h=$e.registerCommand({id:u,handler:async g=>{let v=await g.get(xs).createSession(e,t);this._authenticationAccessService.updateAllowedExtensions(e,v.account.label,[{id:o,name:n,allowed:!0}]),this._updateAccountAndSessionPreferences(e,o,v)}});if(s){let g=s[l]||{disposables:[],requestingExtensionIds:[]};s[l]={disposables:[...g.disposables,p,h],requestingExtensionIds:[...g.requestingExtensionIds,o]},this._signInRequestItems.set(e,s)}else this._signInRequestItems.set(e,{[l]:{disposables:[p,h],requestingExtensionIds:[o]}});this.updateBadgeCount()}};met=I([m(0,Sl),m(1,ce),m(2,at),m(3,Ue),m(4,tt),m(5,xs),m(6,DA),m(7,vk)],met);Ee(jX,met,1);var Aee=class extends x{constructor(e,t,o){super();this.storageService=e;this.secretStorageService=t;this.logService=o;this._onDidChangeTokens=this._register(new E);this.onDidChangeTokens=this._onDidChangeTokens.event;let n=new uh;this._register(this.secretStorageService.onDidChangeSecret(async r=>{let s;try{s=JSON.parse(r)}catch{}s?.isDynamicAuthProvider&&n.queue(async()=>{let l=await this.getSessionsForDynamicAuthProvider(s.authProviderId,s.clientId);this._onDidChangeTokens.fire({authProviderId:s.authProviderId,clientId:s.clientId,tokens:l})})}))}static{this.PROVIDERS_STORAGE_KEY="dynamicAuthProviders"}async getClientRegistration(e){let t=`dynamicAuthProvider:clientRegistration:${e}`,o=await this.secretStorageService.get(t);if(o)try{let s=JSON.parse(o);if(s&&(s.clientId||s.clientSecret))return s}catch{await this.secretStorageService.delete(t)}let r=this._getStoredProviders().find(s=>s.providerId===e);return r?.clientId?{clientId:r.clientId}:void 0}getClientId(e){return this._getStoredProviders().find(n=>n.providerId===e)?.clientId}async storeClientRegistration(e,t,o,n,r){this._trackProvider(e,t,o,r);let s=`dynamicAuthProvider:clientRegistration:${e}`,l={clientId:o,clientSecret:n};await this.secretStorageService.set(s,JSON.stringify(l))}_trackProvider(e,t,o,n){let r=this._getStoredProviders(),s=r.findIndex(l=>l.providerId===e);if(s===-1){let l={providerId:e,label:n||e,authorizationServer:t,clientId:o};r.push(l),this._storeProviders(r)}else{let l=r[s],c={providerId:e,label:n||l.label,authorizationServer:t,clientId:o};r[s]=c,this._storeProviders(r)}}_getStoredProviders(){let e=this.storageService.get(Aee.PROVIDERS_STORAGE_KEY,-1,"[]");try{let t=JSON.parse(e);for(let o of t)o.authorizationServer||(o.authorizationServer=o.issuer);return t}catch{return[]}}_storeProviders(e){this.storageService.store(Aee.PROVIDERS_STORAGE_KEY,JSON.stringify(e),-1,1)}getInteractedProviders(){return this._getStoredProviders()}async removeDynamicProvider(e){let t=this._getStoredProviders(),o=t.find(s=>s.providerId===e),n=t.filter(s=>s.providerId!==e);if(this._storeProviders(n),o){let s=JSON.stringify({isDynamicAuthProvider:!0,authProviderId:e,clientId:o.clientId});await this.secretStorageService.delete(s)}let r=`dynamicAuthProvider:clientRegistration:${e}`;await this.secretStorageService.delete(r)}async getSessionsForDynamicAuthProvider(e,t){let o=JSON.stringify({isDynamicAuthProvider:!0,authProviderId:e,clientId:t}),n=await this.secretStorageService.get(o);if(n){let r=JSON.parse(n);if(!Array.isArray(r)||!r.every(s=>typeof s.created_at=="number"&&yso(s))){this.logService.error(`Invalid session data for ${e} (${t}) in secret storage:`,r),await this.secretStorageService.delete(o);return}return r}}async setSessionsForDynamicAuthProvider(e,t,o){let n=JSON.stringify({isDynamicAuthProvider:!0,authProviderId:e,clientId:t}),r=JSON.stringify(o);await this.secretStorageService.set(n,r),this.logService.trace(`Set session data for ${e} (${t}) in secret storage:`,o)}};Aee=I([m(0,ce),m(1,Dw),m(2,se)],Aee);Ee(SZ,Aee,1);var fM=le("IAuthenticationQueryService");var AH=class{constructor(i,e){this.providerId=i;this.queryService=e}},get=class extends AH{constructor(e,t,o,n){super(e,n);this.accountName=t;this.extensionId=o}isAccessAllowed(){return this.queryService.authenticationAccessService.isAccessAllowed(this.providerId,this.accountName,this.extensionId)}setAccessAllowed(e,t){this.queryService.authenticationAccessService.updateAllowedExtensions(this.providerId,this.accountName,[{id:this.extensionId,name:t||this.extensionId,allowed:e}])}addUsage(e,t){this.queryService.authenticationUsageService.addAccountUsage(this.providerId,this.accountName,e,this.extensionId,t)}getUsage(){return this.queryService.authenticationUsageService.readAccountUsages(this.providerId,this.accountName).filter(t=>t.extensionId===Ii.toKey(this.extensionId)).map(t=>({extensionId:t.extensionId,extensionName:t.extensionName,scopes:t.scopes||[],lastUsed:t.lastUsed}))}removeUsage(){let t=this.queryService.authenticationUsageService.readAccountUsages(this.providerId,this.accountName).filter(o=>o.extensionId!==this.extensionId);this.queryService.authenticationUsageService.removeAccountUsage(this.providerId,this.accountName);for(let o of t)this.queryService.authenticationUsageService.addAccountUsage(this.providerId,this.accountName,o.scopes||[],o.extensionId,o.extensionName)}setAsPreferred(){this.queryService.authenticationExtensionsService.updateAccountPreference(this.extensionId,this.providerId,{label:this.accountName,id:this.accountName})}isPreferred(){return this.queryService.authenticationExtensionsService.getAccountPreference(this.extensionId,this.providerId)===this.accountName}isTrusted(){return this.queryService.authenticationAccessService.readAllowedExtensions(this.providerId,this.accountName).find(o=>o.id===this.extensionId)?.trusted===!0}},MBt=class extends AH{constructor(e,t,o,n){super(e,n);this.accountName=t;this.mcpServerId=o}isAccessAllowed(){return this.queryService.authenticationMcpAccessService.isAccessAllowed(this.providerId,this.accountName,this.mcpServerId)}setAccessAllowed(e,t){this.queryService.authenticationMcpAccessService.updateAllowedMcpServers(this.providerId,this.accountName,[{id:this.mcpServerId,name:t||this.mcpServerId,allowed:e}])}addUsage(e,t){this.queryService.authenticationMcpUsageService.addAccountUsage(this.providerId,this.accountName,e,this.mcpServerId,t)}getUsage(){return this.queryService.authenticationMcpUsageService.readAccountUsages(this.providerId,this.accountName).filter(t=>t.mcpServerId===this.mcpServerId).map(t=>({mcpServerId:t.mcpServerId,mcpServerName:t.mcpServerName,scopes:t.scopes||[],lastUsed:t.lastUsed}))}removeUsage(){let t=this.queryService.authenticationMcpUsageService.readAccountUsages(this.providerId,this.accountName).filter(o=>o.mcpServerId!==this.mcpServerId);this.queryService.authenticationMcpUsageService.removeAccountUsage(this.providerId,this.accountName);for(let o of t)this.queryService.authenticationMcpUsageService.addAccountUsage(this.providerId,this.accountName,o.scopes||[],o.mcpServerId,o.mcpServerName)}setAsPreferred(){this.queryService.authenticationMcpService.updateAccountPreference(this.mcpServerId,this.providerId,{label:this.accountName,id:this.accountName})}isPreferred(){return this.queryService.authenticationMcpService.getAccountPreference(this.mcpServerId,this.providerId)===this.accountName}isTrusted(){return this.queryService.authenticationMcpAccessService.readAllowedMcpServers(this.providerId,this.accountName).find(o=>o.id===this.mcpServerId)?.trusted===!0}},fet=class extends AH{constructor(e,t,o){super(e,o);this.accountName=t}getAllowedExtensions(){let e=this.queryService.authenticationAccessService.readAllowedExtensions(this.providerId,this.accountName),t=this.queryService.authenticationUsageService.readAccountUsages(this.providerId,this.accountName);return e.filter(o=>o.allowed!==!1).map(o=>{let n=t.filter(c=>c.extensionId===o.id),r=n.length>0?Math.max(...n.map(c=>c.lastUsed)):void 0,l=new get(this.providerId,this.accountName,o.id,this.queryService).isTrusted();return{id:o.id,name:o.name,allowed:o.allowed,lastUsed:r,trusted:l}})}allowAccess(e){let t=e.map(o=>({id:o,name:o,allowed:!0}));this.queryService.authenticationAccessService.updateAllowedExtensions(this.providerId,this.accountName,t)}removeAccess(e){let t=e.map(o=>({id:o,name:o,allowed:!1}));this.queryService.authenticationAccessService.updateAllowedExtensions(this.providerId,this.accountName,t)}forEach(e){let t=this.queryService.authenticationUsageService.readAccountUsages(this.providerId,this.accountName),o=this.queryService.authenticationAccessService.readAllowedExtensions(this.providerId,this.accountName),n=new Set;t.forEach(r=>n.add(r.extensionId)),o.forEach(r=>n.add(r.id));for(let r of n){let s=new get(this.providerId,this.accountName,r,this.queryService);e(s)}}},vet=class extends AH{constructor(e,t,o){super(e,o);this.accountName=t}getAllowedMcpServers(){return this.queryService.authenticationMcpAccessService.readAllowedMcpServers(this.providerId,this.accountName).filter(e=>e.allowed!==!1)}allowAccess(e){let t=e.map(o=>({id:o,name:o,allowed:!0}));this.queryService.authenticationMcpAccessService.updateAllowedMcpServers(this.providerId,this.accountName,t)}removeAccess(e){let t=e.map(o=>({id:o,name:o,allowed:!1}));this.queryService.authenticationMcpAccessService.updateAllowedMcpServers(this.providerId,this.accountName,t)}forEach(e){let t=this.queryService.authenticationMcpUsageService.readAccountUsages(this.providerId,this.accountName),o=this.queryService.authenticationMcpAccessService.readAllowedMcpServers(this.providerId,this.accountName),n=new Set;t.forEach(r=>n.add(r.mcpServerId)),o.forEach(r=>n.add(r.id));for(let r of n){let s=new MBt(this.providerId,this.accountName,r,this.queryService);e(s)}}},Dxi=class extends AH{constructor(e,t,o){super(e,o);this.accountName=t}hasAnyUsage(){return!!(this.queryService.authenticationUsageService.readAccountUsages(this.providerId,this.accountName).length>0||this.queryService.authenticationMcpUsageService.readAccountUsages(this.providerId,this.accountName).length>0||this.queryService.authenticationAccessService.readAllowedExtensions(this.providerId,this.accountName).some(r=>r.allowed!==!1)||this.queryService.authenticationMcpAccessService.readAllowedMcpServers(this.providerId,this.accountName).some(r=>r.allowed!==!1))}getEntityCount(){let e=this.queryService.authenticationUsageService.readAccountUsages(this.providerId,this.accountName),t=this.queryService.authenticationAccessService.readAllowedExtensions(this.providerId,this.accountName).filter(u=>u.allowed),o=new Set;e.forEach(u=>o.add(u.extensionId)),t.forEach(u=>o.add(u.id));let n=this.queryService.authenticationMcpUsageService.readAccountUsages(this.providerId,this.accountName),r=this.queryService.authenticationMcpAccessService.readAllowedMcpServers(this.providerId,this.accountName).filter(u=>u.allowed),s=new Set;n.forEach(u=>s.add(u.mcpServerId)),r.forEach(u=>s.add(u.id));let l=o.size,c=s.size;return{extensions:l,mcpServers:c,total:l+c}}removeAllAccess(){let e=new fet(this.providerId,this.accountName,this.queryService),o=e.getAllowedExtensions().map(l=>l.id);o.length>0&&e.removeAccess(o);let n=new vet(this.providerId,this.accountName,this.queryService),s=n.getAllowedMcpServers().map(l=>l.id);s.length>0&&n.removeAccess(s)}forEach(e){new fet(this.providerId,this.accountName,this.queryService).forEach(n=>{e(n.extensionId,"extension")}),new vet(this.providerId,this.accountName,this.queryService).forEach(n=>{e(n.mcpServerId,"mcpServer")})}},PBt=class extends AH{constructor(e,t,o){super(e,o);this.accountName=t}extension(e){return new get(this.providerId,this.accountName,e,this.queryService)}mcpServer(e){return new MBt(this.providerId,this.accountName,e,this.queryService)}extensions(){return new fet(this.providerId,this.accountName,this.queryService)}mcpServers(){return new vet(this.providerId,this.accountName,this.queryService)}entities(){return new Dxi(this.providerId,this.accountName,this.queryService)}remove(){this.queryService.authenticationAccessService.removeAllowedExtensions(this.providerId,this.accountName),this.queryService.authenticationUsageService.removeAccountUsage(this.providerId,this.accountName),this.queryService.authenticationMcpAccessService.removeAllowedMcpServers(this.providerId,this.accountName),this.queryService.authenticationMcpUsageService.removeAccountUsage(this.providerId,this.accountName)}},ABt=class extends AH{constructor(e,t,o){super(e,o);this.extensionId=t}getPreferredAccount(){return this.queryService.authenticationExtensionsService.getAccountPreference(this.extensionId,this.providerId)}setPreferredAccount(e){this.queryService.authenticationExtensionsService.updateAccountPreference(this.extensionId,this.providerId,e)}removeAccountPreference(){this.queryService.authenticationExtensionsService.removeAccountPreference(this.extensionId,this.providerId)}},NBt=class extends AH{constructor(e,t,o){super(e,o);this.mcpServerId=t}async getLastUsedAccount(){try{let e=await this.queryService.authenticationService.getAccounts(this.providerId),t,o=0;for(let n of e){let s=this.queryService.authenticationMcpUsageService.readAccountUsages(this.providerId,n.label).filter(l=>l.mcpServerId===this.mcpServerId);for(let l of s)l.lastUsed>o&&(o=l.lastUsed,t=n.label)}return t}catch{return}}getPreferredAccount(){return this.queryService.authenticationMcpService.getAccountPreference(this.mcpServerId,this.providerId)}setPreferredAccount(e){this.queryService.authenticationMcpService.updateAccountPreference(this.mcpServerId,this.providerId,e)}removeAccountPreference(){this.queryService.authenticationMcpService.removeAccountPreference(this.mcpServerId,this.providerId)}async getUsedAccounts(){try{let e=await this.queryService.authenticationService.getAccounts(this.providerId),t=[];for(let o of e)this.queryService.authenticationMcpUsageService.readAccountUsages(this.providerId,o.label).some(r=>r.mcpServerId===this.mcpServerId)&&t.push(o.label);return t}catch{return[]}}},Lxi=class extends AH{constructor(i,e){super(i,e)}account(i){return new PBt(this.providerId,i,this.queryService)}extension(i){return new ABt(this.providerId,i,this.queryService)}mcpServer(i){return new NBt(this.providerId,i,this.queryService)}async getActiveEntities(){let i=[],e=[];try{let t=await this.queryService.authenticationService.getAccounts(this.providerId);for(let o of t){let n=this.queryService.authenticationUsageService.readAccountUsages(this.providerId,o.label);for(let s of n)i.includes(s.extensionId)||i.push(s.extensionId);let r=this.queryService.authenticationMcpUsageService.readAccountUsages(this.providerId,o.label);for(let s of r)e.includes(s.mcpServerId)||e.push(s.mcpServerId)}}catch{}return{extensions:i,mcpServers:e}}async getAccountNames(){try{return(await this.queryService.authenticationService.getAccounts(this.providerId)).map(e=>e.label)}catch{return[]}}async getUsageStats(){let i=[],e=0,t=0;try{let o=await this.queryService.authenticationService.getAccounts(this.providerId);t=o.length;for(let n of o){let r=this.queryService.authenticationUsageService.readAccountUsages(this.providerId,n.label),s=this.queryService.authenticationMcpUsageService.readAccountUsages(this.providerId,n.label),l=[...r,...s],c=l.length,u=Math.max(...l.map(p=>p.lastUsed),0);c>0&&i.push({accountName:n.label,lastUsed:u,usageCount:c})}i.sort((n,r)=>r.lastUsed-n.lastUsed),e=i.reduce((n,r)=>n+r.usageCount,0)}catch{}return{totalSessions:e,totalAccounts:t,recentActivity:i}}async forEachAccount(i){try{let e=await this.queryService.authenticationService.getAccounts(this.providerId);for(let t of e){let o=new PBt(this.providerId,t.label,this.queryService);i(o)}}catch{}}},Rxi=class{constructor(i,e){this.extensionId=i;this.queryService=e}async getProvidersWithAccess(i){let e=[],t=this.queryService.authenticationService.getProviderIds();for(let o of t)if(!(!i&&o.startsWith(oA)))try{(await this.queryService.authenticationService.getAccounts(o)).some(s=>this.queryService.authenticationAccessService.isAccessAllowed(o,s.label,this.extensionId)===!0)&&e.push(o)}catch{}return e}getAllAccountPreferences(i){let e=new Map,t=this.queryService.authenticationService.getProviderIds();for(let o of t){if(!i&&o.startsWith(oA))continue;let n=this.queryService.authenticationExtensionsService.getAccountPreference(this.extensionId,o);n&&e.set(o,n)}return e}provider(i){return new ABt(i,this.extensionId,this.queryService)}},Mxi=class{constructor(i,e){this.mcpServerId=i;this.queryService=e}async getProvidersWithAccess(i){let e=[],t=this.queryService.authenticationService.getProviderIds();for(let o of t)if(!(!i&&o.startsWith(oA)))try{(await this.queryService.authenticationService.getAccounts(o)).some(s=>this.queryService.authenticationMcpAccessService.isAccessAllowed(o,s.label,this.mcpServerId)===!0)&&e.push(o)}catch{}return e}getAllAccountPreferences(i){let e=new Map,t=this.queryService.authenticationService.getProviderIds();for(let o of t){if(!i&&o.startsWith(oA))continue;let n=this.queryService.authenticationMcpService.getAccountPreference(this.mcpServerId,o);n&&e.set(o,n)}return e}provider(i){return new NBt(i,this.mcpServerId,this.queryService)}},het=class extends x{constructor(e,t,o,n,r,s,l,c){super();this.authenticationService=e;this.authenticationUsageService=t;this.authenticationMcpUsageService=o;this.authenticationAccessService=n;this.authenticationMcpAccessService=r;this.authenticationExtensionsService=s;this.authenticationMcpService=l;this.logService=c;this._onDidChangePreferences=this._register(new E);this.onDidChangePreferences=this._onDidChangePreferences.event;this._onDidChangeAccess=this._register(new E);this.onDidChangeAccess=this._onDidChangeAccess.event;this._register(this.authenticationExtensionsService.onDidChangeAccountPreference(u=>{this._onDidChangePreferences.fire({providerId:u.providerId,entityType:"extension",entityIds:u.extensionIds})})),this._register(this.authenticationMcpService.onDidChangeAccountPreference(u=>{this._onDidChangePreferences.fire({providerId:u.providerId,entityType:"mcpServer",entityIds:u.mcpServerIds})})),this._register(this.authenticationAccessService.onDidChangeExtensionSessionAccess(u=>{this._onDidChangeAccess.fire({providerId:u.providerId,accountName:u.accountName})})),this._register(this.authenticationMcpAccessService.onDidChangeMcpSessionAccess(u=>{this._onDidChangeAccess.fire({providerId:u.providerId,accountName:u.accountName})}))}provider(e){return new Lxi(e,this)}extension(e){return new Rxi(e,this)}mcpServer(e){return new Mxi(e,this)}getProviderIds(e){return this.authenticationService.getProviderIds().filter(t=>e||!t.startsWith(oA))}async clearAllData(e,t=!0){if(e!=="CLEAR_ALL_AUTH_DATA")throw new Error("Must provide confirmation string to clear all authentication data");let o=this.getProviderIds(t);for(let n of o)try{let r=await this.authenticationService.getAccounts(n);for(let s of r)this.authenticationAccessService.removeAllowedExtensions(n,s.label),this.authenticationUsageService.removeAccountUsage(n,s.label),this.authenticationMcpAccessService.removeAllowedMcpServers(n,s.label),this.authenticationMcpUsageService.removeAccountUsage(n,s.label)}catch(r){this.logService.error(`Error clearing data for provider ${n}:`,r)}this.logService.info("All authentication data cleared")}};het=I([m(0,xs),m(1,DA),m(2,bpe),m(3,vk),m(4,vpe),m(5,jX),m(6,dXe),m(7,se)],het);Ee(fM,het,1);var nG=_;var hMe=class extends ja{constructor(e,t,o,n,r){super();this._keybindingService=t;this._configurationService=o;this._markdownRenderer=n;this._accessibilityService=r;this._messageListeners=new N;this._isDisposed=!1;this._forcePosition=!1;this._x=0;this._y=0;this._isLocked=!1;this._enableFocusTraps=!1;this._addedFocusTrap=!1;this._maxHeightRatioRelativeToWindow=.5;this._onDispose=this._register(new E);this._onRequestLayout=this._register(new E);if(this._linkHandler=e.linkHandler,this._target="targetElements"in e.target?e.target:new Pxi(e.target),e.style)switch(e.style){case 1:{e.appearance??={},e.appearance.compact??=!0,e.appearance.showPointer??=!0;break}case 2:{e.appearance??={},e.appearance.compact??=!0;break}}this._hoverPointer=e.appearance?.showPointer?nG("div.workbench-hover-pointer"):void 0,this._hover=this._register(new bY(!e.appearance?.skipFadeInAnimation)),this._hover.containerDomNode.classList.add("workbench-hover"),e.appearance?.compact&&this._hover.containerDomNode.classList.add("workbench-hover","compact"),this._hoverPointer&&this._hover.containerDomNode.classList.add("with-pointer"),e.additionalClasses&&this._hover.containerDomNode.classList.add(...e.additionalClasses),e.position?.forcePosition&&(this._forcePosition=!0),e.trapFocus&&(this._enableFocusTraps=!0);let s=e.appearance?.maxHeightRatio;s!==void 0&&s>0&&s<=1&&(this._maxHeightRatioRelativeToWindow=s),this._hoverPosition=e.position?.hoverPosition===void 0?3:Yo(e.position.hoverPosition)?e.position.hoverPosition:2,this.onmousedown(this._hover.containerDomNode,g=>g.stopPropagation()),this.onkeydown(this._hover.containerDomNode,g=>{g.equals(9)&&this.dispose()}),this._register(j(this._targetWindow,"blur",()=>this.dispose()));let l=nG("div.hover-row.markdown-hover"),c=nG("div.hover-contents");if(typeof e.content=="string")c.textContent=e.content,c.style.whiteSpace="pre-wrap";else if(Do(e.content))c.appendChild(e.content),c.classList.add("html-hover-contents");else{let g=e.content,{element:f}=this._register(this._markdownRenderer.render(g,{actionHandler:this._linkHandler,asyncRenderCallback:()=>{c.classList.add("code-hover-contents"),this.layout(),this._onRequestLayout.fire()}}));c.appendChild(f)}if(l.appendChild(c),this._hover.contentsDomNode.appendChild(l),e.actions&&e.actions.length>0){let g=nG("div.hover-row.status-bar"),f=nG("div.actions");e.actions.forEach(v=>{let b=this._keybindingService.lookupKeybinding(v.commandId),S=b?b.getLabel():null;this._register(SY.render(f,{label:v.label,commandId:v.commandId,run:y=>{v.run(y),this.dispose()},iconClass:v.iconClass},S))}),g.appendChild(f),this._hover.containerDomNode.appendChild(g)}this._hoverContainer=nG("div.workbench-hover-container"),this._hoverPointer&&this._hoverContainer.appendChild(this._hoverPointer),this._hoverContainer.appendChild(this._hover.containerDomNode);let u;if(e.actions&&e.actions.length>0?u=!1:e.persistence?.hideOnHover===void 0?u=typeof e.content=="string"||Ar(e.content)&&!e.content.value.includes("](")&&!e.content.value.includes("</a>"):u=e.persistence.hideOnHover,e.appearance?.showHoverHint){let g=nG("div.hover-row.status-bar"),f=nG("div.info");f.textContent=d(2169,null,Ze?"Option":"Alt"),g.appendChild(f),this._hover.containerDomNode.appendChild(g)}let p=[...this._target.targetElements];u||p.push(this._hoverContainer);let h=this._register(new OBt(p));if(this._register(h.onMouseOut(()=>{this._isLocked||this.dispose()})),u){let g=[...this._target.targetElements,this._hoverContainer];this._lockMouseTracker=this._register(new OBt(g)),this._register(this._lockMouseTracker.onMouseOut(()=>{this._isLocked||this.dispose()}))}else this._lockMouseTracker=h}get _targetWindow(){return Re(this._target.targetElements[0])}get _targetDocumentElement(){return Re(this._target.targetElements[0]).document.documentElement}get isDisposed(){return this._isDisposed}get isMouseIn(){return this._lockMouseTracker.isMouseIn}get domNode(){return this._hover.containerDomNode}get onDispose(){return this._onDispose.event}get onRequestLayout(){return this._onRequestLayout.event}get anchor(){return this._hoverPosition===2?0:1}get x(){return this._x}get y(){return this._y}get isLocked(){return this._isLocked}set isLocked(e){this._isLocked!==e&&(this._isLocked=e,this._hoverContainer.classList.toggle("locked",this._isLocked))}addMouseTrackingElement(e){return this._lockMouseTracker.addElement(e)}addFocusTrap(){if(!this._enableFocusTraps||this._addedFocusTrap)return;this._addedFocusTrap=!0;let e=this._hover.containerDomNode,t=this.findLastFocusableChild(this._hover.containerDomNode);if(t){let o=KS(this._hoverContainer,nG("div")),n=M(this._hoverContainer,nG("div"));o.tabIndex=0,n.tabIndex=0,this._register(j(n,"focus",r=>{e.focus(),r.preventDefault()})),this._register(j(o,"focus",r=>{t.focus(),r.preventDefault()}))}}findLastFocusableChild(e){if(e.hasChildNodes())for(let t=0;t<e.childNodes.length;t++){let o=e.childNodes.item(e.childNodes.length-t-1);if(o.nodeType===o.ELEMENT_NODE){let r=o;if(typeof r.tabIndex=="number"&&r.tabIndex>=0)return r}let n=this.findLastFocusableChild(o);if(n)return n}}render(e){e.appendChild(this._hoverContainer);let o=this._hoverContainer.contains(this._hoverContainer.ownerDocument.activeElement)&&nwt(this._configurationService.getValue("accessibility.verbosity.hover")===!0&&this._accessibilityService.isScreenReaderOptimized(),this._keybindingService.lookupKeybinding("editor.action.accessibleView")?.getAriaLabel());o&&qr(o),this.layout(),this.addFocusTrap()}layout(){this._hover.containerDomNode.classList.remove("right-aligned"),this._hover.contentsDomNode.style.maxHeight="";let e=p=>{let h=Y9(p),g=p.getBoundingClientRect();return{top:g.top*h,bottom:g.bottom*h,right:g.right*h,left:g.left*h}},t=this._target.targetElements.map(p=>e(p)),{top:o,right:n,bottom:r,left:s}=t[0],l=n-s,c=r-o,u={top:o,right:n,bottom:r,left:s,width:l,height:c,center:{x:s+l/2,y:o+c/2}};if(this.adjustHorizontalHoverPosition(u),this.adjustVerticalHoverPosition(u),this.adjustHoverMaxHeight(u),this._hoverContainer.style.padding="",this._hoverContainer.style.margin="",this._hoverPointer){switch(this._hoverPosition){case 1:u.left+=3,u.right+=3,this._hoverContainer.style.paddingLeft="3px",this._hoverContainer.style.marginLeft="-3px";break;case 0:u.left-=3,u.right-=3,this._hoverContainer.style.paddingRight="3px",this._hoverContainer.style.marginRight="-3px";break;case 2:u.top+=3,u.bottom+=3,this._hoverContainer.style.paddingTop="3px",this._hoverContainer.style.marginTop="-3px";break;case 3:u.top-=3,u.bottom-=3,this._hoverContainer.style.paddingBottom="3px",this._hoverContainer.style.marginBottom="-3px";break}u.center.x=u.left+l/2,u.center.y=u.top+c/2}this.computeXCordinate(u),this.computeYCordinate(u),this._hoverPointer&&(this._hoverPointer.classList.remove("top"),this._hoverPointer.classList.remove("left"),this._hoverPointer.classList.remove("right"),this._hoverPointer.classList.remove("bottom"),this.setHoverPointerPosition(u)),this._hover.onContentsChanged()}computeXCordinate(e){let t=this._hover.containerDomNode.clientWidth+2;this._target.x!==void 0?this._x=this._target.x:this._hoverPosition===1?this._x=e.right:this._hoverPosition===0?this._x=e.left-t:(this._hoverPointer?this._x=e.center.x-this._hover.containerDomNode.clientWidth/2:this._x=e.left,this._x+t>=this._targetDocumentElement.clientWidth&&(this._hover.containerDomNode.classList.add("right-aligned"),this._x=Math.max(this._targetDocumentElement.clientWidth-t-2,this._targetDocumentElement.clientLeft))),this._x<this._targetDocumentElement.clientLeft&&(this._x=e.left+2)}computeYCordinate(e){this._target.y!==void 0?this._y=this._target.y:this._hoverPosition===3?this._y=e.top:this._hoverPosition===2?this._y=e.bottom-2:this._hoverPointer?this._y=e.center.y+this._hover.containerDomNode.clientHeight/2:this._y=e.bottom,this._y>this._targetWindow.innerHeight&&(this._y=e.bottom)}adjustHorizontalHoverPosition(e){if(this._target.x!==void 0)return;let t=this._hoverPointer?3:0;if(this._forcePosition){let o=t+2;this._hoverPosition===1?this._hover.containerDomNode.style.maxWidth=`${this._targetDocumentElement.clientWidth-e.right-o}px`:this._hoverPosition===0&&(this._hover.containerDomNode.style.maxWidth=`${e.left-o}px`);return}this._hoverPosition===1?this._targetDocumentElement.clientWidth-e.right<this._hover.containerDomNode.clientWidth+t&&(e.left>=this._hover.containerDomNode.clientWidth+t?this._hoverPosition=0:this._hoverPosition=2):this._hoverPosition===0&&(e.left<this._hover.containerDomNode.clientWidth+t&&(this._targetDocumentElement.clientWidth-e.right>=this._hover.containerDomNode.clientWidth+t?this._hoverPosition=1:this._hoverPosition=2),e.left-this._hover.containerDomNode.clientWidth-t<=this._targetDocumentElement.clientLeft&&(this._hoverPosition=1))}adjustVerticalHoverPosition(e){if(this._target.y!==void 0||this._forcePosition)return;let t=this._hoverPointer?3:0;this._hoverPosition===3?e.top-this._hover.containerDomNode.clientHeight-t<0&&(this._hoverPosition=2):this._hoverPosition===2&&e.bottom+this._hover.containerDomNode.offsetHeight+t>this._targetWindow.innerHeight&&(this._hoverPosition=3)}adjustHoverMaxHeight(e){let t=this._targetWindow.innerHeight*this._maxHeightRatioRelativeToWindow;if(this._forcePosition){let o=(this._hoverPointer?3:0)+2;this._hoverPosition===3?t=Math.min(t,e.top-o):this._hoverPosition===2&&(t=Math.min(t,this._targetWindow.innerHeight-e.bottom-o))}if(this._hover.containerDomNode.style.maxHeight=`${t}px`,this._hover.contentsDomNode.clientHeight<this._hover.contentsDomNode.scrollHeight){let o=`${this._hover.scrollbar.options.verticalScrollbarSize}px`;this._hover.contentsDomNode.style.paddingRight!==o&&(this._hover.contentsDomNode.style.paddingRight=o)}}setHoverPointerPosition(e){if(this._hoverPointer)switch(this._hoverPosition){case 0:case 1:{this._hoverPointer.classList.add(this._hoverPosition===0?"right":"left");let t=this._hover.containerDomNode.clientHeight;t>e.height?this._hoverPointer.style.top=`${e.center.y-(this._y-t)-3}px`:this._hoverPointer.style.top=`${Math.round(t/2)-3}px`;break}case 3:case 2:{this._hoverPointer.classList.add(this._hoverPosition===3?"bottom":"top");let t=this._hover.containerDomNode.clientWidth,o=Math.round(t/2)-3,n=this._x+o;(n<e.left||n>e.right)&&(o=e.center.x-this._x-3),this._hoverPointer.style.left=`${o}px`;break}}}focus(){this._hover.containerDomNode.focus()}hide(){this.dispose()}dispose(){this._isDisposed||(this._onDispose.fire(),this._target.dispose?.(),this._hoverContainer.remove(),this._messageListeners.dispose(),super.dispose()),this._isDisposed=!0}};hMe=I([m(1,_e),m(2,B),m(3,On),m(4,Oi)],hMe);var OBt=class extends ja{constructor(e,t=200){super();this._elements=e;this._eventDebounceDelay=t;this._isMouseIn=!0;this._mouseTimer=this._register(new me);this._onMouseOut=this._register(new E);for(let o of this._elements)this.onmouseover(o,()=>this._onTargetMouseOver()),this.onmouseleave(o,()=>this._onTargetMouseLeave())}get onMouseOut(){return this._onMouseOut.event}get isMouseIn(){return this._isMouseIn}_onTargetMouseOver(){this._isMouseIn=!0,this._mouseTimer.clear()}_onTargetMouseLeave(){this._isMouseIn=!1,this._mouseTimer.value=new Ul(()=>this._fireIfMouseOutside(),this._eventDebounceDelay)}_fireIfMouseOutside(){this._isMouseIn||this._onMouseOut.fire()}addElement(e){if(this._elements.includes(e))return x.None;this._elements.push(e);let t=new N;return t.add(j(e,re.MOUSE_OVER,()=>this._onTargetMouseOver())),t.add(j(e,re.MOUSE_LEAVE,()=>this._onTargetMouseLeave())),t.add(Z(()=>{let o=this._elements.indexOf(e);o>=0&&this._elements.splice(o,1)})),t}},Pxi=class{constructor(i){this._element=i;this.targetElements=[this._element]}dispose(){}};var FBt=class{constructor(i,e,t){this.hoverDelegate=i;this.target=e;this.fadeInAnimation=t}onDidHide(){this._cancellationTokenSource&&(this._cancellationTokenSource.dispose(!0),this._cancellationTokenSource=void 0)}async update(i,e,t){if(this._cancellationTokenSource&&(this._cancellationTokenSource.dispose(!0),this._cancellationTokenSource=void 0),this.isDisposed)return;let o;if(Fe(i)||Do(i)||i===void 0)o=i;else{this._cancellationTokenSource=new Ye;let n=this._cancellationTokenSource.token,r;if(Ixe(i)?xL(i.markdown)?r=i.markdown(n).then(s=>s??i.markdownNotSupportedFallback):r=i.markdown??i.markdownNotSupportedFallback:r=i.element(n),r instanceof Promise?(this._hoverWidget||this.show(d(2170,null),e,t),o=await r):o=r,this.isDisposed||n.isCancellationRequested)return}this.show(o,e,t)}show(i,e,t){let o=this._hoverWidget;if(this.hasContent(i)){let n={content:i,target:this.target,actions:t?.actions,linkHandler:t?.linkHandler,trapFocus:t?.trapFocus,appearance:{showPointer:this.hoverDelegate.placement==="element",skipFadeInAnimation:!this.fadeInAnimation||!!o,showHoverHint:t?.appearance?.showHoverHint},position:{hoverPosition:2}};this._hoverWidget=this.hoverDelegate.showHover(n,e)}o?.dispose()}hasContent(i){return i?Ar(i)?!!i.value:!0:!1}get isDisposed(){return this._hoverWidget?.isDisposed}dispose(){this._hoverWidget?.dispose(),this._cancellationTokenSource?.dispose(!0),this._cancellationTokenSource=void 0}};var bYo=3,bet=class extends x{constructor(e,t,o,n,r,s){super();this._instantiationService=e;this._configurationService=t;this._keybindingService=n;this._layoutService=r;this._accessibilityService=s;this._hoverStack=[];this._currentDelayedHoverWasShown=!1;this._delayedHovers=new Map;this._managedHovers=new Map;this._register(o.onDidShowContextMenu(()=>this.hideHover())),this._register(Ct.registerCommandAndKeybindingRule({id:"workbench.action.showHover",weight:0,primary:Vi(2089,2087),handler:()=>{this._showAndFocusHoverForActiveElement()}}))}get _currentHover(){return this._hoverStack.at(-1)?.hover}get _currentHoverOptions(){return this._hoverStack.at(-1)?.options}_getContainingHoverIndex(e){let t=Do(e)?[e]:e.targetElements;for(let o=this._hoverStack.length-1;o>=0;o--)for(let n of t)if(ts(n,this._hoverStack[o].hover.domNode))return o;return-1}showInstantHover(e,t,o,n){let r=this._createHover(e,o);if(r)return this._showHover(r,e,t),r.hover}showDelayedHover(e,t){if(e.id===void 0&&(e.id=_uo(e.content)),!this._currentDelayedHover||this._currentDelayedHoverWasShown){if(this._currentHover?.isLocked)return;if(gMe(this._currentHoverOptions)===gMe(e))return this._currentHover;if(this._currentHover&&!this._currentHover.isDisposed&&this._currentDelayedHoverGroupId!==void 0&&this._currentDelayedHoverGroupId===t?.groupId)return this.showInstantHover({...e,appearance:{...e.appearance,skipFadeInAnimation:!0}})}else if(this._currentDelayedHover&&gMe(this._currentHoverOptions)===gMe(e))return this._currentDelayedHover;let o=this._createHover(e,void 0);if(!o){this._currentDelayedHover=void 0,this._currentDelayedHoverWasShown=!1,this._currentDelayedHoverGroupId=void 0;return}this._currentDelayedHover=o.hover,this._currentDelayedHoverWasShown=!1,this._currentDelayedHoverGroupId=t?.groupId;let n=t?.reducedDelay?this._configurationService.getValue("workbench.hover.reducedDelay"):this._configurationService.getValue("workbench.hover.delay");return Li(n).then(()=>{o.hover&&!o.hover.isDisposed&&(this._currentDelayedHoverWasShown=!0,this._showHover(o,e))}),o.hover}setupDelayedHover(e,t,o){let n=r=>{let s={...typeof t=="function"?t():t,target:e};return s.style===2&&r&&(s.target=Luo(e,r)),s};return this._setupDelayedHover(e,n,o)}setupDelayedHoverAtMouse(e,t,o){let n=r=>({...typeof t=="function"?t():t,target:r?Luo(e,r):e});return this._setupDelayedHover(e,n,o)}_setupDelayedHover(e,t,o){let n=new N;return n.add(j(e,re.MOUSE_OVER,r=>{this.showDelayedHover(t(r),{groupId:o?.groupId,reducedDelay:o?.reducedDelay})})),o?.setupKeyboardEvents&&n.add(j(e,re.KEY_DOWN,r=>{let s=new gi(r);(s.equals(10)||s.equals(3))&&this.showInstantHover(t(),!0)})),this._delayedHovers.set(e,{show:r=>{this.showInstantHover(t(),r)}}),n.add(Z(()=>this._delayedHovers.delete(e))),n}_createHover(e,t){if(this._currentDelayedHover?.dispose(),this._currentDelayedHover=void 0,e.content==="")return;if(e.id===void 0&&(e.id=_uo(e.content)),this._getContainingHoverIndex(e.target)>=0){if(this._hoverStack.length>=bYo)return}else if(this._currentHover?.isLocked||gMe(this._currentHoverOptions)===gMe(e))return;this._lastHoverOptions=e;let r=e.trapFocus||this._accessibilityService.isScreenReaderOptimized(),s=Nn(),l;t||r&&s&&(s.classList.contains("monaco-hover")||(l=s));let c=new N,u=this._instantiationService.createInstance(hMe,e);if(e.persistence?.sticky&&(u.isLocked=!0),e.position?.hoverPosition&&!Yo(e.position.hoverPosition)&&(e.target={targetElements:Do(e.target)?[e.target]:e.target.targetElements,x:e.position.hoverPosition.x+10}),u.onDispose(()=>{let p=this._hoverStack.findIndex(h=>h.hover===u);if(p>=0){let h=this._hoverStack[p];for(Gr(u.domNode)&&h.lastFocusedElementBeforeOpen&&h.lastFocusedElementBeforeOpen.focus();this._hoverStack.length>p+1;){let f=this._hoverStack.pop();f.contextView.dispose(),f.hover.dispose()}this._hoverStack.splice(p,1),h.contextView.dispose()}c.dispose()},void 0,c),!e.container){let p=Do(e.target)?e.target:e.target.targetElements[0];e.container=this._layoutService.getContainer(Re(p))}if(e.persistence?.sticky)c.add(j(Re(e.container).document,re.MOUSE_DOWN,p=>{ts(p.target,u.domNode)||this._hideHoverAndDescendants(u)}));else{if("targetElements"in e.target)for(let h of e.target.targetElements)c.add(j(h,re.CLICK,()=>this._hideHoverAndDescendants(u)));else c.add(j(e.target,re.CLICK,()=>this._hideHoverAndDescendants(u)));let p=Nn();if(p){let h=Re(p).document;c.add(j(p,re.KEY_DOWN,g=>this._keyDown(g,u,!!e.persistence?.hideOnKeyDown))),c.add(j(h,re.KEY_DOWN,g=>this._keyDown(g,u,!!e.persistence?.hideOnKeyDown))),c.add(j(p,re.KEY_UP,g=>this._keyUp(g,u))),c.add(j(h,re.KEY_UP,g=>this._keyUp(g,u)))}}if("IntersectionObserver"in ut){let p=new IntersectionObserver(g=>this._intersectionChange(g,u),{threshold:0}),h="targetElements"in e.target?e.target.targetElements[0]:e.target;p.observe(h),c.add(Z(()=>p.disconnect()))}return{hover:u,lastFocusedElementBeforeOpen:l,store:c}}_showHover(e,t,o){let{hover:n,lastFocusedElementBeforeOpen:r,store:s}=e,l=this._getContainingHoverIndex(t.target),c=l>=0;if(!c)this._hideAllHovers();else{for(let f=this._hoverStack.length-1;f>l;f--)this._hoverStack[f].hover.dispose();this._hoverStack.length=l+1}if(c)for(let f=0;f<=l;f++)s.add(this._hoverStack[f].hover.addMouseTrackingElement(n.domNode));let u=t.container??this._layoutService.getContainer(Re(Do(t.target)?t.target:t.target.targetElements[0])),p=new TCe(u,1),h={hover:n,options:t,contextView:p,lastFocusedElementBeforeOpen:r};this._hoverStack.push(h);let g=new Nxi(n,o,this._hoverStack.length);p.show(g),s.add(n.onRequestLayout(()=>p.layout())),t.onDidShow?.()}_hideHoverAndDescendants(e){let t=this._hoverStack.findIndex(o=>o.hover===e);if(!(t<0)){for(let o=this._hoverStack.length-1;o>=t;o--)this._hoverStack[o].hover.dispose();this._hoverStack.length=t}}_hideAllHovers(){for(let e=this._hoverStack.length-1;e>=0;e--)this._hoverStack[e].hover.dispose();this._hoverStack.length=0}hideHover(e){this._hoverStack.length!==0&&(!e&&this._currentHover?.isLocked||this.doHideHover())}doHideHover(){let e=this._hoverStack.length;this._hoverStack[e-1]?.hover.dispose(),this._hoverStack.length=e-1}_intersectionChange(e,t){e[e.length-1].isIntersecting||t.dispose()}showAndFocusLastHover(){this._lastHoverOptions&&this.showInstantHover(this._lastHoverOptions,!0,!0)}_showAndFocusHoverForActiveElement(){let e=Nn();for(;e;){let t=this._delayedHovers.get(e)??this._managedHovers.get(e);if(t){t.show(!0);return}e=e.parentElement}}_keyDown(e,t,o){if(e.key==="Alt"){for(let s of this._hoverStack)s.hover.isLocked=!0;return}let n=new gi(e);if(!(this._keybindingService.resolveKeyboardEvent(n).getSingleModifierDispatchChords().some(s=>!!s)||this._keybindingService.softDispatch(n,n.target).kind!==0)&&o&&(!this._currentHoverOptions?.trapFocus||e.key!=="Tab")){let s=this._hoverStack.find(l=>l.hover===t);this._hideHoverAndDescendants(t),s?.lastFocusedElementBeforeOpen?.focus()}}_keyUp(e,t){if(e.key==="Alt"){for(let n of this._hoverStack)n.options.persistence?.sticky||(n.hover.isLocked=!1);if(!this._hoverStack.some(n=>n.hover.isMouseIn)){let n=this._hoverStack[this._hoverStack.length-1];this._hideAllHovers(),n?.lastFocusedElementBeforeOpen?.focus()}}}setupManagedHover(e,t,o,n){if(e.showNativeHover)return SYo(t,o);t.setAttribute("custom-hover","true"),t.title!==""&&(console.warn("HTML element already has a title attribute, which will conflict with the custom hover. Please remove the title attribute."),t.title="");let r,s,l=(f,v)=>{let b=s!==void 0;f&&(s?.dispose(),s=void 0),v&&(r?.dispose(),r=void 0),b&&(e.onDidHideHover?.(),s=void 0)},c=(f,v,b,S)=>new Ul(async()=>{(!s||s.isDisposed)&&(s=new FBt(e,b||t,f>0),await s.update(typeof o=="function"?o():o,v,{...n,trapFocus:S}))},f),u=new N,p=!1;u.add(j(t,re.MOUSE_DOWN,()=>{p=!0,l(!0,!0)},!0)),u.add(j(t,re.MOUSE_UP,()=>{p=!1},!0)),u.add(j(t,re.MOUSE_LEAVE,f=>{p=!1,l(!1,f.fromElement===t)},!0)),u.add(j(t,re.MOUSE_OVER,f=>{if(r)return;let v=new N,b={targetElements:[t],dispose:()=>{}};if(e.placement===void 0||e.placement==="mouse"){let S=y=>{b.x=y.x+10,Axi(y,t)||l(!0,!0)};v.add(j(t,re.MOUSE_MOVE,S,!0))}r=v,Axi(f,t)&&v.add(c(typeof e.delay=="function"?e.delay(o):e.delay,!1,b))},!0));let h=f=>{if(p||r||!Axi(f,t))return;let v={targetElements:[t],dispose:()=>{}},b=new N,S=()=>l(!0,!0);b.add(j(t,re.BLUR,S,!0)),b.add(c(typeof e.delay=="function"?e.delay(o):e.delay,!1,v)),r=b};Kh(t)||u.add(j(t,re.FOCUS,h,!0));let g={show:f=>{l(!1,!0),c(0,f,void 0,f)},hide:()=>{l(!0,!0)},update:async(f,v)=>{o=f,await s?.update(o,void 0,v)},dispose:()=>{this._managedHovers.delete(t),u.dispose(),l(!0,!0)}};return this._managedHovers.set(t,g),g}showManagedHover(e){let t=this._managedHovers.get(e);t&&t.show(!0)}dispose(){this._managedHovers.forEach(e=>e.dispose()),super.dispose()}};bet=I([m(0,F),m(1,B),m(2,Xe),m(3,_e),m(4,Kl),m(5,Oi)],bet);function gMe(a){if(a!==void 0)return a?.id??a}function _uo(a){if(!Do(a))return typeof a=="string"?a.toString():a.value}function Duo(a){let i=typeof a=="function"?a():a;if(Fe(i))return Nu(i);if(Ixe(i))return i.markdownNotSupportedFallback}function SYo(a,i){function e(t){t?a.setAttribute("title",t):a.removeAttribute("title")}return e(Duo(i)),{update:t=>e(Duo(t)),show:()=>{},hide:()=>{},dispose:()=>e(void 0)}}var Nxi=class{constructor(i,e=!1,t=1){this._hover=i;this._focus=e;this.layer=t}get anchorPosition(){return this._hover.anchor}render(i){return this._hover.render(i),this._focus&&this._hover.focus(),this._hover}getAnchor(){return{x:this._hover.x,y:this._hover.y}}layout(){this._hover.layout()}};function Axi(a,i){return Do(a.target)&&IYo(a.target,i)===i}function IYo(a,i){for(i=i??Re(a).document.body;!a.hasAttribute("custom-hover")&&a!==i;)a=a.parentElement;return a}function Luo(a,i){return{targetElements:[a],x:i.x+10}}Ee(nt,bet,1);is((a,i)=>{let e=a.getColor(G1);e&&(i.addRule(`.monaco-hover.workbench-hover .hover-row:not(:first-child):not(:empty) { border-top: 1px solid ${e.transparent(.5)}; }`),i.addRule(`.monaco-hover.workbench-hover hr { border-top: 1px solid ${e.transparent(.5)}; }`))});var Oxi=class{constructor(){this._modifierObservables=new WeakMap}readModifierKeyStatus(i,e){let t=i instanceof Window?i:Re(i),o=this._modifierObservables.get(t);if(!o){let n=nb.getInstance();o=ui(this,n.event,()=>({ctrlKey:n.keyStatus.ctrlKey,shiftKey:n.keyStatus.shiftKey,altKey:n.keyStatus.altKey,metaKey:n.keyStatus.metaKey})),this._modifierObservables.set(t,o)}return o.read(e)}createFocusTracker(i,e){let t=e.add(qn(i)),n=Me("isFocused",(r=>{if(r instanceof Window)return r.document.hasFocus();let s=r.getRootNode()instanceof ShadowRoot?r.getRootNode():null,l=s?s.activeElement:r.ownerDocument.activeElement;return r.contains(l)})(i));return e.add(t.onDidFocus(()=>n.set(!0,void 0))),e.add(t.onDidBlur(()=>n.set(!1,void 0))),n}createHoverTracker(i,e){let t=Me("isHovered",!1),o=()=>t.set(!0,void 0),n=()=>t.set(!1,void 0);return i.addEventListener("mouseenter",o),i.addEventListener("mouseleave",n),e.add({dispose:()=>{i.removeEventListener("mouseenter",o),i.removeEventListener("mouseleave",n)}}),t}createDomFocusTracker(i){return qn(i)}};Ee(_C,Oxi,1);var Fxi=class{constructor(){this._factories=new qs;this._onDidChange=new E;this.onDidChange=this._onDidChange.event}canCreateOutline(i){for(let e of this._factories)if(e.matches(i))return!0;return!1}async createOutline(i,e,t){for(let o of this._factories)if(o.matches(i))return await o.createOutline(i,e,t)}registerOutlineCreator(i){let e=this._factories.push(i);return this._onDidChange.fire(),Z(()=>{e(),this._onDidChange.fire()})}};Ee(cM,Fxi,1);var yYo="diagnosticsService",fMe=le(yYo);function U0(a){let i=a;return!!i?.hostName&&!!i?.errorMessage}var WBt=class a{static{this.CHANNEL_NAME="languageDetectionWorkerHost"}static getChannel(i){return i.getChannel(a.CHANNEL_NAME)}static setChannel(i,e){i.setChannel(a.CHANNEL_NAME,e)}};var VBt=12,wYo=`${tO}/vscode-regexp-languagedetection`,CYo=`${H9}/vscode-regexp-languagedetection`,Wxi=`${tO}/@vscode/vscode-languagedetection`,Vxi=`${H9}/@vscode/vscode-languagedetection`,qA=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this._environmentService=e;this._configurationService=o;this._diagnosticsService=n;this._workspaceContextService=r;this._editorService=l;this._logService=p;this.hasResolvedWorkspaceLanguageIds=!1;this.workspaceLanguageIds=new Set;this.sessionOpenedLanguageIds=new Set;this.historicalGlobalOpenedLanguageIds=new dl(VBt);this.historicalWorkspaceOpenedLanguageIds=new dl(VBt);this.dirtyBiases=!0;this.langBiases={};let g=QK&&this._environmentService.isBuilt&&!Wt;this._languageDetectionWorkerClient=this._register(new Bxi(s,t,c,h,g?vn.asBrowserUri(`${Vxi}/dist/lib/index.js`).toString(!0):vn.asBrowserUri(`${Wxi}/dist/lib/index.js`).toString(!0),g?vn.asBrowserUri(`${Vxi}/model/model.json`).toString(!0):vn.asBrowserUri(`${Wxi}/model/model.json`).toString(!0),g?vn.asBrowserUri(`${Vxi}/model/group1-shard1of1.bin`).toString(!0):vn.asBrowserUri(`${Wxi}/model/group1-shard1of1.bin`).toString(!0),g?vn.asBrowserUri(`${CYo}/dist/index.js`).toString(!0):vn.asBrowserUri(`${wYo}/dist/index.js`).toString(!0))),this.initEditorOpenedListeners(u)}static{this.enablementSettingKey="workbench.editor.languageDetection"}static{this.historyBasedEnablementConfig="workbench.editor.historyBasedLanguageDetection"}static{this.preferHistoryConfig="workbench.editor.preferHistoryBasedLanguageDetection"}static{this.workspaceOpenedLanguagesStorageKey="workbench.editor.languageDetectionOpenedLanguages.workspace"}static{this.globalOpenedLanguagesStorageKey="workbench.editor.languageDetectionOpenedLanguages.global"}async resolveWorkspaceLanguageIds(){if(this.hasResolvedWorkspaceLanguageIds)return;this.hasResolvedWorkspaceLanguageIds=!0;let e=await this._diagnosticsService.getWorkspaceFileExtensions(this._workspaceContextService.getWorkspace()),t=0;for(let o of e.extensions){let n=this._languageDetectionWorkerClient.getLanguageId(o);if(n&&t<VBt&&(this.workspaceLanguageIds.add(n),t++,t>VBt))break}this.dirtyBiases=!0}isEnabledForLanguage(e){return!!e&&this._configurationService.getValue(qA.enablementSettingKey,{overrideIdentifier:e})}getLanguageBiases(){if(!this.dirtyBiases)return this.langBiases;let e={};return this.sessionOpenedLanguageIds.forEach(t=>e[t]=(e[t]??0)+7),this.workspaceLanguageIds.forEach(t=>e[t]=(e[t]??0)+5),[...this.historicalWorkspaceOpenedLanguageIds.keys()].forEach(t=>e[t]=(e[t]??0)+3),[...this.historicalGlobalOpenedLanguageIds.keys()].forEach(t=>e[t]=(e[t]??0)+1),this._logService.trace("Session Languages:",JSON.stringify([...this.sessionOpenedLanguageIds])),this._logService.trace("Workspace Languages:",JSON.stringify([...this.workspaceLanguageIds])),this._logService.trace("Historical Workspace Opened Languages:",JSON.stringify([...this.historicalWorkspaceOpenedLanguageIds.keys()])),this._logService.trace("Historical Globally Opened Languages:",JSON.stringify([...this.historicalGlobalOpenedLanguageIds.keys()])),this._logService.trace("Computed Language Detection Biases:",JSON.stringify(e)),this.dirtyBiases=!1,this.langBiases=e,e}async detectLanguage(e,t){let o=this._configurationService.getValue(qA.historyBasedEnablementConfig),n=this._configurationService.getValue(qA.preferHistoryConfig);o&&await this.resolveWorkspaceLanguageIds();let r=o?this.getLanguageBiases():void 0;return this._languageDetectionWorkerClient.detectLanguage(e,r,n,t)}initEditorOpenedListeners(e){try{let t=JSON.parse(e.get(qA.globalOpenedLanguagesStorageKey,0,"[]"));this.historicalGlobalOpenedLanguageIds.fromJSON(t)}catch(t){console.error(t)}try{let t=JSON.parse(e.get(qA.workspaceOpenedLanguagesStorageKey,1,"[]"));this.historicalWorkspaceOpenedLanguageIds.fromJSON(t)}catch(t){console.error(t)}this._register(this._editorService.onDidActiveEditorChange(()=>{let t=this._editorService.activeTextEditorLanguageId;t&&this._editorService.activeEditor?.resource?.scheme!==Q.untitled&&(this.sessionOpenedLanguageIds.add(t),this.historicalGlobalOpenedLanguageIds.set(t,!0),this.historicalWorkspaceOpenedLanguageIds.set(t,!0),e.store(qA.globalOpenedLanguagesStorageKey,JSON.stringify(this.historicalGlobalOpenedLanguageIds.toJSON()),0,1),e.store(qA.workspaceOpenedLanguagesStorageKey,JSON.stringify(this.historicalWorkspaceOpenedLanguageIds.toJSON()),1,1),this.dirtyBiases=!0)}))}};qA=I([m(0,At),m(1,_t),m(2,B),m(3,fMe),m(4,Pe),m(5,Tt),m(6,ee),m(7,Te),m(8,ce),m(9,se),m(10,Zy)],qA);var Bxi=class extends x{constructor(e,t,o,n,r,s,l,c){super();this._modelService=e;this._languageService=t;this._telemetryService=o;this._webWorkerService=n;this._indexJsUri=r;this._modelJsonUri=s;this._weightsUri=l;this._regexpModelUri=c}_getOrCreateLanguageDetectionWorker(){if(!this.worker){let e=this._register(this._webWorkerService.createWorkerClient(new Ux({esmModuleLocation:vn.asBrowserUri("vs/workbench/services/languageDetection/browser/languageDetectionWebWorkerMain.js"),label:"LanguageDetectionWorker"})));WBt.setChannel(e,{$getIndexJsUri:async()=>this.getIndexJsUri(),$getLanguageId:async o=>this.getLanguageId(o),$sendTelemetryEvent:async(o,n,r)=>this.sendTelemetryEvent(o,n,r),$getRegexpModelUri:async()=>this.getRegexpModelUri(),$getModelJsonUri:async()=>this.getModelJsonUri(),$getWeightsUri:async()=>this.getWeightsUri()});let t=this._register(y7.create(e,this._modelService));this.worker={workerClient:e,workerTextModelSyncClient:t}}return this.worker}_guessLanguageIdByUri(e){let t=this._languageService.guessLanguageIdByFilepathOrFirstLine(e);if(t&&t!=="unknown")return t}async getIndexJsUri(){return this._indexJsUri}getLanguageId(e){if(!e)return;if(this._languageService.isRegisteredLanguageId(e))return e;let t=this._guessLanguageIdByUri(A.file(`file.${e}`));if(!(!t||t==="unknown"))return t}async getModelJsonUri(){return this._modelJsonUri}async getWeightsUri(){return this._weightsUri}async getRegexpModelUri(){return this._regexpModelUri}async sendTelemetryEvent(e,t,o){this._telemetryService.publicLog2(feo,{languages:e.join(","),confidences:t.join(","),timeSpent:o})}async detectLanguage(e,t,o,n){let r=Date.now(),s=this._guessLanguageIdByUri(e);if(s)return s;let{workerClient:l,workerTextModelSyncClient:c}=this._getOrCreateLanguageDetectionWorker();c.ensureSyncedResources([e]);let u=await l.proxy.$detectLanguage(e.toString(),t,o,n),p=this.getLanguageId(u);return this._telemetryService.publicLog2("automaticlanguagedetection.perf",{timeSpent:Date.now()-r,detection:p||"unknown"}),p}};Ee(vS,qA,0);var Hxi=class{constructor(){this.referenceProvider=new _d(this._score.bind(this));this.renameProvider=new _d(this._score.bind(this));this.newSymbolNamesProvider=new _d(this._score.bind(this));this.codeActionProvider=new _d(this._score.bind(this));this.definitionProvider=new _d(this._score.bind(this));this.typeDefinitionProvider=new _d(this._score.bind(this));this.declarationProvider=new _d(this._score.bind(this));this.implementationProvider=new _d(this._score.bind(this));this.documentSymbolProvider=new _d(this._score.bind(this));this.inlayHintsProvider=new _d(this._score.bind(this));this.colorProvider=new _d(this._score.bind(this));this.codeLensProvider=new _d(this._score.bind(this));this.documentFormattingEditProvider=new _d(this._score.bind(this));this.documentRangeFormattingEditProvider=new _d(this._score.bind(this));this.onTypeFormattingEditProvider=new _d(this._score.bind(this));this.signatureHelpProvider=new _d(this._score.bind(this));this.hoverProvider=new _d(this._score.bind(this));this.documentHighlightProvider=new _d(this._score.bind(this));this.multiDocumentHighlightProvider=new _d(this._score.bind(this));this.selectionRangeProvider=new _d(this._score.bind(this));this.foldingRangeProvider=new _d(this._score.bind(this));this.linkProvider=new _d(this._score.bind(this));this.inlineCompletionsProvider=new _d(this._score.bind(this));this.completionProvider=new _d(this._score.bind(this));this.linkedEditingRangeProvider=new _d(this._score.bind(this));this.inlineValuesProvider=new _d(this._score.bind(this));this.evaluatableExpressionProvider=new _d(this._score.bind(this));this.documentRangeSemanticTokensProvider=new _d(this._score.bind(this));this.documentSemanticTokensProvider=new _d(this._score.bind(this));this.documentDropEditProvider=new _d(this._score.bind(this));this.documentPasteEditProvider=new _d(this._score.bind(this))}setNotebookTypeResolver(i){this._notebookTypeResolver=i}_score(i){return this._notebookTypeResolver?.(i)}};Ee(Qt,Hxi,1);var Iet=class extends x{constructor(e,t,o){super();this._themeService=e;this._logService=t;this._languageService=o;this._caches=new WeakMap,this._register(this._themeService.onDidColorThemeChange(()=>{this._caches=new WeakMap}))}getStyling(e){return this._caches.has(e)||this._caches.set(e,new zke(e.getLegend(),this._themeService,this._languageService,this._logService)),this._caches.get(e)}};Iet=I([m(0,Le),m(1,se),m(2,_t)],Iet);Ee(ude,Iet,1);var Z3=le("textMateTokenizationFeature");var BBt=class extends x{constructor(e,t,o,n,r,s,l){super();this._grammar=e;this._initialState=t;this._containsEmbeddedLanguages=o;this._createBackgroundTokenizer=n;this._backgroundTokenizerShouldOnlyVerifyTokens=r;this._reportTokenizationTime=s;this._reportSlowTokenization=l;this._seenLanguages=[];this._onDidEncounterLanguage=this._register(new E)}get onDidEncounterLanguage(){return this._onDidEncounterLanguage.event}get backgroundTokenizerShouldOnlyVerifyTokens(){return this._backgroundTokenizerShouldOnlyVerifyTokens()}getInitialState(){return this._initialState}tokenize(e,t,o){throw new Error("Not supported!")}createBackgroundTokenizer(e,t){if(this._createBackgroundTokenizer)return this._createBackgroundTokenizer(e,t)}tokenizeEncoded(e,t,o){let n=Math.random()*1e4<1,r=this._reportSlowTokenization||n,s=r?new Dn(!0):void 0,l=this._grammar.tokenizeLine2(e,o,500);if(r){let u=s.elapsed();(n||u>32)&&this._reportTokenizationTime(u,e.length,n)}if(l.stoppedEarly)return console.warn(`Time limit reached when tokenizing line: ${e.substring(0,100)}`),new Gae(l.tokens,l.fonts,o);if(this._containsEmbeddedLanguages){let u=this._seenLanguages,p=l.tokens;for(let h=0,g=p.length>>>1;h<g;h++){let f=p[(h<<1)+1],v=bp.getLanguageId(f);u[v]||(u[v]=!0,this._onDidEncounterLanguage.fire(v))}}let c;return o.equals(l.ruleStack)?c=o:c=l.ruleStack,new Gae(l.tokens,l.fonts,c)}};var HBt=class extends x{constructor(e,t,o,n){super();this._encodedLanguageId=e;this._actual=t;this._maxTokenizationLineLength=n;this._register(I1(this._maxTokenizationLineLength)),this._register(o)}get backgroundTokenizerShouldOnlyVerifyTokens(){return this._actual.backgroundTokenizerShouldOnlyVerifyTokens}getInitialState(){return this._actual.getInitialState()}tokenize(e,t,o){throw new Error("Not supported!")}tokenizeEncoded(e,t,o){return e.length>=this._maxTokenizationLineLength.get()?sCe(this._encodedLanguageId,o):this._actual.tokenizeEncoded(e,t,o)}createBackgroundTokenizer(e,t){if(this._actual.createBackgroundTokenizer)return this._actual.createBackgroundTokenizer(e,t)}};var UBt=class a{static{this.CHANNEL_NAME="textMateWorkerHost"}static getChannel(i){return i.getChannel(a.CHANNEL_NAME)}static setChannel(i,e){i.setChannel(a.CHANNEL_NAME,e)}};var yet=class a{constructor(i){this.transformation=i;this.idx=0;this.offset=0}static fromMany(i){let e=i.map(t=>new a(t));return new Uxi(e)}transform(i){let e=this.transformation.replacements.at(this.idx);for(;e&&e.replaceRange.endExclusive<=i;)this.offset+=e.getLengthDelta(),this.idx++,e=this.transformation.replacements.at(this.idx);if(!(e&&e.replaceRange.start<=i))return i+this.offset}},Uxi=class{constructor(i){this.transformers=i}transform(i){for(let e of this.transformers){let t=e.transform(i);if(t===void 0)return;i=t}return i}};var zBt=class a extends x{constructor(e,t,o,n,r,s){super();this._model=e;this._worker=t;this._languageIdCodec=o;this._backgroundTokenizationStore=n;this._configurationService=r;this._maxTokenizationLineLength=s;this.controllerId=a._id++,this._pendingChanges=[],this._states=new F5e,this._loggingEnabled=hr("editor.experimental.asyncTokenizationLogging",!1,this._configurationService),this._register(I1(this._loggingEnabled)),this._register(this._model.onDidChangeContent(u=>{this._shouldLog&&console.log("model change",{fileName:this._model.uri.fsPath.split("\\").pop(),changes:zxi(u.changes)}),this._worker.$acceptModelChanged(this.controllerId,u),this._pendingChanges.push(u)})),this._register(this._model.onDidChangeLanguage(u=>{let p=this._model.getLanguageId(),h=this._languageIdCodec.encodeLanguageId(p);this._worker.$acceptModelLanguageChanged(this.controllerId,p,h)}));let l=this._model.getLanguageId(),c=this._languageIdCodec.encodeLanguageId(l);this._worker.$acceptNewModel({uri:this._model.uri,versionId:this._model.getVersionId(),lines:this._model.getLinesContent(),EOL:this._model.getEOL(),languageId:l,encodedLanguageId:c,maxTokenizationLineLength:this._maxTokenizationLineLength.get(),controllerId:this.controllerId}),this._register(be(u=>{let p=this._maxTokenizationLineLength.read(u);this._worker.$acceptMaxTokenizationLineLength(this.controllerId,p)}))}static{this._id=0}dispose(){super.dispose(),this._worker.$acceptRemovedModel(this.controllerId)}requestTokens(e,t){this._worker.$retokenize(this.controllerId,e,t)}async setTokensAndStates(e,t,o,n,r){if(this.controllerId!==e)return;let s=uz.deserialize(new Uint8Array(o)),l=nCe.deserialize(n,o8i());if(this._shouldLog&&console.log("received background tokenization result",{fileName:this._model.uri.fsPath.split("\\").pop(),updatedTokenLines:s.map(u=>u.getLineRange()).join(" & "),updatedStateLines:r.map(u=>new uo(u.startLineNumber,u.startLineNumber+u.stateDeltas.length).toString()).join(" & ")}),this._shouldLog){let u=this._pendingChanges.filter(p=>p.versionId<=t).map(p=>p.changes).map(p=>zxi(p)).join(" then ");console.log("Applying changes to local states",u)}for(;this._pendingChanges.length>0&&this._pendingChanges[0].versionId<=t;){let u=this._pendingChanges.shift();this._states.acceptChanges(u.changes)}if(this._pendingChanges.length>0){if(this._shouldLog){let h=this._pendingChanges.map(g=>g.changes).map(g=>zxi(g)).join(" then ");console.log("Considering non-processed changes",h)}let u=yet.fromMany(this._pendingChanges.map(h=>Voi(h.changes))),p=new uz;for(let h of s)for(let g=h.startLineNumber;g<=h.endLineNumber;g++)u.transform(g-1)!==void 0&&p.add(g,h.getLineTokens(g));s=p.finalize();for(let h of this._pendingChanges)for(let g of h.changes)for(let f=0;f<s.length;f++)s[f].applyEdit(g.range,g.text);l.rebase(this._stringEditFromChanges(this._model,this._pendingChanges))}let c=yet.fromMany(this._pendingChanges.map(u=>Voi(u.changes)));if(!this._applyStateStackDiffFn||!this._initialState){let{applyStateStackDiff:u,INITIAL:p}=await Pg("vscode-textmate","release/main.js");this._applyStateStackDiffFn=u,this._initialState=p}for(let u of r){let p=u.startLineNumber<=1?this._initialState:this._states.getEndState(u.startLineNumber-1);for(let h=0;h<u.stateDeltas.length;h++){let g=u.stateDeltas[h],f;g?(f=this._applyStateStackDiffFn(p,g),this._states.setEndState(u.startLineNumber+h,f)):f=this._states.getEndState(u.startLineNumber+h);let v=c.transform(u.startLineNumber+h-1);v!==void 0&&this._backgroundTokenizationStore.setEndState(v+1,f),u.startLineNumber+h>=this._model.getLineCount()-1&&this._backgroundTokenizationStore.backgroundTokenizationFinished(),p=f}}this._backgroundTokenizationStore.setTokens(s),this._backgroundTokenizationStore.setFontInfo(l)}_stringEditFromChanges(e,t){let o=[];for(let n of t)for(let r of n.changes){let s=z.lift(r.range),l=r.text,c=e.getOffsetAt(s.getStartPosition()),u=e.getOffsetAt(s.getEndPosition());o.push(ld.replace(new pi(c,u),l))}return ld.compose(o)}get _shouldLog(){return this._loggingEnabled.get()}};function zxi(a){return a.map(i=>z.lift(i.range).toString()+" => "+i.text).join(" & ")}var e8=class{constructor(i,e,t,o,n,r,s,l,c){this._reportTokenizationTime=i;this._shouldTokenizeAsync=e;this._extensionResourceLoaderService=t;this._configurationService=o;this._languageService=n;this._environmentService=r;this._notificationService=s;this._telemetryService=l;this._webWorkerService=c;this._workerProxyPromise=null;this._worker=null;this._workerProxy=null;this._workerTokenizerControllers=new Map;this._currentTheme=null;this._currentTokenColorMap=null;this._grammarDefinitions=[]}static{this._reportedMismatchingTokens=!1}dispose(){this._disposeWorker()}createBackgroundTokenizer(i,e,t){if(!this._shouldTokenizeAsync()||i.isTooLargeForSyncing())return;let o=new N,n=this._getWorkerProxy().then(r=>{if(o.isDisposed||!r)return;let s={controller:void 0,worker:this._worker};return o.add(xYo(i,()=>{let l=new zBt(i,r,this._languageService.languageIdCodec,e,this._configurationService,t);return s.controller=l,this._workerTokenizerControllers.set(l.controllerId,l),Z(()=>{s.controller=void 0,this._workerTokenizerControllers.delete(l.controllerId),l.dispose()})})),s});return{dispose(){o.dispose()},requestTokens:async(r,s)=>{let l=await n;l?.controller&&l.worker===this._worker&&l.controller.requestTokens(r,s)},reportMismatchingTokens:r=>{e8._reportedMismatchingTokens||(e8._reportedMismatchingTokens=!0,this._notificationService.error({message:"Async Tokenization Token Mismatch in line "+r,name:"Async Tokenization Token Mismatch"}),this._telemetryService.publicLog2("asyncTokenizationMismatchingTokens",{}))}}}setGrammarDefinitions(i){this._grammarDefinitions=i,this._disposeWorker()}acceptTheme(i,e){this._currentTheme=i,this._currentTokenColorMap=e,this._currentTheme&&this._currentTokenColorMap&&this._workerProxy&&this._workerProxy.$acceptTheme(this._currentTheme,this._currentTokenColorMap)}_getWorkerProxy(){return this._workerProxyPromise||(this._workerProxyPromise=this._createWorkerProxy()),this._workerProxyPromise}async _createWorkerProxy(){let i=`${tO}/vscode-oniguruma`,e=`${H9}/vscode-oniguruma`,n=`${QK&&this._environmentService.isBuilt&&!Wt?e:i}/release/onig.wasm`,r={grammarDefinitions:this._grammarDefinitions,onigurumaWASMUri:vn.asBrowserUri(n).toString(!0)},s=this._worker=this._webWorkerService.createWorkerClient(new Ux({esmModuleLocation:vn.asBrowserUri("vs/workbench/services/textMate/browser/backgroundTokenization/worker/textMateTokenizationWorker.workerMain.js"),label:"TextMateWorker"}));return UBt.setChannel(s,{$readFile:async l=>{let c=A.revive(l);return this._extensionResourceLoaderService.readExtensionResource(c)},$setTokensAndStates:async(l,c,u,p,h)=>{let g=this._workerTokenizerControllers.get(l);g&&g.setTokensAndStates(l,c,u,p,h)},$reportTokenizationTime:(l,c,u,p,h)=>{this._reportTokenizationTime(l,c,u,p,h)}}),await s.proxy.$init(r),this._worker!==s?null:(this._workerProxy=s.proxy,this._currentTheme&&this._currentTokenColorMap&&this._workerProxy.$acceptTheme(this._currentTheme,this._currentTokenColorMap),s.proxy)}_disposeWorker(){for(let i of this._workerTokenizerControllers.values())i.dispose();this._workerTokenizerControllers.clear(),this._worker&&(this._worker.dispose(),this._worker=null),this._workerProxy=null,this._workerProxyPromise=null}};e8=I([m(2,mk),m(3,B),m(4,_t),m(5,Eo),m(6,Ne),m(7,Te),m(8,Zy)],e8);function xYo(a,i){let e=new N,t=e.add(new N);function o(){a.isAttachedToEditor()?t.add(i()):t.clear()}return o(),e.add(a.onDidChangeAttached(()=>{o()})),e}var KBt=class{constructor(){this._scopeNameToLanguageRegistration=Object.create(null)}reset(){this._scopeNameToLanguageRegistration=Object.create(null)}register(i){if(this._scopeNameToLanguageRegistration[i.scopeName]){let e=this._scopeNameToLanguageRegistration[i.scopeName];Qe(e.location,i.location)||console.warn(`Overwriting grammar scope name to file mapping for scope ${i.scopeName}.
Old grammar file: ${e.location.toString()}.
New grammar file: ${i.location.toString()}`)}this._scopeNameToLanguageRegistration[i.scopeName]=i}getGrammarDefinition(i){return this._scopeNameToLanguageRegistration[i]||null}};var wet="No TM Grammar registered for this language.",GBt=class extends x{constructor(i,e,t,o){super(),this._host=i,this._initialState=t.INITIAL,this._scopeRegistry=new KBt,this._injections={},this._injectedEmbeddedLanguages={},this._languageToScope=new Map,this._grammarRegistry=this._register(new t.Registry({onigLib:o,loadGrammar:async n=>{let r=this._scopeRegistry.getGrammarDefinition(n);if(!r)return this._host.logTrace(`No grammar found for scope ${n}`),null;let s=r.location;try{let l=await this._host.readFile(s);return t.parseRawGrammar(l,s.path)}catch(l){return this._host.logError(`Unable to load and parse grammar for scope ${n} from ${s}`,l),null}},getInjections:n=>{let r=n.split("."),s=[];for(let l=1;l<=r.length;l++){let c=r.slice(0,l).join(".");s=[...s,...this._injections[c]||[]]}return s}}));for(let n of e){if(this._scopeRegistry.register(n),n.injectTo){for(let r of n.injectTo){let s=this._injections[r];s||(this._injections[r]=s=[]),s.push(n.scopeName)}if(n.embeddedLanguages)for(let r of n.injectTo){let s=this._injectedEmbeddedLanguages[r];s||(this._injectedEmbeddedLanguages[r]=s=[]),s.push(n.embeddedLanguages)}}n.language&&this._languageToScope.set(n.language,n.scopeName)}}has(i){return this._languageToScope.has(i)}setTheme(i,e){this._grammarRegistry.setTheme(i,e)}getColorMap(){return this._grammarRegistry.getColorMap()}async createGrammar(i,e){let t=this._languageToScope.get(i);if(typeof t!="string")throw new Error(wet);let o=this._scopeRegistry.getGrammarDefinition(t);if(!o)throw new Error(wet);let n=o.embeddedLanguages;if(this._injectedEmbeddedLanguages[t]){let l=this._injectedEmbeddedLanguages[t];for(let c of l)for(let u of Object.keys(c))n[u]=c[u]}let r=Object.keys(n).length>0,s;try{s=await this._grammarRegistry.loadGrammarWithConfiguration(t,e,{embeddedLanguages:n,tokenTypes:o.tokenTypes,balancedBracketSelectors:o.balancedBracketSelectors,unbalancedBracketSelectors:o.unbalancedBracketSelectors})}catch(l){throw l.message&&l.message.startsWith("No grammar provided for")?new Error(wet):l}return{languageId:i,grammar:s,initialState:this._initialState,containsEmbeddedLanguages:r,sourceExtensionId:o.sourceExtensionId}}};var NH=Rn.registerExtensionPoint({extensionPoint:"grammars",deps:[j4],jsonSchema:{description:d(17998,null),type:"array",defaultSnippets:[{body:[{language:"${1:id}",scopeName:"source.${2:id}",path:"./syntaxes/${3:id}.tmLanguage."}]}],items:{type:"object",defaultSnippets:[{body:{language:"${1:id}",scopeName:"source.${2:id}",path:"./syntaxes/${3:id}.tmLanguage."}}],properties:{language:{description:d(18002,null),type:"string"},scopeName:{description:d(18004,null),type:"string"},path:{description:d(18003,null),type:"string"},embeddedLanguages:{description:d(18000,null),type:"object"},tokenTypes:{description:d(18005,null),type:"object",additionalProperties:{enum:["string","comment","other"]}},injectTo:{description:d(18001,null),type:"array",items:{type:"string"}},balancedBracketScopes:{description:d(17999,null),type:"array",items:{type:"string"},default:["*"]},unbalancedBracketScopes:{description:d(18006,null),type:"array",items:{type:"string"},default:[]}},required:["scopeName","path"]}}});var OH=class extends x{constructor(e,t,o,n,r,s,l,c,u,p){super();this._languageService=e;this._themeService=t;this._extensionResourceLoaderService=o;this._notificationService=n;this._logService=r;this._configurationService=s;this._progressService=l;this._environmentService=c;this._instantiationService=u;this._telemetryService=p;this._createdModes=[],this._encounteredLanguages=[],this._debugMode=!1,this._debugModePrintFunc=()=>{},this._grammarDefinitions=null,this._grammarFactory=null,this._tokenizersRegistrations=this._register(new N),this._currentTheme=null,this._currentTokenColorMap=null,this._currentTokenFontMap=null,this._threadedBackgroundTokenizerFactory=this._instantiationService.createInstance(e8,(h,g,f,v,b)=>this._reportTokenizationTime(h,g,f,v,!0,b),()=>this.getAsyncTokenizationEnabled()),this._vscodeOniguruma=null,this._styleElement=Cr(),this._styleElement.className="vscode-tokens-styles",NH.setHandler(h=>this._handleGrammarsExtPoint(h)),this._updateTheme(this._themeService.getColorTheme(),!0),this._register(this._themeService.onDidColorThemeChange(()=>{this._updateTheme(this._themeService.getColorTheme(),!1)})),this._register(this._languageService.onDidRequestRichLanguageFeatures(h=>{this._createdModes.push(h)}))}static{this.reportTokenizationTimeCounter={sync:0,async:0}}getAsyncTokenizationEnabled(){return!!this._configurationService.getValue("editor.experimental.asyncTokenization")}getAsyncTokenizationVerification(){return!!this._configurationService.getValue("editor.experimental.asyncTokenizationVerification")}_handleGrammarsExtPoint(e){this._grammarDefinitions=null,this._grammarFactory&&(this._grammarFactory.dispose(),this._grammarFactory=null),this._tokenizersRegistrations.clear(),this._grammarDefinitions=[];for(let t of e){let o=t.value;for(let n of o){let r=this._validateGrammarDefinition(t,n);if(r&&(this._grammarDefinitions.push(r),r.language)){let s=new uvt(()=>this._createTokenizationSupport(r.language));this._tokenizersRegistrations.add(s),this._tokenizersRegistrations.add(ic.registerFactory(r.language,s))}}}this._threadedBackgroundTokenizerFactory.setGrammarDefinitions(this._grammarDefinitions);for(let t of this._createdModes)ic.getOrCreate(t)}_validateGrammarDefinition(e,t){if(!TYo(e.description.extensionLocation,t,e.collector,this._languageService))return null;let o=Ge(e.description.extensionLocation,t.path),n=Object.create(null);if(t.embeddedLanguages){let c=Object.keys(t.embeddedLanguages);for(let u=0,p=c.length;u<p;u++){let h=c[u],g=t.embeddedLanguages[h];typeof g=="string"&&this._languageService.isRegisteredLanguageId(g)&&(n[h]=this._languageService.languageIdCodec.encodeLanguageId(g))}}let r=Object.create(null);if(t.tokenTypes){let c=Object.keys(t.tokenTypes);for(let u of c)switch(t.tokenTypes[u]){case"string":r[u]=2;break;case"other":r[u]=0;break;case"comment":r[u]=1;break}}let s=t.language&&this._languageService.isRegisteredLanguageId(t.language)?t.language:void 0;function l(c,u){return!Array.isArray(c)||!c.every(p=>typeof p=="string")?u:c}return{location:o,language:s,scopeName:t.scopeName,embeddedLanguages:n,tokenTypes:r,injectTo:t.injectTo,balancedBracketSelectors:l(t.balancedBracketScopes,["*"]),unbalancedBracketSelectors:l(t.unbalancedBracketScopes,[]),sourceExtensionId:e.description.id}}startDebugMode(e,t){if(this._debugMode){this._notificationService.error(d(17987,null));return}this._debugModePrintFunc=e,this._debugMode=!0,this._debugMode&&this._progressService.withProgress({location:15,buttons:[d(17997,null)]},o=>(o.report({message:d(17995,null)}),this._getVSCodeOniguruma().then(n=>(n.setDefaultDebugCall(!0),o.report({message:d(17996,null)}),new Promise((r,s)=>{})))),o=>{this._getVSCodeOniguruma().then(n=>{this._debugModePrintFunc=()=>{},this._debugMode=!1,n.setDefaultDebugCall(!1),t()})})}_canCreateGrammarFactory(){return!!this._grammarDefinitions}async _getOrCreateGrammarFactory(){if(this._grammarFactory)return this._grammarFactory;let[e,t]=await Promise.all([Pg("vscode-textmate","release/main.js"),this._getVSCodeOniguruma()]),o=Promise.resolve({createOnigScanner:n=>t.createOnigScanner(n),createOnigString:n=>t.createOnigString(n)});return this._grammarFactory?this._grammarFactory:(this._grammarFactory=new GBt({logTrace:n=>this._logService.trace(n),logError:(n,r)=>this._logService.error(n,r),readFile:n=>this._extensionResourceLoaderService.readExtensionResource(n)},this._grammarDefinitions||[],e,o),this._updateTheme(this._themeService.getColorTheme(),!0),this._grammarFactory)}async _createTokenizationSupport(e){if(!this._languageService.isRegisteredLanguageId(e)||!this._canCreateGrammarFactory())return null;try{let t=await this._getOrCreateGrammarFactory();if(!t.has(e))return null;let o=this._languageService.languageIdCodec.encodeLanguageId(e),n=await t.createGrammar(e,o);if(!n.grammar)return null;let r=_Yo("editor.maxTokenizationLineLength",e,-1,this._configurationService),s=new N,l=s.add(new BBt(n.grammar,n.initialState,n.containsEmbeddedLanguages,(c,u)=>this._threadedBackgroundTokenizerFactory.createBackgroundTokenizer(c,u,r),()=>this.getAsyncTokenizationVerification(),(c,u,p)=>{this._reportTokenizationTime(c,e,n.sourceExtensionId,u,!1,p)},!0));return s.add(l.onDidEncounterLanguage(c=>{if(!this._encounteredLanguages[c]){let u=this._languageService.languageIdCodec.decodeLanguageId(c);this._encounteredLanguages[c]=!0,this._languageService.requestBasicLanguageFeatures(u)}})),new HBt(o,l,s,r)}catch(t){return t.message&&t.message===wet||mt(t),null}}_updateTheme(e,t){if(!t&&this._currentTheme&&this._currentTokenColorMap&&EYo(this._currentTheme.settings,e.tokenColors)&&$i(this._currentTokenColorMap,e.tokenColorMap)&&this._currentTokenFontMap&&$i(this._currentTokenFontMap,e.tokenFontMap))return;this._currentTheme={name:e.label,settings:e.tokenColors},this._currentTokenColorMap=e.tokenColorMap,this._currentTokenFontMap=e.tokenFontMap,this._grammarFactory?.setTheme(this._currentTheme,this._currentTokenColorMap);let o=kYo(this._currentTokenColorMap),n=A_(o),r=M8i(this._currentTokenFontMap);this._styleElement.textContent=n+r,ic.setColorMap(o),this._currentTheme&&this._currentTokenColorMap&&this._threadedBackgroundTokenizerFactory.acceptTheme(this._currentTheme,this._currentTokenColorMap)}async createTokenizer(e){if(!this._languageService.isRegisteredLanguageId(e))return null;let t=await this._getOrCreateGrammarFactory();if(!t.has(e))return null;let o=this._languageService.languageIdCodec.encodeLanguageId(e),{grammar:n}=await t.createGrammar(e,o);return n}_getVSCodeOniguruma(){return this._vscodeOniguruma||(this._vscodeOniguruma=(async()=>{let[e,t]=await Promise.all([Pg("vscode-oniguruma","release/main.js"),this._loadVSCodeOnigurumaWASM()]);return await e.loadWASM({data:t,print:o=>{this._debugModePrintFunc(o)}}),e})()),this._vscodeOniguruma}async _loadVSCodeOnigurumaWASM(){return Wt?await(await fetch(HRt("vscode-oniguruma","release/onig.wasm"))).arrayBuffer():await fetch(QK&&this._environmentService.isBuilt?vn.asBrowserUri(`${$ht}/vscode-oniguruma/release/onig.wasm`).toString(!0):vn.asBrowserUri(`${tO}/vscode-oniguruma/release/onig.wasm`).toString(!0))}_reportTokenizationTime(e,t,o,n,r,s){let l=r?"async":"sync";OH.reportTokenizationTimeCounter[l]>50||(OH.reportTokenizationTimeCounter[l]===0&&setTimeout(()=>{OH.reportTokenizationTimeCounter[l]=0},1e3*60*60),OH.reportTokenizationTimeCounter[l]++,this._telemetryService.publicLog2("editor.tokenizedLine",{timeMs:e,languageId:t,lineLength:n,fromWorker:r,sourceExtensionId:o,isRandomSample:s,tokenizationSetting:this.getAsyncTokenizationEnabled()?this.getAsyncTokenizationVerification()?2:1:0}))}};OH=I([m(0,_t),m(1,sp),m(2,mk),m(3,Ne),m(4,se),m(5,B),m(6,Fo),m(7,At),m(8,F),m(9,Te)],OH);function kYo(a){let i=[null];for(let e=1,t=a.length;e<t;e++)i[e]=We.fromHex(a[e]);return i}function EYo(a,i){if(!i||!a||i.length!==a.length)return!1;for(let e=i.length-1;e>=0;e--){let t=i[e],o=a[e];if(t.scope!==o.scope)return!1;let n=t.settings,r=o.settings;if(n&&r){if(n.fontStyle!==r.fontStyle||n.foreground!==r.foreground||n.background!==r.background||n.lineHeight!==r.lineHeight||n.fontSize!==r.fontSize||n.fontFamily!==r.fontFamily)return!1}else if(!n||!r)return!1}return!0}function TYo(a,i,e,t){if(i.language&&(typeof i.language!="string"||!t.isRegisteredLanguageId(i.language)))return e.error(d(17990,null,NH.name,String(i.language))),!1;if(!i.scopeName||typeof i.scopeName!="string")return e.error(d(17993,null,NH.name,String(i.scopeName))),!1;if(!i.path||typeof i.path!="string")return e.error(d(17991,null,NH.name,String(i.path))),!1;if(i.injectTo&&(!Array.isArray(i.injectTo)||i.injectTo.some(n=>typeof n!="string")))return e.error(d(17989,null,NH.name,JSON.stringify(i.injectTo))),!1;if(i.embeddedLanguages&&!xi(i.embeddedLanguages))return e.error(d(17988,null,NH.name,JSON.stringify(i.embeddedLanguages))),!1;if(i.tokenTypes&&!xi(i.tokenTypes))return e.error(d(17994,null,NH.name,JSON.stringify(i.tokenTypes))),!1;let o=Ge(a,i.path);return ws(o,a)||e.warn(d(17992,null,NH.name,o.path,a.path)),!0}function _Yo(a,i,e,t){return ui(o=>t.onDidChangeConfiguration(n=>{n.affectsConfiguration(a,{overrideIdentifier:i})&&o(n)}),()=>t.getValue(a,{overrideIdentifier:i})??e)}var vMe=class{static{this.ID="workbench.contrib.textMateTokenizationInstantiator"}constructor(i){}};vMe=I([m(0,Z3)],vMe);Ee(Z3,OH,0);It(vMe.ID,vMe,St.BlockRestore);$e.registerCommand("_workbench.colorizeTextMateTokens",async(a,i)=>{let e=a.get(Uo),t=i?(await e.files.resolve(i)).textEditorModel:void 0;if(!t)throw new Error(`Cannot resolve text model for resource ${i}`);let o=await ic.getOrCreate(t.getLanguageId());if(!o)throw new Error(`Cannot resolve tokenizer for language ${t.getLanguageId()}`);let n=new Dn,r=o.getInitialState();for(let s=1;s<=t.getLineCount();s++)r=o.tokenizeEncoded(t.getLineContent(s),!0,r).endState;return n.stop(),{tokenizeTime:n.elapsed()}});var DYo="editor.experimental.preferTreeSitter";var LYo="@vscode/tree-sitter-wasm/wasm",RYo="tree-sitter.wasm";function Ruo(a){return`${QK&&a.isBuilt?$ht:tO}/${LYo}`}var bMe=class extends x{constructor(e,t,o){super();this._configurationService=e;this._fileService=t;this._environmentService=o;this.isTest=!1;this._treeSitterImport=new co(async()=>{let e=await Pg("@vscode/tree-sitter-wasm","wasm/tree-sitter.js"),t=this._environmentService,o=this.isTest;return await e.Parser.init({locateFile(n,r){let s=`${Ruo(t)}/${RYo}`;return o?vn.asFileUri(s).toString(!0):vn.asBrowserUri(s).toString(!0)}}),e});this._supportsLanguage=new NI(e=>hr(`${DYo}.${e}`,!1,this._configurationService));this._languagesCache=new NI(e=>bd.fromFn(async()=>{let t=Ruo(this._environmentService),o=`tree-sitter-${e}`,n=`${t}/${o}.wasm`,[r,s]=await Promise.all([this._treeSitterImport.value,this._fileService.readFile(vn.asFileUri(n))]);return await r.Language.load(s.value.buffer)}));this._injectionQueries=new NI({getCacheKey:JSON.stringify},e=>{let t=async()=>{let o=`vs/editor/common/languages/${e.kind}/${e.languageId}.scm`,n=vn.asFileUri(o);if(!this._fileService.hasProvider(n))return;let r=await MYo(this._fileService,n);if(r!==void 0)return r.value.toString()};return bd.fromFn(async()=>{let[o,n,r]=await Promise.all([t(),this._languagesCache.get(e.languageId).promise,this._treeSitterImport.value]);if(o===void 0)return null;let s=r.Query;return new s(n,o)}).resolvedValue})}supportsLanguage(e,t){return this._supportsLanguage.get(e).read(t)}async getParserClass(){return(await this._treeSitterImport.value).Parser}getLanguage(e,t,o){return!t&&!this.supportsLanguage(e,o)?void 0:this._languagesCache.get(e).resolvedValue.read(o)}async getLanguagePromise(e){return this._languagesCache.get(e).promise}getInjectionQueries(e,t){return this.supportsLanguage(e,t)?this._injectionQueries.get({languageId:e,kind:"injections"}).read(t):void 0}getHighlightingQueries(e,t){return this.supportsLanguage(e,t)?this._injectionQueries.get({languageId:e,kind:"highlights"}).read(t):void 0}async createQuery(e,t){let o=await this._treeSitterImport.value;return new o.Query(e,t)}};bMe=I([m(0,B),m(1,fe),m(2,Eo)],bMe);async function MYo(a,i){try{return await a.readFile(i)}catch(e){if(Au(e)===1)return;throw e}}var SMe=class{constructor(i){this._themeService=i;this._colorTheme=ui(this._themeService.onDidColorThemeChange,()=>this._themeService.getColorTheme()),this.onChange=ke(this,e=>{this._colorTheme.read(e),e.reportChange(void 0)})}findMetadata(i,e,t,o){return TVt(this._colorTheme.read(o),i,e,t)}};SMe=I([m(0,sp)],SMe);Ee(tY,bMe,0);Ee(RIt,SMe,0);var PYo=3e4,Kxi=2,Gxi={passive:!0,capture:!0},qBt=class extends x{constructor(i){super();let e=Kxi,t=this._register(new FL),o=this._register(new me);o.value=i.markActive();let n=()=>{++e===Kxi&&(o.clear(),t.cancel())},r=s=>{e===Kxi&&(o.value=i.markActive(),t.cancelAndSet(n,PYo,s)),e=0};this._register(U.runAndSubscribe(nf,({window:s,disposables:l})=>{l.add(j(s.document,"touchstart",()=>r(s),Gxi)),l.add(j(s.document,"mousedown",()=>r(s),Gxi)),l.add(j(s.document,"keydown",()=>r(s),Gxi))},{window:ut,disposables:this._store})),r(ut)}};QPt.add(qBt);var $Bt=class extends x{constructor(e){super();this.value=e;this._totalTime=0;this._startTime=void 0;this._register(be(t=>{if(this.value.read(t))this._startTime=Date.now();else if(this._startTime!==void 0){let n=Date.now()-this._startTime;this._totalTime+=n,this._startTime=void 0}}))}totalTimeMs(){return this._startTime!==void 0?this._totalTime+(Date.now()-this._startTime):this._totalTime}fireWhenTimeIncreasedBy(e,t){let o=new N,n=0,r;return o.add(be(s=>{if(this.value.read(s)){r=Date.now();let c=e-n;if(c<=0){t(),o.dispose();return}let u=setTimeout(()=>{n+=Date.now()-r,r=void 0,t(),o.dispose()},c);s.store.add(Z(()=>{clearTimeout(u),r!==void 0&&(n+=Date.now()-r,r=void 0)}))}})),o}};function Muo(a,i,e){let t=Me("wasTrueRecently",!1),o;return e.add(be(n=>{a.read(n)?(t.set(!0,void 0),o!==void 0&&(clearTimeout(o),o=void 0)):o=setTimeout(()=>{t.set(!1,void 0),o=void 0},i)})),e.add(Z(()=>{o!==void 0&&clearTimeout(o)})),t}var jBt=le("userAttentionService");var AYo=6e4,Cet=class extends x{constructor(e,t){super();this._logService=t;let o=this._register(e.createInstance(xet));this.isVsCodeFocused=o.isVsCodeFocused,this.isUserActive=o.isUserActive,this._isTracingEnabled=ui(this,this._logService.onDidChangeLogLevel,()=>this._logService.getLevel()===1);let n=Muo(this.isUserActive,AYo,this._store);this.hasUserAttention=ke(this,r=>n.read(r)),this._timeKeeper=this._register(new $Bt(this.hasUserAttention)),this._register(be(r=>{this._isTracingEnabled.read(r)&&(r.store.add(be(s=>{let l=this.isVsCodeFocused.read(s);this._logService.trace(`[UserAttentionService] VS Code focus changed: ${l}`)})),r.store.add(be(s=>{let l=this.hasUserAttention.read(s);this._logService.trace(`[UserAttentionService] User attention changed: ${l}`)})))}))}fireAfterGivenFocusTimePassed(e,t){return this._timeKeeper.fireWhenTimeIncreasedBy(e,t)}get totalFocusTimeMs(){return this._timeKeeper.totalTimeMs()}};Cet=I([m(0,F),m(1,se)],Cet);var xet=class extends x{constructor(e,t){super();this._hostService=e;this._logService=t;this._isUserActive=Me(this,!1);this.isVsCodeFocused=ui(this,this._hostService.onDidChangeFocus,()=>this._hostService.hasFocus),this.isUserActive=this._isUserActive;let o=()=>{this._markUserActivity()};this._register(U.runAndSubscribe(nf,({window:n,disposables:r})=>{r.add(j(n.document,"keydown",o,QBt)),r.add(j(n.document,"mousemove",o,QBt)),r.add(j(n.document,"mousedown",o,QBt)),r.add(j(n.document,"touchstart",o,QBt))},{window:ut,disposables:this._store})),this._hostService.hasFocus&&this._markUserActivity()}_markUserActivity(){this._activityDebounceTimeout!==void 0?clearTimeout(this._activityDebounceTimeout):(this._logService.trace("[UserAttentionService] User activity detected"),this._isUserActive.set(!0,void 0)),this._activityDebounceTimeout=setTimeout(()=>{this._isUserActive.set(!1,void 0),this._activityDebounceTimeout=void 0},500)}};xet=I([m(0,Zt),m(1,se)],xet);var QBt={passive:!0,capture:!0};Ee(jBt,Cet,1);var qxi=class{constructor(){this.onWillInstantiateEditorPane=Br.onWillInstantiateEditorPane}didInstantiateEditorPane(i){return Br.didInstantiateEditorPane(i)}};Ee(pTt,qxi,1);var $xi=class extends x{constructor(){super();this._onDidSendData=this._register(new E);this.onDidSendData=this._onDidSendData.event}getDataChannel(e){return new jxi(e,this._onDidSendData)}},jxi=class{constructor(i,e){this.channelId=i;this._onDidSendData=e}sendData(i){this._onDidSendData.fire({channelId:this.channelId,data:i})}};Ee(eX,$xi,1);var zD=le("IDefaultLogLevelsService"),ket=class extends x{constructor(e,t,o,n,r){super();this.environmentService=e;this.fileService=t;this.jsonEditingService=o;this.logService=n;this.loggerService=r;this._onDidChangeDefaultLogLevels=this._register(new E);this.onDidChangeDefaultLogLevels=this._onDidChangeDefaultLogLevels.event;this._defaultLogLevels={default:this._getDefaultLogLevelFromEnv(),extensions:this._getExtensionsDefaultLogLevelsFromEnv()},this._register(this.fileService.onDidFilesChange(s=>{s.contains(this.environmentService.argvResource)&&this.onDidChangeArgv()}))}async onDidChangeArgv(){let e=await this._parseLogLevelsFromArgv();this.updateDefaultLogLevels(e)}get defaultLogLevels(){return this._defaultLogLevels}updateDefaultLogLevels(e){let t={default:e?.default??this._getDefaultLogLevelFromEnv(),extensions:e?.extensions??this._getExtensionsDefaultLogLevelsFromEnv()};eo(this._defaultLogLevels,t)||(this._defaultLogLevels=t,this._onDidChangeDefaultLogLevels.fire(this._defaultLogLevels))}getDefaultLogLevel(e){return e?(e=e.toLowerCase(),this._getDefaultLogLevel(this._defaultLogLevels,e)):this._getDefaultLogLevel(this._defaultLogLevels)}async setDefaultLogLevel(e,t){let o=await this._parseLogLevelsFromArgv()??{};if(t){t=t.toLowerCase();let n=this._getDefaultLogLevel(o,t);o.extensions=o.extensions??[];let r=o.extensions.find(([l])=>l===t);r?r[1]=e:o.extensions.push([t,e]),await this._writeLogLevelsToArgv(o);let s=[...this.loggerService.getRegisteredLoggers()].filter(l=>l.extensionId&&l.extensionId.toLowerCase()===t);for(let{resource:l}of s)this.loggerService.getLogLevel(l)===n&&this.loggerService.setLogLevel(l,e)}else{let n=this._getDefaultLogLevel(o);o.default=e,await this._writeLogLevelsToArgv(o),this.loggerService.getLogLevel()===n&&this.loggerService.setLogLevel(e)}this.updateDefaultLogLevels(o)}_getDefaultLogLevel(e,t){if(t){let o=e.extensions?.find(([n])=>n===t);if(o)return o[1]}return e.default??iZt(this.environmentService)}async _writeLogLevelsToArgv(e){let t=[];gn(e.default)||t.push(IC(e.default));for(let[o,n]of e.extensions??[])t.push(`${o}=${IC(n)}`);await this.jsonEditingService.write(this.environmentService.argvResource,[{path:["log-level"],value:t.length?t:void 0}],!0)}async _parseLogLevelsFromArgv(){let e={extensions:[]},t=await this._readLogLevelsFromArgv();for(let o of t){let n=Bde.exec(o);if(n&&n[1]&&n[2]){let r=Iae(n[2]);gn(r)||e.extensions?.push([n[1].toLowerCase(),r])}else{let r=Iae(o);gn(r)||(e.default=r)}}return!gn(e.default)||e.extensions?.length?e:void 0}async _readLogLevelsFromArgv(){try{let e=await this.fileService.readFile(this.environmentService.argvResource),t=jr(e.value.toString());return Fe(t["log-level"])?[t["log-level"]]:Array.isArray(t["log-level"])?t["log-level"]:[]}catch(e){Au(e)!==1&&this.logService.error(e)}return[]}_getDefaultLogLevelFromEnv(){return iZt(this.environmentService)}_getExtensionsDefaultLogLevelsFromEnv(){let e=[];for(let[t,o]of this.environmentService.extensionLogLevel??[]){let n=Iae(o);gn(n)||e.push([t,n])}return e}};ket=I([m(0,At),m(1,fe),m(2,bg),m(3,se),m(4,Il)],ket);Ee(zD,ket,1);var Eet=class extends x{constructor(e){super();this.layoutService=e;this.contextView=this._register(new TCe(this.layoutService.mainContainer,1)),this.layout(),this._register(e.onDidLayoutContainer(()=>this.layout()))}showContextView(e,t,o){let n;t?t===this.layoutService.getContainer(Re(t))?n=1:o?n=3:n=2:n=1,this.contextView.setContainer(t??this.layoutService.activeContainer,n),this.contextView.show(e);let r={close:()=>{this.openContextView===r&&this.hideContextView()}};return this.openContextView=r,r}layout(){this.contextView.layout()}hideContextView(e){this.contextView.hide(e),this.openContextView=void 0}};Eet=I([m(0,Kl)],Eet);var YBt=class extends Eet{getContextViewElement(){return this.contextView.getViewElement()}};var IMe=class extends x{constructor(e,t){super();this._markerService=t;this._onDidChangeMarker=this._register(new E);this.onDidChangeMarker=this._onDidChangeMarker.event;this._suppressedRanges=new gt;this._markerDecorations=new gt;e.getModels().forEach(o=>this._onModelAdded(o)),this._register(e.onModelAdded(this._onModelAdded,this)),this._register(e.onModelRemoved(this._onModelRemoved,this)),this._register(this._markerService.onMarkerChanged(this._handleMarkerChange,this))}dispose(){super.dispose(),this._markerDecorations.forEach(e=>e.dispose()),this._markerDecorations.clear()}getMarker(e,t){let o=this._markerDecorations.get(e);return o&&o.getMarker(t)||null}getLiveMarkers(e){let t=this._markerDecorations.get(e);return t?t.getMarkers():[]}addMarkerSuppression(e,t){let o=this._suppressedRanges.get(e);return o||(o=new Set,this._suppressedRanges.set(e,o)),o.add(t),this._handleMarkerChange([e]),Z(()=>{let n=this._suppressedRanges.get(e);n&&(n.delete(t),n.size===0&&this._suppressedRanges.delete(e),this._handleMarkerChange([e]))})}_handleMarkerChange(e){e.forEach(t=>{let o=this._markerDecorations.get(t);o&&this._updateDecorations(o)})}_onModelAdded(e){let t=new Qxi(e);this._markerDecorations.set(e.uri,t),this._updateDecorations(t)}_onModelRemoved(e){let t=this._markerDecorations.get(e.uri);t&&(t.dispose(),this._markerDecorations.delete(e.uri)),(e.uri.scheme===Q.inMemory||e.uri.scheme===Q.internal||e.uri.scheme===Q.vscode)&&this._markerService?.read({resource:e.uri}).map(o=>o.owner).forEach(o=>this._markerService.remove(o,[e.uri]))}_updateDecorations(e){let t=this._markerService.read({resource:e.model.uri,take:500}),o=this._suppressedRanges.get(e.model.uri);o&&(t=t.filter(n=>!vt.some(o,r=>z.areIntersectingOrTouching(r,n)))),e.update(t)&&this._onDidChangeMarker.fire(e.model)}};IMe=I([m(0,Tt),m(1,oa)],IMe);var Qxi=class extends x{constructor(e){super();this.model=e;this._map=new hht;this._register(Z(()=>{this.model.deltaDecorations([...this._map.values()],[]),this._map.clear()}))}update(e){let{added:t,removed:o}=t1(new Set(this._map.keys()),new Set(e));if(t.length===0&&o.length===0)return!1;let n=o.map(l=>this._map.get(l)),r=t.map(l=>({range:this._createDecorationRange(this.model,l),options:this._createDecorationOption(l)})),s=this.model.deltaDecorations(n,r);for(let l of o)this._map.delete(l);for(let l=0;l<s.length;l++)this._map.set(t[l],s[l]);return!0}getMarker(e){return this._map.getKey(e.id)}getMarkers(){let e=[];return this._map.forEach((t,o)=>{let n=this.model.getDecorationRange(t);n&&e.push([n,o])}),e}_createDecorationRange(e,t){let o=z.lift(t);if(t.severity===1&&!this._hasMarkerTag(t,1)&&!this._hasMarkerTag(t,2)&&(o=o.setEndPosition(o.startLineNumber,o.startColumn+2)),o=e.validateRange(o),o.isEmpty()){let n=e.getLineLastNonWhitespaceColumn(o.startLineNumber)||e.getLineMaxColumn(o.startLineNumber);if(n===1||o.endColumn>=n)return o;let r=e.getWordAtPosition(o.getStartPosition());r&&(o=new z(o.startLineNumber,r.startColumn,o.endLineNumber,r.endColumn))}else if(t.endColumn===Number.MAX_VALUE&&t.startColumn===1&&o.startLineNumber===o.endLineNumber){let n=e.getLineFirstNonWhitespaceColumn(t.startLineNumber);n<o.endColumn&&(o=new z(o.startLineNumber,n,o.endLineNumber,o.endColumn),t.startColumn=n)}return o}_createDecorationOption(e){let t,o,n,r,s;switch(e.severity){case 1:this._hasMarkerTag(e,2)?t=void 0:this._hasMarkerTag(e,1)?t="squiggly-unnecessary":t="squiggly-hint",n=0;break;case 2:t="squiggly-info",o=Xs(wwe),n=10,s={color:Xs(U5i),position:1};break;case 4:t="squiggly-warning",o=Xs(M3i),n=20,s={color:Xs(z5i),position:1};break;case 8:default:t="squiggly-error",o=Xs(ywe),n=30,s={color:Xs(K5i),position:1};break}return e.tags&&(e.tags.indexOf(1)!==-1&&(r="squiggly-inline-unnecessary"),e.tags.indexOf(2)!==-1&&(r="squiggly-inline-deprecated")),{description:"marker-decoration",stickiness:1,className:t,showIfCollapsed:!0,overviewRuler:{color:o,position:4},minimap:s,zIndex:n,inlineClassName:r}}_hasMarkerTag(e,t){return e.tags?e.tags.indexOf(t)>=0:!1}};var Pme=new Set([Q.inMemory,Q.vscodeSourceControl,Q.walkThrough,Q.walkThroughSnippet,Q.vscodeChatCodeBlock,Q.vscodeTerminal]),Yxi=class{constructor(){this._byResource=new gt;this._byOwner=new Map}set(i,e,t){let o=this._byResource.get(i);o||(o=new Map,this._byResource.set(i,o)),o.set(e,t);let n=this._byOwner.get(e);n||(n=new gt,this._byOwner.set(e,n)),n.set(i,t)}get(i,e){return this._byResource.get(i)?.get(e)}delete(i,e){let t=!1,o=!1,n=this._byResource.get(i);n&&(t=n.delete(e));let r=this._byOwner.get(e);if(r&&(o=r.delete(i)),t!==o)throw new Error("illegal state");return t&&o}values(i){return typeof i=="string"?this._byOwner.get(i)?.values()??vt.empty():A.isUri(i)?this._byResource.get(i)?.values()??vt.empty():vt.map(vt.concat(...this._byOwner.values()),e=>e[1])}},Xxi=class{constructor(i){this.errors=0;this.infos=0;this.warnings=0;this.unknowns=0;this._data=new gt;this._service=i,this._subscription=i.onMarkerChanged(this._update,this)}dispose(){this._subscription.dispose()}_update(i){for(let e of i){let t=this._data.get(e);t&&this._substract(t);let o=this._resourceStats(e);this._add(o),this._data.set(e,o)}}_resourceStats(i){let e={errors:0,warnings:0,infos:0,unknowns:0};if(Pme.has(i.scheme))return e;for(let{severity:t}of this._service.read({resource:i}))t===8?e.errors+=1:t===4?e.warnings+=1:t===2?e.infos+=1:e.unknowns+=1;return e}_substract(i){this.errors-=i.errors,this.warnings-=i.warnings,this.infos-=i.infos,this.unknowns-=i.unknowns}_add(i){this.errors+=i.errors,this.warnings+=i.warnings,this.infos+=i.infos,this.unknowns+=i.unknowns}},XBt=class a{constructor(){this._onMarkerChanged=new A9({merge:a._merge});this.onMarkerChanged=this._onMarkerChanged.event;this._data=new Yxi;this._stats=new Xxi(this);this._filteredResources=new gt}dispose(){this._stats.dispose(),this._onMarkerChanged.dispose()}getStatistics(){return this._stats}remove(i,e){for(let t of e||[])this.changeOne(i,t,[])}changeOne(i,e,t){if($N(t))this._data.delete(e,i)&&this._onMarkerChanged.fire([e]);else{let o=[];for(let n of t){let r=a._toMarker(i,e,n);r&&o.push(r)}this._data.set(e,i,o),this._onMarkerChanged.fire([e])}}installResourceFilter(i,e){let t=this._filteredResources.get(i);return t||(t=[],this._filteredResources.set(i,t)),t.push(e),this._onMarkerChanged.fire([i]),Z(()=>{let o=this._filteredResources.get(i);if(!o)return;let n=o.indexOf(e);n!==-1&&(o.splice(n,1),o.length===0&&this._filteredResources.delete(i),this._onMarkerChanged.fire([i]))})}static _toMarker(i,e,t){let{code:o,severity:n,message:r,source:s,startLineNumber:l,startColumn:c,endLineNumber:u,endColumn:p,relatedInformation:h,modelVersionId:g,tags:f,origin:v}=t;if(r)return l=l>0?l:1,c=c>0?c:1,u=u>=l?u:l,p=p>0?p:c,{resource:e,owner:i,code:o,severity:n,message:r,source:s,startLineNumber:l,startColumn:c,endLineNumber:u,endColumn:p,relatedInformation:h,modelVersionId:g,tags:f,origin:v}}changeAll(i,e){let t=[],o=this._data.values(i);if(o)for(let n of o){let r=vt.first(n);r&&(t.push(r.resource),this._data.delete(r.resource,i))}if(yr(e)){let n=new gt;for(let{resource:r,marker:s}of e){let l=a._toMarker(i,r,s);if(!l)continue;let c=n.get(r);c?c.push(l):(n.set(r,[l]),t.push(r))}for(let[r,s]of n)this._data.set(r,i,s)}t.length>0&&this._onMarkerChanged.fire(t)}_createFilteredMarker(i,e){let t=e.length===1?d(2221,null,e[0]):d(2222,null,e[0],e.length-1);return{owner:"markersFilter",resource:i,severity:2,message:t,startLineNumber:1,startColumn:1,endLineNumber:1,endColumn:1}}read(i=Object.create(null)){let{owner:e,resource:t,severities:o,take:n}=i;if((!n||n<0)&&(n=-1),e&&t){let r=i.ignoreResourceFilters?void 0:this._filteredResources.get(t);if(r?.length)return[this._createFilteredMarker(t,r)];let s=this._data.get(t,e);if(!s)return[];let l=[];for(let c of s){if(n>0&&l.length===n)break;let u=i.ignoreResourceFilters?void 0:this._filteredResources.get(t);u?.length?l.push(this._createFilteredMarker(t,u)):a._accept(c,o)&&l.push(c)}return l}else{let r=!e&&!t?this._data.values():this._data.values(t??e),s=[],l=new En;for(let c of r)for(let u of c){if(l.has(u.resource))continue;if(n>0&&s.length===n)break;let p=i.ignoreResourceFilters?void 0:this._filteredResources.get(u.resource);p?.length?(s.push(this._createFilteredMarker(u.resource,p)),l.add(u.resource)):a._accept(u,o)&&s.push(u)}return s}}static _accept(i,e){return e===void 0||(e&i.severity)===i.severity}static _merge(i){let e=new gt;for(let t of i)for(let o of t)e.set(o,!0);return Array.from(e.keys())}};var Tet="data-keybinding-context",_et=class{constructor(i,e){this._id=i,this._parent=e,this._value=Object.create(null),this._value._contextId=i}get value(){return{...this._value}}setValue(i,e){return eo(this._value[i],e)?!1:(this._value[i]=e,!0)}removeValue(i){return i in this._value?(delete this._value[i],!0):!1}getValue(i){let e=this._value[i];return typeof e>"u"&&this._parent?this._parent.getValue(i):e}updateParent(i){this._parent=i}collectAllValues(){let i=this._parent?this._parent.collectAllValues():Object.create(null);return i={...i,...this._value},delete i._contextId,i}},wMe=class a extends _et{static{this.INSTANCE=new a}constructor(){super(-1,null)}setValue(i,e){return!1}removeValue(i){return!1}getValue(i){}collectAllValues(){return Object.create(null)}},Jxi=class a extends _et{constructor(e,t,o){super(e,null);this._configurationService=t;this._values=Sp.forConfigKeys();this._listener=this._configurationService.onDidChangeConfiguration(n=>{if(n.source===7){let r=Array.from(this._values,([s])=>s);this._values.clear(),o.fire(new Det(r))}else{let r=[];for(let s of n.affectedKeys){let l=`config.${s}`,c=this._values.findSuperstr(l);c!==void 0&&(r.push(...vt.map(c,([u])=>u)),this._values.deleteSuperstr(l)),this._values.has(l)&&(r.push(l),this._values.delete(l))}o.fire(new Det(r))}})}static{this._keyPrefix="config."}dispose(){this._listener.dispose()}getValue(e){if(e.indexOf(a._keyPrefix)!==0)return super.getValue(e);if(this._values.has(e))return this._values.get(e);let t=e.substr(a._keyPrefix.length),o=this._configurationService.getValue(t),n;switch(typeof o){case"number":case"boolean":case"string":n=o;break;default:Array.isArray(o)?n=JSON.stringify(o):n=o}return this._values.set(e,n),n}setValue(e,t){return super.setValue(e,t)}removeValue(e){return super.removeValue(e)}collectAllValues(){let e=Object.create(null);return this._values.forEach((t,o)=>e[o]=t),{...e,...super.collectAllValues()}}},Zxi=class{constructor(i,e,t){this._service=i,this._key=e,this._defaultValue=t,this.reset()}set(i){this._service.setContext(this._key,i)}reset(){typeof this._defaultValue>"u"?this._service.removeContext(this._key):this._service.setContext(this._key,this._defaultValue)}get(){return this._service.getContextKeyValue(this._key)}},JBt=class{constructor(i){this.key=i}affectsSome(i){return i.has(this.key)}allKeysContainedIn(i){return this.affectsSome(i)}},Det=class{constructor(i){this.keys=i}affectsSome(i){for(let e of this.keys)if(i.has(e))return!0;return!1}allKeysContainedIn(i){return this.keys.every(e=>i.has(e))}},eki=class{constructor(i){this.events=i}affectsSome(i){for(let e of this.events)if(e.affectsSome(i))return!0;return!1}allKeysContainedIn(i){return this.events.every(e=>e.allKeysContainedIn(i))}};function NYo(a,i){return a.allKeysContainedIn(new Set(Object.keys(i)))}var ZBt=class extends x{constructor(e){super();this._onDidChangeContext=this._register(new Gm({merge:e=>new eki(e)}));this._isDisposed=!1,this._myContextId=e}get onDidChangeContext(){return this._onDidChangeContext.event}get contextId(){return this._myContextId}createKey(e,t){if(this._isDisposed)throw new Error("AbstractContextKeyService has been disposed");return new Zxi(this,e,t)}bufferChangeEvents(e){this._onDidChangeContext.pause();try{e()}finally{this._onDidChangeContext.resume()}}createScoped(e){if(this._isDisposed)throw new Error("AbstractContextKeyService has been disposed");return new tki(this,e)}createOverlay(e=vt.empty()){if(this._isDisposed)throw new Error("AbstractContextKeyService has been disposed");return new iki(this,e)}contextMatchesRules(e){if(this._isDisposed)throw new Error("AbstractContextKeyService has been disposed");let t=this.getContextValuesContainer(this._myContextId);return e?e.evaluate(t):!0}getContextKeyValue(e){if(!this._isDisposed)return this.getContextValuesContainer(this._myContextId).getValue(e)}setContext(e,t){if(this._isDisposed)return;let o=this.getContextValuesContainer(this._myContextId);o&&o.setValue(e,t)&&this._onDidChangeContext.fire(new JBt(e))}removeContext(e){this._isDisposed||this.getContextValuesContainer(this._myContextId).removeValue(e)&&this._onDidChangeContext.fire(new JBt(e))}getContext(e){return this._isDisposed?wMe.INSTANCE:this.getContextValuesContainer(OYo(e))}dispose(){super.dispose(),this._isDisposed=!0}},yMe=class extends ZBt{constructor(e){super(0);this._contexts=new Map;this._lastContextId=0,this.inputFocusedContext=ig.bindTo(this);let t=this._register(new Jxi(this._myContextId,e,this._onDidChangeContext));this._contexts.set(this._myContextId,t),this._register(U.runAndSubscribe(nf,({window:o,disposables:n})=>{let r=n.add(new me);n.add(j(o,re.FOCUS_IN,()=>{r.value=new N,this.updateInputContextKeys(o.document,r.value)},!0))},{window:ut,disposables:this._store}))}updateInputContextKeys(e,t){function o(){return!!e.activeElement&&Kh(e.activeElement)}let n=o();if(this.inputFocusedContext.set(n),n){let r=t.add(qn(e.activeElement));U.once(r.onDidBlur)(()=>{Ki().document===e&&this.inputFocusedContext.set(o()),r.dispose()},void 0,t)}}getContextValuesContainer(e){return this._isDisposed?wMe.INSTANCE:this._contexts.get(e)||wMe.INSTANCE}createChildContext(e=this._myContextId){if(this._isDisposed)throw new Error("ContextKeyService has been disposed");let t=++this._lastContextId;return this._contexts.set(t,new _et(t,this.getContextValuesContainer(e))),t}disposeContext(e){this._isDisposed||this._contexts.delete(e)}updateParent(e){throw new Error("Cannot update parent of root ContextKeyService")}};yMe=I([m(0,B)],yMe);var tki=class extends ZBt{constructor(e,t){super(e.createChildContext());this._parentChangeListener=this._register(new me);if(this._parent=e,this._updateParentChangeListener(),this._domNode=t,this._domNode.hasAttribute(Tet)){let o="";this._domNode.classList&&(o=Array.from(this._domNode.classList.values()).join(", ")),console.error(`Element already has context attribute${o?": "+o:""}`)}this._domNode.setAttribute(Tet,String(this._myContextId))}_updateParentChangeListener(){this._parentChangeListener.value=this._parent.onDidChangeContext(e=>{let o=this._parent.getContextValuesContainer(this._myContextId).value;NYo(e,o)||this._onDidChangeContext.fire(e)})}dispose(){this._isDisposed||(this._parent.disposeContext(this._myContextId),this._domNode.removeAttribute(Tet),super.dispose())}getContextValuesContainer(e){return this._isDisposed?wMe.INSTANCE:this._parent.getContextValuesContainer(e)}createChildContext(e=this._myContextId){if(this._isDisposed)throw new Error("ScopedContextKeyService has been disposed");return this._parent.createChildContext(e)}disposeContext(e){this._isDisposed||this._parent.disposeContext(e)}updateParent(e){if(this._parent===e)return;let t=this._parent.getContextValuesContainer(this._myContextId),o=t.collectAllValues();this._parent=e,this._updateParentChangeListener();let n=this._parent.getContextValuesContainer(this._parent.contextId);t.updateParent(n);let r=t.collectAllValues(),s={...J$e(o,r),...J$e(r,o)},l=Object.keys(s);this._onDidChangeContext.fire(new Det(l))}},eHt=class{constructor(i,e){this.parent=i;this.overlay=e}getValue(i){return this.overlay.has(i)?this.overlay.get(i):this.parent.getValue(i)}},iki=class a{constructor(i,e){this.parent=i;this.overlay=new Map(e)}get contextId(){return this.parent.contextId}get onDidChangeContext(){return this.parent.onDidChangeContext}bufferChangeEvents(i){this.parent.bufferChangeEvents(i)}createKey(){throw new Error("Not supported.")}getContext(i){return new eHt(this.parent.getContext(i),this.overlay)}getContextValuesContainer(i){let e=this.parent.getContextValuesContainer(i);return new eHt(e,this.overlay)}contextMatchesRules(i){let e=this.getContextValuesContainer(this.contextId);return i?i.evaluate(e):!0}getContextKeyValue(i){return this.overlay.has(i)?this.overlay.get(i):this.parent.getContextKeyValue(i)}createScoped(){throw new Error("Not supported.")}createOverlay(i=vt.empty()){return new a(this,i)}updateParent(){throw new Error("Not supported.")}};function OYo(a){for(;a;){if(a.hasAttribute(Tet)){let i=a.getAttribute(Tet);return i?parseInt(i,10):NaN}a=a.parentElement}return 0}function FYo(a,i,e){a.get(X).createKey(String(i),WYo(e))}function WYo(a){return Fx(a,i=>{if(typeof i=="object"&&i.$mid===1)return A.revive(i).toString();if(i instanceof A)return i.toString()})}$e.registerCommand("_setContext",FYo);$e.registerCommand({id:"getContextKeyInfo",handler(){return[...Y.all()].sort((a,i)=>a.key.localeCompare(i.key))},metadata:{description:d(1908,null),args:[]}});$e.registerCommand("_generateContextKeyInfo",function(){let a=[],i=new Set;for(let e of Y.all())i.has(e.key)||(i.add(e.key),a.push(e));a.sort((e,t)=>e.key.localeCompare(t.key)),console.log(JSON.stringify(a,void 0,2))});var CMe=class extends x{constructor(e,t,o){super();this.configurationService=e;this.modelService=t;this.languageService=o;this._onDidChangeConfiguration=this._register(new E);this.onDidChangeConfiguration=this._onDidChangeConfiguration.event;this._register(this.configurationService.onDidChangeConfiguration(n=>this._onDidChangeConfiguration.fire(this.toResourceConfigurationChangeEvent(n))))}getValue(e,t,o){return typeof o=="string"?this._getValue(e,ye.isIPosition(t)?t:null,o):this._getValue(e,null,typeof t=="string"?t:void 0)}updateValue(e,t,o,n){let r=e?this.getLanguage(e,null):null,s=this.configurationService.inspect(t,{resource:e,overrideIdentifier:r});n===void 0&&(n=this.deriveConfigurationTarget(s,r));let l=r&&s.overrideIdentifiers?.includes(r)?r:void 0;return this.configurationService.updateValue(t,o,{resource:e,overrideIdentifier:l},n)}deriveConfigurationTarget(e,t){if(t){if(e.memory?.override!==void 0)return 8;if(e.workspaceFolder?.override!==void 0)return 6;if(e.workspace?.override!==void 0)return 5;if(e.userRemote?.override!==void 0)return 4;if(e.userLocal?.override!==void 0)return 3}return e.memory?.value!==void 0?8:e.workspaceFolder?.value!==void 0?6:e.workspace?.value!==void 0?5:e.userRemote?.value!==void 0?4:3}_getValue(e,t,o){let n=e?this.getLanguage(e,t):void 0;return typeof o>"u"?this.configurationService.getValue({resource:e,overrideIdentifier:n}):this.configurationService.getValue(o,{resource:e,overrideIdentifier:n})}inspect(e,t,o){let n=e?this.getLanguage(e,t):void 0;return this.configurationService.inspect(o,{resource:e,overrideIdentifier:n})}getLanguage(e,t){let o=this.modelService.getModel(e);return o?t?o.getLanguageIdAtPosition(t.lineNumber,t.column):o.getLanguageId():this.languageService.guessLanguageIdByFilepathOrFirstLine(e)}toResourceConfigurationChangeEvent(e){return{affectedKeys:e.affectedKeys,affectsConfiguration:(t,o)=>{let n=t?this.getLanguage(t,null):void 0;return e.affectsConfiguration(o,{resource:t,overrideIdentifier:n})?!0:n?e.affectedKeys.has(`[${n}]`):!1}}}};CMe=I([m(0,B),m(1,Tt),m(2,_t)],CMe);var xMe=class{constructor(i,e){this.requestService=i;this.fileService=e}async download(i,e,t,o=Se.None){if(i.scheme===Q.file||i.scheme===Q.vscodeRemote){await this.fileService.copy(i,e);return}let n={type:"GET",url:i.toString(!0),callSite:t},r=await this.requestService.request(n,o);if(r.res.statusCode===200)await this.fileService.writeFile(e,r.stream);else{let s=await _w(r);throw new Error(`Expected 200, got back ${r.res.statusCode} instead.

${s}`)}}};xMe=I([m(0,Ea),m(1,fe)],xMe);var Let=class{constructor(i){this._commandService=i}async open(i,e){if(!ec(i,Q.command))return!1;if(!e?.allowCommands||(typeof i=="string"&&(i=A.parse(i)),Array.isArray(e.allowCommands)&&!e.allowCommands.includes(i.path)))return!0;let t=[];try{t=am(decodeURIComponent(i.query))}catch{try{t=am(i.query)}catch{}}return Array.isArray(t)||(t=[t]),await this._commandService.executeCommand(i.path,...t),!0}};Let=I([m(0,ge)],Let);var Ret=class{constructor(i){this._editorService=i}async open(i,e){typeof i=="string"&&(i=A.parse(i));let{selection:t,uri:o}=uwe(i);return i=o,i.scheme===Q.file&&(i=F$(i)),await this._editorService.openCodeEditor({resource:i,options:{selection:t,source:e?.fromUserGesture?1:0,...e?.editorOptions}},this._editorService.getFocusedCodeEditor(),e?.openToSide),!0}};Ret=I([m(0,qt)],Ret);var kMe=class{constructor(i,e){this._openers=new qs;this._validators=new qs;this._resolvers=new qs;this._resolvedUriTargets=new gt(i=>i.with({path:null,fragment:null,query:null}).toString());this._externalOpeners=new qs;this._defaultExternalOpener={openExternal:async t=>(mV(t,Q.http,Q.https)?V$e(t):ut.location.href=t,!0)},this._openers.push({open:async(t,o)=>o?.openExternal||mV(t,Q.mailto,Q.http,Q.https,Q.vsls)?(await this._doOpenExternal(t,o),!0):!1}),this._openers.push(new Let(e)),this._openers.push(new Ret(i))}registerOpener(i){return{dispose:this._openers.unshift(i)}}registerValidator(i){return{dispose:this._validators.push(i)}}registerExternalUriResolver(i){return{dispose:this._resolvers.push(i)}}setDefaultExternalOpener(i){this._defaultExternalOpener=i}registerExternalOpener(i){return{dispose:this._externalOpeners.push(i)}}async open(i,e){let t=typeof i=="string"?A.parse(i):i;if(t.scheme===Q.internal)return!1;if(!e?.skipValidation){let o=this._resolvedUriTargets.get(t)??i;for(let n of this._validators)if(!await n.shouldOpen(o,e))return!1}for(let o of this._openers)if(await o.open(i,e))return!0;return!1}async resolveExternalUri(i,e){for(let t of this._resolvers)try{let o=await t.resolveExternalUri(i,e);if(o)return this._resolvedUriTargets.has(o.resolved)||this._resolvedUriTargets.set(o.resolved,i),o}catch{}throw new Error("Could not resolve external URI: "+i.toString())}async _doOpenExternal(i,e){let t=typeof i=="string"?A.parse(i):i,o;try{o=(await this.resolveExternalUri(t,e)).resolved}catch{o=t}let n;if(typeof i=="string"&&t.toString()===o.toString()?n=i:n=encodeURI(o.toString(!0)),e?.allowContributedOpeners){let r=typeof e?.allowContributedOpeners=="string"?e?.allowContributedOpeners:void 0;for(let s of this._externalOpeners)if(await s.openExternal(n,{sourceUri:t,preferredOpenerId:r},Se.None))return!0}return this._defaultExternalOpener.openExternal(n,{sourceUri:t},Se.None)}dispose(){this._validators.clear()}};kMe=I([m(0,qt),m(1,ge)],kMe);var rG=le("IIgnoredExtensionsManagementService"),EMe=class{constructor(i){this.configurationService=i}hasToNeverSyncExtension(i){return this.getConfiguredIgnoredExtensions().includes(i.toLowerCase())}hasToAlwaysSyncExtension(i){return this.getConfiguredIgnoredExtensions().includes(`-${i.toLowerCase()}`)}updateIgnoredExtensions(i,e){let t=[...this.configurationService.getValue("settingsSync.ignoredExtensions")].map(o=>o.toLowerCase());return t=t.filter(o=>o!==i&&o!==`-${i}`),e&&t.push(i.toLowerCase()),this.configurationService.updateValue("settingsSync.ignoredExtensions",t.length?t:void 0,2)}updateSynchronizedExtensions(i,e){let t=[...this.configurationService.getValue("settingsSync.ignoredExtensions")].map(o=>o.toLowerCase());return t=t.filter(o=>o!==i&&o!==`-${i}`),e&&t.push(`-${i.toLowerCase()}`),this.configurationService.updateValue("settingsSync.ignoredExtensions",t.length?t:void 0,2)}getIgnoredExtensions(i){let e=i.filter(r=>r.isMachineScoped).map(r=>r.identifier.id.toLowerCase()),t=this.getConfiguredIgnoredExtensions().map(r=>r.toLowerCase()),o=[],n=[];if(Array.isArray(t))for(let r of t)r.startsWith("-")?n.push(r.substring(1)):o.push(r);return zo([...e,...o].filter(r=>!n.includes(r)))}getConfiguredIgnoredExtensions(){return(this.configurationService.getValue("settingsSync.ignoredExtensions")||[]).map(i=>i.toLowerCase())}};EMe=I([m(0,B)],EMe);var TMe=class extends C1{constructor(i,e){super(),this.logger=this._register(i.createLogger(Ge(e.logsHome,`${yme}.log`),{id:yme,name:d(2775,null)}))}trace(i,...e){this.logger.trace(i,...e)}debug(i,...e){this.logger.debug(i,...e)}info(i,...e){this.logger.info(i,...e)}warn(i,...e){this.logger.warn(i,...e)}error(i,...e){this.logger.error(i,...e)}flush(){this.logger.flush()}};TMe=I([m(0,Il),m(1,Eo)],TMe);function VYo(a){return a.type==="gallery"}function BYo(a){return a.type===1||a.type===0}var HYo=/^(?<version>\d+\.\d+\.\d+(-.*)?)(@(?<platform>.+))?$/,_Me=class extends x{constructor(e,t){super();this.configurationService=t;this._onDidChangeAllowedExtensions=this._register(new E);this.onDidChangeAllowedExtensionsConfigValue=this._onDidChangeAllowedExtensions.event;this.publisherOrgs=e.extensionPublisherOrgs?.map(o=>o.toLowerCase())??[],this._allowedExtensionsConfigValue=this.getAllowedExtensionsValue(),this._register(this.configurationService.onDidChangeConfiguration(o=>{o.affectsConfiguration(Ide)&&(this._allowedExtensionsConfigValue=this.getAllowedExtensionsValue(),this._onDidChangeAllowedExtensions.fire())}))}get allowedExtensionsConfigValue(){return this._allowedExtensionsConfigValue}getAllowedExtensionsValue(){let e=this.configurationService.getValue(Ide);if(!xi(e)||Array.isArray(e))return;let t=Object.entries(e).map(([o,n])=>[o.toLowerCase(),n]);if(!(t.length===1&&t[0][0]==="*"&&t[0][1]===!0))return Object.fromEntries(t)}isAllowed(e){if(!this._allowedExtensionsConfigValue)return!0;let t,o,n,r,s,l;VYo(e)?(t=e.identifier.id.toLowerCase(),o=e.version,r=e.properties.isPreReleaseVersion,s=e.publisher.toLowerCase(),l=e.publisherDisplayName.toLowerCase(),n=e.properties.targetPlatform):BYo(e)?(t=e.identifier.id.toLowerCase(),o=e.manifest.version,r=e.preRelease,s=e.manifest.publisher.toLowerCase(),l=e.publisherDisplayName?.toLowerCase(),n=e.targetPlatform):(t=e.id.toLowerCase(),o=e.version??"*",n=e.targetPlatform??"universal",r=e.prerelease??!1,s=e.id.substring(0,e.id.indexOf(".")).toLowerCase(),l=e.publisherDisplayName?.toLowerCase());let c=fc("workbench.action.openSettings",{query:`@id:${Ide}`}).toString(),u=this._allowedExtensionsConfigValue[t],p=new Ie(d(2030,null,c));if(!gn(u))return Wa(u)?u?!0:p:u==="stable"&&r?new Ie(d(2027,null,c)):o!=="*"&&Array.isArray(u)&&!u.some(f=>{let v=HYo.exec(f);if(v&&v.groups){let{platform:b,version:S}=v.groups;return!(S!==o||n!=="universal"&&b&&n!==b)}return!1})?new Ie(d(2031,null,o,c)):!0;let h=l&&this.publisherOrgs.includes(l)?l:s,g=this._allowedExtensionsConfigValue[h];return gn(g)?this._allowedExtensionsConfigValue["*"]===!0?!0:p:Wa(g)?g?!0:new Ie(d(2029,null,h,c)):g==="stable"&&r?new Ie(d(2028,null,h,c)):!0}};_Me=I([m(0,tt),m(1,B)],_Me);var sG=le("IMcpGalleryService"),Puo=le("IMcpManagementService"),vM=le("IAllowedMcpServersService"),Wk="chat.mcp.access",t8="chat.mcp.gallery.serviceUrl",aG="chat.mcp.gallery.enabled",Nee="chat.mcp.autostart",tHt="chat.mcp.apps.enabled";var Nuo;(o=>{o.VERSION="v0-2025-07-09",o.SCHEMA="https://static.modelcontextprotocol.io/schemas/2025-07-09/server.schema.json";class e{toRawGalleryMcpServerResult(r){if(!r||typeof r!="object"||!Array.isArray(r.servers))return;let s=r,l=[];for(let c of s.servers){let u=this.toRawGalleryMcpServer(c);if(!u)return;l.push(u)}return{metadata:{count:s.metadata.count??0,nextCursor:s.metadata?.next_cursor},servers:l}}toRawGalleryMcpServer(r){if(!r||typeof r!="object")return;let s=r;if(!s.name||!Fe(s.name)||!s.description||!Fe(s.description)||!s.version||!Fe(s.version)||s.$schema&&s.$schema!==o.SCHEMA)return;let l=s._meta?.["io.modelcontextprotocol.registry/official"];function c(b){return{...b,isRequired:b.is_required,isSecret:b.is_secret}}function u(b){let S={};for(let[y,w]of Object.entries(b))S[y]=c(w);return S}function p(b){return b.type==="positional"?{...b,valueHint:b.value_hint,isRepeated:b.is_repeated,isRequired:b.is_required,isSecret:b.is_secret,variables:b.variables?u(b.variables):void 0}:{...b,isRepeated:b.is_repeated,isRequired:b.is_required,isSecret:b.is_secret,variables:b.variables?u(b.variables):void 0}}function h(b){return{...b,isRequired:b.is_required,isSecret:b.is_secret,variables:b.variables?u(b.variables):void 0}}function g(b){switch(b.type){case"stdio":return{type:"stdio"};case"streamable-http":return{type:"streamable-http",url:b.url,headers:b.headers?.map(h)};case"sse":return{type:"sse",url:b.url,headers:b.headers?.map(h)};default:return{type:"stdio"}}}function f(b){switch(b){case"npm":return"npm";case"docker":case"docker-hub":case"oci":return"oci";case"pypi":return"pypi";case"nuget":return"nuget";case"mcpb":return"mcpb";default:return"npm"}}let v=s._meta["io.modelcontextprotocol.registry/publisher-provided"]?.github;return{id:l.id,name:s.name,description:s.description,repository:s.repository?{url:s.repository.url,source:s.repository.source,id:s.repository.id}:void 0,readme:s.repository?.readme,version:s.version,createdAt:s.created_at,updatedAt:s.updated_at,packages:s.packages?.map(b=>({identifier:b.identifier??b.name,registryType:f(b.registry_type??b.registry_name),version:b.version,fileSha256:b.file_sha256,registryBaseUrl:b.registry_base_url,transport:b.transport?g(b.transport):{type:"stdio"},packageArguments:b.package_arguments?.map(p),runtimeHint:b.runtime_hint,runtimeArguments:b.runtime_arguments?.map(p),environmentVariables:b.environment_variables?.map(h)})),remotes:s.remotes?.map(b=>({type:(b.type??b.transport_type??b.transport)==="sse"?"sse":"streamable-http",url:b.url,headers:b.headers?.map(h)})),registryInfo:{isLatest:l.is_latest,publishedAt:l.published_at,updatedAt:l.updated_at},githubInfo:v?{name:v.name,nameWithOwner:v.name_with_owner,displayName:v.display_name,isInOrganization:v.is_in_organization,license:v.license,opengraphImageUrl:v.opengraph_image_url,ownerAvatarUrl:v.owner_avatar_url,primaryLanguage:v.primary_language,primaryLanguageColor:v.primary_language_color,pushedAt:v.pushed_at,stargazerCount:v.stargazer_count,topics:v.topics,usesCustomOpengraphImage:v.uses_custom_opengraph_image}:void 0}}}o.SERIALIZER=new e})(Nuo||={});var iHt;(t=>{t.VERSION="v0.1";class i{toRawGalleryMcpServerResult(n){if(!n||typeof n!="object"||!Array.isArray(n.servers))return;let r=n,s=[];for(let l of r.servers){let c=this.toRawGalleryMcpServer(l);if(!c){if(s.length===0)return;continue}s.push(c)}return{metadata:r.metadata,servers:s}}toRawGalleryMcpServer(n){if(!n||typeof n!="object")return;let r=n;if(!r.server||!xi(r.server)||!r.server.name||!Fe(r.server.name)||!r.server.description||!Fe(r.server.description)||!r.server.version||!Fe(r.server.version))return;let{"io.modelcontextprotocol.registry/official":s,...l}=r._meta,c=r.server._meta?.["io.modelcontextprotocol.registry/publisher-provided"]?.github;return{name:r.server.name,description:r.server.description,version:r.server.version,title:r.server.title,repository:r.server.repository?{url:r.server.repository.url,source:r.server.repository.source,id:r.server.repository.id}:void 0,readme:c?.readme,icons:r.server.icons,websiteUrl:r.server.websiteUrl,packages:r.server.packages,remotes:r.server.remotes,status:s?.status,registryInfo:s,githubInfo:c,apicInfo:l}}}t.SERIALIZER=new i})(iHt||={});var oki;(t=>{t.VERSION="v0";class i{constructor(){this.galleryMcpServerDataSerializers=[];this.galleryMcpServerDataSerializers.push(iHt.SERIALIZER),this.galleryMcpServerDataSerializers.push(Nuo.SERIALIZER)}toRawGalleryMcpServerResult(n){for(let r of this.galleryMcpServerDataSerializers){let s=r.toRawGalleryMcpServerResult(n);if(s)return s}}toRawGalleryMcpServer(n){for(let r of this.galleryMcpServerDataSerializers){let s=r.toRawGalleryMcpServer(n);if(s)return s}}}t.SERIALIZER=new i})(oki||={});var UYo=50,zYo={pageSize:UYo},nki=class a{constructor(i=zYo){this.state=i}get pageSize(){return this.state.pageSize}get searchText(){return this.state.searchText}get cursor(){return this.state.cursor}withPage(i,e=this.pageSize){return new a({...this.state,pageSize:e,cursor:i})}withSearchText(i){return new a({...this.state,searchText:i})}},DMe=class extends x{constructor(e,t,o,n){super();this.requestService=e;this.fileService=t;this.logService=o;this.mcpGalleryManifestService=n;this.galleryMcpServerDataSerializers=new Map,this.galleryMcpServerDataSerializers.set(oki.VERSION,oki.SERIALIZER),this.galleryMcpServerDataSerializers.set(iHt.VERSION,iHt.SERIALIZER)}isEnabled(){return this.mcpGalleryManifestService.mcpGalleryManifestStatus==="available"}async query(e,t=Se.None){let o=await this.mcpGalleryManifestService.getMcpGalleryManifest();if(!o)return{firstPage:{items:[],hasMore:!1},getNextPage:async()=>({items:[],hasMore:!1})};let n=new nki;e?.text&&(n=n.withSearchText(e.text.trim()));let{servers:r,metadata:s}=await this.queryGalleryMcpServers(n,o,t),l=s.nextCursor;return{firstPage:{items:r,hasMore:!!s.nextCursor},getNextPage:async c=>{if(c.isCancellationRequested)throw new go;if(!l)return{items:[],hasMore:!1};let{servers:u,metadata:p}=await this.queryGalleryMcpServers(n.withPage(l).withSearchText(void 0),o,c);return l=p.nextCursor,{items:u,hasMore:!!p.nextCursor}}}}async getMcpServersFromGallery(e){let t=await this.mcpGalleryManifestService.getMcpGalleryManifest();if(!t)return[];let o=[];return await Promise.allSettled(e.map(async n=>{let r=await this.getMcpServerByName(n,t);r&&o.push(r)})),o}async getMcpServerByName({name:e,id:t},o){let n=this.getLatestServerVersionUrl(e,o);if(n){let l=await this.getMcpServer(n);if(l)return l}let r=this.getNamedServerUrl(e,o);if(r){let l=await this.getMcpServer(r);if(l)return l}let s=t?this.getServerIdUrl(t,o):void 0;if(s){let l=await this.getMcpServer(s);if(l)return l}}async getReadme(e,t){let o=e.readmeUrl;if(!o)return Promise.resolve(d(2224,null));let n=A.parse(o);if(n.scheme===Q.file)try{return(await this.fileService.readFile(n)).value.toString()}catch(l){this.logService.error(`Failed to read file from ${n}: ${l}`)}if(n.authority!=="raw.githubusercontent.com")return new Ie(d(2225,null,o)).value;let r=await this.requestService.request({type:"GET",url:o,callSite:"mcpGalleryService.getReadme"},t),s=await tD(r);if(!s)throw new Error(`Failed to fetch README from ${o}`);return s}toGalleryMcpServer(e,t){let o="",n=e.title;if(e.githubInfo?.name)n||(n=e.githubInfo.name.split("-").map(c=>c.toLowerCase()==="mcp"?"MCP":c.toLowerCase()==="github"?"GitHub":Qse(c)).join(" ")),o=e.githubInfo.nameWithOwner.split("/")[0];else{let c=e.name.split("/");if(c.length>0){let u=c[0].split(".");u.length>0&&(o=u[u.length-1])}n||(n=c[c.length-1].split("-").map(u=>Qse(u)).join(" "))}e.githubInfo?.displayName&&(n=e.githubInfo.displayName);let r;if(e.githubInfo?.preferredImage)r={light:e.githubInfo.preferredImage,dark:e.githubInfo.preferredImage};else if(e.githubInfo?.ownerAvatarUrl)r={light:e.githubInfo.ownerAvatarUrl,dark:e.githubInfo.ownerAvatarUrl};else if(e.apicInfo?.["x-ms-icon"])r={light:e.apicInfo["x-ms-icon"],dark:e.apicInfo["x-ms-icon"]};else if(e.icons&&e.icons.length>0){let c=e.icons.find(p=>p.theme==="light")??e.icons[0],u=e.icons.find(p=>p.theme==="dark")??c;r={light:c.src,dark:u.src}}let s=t?this.getWebUrl(e.name,t):void 0,l=t?this.getPublisherUrl(o,t):void 0;return{id:e.id,name:e.name,displayName:n,galleryUrl:t?.url,webUrl:s,description:e.description,status:e.status??"active",version:e.version,isLatest:e.registryInfo?.isLatest??!0,publishDate:e.registryInfo?.publishedAt?Date.parse(e.registryInfo.publishedAt):void 0,lastUpdated:e.githubInfo?.pushedAt?Date.parse(e.githubInfo.pushedAt):e.registryInfo?.updatedAt?Date.parse(e.registryInfo.updatedAt):void 0,repositoryUrl:e.repository?.url,readme:e.readme,icon:r,publisher:o,publisherUrl:l,license:e.githubInfo?.license,starsCount:e.githubInfo?.stargazerCount,topics:e.githubInfo?.topics,configuration:{packages:e.packages,remotes:e.remotes}}}async queryGalleryMcpServers(e,t,o){let{servers:n,metadata:r}=await this.queryRawGalleryMcpServers(e,t,o);return{servers:n.map(s=>this.toGalleryMcpServer(s,t)),metadata:r}}async queryRawGalleryMcpServers(e,t,o){let n=this.getMcpGalleryUrl(t);if(!n)return{servers:[],metadata:{count:0}};let r=A.parse(n);if(r.scheme===Q.file)try{let h=(await this.fileService.readFile(r)).value.toString();return JSON.parse(h)}catch(p){this.logService.error(`Failed to read file from ${r}: ${p}`)}let s=`${n}?limit=${e.pageSize}&version=latest`;if(e.cursor&&(s+=`&cursor=${e.cursor}`),e.searchText){let p=encodeURIComponent(e.searchText);s+=`&search=${p}`}let l=await this.requestService.request({type:"GET",url:s,callSite:"mcpGalleryService.queryMcpServers"},o),c=await If(l);if(!c)return{servers:[],metadata:{count:0}};let u=this.serializeMcpServersResult(c,t);if(!u)throw new Error(`Failed to serialize MCP servers result from ${n}`,c);return u}async getMcpServer(e,t){let o=await this.requestService.request({type:"GET",url:e,callSite:"mcpGalleryService.getMcpServer"},Se.None);if(o.res.statusCode&&o.res.statusCode>=400&&o.res.statusCode<500)return;let n=await If(o);if(!n)return;t||(t=await this.mcpGalleryManifestService.getMcpGalleryManifest()),t=t&&e.startsWith(t.url)?t:null;let r=this.serializeMcpServer(n,t);if(!r)throw new Error(`Failed to serialize MCP server from ${e}`,n);return this.toGalleryMcpServer(r,t)}serializeMcpServer(e,t){return this.getSerializer(t)?.toRawGalleryMcpServer(e)}serializeMcpServersResult(e,t){return this.getSerializer(t)?.toRawGalleryMcpServerResult(e)}getSerializer(e){let t=e?.version??"v0";return this.galleryMcpServerDataSerializers.get(t)}getNamedServerUrl(e,t){let o=O4(t,"McpServerNamedResourceUriTemplate");if(o)return m_(o,{name:e})}getServerIdUrl(e,t){let o=O4(t,"McpServerIdUriTemplate");if(o)return m_(o,{id:e})}getLatestServerVersionUrl(e,t){let o=O4(t,"McpServerLatestVersionUriTemplate");if(o)return m_(o,{name:encodeURIComponent(e)})}getWebUrl(e,t){let o=O4(t,"McpServerWebUriTemplate");if(o)return m_(o,{name:e})}getPublisherUrl(e,t){let o=O4(t,"PublisherUriTemplate");if(o)return m_(o,{name:e})}getMcpGalleryUrl(e){return O4(e,"McpServersQueryService")}};DMe=I([m(0,Ea),m(1,fe),m(2,se),m(3,WB)],DMe);var LMe=class extends x{constructor(e){super();this.configurationService=e;this._onDidChangeAllowedMcpServers=this._register(new E);this.onDidChangeAllowedMcpServers=this._onDidChangeAllowedMcpServers.event;this._register(this.configurationService.onDidChangeConfiguration(t=>{t.affectsConfiguration(Wk)&&this._onDidChangeAllowedMcpServers.fire()}))}isAllowed(e){if(this.configurationService.getValue(Wk)!=="none")return!0;let t=fc("workbench.action.openSettings",{query:`@id:${Wk}`}).toString();return new Ie(d(2223,null,t))}};LMe=I([m(0,B)],LMe);var Aet="workbench.actions.accounts.signIn";var KYo=new Y("defaultAccountStatus","uninitialized"),oHt="defaultAccount.cachedPolicyData",ski=3600*1e3;function Ouo(a){return{preferredExtensions:[a.chatExtensionId,a.extensionId],authenticationProvider:{default:{id:a.provider.default.id,name:a.provider.default.name},enterprise:{id:a.provider.enterprise.id,name:a.provider.enterprise.name},enterpriseProviderConfig:`${a.completionsAdvancedSetting}.authProvider`,enterpriseProviderUriSetting:a.providerUriSetting,scopes:a.providerScopes},entitlementUrl:a.entitlementUrl,tokenEntitlementUrl:a.tokenEntitlementUrl,mcpRegistryDataUrl:a.mcpRegistryDataUrl}}var RMe=class extends x{constructor(e){super();this.defaultAccount=null;this.initBarrier=new gp;this._onDidChangeDefaultAccount=this._register(new E);this.onDidChangeDefaultAccount=this._onDidChangeDefaultAccount.event;this._onDidChangePolicyData=this._register(new E);this.onDidChangePolicyData=this._onDidChangePolicyData.event;this._onDidChangeCopilotTokenInfo=this._register(new E);this.onDidChangeCopilotTokenInfo=this._onDidChangeCopilotTokenInfo.event;this.defaultAccountProvider=null;this.defaultAccountConfig=Ouo(e.defaultChatAgent)}get policyData(){return this.defaultAccountProvider?.policyData??null}get copilotTokenInfo(){return this.defaultAccountProvider?.copilotTokenInfo??null}async getDefaultAccount(){return await this.initBarrier.wait(),this.defaultAccount}getDefaultAccountAuthenticationProvider(){return this.defaultAccountProvider?this.defaultAccountProvider.getDefaultAccountAuthenticationProvider():{...this.defaultAccountConfig.authenticationProvider.default,enterprise:!1}}setDefaultAccountProvider(e){if(this.defaultAccountProvider)throw new Error("Default account provider is already set");this.defaultAccountProvider=e,this.defaultAccountProvider.policyData&&this._onDidChangePolicyData.fire(this.defaultAccountProvider.policyData),e.refresh().then(t=>{this.defaultAccount=t}).finally(()=>{this.initBarrier.open(),this._register(e.onDidChangeDefaultAccount(t=>this.setDefaultAccount(t))),this._register(e.onDidChangePolicyData(t=>this._onDidChangePolicyData.fire(t))),this._register(e.onDidChangeCopilotTokenInfo(t=>this._onDidChangeCopilotTokenInfo.fire(t)))})}async refresh(){await this.initBarrier.wait();let e=await this.defaultAccountProvider?.refresh();return this.setDefaultAccount(e??null),this.defaultAccount}async signIn(e){return await this.initBarrier.wait(),this.defaultAccountProvider?.signIn(e)??null}async signOut(){await this.initBarrier.wait(),await this.defaultAccountProvider?.signOut()}setDefaultAccount(e){eo(this.defaultAccount,e)||(this.defaultAccount=e,this._onDidChangeDefaultAccount.fire(this.defaultAccount))}};RMe=I([m(0,tt)],RMe);var Pet=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.defaultAccountConfig=e;this.configurationService=t;this.authenticationService=o;this.authenticationExtensionsService=n;this.telemetryService=r;this.extensionService=s;this.requestService=l;this.logService=c;this.environmentService=u;this.storageService=h;this.hostService=g;this.commandService=f;this._defaultAccount=null;this._policyData=null;this._copilotTokenInfo=null;this._onDidChangeDefaultAccount=this._register(new E);this.onDidChangeDefaultAccount=this._onDidChangeDefaultAccount.event;this._onDidChangePolicyData=this._register(new E);this.onDidChangePolicyData=this._onDidChangePolicyData.event;this._onDidChangeCopilotTokenInfo=this._register(new E);this.onDidChangeCopilotTokenInfo=this._onDidChangeCopilotTokenInfo.event;this.initialized=!1;this.updateThrottler=this._register(new ya(100));this.accountDataPollScheduler=this._register(new Dt(()=>this.refetchDefaultAccount(),ski));this.accountStatusContext=KYo.bindTo(p);let v=this.getCachedAccountData();this._policyData=v?.accountPolicyData??null,this._copilotTokenInfo=v?.copilotTokenInfo??null,this.initPromise=this.init().finally(()=>{this.telemetryService.publicLog2("defaultaccount:status",{status:this.defaultAccount?"available":"unavailable",initial:!0}),this.initialized=!0})}get defaultAccount(){return this._defaultAccount?.defaultAccount??null}get policyData(){return this._policyData?.policyData??null}get copilotTokenInfo(){return this._copilotTokenInfo}getCachedAccountData(){let e=this.storageService.get(oHt,-1);if(e)try{let t=JSON.parse(e),{accountId:o,policyData:n,tokenEntitlementsFetchedAt:r,mcpRegistryDataFetchedAt:s,copilotTokenInfo:l}=t;if(o&&n){this.logService.debug("[DefaultAccount] Initializing with cached policy data (migrating old format)");let p={accountPolicyData:{accountId:o,policyData:n,tokenEntitlementsFetchedAt:r,mcpRegistryDataFetchedAt:s},copilotTokenInfo:l};return this.storageService.store(oHt,JSON.stringify(p),-1,1),p}let{accountPolicyData:c,copilotTokenInfo:u}=t;if(c?.accountId&&c?.policyData)return this.logService.debug("[DefaultAccount] Initializing with cached policy data"),{accountPolicyData:c,copilotTokenInfo:u}}catch(t){this.logService.error("[DefaultAccount] Failed to parse cached policy data",Pn(t))}return null}async init(){if(Wt&&!this.environmentService.remoteAuthority){this.logService.debug("[DefaultAccount] Running in web without remote, skipping initialization");return}try{await this.extensionService.whenInstalledExtensionsRegistered(),this.logService.debug("[DefaultAccount] Installed extensions registered.")}catch(e){this.logService.error("[DefaultAccount] Error while waiting for installed extensions to be registered",Pn(e))}this.logService.debug("[DefaultAccount] Starting initialization"),await this.doUpdateDefaultAccount(),this.logService.debug("[DefaultAccount] Initialization complete"),this._register(this.onDidChangeDefaultAccount(e=>{this.telemetryService.publicLog2("defaultaccount:status",{status:e?"available":"unavailable",initial:!1})})),this._register(this.authenticationService.onDidChangeSessions(e=>{let t=this.getDefaultAccountAuthenticationProvider();e.providerId===t.id&&(this.defaultAccount&&e.event.removed?.some(o=>o.id===this.defaultAccount?.sessionId)?this.setDefaultAccount(null):(this.logService.debug("[DefaultAccount] Sessions changed for default account provider, updating default account"),this.updateDefaultAccount()))})),this._register(this.authenticationExtensionsService.onDidChangeAccountPreference(async e=>{let t=this.getDefaultAccountAuthenticationProvider();e.providerId===t.id&&(this.logService.debug("[DefaultAccount] Account preference changed for default account provider, updating default account"),this.updateDefaultAccount())})),this._register(this.authenticationService.onDidRegisterAuthenticationProvider(e=>{let t=this.getDefaultAccountAuthenticationProvider();e.id===t.id&&(this.logService.debug("[DefaultAccount] Default account provider registered, updating default account"),this.updateDefaultAccount())})),this._register(this.authenticationService.onDidUnregisterAuthenticationProvider(e=>{let t=this.getDefaultAccountAuthenticationProvider();e.id===t.id&&(this.logService.debug("[DefaultAccount] Default account provider unregistered, updating default account"),this.updateDefaultAccount())})),this._register(this.hostService.onDidChangeFocus(e=>{e&&this.refetchDefaultAccount(!0)}))}async refresh(){return this.initialized?(this.logService.debug("[DefaultAccount] Refreshing default account"),await this.updateDefaultAccount(),this.defaultAccount):(await this.initPromise,this.defaultAccount)}async refetchDefaultAccount(e){if(this.accountDataPollScheduler.isScheduled()&&this.accountDataPollScheduler.cancel(),!this.hostService.hasFocus||!this._defaultAccount){this.scheduleAccountDataPoll(),this.logService.debug("[DefaultAccount] Skipping refetching default account. Host is not focused or default account is not set");return}this.logService.debug("[DefaultAccount] Refetching default account"),await this.updateDefaultAccount(e)}async updateDefaultAccount(e){await this.updateThrottler.trigger(()=>this.doUpdateDefaultAccount(e))}async doUpdateDefaultAccount(e=!1){try{let t=await this.fetchDefaultAccount(e);this.setDefaultAccount(t),this.scheduleAccountDataPoll()}catch(t){this.logService.error("[DefaultAccount] Error while updating default account",Pn(t))}}async fetchDefaultAccount(e){let t=this.getDefaultAccountAuthenticationProvider();return this.logService.debug("[DefaultAccount] Default account provider ID:",t.id),this.authenticationService.declaredProviders.find(n=>n.id===t.id)?await this.getDefaultAccountForAuthenticationProvider(t,e):(this.logService.info("[DefaultAccount] Authentication provider is not declared.",t),null)}setDefaultAccount(e){eo(this._defaultAccount,e)||(this.logService.trace("[DefaultAccount] Updating default account:",e),e?(this._defaultAccount=e,this.setCopilotTokenInfo(e.copilotTokenInfo),this.setPolicyData(e.policyData),this._onDidChangeDefaultAccount.fire(this._defaultAccount.defaultAccount),this.accountStatusContext.set("available"),this.logService.debug("[DefaultAccount] Account status set to Available")):(this._defaultAccount=null,this.setPolicyData(null),this.setCopilotTokenInfo(null),this._onDidChangeDefaultAccount.fire(null),this.accountDataPollScheduler.cancel(),this.accountStatusContext.set("unavailable"),this.logService.debug("[DefaultAccount] Account status set to Unavailable")))}setPolicyData(e){eo(this._policyData,e)||(this._policyData=e,this.cachePolicyData(e),this._onDidChangePolicyData.fire(this._policyData?.policyData??null))}setCopilotTokenInfo(e){eo(this._copilotTokenInfo,e)||(this._copilotTokenInfo=e,this._onDidChangeCopilotTokenInfo.fire(this._copilotTokenInfo))}cachePolicyData(e){if(e){this.logService.debug("[DefaultAccount] Caching policy data for account:",e.accountId);let t={accountPolicyData:e,copilotTokenInfo:this._copilotTokenInfo??void 0};this.storageService.store(oHt,JSON.stringify(t),-1,1)}else this.logService.debug("[DefaultAccount] Removing cached policy data"),this.storageService.remove(oHt,-1)}scheduleAccountDataPoll(){this._defaultAccount&&this.accountDataPollScheduler.schedule(ski)}extractFromToken(e){let t=new Map,n=e?.split(":")[0]?.split(";");for(let r of n){let[s,l]=r.split("=");t.set(s,l)}return this.logService.debug(`[DefaultAccount] extractFromToken: ${JSON.stringify(Object.fromEntries(t))}`),t}async getDefaultAccountForAuthenticationProvider(e,t){try{this.logService.debug("[DefaultAccount] Getting Default Account from authenticated sessions for provider:",e.id);let o=await this.findMatchingProviderSession(e.id,this.defaultAccountConfig.authenticationProvider.scopes);return o?.length?this.getDefaultAccountFromAuthenticatedSessions(e,o,t):(this.logService.debug("[DefaultAccount] No matching session found for provider:",e.id),null)}catch(o){return this.logService.error("[DefaultAccount] Failed to get default account for provider:",e.id,Pn(o)),null}}async getDefaultAccountFromAuthenticatedSessions(e,t,o){try{let n=t[0].account.id,r=this._defaultAccount?.accountId===n?this._defaultAccount?.defaultAccount.entitlementsData:void 0,s=this._policyData?.accountId===n?this._policyData:void 0,[l,c]=await Promise.all([o&&r?r:this.getEntitlements(t),this.getTokenEntitlements(t,s)]),u,p,h=s?.policyData?{...s.policyData}:void 0;if(c){u=c.fetchedAt;let f=c.data;if(h=h??{},h.chat_agent_enabled=f.policyData.chat_agent_enabled,h.chat_preview_features_enabled=f.policyData.chat_preview_features_enabled,h.mcp=f.policyData.mcp,h.mcp){let v=await this.getMcpRegistryProvider(t,s);p=v?.fetchedAt,h.mcpRegistryUrl=v?.data?.url,h.mcpAccess=v?.data?.registry_access}else h.mcpRegistryUrl=void 0,h.mcpAccess=void 0}let g={authenticationProvider:e,accountName:t[0].account.label,sessionId:t[0].id,enterprise:e.enterprise||t[0].account.label.includes("_"),entitlementsData:l};return this.logService.debug("[DefaultAccount] Successfully created default account for provider:",e.id),{defaultAccount:g,accountId:n,policyData:h?{accountId:n,policyData:h,tokenEntitlementsFetchedAt:u,mcpRegistryDataFetchedAt:p}:null,copilotTokenInfo:c?.data.copilotTokenInfo??null}}catch(n){return this.logService.error("[DefaultAccount] Failed to create default account for provider:",e.id,Pn(n)),null}}async findMatchingProviderSession(e,t){let o=await this.getSessions(e),n=[];for(let r of o){this.logService.debug("[DefaultAccount] Checking session with scopes",r.scopes);for(let s of t)this.scopesMatch(r.scopes,s)&&n.push(r)}return n.length>0?n:void 0}async getSessions(e){for(let t=1;t<=3;t++)try{let o,n;for(let r of this.defaultAccountConfig.preferredExtensions)if(n=this.authenticationExtensionsService.getAccountPreference(r,e),n)break;for(let r of await this.authenticationService.getAccounts(e))if(r.label===n){o=r;break}return await this.authenticationService.getSessions(e,void 0,{account:o},!0)}catch(o){if(this.logService.warn(`[DefaultAccount] Attempt ${t} to get sessions failed:`,Pn(o)),t===3)throw o;await Li(500)}throw new Error("Unable to get sessions after multiple attempts")}scopesMatch(e,t){return t.every(o=>e.includes(o))}async getTokenEntitlements(e,t){if(t?.tokenEntitlementsFetchedAt&&!this.isDataStale(t.tokenEntitlementsFetchedAt))return this.logService.debug("[DefaultAccount] Using last fetched token entitlements data"),{data:{policyData:t.policyData,copilotTokenInfo:this._copilotTokenInfo??{}},fetchedAt:t.tokenEntitlementsFetchedAt};let o=await this.requestTokenEntitlements(e);return o?{data:o,fetchedAt:Date.now()}:void 0}async requestTokenEntitlements(e){let t=this.getTokenEntitlementUrl();if(!t){this.logService.debug("[DefaultAccount] No token entitlements URL found");return}this.logService.debug("[DefaultAccount] Fetching token entitlements from:",t);let o=await this.request(t,"GET",void 0,e,Se.None,"defaultAccount.tokenEntitlements");if(o){if(o.res.statusCode&&o.res.statusCode!==200){this.logService.trace(`[DefaultAccount] unexpected status code ${o.res.statusCode} while fetching token entitlements`);return}try{let n=await If(o);if(n){let r=this.extractFromToken(n.token);return{policyData:{chat_preview_features_enabled:r.get("editor_preview_features")!=="0",chat_agent_enabled:r.get("agent_mode")!=="0",mcp:r.get("mcp")!=="0"},copilotTokenInfo:{sn:r.get("sn"),fcv1:r.get("fcv1")}}}this.logService.error("Failed to fetch token entitlements","No data returned")}catch(n){this.logService.error("Failed to fetch token entitlements",Pn(n))}}}async getEntitlements(e){let t=this.getEntitlementUrl();if(!t){this.logService.debug("[DefaultAccount] No chat entitlements URL found");return}this.logService.debug("[DefaultAccount] Fetching entitlements from:",t);let o=await this.request(t,"GET",void 0,e,Se.None,"defaultAccount.entitlements");if(o){if(o.res.statusCode&&o.res.statusCode!==200)return this.logService.trace(`[DefaultAccount] unexpected status code ${o.res.statusCode} while fetching entitlements`),o.res.statusCode===401||o.res.statusCode===404?null:void 0;try{let n=await If(o);if(n)return n;this.logService.error("[DefaultAccount] Failed to fetch entitlements","No data returned")}catch(n){this.logService.error("[DefaultAccount] Failed to fetch entitlements",Pn(n))}}}async getMcpRegistryProvider(e,t){if(t?.mcpRegistryDataFetchedAt&&!this.isDataStale(t.mcpRegistryDataFetchedAt))return this.logService.debug("[DefaultAccount] Using last fetched MCP registry data"),{data:t.policyData.mcpRegistryUrl&&t.policyData.mcpAccess?{url:t.policyData.mcpRegistryUrl,registry_access:t.policyData.mcpAccess}:null,fetchedAt:t.mcpRegistryDataFetchedAt};let o=await this.requestMcpRegistryProvider(e);return gn(o)?void 0:{data:o,fetchedAt:Date.now()}}async requestMcpRegistryProvider(e){let t=this.getMcpRegistryDataUrl();if(!t)return this.logService.debug("[DefaultAccount] No MCP registry data URL found"),null;this.logService.debug("[DefaultAccount] Fetching MCP registry data from:",t);let o=await this.request(t,"GET",void 0,e,Se.None,"defaultAccount.mcpRegistryProvider");if(o){if(!ZP(o)){if(LDt(o))return this.logService.debug(`[DefaultAccount] Received ${o.res.statusCode} for MCP registry data, treating as no registry available.`),null;this.logService.debug(`[DefaultAccount] unexpected status code ${o.res.statusCode} while fetching MCP registry data`);return}try{let n=await If(o);return n?(this.logService.debug("Fetched MCP registry providers",n.mcp_registries),n.mcp_registries[0]??null):(this.logService.debug("No MCP registry providers content found in response"),null)}catch(n){this.logService.error("Failed to fetch MCP registry providers",Pn(n));return}}}async request(e,t,o,n,r,s){let l;for(let c of n){if(r.isCancellationRequested)return l;try{let u=await this.requestService.request({type:t,url:e,data:t==="POST"?JSON.stringify(o):void 0,disableCache:!0,headers:{Authorization:`Bearer ${c.accessToken}`},callSite:s},r),p=u.res.statusCode;if(p===401||p===404){this.logService.debug(`[DefaultAccount] Received ${p} for URL ${e} with session ${c.id}, likely due to expired/revoked token or insufficient permissions.`,"Trying next session if available."),l=u;continue}return u}catch(u){r.isCancellationRequested||this.logService.error(`[DefaultAccount] request: error ${u}`,e)}}if(!l){this.logService.trace("[DefaultAccount]: No response received for request",e);return}return l}isDataStale(e){return Date.now()-e>=ski}getEntitlementUrl(){if(this.getDefaultAccountAuthenticationProvider().enterprise)try{let e=this.getEnterpriseUrl();return e?`${e.protocol}//api.${e.hostname}${e.port?":"+e.port:""}/copilot_internal/user`:void 0}catch(e){this.logService.error(e)}return this.defaultAccountConfig.entitlementUrl}getTokenEntitlementUrl(){if(this.getDefaultAccountAuthenticationProvider().enterprise)try{let e=this.getEnterpriseUrl();return e?`${e.protocol}//api.${e.hostname}${e.port?":"+e.port:""}/copilot_internal/v2/token`:void 0}catch(e){this.logService.error(e)}return this.defaultAccountConfig.tokenEntitlementUrl}getMcpRegistryDataUrl(){if(this.getDefaultAccountAuthenticationProvider().enterprise)try{let e=this.getEnterpriseUrl();return e?`${e.protocol}//api.${e.hostname}${e.port?":"+e.port:""}/copilot/mcp_registry`:void 0}catch(e){this.logService.error(e)}return this.defaultAccountConfig.mcpRegistryDataUrl}getDefaultAccountAuthenticationProvider(){return this.configurationService.getValue(this.defaultAccountConfig.authenticationProvider.enterpriseProviderConfig)===this.defaultAccountConfig.authenticationProvider.enterprise.id?{...this.defaultAccountConfig.authenticationProvider.enterprise,enterprise:!0}:{...this.defaultAccountConfig.authenticationProvider.default,enterprise:!1}}getEnterpriseUrl(){let e=this.configurationService.getValue(this.defaultAccountConfig.authenticationProvider.enterpriseProviderUriSetting);if(Fe(e))return new URL(e)}async signIn(e){let t=this.getDefaultAccountAuthenticationProvider();if(!t)throw new Error("No default account provider configured");let{additionalScopes:o,...n}=e??{},r=this.defaultAccountConfig.authenticationProvider.scopes[0],s=o?zo([...r,...o]):r,l=await this.authenticationService.createSession(t.id,s,n);for(let c of this.defaultAccountConfig.preferredExtensions)this.authenticationExtensionsService.updateAccountPreference(c,t.id,l.account);return await this.updateDefaultAccount(),this.defaultAccount}async signOut(){this.defaultAccount&&this.commandService.executeCommand("_signOutOfAccount",{providerId:this.defaultAccount.authenticationProvider.id,accountLabel:this.defaultAccount.accountName})}};Pet=I([m(1,B),m(2,xs),m(3,jX),m(4,Te),m(5,lt),m(6,Ea),m(7,se),m(8,At),m(9,X),m(10,ce),m(11,Zt),m(12,ge)],Pet);var MMe=class extends x{static{this.ID="workbench.contributions.defaultAccountProvider"}constructor(i,e,t){super();let o=this._register(e.createInstance(Pet,Ouo(i.defaultChatAgent)));t.setDefaultAccountProvider(o)}};MMe=I([m(0,tt),m(1,F),m(2,ng)],MMe);W(class extends K{constructor(){super({id:Aet,title:L(17230,"Sign In")})}async run(a){await a.get(ng).signIn()}});It(MMe.ID,MMe,St.BlockStartup);var Fuo;(i=>{function a(e,t){return e.callstack<t.callstack?-1:e.callstack>t.callstack?1:0}i.compare=a})(Fuo||={});var Net=class a{constructor(i,e=a.ERROR_FLUSH_TIMEOUT){this._flushHandle=void 0;this._buffer=[];this._disposables=new N;this._telemetryService=i,this._flushDelay=e;let t=k9.addListener(o=>this._onErrorEvent(o));this._disposables.add(Z(t)),this.installErrorListeners()}static{this.ERROR_FLUSH_TIMEOUT=5*1e3}dispose(){clearTimeout(this._flushHandle),this._flushBuffer(),this._disposables.dispose()}installErrorListeners(){}_onErrorEvent(i){if(!i||i.code||(i.detail&&i.detail.stack&&(i=i.detail),pa.isErrorNoTelemetry(i)||i instanceof ta||iht.is(i)||typeof i?.message=="string"&&i.message.includes("Unable to read file")))return;let e=Array.isArray(i.stack)?i.stack.join(`
`):i.stack,t=i.message?i.message:CV(i);e&&this._enqueue({msg:t,callstack:e})}_enqueue(i){let e=Px(this._buffer,i,Fuo.compare);e<0?(i.count=1,this._buffer.splice(~e,0,i)):(this._buffer[e].count||(this._buffer[e].count=0),this._buffer[e].count+=1),this._flushHandle===void 0&&(this._flushHandle=setTimeout(()=>{this._flushBuffer(),this._flushHandle=void 0},this._flushDelay))}_flushBuffer(){for(let i of this._buffer)this._telemetryService.publicLogError2("UnhandledError",i);this._buffer.length=0}};var Oet=class extends Net{installErrorListeners(){let i,e=this;typeof ut.onerror=="function"&&(i=ut.onerror),ut.onerror=function(t,o,n,r,s){e._onUncaughtError(t,o,n,r,s),i?.apply(this,[t,o,n,r,s])},this._disposables.add(Z(()=>{i&&(ut.onerror=i)}))}_onUncaughtError(i,e,t,o,n){let r={callstack:i,msg:i,file:e,line:t,column:o};if(n){if(pa.isErrorNoTelemetry(n))return;let{name:s,message:l,stack:c}=n;r.uncaught_error_name=s,l&&(r.uncaught_error_msg=l),c&&(r.callstack=Array.isArray(n.stack)?n.stack=n.stack.join(`
`):n.stack)}this._enqueue(r)}};var Oee=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.telemetryService=e;this.contextService=t;this.userDataProfileService=c;this.loggerService=h;this.outputService=g;let{filesToOpenOrCreate:v,filesToDiff:b,filesToMerge:S}=l,y=u.getActivePaneComposite(0);e.publicLog2("workspaceLoad",{windowSize:{innerHeight:ut.innerHeight,innerWidth:ut.innerWidth,outerHeight:ut.outerHeight,outerWidth:ut.outerWidth},emptyWorkbench:t.getWorkbenchState()===1,"workbench.filesToOpenOrCreate":v&&v.length||0,"workbench.filesToDiff":b&&b.length||0,"workbench.filesToMerge":S&&S.length||0,customKeybindingsCount:r.customKeybindingsCount(),theme:s.getColorTheme().id,language:wr,pinnedViewlets:u.getPinnedPaneCompositeIds(0),restoredViewlet:y?y.getId():void 0,restoredEditors:n.visibleEditors.length,startupKind:o.startupKind}),this._register(new Oet(e)),this._register(f.files.onDidResolve(w=>this.onTextFileModelResolved(w))),this._register(f.files.onDidSave(w=>this.onTextFileModelSaved(w))),this._register(o.onDidShutdown(()=>this.dispose())),DR(p,l)&&this.handleTelemetryOutputVisibility()}static{this.ALLOWLIST_JSON=["package.json","package-lock.json","tsconfig.json","jsconfig.json","bower.json",".eslintrc.json","tslint.json","composer.json"]}static{this.ALLOWLIST_WORKSPACE_JSON=["settings.json","extensions.json","tasks.json","launch.json"]}onTextFileModelResolved(e){this.getTypeIfSettings(e.model.resource)||this.telemetryService.publicLog2("fileGet",this.getTelemetryData(e.model.resource,e.reason))}onTextFileModelSaved(e){this.getTypeIfSettings(e.model.resource)||this.telemetryService.publicLog2("filePUT",this.getTelemetryData(e.model.resource,e.reason))}getTypeIfSettings(e){if(es(e)!==".json")return"";if(Qe(e,this.userDataProfileService.currentProfile.settingsResource))return"global-settings";if(Qe(e,this.userDataProfileService.currentProfile.keybindingsResource))return"keybindings";if(ws(e,this.userDataProfileService.currentProfile.snippetsHome))return"snippets";let t=this.contextService.getWorkspace().folders;for(let o of t)if(ws(e,o.toResource(".vscode"))){let n=He(e);if(Oee.ALLOWLIST_WORKSPACE_JSON.indexOf(n)>-1)return`.vscode/${n}`}return""}getTelemetryData(e,t){let o=es(e),n=o.indexOf("?");o=n!==-1?o.substr(0,n):o;let r=He(e),s=e.scheme===Q.file?e.fsPath:e.path,l={mimeType:new sg(K_e(e).join(", ")),ext:o,path:_r(s),reason:t,allowlistedjson:void 0};return o===".json"&&Oee.ALLOWLIST_JSON.indexOf(r)>-1&&(l.allowlistedjson=r),l}async handleTelemetryOutputVisibility(){let e=this;this._register(W(class extends K{constructor(){super({id:"workbench.action.showTelemetry",title:L(14724,"Show Telemetry"),category:Ve.Developer,f1:!0})}async run(){for(let o of e.loggerService.getRegisteredLoggers())o.group?.id===LTt.id&&(e.loggerService.setLogLevel(o.resource,1),e.loggerService.setVisibility(o.resource,!0));e.outputService.showChannel(LTt.id)}})),[...this.loggerService.getRegisteredLoggers()].find(o=>o.id===wde)||await U.toPromise(U.filter(this.loggerService.onDidChangeLoggers,o=>[...o.added].some(n=>n.id===wde)));let t=!1;for(let o of this.loggerService.getRegisteredLoggers())if(o.id===wde){t=this.loggerService.getLogLevel()===1||!o.hidden,t&&this.loggerService.setVisibility(o.id,!0);break}if(t){let o=n=>{for(let r of n)r.group?.id===LTt.id&&(e.loggerService.setLogLevel(r.resource,1),this.loggerService.setVisibility(r.id,!0))};o(this.loggerService.getRegisteredLoggers()),this._register(this.loggerService.onDidChangeLoggers(n=>o(n.added)))}}};Oee=I([m(0,Te),m(1,Pe),m(2,ji),m(3,ee),m(4,_e),m(5,sp),m(6,At),m(7,ln),m(8,us),m(9,tt),m(10,Il),m(11,kl),m(12,Uo)],Oee);var Fet=class extends x{constructor(e,t,o){super();this.configurationService=e;this.userDataProfilesService=t;this.telemetryService=o;this.configurationRegistry=ne.as(Jt.Configuration);let{user:n,workspace:r}=e.keys();for(let s of n)this.reportTelemetry(s,3);for(let s of r)this.reportTelemetry(s,5)}getValueToReport(e,t){let o=this.configurationService.inspect(e),n=t===3?o.user?.value:o.workspace?.value;if(Yo(n)||Wa(n))return n.toString();let r=this.configurationRegistry.getConfigurationProperties()[e];if(Fe(n))return r?.enum?.includes(n)?n:void 0;if(Array.isArray(n)&&n.every(s=>Yo(s)||Wa(s)||Fe(s)&&r?.enum?.includes(s)))return JSON.stringify(n)}reportTelemetry(e,t){let o=p7(t);switch(e){case"workbench.activityBar.location":this.telemetryService.publicLog2("workbench.activityBar.location",{settingValue:this.getValueToReport(e,t),source:o});return;case Fw:this.telemetryService.publicLog2("extensions.autoUpdate",{settingValue:this.getValueToReport(e,t),source:o});return;case"editor.stickyScroll.enabled":this.telemetryService.publicLog2("editor.stickyScroll.enabled",{settingValue:this.getValueToReport(e,t),source:o});return;case"typescript.experimental.expandableHover":this.telemetryService.publicLog2("typescript.experimental.expandableHover",{settingValue:this.getValueToReport(e,t),source:o});return;case"window.titleBarStyle":this.telemetryService.publicLog2("window.titleBarStyle",{settingValue:this.getValueToReport(e,t),source:o});return;case"workbench.secondarySideBar.defaultVisibility":this.telemetryService.publicLog2("workbench.secondarySideBar.defaultVisibility",{settingValue:this.getValueToReport(e,t),source:o});return;case Qke:this.telemetryService.publicLog2("extensions.verifySignature",{settingValue:this.getValueToReport(e,t),source:o});return;case"window.newWindowProfile":{let n=this.getValueToReport(e,t),r=n===null?"null":n===this.userDataProfilesService.defaultProfile.name?"default":"custom";this.telemetryService.publicLog2("window.newWindowProfile",{settingValue:r,source:o});return}case OB:this.telemetryService.publicLog2("extensions.autoRestart",{settingValue:this.getValueToReport(e,t),source:o});return;case jl.OutputLocation:this.telemetryService.publicLog2("terminal.integrated.chatAgentTools.outputLocation",{settingValue:this.getValueToReport(e,t),source:o});return;case jl.SuggestEnabled:this.telemetryService.publicLog2("terminal.integrated.suggest.enabled",{settingValue:this.getValueToReport(e,t),source:o});return;case jl.AgentSandboxEnabled:this.telemetryService.publicLog2("chat.agent.sandbox",{settingValue:this.getValueToReport(e,t),source:o});return}}};Fet=I([m(0,B),m(1,an),m(2,Te)],Fet);var Wuo=ne.as(Qi.Workbench);Wuo.registerWorkbenchContribution(Oee,3);Wuo.registerWorkbenchContribution(Fet,4);var rHt=le("preferencesSearchService");var Vuo=new Y("inPreferencesSearch",!1),sHt="settings.action.clearSearchResults",Buo="settings.action.showAIResults",aHt="settings.action.toggleAiSearch",lHt="settings.action.showContextMenu",Huo="settings.action.suggestFilters",KD=new Y("inSettingsEditor",!1),aki=new Y("inSettingsJSONEditor",!1),Ame=new Y("inSettingsSearch",!1),cHt=new Y("settingsTocRowFocus",!1),Wet=new Y("settingRowFocus",!1),Bg=new Y("inKeybindings",!1),PMe=new Y("inKeybindingsSearch",!1),dHt=new Y("keybindingsSearchHasValue",!1),z0=new Y("keybindingFocus",!1),Nme=new Y("whenFocus",!1),uHt=new Y("aiSettingResultsAvailable",!1),Uuo="keybindings.editor.searchKeybindings",pHt="keybindings.editor.clearSearchResults",zuo="keybindings.editor.clearSearchHistory",mHt="keybindings.editor.recordSearchKeys",hHt="keybindings.editor.toggleSortByPrecedence",AMe="keybindings.editor.defineKeybinding",gHt="keybindings.editor.addKeybinding",fHt="keybindings.editor.defineWhenExpression",Kuo="keybindings.editor.acceptWhenExpression",Guo="keybindings.editor.rejectWhenExpression",vHt="keybindings.editor.removeKeybinding",bHt="keybindings.editor.resetKeybinding",SHt="keybindings.editor.copyKeybindingEntry",IHt="keybindings.editor.copyCommandKeybindingEntry",yHt="keybindings.editor.copyCommandTitle",wHt="keybindings.editor.showConflicts",quo="keybindings.editor.focusKeybindings",$uo="keybindings.editor.showDefaultKeybindings",juo="keybindings.editor.showUserKeybindings",Quo="keybindings.editor.showExtensionKeybindings",lG="modified",NMe="ext:",Vk="feature:",Vet="id:",K0="lang:",Yuo="tag:",FH="hasPolicy",i8="workspaceTrust",OMe="requireTrustedWorkspace",o8="advanced";var CHt=!0,lki=!0,cki=1e3,xHt="local",kHt="tfIdf",Xuo="filterModel",EHt="embeddingsFull",THt="llmRanked";var nHt;async function Juo(a,i,e){if(lki&&i.isEnabled()&&!(a.sentiment.hidden||a.sentiment.disabled)){if(nHt)return nHt;if(e.extensionRecommendations){let t={};Object.keys(e.extensionRecommendations).forEach(n=>{let r=e.extensionRecommendations[n];r.onSettingsEditorOpen&&(t[n]=r)});let o={};for(let n in t){let r=n,s=e.quality==="stable";try{let l=await vp(i.getExtensions([{id:r,preRelease:!s}],Se.None),cki);if(l?.length===1)o[n]=l[0];else return}catch{return}}return nHt={settingsEditorRecommendedExtensions:t,recommendedExtensionsGalleryInfo:o},nHt}}}function Ome(a,i){let e=a??Number.MAX_SAFE_INTEGER,t=i??Number.MAX_SAFE_INTEGER;return e<t?-1:e>t?1:0}var _Ht=d(13265,null),DHt=d(13264,null),Zuo=d(13263,null),epo=new Set;["css","html","scss","less","json","js","ts","ie","id","php","scm"].forEach(a=>epo.add(a));var cG=new Map;cG.set("power shell","PowerShell");cG.set("powershell","PowerShell");cG.set("javascript","JavaScript");cG.set("typescript","TypeScript");cG.set("github","GitHub");cG.set("jet brains","JetBrains");cG.set("jetbrains","JetBrains");cG.set("re sharper","ReSharper");cG.set("resharper","ReSharper");function dki(a){a=a.replace(/\.([a-z0-9])/g,(i,e)=>` \u203A ${e.toUpperCase()}`).replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]{1,})([A-Z][a-z])/g,"$1 $2").replace(/^[a-z]/g,i=>i.toUpperCase()).replace(/\b\w+\b/g,i=>epo.has(i.toLowerCase())?i.toUpperCase():i);for(let[i,e]of cG)a=a.replace(new RegExp(`\\b${i}\\b`,"gi"),e);return a}var FMe=ne.as(ma.JSONContribution),G0=class extends x{constructor(e,t){super();this.preferencesService=e;this.logService=t;this._onDidChangeFile=this._register(new E);this.onDidChangeFile=this._onDidChangeFile.event;this.capabilities=2050;this.onDidChangeCapabilities=U.None;this._register(FMe.onDidChangeSchema(o=>{this._onDidChangeFile.fire([{resource:A.parse(o),type:0}])})),this._register(FMe.onDidChangeSchemaAssociations(()=>{this._onDidChangeFile.fire([{resource:G0.SCHEMA_ASSOCIATIONS,type:0}])})),this._register(e.onDidDefaultSettingsContentChanged(o=>{this._onDidChangeFile.fire([{resource:o,type:0}])}))}static{this.SCHEMA=Q.vscode}static{this.SCHEMA_ASSOCIATIONS=A.parse(`${Q.vscode}://schemas-associations/schemas-associations.json`)}async readFile(e){if(e.scheme!==G0.SCHEMA)throw new b$;let t;if(e.authority==="schemas"?t=this.getSchemaContent(e):e.authority===G0.SCHEMA_ASSOCIATIONS.authority?t=JSON.stringify(FMe.getSchemaAssociations()):e.authority==="defaultsettings"&&(t=this.preferencesService.getDefaultSettingsContent(e)),t)return qe.fromString(t).buffer;throw"EntryNotFound"}async stat(e){if(FMe.hasSchemaContent(e.toString())||this.preferencesService.hasDefaultSettingsContent(e)){let t=Date.now();return{type:1,permissions:1,mtime:t,ctime:t,size:0}}if(Qe(e,G0.SCHEMA_ASSOCIATIONS)){let t=Date.now();return{type:1,permissions:1,mtime:t,ctime:t,size:0}}throw"EntryNotFound"}watch(e,t){return x.None}async mkdir(e){}async readdir(e){return[]}async rename(e,t,o){}async delete(e,t){}async writeFile(){throw new b$}getSchemaContent(e){let t=Date.now(),o=FMe.getSchemaContent(e.toString())??"{}",n=this.logService.getLevel();if(n===2||n===1){let r=Date.now(),s=JSON.stringify(FMe.getSchemaContributions().schemas[e.toString()]);this.logService.debug(`${e.toString()}: ${s.length} -> ${o.length} (${Math.round((s.length-o.length)/s.length*100)}%) Took ${r-t}ms`)}return o}};G0=I([m(0,Go),m(1,se)],G0);var Fme=class extends x{constructor(e,t,o,n,r,s,l,c){super();this.instantiationService=t;this.preferencesService=o;this.userDataProfileService=n;this.workspaceService=r;this.configurationService=s;this.editorResolverService=l;this.textEditorService=c;this._register(this.configurationService.onDidChangeConfiguration(p=>{(p.affectsConfiguration(pYe)||p.affectsConfiguration(uYe))&&this.handleSettingsEditorRegistration()})),this.handleSettingsEditorRegistration();let u=this._register(this.instantiationService.createInstance(G0));this._register(e.registerProvider(G0.SCHEMA,u))}static{this.ID="workbench.contrib.preferences"}handleSettingsEditorRegistration(){Be(this.editorOpeningListener),(this.configurationService.getValue(pYe)||this.configurationService.getValue(uYe))&&(this.editorOpeningListener=this.editorResolverService.registerEditor("**/settings.json",{id:Ma.ID,label:d(13270,null),priority:"builtin"},{},{createEditorInput:({resource:e,options:t})=>{if(Qe(e,this.userDataProfileService.currentProfile.settingsResource))return{editor:this.preferencesService.createSplitJsonEditorInput(3,e),options:t};let o=this.workspaceService.getWorkbenchState();if(o===2){let n=this.workspaceService.getWorkspace().folders;if(Qe(e,n[0].toResource(k_e)))return{editor:this.preferencesService.createSplitJsonEditorInput(5,e),options:t}}else if(o===3){let n=this.workspaceService.getWorkspace().folders;for(let r of n)if(Qe(e,r.toResource(k_e)))return{editor:this.preferencesService.createSplitJsonEditorInput(6,e),options:t}}return{editor:this.textEditorService.createTextEditor({resource:e}),options:t}}}))}dispose(){Be(this.editorOpeningListener),super.dispose()}};Fme=I([m(0,fe),m(1,F),m(2,Go),m(3,ln),m(4,Pe),m(5,B),m(6,Ka),m(7,Pk)],Fme);var GYo=ne.as(Jt.Configuration);GYo.registerConfiguration({...Ud,properties:{"workbench.settings.enableNaturalLanguageSearch":{type:"boolean",description:d(13266,null),default:!0,scope:4,tags:["usesOnlineServices"]},"workbench.settings.settingsSearchTocBehavior":{type:"string",enum:["hide","filter"],enumDescriptions:[d(13269,null),d(13268,null)],description:d(13267,null),default:"filter",scope:4}}});var tpo=Ae("settings-folder-dropdown",R.chevronDown,d(13052,null)),ipo=Ae("settings-more-action",R.gear,d(13050,null)),opo=Ae("keybindings-record-keys",R.recordKeys,d(13042,null)),npo=Ae("keybindings-sort",R.sortPrecedence,d(13043,null)),rpo=Ae("keybindings-edit",R.edit,d(13041,null)),spo=Ae("keybindings-add",R.add,d(13040,null)),Wme=Ae("settings-edit",R.edit,d(13048,null)),uki=Ae("settings-remove",R.close,d(13051,null)),apo=Ae("settings-discard",R.discard,d(13046,null)),WMe=Ae("preferences-clear-input",R.clearAll,d(13045,null)),lpo=Ae("preferences-ai-results",R.sparkle,d(13044,null)),cpo=Ae("preferences-filter",R.filter,d(13049,null)),n8=Ae("preferences-open-settings",R.goToFile,d(13047,null));var Bet=class extends wl{constructor(e,t,o,n){super(null,e);this.contextService=t;this.contextMenuService=o;this.hoverService=n;this._folderSettingCounts=new Map;let r=this.contextService.getWorkspace();this._folder=r.folders.length===1?r.folders[0]:null,this._register(this.contextService.onDidChangeWorkspaceFolders(()=>this.onWorkspaceFoldersChanged()))}get folder(){return this._folder}set folder(e){this._folder=e,this.update()}setCount(e,t){let o=this.contextService.getWorkspaceFolder(e);if(!o)throw new Error("unknown folder");let n=o.uri;this._folderSettingCounts.set(n.toString(),t),this.update()}render(e){this.element=e,this.container=e,this.labelElement=_(".action-title"),this.detailsElement=_(".action-details"),this.dropDownElement=_(".dropdown-icon.hide"+q.asCSSSelector(tpo)),this.anchorElement=_("a.action-label.folder-settings",{role:"button","aria-haspopup":"true",tabindex:"0"},this.labelElement,this.detailsElement,this.dropDownElement),this.anchorElementHover=this._register(this.hoverService.setupManagedHover(Ri("mouse"),this.anchorElement,"")),this._register(j(this.anchorElement,re.MOUSE_DOWN,t=>Xt.stop(t))),this._register(j(this.anchorElement,re.CLICK,t=>this.onClick(t))),this._register(j(this.container,re.KEY_UP,t=>this.onKeyUp(t))),M(this.container,this.anchorElement),this.update()}onKeyUp(e){switch(new gi(e).keyCode){case 3:case 10:this.onClick(e);return}}onClick(e){Xt.stop(e,!0),!this.folder||this._action.checked?this.showMenu():this._action.run(this._folder)}updateEnabled(){this.update()}updateChecked(){this.update()}onWorkspaceFoldersChanged(){let e=this._folder,t=this.contextService.getWorkspace();e&&(this._folder=t.folders.filter(o=>Qe(o.uri,e.uri))[0]||t.folders[0]),this._folder=this._folder?this._folder:t.folders.length===1?t.folders[0]:null,this.update(),this._action.checked&&this._action.run(this._folder)}update(){let e=0;this._folderSettingCounts.forEach(o=>e+=o);let t=this.contextService.getWorkspace();if(this._folder){this.labelElement.textContent=this._folder.name,this.anchorElementHover.update(this._folder.name);let o=this.labelWithCount(this._action.label,e);this.detailsElement.textContent=o,this.dropDownElement.classList.toggle("hide",t.folders.length===1||!this._action.checked)}else{let o=this.labelWithCount(this._action.label,e);this.labelElement.textContent=o,this.detailsElement.textContent="",this.anchorElementHover.update(this._action.label),this.dropDownElement.classList.remove("hide")}this.anchorElement.classList.toggle("checked",this._action.checked),this.container.classList.toggle("disabled",!this._action.enabled)}showMenu(){this.contextMenuService.showContextMenu({getAnchor:()=>this.container,getActions:()=>this.getDropdownMenuActions(),getActionViewItem:()=>{},onHide:()=>{this.anchorElement.blur()}})}getDropdownMenuActions(){let e=[],t=this.contextService.getWorkspace().folders;return this.contextService.getWorkbenchState()===3&&t.length>0&&e.push(...t.map((o,n)=>{let r=this._folderSettingCounts.get(o.uri.toString());return{id:"folderSettingsTarget"+n,label:this.labelWithCount(o.name,r),tooltip:this.labelWithCount(o.name,r),checked:!!this.folder&&Qe(this.folder.uri,o.uri),enabled:!0,class:void 0,run:()=>this._action.run(o)}})),e}labelWithCount(e,t){return t&&(e+=` (${t})`),e}};Bet=I([m(1,Pe),m(2,Xe),m(3,nt)],Bet);var VMe=class extends ja{constructor(e,t,o,n,r,s,l){super();this.contextService=o;this.instantiationService=n;this.environmentService=r;this.labelService=s;this.languageService=l;this._settingsTarget=null;this._onDidTargetChange=this._register(new E);this.onDidTargetChange=this._onDidTargetChange.event;this.options=t??{},this.create(e),this._register(this.contextService.onDidChangeWorkbenchState(()=>this.onWorkbenchStateChanged())),this._register(this.contextService.onDidChangeWorkspaceFolders(()=>this.update()))}resetLabels(){let e=this.environmentService.remoteAuthority,t=e&&this.labelService.getHostLabel(Q.vscodeRemote,e);this.userLocalSettings.label=d(13074,null),this.userRemoteSettings.label=d(13075,null)+(t?` [${t}]`:""),this.workspaceSettings.label=d(13076,null),this.folderSettingsAction.label=d(13072,null)}create(e){let t=M(e,_(".settings-tabs-widget"));this.settingsSwitcherBar=this._register(new Zi(t,{orientation:0,focusOnlyEnabledItems:!0,ariaLabel:d(13073,null),ariaRole:"tablist",actionViewItemProvider:(r,s)=>r.id==="folderSettings"?this.folderSettings:void 0})),this.userLocalSettings=this._register(new it("userSettings","",".settings-tab",!0,()=>this.updateTarget(3))),this.userLocalSettings.tooltip=d(13074,null),this.userRemoteSettings=this._register(new it("userSettingsRemote","",".settings-tab",!0,()=>this.updateTarget(4)));let o=this.environmentService.remoteAuthority,n=o&&this.labelService.getHostLabel(Q.vscodeRemote,o);this.userRemoteSettings.tooltip=d(13075,null)+(n?` [${n}]`:""),this.workspaceSettings=this._register(new it("workspaceSettings","",".settings-tab",!1,()=>this.updateTarget(5))),this.folderSettingsAction=this._register(new it("folderSettings","",".settings-tab",!1,async r=>{this.updateTarget(hw(r)?r.uri:3)})),this.folderSettings=this._register(this.instantiationService.createInstance(Bet,this.folderSettingsAction)),this.resetLabels(),this.update(),this.settingsSwitcherBar.push([this.userLocalSettings,this.userRemoteSettings,this.workspaceSettings,this.folderSettingsAction])}get settingsTarget(){return this._settingsTarget}set settingsTarget(e){this._settingsTarget=e,this.userLocalSettings.checked=3===this.settingsTarget,this.userRemoteSettings.checked=4===this.settingsTarget,this.workspaceSettings.checked=5===this.settingsTarget,this.settingsTarget instanceof A?(this.folderSettings.action.checked=!0,this.folderSettings.folder=this.contextService.getWorkspaceFolder(this.settingsTarget)):this.folderSettings.action.checked=!1}setResultCount(e,t){if(e===5){let o=d(13076,null);t&&(o+=` (${t})`),this.workspaceSettings.label=o}else if(e===3){let o=d(13074,null);t&&(o+=` (${t})`),this.userLocalSettings.label=o}else e instanceof A&&this.folderSettings.setCount(e,t)}updateLanguageFilterIndicators(e){if(this.resetLabels(),e){let t=this.languageService.getLanguageName(e);if(t){let o=` [${t}]`;this.userLocalSettings.label+=o,this.userRemoteSettings.label+=o,this.workspaceSettings.label+=o,this.folderSettingsAction.label+=o}}}onWorkbenchStateChanged(){this.folderSettings.folder=null,this.update(),this.settingsTarget===5&&this.contextService.getWorkbenchState()===3&&this.updateTarget(3)}updateTarget(e){return this.settingsTarget===e||e instanceof A&&this.settingsTarget instanceof A&&Qe(this.settingsTarget,e)||(this.settingsTarget=e,this._onDidTargetChange.fire(this.settingsTarget)),Promise.resolve(void 0)}async update(){this.settingsSwitcherBar.domNode.classList.toggle("empty-workbench",this.contextService.getWorkbenchState()===1),this.userRemoteSettings.enabled=!!(this.options.enableRemoteSettings&&this.environmentService.remoteAuthority),this.workspaceSettings.enabled=this.contextService.getWorkbenchState()!==1&&!this.environmentService.isSessionsWindow,this.folderSettings.action.enabled=this.contextService.getWorkbenchState()===3&&this.contextService.getWorkspace().folders.length>0,this.workspaceSettings.tooltip=d(13076,null)}};VMe=I([m(2,Pe),m(3,F),m(4,At),m(5,rt),m(6,_t)],VMe);var Fee=class extends ja{constructor(e,t,o,n,r,s){super();this.options=t;this.contextViewService=o;this.instantiationService=n;this.contextKeyService=r;this.keybindingService=s;this._onDidChange=this._register(new E);this._onFocus=this._register(new E);this.create(e)}get onDidChange(){return this._onDidChange.event}get onFocus(){return this._onFocus.event}create(e){this.domNode=M(e,_("div.settings-header-widget")),this.createSearchContainer(M(this.domNode,_("div.settings-search-container"))),this.controlsDiv=M(this.domNode,_("div.settings-search-controls")),this.options.showResultCount&&(this.countElement=M(this.controlsDiv,_(".settings-count-widget")),this.countElement.style.backgroundColor=kt(bv),this.countElement.style.color=kt(CC),this.countElement.style.border=`1px solid ${kt(bi)}`),this.inputBox.inputElement.setAttribute("aria-live",this.options.ariaLive||"off"),this.options.ariaLabelledBy&&this.inputBox.inputElement.setAttribute("aria-labelledBy",this.options.ariaLabelledBy);let t=this._register(qn(this.inputBox.inputElement));this._register(t.onDidFocus(()=>this._onFocus.fire()));let o=this.options.focusKey;o&&(this._register(t.onDidFocus(()=>o.set(!0))),this._register(t.onDidBlur(()=>o.set(!1))))}createSearchContainer(e){this.searchContainer=e;let t=M(this.searchContainer,_("div.settings-search-input"));this.inputBox=this._register(this.createInputBox(t)),this._register(this.inputBox.onDidChange(o=>this._onDidChange.fire(o)))}createInputBox(e){let t=()=>bR(this.keybindingService);return new Bz(e,this.contextViewService,{...this.options,showHistoryHint:t},this.contextKeyService)}showMessage(e){this.countElement&&e!==this.countElement.textContent&&(this.countElement.textContent=e,this.inputBox.inputElement.setAttribute("aria-label",e),this.inputBox.inputElement.style.paddingRight=this.getControlsWidth()+"px")}layout(e){e.width<400?(this.countElement?.classList.add("hide"),this.inputBox.inputElement.style.paddingRight="0px"):(this.countElement?.classList.remove("hide"),this.inputBox.inputElement.style.paddingRight=this.getControlsWidth()+"px")}getControlsWidth(){return(this.countElement?zl(this.countElement):0)+20}focus(){this.inputBox.focus(),this.getValue()&&this.inputBox.select()}hasFocus(){return this.inputBox.hasFocus()}clear(){this.inputBox.value=""}getValue(){return this.inputBox.value}setValue(e){return this.inputBox.value=e}dispose(){this.options.focusKey?.set(!1),super.dispose()}};Fee=I([m(2,Wn),m(3,F),m(4,X),m(5,_e)],Fee);var Het=class extends x{constructor(e){super();this.editor=e;this._line=-1;this._preferences=[];this._onClick=this._register(new E);this.onClick=this._onClick.event;this._editPreferenceDecoration=this.editor.createDecorationsCollection(),this._register(this.editor.onMouseDown(t=>{t.target.type!==2||t.target.detail.isAfterLines||!this.isVisible()||this._onClick.fire(t)}))}get preferences(){return this._preferences}getLine(){return this._line}show(e,t,o){this._preferences=o;let n=[];this._line=e,n.push({options:{description:"edit-preference-widget-decoration",glyphMarginClassName:q.asClassName(Wme),glyphMarginHoverMessage:new Ie().appendText(t),stickiness:1},range:{startLineNumber:e,startColumn:1,endLineNumber:e,endColumn:1}}),this._editPreferenceDecoration.set(n)}hide(){this._editPreferenceDecoration.clear()}isVisible(){return this._editPreferenceDecoration.length>0}dispose(){this.hide(),super.dispose()}};var Vme=class extends Fee{constructor(e,t,o,n,r,s){super(e,t,o,n,r,s);this.recordDisposables=this._register(new N);this._onKeybinding=this._register(new E);this.onKeybinding=this._onKeybinding.event;this._onEnter=this._register(new E);this.onEnter=this._onEnter.event;this._onEscape=this._register(new E);this.onEscape=this._onEscape.event;this._onBlur=this._register(new E);this.onBlur=this._onBlur.event;this._register(Z(()=>this.stopRecordingKeys())),this._chords=null,this._inputValue=""}clear(){this._chords=null,super.clear()}startRecordingKeys(){this.recordDisposables.add(j(this.inputBox.inputElement,re.KEY_DOWN,e=>this._onKeyDown(new gi(e)))),this.recordDisposables.add(j(this.inputBox.inputElement,re.BLUR,()=>this._onBlur.fire())),this.recordDisposables.add(j(this.inputBox.inputElement,re.INPUT,()=>{this.setInputValue(this._inputValue)}))}stopRecordingKeys(){this._chords=null,this.recordDisposables.clear()}setInputValue(e){this._inputValue=e,this.inputBox.value=this._inputValue}_onKeyDown(e){if(e.preventDefault(),e.stopPropagation(),!this.options.recordEnter&&e.equals(3)){this._onEnter.fire();return}if(e.equals(9)){this._onEscape.fire();return}this.printKeybinding(e)}printKeybinding(e){let t=this.keybindingService.resolveKeyboardEvent(e),o=`code: ${e.browserEvent.code}, keyCode: ${e.browserEvent.keyCode}, key: ${e.browserEvent.key} => UI: ${t.getAriaLabel()}, user settings: ${t.getUserSettingsLabel()}, dispatch: ${t.getDispatchChords()[0]}`,n=this.options;this._chords||(this._chords=[]),this._chords.length>0&&this._chords[this._chords.length-1].getDispatchChords()[0]===null?this._chords[this._chords.length-1]=t:(this._chords.length===2&&(this._chords=[]),this._chords.push(t));let s=this._chords.map(l=>l.getUserSettingsLabel()||"").join(" ");this.setInputValue(n.quoteRecordedKeys?`"${s}"`:s),this.inputBox.inputElement.title=o,this._onKeybinding.fire(this._chords)}};Vme=I([m(2,Wn),m(3,F),m(4,X),m(5,_e)],Vme);var q0=class extends ja{constructor(e,t){super();this.instantiationService=t;this._keybindingDisposables=this._register(new N);this._chords=null;this._isVisible=!1;this._onHide=this._register(new E);this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._onShowExistingKeybindings=this._register(new E);this.onShowExistingKeybidings=this._onShowExistingKeybindings.event;this._domNode=ur(document.createElement("div")),this._domNode.setDisplay("none"),this._domNode.setClassName("defineKeybindingWidget"),this._domNode.setWidth(q0.WIDTH),this._domNode.setHeight(q0.HEIGHT);let o=d(12989,null);M(this._domNode.domNode,_(".message",void 0,o)),this._domNode.domNode.style.backgroundColor=kt(Su),this._domNode.domNode.style.color=kt(jL),this._keybindingInputWidget=this._register(this.instantiationService.createInstance(Vme,this._domNode.domNode,{ariaLabel:o,history:new Set([]),inputBoxStyles:Cl})),this._keybindingInputWidget.startRecordingKeys(),this._register(this._keybindingInputWidget.onKeybinding(n=>this.onKeybinding(n))),this._register(this._keybindingInputWidget.onEnter(()=>this.hide())),this._register(this._keybindingInputWidget.onEscape(()=>this.clearOrHide())),this._register(this._keybindingInputWidget.onBlur(()=>this.onCancel())),this._outputNode=M(this._domNode.domNode,_(".output")),this._showExistingKeybindingsNode=M(this._domNode.domNode,_(".existing")),e&&M(e,this._domNode.domNode)}static{this.WIDTH=400}static{this.HEIGHT=110}get domNode(){return this._domNode.domNode}define(){return this._keybindingInputWidget.clear(),dn.withAsyncBody(async e=>{this._isVisible||(this._isVisible=!0,this._domNode.setDisplay("block"),this._chords=null,this._keybindingInputWidget.setInputValue(""),Rt(this._outputNode),Rt(this._showExistingKeybindingsNode),await Li(0),this._keybindingInputWidget.focus());let t=this._onHide.event(()=>{e(this.getUserSettingsLabel()),t.dispose()})})}layout(e){let t=Math.round((e.height-q0.HEIGHT)/2);this._domNode.setTop(t);let o=Math.round((e.width-q0.WIDTH)/2);this._domNode.setLeft(o)}printExisting(e){if(e>0){let t=_("span.existingText"),o=e===1?d(12990,null,e):d(12988,null,e);M(t,document.createTextNode(o)),en(o),this._showExistingKeybindingsNode.appendChild(t),t.onmousedown=n=>{n.preventDefault()},t.onmouseup=n=>{n.preventDefault()},t.onclick=()=>{this._onShowExistingKeybindings.fire(this.getUserSettingsLabel())}}}onKeybinding(e){if(this._keybindingDisposables.clear(),this._chords=e,Rt(this._outputNode),Rt(this._showExistingKeybindingsNode),this._keybindingDisposables.add(new Am(this._outputNode,Po,Jx)).set(this._chords?.[0]??void 0),this._chords)for(let n=1;n<this._chords.length;n++)this._outputNode.appendChild(document.createTextNode(d(12987,null))),this._keybindingDisposables.add(new Am(this._outputNode,Po,Jx)).set(this._chords[n]);let o=this.getUserSettingsLabel();o&&this._onDidChange.fire(o)}getUserSettingsLabel(){let e=null;return this._chords&&(e=this._chords.map(t=>t.getUserSettingsLabel()).join(" ")),e}onCancel(){this._chords=null,this.hide()}clearOrHide(){this._chords===null?this.hide():(this._chords=null,this._keybindingInputWidget.clear(),Rt(this._outputNode),Rt(this._showExistingKeybindingsNode))}hide(){this._domNode.setDisplay("none"),this._isVisible=!1,this._onHide.fire()}};q0=I([m(1,F)],q0);var Wee=class extends x{constructor(e,t){super();this._editor=e;this._widget=this._register(t.createInstance(q0,null)),this._editor.addOverlayWidget(this)}static{this.ID="editor.contrib.defineKeybindingWidget"}getId(){return Wee.ID}getDomNode(){return this._widget.domNode}getPosition(){return{preference:null}}dispose(){this._editor.removeOverlayWidget(this),super.dispose()}start(){this._editor.hasModel()&&this._editor.revealPositionInCenterIfOutsideViewport(this._editor.getPosition(),0);let e=this._editor.getLayoutInfo();return this._widget.layout(new si(e.width,e.height)),this._widget.define()}};Wee=I([m(1,F)],Wee);function Vb(a){return{wordWrap:"on",overviewRulerLanes:0,glyphMargin:!1,lineNumbers:"off",folding:!1,selectOnLineNumbers:!1,hideCursorInOverviewRuler:!0,selectionHighlight:!1,scrollbar:{horizontal:"hidden",alwaysConsumeMouseWheel:!1},lineDecorationsWidth:0,overviewRulerBorder:!1,scrollBeyondLastLine:!1,renderLineHighlight:"none",fixedOverflowWidgets:!0,acceptSuggestionOnEnter:"smart",dragAndDrop:!1,revealHorizontalRightPadding:5,minimap:{enabled:!1},guides:{indentation:!1},wordSegmenterLocales:a.getValue("editor.wordSegmenterLocales"),accessibilitySupport:a.getValue("editor.accessibilitySupport"),cursorBlinking:a.getValue("editor.cursorBlinking"),editContext:a.getValue("editor.editContext"),defaultColorDecorators:"never",allowVariableLineHeights:!1,allowVariableFonts:!1,allowVariableFontsInAccessibilityMode:!1}}function BMe(){return{isSimpleWidget:!0,contributions:Ba.getSomeEditorContributions([yy.ID,xy,og.ID,nc.ID,vs.ID,Cy.ID])}}function HMe(a){return is((i,e)=>{let t=i.getColor(Rvt);if(t){let o=i.getColor(yv);o&&(e.addRule(`${a} .monaco-editor-background { background-color: ${o}; } `),e.addRule(`${a} .monaco-editor .selected-text { background-color: ${o.transparent(.4)}; }`));let n=i.getColor(QL);n&&e.addRule(`${a} .monaco-editor .view-line span.inline-selected-text { color: ${n}; }`),e.addRule(`${a} .monaco-editor .focused .selected-text { background-color: ${t}; }`)}else e.addRule(`${a} .monaco-editor .focused .selected-text { background-color: ${i.getColor(Sv)}; }`)})}var $A=class extends ja{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this._onShouldFocusResults=this._register(new E);this.onShouldFocusResults=this._onShouldFocusResults.event;this._onInputDidChange=this._register(new E);this.onInputDidChange=this._onInputDidChange.event;this._onDidFocus=this._register(new E);this.onDidFocus=this._onDidFocus.event;this._onDidBlur=this._register(new E);this.onDidBlur=this._onDidBlur.event;this.stylingContainer=M(t,_(".suggest-input-container")),this.element=t,this.placeholderText=M(this.stylingContainer,_(".suggest-input-placeholder",void 0,s.placeholderText||""));let g=Xu(Vb(h),qYo(n));g.overflowWidgetsDomNode=s.overflowWidgetsDomNode;let f=this.getScopedContextKeyService(u),v=f?this._register(l.createChild(new _o([X,f]))):l;this.inputWidget=this._register(v.createInstance(Xr,this.stylingContainer,g,{contributions:Ba.getSomeEditorContributions([nc.ID,vs.ID,og.ID,yy.ID,xy]),isSimpleWidget:!0})),this._register(h.onDidChangeConfiguration(k=>{if(k.affectsConfiguration("editor.accessibilitySupport")||k.affectsConfiguration("editor.cursorBlinking")){let T=h.getValue("editor.accessibilitySupport"),P=h.getValue("editor.cursorBlinking");this.inputWidget.updateOptions({accessibilitySupport:T,cursorBlinking:P})}})),this._register(this.inputWidget.onDidFocusEditorText(()=>this._onDidFocus.fire())),this._register(this.inputWidget.onDidBlurEditorText(()=>this._onDidBlur.fire()));let b=A.parse(r);this.inputModel=c.createModel("",null,b,!0),this._register(this.inputModel),this.inputWidget.setModel(this.inputModel),this._register(this.inputWidget.onDidPaste(()=>this.setValue(this.getValue()))),this._register(this.inputWidget.onDidFocusEditorText(()=>{s.focusContextKey&&s.focusContextKey.set(!0),this.stylingContainer.classList.add("synthetic-focus")})),this._register(this.inputWidget.onDidBlurEditorText(()=>{s.focusContextKey&&s.focusContextKey.set(!1),this.stylingContainer.classList.remove("synthetic-focus")})),this._register(U.chain(this.inputWidget.onKeyDown,k=>k.filter(T=>T.keyCode===3))(k=>{k.preventDefault()},this)),this._register(U.chain(this.inputWidget.onKeyDown,k=>k.filter(T=>T.keyCode===18&&(Ze?T.metaKey:T.ctrlKey)))(()=>this._onShouldFocusResults.fire(),this));let S=this.getValue(),y=this.inputWidget.getModel();y&&this._register(y.onDidChangeContent(()=>{let k=this.getValue();this.placeholderText.style.visibility=k?"hidden":"visible",S.trim()!==k.trim()&&(this._onInputDidChange.fire(void 0),S=k)}));let w={provideResults:o.provideResults,sortKey:o.sortKey||(k=>k),triggerCharacters:o.triggerCharacters||[],wordDefinition:o.wordDefinition?Q$(o.wordDefinition):void 0,alwaysShowSuggestions:!!o.alwaysShowSuggestions};this.setValue(s.value||""),this._register(p.completionProvider.register({scheme:b.scheme,pattern:"**/"+b.path,hasAccessToAllModels:!0},{_debugDisplayName:`suggestEnabledInput/${e}`,triggerCharacters:w.triggerCharacters,provideCompletionItems:(k,T,P)=>{let O=k.getValue(),V=T.column-1,H=0,G=0;if(w.wordDefinition){let $=Wx(T.column,w.wordDefinition,O,0);H=$?.word.length??0,G=$?$.startColumn-1:0}else G=O.lastIndexOf(" ",V-1)+1,H=V-G;return!w.alwaysShowSuggestions&&H>0&&w.triggerCharacters?.indexOf(O[G])===-1?{suggestions:[]}:{suggestions:o.provideResults(O).map($=>{let J,ae;return typeof $=="string"?J=$:(J=$.label,ae=$),{label:J,insertText:J,range:z.fromPositions(T.delta(0,-H),T),sortText:w.sortKey(J),kind:17,...ae}})}}})),this.style(s.styleOverrides||{})}getScopedContextKeyService(e){}updateAriaLabel(e){this.inputWidget.updateOptions({ariaLabel:e})}setValue(e){e=e.replace(/\s/g," ");let t=this.inputModel.getFullModelRange();this.inputWidget.executeEdits("suggestEnabledInput.setValue",[Hn.replace(t,e)]),this.inputWidget.setScrollTop(0),this.inputWidget.setPosition(new ye(1,e.length+1))}getValue(){return this.inputWidget.getValue()}style(e){this.stylingContainer.style.backgroundColor=kt(e.inputBackground??yv),this.stylingContainer.style.color=kt(e.inputForeground??QL),this.placeholderText.style.color=kt(e.inputPlaceholderForeground??Hye),this.stylingContainer.style.borderWidth="1px",this.stylingContainer.style.borderStyle="solid",this.stylingContainer.style.borderColor=tle(e.inputBorder??nw,"transparent");let t=this.stylingContainer.getElementsByClassName("cursor")[0];t&&(t.style.backgroundColor=kt(e.inputForeground??QL))}focus(e){this.inputWidget.focus(),e&&this.inputWidget.getValue()&&this.selectAll()}onHide(){this.inputWidget.onHide()}layout(e){this.inputWidget.layout(e),this.placeholderText.style.width=`${e.width-2}px`}selectAll(){this.inputWidget.setSelection(new z(1,1,1,this.getValue().length+1))}};$A=I([m(6,F),m(7,Tt),m(8,X),m(9,Qt),m(10,B)],$A);var Uet=class extends $A{constructor({id:i,parent:e,ariaLabel:t,suggestionProvider:o,resourceHandle:n,suggestOptions:r,history:s},l,c,u,p,h){super(i,e,o,t,n,r,l,c,u,p,h),this.history=this._register(new BY(new Set(s),100))}addToHistory(){let i=this.getValue();i&&i!==this.getCurrentValue()&&this.history.add(i)}getHistory(){return this.history.getHistory()}showNextValue(){this.history.has(this.getValue())||this.addToHistory();let i=this.getNextValue();i&&(i=i===this.getValue()?this.getNextValue():i),this.setValue(i??"")}showPreviousValue(){this.history.has(this.getValue())||this.addToHistory();let i=this.getPreviousValue();i&&(i=i===this.getValue()?this.getPreviousValue():i),i&&(this.setValue(i),this.inputWidget.setPosition({lineNumber:0,column:0}))}clearHistory(){this.history.clear()}getCurrentValue(){let i=this.history.current();return i||(i=this.history.last(),this.history.next()),i}getPreviousValue(){return this.history.previous()||this.history.first()}getNextValue(){return this.history.next()}};Uet=I([m(1,F),m(2,Tt),m(3,X),m(4,Qt),m(5,B)],Uet);var UMe=class extends Uet{constructor(i,e,t,o,n,r){super(i,e,t,o,n,r);let{historyNavigationBackwardsEnablement:s,historyNavigationForwardsEnablement:l}=this.historyContext;this._register(this.inputWidget.onDidChangeCursorPosition(({position:c})=>{let u=this.inputWidget._getViewModel(),p=u.getLineCount(),h=u.getLineLength(p)+1,g=u.coordinatesConverter.convertModelPositionToViewPosition(c);s.set(g.lineNumber===1&&g.column===1),l.set(g.lineNumber===p&&g.column===h)}))}getScopedContextKeyService(i){let e=this._register(i.createScoped(this.element));return this.historyContext=this._register(XV(e,this)),e}};UMe=I([m(1,F),m(2,Tt),m(3,X),m(4,Qt),m(5,B)],UMe);HMe(".suggest-input-container");function qYo(a){return{fontSize:13,lineHeight:20,wordWrap:"off",scrollbar:{vertical:"hidden"},roundedSelection:!1,guides:{indentation:!1},cursorWidth:1,fontFamily:NO,ariaLabel:a||"",snippetSuggestions:"none",suggest:{filterGraceful:!1,showIcons:!1},autoClosingBrackets:"never"}}var zet=te("settings.headerForeground",{light:"#444444",dark:"#e7e7e7",hcDark:"#ffffff",hcLight:"#292929"},d(13272,null)),pki=te("settings.settingsHeaderHoverForeground",ai(zet,.7),d(13287,null)),_qd=te("settings.modifiedItemIndicator",{light:new We(new zt(102,175,224)),dark:new We(new zt(12,125,157)),hcDark:new We(new zt(0,73,122)),hcLight:new We(new zt(102,175,224))},d(13273,null)),dpo=te("settings.headerBorder",vf,d(13286,null)),Ket=te("settings.sashBorder",vf,d(13288,null)),LHt=te("settings.dropdownBackground",$1,d(13282,null)),RHt=te("settings.dropdownForeground",ule,d(13284,null)),MHt=te("settings.dropdownBorder",TO,d(13283,null)),PHt=te("settings.dropdownListBorder",CO,d(13285,null)),Dqd=te("settings.checkboxBackground",zye,d(13279,null)),Lqd=te("settings.checkboxForeground",Kye,d(13281,null)),Rqd=te("settings.checkboxBorder",jvt,d(13280,null)),zMe=te("settings.textInputBackground",yv,d(13289,null)),KMe=te("settings.textInputForeground",QL,d(13291,null)),AT=te("settings.textInputBorder",nw,d(13290,null)),upo=te("settings.numberInputBackground",yv,d(13274,null)),ppo=te("settings.numberInputForeground",QL,d(13276,null)),mpo=te("settings.numberInputBorder",nw,d(13275,null)),Mqd=te("settings.focusedRowBackground",{dark:ai(yE,.6),light:ai(yE,.6),hcDark:null,hcLight:null},d(13271,null)),Pqd=te("settings.rowHoverBackground",{dark:ai(yE,.3),light:ai(yE,.3),hcDark:null,hcLight:null},d(13278,null)),Aqd=te("settings.focusedRowBorder",Sd,d(13277,null));var PS=_,Ph=class extends Ts{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super(Ph.ID,e,t,o,g);this.keybindingsService=n;this.contextMenuService=r;this.keybindingEditingService=s;this.contextKeyService=l;this.notificationService=c;this.clipboardService=u;this.instantiationService=p;this.editorService=h;this.configurationService=f;this.accessibilityService=v;this._onDefineWhenExpression=this._register(new E);this.onDefineWhenExpression=this._onDefineWhenExpression.event;this._onRejectWhenExpression=this._register(new E);this.onRejectWhenExpression=this._onRejectWhenExpression.event;this._onAcceptWhenExpression=this._register(new E);this.onAcceptWhenExpression=this._onAcceptWhenExpression.event;this._onLayout=this._register(new E);this.onLayout=this._onLayout.event;this.keybindingsEditorModel=null;this.unAssignedKeybindingItemToRevealAndFocus=null;this.tableEntries=[];this.dimension=null;this.latestEmptyFilters=[];this.delayedFiltering=this._register(new Xo(300)),this._register(n.onDidUpdateKeybindings(()=>this.render(!!this.keybindingFocusContextKey.get()))),this.keybindingsEditorContextKey=Bg.bindTo(this.contextKeyService),this.searchFocusContextKey=PMe.bindTo(this.contextKeyService),this.keybindingFocusContextKey=z0.bindTo(this.contextKeyService),this.searchHasValueContextKey=dHt.bindTo(this.contextKeyService),this.searchHistoryDelayer=this._register(new Xo(500)),this.recordKeysAction=this._register(new it(mHt,d(12972,null),q.asClassName(opo))),this.recordKeysAction.checked=!1,this.sortByPrecedenceAction=this._register(new it(hHt,d(12980,null),q.asClassName(npo))),this.sortByPrecedenceAction.checked=!1,this.overflowWidgetsDomNode=PS(".keybindings-overflow-widgets-container.monaco-editor")}static{this.ID="workbench.editor.keybindings"}create(e){super.create(e),this._register(bT({name:"keybindingsEditor",focusNotifiers:[this],focusNextWidget:()=>{this.searchWidget.hasFocus()&&this.focusKeybindings()},focusPreviousWidget:()=>{this.searchWidget.hasFocus()||this.focusSearch()}}))}createEditor(e){let t=M(e,PS("div",{class:"keybindings-editor"}));this.createAriaLabelElement(t),this.createOverlayContainer(t),this.createHeader(t),this.createBody(t)}setInput(e,t,o,n){return this.keybindingsEditorContextKey.set(!0),super.setInput(e,t,o,n).then(()=>this.render(!!(t&&t.preserveFocus)))}clearInput(){super.clearInput(),this.keybindingsEditorContextKey.reset(),this.keybindingFocusContextKey.reset()}layout(e){this.dimension=e,this.layoutSearchWidget(e),this.overlayContainer.style.width=e.width+"px",this.overlayContainer.style.height=e.height+"px",this.defineKeybindingWidget.layout(this.dimension),this.layoutKeybindingsTable(),this._onLayout.fire()}focus(){super.focus();let e=this.activeKeybindingEntry;e?this.selectEntry(e):dc||this.searchWidget.focus()}get activeKeybindingEntry(){let e=this.keybindingsTable.getFocusedElements()[0];return e&&e.templateId===F3?e:null}async defineKeybinding(e,t){this.selectEntry(e),this.showOverlayContainer();try{let o=await this.defineKeybindingWidget.define();o&&await this.updateKeybinding(e,o,e.keybindingItem.when,t)}catch(o){this.onKeybindingEditingError(o)}finally{this.hideOverlayContainer(),this.selectEntry(e)}}defineWhenExpression(e){e.keybindingItem.keybinding&&(this.selectEntry(e),this._onDefineWhenExpression.fire(e))}rejectWhenExpression(e){this._onRejectWhenExpression.fire(e)}acceptWhenExpression(e){this._onAcceptWhenExpression.fire(e)}async updateKeybinding(e,t,o,n){((e.keybindingItem.keybinding?e.keybindingItem.keybinding.getUserSettingsLabel():"")!==t||e.keybindingItem.when!==o)&&(n?await this.keybindingEditingService.addKeybinding(e.keybindingItem.keybindingItem,t,o||void 0):await this.keybindingEditingService.editKeybinding(e.keybindingItem.keybindingItem,t,o||void 0),e.keybindingItem.keybinding||(this.unAssignedKeybindingItemToRevealAndFocus=e))}async removeKeybinding(e){if(this.selectEntry(e),e.keybindingItem.keybinding)try{await this.keybindingEditingService.removeKeybinding(e.keybindingItem.keybindingItem),this.focus()}catch(t){this.onKeybindingEditingError(t),this.selectEntry(e)}}async resetKeybinding(e){this.selectEntry(e);try{await this.keybindingEditingService.resetKeybinding(e.keybindingItem.keybindingItem),e.keybindingItem.keybinding||(this.unAssignedKeybindingItemToRevealAndFocus=e),this.selectEntry(e)}catch(t){this.onKeybindingEditingError(t),this.selectEntry(e)}}async copyKeybinding(e){this.selectEntry(e);let t={key:e.keybindingItem.keybinding&&e.keybindingItem.keybinding.getUserSettingsLabel()||"",command:e.keybindingItem.command};e.keybindingItem.when&&(t.when=e.keybindingItem.when),await this.clipboardService.writeText(JSON.stringify(t,null,"  "))}async copyKeybindingCommand(e){this.selectEntry(e),await this.clipboardService.writeText(e.keybindingItem.command)}async copyKeybindingCommandTitle(e){this.selectEntry(e),await this.clipboardService.writeText(e.keybindingItem.commandLabel)}focusSearch(){this.searchWidget.focus()}search(e){this.focusSearch(),this.searchWidget.setValue(e),this.selectEntry(0)}clearSearchResults(){this.searchWidget.clear(),this.searchHasValueContextKey.set(!1)}showSimilarKeybindings(e){let t=`"${e.keybindingItem.keybinding.getAriaLabel()}"`;t!==this.searchWidget.getValue()&&this.searchWidget.setValue(t)}createAriaLabelElement(e){this.ariaLabelElement=M(e,_("")),this.ariaLabelElement.setAttribute("id","keybindings-editor-aria-label-element"),this.ariaLabelElement.setAttribute("aria-live","assertive")}createOverlayContainer(e){this.overlayContainer=M(e,PS(".overlay-container")),this.overlayContainer.style.position="absolute",this.overlayContainer.style.zIndex="40",this.defineKeybindingWidget=this._register(this.instantiationService.createInstance(q0,this.overlayContainer)),this._register(this.defineKeybindingWidget.onDidChange(t=>this.defineKeybindingWidget.printExisting(this.keybindingsEditorModel.fetch(`"${t}"`).length))),this._register(this.defineKeybindingWidget.onShowExistingKeybidings(t=>this.searchWidget.setValue(`"${t}"`))),this.hideOverlayContainer()}showOverlayContainer(){this.overlayContainer.style.display="block"}hideOverlayContainer(){this.overlayContainer.style.display="none"}createHeader(e){this.headerContainer=M(e,PS(".keybindings-header"));let t=d(12975,null),o=d(12976,null),n=this._register(new it(pHt,d(12956,null),q.asClassName(WMe),!1,async()=>this.clearSearchResults())),r=M(this.headerContainer,PS(".search-container"));this.searchWidget=this._register(this.instantiationService.createInstance(Vme,r,{ariaLabel:t,placeholder:t,focusKey:this.searchFocusContextKey,ariaLabelledBy:"keybindings-editor-aria-label-element",recordEnter:!0,quoteRecordedKeys:!0,history:new Set(this.getMemento(0,0).searchHistory??[]),inputBoxStyles:H_({inputBorder:AT})})),this._register(this.searchWidget.onDidChange(u=>{let p=!!u;n.enabled=p,this.searchHasValueContextKey.set(p),this.delayedFiltering.trigger(()=>this.filterKeybindings()),this.updateSearchOptions()})),this._register(this.searchWidget.onEscape(()=>this.recordKeysAction.checked=!1)),this.actionsContainer=M(r,_(".keybindings-search-actions-container"));let s=this.createRecordingBadge(this.actionsContainer);this._register(this.sortByPrecedenceAction.onDidChange(u=>{u.checked!==void 0&&this.renderKeybindingsEntries(!1),this.updateSearchOptions()})),this._register(this.recordKeysAction.onDidChange(u=>{u.checked!==void 0&&(s.classList.toggle("disabled",!u.checked),u.checked?(this.searchWidget.inputBox.setPlaceHolder(o),this.searchWidget.inputBox.setAriaLabel(o),this.searchWidget.startRecordingKeys(),this.searchWidget.focus()):(this.searchWidget.inputBox.setPlaceHolder(t),this.searchWidget.inputBox.setAriaLabel(t),this.searchWidget.stopRecordingKeys(),this.searchWidget.focus()),this.updateSearchOptions())}));let l=[this.recordKeysAction,this.sortByPrecedenceAction,n],c=this._register(new wp(this.actionsContainer,this.contextMenuService,{actionViewItemProvider:(u,p)=>{if(u.id===this.sortByPrecedenceAction.id||u.id===this.recordKeysAction.id)return new wce(null,u,{...p,keybinding:this.keybindingsService.lookupKeybinding(u.id)?.getLabel(),toggleStyles:gh})},getKeyBinding:u=>this.keybindingsService.lookupKeybinding(u.id)}));c.setActions(l),this._register(this.keybindingsService.onDidUpdateKeybindings(()=>c.setActions(l)))}updateSearchOptions(){let e=this.input;e&&(e.searchOptions={searchValue:this.searchWidget.getValue(),recordKeybindings:!!this.recordKeysAction.checked,sortByPrecedence:!!this.sortByPrecedenceAction.checked})}createRecordingBadge(e){let t=M(e,_(".recording-badge.monaco-count-badge.long.disabled"));return t.textContent=d(12971,null),t.style.backgroundColor=kt(bv),t.style.color=kt(CC),t.style.border=`1px solid ${kt(bi)}`,t}layoutSearchWidget(e){this.searchWidget.layout(e),this.headerContainer.classList.toggle("small",e.width<400),this.searchWidget.inputBox.inputElement.style.paddingRight=`${zl(this.actionsContainer)+12}px`}createBody(e){let t=M(e,PS(".keybindings-body"));this.createTable(t)}createTable(e){this.keybindingsTableContainer=M(e,PS(".keybindings-table-container")),this.keybindingsTable=this._register(this.instantiationService.createInstance(MC,"KeybindingsEditor",this.keybindingsTableContainer,new mki,[{label:"",tooltip:"",weight:0,minimumWidth:40,maximumWidth:40,templateId:Vee.TEMPLATE_ID,project(t){return t}},{label:d(12957,null),tooltip:"",weight:.3,templateId:Bee.TEMPLATE_ID,project(t){return t}},{label:d(12966,null),tooltip:"",weight:.2,templateId:AHt.TEMPLATE_ID,project(t){return t}},{label:d(12983,null),tooltip:"",weight:.35,templateId:Uee.TEMPLATE_ID,project(t){return t}},{label:d(12981,null),tooltip:"",weight:.15,templateId:Hee.TEMPLATE_ID,project(t){return t}}],[this.instantiationService.createInstance(Vee,this),this.instantiationService.createInstance(Bee),this.instantiationService.createInstance(AHt),this.instantiationService.createInstance(Uee,this),this.instantiationService.createInstance(Hee)],{identityProvider:{getId:t=>t.id},horizontalScrolling:!1,accessibilityProvider:new hki(this.configurationService),keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:t=>t.keybindingItem.commandLabel||t.keybindingItem.command},overrideStyles:{listBackground:Ho},multipleSelectionSupport:!1,setRowLineHeight:!1,openOnSingleClick:!1,transformOptimization:!1})),this._register(this.keybindingsTable.onContextMenu(t=>this.onContextMenu(t))),this._register(this.keybindingsTable.onDidChangeFocus(t=>this.onFocusChange())),this._register(this.keybindingsTable.onDidFocus(()=>{this.keybindingsTable.getHTMLElement().classList.add("focused"),this.onFocusChange()})),this._register(this.keybindingsTable.onDidBlur(()=>{this.keybindingsTable.getHTMLElement().classList.remove("focused"),this.keybindingFocusContextKey.reset()})),this._register(this.keybindingsTable.onDidOpen(t=>{if(t.browserEvent?.defaultPrevented)return;let o=this.activeKeybindingEntry;o&&this.defineKeybinding(o,!1)})),M(this.keybindingsTableContainer,this.overflowWidgetsDomNode)}async render(e){if(this.input){let t=this.input;this.keybindingsEditorModel=await t.resolve(),await this.keybindingsEditorModel.resolve(this.getActionsLabels()),this.renderKeybindingsEntries(!1,e),t.searchOptions?(this.recordKeysAction.checked=t.searchOptions.recordKeybindings,this.sortByPrecedenceAction.checked=t.searchOptions.sortByPrecedence,this.searchWidget.setValue(t.searchOptions.searchValue)):this.updateSearchOptions()}}getActionsLabels(){let e=new Map;for(let t of Ba.getEditorActions())e.set(t.id,t.label);for(let t of ve.getMenuItems(D.CommandPalette))if(gE(t)){let o=typeof t.command.title=="string"?t.command.title:t.command.title.value,n=t.command.category?typeof t.command.category=="string"?t.command.category:t.command.category.value:void 0;e.set(t.command.id,n?`${n}: ${o}`:o)}return e}filterKeybindings(){this.renderKeybindingsEntries(this.searchWidget.hasFocus()),this.searchHistoryDelayer.trigger(()=>{this.searchWidget.inputBox.addToHistory(),this.getMemento(0,0).searchHistory=this.searchWidget.inputBox.getHistory(),this.saveState()})}clearKeyboardShortcutSearchHistory(){this.searchWidget.inputBox.clearHistory(),this.getMemento(0,0).searchHistory=this.searchWidget.inputBox.getHistory(),this.saveState()}renderKeybindingsEntries(e,t){if(this.keybindingsEditorModel){let o=this.searchWidget.getValue(),n=this.keybindingsEditorModel.fetch(o,this.sortByPrecedenceAction.checked);this.accessibilityService.alert(d(12965,null,n.length)),this.ariaLabelElement.setAttribute("aria-label",this.getAriaLabel(n)),n.length===0&&this.latestEmptyFilters.push(o);let r=this.keybindingsTable.getSelection()[0];if(this.tableEntries=n,this.keybindingsTable.splice(0,this.keybindingsTable.length,this.tableEntries),this.layoutKeybindingsTable(),e)this.keybindingsTable.setSelection([]),this.keybindingsTable.setFocus([]);else if(this.unAssignedKeybindingItemToRevealAndFocus){let s=this.getNewIndexOfUnassignedKeybinding(this.unAssignedKeybindingItemToRevealAndFocus);s!==-1&&(this.keybindingsTable.reveal(s,.2),this.selectEntry(s)),this.unAssignedKeybindingItemToRevealAndFocus=null}else r!==-1&&r<this.tableEntries.length?this.selectEntry(r,t):this.editorService.activeEditorPane===this&&!t&&this.focus()}}getAriaLabel(e){return this.sortByPrecedenceAction.checked?d(12978,null,e.length):d(12977,null,e.length)}layoutKeybindingsTable(){if(!this.dimension)return;let e=this.dimension.height-(ir(this.headerContainer).height+12);this.keybindingsTableContainer.style.height=`${e}px`,this.keybindingsTable.layout(e)}getIndexOf(e){let t=this.tableEntries.indexOf(e);if(t===-1){for(let o=0;o<this.tableEntries.length;o++)if(this.tableEntries[o].id===e.id)return o}return t}getNewIndexOfUnassignedKeybinding(e){for(let t=0;t<this.tableEntries.length;t++){let o=this.tableEntries[t];if(o.templateId===F3&&o.keybindingItem.command===e.keybindingItem.command)return t}return-1}selectEntry(e,t=!0){let o=typeof e=="number"?e:this.getIndexOf(e);o!==-1&&o<this.keybindingsTable.length&&(t&&(this.keybindingsTable.domFocus(),this.keybindingsTable.setFocus([o])),this.keybindingsTable.setSelection([o]))}focusKeybindings(){this.keybindingsTable.domFocus();let e=this.keybindingsTable.getFocus();this.keybindingsTable.setFocus([e.length?e[0]:0])}selectKeybinding(e){this.selectEntry(e)}recordSearchKeys(){this.recordKeysAction.checked=!0}toggleSortByPrecedence(){this.sortByPrecedenceAction.checked=!this.sortByPrecedenceAction.checked}onContextMenu(e){if(e.element&&e.element.templateId===F3){let t=e.element;this.selectEntry(t),this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>[this.createCopyAction(t),this.createCopyCommandAction(t),this.createCopyCommandTitleAction(t),new ri,...t.keybindingItem.keybinding?[this.createDefineKeybindingAction(t),this.createAddKeybindingAction(t)]:[this.createDefineKeybindingAction(t)],new ri,this.createRemoveAction(t),this.createResetAction(t),new ri,this.createDefineWhenExpressionAction(t),new ri,this.createShowConflictsAction(t)]})}}onFocusChange(){this.keybindingFocusContextKey.reset();let e=this.keybindingsTable.getFocusedElements()[0];e&&e.templateId===F3&&this.keybindingFocusContextKey.set(!0)}createDefineKeybindingAction(e){return{label:e.keybindingItem.keybinding?d(12955,null):d(12954,null),enabled:!0,id:AMe,run:()=>this.defineKeybinding(e,!1)}}createAddKeybindingAction(e){return{label:d(12954,null),enabled:!0,id:gHt,run:()=>this.defineKeybinding(e,!0)}}createDefineWhenExpressionAction(e){return{label:d(12962,null),enabled:!!e.keybindingItem.keybinding,id:fHt,run:()=>this.defineWhenExpression(e)}}createRemoveAction(e){return{label:d(12973,null),enabled:!!e.keybindingItem.keybinding,id:vHt,run:()=>this.removeKeybinding(e)}}createResetAction(e){return{label:d(12974,null),enabled:!e.keybindingItem.keybindingItem.isDefault,id:bHt,run:()=>this.resetKeybinding(e)}}createShowConflictsAction(e){return{label:d(12979,null),enabled:!!e.keybindingItem.keybinding,id:wHt,run:()=>this.showSimilarKeybindings(e)}}createCopyAction(e){return{label:d(12960,null),enabled:!0,id:SHt,run:()=>this.copyKeybinding(e)}}createCopyCommandAction(e){return{label:d(12958,null),enabled:!0,id:IHt,run:()=>this.copyKeybindingCommand(e)}}createCopyCommandTitleAction(e){return{label:d(12959,null),enabled:!!e.keybindingItem.commandLabel,id:yHt,run:()=>this.copyKeybindingCommandTitle(e)}}onKeybindingEditingError(e){this.notificationService.error(typeof e=="string"?e:d(12963,null,`${e}`))}};Ph=I([m(1,Te),m(2,Le),m(3,_e),m(4,Xe),m(5,nCi),m(6,X),m(7,Ne),m(8,Fi),m(9,F),m(10,ee),m(11,ce),m(12,B),m(13,Oi)],Ph);var mki=class{constructor(){this.headerRowHeight=30}getHeight(i){if(i.templateId===F3){let e=i.keybindingItem.commandLabel&&i.commandIdMatches,t=!!i.commandDefaultLabelMatches,o=!!i.extensionIdMatches;if(e&&t)return 60;if(o||e||t)return 40}return 24}},Vee=class{constructor(i,e){this.keybindingsEditor=i;this.keybindingsService=e;this.templateId=Vee.TEMPLATE_ID}static{this.TEMPLATE_ID="actions"}renderTemplate(i){let e=M(i,PS(".actions"));return{actionBar:new Zi(e)}}renderElement(i,e,t){t.actionBar.clear();let o=[];i.keybindingItem.keybinding?o.push(this.createEditAction(i)):o.push(this.createAddAction(i)),t.actionBar.push(o,{icon:!0})}createEditAction(i){return{class:q.asClassName(rpo),enabled:!0,id:"editKeybinding",tooltip:this.keybindingsService.appendKeybinding(d(12961,null),AMe),run:()=>this.keybindingsEditor.defineKeybinding(i,!1)}}createAddAction(i){return{class:q.asClassName(spo),enabled:!0,id:"addKeybinding",tooltip:this.keybindingsService.appendKeybinding(d(12953,null),AMe),run:()=>this.keybindingsEditor.defineKeybinding(i,!1)}}disposeTemplate(i){i.actionBar.dispose()}};Vee=I([m(1,_e)],Vee);var Bee=class{constructor(i){this._hoverService=i;this.templateId=Bee.TEMPLATE_ID}static{this.TEMPLATE_ID="commands"}renderTemplate(i){let e=M(i,PS(".command")),t=this._hoverService.setupManagedHover(Ri("mouse"),e,""),o=M(e,PS(".command-label")),n=new Ya(o),r=M(e,PS(".command-default-label")),s=new Ya(r),l=M(e,PS(".command-id.code")),c=new Ya(l);return{commandColumn:e,commandColumnHover:t,commandLabelContainer:o,commandLabel:n,commandDefaultLabelContainer:r,commandDefaultLabel:s,commandIdLabelContainer:l,commandIdLabel:c}}renderElement(i,e,t){let o=i.keybindingItem,n=!!(o.commandLabel&&i.commandIdMatches),r=!!i.commandDefaultLabelMatches;t.commandColumn.classList.toggle("vertical-align-column",n||r);let s=o.commandLabel?d(12982,null,o.commandLabel,o.command):o.command;t.commandColumn.setAttribute("aria-label",s),t.commandColumnHover.update(s),o.commandLabel?(t.commandLabelContainer.classList.remove("hide"),t.commandLabel.set(o.commandLabel,i.commandLabelMatches)):(t.commandLabelContainer.classList.add("hide"),t.commandLabel.set(void 0)),i.commandDefaultLabelMatches?(t.commandDefaultLabelContainer.classList.remove("hide"),t.commandDefaultLabel.set(o.commandDefaultLabel,i.commandDefaultLabelMatches)):(t.commandDefaultLabelContainer.classList.add("hide"),t.commandDefaultLabel.set(void 0)),i.commandIdMatches||!o.commandLabel?(t.commandIdLabelContainer.classList.remove("hide"),t.commandIdLabel.set(o.command,i.commandIdMatches)):(t.commandIdLabelContainer.classList.add("hide"),t.commandIdLabel.set(void 0))}disposeTemplate(i){i.commandColumnHover.dispose(),i.commandDefaultLabel.dispose(),i.commandIdLabel.dispose(),i.commandLabel.dispose()}};Bee=I([m(0,nt)],Bee);var AHt=class a{constructor(){this.templateId=a.TEMPLATE_ID}static{this.TEMPLATE_ID="keybindings"}renderTemplate(i){let e=M(i,PS(".keybinding"));return{keybindingLabel:new Am(M(e,PS("div.keybinding-label")),Po,Jx)}}renderElement(i,e,t){i.keybindingItem.keybinding?t.keybindingLabel.set(i.keybindingItem.keybinding,i.keybindingMatches):t.keybindingLabel.set(void 0,void 0)}disposeTemplate(i){i.keybindingLabel.dispose()}};function $Yo(a,i){let e=new N;return e.add(j(a,re.CLICK,AIe(i))),e.add(j(a,re.KEY_UP,t=>{let o=new gi(t);(o.equals(10)||o.equals(3))&&(t.preventDefault(),t.stopPropagation(),i())})),e}var Hee=class{constructor(i,e){this.extensionsWorkbenchService=i;this.hoverService=e;this.templateId=Hee.TEMPLATE_ID}static{this.TEMPLATE_ID="source"}renderTemplate(i){let e=M(i,PS(".source")),t=this.hoverService.setupManagedHover(Ri("mouse"),e,""),o=new Ya(M(e,PS(".source-label"))),n=M(e,PS(".extension-container")),r=M(n,PS("a.extension-label",{tabindex:0})),s=new Ya(M(n,PS(".extension-id-container.code")));return{sourceColumn:e,sourceColumnHover:t,sourceLabel:o,extensionLabel:r,extensionContainer:n,extensionId:s,disposables:new N}}renderElement(i,e,t){if(t.disposables.clear(),Fe(i.keybindingItem.source))t.extensionContainer.classList.add("hide"),t.sourceLabel.element.classList.remove("hide"),t.sourceColumnHover.update(""),t.sourceLabel.set(i.keybindingItem.source||"-",i.sourceMatches);else{t.extensionContainer.classList.remove("hide"),t.sourceLabel.element.classList.add("hide");let o=i.keybindingItem.source,n=o.displayName??o.identifier.value;t.sourceColumnHover.update(d(12964,null,n)),t.extensionLabel.textContent=n,t.disposables.add($Yo(t.extensionLabel,()=>{this.extensionsWorkbenchService.open(o.identifier.value)})),i.extensionIdMatches?(t.extensionId.element.classList.remove("hide"),t.extensionId.set(o.identifier.value,i.extensionIdMatches)):(t.extensionId.element.classList.add("hide"),t.extensionId.set(void 0))}}disposeTemplate(i){i.sourceColumnHover.dispose(),i.disposables.dispose(),i.sourceLabel.dispose(),i.extensionId.dispose()}};Hee=I([m(0,Hi),m(1,nt)],Hee);var Get=class extends x{constructor(e,t,o,n){super();this._onDidAccept=this._register(new E);this.onDidAccept=this._onDidAccept.event;this._onDidReject=this._register(new E);this.onDidReject=this._onDidReject.event;let r=Nme.bindTo(n);this.input=this._register(o.createInstance($A,"keyboardshortcutseditor#wheninput",e,{provideResults:()=>{let s=[];for(let l of Y.all())s.push({label:l.key,documentation:l.description,detail:l.type,kind:14});return s},triggerCharacters:["!"," "],wordDefinition:/[a-zA-Z.]+/,alwaysShowSuggestions:!0},"","keyboardshortcutseditor#wheninput",{focusContextKey:r,overflowWidgetsDomNode:t.overflowWidgetsDomNode})),this._register(j(this.input.element,re.DBLCLICK,s=>Xt.stop(s))),this._register(Z(()=>r.reset())),this._register(t.onAcceptWhenExpression(()=>this._onDidAccept.fire(this.input.getValue()))),this._register(U.any(t.onRejectWhenExpression,this.input.onDidBlur)(()=>this._onDidReject.fire()))}layout(e){this.input.layout(e)}show(e){this.input.setValue(e),this.input.focus(!0)}};Get=I([m(2,F),m(3,X)],Get);var Uee=class{constructor(i,e,t){this.keybindingsEditor=i;this.hoverService=e;this.instantiationService=t;this.templateId=Uee.TEMPLATE_ID}static{this.TEMPLATE_ID="when"}renderTemplate(i){let e=M(i,PS(".when")),t=M(e,PS("div.when-label")),o=new Ya(t),n=M(e,PS("div.when-input-container"));return{element:e,whenLabelContainer:t,whenLabel:o,whenInputContainer:n,disposables:new N}}renderElement(i,e,t){t.disposables.clear();let o=t.disposables.add(new N);t.disposables.add(this.keybindingsEditor.onDefineWhenExpression(n=>{if(i===n){t.element.classList.add("input-mode");let r=o.add(this.instantiationService.createInstance(Get,t.whenInputContainer,this.keybindingsEditor));r.layout(new si(t.element.parentElement.clientWidth,18)),r.show(i.keybindingItem.when||"");let s=()=>{o.clear(),t.element.classList.remove("input-mode"),t.element.parentElement.style.paddingLeft="10px",Rt(t.whenInputContainer)};o.add(r.onDidAccept(l=>{s(),this.keybindingsEditor.updateKeybinding(i,i.keybindingItem.keybinding&&i.keybindingItem.keybinding.getUserSettingsLabel()||"",l),this.keybindingsEditor.selectKeybinding(i)})),o.add(r.onDidReject(()=>{s(),this.keybindingsEditor.selectKeybinding(i)})),t.element.parentElement.style.paddingLeft="0px"}})),t.whenLabelContainer.classList.toggle("code",!!i.keybindingItem.when),t.whenLabelContainer.classList.toggle("empty",!i.keybindingItem.when),i.keybindingItem.when?(t.whenLabel.set(i.keybindingItem.when,i.whenMatches,i.keybindingItem.when),t.disposables.add(this.hoverService.setupManagedHover(Ri("mouse"),t.element,i.keybindingItem.when))):t.whenLabel.set("-")}disposeTemplate(i){i.disposables.dispose(),i.whenLabel.dispose()}};Uee=I([m(1,nt),m(2,F)],Uee);var hki=class{constructor(i){this.configurationService=i}getWidgetAriaLabel(){return d(12967,null)}getAriaLabel({keybindingItem:i}){let e=[i.commandLabel?i.commandLabel:i.command,i.keybinding?.getAriaLabel()||d(12969,null),i.when?i.when:d(12970,null),Fe(i.source)?i.source:i.source.description??i.source.identifier.value];if(this.configurationService.getValue("accessibility.verbosity.keybindingsEditor")){let t=d(12968,null);e.push(t)}return e.join(", ")}};te("keybindingTable.headerBackground",Gje,"Background color for the keyboard shortcuts table header.");te("keybindingTable.rowsBackground",Gje,"Background color for the keyboard shortcuts table alternating rows.");is((a,i)=>{let e=a.getColor(To);if(e){let p=e.transparent(.8).makeOpaque(CF(a));i.addRule(`.keybindings-editor > .keybindings-body > .keybindings-table-container .monaco-table .monaco-table-tr .monaco-table-td .code { color: ${p}; }`)}let t=a.getColor(T_),o=a.getColor(ow);if(t&&o){let p=t.transparent(.8).makeOpaque(o);i.addRule(`.keybindings-editor > .keybindings-body > .keybindings-table-container .monaco-table.focused .monaco-list-row.selected .monaco-table-tr .monaco-table-td .code { color: ${p}; }`)}let n=a.getColor(Hvt),r=a.getColor(Kf);if(n&&r){let p=n.transparent(.8).makeOpaque(r);i.addRule(`.keybindings-editor > .keybindings-body > .keybindings-table-container .monaco-table .monaco-list-row.selected .monaco-table-tr .monaco-table-td .code { color: ${p}; }`)}let s=a.getColor(Fye),l=a.getColor(R7);if(s&&l){let p=s.transparent(.8).makeOpaque(l);i.addRule(`.keybindings-editor > .keybindings-body > .keybindings-table-container .monaco-table.focused .monaco-list-row.focused .monaco-table-tr .monaco-table-td .code { color: ${p}; }`)}let c=a.getColor(Wye),u=a.getColor(yE);if(c&&u){let p=c.transparent(.8).makeOpaque(u);i.addRule(`.keybindings-editor > .keybindings-body > .keybindings-table-container .monaco-table.focused .monaco-list-row:hover:not(.focused):not(.selected) .monaco-table-tr .monaco-table-td .code { color: ${p}; }`)}});var dG=class extends it{constructor(e,t,o,n,r,s){super(e,t);this.modelService=o;this.languageService=n;this.quickInputService=r;this.preferencesService=s}static{this.ID="workbench.action.configureLanguageBasedSettings"}static{this.LABEL=L(13035,"Configure Language Specific Settings...")}async run(){let t=this.languageService.getSortedRegisteredLanguageNames().map(({languageName:o,languageId:n})=>{let r=d(13036,null,n),s,l=this.languageService.getExtensions(n);if(l.length)s=A.file(l[0]);else{let c=this.languageService.getFilenames(n);c.length&&(s=A.file(c[0]))}return{label:o,iconClasses:aa(this.modelService,this.languageService,s),description:r}});await this.quickInputService.pick(t,{placeHolder:d(13037,null)}).then(o=>{if(o){let n=this.languageService.getLanguageIdByLanguageName(o.label);if(typeof n=="string")return this.preferencesService.openLanguageSpecificSettings(n)}})}};dG=I([m(2,Tt),m(3,_t),m(4,Ue),m(5,Go)],dG);$e.registerCommand({id:"_getAllSettings",handler:()=>ne.as(Jt.Configuration).getConfigurationProperties()});$e.registerCommand("_getAllCommands",function(a,i){let e=a.get(_e),t=a.get(X),o=[];for(let n of Ba.getEditorActions()){let r=e.lookupKeybinding(n.id);i&&!t.contextMatchesRules(n.precondition)||o.push({command:n.id,label:n.label,description:Qj(n.metadata?.description)?n.metadata.description.value:n.metadata?.description,precondition:n.precondition?.serialize(),keybinding:r?.getLabel()??"Not set"})}for(let n of ve.getMenuItems(D.CommandPalette))if(gE(n)){if(i&&!t.contextMatchesRules(n.when))continue;let r=typeof n.command.title=="string"?n.command.title:n.command.title.value,s=n.command.category?typeof n.command.category=="string"?n.command.category:n.command.category.value:void 0,l=s?`${s}: ${r}`:r,c=Qj(n.command.metadata?.description)?n.command.metadata.description.value:n.command.metadata?.description,u=e.lookupKeybinding(n.command.id);o.push({command:n.command.id,label:l,description:c,precondition:n.when?.serialize(),keybinding:u?.getLabel()??"Not set"})}return o});var NHt;(i=>i.PreferencesEditorPane="workbench.registry.preferences.editorPanes")(NHt||={});var gki=class extends x{constructor(){super();this.descriptors=new Map;this._onDidRegisterPreferencesEditorPanes=this._register(new E);this.onDidRegisterPreferencesEditorPanes=this._onDidRegisterPreferencesEditorPanes.event;this._onDidDeregisterPreferencesEditorPanes=this._register(new E);this.onDidDeregisterPreferencesEditorPanes=this._onDidDeregisterPreferencesEditorPanes.event}registerPreferencesEditorPane(e){if(this.descriptors.has(e.id))throw new Error(`PreferencesEditorPane with id ${e.id} already registered`);return this.descriptors.set(e.id,e),this._onDidRegisterPreferencesEditorPanes.fire([e]),{dispose:()=>{this.descriptors.delete(e.id)&&this._onDidDeregisterPreferencesEditorPanes.fire([e])}}}getPreferencesEditorPanes(){return[...this.descriptors.values()].sort((e,t)=>e.order-t.order)}};ne.add(NHt.PreferencesEditorPane,new gki);var fki=class extends it{constructor(e,t){super(e.id,e.title,"",!0,t);this.descriptor=e}},r8=class extends Ts{constructor(e,t,o,n,r,s){super(r8.ID,e,t,o,n);this.instantiationService=r;this.editorPanesRegistry=ne.as(NHt.PreferencesEditorPane);this.preferencesTabActions=[];this.preferencesEditorPane=this._register(new me);this.searchFocusContextKey=Vuo.bindTo(s),this.element=_(".preferences-editor");let l=M(this.element,_(".preferences-editor-header")),c=M(l,_(".search-container"));this.searchWidget=this._register(this.instantiationService.createInstance(Fee,c,{focusKey:this.searchFocusContextKey,inputBoxStyles:H_({inputBorder:AT})})),this._register(U.debounce(this.searchWidget.onDidChange,()=>{},300)(()=>{this.preferencesEditorPane.value?.search(this.searchWidget.getValue())}));let u=M(l,_(".preferences-tabs-container"));this.preferencesTabActionBar=this._register(new Zi(u,{orientation:0,focusOnlyEnabledItems:!0,ariaLabel:d(13039,null),ariaRole:"tablist"})),this.onDidChangePreferencesEditorPane(this.editorPanesRegistry.getPreferencesEditorPanes(),[]),this._register(this.editorPanesRegistry.onDidRegisterPreferencesEditorPanes(p=>this.onDidChangePreferencesEditorPane(p,[]))),this._register(this.editorPanesRegistry.onDidDeregisterPreferencesEditorPanes(p=>this.onDidChangePreferencesEditorPane([],p))),this.bodyElement=M(this.element,_(".preferences-editor-body"))}static{this.ID="workbench.editor.preferences"}createEditor(e){M(e,this.element)}layout(e){this.dimension=e,this.searchWidget.layout(e),this.searchWidget.inputBox.inputElement.style.paddingRight="12px",this.preferencesEditorPane.value?.layout(new si(this.bodyElement.clientWidth,e.height-87))}async setInput(e,t,o,n){await super.setInput(e,t,o,n),this.preferencesTabActions.length&&this.onDidSelectPreferencesEditorPane(this.preferencesTabActions[0].id)}onDidChangePreferencesEditorPane(e,t){for(let o of t){let n=this.preferencesTabActions.findIndex(r=>r.id===o.id);n!==-1&&(this.preferencesTabActionBar.pull(n),this.preferencesTabActions[n].dispose(),this.preferencesTabActions.splice(n,1))}if(e.length>0){let o=this.editorPanesRegistry.getPreferencesEditorPanes();for(let n of e){let r=o.findIndex(s=>s.id===n.id);if(r!==-1){let s=new fki(n,()=>this.onDidSelectPreferencesEditorPane(n.id));this.preferencesTabActions.splice(r,0,s),this.preferencesTabActionBar.push(s,{index:r})}}}}onDidSelectPreferencesEditorPane(e){let t;for(let o of this.preferencesTabActions)o.id===e?(o.checked=!0,t=o):o.checked=!1;t&&(this.searchWidget.inputBox.setPlaceHolder(d(13038,null,t.descriptor.title)),this.searchWidget.inputBox.setAriaLabel(d(13038,null,t.descriptor.title))),this.renderBody(t?.descriptor),this.dimension&&this.layout(this.dimension)}renderBody(e){if(this.preferencesEditorPane.value=void 0,Rt(this.bodyElement),e){let t=this.instantiationService.createInstance(e.ctorDescriptor.ctor);this.preferencesEditorPane.value=t,this.bodyElement.appendChild(t.getDomNode())}}dispose(){super.dispose(),this.preferencesTabActions.forEach(e=>e.dispose())}};r8=I([m(1,Te),m(2,Le),m(3,ce),m(4,F),m(5,X)],r8);var qet=class extends ja{constructor(e){super();this.label=e;this._onClick=this._register(new E);this.onClick=this._onClick.event;this._domNode=_(".floating-click-widget"),this._domNode.style.padding="6px 11px",this._domNode.style.borderRadius="2px",this._domNode.style.cursor="pointer",this._domNode.style.zIndex="1"}getDomNode(){return this._domNode}render(){Rt(this._domNode),this._domNode.style.backgroundColor=tle(xC,kt(Ho)),this._domNode.style.color=tle(__,kt(Id)),this._domNode.style.border=`1px solid ${kt(bi)}`,M(this._domNode,_("")).textContent=this.label,this.onclick(this._domNode,()=>this._onClick.fire())}},Bme=class extends x{constructor(e,t,o){super();this.renderEmitter=this._register(new E);this.menu=this._register(t.createMenu(e,o))}get onDidRender(){return this.renderEmitter.event}render(){let e=this._register(new N),t=()=>{if(e.clear(),!this.isVisible())return;let o=jm(this.menu.getActions({renderShortTitle:!0,shouldForwardArgs:!0}));if(o.length===0)return;let[n]=o,r=this.createWidget(n,e);e.add(r),e.add(r.onClick(()=>n.run(this.getActionArg()))),r.render()};this._register(this.menu.onDidChange(t)),t()}getActionArg(){}isVisible(){return!0}};Bme=I([m(1,Kt),m(2,X)],Bme);var GMe=class extends Bme{constructor(e,t,o,n){super(e.menuId,o,n);this.options=e;this.instantiationService=t;this.render()}createWidget(e,t){let o=this.instantiationService.createInstance(qet,e.label),n=o.getDomNode();return this.options.container.appendChild(n),t.add(Z(()=>n.remove())),o}getActionArg(){return this.options.getActionArg()}};GMe=I([m(1,F),m(2,Kt),m(3,X)],GMe);var $0=class extends x{constructor(e){super();this.editorService=e;this._onHighlightRemoved=this._register(new E);this.onHighlightRemoved=this._onHighlightRemoved.event;this.rangeHighlightDecorationId=null;this.editor=null;this.editorDisposables=this._register(new N)}removeHighlightRange(){if(this.editor&&this.rangeHighlightDecorationId){let e=this.rangeHighlightDecorationId;this.editor.changeDecorations(t=>{t.removeDecoration(e)}),this._onHighlightRemoved.fire()}this.rangeHighlightDecorationId=null}highlightRange(e,t){t=t??this.getEditor(e),pn(t)?this.doHighlightRange(t,e):SO(t)&&pn(t.activeCodeEditor)&&this.doHighlightRange(t.activeCodeEditor,e)}doHighlightRange(e,t){this.removeHighlightRange(),e.changeDecorations(o=>{this.rangeHighlightDecorationId=o.addDecoration(t.range,this.createRangeHighlightDecoration(t.isWholeLine))}),this.setEditor(e)}getEditor(e){let t=this.editorService.activeEditor?.resource;if(t&&Qe(t,e.resource)&&pn(this.editorService.activeTextEditorControl))return this.editorService.activeTextEditorControl}setEditor(e){this.editor!==e&&(this.editorDisposables.clear(),this.editor=e,this.editorDisposables.add(this.editor.onDidChangeCursorPosition(t=>{(t.reason===0||t.reason===3||t.reason===5||t.reason===6)&&this.removeHighlightRange()})),this.editorDisposables.add(this.editor.onDidChangeModel(()=>{this.removeHighlightRange()})),this.editorDisposables.add(this.editor.onDidDispose(()=>{this.removeHighlightRange(),this.editor=null})))}static{this._WHOLE_LINE_RANGE_HIGHLIGHT=mo.register({description:"codeeditor-range-highlight-whole",stickiness:1,className:"rangeHighlight",isWholeLine:!0})}static{this._RANGE_HIGHLIGHT=mo.register({description:"codeeditor-range-highlight",stickiness:1,className:"rangeHighlight"})}createRangeHighlightDecoration(e=!0){return e?$0._WHOLE_LINE_RANGE_HIGHLIGHT:$0._RANGE_HIGHLIGHT}dispose(){super.dispose(),this.editor?.getModel()&&(this.removeHighlightRange(),this.editor=null)}};$0=I([m(0,ee)],$0);var Hme=class extends qet{constructor(e,t,o,n){super(n.appendKeybinding(t,o));this.editor=e}getId(){return"editor.overlayWidget.floatingClickWidget"}getPosition(){return{preference:1}}render(){super.render(),this.editor.addOverlayWidget(this)}dispose(){this.editor.removeOverlayWidget(this),super.dispose()}};Hme=I([m(3,_e)],Hme);var zee=class extends Bme{constructor(e,t,o,n){super(D.EditorContent,o,n);this.editor=e;this.instantiationService=t;this.render()}static{this.ID="editor.contrib.floatingClickMenu"}createWidget(e){return this.instantiationService.createInstance(Hme,this.editor,e.label,e.id)}isVisible(){return!(this.editor instanceof id)&&this.editor?.hasModel()&&!this.editor.getOption(70)}getActionArg(){return this.editor.getModel()?.uri}};zee=I([m(1,F),m(2,Kt),m(3,X)],zee);var vki=d(17473,null),bki=d(17478,null),hpo=d(17472,null),gpo=d(17471,null),qMe={definitions:{inputs:{type:"array",description:d(17482,null),items:{oneOf:[{type:"object",required:["id","type","description"],additionalProperties:!1,properties:{id:{type:"string",description:vki},type:{type:"string",description:bki,enum:["promptString"],enumDescriptions:[d(17481,null)]},description:{type:"string",description:hpo},default:{type:"string",description:gpo},password:{type:"boolean",description:d(17475,null)}}},{type:"object",required:["id","type","description","options"],additionalProperties:!1,properties:{id:{type:"string",description:vki},type:{type:"string",description:bki,enum:["pickString"],enumDescriptions:[d(17480,null)]},description:{type:"string",description:hpo},default:{type:"string",description:gpo},options:{type:"array",description:d(17474,null),items:{oneOf:[{type:"string"},{type:"object",required:["value"],additionalProperties:!1,properties:{label:{type:"string",description:d(17476,null)},value:{type:"string",description:d(17477,null)}}}]}}}},{type:"object",required:["id","type","command"],additionalProperties:!1,properties:{id:{type:"string",description:vki},type:{type:"string",description:bki,enum:["command"],enumDescriptions:[d(17479,null)]},command:{type:"string",description:d(17470,null)},args:{oneOf:[{type:"object",description:d(17469,null)},{type:"array",description:d(17469,null)},{type:"string",description:d(17469,null)}]}}}]}}}};var jYo="onMcpCollection:",$et=a=>jYo+a;var $Me=Object.keys({"claude-desktop":!0,windsurf:!0,"cursor-global":!0,"cursor-workspace":!0}),vpo={"claude-desktop":d(12051,null),windsurf:d(12057,null),"cursor-global":d(12053,null),"cursor-workspace":d(12055,null)},bpo={"claude-desktop":d(12052,null),windsurf:d(12058,null),"cursor-global":d(12054,null),"cursor-workspace":d(12056,null)},j0="mcp",Kee="chat.mcp.discovery.enabled",jet="chat.mcp.serverSampling",Spo={"mcp-server-time":{command:"python",args:["-m","mcp_server_time","--local-timezone=America/Los_Angeles"],env:{}}},fpo={"my-mcp-server":{url:"http://localhost:3001/mcp",headers:{}}},Ipo=a=>({dev:{type:"object",markdownDescription:d(12026,null),examples:[{watch:"src/**/*.ts",debug:{type:"node"}}],properties:{watch:{description:d(12031,null),examples:["src/**/*.ts"],oneOf:[{type:"string"},{type:"array",items:{type:"string"}}]},...a&&{debug:{markdownDescription:d(12027,null),oneOf:[{type:"object",required:["type"],properties:{type:{type:"string",enum:["node"],description:d(12029,null)}},additionalProperties:!1},{type:"object",required:["type"],properties:{type:{type:"string",enum:["debugpy"],description:d(12030,null)},debugpyPath:{type:"string",description:d(12028,null)}},additionalProperties:!1}]}}}}}),Qet={type:"object",additionalProperties:!1,examples:[Spo["mcp-server-time"]],properties:{type:{type:"string",enum:["stdio"],description:d(12047,null)},sandboxEnabled:{type:"boolean",default:!1,description:d(12045,null)},command:{type:"string",description:d(12034,null)},cwd:{type:"string",description:d(12035,null),examples:["${workspaceFolder}"]},args:{type:"array",description:d(12025,null),items:{type:"string"}},envFile:{type:"string",description:d(12033,null),examples:["${workspaceFolder}/.env"]},env:{description:d(12032,null),additionalProperties:{anyOf:[{type:"null"},{type:"string"},{type:"number"}]}},...Ipo(!0)}},ypo={id:ILe,type:"object",title:d(12046,null),allowTrailingCommas:!0,allowComments:!0,additionalProperties:!1,properties:{sandbox:{description:d(12037,null),type:"object",additionalProperties:!1,properties:{network:{description:d(12042,null),type:"object",additionalProperties:!1,properties:{allowedDomains:{description:d(12043,null),type:"array",items:{type:"string"},default:[]},deniedDomains:{description:d(12044,null),type:"array",items:{type:"string"},default:[]}}},filesystem:{description:d(12038,null),type:"object",additionalProperties:!1,properties:{denyRead:{description:d(12040,null),type:"array",items:{type:"string"},default:[]},allowWrite:{description:d(12039,null),type:"array",items:{type:"string"},default:[]},denyWrite:{description:d(12041,null),type:"array",items:{type:"string"},default:[]}}}}},servers:{examples:[Spo,fpo],additionalProperties:{oneOf:[Qet,{type:"object",additionalProperties:!1,required:["url"],examples:[fpo["my-mcp-server"]],properties:{type:{type:"string",enum:["http","sse"],description:d(12047,null)},url:{type:"string",format:"uri",pattern:"^https?:\\/\\/.+",patternErrorMessage:d(12049,null),description:d(12048,null)},headers:{type:"object",description:d(12036,null),additionalProperties:{type:"string"}},...Ipo(!1)}}]}},inputs:qMe.definitions.inputs}},wpo={extensionPoint:"mcpServerDefinitionProviders",activationEventsGenerator:function*(a){for(let i of a)i.id&&(yield $et(i.id))},jsonSchema:{description:d(12061,null),type:"array",defaultSnippets:[{body:[{id:"",label:""}]}],items:{additionalProperties:!1,type:"object",defaultSnippets:[{body:{id:"",label:""}}],properties:{id:{description:d(12062,null),type:"string"},label:{description:d(12063,null),type:"string"},when:{description:d(12064,null),type:"string"}}}}},Ski=class extends x{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.mcpServerDefinitionProviders&&Array.isArray(e.contributes.mcpServerDefinitionProviders)&&e.contributes.mcpServerDefinitionProviders.length>0}render(e){let t=e.contributes?.mcpServerDefinitionProviders??[],o=[d(12050,null),d(12060,null)],n=t.map(r=>[new Ie().appendMarkdown(`\`${r.id}\``),r.label]);return{data:{headers:o,rows:n},dispose:()=>{}}}};ne.as(As.ExtensionFeaturesRegistry).registerExtensionFeature({id:j0,label:d(12059,null),access:{canToggle:!1},renderer:new Ft(Ski)});var Ume=class extends x{constructor(e,t,o,n,r){super();this.editor=e;this.preferencesModel=t;this.preferencesService=o;this.configurationService=n;this.instantiationService=r;this.modelChangeDelayer=this._register(new Xo(200));this.settingHighlighter=this._register(r.createInstance(Xet,e)),this.editSettingActionRenderer=this._register(this.instantiationService.createInstance(Yet,this.editor,this.preferencesModel,this.settingHighlighter)),this._register(this.editSettingActionRenderer.onUpdateSetting(({key:s,value:l,source:c})=>this.updatePreference(s,l,c))),this._register(this.editor.getModel().onDidChangeContent(()=>this.modelChangeDelayer.trigger(()=>this.onModelChanged()))),this.unsupportedSettingsRenderer=this._register(r.createInstance(Jet,e,t)),this.mcpSettingsRenderer=this._register(r.createInstance(Zet,e,t))}render(){this.editSettingActionRenderer.render(this.preferencesModel.settingsGroups,this.associatedPreferencesModel),this.unsupportedSettingsRenderer.render(),this.mcpSettingsRenderer.render()}updatePreference(e,t,o){let n=o.overrideOf?R1(o.overrideOf.key):null,r=this.preferencesModel.uri;this.configurationService.updateValue(e,t,{overrideIdentifiers:n,resource:r},this.preferencesModel.configurationTarget).then(()=>this.onSettingUpdated(o))}onModelChanged(){this.editor.hasModel()&&this.render()}onSettingUpdated(e){this.editor.focus(),e=this.getSetting(e),e&&(this.editor.setSelection(e.valueRange),this.settingHighlighter.highlight(e,!0))}getSetting(e){let{key:t,overrideOf:o}=e;if(o){let n=this.getSetting(o);for(let r of n.overrides)if(r.key===t)return r;return}return this.preferencesModel.getPreference(t)}focusPreference(e){let t=this.getSetting(e);t?(this.settingHighlighter.highlight(t,!0),this.editor.setPosition({lineNumber:t.keyRange.startLineNumber,column:t.keyRange.startColumn})):this.settingHighlighter.clear(!0)}clearFocus(e){this.settingHighlighter.clear(!0)}editPreference(e){let t=this.getSetting(e);return!!(t&&this.editSettingActionRenderer.activateOnSetting(t))}};Ume=I([m(2,Go),m(3,B),m(4,F)],Ume);var jMe=class extends Ume{constructor(i,e,t,o,n){super(i,e,t,o,n),this.workspaceConfigurationRenderer=this._register(n.createInstance(Gee,i,e))}render(){super.render(),this.workspaceConfigurationRenderer.render()}};jMe=I([m(2,Go),m(3,B),m(4,F)],jMe);var Yet=class extends x{constructor(e,t,o,n,r,s){super();this.editor=e;this.primarySettingsModel=t;this.settingHighlighter=o;this.configurationService=n;this.instantiationService=r;this.contextMenuService=s;this.settingsGroups=[];this._onUpdateSetting=this._register(new E);this.onUpdateSetting=this._onUpdateSetting.event;this.editPreferenceWidgetForCursorPosition=this._register(this.instantiationService.createInstance(Het,e)),this.editPreferenceWidgetForMouseMove=this._register(this.instantiationService.createInstance(Het,e)),this.toggleEditPreferencesForMouseMoveDelayer=this._register(new Xo(75)),this._register(this.editPreferenceWidgetForCursorPosition.onClick(l=>this.onEditSettingClicked(this.editPreferenceWidgetForCursorPosition,l))),this._register(this.editPreferenceWidgetForMouseMove.onClick(l=>this.onEditSettingClicked(this.editPreferenceWidgetForMouseMove,l))),this._register(this.editor.onDidChangeCursorPosition(l=>this.onPositionChanged(l))),this._register(this.editor.onMouseMove(l=>this.onMouseMoved(l))),this._register(this.editor.onDidChangeConfiguration(()=>this.onConfigurationChanged()))}render(e,t){this.editPreferenceWidgetForCursorPosition.hide(),this.editPreferenceWidgetForMouseMove.hide(),this.settingsGroups=e,this.associatedPreferencesModel=t;let o=this.getSettings(this.editor.getPosition().lineNumber);o.length&&this.showEditPreferencesWidget(this.editPreferenceWidgetForCursorPosition,o)}isDefaultSettings(){return this.primarySettingsModel instanceof FRe}onConfigurationChanged(){this.editor.getOption(66)||(this.editPreferenceWidgetForCursorPosition.hide(),this.editPreferenceWidgetForMouseMove.hide())}onPositionChanged(e){this.editPreferenceWidgetForMouseMove.hide();let t=this.getSettings(e.position.lineNumber);t.length?this.showEditPreferencesWidget(this.editPreferenceWidgetForCursorPosition,t):this.editPreferenceWidgetForCursorPosition.hide()}onMouseMoved(e){let t=this.getEditPreferenceWidgetUnderMouse(e);if(t){this.onMouseOver(t);return}this.settingHighlighter.clear(),this.toggleEditPreferencesForMouseMoveDelayer.trigger(()=>this.toggleEditPreferenceWidgetForMouseMove(e))}getEditPreferenceWidgetUnderMouse(e){if(e.target.type===2){let t=e.target.position.lineNumber;if(this.editPreferenceWidgetForMouseMove.getLine()===t&&this.editPreferenceWidgetForMouseMove.isVisible())return this.editPreferenceWidgetForMouseMove;if(this.editPreferenceWidgetForCursorPosition.getLine()===t&&this.editPreferenceWidgetForCursorPosition.isVisible())return this.editPreferenceWidgetForCursorPosition}}toggleEditPreferenceWidgetForMouseMove(e){let t=e.target.position?this.getSettings(e.target.position.lineNumber):null;t&&t.length?this.showEditPreferencesWidget(this.editPreferenceWidgetForMouseMove,t):this.editPreferenceWidgetForMouseMove.hide()}showEditPreferencesWidget(e,t){let o=t[0].valueRange.startLineNumber;this.editor.getOption(66)&&this.marginFreeFromOtherDecorations(o)&&(e.show(o,d(13056,null),t),(e===this.editPreferenceWidgetForCursorPosition?this.editPreferenceWidgetForMouseMove:this.editPreferenceWidgetForCursorPosition).hide())}marginFreeFromOtherDecorations(e){let t=this.editor.getLineDecorations(e);if(t){for(let{options:o}of t)if(o.glyphMarginClassName&&o.glyphMarginClassName.indexOf(q.asClassName(Wme))===-1)return!1}return!0}getSettings(e){let t=this.getConfigurationsMap();return this.getSettingsAtLineNumber(e).filter(o=>{let n=t[o.key];if(n){if(n.policy&&this.configurationService.inspect(o.key).policyValue!==void 0)return!1;if(this.isDefaultSettings())return o.key!=="launch";if((n.type==="boolean"||n.enum)&&(this.primarySettingsModel.configurationTarget!==6||n.scope===5||n.scope===6))return!0}return!1})}getSettingsAtLineNumber(e){let t=0,o=[];for(let n of this.settingsGroups){if(n.range.startLineNumber>e)break;if(e>=n.range.startLineNumber&&e<=n.range.endLineNumber)for(let r of n.sections)for(let s of r.settings){if(s.range.startLineNumber>e)break;if(e>=s.range.startLineNumber&&e<=s.range.endLineNumber)if(!this.isDefaultSettings()&&s.overrides.length)for(let l of s.overrides)e>=l.range.startLineNumber&&e<=l.range.endLineNumber&&o.push({...l,index:t,groupId:n.id});else o.push({...s,index:t,groupId:n.id});t++}}return o}onMouseOver(e){this.settingHighlighter.highlight(e.preferences[0])}onEditSettingClicked(e,t){Xt.stop(t.event,!0);let o=this.getSettings(e.getLine()).length===1?this.getActions(e.preferences[0],this.getConfigurationsMap()[e.preferences[0].key]):e.preferences.map(n=>new Fs(`preferences.submenu.${n.key}`,n.key,this.getActions(n,this.getConfigurationsMap()[n.key])));this.contextMenuService.showContextMenu({getAnchor:()=>t.event,getActions:()=>o})}activateOnSetting(e){let t=e.keyRange.startLineNumber,o=this.getSettings(t);if(!o.length)return!1;this.editPreferenceWidgetForMouseMove.show(t,"",o);let n=this.getActions(this.editPreferenceWidgetForMouseMove.preferences[0],this.getConfigurationsMap()[this.editPreferenceWidgetForMouseMove.preferences[0].key]);return this.contextMenuService.showContextMenu({getAnchor:()=>this.toAbsoluteCoords(new ye(t,1)),getActions:()=>n}),!0}toAbsoluteCoords(e){let t=this.editor.getScrolledVisiblePosition(e),o=ir(this.editor.getDomNode()),n=o.left+t.left,r=o.top+t.top+t.height;return{x:n,y:r+10}}getConfigurationsMap(){return ne.as(Jt.Configuration).getConfigurationProperties()}getActions(e,t){return t.type==="boolean"?[{id:"truthyValue",label:"true",tooltip:"true",enabled:!0,run:()=>this.updateSetting(e.key,!0,e),class:void 0},{id:"falsyValue",label:"false",tooltip:"false",enabled:!0,run:()=>this.updateSetting(e.key,!1,e),class:void 0}]:t.enum?t.enum.map(o=>({id:o,label:JSON.stringify(o),tooltip:JSON.stringify(o),enabled:!0,run:()=>this.updateSetting(e.key,o,e),class:void 0})):this.getDefaultActions(e)}getDefaultActions(e){if(this.isDefaultSettings()){let t=this.associatedPreferencesModel.getPreference(e.key);return[{id:"setDefaultValue",label:t?d(13062,null):d(13054,null),tooltip:t?d(13062,null):d(13054,null),enabled:!0,run:()=>this.updateSetting(e.key,e.value,e),class:void 0}]}return[]}updateSetting(e,t,o){this._onUpdateSetting.fire({key:e,value:t,source:o})}};Yet=I([m(3,B),m(4,F),m(5,Xe)],Yet);var Xet=class extends x{constructor(e,t){super();this.editor=e;this.fixedHighlighter=this._register(t.createInstance($0)),this.volatileHighlighter=this._register(t.createInstance($0))}highlight(e,t=!1){this.volatileHighlighter.removeHighlightRange(),this.fixedHighlighter.removeHighlightRange(),(t?this.fixedHighlighter:this.volatileHighlighter).highlightRange({range:e.valueRange,resource:this.editor.getModel().uri},this.editor),this.editor.revealLineInCenterIfOutsideViewport(e.valueRange.startLineNumber,0)}clear(e=!1){this.volatileHighlighter.removeHighlightRange(),e&&this.fixedHighlighter.removeHighlightRange()}};Xet=I([m(1,F)],Xet);var Jet=class extends x{constructor(e,t,o,n,r,s,l,c,u,p){super();this.editor=e;this.settingsEditorModel=t;this.markerService=o;this.environmentService=n;this.configurationService=r;this.workspaceTrustManagementService=s;this.uriIdentityService=l;this.userDataProfileService=u;this.userDataProfilesService=p;this.renderingDelayer=this._register(new Xo(200));this.codeActions=new gt(e=>this.uriIdentityService.extUri.getComparisonKey(e));this._register(this.editor.getModel().onDidChangeContent(()=>this.delayedRender())),this._register(U.filter(this.configurationService.onDidChangeConfiguration,h=>h.source===7)(()=>this.delayedRender())),this._register(c.codeActionProvider.register({pattern:t.uri.path},this)),this._register(u.onDidChangeCurrentProfile(()=>this.delayedRender()))}delayedRender(){this.renderingDelayer.trigger(()=>this.render())}render(){this.codeActions.clear();let e=this.generateMarkerData();e.length?this.markerService.changeOne("UnsupportedSettingsRenderer",this.settingsEditorModel.uri,e):this.markerService.remove("UnsupportedSettingsRenderer",[this.settingsEditorModel.uri])}async provideCodeActions(e,t,o,n){let r=[],s=this.codeActions.get(e.uri);if(s)for(let[l,c]of s)l.containsRange(t)&&r.push(...c);return{actions:r,dispose:()=>{}}}generateMarkerData(){let e=[],t=ne.as(Jt.Configuration).getConfigurationProperties();for(let o of this.settingsEditorModel.settingsGroups)for(let n of o.sections)for(let r of n.settings){if(kg.test(r.key)){r.overrides&&this.handleOverrides(r.overrides,t,e);continue}let s=t[r.key];if(s){if(this.handleUnstableSettingConfiguration(r,s,e),this.handlePolicyConfiguration(r,s,e))continue;switch(this.settingsEditorModel.configurationTarget){case 3:this.handleLocalUserConfiguration(r,s,e);break;case 4:this.handleRemoteUserConfiguration(r,s,e);break;case 5:this.handleWorkspaceConfiguration(r,s,e);break;case 6:this.handleWorkspaceFolderConfiguration(r,s,e);break}}else e.push(this.generateUnknownConfigurationMarker(r))}return e}handlePolicyConfiguration(e,t,o){return!t.policy||this.configurationService.inspect(e.key).policyValue===void 0||this.settingsEditorModel.configurationTarget===7?!1:(o.push({severity:1,tags:[1],...e.range,message:d(13066,null)}),!0)}handleOverrides(e,t,o){for(let n of e||[]){let r=t[n.key];r?r.scope!==6&&o.push({severity:1,tags:[1],...n.range,message:d(13070,null)}):o.push(this.generateUnknownConfigurationMarker(n))}}handleLocalUserConfiguration(e,t,o){!this.userDataProfileService.currentProfile.isDefault&&!this.userDataProfileService.currentProfile.useDefaultFlags?.settings&&(Qe(this.userDataProfilesService.defaultProfile.settingsResource,this.settingsEditorModel.uri)&&!this.configurationService.isSettingAppliedForAllProfiles(e.key)?o.push({severity:1,tags:[1],...e.range,message:d(13055,null)}):Qe(this.userDataProfileService.currentProfile.settingsResource,this.settingsEditorModel.uri)&&(t.scope&&Kw.includes(t.scope)?o.push(this.generateUnsupportedApplicationSettingMarker(e)):this.configurationService.isSettingAppliedForAllProfiles(e.key)&&o.push({severity:1,tags:[1],...e.range,message:d(13053,null,Ty)}))),this.environmentService.remoteAuthority&&(t.scope===2||t.scope===3||t.scope===7)&&o.push({severity:1,tags:[1],...e.range,message:d(13068,null)})}handleRemoteUserConfiguration(e,t,o){t.scope===1&&o.push(this.generateUnsupportedApplicationSettingMarker(e))}handleWorkspaceConfiguration(e,t,o){if(t.scope&&Kw.includes(t.scope)&&o.push(this.generateUnsupportedApplicationSettingMarker(e)),t.scope===2&&o.push(this.generateUnsupportedMachineSettingMarker(e)),!this.workspaceTrustManagementService.isWorkspaceTrusted()&&t.restricted){let n=this.generateUntrustedSettingMarker(e);o.push(n);let r=this.generateUntrustedSettingCodeActions([n]);this.addCodeActions(n,r)}}handleWorkspaceFolderConfiguration(e,t,o){if(t.scope&&Kw.includes(t.scope)&&o.push(this.generateUnsupportedApplicationSettingMarker(e)),t.scope===2&&o.push(this.generateUnsupportedMachineSettingMarker(e)),t.scope===4&&o.push({severity:1,tags:[1],...e.range,message:d(13069,null)}),!this.workspaceTrustManagementService.isWorkspaceTrusted()&&t.restricted){let n=this.generateUntrustedSettingMarker(e);o.push(n);let r=this.generateUntrustedSettingCodeActions([n]);this.addCodeActions(n,r)}}handleUnstableSettingConfiguration(e,t,o){t.tags?.includes("preview")?o.push(this.generatePreviewSettingMarker(e)):t.tags?.includes("experimental")&&o.push(this.generateExperimentalSettingMarker(e))}generateUnsupportedApplicationSettingMarker(e){return{severity:1,tags:[1],...e.range,message:d(13064,null)}}generateUnsupportedMachineSettingMarker(e){return{severity:1,tags:[1],...e.range,message:d(13065,null)}}generateUntrustedSettingMarker(e){return{severity:4,...e.range,message:d(13071,null)}}generateUnknownConfigurationMarker(e){return{severity:1,tags:[1],...e.range,message:d(13063,null)}}generateUntrustedSettingCodeActions(e){return[{title:d(13057,null),command:{id:"workbench.trust.manage",title:d(13057,null)},diagnostics:e,kind:xr.QuickFix.value}]}generatePreviewSettingMarker(e){return{severity:1,...e.range,message:_Ht}}generateExperimentalSettingMarker(e){return{severity:1,...e.range,message:DHt}}addCodeActions(e,t){let o=this.codeActions.get(this.settingsEditorModel.uri);o||(o=[],this.codeActions.set(this.settingsEditorModel.uri,o)),o.push([z.lift(e),t])}dispose(){this.markerService.remove("UnsupportedSettingsRenderer",[this.settingsEditorModel.uri]),this.codeActions.clear(),super.dispose()}};Jet=I([m(2,oa),m(3,At),m(4,fg),m(5,Nr),m(6,ht),m(7,Qt),m(8,ln),m(9,an)],Jet);var Zet=class extends x{constructor(e,t,o,n,r){super();this.editor=e;this.settingsEditorModel=t;this.markerService=o;this.uriIdentityService=n;this.renderingDelayer=this._register(new Xo(200));this.codeActions=new gt(e=>this.uriIdentityService.extUri.getComparisonKey(e));this._register(this.editor.getModel().onDidChangeContent(()=>this.delayedRender())),this._register(r.codeActionProvider.register({pattern:t.uri.path},this))}delayedRender(){this.renderingDelayer.trigger(()=>this.render())}render(){this.codeActions.clear();let e=this.generateMarkerData();e.length?this.markerService.changeOne("McpSettingsRenderer",this.settingsEditorModel.uri,e):this.markerService.remove("McpSettingsRenderer",[this.settingsEditorModel.uri])}async provideCodeActions(e,t,o,n){let r=[],s=this.codeActions.get(e.uri);if(s)for(let[l,c]of s)l.containsRange(t)&&r.push(...c);return{actions:r,dispose:()=>{}}}generateMarkerData(){let e=[];if(this.settingsEditorModel.configurationTarget!==3&&this.settingsEditorModel.configurationTarget!==4)return e;for(let t of this.settingsEditorModel.settingsGroups)for(let o of t.sections)for(let n of o.settings)if(n.key===j0){let r=this.generateMcpConfigurationMarker(n);e.push(r);let s=this.generateMcpConfigurationCodeActions([r]);this.addCodeActions(n.range,s)}return e}generateMcpConfigurationMarker(e){let o=this.settingsEditorModel.configurationTarget===4?d(13060,null):d(13061,null);return{severity:4,...e.range,message:o}}generateMcpConfigurationCodeActions(e){let t=this.settingsEditorModel.configurationTarget===4,o=t?d(13058,null):d(13059,null),n=t?"workbench.mcp.openRemoteUserMcpJson":"workbench.mcp.openUserMcpJson";return[{title:o,command:{id:n,title:o},diagnostics:e,kind:xr.QuickFix.value}]}addCodeActions(e,t){let o=this.codeActions.get(this.settingsEditorModel.uri);o||(o=[],this.codeActions.set(this.settingsEditorModel.uri,o)),o.push([z.lift(e),t])}dispose(){this.markerService.remove("McpSettingsRenderer",[this.settingsEditorModel.uri]),this.codeActions.clear(),super.dispose()}};Zet=I([m(2,oa),m(3,ht),m(4,Qt)],Zet);var Gee=class extends x{constructor(e,t,o,n){super();this.editor=e;this.workspaceSettingsEditorModel=t;this.workspaceContextService=o;this.markerService=n;this.renderingDelayer=this._register(new Xo(200));this.decorations=this.editor.createDecorationsCollection(),this._register(this.editor.getModel().onDidChangeContent(()=>this.renderingDelayer.trigger(()=>this.render())))}static{this.supportedKeys=["folders","tasks","launch","extensions","settings","remoteAuthority","transient"]}render(){let e=[];if(this.workspaceContextService.getWorkbenchState()===3&&this.workspaceSettingsEditorModel instanceof sme){let t=[];for(let o of this.workspaceSettingsEditorModel.configurationGroups)for(let n of o.sections)for(let r of n.settings)Gee.supportedKeys.includes(r.key)||e.push({severity:1,tags:[1],...r.range,message:d(13067,null)});this.decorations.set(t.map(o=>this.createDecoration(o)))}e.length?this.markerService.changeOne("WorkspaceConfigurationRenderer",this.workspaceSettingsEditorModel.uri,e):this.markerService.remove("WorkspaceConfigurationRenderer",[this.workspaceSettingsEditorModel.uri])}static{this._DIM_CONFIGURATION_=mo.register({description:"dim-configuration",stickiness:1,inlineClassName:"dim-configuration"})}createDecoration(e){return{range:e,options:Gee._DIM_CONFIGURATION_}}dispose(){this.markerService.remove("WorkspaceConfigurationRenderer",[this.workspaceSettingsEditorModel.uri]),this.decorations.clear(),super.dispose()}};Gee=I([m(2,Pe),m(3,oa)],Gee);var QYo=["editor.fontSize","editor.formatOnSave","files.autoSave","GitHub.copilot-chat.manageExtension","editor.defaultFormatter","editor.fontFamily","editor.wordWrap","chat.agent.maxRequests","files.exclude","workbench.colorTheme","editor.tabSize","editor.mouseWheelZoom","editor.formatOnPaste"];function Cpo(a){let i=new Map;for(let t of a)for(let o of t.sections)for(let n of o.settings)i.set(n.key,n);let e=[];for(let t of QYo){let o=i.get(t);o&&e.push(o)}return{id:"commonlyUsed",label:d(13145,null),settings:e}}var ett={id:"root",label:"root",children:[{id:"editor",label:d(13182,null),settings:["editor.*"],children:[{id:"editor/cursor",label:d(13146,null),settings:["editor.cursor*"]},{id:"editor/find",label:d(13155,null),settings:["editor.find.*"]},{id:"editor/font",label:d(13156,null),settings:["editor.font*"]},{id:"editor/format",label:d(13157,null),settings:["editor.format*"]},{id:"editor/diffEditor",label:d(13148,null),settings:["diffEditor.*"]},{id:"editor/multiDiffEditor",label:d(13162,null),settings:["multiDiffEditor.*"]},{id:"editor/minimap",label:d(13161,null),settings:["editor.minimap.*"]},{id:"editor/suggestions",label:d(13177,null),settings:["editor.*suggest*"]},{id:"editor/files",label:d(13154,null),settings:["files.*"]}]},{id:"workbench",label:d(13186,null),settings:["workbench.*"],children:[{id:"workbench/appearance",label:d(13131,null),settings:["workbench.activityBar.*","workbench.*color*","workbench.fontAliasing","workbench.iconTheme","workbench.sidebar.location","workbench.*.visible","workbench.tips.enabled","workbench.tree.*","workbench.view.*"]},{id:"workbench/breadcrumbs",label:d(13133,null),settings:["breadcrumbs.*"]},{id:"workbench/editor",label:d(13149,null),settings:["workbench.editor.*"]},{id:"workbench/settings",label:d(13175,null),settings:["workbench.settings.*"]},{id:"workbench/zenmode",label:d(13188,null),settings:["zenmode.*"]},{id:"workbench/screencastmode",label:d(13172,null),settings:["screencastMode.*"]},{id:"workbench/browser",label:d(13134,null),settings:["workbench.browser.*"]}]},{id:"window",label:d(13185,null),settings:["window.*"],children:[{id:"window/newWindow",label:d(13164,null),settings:["window.*newwindow*"]}]},{id:"chat",label:d(13135,null),children:[{id:"chat/agent",label:d(13136,null),settings:["chat.agent.*","chat.checkpoints.*","chat.editRequests","chat.requestQueuing.*","chat.undoRequests.*","chat.customAgentInSubagent.*","chat.editing.autoAcceptDelay","chat.editing.confirmEditRequest*","chat.planAgent.defaultModel"]},{id:"chat/appearance",label:d(13137,null),settings:["chat.editor.*","chat.fontFamily","chat.fontSize","chat.math.*","chat.agentsControl.*","chat.alternativeToolAction.*","chat.codeBlock.*","chat.editing.explainChanges.enabled","chat.editMode.hidden","chat.editorAssociations","chat.extensionUnification.*","chat.inlineReferences.*","chat.notifyWindow*","chat.statusWidget.*","chat.tips.*","chat.unifiedAgentsBar.*","accessibility.signals.chatUserActionRequired","accessibility.signals.chatResponseReceived"]},{id:"chat/sessions",label:d(13142,null),settings:["chat.agentSessionProjection.*","chat.sessions.*","chat.viewProgressBadge.*","chat.viewSessions.*","chat.restoreLastPanelSession","chat.exitAfterDelegation","chat.repoInfo.*"]},{id:"chat/tools",label:d(13143,null),settings:["chat.tools.*","chat.extensionTools.*"]},{id:"chat/mcp",label:d(13140,null),settings:["mcp","chat.mcp.*","mcp.*"]},{id:"chat/context",label:d(13138,null),settings:["chat.detectParticipant.*","chat.experimental.detectParticipant.*","chat.implicitContext.*","chat.promptFilesLocations","chat.instructionsFilesLocations","chat.modeFilesLocations","chat.agentFilesLocations","chat.agentSkillsLocations","chat.hookFilesLocations","chat.promptFilesRecommendations","chat.useAgentsMdFile","chat.useNestedAgentsMdFiles","chat.useAgentSkills","chat.experimental.useSkillAdherencePrompt","chat.useHooks","chat.includeApplyingInstructions","chat.includeReferencedInstructions","chat.sendElementsToChat.*","chat.useClaudeMdFile"]},{id:"chat/inlineChat",label:d(13139,null),settings:["inlineChat.*"]},{id:"chat/miscellaneous",label:d(13141,null),settings:["chat.disableAIFeatures","chat.allowAnonymousAccess"]}]},{id:"features",label:d(13152,null),children:[{id:"features/accessibilitySignals",label:d(13130,null),settings:["accessibility.signal*"]},{id:"features/accessibility",label:d(13129,null),settings:["accessibility.*"]},{id:"features/explorer",label:d(13153,null),settings:["explorer.*","outline.*"]},{id:"features/search",label:d(13173,null),settings:["search.*"]},{id:"features/debug",label:d(13147,null),settings:["debug.*","launch"]},{id:"features/testing",label:d(13181,null),settings:["testing.*"]},{id:"features/scm",label:d(13171,null),settings:["scm.*"]},{id:"features/extensions",label:d(13151,null),settings:["extensions.*"]},{id:"features/terminal",label:d(13180,null),settings:["terminal.*"]},{id:"features/task",label:d(13178,null),settings:["task.*"]},{id:"features/problems",label:d(13168,null),settings:["problems.*"]},{id:"features/output",label:d(13167,null),settings:["output.*"]},{id:"features/comments",label:d(13144,null),settings:["comments.*"]},{id:"features/remote",label:d(13170,null),settings:["remote.*"]},{id:"features/timeline",label:d(13183,null),settings:["timeline.*"]},{id:"features/notebook",label:d(13165,null),settings:["notebook.*","interactiveWindow.*"]},{id:"features/mergeEditor",label:d(13160,null),settings:["mergeEditor.*"]},{id:"features/issueReporter",label:d(13158,null),settings:["issueReporter.*"],hide:!Wt}]},{id:"application",label:d(13132,null),children:[{id:"application/http",label:d(13169,null),settings:["http.*"]},{id:"application/keyboard",label:d(13159,null),settings:["keyboard.*"]},{id:"application/update",label:d(13184,null),settings:["update.*"]},{id:"application/telemetry",label:d(13179,null),settings:["telemetry.*"]},{id:"application/settingsSync",label:d(13176,null),settings:["settingsSync.*"]},{id:"application/network",label:d(13163,null),settings:["network.*"]},{id:"application/experimental",label:d(13150,null),settings:["application.experimental.*"]},{id:"application/other",label:d(13166,null),settings:["application.*"],hide:ei}]},{id:"security",label:d(13174,null),settings:["security.*"],children:[{id:"security/workspace",label:d(13187,null),settings:["security.workspace.*"]}]}]};var QMe=class extends Pm{constructor(e,t,o,n,r){super(e,{getActions:()=>this.getActions()},r,{...t,actionRunner:o,classNames:e.class,anchorAlignmentProvider:()=>1,menuAsChild:!0});this.searchWidget=n;this.suggestController=nc.get(this.searchWidget.inputWidget)}render(e){super.render(e)}doSearchWidgetAction(e,t){this.searchWidget.setValue(this.searchWidget.getValue().trimEnd()+" "+e),this.searchWidget.focus(),t&&this.suggestController&&this.suggestController.triggerSuggest()}createAction(e,t,o,n,r){return{id:e,label:t,tooltip:o,class:void 0,enabled:!0,run:()=>{this.doSearchWidgetAction(n,r)}}}createToggleAction(e,t,o,n){let s=this.searchWidget.getValue().split(" ").includes(n);return{id:e,label:t,tooltip:o,class:void 0,enabled:!0,checked:s,run:()=>{if(s){let l=this.searchWidget.getValue().split(" ").filter(c=>c!==n).join(" ");this.searchWidget.setValue(l)}else{let l=this.searchWidget.getValue().trimEnd(),c=l?l+" "+n:n;this.searchWidget.setValue(c)}this.searchWidget.focus()}}}createMutuallyExclusiveToggleAction(e,t,o,n,r){let s=this.searchWidget.getValue().split(" ").includes(n);return{id:e,label:t,tooltip:o,class:void 0,enabled:!0,checked:s,run:()=>{if(s){let l=this.searchWidget.getValue().split(" ").filter(c=>c!==n).join(" ");this.searchWidget.setValue(l)}else{let l=this.searchWidget.getValue().split(" ").filter(c=>!r.includes(c)&&c!==n).join(" ").trimEnd();l=l?l+" "+n:n,this.searchWidget.setValue(l)}this.searchWidget.focus()}}}getActions(){return[this.createToggleAction("modifiedSettingsSearch",d(13201,null),d(13202,null),`@${lG}`),new ri,this.createAction("extSettingsSearch",d(13193,null),d(13194,null),`@${NMe}`,!0),this.createAction("featuresSettingsSearch",d(13195,null),d(13196,null),`@${Vk}`,!0),this.createAction("tagSettingsSearch",d(13211,null),d(13212,null),`@${Yuo}`,!0),this.createAction("langSettingsSearch",d(13199,null),d(13200,null),`@${K0}`,!0),this.createAction("idSettingsSearch",d(13197,null),d(13198,null),`@${Vet}`,!1),new ri,this.createToggleAction("onlineSettingsSearch",d(13203,null),d(13204,null),"@tag:usesOnlineServices"),this.createToggleAction("policySettingsSearch",d(13205,null),d(13206,null),`@${FH}`),new ri,this.createMutuallyExclusiveToggleAction("stableSettingsSearch",d(13209,null),d(13210,null),"@stable",["@tag:preview","@tag:experimental"]),this.createMutuallyExclusiveToggleAction("previewSettingsSearch",d(13207,null),d(13208,null),"@tag:preview",["@stable","@tag:experimental"]),this.createMutuallyExclusiveToggleAction("experimentalSettingsSearch",d(13191,null),d(13192,null),"@tag:experimental",["@stable","@tag:preview"]),new ri,this.createToggleAction("advancedSettingsSearch",d(13189,null),d(13190,null),`@tag:${o8}`)]}};QMe=I([m(4,Xe)],QMe);var WH=_,xpo=new Set,Iki=[],zme=class{constructor(i,e,t,o,n,r){this.configurationService=e;this.hoverService=t;this.userDataSyncEnablementService=o;this.languageService=n;this.commandService=r;this.isolatedIndicators=[];this.keybindingListeners=new N;this.focusedIndex=0;this.defaultHoverOptions={trapFocus:!0,style:1,position:{hoverPosition:2}};this.indicatorsContainerElement=M(i,WH(".setting-indicators-container")),this.indicatorsContainerElement.style.display="inline",this.previewIndicator=this.createPreviewIndicator(),this.advancedIndicator=this.createAdvancedIndicator(),this.isolatedIndicators=[this.previewIndicator,this.advancedIndicator],this.workspaceTrustIndicator=this.createWorkspaceTrustIndicator(),this.scopeOverridesIndicator=this.createScopeOverridesIndicator(),this.syncIgnoredIndicator=this.createSyncIgnoredIndicator(),this.defaultOverrideIndicator=this.createDefaultOverrideIndicator(),this.parenthesizedIndicators=[this.workspaceTrustIndicator,this.scopeOverridesIndicator,this.syncIgnoredIndicator,this.defaultOverrideIndicator]}addHoverDisposables(i,e,t){i.clear();let o=i.add(new Dt(()=>{let n=t(!1);n&&i.add(n)},this.configurationService.getValue("workbench.hover.delay")));i.add(j(e,re.MOUSE_OVER,()=>{o.isScheduled()||o.schedule()})),i.add(j(e,re.MOUSE_LEAVE,()=>{o.cancel()})),i.add(j(e,re.KEY_DOWN,n=>{let r=new gi(n);if(r.equals(10)||r.equals(3)){let s=t(!0);s&&i.add(s),n.preventDefault()}}))}createWorkspaceTrustIndicator(){let i=new N,e=WH("span.setting-indicator.setting-item-workspace-trust"),t=i.add(new hx(e));t.text="$(shield) "+d(13128,null);let o=d(13124,null),n=r=>this.hoverService.showInstantHover({...this.defaultHoverOptions,content:o,target:e,actions:[{label:d(13110,null),commandId:"workbench.trust.manage",run:s=>{this.commandService.executeCommand("workbench.trust.manage")}}]},r);return this.addHoverDisposables(i,e,n),{element:e,label:t,disposables:i}}createScopeOverridesIndicator(){let i=new N,e=WH("span.setting-item-overrides"),t=i.add(new hx(e));return{element:e,label:t,disposables:i}}createSyncIgnoredIndicator(){let i=new N,e=WH("span.setting-indicator.setting-item-ignored"),t=i.add(new hx(e));t.text=d(13108,null);let o=d(13123,null),n=r=>this.hoverService.showInstantHover({...this.defaultHoverOptions,content:o,target:e},r);return this.addHoverDisposables(i,e,n),{element:e,label:t,disposables:i}}createDefaultOverrideIndicator(){let i=new N,e=WH("span.setting-indicator.setting-item-default-overridden"),t=i.add(new hx(e));return t.text=d(13105,null),{element:e,label:t,disposables:i}}createPreviewIndicator(){let i=new N,e=WH("span.setting-indicator.setting-item-preview"),t=i.add(new hx(e));return{element:e,label:t,disposables:i}}createAdvancedIndicator(){let i=new N,e=WH("span.setting-indicator.setting-item-preview"),t=i.add(new hx(e));t.text=d(13094,null);let o=n=>this.hoverService.showInstantHover({...this.defaultHoverOptions,content:Zuo,target:e},n);return this.addHoverDisposables(i,e,o),{element:e,label:t,disposables:i}}render(){this.indicatorsContainerElement.innerText="",this.indicatorsContainerElement.style.display="none";let i=this.isolatedIndicators.filter(t=>t.element.style.display!=="none");if(i.length){this.indicatorsContainerElement.style.display="inline";for(let t=0;t<i.length;t++)M(this.indicatorsContainerElement,i[t].element)}let e=this.parenthesizedIndicators.filter(t=>t.element.style.display!=="none");if(e.length){this.indicatorsContainerElement.style.display="inline",M(this.indicatorsContainerElement,WH("span",void 0,"("));for(let t=0;t<e.length-1;t++)M(this.indicatorsContainerElement,e[t].element),M(this.indicatorsContainerElement,WH("span.comma",void 0," \u2022 "));M(this.indicatorsContainerElement,e[e.length-1].element),M(this.indicatorsContainerElement,WH("span",void 0,")"))}this.resetIndicatorNavigationKeyBindings([...i,...e])}resetIndicatorNavigationKeyBindings(i){if(this.keybindingListeners.clear(),this.indicatorsContainerElement.role=i.length>=1?"toolbar":"button",!i.length)return;let e=i[0].focusElement??i[0].element;e.tabIndex=0,this.keybindingListeners.add(j(this.indicatorsContainerElement,"keydown",t=>{let o=new gi(t),n=!0;if(o.equals(14))this.focusIndicatorAt(i,0);else if(o.equals(13))this.focusIndicatorAt(i,i.length-1);else if(o.equals(17)){let r=(this.focusedIndex+1)%i.length;this.focusIndicatorAt(i,r)}else if(o.equals(15)){let r=this.focusedIndex?this.focusedIndex-1:i.length-1;this.focusIndicatorAt(i,r)}else n=!1;n&&(t.preventDefault(),t.stopPropagation())}))}focusIndicatorAt(i,e){if(e===this.focusedIndex)return;let t=i[e],o=t.focusElement??t.element;o.tabIndex=0,o.focus();let n=i[this.focusedIndex],r=n.focusElement??n.element;r.tabIndex=-1,this.focusedIndex=e}updateWorkspaceTrust(i){this.workspaceTrustIndicator.element.style.display=i.isUntrusted?"inline":"none",this.render()}updateSyncIgnored(i,e){this.syncIgnoredIndicator.element.style.display=this.userDataSyncEnablementService.isEnabled()&&e.includes(i.setting.key)?"inline":"none",this.render(),Iki!==e&&(Iki=e,xpo=new Set(Iki))}updatePreviewIndicator(i){let e=i.tags?.has("preview"),t=i.tags?.has("experimental");this.previewIndicator.element.style.display=e||t?"inline":"none",this.previewIndicator.label.text=e?d(13120,null):d(13107,null);let o=e?_Ht:DHt,n=r=>this.hoverService.showInstantHover({...this.defaultHoverOptions,content:o,target:this.previewIndicator.element},r);this.addHoverDisposables(this.previewIndicator.disposables,this.previewIndicator.element,n),this.render()}updateAdvancedIndicator(i){let e=i.tags?.has("advanced");this.advancedIndicator.element.style.display=e?"inline":"none",this.render()}getInlineScopeDisplayText(i){let[e,t]=i.split(":"),o=e==="user"?d(13125,null):e==="workspace"?d(13126,null):d(13121,null);return t?`${this.languageService.getLanguageName(t)} > ${o}`:o}dispose(){this.keybindingListeners.dispose();for(let i of this.isolatedIndicators)i.disposables.dispose();for(let i of this.parenthesizedIndicators)i.disposables.dispose()}updateScopeOverrides(i,e,t){if(this.scopeOverridesIndicator.disposables.clear(),this.scopeOverridesIndicator.element.innerText="",this.scopeOverridesIndicator.element.style.display="none",this.scopeOverridesIndicator.focusElement=this.scopeOverridesIndicator.element,i.hasPolicyValue){this.scopeOverridesIndicator.element.style.display="inline",this.scopeOverridesIndicator.element.classList.add("setting-indicator"),this.scopeOverridesIndicator.label.text="$(briefcase) "+d(13119,null);let o=d(13116,null),n=r=>this.hoverService.showInstantHover({...this.defaultHoverOptions,content:o,actions:[{label:d(13118,null),commandId:"_settings.action.viewPolicySettings",run:s=>{t.fire(`@${FH}`)}}],target:this.scopeOverridesIndicator.element},r);this.addHoverDisposables(this.scopeOverridesIndicator.disposables,this.scopeOverridesIndicator.element,n)}else if(i.settingsTarget===3&&this.configurationService.isSettingAppliedForAllProfiles(i.setting.key)){this.scopeOverridesIndicator.element.style.display="inline",this.scopeOverridesIndicator.element.classList.add("setting-indicator"),this.scopeOverridesIndicator.label.text=d(13098,null);let o=d(13099,null),n=r=>this.hoverService.showInstantHover({...this.defaultHoverOptions,content:o,target:this.scopeOverridesIndicator.element},r);this.addHoverDisposables(this.scopeOverridesIndicator.disposables,this.scopeOverridesIndicator.element,n)}else if(i.overriddenScopeList.length||i.overriddenDefaultsLanguageList.length)if(i.overriddenScopeList.length===1&&!i.overriddenDefaultsLanguageList.length){this.scopeOverridesIndicator.element.style.display="inline",this.scopeOverridesIndicator.element.classList.remove("setting-indicator");let o=i.isConfigured?d(13096,null):d(13102,null);this.scopeOverridesIndicator.label.text=`${o} `;let n=i.overriddenScopeList[0],r=M(this.scopeOverridesIndicator.element,WH("a.modified-scope",void 0,this.getInlineScopeDisplayText(n)));r.tabIndex=-1,this.scopeOverridesIndicator.focusElement=r;let s=l=>{let[c,u]=n.split(":");e.fire({settingKey:i.setting.key,scope:c,language:u}),l.preventDefault(),l.stopPropagation()};this.scopeOverridesIndicator.disposables.add(j(r,re.CLICK,l=>{s(l)})),this.scopeOverridesIndicator.disposables.add(j(r,re.KEY_DOWN,l=>{let c=new gi(l);(c.equals(10)||c.equals(3))&&s(l)}))}else{this.scopeOverridesIndicator.element.style.display="inline",this.scopeOverridesIndicator.element.classList.add("setting-indicator");let o=i.isConfigured?d(13095,null):d(13101,null);this.scopeOverridesIndicator.label.text=o;let n="";if(i.overriddenScopeList.length){n=i.isConfigured?d(13097,null):d(13113,null);for(let l of i.overriddenScopeList){let c=this.getInlineScopeDisplayText(l);n+=`
- `+Ayt(c,OHt.create(l).toString(),YYo(l,this.languageService))}}if(i.overriddenDefaultsLanguageList.length){n&&(n+=`

`);let s=d(13109,null);n+=s;for(let l of i.overriddenDefaultsLanguageList){let c=this.languageService.getLanguageName(l);n+=`
- `+Ayt(c??l,OHt.create(`default:${l}`).toString())}}let r={value:n,isTrusted:!1,supportHtml:!1};this.scopeOverridesIndicator.disposables.add(this.hoverService.setupDelayedHover(this.scopeOverridesIndicator.element,()=>({...this.defaultHoverOptions,content:r,linkHandler:s=>{let[l,c]=OHt.parse(s).split(":");e.fire({settingKey:i.setting.key,scope:l,language:c})}}),{setupKeyboardEvents:!0}))}this.render()}updateDefaultOverrideIndicator(i){this.defaultOverrideIndicator.element.style.display="none";let e=kpo(i);if(e!==void 0){this.defaultOverrideIndicator.element.style.display="inline",this.defaultOverrideIndicator.disposables.clear(),Array.isArray(e)&&e.length===1&&(e=e[0]);let t;Array.isArray(e)?(e=e.map(n=>`\`${n}\``),t=d(13114,null,e.slice(0,-1).join(", ")+" & "+e.slice(-1))):t=d(13103,null,e);let o=n=>this.hoverService.showInstantHover({content:new Ie().appendMarkdown(t),target:this.defaultOverrideIndicator.element,style:1,position:{hoverPosition:2}},n);this.addHoverDisposables(this.defaultOverrideIndicator.disposables,this.defaultOverrideIndicator.element,o)}this.render()}};zme=I([m(1,fg),m(2,nt),m(3,Fl),m(4,_t),m(5,ge)],zme);function kpo(a){let i,e=a.defaultValueSource;if(e)if(e instanceof Map){i=[];for(let[,t]of e){let o=typeof t!="string"?t.displayName??t.id:t;i.includes(o)||i.push(o)}}else typeof e=="string"?i=e:i=e.displayName??e.id;return i}function YYo(a,i){let[e,t]=a.split(":"),o=e==="user"?d(13125,null):e==="workspace"?d(13126,null):d(13121,null);return t?d(13111,null,o,i.getLanguageName(t)):o}function XYo(a,i){let[e,t]=a.split(":"),o=e==="user"?d(13125,null):e==="workspace"?d(13126,null):d(13121,null);return t?d(13112,null,o.toLowerCase(),i.getLanguageName(t)):o}function Epo(a,i,e,t){let o=[];if(a.tags?.has("preview")?o.push(d(13120,null)):a.tags?.has("experimental")&&o.push(d(13107,null)),a.tags?.has("advanced")&&o.push(d(13094,null)),a.isUntrusted&&o.push(d(13127,null)),a.hasPolicyValue)o.push(d(13117,null));else if(a.settingsTarget===3&&i.isSettingAppliedForAllProfiles(a.setting.key))o.push(d(13100,null));else{let l=a.isConfigured?d(13096,null):d(13102,null),c=a.overriddenScopeList.map(u=>XYo(u,t)).join(", ");a.overriddenScopeList.length&&o.push(`${l} ${c}`)}xpo.has(a.setting.key)&&o.push(d(13122,null));let n=kpo(a);if(n!==void 0){Array.isArray(n)&&n.length===1&&(n=n[0]);let l;Array.isArray(n)?l=d(13115,null,n.slice(0,-1).join(", ")+" & "+n.slice(-1)):l=d(13104,null,n),o.push(l)}let r=a.overriddenDefaultsLanguageList.map(l=>t.getLanguageName(l)).join(", ");if(a.overriddenDefaultsLanguageList.length){let l=d(13106,null,r);o.push(l)}return o.join(". ")}var OHt;(e=>{function a(t){return A.from({scheme:Q.internal,path:"/",query:encodeURIComponent(t)})}e.create=a;function i(t){let o=A.parse(t);return decodeURIComponent(o.query)}e.parse=i})(OHt||={});var ttt=class extends x{constructor(e){super();this._tabbable=!1;this._onDidChangeTabbable=this._register(new E);this.id=e}get onDidChangeTabbable(){return this._onDidChangeTabbable.event}get tabbable(){return this._tabbable}set tabbable(e){this._tabbable=e,this._onDidChangeTabbable.fire()}},sv=class extends ttt{constructor(e,t,o,n,r){super(e);this._childSettingKeys=new Set;this._children=[];this.count=t,this.label=o,this.level=n,this.isFirstGroup=r}get children(){return this._children}set children(e){this._children=e,this._childSettingKeys=new Set,this._children.forEach(t=>{t instanceof $w&&this._childSettingKeys.add(t.setting.key)})}containsSetting(e){return this._childSettingKeys.has(e)}},YMe=class extends ttt{constructor(e,t){super(e);this.extensionIds=t}},$w=class a extends ttt{constructor(e,t,o,n,r,s,l,c,u){super(JYo(t.id+"_"+e.key));this.settingsTarget=o;this.isWorkspaceTrusted=n;this.languageFilter=r;this.languageService=s;this.productService=l;this.userDataProfileService=c;this.configurationService=u;this._displayCategory=null;this._displayLabel=null;this.isConfigured=!1;this.isUntrusted=!1;this.hasPolicyValue=!1;this.overriddenScopeList=[];this.overriddenDefaultsLanguageList=[];this.languageOverrideValues=new Map;this.setting=e,this.parent=t,this.initSettingDescription(),this.initSettingValueType()}static{this.MAX_DESC_LINES=20}get displayCategory(){return this._displayCategory||this.initLabels(),this._displayCategory}get displayLabel(){return this._displayLabel||this.initLabels(),this._displayLabel}initLabels(){if(this.setting.title){this._displayLabel=this.setting.title,this._displayCategory=this.setting.categoryLabel??null;return}let e=s8(this.setting.key,this.parent.id,this.setting.isLanguageTagSetting);this._displayLabel=e.label,this._displayCategory=e.category}initSettingDescription(){if(this.setting.description.length>a.MAX_DESC_LINES){let e=this.setting.description.slice(0,a.MAX_DESC_LINES);e.push("[...]"),this.description=e.join(`
`)}else this.description=this.setting.description.join(`
`)}initSettingValueType(){if(eXo(this.setting,this.productService))this.valueType="extension-toggle";else if(this.setting.enum&&(!this.setting.type||rXo(this.setting.type)))this.valueType="enum";else if(this.setting.type==="string")this.setting.editPresentation==="multilineText"?this.valueType="multiline-string":this.valueType="string";else if(tXo(this.setting))this.valueType="exclude";else if(iXo(this.setting))this.valueType="include";else if(this.setting.type==="integer")this.valueType="integer";else if(this.setting.type==="number")this.valueType="number";else if(this.setting.type==="boolean")this.valueType="boolean";else if(this.setting.type==="array"&&this.setting.arrayItemType&&["string","enum","number","integer"].includes(this.setting.arrayItemType))this.valueType="array";else if(Array.isArray(this.setting.type)&&this.setting.type.includes("null")&&this.setting.type.length===2)this.setting.type.includes("integer")?this.valueType="nullable-integer":this.setting.type.includes("number")?this.valueType="nullable-number":this.valueType="complex";else{let e=nXo(this.setting);e?this.setting.allKeysAreBoolean?this.valueType="boolean-object":e==="simple"?this.valueType="object":this.valueType="complex-object":this.setting.isLanguageTagSetting?this.valueType="language-tag":this.valueType="complex"}}inspectSelf(){let e=this.getTargetToInspect(this.setting),t=yki(this.setting.key,e,this.languageFilter,this.configurationService);this.update(t,this.isWorkspaceTrusted)}getTargetToInspect(e){if(!this.userDataProfileService.currentProfile.isDefault&&!this.userDataProfileService.currentProfile.useDefaultFlags?.settings){if(e.scope===1)return 1;if(this.configurationService.isSettingAppliedForAllProfiles(e.key)&&this.settingsTarget===3)return 1}return this.settingsTarget}update(e,t){let{isConfigured:o,inspected:n,targetSelector:r,inspectedLanguageOverrides:s,languageSelector:l}=e;switch(r){case"workspaceFolderValue":case"workspaceValue":this.isUntrusted=!!this.setting.restricted&&!t;break}let c=o?n[r]:n.defaultValue,u=[],p=[];if((l||r!=="workspaceValue")&&typeof n.workspaceValue<"u"&&u.push("workspace:"),(l||r!=="userRemoteValue")&&typeof n.userRemoteValue<"u"&&u.push("remote:"),(l||r!=="userLocalValue")&&typeof n.userLocalValue<"u"&&u.push("user:"),n.overrideIdentifiers)for(let h of n.overrideIdentifiers){let g=s.get(h);g&&(this.languageService.isRegisteredLanguageId(h)&&(l!==h&&typeof g.default?.override<"u"&&p.push(h),(l!==h||r!=="workspaceValue")&&typeof g.workspace?.override<"u"&&u.push(`workspace:${h}`),(l!==h||r!=="userRemoteValue")&&typeof g.userRemote?.override<"u"&&u.push(`remote:${h}`),(l!==h||r!=="userLocalValue")&&typeof g.userLocal?.override<"u"&&u.push(`user:${h}`)),this.languageOverrideValues.set(h,g))}if(this.overriddenScopeList=u,this.overriddenDefaultsLanguageList=p,this.defaultValueSource=this.setting.nonLanguageSpecificDefaultValueSource,n.policyValue!==void 0)this.hasPolicyValue=!0,o=!1,c=n.policyValue,this.scopeValue=n.policyValue,this.defaultValue=n.defaultValue;else if(l&&this.languageOverrideValues.has(l)){let h=this.languageOverrideValues.get(l);c=(o?h[r]:h.defaultValue)??c,this.scopeValue=o&&h[r],this.defaultValue=h.defaultValue??n.defaultValue;let f=ne.as(Jt.Configuration).getConfigurationDefaultsOverrides().get(`[${l}]`)?.source,v=f instanceof Map?f.get(this.setting.key):void 0;v&&(this.defaultValueSource=v)}else this.scopeValue=o&&n[r],this.defaultValue=n.defaultValue;this.value=c,this.isConfigured=o,(o||this.setting.tags||this.tags||this.setting.restricted||this.hasPolicyValue)&&(this.tags=new Set,o&&this.tags.add(lG),this.setting.tags?.forEach(h=>this.tags.add(h)),this.setting.restricted&&this.tags.add(OMe),this.hasPolicyValue&&this.tags.add(FH))}matchesAllTags(e){if(!e?.size)return!0;if(this.tags||this.inspectSelf(),e.has("stable")){if(this.tags?.has("preview")||this.tags?.has("experimental"))return!1;let t=new Set(Array.from(e).filter(o=>o!=="stable"));return t.size===0?!0:!!this.tags?.size&&Array.from(t).every(o=>this.tags.has(o))}return!!this.tags?.size&&Array.from(e).every(t=>this.tags.has(t))}matchesScope(e,t){let o=A.isUri(e)?6:e;return this.setting.scope?o===1?Kw.includes(this.setting.scope):o===6?UZ.includes(this.setting.scope):o===5?y3.includes(this.setting.scope):o===4?yLe.includes(this.setting.scope)||rhi.includes(this.setting.key):o===3&&t?sFt.includes(this.setting.scope)||rhi.includes(this.setting.key):!0:!0}matchesAnyExtension(e){return!e||!e.size?!0:this.setting.extensionInfo?Array.from(e).some(t=>t.toLowerCase()===this.setting.extensionInfo.id.toLowerCase()):!1}matchesAnyFeature(e){if(!e||!e.size)return!0;if(this.setting.extensionInfo)return!1;if(e.has("chat")){let o=ett.children.find(n=>n.id==="chat");if(o?.children&&o.children.flatMap(r=>r.settings??[]).map(r=>Tpo(r)).some(r=>r.test(this.setting.key)))return!0}let t=ett.children.find(o=>o.id==="features");return Array.from(e).some(o=>{if(t?.children){let n=t.children.find(r=>"features/"+o===r.id);return n?.settings?n.settings.map(s=>Tpo(s)).some(s=>s.test(this.setting.key)):!1}else return!1})}matchesAnyId(e){if(!e||!e.size||e.has(this.setting.key))return!0;for(let t of e)if(t.endsWith("*")){let o=t.slice(0,-1);if(this.setting.key.startsWith(o))return!0}return!1}matchesAllLanguages(e){return e?this.languageService.isRegisteredLanguageId(e)?this.setting.scope===6:!1:!0}};function Tpo(a){return a=ns(a).replace(/\\\*/g,".*"),new RegExp(`^${a}$`,"i")}var Kme=class{constructor(i,e,t,o,n,r){this._viewState=i;this._isWorkspaceTrusted=e;this._configurationService=t;this._languageService=o;this._userDataProfileService=n;this._productService=r;this._treeElementsBySettingName=new Map}get root(){return this._root}update(i=this._tocRoot){this._treeElementsBySettingName.clear();let e=this.createSettingsTreeGroupElement(i);e.children[0]instanceof sv&&(e.children[0].isFirstGroup=!0),this._root?(this.disposeChildren(this._root.children),this._root.children=e.children,e.dispose()):this._root=e}updateWorkspaceTrust(i){this._isWorkspaceTrusted=i,this.updateRequireTrustedTargetElements()}disposeChildren(i){for(let e of i)this.disposeChildAndRecurse(e)}disposeChildAndRecurse(i){i instanceof sv&&this.disposeChildren(i.children),i.dispose()}getElementsByName(i){return this._treeElementsBySettingName.get(i)??null}updateElementsByName(i){this._treeElementsBySettingName.has(i)&&this.reinspectSettings(this._treeElementsBySettingName.get(i))}updateRequireTrustedTargetElements(){this.reinspectSettings([...this._treeElementsBySettingName.values()].flat().filter(i=>i.isUntrusted))}reinspectSettings(i){for(let e of i)e.inspectSelf()}createSettingsTreeGroupElement(i,e){let t=e?this.getDepth(e)+1:0,o=new sv(i.id,void 0,i.label,t,!1);o.parent=e;let n=[];if(i.settings){let r=i.settings.map(s=>this.createSettingsTreeSettingElement(s,o));for(let s of r)s.setting.deprecationMessage?(s.inspectSelf(),s.isConfigured?n.push(s):s.dispose()):n.push(s)}if(i.children){let r=i.children.map(s=>this.createSettingsTreeGroupElement(s,o));n.push(...r)}return o.children=n,o}getDepth(i){return i.parent?1+this.getDepth(i.parent):0}createSettingsTreeSettingElement(i,e){let t=new $w(i,e,this._viewState.settingsTarget,this._isWorkspaceTrusted,this._viewState.languageFilter,this._languageService,this._productService,this._userDataProfileService,this._configurationService),o=this._treeElementsBySettingName.get(i.key)??[];return o.push(t),this._treeElementsBySettingName.set(i.key,o),t}dispose(){this._treeElementsBySettingName.clear(),this.disposeChildAndRecurse(this._root)}};Kme=I([m(2,fg),m(3,_t),m(4,ln),m(5,tt)],Kme);function yki(a,i,e,t){let o=A.isUri(i)?{resource:i}:void 0,n=t.inspect(a,o),r=i===1?"applicationValue":i===3?"userLocalValue":i===4?"userRemoteValue":i===5?"workspaceValue":"workspaceFolderValue",s=i===1?"application":i===3?"userLocal":i===4?"userRemote":i===5?"workspace":"workspaceFolder",l=typeof n[r]<"u",c=n.overrideIdentifiers,u=new Map;if(e&&(l=!1),c){for(let p of c)u.set(p,t.inspect(a,{overrideIdentifier:p}));e&&u.has(e)&&typeof u.get(e)[s]?.override<"u"&&(l=!0)}return{isConfigured:l,inspected:n,targetSelector:r,inspectedLanguageOverrides:u,languageSelector:e}}function JYo(a){return a.replace(/[\.\/]/g,"_")}function s8(a,i="",e=!1){let t=a.lastIndexOf("."),o="";t>=0&&(o=a.substring(0,t),a=a.substring(t+1)),i=i.replace(/\//g,"."),o=ZYo(o,i),o=dki(o),e&&(a=ZIe(a),a="$(bracket) "+a);let n=dki(a);return{category:o,label:n}}function ZYo(a,i){let e=o=>{/insiders$/i.test(a)||(i=i.replace(/-?insiders$/i,""));let n=i.split(".").map(r=>r.replace(/-/g,"").toLowerCase()===a.toLowerCase()?r.replace(/-/g,""):r);for(;n.length;){let r=new RegExp(`^${n.join("\\.")}(\\.|$)`,"i");if(r.test(a))return a.replace(r,"");o?n.pop():n.shift()}return null},t=e(!0);return t===null&&(t=e(!1)),t===null&&(t=a),t}function eXo(a,i){return lki&&!!i.extensionRecommendations&&!!a.displayExtensionId}function tXo(a){return a.key==="files.exclude"||a.key==="search.exclude"||a.key==="workbench.localHistory.exclude"||a.key==="explorer.autoRevealExclude"||a.key==="files.readonlyExclude"||a.key==="files.watcherExclude"}function iXo(a){return a.key==="files.readonlyInclude"}function WHt(a){return a==="workbench.editor.customLabels.patterns"}function FHt(a){return a==="string"||a==="boolean"||a==="integer"||a==="number"}function oXo(a,i){let{type:e}=a;if(Array.isArray(e)){if(WHt(i)&&e.length===2&&e.includes("null")&&(e.includes("string")||e.includes("boolean")||e.includes("integer")||e.includes("number")))return"simple";for(let t of e)if(!FHt(t))return!1;return"complex"}if(FHt(e))return"simple";if(e==="array"){if(a.items){let t=Array.isArray(a.items)?a.items:[a.items];for(let{type:o}of t){if(Array.isArray(o)){for(let n of o)if(!FHt(n))return!1;return"complex"}return FHt(o)?"complex":!1}}return!1}return!1}function nXo({key:a,type:i,objectProperties:e,objectPatternProperties:t,objectAdditionalProperties:o}){if(i!=="object"||nr(e)&&nr(t)&&nr(o)||(o===!0||o===void 0)&&!Object.keys(t??{}).includes(".*"))return!1;let n=[...Object.values(e??{}),...Object.values(t??{})];o&&typeof o=="object"&&n.push(o);let r="simple";for(let s of n)for(let l of Array.isArray(s.anyOf)?s.anyOf:[s]){let c=oXo(l,a);if(c===!1)return!1;c==="complex"&&(r="complex")}return r}function rXo(a){let i=["string","boolean","null","integer","number"];return(Array.isArray(a)?a:[a]).every(t=>i.includes(t))}var Gme=class extends Kme{constructor(e,t,o,n,r,s,l,c){super(e,o,n,s,l,c);this.environmentService=r;this.rawSearchResults=null;this.newExtensionSearchResults=null;this.searchResultCount=null;this.aiFilterEnabled=!1;this.id="searchResultModel";this.settingsOrderByTocIndex=t,this.cachedUniqueSearchResults=new Map,this.update({id:"searchResultModel",label:""})}set showAiResults(e){this.aiFilterEnabled=e,this.updateChildren()}sortResults(e){if(this.settingsOrderByTocIndex)for(let t of e)t.setting.internalOrder=this.settingsOrderByTocIndex.get(t.setting.key);return this._viewState.query?(e.sort((t,o)=>t.matchType!==o.matchType?o.matchType-t.matchType:t.matchType&16||t.matchType&32?o.keyMatchScore-t.keyMatchScore||Ome(t.setting.internalOrder,o.setting.internalOrder):t.matchType===2?o.score-t.score:Ome(t.setting.internalOrder,o.setting.internalOrder)),zo(e,t=>t.setting.key)):e.sort((t,o)=>Ome(t.setting.internalOrder,o.setting.internalOrder))}getUniqueSearchResults(){let e=this.cachedUniqueSearchResults.get(this.aiFilterEnabled);if(e)return e;if(!this.rawSearchResults)return null;let t=[];if(this.aiFilterEnabled){let l=new Set,c=this.rawSearchResults[4];c&&(c.filterMatches.forEach(h=>l.add(h.setting.key)),t=c.filterMatches);let u=this.rawSearchResults[3];u&&(u.filterMatches=u.filterMatches.filter(h=>!l.has(h.setting.key)),t=t.concat(u.filterMatches));let p={filterMatches:t,exactMatch:!1};return this.cachedUniqueSearchResults.set(!0,p),p}let o=new Set,n=this.rawSearchResults[0];n&&(n.filterMatches.forEach(l=>o.add(l.setting.key)),t=n.filterMatches);let r=this.rawSearchResults[1];r&&(r.filterMatches=r.filterMatches.filter(l=>!o.has(l.setting.key)),t=t.concat(r.filterMatches),this.newExtensionSearchResults=this.rawSearchResults[2]),t=this.sortResults(t);let s={filterMatches:t,exactMatch:n.exactMatch};return this.cachedUniqueSearchResults.set(!1,s),s}getRawResults(){return this.rawSearchResults??[]}getUniqueSearchResultSettings(){return this.getUniqueSearchResults()?.filterMatches.map(e=>e.setting)??[]}updateChildren(){this.update({id:"searchResultModel",label:"searchResultModel",settings:this.getUniqueSearchResultSettings()});let e=!!this.environmentService.remoteAuthority,t=[];for(let o of this.root.children)o instanceof $w&&o.matchesAllTags(this._viewState.tagFilters)&&o.matchesScope(this._viewState.settingsTarget,e)&&o.matchesAnyExtension(this._viewState.extensionFilters)&&o.matchesAnyId(this._viewState.idFilters)&&o.matchesAnyFeature(this._viewState.featureFilters)&&o.matchesAllLanguages(this._viewState.languageFilter)?t.push(o):o.dispose();if(this.root.children=t,this.searchResultCount=this.root.children.length,this.newExtensionSearchResults?.filterMatches.length){let o=this.newExtensionSearchResults.filterMatches.map(n=>n.setting).filter(n=>n.extensionName&&n.extensionPublisher).map(n=>`${n.extensionPublisher}.${n.extensionName}`);if(o=zo(o),o.length){let n=new YMe("newExtensions",o);n.parent=this._root,this._root.children.push(n)}}}setResult(e,t){if(this.cachedUniqueSearchResults.clear(),this.newExtensionSearchResults=null,this.rawSearchResults&&e===0&&delete this.rawSearchResults[1],this.rawSearchResults??=[],!t){delete this.rawSearchResults[e];return}this.rawSearchResults[e]=t,this.updateChildren()}getUniqueResultsCount(){return this.searchResultCount??0}};Gme=I([m(3,fg),m(4,At),m(5,_t),m(6,ln),m(7,tt)],Gme);var sXo=/(^|\s)@tag:("([^"]*)"|[^"]\S*)/g,aXo=/(^|\s)@ext:("([^"]*)"|[^"]\S*)?/g,lXo=/(^|\s)@feature:("([^"]*)"|[^"]\S*)?/g,cXo=/(^|\s)@id:("([^"]*)"|[^"]\S*)?/g,dXo=/(^|\s)@lang:("([^"]*)"|[^"]\S*)?/g;function VHt(a){function i(s,l,c){return s.replace(l,(u,p,h,g)=>{let f=g||h;return f&&c.push(...f.split(",").map(v=>v.trim()).filter(v=>!uc(v))),""})}let e=[];a=a.replace(sXo,(s,l,c,u)=>(e.push(u||c),"")),a=a.replace(`@${lG}`,()=>(e.push(lG),"")),a=a.replace(`@${FH}`,()=>(e.push(FH),"")),a=a.replace(/@stable/g,()=>(e.push("stable"),""));let t=[],o=[],n=[],r=[];return a=i(a,aXo,t),a=i(a,lXo,o),a=i(a,cXo,n),CHt&&(a=i(a,dXo,r)),a=a.trim(),{tags:e,extensionFilters:t,featureFilters:o,idFilters:n,languageFilter:r.length?r[0]:void 0,query:a}}var Bb=_,wki=class{constructor(i){this._dataItems=[];this._editKey=null;this._selectedIdx=null;this._newDataItem=i}get items(){let i=this._dataItems.map((e,t)=>{let o=typeof this._editKey=="number"&&this._editKey===t;return{...e,editing:o,selected:t===this._selectedIdx||o}});return this._editKey==="create"&&i.push({editing:!0,selected:!0,...this._newDataItem}),i}setEditKey(i){this._editKey=i}setValue(i){this._dataItems=i}select(i){this._selectedIdx=i}getSelected(){return this._selectedIdx}selectNext(){typeof this._selectedIdx=="number"?this._selectedIdx=Math.min(this._selectedIdx+1,this._dataItems.length-1):this._selectedIdx=0}selectPrevious(){typeof this._selectedIdx=="number"?this._selectedIdx=Math.max(this._selectedIdx-1,0):this._selectedIdx=0}},qme=class extends x{constructor(e,t,o,n){super();this.container=e;this.themeService=t;this.contextViewService=o;this.configurationService=n;this.rowElements=[];this._onDidChangeList=this._register(new E);this.model=new wki(this.getEmptyItem());this.listDisposables=this._register(new N);this.onDidChangeList=this._onDidChangeList.event;this.listElement=M(e,Bb("div")),this.listElement.setAttribute("role","list"),this.getContainerClasses().forEach(r=>this.listElement.classList.add(r)),M(e,this.renderAddButton()),this.renderList(),this._register(j(this.listElement,re.POINTER_DOWN,r=>this.onListClick(r))),this._register(j(this.listElement,re.DBLCLICK,r=>this.onListDoubleClick(r))),this._register(Jo(this.listElement,"keydown",r=>{if(r.equals(16))this.selectPreviousRow();else if(r.equals(18))this.selectNextRow();else return;r.preventDefault(),r.stopPropagation()}))}get domNode(){return this.listElement}get items(){return this.model.items}get isReadOnly(){return!1}setValue(e){this.model.setValue(e),this.renderList()}renderHeader(){}isAddButtonVisible(){return!0}renderList(){let e=Gr(this.listElement);Rt(this.listElement),this.listDisposables.clear();let t=this.model.items.some(n=>!!(n.editing&&this.isItemNew(n)));this.container.classList.toggle("setting-list-hide-add-button",!this.isAddButtonVisible()||t),this.model.items.length?this.listElement.tabIndex=0:this.listElement.removeAttribute("tabIndex");let o=this.renderHeader();o&&this.listElement.appendChild(o),this.rowElements=this.model.items.map((n,r)=>this.renderDataOrEditItem(n,r,e)),this.rowElements.forEach(n=>this.listElement.appendChild(n))}createBasicSelectBox(e){let t=e.options.map(({value:s,description:l})=>({text:s,description:l})),o=e.options.findIndex(s=>e.data===s.value),n=pwt({selectBackground:LHt,selectForeground:RHt,selectBorder:MHt,selectListBorder:PHt});return new ME(t,o,this.contextViewService,n,{useCustomDrawn:!oI(this.configurationService)||!(dc&&yg.pointerEvents)})}editSetting(e){this.model.setEditKey(e),this.renderList()}cancelEdit(){this.model.setEditKey("none"),this.renderList()}handleItemChange(e,t,o){this.model.setEditKey("none"),this.isItemNew(e)?this._onDidChangeList.fire({type:"add",newItem:t,targetIndex:o}):this._onDidChangeList.fire({type:"change",originalItem:e,newItem:t,targetIndex:o}),this.renderList()}renderDataOrEditItem(e,t,o){let n=e.editing?this.renderEdit(e,t):this.renderDataItem(e,t,o);return n.setAttribute("role","listitem"),n}renderDataItem(e,t,o){let n=this.renderItem(e,t),r=n.rowElement;r.setAttribute("data-index",t+""),r.setAttribute("tabindex",e.selected?"0":"-1"),r.classList.toggle("selected",e.selected);let s=new Zi(r);return this.listDisposables.add(s),s.push(this.getActionsForItem(e,t),{icon:!0,label:!0}),this.addTooltipsToRow(n,e),e.selected&&o&&tn(()=>r.focus(),void 0,this.listDisposables),this.listDisposables.add(j(r,"click",l=>{l.stopPropagation()})),r}renderAddButton(){let e=Bb(".setting-list-new-row"),t=this._register(new Wi(e,Qo));return t.label=this.getLocalizedStrings().addButtonLabel,t.element.classList.add("setting-list-addButton"),this._register(t.onDidClick(()=>{this.model.setEditKey("create"),this.renderList()})),e}onListClick(e){let t=this.getClickedItemIndex(e);t<0||(e.preventDefault(),e.stopImmediatePropagation(),this.model.getSelected()!==t&&this.selectRow(t))}onListDoubleClick(e){let t=this.getClickedItemIndex(e);if(t<0||this.isReadOnly)return;this.model.items[t]&&(this.editSetting(t),e.preventDefault(),e.stopPropagation())}getClickedItemIndex(e){if(!e.target||Cg(e.target,"monaco-action-bar"))return-1;let o=Cg(e.target,"setting-list-row");if(!o)return-1;let n=o.getAttribute("data-index");return n?parseInt(n):-1}selectRow(e){this.model.select(e),this.rowElements.forEach(o=>o.classList.remove("selected"));let t=this.rowElements[this.model.getSelected()];t.classList.add("selected"),t.focus()}selectNextRow(){this.model.selectNext(),this.selectRow(this.model.getSelected())}selectPreviousRow(){this.model.selectPrevious(),this.selectRow(this.model.getSelected())}};qme=I([m(1,Le),m(2,Wn),m(3,B)],qme);var qee=class extends qme{constructor(e,t,o,n,r){super(e,t,o,r);this.hoverService=n;this.showAddButton=!0;this.isEditable=!0}setValue(e,t){this.keyValueSuggester=t?.keySuggester,this.isEditable=t?.isReadOnly===void 0?!0:!t.isReadOnly,this.showAddButton=this.isEditable?t?.showAddButton??!0:!1,super.setValue(e)}getEmptyItem(){return{value:{type:"string",data:""}}}isAddButtonVisible(){return this.showAddButton}getContainerClasses(){return["setting-list-widget"]}getActionsForItem(e,t){return this.isReadOnly?[]:[{class:q.asClassName(Wme),enabled:!0,id:"workbench.action.editListItem",tooltip:this.getLocalizedStrings().editActionTooltip,run:()=>this.editSetting(t)},{class:q.asClassName(uki),enabled:!0,id:"workbench.action.removeListItem",tooltip:this.getLocalizedStrings().deleteActionTooltip,run:()=>this._onDidChangeList.fire({type:"remove",originalItem:e,targetIndex:t})}]}renderItem(e,t){let o=Bb(".setting-list-row"),n=M(o,Bb(".setting-list-value")),r=M(o,Bb(".setting-list-sibling"));return n.textContent=e.value.data.toString(),e.sibling?r.textContent=`when: ${e.sibling}`:(r.textContent=null,n.classList.add("no-sibling")),this.addDragAndDrop(o,e,t),{rowElement:o,keyElement:n,valueElement:r}}addDragAndDrop(e,t,o){this.model.items.every(r=>!r.editing)?(e.draggable=!0,e.classList.add("draggable")):(e.draggable=!1,e.classList.remove("draggable")),this.listDisposables.add(j(e,re.DRAG_START,r=>{this.dragDetails={element:e,item:t,itemIndex:o},MP(r,e,t.value.data)})),this.listDisposables.add(j(e,re.DRAG_OVER,r=>this.dragDetails?(r.preventDefault(),r.dataTransfer&&(r.dataTransfer.dropEffect="move"),!0):!1));let n=0;this.listDisposables.add(j(e,re.DRAG_ENTER,r=>{n++,e.classList.add("drag-hover")})),this.listDisposables.add(j(e,re.DRAG_LEAVE,r=>{n--,n||e.classList.remove("drag-hover")})),this.listDisposables.add(j(e,re.DROP,r=>this.dragDetails?(r.preventDefault(),n=0,this.dragDetails.element!==e&&this._onDidChangeList.fire({type:"move",originalItem:this.dragDetails.item,sourceIndex:this.dragDetails.itemIndex,newItem:t,targetIndex:o}),!0):!1)),this.listDisposables.add(j(e,re.DRAG_END,r=>{n=0,e.classList.remove("drag-hover"),r.dataTransfer?.clearData(),this.dragDetails&&(this.dragDetails=void 0)}))}renderEdit(e,t){let o=Bb(".setting-list-edit-row"),n,r,s;if(this.keyValueSuggester){let f=this.keyValueSuggester(this.model.items.map(({value:{data:v}})=>v),t);e={...e,value:{type:"enum",data:e.value.data,options:f?f.options:[]}}}switch(e.value.type){case"string":n=this.renderInputBox(e.value,o);break;case"enum":n=this.renderDropdown(e.value,o),s=e.value.options,e.value.options.length&&(r=this.isItemNew(e)?s[0].value:e.value.data);break}let l=()=>({value:{type:"string",data:n.value},sibling:p?.value}),c=f=>({value:{type:"enum",data:f,options:s??[]}}),u=f=>{f.equals(3)?this.handleItemChange(e,l(),t):f.equals(9)&&(this.cancelEdit(),f.preventDefault(),f.stopPropagation()),o?.focus()};if(e.value.type!=="string"){let f=n;this.listDisposables.add(f.onDidSelect(({selected:v})=>{r=v}))}else{let f=n;this.listDisposables.add(Jo(f.inputElement,re.KEY_DOWN,u))}let p;nr(e.sibling)?n instanceof Vc&&n.element.classList.add("no-sibling"):(p=new Vc(o,this.contextViewService,{placeholder:this.getLocalizedStrings().siblingInputPlaceholder,inputBoxStyles:H_({inputBackground:zMe,inputForeground:KMe,inputBorder:AT})}),p.element.classList.add("setting-list-siblingInput"),this.listDisposables.add(p),p.value=e.sibling,this.listDisposables.add(Jo(p.inputElement,re.KEY_DOWN,u)));let h=this.listDisposables.add(new Wi(o,Qo));h.label=d(13256,null),h.element.classList.add("setting-list-ok-button"),this.listDisposables.add(h.onDidClick(()=>{e.value.type==="string"?this.handleItemChange(e,l(),t):this.handleItemChange(e,c(r),t)}));let g=this.listDisposables.add(new Wi(o,{secondary:!0,...Qo}));return g.label=d(13233,null),g.element.classList.add("setting-list-cancel-button"),this.listDisposables.add(g.onDidClick(()=>this.cancelEdit())),this.listDisposables.add(tn(()=>{n.focus(),n instanceof Vc&&n.select()})),o}isItemNew(e){return e.value.data===""}addTooltipsToRow(e,{value:t,sibling:o}){let n=nr(o)?d(13249,null,t.data):d(13247,null,t.data,o),{rowElement:r}=e;this.listDisposables.add(this.hoverService.setupDelayedHover(r,{content:n})),r.setAttribute("aria-label",n)}getLocalizedStrings(){return{deleteActionTooltip:d(13259,null),editActionTooltip:d(13236,null),addButtonLabel:d(13231,null),inputPlaceholder:d(13246,null),siblingInputPlaceholder:d(13248,null)}}renderInputBox(e,t){let o=new Vc(t,this.contextViewService,{placeholder:this.getLocalizedStrings().inputPlaceholder,inputBoxStyles:H_({inputBackground:zMe,inputForeground:KMe,inputBorder:AT})});return o.element.classList.add("setting-list-valueInput"),this.listDisposables.add(o),o.value=e.data.toString(),o}renderDropdown(e,t){if(e.type!=="enum")throw new Error("Valuetype must be enum.");let o=this.createBasicSelectBox(e),n=Bb(".setting-list-object-list-row");return o.render(n),t.appendChild(n),o}};qee=I([m(1,Le),m(2,Wn),m(3,nt),m(4,B)],qee);var BHt=class extends qee{getContainerClasses(){return["setting-list-include-exclude-widget"]}addDragAndDrop(i,e,t){}addTooltipsToRow(i,e){let t=nr(e.sibling)?d(13238,null,e.value.data):d(13240,null,e.value.data,e.sibling);e.source&&(t+=d(13237,null,e.source));let o=new Ie().appendMarkdown(t),{rowElement:n}=i;this.listDisposables.add(this.hoverService.setupDelayedHover(n,{content:o})),n.setAttribute("aria-label",t)}getLocalizedStrings(){return{deleteActionTooltip:d(13257,null),editActionTooltip:d(13234,null),addButtonLabel:d(13232,null),inputPlaceholder:d(13239,null),siblingInputPlaceholder:d(13241,null)}}},HHt=class extends qee{getContainerClasses(){return["setting-list-include-exclude-widget"]}addDragAndDrop(i,e,t){}addTooltipsToRow(i,e){let t=nr(e.sibling)?d(13242,null,e.value.data):d(13244,null,e.value.data,e.sibling);e.source&&(t+=d(13237,null,e.source));let o=new Ie().appendMarkdown(t),{rowElement:n}=i;this.listDisposables.add(this.hoverService.setupDelayedHover(n,{content:o})),n.setAttribute("aria-label",t)}getLocalizedStrings(){return{deleteActionTooltip:d(13258,null),editActionTooltip:d(13235,null),addButtonLabel:d(13232,null),inputPlaceholder:d(13243,null),siblingInputPlaceholder:d(13245,null)}}},$me=class extends qme{constructor(e,t,o,n,r){super(e,t,o,r);this.hoverService=n;this.editable=!0;this.currentSettingKey="";this.showAddButton=!0;this.keySuggester=()=>{};this.valueSuggester=()=>{}}setValue(e,t){this.editable=!t?.isReadOnly,this.showAddButton=t?.showAddButton??this.showAddButton,this.keySuggester=t?.keySuggester??this.keySuggester,this.valueSuggester=t?.valueSuggester??this.valueSuggester,this.propertyNames=t?.propertyNames,lo(t)&&t.settingKey!==this.currentSettingKey&&(this.model.setEditKey("none"),this.model.select(null),this.currentSettingKey=t.settingKey),super.setValue(e)}isItemNew(e){return e.key.data===""&&e.value.data===""}isAddButtonVisible(){return this.showAddButton}get isReadOnly(){return!this.editable}getEmptyItem(){return{key:{type:"string",data:""},value:{type:"string",data:""},removable:!0,resetable:!1}}getContainerClasses(){return["setting-list-object-widget"]}getActionsForItem(e,t){if(this.isReadOnly)return[];let o=[{class:q.asClassName(Wme),enabled:!0,id:"workbench.action.editListItem",label:"",tooltip:this.getLocalizedStrings().editActionTooltip,run:()=>this.editSetting(t)}];return e.resetable&&o.push({class:q.asClassName(apo),enabled:!0,id:"workbench.action.resetListItem",label:"",tooltip:this.getLocalizedStrings().resetActionTooltip,run:()=>this._onDidChangeList.fire({type:"reset",originalItem:e,targetIndex:t})}),e.removable&&o.push({class:q.asClassName(uki),enabled:!0,id:"workbench.action.removeListItem",label:"",tooltip:this.getLocalizedStrings().deleteActionTooltip,run:()=>this._onDidChangeList.fire({type:"remove",originalItem:e,targetIndex:t})}),o}renderHeader(){let e=Bb(".setting-list-row-header"),t=M(e,Bb(".setting-list-object-key")),o=M(e,Bb(".setting-list-object-value")),{keyHeaderText:n,valueHeaderText:r}=this.getLocalizedStrings();return t.textContent=n,o.textContent=r,e}renderItem(e,t){let o=Bb(".setting-list-row");o.classList.add("setting-list-object-row"),this.propertyNames&&e.key.data&&!gdo(this.propertyNames,e.key.data)&&o.classList.add("invalid-key");let n=M(o,Bb(".setting-list-object-key")),r=M(o,Bb(".setting-list-object-value"));return n.textContent=e.key.data,r.textContent=e.value.data.toString(),{rowElement:o,keyElement:n,valueElement:r}}renderEdit(e,t){let o=Bb(".setting-list-edit-row.setting-list-object-row"),n={...e},r=v=>{n.key=v,g.enabled=v.data!=="";let b=this.valueSuggester(v.data)??e.value;this.shouldUseSuggestion(e.value,n.value,b)&&(s(b),h())},s=v=>{n.value=v},l,c;if(this.showAddButton){if(this.isItemNew(e)){let S=this.keySuggester(this.model.items.map(({key:{data:y}})=>y));if(lo(S)){n.key=S;let y=this.valueSuggester(n.key.data);s(y??n.value)}}let{widget:v,element:b}=this.renderEditWidget(n.key,{idx:t,isKey:!0,originalItem:e,changedItem:n,update:r});l=v,c=b}else c=Bb(".setting-list-object-key"),c.textContent=e.key.data;let u,p=Bb(".setting-list-object-value-container"),h=()=>{let{widget:v,element:b}=this.renderEditWidget(n.value,{idx:t,isKey:!1,originalItem:e,changedItem:n,update:s});u=v,Rt(p),p.append(b)};h(),o.append(c,p);let g=this.listDisposables.add(new Wi(o,Qo));g.enabled=n.key.data!=="",g.label=d(13256,null),g.element.classList.add("setting-list-ok-button"),this.listDisposables.add(g.onDidClick(()=>this.handleItemChange(e,n,t)));let f=this.listDisposables.add(new Wi(o,{secondary:!0,...Qo}));return f.label=d(13233,null),f.element.classList.add("setting-list-cancel-button"),this.listDisposables.add(f.onDidClick(()=>this.cancelEdit())),this.listDisposables.add(tn(()=>{let v=l??u;v.focus(),v instanceof Vc&&v.select()})),o}renderEditWidget(e,t){switch(e.type){case"string":return this.renderStringEditWidget(e,t);case"enum":return this.renderEnumEditWidget(e,t);case"boolean":return this.renderEnumEditWidget({type:"enum",data:e.data.toString(),options:[{value:"true"},{value:"false"}]},t)}}renderStringEditWidget(e,{idx:t,isKey:o,originalItem:n,changedItem:r,update:s}){let l=Bb(o?".setting-list-object-input-key":".setting-list-object-input-value"),c=new Vc(l,this.contextViewService,{placeholder:o?d(13251,null):d(13255,null),inputBoxStyles:H_({inputBackground:zMe,inputForeground:KMe,inputBorder:AT})});c.element.classList.add("setting-list-object-input"),this.listDisposables.add(c),c.value=e.data,this.listDisposables.add(c.onDidChange(p=>s({...e,data:p})));let u=p=>{p.equals(3)?this.handleItemChange(n,r,t):p.equals(9)&&(this.cancelEdit(),p.preventDefault(),p.stopPropagation())};return this.listDisposables.add(Jo(c.inputElement,re.KEY_DOWN,u)),{widget:c,element:l}}renderEnumEditWidget(e,{isKey:t,changedItem:o,update:n}){let r=this.createBasicSelectBox(e),s=t?o.key:o.value;this.listDisposables.add(r.onDidSelect(({selected:u})=>n(s.type==="boolean"?{...s,data:u==="true"}:{...s,data:u})));let l=Bb(".setting-list-object-input");return l.classList.add(t?"setting-list-object-input-key":"setting-list-object-input-value"),r.render(l),e.options.findIndex(u=>e.data===u.value)===-1&&e.options.length?n(s.type==="boolean"?{...s,data:!0}:{...s,data:e.options[0].value}):s.type==="boolean"&&n({...s,data:e.data==="true"}),{widget:r,element:l}}shouldUseSuggestion(e,t,o){if(o.type!=="enum"&&o.type===t.type&&o.data===t.data)return!1;if(e.data==="")return!0;if(t.type===o.type&&o.type!=="enum")return!1;if(t.type==="enum"&&o.type==="enum"){let n=new Set(t.options.map(({value:r})=>r));if(o.options.forEach(({value:r})=>n.delete(r)),n.size===0)return!1}return!0}addTooltipsToRow(e,t){let{keyElement:o,valueElement:n,rowElement:r}=e,s;t.source?s=d(13253,null,t.key.data,t.value.data,t.source):s=d(13252,null,t.key.data,t.value.data);let l=new Ie().appendMarkdown(s),c=this.getEnumDescription(t.key)??t.keyDescription??l;this.listDisposables.add(this.hoverService.setupDelayedHover(o,{content:c}));let u=this.getEnumDescription(t.value)??l;this.listDisposables.add(this.hoverService.setupDelayedHover(n,{content:u})),r.setAttribute("aria-label",s)}getEnumDescription(e){return e.type==="enum"?e.options.find(({value:o})=>e.data===o)?.description:void 0}getLocalizedStrings(){return{deleteActionTooltip:d(13259,null),resetActionTooltip:d(13260,null),editActionTooltip:d(13236,null),addButtonLabel:d(13231,null),keyHeaderText:d(13250,null),valueHeaderText:d(13254,null)}}};$me=I([m(1,Le),m(2,Wn),m(3,nt),m(4,B)],$me);var jme=class extends qme{constructor(e,t,o,n,r){super(e,t,o,r);this.hoverService=n;this.currentSettingKey=""}setValue(e,t){lo(t)&&t.settingKey!==this.currentSettingKey&&(this.model.setEditKey("none"),this.model.select(null),this.currentSettingKey=t.settingKey),super.setValue(e)}isItemNew(e){return!e.key.data&&!e.value.data}getEmptyItem(){return{key:{type:"string",data:""},value:{type:"boolean",data:!1},removable:!1,resetable:!0}}getContainerClasses(){return["setting-list-object-widget"]}getActionsForItem(e,t){return[]}isAddButtonVisible(){return!1}renderHeader(){}renderDataOrEditItem(e,t,o){let n=this.renderEdit(e,t);return n.setAttribute("role","listitem"),n}renderItem(e,t){let o=Bb(".blank-row"),n=Bb(".blank-row-key");return{rowElement:o,keyElement:n}}renderEdit(e,t){let o=Bb(".setting-list-edit-row.setting-list-object-row.setting-item-bool"),n={...e},r=h=>{n.value.data=h,this.handleItemChange(e,n,t)},s=e.keyDescription?`${e.keyDescription} (${e.key.data})`:e.key.data,{element:l,widget:c}=this.renderEditWidget(n.value.data,s,r);o.appendChild(l);let u=M(o,Bb(".setting-list-object-value"));u.textContent=s;let p={rowElement:o,keyElement:u,valueElement:c.domNode};return this.addTooltipsToRow(p,e),this._register(j(u,re.MOUSE_DOWN,h=>{h.target.tagName.toLowerCase()!=="a"&&(c.checked=!c.checked,r(c.checked)),Xt.stop(h)})),o}renderEditWidget(e,t,o){let n=new cm({icon:R.check,actionClassName:"setting-value-checkbox",isChecked:e,title:t,...WY});this.listDisposables.add(n);let r=Bb(".setting-list-object-input");return r.classList.add("setting-list-object-input-key-checkbox"),n.domNode.classList.add("setting-value-checkbox"),r.appendChild(n.domNode),this._register(j(r,re.MOUSE_DOWN,s=>{n.checked=!n.checked,o(n.checked),s.stopImmediatePropagation()})),{widget:n,element:r}}addTooltipsToRow(e,t){let o=d(13252,null,t.key.data,t.value.data),n=t.keyDescription??o,{rowElement:r,keyElement:s,valueElement:l}=e;this.listDisposables.add(this.hoverService.setupDelayedHover(s,{content:n})),l.setAttribute("aria-label",o),r.setAttribute("aria-label",o)}getLocalizedStrings(){return{deleteActionTooltip:d(13259,null),resetActionTooltip:d(13260,null),editActionTooltip:d(13236,null),addButtonLabel:d(13231,null),keyHeaderText:d(13250,null),valueHeaderText:d(13254,null)}}};jme=I([m(1,Le),m(2,Wn),m(3,nt),m(4,B)],jme);var Xp=_,uXo=new Set(["accessibility.signals.chatUserActionRequired","accessibility.signals.chatResponseReceived"]);function pXo(a){let i=typeof a.defaultValue=="object"?a.defaultValue??{}:{},e=a.isConfigured?{...i,...a.scopeValue}:i;return Object.keys(e).filter(t=>!!e[t]).map(t=>{let o=i[t],n;if(o===e[t]&&a.setting.type==="object"&&a.defaultValueSource instanceof Map){let l=a.defaultValueSource.get(`${a.setting.key}.${t}`);n=typeof l=="string"?l:l?.displayName}let r=e[t],s=typeof r=="boolean"?void 0:r.when;return{value:{type:"string",data:t},sibling:s,elementType:a.valueType,source:n}})}function mXo(a,i){let e=new Set(a);return i.forEach(({key:t})=>e.delete(t.data)),e.size===0}function ott(a){if(a.anyOf)return a.anyOf.map(ott).flat();let i=a.enumDescriptions??[];return(a.enum??[]).map((e,t)=>{let o=t<i.length?i[t]:void 0;return{value:e,description:o}})}function ntt(a){return a.anyOf?a.anyOf.map(ntt).some(e=>e==="enum")?"enum":"string":a.type==="boolean"?"boolean":a.type==="string"&&lo(a.enum)&&a.enum.length>0?"enum":"string"}function Cki(a,i,e){return a==="boolean"?{type:a,data:!!i}:a==="enum"?{type:a,data:""+i,options:e}:{type:a,data:""+i}}function Mpo(a){let i=typeof a.defaultValue=="object"?a.defaultValue??{}:{},e=typeof a.scopeValue=="object"?a.scopeValue??{}:{},t=a.isConfigured?{...i,...e}:a.hasPolicyValue?a.scopeValue:i,{objectProperties:o,objectPatternProperties:n,objectAdditionalProperties:r}=a.setting,s=Object.entries(n??{}).map(([c,u])=>({pattern:new RegExp(c),schema:u})),l=Object.entries(o??{}).map(([c,u])=>({value:c,description:u.description}));return Object.keys(t).map(c=>{let u=i[c],p;if(u===t[c]&&a.setting.type==="object"&&a.defaultValueSource instanceof Map){let b=a.defaultValueSource.get(`${a.setting.key}.${c}`);p=typeof b=="string"?b:b?.displayName}if(lo(o)&&c in o){let b=ott(o[c]);return{key:{type:"enum",data:c,options:l},value:Cki(ntt(o[c]),t[c],b),keyDescription:o[c].description,removable:nr(u),resetable:!nr(u),source:p}}let h=u===void 0||WHt(a.setting.key),g=!!u&&u!==t[c],f=s.find(({pattern:b})=>b.test(c))?.schema;if(f){let b=ott(f);return{key:{type:"string",data:c},value:Cki(ntt(f),t[c],b),keyDescription:f.description,removable:h,resetable:g,source:p}}let v=ott(typeof r=="boolean"?{}:r??{});return{key:{type:"string",data:c},value:Cki(typeof r=="object"?ntt(r):"string",t[c],v),keyDescription:typeof r=="object"?r.description:void 0,removable:h,resetable:g,source:p}}).filter(c=>!nr(c.value.data))}function hXo(a){let i=typeof a.defaultValue=="object"?a.defaultValue??{}:{},e=typeof a.scopeValue=="object"?a.scopeValue??{}:{},t=a.isConfigured?{...i,...e}:i,{objectProperties:o}=a.setting,n=[];for(let r in o){let s=i[r],l;if(s===t[r]&&a.setting.type==="object"&&a.defaultValueSource instanceof Map){let c=a.defaultValueSource.get(r);l=typeof c=="string"?c:c?.displayName}n.push({key:{type:"string",data:r},value:{type:"boolean",data:!!t[r]},keyDescription:o[r].description,removable:!1,resetable:!0,source:l})}return n}function gXo(a){return(i,e)=>{let t=[];return a.setting.enum&&a.setting.enum.forEach((o,n)=>{if(!a.setting.uniqueItems||e!==void 0&&o===i[e]||!i.includes(o)){let r=a.setting.enumDescriptions?.[n];t.push({value:o,description:r})}}),t.length>0?{type:"enum",data:t[0].value,options:t}:void 0}}function fXo(a){let{objectProperties:i}=a.setting,e=Object.keys(i??{});return t=>{let o=new Set(t),n=[];return e.forEach(r=>{o.has(r)||n.push({value:r,description:i[r].description})}),n.length>0?{type:"enum",data:n[0].value,options:n}:void 0}}function vXo(a){let{objectProperties:i,objectPatternProperties:e,objectAdditionalProperties:t}=a.setting,o=Object.entries(e??{}).map(([n,r])=>({pattern:new RegExp(n),schema:r}));return n=>{let r;lo(i)&&n in i&&(r=i[n]);let s=r??o.find(({pattern:l})=>l.test(n))?.schema;if(lo(s)?r=s:lo(t)&&typeof t=="object"&&(r=t),lo(r)){let l=ntt(r);if(l==="boolean")return{type:l,data:r.default??!0};if(l==="enum"){let c=ott(r);return{type:l,data:r.default??c[0].value,options:c}}else return{type:l,data:r.default??""}}}}function UHt(a){return a==="number"||a==="integer"}function bXo(a,i){let e={};for(let t in i){let o,n=a.setting.objectPatternProperties,r=a.setting.objectProperties,s=a.setting.objectAdditionalProperties;if(r){for(let l in r)if(l===t){o=UHt(r[l].type);break}}if(o===void 0&&n){for(let l in n)if(t.match(l)){o=UHt(n[l].type);break}}o===void 0&&s&&typeof s!="boolean"&&UHt(s.type)&&(o=!0),e[t]=o?Number(i[t]):i[t]}return e}function SXo(a){if(!a.value||!Array.isArray(a.value))return[];if(a.setting.arrayItemType==="enum"){let i=[];return a.setting.enum&&(i=a.setting.enum.map((e,t)=>({value:e,description:a.setting.enumDescriptions?.[t]}))),a.value.map(e=>({value:{type:"enum",data:e,options:i}}))}else return a.value.map(i=>({value:{type:"string",data:i}}))}function IXo(a,i){return a.setting.enum&&a.setting.uniqueItems?a.setting.enum.length-i.length>0:!0}function Ppo(a,i,e,t){let o=Vpo(i);return{tree:Opo(a,o,e,t),leftoverSettings:o}}function Apo(a,i,e,t){return[...Vpo(a)].filter(n=>n.restricted&&yki(n.key,i,e,t).isConfigured)}async function Npo(a,i,e){let t=new Map,o=(s,l,c)=>{if(!t.has(s)){let u={id:s,label:l,children:[]};t.set(s,u)}t.get(s).children.push(c)},n=async s=>{let l=s.sections.map(v=>v.settings).flat(),c=e?Wpo(new Set(l),e):l;Fpo(c);let u=s.extensionInfo.id,p=await a.getExtension(u),h=p?.displayName??p?.name??u,f={id:s.id&&s.id!==u?s.id:s.title,label:s.title,order:s.order,settings:c};o(u,h,f)},r=i.map(s=>n(s));return Promise.all(r).then(()=>{let s=[];for(let l of t.values())if(l.children.length===1)s.push({id:l.id,label:l.children[0].label,settings:l.children[0].settings});else{l.children.sort((u,p)=>Ome(u.order,p.order));let c=l.children.find(u=>u.label===l.label);if(c&&!c.children){let u=l.children.filter(p=>p!==c);s.push({id:l.id,label:l.label,settings:c.settings,children:u})}else s.push(l)}return s.sort((l,c)=>l.label.localeCompare(c.label)),{id:"extensions",label:d(13220,null),children:s}})}function Opo(a,i,e,t){let o;a.children&&(o=a.children.filter(r=>r.hide!==!0).map(r=>Opo(r,i,e,t)).filter(r=>r.children?.length||r.settings?.length));let n;if((e||a.settings)&&(n=Wpo(i,{include:{keyPatterns:[...e?.include?.keyPatterns??[],...a.settings??[]],tags:e?.include?.tags?[...e.include.tags]:[]},exclude:e?.exclude??{}}),Fpo(n)),!o&&!n)throw new Error(`TOC node has no child groups or settings: ${a.id}`);return{id:a.id,label:a.label,children:o,settings:n}}function Fpo(a){let o=n=>n.tags?.includes("experimental")?2:n.tags?.includes("preview")?1:0;a.sort((n,r)=>{let s=o(n),l=o(r);if(s!==l)return s-l;let c=Ome(n.order,r.order);return c!==0?c:n.key.localeCompare(r.key)})}function Wpo(a,i){let e=[];return a.forEach(t=>{let o=!1,n=!1;i.include?.keyPatterns?o=i.include.keyPatterns.some(r=>{if(r.startsWith("@tag:")){let s=r.substring(5);return t.tags?.includes(s)}else return Lpo(t,r)}):o=!0,o&&i.include?.tags?.length&&(o=i.include.tags.some(r=>t.tags?.includes(r))),i.exclude?.keyPatterns&&(n=i.exclude.keyPatterns.some(r=>{if(r.startsWith("@tag:")){let s=r.substring(5);return t.tags?.includes(s)}else return Lpo(t,r)})),!n&&i.exclude?.tags?.length&&(n=i.exclude.tags.some(r=>t.tags?.includes(r))),o&&!n&&(e.push(t),uXo.has(t.key)||a.delete(t))}),e}var Dpo=new Map;function yXo(a){return a=ns(a).replace(/\\\*/g,".*"),new RegExp(`^${a}$`,"i")}function Lpo(a,i){let e=Dpo.get(i);return e||(e=yXo(i),Dpo.set(i,e)),e.test(a.key)}function Vpo(a){let i=new Set;for(let e of a)for(let t of e.sections)for(let o of t.settings)(!o.overrides||!o.overrides.length)&&i.add(o);return i}var Bpo="settings.text.template",Hpo="settings.multilineText.template",Upo="settings.number.template",zpo="settings.enum.template",Kpo="settings.bool.template",Gpo="settings.array.template",qpo="settings.exclude.template",$po="settings.include.template",jpo="settings.object.template",Qpo="settings.boolObject.template",zHt="settings.complex.template",Ypo="settings.complexObject.template",Xpo="settings.newExtensions.template",Jpo="settings.group.template",Zpo="settings.extensionToggle.template";function wXo(a){a.querySelectorAll(`
		[tabindex="0"],
		input:not([tabindex="-1"]),
		select:not([tabindex="-1"]),
		textarea:not([tabindex="-1"]),
		a:not([tabindex="-1"]),
		button:not([tabindex="-1"]),
		area:not([tabindex="-1"])
	`).forEach(e=>{e.setAttribute(Md.ELEMENT_FOCUSABLE_ATTR,"true"),e.setAttribute("tabindex","-1")})}function CXo(a){a.querySelectorAll(`[${Md.ELEMENT_FOCUSABLE_ATTR}="true"]`).forEach(e=>{e.removeAttribute(Md.ELEMENT_FOCUSABLE_ATTR),e.setAttribute("tabindex","0")})}var Md=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super();this.settingActions=e;this.disposableActionFactory=t;this._themeService=o;this._contextViewService=n;this._openerService=r;this._instantiationService=s;this._commandService=l;this._contextMenuService=c;this._keybindingService=u;this._configService=p;this._extensionsService=h;this._extensionsWorkbenchService=g;this._productService=f;this._telemetryService=v;this._hoverService=b;this._markdownRendererService=S;this._onDidClickOverrideElement=this._register(new E);this.onDidClickOverrideElement=this._onDidClickOverrideElement.event;this._onDidChangeSetting=this._register(new E);this.onDidChangeSetting=this._onDidChangeSetting.event;this._onDidOpenSettings=this._register(new E);this.onDidOpenSettings=this._onDidOpenSettings.event;this._onDidClickSettingLink=this._register(new E);this.onDidClickSettingLink=this._onDidClickSettingLink.event;this._onDidFocusSetting=this._register(new E);this.onDidFocusSetting=this._onDidFocusSetting.event;this._onDidChangeIgnoredSettings=this._register(new E);this.onDidChangeIgnoredSettings=this._onDidChangeIgnoredSettings.event;this._onDidChangeSettingHeight=this._register(new E);this.onDidChangeSettingHeight=this._onDidChangeSettingHeight.event;this._onApplyFilter=this._register(new E);this.onApplyFilter=this._onApplyFilter.event;this.ignoredSettings=XVt(Iee(),this._configService),this._register(this._configService.onDidChangeConfiguration(y=>{this.ignoredSettings=XVt(Iee(),this._configService),this._onDidChangeIgnoredSettings.fire()}))}static{this.CONTROL_CLASS="setting-control-focus-target"}static{this.CONTROL_SELECTOR="."+this.CONTROL_CLASS}static{this.CONTENTS_CLASS="setting-item-contents"}static{this.CONTENTS_SELECTOR="."+this.CONTENTS_CLASS}static{this.ALL_ROWS_SELECTOR=".monaco-list-row"}static{this.SETTING_KEY_ATTR="data-key"}static{this.SETTING_ID_ATTR="data-id"}static{this.ELEMENT_FOCUSABLE_ATTR="data-focusable"}renderCommonTemplate(e,t,o){t.classList.add("setting-item"),t.classList.add("setting-item-"+o);let n=new N,r=M(t,Xp(Md.CONTENTS_SELECTOR));r.classList.add("settings-row-inner-container");let s=M(r,Xp(".setting-item-title")),l=M(s,Xp(".setting-item-cat-label-container")),c=M(l,Xp("span.setting-item-category")),u=M(l,Xp("span.setting-item-label")),p=n.add(new hx(u)),h=n.add(this._instantiationService.createInstance(zme,s)),g=M(r,Xp(".setting-item-description")),f=M(r,Xp(".setting-item-modified-indicator"));n.add(this._hoverService.setupDelayedHover(f,{content:d(13221,null)}));let v=M(r,Xp(".setting-item-value")),b=M(v,Xp("div.setting-item-control")),S=M(r,Xp(".setting-item-deprecation-message")),y=M(r,Xp(".setting-toolbar-container")),w=this.renderSettingToolbar(y),k={toDispose:n,elementDisposables:n.add(new N),containerElement:r,categoryElement:c,labelElement:p,descriptionElement:g,controlElement:b,deprecationWarningElement:S,indicatorsLabel:h,toolbar:w};return n.add(j(b,re.MOUSE_DOWN,T=>T.stopPropagation())),n.add(j(s,re.MOUSE_ENTER,T=>r.classList.add("mouseover"))),n.add(j(s,re.MOUSE_LEAVE,T=>r.classList.remove("mouseover"))),k}addSettingElementFocusHandler(e){let t=qn(e.containerElement);e.toDispose.add(t),e.toDispose.add(t.onDidBlur(()=>{e.containerElement.classList.contains("focused")&&e.containerElement.classList.remove("focused")})),e.toDispose.add(t.onDidFocus(()=>{e.containerElement.classList.add("focused"),e.context&&this._onDidFocusSetting.fire(e.context)}))}renderSettingToolbar(e){let t=this._keybindingService.appendKeybinding(d(13227,null),lHt);return new wp(e,this._contextMenuService,{toggleMenuTitle:t,renderDropdownAsChildElement:!dc,moreIcon:ipo})}renderSettingElement(e,t,o){let n=e.element;n.inspectSelf(),o.context=n,o.toolbar.context=n;let r=this.disposableActionFactory(n.setting,n.settingsTarget);r.forEach(p=>jc(p)&&o.elementDisposables.add(p)),o.toolbar.setActions([],[...this.settingActions,...r]);let s=n.setting;o.containerElement.classList.toggle("is-configured",n.isConfigured),o.containerElement.setAttribute(Md.SETTING_KEY_ATTR,n.setting.key),o.containerElement.setAttribute(Md.SETTING_ID_ATTR,n.id);let l=s.key+(n.isConfigured?" - Modified":"");if(o.categoryElement.textContent=n.displayCategory?n.displayCategory+": ":"",o.elementDisposables.add(this._hoverService.setupDelayedHover(o.categoryElement,{content:l})),o.labelElement.text=n.displayLabel,o.labelElement.title=l,o.descriptionElement.innerText="",n.setting.descriptionIsMarkdown){let p=this.renderSettingMarkdown(n,o.containerElement,n.description,o.elementDisposables);o.descriptionElement.appendChild(p)}else o.descriptionElement.innerText=n.description;o.indicatorsLabel.updateScopeOverrides(n,this._onDidClickOverrideElement,this._onApplyFilter),o.elementDisposables.add(this._configService.onDidChangeConfiguration(p=>{p.affectsConfiguration(Ty)&&o.indicatorsLabel.updateScopeOverrides(n,this._onDidClickOverrideElement,this._onApplyFilter)}));let c=p=>this._onDidChangeSetting.fire({key:n.setting.key,value:p,type:o.context.valueType,manualReset:!1,scope:n.setting.scope}),u=n.setting.deprecationMessage||"";u&&n.setting.deprecationMessageIsMarkdown?(o.deprecationWarningElement.innerText="",o.deprecationWarningElement.appendChild(this.renderSettingMarkdown(n,o.containerElement,n.setting.deprecationMessage,o.elementDisposables))):o.deprecationWarningElement.innerText=u,o.deprecationWarningElement.prepend(Xp(".codicon.codicon-error")),o.containerElement.classList.toggle("is-deprecated",!!u),this.renderValue(n,o,c),o.indicatorsLabel.updateWorkspaceTrust(n),o.indicatorsLabel.updateSyncIgnored(n,this.ignoredSettings),o.indicatorsLabel.updateDefaultOverrideIndicator(n),o.indicatorsLabel.updatePreviewIndicator(n),o.indicatorsLabel.updateAdvancedIndicator(n),o.elementDisposables.add(this.onDidChangeIgnoredSettings(()=>{o.indicatorsLabel.updateSyncIgnored(n,this.ignoredSettings)})),this.updateSettingTabbable(n,o),o.elementDisposables.add(n.onDidChangeTabbable(()=>{this.updateSettingTabbable(n,o)}))}updateSettingTabbable(e,t){e.tabbable?CXo(t.containerElement):wXo(t.containerElement)}renderSettingMarkdown(e,t,o,n){o=Bki(o);let r=n.add(this._markdownRendererService.render({value:o,isTrusted:!0},{actionHandler:s=>{if(s.startsWith("#")){let l={source:e,targetKey:s.substring(1)};this._onDidClickSettingLink.fire(l)}else this._openerService.open(s,{allowCommands:!0}).catch(mt)},asyncRenderCallback:()=>{let s=t.clientHeight;s&&this._onDidChangeSettingHeight.fire({element:e,height:s})}}));return r.element.classList.add("setting-item-markdown"),emo(r.element),r.element}disposeTemplate(e){e.toDispose.dispose()}disposeElement(e,t,o){o.elementDisposables?.clear()}};Md=I([m(2,Le),m(3,Wn),m(4,Je),m(5,F),m(6,ge),m(7,Xe),m(8,_e),m(9,B),m(10,lt),m(11,Hi),m(12,tt),m(13,Te),m(14,nt),m(15,On)],Md);var xki=class{constructor(){this.templateId=Jpo}renderTemplate(i){return i.classList.add("group-title"),{parent:i,toDispose:new N}}renderElement(i,e,t){t.parent.innerText="";let o=M(t.parent,Xp("div.settings-group-title-label.settings-row-inner-container"));o.classList.add(`settings-group-level-${i.element.level}`),o.textContent=i.element.label,i.element.isFirstGroup&&o.classList.add("settings-group-first")}disposeTemplate(i){i.toDispose.dispose()}},itt=class{constructor(i){this._commandService=i;this.templateId=Xpo}renderTemplate(i){let e=new N;i.classList.add("setting-item-new-extensions");let t=new Wi(i,{title:!0,...Qo});e.add(t),e.add(t.onDidClick(()=>{o.context&&this._commandService.executeCommand("workbench.extensions.action.showExtensionsWithIds",o.context.extensionIds)})),t.label=d(13222,null),t.element.classList.add("settings-new-extensions-button");let o={button:t,toDispose:e};return o}renderElement(i,e,t){t.context=i.element}disposeTemplate(i){i.toDispose.dispose()}};itt=I([m(0,ge)],itt);var KHt=class a extends Md{constructor(){super(...arguments);this.templateId=zHt}static{this.EDIT_IN_JSON_LABEL=d(13218,null)}renderTemplate(e){let t=this.renderCommonTemplate(null,e,"complex"),o=M(t.controlElement,Xp("a.edit-in-settings-button"));o.classList.add(Md.CONTROL_CLASS),o.role="button";let n=Xp(".setting-item-validation-message");t.containerElement.appendChild(n);let r={...t,button:o,validationErrorMessageElement:n};return this.addSettingElementFocusHandler(r),r}renderElement(e,t,o){super.renderSettingElement(e,t,o)}renderValue(e,t,o){let n=ZIe(e.setting.key),r=d(13219,null,n),s=e.setting.isLanguageTagSetting;t.button.textContent=s?r:a.EDIT_IN_JSON_LABEL;let l=c=>{s?this._onApplyFilter.fire(`@${K0}${n.replaceAll(" ","")}`):this._onDidOpenSettings.fire(e.setting.key),c.preventDefault(),c.stopPropagation()};t.elementDisposables.add(j(t.button,re.CLICK,c=>{l(c)})),t.elementDisposables.add(j(t.button,re.KEY_DOWN,c=>{let u=new gi(c);(u.equals(10)||u.equals(3))&&l(c)})),this.renderValidations(e,t),s?t.button.setAttribute("aria-label",r):t.button.setAttribute("aria-label",`${a.EDIT_IN_JSON_LABEL}: ${e.setting.key}`)}renderValidations(e,t){let o=e.isConfigured&&hCi(e.value,e.setting.type);if(o){t.containerElement.classList.add("invalid-input"),t.validationErrorMessageElement.innerText=o;return}t.containerElement.classList.remove("invalid-input")}},kki=class extends KHt{constructor(){super(...arguments);this.templateId=Ypo}renderTemplate(e){let t=this.renderCommonTemplate(null,e,"list"),o=t.toDispose.add(this._instantiationService.createInstance($me,t.controlElement));o.domNode.classList.add(Md.CONTROL_CLASS);let n=M(M(t.controlElement,Xp(".complex-object-edit-in-settings-button-container")),Xp("a.complex-object.edit-in-settings-button"));n.classList.add(Md.CONTROL_CLASS),n.role="button";let r=Xp(".setting-item-validation-message");t.containerElement.appendChild(r);let s={...t,button:n,validationErrorMessageElement:r,objectSettingWidget:o};return this.addSettingElementFocusHandler(s),s}renderValue(e,t,o){let n=Mpo(e);t.objectSettingWidget.setValue(n,{settingKey:e.setting.key,showAddButton:!1,isReadOnly:!0}),t.button.parentElement?.classList.toggle("hide",e.hasPolicyValue),super.renderValue(e,t,o)}},Eki=class extends Md{constructor(){super(...arguments);this.templateId=Gpo}renderTemplate(e){let t=this.renderCommonTemplate(null,e,"list"),o=t.containerElement.querySelector(".setting-item-description"),n=Xp(".setting-item-validation-message");o.after(n);let r=this._instantiationService.createInstance(qee,t.controlElement);r.domNode.classList.add(Md.CONTROL_CLASS),t.toDispose.add(r);let s={...t,listWidget:r,validationErrorMessageElement:n};return this.addSettingElementFocusHandler(s),t.toDispose.add(r.onDidChangeList(l=>{let c=this.computeNewList(s,l);s.onChange?.(c)})),s}computeNewList(e,t){if(e.context){let o=[];if(Array.isArray(e.context.scopeValue)?o=[...e.context.scopeValue]:Array.isArray(e.context.value)&&(o=[...e.context.value]),t.type==="move"){let n=t.sourceIndex,r=t.targetIndex,s=o.splice(n,1)[0];o.splice(r,0,s)}else if(t.type==="remove"||t.type==="reset")o.splice(t.targetIndex,1);else if(t.type==="change"){let n=t.newItem.value.data.toString();t.targetIndex>-1?o[t.targetIndex]=n:o.push(n)}else t.type==="add"&&o.push(t.newItem.value.data.toString());return e.context.defaultValue&&Array.isArray(e.context.defaultValue)&&e.context.defaultValue.length===o.length&&e.context.defaultValue.join()===o.join()?void 0:o}}renderElement(e,t,o){super.renderSettingElement(e,t,o)}renderValue(e,t,o){let n=SXo(e),r=e.setting.enum?gXo(e):void 0;t.listWidget.setValue(n,{showAddButton:IXo(e,n),keySuggester:r}),t.context=e,t.elementDisposables.add(Z(()=>{t.listWidget.cancelEdit()})),t.onChange=s=>{if(s&&!QHt(e,t,s,!1)){let l=e.setting.arrayItemType,c=UHt(l)?s.map(u=>+u):s;o(c)}else o(s)},QHt(e,t,n.map(s=>s.value.data.toString()),!0)}},GHt=class extends Md{renderTemplateWithWidget(i,e){e.domNode.classList.add(Md.CONTROL_CLASS),i.toDispose.add(e);let t=i.containerElement.querySelector(".setting-item-description"),o=Xp(".setting-item-validation-message");t.after(o);let n={...i,validationErrorMessageElement:o};return e instanceof jme?n.objectCheckboxWidget=e:n.objectDropdownWidget=e,this.addSettingElementFocusHandler(n),n}renderElement(i,e,t){super.renderSettingElement(i,e,t)}},Tki=class extends GHt{constructor(){super(...arguments);this.templateId=jpo}renderTemplate(e){let t=this.renderCommonTemplate(null,e,"list"),o=this._instantiationService.createInstance($me,t.controlElement),n=this.renderTemplateWithWidget(t,o);return t.toDispose.add(o.onDidChangeList(r=>{this.onDidChangeObject(n,r)})),n}onDidChangeObject(e,t){let o=e.objectDropdownWidget;if(e.context){let n=WHt(e.context.setting.key),r=typeof e.context.defaultValue=="object"?e.context.defaultValue??{}:{},s=typeof e.context.scopeValue=="object"?e.context.scopeValue??{}:{},l={...e.context.scopeValue},c=[];if(o.items.forEach((p,h)=>{(t.type==="change"||t.type==="move")&&t.targetIndex===h?(t.originalItem.key.data!==t.newItem.key.data&&n&&t.originalItem.key.data in r?l[t.originalItem.key.data]=null:delete l[t.originalItem.key.data],l[t.newItem.key.data]=t.newItem.value.data,c.push(t.newItem)):(t.type!=="change"&&t.type!=="move"||t.newItem.key.data!==p.key.data)&&(l[p.key.data]=p.value.data,c.push(p))}),t.type==="remove"||t.type==="reset"){let p=t.originalItem.key.data,h=t.type==="remove"&&n&&r[p]===t.originalItem.value.data;h?l[p]=null:delete l[p];let g=c.findIndex(v=>v.key.data===p),f=r[p];h||nr(r[p])&&g>-1?c.splice(g,1):!h&&g>-1&&(c[g].value.data=f)}else t.type==="add"&&(l[t.newItem.key.data]=t.newItem.value.data,c.push(t.newItem));Object.entries(l).forEach(([p,h])=>{s[p]!==h&&r[p]===h&&!(n&&h===null)&&delete l[p]});let u=Object.keys(l).length===0?void 0:l;e.objectDropdownWidget.setValue(c),e.onChange?.(u)}}renderValue(e,t,o){let n=Mpo(e),{key:r,objectProperties:s,objectPatternProperties:l,objectAdditionalProperties:c,propertyNames:u}=e.setting;t.objectDropdownWidget.setValue(n,{settingKey:r,showAddButton:c===!1?!mXo(Object.keys(s??{}),n)||lo(l):!0,keySuggester:fXo(e),valueSuggester:vXo(e),propertyNames:u}),t.context=e,t.elementDisposables.add(Z(()=>{t.objectDropdownWidget.cancelEdit()})),t.onChange=p=>{if(p&&!QHt(e,t,p,!1)){let h=bXo(e,p);o(h)}else o(p)},QHt(e,t,e.value,!0)}},_ki=class extends GHt{constructor(){super(...arguments);this.templateId=Qpo}renderTemplate(e){let t=this.renderCommonTemplate(null,e,"list"),o=this._instantiationService.createInstance(jme,t.controlElement),n=this.renderTemplateWithWidget(t,o);return t.toDispose.add(o.onDidChangeList(r=>{this.onDidChangeObject(n,r)})),n}onDidChangeObject(e,t){if(e.context){let o=e.objectCheckboxWidget,n=typeof e.context.defaultValue=="object"?e.context.defaultValue??{}:{},r=typeof e.context.scopeValue=="object"?e.context.scopeValue??{}:{},s={...e.context.scopeValue},l=[];if(t.type!=="change"){console.warn("Unexpected event type",t.type,"for bool object setting",e.context.setting.key);return}o.items.forEach((u,p)=>{t.targetIndex===p?(s[t.newItem.key.data]=t.newItem.value.data,l.push(t.newItem)):t.newItem.key.data!==u.key.data&&(s[u.key.data]=u.value.data,l.push(u))}),Object.entries(s).forEach(([u,p])=>{r[u]!==p&&n[u]===p&&delete s[u]});let c=Object.keys(s).length===0?void 0:s;e.objectCheckboxWidget.setValue(l),e.onChange?.(c),this._onDidFocusSetting.fire(e.context)}}renderValue(e,t,o){let n=hXo(e),{key:r}=e.setting;t.objectCheckboxWidget.setValue(n,{settingKey:r}),t.context=e,t.onChange=s=>{o(s)}}},qHt=class extends Md{renderTemplate(i){let e=this.renderCommonTemplate(null,i,"list"),t=this._instantiationService.createInstance(this.isExclude()?BHt:HHt,e.controlElement);t.domNode.classList.add(Md.CONTROL_CLASS),e.toDispose.add(t);let o={...e,includeExcludeWidget:t};return this.addSettingElementFocusHandler(o),e.toDispose.add(t.onDidChangeList(n=>this.onDidChangeIncludeExclude(o,n))),o}onDidChangeIncludeExclude(i,e){if(i.context){let o=function(n){let r=Object.keys(n).sort((l,c)=>l.localeCompare(c)),s={};for(let l of r)s[l]=n[l];return s},t={...i.context.scopeValue};e.type!=="add"&&(e.originalItem.value.data.toString()in i.context.defaultValue?t[e.originalItem.value.data.toString()]=!1:delete t[e.originalItem.value.data.toString()]),(e.type==="change"||e.type==="add"||e.type==="move")&&(e.newItem.value.data.toString()in i.context.defaultValue&&!e.newItem.sibling?delete t[e.newItem.value.data.toString()]:t[e.newItem.value.data.toString()]=e.newItem.sibling?{when:e.newItem.sibling}:!0),this._onDidChangeSetting.fire({key:i.context.setting.key,value:Object.keys(t).length===0?void 0:o(t),type:i.context.valueType,manualReset:!1,scope:i.context.setting.scope})}}renderElement(i,e,t){super.renderSettingElement(i,e,t)}renderValue(i,e,t){let o=pXo(i);e.includeExcludeWidget.setValue(o,{isReadOnly:i.hasPolicyValue}),e.context=i,e.elementDisposables.add(Z(()=>{e.includeExcludeWidget.cancelEdit()}))}},Dki=class extends qHt{constructor(){super(...arguments);this.templateId=qpo}isExclude(){return!0}},Lki=class extends qHt{constructor(){super(...arguments);this.templateId=$po}isExclude(){return!1}},xXo=H_({inputBackground:zMe,inputForeground:KMe,inputBorder:AT}),$Ht=class extends Md{constructor(){super(...arguments);this.MULTILINE_MAX_HEIGHT=150}renderTemplate(e,t){let o=this.renderCommonTemplate(null,e,"text"),n=M(o.containerElement,Xp(".setting-item-validation-message")),r={flexibleHeight:t,flexibleWidth:!1,flexibleMaxHeight:this.MULTILINE_MAX_HEIGHT,inputBoxStyles:xXo},s=new Vc(o.controlElement,this._contextViewService,r);o.toDispose.add(s),o.toDispose.add(s.onDidChange(c=>{l.onChange?.(c)})),o.toDispose.add(s),s.inputElement.classList.add(Md.CONTROL_CLASS),s.inputElement.tabIndex=0;let l={...o,inputBox:s,validationErrorMessageElement:n};return this.addSettingElementFocusHandler(l),l}renderElement(e,t,o){super.renderSettingElement(e,t,o)}renderValue(e,t,o){t.onChange=void 0,t.inputBox.value=e.value,t.inputBox.setEnabled(!e.hasPolicyValue),t.inputBox.setAriaLabel(e.setting.key),t.onChange=n=>{jHt(e,t,!1)||o(n)},jHt(e,t,!0)}},Rki=class extends $Ht{constructor(){super(...arguments);this.templateId=Bpo}renderTemplate(e){let t=super.renderTemplate(e,!1);return t.toDispose.add(Jo(t.inputBox.inputElement,re.KEY_DOWN,o=>{(o.equals(16)||o.equals(18))&&o.preventDefault()})),t}},Mki=class extends $Ht{constructor(){super(...arguments);this.templateId=Hpo}renderTemplate(e){return super.renderTemplate(e,!0)}renderValue(e,t,o){let n=r=>{e.value=r,o(r)};super.renderValue(e,t,n),t.elementDisposables.add(t.inputBox.onDidHeightChange(r=>{t.containerElement.clientHeight&&this._onDidChangeSettingHeight.fire({element:e,height:t.containerElement.clientHeight})})),t.inputBox.layout()}},Pki=class extends Md{constructor(){super(...arguments);this.templateId=zpo}renderTemplate(e){let t=this.renderCommonTemplate(null,e,"enum"),o=pwt({selectBackground:LHt,selectForeground:RHt,selectBorder:MHt,selectListBorder:PHt}),n=new ME([],0,this._contextViewService,o,{useCustomDrawn:!oI(this._configService)||!(dc&&yg.pointerEvents)});t.toDispose.add(n),n.render(t.controlElement);let r=t.controlElement.querySelector("select");r&&(r.classList.add(Md.CONTROL_CLASS),r.tabIndex=0),t.toDispose.add(n.onDidSelect(c=>{l.onChange?.(c.index)}));let s=t.containerElement.insertBefore(Xp(".setting-item-enumDescription"),t.descriptionElement.nextSibling),l={...t,selectBox:n,selectElement:r,enumDescriptionElement:s};return this.addSettingElementFocusHandler(l),l}renderElement(e,t,o){super.renderSettingElement(e,t,o)}renderValue(e,t,o){let n=e.setting.enumItemLabels?[...e.setting.enumItemLabels]:[],r=e.setting.enumDescriptions?[...e.setting.enumDescriptions]:[],s=[...e.setting.enum],l=e.setting.enumDescriptionsAreMarkdown,c=new N;t.elementDisposables.add(c);let u=!1;s.includes(e.defaultValue)||(s.unshift(e.defaultValue),r.unshift(""),n.unshift(""),u=!0);let p=Rpo(String(e.defaultValue)),h=s.map(String).map(Rpo).map((f,v)=>{let b=r[v]&&(l?Bki(r[v],!1):r[v]);return{text:n[v]?n[v]:f,detail:n[v]?f:"",description:b,descriptionIsMarkdown:l,descriptionMarkdownActionHandler:S=>{this._openerService.open(S).catch(mt)},decoratorRight:f===p||u&&v===0?d(13225,null):""}});t.selectBox.setOptions(h),t.selectBox.setAriaLabel(e.setting.key),t.selectBox.setEnabled(!e.hasPolicyValue);let g=s.indexOf(e.value);g===-1&&(g=0),t.onChange=void 0,t.selectBox.select(g),t.onChange=f=>{o(u&&f===0?e.defaultValue:s[f])},t.enumDescriptionElement.innerText=""}},kXo=H_({inputBackground:upo,inputForeground:ppo,inputBorder:mpo}),Aki=class extends Md{constructor(){super(...arguments);this.templateId=Upo}renderTemplate(e){let t=super.renderCommonTemplate(null,e,"number"),o=M(t.containerElement,Xp(".setting-item-validation-message")),n=new Vc(t.controlElement,this._contextViewService,{type:"number",inputBoxStyles:kXo});t.toDispose.add(n),t.toDispose.add(n.onDidChange(s=>{r.onChange?.(s)})),t.toDispose.add(n),n.inputElement.classList.add(Md.CONTROL_CLASS),n.inputElement.tabIndex=0;let r={...t,inputBox:n,validationErrorMessageElement:o};return this.addSettingElementFocusHandler(r),r}renderElement(e,t,o){super.renderSettingElement(e,t,o)}renderValue(e,t,o){let n=e.valueType==="integer"||e.valueType==="nullable-integer"?parseInt:parseFloat,r=e.valueType==="nullable-integer"||e.valueType==="nullable-number"?(s=>s===""?null:n(s)):n;t.onChange=void 0,t.inputBox.value=typeof e.value=="number"?e.value.toString():"",t.inputBox.step=e.valueType.includes("integer")?"1":"any",t.inputBox.setAriaLabel(e.setting.key),t.inputBox.setEnabled(!e.hasPolicyValue),t.onChange=s=>{jHt(e,t,!1)||o(r(s))},jHt(e,t,!0)}},Nki=class extends Md{constructor(){super(...arguments);this.templateId=Kpo}renderTemplate(e){e.classList.add("setting-item"),e.classList.add("setting-item-bool");let t=new N,o=M(e,Xp(Md.CONTENTS_SELECTOR));o.classList.add("settings-row-inner-container");let n=M(o,Xp(".setting-item-title")),r=M(n,Xp("span.setting-item-category")),s=M(n,Xp("span.setting-item-label")),l=t.add(new hx(s)),c=t.add(this._instantiationService.createInstance(zme,n)),u=M(o,Xp(".setting-item-value-description")),p=M(u,Xp(".setting-item-bool-control")),h=M(u,Xp(".setting-item-description")),g=M(o,Xp(".setting-item-modified-indicator"));t.add(this._hoverService.setupDelayedHover(g,{content:d(13221,null)}));let f=M(o,Xp(".setting-item-deprecation-message")),v=new cm({icon:R.check,actionClassName:"setting-value-checkbox",isChecked:!0,title:"",...WY});p.appendChild(v.domNode),t.add(v),t.add(v.onChange(()=>{y.onChange(v.checked)})),v.domNode.classList.add(Md.CONTROL_CLASS);let b=M(o,Xp(".setting-toolbar-container")),S=this.renderSettingToolbar(b);t.add(S);let y={toDispose:t,elementDisposables:t.add(new N),containerElement:o,categoryElement:r,labelElement:l,controlElement:p,checkbox:v,descriptionElement:h,deprecationWarningElement:f,indicatorsLabel:c,toolbar:S};return this.addSettingElementFocusHandler(y),t.add(j(p,"mousedown",w=>w.stopPropagation())),t.add(j(n,re.MOUSE_ENTER,w=>o.classList.add("mouseover"))),t.add(j(n,re.MOUSE_LEAVE,w=>o.classList.remove("mouseover"))),y}renderElement(e,t,o){super.renderSettingElement(e,t,o)}renderValue(e,t,o){t.onChange=void 0,t.checkbox.checked=e.value,e.hasPolicyValue?(t.checkbox.disable(),t.descriptionElement.classList.add("disabled")):(t.checkbox.enable(),t.descriptionElement.classList.remove("disabled"),t.elementDisposables.add(j(t.descriptionElement,re.MOUSE_DOWN,n=>{n.target.tagName.toLowerCase()!=="a"&&(t.checkbox.checked=!t.checkbox.checked,t.onChange(t.checkbox.checked)),Xt.stop(n)}))),t.checkbox.setTitle(e.setting.key),t.onChange=o}},Oki=class extends Md{constructor(){super(...arguments);this.templateId=Zpo;this._onDidDismissExtensionSetting=this._register(new E);this.onDidDismissExtensionSetting=this._onDidDismissExtensionSetting.event}renderTemplate(e){let t=super.renderCommonTemplate(null,e,"extension-toggle"),o=new Wi(t.containerElement,{title:!1,...Qo});o.element.classList.add("setting-item-extension-toggle-button"),o.label=d(13228,null);let n=new Wi(t.containerElement,{title:!1,secondary:!0,...Qo});n.element.classList.add("setting-item-extension-dismiss-button"),n.label=d(13217,null);let r={...t,actionButton:o,dismissButton:n};return this.addSettingElementFocusHandler(r),r}renderElement(e,t,o){super.renderSettingElement(e,t,o)}renderValue(e,t,o){t.elementDisposables.clear();let n=e.setting.displayExtensionId;t.elementDisposables.add(t.actionButton.onDidClick(async()=>{this._telemetryService.publicLog2("ManageExtensionClick",{extensionId:n}),this._commandService.executeCommand("extension.open",n)})),t.elementDisposables.add(t.dismissButton.onDidClick(async()=>{this._telemetryService.publicLog2("DismissExtensionClick",{extensionId:n}),this._onDidDismissExtensionSetting.fire(n)}))}},XMe=class extends x{constructor(e,t,o,n){super();this._instantiationService=e;this._contextMenuService=t;this._contextViewService=o;this._userDataSyncEnablementService=n;this._onDidChangeSetting=this._register(new E);this.settingActions=[new it("settings.resetSetting",d(13223,null),void 0,void 0,async u=>{u instanceof $w&&(u.isUntrusted||this._onDidChangeSetting.fire({key:u.setting.key,value:void 0,type:u.setting.type,manualReset:!0,scope:u.setting.scope}))}),new ri,this._instantiationService.createInstance($ee),this._instantiationService.createInstance(jee),this._instantiationService.createInstance(Qee)];let r=(u,p)=>this.getActionsForSetting(u,p),s=u=>[],l=this._instantiationService.createInstance(Oki,[],s),c=[this._instantiationService.createInstance(Nki,this.settingActions,r),this._instantiationService.createInstance(Aki,this.settingActions,r),this._instantiationService.createInstance(Eki,this.settingActions,r),this._instantiationService.createInstance(KHt,this.settingActions,r),this._instantiationService.createInstance(kki,this.settingActions,r),this._instantiationService.createInstance(Rki,this.settingActions,r),this._instantiationService.createInstance(Mki,this.settingActions,r),this._instantiationService.createInstance(Dki,this.settingActions,r),this._instantiationService.createInstance(Lki,this.settingActions,r),this._instantiationService.createInstance(Pki,this.settingActions,r),this._instantiationService.createInstance(Tki,this.settingActions,r),this._instantiationService.createInstance(_ki,this.settingActions,r),l];this.onDidClickOverrideElement=U.any(...c.map(u=>u.onDidClickOverrideElement)),this.onDidChangeSetting=U.any(...c.map(u=>u.onDidChangeSetting),this._onDidChangeSetting.event),this.onDidDismissExtensionSetting=l.onDidDismissExtensionSetting,this.onDidOpenSettings=U.any(...c.map(u=>u.onDidOpenSettings)),this.onDidClickSettingLink=U.any(...c.map(u=>u.onDidClickSettingLink)),this.onDidFocusSetting=U.any(...c.map(u=>u.onDidFocusSetting)),this.onDidChangeSettingHeight=U.any(...c.map(u=>u.onDidChangeSettingHeight)),this.onApplyFilter=U.any(...c.map(u=>u.onApplyFilter)),this.allRenderers=[...c,this._instantiationService.createInstance(xki),this._instantiationService.createInstance(itt)]}getActionsForSetting(e,t){let o=[];return!(e.scope&&Kw.includes(e.scope))&&t===3&&o.push(this._instantiationService.createInstance(Xee,e)),this._userDataSyncEnablementService.isEnabled()&&!e.disallowSyncIgnore&&o.push(this._instantiationService.createInstance(Yee,e)),o.length&&o.splice(0,0,new ri),o}cancelSuggesters(){this._contextViewService.hideContextView()}showContextMenu(e,t){let o=t.querySelector(".monaco-toolbar");o&&this._contextMenuService.showContextMenu({getActions:()=>this.settingActions,getAnchor:()=>o,getActionsContext:()=>e})}getSettingDOMElementForDOMElement(e){let t=Cg(e,Md.CONTENTS_CLASS);return t||null}getDOMElementsForSettingKey(e,t){return e.querySelectorAll(`[${Md.SETTING_KEY_ATTR}="${t}"]`)}getKeyForDOMElementInSetting(e){let t=this.getSettingDOMElementForDOMElement(e);return t&&t.getAttribute(Md.SETTING_KEY_ATTR)}getIdForDOMElementInSetting(e){let t=this.getSettingDOMElementForDOMElement(e);return t&&t.getAttribute(Md.SETTING_ID_ATTR)}dispose(){super.dispose(),this.settingActions.forEach(e=>{jc(e)&&e.dispose()}),this.allRenderers.forEach(e=>{jc(e)&&e.dispose()})}};XMe=I([m(0,F),m(1,Xe),m(2,Wn),m(3,Fl)],XMe);function jHt(a,i,e){if(a.setting.validator){let t=a.setting.validator(i.inputBox.value);if(t){i.containerElement.classList.add("invalid-input"),i.validationErrorMessageElement.innerText=t;let o=d(13230,null);return i.inputBox.inputElement.parentElement.setAttribute("aria-label",[o,t].join(" ")),e||qr(o+" "+t),!0}else i.inputBox.inputElement.parentElement.removeAttribute("aria-label")}return i.containerElement.classList.remove("invalid-input"),!1}function QHt(a,i,e,t){if(i.containerElement.classList.add("invalid-input"),a.setting.validator){let o=a.setting.validator(e);if(o&&o!==""){i.containerElement.classList.add("invalid-input"),i.validationErrorMessageElement.innerText=o;let n=d(13230,null);return i.containerElement.setAttribute("aria-label",[a.setting.key,n,o].join(" ")),t||qr(n+" "+o),!0}else i.containerElement.setAttribute("aria-label",a.setting.key),i.containerElement.classList.remove("invalid-input")}return!1}function emo(a){for(let i=0;i<a.childNodes.length;i++){let e=a.childNodes.item(i);(e.tagName&&e.tagName.toLowerCase())==="img"?e.remove():emo(e)}}function Bki(a,i=!0){return a.replace(/`#([^#\s`]+)#`|'#([^#\s']+)#'/g,(e,t,o)=>{let n=t??o,r=s8(n),s=`${r.category}: ${r.label}`;return i?`[${s}](#${n} "${n}")`:`"${s}"`})}function Rpo(a){return a&&a.replace(/\n/g,"\\n").replace(/\r/g,"\\r")}var Qme=class{constructor(i,e,t){this.viewState=i;this.isFilteringGroups=e;this.environmentService=t}filter(i,e){if(this.viewState.categoryFilter&&i instanceof $w&&!this.settingContainedInGroup(i.setting,this.viewState.categoryFilter))return!1;if(i instanceof $w&&this.viewState.settingsTarget!==3){let t=!!this.environmentService.remoteAuthority;if(!i.matchesScope(this.viewState.settingsTarget,t))return!1}return i instanceof sv?this.isFilteringGroups&&this.viewState.categoryFilter?this.groupIsRelatedToCategory(i,this.viewState.categoryFilter)?2:!1:typeof i.count=="number"?i.count>0:2:!(i instanceof YMe&&(this.viewState.tagFilters?.size||this.viewState.categoryFilter))}settingContainedInGroup(i,e){return e.children.some(t=>t instanceof sv?this.settingContainedInGroup(i,t):t instanceof $w?t.setting.key===i.key:!1)}groupIsRelatedToCategory(i,e){if(i.id===e.id)return!0;let t=i.parent;for(;t;){if(t.id===e.id)return!0;t=t.parent}let o=e.parent;for(;o;){if(o.id===i.id)return!0;o=o.parent}return!1}};Qme=I([m(2,At)],Qme);var Fki=class extends yz{getTemplateId(i){if(i instanceof sv)return Jpo;if(i instanceof $w)return i.valueType==="extension-toggle"?Zpo:i.isConfigured&&hCi(i.value,i.setting.type)?zHt:i.valueType==="boolean"?Kpo:i.valueType==="integer"||i.valueType==="number"||i.valueType==="nullable-integer"||i.valueType==="nullable-number"?Upo:i.valueType==="multiline-string"?Hpo:i.valueType==="string"?Bpo:i.valueType==="enum"?zpo:i.valueType==="array"?Gpo:i.valueType==="exclude"?qpo:i.valueType==="include"?$po:i.valueType==="object"?jpo:i.valueType==="boolean-object"?Qpo:i.valueType==="complex-object"?Ypo:(i.valueType==="language-tag",zHt);if(i instanceof YMe)return Xpo;throw new Error("unknown element type: "+i)}hasDynamicHeight(i){return!(i instanceof sv)}estimateHeight(i){return i instanceof sv?42:i instanceof $w&&i.valueType==="boolean"?78:104}},Wki=class extends jz{isCollapsible(i){return!1}setCollapsed(i,e,t){return!1}},Vki=class{constructor(i,e,t){this.configurationService=i;this.languageService=e;this.userDataProfilesService=t}getAriaLabel(i){if(i instanceof $w){let e=[];if(e.push(`${i.displayCategory} ${i.displayLabel}.`),i.isConfigured){let n=d(13226,null);e.push(n)}let t=Epo(i,this.configurationService,this.userDataProfilesService,this.languageService);t.length&&e.push(`${t}.`);let o=Da({value:Bki(i.description,!1)});return o.length&&e.push(o),e.join(" ")}else return i instanceof sv?i.label:i.id}getWidgetAriaLabel(){return d(13224,null)}},JMe=class extends Rg{constructor(i,e,t,o,n,r,s,l,c){super("SettingsTree",i,new Fki,t,{horizontalScrolling:!1,supportDynamicHeights:!0,scrollToActiveElement:!0,identityProvider:{getId(u){return u.id}},accessibilityProvider:new Vki(r,l,c),styleController:u=>new Kle(Cr(i),u),filter:s.createInstance(Qme,e,!0),smoothScrolling:r.getValue("workbench.list.smoothScrolling"),multipleSelectionSupport:!1,findWidgetEnabled:!1,renderIndentGuides:"none",transformOptimization:!1},s,o,n,r),this.getHTMLElement().classList.add("settings-editor-tree"),this.style(uS({listBackground:Ho,listActiveSelectionBackground:Ho,listActiveSelectionForeground:To,listFocusAndSelectionBackground:Ho,listFocusAndSelectionForeground:To,listFocusBackground:Ho,listFocusForeground:To,listHoverForeground:To,listHoverBackground:Ho,listHoverOutline:Ho,listFocusOutline:Ho,listInactiveSelectionBackground:Ho,listInactiveSelectionForeground:To,listInactiveFocusBackground:Ho,listInactiveFocusOutline:Ho,treeIndentGuidesStroke:void 0,treeInactiveIndentGuidesStroke:void 0})),this.disposables.add(r.onDidChangeConfiguration(u=>{u.affectsConfiguration("workbench.list.smoothScrolling")&&this.updateOptions({smoothScrolling:r.getValue("workbench.list.smoothScrolling")})}))}createModel(i,e){return new Wki(i,e)}};JMe=I([m(3,X),m(4,Io),m(5,fg),m(6,F),m(7,_t),m(8,an)],JMe);var $ee=class extends it{constructor(e){super($ee.ID,$ee.LABEL);this.clipboardService=e}static{this.ID="settings.copySettingId"}static{this.LABEL=d(13216,null)}async run(e){return e&&await this.clipboardService.writeText(e.setting.key),Promise.resolve(void 0)}};$ee=I([m(0,Fi)],$ee);var jee=class extends it{constructor(e){super(jee.ID,jee.LABEL);this.clipboardService=e}static{this.ID="settings.copySettingAsJSON"}static{this.LABEL=d(13214,null)}async run(e){if(e){let t=`"${e.setting.key}": ${JSON.stringify(e.value,void 0,"  ")}`;await this.clipboardService.writeText(t)}return Promise.resolve(void 0)}};jee=I([m(0,Fi)],jee);var Qee=class extends it{constructor(e,t){super(Qee.ID,Qee.LABEL);this.clipboardService=e;this.productService=t}static{this.ID="settings.copySettingAsURL"}static{this.LABEL=d(13215,null)}async run(e){if(e){let t=e.setting.key,o=this.productService.urlProtocol,n=A.from({scheme:o,authority:E_e,path:`/${t}`},!0);await this.clipboardService.writeText(n.toString())}return Promise.resolve(void 0)}};Qee=I([m(0,Fi),m(1,tt)],Qee);var Yee=class extends it{constructor(e,t){super(Yee.ID,Yee.LABEL);this.setting=e;this.configService=t;this._register(U.filter(t.onDidChangeConfiguration,o=>o.affectsConfiguration("settingsSync.ignoredSettings"))(()=>this.update())),this.update()}static{this.ID="settings.stopSyncingSetting"}static{this.LABEL=d(13229,null)}async update(){let e=XVt(Iee(),this.configService);this.checked=!e.includes(this.setting.key)}async run(){let e=[...this.configService.getValue("settingsSync.ignoredSettings")];e=e.filter(r=>r!==this.setting.key&&r!==`-${this.setting.key}`);let o=Iee().includes(this.setting.key),n=!this.checked;return n&&o&&e.push(`-${this.setting.key}`),!n&&!o&&e.push(this.setting.key),this.configService.updateValue("settingsSync.ignoredSettings",e.length?e:void 0,2),Promise.resolve(void 0)}};Yee=I([m(1,B)],Yee);var Xee=class extends it{constructor(e,t){super(Xee.ID,Xee.LABEL);this.setting=e;this.configService=t;this._register(U.filter(t.onDidChangeConfiguration,o=>o.affectsConfiguration(Ty))(()=>this.update())),this.update()}static{this.ID="settings.applyToAllProfiles"}static{this.LABEL=d(13213,null)}update(){let e=this.configService.getValue(Ty);this.checked=e.includes(this.setting.key)}async run(){let e=this.configService.getValue(Ty)??[];this.checked?e.splice(e.indexOf(this.setting.key),1):e.push(this.setting.key);let t=zo(e);this.checked?(await this.configService.updateValue(this.setting.key,this.configService.inspect(this.setting.key).application?.value,3),await this.configService.updateValue(Ty,t.length?t:void 0,3)):(await this.configService.updateValue(Ty,t.length?t:void 0,3),await this.configService.updateValue(this.setting.key,this.configService.inspect(this.setting.key).userLocal?.value,3))}};Xee=I([m(1,fg)],Xee);var tmo=_,ZMe=class{constructor(i,e){this._viewState=i;this.environmentService=e;this._currentSearchModel=null}get settingsTreeRoot(){return this._settingsTreeRoot}set settingsTreeRoot(i){this._settingsTreeRoot=i,this.update()}get currentSearchModel(){return this._currentSearchModel}set currentSearchModel(i){this._currentSearchModel=i,this.update()}get children(){return this._settingsTreeRoot.children}update(){this._settingsTreeRoot&&this.updateGroupCount(this._settingsTreeRoot)}updateGroupCount(i){i.children.forEach(t=>{t instanceof sv&&this.updateGroupCount(t)});let e=i.children.filter(t=>t instanceof sv).reduce((t,o)=>t+o.count,0);i.count=e+this.getGroupCount(i)}getGroupCount(i){return i.children.filter(e=>{if(!(e instanceof $w)||this._currentSearchModel&&!this._currentSearchModel.root.containsSetting(e.setting.key))return!1;let t=!!this.environmentService.remoteAuthority;return e.matchesScope(this._viewState.settingsTarget,t)&&e.matchesAllTags(this._viewState.tagFilters)&&e.matchesAnyFeature(this._viewState.featureFilters)&&e.matchesAnyExtension(this._viewState.extensionFilters)&&e.matchesAnyId(this._viewState.idFilters)}).length}};ZMe=I([m(1,At)],ZMe);var imo="settings.toc.entry",Hki=class{constructor(i){this._hoverService=i;this.templateId=imo}renderTemplate(i){return{labelElement:M(i,tmo(".settings-toc-entry")),countElement:M(i,tmo(".settings-toc-count")),elementDisposables:new N}}renderElement(i,e,t){t.elementDisposables.clear();let o=i.element,n=o.count,r=o.label;t.labelElement.textContent=r,t.elementDisposables.add(this._hoverService.setupDelayedHover(t.labelElement,{content:r})),n?t.countElement.textContent=` (${n})`:t.countElement.textContent=""}disposeTemplate(i){i.elementDisposables.dispose()}},Uki=class{getTemplateId(i){return imo}getHeight(i){return 22}};function Kki(a,i){let e=a.children.filter(t=>t instanceof sv);return vt.map(e,t=>{let o=t.children.some(n=>n instanceof sv);return{element:t,collapsed:void 0,collapsible:o,children:t instanceof sv?Kki(t,i):void 0}})}var zki=class{getWidgetAriaLabel(){return d(13262,null)}getAriaLabel(i){return i&&i instanceof sv?d(13261,null,i.label):""}getAriaLevel(i){let e=1;for(;i instanceof sv&&i.parent;)e++,i=i.parent;return e}},ePe=class extends Rg{constructor(i,e,t,o,n,r,s){let c={filter:s.createInstance(Qme,e,!1),multipleSelectionSupport:!1,identityProvider:{getId(u){return u.id}},styleController:u=>new Kle(Cr(i),u),accessibilityProvider:s.createInstance(zki),collapseByDefault:!0,horizontalScrolling:!1,hideTwistiesOfChildlessElements:!0,renderIndentGuides:"none"};super("SettingsTOC",i,new Uki,[new Hki(r)],c,s,t,o,n),this.style(uS({listBackground:Ho,listFocusOutline:Sd,listActiveSelectionBackground:Ho,listActiveSelectionForeground:zet,listFocusAndSelectionBackground:Ho,listFocusAndSelectionForeground:zet,listFocusBackground:Ho,listFocusForeground:pki,listHoverForeground:pki,listHoverBackground:Ho,listInactiveSelectionBackground:Ho,listInactiveSelectionForeground:zet,listInactiveFocusBackground:Ho,listInactiveFocusOutline:Ho,treeIndentGuidesStroke:void 0,treeInactiveIndentGuidesStroke:void 0}))}};ePe=I([m(2,X),m(3,Io),m(4,B),m(5,nt),m(6,F)],ePe);function rmo(a){return vt.map(a.children,i=>({element:i,children:i instanceof sv?rmo(i):void 0}))}var GD=_,Gki=d(13088,null),omo="workbench.settings.settingsSearchTocBehavior",EXo=d(13092,null),nmo=d(13091,null),TXo="settingsEditorState",hd=class extends Ts{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,P,O,V,H){super(hd.ID,e,t,r,h);this.configurationService=o;this.preferencesService=s;this.instantiationService=l;this.preferencesSearchService=c;this.logService=u;this.storageService=h;this.editorGroupService=g;this.userDataSyncWorkbenchService=f;this.userDataSyncEnablementService=v;this.workspaceTrustManagementService=b;this.extensionService=S;this.languageService=y;this.extensionManagementService=w;this.productService=k;this.extensionGalleryService=T;this.editorProgressService=P;this.keybindingService=V;this.chatEntitlementService=H;this.searchContainer=null;this.settingsTreeModel=this._register(new me);this.searchInProgress=null;this.aiSearchPromise=null;this.showAiResultsAction=null;this.pendingSettingUpdate=null;this._searchResultModel=this._register(new me);this.searchResultLabel=null;this.lastSyncedLabel=null;this.settingsOrderByTocIndex=null;this._currentFocusContext=0;this.hasWarnedMissingSettings=!1;this.tocTreeDisposed=!1;this.tocFocusedElement=null;this.treeFocusedElement=null;this.settingsTreeScrollTop=0;this.installedExtensionIds=[];this.dismissedExtensionSettings=[];this.DISMISSED_EXTENSION_SETTINGS_STORAGE_KEY="settingsEditor2.dismissedExtensionSettings";this.DISMISSED_EXTENSION_SETTINGS_DELIMITER="	";this.searchInputActionBar=null;this.searchDelayer=this._register(new Xo(200)),this.viewState={settingsTarget:3},this.settingFastUpdateDelayer=this._register(new Xo(hd.SETTING_UPDATE_FAST_DEBOUNCE)),this.settingSlowUpdateDelayer=this._register(new Xo(hd.SETTING_UPDATE_SLOW_DEBOUNCE)),this.searchInputDelayer=this._register(new Xo(hd.SEARCH_DEBOUNCE)),this.updatedConfigSchemaDelayer=this._register(new Xo(hd.CONFIG_SCHEMA_UPDATE_DELAYER)),this.inSettingsEditorContextKey=KD.bindTo(p),this.searchFocusContextKey=Ame.bindTo(p),this.tocRowFocused=cHt.bindTo(p),this.settingRowFocused=Wet.bindTo(p),this.aiResultsAvailable=uHt.bindTo(p),this.scheduledRefreshes=new Map,this.editorMemento=this.getEditorMemento(g,n,TXo),this.dismissedExtensionSettings=this.storageService.get(this.DISMISSED_EXTENSION_SETTINGS_STORAGE_KEY,0,"").split(this.DISMISSED_EXTENSION_SETTINGS_DELIMITER),this._register(o.onDidChangeConfiguration(G=>{(G.affectedKeys.has("workbench.settings.showAISearchToggle")||G.affectedKeys.has("workbench.settings.enableNaturalLanguageSearch"))&&this.updateAiSearchToggleVisibility(),G.affectsConfiguration(Fvi)&&this.onConfigUpdate(void 0,!0,!0),G.source!==7&&this.onConfigUpdate(G.affectedKeys)})),this._register(H.onDidChangeSentiment(()=>{this.updateAiSearchToggleVisibility()})),this._register(O.onDidChangeCurrentProfile(G=>{G.join(this.whenCurrentProfileChanged())})),this._register(b.onDidChangeTrust(()=>{this.searchResultModel?.updateWorkspaceTrust(b.isWorkspaceTrusted()),this.settingsTreeModel.value&&(this.settingsTreeModel.value.updateWorkspaceTrust(b.isWorkspaceTrusted()),this.renderTree())})),this._register(o.onDidChangeRestrictedSettings(G=>{G.default.length&&this.currentSettingsModel&&this.updateElementsByKey(new Set(G.default))})),this._register(w.onDidInstallExtensions(()=>{this.refreshInstalledExtensionsList()})),this._register(w.onDidUninstallExtension(()=>{this.refreshInstalledExtensionsList()})),this.modelDisposables=this._register(new N),CHt&&!hd.SUGGESTIONS.includes(`@${K0}`)&&hd.SUGGESTIONS.push(`@${K0}`),this.inputChangeListener=this._register(new me)}static{this.ID="workbench.editor.settings2"}static{this.NUM_INSTANCES=0}static{this.SEARCH_DEBOUNCE=200}static{this.SETTING_UPDATE_FAST_DEBOUNCE=200}static{this.SETTING_UPDATE_SLOW_DEBOUNCE=1e3}static{this.CONFIG_SCHEMA_UPDATE_DELAYER=500}static{this.TOC_MIN_WIDTH=100}static{this.TOC_RESET_WIDTH=200}static{this.EDITOR_MIN_WIDTH=500}static{this.NARROW_TOTAL_WIDTH=this.TOC_RESET_WIDTH+this.EDITOR_MIN_WIDTH}static{this.SUGGESTIONS=[`@${lG}`,"@tag:notebookLayout","@tag:notebookOutputLayout",`@tag:${OMe}`,`@tag:${i8}`,"@tag:sync","@tag:usesOnlineServices","@tag:telemetry","@tag:accessibility","@tag:preview","@tag:experimental",`@tag:${o8}`,`@${Vet}`,`@${NMe}`,`@${Vk}scm`,`@${Vk}explorer`,`@${Vk}search`,`@${Vk}debug`,`@${Vk}extensions`,`@${Vk}terminal`,`@${Vk}task`,`@${Vk}problems`,`@${Vk}output`,`@${Vk}comments`,`@${Vk}remote`,`@${Vk}timeline`,`@${Vk}notebook`,`@${Vk}chat`,`@${FH}`]}static shouldSettingUpdateFast(e){return Array.isArray(e)?!1:e==="enum"||e==="array"||e==="boolean-object"||e==="object"||e==="complex"||e==="boolean"||e==="exclude"||e==="include"}async whenCurrentProfileChanged(){this.updatedConfigSchemaDelayer.trigger(()=>{this.dismissedExtensionSettings=this.storageService.get(this.DISMISSED_EXTENSION_SETTINGS_STORAGE_KEY,0,"").split(this.DISMISSED_EXTENSION_SETTINGS_DELIMITER),this.onConfigUpdate(void 0,!0)})}canShowAdvancedSettings(){return this.configurationService.getValue(Fvi)??!1?!0:this.viewState.tagFilters?.has(o8)??!1}shouldShowSetting(e){return!!(!e.tags?.includes(o8)||this.viewState.idFilters?.has(e.key)||this.viewState.query?.toLowerCase().includes(e.key.toLowerCase())||this.viewState.tagFilters?.has(FH))}disableAiSearchToggle(){this.showAiResultsAction&&(this.showAiResultsAction.checked=!1,this.showAiResultsAction.enabled=!1,this.aiResultsAvailable.set(!1),this.showAiResultsAction.label=nmo)}updateAiSearchToggleVisibility(){if(!this.searchContainer||!this.showAiResultsAction||!this.searchInputActionBar)return;let e=this.configurationService.getValue("workbench.settings.showAISearchToggle"),t=this.configurationService.getValue("workbench.settings.enableNaturalLanguageSearch"),o=this.chatEntitlementService.sentiment.hidden||this.chatEntitlementService.sentiment.disabled,n=e&&t&&!o,r=this.searchInputActionBar.hasAction(this.showAiResultsAction);!r&&n?(this.searchInputActionBar.push(this.showAiResultsAction,{index:0,label:!1,icon:!0}),this.searchContainer.classList.add("with-ai-toggle")):r&&(this.searchInputActionBar.pull(0),this.searchContainer.classList.remove("with-ai-toggle"),this.showAiResultsAction.checked=!1)}get minimumWidth(){return hd.EDITOR_MIN_WIDTH}get maximumWidth(){return Number.POSITIVE_INFINITY}get minimumHeight(){return 180}set minimumWidth(e){}set maximumWidth(e){}get currentSettingsModel(){return this.searchResultModel||this.settingsTreeModel.value}get searchResultModel(){return this._searchResultModel.value??null}set searchResultModel(e){this._searchResultModel.value=e??void 0,this.rootElement.classList.toggle("search-mode",!!this._searchResultModel.value)}get focusedSettingDOMElement(){let e=this.settingsTree.getFocus()[0];if(e instanceof $w)return this.settingRenderers.getDOMElementsForSettingKey(this.settingsTree.getHTMLElement(),e.setting.key)[0]}get currentFocusContext(){return this._currentFocusContext}createEditor(e){e.setAttribute("tabindex","-1"),this.rootElement=M(e,GD(".settings-editor",{tabindex:"-1"})),this.createHeader(this.rootElement),this.createBody(this.rootElement),this.addCtrlAInterceptor(this.rootElement),this.updateStyles(),this._register(bT({name:"settingsEditor2",focusNotifiers:[this],focusNextWidget:()=>{this.searchWidget.inputWidget.hasWidgetFocus()&&this.focusTOC()},focusPreviousWidget:()=>{this.searchWidget.inputWidget.hasWidgetFocus()||this.focusSearch()}}))}async setInput(e,t,o,n){if(this.inSettingsEditorContextKey.set(!0),await super.setInput(e,t,o,n),!this.input)return;let r=await this.input.resolve();if(!(n.isCancellationRequested||!(r instanceof fee))){if(this.modelDisposables.clear(),this.modelDisposables.add(r.onDidChangeGroups(()=>{this.updatedConfigSchemaDelayer.trigger(()=>{this.onConfigUpdate(void 0,!1,!0)})})),this.defaultSettingsEditorModel=r,t=t||x_e({}),!this.viewState.settingsTarget||!this.settingsTargetsWidget.settingsTarget){let s=t.viewState&&t.viewState.settingsTarget;!t.target&&!s&&(t.target=3)}this._setOptions(t),this.onConfigUpdate(void 0,!0).then(()=>{this.inputChangeListener.value=e.onWillDispose(()=>{this.searchWidget.setValue("")}),this.updateTreeScrollSync()}),await this.refreshInstalledExtensionsList()}}async refreshInstalledExtensionsList(){let e=await this.extensionManagementService.getInstalled();this.installedExtensionIds=e.filter(t=>t.manifest.contributes?.configuration).map(t=>t.identifier.id)}restoreCachedState(){let e=this.input&&this.editorMemento.loadEditorState(this.group,this.input);if(e&&typeof e.target=="object"&&(e.target=A.revive(e.target)),e){let t=e.target;this.settingsTargetsWidget.settingsTarget=t,this.viewState.settingsTarget=t,this.searchWidget.getValue()||this.searchWidget.setValue(e.searchQuery)}return this.input&&this.editorMemento.clearEditorState(this.input,this.group),e??null}getViewState(){return this.viewState}setOptions(e){super.setOptions(e),e&&this._setOptions(e)}_setOptions(e){e.focusSearch&&!dc&&this.focusSearch();let t=e.viewState?e.viewState:void 0,o=t?.query??e.query;o!==void 0&&(this.searchWidget.setValue(o),this.viewState.query=o);let n=e.folderUri??t?.settingsTarget??e.target;n&&this.settingsTargetsWidget.updateTarget(n)}clearInput(){this.inSettingsEditorContextKey.set(!1),super.clearInput()}layout(e){if(this.dimension=e,!this.isVisible())return;this.layoutSplitView(e);let o=Math.min(this.headerContainer.clientWidth,e.width)-48-10-this.controlsElement.clientWidth-12;this.searchWidget.layout(new si(o,20)),this.rootElement.classList.toggle("narrow-width",e.width<hd.NARROW_TOTAL_WIDTH)}focus(){if(super.focus(),this._currentFocusContext===0)dc||this.focusSearch();else if(this._currentFocusContext===3){let e=this.focusedSettingDOMElement;if(e){let t=e.querySelector(Md.CONTROL_SELECTOR);if(t){t.focus();return}}}else this._currentFocusContext===2?this.settingsTree.domFocus():this._currentFocusContext===1&&this.tocTree.domFocus()}setEditorVisible(e){super.setEditorVisible(e),e||setTimeout(()=>{this.searchWidget.onHide(),this.settingRenderers.cancelSuggesters()},0)}focusSettings(e=!1){if(this.settingsTree.getFocus().length||this.settingsTree.focusFirst(),this.settingsTree.domFocus(),e){let o=this.settingsTree.getHTMLElement().querySelector(`.focused ${Md.CONTROL_SELECTOR}`);o&&o.focus()}}focusTOC(){this.tocTree.domFocus()}showContextMenu(){let e=this.settingsTree.getFocus()[0],t=this.focusedSettingDOMElement;t&&e instanceof $w&&this.settingRenderers.showContextMenu(e,t)}focusSearch(e,t=!0){e&&this.searchWidget&&this.searchWidget.setValue(e),this.searchWidget.focus(t&&!this.searchInputDelayer.isTriggered)}clearSearchResults(){this.disableAiSearchToggle(),this.searchWidget.setValue(""),this.focusSearch()}clearSearchFilters(){let t=this.searchWidget.getValue().split(" ").filter(o=>o.length&&!hd.SUGGESTIONS.some(n=>o.startsWith(n)));this.searchWidget.setValue(t.join(" "))}updateInputAriaLabel(){let e=Gki;this.searchResultLabel&&(e+=`. ${this.searchResultLabel}`),this.lastSyncedLabel&&(e+=`. ${this.lastSyncedLabel}`),this.searchWidget.updateAriaLabel(e)}createHeader(e){this.headerContainer=M(e,GD(".settings-header")),this.searchContainer=M(this.headerContainer,GD(".search-container"));let t=this._register(new it(sHt,d(13077,null),q.asClassName(WMe),!1,async()=>this.clearSearchResults())),o=["action-label",q.asClassName(lpo)];this.showAiResultsAction=this._register(new it(Buo,nmo,o.join(" "),!0)),this._register(this.showAiResultsAction.onDidChange(async()=>{await this.onDidToggleAiSearch()}));let n=this._register(new it(Huo,d(13079,null),q.asClassName(cpo)));this.searchWidget=this._register(this.instantiationService.createInstance($A,`${hd.ID}.searchbox`,this.searchContainer,{triggerCharacters:["@",":"],provideResults:c=>{let u=c.split(/\s/g);return u[u.length-1].startsWith(`@${K0}`)?this.languageService.getRegisteredLanguageIds().map(h=>`@${K0}${h} `).sort().filter(h=>!c.includes(h)):u[u.length-1].startsWith(`@${NMe}`)?this.installedExtensionIds.map(h=>`@${NMe}${h} `).sort().filter(h=>!c.includes(h)):c===""||u[u.length-1].startsWith("@")?hd.SUGGESTIONS.filter(p=>!c.includes(p)).map(p=>p.endsWith(":")?p:p+" "):[]}},Gki,"settingseditor:searchinput"+hd.NUM_INSTANCES++,{placeholderText:Gki,focusContextKey:this.searchFocusContextKey,styleOverrides:{inputBorder:AT}})),this._register(this.searchWidget.onDidFocus(()=>{this._currentFocusContext=0})),this._register(this.searchWidget.onInputDidChange(()=>{let c=this.searchWidget.getValue();t.enabled=!!c,this.searchInputDelayer.trigger(()=>this.onSearchInputChanged(!0))}));let r=M(this.headerContainer,GD(".settings-header-controls"));r.style.borderColor=kt(dpo);let s=M(r,GD(".settings-target-container"));if(this.settingsTargetsWidget=this._register(this.instantiationService.createInstance(VMe,s,{enableRemoteSettings:!0})),this.settingsTargetsWidget.settingsTarget=3,this._register(this.settingsTargetsWidget.onDidTargetChange(c=>this.onDidSettingsTargetChange(c))),this._register(j(s,re.KEY_DOWN,c=>{new gi(c).keyCode===18&&this.focusSettings()})),this.userDataSyncWorkbenchService.enabled&&this.userDataSyncEnablementService.canToggleEnablement()){let c=this._register(this.instantiationService.createInstance(rtt,this.window,r));this._register(c.onDidChangeLastSyncedLabel(u=>{this.lastSyncedLabel=u,this.updateInputAriaLabel()}))}this.controlsElement=M(this.searchContainer,_(".search-container-widgets")),this.countElement=M(this.controlsElement,_(".settings-count-widget.monaco-count-badge.long")),this.searchInputActionBar=this._register(new Zi(this.controlsElement,{actionViewItemProvider:(c,u)=>{if(c.id===n.id)return this.instantiationService.createInstance(QMe,c,u,this.actionRunner,this.searchWidget);if(this.showAiResultsAction&&c.id===this.showAiResultsAction.id){let p=this.keybindingService.lookupKeybinding(aHt)?.getLabel();return new wce(null,c,{...u,keybinding:p,toggleStyles:gh})}}}));let l=[t,n];this.searchInputActionBar.push(l,{label:!1,icon:!0}),this.disableAiSearchToggle(),this.updateAiSearchToggleVisibility()}toggleAiSearch(){this.searchInputActionBar&&this.showAiResultsAction&&this.searchInputActionBar.hasAction(this.showAiResultsAction)&&(this.showAiResultsAction.enabled||qr(d(13083,null)),this.showAiResultsAction.checked=!this.showAiResultsAction.checked)}async onDidToggleAiSearch(){this.searchResultModel&&this.showAiResultsAction&&(this.searchResultModel.showAiResults=this.showAiResultsAction.checked??!1,this.renderResultCountMessages(!1),this.onDidFinishSearch(!0,void 0))}onDidSettingsTargetChange(e){this.viewState.settingsTarget=e,this.onConfigUpdate(void 0,!0)}onDidDismissExtensionSetting(e){this.dismissedExtensionSettings.includes(e)||this.dismissedExtensionSettings.push(e),this.storageService.store(this.DISMISSED_EXTENSION_SETTINGS_STORAGE_KEY,this.dismissedExtensionSettings.join(this.DISMISSED_EXTENSION_SETTINGS_DELIMITER),0,0),this.onConfigUpdate(void 0,!0)}onDidClickSetting(e,t){let o=this.currentSettingsModel?.getElementsByName(e.targetKey)?.[0],n=!1;if(o){let r=.5;try{let s=this.settingsTree.getRelativeTop(e.source);s!==null&&(r=s)}catch{}this.viewState.categoryFilter&&e.source.displayCategory!==o.displayCategory&&this.tocTree.setFocus([]);try{this.settingsTree.reveal(o,r)}catch{n=!0}if(!n){setTimeout(()=>{this.settingsTree.setFocus([o])},50);let s=this.settingRenderers.getDOMElementsForSettingKey(this.settingsTree.getHTMLElement(),e.targetKey);if(s&&s[0]){let l=s[0].querySelector(Md.CONTROL_SELECTOR);l&&l.focus()}}}if(!t&&(!o||n)){let r=`@id:${e.targetKey}`;this.searchWidget.setValue(r),this.searchInputDelayer.cancel(),this.triggerSearch(r,!0).then(()=>{this.onDidClickSetting(e,!0)})}}switchToSettingsFile(){let e=VHt(this.searchWidget.getValue()).query;return this.openSettingsFile({query:e})}async openSettingsFile(e){let t=this.settingsTargetsWidget.settingsTarget,o={jsonEditor:!0,groupId:this.group.id,...e};if(t===3){if(e?.revealSetting){let r=ne.as(Jt.Configuration).getConfigurationProperties()[e?.revealSetting.key]?.scope;if(r&&Kw.includes(r))return this.preferencesService.openApplicationSettings(o)}return this.preferencesService.openUserSettings(o)}else{if(t===4)return this.preferencesService.openRemoteSettings(o);if(t===5)return this.preferencesService.openWorkspaceSettings(o);if(A.isUri(t))return this.preferencesService.openFolderSettings({folderUri:t,...o})}}createBody(e){this.bodyContainer=M(e,GD(".settings-body")),this.noResultsMessage=M(this.bodyContainer,GD(".no-results-message")),this.noResultsMessage.innerText=d(13084,null),this.clearFilterLinkContainer=GD("span.clear-search-filters"),this.clearFilterLinkContainer.textContent=" - ";let t=M(this.clearFilterLinkContainer,GD("a.pointer.prominent",{tabindex:0},d(13078,null)));this._register(j(t,re.CLICK,r=>{Xt.stop(r,!1),this.clearSearchFilters()})),M(this.noResultsMessage,this.clearFilterLinkContainer),this.noResultsMessage.style.color=kt(Id),this.tocTreeContainer=GD(".settings-toc-container"),this.settingsTreeContainer=GD(".settings-tree-container"),this.createTOC(this.tocTreeContainer),this.createSettingsTree(this.settingsTreeContainer),this.splitView=this._register(new Ou(this.bodyContainer,{orientation:1,proportionalLayout:!0}));let o=this.storageService.getNumber("settingsEditor2.splitViewWidth",0,hd.TOC_RESET_WIDTH);this.splitView.addView({onDidChange:U.None,element:this.tocTreeContainer,minimumSize:hd.TOC_MIN_WIDTH,maximumSize:Number.POSITIVE_INFINITY,layout:(r,s,l)=>{this.tocTreeContainer.style.width=`${r}px`,this.tocTree.layout(l,r)}},o,void 0,!0),this.splitView.addView({onDidChange:U.None,element:this.settingsTreeContainer,minimumSize:hd.EDITOR_MIN_WIDTH,maximumSize:Number.POSITIVE_INFINITY,layout:(r,s,l)=>{this.settingsTreeContainer.style.width=`${r}px`,this.settingsTree.layout(l,r)}},Gl.Distribute,void 0,!0),this._register(this.splitView.onDidSashReset(()=>{let r=this.splitView.getViewSize(0)+this.splitView.getViewSize(1);this.splitView.resizeView(0,hd.TOC_RESET_WIDTH),this.splitView.resizeView(1,r-hd.TOC_RESET_WIDTH)})),this._register(this.splitView.onDidSashChange(()=>{let r=this.splitView.getViewSize(0);this.storageService.store("settingsEditor2.splitViewWidth",r,0,0)}));let n=this.theme.getColor(Ket);this.splitView.style({separatorBorder:n})}addCtrlAInterceptor(e){this._register(Jo(e,re.KEY_DOWN,t=>{t.keyCode===31&&(Ze?t.metaKey:t.ctrlKey)&&!Kh(t.target)&&(t.browserEvent.stopPropagation(),t.browserEvent.preventDefault())}))}createTOC(e){this.tocTreeModel=this.instantiationService.createInstance(ZMe,this.viewState),this.tocTree=this._register(this.instantiationService.createInstance(ePe,M(e,GD(".settings-toc-wrapper",{role:"navigation","aria-label":d(13089,null)})),this.viewState)),this.tocTreeDisposed=!1,this._register(this.tocTree.onDidFocus(()=>{this._currentFocusContext=1})),this._register(this.tocTree.onDidChangeFocus(t=>{let o=t.elements?.[0]??null;this.tocFocusedElement!==o&&(this.tocFocusedElement=o,this.tocTree.setSelection(o?[o]:[]),this.viewState.categoryFilter!==o&&(this.viewState.categoryFilter=o??void 0,this.renderTree(void 0,!0),this.settingsTree.scrollTop=0))})),this._register(this.tocTree.onDidFocus(()=>{this.tocRowFocused.set(!0)})),this._register(this.tocTree.onDidBlur(()=>{this.tocRowFocused.set(!1)})),this._register(this.tocTree.onDidDispose(()=>{this.tocTreeDisposed=!0}))}applyFilter(e){if(this.searchWidget&&!this.searchWidget.getValue().includes(e)){let t=`${e} ${this.searchWidget.getValue().trimStart()}`;this.focusSearch(t,!1)}}removeLanguageFilters(){if(this.searchWidget&&this.searchWidget.getValue().includes(`@${K0}`)){let t=this.searchWidget.getValue().split(" ").filter(o=>!o.startsWith(`@${K0}`)).join(" ");this.focusSearch(t,!1)}}createSettingsTree(e){this.settingRenderers=this._register(this.instantiationService.createInstance(XMe)),this._register(this.settingRenderers.onDidChangeSetting(t=>this.onDidChangeSetting(t.key,t.value,t.type,t.manualReset,t.scope))),this._register(this.settingRenderers.onDidDismissExtensionSetting(t=>this.onDidDismissExtensionSetting(t))),this._register(this.settingRenderers.onDidOpenSettings(t=>{this.openSettingsFile({revealSetting:{key:t,edit:!0}})})),this._register(this.settingRenderers.onDidClickSettingLink(t=>this.onDidClickSetting(t))),this._register(this.settingRenderers.onDidFocusSetting(t=>{this.settingsTree.setFocus([t]),this._currentFocusContext=3,this.settingRowFocused.set(!1)})),this._register(this.settingRenderers.onDidChangeSettingHeight(t=>{let{element:o,height:n}=t;try{this.settingsTree.updateElementHeight(o,n)}catch{}})),this._register(this.settingRenderers.onApplyFilter(t=>this.applyFilter(t))),this._register(this.settingRenderers.onDidClickOverrideElement(t=>{this.removeLanguageFilters(),t.language&&this.applyFilter(`@${K0}${t.language}`),t.scope==="workspace"?this.settingsTargetsWidget.updateTarget(5):t.scope==="user"?this.settingsTargetsWidget.updateTarget(3):t.scope==="remote"&&this.settingsTargetsWidget.updateTarget(4),this.applyFilter(`@${Vet}${t.settingKey}`)})),this.settingsTree=this._register(this.instantiationService.createInstance(JMe,e,this.viewState,this.settingRenderers.allRenderers)),this._register(this.settingsTree.onDidScroll(()=>{this.settingsTree.scrollTop!==this.settingsTreeScrollTop&&(this.settingsTreeScrollTop=this.settingsTree.scrollTop,setTimeout(()=>{this.updateTreeScrollSync()},0))})),this._register(this.settingsTree.onDidFocus(()=>{let t=e.ownerDocument.activeElement?.classList;t&&t.contains("monaco-list")&&t.contains("settings-editor-tree")&&(this._currentFocusContext=2,this.settingRowFocused.set(!0),this.treeFocusedElement??=this.settingsTree.firstVisibleElement??null,this.treeFocusedElement&&(this.treeFocusedElement.tabbable=!0))})),this._register(this.settingsTree.onDidBlur(()=>{this.settingRowFocused.set(!1),this.treeFocusedElement=null})),this._register(this.settingsTree.onDidChangeFocus(t=>{let o=t.elements[0];this.treeFocusedElement!==o&&(this.treeFocusedElement&&(this.treeFocusedElement.tabbable=!1),this.treeFocusedElement=o,this.treeFocusedElement&&(this.treeFocusedElement.tabbable=!0),this.settingsTree.setSelection(o?[o]:[]))}))}onDidChangeSetting(e,t,o,n,r){let l=VHt(this.searchWidget.getValue()).languageFilter;(n||this.pendingSettingUpdate&&this.pendingSettingUpdate.key!==e)&&this.updateChangedSetting(e,t,n,l,r),this.pendingSettingUpdate={key:e,value:t,languageFilter:l},hd.shouldSettingUpdateFast(o)?this.settingFastUpdateDelayer.trigger(()=>this.updateChangedSetting(e,t,n,l,r)):this.settingSlowUpdateDelayer.trigger(()=>this.updateChangedSetting(e,t,n,l,r))}updateTreeScrollSync(){this.settingRenderers.cancelSuggesters()}updateChangedSetting(e,t,o,n,r){let s=this.settingsTargetsWidget.settingsTarget,l=A.isUri(s)?s:void 0,c=(l?6:s)??3,u={resource:l,overrideIdentifiers:n?[n]:void 0},h=c===5||c===6||!!n,g=h?o:t===void 0,f=this.configurationService.inspect(e,u);return!h&&f.defaultValue===t&&(t=void 0),this.configurationService.updateValue(e,t,u,c,{handleDirtyFile:"save"}).then(()=>{let v=this.searchWidget.getValue();v.includes(`@${lG}`)&&this.refreshTOCTree(),this.renderTree(e,g),this.pendingSettingUpdate=null;let b={key:e,query:v,searchResults:this.searchResultModel?.getUniqueSearchResults()??null,rawResults:this.searchResultModel?.getRawResults()??null,showConfiguredOnly:!!this.viewState.tagFilters&&this.viewState.tagFilters.has(lG),isReset:typeof t>"u",settingsTarget:this.settingsTargetsWidget.settingsTarget};return this.reportModifiedSetting(b)})}reportModifiedSetting(e){let t,o,n,r;if(e.searchResults&&(r=e.searchResults.filterMatches.findIndex(c=>c.setting.key===e.key),this.searchResultModel)){o=e.searchResults.filterMatches.find(u=>u.setting.key===e.key)?.providerName;let c=this.searchResultModel.getRawResults();if(c[0]&&r>=0&&(t=c[0].filterMatches.some(p=>p.setting.key===e.key)?"local":"remote"),c[1]){let u=c[1].filterMatches.findIndex(p=>p.setting.key===e.key);n=u>=0?u:void 0}}let s=e.settingsTarget===3?"user":e.settingsTarget===4?"user_remote":e.settingsTarget===5?"workspace":"folder",l={key:e.key,groupId:t,providerName:o,nlpIndex:n,displayIndex:r,showConfiguredOnly:e.showConfiguredOnly,isReset:e.isReset,target:s};this.telemetryService.publicLog2("settingsEditor.settingModified",l)}scheduleRefresh(e,t=""){if(t&&this.scheduledRefreshes.has(t))return;t||(Be(this.scheduledRefreshes.values()),this.scheduledRefreshes.clear());let o=new N,n=qn(e);o.add(n),o.add(n.onDidBlur(()=>{this.scheduledRefreshes.get(t)?.dispose(),this.scheduledRefreshes.delete(t),this.onConfigUpdate(new Set([t]))})),this.scheduledRefreshes.set(t,o)}createSettingsOrderByTocIndex(e){let t=new Map;function o(n,r=0){if(n.settings)for(let s of n.settings)t.has(s.key)||t.set(s.key,r++);if(n.children)for(let s of n.children)r=o(s,r);return r}return o(e),t}refreshModels(e){this.settingsTreeModel.value.update(e),this.tocTreeModel.settingsTreeRoot=this.settingsTreeModel.value.root,this.settingsOrderByTocIndex=this.createSettingsOrderByTocIndex(e)}async onConfigUpdate(e,t=!1,o=!1){if(e&&this.settingsTreeModel)return this.updateElementsByKey(e);if(!this.defaultSettingsEditorModel)return;let n=this.defaultSettingsEditorModel.settingsGroups.slice(1),r=[],s=[];for(let b of n)b.extensionInfo?s.push(b):r.push(b);let l=this.canShowAdvancedSettings()?void 0:{exclude:{tags:[o8]}},c=Ppo(ett,r,l,this.logService),u=c.tree;if(c.leftoverSettings.size&&!this.hasWarnedMissingSettings){let b=[];c.leftoverSettings.forEach(S=>{b.push(S.key)}),this.logService.warn(`SettingsEditor2: Settings not included in settingsLayout.ts: ${b.join(", ")}`),this.hasWarnedMissingSettings=!0}let p=[],h=!1,g=await Juo(this.chatEntitlementService,this.extensionGalleryService,this.productService);if(g&&n.filter(b=>b.extensionInfo).length&&Object.keys(g.settingsEditorRecommendedExtensions).length){await this.refreshInstalledExtensionsList();for(let b in g.settingsEditorRecommendedExtensions){let S=g.recommendedExtensionsGalleryInfo[b];if(!S)continue;let y=S.identifier.id,w=this.installedExtensionIds.includes(y),k=n.findIndex(ae=>ae.extensionInfo&&ae.extensionInfo.id.toLowerCase()===y.toLowerCase()&&ae.sections.length===1&&ae.sections[0].settings.length===1&&ae.sections[0].settings[0].displayExtensionId);if(w||this.dismissedExtensionSettings.includes(y)){k!==-1&&(n.splice(k,1),h=!0);continue}if(k!==-1)continue;let T=null;try{T=await vp(this.extensionGalleryService.getManifest(S,Se.None),cki)??null}catch{continue}if(T===null)continue;let P=T?.contributes?.configuration,O;Array.isArray(P)?P.length===1&&(O=P[0].title):O=P?.title;let V=g.settingsEditorRecommendedExtensions[b],H=S.displayName??S.name??y,G=`${b}.manageExtension`,$={range:Wg,key:G,keyRange:Wg,value:null,valueRange:Wg,description:[V.onSettingsEditorOpen?.descriptionOverride??S.description],descriptionIsMarkdown:!1,descriptionRanges:[],scope:4,type:"null",displayExtensionId:y,extensionGroupTitle:O??H,categoryLabel:"Extensions",title:H},J={sections:[{settings:[$]}],id:y,title:$.extensionGroupTitle,titleRange:Wg,range:Wg,extensionInfo:{id:y,displayName:S.displayName}};n.push(J),p.push(J),h=!0}}if(u.children.push(await Npo(this.extensionService,s,l)),u.children.unshift(Cpo(n)),g&&h&&this.defaultSettingsEditorModel.setAdditionalGroups(p),!this.workspaceTrustManagementService.isWorkspaceTrusted()&&(this.viewState.settingsTarget instanceof A||this.viewState.settingsTarget===5)){let b=Apo(n,this.viewState.settingsTarget,this.viewState.languageFilter,this.configurationService);b.length&&u.children.unshift({id:"workspaceTrust",label:d(13090,null),settings:b})}this.searchResultModel?.updateChildren();let f=this.settingsTree.firstVisibleElement,v;if(f instanceof $w?v=f.setting.key:f instanceof sv&&(v=f.id),this.settingsTreeModel.value){if(this.refreshModels(u),o&&this.searchResultModel)return await this.onSearchInputChanged(!1);if(this.refreshTOCTree(),this.renderTree(void 0,t),v){let b=this.settingsTreeModel.value,S,y=b.getElementsByName(v);if(y&&y.length>0)S=y[0];else{let w=k=>{for(let T of k){if(T.id===v)return T;if(T.children){for(let P of T.children)if(P instanceof sv){let O=w([P]);if(O)return O}}}};S=w([b.root])}if(S)try{this.settingsTree.reveal(S,0)}catch{}}}else if(this.settingsTreeModel.value=this.instantiationService.createInstance(Kme,this.viewState,this.workspaceTrustManagementService.isWorkspaceTrusted()),this.refreshModels(u),(this.viewState.query?void 0:this.restoreCachedState())?.searchQuery||this.searchWidget.getValue())await this.onSearchInputChanged(!0);else{this.refreshTOCTree();let S=this.settingsTreeModel.value.root.children;if(Array.isArray(S)&&S.length>0){let y=S[0];y instanceof sv&&(this.viewState.categoryFilter=y,this.tocTree.setFocus([y]),this.tocTree.setSelection([y]))}this.refreshTree(),this.tocTree.collapseAll()}}updateElementsByKey(e){e.size?(this.searchResultModel&&e.forEach(t=>this.searchResultModel.updateElementsByName(t)),this.settingsTreeModel.value&&e.forEach(t=>this.settingsTreeModel.value.updateElementsByName(t)),e.forEach(t=>this.renderTree(t))):this.renderTree()}getActiveControlInSettingsTree(){let e=this.settingsTree.getHTMLElement(),t=e.ownerDocument.activeElement;return t&&Gr(e)?t:null}renderTree(e,t=!1){if(!t&&e&&this.scheduledRefreshes.has(e)){this.updateModifiedLabelForKey(e);return}if(this.contextViewFocused()){let r=this.window.document.querySelector(".context-view");r&&this.scheduleRefresh(r,e);return}let o=this.getActiveControlInSettingsTree(),n=o&&this.settingRenderers.getSettingDOMElementForDOMElement(o);if(n&&!t)if(e){if(n.getAttribute(Md.SETTING_KEY_ATTR)===e&&n.parentElement&&!n.parentElement.classList.contains("setting-item-list")){this.updateModifiedLabelForKey(e),this.scheduleRefresh(n,e);return}}else{this.scheduleRefresh(n);return}if(this.renderResultCountMessages(!1),e){let r=this.currentSettingsModel?.getElementsByName(e);if(r?.length)r.length>=2&&console.warn("More than one setting with key "+e+" found"),this.refreshSingleElement(r[0]);else return}else this.refreshTree()}contextViewFocused(){return!!Cg(this.rootElement.ownerDocument.activeElement,"context-view")}refreshSingleElement(e){this.isVisible()&&this.settingsTree.hasElement(e)&&(!e.setting.deprecationMessage||e.isConfigured)&&this.settingsTree.rerender(e)}refreshTree(){this.isVisible()&&this.currentSettingsModel&&this.settingsTree.setChildren(null,rmo(this.currentSettingsModel.root))}refreshTOCTree(){this.isVisible()&&(this.tocTreeModel.update(),this.tocTree.setChildren(null,Kki(this.tocTreeModel,this.tocTree)))}updateModifiedLabelForKey(e){if(!this.currentSettingsModel)return;let t=this.currentSettingsModel.getElementsByName(e),o=t&&t[0]&&t[0].isConfigured,n=this.settingRenderers.getDOMElementsForSettingKey(this.settingsTree.getHTMLElement(),e);n&&n[0]&&n[0].classList.toggle("is-configured",!!o)}async onSearchInputChanged(e){if(!this.currentSettingsModel)return;let t=this.searchWidget.getValue().trim();this.viewState.query=t,await this.triggerSearch(t.replace(/\u203A/g," "),e)}parseSettingFromJSON(e){let t=e.match(/"([a-zA-Z.]+)": /);return t&&t[1]}toggleTocBySearchBehaviorType(){this.configurationService.getValue(omo)==="hide"?(this.splitView.setViewVisible(0,!1),this.splitView.style({separatorBorder:We.transparent})):this.layoutSplitView(this.dimension)}async triggerSearch(e,t){let o=this.editorProgressService.show(!0,800),n=this.viewState.tagFilters?.has(o8);if(this.viewState.tagFilters=new Set,this.viewState.extensionFilters=new Set,this.viewState.featureFilters=new Set,this.viewState.idFilters=new Set,this.viewState.languageFilter=void 0,e){let r=VHt(e);e=r.query,r.tags.forEach(s=>this.viewState.tagFilters.add(s)),r.extensionFilters.forEach(s=>this.viewState.extensionFilters.add(s)),r.featureFilters.forEach(s=>this.viewState.featureFilters.add(s)),r.idFilters.forEach(s=>this.viewState.idFilters.add(s)),this.viewState.languageFilter=r.languageFilter}n!==this.viewState.tagFilters?.has(o8)&&await this.onConfigUpdate(),this.settingsTargetsWidget.updateLanguageFilterIndicators(this.viewState.languageFilter),e&&e!=="@"?(e=this.parseSettingFromJSON(e)||e,await this.triggerFilterPreferences(e,t,o),this.toggleTocBySearchBehaviorType()):(this.viewState.tagFilters.size||this.viewState.extensionFilters.size||this.viewState.featureFilters.size||this.viewState.idFilters.size||this.viewState.languageFilter?this.searchResultModel=this.createFilterModel():this.searchResultModel=null,this.searchDelayer.cancel(),this.searchInProgress&&(this.searchInProgress.dispose(!0),this.searchInProgress=null),t&&(this.tocTree.setFocus([]),this.viewState.categoryFilter=void 0),this.tocTreeModel.currentSearchModel=this.searchResultModel,this.searchResultModel?(t&&(this.tocTree.setSelection([]),this.tocTree.expandAll()),this.refreshTOCTree(),this.renderResultCountMessages(!1),this.refreshTree(),this.toggleTocBySearchBehaviorType()):this.tocTreeDisposed||(this.tocTree.collapseAll(),this.refreshTOCTree(),this.renderResultCountMessages(!1),this.refreshTree(),this.layoutSplitView(this.dimension)),o.done())}createFilterModel(){let e=this.instantiationService.createInstance(Gme,this.viewState,this.settingsOrderByTocIndex,this.workspaceTrustManagementService.isWorkspaceTrusted()),t={filterMatches:[],exactMatch:!1},o=this.canShowAdvancedSettings();for(let n of this.defaultSettingsEditorModel.settingsGroups.slice(1))for(let r of n.sections)for(let s of r.settings)!o&&!this.shouldShowSetting(s)||t.filterMatches.push({setting:s,matches:[],matchType:0,keyMatchScore:0,score:0,providerName:Xuo});return e.setResult(0,t),e}async triggerFilterPreferences(e,t,o){this.searchInProgress&&(this.searchInProgress.dispose(!0),this.searchInProgress=null);let n=this.searchInProgress=new Ye;return this.searchDelayer.trigger(async()=>{if(n.token.isCancellationRequested)return;this.disableAiSearchToggle();let r=await this.doLocalSearch(e,n.token);!this.searchResultModel||n.token.isCancellationRequested||(this.searchResultModel.showAiResults=!1,r&&r.filterMatches.length>0&&this.onDidFinishSearch(t,void 0),(!r||!r.exactMatch)&&await this.doRemoteSearch(e,n.token),!n.token.isCancellationRequested&&(this.aiSearchPromise&&this.aiSearchPromise.cancel(),this.searchInputActionBar&&this.showAiResultsAction&&this.searchInputActionBar.hasAction(this.showAiResultsAction)&&(this.aiSearchPromise=Ln(s=>this.doAiSearch(e,s).then(l=>{l&&this.showAiResultsAction&&(this.showAiResultsAction.enabled=!0,this.aiResultsAvailable.set(!0),this.showAiResultsAction.label=EXo,this.renderResultCountMessages(!0))}).catch(l=>{ao(l)||this.logService.trace("Error during AI settings search:",l)}))),this.onDidFinishSearch(t,o)))})}onDidFinishSearch(e,t){this.tocTreeModel.currentSearchModel=this.searchResultModel,e&&(this.tocTree.setFocus([]),this.viewState.categoryFilter=void 0,this.tocTree.expandAll(),this.settingsTree.scrollTop=0),this.refreshTOCTree(),this.renderTree(void 0,!0),t?.done()}doLocalSearch(e,t){let o=this.preferencesSearchService.getLocalSearchProvider(e);return this.searchWithProvider(0,o,xHt,t)}doRemoteSearch(e,t){let o=this.preferencesSearchService.getRemoteSearchProvider(e);return o?this.searchWithProvider(1,o,kHt,t):Promise.resolve(null)}async doAiSearch(e,t){let o=this.preferencesSearchService.getAiSearchProvider(e);if(!o)return null;let n=await this.searchWithProvider(3,o,EHt,t);if(!n||t.isCancellationRequested)return null;let r=await this.getLLMRankedResults(e,t);return t.isCancellationRequested?null:{filterMatches:n.filterMatches.concat(r?.filterMatches??[]),exactMatch:!1}}async getLLMRankedResults(e,t){let o=this.preferencesSearchService.getAiSearchProvider(e);if(!o)return null;let n=new Dn(!1),r=await o.getLLMRankedResults(t);if(n.stop(),t.isCancellationRequested)return null;if(r&&r.filterMatches.length>0){let s=n.elapsed();this.logSearchPerformance(THt,s)}return this.searchResultModel.setResult(4,r),r}async searchWithProvider(e,t,o,n){let r=new Dn(!1),s=await this._searchPreferencesModel(this.defaultSettingsEditorModel,t,n);if(r.stop(),n.isCancellationRequested)return null;if(s&&!this.canShowAdvancedSettings()&&(s.filterMatches=s.filterMatches.filter(l=>this.shouldShowSetting(l.setting))),s&&s.filterMatches.length>0){let l=r.elapsed();this.logSearchPerformance(o,l)}return this.searchResultModel??=this.instantiationService.createInstance(Gme,this.viewState,this.settingsOrderByTocIndex,this.workspaceTrustManagementService.isWorkspaceTrusted()),this.searchResultModel.setResult(e,s),s}logSearchPerformance(e,t){this.telemetryService.publicLog2("settingsEditor.searchPerformance",{providerName:e,elapsedMs:t})}renderResultCountMessages(e){if(this.currentSettingsModel)if(this.clearFilterLinkContainer.style.display=this.viewState.tagFilters&&this.viewState.tagFilters.size>0?"initial":"none",this.searchResultModel){let t=this.searchResultModel.getUniqueResultsCount(),o;if(e)switch(t){case 0:o=d(13085,null);break;case 1:o=d(13087,null);break;default:o=d(13082,null,t)}else switch(t){case 0:o=d(13084,null);break;case 1:o=d(13086,null);break;default:o=d(13081,null,t)}this.searchResultLabel=o,this.updateInputAriaLabel(),this.countElement.innerText=o,qr(o),this.countElement.style.display!=="block"&&(this.countElement.style.display="block"),this.layout(this.dimension),this.rootElement.classList.toggle("no-results",t===0),this.splitView.el.style.visibility=t===0?"hidden":"visible"}else{this.countElement.style.display!=="none"&&(this.searchResultLabel=null,this.updateInputAriaLabel(),this.countElement.style.display="none",this.countElement.innerText="",this.layout(this.dimension)),this.rootElement.classList.remove("no-results"),this.splitView.el.style.visibility="visible";return}}async _searchPreferencesModel(e,t,o){try{return await t.searchModel(e,o)}catch(n){return ao(n)?Promise.reject(n):null}}layoutSplitView(e){if(!this.isVisible())return;let t=e.height-97;if(this.splitView.el.style.height=`${t}px`,this.splitView.layout(this.bodyContainer.clientWidth,t),!(this.configurationService.getValue(omo)==="hide"&&this.searchResultModel)){let r=this.splitView.isViewVisible(0),s=this.bodyContainer.clientWidth>=hd.NARROW_TOTAL_WIDTH;this.splitView.setViewVisible(0,s),!r&&s&&this.bodyContainer.clientWidth>=hd.EDITOR_MIN_WIDTH+hd.TOC_RESET_WIDTH&&this.splitView.resizeView(0,hd.TOC_RESET_WIDTH),this.splitView.style({separatorBorder:s?this.theme.getColor(Ket):We.transparent})}}saveState(){if(this.isVisible()){let e=this.searchWidget.getValue().trim(),t=this.settingsTargetsWidget.settingsTarget;this.input&&this.editorMemento.saveEditorState(this.group,this.input,{searchQuery:e,target:t})}else this.input&&this.editorMemento.clearEditorState(this.input,this.group);super.saveState()}};hd=I([m(1,Te),m(2,fg),m(3,Fn),m(4,Le),m(5,Go),m(6,F),m(7,rHt),m(8,se),m(9,X),m(10,ce),m(11,wt),m(12,SI),m(13,Fl),m(14,Nr),m(15,lt),m(16,_t),m(17,Cs),m(18,tt),m(19,fa),m(20,wd),m(21,ln),m(22,_e),m(23,rr)],hd);var rtt=class extends x{constructor(e,t,o,n,r,s){super();this.commandService=o;this.userDataSyncService=n;this.userDataSyncEnablementService=r;this._onDidChangeLastSyncedLabel=this._register(new E);this.onDidChangeLastSyncedLabel=this._onDidChangeLastSyncedLabel.event;let l=M(t,GD(".settings-right-controls")),c=M(l,GD(".turn-on-sync"));this.turnOnSyncButton=this._register(new Wi(c,{title:!0,...Qo})),this.lastSyncedLabel=M(l,GD(".last-synced-label")),vo(this.lastSyncedLabel),this.turnOnSyncButton.enabled=!0,this.turnOnSyncButton.label=d(13093,null),vo(this.turnOnSyncButton.element),this._register(this.turnOnSyncButton.onDidClick(async()=>{await this.commandService.executeCommand("workbench.userDataSync.actions.turnOn")})),this.updateLastSyncedTime(),this._register(this.userDataSyncService.onDidChangeLastSyncTime(()=>{this.updateLastSyncedTime()})),this._register(new FL).cancelAndSet(()=>this.updateLastSyncedTime(),60*1e3,e),this.update(),this._register(this.userDataSyncService.onDidChangeStatus(()=>{this.update()})),this._register(this.userDataSyncEnablementService.onDidChangeEnablement(()=>{this.update()}))}updateLastSyncedTime(){let e=this.userDataSyncService.lastSyncTime,t;if(typeof e=="number"){let o=ea(e,!0,void 0,!0);t=d(13080,null,o)}else t="";this.lastSyncedLabel.textContent=t,this._onDidChangeLastSyncedLabel.fire(t)}update(){this.userDataSyncService.status!=="uninitialized"&&(this.userDataSyncEnablementService.isEnabled()||this.userDataSyncService.status!=="idle"?(un(this.lastSyncedLabel),vo(this.turnOnSyncButton.element)):(vo(this.lastSyncedLabel),un(this.turnOnSyncButton.element)))}};rtt=I([m(2,ge),m(3,bI),m(4,Fl),m(5,Te)],rtt);var _Xo="settings.action.search",DXo="settings.action.focusSettingsFile",LXo="settings.action.focusSettingsFromSearch",RXo="settings.action.focusSettingsList",MXo="settings.action.focusTOC",PXo="settings.action.focusSettingControl",AXo="settings.action.focusLevelUp",NXo="settings.switchToJSON",OXo="settings.filterByOnline",FXo="settings.filterUntrusted",WXo="workbench.action.openSettings",VXo="settings.filterByTelemetry";ne.as(qo.EditorPane).registerEditorPane(Br.create(hd,hd.ID,d(13030,null)),[new Ft(VD)]);ne.as(qo.EditorPane).registerEditorPane(Br.create(r8,r8.ID,d(13019,null)),[new Ft(gee)]);var $ki=class{canSerialize(i){return!0}serialize(i){return""}deserialize(i){return i.createInstance(gee)}};ne.as(qo.EditorPane).registerEditorPane(Br.create(Ph,Ph.ID,d(12995,null)),[new Ft(WD)]);var jki=class{canSerialize(i){return!0}serialize(i){return""}deserialize(i){return i.createInstance(WD)}},Qki=class{canSerialize(i){return!0}serialize(i){return""}deserialize(i){return i.createInstance(VD)}};ne.as(qo.EditorFactory).registerEditorSerializer(gee.ID,$ki);ne.as(qo.EditorFactory).registerEditorSerializer(WD.ID,jki);ne.as(qo.EditorFactory).registerEditorSerializer(VD.ID,Qki);var stt=L(13013,"Open Settings (UI)"),BXo=L(13015,"Open User Settings (JSON)"),HXo=L(13002,"Open Application Settings (JSON)"),Ry=Ve.Preferences;function qki(a){return Wa(a)?a:void 0}function UXo(a){return Fe(a)?a:void 0}function Q0(a){xi(a)||(a={});let i={focusSearch:qki(a?.focusSearch),openToSide:qki(a?.openToSide),query:UXo(a?.query)};return Fe(a?.revealSetting?.key)&&(i={...i,revealSetting:{key:a.revealSetting.key,edit:qki(a.revealSetting?.edit)}}),i}var tPe=class extends x{constructor(e,t,o,n,r,s,l){super();this.environmentService=e;this.userDataProfileService=t;this.preferencesService=o;this.workspaceContextService=n;this.labelService=r;this.extensionService=s;this.userDataProfilesService=l;this.registerSettingsActions(),this.registerKeybindingsActions(),this.updatePreferencesEditorMenuItem(),this._register(n.onDidChangeWorkbenchState(()=>this.updatePreferencesEditorMenuItem())),this._register(n.onDidChangeWorkspaceFolders(()=>this.updatePreferencesEditorMenuItemForWorkspaceFolders()))}static{this.ID="workbench.contrib.preferencesActions"}registerSettingsActions(){this._register(W(class extends K{constructor(){super({id:WXo,title:{...L(13020,"Settings"),mnemonicTitle:d(12998,null)},keybinding:{weight:200,when:null,primary:2135},menu:[{id:D.GlobalActivity,group:"2_configuration",order:2},{id:D.MenubarPreferencesMenu,group:"2_configuration",order:2}]})}run(t,o){let n=typeof o=="string"?{query:o}:Q0(o);return t.get(Go).openSettings({...n})}})),this._register(W(class extends K{constructor(){super({id:"workbench.action.openSettings2",title:L(13013,"Open Settings (UI)"),category:Ry,f1:!0})}run(t,o){return o=Q0(o),t.get(Go).openSettings({jsonEditor:!1,...o})}})),this._register(W(class extends K{constructor(){super({id:"workbench.action.openSettingsJson",title:BXo,metadata:{description:L(13034,"Opens the JSON file containing the current user profile settings")},category:Ry,f1:!0})}run(t,o){return o=Q0(o),t.get(Go).openSettings({jsonEditor:!0,...o})}}));let e=this;this._register(W(class extends K{constructor(){super({id:"workbench.action.openApplicationSettingsJson",title:HXo,category:Ry,menu:{id:D.CommandPalette,when:C.notEquals(DYe.key,e.userDataProfilesService.defaultProfile.id)}})}run(t,o){return o=Q0(o),t.get(Go).openApplicationSettings({jsonEditor:!0,...o})}})),this._register(W(class extends K{constructor(){super({id:"workbench.action.openGlobalSettings",title:L(13009,"Open User Settings"),category:Ry,f1:!0})}run(t,o){return o=Q0(o),t.get(Go).openUserSettings(o)}})),this._register(W(class extends K{constructor(){super({id:"workbench.action.openRawDefaultSettings",title:L(13010,"Open Default Settings (JSON)"),category:Ry,f1:!0})}run(t){return t.get(Go).openRawDefaultSettings()}})),this._register(W(class extends K{constructor(){super({id:dG.ID,title:dG.LABEL,category:Ry,f1:!0})}run(t){return t.get(F).createInstance(dG,dG.ID,dG.LABEL.value).run()}})),this._register(W(class extends K{constructor(){super({id:"workbench.action.openWorkspaceSettings",title:L(13016,"Open Workspace Settings"),category:Ry,menu:{id:D.CommandPalette,when:za.notEqualsTo("empty")}})}run(t,o){return o=typeof o=="string"?{query:o}:Q0(o),t.get(Go).openWorkspaceSettings(o)}})),this._register(W(class extends K{constructor(){super({id:"workbench.action.openAccessibilitySettings",title:L(13001,"Open Accessibility Settings"),category:Ry,menu:{id:D.CommandPalette,when:za.notEqualsTo("empty")}})}async run(t){await t.get(Go).openSettings({jsonEditor:!1,query:"@tag:accessibility"})}})),this._register(W(class extends K{constructor(){super({id:"workbench.action.openWorkspaceSettingsFile",title:L(13017,"Open Workspace Settings (JSON)"),category:Ry,menu:{id:D.CommandPalette,when:za.notEqualsTo("empty")}})}run(t,o){return o=Q0(o),t.get(Go).openWorkspaceSettings({jsonEditor:!0,...o})}})),this._register(W(class extends K{constructor(){super({id:"workbench.action.openFolderSettings",title:L(13004,"Open Folder Settings"),category:Ry,menu:{id:D.CommandPalette,when:za.isEqualTo("workspace")}})}async run(t,o){let n=t.get(ge),r=t.get(Go),s=await n.executeCommand(rM);s&&(o=Q0(o),await r.openFolderSettings({folderUri:s.uri,...o}))}})),this._register(W(class extends K{constructor(){super({id:"workbench.action.openFolderSettingsFile",title:L(13006,"Open Folder Settings (JSON)"),category:Ry,menu:{id:D.CommandPalette,when:za.isEqualTo("workspace")}})}async run(t,o){let n=t.get(ge),r=t.get(Go),s=await n.executeCommand(rM);s&&(o=Q0(o),await r.openFolderSettings({folderUri:s.uri,jsonEditor:!0,...o}))}})),this._register(W(class extends K{constructor(){super({id:"_workbench.action.openFolderSettings",title:d(13005,null),category:Ry,menu:{id:D.ExplorerContext,group:"2_workspace",order:20,when:C.and(ux,Gd)}})}async run(t,o){if(A.isUri(o))await t.get(Go).openFolderSettings({folderUri:o});else{let n=t.get(ge),r=t.get(Go),s=await n.executeCommand(rM);s&&await r.openFolderSettings({folderUri:s.uri})}}})),this._register(W(class extends K{constructor(){super({id:OXo,title:d(12997,null),menu:{id:D.MenubarPreferencesMenu,group:"3_settings",order:1}})}run(t){let o=t.get(ee).activeEditorPane;o instanceof hd?o.focusSearch("@tag:usesOnlineServices"):t.get(Go).openSettings({jsonEditor:!1,query:"@tag:usesOnlineServices"})}})),this._register(W(class extends K{constructor(){super({id:aHt,precondition:KD,keybinding:{primary:2087,weight:100,when:uHt},category:Ry,f1:!0,title:L(13029,"Toggle AI Settings Search")})}run(t){let o=t.get(ee).activeEditorPane;o instanceof hd&&o.toggleAiSearch()}})),this._register(W(class extends K{constructor(){super({id:FXo,title:L(12994,"Show untrusted workspace settings")})}run(t){t.get(Go).openWorkspaceSettings({jsonEditor:!1,query:`@tag:${OMe}`})}})),this._register(W(class extends K{constructor(){super({id:VXo,title:d(12999,null)})}run(t){let o=t.get(ee).activeEditorPane;o instanceof hd?o.focusSearch("@tag:telemetry"):t.get(Go).openSettings({jsonEditor:!1,query:"@tag:telemetry"})}})),this.registerSettingsEditorActions(),this.extensionService.whenInstalledExtensionsRegistered().then(()=>{let t=this.environmentService.remoteAuthority,o=this.labelService.getHostLabel(Q.vscodeRemote,t)||t;this._register(W(class extends K{constructor(){super({id:"workbench.action.openRemoteSettings",title:L(13011,"Open Remote Settings ({0})",o),category:Ry,menu:{id:D.CommandPalette,when:yb.notEqualsTo("")}})}run(n,r){return r=Q0(r),n.get(Go).openRemoteSettings(r)}})),this._register(W(class extends K{constructor(){super({id:"workbench.action.openRemoteSettingsFile",title:L(13012,"Open Remote Settings (JSON) ({0})",o),category:Ry,menu:{id:D.CommandPalette,when:yb.notEqualsTo("")}})}run(n,r){return r=Q0(r),n.get(Go).openRemoteSettings({jsonEditor:!0,...r})}}))})}registerSettingsEditorActions(){function e(o){let n=o.get(ee).activeEditorPane;return n instanceof hd?n:null}function t(o){e(o)?.focusSearch()}this._register(W(class extends K{constructor(){super({id:_Xo,precondition:KD,keybinding:{primary:2084,weight:100,when:null},category:Ry,f1:!0,title:L(13024,"Focus Settings Search")})}run(o){t(o)}})),this._register(W(class extends K{constructor(){super({id:sHt,precondition:KD,keybinding:{primary:9,weight:100,when:Ame},category:Ry,f1:!0,title:L(13021,"Clear Settings Search Results")})}run(o){e(o)?.clearSearchResults()}})),this._register(W(class extends K{constructor(){super({id:DXo,precondition:C.and(Ame,Xn.Visible.toNegated()),keybinding:{primary:18,weight:100,when:null},title:d(13022,null)})}run(o){e(o)?.focusSettings()}})),this._register(W(class extends K{constructor(){super({id:LXo,precondition:C.and(Ame,Xn.Visible.toNegated()),keybinding:{primary:18,weight:200,when:null},title:d(13022,null)})}run(o){e(o)?.focusSettings()}})),this._register(W(class extends K{constructor(){super({id:RXo,precondition:C.and(KD,cHt),keybinding:{primary:3,weight:200,when:null},title:d(13026,null)})}run(o){let n=e(o);n instanceof hd&&n.focusSettings()}})),this._register(W(class extends K{constructor(){super({id:MXo,precondition:KD,f1:!0,keybinding:[{primary:15,weight:200,when:Wet}],category:Ry,title:L(13027,"Focus Settings Table of Contents")})}run(o){let n=e(o);n instanceof hd&&n.focusTOC()}})),this._register(W(class extends K{constructor(){super({id:PXo,precondition:C.and(KD,Wet),keybinding:{primary:3,weight:200},title:d(13025,null)})}run(o){let n=e(o);if(!(n instanceof hd))return;n.getContainer()?.ownerDocument.activeElement?.classList.contains("monaco-list")&&n.focusSettings(!0)}})),this._register(W(class extends K{constructor(){super({id:lHt,precondition:KD,keybinding:{primary:1091,weight:200,when:null},f1:!0,category:Ry,title:L(13028,"Show Setting Context Menu")})}run(o){let n=e(o);n instanceof hd&&n.showContextMenu()}})),this._register(W(class extends K{constructor(){super({id:AXo,precondition:C.and(KD,Ame.toNegated(),aki.toNegated()),keybinding:{primary:9,weight:200,when:null},f1:!0,category:Ry,title:L(13023,"Move Focus Up One Level")})}run(o){let n=e(o);n instanceof hd&&(n.currentFocusContext===3?n.focusSettings():n.currentFocusContext===2?n.focusTOC():n.currentFocusContext===1&&n.focusSearch())}}))}registerKeybindingsActions(){let e=this,t=L(13018,"Preferences"),o="workbench.action.openGlobalKeybindings";this._register(W(class extends K{constructor(){super({id:o,title:L(13007,"Open Keyboard Shortcuts"),shortTitle:d(12996,null),category:t,icon:n8,keybinding:{when:null,weight:200,primary:Vi(2089,2097)},menu:[{id:D.CommandPalette},{id:D.EditorTitle,when:Wo.Resource.isEqualTo(e.userDataProfileService.currentProfile.keybindingsResource.toString()),group:"navigation",order:1},{id:D.ModalEditorEditorTitle,when:Wo.Resource.isEqualTo(e.userDataProfileService.currentProfile.keybindingsResource.toString()),group:"navigation",order:1},{id:D.GlobalActivity,group:"2_configuration",order:4}]})}run(n,...r){let s=typeof r[0]=="string"?r[0]:void 0,l=Jee(n,r)?.id;return n.get(Go).openGlobalKeybindingSettings(!1,{query:s,groupId:l})}})),this._register(ve.appendMenuItem(D.MenubarPreferencesMenu,{command:{id:o,title:d(12996,null)},group:"2_configuration",order:4})),this._register(W(class extends K{constructor(){super({id:"workbench.action.openDefaultKeybindingsFile",title:L(13003,"Open Default Keyboard Shortcuts (JSON)"),category:t,menu:{id:D.CommandPalette}})}run(n){return n.get(Go).openDefaultKeybindingsFile()}})),this._register(W(class extends K{constructor(){super({id:"workbench.action.openGlobalKeybindingsFile",title:L(13008,"Open Keyboard Shortcuts (JSON)"),category:t,icon:n8,menu:[{id:D.CommandPalette},{id:D.EditorTitle,when:C.and(Bg),group:"navigation"},{id:D.ModalEditorEditorTitle,when:C.and(Bg),group:"navigation"}]})}run(n,...r){let s=Jee(n,r)?.id;return n.get(Go).openGlobalKeybindingSettings(!0,{groupId:s})}})),this._register(W(class extends K{constructor(){super({id:$uo,title:L(13031,"Show System Keybindings"),menu:[{id:D.EditorTitle,when:C.and(Bg),group:"1_keyboard_preferences_actions"}]})}run(n,...r){let l=Jee(n,r)?.activeEditorPane;l instanceof Ph&&l.search("@source:system")}})),this._register(W(class extends K{constructor(){super({id:Quo,title:L(13032,"Show Extension Keybindings"),menu:[{id:D.EditorTitle,when:C.and(Bg),group:"1_keyboard_preferences_actions"}]})}run(n,...r){let l=Jee(n,r)?.activeEditorPane;l instanceof Ph&&l.search("@source:extension")}})),this._register(W(class extends K{constructor(){super({id:juo,title:L(13033,"Show User Keybindings"),menu:[{id:D.EditorTitle,when:C.and(Bg),group:"1_keyboard_preferences_actions"}]})}run(n,...r){let l=Jee(n,r)?.activeEditorPane;l instanceof Ph&&l.search("@source:user")}})),this._register(W(class extends K{constructor(){super({id:pHt,title:d(12991,null),keybinding:{weight:200,when:C.and(Bg,PMe,dHt),primary:9}})}run(n){let r=n.get(ee).activeEditorPane;r instanceof Ph&&r.clearSearchResults()}})),this._register(W(class extends K{constructor(){super({id:zuo,title:d(12992,null),category:t,menu:[{id:D.CommandPalette,when:C.and(Bg)}]})}run(n){let r=n.get(ee).activeEditorPane;r instanceof Ph&&r.clearKeyboardShortcutSearchHistory()}})),this.registerKeybindingEditorActions()}registerKeybindingEditorActions(){let e=this;Ct.registerCommandAndKeybindingRule({id:AMe,weight:200,when:C.and(Bg,z0,Nme.toNegated()),primary:3,handler:(n,r)=>{let s=n.get(ee).activeEditorPane;s instanceof Ph&&s.defineKeybinding(s.activeKeybindingEntry,!1)}}),Ct.registerCommandAndKeybindingRule({id:gHt,weight:200,when:C.and(Bg,z0),primary:Vi(2089,2079),handler:(n,r)=>{let s=n.get(ee).activeEditorPane;s instanceof Ph&&s.defineKeybinding(s.activeKeybindingEntry,!0)}}),Ct.registerCommandAndKeybindingRule({id:fHt,weight:200,when:C.and(Bg,z0),primary:Vi(2089,2083),handler:(n,r)=>{let s=n.get(ee).activeEditorPane;s instanceof Ph&&s.activeKeybindingEntry.keybindingItem.keybinding&&s.defineWhenExpression(s.activeKeybindingEntry)}}),Ct.registerCommandAndKeybindingRule({id:vHt,weight:200,when:C.and(Bg,z0,ig.toNegated()),primary:20,mac:{primary:2049},handler:(n,r)=>{let s=n.get(ee).activeEditorPane;s instanceof Ph&&s.removeKeybinding(s.activeKeybindingEntry)}}),Ct.registerCommandAndKeybindingRule({id:bHt,weight:200,when:C.and(Bg,z0),primary:0,handler:(n,r)=>{let s=n.get(ee).activeEditorPane;s instanceof Ph&&s.resetKeybinding(s.activeKeybindingEntry)}}),Ct.registerCommandAndKeybindingRule({id:Uuo,weight:200,when:C.and(Bg),primary:2084,handler:(n,r)=>{let s=n.get(ee).activeEditorPane;s instanceof Ph&&s.focusSearch()}}),Ct.registerCommandAndKeybindingRule({id:mHt,weight:200,when:C.and(Bg,PMe),primary:553,mac:{primary:2601},handler:(n,r)=>{let s=n.get(ee).activeEditorPane;s instanceof Ph&&s.recordSearchKeys()}}),Ct.registerCommandAndKeybindingRule({id:hHt,weight:200,when:C.and(Bg),primary:558,mac:{primary:2606},handler:(n,r)=>{let s=n.get(ee).activeEditorPane;s instanceof Ph&&s.toggleSortByPrecedence()}}),Ct.registerCommandAndKeybindingRule({id:wHt,weight:200,when:C.and(Bg,z0),primary:0,handler:(n,r)=>{let s=n.get(ee).activeEditorPane;s instanceof Ph&&s.showSimilarKeybindings(s.activeKeybindingEntry)}}),Ct.registerCommandAndKeybindingRule({id:SHt,weight:200,when:C.and(Bg,z0,Nme.negate()),primary:2081,handler:async(n,r)=>{let s=n.get(ee).activeEditorPane;s instanceof Ph&&await s.copyKeybinding(s.activeKeybindingEntry)}}),Ct.registerCommandAndKeybindingRule({id:IHt,weight:200,when:C.and(Bg,z0),primary:0,handler:async(n,r)=>{let s=n.get(ee).activeEditorPane;s instanceof Ph&&await s.copyKeybindingCommand(s.activeKeybindingEntry)}}),Ct.registerCommandAndKeybindingRule({id:yHt,weight:200,when:C.and(Bg,z0),primary:0,handler:async(n,r)=>{let s=n.get(ee).activeEditorPane;s instanceof Ph&&await s.copyKeybindingCommandTitle(s.activeKeybindingEntry)}}),Ct.registerCommandAndKeybindingRule({id:quo,weight:200,when:C.and(Bg,PMe),primary:2066,handler:(n,r)=>{let s=n.get(ee).activeEditorPane;s instanceof Ph&&s.focusKeybindings()}}),Ct.registerCommandAndKeybindingRule({id:Guo,weight:200,when:C.and(Bg,Nme,Xn.Visible.toNegated()),primary:9,handler:async(n,r)=>{let s=n.get(ee).activeEditorPane;s instanceof Ph&&s.rejectWhenExpression(s.activeKeybindingEntry)}}),Ct.registerCommandAndKeybindingRule({id:Kuo,weight:200,when:C.and(Bg,Nme,Xn.Visible.toNegated()),primary:3,handler:async(n,r)=>{let s=n.get(ee).activeEditorPane;s instanceof Ph&&s.acceptWhenExpression(s.activeKeybindingEntry)}});let t=this._register(new N),o=()=>{t.clear(),t.add(W(class extends K{constructor(){let r=Wo.Resource.isEqualTo(e.userDataProfileService.currentProfile.keybindingsResource.toString());super({id:"editor.action.defineKeybinding",title:L(12993,"Define Keybinding"),f1:!0,precondition:r,keybinding:{weight:200,when:r,primary:Vi(2089,2089)},menu:{id:D.EditorContent,when:r}})}async run(r){let s=r.get(ee).activeTextEditorControl;pn(s)&&s.getContribution($Pt)?.showDefineKeybindingWidget()}}))};o(),this._register(this.userDataProfileService.onDidChangeCurrentProfile(()=>o()))}updatePreferencesEditorMenuItem(){let e="_workbench.openWorkspaceSettingsEditor";if(this.workspaceContextService.getWorkbenchState()===3&&!$e.getCommand(e)){$e.registerCommand(e,()=>this.preferencesService.openWorkspaceSettings({jsonEditor:!1}));let t=C.and(Wo.Resource.isEqualTo(this.preferencesService.workspaceSettingsResource.toString()),za.isEqualTo("workspace"),C.not("isInDiffEditor"));ve.appendMenuItem(D.EditorTitle,{command:{id:e,title:stt,icon:n8},when:t,group:"navigation",order:1}),ve.appendMenuItem(D.ModalEditorEditorTitle,{command:{id:e,title:stt,icon:n8},when:t,group:"navigation",order:1})}this.updatePreferencesEditorMenuItemForWorkspaceFolders()}updatePreferencesEditorMenuItemForWorkspaceFolders(){for(let e of this.workspaceContextService.getWorkspace().folders){let t=`_workbench.openFolderSettings.${e.uri.toString()}`;if(!$e.getCommand(t)){$e.registerCommand(t,(n,...r)=>{let s=Jee(n,r)?.id;return this.workspaceContextService.getWorkbenchState()===2?this.preferencesService.openWorkspaceSettings({jsonEditor:!1,groupId:s}):this.preferencesService.openFolderSettings({folderUri:e.uri,jsonEditor:!1,groupId:s})});let o=C.and(Wo.Resource.isEqualTo(this.preferencesService.getFolderSettingsResource(e.uri).toString()),C.not("isInDiffEditor"));ve.appendMenuItem(D.EditorTitle,{command:{id:t,title:stt,icon:n8},when:o,group:"navigation",order:1}),ve.appendMenuItem(D.ModalEditorEditorTitle,{command:{id:t,title:stt,icon:n8},when:o,group:"navigation",order:1})}}}};tPe=I([m(0,At),m(1,ln),m(2,Go),m(3,Pe),m(4,rt),m(5,lt),m(6,an)],tPe);var iPe=class extends x{constructor(e,t){super();this.userDataProfileService=e;this.userDataProfilesService=t;this.registerSettingsEditorTitleActions()}static{this.ID="workbench.contrib.settingsEditorTitleBarActions"}registerSettingsEditorTitleActions(){let e=this._register(new me),t=()=>{let n=C.and(KD.toNegated(),C.or(Wo.Resource.isEqualTo(this.userDataProfileService.currentProfile.settingsResource.toString()),Wo.Resource.isEqualTo(this.userDataProfilesService.defaultProfile.settingsResource.toString())),C.not("isInDiffEditor"));e.clear(),e.value=W(class extends K{constructor(){super({id:"_workbench.openUserSettingsEditor",title:stt,icon:n8,menu:[{id:D.EditorTitle,when:n,group:"navigation",order:1},{id:D.ModalEditorEditorTitle,when:n,group:"navigation",order:1}]})}run(r,...s){let l=Q0(s[0]),c=Jee(r,s)?.id;return r.get(Go).openUserSettings({jsonEditor:!1,...l,groupId:c})}})};t(),this._register(this.userDataProfileService.onDidChangeCurrentProfile(()=>{t()}));let o=C.and(aki.toNegated(),KD);this._register(W(class extends K{constructor(){super({id:NXo,title:L(13014,"Open Settings (JSON)"),icon:n8,menu:[{id:D.EditorTitle,when:o,group:"navigation",order:1},{id:D.ModalEditorEditorTitle,when:o,group:"navigation",order:1}]})}run(n,...r){let l=Jee(n,r)?.activeEditorPane;return l instanceof hd?l.switchToSettingsFile():null}}))}};iPe=I([m(0,ln),m(1,an)],iPe);var oPe=class extends x{constructor(e,t,o,n){super();this.editor=e;this.instantiationService=t;this.preferencesService=o;this.workspaceContextService=n;this.disposables=this._register(new N);this._createPreferencesRenderer(),this._register(this.editor.onDidChangeModel(r=>this._createPreferencesRenderer())),this._register(this.workspaceContextService.onDidChangeWorkbenchState(()=>this._createPreferencesRenderer()))}static{this.ID="editor.contrib.settings"}async _createPreferencesRenderer(){this.disposables.clear(),this.currentRenderer=void 0;let e=this.editor.getModel();if(e&&/\.(json|code-workspace)$/.test(e.uri.path)){let t=await this.preferencesService.createPreferencesEditorModel(e.uri);t instanceof rme&&this.editor.getModel()&&(this.disposables.add(t),t.configurationTarget===5?this.currentRenderer=this.disposables.add(this.instantiationService.createInstance(jMe,this.editor,t)):this.currentRenderer=this.disposables.add(this.instantiationService.createInstance(Ume,this.editor,t))),this.currentRenderer?.render()}}};oPe=I([m(1,F),m(2,Go),m(3,Pe)],oPe);function Jee(a,i){return Dp(i,a.get(ee),a.get(wt),a.get(Io)).groupedEditors[0]?.group}It(tPe.ID,tPe,St.BlockStartup);It(Fme.ID,Fme,St.BlockStartup);It(iPe.ID,iPe,St.AfterRestored);xo(oPe.ID,oPe,1);ve.appendMenuItem(D.MenubarFileMenu,{title:d(13000,null),submenu:D.MenubarPreferencesMenu,group:"5_autosave",order:2,when:rk.toNegated()});var YHt=class{static hasOpenBrace(i){for(;i.scan()!==17;)if(i.getToken()===1)return!0;return!1}static offsetToPosition(i,e){let t=0,o=i.getEOL().length,n=i.getLineCount();for(let r=1;r<=n;r++){let s=i.getLineLength(r)+o,l=t+s;if(l>e)return new ye(r,e-t+1);t=l}return new ye(n,i.getLineMaxColumn(n))}static insertSnippet(i,e){let t=i.getValueLengthInRange(new z(1,1,e.lineNumber,e.column)),o;(b=>(b[b.INVALID=0]="INVALID",b[b.AFTER_OBJECT=1]="AFTER_OBJECT",b[b.BEFORE_OBJECT=2]="BEFORE_OBJECT"))(o||={});let n=0,r=-1,s=0,l=yde(i.getValue()),c=0,u=0,p=(g,f)=>{f!==0&&c===1&&u===0?(n=f,r=g,s=f):n!==0&&(n=0,r=l.getTokenOffset())};for(;l.scan()!==17;){let g=l.getPosition(),f=l.getToken(),v=!1;switch(f){case 3:v=!0,c++,p(g,2);break;case 4:v=!0,c--,p(g,0);break;case 5:v=!0,p(g,2);break;case 1:v=!0,u++,p(g,0);break;case 2:v=!0,u--,p(g,1);break;case 15:case 14:v=!0}if(g>=t&&(n!==0||r!==-1)){let b,S;return n!==0?(b=v?g:l.getTokenOffset(),S=n):(b=r,S=s),S===1?{position:this.offsetToPosition(i,b),prepend:",",append:""}:(l.setPosition(b),{position:this.offsetToPosition(i,b),prepend:"",append:this.hasOpenBrace(l)?",":""})}}let h=i.getLineCount();return{position:new ye(h,i.getLineMaxColumn(h)),prepend:`
[`,append:"]"}}};var Zee=class extends rIe{constructor(i,e){if(super(),e.length===0)throw Yr("chords");this._os=i,this._chords=e}getLabel(){return cR.toLabel(this._os,this._chords,i=>this._getLabel(i))}getAriaLabel(){return swt.toLabel(this._os,this._chords,i=>this._getAriaLabel(i))}getElectronAccelerator(){return this._chords.length>1||this._chords[0].isDuplicateModifierCase()?null:N6i.toLabel(this._os,this._chords,i=>this._getElectronAccelerator(i))}getUserSettingsLabel(){return UCe.toLabel(this._os,this._chords,i=>this._getUserSettingsLabel(i))}isWYSIWYG(){return this._chords.every(i=>this._isWYSIWYG(i))}hasMultipleChords(){return this._chords.length>1}getChords(){return this._chords.map(i=>this._getChord(i))}_getChord(i){return new Rht(i.ctrlKey,i.shiftKey,i.altKey,i.metaKey,this._getLabel(i),this._getAriaLabel(i))}getDispatchChords(){return this._chords.map(i=>this._getChordDispatch(i))}getSingleModifierDispatchChords(){return this._chords.map(i=>this._getSingleModifierChordDispatch(i))}};var zXo=!1;function KXo(a){zXo&&console.info(a)}var ete=class extends Zee{constructor(i,e){super(1,e),this._mapper=i}_getLabel(i){return i.isDuplicateModifierCase()?"":this._mapper.getUILabelForKeyCode(i.keyCode)}_getUSLabelForKeybinding(i){return i.isDuplicateModifierCase()?"":Fp.toString(i.keyCode)}getUSLabel(){return cR.toLabel(this._os,this._chords,i=>this._getUSLabelForKeybinding(i))}_getAriaLabel(i){return i.isDuplicateModifierCase()?"":this._mapper.getAriaLabelForKeyCode(i.keyCode)}_getElectronAccelerator(i){return this._mapper.getElectronAcceleratorForKeyBinding(i)}_getUserSettingsLabel(i){if(i.isDuplicateModifierCase())return"";let e=this._mapper.getUserSettingsLabelForKeyCode(i.keyCode);return e&&e.toLowerCase()}_isWYSIWYG(i){return this.__isWYSIWYG(i.keyCode)}__isWYSIWYG(i){if(i===15||i===16||i===17||i===18)return!0;let e=this._mapper.getAriaLabelForKeyCode(i),t=this._mapper.getUserSettingsLabelForKeyCode(i);return e===t}_getChordDispatch(i){if(i.isModifierKey())return null;let e="";return i.ctrlKey&&(e+="ctrl+"),i.shiftKey&&(e+="shift+"),i.altKey&&(e+="alt+"),i.metaKey&&(e+="meta+"),e+=Fp.toString(i.keyCode),e}_getSingleModifierChordDispatch(i){return i.keyCode===5&&!i.shiftKey&&!i.altKey&&!i.metaKey?"ctrl":i.keyCode===4&&!i.ctrlKey&&!i.altKey&&!i.metaKey?"shift":i.keyCode===6&&!i.ctrlKey&&!i.shiftKey&&!i.metaKey?"alt":i.keyCode===57&&!i.ctrlKey&&!i.shiftKey&&!i.altKey?"meta":null}static getProducedCharCode(i,e){return e?i.ctrlKey&&i.shiftKey&&i.altKey?e.withShiftAltGr:i.ctrlKey&&i.altKey?e.withAltGr:i.shiftKey?e.withShift:e.value:null}static getProducedChar(i,e){let t=this.getProducedCharCode(i,e);return t===null||t.length===0?" --- ":"  "+t+"  "}},nPe=class{constructor(i,e,t){this._isUSStandard=i;this._mapAltGrToCtrlAlt=t;this._keyCodeToLabel=[];this._scanCodeToKeyCode=[],this._keyCodeToLabel=[],this._keyCodeExists=[],this._keyCodeToLabel[0]=Fp.toString(0);for(let s=0;s<193;s++){let l=Qy[s];l!==-1&&(this._scanCodeToKeyCode[s]=l,this._keyCodeToLabel[l]=Fp.toString(l),this._keyCodeExists[l]=!0)}let o=[],n=!1;this._codeInfo=[];for(let s in e)if(e.hasOwnProperty(s)){let l=Zb.toEnum(s);if(l===0){KXo(`Unknown scanCode ${s} in mapping.`);continue}let c=e[s],u=Qy[l];if(u!==-1){let S=Dht[c.vkey]||0;if(S===0||u===S||l!==134)continue}let p=c.value,h=c.withShift,g=c.withAltGr,f=c.withShiftAltGr,v=Dht[c.vkey]||0,b={scanCode:l,keyCode:v,value:p,withShift:h,withAltGr:g,withShiftAltGr:f};if(this._codeInfo[l]=b,this._scanCodeToKeyCode[l]=v,v===0)continue;if(this._keyCodeExists[v]=!0,p.length===0)this._keyCodeToLabel[v]=null;else if(p.length>1)this._keyCodeToLabel[v]=p;else{let S=p.charCodeAt(0);if(S>=97&&S<=122){let y=65+(S-97);o[y]=!0,n=!0,this._keyCodeToLabel[v]=String.fromCharCode(65+(S-97))}else S>=65&&S<=90?(o[S]=!0,n=!0,this._keyCodeToLabel[v]=p):this._keyCodeToLabel[v]=p}}let r=(s,l)=>{o[s]||(this._keyCodeToLabel[l]=String.fromCharCode(s))};if(r(65,31),r(66,32),r(67,33),r(68,34),r(69,35),r(70,36),r(71,37),r(72,38),r(73,39),r(74,40),r(75,41),r(76,42),r(77,43),r(78,44),r(79,45),r(80,46),r(81,47),r(82,48),r(83,49),r(84,50),r(85,51),r(86,52),r(87,53),r(88,54),r(89,55),r(90,56),!n){let s=(l,c)=>{this._keyCodeToLabel[l]=String.fromCharCode(c)};s(85,59),s(86,61),s(87,44),s(88,45),s(89,46),s(90,47),s(91,96),s(92,91),s(93,92),s(94,93),s(95,39)}}dumpDebugInfo(){let i=[],e=[88,104],t=0;i.push("-----------------------------------------------------------------------------------------------------------------------------------------");for(let o=0;o<193;o++){if(Qy[o]!==-1&&e.indexOf(o)===-1)continue;t%6===0&&(i.push("|       HW Code combination      |  Key  |    KeyCode combination    |          UI label         |        User settings       | WYSIWYG |"),i.push("-----------------------------------------------------------------------------------------------------------------------------------------")),t++;let n=this._codeInfo[o],r=Zb.toString(o),s=[0,2,5,7];for(let l of s){let c=!!(l&1),u=!!(l&2),p=!!(l&4),h=new EL(c,u,p,!1,o),g=this._resolveChord(h),f=g?Fp.toString(g.keyCode):null,v=g?new ete(this,[g]):null,b=`${c?"Ctrl+":""}${u?"Shift+":""}${p?"Alt+":""}${r}`,S=v?v.getAriaLabel():null,y=S?S.replace(/Control\+/,"Ctrl+"):null,w=v?v.getUserSettingsLabel():null,k=ete.getProducedChar(h,n),T=f?`${c?"Ctrl+":""}${u?"Shift+":""}${p?"Alt+":""}${f}`:null,O=(v?v.isWYSIWYG():!1)?"       ":"   NO  ";i.push(`| ${this._leftPad(b,30)} | ${k} | ${this._leftPad(T,25)} | ${this._leftPad(y,25)} |  ${this._leftPad(w,25)} | ${O} |`)}i.push("-----------------------------------------------------------------------------------------------------------------------------------------")}return i.join(`
`)}_leftPad(i,e){for(i===null&&(i="null");i.length<e;)i=" "+i;return i}getUILabelForKeyCode(i){return this._getLabelForKeyCode(i)}getAriaLabelForKeyCode(i){return this._getLabelForKeyCode(i)}getUserSettingsLabelForKeyCode(i){return this._isUSStandard?Fp.toUserSettingsUS(i):Fp.toUserSettingsGeneral(i)}getElectronAcceleratorForKeyBinding(i){return Fp.toElectronAccelerator(i.keyCode)}_getLabelForKeyCode(i){return this._keyCodeToLabel[i]||Fp.toString(0)}resolveKeyboardEvent(i){let e=i.ctrlKey||this._mapAltGrToCtrlAlt&&i.altGraphKey,t=i.altKey||this._mapAltGrToCtrlAlt&&i.altGraphKey,o=new eS(e,i.shiftKey,t,i.metaKey,i.keyCode);return new ete(this,[o])}_resolveChord(i){if(!i)return null;if(i instanceof eS)return this._keyCodeExists[i.keyCode]?i:null;let e=this._scanCodeToKeyCode[i.scanCode]||0;return e===0||!this._keyCodeExists[e]?null:new eS(i.ctrlKey,i.shiftKey,i.altKey,i.metaKey,e)}resolveKeybinding(i){let e=MRe(i.chords.map(t=>this._resolveChord(t)));return e.length>0?[new ete(this,e)]:[]}};var GXo=d(12984,null),att=class extends x{constructor(e,t,o){super();this._editor=e;this._instantiationService=t;this._userDataProfileService=o;this._keybindingDecorationRenderer=this._register(new me);this._defineWidget=this._register(this._instantiationService.createInstance(Wee,this._editor)),this._register(this._editor.onDidChangeModel(n=>this._update())),this._update()}_update(){this._keybindingDecorationRenderer.value=smo(this._editor,this._userDataProfileService)?this._instantiationService.createInstance(Yme,this._editor):void 0}showDefineKeybindingWidget(){smo(this._editor,this._userDataProfileService)&&this._defineWidget.start().then(e=>this._onAccepted(e))}_onAccepted(e){if(this._editor.focus(),e&&this._editor.hasModel()){new RegExp(/\\/g).test(e)&&(e=e.slice(0,-1)+"\\\\");let n=["{",'	"key": '+JSON.stringify(e)+",",'	"command": "${1:commandId}",','	"when": "${2:editorTextFocus}"',"}$0"].join(`
`),r=YHt.insertSnippet(this._editor.getModel(),this._editor.getPosition());n=r.prepend+n+r.append,this._editor.setPosition(r.position),vs.get(this._editor)?.insert(n,{overwriteBefore:0,overwriteAfter:0})}}};att=I([m(1,F),m(2,ln)],att);var Yme=class extends x{constructor(e,t){super();this._editor=e;this._keybindingService=t;this._dec=this._editor.createDecorationsCollection(),this._updateDecorations=this._register(new Dt(()=>this._updateDecorationsNow(),500));let o=Ci(this._editor.getModel());this._register(o.onDidChangeContent(()=>this._updateDecorations.schedule())),this._register(this._keybindingService.onDidUpdateKeybindings(()=>this._updateDecorations.schedule())),this._register({dispose:()=>{this._dec.clear(),this._updateDecorations.cancel()}}),this._updateDecorations.schedule()}_updateDecorationsNow(){let e=Ci(this._editor.getModel()),t=[],o=_R(e.getValue());if(o&&Array.isArray(o.children))for(let n=0,r=o.children.length;n<r;n++){let s=o.children[n],l=this._getDecorationForEntry(e,s);l!==null&&t.push(l)}this._dec.set(t)}_getDecorationForEntry(e,t){if(!Array.isArray(t.children))return null;for(let o=0,n=t.children.length;o<n;o++){let r=t.children[o];if(r.type!=="property"||!Array.isArray(r.children)||r.children.length!==2||r.children[0].value!=="key")continue;let l=r.children[1];if(l.type!=="string")continue;let c=this._keybindingService.resolveUserBinding(l.value);if(c.length===0)return this._createDecoration(!0,null,null,e,l);let u=c[0],p=null;if(u instanceof ete&&(p=u.getUSLabel()),!u.isWYSIWYG()){let g=u.getLabel();return typeof g=="string"&&l.value.toLowerCase()===g.toLowerCase()?null:this._createDecoration(!1,u.getLabel(),p,e,l)}if(/abnt_|oem_/.test(l.value))return this._createDecoration(!1,u.getLabel(),p,e,l);let h=u.getUserSettingsLabel();return typeof h=="string"&&!Yme._userSettingsFuzzyEquals(l.value,h)?this._createDecoration(!1,u.getLabel(),p,e,l):null}return null}static _userSettingsFuzzyEquals(e,t){if(e=e.trim().toLowerCase(),t=t.trim().toLowerCase(),e===t)return!0;let o=L0.parseKeybinding(e),n=L0.parseKeybinding(t);return o===null&&n===null?!0:!o||!n?!1:o.equals(n)}_createDecoration(e,t,o,n,r){let s,l,c;e?(s=new Ie().appendText(GXo),l="keybindingError",c=Xs(ywe)):(o&&t!==o?s=new Ie(d(12985,null,t,o)):s=new Ie(d(12986,null,t)),l="keybindingInfo",c=Xs(wwe));let u=n.getPositionAt(r.offset),p=n.getPositionAt(r.offset+r.length);return{range:new z(u.lineNumber,u.column,p.lineNumber,p.column),options:{description:"keybindings-widget",stickiness:1,className:l,hoverMessage:s,overviewRuler:{color:c,position:4}}}}};Yme=I([m(1,_e)],Yme);function smo(a,i){let e=a.getModel();return e?Qe(e.uri,i.currentProfile.keybindingsResource):!1}xo($Pt,att,1);function qXo(a){let i=new Map;for(let e of a)i.set(e,(i.get(e)??0)+1);return i}var rPe=class a{constructor(){this.chunkCount=0;this.chunkOccurrences=new Map;this.documents=new Map}calculateScores(i,e){let t=this.computeEmbedding(i),o=new Map,n=[];for(let[r,s]of this.documents){if(e.isCancellationRequested)return[];for(let l of s.chunks){let c=this.computeSimilarityScore(l,t,o);c>0&&n.push({key:r,score:c})}}return n}static termFrequencies(i){return qXo(a.splitTerms(i))}static*splitTerms(i){let e=t=>t.toLowerCase();for(let[t]of i.matchAll(/\b\p{Letter}[\p{Letter}\d]{2,}\b/gu)){yield e(t);let o=t.replace(/([a-z])([A-Z])/g,"$1 $2").split(/\s+/g);if(o.length>1)for(let n of o)n.length>2&&/\p{Letter}{3,}/gu.test(n)&&(yield e(n))}}updateDocuments(i){for(let{key:e}of i)this.deleteDocument(e);for(let e of i){let t=[];for(let o of e.textChunks){let n=a.termFrequencies(o);for(let r of n.keys())this.chunkOccurrences.set(r,(this.chunkOccurrences.get(r)??0)+1);t.push({text:o,tf:n})}this.chunkCount+=t.length,this.documents.set(e.key,{chunks:t})}return this}deleteDocument(i){let e=this.documents.get(i);if(e){this.documents.delete(i),this.chunkCount-=e.chunks.length;for(let t of e.chunks)for(let o of t.tf.keys()){let n=this.chunkOccurrences.get(o);if(typeof n=="number"){let r=n-1;r<=0?this.chunkOccurrences.delete(o):this.chunkOccurrences.set(o,r)}}}}computeSimilarityScore(i,e,t){let o=0;for(let[n,r]of Object.entries(e)){let s=i.tf.get(n);if(!s)continue;let l=t.get(n);typeof l!="number"&&(l=this.computeIdf(n),t.set(n,l));let c=s*l;o+=c*r}return o}computeEmbedding(i){let e=a.termFrequencies(i);return this.computeTfidf(e)}computeIdf(i){let e=this.chunkOccurrences.get(i)??0;return e>0?Math.log((this.chunkCount+1)/e):0}computeTfidf(i){let e=Object.create(null);for(let[t,o]of i){let n=this.computeIdf(t);n>0&&(e[t]=o*n)}return e}};function amo(a){let i=a.slice(0);i.sort((t,o)=>o.score-t.score);let e=i[0]?.score??0;if(e>0)for(let t of i)t.score/=e;return i}var ltt=class extends x{constructor(e,t){super();this.instantiationService=e;this.configurationService=t}getLocalSearchProvider(e){return this.instantiationService.createInstance(ctt,e)}get remoteSearchAllowed(){return this.configurationService.getValue().workbench.settings.enableNaturalLanguageSearch}getRemoteSearchProvider(e){if(this.remoteSearchAllowed)return this._remoteSearchProvider??=this.instantiationService.createInstance(Zki),this._remoteSearchProvider.setFilter(e),this._remoteSearchProvider}getAiSearchProvider(e){if(this.remoteSearchAllowed)return this._aiSearchProvider??=this.instantiationService.createInstance(dtt),this._aiSearchProvider.setFilter(e),this._aiSearchProvider}};ltt=I([m(0,F),m(1,B)],ltt);function eEi(a){return a.replace(/[":]/g," ").replace(/  /g," ").trim()}var ctt=class{constructor(i,e){this._filter=i;this.configurationService=e;this._filter=eEi(this._filter)}searchModel(i,e){if(!this._filter)return Promise.resolve(null);let t=l=>{let{matches:c,matchType:u,keyMatchScore:p}=new Yki(this._filter,l,!0,this.configurationService);return u===0||c.length===0?null:(vr(this._filter,l.key)&&(u=256),{matches:c,matchType:u,keyMatchScore:p,score:0})},o=i.filterSettings(this._filter,this.getGroupFilter(this._filter),t),n=Math.max(...o.map(l=>l.matchType&uro)),r=9,s=o.filter(l=>l.matchType&n||l.matchType&r||l.matchType===256).map(l=>({...l,providerName:xHt}));return Promise.resolve({filterMatches:s,exactMatch:s.some(l=>l.matchType===256)})}getGroupFilter(i){let e=N$(i,!1,{global:!0});return t=>t.id!=="defaultOverrides"&&e.test(t.title)}};ctt=I([m(1,B)],ctt);var Yki=class{constructor(i,e,t,o){this.searchDescription=t;this.configurationService=o;this.matchType=0;this.keyMatchScore=0;this.matches=zo(this._findMatchesInSetting(i,e),n=>`${n.startLineNumber}_${n.startColumn}_${n.endLineNumber}_${n.endColumn}_`)}_findMatchesInSetting(i,e){return this._doFindMatchesInSetting(i,e)}_keyToLabel(i){return i.replace(/[-._]/g," ").replace(/([a-z]+)([A-Z])/g,"$1 $2").replace(/([A-Za-z]+)(\d+)/g,"$1 $2").replace(/(\d+)([A-Za-z]+)/g,"$1 $2").toLowerCase()}_toAlphaNumeric(i){return i.replace(/[^\p{L}\p{N}]+/gu,"")}_doFindMatchesInSetting(i,e){let t=new Map,o=new Map,n=new Map,r=this._keyToLabel(e.key),s=new Set(i.split(" "));for(let v of s){let b=dw(v,r,!0);b?.length&&o.set(v,b.map(S=>this.toKeyRange(e,S)))}o.size===s.size?this.matchType|=128:o.size>=2&&(this.matchType|=32,this.keyMatchScore=o.size);let l=this._toAlphaNumeric(i),c=this._toAlphaNumeric(e.key),u=BO(l,c);if(u?.length&&(o.set(e.key,u.map(v=>this.toKeyRange(e,v))),this.matchType|=64),this.matchType===0){o.clear();for(let v of s){let b=dw(v,r,!1);b?.length&&o.set(v,b.map(S=>this.toKeyRange(e,S)))}if(o.size>=2||o.size===1&&s.size===1)this.matchType|=16,this.keyMatchScore=o.size;else{let v=X5e(l,c);v?.length&&(o.set(e.key,v.map(b=>this.toKeyRange(e,b))),this.matchType|=4)}}if(e.overrides?.length&&this.matchType!==0)return this.matchType=1,[...o.size?Array.from(o.values()).flat():[]];let p=this.matchType>=32;if(this.searchDescription&&!p){let v=e.keywords?.length?[...e.description,e.keywords.join(" ")]:e.description;for(let b of s)for(let S=0;S<v.length;S++){let y=aY(b,v[S]);y?.length&&t.set(b,y.map(w=>this.toDescriptionRange(e,w,S)))}t.size===s.size?this.matchType|=8:t.clear()}if(!p)if(e.enum?.length){for(let v of e.enum)if(typeof v=="string"){n.clear();for(let b of s){let S=BO(b,v);S?.length&&n.set(b,S.map(y=>this.toValueRange(e,y)))}if(n.size===s.size){this.matchType|=8;break}else n.clear()}}else{let v=this.configurationService.getValue(e.key);if(typeof v=="string"){for(let b of s){let S=BO(b,v);S?.length&&n.set(b,S.map(y=>this.toValueRange(e,y)))}n.size===s.size?this.matchType|=8:n.clear()}}let h=t.size?Array.from(t.values()).flat():[],g=o.size?Array.from(o.values()).flat():[],f=n.size?Array.from(n.values()).flat():[];return[...h,...g,...f]}toKeyRange(i,e){return{startLineNumber:i.keyRange.startLineNumber,startColumn:i.keyRange.startColumn+e.start,endLineNumber:i.keyRange.startLineNumber,endColumn:i.keyRange.startColumn+e.end}}toDescriptionRange(i,e,t){let o=i.descriptionRanges[t];return o?{startLineNumber:o.startLineNumber,startColumn:o.startColumn+e.start,endLineNumber:o.endLineNumber,endColumn:o.startColumn+e.end}:Wg}toValueRange(i,e){return{startLineNumber:i.valueRange.startLineNumber,startColumn:i.valueRange.startColumn+e.start+1,endLineNumber:i.valueRange.startLineNumber,endColumn:i.valueRange.startColumn+e.end+1}}},XHt=class{constructor(){this._settingsRecord={}}updateModel(i){i!==this._currentPreferencesModel&&(this._currentPreferencesModel=i,this.refresh())}refresh(){if(this._settingsRecord={},!!this._currentPreferencesModel){for(let i of this._currentPreferencesModel.settingsGroups)if(i.id!=="mostCommonlyUsed")for(let e of i.sections)for(let t of e.settings)this._settingsRecord[t.key]=t}}getSettingsRecord(){return this._settingsRecord}},Xki=class a{constructor(i){this._aiSettingsSearchService=i;this._filter="";this._recordProvider=new XHt}static{this.EMBEDDINGS_SETTINGS_SEARCH_MAX_PICKS=10}setFilter(i){this._filter=eEi(i)}async searchModel(i,e){return!this._filter||!this._aiSettingsSearchService.isEnabled()?null:(this._recordProvider.updateModel(i),this._aiSettingsSearchService.startSearch(this._filter,e),{filterMatches:await this.getEmbeddingsItems(e),exactMatch:!1})}async getEmbeddingsItems(i){let e=this._recordProvider.getSettingsRecord(),t=[],o=await this._aiSettingsSearchService.getEmbeddingsResults(this._filter,i);if(!o)return[];let n=EHt;for(let r of o){if(t.length===a.EMBEDDINGS_SETTINGS_SEARCH_MAX_PICKS)break;t.push({setting:e[r],matches:[e[r].range],matchType:2,keyMatchScore:0,score:0,providerName:n})}return t}},Jki=class a{constructor(){this._filter="";this._documents=[];this._settingsRecord={}}static{this.TF_IDF_PRE_NORMALIZE_THRESHOLD=50}static{this.TF_IDF_POST_NORMALIZE_THRESHOLD=.7}static{this.TF_IDF_MAX_PICKS=5}setFilter(i){this._filter=eEi(i)}keyToLabel(i){return i.replace(/[-._]/g," ").replace(/([a-z]+)([A-Z])/g,"$1 $2").replace(/([A-Za-z]+)(\d+)/g,"$1 $2").replace(/(\d+)([A-Za-z]+)/g,"$1 $2").toLowerCase()}settingItemToEmbeddingString(i){let e=`Setting Id: ${i.key}
`;return e+=`Label: ${this.keyToLabel(i.key)}
`,e+=`Description: ${i.description}
`,e}async searchModel(i,e){if(!this._filter)return null;if(this._currentPreferencesModel!==i){this._currentPreferencesModel=i,this._documents=[],this._settingsRecord={};for(let t of i.settingsGroups)if(t.id!=="mostCommonlyUsed")for(let o of t.sections)for(let n of o.settings)this._documents.push({key:n.key,textChunks:[this.settingItemToEmbeddingString(n)]}),this._settingsRecord[n.key]=n}return{filterMatches:await this.getTfIdfItems(e),exactMatch:!1}}async getTfIdfItems(i){let e=[],t=new rPe;t.updateDocuments(this._documents);let o=t.calculateScores(this._filter,i);o.sort((r,s)=>s.score-r.score);let n=o[0].score;if(n<a.TF_IDF_PRE_NORMALIZE_THRESHOLD)return[];for(let r of o){if(r.score/n<a.TF_IDF_POST_NORMALIZE_THRESHOLD||e.length===a.TF_IDF_MAX_PICKS)break;let s=r.key;e.push({setting:this._settingsRecord[s],matches:[this._settingsRecord[s].range],matchType:2,keyMatchScore:0,score:r.score,providerName:kHt})}return e}},Zki=class{constructor(){this._filter="";this._tfIdfSearchProvider=new Jki}setFilter(i){this._filter=i,this._tfIdfSearchProvider.setFilter(i)}async searchModel(i,e){return this._filter?await this._tfIdfSearchProvider.searchModel(i,e):null}},dtt=class{constructor(i){this.aiSettingsSearchService=i;this._filter="";this._embeddingsSearchProvider=new Xki(this.aiSettingsSearchService),this._recordProvider=new XHt}setFilter(i){this._filter=i,this._embeddingsSearchProvider.setFilter(i)}async searchModel(i,e){return!this._filter||!this.aiSettingsSearchService.isEnabled()?null:(this._recordProvider.updateModel(i),await this._embeddingsSearchProvider.searchModel(i,e))}async getLLMRankedResults(i){return!this._filter||!this.aiSettingsSearchService.isEnabled()?null:{filterMatches:await this.getLLMRankedItems(i),exactMatch:!1}}async getLLMRankedItems(i){let e=this._recordProvider.getSettingsRecord(),t=[],o=await this.aiSettingsSearchService.getLLMRankedResults(this._filter,i);if(!o)return[];for(let n of o)e[n]&&t.push({setting:e[n],matches:[e[n].range],matchType:2,keyMatchScore:0,score:0,providerName:THt});return t}};dtt=I([m(0,o_e)],dtt);Ee(rHt,ltt,1);var lmo="transientWordWrapState",iEi="isWordWrapMinified",oEi="isDominatedByLongLines",cmo=new Y("canToggleWordWrap",!1,!0),dmo=new Y("editorWordWrap",!1,d(8979,null));function jA(a,i,e){e.setTransientModelProperty(a,lmo,i)}function tte(a,i){return i.getTransientModelProperty(a,lmo)}var JHt="editor.action.toggleWordWrap",tEi=class extends Di{constructor(){super({id:JHt,label:L(8981,"View: Toggle Word Wrap"),precondition:void 0,kbOpts:{kbExpr:null,primary:568,weight:100}})}run(i,e){let t=i.get(qt),o=i.get(F);if(!cPe(t,e))return;let n=e.getModel(),r=tte(n,t),s;r?s=null:s={wordWrapOverride:e.getOption(166).wrappingColumn===-1?"on":"off"},jA(n,s,t);let l=o.invokeFunction(Mwt,e);if(l){let c=l.getOriginalEditor(),u=l.getModifiedEditor(),p=c===e?u:c;cPe(t,p)&&(jA(p.getModel(),s,t),l.updateOptions({}))}}},sPe=class extends x{constructor(e,t,o){super();this._editor=e;this._contextKeyService=t;this._codeEditorService=o;let r=this._editor.getOptions().get(166),s=this._contextKeyService.createKey(iEi,r.isWordWrapMinified),l=this._contextKeyService.createKey(oEi,r.isDominatedByLongLines),c=!1;this._register(e.onDidChangeConfiguration(p=>{if(!p.hasChanged(166))return;let g=this._editor.getOptions().get(166);s.set(g.isWordWrapMinified),l.set(g.isDominatedByLongLines),c||u()})),this._register(e.onDidChangeModel(p=>{u()})),this._register(o.onDidChangeTransientModelProperty(()=>{u()}));let u=()=>{if(!cPe(this._codeEditorService,this._editor))return;let p=tte(this._editor.getModel(),this._codeEditorService);try{c=!0,this._applyWordWrapState(p)}finally{c=!1}}}static{this.ID="editor.contrib.toggleWordWrapController"}_applyWordWrapState(e){let t=e?e.wordWrapOverride:"inherit";this._editor.updateOptions({wordWrapOverride2:t})}};sPe=I([m(1,X),m(2,qt)],sPe);var aPe=class extends x{constructor(e,t){super();this._diffEditor=e;this._codeEditorService=t;this._register(this._diffEditor.onDidChangeModel(()=>{this._ensureSyncedWordWrapToggle()}))}static{this.ID="diffeditor.contrib.toggleWordWrapController"}_ensureSyncedWordWrapToggle(){let e=this._diffEditor.getOriginalEditor(),t=this._diffEditor.getModifiedEditor();if(!e.hasModel()||!t.hasModel())return;let o=tte(e.getModel(),this._codeEditorService),n=tte(t.getModel(),this._codeEditorService);o&&!n&&cPe(this._codeEditorService,e)&&(jA(t.getModel(),o,this._codeEditorService),this._diffEditor.updateOptions({})),!o&&n&&cPe(this._codeEditorService,t)&&(jA(e.getModel(),n,this._codeEditorService),this._diffEditor.updateOptions({}))}};aPe=I([m(1,qt)],aPe);function cPe(a,i){if(!i||i.isSimpleWidget||!i.getModel())return!1;if(i.getOption(70)){for(let t of a.listDiffEditors())if(t.getOriginalEditor()===i&&!t.renderSideBySide)return!1}return!0}var lPe=class extends x{constructor(e,t,o){super();this._editorService=e;this._codeEditorService=t;this._contextService=o;this._register(U.runAndSubscribe(nf,({window:n,disposables:r})=>{r.add(j(n,"focus",()=>this._update(),!0)),r.add(j(n,"blur",()=>this._update(),!0))},{window:ut,disposables:this._store})),this._register(this._editorService.onDidActiveEditorChange(()=>this._update())),this._canToggleWordWrap=cmo.bindTo(this._contextService),this._editorWordWrap=dmo.bindTo(this._contextService),this._activeEditor=null,this._activeEditorListener=this._register(new N),this._update()}static{this.ID="workbench.contrib.editorWordWrapContextKeyTracker"}_update(){let e=this._codeEditorService.getFocusedCodeEditor()||this._codeEditorService.getActiveCodeEditor();this._activeEditor!==e&&(this._activeEditorListener.clear(),this._activeEditor=e,e&&(this._activeEditorListener.add(e.onDidChangeModel(()=>this._updateFromCodeEditor())),this._activeEditorListener.add(e.onDidChangeConfiguration(t=>{t.hasChanged(166)&&this._updateFromCodeEditor()})),this._updateFromCodeEditor()))}_updateFromCodeEditor(){if(cPe(this._codeEditorService,this._activeEditor)){let e=this._activeEditor.getOption(166);this._setValues(!0,e.wrappingColumn!==-1)}else return this._setValues(!1,!1)}_setValues(e,t){this._canToggleWordWrap.set(e),this._editorWordWrap.set(t)}};lPe=I([m(0,ee),m(1,qt),m(2,X)],lPe);It(lPe.ID,lPe,St.AfterRestored);xo(sPe.ID,sPe,0);jgt(aPe.ID,aPe);ni(tEi);ve.appendMenuItem(D.EditorTitle,{command:{id:JHt,title:d(8982,null),icon:R.wordWrap},group:"navigation",order:1,when:C.and(C.has(oEi),C.has(iEi))});ve.appendMenuItem(D.EditorTitle,{command:{id:JHt,title:d(8983,null),icon:R.wordWrap},group:"navigation",order:1,when:C.and(pe.inDiffEditor.negate(),C.has(oEi),C.not(iEi))});ve.appendMenuItem(D.MenubarViewMenu,{command:{id:JHt,title:d(8980,null),toggled:dmo,precondition:cmo},order:1,group:"6_editor"});var QA=class{constructor(i,e){this._instaService=i;this._inputUri=A.from({scheme:"perf",path:"Startup Performance"});this._registration=e.registerTextModelContentProvider("perf",i.createInstance(utt))}static get(){return mTt(QA.ID)}static{this.ID="workbench.contrib.perfview"}dispose(){this._registration.dispose()}getInputUri(){return this._inputUri}getEditorInput(){return this._instaService.createInstance(pG)}};QA=I([m(0,F),m(1,Bt)],QA);var pG=class extends $C{static{this.Id="PerfviewInput"}get typeId(){return pG.Id}constructor(i,e,t,o,n,r,s,l){super(QA.get().getInputUri(),d(12944,null),void 0,void 0,void 0,i,e,t,o,n,r,s,l)}};pG=I([m(0,Bt),m(1,Uo),m(2,ee),m(3,fe),m(4,rt),m(5,gr),m(6,Fn),m(7,Rv)],pG);var utt=class{constructor(i,e,t,o,n,r,s,l,c){this._modelService=i;this._languageService=e;this._editorService=t;this._lifecycleService=o;this._timerService=n;this._extensionService=r;this._productService=s;this._remoteAgentService=l;this._terminalService=c;this._modelDisposables=[]}provideTextContent(i){if(!this._model||this._model.isDisposed()){Be(this._modelDisposables);let e=this._languageService.createById("markdown");this._model=this._modelService.getModel(i)||this._modelService.createModel("Loading...",e,i),this._modelDisposables.push(e.onDidChange(t=>{this._model?.setLanguage(t)})),this._modelDisposables.push(this._extensionService.onDidChangeExtensionsStatus(this._updateModel,this)),jA(this._model,{wordWrapOverride:"off"},this._editorService)}return this._updateModel(),Promise.resolve(this._model)}_updateModel(){Promise.all([this._timerService.whenReady(),this._lifecycleService.when(4),this._extensionService.whenInstalledExtensionsRegistered(),Wt&&!this._remoteAgentService.getConnection()?.remoteAuthority?Promise.resolve():this._terminalService.whenConnected]).then(()=>{if(this._model&&!this._model.isDisposed()){let i=new nEi;this._addSummary(i),i.blank(),this._addSummaryTable(i),i.blank(),this._addExtensionsTable(i),i.blank(),this._addPerfMarksTable("Terminal Stats",i,this._timerService.getPerformanceMarks().find(e=>e[0]==="renderer")?.[1].filter(e=>e.name.startsWith("code/terminal/"))),i.blank(),this._addWorkbenchContributionsPerfMarksTable(i),i.blank(),this._addRawPerfMarks(i),i.blank(),this._addResourceTimingStats(i),this._model.setValue(i.value)}})}_addSummary(i){let e=this._timerService.startupMetrics;i.heading(2,"System Info"),i.li(`${this._productService.nameShort}: ${this._productService.version} (${this._productService.commit||"0000000"})`),i.li(`OS: ${e.platform}(${e.release})`),e.cpus&&i.li(`CPUs: ${e.cpus.model}(${e.cpus.count} x ${e.cpus.speed})`),typeof e.totalmem=="number"&&typeof e.freemem=="number"&&i.li(`Memory(System): ${(e.totalmem/vl.GB).toFixed(2)} GB(${(e.freemem/vl.GB).toFixed(2)}GB free)`),e.meminfo&&i.li(`Memory(Process): ${(e.meminfo.workingSetSize/vl.KB).toFixed(2)} MB working set(${(e.meminfo.privateBytes/vl.KB).toFixed(2)}MB private, ${(e.meminfo.sharedBytes/vl.KB).toFixed(2)}MB shared)`),i.li(`VM(likelihood): ${e.isVMLikelyhood}%`),i.li(`Initial Startup: ${e.initialStartup}`),i.li(`Has ${e.windowCount-1} other windows`),i.li(`Screen Reader Active: ${e.hasAccessibilitySupport}`),i.li(`Empty Workspace: ${e.emptyWorkbench}`)}_addSummaryTable(i){let e=this._timerService.startupMetrics,t=ne.as(Qi.Workbench).timings,o=[];o.push(["import(main.js)",e.timers.ellapsedLoadMainBundle,"[main]",`initial startup: ${e.initialStartup}`]),o.push(["start => app.isReady",e.timers.ellapsedAppReady,"[main]",`initial startup: ${e.initialStartup}`]),o.push(["nls:start => nls:end",e.timers.ellapsedNlsGeneration,"[main]",`initial startup: ${e.initialStartup}`]),o.push(["run main.js",e.timers.ellapsedRunMainBundle,"[main]",`initial startup: ${e.initialStartup}`]),o.push(["start crash reporter",e.timers.ellapsedCrashReporter,"[main]",`initial startup: ${e.initialStartup}`]),o.push(["serve main IPC handle",e.timers.ellapsedMainServer,"[main]",`initial startup: ${e.initialStartup}`]),o.push(["create window",e.timers.ellapsedWindowCreate,"[main]",`initial startup: ${e.initialStartup}, ${e.initialStartup?`state: ${e.timers.ellapsedWindowRestoreState}ms, widget: ${e.timers.ellapsedBrowserWindowCreate}ms, show: ${e.timers.ellapsedWindowMaximize}ms`:""}`]),o.push(["app.isReady => window.loadUrl()",e.timers.ellapsedWindowLoad,"[main]",`initial startup: ${e.initialStartup}`]),o.push(["window.loadUrl() => begin to import(workbench.desktop.main.js)",e.timers.ellapsedWindowLoadToRequire,"[main->renderer]",uTt(e.windowKind)]),o.push(["import(workbench.desktop.main.js)",e.timers.ellapsedRequire,"[renderer]",`cached data: ${e.didUseCachedData?"YES":"NO"}`]),o.push(["wait for window config",e.timers.ellapsedWaitForWindowConfig,"[renderer]",void 0]),o.push(["init storage (global & workspace)",e.timers.ellapsedStorageInit,"[renderer]",void 0]),o.push(["init workspace service",e.timers.ellapsedWorkspaceServiceInit,"[renderer]",void 0]),Wt&&(o.push(["init settings and global state from settings sync service",e.timers.ellapsedRequiredUserDataInit,"[renderer]",void 0]),o.push(["init keybindings, snippets & extensions from settings sync service",e.timers.ellapsedOtherUserDataInit,"[renderer]",void 0])),o.push(["register extensions & spawn extension host",e.timers.ellapsedExtensions,"[renderer]",void 0]),o.push(["restore primary viewlet",e.timers.ellapsedViewletRestore,"[renderer]",e.viewletId]),o.push(["restore secondary viewlet",e.timers.ellapsedAuxiliaryViewletRestore,"[renderer]",e.auxiliaryViewletId]),o.push(["restore panel",e.timers.ellapsedPanelRestore,"[renderer]",e.panelId]),o.push(["restore & resolve visible editors",e.timers.ellapsedEditorRestore,"[renderer]",`${e.editorIds.length}: ${e.editorIds.join(", ")}`]),o.push(["create workbench contributions",e.timers.ellapsedWorkbenchContributions,"[renderer]",`${(t.get(1)?.length??0)+(t.get(2)?.length??0)} blocking startup`]),o.push(["overall workbench load",e.timers.ellapsedWorkbench,"[renderer]",void 0]),o.push(["workbench ready",e.ellapsed,"[main->renderer]",void 0]),o.push(["renderer ready",e.timers.ellapsedRenderer,"[renderer]",void 0]),o.push(["shared process connection ready",e.timers.ellapsedSharedProcesConnected,"[renderer->sharedprocess]",void 0]),o.push(["extensions registered",e.timers.ellapsedExtensionsReady,"[renderer]",void 0]),i.heading(2,"Performance Marks"),i.table(["What","Duration","Process","Info"],o)}_addExtensionsTable(i){let e=[],t=[],o=this._extensionService.getExtensionsStatus();for(let r in o){let{activationTimes:s}=o[r];s&&(s.activationReason.startup?e.push([r,s.activationReason.startup,s.codeLoadingTime,s.activateCallTime,s.activateResolvedTime,s.activationReason.activationEvent,s.activationReason.extensionId.value]):t.push([r,s.activationReason.startup,s.codeLoadingTime,s.activateCallTime,s.activateResolvedTime,s.activationReason.activationEvent,s.activationReason.extensionId.value]))}let n=e.concat(t);n.length>0&&(i.heading(2,"Extension Activation Stats"),i.table(["Extension","Eager","Load Code","Call Activate","Finish Activate","Event","By"],n))}_addPerfMarksTable(i,e,t){if(!t)return;let o=[],n=-1,r=0;for(let{name:s,startTime:l}of t){let c=n!==-1?l-n:0;r+=c,o.push([s,Math.round(l),Math.round(c),Math.round(r)]),n=l}i&&e.heading(2,i),e.table(["Name","Timestamp","Delta","Total"],o)}_addWorkbenchContributionsPerfMarksTable(i){i.heading(2,"Workbench Contributions Blocking Restore");let e=ne.as(Qi.Workbench).timings;i.li(`Total (LifecyclePhase.Starting): ${e.get(1)?.length} (${e.get(1)?.reduce((o,n)=>o+n[1],0)}ms)`),i.li(`Total (LifecyclePhase.Ready): ${e.get(2)?.length} (${e.get(2)?.reduce((o,n)=>o+n[1],0)}ms)`),i.blank();let t=this._timerService.getPerformanceMarks().find(o=>o[0]==="renderer")?.[1].filter(o=>o.name.startsWith("code/willCreateWorkbenchContribution/1")||o.name.startsWith("code/didCreateWorkbenchContribution/1")||o.name.startsWith("code/willCreateWorkbenchContribution/2")||o.name.startsWith("code/didCreateWorkbenchContribution/2"));this._addPerfMarksTable(void 0,i,t)}_addRawPerfMarks(i){for(let[e,t]of this._timerService.getPerformanceMarks()){i.heading(2,`Raw Perf Marks: ${e}`),i.value+="```\n",i.value+=`Name	Timestamp	Delta	Total
`;let o=-1,n=0;for(let{name:r,startTime:s}of t){let l=o!==-1?s-o:0;n+=l,i.value+=`${r}	${s}	${l}	${n}
`,o=s}i.value+="```\n"}}_addResourceTimingStats(i){let e=performance.getEntriesByType("resource").map(t=>[t.name,t.duration]);e.length&&(i.heading(2,"Resource Timing Stats"),i.table(["Name","Duration"],e))}};utt=I([m(0,Tt),m(1,_t),m(2,qt),m(3,ji),m(4,YC),m(5,lt),m(6,tt),m(7,bo),m(8,nn)],utt);var nEi=class{constructor(){this.value=""}heading(i,e){return this.value+=`${"#".repeat(i)} ${e}

`,this}blank(){return this.value+=`
`,this}li(i){return this.value+=`* ${i}
`,this}table(i,e){this.value+=this.toMarkdownTable(i,e)}toMarkdownTable(i,e){let t="",o=[];return i.forEach((n,r)=>{o[r]=n.length}),e.forEach(n=>{n.forEach((r,s)=>{typeof r>"u"&&(r=n[s]="-");let l=r.toString().length;o[s]=Math.max(l,o[s])})}),i.forEach((n,r)=>{t+=`| ${n+" ".repeat(o[r]-n.toString().length)} `}),t+=`|
`,i.forEach((n,r)=>{t+=`| ${"-".repeat(o[r])} `}),t+=`|
`,e.forEach(n=>{n.forEach((r,s)=>{typeof r<"u"&&(t+=`| ${r+" ".repeat(o[s]-r.toString().length)} `)}),t+=`|
`}),t}};var rEi=class{constructor(i,e){this.key=i;this.data=e;this.incoming=new Map;this.outgoing=new Map}},ptt=class{constructor(i){this._hashFn=i;this._nodes=new Map}roots(){let i=[];for(let e of this._nodes.values())e.outgoing.size===0&&i.push(e);return i}insertEdge(i,e){let t=this.lookupOrInsertNode(i),o=this.lookupOrInsertNode(e);t.outgoing.set(o.key,o),o.incoming.set(t.key,t)}removeNode(i){let e=this._hashFn(i);this._nodes.delete(e);for(let t of this._nodes.values())t.outgoing.delete(e),t.incoming.delete(e)}lookupOrInsertNode(i){let e=this._hashFn(i),t=this._nodes.get(e);return t||(t=new rEi(e,i),this._nodes.set(e,t)),t}lookup(i){return this._nodes.get(this._hashFn(i))}isEmpty(){return this._nodes.size===0}toString(){let i=[];for(let[e,t]of this._nodes)i.push(`${e}
	(-> incoming)[${[...t.incoming.keys()].join(", ")}]
	(outgoing ->)[${[...t.outgoing.keys()].join(",")}]
`);return i.join(`
`)}findCycleSlow(){for(let[i,e]of this._nodes){let t=new Set([i]),o=this._findCycle(e,t);if(o)return o}}_findCycle(i,e){for(let[t,o]of i.outgoing){if(e.has(t))return[...e,t].join(" -> ");e.add(t);let n=this._findCycle(o,e);if(n)return n;e.delete(t)}}};var $Xo=!1,ZHt=class extends Error{constructor(i){super("cyclic dependency between services"),this.message=i.findCycleSlow()??`UNABLE to detect cycle, dumping graph: 
${i.toString()}`}},dPe=class a{constructor(i=new _o,e=!1,t,o=$Xo){this._services=i;this._strict=e;this._parent=t;this._enableTracing=o;this._isDisposed=!1;this._servicesToMaybeDispose=new Set;this._children=new Set;this._activeInstantiations=new Set;this._services.set(F,this),this._globalGraph=o?t?._globalGraph??new ptt(n=>n):void 0}dispose(){if(!this._isDisposed){this._isDisposed=!0,Be(this._children),this._children.clear();for(let i of this._servicesToMaybeDispose)jc(i)&&i.dispose();this._servicesToMaybeDispose.clear()}}_throwIfDisposed(){if(this._isDisposed)throw new Error("InstantiationService has been disposed")}createChild(i,e){this._throwIfDisposed();let t=this,o=new class extends a{dispose(){t._children.delete(o),super.dispose()}}(i,this._strict,this,this._enableTracing);return this._children.add(o),e?.add(o),o}invokeFunction(i,...e){this._throwIfDisposed();let t=ite.traceInvocation(this._enableTracing,i),o=!1;try{return i({get:r=>{if(o)throw NSe("service accessor is only valid during the invocation of its target method");let s=this._getOrCreateServiceInstance(r,t);return s||this._throwIfStrict(`[invokeFunction] unknown service '${r}'`,!1),s}},...e)}finally{o=!0,t.stop()}}createInstance(i,...e){this._throwIfDisposed();let t,o;return i instanceof Ft?(t=ite.traceCreation(this._enableTracing,i.ctor),o=this._createInstance(i.ctor,i.staticArguments.concat(e),t)):(t=ite.traceCreation(this._enableTracing,i),o=this._createInstance(i,e,t)),t.stop(),o}_createInstance(i,e=[],t){let o=yV.getServiceDependencies(i).sort((s,l)=>s.index-l.index),n=[];for(let s of o){let l=this._getOrCreateServiceInstance(s.id,t);l||this._throwIfStrict(`[createInstance] ${i.name} depends on UNKNOWN service ${s.id}.`,!1),n.push(l)}let r=o.length>0?o[0].index:e.length;if(e.length!==r){console.trace(`[createInstance] First service dependency of ${i.name} at position ${r+1} conflicts with ${e.length} static arguments`);let s=r-e.length;s>0?e=e.concat(new Array(s)):e=e.slice(0,r)}return Reflect.construct(i,e.concat(n))}_setCreatedServiceInstance(i,e){if(this._services.get(i)instanceof Ft)this._services.set(i,e);else if(this._parent)this._parent._setCreatedServiceInstance(i,e);else throw new Error("illegalState - setting UNKNOWN service instance")}_getServiceInstanceOrDescriptor(i){let e=this._services.get(i);return!e&&this._parent?this._parent._getServiceInstanceOrDescriptor(i):e}_getOrCreateServiceInstance(i,e){this._globalGraph&&this._globalGraphImplicitDependency&&this._globalGraph.insertEdge(this._globalGraphImplicitDependency,String(i));let t=this._getServiceInstanceOrDescriptor(i);return t instanceof Ft?this._safeCreateAndCacheServiceInstance(i,t,e.branch(i,!0)):(e.branch(i,!1),t)}_safeCreateAndCacheServiceInstance(i,e,t){if(this._activeInstantiations.has(i))throw new Error(`illegal state - RECURSIVELY instantiating service '${i}'`);this._activeInstantiations.add(i);try{return this._createAndCacheServiceInstance(i,e,t)}finally{this._activeInstantiations.delete(i)}}_createAndCacheServiceInstance(i,e,t){let o=new ptt(l=>l.id.toString()),n=0,r=[{id:i,desc:e,_trace:t}],s=new Set;for(;r.length;){let l=r.pop();if(!s.has(String(l.id))){if(s.add(String(l.id)),o.lookupOrInsertNode(l),n++>1e3)throw new ZHt(o);for(let c of yV.getServiceDependencies(l.desc.ctor)){let u=this._getServiceInstanceOrDescriptor(c.id);if(u||this._throwIfStrict(`[createInstance] ${i} depends on ${c.id} which is NOT registered.`,!0),this._globalGraph?.insertEdge(String(l.id),String(c.id)),u instanceof Ft){let p={id:c.id,desc:u,_trace:l._trace.branch(c.id,!0)};o.insertEdge(l,p),r.push(p)}}}}for(;;){let l=o.roots();if(l.length===0){if(!o.isEmpty())throw new ZHt(o);break}for(let{data:c}of l){if(this._getServiceInstanceOrDescriptor(c.id)instanceof Ft){let p=this._createServiceInstanceWithOwner(c.id,c.desc.ctor,c.desc.staticArguments,c.desc.supportsDelayedInstantiation,c._trace);this._setCreatedServiceInstance(c.id,p)}o.removeNode(c)}}return this._getServiceInstanceOrDescriptor(i)}_createServiceInstanceWithOwner(i,e,t=[],o,n){if(this._services.get(i)instanceof Ft)return this._createServiceInstance(i,e,t,o,n,this._servicesToMaybeDispose);if(this._parent)return this._parent._createServiceInstanceWithOwner(i,e,t,o,n);throw new Error(`illegalState - creating UNKNOWN service instance ${e.name}`)}_createServiceInstance(i,e,t=[],o,n,r){if(o){let s=new a(void 0,this._strict,this,this._enableTracing);s._globalGraphImplicitDependency=String(i);let l=new Map,c=new H$(()=>{let u=s._createInstance(e,t,n);for(let[p,h]of l){let g=u[p];if(typeof g=="function")for(let f of h)f.disposable=g.apply(u,f.listener)}return l.clear(),r.add(u),u});return new Proxy(Object.create(null),{get(u,p){if(!c.isInitialized&&typeof p=="string"&&(p.startsWith("onDid")||p.startsWith("onWill"))){let f=l.get(p);return f||(f=new qs,l.set(p,f)),(b,S,y)=>{if(c.isInitialized)return c.value[p](b,S,y);{let w={listener:[b,S,y],disposable:void 0},k=f.push(w);return Z(()=>{k(),w.disposable?.dispose()})}}}if(p in u)return u[p];let h=c.value,g=h[p];return typeof g!="function"||(g=g.bind(h),u[p]=g),g},set(u,p,h){return c.value[p]=h,!0},getPrototypeOf(u){return e.prototype}})}else{let s=this._createInstance(e,t,n);return r.add(s),s}}_throwIfStrict(i,e){if(e&&console.warn(i),this._strict)throw new Error(i)}};var ite=class a{constructor(i,e){this.type=i;this.name=e;this._start=Date.now();this._dep=[]}static{this.all=new Set}static{this._None=new class extends a{constructor(){super(0,null)}stop(){}branch(){return this}}}static traceInvocation(i,e){return i?new a(2,e.name||new Error().stack.split(`
`).slice(3,4).join(`
`)):a._None}static traceCreation(i,e){return i?new a(1,e.name):a._None}static{this._totals=0}branch(i,e){let t=new a(3,i.toString());return this._dep.push([i,e,t]),t}stop(){let i=Date.now()-this._start;a._totals+=i;let e=!1;function t(n,r){let s=[],l=new Array(n+1).join("	");for(let[c,u,p]of r._dep)if(u&&p){e=!0,s.push(`${l}CREATES -> ${c}`);let h=t(n+1,p);h&&s.push(h)}else s.push(`${l}uses -> ${c}`);return s.join(`
`)}let o=[`${this.type===1?"CREATE":"CALL"} ${this.name}`,`${t(1,this)}`,`DONE, took ${i.toFixed(2)}ms (grand total ${a._totals.toFixed(2)}ms)`];(i>2||e)&&a.all.add(o.join(`
`))}};var uPe=class extends x{constructor(e,t,o){super();this._configurationService=e;this._editorService=t;this._telemetryService=o;this._listener=this._register(new me);this._scheduler=this._register(new Dt(()=>{this._logSamples(),this._setupListener()},6e4)),(Math.random()<=.01||this._configurationService.getValue("editor.experimentalGpuAcceleration")==="on")&&this._setupListener()}_setupListener(){this._listener.value=U.once(this._editorService.onDidActiveEditorChange)(()=>this._scheduler.schedule())}_logSamples(){let e=Kx.getAndClearMeasurements();e&&this._telemetryService.publicLog2("performance.inputLatency",{keydown:e.keydown,input:e.input,render:e.render,total:e.total,sampleCount:e.sampleCount,gpuAcceleration:this._configurationService.getValue("editor.experimentalGpuAcceleration")==="on"})}};uPe=I([m(0,B),m(1,ee),m(2,Te)],uPe);It(QA.ID,QA,{lazy:!0});ne.as(qo.EditorFactory).registerEditorSerializer(pG.Id,class{canSerialize(){return!0}serialize(){return""}deserialize(a){return a.createInstance(pG)}});W(class extends K{constructor(){super({id:"perfview.show",title:L(12943,"Startup Performance"),category:Ve.Developer,f1:!0})}run(a){let i=a.get(ee),e=QA.get();return i.openEditor(e.getEditorInput(),{pinned:!0})}});W(class extends K{constructor(){super({id:"perf.insta.printAsyncCycles",title:L(12940,"Print Service Cycles"),category:Ve.Developer,f1:!0})}run(i){let e=i.get(F);if(e instanceof dPe){let t=e._globalGraph?.findCycleSlow();t?console.warn("CYCLE",t):console.warn("YEAH, no more cycles")}}});W(class extends K{constructor(){super({id:"perf.insta.printTraces",title:L(12942,"Print Service Traces"),category:Ve.Developer,f1:!0})}run(){if(ite.all.size===0){console.log("Enable via `instantiationService.ts#_enableAllTracing`");return}for(let i of ite.all)console.log(i)}});W(class extends K{constructor(){super({id:"perf.event.profiling",title:L(12941,"Print Emitter Profiles"),category:Ve.Developer,f1:!0})}run(){if(XSe.all.size===0){console.log("USE `EmitterOptions._profName` to enable profiling");return}for(let i of XSe.all)console.log(`${i.name}: ${i.invocationCount} invocations COST ${i.elapsedOverall}ms, ${i.listenerCount} listeners, avg cost is ${i.durations.reduce((e,t)=>e+t,0)/i.durations.length}ms`)}});ne.as(Qi.Workbench).registerWorkbenchContribution(uPe,4);var pPe=class{static{this.Id="perf.disposableTracking"}constructor(i){!i.isBuilt&&!i.extensionTestsLocationURI&&HSe(new fht)}};pPe=I([m(0,Eo)],pPe);It(pPe.Id,pPe,St.Eventually);var umo=new Y("userHasOpenedNotebook",!1),eUt=new Y("notebookFindWidgetFocused",!1),tUt=new Y("interactiveWindowOpen",!1),a8=new Y("mostRecentReplEditor",void 0),Za=C.equals("activeEditor",MR),mtt=C.equals("activeEditor",_X),sEi=C.equals("activeEditor",iEe),pmo=C.or(Za,mtt,sEi),AS=new Y("isCompositeNotebook",!1),pr=new Y("notebookEditorFocused",!1),pp=new Y("notebookCellListFocused",!1),bM=new Y("notebookOutputFocused",!1),ote=new Y("notebookOutputInputFocused",!1),Xl=new Y("notebookEditable",!0),l8=new Y("notebookHasRunningCell",!1),VH=new Y("notebookHasSomethingRunning",!1),htt=new Y("notebookUseConsolidatedOutputButton",!1),peu=new Y("notebookBreakpointMargin",!1),mmo=new Y("notebookCellToolbarLocation","left"),gtt=new Y("notebookCursorNavigationMode",!1),mPe=new Y("notebookLastCellFailed",!1),hmo=new Y("notebookType",void 0),NS=new Y("notebookCellType",void 0),jw=new Y("notebookCellEditable",!1),Xme=new Y("notebookCellFocused",!1),SM=new Y("notebookCellEditorFocused",!1),nte=new Y("notebookCellMarkdownEditMode",!1),ftt=new Y("notebookCellLineNumbers","inherit"),Jme=new Y("notebookCellExecutionState",void 0),iUt=new Y("notebookCellExecuting",!1),Bk=new Y("notebookCellHasOutputs",!1),oUt=new Y("notebookCellIsFirstOutput",!1),nUt=new Y("hasHiddenOutputs",!1),hPe=new Y("notebookCellOutputMimeType",void 0),gPe=new Y("notebookCellInputIsCollapsed",!1),vtt=new Y("notebookCellOutputIsCollapsed",!1),gmo=new Y("notebookCellResource",""),Zme=new Y("notebookCellHasErrorDiagnostics",!1),aEi=new Y("notebookCellOutputMimeTypeListForChat",[]),fPe=new Y("notebookKernel",void 0),rte=new Y("notebookKernelCount",0),vPe=new Y("notebookKernelSourceCount",0),fmo=new Y("notebookKernelSelected",!1),BH=new Y("notebookInterruptibleKernel",!1),rUt=new Y("notebookMissingKernelExtension",!1),sUt=new Y("notebookHasOutputs",!1),bPe=new Y("kernelHasVariableProvider",!1);var NT="_notebook.selectKernel",th=L(12447,"Notebook"),Y0="inline/cell",vmo="inline/output",Df=100,bmo=201;function ehe(a){let i=Jn(a.activeEditorPane);if(!i||!i.hasModel())return;let e=i.getActiveCell(),t=i.getSelectionViewModels();return{cell:e,selectedCells:t,notebookEditor:i}}function jXo(a,i){let t=a.get(Gc).listNotebookEditors().find(o=>o.hasModel()&&o.textModel.uri.toString()===i.toString());if(t&&t.hasModel())return t}function aUt(a,i){let e=A.revive(i);if(e){let t=jXo(a,e);if(t)return{notebookEditor:t}}}function ste(a,i){let e;for(let[,t]of a.notebookEditor.codeEditors)if(Qe(t.getModel()?.uri,i.uri)){e=t;break}return e}var mp=class extends K{constructor(i){if(i.f1!==!1){i.f1=!1;let e={id:D.CommandPalette,when:C.or(Za,mtt,sEi)};i.menu?Array.isArray(i.menu)||(i.menu=[i.menu]):i.menu=[],i.menu=[...i.menu,e]}i.category=th,super(i)}async run(i,e,...t){if(cEi(i,this.desc.id,e),!(!this.isNotebookActionContext(e)&&(e=this.getEditorContextFromArgsOrActive(i,e,...t),!e)))return this.runWithContext(i,e)}isNotebookActionContext(i){return!!i&&!!i.notebookEditor}getEditorContextFromArgsOrActive(i,e,...t){return ehe(i.get(ee))}},Hg=class extends K{constructor(i){if(i.f1!==!1){i.f1=!1;let e={id:D.CommandPalette,when:Za};i.menu?Array.isArray(i.menu)||(i.menu=[i.menu]):i.menu=[],i.menu=[...i.menu,e]}i.category=th,super(i)}parseArgs(i,...e){}async run(i,...e){let t=e[0];if(cEi(i,this.desc.id,t),Smo(t))return this.runWithContext(i,t);let n=this.parseArgs(i,...e);if(n)return this.runWithContext(i,n);let r=SPe(i);if(r){let s=r.getSelections().length===0?[r.getFocus()]:r.getSelections();return this.runWithContext(i,{ui:!1,notebookEditor:r,selectedCells:w6e(r,s)})}}},Pd=class extends mp{isCellActionContext(i){return!!i&&!!i.notebookEditor&&!!i.cell}getCellContextFromArgs(i,e,...t){}async run(i,e,...t){if(cEi(i,this.desc.id,e),this.isCellActionContext(e))return this.runWithContext(i,e);let o=this.getCellContextFromArgs(i,e,...t);if(o)return this.runWithContext(i,o);let n=this.getEditorContextFromArgsOrActive(i);if(this.isCellActionContext(n))return this.runWithContext(i,n)}},lEi=C.or(C.greater(rte.key,0),C.greater(vPe.key,0));function cEi(a,i,e){if(e){let t=a.get(Te);if(e.source)t.publicLog2("workbenchActionExecuted",{id:i,from:e.source});else if(A.isUri(e))t.publicLog2("workbenchActionExecuted",{id:i,from:"cellEditorContextMenu"});else if(e&&"from"in e&&e.from==="cellContainer")t.publicLog2("workbenchActionExecuted",{id:i,from:"cellContainer"});else{let o=Smo(e)?"cellToolbar":Ude(e)?"editorToolbar":"other";t.publicLog2("workbenchActionExecuted",{id:i,from:o})}}}function Smo(a){return!!a&&!!a.notebookEditor&&a.$mid===13}function QXo(a){if(a===void 0)return!1;let i=a.ranges;return!(!i||!Array.isArray(i)||i.some(e=>!Jmi(e))||a.document&&!A.revive(a.document))}function SPe(a,i){let e=aUt(a,i)?.notebookEditor;if(e)return e;let t=Jn(a.get(ee).activeEditorPane);if(!(!t||!t.hasModel()))return t}function mG(a,...i){let e=i[0];if(QXo(e)){let o=SPe(a,e.document);if(!o)return;let r=e.ranges.map(l=>o.getCellsInRange(l).slice(0)).flat(),s=e.autoReveal;return{ui:!1,notebookEditor:o,selectedCells:r,autoReveal:s}}if(Jmi(e)){let o=i[1],n=SPe(a,o);return n?{ui:!1,notebookEditor:n,selectedCells:n.getCellsInRange(e)}:void 0}let t=ehe(a.get(ee));return t?{ui:!1,notebookEditor:t.notebookEditor,selectedCells:t.selectedCells??[],cell:t.cell}:void 0}var btt=[{isOptional:!0,name:"options",description:"The cell range options",schema:{type:"object",required:["ranges"],properties:{ranges:{type:"array",items:[{type:"object",required:["start","end"],properties:{start:{type:"number"},end:{type:"number"}}}]},document:{type:"object",description:"The document uri"},autoReveal:{type:"boolean",description:"Whether the cell should be revealed into view automatically"}}}}];ve.appendMenuItem(D.NotebookCellTitle,{submenu:D.NotebookCellInsert,title:d(12449,null),group:"2_insert",when:Xl.isEqualTo(!0)});ve.appendMenuItem(D.EditorContext,{submenu:D.NotebookCellTitle,title:d(12448,null),group:"2_insert",when:pr});ve.appendMenuItem(D.NotebookCellTitle,{title:d(12446,null),submenu:D.EditorContextShare,group:"4_share"});var the=Ae("notebook-kernel-select",R.serverEnvironment,d(12755,null)),hG=Ae("notebook-execute",R.play,d(12742,null)),Imo=Ae("notebook-execute-above",R.runAbove,d(12739,null)),ymo=Ae("notebook-execute-below",R.runBelow,d(12741,null)),lUt=Ae("notebook-stop",R.primitiveSquare,d(12758,null)),wmo=Ae("notebook-delete-cell",R.trash,d(12736,null)),Cmo=Ae("notebook-execute-all",R.runAll,d(12740,null)),xmo=Ae("notebook-edit",R.pencil,d(12737,null)),kmo=Ae("notebook-stop-edit",R.check,d(12757,null)),Emo=Ae("notebook-move-up",R.arrowUp,d(12747,null)),Tmo=Ae("notebook-move-down",R.arrowDown,d(12746,null)),dEi=Ae("notebook-clear",R.clearAll,d(12733,null)),_mo=Ae("notebook-split-cell",R.splitVertical,d(12756,null)),cUt=Ae("notebook-state-success",R.check,d(12759,null)),IPe=Ae("notebook-state-error",R.error,d(12738,null)),dUt=Ae("notebook-state-pending",R.clock,d(12750,null)),Qw=Ae("notebook-state-executing",R.sync,d(12743,null)),uUt=Ae("notebook-collapsed",R.chevronRight,d(12734,null)),pUt=Ae("notebook-expanded",R.chevronDown,d(12744,null)),Dmo=Ae("notebook-open-as-text",R.fileCode,d(12749,null)),ate=Ae("notebook-revert",R.discard,d(12753,null)),Lmo=Ae("notebook-diff-cell-toggle-whitespace",R.whitespace,d(12760,null)),Rmo=Ae("notebook-render-output",R.preview,d(12752,null)),mUt=Ae("notebook-mimetype",R.code,d(12745,null)),Stt=Ae("notebook-copy",R.copy,d(12735,null)),Mmo=Ae("notebook-save",R.save,d(12754,null)),Pmo=Ae("notebook-diff-editor-previous-change",R.arrowUp,d(12751,null)),Amo=Ae("notebook-diff-editor-next-change",R.arrowDown,d(12748,null)),hUt=Ae("variables-view-icon",R.variableGroup,d(12761,null));function Itt(a){return"kernel"in a}function YXo(a){return"kernels"in a}function gUt(a){return"action"in a}function Omo(a){return a.id==="installSuggested"&&"extensionIds"in a}function Fmo(a){return a.id==="install"}function Nmo(a){return"command"in a}function XXo(a){return"autoRun"in a&&!!a.autoRun}var Wmo=200;function uEi(a,i){let e={kernel:a,picked:a.id===i?.id,label:a.label,description:a.description,detail:a.detail};return a.id===i?.id&&(e.description?e.description=d(12807,null,e.description):e.description=d(12806,null)),e}var pEi=class{constructor(i,e,t,o,n,r,s,l,c){this._notebookKernelService=i;this._productService=e;this._quickInputService=t;this._labelService=o;this._logService=n;this._extensionWorkbenchService=r;this._extensionService=s;this._commandService=l;this._extensionManagementServerService=c}async showQuickPick(i,e,t){let o=i.textModel,n=i.scopedContextKeyService,r=this._getMatchingResult(o),{selected:s,all:l}=r,c;if(e){for(let S of l)if(S.id===e){c=S;break}if(!c)return this._logService.warn(`wanted kernel DOES NOT EXIST, wanted: ${e}, all: ${l.map(S=>S.id)}`),!1}if(c)return this._selecteKernel(o,c),!0;let u=new N,p=u.add(this._quickInputService.createQuickPick({useSeparators:!0})),h=this._getKernelPickerQuickPickItems(o,r,this._notebookKernelService,n);if(h.length===1&&XXo(h[0])&&!t){let S=await this._handleQuickPick(i,h[0],h);return u.dispose(),S}p.items=h,p.canSelectMany=!1,p.placeholder=s?d(12812,null,this._labelService.getUriLabel(o.uri,{relative:!0})):d(12813,null,this._labelService.getUriLabel(o.uri,{relative:!0})),p.busy=this._notebookKernelService.getKernelDetectionTasks(o).length>0;let g=this._notebookKernelService.onDidChangeKernelDetectionTasks(()=>{p.busy=this._notebookKernelService.getKernelDetectionTasks(o).length>0}),f=h.length===0?Ln(S=>this._showInstallKernelExtensionRecommendation(o,p,this._extensionWorkbenchService,S)):void 0,v=U.debounce(U.any(this._notebookKernelService.onDidChangeSourceActions,this._notebookKernelService.onDidAddKernel,this._notebookKernelService.onDidRemoveKernel,this._notebookKernelService.onDidChangeNotebookAffinity),(S,y)=>S,Wmo)(async()=>{p.busy=!1,f?.cancel();let S=p.activeItems,y=this._getMatchingResult(o),w=this._getKernelPickerQuickPickItems(o,y,this._notebookKernelService,n);p.keepScrollPosition=!0;let k=[];for(let T of S)if(Itt(T)){let P=T.kernel.id,O=w.find(V=>Itt(V)&&V.kernel.id===P);O&&k.push(O)}else if(gUt(T)){let P=w.find(O=>gUt(O)&&O.action.action.id===T.action.action.id);P&&k.push(P)}p.items=w,p.activeItems=k},this),b=await new Promise((S,y)=>{u.add(p.onDidAccept(()=>{let w=p.selectedItems[0];S(w?{selected:w,items:p.items}:{selected:void 0,items:p.items}),p.hide()})),u.add(p.onDidHide(()=>{g.dispose(),v.dispose(),p.dispose(),S({selected:void 0,items:p.items})})),p.show()});return u.dispose(),b.selected?await this._handleQuickPick(i,b.selected,b.items):!1}_getMatchingResult(i){return this._notebookKernelService.getMatchingKernel(i)}async _handleQuickPick(i,e,t){if(Itt(e)){let o=e.kernel;return this._selecteKernel(i.textModel,o),!0}return Fmo(e)?await this._showKernelExtension(this._extensionWorkbenchService,this._extensionService,this._extensionManagementServerService,i.textModel.viewType,[]):Omo(e)?await this._showKernelExtension(this._extensionWorkbenchService,this._extensionService,this._extensionManagementServerService,i.textModel.viewType,e.extensionIds,this._productService.quality!=="stable"):gUt(e)&&e.action.runAction(),!0}_selecteKernel(i,e){this._notebookKernelService.selectKernelForNotebook(e,i)}async _showKernelExtension(i,e,t,o,n,r){let s=[],l=[],c=[];for(let p of n){let h=(await i.getExtensions([{id:p}],Se.None))[0];if(h.enablementState===10||h.enablementState===11||h.enablementState===2)c.push(h);else if(!i.installed.some(g=>Ut(g.identifier,h.identifier)))await i.canInstall(h)===!0&&s.push(h);else if(t.remoteExtensionManagementServer){if(i.installed.some(g=>Ut(g.identifier,h.identifier)&&g.server===t.remoteExtensionManagementServer))continue;await i.canInstall(h)&&l.push(h)}}if(s.length||c.length||l.length){await Promise.all([...s.map(async p=>{await i.install(p,{installPreReleaseVersion:r??!1,context:{skipWalkthrough:!0}},15)}),...c.map(async p=>{switch(p.enablementState){case 11:await i.setEnablement([p],13);return;case 10:await i.setEnablement([p],12);return;case 2:await i.setEnablement([p],3);return;default:break}}),...l.map(async p=>{await i.installInServer(p,this._extensionManagementServerService.remoteExtensionManagementServer)})]),await e.activateByEvent(`onNotebook:${o}`);return}let u=o.split(/[^a-z0-9]/ig).map(Qse).join("");await i.openSearch(`@tag:notebookKernel${u}`)}async _showInstallKernelExtensionRecommendation(i,e,t,o){e.busy=!0;let n=await this._getKernelRecommendationsQuickPickItems(i,t);e.busy=!1,!o.isCancellationRequested&&n&&e.items.length===0&&(e.items=n)}async _getKernelRecommendationsQuickPickItems(i,e){let t=[],o=this.getSuggestedLanguage(i),n=o?this.getSuggestedKernelFromLanguage(i.viewType,o):void 0;if(n){if(await e.queryLocal(),e.installed.filter(s=>(s.enablementState===3||s.enablementState===12||s.enablementState===13)&&n.extensionIds.includes(s.identifier.id)).length===n.extensionIds.length)return;t.push({id:"installSuggested",description:n.displayName??n.extensionIds.join(", "),label:`$(${R.lightbulb.id}) `+d(12808,null),extensionIds:n.extensionIds})}return t.push({id:"install",label:d(12814,null)}),t}getSuggestedLanguage(i){let o=i.metadata?.metadata?.language_info?.name;if(!o){let n=i.cells.map(r=>r.language).filter(r=>r!=="markdown");if(n.length>1){let r=n[0];n.every(s=>s===r)&&(o=r)}}return o}getSuggestedKernelFromLanguage(i,e){return xDt.get(i)?.get(e)}},d8=class extends pEi{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,t,o,n,r,s,l,u,c);this._notebookKernelHistoryService=p;this._openerService=h}_getKernelPickerQuickPickItems(e,t,o,n){let r=[];if(t.selected){let l=uEi(t.selected,t.selected);r.push(l)}t.suggestions.filter(l=>l.id!==t.selected?.id).map(l=>uEi(l,t.selected)).forEach(l=>{r.push(l)});let s=r.length===0;return r.length>0&&r.push({type:"separator"}),r.push({id:"selectAnother",label:d(12817,null),autoRun:s}),r}_selecteKernel(e,t){let o=this._notebookKernelService.getMatchingKernel(e);o.selected&&this._notebookKernelHistoryService.addMostRecentKernel(o.selected),super._selecteKernel(e,t),this._notebookKernelHistoryService.addMostRecentKernel(t)}_getMatchingResult(e){let{selected:t,all:o}=this._notebookKernelHistoryService.getKernels(e),n=this._notebookKernelService.getMatchingKernel(e);return{selected:t,all:n.all,suggestions:o,hidden:[]}}async _handleQuickPick(e,t,o){return t.id==="selectAnother"?this.displaySelectAnotherQuickPick(e,o.length===1&&o[0]===t):super._handleQuickPick(e,t,o)}async displaySelectAnotherQuickPick(e,t){let o=e.textModel,n=new N,r=n.add(this._quickInputService.createQuickPick({useSeparators:!0})),s=await new Promise(l=>{r.title=t?d(12815,null):d(12816,null),r.placeholder=d(12818,null),r.busy=!0,r.buttons=[this._quickInputService.backButton],r.show(),n.add(r.onDidTriggerButton(c=>{c===this._quickInputService.backButton&&l(c)})),n.add(r.onDidTriggerItemButton(async c=>{if(Nmo(c.item)&&c.item.documentation!==void 0){let u=A.isUri(c.item.documentation)?A.parse(c.item.documentation):await this._commandService.executeCommand(c.item.documentation);u&&this._openerService.open(u,{openExternal:!0})}})),n.add(r.onDidAccept(async()=>{l(r.selectedItems[0])})),n.add(r.onDidHide(()=>{l(void 0)})),this._calculdateKernelSources(e).then(c=>{r.items=c,r.items.length>0&&(r.busy=!1)}),n.add(U.debounce(U.any(this._notebookKernelService.onDidChangeSourceActions,this._notebookKernelService.onDidAddKernel,this._notebookKernelService.onDidRemoveKernel),(c,u)=>c,Wmo)(async()=>{r.busy=!0;let c=await this._calculdateKernelSources(e);r.items=c,r.busy=!1}))});if(r.hide(),n.dispose(),s===this._quickInputService.backButton)return this.showQuickPick(e,void 0,!0);if(s){let l=s;if(Nmo(l))try{let c=await this._executeCommand(o,l.command);if(c){let{all:u}=await this._getMatchingResult(o),p=u.find(h=>h.id===`ms-toolsai.jupyter/${c}`);return p&&await this._selecteKernel(o,p),!0}else return this.displaySelectAnotherQuickPick(e,!1)}catch{return!1}else{if(Itt(l))return await this._selecteKernel(o,l.kernel),!0;if(YXo(l))return await this._selectOneKernel(o,l.label,l.kernels),!0;if(gUt(l))try{return await l.action.runAction(),!0}catch{return!1}else{if(Fmo(l))return await this._showKernelExtension(this._extensionWorkbenchService,this._extensionService,this._extensionManagementServerService,e.textModel.viewType,[]),!0;if(Omo(l))return await this._showKernelExtension(this._extensionWorkbenchService,this._extensionService,this._extensionManagementServerService,e.textModel.viewType,l.extensionIds,this._productService.quality!=="stable"),this.displaySelectAnotherQuickPick(e,!1)}}}return!1}async _calculdateKernelSources(e){let t=e.textModel,o=this._notebookKernelService.getSourceActions(t,e.scopedContextKeyService),n=await this._notebookKernelService.getKernelSourceActions2(t),r=this._getMatchingResult(t);if(o.length===0&&r.all.length===0&&n.length===0)return await this._getKernelRecommendationsQuickPickItems(t,this._extensionWorkbenchService)??[];let s=r.all.filter(u=>u.extension.value!==AEe),l=[];for(let u of Jg(s,(p,h)=>p.extension.value===h.extension.value?0:1)){let p=this._extensionService.extensions.find(g=>g.identifier.value===u[0].extension.value),h=p?.displayName??p?.description??u[0].extension.value;u.length>1?l.push({label:h,kernels:u}):l.push({label:u[0].label,kernel:u[0]})}let c=n.filter(u=>u.command);l.push(...c.map(u=>{let p=u.documentation?[{iconClass:q.asClassName(R.info),tooltip:d(12811,null)}]:[];return{id:typeof u.command=="string"?u.command:u.command.id,label:u.label,description:u.description,command:u.command,documentation:u.documentation,buttons:p}}));for(let u of o){let p={action:u,picked:!1,label:u.action.label,tooltip:u.action.tooltip};l.push(p)}return l}async _selectOneKernel(e,t,o){let n=o.map(l=>uEi(l,void 0)),r=new N,s=r.add(this._quickInputService.createQuickPick({useSeparators:!0}));s.items=n,s.canSelectMany=!1,s.title=d(12819,null,t),r.add(s.onDidAccept(async()=>{s.selectedItems&&s.selectedItems.length>0&&Itt(s.selectedItems[0])&&await this._selecteKernel(e,s.selectedItems[0].kernel),s.hide(),s.dispose()})),r.add(s.onDidHide(()=>{r.dispose()})),s.show()}async _executeCommand(e,t){let o=typeof t=="string"?t:t.id,n=typeof t=="string"?[]:t.arguments??[];return(typeof t=="string"||!t.arguments||!Array.isArray(t.arguments)||t.arguments.length===0)&&n.unshift({uri:e.uri,$mid:14}),typeof t=="string"?this._commandService.executeCommand(o):this._commandService.executeCommand(o,...n)}static updateKernelStatusAction(e,t,o,n){if(o.getKernelDetectionTasks(e).length){let u=o.getMatchingKernel(e);if(t.enabled=!0,t.class=q.asClassName(q.modify(Qw,"spin")),u.selected){t.label=u.selected.label;let p=u.selected.description??u.selected.detail;t.tooltip=p?d(12810,null,p):d(12809,null)}else t.label=d(12809,null);return}let s=o.getRunningSourceActions(e),l=(u,p)=>{let h=u.action;t.class=p?q.asClassName(q.modify(Qw,"spin")):q.asClassName(the),t.label=h.label,t.enabled=!0};if(s.length)return l(s[0],!0);let{selected:c}=n.getKernels(e);c?(t.label=c.label,t.class=q.asClassName(the),t.tooltip=c.description??c.detail??""):(t.label=d(12815,null),t.class=q.asClassName(the),t.tooltip="")}static async resolveKernel(e,t,o,n){let r=o.getKernels(e);if(r.selected)return r.selected;await n.executeCommand(NT);let{selected:s}=o.getKernels(e);return s}};d8=I([m(0,Ol),m(1,tt),m(2,Ue),m(3,rt),m(4,se),m(5,Hi),m(6,lt),m(7,Ec),m(8,ge),m(9,eM),m(10,Je)],d8);function JXo(a,i){let e;if(i!==void 0&&"notebookEditorId"in i){let t=i.notebookEditorId,o=a.visibleEditorPanes.find(n=>Jn(n)?.getId()===t);e=Jn(o)}else i!==void 0&&"notebookEditor"in i?e=i?.notebookEditor:e=Jn(a.activeEditorPane);return e}function ZXo(a,i,e,t){return!!(a&&(t&&"skipIfAlreadySelected"in t&&t.skipIfAlreadySelected||i&&a.id===i&&Ii.equals(a.extension,e)))}W(class extends K{constructor(){super({id:NT,category:th,title:L(12820,"Select Notebook Kernel"),icon:the,f1:!0,precondition:Za,menu:[{id:D.EditorTitle,when:C.and(Za,C.notEquals("config.notebook.globalToolbar",!0)),group:"navigation",order:-10},{id:D.NotebookToolbar,when:C.equals("config.notebook.globalToolbar",!0),group:"status",order:-10},{id:D.InteractiveToolbar,when:rte.notEqualsTo(0),group:"status",order:-10}],metadata:{description:d(12821,null),args:[{name:"kernelInfo",description:"The kernel info",schema:{type:"object",required:["id","extension"],properties:{id:{type:"string"},extension:{type:"string"},notebookEditorId:{type:"string"}}}}]}})}async run(a,i){let e=a.get(F),t=a.get(ee),o=JXo(t,i);if(!o||!o.hasModel())return!1;let n=i&&"id"in i?i.id:void 0,r=i&&"extension"in i?i.extension:void 0;n&&(typeof n!="string"||typeof r!="string")&&(n=void 0,r=void 0);let s=o.textModel,l=a.get(Ol),{selected:c}=l.getMatchingKernel(s);if(ZXo(c,n,r,i))return!0;let u=n?`${r}/${n}`:void 0;return e.createInstance(d8).showQuickPick(o,u)}});var HH=class extends hs{constructor(e,t,o,n,r){let s=new it("fakeAction",void 0,q.asClassName(the),!0,l=>e.run(l));super(void 0,s,{...o,label:!1,icon:!0});this._editor=t;this._notebookKernelService=n;this._notebookKernelHistoryService=r;this._register(s),this._register(t.onDidChangeModel(this._update,this)),this._register(n.onDidAddKernel(this._update,this)),this._register(n.onDidRemoveKernel(this._update,this)),this._register(n.onDidChangeNotebookAffinity(this._update,this)),this._register(n.onDidChangeSelectedNotebooks(this._update,this)),this._register(n.onDidChangeSourceActions(this._update,this)),this._register(n.onDidChangeKernelDetectionTasks(this._update,this))}render(e){this._update(),super.render(e),e.classList.add("kernel-action-view-item"),this._kernelLabel=document.createElement("a"),e.appendChild(this._kernelLabel),this.updateLabel()}updateLabel(){this._kernelLabel&&(this._kernelLabel.classList.add("kernel-label"),this._kernelLabel.innerText=this._action.label)}_update(){let e=this._editor.textModel;if(!e){this._resetAction();return}d8.updateKernelStatusAction(e,this._action,this._notebookKernelService,this._notebookKernelHistoryService),this.updateClass()}_resetAction(){this._action.enabled=!1,this._action.label="",this._action.class=""}};HH=I([m(3,Ol),m(4,eM)],HH);var fUt=class{constructor(){this._marks={}}get value(){return{...this._marks}}mark(i){if(this._marks[i]){console.error(`Skipping overwrite of notebook perf value: ${i}`);return}this._marks[i]=Date.now()}};var mEi="vscode://schemas/extensions",Vmo={id:mEi,allowComments:!0,allowTrailingCommas:!0,type:"object",title:d(10703,null),additionalProperties:!1,properties:{recommendations:{type:"array",description:d(10702,null),items:{type:"string",pattern:vF,errorMessage:d(10701,null)}},unwantedRecommendations:{type:"array",description:d(10704,null),items:{type:"string",pattern:vF,errorMessage:d(10701,null)}}}},hEi=["{","	// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.","	// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp","","	// List of extensions which should be recommended for users of this workspace.",'	"recommendations": [',"		","	],","	// List of extensions recommended by VS Code that should not be recommended for users of this workspace.",'	"unwantedRecommendations": [',"		","	]","}"].join(`
`);var Bmo=Ae("extensions-view-icon",R.extensions,d(10503,null)),ihe=Ae("extensions-manage",R.gear,d(10510,null)),Hmo=Ae("extensions-clear-search-results",R.clearAll,d(10500,null)),Umo=Ae("extensions-refresh",R.refresh,d(10513,null)),vUt=Ae("extensions-filter",R.filter,d(10504,null)),zmo=Ae("extensions-install-local-in-remote",R.cloudDownload,d(10507,null)),gEi=Ae("extensions-install-workspace-recommended",R.cloudDownload,d(10508,null)),Kmo=Ae("extensions-configure-recommended",R.pencil,d(10501,null)),Gmo=Ae("extensions-sync-enabled",R.sync,d(10520,null)),ytt=Ae("extensions-sync-ignored",R.syncIgnored,d(10521,null)),qmo=Ae("extensions-remote",R.remote,d(10514,null)),fEi=Ae("extensions-install-count",R.cloudDownload,d(10506,null)),vEi=Ae("extensions-private",R.lock,d(10509,null)),$mo=Ae("extensions-rating",R.star,d(10512,null)),bEi=Ae("extensions-pre-release",R.versions,d(10511,null)),wtt=Ae("extensions-sponsor",R.heartFilled,d(10516,null)),Ctt=Ae("extensions-star-full",R.starFull,d(10518,null)),jmo=Ae("extensions-star-half",R.starHalf,d(10519,null)),bUt=Ae("extensions-star-empty",R.starEmpty,d(10517,null)),OS=Ae("extensions-error-message",R.error,d(10502,null)),Gu=Ae("extensions-warning-message",R.warning,d(10523,null)),Ug=Ae("extensions-info-message",R.info,d(10505,null)),IM=Ae("extension-workspace-trust",R.shield,d(10522,null)),Qmo=Ae("extension-activation-time",R.history,d(10499,null)),Ymo=Ae("extension-restart-required",R.refresh,d(10515,null));var gG=le("issueFormService"),OT=le("workbenchIssueService");var lte=class extends it{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super("extension.promptExtensionInstallFailure");this.extension=e;this.options=t;this.version=o;this.installOperation=n;this.error=r;this.productService=s;this.openerService=l;this.notificationService=c;this.dialogService=u;this.commandService=p;this.logService=h;this.extensionManagementServerService=g;this.instantiationService=f;this.galleryService=v;this.extensionManifestPropertiesService=b;this.workbenchIssueService=S}async run(){if(ao(this.error))return;if(this.logService.error(this.error),this.error.name==="Unsupported"){let s=Wt?d(10484,null,this.productService.nameLong):this.productService.nameLong,l=d(10340,null,this.extension.displayName||this.extension.identifier.id,s),{confirmed:c}=await this.dialogService.confirm({type:ft.Info,message:l,primaryButton:d(10433,null),cancelButton:d(10342,null)});c&&this.openerService.open(Wt?A.parse("https://aka.ms/vscode-web-extensions-guide"):A.parse("https://aka.ms/vscode-remote"));return}if("ReleaseVersionNotFound"===this.error.name){await this.dialogService.prompt({type:"error",message:Pn(this.error),buttons:[{label:d(10412,null),run:()=>{let s=this.instantiationService.createInstance(Yw,{installPreReleaseVersion:!0});return s.extension=this.extension,s.run()}}],cancelButton:d(10338,null)});return}if(["Incompatible","IncompatibleApi","IncompatibleTargetPlatform","Malicious","Deprecated"].includes(this.error.name)){await this.dialogService.info(Pn(this.error));return}if("PackageNotSigned"===this.error.name){await this.dialogService.prompt({type:"error",message:d(10436,null,this.extension.displayName),detail:Pn(this.error),buttons:[{label:d(10398,null),run:()=>{let s=this.instantiationService.createInstance(Yw,{...this.options,donotVerifySignature:!0});return s.extension=this.extension,s.run()}}],cancelButton:!0});return}if("SignatureVerificationFailed"===this.error.name){await this.dialogService.prompt({type:"error",message:d(10483,null,this.extension.displayName,this.productService.nameLong),detail:Pn(this.error),buttons:[{label:d(10425,null),run:()=>this.openerService.open("https://code.visualstudio.com/docs/editor/extension-marketplace#_the-extension-signature-cannot-be-verified-by-vs-code")},{label:d(10401,null),run:()=>{let s=this.instantiationService.createInstance(Yw,{...this.options,donotVerifySignature:!0});return s.extension=this.extension,s.run()}}],cancelButton:!0});return}if("SignatureVerificationInternal"===this.error.name){await this.dialogService.prompt({type:"error",message:d(10483,null,this.extension.displayName,this.productService.nameLong),detail:Pn(this.error),buttons:[{label:d(10425,null),run:()=>this.openerService.open("https://code.visualstudio.com/docs/editor/extension-marketplace#_the-extension-signature-cannot-be-verified-by-vs-code")},{label:d(10442,null),run:()=>this.workbenchIssueService.openReporter({issueTitle:d(10444,null,this.extension.displayName),issueBody:d(10443,null)})},{label:d(10401,null),run:()=>{let s=this.instantiationService.createInstance(Yw,{...this.options,donotVerifySignature:!0});return s.extension=this.extension,s.run()}}],cancelButton:!0});return}let e=this.installOperation===3?d(10475,null,this.extension.displayName||this.extension.identifier.id):d(10409,null,this.extension.displayName||this.extension.identifier.id),t,o=[],n=await this.getDownloadUrl();n&&(t=d(10341,null,fc(T2).toString()),o.push({label:d(10365,null),run:()=>this.openerService.open(n).then(()=>{this.notificationService.prompt(ft.Info,d(10416,null,this.extension.identifier.id),[{label:d(10424,null),run:()=>this.commandService.executeCommand(vMt)}])})}));let r=`${e}${t?` ${t}`:""}`;this.notificationService.prompt(ft.Error,r,o)}async getDownloadUrl(){if(dc||!this.extension.gallery||!this.extensionManagementServerService.localExtensionManagementServer&&!this.extensionManagementServerService.remoteExtensionManagementServer)return;let e=this.extension.gallery.properties.targetPlatform;if(e!=="universal"&&e!=="undefined"&&this.extensionManagementServerService.remoteExtensionManagementServer)try{let o=await this.galleryService.getManifest(this.extension.gallery,Se.None);o&&this.extensionManifestPropertiesService.prefersExecuteOnWorkspace(o)&&(e=await this.extensionManagementServerService.remoteExtensionManagementServer.extensionManagementService.getTargetPlatform())}catch(o){this.logService.error(o);return}if(e==="unknown")return;let[t]=await this.galleryService.getExtensions([{...this.extension.identifier,version:this.version}],{targetPlatform:e},Se.None);if(t)return A.parse(t.assets.download.uri)}};lte=I([m(5,tt),m(6,Je),m(7,Ne),m(8,at),m(9,ge),m(10,se),m(11,Ec),m(12,F),m(13,fa),m(14,Gp),m(15,OT)],lte);var Sa=class a extends it{constructor(){super(...arguments);this._onDidChange=this._register(new E);this._extension=null;this._hidden=!1;this.hideOnDisabled=!0}get onDidChange(){return this._onDidChange.event}static{this.EXTENSION_ACTION_CLASS="extension-action"}static{this.TEXT_ACTION_CLASS=`${a.EXTENSION_ACTION_CLASS} text`}static{this.LABEL_ACTION_CLASS=`${a.EXTENSION_ACTION_CLASS} label`}static{this.ICON_ACTION_CLASS=`${a.EXTENSION_ACTION_CLASS} icon`}get extension(){return this._extension}set extension(e){this._extension=e,this.update()}get hidden(){return this._hidden}set hidden(e){this._hidden!==e&&(this._hidden=e,this._onDidChange.fire({hidden:e}))}_setEnabled(e){super._setEnabled(e),this.hideOnDisabled&&(this.hidden=!e)}},IG=class extends Sa{constructor(e,t,o){t=`${t} action-dropdown`;super(e,void 0,t);this.actionsGroups=o;this.menuActionClassNames=[];this._menuActions=[];this.menuActionClassNames=t.split(" "),this.hideOnDisabled=!1,this.extensionActions=o.flat(),this.update(),this._register(U.any(...this.extensionActions.map(n=>n.onDidChange))(()=>this.update(!0))),this.extensionActions.forEach(n=>this._register(n))}get menuActions(){return[...this._menuActions]}get extension(){return super.extension}set extension(e){this.extensionActions.forEach(t=>t.extension=e),super.extension=e}update(e){e||this.extensionActions.forEach(n=>n.update());let t=this.actionsGroups.map(n=>n.filter(r=>!r.hidden)),o=[];for(let n of t)n.length&&(o=[...o,...n,new ri]);o=o.length?o.slice(0,o.length-1):o,this.primaryAction=o[0],this._menuActions=o.length>1?o:[],this._onDidChange.fire({menuActions:this._menuActions}),this.primaryAction?(this.hidden=!1,this.enabled=this.primaryAction.enabled,this.label=this.getLabel(this.primaryAction),this.tooltip=this.primaryAction.tooltip):(this.hidden=!0,this.enabled=!1)}async run(){this.enabled&&await this.primaryAction?.run()}getLabel(e){return e.label}},TPe=class extends IY{constructor(i,e,t){super(null,i,e,t),this._register(i.onDidChange(o=>{(o.hidden!==void 0||o.menuActions!==void 0)&&this.updateClass()}))}render(i){super.render(i),this.updateClass()}updateClass(){if(super.updateClass(),this.element&&this.dropdownMenuActionViewItem?.element){this.element.classList.toggle("hide",this._action.hidden);let i=this._action.menuActions.length===0;this.element.classList.toggle("empty",i),this.dropdownMenuActionViewItem.element.classList.toggle("hide",i)}}},Yw=class extends Sa{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super("extensions.install",d(10396,null),Yw.CLASS,!1);this.extensionsWorkbenchService=t;this.instantiationService=o;this.runtimeExtensionService=n;this.workbenchThemeService=r;this.labelService=s;this.dialogService=l;this.preferencesService=c;this.telemetryService=u;this.contextService=p;this.allowedExtensionsService=h;this.extensionGalleryManifestService=g;this._manifest=null;this.updateThrottler=this._register(new gu);this.hideOnDisabled=!1,this.options={isMachineScoped:!1,...e},this.update(),this._register(h.onDidChangeAllowedExtensionsConfigValue(()=>this.update())),this._register(this.labelService.onDidChangeFormatters(()=>this.updateLabel(),this))}static{this.CLASS=`${this.LABEL_ACTION_CLASS} prominent install`}static{this.HIDE=`${this.CLASS} hide`}set manifest(e){this._manifest=e,this.updateLabel()}update(){this.updateThrottler.queue(()=>this.computeAndUpdateEnablement())}async computeAndUpdateEnablement(){this.enabled=!1,this.class=Yw.HIDE,this.hidden=!0,this.extension&&(this.extension.isBuiltin||this.extensionsWorkbenchService.canSetLanguage(this.extension)||this.extension.state===3&&(this.options.installPreReleaseVersion&&(!this.extension.hasPreReleaseVersion||this.allowedExtensionsService.isAllowed({id:this.extension.identifier.id,publisherDisplayName:this.extension.publisherDisplayName,prerelease:!0})!==!0)||!this.options.installPreReleaseVersion&&!this.extension.hasReleaseVersion||(this.hidden=!1,this.class=Yw.CLASS,await this.extensionsWorkbenchService.canInstall(this.extension)===!0&&(this.enabled=!0,this.updateLabel()))))}async run(){if(!this.extension)return;if(this.extension.gallery&&!this.extension.gallery.isSigned&&CQe(this.extension.private,await this.extensionGalleryManifestService.getExtensionGalleryManifest())){let{result:t}=await this.dialogService.prompt({type:ft.Warning,message:d(10436,null,this.extension.displayName),detail:d(10437,null),buttons:[{label:d(10398,null),run:()=>(this.options.donotVerifySignature=!0,!0)}],cancelButton:{run:()=>!1}});if(!t)return}if(this.extension.deprecationInfo){let t=d(10349,null),o;(p=>(p[p.InstallAnyway=0]="InstallAnyway",p[p.ShowAlternateExtension=1]="ShowAlternateExtension",p[p.ConfigureSettings=2]="ConfigureSettings",p[p.Cancel=3]="Cancel"))(o||={});let n=[{label:d(10398,null),run:()=>0}];if(this.extension.deprecationInfo.extension){t=d(10351,null,this.extension.deprecationInfo.extension.displayName);let s=this.extension.deprecationInfo.extension;n.push({label:d(10457,null,this.extension.deprecationInfo.extension.displayName),run:async()=>{let[l]=await this.extensionsWorkbenchService.getExtensions([{id:s.id,preRelease:s.preRelease}],Se.None);return await this.extensionsWorkbenchService.open(l),1}})}else if(this.extension.deprecationInfo.settings){t=d(10353,null);let s=this.extension.deprecationInfo.settings;n.push({label:d(10343,null),run:async()=>(await this.preferencesService.openSettings({query:s.map(l=>`@id:${l}`).join(" ")}),2)})}else this.extension.deprecationInfo.additionalInfo&&(t=new Ie(`${t} ${this.extension.deprecationInfo.additionalInfo}`));let{result:r}=await this.dialogService.prompt({type:ft.Warning,message:d(10400,null,this.extension.displayName),detail:Fe(t)?t:void 0,custom:Fe(t)?void 0:{markdownDetails:[{markdown:t}]},buttons:n,cancelButton:{run:()=>3}});if(r!==0)return}this.extensionsWorkbenchService.open(this.extension,{showPreReleaseVersion:this.options.installPreReleaseVersion}),en(d(10420,null,this.extension.displayName)),this.telemetryService.publicLog("extensions:action:install",{...this.extension.telemetryData,actionId:this.id});let e=await this.install(this.extension);if(e?.local){en(d(10419,null,this.extension.displayName));let t=await this.getRunningExtension(e.local);if(t&&!(t.activationEvents&&t.activationEvents.some(o=>o.startsWith("onLanguage")))){let o=await this.getThemeAction(e);if(o){o.extension=e;try{return o.run({showCurrentTheme:!0,ignoreFocusLost:!0})}finally{o.dispose()}}}}}async getThemeAction(e){if((await this.workbenchThemeService.getColorThemes()).some(r=>SG(r,e)))return this.instantiationService.createInstance(Hk);if((await this.workbenchThemeService.getFileIconThemes()).some(r=>SG(r,e)))return this.instantiationService.createInstance(Uk);if((await this.workbenchThemeService.getProductIconThemes()).some(r=>SG(r,e)))return this.instantiationService.createInstance(zk)}async install(e){try{return await this.extensionsWorkbenchService.install(e,this.options)}catch(t){await this.instantiationService.createInstance(lte,e,this.options,e.latestVersion,2,t).run();return}}async getRunningExtension(e){let t=await this.runtimeExtensionService.getExtension(e.identifier.id);return t||(this.runtimeExtensionService.canAddExtension(bF(e))?new Promise((o,n)=>{let r=this.runtimeExtensionService.onDidChangeExtensions(async()=>{let s=await this.runtimeExtensionService.getExtension(e.identifier.id);s&&(r.dispose(),o(s))})}):null)}updateLabel(){this.label=this.getLabel()}getLabel(e){return this.extension?.isWorkspaceScoped&&this.extension.resourceExtension&&this.contextService.isInsideWorkspace(this.extension.resourceExtension.location)?d(10417,null):this.options.installPreReleaseVersion&&this.extension?.hasPreReleaseVersion?e?d(10410,null):d(10411,null):this.extension?.hasPreReleaseVersion?e?d(10396,null):d(10414,null):d(10396,null)}};Yw=I([m(1,Hi),m(2,F),m(3,lt),m(4,sp),m(5,rt),m(6,at),m(7,Go),m(8,Te),m(9,Pe),m(10,dm),m(11,Dv)],Yw);var cte=class extends IG{set manifest(i){this.extensionActions.forEach(e=>e.manifest=i),this.update()}constructor(i,e){super("extensions.installActions",Yw.CLASS,[[i.createInstance(Yw,{installPreReleaseVersion:e.preferPreReleases}),i.createInstance(Yw,{installPreReleaseVersion:!e.preferPreReleases})]])}getLabel(i){return i.getLabel(!0)}};cte=I([m(0,F),m(1,ru)],cte);var _Pe=class a extends Sa{static{this.LABEL=d(10421,null)}static{this.CLASS=`${Sa.LABEL_ACTION_CLASS} install installing`}constructor(){super("extension.installing",a.LABEL,a.CLASS,!1)}update(){this.class=`${a.CLASS}${this.extension&&this.extension.state===0?"":" hide"}`}},yM=class extends Sa{constructor(e,t,o,n,r,s){super(e,yM.INSTALL_LABEL,yM.Class,!1);this.server=t;this.canInstallAnyWhere=o;this.extensionsWorkbenchService=n;this.extensionManagementServerService=r;this.extensionManifestPropertiesService=s;this.updateWhenCounterExtensionChanges=!0;this.update()}static{this.INSTALL_LABEL=d(10396,null)}static{this.INSTALLING_LABEL=d(10421,null)}static{this.Class=`${Sa.LABEL_ACTION_CLASS} prominent install-other-server`}static{this.InstallingClass=`${Sa.LABEL_ACTION_CLASS} install-other-server installing`}update(){if(this.enabled=!1,this.class=yM.Class,this.canInstall()){let e=this.extensionsWorkbenchService.installed.filter(t=>Ut(t.identifier,this.extension.identifier)&&t.server===this.server)[0];e?e.state===0&&!e.local&&(this.enabled=!0,this.label=yM.INSTALLING_LABEL,this.class=yM.InstallingClass):(this.enabled=!0,this.label=this.getInstallLabel())}}canInstall(){return!this.extension||!this.server||!this.extension.local||this.extension.state!==1||this.extension.type!==1||this.extension.enablementState===2||this.extension.enablementState===0||this.extension.enablementState===5?!1:!!(IR(this.extension.local.manifest)||this.server===this.extensionManagementServerService.localExtensionManagementServer&&this.extensionManifestPropertiesService.prefersExecuteOnUI(this.extension.local.manifest)||this.server===this.extensionManagementServerService.remoteExtensionManagementServer&&this.extensionManifestPropertiesService.prefersExecuteOnWorkspace(this.extension.local.manifest)||this.server===this.extensionManagementServerService.webExtensionManagementServer&&this.extensionManifestPropertiesService.prefersExecuteOnWeb(this.extension.local.manifest)||this.canInstallAnyWhere&&(this.server===this.extensionManagementServerService.localExtensionManagementServer&&this.extensionManifestPropertiesService.canExecuteOnUI(this.extension.local.manifest)||this.server===this.extensionManagementServerService.remoteExtensionManagementServer&&this.extensionManifestPropertiesService.canExecuteOnWorkspace(this.extension.local.manifest)))}async run(){if(this.extension?.local&&this.extension?.server&&this.server)return this.extensionsWorkbenchService.open(this.extension),en(d(10420,null,this.extension.displayName)),this.extensionsWorkbenchService.installInServer(this.extension,this.server)}};yM=I([m(3,Hi),m(4,Ec),m(5,Gp)],yM);var u8=class extends yM{constructor(i,e,t,o){super("extensions.remoteinstall",t.remoteExtensionManagementServer,i,e,t,o)}getInstallLabel(){return this.extensionManagementServerService.remoteExtensionManagementServer?d(10403,null,this.extensionManagementServerService.remoteExtensionManagementServer.label):yM.INSTALL_LABEL}};u8=I([m(1,Hi),m(2,Ec),m(3,Gp)],u8);var dte=class extends yM{constructor(i,e,t){super("extensions.localinstall",e.localExtensionManagementServer,!1,i,e,t)}getInstallLabel(){return d(10408,null)}};dte=I([m(0,Hi),m(1,Ec),m(2,Gp)],dte);var ute=class extends yM{constructor(i,e,t){super("extensions.webInstall",e.webExtensionManagementServer,!1,i,e,t)}getInstallLabel(){return d(10399,null)}};ute=I([m(0,Hi),m(1,Ec),m(2,Gp)],ute);var FT=class extends Sa{constructor(e,t,o){super("extensions.uninstall",FT.UninstallLabel,FT.UninstallClass,!1);this.extensionsWorkbenchService=e;this.userDataProfilesService=t;this.dialogService=o;this.update()}static{this.UninstallLabel=d(10468,null)}static{this.UninstallingLabel=d(10473,null)}static{this.UninstallClass=`${Sa.LABEL_ACTION_CLASS} uninstall`}static{this.UnInstallingClass=`${Sa.LABEL_ACTION_CLASS} uninstall uninstalling`}update(){if(!this.extension){this.enabled=!1;return}let e=this.extension.state;if(e===2){this.label=FT.UninstallingLabel,this.class=FT.UnInstallingClass,this.enabled=!1;return}if(this.label=this.extension.local?.isApplicationScoped&&this.userDataProfilesService.profiles.length>1?d(10469,null):FT.UninstallLabel,this.class=FT.UninstallClass,this.tooltip=FT.UninstallLabel,e!==1){this.enabled=!1;return}if(this.extension.isBuiltin){this.enabled=!1;return}this.enabled=!0}async run(){if(this.extension){en(d(10472,null,this.extension.displayName));try{await this.extensionsWorkbenchService.uninstall(this.extension),en(d(10471,null,this.extension.displayName))}catch(e){ao(e)||this.dialogService.error(Pn(e))}}}};FT=I([m(0,Hi),m(1,an),m(2,at)],FT);var YA=class extends Sa{constructor(e,t,o,n,r){super("extensions.update",d(10474,null),YA.DisabledClass,!1);this.verbose=e;this.extensionsWorkbenchService=t;this.dialogService=o;this.openerService=n;this.instantiationService=r;this.updateThrottler=this._register(new gu);this.update()}static{this.EnabledClass=`${this.LABEL_ACTION_CLASS} update`}static{this.DisabledClass=`${this.EnabledClass} disabled`}update(){this.updateThrottler.queue(()=>this.computeAndUpdateEnablement()),this.extension&&(this.label=this.verbose?d(10477,null,this.extension.latestVersion):d(10474,null))}async computeAndUpdateEnablement(){if(this.enabled=!1,this.class=YA.DisabledClass,!this.extension||this.extension.deprecationInfo)return;let e=await this.extensionsWorkbenchService.canInstall(this.extension),t=this.extension.state===1;this.enabled=e===!0&&t&&this.extension.outdated,this.class=this.enabled?YA.EnabledClass:YA.DisabledClass}async run(){if(!this.extension)return;let e=await this.extensionsWorkbenchService.shouldRequireConsentToUpdate(this.extension);if(e){let{result:o}=await this.dialogService.prompt({type:"warning",title:d(10481,null,this.extension.displayName),message:d(10480,null,e),buttons:[{label:d(10474,null),run:()=>"update"},{label:d(10447,null),run:()=>"review"},{label:d(10338,null),run:()=>"cancel"}]});if(o==="cancel")return;if(o==="review")return this.extension.hasChangelog()?this.extensionsWorkbenchService.open(this.extension,{tab:"changelog"}):this.extension.repository?this.openerService.open(this.extension.repository):this.extensionsWorkbenchService.open(this.extension)}let t={};this.extension.local?.source==="vsix"&&this.extension.local.pinned&&(t.pinned=!1),this.extension.local?.preRelease&&(t.installPreReleaseVersion=!0);try{en(d(10482,null,this.extension.displayName,this.extension.latestVersion)),await this.extensionsWorkbenchService.install(this.extension,t),en(d(10479,null,this.extension.displayName,this.extension.latestVersion))}catch(o){this.instantiationService.createInstance(lte,this.extension,t,this.extension.latestVersion,3,o).run()}}};YA=I([m(1,Hi),m(2,at),m(3,Je),m(4,F)],YA);var fx=class extends Sa{constructor(e,t,o,n){super(fx.ID,fx.LABEL.value,fx.DisabledClass);this.extensionsWorkbenchService=e;this.extensionEnablementService=t;this.allowedExtensionsService=o;this._register(n.onDidChangeConfiguration(r=>{r.affectsConfiguration(Fw)&&this.update()})),this._register(o.onDidChangeAllowedExtensionsConfigValue(r=>this.update())),this.update()}static{this.ID="workbench.extensions.action.toggleAutoUpdateForExtension"}static{this.LABEL=L(10367,"Auto Update")}static{this.EnabledClass=`${Sa.EXTENSION_ACTION_CLASS} auto-update`}static{this.DisabledClass=`${this.EnabledClass} hide`}update(){if(this.enabled=!1,this.class=fx.DisabledClass,!this.extension||this.extension.isBuiltin||this.extension.deprecationInfo?.disallowInstall)return;let e=this.extension.local??this.extension.gallery;e&&this.allowedExtensionsService.isAllowed(e)!==!0||this.extensionsWorkbenchService.getAutoUpdateValue()==="onlyEnabledExtensions"&&!this.extensionEnablementService.isEnabledEnablementState(this.extension.enablementState)||(this.enabled=!0,this.class=fx.EnabledClass,this.checked=this.extensionsWorkbenchService.isAutoUpdateEnabledFor(this.extension))}async run(){if(!this.extension)return;let e=!this.extensionsWorkbenchService.isAutoUpdateEnabledFor(this.extension);await this.extensionsWorkbenchService.updateAutoUpdateEnablementFor(this.extension,e),e?en(d(10366,null,this.extension.displayName)):en(d(10355,null,this.extension.displayName))}};fx=I([m(0,Hi),m(1,Js),m(2,dm),m(3,B)],fx);var X0=class extends Sa{constructor(e){super(X0.ID,X0.LABEL);this.extensionsWorkbenchService=e}static{this.ID="workbench.extensions.action.toggleAutoUpdatesForPublisher"}static{this.LABEL=d(10463,null)}update(){}async run(){if(!this.extension)return;en(d(10395,null,this.extension.publisherDisplayName));let e=!this.extensionsWorkbenchService.isAutoUpdateEnabledFor(this.extension.publisher);await this.extensionsWorkbenchService.updateAutoUpdateEnablementFor(this.extension.publisher,e),e?en(d(10366,null,this.extension.displayName)):en(d(10355,null,this.extension.displayName))}};X0=I([m(0,Hi)],X0);var J0=class extends Sa{constructor(e,t){super("extensionsAction.migrateDeprecatedExtension",d(10431,null),J0.DisabledClass,!1);this.small=e;this.extensionsWorkbenchService=t;this.update()}static{this.EnabledClass=`${Sa.LABEL_ACTION_CLASS} migrate`}static{this.DisabledClass=`${this.EnabledClass} disabled`}update(){if(this.enabled=!1,this.class=J0.DisabledClass,!this.extension?.local||this.extension.state!==1||!this.extension.deprecationInfo?.extension)return;let e=this.extension.deprecationInfo.extension.id;this.extensionsWorkbenchService.local.some(t=>Ut(t.identifier,{id:e}))||(this.enabled=!0,this.class=J0.EnabledClass,this.tooltip=d(10430,null,this.extension.deprecationInfo.extension.displayName),this.label=this.small?d(10429,null):this.tooltip)}async run(){if(!this.extension?.deprecationInfo?.extension)return;let e=this.extension.local;await this.extensionsWorkbenchService.uninstall(this.extension);let[t]=await this.extensionsWorkbenchService.getExtensions([{id:this.extension.deprecationInfo.extension.id,preRelease:this.extension.deprecationInfo?.extension?.preRelease}],Se.None);await this.extensionsWorkbenchService.install(t,{isMachineScoped:e?.isMachineScoped})}};J0=I([m(1,Hi)],J0);var UH=class extends Sa{constructor(e,t,o,n,r){super(e,t,o,n);this.instantiationService=r;this._actionViewItem=null}createActionViewItem(e){return this._actionViewItem=this.instantiationService.createInstance(xtt,this,e),this._actionViewItem}run(e){return this._actionViewItem?.showMenu(e),Promise.resolve()}};UH=I([m(4,F)],UH);var xtt=class extends hs{constructor(e,t,o){super(null,e,{...t,icon:!0,label:!0});this.contextMenuService=o}showMenu(e){if(this.element){let t=this.getActions(e),o=ir(this.element),n={x:o.left,y:o.top+o.height+10};this.contextMenuService.showContextMenu({getAnchor:()=>n,getActions:()=>t,actionRunner:this.actionRunner,onHide:()=>a1(t)})}}getActions(e){let t=[];for(let o of e)t=[...t,...o,new ri];return t.length?t.slice(0,t.length-1):t}};xtt=I([m(2,Xe)],xtt);async function Xmo(a,i,e){return e.invokeFunction(async t=>{let o=t.get(Hi),n=t.get(Js),r=t.get(Kt),s=t.get(BD),l=t.get(Ok),c=t.get(sp),u=t.get(DA),p=t.get(dm),h=[];if(a){switch(h.push(["extension",a.identifier.id]),h.push(["isBuiltinExtension",a.isBuiltin]),h.push(["isDefaultApplicationScopedExtension",a.local&&S5(a.local.manifest)]),h.push(["isApplicationScopedExtension",a.local&&a.local.isApplicationScoped]),h.push(["isWorkspaceScopedExtension",a.isWorkspaceScoped]),h.push(["isGalleryExtension",!!a.identifier.uuid]),a.local&&h.push(["extensionSource",a.local.source]),h.push(["extensionHasConfiguration",a.local&&!!a.local.manifest.contributes&&!!a.local.manifest.contributes.configuration]),h.push(["extensionHasKeybindings",a.local&&!!a.local.manifest.contributes&&!!a.local.manifest.contributes.keybindings]),h.push(["extensionHasCommands",a.local&&!!a.local.manifest.contributes&&!!a.local.manifest.contributes?.commands]),h.push(["isExtensionRecommended",!!s.getAllRecommendationsWithReason()[a.identifier.id.toLowerCase()]]),h.push(["isExtensionWorkspaceRecommended",s.getAllRecommendationsWithReason()[a.identifier.id.toLowerCase()]?.reasonId===0]),h.push(["isUserIgnoredRecommendation",l.globalIgnoredRecommendations.some(y=>y===a.identifier.id.toLowerCase())]),h.push(["isExtensionPinned",a.pinned]),h.push(["isExtensionEnabled",n.isEnabledEnablementState(a.enablementState)]),a.state){case 0:h.push(["extensionStatus","installing"]);break;case 1:h.push(["extensionStatus","installed"]);break;case 2:h.push(["extensionStatus","uninstalling"]);break;case 3:h.push(["extensionStatus","uninstalled"]);break}h.push(["installedExtensionIsPreReleaseVersion",!!a.local?.isPreReleaseVersion]),h.push(["installedExtensionIsOptedToPreRelease",!!a.local?.preRelease]),h.push(["galleryExtensionIsPreReleaseVersion",!!a.gallery?.properties.isPreReleaseVersion]),h.push(["galleryExtensionHasPreReleaseVersion",a.gallery?.hasPreReleaseVersion]),h.push(["extensionHasPreReleaseVersion",a.hasPreReleaseVersion]),h.push(["extensionHasReleaseVersion",a.hasReleaseVersion]),h.push(["extensionDisallowInstall",a.isMalicious||a.deprecationInfo?.disallowInstall]),h.push(["isExtensionAllowed",p.isAllowed({id:a.identifier.id,publisherDisplayName:a.publisherDisplayName})===!0]),h.push(["isPreReleaseExtensionAllowed",p.isAllowed({id:a.identifier.id,publisherDisplayName:a.publisherDisplayName,prerelease:!0})===!0]),h.push(["extensionIsUnsigned",a.gallery&&!a.gallery.isSigned]),h.push(["extensionIsPrivate",a.gallery?.private]);let[f,v,b,S]=await Promise.all([c.getColorThemes(),c.getFileIconThemes(),c.getProductIconThemes(),u.extensionUsesAuth(a.identifier.id.toLowerCase())]);h.push(["extensionHasColorThemes",f.some(y=>SG(y,a))]),h.push(["extensionHasFileIconThemes",v.some(y=>SG(y,a))]),h.push(["extensionHasProductIconThemes",b.some(y=>SG(y,a))]),h.push(["extensionHasAccountPreferences",S]),h.push(["canSetLanguage",o.canSetLanguage(a)]),h.push(["isActiveLanguagePackExtension",a.gallery&&wr===OX(a.gallery)])}return r.getMenuActions(D.ExtensionContext,i.createOverlay(h),{shouldForwardArgs:!0})})}function ktt(a,i){let e=[];for(let[,t]of a)e.push(t.map(o=>o instanceof Fs?o:i.createInstance(Ett,o)));return e}async function yEi(a,i,e){let t=await Xmo(a,i,e);return ktt(t,e)}var XA=class extends UH{constructor(e,t,o){super(XA.ID,"","",!0,e);this.extensionService=t;this.contextKeyService=o;this.tooltip=d(10427,null),this.update()}static{this.ID="extensions.manage"}static{this.Class=`${Sa.ICON_ACTION_CLASS} manage `+q.asClassName(ihe)}static{this.HideManageExtensionClass=`${this.Class} hide`}async getActionGroups(){let e=[],t=await Xmo(this.extension,this.contextKeyService,this.instantiationService),o=[],n=[],r=[],s=[];for(let[l,c]of t)l===NJ?n.push(...ktt([[l,c]],this.instantiationService)[0]):l===p7e?r.push(...ktt([[l,c]],this.instantiationService)[0]):l===YTe?o.push(...ktt([[l,c]],this.instantiationService)[0]):s.push(...ktt([[l,c]],this.instantiationService));return o.length&&e.push(o),e.push([this.instantiationService.createInstance(m8),this.instantiationService.createInstance(p8)]),e.push([this.instantiationService.createInstance(g8),this.instantiationService.createInstance(h8)]),r.length&&e.push(r),e.push([...n.length?n:[],this.instantiationService.createInstance(WT,this.extension,!1),this.instantiationService.createInstance(FT)]),s.forEach(l=>e.push(l)),e.forEach(l=>l.forEach(c=>{c instanceof Sa&&(c.extension=this.extension)})),e}async run(){return await this.extensionService.whenInstalledExtensionsRegistered(),super.run(await this.getActionGroups())}update(){if(this.class=XA.HideManageExtensionClass,this.enabled=!1,this.extension){let e=this.extension.state;this.enabled=e===1,this.class=this.enabled||e===2?XA.Class:XA.HideManageExtensionClass}}};XA=I([m(0,F),m(1,lt),m(2,X)],XA);var SUt=class extends UH{constructor(e,t){super("extensionEditor.manageExtension","",`${Sa.ICON_ACTION_CLASS} manage ${q.asClassName(ihe)}`,!0,t);this.contextKeyService=e;this.tooltip=d(10427,null)}update(){}async run(){let e=[];return(await yEi(this.extension,this.contextKeyService,this.instantiationService)).forEach(t=>e.push(t)),e.forEach(t=>t.forEach(o=>{o instanceof Sa&&(o.extension=this.extension)})),super.run(e)}},Ett=class extends Sa{constructor(e,t){super(e.id,e.label);this.action=e;this.extensionsWorkbenchService=t}get enabled(){return this.action.enabled}set enabled(e){this.action.enabled=e}update(){this.extension&&(this.action.id===fMt?this.checked=!this.extensionsWorkbenchService.isExtensionIgnoredToSync(this.extension):this.action.id===fx.ID?this.checked=this.extensionsWorkbenchService.isAutoUpdateEnabledFor(this.extension):this.action.id===X0.ID?this.checked=this.extensionsWorkbenchService.isAutoUpdateEnabledFor(this.extension.publisher):this.checked=this.action.checked)}async run(){if(this.extension){let e=this.extension.local?gS(this.extension.local.manifest.publisher,this.extension.local.manifest.name):this.extension.gallery?gS(this.extension.gallery.publisher,this.extension.gallery.name):this.extension.identifier.id,t={id:this.extension.identifier.id,version:this.extension.version,location:this.extension.local?.location,galleryLink:this.extension.url};await this.action.run(e,t)}}};Ett=I([m(1,Hi)],Ett);var $D=class extends Sa{constructor(e,t){super($D.ID,$D.LABEL,$D.DisabledClass);this.extensionsWorkbenchService=e;this.allowedExtensionsService=t;this._register(t.onDidChangeAllowedExtensionsConfigValue(()=>this.update())),this.update()}static{this.ID="workbench.extensions.action.togglePreRlease"}static{this.LABEL=d(10466,null)}static{this.EnabledClass=`${Sa.LABEL_ACTION_CLASS} prominent pre-release`}static{this.DisabledClass=`${this.EnabledClass} hide`}update(){this.enabled=!1,this.class=$D.DisabledClass,this.extension&&(this.extension.isBuiltin||this.extension.state===1&&this.extension.hasPreReleaseVersion&&this.extension.gallery&&(this.extension.preRelease&&(!this.extension.isPreReleaseVersion||this.allowedExtensionsService.isAllowed({id:this.extension.identifier.id,publisherDisplayName:this.extension.publisherDisplayName})!==!0)||!this.extension.preRelease&&(!this.extension.gallery.hasPreReleaseVersion||this.allowedExtensionsService.isAllowed(this.extension.gallery)!==!0)||(this.enabled=!0,this.class=$D.EnabledClass,this.extension.preRelease?(this.label=d(10464,null),this.tooltip=d(10465,null)):(this.label=d(10459,null),this.tooltip=d(10460,null)))))}async run(){this.extension&&(this.extensionsWorkbenchService.open(this.extension,{showPreReleaseVersion:!this.extension.preRelease}),await this.extensionsWorkbenchService.togglePreRelease(this.extension))}};$D=I([m(0,Hi),m(1,dm)],$D);var WT=class extends Sa{constructor(e,t,o,n,r,s,l,c,u){super(WT.ID,WT.LABEL,Sa.LABEL_ACTION_CLASS);this.whenInstalled=t;this.extensionsWorkbenchService=o;this.extensionManagementService=n;this.extensionGalleryService=r;this.quickInputService=s;this.instantiationService=l;this.dialogService=c;this.allowedExtensionsService=u;this._register(u.onDidChangeAllowedExtensionsConfigValue(()=>this.update())),this.extension=e,this.update()}static{this.ID="workbench.extensions.action.install.anotherVersion"}static{this.LABEL=d(10397,null)}update(){this.enabled=!!this.extension&&!this.extension.isBuiltin&&!!this.extension.identifier.uuid&&!this.extension.deprecationInfo&&this.allowedExtensionsService.isAllowed({id:this.extension.identifier.id,publisherDisplayName:this.extension.publisherDisplayName})===!0,this.enabled&&this.whenInstalled&&(this.enabled=!!this.extension?.local&&!!this.extension.server&&this.extension.state===1)}async run(){if(!this.enabled||!this.extension)return;let e=this.extension.server?await this.extension.server.extensionManagementService.getTargetPlatform():await this.extensionManagementService.getTargetPlatform(),t=await this.extensionGalleryService.getAllCompatibleVersions(this.extension.identifier,this.extension.local?.preRelease??this.extension.gallery?.properties.isPreReleaseVersion??!1,e);if(!t.length){await this.dialogService.info(d(10435,null));return}let o=t.map((r,s)=>({id:r.version,label:r.version,description:`${ea(new Date(Date.parse(r.date)),!0)}${r.isPreReleaseVersion?` (${d(10440,null)})`:""}${r.version===this.extension?.local?.manifest.version?` (${d(10346,null)})`:""}`,ariaLabel:`${r.isPreReleaseVersion?"Pre-Release version":"Release version"} ${r.version}`,isPreReleaseVersion:r.isPreReleaseVersion})),n=await this.quickInputService.pick(o,{placeHolder:d(10455,null),matchOnDetail:!0});if(n){if(this.extension.local?.manifest.version===n.id)return;let r={installPreReleaseVersion:n.isPreReleaseVersion,version:n.id};try{await this.extensionsWorkbenchService.install(this.extension,r)}catch(s){this.instantiationService.createInstance(lte,this.extension,r,n.id,2,s).run()}}return null}};WT=I([m(2,Hi),m(3,ru),m(4,fa),m(5,Ue),m(6,F),m(7,at),m(8,dm)],WT);var p8=class extends Sa{constructor(e,t){super(p8.ID,p8.LABEL,Sa.LABEL_ACTION_CLASS);this.extensionsWorkbenchService=e;this.extensionEnablementService=t;this.tooltip=d(10374,null),this.update()}static{this.ID="extensions.enableForWorkspace"}static{this.LABEL=d(10373,null)}update(){this.enabled=!1,this.extension&&this.extension.local&&!this.extension.isWorkspaceScoped&&(this.enabled=this.extension.state===1&&!this.extensionEnablementService.isEnabled(this.extension.local)&&this.extensionEnablementService.canChangeWorkspaceEnablement(this.extension.local))}async run(){if(this.extension)return this.extensionsWorkbenchService.setEnablement(this.extension,13)}};p8=I([m(0,Hi),m(1,Js)],p8);var m8=class extends Sa{constructor(e,t){super(m8.ID,m8.LABEL,Sa.LABEL_ACTION_CLASS);this.extensionsWorkbenchService=e;this.extensionEnablementService=t;this.tooltip=d(10376,null),this.update()}static{this.ID="extensions.enableGlobally"}static{this.LABEL=d(10375,null)}update(){this.enabled=!1,this.extension&&this.extension.local&&!this.extension.isWorkspaceScoped&&(this.enabled=this.extension.state===1&&this.extensionEnablementService.isDisabledGlobally(this.extension.local)&&this.extensionEnablementService.canChangeEnablement(this.extension.local))}async run(){if(this.extension)return this.extensionsWorkbenchService.setEnablement(this.extension,12)}};m8=I([m(0,Hi),m(1,Js)],m8);var h8=class extends Sa{constructor(e,t,o,n){super(h8.ID,h8.LABEL,Sa.LABEL_ACTION_CLASS);this.workspaceContextService=e;this.extensionsWorkbenchService=t;this.extensionEnablementService=o;this.extensionService=n;this.tooltip=d(10361,null),this.update(),this._register(this.extensionService.onDidChangeExtensions(()=>this.update()))}static{this.ID="extensions.disableForWorkspace"}static{this.LABEL=d(10360,null)}update(){this.enabled=!1,this.extension&&this.extension.local&&!this.extension.isWorkspaceScoped&&this.extensionService.extensions.some(e=>Ut({id:e.identifier.value,uuid:e.uuid},this.extension.identifier)&&this.workspaceContextService.getWorkbenchState()!==1)&&(this.enabled=this.extension.state===1&&(this.extension.enablementState===12||this.extension.enablementState===13)&&this.extensionEnablementService.canChangeWorkspaceEnablement(this.extension.local))}async run(){if(this.extension)return this.extensionsWorkbenchService.setEnablement(this.extension,11)}};h8=I([m(0,Pe),m(1,Hi),m(2,Js),m(3,lt)],h8);var g8=class extends Sa{constructor(e,t,o){super(g8.ID,g8.LABEL,Sa.LABEL_ACTION_CLASS);this.extensionsWorkbenchService=e;this.extensionEnablementService=t;this.extensionService=o;this.tooltip=d(10363,null),this.update(),this._register(this.extensionService.onDidChangeExtensions(()=>this.update()))}static{this.ID="extensions.disableGlobally"}static{this.LABEL=d(10362,null)}update(){this.enabled=!1,this.extension&&this.extension.local&&!this.extension.isWorkspaceScoped&&this.extensionService.extensions.some(e=>Ut({id:e.identifier.value,uuid:e.uuid},this.extension.identifier))&&(this.enabled=this.extension.state===1&&(this.extension.enablementState===12||this.extension.enablementState===13)&&this.extensionEnablementService.canChangeEnablement(this.extension.local))}async run(){if(this.extension)return this.extensionsWorkbenchService.setEnablement(this.extension,10)}};g8=I([m(0,Hi),m(1,Js),m(2,lt)],g8);var yPe=class extends IG{constructor(i){super("extensions.enable",Sa.LABEL_ACTION_CLASS,[[i.createInstance(m8),i.createInstance(p8)]])}};yPe=I([m(0,F)],yPe);var wPe=class extends IG{constructor(i){super("extensions.disable",Sa.LABEL_ACTION_CLASS,[[i.createInstance(g8),i.createInstance(h8)]])}};wPe=I([m(0,F)],wPe);var fG=class extends Sa{constructor(e,t,o,n,r,s){super("extensions.runtimeState","",fG.DisabledClass,!1);this.hostService=e;this.extensionsWorkbenchService=t;this.updateService=o;this.extensionService=n;this.productService=r;this.telemetryService=s;this.updateWhenCounterExtensionChanges=!0;this._register(this.extensionService.onDidChangeExtensions(()=>this.update())),this.update()}static{this.EnabledClass=`${Sa.LABEL_ACTION_CLASS} prominent reload`}static{this.DisabledClass=`${this.EnabledClass} disabled`}update(){if(this.enabled=!1,this.tooltip="",this.class=fG.DisabledClass,!this.extension)return;let e=this.extension.state;if(e===0||e===2||this.extension.local&&this.extension.local.manifest&&this.extension.local.manifest.contributes&&this.extension.local.manifest.contributes.localizations&&this.extension.local.manifest.contributes.localizations.length>0)return;let t=this.extension.runtimeState;t&&(this.enabled=!0,this.class=fG.EnabledClass,this.tooltip=t.reason,this.label=t.action==="reloadWindow"?d(10441,null):t.action==="restartExtensions"?d(10445,null):t.action==="quitAndInstall"?d(10446,null):t.action==="applyUpdate"||t.action==="downloadUpdate"?d(10476,null,this.productService.nameShort):"")}async run(){let e=this.extension?.runtimeState;if(e?.action){if(this.telemetryService.publicLog2("extensions:runtimestate:action",{action:e.action}),e?.action==="reloadWindow")return this.hostService.reload();if(e?.action==="restartExtensions")return this.extensionsWorkbenchService.updateRunningExtensions();if(e?.action==="downloadUpdate")return this.updateService.downloadUpdate(!0);if(e?.action==="applyUpdate")return this.updateService.applyUpdate();if(e?.action==="quitAndInstall")return this.updateService.quitAndInstall()}}};fG=I([m(0,Zt),m(1,Hi),m(2,zd),m(3,lt),m(4,tt),m(5,Te)],fG);function SG(a,i){return!!(i&&a.extensionData&&Ii.equals(a.extensionData.extensionId,i.identifier.id))}function wEi(a,i,e,t){let o=[];for(let n of a)SG(n,e)&&!(t&&n===i)&&o.push({label:n.label,id:n.id});return t&&(o.push({type:"separator",label:d(10346,null)}),o.push({label:i.label,id:i.id})),o}var Hk=class extends Sa{constructor(e,t,o,n){super(Hk.ID,Hk.TITLE.value,Hk.DisabledClass,!1);this.workbenchThemeService=t;this.quickInputService=o;this.extensionEnablementService=n;this._register(U.any(e.onDidChangeExtensions,t.onDidColorThemeChange)(()=>this.update(),this)),this.update()}static{this.ID="workbench.extensions.action.setColorTheme"}static{this.TITLE=L(10486,"Set Color Theme")}static{this.EnabledClass=`${Sa.LABEL_ACTION_CLASS} theme`}static{this.DisabledClass=`${this.EnabledClass} disabled`}update(){this.workbenchThemeService.getColorThemes().then(e=>{this.enabled=this.computeEnablement(e),this.class=this.enabled?Hk.EnabledClass:Hk.DisabledClass})}computeEnablement(e){return!!this.extension&&this.extension.state===1&&this.extensionEnablementService.isEnabledEnablementState(this.extension.enablementState)&&e.some(t=>SG(t,this.extension))}async run({showCurrentTheme:e,ignoreFocusLost:t}={showCurrentTheme:!1,ignoreFocusLost:!1}){let o=await this.workbenchThemeService.getColorThemes();if(!this.computeEnablement(o))return;let n=this.workbenchThemeService.getColorTheme(),r=new Xo(100),s=wEi(o,n,this.extension,e),l=await this.quickInputService.pick(s,{placeHolder:d(10450,null),onDidFocus:c=>r.trigger(()=>this.workbenchThemeService.setColorTheme(c.id,void 0)),ignoreFocusLost:t});return this.workbenchThemeService.setColorTheme(l?l.id:n.id,"auto")}};Hk=I([m(0,lt),m(1,sp),m(2,Ue),m(3,Js)],Hk);var Uk=class extends Sa{constructor(e,t,o,n){super(Uk.ID,Uk.TITLE.value,Uk.DisabledClass,!1);this.workbenchThemeService=t;this.quickInputService=o;this.extensionEnablementService=n;this._register(U.any(e.onDidChangeExtensions,t.onDidFileIconThemeChange)(()=>this.update(),this)),this.update()}static{this.ID="workbench.extensions.action.setFileIconTheme"}static{this.TITLE=L(10488,"Set File Icon Theme")}static{this.EnabledClass=`${Sa.LABEL_ACTION_CLASS} theme`}static{this.DisabledClass=`${this.EnabledClass} disabled`}update(){this.workbenchThemeService.getFileIconThemes().then(e=>{this.enabled=this.computeEnablement(e),this.class=this.enabled?Uk.EnabledClass:Uk.DisabledClass})}computeEnablement(e){return!!this.extension&&this.extension.state===1&&this.extensionEnablementService.isEnabledEnablementState(this.extension.enablementState)&&e.some(t=>SG(t,this.extension))}async run({showCurrentTheme:e,ignoreFocusLost:t}={showCurrentTheme:!1,ignoreFocusLost:!1}){let o=await this.workbenchThemeService.getFileIconThemes();if(!this.computeEnablement(o))return;let n=this.workbenchThemeService.getFileIconTheme(),r=new Xo(100),s=wEi(o,n,this.extension,e),l=await this.quickInputService.pick(s,{placeHolder:d(10452,null),onDidFocus:c=>r.trigger(()=>this.workbenchThemeService.setFileIconTheme(c.id,void 0)),ignoreFocusLost:t});return this.workbenchThemeService.setFileIconTheme(l?l.id:n.id,"auto")}};Uk=I([m(0,lt),m(1,sp),m(2,Ue),m(3,Js)],Uk);var zk=class extends Sa{constructor(e,t,o,n){super(zk.ID,zk.TITLE.value,zk.DisabledClass,!1);this.workbenchThemeService=t;this.quickInputService=o;this.extensionEnablementService=n;this._register(U.any(e.onDidChangeExtensions,t.onDidProductIconThemeChange)(()=>this.update(),this)),this.update()}static{this.ID="workbench.extensions.action.setProductIconTheme"}static{this.TITLE=L(10489,"Set Product Icon Theme")}static{this.EnabledClass=`${Sa.LABEL_ACTION_CLASS} theme`}static{this.DisabledClass=`${this.EnabledClass} disabled`}update(){this.workbenchThemeService.getProductIconThemes().then(e=>{this.enabled=this.computeEnablement(e),this.class=this.enabled?zk.EnabledClass:zk.DisabledClass})}computeEnablement(e){return!!this.extension&&this.extension.state===1&&this.extensionEnablementService.isEnabledEnablementState(this.extension.enablementState)&&e.some(t=>SG(t,this.extension))}async run({showCurrentTheme:e,ignoreFocusLost:t}={showCurrentTheme:!1,ignoreFocusLost:!1}){let o=await this.workbenchThemeService.getProductIconThemes();if(!this.computeEnablement(o))return;let n=this.workbenchThemeService.getProductIconTheme(),r=new Xo(100),s=wEi(o,n,this.extension,e),l=await this.quickInputService.pick(s,{placeHolder:d(10453,null),onDidFocus:c=>r.trigger(()=>this.workbenchThemeService.setProductIconTheme(c.id,void 0)),ignoreFocusLost:t});return this.workbenchThemeService.setProductIconTheme(l?l.id:n.id,"auto")}};zk=I([m(0,lt),m(1,sp),m(2,Ue),m(3,Js)],zk);var wM=class extends Sa{constructor(e){super(wM.ID,wM.TITLE.value,wM.DisabledClass,!1);this.extensionsWorkbenchService=e;this.update()}static{this.ID="workbench.extensions.action.setDisplayLanguage"}static{this.TITLE=L(10487,"Set Display Language")}static{this.EnabledClass=`${Sa.LABEL_ACTION_CLASS} language`}static{this.DisabledClass=`${this.EnabledClass} disabled`}update(){this.enabled=!1,this.class=wM.DisabledClass,this.extension&&this.extensionsWorkbenchService.canSetLanguage(this.extension)&&(this.extension.gallery&&wr===OX(this.extension.gallery)||(this.enabled=!0,this.class=wM.EnabledClass))}async run(){return this.extension&&this.extensionsWorkbenchService.setLanguage(this.extension)}};wM=I([m(0,Hi)],wM);var vx=class extends Sa{constructor(e,t){super(vx.ID,vx.TITLE.value,vx.DisabledClass,!1);this.extensionsWorkbenchService=e;this.localeService=t;this.update()}static{this.ID="workbench.extensions.action.clearLanguage"}static{this.TITLE=L(10485,"Clear Display Language")}static{this.EnabledClass=`${Sa.LABEL_ACTION_CLASS} language`}static{this.DisabledClass=`${this.EnabledClass} disabled`}update(){this.enabled=!1,this.class=vx.DisabledClass,this.extension&&this.extensionsWorkbenchService.canSetLanguage(this.extension)&&(this.extension.gallery&&wr!==OX(this.extension.gallery)||(this.enabled=!0,this.class=vx.EnabledClass))}async run(){return this.extension&&this.localeService.clearLocalePreference()}};vx=I([m(0,Hi),m(1,DH)],vx);var ohe=class extends it{constructor(e,t){super(ohe.ID,ohe.LABEL,void 0,!1);this.extensionWorkbenchService=t;this.extensionId=e}static{this.ID="workbench.extensions.action.showRecommendedExtension"}static{this.LABEL=d(10458,null)}async run(){await this.extensionWorkbenchService.openSearch(`@id:${this.extensionId}`);let[e]=await this.extensionWorkbenchService.getExtensions([{id:this.extensionId}],{source:"install-recommendation"},Se.None);return e?this.extensionWorkbenchService.open(e):null}};ohe=I([m(1,Hi)],ohe);var JA=class extends it{constructor(e,t,o){super(JA.ID,JA.LABEL,void 0,!1);this.instantiationService=t;this.extensionWorkbenchService=o;this.extensionId=e}static{this.ID="workbench.extensions.action.installRecommendedExtension"}static{this.LABEL=d(10423,null)}async run(){await this.extensionWorkbenchService.openSearch(`@id:${this.extensionId}`);let[e]=await this.extensionWorkbenchService.getExtensions([{id:this.extensionId}],{source:"install-recommendation"},Se.None);if(e){await this.extensionWorkbenchService.open(e);try{await this.extensionWorkbenchService.install(e)}catch(t){this.instantiationService.createInstance(lte,e,void 0,e.latestVersion,2,t).run()}}}};JA=I([m(1,F),m(2,Hi)],JA);var nhe=class extends it{constructor(e,t){super(nhe.ID,"Ignore Recommendation");this.extension=e;this.extensionRecommendationsManagementService=t;this.class=nhe.Class,this.tooltip=d(10394,null),this.enabled=!0}static{this.ID="extensions.ignore"}static{this.Class=`${Sa.LABEL_ACTION_CLASS} ignore`}run(){return this.extensionRecommendationsManagementService.toggleGlobalIgnoredRecommendation(this.extension.identifier.id,!0),Promise.resolve()}};nhe=I([m(1,Ok)],nhe);var rhe=class extends it{constructor(e,t){super(rhe.ID,"Undo");this.extension=e;this.extensionRecommendationsManagementService=t;this.class=rhe.Class,this.tooltip=d(10467,null),this.enabled=!0}static{this.ID="extensions.ignore"}static{this.Class=`${Sa.LABEL_ACTION_CLASS} undo-ignore`}run(){return this.extensionRecommendationsManagementService.toggleGlobalIgnoredRecommendation(this.extension.identifier.id,!1),Promise.resolve()}};rhe=I([m(1,Ok)],rhe);var CPe=class extends it{constructor(e,t,o,n,r,s,l,c){super(e,t);this.contextService=o;this.fileService=n;this.textFileService=r;this.editorService=s;this.jsonEditingService=l;this.textModelResolverService=c}openExtensionsFile(e){return this.getOrCreateExtensionsFile(e).then(({created:t,content:o})=>this.getSelectionPosition(o,e,["recommendations"]).then(n=>this.editorService.openEditor({resource:e,options:{pinned:t,selection:n}})),t=>Promise.reject(new Error(d(10439,null,t))))}openWorkspaceConfigurationFile(e){return this.getOrUpdateWorkspaceConfigurationFile(e).then(t=>this.getSelectionPosition(t.value.toString(),t.resource,["extensions","recommendations"])).then(t=>this.editorService.openEditor({resource:e,options:{selection:t,forceReload:!0}}))}getOrUpdateWorkspaceConfigurationFile(e){return Promise.resolve(this.fileService.readFile(e)).then(t=>{let o=jr(t.value.toString()).extensions;return!o||!o.recommendations?this.jsonEditingService.write(e,[{path:["extensions"],value:{recommendations:[]}}],!0).then(()=>this.fileService.readFile(e)):t})}getSelectionPosition(e,t,o){let n=_R(e),r=OC(n,o);if(r&&r.parent&&r.parent.children){let s=r.parent.children[1],l=s.children&&s.children.length?s.children[s.children.length-1]:null,c=l?l.offset+l.length:s.offset+1;return Promise.resolve(this.textModelResolverService.createModelReference(t)).then(u=>{let p=u.object.textEditorModel.getPositionAt(c);return u.dispose(),{startLineNumber:p.lineNumber,startColumn:p.column,endLineNumber:p.lineNumber,endColumn:p.column}})}return Promise.resolve(void 0)}getOrCreateExtensionsFile(e){return Promise.resolve(this.fileService.readFile(e)).then(t=>({created:!1,extensionsFileResource:e,content:t.value.toString()}),t=>this.textFileService.write(e,hEi).then(()=>({created:!0,extensionsFileResource:e,content:hEi})))}};CPe=I([m(2,Pe),m(3,fe),m(4,Uo),m(5,ee),m(6,bg),m(7,Bt)],CPe);var vG=class extends CPe{static{this.ID="workbench.extensions.action.configureWorkspaceRecommendedExtensions"}static{this.LABEL=d(10345,null)}constructor(i,e,t,o,n,r,s,l){super(i,e,n,t,o,r,s,l),this._register(this.contextService.onDidChangeWorkbenchState(()=>this.update(),this)),this.update()}update(){this.enabled=this.contextService.getWorkbenchState()!==1}run(){switch(this.contextService.getWorkbenchState()){case 2:return this.openExtensionsFile(this.contextService.getWorkspace().folders[0].toResource(Cme));case 3:return this.openWorkspaceConfigurationFile(this.contextService.getWorkspace().configuration)}return Promise.resolve()}};vG=I([m(2,fe),m(3,Uo),m(4,Pe),m(5,ee),m(6,bg),m(7,Bt)],vG);var bG=class extends CPe{constructor(e,t,o,n,r,s,l,c,u){super(e,t,r,o,n,s,l,c);this.commandService=u}static{this.ID="workbench.extensions.action.configureWorkspaceFolderRecommendedExtensions"}static{this.LABEL=d(10344,null)}run(){let t=this.contextService.getWorkspace().folders.length===1?Promise.resolve(this.contextService.getWorkspace().folders[0]):this.commandService.executeCommand(rM);return Promise.resolve(t).then(o=>o?this.openExtensionsFile(o.toResource(Cme)):null)}};bG=I([m(2,fe),m(3,Uo),m(4,Pe),m(5,ee),m(6,bg),m(7,Bt),m(8,ge)],bG);var Z0=class extends it{constructor(e,t,o){super("extensions.action.statusLabel","",Z0.DISABLED_CLASS,!1);this.extensionService=e;this.extensionManagementServerService=t;this.extensionEnablementService=o;this.initialStatus=null;this.status=null;this.version=null;this.enablementState=null;this._extension=null}static{this.ENABLED_CLASS=`${Sa.TEXT_ACTION_CLASS} extension-status-label`}static{this.DISABLED_CLASS=`${this.ENABLED_CLASS} hide`}get extension(){return this._extension}set extension(e){this._extension&&e&&Ut(this._extension.identifier,e.identifier)||(this.initialStatus=null,this.status=null,this.enablementState=null),this._extension=e,this.update()}update(){let e=this.computeLabel();this.label=e||"",this.class=e?Z0.ENABLED_CLASS:Z0.DISABLED_CLASS}computeLabel(){if(!this.extension)return null;let e=this.status,t=this.version,o=this.enablementState;this.status=this.extension.state,this.version=this.extension.version,this.initialStatus===null&&(this.initialStatus=this.status),this.enablementState=this.extension.enablementState;let n=()=>{let s=this.extensionService.extensions.filter(l=>Ut({id:l.identifier.value,uuid:l.uuid},this.extension.identifier))[0];return this.extension.local?s&&this.extension.version===s.version?!0:this.extensionService.canAddExtension(bF(this.extension.local)):!1},r=()=>this.extension.local?this.extensionService.extensions.every(s=>!(Ut({id:s.identifier.value,uuid:s.uuid},this.extension.identifier)&&this.extension.server===this.extensionManagementServerService.getExtensionManagementServer(ZE(s))))?!0:this.extensionService.canRemoveExtension(bF(this.extension.local)):!1;if(e!==null){if(e===0&&this.status===1)return this.initialStatus===3&&n()?d(10418,null):this.initialStatus===1&&this.version!==t&&n()?d(10478,null):null;if(e===2&&this.status===3)return this.initialStatus=this.status,r()?d(10470,null):null}if(o!==null){let s=this.extensionEnablementService.isEnabledEnablementState(o),l=this.extensionEnablementService.isEnabledEnablementState(this.enablementState);if(!s&&l)return n()?d(10368,null):null;if(s&&!l)return r()?d(10356,null):null}return null}run(){return Promise.resolve()}};Z0=I([m(0,lt),m(1,Ec),m(2,Js)],Z0);var pte=class extends UH{constructor(e,t,o,n){super("extensions.sync","",pte.SYNC_CLASS,!1,n);this.configurationService=e;this.extensionsWorkbenchService=t;this.userDataSyncEnablementService=o;this._register(U.filter(this.configurationService.onDidChangeConfiguration,r=>r.affectsConfiguration("settingsSync.ignoredExtensions"))(()=>this.update())),this._register(o.onDidChangeEnablement(()=>this.update())),this.update()}static{this.IGNORED_SYNC_CLASS=`${Sa.ICON_ACTION_CLASS} extension-sync ${q.asClassName(ytt)}`}static{this.SYNC_CLASS=`${this.ICON_ACTION_CLASS} extension-sync ${q.asClassName(Gmo)}`}update(){if(this.enabled=!!this.extension&&this.userDataSyncEnablementService.isEnabled()&&this.extension.state===1,this.extension){let e=this.extensionsWorkbenchService.isExtensionIgnoredToSync(this.extension);this.class=e?pte.IGNORED_SYNC_CLASS:pte.SYNC_CLASS,this.tooltip=e?d(10393,null):d(10462,null)}}async run(){return super.run([[new it("extensions.syncignore",this.extensionsWorkbenchService.isExtensionIgnoredToSync(this.extension)?d(10461,null):d(10364,null),void 0,!0,()=>this.extensionsWorkbenchService.toggleExtensionIgnoredToSync(this.extension))]])}};pte=I([m(0,B),m(1,Hi),m(2,Fl),m(3,F)],pte);var qD=class extends Sa{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super("extensions.status","",`${qD.CLASS} hide`,!1);this.extensionManagementServerService=e;this.labelService=t;this.commandService=o;this.workspaceTrustEnablementService=n;this.workspaceTrustService=r;this.extensionsWorkbenchService=s;this.extensionService=l;this.extensionManifestPropertiesService=c;this.contextService=u;this.productService=p;this.allowedExtensionsService=h;this.workbenchExtensionEnablementService=g;this.extensionFeaturesManagementService=f;this.extensionGalleryManifestService=v;this.updateWhenCounterExtensionChanges=!0;this._status=[];this._onDidChangeStatus=this._register(new E);this.onDidChangeStatus=this._onDidChangeStatus.event;this.updateThrottler=this._register(new gu);this._register(this.labelService.onDidChangeFormatters(()=>this.update(),this)),this._register(this.extensionService.onDidChangeExtensions(()=>this.update())),this._register(this.extensionFeaturesManagementService.onDidChangeAccessData(()=>this.update())),this._register(h.onDidChangeAllowedExtensionsConfigValue(()=>this.update())),this.update()}static{this.CLASS=`${Sa.ICON_ACTION_CLASS} extension-status`}get status(){return this._status}update(){this.updateThrottler.queue(()=>this.computeAndUpdateStatus())}async computeAndUpdateStatus(){if(this.updateStatus(void 0,!0),this.enabled=!1,!this.extension)return;if(this.extension.isMalicious){this.updateStatus({icon:Gu,message:new Ie(d(10426,null))},!0);return}if(this.extension.state===3&&this.extension.gallery&&!this.extension.gallery.isSigned&&CQe(this.extension.private,await this.extensionGalleryManifestService.getExtensionGalleryManifest())){this.updateStatus({icon:Gu,message:new Ie(d(10438,null))},!0);return}if(this.extension.deprecationInfo){if(this.extension.deprecationInfo.extension){let r=`[${this.extension.deprecationInfo.extension.displayName}](${fc("extension.open",this.extension.deprecationInfo.extension.id)})`;this.updateStatus({icon:Gu,message:new Ie(d(10352,null,r))},!0)}else if(this.extension.deprecationInfo.settings){let r=`[${d(10456,null)}](${fc("workbench.action.openSettings",this.extension.deprecationInfo.settings.map(s=>`@id:${s}`).join(" "))}})`;this.updateStatus({icon:Gu,message:new Ie(d(10354,null,r))},!0)}else{let r=new Ie(d(10350,null));this.extension.deprecationInfo.additionalInfo&&r.appendMarkdown(` ${this.extension.deprecationInfo.additionalInfo}`),this.updateStatus({icon:Gu,message:r},!0)}return}if(this.extension.missingFromGallery){this.updateStatus({icon:Gu,message:new Ie(d(10432,null))},!0);return}if(this.extensionsWorkbenchService.canSetLanguage(this.extension))return;if(this.extension.outdated){let r=await this.extensionsWorkbenchService.shouldRequireConsentToUpdate(this.extension);if(r){let s=new Ie;s.appendMarkdown(`${r} `),s.appendMarkdown(d(10337,null,this.extension.hasChangelog()?fc("extension.open",this.extension.identifier.id,"changelog").toString():this.extension.repository?this.extension.repository:fc("extension.open",this.extension.identifier.id).toString())),this.updateStatus({icon:Gu,message:s},!0)}}if(this.extension.gallery&&this.extension.state===3){let r=await this.extensionsWorkbenchService.canInstall(this.extension);if(r!==!0){this.updateStatus({icon:Gu,message:r},!0);return}}if(!this.extension.local||!this.extension.server||this.extension.state!==1)return;if(this.extension.enablementState===7){let r=this.allowedExtensionsService.isAllowed(this.extension.local);if(r!==!0){this.updateStatus({icon:Gu,message:new Ie(d(10357,null,r.value))},!0);return}}if(this.extension.enablementState===2){this.updateStatus({message:new Ie(d(10359,null))},!0);return}if(this.extension.enablementState===3){this.updateStatus({message:new Ie(d(10369,null))},!0);return}if(this.extension.enablementState===5){let r=Gce(this.extension.local.manifest.capabilities?.virtualWorkspaces);this.updateStatus({icon:Ug,message:new Ie(r?PP(r):d(10358,null))},!0);return}if(_F(this.contextService.getWorkspace())){let r=this.extensionManifestPropertiesService.getExtensionVirtualWorkspaceSupportType(this.extension.local.manifest),s=Gce(this.extension.local.manifest.capabilities?.virtualWorkspaces);if(r==="limited"||s){this.updateStatus({icon:Gu,message:new Ie(s?PP(s):d(10382,null))},!0);return}}if(this.extension.enablementState===9){this.updateStatus({icon:Ug,message:new Ie(d(10379,null,"`chat.extensionUnification.enabled`"))},!0);return}if(!this.workspaceTrustService.isWorkspaceTrusted()&&(this.extension.enablementState===0||this.extension.enablementState===8&&this.workbenchExtensionEnablementService.getDependenciesEnablementStates(this.extension.local).every(([,r])=>this.workbenchExtensionEnablementService.isEnabledEnablementState(r)||r===0))){this.enabled=!0;let r=Gce(this.extension.local.manifest.capabilities?.untrustedWorkspaces);this.updateStatus({icon:IM,message:new Ie(r?PP(r):d(10378,null))},!0);return}if(this.workspaceTrustEnablementService.isWorkspaceTrustEnabled()&&!this.workspaceTrustService.isWorkspaceTrusted()){let r=this.extensionManifestPropertiesService.getExtensionUntrustedWorkspaceSupportType(this.extension.local.manifest),s=Gce(this.extension.local.manifest.capabilities?.untrustedWorkspaces);if(r==="limited"||s){this.enabled=!0,this.updateStatus({icon:IM,message:new Ie(s?PP(s):d(10381,null))},!0);return}}if(this.extension.enablementState===1&&!this.extensionsWorkbenchService.installed.some(r=>Ut(r.identifier,this.extension.identifier)&&r.server!==this.extension.server)){let r;this.extensionManagementServerService.localExtensionManagementServer===this.extension.server?this.extensionManifestPropertiesService.prefersExecuteOnWorkspace(this.extension.local.manifest)&&this.extensionManagementServerService.remoteExtensionManagementServer&&(r=new Ie(`${d(10404,null,this.extensionManagementServerService.remoteExtensionManagementServer.label)} [${d(10425,null)}](https://code.visualstudio.com/api/advanced-topics/remote-extensions#architecture-and-extension-kinds)`)):this.extensionManagementServerService.remoteExtensionManagementServer===this.extension.server?this.extensionManifestPropertiesService.prefersExecuteOnUI(this.extension.local.manifest)&&(this.extensionManagementServerService.localExtensionManagementServer?r=new Ie(`${d(10402,null,this.extensionManagementServerService.remoteExtensionManagementServer.label)} [${d(10425,null)}](https://code.visualstudio.com/api/advanced-topics/remote-extensions#architecture-and-extension-kinds)`):Wt&&(r=new Ie(`${d(10347,null,this.productService.nameLong)} [${d(10425,null)}](https://code.visualstudio.com/api/advanced-topics/remote-extensions#architecture-and-extension-kinds)`))):this.extensionManagementServerService.webExtensionManagementServer===this.extension.server&&(r=new Ie(`${d(10339,null,this.productService.nameLong)} [${d(10425,null)}](https://code.visualstudio.com/api/advanced-topics/remote-extensions#architecture-and-extension-kinds)`)),r&&this.updateStatus({icon:Gu,message:r},!0);return}let e=new Ii(this.extension.identifier.id),t=ne.as(As.ExtensionFeaturesRegistry).getExtensionFeatures();for(let r of t){let s=this.extensionFeaturesManagementService.getAccessData(e,r.id)?.current?.status,l=`[${d(10428,null)}](${fc("extension.open",this.extension.identifier.id,"features",!1,r.id)})`;if(s?.severity===ft.Error){this.updateStatus({icon:OS,message:new Ie().appendText(s.message).appendMarkdown(` ${l}`)},!0);return}if(s?.severity===ft.Warning){this.updateStatus({icon:Gu,message:new Ie().appendText(s.message).appendMarkdown(` ${l}`)},!0);return}}if(this.extensionManagementServerService.remoteExtensionManagementServer){if(IR(this.extension.local.manifest)){if(!this.extensionsWorkbenchService.installed.some(l=>Ut(l.identifier,this.extension.identifier)&&l.server!==this.extension.server)){let l=this.extension.server===this.extensionManagementServerService.localExtensionManagementServer?new Ie(d(10405,null,this.extensionManagementServerService.remoteExtensionManagementServer.label)):new Ie(d(10406,null));this.updateStatus({icon:Ug,message:l},!0)}return}let r=this.extensionService.extensions.filter(l=>Ut({id:l.identifier.value,uuid:l.uuid},this.extension.identifier))[0],s=r?this.extensionManagementServerService.getExtensionManagementServer(ZE(r)):null;if(this.extension.server===this.extensionManagementServerService.localExtensionManagementServer&&s===this.extensionManagementServerService.remoteExtensionManagementServer){this.extensionManifestPropertiesService.prefersExecuteOnWorkspace(this.extension.local.manifest)&&this.updateStatus({icon:Ug,message:new Ie(`${d(10372,null)} [${d(10425,null)}](https://code.visualstudio.com/api/advanced-topics/remote-extensions#architecture-and-extension-kinds)`)},!0);return}if(this.extension.server===this.extensionManagementServerService.remoteExtensionManagementServer&&s===this.extensionManagementServerService.localExtensionManagementServer){this.extensionManifestPropertiesService.prefersExecuteOnUI(this.extension.local.manifest)&&this.updateStatus({icon:Ug,message:new Ie(`${d(10371,null)} [${d(10425,null)}](https://code.visualstudio.com/api/advanced-topics/remote-extensions#architecture-and-extension-kinds)`)},!0);return}if(this.extension.server===this.extensionManagementServerService.remoteExtensionManagementServer&&s===this.extensionManagementServerService.webExtensionManagementServer){this.extensionManifestPropertiesService.canExecuteOnWeb(this.extension.local.manifest)&&this.updateStatus({icon:Ug,message:new Ie(`${d(10370,null)} [${d(10425,null)}](https://code.visualstudio.com/api/advanced-topics/remote-extensions#architecture-and-extension-kinds)`)},!0);return}}if(this.extension.enablementState===8){this.updateStatus({icon:Gu,message:new Ie(d(10377,null)).appendMarkdown(`&nbsp;[${d(10348,null)}](${fc("extension.open",this.extension.identifier.id,"dependencies")})`)},!0);return}if(!this.extension.local.isValid){let r=this.extension.local.validations.filter(([s])=>s===ft.Error).map(([,s])=>s);this.updateStatus({icon:Gu,message:new Ie(r.join(" ").trim())},!0);return}let o=this.workbenchExtensionEnablementService.isEnabled(this.extension.local),n=this.extensionService.extensions.some(r=>Ut({id:r.identifier.value,uuid:r.uuid},this.extension.identifier));if(!this.extension.isWorkspaceScoped&&o&&n){if(this.extension.enablementState===13){this.updateStatus({message:new Ie(d(10491,null))},!0);return}if(this.extensionManagementServerService.localExtensionManagementServer&&this.extensionManagementServerService.remoteExtensionManagementServer&&this.extension.server===this.extensionManagementServerService.remoteExtensionManagementServer){this.updateStatus({message:new Ie(d(10380,null,this.extension.server.label))},!0);return}if(this.extension.enablementState===12)return}if(!o&&!n){if(this.extension.enablementState===10){this.updateStatus({message:new Ie(d(10392,null))},!0);return}if(this.extension.enablementState===11){this.updateStatus({message:new Ie(d(10490,null))},!0);return}}}updateStatus(e,t){if(e){if(this._status.some(o=>o.message.value===e.message.value&&o.icon?.id===e.icon?.id))return}else{if(this._status.length===0)return;this._status=[]}e&&(this._status.push(e),this._status.sort((o,n)=>n.icon===IM?-1:o.icon===IM?1:n.icon===OS?-1:o.icon===OS?1:n.icon===Gu?-1:o.icon===Gu?1:n.icon===Ug?-1:o.icon===Ug?1:0)),t&&(e?.icon===OS?this.class=`${qD.CLASS} extension-status-error ${q.asClassName(OS)}`:e?.icon===Gu?this.class=`${qD.CLASS} extension-status-warning ${q.asClassName(Gu)}`:e?.icon===Ug?this.class=`${qD.CLASS} extension-status-info ${q.asClassName(Ug)}`:e?.icon===IM?this.class=`${qD.CLASS} ${q.asClassName(IM)}`:this.class=`${qD.CLASS} hide`),this._onDidChangeStatus.fire()}async run(){if(this._status[0]?.icon===IM)return this.commandService.executeCommand("workbench.trust.manage")}};qD=I([m(0,Ec),m(1,rt),m(2,ge),m(3,kR),m(4,Nr),m(5,Hi),m(6,lt),m(7,Gp),m(8,Pe),m(9,tt),m(10,dm),m(11,Js),m(12,cy),m(13,Dv)],qD);var ZA=class extends it{constructor(e=ZA.ID,t=ZA.LABEL,o,n,r,s){super(e,t);this.extensionsWorkbenchService=o;this.quickInputService=n;this.instantiationService=r;this.extensionEnablementService=s}static{this.ID="workbench.extensions.action.install.specificVersion"}static{this.LABEL=d(10413,null)}get enabled(){return this.extensionsWorkbenchService.local.some(e=>this.isEnabled(e))}async run(){let e=await this.quickInputService.pick(this.getExtensionEntries(),{placeHolder:d(10454,null),matchOnDetail:!0});e&&e.extension&&(await this.instantiationService.createInstance(WT,e.extension,!0).run(),await this.extensionsWorkbenchService.openSearch(e.extension.identifier.id))}isEnabled(e){return this.instantiationService.createInstance(WT,e,!0).enabled&&!!e.local&&this.extensionEnablementService.isEnabled(e.local)}async getExtensionEntries(){let e=await this.extensionsWorkbenchService.queryLocal(),t=[];for(let o of e)this.isEnabled(o)&&t.push({id:o.identifier.id,label:o.displayName||o.identifier.id,description:o.identifier.id,extension:o});return t.sort((o,n)=>o.extension.displayName.localeCompare(n.extension.displayName))}};ZA=I([m(2,Hi),m(3,Ue),m(4,F),m(5,Js)],ZA);var xPe=class extends it{constructor(e,t,o,n,r){super(e);this.extensionsWorkbenchService=t;this.quickInputService=o;this.notificationService=n;this.progressService=r;this.extensions=void 0;this.update(),this.extensionsWorkbenchService.queryLocal().then(()=>this.updateExtensions()),this._register(this.extensionsWorkbenchService.onChange(()=>{this.extensions&&this.updateExtensions()}))}updateExtensions(){this.extensions=this.extensionsWorkbenchService.local,this.update()}update(){this.enabled=!!this.extensions&&this.getExtensionsToInstall(this.extensions).length>0,this.tooltip=this.label}async run(){return this.selectAndInstallExtensions()}async queryExtensionsToInstall(){let e=await this.extensionsWorkbenchService.queryLocal();return this.getExtensionsToInstall(e)}async selectAndInstallExtensions(){let e=this.quickInputService.createQuickPick();e.busy=!0;let t=e.onDidAccept(()=>{t.dispose(),e.hide(),e.dispose(),this.onDidAccept(e.selectedItems)});e.show();let o=await this.queryExtensionsToInstall();e.busy=!1,o.length?(e.title=this.getQuickPickTitle(),e.placeholder=d(10451,null),e.canSelectMany=!0,o.sort((n,r)=>n.displayName.localeCompare(r.displayName)),e.items=o.map(n=>({extension:n,label:n.displayName,description:n.version}))):(e.hide(),e.dispose(),this.notificationService.notify({severity:ft.Info,message:d(10434,null)}))}async onDidAccept(e){if(e.length){let t=e.filter(o=>!!o.extension).map(o=>o.extension);t.length&&(await this.progressService.withProgress({location:15,title:d(10422,null)},()=>this.installExtensions(t)),this.notificationService.info(d(10391,null)))}}};xPe=I([m(1,Hi),m(2,Ue),m(3,Ne),m(4,Fo)],xPe);var kPe=class extends xPe{constructor(e,t,o,n,r,s,l,c,u){super("workbench.extensions.actions.installLocalExtensionsInRemote",e,t,n,o);this.extensionManagementServerService=r;this.extensionGalleryService=s;this.instantiationService=l;this.fileService=c;this.logService=u}get label(){return this.extensionManagementServerService&&this.extensionManagementServerService.remoteExtensionManagementServer?d(10448,null,this.extensionManagementServerService.remoteExtensionManagementServer.label):""}getQuickPickTitle(){return d(10407,null,this.extensionManagementServerService.remoteExtensionManagementServer.label)}getExtensionsToInstall(e){return e.filter(t=>{let o=this.instantiationService.createInstance(u8,!0);return o.extension=t,o.enabled})}async installExtensions(e){let t=[],o=[],n=await this.extensionManagementServerService.remoteExtensionManagementServer.extensionManagementService.getTargetPlatform();await dn.settled(e.map(async r=>{if(this.extensionGalleryService.isEnabled()){let l=(await this.extensionGalleryService.getExtensions([{...r.identifier,preRelease:!!r.local?.preRelease}],{targetPlatform:n,compatible:!0},Se.None))[0];if(l){t.push(l);return}}let s=await this.extensionManagementServerService.localExtensionManagementServer.extensionManagementService.zip(r.local);o.push(s)})),await dn.settled(t.map(r=>this.extensionManagementServerService.remoteExtensionManagementServer.extensionManagementService.installFromGallery(r)));try{await dn.settled(o.map(r=>this.extensionManagementServerService.remoteExtensionManagementServer.extensionManagementService.install(r)))}finally{try{await Promise.allSettled(o.map(r=>this.fileService.del(r)))}catch(r){this.logService.error(r)}}}};kPe=I([m(0,Hi),m(1,Ue),m(2,Fo),m(3,Ne),m(4,Ec),m(5,fa),m(6,F),m(7,fe),m(8,se)],kPe);var EPe=class extends xPe{constructor(e,t,o,n,r,s,l,c,u){super(e,t,o,r,n);this.extensionManagementServerService=s;this.extensionGalleryService=l;this.fileService=c;this.logService=u}get label(){return d(10449,null)}getQuickPickTitle(){return d(10415,null)}getExtensionsToInstall(e){return e.filter(t=>t.type===1&&t.server!==this.extensionManagementServerService.localExtensionManagementServer&&!this.extensionsWorkbenchService.installed.some(o=>o.server===this.extensionManagementServerService.localExtensionManagementServer&&Ut(o.identifier,t.identifier)))}async installExtensions(e){let t=[],o=[],n=await this.extensionManagementServerService.localExtensionManagementServer.extensionManagementService.getTargetPlatform();await dn.settled(e.map(async r=>{if(this.extensionGalleryService.isEnabled()){let l=(await this.extensionGalleryService.getExtensions([{...r.identifier,preRelease:!!r.local?.preRelease}],{targetPlatform:n,compatible:!0},Se.None))[0];if(l){t.push(l);return}}let s=await this.extensionManagementServerService.remoteExtensionManagementServer.extensionManagementService.zip(r.local);o.push(s)})),await dn.settled(t.map(r=>this.extensionManagementServerService.localExtensionManagementServer.extensionManagementService.installFromGallery(r)));try{await dn.settled(o.map(r=>this.extensionManagementServerService.localExtensionManagementServer.extensionManagementService.install(r)))}finally{try{await Promise.allSettled(o.map(r=>this.fileService.del(r)))}catch(r){this.logService.error(r)}}}};EPe=I([m(1,Hi),m(2,Ue),m(3,Fo),m(4,Ne),m(5,Ec),m(6,fa),m(7,fe),m(8,se)],EPe);$e.registerCommand("workbench.extensions.action.showExtensionsForLanguage",function(a,i){return a.get(Hi).openSearch(`ext:${i.replace(/^\./,"")}`)});var LPe="workbench.extensions.action.showExtensionsWithIds";$e.registerCommand(LPe,function(a,i){return a.get(Hi).openSearch(i.map(t=>`@id:${t}`).join(" "))});te("extensionButton.background",{dark:pj,light:pj,hcDark:null,hcLight:null},d(10383,null));te("extensionButton.foreground",{dark:ple,light:ple,hcDark:null,hcLight:null},d(10385,null));te("extensionButton.hoverBackground",{dark:mle,light:mle,hcDark:null,hcLight:null},d(10386,null));te("extensionButton.border",{dark:Uye,light:Uye,hcDark:bi,hcLight:bi},d(10384,null));te("extensionButton.separator",$vt,d(10390,null));var Jmo=te("extensionButton.prominentBackground",{dark:xC,light:xC,hcDark:null,hcLight:null},d(10387,null));te("extensionButton.prominentForeground",{dark:__,light:__,hcDark:null,hcLight:null},d(10388,null));te("extensionButton.prominentHoverBackground",{dark:uj,light:uj,hcDark:null,hcLight:null},d(10389,null));is((a,i)=>{let e=a.getColor(Iv);e&&(i.addRule(`.extension-editor .header .actions-status-container > .status ${q.asCSSSelector(OS)} { color: ${e}; }`),i.addRule(`.extension-editor .body .subcontent .runtime-status ${q.asCSSSelector(OS)} { color: ${e}; }`),i.addRule(`.monaco-hover.extension-hover .markdown-hover .hover-contents ${q.asCSSSelector(OS)} { color: ${e}; }`));let t=a.getColor(jh);t&&(i.addRule(`.extension-editor .header .actions-status-container > .status ${q.asCSSSelector(Gu)} { color: ${t}; }`),i.addRule(`.extension-editor .body .subcontent .runtime-status ${q.asCSSSelector(Gu)} { color: ${t}; }`),i.addRule(`.monaco-hover.extension-hover .markdown-hover .hover-contents ${q.asCSSSelector(Gu)} { color: ${t}; }`));let o=a.getColor(Dm);o&&(i.addRule(`.extension-editor .header .actions-status-container > .status ${q.asCSSSelector(Ug)} { color: ${o}; }`),i.addRule(`.extension-editor .body .subcontent .runtime-status ${q.asCSSSelector(Ug)} { color: ${o}; }`),i.addRule(`.monaco-hover.extension-hover .markdown-hover .hover-contents ${q.asCSSSelector(Ug)} { color: ${o}; }`))});var eJo="NotebookEditorViewState",jD=class extends Ts{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super(jD.ID,e,t,o,r);this._instantiationService=n;this._editorService=s;this._editorGroupService=l;this._notebookWidgetService=c;this._contextKeyService=u;this._fileService=p;this._editorProgressService=g;this._notebookService=f;this._extensionsWorkbenchService=v;this._workingCopyBackupService=b;this.logService=S;this._preferencesService=y;this._groupListener=this._register(new N);this._widgetDisposableStore=this._register(new N);this._widget={value:void 0};this._inputListener=this._register(new me);this._onDidFocusWidget=this._register(new E);this._onDidBlurWidget=this._register(new E);this._onDidChangeModel=this._register(new E);this.onDidChangeModel=this._onDidChangeModel.event;this._onDidChangeSelection=this._register(new E);this.onDidChangeSelection=this._onDidChangeSelection.event;this._onDidChangeScroll=this._register(new E);this.onDidChangeScroll=this._onDidChangeScroll.event;this._editorMemento=this.getEditorMemento(l,h,eJo),this._register(this._fileService.onDidChangeFileSystemProviderCapabilities(w=>this._onDidChangeFileSystemProvider(w.scheme))),this._register(this._fileService.onDidChangeFileSystemProviderRegistrations(w=>this._onDidChangeFileSystemProvider(w.scheme)))}static{this.ID=MR}get onDidFocus(){return this._onDidFocusWidget.event}get onDidBlur(){return this._onDidBlurWidget.event}_onDidChangeFileSystemProvider(e){this.input instanceof Ra&&this.input.resource?.scheme===e&&this._updateReadonly(this.input)}_onDidChangeInputCapabilities(e){this.input===e&&this._updateReadonly(e)}_updateReadonly(e){this._widget.value?.setOptions({isReadOnly:!!e.isReadonly()})}get textModel(){return this._widget.value?.textModel}get minimumWidth(){return 220}get maximumWidth(){return Number.POSITIVE_INFINITY}set minimumWidth(e){}set maximumWidth(e){}get scopedContextKeyService(){return this._widget.value?.scopedContextKeyService}createEditor(e){this._rootElement=M(e,_(".notebook-editor")),this._rootElement.id=`notebook-editor-element-${xt()}`}getActionViewItem(e,t){if(e.id===NT)return this._register(this._instantiationService.createInstance(HH,e,this,t))}getControl(){return this._widget.value}setVisible(e){super.setVisible(e),e||this._widget.value?.onWillHide()}setEditorVisible(e){super.setEditorVisible(e),this._groupListener.clear(),this._groupListener.add(this.group.onWillCloseEditor(t=>this._saveEditorViewState(t.editor))),this._groupListener.add(this.group.onDidModelChange(()=>{this._editorGroupService.activeGroup!==this.group&&this._widget?.value?.updateEditorFocus()})),e||(this._saveEditorViewState(this.input),this.input&&this._widget.value&&this._widget.value.onWillHide())}focus(){super.focus(),this._widget.value?.focus()}hasFocus(){let e=this._widget.value;return e?!!e&&Gr(e.getDomNode()||Gr(e.getOverflowContainerDomNode())):!1}async setInput(e,t,o,n,r){try{let s=!1,l=Li(1e4);l.then(()=>{s=!0,this._handlePerfMark(c,e)});let c=new fUt;c.mark("startTime"),this._inputListener.value=e.onDidChangeCapabilities(()=>this._onDidChangeInputCapabilities(e)),this._widgetDisposableStore.clear(),this._widget.value?.onWillHide(),this._widget=this._instantiationService.invokeFunction(this._notebookWidgetService.retrieveWidget,this.group.id,e,void 0,this._pagePosition?.dimension,this.window),this._rootElement&&this._widget.value.getDomNode()&&(this._rootElement.setAttribute("aria-flowto",this._widget.value.getDomNode().id||""),dO(this._widget.value.getDomNode(),this._rootElement)),this._widgetDisposableStore.add(this._widget.value.onDidChangeModel(()=>this._onDidChangeModel.fire())),this._widgetDisposableStore.add(this._widget.value.onDidChangeActiveCell(()=>this._onDidChangeSelection.fire({reason:2}))),this._pagePosition&&this._widget.value.layout(this._pagePosition.dimension,this._rootElement,this._pagePosition.position),await super.setInput(e,t,o,n);let u=await e.resolve(t,c);if(c.mark("inputLoaded"),n.isCancellationRequested)return;if(!this._widget.value)return r?void 0:this.setInput(e,t,o,n,!0);if(u===null){let g=this._notebookService.getViewTypeProvider(e.viewType);if(!g)throw new Error(d(12670,null,e.viewType));await this._extensionsWorkbenchService.whenInitialized;let f=this._extensionsWorkbenchService.local.find(v=>v.identifier.id===g);throw t4(new Error(d(12671,null,e.viewType)),[ii({id:"workbench.notebook.action.installOrEnableMissing",label:f?d(12673,null,e.viewType):d(12674,null,e.viewType),run:async()=>{let v=this._notebookService.onAddViewType(S=>{S===e.viewType&&(this._editorService.openEditor({resource:e.resource}),v.dispose())}),b=this._extensionsWorkbenchService.local.find(S=>S.identifier.id===g);try{b?await this._extensionsWorkbenchService.setEnablement(b,b.enablementState===11?13:12):await this._instantiationService.createInstance(JA,g).run()}catch(S){this.logService.error(`Failed to install or enable extension ${g}`,S),v.dispose()}}}),ii({id:"workbench.notebook.action.openAsText",label:d(12672,null),run:async()=>{let v=await this._workingCopyBackupService.resolve({resource:e.resource,typeId:yF.create(e.viewType)});if(v){let b=await tb(v.value);this._editorService.openEditor({resource:void 0,contents:b.toString()})}else this._editorService.openEditor({resource:e.resource,options:{override:la.id,pinned:!0}})}})],{allowDialog:!0})}this._widgetDisposableStore.add(u.notebook.onDidChangeContent(()=>this._onDidChangeSelection.fire({reason:3})));let p=t?.viewState??this._loadNotebookEditorViewState(e);this._widget.value.setParentContextKeyService(this._contextKeyService),this._widget.value.setEditorProgressService(this._editorProgressService),await this._widget.value.setModel(u.notebook,p,c);let h=!!e.isReadonly();if(await this._widget.value.setOptions({...t,isReadOnly:h}),this._widgetDisposableStore.add(this._widget.value.onDidFocusWidget(()=>this._onDidFocusWidget.fire())),this._widgetDisposableStore.add(this._widget.value.onDidBlurWidget(()=>this._onDidBlurWidget.fire())),this._widgetDisposableStore.add(this._editorGroupService.createEditorDropTarget(this._widget.value.getDomNode(),{containsGroup:g=>this.group.id===g.id})),this._widgetDisposableStore.add(this._widget.value.onDidScroll(()=>{this._onDidChangeScroll.fire()})),c.mark("editorLoaded"),l.cancel(),s)return;this._handlePerfMark(c,e,u.notebook),this._onDidChangeControl.fire()}catch(s){if(this.logService.warn("NotebookEditorWidget#setInput failed",s),e4(s))throw s;if(s.fileOperationResult===7){let c;throw s instanceof MO?c=d(12677,null,vl.formatSize(s.size)):c=d(12676,null),LEe(this.group,e,t,c,this._preferencesService)}throw t4(s instanceof Error?s:new Error(s?s.message:""),[ii({id:"workbench.notebook.action.openInTextEditor",label:d(12675,null),run:async()=>{let c=this._editorService.activeEditorPane;if(!c)return;let u=po.getCanonicalUri(c.input);if(u&&u.toString()===e.resource?.toString())return this._editorService.openEditor({resource:u,options:{override:la.id,pinned:!0}})}})],{allowDialog:!0})}}_handlePerfMark(e,t,o){let n=e.value,r=n.startTime,s=n.extensionActivated,l=n.inputLoaded,c=n.webviewCommLoaded,u=n.customMarkdownLoaded,p=n.editorLoaded,h=-1,g=-1,f=-1,v=-1,b=-1;r!==void 0&&s!==void 0&&(h=s-r,l!==void 0&&(g=l-s),c!==void 0&&(f=c-s),u!==void 0&&(v=u-r),p!==void 0&&(b=p-r));let S,y,w,k,T,P,O;if(o){let V=new Dn;for(let H of o.cells)H.cellKind===2?(S=(S||0)+1,T=(T||0)+H.getTextLength(),w=(w||0)+H.outputs.length,k=(k||0)+H.outputs.reduce((G,$)=>G+$.outputs.reduce((J,ae)=>J+ae.data.byteLength,0),0)):(y=(y||0)+1,P=(T||0)+H.getTextLength());O=V.elapsed()}this.logService.trace(`[NotebookEditor] open notebook perf ${o?.uri.toString()??""} - extensionActivation: ${h}, inputLoad: ${g}, webviewComm: ${f}, customMarkdown: ${v}, editorLoad: ${b}`),this.telemetryService.publicLog2("notebook/editorOpenPerf",{scheme:t.resource.scheme,ext:es(t.resource),viewType:t.viewType,extensionActivated:h,inputLoaded:g,webviewCommLoaded:f,customMarkdownLoaded:v,editorLoaded:b,codeCellCount:S,mdCellCount:y,outputCount:w,outputBytes:k,codeLength:T,markdownLength:P,notebookStatsLoaded:O})}clearInput(){this._inputListener.clear(),this._widget.value&&(this._saveEditorViewState(this.input),this._widget.value.onWillHide()),super.clearInput()}setOptions(e){this._widget.value?.setOptions(e),super.setOptions(e)}saveState(){this._saveEditorViewState(this.input),super.saveState()}getViewState(){let e=this.input;if(e instanceof Ra)return this._saveEditorViewState(e),this._loadNotebookEditorViewState(e)}getSelection(){if(this._widget.value){let e=this._widget.value.getActiveCell();if(e){let t=e.uri;return new CEi(t,e.getSelections())}}}getScrollPosition(){let e=this.getControl();if(!e)throw new Error("Notebook widget has not yet been initialized");return{scrollTop:e.scrollTop,scrollLeft:0}}setScrollPosition(e){let t=this.getControl();if(!t)throw new Error("Control has not yet been initialized");t.setScrollTop(e.scrollTop)}_saveEditorViewState(e){if(this._widget.value&&e instanceof Ra){if(this._widget.value.isDisposed)return;let t=this._widget.value.getEditorViewState();this._editorMemento.saveEditorState(this.group,e.resource,t)}}_loadNotebookEditorViewState(e){let t=this._editorMemento.loadEditorState(this.group,e.resource);if(t)return t;for(let o of this._editorGroupService.getGroups(1))if(o.activeEditorPane!==this&&o.activeEditorPane instanceof jD&&o.activeEditor?.matches(e))return o.activeEditorPane._widget.value?.getEditorViewState()}layout(e,t){this._rootElement.classList.toggle("mid-width",e.width<1e3&&e.width>=600),this._rootElement.classList.toggle("narrow-width",e.width<600),this._pagePosition={dimension:e,position:t},!(!this._widget.value||!(this.input instanceof Ra))&&(this.input.resource.toString()!==this.textModel?.uri.toString()&&this._widget.value?.hasModel()||this.isVisible()&&this._widget.value.layout(e,this._rootElement,t))}};jD=I([m(1,Te),m(2,Le),m(3,F),m(4,ce),m(5,ee),m(6,wt),m(7,Gc),m(8,X),m(9,fe),m(10,Fn),m(11,wd),m(12,bn),m(13,Hi),m(14,hm),m(15,se),m(16,Go)],jD);var CEi=class a{constructor(i,e){this.cellUri=i;this.selections=e}compare(i){return i instanceof a?Qe(this.cellUri,i.cellUri)?1:3:3}restore(i){let e={cellOptions:{resource:this.cellUri,options:{selection:this.selections[0]}}};return Object.assign(e,i),e}log(){return this.cellUri.fragment}};function Zmo(a,i){if(a?.getId()===jD.ID){let e=a.getControl();if(e){for(let[t,o]of e.codeEditors)if(o===i)return!0}}return!1}var she=Object.freeze({type:"type",displayName:"displayName",selector:"selector",priority:"priority"}),eN=Object.freeze({id:"id",displayName:"displayName",mimeTypes:"mimeTypes",entrypoint:"entrypoint",hardDependencies:"dependencies",optionalDependencies:"optionalDependencies",requiresMessaging:"requiresMessaging"}),_tt=Object.freeze({type:"type",entrypoint:"entrypoint",localResourceRoots:"localResourceRoots"}),iJo={description:d(12702,null),type:"array",defaultSnippets:[{body:[{type:"",displayName:"",selector:[{filenamePattern:""}]}]}],items:{type:"object",required:[she.type,she.displayName,she.selector],properties:{[she.type]:{type:"string",description:d(12706,null)},[she.displayName]:{type:"string",description:d(12703,null)},[she.selector]:{type:"array",description:d(12704,null),items:{type:"object",properties:{filenamePattern:{type:"string",description:d(12705,null)},excludeFileNamePattern:{type:"string",description:d(12719,null)}}}},[she.priority]:{type:"string",markdownDeprecationMessage:d(12724,null),enum:["default","option"],markdownEnumDescriptions:[d(12725,null),d(12726,null)],default:"default"}}}},eho=Object.freeze({id:"",displayName:"",mimeTypes:[""],entrypoint:""}),oJo={description:d(12707,null),type:"array",defaultSnippets:[{body:[eho]}],items:{defaultSnippets:[{body:eho}],allOf:[{type:"object",required:[eN.id,eN.displayName],properties:{[eN.id]:{type:"string",description:d(12717,null)},[eN.displayName]:{type:"string",description:d(12708,null)},[eN.hardDependencies]:{type:"array",uniqueItems:!0,items:{type:"string"},markdownDescription:d(12711,null)},[eN.optionalDependencies]:{type:"array",uniqueItems:!0,items:{type:"string"},markdownDescription:d(12712,null)},[eN.requiresMessaging]:{default:"never",enum:["always","optional","never"],enumDescriptions:[d(12714,null),d(12716,null),d(12715,null)],description:d(12713,null)}}},{oneOf:[{required:[eN.entrypoint,eN.mimeTypes],properties:{[eN.mimeTypes]:{type:"array",description:d(12718,null),items:{type:"string"}},[eN.entrypoint]:{description:d(12709,null),type:"string"}}},{required:[eN.entrypoint],properties:{[eN.entrypoint]:{description:d(12709,null),type:"object",required:["extends","path"],properties:{extends:{type:"string",description:d(12710,null)},path:{type:"string",description:d(12709,null)}}}}}]}]}},nJo={description:d(12722,null),type:"array",defaultSnippets:[{body:[{type:"",entrypoint:""}]}],items:{type:"object",required:[_tt.type,_tt.entrypoint],properties:{[_tt.type]:{type:"string",description:d(12723,null)},[_tt.entrypoint]:{type:"string",description:d(12720,null)},[_tt.localResourceRoots]:{type:"array",items:{type:"string"},description:d(12721,null)}}}},tho=Rn.registerExtensionPoint({extensionPoint:"notebooks",jsonSchema:iJo,activationEventsGenerator:function*(a){for(let i of a)i.type&&(yield`onNotebookSerializer:${i.type}`)}}),iho=Rn.registerExtensionPoint({extensionPoint:"notebookRenderer",jsonSchema:oJo,activationEventsGenerator:function*(a){for(let i of a)i.id&&(yield`onRenderer:${i.id}`)}}),oho=Rn.registerExtensionPoint({extensionPoint:"notebookPreload",jsonSchema:nJo}),xEi=class extends x{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.notebooks}render(e){let t=e.contributes?.notebooks||[];if(!t.length)return{data:{headers:[],rows:[]},dispose:()=>{}};let o=[d(12727,null),d(12729,null)],n=t.sort((r,s)=>r.type.localeCompare(s.type)).map(r=>[r.type,r.displayName]);return{data:{headers:o,rows:n},dispose:()=>{}}}},kEi=class extends x{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.notebookRenderer}render(e){let t=e.contributes?.notebookRenderer||[];if(!t.length)return{data:{headers:[],rows:[]},dispose:()=>{}};let o=[d(12730,null),d(12728,null)],n=t.sort((r,s)=>r.displayName.localeCompare(s.displayName)).map(r=>[r.displayName,r.mimeTypes.join(",")]);return{data:{headers:o,rows:n},dispose:()=>{}}}};ne.as(As.ExtensionFeaturesRegistry).registerExtensionFeature({id:"notebooks",label:d(12732,null),access:{canToggle:!1},renderer:new Ft(xEi)});ne.as(As.ExtensionFeaturesRegistry).registerExtensionFeature({id:"notebookRenderer",label:d(12731,null),access:{canToggle:!1},renderer:new Ft(kEi)});var EEi=class extends wh{constructor(e,t){super();this.original=e;this.modified=t}},Xw=class extends Pa{constructor(e,t,o,n,r,s){super(e,t,o,n,void 0,s);this.original=o;this.modified=n;this.viewType=r;this._modifiedTextModel=null;this._originalTextModel=null;this._cachedModel=void 0}static create(e,t,o,n,r,s){let l=Ra.getOrCreate(e,r,void 0,s),c=Ra.getOrCreate(e,t,void 0,s);return e.createInstance(Xw,o,n,l,c,s)}static{this.ID="workbench.input.diffNotebookInput"}get resource(){return this.modified.resource}get editorId(){return this.viewType}get typeId(){return Xw.ID}async resolve(){let[e,t]=await Promise.all([this.original.resolve(),this.modified.resolve()]);if(this._cachedModel?.dispose(),!t)throw new Error(`Fail to resolve modified editor model for resource ${this.modified.resource} with notebookType ${this.viewType}`);if(!e)throw new Error(`Fail to resolve original editor model for resource ${this.original.resource} with notebookType ${this.viewType}`);return this._originalTextModel=e,this._modifiedTextModel=t,this._cachedModel=new EEi(this._originalTextModel,this._modifiedTextModel),this._cachedModel}toUntyped(){let e={resource:this.original.resource},t={resource:this.resource};return{original:e,modified:t,primary:t,secondary:e,options:{override:this.viewType}}}matches(e){return this===e?!0:e instanceof Xw?this.modified.matches(e.modified)&&this.original.matches(e.original)&&this.viewType===e.viewType:Ib(e)?this.modified.matches(e.modified)&&this.original.matches(e.original)&&this.editorId!==void 0&&(this.editorId===e.options?.override||e.options?.override===void 0):!1}dispose(){super.dispose(),this._cachedModel?.dispose(),this._cachedModel=void 0,this.original.dispose(),this.modified.dispose(),this._originalTextModel=null,this._modifiedTextModel=null}};Xw=I([m(5,ee)],Xw);var IUt=class{constructor(i,e,t,o,n,r,s){this.resource=i;this.fromIndex=e;this.length=t;this.toIndex=o;this.editingDelegate=n;this.beforedSelections=r;this.endSelections=s;this.type=0;this.code="undoredo.textBufferEdit"}get label(){return this.length===1?"Move Cell":"Move Cells"}undo(){if(!this.editingDelegate.moveCell)throw new Error("Notebook Move Cell not implemented for Undo/Redo");this.editingDelegate.moveCell(this.toIndex,this.length,this.fromIndex,this.endSelections,this.beforedSelections)}redo(){if(!this.editingDelegate.moveCell)throw new Error("Notebook Move Cell not implemented for Undo/Redo");this.editingDelegate.moveCell(this.fromIndex,this.length,this.toIndex,this.beforedSelections,this.endSelections)}},yUt=class{constructor(i,e,t,o,n){this.resource=i;this.diffs=e;this.editingDelegate=t;this.beforeHandles=o;this.endHandles=n;this.type=0;this.code="undoredo.textBufferEdit"}get label(){return this.diffs.length===1&&this.diffs[0][1].length===0?this.diffs[0][2].length>1?"Insert Cells":"Insert Cell":this.diffs.length===1&&this.diffs[0][2].length===0?this.diffs[0][1].length>1?"Delete Cells":"Delete Cell":"Insert Cell"}undo(){if(!this.editingDelegate.replaceCell)throw new Error("Notebook Replace Cell not implemented for Undo/Redo");this.diffs.forEach(i=>{this.editingDelegate.replaceCell(i[0],i[2].length,i[1],this.beforeHandles)})}redo(){if(!this.editingDelegate.replaceCell)throw new Error("Notebook Replace Cell not implemented for Undo/Redo");this.diffs.reverse().forEach(i=>{this.editingDelegate.replaceCell(i[0],i[1].length,i[2],this.endHandles)})}},wUt=class{constructor(i,e,t,o,n){this.resource=i;this.index=e;this.oldMetadata=t;this.newMetadata=o;this.editingDelegate=n;this.type=0;this.label="Update Cell Metadata";this.code="undoredo.textBufferEdit"}undo(){this.editingDelegate.updateCellMetadata&&this.editingDelegate.updateCellMetadata(this.index,this.oldMetadata)}redo(){this.editingDelegate.updateCellMetadata&&this.editingDelegate.updateCellMetadata(this.index,this.newMetadata)}};var hte=class extends x{constructor(e){super();this._rawOutput=e;this._onDidChangeData=this._register(new E);this.onDidChangeData=this._onDidChangeData.event;this._versionId=0;this.versionedBufferLengths={};this._alternativeOutputId=this._rawOutput.outputId}get outputs(){return this._rawOutput.outputs||[]}get metadata(){return this._rawOutput.metadata}get outputId(){return this._rawOutput.outputId}get alternativeOutputId(){return this._alternativeOutputId}get versionId(){return this._versionId}replaceData(e){this.versionedBufferLengths={},this._rawOutput=e,this.optimizeOutputItems(),this._versionId=this._versionId+1,this._onDidChangeData.fire()}appendData(e){this.trackBufferLengths(),this._rawOutput.outputs.push(...e),this.optimizeOutputItems(),this._versionId=this._versionId+1,this._onDidChangeData.fire()}trackBufferLengths(){this.outputs.forEach(e=>{HL(e.mime)&&(this.versionedBufferLengths[e.mime]||(this.versionedBufferLengths[e.mime]={}),this.versionedBufferLengths[e.mime][this.versionId]=e.data.byteLength)})}appendedSinceVersion(e,t){let o=this.versionedBufferLengths[t]?.[e],n=this.outputs.find(r=>r.mime===t);if(o&&n)return n.data.slice(o)}optimizeOutputItems(){if(this.outputs.length>1&&this.outputs.every(e=>HL(e.mime))){let e=new Map,t=[];this.outputs.forEach(o=>{let n;e.has(o.mime)?n=e.get(o.mime):(n=[],e.set(o.mime,n),t.push(o.mime)),n.push(o.data.buffer)}),this.outputs.length=0,t.forEach(o=>{let n=WJi(e.get(o));this.outputs.push({mime:o,data:n.data}),n.didCompression&&(this.versionedBufferLengths={})})}}asDto(){return{metadata:this._rawOutput.metadata,outputs:this._rawOutput.outputs,outputId:this._rawOutput.outputId}}bumpVersion(){this._versionId=this._versionId+1}};var f8=class a extends x{constructor(e,t,o,n,r,s,l,c=void 0,u){super();this.uri=e;this.handle=t;this.transientOptions=n;this._languageService=r;this._defaultEOL=s;this._languageDetectionService=c;this._notebookLoggingService=u;this._onDidChangeTextModel=this._register(new E);this.onDidChangeTextModel=this._onDidChangeTextModel.event;this._onDidChangeOutputs=this._register(new E);this.onDidChangeOutputs=this._onDidChangeOutputs.event;this._onDidChangeOutputItems=this._register(new E);this.onDidChangeOutputItems=this._onDidChangeOutputItems.event;this._onDidChangeContent=this._register(new E);this.onDidChangeContent=this._onDidChangeContent.event;this._onDidChangeMetadata=this._register(new E);this.onDidChangeMetadata=this._onDidChangeMetadata.event;this._onDidChangeInternalMetadata=this._register(new E);this.onDidChangeInternalMetadata=this._onDidChangeInternalMetadata.event;this._onDidChangeLanguage=this._register(new E);this.onDidChangeLanguage=this._onDidChangeLanguage.event;this._textBufferHash=null;this._hash=null;this._versionId=1;this._alternativeId=1;this._textModelDisposables=this._register(new N);this._textModel=void 0;this.autoDetectLanguageThrottler=this._register(new ya(a.AUTO_DETECT_LANGUAGE_THROTTLE_DELAY));this._autoLanguageDetectionEnabled=!1;this._hasLanguageSetExplicitly=!1;this._source=o.source,this._language=o.language,this._mime=o.mime,this.cellKind=o.cellKind;let p=o.cellKind===2?l?.codeCell:l?.markupCell;this.collapseState=o.collapseState??p??void 0,this._outputs=o.outputs.map(h=>new hte(h)),this._metadata=o.metadata??{},this._internalMetadata=o.internalMetadata??{}}get outputs(){return this._outputs}get metadata(){return this._metadata}set metadata(e){this._metadata=e,this._hash=null,this._onDidChangeMetadata.fire()}get internalMetadata(){return this._internalMetadata}set internalMetadata(e){let t=this._internalMetadata.lastRunSuccess!==e.lastRunSuccess;e={...e,runStartTimeAdjustment:rJo(this._internalMetadata,e)},this._internalMetadata=e,this._hash=null,this._onDidChangeInternalMetadata.fire({lastRunSuccessChanged:t})}get language(){return this._language}set language(e){this._textModel&&this._textModel.getLanguageId()===this._languageService.getLanguageIdByLanguageName(e)&&this._textModel.getLanguageId()===this._languageService.getLanguageIdByLanguageName(this.language)||(this._hasLanguageSetExplicitly=!0,this._setLanguageInternal(e))}get mime(){return this._mime}set mime(e){this._mime!==e&&(this._mime=e,this._hash=null,this._onDidChangeContent.fire("mime"))}get textBuffer(){return this._textBuffer?this._textBuffer:(this._textBuffer=this._register(hz(this._source,this._defaultEOL).textBuffer),this._register(this._textBuffer.onDidChangeContent(()=>{this._hash=null,this._textModel||this._onDidChangeContent.fire("content"),this.autoDetectLanguage()})),this._textBuffer)}get alternativeId(){return this._alternativeId}get textModel(){return this._textModel}set textModel(e){this._textModel!==e&&(this._textModelDisposables.clear(),this._textModel=e,this._textModel&&(this.setRegisteredLanguage(this._languageService,this._textModel.getLanguageId(),this.language),this._textModelDisposables.add(this._textModel.onDidChangeLanguage(t=>this.setRegisteredLanguage(this._languageService,t.newLanguage,this.language))),this._textModelDisposables.add(this._textModel.onWillDispose(()=>this.textModel=void 0)),this._textModelDisposables.add(this._textModel.onDidChangeContent(t=>{this._textModel&&(this._versionId=this._textModel.getVersionId(),this._alternativeId=this._textModel.getAlternativeVersionId()),this._textBufferHash=null,this._onDidChangeContent.fire("content"),this._onDidChangeContent.fire({type:"model",event:t})})),this._textModel._overwriteVersionId(this._versionId),this._textModel._overwriteAlternativeVersionId(this._versionId),this._onDidChangeTextModel.fire()))}setRegisteredLanguage(e,t,o){let n=t===$r||t==="jupyter";!e.isRegisteredLanguageId(o)&&n?this._onDidChangeLanguage.fire(o):this.language=t}static{this.AUTO_DETECT_LANGUAGE_THROTTLE_DELAY=600}get hasLanguageSetExplicitly(){return this._hasLanguageSetExplicitly}enableAutoLanguageDetection(){this._autoLanguageDetectionEnabled=!0,this.autoDetectLanguage()}async autoDetectLanguage(){this._autoLanguageDetectionEnabled&&this.autoDetectLanguageThrottler.trigger(()=>this._doAutoDetectLanguage())}async _doAutoDetectLanguage(){if(this.hasLanguageSetExplicitly)return;let e=await this._languageDetectionService?.detectLanguage(this.uri);e&&(this._textModel&&this._textModel.getLanguageId()===this._languageService.getLanguageIdByLanguageName(e)&&this._textModel.getLanguageId()===this._languageService.getLanguageIdByLanguageName(this.language)||this._setLanguageInternal(e))}_setLanguageInternal(e){let t=this._languageService.getLanguageIdByLanguageName(e);if(t!==null){if(this._textModel){let o=this._languageService.createById(t);this._textModel.setLanguage(o.languageId)}this._language!==e&&(this._language=e,this._hash=null,this._onDidChangeLanguage.fire(e),this._onDidChangeContent.fire("language"))}}resetTextBuffer(e){this._textBuffer=e}getValue(){let e=this.getFullModelRange();return this.textBuffer.getEOL()===`
`?this.textBuffer.getValueInRange(e,1):this.textBuffer.getValueInRange(e,2)}getTextBufferHash(){if(this._textBufferHash!==null)return this._textBufferHash;let e=new Yy,t=this.textBuffer.createSnapshot(!1),o;for(;o=t.read();)e.update(o);return this._textBufferHash=e.digest(),this._textBufferHash}getHashValue(){return this._hash!==null?this._hash:(this._hash=_r([_r(this.language),this.getTextBufferHash(),this._getPersisentMetadata(),this.transientOptions.transientOutputs?[]:this._outputs.map(e=>({outputs:e.outputs.map(t=>({mime:t.mime,data:Array.from(t.data.buffer)})),metadata:e.metadata}))]),this._hash)}_getPersisentMetadata(){return wG(this.transientOptions.transientCellMetadata,this.metadata,this.language)}getTextLength(){return this.textBuffer.getLength()}getFullModelRange(){let e=this.textBuffer.getLineCount();return new z(1,1,e,this.textBuffer.getLineLength(e)+1)}spliceNotebookCellOutputs(e){if(this._notebookLoggingService.trace("textModelEdits",`splicing outputs at ${e.start} length: ${e.deleteCount} with ${e.newOutputs.length} new outputs`),e.deleteCount>0&&e.newOutputs.length>0){let t=Math.min(e.deleteCount,e.newOutputs.length);for(let n=0;n<t;n++){let r=this.outputs[e.start+n],s=e.newOutputs[n];this.replaceOutput(r.outputId,s)}this.outputs.splice(e.start+t,e.deleteCount-t,...e.newOutputs.slice(t)).forEach(n=>n.dispose()),this._onDidChangeOutputs.fire({start:e.start+t,deleteCount:e.deleteCount-t,newOutputs:e.newOutputs.slice(t)})}else this.outputs.splice(e.start,e.deleteCount,...e.newOutputs).forEach(o=>o.dispose()),this._onDidChangeOutputs.fire(e)}replaceOutput(e,t){let o=this.outputs.findIndex(r=>r.outputId===e);return o<0?!1:(this._notebookLoggingService.trace("textModelEdits",`replacing an output item at index ${o}`),this.outputs[o].replaceData({outputs:t.outputs,outputId:t.outputId,metadata:t.metadata}),t.dispose(),this._onDidChangeOutputItems.fire(),!0)}changeOutputItems(e,t,o){let n=this.outputs.findIndex(s=>s.outputId===e);if(n<0)return!1;let r=this.outputs[n];return this._notebookLoggingService.trace("textModelEdits",`${t?"appending":"replacing"} ${o.length} output items to for output index ${n}`),t?r.appendData(o):r.replaceData({outputId:e,outputs:o,metadata:r.metadata}),this._onDidChangeOutputItems.fire(),!0}_outputNotEqualFastCheck(e,t){if(e.length!==t.length)return!1;for(let o=0;o<this.outputs.length;o++){let n=e[o],r=t[o];if(n.outputs.length!==r.outputs.length)return!1;for(let s=0;s<n.outputs.length;s++)if(n.outputs[s].mime!==r.outputs[s].mime||n.outputs[s].data.byteLength!==r.outputs[s].data.byteLength)return!1}return!0}equal(e){return this.language!==e.language||this.outputs.length!==e.outputs.length||this.getTextLength()!==e.getTextLength()||!this.transientOptions.transientOutputs&&!this._outputNotEqualFastCheck(this.outputs,e.outputs)?!1:this.getHashValue()===e.getHashValue()}fastEqual(e,t){if(this.language!==e.language||this.mime!==e.mime||this.cellKind!==e.cellKind||!t&&(this.internalMetadata?.executionOrder!==e.internalMetadata?.executionOrder||this.internalMetadata?.lastRunSuccess!==e.internalMetadata?.lastRunSuccess||this.internalMetadata?.runStartTime!==e.internalMetadata?.runStartTime||this.internalMetadata?.runStartTimeAdjustment!==e.internalMetadata?.runStartTimeAdjustment||this.internalMetadata?.runEndTime!==e.internalMetadata?.runEndTime))return!1;if(this._textBuffer){if(!a.linesAreEqual(this.textBuffer.getLinesContent(),e.source))return!1}else if(this._source!==e.source)return!1;return!0}static linesAreEqual(e,t){let o=yc(t);if(e.length!==o.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==o[n])return!1;return!0}dispose(){Be(this._outputs);let e=new Z7([],"",`
`,!1,!1,!0,!0);e.dispose(),this._textBuffer=e,super.dispose()}};function yG(a){return{source:a.getValue(),language:a.language,mime:a.mime,cellKind:a.cellKind,outputs:a.outputs.map(i=>({outputs:i.outputs,outputId:xt()})),metadata:{}}}function rJo(a,i){if(a.runStartTime!==i.runStartTime&&typeof i.runStartTime=="number"){let e=Date.now()-i.runStartTime;return e<0?Math.abs(e):0}else return i.runStartTimeAdjustment}function wG(a,i,e,t){let o={};if(a){let s=new Set([...Object.keys(i)]);for(let l of s)a[l]||(o[l]=i[l])}else o=i;let n={language:e,...o};return e&&(n.language=e),s0(t?TEi(n):n,{})}function TEi(a){return Array.isArray(a)?a.map(TEi):a!=null&&typeof a=="object"&&Object.keys(a).length>0?Object.keys(a).sort().reduce((i,e)=>(i[e]=TEi(a[e]),i),{}):a}var _Ei=class{constructor(i,e,t,o,n,r){this.textModel=i;this.undoRedoGroup=e;this._pauseableEmitter=t;this._postUndoRedo=o;this.tag="notebookUndoRedoElement";this._operations=[];this._beginSelectionState=void 0;this._resultSelectionState=void 0;this.type=1,this._beginSelectionState=n,this._beginAlternativeVersionId=r,this._resultAlternativeVersionId=r}get code(){return this._operations.length===1?this._operations[0].code:"undoredo.notebooks.stackOperation"}get label(){return this._operations.length===1?this._operations[0].label:"edit"}get resources(){return[this.textModel.uri]}get isEmpty(){return this._operations.length===0}pushEndState(i,e){this._resultAlternativeVersionId=i,this._resultSelectionState=e||this._resultSelectionState}pushEditOperation(i,e,t,o){this._operations.length===0&&(this._beginSelectionState=this._beginSelectionState??e),this._operations.push(i),this._resultSelectionState=t,this._resultAlternativeVersionId=o}async undo(){this._pauseableEmitter.pause();try{for(let i=this._operations.length-1;i>=0;i--)await this._operations[i].undo();this._postUndoRedo(this._beginAlternativeVersionId),this._pauseableEmitter.fire({rawEvents:[],synchronous:void 0,versionId:this.textModel.versionId,endSelectionState:this._beginSelectionState})}finally{this._pauseableEmitter.resume()}}async redo(){this._pauseableEmitter.pause();try{for(let i=0;i<this._operations.length;i++)await this._operations[i].redo();this._postUndoRedo(this._resultAlternativeVersionId),this._pauseableEmitter.fire({rawEvents:[],synchronous:void 0,versionId:this.textModel.versionId,endSelectionState:this._resultSelectionState})}finally{this._pauseableEmitter.resume()}}},DEi=class{constructor(i,e,t,o){this._textModel=i;this._undoService=e;this._pauseableEmitter=t;this._postUndoRedo=o;this._pendingStackOperation=null;this._isAppending=!1}isUndoStackEmpty(){return this._pendingStackOperation===null||this._pendingStackOperation.isEmpty}pushStackElement(i,e){this._pendingStackOperation&&!this._pendingStackOperation.isEmpty&&(this._pendingStackOperation.pushEndState(i,e),this._isAppending||this._undoService.pushElement(this._pendingStackOperation,this._pendingStackOperation.undoRedoGroup)),this._isAppending=!1,this._pendingStackOperation=null}_getOrCreateEditStackElement(i,e,t){return this._pendingStackOperation??=new _Ei(this._textModel,e,this._pauseableEmitter,this._postUndoRedo,i,t||"")}appendPreviousOperation(){let i=this._undoService.getLastElement(this._textModel.uri);return i&&i.tag==="notebookUndoRedoElement"?(this._pendingStackOperation=i,this._isAppending=!0,!0):!1}pushEditOperation(i,e,t,o,n){this._getOrCreateEditStackElement(e,n,o).pushEditOperation(i,e,t,o)}},LEi=class extends Gm{get isEmpty(){return this._eventQueue.isEmpty()}isDirtyEvent(){for(let i of this._eventQueue)for(let e=0;e<i.rawEvents.length;e++)if(!i.rawEvents[e].transient)return!0;return!1}},gte=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this.viewType=e;this.uri=t;this._undoService=s;this._modelService=l;this._languageService=c;this._languageDetectionService=u;this._notebookExecutionStateService=p;this._notebookLoggingService=h;this._isDisposed=!1;this._onWillDispose=this._register(new E);this._onWillAddRemoveCells=this._register(new E);this._onDidChangeContent=this._register(new E);this.onWillDispose=this._onWillDispose.event;this.onWillAddRemoveCells=this._onWillAddRemoveCells.event;this.onDidChangeContent=this._onDidChangeContent.event;this._cellhandlePool=0;this._cellListeners=new Map;this._cells=[];this.metadata={};this.transientOptions={transientCellMetadata:{},transientDocumentMetadata:{},transientOutputs:!1,cellContentMetadata:{}};this._versionId=0;this._notebookSpecificAlternativeId=0;this._alternativeVersionId="1";this.newCellsFromLastEdit=new Set;this.transientOptions=r,this.metadata=n,this._initialize(o);let g=f=>{if(f.uri.scheme===Q.vscodeNotebookCell&&f instanceof ip){let v=Zo.parse(f.uri);if(v&&Qe(v.notebook,this.uri)){let b=this._getCellIndexByHandle(v.handle);if(b>=0){let S=this.cells[b];S&&(S.textModel=f)}}}};this._register(l.onModelAdded(f=>g(f))),this._pauseableEmitter=this._register(new LEi({merge:f=>{let v=f[0],b=v.rawEvents,S=v.versionId,y=v.endSelectionState,w=v.synchronous;for(let k=1;k<f.length;k++)b.push(...f[k].rawEvents),S=f[k].versionId,y=f[k].endSelectionState!==void 0?f[k].endSelectionState:y,w=f[k].synchronous!==void 0?f[k].synchronous:w;return{rawEvents:b,versionId:S,endSelectionState:y,synchronous:w}}})),this._register(this._pauseableEmitter.event(f=>{f.rawEvents.length&&this._onDidChangeContent.fire(f)})),this._operationManager=new DEi(this,this._undoService,this._pauseableEmitter,f=>{this._increaseVersionId(!0),this._overwriteAlternativeVersionId(f)}),this._notebookLoggingService.trace("notebookTextModel",`Initialized notebook text model for ${t.toString()}`)}get length(){return this._cells.length}get cells(){return this._cells}get versionId(){return this._versionId}get alternativeVersionId(){return this._alternativeVersionId}get notebookType(){return this.viewType}setCellCollapseDefault(e){this._defaultCollapseConfig=e}_initialize(e,t){this._cells=[],this._versionId=0,this._notebookSpecificAlternativeId=0;let o=e.map(n=>{let r=this._cellhandlePool++,s=Zo.generate(this.uri,r);return new f8(s,r,n,this.transientOptions,this._languageService,this._modelService.getCreationOptions(n.language,s,!1).defaultEOL,this._defaultCollapseConfig,this._languageDetectionService,this._notebookLoggingService)});for(let n=0;n<o.length;n++){let r=o[n].onDidChangeContent(s=>{this._bindCellContentHandler(o[n],s)});this._cellListeners.set(o[n].handle,r),this._register(o[n])}this._cells.splice(0,0,...o),this._alternativeVersionId=this._generateAlternativeId(),t&&this._pauseableEmitter.fire({rawEvents:[{kind:100,transient:!1}],versionId:this.versionId,synchronous:!0,endSelectionState:void 0})}_bindCellContentHandler(e,t){switch(this._increaseVersionId(t==="content"||typeof t=="object"&&t.type==="model"),t){case"content":this._pauseableEmitter.fire({rawEvents:[{kind:10,index:this._getCellIndexByHandle(e.handle),transient:!1}],versionId:this.versionId,synchronous:!0,endSelectionState:void 0});break;case"language":this._pauseableEmitter.fire({rawEvents:[{kind:5,index:this._getCellIndexByHandle(e.handle),language:e.language,transient:!1}],versionId:this.versionId,synchronous:!0,endSelectionState:void 0});break;case"mime":this._pauseableEmitter.fire({rawEvents:[{kind:13,index:this._getCellIndexByHandle(e.handle),mime:e.mime,transient:!1}],versionId:this.versionId,synchronous:!0,endSelectionState:void 0});break;default:typeof t=="object"&&t.type==="model"&&this._pauseableEmitter.fire({rawEvents:[{kind:10,index:this._getCellIndexByHandle(e.handle),transient:!1}],versionId:this.versionId,synchronous:!0,endSelectionState:void 0});break}}_generateAlternativeId(){return`${this._notebookSpecificAlternativeId}_`+this.cells.map(e=>e.handle+","+e.alternativeId).join(";")}dispose(){this._isDisposed||(this._isDisposed=!0,this._onWillDispose.fire(),this._undoService.removeElements(this.uri),Be(this._cellListeners.values()),this._cellListeners.clear(),Be(this._cells),this._cells=[],super.dispose())}pushStackElement(){}_getCellIndexByHandle(e){return this.cells.findIndex(t=>t.handle===e)}_getCellIndexWithOutputIdHandleFromEdits(e,t){let o=t.find(n=>No(n,{outputs:!0})&&n.outputs.some(r=>r.outputId===e));if(o){if(No(o,{index:!0}))return o.index;if(No(o,{handle:!0})){let n=this._getCellIndexByHandle(o.handle);return this._assertIndex(n),n}}return-1}_getCellIndexWithOutputIdHandle(e){return this.cells.findIndex(t=>!!t.outputs.find(o=>o.outputId===e))}reset(e,t,o){this.transientOptions=o;let r=this._notebookExecutionStateService.getCellExecutionsForNotebook(this.uri).filter(l=>l.state===3).map(l=>l.cellHandle),s=gte.computeEdits(this,e,r);this.applyEdits([...s,{editType:5,metadata:t}],!0,void 0,()=>{},void 0,!1)}createSnapshot(e){let t=e.transientOptions??this.transientOptions,o={metadata:IP(this.metadata,r=>!t.transientDocumentMetadata[r]),cells:[]},n=0;for(let r of this.cells){let s={cellKind:r.cellKind,language:r.language,mime:r.mime,source:r.getValue(),outputs:[],internalMetadata:r.internalMetadata};if(e.context===2&&e.outputSizeLimit>0&&(r.outputs.forEach(l=>{l.outputs.forEach(c=>{n+=c.data.byteLength})}),n>e.outputSizeLimit))throw new Error("Notebook too large to backup");s.outputs=t.transientOutputs?[]:r.outputs,s.metadata=IP(r.metadata,l=>!t.transientCellMetadata[l]),o.cells.push(s)}return o}restoreSnapshot(e,t){this.reset(e.cells,e.metadata,t??this.transientOptions)}static computeEdits(e,t,o=[]){let n=[],r=c=>o.includes(c.handle),s=this._commonPrefix(e.cells,e.cells.length,0,t,t.length,0,r);if(s>0)for(let c=0;c<s;c++)n.push({editType:3,index:c,metadata:t[c].metadata??{}},...this._computeOutputEdit(c,e.cells[c].outputs,t[c].outputs));if(e.cells.length===t.length&&s===e.cells.length)return n;let l=this._commonSuffix(e.cells,e.cells.length-s,s,t,t.length-s,s,r);if(l>0?n.push({editType:1,index:s,count:e.cells.length-s-l,cells:t.slice(s,t.length-l)}):s>0?n.push({editType:1,index:s,count:e.cells.length-s,cells:t.slice(s)}):n.push({editType:1,index:0,count:e.cells.length,cells:t}),l>0)for(let c=l;c>0;c--)n.push({editType:3,index:e.cells.length-c,metadata:t[t.length-c].metadata??{}},...this._computeOutputEdit(e.cells.length-c,e.cells[e.cells.length-c].outputs,t[t.length-c].outputs));return n}static _computeOutputEdit(e,t,o){return t.length!==o.length?[{editType:2,index:e,outputs:o,append:!1}]:t.length===0?[]:o.map((n,r)=>({editType:7,outputId:t[r].outputId,items:n.outputs,append:!1}))}static _commonPrefix(e,t,o,n,r,s,l){let c=Math.min(t,r),u=0;for(let p=0;p<c&&e[o+p].fastEqual(n[s+p],l(e[o+p]));p++)u++;return u}static _commonSuffix(e,t,o,n,r,s,l){let c=Math.min(t,r),u=0;for(let p=0;p<c&&e[o+t-p-1].fastEqual(n[s+r-p-1],l(e[o+t-p-1]));p++)u++;return u}isOnlyEditingMetadataOnNewCells(e){for(let t of e)if(t.editType!==9&&(t.editType!==3&&t.editType!==8||No(t,{index:!0})&&!this.newCellsFromLastEdit.has(this.cells[t.index].handle)||No(t,{handle:!0})&&!this.newCellsFromLastEdit.has(t.handle)))return!1;return!0}applyEdits(e,t,o,n,r,s){this._notebookLoggingService.trace("textModelEdits",`Begin applying ${e.length} raw edits`),this._pauseableEmitter.pause();try{this._operationManager.pushStackElement(this._alternativeVersionId,void 0),s&&this.isOnlyEditingMetadataOnNewCells(e)?this._operationManager.appendPreviousOperation()||(s=!1):s&&this.newCellsFromLastEdit.clear();try{return this._doApplyEdits(e,t,s,o,r),!0}catch(l){throw this._notebookLoggingService.error("textModelEdits",`Error while applying edits: ${l}`),l}finally{if(!this._pauseableEmitter.isEmpty){let l=n();this._increaseVersionId(this._operationManager.isUndoStackEmpty()&&!this._pauseableEmitter.isDirtyEvent()),this._operationManager.pushStackElement(this._alternativeVersionId,l),this._pauseableEmitter.fire({rawEvents:[],versionId:this.versionId,synchronous:t,endSelectionState:l}),this._notebookLoggingService.trace("textModelEdits",`End applying ${e.length} raw edits`)}}}finally{this._pauseableEmitter.resume()}}_doApplyEdits(e,t,o,n,r){let s=e.map((u,p)=>{let h=-1;if(No(u,{index:!0}))h=u.index;else if(No(u,{handle:!0}))h=this._getCellIndexByHandle(u.handle),this._assertIndex(h,`editType: ${u.editType}, key: handle`);else if(No(u,{outputId:!0})){if(h=this._getCellIndexWithOutputIdHandle(u.outputId),this._indexIsInvalid(h)&&(h=this._getCellIndexWithOutputIdHandleFromEdits(u.outputId,e.slice(0,p))),this._indexIsInvalid(h))return null}else if(u.editType!==5)throw new Error("Invalid cell edit: "+JSON.stringify(u));return{edit:u,cellIndex:h,end:u.editType===5?void 0:u.editType===1?u.index+u.count:h,originalIndex:p}}).filter(lo),c=this._mergeCellEdits(s).sort((u,p)=>u.end===void 0?-1:p.end===void 0?1:p.end-u.end||p.originalIndex-u.originalIndex).reduce((u,p)=>{if(!u.length)u.push([p]);else{let h=u[u.length-1],g=h[0].cellIndex;p.cellIndex===g?h.push(p):u.push([p])}return u},[]).map(u=>{let p=[],h=[];return u.forEach(g=>{g.edit.editType===1?p.push(g):h.push(g)}),[...h.reverse(),...p]}).flat();for(let{edit:u,cellIndex:p}of c)switch(u.editType){case 1:this._replaceCells(u.index,u.count,u.cells,t,o,n,r);break;case 2:{this._assertIndex(p);let h=this._cells[p];u.append?this._spliceNotebookCellOutputs(h,{start:h.outputs.length,deleteCount:0,newOutputs:u.outputs.map(g=>new hte(g))},!0,o):this._spliceNotebookCellOutputs2(h,u.outputs,o);break}case 7:{this._assertIndex(p);let h=this._cells[p];u.append?this._appendNotebookCellOutputItems(h,u.outputId,u.items):this._replaceNotebookCellOutputItems(h,u.outputId,u.items)}break;case 3:this._assertIndex(u.index),this._changeCellMetadata(this._cells[u.index],u.metadata,o,n,r);break;case 8:this._assertIndex(p),this._changeCellMetadataPartial(this._cells[p],u.metadata,o,n,r);break;case 9:this._assertIndex(p),this._changeCellInternalMetadataPartial(this._cells[p],u.internalMetadata);break;case 4:this._assertIndex(u.index),this._changeCellLanguage(this._cells[u.index],u.language,o,n,r);break;case 5:this._updateNotebookCellMetadata(u.metadata,o,n,r);break;case 6:this._moveCellToIdx(u.index,u.length,u.newIdx,t,o,n,void 0,r);break}}_mergeCellEdits(e){let t=[];return e.forEach(o=>{if(t.length){let n=t[t.length-1];n.edit.editType===2&&n.edit.append&&o.edit.editType===2&&o.edit.append&&n.cellIndex===o.cellIndex?n.edit.outputs=[...n.edit.outputs,...o.edit.outputs]:n.edit.editType===2&&!n.edit.append&&n.edit.outputs.length===0&&o.edit.editType===2&&o.edit.append&&n.cellIndex===o.cellIndex?(n.edit.append=!1,n.edit.outputs=o.edit.outputs):t.push(o)}else t.push(o)}),t}_replaceCells(e,t,o,n,r,s,l){if(t===0&&o.length===0)return;let c=this._cells.slice(0),u=new Set;c.forEach(v=>{u.add(v.handle)});for(let v=e;v<Math.min(e+t,this._cells.length);v++){let b=this._cells[v];this._cellListeners.get(b.handle)?.dispose(),this._cellListeners.delete(b.handle)}let p=o.map(v=>{let b=this._cellhandlePool++,S=Zo.generate(this.uri,b);v.outputs||(v.outputs=[]);let y=new f8(S,b,v,this.transientOptions,this._languageService,this._modelService.getCreationOptions(v.language,S,!1).defaultEOL,this._defaultCollapseConfig,this._languageDetectionService,this._notebookLoggingService),w=this._modelService.getModel(S);w&&w instanceof ip&&(y.textModel=w,y.language=v.language,y.textModel.setValue(v.source),y.resetTextBuffer(y.textModel.getTextBuffer()));let k=y.onDidChangeContent(T=>{this._bindCellContentHandler(y,T)});return this.newCellsFromLastEdit.add(y.handle),this._cellListeners.set(y.handle,k),this._register(y),y}),h=this._cells.slice(0);h.splice(e,t,...p);let g=AQe(this._cells,h,v=>u.has(v.handle)).map(v=>[v.start,v.deleteCount,v.toInsert]);this._onWillAddRemoveCells.fire({rawEvent:{kind:1,changes:g}}),this._cells=h;let f=g.map(v=>{let b=c.slice(v[0],v[0]+v[1]);return[v[0],b,v[2]]});r&&this._operationManager.pushEditOperation(new yUt(this.uri,f,{insertCell:(v,b,S)=>{this._insertNewCell(v,[b],!0,S)},deleteCell:(v,b)=>{this._removeCell(v,1,!0,b)},replaceCell:(v,b,S,y)=>{this._replaceNewCells(v,b,S,!0,y)}},void 0,void 0),s,void 0,this._alternativeVersionId,l),this._pauseableEmitter.fire({rawEvents:[{kind:1,changes:g,transient:!1}],versionId:this.versionId,synchronous:n,endSelectionState:void 0})}_increaseVersionId(e){this._versionId=this._versionId+1,e||(this._notebookSpecificAlternativeId=this._versionId),this._alternativeVersionId=this._generateAlternativeId()}_overwriteAlternativeVersionId(e){this._alternativeVersionId=e,this._notebookSpecificAlternativeId=Number(e.substring(0,e.indexOf("_")))}_updateNotebookCellMetadata(e,t,o,n){let r=this.metadata,s=this._isDocumentMetadataChanged(this.metadata,e);if(s&&t){let l=this;this._operationManager.pushEditOperation(new class{constructor(){this.type=0;this.label="Update Cell Metadata";this.code="undoredo.textBufferEdit"}get resource(){return l.uri}undo(){l._updateNotebookCellMetadata(r,!1,o,n)}redo(){l._updateNotebookCellMetadata(e,!1,o,n)}},o,void 0,this._alternativeVersionId,n)}this.metadata=e,this._pauseableEmitter.fire({rawEvents:[{kind:11,metadata:this.metadata,transient:!s}],versionId:this.versionId,synchronous:!0,endSelectionState:void 0})}_insertNewCell(e,t,o,n){for(let s=0;s<t.length;s++){let l=t[s].onDidChangeContent(c=>{this._bindCellContentHandler(t[s],c)});this._cellListeners.set(t[s].handle,l)}let r=[[e,0,t]];this._onWillAddRemoveCells.fire({rawEvent:{kind:1,changes:r}}),this._cells.splice(e,0,...t),this._pauseableEmitter.fire({rawEvents:[{kind:1,changes:r,transient:!1}],versionId:this.versionId,synchronous:o,endSelectionState:n})}_removeCell(e,t,o,n){for(let s=e;s<e+t;s++){let l=this._cells[s];this._cellListeners.get(l.handle)?.dispose(),this._cellListeners.delete(l.handle)}let r=[[e,t,[]]];this._onWillAddRemoveCells.fire({rawEvent:{kind:1,changes:r}}),this._cells.splice(e,t),this._pauseableEmitter.fire({rawEvents:[{kind:1,changes:r,transient:!1}],versionId:this.versionId,synchronous:o,endSelectionState:n})}_replaceNewCells(e,t,o,n,r){for(let l=e;l<e+t;l++){let c=this._cells[l];this._cellListeners.get(c.handle)?.dispose(),this._cellListeners.delete(c.handle)}for(let l=0;l<o.length;l++){let c=o[l].onDidChangeContent(u=>{this._bindCellContentHandler(o[l],u)});this._cellListeners.set(o[l].handle,c)}let s=[[e,t,o]];this._onWillAddRemoveCells.fire({rawEvent:{kind:1,changes:s}}),this._cells.splice(e,t,...o),this._pauseableEmitter.fire({rawEvents:[{kind:1,changes:s,transient:!1}],versionId:this.versionId,synchronous:n,endSelectionState:r})}_isDocumentMetadataChanged(e,t){let o=new Set([...Object.keys(e||{}),...Object.keys(t||{})]);for(let n of o)if(n==="custom"){if(!this._customMetadataEqual(e[n],t[n])&&!this.transientOptions.transientDocumentMetadata[n])return!0}else if(e[n]!==t[n]&&!this.transientOptions.transientDocumentMetadata[n])return!0;return!1}_isCellMetadataChanged(e,t){let o=new Set([...Object.keys(e||{}),...Object.keys(t||{})]);for(let n of o)if(e[n]!==t[n]&&!this.transientOptions.transientCellMetadata[n])return!0;return!1}_customMetadataEqual(e,t){if(!e&&!t)return!0;if(!e||!t)return!1;let o=Object.getOwnPropertyNames(e),n=Object.getOwnPropertyNames(t);if(o.length!==n.length)return!1;for(let r=0;r<o.length;r++){let s=o[r];if(e[s]!==t[s])return!1}return!0}_changeCellMetadataPartial(e,t,o,n,r){let s={...e.metadata},l;for(l in t){let c=t[l]??void 0;s[l]=c}return this._changeCellMetadata(e,s,o,n,r)}_changeCellMetadata(e,t,o,n,r){let s=this._isCellMetadataChanged(e.metadata,t);if(s&&o){let l=this._cells.indexOf(e);this._operationManager.pushEditOperation(new wUt(this.uri,l,Object.freeze(e.metadata),Object.freeze(t),{updateCellMetadata:(c,u)=>{let p=this._cells[c];p&&this._changeCellMetadata(p,u,!1,n,r)}}),n,void 0,this._alternativeVersionId,r)}e.metadata=t,this._pauseableEmitter.fire({rawEvents:[{kind:7,index:this._cells.indexOf(e),metadata:e.metadata,transient:!s}],versionId:this.versionId,synchronous:!0,endSelectionState:void 0})}_changeCellInternalMetadataPartial(e,t){let o={...e.internalMetadata},n;for(n in t){let r=t[n]??void 0;o[n]=r}e.internalMetadata=o,this._pauseableEmitter.fire({rawEvents:[{kind:12,index:this._cells.indexOf(e),internalMetadata:e.internalMetadata,transient:!0}],versionId:this.versionId,synchronous:!0,endSelectionState:void 0})}_changeCellLanguage(e,t,o,n,r){if(e.language===t)return;let s=e.language;if(e.language=t,o){let l=this;this._operationManager.pushEditOperation(new class{constructor(){this.type=0;this.label="Update Cell Language";this.code="undoredo.textBufferEdit"}get resource(){return l.uri}undo(){l._changeCellLanguage(e,s,!1,n,r)}redo(){l._changeCellLanguage(e,t,!1,n,r)}},n,void 0,this._alternativeVersionId,r)}this._pauseableEmitter.fire({rawEvents:[{kind:5,index:this._cells.indexOf(e),language:t,transient:!1}],versionId:this.versionId,synchronous:!0,endSelectionState:void 0})}_spliceNotebookCellOutputs2(e,t,o){if(t.length===0&&e.outputs.length===0)return;if(t.length<=1){this._spliceNotebookCellOutputs(e,{start:0,deleteCount:e.outputs.length,newOutputs:t.map(l=>new hte(l))},!1,o);return}new xP(new CUt(e.outputs),new CUt(t)).ComputeDiff(!1).changes.map(l=>({start:l.originalStart,deleteCount:l.originalLength,newOutputs:t.slice(l.modifiedStart,l.modifiedStart+l.modifiedLength).map(c=>new hte(c))})).reverse().forEach(l=>{this._spliceNotebookCellOutputs(e,l,!1,o)})}_spliceNotebookCellOutputs(e,t,o,n){e.spliceNotebookCellOutputs(t),this._pauseableEmitter.fire({rawEvents:[{kind:8,index:this._cells.indexOf(e),outputs:e.outputs.map(r=>r.asDto())??[],append:o,transient:this.transientOptions.transientOutputs}],versionId:this.versionId,synchronous:!0,endSelectionState:void 0})}_appendNotebookCellOutputItems(e,t,o){e.changeOutputItems(t,!0,o)&&this._pauseableEmitter.fire({rawEvents:[{kind:9,index:this._cells.indexOf(e),outputId:t,outputItems:o,append:!0,transient:this.transientOptions.transientOutputs}],versionId:this.versionId,synchronous:!0,endSelectionState:void 0})}_replaceNotebookCellOutputItems(e,t,o){e.changeOutputItems(t,!1,o)&&this._pauseableEmitter.fire({rawEvents:[{kind:9,index:this._cells.indexOf(e),outputId:t,outputItems:o,append:!1,transient:this.transientOptions.transientOutputs}],versionId:this.versionId,synchronous:!0,endSelectionState:void 0})}_moveCellToIdx(e,t,o,n,r,s,l,c){r&&this._operationManager.pushEditOperation(new IUt(this.uri,e,t,o,{moveCell:(p,h,g,f,v)=>{this._moveCellToIdx(p,h,g,!0,!1,f,v,c)}},s,l),s,l,this._alternativeVersionId,c),this._assertIndex(e),this._assertIndex(o);let u=this._cells.splice(e,t);return this._cells.splice(o,0,...u),this._pauseableEmitter.fire({rawEvents:[{kind:2,index:e,length:t,newIdx:o,cells:u,transient:!1}],versionId:this.versionId,synchronous:n,endSelectionState:l}),!0}_assertIndex(e,t){if(this._indexIsInvalid(e))throw new Error(`model index out of range ${e} (cellCount: ${this._cells.length}${t?`, ${t}`:""})`)}_indexIsInvalid(e){return e<0||e>=this._cells.length}findNextMatch(e,t,o,n,r,s){this._assertIndex(t.cellIndex);let c=new tw(e,o,n,r).parseSearchRequest();if(!c)return null;let u=t.cellIndex,p=t.position,h=this._cells.length;for(;u<h;){let g=this._cells[u],f=s&&u===s.cellIndex&&p.isBefore(s.position),v=new z(p.lineNumber,p.column,f?s.position.lineNumber:g.textBuffer.getLineCount(),f?s.position.column:g.textBuffer.getLineMaxColumn(g.textBuffer.getLineCount())),b=g.textBuffer.findMatchesLineByLine(v,c,!1,1);if(b.length>0)return{cell:g,match:b[0]};if(f)break;u++,s&&u>=this._cells.length&&(u=0,h=s.cellIndex+1),p=new ye(1,1)}return null}findMatches(e,t,o,n){let s=new tw(e,t,o,n).parseSearchRequest();if(!s)return[];let l=[];for(let c of this._cells){let u=new z(1,1,c.textBuffer.getLineCount(),c.textBuffer.getLineMaxColumn(c.textBuffer.getLineCount())),p=c.textBuffer.findMatchesLineByLine(u,s,!1,1e3);p.length>0&&l.push({cell:c,matches:p})}return l}};gte=I([m(5,Ml),m(6,Tt),m(7,_t),m(8,vS),m(9,bs),m(10,Uv)],gte);var CUt=class{constructor(i){this.outputs=i}getElements(){return this.outputs.map(i=>_r(i.outputs.map(e=>({mime:e.mime,data:e.data}))))}};var xUt=class{constructor(i){this.value=new Set(i),this.defined=this.value.size>0}matches(i){return i.some(e=>this.value.has(e))}},kUt=class{constructor(i){this.id=i.id,this.extensionId=i.extension.identifier,this.extensionLocation=i.extension.extensionLocation,this.isBuiltin=i.extension.isBuiltin,typeof i.entrypoint=="string"?this.entrypoint={extends:void 0,path:Ge(this.extensionLocation,i.entrypoint)}:this.entrypoint={extends:i.entrypoint.extends,path:Ge(this.extensionLocation,i.entrypoint.path)},this.displayName=i.displayName,this.mimeTypes=i.mimeTypes,this.mimeTypeGlobs=this.mimeTypes.map(e=>Ym(e,{ignoreCase:!0})),this.hardDependencies=new xUt(i.dependencies??vt.empty()),this.optionalDependencies=new xUt(i.optionalDependencies??vt.empty()),this.messaging=i.requiresMessaging??"never"}matchesWithoutKernel(i){return this.matchesMimeTypeOnly(i)?this.hardDependencies.defined?0:this.optionalDependencies.defined?1:2:3}matches(i,e){return this.matchesMimeTypeOnly(i)?this.hardDependencies.defined?this.hardDependencies.matches(e)?0:3:this.optionalDependencies.matches(e)?1:2:3}matchesMimeTypeOnly(i){return this.entrypoint.extends?!1:this.mimeTypeGlobs.some(e=>e(i))||this.mimeTypes.some(e=>e===i)}},EUt=class{constructor(i){this.type=i.type,this.entrypoint=Ge(i.extension.extensionLocation,i.entrypoint),this.extensionLocation=i.extension.extensionLocation,this.localResourceRoots=i.localResourceRoots.map(e=>Ge(i.extension.extensionLocation,e))}};var fte=class a{get selectors(){return this._selectors}get options(){return this._options}constructor(i){this.extension=i.extension,this.id=i.id,this.displayName=i.displayName,this._selectors=i.selectors?.map(e=>({include:e.filenamePattern,exclude:e.excludeFileNamePattern||""}))||i._selectors||[],this.priority=i.priority,this.providerDisplayName=i.providerDisplayName,this._options={transientCellMetadata:{},transientDocumentMetadata:{},transientOutputs:!1,cellContentMetadata:{}}}update(i){i.selectors&&(this._selectors=i.selectors),i.options&&(this._options=i.options)}matches(i){return this.selectors?.some(e=>a.selectorMatches(e,i))}static selectorMatches(i,e){if((typeof i=="string"||qP(i))&&Ed(i,jo(e.fsPath),{ignoreCase:!0}))return!0;if(!QTt(i))return!1;let t=i.include,o=i.exclude;return Ed(t,jo(e.fsPath),{ignoreCase:!0})?!(o&&Ed(o,jo(e.fsPath),{ignoreCase:!0})):!1}static possibleFileEnding(i){for(let e of i){let t=a._possibleFileEnding(e);if(t)return t}}static _possibleFileEnding(i){let e=/^.*(\.[a-zA-Z0-9_-]+)$/,t;if(typeof i=="string")t=i;else if(qP(i))t=i.pattern;else if(i.include)return a._possibleFileEnding(i.include);if(t){let o=e.exec(t);if(o)return o[1]}}};var lJo="multi-cell-notebook-diff-editor",ahe=class a extends Xw{static{this.ID="workbench.input.multiDiffNotebookInput"}static create(i,e,t,o,n,r){let s=Ra.getOrCreate(i,n,void 0,r),l=Ra.getOrCreate(i,e,void 0,r);return i.createInstance(a,t,o,s,l,r)}},vte=class extends au{constructor(e,t,o,n,r,s,l){super(e,void 0,void 0,!0,o,n,r,s,l);this.notebookDiffViewModel=t;this._register(s.registerResolver(this))}static createInput(e,t){let o=A.parse(`${lJo}:${new Date().getMilliseconds().toString()+Math.random().toString()}`);return t.createInstance(vte,o,e)}canHandleUri(e){return e.toString()===this.multiDiffSource.toString()}async resolveDiffSource(e){return{resources:this.notebookDiffViewModel}}};vte=I([m(2,Bt),m(3,Fn),m(4,F),m(5,XK),m(6,Uo)],vte);var iN=class extends x{constructor(e,t,o,n,r,s,l,c,u){super();this._editorResolverService=o;this._configurationService=n;this._accessibilityService=r;this._instantiationService=s;this._fileService=l;this._notebookEditorModelResolverService=c;this.uriIdentService=u;this._handled=!1;this._contributedEditors=new Map;this._contributedEditorDisposables=this._register(new N);this._memento=new Al(iN.CUSTOM_EDITORS_STORAGE_ID,e);let p=this._memento.getMemento(0,1);this._editorResolverService.bufferChangeEvents(()=>{for(let h of p[iN.CUSTOM_EDITORS_ENTRY_ID]||[])this.add(new fte(h),!1)}),this._register(t.onDidRegisterExtensions(()=>{this._handled||(this._clear(),p[iN.CUSTOM_EDITORS_ENTRY_ID]=[],this._memento.saveMemento())})),tho.setHandler(h=>this._setupHandler(h))}static{this.CUSTOM_EDITORS_STORAGE_ID="notebookEditors"}static{this.CUSTOM_EDITORS_ENTRY_ID="editors"}dispose(){this._clear(),super.dispose()}_setupHandler(e){this._handled=!0;let t=[...this._contributedEditors.values()].filter(r=>!r.extension);this._clear();let o=new Map;t.forEach(r=>{o.set(r.id,this.add(r))});for(let r of e)for(let s of r.value){if(!s.type){r.collector.error("Notebook does not specify type-property");continue}let l=this.get(s.type);if(l)if(!l.extension&&r.description.isBuiltin&&t.find(c=>c.id===s.type))o.get(s.type)?.dispose();else{r.collector.error(`Notebook type '${s.type}' already used`);continue}this.add(new fte({extension:r.description.identifier,id:s.type,displayName:s.displayName,selectors:s.selector||[],priority:this._convertPriority(s.priority),providerDisplayName:r.description.displayName??r.description.identifier.value}))}let n=this._memento.getMemento(0,1);n[iN.CUSTOM_EDITORS_ENTRY_ID]=Array.from(this._contributedEditors.values()),this._memento.saveMemento()}clearEditorCache(){let e=this._memento.getMemento(0,1);e[iN.CUSTOM_EDITORS_ENTRY_ID]=[],this._memento.saveMemento()}_convertPriority(e){return e?e==="default"?"default":"option":"default"}_registerContributionPoint(e){let t=new N;for(let o of e.selectors){let n=o.include||o,r={id:e.id,label:e.displayName,detail:e.providerDisplayName,priority:e.priority},s={canHandleDiff:()=>!!this._configurationService.getValue(yt.textDiffEditorPreview)&&!this._accessibilityService.isScreenReaderOptimized(),canSupportResource:f=>f.scheme===Q.vscodeNotebookCellOutput?new URLSearchParams(f.query).get("openIn")==="notebook":f.scheme===Q.untitled||f.scheme===Q.vscodeNotebookCell||this._fileService.hasProvider(f)},l=async({resource:f,options:v})=>{let b;if(f.scheme===Q.vscodeNotebookCellOutput){let P=Zo.parseCellOutputUri(f);if(!P||!P.notebook||P.cellHandle===void 0)throw new Error("Invalid cell output uri");b={notebook:P.notebook,handle:P.cellHandle}}else b=Zo.parse(f);let S,y;b?(S=this.uriIdentService.asCanonicalUri(b.notebook),y={resource:f,options:v}):S=this.uriIdentService.asCanonicalUri(f),y||(y=v?.cellOptions);let w;if(f.scheme===Q.vscodeNotebookCellOutput){if(b?.handle===void 0||!b?.notebook)throw new Error("Invalid cell handle");y={resource:Zo.generate(b.notebook,b.handle),options:v};let O=await this._notebookEditorModelResolverService.resolve(S).then(H=>H.object.notebook.cells.findIndex(G=>G.handle===b?.handle)).then(H=>H>=0?H:0),V=[{start:O,end:O+1}];w={...v,cellOptions:y,viewState:void 0,cellSelections:V}}else w={...v,cellOptions:y,viewState:void 0};let k=y?.resource;return{editor:Ra.getOrCreate(this._instantiationService,S,k,e.id),options:w}},c=async({resource:f,options:v})=>{let b=await this._notebookEditorModelResolverService.resolve({untitledResource:f},e.id);return U.once(b.object.notebook.onWillDispose)(()=>{b.dispose()}),{editor:Ra.getOrCreate(this._instantiationService,b.object.resource,void 0,e.id),options:v}},u=(f,v)=>{let{modified:b,original:S,label:y,description:w}=f;return this._configurationService.getValue("notebook.experimental.enableNewDiffEditor")?{editor:ahe.create(this._instantiationService,b.resource,y,w,S.resource,e.id)}:{editor:Xw.create(this._instantiationService,b.resource,y,w,S.resource,e.id)}},h={createEditorInput:l,createDiffEditorInput:u,createUntitledEditorInput:c,createMergeEditorInput:f=>({editor:this._instantiationService.createInstance(Eb,f.base.resource,{uri:f.input1.resource,title:f.input1.label??He(f.input1.resource),description:f.input1.description??"",detail:f.input1.detail},{uri:f.input2.resource,title:f.input2.label??He(f.input2.resource),description:f.input2.description??"",detail:f.input2.detail},f.result.resource)})},g={createEditorInput:l,createDiffEditorInput:u};t.add(this._configurationService.onDidChangeConfiguration(f=>{f.affectsConfiguration(yt.textDiffEditorPreview)&&(!!this._configurationService.getValue(yt.textDiffEditorPreview)&&!this._accessibilityService.isScreenReaderOptimized()?(h.createDiffEditorInput=u,g.createDiffEditorInput=u):(h.createDiffEditorInput=void 0,g.createDiffEditorInput=void 0))})),t.add(this._accessibilityService.onDidChangeScreenReaderOptimized(()=>{!!this._configurationService.getValue(yt.textDiffEditorPreview)&&!this._accessibilityService.isScreenReaderOptimized()?(h.createDiffEditorInput=u,g.createDiffEditorInput=u):(h.createDiffEditorInput=void 0,g.createDiffEditorInput=void 0)})),t.add(this._editorResolverService.registerEditor(n,r,s,h)),t.add(this._editorResolverService.registerEditor(`${Q.vscodeNotebookCell}:/**/${n}`,{...r,priority:"exclusive"},s,g))}return t}_clear(){this._contributedEditors.clear(),this._contributedEditorDisposables.clear()}get(e){return this._contributedEditors.get(e)}add(e,t=!0){if(this._contributedEditors.has(e.id))throw new Error(`notebook type '${e.id}' ALREADY EXISTS`);this._contributedEditors.set(e.id,e);let o;if(e.extension&&(o=this._registerContributionPoint(e),this._contributedEditorDisposables.add(o)),t){let n=this._memento.getMemento(0,1);n[iN.CUSTOM_EDITORS_ENTRY_ID]=Array.from(this._contributedEditors.values()),this._memento.saveMemento()}return this._register(Z(()=>{let n=this._memento.getMemento(0,1);n[iN.CUSTOM_EDITORS_ENTRY_ID]=Array.from(this._contributedEditors.values()),this._memento.saveMemento(),o?.dispose(),this._contributedEditors.delete(e.id)}))}getContributedNotebook(e){let t=[];for(let o of this._contributedEditors.values())o.matches(e)&&t.push(o);return t.length===0&&e.scheme===Q.untitled?Array.from(this._contributedEditors.values()):t}[Symbol.iterator](){return this._contributedEditors.values()}};iN=I([m(0,ce),m(1,lt),m(2,Ka),m(3,B),m(4,Oi),m(5,F),m(6,fe),m(7,yh),m(8,ht)],iN);var Dtt=class{constructor(i){this.contributedRenderers=new Map;this.preferredMimetype=new co(()=>this.preferredMimetypeMemento.getMemento(1,1));this.preferredMimetypeMemento=new Al("workbench.editor.notebook.preferredRenderer2",i)}clear(){this.contributedRenderers.clear()}get(i){return this.contributedRenderers.get(i)}getAll(){return Array.from(this.contributedRenderers.values())}add(i){this.contributedRenderers.has(i.id)||this.contributedRenderers.set(i.id,i)}setPreferred(i,e,t){let o=this.preferredMimetype.value,n=o[i.id];n?n[e]=t:o[i.id]={[e]:t},this.preferredMimetypeMemento.saveMemento()}findBestRenderers(i,e,t){let o;(g=>(g[g.PreviouslySelected=256]="PreviouslySelected",g[g.SameExtensionAsNotebook=512]="SameExtensionAsNotebook",g[g.OtherRenderer=768]="OtherRenderer",g[g.BuiltIn=1024]="BuiltIn"))(o||={});let n=i&&this.preferredMimetype.value[i.id]?.[e],r=i?.extension?.value,s=i?.id,l=Array.from(this.contributedRenderers.values()).map(c=>{let u=t===void 0?c.matchesWithoutKernel(e):c.matches(e,t);if(u===3)return;let p=c.extensionId.value,h=n===c.id?256:p===r||FJi.get(p)?.has(s)?512:c.isBuiltin?1024:768;return{ordered:{mimeType:e,rendererId:c.id,isTrusted:!0},score:h|u}}).filter(lo);return l.length===0?[{mimeType:e,rendererId:SK,isTrusted:!0}]:l.sort((c,u)=>c.score-u.score).map(c=>c.ordered)}};Dtt=I([m(0,ce)],Dtt);var REi=class{constructor(i,e){this.model=i;this._modelEventListeners=new N;this._modelEventListeners.add(i.onWillDispose(()=>e(i)))}get uri(){return this.model.uri}getCellIndex(i){return this.model.cells.findIndex(e=>Qe(e.uri,i))}dispose(){this._modelEventListeners.dispose()}},bte=class extends x{constructor(e,t,o,n,r,s){super();this._extensionService=e;this._configurationService=t;this._accessibilityService=o;this._instantiationService=n;this._storageService=r;this._notebookDocumentService=s;this._notebookProviders=new Map,this._notebookProviderInfoStore=void 0,this._notebookRenderersInfoStore=this._instantiationService.createInstance(Dtt),this._onDidChangeOutputRenderers=this._register(new E),this.onDidChangeOutputRenderers=this._onDidChangeOutputRenderers.event,this._notebookStaticPreloadInfoStore=new Set,this._models=new gt,this._onWillAddNotebookDocument=this._register(new E),this._onDidAddNotebookDocument=this._register(new E),this._onWillRemoveNotebookDocument=this._register(new E),this._onDidRemoveNotebookDocument=this._register(new E),this.onWillAddNotebookDocument=this._onWillAddNotebookDocument.event,this.onDidAddNotebookDocument=this._onDidAddNotebookDocument.event,this.onDidRemoveNotebookDocument=this._onDidRemoveNotebookDocument.event,this.onWillRemoveNotebookDocument=this._onWillRemoveNotebookDocument.event,this._onAddViewType=this._register(new E),this.onAddViewType=this._onAddViewType.event,this._onWillRemoveViewType=this._register(new E),this.onWillRemoveViewType=this._onWillRemoveViewType.event,this._onDidChangeEditorTypes=this._register(new E),this.onDidChangeEditorTypes=this._onDidChangeEditorTypes.event,this._lastClipboardIsCopy=!0,iho.setHandler(c=>{this._notebookRenderersInfoStore.clear();for(let u of c)for(let p of u.value){if(!p.entrypoint){u.collector.error("Notebook renderer does not specify entry point");continue}let h=p.id;if(!h){u.collector.error("Notebook renderer does not specify id-property");continue}this._notebookRenderersInfoStore.add(new kUt({id:h,extension:u.description,entrypoint:p.entrypoint,displayName:p.displayName,mimeTypes:p.mimeTypes||[],dependencies:p.dependencies,optionalDependencies:p.optionalDependencies,requiresMessaging:p.requiresMessaging}))}this._onDidChangeOutputRenderers.fire()}),oho.setHandler(c=>{this._notebookStaticPreloadInfoStore.clear();for(let u of c)if(Ua(u.description,"contribNotebookStaticPreloads"))for(let p of u.value){if(!p.entrypoint){u.collector.error("Notebook preload does not specify entry point");continue}let h=p.type;if(!h){u.collector.error("Notebook preload does not specify type-property");continue}this._notebookStaticPreloadInfoStore.add(new EUt({type:h,extension:u.description,entrypoint:p.entrypoint,localResourceRoots:p.localResourceRoots??[]}))}});let l=()=>{this._displayOrder=new jTt(this._configurationService.getValue(yt.displayOrder)||[],this._accessibilityService.isScreenReaderOptimized()?OJi:Ami)};l(),this._register(this._configurationService.onDidChangeConfiguration(c=>{c.affectsConfiguration(yt.displayOrder)&&l()})),this._register(this._accessibilityService.onDidChangeScreenReaderOptimized(()=>{l()})),this._memento=new Al(bte._storageNotebookViewTypeProvider,this._storageService),this._viewTypeCache=this._memento.getMemento(1,1)}static{this._storageNotebookViewTypeProvider="notebook.viewTypeProvider"}get notebookProviderInfoStore(){return this._notebookProviderInfoStore||(this._notebookProviderInfoStore=this._register(this._instantiationService.createInstance(iN))),this._notebookProviderInfoStore}getEditorTypes(){return[...this.notebookProviderInfoStore].map(e=>({id:e.id,displayName:e.displayName,providerDisplayName:e.providerDisplayName}))}clearEditorCache(){this.notebookProviderInfoStore.clearEditorCache()}_postDocumentOpenActivation(e){this._extensionService.activateByEvent(`onNotebook:${e}`),this._extensionService.activateByEvent("onNotebook:*")}async canResolve(e){return this._notebookProviders.has(e)?!0:(await this._extensionService.whenInstalledExtensionsRegistered(),await this._extensionService.activateByEvent(`onNotebookSerializer:${e}`),this._notebookProviders.has(e))}registerContributedNotebookType(e,t){let o=new fte({extension:t.extension,id:e,displayName:t.displayName,providerDisplayName:t.providerDisplayName,priority:t.priority||"default",selectors:[]});o.update({selectors:t.filenamePattern});let n=this.notebookProviderInfoStore.add(o);return this._onDidChangeEditorTypes.fire(),Z(()=>{n.dispose(),this._onDidChangeEditorTypes.fire()})}_registerProviderData(e,t){if(this._notebookProviders.has(e))throw new Error(`notebook provider for viewtype '${e}' already exists`);return this._notebookProviders.set(e,t),this._onAddViewType.fire(e),Z(()=>{this._onWillRemoveViewType.fire(e),this._notebookProviders.delete(e)})}registerNotebookSerializer(e,t,o){return this.notebookProviderInfoStore.get(e)?.update({options:o.options}),this._viewTypeCache[e]=t.id.value,this._persistMementos(),this._registerProviderData(e,new NR(e,o,t))}async withNotebookDataProvider(e){let t=this.notebookProviderInfoStore.get(e);if(!t){let n=this.getViewTypeProvider(e),r=n?[ii({id:"workbench.notebook.action.installMissingViewType",label:d(12772,null,e),run:async()=>{await this._instantiationService.createInstance(JA,n).run()}})]:[];throw w1(`UNKNOWN notebook type '${e}'`,r)}await this.canResolve(t.id);let o=this._notebookProviders.get(t.id);if(!o)throw new Error(`NO provider registered for view type: '${t.id}'`);return o}tryGetDataProviderSync(e){let t=this.notebookProviderInfoStore.get(e);if(t)return this._notebookProviders.get(t.id)}_persistMementos(){this._memento.saveMemento()}getViewTypeProvider(e){return this._viewTypeCache[e]}getRendererInfo(e){return this._notebookRenderersInfoStore.get(e)}updateMimePreferredRenderer(e,t,o,n){let r=this.notebookProviderInfoStore.get(e);r&&this._notebookRenderersInfoStore.setPreferred(r,t,o),this._displayOrder.prioritize(t,n)}saveMimeDisplayOrder(e){this._configurationService.updateValue(yt.displayOrder,this._displayOrder.toArray(),e)}getRenderers(){return this._notebookRenderersInfoStore.getAll()}*getStaticPreloads(e){for(let t of this._notebookStaticPreloadInfoStore)t.type===e&&(yield t)}async createNotebookTextModel(e,t,o){if(this._models.has(t))throw new Error(`notebook for ${t} already exists`);let n=await this.withNotebookDataProvider(e);if(!(n instanceof NR))throw new Error("CANNOT open file notebook with this provider");let r=o?await tb(o):qe.fromByteArray([]),s=await n.serializer.dataToNotebook(r),l=this._instantiationService.createInstance(gte,n.viewType,t,s.cells,s.metadata,n.serializer.options),c=new REi(l,this._onWillDisposeDocument.bind(this));return this._models.set(t,c),this._notebookDocumentService.addNotebookDocument(c),this._onWillAddNotebookDocument.fire(l),this._onDidAddNotebookDocument.fire(l),this._postDocumentOpenActivation(n.viewType),l}async createNotebookTextDocumentSnapshot(e,t,o){let n=this.getNotebookTextModel(e);if(!n)throw new Error(`notebook for ${e} doesn't exist`);let r=await this.withNotebookDataProvider(n.viewType);if(!(r instanceof NR))throw new Error("CANNOT open file notebook with this provider");let s=r.serializer,l=this._configurationService.getValue(yt.outputBackupSizeLimit)*1024,c=n.createSnapshot({context:t,outputSizeLimit:l,transientOptions:s.options}),u=n.metadata.indentAmount;typeof u=="string"&&u&&(c.metadata.indentAmount=u);let p=await s.notebookToData(c);if(o.isCancellationRequested)throw new go;return v_(p)}async restoreNotebookTextModelFromSnapshot(e,t,o){let n=this.getNotebookTextModel(e);if(!n)throw new Error(`notebook for ${e} doesn't exist`);let r=await this.withNotebookDataProvider(n.viewType);if(!(r instanceof NR))throw new Error("CANNOT open file notebook with this provider");let s=r.serializer,l=await tb(o),c=await r.serializer.dataToNotebook(l);return n.restoreSnapshot(c,s.options),n}getNotebookTextModel(e){return this._models.get(e)?.model}getNotebookTextModels(){return vt.map(this._models.values(),e=>e.model)}listNotebookDocuments(){return[...this._models].map(e=>e[1].model)}_onWillDisposeDocument(e){let t=this._models.get(e.uri);t&&(this._onWillRemoveNotebookDocument.fire(t.model),this._models.delete(e.uri),this._notebookDocumentService.removeNotebookDocument(t),t.dispose(),this._onDidRemoveNotebookDocument.fire(t.model))}getOutputMimeTypeInfo(e,t,o){let n=this._displayOrder.sort(new Set(o.outputs.map(s=>s.mime))),r=this.notebookProviderInfoStore.get(e.viewType);return n.flatMap(s=>this._notebookRenderersInfoStore.findBestRenderers(r,s,t)).sort((s,l)=>(s.rendererId===SK?1:0)-(l.rendererId===SK?1:0))}getContributedNotebookTypes(e){return e?this.notebookProviderInfoStore.getContributedNotebook(e):[...this.notebookProviderInfoStore]}hasSupportedNotebooks(e){if(this._models.has(e))return!0;let t=this.notebookProviderInfoStore.getContributedNotebook(e);return t.length?t.some(o=>o.matches(e)&&(o.priority==="default"||o.priority==="exclusive")):!1}getContributedNotebookType(e){return this.notebookProviderInfoStore.get(e)}getNotebookProviderResourceRoots(){let e=[];return this._notebookProviders.forEach(t=>{t.extensionData.location&&e.push(A.revive(t.extensionData.location))}),e}setToCopy(e,t){this._cutItems=e,this._lastClipboardIsCopy=t}getToCopy(){if(this._cutItems)return{items:this._cutItems,isCopy:this._lastClipboardIsCopy}}};bte=I([m(0,lt),m(1,B),m(2,Oi),m(3,F),m(4,ce),m(5,U5)],bte);var TUt=(c=>(c[c.Base=0]="Base",c[c.Sash=35]="Sash",c[c.SuggestWidget=40]="SuggestWidget",c[c.Hover=50]="Hover",c[c.DragImage=1e3]="DragImage",c[c.MenubarMenuItemsHolder=2e3]="MenubarMenuItemsHolder",c[c.ContextView=2500]="ContextView",c[c.ModalDialog=2600]="ModalDialog",c[c.PaneDropOverlay=1e4]="PaneDropOverlay",c))(TUt||{}),cJo=Object.keys(TUt).filter(a=>!isNaN(Number(a))).map(a=>Number(a)).sort((a,i)=>i-a);function dJo(a){for(let i of cJo)if(a>=i)return i;return-1}var MEi=class{constructor(){this.styleSheet=Cr(),this.zIndexMap=new Map,this.scheduler=new Dt(()=>this.updateStyleElement(),200)}registerZIndex(i,e,t){if(this.zIndexMap.get(t))throw new Error(`z-index with name ${t} has already been registered.`);let o=i+e;if(dJo(o)!==i)throw new Error(`Relative layer: ${i} + z-index: ${e} exceeds next layer ${o}.`);return this.zIndexMap.set(t,o),this.scheduler.schedule(),this.getVarName(t)}getVarName(i){return`--z-index-${i}`}updateStyleElement(){Rt(this.styleSheet);let i="";this.zIndexMap.forEach((e,t)=>{i+=`${this.getVarName(t)}: ${e};
`}),$h(":root",i,this.styleSheet)}},uJo=new MEi;function Kk(a,i,e){return uJo.registerZIndex(a,i,e)}var PEi=Ae("debug-console-view-icon",R.debugConsole,d(9612,null)),AEi=Ae("run-view-icon",R.debugAlt,d(9632,null)),nho=Ae("variables-view-icon",R.debugAlt,d(9633,null)),rho=Ae("watch-view-icon",R.debugAlt,d(9639,null)),sho=Ae("callstack-view-icon",R.debugAlt,d(9586,null)),_Ut=Ae("breakpoints-view-icon",R.debugAlt,d(9585,null)),aho=Ae("loaded-scripts-view-icon",R.debugAlt,d(9631,null)),eW={regular:Ae("debug-breakpoint",R.debugBreakpoint,d(9588,null)),disabled:Ae("debug-breakpoint-disabled",R.debugBreakpointDisabled,d(9595,null)),unverified:Ae("debug-breakpoint-unverified",R.debugBreakpointUnverified,d(9605,null)),pending:Ae("debug-breakpoint-pending",R.debugBreakpointPending,d(9603,null))},NEi={regular:Ae("debug-breakpoint-function",R.debugBreakpointFunction,d(9596,null)),disabled:Ae("debug-breakpoint-function-disabled",R.debugBreakpointFunctionDisabled,d(9597,null)),unverified:Ae("debug-breakpoint-function-unverified",R.debugBreakpointFunctionUnverified,d(9598,null))},OEi={regular:Ae("debug-breakpoint-conditional",R.debugBreakpointConditional,d(9589,null)),disabled:Ae("debug-breakpoint-conditional-disabled",R.debugBreakpointConditionalDisabled,d(9590,null)),unverified:Ae("debug-breakpoint-conditional-unverified",R.debugBreakpointConditionalUnverified,d(9591,null))},FEi={regular:Ae("debug-breakpoint-data",R.debugBreakpointData,d(9592,null)),disabled:Ae("debug-breakpoint-data-disabled",R.debugBreakpointDataDisabled,d(9593,null)),unverified:Ae("debug-breakpoint-data-unverified",R.debugBreakpointDataUnverified,d(9594,null))},DUt={regular:Ae("debug-breakpoint-log",R.debugBreakpointLog,d(9600,null)),disabled:Ae("debug-breakpoint-log-disabled",R.debugBreakpointLogDisabled,d(9601,null)),unverified:Ae("debug-breakpoint-log-unverified",R.debugBreakpointLogUnverified,d(9602,null))},Ltt=Ae("debug-hint",R.debugHint,d(9599,null)),LUt=Ae("debug-breakpoint-unsupported",R.debugBreakpointUnsupported,d(9604,null)),RUt=[eW,NEi,OEi,FEi,DUt],lhe=Ae("debug-stackframe",R.debugStackframe,d(9623,null)),che=Ae("debug-stackframe-focused",R.debugStackframeFocused,d(9624,null)),lho=Ae("debug-gripper",R.gripper,d(9615,null)),Rtt=Ae("debug-restart-frame",R.debugRestartFrame,d(9620,null)),v8=Ae("debug-stop",R.debugStop,d(9630,null)),tW=Ae("debug-disconnect",R.debugDisconnect,d(9614,null)),dhe=Ae("debug-restart",R.debugRestart,d(9619,null)),uhe=Ae("debug-step-over",R.debugStepOver,d(9629,null)),Ste=Ae("debug-step-into",R.debugStepInto,d(9627,null)),Ite=Ae("debug-step-out",R.debugStepOut,d(9628,null)),Mtt=Ae("debug-step-back",R.debugStepBack,d(9626,null)),phe=Ae("debug-pause",R.debugPause,d(9617,null)),mhe=Ae("debug-continue",R.debugContinue,d(9613,null)),Ptt=Ae("debug-reverse-continue",R.debugReverseContinue,d(9621,null)),cho=Ae("debug-run",R.run,d(9622,null)),MUt=Ae("debug-start",R.debugStart,d(9625,null)),RPe=Ae("debug-configure",R.gear,d(9607,null)),bcu=Ae("debug-console",R.gear,d(9608,null)),dho=Ae("debug-remove-config",R.trash,d(9618,null)),Scu=Ae("debug-collapse-all",R.collapseAll,d(9606,null)),uho=Ae("callstack-view-session",R.bug,d(9587,null)),pho=Ae("debug-console-clear-all",R.clearAll,d(9609,null)),mho=Ae("watch-expressions-remove-all",R.closeAll,d(9638,null)),hho=Ae("watch-expression-remove",R.removeClose,d(9634,null)),gho=Ae("watch-expressions-add",R.add,d(9635,null)),fho=Ae("watch-expressions-add-function-breakpoint",R.add,d(9637,null)),vho=Ae("watch-expressions-add-data-breakpoint",R.variableGroup,d(9636,null)),bho=Ae("breakpoints-remove-all",R.closeAll,d(9584,null)),Sho=Ae("breakpoints-activate",R.activateBreakpoints,d(9583,null)),Iho=Ae("debug-console-evaluation-input",R.arrowSmallRight,d(9610,null)),yho=Ae("debug-console-evaluation-prompt",R.chevronRight,d(9611,null)),PUt=Ae("debug-inspect-memory",R.fileBinary,d(9616,null));var who=te("debugToolBar.background",{dark:"#333333",light:"#F3F3F3",hcDark:"#000000",hcLight:"#FFFFFF"},d(9507,null)),Cho=te("debugToolBar.border",null,d(9508,null)),MPe=te("debugIcon.startForeground",{dark:"#89D185",light:"#388A34",hcDark:"#89D185",hcLight:"#388A34"},d(9501,null));function xho(){let a=te("debugTokenExpression.name",{dark:"#c586c0",light:"#9b46b0",hcDark:To,hcLight:To},"Foreground color for the token names shown in the debug views (ie. the Variables or Watch view)."),i=te("debugTokenExpression.type",{dark:"#4A90E2",light:"#4A90E2",hcDark:To,hcLight:To},"Foreground color for the token types shown in the debug views (ie. the Variables or Watch view)."),e=te("debugTokenExpression.value",{dark:"#cccccc99",light:"#6c6c6ccc",hcDark:To,hcLight:To},"Foreground color for the token values shown in the debug views (ie. the Variables or Watch view)."),t=te("debugTokenExpression.string",{dark:"#ce9178",light:"#a31515",hcDark:"#f48771",hcLight:"#a31515"},"Foreground color for strings in the debug views (ie. the Variables or Watch view)."),o=te("debugTokenExpression.boolean",{dark:"#4e94ce",light:"#0000ff",hcDark:"#75bdfe",hcLight:"#0000ff"},"Foreground color for booleans in the debug views (ie. the Variables or Watch view)."),n=te("debugTokenExpression.number",{dark:"#b5cea8",light:"#098658",hcDark:"#89d185",hcLight:"#098658"},"Foreground color for numbers in the debug views (ie. the Variables or Watch view)."),r=te("debugTokenExpression.error",{dark:"#f48771",light:"#e51400",hcDark:"#f48771",hcLight:"#e51400"},"Foreground color for expression errors in the debug views (ie. the Variables or Watch view) and for error logs shown in the debug console."),s=te("debugView.exceptionLabelForeground",{dark:To,light:"#FFF",hcDark:To,hcLight:To},"Foreground color for a label shown in the CALL STACK view when the debugger breaks on an exception."),l=te("debugView.exceptionLabelBackground",{dark:"#6C2022",light:"#A31515",hcDark:"#6C2022",hcLight:"#A31515"},"Background color for a label shown in the CALL STACK view when the debugger breaks on an exception."),c=te("debugView.stateLabelForeground",To,"Foreground color for a label in the CALL STACK view showing the current session's or thread's state."),u=te("debugView.stateLabelBackground","#88888844","Background color for a label in the CALL STACK view showing the current session's or thread's state."),p=te("debugView.valueChangedHighlight","#569CD6","Color used to highlight value changes in the debug views (ie. in the Variables view)."),h=te("debugConsole.infoForeground",{dark:Dm,light:Dm,hcDark:To,hcLight:To},"Foreground color for info messages in debug REPL console."),g=te("debugConsole.warningForeground",{dark:jh,light:jh,hcDark:"#008000",hcLight:jh},"Foreground color for warning messages in debug REPL console."),f=te("debugConsole.errorForeground",sle,"Foreground color for error messages in debug REPL console."),v=te("debugConsole.sourceForeground",To,"Foreground color for source filenames in debug REPL console."),b=te("debugConsoleInputIcon.foreground",To,"Foreground color for debug console input marker icon."),S=te("debugIcon.pauseForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},d(9499,null)),y=te("debugIcon.stopForeground",{dark:"#F48771",light:"#A1260D",hcDark:"#F48771",hcLight:"#A1260D"},d(9506,null)),w=te("debugIcon.disconnectForeground",{dark:"#F48771",light:"#A1260D",hcDark:"#F48771",hcLight:"#A1260D"},d(9498,null)),k=te("debugIcon.restartForeground",{dark:"#89D185",light:"#388A34",hcDark:"#89D185",hcLight:"#388A34"},d(9500,null)),T=te("debugIcon.stepOverForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},d(9505,null)),P=te("debugIcon.stepIntoForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},d(9503,null)),O=te("debugIcon.stepOutForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},d(9504,null)),V=te("debugIcon.continueForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},d(9497,null)),H=te("debugIcon.stepBackForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},d(9502,null));is((G,$)=>{let J=G.getColor(bv),ae=G.getColor(CC),he=G.getColor(Kvt),oe=G.getColor(s),de=G.getColor(l),Ce=G.getColor(c),xe=G.getColor(u),ze=G.getColor(p),De=G.getColor(ale);$.addRule(`
			/* Text colour of the call stack row's filename */
			.debug-pane .debug-call-stack .monaco-list-row:not(.selected) .stack-frame > .file .file-name {
				color: ${he}
			}

			/* Line & column number "badge" for selected call stack row */
			.debug-pane .monaco-list-row.selected .line-number {
				background-color: ${J};
				color: ${ae};
			}

			/* Line & column number "badge" for unselected call stack row (basically all other rows) */
			.debug-pane .line-number {
				background-color: ${J.transparent(.6)};
				color: ${ae.transparent(.6)};
			}

			/* State "badge" displaying the active session's current state.
			* Only visible when there are more active debug sessions/threads running.
			*/
			.debug-pane .debug-call-stack .thread > .state.label,
			.debug-pane .debug-call-stack .session > .state.label {
				background-color: ${xe};
				color: ${Ce};
			}

			/* State "badge" displaying the active session's current state.
			* Only visible when there are more active debug sessions/threads running
			* and thread paused due to a thrown exception.
			*/
			.debug-pane .debug-call-stack .thread > .state.label.exception,
			.debug-pane .debug-call-stack .session > .state.label.exception {
				background-color: ${de};
				color: ${oe};
			}

			/* Info "badge" shown when the debugger pauses due to a thrown exception. */
			.debug-pane .call-stack-state-message > .label.exception {
				background-color: ${de};
				color: ${oe};
			}

			/* Animation of changed values in Debug viewlet */
			@keyframes debugViewletValueChanged {
				0%   { background-color: ${ze.transparent(0)} }
				5%   { background-color: ${ze.transparent(.9)} }
				100% { background-color: ${ze.transparent(.3)} }
			}

			.debug-pane .monaco-list-row .expression .value.changed {
				background-color: ${ze.transparent(.3)};
				animation-name: debugViewletValueChanged;
				animation-duration: 1s;
				animation-fill-mode: forwards;
			}

			.monaco-list-row .expression .lazy-button:hover {
				background-color: ${De}
			}
		`);let Oe=G.getColor(bi);Oe&&$.addRule(`
			.debug-pane .line-number {
				border: 1px solid ${Oe};
			}
			`),uf(G.type)&&$.addRule(`
			.debug-pane .line-number {
				background-color: ${J};
				color: ${ae};
			}`);let pt=G.getColor(a),et=G.getColor(i),Ti=G.getColor(e),Ht=G.getColor(t),zi=G.getColor(o),Vo=G.getColor(r),sn=G.getColor(n);$.addRule(`
			.monaco-workbench .monaco-list-row .expression .name {
				color: ${pt};
			}

			.monaco-workbench .monaco-list-row .expression .type {
				color: ${et};
			}

			.monaco-workbench .monaco-list-row .expression .value,
			.monaco-workbench .debug-hover-widget .value {
				color: ${Ti};
			}

			.monaco-workbench .monaco-list-row .expression .value.string,
			.monaco-workbench .debug-hover-widget .value.string {
				color: ${Ht};
			}

			.monaco-workbench .monaco-list-row .expression .value.boolean,
			.monaco-workbench .debug-hover-widget .value.boolean {
				color: ${zi};
			}

			.monaco-workbench .monaco-list-row .expression .error,
			.monaco-workbench .debug-hover-widget .error,
			.monaco-workbench .debug-pane .debug-variables .scope .error {
				color: ${Vo};
			}

			.monaco-workbench .monaco-list-row .expression .value.number,
			.monaco-workbench .debug-hover-widget .value.number {
				color: ${sn};
			}
		`);let _n=G.getColor(nw)||We.fromHex("#80808060"),mn=G.getColor(h),hn=G.getColor(g),yo=G.getColor(f),Mr=G.getColor(v),cn=G.getColor(b);$.addRule(`
			.repl .repl-input-wrapper {
				border-top: 1px solid ${_n};
			}

			.monaco-workbench .repl .repl-tree .output .expression .value.info {
				color: ${mn};
			}

			.monaco-workbench .repl .repl-tree .output .expression .value.warn {
				color: ${hn};
			}

			.monaco-workbench .repl .repl-tree .output .expression .value.error {
				color: ${yo};
			}

			.monaco-workbench .repl .repl-tree .output .expression .source {
				color: ${Mr};
			}

			.monaco-workbench .repl .repl-tree .monaco-tl-contents .arrow {
				color: ${cn};
			}
		`),G.defines(b)||$.addRule(`
				.monaco-workbench.vs .repl .repl-tree .monaco-tl-contents .arrow {
					opacity: 0.25;
				}

				.monaco-workbench.vs-dark .repl .repl-tree .monaco-tl-contents .arrow {
					opacity: 0.4;
				}

				.monaco-workbench.hc-black .repl .repl-tree .monaco-tl-contents .arrow,
				.monaco-workbench.hc-light .repl .repl-tree .monaco-tl-contents .arrow {
					opacity: 1;
				}
			`);let er=G.getColor(MPe);er&&$.addRule(`.monaco-workbench ${q.asCSSSelector(MUt)} { color: ${er}; }`);let Ns=G.getColor(S);Ns&&$.addRule(`.monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(phe)}, .monaco-workbench ${q.asCSSSelector(phe)} { color: ${Ns}; }`);let ua=G.getColor(y);ua&&$.addRule(`.monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(v8)},.monaco-workbench ${q.asCSSSelector(v8)} { color: ${ua}; }`);let xm=G.getColor(w);xm&&$.addRule(`.monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(tW)},.monaco-workbench .debug-view-content ${q.asCSSSelector(tW)}, .monaco-workbench .debug-toolbar ${q.asCSSSelector(tW)}, .monaco-workbench .command-center-center ${q.asCSSSelector(tW)} { color: ${xm}; }`);let tm=G.getColor(k);tm&&$.addRule(`.monaco-workbench ${q.asCSSSelector(dhe)}, .monaco-workbench ${q.asCSSSelector(Rtt)}, .monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(dhe)}, .monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(Rtt)} { color: ${tm}; }`);let Lu=G.getColor(T);Lu&&$.addRule(`.monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(uhe)}, .monaco-workbench ${q.asCSSSelector(uhe)} { color: ${Lu}; }`);let jg=G.getColor(P);jg&&$.addRule(`.monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(Ste)}, .monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(Ste)}, .monaco-workbench ${q.asCSSSelector(Ste)} { color: ${jg}; }`);let Ir=G.getColor(O);Ir&&$.addRule(`.monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(Ite)}, .monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(Ite)}, .monaco-workbench ${q.asCSSSelector(Ite)} { color: ${Ir}; }`);let Lx=G.getColor(V);Lx&&$.addRule(`.monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(mhe)}, .monaco-workbench ${q.asCSSSelector(mhe)}, .monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(Ptt)}, .monaco-workbench ${q.asCSSSelector(Ptt)} { color: ${Lx}; }`);let Qg=G.getColor(H);Qg&&$.addRule(`.monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(Mtt)}, .monaco-workbench ${q.asCSSSelector(Mtt)} { color: ${Qg}; }`)})}var Att=class a{static{this.INSTANCE=new a}constructor(){this.editorContributions=[]}registerEditorContribution(i,e){this.editorContributions.push({id:i,ctor:e})}getEditorContributions(){return this.editorContributions.slice(0)}};function bm(a,i){Att.INSTANCE.registerEditorContribution(a,i)}var b8;(e=>{function a(){return Att.INSTANCE.getEditorContributions()}e.getEditorContributions=a;function i(t){return Att.INSTANCE.getEditorContributions().filter(o=>t.indexOf(o.id)>=0)}e.getSomeEditorContributions=i})(b8||={});var WEi=class{constructor(){this._frameId=0;this._domFrameLog()}_domFrameLog(){}debug(...i){let e=new Date;console.log(`${e.getSeconds()}:${e.getMilliseconds().toString().padStart(3,"0")}`,`frame #${this._frameId}: `,...i)}},pJo=new WEi;function kho(...a){pJo.debug(...a)}var Ntt=class{constructor(i,e){this.source=i;this.value=e;this.type=1}},AUt=class{constructor(i){this.source=i;this.type=2}},NUt=class{constructor(i,e){this.source=i;this.cell=e;this.type=3}};var Rp=class extends x{constructor(){super();this.cellDisposables=this._register(new N)}prepareRenderCell(e){}renderCell(e){this.currentCell=e,CM(()=>this.didRenderCell(e))}didRenderCell(e){}unrenderCell(e){this.currentCell=void 0,this.cellDisposables.clear()}prepareLayout(){}updateInternalLayoutNow(e){}updateState(e,t){}updateForExecutionState(e,t){}},Ott=class extends x{constructor(){super();this.cellDisposables=this._register(new N)}prepareRenderCell(e){}renderCell(e){this.currentCell=e,this.didRenderCell(e)}didRenderCell(e){}unrenderCell(e){this.currentCell=void 0,this.cellDisposables.clear()}updateInternalLayoutNow(e){}updateState(e,t){}updateForExecutionState(e,t){}};function CM(a){try{return a()}catch(i){return mt(i),null}}var Ftt=class a extends x{constructor(e,t,o){super();this.targetWindow=e;this.contentParts=t;this.overlayParts=o;this._scheduledOverlayRendering=this._register(new me);this._scheduledOverlayUpdateState=this._register(new me);this._scheduledOverlayUpdateExecutionState=this._register(new me)}concatContentPart(e,t){return new a(t,this.contentParts.concat(e),this.overlayParts)}concatOverlayPart(e,t){return new a(t,this.contentParts,this.overlayParts.concat(e))}scheduleRenderCell(e){for(let t of this.contentParts)CM(()=>t.prepareRenderCell(e));for(let t of this.overlayParts)CM(()=>t.prepareRenderCell(e));for(let t of this.contentParts)CM(()=>t.renderCell(e));this._scheduledOverlayRendering.value=Q9(this.targetWindow,()=>{for(let t of this.overlayParts)CM(()=>t.renderCell(e))})}unrenderCell(e){for(let t of this.contentParts)CM(()=>t.unrenderCell(e));this._scheduledOverlayRendering.value=void 0,this._scheduledOverlayUpdateState.value=void 0,this._scheduledOverlayUpdateExecutionState.value=void 0;for(let t of this.overlayParts)CM(()=>t.unrenderCell(e))}updateInternalLayoutNow(e){for(let t of this.contentParts)CM(()=>t.updateInternalLayoutNow(e));for(let t of this.overlayParts)CM(()=>t.updateInternalLayoutNow(e))}prepareLayout(){for(let e of this.contentParts)CM(()=>e.prepareLayout())}updateState(e,t){for(let o of this.contentParts)CM(()=>o.updateState(e,t));this._scheduledOverlayUpdateState.value=Q9(this.targetWindow,()=>{for(let o of this.overlayParts)CM(()=>o.updateState(e,t))})}updateForExecutionState(e,t){for(let o of this.contentParts)CM(()=>o.updateForExecutionState(e,t));this._scheduledOverlayUpdateExecutionState.value=Q9(this.targetWindow,()=>{for(let o of this.overlayParts)CM(()=>o.updateForExecutionState(e,t))})}};var mJo=0,yte=class extends x{constructor(e,t,o){super();this.cellViewModel=e;this._outputRawData=t;this._notebookService=o;this._onDidResetRendererEmitter=this._register(new E);this.onDidResetRenderer=this._onDidResetRendererEmitter.event;this.alwaysShow=!1;this.visible=Me("outputVisible",!1);this.outputHandle=mJo++}setVisible(e=!0,t=!1){!e&&this.alwaysShow||(t&&e&&(this.alwaysShow=!0),this.visible.set(e,void 0))}get model(){return this._outputRawData}get pickedMimeType(){return this._pickedMimeType}set pickedMimeType(e){this._pickedMimeType=e}hasMultiMimeType(){if(this._outputRawData.outputs.length<2)return!1;let e=this._outputRawData.outputs[0].mime;return this._outputRawData.outputs.some(t=>t.mime!==e)}resolveMimeTypes(e,t){let o=this._notebookService.getOutputMimeTypeInfo(e,t,this.model),n=o.findIndex(r=>r.rendererId!==SK&&r.isTrusted);return[o,Math.max(n,0)]}resetRenderer(){this._pickedMimeType=void 0,this.model.bumpVersion(),this._onDidResetRendererEmitter.fire()}toRawJSON(){return{outputs:this._outputRawData.outputs}}};var PPe=class extends x{constructor(e,t,o,n,r,s,l,c,u){super();this.viewType=e;this.model=t;this.id=o;this._viewContext=n;this._configurationService=r;this._modelService=s;this._undoRedoService=l;this._codeEditorService=c;this._inlineChatSessionService=u;this._onDidChangeEditorAttachState=this._register(new E);this.onDidChangeEditorAttachState=this._onDidChangeEditorAttachState.event;this._onDidChangeState=this._register(new E);this.onDidChangeState=this._onDidChangeState.event;this._editState=0;this._lineNumbers="inherit";this._focusMode=0;this._editorListeners=[];this._editorViewStates=null;this._editorTransientState=null;this._resolvedCellDecorations=new Map;this._textModelRefChangeDisposable=this._register(new me);this._cellDecorationsChanged=this._register(new E);this.onCellDecorationsChanged=this._cellDecorationsChanged.event;this._resolvedDecorations=new Map;this._lastDecorationId=0;this._cellStatusBarItems=new Map;this._onDidChangeCellStatusBarItems=this._register(new E);this.onDidChangeCellStatusBarItems=this._onDidChangeCellStatusBarItems.event;this._lastStatusBarId=0;this._dragging=!1;this._inputCollapsed=!1;this._outputCollapsed=!1;this._commentHeight=0;this._isDisposed=!1;this._isReadonly=!1;this._editStateSource="";this._register(t.onDidChangeMetadata(()=>{this._onDidChangeState.fire({metadataChanged:!0})})),this._register(t.onDidChangeInternalMetadata(p=>{this._onDidChangeState.fire({internalMetadataChanged:!0}),p.lastRunSuccessChanged&&this.layoutChange({})})),this._register(this._configurationService.onDidChangeConfiguration(p=>{p.affectsConfiguration("notebook.lineNumbers")&&(this.lineNumbers="inherit")})),this.model.collapseState?.inputCollapsed&&(this._inputCollapsed=!0),this.model.collapseState?.outputCollapsed&&(this._outputCollapsed=!0),this._commentOptions=this._configurationService.getValue("editor.comments",{overrideIdentifier:this.language}),this._register(this._configurationService.onDidChangeConfiguration(p=>{p.affectsConfiguration("editor.comments")&&(this._commentOptions=this._configurationService.getValue("editor.comments",{overrideIdentifier:this.language}))}))}get handle(){return this.model.handle}get uri(){return this.model.uri}get lineCount(){return this.model.textBuffer.getLineCount()}get metadata(){return this.model.metadata}get internalMetadata(){return this.model.internalMetadata}get language(){return this.model.language}get mime(){return typeof this.model.mime=="string"?this.model.mime:this.language==="markdown"?tr.markdown:tr.text}get lineNumbers(){return this._lineNumbers}set lineNumbers(e){e!==this._lineNumbers&&(this._lineNumbers=e,this._onDidChangeState.fire({cellLineNumberChanged:!0}))}get commentOptions(){return this._commentOptions}set commentOptions(e){this._commentOptions=e}get focusMode(){return this._focusMode}set focusMode(e){this._focusMode!==e&&(this._focusMode=e,this._onDidChangeState.fire({focusModeChanged:!0}))}get editorAttached(){return!!this._textEditor}get textModel(){return this.model.textModel}hasModel(){return!!this.textModel}get dragging(){return this._dragging}set dragging(e){this._dragging=e,this._onDidChangeState.fire({dragStateChanged:!0})}get isInputCollapsed(){return this._inputCollapsed}set isInputCollapsed(e){this._inputCollapsed=e,this._onDidChangeState.fire({inputCollapsedChanged:!0})}get isOutputCollapsed(){return this._outputCollapsed}set isOutputCollapsed(e){this._outputCollapsed=e,this._onDidChangeState.fire({outputCollapsedChanged:!0})}set commentHeight(e){this._commentHeight!==e&&(this._commentHeight=e,this.layoutChange({commentHeight:!0},"BaseCellViewModel#commentHeight"))}updateOptions(e){this._textEditor&&typeof e.readonly=="boolean"&&this._textEditor.updateOptions({readOnly:e.readonly}),typeof e.readonly=="boolean"&&(this._isReadonly=e.readonly)}assertTextModelAttached(){return!!(this.textModel&&this._textEditor&&this._textEditor.getModel()===this.textModel)}attachTextEditor(e,t){if(!e.hasModel())throw new Error("Invalid editor: model is missing");if(this._textEditor===e){this._editorListeners.length===0&&(this._editorListeners.push(this._textEditor.onDidChangeCursorSelection(()=>{this._onDidChangeState.fire({selectionChanged:!0})})),this._onDidChangeState.fire({selectionChanged:!0}));return}this._textEditor=e,this._isReadonly&&e.updateOptions({readOnly:this._isReadonly}),this._editorViewStates?this._restoreViewState(this._editorViewStates):t&&this._restoreViewState({contributionsState:{},cursorState:[],viewState:{scrollLeft:0,firstPosition:{lineNumber:1,column:1},firstPositionDeltaTop:this._viewContext.notebookOptions.getLayoutConfiguration().editorTopPadding}}),this._editorTransientState&&jA(e.getModel(),this._editorTransientState,this._codeEditorService),!this._isDisposed&&(e.changeDecorations(o=>{this._resolvedDecorations.forEach((n,r)=>{if(r.startsWith("_lazy_")){let s=o.addDecoration(n.options.range,n.options.options);this._resolvedDecorations.get(r).id=s}else{let s=o.addDecoration(n.options.range,n.options.options);this._resolvedDecorations.get(r).id=s}})}),this._editorListeners.push(e.onDidChangeCursorSelection(()=>{this._onDidChangeState.fire({selectionChanged:!0})})),this._editorListeners.push(this._inlineChatSessionService.onWillStartSession(o=>{o===this._textEditor&&this.textBuffer.getLength()===0&&this.enableAutoLanguageDetection()})),this._onDidChangeState.fire({selectionChanged:!0}),this._onDidChangeEditorAttachState.fire())}detachTextEditor(){this.saveViewState(),this.saveTransientState(),this._textEditor?.changeDecorations(e=>{this._resolvedDecorations.forEach(t=>{let o=t.id;o&&e.removeDecoration(o)})}),this._textEditor=void 0,Be(this._editorListeners),this._editorListeners=[],this._onDidChangeEditorAttachState.fire(),this._textModelRef&&(this._textModelRef.dispose(),this._textModelRef=void 0),this._textModelRefChangeDisposable.clear()}getText(){return this.model.getValue()}getAlternativeId(){return this.model.alternativeId}getTextLength(){return this.model.getTextLength()}enableAutoLanguageDetection(){this.model.enableAutoLanguageDetection()}saveViewState(){this._textEditor&&(this._editorViewStates=this._textEditor.saveViewState())}saveTransientState(){!this._textEditor||!this._textEditor.hasModel()||(this._editorTransientState=tte(this._textEditor.getModel(),this._codeEditorService))}saveEditorViewState(){return this._textEditor&&(this._editorViewStates=this._textEditor.saveViewState()),this._editorViewStates}restoreEditorViewState(e,t){this._editorViewStates=e}_restoreViewState(e){e&&this._textEditor?.restoreViewState(e)}addModelDecoration(e){if(!this._textEditor){let o=++this._lastDecorationId,n=`_lazy_${this.id};${o}`;return this._resolvedDecorations.set(n,{options:e}),n}let t;return this._textEditor.changeDecorations(o=>{t=o.addDecoration(e.range,e.options),this._resolvedDecorations.set(t,{id:t,options:e})}),t}removeModelDecoration(e){let t=this._resolvedDecorations.get(e);this._textEditor&&t&&t.id!==void 0&&this._textEditor.changeDecorations(o=>{o.removeDecoration(t.id)}),this._resolvedDecorations.delete(e)}deltaModelDecorations(e,t){return e.forEach(n=>{this.removeModelDecoration(n)}),t.map(n=>this.addModelDecoration(n))}_removeCellDecoration(e){let t=this._resolvedCellDecorations.get(e);if(this._resolvedCellDecorations.delete(e),t){for(let o of this._resolvedCellDecorations.values())t.className===o.className&&(t.className=void 0),t.outputClassName===o.outputClassName&&(t.outputClassName=void 0),t.gutterClassName===o.gutterClassName&&(t.gutterClassName=void 0),t.topClassName===o.topClassName&&(t.topClassName=void 0);this._cellDecorationsChanged.fire({added:[],removed:[t]})}}_addCellDecoration(e){let t=++this._lastDecorationId,o=`_cell_${this.id};${t}`;return this._resolvedCellDecorations.set(o,e),this._cellDecorationsChanged.fire({added:[e],removed:[]}),o}getCellDecorations(){return[...this._resolvedCellDecorations.values()]}getCellDecorationRange(e){return this._textEditor?this._textEditor.getModel()?.getDecorationRange(e)??null:null}deltaCellDecorations(e,t){return e.forEach(n=>{this._removeCellDecoration(n)}),t.map(n=>this._addCellDecoration(n))}deltaCellStatusBarItems(e,t){e.forEach(n=>{this._cellStatusBarItems.get(n)&&this._cellStatusBarItems.delete(n)});let o=t.map(n=>{let r=++this._lastStatusBarId,s=`_cell_${this.id};${r}`;return this._cellStatusBarItems.set(s,n),s});return this._onDidChangeCellStatusBarItems.fire(),o}getCellStatusBarItems(){return Array.from(this._cellStatusBarItems.values())}revealRangeInCenter(e){this._textEditor?.revealRangeInCenter(e,1)}setSelection(e){this._textEditor?.setSelection(e)}setSelections(e){e.length&&(this._textEditor?this._textEditor?.setSelections(e):this._editorViewStates&&(this._editorViewStates.cursorState=e.map(t=>({inSelectionMode:!t.isEmpty(),selectionStart:t.getStartPosition(),position:t.getEndPosition()}))))}getSelections(){return this._textEditor?.getSelections()??this._editorViewStates?.cursorState.map(e=>new ti(e.selectionStart.lineNumber,e.selectionStart.column,e.position.lineNumber,e.position.column))??[]}getSelectionsStartPosition(){return this._textEditor?this._textEditor.getSelections()?.map(t=>t.getStartPosition()):this._editorViewStates?.cursorState?.map(t=>t.selectionStart)}getLineScrollTopOffset(e){if(!this._textEditor)return 0;let t=this._viewContext.notebookOptions.computeEditorPadding(this.internalMetadata,this.uri);return this._textEditor.getTopForLineNumber(e)+t.top}getPositionScrollTopOffset(e){if(!this._textEditor)return 0;let t=e instanceof ti?e.getPosition():e.getStartPosition(),o=this._viewContext.notebookOptions.computeEditorPadding(this.internalMetadata,this.uri);return this._textEditor.getTopForPosition(t.lineNumber,t.column)+o.top}cursorAtLineBoundary(){if(!this._textEditor||!this.textModel||!this._textEditor.hasTextFocus())return 0;let e=this._textEditor.getSelection();if(!e||!e.isEmpty())return 0;let t=this.textModel.getLineLength(e.startLineNumber);if(t===0)return 3;switch(e.startColumn){case 1:return 1;case t+1:return 2;default:return 0}}cursorAtBoundary(){if(!this._textEditor)return 0;if(!this.textModel)return 0;let e=this._textEditor.getSelection();if(!e||!e.isEmpty())return 0;let t=this._textEditor.getTopForPosition(1,1),o=this._textEditor.getTopForPosition(this.textModel.getLineCount(),this.textModel.getLineLength(this.textModel.getLineCount())),n=this._textEditor.getTopForPosition(e.startLineNumber,e.startColumn);return n===o?n===t?3:2:n===t?1:0}get editStateSource(){return this._editStateSource}updateEditState(e,t){e!==this._editState&&(this._editStateSource=t,this._editState=e,this._onDidChangeState.fire({editStateChanged:!0}),this._editState===0&&(this.focusMode=0))}getEditState(){return this._editState}get textBuffer(){return this.model.textBuffer}async resolveTextModel(){if(!this._textModelRef||!this.textModel){if(this._textModelRef=await this._modelService.createModelReference(this.uri),this._isDisposed)return this.textModel;if(!this._textModelRef)throw new Error(`Cannot resolve text model for ${this.uri}`);this._textModelRefChangeDisposable.value=this.textModel.onDidChangeContent(()=>this.onDidChangeTextModelContent())}return this.textModel}cellStartFind(e,t){let o=[],n=this.textBuffer.getLineCount(),r=t.findScope?.selectedTextRanges??[new z(1,1,n,this.textBuffer.getLineLength(n)+1)];if(this.assertTextModelAttached())o=this.textModel.findMatches(e,r,t.regex||!1,t.caseSensitive||!1,t.wholeWord&&t.wordSeparators||null,t.regex||!1);else{let l=new tw(e,t.regex||!1,t.caseSensitive||!1,t.wholeWord&&t.wordSeparators||null).parseSearchRequest();if(!l)return null;r.forEach(c=>{o.push(...this.textBuffer.findMatchesLineByLine(new z(c.startLineNumber,c.startColumn,c.endLineNumber,c.endColumn),l,t.regex||!1,1e3))})}return o}dispose(){this._isDisposed=!0,super.dispose(),Be(this._editorListeners),this._undoRedoService.getUriComparisonKey(this.uri)===this.uri.toString()&&this._undoRedoService.removeElements(this.uri),this._textModelRef?.dispose()}toJSON(){return{handle:this.handle}}};var yI=le("IInlineChatSessionService");async function fJo(a,i,e,t){let o=a.get(Pt),n=a.get(mi);if(!i)return;let r=n.startNewLocalSession("panel");r.object.inputModel.setState({...e,mode:{id:"agent",kind:"agent"}});let l=await o.openSession(r.object.sessionResource);r.dispose(),l&&t&&!t.selection.isEmpty()&&await l.attachmentModel.addFile(t.uri,t.selection),l?.acceptInput(i.message.text)}async function OUt(a,i){let e=i.chatModel.getRequests().at(-1);e&&(await fJo(a,e,i.chatModel.inputModel.state.get(),{uri:i.uri,selection:i.initialSelection}),i.dispose())}function Eho(a,i){let e=i.chatModel.getRequests().at(-1);if(e)return a.get(mi).removeRequest(i.chatModel.sessionResource,e.id),i.chatModel.inputModel.setState({inputText:e.message.text}),i.setTerminationState(void 0),e.message.text}var APe=500,ih=class extends PPe{constructor(e,t,o,n,r,s,l,c,u,p){super(e,t,xt(),n,r,l,c,u,p);this.viewContext=n;this._notebookService=s;this.cellKind=2;this._onLayoutInfoRead=this._register(new E);this.onLayoutInfoRead=this._onLayoutInfoRead.event;this._onDidStartExecution=this._register(new E);this.onDidStartExecution=this._onDidStartExecution.event;this._onDidStopExecution=this._register(new E);this.onDidStopExecution=this._onDidStopExecution.event;this._onDidChangeOutputs=this._register(new E);this.onDidChangeOutputs=this._onDidChangeOutputs.event;this._onDidRemoveOutputs=this._register(new E);this.onDidRemoveOutputs=this._onDidRemoveOutputs.event;this._outputCollection=[];this._outputsTop=null;this._pauseableEmitter=this._register(new Gm);this.onDidChangeLayout=this._pauseableEmitter.event;this._editorHeight=0;this._chatHeight=0;this._hoveringOutput=!1;this._focusOnOutput=!1;this._focusInputInOutput=!1;this._outputMinHeight=0;this.executionErrorDiagnostic=Me("excecutionError",void 0);this._hasFindResult=this._register(new E);this.hasFindResult=this._hasFindResult.event;this._outputViewModels=this.model.outputs.map(g=>new yte(this,g,this._notebookService)),this._register(this.model.onDidChangeOutputs(g=>{let f=[],v=!1;for(let b=g.start;b<g.start+g.deleteCount;b++)this._outputCollection[b]!==void 0&&this._outputCollection[b]!==0&&(v=!0);this._outputCollection.splice(g.start,g.deleteCount,...g.newOutputs.map(()=>0)),f.push(...this._outputViewModels.splice(g.start,g.deleteCount,...g.newOutputs.map(b=>new yte(this,b,this._notebookService)))),this._outputsTop=null,this._onDidChangeOutputs.fire(g),this._onDidRemoveOutputs.fire(f),v&&this.layoutChange({outputHeight:!0},"CodeCellViewModel#model.onDidChangeOutputs"),this._outputCollection.length||this.executionErrorDiagnostic.set(void 0,void 0),Be(f)})),this._outputCollection=new Array(this.model.outputs.length);let h=this.viewContext.notebookOptions.getLayoutConfiguration();this._layoutInfo={fontInfo:o?.fontInfo||null,editorHeight:0,editorWidth:o?this.viewContext.notebookOptions.computeCodeCellEditorWidth(o.width):0,chatHeight:0,statusBarHeight:0,commentOffset:0,commentHeight:0,outputContainerOffset:0,outputTotalHeight:0,outputShowMoreContainerHeight:0,outputShowMoreContainerOffset:0,totalHeight:this.computeTotalHeight(17,0,0,0),codeIndicatorHeight:0,outputIndicatorHeight:0,bottomToolbarOffset:0,layoutState:0,estimatedHasHorizontalScrolling:!1,outlineWidth:1,topMargin:h.cellTopMargin,bottomMargin:h.cellBottomMargin}}set editorHeight(e){this._editorHeight!==e&&(this._editorHeight=e,this.layoutChange({editorHeight:!0},"CodeCellViewModel#editorHeight"))}get editorHeight(){throw new Error("editorHeight is write-only")}set chatHeight(e){this._chatHeight!==e&&(this._chatHeight=e,this.layoutChange({chatHeight:!0},"CodeCellViewModel#chatHeight"))}get chatHeight(){return this._chatHeight}get outputIsHovered(){return this._hoveringOutput}set outputIsHovered(e){this._hoveringOutput=e,this._onDidChangeState.fire({outputIsHoveredChanged:!0})}get outputIsFocused(){return this._focusOnOutput}set outputIsFocused(e){this._focusOnOutput=e,this._onDidChangeState.fire({outputIsFocusedChanged:!0})}get inputInOutputIsFocused(){return this._focusInputInOutput}set inputInOutputIsFocused(e){this._focusInputInOutput=e}get outputMinHeight(){return this._outputMinHeight}set outputMinHeight(e){this._outputMinHeight=e}get layoutInfo(){return this._layoutInfo}get outputsViewModels(){return this._outputViewModels}updateExecutionState(e){e.changed?(this.executionErrorDiagnostic.set(void 0,void 0),this._onDidStartExecution.fire(e)):this._onDidStopExecution.fire(e)}updateOptions(e){super.updateOptions(e),(e.cellStatusBarVisibility||e.insertToolbarPosition||e.cellToolbarLocation)&&this.layoutChange({})}pauseLayout(){this._pauseableEmitter.pause()}resumeLayout(){this._pauseableEmitter.resume()}layoutChange(e,t){this._ensureOutputsTop();let o=this.viewContext.notebookOptions.getLayoutConfiguration(),n=this.viewContext.notebookOptions.computeBottomToolbarDimensions(this.viewType),r=e.outputShowMoreContainerHeight?e.outputShowMoreContainerHeight:this._layoutInfo.outputShowMoreContainerHeight,s=Math.max(this._outputMinHeight,this.isOutputCollapsed?o.collapsedIndicatorHeight:this._outputsTop.getTotalSum()),l=e.commentHeight?this._commentHeight:this._layoutInfo.commentHeight,c=this.layoutInfo;if(this.isInputCollapsed){let u=o.collapsedIndicatorHeight,p=s+r,h=e.chatHeight?this._chatHeight:this._layoutInfo.chatHeight,g=o.cellTopMargin+o.collapsedIndicatorHeight,f=o.cellTopMargin+o.collapsedIndicatorHeight+o.cellBottomMargin+n.bottomToolbarGap+h+l+s+r,v=f-n.bottomToolbarGap-n.bottomToolbarHeight/2-r,b=this.viewContext.notebookOptions.computeBottomToolbarOffset(f,this.viewType),S=e.outerWidth!==void 0?this.viewContext.notebookOptions.computeCodeCellEditorWidth(e.outerWidth):this._layoutInfo?.editorWidth;this._layoutInfo={fontInfo:e.font??this._layoutInfo.fontInfo??null,editorHeight:this._layoutInfo.editorHeight,editorWidth:S,chatHeight:h,statusBarHeight:0,outputContainerOffset:g,outputTotalHeight:s,outputShowMoreContainerHeight:r,outputShowMoreContainerOffset:v,commentOffset:g+s,commentHeight:l,totalHeight:f,codeIndicatorHeight:u,outputIndicatorHeight:p,bottomToolbarOffset:b,layoutState:this._layoutInfo.layoutState,estimatedHasHorizontalScrolling:!1,outlineWidth:1,topMargin:o.cellTopMargin,bottomMargin:o.cellBottomMargin}}else{let u,p,h,g=!1,f=e.chatHeight?this._chatHeight:this._layoutInfo.chatHeight;if(!e.editorHeight&&this._layoutInfo.layoutState===2&&!e.outputHeight){let P=this.estimateEditorHeight(e.font?.lineHeight??this._layoutInfo.fontInfo?.lineHeight);p=P.editorHeight,g=P.hasHorizontalScrolling,h=this._layoutInfo.totalHeight,u=2}else if(e.editorHeight||this._layoutInfo.layoutState===3)p=this._editorHeight,h=this.computeTotalHeight(this._editorHeight,s,r,f),u=3,g=this._layoutInfo.estimatedHasHorizontalScrolling;else{let P=this.estimateEditorHeight(e.font?.lineHeight??this._layoutInfo.fontInfo?.lineHeight);p=P.editorHeight,g=P.hasHorizontalScrolling,h=this.computeTotalHeight(p,s,r,f),u=1}let v=this.viewContext.notebookOptions.computeEditorStatusbarHeight(this.internalMetadata,this.uri),b=p+v,S=s+r,y=o.editorToolbarHeight+o.cellTopMargin+f+p+v,w=h-n.bottomToolbarGap-n.bottomToolbarHeight/2-r,k=this.viewContext.notebookOptions.computeBottomToolbarOffset(h,this.viewType),T=e.outerWidth!==void 0?this.viewContext.notebookOptions.computeCodeCellEditorWidth(e.outerWidth):this._layoutInfo?.editorWidth;this._layoutInfo={fontInfo:e.font??this._layoutInfo.fontInfo??null,chatHeight:f,editorHeight:p,editorWidth:T,statusBarHeight:v,outputContainerOffset:y,outputTotalHeight:s,outputShowMoreContainerHeight:r,outputShowMoreContainerOffset:w,commentOffset:y+s,commentHeight:l,totalHeight:h,codeIndicatorHeight:b,outputIndicatorHeight:S,bottomToolbarOffset:k,layoutState:u,estimatedHasHorizontalScrolling:g,topMargin:o.cellTopMargin,bottomMargin:o.cellBottomMargin,outlineWidth:1}}this._fireOnDidChangeLayout({...e,totalHeight:this.layoutInfo.totalHeight!==c.totalHeight,source:t})}_fireOnDidChangeLayout(e){this._pauseableEmitter.fire(e)}restoreEditorViewState(e,t){super.restoreEditorViewState(e),t!==void 0&&this._layoutInfo.layoutState!==3&&(this._layoutInfo={...this._layoutInfo,totalHeight:t,layoutState:2})}getDynamicHeight(){return this._onLayoutInfoRead.fire(),this._layoutInfo.totalHeight}getHeight(e){if(this._layoutInfo.layoutState===0){let t=this.estimateEditorHeight(e);return this.computeTotalHeight(t.editorHeight,0,0,0)}else return this._layoutInfo.totalHeight}estimateEditorHeight(e=20){let t=!1,o=this.viewContext.getBaseCellEditorOptions(this.language);if(this.layoutInfo.fontInfo&&o.value.wordWrap==="off"){for(let l=0;l<this.lineCount;l++)if(this.textBuffer.getLineLastNonWhitespaceColumn(l+1)*(this.layoutInfo.fontInfo.typicalHalfwidthCharacterWidth+this.layoutInfo.fontInfo.letterSpacing)>this.layoutInfo.editorWidth){t=!0;break}}let n=t?12:0,r=this.viewContext.notebookOptions.computeEditorPadding(this.internalMetadata,this.uri);return{editorHeight:this.lineCount*e+r.top+r.bottom+n,hasHorizontalScrolling:t}}computeTotalHeight(e,t,o,n){let r=this.viewContext.notebookOptions.getLayoutConfiguration(),{bottomToolbarGap:s}=this.viewContext.notebookOptions.computeBottomToolbarDimensions(this.viewType);return r.editorToolbarHeight+r.cellTopMargin+n+e+this.viewContext.notebookOptions.computeEditorStatusbarHeight(this.internalMetadata,this.uri)+this._commentHeight+t+o+s+r.cellBottomMargin}onDidChangeTextModelContent(){this.getEditState()!==1&&(this.updateEditState(1,"onDidChangeTextModelContent"),this._onDidChangeState.fire({contentChanged:!0}))}onDeselect(){this.updateEditState(0,"onDeselect")}updateOutputShowMoreContainerHeight(e){this.layoutChange({outputShowMoreContainerHeight:e},"CodeCellViewModel#updateOutputShowMoreContainerHeight")}updateOutputMinHeight(e){this.outputMinHeight=e}unlockOutputHeight(){this.outputMinHeight=0,this.layoutChange({outputHeight:!0})}updateOutputHeight(e,t,o){if(e>=this._outputCollection.length)throw new Error("Output index out of range!");this._ensureOutputsTop();try{e===0||t>0?this._outputViewModels[e].setVisible(!0):t===0&&this._outputViewModels[e].setVisible(!1)}catch(n){let r=`Failed to update output height for cell ${this.handle}, output ${e}. this.outputCollection.length: ${this._outputCollection.length}, this._outputViewModels.length: ${this._outputViewModels.length}`;throw new Error(`${r}.
 Error: ${n.message}`)}this._outputViewModels[e].visible.get()&&t<28&&(t=28),this._outputCollection[e]=t,this._outputsTop.setValue(e,t)&&this.layoutChange({outputHeight:!0},o)}getOutputOffsetInContainer(e){if(this._ensureOutputsTop(),e>=this._outputCollection.length)throw new Error("Output index out of range!");return this._outputsTop.getPrefixSum(e-1)}getOutputOffset(e){return this.layoutInfo.outputContainerOffset+this.getOutputOffsetInContainer(e)}spliceOutputHeights(e,t,o){if(this._ensureOutputsTop(),this._outputsTop.removeValues(e,t),o.length){let n=new Uint32Array(o.length);for(let r=0;r<o.length;r++)n[r]=o[r];this._outputsTop.insertValues(e,n)}this.layoutChange({outputHeight:!0},"CodeCellViewModel#spliceOutputs")}_ensureOutputsTop(){if(!this._outputsTop){let e=new Uint32Array(this._outputCollection.length);for(let t=0;t<this._outputCollection.length;t++)e[t]=this._outputCollection[t];this._outputsTop=new C_(e)}}startFind(e,t){let o=super.cellStartFind(e,t);return o===null?null:{cell:this,contentMatches:o}}dispose(){super.dispose(),this._outputCollection=[],this._outputsTop=null,Be(this._outputViewModels)}};ih=I([m(4,B),m(5,bn),m(6,Bt),m(7,Ml),m(8,qt),m(9,yI)],ih);var Hb=class extends PPe{constructor(e,t,o,n,r,s,l,c,u,p){super(e,t,xt(),r,s,l,c,u,p);this.foldingDelegate=n;this.viewContext=r;this.cellKind=1;this._previewHeight=0;this._chatHeight=0;this._editorHeight=0;this._statusBarHeight=0;this._onDidChangeLayout=this._register(new E);this.onDidChangeLayout=this._onDidChangeLayout.event;this._hoveringOutput=!1;this._focusOnOutput=!1;this._hoveringCell=!1;this.outputsViewModels=[];this._hasFindResult=this._register(new E);this.hasFindResult=this._hasFindResult.event;let{bottomToolbarGap:h}=this.viewContext.notebookOptions.computeBottomToolbarDimensions(this.viewType),g=this.viewContext.notebookOptions.getLayoutConfiguration();this._layoutInfo={chatHeight:0,editorHeight:0,previewHeight:0,fontInfo:o?.fontInfo||null,editorWidth:o?.width?this.viewContext.notebookOptions.computeMarkdownCellEditorWidth(o.width):0,commentOffset:0,commentHeight:0,bottomToolbarOffset:h,totalHeight:100,layoutState:0,foldHintHeight:0,statusBarHeight:0,outlineWidth:1,bottomMargin:g.markdownCellBottomMargin,topMargin:g.markdownCellTopMargin},this._register(this.onDidChangeState(f=>{this.viewContext.eventDispatcher.emit([new NUt(f,this.model)]),f.foldingStateChanged&&this._updateTotalHeight(this._computeTotalHeight(),0)}))}get renderedHtml(){return this._renderedHtml}set renderedHtml(e){this._renderedHtml!==e&&(this._renderedHtml=e,this._onDidChangeState.fire({contentChanged:!0}))}get layoutInfo(){return this._layoutInfo}set renderedMarkdownHeight(e){this._previewHeight=e,this._updateTotalHeight(this._computeTotalHeight())}set chatHeight(e){this._chatHeight=e,this._updateTotalHeight(this._computeTotalHeight())}get chatHeight(){return this._chatHeight}set editorHeight(e){this._editorHeight=e,this._statusBarHeight=this.viewContext.notebookOptions.computeStatusBarHeight(),this._updateTotalHeight(this._computeTotalHeight())}get editorHeight(){throw new Error("MarkdownCellViewModel.editorHeight is write only")}get foldingState(){return this.foldingDelegate.getFoldingState(this.foldingDelegate.getCellIndex(this))}get outputIsHovered(){return this._hoveringOutput}set outputIsHovered(e){this._hoveringOutput=e}get outputIsFocused(){return this._focusOnOutput}set outputIsFocused(e){this._focusOnOutput=e}get inputInOutputIsFocused(){return!1}set inputInOutputIsFocused(e){}get cellIsHovered(){return this._hoveringCell}set cellIsHovered(e){this._hoveringCell=e,this._onDidChangeState.fire({cellIsHoveredChanged:!0})}_computeTotalHeight(){let e=this.viewContext.notebookOptions.getLayoutConfiguration(),{bottomToolbarGap:t}=this.viewContext.notebookOptions.computeBottomToolbarDimensions(this.viewType),o=this._computeFoldHintHeight();return this.getEditState()===1?this._editorHeight+e.markdownCellTopMargin+e.markdownCellBottomMargin+t+this._statusBarHeight+this._commentHeight:Math.max(1,this._previewHeight+t+o+this._commentHeight)}_computeFoldHintHeight(){return this.getEditState()===1||this.foldingState!==2?0:this.viewContext.notebookOptions.getLayoutConfiguration().markdownFoldHintHeight}updateOptions(e){super.updateOptions(e),(e.cellStatusBarVisibility||e.insertToolbarPosition||e.cellToolbarLocation)&&this._updateTotalHeight(this._computeTotalHeight())}getOutputOffset(e){return-1}updateOutputHeight(e,t){}triggerFoldingStateChange(){this._onDidChangeState.fire({foldingStateChanged:!0})}_updateTotalHeight(e,t){e!==this.layoutInfo.totalHeight&&this.layoutChange({totalHeight:e,context:t})}layoutChange(e){let t,o;this.isInputCollapsed?(t=this.viewContext.notebookOptions.computeCollapsedMarkdownCellHeight(this.viewType),e.totalHeight=t,o=0):(t=e.totalHeight===void 0?this._layoutInfo.layoutState===0?100:this._layoutInfo.totalHeight:e.totalHeight,o=this._computeFoldHintHeight());let n,r=this.viewContext.notebookOptions.getLayoutConfiguration();this.getEditState()===1?n=r.editorToolbarHeight+r.cellTopMargin+this._chatHeight+this._editorHeight+this._statusBarHeight:n=this._previewHeight,this._layoutInfo={fontInfo:e.font||this._layoutInfo.fontInfo,editorWidth:e.outerWidth!==void 0?this.viewContext.notebookOptions.computeMarkdownCellEditorWidth(e.outerWidth):this._layoutInfo.editorWidth,chatHeight:this._chatHeight,editorHeight:this._editorHeight,statusBarHeight:this._statusBarHeight,previewHeight:this._previewHeight,bottomToolbarOffset:this.viewContext.notebookOptions.computeBottomToolbarOffset(t,this.viewType),totalHeight:t,layoutState:3,foldHintHeight:o,commentOffset:n,commentHeight:e.commentHeight?this._commentHeight:this._layoutInfo.commentHeight,outlineWidth:1,bottomMargin:r.markdownCellBottomMargin,topMargin:r.markdownCellTopMargin},this._onDidChangeLayout.fire(e)}restoreEditorViewState(e,t){super.restoreEditorViewState(e),t!==void 0&&this.layoutInfo.layoutState===0&&(this._layoutInfo={...this.layoutInfo,totalHeight:t,chatHeight:this._chatHeight,editorHeight:this._editorHeight,statusBarHeight:this._statusBarHeight,layoutState:2},this.layoutChange({}))}getDynamicHeight(){return null}getHeight(e){return this._layoutInfo.layoutState===0?100:this._layoutInfo.totalHeight}onDidChangeTextModelContent(){this._onDidChangeState.fire({contentChanged:!0})}onDeselect(){}startFind(e,t){let o=super.cellStartFind(e,t);return o===null?null:{cell:this,contentMatches:o}}dispose(){super.dispose(),this.foldingDelegate=null}};Hb=I([m(5,B),m(6,Bt),m(7,Ml),m(8,qt),m(9,yI)],Hb);var fhe=class extends Rp{constructor(e,t){super();this.instantiationService=t;this.cellContextKeyManager=this._register(this.instantiationService.createInstance(vhe,e,void 0))}didRenderCell(e){this.cellContextKeyManager.updateForElement(e)}};fhe=I([m(1,F)],fhe);var vhe=class extends x{constructor(e,t,o,n){super();this.notebookEditor=e;this.element=t;this._contextKeyService=o;this._notebookExecutionStateService=n;this.elementDisposables=this._register(new N);this._contextKeyService.bufferChangeEvents(()=>{this.cellType=NS.bindTo(this._contextKeyService),this.cellEditable=jw.bindTo(this._contextKeyService),this.cellFocused=Xme.bindTo(this._contextKeyService),this.cellEditorFocused=SM.bindTo(this._contextKeyService),this.markdownEditMode=nte.bindTo(this._contextKeyService),this.cellRunState=Jme.bindTo(this._contextKeyService),this.cellExecuting=iUt.bindTo(this._contextKeyService),this.cellHasOutputs=Bk.bindTo(this._contextKeyService),this.cellContentCollapsed=gPe.bindTo(this._contextKeyService),this.cellOutputCollapsed=vtt.bindTo(this._contextKeyService),this.cellLineNumbers=ftt.bindTo(this._contextKeyService),this.cellResource=gmo.bindTo(this._contextKeyService),this.cellHasErrorDiagnostics=Zme.bindTo(this._contextKeyService),t&&this.updateForElement(t)}),this._register(this._notebookExecutionStateService.onDidChangeExecution(r=>{r.type===0&&this.element&&r.affectsCell(this.element.uri)&&this.updateForExecutionState()}))}updateForElement(e){this.elementDisposables.clear(),this.element=e,e&&(this.elementDisposables.add(e.onDidChangeState(t=>this.onDidChangeState(t))),e instanceof ih&&(this.elementDisposables.add(e.onDidChangeOutputs(()=>this.updateForOutputs())),this.elementDisposables.add(be(t=>{this.cellHasErrorDiagnostics.set(!!t.readObservable(e.executionErrorDiagnostic))}))),this.elementDisposables.add(this.notebookEditor.onDidChangeActiveCell(()=>this.updateForFocusState())),this.element instanceof Hb?this.cellType.set("markup"):this.element instanceof ih&&this.cellType.set("code"),this._contextKeyService.bufferChangeEvents(()=>{this.updateForFocusState(),this.updateForExecutionState(),this.updateForEditState(),this.updateForCollapseState(),this.updateForOutputs(),this.cellLineNumbers.set(this.element.lineNumbers),this.cellResource.set(this.element.uri.toString())}))}onDidChangeState(e){this._contextKeyService.bufferChangeEvents(()=>{e.internalMetadataChanged&&this.updateForExecutionState(),e.editStateChanged&&this.updateForEditState(),e.focusModeChanged&&this.updateForFocusState(),e.cellLineNumberChanged&&this.cellLineNumbers.set(this.element.lineNumbers),(e.inputCollapsedChanged||e.outputCollapsedChanged)&&this.updateForCollapseState()})}updateForFocusState(){if(!this.element)return;let e=this.notebookEditor.getActiveCell();this.cellFocused.set(this.notebookEditor.getActiveCell()===this.element),e===this.element?this.cellEditorFocused.set(this.element.focusMode===1):this.cellEditorFocused.set(!1)}updateForExecutionState(){if(!this.element)return;let e=this.element.internalMetadata;this.cellEditable.set(!this.notebookEditor.isReadOnly);let t=this._notebookExecutionStateService.getCellExecution(this.element.uri);this.element instanceof Hb?(this.cellRunState.reset(),this.cellExecuting.reset()):t?.state===3?(this.cellRunState.set("executing"),this.cellExecuting.set(!0)):t?.state===2||t?.state===1?(this.cellRunState.set("pending"),this.cellExecuting.set(!0)):e.lastRunSuccess===!0?(this.cellRunState.set("succeeded"),this.cellExecuting.set(!1)):e.lastRunSuccess===!1?(this.cellRunState.set("failed"),this.cellExecuting.set(!1)):(this.cellRunState.set("idle"),this.cellExecuting.set(!1))}updateForEditState(){this.element&&(this.element instanceof Hb?this.markdownEditMode.set(this.element.getEditState()===1):this.markdownEditMode.set(!1))}updateForCollapseState(){this.element&&(this.cellContentCollapsed.set(!!this.element.isInputCollapsed),this.cellOutputCollapsed.set(!!this.element.isOutputCollapsed))}updateForOutputs(){this.element instanceof ih?this.cellHasOutputs.set(this.element.outputsViewModels.length>0):this.cellHasOutputs.set(!1)}};vhe=I([m(2,X),m(3,bs)],vhe);var vJo=_,_ho="cell-dragging",VEi="global-drag-active",Wtt=class extends Rp{constructor(e){super();this.container=e}didRenderCell(e){this.update(e)}updateState(e,t){t.dragStateChanged&&this.update(e)}update(e){this.container.classList.toggle(_ho,e.dragging)}},FUt=class extends x{constructor(e,t){super();this.notebookEditor=e;this.notebookListContainer=t;this.draggedCells=[];this.isScrolling=!1;this.listOnWillScrollListener=this._register(new me);this.listInsertionIndicator=M(t,vJo(".cell-list-insertion-indicator")),this._register(j(t.ownerDocument.body,re.DRAG_START,this.onGlobalDragStart.bind(this),!0)),this._register(j(t.ownerDocument.body,re.DRAG_END,this.onGlobalDragEnd.bind(this),!0));let o=(n,r,s=!1)=>{this._register(j(e.getDomNode(),n,l=>{let c=this.toCellDragEvent(l);c&&r(c)},s))};o(re.DRAG_OVER,n=>{this.currentDraggedCell&&(n.browserEvent.preventDefault(),this.onCellDragover(n))},!0),o(re.DROP,n=>{this.currentDraggedCell&&(n.browserEvent.preventDefault(),this.onCellDrop(n))}),o(re.DRAG_LEAVE,n=>{n.browserEvent.preventDefault(),this.onCellDragLeave(n)}),this.scrollingDelayer=this._register(new Xo(200))}setList(e){this.list=e,this.listOnWillScrollListener.value=this.list.onWillScroll(t=>{t.scrollTopChanged&&(this.setInsertIndicatorVisibility(!1),this.isScrolling=!0,this.scrollingDelayer.trigger(()=>{this.isScrolling=!1}))})}setInsertIndicatorVisibility(e){this.listInsertionIndicator.style.opacity=e?"1":"0"}toCellDragEvent(e){let t=this.notebookListContainer.getBoundingClientRect().top,o=this.list.scrollTop+e.clientY-t,n=this.list.elementAt(o);if(!n)return;let r=this.list.getCellViewScrollTop(n),s=this.list.elementHeight(n),c=(o-r)/s;return{browserEvent:e,draggedOverCell:n,cellTop:r,cellHeight:s,dragPosRatio:c}}clearGlobalDragState(){this.notebookEditor.getDomNode().classList.remove(VEi)}onGlobalDragStart(){this.notebookEditor.getDomNode().classList.add(VEi)}onGlobalDragEnd(){this.notebookEditor.getDomNode().classList.remove(VEi)}onCellDragover(e){if(!e.browserEvent.dataTransfer)return;if(!this.currentDraggedCell){e.browserEvent.dataTransfer.dropEffect="none";return}if(this.isScrolling||this.currentDraggedCell===e.draggedOverCell){this.setInsertIndicatorVisibility(!1);return}let t=this.getDropInsertDirection(e.dragPosRatio),o=t==="above"?e.cellTop:e.cellTop+e.cellHeight;this.updateInsertIndicator(t,o)}updateInsertIndicator(e,t){let{bottomToolbarGap:o}=this.notebookEditor.notebookOptions.computeBottomToolbarDimensions(this.notebookEditor.textModel?.viewType),n=t-this.list.scrollTop+o/2;n>=0?(this.listInsertionIndicator.style.top=`${n}px`,this.setInsertIndicatorVisibility(!0)):this.setInsertIndicatorVisibility(!1)}getDropInsertDirection(e){return e<.5?"above":"below"}onCellDrop(e){let t=this.currentDraggedCell;if(this.isScrolling||this.currentDraggedCell===e.draggedOverCell)return;this.dragCleanup();let o=this.getDropInsertDirection(e.dragPosRatio);this._dropImpl(t,o,e.browserEvent,e.draggedOverCell)}getCellRangeAroundDragTarget(e){let t=this.notebookEditor.getSelections(),n=HX(this.notebookEditor,t).find(r=>r.start<=e&&e<r.end);return n||{start:e,end:e+1}}_dropImpl(e,t,o,n){let r=this.list.getCellViewScrollTop(n),s=this.list.elementHeight(n),l=t==="above"?r:r+s,{bottomToolbarGap:c}=this.notebookEditor.notebookOptions.computeBottomToolbarDimensions(this.notebookEditor.textModel?.viewType),u=l-this.list.scrollTop+c/2,p=this.notebookEditor.getDomNode().getBoundingClientRect().height;if(u<0||u>p)return;let h=o.ctrlKey&&!Ze||o.altKey&&Ze;if(!this.notebookEditor.hasModel())return;let g=this.notebookEditor.textModel;if(h){let f=this.notebookEditor.getCellIndex(e),v=this.getCellRangeAroundDragTarget(f),b=this.notebookEditor.getCellIndex(n);if(t==="below"){let w=this.notebookEditor.getCellIndex(n);b=this.notebookEditor.getNextVisibleCellIndex(w)}let S,y;if(b<=v.start)S={start:b,end:b+v.end-v.start},y={start:b+f-v.start,end:b+f-v.start+1};else{let w=b-v.start;S={start:v.start+w,end:v.end+w},y={start:f+w,end:f+w+1}}g.applyEdits([{editType:1,index:b,count:0,cells:Yf([v]).map(w=>yG(this.notebookEditor.cellAt(w).model))}],!0,{kind:1,focus:this.notebookEditor.getFocus(),selections:this.notebookEditor.getSelections()},()=>({kind:1,focus:y,selections:[S]}),void 0,!0),this.notebookEditor.revealCellRangeInView(S)}else bJo(this.notebookEditor,e,t,n)}onCellDragLeave(e){(!e.browserEvent.relatedTarget||!ts(e.browserEvent.relatedTarget,this.notebookEditor.getDomNode()))&&this.setInsertIndicatorVisibility(!1)}dragCleanup(){this.currentDraggedCell&&(this.draggedCells.forEach(e=>e.dragging=!1),this.currentDraggedCell=void 0,this.draggedCells=[]),this.setInsertIndicatorVisibility(!1)}registerDragHandle(e,t,o,n){let r=e.container;for(let c of o)c.setAttribute("draggable","true");let s=()=>{!this.notebookEditor.notebookOptions.getDisplayOptions().dragAndDropEnabled||this.notebookEditor.isReadOnly||(r.classList.remove(_ho),this.dragCleanup())};for(let c of o)e.templateDisposables.add(j(c,re.DRAG_END,s));let l=c=>{if(!c.dataTransfer||!this.notebookEditor.notebookOptions.getDisplayOptions().dragAndDropEnabled||this.notebookEditor.isReadOnly)return;this.currentDraggedCell=e.currentRenderedCell,this.draggedCells=this.notebookEditor.getSelections().map(p=>this.notebookEditor.getCellsInRange(p)).flat(),this.draggedCells.forEach(p=>p.dragging=!0);let u=n();t.parentElement.appendChild(u),c.dataTransfer.setDragImage(u,0,0),setTimeout(()=>u.remove(),0)};for(let c of o)e.templateDisposables.add(j(c,re.DRAG_START,l))}startExplicitDrag(e,t){!this.notebookEditor.notebookOptions.getDisplayOptions().dragAndDropEnabled||this.notebookEditor.isReadOnly||(this.currentDraggedCell=e,this.setInsertIndicatorVisibility(!0))}explicitDrag(e,t){if(!this.notebookEditor.notebookOptions.getDisplayOptions().dragAndDropEnabled||this.notebookEditor.isReadOnly)return;let o=this.list.elementAt(t);if(o&&o!==e){let u=this.list.getCellViewScrollTop(o),p=this.list.elementHeight(o),h=this.getExplicitDragDropDirection(t,u,p),g=h==="above"?u:u+p;this.updateInsertIndicator(h,g)}if(this.currentDraggedCell!==e)return;let n=this.notebookEditor.getDomNode().getBoundingClientRect(),r=t-this.list.scrollTop,s=.2,l=20,c=r/n.height;c<s?this.list.scrollTop-=l*(1-c/s):c>1-s&&(this.list.scrollTop+=l*(1-(1-c)/s))}endExplicitDrag(e){this.setInsertIndicatorVisibility(!1)}explicitDrop(e,t){this.currentDraggedCell=void 0,this.setInsertIndicatorVisibility(!1);let o=this.list.elementAt(t.dragOffsetY);if(!o||o===e)return;let n=this.list.getCellViewScrollTop(o),r=this.list.elementHeight(o),s=this.getExplicitDragDropDirection(t.dragOffsetY,n,r);this._dropImpl(e,s,t,o)}getExplicitDragDropDirection(e,t,o){let r=(e-t)/o;return this.getDropInsertDirection(r)}dispose(){this.notebookEditor=null,super.dispose()}};function bJo(a,i,e,t){let o=a.getCellIndex(i),n=a.getCellIndex(t);if(typeof o!="number"||typeof n!="number")return;e==="below"&&(n=a.getNextVisibleCellIndex(n)??n);let r=a.getSelections();r.length||(r=[a.getFocus()]);let s=a.getFocus().start;r.some(b=>b.start<=o&&b.end>o)||(r=[{start:o,end:o+1}],s=o);let l=r.find(b=>b.start<=n&&b.end>n);l&&(n=l.start);let c=0,u=n,p=n;r.sort((b,S)=>S.start-b.start);let h=r.map(b=>{let S=b.end-b.start,y=0;b.end<=p&&(y=-S);let w=p+y;if(s>=b.start&&s<=b.end){let P=s-b.start;u=w+P}let k=b.start>=n?c:0,T={editType:6,index:b.start+k,length:S,newIdx:w};return c+=S,b.end<p&&(p-=S),T}),g=h[h.length-1],f={start:g.newIdx,end:g.newIdx+c},v={start:u,end:u+1};a.textModel.applyEdits(h,!0,{kind:1,focus:a.getFocus(),selections:a.getSelections()},()=>({kind:1,focus:v,selections:[f]}),void 0,!0),a.revealCellRangeInView(f)}var WUt=class{constructor(i){this._items=[];this._whitespace=[];this._prefixSumComputer=new Cye([]);this._size=0;this._paddingTop=0;this._paddingTop=i??0,this._size=this._paddingTop}get paddingTop(){return this._paddingTop}set paddingTop(i){this._size=this._size+i-this._paddingTop,this._paddingTop=i}get count(){return this._items.length}get size(){return this._size}getWhitespaces(){return this._whitespace}restoreWhitespace(i){this._whitespace=i,this._size=this._paddingTop+this._items.reduce((e,t)=>e+t.size,0)+this._whitespace.reduce((e,t)=>e+t.size,0)}splice(i,e,t){let o=t??[];this._items.splice(i,e,...o),this._size=this._paddingTop+this._items.reduce((r,s)=>r+s.size,0)+this._whitespace.reduce((r,s)=>r+s.size,0),this._prefixSumComputer.removeValues(i,e);let n=[];for(let r=0;r<o.length;r++){let s=r+i,l=this._whitespace.filter(c=>c.afterPosition===s+1);l.length>0?n.push(o[r].size+l.reduce((c,u)=>c+u.size,0)):n.push(o[r].size)}this._prefixSumComputer.insertValues(i,n);for(let r=i;r<this._items.length;r++){let s=this._whitespace.filter(l=>l.afterPosition===r+1);s.length>0?this._prefixSumComputer.setValue(r,this._items[r].size+s.reduce((l,c)=>l+c.size,0)):this._prefixSumComputer.setValue(r,this._items[r].size)}}insertWhitespace(i,e,t){let o=0,n=this._whitespace.filter(r=>r.afterPosition===e);if(n.length>0&&(o=Math.max(...n.map(r=>r.priority))+1),this._whitespace.push({id:i,afterPosition:e,size:t,priority:o}),this._size+=t,this._whitespace.sort((r,s)=>r.afterPosition===s.afterPosition?r.priority-s.priority:r.afterPosition-s.afterPosition),e>0){let r=e-1,l=this._items[r].size+t;this._prefixSumComputer.setValue(r,l)}}changeOneWhitespace(i,e,t){let o=this._whitespace.findIndex(n=>n.id===i);if(o!==-1){let n=this._whitespace[o],r=n.afterPosition;n.afterPosition=e;let s=n.size,l=t-s;if(n.size=t,this._size+=l,r>0&&r<=this._items.length){let c=r-1,p=this._items[c].size;this._prefixSumComputer.setValue(c,p)}if(e>0&&e<=this._items.length){let c=e-1,p=this._items[c].size+t;this._prefixSumComputer.setValue(c,p)}}}removeWhitespace(i){let e=this._whitespace.findIndex(t=>t.id===i);if(e!==-1){let t=this._whitespace[e];if(this._whitespace.splice(e,1),this._size-=t.size,t.afterPosition>0){let o=t.afterPosition-1,n=this._items[o].size,r=this._whitespace.filter(l=>l.afterPosition===t.afterPosition),s=n+r.reduce((l,c)=>l+c.size,0);this._prefixSumComputer.setValue(o,s)}}}getWhitespacePosition(i){let e=this._whitespace.find(l=>l.id===i);if(!e)throw new Error("Whitespace not found");let t=e.afterPosition;if(t===0)return this._whitespace.filter(c=>c.afterPosition===t&&c.priority<e.priority).reduce((c,u)=>c+u.size,0)+this.paddingTop;let o=this._whitespace.filter(l=>l.afterPosition===0).reduce((l,c)=>l+c.size,0),n=t-1,r=this._prefixSumComputer.getPrefixSum(n),s=this._items[n].size;return r+s+o+this.paddingTop}indexAt(i){if(i<0)return-1;let e=this._whitespace.filter(o=>o.afterPosition===0).reduce((o,n)=>o+n.size,0),t=i-(this._paddingTop+e);return t<=0?0:t>=this._size-this._paddingTop-e?this.count:this._prefixSumComputer.getIndexOf(Math.trunc(t)).index}indexAfter(i){let e=this.indexAt(i);return Math.min(e+1,this._items.length)}positionAt(i){if(i<0||this.count===0||i>=this.count)return-1;let e=this._whitespace.filter(t=>t.afterPosition===0).reduce((t,o)=>t+o.size,0);return this._prefixSumComputer.getPrefixSum(i)+this._paddingTop+e}},VUt=class extends ICe{constructor(){super(...arguments);this._lastWhitespaceId=0;this._renderingStack=0}get inRenderingTransaction(){return this._renderingStack>0}get notebookRangeMap(){return this.rangeMap}render(e,t,o,n,r,s){this._renderingStack++,super.render(e,t,o,n,r,s),this._renderingStack--}_rerender(e,t,o){this._renderingStack++,super._rerender(e,t,o),this._renderingStack--}createRangeMap(e){let t=this.rangeMap;if(t){let o=new WUt(e);return o.restoreWhitespace(t.getWhitespaces()),o}else return new WUt(e)}insertWhitespace(e,t){let o=this.scrollTop,n=`${++this._lastWhitespaceId}`,r=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight),s=this.elementTop(e),l=o>s;this.notebookRangeMap.insertWhitespace(n,e,t);let c=l?o+t:o;return this.render(r,c,this.lastRenderHeight,void 0,void 0,!1),this._rerender(c,this.renderHeight,!1),this.eventuallyUpdateScrollDimensions(),n}changeOneWhitespace(e,t,o){let n=this.scrollTop,r=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight);this.notebookRangeMap.getWhitespacePosition(e)>n?(this.notebookRangeMap.changeOneWhitespace(e,t,o),this.render(r,n,this.lastRenderHeight,void 0,void 0,!1),this._rerender(n,this.renderHeight,!1),this.eventuallyUpdateScrollDimensions()):(this.notebookRangeMap.changeOneWhitespace(e,t,o),this.eventuallyUpdateScrollDimensions())}removeWhitespace(e){let t=this.scrollTop,o=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight);this.notebookRangeMap.removeWhitespace(e),this.render(o,t,this.lastRenderHeight,void 0,void 0,!1),this._rerender(t,this.renderHeight,!1),this.eventuallyUpdateScrollDimensions()}getWhitespacePosition(e){return this.notebookRangeMap.getWhitespacePosition(e)}};var BUt=class{constructor(i,e,t){this.notebookExecutionStateService=i;this.configurationService=e;this.scrollEvent=t;this.stopAnchoring=!1}shouldAnchor(i,e,t,o){if(i.element(e).focusMode===1)return!0;if(this.stopAnchoring)return!1;let n=i.elementTop(e)+i.elementHeight(e)+t,s=i.renderHeight+i.getScrollTop()>n,l=this.configurationService.getValue(yt.scrollToRevealCell)!=="none",c=t>0;return l&&c&&!s?(this.watchAchorDuringExecution(o),!0):!1}watchAchorDuringExecution(i){if(!this.executionWatcher&&i.cellKind===2){let e=this.notebookExecutionStateService.getCellExecution(i.uri);e&&e.state===3&&(this.executionWatcher=i.onDidStopExecution(()=>{this.executionWatcher?.dispose(),this.executionWatcher=void 0,this.scrollWatcher?.dispose(),this.stopAnchoring=!1}),this.scrollWatcher=this.scrollEvent(t=>{t.scrollTop<t.oldScrollTop&&(this.stopAnchoring=!0,this.scrollWatcher?.dispose())}))}}dispose(){this.executionWatcher?.dispose(),this.scrollWatcher?.dispose()}};var BEi=()=>{throw new Error("Invalid notebook view zone change accessor")},HUt=class extends x{constructor(e,t){super();this.listView=e;this.coordinator=t;this.domNode=ur(document.createElement("div")),this.domNode.setClassName("view-zones"),this.domNode.setPosition("absolute"),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this.domNode.setWidth("100%"),this._zones={},this.listView.containerDomNode.appendChild(this.domNode.domNode)}changeViewZones(e){let t=!1,o={addZone:n=>(t=!0,this._addZone(n)),removeZone:n=>{t=!0,this._removeZone(n)},layoutZone:n=>{t=!0,this._layoutZone(n)}};return SJo(e,o),o.addZone=BEi,o.removeZone=BEi,o.layoutZone=BEi,t}getViewZoneLayoutInfo(e){let t=this._zones[e];if(!t)return null;let o=this.listView.getWhitespacePosition(t.whitespaceId);return{height:t.zone.heightInPx,top:o}}onCellsChanged(e){e.splices.slice().reverse().forEach(o=>{let[n,r,s]=o,l=n,c=n+r;for(let u in this._zones){let p=this._zones[u].zone,h=p.afterModelPosition-1;if(h>=l&&h<c)p.afterModelPosition=l,this._updateWhitespace(this._zones[u]);else if(h>=c){let f=s.length-r;p.afterModelPosition+=f,this._updateWhitespace(this._zones[u])}}})}onHiddenRangesChange(){for(let e in this._zones)this._updateWhitespace(this._zones[e])}_updateWhitespace(e){let t=e.whitespaceId,o=this.coordinator.convertModelIndexToViewIndex(e.zone.afterModelPosition),n=this._isInHiddenRanges(e.zone);e.isInHiddenArea=n,this.listView.changeOneWhitespace(t,o,n?0:e.zone.heightInPx)}layout(){for(let e in this._zones)this._layoutZone(e)}_addZone(e){let t=this.coordinator.convertModelIndexToViewIndex(e.afterModelPosition),o=this.listView.insertWhitespace(t,e.heightInPx),n=this._isInHiddenRanges(e),r={whitespaceId:o,zone:e,domNode:ur(e.domNode),isInHiddenArea:n};return this._zones[o]=r,r.domNode.setPosition("absolute"),r.domNode.domNode.style.width="100%",r.domNode.setDisplay("none"),r.domNode.setAttribute("notebook-view-zone",o),this.domNode.appendChild(r.domNode),o}_removeZone(e){this.listView.removeWhitespace(e);let t=this._zones[e];if(t)try{this.domNode.removeChild(t.domNode)}catch{}delete this._zones[e]}_layoutZone(e){let t=this._zones[e];if(!t)return;if(this._updateWhitespace(this._zones[e]),this._isInHiddenRanges(t.zone))t.domNode.setDisplay("none");else{let n=this.listView.getWhitespacePosition(t.whitespaceId);t.domNode.setTop(n),t.domNode.setDisplay("block"),t.domNode.setHeight(t.zone.heightInPx)}}_isInHiddenRanges(e){let t=e.afterModelPosition;return!this.coordinator.modelIndexIsVisible(t)}dispose(){super.dispose(),this._zones={}}};function SJo(a,i){try{a(i)}catch(e){mt(e)}}var HEi=class a extends K{static{this.viewZoneIds=[]}constructor(){super({id:"notebook.developer.addViewZones",title:L(12822,"Toggle Notebook View Zones"),category:Ve.Developer,precondition:p5,f1:!0})}async run(i){let e=i.get(ee),t=Jn(e.activeEditorPane);t&&(a.viewZoneIds.length>0?t.changeViewZones(o=>{a.viewZoneIds.reverse().forEach(n=>{o.removeZone(n)}),a.viewZoneIds=[]}):t.changeViewZones(o=>{let n=t.getCellsInRange();if(n.length===0)return;let r=[];for(let s=0;s<n.length;s++){let l=document.createElement("div");l.innerText=`View Zone ${s}`,l.style.backgroundColor="rgba(0, 255, 0, 0.5)";let c=o.addZone({afterModelPosition:s,heightInPx:200,domNode:l});r.push(c)}a.viewZoneIds=r}))}};W(HEi);var UUt=class extends x{constructor(e){super();this.listView=e;this._lastOverlayId=0;this._overlays=Object.create(null);this.domNode=ur(document.createElement("div")),this.domNode.setClassName("cell-overlays"),this.domNode.setPosition("absolute"),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this.domNode.setWidth("100%"),this.listView.containerDomNode.appendChild(this.domNode.domNode)}changeCellOverlays(e){let t=!1;return e({addOverlay:n=>(t=!0,this._addOverlay(n)),removeOverlay:n=>{t=!0,this._removeOverlay(n)},layoutOverlay:n=>{t=!0,this._layoutOverlay(n)}}),t}onCellsChanged(e){this.layout()}onHiddenRangesChange(){this.layout()}layout(){for(let e in this._overlays)this._layoutOverlay(e)}_addOverlay(e){let t=`${++this._lastOverlayId}`,o={overlayId:t,overlay:e,domNode:ur(e.domNode)};return this._overlays[t]=o,o.domNode.setClassName("cell-overlay"),o.domNode.setPosition("absolute"),this.domNode.appendChild(o.domNode),t}_removeOverlay(e){let t=this._overlays[e];if(t){try{this.domNode.removeChild(t.domNode)}catch{}delete this._overlays[e]}}_layoutOverlay(e){let t=this._overlays[e];if(!t)return;if(this._isInHiddenRanges(t)){t.domNode.setDisplay("none");return}t.domNode.setDisplay("block");let n=this.listView.indexOf(t.overlay.cell);if(n===-1)return;let r=this.listView.elementTop(n);t.domNode.setTop(r)}_isInHiddenRanges(e){return this.listView.indexOf(e.overlay.cell)===-1}};function UEi(a,i){if(!i.length)return a;let e=0,t=0,o=[];for(;e<a.length&&t<i.length;)e<i[t].start&&o.push(...a.slice(e,i[t].start)),e=i[t].end+1,t++;return e<a.length&&o.push(...a.slice(e)),o}var bhe=5e3;function yJo(a){let i=0-(parseInt(a.style.top,10)||0);return i>=0&&i<=bhe*2}var NPe=class extends Vl{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,t,n,r,l,s,c,u,p);this.listUser=e;this.notebookOptions=o;this._previousFocusedElements=[];this._localDisposableStore=new N;this._viewModelStore=new N;this._onDidRemoveOutputs=this._localDisposableStore.add(new E);this.onDidRemoveOutputs=this._onDidRemoveOutputs.event;this._onDidHideOutputs=this._localDisposableStore.add(new E);this.onDidHideOutputs=this._onDidHideOutputs.event;this._onDidRemoveCellsFromView=this._localDisposableStore.add(new E);this.onDidRemoveCellsFromView=this._onDidRemoveCellsFromView.event;this._viewModel=null;this._hiddenRangeIds=[];this.hiddenRangesPrefixSum=null;this._onDidChangeVisibleRanges=this._localDisposableStore.add(new E);this.onDidChangeVisibleRanges=this._onDidChangeVisibleRanges.event;this._visibleRanges=[];this._isDisposed=!1;this._isInLayout=!1;this._webviewElement=null;pp.bindTo(this.contextKeyService).set(!0),this._previousFocusedElements=this.getFocusedElements(),this._localDisposableStore.add(this.onDidChangeFocus(w=>{this._previousFocusedElements.forEach(k=>{w.elements.indexOf(k)<0&&k.onDeselect()}),this._previousFocusedElements=w.elements}));let g=Lde.bindTo(s);g.set("none");let f=Rde.bindTo(s);f.set("none");let v=this._localDisposableStore.add(new me),b=this._localDisposableStore.add(new me);this._notebookCellAnchor=new BUt(h,u,this.onDidScroll);let S=w=>{switch(w.cursorAtBoundary()){case 3:g.set("both");break;case 1:g.set("top");break;case 2:g.set("bottom");break;default:g.set("none");break}switch(w.cursorAtLineBoundary()){case 3:f.set("both");break;case 1:f.set("start");break;case 2:f.set("end");break;default:f.set("none");break}};this._localDisposableStore.add(this.onDidChangeFocus(w=>{if(w.elements.length){let k=w.elements[0];v.value=k.onDidChangeState(T=>{T.selectionChanged&&S(k)}),b.value=k.onDidChangeEditorAttachState(()=>{k.editorAttached&&S(k)}),S(k);return}g.set("none")}));let y=()=>{if(!this.view.length)return;let w=this.getViewScrollTop(),k=this.getViewScrollBottom();if(w>=k)return;let T=Bn(this.view.indexAt(w),0,this.view.length-1),P=this.view.element(T),O=this._viewModel.getCellIndex(P),V=Bn(this.view.indexAt(k),0,this.view.length-1),H=this.view.element(V),G=this._viewModel.getCellIndex(H);G-O===V-T?this.visibleRanges=[{start:O,end:G+1}]:this.visibleRanges=this._getVisibleRangesFromIndex(T,O,V,G)};this._localDisposableStore.add(this.view.onDidChangeContentHeight(()=>{this._isInLayout&&Wr(Re(t),()=>{y()}),y()})),this._localDisposableStore.add(this.view.onDidScroll(()=>{this._isInLayout&&Wr(Re(t),()=>{y()}),y()}))}get onWillScroll(){return this.view.onWillScroll}get rowsContainer(){return this.view.containerDomNode}get scrollableElement(){return this.view.scrollableElementDomNode}get viewModel(){return this._viewModel}get visibleRanges(){return this._visibleRanges}set visibleRanges(e){I6e(this._visibleRanges,e)||(this._visibleRanges=e,this._onDidChangeVisibleRanges.fire())}get isDisposed(){return this._isDisposed}get webviewElement(){return this._webviewElement}get inRenderingTransaction(){return this.view.inRenderingTransaction}createListView(e,t,o,n){let r=new VUt(e,t,o,n);return this.viewZones=new HUt(r,this),this.cellOverlays=new UUt(r),r}_getView(){return this.view}attachWebview(e){e.style.top=`-${bhe}px`,this.rowsContainer.insertAdjacentElement("afterbegin",e),this._webviewElement=new cf(e)}elementAt(e){if(!this.view.length)return;let t=this.view.indexAt(e),o=Bn(t,0,this.view.length-1);return this.element(o)}elementHeight(e){let t=this._getViewIndexUpperBound(e);if(t===void 0||t<0||t>=this.length)throw this._getViewIndexUpperBound(e),new sR(this.listUser,`Invalid index ${t}`);return this.view.elementHeight(t)}detachViewModel(){this._viewModelStore.clear(),this._viewModel=null,this.hiddenRangesPrefixSum=null}attachViewModel(e){this._viewModel=e,this._viewModelStore.add(e.onDidChangeViewCells(r=>{if(this._isDisposed)return;this.viewZones.onCellsChanged(r),this.cellOverlays.onCellsChanged(r);let s=this._hiddenRangeIds.map(h=>this._viewModel.getTrackedRange(h)).filter(h=>h!==null),l=UEi(this._viewModel.viewCells,s),c=[],u=new Set;for(let h=0;h<this.length;h++)c.push(this.element(h)),u.add(this.element(h).uri.toString());let p=AQe(c,l,h=>u.has(h.uri.toString()));r.synchronous?this._updateElementsInWebview(p):this._viewModelStore.add(Wr(Re(this.rowsContainer),()=>{this._isDisposed||this._updateElementsInWebview(p)}))})),this._viewModelStore.add(e.onDidChangeSelection(r=>{if(r==="view")return;let s=Yf(e.getSelections()).map(c=>e.cellAt(c)).filter(c=>!!c).map(c=>this._getViewIndexUpperBound(c));this.setSelection(s,void 0,!0);let l=Yf([e.getFocus()]).map(c=>e.cellAt(c)).filter(c=>!!c).map(c=>this._getViewIndexUpperBound(c));l.length&&this.setFocus(l,void 0,!0)}));let t=e.getHiddenRanges();this.setHiddenAreas(t,!1);let o=LF(t),n=e.viewCells.slice(0);o.reverse().forEach(r=>{let s=n.splice(r.start,r.end-r.start+1);this._onDidRemoveCellsFromView.fire(s)}),this.splice2(0,0,n)}_updateElementsInWebview(e){e.reverse().forEach(t=>{let o=[],n=[],r=[];for(let s=t.start;s<t.start+t.deleteCount;s++){let l=this.element(s);l.cellKind===2?this._viewModel.hasCell(l)?o.push(...l?.outputsViewModels):n.push(...l?.outputsViewModels):r.push(l)}this.splice2(t.start,t.deleteCount,t.toInsert),this._onDidHideOutputs.fire(o),this._onDidRemoveOutputs.fire(n),this._onDidRemoveCellsFromView.fire(r)})}clear(){super.splice(0,this.length)}setHiddenAreas(e,t){if(!this._viewModel)return!1;let o=LF(e),n=this._hiddenRangeIds.map(s=>this._viewModel.getTrackedRange(s)).filter(s=>s!==null);if(o.length===n.length){let s=!1;for(let l=0;l<o.length;l++)if(!(o[l].start===n[l].start&&o[l].end===n[l].end)){s=!0;break}if(!s)return this._updateHiddenRangePrefixSum(o),this.viewZones.onHiddenRangesChange(),this.viewZones.layout(),this.cellOverlays.onHiddenRangesChange(),this.cellOverlays.layout(),!1}this._hiddenRangeIds.forEach(s=>this._viewModel.setTrackedRange(s,null,3));let r=o.map(s=>this._viewModel.setTrackedRange(null,s,3)).filter(s=>s!==null);return this._hiddenRangeIds=r,this._updateHiddenRangePrefixSum(o),this.viewZones.onHiddenRangesChange(),this.cellOverlays.onHiddenRangesChange(),t&&this.updateHiddenAreasInView(n,o),this.viewZones.layout(),this.cellOverlays.layout(),!0}_updateHiddenRangePrefixSum(e){let t=0,o=0,n=[];for(;o<e.length;){for(let s=t;s<e[o].start-1;s++)n.push(1);n.push(e[o].end-e[o].start+1+1),t=e[o].end+1,o++}for(let s=t;s<this._viewModel.length;s++)n.push(1);let r=new Uint32Array(n.length);for(let s=0;s<n.length;s++)r[s]=n[s];this.hiddenRangesPrefixSum=new C_(r)}updateHiddenAreasInView(e,t){let o=UEi(this._viewModel.viewCells,e),n=new Set;o.forEach(l=>{n.add(l.uri.toString())});let r=UEi(this._viewModel.viewCells,t),s=AQe(o,r,l=>n.has(l.uri.toString()));this._updateElementsInWebview(s)}splice2(e,t,o=[]){if(e<0||e>this.view.length)return;let n=Gr(this.rowsContainer);super.splice(e,t,o),n&&this.domFocus();let r=[];this.getSelectedElements().forEach(s=>{this._viewModel.hasCell(s)&&r.push(s.handle)}),!r.length&&this._viewModel.viewCells.length&&this._viewModel.updateSelectionsState({kind:1,focus:{start:0,end:1},selections:[{start:0,end:1}]}),this.viewZones.layout(),this.cellOverlays.layout()}getModelIndex(e){let t=this.indexOf(e);return this.getModelIndex2(t)}getModelIndex2(e){return this.hiddenRangesPrefixSum?this.hiddenRangesPrefixSum.getPrefixSum(e-1):e}getViewIndex(e){let t=this._viewModel.getCellIndex(e);return this.getViewIndex2(t)}getViewIndex2(e){if(!this.hiddenRangesPrefixSum)return e;let t=this.hiddenRangesPrefixSum.getIndexOf(e);return t.remainder!==0?e>=this.hiddenRangesPrefixSum.getTotalSum()?e-(this.hiddenRangesPrefixSum.getTotalSum()-this.hiddenRangesPrefixSum.getCount()):void 0:t.index}convertModelIndexToViewIndex(e){return this.hiddenRangesPrefixSum?e>=this.hiddenRangesPrefixSum.getTotalSum()?Math.min(this.length,this.hiddenRangesPrefixSum.getTotalSum()):this.hiddenRangesPrefixSum.getIndexOf(e).index:e}modelIndexIsVisible(e){return this.hiddenRangesPrefixSum&&this.hiddenRangesPrefixSum.getIndexOf(e).remainder!==0?e>=this.hiddenRangesPrefixSum.getTotalSum():!0}_getVisibleRangesFromIndex(e,t,o,n){let r=[],s=[],l=e,c=t;for(;l<=o;){let u=this.hiddenRangesPrefixSum.getPrefixSum(l);u===c+1?(r.length&&(r[r.length-1]===c-1?s.push({start:r[r.length-1],end:c+1}):s.push({start:r[r.length-1],end:r[r.length-1]+1})),r.push(c),l++,c++):(r.length&&(r[r.length-1]===c-1?s.push({start:r[r.length-1],end:c+1}):s.push({start:r[r.length-1],end:r[r.length-1]+1})),r.push(c),l++,c=u)}return r.length&&s.push({start:r[r.length-1],end:r[r.length-1]+1}),LF(s)}getVisibleRangesPlusViewportAboveAndBelow(){if(this.view.length<=0)return[];let e=Math.max(this.getViewScrollTop()-this.renderHeight,0),t=this.view.indexAt(e),o=this.view.element(t),n=this._viewModel.getCellIndex(o),r=Bn(this.getViewScrollBottom()+this.renderHeight,0,this.scrollHeight),s=Bn(this.view.indexAt(r),0,this.view.length-1),l=this.view.element(s),c=this._viewModel.getCellIndex(l);return c-n===s-t?[{start:n,end:c}]:this._getVisibleRangesFromIndex(t,n,s,c)}_getViewIndexUpperBound(e){if(!this._viewModel)return-1;let t=this._viewModel.getCellIndex(e);if(t===-1)return-1;if(!this.hiddenRangesPrefixSum)return t;let o=this.hiddenRangesPrefixSum.getIndexOf(t);return o.remainder!==0&&t>=this.hiddenRangesPrefixSum.getTotalSum()?t-(this.hiddenRangesPrefixSum.getTotalSum()-this.hiddenRangesPrefixSum.getCount()):o.index}_getViewIndexUpperBound2(e){if(!this.hiddenRangesPrefixSum)return e;let t=this.hiddenRangesPrefixSum.getIndexOf(e);return t.remainder!==0&&e>=this.hiddenRangesPrefixSum.getTotalSum()?e-(this.hiddenRangesPrefixSum.getTotalSum()-this.hiddenRangesPrefixSum.getCount()):t.index}focusElement(e){let t=this._getViewIndexUpperBound(e);if(t>=0&&this._viewModel){let o=this.element(t).handle;this._viewModel.updateSelectionsState({kind:0,primary:o,selections:[o]},"view"),this.setFocus([t],void 0,!1)}}selectElements(e){let t=e.map(o=>this._getViewIndexUpperBound(o)).filter(o=>o>=0);this.setSelection(t)}getCellViewScrollTop(e){let t=this._getViewIndexUpperBound(e);if(t===void 0||t<0||t>=this.length)throw new sR(this.listUser,`Invalid index ${t}`);return this.view.elementTop(t)}getCellViewScrollBottom(e){let t=this._getViewIndexUpperBound(e);if(t===void 0||t<0||t>=this.length)throw new sR(this.listUser,`Invalid index ${t}`);let o=this.view.elementTop(t),n=this.view.elementHeight(t);return o+n}setFocus(e,t,o){if(o){super.setFocus(e,t);return}if(e.length){if(this._viewModel){let n=this.element(e[0]).handle;this._viewModel.updateSelectionsState({kind:0,primary:n,selections:this.getSelection().map(r=>this.element(r).handle)},"view")}}else if(this._viewModel){if(this.length)return;this._viewModel.updateSelectionsState({kind:0,primary:null,selections:[]},"view")}super.setFocus(e,t)}setSelection(e,t,o){if(o){super.setSelection(e,t);return}e.length?this._viewModel&&this._viewModel.updateSelectionsState({kind:0,primary:this.getFocusedElements()[0]?.handle??null,selections:e.map(n=>this.element(n)).map(n=>n.handle)},"view"):this._viewModel&&this._viewModel.updateSelectionsState({kind:0,primary:this.getFocusedElements()[0]?.handle??null,selections:[]},"view"),super.setSelection(e,t)}revealCells(e){let t=this._getViewIndexUpperBound2(e.start);if(t<0)return;let o=this._getViewIndexUpperBound2(e.end-1),n=this.getViewScrollTop(),r=this.getViewScrollBottom(),s=this.view.elementTop(t);if(s>=n&&s<r){let l=this.view.elementTop(o),c=this.view.elementHeight(o);if(l+c<=r)return;if(l>=r)return this._revealInternal(o,!1,2);if(l<r)return l+c-r<s-n?this.view.setScrollTop(n+l+c-r):this._revealInternal(t,!1,0)}this._revealInViewWithMinimalScrolling(t)}_revealInViewWithMinimalScrolling(e,t){let o=this.view.firstMostlyVisibleIndex,n=this.view.elementHeight(e);e<=o||!t&&n>=this.view.renderHeight?this._revealInternal(e,!0,0):this._revealInternal(e,!0,2,t)}scrollToBottom(){let e=this.view.scrollHeight,t=this.getViewScrollTop(),o=this.getViewScrollBottom();this.view.setScrollTop(e-(o-t))}async revealCell(e,t){let o=this._getViewIndexUpperBound(e);if(!(o<0)){switch(t){case 2:this._revealInternal(o,!1,0);break;case 3:this._revealInternal(o,!1,1);break;case 4:this._revealInternal(o,!0,1);break;case 5:this._revealInternal(o,!0,3);break;case 6:this._revealInViewWithMinimalScrolling(o,!0);break;case 1:this._revealInViewWithMinimalScrolling(o);break}if((e.getEditState()===1||t===6&&e.cellKind===2)&&!e.editorAttached)return Vtt(e)}}_revealInternal(e,t,o,n){if(e>=this.view.length)return;let r=this.getViewScrollTop(),s=this.getViewScrollBottom(),l=this.view.elementTop(e),c=this.view.elementHeight(e)+l;if(!(t&&l>=r&&c<s))switch(o){case 0:this.view.setScrollTop(l),this.view.setScrollTop(this.view.elementTop(e));break;case 1:case 3:{this.view.setScrollTop(l-this.view.renderHeight/2);let u=this.view.elementTop(e),p=this.view.elementHeight(e),h=this.getViewScrollBottom()-this.getViewScrollTop();p>=h?this.view.setScrollTop(u):o===1?this.view.setScrollTop(u+p/2-h/2):o===3&&this.view.setScrollTop(u-h/5)}break;case 2:if(n){let u=this.viewModel?.layoutInfo?.fontInfo.lineHeight??15,p=this.notebookOptions.getLayoutConfiguration().cellTopMargin+this.notebookOptions.getLayoutConfiguration().editorTopPadding,h=l+u+p;if(h<s)return;this.view.setScrollTop(this.scrollTop+(h-s));break}this.view.setScrollTop(this.scrollTop+(c-s)),this.view.setScrollTop(this.scrollTop+(this.view.elementTop(e)+this.view.elementHeight(e)-this.getViewScrollBottom()));break;default:break}}async revealRangeInCell(e,t,o){let n=this._getViewIndexUpperBound(e);if(!(n<0))switch(o){case 1:return this._revealRangeInternalAsync(n,t);case 2:return this._revealRangeInCenterInternalAsync(n,t);case 3:return this._revealRangeInCenterIfOutsideViewportInternalAsync(n,t)}}async _revealRangeInternalAsync(e,t){let o=this.getViewScrollTop(),n=this.getViewScrollBottom(),r=this.view.elementTop(e),s=this.view.element(e);if(s.editorAttached)this._revealRangeCommon(e,t);else{let l=this.view.elementHeight(e),c;return r+l<=o?(this.view.setScrollTop(r),c="top"):r>=n&&(this.view.setScrollTop(r-this.view.renderHeight/2),c="bottom"),new Promise((p,h)=>{U.once(s.onDidChangeEditorAttachState)(()=>{s.editorAttached?p():h()})}).then(()=>{this._revealRangeCommon(e,t,c)})}}async _revealRangeInCenterInternalAsync(e,t){let o=(l,c)=>{let u=this.view.element(l),p=u.getPositionScrollTopOffset(c),h=this.view.elementTop(l)+p;this.view.setScrollTop(h-this.view.renderHeight/2),u.revealRangeInCenter(c)},r=this.view.elementTop(e);this.view.setScrollTop(r-this.view.renderHeight/2);let s=this.view.element(e);if(s.editorAttached)o(e,t);else return Vtt(s).then(()=>o(e,t))}async _revealRangeInCenterIfOutsideViewportInternalAsync(e,t){let o=(p,h)=>{let g=this.view.element(p),f=g.getPositionScrollTopOffset(h),v=this.view.elementTop(p)+f;this.view.setScrollTop(v-this.view.renderHeight/2),g.revealRangeInCenter(h)},n=this.getViewScrollTop(),r=this.getViewScrollBottom(),l=this.view.elementTop(e),c=this.view.element(e),u=l+c.getPositionScrollTopOffset(t);if(u<n||u>r){this.view.setScrollTop(u-this.view.renderHeight/2);let p=this.view.elementTop(e)+c.getPositionScrollTopOffset(t);if(this.view.setScrollTop(p-this.view.renderHeight/2),!c.editorAttached)return Vtt(c).then(()=>o(e,t))}else if(c.editorAttached)c.revealRangeInCenter(t);else return Vtt(c).then(()=>o(e,t))}_revealRangeCommon(e,t,o){let n=this.view.element(e),r=this.getViewScrollTop(),s=this.getViewScrollBottom(),l=n.getPositionScrollTopOffset(t),c=this.view.elementHeight(e);if(l>=c){let h=n.layoutInfo.totalHeight;this.updateElementHeight(e,h)}let p=this.view.elementTop(e)+l;p<r?this.view.setScrollTop(p-30):p>s?this.view.setScrollTop(r+p-s+30):o==="bottom"?this.view.setScrollTop(r+p-s+30):o==="top"&&this.view.setScrollTop(p-30)}revealCellOffsetInCenter(e,t){let o=this._getViewIndexUpperBound(e);if(o>=0){let n=this.view.element(o),r=this.view.elementTop(o);if(n instanceof Hb)return this._revealInCenterIfOutsideViewport(o);{let s=n.layoutInfo.outputContainerOffset+Math.min(t,n.layoutInfo.outputTotalHeight);this.view.setScrollTop(r-this.view.renderHeight/2),this.view.setScrollTop(r+s-this.view.renderHeight/2)}}}revealOffsetInCenterIfOutsideViewport(e){let t=this.getViewScrollTop(),o=this.getViewScrollBottom();if(e<t||e>o){let n=Math.max(0,e-this.view.renderHeight/2);this.view.setScrollTop(n)}}_revealInCenterIfOutsideViewport(e){this._revealInternal(e,!0,1)}domElementOfElement(e){let t=this._getViewIndexUpperBound(e);return t>=0&&t<this.length?this.view.domElement(t):null}focusView(){this.view.domNode.focus()}triggerScrollFromMouseWheelEvent(e){this.view.delegateScrollFromMouseWheelEvent(e)}delegateVerticalScrollbarPointerDown(e){this.view.delegateVerticalScrollbarPointerDown(e)}isElementAboveViewport(e){return this.view.elementTop(e)+this.view.elementHeight(e)<this.scrollTop}updateElementHeight2(e,t,o=null){let n=this._getViewIndexUpperBound(e);if(n===void 0||n<0||n>=this.length)return;if(this.isElementAboveViewport(n)){let c=this.elementHeight(e)-t;this._webviewElement&&U.once(this.view.onWillScroll)(()=>{let u=parseInt(this._webviewElement.domNode.style.top,10);yJo(this._webviewElement.domNode)?this._webviewElement.setTop(u-c):this._webviewElement.setTop(-bhe)}),this.view.updateElementHeight(n,t,o),this.viewZones.layout(),this.cellOverlays.layout();return}if(o!==null){this.view.updateElementHeight(n,t,o),this.viewZones.layout(),this.cellOverlays.layout();return}let r=this.getFocus(),s=r.length?r[0]:null;if(s){let l=t-this.view.elementHeight(n);if(this._notebookCellAnchor.shouldAnchor(this.view,s,l,this.element(n))){this.view.updateElementHeight(n,t,s),this.viewZones.layout(),this.cellOverlays.layout();return}}this.view.updateElementHeight(n,t,null),this.viewZones.layout(),this.cellOverlays.layout()}changeViewZones(e){this.viewZones.changeViewZones(e)&&this.viewZones.layout()}changeCellOverlays(e){this.cellOverlays.changeCellOverlays(e)&&this.cellOverlays.layout()}getViewZoneLayoutInfo(e){return this.viewZones.getViewZoneLayoutInfo(e)}domFocus(){let e=this.getFocusedElements()[0],t=e&&this.domElementOfElement(e);this.view.domNode.ownerDocument.activeElement&&t&&t.contains(this.view.domNode.ownerDocument.activeElement)||!Ze&&this.view.domNode.ownerDocument.activeElement&&Cg(this.view.domNode.ownerDocument.activeElement,"context-view")||super.domFocus()}focusContainer(e){e&&(this._viewModel?.updateSelectionsState({kind:0,primary:null,selections:[]},"view"),this.setFocus([],void 0,!0),this.setSelection([],void 0,!0)),super.domFocus()}getViewScrollTop(){return this.view.getScrollTop()}getViewScrollBottom(){return this.getViewScrollTop()+this.view.renderHeight}setCellEditorSelection(e,t){let o=e;o.editorAttached?o.setSelection(t):Vtt(o).then(()=>{o.setSelection(t)})}style(e){let t=this.view.domId;this.styleElement||(this.styleElement=Cr(this.view.domNode));let o=t&&`.${t}`,n=[];e.listBackground&&n.push(`.monaco-list${o} > div.monaco-scrollable-element > .monaco-list-rows { background: ${e.listBackground}; }`),e.listFocusBackground&&(n.push(`.monaco-list${o}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused { background-color: ${e.listFocusBackground}; }`),n.push(`.monaco-list${o}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused:hover { background-color: ${e.listFocusBackground}; }`)),e.listFocusForeground&&n.push(`.monaco-list${o}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused { color: ${e.listFocusForeground}; }`),e.listActiveSelectionBackground&&(n.push(`.monaco-list${o}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected { background-color: ${e.listActiveSelectionBackground}; }`),n.push(`.monaco-list${o}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected:hover { background-color: ${e.listActiveSelectionBackground}; }`)),e.listActiveSelectionForeground&&n.push(`.monaco-list${o}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected { color: ${e.listActiveSelectionForeground}; }`),e.listFocusAndSelectionBackground&&n.push(`
				.monaco-drag-image${o},
				.monaco-list${o}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected.focused { background-color: ${e.listFocusAndSelectionBackground}; }
			`),e.listFocusAndSelectionForeground&&n.push(`
				.monaco-drag-image${o},
				.monaco-list${o}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected.focused { color: ${e.listFocusAndSelectionForeground}; }
			`),e.listInactiveFocusBackground&&(n.push(`.monaco-list${o} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused { background-color:  ${e.listInactiveFocusBackground}; }`),n.push(`.monaco-list${o} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused:hover { background-color:  ${e.listInactiveFocusBackground}; }`)),e.listInactiveSelectionBackground&&(n.push(`.monaco-list${o} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected { background-color:  ${e.listInactiveSelectionBackground}; }`),n.push(`.monaco-list${o} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected:hover { background-color:  ${e.listInactiveSelectionBackground}; }`)),e.listInactiveSelectionForeground&&n.push(`.monaco-list${o} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected { color: ${e.listInactiveSelectionForeground}; }`),e.listHoverBackground&&n.push(`.monaco-list${o}:not(.drop-target) > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row:hover:not(.selected):not(.focused) { background-color:  ${e.listHoverBackground}; }`),e.listHoverForeground&&n.push(`.monaco-list${o} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row:hover:not(.selected):not(.focused) { color:  ${e.listHoverForeground}; }`),e.listSelectionOutline&&n.push(`.monaco-list${o} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected { outline: 1px dotted ${e.listSelectionOutline}; outline-offset: -1px; }`),e.listFocusOutline&&n.push(`
				.monaco-drag-image${o},
				.monaco-list${o}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused { outline: 1px solid ${e.listFocusOutline}; outline-offset: -1px; }
			`),e.listInactiveFocusOutline&&n.push(`.monaco-list${o} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused { outline: 1px dotted ${e.listInactiveFocusOutline}; outline-offset: -1px; }`),e.listHoverOutline&&n.push(`.monaco-list${o} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row:hover { outline: 1px dashed ${e.listHoverOutline}; outline-offset: -1px; }`),e.listDropOverBackground&&n.push(`
				.monaco-list${o}.drop-target,
				.monaco-list${o} > div.monaco-scrollable-element > .monaco-list-rows.drop-target,
				.monaco-list${o} > div.monaco-scrollable-element > .monaco-list-row.drop-target { background-color: ${e.listDropOverBackground} !important; color: inherit !important; }
			`);let r=n.join(`
`);r!==this.styleElement.textContent&&(this.styleElement.textContent=r)}getRenderHeight(){return this.view.renderHeight}getScrollHeight(){return this.view.scrollHeight}layout(e,t){this._isInLayout=!0,super.layout(e,t),this.renderHeight===0?this.view.domNode.style.visibility="hidden":this.view.domNode.style.visibility="initial",this._isInLayout=!1}dispose(){this._isDisposed=!0,this._viewModelStore.dispose(),this._localDisposableStore.dispose(),this._notebookCellAnchor.dispose(),this.viewZones.dispose(),this.cellOverlays.dispose(),super.dispose(),this._previousFocusedElements=[],this._viewModel=null,this._hiddenRangeIds=[],this.hiddenRangesPrefixSum=null,this._visibleRanges=[]}};NPe=I([m(7,Io),m(8,B),m(9,F),m(10,bs)],NPe);var zUt=class extends x{constructor(e){super();this.list=e}getViewIndex(e){return this.list.getViewIndex(e)??-1}getViewHeight(e){return this.list.viewModel?this.list.elementHeight(e):-1}getCellRangeFromViewRange(e,t){if(!this.list.viewModel)return;let o=this.list.getModelIndex2(e);if(o===void 0)throw new Error(`startIndex ${e} out of boundary`);if(t>=this.list.length){let n=this.list.viewModel.length;return{start:o,end:n}}else{let n=this.list.getModelIndex2(t);if(n===void 0)throw new Error(`endIndex ${t} out of boundary`);return{start:o,end:n}}}getCellsFromViewRange(e,t){if(!this.list.viewModel)return[];let o=this.getCellRangeFromViewRange(e,t);return o?this.list.viewModel.getCellsInRange(o):[]}getCellsInRange(e){return this.list.viewModel?.getCellsInRange(e)??[]}getVisibleRangesPlusViewportAboveAndBelow(){return this.list?.getVisibleRangesPlusViewportAboveAndBelow()??[]}};function Vtt(a){return new Promise((i,e)=>{U.once(a.onDidChangeEditorAttachState)(()=>a.editorAttached?i():e())})}async function wJo(a){let e=navigator.userAgent.indexOf("Chrome")>=0,t=new TextEncoder,o=new TextDecoder;function n(){let je,we;return{promise:new Promise((Lt,Gt)=>{je=Lt,we=Gt}),resolve:je,reject:we}}let r=a.options,s=a.isWorkspaceTrusted,l=a.renderOptions,c=_n(),u=globalThis.acquireVsCodeApi,p=u();delete globalThis.acquireVsCodeApi;let h=new CSSStyleSheet;h.replaceSync(a.style.tokenizationCss);let g=typeof requestIdleCallback!="function"||typeof cancelIdleCallback!="function"?je=>{setTimeout(()=>{if(we)return;let Ke=Date.now()+15;je(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,Ke-Date.now())}}))});let we=!1;return{dispose(){we||(we=!0)}}}:(je,we)=>{let Ke=requestIdleCallback(je,typeof we=="number"?{timeout:we}:void 0),Lt=!1;return{dispose(){Lt||(Lt=!0,cancelIdleCallback(Ke))}}};function f(je){for(let we of je.composedPath())if(we instanceof HTMLElement&&we.classList.contains("output"))return{id:we.id}}let v,b=je=>{let we=je&&f(je);we&&(v=void 0,setTimeout(()=>{v?.id!==we.id&&Co("outputBlur",we)},0))},S=(je,we=document)=>{let Ke=we.activeElement;return!!(Ke&&je.contains(Ke)&&(Ke.matches(":read-write")||Ke.tagName.toLowerCase()==="select"||Ke.shadowRoot&&S(Ke.shadowRoot,Ke.shadowRoot)))},y=je=>{v=f(je);let we=window.document.activeElement;if(!we)return;let Ke=v?.id;Ke&&S(we,window.document)&&(Co("outputInputFocus",{inputFocused:!0,id:Ke}),we.addEventListener("blur",()=>{Co("outputInputFocus",{inputFocused:!1,id:Ke})},{once:!0}))},w=je=>{if(!je||!je.view||!je.view.document)return;let we=v=f(je);for(let Ke of je.composedPath())if(Ke instanceof HTMLAnchorElement&&Ke.href){if(Ke.href.startsWith("blob:"))we&&Co("outputFocus",we),G(Ke.href,Ke.download);else if(Ke.href.startsWith("data:"))we&&Co("outputFocus",we),H(Ke.href,Ke.download);else if(Ke.getAttribute("href")?.trim().startsWith("#")){if(!Ke.hash){Co("scroll-to-reveal",{scrollTop:0});return}let Lt=Ke.hash.substring(1),Gt=je.view.document.getElementById(Lt);if(!Gt){for(let Ro of je.view.document.querySelectorAll(".preview"))if(Gt=Ro.shadowRoot?.getElementById(Lt),Gt)break}if(Gt){let Ro=Gt.getBoundingClientRect().top+je.view.scrollY;Co("scroll-to-reveal",{scrollTop:Ro});return}}else{let Lt=Ke.getAttribute("href");Lt&&(Lt.startsWith("command:")&&we&&Co("outputFocus",we),Co("clicked-link",{href:Lt}))}je.preventDefault(),je.stopPropagation();return}we&&Co("outputFocus",we)},k=()=>{let je=window.getSelection();je&&je.removeAllRanges()},T=je=>{let we=window.getSelection();if(!we)return;let Ke=window.document.getElementById(je);if(!Ke)return;we.removeAllRanges();let Lt=document.createRange();Lt.selectNode(Ke),we.addRange(Lt)},P=je=>{if(!window.document.getElementById(je))return;let Ke=window.document.activeElement;Ke&&S(Ke,window.document)&&Ke.select()},O=je=>{if(!v?.id||!je.shiftKey)return;if(je.shiftKey&&(je.code==="ArrowUp"||je.code==="ArrowDown")){je.stopPropagation();return}if(!(je.code==="PageUp"||je.code==="PageDown")&&!(je.metaKey&&(je.code==="ArrowDown"||je.code==="ArrowUp")))return;let we=window.document.getElementById(v.id),Ke=window.getSelection();if(!we||!Ke?.anchorNode)return;let Lt=window.document.activeElement;if(Lt&&S(Lt,window.document))return;je.stopPropagation(),je.preventDefault();let{anchorNode:Gt,anchorOffset:Ro}=Ke,so=document.createRange();je.code==="PageDown"||je.code==="ArrowDown"?(so.setStart(Gt,Ro),so.setEnd(we,1)):(so.setStart(we,0),so.setEnd(Gt,Ro)),Ke.removeAllRanges(),Ke.addRange(so)},V=je=>{if(!v?.id)return;let we=window.document.activeElement;if(!(we&&S(we,window.document))&&(je.key==="a"&&je.ctrlKey||je.metaKey&&je.key==="a")){je.preventDefault();return}},H=async(je,we)=>{Co("clicked-data-url",{data:je,downloadName:we})},G=async(je,we)=>{try{let Lt=await(await fetch(je)).blob(),Gt=new FileReader;Gt.addEventListener("load",()=>{H(Gt.result,we)}),Gt.readAsDataURL(Lt)}catch(Ke){console.error(Ke.message)}};window.document.body.addEventListener("click",w),window.document.body.addEventListener("focusin",y),window.document.body.addEventListener("focusout",b),window.document.body.addEventListener("keydown",O),window.document.body.addEventListener("keydown",V);function $(){return Object.freeze({onDidReceiveKernelMessage:cn.event,postKernelMessage:je=>Co("customKernelMessage",{message:je})})}async function J(je){try{return await ae(je)}catch(we){throw console.error(we),we}}async function ae(je){let we=await __import(je);if(!we.activate){console.error(`Notebook preload '${je}' was expected to be a module but it does not export an 'activate' function`);return}return we.activate($())}let he=new class{constructor(){this.pending=new Map}updateHeight(je,we,Ke){this.pending.size||setTimeout(()=>{this.updateImmediately()},0);let Lt=this.pending.get(je);Lt&&Lt.isOutput?this.pending.set(je,{id:je,height:we,init:Lt.init,isOutput:Lt.isOutput}):this.pending.set(je,{id:je,height:we,...Ke})}updateImmediately(){this.pending.size&&(Co("dimension",{updates:Array.from(this.pending.values())}),this.pending.clear())}};function oe(je){return je>2.1}let de=new class{constructor(){this._observedElements=new WeakMap;this._observer=new ResizeObserver(je=>{for(let we of je){if(!window.document.body.contains(we.target))continue;let Ke=this._observedElements.get(we.target);if(!Ke||(this.postResizeMessage(Ke.cellId),we.target.id!==Ke.id)||!we.contentRect)continue;if(!Ke.output){this.updateHeight(Ke,we.target.offsetHeight);continue}let Lt=oe(we.contentRect.height);Lt&&Ke.lastKnownPadding===0||!Lt&&Ke.lastKnownPadding!==0?window.requestAnimationFrame(()=>{Lt?we.target.style.padding=`${a.style.outputNodePadding}px ${a.style.outputNodePadding}px ${a.style.outputNodePadding}px ${a.style.outputNodeLeftPadding}px`:we.target.style.padding="0px",this.updateHeight(Ke,Lt?we.target.offsetHeight:0)}):this.updateHeight(Ke,Lt?we.target.offsetHeight:0)}})}updateHeight(je,we){je.lastKnownHeight!==we&&(je.lastKnownHeight=we,he.updateHeight(je.id,we,{isOutput:je.output}))}observe(je,we,Ke,Lt){this._observedElements.has(je)||(this._observedElements.set(je,{id:we,output:Ke,lastKnownPadding:a.style.outputNodePadding,lastKnownHeight:-1,cellId:Lt}),this._observer.observe(je))}postResizeMessage(je){clearTimeout(this._outputResizeTimer),this._outputResizeTimer=setTimeout(()=>{Co("outputResized",{cellId:je})},250)}},Ce,xe,ze,De;function Oe(je,we){if(ze=je,we===void 0)return De=Date.now(),Ce=void 0,je.setAttribute("recentlyScrolled","true"),clearTimeout(xe),xe=setTimeout(()=>{ze?.removeAttribute("recentlyScrolled")},300),!0;if(je.hasAttribute("recentlyScrolled")){if(De&&Date.now()-De>400){if(Ce&&we<0&&we<Ce-8)return clearTimeout(xe),ze?.removeAttribute("recentlyScrolled"),!1;if(Ce&&we>0&&we>Ce+8)return clearTimeout(xe),ze?.removeAttribute("recentlyScrolled"),!1;clearTimeout(xe),xe=setTimeout(()=>{ze?.removeAttribute("recentlyScrolled")},50)}else clearTimeout(xe),xe=setTimeout(()=>{ze?.removeAttribute("recentlyScrolled")},300);return Ce=we,!0}return!1}function pt(je){for(let we=je.target;we;we=we.parentNode){if(!(we instanceof Element)||we.id==="container"||we.classList.contains("cell_container")||we.classList.contains("markup")||we.classList.contains("output_container"))return!1;if(je.deltaY<0&&we.scrollTop>0)return Oe(we),!0;if(je.deltaY>0&&we.scrollTop+we.clientHeight<we.scrollHeight){if(we.scrollHeight-we.scrollTop-we.clientHeight<2||window.getComputedStyle(we).overflowY==="hidden"||window.getComputedStyle(we).overflowY==="visible")continue;return Oe(we),!0}if(Oe(we,je.deltaY))return!0}return!1}let et=je=>{je.defaultPrevented||pt(je)||Co("did-scroll-wheel",{payload:{deltaMode:je.deltaMode,deltaX:je.deltaX,deltaY:je.deltaY,deltaZ:je.deltaZ,wheelDelta:je.wheelDelta&&e?je.wheelDelta/window.devicePixelRatio:je.wheelDelta,wheelDeltaX:je.wheelDeltaX&&e?je.wheelDeltaX/window.devicePixelRatio:je.wheelDeltaX,wheelDeltaY:je.wheelDeltaY&&e?je.wheelDeltaY/window.devicePixelRatio:je.wheelDeltaY,detail:je.detail,shiftKey:je.shiftKey,type:je.type}})};function Ti(je,we){let Ke=window.document.getElementById(je)??(we?window.document.getElementById(we):void 0);if(Ke){if(Ke.contains(window.document.activeElement))return;let Lt=Ke.querySelector('[tabindex="0"], [href], button, input, option, select, textarea');Lt||(Lt=Ke,Lt.tabIndex=-1),v?.id!==Ke.id&&(v=Ke,Co("outputFocus",{id:Ke.id})),Lt.focus()}}function Ht(je,we){let Ke=document.createElement("div");return Ke.id=`focus-sink-${je}`,Ke.tabIndex=0,Ke.addEventListener("focus",()=>{Co("focus-editor",{cellId:je,focusNext:we})}),Ke}function zi(je,we="mark",Ke={}){function Lt(Hr){if(!Hr.startContainer.ownerDocument)return[];if(Hr.startContainer.nodeType===Node.TEXT_NODE&&Hr.startOffset>0){let cC=Hr.startContainer,Mse=Hr.endOffset,g$=cC.splitText(Hr.startOffset);Hr.endContainer===cC&&Hr.setEnd(g$,Mse-Hr.startOffset),Hr.setStart(g$,0)}Hr.endContainer.nodeType===Node.TEXT_NODE&&Hr.endOffset<Hr.endContainer.length&&Hr.endContainer.splitText(Hr.endOffset);let ll=Hr.startContainer.ownerDocument.createTreeWalker(Hr.commonAncestorContainer,NodeFilter.SHOW_TEXT,cC=>Hr.intersectsNode(cC)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT);ll.currentNode=Hr.startContainer;let Ao=[];for(ll.currentNode.nodeType===Node.TEXT_NODE&&Ao.push(ll.currentNode);ll.nextNode()&&Hr.comparePoint(ll.currentNode,0)!==1;)ll.currentNode.nodeType===Node.TEXT_NODE&&Ao.push(ll.currentNode);return Ao}function Gt(Hr,ll,Ao){let cC=Hr.ownerDocument.createElement(ll);Object.keys(Ao).forEach(g$=>{cC.setAttribute(g$,Ao[g$])});let Mse=Hr.ownerDocument.createRange();return Mse.selectNode(Hr),Mse.surroundContents(cC),cC}if(je.collapsed)return{remove:()=>{},update:()=>{}};let Ro=Lt(je),so=[];for(let Hr in Ro){let ll=Gt(Ro[Hr],we,Ke);so.push(ll)}function Pr(Hr){if(Hr.childNodes.length===1)Hr.replaceWith(Hr.firstChild);else{for(;Hr.firstChild;)Hr.parentNode?.insertBefore(Hr.firstChild,Hr);Hr.remove()}}function Is(){for(let Hr in so)Pr(so[Hr])}function Qr(Hr,ll={}){Object.keys(ll).forEach(Ao=>{Hr.setAttribute(Ao,ll[Ao])})}function Ta(Hr){for(let ll in so)Qr(so[ll],Hr)}return{remove:Is,update:Ta}}function Vo(je){let we=window.getSelection();if(we)try{we.removeAllRanges();let Ke=document.createRange();Ke.setStart(je.startContainer,je.startOffset),Ke.setEnd(je.endContainer,je.endOffset),we.addRange(Ke)}catch(Ke){console.log(Ke)}}function sn(je,we,Ke="mark",Lt={}){if(we){let Gt=zi(je,Ke,Lt);return{range:je,dispose:Gt.remove,update:(Ro,so)=>{so===void 0?Gt.update({style:`background-color: ${Ro}`}):Gt.update({class:so})}}}else{window.document.execCommand("hiliteColor",!1,Ns);let Gt=window.getSelection().getRangeAt(0).cloneRange(),Ro={collapsed:Gt.collapsed,commonAncestorContainer:Gt.commonAncestorContainer,endContainer:Gt.endContainer,endOffset:Gt.endOffset,startContainer:Gt.startContainer,startOffset:Gt.startOffset};return{range:Ro,dispose:()=>{Vo(Ro);try{document.designMode="On",window.document.execCommand("removeFormat",!1,void 0),document.designMode="Off",window.getSelection()?.removeAllRanges()}catch(so){console.log(so)}},update:(so,Pr)=>{Vo(Ro);try{document.designMode="On",window.document.execCommand("removeFormat",!1,void 0),window.document.execCommand("hiliteColor",!1,so),document.designMode="Off",window.getSelection()?.removeAllRanges()}catch(Is){console.log(Is)}}}}}function _n(je=()=>{}){let we=new Set;return{fire(Ke){for(let Lt of[...we])Lt.fn.call(Lt.thisArg,Ke)},event(Ke,Lt,Gt){let Ro={fn:Ke,thisArg:Lt},so={dispose:()=>{we.delete(Ro),je(we)}};return we.add(Ro),je(we),Gt instanceof Array?Gt.push(so):Gt&&Gt.add(so),so}}}function mn(je,we,Ke){we.innerText=je;let Lt=document.createElement("ul");for(let Gt of Ke){console.error(Gt);let Ro=document.createElement("li");Ro.innerText=Gt.message,Lt.appendChild(Ro)}we.appendChild(Lt)}let hn=new class{constructor(){this._requestPool=0;this._requests=new Map}getOutputItem(je,we){let Ke=this._requestPool++,{promise:Lt,resolve:Gt}=n();return this._requests.set(Ke,{resolve:Gt}),Co("getOutputItem",{requestId:Ke,outputId:je,mime:we}),Lt}resolveOutputItem(je,we){let Ke=this._requests.get(je);Ke&&(this._requests.delete(je),Ke.resolve(we))}},yo=!1;function Mr(je,we,Ke,Lt,Gt,Ro){function so(Ta,Hr,ll,Ao,cC){return Object.freeze({id:Ta,mime:Hr,metadata:ll,appendedText(){if(cC)return o.decode(cC.valueBytes)},data(){return Ao},text(){return o.decode(Ao)},json(){return JSON.parse(this.text())},blob(){return new Blob([Ao],{type:this.mime})},get _allOutputItems(){return yo||(yo=!0,console.warn("'_allOutputItems' is proposed API. DO NOT ship an extension that depends on it!")),Is}})}let Pr=new Map,Is=Object.freeze(Gt.map(Ta=>{let Hr=Ta.mime;return Object.freeze({mime:Hr,getItem(){let ll=Pr.get(Hr);if(ll)return ll;let Ao=hn.getOutputItem(je,Hr).then(cC=>cC?so(je,cC.mime,Ke,cC.valueBytes):void 0);return Pr.set(Hr,Ao),Ao}})})),Qr=so(je,we,Ke,Lt,Ro);return Pr.set(we,Promise.resolve(Qr)),Qr}let cn=_n(),er=window.trustedTypes?.createPolicy("notebookRenderer",{createHTML:je=>je,createScript:je=>je});window.addEventListener("wheel",et);let Ns=window.getComputedStyle(window.document.getElementById("_defaultColorPalatte")).color,ua=window.getComputedStyle(window.document.getElementById("_defaultColorPalatte")).backgroundColor;class xm{constructor(){this._activeHighlightInfo=new Map}addHighlights(we,Ke){for(let Gt=we.length-1;Gt>=0;Gt--){let Ro=we[Gt],so=sn(Ro.originalRange,!0,"mark",Ro.isShadow?{style:"background-color: "+Ns+";"}:{class:"find-match"});Ro.highlightResult=so}let Lt={matches:we,currentMatchIndex:-1};this._activeHighlightInfo.set(Ke,Lt)}removeHighlights(we){this._activeHighlightInfo.get(we)?.matches.forEach(Ke=>{Ke.highlightResult?.dispose()}),this._activeHighlightInfo.delete(we)}highlightCurrentMatch(we,Ke){let Lt=this._activeHighlightInfo.get(Ke);if(!Lt){console.error("Modified current highlight match before adding highlight list.");return}let Gt=Lt.matches[Lt.currentMatchIndex];Gt?.highlightResult?.update(Ns,Gt.isShadow?void 0:"find-match");let Ro=Lt.matches[we];Lt.currentMatchIndex=we;let so=window.getSelection();if(Ro&&so&&Ro.highlightResult){let Pr=0;try{let Is=window.document.getElementById(Ro.id).getBoundingClientRect().top,Qr=document.createRange();Qr.selectNode(Ro.highlightResult.range.startContainer),Ro.highlightResult.range.startContainer.parentElement?.scrollIntoView({behavior:"auto",block:"end",inline:"nearest"});let Ta=Qr.getBoundingClientRect().top;Qr.detach(),Pr=Ta-Is}catch(Is){console.error(Is)}Ro.highlightResult?.update(ua,Ro.isShadow?void 0:"current-find-match"),window.document.getSelection()?.removeAllRanges(),Co("didFindHighlightCurrent",{offset:Pr})}}unHighlightCurrentMatch(we,Ke){let Lt=this._activeHighlightInfo.get(Ke);if(!Lt)return;let Gt=Lt.matches[we];Gt&&Gt.highlightResult&&Gt.highlightResult.update(Ns,Gt.isShadow?void 0:"find-match")}dispose(){window.document.getSelection()?.removeAllRanges(),this._activeHighlightInfo.forEach(we=>{we.matches.forEach(Ke=>{Ke.highlightResult?.dispose()})})}}class tm{constructor(){this._activeHighlightInfo=new Map,this._matchesHighlight=new Highlight,this._matchesHighlight.priority=1,this._currentMatchesHighlight=new Highlight,this._currentMatchesHighlight.priority=2,CSS.highlights?.set("find-highlight",this._matchesHighlight),CSS.highlights?.set("current-find-highlight",this._currentMatchesHighlight)}_refreshRegistry(we=!0){we&&this._matchesHighlight.clear(),this._currentMatchesHighlight.clear(),this._activeHighlightInfo.forEach(Ke=>{if(we)for(let Lt=0;Lt<Ke.matches.length;Lt++)this._matchesHighlight.add(Ke.matches[Lt].originalRange);Ke.currentMatchIndex<Ke.matches.length&&Ke.currentMatchIndex>=0&&this._currentMatchesHighlight.add(Ke.matches[Ke.currentMatchIndex].originalRange)})}addHighlights(we,Ke){for(let Gt=0;Gt<we.length;Gt++)this._matchesHighlight.add(we[Gt].originalRange);let Lt={matches:we,currentMatchIndex:-1};this._activeHighlightInfo.set(Ke,Lt)}highlightCurrentMatch(we,Ke){let Lt=this._activeHighlightInfo.get(Ke);if(!Lt){console.error("Modified current highlight match before adding highlight list.");return}Lt.currentMatchIndex=we;let Gt=Lt.matches[we];if(Gt){let Ro=0;try{let so=window.document.getElementById(Gt.id).getBoundingClientRect().top;Gt.originalRange.startContainer.parentElement?.scrollIntoView({behavior:"auto",block:"end",inline:"nearest"}),Ro=Gt.originalRange.getBoundingClientRect().top-so,Co("didFindHighlightCurrent",{offset:Ro})}catch(so){console.error(so)}}this._refreshRegistry(!1)}unHighlightCurrentMatch(we,Ke){let Lt=this._activeHighlightInfo.get(Ke);Lt&&(Lt.currentMatchIndex=-1)}removeHighlights(we){this._activeHighlightInfo.delete(we),this._refreshRegistry()}dispose(){window.document.getSelection()?.removeAllRanges(),this._currentMatchesHighlight.clear(),this._matchesHighlight.clear()}}let Lu=CSS.highlights?new tm:new xm;function jg(je){let Ke=je.getRangeAt(0).cloneRange(),Lt=je.toString().length;je.collapseToStart(),je.modify("move","backward","lineboundary"),je.modify("extend","forward","lineboundary");let Gt=je.toString(),Ro=Ir(je.getRangeAt(0),Ke),so={start:Ro,end:Ro+Lt};return je.removeAllRanges(),je.addRange(Ke),{line:Gt,range:so}}function Ir(je,we){let Ke=Lx(je.startContainer,we.startContainer),Lt=lC(Ke,je.startContainer)+je.startOffset;return lC(Ke,we.startContainer)+we.startOffset-Lt}function Lx(je,we){let Ke=new Range;return Ke.setStart(je,0),Ke.setEnd(we,0),Ke.commonAncestorContainer}function Qg(je){let we=0;if(je.nodeType===Node.TEXT_NODE)we+=je.textContent?.length||0;else for(let Ke of je.childNodes)we+=Qg(Ke);return we}function lC(je,we){if(!we)return 0;let Ke=0;if(we===je||!je.contains(we))return Ke;let Lt=we.previousSibling;for(;Lt;)Ke+=Qg(Lt),Lt=Lt.previousSibling;return Ke+lC(je,we.parentNode)}let Op=(je,we)=>{let Ke=!0,Lt=[],Gt=document.createRange();Gt.selectNodeContents(window.document.getElementById("findStart"));let Ro=window.getSelection();Ro?.removeAllRanges(),Ro?.addRange(Gt),Mi.toggleDragDropEnabled(!1);try{for(document.designMode="On";Ke&&Lt.length<500;)if(Ke=window.find(je,!!we.caseSensitive,!1,!1,!!we.wholeWord,!0,!1),Ke){let so=window.getSelection();if(!so){console.log("no selection");break}if(we.includeMarkup&&so.rangeCount>0&&so.getRangeAt(0).startContainer.nodeType===1&&so.getRangeAt(0).startContainer.classList.contains("markup")){let Is=so.anchorNode?.firstChild,Qr=Is.shadowRoot,Ta=Qr?.getSelection?Qr?.getSelection():null;Ta&&Ta.anchorNode&&Lt.push({type:"preview",id:Is.id,cellId:Is.id,container:Is,isShadow:!0,originalRange:Ta.getRangeAt(0),searchPreviewInfo:we.shouldGetSearchPreviewInfo?jg(Ta):void 0})}if(we.includeOutput&&so.rangeCount>0&&so.getRangeAt(0).startContainer.nodeType===1&&so.getRangeAt(0).startContainer.classList.contains("output_container")){let Is=so.getRangeAt(0).startContainer.parentElement.id,Qr=so.anchorNode?.firstChild,Ta=Qr.shadowRoot,Hr=Ta?.getSelection?Ta?.getSelection():null;Hr&&Hr.anchorNode&&Lt.push({type:"output",id:Qr.id,cellId:Is,container:Qr,isShadow:!0,originalRange:Hr.getRangeAt(0),searchPreviewInfo:we.shouldGetSearchPreviewInfo?jg(Hr):void 0})}let Pr=so.anchorNode?.parentElement;if(Pr){let Is=Lt.length?Lt[Lt.length-1]:null;if(Is&&Is.container.contains(Pr)&&we.includeOutput)Lt.push({type:Is.type,id:Is.id,cellId:Is.cellId,container:Is.container,isShadow:!1,originalRange:so.getRangeAt(0),searchPreviewInfo:we.shouldGetSearchPreviewInfo?jg(so):void 0});else for(let Qr=Pr;Qr&&Qr instanceof Element;Qr=Qr.parentElement){if(Qr.classList.contains("output")&&we.includeOutput){let Ta=Qr.parentElement?.parentElement?.id;Ta&&Lt.push({type:"output",id:Qr.id,cellId:Ta,container:Qr,isShadow:!1,originalRange:so.getRangeAt(0),searchPreviewInfo:we.shouldGetSearchPreviewInfo?jg(so):void 0});break}if(Qr.id==="container"||Qr===window.document.body)break}}else break}}catch(so){console.log(so)}Lt=Lt.filter(so=>we.findIds.length?we.findIds.includes(so.cellId):!0),Lu.addHighlights(Lt,we.ownerID),window.document.getSelection()?.removeAllRanges(),Mi.toggleDragDropEnabled(r.dragAndDropEnabled),document.designMode="Off",Co("didFind",{matches:Lt.map((so,Pr)=>({type:so.type,id:so.id,cellId:so.cellId,index:Pr,searchPreviewInfo:so.searchPreviewInfo}))})},Af=async(je,we,Ke,Lt=5)=>{if(!window.document.hasFocus()&&Lt>0){setTimeout(()=>{Af(je,we,Ke,Lt-1)},50);return}try{let Gt=window.document.getElementById(je)??window.document.getElementById(we),Ro=Gt?.querySelector("img");if(!Ro){let so=Gt?.querySelector("svg.output-image")??Gt?.querySelector("div.svgContainerStyle > svg");so&&(Ro=new Image,Ro.src="data:image/svg+xml,"+encodeURIComponent(so.outerHTML))}if(Ro){let Pr=await(Qr=>new Promise((Ta,Hr)=>{Qr.complete&&Qr.naturalWidth>0?Ta(Qr):(Qr.onload=()=>Ta(Qr),Qr.onerror=()=>Hr(new Error("Failed to load image")),setTimeout(()=>Hr(new Error("Image load timeout")),5e3))}))(Ro),Is={"image/png":new Promise(Qr=>{let Ta=document.createElement("canvas");Ta.width=Pr.naturalWidth,Ta.height=Pr.naturalHeight,Ta.getContext("2d").drawImage(Pr,0,0),Ta.toBlob(ll=>{ll?Qr(ll):console.error("No blob data to write to clipboard"),Ta.remove()},"image/png")})};if(Ke)for(let Qr of Ke)Is[Qr.mimeType]=Qr.content;await navigator.clipboard.write([new ClipboardItem(Is)])}else console.error("Could not find image element to copy for output with id",je)}catch(Gt){console.error("Could not copy image:",Gt)}};window.addEventListener("message",async je=>{let we=je;switch(we.data.type){case"initializeMarkup":{try{await Promise.all(we.data.cells.map(Ke=>Mi.ensureMarkupCell(Ke)))}finally{he.updateImmediately(),Co("initializedMarkup",{requestId:we.data.requestId})}break}case"createMarkupCell":Mi.ensureMarkupCell(we.data.cell);break;case"showMarkupCell":Mi.showMarkupCell(we.data.id,we.data.top,we.data.content,we.data.metadata);break;case"hideMarkupCells":for(let Ke of we.data.ids)Mi.hideMarkupCell(Ke);break;case"unhideMarkupCells":for(let Ke of we.data.ids)Mi.unhideMarkupCell(Ke);break;case"deleteMarkupCell":for(let Ke of we.data.ids)Mi.deleteMarkupCell(Ke);break;case"updateSelectedMarkupCells":Mi.updateSelectedCells(we.data.selectedCellIds);break;case"html":{let Ke=we.data;Ke.createOnIdle?LI.enqueueIdle(Ke.outputId,Lt=>Mi.renderOutputCell(Ke,Lt)):LI.enqueue(Ke.outputId,Lt=>Mi.renderOutputCell(Ke,Lt));break}case"view-scroll":{we.data.widgets.forEach(Ke=>{LI.enqueue(Ke.outputId,()=>{Mi.updateOutputsScroll([Ke])})}),Mi.updateMarkupScrolls(we.data.markupCells);break}case"clear":jt.clearAll(),Mi.clearAll(),window.document.getElementById("container").innerText="";break;case"clearOutput":{let{cellId:Ke,rendererId:Lt,outputId:Gt}=we.data;LI.cancelOutput(Gt),Mi.clearOutput(Ke,Gt,Lt);break}case"hideOutput":{let{cellId:Ke,outputId:Lt}=we.data;LI.enqueue(Lt,()=>{Mi.hideOutput(Ke)});break}case"showOutput":{let{outputId:Ke,cellTop:Lt,cellId:Gt,content:Ro}=we.data;LI.enqueue(Ke,()=>{Mi.showOutput(Gt,Ke,Lt),Ro&&Mi.updateAndRerender(Gt,Ke,Ro)});break}case"copyImage":{await Af(we.data.outputId,we.data.altOutputId,we.data.textAlternates);break}case"ack-dimension":{for(let{cellId:Ke,outputId:Lt,height:Gt}of we.data.updates)Mi.updateOutputHeight(Ke,Lt,Gt);break}case"preload":{let Ke=we.data.resources;for(let{uri:Lt}of Ke)Rx.load(Lt);break}case"updateRenderers":{let{rendererData:Ke}=we.data;jt.updateRendererData(Ke);break}case"focus-output":Ti(we.data.cellOrOutputId,we.data.alternateId);break;case"blur-output":k();break;case"select-output-contents":T(we.data.cellOrOutputId);break;case"select-input-contents":P(we.data.cellOrOutputId);break;case"decorations":{let Ke=window.document.getElementById(we.data.cellId);Ke||(Mi.ensureOutputCell(we.data.cellId,-1e5,!0),Ke=window.document.getElementById(we.data.cellId)),Ke?.classList.add(...we.data.addedClassNames),Ke?.classList.remove(...we.data.removedClassNames);break}case"markupDecorations":{let Ke=window.document.getElementById(we.data.cellId);Ke&&(Ke?.classList.add(...we.data.addedClassNames),Ke?.classList.remove(...we.data.removedClassNames));break}case"customKernelMessage":cn.fire(we.data.message);break;case"customRendererMessage":jt.getRenderer(we.data.rendererId)?.receiveMessage(we.data.message);break;case"notebookStyles":{let Ke=window.document.documentElement.style;for(let Lt=Ke.length-1;Lt>=0;Lt--){let Gt=Ke[Lt];Gt&&Gt.startsWith("--notebook-")&&Ke.removeProperty(Gt)}for(let[Lt,Gt]of Object.entries(we.data.styles))Ke.setProperty(`--${Lt}`,Gt);break}case"notebookOptions":r=we.data.options,Mi.toggleDragDropEnabled(r.dragAndDropEnabled),l=we.data.renderOptions,c.fire(l);break;case"tokenizedCodeBlock":{let{codeBlockId:Ke,html:Lt}=we.data;no.highlightCodeBlock(Ke,Lt);break}case"tokenizedStylesChanged":{h.replaceSync(we.data.css);break}case"find":{Lu.removeHighlights(we.data.options.ownerID),Op(we.data.query,we.data.options);break}case"findHighlightCurrent":{Lu?.highlightCurrentMatch(we.data.index,we.data.ownerID);break}case"findUnHighlightCurrent":{Lu?.unHighlightCurrentMatch(we.data.index,we.data.ownerID);break}case"findStop":{Lu.removeHighlights(we.data.ownerID);break}case"returnOutputItem":hn.resolveOutputItem(we.data.requestId,we.data.output)}});let h$="vscode.fallbackToNextRenderer";class C9{constructor(we){this.data=we;this._onMessageEvent=_n()}receiveMessage(we){this._onMessageEvent.fire(we)}async renderOutputItem(we,Ke,Lt){try{await this.load()}catch(Gt){Lt.aborted||mn(`Error loading renderer '${this.data.id}'`,Ke,Gt instanceof Error?[Gt]:[]);return}if(!this._api){Lt.aborted||mn(`Renderer '${this.data.id}' does not implement renderOutputItem`,Ke,[]);return}try{let Gt=performance.now();await this._api.renderOutputItem(we,Ke,Lt),this.postDebugMessage("Rendered output item",{id:we.id,duration:`${performance.now()-Gt}ms`})}catch(Gt){if(Lt.aborted)return;if(Gt instanceof Error&&Gt.name===h$)throw Gt;mn(`Error rendering output item using '${this.data.id}'`,Ke,Gt instanceof Error?[Gt]:[]),this.postDebugMessage("Rendering output item failed",{id:we.id,error:Gt+""})}}disposeOutputItem(we){this._api?.disposeOutputItem?.(we)}createRendererContext(){let{id:we,messaging:Ke}=this.data,Lt={setState:Gt=>p.setState({...p.getState(),[we]:Gt}),getState:()=>{let Gt=p.getState();return typeof Gt=="object"&&Gt?Gt[we]:void 0},getRenderer:async Gt=>{let Ro=jt.getRenderer(Gt);if(Ro)return Ro._api?Ro._api:Ro.load()},workspace:{get isTrusted(){return s}},settings:{get lineLimit(){return l.lineLimit},get outputScrolling(){return l.outputScrolling},get outputWordWrap(){return l.outputWordWrap},get linkifyFilePaths(){return l.linkifyFilePaths},get minimalError(){return l.minimalError}},get onDidChangeSettings(){return c.event}};return Ke&&(Lt.onDidReceiveMessage=this._onMessageEvent.event,Lt.postMessage=Gt=>Co("customRendererMessage",{rendererId:we,message:Gt})),Object.freeze(Lt)}load(){return this._loadPromise??=this._load(),this._loadPromise}async _load(){this.postDebugMessage("Start loading renderer");try{await Rx.waitForAllCurrent();let we=performance.now(),Ke=await __import(this.data.entrypoint.path);if(this.postDebugMessage("Imported renderer",{duration:`${performance.now()-we}ms`}),!Ke)return;this._api=await Ke.activate(this.createRendererContext()),this.postDebugMessage("Activated renderer",{duration:`${performance.now()-we}ms`});let Lt=a.rendererData.filter(Gt=>Gt.entrypoint.extends===this.data.id);return Lt.length&&this.postDebugMessage("Activating dependant renderers",{dependents:Lt.map(Gt=>Gt.id).join(", ")}),await Promise.all(Lt.map(async Gt=>{let Ro=jt.getRenderer(Gt.id);if(!Ro)throw new Error(`Could not find extending renderer: ${Gt.id}`);try{return await Ro.load()}catch(so){console.error(so),this.postDebugMessage("Activating dependant renderer failed",{dependent:Gt.id,error:so+""});return}})),this._api}catch(we){throw this.postDebugMessage("Loading renderer failed"),we}}postDebugMessage(we,Ke){Co("logRendererDebugMessage",{message:`[renderer ${this.data.id}] - ${we}`,data:Ke})}}let Rx=new class{constructor(){this.preloads=new Map}waitFor(je){return this.preloads.get(je)||Promise.resolve(new Error(`Preload not ready: ${je}`))}load(je){let we=Promise.all([J(je),this.waitForAllCurrent()]);return this.preloads.set(je,we),we}waitForAllCurrent(){return Promise.all([...this.preloads.values()].map(je=>je.catch(we=>we)))}},LI=new class{constructor(){this.outputs=new Map;this.pendingOutputCreationRequest=new Map}enqueue(je,we){this.pendingOutputCreationRequest.get(je)?.dispose(),this.pendingOutputCreationRequest.delete(je);let Ke=this.outputs.get(je);if(Ke)Ke.queue=Ke.queue.then(async Lt=>{Ke.abort.signal.aborted||await we(Ke.abort.signal)});else{let Lt=new AbortController;this.outputs.set(je,{abort:Lt,queue:new Promise(Gt=>Gt(we(Lt.signal)))})}}enqueueIdle(je,we){this.pendingOutputCreationRequest.get(je)?.dispose(),LI.pendingOutputCreationRequest.set(je,g(()=>{LI.enqueue(je,we),LI.pendingOutputCreationRequest.delete(je)}))}cancelAll(){this.pendingOutputCreationRequest.forEach(je=>je.dispose()),this.pendingOutputCreationRequest.clear();for(let{abort:je}of this.outputs.values())je.abort();this.outputs.clear()}cancelOutput(je){this.pendingOutputCreationRequest.get(je)?.dispose(),this.pendingOutputCreationRequest.delete(je);let we=this.outputs.get(je);we&&(we.abort.abort(),this.outputs.delete(je))}},jt=new class{constructor(){this._renderers=new Map;for(let je of a.rendererData)this.addRenderer(je)}getRenderer(je){return this._renderers.get(je)}rendererEqual(je,we){if(je.id!==we.id||je.entrypoint.path!==we.entrypoint.path||je.entrypoint.extends!==we.entrypoint.extends||je.messaging!==we.messaging||je.mimeTypes.length!==we.mimeTypes.length)return!1;for(let Ke=0;Ke<je.mimeTypes.length;Ke++)if(je.mimeTypes[Ke]!==we.mimeTypes[Ke])return!1;return!0}updateRendererData(je){let we=new Set(this._renderers.keys()),Ke=new Set(je.map(Lt=>Lt.id));for(let Lt of je){let Gt=this._renderers.get(Lt.id);Gt&&this.rendererEqual(Gt.data,Lt)||this.addRenderer(Lt)}for(let Lt of we)Ke.has(Lt)||this._renderers.delete(Lt)}addRenderer(je){this._renderers.set(je.id,new C9(je))}clearAll(){LI.cancelAll();for(let je of this._renderers.values())je.disposeOutputItem()}clearOutput(je,we){LI.cancelOutput(we),this._renderers.get(je)?.disposeOutputItem(we)}async render(je,we,Ke,Lt){let Gt=this.findRenderer(we,je);if(!Gt){let so=(window.document.documentElement.style.getPropertyValue("--notebook-cell-renderer-not-found-error")||"").replace("$0",()=>je.mime);this.showRenderError(je,Ke,so);return}if(!(await this._doRender(je,Ke,Gt,Lt)).continue)return;for(let so of je._allOutputItems){if(so.mime===je.mime)continue;let Pr=await so.getItem();if(Lt.aborted)return;if(Pr){let Is=this.findRenderer(void 0,Pr);if(Is&&!(await this._doRender(Pr,Ke,Is,Lt)).continue)return}}let Ro=(window.document.documentElement.style.getPropertyValue("--notebook-cell-renderer-fallbacks-exhausted")||"").replace("$0",()=>je.mime);this.showRenderError(je,Ke,Ro)}async _doRender(je,we,Ke,Lt){try{return await Ke.renderOutputItem(je,we,Lt),{continue:!1}}catch(Gt){if(Lt.aborted)return{continue:!1};if(Gt instanceof Error&&Gt.name===h$)return{continue:!0};throw Gt}}findRenderer(je,we){let Ke;if(typeof je=="string")Ke=Array.from(this._renderers.values()).find(Lt=>Lt.data.id===je);else{let Lt=Array.from(this._renderers.values()).filter(Gt=>Gt.data.mimeTypes.includes(we.mime)&&!Gt.data.entrypoint.extends);Lt.length&&(Lt.sort((Gt,Ro)=>+Gt.data.isBuiltin-+Ro.data.isBuiltin),Ke=Lt[0])}return Ke}showRenderError(je,we,Ke){let Lt=document.createElement("div"),Gt=document.createElement("div");Gt.className="no-renderer-error",Gt.innerText=Ke;let Ro=document.createElement("div");Ro.innerText=je.text(),Lt.appendChild(Gt),Lt.appendChild(Ro),we.innerText="",we.appendChild(Lt)}},Mi=new class{constructor(){this._markupCells=new Map;this._outputCells=new Map}clearAll(){for(let we of this._markupCells.values())we.dispose();this._markupCells.clear();for(let we of this._outputCells.values())we.dispose();this._outputCells.clear()}async createMarkupCell(we,Ke,Lt){let Gt=this._markupCells.get(we.cellId);if(Gt)return console.error(`Trying to create markup that already exists: ${we.cellId}`),Gt;let Ro=new Kr(we.cellId,we.mime,we.content,Ke,we.metadata);return Ro.element.style.visibility=Lt?"":"hidden",this._markupCells.set(we.cellId,Ro),await Ro.ready,Ro}async ensureMarkupCell(we){let Ke=this._markupCells.get(we.cellId);Ke?(Ke.element.style.visibility=we.visible?"":"hidden",await Ke.updateContentAndRender(we.content,we.metadata)):Ke=await this.createMarkupCell(we,we.offset,we.visible)}deleteMarkupCell(we){let Ke=this.getExpectedMarkupCell(we);Ke&&(Ke.remove(),Ke.dispose(),this._markupCells.delete(we))}async updateMarkupContent(we,Ke,Lt){await this.getExpectedMarkupCell(we)?.updateContentAndRender(Ke,Lt)}showMarkupCell(we,Ke,Lt,Gt){this.getExpectedMarkupCell(we)?.show(Ke,Lt,Gt)}hideMarkupCell(we){this.getExpectedMarkupCell(we)?.hide()}unhideMarkupCell(we){this.getExpectedMarkupCell(we)?.unhide()}getExpectedMarkupCell(we){let Ke=this._markupCells.get(we);if(!Ke){console.log(`Could not find markup cell '${we}'`);return}return Ke}updateSelectedCells(we){let Ke=new Set(we);for(let Lt of this._markupCells.values())Lt.setSelected(Ke.has(Lt.id))}toggleDragDropEnabled(we){for(let Ke of this._markupCells.values())Ke.toggleDragDropEnabled(we)}updateMarkupScrolls(we){for(let{id:Ke,top:Lt}of we){let Gt=this._markupCells.get(Ke);Gt&&(Gt.element.style.top=`${Lt}px`)}}async renderOutputCell(we,Ke){let Lt=await Promise.all(we.requiredPreloads.map(Ro=>Rx.waitFor(Ro.uri).then(()=>{},so=>so)));return Ke.aborted?void 0:this.ensureOutputCell(we.cellId,we.cellTop,!1).renderOutputElement(we,Lt,Ke)}ensureOutputCell(we,Ke,Lt){let Gt=this._outputCells.get(we),Ro=!!Gt;return Gt||(Gt=new Ia(we),this._outputCells.set(we,Gt)),Ro&&Lt||(Gt.element.style.top=Ke+"px"),Gt}clearOutput(we,Ke,Lt){this._outputCells.get(we)?.clearOutput(Ke,Lt)}showOutput(we,Ke,Lt){this._outputCells.get(we)?.show(Ke,Lt)}updateAndRerender(we,Ke,Lt){this._outputCells.get(we)?.updateContentAndRerender(Ke,Lt)}hideOutput(we){this._outputCells.get(we)?.hide()}updateOutputHeight(we,Ke,Lt){this._outputCells.get(we)?.updateOutputHeight(Ke,Lt)}updateOutputsScroll(we){for(let Ke of we)this._outputCells.get(Ke.cellId)?.updateScroll(Ke)}};class no{static{this.pendingCodeBlocksToHighlight=new Map}static highlightCodeBlock(we,Ke){let Lt=no.pendingCodeBlocksToHighlight.get(we);if(!Lt)return;let Gt=er?.createHTML(Ke)??Ke;Lt.innerHTML=Gt;let Ro=Lt.getRootNode();Ro instanceof ShadowRoot&&(Ro.adoptedStyleSheets.includes(h)||Ro.adoptedStyleSheets.push(h))}static requestHighlightCodeBlock(we){let Ke=[],Lt=0;for(let Gt of we.querySelectorAll(".vscode-code-block")){let Ro=Gt.getAttribute("data-vscode-code-block-lang");if(Gt.textContent&&Ro){let so=`${Date.now()}-${Lt++}`;Ke.push({value:Gt.textContent,lang:Ro,id:so}),no.pendingCodeBlocksToHighlight.set(so,Gt)}}return Ke}}class Kr{constructor(we,Ke,Lt,Gt,Ro){this._isDisposed=!1;let so=this;this.id=we,this._content={value:Lt,version:0,metadata:Ro};let{promise:Pr,resolve:Is,reject:Qr}=n();this.ready=Pr;let Ta;this.outputItem=Object.freeze({id:we,mime:Ke,get metadata(){return so._content.metadata},text:()=>this._content.value,json:()=>{},data:()=>{if(Ta?.version===this._content.version)return Ta.value;let Ao=t.encode(this._content.value);return Ta={version:this._content.version,value:Ao},Ao},blob(){return new Blob([this.data()],{type:this.mime})},_allOutputItems:[{mime:Ke,getItem:async()=>this.outputItem}]});let Hr=window.document.getElementById("container"),ll=document.createElement("div");ll.className="markup",ll.style.position="absolute",ll.style.width="100%",this.element=document.createElement("div"),this.element.id=this.id,this.element.classList.add("preview"),this.element.style.position="absolute",this.element.style.top=Gt+"px",this.toggleDragDropEnabled(r.dragAndDropEnabled),ll.appendChild(this.element),Hr.appendChild(ll),this.addEventListeners(),this.updateContentAndRender(this._content.value,this._content.metadata).then(()=>{this._isDisposed||de.observe(this.element,this.id,!1,this.id),Is()},()=>Qr())}dispose(){this._isDisposed=!0,this.renderTaskAbort?.abort(),this.renderTaskAbort=void 0}addEventListeners(){this.element.addEventListener("dblclick",()=>{Co("toggleMarkupPreview",{cellId:this.id})}),this.element.addEventListener("click",we=>{Co("clickMarkupCell",{cellId:this.id,altKey:we.altKey,ctrlKey:we.ctrlKey,metaKey:we.metaKey,shiftKey:we.shiftKey})}),this.element.addEventListener("contextmenu",we=>{Co("contextMenuMarkupCell",{cellId:this.id,clientX:we.clientX,clientY:we.clientY})}),this.element.addEventListener("mouseenter",()=>{Co("mouseEnterMarkupCell",{cellId:this.id})}),this.element.addEventListener("mouseleave",()=>{Co("mouseLeaveMarkupCell",{cellId:this.id})}),this.element.addEventListener("dragstart",we=>{Nt.startDrag(we,this.id)}),this.element.addEventListener("drag",we=>{Nt.updateDrag(we,this.id)}),this.element.addEventListener("dragend",we=>{Nt.endDrag(we,this.id)})}async updateContentAndRender(we,Ke){this._content={value:we,version:this._content.version+1,metadata:Ke},this.renderTaskAbort?.abort();let Lt=new AbortController;this.renderTaskAbort=Lt;try{await jt.render(this.outputItem,void 0,this.element,this.renderTaskAbort.signal)}finally{this.renderTaskAbort===Lt&&(this.renderTaskAbort=void 0)}let Gt=this.element.shadowRoot??this.element,Ro=[];for(let Pr of Gt.children)switch(Pr.tagName){case"LINK":case"SCRIPT":case"STYLE":break;default:Ro.push(Pr.outerHTML);break}let so=no.requestHighlightCodeBlock(Gt);Co("renderedMarkup",{cellId:this.id,html:Ro.join(""),codeBlocks:so}),he.updateHeight(this.id,this.element.offsetHeight,{isOutput:!1})}show(we,Ke,Lt){this.element.style.visibility="",this.element.style.top=`${we}px`,typeof Ke=="string"||Lt?this.updateContentAndRender(Ke??this._content.value,Lt??this._content.metadata):this.updateMarkupDimensions()}hide(){this.element.style.visibility="hidden"}unhide(){this.element.style.visibility="",this.updateMarkupDimensions()}remove(){this.element.remove()}async updateMarkupDimensions(){he.updateHeight(this.id,this.element.offsetHeight,{isOutput:!1})}setSelected(we){this.element.classList.toggle("selected",we)}toggleDragDropEnabled(we){we?(this.element.classList.add("draggable"),this.element.setAttribute("draggable","true")):(this.element.classList.remove("draggable"),this.element.removeAttribute("draggable"))}}class Ia{constructor(we){this.outputElements=new Map;let Ke=window.document.getElementById("container"),Lt=Ht(we);Ke.appendChild(Lt),this.element=document.createElement("div"),this.element.style.position="absolute",this.element.style.outline="0",this.element.id=we,this.element.classList.add("cell_container"),Ke.appendChild(this.element),this.element=this.element;let Gt=Ht(we,!0);Ke.appendChild(Gt)}dispose(){for(let we of this.outputElements.values())we.dispose();this.outputElements.clear()}createOutputElement(we){let Ke=this.outputElements.get(we.outputId);return Ke||(Ke=new Yg(we.outputId),this.element.appendChild(Ke.element),this.outputElements.set(we.outputId,Ke)),Ke.createOutputElement(we.outputId,we.outputOffset,we.left,we.cellId)}async renderOutputElement(we,Ke,Lt){let Gt=Date.now(),Ro=this.createOutputElement(we);if(await Ro.render(we.content,we.rendererId,Ke,Lt),Ro.element.style.visibility=we.initiallyHidden?"hidden":"",we.executionId&&we.rendererId){let so;we.content.type===1&&(so=we.content.output.valueBytes.length),so!==void 0&&so>0&&so<100*1024&&Co("notebookPerformanceMessage",{cellId:we.cellId,executionId:we.executionId,duration:Date.now()-Gt,rendererId:we.rendererId,outputSize:so})}}clearOutput(we,Ke){let Lt=this.outputElements.get(we);Lt?.clear(Ke),Lt?.dispose(),this.outputElements.delete(we)}show(we,Ke){this.outputElements.get(we)&&(this.element.style.visibility="",this.element.style.top=`${Ke}px`)}hide(){this.element.style.visibility="hidden"}updateContentAndRerender(we,Ke){this.outputElements.get(we)?.updateContentAndRender(Ke)}updateOutputHeight(we,Ke){this.outputElements.get(we)?.updateHeight(Ke)}updateScroll(we){this.element.style.top=`${we.cellTop}px`;let Ke=this.outputElements.get(we.outputId);Ke&&(Ke.updateScroll(we.outputOffset),we.forceDisplay&&Ke.outputNode&&(Ke.outputNode.element.style.visibility="")),we.forceDisplay&&(this.element.style.visibility="")}}class Yg{constructor(we){this.outputId=we;this.element=document.createElement("div"),this.element.classList.add("output_container"),this.element.setAttribute("data-vscode-context",JSON.stringify({preventDefaultContextMenuItems:!0})),this.element.style.position="absolute",this.element.style.overflow="hidden"}get outputNode(){return this._outputNode}dispose(){this._outputNode?.dispose()}clear(we){we&&jt.clearOutput(we,this.outputId),this.element.remove()}updateHeight(we){this.element.style.maxHeight=`${we}px`,this.element.style.height=`${we}px`}updateScroll(we){this.element.style.top=`${we}px`}createOutputElement(we,Ke,Lt,Gt){return this.element.innerText="",this.element.style.maxHeight="0px",this.element.style.top=`${Ke}px`,this._outputNode?.dispose(),this._outputNode=new on(we,Lt,Gt),this.element.appendChild(this._outputNode.element),this._outputNode}updateContentAndRender(we){this._outputNode?.updateAndRerender(we)}}p.postMessage({__vscode_notebook_message:!0,type:"initialized"});for(let je of a.staticPreloadsData)Rx.load(je.entrypoint);function Co(je,we){p.postMessage({__vscode_notebook_message:!0,type:je,...we})}class on{constructor(we,Ke,Lt){this.outputId=we;this.cellId=Lt;this.hasResizeObserver=!1;this.isImageOutput=!1;this.element=document.createElement("div"),this.element.id=we,this.element.classList.add("output"),this.element.style.position="absolute",this.element.style.top="0px",this.element.style.left=Ke+"px",this.element.style.padding=`${a.style.outputNodePadding}px ${a.style.outputNodePadding}px ${a.style.outputNodePadding}px ${a.style.outputNodeLeftPadding}`,this.element.addEventListener("mouseenter",()=>{Co("mouseenter",{id:we})}),this.element.addEventListener("mouseleave",()=>{Co("mouseleave",{id:we})}),this.element.addEventListener("dragstart",Gt=>{if(!Gt.dataTransfer)return;let Ro={outputId:this.outputId};Gt.dataTransfer.setData("notebook-cell-output",JSON.stringify(Ro))}),window.addEventListener("keydown",Gt=>{Gt.altKey&&(this.element.draggable=!0)}),window.addEventListener("keyup",Gt=>{Gt.altKey||(this.element.draggable=this.isImageOutput)}),window.addEventListener("blur",()=>{this.element.draggable=this.isImageOutput})}dispose(){this.renderTaskAbort?.abort(),this.renderTaskAbort=void 0}async render(we,Ke,Lt,Gt){if(this.renderTaskAbort?.abort(),this.renderTaskAbort=void 0,this._content={preferredRendererId:Ke,preloadErrors:Lt},we.type===0){let Hr=er?.createHTML(we.htmlContent)??we.htmlContent;this.element.innerHTML=Hr}else if(Lt.some(Hr=>Hr instanceof Error)){let Hr=Lt.filter(ll=>ll instanceof Error);mn("Error loading preloads",this.element,Hr)}else{let Hr=["image/png","image/jpeg","image/svg"];this.isImageOutput=Hr.includes(we.output.mime),this.element.draggable=this.isImageOutput;let ll=Mr(this.outputId,we.output.mime,we.metadata,we.output.valueBytes,we.allOutputs,we.output.appended),Ao=new AbortController;this.renderTaskAbort=Ao,Gt?.addEventListener("abort",()=>Ao.abort());try{await jt.render(ll,Ke,this.element,Ao.signal)}finally{this.renderTaskAbort===Ao&&(this.renderTaskAbort=void 0)}}this.hasResizeObserver||(this.hasResizeObserver=!0,de.observe(this.element,this.outputId,!0,this.cellId));let Ro=this.element.offsetHeight,so=document.defaultView.getComputedStyle(this.element),Pr=parseFloat(so.paddingTop)+parseFloat(so.paddingBottom),Is=Ro-Pr;oe(Is)&&so.padding==="0px"?(he.updateHeight(this.outputId,Ro+a.style.outputNodePadding*2,{isOutput:!0,init:!0}),this.element.style.padding=`${a.style.outputNodePadding}px ${a.style.outputNodePadding}px ${a.style.outputNodePadding}px ${a.style.outputNodeLeftPadding}`):oe(Is)?(he.updateHeight(this.outputId,this.element.offsetHeight,{isOutput:!0,init:!0}),this.element.style.padding=`0 ${a.style.outputNodePadding}px 0 ${a.style.outputNodeLeftPadding}`):he.updateHeight(this.outputId,0,{isOutput:!0,init:!0});let Qr=this.element.shadowRoot??this.element,Ta=no.requestHighlightCodeBlock(Qr);Ta.length>0&&Co("renderedCellOutput",{codeBlocks:Ta})}updateAndRerender(we){this._content&&this.render(we,this._content.preferredRendererId,this._content.preloadErrors)}}let Nt=new class{constructor(){window.document.addEventListener("dragover",we=>{we.preventDefault()}),window.document.addEventListener("drop",we=>{we.preventDefault();let Ke=this.currentDrag;Ke&&(this.currentDrag=void 0,Co("cell-drop",{cellId:Ke.cellId,ctrlKey:we.ctrlKey,altKey:we.altKey,dragOffsetY:we.clientY}))})}startDrag(we,Ke){if(!we.dataTransfer||!r.dragAndDropEnabled)return;this.currentDrag={cellId:Ke,clientY:we.clientY};let Lt=9999;this.dragOverlay||(this.dragOverlay=document.createElement("div"),this.dragOverlay.style.position="absolute",this.dragOverlay.style.top="0",this.dragOverlay.style.left="0",this.dragOverlay.style.zIndex=`${Lt}`,this.dragOverlay.style.width="100%",this.dragOverlay.style.height="100%",this.dragOverlay.style.background="transparent",window.document.body.appendChild(this.dragOverlay)),we.target.style.zIndex=`${Lt+1}`,we.target.classList.add("dragging"),Co("cell-drag-start",{cellId:Ke,dragOffsetY:we.clientY});let Gt=()=>{this.currentDrag?.cellId===Ke&&(Co("cell-drag",{cellId:Ke,dragOffsetY:this.currentDrag.clientY}),window.requestAnimationFrame(Gt))};window.requestAnimationFrame(Gt)}updateDrag(we,Ke){Ke!==this.currentDrag?.cellId?this.currentDrag=void 0:this.currentDrag={cellId:Ke,clientY:we.clientY}}endDrag(we,Ke){this.currentDrag=void 0,we.target.classList.remove("dragging"),Co("cell-drag-end",{cellId:Ke}),this.dragOverlay&&(this.dragOverlay.remove(),this.dragOverlay=void 0),we.target.style.zIndex=""}}}function Lho(a,i,e,t,o,n,r){return`
		const __import = (x) => import(x);
		(${wJo})(
			JSON.parse(decodeURIComponent("${encodeURIComponent(JSON.stringify({style:a,options:i,renderOptions:e,rendererData:t,staticPreloadsData:o,isWorkspaceTrusted:n,nonce:r}))}"))
		)
//# sourceURL=notebookWebviewPreloads.js
`}var CJo=new Map([["theme-font-family","vscode-font-family"],["theme-font-weight","vscode-font-weight"],["theme-font-size","vscode-font-size"],["theme-code-font-family","vscode-editor-font-family"],["theme-code-font-weight","vscode-editor-font-weight"],["theme-code-font-size","vscode-editor-font-size"],["theme-scrollbar-background","vscode-scrollbarSlider-background"],["theme-scrollbar-hover-background","vscode-scrollbarSlider-hoverBackground"],["theme-scrollbar-active-background","vscode-scrollbarSlider-activeBackground"],["theme-quote-background","vscode-textBlockQuote-background"],["theme-quote-border","vscode-textBlockQuote-border"],["theme-code-foreground","vscode-textPreformat-foreground"],["theme-code-background","vscode-textPreformat-background"],["theme-background","vscode-editor-background"],["theme-foreground","vscode-editor-foreground"],["theme-ui-foreground","vscode-foreground"],["theme-link","vscode-textLink-foreground"],["theme-link-active","vscode-textLink-activeForeground"],["theme-button-background","vscode-button-background"],["theme-button-hover-background","vscode-button-hoverBackground"],["theme-button-foreground","vscode-button-foreground"],["theme-button-secondary-background","vscode-button-secondaryBackground"],["theme-button-secondary-hover-background","vscode-button-secondaryHoverBackground"],["theme-button-secondary-foreground","vscode-button-secondaryForeground"],["theme-button-hover-foreground","vscode-button-foreground"],["theme-button-focus-foreground","vscode-button-foreground"],["theme-button-secondary-hover-foreground","vscode-button-secondaryForeground"],["theme-button-secondary-focus-foreground","vscode-button-secondaryForeground"],["theme-input-background","vscode-input-background"],["theme-input-foreground","vscode-input-foreground"],["theme-input-placeholder-foreground","vscode-input-placeholderForeground"],["theme-input-focus-border-color","vscode-focusBorder"],["theme-menu-background","vscode-menu-background"],["theme-menu-foreground","vscode-menu-foreground"],["theme-menu-hover-background","vscode-menu-selectionBackground"],["theme-menu-focus-background","vscode-menu-selectionBackground"],["theme-menu-hover-foreground","vscode-menu-selectionForeground"],["theme-menu-focus-foreground","vscode-menu-selectionForeground"],["theme-error-background","vscode-inputValidation-errorBackground"],["theme-error-foreground","vscode-foreground"],["theme-warning-background","vscode-inputValidation-warningBackground"],["theme-warning-foreground","vscode-foreground"],["theme-info-background","vscode-inputValidation-infoBackground"],["theme-info-foreground","vscode-foreground"],["theme-notebook-output-background","vscode-notebook-outputContainerBackgroundColor"],["theme-notebook-output-border","vscode-notebook-outputContainerBorderColor"],["theme-notebook-cell-selected-background","vscode-notebook-selectedCellBackground"],["theme-notebook-symbol-highlight-background","vscode-notebook-symbolHighlightBackground"],["theme-notebook-diff-removed-background","vscode-diffEditor-removedTextBackground"],["theme-notebook-diff-inserted-background","vscode-diffEditor-insertedTextBackground"]]),xJo={"theme-input-border-width":"1px","theme-button-primary-hover-shadow":"none","theme-button-secondary-hover-shadow":"none","theme-input-border-color":"transparent"},Rho=a=>{let i={...a,...xJo};for(let[e,t]of CJo)i[e]=a[t];return i};var Mho="vscode-cdn.net",zEi=`vscode-resource.${Mho}`,She=`'self' https://*.${Mho}`;function wte(a,i){return a.scheme===Q.http||a.scheme===Q.https?a:(i&&i.authority&&i.isRemote&&a.scheme===Q.file&&(a=A.from({scheme:Q.vscodeRemote,authority:i.authority,path:a.path})),A.from({scheme:Q.https,authority:`${a.scheme}+${kJo(a.authority)}.${zEi}`,path:a.path,fragment:a.fragment,query:a.query}))}function kJo(a){return a.replace(/./g,i=>{let e=i.charCodeAt(0);return e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57?i:"-"+e.toString(16).padStart(4,"0")})}function Pho(a){return a.replace(/-([0-9a-f]{4})/g,(i,e)=>String.fromCharCode(parseInt(e,16)))}function FPe(a,i,e=!1){let t=[];for(let n=0;n<i.outputsViewModels.length;n++){let r=i.outputsViewModels[n],s=i.model.outputs[n],[l,c]=r.resolveMimeTypes(a,void 0),u=l[c].mimeType,p=s.outputs.find(g=>g.mime===u);if((!p||u.startsWith("image"))&&(p=s.outputs.find(g=>!g.mime.startsWith("image"))),!p)continue;let h="";if(HL(u)){let{text:g,count:f}=KUt(r);h=g,f>1&&(n+=f-1)}else h=GUt(u,p,e);t.push(h)}let o;return t.length>1?o=t.map((n,r)=>`Cell output ${r+1} of ${t.length}
${n}`).join(`
`):o=t[0]??"",o}function KUt(a){let i="",e=a.cellViewModel,t=e.outputsViewModels.indexOf(a),o=0;for(;t<e.model.outputs.length;){let r=e.model.outputs[t].outputs.find(s=>HL(s.mime));if(!r)break;i=i+Aho.decode(r.data.buffer),t=t+1,o++}return{text:i.trim(),count:o}}var Aho=new TextDecoder;function GUt(a,i,e=!1){let t=`${a}`,o=1e5;if(t=Aho.decode(i.data.slice(0,o).buffer),i.data.byteLength>o)t=t+"...(truncated)";else if(a==="application/vnd.code.notebook.error"){t=t.replace(/\\u001b\[[0-9;]*m/gi,"");try{let n=JSON.parse(t);!n.stack||e?t=`${n.name}: ${n.message}`:t=n.stack}catch{}}return t.trim()}async function Nho(a,i,e,t){let o=i.model,n=a&&OPe.includes(a)?o.outputs.find(s=>s.mime===a):o.outputs.find(s=>OPe.includes(s.mime));if(a=n?.mime,!a||!n)return;let r=HL(a)?KUt(i).text:GUt(a,n);try{await e.writeText(r)}catch(s){t.error(`Failed to copy content: ${s}`)}}var OPe=["text/latex","text/html","application/vnd.code.notebook.error","application/vnd.code.notebook.stdout","application/x.notebook.stdout","application/x.notebook.stream","application/vnd.code.notebook.stderr","application/x.notebook.stderr","text/plain","text/markdown","application/json"];var EJo=/:([\d]+)(?::([\d]+))?$/,TJo=/line=(\d+)$/,_Jo=/^(.*)#([^#]*)$/,oN=class extends yu{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,P,O,V,H,G){super(H);this.notebookEditor=e;this.id=t;this.notebookViewType=o;this.documentUri=n;this.options=r;this.rendererMessaging=s;this.webviewService=l;this.openerService=c;this.notebookService=u;this.contextService=p;this.environmentService=h;this.fileDialogService=g;this.fileService=f;this.contextMenuService=v;this.contextKeyService=b;this.workspaceTrustManagementService=S;this.configurationService=y;this.languageService=w;this.workspaceContextService=k;this.editorGroupService=T;this.storageService=P;this.pathService=O;this.notebookLogService=V;this.telemetryService=G;this.webview=void 0;this.insetMapping=new Map;this.pendingWebviewIdleCreationRequest=new Map;this.pendingWebviewIdleInsetMapping=new Map;this.reversedPendingWebviewIdleInsetMapping=new Map;this.markupPreviewMapping=new Map;this.hiddenInsetMapping=new Set;this.reversedInsetMapping=new Map;this.localResourceRootsCache=void 0;this._onMessage=this._register(new E);this._preloadsCache=new Set;this.onMessage=this._onMessage.event;this._disposed=!1;this.firstInit=!0;this.nonce=xt();this._logRendererDebugMessage("Creating backlayer webview for notebook"),this.element=document.createElement("div"),this.element.style.height="1400px",this.element.style.position="absolute",s&&(this._register(s),s.receiveMessageHandler=($,J)=>!this.webview||this._disposed?Promise.resolve(!1):(this._sendMessageToWebview({__vscode_notebook_message:!0,type:"customRendererMessage",rendererId:$,message:J}),Promise.resolve(!0))),this._register(S.onDidChangeTrust($=>{let J=this.asWebviewUri(this.getNotebookBaseUri(),void 0),ae=this.generateContent(J.toString());this.webview?.setHtml(ae)})),this._register(ic.onDidChange(()=>{this._sendMessageToWebview({type:"tokenizedStylesChanged",css:Fho()})}))}static getOriginStore(e){return this._originStore??=new g4("notebook.backlayerWebview.origins",e),this._originStore}updateOptions(e){this.options=e,this._updateStyles(),this._updateOptions()}_logRendererDebugMessage(e){this.notebookLogService.debug("BacklayerWebview",`${this.documentUri} (${this.id}) - ${e}`)}_updateStyles(){this._sendMessageToWebview({type:"notebookStyles",styles:this._generateStyles()})}_updateOptions(){this._sendMessageToWebview({type:"notebookOptions",options:{dragAndDropEnabled:this.options.dragAndDropEnabled},renderOptions:{lineLimit:this.options.outputLineLimit,outputScrolling:this.options.outputScrolling,outputWordWrap:this.options.outputWordWrap,linkifyFilePaths:this.options.outputLinkifyFilePaths,minimalError:this.options.minimalError}})}_generateStyles(){return{"notebook-output-left-margin":`${this.options.leftMargin+this.options.runGutter}px`,"notebook-output-width":`calc(100% - ${this.options.leftMargin+this.options.rightMargin+this.options.runGutter}px)`,"notebook-output-node-padding":`${this.options.outputNodePadding}px`,"notebook-run-gutter":`${this.options.runGutter}px`,"notebook-preview-node-padding":`${this.options.previewNodePadding}px`,"notebook-markdown-left-margin":`${this.options.markdownLeftMargin}px`,"notebook-output-node-left-padding":`${this.options.outputNodeLeftPadding}px`,"notebook-markdown-min-height":`${this.options.previewNodePadding*2}px`,"notebook-markup-font-size":typeof this.options.markupFontSize=="number"&&this.options.markupFontSize>0?`${this.options.markupFontSize}px`:`calc(${this.options.fontSize}px * 1.2)`,"notebook-markdown-line-height":typeof this.options.markdownLineHeight=="number"&&this.options.markdownLineHeight>0?`${this.options.markdownLineHeight}px`:"normal","notebook-cell-output-font-size":`${this.options.outputFontSize||this.options.fontSize}px`,"notebook-cell-output-line-height":`${this.options.outputLineHeight}px`,"notebook-cell-output-max-height":`${this.options.outputLineHeight*this.options.outputLineLimit+2}px`,"notebook-cell-output-font-family":this.options.outputFontFamily||this.options.fontFamily,"notebook-cell-markup-empty-content":d(12800,null),"notebook-cell-renderer-not-found-error":d(12802,null),"notebook-cell-renderer-fallbacks-exhausted":d(12801,null),"notebook-markup-font-family":this.options.markupFontFamily}}generateContent(e){let t=this.getRendererData(),o=this.getStaticPreloadsData(),n={lineLimit:this.options.outputLineLimit,outputScrolling:this.options.outputScrolling,outputWordWrap:this.options.outputWordWrap,linkifyFilePaths:this.options.outputLinkifyFilePaths,minimalError:this.options.minimalError},r=Lho({...this.options,tokenizationCss:Fho()},{dragAndDropEnabled:this.options.dragAndDropEnabled},n,t,o,this.workspaceTrustManagementService.isWorkspaceTrusted(),this.nonce),s=this.configurationService.getValue("notebook.experimental.enableCsp"),l=this.getColor(lle),c=this.getColor(rS);return`
		<html lang="en">
			<head>
				<meta charset="UTF-8">
				<base href="${e}/" />
				${s?`<meta http-equiv="Content-Security-Policy" content="
					default-src 'none';
					script-src ${She} 'unsafe-inline' 'unsafe-eval';
					style-src ${She} 'unsafe-inline';
					img-src ${She} https: http: data:;
					font-src ${She} https:;
					connect-src https:;
					child-src https: data:;
				">`:""}
				<style nonce="${this.nonce}">
					::highlight(find-highlight) {
						background-color: var(--vscode-editor-findMatchBackground, ${c});
					}

					::highlight(current-find-highlight) {
						background-color: var(--vscode-editor-findMatchHighlightBackground, ${l});
					}

					#container .cell_container {
						width: 100%;
					}

					#container .output_container {
						width: 100%;
					}

					#container .cell_container.nb-insertHighlight div.output_container div.output {
						background-color: var(--vscode-diffEditor-insertedLineBackground, var(--vscode-diffEditor-insertedTextBackground));
					}

					#container > div > div > div.output {
						font-size: var(--notebook-cell-output-font-size);
						width: var(--notebook-output-width);
						margin-left: var(--notebook-output-left-margin);
						background-color: var(--theme-notebook-output-background);
						padding-top: var(--notebook-output-node-padding);
						padding-right: var(--notebook-output-node-padding);
						padding-bottom: var(--notebook-output-node-padding);
						padding-left: var(--notebook-output-node-left-padding);
						box-sizing: border-box;
						border-top: none;
					}

					/* markdown */
					#container div.preview {
						width: 100%;
						padding-right: var(--notebook-preview-node-padding);
						padding-left: var(--notebook-markdown-left-margin);
						padding-top: var(--notebook-preview-node-padding);
						padding-bottom: var(--notebook-preview-node-padding);

						box-sizing: border-box;
						white-space: nowrap;
						overflow: hidden;
						white-space: initial;

						font-size: var(--notebook-markup-font-size);
						line-height: var(--notebook-markdown-line-height);
						color: var(--theme-ui-foreground);
						font-family: var(--notebook-markup-font-family);
					}

					#container div.preview.draggable {
						user-select: none;
						-webkit-user-select: none;
						-ms-user-select: none;
						cursor: grab;
					}

					#container div.preview.selected {
						background: var(--theme-notebook-cell-selected-background);
					}

					#container div.preview.dragging {
						background-color: var(--theme-background);
						opacity: 0.5 !important;
					}

					.monaco-workbench.vs-dark .notebookOverlay .cell.markdown .latex img,
					.monaco-workbench.vs-dark .notebookOverlay .cell.markdown .latex-block img {
						filter: brightness(0) invert(1)
					}

					#container .markup > div.nb-symbolHighlight {
						background-color: var(--theme-notebook-symbol-highlight-background);
					}

					#container .markup > div.nb-insertHighlight {
						background-color: var(--vscode-diffEditor-insertedLineBackground, var(--vscode-diffEditor-insertedTextBackground));
					}

					#container .nb-symbolHighlight .output_container .output {
						background-color: var(--theme-notebook-symbol-highlight-background);
					}

					#container .markup > div.nb-multiCellHighlight {
						background-color: var(--theme-notebook-symbol-highlight-background);
					}

					#container .nb-multiCellHighlight .output_container .output {
						background-color: var(--theme-notebook-symbol-highlight-background);
					}

					#container .nb-chatGenerationHighlight .output_container .output {
						background-color: var(--vscode-notebook-selectedCellBackground);
					}

					#container > div.nb-cellDeleted .output_container {
						background-color: var(--theme-notebook-diff-removed-background);
					}

					#container > div.nb-cellAdded .output_container {
						background-color: var(--theme-notebook-diff-inserted-background);
					}

					#container > div > div:not(.preview) > div {
						overflow-x: auto;
					}

					#container .no-renderer-error {
						color: var(--vscode-editorError-foreground);
					}

					body {
						padding: 0px;
						height: 100%;
						width: 100%;
					}

					table, thead, tr, th, td, tbody {
						border: none;
						border-color: transparent;
						border-spacing: 0;
						border-collapse: collapse;
					}

					table, th, tr {
						vertical-align: middle;
						text-align: right;
					}

					thead {
						font-weight: bold;
						background-color: rgba(130, 130, 130, 0.16);
					}

					th, td {
						padding: 4px 8px;
					}

					tr:nth-child(even) {
						background-color: rgba(130, 130, 130, 0.08);
					}

					tbody th {
						font-weight: normal;
					}

					.find-match {
						background-color: var(--vscode-editor-findMatchHighlightBackground);
					}

					.current-find-match {
						background-color: var(--vscode-editor-findMatchBackground);
					}

					#_defaultColorPalatte {
						color: var(--vscode-editor-findMatchHighlightBackground);
						background-color: var(--vscode-editor-findMatchBackground);
					}
				</style>
			</head>
			<body style="overflow: hidden;">
				<div id='findStart' tabIndex=-1></div>
				<div id='container' class="widgetarea" style="position: absolute;width:100%;top: 0px"></div>
				<div id="_defaultColorPalatte"></div>
				<script type="module">${r}</script>
			</body>
		</html>`}getRendererData(){return this.notebookService.getRenderers().map(e=>{let t={extends:e.entrypoint.extends,path:this.asWebviewUri(e.entrypoint.path,e.extensionLocation).toString()};return{id:e.id,entrypoint:t,mimeTypes:e.mimeTypes,messaging:e.messaging!=="never"&&!!this.rendererMessaging,isBuiltin:e.isBuiltin}})}getStaticPreloadsData(){return Array.from(this.notebookService.getStaticPreloads(this.notebookViewType),e=>({entrypoint:this.asWebviewUri(e.entrypoint,e.extensionLocation).toString().toString()}))}asWebviewUri(e,t){return wte(e,t?.scheme===Q.vscodeRemote?{isRemote:!0,authority:t.authority}:void 0)}postKernelMessage(e){this._sendMessageToWebview({__vscode_notebook_message:!0,type:"customKernelMessage",message:e})}resolveOutputId(e){let t=this.reversedInsetMapping.get(e);return t?{cellInfo:this.insetMapping.get(t).cellInfo,output:t}:void 0}isResolved(){return!!this.webview}createWebview(e){let t=this.asWebviewUri(this.getNotebookBaseUri(),void 0),o=this.generateContent(t.toString());return this._initialize(o,e)}getNotebookBaseUri(){if(this.documentUri.scheme===Q.untitled){let e=this.workspaceContextService.getWorkspaceFolder(this.documentUri);if(e)return e.uri;let t=this.workspaceContextService.getWorkspace().folders;if(t.length)return t[0].uri}return ci(this.documentUri)}getBuiltinLocalResourceRoots(){return this.documentUri.path.toLowerCase().endsWith(".ipynb")?Wt?[]:[ci(vn.asFileUri("vs/nls.js"))]:[]}_initialize(e,t){if(!Re(this.element).document.body.contains(this.element))throw new Error("Element is already detached from the DOM tree");this.webview=this._createInset(this.webviewService,e),this.webview.mountTo(this.element,t),this._register(this.webview),this._register(new kJ(t,()=>this.webview));let o=new Ko;return this._register(this.webview.onFatalError(n=>{o.error(new Error(`Could not initialize webview: ${n.message}}`))})),this._register(this.webview.onMessage(async n=>{let r=n.message;if(!this._disposed&&r.__vscode_notebook_message)switch(r.type){case"initialized":{o.complete(),this.initializeWebViewState();break}case"initializedMarkup":{this.initializeMarkupPromise?.requestId===r.requestId&&(this.initializeMarkupPromise?.p.complete(),this.initializeMarkupPromise=void 0);break}case"dimension":{for(let s of r.updates){let l=s.height;if(s.isOutput){let c=this.resolveOutputId(s.id);if(c){let{cellInfo:u,output:p}=c;this.notebookEditor.updateOutputHeight(u,p,l,!!s.init,"webview#dimension"),this.notebookEditor.scheduleOutputHeightAck(u,s.id,l)}else if(s.init){let u=this.reversedPendingWebviewIdleInsetMapping.get(s.id);if(u){let p=this.pendingWebviewIdleInsetMapping.get(u);this.pendingWebviewIdleCreationRequest.delete(u),this.pendingWebviewIdleCreationRequest.delete(u);let h=p.cellInfo;this.reversedInsetMapping.set(s.id,u),this.insetMapping.set(u,p),this.notebookEditor.updateOutputHeight(h,u,l,!!s.init,"webview#dimension"),this.notebookEditor.scheduleOutputHeightAck(h,s.id,l)}this.reversedPendingWebviewIdleInsetMapping.delete(s.id)}{if(!s.init)continue;let u=this.reversedInsetMapping.get(s.id);if(!u)continue;let p=this.insetMapping.get(u);p.initialized=!0}}else this.notebookEditor.updateMarkupCellHeight(s.id,l,!!s.init)}break}case"mouseenter":{let s=this.resolveOutputId(r.id);if(s){let l=this.notebookEditor.getCellByInfo(s.cellInfo);l&&(l.outputIsHovered=!0)}break}case"mouseleave":{let s=this.resolveOutputId(r.id);if(s){let l=this.notebookEditor.getCellByInfo(s.cellInfo);l&&(l.outputIsHovered=!1)}break}case"outputFocus":{let s=this.resolveOutputId(r.id);if(s){let l=this.notebookEditor.getCellByInfo(s.cellInfo);l&&(l.outputIsFocused=!0,this.notebookEditor.focusNotebookCell(l,"output",{outputId:s.output.model.outputId,skipReveal:!0,outputWebviewFocused:!0}))}break}case"outputBlur":{let s=this.resolveOutputId(r.id);if(s){let l=this.notebookEditor.getCellByInfo(s.cellInfo);l&&(l.outputIsFocused=!1,l.inputInOutputIsFocused=!1)}break}case"scroll-ack":break;case"scroll-to-reveal":{this.notebookEditor.setScrollTop(r.scrollTop-bhe);break}case"did-scroll-wheel":{this.notebookEditor.triggerScroll({...r.payload,preventDefault:()=>{},stopPropagation:()=>{}});break}case"focus-editor":{let s=this.notebookEditor.getCellById(r.cellId);s&&(r.focusNext?this.notebookEditor.focusNextNotebookCell(s,"editor"):await this.notebookEditor.focusNotebookCell(s,"editor"));break}case"clicked-data-url":{this._onDidClickDataLink(r);break}case"clicked-link":{if(ec(r.href,Q.command)){let s=A.parse(r.href);if(s.path==="workbench.action.openLargeOutput"){let l=s.query,c=this.editorGroupService.activeGroup;c&&c.activeEditor&&c.pinEditor(c.activeEditor),this.openerService.open(Zo.generateCellOutputUriWithId(this.documentUri,l));return}if(s.path==="cellOutput.enableScrolling"){let l=s.query,c=this.reversedInsetMapping.get(l);c&&(this.telemetryService.publicLog2("workbenchActionExecuted",{id:"notebook.cell.toggleOutputScrolling",from:"inlineLink"}),c.cellViewModel.outputsViewModels.forEach(u=>{u.model.metadata&&(u.model.metadata.scrollable=!0,u.resetRenderer())}));return}this.openerService.open(r.href,{fromUserGesture:!0,fromWorkspace:!0,allowCommands:["github-issues.authNow","workbench.extensions.search","workbench.action.openSettings","_notebook.selectKernel","jupyter.viewOutput","jupyter.createPythonEnvAndSelectController"]});return}if(mV(r.href,Q.http,Q.https,Q.mailto))this.openerService.open(r.href,{fromUserGesture:!0,fromWorkspace:!0});else if(ec(r.href,Q.vscodeNotebookCell)){let s=A.parse(r.href);await this._handleNotebookCellResource(s)}else/^[\w\-]+:/.test(r.href)?Zl(r.href)?this._openUri(A.file(r.href)):this._openUri(A.parse(r.href)):await this._handleResourceOpening(DJo(r.href));break}case"customKernelMessage":{this._onMessage.fire({message:r.message});break}case"customRendererMessage":{this.rendererMessaging?.postMessage(r.rendererId,r.message);break}case"clickMarkupCell":{let s=this.notebookEditor.getCellById(r.cellId);s&&(r.shiftKey||(Ze?r.metaKey:r.ctrlKey)?this.notebookEditor.toggleNotebookCellSelection(s,r.shiftKey):await this.notebookEditor.focusNotebookCell(s,"container",{skipReveal:!0}));break}case"contextMenuMarkupCell":{let s=this.notebookEditor.getCellById(r.cellId);if(s){await this.notebookEditor.focusNotebookCell(s,"container",{skipReveal:!0});let l=this.element.getBoundingClientRect();this.contextMenuService.showContextMenu({menuId:D.NotebookCellTitle,contextKeyService:this.contextKeyService,getAnchor:()=>({x:l.x+r.clientX,y:l.y+r.clientY})})}break}case"toggleMarkupPreview":{let s=this.notebookEditor.getCellById(r.cellId);s&&!this.notebookEditor.creationOptions.isReadOnly&&(this.notebookEditor.setMarkupCellEditState(r.cellId,1),await this.notebookEditor.focusNotebookCell(s,"editor",{skipReveal:!0}));break}case"mouseEnterMarkupCell":{let s=this.notebookEditor.getCellById(r.cellId);s instanceof Hb&&(s.cellIsHovered=!0);break}case"mouseLeaveMarkupCell":{let s=this.notebookEditor.getCellById(r.cellId);s instanceof Hb&&(s.cellIsHovered=!1);break}case"cell-drag-start":{this.notebookEditor.didStartDragMarkupCell(r.cellId,r);break}case"cell-drag":{this.notebookEditor.didDragMarkupCell(r.cellId,r);break}case"cell-drop":{this.notebookEditor.didDropMarkupCell(r.cellId,{dragOffsetY:r.dragOffsetY,ctrlKey:r.ctrlKey,altKey:r.altKey});break}case"cell-drag-end":{this.notebookEditor.didEndDragMarkupCell(r.cellId);break}case"renderedMarkup":{let s=this.notebookEditor.getCellById(r.cellId);s instanceof Hb&&(s.renderedHtml=r.html),this._handleHighlightCodeBlock(r.codeBlocks);break}case"renderedCellOutput":{this._handleHighlightCodeBlock(r.codeBlocks);break}case"outputResized":{this.notebookEditor.didResizeOutput(r.cellId);break}case"getOutputItem":{let l=this.resolveOutputId(r.outputId)?.output.model.outputs.find(c=>c.mime===r.mime);this._sendMessageToWebview({type:"returnOutputItem",requestId:r.requestId,output:l?{mime:l.mime,valueBytes:l.data.buffer}:void 0});break}case"logRendererDebugMessage":{this._logRendererDebugMessage(`${r.message}${r.data?" "+JSON.stringify(r.data,null,4):""}`);break}case"notebookPerformanceMessage":{this.notebookEditor.updatePerformanceMetadata(r.cellId,r.executionId,r.duration,r.rendererId),r.outputSize&&r.rendererId==="vscode.builtin-renderer"&&this._sendPerformanceData(r.outputSize,r.duration);break}case"outputInputFocus":{let s=this.resolveOutputId(r.id);if(s){let l=this.notebookEditor.getCellByInfo(s.cellInfo);l&&(l.inputInOutputIsFocused=r.inputFocused)}this.notebookEditor.didFocusOutputInputChange(r.inputFocused)}}})),o.p}_sendPerformanceData(e,t){let o={outputSize:e,renderTime:t};this.telemetryService.publicLog2("NotebookCellOutputRender",o)}_handleNotebookCellResource(e){let t=e.path.length>0?e:this.documentUri,o=/(?:^|&)line=([^&]+)/.exec(e.query),n;if(o){let l=parseInt(o[1],10);isNaN(l)||(n={selection:{startLineNumber:l,startColumn:1}})}let r=/(?:^|&)execution_count=([^&]+)/.exec(e.query);if(r){let l=parseInt(r[1],10);if(!isNaN(l)){let u=this.notebookService.getNotebookTextModel(t)?.cells.slice().reverse().find(p=>p.internalMetadata.executionOrder===l);if(u?.uri)return this.openerService.open(u.uri,{fromUserGesture:!0,fromWorkspace:!0,editorOptions:n})}}let s=/\?line=(\d+)$/.exec(e.fragment);if(s){let l=parseInt(s[1],10);if(!isNaN(l)){let c=l+1,u=e.fragment.substring(0,s.index),p={selection:{startLineNumber:c,startColumn:1,endLineNumber:c,endColumn:1}};return this.openerService.open(t.with({fragment:u}),{fromUserGesture:!0,fromWorkspace:!0,editorOptions:p})}}return this.openerService.open(t,{fromUserGesture:!0,fromWorkspace:!0})}async _handleResourceOpening(e){let t,o,n=_Jo.exec(e);if(n&&(e=n[1],o=n[2]),e.startsWith("/")){t=await this.pathService.fileURI(e);let r=this.workspaceContextService.getWorkspace().folders;r.length&&(t=t.with({scheme:r[0].uri.scheme,authority:r[0].uri.authority}))}else if(e.startsWith("~")){let r=await this.pathService.userHome();r&&(t=A.joinPath(r,e.substring(2)))}else if(this.documentUri.scheme===Q.untitled){let r=this.workspaceContextService.getWorkspace().folders;if(!r.length)return;t=A.joinPath(r[0].uri,e)}else t=A.joinPath(ci(this.documentUri),e);t&&(o&&(t=t.with({fragment:o})),this._openUri(t))}_openUri(e){let t,o,n=EJo.exec(e.path);n&&(e=e.with({path:e.path.slice(0,n.index),fragment:`L${n[0].slice(1)}`}),t=parseInt(n[1],10),o=parseInt(n[2],10));let r=TJo.exec(e.query);if(r){let l=parseInt(r[1],10);isNaN(l)||(t=l+1,o=1,e=e.with({fragment:`L${t}`}))}e=e.with({query:null});let s;for(let l of this.editorGroupService.groups){let c=l.editors.find(u=>u.resource&&Qe(u.resource,e,!0));if(c){s={group:l,editor:c};break}}if(s){let l=t!==void 0&&o!==void 0?{startLineNumber:t,startColumn:o}:void 0,c={selection:l};s.group.openEditor(s.editor,l?c:void 0)}else this.openerService.open(e,{fromUserGesture:!0,fromWorkspace:!0})}_handleHighlightCodeBlock(e){for(let{id:t,value:o,lang:n}of e){let r=this.languageService.getLanguageIdByLanguageName(n);r&&fz(this.languageService,o,r).then(s=>{this._disposed||this._sendMessageToWebview({type:"tokenizedCodeBlock",html:s,codeBlockId:t})})}}async _onDidClickDataLink(e){if(typeof e.data!="string")return;let[t,o]=e.data.split(";base64,");if(!o||!t)return;let n=es(this.documentUri)===".interactive"?this.workspaceContextService.getWorkspace().folders[0]?.uri??await this.fileDialogService.defaultFilePath():ci(this.documentUri),r;if(e.downloadName)r=e.downloadName;else{let u=t.replace(/^data:/,""),p=u&&yP(u);r=p?`download${p}`:"download"}let s=Ge(n,r),l=await this.fileDialogService.showSaveDialog({defaultUri:s});if(!l)return;let c=qa(o);await this.fileService.writeFile(l,c),await this.openerService.open(l)}_createInset(e,t){this.localResourceRootsCache=this._getResourceRootsCache();let o=e.createWebviewElement({origin:oN.getOriginStore(this.storageService).getOrigin(this.notebookViewType,void 0),title:d(12803,null),options:{purpose:"notebookRenderer",enableFindWidget:!1,transformCssVariables:Rho},contentOptions:{allowMultipleAPIAcquire:!0,allowScripts:!0,localResourceRoots:this.localResourceRootsCache},extension:void 0,providedViewType:"notebook.output"});return o.setHtml(t),o.setContextKeyService(this.contextKeyService),o}_getResourceRootsCache(){let e=this.contextService.getWorkspace().folders.map(o=>o.uri),t=this.getNotebookBaseUri();return[this.notebookService.getNotebookProviderResourceRoots(),this.notebookService.getRenderers().map(o=>ci(o.entrypoint.path)),...Array.from(this.notebookService.getStaticPreloads(this.notebookViewType),o=>[ci(o.entrypoint),...o.localResourceRoots]),e,t,this.getBuiltinLocalResourceRoots()].flat()}initializeWebViewState(){this._preloadsCache.clear(),this._currentKernel&&this._updatePreloadsFromKernel(this._currentKernel);for(let[e,t]of this.insetMapping.entries())this._sendMessageToWebview({...t.cachedCreation,initiallyHidden:this.hiddenInsetMapping.has(e)});if(!this.initializeMarkupPromise?.isFirstInit){let e=[...this.markupPreviewMapping.values()];this.markupPreviewMapping.clear(),this.initializeMarkup(e)}this._updateStyles(),this._updateOptions()}shouldUpdateInset(e,t,o,n){if(this._disposed||"isOutputCollapsed"in e&&e.isOutputCollapsed)return!1;if(this.hiddenInsetMapping.has(t))return!0;let r=this.insetMapping.get(t);return!(!r||n===r.cachedCreation.outputOffset&&o===r.cachedCreation.cellTop)}ackHeight(e){this._sendMessageToWebview({type:"ack-dimension",updates:e})}updateScrollTops(e,t){if(this._disposed)return;let o=di(e.map(n=>{let r=this.insetMapping.get(n.output);if(!r||!n.forceDisplay&&!this.shouldUpdateInset(n.cell,n.output,n.cellTop,n.outputOffset))return;let s=r.outputId;return r.cachedCreation.cellTop=n.cellTop,r.cachedCreation.outputOffset=n.outputOffset,this.hiddenInsetMapping.delete(n.output),{cellId:n.cell.id,outputId:s,cellTop:n.cellTop,outputOffset:n.outputOffset,forceDisplay:n.forceDisplay}}));!o.length&&!t.length||this._sendMessageToWebview({type:"view-scroll",widgets:o,markupCells:t})}async createMarkupPreview(e){if(!this._disposed){if(this.markupPreviewMapping.has(e.cellId)){console.error("Trying to create markup preview that already exists");return}this.markupPreviewMapping.set(e.cellId,e),this._sendMessageToWebview({type:"createMarkupCell",cell:e})}}async showMarkupPreview(e){if(this._disposed)return;let t=this.markupPreviewMapping.get(e.cellId);if(!t)return this.createMarkupPreview(e);let o=e.content===t.content,n=eo(e.metadata,t.metadata);(!o||!n||!t.visible)&&this._sendMessageToWebview({type:"showMarkupCell",id:e.cellId,handle:e.cellHandle,content:o?void 0:e.content,top:e.offset,metadata:n?void 0:e.metadata}),t.metadata=e.metadata,t.content=e.content,t.offset=e.offset,t.visible=!0}async hideMarkupPreviews(e){if(this._disposed)return;let t=[];for(let o of e){let n=this.markupPreviewMapping.get(o);n&&n.visible&&(t.push(o),n.visible=!1)}t.length&&this._sendMessageToWebview({type:"hideMarkupCells",ids:t})}async unhideMarkupPreviews(e){if(this._disposed)return;let t=[];for(let o of e){let n=this.markupPreviewMapping.get(o);n?n.visible||(n.visible=!0,t.push(o)):console.error(`Trying to unhide a preview that does not exist: ${o}`)}this._sendMessageToWebview({type:"unhideMarkupCells",ids:t})}async deleteMarkupPreviews(e){if(!this._disposed){for(let t of e)this.markupPreviewMapping.has(t)||console.error(`Trying to delete a preview that does not exist: ${t}`),this.markupPreviewMapping.delete(t);e.length&&this._sendMessageToWebview({type:"deleteMarkupCell",ids:e})}}async updateMarkupPreviewSelections(e){this._disposed||this._sendMessageToWebview({type:"updateSelectedMarkupCells",selectedCellIds:e.filter(t=>this.markupPreviewMapping.has(t))})}async initializeMarkup(e){if(this._disposed)return;this.initializeMarkupPromise?.p.complete();let t=xt();this.initializeMarkupPromise={p:new Ko,requestId:t,isFirstInit:this.firstInit},this.firstInit=!1;for(let o of e)this.markupPreviewMapping.set(o.cellId,o);return this._sendMessageToWebview({type:"initializeMarkup",cells:e,requestId:t}),this.initializeMarkupPromise.p.p}_cachedInsetEqual(e,t){return t.type===1?e.renderer?.id===t.renderer.id:e.cachedCreation.type==="html"}requestCreateOutputWhenWebviewIdle(e,t,o,n){this._disposed||this.insetMapping.has(t.source)||this.pendingWebviewIdleCreationRequest.has(t.source)||this.pendingWebviewIdleInsetMapping.has(t.source)||this.pendingWebviewIdleCreationRequest.set(t.source,PL(()=>{let{message:r,renderer:s,transfer:l}=this._createOutputCreationMessage(e,t,o,n,!0,!0);this._sendMessageToWebview(r,l),this.pendingWebviewIdleInsetMapping.set(t.source,{outputId:r.outputId,versionId:t.source.model.versionId,cellInfo:e,renderer:s,cachedCreation:r}),this.reversedPendingWebviewIdleInsetMapping.set(r.outputId,t.source),this.pendingWebviewIdleCreationRequest.delete(t.source)}))}createOutput(e,t,o,n){if(this._disposed)return;let r=this.insetMapping.get(t.source);if(this.pendingWebviewIdleCreationRequest.get(t.source)?.dispose(),this.pendingWebviewIdleCreationRequest.delete(t.source),this.pendingWebviewIdleInsetMapping.delete(t.source),r&&this.reversedPendingWebviewIdleInsetMapping.delete(r.outputId),r&&this._cachedInsetEqual(r,t)){this.hiddenInsetMapping.delete(t.source),this._sendMessageToWebview({type:"showOutput",cellId:r.cellInfo.cellId,outputId:r.outputId,cellTop:o,outputOffset:n});return}let{message:s,renderer:l,transfer:c}=this._createOutputCreationMessage(e,t,o,n,!1,!1);this._sendMessageToWebview(s,c),this.insetMapping.set(t.source,{outputId:s.outputId,versionId:t.source.model.versionId,cellInfo:e,renderer:l,cachedCreation:s}),this.hiddenInsetMapping.delete(t.source),this.reversedInsetMapping.set(s.outputId,t.source)}createMetadata(e,t){if(t.startsWith("image")){let o=e.outputs.find(n=>n.mime==="text/plain")?.data.buffer;if(o?.length&&o?.length>0){let n=new TextDecoder().decode(o);return{...e.metadata,vscode_altText:n}}}return e.metadata}_createOutputCreationMessage(e,t,o,n,r,s){let l={type:"html",executionId:e.executionId,cellId:e.cellId,cellTop:o,outputOffset:n,left:0,requiredPreloads:[],createOnIdle:r},c=[],u,p;if(t.type===1){let h=t.source.model;p=t.renderer;let g=h.outputs.find(b=>b.mime===t.mimeType),f=this.createMetadata(h,t.mimeType),v=Oho(g.data.buffer,c);u={...l,outputId:h.outputId,rendererId:t.renderer.id,content:{type:1,outputId:h.outputId,metadata:f,output:{mime:g.mime,valueBytes:v},allOutputs:h.outputs.map(b=>({mime:b.mime}))},initiallyHidden:s}}else u={...l,outputId:xt(),content:{type:t.type,htmlContent:t.htmlContent},initiallyHidden:s};return{message:u,renderer:p,transfer:c}}updateOutput(e,t,o,n){if(this._disposed)return;if(!this.insetMapping.has(t.source)){this.createOutput(e,t,o,n);return}let r=this.insetMapping.get(t.source);if(r.versionId===t.source.model.versionId)return;this.hiddenInsetMapping.delete(t.source);let s,l=[];if(t.type===1){let c=t.source.model,u=c.outputs.find(f=>f.mime===t.mimeType),p=c.appendedSinceVersion(r.versionId,t.mimeType),h=p?{valueBytes:p.buffer,previousVersion:r.versionId}:void 0,g=Oho(u.data.buffer,l);s={type:1,outputId:r.outputId,metadata:c.metadata,output:{mime:t.mimeType,valueBytes:g,appended:h},allOutputs:c.outputs.map(f=>({mime:f.mime}))}}this._sendMessageToWebview({type:"showOutput",cellId:r.cellInfo.cellId,outputId:r.outputId,cellTop:o,outputOffset:n,content:s},l),r.versionId=t.source.model.versionId}async copyImage(e){let t=[],o=e.model;for(let n of o.outputs)if(OPe.includes(n.mime)){let r=HL(n.mime)?KUt(e).text:GUt(n.mime,n);t.push({mimeType:n.mime,content:r})}this._sendMessageToWebview({type:"copyImage",outputId:e.model.outputId,altOutputId:e.model.alternativeOutputId,textAlternates:t.length>0?t:void 0})}removeInsets(e){if(!this._disposed)for(let t of e){let o=this.insetMapping.get(t);if(!o)continue;let n=o.outputId;this._sendMessageToWebview({type:"clearOutput",rendererId:o.cachedCreation.rendererId,cellUri:o.cellInfo.cellUri.toString(),outputId:n,cellId:o.cellInfo.cellId}),this.insetMapping.delete(t),this.pendingWebviewIdleCreationRequest.get(t)?.dispose(),this.pendingWebviewIdleCreationRequest.delete(t),this.pendingWebviewIdleInsetMapping.delete(t),this.reversedPendingWebviewIdleInsetMapping.delete(n),this.reversedInsetMapping.delete(n)}}hideInset(e){if(this._disposed)return;let t=this.insetMapping.get(e);t&&(this.hiddenInsetMapping.add(e),this._sendMessageToWebview({type:"hideOutput",outputId:t.outputId,cellId:t.cellInfo.cellId}))}focusWebview(){this._disposed||this.webview?.focus()}selectOutputContents(e){if(this._disposed)return;let t=e.outputsViewModels.find(n=>n.model.outputId===e.focusedOutputId),o=t?this.insetMapping.get(t)?.outputId:void 0;this._sendMessageToWebview({type:"select-output-contents",cellOrOutputId:o||e.id})}selectInputContents(e){if(this._disposed)return;let t=e.outputsViewModels.find(n=>n.model.outputId===e.focusedOutputId),o=t?this.insetMapping.get(t)?.outputId:void 0;this._sendMessageToWebview({type:"select-input-contents",cellOrOutputId:o||e.id})}focusOutput(e,t,o){this._disposed||(o||this.webview?.focus(),this._sendMessageToWebview({type:"focus-output",cellOrOutputId:e,alternateId:t}))}blurOutput(){this._disposed||this._sendMessageToWebview({type:"blur-output"})}async find(e,t){if(e==="")return this._sendMessageToWebview({type:"findStop",ownerID:t.ownerID}),[];let o=new Promise(r=>{let s=this.webview?.onMessage(l=>{l.message.type==="didFind"&&(r(l.message.matches),s?.dispose())})});return this._sendMessageToWebview({type:"find",query:e,options:t}),await o}findStop(e){this._sendMessageToWebview({type:"findStop",ownerID:e})}async findHighlightCurrent(e,t){let o=new Promise(r=>{let s=this.webview?.onMessage(l=>{l.message.type==="didFindHighlightCurrent"&&(r(l.message.offset),s?.dispose())})});return this._sendMessageToWebview({type:"findHighlightCurrent",index:e,ownerID:t}),await o}async findUnHighlightCurrent(e,t){this._sendMessageToWebview({type:"findUnHighlightCurrent",index:e,ownerID:t})}deltaCellOutputContainerClassNames(e,t,o){this._sendMessageToWebview({type:"decorations",cellId:e,addedClassNames:t,removedClassNames:o})}deltaMarkupPreviewClassNames(e,t,o){this.markupPreviewMapping.get(e)&&this._sendMessageToWebview({type:"markupDecorations",cellId:e,addedClassNames:t,removedClassNames:o})}updateOutputRenderers(){if(!this.webview)return;let e=this.getRendererData();this.localResourceRootsCache=this._getResourceRootsCache();let t=[...this.localResourceRootsCache||[],...this._currentKernel?[this._currentKernel.localResourceRoot]:[]];this.webview.localResourcesRoot=t,this._sendMessageToWebview({type:"updateRenderers",rendererData:e})}async updateKernelPreloads(e){if(this._disposed||e===this._currentKernel)return;let t=this._currentKernel;this._currentKernel=e,t&&t.preloadUris.length>0?this.webview?.reload():e&&this._updatePreloadsFromKernel(e)}_updatePreloadsFromKernel(e){let t=[];for(let o of e.preloadUris){let n=this.environmentService.isExtensionDevelopment&&(o.scheme==="http"||o.scheme==="https")?o:this.asWebviewUri(o,void 0);this._preloadsCache.has(n.toString())||(t.push({uri:n.toString(),originalUri:o.toString()}),this._preloadsCache.add(n.toString()))}t.length&&this._updatePreloads(t)}_updatePreloads(e){if(!this.webview)return;let t=[...this.localResourceRootsCache||[],...this._currentKernel?[this._currentKernel.localResourceRoot]:[]];this.webview.localResourcesRoot=t,this._sendMessageToWebview({type:"preload",resources:e})}_sendMessageToWebview(e,t){this._disposed||this.webview?.postMessage(e,t)}dispose(){this._disposed=!0,this.webview?.dispose(),this.webview=void 0,this.notebookEditor=null,this.insetMapping.clear(),this.pendingWebviewIdleCreationRequest.clear(),super.dispose()}};oN=I([m(6,cp),m(7,Je),m(8,bn),m(9,Pe),m(10,At),m(11,rn),m(12,fe),m(13,Xe),m(14,X),m(15,Nr),m(16,B),m(17,_t),m(18,Pe),m(19,wt),m(20,ce),m(21,An),m(22,Uv),m(23,Le),m(24,Te)],oN);function Oho(a,i){if(a.byteLength===a.buffer.byteLength)return a;{let e=new Uint8Array(a);return i.push(e.buffer),e}}function Fho(){let a=ic.getColorMap();return a?A_(a):""}function DJo(a){try{return decodeURIComponent(a)}catch{return a}}var Htt=class extends Rp{get activeCell(){return this.currentCell}constructor(i,e){super()}didRenderCell(i){super.didRenderCell(i)}unrenderCell(i){super.unrenderCell(i)}updateInternalLayoutNow(i){}dispose(){super.dispose()}};var Ihe=class extends Rp{constructor(e,t,o,n,r,s){super();this.notebookEditor=e;this.container=t;this.contextKeyService=o;this.themeService=n;this.commentService=r;this.instantiationService=s;this.container.classList.add("review-widget"),this._register(this._commentThreadWidgets=new Vt),this._register(this.themeService.onDidColorThemeChange(this._applyTheme,this)),this._applyTheme()}async initialize(e){this.currentElement!==e&&(this.currentElement=e,await this._updateThread())}async _createCommentTheadWidget(e,t){let o=new N,n=this.instantiationService.createInstance(uZ,this.container,this.notebookEditor,e,this.notebookEditor.textModel.uri,this.contextKeyService,this.instantiationService,t,void 0,void 0,{},void 0,{actionRunner:()=>{},collapse:async()=>!0});o.add(n),this._commentThreadWidgets.set(t.threadId,{widget:n,dispose:()=>o.dispose()});let r=this.notebookEditor.getLayoutInfo();await n.display(r.fontInfo.lineHeight,!0),this._applyTheme(),o.add(n.onDidResize(()=>{this.currentElement&&(this.currentElement.commentHeight=this._calculateCommentThreadHeight(n.getDimensions().height))}))}_bindListeners(){this.cellDisposables.add(this.commentService.onDidUpdateCommentThreads(async()=>this._updateThread()))}async _updateThread(){if(!this.currentElement)return;let e=await this._getCommentThreadsForCell(this.currentElement),t=new Set(this._commentThreadWidgets.keys()),o=this.currentElement.layoutInfo;this.container.style.top=`${o.commentOffset}px`;for(let n of e)if(n)for(let r of n.threads){t.delete(r.threadId);let s=this._commentThreadWidgets.get(r.threadId)?.widget;s?await s.updateCommentThread(r):await this._createCommentTheadWidget(n.uniqueOwner,r)}for(let n of t)this._commentThreadWidgets.deleteAndDispose(n);this._updateHeight()}_calculateCommentThreadHeight(e){let t=this.notebookEditor.getLayoutInfo(),o=Math.ceil(t.fontInfo.lineHeight*1.2),n=t.fontInfo.lineHeight,r=Math.round(n/3),s=Math.round(n/9)*2;return o+e+r+s+8}_updateHeight(){if(!this.currentElement)return;let e=0;for(let{widget:t}of this._commentThreadWidgets.values())e+=this._calculateCommentThreadHeight(t.getDimensions().height);this.currentElement.commentHeight=e}async _getCommentThreadsForCell(e){return this.notebookEditor.hasModel()?di(await this.commentService.getNotebookComments(e.uri)):[]}_applyTheme(){let e=this.notebookEditor.getLayoutInfo().fontInfo;for(let{widget:t}of this._commentThreadWidgets.values())t.applyTheme(e)}didRenderCell(e){this.initialize(e),this._bindListeners()}prepareLayout(){this._updateHeight()}updateInternalLayoutNow(e){this.currentElement&&(this.container.style.top=`${e.layoutInfo.commentOffset}px`)}};Ihe=I([m(2,X),m(3,Le),m(4,Om),m(5,F)],Ihe);var Utt=class extends Rp{constructor(e,t,o){super();this.notebookEditor=e;this.rootContainer=t;this.decorationContainer=o}didRenderCell(e){let t=[];this.rootContainer.classList.forEach(n=>{/^nb\-.*$/.test(n)&&t.push(n)}),t.forEach(n=>{this.rootContainer.classList.remove(n)}),this.decorationContainer.innerText="";let o=()=>{this.decorationContainer.innerText="",e.getCellDecorations().filter(n=>n.topClassName!==void 0).forEach(n=>{this.decorationContainer.append(_(`.${n.topClassName}`))})};this.cellDisposables.add(e.onCellDecorationsChanged(n=>{(n.added.find(s=>s.topClassName)||n.removed.find(s=>s.topClassName))&&o()})),o(),this.registerDecorations()}registerDecorations(){this.currentCell&&(this.cellDisposables.add(this.currentCell.onCellDecorationsChanged(e=>{e.added.forEach(t=>{t.className&&this.currentCell&&this.rootContainer.classList.add(t.className)}),e.removed.forEach(t=>{t.className&&this.currentCell&&this.rootContainer.classList.remove(t.className)})})),this.currentCell.getCellDecorations().forEach(e=>{e.className&&this.currentCell&&(this.rootContainer.classList.add(e.className),this.notebookEditor.deltaCellContainerClassNames(this.currentCell.id,[e.className],[],this.currentCell.cellKind)),e.outputClassName&&this.currentCell&&this.notebookEditor.deltaCellContainerClassNames(this.currentCell.id,[e.outputClassName],[],this.currentCell.cellKind)}))}};var KEi=class a{static{this._ttPolicy=pf("cellRendererEditorText",{createHTML(i){return i}})}getRichText(i,e){let t=i.getModel();if(!t)return null;let o=this.getDefaultColorMap(),n=i.getOptions().get(59),r="--notebook-editor-font-family",s="--notebook-editor-font-size",l="--notebook-editor-font-weight",c=`color: ${o[1]};background-color: ${o[2]};font-family: var(${r});font-weight: var(${l});font-size: var(${s});line-height: ${n.lineHeight}px;white-space: pre;`,u=_("div",{style:c}),p=n.fontSize,h=n.fontWeight;u.style.setProperty(r,n.fontFamily),u.style.setProperty(s,`${p}px`),u.style.setProperty(l,h);let g=this.getRichTextLinesAsHtml(t,e,o);return u.innerHTML=g,u}getRichTextLinesAsHtml(i,e,t){let o=e.startLineNumber,n=e.startColumn,r=e.endLineNumber,s=e.endColumn,l=i.getOptions().tabSize,c="";for(let u=o;u<=r;u++){let p=i.tokenization.getLineTokens(u),h=p.getLineContent(),g=u===o?n-1:0,f=u===r?s-1:h.length;h===""?c+="<br>":c+=oyt(h,p.inflate(),t,g,f,l,ei)}return a._ttPolicy?.createHTML(c)??c}getDefaultColorMap(){let i=ic.getColorMap(),e=["#000000"];if(i)for(let t=1,o=i.length;t<o;t++)e[t]=We.Format.CSS.formatHex(i[t]);return e}},qUt=class{getDragImage(i,e,t){let o=this.getDragImageImpl(i,e,t);return o||(o=document.createElement("div"),o.textContent="1 cell"),o}getDragImageImpl(i,e,t){let o=i.container.cloneNode(!0);o.classList.forEach(s=>o.classList.remove(s)),o.classList.add("cell-drag-image","monaco-list-row","focused",`${t}-cell-row`);let n=o.querySelector(".cell-editor-container");if(!n)return null;let r=new KEi().getRichText(e,new z(1,1,1,1e3));return r?(vi(n,r),o):null}};var oW=class extends Rp{constructor(e,t,o){super();this.base=e;this.notebookOptions=t;this.configurationService=o;this._lineNumbers="inherit";this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._register(e.onDidChange(()=>{this._recomputeOptions()})),this._value=this._computeEditorOptions()}set tabSize(e){this._tabSize!==e&&(this._tabSize=e,this._onDidChange.fire())}get tabSize(){return this._tabSize}set indentSize(e){this._indentSize!==e&&(this._indentSize=e,this._onDidChange.fire())}get indentSize(){return this._indentSize}set insertSpaces(e){this._insertSpaces!==e&&(this._insertSpaces=e,this._onDidChange.fire())}get insertSpaces(){return this._insertSpaces}updateState(e,t){t.cellLineNumberChanged&&this.setLineNumbers(e.lineNumbers)}_recomputeOptions(){this._value=this._computeEditorOptions(),this._onDidChange.fire()}_computeEditorOptions(){let e=this.base.value,t=this.notebookOptions.getDisplayOptions().editorOptionsCustomizations,o=t?.["editor.indentSize"];o!==void 0&&(this.indentSize=o);let n=t?.["editor.insertSpaces"];n!==void 0&&(this.insertSpaces=n);let r=t?.["editor.tabSize"];r!==void 0&&(this.tabSize=r);let s=e.lineNumbers;switch(this._lineNumbers){case"inherit":this.configurationService.getValue("notebook.lineNumbers")==="on"?e.lineNumbers==="off"&&(s="on"):s="off";break;case"on":e.lineNumbers==="off"&&(s="on");break;case"off":s="off";break}let l={};return e.lineNumbers!==s&&(l.lineNumbers=s),this.notebookOptions.getLayoutConfiguration().disableRulers&&(l.rulers=[]),{...e,...l}}getUpdatedValue(e,t){let o=this.getValue(e,t);return delete o.hover,o}getValue(e,t){return{...this._value,padding:this.notebookOptions.computeEditorPadding(e,t)}}getDefaultValue(){return{...this._value,padding:{top:12,bottom:12}}}setLineNumbers(e){this._lineNumbers=e,this._recomputeOptions()}};ne.as(Jt.Configuration).registerConfiguration({id:"notebook",order:100,type:"object",properties:{"notebook.lineNumbers":{type:"string",enum:["off","on"],default:"off",markdownDescription:d(12774,null)}}});W(class extends K{constructor(){super({id:"notebook.toggleLineNumbers",title:L(12776,"Toggle Notebook Line Numbers"),shortTitle:L(12777,"Line Numbers"),precondition:pr,menu:[{id:D.NotebookToolbar,group:"notebookLayout",order:2,when:C.equals("config.notebook.globalToolbar",!0)}],category:th,f1:!0,toggled:{condition:C.notEquals("config.notebook.lineNumbers","off"),title:d(12775,null)}})}async run(i){let e=i.get(B);e.getValue("notebook.lineNumbers")==="on"?e.updateValue("notebook.lineNumbers","off"):e.updateValue("notebook.lineNumbers","on")}});W(class extends Hg{constructor(){super({id:"notebook.cell.toggleLineNumbers",title:d(12773,null),precondition:fr.isEqualTo(MR),menu:[{id:D.NotebookCellTitle,group:"View",order:1}],toggled:C.or(ftt.isEqualTo("on"),C.and(ftt.isEqualTo("inherit"),C.equals("config.notebook.lineNumbers","on")))})}async runWithContext(i,e){if(e.ui)this.updateCell(i.get(B),e.cell);else{let t=i.get(B);e.selectedCells.forEach(o=>{this.updateCell(t,o)})}}updateCell(i,e){let t=i.getValue("notebook.lineNumbers")==="on",o=e.lineNumbers;o==="on"||o==="inherit"&&t?e.lineNumbers="off":e.lineNumbers="on"}});var LJo=200,WPe=class extends Rp{constructor(e,t,o){super();this._notebookEditor=e;this._executionOrderLabel=t;this._notebookExecutionStateService=o;this.kernelDisposables=this._register(new N);this._executionOrderLabel.classList.add("cell-execution-order"),this._executionOrderContent=M(this._executionOrderLabel,_("div")),this._register(this._notebookExecutionStateService.onDidChangeExecution(n=>{this.currentCell&&No(n,{affectsCell:!0})&&n.affectsCell(this.currentCell.uri)&&this._updatePosition()})),this._register(this._notebookEditor.onDidChangeActiveKernel(()=>{this.currentCell&&(this.kernelDisposables.clear(),this._notebookEditor.activeKernel&&this.kernelDisposables.add(this._notebookEditor.activeKernel.onDidChange(()=>{this.currentCell&&this.updateExecutionOrder(this.currentCell.internalMetadata)})),this.updateExecutionOrder(this.currentCell.internalMetadata))})),this._register(this._notebookEditor.onDidScroll(()=>{this._updatePosition()}))}didRenderCell(e){this.updateExecutionOrder(e.internalMetadata,!0)}updateState(e,t){t.internalMetadataChanged&&this.updateExecutionOrder(e.internalMetadata)}updateExecutionOrder(e,t=!1){if(this._notebookEditor.activeKernel?.implementsExecutionOrder||!this._notebookEditor.activeKernel&&typeof e.executionOrder=="number"){if(typeof e.executionOrder!="number"&&!t&&this._notebookExecutionStateService.getCellExecution(this.currentCell.uri)){let n=this.currentCell;tn(()=>{this.currentCell===n&&(this.updateExecutionOrder(this.currentCell.internalMetadata,!0),this._updatePosition())},LJo,this.cellDisposables);return}let o=typeof e.executionOrder=="number"?`[${e.executionOrder}]`:"[ ]";this._executionOrderContent.innerText=o,this._updatePosition()}else this._executionOrderContent.innerText=""}updateInternalLayoutNow(e){this._updatePosition()}_updatePosition(){if(!this.currentCell)return;if(this.currentCell.isInputCollapsed){vo(this._executionOrderLabel);return}let e=!!this._notebookExecutionStateService.getCellExecution(this.currentCell.uri),t=this._executionOrderLabel.classList.contains("sticky");if(!e&&(this._executionOrderLabel.classList.remove("sticky"),t)){let n=this.currentCell.internalMetadata.executionOrder,r=typeof n=="number"?`[${n}]`:"[ ]";this._executionOrderContent.innerText=r}un(this._executionOrderLabel);let o=this.currentCell.layoutInfo.editorHeight-22+this.currentCell.layoutInfo.statusBarHeight;if(this.currentCell instanceof ih){let r=this._notebookEditor.getAbsoluteTopOfElement(this.currentCell)+this.currentCell.layoutInfo.outputContainerOffset,s=this._notebookEditor.scrollBottom,l=22,c=this.currentCell.layoutInfo.statusBarHeight>0,u=r-s;if(o-=u,o=Bn(o,l+12,this.currentCell.layoutInfo.editorHeight-l+this.currentCell.layoutInfo.statusBarHeight),s<=r&&e){if(!this._executionOrderContent.classList.contains("sticky-spinner")){this._executionOrderLabel.classList.add("sticky-spinner"),Rt(this._executionOrderContent);let h=q.modify(Qw,"spin");M(this._executionOrderContent,...Un(`$(${h.id})`))}}else if(!c&&e){let p=this._executionOrderLabel.classList.contains("sticky");this._executionOrderLabel.classList.remove("sticky"),o=this.currentCell.layoutInfo.editorHeight-l;let h=this._executionOrderContent.querySelector(".codicon")!==null;if(p||h){let g=this.currentCell.internalMetadata.executionOrder,f=typeof g=="number"?`[${g}]`:"[ ]";this._executionOrderContent.innerText=f}}else{let p=this._executionOrderLabel.classList.contains("sticky");if(this._executionOrderLabel.classList.remove("sticky"),p){let h=this.currentCell.internalMetadata.executionOrder,g=typeof h=="number"?`[${h}]`:"[ ]";this._executionOrderContent.innerText=g}}}this._executionOrderLabel.style.top=`${o}px`}};WPe=I([m(2,bs)],WPe);var ztt=class extends Rp{constructor(i,e,t){super(),this._register(j(i,re.FOCUS,()=>{this.currentCell&&t.focusElement(this.currentCell)},!0)),e&&this._register(j(e,re.FOCUS,()=>{this.currentCell&&this.currentCell.outputsViewModels.length&&t.focusNotebookCell(this.currentCell,"output")}))}};var Ktt=class extends Rp{constructor(e,t,o,n,r,s){super();this.notebookEditor=e;this.titleToolbar=t;this.top=o;this.left=n;this.right=r;this.bottom=s;this.codeFocusIndicator=new cf(M(this.left.domNode,_(".codeOutput-focus-indicator-container",void 0,_(".codeOutput-focus-indicator.code-focus-indicator")))),this.outputFocusIndicator=new cf(M(this.left.domNode,_(".codeOutput-focus-indicator-container",void 0,_(".codeOutput-focus-indicator.output-focus-indicator")))),this._register(j(this.codeFocusIndicator.domNode,re.CLICK,()=>{this.currentCell&&(this.currentCell.isInputCollapsed=!this.currentCell.isInputCollapsed)})),this._register(j(this.outputFocusIndicator.domNode,re.CLICK,()=>{this.currentCell&&(this.currentCell.isOutputCollapsed=!this.currentCell.isOutputCollapsed)})),this._register(j(this.left.domNode,re.DBLCLICK,l=>{if(!this.currentCell||!this.notebookEditor.hasModel()||l.target!==this.left.domNode)return;l.offsetY<this.currentCell.layoutInfo.outputContainerOffset?this.currentCell.isInputCollapsed=!this.currentCell.isInputCollapsed:this.currentCell.isOutputCollapsed=!this.currentCell.isOutputCollapsed})),this._register(this.titleToolbar.onDidUpdateActions(()=>{this.updateFocusIndicatorsForTitleMenu()}))}updateInternalLayoutNow(e){if(e.cellKind===1){let t=this.notebookEditor.notebookOptions.computeIndicatorPosition(e.layoutInfo.totalHeight,e.layoutInfo.foldHintHeight,this.notebookEditor.textModel?.viewType);this.bottom.domNode.style.transform=`translateY(${t.bottomIndicatorTop+6}px)`,this.left.setHeight(t.verticalIndicatorHeight),this.right.setHeight(t.verticalIndicatorHeight),this.codeFocusIndicator.setHeight(t.verticalIndicatorHeight-this.getIndicatorTopMargin()*2-e.layoutInfo.chatHeight)}else{let t=e,o=this.notebookEditor.notebookOptions.getLayoutConfiguration(),n=this.notebookEditor.notebookOptions.computeBottomToolbarDimensions(this.notebookEditor.textModel?.viewType),r=t.layoutInfo.codeIndicatorHeight+t.layoutInfo.outputIndicatorHeight+t.layoutInfo.commentHeight;this.left.setHeight(r),this.right.setHeight(r),this.codeFocusIndicator.setHeight(t.layoutInfo.codeIndicatorHeight),this.outputFocusIndicator.setHeight(Math.max(t.layoutInfo.outputIndicatorHeight-t.viewContext.notebookOptions.getLayoutConfiguration().focusIndicatorGap,0)),this.bottom.domNode.style.transform=`translateY(${t.layoutInfo.totalHeight-n.bottomToolbarGap-o.cellBottomMargin}px)`}this.updateFocusIndicatorsForTitleMenu()}updateFocusIndicatorsForTitleMenu(){let e=(this.currentCell?.layoutInfo.chatHeight??0)+this.getIndicatorTopMargin();this.left.domNode.style.transform=`translateY(${e}px)`,this.right.domNode.style.transform=`translateY(${e}px)`}getIndicatorTopMargin(){let e=this.notebookEditor.notebookOptions.getLayoutConfiguration();return this.titleToolbar.hasActions?e.editorToolbarHeight+e.cellTopMargin:e.cellTopMargin}};var VPe=class extends Rp{constructor(e,t,o){super();this._notebookExecutionStateService=o;this._progressBar=this._register(new Zf(e,vw)),this._progressBar.hide(),this._collapsedProgressBar=this._register(new Zf(t,vw)),this._collapsedProgressBar.hide()}didRenderCell(e){this._updateForExecutionState(e)}updateForExecutionState(e,t){this._updateForExecutionState(e,t)}updateState(e,t){if((t.metadataChanged||t.internalMetadataChanged)&&this._updateForExecutionState(e),t.inputCollapsedChanged){let o=this._notebookExecutionStateService.getCellExecution(e.uri);e.isInputCollapsed?(this._progressBar.hide(),o?.state===3&&this._updateForExecutionState(e)):(this._collapsedProgressBar.hide(),o?.state===3&&this._updateForExecutionState(e))}}_updateForExecutionState(e,t){let o=t?.changed??this._notebookExecutionStateService.getCellExecution(e.uri),n=e.isInputCollapsed?this._collapsedProgressBar:this._progressBar;o?.state===3&&(!o.didPause||e.isInputCollapsed)?RJo(n):n.hide()}};VPe=I([m(2,bs)],VPe);function RJo(a){a.infinite().show(500)}var BPe=_,yhe=class extends Rp{constructor(e,t,o,n,r,s,l,c){super();this._notebookEditor=e;this._cellContainer=t;this._editor=n;this._instantiationService=r;this._themeService=c;this.leftItems=[];this.rightItems=[];this.width=0;this._onDidClick=this._register(new E);this.onDidClick=this._onDidClick.event;this.statusBarContainer=M(o,BPe(".cell-statusbar-container")),this.statusBarContainer.tabIndex=-1;let u=M(this.statusBarContainer,BPe(".cell-status-left")),p=M(this.statusBarContainer,BPe(".cell-status-right"));this.leftItemsContainer=M(u,BPe(".cell-contributed-items.cell-contributed-items-left")),this.rightItemsContainer=M(p,BPe(".cell-contributed-items.cell-contributed-items-right")),this.itemsDisposable=this._register(new N),this.hoverDelegate=new class{constructor(){this._lastHoverHideTime=0;this.showHover=h=>(h.position=h.position??{},h.position.hoverPosition=3,s.showInstantHover(h));this.placement="element"}get delay(){return Date.now()-this._lastHoverHideTime<200?0:l.getValue("workbench.hover.delay")}onDidHideHover(){this._lastHoverHideTime=Date.now()}},this._register(this._themeService.onDidColorThemeChange(()=>this.currentContext&&this.updateContext(this.currentContext))),this._register(j(this.statusBarContainer,re.CLICK,h=>{if(h.target===u||h.target===p||h.target===this.statusBarContainer)this._onDidClick.fire({type:0,event:h});else{let g=h.target,f=!1;if(g&&Do(g)){let v=g;(v.classList.contains("cell-status-item-has-command")||v.parentElement&&v.parentElement.classList.contains("cell-status-item-has-command"))&&(f=!0)}f?this._onDidClick.fire({type:2,event:h}):this._onDidClick.fire({type:1,event:h})}}))}didRenderCell(e){if(this._notebookEditor.hasModel()){let t={ui:!0,cell:e,notebookEditor:this._notebookEditor,$mid:13};this.updateContext(t)}if(this._editor){let t=()=>{if(this._editor&&(this._editor.hasWidgetFocus()||this.statusBarContainer.ownerDocument.activeElement&&this.statusBarContainer.contains(this.statusBarContainer.ownerDocument.activeElement)))e.focusMode=1;else{let o=e.focusMode;o===3?e.focusMode=3:o===2&&this._notebookEditor.hasWebviewFocus()?e.focusMode=2:e.focusMode=0}};this.cellDisposables.add(this._editor.onDidFocusEditorWidget(()=>{t()})),this.cellDisposables.add(this._editor.onDidBlurEditorWidget(()=>{this._notebookEditor.hasEditorFocus()&&!(this.statusBarContainer.ownerDocument.activeElement&&this.statusBarContainer.contains(this.statusBarContainer.ownerDocument.activeElement))&&t()})),this.cellDisposables.add(this.onDidClick(o=>{if(this.currentCell instanceof ih&&o.type!==2&&this._editor){let n=this._editor.getTargetAtClientPoint(o.event.clientX,o.event.clientY-this._notebookEditor.notebookOptions.computeEditorStatusbarHeight(this.currentCell.internalMetadata,this.currentCell.uri));n?.position&&(this._editor.setPosition(n.position),this._editor.focus())}}))}}updateInternalLayoutNow(e){this._cellContainer.classList.toggle("cell-statusbar-hidden",this._notebookEditor.notebookOptions.computeEditorStatusbarHeight(e.internalMetadata,e.uri)===0);let o=e.layoutInfo.editorWidth;if(!o)return;this.width=o,this.statusBarContainer.style.width=`${o}px`;let n=this.getMaxItemWidth();this.leftItems.forEach(r=>r.maxWidth=n),this.rightItems.forEach(r=>r.maxWidth=n)}getMaxItemWidth(){return this.width/2}updateContext(e){this.currentContext=e,this.itemsDisposable.clear(),this.currentContext&&(this.itemsDisposable.add(this.currentContext.cell.onDidChangeLayout(()=>{this.currentContext&&this.updateInternalLayoutNow(this.currentContext.cell)})),this.itemsDisposable.add(this.currentContext.cell.onDidChangeCellStatusBarItems(()=>this.updateRenderedItems())),this.itemsDisposable.add(this.currentContext.notebookEditor.onDidChangeActiveCell(()=>this.updateActiveCell())),this.updateInternalLayoutNow(this.currentContext.cell),this.updateActiveCell(),this.updateRenderedItems())}updateActiveCell(){let e=this.currentContext.notebookEditor.getActiveCell()===this.currentContext?.cell;this.statusBarContainer.classList.toggle("is-active-cell",e)}updateRenderedItems(){let e=this.currentContext.cell.getCellStatusBarItems();e.sort((s,l)=>(l.priority??0)-(s.priority??0));let t=this.getMaxItemWidth(),o=e.filter(s=>s.alignment===1),n=e.filter(s=>s.alignment===2).reverse(),r=(s,l,c)=>{if(s.length>l.length){let u=s.splice(l.length,s.length-l.length);for(let p of u)p.container.remove(),p.dispose()}l.forEach((u,p)=>{let h=s[p];if(h)h.updateItem(u,t);else{let g=this._instantiationService.createInstance(Gtt,this.currentContext,this.hoverDelegate,this._editor,u,t);s.push(g),c.appendChild(g.container)}})};r(this.leftItems,o,this.leftItemsContainer),r(this.rightItems,n,this.rightItemsContainer)}dispose(){super.dispose(),Be(this.leftItems),Be(this.rightItems)}};yhe=I([m(4,F),m(5,nt),m(6,B),m(7,Le)],yhe);var Gtt=class extends x{constructor(e,t,o,n,r,s,l,c,u,p){super();this._context=e;this._hoverDelegate=t;this._editor=o;this._telemetryService=s;this._commandService=l;this._notificationService=c;this._themeService=u;this._hoverService=p;this.container=BPe(".cell-status-item");this._itemDisposables=this._register(new N);this.updateItem(n,r)}set maxWidth(e){this.container.style.maxWidth=e+"px"}updateItem(e,t){this._itemDisposables.clear(),(!this._currentItem||this._currentItem.text!==e.text)&&(this._itemDisposables.add(new hx(this.container)).text=e.text.replace(/\n/g," "));let o=s=>lye(s)?this._themeService.getColorTheme().getColor(s.id)?.toString()||"":s;this.container.style.color=e.color?o(e.color):"",this.container.style.backgroundColor=e.backgroundColor?o(e.backgroundColor):"",this.container.style.opacity=e.opacity?e.opacity:"",this.container.classList.toggle("cell-status-item-show-when-active",!!e.onlyShowWhenActive),typeof t=="number"&&(this.maxWidth=t);let n,r;if(e.accessibilityInformation?(n=e.accessibilityInformation.label,r=e.accessibilityInformation.role):n=e.text?Nu(e.text).trim():"",this.container.setAttribute("aria-label",n),this.container.setAttribute("role",r||""),e.tooltip){let s=typeof e.tooltip=="string"?e.tooltip:{markdown:e.tooltip,markdownNotSupportedFallback:void 0};this._itemDisposables.add(this._hoverService.setupManagedHover(this._hoverDelegate,this.container,s))}this.container.classList.toggle("cell-status-item-has-command",!!e.command),e.command?(this.container.tabIndex=0,this._itemDisposables.add(j(this.container,re.CLICK,s=>{this.executeCommand()})),this._itemDisposables.add(j(this.container,re.KEY_DOWN,s=>{let l=new gi(s);(l.equals(10)||l.equals(3))&&this.executeCommand()}))):this.container.removeAttribute("tabIndex"),this._currentItem=e}async executeCommand(){let e=this._currentItem.command;if(!e)return;let t=typeof e=="string"?e:e.id,o=typeof e=="string"?[]:e.arguments??[];(typeof e=="string"||!e.arguments||!Array.isArray(e.arguments)||e.arguments.length===0)&&o.unshift(this._context),this._telemetryService.publicLog2("workbenchActionExecuted",{id:t,from:"cell status bar"});try{this._editor?.focus(),await this._commandService.executeCommand(t,...o)}catch(n){this._notificationService.error(xn(n))}}};Gtt=I([m(5,Te),m(6,ge),m(7,Ne),m(8,Le),m(9,nt)],Gtt);var xM=class extends xl{updateLabel(){this.options.label&&this.label&&vi(this.label,...Un(this._commandAction.label??""))}},HPe=class extends xl{render(i){super.render(i),i.classList.add("notebook-action-view-item"),this._actionLabel=document.createElement("a"),i.appendChild(this._actionLabel),this.updateLabel()}updateLabel(){this._actionLabel&&(this._actionLabel.classList.add("notebook-label"),this._actionLabel.innerText=this._action.label)}},S8=class extends VE{constructor(e,t,o,n,r,s,l,c,u){super(e,{...t,hoverDelegate:t?.hoverDelegate??Ri("element")},s,l,c);this._renderLabel=o;this.subActionProvider=n;this.subActionViewItemProvider=r;this._hoverService=u}render(e){super.render(e),e.classList.add("notebook-action-view-item"),e.classList.add("notebook-action-view-item-unified"),this._actionLabel=document.createElement("a"),e.appendChild(this._actionLabel),this._hover=this._register(this._hoverService.setupManagedHover(this.options.hoverDelegate??Ri("element"),this._actionLabel,"")),this.updateLabel();for(let t of[re.CLICK,re.MOUSE_DOWN,Kn.Tap])this._register(j(e,t,o=>this.onClick(o,!0)))}onClick(e,t=!1){Xt.stop(e,!0);let o=nr(this._context)?this.options?.useEventAsContext?e:{preserveFocus:t}:this._context;this.actionRunner.run(this._primaryAction??this._action,o)}updateLabel(){let e=this.subActionProvider.getActions();if(this._actionLabel){let t=e[0];if(this._primaryAction=t,t&&t instanceof Lo){let o=this.element;if(o&&t.item.icon&&q.isThemeIcon(t.item.icon)){let n=q.asClassNameArray(t.item.icon);o.classList.forEach(r=>{r.startsWith("codicon-")&&o.classList.remove(r)}),o.classList.add(...n)}this._renderLabel&&(this._actionLabel.classList.add("notebook-label"),this._actionLabel.innerText=this._action.label,this._hover?.update(t.tooltip.length?t.tooltip:t.label))}else this._renderLabel&&(this._actionLabel.classList.add("notebook-label"),this._actionLabel.innerText=this._action.label,this._hover?.update(this._action.tooltip.length?this._action.tooltip:this._action.label))}}};S8=I([m(5,_e),m(6,Xe),m(7,Le),m(8,nt)],S8);function $Ut(a,i,e,t){let o=t?.extraOffset??0,n=t?.min??0,r=()=>{if(i.isInputCollapsed)e.style.top="";else{let l=a.scrollTop,c=a.getAbsoluteTopOfElement(i),u=l-c+o,p=i.layoutInfo.editorHeight+i.layoutInfo.statusBarHeight-45,h=p>20?Bn(n,u,p):n;e.style.top=`${h}px`}};r();let s=[];return s.push(a.onDidScroll(()=>r()),a.onDidChangeLayout(()=>r())),wn(...s)}var whe=class extends Ott{constructor(e,t,o,n,r,s,l){super();this._notebookEditor=e;this._bottomCellToolbarContainer=o;this.instantiationService=n;this.contextMenuService=r;this.contextKeyService=s;this.menuService=l}_initialize(){if(this._betweenCellToolbar)return this._betweenCellToolbar;let e=this._register(new wp(this._bottomCellToolbarContainer,this.contextMenuService,{actionViewItemProvider:(n,r)=>{if(n instanceof Lo)return this._notebookEditor.notebookOptions.getDisplayOptions().insertToolbarAlignment==="center"?this.instantiationService.createInstance(xM,n,{hoverDelegate:r.hoverDelegate}):this.instantiationService.createInstance(xl,n,{hoverDelegate:r.hoverDelegate})}}));this._betweenCellToolbar=e;let t=this._register(this.menuService.createMenu(this._notebookEditor.creationOptions.menuIds.cellInsertToolbar,this.contextKeyService)),o=()=>{let n=qtt(t);e.setActions(n.primary,n.secondary)};return this._register(t.onDidChange(()=>o())),this._register(this._notebookEditor.notebookOptions.onDidChangeOptions(n=>{n.insertToolbarAlignment&&o()})),o(),e}didRenderCell(e){let t=this._initialize();this._notebookEditor.hasModel()&&(t.context={ui:!0,cell:e,notebookEditor:this._notebookEditor,source:"insertToolbar",$mid:13}),this.updateInternalLayoutNow(e)}updateInternalLayoutNow(e){let t=e.layoutInfo.bottomToolbarOffset;this._bottomCellToolbarContainer.style.transform=`translateY(${t}px)`}};whe=I([m(3,F),m(4,Xe),m(5,X),m(6,Kt)],whe);var Che=class extends Ott{constructor(e,t,o,n,r,s,l,c){super();this.toolbarContainer=e;this._rootClassDelegate=t;this.toolbarId=o;this.deleteToolbarId=n;this._notebookEditor=r;this.contextKeyService=s;this.menuService=l;this.instantiationService=c;this._onDidUpdateActions=this._register(new E);this.onDidUpdateActions=this._onDidUpdateActions.event}get hasActions(){return this._model?this._model.actions.primary.length+this._model.actions.secondary.length+this._model.deleteActions.primary.length+this._model.deleteActions.secondary.length>0:!1}_initializeModel(){if(this._model)return this._model;let e=this._register(this.menuService.createMenu(this.toolbarId,this.contextKeyService)),t=this._register(this.menuService.createMenu(this.deleteToolbarId,this.contextKeyService)),o=qtt(e),n=qtt(t);return this._model={titleMenu:e,actions:o,deleteMenu:t,deleteActions:n},this._model}_initialize(e,t){if(this._view)return this._view;let o=this._register(Qh()),n=this._register(this.instantiationService.createInstance(ol,this.toolbarContainer,{actionViewItemProvider:(s,l)=>Bs(this.instantiationService,s,l),renderDropdownAsChildElement:!0,hoverDelegate:o})),r=this._register(this.instantiationService.invokeFunction(s=>MJo(s,this.toolbarContainer,o,"cell-delete-toolbar")));return(e.deleteActions.primary.length!==0||e.deleteActions.secondary.length!==0)&&r.setActions(e.deleteActions.primary,e.deleteActions.secondary),this.setupChangeListeners(n,e.titleMenu,e.actions),this.setupChangeListeners(r,e.deleteMenu,e.deleteActions),this._view={toolbar:n,deleteToolbar:r},this._view}prepareRenderCell(e){this._initializeModel()}didRenderCell(e){let t=this._initializeModel(),o=this._initialize(t,e);if(this.cellDisposables.add($Ut(this._notebookEditor,e,this.toolbarContainer,{extraOffset:4,min:-14})),this._notebookEditor.hasModel()){let n={ui:!0,cell:e,notebookEditor:this._notebookEditor,source:"cellToolbar",$mid:13};this.updateContext(o,n)}}updateContext(e,t){e.toolbar.context=t,e.deleteToolbar.context=t}setupChangeListeners(e,t,o){let n=!1,r;this.updateActions(e,o),this._register(t.onDidChange(()=>{if(n){let l=qtt(t);r=()=>this.updateActions(e,l);return}let s=qtt(t);this.updateActions(e,s)})),this._rootClassDelegate.toggle("cell-toolbar-dropdown-active",!1),this._register(e.onDidChangeDropdownVisibility(s=>{n=s,this._rootClassDelegate.toggle("cell-toolbar-dropdown-active",s),r&&!s&&(tn(()=>{r?.()},0,this._store),r=void 0)}))}updateActions(e,t){let o=Gr(e.getElement());e.setActions(t.primary,t.secondary),o&&this._notebookEditor.focus(),t.primary.length||t.secondary.length?(this._rootClassDelegate.toggle("cell-has-toolbar-actions",!0),this._onDidUpdateActions.fire()):(this._rootClassDelegate.toggle("cell-has-toolbar-actions",!1),this._onDidUpdateActions.fire())}};Che=I([m(5,X),m(6,Kt),m(7,F)],Che);function qtt(a){return ml(a.getActions({shouldForwardArgs:!0}),i=>/^inline/.test(i))}function MJo(a,i,e,t){let o=a.get(Xe),n=a.get(_e),r=a.get(F),s=new wp(i,o,{getKeyBinding:l=>n.lookupKeybinding(l.id),actionViewItemProvider:(l,c)=>Bs(r,l,c),renderDropdownAsChildElement:!0,hoverDelegate:e});return t&&s.getElement().classList.add(t),s}var $tt=pf("collapsedCellPreview",{createHTML:a=>a});var GEi="notebook.cellOutput.copy";W(class extends K{constructor(){super({id:"notebook.cellOuput.showEmptyOutputs",title:d(12431,null),menu:{id:D.NotebookOutputToolbar,when:C.and(Bk,nUt)},f1:!1,category:th})}run(i,e){let t=e.cell;if(t&&t.cellKind===2)for(let o=1;o<t.outputsViewModels.length;o++)t.outputsViewModels[o].visible.get()||(t.outputsViewModels[o].setVisible(!0,!0),t.updateOutputHeight(o,1,"command"))}});W(class extends K{constructor(){super({id:GEi,title:d(12427,null),menu:{id:D.NotebookOutputToolbar,when:Bk},category:th,icon:Stt})}async run(i,e){let t=i.get(ee),o=i.get(Fi),n=i.get(se),r=jUt(t,e);if(!r)return;let s=QUt(e,r);if(!s)return;let l=s.pickedMimeType?.mimeType;if(l?.startsWith("image/")){let c={skipReveal:!0,outputId:s.model.outputId,altOutputId:s.model.alternativeOutputId};await r.focusNotebookCell(s.cellViewModel,"output",c),r.copyOutputImage(s)}else Nho(l,s,o,n)}});function jtt(a,i){let e=i.getViewModel();if(e){let t=e.viewCells.filter(o=>o.cellKind===2);for(let o of t){let n=o.outputsViewModels.find(r=>r.model.outputId===a||r.model.alternativeOutputId===a);if(n)return n}}}function jUt(a,i){return i&&"notebookEditor"in i?i.notebookEditor:Jn(a.activeEditorPane)}function QUt(a,i){let e;if(a&&"outputId"in a&&typeof a.outputId=="string"?e=jtt(a.outputId,i):a&&"outputViewModel"in a&&(e=a.outputViewModel),!e){let t=i.getActiveCell();if(!t)return;t.focusedOutputId!==void 0?e=t.outputsViewModels.find(o=>o.model.outputId===t.focusedOutputId):e=t.outputsViewModels.find(o=>o.pickedMimeType?.isTrusted)}return e}var PJo="notebook.cellOutput.openInTextEditor";W(class extends K{constructor(){super({id:PJo,title:d(12428,null),f1:!1,category:th,icon:Stt})}async run(i,e){let t=i.get(ee),o=i.get(yh),n=i.get(Je),r=jUt(t,e);if(!r)return;let s=QUt(e,r);if(s?.model.outputId&&r.textModel?.uri){let l=await o.resolve(r.textModel.uri);await n.open(Zo.generateCellOutputUriWithId(r.textModel.uri,s.model.outputId)),l.dispose()}}});var AJo="notebook.cellOutput.saveImage";W(class extends K{constructor(){super({id:AJo,title:d(12430,null),menu:{id:D.NotebookOutputToolbar,when:C.regex(hPe.key,/^image\//)},f1:!1,category:th,icon:Mmo})}async run(i,e){let t=i.get(ee),o=i.get(rn),n=i.get(fe),r=i.get(se),s=jUt(t,e);if(!s)return;let l=QUt(e,s);if(!l)return;let c=l.pickedMimeType?.mimeType;if(!c?.startsWith("image/"))return;let u=l.model.outputs.find(b=>b.mime===c);if(!u){r.error("Could not find output item with mime type",c);return}let h={"image/png":"png","image/jpeg":"jpg","image/jpg":"jpg","image/gif":"gif","image/svg+xml":"svg","image/webp":"webp","image/bmp":"bmp","image/tiff":"tiff"}[c]||"png",g=`image.${h}`,f=s.textModel?.uri?A.joinPath(A.file(s.textModel.uri.fsPath),"..",g):void 0,v=await o.showSaveDialog({defaultUri:f,filters:[{name:d(12426,null),extensions:[h]}]});if(v)try{let b=u.data;await n.writeFile(v,b),r.info("Saved image output to",v.toString())}catch(b){r.error("Failed to save image output",b)}}});var NJo="notebook.cellOutput.openInOutputPreview";W(class extends K{constructor(){super({id:NJo,title:d(12429,null),menu:{id:D.NotebookOutputToolbar,when:C.and(Bk,C.equals("config.notebook.output.openInPreviewEditor.enabled",!0))},f1:!1,category:th})}async run(i,e){let t=i.get(ee),o=i.get(Je),n=jUt(t,e);if(!n)return;let r=QUt(e,n);if(!r)return;let s=r.cellViewModel;if(!s)return;let l=n.getCellByHandle(s.handle);if(!l)return;let c=n.getCellIndex(l);if(c===void 0)return;let u=s.outputsViewModels.indexOf(r);if(u===-1||!n.textModel)return;let p=Zo.generateOutputEditorUri(n.textModel.uri,l.id,c,r.model.outputId,u);o.open(p,{openToSide:!0})}});var I8=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this.notebookEditor=e;this.viewCell=t;this.cellOutputContainer=o;this.outputContainer=n;this.output=r;this.notebookService=s;this.quickInputService=l;this.menuService=u;this.extensionsWorkbenchService=p;this.instantiationService=h;this.toolbarDisposables=this._register(new N);this.toolbarAttached=!1;this._outputHeightTimer=null;this.contextKeyService=c,this._register(this.output.model.onDidChangeData(()=>{this.rerender()})),this._register(this.output.onDidResetRenderer(()=>{this.rerender()}))}detach(){this.renderedOutputContainer?.remove();let e=0;if(this.innerContainer){for(let t=0;t<this.innerContainer.childNodes.length&&(this.innerContainer.childNodes[t].className==="rendered-output"&&e++,!(e>1));t++);e===0&&this.innerContainer.remove()}this.notebookEditor.removeInset(this.output)}updateDOMTop(e){this.innerContainer&&(this.innerContainer.style.top=`${e}px`)}rerender(){if(this.notebookEditor.hasModel()&&this.innerContainer&&this.renderResult&&this.renderResult.type===1){let[e,t]=this.output.resolveMimeTypes(this.notebookEditor.textModel,this.notebookEditor.activeKernel?.preloadProvides),o=e[t];if(o.mimeType===this.renderResult.mimeType&&o.rendererId===this.renderResult.renderer.id){let n=this.viewCell.outputsViewModels.indexOf(this.output);this.notebookEditor.updateOutput(this.viewCell,this.renderResult,this.viewCell.getOutputOffset(n));return}}if(this.innerContainer){let e=this.innerContainer.nextElementSibling;this.toolbarDisposables.clear();let t=this.innerContainer;t&&(t.remove(),this.notebookEditor.removeInset(this.output)),this.render(e)}else{let e=this.cellOutputContainer.renderedOutputEntries.findIndex(o=>o.element===this),t=e>0&&this.cellOutputContainer.renderedOutputEntries[e-1].element.innerContainer?.parentElement?this.cellOutputContainer.renderedOutputEntries[e-1].element.innerContainer:void 0;this.render(t)}this._relayoutCell()}_generateInnerOutputContainer(e,t){return this.innerContainer=_(".output-inner-container"),e&&e.nextElementSibling?this.outputContainer.domNode.insertBefore(this.innerContainer,e.nextElementSibling):this.outputContainer.domNode.appendChild(this.innerContainer),this.innerContainer.setAttribute("output-mime-type",t.mimeType),this.innerContainer}render(e){let t=this.viewCell.outputsViewModels.indexOf(this.output);if(this.viewCell.isOutputCollapsed||!this.notebookEditor.hasModel()){this.cellOutputContainer.flagAsStale();return}if(!Zo.parse(this.viewCell.uri)?.notebook)return;let n=this.notebookEditor.textModel,[r,s]=this.output.resolveMimeTypes(n,this.notebookEditor.activeKernel?.preloadProvides),l=r[s];if(!r.find(h=>h.isTrusted)||r.length===0){this.viewCell.updateOutputHeight(t,0,"CellOutputElement#noMimeType");return}let c=r[s],u=this.notebookService.getRendererInfo(c.rendererId);!u&&c.mimeType.indexOf("text/")>-1&&(u=this.notebookService.getRendererInfo("vscode.builtin-renderer"));let p=this._generateInnerOutputContainer(e,c);if(t===0||this.output.visible.get()?this._attachToolbar(p,n,this.notebookEditor.activeKernel,t,l,r):(this._register(be(h=>{let g=h.readObservable(this.output.visible);g&&!this.toolbarAttached?this._attachToolbar(p,n,this.notebookEditor.activeKernel,t,l,r):g||this.toolbarDisposables.clear(),this.cellOutputContainer.checkForHiddenOutputs()})),this.cellOutputContainer.hasHiddenOutputs.set(!0,void 0)),this.renderedOutputContainer=M(p,_(".rendered-output")),this.renderResult=u?{type:1,renderer:u,source:this.output,mimeType:c.mimeType}:this._renderMissingRenderer(this.output,c.mimeType),this.output.pickedMimeType=c,!this.renderResult){this.viewCell.updateOutputHeight(t,0,"CellOutputElement#renderResultUndefined");return}return this.notebookEditor.createOutput(this.viewCell,this.renderResult,this.viewCell.getOutputOffset(t),!1),p.classList.add("background"),{initRenderIsSynchronous:!1}}_renderMissingRenderer(e,t){if(!e.model.outputs.length)return this._renderMessage(e,d(12779,null));if(!t){let n=e.model.outputs.map(r=>r.mime).join(", ");return this._renderMessage(e,d(12781,null,n))}return this._renderSearchForMimetype(e,t)}_renderSearchForMimetype(e,t){let o=`@tag:notebookRenderer ${t}`,n=_("p",void 0,`No renderer could be found for mimetype "${t}", but one might be available on the Marketplace.`),r=_("a",{href:`command:workbench.extensions.search?%22${o}%22`,class:"monaco-button monaco-text-button",tabindex:0,role:"button",style:"padding: 8px; text-decoration: none; color: rgb(255, 255, 255); background-color: rgb(14, 99, 156); max-width: 200px;"},"Search Marketplace");return{type:0,source:e,htmlContent:n.outerHTML+r.outerHTML}}_renderMessage(e,t){let o=_("p",void 0,t);return{type:0,source:e,htmlContent:o.outerHTML}}shouldEnableCopy(e){if(!e.find(t=>OPe.indexOf(t.mimeType)||t.mimeType.startsWith("image/")))return!1;if(HL(e[0].mimeType)){let t=this.output.cellViewModel,o=t.outputsViewModels.indexOf(this.output);if(o>0){let n=t.model.outputs[o-1];return!HL(n.outputs[0].mime)}}return!0}async _attachToolbar(e,t,o,n,r,s){let l=s.filter(w=>w.isTrusted).length>1,c=this.shouldEnableCopy(s);if(n>0&&!l&&!c||!this.notebookEditor.hasModel())return;e.style.position="relative";let u=_(".cell-output-toolbar");e.appendChild(u);let p=this.toolbarDisposables.add(this.instantiationService.createInstance(ol,u,{renderDropdownAsChildElement:!1}));p.context={ui:!0,cell:this.output.cellViewModel,outputViewModel:this.output,notebookEditor:this.notebookEditor,$mid:13};let h=this.toolbarDisposables.add(new it("notebook.output.pickMimetype",d(12782,null),q.asClassName(mUt),void 0,async w=>this._pickActiveMimeTypeRenderer(e,t,o,this.output))),g=this.toolbarDisposables.add(this.contextKeyService.createScoped(e)),f=nUt.bindTo(g),v=oUt.bindTo(g),b=hPe.bindTo(g);v.set(n===0),b.set(r.mimeType),this.toolbarDisposables.add(be(w=>{f.set(this.cellOutputContainer.hasHiddenOutputs.read(w))}));let S=this.toolbarDisposables.add(this.menuService.createMenu(D.NotebookOutputToolbar,g)),y=()=>{let{secondary:w}=ml(S.getActions({shouldForwardArgs:!0}),()=>!1);c||(w=w.filter(k=>k.id!==GEi)),l&&(w=[h,...w]),p.setActions([],w)};y(),this.toolbarDisposables.add(S.onDidChange(y))}async _pickActiveMimeTypeRenderer(e,t,o,n){let[r,s]=n.resolveMimeTypes(t,o?.preloadProvides),l=[],c=[];r.forEach((S,y)=>{S.isTrusted&&(S.rendererId===SK?c:l).push({label:S.mimeType,id:S.mimeType,index:y,picked:y===s,detail:this._generateRendererInfo(S.rendererId),description:y===s?d(12778,null):void 0})}),c.some(S=>OJo.includes(S.id))&&c.push({label:d(12780,null),id:"installRenderers",index:r.length});let u=new N,p=u.add(this.quickInputService.createQuickPick({useSeparators:!0}));p.items=[...l,{type:"separator"},...c],p.activeItems=l.filter(S=>!!S.picked),p.placeholder=l.length!==r.length?d(12784,null):d(12783,null);let h=await new Promise(S=>{u.add(p.onDidAccept(()=>{S(p.selectedItems.length===1?p.selectedItems[0]:void 0),u.dispose()})),p.show()});if(h===void 0||h.index===s)return;if(h.id==="installRenderers"){this._showJupyterExtension();return}let g=e.nextElementSibling;this.toolbarDisposables.clear();let f=this.innerContainer;f&&(f.remove(),this.notebookEditor.removeInset(n)),n.pickedMimeType=r[h.index],this.viewCell.updateOutputMinHeight(this.viewCell.layoutInfo.outputTotalHeight);let{mimeType:v,rendererId:b}=r[h.index];this.notebookService.updateMimePreferredRenderer(t.viewType,v,b,r.map(S=>S.mimeType)),this.render(g),this._validateFinalOutputHeight(!1),this._relayoutCell()}async _showJupyterExtension(){await this.extensionsWorkbenchService.openSearch(`@id:${AEe}`)}_generateRendererInfo(e){let t=this.notebookService.getRendererInfo(e);return t?`${t.displayName!==""?t.displayName:t.id} (${t.extensionId.value})`:d(12785,null)}_validateFinalOutputHeight(e){this._outputHeightTimer!==null&&clearTimeout(this._outputHeightTimer),e?this.viewCell.unlockOutputHeight():this._outputHeightTimer=setTimeout(()=>{this.viewCell.unlockOutputHeight()},1e3)}_relayoutCell(){this.notebookEditor.layoutNotebookCell(this.viewCell,this.viewCell.layoutInfo.totalHeight)}dispose(){this._outputHeightTimer&&(this.viewCell.unlockOutputHeight(),clearTimeout(this._outputHeightTimer)),super.dispose()}};I8=I([m(5,bn),m(6,Ue),m(7,X),m(8,Kt),m(9,Hi),m(10,F)],I8);var xhe=class{constructor(i,e){this.model=i;this.element=e}};var UPe=class extends Rp{constructor(e,t,o,n,r,s,l){super();this.notebookEditor=e;this.viewCell=t;this.templateData=o;this.options=n;this.openerService=r;this._notebookExecutionStateService=s;this.instantiationService=l;this._outputEntries=[];this._hasStaleOutputs=!1;this.hasHiddenOutputs=Me("hasHiddenOutputs",!1);this._outputHeightTimer=null;this._register(t.onDidStartExecution(()=>{t.updateOutputMinHeight(t.layoutInfo.outputTotalHeight)})),this._register(t.onDidStopExecution(()=>{this._validateFinalOutputHeight(!1)})),this._register(t.onDidChangeOutputs(c=>{let p=this._notebookExecutionStateService.getCellExecution(t.uri)?1:2;this._updateOutputs(c,p)})),this._register(t.onDidChangeLayout(()=>{this.updateInternalLayoutNow(t)}))}checkForHiddenOutputs(){this._outputEntries.find(e=>!e.model.visible.get())?this.hasHiddenOutputs.set(!0,void 0):this.hasHiddenOutputs.set(!1,void 0)}get renderedOutputEntries(){return this._outputEntries}updateInternalLayoutNow(e){this.templateData.outputContainer.setTop(e.layoutInfo.outputContainerOffset),this.templateData.outputShowMoreContainer.setTop(e.layoutInfo.outputShowMoreContainerOffset),this._outputEntries.forEach(t=>{let o=this.viewCell.outputsViewModels.indexOf(t.model);if(o>=0){let n=this.viewCell.getOutputOffsetInContainer(o);t.element.updateDOMTop(n)}})}render(){try{this._doRender()}finally{this._relayoutCell()}}flagAsStale(){this._hasStaleOutputs=!0}_doRender(){if(this.viewCell.outputsViewModels.length>0){this.viewCell.layoutInfo.outputTotalHeight!==0&&this.viewCell.updateOutputMinHeight(this.viewCell.layoutInfo.outputTotalHeight),un(this.templateData.outputContainer.domNode);for(let e=0;e<Math.min(this.options.limit,this.viewCell.outputsViewModels.length);e++){let t=this.viewCell.outputsViewModels[e],o=this.instantiationService.createInstance(I8,this.notebookEditor,this.viewCell,this,this.templateData.outputContainer,t);this._outputEntries.push(new xhe(t,o)),o.render(void 0)}this.viewCell.outputsViewModels.length>this.options.limit&&(un(this.templateData.outputShowMoreContainer.domNode),this.viewCell.updateOutputShowMoreContainerHeight(46)),this._validateFinalOutputHeight(!1)}else vo(this.templateData.outputContainer.domNode);this.templateData.outputShowMoreContainer.domNode.innerText="",this.viewCell.outputsViewModels.length>this.options.limit?this.templateData.outputShowMoreContainer.domNode.appendChild(this._generateShowMoreElement(this.templateData.templateDisposables)):(vo(this.templateData.outputShowMoreContainer.domNode),this.viewCell.updateOutputShowMoreContainerHeight(0))}viewUpdateShowOutputs(e){this._hasStaleOutputs&&(this._hasStaleOutputs=!1,this._outputEntries.forEach(t=>{t.element.rerender()}));for(let t=0;t<this._outputEntries.length;t++){let n=this._outputEntries[t].element;n.renderResult?this.notebookEditor.createOutput(this.viewCell,n.renderResult,this.viewCell.getOutputOffset(t),!1):n.render(void 0)}this._relayoutCell()}viewUpdateHideOuputs(){for(let e=0;e<this._outputEntries.length;e++)this.notebookEditor.hideInset(this._outputEntries[e].model)}_validateFinalOutputHeight(e){this._outputHeightTimer!==null&&clearTimeout(this._outputHeightTimer);let t=this._notebookExecutionStateService.getCellExecution(this.viewCell.uri);e?this.viewCell.unlockOutputHeight():t?.state!==3&&(this._outputHeightTimer=setTimeout(()=>{this.viewCell.unlockOutputHeight()},200))}_updateOutputs(e,t=2){let o=this.viewCell.layoutInfo.outputTotalHeight;this.viewCell.updateOutputMinHeight(o),this.viewCell.outputsViewModels.length?un(this.templateData.outputContainer.domNode):vo(this.templateData.outputContainer.domNode),this.viewCell.spliceOutputHeights(e.start,e.deleteCount,e.newOutputs.map(n=>0)),this._renderNow(e,t)}_renderNow(e,t){if(e.start>=this.options.limit)return;let o=this._outputEntries.slice(0,e.start),n=this._outputEntries.slice(e.start,e.start+e.deleteCount),r=this._outputEntries.slice(e.start+e.deleteCount),s=this.viewCell.outputsViewModels.slice(e.start,e.start+e.newOutputs.length);if(o.length+s.length+r.length>this.options.limit)if(o.length+s.length>this.options.limit){[...n,...r].forEach(c=>{c.element.detach(),c.element.dispose()}),s=s.slice(0,this.options.limit-o.length);let l=s.map(c=>new xhe(c,this.instantiationService.createInstance(I8,this.notebookEditor,this.viewCell,this,this.templateData.outputContainer,c)));this._outputEntries=[...o,...l];for(let c=o.length;c<this._outputEntries.length;c++)this._outputEntries[c].element.render(void 0)}else{let l=r.slice(this.options.limit-o.length-s.length);[...n,...l].forEach(p=>{p.element.detach(),p.element.dispose()});let c=o.length+s.length,u=s.map(p=>new xhe(p,this.instantiationService.createInstance(I8,this.notebookEditor,this.viewCell,this,this.templateData.outputContainer,p)));this._outputEntries=[...o,...u,...r.slice(0,this.options.limit-o.length-s.length)];for(let p=o.length;p<c;p++){let h=p-1>=0&&this._outputEntries[p-1]&&this._outputEntries[p-1].element.innerContainer?.parentElement?this._outputEntries[p-1].element.innerContainer:void 0;this._outputEntries[p].element.render(h)}}else{n.forEach(p=>{p.element.detach(),p.element.dispose()});let l=o.length+s.length,c=s.map(p=>new xhe(p,this.instantiationService.createInstance(I8,this.notebookEditor,this.viewCell,this,this.templateData.outputContainer,p))),u=[];if(o.length+c.length+r.length<this.viewCell.outputsViewModels.length){let p=Math.min(this.options.limit,this.viewCell.outputsViewModels.length);u=this.viewCell.outputsViewModels.slice(o.length+c.length+r.length,p).map(h=>new xhe(h,this.instantiationService.createInstance(I8,this.notebookEditor,this.viewCell,this,this.templateData.outputContainer,h)))}this._outputEntries=[...o,...c,...r,...u];for(let p=o.length;p<l;p++){let h=p-1>=0&&this._outputEntries[p-1]&&this._outputEntries[p-1].element.innerContainer?.parentElement?this._outputEntries[p-1].element.innerContainer:void 0;this._outputEntries[p].element.render(h)}for(let p=0;p<u.length;p++)this._outputEntries[o.length+s.length+r.length+p].element.render(void 0)}this.viewCell.outputsViewModels.length>this.options.limit?(un(this.templateData.outputShowMoreContainer.domNode),this.templateData.outputShowMoreContainer.domNode.hasChildNodes()||this.templateData.outputShowMoreContainer.domNode.appendChild(this._generateShowMoreElement(this.templateData.templateDisposables)),this.viewCell.updateOutputShowMoreContainerHeight(46)):vo(this.templateData.outputShowMoreContainer.domNode),this._relayoutCell(),this._validateFinalOutputHeight(t===2&&this.viewCell.outputsViewModels.length===0)}_generateShowMoreElement(e){let t={value:`There are more than ${this.options.limit} outputs, [show more (open the raw output data in a text editor) ...](command:workbench.action.openLargeOutput)`,isTrusted:!0,supportThemeIcons:!0},o=e.add(Gf(t,{actionHandler:n=>{n==="command:workbench.action.openLargeOutput"&&this.openerService.open(Zo.generateCellOutputUriWithId(this.notebookEditor.textModel.uri))}}));return o.element.classList.add("output-show-more"),o.element}_relayoutCell(){this.notebookEditor.layoutNotebookCell(this.viewCell,this.viewCell.layoutInfo.totalHeight)}dispose(){this.viewCell.updateOutputMinHeight(0),this._outputHeightTimer&&clearTimeout(this._outputHeightTimer),this._outputEntries.forEach(e=>{e.element.dispose()}),super.dispose()}};UPe=I([m(4,Je),m(5,bs),m(6,F)],UPe);var OJo=["application/geo+json","application/vdom.v1+json","application/vnd.dataresource+json","application/vnd.plotly.v1+json","application/vnd.vega.v2+json","application/vnd.vega.v3+json","application/vnd.vega.v4+json","application/vnd.vega.v5+json","application/vnd.vegalite.v1+json","application/vnd.vegalite.v2+json","application/vnd.vegalite.v3+json","application/vnd.vegalite.v4+json","application/x-nteract-model-debug+json","image/svg+xml","text/latex","text/vnd.plotly.v1+html","application/vnd.jupyter.widget-view+json","application/vnd.code.notebook.error"];var zPe=class extends x{constructor(e,t,o,n){super();this._cell=t;this._element=o;this._executionStateService=n;this._visible=!1;this._update(),this._register(this._executionStateService.onDidChangeExecution(r=>{r.type===0&&r.affectsCell(this._cell.uri)&&this._update()})),this._register(this._cell.model.onDidChangeInternalMetadata(()=>this._update()))}setVisibility(e){this._visible=e,this._update()}_update(){if(!this._visible)return;let e=this._executionStateService.getCellExecution(this._cell.uri),t=this._getItemForState(e,this._cell.model.internalMetadata);t?(this._element.style.display="",vi(this._element,...Un(t.text)),this._element.title=t.tooltip??""):(this._element.style.display="none",vi(this._element))}_getItemForState(e,t){let o=e?.state,{lastRunSuccess:n}=t;if(!o&&n)return{text:`$(${cUt.id})`,tooltip:d(12791,null)};if(!o&&n===!1)return{text:`$(${IPe.id})`,tooltip:d(12789,null)};if(o===2||o===1)return{text:`$(${dUt.id})`,tooltip:d(12790,null)};if(o===3)return{text:`$(${q.modify(Qw,"spin").id})`,tooltip:d(12788,null)}}};zPe=I([m(3,bs)],zPe);var KPe=class extends x{constructor(e,t,o,n,r,s,l,c,u,p){super();this.notebookEditor=e;this.viewCell=t;this.templateData=o;this.editorPool=n;this.instantiationService=r;this.keybindingService=s;this.languageService=l;this.configurationService=c;this._isDisposed=!1;this._useNewApproachForEditorLayout=!0;this._pointerDownInEditor=!1;this._pointerDraggingInEditor=!1;let g=`[Cell ${this.notebookEditor.getCellIndex(this.viewCell)}]`,f=this._debug=S=>{p.debug("CellLayout",`${g} ${S}`)};this._cellEditorOptions=this._register(new oW(this.notebookEditor.getBaseCellEditorOptions(t.language),this.notebookEditor.notebookOptions,this.configurationService)),this._outputContainerRenderer=this.instantiationService.createInstance(UPe,e,t,o,{limit:APe}),this.cellParts=this._register(o.cellParts.concatContentPart([this._cellEditorOptions,this._outputContainerRenderer],Re(e.getDomNode())));let v={height:this.calculateInitEditorHeight(),width:this.viewCell.layoutInfo.editorWidth};this._cellLayout=new qEi(this._useNewApproachForEditorLayout,e,t,o,{debug:f},v),this.initializeEditor(v),this._renderedInputCollapseState=!1,this.registerNotebookEditorListeners(),this.registerViewCellLayoutChange(),this.registerCellEditorEventListeners(),this.registerMouseListener(),this._register(U.any(this.viewCell.onDidStartExecution,this.viewCell.onDidStopExecution)(S=>{this.cellParts.updateForExecutionState(this.viewCell,S)})),this._register(this.viewCell.onDidChangeState(S=>{if(this.cellParts.updateState(this.viewCell,S),S.outputIsHoveredChanged&&this.updateForOutputHover(),S.outputIsFocusedChanged&&this.updateForOutputFocus(),(S.metadataChanged||S.internalMetadataChanged)&&this.updateEditorOptions(),S.inputCollapsedChanged||S.outputCollapsedChanged){this.viewCell.pauseLayout();let y=this.updateForCollapseState();this.viewCell.resumeLayout(),y&&this.relayoutCell()}S.focusModeChanged&&this.updateEditorForFocusModeChange(!0)})),this.updateEditorOptions(),this.updateEditorForFocusModeChange(!1),this.updateForOutputHover(),this.updateForOutputFocus(),this.cellParts.scheduleRenderCell(this.viewCell),this._register(Z(()=>{this.cellParts.unrenderCell(this.viewCell)})),this.viewCell.editorHeight=v.height,this._outputContainerRenderer.render(),this._renderedOutputCollapseState=!1,this.initialViewUpdateExpanded(),this._register(this.viewCell.onLayoutInfoRead(()=>{this.cellParts.prepareLayout()}));let b=M(this.templateData.cellInputCollapsedContainer,_(".collapsed-execution-icon"));this._register(Z(()=>{b.remove()})),this._collapsedExecutionIcon=this._register(this.instantiationService.createInstance(zPe,this.notebookEditor,this.viewCell,b)),this.updateForCollapseState(),this._register(U.runAndSubscribe(t.onDidChangeOutputs,this.updateForOutputs.bind(this))),this._register(U.runAndSubscribe(t.onDidChangeLayout,this.updateForLayout.bind(this))),this._cellEditorOptions.setLineNumbers(this.viewCell.lineNumbers),o.editor.updateOptions(this._cellEditorOptions.getUpdatedValue(this.viewCell.internalMetadata,this.viewCell.uri))}updateCodeCellOptions(e){e.editor.updateOptions(this._cellEditorOptions.getUpdatedValue(this.viewCell.internalMetadata,this.viewCell.uri));let t=new Ye;this._register({dispose(){t.dispose(!0)}}),Va(this.viewCell.resolveTextModel(),t.token).then(o=>{this._isDisposed||o&&o.updateOptions({indentSize:this._cellEditorOptions.indentSize,tabSize:this._cellEditorOptions.tabSize,insertSpaces:this._cellEditorOptions.insertSpaces})})}updateForLayout(){this._pendingLayout?.dispose(),this._pendingLayout=Q9(Re(this.notebookEditor.getDomNode()),()=>{this.cellParts.updateInternalLayoutNow(this.viewCell)})}updateForOutputHover(){this.templateData.container.classList.toggle("cell-output-hover",this.viewCell.outputIsHovered)}updateForOutputFocus(){this.templateData.container.classList.toggle("cell-output-focus",this.viewCell.outputIsFocused)}calculateInitEditorHeight(){let e=this.viewCell.lineCount,t=this.viewCell.layoutInfo.fontInfo?.lineHeight||17,o=this.notebookEditor.notebookOptions.computeEditorPadding(this.viewCell.internalMetadata,this.viewCell.uri);return this.viewCell.layoutInfo.editorHeight===0?e*t+o.top+o.bottom:this.viewCell.layoutInfo.editorHeight}initializeEditor(e){this._debug(`Initialize Editor ${e.height} x ${e.width}, Scroll Top = ${this.notebookEditor.scrollTop}`),this._cellLayout.layoutEditor("init"),this.layoutEditor(e);let t=new Ye;this._register({dispose(){t.dispose(!0)}}),Va(this.viewCell.resolveTextModel(),t.token).then(o=>{if(!(this._isDisposed||o?.isDisposed())){if(o&&this.templateData.editor){if(this._reigsterModelListeners(o),this.templateData.editor.setModel(o),this._isDisposed)return;o.updateOptions({indentSize:this._cellEditorOptions.indentSize,tabSize:this._cellEditorOptions.tabSize,insertSpaces:this._cellEditorOptions.insertSpaces}),this.viewCell.attachTextEditor(this.templateData.editor,this.viewCell.layoutInfo.estimatedHasHorizontalScrolling);let n=()=>{this.notebookEditor.getActiveCell()===this.viewCell&&this.viewCell.focusMode===1&&(this.notebookEditor.hasEditorFocus()||this.notebookEditor.getDomNode().ownerDocument.activeElement===this.notebookEditor.getDomNode().ownerDocument.body)&&this.templateData.editor.focus()};if(n(),this.templateData.editor.getContentHeight()!==e.height&&this.onCellEditorHeightChange("onDidResolveTextModel"),this._isDisposed)return;n()}this._register(this._cellEditorOptions.onDidChange(()=>this.updateCodeCellOptions(this.templateData)))}})}updateForOutputs(){hh(this.viewCell.outputsViewModels.length>0,this.templateData.focusSinkElement)}updateEditorOptions(){let e=this.templateData.editor;if(!e)return;let t=this.notebookEditor.isReadOnly,o=this.notebookEditor.notebookOptions.computeEditorPadding(this.viewCell.internalMetadata,this.viewCell.uri),n=e.getOptions();(n.get(104)!==t||n.get(96)!==o)&&e.updateOptions({readOnly:this.notebookEditor.isReadOnly,padding:this.notebookEditor.notebookOptions.computeEditorPadding(this.viewCell.internalMetadata,this.viewCell.uri)})}registerNotebookEditorListeners(){this._register(this.notebookEditor.onDidScroll(()=>{this.adjustEditorPosition(),this._cellLayout.layoutEditor("nbDidScroll")})),this._register(this.notebookEditor.onDidChangeLayout(()=>{this.adjustEditorPosition(),this.onCellWidthChange("nbLayoutChange")}))}adjustEditorPosition(){if(this._useNewApproachForEditorLayout)return;let e=-7,t=0,o=this.notebookEditor.scrollTop,n=this.notebookEditor.getAbsoluteTopOfElement(this.viewCell),r=o-n+e,s=this.notebookEditor.getLayoutInfo(),l=s.height-s.stickyHeight-26,c=this.viewCell.layoutInfo.editorHeight-l,u=c>20?Bn(t,r,c):t;this.templateData.editorPart.style.top=`${u}px`,this.templateData.editor.setScrollTop(u)}registerViewCellLayoutChange(){this._register(this.viewCell.onDidChangeLayout(e=>{e.outerWidth!==void 0&&this.templateData.editor.getLayoutInfo().width!==this.viewCell.layoutInfo.editorWidth&&(this.onCellWidthChange("viewCellLayoutChange"),this.adjustEditorPosition())}))}registerCellEditorEventListeners(){this._register(this.templateData.editor.onDidContentSizeChange(e=>{e.contentHeightChanged&&this.viewCell.layoutInfo.editorHeight!==e.contentHeight&&(this.onCellEditorHeightChange("onDidContentSizeChange"),this.adjustEditorPosition())})),this._useNewApproachForEditorLayout&&this._register(this.templateData.editor.onDidScrollChange(e=>{if(this._pointerDownInEditor||this._pointerDraggingInEditor||this._cellLayout.editorVisibility==="Invisible"||!this.templateData.editor.hasTextFocus()||this._cellLayout._lastChangedEditorScrolltop===e.scrollTop||this._cellLayout.isUpdatingLayout)return;let t=this.notebookEditor.scrollTop,o=e.scrollTop-(this._cellLayout._lastChangedEditorScrolltop??0);if(this._cellLayout.editorVisibility==="Full (Small Viewport)"&&typeof this._cellLayout._lastChangedEditorScrolltop=="number")this._debug(`Scroll Change (1) = ${e.scrollTop} changed by ${o} (notebook scrollTop: ${t}, setEditorScrollTop: ${e.scrollTop})`);else if(this._cellLayout.editorVisibility==="Bottom Clipped"&&typeof this._cellLayout._lastChangedEditorScrolltop=="number")this._debug(`Scroll Change (2) = ${e.scrollTop} changed by ${o} (notebook scrollTop: ${t}, setNotebookScrollTop: ${t+e.scrollTop})`),this.notebookEditor.setScrollTop(t+e.scrollTop);else if(this._cellLayout.editorVisibility==="Top Clipped"&&typeof this._cellLayout._lastChangedEditorScrolltop=="number"){let n=t+o-1;this._debug(`Scroll Change (3) = ${e.scrollTop} changed by ${o} (notebook scrollTop: ${t}, setNotebookScrollTop?: ${n})`),t!==n&&this.notebookEditor.setScrollTop(n)}else this._debug(`Scroll Change (4) = ${e.scrollTop} changed by ${o} (notebook scrollTop: ${t})`),this._cellLayout._lastChangedEditorScrolltop=void 0})),this._register(this.templateData.editor.onDidChangeCursorSelection(e=>{if(e.source==="restoreState"||e.oldModelVersionId===0||!this.templateData.editor.hasTextFocus()||(this._pointerDownInEditor||this._pointerDraggingInEditor)&&this._useNewApproachForEditorLayout)return;let t=this.templateData.editor.getSelections();if(t?.length){let o=this.templateData.editor.getContentHeight(),n=this.viewCell.layoutInfo.editorHeight;if(o!==n&&(this._useNewApproachForEditorLayout||(this._debug("onDidChangeCursorSelection"),this.onCellEditorHeightChange("onDidChangeCursorSelection")),this._isDisposed))return;let r=t[t.length-1];this.notebookEditor.revealRangeInViewAsync(this.viewCell,r)}})),this._register(this.templateData.editor.onDidBlurEditorWidget(()=>{Cp.get(this.templateData.editor)?.hideLightBulbWidget()}))}_reigsterModelListeners(e){this._register(e.onDidChangeTokens(()=>{if(this.viewCell.isInputCollapsed&&this._inputCollapseElement){let t=this._getRichTextFromLineTokens(e);this._inputCollapseElement.innerHTML=$tt?.createHTML(t)??t,this._attachInputExpandButton(this._inputCollapseElement)}}))}registerMouseListener(){let e=()=>{this._pointerDownInEditor=!1,this._pointerDraggingInEditor=!1,this._cellLayout.setPointerDown(!1)};if(this._register(this.templateData.editor.onMouseDown(t=>{t.event.rightButton&&t.event.preventDefault(),this._useNewApproachForEditorLayout&&t.event.leftButton&&(this._pointerDownInEditor=!0,this._pointerDraggingInEditor=!1,this._cellLayout.setPointerDown(!1))})),this._useNewApproachForEditorLayout&&this._register(this.templateData.editor.onMouseMove(t=>{if(this._pointerDownInEditor){if(!t.event.leftButton){e();return}this._pointerDraggingInEditor||(this._pointerDraggingInEditor=!0,this._cellLayout.setPointerDown(!0))}})),this._useNewApproachForEditorLayout){let t=Re(this.notebookEditor.getDomNode());this._register(j(t,"mouseup",e)),this._register(j(t,"pointerup",e)),this._register(j(t,"pointercancel",e)),this._register(j(t,"blur",e)),this._register(j(t,"keydown",o=>{o.key==="Escape"&&(this._pointerDownInEditor||this._pointerDraggingInEditor)&&e()}))}}shouldPreserveEditor(){return this.notebookEditor.getActiveCell()===this.viewCell&&this.viewCell.focusMode===1&&(this.notebookEditor.hasEditorFocus()||this.notebookEditor.getDomNode().ownerDocument.activeElement===this.notebookEditor.getDomNode().ownerDocument.body)}updateEditorForFocusModeChange(e){this.shouldPreserveEditor()&&(e?this.templateData.editor.focus():this._register(zh(Re(this.templateData.container),()=>{this.templateData.editor.focus()}))),this.templateData.container.classList.toggle("cell-editor-focus",this.viewCell.focusMode===1),this.templateData.container.classList.toggle("cell-output-focus",this.viewCell.focusMode===2)}updateForCollapseState(){return this.viewCell.isOutputCollapsed===this._renderedOutputCollapseState&&this.viewCell.isInputCollapsed===this._renderedInputCollapseState?!1:(this.viewCell.layoutChange({editorHeight:!0}),this.viewCell.isInputCollapsed?this._collapseInput():this._showInput(),this.viewCell.isOutputCollapsed?this._collapseOutput():this._showOutput(!1),this.relayoutCell(),this._renderedOutputCollapseState=this.viewCell.isOutputCollapsed,this._renderedInputCollapseState=this.viewCell.isInputCollapsed,!0)}_collapseInput(){vo(this.templateData.editorPart),this.templateData.container.classList.toggle("input-collapsed",!0),this._removeInputCollapsePreview(),this._collapsedExecutionIcon.setVisibility(!0);let e=this.templateData.editor.hasModel()?this._getRichTextFromLineTokens(this.templateData.editor.getModel()):this._getRichText(this.viewCell.textBuffer,this.viewCell.language),t=_("div.cell-collapse-preview");t.innerHTML=$tt?.createHTML(e)??e,this._inputCollapseElement=t,this.templateData.cellInputCollapsedContainer.appendChild(t),this._attachInputExpandButton(t),un(this.templateData.cellInputCollapsedContainer)}_attachInputExpandButton(e){let t=_("span.expandInputIcon"),o=this.keybindingService.lookupKeybinding(PEe);o&&(e.title=d(12787,null,o.getLabel()),t.title=d(12786,null,o.getLabel())),t.classList.add(...q.asClassNameArray(R.more)),e.appendChild(t)}_showInput(){this._collapsedExecutionIcon.setVisibility(!1),un(this.templateData.editorPart),vo(this.templateData.cellInputCollapsedContainer)}_getRichText(e,t){return iyt(this.languageService,e.getLineContent(1),t)}_getRichTextFromLineTokens(e){let t='<div class="monaco-tokenized-source">',n=e.tokenization.getLineTokens(1).inflate(),r=e.getLineContent(1),s=0;for(let l=0,c=n.getCount();l<c;l++){let u=n.getClassName(l),p=n.getEndOffset(l);t+=`<span class="${u}">${mr(r.substring(s,p))}</span>`,s=p}return t+="</div>",t}_removeInputCollapsePreview(){let e=this.templateData.cellInputCollapsedContainer.children,t=[];for(let o=0;o<e.length;o++)e[o].classList.contains("cell-collapse-preview")&&t.push(e[o]);t.forEach(o=>{o.remove()})}_updateOutputInnerContainer(e){let t=this.templateData.outputContainer.domNode.children;for(let o=0;o<t.length;o++)t[o].classList.contains("output-inner-container")&&hh(!e,t[o])}_collapseOutput(){this.templateData.container.classList.toggle("output-collapsed",!0),un(this.templateData.cellOutputCollapsedContainer),this._updateOutputInnerContainer(!0),this._outputContainerRenderer.viewUpdateHideOuputs()}_showOutput(e){this.templateData.container.classList.toggle("output-collapsed",!1),vo(this.templateData.cellOutputCollapsedContainer),this._updateOutputInnerContainer(!1),this._outputContainerRenderer.viewUpdateShowOutputs(e)}initialViewUpdateExpanded(){this.templateData.container.classList.toggle("input-collapsed",!1),un(this.templateData.editorPart),vo(this.templateData.cellInputCollapsedContainer),this.templateData.container.classList.toggle("output-collapsed",!1),this._showOutput(!0)}layoutEditor(e){if(this._useNewApproachForEditorLayout)return;let t=this.notebookEditor.getLayoutInfo(),o=Math.min(t.height-t.stickyHeight-26,e.height);this._debug(`Layout Editor: Width = ${e.width}, Height = ${o} (Requested: ${e.height}, Editor Layout Height: ${t.height}, Sticky: ${t.stickyHeight})`),this.templateData.editor.layout({width:e.width,height:o},!0)}onCellWidthChange(e){this._debug(`Cell Editor Width Change, ${e}, Content Height = ${this.templateData.editor.getContentHeight()}`);let t=this.templateData.editor.getContentHeight();this.templateData.editor.hasModel()?(this._debug(`**** Updating Cell Editor Height (1), ContentHeight: ${t}, CodeCellLayoutInfo.EditorWidth ${this.viewCell.layoutInfo.editorWidth}, EditorLayoutInfo ${this.templateData.editor.getLayoutInfo().height} ****`),this.viewCell.editorHeight=t,this.relayoutCell(),this.layoutEditor({width:this.viewCell.layoutInfo.editorWidth,height:t})):this._debug(`Cell Editor Width Change without model, return (1), ContentHeight: ${t}, CodeCellLayoutInfo.EditorWidth ${this.viewCell.layoutInfo.editorWidth}, EditorLayoutInfo ${this.templateData.editor.getLayoutInfo().height}`),this._cellLayout.layoutEditor(e)}onCellEditorHeightChange(e){let t=this.templateData.editor.getContentHeight();this.templateData.editor.hasModel()||this._debug(`Cell Editor Height Change without model, return (2), ContentHeight: ${t}, CodeCellLayoutInfo.EditorWidth ${this.viewCell.layoutInfo.editorWidth}, EditorLayoutInfo ${this.templateData.editor.getLayoutInfo()}`),this._debug(`Cell Editor Height Change (${e}): ${t}`),this._debug(`**** Updating Cell Editor Height (2), ContentHeight: ${t}, CodeCellLayoutInfo.EditorWidth ${this.viewCell.layoutInfo.editorWidth}, EditorLayoutInfo ${this.templateData.editor.getLayoutInfo().height} ****`);let o=this.templateData.editor.getLayoutInfo();this.viewCell.editorHeight=t,this.relayoutCell(),this.layoutEditor({width:o.width,height:t}),this._cellLayout.layoutEditor(e)}relayoutCell(){this.notebookEditor.layoutNotebookCell(this.viewCell,this.viewCell.layoutInfo.totalHeight)}dispose(){this._isDisposed=!0,this.shouldPreserveEditor()&&this.editorPool.preserveFocusedEditor(this.viewCell),this.viewCell.detachTextEditor(),this._removeInputCollapsePreview(),this._outputContainerRenderer.dispose(),this._pendingLayout?.dispose(),super.dispose()}};KPe=I([m(4,F),m(5,_e),m(6,_t),m(7,B),m(8,bs),m(9,Uv)],KPe);var qEi=class{constructor(i,e,t,o,n,r){this._enabled=i;this.notebookEditor=e;this.viewCell=t;this.templateData=o;this._logService=n;this._initialEditorDimension=r;this._initialized=!1;this._pointerDown=!1}get editorVisibility(){return this._editorVisibility}get isUpdatingLayout(){return this._isUpdatingLayout}setPointerDown(i){this._pointerDown=i}layoutEditor(i){if(!this._enabled)return;let e=this.templateData.editorPart;if(this.viewCell.isInputCollapsed){e.style.top="";return}let t=this.notebookEditor.getLayoutInfo().fontInfo.lineHeight,o=this.viewCell.layoutInfo.topMargin,n=this.viewCell.layoutInfo.outlineWidth,r=this.viewCell.layoutInfo.statusBarHeight,s=this.templateData.editor,l=this.templateData.editor.getLayoutInfo(),c=this._initialized&&(i==="nbLayoutChange"||i==="viewCellLayoutChange")?this.viewCell.layoutInfo.editorWidth:l.width,u=this.viewCell.layoutInfo.editorHeight,p=this.notebookEditor.scrollTop,h=this.notebookEditor.getAbsoluteTopOfElement(this.viewCell),g=this.notebookEditor.getAbsoluteBottomOfElement(this.viewCell),f=this.notebookEditor.getHeightOfElement(this.viewCell),v;if(!this._initialized&&i==="init")v=this._initialEditorDimension.height,this._establishedContentHeight=v;else{let G=s.getContentHeight(),$=G===-1?Math.max(s.getLayoutInfo().height,this._initialEditorDimension.height):G;!this._initialized||i==="onDidContentSizeChange"||i==="viewCellLayoutChange"||i==="nbLayoutChange"?(v=$,this._establishedContentHeight=v):v=this._establishedContentHeight??$}let S=h+this.viewCell.layoutInfo.outputContainerOffset,y=this.notebookEditor.scrollBottom,w=y-p===0?this.notebookEditor.getLayoutInfo().height:y-p,k=this.viewCell.layoutInfo.outputContainerOffset,T=typeof this._previousScrollBottom=="number"&&y<this._previousScrollBottom?"up":"down";this._previousScrollBottom=y;let P=Math.max(0,p-h-o-n),O=u-P;O<t&&(P=P-(t-O)-n);let V=v,H=0;if(p<=h+o){let G=t+this.notebookEditor.notebookOptions.getLayoutConfiguration().editorTopPadding;y>=S?(V=Bn(v,G,v),this._editorVisibility="Full"):(V=Bn(y-(h+o)-r,G,v)+2*n,this._editorVisibility="Bottom Clipped",H=0)}else if(w<=v&&y<=S){let G=t+this.notebookEditor.notebookOptions.getLayoutConfiguration().editorTopPadding;V=Bn(w-r,G,v-r)+2*n,this._editorVisibility="Full (Small Viewport)",H=P}else{let G=t;V=Bn(v-(p-(h+o)),G,v),p>S?this._editorVisibility="Invisible":this._editorVisibility="Top Clipped",H=v-V}this._logService.debug(`${i} (${this._editorVisibility}, ${this._initialized})`),this._logService.debug(`=> Editor Top = ${P}px (editHeight = ${u}, editContentHeight: ${v})`),this._logService.debug(`=> eleTop = ${h}, eleBottom = ${g}, eleHeight = ${f}`),this._logService.debug(`=> scrollTop = ${p}, top = ${P}`),this._logService.debug(`=> cellTopMargin = ${o}, cellBottomMargin = ${this.viewCell.layoutInfo.topMargin}, cellOutline = ${n}`),this._logService.debug(`=> scrollBottom: ${y}, editBottom: ${S}, viewport: ${w}, scroll: ${T}, contOffset: ${k})`),this._logService.debug(`=> Editor Height = ${V}px, Width: ${c}px, Initial Width: ${this._initialEditorDimension.width}, EditorScrollTop = ${H}px, StatusbarHeight = ${r}, lineHeight = ${this.notebookEditor.getLayoutInfo().fontInfo.lineHeight}`);try{this._isUpdatingLayout=!0,e.style.top=`${P}px`,s.layout({width:this._initialized?c:this._initialEditorDimension.width,height:V},!0),!this._pointerDown&&H>=0&&(this._lastChangedEditorScrolltop=H,s.setScrollTop(H))}finally{this._initialized=!0,this._isUpdatingLayout=!1,this._logService.debug("Updated Editor Layout")}}};var Jw=class extends wl{constructor(e,t,o,n,r,s,l,c,u,p,h){super(null,e,{hoverDelegate:r?.hoverDelegate});this._options=r;this._contextMenuProvider=s;this._container=null;this._dropdownContainer=null;this._primaryAction=new xl(e,{hoverDelegate:r?.hoverDelegate},l,c,u,p,s,h),r?.actionRunner&&(this._primaryAction.actionRunner=r.actionRunner),this._dropdown=new Pm(t,o,this._contextMenuProvider,{menuAsChild:r?.menuAsChild??!0,classNames:n?["codicon","codicon-chevron-down",n]:["codicon","codicon-chevron-down"],actionRunner:this._options?.actionRunner,keybindingProvider:this._options?.getKeyBinding??(g=>l.lookupKeybinding(g.id)),hoverDelegate:r?.hoverDelegate,skipTelemetry:r?.skipTelemetry})}get onDidChangeDropdownVisibility(){return this._dropdown.onDidChangeVisibility}set actionRunner(e){super.actionRunner=e,this._primaryAction.actionRunner=e,this._dropdown.actionRunner=e}get actionRunner(){return super.actionRunner}setActionContext(e){super.setActionContext(e),this._primaryAction.setActionContext(e),this._dropdown.setActionContext(e)}render(e){this._container=e,super.render(this._container),this._container.classList.add("monaco-dropdown-with-primary");let t=_(".action-container");t.role="button",t.ariaDisabled=String(!this.action.enabled),this._primaryAction.render(M(this._container,t)),this._dropdownContainer=_(".dropdown-action-container"),this._dropdown.render(M(this._container,this._dropdownContainer)),this._register(j(t,re.KEY_DOWN,o=>{if(!this.action.enabled)return;let n=new gi(o);n.equals(17)&&(this._primaryAction.element.tabIndex=-1,this._dropdown.focus(),n.stopPropagation())})),this._register(j(this._dropdownContainer,re.KEY_DOWN,o=>{if(!this.action.enabled)return;let n=new gi(o);n.equals(15)&&(this._primaryAction.element.tabIndex=0,this._dropdown.setFocusable(!1),this._primaryAction.element?.focus(),n.stopPropagation())})),this.updateEnabled()}focus(e){e?this._dropdown.focus():(this._primaryAction.element.tabIndex=0,this._primaryAction.element.focus())}blur(){this._primaryAction.element.tabIndex=-1,this._dropdown.blur(),this._container.blur()}setFocusable(e){e?this._primaryAction.element.tabIndex=0:(this._primaryAction.element.tabIndex=-1,this._dropdown.setFocusable(!1))}updateEnabled(){let e=!this.action.enabled;this.element?.classList.toggle("disabled",e)}update(e,t,o){this._dropdown.dispose(),this._dropdown=new Pm(e,t,this._contextMenuProvider,{menuAsChild:this._options?.menuAsChild??!0,classNames:["codicon",o||"codicon-chevron-down"],actionRunner:this._options?.actionRunner,hoverDelegate:this._options?.hoverDelegate,keybindingProvider:this._options?.getKeyBinding}),this._dropdownContainer&&this._dropdown.render(this._dropdownContainer)}showDropdown(){this._dropdown.show()}dispose(){this._primaryAction.dispose(),this._dropdown.dispose(),super.dispose()}};Jw=I([m(5,Xe),m(6,_e),m(7,Ne),m(8,X),m(9,Le),m(10,Oi)],Jw);var GPe=class extends Rp{constructor(e,t,o,n,r,s,l,c,u,p){super();this.notebookEditor=e;this.contextKeyService=t;this.cellContainer=o;this.runButtonContainer=n;this.keybindingService=c;this.contextMenuService=u;this.instantiationService=p;this.primaryMenu=this._register(l.createMenu(r,t)),this.secondaryMenu=this._register(l.createMenu(s,t)),this.createRunCellToolbar(n,o,t);let h=()=>{let f=this.getCellToolbarActions(this.primaryMenu).primary[0];this.toolbar.setActions(f?[f]:[])};h(),this._register(this.primaryMenu.onDidChange(h)),this._register(this.secondaryMenu.onDidChange(h)),this._register(this.notebookEditor.notebookOptions.onDidChangeOptions(h))}didRenderCell(e){if(this.cellDisposables.add($Ut(this.notebookEditor,e,this.runButtonContainer)),this.notebookEditor.hasModel()){let t={ui:!0,cell:e,notebookEditor:this.notebookEditor,$mid:13};this.toolbar.context=t}}getCellToolbarActions(e){return ml(e.getActions({shouldForwardArgs:!0}),t=>/^inline/.test(t))}createRunCellToolbar(e,t,o){let n=this._register(new N),r=this._register(new it("notebook.moreRunActions",d(12792,null),"codicon-chevron-down",!0)),s=c=>this.keybindingService.lookupKeybinding(c.id,l),l=this._register(FJo(o));this.toolbar=this._register(new wp(e,this.contextMenuService,{getKeyBinding:s,actionViewItemProvider:(c,u)=>{n.clear();let p=this.getCellToolbarActions(this.primaryMenu).primary[0];if(!(p instanceof Lo))return;let h=this.getCellToolbarActions(this.secondaryMenu).secondary;if(!h.length)return;let g=this.instantiationService.createInstance(Jw,p,r,h,"notebook-cell-run-toolbar",{...u,getKeyBinding:s});return n.add(g.onDidChangeDropdownVisibility(f=>{t.classList.toggle("cell-run-toolbar-dropdown-active",f)})),g},renderDropdownAsChildElement:!0}))}};GPe=I([m(6,Kt),m(7,_e),m(8,Xe),m(9,F)],GPe);function FJo(a){let i=a.createScoped(document.createElement("div"));return ig.bindTo(i).set(!0),pe.editorTextFocus.bindTo(i).set(!0),pe.focus.bindTo(i).set(!0),pe.textInputFocus.bindTo(i).set(!0),Jme.bindTo(i).set("idle"),pp.bindTo(i).set(!0),pr.bindTo(i).set(!0),NS.bindTo(i).set("code"),i}var Qtt=class extends Rp{constructor(e,t){super();this.notebookEditor=e;this._register(j(t,re.DBLCLICK,o=>{!this.currentCell||!this.notebookEditor.hasModel()||(this.currentCell.isInputCollapsed?this.currentCell.isInputCollapsed=!1:this.currentCell.isOutputCollapsed=!1)})),this._register(j(t,re.CLICK,o=>{if(!this.currentCell||!this.notebookEditor.hasModel())return;let n=o.target;n&&n.classList&&n.classList.contains("expandInputIcon")&&(this.currentCell.isInputCollapsed=!1)}))}};var Who=_,qPe=class extends Rp{constructor(e,t,o){super();this.notebookEditor=e;let n=M(t,Who("span.expandOutputPlaceholder"));n.textContent=d(12795,null);let r=M(t,Who("span.expandOutputIcon"));r.classList.add(...q.asClassNameArray(R.more));let s=o.lookupKeybinding(CDt);s&&(n.title=d(12794,null,s.getLabel()),t.title=d(12793,null,s.getLabel())),vo(t),this._register(j(r,re.CLICK,()=>this.expand())),this._register(j(t,re.DBLCLICK,()=>this.expand()))}expand(){!this.currentCell||!this.currentCell||this.notebookEditor.textModel.cells.indexOf(this.currentCell.model)<0||(this.currentCell.isOutputCollapsed=!this.currentCell.isOutputCollapsed)}};qPe=I([m(2,_e)],qPe);var WJo={limit:5e3,update:()=>{}},YUt=class{constructor(){this._viewModel=null;this._viewModelStore=new N;this._onDidFoldingRegionChanges=new E;this.onDidFoldingRegionChanged=this._onDidFoldingRegionChanges.event;this._foldingRangeDecorationIds=[];this._regions=new ay(new Uint32Array(0),new Uint32Array(0))}get regions(){return this._regions}dispose(){this._onDidFoldingRegionChanges.dispose(),this._viewModelStore.dispose()}detachViewModel(){this._viewModelStore.clear(),this._viewModel=null}attachViewModel(i){this._viewModel=i,this._viewModelStore.add(this._viewModel.onDidChangeViewCells(()=>{this.recompute()})),this._viewModelStore.add(this._viewModel.onDidChangeSelection(()=>{if(!this._viewModel)return;let e=Yf(this._viewModel.getSelections()),t=!1;e.forEach(o=>{let n=this.regions.findRange(o+1);for(;n!==-1;)this._regions.isCollapsed(n)&&o>this._regions.getStartLineNumber(n)-1&&(this._regions.setCollapsed(n,!1),t=!0),n=this._regions.getParentIndex(n)}),t&&this._onDidFoldingRegionChanges.fire()})),this.recompute()}getRegionAtLine(i){if(this._regions){let e=this._regions.findRange(i);if(e>=0)return this._regions.toRegion(e)}return null}getRegionsInside(i,e){let t=[],o=i?i.regionIndex+1:0,n=i?i.endLineNumber:Number.MAX_VALUE;if(e&&e.length===2){let r=[];for(let s=o,l=this._regions.length;s<l;s++){let c=this._regions.toRegion(s);if(this._regions.getStartLineNumber(s)<n){for(;r.length>0&&!c.containedBy(r[r.length-1]);)r.pop();r.push(c),e(c,r.length)&&t.push(c)}else break}}else for(let r=o,s=this._regions.length;r<s;r++){let l=this._regions.toRegion(r);if(this._regions.getStartLineNumber(r)<n)(!e||e(l))&&t.push(l);else break}return t}getAllRegionsAtLine(i,e){let t=[];if(this._regions){let o=this._regions.findRange(i),n=1;for(;o>=0;){let r=this._regions.toRegion(o);(!e||e(r,n))&&t.push(r),n++,o=r.parentIndex}}return t}setCollapsed(i,e){this._regions.setCollapsed(i,e)}recompute(){if(!this._viewModel)return;let i=this._viewModel,e=i.viewCells,t=[];for(let p=0;p<e.length;p++){let h=e[p];if(h.cellKind!==1||h.language!=="markdown")continue;let g=Math.min(7,...Array.from($Ei(h.getText()),f=>f.depth));g<7&&t.push({index:p,level:g,endIndex:0})}let o=t.map((p,h)=>{let g;for(let v=h+1;v<t.length;++v)if(t[v].level<=p.level){g=t[v].index-1;break}let f=g!==void 0?g:e.length-1;return{start:p.index+1,end:f+1,rank:1}}).filter(p=>p.start!==p.end),n=aci(o,WJo),r=0,s=()=>{for(;r<this._regions.length;){let p=this._regions.isCollapsed(r);if(r++,p)return r-1}return-1},l=0,c=s();for(;c!==-1&&l<n.length;){let p=i.getTrackedRange(this._foldingRangeDecorationIds[c]);if(p){let h=p.start;for(;l<n.length;){let g=n.getStartLineNumber(l)-1;if(h>=g)n.setCollapsed(l,h===g),l++;else break}}c=s()}for(;l<n.length;)n.setCollapsed(l,!1),l++;let u=[];for(let p=0;p<n.length;p++){let h=n.toRegion(p);u.push({start:h.startLineNumber-1,end:h.endLineNumber-1})}this._foldingRangeDecorationIds.forEach(p=>i.setTrackedRange(p,null,3)),this._foldingRangeDecorationIds=u.map(p=>i.setTrackedRange(null,p,3)).filter(p=>p!==null),this._regions=n,this._onDidFoldingRegionChanges.fire()}getMemento(){let i=[],e=0;for(;e<this._regions.length;){if(this._regions.isCollapsed(e)){let o=this._regions.toRegion(e);i.push({start:o.startLineNumber-1,end:o.endLineNumber-1})}e++}return i}applyMemento(i){if(!this._viewModel)return!1;let e=0,t=0;for(;t<i.length&&e<this._regions.length;){if(this._viewModel.getTrackedRange(this._foldingRangeDecorationIds[e])){let n=i[t].start;for(;e<this._regions.length;){let r=this._regions.getStartLineNumber(e)-1;if(n>=r)this._regions.setCollapsed(e,n===r),e++;else break}}t++}for(;e<this._regions.length;)this._regions.setCollapsed(e,!1),e++;return!0}};function*$Ei(a){for(let i of oc.lexer(a,{gfm:!0}))i.type==="heading"&&(yield{depth:i.depth,text:Da({value:i.raw}).trim()})}var kM=class extends x{constructor(e){super();this._notebookEditor=e;this._foldingModel=null;this._localStore=this._register(new N);this._register(this._notebookEditor.onMouseUp(t=>{this.onMouseUp(t)})),this._register(this._notebookEditor.onDidChangeModel(()=>{this._localStore.clear(),this._notebookEditor.hasModel()&&(this._localStore.add(this._notebookEditor.onDidChangeCellState(t=>{t.source.editStateChanged&&t.cell.cellKind===1&&this._foldingModel?.recompute()})),this._foldingModel=new YUt,this._localStore.add(this._foldingModel),this._foldingModel.attachViewModel(this._notebookEditor.getViewModel()),this._localStore.add(this._foldingModel.onDidFoldingRegionChanged(()=>{this._updateEditorFoldingRanges()})))}))}static{this.id="workbench.notebook.foldingController"}saveViewState(){return this._foldingModel?.getMemento()||[]}restoreViewState(e){this._foldingModel?.applyMemento(e||[]),this._updateEditorFoldingRanges()}setFoldingStateDown(e,t,o){let n=t===2,r=this._foldingModel.getRegionAtLine(e+1),s=[];if(r&&(r.isCollapsed!==n&&s.push(r),o>1)){let l=this._foldingModel.getRegionsInside(r,(c,u)=>c.isCollapsed!==n&&u<o);s.push(...l)}s.forEach(l=>this._foldingModel.setCollapsed(l.regionIndex,t===2)),this._updateEditorFoldingRanges()}setFoldingStateUp(e,t,o){if(!this._foldingModel)return;this._foldingModel.getAllRegionsAtLine(e+1,(r,s)=>r.isCollapsed!==(t===2)&&s<=o).forEach(r=>this._foldingModel.setCollapsed(r.regionIndex,t===2)),this._updateEditorFoldingRanges()}_updateEditorFoldingRanges(){if(!this._foldingModel||!this._notebookEditor.hasModel())return;let e=this._notebookEditor.getViewModel();e.updateFoldingRanges(this._foldingModel.regions);let t=e.getHiddenRanges();this._notebookEditor.setHiddenAreas(t)}onMouseUp(e){if(!e.event.target||!this._notebookEditor.hasModel())return;let t=this._notebookEditor.getViewModel(),o=e.event.target;if(o.classList.contains("codicon-notebook-collapsed")||o.classList.contains("codicon-notebook-expanded")){if(!o.parentElement.classList.contains("notebook-folding-indicator"))return;let r=e.target,s=t.getCellIndex(r),l=t.getFoldingState(s);if(l===0)return;this.setFoldingStateUp(s,l===2?1:2,1),this._notebookEditor.focusElement(r)}}recompute(){this._foldingModel?.recompute()}};bm(kM.id,kM);var VJo=d(12489,null),Vho=L(12491,"Unfold Cell"),Bho={args:[{isOptional:!0,name:"index",description:"The cell index",schema:{type:"object",required:["index","direction"],properties:{index:{type:"number"},direction:{type:"string",enum:["up","down"],default:"down"},levels:{type:"number",default:1}}}}]};W(class extends K{constructor(){super({id:"notebook.fold",title:L(12490,"Fold Cell"),category:th,keybinding:{when:C.and(pr,C.not(np)),primary:3164,mac:{primary:2652,secondary:[15]},secondary:[15],weight:200},metadata:{description:VJo,args:Bho.args},precondition:Za,f1:!0})}async run(a,i){let e=a.get(ee),t=Jn(e.activeEditorPane);if(!t||!t.hasModel())return;let o=i&&i.levels||1,n=i&&i.direction==="up"?"up":"down",r;if(i)r=i.index;else{let l=t.getActiveCell();if(!l)return;r=t.getCellIndex(l)}let s=t.getContribution(kM.id);if(r!==void 0){if((r<0||r>=t.getLength()?void 0:t.cellAt(r))?.cellKind===2&&n==="down")return;n==="up"?s.setFoldingStateUp(r,2,o):s.setFoldingStateDown(r,2,o);let c=t.getViewModel().getNearestVisibleCellIndexUpwards(r);t.focusElement(t.cellAt(c))}}});W(class extends K{constructor(){super({id:"notebook.unfold",title:Vho,category:th,keybinding:{when:C.and(pr,C.not(np)),primary:3166,mac:{primary:2654,secondary:[17]},secondary:[17],weight:200},metadata:{description:Vho,args:Bho.args},precondition:Za,f1:!0})}async run(a,i){let e=a.get(ee),t=Jn(e.activeEditorPane);if(!t)return;let o=i&&i.levels||1,n=i&&i.direction==="up"?"up":"down",r;if(i)r=i.index;else{let l=t.getActiveCell();if(!l)return;r=t.getCellIndex(l)}let s=t.getContribution(kM.id);r!==void 0&&(n==="up"?s.setFoldingStateUp(r,1,o):s.setFoldingStateDown(r,1,o))}});var $Pe=class extends Rp{constructor(e,t,o){super();this._notebookEditor=e;this._container=t;this._notebookExecutionStateService=o;this._runButtonListener=this._register(new me);this._cellExecutionListener=this._register(new me)}didRenderCell(e){this.update(e)}update(e){if(!this._notebookEditor.hasModel()){this._cellExecutionListener.clear(),this._runButtonListener.clear();return}if(e.isInputCollapsed||e.getEditState()===1)this._cellExecutionListener.clear(),this._runButtonListener.clear(),vo(this._container);else if(e.foldingState===2){let t=this._notebookEditor.getViewModel().getCellIndex(e),o=this._notebookEditor.getViewModel().getFoldedLength(t),n=this.getRunFoldedSectionButton({start:t,end:t+o+1});n?vi(this._container,n,this.getHiddenCellsLabel(o),this.getHiddenCellHintButton(e)):vi(this._container,this.getHiddenCellsLabel(o),this.getHiddenCellHintButton(e)),un(this._container);let r=e.layoutInfo.previewHeight;this._container.style.top=`${r}px`}else this._cellExecutionListener.clear(),this._runButtonListener.clear(),vo(this._container)}getHiddenCellsLabel(e){let t=e===1?d(12796,null):d(12797,null,e);return _("span.notebook-folded-hint-label",void 0,t)}getHiddenCellHintButton(e){let t=_("span.cell-expand-part-button");return t.classList.add(...q.asClassNameArray(R.more)),this._register(j(t,re.CLICK,()=>{let o=this._notebookEditor.getContribution(kM.id),n=this._notebookEditor.getCellIndex(e);typeof n=="number"&&o.setFoldingStateDown(n,1,1)})),t}getRunFoldedSectionButton(e){let t=_("span.folded-cell-run-section-button"),o=this._notebookEditor.getCellsInRange(e);if(!o.some(l=>l.cellKind===2))return;let s=o.some(l=>{let c=this._notebookExecutionStateService.getCellExecution(l.uri);return c&&c.state===3})?q.modify(Qw,"spin"):R.play;return t.classList.add(...q.asClassNameArray(s)),this._runButtonListener.value=j(t,re.CLICK,()=>{this._notebookEditor.executeNotebookCells(o)}),this._cellExecutionListener.value=this._notebookExecutionStateService.onDidChangeExecution(()=>{let c=o.some(u=>{let p=this._notebookExecutionStateService.getCellExecution(u.uri);return p&&p.state===3})?q.modify(Qw,"spin"):R.play;t.className="",t.classList.add("folded-cell-run-section-button",...q.asClassNameArray(c))}),t}updateInternalLayoutNow(e){this.update(e)}};$Pe=I([m(2,bs)],$Pe);var jPe=class extends x{constructor(e,t,o,n,r,s,l,c,u,p){super();this.notebookEditor=e;this.viewCell=t;this.templateData=o;this.renderedEditors=n;this.accessibilityService=r;this.contextKeyService=s;this.instantiationService=l;this.languageService=c;this.configurationService=u;this.keybindingService=p;this.editor=null;this.localDisposables=this._register(new N);this.focusSwitchDisposable=this._register(new me);this.editorDisposables=this._register(new N);this._isDisposed=!1;this.constructDOM(),this.editorPart=o.editorPart,this.cellEditorOptions=this._register(new oW(this.notebookEditor.getBaseCellEditorOptions(t.language),this.notebookEditor.notebookOptions,this.configurationService)),this.cellEditorOptions.setLineNumbers(this.viewCell.lineNumbers),this.editorOptions=this.cellEditorOptions.getValue(this.viewCell.internalMetadata,this.viewCell.uri),this._register(Z(()=>n.delete(this.viewCell))),this.registerListeners(),this.templateData.cellParts.scheduleRenderCell(this.viewCell),this._register(Z(()=>{this.templateData.cellParts.unrenderCell(this.viewCell)})),this._register(this.accessibilityService.onDidChangeScreenReaderOptimized(()=>{this.viewUpdate()})),this.updateForHover(),this.updateForFocusModeChange(),this.foldingState=t.foldingState,this.layoutFoldingIndicator(),this.updateFoldingIconShowClass(),this.viewCell.layoutInfo.totalHeight>0&&this.relayoutCell(),this.viewUpdate(),this.layoutCellParts(),this._register(this.viewCell.onDidChangeLayout(()=>{this.layoutCellParts()}))}layoutCellParts(){this.templateData.cellParts.updateInternalLayoutNow(this.viewCell)}constructDOM(){let e=`aria-markup-cell-${this.viewCell.id}`;this.markdownAccessibilityContainer=this.templateData.cellContainer,this.markdownAccessibilityContainer.id=e,this.markdownAccessibilityContainer.style.height="1px",this.markdownAccessibilityContainer.style.overflow="hidden",this.markdownAccessibilityContainer.style.position="absolute",this.markdownAccessibilityContainer.style.top="100000px",this.markdownAccessibilityContainer.style.left="10000px",this.markdownAccessibilityContainer.ariaHidden="false",this.templateData.rootContainer.setAttribute("aria-describedby",e),this.templateData.container.classList.toggle("webview-backed-markdown-cell",!0)}registerListeners(){this._register(this.viewCell.onDidChangeState(e=>{this.templateData.cellParts.updateState(this.viewCell,e)})),this._register(this.viewCell.model.onDidChangeMetadata(()=>{this.viewUpdate()})),this._register(this.viewCell.onDidChangeState(e=>{if((e.editStateChanged||e.contentChanged)&&this.viewUpdate(),e.focusModeChanged&&this.updateForFocusModeChange(),e.foldingStateChanged){let t=this.viewCell.foldingState;t!==this.foldingState&&(this.foldingState=t,this.layoutFoldingIndicator())}e.cellIsHoveredChanged&&this.updateForHover(),e.inputCollapsedChanged&&(this.updateCollapsedState(),this.viewUpdate()),e.cellLineNumberChanged&&this.cellEditorOptions.setLineNumbers(this.viewCell.lineNumbers)})),this._register(this.notebookEditor.notebookOptions.onDidChangeOptions(e=>{e.showFoldingControls&&this.updateFoldingIconShowClass()})),this._register(this.viewCell.onDidChangeLayout(e=>{let t=this.editor?.getLayoutInfo();e.outerWidth&&this.viewCell.getEditState()===1&&t&&t.width!==this.viewCell.layoutInfo.editorWidth&&this.onCellEditorWidthChange()})),this._register(this.cellEditorOptions.onDidChange(()=>this.updateMarkupCellOptions()))}updateMarkupCellOptions(){if(this.updateEditorOptions(this.cellEditorOptions.getUpdatedValue(this.viewCell.internalMetadata,this.viewCell.uri)),this.editor){this.editor.updateOptions(this.cellEditorOptions.getUpdatedValue(this.viewCell.internalMetadata,this.viewCell.uri));let e=new Ye;this._register({dispose(){e.dispose(!0)}}),Va(this.viewCell.resolveTextModel(),e.token).then(t=>{this._isDisposed||t&&t.updateOptions({indentSize:this.cellEditorOptions.indentSize,tabSize:this.cellEditorOptions.tabSize,insertSpaces:this.cellEditorOptions.insertSpaces})})}}updateCollapsedState(){this.viewCell.isInputCollapsed?this.notebookEditor.hideMarkupPreviews([this.viewCell]):this.notebookEditor.unhideMarkupPreviews([this.viewCell])}updateForHover(){this.templateData.container.classList.toggle("markdown-cell-hover",this.viewCell.cellIsHovered)}updateForFocusModeChange(){this.viewCell.focusMode===1&&this.focusEditorIfNeeded(),this.templateData.container.classList.toggle("cell-editor-focus",this.viewCell.focusMode===1)}dispose(){this._isDisposed=!0,this.notebookEditor.getActiveCell()===this.viewCell&&this.viewCell.focusMode===1&&(this.notebookEditor.hasEditorFocus()||this.notebookEditor.getDomNode().ownerDocument.activeElement===this.notebookEditor.getDomNode().ownerDocument.body)&&this.notebookEditor.focusContainer(),this.viewCell.detachTextEditor(),super.dispose()}updateFoldingIconShowClass(){let e=this.notebookEditor.notebookOptions.getDisplayOptions().showFoldingControls;this.templateData.foldingIndicator.classList.remove("mouseover","always"),this.templateData.foldingIndicator.classList.add(e)}viewUpdate(){this.viewCell.isInputCollapsed?this.viewUpdateCollapsed():this.viewCell.getEditState()===1?this.viewUpdateEditing():this.viewUpdatePreview()}viewUpdateCollapsed(){un(this.templateData.cellInputCollapsedContainer),vo(this.editorPart),this.templateData.cellInputCollapsedContainer.innerText="",M(this.templateData.cellInputCollapsedContainer,_("span")).classList.add(...q.asClassNameArray(R.markdown));let t=_("div");t.classList.add("cell-collapse-preview");let o=this.getRichText(this.viewCell.textBuffer,this.viewCell.language);t.innerText=o,t.innerHTML=$tt?.createHTML(o)??o,this.templateData.cellInputCollapsedContainer.appendChild(t);let n=M(t,_("span.expandInputIcon"));n.classList.add(...q.asClassNameArray(R.more));let r=this.keybindingService.lookupKeybinding(PEe);r&&(t.title=d(12799,null,r.getLabel()),n.title=d(12798,null,r.getLabel())),this.markdownAccessibilityContainer.ariaHidden="true",this.templateData.container.classList.toggle("input-collapsed",!0),this.viewCell.renderedMarkdownHeight=0,this.viewCell.layoutChange({})}getRichText(e,t){return iyt(this.languageService,e.getLineContent(1),t)}viewUpdateEditing(){let e;if(un(this.editorPart),this.markdownAccessibilityContainer.ariaHidden="true",vo(this.templateData.cellInputCollapsedContainer),this.notebookEditor.hideMarkupPreviews([this.viewCell]),this.templateData.container.classList.toggle("input-collapsed",!1),this.templateData.container.classList.toggle("markdown-cell-edit-mode",!0),this.editor&&this.editor.hasModel())e=this.editor.getContentHeight(),this.viewCell.attachTextEditor(this.editor),this.focusEditorIfNeeded(),this.bindEditorListeners(this.editor),this.editor.layout({width:this.viewCell.layoutInfo.editorWidth,height:e});else{this.editorDisposables.clear();let t=this.notebookEditor.notebookOptions.computeMarkdownCellEditorWidth(this.notebookEditor.getLayoutInfo().width),o=this.viewCell.lineCount,n=this.viewCell.layoutInfo.fontInfo?.lineHeight||17,r=this.notebookEditor.notebookOptions.computeEditorPadding(this.viewCell.internalMetadata,this.viewCell.uri);e=Math.max(o,1)*n+r.top+r.bottom,this.templateData.editorContainer.innerText="";let s=this.contextKeyService.createScoped(this.templateData.editorPart);pe.inCompositeEditor.bindTo(s).set(!0);let l=this.editorDisposables.add(this.instantiationService.createChild(new _o([X,s])));this.editorDisposables.add(s),this.editor=this.editorDisposables.add(l.createInstance(Xr,this.templateData.editorContainer,{...this.editorOptions,dimension:{width:t,height:e},allowVariableLineHeights:!1},{contributions:this.notebookEditor.creationOptions.cellEditorContributions})),this.templateData.currentEditor=this.editor,this.editorDisposables.add(this.editor.onDidBlurEditorWidget(()=>{this.editor&&hS.get(this.editor)?.stopHighlighting()})),this.editorDisposables.add(this.editor.onDidFocusEditorWidget(()=>{this.editor&&hS.get(this.editor)?.restoreViewState(!0)}));let c=new Ye;this.editorDisposables.add({dispose(){c.dispose(!0)}}),Va(this.viewCell.resolveTextModel(),c.token).then(u=>{if(!u)return;this.editor.setModel(u),u.updateOptions({indentSize:this.cellEditorOptions.indentSize,tabSize:this.cellEditorOptions.tabSize,insertSpaces:this.cellEditorOptions.insertSpaces});let p=this.editor.getContentHeight();p!==e&&(this.editor.layout({width:t,height:p}),e=p),this.viewCell.attachTextEditor(this.editor),this.viewCell.getEditState()===1&&this.focusEditorIfNeeded(),this.bindEditorListeners(this.editor),this.viewCell.editorHeight=e})}this.viewCell.editorHeight=e,this.focusEditorIfNeeded(),this.renderedEditors.set(this.viewCell,this.editor)}viewUpdatePreview(){this.viewCell.detachTextEditor(),vo(this.editorPart),vo(this.templateData.cellInputCollapsedContainer),this.markdownAccessibilityContainer.ariaHidden="false",this.templateData.container.classList.toggle("input-collapsed",!1),this.templateData.container.classList.toggle("markdown-cell-edit-mode",!1),this.renderedEditors.delete(this.viewCell),this.markdownAccessibilityContainer.innerText="",this.viewCell.renderedHtml&&(this.accessibilityService.isScreenReaderOptimized()?NP(this.markdownAccessibilityContainer,this.viewCell.renderedHtml):Rt(this.markdownAccessibilityContainer)),this.notebookEditor.createMarkupPreview(this.viewCell)}focusEditorIfNeeded(){if(this.viewCell.focusMode===1&&(this.notebookEditor.hasEditorFocus()||this.notebookEditor.getDomNode().ownerDocument.activeElement===this.notebookEditor.getDomNode().ownerDocument.body)){if(!this.editor)return;this.editor.focus();let e=this.editor.getSelection();if(!e)return;this.notebookEditor.revealRangeInViewAsync(this.viewCell,e)}}layoutEditor(e){this.editor?.layout(e)}onCellEditorWidthChange(){let e=this.editor.getContentHeight();this.layoutEditor({width:this.viewCell.layoutInfo.editorWidth,height:e})}relayoutCell(){this.notebookEditor.layoutNotebookCell(this.viewCell,this.viewCell.layoutInfo.totalHeight),this.layoutFoldingIndicator()}updateEditorOptions(e){this.editorOptions=e,this.editor?.updateOptions(this.editorOptions)}layoutFoldingIndicator(){switch(this.foldingState){case 0:this.templateData.foldingIndicator.style.display="none",this.templateData.foldingIndicator.innerText="";break;case 2:this.templateData.foldingIndicator.style.display="",vi(this.templateData.foldingIndicator,Sn(uUt));break;case 1:this.templateData.foldingIndicator.style.display="",vi(this.templateData.foldingIndicator,Sn(pUt));break;default:break}}bindEditorListeners(e){this.localDisposables.clear(),this.focusSwitchDisposable.clear(),this.localDisposables.add(e.onDidContentSizeChange(o=>{o.contentHeightChanged&&this.onCellEditorHeightChange(e,o.contentHeight)})),this.localDisposables.add(e.onDidChangeCursorSelection(o=>{if(o.source==="restoreState")return;let n=e.getSelections();if(n?.length){let r=e.getContentHeight(),s=this.viewCell.layoutInfo.editorHeight;r!==s&&this.onCellEditorHeightChange(e,r);let l=n[n.length-1];this.notebookEditor.revealRangeInViewAsync(this.viewCell,l)}}));let t=()=>this.viewCell.focusMode=e.hasWidgetFocus()?1:0;this.localDisposables.add(e.onDidFocusEditorWidget(()=>{t()})),this.localDisposables.add(e.onDidBlurEditorWidget(()=>{this.templateData.container.ownerDocument.activeElement?.contains(this.templateData.container)?this.focusSwitchDisposable.value=tn(()=>t(),300):t()})),t()}onCellEditorHeightChange(e,t){let o=e.getLayoutInfo();this.viewCell.editorHeight=t,e.layout({width:o.width,height:t})}};jPe=I([m(4,Oi),m(5,X),m(6,F),m(7,_t),m(8,B),m(9,_e)],jPe);var oh=_,QPe=class extends x{constructor(e,t){super();this.configurationService=t;let o=this.configurationService.getValue("editor");this.lineHeight=QS(o,bu.getInstance(e).value).lineHeight}getHeight(e){return e.getHeight(this.lineHeight)}getDynamicHeight(e){return e.getDynamicHeight()}getTemplateId(e){return e.cellKind===1?y8.TEMPLATE_ID:w8.TEMPLATE_ID}};QPe=I([m(1,B)],QPe);var XUt=class extends x{constructor(e,t,o,n,r,s,l,c,u,p){super();this.instantiationService=e;this.notebookEditor=t;this.contextMenuService=o;this.menuService=n;this.keybindingService=s;this.notificationService=l;this.contextKeyServiceProvider=c;this.dndController=p;this.editorOptions=this._register(new oW(this.notebookEditor.getBaseCellEditorOptions(u),this.notebookEditor.notebookOptions,r))}dispose(){super.dispose(),this.dndController=void 0}},y8=class extends XUt{constructor(e,t,o,n,r,s,l,c,u,p,h){super(s,e,l,c,r,u,p,n,"markdown",t);this.renderedEditors=o;this._notebookExecutionStateService=h}static{this.TEMPLATE_ID="markdown_cell"}get templateId(){return y8.TEMPLATE_ID}renderTemplate(e){e.classList.add("markdown-cell-row");let t=M(e,_(".cell-inner-container")),o=new N,n=o.add(this.contextKeyServiceProvider(t)),r=M(e,oh(".cell-decoration")),s=M(t,oh(".cell-title-toolbar")),l=new cf(M(t,oh(".cell-focus-indicator.cell-focus-indicator-top"))),c=new cf(M(t,_(".cell-focus-indicator.cell-focus-indicator-side.cell-focus-indicator-left"))),u=M(c.domNode,_(".notebook-folding-indicator")),p=new cf(M(t,_(".cell-focus-indicator.cell-focus-indicator-side.cell-focus-indicator-right"))),h=M(t,oh(".cell.code")),g=M(h,oh(".cell-editor-part")),f=M(g,oh(".cell-chat-part")),v=M(h,oh(".input-collapse-container"));v.style.display="none";let b=M(g,oh(".cell-editor-container"));g.style.display="none";let S=M(t,oh(".cell-comment-container")),y=M(t,oh(".cell.markdown")),w=M(t,oh(".cell-bottom-toolbar-container")),k=o.add(this.instantiationService.createChild(new _o([X,n]))),T={toggle:(G,$)=>t.classList.toggle(G,$)},P=o.add(k.createInstance(Che,s,T,this.notebookEditor.creationOptions.menuIds.cellTitleToolbar,this.notebookEditor.creationOptions.menuIds.cellDeleteToolbar,this.notebookEditor)),O=new cf(M(t,oh(".cell-focus-indicator.cell-focus-indicator-bottom"))),V=new Ftt(Re(e),[o.add(k.createInstance(Htt,this.notebookEditor,f)),o.add(k.createInstance(yhe,this.notebookEditor,t,g,void 0)),o.add(new Ktt(this.notebookEditor,P,l,c,p,O)),o.add(new $Pe(this.notebookEditor,M(t,oh(".notebook-folded-hint")),this._notebookExecutionStateService)),o.add(new Utt(this.notebookEditor,e,r)),o.add(k.createInstance(Ihe,this.notebookEditor,S)),o.add(new Qtt(this.notebookEditor,v)),o.add(new ztt(t,void 0,this.notebookEditor)),o.add(new Wtt(t)),o.add(k.createInstance(fhe,this.notebookEditor))],[P,o.add(k.createInstance(whe,this.notebookEditor,s,w))]);return o.add(V),{rootContainer:e,cellInputCollapsedContainer:v,instantiationService:k,container:t,cellContainer:y,editorPart:g,editorContainer:b,foldingIndicator:u,templateDisposables:o,elementDisposables:o.add(new N),cellParts:V,toJSON:()=>({})}}renderElement(e,t,o,n){if(!this.notebookEditor.hasModel())throw new Error("The notebook editor is not attached with view model yet.");o.currentRenderedCell=e,o.currentEditor=void 0,o.editorPart.style.display="none",o.cellContainer.innerText="",n?.height!==void 0&&o.elementDisposables.add(o.instantiationService.createInstance(jPe,this.notebookEditor,e,o,this.renderedEditors))}disposeTemplate(e){e.templateDisposables.dispose()}disposeElement(e,t,o){o.elementDisposables.clear()}};y8=I([m(4,B),m(5,F),m(6,Xe),m(7,Kt),m(8,_e),m(9,Ne),m(10,bs)],y8);var w8=class extends XUt{constructor(e,t,o,n,r,s,l,c,u,p,h){super(u,e,l,c,s,p,h,r,$r,n);this.renderedEditors=t;this.editorPool=o}static{this.TEMPLATE_ID="code_cell"}get templateId(){return w8.TEMPLATE_ID}renderTemplate(e){e.classList.add("code-cell-row");let t=M(e,_(".cell-inner-container")),o=new N,n=o.add(this.contextKeyServiceProvider(t)),r=M(e,oh(".cell-decoration")),s=new cf(M(t,oh(".cell-focus-indicator.cell-focus-indicator-top"))),l=M(t,oh(".cell-title-toolbar")),c=new cf(M(t,_(".cell-focus-indicator.cell-focus-indicator-side.cell-focus-indicator-left"))),u=M(t,oh(".cell-chat-part")),p=M(t,oh(".cell.code")),h=M(p,oh(".run-button-container")),g=M(p,oh(".input-collapse-container"));g.style.display="none";let f=M(c.domNode,oh("div.execution-count-label"));f.title=d(12804,null);let v=M(p,oh(".cell-editor-part")),b=M(v,oh(".cell-editor-container")),S=M(t,oh(".cell-comment-container")),y=o.add(this.contextKeyServiceProvider(v)),w=o.add(this.instantiationService.createChild(new _o([X,y])));pe.inCompositeEditor.bindTo(y).set(!0);let k=w.createInstance(Xr,b,{...this.editorOptions.getDefaultValue(),allowVariableLineHeights:!1,dimension:{width:0,height:0},scrollbar:{vertical:"hidden",horizontal:"auto",handleMouseWheel:!1,useShadows:!1}},{contributions:this.notebookEditor.creationOptions.cellEditorContributions});o.add(k);let T=new cf(M(t,oh(".output"))),P=M(T.domNode,oh(".output-collapse-container")),O=new cf(M(t,oh(".output-show-more-container"))),V=new cf(M(t,_(".cell-focus-indicator.cell-focus-indicator-side.cell-focus-indicator-right"))),H=M(t,oh(".cell-editor-focus-sink"));H.setAttribute("tabindex","0");let G=M(t,oh(".cell-bottom-toolbar-container")),$=new cf(M(t,oh(".cell-focus-indicator.cell-focus-indicator-bottom"))),J=o.add(this.instantiationService.createChild(new _o([X,n]))),ae={toggle:(pt,et)=>t.classList.toggle(pt,et)},he=o.add(J.createInstance(Che,l,ae,this.notebookEditor.creationOptions.menuIds.cellTitleToolbar,this.notebookEditor.creationOptions.menuIds.cellDeleteToolbar,this.notebookEditor)),oe=o.add(new Ktt(this.notebookEditor,he,s,c,V,$)),de=[oe,o.add(J.createInstance(Htt,this.notebookEditor,u)),o.add(J.createInstance(yhe,this.notebookEditor,t,v,k)),o.add(J.createInstance(VPe,v,g)),o.add(new Utt(this.notebookEditor,e,r)),o.add(J.createInstance(Ihe,this.notebookEditor,S)),o.add(J.createInstance(WPe,this.notebookEditor,f)),o.add(J.createInstance(qPe,this.notebookEditor,P)),o.add(new Qtt(this.notebookEditor,g)),o.add(new ztt(t,H,this.notebookEditor)),o.add(new Wtt(t)),o.add(J.createInstance(fhe,this.notebookEditor))],{cellExecutePrimary:Ce,cellExecuteToolbar:xe}=this.notebookEditor.creationOptions.menuIds;Ce&&xe&&de.push(o.add(J.createInstance(GPe,this.notebookEditor,n,t,h,Ce,xe)));let ze=new Ftt(Re(e),de,[he,o.add(J.createInstance(whe,this.notebookEditor,l,G))]);o.add(ze);let De={rootContainer:e,editorPart:v,cellInputCollapsedContainer:g,cellOutputCollapsedContainer:P,instantiationService:J,container:t,cellContainer:p,focusSinkElement:H,outputContainer:T,outputShowMoreContainer:O,editor:k,templateDisposables:o,elementDisposables:o.add(new N),cellParts:ze,toJSON:()=>({})},Oe=[c.domNode,oe.codeFocusIndicator.domNode,oe.outputFocusIndicator.domNode];return this.dndController?.registerDragHandle(De,e,Oe,()=>new qUt().getDragImage(De,De.editor,"code")),De}renderElement(e,t,o,n){if(!this.notebookEditor.hasModel())throw new Error("The notebook editor is not attached with view model yet.");o.currentRenderedCell=e,n?.height!==void 0&&(o.outputContainer.domNode.innerText="",o.outputContainer.domNode.appendChild(o.cellOutputCollapsedContainer),o.elementDisposables.add(o.instantiationService.createInstance(KPe,this.notebookEditor,e,o,this.editorPool)),this.renderedEditors.set(e,o.editor))}disposeTemplate(e){e.templateDisposables.dispose()}disposeElement(e,t,o){o.elementDisposables.clear(),this.renderedEditors.delete(e)}};w8=I([m(5,B),m(6,Xe),m(7,Kt),m(8,F),m(9,_e),m(10,Ne)],w8);var YPe=class extends x{constructor(){super(...arguments);this._onDidChangeLayout=this._register(new E);this.onDidChangeLayout=this._onDidChangeLayout.event;this._onDidChangeMetadata=this._register(new E);this.onDidChangeMetadata=this._onDidChangeMetadata.event;this._onDidChangeCellState=this._register(new E);this.onDidChangeCellState=this._onDidChangeCellState.event}emit(e){for(let t=0,o=e.length;t<o;t++){let n=e[t];switch(n.type){case 1:this._onDidChangeLayout.fire(n);break;case 2:this._onDidChangeMetadata.fire(n);break;case 3:this._onDidChangeCellState.fire(n);break}}}};var XPe=class extends x{constructor(e,t){super();this._notebookEditor=e;this.ownerID=t;this._allMatchesDecorations=[];this._currentMatchCellDecorations=[];this._allMatchesCellDecorations=[];this._currentMatchDecorations=null}get currentMatchDecorations(){return this._currentMatchDecorations}clearDecorations(){this.clearCurrentFindMatchDecoration(),this.setAllFindMatchesDecorations([])}async highlightCurrentFindMatchDecorationInCell(e,t){return this.clearCurrentFindMatchDecoration(),this._notebookEditor.changeModelDecorations(o=>{let n=a5._CURRENT_FIND_MATCH_DECORATION,r=[{range:t,options:n}],s={ownerId:e.handle,decorations:r};this._currentMatchDecorations={kind:"input",decorations:o.deltaDecorations(this._currentMatchDecorations?.kind==="input"?this._currentMatchDecorations.decorations:[],[s])}}),this._currentMatchCellDecorations=this._notebookEditor.deltaCellDecorations(this._currentMatchCellDecorations,[{handle:e.handle,options:{overviewRuler:{color:Nye,modelRanges:[t],includeOutput:!1,position:2}}}]),null}async highlightCurrentFindMatchDecorationInWebview(e,t){this.clearCurrentFindMatchDecoration();let o=await this._notebookEditor.findHighlightCurrent(t,this.ownerID);return this._currentMatchDecorations={kind:"output",index:t},this._currentMatchCellDecorations=this._notebookEditor.deltaCellDecorations(this._currentMatchCellDecorations,[{handle:e.handle,options:{overviewRuler:{color:Nye,modelRanges:[],includeOutput:!0,position:2}}}]),o}clearCurrentFindMatchDecoration(){this._currentMatchDecorations?.kind==="input"?this._notebookEditor.changeModelDecorations(e=>{e.deltaDecorations(this._currentMatchDecorations?.kind==="input"?this._currentMatchDecorations.decorations:[],[]),this._currentMatchDecorations=null}):this._currentMatchDecorations?.kind==="output"&&this._notebookEditor.findUnHighlightCurrent(this._currentMatchDecorations.index,this.ownerID),this._currentMatchCellDecorations=this._notebookEditor.deltaCellDecorations(this._currentMatchCellDecorations,[])}setAllFindMatchesDecorations(e){this._notebookEditor.changeModelDecorations(t=>{let o=a5._FIND_MATCH_DECORATION,n=e.map(r=>{let s=new Array(r.contentMatches.length);for(let l=0;l<r.contentMatches.length;l++)s[l]={range:r.contentMatches[l].range,options:o};return{ownerId:r.cell.handle,decorations:s}});this._allMatchesDecorations=t.deltaDecorations(this._allMatchesDecorations,n)}),this._allMatchesCellDecorations=this._notebookEditor.deltaCellDecorations(this._allMatchesCellDecorations,e.map(t=>({ownerId:t.cell.handle,handle:t.cell.handle,options:{overviewRuler:{color:EO,modelRanges:t.contentMatches.map(o=>o.range),includeOutput:t.webviewMatches.length>0,position:2}}})))}stopWebviewFind(){this._notebookEditor.findStop(this.ownerID)}dispose(){this.clearDecorations(),super.dispose()}};var C8=class{get length(){return this._contentMatches.length+this._webviewMatches.length}get contentMatches(){return this._contentMatches}get webviewMatches(){return this._webviewMatches}constructor(i,e,t,o){this.cell=i,this.index=e,this._contentMatches=t,this._webviewMatches=o}getMatch(i){if(i>=this.length)throw new Error("NotebookCellFindMatch: index out of range");return i<this._contentMatches.length?this._contentMatches[i]:this._webviewMatches[i-this._contentMatches.length]}},ZPe=class extends x{constructor(e,t,o){super();this._notebookEditor=e;this._state=t;this._configurationService=o;this._findMatches=[];this._findMatchesStarts=null;this._currentMatch=-1;this._computePromise=null;this._modelDisposable=this._register(new N);this._throttledDelayer=this._register(new Xo(20)),this._computePromise=null,this._register(t.onFindReplaceStateChange(n=>{this._updateCellStates(n),(n.searchString||n.isRegex||n.matchCase||n.searchScope||n.wholeWord||n.isRevealed&&this._state.isRevealed||n.filters||n.isReplaceRevealed)&&this.research(),n.isRevealed&&!this._state.isRevealed&&this.clear()})),this._register(this._notebookEditor.onDidChangeModel(n=>{this._registerModelListener(n)})),this._register(this._notebookEditor.onDidChangeCellState(n=>{n.cell.cellKind===1&&n.source.editStateChanged&&this.research()})),this._notebookEditor.hasModel()&&this._registerModelListener(this._notebookEditor.textModel),this._findMatchDecorationModel=new XPe(this._notebookEditor,this._notebookEditor.getId())}get findMatches(){return this._findMatches}get currentMatch(){return this._currentMatch}_updateCellStates(e){if(!this._state.filters?.markupInput||!this._state.filters?.markupPreview||!this._state.filters?.findScope)return;let t=()=>{let o=this._notebookEditor.getViewModel();if(!o)return;let n=this._configurationService.inspect("editor.wordSeparators").value,r={regex:this._state.isRegex,wholeWord:this._state.wholeWord,caseSensitive:this._state.matchCase,wordSeparators:n,includeMarkupInput:!0,includeCodeInput:!1,includeMarkupPreview:!1,includeOutput:!1,findScope:this._state.filters?.findScope},s=o.find(this._state.searchString,r);for(let l=0;l<o.length;l++){let c=o.cellAt(l);if(c&&c.cellKind===1){let p=s.find(g=>g.cell.handle===c.handle&&g.contentMatches.length>0)?1:0,h=c.getEditState();if(h===1&&c.editStateSource!=="find")continue;h!==p&&c.updateEditState(p,"find")}}};if(e.isReplaceRevealed&&!this._state.isReplaceRevealed){let o=this._notebookEditor.getViewModel();if(!o)return;for(let n=0;n<o.length;n++){let r=o.cellAt(n);r&&r.cellKind===1&&r.getEditState()===1&&r.editStateSource==="find"&&r.updateEditState(0,"find")}return}(e.isReplaceRevealed||(e.filters||e.isRevealed||e.searchString||e.replaceString)&&this._state.isRevealed&&this._state.isReplaceRevealed)&&t()}ensureFindMatches(){this._findMatchesStarts||this.set(this._findMatches,!0)}getCurrentMatch(){let e=this._findMatchesStarts.getIndexOf(this._currentMatch),t=this._findMatches[e.index].cell,o=this._findMatches[e.index].getMatch(e.remainder);return{cell:t,match:o,isModelMatch:e.remainder<this._findMatches[e.index].contentMatches.length}}refreshCurrentMatch(e){let t=this.findMatches.findIndex(s=>s.cell===e.cell);if(t===-1)return;let n=this.findMatches[t].contentMatches.findIndex(s=>s.range.intersectRanges(e.range)!==null);if(n===void 0)return;let r=t===0?0:this._findMatchesStarts?.getPrefixSum(t-1)??0;this._currentMatch=r+n,this.highlightCurrentFindMatchDecoration(t,n).then(async s=>{await this.revealCellRange(t,n,s),this._state.changeMatchInfo(this._currentMatch,this._findMatches.reduce((l,c)=>l+c.length,0),void 0)})}find(e){if(!this.findMatches.length)return;if(!this._findMatchesStarts)this.set(this._findMatches,!0),No(e,{index:!0})&&(this._currentMatch=e.index);else{let o=this._findMatchesStarts.getTotalSum();if(No(e,{index:!0}))this._currentMatch=e.index;else if(this._currentMatch===-1)this._currentMatch=e.previous?o-1:0;else{let n=(this._currentMatch+(e.previous?-1:1)+o)%o;this._currentMatch=n}}let t=this._findMatchesStarts.getIndexOf(this._currentMatch);this.highlightCurrentFindMatchDecoration(t.index,t.remainder).then(async o=>{await this.revealCellRange(t.index,t.remainder,o),this._state.changeMatchInfo(this._currentMatch,this._findMatches.reduce((n,r)=>n+r.length,0),void 0)})}async revealCellRange(e,t,o){let n=this._findMatches[e];if(t>=n.contentMatches.length)this._notebookEditor.focusElement(n.cell),this._notebookEditor.getCellIndex(n.cell)!==void 0&&this._notebookEditor.revealCellOffsetInCenter(n.cell,o??0);else{let r=n.getMatch(t);n.cell.getEditState()!==1&&n.cell.updateEditState(1,"find"),n.cell.isInputCollapsed=!1,this._notebookEditor.focusElement(n.cell),this._notebookEditor.setCellEditorSelection(n.cell,r.range),await this._notebookEditor.revealInView(n.cell),this._notebookEditor.revealRangeInCenterIfOutsideViewportAsync(n.cell,r.range)}}_registerModelListener(e){this._modelDisposable.clear(),e&&this._modelDisposable.add(e.onDidChangeContent(t=>{t.rawEvents.some(o=>o.kind===10||o.kind===1)&&this.research()})),this.research()}async research(){return this._throttledDelayer.trigger(async()=>{this._state.change({isSearching:!0},!1),await this._research(),this._state.change({isSearching:!1},!1)})}async _research(){if(this._computePromise?.cancel(),!this._state.isRevealed||!this._notebookEditor.hasModel()){this.set([],!1);return}this._computePromise=Ln(l=>this._compute(l));let e=await this._computePromise;if(!e){this.set([],!1);return}if(e.length===0){this.set([],!1);return}let t=l=>{let c=Ky(e.map(u=>u.index),u=>u>=l);this._updateCurrentMatch(e,this._matchesCountBeforeIndex(e,c))};if(this._currentMatch===-1)if(this._notebookEditor.getLength()===0){this.set(e,!1);return}else{let l=this._notebookEditor.getFocus().start;t(l),this.set(e,!1);return}let o=this._findMatchesStarts.getIndexOf(this._currentMatch),n=this._findMatches[o.index].cell,r=this._notebookEditor.getCellIndex(n);if(r<0){if(this._notebookEditor.getLength()===0){this.set(e,!1);return}t(r);return}let s=this._notebookEditor.cellAt(r);if(s.cellKind===1&&s.getEditState()===0){t(r);return}if(!this._findMatchDecorationModel.currentMatchDecorations){t(r);return}if(this._findMatchDecorationModel.currentMatchDecorations.kind==="input"){let l=this._findMatchDecorationModel.currentMatchDecorations.decorations.find(u=>u.ownerId===s.handle);if(!l){t(r);return}let c=Ky(e,u=>u.index>=r)%e.length;if(e[c].index>r){this._updateCurrentMatch(e,this._matchesCountBeforeIndex(e,c));return}else{let u=s.editorAttached&&l.decorations[0]?s.getCellDecorationRange(l.decorations[0]):null;if(u===null&&o.remainder<this._findMatches[o.index].contentMatches.length&&(u=this._findMatches[o.index].getMatch(o.remainder).range),u!==null){let p=e[c],h=Ky(p.contentMatches,g=>z.compareRangesUsingStarts(g.range,u)>=0);this._updateCurrentMatch(e,this._matchesCountBeforeIndex(e,c)+h)}else{this._updateCurrentMatch(e,this._matchesCountBeforeIndex(e,c));return}}}else{let l=Ky(e.map(c=>c.index),c=>c>=r)%e.length;this._updateCurrentMatch(e,this._matchesCountBeforeIndex(e,l))}}set(e,t){if(!e||!e.length){this._findMatches=[],this._findMatchDecorationModel.setAllFindMatchesDecorations([]),this.constructFindMatchesStarts(),this._currentMatch=-1,this._findMatchDecorationModel.clearCurrentFindMatchDecoration(),this._state.changeMatchInfo(this._currentMatch,this._findMatches.reduce((o,n)=>o+n.length,0),void 0);return}this._findMatches=e,this._findMatchDecorationModel.setAllFindMatchesDecorations(e||[]),this.constructFindMatchesStarts(),t&&(this._currentMatch=0,this.highlightCurrentFindMatchDecoration(0,0)),this._state.changeMatchInfo(this._currentMatch,this._findMatches.reduce((o,n)=>o+n.length,0),void 0)}async _compute(e){if(!this._notebookEditor.hasModel())return null;let t=null,o=this._state.searchString,n=this._configurationService.inspect("editor.wordSeparators").value,r={regex:this._state.isRegex,wholeWord:this._state.wholeWord,caseSensitive:this._state.matchCase,wordSeparators:n,includeMarkupInput:this._state.filters?.markupInput??!0,includeCodeInput:this._state.filters?.codeInput??!0,includeMarkupPreview:!!this._state.filters?.markupPreview,includeOutput:!!this._state.filters?.codeOutput,findScope:this._state.filters?.findScope};return t=await this._notebookEditor.find(o,r,e),e.isCancellationRequested?null:t}_updateCurrentMatch(e,t){this._currentMatch=t%e.length,this.set(e,!1);let o=this._findMatchesStarts.getIndexOf(this._currentMatch);this.highlightCurrentFindMatchDecoration(o.index,o.remainder),this._state.changeMatchInfo(this._currentMatch,this._findMatches.reduce((n,r)=>n+r.length,0),void 0)}_matchesCountBeforeIndex(e,t){let o=0;for(let n=0;n<t;n++)o+=e[n].length;return o}constructFindMatchesStarts(){if(this._findMatches&&this._findMatches.length){let e=new Uint32Array(this._findMatches.length);for(let t=0;t<this._findMatches.length;t++)e[t]=this._findMatches[t].length;this._findMatchesStarts=new C_(e)}else this._findMatchesStarts=null}async highlightCurrentFindMatchDecoration(e,t){let o=this._findMatches[e].cell,n=this._findMatches[e].getMatch(t);return t<this._findMatches[e].contentMatches.length?this._findMatchDecorationModel.highlightCurrentFindMatchDecorationInCell(o,n.range):this._findMatchDecorationModel.highlightCurrentFindMatchDecorationInWebview(o,n.index)}clear(){this._computePromise?.cancel(),this._throttledDelayer.cancel(),this.set([],!1)}dispose(){this._findMatchDecorationModel.dispose(),super.dispose()}};ZPe=I([m(2,B)],ZPe);var JUt=class extends x{constructor(){super(...arguments);this._onDidChangeSelection=this._register(new E);this._primary={start:0,end:0};this._selections=[{start:0,end:0}]}get onDidChangeSelection(){return this._onDidChangeSelection.event}get selections(){return this._selections}get focus(){return this._primary}setState(e,t,o,n){let r=e??{start:0,end:0},s=t.length>0?t:[{start:0,end:0}],l=!I6e([r],[this._primary])||!I6e(this._selections,s);this._primary=r,this._selections=s,(l||o)&&this._onDidChangeSelection.fire(n)}setSelections(e,t,o){this.setState(this._primary,e,t,o)}};var BJo=()=>{throw new Error("Invalid change accessor")},QEi=class{constructor(){this._decorationsTree=new j7}intervalSearch(i,e,t,o,n,r,s=!1){return this._decorationsTree.intervalSearch(i,e,t,o,n,r,s)}search(i,e,t,o,n,r){return this._decorationsTree.search(i,e,t,n,r)}collectNodesFromOwner(i){return this._decorationsTree.collectNodesFromOwner(i)}collectNodesPostOrder(){return this._decorationsTree.collectNodesPostOrder()}insert(i){this._decorationsTree.insert(i)}delete(i){this._decorationsTree.delete(i)}resolveNode(i,e){this._decorationsTree.resolveNode(i,e)}acceptReplace(i,e,t,o){this._decorationsTree.acceptReplace(i,e,t,o)}},Hho=[mo.register({description:"notebook-view-model-tracked-range-always-grows-when-typing-at-edges",stickiness:0}),mo.register({description:"notebook-view-model-tracked-range-never-grows-when-typing-at-edges",stickiness:1}),mo.register({description:"notebook-view-model-tracked-range-grows-only-when-typing-before",stickiness:2}),mo.register({description:"notebook-view-model-tracked-range-grows-only-when-typing-after",stickiness:3})];function HJo(a){return a instanceof mo?a:mo.createDynamic(a)}var jEi=0,Cte=class extends x{constructor(e,t,o,n,r,s,l,c,u,p){super();this.viewType=e;this._notebook=t;this._viewContext=o;this._layoutInfo=n;this._options=r;this._instantiationService=s;this._bulkEditService=l;this._undoService=c;this._textModelService=u;this.notebookExecutionStateService=p;this._localStore=this._register(new N);this._handleToViewCellMapping=new Map;this._onDidChangeOptions=this._register(new E);this._viewCells=[];this._onDidChangeViewCells=this._register(new E);this._lastNotebookEditResource=[];this._onDidChangeSelection=this._register(new E);this._selectionCollection=this._register(new JUt);this._decorationsTree=new QEi;this._decorations=Object.create(null);this._lastDecorationId=0;this._foldingRanges=null;this._onDidFoldingStateChanged=this._register(new E);this.onDidFoldingStateChanged=this._onDidFoldingStateChanged.event;this._hiddenRanges=[];this._focused=!0;this._decorationIdToCellMap=new Map;this._statusBarItemIdToCellMap=new Map;this._lastOverviewRulerDecorationId=0;this._overviewRulerDecorations=new Map;jEi++,this.id="$notebookViewModel"+jEi,this._instanceId=mIe(jEi);let h=(f,v)=>{let b=f.map(k=>[k[0],k[1],k[2].map(T=>Uho(this._instantiationService,this,T,this._viewContext))]);b.reverse().forEach(k=>{let T=this._viewCells.splice(k[0],k[1],...k[2]);this._decorationsTree.acceptReplace(k[0],k[1],k[2].length,!0),T.forEach(P=>{this._handleToViewCellMapping.delete(P.handle),P.dispose()}),k[2].forEach(P=>{this._handleToViewCellMapping.set(P.handle,P),this._localStore.add(P)})});let S=this.selectionHandles;this._onDidChangeViewCells.fire({synchronous:v,splices:b});let y=[];if(S.length){let k=S[0],T=this._viewCells.indexOf(this.getCellByHandle(k));y=[k];let P=0;for(let O=0;O<b.length;O++){let V=b[0];if(V[0]+V[1]<=T){P+=V[2].length-V[1];continue}if(V[0]>T){y=[k];break}if(V[0]+V[1]>T){y=[this._viewCells[V[0]+P].handle];break}}}let w=y.map(k=>this._viewCells.findIndex(T=>T.handle===k));this._selectionCollection.setState(Gde([w[0]])[0],Gde(w),!0,"model")};this._register(this._notebook.onDidChangeContent(f=>{for(let v=0;v<f.rawEvents.length;v++){let b=f.rawEvents[v],S=[],y=f.synchronous??!0;if(b.kind===1||b.kind===6){S=b.changes,h(S,y);continue}else if(b.kind===2)h([[b.index,b.length,[]]],y),h([[b.newIdx,0,b.cells]],y);else continue}})),this._register(this._notebook.onDidChangeContent(f=>{f.rawEvents.forEach(v=>{v.kind===11&&this._viewContext.eventDispatcher.emit([new AUt(this._notebook.metadata)])}),f.endSelectionState&&this.updateSelectionsState(f.endSelectionState)})),this._register(this._viewContext.eventDispatcher.onDidChangeLayout(f=>{this._layoutInfo=f.value,this._viewCells.forEach(v=>{v.cellKind===1?(f.source.width||f.source.fontInfo)&&v.layoutChange({outerWidth:f.value.width,font:f.value.fontInfo}):f.source.width!==void 0&&v.layoutChange({outerWidth:f.value.width,font:f.value.fontInfo})})})),this._register(this._viewContext.notebookOptions.onDidChangeOptions(f=>{for(let v=0;v<this.length;v++)this._viewCells[v].updateOptions(f)})),this._register(p.onDidChangeExecution(f=>{if(f.type!==0)return;let v=this.getCellByHandle(f.cellHandle);v instanceof ih&&v.updateExecutionState(f)})),this._register(this._selectionCollection.onDidChangeSelection(f=>{this._onDidChangeSelection.fire(f)}));let g=this.isRepl?this._notebook.cells.length-1:this._notebook.cells.length;for(let f=0;f<g;f++)this._viewCells.push(Uho(this._instantiationService,this,this._notebook.cells[f],this._viewContext));this._viewCells.forEach(f=>{this._handleToViewCellMapping.set(f.handle,f)})}get options(){return this._options}get onDidChangeOptions(){return this._onDidChangeOptions.event}get viewCells(){return this._viewCells}get length(){return this._viewCells.length}get notebookDocument(){return this._notebook}get uri(){return this._notebook.uri}get metadata(){return this._notebook.metadata}get isRepl(){return this.viewType==="repl"}get onDidChangeViewCells(){return this._onDidChangeViewCells.event}get lastNotebookEditResource(){return this._lastNotebookEditResource.length?this._lastNotebookEditResource[this._lastNotebookEditResource.length-1]:null}get layoutInfo(){return this._layoutInfo}get onDidChangeSelection(){return this._onDidChangeSelection.event}get selectionHandles(){let e=new Set,t=[];return Yf(this._selectionCollection.selections).map(o=>o<this.length?this.cellAt(o):void 0).forEach(o=>{o&&!e.has(o.handle)&&(e.add(o.handle),t.push(o.handle))}),t}set selectionHandles(e){let t=e.map(o=>this._viewCells.findIndex(n=>n.handle===o));this._selectionCollection.setSelections(Gde(t),!0,"model")}get focused(){return this._focused}updateOptions(e){this._options={...this._options,...e},this._viewCells.forEach(t=>t.updateOptions({readonly:this._options.isReadOnly})),this._onDidChangeOptions.fire()}getFocus(){return this._selectionCollection.focus}getSelections(){return this._selectionCollection.selections}getMostRecentlyExecutedCell(){let e=this.notebookExecutionStateService.getLastCompletedCellForNotebook(this._notebook.uri);return e!==void 0?this.getCellByHandle(e):void 0}setEditorFocus(e){this._focused=e}validateRange(e){if(!e)return null;let t=Bn(e.start,0,this.length),o=Bn(e.end,0,this.length);return t<=o?{start:t,end:o}:{start:o,end:t}}updateSelectionsState(e,t="model"){if(this._focused||t==="model")if(e.kind===0){let o=e.primary!==null?this.getCellIndexByHandle(e.primary):null,n=o!==null?this.validateRange({start:o,end:o+1}):null,r=Gde(e.selections.map(s=>this.getCellIndexByHandle(s))).map(s=>this.validateRange(s)).filter(s=>s!==null);this._selectionCollection.setState(n,LF(r),!0,t)}else{let o=this.validateRange(e.focus),n=e.selections.map(r=>this.validateRange(r)).filter(r=>r!==null);this._selectionCollection.setState(o,LF(n),!0,t)}}getFoldingStartIndex(e){if(!this._foldingRanges)return-1;let t=this._foldingRanges.findRange(e+1);return this._foldingRanges.getStartLineNumber(t)-1}getFoldingState(e){if(!this._foldingRanges)return 0;let t=this._foldingRanges.findRange(e+1);return this._foldingRanges.getStartLineNumber(t)-1!==e?0:this._foldingRanges.isCollapsed(t)?2:1}getFoldedLength(e){if(!this._foldingRanges)return 0;let t=this._foldingRanges.findRange(e+1),o=this._foldingRanges.getStartLineNumber(t)-1;return this._foldingRanges.getEndLineNumber(t)-1-o}updateFoldingRanges(e){this._foldingRanges=e;let t=!1,o=[],n=0,r=0,s=Number.MAX_VALUE,l=-1;for(;n<e.length;n++){if(!e.isCollapsed(n))continue;let c=e.getStartLineNumber(n)+1,u=e.getEndLineNumber(n);s<=c&&u<=l||(!t&&r<this._hiddenRanges.length&&this._hiddenRanges[r].start+1===c&&this._hiddenRanges[r].end+1===u?(o.push(this._hiddenRanges[r]),r++):(t=!0,o.push({start:c-1,end:u-1})),s=c,l=u)}(t||r<this._hiddenRanges.length)&&(this._hiddenRanges=o,this._onDidFoldingStateChanged.fire()),this._viewCells.forEach(c=>{c.cellKind===1&&c.triggerFoldingStateChange()})}getHiddenRanges(){return this._hiddenRanges}getOverviewRulerDecorations(){return Array.from(this._overviewRulerDecorations.values())}getCellByHandle(e){return this._handleToViewCellMapping.get(e)}getCellIndexByHandle(e){return this._viewCells.findIndex(t=>t.handle===e)}getCellIndex(e){return this._viewCells.indexOf(e)}cellAt(e){return this._viewCells[e]}getCellsInRange(e){if(!e)return this._viewCells.slice(0);let t=this.validateRange(e);if(t){let o=[];for(let n=t.start;n<t.end;n++)o.push(this._viewCells[n]);return o}return[]}getNearestVisibleCellIndexUpwards(e){for(let t=this._hiddenRanges.length-1;t>=0;t--){let o=this._hiddenRanges[t],n=o.start-1,r=o.end;if(!(n>e)){if(n<=e&&r>=e)return e;break}}return e}getNextVisibleCellIndex(e){for(let t=0;t<this._hiddenRanges.length;t++){let o=this._hiddenRanges[t],n=o.start-1,r=o.end;if(!(r<e)){if(n<=e)return r+1;break}}return e+1}getPreviousVisibleCellIndex(e){for(let t=this._hiddenRanges.length-1;t>=0;t--){let o=this._hiddenRanges[t],n=o.start-1;if(o.end<e)return e;if(n<=e)return n}return e}hasCell(e){return this._handleToViewCellMapping.has(e.handle)}getVersionId(){return this._notebook.versionId}getAlternativeId(){return this._notebook.alternativeVersionId}getTrackedRange(e){return this._getDecorationRange(e)}_getDecorationRange(e){let t=this._decorations[e];if(!t)return null;let o=this.getVersionId();return t.cachedVersionId!==o&&this._decorationsTree.resolveNode(t,o),t.range===null?{start:t.cachedAbsoluteStart-1,end:t.cachedAbsoluteEnd-1}:{start:t.range.startLineNumber-1,end:t.range.endLineNumber-1}}setTrackedRange(e,t,o){let n=e?this._decorations[e]:null;return n?t?(this._decorationsTree.delete(n),n.reset(this.getVersionId(),t.start,t.end+1,new z(t.start+1,1,t.end+1,1)),n.setOptions(Hho[o]),this._decorationsTree.insert(n),n.id):(this._decorationsTree.delete(n),delete this._decorations[n.id],null):t?this._deltaCellDecorationsImpl(0,[],[{range:new z(t.start+1,1,t.end+1,1),options:Hho[o]}])[0]:null}_deltaCellDecorationsImpl(e,t,o){let n=this.getVersionId(),r=t.length,s=0,l=o.length,c=0,u=new Array(l);for(;s<r||c<l;){let p=null;if(s<r){do p=this._decorations[t[s++]];while(!p&&s<r);p&&this._decorationsTree.delete(p)}if(c<l){if(!p){let v=++this._lastDecorationId,b=`${this._instanceId};${v}`;p=new Ale(b,0,0),this._decorations[b]=p}let h=o[c],g=h.range,f=HJo(h.options);p.ownerId=e,p.reset(n,g.startLineNumber,g.endLineNumber,z.lift(g)),p.setOptions(f),this._decorationsTree.insert(p),u[c]=p.id,c++}else p&&delete this._decorations[p.id]}return u}deltaCellDecorations(e,t){e.forEach(n=>{let r=this._decorationIdToCellMap.get(n);r!==void 0&&(this.getCellByHandle(r)?.deltaCellDecorations([n],[]),this._decorationIdToCellMap.delete(n)),this._overviewRulerDecorations.delete(n)});let o=[];return t.forEach(n=>{if(aeo(n)){let s=this.getCellByHandle(n.handle)?.deltaCellDecorations([],[n.options])||[];s.forEach(l=>{this._decorationIdToCellMap.set(l,n.handle)}),o.push(...s)}else{let r=++this._lastOverviewRulerDecorationId,s=`_overview_${this.id};${r}`;this._overviewRulerDecorations.set(s,n),o.push(s)}}),o}deltaCellStatusBarItems(e,t){let o=MI(e,r=>this._statusBarItemIdToCellMap.get(r)??-1),n=[];t.forEach(r=>{let s=this.getCellByHandle(r.handle),l=o[r.handle]??[];delete o[r.handle],l.forEach(u=>this._statusBarItemIdToCellMap.delete(u));let c=s?.deltaCellStatusBarItems(l,r.items)||[];c.forEach(u=>{this._statusBarItemIdToCellMap.set(u,r.handle)}),n.push(...c)});for(let r in o){let s=parseInt(r),l=o[s];this.getCellByHandle(s)?.deltaCellStatusBarItems(l,[]),l.forEach(u=>this._statusBarItemIdToCellMap.delete(u))}return n}nearestCodeCellIndex(e){let t=this.viewCells.slice(0,e).reverse().findIndex(o=>o.cellKind===2);if(t>-1)return e-t-1;{let o=this.viewCells.slice(e+1).findIndex(n=>n.cellKind===2);return o>-1?e+1+o:-1}}getEditorViewState(){let e={},t={},o={},n={};this._viewCells.forEach((s,l)=>{s.getEditState()===1&&(e[l]=!0),s.isInputCollapsed&&(t[l]=!0),s instanceof ih&&s.isOutputCollapsed&&(o[l]=!0),s.lineNumbers!=="inherit"&&(n[l]=s.lineNumbers)});let r={};return this._viewCells.map(s=>({handle:s.model.handle,state:s.saveEditorViewState()})).forEach((s,l)=>{s.state&&(r[l]=s.state)}),{editingCells:e,editorViewStates:r,cellLineNumberStates:n,collapsedInputCells:t,collapsedOutputCells:o}}restoreEditorViewState(e){e&&this._viewCells.forEach((t,o)=>{let n=e.editingCells&&e.editingCells[o],r=e.editorViewStates&&e.editorViewStates[o];t.updateEditState(n?1:0,"viewState");let s=e.cellTotalHeights?e.cellTotalHeights[o]:void 0;t.restoreEditorViewState(r,s),e.collapsedInputCells&&e.collapsedInputCells[o]&&(t.isInputCollapsed=!0),e.collapsedOutputCells&&e.collapsedOutputCells[o]&&t instanceof ih&&(t.isOutputCollapsed=!0),e.cellLineNumberStates&&e.cellLineNumberStates[o]&&(t.lineNumbers=e.cellLineNumberStates[o])})}changeModelDecorations(e){let t={deltaDecorations:(n,r)=>this._deltaModelDecorationsImpl(n,r)},o=null;try{o=e(t)}catch(n){mt(n)}return t.deltaDecorations=BJo,o}_deltaModelDecorationsImpl(e,t){let o=new Map;e.forEach(r=>{let s=r.ownerId;if(!o.has(s)){let c=this._viewCells.find(u=>u.handle===s);c&&o.set(s,{cell:c,oldDecorations:[],newDecorations:[]})}let l=o.get(s);l&&(l.oldDecorations=r.decorations)}),t.forEach(r=>{let s=r.ownerId;if(!o.has(s)){let c=this._viewCells.find(u=>u.handle===s);c&&o.set(s,{cell:c,oldDecorations:[],newDecorations:[]})}let l=o.get(s);l&&(l.newDecorations=r.decorations)});let n=[];return o.forEach((r,s)=>{let l=r.cell.deltaModelDecorations(r.oldDecorations,r.newDecorations);n.push({ownerId:s,decorations:l})}),n}find(e,t){let o=[],n=[];if(t.findScope&&(t.findScope.findScopeType==="cells"||t.findScope.findScopeType==="text")){let r=t.findScope.selectedCellRanges?.map(l=>this.validateRange(l)).filter(l=>!!l)??[];n=Yf(r).map(l=>this._viewCells[l])}else n=this._viewCells;return n.forEach((r,s)=>{let l=r.startFind(e,t);l&&o.push(new C8(l.cell,s,l.contentMatches,[]))}),o.filter(r=>r.cell.cellKind===2?t.includeCodeInput:(r.cell.getEditState()===1||!t.includeMarkupPreview)&&t.includeMarkupInput)}replaceOne(e,t,o){let n=e;return this._lastNotebookEditResource.push(n.uri),n.resolveTextModel().then(()=>{this._bulkEditService.apply([new nl(e.uri,{range:t,text:o})],{quotableLabel:"Notebook Replace"})})}async replaceAll(e,t){if(!e.length)return;let o=[];return this._lastNotebookEditResource.push(e[0].cell.uri),e.forEach(n=>{n.contentMatches.forEach((r,s)=>{o.push({versionId:void 0,textEdit:{range:r.range,text:t[s]},resource:n.cell.uri})})}),Promise.all(e.map(n=>n.cell.resolveTextModel())).then(async()=>{this._bulkEditService.apply({edits:o},{quotableLabel:"Notebook Replace All"})})}async _withElement(e,t){let o=this._viewCells.filter(r=>e.matchesResource(r.uri)),n=await Promise.all(o.map(r=>this._textModelService.createModelReference(r.uri)));await t(),n.forEach(r=>r.dispose())}async undo(){let e=this._undoService.getElements(this.uri),t=e.past.length?e.past[e.past.length-1]:void 0;return t&&t instanceof oR||t instanceof BV?(await this._withElement(t,async()=>{await this._undoService.undo(this.uri)}),t instanceof oR?[t.resource]:t.resources):(await this._undoService.undo(this.uri),[])}async redo(){let t=this._undoService.getElements(this.uri).future[0];return t&&t instanceof oR||t instanceof BV?(await this._withElement(t,async()=>{await this._undoService.redo(this.uri)}),t instanceof oR?[t.resource]:t.resources):(await this._undoService.redo(this.uri),[])}equal(e){return this._notebook===e}dispose(){this._localStore.clear(),this._viewCells.forEach(e=>{e.dispose()}),super.dispose()}};Cte=I([m(5,F),m(6,La),m(7,Ml),m(8,Bt),m(9,bs)],Cte);function Uho(a,i,e,t){return e.cellKind===2?a.createInstance(ih,i.viewType,e,i.layoutInfo,t):a.createInstance(Hb,i.viewType,e,i.layoutInfo,i,t)}var eAe=class{constructor(i,e,t){this.notebookOptions=i;this.eventDispatcher=e;this.getBaseCellEditorOptions=t}};var YEi=21,UJo=21,x8=8,XEi=class{constructor(i,e,t,o){this.notebookEditor=i;this.editorToolbar=e;this.goToMenu=t;this.instantiationService=o}actionProvider(i,e){if(i.id===NT)return this.instantiationService.createInstance(HH,i,this.notebookEditor,e);if(i instanceof Lo)return this.instantiationService.createInstance(HPe,i,{hoverDelegate:e.hoverDelegate});if(i instanceof Nc&&i.item.submenu.id===D.NotebookCellExecuteGoTo.id)return this.instantiationService.createInstance(S8,i,{hoverDelegate:e.hoverDelegate},!0,{getActions:()=>this.goToMenu.getActions().find(([t])=>t==="navigation/execute")?.[1]??[]},this.actionProvider.bind(this))}calculateActions(i){let e=this.editorToolbar.primaryActions,t=this.editorToolbar.secondaryActions,o=zho(e,t,i);return{primaryActions:o.primaryActions.map(n=>n.action),secondaryActions:o.secondaryActions}}},JEi=class{constructor(i,e,t,o){this.notebookEditor=i;this.editorToolbar=e;this.goToMenu=t;this.instantiationService=o}actionProvider(i,e){if(i.id===NT)return this.instantiationService.createInstance(HH,i,this.notebookEditor,e);if(i instanceof Lo)return this.instantiationService.createInstance(xl,i,{hoverDelegate:e.hoverDelegate});if(i instanceof Nc)return i.item.submenu.id===D.NotebookCellExecuteGoTo.id?this.instantiationService.createInstance(S8,i,{hoverDelegate:e.hoverDelegate},!1,{getActions:()=>this.goToMenu.getActions().find(([t])=>t==="navigation/execute")?.[1]??[]},this.actionProvider.bind(this)):this.instantiationService.createInstance(VE,i,{hoverDelegate:e.hoverDelegate})}calculateActions(i){let e=this.editorToolbar.primaryActions,t=this.editorToolbar.secondaryActions,o=zho(e,t,i);return{primaryActions:o.primaryActions.map(n=>n.action),secondaryActions:o.secondaryActions}}},ZEi=class{constructor(i,e,t,o){this.notebookEditor=i;this.editorToolbar=e;this.goToMenu=t;this.instantiationService=o}actionProvider(i,e){if(i.id===NT)return this.instantiationService.createInstance(HH,i,this.notebookEditor,e);let t=this.editorToolbar.primaryActions.find(o=>o.action.id===i.id);return!t||t.renderLabel?i instanceof Lo?this.instantiationService.createInstance(HPe,i,{hoverDelegate:e.hoverDelegate}):i instanceof Nc&&i.item.submenu.id===D.NotebookCellExecuteGoTo.id?this.instantiationService.createInstance(S8,i,{hoverDelegate:e.hoverDelegate},!0,{getActions:()=>this.goToMenu.getActions().find(([o])=>o==="navigation/execute")?.[1]??[]},this.actionProvider.bind(this)):void 0:i instanceof Lo?this.instantiationService.createInstance(xl,i,{hoverDelegate:e.hoverDelegate}):i instanceof Nc?i.item.submenu.id===D.NotebookCellExecuteGoTo.id?this.instantiationService.createInstance(S8,i,{hoverDelegate:e.hoverDelegate},!1,{getActions:()=>this.goToMenu.getActions().find(([o])=>o==="navigation/execute")?.[1]??[]},this.actionProvider.bind(this)):this.instantiationService.createInstance(VE,i,{hoverDelegate:e.hoverDelegate}):void 0}calculateActions(i){let e=this.editorToolbar.primaryActions,t=this.editorToolbar.secondaryActions,o=zJo(e,t,i);return{primaryActions:o.primaryActions.map(n=>n.action),secondaryActions:o.secondaryActions}}},tAe=class extends x{constructor(e,t,o,n,r,s,l,c,u,p){super();this.notebookEditor=e;this.contextKeyService=t;this.notebookOptions=o;this.domNode=n;this.instantiationService=r;this.configurationService=s;this.contextMenuService=l;this.menuService=c;this.editorService=u;this.keybindingService=p;this._useGlobalToolbar=!1;this._renderLabel=0;this._visible=!1;this._onDidChangeVisibility=this._register(new E);this.onDidChangeVisibility=this._onDidChangeVisibility.event;this._dimension=null;this._primaryActions=[],this._secondaryActions=[],this._buildBody(),this._register(U.debounce(this.editorService.onDidActiveEditorChange,(h,g)=>h,200)(this._updatePerEditorChange,this)),this._registerNotebookActionsToolbar(),this._register(j(this.domNode,re.CONTEXT_MENU,h=>{let g=new Cn(Re(this.domNode),h);this.contextMenuService.showContextMenu({menuId:D.NotebookToolbarContext,getAnchor:()=>g,menuActionOptions:{renderShortTitle:!0}})}))}get primaryActions(){return this._primaryActions}get secondaryActions(){return this._secondaryActions}set visible(e){this._visible!==e&&(this._visible=e,this._onDidChangeVisibility.fire(e))}get useGlobalToolbar(){return this._useGlobalToolbar}_buildBody(){this._notebookTopLeftToolbarContainer=document.createElement("div"),this._notebookTopLeftToolbarContainer.classList.add("notebook-toolbar-left"),this._leftToolbarScrollable=new ms(this._notebookTopLeftToolbarContainer,{vertical:2,horizontal:3,horizontalScrollbarSize:3,useShadows:!1,scrollYToX:!0}),this._register(this._leftToolbarScrollable),M(this.domNode,this._leftToolbarScrollable.getDomNode()),this._notebookTopRightToolbarContainer=document.createElement("div"),this._notebookTopRightToolbarContainer.classList.add("notebook-toolbar-right"),M(this.domNode,this._notebookTopRightToolbarContainer)}_updatePerEditorChange(){if(this.editorService.activeEditorPane?.getId()===MR&&this.editorService.activeEditorPane.getControl()===this.notebookEditor){this._showNotebookActionsinEditorToolbar();return}}_registerNotebookActionsToolbar(){this._notebookGlobalActionsMenu=this._register(this.menuService.createMenu(this.notebookEditor.creationOptions.menuIds.notebookToolbar,this.contextKeyService)),this._executeGoToActionsMenu=this._register(this.menuService.createMenu(D.NotebookCellExecuteGoTo,this.contextKeyService)),this._useGlobalToolbar=this.notebookOptions.getDisplayOptions().globalToolbar,this._renderLabel=this._convertConfiguration(this.configurationService.getValue(yt.globalToolbarShowLabel)),this._updateStrategy();let e={ui:!0,notebookEditor:this.notebookEditor,source:"notebookToolbar"},t=(l,c)=>{if(l.id===NT)return this.instantiationService.createInstance(HH,l,this.notebookEditor,c);if(this._renderLabel!==1){let u=this._primaryActions.find(p=>p.action.id===l.id);return u&&u.renderLabel?l instanceof Lo?this.instantiationService.createInstance(HPe,l,{hoverDelegate:c.hoverDelegate}):void 0:l instanceof Lo?this.instantiationService.createInstance(xl,l,{hoverDelegate:c.hoverDelegate}):void 0}else return l instanceof Lo?this.instantiationService.createInstance(xl,l,{hoverDelegate:c.hoverDelegate}):void 0},o=this._register(this.instantiationService.createInstance(mf,"element",{instantHover:!0},{}));o.setInstantHoverTimeLimit(600);let n={hiddenItemStrategy:1,resetMenu:D.NotebookToolbar,actionViewItemProvider:(l,c)=>this._strategy.actionProvider(l,c),getKeyBinding:l=>this.keybindingService.lookupKeybinding(l.id),renderDropdownAsChildElement:!0,hoverDelegate:o};this._notebookLeftToolbar=this.instantiationService.createInstance(ol,this._notebookTopLeftToolbarContainer,n),this._register(this._notebookLeftToolbar),this._notebookLeftToolbar.context=e,this._notebookRightToolbar=new wp(this._notebookTopRightToolbarContainer,this.contextMenuService,{getKeyBinding:l=>this.keybindingService.lookupKeybinding(l.id),actionViewItemProvider:t,renderDropdownAsChildElement:!0,hoverDelegate:o}),this._register(this._notebookRightToolbar),this._notebookRightToolbar.context=e,this._showNotebookActionsinEditorToolbar();let r=!1,s;this._register(this._notebookGlobalActionsMenu.onDidChange(()=>{if(r){s=()=>this._showNotebookActionsinEditorToolbar();return}this.notebookEditor.isVisible&&this._showNotebookActionsinEditorToolbar()})),this._register(this._notebookLeftToolbar.onDidChangeDropdownVisibility(l=>{r=l,s&&!l&&(setTimeout(()=>{s?.()},0),s=void 0)})),this._register(this.notebookOptions.onDidChangeOptions(l=>{l.globalToolbar!==void 0&&(this._useGlobalToolbar=this.notebookOptions.getDisplayOptions().globalToolbar,this._showNotebookActionsinEditorToolbar())})),this._register(this.configurationService.onDidChangeConfiguration(l=>{if(l.affectsConfiguration(yt.globalToolbarShowLabel)){this._renderLabel=this._convertConfiguration(this.configurationService.getValue(yt.globalToolbarShowLabel)),this._updateStrategy(),this._notebookLeftToolbar.getElement().remove(),this._notebookLeftToolbar.dispose(),this._notebookLeftToolbar=this.instantiationService.createInstance(ol,this._notebookTopLeftToolbarContainer,n),this._register(this._notebookLeftToolbar),this._notebookLeftToolbar.context=e,this._showNotebookActionsinEditorToolbar();return}}))}_updateStrategy(){switch(this._renderLabel){case 0:this._strategy=new XEi(this.notebookEditor,this,this._executeGoToActionsMenu,this.instantiationService);break;case 1:this._strategy=new JEi(this.notebookEditor,this,this._executeGoToActionsMenu,this.instantiationService);break;case 2:this._strategy=new ZEi(this.notebookEditor,this,this._executeGoToActionsMenu,this.instantiationService);break}}_convertConfiguration(e){switch(e){case!0:return 0;case!1:return 1;case"always":return 0;case"never":return 1;case"dynamic":return 2}}_showNotebookActionsinEditorToolbar(){if(!this.notebookEditor.hasModel()){this._deferredActionUpdate?.dispose(),this._deferredActionUpdate=void 0,this.visible=!1;return}this._deferredActionUpdate||(this._useGlobalToolbar?this._deferredActionUpdate=tn(async()=>{await this._setNotebookActions(),this.visible=!0,this._deferredActionUpdate?.dispose(),this._deferredActionUpdate=void 0},50):(this.domNode.style.display="none",this._deferredActionUpdate=void 0,this.visible=!1))}async _setNotebookActions(){let e=this._notebookGlobalActionsMenu.getActions({shouldForwardArgs:!0,renderShortTitle:!0});this.domNode.style.display="flex";let t=e.filter(l=>/^navigation/.test(l[0])),o=[];t.sort((l,c)=>l[0]==="navigation"?1:c[0]==="navigation"?-1:0).forEach((l,c)=>{o.push(...l[1]),c<t.length-1&&o.push(new ri)});let n=e.find(l=>/^status/.test(l[0])),r=n?n[1]:[],s=e.filter(l=>!/^navigation/.test(l[0])&&!/^status/.test(l[0])).reduce((l,c)=>(l.push(...c[1]),l),[]);this._notebookLeftToolbar.setActions([],[]),this._primaryActions=o.map(l=>({action:l,size:l instanceof ri?1:0,renderLabel:!0,visible:!0})),this._notebookLeftToolbar.setActions(o,s),this._secondaryActions=s,this._notebookRightToolbar.setActions(r,[]),this._secondaryActions=s,this._dimension&&this._dimension.width>=0&&this._dimension.height>=0&&this._cacheItemSizes(this._notebookLeftToolbar),this._computeSizes()}_cacheItemSizes(e){for(let t=0;t<e.getItemsLength();t++){let o=e.getItemAction(t);if(o&&o.id!=="toolbar.toggle.more"){let n=this._primaryActions.find(r=>r.action.id===o.id);n&&(n.size=e.getItemWidth(t))}}}_computeSizes(){let e=this._notebookLeftToolbar,t=this._notebookRightToolbar;if(e&&t&&this._dimension&&this._dimension.height>=0&&this._dimension.width>=0){if(this._primaryActions.length===0&&e.getItemsLength()!==this._primaryActions.length&&this._cacheItemSizes(this._notebookLeftToolbar),this._primaryActions.length===0)return;let o=(t.getItemsLength()?t.getItemWidth(0):0)+x8,n=this._dimension.width-o-(x8+UJo)-x8-x8,r=this._strategy.calculateActions(n);this._notebookLeftToolbar.setActions(r.primaryActions,r.secondaryActions)}}layout(e){this._dimension=e,this._useGlobalToolbar?this.domNode.style.display="flex":this.domNode.style.display="none",this._computeSizes()}dispose(){this._notebookLeftToolbar.context=void 0,this._notebookRightToolbar.context=void 0,this._notebookLeftToolbar.dispose(),this._notebookRightToolbar.dispose(),this._notebookLeftToolbar=null,this._notebookRightToolbar=null,this._deferredActionUpdate?.dispose(),this._deferredActionUpdate=void 0,super.dispose()}};tAe=I([m(4,F),m(5,B),m(6,Xe),m(7,Kt),m(8,ee),m(9,_e)],tAe);function zho(a,i,e){return ZUt(a,i,e,!1)}function zJo(a,i,e){if(a.length===0)return{primaryActions:[],secondaryActions:i};let t=a.filter(s=>s.size!==0).length;if(a.map(s=>s.size).reduce((s,l)=>s+l,0)+(t-1)*x8<=e)return a.forEach(s=>{s.renderLabel=!0}),ZUt(a,i,e,!1);if(t*YEi+(t-1)*x8>e)return a.forEach(s=>{s.renderLabel=!1}),ZUt(a,i,e,!0);let n=0,r=-1;for(let s=0;s<a.length;s++)if(n+=a[s].size+x8,a[s].action instanceof ri){let l=a.slice(s+1).filter(u=>u.size!==0);n+(l.length===0?0:l.length*YEi+(l.length-1)*x8)<=e&&(r=s)}else continue;return r<0?(a.forEach(s=>{s.renderLabel=!1}),ZUt(a,i,e,!0)):(a.slice(0,r+1).forEach(s=>{s.renderLabel=!0}),a.slice(r+1).forEach(s=>{s.renderLabel=!1}),{primaryActions:a,secondaryActions:i})}function ZUt(a,i,e,t){let o=[],n=[],r=0,s=!1,l=!1;if(a.length===0)return{primaryActions:[],secondaryActions:i};for(let c=0;c<a.length;c++){let u=a[c],p=t?u.size===0?0:YEi:u.size;if(!(u.action instanceof ri&&o.length>0&&o[o.length-1].action instanceof ri)&&!(u.action instanceof ri&&!s))if(r+p<=e&&!l)r+=x8+p,o.push(u),p!==0&&(s=!0),u.action instanceof ri&&(s=!1);else if(l=!0,p===0)o.push(u);else{if(u.action instanceof ri)continue;n.push(u.action)}}for(let c=o.length-1;c>0;c--){let u=o[c];if(u.size!==0){u.action instanceof ri&&o.splice(c,1);break}}if(o.length&&o[o.length-1].action instanceof ri&&o.pop(),n.length!==0&&n.push(new ri),t){let c=o.findIndex(u=>u.action.id==="notebook.cell.insertMarkdownCellBelow");c!==-1&&o.splice(c,1)}return{primaryActions:o,secondaryActions:[...n,...i]}}var iAe=class{constructor(i,e,t,o,n){this._editor=i;this._notebookKernelService=e;this._extensionService=o;this._notebookExecutionStateService=n;this._disposables=new N;this._viewModelDisposables=new N;this._cellOutputsListeners=[];this._selectedKernelDisposables=new N;this._notebookKernel=fPe.bindTo(t),this._notebookKernelCount=rte.bindTo(t),this._notebookKernelSelected=fmo.bindTo(t),this._interruptibleKernel=BH.bindTo(t),this._hasVariableProvider=bPe.bindTo(t),this._someCellRunning=l8.bindTo(t),this._kernelRunning=VH.bindTo(t),this._useConsolidatedOutputButton=htt.bindTo(t),this._hasOutputs=sUt.bindTo(t),this._viewType=hmo.bindTo(t),this._missingKernelExtension=rUt.bindTo(t),this._notebookKernelSourceCount=vPe.bindTo(t),this._cellToolbarLocation=mmo.bindTo(t),this._lastCellFailed=mPe.bindTo(t),this._handleDidChangeModel(),this._updateForNotebookOptions(),this._disposables.add(i.onDidChangeModel(this._handleDidChangeModel,this)),this._disposables.add(e.onDidAddKernel(this._updateKernelContext,this)),this._disposables.add(e.onDidChangeSelectedNotebooks(this._updateKernelContext,this)),this._disposables.add(e.onDidChangeSourceActions(this._updateKernelContext,this)),this._disposables.add(i.notebookOptions.onDidChangeOptions(this._updateForNotebookOptions,this)),this._disposables.add(o.onDidChangeExtensions(this._updateForInstalledExtension,this)),this._disposables.add(n.onDidChangeExecution(this._updateForExecution,this)),this._disposables.add(n.onDidChangeLastRunFailState(this._updateForLastRunFailState,this))}dispose(){this._disposables.dispose(),this._viewModelDisposables.dispose(),this._selectedKernelDisposables.dispose(),this._notebookKernelCount.reset(),this._notebookKernelSourceCount.reset(),this._interruptibleKernel.reset(),this._hasVariableProvider.reset(),this._someCellRunning.reset(),this._kernelRunning.reset(),this._viewType.reset(),Be(this._cellOutputsListeners),this._cellOutputsListeners.length=0}_handleDidChangeModel(){if(this._updateKernelContext(),this._updateForNotebookOptions(),this._viewModelDisposables.clear(),Be(this._cellOutputsListeners),this._cellOutputsListeners.length=0,!this._editor.hasModel())return;let i=()=>{let o=!1;if(this._editor.hasModel()){for(let n=0;n<this._editor.getLength();n++)if(this._editor.cellAt(n).outputsViewModels.length>0){o=!0;break}}this._hasOutputs.set(o)},e=this._viewModelDisposables.add(new N),t=o=>o.model.onDidChangeOutputs(()=>{e.clear(),e.add(Wr(Re(this._editor.getDomNode()),()=>{i()}))});for(let o=0;o<this._editor.getLength();o++){let n=this._editor.cellAt(o);this._cellOutputsListeners.push(t(n))}i(),this._updateForInstalledExtension(),this._viewModelDisposables.add(this._editor.onDidChangeViewCells(o=>{[...o.splices].reverse().forEach(n=>{let[r,s,l]=n,c=this._cellOutputsListeners.splice(r,s,...l.map(t));Be(c)})})),this._viewType.set(this._editor.textModel.viewType)}_updateForExecution(i){if(this._editor.textModel){let e=this._notebookExecutionStateService.getExecution(this._editor.textModel.uri),t=this._notebookExecutionStateService.getCellExecutionsForNotebook(this._editor.textModel.uri);this._kernelRunning.set(t.length>0||!!e),i.type===0&&this._someCellRunning.set(t.length>0)}else this._kernelRunning.set(!1),i.type===0&&this._someCellRunning.set(!1)}_updateForLastRunFailState(i){i.notebook===this._editor.textModel?.uri&&this._lastCellFailed.set(i.visible)}async _updateForInstalledExtension(){if(!this._editor.hasModel())return;let i=this._editor.textModel.viewType,e=seo.get(i);this._missingKernelExtension.set(!!e&&!await this._extensionService.getExtension(e))}_updateKernelContext(){if(!this._editor.hasModel()){this._notebookKernelCount.reset(),this._notebookKernelSourceCount.reset(),this._interruptibleKernel.reset(),this._hasVariableProvider.reset();return}let{selected:i,all:e}=this._notebookKernelService.getMatchingKernel(this._editor.textModel),t=this._notebookKernelService.getSourceActions(this._editor.textModel,this._editor.scopedContextKeyService);this._notebookKernelCount.set(e.length),this._notebookKernelSourceCount.set(t.length),this._interruptibleKernel.set(i?.implementsInterrupt??!1),this._hasVariableProvider.set(i?.hasVariableProvider??!1),this._notebookKernelSelected.set(!!i),this._notebookKernel.set(i?.id??""),this._selectedKernelDisposables.clear(),i&&this._selectedKernelDisposables.add(i.onDidChange(()=>{this._interruptibleKernel.set(i?.implementsInterrupt??!1)}))}_updateForNotebookOptions(){let i=this._editor.notebookOptions.getDisplayOptions();this._useConsolidatedOutputButton.set(i.consolidatedOutputButton),this._cellToolbarLocation.set(this._editor.notebookOptions.computeCellToolbarLocation(this._editor.textModel?.viewType))}};iAe=I([m(1,Ol),m(2,X),m(3,lt),m(4,bs)],iAe);var oAe=class extends yu{constructor(e,t,o){super(o);this.notebookEditor=e;this._lanes=3;this._domNode=ur(document.createElement("canvas")),this._domNode.setPosition("relative"),this._domNode.setLayerHinting(!0),this._domNode.setContain("strict"),t.appendChild(this._domNode.domNode),this._register(e.onDidChangeDecorations(()=>{this.layout()})),this._register(bu.getInstance(Re(this._domNode.domNode)).onDidChange(()=>{this.layout()}))}layout(){let t=this.notebookEditor.getLayoutInfo(),o=t.scrollHeight,n=t.height,r=bu.getInstance(Re(this._domNode.domNode)).value;this._domNode.setWidth(10),this._domNode.setHeight(n),this._domNode.domNode.width=10*r,this._domNode.domNode.height=n*r;let s=this._domNode.domNode.getContext("2d");s.clearRect(0,0,10*r,n*r),this._render(s,10*r,n*r,o*r,r)}_render(e,t,o,n,r){let s=this.notebookEditor.getViewModel(),l=this.notebookEditor.getLayoutInfo().fontInfo,c=t/this._lanes,u=0;if(s){for(let h=0;h<s.viewCells.length;h++){let g=s.viewCells[h],f=g.textBuffer,v=g.getCellDecorations(),b=g.layoutInfo.totalHeight/n*r*o;v.filter(S=>S.overviewRuler).forEach(S=>{let y=S.overviewRuler,w=this.getColor(y.color)??"#000000",k=Math.min(l.lineHeight,g.layoutInfo.editorHeight/n/f.getLineCount()*r*o),T=y.modelRanges.map(V=>V.startLineNumber).reduce((V,H)=>((V.length===0||V[V.length-1]!==H)&&V.push(H),V),[]),P=0;switch(y.position){case 1:P=0;break;case 2:P=c;break;case 4:P=c*2;break;default:break}let O=y.position===7?c*3:c;for(let V=0;V<T.length;V++){e.fillStyle=w;let G=(T[V]-1)*k;e.fillRect(P,u+G,O,k)}if(y.includeOutput){e.fillStyle=w;let V=g.layoutInfo.editorHeight/n*r*o,H=l.lineHeight/n*r*o;e.fillRect(c,u+V,c,H)}}),u+=b}let p=s.getOverviewRulerDecorations();for(let h=0;h<p.length;h++){let g=p[h];if(!g.options.overviewRuler)continue;let f=this.notebookEditor.getViewZoneLayoutInfo(g.viewZoneId);if(!f)continue;let v=this.getColor(g.options.overviewRuler.color)??"#000000",b=0;switch(g.options.overviewRuler.position){case 1:b=0;break;case 2:b=c;break;case 4:b=c*2;break;default:break}let S=g.options.overviewRuler.position===7?c*3:c;e.fillStyle=v;let y=f.height/n*r*o,w=f.top/n*r*o;e.fillRect(b,w,S,y)}}}};oAe=I([m(2,Le)],oAe);var nAe=class extends x{constructor(e,t,o,n,r){super();this.notebookEditor=e;this.notebookOptions=t;this.instantiationService=o;this.contextMenuService=n;this.menuService=r;this.viewZone=this._register(new me);this._modelDisposables=this._register(new N);this.topCellToolbarContainer=_("div"),this.topCellToolbar=_(".cell-list-top-cell-toolbar-container"),this.topCellToolbarContainer.appendChild(this.topCellToolbar),this._register(this.notebookEditor.onDidAttachViewModel(()=>{this.updateTopToolbar()})),this._register(this.notebookOptions.onDidChangeOptions(s=>{(s.insertToolbarAlignment||s.insertToolbarPosition||s.cellToolbarLocation)&&this.updateTopToolbar()}))}updateTopToolbar(){let e=this.notebookOptions.getLayoutConfiguration();if(this.viewZone.value=new N,e.insertToolbarPosition==="hidden"||e.insertToolbarPosition==="notebookToolbar"){let t=this.notebookOptions.computeTopInsertToolbarHeight(this.notebookEditor.textModel?.viewType);t!==0&&this.notebookEditor.changeViewZones(o=>{let n=o.addZone({afterModelPosition:0,heightInPx:t,domNode:_("div")});o.layoutZone(n),this.viewZone.value?.add({dispose:()=>{this.notebookEditor.isDisposed||this.notebookEditor.changeViewZones(r=>{r.removeZone(n)})}})});return}this.notebookEditor.changeViewZones(t=>{let o=this.notebookOptions.computeTopInsertToolbarHeight(this.notebookEditor.textModel?.viewType),n=t.addZone({afterModelPosition:0,heightInPx:o,domNode:this.topCellToolbarContainer});t.layoutZone(n),this.viewZone.value?.add({dispose:()=>{this.notebookEditor.isDisposed||this.notebookEditor.changeViewZones(s=>{s.removeZone(n)})}}),Rt(this.topCellToolbar);let r=this.instantiationService.createInstance(or,this.topCellToolbar,this.notebookEditor.creationOptions.menuIds.cellTopInsertToolbar,{actionViewItemProvider:(s,l)=>{if(s instanceof Lo)return this.instantiationService.createInstance(xM,s,{hoverDelegate:l.hoverDelegate})},menuOptions:{shouldForwardArgs:!0},toolbarOptions:{primaryGroup:s=>/^inline/.test(s)},hiddenItemStrategy:0});this.notebookEditor.hasModel()&&(r.context={notebookEditor:this.notebookEditor}),this.viewZone.value?.add(r),this.viewZone.value?.add(this.notebookEditor.onDidChangeModel(()=>{this._modelDisposables.clear(),this.notebookEditor.hasModel()&&(this._modelDisposables.add(this.notebookEditor.onDidChangeViewCells(()=>{this.updateClass()})),this.updateClass())})),this.updateClass()})}updateClass(){this.notebookEditor.hasModel()&&this.notebookEditor.getLength()===0?this.topCellToolbar.classList.add("emptyNotebook"):this.topCellToolbar.classList.remove("emptyNotebook")}};nAe=I([m(2,F),m(3,Xe),m(4,Kt)],nAe);var Kho=18,eTi=4,Gho=Object.freeze({codeCellLeftMargin:28,cellRunGutter:32,markdownCellTopMargin:8,markdownCellBottomMargin:8,markdownCellLeftMargin:0,markdownCellGutter:32,focusIndicatorLeftMargin:4}),qho=Object.freeze({codeCellLeftMargin:8,cellRunGutter:36,markdownCellTopMargin:6,markdownCellBottomMargin:6,markdownCellLeftMargin:8,markdownCellGutter:36,focusIndicatorLeftMargin:4}),VT=class extends x{constructor(e,t,o,n,r,s){super();this.targetWindow=e;this.isReadonly=t;this.overrides=o;this.configurationService=n;this.notebookExecutionStateService=r;this.codeEditorService=s;this._onDidChangeOptions=this._register(new E);this.onDidChangeOptions=this._onDidChangeOptions.event;this._editorTopPadding=12;this.previousModelToCompare=Me("previousModelToCompare",void 0);let l=this.configurationService.getValue(yt.showCellStatusBar),c=o?.globalToolbar??this.configurationService.getValue(yt.globalToolbar)??!0,u=o?.stickyScrollEnabled??this.configurationService.getValue(yt.stickyScrollEnabled)??!1,p=this._computeStickyScrollModeOption(),h=this.configurationService.getValue(yt.consolidatedOutputButton)??!0,g=this.configurationService.getValue(yt.consolidatedRunButton)??!1,f=o?.dragAndDropEnabled??this.configurationService.getValue(yt.dragAndDropEnabled)??!0,v=this.configurationService.getValue(yt.cellToolbarLocation)??{default:"right"},b=o?.cellToolbarInteraction??this.configurationService.getValue(yt.cellToolbarVisibility),S=this.configurationService.getValue(yt.compactView)??!0,y=this._computeFocusIndicatorOption(),w=this._computeInsertToolbarPositionOption(this.isReadonly),k=this._computeInsertToolbarAlignmentOption(),T=this._computeShowFoldingControlsOption(),P=this.configurationService.getValue("editor.fontSize"),O=this.configurationService.getValue(yt.markupFontSize),V=this.configurationService.getValue(yt.markdownLineHeight),H=this.configurationService.getValue(yt.cellEditorOptionsCustomizations)??{};H=xi(H)?H:{};let G=this.configurationService.getValue(yt.interactiveWindowCollapseCodeCells),$,J=this.configurationService.getValue(yt.outputLineHeightDeprecated);J!==void 0?(this._migrateDeprecatedSetting(yt.outputLineHeightDeprecated,yt.outputLineHeight),$=J):$=this.configurationService.getValue(yt.outputLineHeight);let ae,he=this.configurationService.getValue(yt.outputFontSizeDeprecated);he!==void 0?(this._migrateDeprecatedSetting(yt.outputFontSizeDeprecated,yt.outputFontSize),ae=he):ae=this.configurationService.getValue(yt.outputFontSize)||P;let oe,de=this.configurationService.getValue(yt.outputFontFamilyDeprecated);de!==void 0?(this._migrateDeprecatedSetting(yt.outputFontFamilyDeprecated,yt.outputFontFamily),oe=de):oe=this.configurationService.getValue(yt.outputFontFamily);let Ce,xe=this.configurationService.getValue(yt.outputScrollingDeprecated);xe!==void 0?(this._migrateDeprecatedSetting(yt.outputScrollingDeprecated,yt.outputScrolling),Ce=xe):Ce=this.configurationService.getValue(yt.outputScrolling);let ze=this._computeOutputLineHeight($,ae),De=this.configurationService.getValue(yt.outputWordWrap),Oe=this.configurationService.getValue(yt.textOutputLineLimit)??30,pt=this.configurationService.getValue(yt.LinkifyOutputFilePaths)??!0,et=this.configurationService.getValue(yt.minimalErrorRendering),Ti=this.configurationService.getValue(yt.markupFontFamily),Ht=this._computeEditorTopPadding();this._layoutConfiguration={...S?qho:Gho,cellTopMargin:6,cellBottomMargin:6,cellRightMargin:16,cellStatusBarHeight:22,cellOutputPadding:8,markdownPreviewPadding:8,editorToolbarHeight:0,editorTopPadding:Ht,editorBottomPadding:4,editorBottomPaddingWithoutStatusBar:12,collapsedIndicatorHeight:28,showCellStatusBar:l,globalToolbar:c,stickyScrollEnabled:u,stickyScrollMode:p,consolidatedOutputButton:h,consolidatedRunButton:g,dragAndDropEnabled:f,cellToolbarLocation:v,cellToolbarInteraction:b,compactView:S,focusIndicator:y,insertToolbarPosition:w,insertToolbarAlignment:k,showFoldingControls:T,fontSize:P,outputFontSize:ae,outputFontFamily:oe,outputLineHeight:ze,markupFontSize:O,markdownLineHeight:V,editorOptionsCustomizations:H,focusIndicatorGap:3,interactiveWindowCollapseCodeCells:G,markdownFoldHintHeight:22,outputScrolling:Ce,outputWordWrap:De,outputLineLimit:Oe,outputLinkifyFilePaths:pt,outputMinimalError:et,markupFontFamily:Ti,disableRulers:o?.disableRulers},this._register(this.configurationService.onDidChangeConfiguration(zi=>{this._updateConfiguration(zi)}))}updateOptions(e){this.isReadonly!==e&&(this.isReadonly=e,this._updateConfiguration({affectsConfiguration(t){return t===yt.insertToolbarLocation},source:7,affectedKeys:new Set([yt.insertToolbarLocation]),change:{keys:[yt.insertToolbarLocation],overrides:[]}}))}_computeEditorTopPadding(){let e=!1,t=r=>{this._editorTopPadding=r;let s=Object.assign({},this._layoutConfiguration);s.editorTopPadding=this._editorTopPadding,this._layoutConfiguration=s,this._onDidChangeOptions.fire({editorTopPadding:!0})},o=new Set,n=r=>{if(!e&&!o.has(r))try{let s=this.codeEditorService.resolveDecorationOptions(r,!0);if(s.afterContentClassName||s.beforeContentClassName){let l=this.codeEditorService.resolveDecorationCSSRules(r);if(l!==null){for(let c=0;c<l.length;c++)if((l[c].selectorText.endsWith("::after")||l[c].selectorText.endsWith("::after"))&&l[c].cssText.indexOf("top:")>-1){let u=this.configurationService.getValue("editor");t(QS(u,bu.getInstance(this.targetWindow).value).lineHeight+2),e=!0;break}}}o.add(r)}catch{}};return this._register(this.codeEditorService.onDecorationTypeRegistered(n)),this.codeEditorService.listDecorationTypes().forEach(n),this._editorTopPadding}_migrateDeprecatedSetting(e,t){let o=this.configurationService.inspect(e);o.application!==void 0&&(this.configurationService.updateValue(e,void 0,1),this.configurationService.updateValue(t,o.application.value,1)),o.user!==void 0&&(this.configurationService.updateValue(e,void 0,2),this.configurationService.updateValue(t,o.user.value,2)),o.userLocal!==void 0&&(this.configurationService.updateValue(e,void 0,3),this.configurationService.updateValue(t,o.userLocal.value,3)),o.userRemote!==void 0&&(this.configurationService.updateValue(e,void 0,4),this.configurationService.updateValue(t,o.userRemote.value,4)),o.workspace!==void 0&&(this.configurationService.updateValue(e,void 0,5),this.configurationService.updateValue(t,o.workspace.value,5)),o.workspaceFolder!==void 0&&(this.configurationService.updateValue(e,void 0,6),this.configurationService.updateValue(t,o.workspaceFolder.value,6))}_computeOutputLineHeight(e,t){if(e===0){let n=this.configurationService.getValue("editor");e=iw.readFontInfo(this.targetWindow,QS(n,bu.getInstance(this.targetWindow).value)).lineHeight}else if(e<9){let n=t;n===0&&(n=this.configurationService.getValue("editor.fontSize")),e=e*n}return e=Math.round(e),e<9&&(e=9),e}_updateConfiguration(e){let t=e.affectsConfiguration(yt.showCellStatusBar),o=e.affectsConfiguration(yt.cellToolbarLocation),n=e.affectsConfiguration(yt.cellToolbarVisibility),r=e.affectsConfiguration(yt.compactView),s=e.affectsConfiguration(yt.focusIndicator),l=e.affectsConfiguration(yt.insertToolbarLocation),c=e.affectsConfiguration(yt.experimentalInsertToolbarAlignment),u=e.affectsConfiguration(yt.globalToolbar),p=e.affectsConfiguration(yt.stickyScrollEnabled),h=e.affectsConfiguration(yt.stickyScrollMode),g=e.affectsConfiguration(yt.consolidatedOutputButton),f=e.affectsConfiguration(yt.consolidatedRunButton),v=e.affectsConfiguration(yt.showFoldingControls),b=e.affectsConfiguration(yt.dragAndDropEnabled),S=e.affectsConfiguration("editor.fontSize"),y=e.affectsConfiguration(yt.outputFontSize),w=e.affectsConfiguration(yt.markupFontSize),k=e.affectsConfiguration(yt.markdownLineHeight),T=e.affectsConfiguration("editor.fontFamily"),P=e.affectsConfiguration(yt.outputFontFamily),O=e.affectsConfiguration(yt.cellEditorOptionsCustomizations),V=e.affectsConfiguration(yt.interactiveWindowCollapseCodeCells),H=e.affectsConfiguration(yt.outputLineHeight),G=e.affectsConfiguration(yt.outputScrolling),$=e.affectsConfiguration(yt.outputWordWrap),J=e.affectsConfiguration(yt.LinkifyOutputFilePaths),ae=e.affectsConfiguration(yt.minimalErrorRendering),he=e.affectsConfiguration(yt.markupFontFamily);if(!t&&!o&&!n&&!r&&!s&&!l&&!c&&!u&&!p&&!h&&!g&&!f&&!v&&!b&&!S&&!y&&!w&&!k&&!T&&!P&&!O&&!V&&!H&&!G&&!$&&!J&&!ae&&!he)return;let oe=Object.assign({},this._layoutConfiguration);if(t&&(oe.showCellStatusBar=this.configurationService.getValue(yt.showCellStatusBar)),o&&(oe.cellToolbarLocation=this.configurationService.getValue(yt.cellToolbarLocation)??{default:"right"}),n&&!this.overrides?.cellToolbarInteraction&&(oe.cellToolbarInteraction=this.configurationService.getValue(yt.cellToolbarVisibility)),s&&(oe.focusIndicator=this._computeFocusIndicatorOption()),r){let de=this.configurationService.getValue(yt.compactView)??!0;oe=Object.assign(oe,{...de?qho:Gho}),oe.compactView=de}if(c&&(oe.insertToolbarAlignment=this._computeInsertToolbarAlignmentOption()),l&&(oe.insertToolbarPosition=this._computeInsertToolbarPositionOption(this.isReadonly)),u&&this.overrides?.globalToolbar===void 0&&(oe.globalToolbar=this.configurationService.getValue(yt.globalToolbar)??!0),p&&this.overrides?.stickyScrollEnabled===void 0&&(oe.stickyScrollEnabled=this.configurationService.getValue(yt.stickyScrollEnabled)??!1),h&&(oe.stickyScrollMode=this.configurationService.getValue(yt.stickyScrollMode)??"flat"),g&&(oe.consolidatedOutputButton=this.configurationService.getValue(yt.consolidatedOutputButton)??!0),f&&(oe.consolidatedRunButton=this.configurationService.getValue(yt.consolidatedRunButton)??!0),v&&(oe.showFoldingControls=this._computeShowFoldingControlsOption()),b&&(oe.dragAndDropEnabled=this.configurationService.getValue(yt.dragAndDropEnabled)??!0),S&&(oe.fontSize=this.configurationService.getValue("editor.fontSize")),(y||S)&&(oe.outputFontSize=this.configurationService.getValue(yt.outputFontSize)||oe.fontSize),w&&(oe.markupFontSize=this.configurationService.getValue(yt.markupFontSize)),k&&(oe.markdownLineHeight=this.configurationService.getValue(yt.markdownLineHeight)),P&&(oe.outputFontFamily=this.configurationService.getValue(yt.outputFontFamily)),O&&(oe.editorOptionsCustomizations=this.configurationService.getValue(yt.cellEditorOptionsCustomizations)),V&&(oe.interactiveWindowCollapseCodeCells=this.configurationService.getValue(yt.interactiveWindowCollapseCodeCells)),H||S||y){let de=this.configurationService.getValue(yt.outputLineHeight);oe.outputLineHeight=this._computeOutputLineHeight(de,oe.outputFontSize)}$&&(oe.outputWordWrap=this.configurationService.getValue(yt.outputWordWrap)),G&&(oe.outputScrolling=this.configurationService.getValue(yt.outputScrolling)),J&&(oe.outputLinkifyFilePaths=this.configurationService.getValue(yt.LinkifyOutputFilePaths)),ae&&(oe.outputMinimalError=this.configurationService.getValue(yt.minimalErrorRendering)),he&&(oe.markupFontFamily=this.configurationService.getValue(yt.markupFontFamily)),this._layoutConfiguration=Object.freeze(oe),this._onDidChangeOptions.fire({cellStatusBarVisibility:t,cellToolbarLocation:o,cellToolbarInteraction:n,compactView:r,focusIndicator:s,insertToolbarPosition:l,insertToolbarAlignment:c,globalToolbar:u,stickyScrollEnabled:p,stickyScrollMode:h,showFoldingControls:v,consolidatedOutputButton:g,consolidatedRunButton:f,dragAndDropEnabled:b,fontSize:S,outputFontSize:y,markupFontSize:w,markdownLineHeight:k,fontFamily:T,outputFontFamily:P,editorOptionsCustomizations:O,interactiveWindowCollapseCodeCells:V,outputLineHeight:H,outputScrolling:G,outputWordWrap:$,outputLinkifyFilePaths:J,minimalError:ae,markupFontFamily:he})}_computeInsertToolbarPositionOption(e){return e?"hidden":this.configurationService.getValue(yt.insertToolbarLocation)??"both"}_computeInsertToolbarAlignmentOption(){return this.configurationService.getValue(yt.experimentalInsertToolbarAlignment)??"center"}_computeShowFoldingControlsOption(){return this.configurationService.getValue(yt.showFoldingControls)??"mouseover"}_computeFocusIndicatorOption(){return this.configurationService.getValue(yt.focusIndicator)??"gutter"}_computeStickyScrollModeOption(){return this.configurationService.getValue(yt.stickyScrollMode)??"flat"}getCellCollapseDefault(){return this._layoutConfiguration.interactiveWindowCollapseCodeCells==="never"?{codeCell:{inputCollapsed:!1}}:{codeCell:{inputCollapsed:!0}}}getLayoutConfiguration(){return this._layoutConfiguration}getDisplayOptions(){return this._layoutConfiguration}getCellEditorContainerLeftMargin(){let{codeCellLeftMargin:e,cellRunGutter:t}=this._layoutConfiguration;return e+t}computeCollapsedMarkdownCellHeight(e){let{bottomToolbarGap:t}=this.computeBottomToolbarDimensions(e);return this._layoutConfiguration.markdownCellTopMargin+this._layoutConfiguration.collapsedIndicatorHeight+t+this._layoutConfiguration.markdownCellBottomMargin}computeBottomToolbarOffset(e,t){let{bottomToolbarGap:o,bottomToolbarHeight:n}=this.computeBottomToolbarDimensions(t);return e-o-n/2}computeCodeCellEditorWidth(e){return e-(this._layoutConfiguration.codeCellLeftMargin+this._layoutConfiguration.cellRunGutter+this._layoutConfiguration.cellRightMargin)}computeMarkdownCellEditorWidth(e){return e-this._layoutConfiguration.markdownCellGutter-this._layoutConfiguration.markdownCellLeftMargin-this._layoutConfiguration.cellRightMargin}computeStatusBarHeight(){return this._layoutConfiguration.cellStatusBarHeight}_computeBottomToolbarDimensions(e,t,o,n){return o==="left"||n!=="hidden"?{bottomToolbarGap:18,bottomToolbarHeight:18}:t==="betweenCells"||t==="both"?e?{bottomToolbarGap:12,bottomToolbarHeight:20}:{bottomToolbarGap:20,bottomToolbarHeight:20}:{bottomToolbarGap:0,bottomToolbarHeight:0}}computeBottomToolbarDimensions(e){let t=this._layoutConfiguration,o=this.computeCellToolbarLocation(e),{bottomToolbarGap:n,bottomToolbarHeight:r}=this._computeBottomToolbarDimensions(t.compactView,t.insertToolbarPosition,t.insertToolbarAlignment,o);return{bottomToolbarGap:n,bottomToolbarHeight:r}}computeCellToolbarLocation(e){let t=this._layoutConfiguration.cellToolbarLocation;if(typeof t=="string"){if(t==="left"||t==="right"||t==="hidden")return t}else if(e){let o=t[e]??t.default,n="right";switch(o){case"left":n="left";break;case"right":n="right";break;case"hidden":n="hidden";break;default:n="right";break}return n}return"right"}computeTopInsertToolbarHeight(e){if(this._layoutConfiguration.insertToolbarPosition==="betweenCells"||this._layoutConfiguration.insertToolbarPosition==="both")return Kho;let t=this.computeCellToolbarLocation(e);return t==="left"||t==="right"?Kho:0}computeEditorPadding(e,t){return{top:this._editorTopPadding,bottom:this.statusBarIsVisible(e,t)?this._layoutConfiguration.editorBottomPadding:this._layoutConfiguration.editorBottomPaddingWithoutStatusBar}}computeEditorStatusbarHeight(e,t){return this.statusBarIsVisible(e,t)?this.computeStatusBarHeight():0}statusBarIsVisible(e,t){let o=this.notebookExecutionStateService.getCellExecution(t);return this._layoutConfiguration.showCellStatusBar==="visible"?!0:this._layoutConfiguration.showCellStatusBar==="visibleAfterExecute"?typeof e.lastRunSuccess=="boolean"||o!==void 0:!1}computeWebviewOptions(){return{outputNodePadding:this._layoutConfiguration.cellOutputPadding,outputNodeLeftPadding:this._layoutConfiguration.cellOutputPadding,previewNodePadding:this._layoutConfiguration.markdownPreviewPadding,markdownLeftMargin:this._layoutConfiguration.markdownCellGutter+this._layoutConfiguration.markdownCellLeftMargin,leftMargin:this._layoutConfiguration.codeCellLeftMargin,rightMargin:this._layoutConfiguration.cellRightMargin,runGutter:this._layoutConfiguration.cellRunGutter,dragAndDropEnabled:this._layoutConfiguration.dragAndDropEnabled,fontSize:this._layoutConfiguration.fontSize,outputFontSize:this._layoutConfiguration.outputFontSize,outputFontFamily:this._layoutConfiguration.outputFontFamily,markupFontSize:this._layoutConfiguration.markupFontSize,markdownLineHeight:this._layoutConfiguration.markdownLineHeight,outputLineHeight:this._layoutConfiguration.outputLineHeight,outputScrolling:this._layoutConfiguration.outputScrolling,outputWordWrap:this._layoutConfiguration.outputWordWrap,outputLineLimit:this._layoutConfiguration.outputLineLimit,outputLinkifyFilePaths:this._layoutConfiguration.outputLinkifyFilePaths,minimalError:this._layoutConfiguration.outputMinimalError,markupFontFamily:this._layoutConfiguration.markupFontFamily}}computeDiffWebviewOptions(){return{outputNodePadding:this._layoutConfiguration.cellOutputPadding,outputNodeLeftPadding:0,previewNodePadding:this._layoutConfiguration.markdownPreviewPadding,markdownLeftMargin:0,leftMargin:32,rightMargin:0,runGutter:0,dragAndDropEnabled:!1,fontSize:this._layoutConfiguration.fontSize,outputFontSize:this._layoutConfiguration.outputFontSize,outputFontFamily:this._layoutConfiguration.outputFontFamily,markupFontSize:this._layoutConfiguration.markupFontSize,markdownLineHeight:this._layoutConfiguration.markdownLineHeight,outputLineHeight:this._layoutConfiguration.outputLineHeight,outputScrolling:this._layoutConfiguration.outputScrolling,outputWordWrap:this._layoutConfiguration.outputWordWrap,outputLineLimit:this._layoutConfiguration.outputLineLimit,outputLinkifyFilePaths:!1,minimalError:!1,markupFontFamily:this._layoutConfiguration.markupFontFamily}}computeIndicatorPosition(e,t,o){let{bottomToolbarGap:n}=this.computeBottomToolbarDimensions(o);return{bottomIndicatorTop:e-n-this._layoutConfiguration.cellBottomMargin-t,verticalIndicatorHeight:e-n-t}}};VT=I([m(3,B),m(4,bs),m(5,qt)],VT);var e1t=class a extends x{constructor(e,t,o,n){super();this.notebookEditor=e;this.notebookOptions=t;this.configurationService=o;this.language=n;this._localDisposableStore=this._register(new N);this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._register(o.onDidChangeConfiguration(r=>{(r.affectsConfiguration("editor")||r.affectsConfiguration("notebook"))&&this._recomputeOptions()})),this._register(t.onDidChangeOptions(r=>{(r.cellStatusBarVisibility||r.editorTopPadding||r.editorOptionsCustomizations)&&this._recomputeOptions()})),this._register(this.notebookEditor.onDidChangeModel(()=>{this._localDisposableStore.clear(),this.notebookEditor.hasModel()&&(this._localDisposableStore.add(this.notebookEditor.onDidChangeOptions(()=>{this._recomputeOptions()})),this._recomputeOptions())})),this.notebookEditor.hasModel()&&this._localDisposableStore.add(this.notebookEditor.onDidChangeOptions(()=>{this._recomputeOptions()})),this._value=this._computeEditorOptions()}static{this.fixedEditorOptions={scrollBeyondLastLine:!1,scrollbar:{verticalScrollbarSize:14,horizontal:"auto",useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,alwaysConsumeMouseWheel:!1},renderLineHighlightOnlyWhenFocus:!0,overviewRulerLanes:0,lineDecorationsWidth:0,folding:!0,fixedOverflowWidgets:!0,minimap:{enabled:!1},renderValidationDecorations:"on",lineNumbersMinChars:3}}get value(){return this._value}_recomputeOptions(){this._value=this._computeEditorOptions(),this._onDidChange.fire()}_computeEditorOptions(){let e=Ji(this.configurationService.getValue("editor",{overrideIdentifier:this.language})),t=this.notebookOptions.getDisplayOptions().editorOptionsCustomizations,o={};if(t)for(let r in t)r.indexOf("editor.")===0&&(o[r.substring(7)]=t[r]);return Object.freeze({...e,...a.fixedEditorOptions,...o,padding:{top:12,bottom:12},readOnly:this.notebookEditor.isReadOnly})}};var khe=class{constructor(i,e,t,o,n,r,s,l){this.index=i;this.level=e;this.cell=t;this.label=o;this.isExecuting=n;this.isPaused=r;this.range=s;this.symbolKind=l;this._children=[]}get icon(){return this.symbolKind?_m.toIcon(this.symbolKind):this.isExecuting&&this.isPaused?Qw:this.isExecuting?q.modify(Qw,"spin"):this.cell.cellKind===1?R.markdown:R.code}addChild(i){this._children.push(i),i._parent=this}get parent(){return this._parent}get children(){return this._children}get markerInfo(){return this._markerInfo}get position(){if(this.range)return{startLineNumber:this.range.startLineNumber,startColumn:this.range.startColumn}}updateMarkers(i){if(this.cell.cellKind===2){let e=i.read({resource:this.cell.uri,severities:12});if(e.length===0)this._markerInfo=void 0;else{let t=e.find(o=>o.severity===8)?.severity??4;this._markerInfo={topSev:t,count:e.length}}}else{let e;for(let t of this.children)t.updateMarkers(i),t.markerInfo&&(e=e?Math.max(t.markerInfo.topSev,e):t.markerInfo.topSev);this._markerInfo=e&&{topSev:e,count:0}}}clearMarkers(){this._markerInfo=void 0;for(let i of this.children)i.clearMarkers()}find(i,e){if(i.id===this.cell.id)return this;e.push(this);for(let t of this.children){let o=t.find(i,e);if(o)return o}e.pop()}asFlatList(i){i.push(this);for(let e of this.children)e.asFlatList(i)}};function KJo(a){let i=Array.from($Ei(a));if(i.length)return i;let e=a.match(/<h([1-6]).*>(.*)<\/h\1>/i);if(e){let t=parseInt(e[1]),o=e[2].trim();i.push({depth:t,text:o})}return i}var t1t=le("INotebookOutlineEntryFactory"),rAe=class{constructor(i,e,t){this.executionStateService=i;this.outlineModelService=e;this.textModelService=t;this.cellOutlineEntryCache={};this.cachedMarkdownOutlineEntries=new WeakMap}getOutlineEntries(i,e){let t=[],o=i.cellKind===1,n=GJo(i),r=!1;if(o){let s=i.getText().substring(0,1e4),l=this.cachedMarkdownOutlineEntries.get(i),c=l?.alternativeId===i.getAlternativeId()?l.headers:Array.from(KJo(s));this.cachedMarkdownOutlineEntries.set(i,{alternativeId:i.getAlternativeId(),headers:c});for(let{depth:u,text:p}of c)r=!0,t.push(new khe(e++,u,i,p,!1,!1));r||(n=Da({value:n}))}if(!r){let s=!o&&this.executionStateService.getCellExecution(i.uri),l=n.trim();if(!o){let c=this.cellOutlineEntryCache[i.id];c&&(t.push(new khe(e++,7,i,l,!!s,s?s.isPaused:!1)),c.forEach(u=>{t.push(new khe(e++,u.level,i,u.name,!1,!1,u.range,u.kind))}))}t.length===0&&(l.length===0&&(l=d(12805,null)),t.push(new khe(e++,7,i,l,!!s,s?s.isPaused:!1)))}return t}async cacheSymbols(i,e){if(i.cellKind===1)return;let t=await this.textModelService.createModelReference(i.uri);try{let o=t.object.textEditorModel,n=await this.outlineModelService.getOrCreate(o,e),r=$ho(n.getTopLevelSymbols(),8);this.cellOutlineEntryCache[i.id]=r}finally{t.dispose()}}};rAe=I([m(0,bs),m(1,AC),m(2,Bt)],rAe);function $ho(a,i){let e=[];return a.forEach(t=>{e.push({name:t.name,range:t.range,level:i,kind:t.kind}),t.children&&e.push(...$ho(t.children,i+1))}),e}function GJo(a){let i=a.textBuffer;for(let e=0;e<i.getLineCount();e++){let t=i.getLineFirstNonWhitespaceColumn(e+1),o=i.getLineLength(e+1);if(t<o)return i.getLineContent(e+1)}return a.getText().substring(0,100)}var sAe=class{constructor(i,e,t,o){this._editor=i;this._markerService=e;this._configurationService=t;this._outlineEntryFactory=o;this._disposables=new N;this._onDidChange=new E;this.onDidChange=this._onDidChange.event;this._entries=[];this.recomputeState()}get activeElement(){return this._activeEntry}get entries(){return this._entries}get isEmpty(){return this._entries.length===0}get uri(){return this._uri}async computeFullSymbols(i){try{let t=this._editor?.getViewModel()?.viewCells.filter(o=>o.cellKind===2);if(t){let o=[];for(let n of t.slice(0,50))o.push(this._outlineEntryFactory.cacheSymbols(n,i));await Promise.allSettled(o)}this.recomputeState()}catch(e){console.error("Failed to compute notebook outline symbols:",e),this.recomputeState()}}recomputeState(){if(this._disposables.clear(),this._activeEntry=void 0,this._uri=void 0,!this._editor.hasModel())return;this._uri=this._editor.textModel.uri;let i=this._editor;if(i.getLength()===0)return;let e=i.getViewModel().viewCells,t=[];for(let s of e)t.push(...this._outlineEntryFactory.getOutlineEntries(s,t.length));if(t.length>0){let s=[t[0]],l=[t[0]];for(let c=1;c<t.length;c++){let u=t[c];for(;;){let p=l.length;if(p===0){s.push(u),l.push(u);break}else{let h=l[p-1];if(h.level<u.level){h.addChild(u),l.push(u);break}else l.pop()}}}this._entries=s}let o=new me;this._disposables.add(o);let n=()=>{if(i.isDisposed)return;let s=u=>{for(let p of this._entries)u?p.clearMarkers():p.updateMarkers(this._markerService)},l=this._configurationService.getValue("problems.visibility");if(l===void 0)return;let c=this._configurationService.getValue("outline.problems.enabled");l&&c?(o.value=this._markerService.onMarkerChanged(u=>{if(i.isDisposed){console.error("notebook editor is disposed");return}u.some(p=>i.getCellsInRange().some(h=>Qe(h.uri,p)))&&(s(!1),this._onDidChange.fire({}))}),s(!1)):(o.clear(),s(!0))};n(),this._disposables.add(this._configurationService.onDidChangeConfiguration(s=>{(s.affectsConfiguration("problems.visibility")||s.affectsConfiguration("outline.problems.enabled"))&&(n(),this._onDidChange.fire({}))}));let{changeEventTriggered:r}=this.recomputeActive();r||this._onDidChange.fire({})}recomputeActive(){let i,e=this._editor;if(e&&e.hasModel()&&e.getLength()>0){let t=e.cellAt(e.getFocus().start);if(t){for(let o of this._entries)if(i=o.find(t,[]),i)break}}return i!==this._activeEntry?(this._activeEntry=i,this._onDidChange.fire({affectOnlyActiveElement:!0}),{changeEventTriggered:!0}):{changeEventTriggered:!1}}dispose(){this._entries.length=0,this._activeEntry=void 0,this._disposables.dispose(),this._onDidChange.dispose()}};sAe=I([m(1,oa),m(2,B),m(3,t1t)],sAe);var Xtt=class extends uC{constructor(e){super();this.instantiationService=e}createReferencedObject(e,t){return this.instantiationService.createInstance(sAe,t)}destroyReferencedObject(e,t){t.dispose()}};Xtt=I([m(0,F)],Xtt);var lAe=le("INotebookCellOutlineDataSourceFactory"),aAe=class{constructor(i){this._data=i.createInstance(Xtt)}getOrCreate(i){return this._data.acquire(i.getId(),i)}};aAe=I([m(0,F)],aAe);var o1t=class a extends x{constructor(e,t,o,n,r){super();this.element=e;this.foldingIcon=t;this.header=o;this.entry=n;this.notebookEditor=r;this._register(j(this.header,re.CLICK||Kn.Tap,()=>{this.focusCell()})),this._register(j(this.foldingIcon.domNode,re.CLICK||Kn.Tap,()=>{if(this.entry.cell.cellKind===1){let s=this.entry.cell.foldingState;this.toggleFoldRange(s)}}))}toggleFoldRange(e){let t=this.notebookEditor.getContribution(kM.id),o=this.entry.index,n=this.entry.level,r=e===2?1:2;t.setFoldingStateDown(o,r,n),this.focusCell()}focusCell(){this.notebookEditor.focusNotebookCell(this.entry.cell,"container");let e=this.notebookEditor.getAbsoluteTopOfElement(this.entry.cell),t=a.getParentCount(this.entry);this.notebookEditor.setScrollTop(e-(t+1.1)*22)}static getParentCount(e){let t=0;for(;e.parent;)t++,e=e.parent;return t}},tTi=class{constructor(i,e){this.isCollapsed=i;this.dimension=e;this.domNode=document.createElement("div"),this.domNode.style.width=`${e}px`,this.domNode.style.height=`${e}px`,this.domNode.className=q.asClassName(i?Uce:Hce)}setVisible(i){this.domNode.style.cursor=i?"pointer":"default",this.domNode.style.opacity=i?"1":"0"}},My=class extends x{constructor(e,t,o,n,r,s){super();this.domNode=e;this.notebookEditor=t;this.notebookCellList=o;this.layoutFn=n;this._contextMenuService=r;this.instantiationService=s;this._disposables=new N;this.currentStickyLines=new Map;this._onDidChangeNotebookStickyScroll=this._register(new E);this.onDidChangeNotebookStickyScroll=this._onDidChangeNotebookStickyScroll.event;this._layoutDisposableStore=this._register(new N);this.notebookEditor.notebookOptions.getDisplayOptions().stickyScrollEnabled&&this.init().catch(console.error),this._register(this.notebookEditor.notebookOptions.onDidChangeOptions(l=>{(l.stickyScrollEnabled||l.stickyScrollMode)&&this.updateConfig(l)})),this._register(j(this.domNode,re.CONTEXT_MENU,async l=>{this.onContextMenu(l)})),this._register(j(this.domNode,re.WHEEL,l=>{this.notebookCellList.triggerScrollFromMouseWheelEvent(l)}))}getDomNode(){return this.domNode}getCurrentStickyHeight(){let e=0;return this.currentStickyLines.forEach(t=>{t.rendered&&(e+=22)}),e}setCurrentStickyLines(e){this.currentStickyLines=e}compareStickyLineMaps(e,t){if(e.size!==t.size)return!1;for(let[o,n]of e){let r=t.get(o);if(!r||n.rendered!==r.rendered)return!1}return!0}onContextMenu(e){let t=new Cn(Re(this.domNode),e),o=t.target.parentElement,n=Array.from(this.currentStickyLines.values()).find(s=>s.line.element.contains(o))?.line.entry;if(!n)return;let r={outlineEntry:n,notebookEditor:this.notebookEditor};this._contextMenuService.showContextMenu({menuId:D.NotebookStickyScrollContext,getAnchor:()=>t,menuActionOptions:{shouldForwardArgs:!0,arg:r,renderShortTitle:!0}})}updateConfig(e){e.stickyScrollEnabled?this.notebookEditor.notebookOptions.getDisplayOptions().stickyScrollEnabled?this.init().catch(console.error):(this._disposables.clear(),this.notebookCellOutlineReference?.dispose(),this.disposeCurrentStickyLines(),Rt(this.domNode),this.updateDisplay()):e.stickyScrollMode&&this.notebookEditor.notebookOptions.getDisplayOptions().stickyScrollEnabled&&this.notebookCellOutlineReference?.object&&this.updateContent(Jtt(this.notebookEditor,this.notebookCellList,this.notebookCellOutlineReference?.object?.entries,this.getCurrentStickyHeight()))}async init(){let{object:e}=this.notebookCellOutlineReference=this.instantiationService.invokeFunction(o=>o.get(lAe).getOrCreate(this.notebookEditor));this._register(this.notebookCellOutlineReference),await e.computeFullSymbols(Se.None);let t=Jtt(this.notebookEditor,this.notebookCellList,e.entries,this.getCurrentStickyHeight());this.updateContent(t),this._disposables.add(e.onDidChange(()=>{let o=Jtt(this.notebookEditor,this.notebookCellList,e.entries,this.getCurrentStickyHeight());this.compareStickyLineMaps(o,this.currentStickyLines)?this.disposeStickyLineMap(o):this.updateContent(o)})),this._disposables.add(this.notebookEditor.onDidAttachViewModel(async()=>{await e.computeFullSymbols(Se.None);let o=Jtt(this.notebookEditor,this.notebookCellList,e.entries,this.getCurrentStickyHeight());this.updateContent(o)})),this._disposables.add(this.notebookEditor.onDidScroll(()=>{let o=new Xo(100);o.trigger(()=>{o.dispose();let n=Jtt(this.notebookEditor,this.notebookCellList,e.entries,this.getCurrentStickyHeight());this.compareStickyLineMaps(n,this.currentStickyLines)?this.disposeStickyLineMap(n):this.updateContent(n)})}))}disposeStickyLineMap(e){e.forEach(t=>{t.line&&t.line.dispose()})}static getVisibleOutlineEntry(e,t){let o=0,n=t.length-1;for(;o<=n;){let r=Math.floor((o+n)/2);if(t[r].index===e){let s=t[r],l=[];return s.asFlatList(l),l.find(c=>c.index===e)}else t[r].index<e?o=r+1:n=r-1}if(n>=0){let r=t[n],s=[];return r.asFlatList(s),s.find(l=>l.index===e)}}updateContent(e){Rt(this.domNode),this.disposeCurrentStickyLines(),this.renderStickyLines(e,this.domNode);let t=this.getCurrentStickyHeight();this.setCurrentStickyLines(e);let o=this.getCurrentStickyHeight()-t;if(o!==0){this._onDidChangeNotebookStickyScroll.fire(o);let n=this._layoutDisposableStore.add(Wr(Re(this.getDomNode()),()=>{this.layoutFn(o),this.updateDisplay(),this._layoutDisposableStore.delete(n)}))}else this.updateDisplay()}updateDisplay(){this.getCurrentStickyHeight()>0?this.domNode.style.display="block":this.domNode.style.display="none"}static computeStickyHeight(e){let t=0;for(e.cell.cellKind===1&&e.level<7&&(t+=22);e.parent;)t+=22,e=e.parent;return t}static checkCollapsedStickyLines(e,t,o){let n=e,r=new Map,s=[];for(;n;){if(n.level>=7){n=n.parent;continue}let l=My.createStickyElement(n,o);r.set(n,{line:l,rendered:!1}),s.unshift(l),n=n.parent}for(let l=0;l<s.length&&!(l>=t);l++)r.set(s[l].entry,{line:s[l],rendered:!0});return r}renderStickyLines(e,t){let o=Array.from(e.entries()).reverse();for(let[,n]of o)n.rendered&&t.append(n.line.element)}static createStickyElement(e,t){let o=document.createElement("div");o.classList.add("notebook-sticky-scroll-element"),t.notebookOptions.getLayoutConfiguration().stickyScrollMode==="indented"&&(o.style.paddingLeft=o1t.getParentCount(e)*10+"px");let r=!1;e.cell.cellKind===1&&(r=e.cell.foldingState===2);let s=new tTi(r,16);s.domNode.classList.add("notebook-sticky-scroll-folding-icon"),s.setVisible(!0);let l=document.createElement("div");return l.classList.add("notebook-sticky-scroll-header"),l.innerText=e.label,o.append(s.domNode,l),new o1t(o,s,l,e,t)}disposeCurrentStickyLines(){this.currentStickyLines.forEach(e=>{e.line.dispose()})}dispose(){this._disposables.dispose(),this.disposeCurrentStickyLines(),this.notebookCellOutlineReference?.dispose(),super.dispose()}};My=I([m(4,Xe),m(5,F)],My);function Jtt(a,i,e,t){let o=a.scrollTop-t,n=a.visibleRanges[0];if(!n)return new Map;if(n.start===0){let h=a.cellAt(0),g=My.getVisibleOutlineEntry(0,e);if(h&&g&&h.cellKind===1&&g.level<7&&a.scrollTop>22)return My.checkCollapsedStickyLines(g,100,a)}let r,s,l=n.start-1;for(let h=l;h<n.end;h++){if(r=a.cellAt(h),!r)return new Map;if(s=My.getVisibleOutlineEntry(h,e),!s)continue;let g=a.cellAt(h+1);if(!g){let v=a.getLayoutInfo().scrollHeight,b=Math.floor(v/22);return My.checkCollapsedStickyLines(s,b,a)}let f=My.getVisibleOutlineEntry(h+1,e);if(f&&g.cellKind===1&&f.level<7){let v=i.getCellViewScrollTop(g),b=My.computeStickyHeight(s),S=My.computeStickyHeight(f);if(o+b<v){let y=Math.floor((v-o)/22);return My.checkCollapsedStickyLines(s,y,a)}else{if(S>=b)return My.checkCollapsedStickyLines(f,100,a);if(S<b){let y=v-o;if(y>=S){let w=Math.floor(y/22);return My.checkCollapsedStickyLines(s,w,a)}else return My.checkCollapsedStickyLines(f,100,a)}}}}let c=a.getLayoutInfo().scrollHeight,u=Math.floor((c-o)/22);return My.checkCollapsedStickyLines(s,u,a)}var n1t=class{constructor(){this.priority=105;this.name="webview-find";this.type="help";this.when=FK}getProvider(i){return new iTi}},iTi=class extends x{constructor(){super(...arguments);this.id="webviewFindHelp";this.verbositySettingKey="accessibility.verbosity.find";this.options={type:"help"}}onClose(){}provideContent(){let e=[];return e.push(d(16596,null)),e.push(d(16591,null)),e.push(""),e.push(d(16618,null)),e.push(d(16617,null)),e.push(""),e.push(d(16605,null)),e.push(d(16604,null)),e.push(""),e.push(d(16601,null)),e.push(d(16600,null)),e.push(d(16597,null)),e.push(d(16598,null)),e.push(d(16599,null)),e.push(""),e.push(d(16595,null)),e.push(d(16592,null)),e.push(d(16593,null)),e.push(d(16594,null)),e.push(""),e.push(d(16606,null)),e.push(""),e.push(d(16608,null)),e.push(d(16607,null)),e.push(d(16609,null)),e.push(""),e.push(d(16612,null)),e.push(d(16610,null)),e.push(d(16613,null)),e.push(d(16611,null)),e.push(""),e.push(d(16603,null)),e.push(d(16602,null)),e.push(""),e.push(d(16615,null,"<keybinding:workbench.action.openSettings>")),e.push(d(16614,null)),e.push(d(16616,null)),e.push(""),e.push(d(16590,null)),e.push(d(16589,null)),e.join(`
`)}};var qJo=100;function cAe(a,i){a?.addImplementation(qJo,"webview",e=>{let o=e.get(cp).activeWebview;if(o?.isFocused)return i(o),!0;if(Nn()?.classList.contains("action-menu-item")){let n=e.get(ee);if(n.activeEditor instanceof Hu)return i(n.activeEditor.webview),!0}return!1})}cAe(S_,a=>a.undo());cAe(I_,a=>a.redo());cAe(Qgt,a=>a.selectAll());cAe(VP,a=>a.copy());cAe(WP,a=>a.paste());cAe($V,a=>a.cut());var Ztt="preventDefaultContextMenuItems";$V&&ve.appendMenuItem(D.WebviewContext,{command:{id:$V.id,title:d(16586,null)},group:"5_cutcopypaste",order:1,when:C.not(Ztt)});VP&&ve.appendMenuItem(D.WebviewContext,{command:{id:VP.id,title:d(16585,null)},group:"5_cutcopypaste",order:2,when:C.not(Ztt)});WP&&ve.appendMenuItem(D.WebviewContext,{command:{id:WP.id,title:d(16587,null)},group:"5_cutcopypaste",order:3,when:C.not(Ztt)});ga.register(new n1t);var dAe=class extends x{constructor(e,t,o,n,r,s){super();this.viewModel=e;this.isReplHistory=t;this.notebookExecutionStateService=o;this.keybindingService=n;this.configurationService=r;this.accessibilityService=s;this._onDidAriaLabelChange=this._register(new E);this.onDidAriaLabelChange=this._onDidAriaLabelChange.event;this._register(U.debounce(this.notebookExecutionStateService.onDidChangeExecution,(l,c)=>this.mergeEvents(l,c),100)(l=>{if(!l.length)return;let c=this.viewModel();if(c){for(let p of l){let h=c.getCellByHandle(p.cellHandle);h&&this._onDidAriaLabelChange.fire(h)}let u=l[l.length-1];if(this.shouldReadCellOutputs(u.state)){let p=c.getCellByHandle(u.cellHandle);if(p&&p.outputsViewModels.length){let h=FPe(c.notebookDocument,p,!0);en(h)}}}},this))}shouldReadCellOutputs(e){return e===void 0&&this.isReplHistory&&this.accessibilityService.isScreenReaderOptimized()&&this.configurationService.getValue("accessibility.replEditor.readLastExecutionOutput")}get verbositySettingId(){return this.isReplHistory?"accessibility.verbosity.replEditor":"accessibility.verbosity.notebook"}getAriaLabel(e){let t=U.filter(this.onDidAriaLabelChange,o=>o===e);return ui(this,t,()=>{let o=this.viewModel();return o&&o.getCellIndex(e)>=0?this.getLabel(e):""})}createItemLabel(e,t){return this.isReplHistory?`cell${e}`:`${t===1?"markdown":"code"} cell${e}`}getLabel(e){let t=this.notebookExecutionStateService.getCellExecution(e.uri)?.state,o=t===3?", executing":t===2?", pending":"";return this.createItemLabel(o,e.cellKind)}get widgetAriaLabelName(){return this.isReplHistory?d(12669,null):d(12666,null)}getWidgetAriaLabel(){let e=this.keybindingService.lookupKeybinding("editor.action.accessibilityHelp")?.getLabel();return this.configurationService.getValue(this.verbositySettingId)?e?d(12667,null,this.widgetAriaLabelName,e):d(12668,null,this.widgetAriaLabelName):this.widgetAriaLabelName}mergeEvents(e,t){let o=this.viewModel(),n=e||[];if(o&&t.type===0&&t.affectsNotebook(o.uri)){let r=n.findIndex(s=>s.cellHandle===t.cellHandle);r>=0&&n.splice(r,1),n.push({cellHandle:t.cellHandle,state:t.changed?.state})}return n}};dAe=I([m(2,bs),m(3,_e),m(4,B),m(5,Oi)],dAe);var r1t=class extends x{constructor(e,t){super();this._notebookEditor=e;this._listViewScrollablement=t;this._register(j(this._listViewScrollablement,re.MOUSE_WHEEL,o=>{let n=o.deltaX,r=o.deltaY,s=o.wheelDeltaX,l=o.wheelDeltaY,c=o.wheelDelta;if(!Ze&&o.shiftKey&&!n&&(n=r,r=0,s=l,l=0),n===0)return;let p=this._notebookEditor.codeEditors.find(f=>{let v=f[1].getLayoutInfo();if(v.contentWidth===v.width)return!1;let b=f[1].getDomNode();return!!(b&&b.contains(o.target))});if(!p)return;let h=Re(o),g={deltaMode:o.deltaMode,deltaX:n,deltaY:0,deltaZ:0,wheelDelta:c&&d1?c/h.devicePixelRatio:c,wheelDeltaX:s&&d1?s/h.devicePixelRatio:s,wheelDeltaY:0,detail:o.detail,shiftKey:o.shiftKey,type:o.type,defaultPrevented:!1,preventDefault:()=>{},stopPropagation:()=>{}};p[1].delegateScrollFromMouseWheelEvent(g)}))}};var uAe=class extends x{constructor(e,t,o,n,r){super();this.notebookEditor=e;this.contextKeyServiceProvider=t;this.textModelService=o;this._configurationService=n;this._instantiationService=r;this._editorDisposable=this._register(new me);this._isInitialized=!1;this._isDisposed=!1;this._focusedEditorDOM=this.notebookEditor.getDomNode().appendChild(_(".cell-editor-part-cache")),this._focusedEditorDOM.style.position="absolute",this._focusedEditorDOM.style.top="-50000px",this._focusedEditorDOM.style.width="1px",this._focusedEditorDOM.style.height="1px"}_initializeEditor(e){this._editorContextKeyService=this._register(this.contextKeyServiceProvider(this._focusedEditorDOM));let t=KS(this._focusedEditorDOM,_(".cell-editor-container")),o=this._register(this._instantiationService.createChild(new _o([X,this._editorContextKeyService])));pe.inCompositeEditor.bindTo(this._editorContextKeyService).set(!0);let n=new oW(this.notebookEditor.getBaseCellEditorOptions(e.language),this.notebookEditor.notebookOptions,this._configurationService);this._editor=this._register(o.createInstance(Xr,t,{...n.getDefaultValue(),dimension:{width:0,height:0},scrollbar:{vertical:"hidden",horizontal:"auto",handleMouseWheel:!1,useShadows:!1},allowVariableLineHeights:!1},{contributions:this.notebookEditor.creationOptions.cellEditorContributions})),n.dispose(),this._isInitialized=!0}preserveFocusedEditor(e){this._isInitialized||this._initializeEditor(e),this._editorDisposable.clear(),this._focusEditorCancellablePromise?.cancel(),this._focusEditorCancellablePromise=Ln(async t=>{let o=await this.textModelService.createModelReference(e.uri);if(this._isDisposed||t.isCancellationRequested){o.dispose();return}let n=new N;n.add(o),this._editor.setModel(o.object.textEditorModel),this._editor.setSelections(e.getSelections()),this._editor.focus();let r=()=>{let s=this._editor.getSelections();s&&e.setSelections(s),this.notebookEditor.revealInView(e),this._editor.setModel(null),o.dispose()};n.add(this._editor.onDidChangeModelContent(s=>{r()})),n.add(this._editor.onDidChangeCursorSelection(s=>{(s.source==="keyboard"||s.source==="mouse")&&r()})),n.add(this.notebookEditor.onDidChangeActiveEditor(()=>{let s=this.notebookEditor.getActiveCell();(s!==e||s.focusMode!==1)&&(this._editorDisposable.clear(),this._editor.setModel(null),o.dispose())})),this._editorDisposable.value=n})}dispose(){this._isDisposed=!0,this._focusEditorCancellablePromise?.cancel(),super.dispose()}};uAe=I([m(2,Bt),m(3,B),m(4,F)],uAe);var s1t=class extends x{constructor(e,t,o){super();this.notebookWidget=e;this._list=t;this.loggingService=o;this._pendingLayouts=new WeakMap;this._layoutDisposables=new Set;this._layoutStack=[];this._isDisposed=!1}checkStackDepth(){if(this._layoutStack.length>30){let e=this._layoutStack.join(" -> ");throw new Error("NotebookCellLayoutManager: layout stack is too deep: "+e)}}async layoutNotebookCell(e,t){let o=`cell:${e.handle}, height:${t}`;if(this.loggingService.debug("cell layout",o),this._list.getViewIndex(e)===void 0)return;if(this._pendingLayouts?.has(e)){let l=this._pendingLayouts.get(e);l.dispose(),this._layoutDisposables.delete(l)}let r=new Ko,s=()=>{let l=this._pendingLayouts?.get(e);this._pendingLayouts?.delete(e),this._layoutStack.push(o);try{if(this._isDisposed||!this.notebookWidget.viewModel?.hasCell(e)||this._list.getViewIndex(e)===void 0||this._list.elementHeight(e)===t)return;if(this.checkStackDepth(),!this.notebookWidget.hasEditorFocus()){let c=this.notebookWidget.viewModel?.getCellIndex(e),u=this.notebookWidget.visibleRanges;if(c!==void 0&&u&&u.length&&u[0].start===c&&this._list.scrollTop>this.notebookWidget.getAbsoluteTopOfElement(e))return this._list.updateElementHeight2(e,t,Math.min(c+1,this.notebookWidget.getLength()-1))}this._list.updateElementHeight2(e,t)}finally{this._layoutStack.pop(),r.complete(void 0),l&&(l.dispose(),this._layoutDisposables.delete(l))}};if(this._list.inRenderingTransaction){let l=Wr(Re(this.notebookWidget.getDomNode()),s),c=Z(()=>{l.dispose(),r.complete(void 0)});this._pendingLayouts?.set(e,c),this._layoutDisposables.add(c)}else s();return r.p}dispose(){super.dispose(),this._isDisposed=!0,this._layoutDisposables.forEach(e=>e.dispose())}};var jJo=_;function kte(){let a=["editor.contrib.review",zee.ID,vB.ID,"editor.contrib.dirtydiff","editor.contrib.testingOutputPeek","editor.contrib.testingDecorations","store.contrib.stickyScrollController","editor.contrib.findController","editor.contrib.emptyTextEditorHint"],i=Ba.getEditorContributions().filter(e=>a.indexOf(e.id)===-1);return{menuIds:{notebookToolbar:D.NotebookToolbar,cellTitleToolbar:D.NotebookCellTitle,cellDeleteToolbar:D.NotebookCellDelete,cellInsertToolbar:D.NotebookCellBetween,cellTopInsertToolbar:D.NotebookCellListTop,cellExecuteToolbar:D.NotebookCellExecute,cellExecutePrimary:D.NotebookCellExecutePrimary},cellEditorContributions:i}}var xG=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super();this.creationOptions=e;this.notebookRendererMessaging=r;this.notebookEditorService=s;this.notebookKernelService=l;this._notebookService=c;this.configurationService=u;this.layoutService=h;this.contextMenuService=g;this.telemetryService=f;this.notebookExecutionService=v;this.editorProgressService=b;this.logService=S;this._onDidChangeCellState=this._register(new E);this.onDidChangeCellState=this._onDidChangeCellState.event;this._onDidChangeViewCells=this._register(new E);this.onDidChangeViewCells=this._onDidChangeViewCells.event;this._onWillChangeModel=this._register(new E);this.onWillChangeModel=this._onWillChangeModel.event;this._onDidChangeModel=this._register(new E);this.onDidChangeModel=this._onDidChangeModel.event;this._onDidAttachViewModel=this._register(new E);this.onDidAttachViewModel=this._onDidAttachViewModel.event;this._onDidChangeOptions=this._register(new E);this.onDidChangeOptions=this._onDidChangeOptions.event;this._onDidChangeDecorations=this._register(new E);this.onDidChangeDecorations=this._onDidChangeDecorations.event;this._onDidScroll=this._register(new E);this.onDidScroll=this._onDidScroll.event;this._onDidChangeLayout=this._register(new E);this.onDidChangeLayout=this._onDidChangeLayout.event;this._onDidChangeActiveCell=this._register(new E);this.onDidChangeActiveCell=this._onDidChangeActiveCell.event;this._onDidChangeFocus=this._register(new E);this.onDidChangeFocus=this._onDidChangeFocus.event;this._onDidChangeSelection=this._register(new E);this.onDidChangeSelection=this._onDidChangeSelection.event;this._onDidChangeVisibleRanges=this._register(new E);this.onDidChangeVisibleRanges=this._onDidChangeVisibleRanges.event;this._onDidFocusEmitter=this._register(new E);this.onDidFocusWidget=this._onDidFocusEmitter.event;this._onDidBlurEmitter=this._register(new E);this.onDidBlurWidget=this._onDidBlurEmitter.event;this._onDidChangeActiveEditor=this._register(new E);this.onDidChangeActiveEditor=this._onDidChangeActiveEditor.event;this._onDidChangeActiveKernel=this._register(new E);this.onDidChangeActiveKernel=this._onDidChangeActiveKernel.event;this._onMouseUp=this._register(new E);this.onMouseUp=this._onMouseUp.event;this._onMouseDown=this._register(new E);this.onMouseDown=this._onMouseDown.event;this._onDidReceiveMessage=this._register(new E);this.onDidReceiveMessage=this._onDidReceiveMessage.event;this._onDidRenderOutput=this._register(new E);this.onDidRenderOutput=this._onDidRenderOutput.event;this._onDidRemoveOutput=this._register(new E);this.onDidRemoveOutput=this._onDidRemoveOutput.event;this._onDidResizeOutputEmitter=this._register(new E);this.onDidResizeOutput=this._onDidResizeOutputEmitter.event;this._webview=null;this._webviewResolvePromise=null;this._webviewTransparentCover=null;this._listDelegate=null;this._dndController=null;this._listTopCellToolbar=null;this._renderedEditors=new Map;this._localStore=this._register(new N);this._localCellStateListeners=[];this._shadowElementViewInfo=null;this._contributions=new Map;this._insetModifyQueueByOutputId=new Nx;this._cellContextKeyManager=null;this._uuid=xt();this._webviewFocused=!1;this._isVisible=!1;this._isDisposed=!1;this._baseCellEditorOptions=new Map;this._debugFlag=!1;this._backgroundMarkdownRenderRunning=!1;this._lastCellWithEditorFocus=null;this._pendingOutputHeightAcks=new Map;this._dimension=t,this.isReplHistory=e.isReplHistory??!1,this._readOnly=e.isReadOnly??!1,this._overlayContainer=document.createElement("div"),this.scopedContextKeyService=this._register(p.createScoped(this._overlayContainer)),this.instantiationService=this._register(o.createChild(new _o([X,this.scopedContextKeyService]))),this._notebookOptions=e.options??this.instantiationService.createInstance(VT,this.creationOptions?.codeWindow??ut,this._readOnly,void 0),this._register(this._notebookOptions);let y=this._register(new YPe);this._viewContext=new eAe(this._notebookOptions,y,P=>this.getBaseCellEditorOptions(P)),this._register(this._viewContext.eventDispatcher.onDidChangeLayout(()=>{this._onDidChangeLayout.fire()})),this._register(this._viewContext.eventDispatcher.onDidChangeCellState(P=>{this._onDidChangeCellState.fire(P)})),this._register(c.onDidChangeOutputRenderers(()=>{this._updateOutputRenderers()})),this._register(this.instantiationService.createInstance(iAe,this)),this._register(l.onDidChangeSelectedNotebooks(P=>{Qe(P.notebook,this.viewModel?.uri)&&(this._loadKernelPreloads(),this._onDidChangeActiveKernel.fire())})),this._scrollBeyondLastLine=this.configurationService.getValue("editor.scrollBeyondLastLine"),this._register(this.configurationService.onDidChangeConfiguration(P=>{P.affectsConfiguration("editor.scrollBeyondLastLine")&&(this._scrollBeyondLastLine=this.configurationService.getValue("editor.scrollBeyondLastLine"),this._dimension&&this._isVisible&&this.layout(this._dimension))})),this._register(this._notebookOptions.onDidChangeOptions(P=>{(P.cellStatusBarVisibility||P.cellToolbarLocation||P.cellToolbarInteraction)&&this._updateForNotebookConfiguration(),P.fontFamily&&this._generateFontInfo(),(P.compactView||P.focusIndicator||P.insertToolbarPosition||P.cellToolbarLocation||P.dragAndDropEnabled||P.fontSize||P.markupFontSize||P.markdownLineHeight||P.fontFamily||P.insertToolbarAlignment||P.outputFontSize||P.outputLineHeight||P.outputFontFamily||P.outputWordWrap||P.outputScrolling||P.outputLinkifyFilePaths||P.minimalError)&&(this._styleElement?.remove(),this._createLayoutStyles(),this._webview?.updateOptions({...this.notebookOptions.computeWebviewOptions(),fontFamily:this._generateFontFamily()})),this._dimension&&this._isVisible&&this.layout(this._dimension)}));let w=e.codeWindow?this.layoutService.getContainer(e.codeWindow):this.layoutService.mainContainer;this._register(n.getPart(w).onDidScroll(P=>{!this._shadowElement||!this._isVisible||(this.updateShadowElement(this._shadowElement,this._dimension),this.layoutContainerOverShadowElement(this._dimension,this._position))})),this.notebookEditorService.addNotebookEditor(this);let k=xt();this._overlayContainer.id=`notebook-${k}`,this._overlayContainer.className="notebookOverlay",this._overlayContainer.classList.add("notebook-editor"),this._overlayContainer.inert=!0,this._overlayContainer.style.visibility="hidden",w.appendChild(this._overlayContainer),this._createBody(this._overlayContainer),this._generateFontInfo(),this._isVisible=!0,this._editorFocus=pr.bindTo(this.scopedContextKeyService),this._outputFocus=bM.bindTo(this.scopedContextKeyService),this._outputInputFocus=ote.bindTo(this.scopedContextKeyService),this._editorEditable=Xl.bindTo(this.scopedContextKeyService),this._cursorNavMode=gtt.bindTo(this.scopedContextKeyService),new Y(Ztt,!1).bindTo(this.scopedContextKeyService).set(!0),this._editorEditable.set(!e.isReadOnly);let T;Array.isArray(this.creationOptions.contributions)?T=this.creationOptions.contributions:T=b8.getEditorContributions();for(let P of T){let O;try{O=this.instantiationService.createInstance(P.ctor,this)}catch(V){mt(V)}if(O)if(!this._contributions.has(P.id))this._contributions.set(P.id,O);else throw O.dispose(),new Error(`DUPLICATE notebook editor contribution: '${P.id}'`)}this._updateForNotebookConfiguration()}get isVisible(){return this._isVisible}get isDisposed(){return this._isDisposed}set viewModel(e){this._onWillChangeModel.fire(this._notebookViewModel?.notebookDocument),this._notebookViewModel=e,this._onDidChangeModel.fire(e?.notebookDocument)}get viewModel(){return this._notebookViewModel}get textModel(){return this._notebookViewModel?.notebookDocument}get isReadOnly(){return this._notebookViewModel?.options.isReadOnly??!1}get activeCodeEditor(){if(this._isDisposed)return;let[e]=this._list.getFocusedElements();return this._renderedEditors.get(e)}get activeCellAndCodeEditor(){if(this._isDisposed)return;let[e]=this._list.getFocusedElements(),t=this._renderedEditors.get(e);if(t)return[e,t]}get codeEditors(){return[...this._renderedEditors]}get visibleRanges(){return this._list?this._list.visibleRanges||[]:[]}get notebookOptions(){return this._notebookOptions}_debug(...e){this._debugFlag&&kho(...e)}getId(){return this._uuid}getViewModel(){return this.viewModel}getLength(){return this.viewModel?.length??0}getSelections(){return this.viewModel?.getSelections()??[{start:0,end:0}]}setSelections(e){if(!this.viewModel)return;let t=this.viewModel.getFocus();this.viewModel.updateSelectionsState({kind:1,focus:t,selections:e})}getFocus(){return this.viewModel?.getFocus()??{start:0,end:0}}setFocus(e){if(!this.viewModel)return;let t=this.viewModel.getSelections();this.viewModel.updateSelectionsState({kind:1,focus:e,selections:t})}getSelectionViewModels(){if(!this.viewModel)return[];let e=new Set;return this.viewModel.getSelections().map(t=>this.viewModel.viewCells.slice(t.start,t.end)).reduce((t,o)=>(o.forEach(n=>{e.has(n.handle)||(e.add(n.handle),t.push(n))}),t),[])}hasModel(){return!!this._notebookViewModel}showProgress(){this._currentProgress=this.editorProgressService.show(!0)}hideProgress(){this._currentProgress&&(this._currentProgress.done(),this._currentProgress=void 0)}getBaseCellEditorOptions(e){let t=this._baseCellEditorOptions.get(e);if(t)return t;{let o=new e1t(this,this.notebookOptions,this.configurationService,e);return this._baseCellEditorOptions.set(e,o),o}}_updateForNotebookConfiguration(){if(!this._overlayContainer)return;this._overlayContainer.classList.remove("cell-title-toolbar-left"),this._overlayContainer.classList.remove("cell-title-toolbar-right"),this._overlayContainer.classList.remove("cell-title-toolbar-hidden");let e=this._notebookOptions.computeCellToolbarLocation(this.viewModel?.viewType);this._overlayContainer.classList.add(`cell-title-toolbar-${e}`);let t=this._notebookOptions.getDisplayOptions().cellToolbarInteraction,o="hover";this._overlayContainer.classList.remove("cell-toolbar-hover"),this._overlayContainer.classList.remove("cell-toolbar-click"),(t==="hover"||t==="click")&&(o=t),this._overlayContainer.classList.add(`cell-toolbar-${o}`)}_generateFontInfo(){let e=this.configurationService.getValue("editor"),t=Re(this.getDomNode());this._fontInfo=iw.readFontInfo(t,QS(e,bu.getInstance(t).value))}_createBody(e){this._notebookTopToolbarContainer=document.createElement("div"),this._notebookTopToolbarContainer.classList.add("notebook-toolbar-container"),this._notebookTopToolbarContainer.style.display="none",M(e,this._notebookTopToolbarContainer),this._notebookStickyScrollContainer=document.createElement("div"),this._notebookStickyScrollContainer.classList.add("notebook-sticky-scroll-container"),M(e,this._notebookStickyScrollContainer),this._body=document.createElement("div"),M(e,this._body),this._body.classList.add("cell-list-container"),this._createLayoutStyles(),this._createCellList(),this._notebookOverviewRulerContainer=document.createElement("div"),this._notebookOverviewRulerContainer.classList.add("notebook-overview-ruler-container"),this._list.scrollableElement.appendChild(this._notebookOverviewRulerContainer),this._registerNotebookOverviewRuler(),this._register(this.instantiationService.createInstance(r1t,this,this._list.scrollableElement)),this._overflowContainer=document.createElement("div"),this._overflowContainer.classList.add("notebook-overflow-widget-container","monaco-editor"),M(e,this._overflowContainer)}_generateFontFamily(){return this._fontInfo?.fontFamily??'"SF Mono", Monaco, Menlo, Consolas, "Ubuntu Mono", "Liberation Mono", "DejaVu Sans Mono", "Courier New", monospace'}_createLayoutStyles(){this._styleElement=Cr(this._body);let{cellRightMargin:e,cellTopMargin:t,cellRunGutter:o,cellBottomMargin:n,codeCellLeftMargin:r,markdownCellGutter:s,markdownCellLeftMargin:l,markdownCellBottomMargin:c,markdownCellTopMargin:u,collapsedIndicatorHeight:p,focusIndicator:h,insertToolbarPosition:g,outputFontSize:f,focusIndicatorLeftMargin:v,focusIndicatorGap:b}=this._notebookOptions.getLayoutConfiguration(),{insertToolbarAlignment:S,compactView:y,fontSize:w}=this._notebookOptions.getDisplayOptions(),k=this._notebookOptions.getCellEditorContainerLeftMargin(),{bottomToolbarGap:T,bottomToolbarHeight:P}=this._notebookOptions.computeBottomToolbarDimensions(this.viewModel?.viewType),O=[];this._fontInfo||this._generateFontInfo();let V=this._generateFontFamily();O.push(`
		.notebook-editor {
			--notebook-cell-output-font-size: ${f}px;
			--notebook-cell-input-preview-font-size: ${w}px;
			--notebook-cell-input-preview-font-family: ${V};
		}
		`),y?O.push(`.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .markdown-cell-row div.cell.code { margin-left: ${k}px; }`):O.push(`.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .markdown-cell-row div.cell.code { margin-left: ${r}px; }`),h==="border"?(O.push(`
			.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator-top:before,
			.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator-bottom:before,
			.monaco-workbench .notebookOverlay .monaco-list .markdown-cell-row .cell-inner-container:before,
			.monaco-workbench .notebookOverlay .monaco-list .markdown-cell-row .cell-inner-container:after {
				content: "";
				position: absolute;
				width: 100%;
				height: 1px;
			}

			.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator-left:before,
			.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator-right:before {
				content: "";
				position: absolute;
				width: 1px;
				height: 100%;
				z-index: 10;
			}

			/* top border */
			.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator-top:before {
				border-top: 1px solid transparent;
			}

			/* left border */
			.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator-left:before {
				border-left: 1px solid transparent;
			}

			/* bottom border */
			.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator-bottom:before {
				border-bottom: 1px solid transparent;
			}

			/* right border */
			.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator-right:before {
				border-right: 1px solid transparent;
			}
			`),O.push(`
			.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row.code-cell-row.focused .cell-focus-indicator-left:before,
			.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row.code-cell-row.focused .cell-focus-indicator-right:before,
			.monaco-workbench .notebookOverlay .monaco-list.selection-multiple .monaco-list-row.code-cell-row.selected .cell-focus-indicator-left:before,
			.monaco-workbench .notebookOverlay .monaco-list.selection-multiple .monaco-list-row.code-cell-row.selected .cell-focus-indicator-right:before {
				top: -${t}px; height: calc(100% + ${t+n}px)
			}`)):(O.push(`
			.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator-left .codeOutput-focus-indicator {
				border-left: 3px solid transparent;
				border-radius: 4px;
				width: 0px;
				margin-left: ${v}px;
				border-color: var(--vscode-notebook-inactiveFocusedCellBorder) !important;
			}

			.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row.focused .cell-focus-indicator-left .codeOutput-focus-indicator-container,
			.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-output-hover .cell-focus-indicator-left .codeOutput-focus-indicator-container,
			.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .markdown-cell-hover .cell-focus-indicator-left .codeOutput-focus-indicator-container,
			.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row:hover .cell-focus-indicator-left .codeOutput-focus-indicator-container {
				display: block;
			}

			.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator-left .codeOutput-focus-indicator-container:hover .codeOutput-focus-indicator {
				border-left: 5px solid transparent;
				margin-left: ${v-1}px;
			}
			`),O.push(`
			.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row.focused .cell-inner-container.cell-output-focus .cell-focus-indicator-left .codeOutput-focus-indicator,
			.monaco-workbench .notebookOverlay .monaco-list:focus-within .monaco-list-row.focused .cell-inner-container .cell-focus-indicator-left .codeOutput-focus-indicator {
				border-color: var(--vscode-notebook-focusedCellBorder) !important;
			}

			.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-inner-container .cell-focus-indicator-left .output-focus-indicator {
				margin-top: ${b}px;
			}
			`)),g==="betweenCells"||g==="both"?(O.push(".monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .cell-bottom-toolbar-container { display: flex; }"),O.push(".monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .view-zones .cell-list-top-cell-toolbar-container { display: flex; }")):(O.push(".monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .cell-bottom-toolbar-container { display: none; }"),O.push(".monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .view-zones .cell-list-top-cell-toolbar-container { display: none; }")),S==="left"&&(O.push(`
			.monaco-workbench .notebookOverlay .cell-list-top-cell-toolbar-container .action-item:first-child,
			.monaco-workbench .notebookOverlay .cell-list-top-cell-toolbar-container .action-item:first-child, .monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .cell-bottom-toolbar-container .action-item:first-child {
				margin-right: 0px !important;
			}`),O.push(`
			.monaco-workbench .notebookOverlay .cell-list-top-cell-toolbar-container .monaco-toolbar .action-label,
			.monaco-workbench .notebookOverlay .cell-list-top-cell-toolbar-container .monaco-toolbar .action-label, .monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .cell-bottom-toolbar-container .monaco-toolbar .action-label {
				padding: 0px !important;
				justify-content: center;
				border-radius: 4px;
			}`),O.push(`
			.monaco-workbench .notebookOverlay .cell-list-top-cell-toolbar-container,
			.monaco-workbench .notebookOverlay .cell-list-top-cell-toolbar-container, .monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .cell-bottom-toolbar-container {
				align-items: flex-start;
				justify-content: left;
				margin: 0 16px 0 ${8+r}px;
			}`),O.push(`
			.monaco-workbench .notebookOverlay .cell-list-top-cell-toolbar-container,
			.notebookOverlay .cell-bottom-toolbar-container .action-item {
				border: 0px;
			}`)),O.push(`.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .code-cell-row div.cell.code { margin-left: ${k}px; }`),O.push(`.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .view-zones .code-cell-row div.cell.code { margin-left: ${k}px; }`),O.push(`.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .view-zones .code-cell-row div.cell { margin-right: ${e}px; }`),O.push(`.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row div.cell { margin-right: ${e}px; }`),O.push(`.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row > .cell-inner-container { padding-top: ${t}px; }`),O.push(`.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .markdown-cell-row > .cell-inner-container { padding-bottom: ${c}px; padding-top: ${u}px; }`),O.push(".notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .markdown-cell-row > .cell-inner-container.webview-backed-markdown-cell { padding: 0; }"),O.push(`.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .markdown-cell-row > .webview-backed-markdown-cell.markdown-cell-edit-mode .cell.code { padding-bottom: ${c}px; padding-top: ${u}px; }`),O.push(`.notebookOverlay .output { margin: 0px ${e}px 0px ${k}px; }`),O.push(`.notebookOverlay .output { width: calc(100% - ${k+e}px); }`),O.push(`.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .cell-comment-container { left: ${k}px; }`),O.push(`.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .cell-comment-container { width: calc(100% - ${k+e}px); }`),O.push(`.monaco-workbench .notebookOverlay .output .output-collapse-container .expandButton { left: -${o}px; }`),O.push(`.monaco-workbench .notebookOverlay .output .output-collapse-container .expandButton {
			position: absolute;
			width: ${o}px;
			padding: 6px 0px;
		}`),O.push(`.notebookOverlay .output-show-more-container { margin: 0px ${e}px 0px ${k}px; }`),O.push(`.notebookOverlay .output-show-more-container { width: calc(100% - ${k+e}px); }`),O.push(`.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row div.cell.markdown { padding-left: ${o}px; }`),O.push(`.monaco-workbench .notebookOverlay > .cell-list-container .notebook-folding-indicator { left: ${(s-20)/2+l}px; }`),O.push(`.notebookOverlay > .cell-list-container .notebook-folded-hint { left: ${s+l+8}px; }`),O.push(`.notebookOverlay .monaco-list .monaco-list-row :not(.webview-backed-markdown-cell) .cell-focus-indicator-top { height: ${t}px; }`),O.push(`.notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator-side { bottom: ${T}px; }`),O.push(`.notebookOverlay .monaco-list .monaco-list-row.code-cell-row .cell-focus-indicator-left { width: ${k}px; }`),O.push(`.notebookOverlay .monaco-list .monaco-list-row.markdown-cell-row .cell-focus-indicator-left { width: ${r}px; }`),O.push(`.notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator.cell-focus-indicator-right { width: ${e}px; }`),O.push(`.notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator-bottom { height: ${n}px; }`),O.push(`.notebookOverlay .monaco-list .monaco-list-row .cell-shadow-container-bottom { top: ${n}px; }`),O.push(`
			.notebookOverlay .monaco-list.selection-multiple .monaco-list-row:has(+ .monaco-list-row.selected) .cell-focus-indicator-bottom {
				height: ${T+n}px;
			}
		`),O.push(`
			.notebookOverlay .monaco-list .monaco-list-row.code-cell-row.nb-multiCellHighlight:has(+ .monaco-list-row.nb-multiCellHighlight) .cell-focus-indicator-bottom {
				height: ${T+n}px;
				background-color: var(--vscode-notebook-symbolHighlightBackground) !important;
			}

			.notebookOverlay .monaco-list .monaco-list-row.markdown-cell-row.nb-multiCellHighlight:has(+ .monaco-list-row.nb-multiCellHighlight) .cell-focus-indicator-bottom {
				height: ${T+n-6}px;
				background-color: var(--vscode-notebook-symbolHighlightBackground) !important;
			}
		`),O.push(`
			.monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .input-collapse-container .cell-collapse-preview {
				line-height: ${p}px;
			}

			.monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .input-collapse-container .cell-collapse-preview .monaco-tokenized-source {
				max-height: ${p}px;
			}
		`),O.push(`.monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .cell-bottom-toolbar-container .monaco-toolbar { height: ${P}px }`),O.push(`.monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .view-zones .cell-list-top-cell-toolbar-container .monaco-toolbar { height: ${P}px }`),O.push(`.monaco-workbench .notebookOverlay.cell-title-toolbar-right > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .cell-title-toolbar {
			right: ${e+26}px;
		}
		.monaco-workbench .notebookOverlay.cell-title-toolbar-left > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .cell-title-toolbar {
			left: ${k+16}px;
		}
		.monaco-workbench .notebookOverlay.cell-title-toolbar-hidden > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .cell-title-toolbar {
			display: none;
		}`),O.push(`
		.monaco-workbench .notebookOverlay .output > div.foreground.output-inner-container {
			padding: ${eTi}px 8px;
		}
		.monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .output-collapse-container {
			padding: ${eTi}px 8px;
		}
		`),O.push(`
		.monaco-workbench .notebookOverlay .cell-chat-part {
			margin: 0 ${e}px 6px 4px;
		}
		`),this._styleElement.textContent=O.join(`
`)}_createCellList(){this._body.classList.add("cell-list-container"),this._dndController=this._register(new FUt(this,this._body));let e=n=>this._list.contextKeyService.createScoped(n);this._editorPool=this._register(this.instantiationService.createInstance(uAe,this,e));let t=[this.instantiationService.createInstance(w8,this,this._renderedEditors,this._editorPool,this._dndController,e),this.instantiationService.createInstance(y8,this,this._dndController,this._renderedEditors,e)];t.forEach(n=>{this._register(n)}),this._listDelegate=this.instantiationService.createInstance(QPe,Re(this.getDomNode())),this._register(this._listDelegate);let o=this.instantiationService.createInstance(dAe,()=>this.viewModel,this.isReplHistory);this._register(o),this._list=this.instantiationService.createInstance(NPe,"NotebookCellList",this._body,this._viewContext.notebookOptions,this._listDelegate,t,this.scopedContextKeyService,{setRowLineHeight:!1,setRowHeight:!1,supportDynamicHeights:!0,horizontalScrolling:!1,keyboardSupport:!1,mouseSupport:!0,multipleSelectionSupport:!0,selectionNavigation:!0,typeNavigationEnabled:!0,paddingTop:0,paddingBottom:0,transformOptimization:!1,initialSize:this._dimension,styleController:n=>this._list,overrideStyles:{listBackground:xte,listActiveSelectionBackground:xte,listActiveSelectionForeground:To,listFocusAndSelectionBackground:xte,listFocusAndSelectionForeground:To,listFocusBackground:xte,listFocusForeground:To,listHoverForeground:To,listHoverBackground:xte,listHoverOutline:Sd,listFocusOutline:Sd,listInactiveSelectionBackground:xte,listInactiveSelectionForeground:To,listInactiveFocusBackground:xte,listInactiveFocusOutline:xte},accessibilityProvider:o}),this._cellLayoutManager=new s1t(this,this._list,this.logService),this._dndController.setList(this._list),this._register(this._list),this._listViewInfoAccessor=new zUt(this._list),this._register(this._listViewInfoAccessor),this._register(wn(...t)),this._listTopCellToolbar=this._register(this.instantiationService.createInstance(nAe,this,this.notebookOptions)),this._webviewTransparentCover=M(this._list.rowsContainer,jJo(".webview-cover")),this._webviewTransparentCover.style.display="none",this._register(DIe(this._overlayContainer,n=>{n.target.classList.contains("slider")&&this._webviewTransparentCover&&(this._webviewTransparentCover.style.display="block")})),this._register(ygt(this._overlayContainer,()=>{this._webviewTransparentCover&&(this._webviewTransparentCover.style.display="none")})),this._register(this._list.onMouseDown(n=>{n.element&&this._onMouseDown.fire({event:n.browserEvent,target:n.element})})),this._register(this._list.onMouseUp(n=>{n.element&&this._onMouseUp.fire({event:n.browserEvent,target:n.element})})),this._register(this._list.onDidChangeFocus(n=>{this._onDidChangeActiveEditor.fire(this),this._onDidChangeActiveCell.fire(),this._onDidChangeFocus.fire(),this._cursorNavMode.set(!1)})),this._register(this._list.onContextMenu(n=>{this.showListContextMenu(n)})),this._register(this._list.onDidChangeVisibleRanges(()=>{this._onDidChangeVisibleRanges.fire()})),this._register(this._list.onDidScroll(n=>{n.scrollTop!==n.oldScrollTop&&(this._onDidScroll.fire(),this.clearActiveCellWidgets()),n.scrollTop===n.oldScrollTop&&n.scrollHeightChanged&&this._onDidChangeLayout.fire()})),this._focusTracker=this._register(qn(this.getDomNode())),this._register(this._focusTracker.onDidBlur(()=>{this._editorFocus.set(!1),this.viewModel?.setEditorFocus(!1),this._onDidBlurEmitter.fire()})),this._register(this._focusTracker.onDidFocus(()=>{this._editorFocus.set(!0),this.viewModel?.setEditorFocus(!0),this._onDidFocusEmitter.fire()})),this._registerNotebookActionsToolbar(),this._registerNotebookStickyScroll(),this._register(this.configurationService.onDidChangeConfiguration(n=>{n.affectsConfiguration(o.verbositySettingId)&&(this._list.ariaLabel=o?.getWidgetAriaLabel())}))}showListContextMenu(e){this.contextMenuService.showContextMenu({menuId:D.NotebookCellTitle,menuActionOptions:{shouldForwardArgs:!0},contextKeyService:this.scopedContextKeyService,getAnchor:()=>e.anchor,getActionsContext:()=>({from:"cellContainer"})})}_registerNotebookOverviewRuler(){this._notebookOverviewRuler=this._register(this.instantiationService.createInstance(oAe,this,this._notebookOverviewRulerContainer))}_registerNotebookActionsToolbar(){this._notebookTopToolbar=this._register(this.instantiationService.createInstance(tAe,this,this.scopedContextKeyService,this._notebookOptions,this._notebookTopToolbarContainer)),this._register(this._notebookTopToolbar.onDidChangeVisibility(()=>{this._dimension&&this._isVisible&&this.layout(this._dimension)}))}_registerNotebookStickyScroll(){this._notebookStickyScroll=this._register(this.instantiationService.createInstance(My,this._notebookStickyScrollContainer,this,this._list,e=>{this.isDisposed||(this._dimension&&this._isVisible&&(e>0?(this.layout(this._dimension),this.setScrollTop(this.scrollTop+e)):e<0&&(this.setScrollTop(this.scrollTop+e),this.layout(this._dimension))),this._onDidScroll.fire())}))}_updateOutputRenderers(){!this.viewModel||!this._webview||(this._webview.updateOutputRenderers(),this.viewModel.viewCells.forEach(e=>{e.outputsViewModels.forEach(t=>{t.pickedMimeType?.rendererId===SK&&t.resetRenderer()})}))}getDomNode(){return this._overlayContainer}getOverflowContainerDomNode(){return this._overflowContainer}getInnerWebview(){return this._webview?.webview}setEditorProgressService(e){this.editorProgressService=e}setParentContextKeyService(e){this.scopedContextKeyService.updateParent(e)}async setModel(e,t,o,n){if(this.viewModel===void 0||!this.viewModel.equal(e)){let r=this._notebookOptions.computeBottomToolbarDimensions(this.viewModel?.viewType);this._detachModel(),await this._attachModel(e,n??e.viewType,t,o);let s=this._notebookOptions.computeBottomToolbarDimensions(this.viewModel?.viewType);(r.bottomToolbarGap!==s.bottomToolbarGap||r.bottomToolbarHeight!==s.bottomToolbarHeight)&&(this._styleElement?.remove(),this._createLayoutStyles(),this._webview?.updateOptions({...this.notebookOptions.computeWebviewOptions(),fontFamily:this._generateFontFamily()})),this.telemetryService.publicLog2("notebook/editorOpened",{scheme:e.uri.scheme,ext:es(e.uri),viewType:e.viewType,isRepl:this.isReplHistory})}else this.restoreListViewState(t);this._restoreSelectedKernel(t),this._loadKernelPreloads(),this._dndController?.clearGlobalDragState(),this._localStore.add(this._list.onDidChangeFocus(()=>{this.updateContextKeysOnFocusChange()})),this.updateContextKeysOnFocusChange(),this._backgroundMarkdownRendering()}_backgroundMarkdownRendering(){this._backgroundMarkdownRenderRunning||(this._backgroundMarkdownRenderRunning=!0,rf(Re(this.getDomNode()),e=>{this._backgroundMarkdownRenderingWithDeadline(e)}))}_backgroundMarkdownRenderingWithDeadline(e){let t=Date.now()+e.timeRemaining(),o=()=>{try{if(this._backgroundMarkdownRenderRunning=!0,this._isDisposed||!this.viewModel)return;let n=this.viewModel.viewCells.find(r=>r.cellKind===1&&!this._webview?.markupPreviewMapping.has(r.id)&&!this.cellIsHidden(r));if(!n)return;this.createMarkupPreview(n)}finally{this._backgroundMarkdownRenderRunning=!1}Date.now()<t?pC(o):this._backgroundMarkdownRendering()};o()}updateContextKeysOnFocusChange(){if(!this.viewModel)return;let e=this._list.getFocusedElements()[0];e&&(this._cellContextKeyManager||(this._cellContextKeyManager=this._localStore.add(this.instantiationService.createInstance(vhe,this,e))),this._cellContextKeyManager.updateForElement(e))}async setOptions(e){if(e?.isReadOnly!==void 0&&(this._readOnly=e?.isReadOnly),!this.viewModel)return;this.viewModel.updateOptions({isReadOnly:this._readOnly}),this.notebookOptions.updateOptions(this._readOnly);let t=e?.cellOptions??this._parseIndexedCellOptions(e);if(t){let o=this.viewModel.viewCells.find(n=>n.uri.toString()===t.resource.toString());if(o){this.focusElement(o);let n=t.options?.selection;n?(o.updateEditState(1,"setOptions"),o.focusMode=1,await this.revealRangeInCenterIfOutsideViewportAsync(o,new z(n.startLineNumber,n.startColumn,n.endLineNumber||n.startLineNumber,n.endColumn||n.startColumn))):this._list.revealCell(o,e?.cellRevealType??4);let r=this._renderedEditors.get(o);if(r){if(t.options?.selection){let{selection:s}=t.options,l=new z(s.startLineNumber,s.startColumn,s.endLineNumber||s.startLineNumber,s.endColumn||s.startColumn);r.setSelection(l),r.revealPositionInCenterIfOutsideViewport({lineNumber:s.startLineNumber,column:s.startColumn}),await this.revealRangeInCenterIfOutsideViewportAsync(o,l)}t.options?.preserveFocus||r.focus()}}}if(e?.cellSelections){let o=e.cellSelections[0].start,n=this.viewModel.cellAt(o);n&&(this.viewModel.updateSelectionsState({kind:1,focus:{start:o,end:o+1},selections:e.cellSelections}),this.revealInCenterIfOutsideViewport(n))}this._updateForOptions(),this._onDidChangeOptions.fire()}_parseIndexedCellOptions(e){if(e?.indexedCellOptions){let t=this.cellAt(e.indexedCellOptions.index);if(t)return{resource:t.uri,options:{selection:e.indexedCellOptions.selection,preserveFocus:!1}}}}_detachModel(){this._localStore.clear(),Be(this._localCellStateListeners),this._list.detachViewModel(),this.viewModel?.dispose(),this.viewModel=void 0,this._webview?.dispose(),this._webview?.element.remove(),this._webview=null,this._list.clear()}_updateForOptions(){this.viewModel&&(this._editorEditable.set(!this.viewModel.options.isReadOnly),this._overflowContainer.classList.toggle("notebook-editor-editable",!this.viewModel.options.isReadOnly),this.getDomNode().classList.toggle("notebook-editor-editable",!this.viewModel.options.isReadOnly))}async _resolveWebview(){return this.textModel?this._webviewResolvePromise?this._webviewResolvePromise:(this._webview||this._ensureWebview(this.getId(),this.textModel.viewType,this.textModel.uri),this._webviewResolvePromise=(async()=>{if(!this._webview)throw new Error("Notebook output webview object is not created successfully.");if(await this._webview.createWebview(this.creationOptions.codeWindow??ut),!this._webview.webview)throw new Error("Notebook output webview element was not created successfully.");return this._localStore.add(this._webview.webview.onDidBlur(()=>{this._outputFocus.set(!1),this._webviewFocused=!1,this.updateEditorFocus(),this.updateCellFocusMode()})),this._localStore.add(this._webview.webview.onDidFocus(()=>{this._outputFocus.set(!0),this.updateEditorFocus(),this._webviewFocused=!0})),this._localStore.add(this._webview.onMessage(e=>{this._onDidReceiveMessage.fire(e)})),this._webview})(),this._webviewResolvePromise):null}_ensureWebview(e,t,o){if(this._webview)return;let n=this;this._webview=this.instantiationService.createInstance(oN,{get creationOptions(){return n.creationOptions},setScrollTop(r){n._list.scrollTop=r},triggerScroll(r){n._list.triggerScrollFromMouseWheelEvent(r)},getCellByInfo:n.getCellByInfo.bind(n),getCellById:n._getCellById.bind(n),toggleNotebookCellSelection:n._toggleNotebookCellSelection.bind(n),focusNotebookCell:n.focusNotebookCell.bind(n),focusNextNotebookCell:n.focusNextNotebookCell.bind(n),updateOutputHeight:n._updateOutputHeight.bind(n),scheduleOutputHeightAck:n._scheduleOutputHeightAck.bind(n),updateMarkupCellHeight:n._updateMarkupCellHeight.bind(n),setMarkupCellEditState:n._setMarkupCellEditState.bind(n),didStartDragMarkupCell:n._didStartDragMarkupCell.bind(n),didDragMarkupCell:n._didDragMarkupCell.bind(n),didDropMarkupCell:n._didDropMarkupCell.bind(n),didEndDragMarkupCell:n._didEndDragMarkupCell.bind(n),didResizeOutput:n._didResizeOutput.bind(n),updatePerformanceMetadata:n._updatePerformanceMetadata.bind(n),didFocusOutputInputChange:n._didFocusOutputInputChange.bind(n)},e,t,o,{...this._notebookOptions.computeWebviewOptions(),fontFamily:this._generateFontFamily()},this.notebookRendererMessaging.getScoped(this._uuid)),this._webview.element.style.width="100%",this._list.attachWebview(this._webview.element)}async _attachModel(e,t,o,n){this._ensureWebview(this.getId(),e.viewType,e.uri),this.viewModel=this.instantiationService.createInstance(Cte,t,e,this._viewContext,this.getLayoutInfo(),{isReadOnly:this._readOnly}),this._viewContext.eventDispatcher.emit([new Ntt({width:!0,fontInfo:!0},this.getLayoutInfo())]),this.notebookOptions.updateOptions(this._readOnly),this._updateForOptions(),this._updateForNotebookConfiguration();{this.viewModel.restoreEditorViewState(o);let l=o?.contributionsState||{};for(let[c,u]of this._contributions)typeof u.restoreViewState=="function"&&u.restoreViewState(l[c])}this._localStore.add(this.viewModel.onDidChangeViewCells(l=>{this._onDidChangeViewCells.fire(l)})),this._localStore.add(this.viewModel.onDidChangeSelection(()=>{this._onDidChangeSelection.fire(),this.updateSelectedMarkdownPreviews()})),this._localStore.add(this._list.onWillScroll(l=>{this._webview?.isResolved()&&(this._webviewTransparentCover.style.transform=`translateY(${l.scrollTop})`)}));let r=!1,s=this._localStore.add(new me);this._localStore.add(this._list.onDidChangeContentHeight(()=>{r||(r=!0,s.value=Wr(Re(this.getDomNode()),()=>{r=!1,this._updateScrollHeight()},100))})),this._localStore.add(this._list.onDidRemoveOutputs(l=>{l.forEach(c=>this.removeInset(c))})),this._localStore.add(this._list.onDidHideOutputs(l=>{l.forEach(c=>this.hideInset(c))})),this._localStore.add(this._list.onDidRemoveCellsFromView(l=>{let c=[],u=[];for(let p of l)if(p.cellKind===1){let h=p;this.viewModel?.viewCells.find(g=>g.handle===h.handle)?c.push(h):u.push(h)}this.hideMarkupPreviews(c),this.deleteMarkupPreviews(u)})),await this._warmupWithMarkdownRenderer(this.viewModel,o,n),n?.mark("customMarkdownLoaded"),this._localCellStateListeners=this.viewModel.viewCells.map(l=>this._bindCellListener(l)),this._lastCellWithEditorFocus=this.viewModel.viewCells.find(l=>this.getActiveCell()===l&&l.focusMode===1)??null,this._localStore.add(this.viewModel.onDidChangeViewCells(l=>{this._isDisposed||([...l.splices].reverse().forEach(c=>{let[u,p,h]=c,g=this._localCellStateListeners.splice(u,p,...h.map(f=>this._bindCellListener(f)));Be(g)}),l.splices.some(c=>c[2].some(u=>u.cellKind===1))&&this._backgroundMarkdownRendering())})),this._dimension?this._list.layout(this.getBodyHeight(this._dimension.height),this._dimension.width):this._list.layout(),this._dndController?.clearGlobalDragState(),this.restoreListViewState(o)}_bindCellListener(e){let t=new N;return t.add(e.onDidChangeLayout(o=>{(o.totalHeight||o.outerWidth)&&this.layoutNotebookCell(e,e.layoutInfo.totalHeight,o.context)})),e.cellKind===2&&t.add(e.onDidRemoveOutputs(o=>{o.forEach(n=>this.removeInset(n))})),t.add(e.onDidChangeState(o=>{o.inputCollapsedChanged&&e.isInputCollapsed&&e.cellKind===1&&this.hideMarkupPreviews([e]),o.outputCollapsedChanged&&e.isOutputCollapsed&&e.cellKind===2&&e.outputsViewModels.forEach(n=>this.hideInset(n)),o.focusModeChanged&&this._validateCellFocusMode(e)})),t.add(e.onCellDecorationsChanged(o=>{o.added.forEach(n=>{n.className&&this.deltaCellContainerClassNames(e.id,[n.className],[],e.cellKind),n.outputClassName&&this.deltaCellContainerClassNames(e.id,[n.outputClassName],[],e.cellKind)}),o.removed.forEach(n=>{n.className&&this.deltaCellContainerClassNames(e.id,[],[n.className],e.cellKind),n.outputClassName&&this.deltaCellContainerClassNames(e.id,[],[n.outputClassName],e.cellKind)})})),t}_validateCellFocusMode(e){e.focusMode===1&&(this._lastCellWithEditorFocus&&this._lastCellWithEditorFocus!==e&&(this._lastCellWithEditorFocus.focusMode=0),this._lastCellWithEditorFocus=e)}async _warmupWithMarkdownRenderer(e,t,o){this.logService.debug("NotebookEditorWidget","warmup "+this.viewModel?.uri.toString()),await this._resolveWebview(),o?.mark("webviewCommLoaded"),this.logService.debug("NotebookEditorWidget","warmup - webview resolved"),this._webview.element.style.visibility="hidden",await this._warmupViewportMarkdownCells(e,t),this.logService.debug("NotebookEditorWidget","warmup - viewport warmed up"),this._list.layout(0,0),this._list.attachViewModel(e),this._list.scrollTop=t?.scrollPosition?.top??0,this._debug("finish initial viewport warmup and view state restore."),this._webview.element.style.visibility="visible",this.logService.debug("NotebookEditorWidget","warmup - list view model attached, set to visible"),this._onDidAttachViewModel.fire()}async _warmupViewportMarkdownCells(e,t){if(t&&t.cellTotalHeights){let o=t.cellTotalHeights,n=t.scrollPosition?.top??0,r=n+Math.max(this._dimension?.height??0,1080),s=0,l=[];for(let c=0;c<e.length;c++){let u=e.cellAt(c),p=o[c]??0;if(s+p<n){s+=p;continue}if(u.cellKind===1&&l.push([u,s]),s+=p,s>r)break}await this._webview.initializeMarkup(l.map(([c,u])=>this.createMarkupCellInitialization(c,u)))}else{let o=e.viewCells.filter(l=>l.cellKind===1).slice(0,5).map(l=>this.createMarkupCellInitialization(l,-1e4));await this._webview.initializeMarkup(o);let n=0,r=[],s=Math.max(this._dimension?.height??0,1080);for(let l of e.viewCells)if(l.cellKind===1&&r.push({id:l.id,top:n}),n+=l.getHeight(this.getLayoutInfo().fontInfo.lineHeight),n>s)break;this._webview?.updateScrollTops([],r)}}createMarkupCellInitialization(e,t){return{mime:e.mime,cellId:e.id,cellHandle:e.handle,content:e.getText(),offset:t,visible:!1,metadata:e.metadata}}restoreListViewState(e){if(!this.viewModel)return;e?.scrollPosition!==void 0?(this._list.scrollTop=e.scrollPosition.top,this._list.scrollLeft=e.scrollPosition.left):(this._list.scrollTop=0,this._list.scrollLeft=0);let t=typeof e?.focus=="number"?e.focus:0;if(t<this.viewModel.length){let o=this.viewModel.cellAt(t);o&&this.viewModel?.updateSelectionsState({kind:0,primary:o.handle,selections:[o.handle]})}else this._list.length>0&&this.viewModel.updateSelectionsState({kind:1,focus:{start:0,end:1},selections:[{start:0,end:1}]});if(e?.editorFocused){let o=this.viewModel.cellAt(t);o&&(o.focusMode=1)}}_restoreSelectedKernel(e){if(e?.selectedKernelId&&this.textModel){let t=this.notebookKernelService.getMatchingKernel(this.textModel),o=t.all.find(n=>n.id===e.selectedKernelId);o&&!t.selected&&this.notebookKernelService.selectKernelForNotebook(o,this.textModel)}}getEditorViewState(){let e=this.viewModel?.getEditorViewState();if(!e)return{editingCells:{},cellLineNumberStates:{},editorViewStates:{},collapsedInputCells:{},collapsedOutputCells:{}};if(this._list){e.scrollPosition={left:this._list.scrollLeft,top:this._list.scrollTop};let o={};for(let n=0;n<this.viewModel.length;n++){let r=this.viewModel.cellAt(n);o[n]=r.layoutInfo.totalHeight}if(e.cellTotalHeights=o,this.viewModel){let n=this.viewModel.getFocus(),r=this.viewModel.cellAt(n.start);if(r){let s=this._list.domElementOfElement(r),l=r.getEditState()===1&&!!(s&&s.ownerDocument.activeElement&&s.contains(s.ownerDocument.activeElement));e.editorFocused=l,e.focus=n.start}}}let t={};for(let[o,n]of this._contributions)typeof n.saveViewState=="function"&&(t[o]=n.saveViewState());return e.contributionsState=t,this.textModel?.uri.scheme===Q.untitled&&(e.selectedKernelId=this.activeKernel?.id),e}_allowScrollBeyondLastLine(){return this._scrollBeyondLastLine&&!this.isReplHistory}getBodyHeight(e){return Math.max(e-(this._notebookTopToolbar?.useGlobalToolbar?26:0),0)}layout(e,t,o){if(!t&&this._shadowElementViewInfo===null){this._dimension=e,this._position=o;return}if(e.width<=0||e.height<=0){this.onWillHide();return}let n=this.layoutService.whenContainerStylesLoaded(Re(this.getDomNode()));n?n.then(()=>this.layoutNotebook(e,t,o)):this.layoutNotebook(e,t,o)}layoutNotebook(e,t,o){if(t&&this.updateShadowElement(t,e,o),this._shadowElementViewInfo&&this._shadowElementViewInfo.width<=0&&this._shadowElementViewInfo.height<=0){this.onWillHide();return}this._dimension=e,this._position=o;let n=this.getBodyHeight(e.height)-this.getLayoutInfo().stickyHeight;VL(this._body,e.width,n);let r=n;this._list.getRenderHeight()<r?(this._list.updateOptions({paddingBottom:this._allowScrollBeyondLastLine()?Math.max(0,r-50):0,paddingTop:0}),this._list.layout(r,e.width)):(this._list.layout(r,e.width),this._list.updateOptions({paddingBottom:this._allowScrollBeyondLastLine()?Math.max(0,r-50):0,paddingTop:0})),this._overlayContainer.inert=!1,this._overlayContainer.style.visibility="visible",this._overlayContainer.style.display="block",this._overlayContainer.style.position="absolute",this._overlayContainer.style.overflow="hidden",this.layoutContainerOverShadowElement(e,o),this._webviewTransparentCover&&(this._webviewTransparentCover.style.height=`${e.height}px`,this._webviewTransparentCover.style.width=`${e.width}px`),this._notebookTopToolbar.layout(this._dimension),this._notebookOverviewRuler.layout(),this._viewContext?.eventDispatcher.emit([new Ntt({width:!0,fontInfo:!0},this.getLayoutInfo())])}updateShadowElement(e,t,o){if(this._shadowElement=e,t&&o)this._shadowElementViewInfo={height:t.height,width:t.width,top:o.top,left:o.left};else{let n=e.getBoundingClientRect();this._shadowElementViewInfo={height:n.height,width:n.width,top:n.top,left:n.left}}}layoutContainerOverShadowElement(e,t){if(e&&t){this._overlayContainer.style.top=`${t.top}px`,this._overlayContainer.style.left=`${t.left}px`,this._overlayContainer.style.width=`${e.width}px`,this._overlayContainer.style.height=`${e.height}px`;return}if(!this._shadowElementViewInfo)return;let o=this._overlayContainer.parentElement?.getBoundingClientRect();this._overlayContainer.style.top=`${this._shadowElementViewInfo.top-(o?.top||0)}px`,this._overlayContainer.style.left=`${this._shadowElementViewInfo.left-(o?.left||0)}px`,this._overlayContainer.style.width=`${e?e.width:this._shadowElementViewInfo.width}px`,this._overlayContainer.style.height=`${e?e.height:this._shadowElementViewInfo.height}px`}focus(){if(this._isVisible=!0,this._editorFocus.set(!0),this._webviewFocused)this._webview?.focusWebview();else{if(this.viewModel){let e=this.viewModel.getFocus(),t=this.viewModel.cellAt(e.start);if(this.hasEditorFocus()||(this.focusContainer(),this.updateEditorFocus()),t&&t.focusMode===1){t.updateEditState(1,"editorWidget.focus"),t.focusMode=1,this.focusEditor(t);return}}this._list.domFocus()}this._currentProgress&&this.showProgress()}onShow(){this._isVisible=!0}focusEditor(e){for(let[t,o]of this._renderedEditors.entries())if(t===e){o.focus();return}}focusContainer(e=!1){this._webviewFocused?this._webview?.focusWebview():this._list.focusContainer(e)}selectOutputContent(e){this._webview?.selectOutputContents(e)}selectInputContents(e){this._webview?.selectInputContents(e)}onWillHide(){this._isVisible=!1,this._editorFocus.set(!1),this._overlayContainer.inert=!0,this._overlayContainer.style.visibility="hidden",this._overlayContainer.style.left="-50000px",this._notebookTopToolbarContainer.style.display="none",this.clearActiveCellWidgets()}clearActiveCellWidgets(){this._renderedEditors.forEach((e,t)=>{this.getActiveCell()===t&&e&&(nc.get(e)?.cancelSuggestWidget(),fh.get(e)?.clearWidgets(),ku.get(e)?.clearWidgets())}),this._renderedEditors.forEach((e,t)=>{Hc.get(e)?.model.get()?.inlineEditState.get()&&e.render(!0)})}editorHasDomFocus(){return Gr(this.getDomNode())}updateEditorFocus(){this._focusTracker.refreshState();let e=this.editorHasDomFocus();this._editorFocus.set(e),this.viewModel?.setEditorFocus(e)}updateCellFocusMode(){let e=this.getActiveCell();e?.focusMode===2&&!this._webviewFocused&&(e.focusMode=0)}hasEditorFocus(){return this.updateEditorFocus(),this.editorHasDomFocus()}hasWebviewFocus(){return this._webviewFocused}hasOutputTextSelection(){if(!this.hasEditorFocus())return!1;let e=Re(this.getDomNode()).getSelection();if(e?.rangeCount!==1)return!1;let t=e.getRangeAt(0);if(t.startContainer===t.endContainer&&t.endOffset-t.startOffset===0)return!1;let o=t.commonAncestorContainer;if(!this._body.contains(o))return!1;for(;o&&o!==this._body;){if(o.classList&&o.classList.contains("output"))return!0;o=o.parentNode}return!1}_didFocusOutputInputChange(e){this._outputInputFocus.set(e)}focusElement(e){this.viewModel?.updateSelectionsState({kind:0,primary:e.handle,selections:[e.handle]})}get scrollTop(){return this._list.scrollTop}get scrollBottom(){return this._list.scrollTop+this._list.getRenderHeight()}getAbsoluteTopOfElement(e){return this._list.getCellViewScrollTop(e)}getAbsoluteBottomOfElement(e){return this._list.getCellViewScrollBottom(e)}getHeightOfElement(e){return this._list.elementHeight(e)}scrollToBottom(){this._list.scrollToBottom()}setScrollTop(e){this._list.scrollTop=e}revealCellRangeInView(e){return this._list.revealCells(e)}revealInView(e){return this._list.revealCell(e,1)}revealInViewAtTop(e){this._list.revealCell(e,2)}revealInCenter(e){this._list.revealCell(e,3)}async revealInCenterIfOutsideViewport(e){await this._list.revealCell(e,4)}async revealFirstLineIfOutsideViewport(e){await this._list.revealCell(e,6)}async revealLineInViewAsync(e,t){return this._list.revealRangeInCell(e,new z(t,1,t,1),1)}async revealLineInCenterAsync(e,t){return this._list.revealRangeInCell(e,new z(t,1,t,1),2)}async revealLineInCenterIfOutsideViewportAsync(e,t){return this._list.revealRangeInCell(e,new z(t,1,t,1),3)}async revealRangeInViewAsync(e,t){return this._list.revealRangeInCell(e,t,1)}async revealRangeInCenterAsync(e,t){return this._list.revealRangeInCell(e,t,2)}async revealRangeInCenterIfOutsideViewportAsync(e,t){return this._list.revealRangeInCell(e,t,3)}revealCellOffsetInCenter(e,t){return this._list.revealCellOffsetInCenter(e,t)}revealOffsetInCenterIfOutsideViewport(e){return this._list.revealOffsetInCenterIfOutsideViewport(e)}getViewIndexByModelIndex(e){if(!this._listViewInfoAccessor)return-1;let t=this.viewModel?.viewCells[e];return t?this._listViewInfoAccessor.getViewIndex(t):-1}getViewHeight(e){return this._listViewInfoAccessor?this._listViewInfoAccessor.getViewHeight(e):-1}getCellRangeFromViewRange(e,t){return this._listViewInfoAccessor.getCellRangeFromViewRange(e,t)}getCellsInRange(e){return this._listViewInfoAccessor.getCellsInRange(e)}setCellEditorSelection(e,t){this._list.setCellEditorSelection(e,t)}setHiddenAreas(e){return this._list.setHiddenAreas(e,!0)}getVisibleRangesPlusViewportAboveAndBelow(){return this._listViewInfoAccessor.getVisibleRangesPlusViewportAboveAndBelow()}deltaCellDecorations(e,t){let o=this.viewModel?.deltaCellDecorations(e,t)||[];return this._onDidChangeDecorations.fire(),o}deltaCellContainerClassNames(e,t,o,n){n===1?this._webview?.deltaMarkupPreviewClassNames(e,t,o):this._webview?.deltaCellOutputContainerClassNames(e,t,o)}changeModelDecorations(e){return this.viewModel?.changeModelDecorations(e)||null}changeViewZones(e){this._list.changeViewZones(e),this._onDidChangeLayout.fire()}getViewZoneLayoutInfo(e){return this._list.getViewZoneLayoutInfo(e)}changeCellOverlays(e){this._list.changeCellOverlays(e)}async _loadKernelPreloads(){if(!this.hasModel())return;let{selected:e}=this.notebookKernelService.getMatchingKernel(this.textModel);this._webview?.isResolved()||await this._resolveWebview(),this._webview?.updateKernelPreloads(e)}get activeKernel(){return this.textModel&&this.notebookKernelService.getSelectedOrSuggestedKernel(this.textModel)}async cancelNotebookCells(e){if(!(!this.viewModel||!this.hasModel()))return e||(e=this.viewModel.viewCells),this.notebookExecutionService.cancelNotebookCellHandles(this.textModel,Array.from(e).map(t=>t.handle))}async executeNotebookCells(e){if(!this.viewModel||!this.hasModel()){this.logService.info("notebookEditorWidget","No NotebookViewModel, cannot execute cells");return}return e||(e=this.viewModel.viewCells),this.notebookExecutionService.executeNotebookCells(this.textModel,Array.from(e).map(t=>t.model),this.scopedContextKeyService)}async layoutNotebookCell(e,t,o){return this._cellLayoutManager?.layoutNotebookCell(e,t)}getActiveCell(){let e=this._list.getFocusedElements();if(e&&e.length)return e[0]}_toggleNotebookCellSelection(e,t){let o=this._list.getSelectedElements(),n=o.includes(e),r=t?o[o.length-1]??e:e,s=this._list.getViewIndex(e),l=this._list.getViewIndex(r),c=this.getCellsInViewRange(s,l);n?this._list.selectElements(o.filter(u=>!c.includes(u))):(this.focusElement(e),this._list.selectElements([...o.filter(u=>!c.includes(u)),...c]))}getCellsInViewRange(e,t){let o=[];for(let n=0;n<this._list.length;++n){let r=this._list.element(n);r&&(n>=e&&n<=t||n>=t&&n<=e)&&o.push(r)}return o}async focusNotebookCell(e,t,o){if(!this._isDisposed)if(e.focusedOutputId=void 0,t==="editor"){if(e.isInputCollapsed=!1,this.focusElement(e),this._list.focusView(),e.updateEditState(1,"focusNotebookCell"),e.focusMode=1,!o?.skipReveal)if(typeof o?.focusEditorLine=="number"){this._cursorNavMode.set(!0),await this.revealLineInViewAsync(e,o.focusEditorLine);let n=this._renderedEditors.get(e),r=o.focusEditorLine;n?.setSelection({startLineNumber:r,startColumn:1,endLineNumber:r,endColumn:1})}else{let n=e.getSelectionsStartPosition();if(n?.length){let r=n[0];await this.revealRangeInViewAsync(e,z.fromPositions(r,r))}else await this.revealInView(e)}}else if(t==="output"){if(this.focusElement(e),this.hasEditorFocus()||this._list.focusView(),!this._webview)return;let n=e.outputsViewModels.find(s=>s.model.alternativeOutputId)?.model.alternativeOutputId,r=o?.outputId??n??e.id;this._webview.focusOutput(r,o?.altOutputId,o?.outputWebviewFocused||this._webviewFocused),e.updateEditState(0,"focusNotebookCell"),e.focusMode=2,e.focusedOutputId=o?.outputId,this._outputFocus.set(!0),o?.skipReveal||this.revealInCenterIfOutsideViewport(e)}else{let n=this._list.domElementOfElement(e);n&&n.ownerDocument.activeElement&&n.contains(n.ownerDocument.activeElement)&&n.ownerDocument.activeElement.blur(),this._webview?.blurOutput(),e.updateEditState(0,"focusNotebookCell"),e.focusMode=0,this.focusElement(e),o?.skipReveal||(typeof o?.focusEditorLine=="number"?(this._cursorNavMode.set(!0),await this.revealInView(e)):o?.revealBehavior===1?await this.revealFirstLineIfOutsideViewport(e):o?.revealBehavior===0?await this.revealInView(e):await this.revealInCenterIfOutsideViewport(e)),this._list.focusView(),this.updateEditorFocus()}}async focusNextNotebookCell(e,t){let o=this.viewModel?.getCellIndex(e);if(typeof o!="number")return;let n=this.viewModel?.cellAt(o+1);n&&await this.focusNotebookCell(n,t)}async _warmupCell(e){if(e.isOutputCollapsed)return;let t=e.outputsViewModels;for(let o of t.slice(0,APe)){let[n,r]=o.resolveMimeTypes(this.textModel,void 0);if(!n.find(p=>p.isTrusted)||n.length===0)continue;let s=n[r];if(!s)return;let l=this._notebookService.getRendererInfo(s.rendererId);if(!l)return;let c={type:1,renderer:l,source:o,mimeType:s.mimeType},u=this._webview?.insetMapping.get(c.source);if(!u||!u.initialized){let p=new Promise(h=>{this._register(U.any(this.onDidRenderOutput,this.onDidRemoveOutput)(g=>{g.model===c.source.model&&h()}))});this.createOutput(e,c,0,!1),await p}else this.createOutput(e,c,0,!1);return}}async _warmupAll(e){if(!this.hasModel()||!this.viewModel)return;let t=this.viewModel.viewCells,o=[];for(let n=0;n<t.length;n++)t[n].cellKind===1&&!this._webview.markupPreviewMapping.has(t[n].id)&&o.push(this.createMarkupPreview(t[n]));if(e&&this._list)for(let n=0;n<this._list.length;n++){let r=this._list.element(n);r?.cellKind===2&&o.push(this._warmupCell(r))}return Promise.all(o)}async _warmupSelection(e,t){if(!this.hasModel()||!this.viewModel)return;let o=this.viewModel.viewCells,n=[];for(let r of t)for(let s=r.start;s<r.end;s++)o[s].cellKind===1&&!this._webview.markupPreviewMapping.has(o[s].id)&&n.push(this.createMarkupPreview(o[s]));if(e&&this._list)for(let r of t)for(let s=r.start;s<r.end;s++){let l=this._list.element(s);l?.cellKind===2&&n.push(this._warmupCell(l))}return Promise.all(n)}async find(e,t,o,n=!1,r=!1,s){if(!this._notebookViewModel)return[];s||(s=this.getId());let l=this._notebookViewModel.find(e,t).filter(p=>p.length>0);if(!t.includeMarkupPreview&&!t.includeOutput||t.findScope?.findScopeType==="text")return this._webview?.findStop(s),l;let c={};if(l.forEach(p=>{c[p.cell.id]=p}),this._webview){let p=Date.now();t.findScope&&t.findScope.findScopeType==="cells"&&t.findScope.selectedCellRanges?await this._warmupSelection(!!t.includeOutput,t.findScope.selectedCellRanges):await this._warmupAll(!!t.includeOutput);let h=Date.now();if(this.logService.debug("Find",`Warmup time: ${h-p}ms`),o.isCancellationRequested)return[];let g=[];t.findScope&&t.findScope.findScopeType==="cells"&&t.findScope.selectedCellRanges&&(g=Yf(t.findScope.selectedCellRanges).map(b=>this._notebookViewModel?.viewCells[b].id??""));let f=await this._webview.find(e,{caseSensitive:t.caseSensitive,wholeWord:t.wholeWord,includeMarkup:!!t.includeMarkupPreview,includeOutput:!!t.includeOutput,shouldGetSearchPreviewInfo:r,ownerID:s,findIds:g});if(o.isCancellationRequested)return[];f.forEach(v=>{let b=this._notebookViewModel.viewCells.find(y=>y.id===v.cellId);if(!b)return;if(v.type==="preview"){if(b.getEditState()===0&&!t.includeMarkupPreview||b.getEditState()===1&&t.includeMarkupInput)return}else if(!t.includeOutput)return;let S=c[v.cellId];S?S.webviewMatches.push(v):c[v.cellId]=new C8(this._notebookViewModel.viewCells.find(y=>y.id===v.cellId),this._notebookViewModel.viewCells.findIndex(y=>y.id===v.cellId),[],[v])})}let u=[];return this._notebookViewModel.viewCells.forEach((p,h)=>{c[p.id]&&u.push(new C8(p,h,c[p.id].contentMatches,c[p.id].webviewMatches))}),u}async findHighlightCurrent(e,t){return this._webview?this._webview?.findHighlightCurrent(e,t??this.getId()):0}async findUnHighlightCurrent(e,t){if(this._webview)return this._webview?.findUnHighlightCurrent(e,t??this.getId())}findStop(e){this._webview?.findStop(e??this.getId())}getLayoutInfo(){if(!this._list)throw new Error("Editor is not initalized successfully");this._fontInfo||this._generateFontInfo();let e=0;return this._dimension&&(e=(this._notebookTopToolbar?.useGlobalToolbar?26:0)+(this._notebookStickyScroll?.getCurrentStickyHeight()??0)),{width:this._dimension?.width??0,height:this._dimension?.height??0,scrollHeight:this._list?.getScrollHeight()??0,fontInfo:this._fontInfo,stickyHeight:this._notebookStickyScroll?.getCurrentStickyHeight()??0,listViewOffsetTop:e}}async createMarkupPreview(e){if(!this._webview||(this._webview.isResolved()||await this._resolveWebview(),!this._webview||!this._list.webviewElement)||!this.viewModel||!this._list.viewModel||this.viewModel.getCellIndex(e)===-1||this.cellIsHidden(e))return;let t=parseInt(this._list.webviewElement.domNode.style.top,10),o=t?0-t:0,n=this._list.getCellViewScrollTop(e);await this._webview.showMarkupPreview({mime:e.mime,cellHandle:e.handle,cellId:e.id,content:e.getText(),offset:n+o,visible:!0,metadata:e.metadata})}cellIsHidden(e){let t=this.viewModel.getCellIndex(e);return this.viewModel.getHiddenRanges().some(n=>t>=n.start&&t<=n.end)}async unhideMarkupPreviews(e){this._webview&&(this._webview.isResolved()||await this._resolveWebview(),await this._webview?.unhideMarkupPreviews(e.map(t=>t.id)))}async hideMarkupPreviews(e){!this._webview||!e.length||(this._webview.isResolved()||await this._resolveWebview(),await this._webview?.hideMarkupPreviews(e.map(t=>t.id)))}async deleteMarkupPreviews(e){this._webview&&(this._webview.isResolved()||await this._resolveWebview(),await this._webview?.deleteMarkupPreviews(e.map(t=>t.id)))}async updateSelectedMarkdownPreviews(){if(!this._webview)return;this._webview.isResolved()||await this._resolveWebview();let e=this.getSelectionViewModels().map(t=>t.id);await this._webview?.updateMarkupPreviewSelections(e.length>1?e:[])}async createOutput(e,t,o,n){this._insetModifyQueueByOutputId.queue(t.source.model.outputId,async()=>{if(this._isDisposed||!this._webview||(this._webview.isResolved()||await this._resolveWebview(),!this._webview)||!this._list.webviewElement)return;t.type===1&&this.notebookRendererMessaging.prepare(t.renderer.id);let r=parseInt(this._list.webviewElement.domNode.style.top,10),s=r?0-r:0,l=this._list.getCellViewScrollTop(e)+s,c=this._webview.insetMapping.get(t.source);if(!c||!c.renderer&&t.type===1)n?this._webview.requestCreateOutputWhenWebviewIdle({cellId:e.id,cellHandle:e.handle,cellUri:e.uri,executionId:e.internalMetadata.executionId},t,l,o):this._webview.createOutput({cellId:e.id,cellHandle:e.handle,cellUri:e.uri,executionId:e.internalMetadata.executionId},t,l,o);else if(c.renderer&&t.type===1&&c.renderer.id!==t.renderer.id)this._webview.removeInsets([t.source]),this._webview.createOutput({cellId:e.id,cellHandle:e.handle,cellUri:e.uri},t,l,o);else if(c.versionId!==t.source.model.versionId)this._webview.updateOutput({cellId:e.id,cellHandle:e.handle,cellUri:e.uri,executionId:e.internalMetadata.executionId},t,l,o);else{let u=e.outputsViewModels.indexOf(t.source),p=e.getOutputOffset(u);this._webview.updateScrollTops([{cell:e,output:t.source,cellTop:l,outputOffset:p,forceDisplay:!e.isOutputCollapsed}],[])}})}async updateOutput(e,t,o){this._insetModifyQueueByOutputId.queue(t.source.model.outputId,async()=>{if(this._isDisposed||!this._webview||e.isOutputCollapsed||(this._webview.isResolved()||await this._resolveWebview(),!this._webview||!this._list.webviewElement))return;if(!this._webview.insetMapping.has(t.source))return this.createOutput(e,t,o,!1);t.type===1&&this.notebookRendererMessaging.prepare(t.renderer.id);let n=parseInt(this._list.webviewElement.domNode.style.top,10),r=n?0-n:0,s=this._list.getCellViewScrollTop(e)+r;this._webview.updateOutput({cellId:e.id,cellHandle:e.handle,cellUri:e.uri},t,s,o)})}async copyOutputImage(e){this._webview?.copyImage(e)}removeInset(e){this._insetModifyQueueByOutputId.queue(e.model.outputId,async()=>{this._isDisposed||!this._webview||(this._webview?.isResolved()&&this._webview.removeInsets([e]),this._onDidRemoveOutput.fire(e))})}hideInset(e){this._insetModifyQueueByOutputId.queue(e.model.outputId,async()=>{this._isDisposed||!this._webview||this._webview?.isResolved()&&this._webview.hideInset(e)})}postMessage(e){this._webview?.isResolved()&&this._webview.postKernelMessage(e)}addClassName(e){this._overlayContainer.classList.add(e)}removeClassName(e){this._overlayContainer.classList.remove(e)}cellAt(e){return this.viewModel?.cellAt(e)}getCellByInfo(e){let{cellHandle:t}=e;return this.viewModel?.viewCells.find(o=>o.handle===t)}getCellByHandle(e){return this.viewModel?.getCellByHandle(e)}getCellIndex(e){return this.viewModel?.getCellIndexByHandle(e.handle)}getNextVisibleCellIndex(e){return this.viewModel?.getNextVisibleCellIndex(e)}getPreviousVisibleCellIndex(e){return this.viewModel?.getPreviousVisibleCellIndex(e)}_updateScrollHeight(){if(this._isDisposed||!this._webview?.isResolved()||!this._list.webviewElement)return;let e=this._list.scrollHeight;this._webview.element.style.height=`${e+bhe*2}px`;let t=parseInt(this._list.webviewElement.domNode.style.top,10),o=t?0-t:0,n=[],r=[];this._webview?.insetMapping.forEach((l,c)=>{let u=this.viewModel?.getCellByHandle(l.cellInfo.cellHandle);if(!u||!(u instanceof ih)||this._list.getViewIndex(u)===void 0)return;let h=u.outputsViewModels.indexOf(c);if(h<0){r.push(c);return}let g=this._list.getCellViewScrollTop(u),f=u.getOutputOffset(h);n.push({cell:u,output:c,cellTop:g+o,outputOffset:f,forceDisplay:!1})}),this._webview.removeInsets(r);let s=[];for(let l of this._webview.markupPreviewMapping.keys()){let c=this.viewModel?.viewCells.find(u=>u.id===l);if(c){let u=this._list.getCellViewScrollTop(c);s.push({id:l,top:u+o})}}(s.length||n.length)&&(this._debug("_list.onDidChangeContentHeight/markdown",s),this._webview?.updateScrollTops(n,s))}_updateOutputHeight(e,t,o,n,r){let s=this.viewModel?.viewCells.find(l=>l.handle===e.cellHandle);if(s&&s instanceof ih){let l=s.outputsViewModels.indexOf(t);l>-1?(this._debug("update cell output",s.handle,o),s.updateOutputHeight(l,o,r),this.layoutNotebookCell(s,s.layoutInfo.totalHeight),n&&this._onDidRenderOutput.fire(t)):this._debug("tried to update cell output that does not exist")}}_scheduleOutputHeightAck(e,t,o){let n=this._pendingOutputHeightAcks.size===0;this._pendingOutputHeightAcks.set(t,{cellId:e.cellId,outputId:t,height:o}),n&&Wr(Re(this.getDomNode()),()=>{this._debug("ack height"),this._updateScrollHeight(),this._webview?.ackHeight([...this._pendingOutputHeightAcks.values()]),this._pendingOutputHeightAcks.clear()},-1)}_getCellById(e){return this.viewModel?.viewCells.find(t=>t.id===e)}_updateMarkupCellHeight(e,t,o){let n=this._getCellById(e);if(n&&n instanceof Hb){let{bottomToolbarGap:r}=this._notebookOptions.computeBottomToolbarDimensions(this.viewModel?.viewType);this._debug("updateMarkdownCellHeight",n.handle,t+r,o),n.renderedMarkdownHeight=t}}_setMarkupCellEditState(e,t){let o=this._getCellById(e);o instanceof Hb&&(this.revealInView(o),o.updateEditState(t,"setMarkdownCellEditState"))}_didStartDragMarkupCell(e,t){let o=this._getCellById(e);if(o instanceof Hb){let n=this._list.webviewElement?-parseInt(this._list.webviewElement.domNode.style.top,10):0;this._dndController?.startExplicitDrag(o,t.dragOffsetY-n)}}_didDragMarkupCell(e,t){let o=this._getCellById(e);if(o instanceof Hb){let n=this._list.webviewElement?-parseInt(this._list.webviewElement.domNode.style.top,10):0;this._dndController?.explicitDrag(o,t.dragOffsetY-n)}}_didDropMarkupCell(e,t){let o=this._getCellById(e);if(o instanceof Hb){let n=this._list.webviewElement?-parseInt(this._list.webviewElement.domNode.style.top,10):0;t.dragOffsetY-=n,this._dndController?.explicitDrop(o,t)}}_didEndDragMarkupCell(e){let t=this._getCellById(e);t instanceof Hb&&this._dndController?.endExplicitDrag(t)}_didResizeOutput(e){let t=this._getCellById(e);t&&this._onDidResizeOutputEmitter.fire(t)}_updatePerformanceMetadata(e,t,o,n){if(!this.hasModel())return;let r=this._getCellById(e),s=r?this.getCellIndex(r):void 0;if(r?.internalMetadata.executionId===t&&s!==void 0){let l=r.internalMetadata.renderDuration||{};l[n]=(l[n]??0)+o,this.textModel.applyEdits([{editType:9,index:s,internalMetadata:{executionId:t,renderDuration:l}}],!0,void 0,()=>{},void 0,!1)}}getContribution(e){return this._contributions.get(e)||null}dispose(){this._isDisposed=!0,this._webview?.dispose(),this._webview=null,this.notebookEditorService.removeNotebookEditor(this),Be(this._contributions.values()),this._contributions.clear(),this._localStore.clear(),Be(this._localCellStateListeners),this._list.dispose(),this._cellLayoutManager?.dispose(),this._listTopCellToolbar?.dispose(),this._overlayContainer.remove(),this.viewModel?.dispose(),this._renderedEditors.clear(),this._baseCellEditorOptions.forEach(e=>e.dispose()),this._baseCellEditorOptions.clear(),this._notebookOverviewRulerContainer.remove(),super.dispose(),this._webview=null,this._webviewResolvePromise=null,this._webviewTransparentCover=null,this._dndController=null,this._listTopCellToolbar=null,this._notebookViewModel=void 0,this._cellContextKeyManager=null,this._notebookTopToolbar=null,this._list=null,this._listViewInfoAccessor=null,this._listDelegate=null}toJSON(){return{notebookUri:this.viewModel?.uri}}};xG=I([m(2,F),m(3,wt),m(4,aDe),m(5,Gc),m(6,Ol),m(7,bn),m(8,B),m(9,X),m(10,Kl),m(11,Xe),m(12,Te),m(13,eJ),m(14,wd),m(15,Uv)],xG);Kk(0,5,"notebook-progress-bar");Kk(0,10,"notebook-list-insertion-indicator");Kk(0,20,"notebook-cell-editor-outline");Kk(0,25,"notebook-scrollbar");Kk(0,26,"notebook-cell-status");Kk(0,26,"notebook-folding-indicator");Kk(0,27,"notebook-output");Kk(0,28,"notebook-cell-bottom-toolbar-container");Kk(0,29,"notebook-run-button-container");Kk(0,29,"notebook-input-collapse-condicon");Kk(0,30,"notebook-cell-output-toolbar");Kk(35,1,"notebook-cell-expand-part-button");Kk(35,2,"notebook-cell-toolbar");Kk(35,3,"notebook-cell-toolbar-dropdown-active");var oTi=te("notebook.cellBorderColor",{dark:ai(Kf,1),light:ai(Kf,1),hcDark:vf,hcLight:vf},d(12679,null)),cDu=te("notebook.focusedEditorBorder",Sd,d(12687,null)),Qho=te("notebookStatusSuccessIcon.foreground",MPe,d(12700,null)),Yho=te("notebookEditorOverviewRuler.runningCellForeground",MPe,d(12694,null)),Xho=te("notebookStatusErrorIcon.foreground",sle,d(12698,null)),dDu=te("notebookStatusRunningIcon.foreground",To,d(12699,null)),uDu=te("notebook.outputContainerBorderColor",null,d(12691,null)),pDu=te("notebook.outputContainerBackgroundColor",null,d(12690,null)),mDu=te("notebook.cellToolbarSeparator",{dark:We.fromHex("#808080").transparent(.35),light:We.fromHex("#808080").transparent(.35),hcDark:bi,hcLight:bi},d(12684,null)),jho=te("notebook.focusedCellBackground",null,d(12678,null)),hDu=te("notebook.selectedCellBackground",{dark:Kf,light:Kf,hcDark:null,hcLight:null},d(12701,null)),gDu=te("notebook.cellHoverBackground",{dark:ai(jho,.5),light:ai(jho,.7),hcDark:null,hcLight:null},d(12681,null)),fDu=te("notebook.selectedCellBorder",{dark:oTi,light:oTi,hcDark:bi,hcLight:bi},d(12692,null)),vDu=te("notebook.inactiveSelectedCellBorder",{dark:null,light:null,hcDark:Sd,hcLight:Sd},d(12689,null)),bDu=te("notebook.focusedCellBorder",Sd,d(12686,null)),SDu=te("notebook.inactiveFocusedCellBorder",oTi,d(12688,null)),IDu=te("notebook.cellStatusBarItemHoverBackground",{light:new We(new zt(0,0,0,.08)),dark:new We(new zt(255,255,255,.15)),hcDark:new We(new zt(255,255,255,.15)),hcLight:new We(new zt(0,0,0,.08))},d(12683,null)),yDu=te("notebook.cellInsertionIndicator",Sd,d(12682,null)),wDu=te("notebookScrollbarSlider.background",k7,d(12696,null)),CDu=te("notebookScrollbarSlider.hoverBackground",z1,d(12697,null)),xDu=te("notebookScrollbarSlider.activeBackground",K1,d(12695,null)),kDu=te("notebook.symbolHighlightBackground",{dark:We.fromHex("#ffffff0b"),light:We.fromHex("#fdff0033"),hcDark:null,hcLight:null},d(12693,null)),EDu=te("notebook.cellEditorBackground",{light:bf,dark:bf,hcDark:null,hcLight:null},d(12680,null)),xte=te("notebook.editorBackground",{light:l6e,dark:l6e,hcDark:null,hcLight:null},d(12685,null));var QJo={top:24,bottom:24},Jho={top:12,bottom:12};function nN(a){return a===1?QJo:Jho}var pAe={padding:Jho,scrollBeyondLastLine:!1,scrollbar:{verticalScrollbarSize:14,horizontal:"auto",vertical:"auto",useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,alwaysConsumeMouseWheel:!1},renderLineHighlightOnlyWhenFocus:!0,overviewRulerLanes:0,overviewRulerBorder:!1,selectOnLineNumbers:!1,wordWrap:"off",lineNumbers:"off",glyphMargin:!0,fixedOverflowWidgets:!0,minimap:{enabled:!1},renderValidationDecorations:"on",renderLineHighlight:"none",readOnly:!0},mAe={...pAe,glyphMargin:!0,enableSplitViewResizing:!1,renderIndicators:!0,renderMarginRevertIcon:!1,readOnly:!1,isInEmbeddedEditor:!0,renderOverviewRuler:!1,wordWrap:"off",diffWordWrap:"off",diffAlgorithm:"advanced",renderSideBySide:!0,useInlineViewWhenSpaceIsLimited:!1};var Ehe=class extends x{constructor(e,t){super();this.textModel=e;this._notebookService=t;this._onDidChangeState=this._register(new E);this._hoveringOutput=!1;this._focusOnOutput=!1;this._focusInputInOutput=!1;this._outputCollection=[];this._outputsTop=null;this._onDidChangeOutputLayout=this._register(new E);this.onDidChangeOutputLayout=this._onDidChangeOutputLayout.event;this._id=xt(),this._outputViewModels=this.textModel.outputs.map(o=>new yte(this,o,this._notebookService)),this._register(this.textModel.onDidChangeOutputs(o=>{this._outputCollection.splice(o.start,o.deleteCount,...o.newOutputs.map(()=>0)),this._outputViewModels.splice(o.start,o.deleteCount,...o.newOutputs.map(r=>new yte(this,r,this._notebookService))).forEach(r=>r.dispose()),this._outputsTop=null,this._onDidChangeOutputLayout.fire()})),this._outputCollection=new Array(this.textModel.outputs.length)}get id(){return this._id}get outputs(){return this.textModel.outputs}get language(){return this.textModel.language}get metadata(){return this.textModel.metadata}get uri(){return this.textModel.uri}get handle(){return this.textModel.handle}get outputIsHovered(){return this._hoveringOutput}set outputIsHovered(e){this._hoveringOutput=e,this._onDidChangeState.fire({outputIsHoveredChanged:!0})}get outputIsFocused(){return this._focusOnOutput}set outputIsFocused(e){this._focusOnOutput=e,this._onDidChangeState.fire({outputIsFocusedChanged:!0})}get inputInOutputIsFocused(){return this._focusInputInOutput}set inputInOutputIsFocused(e){this._focusInputInOutput=e}get outputsViewModels(){return this._outputViewModels}_ensureOutputsTop(){if(!this._outputsTop){let e=new Uint32Array(this._outputCollection.length);for(let t=0;t<this._outputCollection.length;t++)e[t]=this._outputCollection[t];this._outputsTop=new C_(e)}}getOutputOffset(e){if(this._ensureOutputsTop(),e>=this._outputCollection.length)throw new Error("Output index out of range!");return this._outputsTop.getPrefixSum(e-1)}updateOutputHeight(e,t){if(e>=this._outputCollection.length)throw new Error("Output index out of range!");this._ensureOutputsTop(),this._outputCollection[e]=t,this._outputsTop.setValue(e,t)&&this._onDidChangeOutputLayout.fire()}getOutputTotalHeight(){return this._ensureOutputsTop(),this._outputsTop?.getTotalSum()??0}dispose(){super.dispose(),this._outputViewModels.forEach(e=>{e.dispose()})}};Ehe=I([m(1,bn)],Ehe);var a1t=class{constructor(i,e){this.source=i;this.value=e;this.type=1}};var hAe=class extends x{constructor(){super(...arguments);this._onDidChangeLayout=this._register(new E);this.onDidChangeLayout=this._onDidChangeLayout.event;this._onDidChangeCellLayout=this._register(new E);this.onDidChangeCellLayout=this._onDidChangeCellLayout.event}emit(e){for(let t=0,o=e.length;t<o;t++){let n=e[t];switch(n.type){case 1:this._onDidChangeLayout.fire(n);break;case 2:this._onDidChangeCellLayout.fire(n);break}}}};var QD=16,The=new Y("notebook.diffEditor.cell.inputChanged",!1),eit=new Y("notebook.diffEditor.metadataChanged",!1),nTi="notebook.diffEditor.cell.ignoreWhitespace",Zho=new Y(nTi,!1),_he=new Y("notebook.diffEditor.cell.property.changed",!1),l1t=new Y("notebook.diffEditor.cell.property.expanded",!1),ego=new Y("notebook.diffEditor.allCollapsed",void 0,d(12579,null)),Dhe=new Y("notebook.diffEditor.hasUnchangedCells",void 0,d(12580,null)),tit=new Y("notebook.diffEditor.unchangedCellsAreHidden",void 0,d(12583,null)),k8=new Y("notebook.diffEditor.item.kind",void 0,d(12581,null)),E8=new Y("notebook.diffEditor.item.state",void 0,d(12582,null));function c1t(a,i){let e={};if(a){let o=new Set([...Object.keys(i)]);for(let n of o)a[n]||(e[n]=i[n])}else e=i;return s0(e,{})}var iit=class extends x{constructor(e){super();this.notebookModel=e;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._textBufferHash=null;this.uri=PQe.generate(this.notebookModel.uri),this._register(this.notebookModel.onDidChangeContent(t=>{t.rawEvents.some(o=>o.kind===11||o.kind===1)&&(this._textBuffer?.dispose(),this._textBuffer=void 0,this._textBufferHash=null,this._onDidChange.fire())}))}get metadata(){return this.notebookModel.metadata}get textBuffer(){if(this._textBuffer)return this._textBuffer;let e=c1t(this.notebookModel.transientOptions.transientDocumentMetadata,this.metadata);return this._textBuffer=this._register(hz(e,1).textBuffer),this._register(this._textBuffer.onDidChangeContent(()=>{this._onDidChange.fire()})),this._textBuffer}getHash(){if(this._textBufferHash!==null)return this._textBufferHash;let e=new Yy,t=this.textBuffer.createSnapshot(!1),o;for(;o=t.read();)e.update(o);return this._textBufferHash=e.digest(),this._textBufferHash}getValue(){let e=this.getFullModelRange();return this.textBuffer.getEOL()===`
`?this.textBuffer.getValueInRange(e,1):this.textBuffer.getValueInRange(e,2)}getFullModelRange(){let e=this.textBuffer.getLineCount();return new z(1,1,e,this.textBuffer.getLineLength(e)+1)}};var d1t=25,tgo=24,igo=17;var rit=1440,oit=class extends x{constructor(e,t,o){super();this.mainDocumentTextModel=e;this.editorEventDispatcher=t;this.initData=o;this._layoutInfoEmitter=this._register(new E);this.onDidLayoutChange=this._layoutInfoEmitter.event;this._register(this.editorEventDispatcher.onDidChangeLayout(n=>this._layoutInfoEmitter.fire({outerWidth:!0})))}},u1t=class extends oit{constructor(e,t,o){super(e,t,o);this.type="placeholder";this.hiddenCells=[];this._unfoldHiddenCells=this._register(new E);this.onUnfoldHiddenCells=this._unfoldHiddenCells.event;this.renderOutput=!1}get totalHeight(){return 24+2*QD}getHeight(e){return this.totalHeight}layoutChange(){}showHiddenCells(){this._unfoldHiddenCells.fire()}},gAe=class extends oit{constructor(e,t,o,n,r,s,l){super(e,n,r);this.originalDocumentTextModel=e;this.modifiedDocumentTextModel=t;this.type=o;this.editorHeightCalculator=l;this.renderOutput=!1;this._sourceEditorViewState=null;let c=d1t;this._layoutInfo={width:0,editorHeight:0,editorMargin:0,metadataHeight:0,cellStatusHeight:c,metadataStatusHeight:0,rawOutputHeight:0,outputTotalHeight:0,outputStatusHeight:0,outputMetadataHeight:0,bodyMargin:32,totalHeight:82+c+0,layoutState:0},this.cellFoldingState=o==="modifiedMetadata"?0:1,this.originalMetadata=this._register(new iit(e)),this.modifiedMetadata=this._register(new iit(t))}set editorHeight(e){this._layout({editorHeight:e})}get editorHeight(){throw new Error("Use Cell.layoutInfo.editorHeight")}set editorMargin(e){this._layout({editorMargin:e})}get editorMargin(){throw new Error("Use Cell.layoutInfo.editorMargin")}get layoutInfo(){return this._layoutInfo}get totalHeight(){return this.layoutInfo.totalHeight}async computeHeights(){if(this.type==="unchangedMetadata")this.editorHeight=this.editorHeightCalculator.computeHeightFromLines(this.originalMetadata.textBuffer.getLineCount());else{let e=this.originalMetadata.uri,t=this.modifiedMetadata.uri;this.editorHeight=await this.editorHeightCalculator.diffAndComputeHeight(e,t)}}layoutChange(){this._layout({recomputeOutput:!0})}_layout(e){let t=e.width!==void 0?e.width:this._layoutInfo.width,o=e.editorHeight!==void 0?e.editorHeight:this._layoutInfo.editorHeight,n=e.editorMargin!==void 0?e.editorMargin:this._layoutInfo.editorMargin,r=e.cellStatusHeight!==void 0?e.cellStatusHeight:this._layoutInfo.cellStatusHeight,s=e.bodyMargin!==void 0?e.bodyMargin:this._layoutInfo.bodyMargin,l=o+n+r+s,c={width:t,editorHeight:o,editorMargin:n,metadataHeight:0,cellStatusHeight:r,metadataStatusHeight:0,outputTotalHeight:0,outputStatusHeight:0,bodyMargin:s,rawOutputHeight:0,outputMetadataHeight:0,totalHeight:l,layoutState:3},u=!1,p={};c.width!==this._layoutInfo.width&&(p.width=!0,u=!0),c.editorHeight!==this._layoutInfo.editorHeight&&(p.editorHeight=!0,u=!0),c.editorMargin!==this._layoutInfo.editorMargin&&(p.editorMargin=!0,u=!0),c.cellStatusHeight!==this._layoutInfo.cellStatusHeight&&(p.cellStatusHeight=!0,u=!0),c.bodyMargin!==this._layoutInfo.bodyMargin&&(p.bodyMargin=!0,u=!0),c.totalHeight!==this._layoutInfo.totalHeight&&(p.totalHeight=!0,u=!0),u&&(this._layoutInfo=c,this._fireLayoutChangeEvent(p))}getHeight(e){if(this._layoutInfo.layoutState===0){let t=this.cellFoldingState===1?0:this.computeInputEditorHeight(e);return this._computeTotalHeight(t)}else return this._layoutInfo.totalHeight}_computeTotalHeight(e){return e+this._layoutInfo.editorMargin+this._layoutInfo.metadataHeight+this._layoutInfo.cellStatusHeight+this._layoutInfo.metadataStatusHeight+this._layoutInfo.outputTotalHeight+this._layoutInfo.outputStatusHeight+this._layoutInfo.outputMetadataHeight+this._layoutInfo.bodyMargin}computeInputEditorHeight(e){return this.editorHeightCalculator.computeHeightFromLines(Math.max(this.originalMetadata.textBuffer.getLineCount(),this.modifiedMetadata.textBuffer.getLineCount()))}_fireLayoutChangeEvent(e){this._layoutInfoEmitter.fire(e),this.editorEventDispatcher.emit([{type:2,source:this._layoutInfo}])}getComputedCellContainerWidth(e,t,o){return o?e.width-2*QD+(t?op.ENTIRE_DIFF_OVERVIEW_WIDTH:0)-2:(e.width-2*QD+(t?op.ENTIRE_DIFF_OVERVIEW_WIDTH:0))/2-18-2}getSourceEditorViewState(){return this._sourceEditorViewState}saveSpirceEditorViewState(e){this._sourceEditorViewState=e}},p1t=class extends oit{constructor(e,t,o,n,r,s,l,c,u,p){super(e,r,s);this.type=n;this.index=c;this.configurationService=u;this.diffEditorHeightCalculator=p;this._stateChangeEmitter=this._register(new E);this.onDidStateChange=this._stateChangeEmitter.event;this._hideUnchangedCells=this._register(new E);this.onHideUnchangedCells=this._hideUnchangedCells.event;this._renderOutput=!0;this._sourceEditorViewState=null;this._outputEditorViewState=null;this._metadataEditorViewState=null;this.original=t?this._register(new Ehe(t,l)):void 0,this.modified=o?this._register(new Ehe(o,l)):void 0;let h=this._estimateEditorHeight(s.fontInfo),g=d1t;this._layoutInfo={width:0,editorHeight:h,editorMargin:0,metadataHeight:0,cellStatusHeight:g,metadataStatusHeight:this.ignoreMetadata?0:d1t,rawOutputHeight:0,outputTotalHeight:0,outputStatusHeight:this.ignoreOutputs?0:d1t,outputMetadataHeight:0,bodyMargin:32,totalHeight:82+g+h,layoutState:0},this.cellFoldingState=o?.getTextBufferHash()!==t?.getTextBufferHash()?0:1,this.metadataFoldingState=1,this.outputFoldingState=1}hideUnchangedCells(){this._hideUnchangedCells.fire()}set rawOutputHeight(e){this._layout({rawOutputHeight:Math.min(rit,e)})}get rawOutputHeight(){throw new Error("Use Cell.layoutInfo.rawOutputHeight")}set outputStatusHeight(e){this._layout({outputStatusHeight:e})}get outputStatusHeight(){throw new Error("Use Cell.layoutInfo.outputStatusHeight")}set outputMetadataHeight(e){this._layout({outputMetadataHeight:e})}get outputMetadataHeight(){throw new Error("Use Cell.layoutInfo.outputStatusHeight")}set editorHeight(e){this._layout({editorHeight:e})}get editorHeight(){throw new Error("Use Cell.layoutInfo.editorHeight")}set editorMargin(e){this._layout({editorMargin:e})}get editorMargin(){throw new Error("Use Cell.layoutInfo.editorMargin")}set metadataStatusHeight(e){this._layout({metadataStatusHeight:e})}get metadataStatusHeight(){throw new Error("Use Cell.layoutInfo.outputStatusHeight")}set metadataHeight(e){this._layout({metadataHeight:e})}get metadataHeight(){throw new Error("Use Cell.layoutInfo.metadataHeight")}set renderOutput(e){this._renderOutput=e,this._layout({recomputeOutput:!0}),this._stateChangeEmitter.fire({renderOutput:this._renderOutput})}get renderOutput(){return this._renderOutput}get layoutInfo(){return this._layoutInfo}get totalHeight(){return this.layoutInfo.totalHeight}get ignoreOutputs(){return this.configurationService.getValue("notebook.diff.ignoreOutputs")||!!this.mainDocumentTextModel?.transientOptions.transientOutputs}get ignoreMetadata(){return this.configurationService.getValue("notebook.diff.ignoreMetadata")}layoutChange(){this._layout({recomputeOutput:!0})}_estimateEditorHeight(e){let t=e?.lineHeight??17;switch(this.type){case"unchanged":case"insert":{let o=this.modified.textModel.textBuffer.getLineCount();return o*t+nN(o).top+nN(o).bottom}case"delete":case"modified":{let o=this.original.textModel.textBuffer.getLineCount();return o*t+nN(o).top+nN(o).bottom}}}_layout(e){let t=e.width!==void 0?e.width:this._layoutInfo.width,o=e.editorHeight!==void 0?e.editorHeight:this._layoutInfo.editorHeight,n=e.editorMargin!==void 0?e.editorMargin:this._layoutInfo.editorMargin,r=e.metadataHeight!==void 0?e.metadataHeight:this._layoutInfo.metadataHeight,s=e.cellStatusHeight!==void 0?e.cellStatusHeight:this._layoutInfo.cellStatusHeight,l=e.metadataStatusHeight!==void 0?e.metadataStatusHeight:this._layoutInfo.metadataStatusHeight,c=e.rawOutputHeight!==void 0?e.rawOutputHeight:this._layoutInfo.rawOutputHeight,u=e.outputStatusHeight!==void 0?e.outputStatusHeight:this._layoutInfo.outputStatusHeight,p=e.bodyMargin!==void 0?e.bodyMargin:this._layoutInfo.bodyMargin,h=e.outputMetadataHeight!==void 0?e.outputMetadataHeight:this._layoutInfo.outputMetadataHeight,g=this.ignoreOutputs?0:e.recomputeOutput||e.rawOutputHeight!==void 0||e.outputMetadataHeight!==void 0?this._getOutputTotalHeight(c,h):this._layoutInfo.outputTotalHeight,f=o+n+s+r+l+g+u+p,v={width:t,editorHeight:o,editorMargin:n,metadataHeight:r,cellStatusHeight:s,metadataStatusHeight:l,outputTotalHeight:g,outputStatusHeight:u,bodyMargin:p,rawOutputHeight:c,outputMetadataHeight:h,totalHeight:f,layoutState:3},b=!1,S={};v.width!==this._layoutInfo.width&&(S.width=!0,b=!0),v.editorHeight!==this._layoutInfo.editorHeight&&(S.editorHeight=!0,b=!0),v.editorMargin!==this._layoutInfo.editorMargin&&(S.editorMargin=!0,b=!0),v.metadataHeight!==this._layoutInfo.metadataHeight&&(S.metadataHeight=!0,b=!0),v.cellStatusHeight!==this._layoutInfo.cellStatusHeight&&(S.cellStatusHeight=!0,b=!0),v.metadataStatusHeight!==this._layoutInfo.metadataStatusHeight&&(S.metadataStatusHeight=!0,b=!0),v.outputTotalHeight!==this._layoutInfo.outputTotalHeight&&(S.outputTotalHeight=!0,b=!0),v.outputStatusHeight!==this._layoutInfo.outputStatusHeight&&(S.outputStatusHeight=!0,b=!0),v.bodyMargin!==this._layoutInfo.bodyMargin&&(S.bodyMargin=!0,b=!0),v.outputMetadataHeight!==this._layoutInfo.outputMetadataHeight&&(S.outputMetadataHeight=!0,b=!0),v.totalHeight!==this._layoutInfo.totalHeight&&(S.totalHeight=!0,b=!0),b&&(this._layoutInfo=v,this._fireLayoutChangeEvent(S))}getHeight(e){if(this._layoutInfo.layoutState===0){let t=this.cellFoldingState===1?0:this.computeInputEditorHeight(e);return this._computeTotalHeight(t)}else return this._layoutInfo.totalHeight}_computeTotalHeight(e){return e+this._layoutInfo.editorMargin+this._layoutInfo.metadataHeight+this._layoutInfo.cellStatusHeight+this._layoutInfo.metadataStatusHeight+this._layoutInfo.outputTotalHeight+this._layoutInfo.outputStatusHeight+this._layoutInfo.outputMetadataHeight+this._layoutInfo.bodyMargin}computeInputEditorHeight(e){let t=Math.max(this.original?.textModel.textBuffer.getLineCount()??1,this.modified?.textModel.textBuffer.getLineCount()??1);return this.diffEditorHeightCalculator.computeHeightFromLines(t)}_getOutputTotalHeight(e,t){return this.outputFoldingState===1?0:this.renderOutput?this.isOutputEmpty()?24:this.getRichOutputTotalHeight()+t:e}_fireLayoutChangeEvent(e){this._layoutInfoEmitter.fire(e),this.editorEventDispatcher.emit([{type:2,source:this._layoutInfo}])}getComputedCellContainerWidth(e,t,o){return o?e.width-2*QD+(t?op.ENTIRE_DIFF_OVERVIEW_WIDTH:0)-2:(e.width-2*QD+(t?op.ENTIRE_DIFF_OVERVIEW_WIDTH:0))/2-18-2}getOutputEditorViewState(){return this._outputEditorViewState}saveOutputEditorViewState(e){this._outputEditorViewState=e}getMetadataEditorViewState(){return this._metadataEditorViewState}saveMetadataEditorViewState(e){this._metadataEditorViewState=e}getSourceEditorViewState(){return this._sourceEditorViewState}saveSpirceEditorViewState(e){this._sourceEditorViewState=e}},bx=class extends p1t{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,o,n,r,s,l,c,p,u,h);this.otherDocumentTextModel=t;this.type=r,this.cellFoldingState=this.modified.textModel.getValue()!==this.original.textModel.getValue()?0:1,this.metadataFoldingState=1,this.outputFoldingState=1,this.checkMetadataIfModified()&&(this.metadataFoldingState=0),this.checkIfOutputsModified()&&(this.outputFoldingState=0),this._register(this.original.onDidChangeOutputLayout(()=>{this._layout({recomputeOutput:!0})})),this._register(this.modified.onDidChangeOutputLayout(()=>{this._layout({recomputeOutput:!0})})),this._register(this.modified.textModel.onDidChangeContent(()=>{if(e.transientOptions.cellContentMetadata){let g=[...Object.keys(e.transientOptions.cellContentMetadata)],f=Object.assign({},this.modified.metadata),v=this.original.metadata;for(let b of g)Object.hasOwn(v,b)&&(f[b]=v[b]);this.modified.textModel.metadata=f}}))}get originalDocument(){return this.otherDocumentTextModel}get modifiedDocument(){return this.mainDocumentTextModel}checkIfInputModified(){return this.original.textModel.getTextBufferHash()===this.modified.textModel.getTextBufferHash()?!1:{reason:"Cell content has changed"}}checkIfOutputsModified(){if(this.mainDocumentTextModel.transientOptions.transientOutputs||this.ignoreOutputs)return!1;let e=YJo(this.original?.outputs??[],this.modified?.outputs??[]);return e===0?!1:{reason:e===1?"Output metadata has changed":void 0,kind:e}}checkMetadataIfModified(){return this.ignoreMetadata?!1:_r(wG(this.mainDocumentTextModel.transientOptions.transientCellMetadata,this.original?.metadata||{},this.original?.language))!==_r(wG(this.mainDocumentTextModel.transientOptions.transientCellMetadata,this.modified?.metadata??{},this.modified?.language))?{reason:void 0}:!1}updateOutputHeight(e,t,o){e===0?this.original.updateOutputHeight(t,o):this.modified.updateOutputHeight(t,o)}getOutputOffsetInContainer(e,t){return e===0?this.original.getOutputOffset(t):this.modified.getOutputOffset(t)}getOutputOffsetInCell(e,t){let o=this.getOutputOffsetInContainer(e,t);return this._layoutInfo.editorHeight+this._layoutInfo.editorMargin+this._layoutInfo.metadataHeight+this._layoutInfo.cellStatusHeight+this._layoutInfo.metadataStatusHeight+this._layoutInfo.outputStatusHeight+this._layoutInfo.bodyMargin/2+o}isOutputEmpty(){return this.mainDocumentTextModel.transientOptions.transientOutputs?!0:this.checkIfOutputsModified()?!1:(this.original?.outputs||[]).length===0}getRichOutputTotalHeight(){return Math.max(this.original.getOutputTotalHeight(),this.modified.getOutputTotalHeight())}getNestedCellViewModel(e){return e===0?this.original:this.modified}getCellByUri(e){return e.toString()===this.original.uri.toString()?this.original:this.modified}computeInputEditorHeight(e){return this.type==="modified"&&typeof this.editorHeightWithUnchangedLinesCollapsed=="number"&&this.checkIfInputModified()?this.editorHeightWithUnchangedLinesCollapsed:super.computeInputEditorHeight(e)}async computeModifiedInputEditorHeight(){this.checkIfInputModified()&&(this.editorHeightWithUnchangedLinesCollapsed=this._layoutInfo.editorHeight=await this.diffEditorHeightCalculator.diffAndComputeHeight(this.original.uri,this.modified.uri))}async computeModifiedMetadataEditorHeight(){if(this.checkMetadataIfModified()){let e=Zo.generateCellPropertyUri(this.originalDocument.uri,this.original.handle,Q.vscodeNotebookCellMetadata),t=Zo.generateCellPropertyUri(this.modifiedDocument.uri,this.modified.handle,Q.vscodeNotebookCellMetadata);this._layoutInfo.metadataHeight=await this.diffEditorHeightCalculator.diffAndComputeHeight(e,t)}}async computeEditorHeights(){this.type!=="unchanged"&&await Promise.all([this.computeModifiedInputEditorHeight(),this.computeModifiedMetadataEditorHeight()])}},nit=class extends p1t{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,o,n,r,s,l,c,h,u,p);this.otherDocumentTextModel=t;this.type=r,this._register(this.cellViewModel.onDidChangeOutputLayout(()=>{this._layout({recomputeOutput:!0})}))}get cellViewModel(){return this.type==="insert"?this.modified:this.original}get originalDocument(){return this.type==="insert"?this.otherDocumentTextModel:this.mainDocumentTextModel}get modifiedDocument(){return this.type==="insert"?this.mainDocumentTextModel:this.otherDocumentTextModel}checkIfInputModified(){return{reason:"Cell content has changed"}}getNestedCellViewModel(e){return this.type==="insert"?this.modified:this.original}checkIfOutputsModified(){return!1}checkMetadataIfModified(){return!1}updateOutputHeight(e,t,o){this.cellViewModel?.updateOutputHeight(t,o)}getOutputOffsetInContainer(e,t){return this.cellViewModel.getOutputOffset(t)}getOutputOffsetInCell(e,t){let o=this.cellViewModel.getOutputOffset(t);return this._layoutInfo.editorHeight+this._layoutInfo.editorMargin+this._layoutInfo.metadataHeight+this._layoutInfo.cellStatusHeight+this._layoutInfo.metadataStatusHeight+this._layoutInfo.outputStatusHeight+this._layoutInfo.bodyMargin/2+o}isOutputEmpty(){return this.mainDocumentTextModel.transientOptions.transientOutputs?!0:(this.original?.outputs||this.modified?.outputs||[]).length===0}getRichOutputTotalHeight(){return this.cellViewModel?.getOutputTotalHeight()??0}getCellByUri(e){return this.cellViewModel}};function ogo(a,i){if(_r(a.metadata)===_r(i.metadata))return 2;for(let e=0;e<a.outputs.length;e++){let t=a.outputs[e],o=i.outputs[e];if(t.mime!==o.mime||t.data.buffer.length!==o.data.buffer.length)return 2;for(let n=0;n<t.data.buffer.length;n++)if(t.data.buffer[n]!==o.data.buffer[n])return 2}return 1}function YJo(a,i){if(a.length!==i.length)return 2;let e=a.length;for(let t=0;t<e;t++){let o=a[t],n=i[t];if(_r(o.metadata)!==_r(n.metadata))return 1;if(o.outputs.length!==n.outputs.length)return 2;for(let r=0;r<o.outputs.length;r++){let s=o.outputs[r],l=n.outputs[r];if(s.mime!==l.mime||s.data.buffer.length!==l.data.buffer.length)return 2;for(let c=0;c<s.data.buffer.length;c++)if(s.data.buffer[c]!==l.data.buffer[c])return 2}}return 0}function sTi(a){if(!a.length)return null;let e=a[0].mime;return a.find(o=>o.mime!==e)?null:a.map(o=>o.data.toString()).join("")}function Ete(a){if(a.length===1){let i=sTi(a[0].outputs);if(i)return i}return JSON.stringify(a.map(i=>({metadata:i.metadata,outputItems:i.outputs.map(e=>({mimeType:e.mime,data:e.data.toString()}))})),void 0,"	")}var aTi=class extends x{constructor(e,t,o,n,r,s,l,c,u){super();this._notebookEditor=e;this._notebookTextModel=t;this._notebookService=o;this._quickInputService=n;this._diffElementViewModel=r;this._diffSide=s;this._nestedCell=l;this._outputContainer=c;this.output=u;this.resizeListener=this._register(new N)}render(e,t){let o=document.createElement("div"),n,[r,s]=this.output.resolveMimeTypes(this._notebookTextModel,void 0),l=this.output.pickedMimeType||r[s];if(r.length>1){o.style.position="relative";let u=_(".multi-mimetype-output");u.classList.add(...q.asClassNameArray(mUt)),u.tabIndex=0,u.title=d(12554,null,r.map(p=>p.mimeType).join(", ")),o.appendChild(u),this.resizeListener.add(Jo(u,"mousedown",async p=>{p.leftButton&&(p.preventDefault(),p.stopPropagation(),await this.pickActiveMimeTypeRenderer(this._notebookTextModel,this.output))})),this.resizeListener.add(j(u,re.KEY_DOWN,async p=>{let h=new gi(p);(h.equals(3)||h.equals(10))&&(p.preventDefault(),p.stopPropagation(),await this.pickActiveMimeTypeRenderer(this._notebookTextModel,this.output))}))}let c=_(".output-inner-container");if(M(o,c),r.length!==0){let u=this._notebookService.getRendererInfo(l.rendererId);n=u?{type:1,renderer:u,source:this.output,mimeType:l.mimeType}:this._renderMissingRenderer(this.output,l.mimeType),this.output.pickedMimeType=l}this.domNode=o,this.renderResult=n,n&&(t?this._outputContainer.insertBefore(o,t):this._outputContainer.appendChild(o),this._notebookEditor.createOutput(this._diffElementViewModel,this._nestedCell,n,()=>this.getOutputOffsetInCell(e),this._diffElementViewModel instanceof bx?this._diffSide:this._diffElementViewModel.type==="insert"?1:0))}_renderMissingRenderer(e,t){if(!e.model.outputs.length)return this._renderMessage(e,d(12553,null));if(!t){let n=e.model.outputs.map(r=>r.mime).join(", ");return this._renderMessage(e,d(12555,null,n))}return this._renderSearchForMimetype(e,t)}_renderSearchForMimetype(e,t){let o=`@tag:notebookRenderer ${t}`,n=_("p",void 0,`No renderer could be found for mimetype "${t}", but one might be available on the Marketplace.`),r=_("a",{href:`command:workbench.extensions.search?%22${o}%22`,class:"monaco-button monaco-text-button",tabindex:0,role:"button",style:"padding: 8px; text-decoration: none; color: rgb(255, 255, 255); background-color: rgb(14, 99, 156); max-width: 200px;"},"Search Marketplace");return{type:0,source:e,htmlContent:n.outerHTML+r.outerHTML}}_renderMessage(e,t){let o=_("p",void 0,t);return{type:0,source:e,htmlContent:o.outerHTML}}async pickActiveMimeTypeRenderer(e,t){let[o,n]=t.resolveMimeTypes(e,void 0),r=o.filter(u=>u.isTrusted).map((u,p)=>({label:u.mimeType,id:u.mimeType,index:p,picked:p===n,detail:this.generateRendererInfo(u.rendererId),description:p===n?d(12552,null):void 0})),s=new N,l=s.add(this._quickInputService.createQuickPick());l.items=r,l.activeItems=r.filter(u=>!!u.picked),l.placeholder=r.length!==o.length?d(12557,null):d(12556,null);let c=await new Promise(u=>{s.add(l.onDidAccept(()=>{u(l.selectedItems.length===1?l.selectedItems[0].index:void 0),s.dispose()})),l.show()});if(c!==void 0&&c!==n){let u=this._nestedCell.outputsViewModels.indexOf(t),p=this.domNode.nextElementSibling;this.resizeListener.clear();let h=this.domNode;h&&(h.remove(),this._notebookEditor.removeInset(this._diffElementViewModel,this._nestedCell,t,this._diffSide)),t.pickedMimeType=o[c],this.render(u,p)}}generateRendererInfo(e){let t=this._notebookService.getRendererInfo(e);return t?`${t.displayName!==""?t.displayName:t.id} (${t.extensionId.value})`:d(12551,null)}getCellOutputCurrentIndex(){return this._diffElementViewModel.getNestedCellViewModel(this._diffSide).outputs.indexOf(this.output.model)}updateHeight(e,t){this._diffElementViewModel.updateOutputHeight(this._diffSide,e,t)}getOutputOffsetInContainer(e){return this._diffElementViewModel.getOutputOffsetInContainer(this._diffSide,e)}getOutputOffsetInCell(e){return this._diffElementViewModel.getOutputOffsetInCell(this._diffSide,e)}},T8=class extends x{constructor(e,t,o,n,r,s,l,c){super();this._editor=e;this._notebookTextModel=t;this._diffElementViewModel=o;this._nestedCellViewModel=n;this._diffSide=r;this._outputContainer=s;this._notebookService=l;this._quickInputService=c;this._outputEntries=new Map;this._register(this._diffElementViewModel.onDidLayoutChange(()=>{this._outputEntries.forEach((u,p)=>{let h=n.outputs.indexOf(p.model);if(h>=0){let g=this._diffElementViewModel.getOutputOffsetInContainer(this._diffSide,h);u.domNode.style.top=`${g}px`}})})),this._register(this._nestedCellViewModel.textModel.onDidChangeOutputs(u=>{this._updateOutputs(u)}))}_updateOutputs(e){let t=[];this._outputEntries.forEach((r,s)=>{this._nestedCellViewModel.outputsViewModels.indexOf(s)<0&&(t.push(s),r.domNode.remove(),this._editor.removeInset(this._diffElementViewModel,this._nestedCellViewModel,s,this._diffSide))}),t.forEach(r=>{this._outputEntries.get(r)?.dispose(),this._outputEntries.delete(r)});let o;this._nestedCellViewModel.outputsViewModels.reverse().forEach(r=>{if(this._outputEntries.has(r)){o=this._outputEntries.get(r).domNode;return}let s=this._nestedCellViewModel.outputsViewModels.indexOf(r);this._renderOutput(r,s,o),o=this._outputEntries.get(r)?.domNode})}render(){for(let e=0;e<this._nestedCellViewModel.outputsViewModels.length;e++){let t=this._nestedCellViewModel.outputsViewModels[e];this._renderOutput(t,e,void 0)}}showOutputs(){for(let e=0;e<this._nestedCellViewModel.outputsViewModels.length;e++){let t=this._nestedCellViewModel.outputsViewModels[e];this._editor.showInset(this._diffElementViewModel,t.cellViewModel,t,this._diffSide)}}hideOutputs(){this._outputEntries.forEach((e,t)=>{this._editor.hideInset(this._diffElementViewModel,this._nestedCellViewModel,t)})}_renderOutput(e,t,o){this._outputEntries.has(e)||this._outputEntries.set(e,new aTi(this._editor,this._notebookTextModel,this._notebookService,this._quickInputService,this._diffElementViewModel,this._diffSide,this._nestedCellViewModel,this._outputContainer,e)),this._outputEntries.get(e).render(t,o)}};T8=I([m(6,bn),m(7,Ue)],T8);function m1t(a){return XJo(a)}function XJo(a){let i=new N,e=i.add(new E),t={options:{enabled:a.getValue("diffEditor.hideUnchangedRegions.enabled"),minimumLineCount:a.getValue("diffEditor.hideUnchangedRegions.minimumLineCount"),contextLineCount:a.getValue("diffEditor.hideUnchangedRegions.contextLineCount"),revealLineCount:a.getValue("diffEditor.hideUnchangedRegions.revealLineCount")},onDidChangeEnablement:e.event.bind(e),dispose:()=>i.dispose()};return i.add(a.onDidChangeConfiguration(o=>{o.affectsConfiguration("diffEditor.hideUnchangedRegions.minimumLineCount")&&(t.options.minimumLineCount=a.getValue("diffEditor.hideUnchangedRegions.minimumLineCount")),o.affectsConfiguration("diffEditor.hideUnchangedRegions.contextLineCount")&&(t.options.contextLineCount=a.getValue("diffEditor.hideUnchangedRegions.contextLineCount")),o.affectsConfiguration("diffEditor.hideUnchangedRegions.revealLineCount")&&(t.options.revealLineCount=a.getValue("diffEditor.hideUnchangedRegions.revealLineCount")),o.affectsConfiguration("diffEditor.hideUnchangedRegions.enabled")&&(t.options.enabled=a.getValue("diffEditor.hideUnchangedRegions.enabled"),e.fire(t.options.enabled))})),t}function _8(){return{isSimpleWidget:!1,contributions:Ba.getSomeEditorContributions([yy.ID,xy,og.ID,nc.ID,vs.ID,Cy.ID])}}var h1t=class extends x{constructor(i,e){super(),e.body.classList.remove("left","right","full");let t=i.hiddenCells.length===1?d(12547,null,i.hiddenCells.length):d(12548,null,i.hiddenCells.length);e.placeholder.innerText=t,this._register(j(e.placeholder,"dblclick",o=>{o.button===0&&(o.preventDefault(),i.showHiddenCells())})),this._register(e.marginOverlay.onAction(()=>i.showHiddenCells())),e.marginOverlay.show()}},zH=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.cell=e;this.propertyHeaderContainer=t;this.notebookEditor=o;this.accessor=n;this.contextMenuService=r;this.keybindingService=s;this.commandService=l;this.notificationService=c;this.menuService=u;this.contextKeyService=p;this.themeService=h;this.telemetryService=g;this.accessibilityService=f}buildHeader(){this._foldingIndicator=M(this.propertyHeaderContainer,_(".property-folding-indicator")),this._foldingIndicator.classList.add(this.accessor.prefix);let e=M(this.propertyHeaderContainer,_("div.property-status"));this._statusSpan=M(e,_("span")),this._description=M(e,_("span.property-description"));let t=M(this.propertyHeaderContainer,_("div.property-toolbar"));this._toolbar=this._register(new ol(t,{actionViewItemProvider:(n,r)=>{if(n instanceof Lo)return new xM(n,{hoverDelegate:r.hoverDelegate},this.keybindingService,this.notificationService,this.contextKeyService,this.themeService,this.contextMenuService,this.accessibilityService)}},this.menuService,this.contextKeyService,this.contextMenuService,this.keybindingService,this.commandService,this.telemetryService)),this._toolbar.context=this.cell;let o=this.contextKeyService.createScoped(t);this._register(o),this._propertyChanged=_he.bindTo(o),this._propertyExpanded=l1t.bindTo(o),this._menu=this._register(this.menuService.createMenu(this.accessor.menuId,o)),this._register(this._menu.onDidChange(()=>this.updateMenu())),this._register(this.notebookEditor.onMouseUp(n=>{if(!n.event.target||n.target!==this.cell)return;let r=n.event.target;if(r===this.propertyHeaderContainer||r===this._foldingIndicator||this._foldingIndicator.contains(r)||r===e||e.contains(r)){let s=this.accessor.getFoldingState();this.accessor.updateFoldingState(s===0?1:0),this._updateFoldingIcon(),this.accessor.updateInfoRendering(this.cell.renderOutput)}})),this.refresh(),this.accessor.updateInfoRendering(this.cell.renderOutput)}refresh(){this.updateMenu(),this._updateFoldingIcon();let e=this.accessor.checkIfModified();this._propertyChanged&&this._propertyChanged.set(!!e),e?(this._statusSpan.textContent=this.accessor.changedLabel,this._statusSpan.style.fontWeight="bold",e.reason&&(this._description.textContent=e.reason),this.propertyHeaderContainer.classList.add("modified")):(this._statusSpan.textContent=this.accessor.unChangedLabel,this._statusSpan.style.fontWeight="normal",this._description.textContent="",this.propertyHeaderContainer.classList.remove("modified"))}updateMenu(){if(this.accessor.checkIfModified()){let t=jm(this._menu.getActions({shouldForwardArgs:!0}));this._toolbar.setActions(t)}else this._toolbar.setActions([])}_updateFoldingIcon(){this.accessor.getFoldingState()===1?(vi(this._foldingIndicator,Sn(uUt)),this._propertyExpanded?.set(!1)):(vi(this._foldingIndicator,Sn(pUt)),this._propertyExpanded?.set(!0))}};zH=I([m(4,Xe),m(5,_e),m(6,ge),m(7,Ne),m(8,Kt),m(9,X),m(10,Le),m(11,Te),m(12,Oi)],zH);var fAe=class extends x{constructor(e,t,o,n,r,s,l,c,u){super();this.notebookEditor=e;this.viewModel=t;this.templateData=o;this.instantiationService=n;this.textModelService=r;this.menuService=s;this.contextKeyService=l;this.textConfigurationService=c;this.configurationService=u;this._editor=o.sourceEditor,this._cellHeaderContainer=this.templateData.cellHeaderContainer,this._editorContainer=this.templateData.editorContainer,this._diffEditorContainer=this.templateData.diffEditorContainer,this._editorViewStateChanged=!1,this._register(t.onDidLayoutChange(p=>{this.layout(p),this.updateBorders()})),this.buildBody(),this.updateBorders()}buildBody(){let e=this.templateData.body;e.classList.remove("full"),e.classList.add("full"),this.updateSourceEditor(),this.viewModel instanceof gAe&&this._register(this.viewModel.modifiedMetadata.onDidChange(t=>{this._cellHeader.refresh()}))}layoutNotebookCell(){this.notebookEditor.layoutNotebookCell(this.viewModel,this.viewModel.layoutInfo.totalHeight)}updateBorders(){this.templateData.leftBorder.style.height=`${this.viewModel.layoutInfo.totalHeight-32}px`,this.templateData.rightBorder.style.height=`${this.viewModel.layoutInfo.totalHeight-32}px`,this.templateData.bottomBorder.style.top=`${this.viewModel.layoutInfo.totalHeight-32}px`}updateSourceEditor(){this._cellHeaderContainer.style.display="flex",this._cellHeaderContainer.innerText="",this._editorContainer.classList.add("diff");let e=()=>{if(this.viewModel.cellFoldingState===1){this._editorContainer.style.display="none",this.viewModel.editorHeight=0;return}let s=this.notebookEditor.getLayoutInfo().fontInfo.lineHeight||17,l=this.viewModel.layoutInfo.editorHeight!==0?this.viewModel.layoutInfo.editorHeight:this.viewModel.computeInputEditorHeight(s);this._editorContainer.style.height=`${l}px`,this._editorContainer.style.display="block";let c=this._editor.getContentHeight();return c>=0&&(this.viewModel.editorHeight=c),l},t=()=>{let s=e();if(!s)return;let l=this.viewModel.modifiedMetadata.textBuffer.getLineCount(),c={padding:nN(l)},u=this._register(m1t(this.configurationService));u.options.enabled&&(c.hideUnchangedRegions=u.options),this._editor.updateOptions(c),this._register(u.onDidChangeEnablement(()=>{c.hideUnchangedRegions=u.options,this._editor.updateOptions(c)})),this._editor.layout({width:this.notebookEditor.getLayoutInfo().width-2*QD,height:s}),this._register(this._editor.onDidContentSizeChange(p=>{this.viewModel.cellFoldingState===0&&p.contentHeightChanged&&this.viewModel.layoutInfo.editorHeight!==p.contentHeight&&(this.viewModel.editorHeight=p.contentHeight)})),this._initializeSourceDiffEditor()};this._cellHeader=this._register(this.instantiationService.createInstance(zH,this.viewModel,this._cellHeaderContainer,this.notebookEditor,{updateInfoRendering:()=>t(),checkIfModified:()=>this.viewModel.originalMetadata.getHash()!==this.viewModel.modifiedMetadata.getHash()?{reason:void 0}:!1,getFoldingState:()=>this.viewModel.cellFoldingState,updateFoldingState:s=>this.viewModel.cellFoldingState=s,unChangedLabel:"Notebook Metadata",changedLabel:"Notebook Metadata changed",prefix:"metadata",menuId:D.NotebookDiffDocumentMetadata})),this._cellHeader.buildHeader(),t();let o=this.contextKeyService.createScoped(this.templateData.inputToolbarContainer);this._register(o);let n=eit.bindTo(o);n.set(this.viewModel.originalMetadata.getHash()!==this.viewModel.modifiedMetadata.getHash()),this._toolbar=this.templateData.toolbar,this._toolbar.context=this.viewModel;let r=()=>{let s=this.viewModel.originalMetadata.getHash()!==this.viewModel.modifiedMetadata.getHash();if(n.set(s),s){let l=this.menuService.getMenuActions(D.NotebookDiffDocumentMetadata,o,{shouldForwardArgs:!0}),c=jm(l);this._toolbar.setActions(c)}else this._toolbar.setActions([])};this._register(this.viewModel.modifiedMetadata.onDidChange(()=>{r()})),r()}async _initializeSourceDiffEditor(){let[e,t]=await Promise.all([this.textModelService.createModelReference(this.viewModel.originalMetadata.uri),this.textModelService.createModelReference(this.viewModel.modifiedMetadata.uri)]);if(this._store.isDisposed){e.dispose(),t.dispose();return}this._register(e),this._register(t);let o=this._register(this._editor.createViewModel({original:e.object.textEditorModel,modified:t.object.textEditorModel}));await o.waitForDiff(),this._editor.setModel(o);let n=()=>{this._editorViewStateChanged=!0},r=c=>{(c.scrollTopChanged||c.scrollLeftChanged)&&(this._editorViewStateChanged=!0)};this.updateEditorOptionsForWhitespace(),this._register(this._editor.getOriginalEditor().onDidChangeCursorSelection(n)),this._register(this._editor.getOriginalEditor().onDidScrollChange(r)),this._register(this._editor.getModifiedEditor().onDidChangeCursorSelection(n)),this._register(this._editor.getModifiedEditor().onDidScrollChange(r));let s=this.viewModel.getSourceEditorViewState();s&&this._editor.restoreViewState(s);let l=this._editor.getContentHeight();this.viewModel.editorHeight=l}updateEditorOptionsForWhitespace(){let e=this._editor,t=e.getModel()?.modified.uri||e.getModel()?.original.uri;if(!t)return;let o=this.textConfigurationService.getValue(t,"diffEditor.ignoreTrimWhitespace");e.updateOptions({ignoreTrimWhitespace:o}),this._register(this.textConfigurationService.onDidChangeConfiguration(n=>{if(n.affectsConfiguration(t,"diffEditor")&&n.affectedKeys.has("diffEditor.ignoreTrimWhitespace")){let r=this.textConfigurationService.getValue(t,"diffEditor.ignoreTrimWhitespace");e.updateOptions({ignoreTrimWhitespace:r})}}))}layout(e){Wr(Re(this._diffEditorContainer),()=>{e.editorHeight&&(this._editorContainer.style.height=`${this.viewModel.layoutInfo.editorHeight}px`,this._editor.layout({width:this._editor.getViewWidth(),height:this.viewModel.layoutInfo.editorHeight})),e.outerWidth&&(this._editorContainer.style.height=`${this.viewModel.layoutInfo.editorHeight}px`,this._editor.layout()),this.layoutNotebookCell()})}dispose(){this._editor.setModel(null),this._editorViewStateChanged&&this.viewModel.saveSpirceEditorViewState(this._editor.saveViewState()),super.dispose()}};fAe=I([m(3,F),m(4,Bt),m(5,Kt),m(6,X),m(7,Fn),m(8,B)],fAe);var g1t=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super();this.notebookEditor=e;this.cell=t;this.templateData=o;this.style=n;this.instantiationService=r;this.languageService=s;this.modelService=l;this.textModelService=c;this.contextMenuService=u;this.keybindingService=p;this.notificationService=h;this.menuService=g;this.contextKeyService=f;this.configurationService=v;this.textConfigurationService=b;this._metadataLocalDisposable=this._register(new N);this._outputLocalDisposable=this._register(new N);this._ignoreMetadata=!1;this._ignoreOutputs=!1;this._isDisposed=!1,this._metadataEditorDisposeStore=this._register(new N),this._outputEditorDisposeStore=this._register(new N),this._register(t.onDidLayoutChange(S=>{this.layout(S)})),this._register(t.onDidLayoutChange(S=>this.updateBorders())),this.init(),this.buildBody(),this._register(t.onDidStateChange(()=>{this.updateOutputRendering(this.cell.renderOutput)}))}buildBody(){let e=this.templateData.body;switch(this._diffEditorContainer=this.templateData.diffEditorContainer,e.classList.remove("left","right","full"),this.style){case"left":e.classList.add("left");break;case"right":e.classList.add("right");break;default:e.classList.add("full");break}this.styleContainer(this._diffEditorContainer),this.updateSourceEditor(),this.cell.modified&&this._register(this.cell.modified.textModel.onDidChangeContent(()=>this._cellHeader.refresh())),this._ignoreMetadata=this.configurationService.getValue("notebook.diff.ignoreMetadata"),this._ignoreMetadata?this._disposeMetadata():this._buildMetadata(),this._ignoreOutputs=this.configurationService.getValue("notebook.diff.ignoreOutputs")||!!this.notebookEditor.textModel?.transientOptions.transientOutputs,this._ignoreOutputs?this._disposeOutput():this._buildOutput(),this._register(this.configurationService.onDidChangeConfiguration(t=>{let o=!1,n=!1;if(t.affectsConfiguration("notebook.diff.ignoreMetadata")){let r=this.configurationService.getValue("notebook.diff.ignoreMetadata");r!==void 0&&this._ignoreMetadata!==r&&(this._ignoreMetadata=r,this._metadataLocalDisposable.clear(),this.configurationService.getValue("notebook.diff.ignoreMetadata")?this._disposeMetadata():(this.cell.metadataStatusHeight=25,this._buildMetadata(),this.updateMetadataRendering(),o=!0))}if(t.affectsConfiguration("notebook.diff.ignoreOutputs")){let r=this.configurationService.getValue("notebook.diff.ignoreOutputs");r!==void 0&&this._ignoreOutputs!==(r||this.notebookEditor.textModel?.transientOptions.transientOutputs)&&(this._ignoreOutputs=r||!!this.notebookEditor.textModel?.transientOptions.transientOutputs,this._outputLocalDisposable.clear(),this._ignoreOutputs?(this._disposeOutput(),this.cell.layoutChange()):(this.cell.outputStatusHeight=25,this._buildOutput(),n=!0))}(o||n)&&this.layout({metadataHeight:o,outputTotalHeight:n})}))}updateMetadataRendering(){this.cell.metadataFoldingState===0?(this._metadataInfoContainer.style.display="block",!this._metadataEditorContainer||!this._metadataEditor?(this._metadataEditorContainer=M(this._metadataInfoContainer,_(".metadata-editor-container")),this._buildMetadataEditor()):this.cell.metadataHeight=this._metadataEditor.getContentHeight()):(this._metadataInfoContainer.style.display="none",this.cell.metadataHeight=0)}updateOutputRendering(e){this.cell.outputFoldingState===0?(this._outputInfoContainer.style.display="block",e?(this._hideOutputsRaw(),this._buildOutputRendererContainer(),this._showOutputsRenderer(),this._showOutputsEmptyView()):(this._hideOutputsRenderer(),this._buildOutputRawContainer(),this._showOutputsRaw())):(this._outputInfoContainer.style.display="none",this._hideOutputsRaw(),this._hideOutputsRenderer(),this._hideOutputsEmptyView())}_buildOutputRawContainer(){this._outputEditorContainer||(this._outputEditorContainer=M(this._outputInfoContainer,_(".output-editor-container")),this._buildOutputEditor())}_showOutputsRaw(){this._outputEditorContainer&&(this._outputEditorContainer.style.display="block",this.cell.rawOutputHeight=this._outputEditor.getContentHeight())}_showOutputsEmptyView(){this.cell.layoutChange()}_hideOutputsRaw(){this._outputEditorContainer&&(this._outputEditorContainer.style.display="none",this.cell.rawOutputHeight=0)}_hideOutputsEmptyView(){this.cell.layoutChange()}_applySanitizedMetadataChanges(e,t){let o={};try{let n=JSON.parse(t),r=new Set([...Object.keys(n)]);for(let l of r)switch(l){case"inputCollapsed":case"outputCollapsed":typeof n[l]=="boolean"?o[l]=n[l]:o[l]=e[l];break;default:o[l]=n[l];break}let s=this.notebookEditor.textModel.cells.indexOf(this.cell.modified.textModel);if(s<0)return;this.notebookEditor.textModel.applyEdits([{editType:3,index:s,metadata:o}],!0,void 0,()=>{},void 0,!0)}catch{}}async _buildMetadataEditor(){if(this._metadataEditorDisposeStore.clear(),this.cell instanceof bx){this._metadataEditor=this.instantiationService.createInstance(op,this._metadataEditorContainer,{...mAe,overflowWidgetsDomNode:this.notebookEditor.getOverflowContainerDomNode(),readOnly:!1,originalEditable:!1,ignoreTrimWhitespace:!1,automaticLayout:!1,dimension:{height:this.cell.layoutInfo.metadataHeight,width:this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(),!0,!0)}},{originalEditor:_8(),modifiedEditor:_8()});let e=this._register(m1t(this.configurationService));e.options.enabled&&this._metadataEditor.updateOptions({hideUnchangedRegions:e.options}),this._metadataEditorDisposeStore.add(e.onDidChangeEnablement(()=>{this._metadataEditor&&this._metadataEditor.updateOptions({hideUnchangedRegions:e.options})})),this.layout({metadataHeight:!0}),this._metadataEditorDisposeStore.add(this._metadataEditor),this._metadataEditorContainer?.classList.add("diff");let[t,o]=await Promise.all([this.textModelService.createModelReference(Zo.generateCellPropertyUri(this.cell.originalDocument.uri,this.cell.original.handle,Q.vscodeNotebookCellMetadata)),this.textModelService.createModelReference(Zo.generateCellPropertyUri(this.cell.modifiedDocument.uri,this.cell.modified.handle,Q.vscodeNotebookCellMetadata))]);if(this._isDisposed){t.dispose(),o.dispose();return}this._metadataEditorDisposeStore.add(t),this._metadataEditorDisposeStore.add(o);let n=this._metadataEditor.createViewModel({original:t.object.textEditorModel,modified:o.object.textEditorModel});if(this._metadataEditor.setModel(n),await n.waitForDiff(),this._isDisposed)return;this.cell.metadataHeight=this._metadataEditor.getContentHeight(),this._metadataEditorDisposeStore.add(this._metadataEditor.onDidContentSizeChange(s=>{s.contentHeightChanged&&this.cell.metadataFoldingState===0&&(this.cell.metadataHeight=s.contentHeight)}));let r=!1;this._metadataEditorDisposeStore.add(o.object.textEditorModel.onDidChangeContent(()=>{r=!0;let s=o.object.textEditorModel.getValue();this._applySanitizedMetadataChanges(this.cell.modified.metadata,s),this._metadataHeader.refresh(),r=!1})),this._metadataEditorDisposeStore.add(this.cell.modified.textModel.onDidChangeMetadata(()=>{if(r)return;let s=wG(this.notebookEditor.textModel?.transientOptions.transientCellMetadata,this.cell.modified?.metadata||{},this.cell.modified?.language,!0);o.object.textEditorModel.setValue(s)}));return}else{this._metadataEditor=this.instantiationService.createInstance(Xr,this._metadataEditorContainer,{...pAe,dimension:{width:this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(),!1,!0),height:this.cell.layoutInfo.metadataHeight},overflowWidgetsDomNode:this.notebookEditor.getOverflowContainerDomNode(),readOnly:!1,allowVariableLineHeights:!1},{}),this.layout({metadataHeight:!0}),this._metadataEditorDisposeStore.add(this._metadataEditor);let e=this.languageService.createById("jsonc"),t=wG(this.notebookEditor.textModel?.transientOptions.transientCellMetadata,this.cell.type==="insert"?this.cell.modified.metadata||{}:this.cell.original.metadata||{},void 0,!0),o=this.cell.type==="insert"?this.cell.modified.uri:this.cell.original.uri,n=this.cell.type==="insert"?this.cell.modified.handle:this.cell.original.handle,r=Zo.generateCellPropertyUri(o,n,Q.vscodeNotebookCellMetadata),s=this.modelService.createModel(t,e,r,!1);this._metadataEditor.setModel(s),this._metadataEditorDisposeStore.add(s),this.cell.metadataHeight=this._metadataEditor.getContentHeight(),this._metadataEditorDisposeStore.add(this._metadataEditor.onDidContentSizeChange(l=>{l.contentHeightChanged&&this.cell.metadataFoldingState===0&&(this.cell.metadataHeight=l.contentHeight)}))}}_buildOutputEditor(){if(this._outputEditorDisposeStore.clear(),(this.cell.type==="modified"||this.cell.type==="unchanged")&&!this.notebookEditor.textModel.transientOptions.transientOutputs){let n=Ete(this.cell.original?.outputs||[]),r=Ete(this.cell.modified?.outputs||[]);if(n!==r){let s=this.languageService.createById("json"),l=this.modelService.createModel(n,s,void 0,!0),c=this.modelService.createModel(r,s,void 0,!0);this._outputEditorDisposeStore.add(l),this._outputEditorDisposeStore.add(c);let u=this.notebookEditor.getLayoutInfo().fontInfo.lineHeight||17,p=Math.max(l.getLineCount(),c.getLineCount());this._outputEditor=this.instantiationService.createInstance(op,this._outputEditorContainer,{...mAe,overflowWidgetsDomNode:this.notebookEditor.getOverflowContainerDomNode(),readOnly:!0,ignoreTrimWhitespace:!1,automaticLayout:!1,dimension:{height:Math.min(rit,this.cell.layoutInfo.rawOutputHeight||u*p),width:this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(),!1,!0)},accessibilityVerbose:this.configurationService.getValue("accessibility.verbosity.diffEditor")??!1},{originalEditor:_8(),modifiedEditor:_8()}),this._outputEditorDisposeStore.add(this._outputEditor),this._outputEditorContainer?.classList.add("diff"),this._outputEditor.setModel({original:l,modified:c}),this._outputEditor.restoreViewState(this.cell.getOutputEditorViewState()),this.cell.rawOutputHeight=this._outputEditor.getContentHeight(),this._outputEditorDisposeStore.add(this._outputEditor.onDidContentSizeChange(h=>{h.contentHeightChanged&&this.cell.outputFoldingState===0&&(this.cell.rawOutputHeight=h.contentHeight)})),this._outputEditorDisposeStore.add(this.cell.modified.textModel.onDidChangeOutputs(()=>{let h=Ete(this.cell.modified?.outputs||[]);c.setValue(h),this._outputHeader.refresh()}));return}}this._outputEditor=this.instantiationService.createInstance(Xr,this._outputEditorContainer,{...pAe,dimension:{width:Math.min(rit,this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(),!1,this.cell.type==="unchanged"||this.cell.type==="modified")-32),height:this.cell.layoutInfo.rawOutputHeight},overflowWidgetsDomNode:this.notebookEditor.getOverflowContainerDomNode(),allowVariableLineHeights:!1},{}),this._outputEditorDisposeStore.add(this._outputEditor);let e=this.languageService.createById("json"),t=Ete(this.notebookEditor.textModel.transientOptions.transientOutputs?[]:this.cell.type==="insert"?this.cell.modified?.outputs||[]:this.cell.original?.outputs||[]),o=this.modelService.createModel(t,e,void 0,!0);this._outputEditorDisposeStore.add(o),this._outputEditor.setModel(o),this._outputEditor.restoreViewState(this.cell.getOutputEditorViewState()),this.cell.rawOutputHeight=this._outputEditor.getContentHeight(),this._outputEditorDisposeStore.add(this._outputEditor.onDidContentSizeChange(n=>{n.contentHeightChanged&&this.cell.outputFoldingState===0&&(this.cell.rawOutputHeight=n.contentHeight)}))}layoutNotebookCell(){this.notebookEditor.layoutNotebookCell(this.cell,this.cell.layoutInfo.totalHeight)}updateBorders(){this.templateData.leftBorder.style.height=`${this.cell.layoutInfo.totalHeight-32}px`,this.templateData.rightBorder.style.height=`${this.cell.layoutInfo.totalHeight-32}px`,this.templateData.bottomBorder.style.top=`${this.cell.layoutInfo.totalHeight-32}px`}dispose(){this._outputEditor&&this.cell.saveOutputEditorViewState(this._outputEditor.saveViewState()),this._metadataEditor&&this.cell.saveMetadataEditorViewState(this._metadataEditor.saveViewState()),this._metadataEditorDisposeStore.dispose(),this._outputEditorDisposeStore.dispose(),this._isDisposed=!0,super.dispose()}},f1t=class extends g1t{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v){super(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v),this.cell=e,this.templateData=t,this.updateBorders()}init(){this._diagonalFill=this.templateData.diagonalFill}buildBody(){let i=this.templateData.body;switch(this._diffEditorContainer=this.templateData.diffEditorContainer,i.classList.remove("left","right","full"),this.style){case"left":i.classList.add("left");break;case"right":i.classList.add("right");break;default:i.classList.add("full");break}this.styleContainer(this._diffEditorContainer),this.updateSourceEditor(),this.configurationService.getValue("notebook.diff.ignoreMetadata")?this._disposeMetadata():this._buildMetadata(),this.configurationService.getValue("notebook.diff.ignoreOutputs")||this.notebookEditor.textModel?.transientOptions.transientOutputs?this._disposeOutput():this._buildOutput(),this._register(this.configurationService.onDidChangeConfiguration(e=>{let t=!1,o=!1;e.affectsConfiguration("notebook.diff.ignoreMetadata")&&(this._metadataLocalDisposable.clear(),this.configurationService.getValue("notebook.diff.ignoreMetadata")?this._disposeMetadata():(this.cell.metadataStatusHeight=25,this._buildMetadata(),this.updateMetadataRendering(),t=!0)),e.affectsConfiguration("notebook.diff.ignoreOutputs")&&(this._outputLocalDisposable.clear(),this.configurationService.getValue("notebook.diff.ignoreOutputs")||this.notebookEditor.textModel?.transientOptions.transientOutputs?this._disposeOutput():(this.cell.outputStatusHeight=25,this._buildOutput(),o=!0)),(t||o)&&this.layout({metadataHeight:t,outputTotalHeight:o})}))}updateSourceEditor(){this._cellHeaderContainer=this.templateData.cellHeaderContainer,this._cellHeaderContainer.style.display="flex",this._cellHeaderContainer.innerText="",this._editorContainer=this.templateData.editorContainer,this._editorContainer.classList.add("diff");let i=()=>{if(this.cell.cellFoldingState===1){this._editorContainer.style.display="none",this.cell.editorHeight=0;return}let e=this.notebookEditor.getLayoutInfo().fontInfo.lineHeight||17,t=this.cell.computeInputEditorHeight(e);if(this._editorContainer.style.height=`${t}px`,this._editorContainer.style.display="block",this._editor){let o=this._editor.getContentHeight();o>=0&&(this.cell.editorHeight=o);return}this._editor=this.templateData.sourceEditor,this._editor.layout({width:(this.notebookEditor.getLayoutInfo().width-2*QD)/2-18,height:t}),this._editor.updateOptions({readOnly:this.readonly}),this.cell.editorHeight=t,this._register(this._editor.onDidContentSizeChange(o=>{this.cell.cellFoldingState===0&&o.contentHeightChanged&&this.cell.layoutInfo.editorHeight!==o.contentHeight&&(this.cell.editorHeight=o.contentHeight)})),this._initializeSourceDiffEditor(this.nestedCellViewModel)};this._cellHeader=this._register(this.instantiationService.createInstance(zH,this.cell,this._cellHeaderContainer,this.notebookEditor,{updateInfoRendering:()=>i(),checkIfModified:()=>({reason:void 0}),getFoldingState:()=>this.cell.cellFoldingState,updateFoldingState:e=>this.cell.cellFoldingState=e,unChangedLabel:"Input",changedLabel:"Input",prefix:"input",menuId:D.NotebookDiffCellInputTitle})),this._cellHeader.buildHeader(),i(),this._initializeSourceDiffEditor(this.nestedCellViewModel)}calculateDiagonalFillHeight(){return this.cell.layoutInfo.cellStatusHeight+this.cell.layoutInfo.editorHeight+this.cell.layoutInfo.editorMargin+this.cell.layoutInfo.metadataStatusHeight+this.cell.layoutInfo.metadataHeight+this.cell.layoutInfo.outputTotalHeight+this.cell.layoutInfo.outputStatusHeight}async _initializeSourceDiffEditor(i){let e=await this.textModelService.createModelReference(i.uri);if(this._isDisposed)return;let t=e.object.textEditorModel;this._register(e),this._editor.setModel(t);let o=this.cell.getSourceEditorViewState();o&&this._editor.restoreViewState(o);let n=this._editor.getContentHeight();this.cell.editorHeight=n;let r=`${this.calculateDiagonalFillHeight()}px`;this._diagonalFill.style.height!==r&&(this._diagonalFill.style.height=r)}_disposeMetadata(){this.cell.metadataStatusHeight=0,this.cell.metadataHeight=0,this.templateData.cellHeaderContainer.style.display="none",this.templateData.metadataHeaderContainer.style.display="none",this.templateData.metadataInfoContainer.style.display="none",this._metadataEditor=void 0}_buildMetadata(){this._metadataHeaderContainer=this.templateData.metadataHeaderContainer,this._metadataInfoContainer=this.templateData.metadataInfoContainer,this._metadataHeaderContainer.style.display="flex",this._metadataInfoContainer.style.display="block",this._metadataHeaderContainer.innerText="",this._metadataInfoContainer.innerText="",this._metadataHeader=this.instantiationService.createInstance(zH,this.cell,this._metadataHeaderContainer,this.notebookEditor,{updateInfoRendering:this.updateMetadataRendering.bind(this),checkIfModified:()=>this.cell.checkMetadataIfModified(),getFoldingState:()=>this.cell.metadataFoldingState,updateFoldingState:i=>{this.cell.metadataFoldingState=i},unChangedLabel:"Metadata",changedLabel:"Metadata changed",prefix:"metadata",menuId:D.NotebookDiffCellMetadataTitle}),this._metadataLocalDisposable.add(this._metadataHeader),this._metadataHeader.buildHeader()}_buildOutput(){this.templateData.outputHeaderContainer.style.display="flex",this.templateData.outputInfoContainer.style.display="block",this._outputHeaderContainer=this.templateData.outputHeaderContainer,this._outputInfoContainer=this.templateData.outputInfoContainer,this._outputHeaderContainer.innerText="",this._outputInfoContainer.innerText="",this._outputHeader=this.instantiationService.createInstance(zH,this.cell,this._outputHeaderContainer,this.notebookEditor,{updateInfoRendering:this.updateOutputRendering.bind(this),checkIfModified:()=>this.cell.checkIfOutputsModified(),getFoldingState:()=>this.cell.outputFoldingState,updateFoldingState:i=>{this.cell.outputFoldingState=i},unChangedLabel:"Outputs",changedLabel:"Outputs changed",prefix:"output",menuId:D.NotebookDiffCellOutputsTitle}),this._outputLocalDisposable.add(this._outputHeader),this._outputHeader.buildHeader()}_disposeOutput(){this._hideOutputsRaw(),this._hideOutputsRenderer(),this._hideOutputsEmptyView(),this.cell.rawOutputHeight=0,this.cell.outputMetadataHeight=0,this.cell.outputStatusHeight=0,this.templateData.outputHeaderContainer.style.display="none",this.templateData.outputInfoContainer.style.display="none",this._outputViewContainer=void 0}},vAe=class extends f1t{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f){super(i,e,t,"left",s,o,n,r,l,c,u,p,h,g,f)}get nestedCellViewModel(){return this.cell.original}get readonly(){return!0}styleContainer(i){i.classList.remove("inserted"),i.classList.add("removed")}layout(i){Wr(Re(this._diffEditorContainer),()=>{(i.editorHeight||i.outerWidth)&&this._editor&&(this._editorContainer.style.height=`${this.cell.layoutInfo.editorHeight}px`,this._editor.layout({width:this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(),!1,!1),height:this.cell.layoutInfo.editorHeight})),i.outerWidth&&this._editor&&(this._editorContainer.style.height=`${this.cell.layoutInfo.editorHeight}px`,this._editor.layout()),(i.metadataHeight||i.outerWidth)&&this._metadataEditor?.layout({width:this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(),!1,!1),height:this.cell.layoutInfo.metadataHeight}),(i.outputTotalHeight||i.outerWidth)&&this._outputEditor?.layout({width:this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(),!1,!1),height:this.cell.layoutInfo.outputTotalHeight}),this._diagonalFill&&(this._diagonalFill.style.height=`${this.calculateDiagonalFillHeight()}px`),this.layoutNotebookCell()})}_buildOutputRendererContainer(){if(!this._outputViewContainer){this._outputViewContainer=M(this._outputInfoContainer,_(".output-view-container")),this._outputEmptyElement=M(this._outputViewContainer,_(".output-empty-view"));let i=M(this._outputEmptyElement,_("span"));i.innerText="No outputs to render",this.cell.original?.outputs.length?this._outputEmptyElement.style.display="none":this._outputEmptyElement.style.display="block",this.cell.layoutChange(),this._outputLeftView=this.instantiationService.createInstance(T8,this.notebookEditor,this.notebookEditor.textModel,this.cell,this.cell.original,0,this._outputViewContainer),this._register(this._outputLeftView),this._outputLeftView.render();let e=this.notebookEditor.onDidDynamicOutputRendered(t=>{t.cell.uri.toString()===this.cell.original.uri.toString()&&(this.notebookEditor.deltaCellOutputContainerClassNames(0,this.cell.original.id,["nb-cellDeleted"],[]),e.dispose())});this._register(e)}this._outputViewContainer.style.display="block"}_decorate(){this.notebookEditor.deltaCellOutputContainerClassNames(0,this.cell.original.id,["nb-cellDeleted"],[])}_showOutputsRenderer(){this._outputViewContainer&&(this._outputViewContainer.style.display="block",this._outputLeftView?.showOutputs(),this._decorate())}_hideOutputsRenderer(){this._outputViewContainer&&(this._outputViewContainer.style.display="none",this._outputLeftView?.hideOutputs())}dispose(){this._editor&&this.cell.saveSpirceEditorViewState(this._editor.saveViewState()),super.dispose()}};vAe=I([m(3,_t),m(4,Tt),m(5,Bt),m(6,F),m(7,Xe),m(8,_e),m(9,Ne),m(10,Kt),m(11,X),m(12,B),m(13,Fn)],vAe);var bAe=class extends f1t{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f){super(i,e,t,"right",o,n,r,s,l,c,u,p,h,g,f)}get nestedCellViewModel(){return this.cell.modified}get readonly(){return!1}styleContainer(i){i.classList.remove("removed"),i.classList.add("inserted")}_buildOutputRendererContainer(){if(!this._outputViewContainer){this._outputViewContainer=M(this._outputInfoContainer,_(".output-view-container")),this._outputEmptyElement=M(this._outputViewContainer,_(".output-empty-view")),this._outputEmptyElement.innerText="No outputs to render",this.cell.modified?.outputs.length?this._outputEmptyElement.style.display="none":this._outputEmptyElement.style.display="block",this.cell.layoutChange(),this._outputRightView=this.instantiationService.createInstance(T8,this.notebookEditor,this.notebookEditor.textModel,this.cell,this.cell.modified,1,this._outputViewContainer),this._register(this._outputRightView),this._outputRightView.render();let i=this.notebookEditor.onDidDynamicOutputRendered(e=>{e.cell.uri.toString()===this.cell.modified.uri.toString()&&(this.notebookEditor.deltaCellOutputContainerClassNames(1,this.cell.modified.id,["nb-cellAdded"],[]),i.dispose())});this._register(i)}this._outputViewContainer.style.display="block"}_decorate(){this.notebookEditor.deltaCellOutputContainerClassNames(1,this.cell.modified.id,["nb-cellAdded"],[])}_showOutputsRenderer(){this._outputViewContainer&&(this._outputViewContainer.style.display="block",this._outputRightView?.showOutputs(),this._decorate())}_hideOutputsRenderer(){this._outputViewContainer&&(this._outputViewContainer.style.display="none",this._outputRightView?.hideOutputs())}layout(i){Wr(Re(this._diffEditorContainer),()=>{(i.editorHeight||i.outerWidth)&&this._editor&&(this._editorContainer.style.height=`${this.cell.layoutInfo.editorHeight}px`,this._editor.layout({width:this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(),!1,!1),height:this.cell.layoutInfo.editorHeight})),i.outerWidth&&this._editor&&(this._editorContainer.style.height=`${this.cell.layoutInfo.editorHeight}px`,this._editor.layout()),(i.metadataHeight||i.outerWidth)&&this._metadataEditor?.layout({width:this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(),!1,!0),height:this.cell.layoutInfo.metadataHeight}),(i.outputTotalHeight||i.outerWidth)&&this._outputEditor?.layout({width:this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(),!1,!1),height:this.cell.layoutInfo.outputTotalHeight}),this.layoutNotebookCell(),this._diagonalFill&&(this._diagonalFill.style.height=`${this.calculateDiagonalFillHeight()}px`)})}dispose(){this._editor&&this.cell.saveSpirceEditorViewState(this._editor.saveViewState()),super.dispose()}};bAe=I([m(3,F),m(4,_t),m(5,Tt),m(6,Bt),m(7,Xe),m(8,_e),m(9,Ne),m(10,Kt),m(11,X),m(12,B),m(13,Fn)],bAe);var Lhe=class extends g1t{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f){super(i,e,t,"full",o,n,r,s,l,c,u,p,h,g,f),this.cell=e,this.templateData=t,this._editorViewStateChanged=!1,this.updateBorders()}init(){}styleContainer(i){i.classList.remove("inserted","removed")}buildBody(){super.buildBody(),this.cell.displayIconToHideUnmodifiedCells?(this._register(this.templateData.marginOverlay.onAction(()=>this.cell.hideUnchangedCells())),this.templateData.marginOverlay.show()):this.templateData.marginOverlay.hide()}_disposeMetadata(){this.cell.metadataStatusHeight=0,this.cell.metadataHeight=0,this.templateData.metadataHeaderContainer.style.display="none",this.templateData.metadataInfoContainer.style.display="none",this._metadataEditor=void 0}_buildMetadata(){this._metadataHeaderContainer=this.templateData.metadataHeaderContainer,this._metadataInfoContainer=this.templateData.metadataInfoContainer,this._metadataHeaderContainer.style.display="flex",this._metadataInfoContainer.style.display="block",this._metadataHeaderContainer.innerText="",this._metadataInfoContainer.innerText="",this._metadataHeader=this.instantiationService.createInstance(zH,this.cell,this._metadataHeaderContainer,this.notebookEditor,{updateInfoRendering:this.updateMetadataRendering.bind(this),checkIfModified:()=>this.cell.checkMetadataIfModified(),getFoldingState:()=>this.cell.metadataFoldingState,updateFoldingState:i=>{this.cell.metadataFoldingState=i},unChangedLabel:"Metadata",changedLabel:"Metadata changed",prefix:"metadata",menuId:D.NotebookDiffCellMetadataTitle}),this._metadataLocalDisposable.add(this._metadataHeader),this._metadataHeader.buildHeader()}_disposeOutput(){this._hideOutputsRaw(),this._hideOutputsRenderer(),this._hideOutputsEmptyView(),this.cell.rawOutputHeight=0,this.cell.outputMetadataHeight=0,this.cell.outputStatusHeight=0,this.templateData.outputHeaderContainer.style.display="none",this.templateData.outputInfoContainer.style.display="none",this._outputViewContainer=void 0}_buildOutput(){this.templateData.outputHeaderContainer.style.display="flex",this.templateData.outputInfoContainer.style.display="block",this._outputHeaderContainer=this.templateData.outputHeaderContainer,this._outputInfoContainer=this.templateData.outputInfoContainer,this._outputHeaderContainer.innerText="",this._outputInfoContainer.innerText="",this.cell.checkIfOutputsModified()?this._outputInfoContainer.classList.add("modified"):this._outputInfoContainer.classList.remove("modified"),this._outputHeader=this.instantiationService.createInstance(zH,this.cell,this._outputHeaderContainer,this.notebookEditor,{updateInfoRendering:this.updateOutputRendering.bind(this),checkIfModified:()=>this.cell.checkIfOutputsModified(),getFoldingState:()=>this.cell.outputFoldingState,updateFoldingState:i=>{this.cell.outputFoldingState=i},unChangedLabel:"Outputs",changedLabel:"Outputs changed",prefix:"output",menuId:D.NotebookDiffCellOutputsTitle}),this._outputLocalDisposable.add(this._outputHeader),this._outputHeader.buildHeader()}_buildOutputRendererContainer(){if(!this._outputViewContainer){this._outputViewContainer=M(this._outputInfoContainer,_(".output-view-container")),this._outputEmptyElement=M(this._outputViewContainer,_(".output-empty-view")),this._outputEmptyElement.innerText="No outputs to render",!this.cell.checkIfOutputsModified()&&this.cell.modified.outputs.length===0?this._outputEmptyElement.style.display="block":this._outputEmptyElement.style.display="none",this.cell.layoutChange(),this._register(this.cell.modified.textModel.onDidChangeOutputs(()=>{!this.cell.checkIfOutputsModified()&&this.cell.modified.outputs.length===0?this._outputEmptyElement.style.display="block":this._outputEmptyElement.style.display="none",this._decorate()})),this._outputLeftContainer=M(this._outputViewContainer,_(".output-view-container-left")),this._outputRightContainer=M(this._outputViewContainer,_(".output-view-container-right")),this._outputMetadataContainer=M(this._outputViewContainer,_(".output-view-container-metadata"));let i=this.cell.checkIfOutputsModified(),e=i&&i.kind===1&&this.cell.original.outputs.length===1&&this.cell.modified.outputs.length===1&&ogo(this.cell.original.outputs[0],this.cell.modified.outputs[0])===1;if(i&&!e){let t=this.notebookEditor.onDidDynamicOutputRendered(n=>{n.cell.uri.toString()===this.cell.original.uri.toString()&&this.cell.checkIfOutputsModified()&&(this.notebookEditor.deltaCellOutputContainerClassNames(0,this.cell.original.id,["nb-cellDeleted"],[]),t.dispose())}),o=this.notebookEditor.onDidDynamicOutputRendered(n=>{n.cell.uri.toString()===this.cell.modified.uri.toString()&&this.cell.checkIfOutputsModified()&&(this.notebookEditor.deltaCellOutputContainerClassNames(1,this.cell.modified.id,["nb-cellAdded"],[]),o.dispose())});this._register(t),this._register(o)}if(this._outputLeftView=this.instantiationService.createInstance(T8,this.notebookEditor,this.notebookEditor.textModel,this.cell,this.cell.original,0,this._outputLeftContainer),this._outputLeftView.render(),this._register(this._outputLeftView),this._outputRightView=this.instantiationService.createInstance(T8,this.notebookEditor,this.notebookEditor.textModel,this.cell,this.cell.modified,1,this._outputRightContainer),this._outputRightView.render(),this._register(this._outputRightView),i&&!e&&this._decorate(),e){this._outputMetadataContainer.style.top=`${this.cell.layoutInfo.rawOutputHeight}px`,this._outputMetadataEditor=this.instantiationService.createInstance(op,this._outputMetadataContainer,{...mAe,overflowWidgetsDomNode:this.notebookEditor.getOverflowContainerDomNode(),readOnly:!0,ignoreTrimWhitespace:!1,automaticLayout:!1,dimension:{height:rit,width:this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(),!1,!0)}},{originalEditor:_8(),modifiedEditor:_8()}),this._register(this._outputMetadataEditor);let t=JSON.stringify(this.cell.original.outputs[0].metadata??{},void 0,"	"),o=JSON.stringify(this.cell.modified.outputs[0].metadata??{},void 0,"	"),n=this.languageService.createById("json"),r=this.modelService.createModel(t,n,void 0,!0),s=this.modelService.createModel(o,n,void 0,!0);this._outputMetadataEditor.setModel({original:r,modified:s}),this.cell.outputMetadataHeight=this._outputMetadataEditor.getContentHeight(),this._register(this._outputMetadataEditor.onDidContentSizeChange(l=>{this.cell.outputMetadataHeight=l.contentHeight}))}}this._outputViewContainer.style.display="block"}_decorate(){this.cell.checkIfOutputsModified()?(this.notebookEditor.deltaCellOutputContainerClassNames(0,this.cell.original.id,["nb-cellDeleted"],[]),this.notebookEditor.deltaCellOutputContainerClassNames(1,this.cell.modified.id,["nb-cellAdded"],[])):(this.notebookEditor.deltaCellOutputContainerClassNames(0,this.cell.original.id,[],["nb-cellDeleted"]),this.notebookEditor.deltaCellOutputContainerClassNames(1,this.cell.modified.id,[],["nb-cellAdded"]))}_showOutputsRenderer(){this._outputViewContainer&&(this._outputViewContainer.style.display="block",this._outputLeftView?.showOutputs(),this._outputRightView?.showOutputs(),this._outputMetadataEditor?.layout({width:this._editor?.getViewWidth()||this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(),!1,!0),height:this.cell.layoutInfo.outputMetadataHeight}),this._decorate())}_hideOutputsRenderer(){this._outputViewContainer&&(this._outputViewContainer.style.display="none",this._outputLeftView?.hideOutputs(),this._outputRightView?.hideOutputs())}updateSourceEditor(){this._cellHeaderContainer=this.templateData.cellHeaderContainer,this._cellHeaderContainer.style.display="flex",this._cellHeaderContainer.innerText="";let i=this.cell.modified;this._editorContainer=this.templateData.editorContainer,this._editorContainer.classList.add("diff");let e=()=>{if(this.cell.cellFoldingState===1){this._editorContainer.style.display="none",this.cell.editorHeight=0;return}let l=i.textModel.textBuffer.getLineCount(),c=this.notebookEditor.getLayoutInfo().fontInfo.lineHeight||17,u=this.cell.layoutInfo.editorHeight!==0?this.cell.layoutInfo.editorHeight:this.cell.computeInputEditorHeight(c);if(this._editorContainer.style.height=`${u}px`,this._editorContainer.style.display="block",this._editor){let g=this._editor.getContentHeight();g>=0&&(this.cell.editorHeight=g);return}this._editor=this.templateData.sourceEditor;let p={padding:nN(l)},h=this._register(m1t(this.configurationService));h.options.enabled&&(p.hideUnchangedRegions=h.options),this._editor.updateOptions(p),this._register(h.onDidChangeEnablement(()=>{p.hideUnchangedRegions=h.options,this._editor?.updateOptions(p)})),this._editor.layout({width:this.notebookEditor.getLayoutInfo().width-2*QD,height:u}),this._register(this._editor.onDidContentSizeChange(g=>{this.cell.cellFoldingState===0&&g.contentHeightChanged&&this.cell.layoutInfo.editorHeight!==g.contentHeight&&(this.cell.editorHeight=g.contentHeight)})),this._initializeSourceDiffEditor()};this._cellHeader=this._register(this.instantiationService.createInstance(zH,this.cell,this._cellHeaderContainer,this.notebookEditor,{updateInfoRendering:()=>e(),checkIfModified:()=>this.cell.modified?.textModel.getTextBufferHash()!==this.cell.original?.textModel.getTextBufferHash()?{reason:void 0}:!1,getFoldingState:()=>this.cell.cellFoldingState,updateFoldingState:l=>this.cell.cellFoldingState=l,unChangedLabel:"Input",changedLabel:"Input changed",prefix:"input",menuId:D.NotebookDiffCellInputTitle})),this._cellHeader.buildHeader(),e();let t=this.contextKeyService.createScoped(this.templateData.inputToolbarContainer);this._register(t);let o=The.bindTo(t);o.set(this.cell.modified.textModel.getTextBufferHash()!==this.cell.original.textModel.getTextBufferHash());let n=Zho.bindTo(t),r=this.textConfigurationService.getValue(this.cell.modified.uri,"diffEditor.ignoreTrimWhitespace");n.set(r),this._toolbar=this.templateData.toolbar,this._toolbar.context=this.cell;let s=()=>{let l=this.textConfigurationService.getValue(this.cell.modified.uri,"diffEditor.ignoreTrimWhitespace");n.set(l);let c=this.cell.modified.textModel.getTextBufferHash()!==this.cell.original.textModel.getTextBufferHash();if(o.set(c),c){let u=this.menuService.getMenuActions(D.NotebookDiffCellInputTitle,t,{shouldForwardArgs:!0}),p=jm(u);this._toolbar.setActions(p)}else this._toolbar.setActions([])};this._register(this.cell.modified.textModel.onDidChangeContent(()=>s())),this._register(this.textConfigurationService.onDidChangeConfiguration(l=>{l.affectsConfiguration(this.cell.modified.uri,"diffEditor")&&l.affectedKeys.has("diffEditor.ignoreTrimWhitespace")&&s()})),s()}async _initializeSourceDiffEditor(){let[i,e]=await Promise.all([this.textModelService.createModelReference(this.cell.original.uri),this.textModelService.createModelReference(this.cell.modified.uri)]);if(this._register(i),this._register(e),this._isDisposed){i.dispose(),e.dispose();return}let t=this._register(this._editor.createViewModel({original:i.object.textEditorModel,modified:e.object.textEditorModel}));await t.waitForDiff(),this._editor.setModel(t);let o=()=>{this._editorViewStateChanged=!0},n=l=>{(l.scrollTopChanged||l.scrollLeftChanged)&&(this._editorViewStateChanged=!0)};this.updateEditorOptionsForWhitespace(),this._register(this._editor.getOriginalEditor().onDidChangeCursorSelection(o)),this._register(this._editor.getOriginalEditor().onDidScrollChange(n)),this._register(this._editor.getModifiedEditor().onDidChangeCursorSelection(o)),this._register(this._editor.getModifiedEditor().onDidScrollChange(n));let r=this.cell.getSourceEditorViewState();r&&this._editor.restoreViewState(r);let s=this._editor.getContentHeight();this.cell.editorHeight=s}updateEditorOptionsForWhitespace(){let i=this._editor;if(!i)return;let e=i.getModel()?.modified.uri||i.getModel()?.original.uri;if(!e)return;let t=this.textConfigurationService.getValue(e,"diffEditor.ignoreTrimWhitespace");i.updateOptions({ignoreTrimWhitespace:t}),this._register(this.textConfigurationService.onDidChangeConfiguration(o=>{if(o.affectsConfiguration(e,"diffEditor")&&o.affectedKeys.has("diffEditor.ignoreTrimWhitespace")){let n=this.textConfigurationService.getValue(e,"diffEditor.ignoreTrimWhitespace");i.updateOptions({ignoreTrimWhitespace:n})}}))}layout(i){Wr(Re(this._diffEditorContainer),()=>{i.editorHeight&&this._editor&&(this._editorContainer.style.height=`${this.cell.layoutInfo.editorHeight}px`,this._editor.layout({width:this._editor.getViewWidth(),height:this.cell.layoutInfo.editorHeight})),i.outerWidth&&this._editor&&(this._editorContainer.style.height=`${this.cell.layoutInfo.editorHeight}px`,this._editor.layout()),(i.metadataHeight||i.outerWidth)&&this._metadataEditorContainer&&(this._metadataEditorContainer.style.height=`${this.cell.layoutInfo.metadataHeight}px`,this._metadataEditor?.layout({width:this._editor?.getViewWidth()||this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(),!1,!0),height:this.cell.layoutInfo.metadataHeight})),(i.outputTotalHeight||i.outerWidth)&&(this._outputEditorContainer&&(this._outputEditorContainer.style.height=`${this.cell.layoutInfo.outputTotalHeight}px`,this._outputEditor?.layout({width:this._editor?.getViewWidth()||this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(),!1,!0),height:this.cell.layoutInfo.outputTotalHeight})),this._outputMetadataContainer&&(this._outputMetadataContainer.style.height=`${this.cell.layoutInfo.outputMetadataHeight}px`,this._outputMetadataContainer.style.top=`${this.cell.layoutInfo.outputTotalHeight-this.cell.layoutInfo.outputMetadataHeight}px`,this._outputMetadataEditor?.layout({width:this._editor?.getViewWidth()||this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(),!1,!0),height:this.cell.layoutInfo.outputMetadataHeight}))),this.layoutNotebookCell()})}dispose(){this._editor&&this._editor.setModel(null),this._editor&&this._editorViewStateChanged&&this.cell.saveSpirceEditorViewState(this._editor.saveViewState()),super.dispose()}};Lhe=I([m(3,F),m(4,_t),m(5,Tt),m(6,Bt),m(7,Xe),m(8,_e),m(9,Ne),m(10,Kt),m(11,X),m(12,B),m(13,Fn)],Lhe);var v1t=class extends x{constructor(e){super();this.container=e;this._nodes=ct("div.diff-hidden-cells",[ct("div.center@content",{style:{display:"flex"}},[_("a",{title:d(12550,null),role:"button",onclick:()=>{this._action.fire()}},...Un("$(unfold)"))])]);this._action=this._register(new E);this.onAction=this._action.event;this._nodes.root.style.display="none",e.appendChild(this._nodes.root)}show(){this._nodes.root.style.display="block"}hide(){this._nodes.root.style.display="none"}dispose(){this.hide(),this.container.removeChild(this._nodes.root),vi(this._nodes.root),super.dispose()}},sit=class extends x{constructor(e){super();this.container=e;this._nodes=ct("div.diff-hidden-cells",[ct("div.center@content",{style:{display:"flex"}},[_("a",{title:d(12549,null),role:"button",onclick:()=>{this._action.fire()}},...Un("$(fold)"))])]);this._action=this._register(new E);this.onAction=this._action.event;this._nodes.root.style.display="none",e.appendChild(this._nodes.root)}show(){this._nodes.root.style.display="block"}hide(){this._nodes.root.style.display="none"}dispose(){this.hide(),this.container.removeChild(this._nodes.root),vi(this._nodes.root),super.dispose()}};var SAe=class{constructor(i,e){this.configurationService=e;let t=this.configurationService.getValue("editor");this.lineHeight=QS(t,bu.getInstance(i).value).lineHeight}getHeight(i){return i.getHeight(this.lineHeight)}hasDynamicHeight(i){return!1}getTemplateId(i){switch(i.type){case"delete":case"insert":return R8.TEMPLATE_ID;case"modified":case"unchanged":return M8.TEMPLATE_ID;case"placeholder":return D8.TEMPLATE_ID;case"modifiedMetadata":case"unchangedMetadata":return L8.TEMPLATE_ID}}};SAe=I([m(1,B)],SAe);var D8=class{constructor(i,e){this.notebookEditor=i;this.instantiationService=e}static{this.TEMPLATE_ID="cell_diff_placeholder"}get templateId(){return D8.TEMPLATE_ID}renderTemplate(i){let e=_(".cell-placeholder-body");M(i,e);let t=new N,o=new v1t(e),n=M(e,_(".contents")),r=M(n,_("span.text",{title:d(12584,null)}));return{body:e,container:i,placeholder:r,marginOverlay:o,elementDisposables:t}}renderElement(i,e,t){t.body.classList.remove("left","right","full"),t.elementDisposables.add(this.instantiationService.createInstance(h1t,i,t))}disposeTemplate(i){i.container.innerText=""}disposeElement(i,e,t){t.elementDisposables.clear()}};D8=I([m(1,F)],D8);var L8=class{constructor(i,e,t,o,n,r,s,l,c){this.notebookEditor=i;this.instantiationService=e;this.contextMenuService=t;this.keybindingService=o;this.menuService=n;this.contextKeyService=r;this.notificationService=s;this.themeService=l;this.accessibilityService=c}static{this.TEMPLATE_ID="notebook_metadata_diff_side_by_side"}get templateId(){return L8.TEMPLATE_ID}renderTemplate(i){let e=_(".cell-body");M(i,e);let t=_(".cell-diff-editor-container");M(e,t);let o=M(t,_(".input-header-container")),n=M(t,_(".source-container")),{editor:r,editorContainer:s}=this._buildSourceEditor(n),l=M(n,_(".editor-input-toolbar-container")),c=M(l,_("div.property-toolbar")),u=this.instantiationService.createInstance(ol,c,{actionViewItemProvider:(y,w)=>{if(y instanceof Lo)return new xM(y,{hoverDelegate:w.hoverDelegate},this.keybindingService,this.notificationService,this.contextKeyService,this.themeService,this.contextMenuService,this.accessibilityService)},highlightToggledItems:!0}),p=M(e,_(".border-container")),h=M(p,_(".left-border")),g=M(p,_(".right-border")),f=M(p,_(".top-border")),v=M(p,_(".bottom-border")),b=new sit(e),S=new N;return{body:e,container:i,diffEditorContainer:t,cellHeaderContainer:o,sourceEditor:r,editorContainer:s,inputToolbarContainer:l,toolbar:u,leftBorder:h,rightBorder:g,topBorder:f,bottomBorder:v,marginOverlay:b,elementDisposables:S}}_buildSourceEditor(i){return ngo(this.instantiationService,this.notebookEditor,i,{readOnly:!0})}renderElement(i,e,t){t.body.classList.remove("full"),t.elementDisposables.add(this.instantiationService.createInstance(fAe,this.notebookEditor,i,t))}disposeTemplate(i){i.container.innerText="",i.sourceEditor.dispose(),i.toolbar?.dispose(),i.elementDisposables.dispose()}disposeElement(i,e,t){t.toolbar&&(t.toolbar.context=void 0),t.elementDisposables.clear()}};L8=I([m(1,F),m(2,Xe),m(3,_e),m(4,Kt),m(5,X),m(6,Ne),m(7,Le),m(8,Oi)],L8);var R8=class{constructor(i,e){this.notebookEditor=i;this.instantiationService=e}static{this.TEMPLATE_ID="cell_diff_single"}get templateId(){return R8.TEMPLATE_ID}renderTemplate(i){let e=_(".cell-body");M(i,e);let t=_(".cell-diff-editor-container");M(e,t);let o=M(e,_(".diagonal-fill")),n=M(t,_(".input-header-container")),r=M(t,_(".source-container")),{editor:s,editorContainer:l}=this._buildSourceEditor(r),c=M(t,_(".metadata-header-container")),u=M(t,_(".metadata-info-container")),p=M(t,_(".output-header-container")),h=M(t,_(".output-info-container")),g=M(e,_(".border-container")),f=M(g,_(".left-border")),v=M(g,_(".right-border")),b=M(g,_(".top-border")),S=M(g,_(".bottom-border"));return{body:e,container:i,editorContainer:l,diffEditorContainer:t,diagonalFill:o,cellHeaderContainer:n,sourceEditor:s,metadataHeaderContainer:c,metadataInfoContainer:u,outputHeaderContainer:p,outputInfoContainer:h,leftBorder:f,rightBorder:v,topBorder:b,bottomBorder:S,elementDisposables:new N}}_buildSourceEditor(i){return JJo(this.instantiationService,this.notebookEditor,i)}renderElement(i,e,t){switch(t.body.classList.remove("left","right","full"),i.type){case"delete":t.elementDisposables.add(this.instantiationService.createInstance(vAe,this.notebookEditor,i,t));return;case"insert":t.elementDisposables.add(this.instantiationService.createInstance(bAe,this.notebookEditor,i,t));return;default:break}}disposeTemplate(i){i.container.innerText="",i.sourceEditor.dispose(),i.elementDisposables.dispose()}disposeElement(i,e,t){t.elementDisposables.clear()}};R8=I([m(1,F)],R8);var M8=class{constructor(i,e,t,o,n,r,s,l,c){this.notebookEditor=i;this.instantiationService=e;this.contextMenuService=t;this.keybindingService=o;this.menuService=n;this.contextKeyService=r;this.notificationService=s;this.themeService=l;this.accessibilityService=c}static{this.TEMPLATE_ID="cell_diff_side_by_side"}get templateId(){return M8.TEMPLATE_ID}renderTemplate(i){let e=_(".cell-body");M(i,e);let t=_(".cell-diff-editor-container");M(e,t);let o=M(t,_(".input-header-container")),n=M(t,_(".source-container")),{editor:r,editorContainer:s}=this._buildSourceEditor(n),l=M(n,_(".editor-input-toolbar-container")),c=M(l,_("div.property-toolbar")),u=this.instantiationService.createInstance(ol,c,{actionViewItemProvider:(P,O)=>{if(P instanceof Lo)return new xM(P,{hoverDelegate:O.hoverDelegate},this.keybindingService,this.notificationService,this.contextKeyService,this.themeService,this.contextMenuService,this.accessibilityService)},highlightToggledItems:!0}),p=M(t,_(".metadata-header-container")),h=M(t,_(".metadata-info-container")),g=M(t,_(".output-header-container")),f=M(t,_(".output-info-container")),v=M(e,_(".border-container")),b=M(v,_(".left-border")),S=M(v,_(".right-border")),y=M(v,_(".top-border")),w=M(v,_(".bottom-border")),k=new sit(e),T=new N;return{body:e,container:i,diffEditorContainer:t,cellHeaderContainer:o,sourceEditor:r,editorContainer:s,inputToolbarContainer:l,toolbar:u,metadataHeaderContainer:p,metadataInfoContainer:h,outputHeaderContainer:g,outputInfoContainer:f,leftBorder:b,rightBorder:S,topBorder:y,bottomBorder:w,marginOverlay:k,elementDisposables:T}}_buildSourceEditor(i){return ngo(this.instantiationService,this.notebookEditor,i)}renderElement(i,e,t){switch(t.body.classList.remove("left","right","full"),i.type){case"unchanged":t.elementDisposables.add(this.instantiationService.createInstance(Lhe,this.notebookEditor,i,t));return;case"modified":t.elementDisposables.add(this.instantiationService.createInstance(Lhe,this.notebookEditor,i,t));return;default:break}}disposeTemplate(i){i.container.innerText="",i.sourceEditor.dispose(),i.toolbar?.dispose(),i.elementDisposables.dispose()}disposeElement(i,e,t){t.toolbar&&(t.toolbar.context=void 0),t.elementDisposables.clear()}};M8=I([m(1,F),m(2,Xe),m(3,_e),m(4,Kt),m(5,X),m(6,Ne),m(7,Le),m(8,Oi)],M8);var lTi=class extends zle{onViewPointer(i){if(cY(i.browserEvent.target)){let e=typeof i.index>"u"?[]:[i.index];this.list.setFocus(e,i.browserEvent)}else super.onViewPointer(i)}},IAe=class extends Vl{get rowsContainer(){return this.view.containerDomNode}constructor(i,e,t,o,n,r,s,l,c){super(i,e,t,o,r,n,s,l,c)}createMouseController(i){return new lTi(this)}getCellViewScrollTop(i){let e=this.indexOf(i);return this.view.elementTop(e)}getScrollHeight(){return this.view.scrollHeight}triggerScrollFromMouseWheelEvent(i){this.view.delegateScrollFromMouseWheelEvent(i)}delegateVerticalScrollbarPointerDown(i){this.view.delegateVerticalScrollbarPointerDown(i)}clear(){super.splice(0,this.length)}updateElementHeight2(i,e){let t=this.indexOf(i),o=this.getFocus();this.view.updateElementHeight(t,e,o.length?o[0]:null)}style(i){let e=this.view.domId;this.styleElement||(this.styleElement=Cr(this.view.domNode));let t=e&&`.${e}`,o=[];i.listBackground&&o.push(`.monaco-list${t} > div.monaco-scrollable-element > .monaco-list-rows { background: ${i.listBackground}; }`),i.listFocusBackground&&(o.push(`.monaco-list${t}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused { background-color: ${i.listFocusBackground}; }`),o.push(`.monaco-list${t}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused:hover { background-color: ${i.listFocusBackground}; }`)),i.listFocusForeground&&o.push(`.monaco-list${t}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused { color: ${i.listFocusForeground}; }`),i.listActiveSelectionBackground&&(o.push(`.monaco-list${t}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected { background-color: ${i.listActiveSelectionBackground}; }`),o.push(`.monaco-list${t}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected:hover { background-color: ${i.listActiveSelectionBackground}; }`)),i.listActiveSelectionForeground&&o.push(`.monaco-list${t}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected { color: ${i.listActiveSelectionForeground}; }`),i.listFocusAndSelectionBackground&&o.push(`
				.monaco-drag-image${t},
				.monaco-list${t}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected.focused { background-color: ${i.listFocusAndSelectionBackground}; }
			`),i.listFocusAndSelectionForeground&&o.push(`
				.monaco-drag-image${t},
				.monaco-list${t}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected.focused { color: ${i.listFocusAndSelectionForeground}; }
			`),i.listInactiveFocusBackground&&(o.push(`.monaco-list${t} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused { background-color:  ${i.listInactiveFocusBackground}; }`),o.push(`.monaco-list${t} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused:hover { background-color:  ${i.listInactiveFocusBackground}; }`)),i.listInactiveSelectionBackground&&(o.push(`.monaco-list${t} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected { background-color:  ${i.listInactiveSelectionBackground}; }`),o.push(`.monaco-list${t} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected:hover { background-color:  ${i.listInactiveSelectionBackground}; }`)),i.listInactiveSelectionForeground&&o.push(`.monaco-list${t} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected { color: ${i.listInactiveSelectionForeground}; }`),i.listHoverBackground&&o.push(`.monaco-list${t}:not(.drop-target) > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row:hover:not(.selected):not(.focused) { background-color:  ${i.listHoverBackground}; }`),i.listHoverForeground&&o.push(`.monaco-list${t} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row:hover:not(.selected):not(.focused) { color:  ${i.listHoverForeground}; }`),i.listSelectionOutline&&o.push(`.monaco-list${t} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected { outline: 1px dotted ${i.listSelectionOutline}; outline-offset: -1px; }`),i.listFocusOutline&&o.push(`
				.monaco-drag-image${t},
				.monaco-list${t}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused { outline: 1px solid ${i.listFocusOutline}; outline-offset: -1px; }
			`),i.listInactiveFocusOutline&&o.push(`.monaco-list${t} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused { outline: 1px dotted ${i.listInactiveFocusOutline}; outline-offset: -1px; }`),i.listHoverOutline&&o.push(`.monaco-list${t} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row:hover { outline: 1px dashed ${i.listHoverOutline}; outline-offset: -1px; }`),i.listDropOverBackground&&o.push(`
				.monaco-list${t}.drop-target,
				.monaco-list${t} > div.monaco-scrollable-element > .monaco-list-rows.drop-target,
				.monaco-list${t} > div.monaco-scrollable-element > .monaco-list-row.drop-target { background-color: ${i.listDropOverBackground} !important; color: inherit !important; }
			`);let n=o.join(`
`);n!==this.styleElement.textContent&&(this.styleElement.textContent=n)}};IAe=I([m(6,Io),m(7,B),m(8,F)],IAe);function ngo(a,i,e,t={}){let o=M(e,_(".editor-container"));return{editor:a.createInstance(op,o,{...mAe,overflowWidgetsDomNode:i.getOverflowContainerDomNode(),originalEditable:!1,ignoreTrimWhitespace:!1,automaticLayout:!1,dimension:{height:0,width:0},renderSideBySide:!0,useInlineViewWhenSpaceIsLimited:!1,...t},{originalEditor:_8(),modifiedEditor:_8()}),editorContainer:o}}function JJo(a,i,e,t={}){let o=M(e,_(".editor-container")),n=["editor.contrib.emptyTextEditorHint"];return{editor:a.createInstance(Xr,o,{...pAe,glyphMargin:!1,dimension:{width:(i.getLayoutInfo().width-2*QD)/2-18,height:0},automaticLayout:!1,overflowWidgetsDomNode:i.getOverflowContainerDomNode(),allowVariableLineHeights:!1,readOnly:!0},{contributions:Ba.getEditorContributions().filter(s=>n.indexOf(s.id)===-1)}),editorContainer:o}}var ZJo="notebookEditorWorkerService",kG=le(ZJo);var eZo=20,yAe=class extends yu{constructor(e,t,o,n){super(n);this.notebookEditor=e;this.width=t;this._diffElementViewModels=[];this._lanes=2;this._insertColor=null,this._removeColor=null,this._insertColorHex=null,this._removeColorHex=null,this._disposables=this._register(new N),this._renderAnimationFrame=null,this._domNode=ur(document.createElement("canvas")),this._domNode.setPosition("relative"),this._domNode.setLayerHinting(!0),this._domNode.setContain("strict"),o.appendChild(this._domNode.domNode),this._overviewViewportDomElement=ur(document.createElement("div")),this._overviewViewportDomElement.setClassName("diffViewport"),this._overviewViewportDomElement.setPosition("absolute"),this._overviewViewportDomElement.setWidth(t),o.appendChild(this._overviewViewportDomElement.domNode),this._register(bu.getInstance(Re(this._domNode.domNode)).onDidChange(()=>{this._scheduleRender()})),this._register(this.themeService.onDidColorThemeChange(r=>{this.applyColors(r)&&this._scheduleRender()})),this.applyColors(this.themeService.getColorTheme()),this._register(this.notebookEditor.onDidScroll(()=>{this._renderOverviewViewport()})),this._register(Jo(o,re.POINTER_DOWN,r=>{this.notebookEditor.delegateVerticalScrollbarPointerDown(r)}))}applyColors(e){let t=e.getColor(Ovt)||(e.getColor(df)||Lye).transparent(2),o=e.getColor(Fvt)||(e.getColor(zf)||Rye).transparent(2),n=!t.equals(this._insertColor)||!o.equals(this._removeColor);return this._insertColor=t,this._removeColor=o,this._insertColor&&(this._insertColorHex=We.Format.CSS.formatHexA(this._insertColor)),this._removeColor&&(this._removeColorHex=We.Format.CSS.formatHexA(this._removeColor)),n}layout(){this._layoutNow()}updateViewModels(e,t){this._disposables.clear(),this._diffElementViewModels=e,t&&(this._disposables.add(t.onDidChangeLayout(()=>{this._scheduleRender()})),this._disposables.add(t.onDidChangeCellLayout(()=>{this._scheduleRender()}))),this._scheduleRender()}_scheduleRender(){this._renderAnimationFrame===null&&(this._renderAnimationFrame=zh(Re(this._domNode.domNode),this._onRenderScheduled.bind(this),16))}_onRenderScheduled(){this._renderAnimationFrame=null,this._layoutNow()}_layoutNow(){let t=this.notebookEditor.getLayoutInfo().height,o=this._diffElementViewModels.map(s=>s.totalHeight).reduce((s,l)=>s+l,0),n=bu.getInstance(Re(this._domNode.domNode)).value;this._domNode.setWidth(this.width),this._domNode.setHeight(t),this._domNode.domNode.width=this.width*n,this._domNode.domNode.height=t*n;let r=this._domNode.domNode.getContext("2d");r.clearRect(0,0,this.width*n,t*n),this._renderCanvas(r,this.width*n,t*n,o*n,n),this._renderOverviewViewport()}_renderOverviewViewport(){let e=this._computeOverviewViewport();e?(this._overviewViewportDomElement.setTop(e.top),this._overviewViewportDomElement.setHeight(e.height)):(this._overviewViewportDomElement.setTop(0),this._overviewViewportDomElement.setHeight(0))}_computeOverviewViewport(){let e=this.notebookEditor.getLayoutInfo();if(!e)return null;let t=this.notebookEditor.getScrollTop(),o=this.notebookEditor.getScrollHeight(),n=Math.max(0,e.height),r=Math.max(0,n-0),s=e.height,l=Math.round(Math.max(eZo,Math.floor(s*r/o))),c=(r-l)/(o-s),u=Math.round(t*c);return{height:l,top:u}}_renderCanvas(e,t,o,n,r){if(!this._insertColorHex||!this._removeColorHex)return;let s=t/this._lanes,l=0;for(let c=0;c<this._diffElementViewModels.length;c++){let u=this._diffElementViewModels[c],p=Math.round(u.totalHeight/n*r*o);switch(u.type){case"insert":e.fillStyle=this._insertColorHex,e.fillRect(s,l,s,p);break;case"delete":e.fillStyle=this._removeColorHex,e.fillRect(0,l,s,p);break;case"unchanged":case"unchangedMetadata":break;case"modified":case"modifiedMetadata":e.fillStyle=this._removeColorHex,e.fillRect(0,l,s,p),e.fillStyle=this._insertColorHex,e.fillRect(s,l,s,p);break}l+=p}}dispose(){this._renderAnimationFrame!==null&&(this._renderAnimationFrame.dispose(),this._renderAnimationFrame=null),super.dispose()}};yAe=I([m(3,Le)],yAe);function wAe(a,i,e){let t=e.cellsDiff.changes,o=[],n=0,r=0,s=-1;for(let l=0;l<t.length;l++){let c=t[l];for(let p=0;p<c.originalStart-n;p++){let h=a.cells[n+p],g=i.cells[r+p];h.getHashValue()===g.getHashValue()?o.push({originalCellIndex:n+p,modifiedCellIndex:r+p,type:"unchanged"}):(s===-1&&(s=o.length),o.push({originalCellIndex:n+p,modifiedCellIndex:r+p,type:"modified"}))}let u=tZo(c,a,i);u.length&&s===-1&&(s=o.length),o.push(...u),n=c.originalStart+c.originalLength,r=c.modifiedStart+c.modifiedLength}for(let l=n;l<a.cells.length;l++)o.push({originalCellIndex:l,modifiedCellIndex:l-n+r,type:"unchanged"});return{cellDiffInfo:o,firstChangeIndex:s}}function tZo(a,i,e){let t=[],o=Math.min(a.originalLength,a.modifiedLength);for(let n=0;n<o;n++){let r=i.cells[a.originalStart+n],s=e.cells[a.modifiedStart+n];if(r.cellKind!==s.cellKind)t.push({originalCellIndex:a.originalStart+n,type:"delete"}),t.push({modifiedCellIndex:a.modifiedStart+n,type:"insert"});else{let l=r.equal(s);t.push({originalCellIndex:a.originalStart+n,modifiedCellIndex:a.modifiedStart+n,type:l?"unchanged":"modified"})}}for(let n=o;n<a.originalLength;n++)t.push({originalCellIndex:a.originalStart+n,type:"delete"});for(let n=o;n<a.modifiedLength;n++)t.push({modifiedCellIndex:a.modifiedStart+n,type:"insert"});return t}var CAe=class extends x{constructor(e,t,o,n,r,s,l,c){super();this.model=e;this.notebookEditorWorkerService=t;this.configurationService=o;this.eventDispatcher=n;this.notebookService=r;this.diffEditorHeightCalculator=s;this.fontInfo=l;this.excludeUnchangedPlaceholder=c;this.placeholderAndRelatedCells=new Map;this._items=[];this._onDidChangeItems=this._register(new E);this.onDidChangeItems=this._onDidChangeItems.event;this.disposables=this._register(new N);this._onDidChange=this._register(new E);this.diffEditorItems=[];this.onDidChange=this._onDidChange.event;this.originalCellViewModels=[];this.hideOutput=this.model.modified.notebook.transientOptions.transientOutputs||this.configurationService.getValue("notebook.diff.ignoreOutputs"),this.ignoreMetadata=this.configurationService.getValue("notebook.diff.ignoreMetadata"),this._register(this.configurationService.onDidChangeConfiguration(u=>{let p=!1,h=!1;if(u.affectsConfiguration("notebook.diff.ignoreMetadata")){let g=this.configurationService.getValue("notebook.diff.ignoreMetadata");g!==void 0&&this.ignoreMetadata!==g&&(this.ignoreMetadata=g,p=!0,h=!0)}if(u.affectsConfiguration("notebook.diff.ignoreOutputs")){let g=this.configurationService.getValue("notebook.diff.ignoreOutputs");g!==void 0&&this.hideOutput!==(g||this.model.modified.notebook.transientOptions.transientOutputs)&&(this.hideOutput=g||!!this.model.modified.notebook.transientOptions.transientOutputs,p=!0)}h&&this.toggleNotebookMetadata(),p&&this._onDidChange.fire()}))}get items(){return this._items}get value(){return this.diffEditorItems.filter(e=>e.type!=="placeholder").filter(e=>this._includeUnchanged?!0:e instanceof Rhe||e instanceof Tte||e instanceof _te?!(e.type==="unchanged"&&e.containerType==="unchanged"):!0).filter(e=>e instanceof _te?!this.hideOutput:!0).filter(e=>e instanceof Tte?!this.ignoreMetadata:!0)}get hasUnchangedCells(){return this._hasUnchangedCells===!0}get includeUnchanged(){return this._includeUnchanged===!0}set includeUnchanged(e){this._includeUnchanged=e,this._onDidChange.fire()}dispose(){this.clear(),super.dispose()}clear(){this.disposables.clear(),Be(Array.from(this.placeholderAndRelatedCells.keys())),this.placeholderAndRelatedCells.clear(),Be(this.originalCellViewModels),this.originalCellViewModels=[],Be(this._items),this._items.splice(0,this._items.length)}async computeDiff(e){let t=await Va(this.notebookEditorWorkerService.computeDiff(this.model.original.resource,this.model.modified.resource),e);if(!t||e.isCancellationRequested)return;iZo(this.model.original.notebook,this.model.modified.notebook,t.cellsDiff);let{cellDiffInfo:o,firstChangeIndex:n}=wAe(this.model.original.notebook,this.model.modified.notebook,t);if(!oZo(o,this.originalCellViewModels,this.model)){if(await Va(this.updateViewModels(o,t.metadataChanged,n),e),e.isCancellationRequested)return;this.updateDiffEditorItems()}}toggleNotebookMetadata(){this.notebookMetadataViewModel&&(this.ignoreMetadata?this._items.length&&this._items[0]===this.notebookMetadataViewModel&&(this._items.splice(0,1),this._onDidChangeItems.fire({start:0,deleteCount:1,elements:[]})):(!this._items.length||this._items[0]!==this.notebookMetadataViewModel)&&(this._items.splice(0,0,this.notebookMetadataViewModel),this._onDidChangeItems.fire({start:0,deleteCount:0,elements:[this.notebookMetadataViewModel]})))}updateDiffEditorItems(){this.diffEditorItems=[];let e=this.model.original.resource,t=this.model.modified.resource;this._hasUnchangedCells=!1,this.items.forEach(o=>{switch(o.type){case"delete":{this.diffEditorItems.push(new Rhe(o.original.uri,void 0,o.type,o.type));let n=Zo.generateCellPropertyUri(e,o.original.handle,Q.vscodeNotebookCellMetadata);this.diffEditorItems.push(new Tte(n,void 0,o.type,o.type));let r=Zo.generateCellPropertyUri(e,o.original.handle,Q.vscodeNotebookCellOutput);this.diffEditorItems.push(new _te(r,void 0,o.type,o.type));break}case"insert":{this.diffEditorItems.push(new Rhe(void 0,o.modified.uri,o.type,o.type));let n=Zo.generateCellPropertyUri(t,o.modified.handle,Q.vscodeNotebookCellMetadata);this.diffEditorItems.push(new Tte(void 0,n,o.type,o.type));let r=Zo.generateCellPropertyUri(t,o.modified.handle,Q.vscodeNotebookCellOutput);this.diffEditorItems.push(new _te(void 0,r,o.type,o.type));break}case"modified":{let n=o.checkIfInputModified()?o.type:"unchanged",r=o.checkIfInputModified()||o.checkMetadataIfModified()||o.checkIfOutputsModified()?o.type:"unchanged";this.diffEditorItems.push(new Rhe(o.original.uri,o.modified.uri,n,r));let s=Zo.generateCellPropertyUri(e,o.original.handle,Q.vscodeNotebookCellMetadata),l=Zo.generateCellPropertyUri(t,o.modified.handle,Q.vscodeNotebookCellMetadata);this.diffEditorItems.push(new Tte(s,l,o.checkMetadataIfModified()?o.type:"unchanged",r));let c=Zo.generateCellPropertyUri(e,o.original.handle,Q.vscodeNotebookCellOutput),u=Zo.generateCellPropertyUri(t,o.modified.handle,Q.vscodeNotebookCellOutput);this.diffEditorItems.push(new _te(c,u,o.checkIfOutputsModified()?o.type:"unchanged",r));break}case"unchanged":{this._hasUnchangedCells=!0,this.diffEditorItems.push(new Rhe(o.original.uri,o.modified.uri,o.type,o.type));let n=Zo.generateCellPropertyUri(e,o.original.handle,Q.vscodeNotebookCellMetadata),r=Zo.generateCellPropertyUri(t,o.modified.handle,Q.vscodeNotebookCellMetadata);this.diffEditorItems.push(new Tte(n,r,o.type,o.type));let s=Zo.generateCellPropertyUri(e,o.original.handle,Q.vscodeNotebookCellOutput),l=Zo.generateCellPropertyUri(t,o.modified.handle,Q.vscodeNotebookCellOutput);this.diffEditorItems.push(new _te(s,l,o.type,o.type));break}}}),this._onDidChange.fire()}async updateViewModels(e,t,o){let n=await this.createDiffViewModels(e,t),r=this._items.length;this.clear(),this._items.splice(0,r);let s;this.originalCellViewModels=n,n.forEach((l,c)=>{if(l.type==="unchanged"&&!this.excludeUnchangedPlaceholder){if(!s){l.displayIconToHideUnmodifiedCells=!0,s=new u1t(l.mainDocumentTextModel,l.editorEventDispatcher,l.initData),this._items.push(s);let p=s;this.disposables.add(p.onUnfoldHiddenCells(()=>{let h=this.placeholderAndRelatedCells.get(p);if(!Array.isArray(h))return;let g=this._items.indexOf(p);this._items.splice(g,1,...h),this._onDidChangeItems.fire({start:g,deleteCount:1,elements:h})})),this.disposables.add(l.onHideUnchangedCells(()=>{let h=this.placeholderAndRelatedCells.get(p);if(!Array.isArray(h))return;let g=this._items.indexOf(l);this._items.splice(g,h.length,p),this._onDidChangeItems.fire({start:g,deleteCount:h.length,elements:[p]})}))}let u=this.placeholderAndRelatedCells.get(s)||[];u.push(l),this.placeholderAndRelatedCells.set(s,u),s.hiddenCells.push(l)}else s=void 0,this._items.push(l)}),this._onDidChangeItems.fire({start:0,deleteCount:r,elements:this._items,firstChangeIndex:o})}async createDiffViewModels(e,t){let o=this.model.original.notebook,n=this.model.modified.notebook,r={metadataStatusHeight:this.configurationService.getValue("notebook.diff.ignoreMetadata")?0:25,outputStatusHeight:this.configurationService.getValue("notebook.diff.ignoreOutputs")||n.transientOptions.transientOutputs?0:25,fontInfo:this.fontInfo},s=[];return this.notebookMetadataViewModel=this._register(new gAe(this.model.original.notebook,this.model.modified.notebook,t?"modifiedMetadata":"unchangedMetadata",this.eventDispatcher,r,this.notebookService,this.diffEditorHeightCalculator)),this.ignoreMetadata||(t&&await this.notebookMetadataViewModel.computeHeights(),s.push(this.notebookMetadataViewModel)),(await Promise.all(e.map(async c=>{switch(c.type){case"delete":return new nit(o,n,o.cells[c.originalCellIndex],void 0,"delete",this.eventDispatcher,r,this.notebookService,this.configurationService,this.diffEditorHeightCalculator,c.originalCellIndex);case"insert":return new nit(n,o,void 0,n.cells[c.modifiedCellIndex],"insert",this.eventDispatcher,r,this.notebookService,this.configurationService,this.diffEditorHeightCalculator,c.modifiedCellIndex);case"modified":{let u=new bx(this.model.modified.notebook,this.model.original.notebook,o.cells[c.originalCellIndex],n.cells[c.modifiedCellIndex],"modified",this.eventDispatcher,r,this.notebookService,this.configurationService,c.originalCellIndex,this.diffEditorHeightCalculator);return await u.computeEditorHeights(),u}case"unchanged":return new bx(this.model.modified.notebook,this.model.original.notebook,o.cells[c.originalCellIndex],n.cells[c.modifiedCellIndex],"unchanged",this.eventDispatcher,r,this.notebookService,this.configurationService,c.originalCellIndex,this.diffEditorHeightCalculator)}}))).forEach(c=>s.push(c)),s}};function iZo(a,i,e){let t=e.changes;for(let o=0;o<e.changes.length-1;o++){let n=t[o],r=t[o+1],s=n.originalStart,l=n.modifiedStart;n.originalLength===1&&n.modifiedLength===0&&r.originalStart===s+2&&r.originalLength===0&&r.modifiedStart===l+1&&r.modifiedLength===1&&a.cells[s].getHashValue()===i.cells[l+1].getHashValue()&&a.cells[s+1].getHashValue()===i.cells[l].getHashValue()&&(n.originalStart=s,n.originalLength=0,n.modifiedStart=l,n.modifiedLength=1,r.originalStart=s+1,r.originalLength=1,r.modifiedStart=l+2,r.modifiedLength=0,o++)}}function oZo(a,i,e){if(a.length!==i.length)return!1;let t=e.original.notebook,o=e.modified.notebook;for(let n=0;n<i.length;n++){let r=a[n],s=i[n];if(r.type!==s.type)return!1;switch(r.type){case"delete":{if(t.cells[r.originalCellIndex].handle!==s.original?.handle)return!1;continue}case"insert":{if(o.cells[r.modifiedCellIndex].handle!==s.modified?.handle)return!1;continue}default:{if(t.cells[r.originalCellIndex].handle!==s.original?.handle||o.cells[r.modifiedCellIndex].handle!==s.modified?.handle)return!1;continue}}}return!0}var ait=class extends xk{constructor(e,t,o,n,r,s,l){super(e,t,o,void 0,l);this.type=n;this.containerType=r;this.kind=s}},Rhe=class extends ait{constructor(i,e,t,o){super(i,e,e||i,t,o,"Cell",{[k8.key]:"Cell",[E8.key]:t})}},Tte=class extends ait{constructor(i,e,t,o){super(i,e,e||i,t,o,"Metadata",{[k8.key]:"Metadata",[E8.key]:t})}},_te=class extends ait{constructor(i,e,t,o){super(i,e,e||i,t,o,"Output",{[k8.key]:"Output",[E8.key]:t})}};var Dte=class{constructor(i,e,t,o){this.lineHeight=i;this.textModelResolverService=e;this.editorWorkerService=t;this.configurationService=o}async diffAndComputeHeight(i,e){let[t,o]=await Promise.all([this.textModelResolverService.createModelReference(i),this.textModelResolverService.createModelReference(e)]);try{let n=await this.editorWorkerService.computeDiff(i,e,{ignoreTrimWhitespace:!0,maxComputationTimeMs:0,computeMoves:!1},"advanced").then(y=>y?.changes||[]),r=this.configurationService.getValue("diffEditor.hideUnchangedRegions.enabled"),s=this.configurationService.getValue("diffEditor.hideUnchangedRegions.minimumLineCount"),l=this.configurationService.getValue("diffEditor.hideUnchangedRegions.contextLineCount"),c=t.object.textEditorModel.getLineCount(),u=o.object.textEditorModel.getLineCount(),p=r?gY.fromDiffs(n,c,u,s??3,l??3):[],h=n.reduce((y,w)=>w.original.isEmpty&&!w.modified.isEmpty?y+w.modified.length:!w.original.isEmpty&&!w.modified.isEmpty&&w.modified.length>w.original.length?y+w.modified.length-w.original.length:y,0),g=t.object.textEditorModel.getLineCount(),f=p.reduce((y,w)=>y+w.lineCount,0),b=p.length*tgo,S=g+h-f;return S*this.lineHeight+nN(S).top+nN(S).bottom+b}finally{t.dispose(),o.dispose()}}computeHeightFromLines(i){return i*this.lineHeight+nN(i).top+nN(i).bottom}};Dte=I([m(1,Bt),m(2,Qs),m(3,B)],Dte);var b1t=le("INotebookOriginalCellModelFactory"),lit=class extends uC{constructor(e,t){super();this.modelService=e;this._languageService=t}createReferencedObject(e,t,o,n,r){let s=`${t.scheme}-chat-edit`,l=A.from({scheme:s,fragment:t.fragment,path:t.path}),c=this._languageService.getLanguageIdByLanguageName(n)?this._languageService.createById(n):r===1?this._languageService.createById("markdown"):null;return this.modelService.createModel(o,c,l)}destroyReferencedObject(e,t){t.dispose()}};lit=I([m(0,Tt),m(1,_t)],lit);var xAe=class{constructor(i){this._data=i.createInstance(lit)}getOrCreate(i,e,t,o){return this._data.acquire(i.toString(),i,e,t,o)}};xAe=I([m(0,F)],xAe);var kAe=class extends N{constructor(e,t,o,n,r,s){super();this.modifiedCell=t;this.originalCell=o;this.editor=n;this._editorWorkerService=r;this.originalCellModelFactory=s;this._viewZones=[];this.throttledDecorator=this.add(new ya(50));this.perEditorDisposables=this.add(new N);let l=ui(e.onDidChangeVisibleRanges,()=>e.visibleRanges),c=ke(u=>{if(!l.read(u).map(f=>e.getCellsInRange(f)).flat().map(f=>f.handle).includes(t.handle))return;let g=e.codeEditors.find(f=>f[0].handle===t.handle)?.[1];if(g?.getModel()===this.modifiedCell.textModel)return g});this.add(il((u,p)=>{let h=c.read(u);this.perEditorDisposables.clear(),h&&(p.add(h.onDidChangeModel(()=>{this.perEditorDisposables.clear()})),p.add(h.onDidChangeModelContent(()=>{this.update(h)})),p.add(h.onDidChangeConfiguration(g=>{(g.hasChanged(59)||g.hasChanged(75))&&this.update(h)})),this.update(h))}))}update(e){this.throttledDecorator.trigger(()=>this._updateImpl(e))}async _updateImpl(e){if(this.isDisposed)return;if(e.getOption(70)){this.perEditorDisposables.clear();return}let t=e.getModel();if(!t||t!==this.modifiedCell.textModel){this.perEditorDisposables.clear();return}let o=this.getOrCreateOriginalModel(e);if(!o){this.perEditorDisposables.clear();return}let n=t.getVersionId(),r=await this._editorWorkerService.computeDiff(o.uri,t.uri,{computeMoves:!0,ignoreTrimWhitespace:!1,maxComputationTimeMs:Number.MAX_SAFE_INTEGER},"advanced");this.isDisposed||(r&&!r.identical&&this.modifiedCell.textModel&&o&&t===e.getModel()&&e.getModel()?.getVersionId()===n?this._updateWithDiff(e,o,r,this.modifiedCell.textModel):this.perEditorDisposables.clear())}getOrCreateOriginalModel(e){if(!this._originalModel){let t=e.getModel();if(!t)return;this._originalModel=this.add(this.originalCellModelFactory.getOrCreate(t.uri,this.originalCell.getValue(),t.getLanguageId(),this.modifiedCell.cellKind)).object}return this._originalModel}_updateWithDiff(e,t,o,n){if(nZo(o,this.diffForPreviouslyAppliedDecorators))return;this.perEditorDisposables.clear();let r=e.createDecorationsCollection();this.perEditorDisposables.add(Z(()=>{e.changeViewZones(g=>{for(let f of this._viewZones)g.removeZone(f)}),this._viewZones=[],r.clear(),this.diffForPreviouslyAppliedDecorators=void 0})),this.diffForPreviouslyAppliedDecorators=o;let s=mo.createDynamic({...tce,stickiness:1}),l=mo.createDynamic({...ACe,stickiness:1}),c=(g,f)=>mo.createDynamic({description:"chat-editing-decoration",overviewRuler:{color:Yu(g),position:1},minimap:{color:Yu(f),position:2}}),u=c(gJ,ETe),p=c(fJ,TTe),h=c(vJ,_Te);e.changeViewZones(g=>{for(let w of this._viewZones)g.removeZone(w);this._viewZones=[];let f=[],v=t.mightContainNonBasicASCII(),b=t.mightContainRTL(),S=OE.fromEditor(this.editor),y=n.getLineCount();for(let w of o.changes){let k=w.original;t.tokenization.forceTokenization(Math.max(1,k.endLineNumberExclusive-1));let T=new NE(k.mapToLineArray(G=>t.tokenization.getLineTokens(G)),[],v,b),P=[];for(let G of w.innerChanges||[])P.push(new CE(G.originalRange.delta(-(w.original.startLineNumber-1)),jj.className,0)),!(G.originalRange.isEmpty()&&G.originalRange.startLineNumber===1&&G.modifiedRange.endLineNumber===y)&&!G.modifiedRange.isEmpty()&&f.push({range:G.modifiedRange,options:s});let O=P.length===1&&P[0].range.isEmpty()&&w.original.startLineNumber===1;!w.modified.isEmpty&&!(O&&w.modified.endLineNumberExclusive-1===y)&&f.push({range:w.modified.toInclusiveRange(),options:l}),w.original.isEmpty?f.push({range:w.modified.toInclusiveRange(),options:p}):w.modified.isEmpty?f.push({range:new z(w.modified.startLineNumber-1,1,w.modified.startLineNumber,1),options:h}):f.push({range:w.modified.toInclusiveRange(),options:u});let V=document.createElement("div");V.className="chat-editing-original-zone view-lines line-delete monaco-mouse-cursor-text";let H=lR(T,S,P,V);if(!O){let G={afterLineNumber:w.modified.startLineNumber-1,heightInLines:H.heightInLines,domNode:V,ordinal:50002};this._viewZones.push(g.addZone(G))}}r.set(f)})}};kAe=I([m(4,Qs),m(5,b1t)],kAe);function nZo(a,i){return a&&i?!(a.changes.length!==i.changes.length||a.moves.length!==i.moves.length||!rgo(a.changes,i.changes)||!a.moves.some((e,t)=>{let o=i.moves[t];return!rgo(e.changes,o.changes)||e.lineRangeMapping.changedLineCount!==o.lineRangeMapping.changedLineCount||!e.lineRangeMapping.modified.equals(o.lineRangeMapping.modified)||!e.lineRangeMapping.original.equals(o.lineRangeMapping.original)})):!a&&!i}function rgo(a,i){return!(a.length!==i.length||a.some((e,t)=>{let o=i[t];return!!(e.changedLineCount!==o.changedLineCount||(e.innerChanges||[]).length!==(o.innerChanges||[]).length||(e.innerChanges||[]).some((n,r)=>{let s=o.innerChanges[r];return!n.modifiedRange.equalsRange(s.modifiedRange)||!n.originalRange.equalsRange(s.originalRange)}))}))}var rZo=pf("notebookRenderer",{createHTML:a=>a}),Lte=class extends x{constructor(e,t,o,n){super();this._notebookEditor=e;this.toolbar=t;this.languageService=o;this.instantiationService=n;this.zoneRemover=this._register(new N);this.createdViewZones=new Map;this.deletedCellInfos=new Map}getTop(e){let t=this.deletedCellInfos.get(e);if(!t)return;if(t.previousIndex===-1)return 0;let o=this._notebookEditor.getCellsInRange({start:t.previousIndex,end:t.previousIndex+1});if(!o.length)return this._notebookEditor.getLayoutInfo().height+t.offset;let n=o[0],r=this._notebookEditor.getHeightOfElement(n);return this._notebookEditor.getAbsoluteTopOfElement(n)+r+t.offset}reveal(e){let t=this.getTop(e);if(typeof t=="number"){this._notebookEditor.focusContainer(),this._notebookEditor.revealOffsetInCenterIfOutsideViewport(t);let o=this.deletedCellInfos.get(e);if(o){let n=o.previousIndex===-1?0:o.previousIndex;this._notebookEditor.setFocus({start:n,end:n}),this._notebookEditor.setSelections([{start:n,end:n}])}}}apply(e,t){this.clear();let o=-1,n={cells:[],index:0};e.forEach(r=>{if(r.type==="delete"){let s=t.cells[r.originalCellIndex];s&&(n.cells.push({cell:s,originalIndex:r.originalCellIndex,previousIndex:o}),n.index=o)}else n.cells.length&&(this._createWidget(n.index+1,n.cells),n.cells.length=0),o=r.modifiedCellIndex}),n.cells.length&&this._createWidget(n.index+1,n.cells)}clear(){this.deletedCellInfos.clear(),this.zoneRemover.clear()}_createWidget(e,t){this._createWidgetImpl(e,t)}async _createWidgetImpl(e,t){let o=document.createElement("div"),n=[],r=await Promise.all(t.map(async l=>{let c=new cit(this._notebookEditor,this.toolbar,l.cell.getValue(),l.cell.language,o,l.originalIndex,this.languageService,this.instantiationService);n.push(c);let u=await c.render();return this.deletedCellInfos.set(l.originalIndex,{height:u,previousIndex:l.previousIndex,offset:0}),u}));Array.from(this.deletedCellInfos.keys()).sort((l,c)=>l-c).forEach(l=>{let c=this.deletedCellInfos.get(l-1);if(c){let u=this.deletedCellInfos.get(l);u&&(u.offset=c.height+c.offset)}});let s=r.reduce((l,c)=>l+c,0);this._notebookEditor.changeViewZones(l=>{let c={afterModelPosition:e,heightInPx:s+4,domNode:o},u=l.addZone(c);l.layoutZone(u),this.createdViewZones.set(e,u);let p=this._notebookEditor.deltaCellDecorations([],[{viewZoneId:u,options:{overviewRuler:{color:vJ,position:2}}}]);this.zoneRemover.add(Z(()=>{this.createdViewZones.get(e)===u&&this.createdViewZones.delete(e),this._notebookEditor.isDisposed||(this._notebookEditor.changeViewZones(h=>{h.removeZone(u),Be(n)}),this._notebookEditor.deltaCellDecorations(p,[]))}))})}};Lte=I([m(2,_t),m(3,F)],Lte);var cit=class extends x{constructor(e,t,o,n,r,s,l,c){super();this._notebookEditor=e;this._toolbarOptions=t;this.code=o;this.language=n;this._originalIndex=s;this.languageService=l;this.instantiationService=c;this.container=M(r,document.createElement("div")),this._register(Z(()=>{r.removeChild(this.container)}))}async render(){let e=this.code,t=this.language,o=await fz(this.languageService,e,t),n=this._notebookEditor.getBaseCellEditorOptions(t).value,r="--notebook-editor-font-family",s="--notebook-editor-font-size",l="--notebook-editor-font-weight",u=this._notebookEditor.codeEditors.map(T=>T[1]).find(T=>T)?.getOptions().get(165),p=`font-family: var(${r});font-weight: var(${l});font-size: var(${s});`+n.lineHeight?`line-height: ${n.lineHeight}px;`:""+u?.contentLeft?`margin-left: ${u}px;`:"white-space: pre;",h=this.container;if(h.classList.add("code-cell-row"),this._toolbarOptions){let T=document.createElement("div");T.className=this._toolbarOptions.className,h.appendChild(T);let O=this._register(this.instantiationService.createChild(new _o([X,this._notebookEditor.scopedContextKeyService]))).createInstance(or,T,this._toolbarOptions.menuId,{telemetrySource:this._toolbarOptions.telemetrySource,hiddenItemStrategy:-1,toolbarOptions:{primaryGroup:()=>!0},menuOptions:{renderShortTitle:!0,arg:this._toolbarOptions.argFactory(this._originalIndex)},actionViewItemProvider:this._toolbarOptions.actionViewItemProvider});this._store.add(O),T.style.position="absolute",T.style.right="40px",T.style.zIndex="10",T.classList.add("hover")}let g=M(h,_(".cell-inner-container"));g.style.position="relative";let f=M(g,_(".cell-focus-indicator.cell-focus-indicator-side.cell-focus-indicator-left")),v=M(g,_(".cell.code"));M(f,_("div.execution-count-label"));let b=M(v,_(".cell-editor-part")),S=M(b,_(".cell-editor-container"));return S=M(S,_(".code",{style:p})),n.fontFamily&&S.style.setProperty(r,n.fontFamily),n.fontSize&&S.style.setProperty(s,`${n.fontSize}px`),n.fontWeight&&S.style.setProperty(l,n.fontWeight),S.innerHTML=rZo?.createHTML(o)||o,yc(e).length*(n.lineHeight||igo)+12+12+16+16}};cit=I([m(6,_t),m(7,F)],cit);var EAe=class extends x{constructor(e){super();this.notebookEditor=e;this.decorators=this._register(new N)}apply(e){let t=this.notebookEditor.textModel;if(!t)return;let o=e.filter(r=>r.type==="insert").map(r=>t.cells[r.modifiedCellIndex]),n=this.notebookEditor.deltaCellDecorations([],o.map(r=>({handle:r.handle,options:{className:"nb-insertHighlight",outputClassName:"nb-insertHighlight",overviewRuler:{color:fJ,modelRanges:[],includeOutput:!0,position:7}}})));this.clear(),this.decorators.add(Z(()=>{this.notebookEditor.isDisposed||this.notebookEditor.deltaCellDecorations(n,[])}))}clear(){this.decorators.clear()}};var sgo=le("INotebookOriginalModelReferenceFactory"),dit=class extends uC{constructor(e,t){super();this.notebookService=e;this.modelService=t;this.modelsToDispose=new Set}async createReferencedObject(e,t,o){this.modelsToDispose.delete(e);let n=t.originalURI,r=this.notebookService.getNotebookTextModel(n);if(r)return r;let s=await this.modelService.createModelReference(n),l=qe.fromString(s.object.textEditorModel.getValue()),c=v_(l);return s.dispose(),this.notebookService.createNotebookTextModel(o,n,c)}destroyReferencedObject(e,t){this.modelsToDispose.add(e),(async()=>{try{let o=await t;if(!this.modelsToDispose.has(e))return;o.dispose()}catch{}finally{this.modelsToDispose.delete(e)}})()}};dit=I([m(0,bn),m(1,Bt)],dit);var TAe=class{constructor(i){this.instantiationService=i;this._resourceModelCollection=void 0;this._asyncModelCollection=void 0}get resourceModelCollection(){return this._resourceModelCollection||(this._resourceModelCollection=this.instantiationService.createInstance(dit)),this._resourceModelCollection}get asyncModelCollection(){return this._asyncModelCollection||(this._asyncModelCollection=new VSe(this.resourceModelCollection)),this._asyncModelCollection}getOrCreate(i,e){return this.asyncModelCollection.acquire(i.originalURI.toString(),i,e)}};TAe=I([m(0,F)],TAe);var Rte=class extends x{constructor(e,t,o,n){super();this.notebookEditor=e;this.notebookEditorWorkerService=t;this.instantiationService=o;this.logService=n;this.cellDecorators=new Map;this.listeners=[];this.logService.debug("inlineDiff","Watching for previous model"),this._register(be(r=>{this.previous=this.notebookEditor.notebookOptions.previousModelToCompare.read(r),this.previous&&(this.logService.debug("inlineDiff","Previous model set"),this.notebookEditor.hasModel()?this.initialize():(this.logService.debug("inlineDiff","Waiting for model to attach"),this.listeners.push(U.once(this.notebookEditor.onDidAttachViewModel)(()=>this.initialize()))))}))}static{this.ID="workbench.notebook.inlineDiffDecoration"}clear(){this.listeners.forEach(e=>e.dispose()),this.cellDecorators.forEach((e,t)=>{e.dispose(),this.cellDecorators.delete(t)}),this.insertedCellDecorator?.dispose(),this.deletedCellDecorator?.dispose(),this.cachedNotebookDiff=void 0,this.listeners=[],this.logService.debug("inlineDiff","Cleared decorations and listeners")}dispose(){this.logService.debug("inlineDiff","Disposing"),this.clear(),super.dispose()}initialize(){if(this.clear(),!this.previous)return;this.insertedCellDecorator=this.instantiationService.createInstance(EAe,this.notebookEditor),this.deletedCellDecorator=this.instantiationService.createInstance(Lte,this.notebookEditor,void 0),this._update();let e=U.debounce(this.notebookEditor.onDidChangeVisibleRanges,t=>t,100,void 0,void 0,void 0,this._store);if(this.listeners.push(e(()=>this._update())),this.listeners.push(this.notebookEditor.onDidChangeModel(()=>this._update())),this.notebookEditor.textModel){let t=U.debounce(this.notebookEditor.textModel.onDidChangeContent,(n,r)=>r,100,void 0,void 0,void 0,this._store),o=U.debounce(this.previous.onDidChangeContent,(n,r)=>r,100,void 0,void 0,void 0,this._store);this.listeners.push(t(()=>this._update())),this.listeners.push(o(()=>this._update()))}this.logService.debug("inlineDiff","Initialized")}async _update(){let e=this.notebookEditor.getViewModel()?.notebookDocument;if(!this.previous||!e){this.logService.debug("inlineDiff","Update skipped - no original or current document");return}if(!this.cachedNotebookDiff||this.cachedNotebookDiff.originalVersion!==this.previous.versionId||this.cachedNotebookDiff.version!==e.versionId){let t={cellDiffInfo:[]};try{let o=await this.notebookEditorWorkerService.computeDiff(this.previous.uri,e.uri);t=wAe(this.previous,e,o)}catch(o){this.logService.error("inlineDiff",`Error computing diff:
`+o);return}this.cachedNotebookDiff={cellDiffInfo:t.cellDiffInfo,originalVersion:this.previous.versionId,version:e.versionId},this.insertedCellDecorator?.apply(t.cellDiffInfo),this.deletedCellDecorator?.apply(t.cellDiffInfo,this.previous)}await this.updateCells(this.previous,e,this.cachedNotebookDiff.cellDiffInfo)}async updateCells(e,t,o){let n=new Set;o.forEach(r=>{if(r.type==="modified"){let s=t.cells[r.modifiedCellIndex],l=e.cells[r.originalCellIndex],c=this.notebookEditor.codeEditors.find(([u])=>u.handle===s.handle)?.[1];if(c){let u=this.cellDecorators.get(s);if(u?.modifiedCell!==s||u?.originalCell!==l){u?.dispose();let p=this.instantiationService.createInstance(kAe,this.notebookEditor,s,l,c);this.cellDecorators.set(s,p),n.add(p),this._register(c.onDidDispose(()=>{p.dispose(),this.cellDecorators.get(s)===p&&this.cellDecorators.delete(s)}))}else u&&n.add(u)}}}),this.cellDecorators.forEach((r,s)=>{n.has(r)||(r.dispose(),this.cellDecorators.delete(s))})}};Rte=I([m(1,kG),m(2,F),m(3,Uv)],Rte);bm(Rte.ID,Rte);Ee(sgo,TAe,1);Ee(b1t,xAe,1);var _Ae=class extends x{constructor(e,t,o,n,r,s,l){super();this.rootElement=e;this.groupId=t;this.window=o;this.options=n;this.dimension=r;this.instantiationService=s;this.widgetService=l;this.widget={value:void 0}}get editorWidget(){return this.widget.value}async show(e,t,o,n){this.widget.value||this.createNotebookWidget(e,this.groupId,this.rootElement),this.dimension&&this.widget.value?.layout(this.dimension,this.rootElement,this.position),t&&(await this.widget.value?.setOptions({...n}),this.widget.value?.notebookOptions.previousModelToCompare.set(o,void 0),await this.widget.value.setModel(t,n?.viewState))}hide(){this.widget.value&&(this.widget.value.notebookOptions.previousModelToCompare.set(void 0,void 0),this.widget.value.onWillHide())}setLayout(e,t){this.dimension=e,this.position=t}createNotebookWidget(e,t,o){let n=b8.getSomeEditorContributions([Rte.ID]),r={notebookToolbar:D.NotebookToolbar,cellTitleToolbar:D.NotebookCellTitle,cellDeleteToolbar:D.NotebookCellDelete,cellInsertToolbar:D.NotebookCellBetween,cellTopInsertToolbar:D.NotebookCellListTop,cellExecuteToolbar:D.NotebookCellExecute,cellExecutePrimary:void 0},s=["editor.contrib.review","editor.contrib.floatingClickMenu","editor.contrib.dirtydiff","editor.contrib.testingOutputPeek","editor.contrib.testingDecorations","store.contrib.stickyScrollController","editor.contrib.findController","editor.contrib.emptyTextEditorHint"],l=Ba.getEditorContributions().filter(c=>s.indexOf(c.id)===-1);this.widget=this.instantiationService.invokeFunction(this.widgetService.retrieveWidget,t,e,{contributions:n,menuIds:r,cellEditorContributions:l,options:this.options},this.dimension,this.window),this.rootElement&&this.widget.value.getDomNode()&&(this.rootElement.setAttribute("aria-flowto",this.widget.value.getDomNode().id||""),dO(this.widget.value.getDomNode(),this.rootElement))}dispose(){super.dispose(),this.widget.value&&this.widget.value.dispose()}};_Ae=I([m(5,F),m(6,Gc)],_Ae);var sZo=_,cTi=class a{constructor(i){this.selections=i}compare(i){if(!(i instanceof a))return 3;if(this.selections.length!==i.selections.length)return 3;for(let e=0;e<this.selections.length;e++)if(this.selections[e]!==i.selections[e])return 3;return 1}restore(i){let e={cellSelections:Gde(this.selections)};return Object.assign(e,i),e}},nh=class extends Ts{constructor(e,t,o,n,r,s,l,c,u,p){super(nh.ID,e,l,o,c);this.instantiationService=t;this.contextKeyService=n;this.notebookEditorWorkerService=r;this.configurationService=s;this.notebookService=u;this.editorService=p;this.creationOptions=kte();this._dimension=void 0;this._modifiedWebview=null;this._originalWebview=null;this._webviewTransparentCover=null;this._inlineView=!1;this._onMouseUp=this._register(new E);this.onMouseUp=this._onMouseUp.event;this._onDidScroll=this._register(new E);this.onDidScroll=this._onDidScroll.event;this.onDidChangeScroll=this._onDidScroll.event;this._model=null;this._modifiedResourceDisposableStore=this._register(new N);this._insetModifyQueueByOutputId=new Nx;this._onDidDynamicOutputRendered=this._register(new E);this.onDidDynamicOutputRendered=this._onDidDynamicOutputRendered.event;this._localStore=this._register(new N);this._onDidChangeSelection=this._register(new E);this.onDidChangeSelection=this._onDidChangeSelection.event;this._isDisposed=!1;this._currentChangedIndex=Me(this,-1);this.currentChangedIndex=this._currentChangedIndex;this.pendingLayouts=new WeakMap;this.diffEditorCalcuator=this.instantiationService.createInstance(Dte,this.fontInfo.lineHeight),this._notebookOptions=t.createInstance(VT,this.window,!1,void 0),this._register(this._notebookOptions),this._revealFirst=!0}static{this.ENTIRE_DIFF_OVERVIEW_WIDTH=30}static{this.ID=TX}get textModel(){return this._model?.modified.notebook}get inlineNotebookEditor(){if(this._inlineView)return this.inlineDiffWidget?.editorWidget}get notebookOptions(){return this._notebookOptions}get isDisposed(){return this._isDisposed}get fontInfo(){return this._fontInfo||(this._fontInfo=this.createFontInfo()),this._fontInfo}createFontInfo(){let e=this.configurationService.getValue("editor");return iw.readFontInfo(this.window,QS(e,bu.getInstance(this.window).value))}isOverviewRulerEnabled(){return this.configurationService.getValue(yt.diffOverviewRuler)??!1}getSelection(){let e=this._list.getFocus();return new cTi(e)}toggleNotebookCellSelection(e){}updatePerformanceMetadata(e,t,o,n){}async focusNotebookCell(e,t){}async focusNextNotebookCell(e,t){}didFocusOutputInputChange(e){}getScrollTop(){return this._list?.scrollTop??0}getScrollHeight(){return this._list?.scrollHeight??0}getScrollPosition(){return{scrollTop:this.getScrollTop(),scrollLeft:this._list?.scrollLeft??0}}setScrollPosition(e){this._list&&(this._list.scrollTop=e.scrollTop,e.scrollLeft!==void 0&&(this._list.scrollLeft=e.scrollLeft))}delegateVerticalScrollbarPointerDown(e){this._list?.delegateVerticalScrollbarPointerDown(e)}updateOutputHeight(e,t,o,n){let r=e.diffElement,s=this.getCellByInfo(e),l=s.outputsViewModels.indexOf(t);if(r instanceof bx){let c=Zo.parse(e.cellUri);if(!c)return;r.updateOutputHeight(c.notebook.toString()===this._model?.original.resource.toString()?0:1,l,o)}else r.updateOutputHeight(r.type==="insert"?1:0,l,o);n&&this._onDidDynamicOutputRendered.fire({cell:s,output:t})}setMarkupCellEditState(e,t){}didStartDragMarkupCell(e,t){}didDragMarkupCell(e,t){}didEndDragMarkupCell(e){}didDropMarkupCell(e){}didResizeOutput(e){}async toggleInlineView(){this._layoutCancellationTokenSource?.dispose(),this._inlineView=!this._inlineView,this._lastLayoutProperties&&(this._inlineView?(this.layout(this._lastLayoutProperties?.dimension,this._lastLayoutProperties?.position),this.inlineDiffWidget?.show(this.input,this._model?.modified.notebook,this._model?.original.notebook,this._options)):(this.layout(this._lastLayoutProperties?.dimension,this._lastLayoutProperties?.position),this.inlineDiffWidget?.hide()),this._layoutCancellationTokenSource=new Ye,this.updateLayout(this._layoutCancellationTokenSource.token))}createEditor(e){this._rootElement=M(e,_(".notebook-text-diff-editor")),this._overflowContainer=document.createElement("div"),this._overflowContainer.classList.add("notebook-overflow-widget-container","monaco-editor"),M(e,this._overflowContainer);let t=[this.instantiationService.createInstance(R8,this),this.instantiationService.createInstance(M8,this),this.instantiationService.createInstance(D8,this),this.instantiationService.createInstance(L8,this)];this._listViewContainer=M(this._rootElement,_(".notebook-diff-list-view")),this._list=this.instantiationService.createInstance(IAe,"NotebookTextDiff",this._listViewContainer,this.instantiationService.createInstance(SAe,this.window),t,this.contextKeyService,{setRowLineHeight:!1,setRowHeight:!1,supportDynamicHeights:!0,horizontalScrolling:!1,keyboardSupport:!1,mouseSupport:!0,multipleSelectionSupport:!1,typeNavigationEnabled:!0,paddingBottom:0,styleController:o=>this._list,overrideStyles:{listBackground:Ho,listActiveSelectionBackground:Ho,listActiveSelectionForeground:To,listFocusAndSelectionBackground:Ho,listFocusAndSelectionForeground:To,listFocusBackground:Ho,listFocusForeground:To,listHoverForeground:To,listHoverBackground:Ho,listHoverOutline:Sd,listFocusOutline:Sd,listInactiveSelectionBackground:Ho,listInactiveSelectionForeground:To,listInactiveFocusBackground:Ho,listInactiveFocusOutline:Ho},accessibilityProvider:{getAriaLabel(){return null},getWidgetAriaLabel(){return d(12578,null)}}}),this.inlineDiffWidget=this._register(this.instantiationService.createInstance(_Ae,this._rootElement,this.group.id,this.window,this.notebookOptions,this._dimension)),this._register(this._list),this._register(this._list.onMouseUp(o=>{o.element&&(typeof o.index=="number"&&this._list.setFocus([o.index]),this._onMouseUp.fire({event:o.browserEvent,target:o.element}))})),this._register(this._list.onDidScroll(()=>{this._onDidScroll.fire()})),this._register(this._list.onDidChangeFocus(()=>this._onDidChangeSelection.fire({reason:2}))),this._overviewRulerContainer=document.createElement("div"),this._overviewRulerContainer.classList.add("notebook-overview-ruler-container"),this._rootElement.appendChild(this._overviewRulerContainer),this._registerOverviewRuler(),this._webviewTransparentCover=M(this._list.rowsContainer,sZo(".webview-cover")),this._webviewTransparentCover.style.display="none",this._register(DIe(this._overflowContainer,o=>{o.target.classList.contains("slider")&&this._webviewTransparentCover&&(this._webviewTransparentCover.style.display="block")})),this._register(ygt(this._overflowContainer,()=>{this._webviewTransparentCover&&(this._webviewTransparentCover.style.display="none")})),this._register(this._list.onDidScroll(o=>{this._webviewTransparentCover.style.top=`${o.scrollTop}px`}))}_registerOverviewRuler(){this._overviewRuler=this._register(this.instantiationService.createInstance(yAe,this,nh.ENTIRE_DIFF_OVERVIEW_WIDTH,this._overviewRulerContainer))}_updateOutputsOffsetsInWebview(e,t,o,n,r){if(o.element.style.height=`${t}px`,o.insetMapping){let s=[],l=[];o.insetMapping.forEach((c,u)=>{let p=n(c.cellInfo.diffElement);if(!(!p||this._list.indexOf(c.cellInfo.diffElement)===void 0))if(p.outputsViewModels.indexOf(u)<0)l.push(u);else{let g=this._list.getCellViewScrollTop(c.cellInfo.diffElement),f=p.outputsViewModels.indexOf(u),v=c.cellInfo.diffElement.getOutputOffsetInCell(r,f);s.push({cell:p,output:u,cellTop:g,outputOffset:v,forceDisplay:!1})}}),o.removeInsets(l),s.length&&o.updateScrollTops(s,[])}}async setInput(e,t,o,n){this.inlineDiffWidget?.hide(),await super.setInput(e,t,o,n);let r=await e.resolve();this._model!==r&&(this._detachModel(),this._attachModel(r)),this._model=r,this._model!==null&&(this._inlineView?(this._listViewContainer.style.display="none",this.inlineDiffWidget?.show(e,r.modified.notebook,r.original.notebook,t)):(this._listViewContainer.style.display="block",this.inlineDiffWidget?.hide()),this._revealFirst=!0,this._modifiedResourceDisposableStore.clear(),this._layoutCancellationTokenSource=new Ye,this._modifiedResourceDisposableStore.add(U.any(this._model.original.notebook.onDidChangeContent,this._model.modified.notebook.onDidChangeContent)(s=>{this._model!==null&&this.editorService.activeEditor!==e&&(this._layoutCancellationTokenSource?.dispose(),this._layoutCancellationTokenSource=new Ye,this.updateLayout(this._layoutCancellationTokenSource.token))})),await this._createOriginalWebview(xt(),this._model.original.viewType,this._model.original.resource),this._originalWebview&&this._modifiedResourceDisposableStore.add(this._originalWebview),await this._createModifiedWebview(xt(),this._model.modified.viewType,this._model.modified.resource),this._modifiedWebview&&this._modifiedResourceDisposableStore.add(this._modifiedWebview),await this.updateLayout(this._layoutCancellationTokenSource.token,t?.cellSelections?Yf(t.cellSelections):void 0))}setVisible(e){super.setVisible(e),e||this.inlineDiffWidget?.hide()}_detachModel(){this._localStore.clear(),this._originalWebview?.dispose(),this._originalWebview?.element.remove(),this._originalWebview=null,this._modifiedWebview?.dispose(),this._modifiedWebview?.element.remove(),this._modifiedWebview=null,this.notebookDiffViewModel?.dispose(),this.notebookDiffViewModel=void 0,this._modifiedResourceDisposableStore.clear(),this._list.clear()}_attachModel(e){this._model=e,this._eventDispatcher=new hAe;let t=()=>{Wr(this.window,()=>{this._isDisposed||(this._modifiedWebview&&this._updateOutputsOffsetsInWebview(this._list.scrollTop,this._list.scrollHeight,this._modifiedWebview,n=>n.modified,1),this._originalWebview&&this._updateOutputsOffsetsInWebview(this._list.scrollTop,this._list.scrollHeight,this._originalWebview,n=>n.original,0))})};this._localStore.add(this._list.onDidChangeContentHeight(()=>{t()})),this._localStore.add(this._list.onDidChangeFocus(n=>{if(n.indexes.length&&this.notebookDiffViewModel&&n.indexes[0]<this.notebookDiffViewModel.items.length){let r=this.notebookDiffViewModel.items[n.indexes[0]],s=this.notebookDiffViewModel.items.filter(l=>l.type!=="unchanged"&&l.type!=="unchangedMetadata"&&l.type!=="placeholder");if(r&&r?.type!=="placeholder"&&r?.type!=="unchanged"&&r?.type!=="unchangedMetadata")return this._currentChangedIndex.set(s.indexOf(r),void 0)}return this._currentChangedIndex.set(-1,void 0)})),this._localStore.add(this._eventDispatcher.onDidChangeCellLayout(()=>{t()}));let o=this.notebookDiffViewModel=this._register(new CAe(this._model,this.notebookEditorWorkerService,this.configurationService,this._eventDispatcher,this.notebookService,this.diffEditorCalcuator,this.fontInfo,void 0));this._localStore.add(this.notebookDiffViewModel.onDidChangeItems(n=>{this._originalWebview?.removeInsets([...this._originalWebview?.insetMapping.keys()]),this._modifiedWebview?.removeInsets([...this._modifiedWebview?.insetMapping.keys()]),this._revealFirst&&typeof n.firstChangeIndex=="number"&&n.firstChangeIndex>-1&&n.firstChangeIndex<this._list.length&&(this._revealFirst=!1,this._list.setFocus([n.firstChangeIndex]),this._list.reveal(n.firstChangeIndex,.3)),this._list.splice(n.start,n.deleteCount,n.elements),this.isOverviewRulerEnabled()&&this._overviewRuler.updateViewModels(o.items,this._eventDispatcher)}))}async _createModifiedWebview(e,t,o){this._modifiedWebview?.dispose(),this._modifiedWebview=this.instantiationService.createInstance(oN,this,e,t,o,{...this._notebookOptions.computeDiffWebviewOptions(),fontFamily:this._generateFontFamily()},void 0),this._list.rowsContainer.insertAdjacentElement("afterbegin",this._modifiedWebview.element),this._modifiedWebview.createWebview(this.window),this._modifiedWebview.element.style.width="calc(50% - 16px)",this._modifiedWebview.element.style.left="calc(50%)"}_generateFontFamily(){return this.fontInfo.fontFamily??'"SF Mono", Monaco, Menlo, Consolas, "Ubuntu Mono", "Liberation Mono", "DejaVu Sans Mono", "Courier New", monospace'}async _createOriginalWebview(e,t,o){this._originalWebview?.dispose(),this._originalWebview=this.instantiationService.createInstance(oN,this,e,t,o,{...this._notebookOptions.computeDiffWebviewOptions(),fontFamily:this._generateFontFamily()},void 0),this._list.rowsContainer.insertAdjacentElement("afterbegin",this._originalWebview.element),this._originalWebview.createWebview(this.window),this._originalWebview.element.style.width="calc(50% - 16px)",this._originalWebview.element.style.left="16px"}setOptions(e){let t=e?.cellSelections?Yf(e.cellSelections):void 0;t&&this._list.setFocus(t)}async updateLayout(e,t){!this._model||!this.notebookDiffViewModel||(await this.notebookDiffViewModel.computeDiff(e),!e.isCancellationRequested&&t&&this._list.setFocus(t))}scheduleOutputHeightAck(e,t,o){let n=e.diffElement,r=0;if(n instanceof bx){let l=Zo.parse(e.cellUri);if(!l)return;r=l.notebook.toString()===this._model?.original.resource.toString()?0:1}else r=n.type==="insert"?1:0;let s=r===1?this._modifiedWebview:this._originalWebview;Wr(this.window,()=>{s?.ackHeight([{cellId:e.cellId,outputId:t,height:o}])},10)}layoutNotebookCell(e,t){let o=(l,c)=>{this._list.updateElementHeight2(l,c)},n=this.pendingLayouts.get(e);n&&this._localStore.delete(n);let r,s=Wr(this.window,()=>{this.pendingLayouts.delete(e),o(e,t),r()});return n=Z(()=>{s.dispose(),r()}),this._localStore.add(n),this.pendingLayouts.set(e,n),new Promise(l=>{r=l})}setScrollTop(e){this._list.scrollTop=e}triggerScroll(e){this._list.triggerScrollFromMouseWheelEvent(e)}firstChange(){if(!this.notebookDiffViewModel)return;let t=this.notebookDiffViewModel.items.findIndex(o=>o.type!=="unchanged"&&o.type!=="unchangedMetadata"&&o.type!=="placeholder");t>=0&&(this._list.setFocus([t]),this._list.reveal(t))}lastChange(){if(!this.notebookDiffViewModel)return;let e=this.notebookDiffViewModel.items,t=e.slice().reverse().find(n=>n.type!=="unchanged"&&n.type!=="unchangedMetadata"&&n.type!=="placeholder"),o=t?e.indexOf(t):-1;o>=0&&(this._list.setFocus([o]),this._list.reveal(o))}previousChange(){if(!this.notebookDiffViewModel)return;let e=this._list.getFocus()[0];(isNaN(e)||e<0)&&(e=0);let t=e-1,o=this.notebookDiffViewModel.items;for(;t>=0;){let n=o[t];if(n.type!=="unchanged"&&n.type!=="unchangedMetadata"&&n.type!=="placeholder")break;t--}if(t>=0)this._list.setFocus([t]),this._list.reveal(t);else{let n=o.findLastIndex(r=>r.type!=="unchanged"&&r.type!=="unchangedMetadata"&&r.type!=="placeholder");n>=0&&(this._list.setFocus([n]),this._list.reveal(n))}}nextChange(){if(!this.notebookDiffViewModel)return;let e=this._list.getFocus()[0];(isNaN(e)||e<0)&&(e=0);let t=e+1,o=this.notebookDiffViewModel.items;for(;t<o.length;){let n=o[t];if(n.type!=="unchanged"&&n.type!=="unchangedMetadata"&&n.type!=="placeholder")break;t++}if(t<o.length)this._list.setFocus([t]),this._list.reveal(t);else{let n=o.findIndex(r=>r.type!=="unchanged"&&r.type!=="unchangedMetadata"&&r.type!=="placeholder");n>=0&&(this._list.setFocus([n]),this._list.reveal(n))}}createOutput(e,t,o,n,r){this._insetModifyQueueByOutputId.queue(o.source.model.outputId+(r===1?"-right":"left"),async()=>{let s=r===1?this._modifiedWebview:this._originalWebview;if(s)if(s.insetMapping.has(o.source)){let l=this._list.getCellViewScrollTop(e),c=t.outputsViewModels.indexOf(o.source),u=e.getOutputOffsetInCell(r,c);s.updateScrollTops([{cell:t,output:o.source,cellTop:l,outputOffset:u,forceDisplay:!0}],[])}else{let l=this._list.getCellViewScrollTop(e);await s.createOutput({diffElement:e,cellHandle:t.handle,cellId:t.id,cellUri:t.uri},o,l,n())}})}updateMarkupCellHeight(){}getCellByInfo(e){return e.diffElement.getCellByUri(e.cellUri)}getCellById(e){throw new Error("Not implemented")}removeInset(e,t,o,n){this._insetModifyQueueByOutputId.queue(o.model.outputId+(n===1?"-right":"left"),async()=>{let r=n===1?this._modifiedWebview:this._originalWebview;r&&r.insetMapping.has(o)&&r.removeInsets([o])})}showInset(e,t,o,n){this._insetModifyQueueByOutputId.queue(o.model.outputId+(n===1?"-right":"left"),async()=>{let r=n===1?this._modifiedWebview:this._originalWebview;if(!r||!r.insetMapping.has(o))return;let s=this._list.getCellViewScrollTop(e),l=t.outputsViewModels.indexOf(o),c=e.getOutputOffsetInCell(n,l);r.updateScrollTops([{cell:t,output:o,cellTop:s,outputOffset:c,forceDisplay:!0}],[])})}hideInset(e,t,o){this._modifiedWebview?.hideInset(o),this._originalWebview?.hideInset(o)}getDomNode(){return this._rootElement}getOverflowContainerDomNode(){return this._overflowContainer}getControl(){return this}clearInput(){this.inlineDiffWidget?.hide(),super.clearInput(),this._modifiedResourceDisposableStore.clear(),this._list?.splice(0,this._list?.length||0),this._model=null,this.notebookDiffViewModel?.dispose(),this.notebookDiffViewModel=void 0}deltaCellOutputContainerClassNames(e,t,o,n){e===0?this._originalWebview?.deltaCellOutputContainerClassNames(t,o,n):this._modifiedWebview?.deltaCellOutputContainerClassNames(t,o,n)}getLayoutInfo(){if(!this._list)throw new Error("Editor is not initalized successfully");return{width:this._dimension.width,height:this._dimension.height,fontInfo:this.fontInfo,scrollHeight:this._list?.getScrollHeight()??0,stickyHeight:0,listViewOffsetTop:0}}layout(e,t){this._rootElement.classList.toggle("mid-width",e.width<1e3&&e.width>=600),this._rootElement.classList.toggle("narrow-width",e.width<600);let o=this.isOverviewRulerEnabled();this._dimension=e.with(e.width-(o?nh.ENTIRE_DIFF_OVERVIEW_WIDTH:0)),this._listViewContainer.style.height=`${e.height}px`,this._listViewContainer.style.width=`${this._dimension.width}px`,this._inlineView?(this._listViewContainer.style.display="none",this.inlineDiffWidget?.setLayout(e,t)):(this.inlineDiffWidget?.hide(),this._listViewContainer.style.display="block",this._list?.layout(this._dimension.height,this._dimension.width),this._modifiedWebview&&(this._modifiedWebview.element.style.width="calc(50% - 16px)",this._modifiedWebview.element.style.left="calc(50%)"),this._originalWebview&&(this._originalWebview.element.style.width="calc(50% - 16px)",this._originalWebview.element.style.left="16px"),this._webviewTransparentCover&&(this._webviewTransparentCover.style.height=`${this._dimension.height}px`,this._webviewTransparentCover.style.width=`${this._dimension.width}px`),o&&this._overviewRuler.layout()),this._lastLayoutProperties={dimension:e,position:t},this._eventDispatcher?.emit([new a1t({width:!0,fontInfo:!0},this.getLayoutInfo())])}dispose(){this._isDisposed=!0,this._layoutCancellationTokenSource?.dispose(),this._detachModel(),super.dispose()}};nh=I([m(1,F),m(2,Le),m(3,X),m(4,kG),m(5,B),m(6,Te),m(7,ce),m(8,bn),m(9,ee)],nh);Kk(0,10,"notebook-diff-view-viewport-slider");is((a,i)=>{let e=a.getColor(A5i);i.addRule(`
	.notebook-text-diff-editor .diagonal-fill {
		background-image: linear-gradient(
			-45deg,
			${e} 12.5%,
			#0000 12.5%, #0000 50%,
			${e} 50%, ${e} 62.5%,
			#0000 62.5%, #0000 100%
		);
		background-size: 8px 8px;
	}
	`),i.addRule(`.notebook-text-diff-editor .cell-body { margin: ${QD}px; }`),i.addRule(`.notebook-text-diff-editor .cell-placeholder-body { margin: ${QD}px 0; }`)});var DAe=class extends x{constructor(i,e,t){super(),this._workerManager=this._register(new dTi(i,e,t))}canComputeDiff(i,e){throw new Error("Method not implemented.")}computeDiff(i,e){return this._workerManager.withWorker().then(t=>t.computeDiff(i,e))}canPromptRecommendation(i){return this._workerManager.withWorker().then(e=>e.canPromptRecommendation(i))}};DAe=I([m(0,bn),m(1,Tt),m(2,Zy)],DAe);var dTi=class extends x{constructor(e,t,o){super();this._notebookService=e;this._modelService=t;this._webWorkerService=o;this._editorWorkerClient=null}withWorker(){return this._editorWorkerClient||(this._editorWorkerClient=new pTi(this._notebookService,this._modelService,this._webWorkerService),this._register(this._editorWorkerClient)),Promise.resolve(this._editorWorkerClient)}},uTi=class extends x{constructor(e,t,o){super();this._proxy=e;this._notebookService=t;this._modelService=o;this._syncedModels=Object.create(null);this._syncedModelsLastUsedTime=Object.create(null)}ensureSyncedResources(e){for(let t of e){let o=t.toString();this._syncedModels[o]||this._beginModelSync(t),this._syncedModels[o]&&(this._syncedModelsLastUsedTime[o]=new Date().getTime())}}_beginModelSync(e){let t=this._notebookService.listNotebookDocuments().find(c=>c.uri.toString()===e.toString());if(!t)return;let o=e.toString();this._proxy.$acceptNewModel(t.uri.toString(),t.metadata,t.transientOptions.transientDocumentMetadata,t.cells.map(c=>({handle:c.handle,url:c.uri.toString(),source:c.textBuffer.getLinesContent(),eol:c.textBuffer.getEOL(),versionId:c.textModel?.getVersionId()??0,language:c.language,mime:c.mime,cellKind:c.cellKind,outputs:c.outputs.map(u=>({outputId:u.outputId,outputs:u.outputs})),metadata:c.metadata,internalMetadata:c.internalMetadata})));let n=new N,r=c=>({handle:c.handle,url:c.uri.toString(),source:c.textBuffer.getLinesContent(),eol:c.textBuffer.getEOL(),versionId:0,language:c.language,cellKind:c.cellKind,outputs:c.outputs.map(u=>({outputId:u.outputId,outputs:u.outputs})),metadata:c.metadata,internalMetadata:c.internalMetadata}),s=new Set,l=c=>{s.add(c),n.add(c.onDidChangeContent(u=>{typeof u=="object"&&u.type==="model"&&this._proxy.$acceptCellModelChanged(o,c.handle,u.event)}))};t.cells.forEach(c=>l(c)),t.cells.length!==s.size&&n.add(this._modelService.onModelAdded(c=>{if(c.uri.scheme!==Q.vscodeNotebookCell||!(c instanceof ip))return;let u=Zo.parse(c.uri);if(!u||!Qe(u.notebook,t.uri))return;let p=t.cells.find(h=>h.handle===u.handle);p&&l(p)})),n.add(t.onDidChangeContent(c=>{let u=[];c.rawEvents.forEach(p=>{switch(p.kind){case 1:case 6:{u.push({kind:p.kind,changes:p.changes.map(h=>[h[0],h[1],h[2].map(g=>r(g))])});for(let h of p.changes)for(let g of h[2])l(g);break}case 2:{u.push({kind:2,index:p.index,length:p.length,newIdx:p.newIdx,cells:p.cells.map(h=>r(h))});break}case 10:break;case 11:u.push({kind:p.kind,metadata:p.metadata});default:u.push(p)}}),this._proxy.$acceptModelChanged(o.toString(),{rawEvents:u,versionId:c.versionId})})),n.add(t.onWillDispose(()=>{this._stopModelSync(o)})),n.add(Z(()=>{this._proxy.$acceptRemovedModel(o)})),this._syncedModels[o]=n}_stopModelSync(e){let t=this._syncedModels[e];delete this._syncedModels[e],delete this._syncedModelsLastUsedTime[e],Be(t)}},pTi=class extends x{constructor(e,t,o){super();this._notebookService=e;this._modelService=t;this._webWorkerService=o;this._worker=null,this._modelManager=null}computeDiff(e,t){return this._ensureSyncedResources([e,t]).$computeDiff(e.toString(),t.toString())}canPromptRecommendation(e){return this._ensureSyncedResources([e]).$canPromptRecommendation(e.toString())}_getOrCreateModelManager(e){return this._modelManager||(this._modelManager=this._register(new uTi(e,this._notebookService,this._modelService))),this._modelManager}_ensureSyncedResources(e){let t=this._getOrCreateWorker().proxy;return this._getOrCreateModelManager(t).ensureSyncedResources(e),t}_getOrCreateWorker(){if(!this._worker)try{this._worker=this._register(this._webWorkerService.createWorkerClient(new Ux({esmModuleLocation:vn.asBrowserUri("vs/workbench/contrib/notebook/common/services/notebookWebWorkerMain.js"),label:"NotebookEditorWorker"})))}catch(e){throw e}return this._worker}};var S1t=class extends x{constructor(){super(...arguments);this._onDidChangeProviders=this._register(new E);this.onDidChangeProviders=this._onDidChangeProviders.event;this._onDidChangeItems=this._register(new E);this.onDidChangeItems=this._onDidChangeItems.event;this._providers=[]}registerCellStatusBarItemProvider(e){this._providers.push(e);let t;return e.onDidChangeStatusBarItems&&(t=e.onDidChangeStatusBarItems(()=>this._onDidChangeItems.fire())),this._onDidChangeProviders.fire(),Z(()=>{t?.dispose();let o=this._providers.findIndex(n=>n===e);this._providers.splice(o,1)})}async getStatusBarItemsForCell(e,t,o,n){let r=this._providers.filter(s=>s.viewType===o||s.viewType==="*");return await Promise.all(r.map(async s=>{try{return await s.provideCellStatusBarItems(e,t,n)??{items:[]}}catch(l){return ys(l),{items:[]}}}))}};var LAe=class{constructor(i,e,t,o){this.editorGroupService=i;this.instantiationService=o;this._tokenPool=1;this._disposables=new N;this._notebookEditors=new Map;this.groupListener=new Map;this._onNotebookEditorAdd=new E;this._onNotebookEditorsRemove=new E;this.onDidAddNotebookEditor=this._onNotebookEditorAdd.event;this.onDidRemoveNotebookEditor=this._onNotebookEditorsRemove.event;this._borrowableEditors=new Map;let n=s=>{let{id:l}=s,c=[];c.push(s.onDidCloseEditor(u=>{let p=this._borrowableEditors.get(s.id);if(!p)return;(u.editor instanceof Ra||u.editor instanceof Xw?[u.editor]:i4(u.editor)?u.editor.editorInputs:[]).forEach(g=>{let f=p.get(g.resource),v=f?.findIndex(S=>S.editorType===g.typeId);if(!f||v===void 0||v===-1)return;let b=f.splice(v,1)[0];b.token=void 0,this._disposeWidget(b.widget),b.disposableStore.dispose(),b.widget=void 0})})),c.push(s.onWillMoveEditor(u=>{S6e(u.editor)&&this._allowWidgetMove(u.editor,u.groupId,u.target),i4(u.editor)&&u.editor.editorInputs.forEach(p=>{this._allowWidgetMove(p,u.groupId,u.target)})})),this.groupListener.set(l,c)};this._disposables.add(i.onDidAddGroup(n)),i.whenReady.then(()=>i.groups.forEach(n)),this._disposables.add(i.onDidRemoveGroup(s=>{let l=this.groupListener.get(s.id);l&&(l.forEach(u=>u.dispose()),this.groupListener.delete(s.id));let c=this._borrowableEditors.get(s.id);if(this._borrowableEditors.delete(s.id),c)for(let u of c.values())for(let p of u)p.token=void 0,this._disposeWidget(p.widget),p.disposableStore.dispose()})),this._mostRecentRepl=a8.bindTo(t);let r=tUt.bindTo(t);this._disposables.add(e.onDidEditorsChange(s=>{s.event.kind===5&&!r.get()?e.editors.find(l=>i4(l))&&r.set(!0):s.event.kind===6&&r.get()&&(e.editors.find(l=>i4(l))||r.set(!1))}))}dispose(){this._disposables.dispose(),this._onNotebookEditorAdd.dispose(),this._onNotebookEditorsRemove.dispose(),this.groupListener.forEach(i=>{i.forEach(e=>e.dispose())}),this.groupListener.clear(),this._borrowableEditors.forEach(i=>{i.forEach(e=>{e.forEach(t=>t.disposableStore.dispose())})})}_disposeWidget(i){i.onWillHide();let e=i.getDomNode();i.dispose(),e.remove()}_allowWidgetMove(i,e,t){let o=this.editorGroupService.getPart(e),n=this.editorGroupService.getPart(t);if(o.windowId!==n.windowId)return;let r=this._borrowableEditors.get(t)?.get(i.resource)?.findIndex(p=>p.editorType===i.typeId);if(r!==void 0&&r!==-1)return;let s=this._borrowableEditors.get(e)?.get(i.resource)?.find(p=>p.editorType===i.typeId);if(!s)throw new Error("no widget at source group");let l=this._borrowableEditors.get(e)?.get(i.resource);if(l){let p=l.findIndex(h=>h.editorType===i.typeId);p!==-1&&l.splice(p,1)}let c=this._borrowableEditors.get(t);c||(c=new gt,this._borrowableEditors.set(t,c));let u=c.get(i.resource)??[];u?.push(s),c.set(i.resource,u)}retrieveExistingWidgetFromURI(i){for(let e of this._borrowableEditors.values()){let t=e.get(i);if(t&&t.length>0)return this._createBorrowValue(t[0].token,t[0])}}retrieveAllExistingWidgets(){let i=[];for(let e of this._borrowableEditors.values())for(let t of e.values())for(let o of t)i.push(this._createBorrowValue(o.token,o));return i}retrieveWidget(i,e,t,o,n,r){let s=this._borrowableEditors.get(e)?.get(t.resource)?.find(l=>l.editorType===t.typeId);if(s)s.token=this._tokenPool++;else{let l=i.get(X),c=i.get(wd),u=new N,p=this.createWidget(l,u,c,o,r,n),h=this._tokenPool++;s={widget:p,editorType:t.typeId,token:h,disposableStore:u};let g=this._borrowableEditors.get(e);g||(g=new gt,this._borrowableEditors.set(e,g));let f=g.get(t.resource)??[];f.push(s),g.set(t.resource,f)}return this._createBorrowValue(s.token,s)}createWidget(i,e,t,o,n,r){let s=e.add(this.instantiationService.createChild(new _o([X,i],[wd,t]))),l=o??kte();return s.createInstance(xG,{...l,codeWindow:n??l.codeWindow},r)}_createBorrowValue(i,e){return{get value(){return e.token===i?e.widget:void 0}}}addNotebookEditor(i){this._notebookEditors.set(i.getId(),i),this._onNotebookEditorAdd.fire(i)}removeNotebookEditor(i){let e=i.getViewModel()?.notebookDocument.uri;this._notebookEditors.delete(i.getId())&&this._onNotebookEditorsRemove.fire(i),this._mostRecentRepl.get()===e?.toString()&&this._mostRecentRepl.reset()}getNotebookEditor(i){return this._notebookEditors.get(i)}listNotebookEditors(){return[...this._notebookEditors].map(i=>i[1])}getNotebookForPossibleCell(i){for(let e of this._notebookEditors.values())for(let[,t]of e.codeEditors)if(t===i)return e}updateReplContextKey(i){this._mostRecentRepl.set(i)}};LAe=I([m(0,wt),m(1,ee),m(2,X),m(3,F)],LAe);var Mte=class extends x{constructor(e,t,o){super();this.fileService=e;this.logService=t;this.workingCopyBackupService=o;this._onDidCreate=this._register(new E);this.onDidCreate=this._onDidCreate.event;this.mapResourceToWorkingCopy=new gt;this.mapResourceToDisposeListener=new gt}has(e){return this.mapResourceToWorkingCopy.has(e)}add(e,t){this.get(e)!==t&&(this.mapResourceToWorkingCopy.set(e,t),this.mapResourceToDisposeListener.get(e)?.dispose(),this.mapResourceToDisposeListener.set(e,t.onWillDispose(()=>this.remove(e))),this._onDidCreate.fire(t))}remove(e){let t=this.mapResourceToDisposeListener.get(e);return t&&(Be(t),this.mapResourceToDisposeListener.delete(e)),this.mapResourceToWorkingCopy.delete(e)}get workingCopies(){return[...this.mapResourceToWorkingCopy.values()]}get(e){return this.mapResourceToWorkingCopy.get(e)}dispose(){super.dispose(),this.mapResourceToWorkingCopy.clear(),Be(this.mapResourceToDisposeListener.values()),this.mapResourceToDisposeListener.clear()}async destroy(){try{await dn.settled(this.workingCopies.map(async e=>{e.isDirty()&&await this.saveWithFallback(e)}))}catch(e){this.logService.error(e)}Be(this.mapResourceToWorkingCopy.values()),this.dispose()}async saveWithFallback(e){let t=!1;try{t=await e.save()}catch{}if(!t||e.isDirty()){let o=await this.workingCopyBackupService.resolve(e);o&&await this.fileService.writeFile(e.resource,o.value,{unlock:!0})}}};Mte=I([m(0,fe),m(1,se),m(2,hm)],Mte);var RAe=class extends Mte{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super(o,s,c);this.workingCopyTypeId=e;this.modelFactory=t;this.lifecycleService=n;this.labelService=r;this.workingCopyFileService=l;this.uriIdentityService=u;this.filesConfigurationService=p;this.workingCopyService=h;this.notificationService=g;this.workingCopyEditorService=f;this.editorService=v;this.elevatedFileService=b;this.progressService=S;this._onDidResolve=this._register(new E);this.onDidResolve=this._onDidResolve.event;this._onDidChangeDirty=this._register(new E);this.onDidChangeDirty=this._onDidChangeDirty.event;this._onDidChangeReadonly=this._register(new E);this.onDidChangeReadonly=this._onDidChangeReadonly.event;this._onDidChangeOrphaned=this._register(new E);this.onDidChangeOrphaned=this._onDidChangeOrphaned.event;this._onDidSaveError=this._register(new E);this.onDidSaveError=this._onDidSaveError.event;this._onDidSave=this._register(new E);this.onDidSave=this._onDidSave.event;this._onDidRevert=this._register(new E);this.onDidRevert=this._onDidRevert.event;this._onDidRemove=this._register(new E);this.onDidRemove=this._onDidRemove.event;this.mapResourceToWorkingCopyListeners=new gt;this.mapResourceToPendingWorkingCopyResolve=new gt;this.workingCopyResolveQueue=this._register(new b1);this.mapCorrelationIdToWorkingCopiesToRestore=new Map;this.registerListeners()}registerListeners(){this._register(this.fileService.onDidFilesChange(e=>this.onDidFilesChange(e))),this._register(this.fileService.onDidChangeFileSystemProviderCapabilities(e=>this.onDidChangeFileSystemProviderCapabilities(e))),this._register(this.fileService.onDidChangeFileSystemProviderRegistrations(e=>this.onDidChangeFileSystemProviderRegistrations(e))),this._register(this.workingCopyFileService.onWillRunWorkingCopyFileOperation(e=>this.onWillRunWorkingCopyFileOperation(e))),this._register(this.workingCopyFileService.onDidFailWorkingCopyFileOperation(e=>this.onDidFailWorkingCopyFileOperation(e))),this._register(this.workingCopyFileService.onDidRunWorkingCopyFileOperation(e=>this.onDidRunWorkingCopyFileOperation(e))),Wt?this._register(this.lifecycleService.onBeforeShutdown(e=>e.veto(this.onBeforeShutdownWeb(),"veto.fileWorkingCopyManager"))):this._register(this.lifecycleService.onWillShutdown(e=>e.join(this.onWillShutdownDesktop(),{id:"join.fileWorkingCopyManager",label:d(18356,null)})))}onBeforeShutdownWeb(){return!!this.workingCopies.some(e=>e.hasState(2))}async onWillShutdownDesktop(){let e;for(;(e=this.workingCopies.filter(t=>t.hasState(2))).length>0;)await dn.settled(e.map(t=>t.joinState(2)))}onDidChangeFileSystemProviderCapabilities(e){this.queueWorkingCopyReloads(e.scheme)}onDidChangeFileSystemProviderRegistrations(e){e.added&&this.queueWorkingCopyReloads(e.scheme)}onDidFilesChange(e){this.queueWorkingCopyReloads(e)}queueWorkingCopyReloads(e){for(let t of this.workingCopies){if(t.isDirty())continue;let o=!1;typeof e=="string"?o=e===t.resource.scheme:o=e.contains(t.resource,0,1),o&&this.queueWorkingCopyReload(t)}}queueWorkingCopyReload(e){this.workingCopyResolveQueue.queueSize(e.resource)<=1&&this.workingCopyResolveQueue.queueFor(e.resource,async()=>{try{await this.reload(e)}catch(o){this.logService.error(o)}})}onWillRunWorkingCopyFileOperation(e){(e.operation===2||e.operation===3)&&e.waitUntil((async()=>{let t=[];for(let{source:o,target:n}of e.files)if(o){if(this.uriIdentityService.extUri.isEqual(o,n))continue;let r=[];for(let s of this.workingCopies)this.uriIdentityService.extUri.isEqualOrParent(s.resource,o)&&r.push(s);for(let s of r){let l=s.resource,c;this.uriIdentityService.extUri.isEqual(l,o)?c=n:c=Ge(n,l.path.substr(o.path.length+1)),t.push({source:l,target:c,snapshot:s.isDirty()?await s.model?.snapshot(1,Se.None):void 0})}}this.mapCorrelationIdToWorkingCopiesToRestore.set(e.correlationId,t)})())}onDidFailWorkingCopyFileOperation(e){if(e.operation===2||e.operation===3){let t=this.mapCorrelationIdToWorkingCopiesToRestore.get(e.correlationId);if(t){this.mapCorrelationIdToWorkingCopiesToRestore.delete(e.correlationId);for(let o of t)o.snapshot&&this.get(o.source)?.markModified()}}}onDidRunWorkingCopyFileOperation(e){switch(e.operation){case 0:e.waitUntil((async()=>{for(let{target:t}of e.files){let o=this.get(t);o&&!o.isDisposed()&&await o.revert()}})());break;case 2:case 3:e.waitUntil((async()=>{let t=this.mapCorrelationIdToWorkingCopiesToRestore.get(e.correlationId);t&&(this.mapCorrelationIdToWorkingCopiesToRestore.delete(e.correlationId),await dn.settled(t.map(async o=>{let n=this.uriIdentityService.asCanonicalUri(o.target);await this.resolve(n,{reload:{async:!1},contents:o.snapshot})})))})());break}}async reload(e){await this.joinPendingResolves(e.resource),!(e.isDirty()||e.isDisposed()||!this.has(e.resource))&&await this.doResolve(e,{reload:{async:!1}})}async resolve(e,t){let o=this.joinPendingResolves(e);return o&&await o,this.doResolve(e,t)}async doResolve(e,t){let o,n;A.isUri(e)?(n=e,o=this.get(n)):(n=e.resource,o=e);let r,s=!1,l={contents:t?.contents,forceReadFromFile:t?.reload?.force,limits:t?.limits};o?t?.contents?r=o.resolve(l):t?.reload?t.reload.async?(r=Promise.resolve(),(async()=>{try{await o.resolve(l)}catch(c){o.isDisposed()||mt(c)}})()):r=o.resolve(l):r=Promise.resolve():(s=!0,o=new Z4(this.workingCopyTypeId,n,this.labelService.getUriBasenameLabel(n),this.modelFactory,async c=>{await this.resolve(n,{...c,reload:{async:!1}})},this.fileService,this.logService,this.workingCopyFileService,this.filesConfigurationService,this.workingCopyBackupService,this.workingCopyService,this.notificationService,this.workingCopyEditorService,this.editorService,this.elevatedFileService,this.progressService),r=o.resolve(l),this.registerWorkingCopy(o)),this.mapResourceToPendingWorkingCopyResolve.set(n,r),this.add(n,o),s&&o.isDirty()&&this._onDidChangeDirty.fire(o);try{await r}catch(c){throw s&&o.dispose(),c}finally{this.mapResourceToPendingWorkingCopyResolve.delete(n)}return s&&o.isDirty()&&this._onDidChangeDirty.fire(o),o}joinPendingResolves(e){if(this.mapResourceToPendingWorkingCopyResolve.get(e))return this.doJoinPendingResolves(e)}async doJoinPendingResolves(e){let t;for(;this.mapResourceToPendingWorkingCopyResolve.has(e);){let o=this.mapResourceToPendingWorkingCopyResolve.get(e);if(o===t)return;t=o;try{await o}catch{}}}registerWorkingCopy(e){let t=new N;t.add(e.onDidResolve(()=>this._onDidResolve.fire(e))),t.add(e.onDidChangeDirty(()=>this._onDidChangeDirty.fire(e))),t.add(e.onDidChangeReadonly(()=>this._onDidChangeReadonly.fire(e))),t.add(e.onDidChangeOrphaned(()=>this._onDidChangeOrphaned.fire(e))),t.add(e.onDidSaveError(()=>this._onDidSaveError.fire(e))),t.add(e.onDidSave(o=>this._onDidSave.fire({workingCopy:e,...o}))),t.add(e.onDidRevert(()=>this._onDidRevert.fire(e))),this.mapResourceToWorkingCopyListeners.set(e.resource,t)}remove(e){let t=super.remove(e),o=this.mapResourceToWorkingCopyListeners.get(e);return o&&(Be(o),this.mapResourceToWorkingCopyListeners.delete(e)),t&&this._onDidRemove.fire(e),t}canDispose(e){return e.isDisposed()||!this.mapResourceToPendingWorkingCopyResolve.has(e.resource)&&!e.isDirty()?!0:this.doCanDispose(e)}async doCanDispose(e){let t=this.joinPendingResolves(e.resource);return t?(await t,this.canDispose(e)):e.isDirty()?(await U.toPromise(e.onDidChangeDirty),this.canDispose(e)):!0}dispose(){super.dispose(),this.mapResourceToPendingWorkingCopyResolve.clear(),Be(this.mapResourceToWorkingCopyListeners.values()),this.mapResourceToWorkingCopyListeners.clear()}};RAe=I([m(2,fe),m(3,ji),m(4,rt),m(5,se),m(6,qp),m(7,hm),m(8,ht),m(9,gr),m(10,Xa),m(11,Ne),m(12,iv),m(13,ee),m(14,l0),m(15,Fo)],RAe);var EG=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this.typeId=e;this.resource=t;this.name=o;this.hasAssociatedFilePath=n;this.isScratchpad=r;this.initialContents=s;this.modelFactory=l;this.saveDelegate=c;this.workingCopyBackupService=p;this.logService=h;this._model=void 0;this._onDidChangeContent=this._register(new E);this.onDidChangeContent=this._onDidChangeContent.event;this._onDidChangeDirty=this._register(new E);this.onDidChangeDirty=this._onDidChangeDirty.event;this._onDidSave=this._register(new E);this.onDidSave=this._onDidSave.event;this._onDidRevert=this._register(new E);this.onDidRevert=this._onDidRevert.event;this._onWillDispose=this._register(new E);this.onWillDispose=this._onWillDispose.event;this.capabilities=this.isScratchpad?6:2,this.modified=this.hasAssociatedFilePath||!!(this.initialContents&&this.initialContents.markModified!==!1),this._register(u.registerWorkingCopy(this))}get model(){return this._model}isDirty(){return this.modified&&!this.isScratchpad}isModified(){return this.modified}setModified(e){this.modified!==e&&(this.modified=e,this.isScratchpad||this._onDidChangeDirty.fire())}async resolve(){if(this.trace("resolve()"),this.isResolved()){this.trace("resolve() - exit (already resolved)");return}let e,t=await this.workingCopyBackupService.resolve(this);t?(this.trace("resolve() - with backup"),e=t.value):this.initialContents?.value?(this.trace("resolve() - with initial contents"),e=this.initialContents.value):(this.trace("resolve() - empty"),e=eqi()),await this.doCreateModel(e),this.setModified(this.hasAssociatedFilePath||!!t||!!(this.initialContents&&this.initialContents.markModified!==!1)),(t||this.initialContents)&&this._onDidChangeContent.fire()}async doCreateModel(e){this.trace("doCreateModel()"),this._model=this._register(await this.modelFactory.createModel(this.resource,e,Se.None)),this.installModelListeners(this._model)}installModelListeners(e){this._register(e.onDidChangeContent(t=>this.onModelContentChanged(t))),this._register(e.onWillDispose(()=>this.dispose()))}onModelContentChanged(e){!this.hasAssociatedFilePath&&e.isInitial?this.setModified(!1):this.setModified(!0),this._onDidChangeContent.fire()}isResolved(){return!!this.model}get backupDelay(){return this.model?.configuration?.backupDelay}async backup(e){let t;return this.isResolved()?t=await Va(this.model.snapshot(2,e),e):this.initialContents&&(t=this.initialContents.value),{content:t}}async save(e){this.trace("save()");let t=await this.saveDelegate(this,e);return t&&this._onDidSave.fire({reason:e?.reason,source:e?.source}),t}async revert(){this.trace("revert()"),this.setModified(!1),this._onDidRevert.fire(),this.dispose()}dispose(){this.trace("dispose()"),this._onWillDispose.fire(),super.dispose()}trace(e){this.logService.trace(`[untitled file working copy] ${e}`,this.resource.toString(),this.typeId)}};EG=I([m(8,Xa),m(9,hm),m(10,se)],EG);var MAe=class extends Mte{constructor(e,t,o,n,r,s,l,c){super(n,s,l);this.workingCopyTypeId=e;this.modelFactory=t;this.saveDelegate=o;this.labelService=r;this.workingCopyService=c;this._onDidSave=this._register(new E);this.onDidSave=this._onDidSave.event;this._onDidChangeDirty=this._register(new E);this.onDidChangeDirty=this._onDidChangeDirty.event;this._onWillDispose=this._register(new E);this.onWillDispose=this._onWillDispose.event;this.mapResourceToWorkingCopyListeners=new gt}async resolve(e){let t=this.doCreateOrGet(e);return await t.resolve(),t}doCreateOrGet(e=Object.create(null)){let t=this.massageOptions(e);if(t.untitledResource){let o=this.get(t.untitledResource);if(o)return o}return this.doCreate(t)}massageOptions(e){let t=Object.create(null);return e.associatedResource?(t.untitledResource=A.from({scheme:Q.untitled,authority:e.associatedResource.authority,fragment:e.associatedResource.fragment,path:e.associatedResource.path,query:e.associatedResource.query}),t.associatedResource=e.associatedResource):(e.untitledResource?.scheme===Q.untitled&&(t.untitledResource=e.untitledResource),t.isScratchpad=e.isScratchpad),t.contents=e.contents,t}doCreate(e){let t=e.untitledResource;if(!t){let n=1;do t=A.from({scheme:Q.untitled,path:e.isScratchpad?`Scratchpad-${n}`:`Untitled-${n}`,query:this.workingCopyTypeId?`typeId=${this.workingCopyTypeId}`:void 0}),n++;while(this.has(t))}let o=new EG(this.workingCopyTypeId,t,this.labelService.getUriBasenameLabel(t),!!e.associatedResource,!!e.isScratchpad,e.contents,this.modelFactory,this.saveDelegate,this.workingCopyService,this.workingCopyBackupService,this.logService);return this.registerWorkingCopy(o),o}registerWorkingCopy(e){let t=new N;t.add(e.onDidChangeDirty(()=>this._onDidChangeDirty.fire(e))),t.add(e.onWillDispose(()=>this._onWillDispose.fire(e))),this.mapResourceToWorkingCopyListeners.set(e.resource,t),this.add(e.resource,e),e.isDirty()&&this._onDidChangeDirty.fire(e)}remove(e){let t=super.remove(e),o=this.mapResourceToWorkingCopyListeners.get(e);return o&&(Be(o),this.mapResourceToWorkingCopyListeners.delete(e)),t}dispose(){super.dispose(),Be(this.mapResourceToWorkingCopyListeners.values()),this.mapResourceToWorkingCopyListeners.clear()}notifyDidSave(e,t){this._onDidSave.fire({source:e,target:t})}};MAe=I([m(3,fe),m(4,rt),m(5,se),m(6,hm),m(7,Xa)],MAe);var P8=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,P,O){super();this.workingCopyTypeId=e;this.storedWorkingCopyModelFactory=t;this.untitledWorkingCopyModelFactory=o;this.fileService=n;this.logService=l;this.workingCopyFileService=c;this.uriIdentityService=p;this.fileDialogService=h;this.filesConfigurationService=g;this.pathService=w;this.environmentService=k;this.dialogService=T;this.decorationsService=P;this.stored=this._register(new RAe(this.workingCopyTypeId,this.storedWorkingCopyModelFactory,n,r,s,l,c,u,p,g,f,v,b,S,y,O)),this.untitled=this._register(new MAe(this.workingCopyTypeId,this.untitledWorkingCopyModelFactory,async(V,H)=>!!await this.saveAs(V.resource,void 0,H),n,s,l,u,f)),this.onDidCreate=U.any(this.stored.onDidCreate,this.untitled.onDidCreate),this.provideDecorations()}static{this.FILE_WORKING_COPY_SAVE_CREATE_SOURCE=Ih.registerSource("fileWorkingCopyCreate.source",d(18331,null))}static{this.FILE_WORKING_COPY_SAVE_REPLACE_SOURCE=Ih.registerSource("fileWorkingCopyReplace.source",d(18333,null))}provideDecorations(){let e=this._register(new class extends x{constructor(o){super();this.stored=o;this.label=d(18332,null);this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this.registerListeners()}registerListeners(){this._register(this.stored.onDidResolve(o=>{(o.isReadonly()||o.hasState(4))&&this._onDidChange.fire([o.resource])})),this._register(this.stored.onDidRemove(o=>this._onDidChange.fire([o]))),this._register(this.stored.onDidChangeReadonly(o=>this._onDidChange.fire([o.resource]))),this._register(this.stored.onDidChangeOrphaned(o=>this._onDidChange.fire([o.resource])))}provideDecorations(o){let n=this.stored.get(o);if(!n||n.isDisposed())return;let r=n.isReadonly(),s=n.hasState(4);if(r&&s)return{color:Gx,letter:R.lockSmall,strikethrough:!0,tooltip:d(18337,null)};if(r)return{letter:R.lockSmall,tooltip:d(18336,null)};if(s)return{color:Gx,strikethrough:!0,tooltip:d(18330,null)}}}(this.stored));this._register(this.decorationsService.registerDecorationsProvider(e))}get workingCopies(){return[...this.stored.workingCopies,...this.untitled.workingCopies]}get(e){return this.stored.get(e)??this.untitled.get(e)}resolve(e,t){return A.isUri(e)?e.scheme===Q.untitled?this.untitled.resolve({untitledResource:e}):this.stored.resolve(e,t):this.untitled.resolve(e)}async saveAs(e,t,o){if(!t){let n=this.get(e);n instanceof EG&&n.hasAssociatedFilePath?t=await this.suggestSavePath(e):t=await this.fileDialogService.pickFileToSave(await this.suggestSavePath(o?.suggestedTarget??e),o?.availableFileSystems)}if(t){if(this.filesConfigurationService.isReadonly(t))if(await this.confirmMakeWriteable(t))this.filesConfigurationService.updateReadonly(t,!1);else return;return this.fileService.hasProvider(e)&&Qe(e,t)?this.doSave(e,{...o,force:!0}):this.fileService.hasProvider(e)&&this.uriIdentityService.extUri.isEqual(e,t)&&await this.fileService.exists(e)?(await this.workingCopyFileService.move([{file:{source:e,target:t}}],Se.None),await this.doSave(e,o)??await this.doSave(t,o)):this.doSaveAs(e,t,o)}}async doSave(e,t){let o=this.stored.get(e);if(o&&await o.save(t))return o}async doSaveAs(e,t,o){let n,r=this.get(e);r?.isResolved()?n=await r.model.snapshot(1,Se.None):n=(await this.fileService.readFileStream(e)).value;let{targetFileExists:s,targetStoredFileWorkingCopy:l}=await this.doResolveSaveTarget(e,t);if(!(r instanceof EG&&r.hasAssociatedFilePath&&s&&this.uriIdentityService.extUri.isEqual(t,of(r.resource,this.environmentService.remoteAuthority,this.pathService.defaultUriScheme))&&!await this.confirmOverwrite(t)||(await l.model?.update(n,Se.None),o?.source||(o={...o,source:s?P8.FILE_WORKING_COPY_SAVE_REPLACE_SOURCE:P8.FILE_WORKING_COPY_SAVE_CREATE_SOURCE}),!await l.save({...o,from:e,force:!0})))){try{await r?.revert()}catch(u){this.logService.error(u)}return e.scheme===Q.untitled&&this.untitled.notifyDidSave(e,t),l}}async doResolveSaveTarget(e,t){let o=!1,n=this.stored.get(t);return n?.isResolved()?o=!0:(o=await this.fileService.exists(t),o||await this.workingCopyFileService.create([{resource:t}],Se.None),this.uriIdentityService.extUri.isEqual(e,t)&&this.get(e)?n=await this.stored.resolve(e):n=await this.stored.resolve(t)),{targetFileExists:o,targetStoredFileWorkingCopy:n}}async confirmOverwrite(e){let{confirmed:t}=await this.dialogService.confirm({type:"warning",message:d(18329,null,He(e)),detail:d(18335,null,He(e),He(ci(e))),primaryButton:d(18338,null)});return t}async confirmMakeWriteable(e){let{confirmed:t}=await this.dialogService.confirm({type:"warning",message:d(18327,null,He(e)),detail:d(18328,null),primaryButton:d(18334,null)});return t}async suggestSavePath(e){if(this.fileService.hasProvider(e))return e;let t=this.get(e);if(t instanceof EG&&t.hasAssociatedFilePath)return of(e,this.environmentService.remoteAuthority,this.pathService.defaultUriScheme);let o=await this.fileDialogService.defaultFilePath();if(t){let n=Ge(o,t.name);if(await this.pathService.hasValidBasename(n,t.name))return n}return Ge(o,He(e))}async destroy(){await dn.settled([this.stored.destroy(),this.untitled.destroy()])}};P8=I([m(3,fe),m(4,ji),m(5,rt),m(6,se),m(7,qp),m(8,hm),m(9,ht),m(10,rn),m(11,gr),m(12,Xa),m(13,Ne),m(14,iv),m(15,ee),m(16,l0),m(17,An),m(18,At),m(19,at),m(20,Ov),m(21,Fo)],P8);var uit=class extends uC{constructor(e,t,o,n,r){super();this._instantiationService=e;this._notebookService=t;this._configurationService=o;this._telemetryService=n;this._notebookLoggingService=r;this._disposables=new N;this._workingCopyManagers=new Map;this._modelListener=new Map;this._onDidSaveNotebook=new E;this.onDidSaveNotebook=this._onDidSaveNotebook.event;this._onDidChangeDirty=new E;this.onDidChangeDirty=this._onDidChangeDirty.event;this._dirtyStates=new gt;this.modelsToDispose=new Set}dispose(){this._disposables.dispose(),this._onDidSaveNotebook.dispose(),this._onDidChangeDirty.dispose(),Be(this._modelListener.values()),Be(this._workingCopyManagers.values())}isDirty(e){return this._dirtyStates.get(e)??!1}isListeningToModel(e){for(let t of this._modelListener.keys())if(t.resource.toString()===e.toString())return!0;return!1}async createReferencedObject(e,t,o,n,r,s){this.modelsToDispose.delete(e);let l=A.parse(e),c=yF.create(t,s),u=this._workingCopyManagers.get(c);if(!u){let v=new cDe(t,this._notebookService,this._configurationService,this._telemetryService,this._notebookLoggingService);u=this._instantiationService.createInstance(P8,c,v,v),this._workingCopyManagers.set(c,u)}let p=r||t==="interactive"&&this._configurationService.getValue(yt.InteractiveWindowPromptToSave)!==!0,g=await this._instantiationService.createInstance(c0,l,o,t,u,p).load({limits:n}),f;return this._modelListener.set(g,wn(g.onDidSave(()=>this._onDidSaveNotebook.fire(g.resource)),g.onDidChangeDirty(()=>{let v=g.isDirty();this._dirtyStates.set(g.resource,v),v&&!f?f=this.acquire(e,t):f&&(f.dispose(),f=void 0),this._onDidChangeDirty.fire(g)}),Z(()=>f?.dispose()))),g}destroyReferencedObject(e,t){this.modelsToDispose.add(e),(async()=>{try{let o=await t;if(!this.modelsToDispose.has(e)||(o instanceof c0&&await o.canDispose(),!this.modelsToDispose.has(e)))return;this._modelListener.get(o)?.dispose(),this._modelListener.delete(o),o.dispose()}catch(o){this._notebookLoggingService.error("NotebookModelCollection","FAILED to destory notebook - "+o)}finally{this.modelsToDispose.delete(e)}})()}};uit=I([m(0,F),m(1,bn),m(2,B),m(3,Te),m(4,Uv)],uit);var PAe=class{constructor(i,e,t,o){this._notebookService=e;this._extensionService=t;this._uriIdentService=o;this._onWillFailWithConflict=new P9;this.onWillFailWithConflict=this._onWillFailWithConflict.event;this._data=i.createInstance(uit),this.onDidSaveNotebook=this._data.onDidSaveNotebook,this.onDidChangeDirty=this._data.onDidChangeDirty}dispose(){this._data.dispose()}isDirty(i){return this._data.isDirty(i)}createUntitledUri(i){let e=this._notebookService.getContributedNotebookType(Ci(i));if(!e)throw new Error("UNKNOWN notebook type: "+i);let t=fte.possibleFileEnding(e.selectors)??"";for(let o=1;;o++){let n=A.from({scheme:Q.untitled,path:`Untitled-${o}${t}`,query:i});if(!this._notebookService.getNotebookTextModel(n)&&!this._data.isListeningToModel(n))return n}}async validateResourceViewType(i,e){if(!i&&!e)throw new Error("Must provide at least one of resource or viewType");if(i?.scheme===Zo.scheme){let n=i;if(i=tEe(i)?.notebook,!i)throw new Error(`CANNOT open a cell-uri as notebook. Tried with ${n.toString()}`)}let t=this._uriIdentService.asCanonicalUri(i??this.createUntitledUri(e)),o=this._notebookService.getNotebookTextModel(t);if(!e)if(o)e=o.viewType;else{await this._extensionService.whenInstalledExtensionsRegistered();let n=this._notebookService.getContributedNotebookTypes(t);e=n.find(r=>r.priority==="exclusive")?.id??n.find(r=>r.priority==="default")?.id??n[0]?.id}if(!e)throw new Error(`Missing viewType for '${t}'`);if(o&&o.viewType!==e){await this._onWillFailWithConflict.fireAsync({resource:t,viewType:e},Se.None);let n=this._notebookService.getNotebookTextModel(t)?.viewType;if(n&&n!==e)throw new Error(`A notebook with view type '${n}' already exists for '${t}', CANNOT create another notebook with view type ${e}`)}return{resource:t,viewType:e}}async createUntitledNotebookTextModel(i){let e=this._uriIdentService.asCanonicalUri(this.createUntitledUri(i));return await this._notebookService.createNotebookTextModel(i,e)}async resolve(i,e,t){let o,n;A.isUri(i)?o=i:i.untitledResource&&(i.untitledResource.scheme===Q.untitled?o=i.untitledResource:(o=i.untitledResource.with({scheme:Q.untitled}),n=!0));let r=await this.validateResourceViewType(o,e),s=this._data.acquire(r.resource.toString(),r.viewType,n,t?.limits,t?.scratchpad,t?.viewType);try{return{object:await s.object,dispose(){s.dispose()}}}catch(l){throw s.dispose(),l}}};PAe=I([m(0,F),m(1,bn),m(2,lt),m(3,ht)],PAe);var mTi=class a{constructor(i){this.notebookPriorities=new gt;this.kernel=i,this.score=-1,this.time=a._logicClock++}static{this._logicClock=0}},TG=class{static str(i){return`${i.notebookType}/${i.uri.toString()}`}static obj(i){let e=i.indexOf("/");return{notebookType:i.substring(0,e),uri:A.parse(i.substring(e+1))}}},hTi=class extends x{constructor(e,t,o){super();this.action=e;this.model=t;this.isPrimary=o;this._onDidChangeState=this._register(new E);this.onDidChangeState=this._onDidChangeState.event}async runAction(){if(this.execution)return this.execution;this.execution=this._runAction(),this._onDidChangeState.fire(),await this.execution,this.execution=void 0,this._onDidChangeState.fire()}async _runAction(){try{await this.action.run({uri:this.model.uri,$mid:14})}catch(e){console.warn(`Kernel source command failed: ${e}`)}}},KH=class extends x{constructor(e,t,o,n){super();this._notebookService=e;this._storageService=t;this._menuService=o;this._contextKeyService=n;this._kernels=new Map;this._notebookBindings=new dl(1e3,.7);this._onDidChangeNotebookKernelBinding=this._register(new E);this._onDidAddKernel=this._register(new E);this._onDidRemoveKernel=this._register(new E);this._onDidChangeNotebookAffinity=this._register(new E);this._onDidChangeSourceActions=this._register(new E);this._onDidNotebookVariablesChange=this._register(new E);this._kernelSources=new Map;this._kernelSourceActionsUpdates=new Map;this._kernelDetectionTasks=new Map;this._onDidChangeKernelDetectionTasks=this._register(new E);this._kernelSourceActionProviders=new Map;this.onDidChangeSelectedNotebooks=this._onDidChangeNotebookKernelBinding.event;this.onDidAddKernel=this._onDidAddKernel.event;this.onDidRemoveKernel=this._onDidRemoveKernel.event;this.onDidChangeNotebookAffinity=this._onDidChangeNotebookAffinity.event;this.onDidChangeSourceActions=this._onDidChangeSourceActions.event;this.onDidChangeKernelDetectionTasks=this._onDidChangeKernelDetectionTasks.event;this.onDidNotebookVariablesUpdate=this._onDidNotebookVariablesChange.event;this._register(e.onDidAddNotebookDocument(this._tryAutoBindNotebook,this)),this._register(e.onWillRemoveNotebookDocument(r=>{let s=TG.str(r);this._notebookBindings.get(s)&&r.uri.scheme===Q.untitled&&this.selectKernelForNotebook(void 0,r),this._kernelSourceActionsUpdates.get(s)?.dispose(),this._kernelSourceActionsUpdates.delete(s)}));try{let r=JSON.parse(this._storageService.get(KH._storageNotebookBinding,1,"[]"));this._notebookBindings.fromJSON(r)}catch{}}static{this._storageNotebookBinding="notebook.controller2NotebookBindings"}dispose(){this._kernels.clear(),this._kernelSources.forEach(e=>{e.menu.dispose(),e.actions.forEach(t=>t[1].dispose())}),this._kernelSourceActionsUpdates.forEach(e=>{e.dispose()}),this._kernelSourceActionsUpdates.clear(),super.dispose()}_persistMementos(){this._persistSoonHandle?.dispose(),this._persistSoonHandle=rf(Ki(),()=>{this._storageService.store(KH._storageNotebookBinding,JSON.stringify(this._notebookBindings),1,1)},100)}static _score(e,t){return e.viewType==="*"?5:e.viewType===t.notebookType?10:0}_tryAutoBindNotebook(e,t){let o=this._notebookBindings.get(TG.str(e));if(!o)return;let n=this._kernels.get(o);!n||!KH._score(n.kernel,e)||(!t||n.kernel===t)&&this._onDidChangeNotebookKernelBinding.fire({notebook:e.uri,oldKernel:void 0,newKernel:n.kernel.id})}notifyVariablesChange(e){this._onDidNotebookVariablesChange.fire(e)}registerKernel(e){if(this._kernels.has(e.id))throw new Error(`NOTEBOOK CONTROLLER with id '${e.id}' already exists`);this._kernels.set(e.id,new mTi(e)),this._onDidAddKernel.fire(e);for(let t of this._notebookService.getNotebookTextModels())this._tryAutoBindNotebook(t,e);return Z(()=>{this._kernels.delete(e.id)&&this._onDidRemoveKernel.fire(e);for(let[t,o]of Array.from(this._notebookBindings))o===e.id&&this._onDidChangeNotebookKernelBinding.fire({notebook:TG.obj(t).uri,oldKernel:e.id,newKernel:void 0})})}getMatchingKernel(e){let t=[];for(let c of this._kernels.values()){let u=KH._score(c.kernel,e);u&&t.push({score:u,kernel:c.kernel,instanceAffinity:c.notebookPriorities.get(e.uri)??1})}t.sort((c,u)=>u.instanceAffinity-c.instanceAffinity||c.score-u.score||c.kernel.label.localeCompare(u.kernel.label));let o=t.map(c=>c.kernel),n=this._notebookBindings.get(TG.str(e)),r=n?this._kernels.get(n)?.kernel:void 0,s=t.filter(c=>c.instanceAffinity>1).map(c=>c.kernel),l=t.filter(c=>c.instanceAffinity<0).map(c=>c.kernel);return{all:o,selected:r,suggestions:s,hidden:l}}getSelectedOrSuggestedKernel(e){let t=this.getMatchingKernel(e);if(t.selected)return t.selected;let o=t.all.filter(n=>this._kernels.get(n.id)?.notebookPriorities.get(e.uri)===2);return o.length===1?o[0]:t.all.length===1?t.all[0]:void 0}selectKernelForNotebook(e,t){let o=TG.str(t),n=this._notebookBindings.get(o);n!==e?.id&&(e?this._notebookBindings.set(o,e.id):this._notebookBindings.delete(o),this._onDidChangeNotebookKernelBinding.fire({notebook:t.uri,oldKernel:n,newKernel:e?.id}),this._persistMementos())}preselectKernelForNotebook(e,t){let o=TG.str(t);this._notebookBindings.get(o)!==e?.id&&(this._notebookBindings.set(o,e.id),this._persistMementos())}updateKernelNotebookAffinity(e,t,o){let n=this._kernels.get(e.id);if(!n)throw new Error(`UNKNOWN kernel '${e.id}'`);o===void 0?n.notebookPriorities.delete(t):n.notebookPriorities.set(t,o),this._onDidChangeNotebookAffinity.fire()}getRunningSourceActions(e){let t=TG.str(e),o=this._kernelSources.get(t);return o?o.actions.filter(n=>n[0].execution).map(n=>n[0]):[]}getSourceActions(e,t){t=t??this._contextKeyService;let o=TG.str(e),n=this._kernelSources.get(o);if(n)return n.actions.map(c=>c[0]);let r=this._register(this._menuService.createMenu(D.NotebookKernelSource,t)),s={menu:r,actions:[]},l=(c,u)=>{let p=c.getActions({shouldForwardArgs:!0}),h=[];p.forEach(g=>{let f=/^primary/.test(g[0]);g[1].forEach(v=>{let b=new hTi(v,u,f),S=b.onDidChangeState(()=>{this._onDidChangeSourceActions.fire({notebook:u.uri,viewType:u.notebookType})});h.push([b,S])})}),s.actions=h,this._kernelSources.set(o,s),this._onDidChangeSourceActions.fire({notebook:u.uri,viewType:u.notebookType})};return this._kernelSourceActionsUpdates.get(o)?.dispose(),this._kernelSourceActionsUpdates.set(o,r.onDidChange(()=>{l(r,e)})),l(r,e),s.actions.map(c=>c[0])}registerNotebookKernelDetectionTask(e){let t=e.notebookType,o=this._kernelDetectionTasks.get(t)??[];return o.push(e),this._kernelDetectionTasks.set(t,o),this._onDidChangeKernelDetectionTasks.fire(t),Z(()=>{let n=this._kernelDetectionTasks.get(t)??[],r=n.indexOf(e);r>=0&&(n.splice(r,1),this._kernelDetectionTasks.set(t,n),this._onDidChangeKernelDetectionTasks.fire(t))})}getKernelDetectionTasks(e){return this._kernelDetectionTasks.get(e.notebookType)??[]}registerKernelSourceActionProvider(e,t){let o=this._kernelSourceActionProviders.get(e)??[];o.push(t),this._kernelSourceActionProviders.set(e,o),this._onDidChangeSourceActions.fire({viewType:e});let n=t.onDidChangeSourceActions?.(()=>{this._onDidChangeSourceActions.fire({viewType:e})});return Z(()=>{let r=this._kernelSourceActionProviders.get(e)??[],s=r.indexOf(t);s>=0&&(r.splice(s,1),this._kernelSourceActionProviders.set(e,r)),n?.dispose()})}getKernelSourceActions2(e){let t=e.notebookType,n=(this._kernelSourceActionProviders.get(t)??[]).map(r=>r.provideKernelSourceActions());return Promise.all(n).then(r=>r.reduce((s,l)=>s.concat(l),[]))}};KH=I([m(0,bn),m(1,ce),m(2,Kt),m(3,X)],KH);var AAe=class extends x{constructor(e){super();this.extensionService=e;this.activations=new Map;this.scopedMessaging=new Map;this.postMessageEmitter=this._register(new E);this.onShouldPostMessage=this.postMessageEmitter.event}receiveMessage(e,t,o){if(e===void 0){let n=[...this.scopedMessaging.values()].map(r=>r.receiveMessageHandler?.(t,o));return Promise.all(n).then(r=>r.some(s=>!!s))}return this.scopedMessaging.get(e)?.receiveMessageHandler?.(t,o)??Promise.resolve(!1)}prepare(e){if(this.activations.has(e))return;let t=[];this.activations.set(e,t),this.extensionService.activateByEvent(`onRenderer:${e}`).then(()=>{for(let o of t)this.postMessageEmitter.fire(o);this.activations.set(e,void 0)})}getScoped(e){let t=this.scopedMessaging.get(e);if(t)return t;let o={postMessage:(n,r)=>this.postMessage(e,n,r),dispose:()=>this.scopedMessaging.delete(e)};return this.scopedMessaging.set(e,o),o}postMessage(e,t,o){this.activations.has(t)||this.prepare(t);let n=this.activations.get(t),r={rendererId:t,editorId:e,message:o};n===void 0?this.postMessageEmitter.fire(r):n.push(r)}};AAe=I([m(0,lt)],AAe);async function NAe(a,i,e,t){let{notebookEditor:o}=i;if(o.hasModel()&&!o.isReadOnly){if(i.ui&&i.cell){let{cell:n}=i;if(n.cellKind===a)return;let r=n.getText(),s=o.getCellIndex(n);e===void 0&&(e=(o.activeKernel?.supportedLanguages??[])[0]??$r),o.textModel.applyEdits([{editType:1,index:s,count:1,cells:[{cellKind:a,source:r,language:e,mime:t??n.mime,outputs:n.model.outputs,metadata:n.metadata}]}],!0,{kind:1,focus:o.getFocus(),selections:o.getSelections()},()=>({kind:1,focus:o.getFocus(),selections:o.getSelections()}),void 0,!0);let l=o.cellAt(s);await o.focusNotebookCell(l,n.getEditState()===1?"editor":"container")}else if(i.selectedCells){let n=i.selectedCells,r=[];n.forEach(s=>{if(s.cellKind===a)return;let l=s.getText(),c=o.getCellIndex(s);e===void 0&&(e=(o.activeKernel?.supportedLanguages??[])[0]??$r),r.push({editType:1,index:c,count:1,cells:[{cellKind:a,source:l,language:e,mime:t??s.mime,outputs:s.model.outputs,metadata:s.metadata}]})}),o.textModel.applyEdits(r,!0,{kind:1,focus:o.getFocus(),selections:o.getSelections()},()=>({kind:1,focus:o.getFocus(),selections:o.getSelections()}),void 0,!0)}}}function lgo(a,i){let e=a.textModel,t=a.getSelections(),o=a.getCellIndex(i),n=t.find(s=>s.start<=o&&o<s.end),r=!a.isReadOnly||e.viewType==="interactive";if(n){let s=t.reverse().map(c=>({editType:1,index:c.start,count:c.end-c.start,cells:[]})),l=n.end>=a.getLength()?void 0:a.cellAt(n.end);e.applyEdits(s,!0,{kind:1,focus:a.getFocus(),selections:a.getSelections()},()=>{if(l){let c=e.cells.findIndex(u=>u.handle===l.handle);return{kind:1,focus:{start:c,end:c+1},selections:[{start:c,end:c+1}]}}else if(e.length){let c=e.length-1;return{kind:1,focus:{start:c,end:c+1},selections:[{start:c,end:c+1}]}}else return{kind:1,focus:{start:0,end:0},selections:[{start:0,end:0}]}},void 0,r)}else{let s=a.getFocus(),l=[{editType:1,index:o,count:1,cells:[]}],c=[];for(let u=0;u<t.length;u++){let p=t[u];p.end<=o?c.push(p):p.start>o?c.push({start:p.start-1,end:p.end-1}):c.push({start:o,end:o+1})}if(a.cellAt(s.start)===i){let u=s.end===e.length?{start:s.start-1,end:s.end-1}:s;e.applyEdits(l,!0,{kind:1,focus:a.getFocus(),selections:a.getSelections()},()=>({kind:1,focus:u,selections:c}),void 0,r)}else{let u=s.start>o?{start:s.start-1,end:s.end-1}:s;e.applyEdits(l,!0,{kind:1,focus:a.getFocus(),selections:a.getSelections()},()=>({kind:1,focus:u,selections:c}),void 0,r)}}}async function gTi(a,i){if(!a.notebookEditor.hasModel())return;let e=a.notebookEditor,t=e.textModel;if(e.isReadOnly)return;let o;if(a.cell){let n=e.getCellIndex(a.cell);o={start:n,end:n+1}}else{let n=e.getSelections();o=HX(e,n)[0]}if(!(!o||o.start===o.end))if(i==="up"){if(o.start===0)return;let n=o.start-1,r={start:o.start-1,end:o.end-1},s=a.notebookEditor.getFocus(),l=yDt(o,s)?{start:s.start-1,end:s.end-1}:{start:o.start-1,end:o.start};t.applyEdits([{editType:6,index:n,length:1,newIdx:o.end-1}],!0,{kind:1,focus:e.getFocus(),selections:e.getSelections()},()=>({kind:1,focus:l,selections:[r]}),void 0,!0);let c=e.getSelections()[0]??e.getFocus();e.revealCellRangeInView(c)}else{if(o.end>=t.length)return;let n=o.end,r={start:o.start+1,end:o.end+1},s=e.getFocus(),l=yDt(o,s)?{start:s.start+1,end:s.end+1}:{start:o.start+1,end:o.start+2};t.applyEdits([{editType:6,index:n,length:1,newIdx:o.start}],!0,{kind:1,focus:e.getFocus(),selections:e.getSelections()},()=>({kind:1,focus:l,selections:[r]}),void 0,!0);let c=e.getSelections()[0]??e.getFocus();e.revealCellRangeInView(c)}}async function fTi(a,i){let e=a.notebookEditor;if(!e.hasModel())return;let t=e.textModel;if(e.isReadOnly)return;let o;if(a.ui){let n=a.cell,r=e.getCellIndex(n);o={start:r,end:r+1}}else{let n=e.getSelections();o=HX(e,n)[0]}if(!(!o||o.start===o.end))if(i==="up"){let n=e.getFocus(),r=e.getSelections();t.applyEdits([{editType:1,index:o.end,count:0,cells:Yf([o]).map(s=>yG(e.cellAt(s).model))}],!0,{kind:1,focus:n,selections:r},()=>({kind:1,focus:n,selections:r}),void 0,!0)}else{let n=e.getFocus(),r=e.getSelections(),l=Yf([o]).map(h=>yG(e.cellAt(h).model)).length,c=a.ui?n:{start:n.start+l,end:n.end+l},u=a.ui?r:[{start:o.start+l,end:o.end+l}];t.applyEdits([{editType:1,index:o.end,count:0,cells:Yf([o]).map(h=>yG(e.cellAt(h).model))}],!0,{kind:1,focus:n,selections:r},()=>({kind:1,focus:c,selections:u}),void 0,!0);let p=e.getSelections()[0]??e.getFocus();e.revealCellRangeInView(p)}}async function cgo(a,i,e){let t=e.notebookEditor;if(t.isReadOnly)return;let o=[],n=[];for(let p of t.getSelections())n.push(...t.getCellsInRange(p));if(n.length<=1)return;let r=n[0].cellKind;if(!n.every(p=>p.cellKind===r)){let p=d(12424,null);return i.warn(p)}let l=n[0],c=n.map(p=>p.getText()).join(l.textBuffer.getEOL()),u=t.getSelections()[0];o.push(new Mv(t.textModel.uri,{editType:1,index:u.start,count:u.end-u.start,cells:[{cellKind:l.cellKind,source:c,language:l.language,mime:l.mime,outputs:l.model.outputs,metadata:l.metadata}]}));for(let p of t.getSelections().slice(1))o.push(new Mv(t.textModel.uri,{editType:1,index:p.start,count:p.end-p.start,cells:[]}));o.length&&await a.apply(o,{quotableLabel:d(12425,null)})}async function ago(a,i,e,t){if(a.isReadOnly)return null;let o=a.textModel,n=a.getCellsInRange(i);if(!n.length||i.start===0&&e==="above"||i.end===o.length&&e==="below")return null;for(let r=0;r<n.length;r++){let s=n[r];if(t&&s.cellKind!==t)return null}if(e==="above"){let r=a.cellAt(i.start-1);if(t&&r.cellKind!==t)return null;let s=n.map(u=>(u.textBuffer.getEOL()??"")+u.getText()).join(""),l=r.textBuffer.getLineCount(),c=r.textBuffer.getLineLength(l);return{edits:[new nl(r.uri,{range:new z(l,c+1,l,c+1),text:s}),new Mv(o.uri,{editType:1,index:i.start,count:i.end-i.start,cells:[]})],cell:r,endFocus:{start:i.start-1,end:i.start},endSelections:[{start:i.start-1,end:i.start}]}}else{let r=a.cellAt(i.end);if(t&&r.cellKind!==t)return null;let s=n[0],c=[...n.slice(1),r].map(h=>(h.textBuffer.getEOL()??"")+h.getText()).join(""),u=s.textBuffer.getLineCount(),p=s.textBuffer.getLineLength(u);return{edits:[new nl(s.uri,{range:new z(u,p+1,u,p+1),text:c}),new Mv(o.uri,{editType:1,index:i.start+1,count:i.end-i.start,cells:[]})],cell:s,endFocus:{start:i.start,end:i.start+1},endSelections:[{start:i.start,end:i.start+1}]}}}async function vTi(a,i,e){let t=i.notebookEditor,o=t.textModel,n=t.getViewModel(),r=null;if(i.ui){let s=i.cell.focusMode,l=t.getCellIndex(i.cell);if(r=await ago(t,{start:l,end:l+1},e),!r)return;await a.apply(r?.edits,{quotableLabel:"Join Notebook Cells"}),n.updateSelectionsState({kind:1,focus:r.endFocus,selections:r.endSelections}),r.cell.updateEditState(1,"joinCellsWithSurrounds"),t.revealCellRangeInView(t.getFocus()),s===1&&(r.cell.focusMode=1)}else{let s=t.getSelections();if(!s.length)return;let l=t.getFocus(),c=t.cellAt(l.start)?.focusMode,u=[],p=null,h=[];for(let f=s.length-1;f>=0;f--){let v=s[f],b=yDt(v,l);if(v.end>=o.length&&e==="below"||v.start===0&&e==="above"){b&&(p=t.cellAt(l.start)),h.push(...t.getCellsInRange(v));continue}let S=await ago(t,v,e);if(!S)return;u.push(...S.edits),h.push(S.cell),b&&(p=S.cell)}if(!u.length||!p||!h.length)return;await a.apply(u,{quotableLabel:"Join Notebook Cells"}),h.forEach(f=>{f.updateEditState(1,"joinCellsWithSurrounds")}),n.updateSelectionsState({kind:0,primary:p.handle,selections:h.map(f=>f.handle)}),t.revealCellRangeInView(t.getFocus());let g=t.cellAt(t.getFocus().start);c===1&&g&&(g.focusMode=1)}}function aZo(a,i){let e=[],t=i.getLineCount(),o=s=>i.getLineLength(s);a=a.sort((s,l)=>{let c=s.lineNumber-l.lineNumber,u=s.column-l.column;return c!==0?c:u});for(let s of a)o(s.lineNumber)+1===s.column&&s.column!==1&&s.lineNumber<t&&(s=new ye(s.lineNumber+1,1)),lZo(e,s);if(e.length===0)return null;let n=new ye(1,1),r=new ye(t,o(t)+1);return[n,...e,r]}function lZo(a,i){let e=a.length>0?a[a.length-1]:void 0;(!e||e.lineNumber!==i.lineNumber||e.column!==i.column)&&a.push(i)}function dgo(a,i){let e=aZo(i,a.textBuffer);if(!e)return null;let t=[];for(let o=1;o<e.length;o++){let n=e[o-1],r=e[o];t.push(a.textBuffer.getValueInRange(new z(n.lineNumber,n.column,r.lineNumber,r.column),0))}return t}function GH(a,i,e,t,o="above",n="",r=!1,s){let l=i.getViewModel(),c=i.activeKernel;if(l.options.isReadOnly)return null;let u=i.cellAt(e),p=r?l.getNextVisibleCellIndex(e):e+1,h;if(t===2){let f=c?.supportedLanguages??a.getRegisteredLanguageIds(),v=f[0]||$r;if(u?.cellKind===2)h=u.language;else if(u?.cellKind===1){let b=l.nearestCodeCellIndex(e);b>-1?h=l.cellAt(b).language:h=v}else if(!u&&l.length===0){let b=s?.getKernels(l.notebookDocument);b?.all.length?h=b.all[0].supportedLanguages[0]||v:h=v}else u===void 0&&o==="above"?h=l.viewCells.find(b=>b.cellKind===2)?.language||v:h=v;f.includes(h)||(h=v)}else h="markdown";return cZo(l,u?o==="above"?e:p:e,n,h,t,void 0,[],!0,!0)}function cZo(a,i,e,t,o,n,r,s,l){let c={kind:1,focus:{start:i,end:i+1},selections:[{start:i,end:i+1}]};return a.notebookDocument.applyEdits([{editType:1,index:i,count:0,cells:[{cellKind:o,language:t,mime:void 0,outputs:r,metadata:n,source:e}]}],s,{kind:1,focus:a.getFocus(),selections:a.getSelections()},()=>c,void 0,l&&!a.options.isReadOnly),a.cellAt(i)}var dZo="notebook.cell.insertCodeCellAbove",I1t="notebook.cell.insertCodeCellBelow",uZo="notebook.cell.insertCodeCellAboveAndFocusContainer",pZo="notebook.cell.insertCodeCellBelowAndFocusContainer",bTi="notebook.cell.insertCodeCellAtTop",mZo="notebook.cell.insertMarkdownCellAbove",STi="notebook.cell.insertMarkdownCellBelow",ugo="notebook.cell.insertMarkdownCellAtTop";function ITi(a,i,e,t,o){let n=null;i.ui&&i.notebookEditor.focus();let r=a.get(_t),s=a.get(eM);if(i.cell){let l=i.notebookEditor.getCellIndex(i.cell);n=GH(r,i.notebookEditor,l,e,t,void 0,!0,s)}else{let l=i.notebookEditor.getFocus(),c=Math.max(l.end-1,0);n=GH(r,i.notebookEditor,c,e,t,void 0,!0,s)}return n}var Pte=class extends mp{constructor(e,t,o,n){super(e);this.kind=t;this.direction=o;this.focusEditor=n}async runWithContext(e,t){let o=await ITi(e,t,this.kind,this.direction,this.focusEditor);o&&await t.notebookEditor.focusNotebookCell(o,this.focusEditor?"editor":"container")}};W(class extends Pte{constructor(){super({id:dZo,title:d(12492,null),keybinding:{primary:3075,when:C.and(pp,ig.toNegated()),weight:200},menu:{id:D.NotebookCellInsert,order:0}},2,"above",!0)}});W(class extends Pte{constructor(){super({id:uZo,title:d(12493,null)},2,"above",!1)}});W(class extends Pte{constructor(){super({id:I1t,title:d(12495,null),keybinding:{primary:2051,when:C.and(pp,ig.toNegated()),weight:200},menu:{id:D.NotebookCellInsert,order:1}},2,"below",!0)}});W(class extends Pte{constructor(){super({id:pZo,title:d(12496,null)},2,"below",!1)}});W(class extends Pte{constructor(){super({id:mZo,title:d(12497,null),menu:{id:D.NotebookCellInsert,order:2}},1,"above",!0)}});W(class extends Pte{constructor(){super({id:STi,title:d(12499,null),menu:{id:D.NotebookCellInsert,order:3}},1,"below",!0)}});W(class extends mp{constructor(){super({id:bTi,title:d(12494,null),f1:!1})}async run(i,e){e=e??this.getEditorContextFromArgsOrActive(i),e&&this.runWithContext(i,e)}async runWithContext(i,e){let t=i.get(_t),o=i.get(eM),n=GH(t,e.notebookEditor,0,2,"above",void 0,!0,o);n&&await e.notebookEditor.focusNotebookCell(n,"editor")}});W(class extends mp{constructor(){super({id:ugo,title:d(12498,null),f1:!1})}async run(i,e){e=e??this.getEditorContextFromArgsOrActive(i),e&&this.runWithContext(i,e)}async runWithContext(i,e){let t=i.get(_t),o=i.get(eM),n=GH(t,e.notebookEditor,0,1,"above",void 0,!0,o);n&&await e.notebookEditor.focusNotebookCell(n,"editor")}});ve.appendMenuItem(D.NotebookCellBetween,{command:{id:I1t,title:"$(add) "+d(12500,null),tooltip:d(12504,null)},order:0,group:"inline",when:C.and(Xl.isEqualTo(!0),C.notEquals("config.notebook.experimental.insertToolbarAlignment","left"))});ve.appendMenuItem(D.NotebookCellBetween,{command:{id:I1t,title:d(12502,null),icon:R.add,tooltip:d(12504,null)},order:0,group:"inline",when:C.and(Xl.isEqualTo(!0),C.equals("config.notebook.experimental.insertToolbarAlignment","left"))});ve.appendMenuItem(D.NotebookToolbar,{command:{id:I1t,icon:R.add,title:d(12503,null),tooltip:d(12504,null)},order:-5,group:"navigation/add",when:C.and(Xl.isEqualTo(!0),C.notEquals("config.notebook.insertToolbarLocation","betweenCells"),C.notEquals("config.notebook.insertToolbarLocation","hidden"))});ve.appendMenuItem(D.NotebookCellListTop,{command:{id:bTi,title:"$(add) "+d(12500,null),tooltip:d(12504,null)},order:0,group:"inline",when:C.and(Xl.isEqualTo(!0),C.notEquals("config.notebook.experimental.insertToolbarAlignment","left"))});ve.appendMenuItem(D.NotebookCellListTop,{command:{id:bTi,title:d(12501,null),icon:R.add,tooltip:d(12504,null)},order:0,group:"inline",when:C.and(Xl.isEqualTo(!0),C.equals("config.notebook.experimental.insertToolbarAlignment","left"))});ve.appendMenuItem(D.NotebookCellBetween,{command:{id:STi,title:"$(add) "+d(12505,null),tooltip:d(12507,null)},order:1,group:"inline",when:C.and(Xl.isEqualTo(!0),C.notEquals("config.notebook.experimental.insertToolbarAlignment","left"))});ve.appendMenuItem(D.NotebookToolbar,{command:{id:STi,icon:R.add,title:d(12506,null),tooltip:d(12507,null)},order:-5,group:"navigation/add",when:C.and(Xl.isEqualTo(!0),C.notEquals("config.notebook.insertToolbarLocation","betweenCells"),C.notEquals("config.notebook.insertToolbarLocation","hidden"),C.notEquals(`config.${yt.globalToolbarShowLabel}`,!1),C.notEquals(`config.${yt.globalToolbarShowLabel}`,"never"))});ve.appendMenuItem(D.NotebookCellListTop,{command:{id:ugo,title:"$(add) "+d(12505,null),tooltip:d(12507,null)},order:1,group:"inline",when:C.and(Xl.isEqualTo(!0),C.notEquals("config.notebook.experimental.insertToolbarAlignment","left"))});ne.as(Jt.Configuration).registerConfiguration({id:"editor",properties:{"inlineChat.finishOnType":{description:d(11283,null),default:!1,type:"boolean"},"inlineChat.enableV2":{description:d(11282,null),default:!1,type:"boolean",tags:["preview"],experiment:{mode:"auto"}},"inlineChat.notebookAgent":{markdownDescription:d(11318,null),default:!1,type:"boolean",tags:["experimental"],experiment:{mode:"startup"}},"inlineChat.affordance":{description:d(11274,null),default:"off",type:"string",enum:["off","gutter","editor"],enumDescriptions:[d(11277,null),d(11276,null),d(11275,null)],experiment:{mode:"auto"},tags:["experimental"]},"inlineChat.renderMode":{description:d(11319,null),default:"hover",type:"string",enum:["zone","hover"],enumDescriptions:[d(11321,null),d(11320,null)],experiment:{mode:"auto"},tags:["experimental"]},"inlineChat.fixDiagnostics":{description:d(11284,null),default:!0,type:"boolean",experiment:{mode:"auto"},tags:["experimental"]},"inlineChat.askInChat":{description:d(11278,null),default:!0,type:"boolean"}}});var y1t="interactiveEditor";var w1t=new Y("inlineChatPossible",!1,d(11301,null)),yTi=new Y("inlineChatHasEditsAgent",!1,d(11298,null)),hZo=new Y("inlineChatHasNotebookInline",!1,d(11300,null)),wTi=new Y("inlineChatHasNotebookAgent",!1,d(11299,null)),nW=new Y("inlineChatVisible",!1,d(11317,null)),_G=new Y("inlineChatFocused",!1,d(11297,null)),CTi=new Y("inlineChatEditing",!0,d(11294,null)),C1t=new Y("inlineChatResponseFocused",!1,d(11314,null)),IBu=new Y("inlineChatEmpty",!1,d(11295,null)),pit=new Y("inlineChatInputHasText",!1,d(11309,null)),A8=new Y("inlineChatInputWidgetFocused",!1,d(11310,null)),yBu=new Y("inlineChatInnerCursorFirst",!1,d(11303,null)),wBu=new Y("inlineChatInnerCursorLast",!1,d(11304,null)),mit=new Y("inlineChatOuterCursorPosition","",d(11311,null)),CBu=new Y("inlineChatHasStashedSession",!1,d(11302,null)),xBu=new Y("inlineChatChangeHasDiff",!1,d(11290,null)),kBu=new Y("inlineChatChangeShowsDiff",!1,d(11291,null)),OAe=new Y("inlineChatRequestInProgress",!1,d(11313,null)),pgo=new Y("inlineChatResponseType","none",d(11315,null)),Py=new Y("inlineChatFileBelongsToChat",!1,d(11296,null)),x1t=new Y("inlineChatPendingConfirmation",!1,d(11312,null)),Mhe=new Y("inlineChatTerminated",!1,d(11316,null)),k1t=new Y("inlineChatAffordanceVisible",!1,d(11289,null)),hit=C.or(C.and(Za,hZo)),Phe=C.or(yTi,C.and(Za,wTi)),YD=C.equals("config.inlineChat.renderMode","hover"),git=C.equals("config.inlineChat.fixDiagnostics",!0),EM=C.equals("config.inlineChat.askInChat",!0),N8="inlineChat.start",E1t="inlineChat.askInChat",mgo="inlineChat.acceptChanges";var hgo="inlineChat.regenerate";var ggo="inlineChat.toggleDiff",fgo="inlineChat.reportIssue",Ate=D.for("inlineChatWidget.status"),qH=D.for("inlineChatWidget.secondary"),EBu=D.for("inlineChatWidget.changesZone"),vgo=D.for("inlineChatWidget.side"),bgo=te("inlineChat.foreground",jL,d(11287,null)),xTi=te("inlineChat.background",Su,d(11285,null)),TBu=te("inlineChat.border",CO,d(11286,null)),_Bu=te("inlineChat.shadow",kO,d(11288,null)),DBu=te("inlineChatInput.border",CO,d(11306,null)),LBu=te("inlineChatInput.focusBorder",Sd,d(11307,null)),RBu=te("inlineChatInput.placeholderForeground",Hye,d(11308,null)),MBu=te("inlineChatInput.background",yv,d(11305,null)),PBu=te("inlineChatDiff.inserted",ai(df,.5),d(11292,null)),ABu=te("editorOverviewRuler.inlineChatInserted",{dark:ai(df,.6),light:ai(df,.8),hcDark:ai(df,.6),hcLight:ai(df,.8)},d(11280,null)),NBu=te("editorMinimap.inlineChatInserted",{dark:ai(df,.6),light:ai(df,.8),hcDark:ai(df,.6),hcLight:ai(df,.8)},d(11279,null)),OBu=te("inlineChatDiff.removed",ai(zf,.5),d(11293,null)),FBu=te("editorOverviewRuler.inlineChatRemoved",{dark:ai(zf,.6),light:ai(zf,.8),hcDark:ai(zf,.6),hcLight:ai(zf,.8)},d(11281,null));var gZo="notebook.execute",fZo="notebook.cancelExecution",vZo="notebook.interruptExecution",bZo="notebook.cell.cancelExecution",SZo="notebook.cell.executeAndFocusContainer",Sgo="notebook.cell.executeAndSelectBelow",Igo="notebook.cell.executeAndInsertBelow",IZo="notebook.cell.executeCellAndBelow",yZo="notebook.cell.executeCellsAbove",wZo="notebook.renderAllMarkdownCells",CZo="notebook.revealRunningCell",xZo="notebook.revealLastFailedCell",Ahe=C.and(NS.isEqualTo("code"),C.or(C.greater(rte.key,0),C.greater(vPe.key,0),rUt)),fit=C.and(Ahe,iUt.toNegated()),Cgo=C.and(NS.isEqualTo("markup"));function xgo(a){for(let i=0;i<a.notebookEditor.getLength();i++){let e=a.notebookEditor.cellAt(i);e.cellKind===1&&e.updateEditState(0,"renderAllMarkdownCells")}}async function _1t(a,i,e){let t=a.activeGroup;if(t&&t.activeEditor&&t.pinEditor(t.activeEditor),i.autoReveal&&(i.cell||i.selectedCells?.length)&&e&&e.openEditor({resource:i.notebookEditor.textModel.uri,options:{revealIfOpened:!0}}),i.ui&&i.cell)i.autoReveal&&ygo(i.cell,i.notebookEditor),await i.notebookEditor.executeNotebookCells(vt.single(i.cell));else if(i.selectedCells?.length||i.cell){let n=i.selectedCells?.length?i.selectedCells:[i.cell],r=n[0];r&&i.autoReveal&&ygo(r,i.notebookEditor),await i.notebookEditor.executeNotebookCells(n)}let o;for(let[,n]of i.notebookEditor.codeEditors)if(Qe(n.getModel()?.uri,(i.cell??i.selectedCells?.[0])?.uri)){o=n;break}}var kZo=20,EZo=60;function ygo(a,i){if(i.focusNotebookCell(a,"container",{skipReveal:!0}),a.cellKind===1){let v=i.getCellIndex(a);i.revealCellRangeInView({start:v,end:v+1});return}if(!(a instanceof ih))return;let e=i.getAbsoluteTopOfElement(a),t=e+a.layoutInfo.outputContainerOffset,o=a.layoutInfo.outputTotalHeight,n=i.getAbsoluteBottomOfElement(a),r=i.getLayoutInfo().height,s=r*.34,l=r*.66,c=a.layoutInfo.totalHeight,u=e>=i.scrollTop&&n<=i.scrollBottom,p=t-25>=i.scrollTop&&t+25<=i.scrollBottom,h=v=>{i.setScrollTop(v-kZo)},g=v=>{i.setScrollTop(v)},f=v=>{i.setScrollTop(v+EZo)};if(!u){if(c<=r&&!p){h(e);return}c>r&&!p&&(o>0&&o>=l?g(t-s):o>0?f(n-r):g(t-l))}}W(class extends mp{constructor(){super({id:wZo,title:d(12484,null)})}async runWithContext(i,e){xgo(e)}});W(class extends mp{constructor(){super({id:gZo,title:d(12482,null),icon:Cmo,metadata:{description:d(12482,null),args:[{name:"uri",description:"The document uri"}]},menu:[{id:D.EditorTitle,order:-1,group:"navigation",when:C.and(Za,C.or(BH.toNegated(),VH.toNegated()),C.notEquals("config.notebook.globalToolbar",!0))},{id:D.NotebookToolbar,order:-1,group:"navigation/execute",when:C.and(C.or(BH.toNegated(),VH.toNegated()),C.and(VH,BH.toNegated())?.negate(),C.equals("config.notebook.globalToolbar",!0))}]})}getEditorContextFromArgsOrActive(i,e){return aUt(i,e)??ehe(i.get(ee))}async runWithContext(i,e){xgo(e);let o=i.get(ee).findEditors({resource:e.notebookEditor.textModel.uri,typeId:Ra.ID,editorId:e.notebookEditor.textModel.viewType}).at(0),n=i.get(wt);return o&&n.getGroup(o.groupId)?.pinEditor(o.editor),e.notebookEditor.executeNotebookCells()}});W(class extends Hg{constructor(){super({id:reo,precondition:fit,title:d(12476,null),keybinding:{when:pp,primary:259,win:{primary:2563},weight:Df},menu:{id:D.NotebookCellExecutePrimary,when:fit,group:"inline"},metadata:{description:d(12476,null),args:btt},icon:hG})}parseArgs(i,...e){return mG(i,...e)}async runWithContext(i,e){let t=i.get(wt),o=i.get(ee);e.ui&&await e.notebookEditor.focusNotebookCell(e.cell,"container",{skipReveal:!0}),await _1t(t,e,o)}});W(class extends Hg{constructor(){super({id:yZo,precondition:Ahe,title:d(12477,null),menu:[{id:D.NotebookCellExecute,when:C.and(Ahe,C.equals(`config.${yt.consolidatedRunButton}`,!0))},{id:D.NotebookCellTitle,order:2,group:Y0,when:C.and(Ahe,C.equals(`config.${yt.consolidatedRunButton}`,!1))}],icon:Imo})}parseArgs(i,...e){return mG(i,...e)}async runWithContext(i,e){let t;if(e.ui?(t=e.notebookEditor.getCellIndex(e.cell),await e.notebookEditor.focusNotebookCell(e.cell,"container",{skipReveal:!0})):t=Math.min(...e.selectedCells.map(o=>e.notebookEditor.getCellIndex(o))),typeof t=="number"){let o={start:0,end:t},n=e.notebookEditor.getCellsInRange(o);e.notebookEditor.executeNotebookCells(n)}}});W(class extends Hg{constructor(){super({id:IZo,precondition:Ahe,title:d(12481,null),menu:[{id:D.NotebookCellExecute,when:C.and(Ahe,C.equals(`config.${yt.consolidatedRunButton}`,!0))},{id:D.NotebookCellTitle,order:3,group:Y0,when:C.and(Ahe,C.equals(`config.${yt.consolidatedRunButton}`,!1))}],icon:ymo})}parseArgs(i,...e){return mG(i,...e)}async runWithContext(i,e){let t;if(e.ui?(t=e.notebookEditor.getCellIndex(e.cell),await e.notebookEditor.focusNotebookCell(e.cell,"container",{skipReveal:!0})):t=Math.min(...e.selectedCells.map(o=>e.notebookEditor.getCellIndex(o))),typeof t=="number"){let o={start:t,end:e.notebookEditor.getLength()},n=e.notebookEditor.getCellsInRange(o);e.notebookEditor.executeNotebookCells(n)}}});W(class extends Hg{constructor(){super({id:SZo,precondition:fit,title:d(12478,null),metadata:{description:d(12478,null),args:btt},icon:hG})}parseArgs(i,...e){return mG(i,...e)}async runWithContext(i,e){let t=i.get(wt),o=i.get(ee);if(e.ui)await e.notebookEditor.focusNotebookCell(e.cell,"container",{skipReveal:!0});else{let n=e.selectedCells[0];n&&await e.notebookEditor.focusNotebookCell(n,"container",{skipReveal:!0})}await _1t(t,e,o)}});var wgo=C.or(C.equals(Jme.key,"executing"),C.equals(Jme.key,"pending"));W(class extends Hg{constructor(){super({id:bZo,precondition:wgo,title:d(12474,null),icon:lUt,menu:{id:D.NotebookCellExecutePrimary,when:wgo,group:"inline"},metadata:{description:d(12474,null),args:[{name:"options",description:"The cell range options",schema:{type:"object",required:["ranges"],properties:{ranges:{type:"array",items:[{type:"object",required:["start","end"],properties:{start:{type:"number"},end:{type:"number"}}}]},document:{type:"object",description:"The document uri"}}}}]}})}parseArgs(i,...e){return mG(i,...e)}async runWithContext(i,e){return e.ui?(await e.notebookEditor.focusNotebookCell(e.cell,"container",{skipReveal:!0}),e.notebookEditor.cancelNotebookCells(vt.single(e.cell))):e.notebookEditor.cancelNotebookCells(e.selectedCells)}});W(class extends Pd{constructor(){super({id:Sgo,precondition:C.or(fit,NS.isEqualTo("markup")),title:d(12480,null),keybinding:{when:C.and(pp,_G.negate()),primary:1027,weight:Df}})}async runWithContext(i,e){let t=i.get(wt),o=i.get(ee),n=e.notebookEditor.getCellIndex(e.cell);if(typeof n!="number")return;let r=i.get(_t),l=i.get(B).getValue(yt.scrollToRevealCell),c;if(l==="none"?c={skipReveal:!0}:c={revealBehavior:l==="fullCell"?0:1},e.cell.cellKind===1){let u=e.notebookEditor.cellAt(n+1);if(e.cell.updateEditState(0,Sgo),u)await e.notebookEditor.focusNotebookCell(u,"container",c);else{let p=GH(r,e.notebookEditor,n,1,"below");p&&await e.notebookEditor.focusNotebookCell(p,"editor",c)}return}else{let u=e.notebookEditor.cellAt(n+1);if(u)await e.notebookEditor.focusNotebookCell(u,"container",c);else{let p=GH(r,e.notebookEditor,n,2,"below");p&&await e.notebookEditor.focusNotebookCell(p,"editor",c)}return _1t(t,e,o)}}});W(class extends Pd{constructor(){super({id:Igo,precondition:C.or(fit,NS.isEqualTo("markup")),title:d(12479,null),keybinding:{when:pp,primary:515,weight:Df}})}async runWithContext(i,e){let t=i.get(wt),o=i.get(ee),n=e.notebookEditor.getCellIndex(e.cell),r=i.get(_t),s=e.cell.focusMode===1?"editor":"container",l=GH(r,e.notebookEditor,n,e.cell.cellKind,"below");l&&await e.notebookEditor.focusNotebookCell(l,s),e.cell.cellKind===1?e.cell.updateEditState(0,Igo):_1t(t,e,o)}});var T1t=class extends mp{getEditorContextFromArgsOrActive(i,e){return aUt(i,e)??ehe(i.get(ee))}async runWithContext(i,e){return e.notebookEditor.cancelNotebookCells()}};W(class extends T1t{constructor(){super({id:fZo,title:L(12475,"Stop Execution"),icon:lUt,menu:[{id:D.EditorTitle,order:-1,group:"navigation",when:C.and(Za,VH,BH.toNegated(),C.notEquals("config.notebook.globalToolbar",!0))},{id:D.NotebookToolbar,order:-1,group:"navigation/execute",when:C.and(VH,BH.toNegated(),C.equals("config.notebook.globalToolbar",!0))}]})}});W(class extends T1t{constructor(){super({id:vZo,title:L(12483,"Interrupt"),precondition:C.and(VH,BH),icon:lUt,menu:[{id:D.EditorTitle,order:-1,group:"navigation",when:C.and(Za,VH,BH,C.notEquals("config.notebook.globalToolbar",!0))},{id:D.NotebookToolbar,order:-1,group:"navigation/execute",when:C.and(VH,BH,C.equals("config.notebook.globalToolbar",!0))},{id:D.InteractiveToolbar,group:"navigation/execute"}]})}});ve.appendMenuItem(D.NotebookToolbar,{title:d(12488,null),submenu:D.NotebookCellExecuteGoTo,group:"navigation/execute",order:20,icon:q.modify(Qw,"spin")});W(class extends mp{constructor(){super({id:CZo,title:d(12487,null),tooltip:d(12487,null),shortTitle:d(12487,null),precondition:l8,menu:[{id:D.EditorTitle,when:C.and(Za,l8,C.notEquals("config.notebook.globalToolbar",!0)),group:"navigation",order:0},{id:D.NotebookCellExecuteGoTo,when:C.and(Za,l8,C.equals("config.notebook.globalToolbar",!0)),group:"navigation/execute",order:20},{id:D.InteractiveToolbar,when:C.and(l8,C.equals("activeEditor","workbench.editor.interactive")),group:"navigation",order:10}],icon:q.modify(Qw,"spin")})}async runWithContext(i,e){let t=i.get(bs),o=e.notebookEditor.textModel.uri,n=t.getCellExecutionsForNotebook(o);if(n[0]){let s=this.findCellAtTopFrame(i,o)??n[0].cellHandle,l=e.notebookEditor.getCellByHandle(s);l&&e.notebookEditor.focusNotebookCell(l,"container")}}findCellAtTopFrame(i,e){let t=i.get(Ni);for(let o of t.getModel().getSessions())for(let n of o.getAllThreads()){let r=n.getTopStackFrame();if(r){let s=Zo.parse(r.source.uri);if(s&&s.notebook.toString()===e.toString())return s.handle}}}});W(class extends mp{constructor(){super({id:xZo,title:d(12485,null),tooltip:d(12485,null),shortTitle:d(12486,null),precondition:mPe,menu:[{id:D.EditorTitle,when:C.and(Za,mPe,l8.toNegated(),C.notEquals("config.notebook.globalToolbar",!0)),group:"navigation",order:0},{id:D.NotebookCellExecuteGoTo,when:C.and(Za,mPe,l8.toNegated(),C.equals("config.notebook.globalToolbar",!0)),group:"navigation/execute",order:20}],icon:IPe})}async runWithContext(i,e){let t=i.get(bs),o=e.notebookEditor.textModel.uri,n=t.getLastFailedCellForNotebook(o);if(n!==void 0){let r=e.notebookEditor.getCellByHandle(n);r&&e.notebookEditor.focusNotebookCell(r,"container")}}});var Ay;(i=>i.Id="outline")(Ay||={});var D1t=new Y("outlineFollowsCursor",!1),L1t=new Y("outlineFiltersOnType",!1),FAe=new Y("outlineSortMode",0),vit=new Y("outlineAllCollapsed",!1),kgo=new Y("outlineFocused",!0);var Cit=class{constructor(i,e,t,o,n,r){this.container=i;this.iconClass=e;this.iconLabel=t;this.decoration=o;this.actionMenu=n;this.elementDisposables=r}static{this.templateId="NotebookOutlineRenderer"}},bit=class{constructor(i,e,t,o,n,r,s,l){this._editor=i;this._target=e;this._themeService=t;this._configurationService=o;this._contextMenuService=n;this._contextKeyService=r;this._menuService=s;this._instantiationService=l;this.templateId=Cit.templateId}renderTemplate(i){let e=new N;i.classList.add("notebook-outline-element","show-file-icons");let t=document.createElement("div");i.append(t);let o=new Bc(i,{supportHighlights:!0}),n=document.createElement("div");n.className="element-decoration",i.append(n);let r=document.createElement("div");return r.className="action-menu",i.append(r),new Cit(i,t,o,n,r,e)}renderElement(i,e,t){let o=[],n={matches:xa(i.filterData),labelEscapeNewLines:!0,extraClasses:o},r=i.element.cell.cellKind===2;i.element.level>=8?t.iconClass.className="element-icon "+q.asClassNameArray(i.element.icon).join(" "):r&&this._themeService.getFileIconTheme().hasFileIcons&&!i.element.isExecuting?(t.iconClass.className="",o.push(...lK(i.element.cell.language??""))):t.iconClass.className="element-icon "+q.asClassNameArray(i.element.icon).join(" "),t.iconLabel.setLabel(" "+i.element.label,void 0,n);let{markerInfo:s}=i.element;if(t.container.style.removeProperty("--outline-element-color"),t.decoration.innerText="",s){let l=this._configurationService.getValue("problems.visibility");!this._configurationService.getValue("outline.problems.badges")||!l?(t.decoration.classList.remove("bubble"),t.decoration.innerText=""):s.count===0?(t.decoration.classList.add("bubble"),t.decoration.innerText="\uEA71"):(t.decoration.classList.remove("bubble"),t.decoration.innerText=s.count>9?"9+":String(s.count));let u=this._themeService.getColorTheme().getColor(s.topSev===8?Gx:q1);if(l===void 0)return;!this._configurationService.getValue("outline.problems.colors")||!l?(t.container.style.removeProperty("--outline-element-color"),t.decoration.style.setProperty("--outline-element-color",u?.toString()??"inherit")):t.container.style.setProperty("--outline-element-color",u?.toString()??"inherit")}if(this._target===1){if(!this._editor)return;let l=i.element.cell,c=this._editor.getViewModel();if(!c)return;let u=c.getCellIndex(l),p=r?0:c.getFoldedLength(u),h=t.elementDisposables.add(this._contextKeyService.createScoped(t.container));av.CellKind.bindTo(h).set(r?2:1),av.CellHasChildren.bindTo(h).set(p>0),av.CellHasHeader.bindTo(h).set(i.element.level!==7),av.OutlineElementTarget.bindTo(h).set(this._target),this.setupFolding(r,c,h,t,l);let g=t.elementDisposables.add(new wp(t.actionMenu,this._contextMenuService,{actionViewItemProvider:b=>{if(b instanceof Lo)return this._instantiationService.createInstance(xl,b,void 0)}})),f=t.elementDisposables.add(this._menuService.createMenu(D.NotebookOutlineActionMenu,h)),v=ETi(f,{notebookEditor:this._editor,outlineEntry:i.element});g.setActions(v.primary,v.secondary),this.setupToolbarListeners(this._editor,g,f,v,i.element,t),t.actionMenu.style.padding="0 0.8em 0 0.4em"}}disposeTemplate(i){i.iconLabel.dispose(),i.elementDisposables.dispose()}disposeElement(i,e,t){t.elementDisposables.clear(),Rt(t.actionMenu)}setupFolding(i,e,t,o,n){let r=i?0:n.foldingState,s=av.CellFoldingState.bindTo(t);s.set(r),i||o.elementDisposables.add(e.onDidFoldingStateChanged(()=>{let l=n.foldingState;av.CellFoldingState.bindTo(t).set(l),s.set(l)}))}setupToolbarListeners(i,e,t,o,n,r){let s=!1,l;e.setActions(o.primary,o.secondary),r.elementDisposables.add(t.onDidChange(()=>{if(s){let u=ETi(t,{notebookEditor:i,outlineEntry:n});l=()=>e.setActions(u.primary,u.secondary);return}let c=ETi(t,{notebookEditor:i,outlineEntry:n});e.setActions(c.primary,c.secondary)})),r.container.classList.remove("notebook-outline-toolbar-dropdown-active"),r.elementDisposables.add(e.onDidChangeDropdownVisibility(c=>{s=c,c?r.container.classList.add("notebook-outline-toolbar-dropdown-active"):r.container.classList.remove("notebook-outline-toolbar-dropdown-active"),l&&!c&&(tn(()=>{l?.()},0,r.elementDisposables),l=void 0)}))}};bit=I([m(2,Le),m(3,B),m(4,Xe),m(5,X),m(6,Kt),m(7,F)],bit);function ETi(a,i){return ml(a.getActions({shouldForwardArgs:!0,arg:i}),e=>/^inline/.test(e))}var TTi=class{getAriaLabel(i){return i.label}getWidgetAriaLabel(){return""}},_Ti=class{getKeyboardNavigationLabel(i){return i.label}},DTi=class{getHeight(i){return 22}getTemplateId(i){return Cit.templateId}},Sit=class{constructor(i,e,t){this.notebookCellOutlineDataSourceRef=i;this._configurationService=e;this._themeService=t;this._disposables=new N;this.gotoShowCodeCellSymbols=this._configurationService.getValue(yt.gotoSymbolsAllSymbols),this._disposables.add(this._configurationService.onDidChangeConfiguration(o=>{o.affectsConfiguration(yt.gotoSymbolsAllSymbols)&&(this.gotoShowCodeCellSymbols=this._configurationService.getValue(yt.gotoSymbolsAllSymbols))}))}getQuickPickElements(){let i=[];for(let r of this.notebookCellOutlineDataSourceRef?.object?.entries??[])r.asFlatList(i);let e=[],{hasFileIcons:t}=this._themeService.getFileIconTheme(),o=r=>!!r.symbolKind,n=r=>r.cell.cellKind===2&&r.level===7;for(let r=0;r<i.length;r++){let s=i[r],l=i[r+1];if(!this.gotoShowCodeCellSymbols&&o(s)||this.gotoShowCodeCellSymbols&&n(s)&&l&&o(l))continue;let c=t&&!s.symbolKind;e.push({element:s,label:c?s.label:`$(${s.icon.id}) ${s.label}`,ariaLabel:s.label,iconClasses:c?lK(s.cell.language??""):void 0})}return e}dispose(){this._disposables.dispose()}};Sit=I([m(1,B),m(2,Le)],Sit);function LTi(a,i,e,t){return!!(i&&a.cell.cellKind===1&&a.level===7||!e&&a.cell.cellKind===2||!t&&a.cell.cellKind===2&&a.level>7)}var Iit=class{constructor(i,e){this.outlineDataSourceRef=i;this._configurationService=e;this._disposables=new N;this.showCodeCells=this._configurationService.getValue(yt.outlineShowCodeCells),this.showCodeCellSymbols=this._configurationService.getValue(yt.outlineShowCodeCellSymbols),this.showMarkdownHeadersOnly=this._configurationService.getValue(yt.outlineShowMarkdownHeadersOnly),this._disposables.add(this._configurationService.onDidChangeConfiguration(t=>{t.affectsConfiguration(yt.outlineShowCodeCells)&&(this.showCodeCells=this._configurationService.getValue(yt.outlineShowCodeCells)),t.affectsConfiguration(yt.outlineShowCodeCellSymbols)&&(this.showCodeCellSymbols=this._configurationService.getValue(yt.outlineShowCodeCellSymbols)),t.affectsConfiguration(yt.outlineShowMarkdownHeadersOnly)&&(this.showMarkdownHeadersOnly=this._configurationService.getValue(yt.outlineShowMarkdownHeadersOnly))}))}getActiveEntry(){let i=this.outlineDataSourceRef?.object?.activeElement;if(!i)return;if(!LTi(i,this.showMarkdownHeadersOnly,this.showCodeCells,this.showCodeCellSymbols))return i;let e=i.parent;for(;e;)if(LTi(e,this.showMarkdownHeadersOnly,this.showCodeCells,this.showCodeCellSymbols))e=e.parent;else return e}*getChildren(i){let t=i instanceof WAe?this.outlineDataSourceRef?.object?.entries??[]:i.children;for(let o of t)o.cell.cellKind===1?this.showMarkdownHeadersOnly?o.level<7&&(yield o):yield o:this.showCodeCells&&o.cell.cellKind===2&&(this.showCodeCellSymbols?yield o:o.level===7&&(yield o))}dispose(){this._disposables.dispose()}};Iit=I([m(1,B)],Iit);var yit=class{constructor(i,e){this.outlineDataSourceRef=i;this._configurationService=e;this._disposables=new N;this.showCodeCells=this._configurationService.getValue(yt.breadcrumbsShowCodeCells),this._disposables.add(this._configurationService.onDidChangeConfiguration(t=>{t.affectsConfiguration(yt.breadcrumbsShowCodeCells)&&(this.showCodeCells=this._configurationService.getValue(yt.breadcrumbsShowCodeCells))}))}getBreadcrumbElements(){let i=[],e=this.outlineDataSourceRef?.object?.activeElement;for(;e;)(this.showCodeCells||e.cell.cellKind!==2)&&i.unshift({element:e,label:e.label}),e=e.parent;return i}dispose(){this._disposables.dispose()}};yit=I([m(1,B)],yit);var RTi=class{constructor(){this._collator=Jc.Collator(void 0,{numeric:!0})}compareByPosition(i,e){return i.index-e.index}compareByType(i,e){return i.cell.cellKind-e.cell.cellKind||this._collator.value.compare(i.label,e.label)}compareByName(i,e){return this._collator.value.compare(i.label,e.label)}},WAe=class{constructor(i,e,t,o,n,r,s,l){this._editor=i;this._target=e;this._themeService=t;this._editorService=o;this._instantiationService=n;this._configurationService=r;this._languageFeaturesService=s;this._notebookExecutionStateService=l;this.outlineKind="notebookCells";this._disposables=new N;this._modelDisposables=new N;this._dataSourceDisposables=new N;this._onDidChange=new E;this.onDidChange=this._onDidChange.event;this.delayerRecomputeState=this._disposables.add(new Xo(300));this.delayerRecomputeActive=this._disposables.add(new Xo(200));this.delayerRecomputeSymbols=this._disposables.add(new Xo(2e3));this.outlineShowCodeCells=this._configurationService.getValue(yt.outlineShowCodeCells),this.outlineShowCodeCellSymbols=this._configurationService.getValue(yt.outlineShowCodeCellSymbols),this.outlineShowMarkdownHeadersOnly=this._configurationService.getValue(yt.outlineShowMarkdownHeadersOnly),this.initializeOutline();let c=new DTi,u=[this._instantiationService.createInstance(bit,this._editor.getControl(),this._target)],p=new RTi,h={collapseByDefault:this._target===2||this._target===1&&this._configurationService.getValue("outline.collapseItems")==="alwaysCollapse",expandOnlyOnTwistieClick:!0,multipleSelectionSupport:!1,accessibilityProvider:new TTi,identityProvider:{getId:g=>g.cell.uri.toString()},keyboardNavigationLabelProvider:new _Ti};this.config={treeDataSource:this._treeDataSource,quickPickDataSource:this._quickPickDataSource,breadcrumbsDataSource:this._breadcrumbsDataSource,delegate:c,renderers:u,comparator:p,options:h}}get activeElement(){if(this.checkDelayer(),this._target===1)return this.config.treeDataSource.getActiveEntry();console.error("activeElement should not be called outside of the OutlinePane")}get entries(){return this.checkDelayer(),this._outlineDataSourceReference?.object?.entries??[]}get uri(){return this._outlineDataSourceReference?.object?.uri}get isEmpty(){return this._outlineDataSourceReference?.object?.entries?!this._outlineDataSourceReference.object.entries.some(i=>!LTi(i,this.outlineShowMarkdownHeadersOnly,this.outlineShowCodeCells,this.outlineShowCodeCellSymbols)):!0}checkDelayer(){this.delayerRecomputeState.isTriggered()&&(this.delayerRecomputeState.cancel(),this.recomputeState())}initializeOutline(){this.setDataSources(),this.setModelListeners(),this._disposables.add(this._editor.onDidChangeModel(()=>{this.setDataSources(),this.setModelListeners(),this.computeSymbols()})),this._disposables.add(this._languageFeaturesService.documentSymbolProvider.onDidChange(()=>{this.delayedComputeSymbols()})),this._disposables.add(this._editor.onDidChangeSelection(()=>{this.delayedRecomputeActive()})),this._disposables.add(this._configurationService.onDidChangeConfiguration(i=>{(i.affectsConfiguration(yt.outlineShowMarkdownHeadersOnly)||i.affectsConfiguration(yt.outlineShowCodeCells)||i.affectsConfiguration(yt.outlineShowCodeCellSymbols)||i.affectsConfiguration(yt.breadcrumbsShowCodeCells))&&(this.outlineShowCodeCells=this._configurationService.getValue(yt.outlineShowCodeCells),this.outlineShowCodeCellSymbols=this._configurationService.getValue(yt.outlineShowCodeCellSymbols),this.outlineShowMarkdownHeadersOnly=this._configurationService.getValue(yt.outlineShowMarkdownHeadersOnly),this.delayedRecomputeState())})),this._disposables.add(this._notebookExecutionStateService.onDidChangeExecution(i=>{i.type===0&&this._editor.textModel&&i.affectsNotebook(this._editor.textModel?.uri)&&this.delayedRecomputeState()})),this._disposables.add(this._configurationService.onDidChangeConfiguration(i=>{i.affectsConfiguration(yt.outlineShowCodeCellSymbols)&&(this.outlineShowCodeCellSymbols=this._configurationService.getValue(yt.outlineShowCodeCellSymbols),this.computeSymbols())})),this._disposables.add(this._themeService.onDidFileIconThemeChange(()=>{this._onDidChange.fire({})})),this.recomputeState()}setDataSources(){let i=this._editor.getControl();this._outlineDataSourceReference?.dispose(),this._dataSourceDisposables.clear(),i?.hasModel()?(this._outlineDataSourceReference=this._dataSourceDisposables.add(this._instantiationService.invokeFunction(e=>e.get(lAe).getOrCreate(i))),this._dataSourceDisposables.add(this._outlineDataSourceReference.object.onDidChange(()=>{this._onDidChange.fire({})}))):this._outlineDataSourceReference=void 0,this._treeDataSource=this._dataSourceDisposables.add(this._instantiationService.createInstance(Iit,this._outlineDataSourceReference)),this._quickPickDataSource=this._dataSourceDisposables.add(this._instantiationService.createInstance(Sit,this._outlineDataSourceReference)),this._breadcrumbsDataSource=this._dataSourceDisposables.add(this._instantiationService.createInstance(yit,this._outlineDataSourceReference))}setModelListeners(){this._modelDisposables.clear(),this._editor.textModel&&(this.entries.length||this.computeSymbols(),this._modelDisposables.add(this._editor.textModel.onDidChangeContent(i=>{i.rawEvents.some(e=>e.kind===10||e.kind===12||e.kind===2||e.kind===1)&&this.delayedRecomputeState()})))}async computeSymbols(i=Se.None){this._target===1&&this.outlineShowCodeCellSymbols&&this.doComputeSymbols(i)}async doComputeSymbols(i){await this._outlineDataSourceReference?.object?.computeFullSymbols(i)}async delayedComputeSymbols(){this.delayerRecomputeState.cancel(),this.delayerRecomputeActive.cancel(),this.delayerRecomputeSymbols.trigger(()=>{this.computeSymbols()})}recomputeState(){this._outlineDataSourceReference?.object?.recomputeState()}delayedRecomputeState(){this.delayerRecomputeActive.cancel(),this.delayerRecomputeState.trigger(()=>{this.recomputeState()})}recomputeActive(){this._outlineDataSourceReference?.object?.recomputeActive()}delayedRecomputeActive(){this.delayerRecomputeActive.trigger(()=>{this.recomputeActive()})}async reveal(i,e,t){let o={...e,override:this._editor.input?.editorId,cellRevealType:2,selection:i.position,viewState:void 0};await this._editorService.openEditor({resource:i.cell.uri,options:o},t?In:void 0)}preview(i){let e=this._editor.getControl();if(!e)return x.None;if(i.range){let n=z.lift(i.range);e.revealRangeInCenterIfOutsideViewportAsync(i.cell,n)}else e.revealInCenterIfOutsideViewport(i.cell);let t=e.deltaCellDecorations([],[{handle:i.cell.handle,options:{className:"nb-symbolHighlight",outputClassName:"nb-symbolHighlight"}}]),o;return e.changeModelDecorations(n=>{if(i.range){let r=[{range:i.range,options:{description:"document-symbols-outline-range-highlight",className:"rangeHighlight",isWholeLine:!0}}],s={ownerId:i.cell.handle,decorations:r};o=n.deltaDecorations([],[s])}}),Z(()=>{e.deltaCellDecorations(t,[]),o?.length&&e.changeModelDecorations(n=>{n.deltaDecorations(o,[])})})}captureViewState(){let i=this._editor.getControl(),e=i?.getEditorViewState();return Z(()=>{e&&i?.restoreListViewState(e)})}dispose(){this._onDidChange.dispose(),this._disposables.dispose(),this._modelDisposables.dispose(),this._dataSourceDisposables.dispose(),this._outlineDataSourceReference?.dispose()}};WAe=I([m(2,Le),m(3,ee),m(4,F),m(5,B),m(6,Qt),m(7,bs)],WAe);var wit=class{constructor(i,e){this._instantiationService=e;let t=i.registerOutlineCreator(this);this.dispose=()=>t.dispose()}matches(i){return i.getId()===jD.ID}async createOutline(i,e,t){let o=this._instantiationService.createInstance(WAe,i,e);return e===4&&await o.doComputeSymbols(t),o}};wit=I([m(0,cM),m(1,F)],wit);var av={CellKind:new Y("notebookCellKind",void 0),CellHasChildren:new Y("notebookCellHasChildren",!1),CellHasHeader:new Y("notebookCellHasHeader",!1),CellFoldingState:new Y("notebookCellFoldingState",0),OutlineElementTarget:new Y("notebookOutlineElementTarget",void 0)};ne.as(Qi.Workbench).registerWorkbenchContribution(wit,4);ne.as(Jt.Configuration).registerConfiguration({id:"notebook",order:100,type:"object",properties:{[yt.outlineShowMarkdownHeadersOnly]:{type:"boolean",default:!0,markdownDescription:d(12406,null)},[yt.outlineShowCodeCells]:{type:"boolean",default:!1,markdownDescription:d(12404,null)},[yt.outlineShowCodeCellSymbols]:{type:"boolean",default:!0,markdownDescription:d(12405,null)},[yt.breadcrumbsShowCodeCells]:{type:"boolean",default:!0,markdownDescription:d(12401,null)},[yt.gotoSymbolsAllSymbols]:{type:"boolean",default:!0,markdownDescription:d(12403,null)}}});ve.appendMenuItem(D.ViewTitle,{submenu:D.NotebookOutlineFilter,title:d(12402,null),icon:R.filter,group:"navigation",order:-1,when:C.and(C.equals("view",Ay.Id),Za)});W(class extends K{constructor(){super({id:"notebook.outline.toggleShowMarkdownHeadersOnly",title:d(12409,null),f1:!1,toggled:{condition:C.equals("config.notebook.outline.showMarkdownHeadersOnly",!0)},menu:{id:D.NotebookOutlineFilter,group:"0_markdown_cells"}})}run(i,...e){let t=i.get(B),o=t.getValue(yt.outlineShowMarkdownHeadersOnly);t.updateValue(yt.outlineShowMarkdownHeadersOnly,!o)}});W(class extends K{constructor(){super({id:"notebook.outline.toggleCodeCells",title:d(12407,null),f1:!1,toggled:{condition:C.equals("config.notebook.outline.showCodeCells",!0)},menu:{id:D.NotebookOutlineFilter,order:1,group:"1_code_cells"}})}run(i,...e){let t=i.get(B),o=t.getValue(yt.outlineShowCodeCells);t.updateValue(yt.outlineShowCodeCells,!o)}});W(class extends K{constructor(){super({id:"notebook.outline.toggleCodeCellSymbols",title:d(12408,null),f1:!1,toggled:{condition:C.equals("config.notebook.outline.showCodeCellSymbols",!0)},menu:{id:D.NotebookOutlineFilter,order:2,group:"1_code_cells"}})}run(i,...e){let t=i.get(B),o=t.getValue(yt.outlineShowCodeCellSymbols);t.updateValue(yt.outlineShowCodeCellSymbols,!o)}});var MTi=class extends K{constructor(){super({id:"notebook.section.runSingleCell",title:{...L(12542,"Run Cell"),mnemonicTitle:d(12540,null)},shortTitle:d(12543,null),icon:hG,menu:[{id:D.NotebookOutlineActionMenu,group:"inline",order:1,when:C.and(av.CellKind.isEqualTo(2),av.OutlineElementTarget.isEqualTo(1),av.CellHasChildren.toNegated(),av.CellHasHeader.toNegated())}]})}async run(i,e){R1t(e)&&e.notebookEditor.executeNotebookCells([e.outlineEntry.cell])}},PTi=class extends K{constructor(){super({id:"notebook.section.runCells",title:{...L(12544,"Run Cells In Section"),mnemonicTitle:d(12541,null)},shortTitle:d(12545,null),icon:hG,menu:[{id:D.NotebookStickyScrollContext,group:"notebookExecution",order:1},{id:D.NotebookOutlineActionMenu,group:"inline",order:1,when:C.and(av.CellKind.isEqualTo(1),av.OutlineElementTarget.isEqualTo(1),av.CellHasChildren,av.CellHasHeader)},{id:D.NotebookCellTitle,order:0,group:Y0,when:Cgo}]})}async run(i,e){let t;if(R1t(e))t=e.outlineEntry.cell;else if(_Zo(e))t=e.cell;else return;t.getEditState()===1&&e.notebookEditor.getContribution(kM.id).recompute();let o=e.notebookEditor.getViewModel()?.getCellIndex(t);if(o===void 0)return;let n=e.notebookEditor.getViewModel()?.getFoldingStartIndex(o);if(n===void 0)return;let r=e.notebookEditor.getViewModel()?.getFoldedLength(n);if(r===void 0)return;let s=e.notebookEditor.getCellsInRange({start:n,end:n+r+1});e.notebookEditor.executeNotebookCells(s)}},ATi=class extends K{constructor(){super({id:"notebook.section.foldSection",title:{...L(12536,"Fold Section"),mnemonicTitle:d(12539,null)},shortTitle:d(12537,null),menu:[{id:D.NotebookOutlineActionMenu,group:"notebookFolding",order:2,when:C.and(av.CellKind.isEqualTo(1),av.OutlineElementTarget.isEqualTo(1),av.CellHasChildren,av.CellHasHeader,av.CellFoldingState.isEqualTo(1))}]})}async run(i,e){R1t(e)&&this.toggleFoldRange(e.outlineEntry,e.notebookEditor)}toggleFoldRange(i,e){let t=e.getContribution(kM.id),o=i.index,n=i.level,r=2;t.setFoldingStateDown(o,r,n)}},NTi=class extends K{constructor(){super({id:"notebook.section.expandSection",title:{...L(12534,"Expand Section"),mnemonicTitle:d(12538,null)},shortTitle:d(12535,null),menu:[{id:D.NotebookOutlineActionMenu,group:"notebookFolding",order:2,when:C.and(av.CellKind.isEqualTo(1),av.OutlineElementTarget.isEqualTo(1),av.CellHasChildren,av.CellHasHeader,av.CellFoldingState.isEqualTo(2))}]})}async run(i,e){R1t(e)&&this.toggleFoldRange(e.outlineEntry,e.notebookEditor)}toggleFoldRange(i,e){let t=e.getContribution(kM.id),o=i.index,n=i.level,r=1;t.setFoldingStateDown(o,r,n)}};function R1t(a){return!!(a&&a.notebookEditor&&a.outlineEntry)}function _Zo(a){return!!(a&&a.notebookEditor&&a.cell)}W(MTi);W(PTi);W(ATi);W(NTi);W(class extends K{constructor(){super({id:"workbench.notebook.layout.select",title:L(12525,"Select between Notebook Layouts"),f1:!0,precondition:C.equals(`config.${yt.openGettingStarted}`,!0),category:th,menu:[{id:D.EditorTitle,group:"notebookLayout",when:C.and(Za,C.notEquals("config.notebook.globalToolbar",!0),C.equals(`config.${yt.openGettingStarted}`,!0)),order:0},{id:D.NotebookToolbar,group:"notebookLayout",when:C.and(C.equals("config.notebook.globalToolbar",!0),C.equals(`config.${yt.openGettingStarted}`,!0)),order:0}]})}run(i){i.get(ge).executeCommand("workbench.action.openWalkthrough",{category:"notebooks",step:"notebookProfile"},!0)}});W(class extends K{constructor(){super({id:"workbench.notebook.layout.configure",title:L(12524,"Customize Notebook Layout"),f1:!0,category:th,menu:[{id:D.NotebookToolbar,group:"notebookLayout",when:C.equals("config.notebook.globalToolbar",!0),order:1}]})}run(i){i.get(Go).openSettings({jsonEditor:!1,query:"@tag:notebookLayout"})}});W(class extends K{constructor(){super({id:"workbench.notebook.layout.configure.editorTitle",title:L(12524,"Customize Notebook Layout"),f1:!1,category:th,menu:[{id:D.NotebookEditorLayoutConfigure,group:"notebookLayout",when:Za,order:1}]})}run(i){i.get(Go).openSettings({jsonEditor:!1,query:"@tag:notebookLayout"})}});ve.appendMenuItem(D.EditorTitle,{submenu:D.NotebookEditorLayoutConfigure,title:L(12509,"Customize Notebook..."),icon:R.gear,group:"navigation",order:-1,when:Za});W(class extends K{constructor(){super({id:"notebook.toggleLineNumbersFromEditorTitle",title:L(12517,"Toggle Notebook Line Numbers"),shortTitle:L(12518,"Line Numbers"),precondition:pr,menu:[{id:D.NotebookEditorLayoutConfigure,group:"notebookLayoutDetails",order:1,when:Za}],category:th,f1:!0,toggled:{condition:C.notEquals("config.notebook.lineNumbers","off"),title:d(12513,null)}})}async run(i){return i.get(ge).executeCommand("notebook.toggleLineNumbers")}});W(class extends K{constructor(){super({id:"notebook.toggleCellToolbarPositionFromEditorTitle",title:L(12516,"Toggle Cell Toolbar Position"),menu:[{id:D.NotebookEditorLayoutConfigure,group:"notebookLayoutDetails",order:3}],category:th,f1:!1})}async run(i,...e){return i.get(ge).executeCommand("notebook.toggleCellToolbarPosition",...e)}});W(class extends K{constructor(){super({id:"breadcrumbs.toggleFromEditorTitle",title:L(12514,"Toggle Breadcrumbs"),shortTitle:L(12515,"Breadcrumbs"),toggled:{condition:C.equals("config.breadcrumbs.enabled",!0),title:d(12508,null)},menu:[{id:D.NotebookEditorLayoutConfigure,group:"notebookLayoutDetails",order:2}],category:th,f1:!1})}async run(i){return i.get(ge).executeCommand("breadcrumbs.toggle")}});W(class extends K{constructor(){super({id:"notebook.saveMimeTypeOrder",title:L(12512,"Save Mimetype Display Order"),f1:!0,category:th,precondition:Za})}run(i){let e=i.get(bn),t=new N,o=t.add(i.get(Ue).createQuickPick());o.placeholder=d(12511,null),o.items=[{target:2,label:d(12520,null)},{target:5,label:d(12521,null)}],t.add(o.onDidAccept(()=>{let n=o.selectedItems[0]?.target;n!==void 0&&e.saveMimeDisplayOrder(n),o.dispose()})),t.add(o.onDidHide(()=>t.dispose())),o.show()}});W(class extends K{constructor(){super({id:"workbench.notebook.layout.webview.reset",title:L(12526,"Reset Notebook Webview"),f1:!1,category:th})}run(i,e){let t=i.get(ee);if(e){let o=A.revive(e),r=i.get(Gc).listNotebookEditors().filter(s=>s.hasModel()&&s.textModel.uri.toString()===o.toString());for(let s of r)s.hasModel()&&s.getInnerWebview()?.reload()}else{let o=Jn(t.activeEditorPane);if(!o)return;o.getInnerWebview()?.reload()}}});W(class extends K{constructor(){super({id:"notebook.action.toggleNotebookStickyScroll",title:{...L(12522,"Toggle Notebook Sticky Scroll"),mnemonicTitle:d(12510,null)},shortTitle:L(12523,"Sticky Scroll"),category:Ve.View,toggled:{condition:C.equals("config.notebook.stickyScroll.enabled",!0),title:d(12519,null),mnemonicTitle:d(12510,null)},menu:[{id:D.CommandPalette},{id:D.NotebookStickyScrollContext,group:"notebookView",order:2},{id:D.NotebookToolbarContext,group:"notebookView",order:2}]})}async run(i){let e=i.get(B),t=!e.getValue("notebook.stickyScroll.enabled");return e.updateValue("notebook.stickyScroll.enabled",t)}});var VAe=le("IWebContentExtractorService"),DG=le("ISharedWebContentExtractorService");var xit=["text/plain","text/html","application/vnd.code.notebook.error","application/vnd.code.notebook.stdout","application/x.notebook.stdout","application/x.notebook.stream","application/vnd.code.notebook.stderr","application/x.notebook.stderr","image/png","image/jpeg","image/svg"];function M1t(a,i,e){let t=a.cellViewModel.handle,o=e.textModel,n=e.getCellByHandle(t);if(!n||n.outputsViewModels.length===0||!o)return;let r=o.uri,s=n.uri,l=o.cells.indexOf(n.model),c=a?.model.outputId,u=0;c!==void 0&&(u=n.outputsViewModels.findIndex(f=>f.model.outputId===c));let p=Zo.generateCellOutputUriWithIndex(r,s,u),h=Hp(Ga(r));return{value:p,id:p.toString(),name:d(12329,null,h,`${l+1}`,`${u+1}`),icon:i==="application/vnd.code.notebook.error"?q.fromId("error"):void 0,kind:"notebookOutput",outputIndex:u,mimeType:i}}var Nhe="application/vnd.code.additional-editor-data",kit=class{constructor(i,e,t,o,n){this.chatWidgetService=i;this.extensionService=e;this.fileService=t;this.environmentService=o;this.logService=n;this.kind=new fs("chat.attach.image");this.providedPasteEditKinds=[this.kind];this.copyMimeTypes=[];this.pasteMimeTypes=["image/*"];this.imagesFolder=Ge(this.environmentService.workspaceStorageHome,"vscode-chat-images"),TDt(this.fileService,this.logService,this.imagesFolder)}async provideDocumentPasteEdits(i,e,t,o,n){if(!this.extensionService.extensions.some(w=>Ua(w,"chatReferenceBinaryData")))return;let r=["image/png","image/jpeg","image/jpg","image/bmp","image/gif","image/tiff"],s,l;for(let w of r)if(l=t.get(w),l){s=w;break}if(!l||!s)return;let c=await l.asFile()?.data();if(n.isCancellationRequested||!c)return;let u=this.chatWidgetService.getWidgetByInputUri(i.uri);if(!u)return;let p=u.attachmentModel.attachments,h=d(8044,null),g=h;for(let w=2;p.some(k=>k.name===g);w++)g=`${h} ${w}`;let f=await EDt(this.fileService,this.imagesFolder,c,s);if(n.isCancellationRequested||!f)return;let v=await JP(c);if(n.isCancellationRequested||!v)return;let b=await DZo(v,s,n,g,f);if(n.isCancellationRequested||!b||u.attachmentModel.getAttachmentIDs().has(b.id))return;let y=Tgo(i,[b],s,this.kind,d(8043,null),this.chatWidgetService);return P1t(y)}};kit=I([m(2,fe),m(3,Eo),m(4,se)],kit);async function DZo(a,i,e,t,o){let n=await _it(a);if(!e.isCancellationRequested)return{kind:"image",value:a,id:n,name:t,icon:R.fileMedia,mimeType:i,isPasted:!0,references:[{reference:o,kind:"reference"}]}}async function _it(a){let i=await crypto.subtle.digest("SHA-256",a);return Array.from(new Uint8Array(i)).map(t=>t.toString(16).padStart(2,"0")).join("")}function Ego(a){return a.length<4?!1:Object.values({png:[137,80,78,71,13,10,26,10],jpeg:[255,216,255],bmp:[66,77],gif:[71,73,70,56],tiff:[73,73,42,0]}).some(e=>e.every((t,o)=>a[o]===t))}var Eit=class{constructor(i,e,t){this.modelService=i;this.languageFeaturesService=e;this.outlineModelService=t;this.providedPasteEditKinds=[];this.copyMimeTypes=[Nhe];this.pasteMimeTypes=[]}async prepareDocumentPaste(i,e,t,o){if(i.uri.scheme===Q.vscodeChatInput)return;let n=new qx,r={range:e[0],uri:i.uri.toJSON()};n.append(Nhe,DO(JSON.stringify(r)));let s=t.get(tr.text);return s&&e.length&&this.primeSymbolReferenceCache(i,e[0],s,o),n}async primeSymbolReferenceCache(i,e,t,o){let n=i.getValueInRange(e);e.startLineNumber===e.endLineNumber&&(o.isCancellationRequested||!_go.test(n)||PZo(i.uri,e,n,Lgo(this.modelService,this.languageFeaturesService,this.outlineModelService,i.uri,e,n,o)))}};Eit=I([m(0,Tt),m(1,Qt),m(2,AC)],Eit);var $H=class{constructor(i){this.chatWidgetService=i;this.kind=new fs("chat.attach.attachments");this.providedPasteEditKinds=[this.kind];this.copyMimeTypes=[$H.ATTACHMENT_MIME_TYPE];this.pasteMimeTypes=[$H.ATTACHMENT_MIME_TYPE]}static{this.ATTACHMENT_MIME_TYPE="application/vnd.chat.attachment+json"}async prepareDocumentPaste(i,e,t,o){let n=this.chatWidgetService.getWidgetByInputUri(i.uri);if(!n||!n.viewModel)return;let r=n.attachmentModel.attachments,s=HF(n);if(r.length===0&&s.length===0)return;let l=new qx;return l.append($H.ATTACHMENT_MIME_TYPE,DO(JSON.stringify({attachments:r,dynamicVariables:s}))),l}async provideDocumentPasteEdits(i,e,t,o,n){let r=this.chatWidgetService.getWidgetByInputUri(i.uri);if(!r||!r.viewModel)return;let s=r.getContrib(yS.ID);if(!s)return;let l=t.get(tr.text),u=await t.get($H.ATTACHMENT_MIME_TYPE)?.asString(),p=await l?.asString();if(p===void 0||u===void 0||n.isCancellationRequested)return;let h;try{h=$n(JSON.parse(u))}catch{}if(!Array.isArray(h?.attachments)&&!Array.isArray(h?.dynamicVariables))return;let g={insertText:p,title:d(8041,null),kind:this.kind,handledMimeType:$H.ATTACHMENT_MIME_TYPE,additionalEdit:{edits:[]}};return g.additionalEdit?.edits.push({resource:i.uri,redo:()=>{r.attachmentModel.addContext(...h.attachments);for(let f of h.dynamicVariables)s?.addReference(f);r.refreshParsedInput()},undo:()=>{r.attachmentModel.delete(...h.attachments.map(f=>f.id)),r.refreshParsedInput()}}),P1t(g)}};$H=I([m(0,Pt)],$H);var OTi=class{constructor(i,e){this.chatWidgetService=i;this.modelService=e;this.kind=new fs("chat.attach.text");this.providedPasteEditKinds=[this.kind];this.copyMimeTypes=[];this.pasteMimeTypes=[Nhe]}async provideDocumentPasteEdits(i,e,t,o,n){if(i.uri.scheme!==Q.vscodeChatInput)return;let r=t.get(tr.text),s=t.get("vscode-editor-data"),l=t.get(Nhe);if(!s||!r||!l)return;let c=await r.asString(),u=JSON.parse(await s.asString()),p=JSON.parse(await l.asString()),h=this.chatWidgetService.getWidgetByInputUri(i.uri);if(!h)return;let g=p.range.startLineNumber,f=p.range.endLineNumber;if(g===f){let y=this.modelService.getModel(A.revive(p.uri));if(!y||y.getLineContent(g)!==c)return}let v=LZo(c,A.revive(p.uri),u.mode,p.range);if(n.isCancellationRequested||!v||h.attachmentModel.getAttachmentIDs().has(v.id))return;let S=Tgo(i,[v],tr.text,this.kind,d(8042,null),this.chatWidgetService);return S.yieldTo=[{kind:fs.Empty.append("text","plain")}],P1t(S)}};function LZo(a,i,e,t){let o=He(i),n=t.startLineNumber,r=t.endLineNumber,s=`Copied Selection of Code: 


 From the file: ${o} From lines ${n} to ${r} 
 \`\`\`${a}\`\`\``,l=n===r?d(8040,null):d(8039,null,r+1-n);return{kind:"paste",value:s,id:`${o}${n}${r}${t.startColumn}${t.endColumn}`,name:`${o} ${l}`,icon:R.code,pastedLines:l,language:e,fileName:i.toString(),copiedFrom:{uri:i,range:t},code:a,references:[{reference:i,kind:"reference"}]}}function Tgo(a,i,e,t,o,n){let r=i.length===1?i[0].name:d(8038,null,i[0].name,i.length-1),s=i.length===1&&bk(i[0]),l={resource:a.uri,variable:i,undo:()=>{let c=n.getWidgetByInputUri(a.uri);if(!c)throw new Error("No widget found for undo");c.attachmentModel.delete(...i.map(u=>u.id))},redo:()=>{let c=n.getWidgetByInputUri(a.uri);if(!c)throw new Error("No widget found for redo");c.attachmentModel.addContext(...i),s&&en(d(8037,null))},metadata:{needsConfirmation:!1,label:r}};return{insertText:"",title:o,kind:t,handledMimeType:e,additionalEdit:{edits:[l]}}}function P1t(a){return{edits:[a],dispose:()=>{}}}var _go=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,RZo=3,BAe=[];function Dgo(a,i,e){return`${a.toString()}|${i.startLineNumber}:${i.startColumn}-${i.endLineNumber}:${i.endColumn}|${e}`}async function MZo(a,i,e){let t=Dgo(a,i,e);return BAe.find(o=>o.key===t)?.promise}function PZo(a,i,e,t){let o={key:Dgo(a,i,e),promise:t};for(BAe.unshift(o);BAe.length>RZo;)BAe.pop();t.catch(()=>{let n=BAe.indexOf(o);n!==-1&&BAe.splice(n,1)})}async function Lgo(a,i,e,t,o,n,r){let s=a.getModel(t);if(!s)return;let l=new ye(o.startLineNumber,o.startColumn),c=await sF(i.definitionProvider,s,l,!1,r);if(r.isCancellationRequested||!c.length)return;let u=c[0],p=u.targetSelectionRange??u.range,h={uri:u.uri,range:p},g=R.symbolProperty,f=a.getModel(u.uri);if(f)try{let v=await e.getOrCreate(f,r);if(!r.isCancellationRequested){let b=v.getItemEnclosingPosition({lineNumber:p.startLineNumber,column:p.startColumn});b&&(g=_m.toIcon(b.symbol.kind))}}catch{}if(!r.isCancellationRequested)return{id:`vscode.symbol/${JSON.stringify(h)}`,fullName:n,data:h,icon:g}}var Tit=class{constructor(i,e,t,o){this.chatWidgetService=i;this.modelService=e;this.languageFeaturesService=t;this.outlineModelService=o;this.kind=new fs("chat.attach.symbol");this.providedPasteEditKinds=[this.kind];this.copyMimeTypes=[];this.pasteMimeTypes=[Nhe]}async provideDocumentPasteEdits(i,e,t,o,n){if(i.uri.scheme!==Q.vscodeChatInput)return;let r=t.get(tr.text),s=t.get(Nhe);if(!r||!s)return;let l=await r.asString();if(!_go.test(l))return;let c;try{c=JSON.parse(await s.asString())}catch{return}let u=A.revive(c.uri),p=c.range;if(!this.chatWidgetService.getWidgetByInputUri(i.uri))return;let f=await MZo(u,p,l);if(f||(f=await Lgo(this.modelService,this.languageFeaturesService,this.outlineModelService,u,p,l,n)),!f||n.isCancellationRequested)return;let v=`${Tu}sym:${l}`,b=e[0],S=`${v} `,y={startLineNumber:b.startLineNumber,startColumn:b.startColumn,endLineNumber:b.startLineNumber,endColumn:b.startColumn+v.length},w={id:f.id,fullName:f.fullName,range:y,data:f.data,icon:f.icon},k={insertText:S,title:d(8045,null),kind:this.kind,handledMimeType:Nhe,additionalEdit:{edits:[{resource:i.uri,redo:()=>{this.chatWidgetService.getWidgetByInputUri(i.uri)?.getContrib(yS.ID)?.addReference(w)},undo:()=>{}}]}};return k.yieldTo=[{kind:new fs("chat.attach.text")}],P1t(k)}};Tit=I([m(0,Pt),m(1,Tt),m(2,Qt),m(3,AC)],Tit);var HAe=class extends x{constructor(i,e,t,o,n,r,s,l){super(),this._register(e.documentPasteEditProvider.register({scheme:Q.vscodeChatInput,pattern:"*",hasAccessToAllModels:!0},i.createInstance($H))),this._register(e.documentPasteEditProvider.register({scheme:Q.vscodeChatInput,pattern:"*",hasAccessToAllModels:!0},new kit(t,o,n,s,l))),this._register(e.documentPasteEditProvider.register({scheme:Q.vscodeChatInput,pattern:"*",hasAccessToAllModels:!0},new OTi(t,r))),this._register(e.documentPasteEditProvider.register({scheme:Q.vscodeChatInput,pattern:"*",hasAccessToAllModels:!0},i.createInstance(Tit))),this._register(e.documentPasteEditProvider.register("*",i.createInstance(Eit)))}};HAe=I([m(0,F),m(1,Qt),m(2,Pt),m(3,lt),m(4,fe),m(5,Tt),m(6,Eo),m(7,se)],HAe);var rW=le("IChatAttachmentResolveService"),UAe=class{constructor(i,e,t,o){this.fileService=i;this.editorService=e;this.extensionService=t;this.dialogService=o}async resolveEditorAttachContext(i){if(DEe(i))return await this.resolveUntitledEditorAttachContext(i);if(!i.resource)return;let e;try{e=await this.fileService.stat(i.resource)}catch{return}if(!e.isDirectory&&!e.isFile)return;let t=await this.resolveImageEditorAttachContext(i.resource);return t?this.extensionService.extensions.some(o=>Ua(o,"chatReferenceBinaryData"))?t:void 0:await this.resolveResourceAttachContext(i.resource,e.isDirectory)}async resolveUntitledEditorAttachContext(i){if(i.resource)return await this.resolveResourceAttachContext(i.resource,!1);let e=this.editorService.editors.filter(t=>t instanceof eh);for(let t of e)if((await t.resolve()).textEditorModel?.getValue()===i.contents)return await this.resolveResourceAttachContext(t.resource,!1)}async resolveResourceAttachContext(i,e){let t=0;return e||/\.(svg)$/i.test(i.path)&&(t=2),{kind:e?"directory":"file",value:i,id:i.toString(),name:He(i),omittedState:t}}async resolveImageEditorAttachContext(i,e,t){if(!i)return;if(t){if(!f3(t))return}else{let l=Rgo.exec(i.path);if(!l)return;t=NZo(l)}let o=He(i),n;if(e)n=e;else{let l;try{l=await this.fileService.stat(i)}catch{return}let c=await this.fileService.readFile(i);if(l.size>30*1024*1024)throw this.dialogService.error(d(6443,null),d(6444,null,o)),new Error("Image is too large");n=c.value}let r=/\.gif$/i.test(i.path);return(await this.resolveImageAttachContext([{id:i.toString(),name:o,data:n.buffer,icon:R.fileMedia,resource:i,mimeType:t,omittedState:r?1:0}]))[0]}resolveImageAttachContext(i){return Promise.all(i.map(async e=>({id:e.id||await _it(e.data),name:e.name,fullName:e.resource?e.resource.path:void 0,value:await JP(e.data,e.mimeType),icon:e.icon,kind:"image",isFile:!1,isDirectory:!1,omittedState:e.omittedState||0,references:e.resource?[{reference:e.resource,kind:"reference"}]:[]})))}resolveMarkerAttachContext(i){return i.map(e=>{let t;return"severity"in e?t=nA.fromMarker(e):t={filterUri:A.revive(e.uri),filterSeverity:4},nA.toEntry(t)})}resolveSymbolsAttachContext(i){return i.map(e=>{let t=A.file(e.fsPath);return{kind:"symbol",id:AZo(t,e.range),value:{uri:t,range:e.range},symbolKind:e.kind,icon:_m.toIcon(e.kind),fullName:e.name,name:e.name}})}resolveNotebookOutputAttachContext(i){let e=Jn(this.editorService.activeEditorPane);if(!e)return[];let t=jtt(i.outputId,e);if(!t)return[];let o=t.pickedMimeType?.mimeType;if(o&&xit.includes(o)){let n=M1t(t,o,e);return n?[n]:[]}return[]}async resolveDirectoryImages(i){let e=[];return await this._collectDirectoryImages(i,e),e}async _collectDirectoryImages(i,e){let t;try{t=await this.fileService.resolve(i)}catch{return}if(!t.children)return;let o=[];for(let n of t.children)n.isDirectory&&!n.isSymbolicLink?o.push(this._collectDirectoryImages(n.resource,e)):n.isFile&&!n.isSymbolicLink&&Rgo.test(n.resource.path)&&o.push(this.resolveImageEditorAttachContext(n.resource).then(r=>{r&&e.push(r)}).catch(()=>{}));await Promise.all(o)}resolveSourceControlHistoryItemAttachContext(i){return i.map(e=>({id:e.historyItem.id,name:e.name,value:A.revive(e.resource),historyItem:{...e.historyItem,references:[]},kind:"scmHistoryItem"}))}};UAe=I([m(0,fe),m(1,ee),m(2,lt),m(3,at)],UAe);function AZo(a,i){let e="";return i&&(e=`:${i.startLineNumber}`,i.startLineNumber!==i.endLineNumber&&(e+=`-${i.endLineNumber}`)),a.fsPath+e}var Rgo=new RegExp(`\\.(${Object.keys(uOt).join("|")})$`,"i");function NZo(a){let i=a[1].toLowerCase();return uOt[i]}var Dit=class extends xl{constructor(e,t,o,n,r,s,l,c,u){let p=new class extends Lo{constructor(){super(e.item,e.alt?.item,{},e.hideActions,e.menuKeybinding,r,u);this.elementGetter=()=>{}}async run(...g){let f=Cp.get(t),v=f?.lightBulbState.get(),b=this.elementGetter();if(f&&v&&b){let{bottom:S,left:y}=b.getBoundingClientRect();await f.showCodeActions(v.trigger,v.actions,{x:y,y:S})}}};super(p,{draggable:!1},o,n,r,s,l,c);this._editor=t;this._lightBulbStore=this._store.add(new me);p.elementGetter=()=>this.element}render(e){super.render(e),this._updateFromLightBulb()}getTooltip(){return this._currentTitle??super.getTooltip()}_updateFromLightBulb(){let e=Cp.get(this._editor);if(!e)return;let t=new N;this._lightBulbStore.value=t,t.add(be(o=>{let n=e.lightBulbState.read(o);if(this.label){let r=n?.icon??R.lightBulb,s=q.asClassNameArray(r);this.label.className="",this.label.classList.add("codicon","action-label",...s)}this._currentTitle=n?.title,this.updateTooltip()}))}};Dit=I([m(2,_e),m(3,Ne),m(4,X),m(5,Le),m(6,Xe),m(7,Oi),m(8,ge)],Dit);var Lit=class extends xl{constructor(i,e,t,o,n,r,s){super(i,{draggable:!1},e,t,o,n,r,s),this.options.label=!0,this.options.icon=!1,this._kbLabel=e.lookupKeybinding(i.id)?.getLabel()??void 0}updateLabel(){this.label&&vi(this.label,this.action.label,...this._kbLabel?[_("span.inline-chat-keybinding",void 0,this._kbLabel)]:[])}};Lit=I([m(1,_e),m(2,Ne),m(3,X),m(4,Le),m(5,Xe),m(6,Oi)],Lit);var Nte=class extends x{constructor(e,t,o){super();this._editor=e;this._id=`inline-chat-content-widget-${Nte._idPool++}`;this._position=null;this._isVisible=!1;this._onDidRunAction=this._store.add(new E);this.onDidRunAction=this._onDidRunAction.event;this.allowEditorOverflow=!0;this.suppressMouseDown=!1;this._domNode=_(".inline-chat-content-widget");let n=this._store.add(o.createInstance(or,this._domNode,D.InlineChatEditorAffordance,{telemetrySource:"inlineChatEditorAffordance",hiddenItemStrategy:0,menuOptions:{renderShortTitle:!0},toolbarOptions:{primaryGroup:()=>!0,useSeparatorsInPrimaryActions:!0},actionViewItemProvider:r=>{if(r instanceof Lo&&r.id===Pz)return o.createInstance(Dit,r,this._editor);if(r instanceof Lo&&(r.id===N8||r.id===E1t||r.id==="inlineChat.fixDiagnostics"))return o.createInstance(Lit,r)}}));this._store.add(n.actionRunner.onDidRun(r=>{this._onDidRunAction.fire(r.action.id),this._hide()})),this._store.add(be(r=>{let s=t.read(r);s?this._show(s):this._hide()})),this._store.add(this._editor.onDidScrollChange(()=>{let r=t.get();if(!r)return;let s=this._isPositionInViewport();s&&!this._isVisible?this._show(r):!s&&this._isVisible&&this._hide()}))}static{this._idPool=0}_show(e){e.isEmpty()?this._showAtLineStart(e.getPosition().lineNumber):this._showAtSelection(e),this._isVisible?this._editor.layoutContentWidget(this):(this._editor.addContentWidget(this),this._isVisible=!0)}_showAtSelection(e){let t=e.getPosition(),n=e.getDirection()===1?1:2;this._position={position:t,preference:[n]}}_showAtLineStart(e){let t=this._editor.getModel();if(!t)return;let o=t.getOptions().tabSize,n=this._editor.getOptions().get(59),r=t.getLineContent(e),s=kj(r,o),l=s<0?!0:n.spaceWidth*s>22,c=e;if(!l){let p=g=>{let f=t.getLineContent(g);return/^\s*$|^\s+/.test(f)},h=t.getLineCount();e>1&&p(e-1)?c=e-1:e<h&&p(e+1)&&(c=e+1)}let u=/^\S\s*$/.test(t.getLineContent(c))?2:1;this._position={position:{lineNumber:c,column:u},preference:[0]}}_isPositionInViewport(){let e=this._position?.position;if(!e||!this._editor.getVisibleRanges().some(s=>e.lineNumber>=s.startLineNumber&&e.lineNumber<=s.endLineNumber))return!1;let n=this._editor.getScrolledVisiblePosition(e);if(!n)return!1;let r=this._editor.getOptions().get(165);return n.left>=0&&n.left<=r.width}_hide(){this._isVisible&&(this._isVisible=!1,this._editor.removeContentWidget(this))}getId(){return this._id}getDomNode(){return this._domNode}getPosition(){return this._position}beforeRender(){let e=this._editor.getPosition(),t=e?this._editor.getLineHeightForPosition(e):this._editor.getOption(75);return this._domNode.style.setProperty("--vscode-inline-chat-affordance-height",`${t}px`),null}dispose(){this._isVisible&&this._editor.removeContentWidget(this),super.dispose()}};Nte=I([m(2,F)],Nte);var zAe=class extends uK{constructor(e,t,o,n,r,s,l,c,u,p){let h=u.createMenu(D.InlineChatEditorAffordance,p),g=ui(h.onDidChange,()=>h.getActions({renderShortTitle:!1})),v=Cp.get(e.editor)?.lightBulbState,b=ke(y=>{let w=t.read(y);if(!w)return;let k=[];for(let[,G]of g.read(y)){let $=[];for(let J of G)J instanceof Lo&&$.push({command:{id:J.item.id,title:J.label},icon:q.isThemeIcon(J.item.icon)?J.item.icon:void 0});$.length>0&&k.push($)}let T=w.getPosition(),P=new uo(T.lineNumber,T.lineNumber+1),O=new uX(void 0,"",k,void 0,void 0,void 0,!0),V=v?.read(y),H=V?V.icon:R.sparkle;return new dX(O,P,new pX(()=>{},()=>{}),void 0,{icon:H})}),S=Me({},!1);super(e,b,So("inactive"),So(0),So(!1),S,n,r,s,l,c);this._onDidRunAction=this._store.add(new E);this.onDidRunAction=this._onDidRunAction.event;this._store.add(h),this._store.add(this.onDidCloseWithCommand(y=>this._onDidRunAction.fire(y)))}};zAe=I([m(2,_e),m(3,nt),m(4,F),m(5,Oi),m(6,Le),m(7,_C),m(8,Kt),m(9,X)],zAe);var KAe=class extends x{$d;$e;$f;$g=Me(this,void 0);$h=Me(this,void 0);constructor(i,e,t,o,n,r,s,l){super(),this.$d=i,this.$e=e,this.$f=t;let c=gs(this.$d),u=hr("inlineChat.affordance","off",o),p=gP(c.cursorSelection,500),h=this.$h,g=k1t.bindTo(l);this._store.add({dispose:()=>g.reset()});let f=!1,v;this._store.add(Vs(c.selections,(w,k,T)=>{f=T.every(P=>P.reason===3),(!w||w.length!==1||w[0].isEmpty()||!f)&&h.set(void 0,void 0)})),this._store.add(be(w=>{let k=p.read(w);if(!k||k.isEmpty()||!f||this.$d.getModel()?.getValueInRange(k).match(/^\s+$/)){h.set(void 0,void 0),v=void 0;return}v=xt();let T=u.read(void 0);(T==="gutter"||T==="editor")&&s.publicLog2("inlineChatAffordance/shown",{mode:T,id:v,commandId:""}),h.set(k,void 0)})),this._store.add(be(w=>{n.sentimentObs.read(w).hidden&&h.set(void 0,void 0)}));let b=ke(w=>{Fr(this,r.onDidChangeSessions).read(w);let k=c.model.read(w);return k?r.getSessionByTextModel(k.uri)!==void 0:!1});this._store.add(be(w=>{b.read(w)&&h.set(void 0,void 0)})),this._store.add(this.$d.onContextMenu(()=>{h.set(void 0,void 0)})),this._store.add(be(w=>{c.isFocused.read(w)||h.set(void 0,void 0)})),this._store.add(be(w=>{let k=h.read(w),T=u.read(w);g.set(k!==void 0&&(T==="editor"||T==="gutter"))}));let S=this._store.add(this.$f.createInstance(zAe,c,ke(w=>u.read(w)==="gutter"?h.read(w):void 0))),y=this.$f.createInstance(Nte,this.$d,ke(w=>u.read(w)==="editor"?h.read(w):void 0));this._store.add(y),this._store.add(U.any(y.onDidRunAction,S.onDidRunAction)(w=>{v&&s.publicLog2("inlineChatAffordance/selected",{mode:u.get(),id:v,commandId:w})})),this._store.add(be(w=>{let k=u.read(w),T=k==="editor"||k==="gutter",P=Cp.get(this.$d);P&&(P.onlyLightBulbWithEmptySelection=T)})),this._store.add(be(w=>{let k=this.$g.read(w);if(!k)return;this.$d.revealLineInCenterIfOutsideViewport(k.lineNumber,1);let P=this.$d.getDomNode().getBoundingClientRect(),O=k.rect.left-P.left;this.$e.show(k.lineNumber,O,k.above,k.placeholder,k.value)})),this._store.add(be(w=>{this.$e.position.read(w)===null&&this.$g.set(void 0,void 0)}))}dismiss(){this.$h.set(void 0,void 0)}async showMenuAtSelection(i,e){wo(this.$d.hasModel());let t=this.$d.getSelection().getDirection(),o=this.$d.getPosition(),n=this.$d.getDomNode(),r=this.$d.getScrolledVisiblePosition(o),s=n.getBoundingClientRect(),l=s.left+r.left,c=s.top+r.top;this.$g.set({rect:new DOMRect(l,c,0,r.height),above:t===1,lineNumber:o.lineNumber,placeholder:i,value:e},void 0),await Wf(this.$e.position,u=>u===null)}};KAe=I([m(2,F),m(3,B),m(4,rr),m(5,yI),m(6,Te),m(7,X)],KAe);var k2u=te("multiDiffEditor.headerBackground",{dark:"#262626",light:"tab.inactiveBackground",hcDark:"tab.inactiveBackground",hcLight:"tab.inactiveBackground"},d(254,null)),E2u=te("multiDiffEditor.background",Ho,d(252,null)),T2u=te("multiDiffEditor.border",{dark:"sideBarSectionHeader.border",light:"#cccccc",hcDark:"sideBarSectionHeader.border",hcLight:"#cccccc"},d(253,null));var N1t=class{constructor(i,e){this.viewModel=i;this.deltaScrollVertical=e}getId(){return this.viewModel}},Ote=class extends x{constructor(e,t,o,n,r){super();this._container=e;this._overflowWidgetsDomNode=t;this._workbenchUIElementFactory=o;this._instantiationService=n;this._viewModel=Me(this,void 0),this._collapsed=ke(this,c=>this._viewModel.read(c)?.collapsed.read(c)),this._editorContentHeight=Me(this,500),this.contentHeight=ke(this,c=>(this._collapsed.read(c)?0:this._editorContentHeight.read(c))+this._outerEditorHeight),this._modifiedContentWidth=Me(this,0),this._modifiedWidth=Me(this,0),this._originalContentWidth=Me(this,0),this._originalWidth=Me(this,0),this.maxScroll=ke(this,c=>{let u=this._modifiedContentWidth.read(c)-this._modifiedWidth.read(c),p=this._originalContentWidth.read(c)-this._originalWidth.read(c);return u>p?{maxScroll:u,width:this._modifiedWidth.read(c)}:{maxScroll:p,width:this._originalWidth.read(c)}}),this._elements=ct("div.multiDiffEntry",[ct("div.header@header",[ct("div.header-content",[ct("div.collapse-button@collapseButton"),ct("div.file-path",[ct("div.title.modified.show-file-icons@primaryPath",[]),ct("div.status.deleted@status",["R"]),ct("div.title.original.show-file-icons@secondaryPath",[])]),ct("div.actions@actions")])]),ct("div.editorParent",[ct("div.editorContainer@editor")])]),this.editor=this._register(this._instantiationService.createInstance(op,this._elements.editor,{overflowWidgetsDomNode:this._overflowWidgetsDomNode,fixedOverflowWidgets:!0},{})),this.isModifedFocused=gs(this.editor.getModifiedEditor()).isFocused,this.isOriginalFocused=gs(this.editor.getOriginalEditor()).isFocused,this.isFocused=ke(this,c=>this.isModifedFocused.read(c)||this.isOriginalFocused.read(c)),this._resourceLabel=this._workbenchUIElementFactory.createResourceLabel?this._register(this._workbenchUIElementFactory.createResourceLabel(this._elements.primaryPath)):void 0,this._resourceLabel2=this._workbenchUIElementFactory.createResourceLabel?this._register(this._workbenchUIElementFactory.createResourceLabel(this._elements.secondaryPath)):void 0,this._dataStore=this._register(new N),this._headerHeight=40,this._lastScrollTop=-1,this._isSettingScrollTop=!1;let s=new Wi(this._elements.collapseButton,{});this._register(be(c=>{s.element.className="",s.icon=this._collapsed.read(c)?R.chevronRight:R.chevronDown})),this._register(s.onDidClick(()=>{this._viewModel.get()?.collapsed.set(!this._collapsed.get(),void 0)})),this._register(be(c=>{this._elements.editor.style.display=this._collapsed.read(c)?"none":"block"})),this._register(this.editor.getModifiedEditor().onDidLayoutChange(c=>{let u=this.editor.getModifiedEditor().getLayoutInfo().contentWidth;this._modifiedWidth.set(u,void 0)})),this._register(this.editor.getOriginalEditor().onDidLayoutChange(c=>{let u=this.editor.getOriginalEditor().getLayoutInfo().contentWidth;this._originalWidth.set(u,void 0)})),this._register(this.editor.onDidContentSizeChange(c=>{q9(u=>{this._editorContentHeight.set(c.contentHeight,u),this._modifiedContentWidth.set(this.editor.getModifiedEditor().getContentWidth(),u),this._originalContentWidth.set(this.editor.getOriginalEditor().getContentWidth(),u)})})),this._register(this.editor.getOriginalEditor().onDidScrollChange(c=>{if(this._isSettingScrollTop||!c.scrollTopChanged||!this._data)return;let u=c.scrollTop-this._lastScrollTop;this._data.deltaScrollVertical(u)})),this._register(be(c=>{let u=this._viewModel.read(c)?.isActive.read(c);this._elements.root.classList.toggle("active",u)})),this._container.appendChild(this._elements.root),this._outerEditorHeight=this._headerHeight,this._contextKeyService=this._register(r.createScoped(this._elements.actions));let l=this._register(this._instantiationService.createChild(new _o([X,this._contextKeyService])));this._register(l.createInstance(or,this._elements.actions,D.MultiDiffEditorFileToolbar,{actionRunner:this._register(new ZCe(()=>this._viewModel.get()?.modifiedUri??this._viewModel.get()?.originalUri)),menuOptions:{shouldForwardArgs:!0},toolbarOptions:{primaryGroup:c=>c.startsWith("navigation")},actionViewItemProvider:(c,u)=>Bs(l,c,u)}))}setScrollLeft(e){this._modifiedContentWidth.get()-this._modifiedWidth.get()>this._originalContentWidth.get()-this._originalWidth.get()?this.editor.getModifiedEditor().setScrollLeft(e):this.editor.getOriginalEditor().setScrollLeft(e)}setData(e){this._data=e;function t(n){return{...n,scrollBeyondLastLine:!1,hideUnchangedRegions:{enabled:!0},scrollbar:{vertical:"hidden",horizontal:"hidden",handleMouseWheel:!1,useShadows:!1},renderOverviewRuler:!1,fixedOverflowWidgets:!0,overviewRulerBorder:!1}}if(!e){q9(n=>{this._viewModel.set(void 0,n),this.editor.setDiffModel(null,n),this._dataStore.clear()});return}let o=e.viewModel.documentDiffItem;if(q9(n=>{this._resourceLabel?.setUri(e.viewModel.modifiedUri??e.viewModel.originalUri,{strikethrough:e.viewModel.modifiedUri===void 0});let r=!1,s=!1,l=!1,c="";e.viewModel.modifiedUri&&e.viewModel.originalUri&&e.viewModel.modifiedUri.path!==e.viewModel.originalUri.path?(c="R",r=!0):e.viewModel.modifiedUri?e.viewModel.originalUri||(c="A",l=!0):(c="D",s=!0),this._elements.status.classList.toggle("renamed",r),this._elements.status.classList.toggle("deleted",s),this._elements.status.classList.toggle("added",l),this._elements.status.innerText=c,this._resourceLabel2?.setUri(r?e.viewModel.originalUri:void 0,{strikethrough:!0}),this._dataStore.clear(),this._viewModel.set(e.viewModel,n),this.editor.setDiffModel(e.viewModel.diffEditorViewModelRef,n),this.editor.updateOptions(t(o.options??{}))}),o.onOptionsDidChange&&this._dataStore.add(o.onOptionsDidChange(()=>{this.editor.updateOptions(t(o.options??{}))})),e.viewModel.isAlive.recomputeInitiallyAndOnChange(this._dataStore,n=>{n||this.setData(void 0)}),e.viewModel.documentDiffItem.contextKeys)for(let[n,r]of Object.entries(e.viewModel.documentDiffItem.contextKeys))this._contextKeyService.createKey(n,r)}render(e,t,o,n){this._elements.root.style.visibility="visible",this._elements.root.style.top=`${e.start}px`,this._elements.root.style.height=`${e.length}px`,this._elements.root.style.width=`${t}px`,this._elements.root.style.position="absolute";let r=e.length-this._headerHeight,s=Math.max(0,Math.min(n.start-e.start,r));this._elements.header.style.transform=`translateY(${s}px)`,q9(l=>{this.editor.layout({width:t-16-2,height:e.length-this._outerEditorHeight})});try{this._isSettingScrollTop=!0,this._lastScrollTop=o,this.editor.getOriginalEditor().setScrollTop(o)}finally{this._isSettingScrollTop=!1}this._elements.header.classList.toggle("shadow",s>0||o>0),this._elements.header.classList.toggle("collapsed",s===r)}hide(){this._elements.root.style.top="-100000px",this._elements.root.style.visibility="hidden"}};Ote=I([m(3,F),m(4,X)],Ote);var O1t=class{constructor(i){this._create=i;this._unused=new Set;this._used=new Set;this._itemData=new Map}getUnusedObj(i){let e;if(this._unused.size===0)e=this._create(i),this._itemData.set(e,i);else{let t=[...this._unused.values()];e=t.find(o=>this._itemData.get(o).getId()===i.getId())??t[0],this._unused.delete(e),this._itemData.set(e,i),e.setData(i)}return this._used.add(e),{object:e,dispose:()=>{this._used.delete(e),this._unused.size>5?e.dispose():this._unused.add(e)}}}dispose(){for(let i of this._used)i.dispose();for(let i of this._unused)i.dispose();this._used.clear(),this._unused.clear()}};var qAe=class extends x{constructor(e,t,o,n,r,s){super();this._element=e;this._dimension=t;this._viewModel=o;this._workbenchUIElementFactory=n;this._parentContextKeyService=r;this._parentInstantiationService=s;this._scrollableElements=ct("div.scrollContent",[ct("div@content",{style:{overflow:"hidden"}}),ct("div.monaco-editor@overflowWidgetsDomNode",{})]),this._scrollable=this._register(new y_({forceIntegerValues:!1,scheduleAtNextAnimationFrame:u=>Wr(Re(this._element),u),smoothScrollDuration:100})),this._scrollableElement=this._register(new _O(this._scrollableElements.root,{vertical:1,horizontal:1,useShadows:!1},this._scrollable)),this._elements=ct("div.monaco-component.multiDiffEditor",{},[ct("div",{},[this._scrollableElement.getDomNode()]),ct("div.placeholder@placeholder",{},[ct("div")])]),this._sizeObserver=this._register(new _Ce(this._element,void 0)),this._objectPool=this._register(new O1t(u=>{let p=this._instantiationService.createInstance(Ote,this._scrollableElements.content,this._scrollableElements.overflowWidgetsDomNode,this._workbenchUIElementFactory);return p.setData(u),p})),this.scrollTop=ui(this,this._scrollableElement.onScroll,()=>this._scrollableElement.getScrollPosition().scrollTop),this.scrollLeft=ui(this,this._scrollableElement.onScroll,()=>this._scrollableElement.getScrollPosition().scrollLeft),this._viewItemsInfo=ke(this,u=>{let p=this._viewModel.read(u);if(!p)return{items:[],getItem:v=>{throw new li}};let h=p.items.read(u),g=new Map;return{items:h.map(v=>{let b=u.store.add(new FTi(v,this._objectPool,this.scrollLeft,y=>{this._scrollableElement.setScrollPosition({scrollTop:this._scrollableElement.getScrollPosition().scrollTop+y})})),S=this._lastDocStates?.[b.getKey()];return S&&Gi(y=>{b.setViewState(S,y)}),g.set(v,b),b}),getItem:v=>g.get(v)}}),this._viewItems=this._viewItemsInfo.map(this,u=>u.items),this._spaceBetweenPx=0,this._totalHeight=this._viewItems.map(this,(u,p)=>u.reduce((h,g)=>h+g.contentHeight.read(p)+this._spaceBetweenPx,0)),this.activeControl=ke(this,u=>{let p=this._viewModel.read(u)?.activeDiffItem.read(u);return p?this._viewItemsInfo.read(u).getItem(p).template.read(u)?.editor:void 0}),this._contextKeyService=this._register(this._parentContextKeyService.createScoped(this._element)),this._instantiationService=this._register(this._parentInstantiationService.createChild(new _o([X,this._contextKeyService]))),this._contextKeyService.createKey(pe.inMultiDiffEditor.key,!0),this._lastDocStates={},this._register(il((u,p)=>{let h=this._viewModel.read(u);if(h&&h.contextKeys)for(let[g,f]of Object.entries(h.contextKeys)){let v=this._contextKeyService.createKey(g,void 0);v.set(f),p.add(Z(()=>v.reset()))}}));let l=this._parentContextKeyService.createKey(pe.multiDiffEditorAllCollapsed.key,!1);this._register(be(u=>{let p=this._viewModel.read(u);if(p){let h=p.items.read(u).every(g=>g.collapsed.read(u));l.set(h)}})),this._register(be(u=>{let p=this._dimension.read(u);this._sizeObserver.observe(p)}));let c=ke(u=>{if(this._viewItems.read(u).length>0)return;let h=this._viewModel.read(u);return!h||h.isLoading.read(u)?d(255,null):d(256,null)});this._register(be(u=>{let p=c.read(u);this._elements.placeholder.innerText=p??"",this._elements.placeholder.classList.toggle("visible",!!p)})),this._scrollableElements.content.style.position="relative",this._register(be(u=>{let p=this._sizeObserver.height.read(u);this._scrollableElements.root.style.height=`${p}px`;let h=this._totalHeight.read(u);this._scrollableElements.content.style.height=`${h}px`;let g=this._sizeObserver.width.read(u),f=g,v=this._viewItems.read(u),b=n$e(v,cl(S=>S.maxScroll.read(u).maxScroll,hu));if(b){let S=b.maxScroll.read(u);f=g+S.maxScroll}this._scrollableElement.setScrollDimensions({width:g,height:p,scrollHeight:h,scrollWidth:f})})),e.replaceChildren(this._elements.root),this._register(Z(()=>{e.replaceChildren()})),this._register(be(u=>{let p=this._viewModel.read(u);if(p&&!p.isLoading.read(u)){if(p.items.read(u).length===0||p.activeDiffItem.read(u))return;this.goToNextChange()}})),this._register(this._register(be(u=>{q9(p=>{this.render(u)})})))}setScrollState(e){this._scrollableElement.setScrollPosition({scrollLeft:e.left,scrollTop:e.top})}getRootElement(){return this._elements.root}getContextKeyService(){return this._contextKeyService}getScopedInstantiationService(){return this._instantiationService}reveal(e,t){let o=this._viewItems.get(),n=o.findIndex(u=>u.viewModel.originalUri?.toString()===e.original?.toString()&&u.viewModel.modifiedUri?.toString()===e.modified?.toString());if(n===-1)throw new li("Resource not found in diff editor");let r=o[n];this._viewModel.get().activeDiffItem.setCache(r.viewModel,void 0);let s=0;for(let u=0;u<n;u++)s+=o[u].contentHeight.get()+this._spaceBetweenPx;this._scrollableElement.setScrollPosition({scrollTop:s});let l=r.template.get()?.editor,c="original"in e?l?.getOriginalEditor():l?.getModifiedEditor();c&&t?.range&&(c.revealRangeInCenter(t.range),OZo(c,t.range))}getViewState(){return{scrollState:{top:this.scrollTop.get(),left:this.scrollLeft.get()},docStates:Object.fromEntries(this._viewItems.get().map(e=>[e.getKey(),e.getViewState()]))}}setViewState(e){this.setScrollState(e.scrollState),this._lastDocStates=e.docStates,Gi(t=>{if(e.docStates)for(let o of this._viewItems.get()){let n=e.docStates[o.getKey()];n&&o.setViewState(n,t)}})}findDocumentDiffItem(e){return this._viewItems.get().find(o=>o.viewModel.diffEditorViewModel.model.modified.uri.toString()===e.toString()||o.viewModel.diffEditorViewModel.model.original.uri.toString()===e.toString())?.viewModel.documentDiffItem}tryGetCodeEditor(e){let t=this._viewItems.get().find(n=>n.viewModel.diffEditorViewModel.model.modified.uri.toString()===e.toString()||n.viewModel.diffEditorViewModel.model.original.uri.toString()===e.toString()),o=t?.template.get()?.editor;if(o)return t.viewModel.diffEditorViewModel.model.modified.uri.toString()===e.toString()?{diffEditor:o,editor:o.getModifiedEditor()}:{diffEditor:o,editor:o.getOriginalEditor()}}goToNextChange(){this._navigateToChange("next")}goToPreviousChange(){this._navigateToChange("previous")}_navigateToChange(e){let t=this._viewItems.get();if(t.length===0)return;let o=this._viewModel.get()?.activeDiffItem.get(),n=o?t.findIndex(c=>c.viewModel===o):-1;if(n===-1){this._goToFile(0,"first");return}let r=t[n];r.viewModel.collapsed.get()&&r.viewModel.collapsed.set(!1,void 0);let s=r.template.get()?.editor;if(s?.getDiffComputationResult()?.changes2?.length){let c=s.getModifiedEditor().getPosition()?.lineNumber||1,u=s.getDiffComputationResult().changes2;if(e==="next"?u.some(h=>h.modified.startLineNumber>c):u.some(h=>h.modified.endLineNumberExclusive<=c)){s.goToDiff(e);return}}let l=(n+(e==="next"?1:-1)+t.length)%t.length;this._goToFile(l,e==="next"?"first":"last")}_goToFile(e,t){let o=this._viewItems.get()[e];o.viewModel.collapsed.get()&&o.viewModel.collapsed.set(!1,void 0),this.reveal({original:o.viewModel.originalUri,modified:o.viewModel.modifiedUri});let n=o.template.get()?.editor;if(n?.getDiffComputationResult()?.changes2?.length)if(t==="first")n.revealFirstDiff();else{let r=n.getDiffComputationResult().changes2.at(-1),s=n.getModifiedEditor();s.setPosition({lineNumber:r.modified.startLineNumber,column:1}),s.revealLineInCenter(r.modified.startLineNumber)}n?.focus()}render(e){let t=this.scrollTop.read(e),o=0,n=0,r=0,s=this._sizeObserver.height.read(e),l=pi.ofStartAndLength(t,s),c=this._sizeObserver.width.read(e);for(let u of this._viewItems.read(e)){let p=u.contentHeight.read(e),h=Math.min(p,s),g=pi.ofStartAndLength(n,h),f=pi.ofStartAndLength(r,p);if(f.isBefore(l))o-=p-h,u.hide();else if(f.isAfter(l))u.hide();else{let v=Math.max(0,Math.min(l.start-f.start,p-h));o-=v;let b=pi.ofStartAndLength(t+o,s);u.render(g,v,c,b)}n+=h+this._spaceBetweenPx,r+=p+this._spaceBetweenPx}this._scrollableElements.content.style.transform=`translateY(${-(t+o)}px)`}};qAe=I([m(4,X),m(5,F)],qAe);function OZo(a,i){let e=a.getModel(),t=a.createDecorationsCollection([{range:i,options:{description:"symbol-navigate-action-highlight",className:"symbolHighlight"}}]);setTimeout(()=>{a.getModel()===e&&t.clear()},350)}var FTi=class extends x{constructor(e,t,o,n){super();this.viewModel=e;this._objectPool=t;this._scrollLeft=o;this._deltaScrollVertical=n;this._templateRef=this._register(SV(this,void 0));this.contentHeight=ke(this,e=>this._templateRef.read(e)?.object.contentHeight?.read(e)??this.viewModel.lastTemplateData.read(e).contentHeight);this.maxScroll=ke(this,e=>this._templateRef.read(e)?.object.maxScroll.read(e)??{maxScroll:0,scrollWidth:0});this.template=ke(this,e=>this._templateRef.read(e)?.object);this._isHidden=Me(this,!1);this._isFocused=ke(this,e=>this.template.read(e)?.isFocused.read(e)??!1);this.viewModel.setIsFocused(this._isFocused,void 0),this._register(be(r=>{let s=this._scrollLeft.read(r);this._templateRef.read(r)?.object.setScrollLeft(s)})),this._register(be(r=>{let s=this._templateRef.read(r);!s||!this._isHidden.read(r)||s.object.isFocused.read(r)||this._clear()}))}dispose(){this._clear(),super.dispose()}toString(){return`VirtualViewItem(${this.viewModel.documentDiffItem.modified?.uri.toString()})`}getKey(){return this.viewModel.getKey()}getViewState(){return Gi(e=>{this._updateTemplateData(e)}),{collapsed:this.viewModel.collapsed.get(),selections:this.viewModel.lastTemplateData.get().selections}}setViewState(e,t){this.viewModel.collapsed.set(e.collapsed,t),this._updateTemplateData(t);let o=this.viewModel.lastTemplateData.get(),n=e.selections?.map(ti.liftSelection);this.viewModel.lastTemplateData.set({...o,selections:n},t);let r=this._templateRef.get();r&&n&&r.object.editor.setSelections(n)}_updateTemplateData(e){let t=this._templateRef.get();t&&this.viewModel.lastTemplateData.set({contentHeight:t.object.contentHeight.get(),selections:t.object.editor.getSelections()??void 0},e)}_clear(){let e=this._templateRef.get();e&&Gi(t=>{this._updateTemplateData(t),e.object.hide(),this._templateRef.set(void 0,t)})}hide(){this._isHidden.set(!0,void 0)}render(e,t,o,n){this._isHidden.set(!1,void 0);let r=this._templateRef.get();if(!r){r=this._objectPool.getUnusedObj(new N1t(this.viewModel,this._deltaScrollVertical)),this._templateRef.set(r,void 0);let s=this.viewModel.lastTemplateData.get().selections;s&&r.object.editor.setSelections(s)}r.object.render(e,o,t,n)}};var Fte=class extends x{constructor(e,t,o){super();this._element=e;this._workbenchUIElementFactory=t;this._instantiationService=o;this._dimension=Me(this,void 0);this._viewModel=Me(this,void 0);this._widgetImpl=ke(this,e=>(Xx(Ote,e),e.store.add(this._instantiationService.createInstance(Xx(qAe,e),this._element,this._dimension,this._viewModel,this._workbenchUIElementFactory))));this._activeControl=ke(this,e=>this._widgetImpl.read(e).activeControl.read(e));this.onDidChangeActiveControl=U.fromObservableLight(this._activeControl);this._register(fP(this._widgetImpl))}reveal(e,t){this._widgetImpl.get().reveal(e,t)}createViewModel(e){return new GTe(e,this._instantiationService)}setViewModel(e){this._viewModel.set(e,void 0)}layout(e){this._dimension.set(e,void 0)}getActiveControl(){return this._activeControl.get()}getViewState(){return this._widgetImpl.get().getViewState()}setViewState(e){this._widgetImpl.get().setViewState(e)}tryGetCodeEditor(e){return this._widgetImpl.get().tryGetCodeEditor(e)}getRootElement(){return this._widgetImpl.get().getRootElement()}getContextKeyService(){return this._widgetImpl.get().getContextKeyService()}getScopedInstantiationService(){return this._widgetImpl.get().getScopedInstantiationService()}findDocumentDiffItem(e){return this._widgetImpl.get().findDocumentDiffItem(e)}goToNextChange(){this._widgetImpl.get().goToNextChange()}goToPreviousChange(){this._widgetImpl.get().goToPreviousChange()}};Fte=I([m(2,F)],Fte);var zg=class extends $F{constructor(e,t,o,n,r,s,l,c,u){super(zg.ID,e,"multiDiffEditor",o,t,r,c,n,s,l);this.editorProgressService=u;this._multiDiffEditorWidget=void 0}static{this.ID="multiDiffEditor"}get viewModel(){return this._viewModel}createEditor(e){this._multiDiffEditorWidget=this._register(this.instantiationService.createInstance(Fte,e,this.instantiationService.createInstance(Rit))),this._register(this._multiDiffEditorWidget.onDidChangeActiveControl(()=>{this._onDidChangeControl.fire()})),this._contentOverlay=this._register(new WTi(this._multiDiffEditorWidget.getRootElement(),this._multiDiffEditorWidget.getContextKeyService(),this._multiDiffEditorWidget.getScopedInstantiationService()))}async setInput(e,t,o,n){await super.setInput(e,t,o,n),this._viewModel=await e.getViewModel(),this._contentOverlay?.updateResource(e.resource),this._multiDiffEditorWidget.setViewModel(this._viewModel);let r=this.loadEditorViewState(e,o);r&&this._multiDiffEditorWidget.setViewState(r),this._applyOptions(t)}setOptions(e){this._applyOptions(e)}_applyOptions(e){let t=e?.viewState;!t||!t.revealData||this._multiDiffEditorWidget?.reveal(t.revealData.resource,{range:t.revealData.range?z.lift(t.revealData.range):void 0,highlight:!0})}async clearInput(){await super.clearInput(),this._contentOverlay?.updateResource(void 0),this._multiDiffEditorWidget.setViewModel(void 0)}layout(e){this._multiDiffEditorWidget.layout(e)}getControl(){return this._multiDiffEditorWidget.getActiveControl()}focus(){super.focus(),this._multiDiffEditorWidget?.getActiveControl()?.focus()}hasFocus(){return this._multiDiffEditorWidget?.getActiveControl()?.hasTextFocus()||super.hasFocus()}computeEditorViewState(e){return this._multiDiffEditorWidget.getViewState()}tracksEditorViewState(e){return e instanceof au}toEditorViewStateResource(e){return e.resource}tryGetCodeEditor(e){return this._multiDiffEditorWidget.tryGetCodeEditor(e)}findDocumentDiffItem(e){let t=this._multiDiffEditorWidget.findDocumentDiffItem(e);return t?t.multiDiffEditorItem:void 0}goToNextChange(){this._multiDiffEditorWidget?.goToNextChange()}goToPreviousChange(){this._multiDiffEditorWidget?.goToPreviousChange()}async showWhile(e){return this.editorProgressService.showWhile(e)}};zg=I([m(1,F),m(2,Te),m(3,Le),m(4,ce),m(5,ee),m(6,wt),m(7,Fn),m(8,wd)],zg);var WTi=class extends x{constructor(e,t,o){super();this.resourceObs=Me(this,void 0);let n=o.createInstance(vde,D.MultiDiffEditorContent,t,this.resourceObs);n.element.classList.add("multi-diff-root-floating-menu"),this._register(n);let r=ke(s=>{let l=this.resourceObs.read(s),c=n.hasActions.read(s);return l!==void 0&&c});this._register(be(s=>{r.read(s)&&(e.appendChild(n.element),s.store.add(Z(()=>{n.element.remove()})))}))}updateResource(e){this.resourceObs.set(e,void 0)}},Rit=class{constructor(i){this._instantiationService=i}createResourceLabel(i){let e=this._instantiationService.createInstance(Tk,i,{});return{setUri(t,o={}){t?e.element.setFile(t,{strikethrough:o.strikethrough}):e.element.clear()},dispose(){e.dispose()}}}};Rit=I([m(0,F)],Rit);var $Ae=new Y("chatEdits.isGlobalEditingSession",void 0,d(6959,null)),Kg=new Y("chatEdits.hasEditorModifications",void 0,d(6962,null)),Wte=new Y("chatEdits.isCurrentlyBeingModified",void 0,d(6963,null)),Vte=new Y("chatEdits.isReviewModeEnabled",!0,d(6961,null)),Gk=new Y("chatEdits.isRequestInProgress",!1,d(6960,null)),FZo=new Y("chatEdits.requestCount",0,d(6964,null)),F1t=new Y("chatEdits.cursorInChangeRange",!1,d(6958,null)),Ohe=class{constructor(i,e){this._store=new N;let t=this._store.add(new Vt),o=ui(this,U.any(e.onDidAddGroup,e.onDidRemoveGroup),()=>e.groups);this._store.add(be(n=>{let r=new Set(t.keys());for(let s of o.read(n))r.delete(s),!t.has(s)&&t.set(s,i.createInstance(Mit,s));for(let s of r)t.deleteAndDispose(s)}))}static{this.ID="chat.edits.editorContextKeys"}dispose(){this._store.dispose()}};Ohe=I([m(0,F),m(1,wt)],Ohe);var Mit=class{constructor(i,e,t,o){this._store=new N;this._ctxIsGlobalEditingSession=$Ae.bindTo(i.scopedContextKeyService),this._ctxHasEditorModification=Kg.bindTo(i.scopedContextKeyService),this._ctxIsCurrentlyBeingModified=Wte.bindTo(i.scopedContextKeyService),this._ctxHasRequestInProgress=Gk.bindTo(i.scopedContextKeyService),this._ctxReviewModeEnabled=Vte.bindTo(i.scopedContextKeyService),this._ctxRequestCount=FZo.bindTo(i.scopedContextKeyService);let n=ui(this,i.onDidModelChange,()=>i.activeEditor),r=ke(s=>{let l=n.read(s),c=po.getOriginalUri(l,{supportSideBySide:1});if(!c){this._reset();return}return new Pit(c,t,e).value.read(s)});this._store.add(be(s=>{let l=r.read(s);if(!l){this._reset();return}let{session:c,entry:u}=l,p=o.getSession(c.chatSessionResource);this._ctxHasEditorModification.set(u?.state.read(s)===0),this._ctxIsGlobalEditingSession.set(c.isGlobalEditingSession),this._ctxReviewModeEnabled.set(u?u.reviewMode.read(s):!1),this._ctxHasRequestInProgress.set(p?.requestInProgress.read(s)??!1),this._ctxIsCurrentlyBeingModified.set(!!u?.isCurrentlyBeingModifiedBy.read(s));let h=p?ui(this,p.onDidChange,()=>p.getRequests().length):So(0);this._ctxRequestCount.set(h.read(s))}))}_reset(){this._ctxIsGlobalEditingSession.reset(),this._ctxHasEditorModification.reset(),this._ctxHasRequestInProgress.reset(),this._ctxReviewModeEnabled.reset(),this._ctxRequestCount.reset()}dispose(){this._store.dispose(),this._reset()}};Mit=I([m(1,yI),m(2,ud),m(3,mi)],Mit);var Pit=class{constructor(i,e,t){let o=ui(this,t.onDidChangeSessions,()=>t.getSessionByTextModel(i)),n=e.editingSessionsObs.map((r,s)=>{for(let l of r){let c=l.readEntry(i,s);if(c)return{session:l,entry:c,isInlineChat:!1}}});this.value=ke(r=>{let s=o.read(r);return s?{session:s.editingSession,entry:s.editingSession.readEntry(i,r),isInlineChat:!0}:n.read(r)})}};Pit=I([m(1,ud),m(2,yI)],Pit);function WZo(a,i){let e=[],t=[];for(let o=a.original.startLineNumber;o<a.original.endLineNumberExclusive;o++){let n=i.originalModel.getLineContent(o);e.push(n)}for(let o=a.modified.startLineNumber;o<a.modified.endLineNumberExclusive;o++){let n=i.modifiedModel.getLineContent(o);t.push(n)}return{originalText:e.join(`
`),modifiedText:t.join(`
`)}}function VZo(a,i=5){if(a.length===0)return[];let e=[],t=[a[0]];for(let o=1;o<a.length;o++){let n=t[0],r=a[o],s=n.modified.startLineNumber;r.modified.startLineNumber-s<=i?t.push(r):(e.push(t),t=[r])}return t.length>0&&e.push(t),e}var VTi=class a extends x{constructor(e,t,o,n,r,s){super();this._editor=e;this._changes=t;this._chatWidgetService=n;this._viewsService=r;this._chatSessionResource=s;this._id=`chat-explanation-widget-${a._idPool++}`;this._explanationItems=new Map;this._position=null;this._explanations=[];this._isExpanded=!0;this._isAllRead=!1;this._disposed=!1;this._startLineNumber=1;this._eventStore=this._register(new N);this._uri=o.modifiedModel.uri,this._rangeHighlightDecoration=this._editor.createDecorationsCollection(),this._explanations=this._changes.map(c=>{let{originalText:u,modifiedText:p}=WZo(c,o);return{startLineNumber:c.modified.startLineNumber,endLineNumber:c.modified.endLineNumberExclusive-1,explanation:d(6979,null),read:!1,loading:!0,originalText:u,modifiedText:p}}),this._domNode=_("div.chat-explanation-widget"),this._headerNode=_("div.chat-explanation-header"),this._readIndicator=_("div.chat-explanation-read-indicator"),this._updateReadIndicator(),this._headerNode.appendChild(this._readIndicator),this._titleNode=_("span.chat-explanation-title"),this._updateTitle(),this._headerNode.appendChild(this._titleNode),this._headerNode.appendChild(_("span.chat-explanation-spacer")),this._toggleButton=_("div.chat-explanation-toggle"),this._updateToggleButton(),this._headerNode.appendChild(this._toggleButton),this._dismissButton=_("div.chat-explanation-dismiss"),this._dismissButton.appendChild(Sn(R.close)),this._dismissButton.title=d(6976,null),this._headerNode.appendChild(this._dismissButton),this._domNode.appendChild(this._headerNode),this._bodyNode=_("div.chat-explanation-body"),this._buildExplanationItems(),this._domNode.appendChild(this._bodyNode);let l=_("div.chat-explanation-arrow");this._domNode.appendChild(l),this._setupEventHandlers(),this._domNode.classList.add("visible"),this._editor.addOverlayWidget(this)}static{this._idPool=0}_setupEventHandlers(){this._eventStore.add(j(this._readIndicator,"click",e=>{e.stopPropagation(),this._isAllRead=!this._isAllRead;for(let t of this._explanations)t.read=this._isAllRead;this._updateReadIndicator(),this._updateExplanationItemsReadState()})),this._eventStore.add(j(this._toggleButton,"click",e=>{e.stopPropagation(),this._toggleExpanded()})),this._eventStore.add(j(this._headerNode,"click",()=>{this._toggleExpanded()})),this._eventStore.add(j(this._dismissButton,"click",e=>{e.stopPropagation(),this._dismiss()}))}_toggleExpanded(){this._isExpanded=!this._isExpanded,this._bodyNode.classList.toggle("collapsed",!this._isExpanded),this._updateToggleButton(),this._editor.layoutOverlayWidget(this)}_dismiss(){this._domNode.classList.add("fadeOut");let e=()=>{this.dispose()},t=setTimeout(e,150);this._domNode.addEventListener("animationend",()=>{clearTimeout(t),e()},{once:!0})}_updateReadIndicator(){Rt(this._readIndicator);let e=this._explanations.every(o=>o.read),t=this._explanations.some(o=>o.read);this._isAllRead=e,e?(this._readIndicator.appendChild(Sn(R.circle)),this._readIndicator.classList.add("read"),this._readIndicator.classList.remove("partial","unread"),this._readIndicator.title=d(6984,null)):t?(this._readIndicator.appendChild(Sn(R.circleFilled)),this._readIndicator.classList.remove("read","unread"),this._readIndicator.classList.add("partial"),this._readIndicator.title=d(6982,null)):(this._readIndicator.appendChild(Sn(R.circleFilled)),this._readIndicator.classList.remove("read","partial"),this._readIndicator.classList.add("unread"),this._readIndicator.title=d(6983,null))}_updateTitle(){let e=this._explanations.length;e===1?this._titleNode.textContent=d(6986,null):this._titleNode.textContent=d(6985,null,e)}_updateToggleButton(){Rt(this._toggleButton),this._isExpanded?(this._toggleButton.appendChild(Sn(R.chevronUp)),this._toggleButton.title=d(6975,null)):(this._toggleButton.appendChild(Sn(R.chevronDown)),this._toggleButton.title=d(6977,null))}_buildExplanationItems(){Rt(this._bodyNode),this._explanationItems.clear();for(let e=0;e<this._explanations.length;e++){let t=this._explanations[e],o=_("div.chat-explanation-item"),n=_("span.chat-explanation-line-info");t.startLineNumber===t.endLineNumber?n.textContent=d(6980,null,t.startLineNumber):n.textContent=d(6981,null,t.startLineNumber,t.endLineNumber),o.appendChild(n);let r=_("span.chat-explanation-text");if(t.loading){let c=Sn(q.modify(R.loading,"spin"));c.classList.add("chat-explanation-loading"),r.appendChild(c);let u=document.createTextNode(" "+t.explanation);r.appendChild(u)}else r.textContent=t.explanation;o.appendChild(r);let s=_("div.chat-explanation-item-read");this._updateItemReadIndicator(s,t.read),o.appendChild(s);let l=_("div.chat-explanation-reply-button");l.appendChild(Sn(R.arrowRight)),l.title=d(6978,null),o.appendChild(l),this._eventStore.add(j(l,"click",async c=>{c.stopPropagation();let u=new z(t.startLineNumber,1,t.endLineNumber,1),p;this._chatSessionResource?p=await this._chatWidgetService.openSession(this._chatSessionResource):(await this._viewsService.openView(Dr,!0),p=this._chatWidgetService.lastFocusedWidget),p&&p.attachmentModel.addContext(p.attachmentModel.asFileVariableEntry(this._uri,u))})),this._eventStore.add(j(o,"click",c=>{c.stopPropagation(),t.read=!t.read,this._updateItemReadIndicator(s,t.read),this._updateReadIndicator()})),this._eventStore.add(j(o,"mouseenter",()=>{let c=new z(t.startLineNumber,1,t.endLineNumber,this._editor.getModel()?.getLineMaxColumn(t.endLineNumber)??1);this._rangeHighlightDecoration.set([{range:c,options:{description:"chat-explanation-range-highlight",className:"rangeHighlight",isWholeLine:!0,linesDecorationsClassName:"chat-explanation-range-glyph"}},{range:c,options:{description:"chat-explanation-range-highlight-overview",overviewRuler:{color:Xs(Iwe),position:7}}}])})),this._eventStore.add(j(o,"mouseleave",()=>{this._rangeHighlightDecoration.clear()})),this._explanationItems.set(e,{item:o,readIndicator:s,textElement:r}),this._bodyNode.appendChild(o)}}setExplanationByLineNumber(e,t,o){for(let n=0;n<this._explanations.length;n++){let r=this._explanations[n];if(r.startLineNumber===e&&r.endLineNumber===t)return r.explanation=o,r.loading=!1,this._updateExplanationText(n),!0}return!1}get explanationCount(){return this._explanations.length}_updateExplanationText(e){let t=this._explanationItems.get(e),o=this._explanations[e];t&&o&&(Rt(t.textElement),t.textElement.textContent=o.explanation)}_updateItemReadIndicator(e,t){Rt(e),t?(e.appendChild(Sn(R.circle)),e.classList.add("read"),e.classList.remove("unread")):(e.appendChild(Sn(R.circleFilled)),e.classList.remove("read"),e.classList.add("unread"))}_updateExplanationItemsReadState(){this._explanationItems.forEach(({readIndicator:e},t)=>{let o=this._explanations[t];this._updateItemReadIndicator(e,o.read)})}layout(e){if(this._disposed)return;this._startLineNumber=e;let t=this._editor.getOption(75),{contentLeft:o,contentWidth:n,verticalScrollbarWidth:r}=this._editor.getLayoutInfo(),s=this._editor.getScrollTop(),l=zl(this._domNode)||280;this._position={stackOrdinal:2,preference:{top:this._editor.getTopForLineNumber(e)-s-t,left:o+n-(2*r+l)}},this._editor.layoutOverlayWidget(this)}toggle(e){this._domNode.classList.toggle("visible",e),e&&this._explanations.length>0&&this.layout(this._explanations[0].startLineNumber)}relayout(){this._startLineNumber&&this.layout(this._startLineNumber)}getId(){return this._id}getDomNode(){return this._domNode}getPosition(){return this._position}dispose(){this._disposed||(this._disposed=!0,this._rangeHighlightDecoration.clear(),this._editor.removeOverlayWidget(this),super.dispose())}},jAe=class extends x{constructor(e,t,o,n,r){super();this._editor=e;this._chatWidgetService=t;this._viewsService=o;this._modelUri=r;this._widgets=[];this._visible=!1;this._register(this._editor.onDidChangeModel(()=>{let s=this._editor.getModel()?.uri;if(this._modelUri)if(s&&s.toString()===this._modelUri.toString())for(let l of this._widgets)l.toggle(this._visible),l.relayout();else for(let l of this._widgets)l.toggle(!1)})),this._register(be(s=>{let c=n.state.read(s).get(this._modelUri);c?(this._diffInfo=c.diffInfo,this._chatSessionResource=c.chatSessionResource,this._widgets.length===0&&this._diffInfo&&this._createWidgets(this._diffInfo,this._chatSessionResource),c.progress==="complete"&&this._handleExplanations(this._modelUri,c.explanations),this.show()):this.hide()}))}_createWidgets(e,t){if(e.identical||e.changes.length===0)return;let o=VZo(e.changes,5);for(let n of o){let r=new VTi(this._editor,n,e,this._chatWidgetService,this._viewsService,t);this._widgets.push(r),this._register(r),r.layout(n[0].modified.startLineNumber)}this._register(U.any(this._editor.onDidScrollChange,this._editor.onDidLayoutChange)(()=>{for(let n of this._widgets)n.relayout()}))}_handleExplanations(e,t){if(!(!this._modelUri||e.toString()!==this._modelUri.toString())){for(let o of t)for(let n of this._widgets)if(n.setExplanationByLineNumber(o.startLineNumber,o.endLineNumber,o.explanation))break}}show(){this._visible=!0;for(let e of this._widgets)e.toggle(!0),e.relayout()}hide(){this._visible=!1;for(let e of this._widgets)e.toggle(!1)}_clearWidgets(){for(let e of this._widgets)e.dispose();this._widgets.length=0}dispose(){this._clearWidgets(),super.dispose()}};var Fhe=le("chatEditingExplanationModelManager");function BZo(a,i){let e=[],t=[];for(let o=a.original.startLineNumber;o<a.original.endLineNumberExclusive;o++){let n=i.originalModel.getLineContent(o);e.push(n)}for(let o=a.modified.startLineNumber;o<a.modified.endLineNumberExclusive;o++){let n=i.modifiedModel.getLineContent(o);t.push(n)}return{originalText:e.join(`
`),modifiedText:t.join(`
`)}}var Ait=class extends x{constructor(e){super();this._languageModelsService=e;this._state=Me(this,new gt);this.state=this._state}_updateUriState(e,t){let o=this._state.get(),n=new gt(o);n.set(e,t),this._state.set(n,void 0)}_updateUriStatePartial(e,t){let o=this._state.get(),n=o.get(e);if(n){let r=new gt(o);r.set(e,{...n,...t}),this._state.set(r,void 0)}}_removeUris(e){let t=this._state.get(),o=new gt(t);for(let n of e)o.delete(n);this._state.set(o,void 0)}generateExplanations(e,t,o){let n=e.map(l=>l.modifiedModel.uri),r=new Ye(o);for(let l of e)this._updateUriState(l.modifiedModel.uri,{progress:"loading",explanations:[],diffInfo:l,chatSessionResource:t});let s=this._doGenerateExplanations(e,r.token);return{uris:n,completed:s,dispose:()=>{r.dispose(!0),this._removeUris(n)}}}async _doGenerateExplanations(e,t){let o=[];for(let s of e)s.changes.length===0||s.identical?this._updateUriStatePartial(s.modifiedModel.uri,{progress:"complete",explanations:[]}):o.push(s);if(o.length===0)return;let n=o.map(s=>{let l=s.modifiedModel.uri,c=He(l),u=s.changes.map(p=>{let{originalText:h,modifiedText:g}=BZo(p,s);return{startLineNumber:p.modified.startLineNumber,endLineNumber:p.modified.endLineNumberExclusive-1,originalText:h,modifiedText:g}});return{uri:l,fileName:c,changes:u}}),r=n.reduce((s,l)=>s+l.changes.length,0);try{let s=await this._languageModelsService.selectLanguageModels({vendor:"copilot",id:"copilot-fast"});if(!s.length){for(let b of n)this._updateUriStatePartial(b.uri,{progress:"error",explanations:[],errorMessage:d(6974,null)});return}if(t.isCancellationRequested)return;let l=0,c=n.map(b=>b.changes.map(S=>{let y=`=== CHANGE ${l} (File: ${b.fileName}, Lines ${S.startLineNumber}-${S.endLineNumber}) ===
BEFORE:
${S.originalText||"(empty)"}

AFTER:
${S.modifiedText||"(empty)"}`;return l++,y}).join(`

`)).join(`

`),u=n.length,p=`Analyze these ${r} code changes across ${u} file${u>1?"s":""} and provide a brief explanation for each one.
These changes are part of a single coherent modification, so consider how they relate to each other.

${c}

Respond with a JSON array containing exactly ${r} objects, one for each change in order.
Each object should have an "explanation" field with a brief sentence (max 15 words) explaining what changed and why.
Be specific about the actual code changes. Return ONLY valid JSON, no markdown.

Example response format:
[{"explanation": "Added null check to prevent crash"}, {"explanation": "Renamed variable for clarity"}]`,h=await this._languageModelsService.sendChatRequest(s[0],void 0,[{role:1,content:[{type:"text",value:p}]}],{},t),g="";for await(let b of h.stream){if(t.isCancellationRequested)return;if(Array.isArray(b))for(let S of b)S.type==="text"&&(g+=S.value);else b.type==="text"&&(g+=b.value)}if(await h.result,t.isCancellationRequested)return;let f=[];try{let b=g.trim();b.startsWith("```")&&(b=b.replace(/^```(?:json)?\n?/,"").replace(/\n?```$/,"")),f=JSON.parse(b)}catch{}let v=0;for(let b of n){let S=[];for(let y of b.changes){let w=f[v]?.explanation?.trim()||d(6972,null);S.push({uri:b.uri,startLineNumber:y.startLineNumber,endLineNumber:y.endLineNumber,originalText:y.originalText,modifiedText:y.modifiedText,explanation:w}),v++}this._updateUriStatePartial(b.uri,{progress:"complete",explanations:S})}}catch(s){if(!t.isCancellationRequested){let l=s instanceof Error?s.message:d(6973,null);for(let c of n)this._updateUriStatePartial(c.uri,{progress:"error",explanations:[],errorMessage:l})}}}};Ait=I([m(0,ds)],Ait);Ee(Fhe,Ait,1);var O8=class extends K{constructor(i){super({category:Si,...i})}async run(i,...e){let t=i.get(F),o=i.get(ud),n=i.get(ee),r=po.getOriginalUri(n.activeEditorPane?.input,{supportSideBySide:1});if(!r||!n.activeEditorPane)return;let s=o.editingSessionsObs.get().find(u=>u.getEntry(r));if(!s)return;let l=s.getEntry(r),c=l.getEditorIntegration(n.activeEditorPane);return t.invokeFunction(this.runChatEditingCommand.bind(this),s,l,c,...e)}},W1t=class extends O8{constructor(e){super({id:e?"chatEditor.action.navigateNext":"chatEditor.action.navigatePrevious",title:e?L(6953,"Go to Next Chat Edit"):L(6954,"Go to Previous Chat Edit"),icon:e?R.arrowDown:R.arrowUp,precondition:C.and(ie.enabled,Kg),keybinding:{primary:e?575:1599,weight:200,when:C.and(Kg,C.or(pe.focus,pp))},f1:!0,menu:{id:D.ChatEditingEditorContent,group:"navigate",order:e?3:2,when:C.and(Vte,Kg)}});this.next=e}async runChatEditingCommand(e,t,o,n){let r=e.get(F);(this.next?n.next(!1):n.previous(!1))||await r.invokeFunction($Ti,t,o,this.next)||(this.next?n.next(!0):n.previous(!0))}};async function $Ti(a,i,e,t){let o=a.get(ee),n=i.entries.get(),r=n.indexOf(e),s;for(;r=(r+(t?1:-1)+n.length)%n.length,s=n[r],s.state.get()!==0;)if(s===e)return!1;let l=await o.openEditor({resource:s.modifiedURI,options:{revealIfOpened:!1,revealIfVisible:!1}},jn);return l?(i.entries.get().includes(s)&&s.getEditorIntegration(l).reveal(t),!0):!1}var V1t=class extends O8{constructor(e,t){super({id:e,title:t?L(6937,"Keep Chat Edits"):L(6947,"Undo Chat Edits"),shortTitle:t?L(6938,"Keep"):L(6948,"Undo"),tooltip:t?L(6939,"Keep Chat Edits in this File"):L(6949,"Undo Chat Edits in this File"),precondition:C.and(Kg,Wte.negate()),icon:t?R.check:R.discard,f1:!0,keybinding:{when:C.or(pe.focus,pr),weight:210,primary:t?3127:3116},menu:{id:D.ChatEditingEditorContent,group:"a_resolve",order:t?0:1,when:C.and(t?void 0:Vte,C.or($Ae,Gk.negate()))}});this._keep=t}async runChatEditingCommand(e,t,o,n){let r=e.get(F),s=e.get(B);this._keep?t.accept(o.modifiedURI):t.reject(o.modifiedURI),s.getValue("chat.editing.revealNextChangeOnResolve")&&await r.invokeFunction($Ti,t,o,!0)}},Whe=class a extends V1t{static{this.ID="chatEditor.action.accept"}constructor(){super(a.ID,!0)}},Nit=class a extends V1t{static{this.ID="chatEditor.action.reject"}constructor(){super(a.ID,!1)}},Mgo="chatEditor.action.acceptHunk",Pgo="chatEditor.action.undoHunk",B1t=class extends O8{constructor(e){super({id:e?Mgo:Pgo,title:e?L(6943,"Keep this Change"):L(6956,"Undo this Change"),shortTitle:e?L(6944,"Keep"):L(6957,"Undo"),precondition:C.and(Kg,Wte.negate()),f1:!0,keybinding:{when:C.and(F1t,C.or(pe.focus,pp)),weight:201,primary:e?2103:2092},menu:{id:D.ChatEditingEditorHunk,order:1}});this._accept=e}async runChatEditingCommand(e,t,o,n,...r){let s=e.get(F),l=e.get(B);this._accept?await n.acceptNearestChange(r[0]):await n.rejectNearestChange(r[0]),l.getValue("chat.editing.revealNextChangeOnResolve")&&o.changesCount.get()===0&&await s.invokeFunction($Ti,t,o,!0)}},BTi=class extends B1t{static{this.ID=Mgo}constructor(){super(!0)}},HTi=class extends B1t{static{this.ID=Pgo}constructor(){super(!1)}},UTi=class extends O8{constructor(){super({id:"chatEditor.action.toggleDiff",title:L(6946,"Toggle Diff Editor for Chat Edits"),category:Si,toggled:{condition:C.or(pe.inDiffEditor,fr.isEqualTo(WX)),icon:R.goToFile},precondition:C.and(Kg),icon:R.diffSingle,keybinding:{when:pe.focus,weight:200,primary:1601},menu:[{id:D.ChatEditingEditorHunk,order:10},{id:D.ChatEditingEditorContent,group:"a_resolve",order:2,when:C.and(Vte)},{id:D.ChatEditorInlineExecute,group:"a_resolve",order:2,when:C.and(Vte,YD)}]})}runChatEditingCommand(i,e,t,o,...n){o.toggleDiff(n[0])}},zTi=class extends O8{constructor(){super({id:"chatEditor.action.showAccessibleDiffView",title:L(6945,"Show Accessible Diff View for Chat Edits"),f1:!0,precondition:C.and(Kg,Wte.negate()),keybinding:{when:C.and(pe.focus,$a),weight:200,primary:65}})}runChatEditingCommand(i,e,t,o){o.enableAccessibleDiffView()}},KTi=class extends O8{constructor(){super({id:"chatEditor.action.reviewChanges",title:L(6955,"Review"),precondition:C.and(Kg,Wte.negate()),menu:[{id:D.ChatEditingEditorContent,group:"a_resolve",order:3,when:C.and(Vte.negate(),Wte.negate(),C.or($Ae,Gk.negate()))}]})}runChatEditingCommand(i,e,t,o,...n){t.enableReviewModeUntilSettled()}},GTi=class a extends O8{static{this.ID="chatEditor.action.acceptAllEdits"}constructor(){super({id:a.ID,title:L(6941,"Keep All Chat Edits"),tooltip:L(6942,"Keep All Chat Edits in this Session"),precondition:C.and(Kg,Wte.negate()),icon:R.checkAll,f1:!0,keybinding:{when:C.or(pe.focus,pr),weight:210,primary:2615}})}async runChatEditingCommand(i,e,t,o,...n){await e.accept()}},H1t=class extends K{constructor(e){super({id:e?"chatEditing.multidiff.acceptAllFiles":"chatEditing.multidiff.discardAllFiles",title:e?d(6940,null):d(6950,null),icon:e?R.check:R.discard,menu:{when:C.equals("resourceScheme",$K),id:D.EditorTitle,order:e?0:1,group:"navigation"}});this.accept=e}async run(e,...t){let o=e.get(ud),n=e.get(ee),r=e.get(wt),s=e.get(Io),c=Dp(t,n,r,s).groupedEditors[0];if(!c)return;let u=c.editors[0];if(!(u instanceof au)||!u.resource)return;let{chatSessionResource:p}=P9e(u.resource),h=o.getEditingSession(p);h&&(this.accept?await h.accept():await h.reject(),n.closeEditor({editor:u,groupId:c.group.id}))}},HZo=[$K,"copilotcli-worktree-changes","copilotcloud-pr-changes"],qTi=class extends K{constructor(){super({id:"chatEditing.multidiff.explain",title:d(6951,null),menu:{when:C.and(C.or(...HZo.map(e=>C.equals("resourceScheme",e))),C.has("config.chat.editing.explainChanges.enabled")),id:D.MultiDiffEditorContent,order:10}});this._widgetsByInput=new WeakMap}async run(e,...t){let o=e.get(ee),n=e.get(Fhe),r=e.get(Pt),s=e.get($t),l=e.get(ud),c=o.activeEditorPane;if(!c||!(c instanceof zg)||!c.viewModel)return;let u=c.input;if(!u)return;this._widgetsByInput.get(u)?.dispose();let p=new N;this._widgetsByInput.set(u,p),U.once(u.onWillDispose)(()=>{p.dispose(),this._widgetsByInput.delete(u)});let g=c.viewModel.items.get(),f;if(u instanceof au&&u.resource?.scheme===$K&&(f=P9e(u.resource).chatSessionResource),!f){let S=g.map(y=>{let w=y.documentDiffItem,k=w?.multiDiffEditorItem?.goToFileUri;if(k)return k;let T=w?.multiDiffEditorItem?.modifiedUri??y.modifiedUri;if(T?.path)return A.file(T.path)}).filter(y=>!!y);for(let y of l.editingSessionsObs.get())if(S.some(w=>y.getEntry(w))){f=y.chatSessionResource;break}}let v=new Map;for(let S of g){let y=S.modifiedUri;if(!y)continue;let w=c.tryGetCodeEditor(y);if(!w)continue;let k=S.diffEditorViewModel;await k.waitForDiff();let T=k.diff.get();if(!T||T.identical)continue;let P=y.toString(),O=v.get(P);O?O.changes.push(...T.mappings.map(V=>V.lineRangeMapping)):v.set(P,{editor:w.editor,changes:T.mappings.map(V=>V.lineRangeMapping),originalModel:k.model.original,modifiedModel:k.model.modified})}let b=[];for(let S of v.values()){let y={changes:S.changes,identical:!1,originalModel:S.originalModel,modifiedModel:S.modifiedModel};b.push(y);let w=new jAe(S.editor,r,s,n,y.modifiedModel.uri);p.add(w)}b.length>0&&p.add(n.generateExplanations(b,f,Se.None))}};function Ago(){W(class extends W1t{constructor(){super(!0)}}),W(class extends W1t{constructor(){super(!1)}}),W(KTi),W(Whe),W(Nit),W(GTi),W(BTi),W(HTi),W(UTi),W(zTi),W(class extends H1t{constructor(){super(!0)}}),W(class extends H1t{constructor(){super(!1)}}),W(qTi),ve.appendMenuItem(D.ChatEditingEditorContent,{command:{id:jTi,title:d(6952,null),precondition:C.false()},group:"navigate",order:-1,when:C.and(Vte,Kg)})}var jTi="chatEditor.navigation.bearings";var Wit=class extends hs{constructor(e,t,o,n,r,s=[Whe.ID]){super(void 0,e,{...t,icon:!1,label:!0,keybindingNotRenderedWithLabel:!0});this._entry=o;this._editor=n;this._keybindingService=r;this._primaryActionIds=s;this._reveal=this._store.add(new me)}render(e){if(super.render(e),this._primaryActionIds.includes(this._action.id)&&this.element?.classList.add("primary"),this._action.id===Whe.ID){let t=this._store.add(new me);this._store.add(be(o=>{wo(this.label),wo(this.element);let n=this._entry.read(o)?.autoAcceptController.read(o);if(n){let r=-100*(n.remaining/n.total);this.element.style.setProperty("--vscode-action-item-auto-timeout",`${r}%`),this.element.classList.toggle("auto",!0),t.value=LIe(this.element,()=>n.cancel())}else this.element.classList.toggle("auto",!1),t.clear()}))}}set actionRunner(e){super.actionRunner=e,this._editor&&(this._reveal.value=e.onWillRun(t=>{this._editor.focus()}))}get actionRunner(){return super.actionRunner}getTooltip(){let e=super.getTooltip();return e&&this._keybindingService.appendKeybinding(e,this._action.id)}},Oit=class extends x{constructor(e,t,o){super();this._editor=e;this._keybindingService=t;this._instaService=o;this._showStore=this._store.add(new N);this._session=Me(this,void 0);this._entry=Me(this,void 0);this._navigationBearings=Me(this,{changeCount:-1,activeIdx:-1,entriesCount:-1});this._domNode=document.createElement("div"),this._domNode.classList.add("chat-editor-overlay-widget"),this._isBusy=ke(s=>this._entry.read(s)?.waitsForLastEdits.read(s));let n=document.createElement("div");n.classList.add("chat-editor-overlay-progress"),M(n,Sn(q.modify(R.loading,"spin")));let r=M(n,_("span.progress-message"));this._domNode.appendChild(n),this._store.add(be(s=>{let l=this._isBusy.read(s);this._domNode.classList.toggle("busy",l),r.innerText=""})),this._toolbarNode=document.createElement("div"),this._toolbarNode.classList.add("chat-editor-overlay-toolbar")}dispose(){this.hide(),super.dispose()}getDomNode(){return this._domNode}show(e,t,o){this._showStore.clear(),Gi(n=>{this._session.set(e,n),this._entry.set(t,n)}),this._showStore.add(be(n=>{let r=o.entryIndex.read(n),s=o.changeIndex.read(n),l=e.entries.read(n),c=r!==void 0&&s!==void 0?s:-1,u=0;for(let p=0;p<l.length;p++){let h=l[p].changesCount.read(n);u+=h,r!==void 0&&p<r&&(c+=h)}this._navigationBearings.set({changeCount:u,activeIdx:c,entriesCount:l.length},void 0)})),this._domNode.appendChild(this._toolbarNode),this._showStore.add(Z(()=>this._toolbarNode.remove())),this._showStore.add(this._instaService.createInstance(or,this._toolbarNode,D.ChatEditingEditorContent,{telemetrySource:"chatEditor.overlayToolbar",hiddenItemStrategy:0,toolbarOptions:{primaryGroup:()=>!0,useSeparatorsInPrimaryActions:!0},menuOptions:{renderShortTitle:!0},actionViewItemProvider:(n,r)=>{let s=this;if(n.id===jTi)return new class extends hs{constructor(){super(void 0,n,{...r,icon:!1,label:!0,keybindingNotRenderedWithLabel:!0})}render(l){super.render(l),l.classList.add("label-item"),this._store.add(be(c=>{wo(this.label);let{changeCount:u,activeIdx:p}=s._navigationBearings.read(c);if(u>0){let h=p===-1?"1":`${p+1}`;this.label.innerText=d(6966,null,h,u)}else this.label.innerText=d(6965,null);this.updateTooltip()}))}getTooltip(){let{changeCount:l,entriesCount:c}=s._navigationBearings.get();if(l===-1||c===-1)return;let u;return l===1&&c===1?u=d(6967,null):l===1?u=d(6968,null,c):c===1?u=d(6970,null,l):u=d(6971,null,l,c),s._isBusy.get()?d(6969,null,u):u}};if(n.id===Whe.ID||n.id===Nit.ID)return new Wit(n,r,s._entry,s._editor,s._keybindingService)}}))}hide(){Gi(e=>{this._session.set(void 0,e),this._entry.set(void 0,e),this._navigationBearings.set({changeCount:-1,activeIdx:-1,entriesCount:-1},e)}),this._showStore.clear()}};Oit=I([m(1,_e),m(2,F)],Oit);var Fit=class{constructor(i,e,t,o){this._store=new N;this._domNode=document.createElement("div");this._domNode.classList.add("chat-editing-editor-overlay"),this._domNode.style.position="absolute",this._domNode.style.bottom="24px",this._domNode.style.right="24px",this._domNode.style.zIndex="100";let n=t.createInstance(Oit,e);this._domNode.appendChild(n.getDomNode()),this._store.add(Z(()=>this._domNode.remove())),this._store.add(n);let r=()=>{i.contains(this._domNode)||i.appendChild(this._domNode)},s=()=>{i.contains(this._domNode)&&(n.hide(),this._domNode.remove())},l=Fr(this,U.any(e.onDidActiveEditorChange,e.onDidModelChange)),c=Os({equalsFn:Qe},p=>{l.read(p);let h=e.activeEditorPane;return po.getOriginalUri(h?.input,{supportSideBySide:1})}),u=ke(p=>{l.read(p);let h=c.read(p);if(h)for(let g of o.editingSessionsObs.read(p)){if(!g.isGlobalEditingSession)continue;let f=g.readEntry(h,p);if(f)return{session:g,entry:f}}});this._store.add(be(p=>{let h=u.read(p);if(!h){s();return}let{session:g,entry:f}=h;if(f?.state.read(p)===0){let v=e.activeEditorPane;wo(v);let b=ke(y=>f?f.getEditorIntegration(v).currentIndex.read(y):0),S=ke(y=>f?g.entries.read(y).indexOf(f):0);n.show(g,f,{entryIndex:S,changeIndex:b}),r()}else s()}))}dispose(){this._store.dispose()}};Fit=I([m(2,F),m(3,ud)],Fit);var Vhe=class{constructor(i,e){this._store=new N;let t=ui(this,U.any(i.onDidAddGroup,i.onDidRemoveGroup),()=>i.groups),o=this._store.add(new Vt);this._store.add(be(n=>{let r=new Set(o.keys()),s=t.read(n);for(let l of s)if(l instanceof Wb&&(r.delete(l),!o.has(l))){let c=e.createChild(new _o([X,l.scopedContextKeyService])),u=l.element,p=c.createInstance(Fit,u,l);o.set(l,wn(p,c))}for(let l of r)o.deleteAndDispose(l)}))}static{this.ID="chat.edits.editorOverlay"}dispose(){this._store.dispose()}};Vhe=I([m(0,wt),m(1,F)],Vhe);var U1t=le("IInlineChatHistoryService"),QTi="inlineChat.history",UZo=50,QAe=class extends x{constructor(e){super();this._storageService=e;let t=this._storageService.get(QTi,0),o=[""];if(t)try{let n=JSON.parse(t);Array.isArray(n)&&n.length>0&&(o=n,o[o.length-1]!==""&&o.push(""))}catch{}this._history=new YV(o,UZo),this._store.add(this._storageService.onWillSaveState(()=>{this._saveToStorage()}))}_saveToStorage(){let e=[...this._history].filter(t=>t.length>0);e.length===0?this._storageService.remove(QTi,0):this._storageService.store(QTi,JSON.stringify(e),0,0)}addToHistory(e){this._history.replaceLast(e),this._history.add("")}previousValue(){return this._history.previous()}nextValue(){return this._history.next()}isAtEnd(){return this._history.isAtEnd()}replaceLast(e){this._history.replaceLast(e)}resetCursor(){this._history.resetCursor()}};QAe=I([m(0,ce)],QAe);var YAe=class extends x{constructor(e,t,o,n,r,s,l){super();this._editorObs=e;this._contextKeyService=t;this._menuService=o;this._historyService=l;this._position=Me(this,null);this.position=this._position;this._showStore=this._store.add(new N);this._anchorLineNumber=0;this._anchorLeft=0;this._anchorAbove=!1;this._domNode=_(".inline-chat-gutter-menu"),this._container=M(this._domNode,_(".inline-chat-gutter-container")),this._inputContainer=M(this._container,_(".input")),this._toolbarContainer=M(this._container,_(".toolbar"));let c=M(this._domNode,_(".inline-chat-gutter-actions")),u=this._store.add(new Zi(c,{orientation:1,preventLoopNavigation:!0})),p=this._store.add(this._menuService.createMenu(D.ChatEditorInlineMenu,this._contextKeyService)),h=()=>{let H=jm(p.getActions({shouldForwardArgs:!0}));u.clear(),u.push(H),hh(H.length>0,c)};this._store.add(p.onDidChange(h)),h();let g=Vb(s);g.wordWrap="off",g.wrappingStrategy="advanced",g.lineNumbers="off",g.glyphMargin=!1,g.lineDecorationsWidth=0,g.lineNumbersMinChars=0,g.folding=!1,g.minimap={enabled:!1},g.scrollbar={vertical:"hidden",horizontal:"hidden",alwaysConsumeMouseWheel:!0},g.renderLineHighlight="none",g.fontFamily=NO,g.fontSize=13,g.lineHeight=20,g.cursorWidth=1,g.padding={top:2,bottom:2};let f={isSimpleWidget:!0,contributions:Ba.getSomeEditorContributions([mB.ID])};this._input=this._store.add(n.createInstance(Xr,this._inputContainer,g,f));let v=this._store.add(r.createModel("",null,A.parse(`gutter-input:${Date.now()}`),!0));this._input.setModel(v);let b=this._store.add(n.createInstance(or,this._toolbarContainer,D.InlineChatInput,{telemetrySource:"inlineChatInput.toolbar",hiddenItemStrategy:-1,toolbarOptions:{primaryGroup:()=>!0},menuOptions:{shouldForwardArgs:!0}})),S=fb.get(this._editorObs.editor);this._stickyScrollHeight=S?ui(S.onDidChangeStickyScrollHeight,()=>S.stickyScrollWidgetHeight):So(0);let y=Me(this,0),w=new WL(()=>{y.set(zl(b.getElement()),void 0)});this._store.add(w),this._store.add(w.observe(b.getElement()));let k=ui(this,this._input.onDidChangeModelContent,()=>this._input.getContentWidth()),T=ui(this,this._input.onDidContentSizeChange,()=>this._input.getContentHeight());this._layoutData=ke(H=>{let $=k.read(H)+6+y.read(H),J=220,ae=600,he=Math.round(ae/1.618),oe;this._input.getOption(149)==="on"?oe=ae:$<=J?oe=J:$<=he?oe=he:oe=ae;let de=this._input.getOption(75),Ce=Math.min(T.read(H),3*de);return $>oe&&this._input.updateOptions({wordWrap:"on"}),{editorPad:6,toolbarWidth:y.read(H),totalWidth:oe,height:Ce}}),this._store.add(be(H=>{let{editorPad:G,toolbarWidth:$,totalWidth:J,height:ae}=this._layoutData.read(H),he=J-$-G;this._container.style.width=`${J}px`,this._inputContainer.style.width=`${he}px`,this._input.layout({width:he,height:ae})})),this._store.add(this._input.onDidFocusEditorText(()=>this._container.classList.add("focused"))),this._store.add(this._input.onDidBlurEditorText(()=>this._container.classList.remove("focused"))),this._store.add(this._input.onDidScrollChange(H=>{this._toolbarContainer.classList.toggle("fake-scroll-decoration",H.scrollTop>0)}));let P=pit.bindTo(this._contextKeyService);this._store.add(this._input.onDidChangeModelContent(()=>{P.set(this._input.getModel().getValue().trim().length>0)})),this._store.add(Z(()=>P.reset()));let O=A8.bindTo(this._contextKeyService);this._store.add(this._input.onDidFocusEditorText(()=>O.set(!0))),this._store.add(this._input.onDidBlurEditorText(()=>O.set(!1))),this._store.add(Z(()=>O.reset())),this._store.add(this._input.onKeyDown(H=>{if(H.keyCode===16){let G=this._input.getPosition();G&&G.lineNumber===1&&(this._showPreviousHistoryValue(),H.preventDefault(),H.stopPropagation())}else if(H.keyCode===18){let G=this._input.getModel(),$=this._input.getPosition();$&&$.lineNumber===G.getLineCount()&&(this._historyService.isAtEnd()?u.isEmpty()||(H.preventDefault(),H.stopPropagation(),u.focus(0)):(this._showNextHistoryValue(),H.preventDefault(),H.stopPropagation()))}})),this._store.add(j(u.domNode,"keydown",H=>{let G=new gi(H);if(G.keyCode===9)G.preventDefault(),G.stopPropagation(),this.hide();else if(G.keyCode===16){let $=u.viewItems[0];$?.element&&Gr($.element)&&(G.preventDefault(),G.stopPropagation(),this._input.focus())}},!0));let V=this._store.add(qn(this._domNode));this._store.add(V.onDidBlur(()=>this.hide()))}get value(){return this._input.getModel().getValue().trim()}addToHistory(e){this._historyService.addToHistory(e)}_showPreviousHistoryValue(){this._historyService.isAtEnd()&&this._historyService.replaceLast(this._input.getModel().getValue());let e=this._historyService.previousValue();e!==void 0&&this._input.getModel().setValue(e)}_showNextHistoryValue(){if(this._historyService.isAtEnd())return;let e=this._historyService.nextValue();e!==void 0&&this._input.getModel().setValue(e)}show(e,t,o,n,r){this._showStore.clear(),this._historyService.resetCursor(),this._input.updateOptions({wordWrap:"off",placeholder:n}),this._input.getModel().setValue(r??""),this._anchorLineNumber=e,this._anchorLeft=t,this._anchorAbove=o,this._updatePosition(),this._showStore.add(this._editorObs.createOverlayWidget({domNode:this._domNode,position:this._position,minContentWidthInPx:So(0),allowEditorOverflow:!0})),o&&this._updatePosition(),this._showStore.add(this._editorObs.editor.onDidScrollChange(()=>{let l=this._editorObs.editor.getVisibleRanges().some(u=>this._anchorLineNumber>=u.startLineNumber&&this._anchorLineNumber<=u.endLineNumber),c=!!this._input.getModel().getValue();!l&&!c?this.hide():this._updatePosition()})),setTimeout(()=>{this._input.focus(),r&&this._input.setSelection(this._input.getModel().getFullModelRange())},0)}_updatePosition(){let e=this._editorObs.editor,t=e.getOption(75),o=e.getTopForLineNumber(this._anchorLineNumber)-e.getScrollTop(),n=o;if(this._anchorAbove){let g=this._domNode.offsetHeight;n=o-g}else n=o+t;let r=this._stickyScrollHeight.get(),s=e.getLayoutInfo(),l=this._domNode.offsetHeight,c=r,u=s.height-l,p=Math.max(c,Math.min(n,u)),h=p!==n;this._domNode.classList.toggle("clamped",h),this._position.set({preference:{top:p,left:this._anchorLeft},stackOrdinal:1e4},void 0)}hide(){let e=this._editorObs.editor.getDomNode();e&&Gr(e)&&this._editorObs.editor.focus(),this._position.set(null,void 0),this._input.getModel().setValue(""),this._showStore.clear()}};YAe=I([m(1,X),m(2,Kt),m(3,F),m(4,Tt),m(5,B),m(6,U1t)],YAe);var XAe=class extends x{constructor(e,t,o,n){super();this._editorObs=e;this._instaService=t;this._keybindingService=o;this._logService=n;this._domNode=document.createElement("div");this._showStore=this._store.add(new N);this._position=Me(this,null);this._minContentWidthInPx=So(0);this._domNode.classList.add("inline-chat-session-overlay-widget"),this._container=document.createElement("div"),this._domNode.appendChild(this._container),this._container.classList.add("inline-chat-session-overlay-container"),this._markdownContainer=document.createElement("div"),this._markdownContainer.classList.add("markdown-scroll-container"),this._markdownMessage=document.createElement("div"),this._markdownMessage.classList.add("markdown-message"),this._markdownContainer.appendChild(this._markdownMessage),this._markdownScrollable=this._store.add(new ms(this._markdownContainer,{consumeMouseWheelIfScrollbarIsNeeded:!0,horizontal:2,vertical:1})),this._container.appendChild(this._markdownScrollable.getDomNode()),this._contentRow=document.createElement("div"),this._contentRow.classList.add("content-row"),this._container.appendChild(this._contentRow),this._statusNode=document.createElement("div"),this._statusNode.classList.add("status"),this._icon=M(this._statusNode,_("span")),this._message=M(this._statusNode,_("span.message")),this._contentRow.appendChild(this._statusNode),this._toolbarNode=document.createElement("div"),this._toolbarNode.classList.add("toolbar");let r=fb.get(this._editorObs.editor);this._stickyScrollHeight=r?ui(r.onDidChangeStickyScrollHeight,()=>r.stickyScrollWidgetHeight):So(0)}show(e){wo(this._editorObs.editor.hasModel()),this._showStore.clear();let t=ke(u=>e.editingSession.readEntry(e.uri,u)),o=ke(u=>{let p=e?.chatModel;if(!e||!p)return;let h=e.terminationState.read(u);if(h)return{markdown:h,icon:R.info};let g=p.lastRequestObs.read(u)?.response;if(!g)return{message:d(11256,null),icon:q.modify(R.loading,"spin")};if(g.isComplete){if(g.result?.errorDetails)return{message:d(11254,null),icon:R.error};let S=t.read(u)?.changesCount.read(u)??0;return{message:S===0?d(11251,null):S===1?d(11252,null):d(11253,null,S),icon:R.check}}if(g.isPendingConfirmation.read(u))return{message:d(11255,null),icon:R.error};let v=Vf({equalsFn:()=>!1},g.onDidChange,()=>g.response.value).read(u).filter(b=>b.kind==="progressMessage"||b.kind==="toolInvocation").at(-1);return v?.kind==="toolInvocation"?{message:v.invocationMessage,icon:q.modify(R.loading,"spin")}:v?.kind==="progressMessage"?{message:v.content,icon:q.modify(R.loading,"spin")}:{message:d(11256,null),icon:q.modify(R.loading,"spin")}}),n=this._showStore.add(new N);this._showStore.add(be(u=>{let p=o.read(u);if(p)if(p.message&&p.icon?(this._message.innerText=Da(p.message),this._icon.className="",this._icon.classList.add(...q.asClassNameArray(p.icon)),this._statusNode.classList.remove("hidden"),this._contentRow.classList.remove("status-hidden")):(this._message.innerText="",this._icon.className="",this._statusNode.classList.add("hidden"),this._contentRow.classList.add("status-hidden")),n.clear(),this._markdownMessage.replaceChildren(),p.markdown){this._markdownScrollable.getDomNode().classList.remove("hidden");let h=typeof p.markdown=="string"?new Ie(p.markdown):p.markdown,g=n.add(Gf(h));this._markdownMessage.appendChild(g.element),this._markdownScrollable.scanDomNode()}else this._markdownScrollable.getDomNode().classList.add("hidden");else this._message.innerText="",this._icon.className="",this._statusNode.classList.add("hidden"),this._contentRow.classList.add("status-hidden"),n.clear(),this._markdownMessage.replaceChildren(),this._markdownScrollable.getDomNode().classList.add("hidden")})),this._showStore.add(be(u=>{let h=e.chatModel.lastRequestObs.read(u)?.response?.isPendingConfirmation.read(u);h&&this._logService.info(`[InlineChat] UNEXPECTED approval needed: ${h.detail??"unknown"}`)})),this._contentRow.appendChild(this._toolbarNode),this._showStore.add(Z(()=>this._toolbarNode.remove()));let r=this;this._showStore.add(this._instaService.createInstance(or,this._toolbarNode,D.ChatEditorInlineExecute,{telemetrySource:"inlineChatProgress.overlayToolbar",hiddenItemStrategy:0,toolbarOptions:{primaryGroup:()=>!0,useSeparatorsInPrimaryActions:!0},menuOptions:{renderShortTitle:!0},actionViewItemProvider:(u,p)=>{let h=["inlineChat2.cancel","inlineChat2.keep","inlineChat2.rephrase"];if(h.concat(["inlineChat2.undo"]).includes(u.id))return new Wit(u,{...p,keybinding:void 0},t,void 0,r._keybindingService,h)}}));let s=this._editorObs.getOption(75),l=Me(this,0),c=new WL(()=>{l.set(this._domNode.offsetWidth,void 0)});this._showStore.add(c),this._showStore.add(c.observe(this._domNode)),this._showStore.add(be(u=>{let p=this._editorObs.layoutInfo.read(u),h=this._stickyScrollHeight.read(u),g=l.read(u),f=Math.round(s.read(u)*2/3),v=Math.min(400,p.contentWidth-2*f),b=Math.min(150,Math.floor(p.height/3));this._domNode.style.maxWidth=`${v}px`,this._markdownScrollable.getDomNode().style.maxHeight=`${b}px`,this._markdownContainer.style.maxHeight=`${b}px`,this._markdownScrollable.scanDomNode();let S=h+f,y=p.width-g-p.verticalScrollbarWidth-p.minimap.minimapWidth-f;this._position.set({preference:{top:S,left:y},stackOrdinal:1e4},void 0)})),this._showStore.add(this._editorObs.createOverlayWidget({domNode:this._domNode,position:this._position,minContentWidthInPx:this._minContentWidthInPx,allowEditorOverflow:!1}))}hide(){this._position.set(null,void 0),this._showStore.clear()}};XAe=I([m(1,F),m(2,_e),m(3,se)],XAe);var Vit=class extends Sw{constructor(e,t,o,n,r,s){super(e);this._options=t;this._contextMenuService=o;this._keybindingService=n;this._hoverService=s;this._store=new N;this._updateStore=new N;this._onDidChange=new E;this.onDidChange=this._onDidChange.event;this._actionRunner=this._store.add(new rs),t?.telemetrySource&&this._actionRunner.onDidRun(l=>{r.publicLog2("workbenchActionExecuted",{id:l.action.id,from:t.telemetrySource})},void 0,this._store)}dispose(){this._onDidChange.dispose(),this._updateStore.dispose(),this._store.dispose(),super.dispose()}update(e,t){let o=this._options?.buttonConfigProvider??(()=>({showLabel:!0}));this._updateStore.clear(),this.clear();let n=this._updateStore.add(Qh());for(let r=0;r<e.length;r++){let s=r>0,l=e[r],c,u,p;if(l instanceof Fs&&l.actions.length>1){let[v,...b]=l.actions;c=v,p=c.tooltip||c.label,p=this._keybindingService.appendKeybinding(p,c.id),u=this.addButtonWithDropdown({secondary:o(c,r)?.isSecondary??s,actionRunner:this._actionRunner,actions:b,contextMenuProvider:this._contextMenuService,ariaLabel:p,supportIcons:!0,small:this._options?.small})}else c=l instanceof Fs&&l.actions.length===1?l.actions[0]:l,p=c.tooltip||c.label,p=this._keybindingService.appendKeybinding(p,c.id),u=this.addButton({secondary:o(c,r)?.isSecondary??s,ariaLabel:p,supportIcons:!0,small:this._options?.small});u.enabled=c.enabled,u.checked=c.checked??!1,u.element.classList.add("default-colors");let h=o(c,r)?.showLabel??!0,g=o(c,r)?.customClass,f=o(c,r)?.customLabel;if(g&&u.element.classList.add(g),h?u.label=f??c.label:u.element.classList.add("monaco-text-button"),o(c,r)?.showIcon)if(c instanceof Lo&&q.isThemeIcon(c.item.icon))if(!h)u.icon=c.item.icon;else{let v=f??c.label;u.label=Ar(v)?new Ie(`$(${c.item.icon.id}) ${v.value}`,{isTrusted:v.isTrusted,supportThemeIcons:!0,supportHtml:v.supportHtml}):`$(${c.item.icon.id}) ${v}`}else c.class&&u.element.classList.add(...c.class.split(" "));this._updateStore.add(this._hoverService.setupManagedHover(n,u.element,p)),this._updateStore.add(u.onDidClick(async()=>{if(this._options?.disableWhileRunning){u.enabled=!1;try{await this._actionRunner.run(c)}finally{u.enabled=c.enabled}}else this._actionRunner.run(c)}))}if(t.length>0){let r=this.addButton({secondary:!0,ariaLabel:d(1808,null),small:this._options?.small});r.icon=R.dropDownButton,r.element.classList.add("default-colors","monaco-text-button"),r.enabled=!0,this._updateStore.add(this._hoverService.setupManagedHover(n,r.element,d(1808,null))),this._updateStore.add(r.onDidClick(async()=>{this._contextMenuService.showContextMenu({getAnchor:()=>r.element,getActions:()=>t,actionRunner:this._actionRunner,onHide:()=>r.element.setAttribute("aria-expanded","false")}),r.element.setAttribute("aria-expanded","true")}))}this._onDidChange.fire(this)}};Vit=I([m(2,Xe),m(3,_e),m(4,Te),m(5,nt)],Vit);var LG=class extends Vit{constructor(i,e,t,o,n,r,s,l,c){super(i,t,r,s,l,c);let u=o.createMenu(e,n);this._store.add(u);let p=()=>{this.clear();let h=ml(u.getActions(t?.menuOptions),t?.toolbarOptions?.primaryGroup);super.update(h.primary,h.secondary)};this._store.add(u.onDidChange(p)),p()}dispose(){super.dispose()}update(i){throw new Error("Use Menu or WorkbenchButtonBar")}};LG=I([m(3,Kt),m(4,X),m(5,Xe),m(6,_e),m(7,Te),m(8,nt)],LG);var z1t=le("chatLayoutService");var G1t="http://_vscodecontentref_";function YTi(a){let i=0,e=[];for(let t of a){let o=e.findLastIndex(r=>r.kind!=="textEditGroup"&&r.kind!=="undoStop"),n=e[o];if(t.kind==="inlineReference"){let r=t.name;r||(A.isUri(t.inlineReference)?r=He(t.inlineReference):lf(t.inlineReference)?r=He(t.inlineReference.uri):r=t.inlineReference.name);let s=n?.kind==="markdownContent"?n.content.value:"";if(GZo(s))if(n?.kind==="markdownContent"){let l=DZ(n.content,new Ie(r));e[o]={...n,content:l}}else e.push({content:new Ie(r),kind:"markdownContent"});else{let l=i++,c=A.parse(G1t).with({path:String(l)}),u=`[${r}](${c.toString()})`,p={[l]:t};if(n?.kind==="markdownContent"){let h=DZ(n.content,new Ie(u));e[o]={...n,content:h,inlineReferences:{...p,...n.inlineReferences||{}}}}else e.push({content:new Ie(u),inlineReferences:p,kind:"markdownContent"})}}else if(t.kind==="markdownContent"&&n?.kind==="markdownContent")if(cOt(n.content,t.content)){let r=DZ(n.content,t.content);e[o]={...n,content:r}}else n.inlineReferences&&KZo(n.content.value)?e[o]={...n,content:{...t.content,value:n.content.value+t.content.value}}:e.push(t);else if(t.kind==="markdownVuln"){let s=`<vscode_annotation details='${encodeURIComponent(JSON.stringify(t.vulnerabilities))}'>${t.content.value}</vscode_annotation>`;if(n?.kind==="markdownContent"){let l=DZ(n.content,new Ie(s));e[o]={...n,content:l}}else e.push({content:new Ie(s),kind:"markdownContent"})}else if(t.kind==="codeblockUri"){if(n?.kind==="markdownContent"){let r=t.isEdit?" isEdit":"",s=t.subAgentInvocationId?` subAgentInvocationId="${encodeURIComponent(t.subAgentInvocationId)}"`:"",l=`<vscode_codeblock_uri${r}${s}>${t.uri.toString()}</vscode_codeblock_uri>`,c=DZ(n.content,new Ie(l));e.splice(o,1),e.push({...n,content:c})}}else e.push(t)}return e}var zZo=new RegExp(`^(\\[.*?\\]\\(${G1t}/\\d+\\))+$`);function KZo(a){return zZo.test(a)}function GZo(a){let i=a.split(`
`),e=!1,t="",o=0,n=[];for(let r of i){let s=r.trimStart();if(e){let c=K1t(s,t);c>=o&&s.substring(c).trim()===""&&(e=!1,n.length=0);continue}let l=s[0];if(l==="`"||l==="~"){let c=K1t(s,l);if(c>=3&&(l==="~"||!s.substring(c).includes("`"))){e=!0,t=l,o=c,n.length=0;continue}}n.push(r)}return e||qZo(n.join(`
`))}function K1t(a,i){let e=0;for(;e<a.length&&a[e]===i;)e++;return e}function qZo(a){let i=0;for(;i<a.length;){if(a[i]!=="`"){i++;continue}let e=K1t(a.substring(i),"`");i+=e;let t=!1;for(;i<a.length;){if(a[i]!=="`"){i++;continue}let o=K1t(a.substring(i),"`");if(i+=o,o===e){t=!0;break}}if(!t)return!0}return!1}function JAe(a){let i=/<vscode_codeblock_uri( isEdit)?( subAgentInvocationId="([^"]*)")?>([\s\S]*?)<\/vscode_codeblock_uri>/ms.exec(a);if(i){let[e,t,,o,n]=i;if(n){let r=A.parse(n),s=a.substring(0,i.index)+a.substring(i.index+e.length),l;if(o)try{l=decodeURIComponent(o)}catch{l=o}return{uri:r,textWithoutResult:s,isEdit:!!t,subAgentInvocationId:l}}}}function Ngo(a){let i=/<vscode_codeblock_uri[^>]* subAgentInvocationId="([^"]*)"/ms.exec(a);if(i)try{return decodeURIComponent(i[1])}catch{return i[1]}}function Ogo(a){return a.includes("<vscode_codeblock_uri")}function Fgo(a){return a.includes("<vscode_codeblock_uri isEdit")}function Wgo(a){let i=[],e=a,t;for(;(t=/<vscode_annotation details='(.*?)'>(.*?)<\/vscode_annotation>/ms.exec(e))!==null;){let[o,n,r]=t,s=t.index,l=e.substring(0,s),c=l.split(`
`).length-1,u=r.split(`
`).length-1,p=l.lastIndexOf(`
`),h=s-(p+1)+1,g=(l+r).lastIndexOf(`
`),f=s+r.length-(g+1)+1;try{JSON.parse(decodeURIComponent(n)).forEach(({title:b,description:S})=>i.push({title:b,description:S,range:{startLineNumber:c+1,startColumn:h,endLineNumber:c+u+1,endColumn:f}}))}catch{}e=e.substring(0,s)+r+e.substring(s+o.length)}return{newText:e,vulnerabilities:i}}var sW=class extends x{constructor(e,t,o){super();this.tag=e;this.languageService=t;this.textModelService=o;this._models=new Map;this.maxModelCount=100;this._register(this.languageService.onDidChange(async()=>{for(let n of this._models.values()){if(!n.inLanguageId)continue;let r=(await n.model).object,s=r.getLanguageId();(!s||s===$r)&&this.trySetTextModelLanguage(n.inLanguageId,r.textEditorModel)}}))}dispose(){super.dispose(),this.clear()}get(e,t,o){let n=this._models.get(this.getKey(e,t,o));if(n)return{model:n.model.then(r=>r.object.textEditorModel),vulns:n.vulns,codemapperUri:n.codemapperUri,isEdit:n.isEdit,subAgentInvocationId:n.subAgentInvocationId}}getOrCreate(e,t,o){let n=this.get(e,t,o);if(n)return n;let r=this.getCodeBlockUri(e,t,o),s=this.textModelService.createModelReference(r);for(this._models.set(this.getKey(e,t,o),{model:s,vulns:[],inLanguageId:void 0,codemapperUri:void 0});this._models.size>this.maxModelCount;){let l=vt.first(this._models.keys());if(!l)break;this.delete(l)}return{model:s.then(l=>l.object.textEditorModel),vulns:[],codemapperUri:void 0}}delete(e){let t=this._models.get(e);t&&(t.model.then(o=>o.dispose()),this._models.delete(e))}clear(){this._models.forEach(async e=>await e.model.then(t=>t.dispose())),this._models.clear()}updateSync(e,t,o,n){let r=this.getOrCreate(e,t,o);return this.updateInternalCodeBlockEntry(n,e,t,o),this.get(e,t,o)??r}markCodeBlockCompleted(e,t,o){this._models.get(this.getKey(e,t,o))}async update(e,t,o,n){let r=this.getOrCreate(e,t,o),s=this.updateInternalCodeBlockEntry(n,e,t,o),l=await r.model;if(!l||l.isDisposed())return r;n.languageId&&this.trySetTextModelLanguage(n.languageId,l);let c=l.getValue(1);if(s===c)return r;if(s.startsWith(c)){let u=s.slice(c.length),p=l.getLineCount(),h=l.getLineMaxColumn(p);l.applyEdits([{range:new z(p,h,p,h),text:u}])}else l.setValue(s);return r}updateInternalCodeBlockEntry(e,t,o,n){let r=this._models.get(this.getKey(t,o,n));r&&(r.inLanguageId=e.languageId);let s=Wgo(e.text),l=$Zo(s.newText,e.languageId);r&&(r.vulns=s.vulnerabilities);let c=JAe(l);return c?(r&&(r.codemapperUri=c.uri,r.isEdit=c.isEdit,r.subAgentInvocationId=c.subAgentInvocationId),l=c.textWithoutResult):r&&(r.codemapperUri=void 0,r.isEdit=void 0,r.subAgentInvocationId=void 0),e.isComplete&&this.markCodeBlockCompleted(t,o,n),l}trySetTextModelLanguage(e,t){let o=this.languageService.getLanguageIdByLanguageName(e);o&&o!==t.getLanguageId()&&t.setLanguage(o)}getKey(e,t,o){return`${e.toString()}/${t.id}/${o}`}getCodeBlockUri(e,t,o){let n=this.getUriMetaData(t),r=this.tag?`${this.tag}-${o}`:`${o}`,s=Yd(qe.wrap(new TextEncoder().encode(e.toString())),!1,!0);return A.from({scheme:Q.vscodeChatCodeBlock,authority:s,path:`/${t.id}/${r}`,fragment:n?JSON.stringify(n):void 0})}getUriMetaData(e){if(Ui(e))return{references:e.contentReferences.map(t=>{if(typeof t.reference=="string")return;let o=Zeo(t.reference)?t.reference.value:t.reference;if(o)return A.isUri(o)?{uri:o.toJSON()}:{uri:o.uri.toJSON(),range:o.range}})}}};sW=I([m(1,_t),m(2,Bt)],sW);function $Zo(a,i){return i==="php"&&!a.trim().startsWith("<?")?`<?php
${a}`:a}var Ss;(P=>{P.PROMPT_LOCATIONS_KEY="chat.promptFilesLocations",P.INSTRUCTIONS_LOCATION_KEY="chat.instructionsFilesLocations",P.MODE_LOCATION_KEY="chat.modeFilesLocations",P.AGENTS_LOCATION_KEY="chat.agentFilesLocations",P.SKILLS_LOCATION_KEY="chat.agentSkillsLocations",P.HOOKS_LOCATION_KEY="chat.hookFilesLocations",P.PROMPT_FILES_SUGGEST_KEY="chat.promptFilesRecommendations",P.USE_COPILOT_INSTRUCTION_FILES="github.copilot.chat.codeGeneration.useInstructionFiles",P.USE_AGENT_MD="chat.useAgentsMdFile",P.USE_NESTED_AGENT_MD="chat.useNestedAgentsMdFiles",P.USE_CLAUDE_MD="chat.useClaudeMdFile",P.USE_AGENT_SKILLS="chat.useAgentSkills",P.USE_CHAT_HOOKS="chat.useHooks",P.USE_CLAUDE_HOOKS="chat.useClaudeHooks",P.USE_CUSTOM_AGENT_HOOKS="chat.useCustomAgentHooks",P.USE_SKILL_ADHERENCE_PROMPT="chat.experimental.useSkillAdherencePrompt",P.INCLUDE_APPLYING_INSTRUCTIONS="chat.includeApplyingInstructions",P.INCLUDE_REFERENCED_INSTRUCTIONS="chat.includeReferencedInstructions",P.USE_CUSTOMIZATIONS_IN_PARENT_REPOS="chat.useCustomizationsInParentRepositories";function w(O,V){let H=XTi(V),G=O.getValue(H);if(!(G==null||Array.isArray(G))&&typeof G=="object"){let $={};for(let[J,ae]of Object.entries(G)){let he=J.trim(),oe=Vgo(ae);oe!==void 0&&he&&($[he]=oe)}return $}}P.getLocationsValue=w;function k(O,V){let H=w(O,V),G=aTe(V);if(H&&typeof H=="object"){let $=[],J=new Set(G.map(ae=>ae.path));for(let ae of G)H[ae.path]!==!1&&$.push(ae);for(let[ae,he]of Object.entries(H)){if(he===!1||J.has(ae))continue;let oe=Bit(ae)?"user":"local";$.push({path:ae,source:oe==="local"?"config-personal":"config-workspace",storage:oe})}return $}return[]}P.promptSourceFolders=k;function T(O,V){let H=O.getValue(P.PROMPT_FILES_SUGGEST_KEY,{resource:V});if(!H||typeof H!="object"||Array.isArray(H))return;let G={};for(let[$,J]of Object.entries(H)){let ae=$.trim();if(!ae)continue;if(typeof J=="boolean"){G[ae]=J;continue}if(typeof J=="string"){let oe=J.trim();oe&&(G[ae]=oe);continue}let he=Vgo(J);he!==void 0&&(G[ae]=he)}return Object.keys(G).length>0?G:void 0}P.getPromptFilesRecommendationsValue=T})(Ss||={});function XTi(a){switch(a){case"instructions":return Ss.INSTRUCTIONS_LOCATION_KEY;case"prompt":return Ss.PROMPT_LOCATIONS_KEY;case"agent":return Ss.AGENTS_LOCATION_KEY;case"skill":return Ss.SKILLS_LOCATION_KEY;case"hook":return Ss.HOOKS_LOCATION_KEY;default:throw new Error("Unknown prompt type")}}function Vgo(a){if(typeof a=="boolean")return a;if(typeof a=="string"){let i=a.trim().toLowerCase();return i==="true"?!0:i==="false"?!1:void 0}}function Bit(a){return a.startsWith("~/")}var Gg=le("agentPluginService");function ZTi(a,i){let e=He(a.uri),t=Bgo(e),o=Bgo(i);return o.startsWith(`${t}:`)?o:`${t}:${o}`}function Bgo(a){return a.trim().toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9_.:-]/g,"-").replace(/-+/g,"-").replace(/^[-:.]+|[-:.]+$/g,"")}var JTi=class{constructor(){this._discovery=[]}register(i){this._discovery.push(i)}getAll(){return this._discovery}},ZAe=new JTi;function jZo(){return{applyingInstructionsCount:0,referencedInstructionsCount:0,agentInstructionsCount:0,listedInstructionsCount:0,totalInstructionsCount:0,claudeRulesCount:0,claudeMdCount:0,claudeAgentsCount:0}}var Bte=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v){this._modeKind=i;this._enabledTools=e;this._enabledSubagents=t;this._sessionResource=o;this._promptsService=n;this._logService=r;this._labelService=s;this._configurationService=l;this._contextKeyService=c;this._workspaceService=u;this._fileService=p;this._remoteAgentService=h;this._telemetryService=g;this._languageModelToolsService=f;this._agentPluginService=v;this._parseResults=new gt}async _parseInstructionsFile(i,e){if(this._parseResults.has(i))return this._parseResults.get(i);try{let t=await this._promptsService.parseNew(i,e);return this._parseResults.set(i,t),t}catch(t){this._logService.error(`[InstructionsContextComputer] Failed to parse instruction file: ${i}`,t);return}}async collect(i,e){let t=await this._promptsService.getInstructionFiles(e,this._sessionResource);this._logService.trace(`[InstructionsContextComputer] ${t.length} instruction files available.`);let o=jZo(),n=this._getContext(i);await this.addApplyingInstructions(t,n,i,o,e),await this._addReferencedInstructions(i,o,e),await this._addAgentInstructions(i,o,e);let r=await this._getCustomizationsIndex(t,i,o,e);r&&(i.add(r),o.listedInstructionsCount++),this.sendTelemetry(o)}sendTelemetry(i){i.totalInstructionsCount=i.agentInstructionsCount+i.referencedInstructionsCount+i.applyingInstructionsCount+i.listedInstructionsCount,this._telemetryService.publicLog2("instructionsCollected",i)}async _logSkillLoadedTelemetry(i){try{let e=new gt,t=this._agentPluginService.plugins.get();for(let n of t)e.set(n.uri,n);let o=n=>n!==void 0?String(_r(n)):"";for(let n of i){let r=n.pluginUri?e.get(n.pluginUri):void 0;this._telemetryService.publicLog2("skillLoadedIntoContext",{skillNameHash:o(n.name),skillStorage:n.storage,extensionIdHash:o(n.extension?.identifier.value),extensionVersion:n.extension?.version??"",pluginNameHash:o(r?.label),pluginVersion:r?.fromMarketplace?.version??""})}}catch(e){this._logService.error("[InstructionsContextComputer] Failed to log skill telemetry",e)}}async addApplyingInstructions(i,e,t,o,n){if(!this._configurationService.getValue(Ss.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:s}of i){let l=await this._parseInstructionsFile(s,n);if(!l){this._logService.trace(`[InstructionsContextComputer] Unable to read: ${s}`);continue}let c=l.header?.applyTo,u=l.header?.paths,p=DB(s),h=p?u?.join(", ")??"**":c;if(!h){this._logService.trace(`[InstructionsContextComputer] No 'applyTo' found: ${s}`);continue}if(e.instructions.has(s)){this._logService.trace(`[InstructionsContextComputer] Skipping already processed instruction file: ${s}`);continue}let g=this._matches(e.files,h);if(g){this._logService.trace(`[InstructionsContextComputer] Match for ${s} with ${g.pattern}${g.file?` for file ${g.file}`:""}`);let f=g.file?d(8285,null,h,this._labelService.getUriLabel(g.file,{relative:!0})):d(8283,null);t.add(WF(s,"vscode.instructions.file.root",f,!0)),o.applyingInstructionsCount++,p&&o.claudeRulesCount++}else this._logService.trace(`[InstructionsContextComputer] No match for ${s} with ${h}`)}}_getContext(i){let e=new En,t=new En;for(let o of i.asArray())if(lD(o))t.add(o.value);else{let n=aD.toUri(o);n&&e.add(n)}return{files:e,instructions:t}}async _addAgentInstructions(i,e,t){let o={logInfo:l=>this._logService.trace(`[InstructionsContextComputer] ${l}`)},n=await this._promptsService.listAgentInstructions(t,o),r=new d4,s=new d4;for(let{uri:l,type:c}of n){let u=WF(l,"vscode.instructions.file.root",void 0,!0);r.add(u),c==="copilotInstructionsMd"&&s.add(u),e.agentInstructionsCount++,c==="claudeMd"&&e.claudeMdCount++,o.logInfo(`Agent instruction file added: ${l.toString()}`)}if(s.length>0){await this._addReferencedInstructions(s,e,t);for(let l of s.asArray())i.add(l)}for(let l of r.asArray())i.add(l)}_matches(i,e){let t=ER(e,","),o=n=>{if(n=n.trim(),n.length!==0){if(n==="**"||n==="**/*"||n==="*")return{pattern:n};!n.startsWith("/")&&!n.startsWith("**/")&&(n="**/"+n);for(let r of i)if(Ed(n,r.path,{ignoreCase:!0}))return{pattern:n,file:r}}};for(let n of t){let r=o(n);if(r)return r}}_getTool(i){if(!this._enabledTools)return;let e=this._languageModelToolsService.getToolByName(i);if(e&&this._enabledTools[e.id])return{tool:e,variable:`#tool:${this._languageModelToolsService.getFullReferenceName(e)}`}}async _getCustomizationsIndex(i,e,t,o){let n=this._getTool("readFile"),r=this._getTool(u4.runSubagent),l=(await this._remoteAgentService.getEnvironment())?.os,c=f=>QZo(f,l),u=[];if(n){let v=this._configurationService.getValue(Ss.USE_NESTED_AGENT_MD)?this._promptsService.listNestedAgentMDs(o):Promise.resolve([]);u.push("<instructions>"),u.push("Here is a list of instruction files that contain rules for working with this codebase."),u.push("These files are important for understanding the codebase structure, conventions, and best practices."),u.push("Please make sure to follow the rules specified in these files when working with the codebase."),u.push(`If the file is not already available as attachment, use the ${n.variable} tool to acquire it.`),u.push("Make sure to acquire the instructions before working with the codebase.");let b=!1;for(let{uri:P}of i){let O=await this._parseInstructionsFile(P,o);if(O){if(u.push("<instruction>"),O.header){let{description:V}=O.header;V&&u.push(`<description>${V}</description>`),u.push(`<file>${c(P)}</file>`);let H=t_i(O.header,DB(P));H&&u.push(`<applyTo>${H}</applyTo>`)}else u.push(`<file>${c(P)}</file>`);u.push("</instruction>"),b=!0}}let S=await v;for(let{uri:P}of S){let O=this._labelService.getUriLabel(ci(P),{relative:!0}),V=O.trim().length===0?d(8282,null):d(8281,null,O);u.push("<instruction>"),u.push(`<description>${V}</description>`),u.push(`<file>${c(P)}</file>`),u.push("</instruction>"),b=!0}b?u.push("</instructions>","",""):u.length=0;let y=await this._promptsService.findAgentSkills(o,this._sessionResource),w=this._configurationService.getValue(BR),k=this._configurationService.getValue(eTe),T=y?.filter(P=>!(P.disableModelInvocation||P.when&&!this._contextKeyService.contextMatchesRules(P.when)||(!w||!k)&&P.uri.path.includes(sLt)));if(T&&T.length>0){this._logSkillLoadedTelemetry(T);let P=this._configurationService.getValue(Ss.USE_SKILL_ADHERENCE_PROMPT);u.push("<skills>"),P?(u.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."),u.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 ${n.variable} to load the relevant skill(s).`),u.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."),u.push("How to determine if a skill applies:"),u.push("1. Review the available skills below and match their descriptions against the user's request"),u.push("2. If any skill's domain overlaps with the task, load that skill immediately"),u.push("3. When multiple skills apply (e.g., a flowchart in documentation), load all relevant skills"),u.push("Examples:"),u.push(`- "Help me write unit tests for this module" -> Load the testing skill via ${n.variable} FIRST, then proceed`),u.push(`- "Optimize this slow function" -> Load the performance-profiling skill via ${n.variable} FIRST, then proceed`),u.push('- "Add a discount code field to checkout" -> Load both the checkout-flow and form-validation skills FIRST'),u.push("Available skills:")):(u.push("Here is a list of skills that contain domain specific knowledge on a variety of topics."),u.push("Each skill comes with a description of the topic and a file path that contains the detailed instructions."),u.push(`When a user asks you to perform a task that falls within the domain of a skill, use the ${n.variable} tool to acquire the full instructions from the file URI.`));for(let O of T)u.push("<skill>"),u.push(`<name>${O.name}</name>`),O.description&&u.push(`<description>${O.description}</description>`),u.push(`<file>${c(O.uri)}</file>`),u.push("</skill>");u.push("</skills>","","")}}if(r&&this._configurationService.getValue("chat.customAgentInSubagent.enabled")){let f=(()=>{if(!this._enabledSubagents||this._enabledSubagents.includes("*"))return b=>b.visibility.agentInvocable;{let b=this._enabledSubagents;return S=>b.includes(S.name)}})(),v=await this._promptsService.getCustomAgents(o,this._sessionResource);if(v.length>0){u.push("<agents>"),u.push("Here is a list of agents that can be used when running a subagent."),u.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."),u.push(`Use the ${r.variable} tool with the agent name to run the subagent.`);for(let b of v)f(b)&&(u.push("<agent>"),u.push(`<name>${b.name}</name>`),b.description&&u.push(`<description>${b.description}</description>`),b.argumentHint&&u.push(`<argumentHint>${b.argumentHint}</argumentHint>`),u.push("</agent>"),_Lt(b.uri)&&t.claudeAgentsCount++);u.push("</agents>","","")}}if(u.length===0)return;let p=u.join(`
`),h=[],g=f=>{if(f){let v=p.indexOf(f.variable);for(;v>=0;)h.push(eue(f.tool,new pi(v,v+f.variable.length))),v=p.indexOf(f.variable,v+1)}};return g(n),g(r),Geo(p,!0,h)}async _addReferencedInstructions(i,e,t){if(!this._configurationService.getValue(Ss.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 n=new En,r=[];for(let l of i.asArray())lD(l)&&(n.has(l.value)||(r.push(l.value),n.add(l.value)));let s=r.pop();for(;s;){let l=await this._parseInstructionsFile(s,t);if(l&&l.body){let c=[];for(let u of l.body.fileReferences){let p=l.body.resolveFilePath(u.content);p&&!n.has(p)&&(Ehi(p)||this._workspaceService.getWorkspaceFolder(p)!==void 0)&&(c.push({resource:p}),n.add(p))}if(c.length>0){let u=await this._fileService.resolveAll(c);for(let p=0;p<u.length;p++){let h=u[p],g=c[p].resource;if(h.success&&h.stat?.isFile){Ehi(g)&&r.push(g);let f=d(8284,null,He(s));i.add(WF(g,"vscode.instructions.file.reference",f,!0)),e.referencedInstructionsCount++,this._logService.trace(`[InstructionsContextComputer] ${g.toString()} added, referenced by ${s.toString()}`)}}}}s=r.pop()}}};Bte=I([m(4,Or),m(5,se),m(6,rt),m(7,B),m(8,X),m(9,Pe),m(10,fe),m(11,bo),m(12,Te),m(13,Vn),m(14,Gg)],Bte);function QZo(a,i){if(a.scheme===Q.file||a.scheme===Q.vscodeRemote){let e=a.fsPath;return i!==void 0?i===1?e.replace(/\//g,"\\"):e.replace(/\\/g,"/"):e}return a.toString()}function t_i(a,i){return i?a?.paths?.join(", ")??"**":a?.applyTo??void 0}var eNe=class extends x{constructor(e,t,o,n){super();this.configurationService=e;this.contextMenuService=t;this.chatSessionsService=o;this.contextKeyService=n;this._onDidChangeHeight=this._register(new E);this.onDidChangeHeight=this._onDidChangeHeight.event;this._onDidSelectPrompt=this._register(new E);this.onDidSelectPrompt=this._onDidSelectPrompt.event;this.buttonDisposables=new Map;this.domNode=this.createSuggestNextWidget()}get height(){return this.domNode.style.display==="none"?0:this.domNode.offsetHeight}getCurrentMode(){return this._currentMode}createSuggestNextWidget(){let e=_(".chat-suggest-next-widget.chat-welcome-view-suggested-prompts");return e.style.display="none",this.titleElement=M(e,_(".chat-welcome-view-suggested-prompts-title")),this.promptsContainer=e,e}render(e){let t=e.handOffs?.get();if(!t||t.length===0){this.hide();return}this._currentMode=e;let o=e.name.get()||e.label.get()||d(7776,null);this.titleElement.textContent=d(7777,null,o);let n=[];for(let c=1;c<this.promptsContainer.children.length;c++)n.push(this.promptsContainer.children[c]);for(let c of n){let u=this.buttonDisposables.get(c);u&&(u.dispose(),this.buttonDisposables.delete(c)),this.promptsContainer.removeChild(c)}let r=this.configurationService.getValue("chat.autopilot.enabled")!==!1,s=this.configurationService.inspect("chat.tools.global.autoApprove").policyValue===!1,l=r&&!s?t.find(c=>c.send):void 0;for(let c of t){let u=this.createPromptButton(c);if(this.promptsContainer.appendChild(u),c===l){let p=this.createAutopilotButton(c);this.promptsContainer.appendChild(p)}}this.domNode.style.display="flex",this._onDidChangeHeight.fire()}createPromptButton(e){let t=new N,o=e.label,n=()=>this._currentMode?.handOffs?.get()?.find(g=>g.label===o)??e,r=_(".chat-welcome-view-suggested-prompt");r.setAttribute("tabindex","0"),r.setAttribute("role","button"),r.setAttribute("aria-label",d(7778,null,e.label));let s=M(r,_(".chat-welcome-view-suggested-prompt-title"));s.textContent=e.label;let l=e.showContinueOn??!0,c=this.contextKeyService.getContextKeyValue(ie.chatSessionType.key),p=this.chatSessionsService.getAllChatSessionContributions().filter(h=>{if(!h.canDelegate||h.type===c)return!1;let g=lg(h.type);return g!==void 0&&tLt(g)});if(l&&p.length>0){r.classList.add("chat-suggest-next-has-dropdown");let h=M(r,_(".chat-suggest-next-dropdown"));h.setAttribute("tabindex","0"),h.setAttribute("role","button"),h.setAttribute("aria-label",d(7779,null,e.label)),h.setAttribute("aria-haspopup","true"),M(h,_(".chat-suggest-next-separator")).setAttribute("aria-hidden","true"),M(h,_(".codicon.codicon-chevron-down.dropdown-chevron")).setAttribute("aria-hidden","true");let v=(b,S)=>{b.preventDefault(),b.stopPropagation();let y=p.map(w=>{let k=lg(w.type),T=lT(k),P=IS(k);return new it(w.type,d(7781,null,P),q.isThemeIcon(T)?q.asClassName(T):void 0,!0,()=>{let O=n();O&&this._onDidSelectPrompt.fire({handoff:O,agentId:w.name})})});this.contextMenuService.showContextMenu({getAnchor:()=>S||h,getActions:()=>y,autoSelectFirstItem:!0})};t.add(j(h,"click",b=>{v(b,h)})),t.add(j(h,"keydown",b=>{(b.key==="Enter"||b.key===" ")&&v(b,h)})),t.add(j(r,"click",b=>{if(Do(b.target)&&b.target.closest(".chat-suggest-next-dropdown"))return;let S=n();S&&this._onDidSelectPrompt.fire({handoff:S})}))}else t.add(j(r,"click",()=>{let h=n();h&&this._onDidSelectPrompt.fire({handoff:h})}));return t.add(j(r,"keydown",h=>{if(h.key==="Enter"||h.key===" "){h.preventDefault();let g=n();g&&this._onDidSelectPrompt.fire({handoff:g})}})),this.buttonDisposables.set(r,t),r}createAutopilotButton(e){let t=new N,o=e.label,n=()=>this._currentMode?.handOffs?.get()?.find(u=>u.label===o)??e,r=d(7780,null),s=_(".chat-welcome-view-suggested-prompt");s.setAttribute("tabindex","0"),s.setAttribute("role","button"),s.setAttribute("aria-label",r);let l=M(s,_(".chat-welcome-view-suggested-prompt-title"));return l.textContent=r,t.add(j(s,"click",()=>{let c=n();c&&this._onDidSelectPrompt.fire({handoff:c,withAutopilot:!0})})),t.add(j(s,"keydown",c=>{if(c.key==="Enter"||c.key===" "){c.preventDefault();let u=n();u&&this._onDidSelectPrompt.fire({handoff:u,withAutopilot:!0})}})),this.buttonDisposables.set(s,t),s}hide(){this.domNode.style.display!=="none"&&(this._currentMode=void 0,this.domNode.style.display="none",this._onDidChangeHeight.fire())}dispose(){for(let e of this.buttonDisposables.values())e.dispose();this.buttonDisposables.clear(),super.dispose()}};eNe=I([m(0,B),m(1,Xe),m(2,Us),m(3,X)],eNe);function rN(a){return(i,e,t)=>new Hit(a,i,e,t)}var Hit=class extends mP{constructor(e,t,o,n){let r=()=>{let c=n.get(e.key,t);if(c!==void 0)try{return e.fromStorage(c)}catch{return e.defaultValue}return e.defaultValue},s=r();super(new Qu(void 0,`storage/${e.key}`,void 0),s,Ff,Rl.ofCaller());this.opts=e;this.storageScope=t;this.storageTarget=o;this.storageService=n;this._store=new N;this._noStorageUpdateNeeded=!1;let l=n.onDidChangeValue(t,e.key,this._store);this._store.add(l(c=>{if(c.external&&c.key===e.key){this._noStorageUpdateNeeded=!0;try{this.set(r(),void 0)}finally{this._noStorageUpdateNeeded=!1}}}))}_setValue(e){if(super._setValue(e),this._noStorageUpdateNeeded)return;let t=this.opts.toStorage(this.get());this.storageService.store(this.opts.key,t,this.storageScope,this.storageTarget)}dispose(){this._store.dispose()}};Hit=I([m(3,ce)],Hit);function Hgo(a,i,e,t,o){return i&&i!=="local"&&q1t(a,i)?a.filter(n=>n.metadata?.targetChatSessionType===i&&n.metadata?.isUserSelectable):a.filter(n=>!n.metadata?.targetChatSessionType&&n.metadata?.isUserSelectable&&i_i(n,e)&&o_i(n,t,o))}function i_i(a,i){return i==="agent"?nD.suitableForAgentMode(a.metadata):!0}function o_i(a,i,e){return i!=="editor"||!e?!0:!!a.metadata.capabilities?.toolCalling}function q1t(a,i){return i?a.some(e=>e.metadata.targetChatSessionType===i):!1}function $1t(a,i,e){return q1t(i,e)?a.metadata.targetChatSessionType===e:!a.metadata.targetChatSessionType}function Ugo(a,i){return a.find(e=>e.metadata.isDefaultForLocation[i])||a[0]}function n_i(a,i,e,t){let o=e.find(n=>n.identifier===a);return o?!i||o.metadata.isDefaultForLocation[t]?{shouldRestore:!0,model:o}:{shouldRestore:!1,model:o}:{shouldRestore:!1,model:void 0}}function zgo(a,i,e,t){return!a||!i.some(o=>o.identifier===a.identifier)||!i_i(a,e.currentModeKind)||!o_i(a,e.location,e.isInlineChatV2Enabled)||!$1t(a,t,e.sessionType)}function Kgo(a,i,e,t,o){if(i&&i.identifier===a.identifier)return{action:"keep"};if(!$1t(a,e,t))return{action:"default"};if(o){if(!i_i(a,o.currentModeKind))return{action:"default"};if(!o_i(a,o.location,o.isInlineChatV2Enabled))return{action:"default"}}return{action:"apply"}}function Ggo(a,i,e){if(a.length>0){let t=new Set(a.map(o=>o.metadata.vendor));return[...a,...i.filter(o=>!t.has(o.metadata.vendor)&&e.has(o.metadata.vendor))]}return i}function qgo(a,i){return a?!i.some(e=>e.identifier===a):!0}function $go(a,i,e,t){return e.metadata.isUserSelectable?n_i(a,i,[e],t).shouldRestore:!1}function Bhe(a){return!!a&&A.isUri(a.sessionResource)&&a.$mid===19}var sN=class extends K{constructor(i){super({category:Si,...i})}run(i,...e){let t=zhe(i,e);if(!(!t||!t.editingSession))return this.runEditingSessionAction(i,t.editingSession,t.chatWidget,...e)}};function zhe(a,i){let e=i.at(0),t=Bhe(e)?e:void 0,o=a.get(Pt),n=a.get(ud),r=t?o.getWidgetBySessionResource(t.sessionResource):void 0;return r||(r=o.lastFocusedWidget??o.getWidgetsByLocations("panel").find(l=>l.supportsChangingModes)),r?.viewModel?{editingSession:n.getEditingSession(r.viewModel.model.sessionResource),chatWidget:r}:void 0}var Uit=class extends sN{runEditingSessionAction(i,e,t,...o){let n=[];if(A.isUri(o[0])?n.push(o[0]):t&&n.push(...t.input.selectedElements),!!n.length)return this.runWorkingSetAction(i,e,t,...n)}};W(class extends Uit{constructor(){super({id:"chatEditing.openFileInDiff",title:L(6934,"Open Changes in Diff Editor"),icon:R.diffSingle,menu:[{id:D.ChatEditingWidgetModifiedFilesToolbar,when:C.equals(jK.key,0),order:2,group:"navigation"}]})}async runWorkingSetAction(i,e,t,...o){let n=i.get(ee);for(let r of o){let s=n.activeEditorPane;if(s||(s=await n.openEditor({resource:r})),!s)return;e.getEntry(r)?.getEditorIntegration(s).toggleDiff(void 0,!0)}}});W(class extends Uit{constructor(){super({id:"chatEditing.acceptFile",title:L(6900,"Keep"),icon:R.check,menu:[{when:C.and(C.equals("resourceScheme",$K),C.notIn(DTe.key,R9e.key)),id:D.MultiDiffEditorFileToolbar,order:0,group:"navigation"},{id:D.ChatEditingWidgetModifiedFilesToolbar,when:C.equals(jK.key,0),order:0,group:"navigation"}]})}async runWorkingSetAction(i,e,t,...o){await e.accept(...o)}});W(class extends Uit{constructor(){super({id:"chatEditing.discardFile",title:L(6931,"Undo"),icon:R.discard,menu:[{when:C.and(C.equals("resourceScheme",$K),C.notIn(DTe.key,R9e.key)),id:D.MultiDiffEditorFileToolbar,order:2,group:"navigation"},{id:D.ChatEditingWidgetModifiedFilesToolbar,when:C.equals(jK.key,0),order:1,group:"navigation"}]})}async runWorkingSetAction(i,e,t,...o){await e.reject(...o)}});var r_i=class extends sN{constructor(){super({id:"chatEditing.acceptAllFiles",title:d(6899,null),icon:R.check,tooltip:d(6901,null),precondition:mD,keybinding:{primary:2051,when:C.and(mD,ie.inChatInput),weight:200},menu:[{id:D.ChatEditingWidgetToolbar,group:"navigation",order:0,when:C.and(S4.negate(),C.and(mD))}]})}async runEditingSessionAction(i,e,t,...o){await e.accept()}};W(r_i);var s_i=class extends sN{constructor(){super({id:"chatEditing.discardAllFiles",title:d(6930,null),icon:R.discard,tooltip:d(6932,null),precondition:mD,menu:[{id:D.ChatEditingWidgetToolbar,group:"navigation",order:1,when:C.and(S4.negate(),mD)}],keybinding:{when:C.and(mD,ie.inChatInput,ie.inputHasText.negate()),weight:200,primary:2049}})}async runEditingSessionAction(i,e,t,...o){await YZo(i,e)}};W(s_i);var a_i=class a extends sN{static{this.ID="chatEditing.toggleExplanationWidget"}constructor(){super({id:a.ID,title:d(6933,null),tooltip:d(6935,null),precondition:mD,menu:[{id:D.ChatEditingWidgetToolbar,group:"navigation",order:2,when:C.and(mD,C.has("config.chat.editing.explainChanges.enabled"))}]})}async runEditingSessionAction(i,e,t,...o){e.hasExplanations()?e.clearExplanations():await e.triggerExplanationGeneration()}};W(a_i);async function YZo(a,i){let e=a.get(at),t=i.entries.get().filter(o=>o.state.get()===0);return t.length>0&&!(await e.confirm({title:d(6906,null),message:t.length===1?d(6904,null,He(t[0].modifiedURI)):d(6903,null,t.length),primaryButton:d(6905,null),type:"info"})).confirmed?!1:(await i.reject(),!0)}var Hhe=class a extends sN{static{this.ID="chatEditing.viewChanges"}static{this.LABEL=d(6928,null)}constructor(){super({id:a.ID,title:{value:a.LABEL,original:a.LABEL},tooltip:a.LABEL,f1:!0,icon:R.diffMultiple,precondition:mD,menu:[{id:D.ChatEditingWidgetToolbar,group:"navigation",order:4,when:C.and(S4.negate(),C.and(M9e,mD))}]})}async runEditingSessionAction(i,e,t,...o){await e.show()}};W(Hhe);var zit=class a extends K{static{this.ID="chatEditing.viewAllSessionChanges"}constructor(){super({id:a.ID,title:L(6927,"View All Changes"),icon:R.diffMultiple,category:Si,precondition:ie.hasAgentSessionChanges,menu:[{id:D.ChatEditingSessionChangesToolbar,group:"navigation",order:10}]})}async run(i,e){let t=i.get(md),o=i.get(ge),n=i.get(ud);if(!A.isUri(e)&&!d0(e))return;let r=A.isUri(e)?e:e.resource,s=t.getSession(r),l=s?.changes;if(!s||!l)return;if(s.providerType==="copilotcli"||s.providerType==="copilot-cloud-agent"){if(!Array.isArray(l)||l.length===0)return;let u=l.map(p=>({originalUri:p.originalUri,modifiedUri:p.modifiedUri}));await o.executeCommand("_workbench.openMultiDiffEditor",{multiDiffSourceUri:r.with({scheme:r.scheme+"-worktree-changes"}),title:d(6925,null),resources:u}),s?.setRead(!0);return}await n.getEditingSession(r)?.show(),s?.setRead(!0)}};W(zit);function jgo(a){return a?.length?a.filter(i=>!aLt(i)&&!tTe(i)&&!LK(i)&&!(lD(i)&&i.automaticallyAdded)&&!(RK(i)&&i.automaticallyAdded)):[]}async function Qgo(a,i,e){let t=a.get(B),o=a.get(at),r=a.get(Pt).getWidgetBySessionResource(i),l=a.get(mi).getSession(i);if(!l)return!1;let c=l.editingSession;if(!c)return!1;let u=l.getRequests(),p=u.findIndex(k=>k.id===e);if(p===-1)return!1;let h=u.length-p,g=u.slice(p),f=new Set(g.map(k=>k.id)),v=c.entries.get().filter(k=>f.has(k.lastModifyingRequestId))??[],b=v.length>0&&t.getValue("chat.editing.confirmEditRequestRemoval")===!0,S;h===1?v.length===1?S=d(6915,null,He(v[0].modifiedURI)):S=d(6916,null,v.length):v.length===1?S=d(6911,null,He(v[0].modifiedURI)):S=d(6912,null,v.length);let y=b?await o.confirm({title:h===1?d(6917,null):d(6914,null,h),message:S,primaryButton:d(6913,null),checkbox:{label:d(6910,null),checked:!1},type:"info"}):{confirmed:!0};if(!y.confirmed)return r?.viewModel?.model.setCheckpoint(void 0),!1;y.checkboxChecked&&await t.updateValue("chat.editing.confirmEditRequestRemoval",!1);let w=u[p].id;return await c.restoreSnapshot(w,void 0),!0}async function l_i(a,i){let e=Sr(i)?i.id:Ui(i)?i.requestId:void 0;return e?Qgo(a,i.sessionResource,e):!1}W(class extends K{constructor(){super({id:"workbench.action.chat.undoEdits",title:L(6924,"Undo Requests"),f1:!1,category:Si,icon:R.discard,keybinding:{primary:20,mac:{primary:2049},when:C.and(ie.inChatSession,pe.textInputFocus.negate(),ie.inChatQuestionCarousel.negate()),weight:200},menu:[{id:D.ChatMessageTitle,group:"navigation",order:2,when:C.and(C.equals("config.chat.editRequests","input").negate(),C.equals("config.chat.checkpoints.enabled",!1),ie.lockedToCodingAgent.negate())}]})}async run(i,...e){let t=e[0],o=i.get(Pt),n=i.get(B),r=Lk(t)&&o.getWidgetBySessionResource(t.sessionResource)||o.lastFocusedWidget;if(!Ui(t)&&!Sr(t)&&(t=r?.getFocus()),!t)return;if(await l_i(i,t)&&Sr(t)&&n.getValue("chat.undoRequests.restoreInput")){r?.focusInput(),r?.input.setValue(t.messageText,!1);let l=jgo(t.attachedContext);l.length&&await r?.input.restoreAttachments(l)}}});W(class extends K{constructor(){super({id:"workbench.action.chat.restoreCheckpoint",title:L(6918,"Restore Checkpoint"),tooltip:L(6920,"Restores workspace and chat to this point"),f1:!1,category:Si,keybinding:{primary:20,mac:{primary:2049},when:C.and(ie.inChatSession,pe.textInputFocus.negate(),ie.inChatQuestionCarousel.negate()),weight:200},menu:[{id:D.ChatMessageCheckpoint,group:"navigation",order:2,when:C.and(ie.isRequest,ie.lockedToCodingAgent.negate(),ie.isFirstRequest.negate())}]})}async run(i,...e){let t=e[0],o=i.get(Pt),n=Lk(t)&&o.getWidgetBySessionResource(t.sessionResource)||o.lastFocusedWidget;if(!Ui(t)&&!Sr(t)&&(t=n?.getFocus()),!t)return;let r=Sr(t)?jgo(t.attachedContext):[];Sr(t)&&(n?.focusInput(),n?.input.setValue(t.messageText,!1)),n?.viewModel?.model.setCheckpoint(t.id),await l_i(i,t)&&r.length&&await n?.input.restoreAttachments(r)}});W(class extends K{constructor(){super({id:"workbench.action.chat.startOver",title:L(6922,"Start Over"),tooltip:L(6923,"Clears the chat and undoes all changes"),f1:!1,category:Si,menu:[{id:D.ChatMessageCheckpoint,group:"navigation",order:2,when:C.and(ie.isRequest,ie.lockedToCodingAgent.negate(),ie.isFirstRequest)}]})}async run(i,...e){let t=e[0],o=i.get(Pt),n=Lk(t)&&o.getWidgetBySessionResource(t.sessionResource)||o.lastFocusedWidget;!Ui(t)&&!Sr(t)&&(t=n?.getFocus()),t&&(n?.viewModel?.model.setCheckpoint(t.id),await l_i(i,t))}});W(class extends K{constructor(){super({id:"workbench.action.chat.restoreLastCheckpoint",title:L(6921,"Restore to Last Checkpoint"),f1:!0,category:Si,icon:R.discard,precondition:C.and(ie.inChatSession,C.equals("config.chat.checkpoints.enabled",!0),ie.lockedToCodingAgent.negate())})}async run(i,...e){let t=e[0],o=i.get(Pt),n=i.get(mi),r=Lk(t)&&o.getWidgetBySessionResource(t.sessionResource)||o.lastFocusedWidget;!Ui(t)&&!Sr(t)&&(t=r?.getFocus());let s=r?.viewModel?.sessionResource??(Lk(t)?t.sessionResource:void 0);if(!s)return;let l=n.getSession(s);if(!l?.editingSession)return;let c=l.checkpoint;if(!c){en(d(6919,null));return}r?.viewModel?.model.setCheckpoint(c.id),r?.focusInput(),r?.input.setValue(c.message.text,!1),await Qgo(i,s,c.id)}});W(class extends K{constructor(){super({id:"workbench.action.chat.editRequests",title:L(6907,"Edit Request"),f1:!1,category:Si,icon:R.edit,keybinding:{primary:3,when:C.and(ie.inChatSession,pe.textInputFocus.negate()),weight:200},menu:[{id:D.ChatMessageTitle,group:"navigation",order:2,when:C.and(C.or(C.equals("config.chat.editRequests","hover"),C.equals("config.chat.editRequests","input")))}]})}async run(i,...e){let t=e[0],o=i.get(Pt),n=Lk(t)&&o.getWidgetBySessionResource(t.sessionResource)||o.lastFocusedWidget;!Ui(t)&&!Sr(t)&&(t=n?.getFocus()),t&&Sr(t)&&n?.startEditing(t.id)}});W(class Ygo extends K{static{this.id="chat.openFileUpdatedBySnapshot"}constructor(){super({id:Ygo.id,title:d(6908,null),menu:[{id:D.ChatEditingCodeBlockContext,group:"navigation",order:0}]})}async run(i,...e){let t=e[0];if(!t?.sessionResource)return;await i.get(ee).openEditor({resource:t.uri})}});W(class Xgo extends K{static{this.id="chat.openFileSnapshot"}constructor(){super({id:Xgo.id,title:d(6909,null),menu:[{id:D.ChatEditingCodeBlockContext,group:"navigation",order:1}]})}async run(i,...e){let t=e[0];if(!t?.sessionResource)return;let o=i.get(mi),n=i.get(ud),r=i.get(ee),s=o.getSession(t.sessionResource);if(!s)return;let l=n.getEditingSession(s.sessionResource)?.getSnapshotUri(t.requestId,t.uri,t.stopId);if(l){let c=await r.openEditor({resource:l,label:d(6926,null,He(t.uri)),options:{activation:1}});pn(c)&&c.updateOptions({readOnly:!0})}}});W(class extends sN{constructor(){super({id:"workbench.action.edits.addFilesFromReferences",title:L(6902,"Add Files From References"),f1:!1,category:Si,menu:{id:D.ChatInputSymbolAttachmentContext,group:"navigation",order:1,when:C.and(ie.chatModeKind.isEqualTo("ask"),pe.hasReferenceProvider)}})}async runEditingSessionAction(i,e,t,...o){if(o.length===0||!lf(o[0]))return;let n=i.get(Bt),r=i.get(Qt),s=o[0],l=await n.createModelReference(s.uri);try{let c=l.object.textEditorModel;if(!c)return;let u=new ye(s.range.startLineNumber,s.range.startColumn),[p,h,g]=await Promise.all([this.getReferences(u,c,r),this.getDefinitions(u,c,r),this.getImplementations(u,c,r)]),f=[];for(let v of[...h,...g,...p])f.push(t.attachmentModel.asFileVariableEntry(v.uri));t.attachmentModel.addContext(...f)}finally{l.dispose()}}async getReferences(i,e,t){let o=t.referenceProvider.all(e);return(await Promise.all(o.map(async r=>await r.provideReferences(e,i,{includeDeclaration:!0},Se.None)??[]))).flat()}async getDefinitions(i,e,t){let o=t.definitionProvider.all(e);return(await Promise.all(o.map(async r=>await r.provideDefinition(e,i,Se.None)??[]))).flat()}async getImplementations(i,e,t){let o=t.implementationProvider.all(e);return(await Promise.all(o.map(async r=>await r.provideImplementation(e,i,Se.None)??[]))).flat()}});var Uhe=class a extends sN{static{this.Id="chatEditing.viewPreviousEdits"}static{this.Label=d(6929,null)}constructor(){super({id:a.Id,title:{value:a.Label,original:a.Label},tooltip:a.Label,f1:!0,icon:R.diffMultiple,precondition:C.and(ie.enabled,mD.negate()),menu:[{id:D.ChatEditingWidgetToolbar,group:"navigation",order:4,when:C.and(S4.negate(),C.and(M9e,mD.negate()))}]})}async runEditingSessionAction(i,e,t,...o){await e.show(!0)}};W(Uhe);$e.registerCommand("_chat.editSessions.accept",async(a,i)=>{if(i.length===0)return;let e=i.map(o=>A.revive(o)),t=a.get(ud);for(let o of t.editingSessionsObs.get())await o.accept(...e)});var tNe=class extends M4e{constructor(e,t,o,n,r){super(e,t);this._options=t;this.actionWidgetService=o;this.keybindingService=n;this.telemetryService=r;this._enabled=!0}show(){if(!this._enabled)return;let e=this._options.actionBarActions??this._options.actionBarActionProvider?.getActions()??[],t=this._options.actions??this._options.actionProvider?.getActions()??[],o=t.find(g=>g.checked),n=o,r=[],s=new Map;for(let g of t){let f=g.category;f||(f={label:"",order:Number.MIN_SAFE_INTEGER}),s.has(f.label)||s.set(f.label,[]),s.get(f.label).push(g)}let l=Array.from(s.entries()).sort((g,f)=>{let v=g[1][0]?.category?.order??Number.MAX_SAFE_INTEGER,b=f[1][0]?.category?.order??Number.MAX_SAFE_INTEGER;return v-b});for(let g=0;g<l.length;g++){let[f,v]=l[g];(v[0]?.category?.showHeader??!1)&&f&&r.push({kind:"header",label:f,canPreview:!1,disabled:!1,hideIcon:!1});for(let S of v)r.push({item:S,tooltip:S.tooltip,description:S.description,hover:S.hover,toolbarActions:S.toolbarActions,kind:"action",canPreview:!1,group:{title:"",icon:S.icon??q.fromId(S.checked?R.check.id:R.blank.id)},disabled:!S.enabled,hideIcon:!1,label:S.label,keybinding:this._options.showItemKeybindings?this.keybindingService.lookupKeybinding(S.id):void 0});g<l.length-1&&r.push({label:"",kind:"separator",canPreview:!1,disabled:!1,hideIcon:!1})}let c=Nn(),u=new Set(e.map(g=>g.id)),p={onSelect:(g,f)=>{u.has(g.id)||(n=g),this.actionWidgetService.hide(),g.run()},onHide:()=>{this.hide(),Do(c)&&c.focus(),this._emitCloseEvent(o,n)}};if(e.length){r.length&&r.push({label:"",kind:"separator",canPreview:!1,disabled:!1,hideIcon:!1});for(let g of e)r.push({item:g,tooltip:g.tooltip,kind:"action",canPreview:!1,group:{title:"",icon:q.fromId(R.blank.id)},disabled:!g.enabled,hideIcon:!1,label:g.label})}let h={isChecked(g){return g.kind==="action"&&!!g?.item?.checked},getRole:g=>{switch(g.kind){case"action":return g.item&&u.has(g.item.id)?"menuitem":"menuitemcheckbox";case"separator":return"separator";default:return"separator"}},getWidgetRole:()=>"menu"};super.show(),this.actionWidgetService.show(this._options.label??"",!1,r,p,this._options.getAnchor?.()??this.element,void 0,[],h,this._options.listOptions)}setEnabled(e){this._enabled=e}_emitCloseEvent(e,t){let o=e,n=t;this._options.reporter&&this.telemetryService.publicLog2("actionWidgetDropdownClosed",{id:this._options.reporter.id,name:this._options.reporter.name,selectionChanged:o?.id!==n?.id,optionIdBefore:this._options.reporter.includeOptions?o?.id:void 0,optionIdAfter:this._options.reporter.includeOptions?n?.id:void 0,optionLabelBefore:this._options.reporter.includeOptions?o?.label:void 0,optionLabelAfter:this._options.reporter.includeOptions?n?.label:void 0})}};tNe=I([m(2,td),m(3,_e),m(4,Te)],tNe);var aW=class extends wl{constructor(e,t,o,n,r,s){super(void 0,e);this.actionWidgetOptions=t;this._actionWidgetService=o;this._keybindingService=n;this._contextKeyService=r;this._telemetryService=s;this.actionItem=null}render(e){this.actionItem=e;let t=o=>(this.element=M(o,_("a.action-label")),this.renderLabel(this.element));this.actionWidgetDropdown=this._register(new tNe(e,{...this.actionWidgetOptions,labelRenderer:t},this._actionWidgetService,this._keybindingService,this._telemetryService)),this._register(this.actionWidgetDropdown.onDidChangeVisibility(o=>{this.element?.setAttribute("aria-expanded",`${o}`)})),this.updateTooltip(),this.updateEnabled()}renderLabel(e){return e.classList.add("codicon"),this._action.label&&this._register(Up().setupManagedHover(this.options.hoverDelegate??Ri("mouse"),e,this._action.label)),null}updateAriaLabel(){this.element&&this.setAriaLabelAttributes(this.element)}setAriaLabelAttributes(e){e.setAttribute("role","button"),e.setAttribute("aria-haspopup","true"),e.setAttribute("aria-expanded","false"),e.ariaLabel=this.getTooltip()+" - "+(e.textContent||this._action.label)||""}getTooltip(){let e=this.action.tooltip??this.action.label;return this._keybindingService.appendKeybinding(e,this.action.id,this._contextKeyService)}show(){this.actionWidgetDropdown?.show()}updateEnabled(){let e=!this.action.enabled;this.actionItem?.classList.toggle("disabled",e),this.element?.classList.toggle("disabled",e),this.actionWidgetDropdown?.setEnabled(!e)}};aW=I([m(2,td),m(3,_e),m(4,X),m(5,Te)],aW);function Q1t(a){let i=a.match(/(?:github\.com)[/:](?<owner>[^/]+)\/(?<repo>[^/.]+)/);if(i?.groups)return`${i.groups.owner}/${i.groups.repo}`}async function Jgo(a,i){try{let e=`${a}/.git`,t=A.file(e),o;try{if((await i.stat(t)).isDirectory)o=A.file(`${e}/config`);else{let u=(await i.readFile(t)).value.toString().trim().replace(/^gitdir:\s*/,""),h=(u.startsWith("/")?u:`${a}/${u}`).replace(/\/worktrees\/[^/]+$/,"");o=A.file(`${h}/config`)}}catch{return}let s=(await i.readFile(o)).value.toString().match(/\[remote\s+"origin"\][^[]*url\s*=\s*(.+)/m);if(s?.[1])return Q1t(s[1].trim())}catch{}}var c_i=class a extends K{static{this.ID="workbench.action.chat.continueChatInSession"}constructor(){super({id:a.ID,title:L(5800,"Continue Chat in..."),tooltip:d(5801,null),precondition:C.and(ie.enabled,ie.requestInProgress.negate(),ie.remoteJobCreating.negate(),ie.hasCanDelegateProviders),menu:[{id:D.ChatExecute,group:"navigation",order:3.4,when:C.and(ie.lockedToCodingAgent.negate(),ie.hasCanDelegateProviders)},{id:D.EditorContent,group:"continueIn",when:C.and(C.equals(Wo.Scheme.key,Q.untitled),C.equals(Wo.LangId.key,cT),C.notEquals(jK.key,0),Kg.negate(),ie.hasCanDelegateProviders)}]})}async run(){}},Hte=class extends aW{constructor(e,t,o,n,r,s,l,c,u){super(e,{actionProvider:Hte.actionProvider(s,l,t),actionBarActions:Hte.getActionBarActions(c),reporter:{id:"ChatContinueInSession",name:"ChatContinueInSession",includeOptions:!0}},o,r,n,u);this.location=t;this.contextKeyService=n}static getActionBarActions(e){let t="https://aka.ms/vscode-continue-chat-in";return[{id:"workbench.action.chat.continueChatInSession.learnMore",label:d(5799,null),tooltip:d(5799,null),class:void 0,enabled:!0,run:async()=>{await e.open(A.parse(t))}}]}static actionProvider(e,t,o){return{getActions:()=>{let n=[],r=e.getAllChatSessionContributions(),s=r.find(c=>c.type==="copilotcli");s&&s.canDelegate&&n.push(this.toAction("copilotcli",s,t,o));let l=r.find(c=>c.type==="copilot-cloud-agent");return l&&l.canDelegate&&n.push(this.toAction("copilot-cloud-agent",l,t,o)),n.length===0&&(n.push(this.toSetupAction("copilotcli",t)),n.push(this.toSetupAction("copilot-cloud-agent",t))),n}}}static toAction(e,t,o,n){return{id:t.type,enabled:!0,icon:lT(e),class:void 0,description:`@${t.name}`,label:IS(e),tooltip:d(5804,null,IS(e)),category:{label:d(5802,null),order:0,showHeader:!0},run:()=>o.invokeFunction(r=>n==="editor"?new u_i().run(r,t):new Kit().run(r,t))}}static toSetupAction(e,t){return{id:e,enabled:!0,icon:lT(e),class:void 0,label:IS(e),tooltip:d(5804,null,IS(e)),category:{label:d(5802,null),order:0,showHeader:!0},run:()=>t.invokeFunction(o=>o.get(ge).executeCommand(Ab))}}renderLabel(e){if(this.location==="editor"){let t=ct("span.action-widget-delegate-label",[ct("span",{className:q.asClassName(R.forward)}),ct("span",[d(5803,null)])]);return e.appendChild(t.root),null}else{let t=this.contextKeyService.contextMatchesRules(ie.remoteJobCreating)?R.sync:R.forward;return e.classList.add(...q.asClassNameArray(t)),super.renderLabel(e)}}};Hte=I([m(2,td),m(3,X),m(4,_e),m(5,Us),m(6,F),m(7,Je),m(8,Te)],Hte);var d_i="workbench.action.chat.openNewSessionEditor",Kit=class{constructor(){}openUntitledEditor(i,e){i.executeCommand(`${d_i}.${e.type}`)}async extractRepoNwoFromSession(i,e,t,o,n){let r=n.repoData;if(r?.remoteUrl){let l=Q1t(r.remoteUrl);if(l)return l}let s=i.getSession(o);if(s?.metadata){let l=s.metadata,c=l.owner,u=l.name;if(c&&u)return`${c}/${u}`;let p=l.repositoryNwo;if(p?.includes("/"))return p;let h=l.repositoryUrl;if(h){let f=Q1t(h);if(f)return f}let g=l.workingDirectoryPath??l.repositoryPath??l.worktreePath;if(g){let f=await Jgo(g,t);if(f)return f}}for(let l of["repositories","repository"]){let c=e.getSessionOption(o,l);if(c){let u=typeof c=="string"?c:c.id;if(u){if(u.split("/").filter(Boolean).length===2)return u;let h=Q1t(u);if(h)return h;try{let g=A.parse(u);if(g.authority==="github"){let f=g.path.split("/").filter(Boolean);if(f.length>=2)return`${f[0]}/${f[1]}`}}catch{}if(Zl(u)){let g=await Jgo(u,t);if(g)return g}}}}}async run(i,e,t){let o=i.get(X),n=i.get(ge),r=i.get(Pt),s=i.get(cr),l=i.get(mi),c=i.get(ee),u=i.get(md),p=i.get(Us),h=i.get(fe),g=ie.remoteJobCreating.bindTo(o);try{g.set(!0);let f=t??r.lastFocusedWidget;if(!f||!f.viewModel)return this.openUntitledEditor(n,e);let v=f.viewModel.model;if(!v)return;let b=f.viewModel.sessionResource,S=v.getRequests(),y=f.getInput();if(!y){if(!S.length)return this.openUntitledEditor(n,e);y="implement this."}let w=f.input.getAttachedAndImplicitContext();if(f.input.acceptInput(!0),f.location==="editor"){let ae=c.activeTextEditorControl;if(ae){let he=ae.getModel(),oe;he&&d7(he)&&(oe=he.uri);let de=ae.getSelection();oe&&de&&w.add({kind:"file",id:"vscode.implicit.selection",name:He(oe),value:{uri:oe,range:de}})}}let k=e.type,T=wb.getValue(o),P=lg(b);if(T&&P&&P!==k){let he=py(f.viewContext)?`workbench.action.chat.openNewSessionSidebar.${k}`:`${d_i}.${k}`,oe=2e4,de=S.map(De=>{let Oe=`User: ${De.message.text}`,pt=De.response?.response?`Assistant: ${De.response.response.getMarkdown()}`:"";return pt?`${Oe}
${pt}`:Oe}).join(`

`);de.length>oe&&(de=de.substring(de.length-oe));let Ce=de?`The following is the conversation history from a previous ${IS(P)} session. Continue working on it.

${de}

User: ${y}`:y,xe=[],ze=await this.extractRepoNwoFromSession(u,p,h,b,v);ze&&xe.push({optionId:"repositories",value:ze}),await n.executeCommand(he,{prompt:Ce,attachedContext:w.asArray(),initialSessionOptions:xe.length>0?xe:void 0});return}let O=s.getDefaultAgent("panel"),G=i.get(F).createInstance(uT).parseChatRequestWithReferences(HF(f),MK(f),y,"panel"),$=v.addRequest(G,{variables:w.asArray()},0,void 0,O);await l.removeRequest(b,$.id);let J=await l.sendRequest(b,y,{agentIdSilent:k,attachedContext:w.asArray(),userSelectedModelId:f.input.currentLanguageModel,...f.getModeRequestOptions()});p4.isSent(J)&&await f.handleDelegationExitIfNeeded(O,J.data.agent)}catch(f){throw console.error("[Delegation] Error creating remote coding agent job",f),f}finally{g.set(!1)}}},u_i=class{constructor(){}async run(i,e){try{let o=i.get(ee).activeTextEditorControl,n=i.get(ge);if(!o)return;let r=o.getModel();if(!r||!d7(r))return;let s=r.uri,l=[WF(s,"vscode.prompt.file",void 0,!1,[])],c=`Follow instructions in [${He(s)}](${s.toString()}).`;await n.executeCommand(`${d_i}.${e.type}`,{prompt:c,attachedContext:l})}catch(t){throw console.error("Error creating remote agent job from editor",t),t}}},j1t=class extends x{static{this.ID="chat.continueChatInSessionActionRendering"}constructor(i,e){super();let t=i.register(D.EditorContent,c_i.ID,(o,n,r)=>{if(o instanceof Lo)return e.createInstance(Hte,o,"editor")});im(t)}};j1t=I([m(0,Zx),m(1,F)],j1t);var Y1t=class extends K{async run(i,...e){let t=e[0],o=i.get(Te),n=i.get(Pt),r=t?.widget??n.lastFocusedWidget,s=r?.input.pendingDelegationTarget;if(s&&s!=="local")return await this.handleDelegation(i,r,s);if(r?.viewModel?.editing){let l=i.get(B),c=i.get(at),p=i.get(mi).getSession(r.viewModel.sessionResource);if(!p)return;let h=p.editingSession;if(!h)return;let g=r.viewModel?.editing.id;if(g){let f=p.getRequests(),v=f.findIndex(V=>V.id===g),b=f.length-v,S=f.slice(v),y=new Set(S.map(V=>V.id)),w=h.entries.get().filter(V=>y.has(V.lastModifyingRequestId))??[],k=w.length>0&&l.getValue("chat.editing.confirmEditRequestRemoval")===!0,T;b===1?w.length===1?T=d(5823,null,He(w[0].modifiedURI)):T=d(5824,null,w.length):w.length===1?T=d(5819,null,He(w[0].modifiedURI)):T=d(5820,null,w.length);let P=k?await c.confirm({title:b===1?d(5825,null):d(5822,null,b),message:T,primaryButton:d(5821,null),checkbox:{label:d(5818,null),checked:!1},type:"info"}):{confirmed:!0};if(P.confirmed)b>0&&o.publicLog2("chat.undoEditsConfirmation",{editRequestType:l.getValue("chat.editRequests"),outcome:"applied",editsUndoCount:b});else{o.publicLog2("chat.undoEditsConfirmation",{editRequestType:l.getValue("chat.editRequests"),outcome:"cancelled",editsUndoCount:b});return}P.checkboxChecked&&await l.updateValue("chat.editing.confirmEditRequestRemoval",!1);let O=f[v].id;await h.restoreSnapshot(O,void 0)}}else r?.viewModel?.model.checkpoint&&r.viewModel.model.setCheckpoint(void 0);r?.acceptInput(t?.inputValue)}async handleDelegation(i,e,t){let r=i.get(Us).getAllChatSessionContributions().find(s=>lg(s.type)===t);if(!r)throw new Error(`No contribution found for delegation target: ${t}`);if(r.canDelegate===!1)throw new Error(`The contribution for delegation target: ${t} does not support delegation.`);return new Kit().run(i,r,e)}},XZo=C.or(ie.requestInProgress,ie.Editing.hasToolConfirmation,ie.Editing.hasQuestionCarousel),JZo=C.and(ie.requestInProgress,ie.inputHasText.negate()),ZZo=C.or(ie.Editing.hasToolConfirmation,C.and(ie.Editing.hasQuestionCarousel,ie.inputHasText.negate())),Zgo=C.or(ie.Editing.hasQuestionCarousel.negate(),ie.inputHasText),iNe=ie.requestInProgress.negate(),BT=class a extends Y1t{static{this.ID="workbench.action.chat.submit"}constructor(){let i=ie.chatModeKind.isEqualTo("ask"),e=C.and(ie.inputHasText,iNe,ie.chatSessionOptionsValid);super({id:a.ID,title:L(5838,"Send"),f1:!1,category:Si,icon:R.arrowUp,precondition:e,toggled:{condition:ie.lockedToCodingAgent,icon:R.arrowUp,tooltip:d(5843,null)},keybinding:{when:C.and(ie.inChatInput,ie.withinEditSessionDiff.negate()),primary:3,weight:100},menu:[{id:D.ChatExecute,order:4,when:C.and(iNe,i,ie.withinEditSessionDiff.negate(),Zgo),group:"navigation",alt:{id:"workbench.action.chat.sendToNewChat",title:L(5817,"Send to New Chat"),icon:R.plus}},{id:D.ChatEditorInlineExecute,group:"navigation",order:4,when:C.and(C.or(Kg.negate(),ie.inputHasText),iNe,ie.requestInProgress.negate(),i)}]})}},w_i="workbench.action.chat.toggleAgentMode",p_i=class a extends K{static{this.ID=w_i}constructor(){super({id:a.ID,title:L(5841,"Switch to Next Agent"),f1:!0,category:Si,precondition:C.and(ie.enabled,ie.requestInProgress.negate())})}async run(i,...e){let t=i.get(ge),o=i.get(F),n=i.get(Fg),r=i.get(Te),s=i.get(Pt),l=e.at(0),c;if(l?.sessionResource?c=s.getWidgetBySessionResource(l.sessionResource):c=zhe(i,e)?.chatWidget,!c)return;let p=c.viewModel?.model?.getRequests().length??0,h=(l&&(n.findModeById(l.modeId)||n.findModeByName(l.modeId)))??this.getNextMode(c,p,n),g=c.input.currentModeObs.get();if(h.id===g.id)return;let f=await o.invokeFunction(EXe,c.input.currentModeKind,h.kind,p,c.viewModel?.model);if(!f)return;let v=h.source?.storage??"builtin",b=h.source?.storage==="extension"?h.source.extensionId.value:void 0,S=h.customTools?.get()?.length??0,y=h.handOffs?.get()?.length??0,w=h.uri?.get(),k=w?_Lt(w):void 0;r.publicLog2("chat.modeChange",{fromMode:d3(g),mode:d3(h),requestCount:p,storage:v,extensionId:b,toolsCount:S,handoffsCount:y,isClaudeAgent:k}),c.input.setChatMode(h.id),f.needToClearSession&&await t.executeCommand(Zm)}getNextMode(i,e,t){let o=t.getModes(),n=[...o.builtin.filter(l=>l.kind!=="edit"||e===0),...o.custom??[]],r=n.findIndex(l=>l.id===i.input.currentModeObs.get().id);return n[(r+1)%n.length]}},m_i=class a extends K{static{this.ID="workbench.action.chat.switchToNextModel"}constructor(){super({id:a.ID,title:L(5840,"Switch to Next Model"),category:Si,f1:!0,precondition:ie.enabled})}run(i,...e){i.get(Pt).lastFocusedWidget?.input.switchToNextModel()}},Khe=class a extends K{static{this.ID="workbench.action.chat.openModelPicker"}constructor(){super({id:a.ID,title:L(5833,"Open Model Picker"),category:Si,f1:!1,keybinding:{primary:2649,weight:200,when:ie.inChatInput},precondition:ie.enabled,menu:{id:D.ChatInput,order:3,group:"navigation",when:C.and(C.or(ie.lockedToCodingAgent.negate(),ie.chatSessionHasTargetedModels),C.or(C.equals(ie.location.key,"panel"),C.equals(ie.location.key,"editor"),C.equals(ie.location.key,"notebook"),C.equals(ie.location.key,"terminal")),C.or(ie.inAgentSessionsWelcome.negate(),ie.chatSessionHasTargetedModels,ie.agentSessionType.isEqualTo("local")))}})}async run(i,...e){let t=i.get(Pt),o=t.lastFocusedWidget;o&&(await t.reveal(o),o.input.openModelPicker())}},Git=class a extends K{static{this.ID="workbench.action.chat.openPermissionPicker"}constructor(){super({id:a.ID,title:L(5835,"Open Permission Picker"),tooltip:d(5845,null),category:Si,f1:!1,precondition:ie.enabled,menu:{id:D.ChatInputSecondary,order:10,group:"navigation",when:C.and(ie.enabled,ie.location.isEqualTo("panel"),ie.chatModeKind.notEqualsTo("ask"),ie.inQuickChat.negate(),C.or(ie.lockedToCodingAgent.negate(),ie.lockedCodingAgentId.isEqualTo("copilotcli")))}})}async run(i){let t=i.get(Pt).lastFocusedWidget;t&&t.input.openPermissionPicker()}},Ute=class a extends K{static{this.ID="workbench.action.chat.openModePicker"}constructor(){super({id:a.ID,title:L(5834,"Open Agent Picker"),tooltip:d(5844,null),category:Si,f1:!1,precondition:ie.enabled,keybinding:{when:C.and(ie.inChatInput,ie.location.isEqualTo("panel")),primary:2137,weight:100},menu:[{id:D.ChatInput,order:1,when:C.and(ie.enabled,ie.location.isEqualTo("panel"),ie.inQuickChat.negate(),C.or(ie.lockedToCodingAgent.negate(),ie.chatSessionHasCustomAgentTarget),C.or(ie.inAgentSessionsWelcome.negate(),ie.chatSessionHasCustomAgentTarget,ie.agentSessionType.isEqualTo("local"))),group:"navigation"}]})}async run(i,...e){let o=i.get(Pt).lastFocusedWidget;o&&o.input.openModePicker()}},zte=class a extends K{static{this.ID="workbench.action.chat.openSessionTargetPicker"}constructor(){super({id:a.ID,title:L(5836,"Open Session Target Picker"),tooltip:d(5846,null),category:Si,f1:!1,precondition:C.and(ie.enabled,C.or(ie.chatSessionIsEmpty,ie.inAgentSessionsWelcome),ie.currentlyEditingInput.negate(),ie.currentlyEditing.negate()),menu:[{id:D.ChatInput,order:0,when:C.and(ie.enabled,ie.location.isEqualTo("panel"),ie.inQuickChat.negate(),ie.chatSessionIsEmpty,wb),group:"navigation"},{id:D.ChatInputSecondary,order:0,when:C.and(ie.enabled,ie.location.isEqualTo("panel"),ie.inQuickChat.negate(),wb.negate(),ie.chatSessionIsEmpty),group:"navigation"}]})}async run(i,...e){let o=i.get(Pt).lastFocusedWidget;o&&o.input.openSessionTargetPicker()}},oNe=class a extends K{static{this.ID="workbench.action.chat.openDelegationPicker"}constructor(){super({id:a.ID,title:L(5832,"Open Delegation Picker"),tooltip:d(5826,null),category:Si,f1:!1,precondition:C.and(ie.enabled,ie.chatSessionIsEmpty.negate(),ie.currentlyEditingInput.negate(),ie.currentlyEditing.negate()),menu:[{id:D.ChatInputSecondary,order:.5,when:C.and(ie.enabled,ie.location.isEqualTo("panel"),ie.inQuickChat.negate(),ie.chatSessionSupportsDelegation,ie.chatSessionIsEmpty.negate()),group:"navigation"}]})}async run(i,...e){let o=i.get(Pt).lastFocusedWidget;o&&o.input.openDelegationPicker()}},nNe=class a extends K{static{this.ID="workbench.action.chat.openWorkspacePicker"}constructor(){super({id:a.ID,title:L(5837,"Open Workspace Picker"),tooltip:d(5842,null),category:Si,f1:!1,precondition:C.and(ie.enabled,ie.inAgentSessionsWelcome),menu:[{id:D.ChatInput,order:.6,when:C.and(ie.inAgentSessionsWelcome,ie.chatSessionType.isEqualTo(sc),wb),group:"navigation"},{id:D.ChatInputSecondary,order:.6,when:C.and(ie.inAgentSessionsWelcome,ie.chatSessionType.isEqualTo(sc),wb.negate()),group:"navigation"}]})}async run(i,...e){}},qit=class a extends K{static{this.ID="workbench.action.chat.chatSessionPrimaryPicker"}constructor(){super({id:a.ID,title:L(5831,"Open Primary Session Picker"),category:Si,f1:!1,precondition:ie.enabled,menu:{id:D.ChatInput,order:4,group:"navigation",when:C.and(ie.chatSessionHasModels,C.or(ie.lockedToCodingAgent,C.and(ie.inAgentSessionsWelcome,ie.chatSessionType.notEqualsTo("local"))))}})}async run(i,...e){let o=i.get(Pt).lastFocusedWidget;o&&o.input.openChatSessionPicker()}},een="workbench.action.chat.changeModel",h_i=class a extends K{static{this.ID=een}constructor(){super({id:a.ID,title:L(5830,"Change Model"),category:Si,f1:!1,precondition:ie.enabled})}run(i,...e){let t=e[0];wo(typeof t.vendor=="string"&&typeof t.id=="string"&&typeof t.family=="string");let n=i.get(Pt).getAllWidgets();for(let r of n)r.input.switchModel(t)}},g_i=class a extends Y1t{static{this.ID="workbench.action.edits.submit"}constructor(){let i=C.and(C.or(iNe,ie.editingRequestType.isEqualTo(ie.EditingRequestType.Sent)),ie.editingRequestType.notEqualsTo(ie.EditingRequestType.Queue),ie.editingRequestType.notEqualsTo(ie.EditingRequestType.Steer)),e=ie.chatModeKind.notEqualsTo("ask"),t=C.and(ie.inputHasText,i,ie.chatSessionOptionsValid);super({id:a.ID,title:L(5827,"Send"),f1:!1,category:Si,icon:R.arrowUp,precondition:t,menu:[{id:D.ChatExecute,order:4,when:C.and(i,e,Zgo),group:"navigation",alt:{id:"workbench.action.chat.sendToNewChat",title:L(5817,"Send to New Chat"),icon:R.plus}}]})}},f_i=class a extends K{static{this.ID="workbench.action.chat.submitWithoutDispatching"}constructor(){let i=C.and(ie.inputHasText,iNe,ie.chatModeKind.isEqualTo("ask"));super({id:a.ID,title:L(5839,"Send"),f1:!1,category:Si,precondition:i,keybinding:{when:ie.inChatInput,primary:1539,weight:100}})}run(i,...e){let t=e[0],o=i.get(Pt);(t?.widget??o.lastFocusedWidget)?.acceptInput(t?.inputValue,{noCommandDetection:!0})}},v_i=class a extends K{static{this.ID="workbench.action.chat.submitWithCodebase"}constructor(){let i=C.and(ie.inputHasText,iNe);super({id:a.ID,title:L(5814,"Send with {0}",`${Tu}codebase`),precondition:i,keybinding:{when:ie.inChatInput,primary:2051,weight:100}})}run(i,...e){let t=e[0],o=i.get(Pt),n=t?.widget??o.lastFocusedWidget;if(!n)return;let s=i.get(Vn).getToolByName("codebase");s&&(n.input.attachmentModel.addContext({id:s.id,name:s.displayName??"",fullName:s.displayName??"",value:void 0,icon:q.isThemeIcon(s.icon)?s.icon:void 0,kind:"tool"}),n.acceptInput())}},b_i=class extends K{constructor(){let i=ie.inputHasText;super({id:"workbench.action.chat.sendToNewChat",title:L(5817,"Send to New Chat"),precondition:i,category:Si,f1:!1,keybinding:{weight:200,primary:3075,when:ie.inChatInput}})}async run(i,...e){let t=e[0],o=i.get(Pt),n=i.get($t),r=i.get(at),s=i.get(mi),l=t?.widget??o.lastFocusedWidget;if(!l)return;let c=l.getInput();l.viewModel&&await s.cancelCurrentRequestForSession(l.viewModel.sessionResource,"newSessionAction"),!(l.viewModel?.model&&!await kXe(l.viewModel.model,void 0,r))&&(l.setInput(""),await rOt(l,n),l.acceptInput(c,{storeToHistory:!0}))}},jit="workbench.action.chat.cancel",$it=class a extends K{static{this.ID=jit}constructor(){super({id:a.ID,title:L(5828,"Cancel"),f1:!1,category:Si,icon:R.stopCircle,menu:[{id:D.ChatExecute,when:C.and(C.or(JZo,ZZo),ie.remoteJobCreating.negate(),ie.currentlyEditing.negate()),order:4,group:"navigation"},{id:D.ChatEditorInlineExecute,when:C.and($Ae.negate(),Gk,YD.negate()),order:4,group:"navigation"}],keybinding:{weight:200,primary:2057,when:C.and(XZo,ie.remoteJobCreating.negate()),win:{primary:513}}})}async run(i,...e){let t=e[0],o=i.get(Pt),n=i.get(se),r=i.get(Te),s=t?.widget??o.lastFocusedWidget;if(!s){r.publicLog2(G6e,{source:"cancelAction",reason:"noWidget",requestInProgress:"unknown",pendingRequests:0}),n.info("ChatCancelAction#run: No focused chat widget was found");return}let l=i.get(mi);s.viewModel?await l.cancelCurrentRequestForSession(s.viewModel.sessionResource,"cancelAction"):(r.publicLog2(G6e,{source:"cancelAction",reason:"noViewModel",requestInProgress:"unknown",pendingRequests:0}),n.info("ChatCancelAction#run: Canceled chat widget has no view model"))}},ten="workbench.edit.chat.cancel",S_i=class a extends K{static{this.ID=ten}constructor(){super({id:a.ID,title:L(5829,"Cancel Edit"),f1:!1,category:Si,icon:R.x,menu:[{id:D.ChatMessageTitle,group:"navigation",order:1,when:C.and(ie.isRequest,ie.currentlyEditing,C.equals("config.chat.editRequests","input"))}],keybinding:{primary:9,when:C.and(ie.inChatInput,pe.hoverVisible.toNegated(),pe.hasNonEmptySelection.toNegated(),pe.hasMultipleSelections.toNegated(),C.or(ie.currentlyEditing,ie.currentlyEditingInput)),weight:95}})}run(i,...e){let t=e[0],o=i.get(Pt),n=t?.widget??o.lastFocusedWidget;n&&n.finishedEditing()}},ien="workbench.action.chat.getHandoffs",I_i=class a extends K{static{this.ID=ien}constructor(){super({id:a.ID,title:L(5816,"Get Handoffs"),f1:!1,category:Si})}run(i,...e){let t=i.get(Fg),o=e.at(0),{builtin:n,custom:r}=t.getModes(),s=[...n,...r];if(o?.sourceCustomAgent){let l=o.sourceCustomAgent;s=s.filter(c=>c.name.get().toLowerCase()===l.toLowerCase())}return jso(s)}},oen="workbench.action.chat.executeHandoff",y_i=class a extends K{static{this.ID=oen}constructor(){super({id:a.ID,title:L(5815,"Execute Handoff"),f1:!1,category:Si})}async run(i,...e){let t=i.get(Pt),o=i.get(Fg),n=e.at(0);if(!n?.id&&!n?.label)return{success:!1,error:"Either id or label is required"};let r;if(n.sessionResource){let u;try{u=A.parse(n.sessionResource)}catch{return{success:!1,error:`Invalid sessionResource URI: '${n.sessionResource}'`}}r=t.getWidgetBySessionResource(u)}else r=t.lastFocusedWidget;if(!r)return{success:!1,error:"No chat widget found. Provide sessionResource or focus a chat widget."};let s;if(n.sourceCustomAgent){let u=n.sourceCustomAgent.toLowerCase(),{builtin:p,custom:h}=o.getModes();s=[...p,...h].find(g=>g.name.get().toLowerCase()===u||g.id.toLowerCase()===u)}s||(s=r.input.currentModeObs.get());let l=s?.handOffs?.get();if(!l||l.length===0)return{success:!1,error:`No handoffs available for mode '${s?.name.get()}'`};let c=n.id?l.find(u=>ASi(u)===n.id):void 0;if(!c&&n.label){let u=n.label.trim().toLowerCase();c=l.find(p=>p.label.trim().toLowerCase()===u)}return c?(await r.executeHandoff(c),{success:!0,targetMode:c.agent}):{success:!1,error:`No handoff with identifier '${n.id??n.label}' found for mode '${s?.name.get()}'`}}};function efo(){W(BT),W(g_i),W(f_i),W($it),W(b_i),W(v_i),W(p_i),W(m_i),W(Khe),W(Git),W(Ute),W(zte),W(oNe),W(nNe),W(qit),W(h_i),W(S_i),W(I_i),W(y_i)}var rNe=class extends x{constructor(e,t,o){super();this.fileService=e;this.webContentExtractorService=t;this.chatAttachmentResolveService=o;this._attachments=new Map;this._fileWatchers=this._register(new Vt);this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event}get attachments(){return Array.from(this._attachments.values())}get size(){return this._attachments.size}get fileAttachments(){return this.attachments.filter(e=>e.kind==="file"&&A.isUri(e.value)).map(e=>e.value)}getAttachmentIDs(){return new Set(this._attachments.keys())}async addFile(e,t){if(/\.(png|jpe?g|gif|bmp|webp)$/i.test(e.path)){let o=await this.asImageVariableEntry(e);o&&this.addContext(o);return}else this.addContext(this.asFileVariableEntry(e,t))}addFolder(e){this.addContext({kind:"directory",value:e,id:e.toString(),name:He(e)})}clear(e=!1){if(e){let t=Array.from(this._attachments.keys());this._attachments.clear(),this._fileWatchers.clearAndDisposeAll(),this._onDidChange.fire({deleted:t,added:[],updated:[]})}else{let t=[],o=Array.from(this._attachments.keys());for(let n of o){let r=this._attachments.get(n);r&&!lD(r)&&(this._attachments.delete(n),this._fileWatchers.deleteAndDispose(n),t.push(n))}this._onDidChange.fire({deleted:t,added:[],updated:[]})}}addContext(...e){e=e.filter(t=>!this._attachments.has(t.id)),this.updateContext(vt.empty(),e)}clearAndSetContext(...e){this.updateContext(Array.from(this._attachments.keys()),e)}delete(...e){this.updateContext(e,vt.empty())}updateContext(e,t){let o=[],n=[],r=[];for(let s of e)this._attachments.get(s)&&(this._attachments.delete(s),o.push(s),this._fileWatchers.deleteAndDispose(s));for(let s of t){let l=this._attachments.get(s.id);l?eo(l,s)||(this._fileWatchers.deleteAndDispose(s.id),this._attachments.set(s.id,s),r.push(s),this._watchAttachment(s)):(this._attachments.set(s.id,s),n.push(s),this._watchAttachment(s))}(o.length>0||n.length>0||r.length>0)&&this._onDidChange.fire({deleted:o,added:n,updated:r})}_watchAttachment(e){let t=aD.toUri(e);if(!t||t.scheme!==Q.file)return;let o=this.fileService.createWatcher(t,{recursive:!1,excludes:[]}),n=o.onDidChange(r=>{r.contains(t,2)&&this.updateContext([e.id],vt.empty())});this._fileWatchers.set(e.id,wn(n,o))}asFileVariableEntry(e,t){return{kind:"file",value:t?{uri:e,range:t}:e,id:e.toString()+(t?.toString()??""),name:He(e)}}async asImageVariableEntry(e){if(e.scheme===Q.file&&await this.fileService.canHandleResource(e))return await this.chatAttachmentResolveService.resolveImageEditorAttachContext(e);if(e.scheme===Q.http||e.scheme===Q.https){let t=await this.webContentExtractorService.readImage(e,Se.None);if(t)return await this.chatAttachmentResolveService.resolveImageEditorAttachContext(e,t)}}};rNe=I([m(0,fe),m(1,DG),m(2,rW)],rNe);var sNe=le("chatAttachmentWidgetRegistry"),X1t=class{constructor(){this._factories=new Map}registerFactory(i,e){return this._factories.set(i,e),{dispose:()=>{this._factories.get(i)===e&&this._factories.delete(i)}}}createWidget(i,e,t){let o=this._factories.get(i.kind);if(o)return o(i,e,t)}};function Qit(a,i){let e=new N;return e.add(j(a,re.CLICK,t=>{t.detail!==2&&(Xt.stop(t,!0),i(C_i(new Cn(Re(a),t))))})),e.add(j(a,re.DBLCLICK,t=>{Xt.stop(t,!0),i(C_i(new Cn(Re(a),t),!0))})),e.add(j(a,re.KEY_DOWN,t=>{let o=C_i(new gi(t));o&&(Xt.stop(t,!0),i(o))})),e}function C_i(a,i){if(a instanceof gi){let e;return a.equals(3)||Ze&&a.equals(2066)?e=!1:a.equals(10)&&(e=!0),typeof e>"u"?void 0:{editorOptions:{preserveFocus:e,pinned:!e},openToSide:!1}}else return{editorOptions:{preserveFocus:!i,pinned:i||a.middleButton},openToSide:a.ctrlKey||a.metaKey||a.altKey}}var lW="revealInExplorer",aNe="workbench.action.files.revert",J1t="explorer.openToSide",Z1t="explorer.openWith",ezt="selectForCompare",tzt="compareSelected",izt="compareFiles",Yit="workbench.files.action.compareWithSaved",Ghe="copyFilePath",qhe="copyRelativeFilePath",Xit="workbench.action.files.saveAs",ozt=L(10957,"Save As..."),lNe="workbench.action.files.save",x_i=L(10955,"Save"),nzt="workbench.action.files.saveWithoutFormatting",tfo=L(10958,"Save without Formatting"),cNe="saveAll",ifo=L(10956,"Save All"),$he="workbench.files.action.saveAllInGroup",rzt="workbench.action.files.saveFiles",F8=new Y("groupFocusedInOpenEditors",!1),dNe=new Y("dirtyEditorFocusedInOpenEditors",!1),Jit=new Y("readonlyEditorFocusedInOpenEditors",!1),szt=new Y("openEditorsSelectedFileOrUntitled",!0),Zit=new Y("resourceSelectedForCompare",!1),azt="removeRootFolder",ofo=d(10954,null),nfo="previousCompressedFolder",rfo="nextCompressedFolder",sfo="firstCompressedFolder",afo="lastCompressedFolder",cW="workbench.action.files.newUntitledFile",lzt=L(10953,"New Untitled Text File"),lfo="workbench.action.files.newFile";var czt=class{constructor(i){this.root=new dzt;for(let[e,t]of i)for(let o of t)this.root.add(e,o)}toString(){return this.root.toString()}getAttributes(i,e){let t=i.lastIndexOf(".");return t<1?{dirname:e,basename:i,extname:""}:{dirname:e,basename:i.substring(0,t),extname:i.substring(t+1)}}nest(i,e){let t=new dzt;for(let r of i){let s=this.getAttributes(r,e),l=this.root.get(r,s);for(let c of l)t.add(c,r)}let o=(r,s=new Set)=>{if(s.has(r))return[];s.add(r);let l=this.getAttributes(r,e),c=t.get(r,l);return c.length===0?[r]:c.length===1&&c[0]===r?[r]:c.flatMap(u=>o(u,s))},n=new Map;for(let r of i){let s=o(r);s.length===0&&(s=[r]);for(let l of s){let c=n.get(l);c||n.set(l,c=new Set),r!==l&&c.add(r)}}return n}},dzt=class a{constructor(){this.value=new k_i;this.map=new Map}add(i,e){if(i==="")this.value.add(i,e);else if(i[0]==="*")this.value.add(i,e);else{let t=i[0],o=i.slice(1),n=this.map.get(t);n||this.map.set(t,n=new a),n.add(o,e)}}get(i,e){let t=[];t.push(...this.value.get(i,e));let o=i[0],n=i.slice(1),r=this.map.get(o);return r&&t.push(...r.get(n,e)),t}toString(i=""){let e=[];return this.value.hasItems&&e.push(`* => 
`+this.value.toString(i+"  ")),[...this.map.entries()].map(([t,o])=>e.push("^"+t+` => 
`+o.toString(i+"  "))),e.map(t=>i+t).join(`
`)}},k_i=class a{constructor(){this.star=[];this.epsilon=[];this.map=new Map;this.hasItems=!1}add(i,e){if(this.hasItems=!0,i==="*")this.star.push(new uzt(e));else if(i==="")this.epsilon.push(new uzt(e));else{let t=i[i.length-1],o=i.slice(0,i.length-1);if(t==="*")throw Error("Unexpected star in SufTrie key: "+i);{let n=this.map.get(t);n||this.map.set(t,n=new a),n.add(o,e)}}}get(i,e){let t=[];i===""&&t.push(...this.epsilon.map(s=>s.substitute(e))),this.star.length&&t.push(...this.star.map(s=>s.substitute(e,i)));let o=i[i.length-1],n=i.slice(0,i.length-1),r=this.map.get(o);return r&&t.push(...r.get(n,e)),t}toString(i=""){let e=[];return this.star.length&&e.push("* => "+this.star.join("; ")),this.epsilon.length&&e.push("\u03B5 => "+this.epsilon.join("; ")),[...this.map.entries()].map(([t,o])=>e.push(t+`$ => 
`+o.toString(i+"  "))),e.map(t=>i+t).join(`
`)}};var cfo=/\$[({](capture|basename|dirname|extname)[)}]/g,uzt=class{constructor(i){this.tokens=[];cfo.lastIndex=0;let e,t=0;for(;e=cfo.exec(i);){let o=i.slice(t,e.index);this.tokens.push(o);let n=e[1];switch(n){case"basename":case"dirname":case"extname":case"capture":this.tokens.push({capture:n});break;default:throw Error("unknown substitution type: "+n)}t=e.index+e[0].length}if(t!==i.length){let o=i.slice(t,i.length);this.tokens.push(o)}}substitute(i,e){return this.tokens.map(t=>{if(typeof t=="string")return t;switch(t.capture){case"basename":return i.basename;case"dirname":return i.dirname;case"extname":return i.extname;case"capture":return e||""}}).join("")}};var pzt=class{constructor(i,e,t,o,n){this.contextService=i;this.uriIdentityService=e;this._onDidChangeRoots=new E;let r=()=>this._roots=this.contextService.getWorkspace().folders.map(s=>new qg(s.uri,t,o,n,void 0,!0,!1,!1,!1,s.name));r(),this._listener=this.contextService.onDidChangeWorkspaceFolders(()=>{r(),this._onDidChangeRoots.fire()})}get roots(){return this._roots}get onDidChangeRoots(){return this._onDidChangeRoots.event}findAll(i){return di(this.roots.map(e=>e.find(i)))}findClosest(i){let e=this.contextService.getWorkspaceFolder(i);if(e){let t=this.roots.find(o=>this.uriIdentityService.extUri.isEqual(o.resource,e.uri));if(t)return t.find(i)}return null}dispose(){this._onDidChangeRoots.dispose(),Be(this._listener)}},Kte=class Kte{constructor(i,e,t,o,n,r,s,l,c,u=Ga(i),p,h=!1){this.resource=i;this.fileService=e;this.configService=t;this.filesConfigService=o;this._parent=n;this._isDirectory=r;this._isSymbolicLink=s;this._readonly=l;this._locked=c;this._name=u;this._mtime=p;this._unknown=h;this.error=void 0;this._isExcluded=!1;this.markedAsFindResult=!1;this._isDirectoryResolved=!1}get isExcluded(){return this._isExcluded?!0:this._parent?this._parent.isExcluded:!1}set isExcluded(i){this._isExcluded=i}hasChildren(i){return this.hasNests?this.nestedChildren?.some(e=>i(e))??!1:this.isDirectory}get hasNests(){return!!this.nestedChildren?.length}get isDirectoryResolved(){return this._isDirectoryResolved}get isSymbolicLink(){return!!this._isSymbolicLink}get isDirectory(){return!!this._isDirectory}get isReadonly(){return this.filesConfigService.isReadonly(this.resource,{resource:this.resource,name:this.name,readonly:this._readonly,locked:this._locked})}get mtime(){return this._mtime}get name(){return this._name}get isUnknown(){return this._unknown}get parent(){return this._parent}get root(){return this._parent?this._parent.root:this}get children(){return new Map}updateName(i){this._parent?.removeChild(this),this._name=i,this._parent?.addChild(this)}getId(){let i=this.root.resource.toString()+"::"+this.resource.toString();return this.isMarkedAsFiltered()&&(i+="::findFilterResult"),i}toString(){return`ExplorerItem: ${this.name}`}get isRoot(){return this===this.root}static create(i,e,t,o,n,r){let s=new Kte(o.resource,i,e,t,n,o.isDirectory,o.isSymbolicLink,o.readonly,o.locked,o.name,o.mtime,!o.isFile&&!o.isDirectory);if(s.isDirectory&&(s._isDirectoryResolved=!!o.children||!!r&&r.some(l=>ws(l,s.resource)),o.children))for(let l=0,c=o.children.length;l<c;l++){let u=Kte.create(i,e,t,o.children[l],s,r);s.addChild(u)}return s}static mergeLocalWithDisk(i,e){if(i.resource.toString()!==e.resource.toString())return;let t=i.isDirectory||e.isDirectory;if(!(t&&e._isDirectoryResolved&&!i._isDirectoryResolved)&&(e.resource=i.resource,e.isRoot||e.updateName(i.name),e._isDirectory=i.isDirectory,e._mtime=i.mtime,e._isDirectoryResolved=i._isDirectoryResolved,e._isSymbolicLink=i.isSymbolicLink,e.error=i.error,t&&i._isDirectoryResolved)){let o=new gt;e.children.forEach(n=>{o.set(n.resource,n)}),e.children.clear(),i.children.forEach(n=>{let r=o.get(n.resource);r?(Kte.mergeLocalWithDisk(n,r),e.addChild(r),o.delete(n.resource)):e.addChild(n)}),o.forEach(n=>{n instanceof W8&&e.addChild(n)})}}addChild(i){i._parent=this,i.updateResource(!1),this.children.set(this.getPlatformAwareName(i.name),i)}getChild(i){return this.children.get(this.getPlatformAwareName(i))}fetchChildren(i){let e=this.configService.getValue({resource:this.root.resource}).explorer.fileNesting;return e.enabled&&this.nestedChildren?this.nestedChildren:(async()=>{if(!this._isDirectoryResolved){let o=i==="modified";this.error=void 0;try{let n=await this.fileService.resolve(this.resource,{resolveSingleChildDescendants:!0,resolveMetadata:o}),r=Kte.create(this.fileService,this.configService,this.filesConfigService,n,this);Kte.mergeLocalWithDisk(r,this)}catch(n){throw this.error=n,n}this._isDirectoryResolved=!0}let t=[];if(e.enabled){let o=[],n=[];for(let s of this.children.entries())s[1].nestedParent=void 0,s[1].isDirectory?n.push(s):o.push(s);let r=this.fileNester.nest(o.map(([s])=>s),this.getPlatformAwareName(this.name));for(let[s,l]of o){let c=r.get(s);if(c!==void 0){l.nestedChildren=[];for(let u of c.keys()){let p=Ci(this.children.get(u));l.nestedChildren.push(p),p.nestedParent=l}t.push(l)}else l.nestedChildren=void 0}for(let[s,l]of n.values())t.push(l)}else this.children.forEach(o=>{t.push(o)});return t})()}get fileNester(){if(!this.root._fileNester){let i=this.configService.getValue({resource:this.root.resource}).explorer.fileNesting,e=Object.entries(i.patterns).filter(t=>typeof t[0]=="string"&&typeof t[1]=="string"&&t[0]&&t[1]).map(([t,o])=>[this.getPlatformAwareName(t.trim()),o.split(",").map(n=>this.getPlatformAwareName(n.trim().replace(/\u200b/g,"").trim())).filter(n=>n!=="")]);this.root._fileNester=new czt(e)}return this.root._fileNester}removeChild(i){this.nestedChildren=void 0,this.children.delete(this.getPlatformAwareName(i.name))}forgetChildren(){this.children.clear(),this.nestedChildren=void 0,this._isDirectoryResolved=!1,this._fileNester=void 0}getPlatformAwareName(i){return this.fileService.hasCapability(this.resource,1024)?i:i.toLowerCase()}move(i){this.nestedParent?.removeChild(this),this._parent?.removeChild(this),i.removeChild(this),i.addChild(this),this.updateResource(!0)}updateResource(i){this._parent&&(this.resource=Ge(this._parent.resource,this.name)),i&&this.isDirectory&&this.children.forEach(e=>{e.updateResource(!0)})}rename(i){this.updateName(i.name),this._mtime=i.mtime,this.updateResource(!0)}find(i){let e=!this.fileService.hasCapability(i,1024);return i&&this.resource.scheme===i.scheme&&vr(this.resource.authority,i.authority)&&(e?mE(i.path,this.resource.path):i.path.startsWith(this.resource.path))?this.findByPath(dh(i.path,Oo.sep),this.resource.path.length,e):null}findByPath(i,e,t){if(OGi(dh(this.resource.path,Oo.sep),i,t))return this;if(this.isDirectory){for(;e<i.length&&i[e]===Oo.sep;)e++;let o=i.indexOf(Oo.sep,e);o===-1&&(o=i.length);let n=i.substring(e,o),r=this.children.get(this.getPlatformAwareName(n));if(r)return r.findByPath(i,o,t)}return null}isMarkedAsFiltered(){return this.markedAsFindResult}markItemAndParentsAsFiltered(){this.markedAsFindResult=!0,this.parent?.markItemAndParentsAsFiltered()}unmarkItemAndChildren(){this.markedAsFindResult=!1,this.children.forEach(i=>i.unmarkItemAndChildren())}};I([hi],Kte.prototype,"children",1);var qg=Kte,W8=class extends qg{constructor(i,e,t,o,n){super(A.file(""),i,e,t,o,n),this._isDirectoryResolved=!0}};var Oa=le("explorerService");function nen(a){let i=a.lastFocusedList,e=i?.getHTMLElement();if(e&&wa(e)){let t;if(i instanceof Cc){let o=i.getFocusedElements();o.length&&(t=o[0])}else if(i instanceof Tv){let o=i.getFocus();o.length&&(t=o[0])}return t}}function jhe(a,i,e){if(A.isUri(a))return a;let t=nen(e);return t instanceof qg?t.resource:t instanceof Rh?t.getResource():po.getOriginalUri(i.activeEditor,{supportSideBySide:1})}function dW(a,i,e,t,o){let n=i.lastFocusedList,r=n?.getHTMLElement();if(r&&wa(r)){if(n instanceof Tv&&n.getFocus().every(u=>u instanceof qg)){let u=o.getContext(!0,!0);if(u.length)return u.map(p=>p.resource)}if(n instanceof Cc){let u=di(n.getSelectedElements().filter(v=>v instanceof Rh).map(v=>v.getResource())),p=n.getFocusedElements(),h=p.length?p[0]:void 0,g;if(A.isUri(a))g=a.toString();else if(h instanceof Rh){let v=h.getResource();g=v?v.toString():void 0}let f=u.findIndex(v=>v.toString()===g);if(f!==-1){let v=u[f];return u.splice(f,1),u.unshift(v),u}}}let l=t.activeGroup.selectedEditors;if(l.length>1&&A.isUri(a)){let u=l.findIndex(p=>p.matches({resource:a}));if(u!==-1){let p=l[u];return l.splice(u,1),l.unshift(p),l.map(h=>po.getOriginalUri(h)).filter(h=>!!h)}}let c=jhe(a,e,i);return c?[c]:[]}function E_i(a){let i=a.get(Io).lastFocusedList,e=i?.getHTMLElement();if(e&&wa(e)&&i instanceof Cc){let t=di(i.getSelectedElements().filter(s=>s instanceof Rh)),o=i.getFocusedElements(),n=o.length?o[0]:void 0,r;return n instanceof Rh&&(r=n),t.some(s=>s===r)?t:r?[r]:void 0}}var jH=class{constructor(i,e,t,o,n){this.progressService=i;this.dialogService=e;this.explorerService=t;this.editorService=o;this.fileService=n}static{this.MAX_PARALLEL_UPLOADS=20}upload(i,e){let t=new Ye,o=this.progressService.withProgress({location:10,delay:800,cancellable:!0,title:d(10987,null)},async n=>this.doUpload(i,this.toTransfer(e),n,t.token),()=>t.dispose(!0));return this.progressService.withProgress({location:Fb,delay:500},()=>o),o}toTransfer(i){if($qi(i))return i.dataTransfer;let e={items:[]};for(let t of i)e.items.push({webkitGetAsEntry:()=>({name:t.name,isDirectory:!1,isFile:!0,createReader:()=>{throw new Error("Unsupported for files")},file:o=>o(t)})});return e}async doUpload(i,e,t,o){let n=e.items,r=[];for(let p of n)r.push(p.webkitGetAsEntry());let s=[],l={startTime:Date.now(),progressScheduler:new pP(p=>{t.report(p[p.length-1])},1e3),filesTotal:r.length,filesUploaded:0,totalBytesUploaded:0},c=new g_(jH.MAX_PARALLEL_UPLOADS);await dn.settled(r.map(p=>c.queue(async()=>{if(o.isCancellationRequested)return;if(i&&p.name&&i.getChild(p.name)){let{confirmed:g}=await this.dialogService.confirm(__i(p.name));if(!g||(await this.explorerService.applyBulkEdit([new Cu(Ge(i.resource,p.name),void 0,{recursive:!0,folder:i.getChild(p.name)?.isDirectory})],{undoLabel:d(10984,null,p.name),progressLabel:d(10985,null,p.name)}),o.isCancellationRequested))return}let h=await this.doUploadEntry(p,i.resource,i,t,l,o);h&&s.push(h)}))),l.progressScheduler.dispose();let u=s[0];!o.isCancellationRequested&&u?.isFile&&await this.editorService.openEditor({resource:u.resource,options:{pinned:!0}})}async doUploadEntry(i,e,t,o,n,r){if(r.isCancellationRequested||!i.name||!i.isFile&&!i.isDirectory)return;let s=0,l=(u,p)=>{s+=p,n.totalBytesUploaded+=p;let h=n.totalBytesUploaded/((Date.now()-n.startTime)/1e3),g;u<vl.MB?n.filesTotal===1?g=`${i.name}`:g=d(10989,null,n.filesUploaded,n.filesTotal,vl.formatSize(h)):g=d(10988,null,i.name,vl.formatSize(s),vl.formatSize(u),vl.formatSize(h)),n.progressScheduler.work({message:g})};n.filesUploaded++,l(0,0);let c=Ge(e,i.name);if(i.isFile){let u=await new Promise((p,h)=>i.file(p,h));return r.isCancellationRequested?void 0:(typeof u.stream=="function"&&u.size>vl.MB?await this.doUploadFileBuffered(c,u,l,r):await this.doUploadFileUnbuffered(c,u,l),{isFile:!0,resource:c})}else{if(await this.fileService.createFolder(c),r.isCancellationRequested)return;let u=i.createReader(),p=[],h=!1;do{let S=await new Promise((y,w)=>u.readEntries(y,w));S.length>0?p.push(...S):h=!0}while(!h&&!r.isCancellationRequested);n.filesTotal+=p.length;let g=t?.getChild(i.name)||void 0,f=[],v=[];for(let S of p)S.isFile?f.push(S):S.isDirectory&&v.push(S);let b=new g_(jH.MAX_PARALLEL_UPLOADS);await dn.settled(f.map(S=>b.queue(()=>this.doUploadEntry(S,c,g,o,n,r))));for(let S of v)await this.doUploadEntry(S,c,g,o,n,r);return{isFile:!1,resource:c}}}async doUploadFileBuffered(i,e,t,o){let n=IIe({highWaterMark:10}),r=this.fileService.writeFile(i,n);try{let s=e.stream().getReader(),l=await s.read();for(;!l.done&&!o.isCancellationRequested;){let c=qe.wrap(l.value);if(await n.write(c),o.isCancellationRequested)break;t(e.size,c.byteLength),l=await s.read()}n.end(void 0)}catch(s){n.error(s),n.end()}o.isCancellationRequested||await r}doUploadFileUnbuffered(i,e,t){return new Promise((o,n)=>{let r=new FileReader;r.onload=async s=>{try{if(s.target?.result instanceof ArrayBuffer){let l=qe.wrap(new Uint8Array(s.target.result));await this.fileService.writeFile(i,l),t(e.size,l.byteLength)}else throw new Error("Could not read from dropped file.");o()}catch(l){n(l)}},r.readAsArrayBuffer(e)})}};jH=I([m(0,Fo),m(1,at),m(2,Oa),m(3,ee),m(4,fe)],jH);var uNe=class{constructor(i,e,t,o,n,r,s,l,c,u,p){this.fileService=i;this.hostService=e;this.contextService=t;this.configurationService=o;this.dialogService=n;this.workspaceEditingService=r;this.explorerService=s;this.editorService=l;this.progressService=c;this.notificationService=u;this.instantiationService=p}async import(i,e,t){let o=new Ye,n=this.progressService.withProgress({location:10,delay:800,cancellable:!0,title:d(10969,null)},async()=>await this.doImport(i,e,t,o.token),()=>o.dispose(!0));return this.progressService.withProgress({location:Fb,delay:500},()=>n),n}async doImport(i,e,t,o){let n=di((await this.instantiationService.invokeFunction(c=>pwe(c,e))).map(c=>c.resource));await Promise.all(n.map(c=>this.fileService.activateProvider(c.scheme)));let r=di(n.filter(c=>this.fileService.hasProvider(c))),s=await this.fileService.resolveAll(r.map(c=>({resource:c})));if(o.isCancellationRequested)return;this.hostService.focus(t);let l=s.filter(c=>c.success&&c.stat?.isDirectory).map(c=>({uri:c.stat.resource}));if(l.length>0&&i.isRoot){let c;(b=>(b[b.Copy=1]="Copy",b[b.Add=2]="Add"))(c||={});let u=[{label:l.length>1?d(10967,null):d(10965,null),run:()=>1}],p,h=this.contextService.getWorkspace().folders.map(f=>f.uri.scheme);l.some(f=>h.indexOf(f.uri.scheme)>=0)?(u.unshift({label:l.length>1?d(10960,null):d(10959,null),run:()=>2}),p=l.length>1?d(10978,null):d(10977,null,He(l[0].uri))):p=l.length>1?d(10966,null):d(10964,null,He(l[0].uri));let{result:g}=await this.dialogService.prompt({type:ft.Info,message:p,buttons:u,cancelButton:!0});if(g===2)return this.workspaceEditingService.addFolders(l);if(g===1)return this.importResources(i,r,o)}else if(i instanceof qg)return this.importResources(i,r,o)}async importResources(i,e,t){if(e&&e.length>0){let o=await this.fileService.resolve(i.resource);if(t.isCancellationRequested)return;let n=new Set,r=this.fileService.hasCapability(i.resource,1024);o.children&&o.children.forEach(h=>{n.add(r?h.name:h.name.toLowerCase())});let s=0,l=di(await dn.settled(e.map(async h=>{if(!await this.fileService.exists(h)){s++;return}if(!(n.has(r?He(h):He(h).toLowerCase())&&!(await this.dialogService.confirm(__i(He(h)))).confirmed))return h})));s>0&&this.notificationService.error(s>1?d(10980,null):d(10979,null));let c=l.map(h=>{let g=He(h),f=Ge(i.resource,g);return new Cu(h,f,{overwrite:!0,copy:!0})}),u=this.configurationService.getValue().explorer.confirmUndo;if(await this.explorerService.applyBulkEdit(c,{undoLabel:l.length===1?d(10981,null,He(l[0])):d(10982,null,l.length),progressLabel:l.length===1?d(10968,null,He(l[0])):d(10970,null,l.length),progressLocation:10,confirmBeforeUndo:u==="verbose"||u==="default"}),this.configurationService.getValue().explorer.autoOpenDroppedFile&&c.length===1){let h=this.explorerService.findClosest(c[0].newResource);h&&!h.isDirectory&&this.editorService.openEditor({resource:h.resource,options:{pinned:!0}})}}}};uNe=I([m(0,fe),m(1,Zt),m(2,Pe),m(3,B),m(4,at),m(5,Db),m(6,Oa),m(7,ee),m(8,Fo),m(9,Ne),m(10,F)],uNe);var V8=class{constructor(i,e,t,o,n,r){this.fileService=i;this.explorerService=e;this.progressService=t;this.logService=o;this.fileDialogService=n;this.storageService=r}static{this.LAST_USED_DOWNLOAD_PATH_STORAGE_KEY="workbench.explorer.downloadPath"}download(i){let e=new Ye,t=this.progressService.withProgress({location:10,delay:800,cancellable:Wt,title:d(10974,null)},async o=>this.doDownload(i,o,e),()=>e.dispose(!0));return this.progressService.withProgress({location:Fb,delay:500},()=>t),t}async doDownload(i,e,t){for(let o of i){if(t.token.isCancellationRequested)return;Wt?await this.doDownloadBrowser(o.resource,e,t):await this.doDownloadNative(o,e,t)}}async doDownloadBrowser(i,e,t){let o=await this.fileService.resolve(i,{resolveMetadata:!0});if(t.token.isCancellationRequested)return;let n=32*vl.MB,r=o.isDirectory||o.size>n,s=Ki();if(r&&$x.supported(s))try{let l=await s.showDirectoryPicker(),c={startTime:Date.now(),progressScheduler:new pP(u=>{e.report(u[u.length-1])},1e3),filesTotal:o.isDirectory?0:1,filesDownloaded:0,totalBytesDownloaded:0,fileBytesDownloaded:0};if(o.isDirectory){let u=await l.getDirectoryHandle(o.name,{create:!0});await this.downloadFolderBrowser(o,u,c,t.token)}else await this.downloadFileBrowser(l,o,c,t.token);c.progressScheduler.dispose()}catch(l){this.logService.warn(l),t.cancel()}else if(o.isFile){let l;try{l=(await this.fileService.readFile(o.resource,{limits:{size:n}},t.token)).value.buffer}catch{l=vn.uriToBrowserUri(o.resource)}t.token.isCancellationRequested||e$i(l,o.name)}}async downloadFileBufferedBrowser(i,e,t,o){let n=await this.fileService.readFileStream(i,void 0,o);if(o.isCancellationRequested){e.close();return}return new Promise((r,s)=>{let l=n.value,c=new N;c.add(Z(()=>e.close())),c.add($c(o.onCancellationRequested)(()=>{c.dispose(),s(PI())})),fV(l,{onData:u=>{e.write(u.buffer),this.reportProgress(n.name,n.size,u.byteLength,t)},onError:u=>{c.dispose(),s(u)},onEnd:()=>{c.dispose(),r()}},o)})}async downloadFileUnbufferedBrowser(i,e,t,o){let n=await this.fileService.readFile(i,void 0,o);o.isCancellationRequested||(e.write(n.value.buffer),this.reportProgress(n.name,n.size,n.value.byteLength,t)),e.close()}async downloadFileBrowser(i,e,t,o){t.filesDownloaded++,t.fileBytesDownloaded=0,this.reportProgress(e.name,0,0,t);let r=await(await i.getFileHandle(e.name,{create:!0})).createWritable();return e.size>vl.MB?this.downloadFileBufferedBrowser(e.resource,r,t,o):this.downloadFileUnbufferedBrowser(e.resource,r,t,o)}async downloadFolderBrowser(i,e,t,o){if(i.children){t.filesTotal+=i.children.map(n=>n.isFile).length;for(let n of i.children){if(o.isCancellationRequested)return;if(n.isFile)await this.downloadFileBrowser(e,n,t,o);else{let r=await e.getDirectoryHandle(n.name,{create:!0}),s=await this.fileService.resolve(n.resource,{resolveMetadata:!0});await this.downloadFolderBrowser(s,r,t,o)}}}}reportProgress(i,e,t,o){o.fileBytesDownloaded+=t,o.totalBytesDownloaded+=t;let n=o.totalBytesDownloaded/((Date.now()-o.startTime)/1e3),r;e<vl.MB?o.filesTotal===1?r=i:r=d(10976,null,o.filesDownloaded,o.filesTotal,vl.formatSize(n)):r=d(10975,null,i,vl.formatSize(o.fileBytesDownloaded),vl.formatSize(e),vl.formatSize(n)),o.progressScheduler.work({message:r})}async doDownloadNative(i,e,t){e.report({message:i.name});let o,n=this.storageService.get(V8.LAST_USED_DOWNLOAD_PATH_STORAGE_KEY,-1);n?o=Ge(A.file(n),i.name):o=Ge(i.isDirectory?await this.fileDialogService.defaultFolderPath(Q.file):await this.fileDialogService.defaultFilePath(Q.file),i.name);let r=await this.fileDialogService.showSaveDialog({availableFileSystems:[Q.file],saveLabel:d(10972,null),title:d(10961,null),defaultUri:o});r?(this.storageService.store(V8.LAST_USED_DOWNLOAD_PATH_STORAGE_KEY,ci(r).fsPath,-1,1),await this.explorerService.applyBulkEdit([new Cu(i.resource,r,{overwrite:!0,copy:!0})],{undoLabel:d(10971,null,i.name),progressLabel:d(10973,null,i.name),progressLocation:10})):t.cancel()}};V8=I([m(0,fe),m(1,Oa),m(2,Fo),m(3,se),m(4,rn),m(5,ce)],V8);function __i(a){return{message:d(10963,null,a),detail:d(10983,null),primaryButton:d(10986,null),type:"warning"}}function ufo(a){return a.length>1?{message:d(10962,null,a.length),detail:kC(a)+`
`+d(10983,null),primaryButton:d(10986,null),type:"warning"}:__i(He(a[0]))}var Yhe="explorer.newFile",D_i=L(10875,"New File..."),hNe="explorer.newFolder",L_i=L(10876,"New Folder..."),mfo=d(10885,null),hfo=d(10844,null),gfo=d(10838,null),ffo=d(10881,null),xzt=new Y("fileCopied",!1),R_i="explorer.download",vfo=d(10859,null),M_i="explorer.upload",bfo=d(10907,null),pfo="explorer.confirmDelete",ren=5e6;async function Sfo(a,i){a&&(a.indexOf("/")>=0||a.indexOf("\\")>=0)&&await i.refresh()}async function P_i(a,i,e,t,o,n,r,s=!1,l=!1){let c;r?c=ei?d(10847,null):d(10848,null):c=d(10846,null);let u=y$e(n,f=>f.resource),p=new Set;for(let f of u)for(let v of i.getDirty(f.resource))p.add(v);if(p.size){let f;if(u.length>1?f=d(10854,null):u[0].isDirectory?p.size===1?f=d(10856,null,u[0].name):f=d(10855,null,u[0].name,p.size):f=d(10853,null,u[0].name),(await e.confirm({type:"warning",message:f,detail:d(10857,null),primaryButton:c})).confirmed)s=!0;else return}if(!s){let f=u.filter(v=>o.isReadonly(v.resource));if(f.length){let v;if(f.length>1?v=d(10882,null):f[0].isDirectory?v=d(10884,null,u[0].name):v=d(10883,null,u[0].name),!(await e.confirm({type:"warning",message:v,detail:d(10836,null),primaryButton:d(10835,null)})).confirmed)return}}let h,g=u.some(f=>f.isDirectory)?d(10870,null):u.length>1?d(10891,null):d(10890,null);if(s||t.getValue(pfo)===!1)h={confirmed:!0};else if(r){let{message:f,detail:v}=sen(u);v+=v?`
`:"",ei?v+=u.length>1?d(10904,null):d(10903,null):v+=u.length>1?d(10906,null):d(10905,null),h=await e.confirm({message:f,detail:v,primaryButton:c,checkbox:{label:d(10858,null)}})}else{let{message:f,detail:v}=aen(u);v+=v?`
`:"",v+=g,h=await e.confirm({type:"warning",message:f,detail:v,primaryButton:c})}if(h.confirmed&&h.checkboxChecked===!0&&await t.updateValue(pfo,!1),!!h.confirmed)try{let f=u.map(b=>new Cu(b.resource,void 0,{recursive:!0,folder:b.isDirectory,ignoreIfNotExists:l,skipTrashBin:!r,maxSize:ren})),v={undoLabel:u.length>1?d(10845,null,u.length):d(10849,null,u[0].name),progressLabel:u.length>1?d(10851,null,u.length):d(10852,null,u[0].name)};await a.applyBulkEdit(f,v)}catch(f){let v,b,S;if(r?(v=ei?d(10814,null):d(10902,null),b=g,S=d(10850,null)):(v=xn(f,!1),S=d(10893,null)),(await e.confirm({type:"warning",message:v,detail:b,primaryButton:S})).confirmed)return r&&(r=!1),s=!0,l=!0,P_i(a,i,e,t,o,n,r,s,l)}}function sen(a){return Ifo(a)?{message:d(10828,null,a.length),detail:kC(a.map(i=>i.resource))}:a.length>1?a[0].isDirectory?{message:d(10831,null,a.length),detail:kC(a.map(i=>i.resource))}:{message:d(10830,null,a.length),detail:kC(a.map(i=>i.resource))}:a[0].isDirectory&&!a[0].isSymbolicLink?{message:d(10829,null,a[0].name),detail:""}:{message:d(10827,null,a[0].name),detail:""}}function aen(a){return Ifo(a)?{message:d(10823,null,a.length),detail:kC(a.map(i=>i.resource))}:a.length>1?a[0].isDirectory?{message:d(10826,null,a.length),detail:kC(a.map(i=>i.resource))}:{message:d(10825,null,a.length),detail:kC(a.map(i=>i.resource))}:a[0].isDirectory?{message:d(10824,null,a[0].name),detail:""}:{message:d(10822,null,a[0].name),detail:""}}function Ifo(a){let i=a.find(t=>t.isDirectory),e=a.find(t=>!t.isDirectory);return!!i&&!!e}async function mzt(a,i,e,t,o,n){let r=typeof o.resource=="string"?o.resource:Ga(o.resource),s=Ge(t.resource,r);if(!(n==="disabled"&&!await cen(i,e,s))){for(;!o.allowOverwrite&&a.findClosest(s);)n!=="disabled"&&(r=len(r,!!o.isDirectory,n)),s=Ge(t.resource,r);return s}}function len(a,i,e){if(e==="simple"){let p=a,h="";i||(h=qm(a),p=jo(a,h));let g=/^(.+ copy)( \d+)?$/;return g.test(p)?p.replace(g,(f,v,b)=>{let S=b?parseInt(b):1;return S===0?`${v}`:S<1073741824?`${v} ${S+1}`:`${v}${b} copy`})+h:`${p} copy${h}`}let t="[\\.\\-_]",o=1073741824,n=RegExp("(.*"+t+")(\\d+)(\\..*)$");if(!i&&a.match(n))return a.replace(n,(p,h,g,f)=>{let v=parseInt(g);return v<o?h+String(v+1).padStart(g.length,"0")+f:`${h}${g}.1${f}`});let r=RegExp("(\\d+)("+t+".*)(\\..*)$");if(!i&&a.match(r))return a.replace(r,(p,h,g,f)=>{let v=parseInt(h);return v<o?String(v+1).padStart(h.length,"0")+g+f:`${h}${g}.1${f}`});let s=RegExp("(\\d+)(\\..*)$");if(!i&&a.match(s))return a.replace(s,(p,h,g)=>{let f=parseInt(h);return f<o?String(f+1).padStart(h.length,"0")+g:`${h}.1${g}`});let l=a.lastIndexOf(".");if(!i&&l>=0)return`${a.substr(0,l)}.1${a.substr(l)}`;let c=RegExp("(\\d+)$");if(!i&&l===-1&&a.match(c))return a.replace(c,(p,h)=>{let g=parseInt(h);return g<o?String(g+1).padStart(h.length,"0"):`${h}.1`});let u=RegExp("(.*)(\\d*)$");return!i&&l===-1&&a.match(u)?a.replace(u,(p,h,g)=>{let f=parseInt(g);return isNaN(f)&&(f=0),f<o?h+String(f+1).padStart(g.length,"0"):`${h}${g}.1`}):i&&a.match(/(\d+)$/)?a.replace(/(\d+)$/,(p,...h)=>{let g=parseInt(h[0]);return g<o?String(g+1).padStart(h[0].length,"0"):`${h[0]}.1`}):i&&a.match(/^(\d+)/)?a.replace(/^(\d+)(.*)$/,(p,...h)=>{let g=parseInt(h[0]);return g<o?String(g+1).padStart(h[0].length,"0")+h[1]:`${h[0]}${h[1]}.1`}):`${a}.1`}async function cen(a,i,e){if(!await a.exists(e))return!0;let{confirmed:o}=await i.confirm({type:ft.Warning,message:d(10833,null,jo(e.path)),primaryButton:d(10888,null)});return o}var hzt=class a extends K{static{this.ID="workbench.files.action.compareFileWith"}static{this.LABEL=L(10868,"Compare Active File With...")}constructor(){super({id:a.ID,title:a.LABEL,f1:!0,category:Ve.File,precondition:fr,metadata:{description:L(10817,"Opens a picker to select a file to diff with the active editor.")}})}async run(i){let e=i.get(ee),t=i.get(Bt),o=i.get(Ue),n=e.activeEditor,r=po.getOriginalUri(n);if(r&&t.canHandleResource(r)){let s=await o.quickAccess.pick("",{itemActivation:2});if(s?.length===1){let l=s[0].resource;A.isUri(l)&&t.canHandleResource(l)&&e.openEditor({original:{resource:r},modified:{resource:l},options:{pinned:!0}})}}}},iot=class a extends K{static{this.ID="workbench.action.toggleAutoSave"}constructor(){super({id:a.ID,title:L(10900,"Toggle Auto Save"),f1:!0,category:Ve.File,metadata:{description:L(10901,"Toggle the ability to save files automatically after typing")}})}run(i){return i.get(gr).toggleAutoSave()}},eot=class extends it{constructor(e,t,o,n,r){super(e,t);this.commandService=o;this.notificationService=n;this.workingCopyService=r;this.lastDirtyState=this.workingCopyService.hasDirty,this.enabled=this.lastDirtyState,this.registerListeners()}registerListeners(){this._register(this.workingCopyService.onDidChangeDirty(e=>this.updateEnablement(e)))}updateEnablement(e){let t=e.isDirty()||this.workingCopyService.hasDirty;this.lastDirtyState!==t&&(this.enabled=t,this.lastDirtyState=this.enabled)}async run(e){try{await this.doRun(e)}catch(t){this.notificationService.error(xn(t,!1))}}};eot=I([m(2,ge),m(3,Ne),m(4,Xa)],eot);var pNe=class extends eot{static{this.ID="workbench.files.action.saveAllInGroup"}static{this.LABEL=d(10894,null)}get class(){return"explorer-action "+q.asClassName(R.saveAll)}doRun(i){return this.commandService.executeCommand($he,{},i)}},Gte=class extends it{constructor(e,t,o){super(e,t,q.asClassName(R.closeAll));this.commandService=o}static{this.ID="workbench.files.action.closeGroup"}static{this.LABEL=d(10816,null)}run(e){return this.commandService.executeCommand(oJe,{},e)}};Gte=I([m(2,ge)],Gte);var gzt=class a extends K{static{this.ID="workbench.files.action.focusFilesExplorer"}static{this.LABEL=L(10866,"Focus on Files Explorer")}constructor(){super({id:a.ID,title:a.LABEL,f1:!0,category:Ve.File,metadata:{description:L(10867,"Moves focus to the file explorer view container.")}})}async run(i){await i.get(us).openPaneComposite(nv,0,!0)}},fzt=class a extends K{static{this.ID="workbench.files.action.showActiveFileInExplorer"}static{this.LABEL=L(10897,"Reveal Active File in Explorer View")}constructor(){super({id:a.ID,title:a.LABEL,f1:!0,category:Ve.File,metadata:{description:L(10898,"Reveals and selects the active file within the explorer view.")}})}async run(i){let e=i.get(ge),t=i.get(ee),o=po.getOriginalUri(t.activeEditor,{supportSideBySide:1});o&&e.executeCommand(lW,o)}},vzt=class a extends K{static{this.ID="workbench.action.files.showOpenedFileInNewWindow"}static{this.LABEL=L(10877,"Open Active Editor in New Empty Workspace")}constructor(){super({id:a.ID,title:a.LABEL,f1:!0,category:Ve.File,precondition:zX,metadata:{description:L(10878,"Opens the active editor in a new window with no folders open.")}})}async run(i){let e=i.get(ee),t=i.get(Zt),o=i.get(at),n=i.get(fe),r=po.getOriginalUri(e.activeEditor,{supportSideBySide:1});r&&n.hasProvider(r)?t.openWindow([{fileUri:r}],{forceNewWindow:!0}):o.error(d(10879,null))}};function yfo(a,i,e,t){if(e=uen(e),!e||e.length===0||/^\s+$/.test(e))return{content:d(10860,null),severity:ft.Error};if(e[0]==="/"||e[0]==="\\")return{content:d(10864,null),severity:ft.Error};let o=di(e.split(/[\\/]/)),n=i.parent;if(e!==i.name){let r=n?.getChild(e);if(r&&r!==i)return{content:d(10863,null,e),severity:ft.Error}}if(o.some(r=>!a.hasValidBasename(i.resource,t,r))){let r=e.replace(/\*/g,"\\*");return{content:d(10869,null,den(r)),severity:ft.Error}}return o.some(r=>/^\s|\s$/.test(r))?{content:d(10865,null),severity:ft.Warning}:null}function den(a){return a?.length>255?`${a.substr(0,255)}...`:a}function uen(a){return a&&(a=LL(a,"	"),a=dh(a,"/"),a=dh(a,"\\"),a)}var bzt=class a extends K{static{this.ID="workbench.files.action.compareNewUntitledTextFiles"}static{this.LABEL=L(10818,"Compare New Untitled Text Files")}constructor(){super({id:a.ID,title:a.LABEL,f1:!0,category:Ve.File,metadata:{description:L(10819,"Opens a new diff editor with two untitled files.")}})}async run(i){await i.get(ee).openEditor({original:{resource:void 0},modified:{resource:void 0},options:{pinned:!0}})}},Szt=class a extends K{static{this.ID="workbench.files.action.compareWithClipboard"}static{this.LABEL=L(10820,"Compare Active File with Clipboard")}static{this.SCHEME_COUNTER=0}constructor(){super({id:a.ID,title:a.LABEL,f1:!0,category:Ve.File,keybinding:{primary:Vi(2089,33),weight:200},metadata:{description:L(10821,"Opens a new diff editor to compare the active file with the contents of the clipboard.")}})}async run(i){let e=i.get(ee),t=i.get(F),o=i.get(Bt),n=i.get(fe),r=po.getOriginalUri(e.activeEditor,{supportSideBySide:1}),s=`clipboardCompare${a.SCHEME_COUNTER++}`;if(r&&(n.hasProvider(r)||r.scheme===Q.untitled)){if(!this.registrationDisposal){let u=t.createInstance(tot);this.registrationDisposal=o.registerTextModelContentProvider(s,u)}let l=He(r),c=d(10815,null,l);await e.openEditor({original:{resource:r.with({scheme:s})},modified:{resource:r},label:c,options:{pinned:!0}}).finally(()=>{Be(this.registrationDisposal),this.registrationDisposal=void 0})}}dispose(){Be(this.registrationDisposal),this.registrationDisposal=void 0}},tot=class{constructor(i,e,t){this.clipboardService=i;this.languageService=e;this.modelService=t}async provideTextContent(i){let e=await this.clipboardService.readText();return this.modelService.createModel(e,this.languageService.createByFilepathOrFirstLine(i),i)}};tot=I([m(0,Fi),m(1,_t),m(2,Tt)],tot);function pen(a,i,e){a.prompt(ft.Error,xn(i,!1),[{label:d(10892,null),run:()=>e()}])}async function wfo(a,i){let e=a.get(Oa),t=a.get(fe),o=a.get(B),n=a.get(gr),r=a.get(ee),s=a.get($t),l=a.get(Ne),c=a.get(bo),u=a.get(ge),p=a.get(An),h=!s.isViewVisible(Fb),g=await s.openView(Fb,!0);if(h&&await Li(500),!g){if(i)throw new Error("Open a folder or workspace first.");return u.executeCommand(cW)}let f=e.getContext(!1),v=f.length>0?f[0]:void 0,b;if(v?b=v.isDirectory?v:v.parent||e.roots[0]:b=e.roots[0],b.isReadonly)throw new Error("Parent folder is readonly.");let S=new W8(t,o,n,b,i);b.addChild(S);let y=async k=>{try{let T=Ge(b.resource,k);k.endsWith("/")&&(i=!0),await e.applyBulkEdit([new Cu(void 0,T,{folder:i})],{undoLabel:d(10842,null,k),progressLabel:d(10843,null,k),confirmBeforeUndo:!0}),await Sfo(k,e),i?await e.select(T,!0):await r.openEditor({resource:T,options:{pinned:!0}})}catch(T){pen(l,T,()=>y(k))}},w=(await c.getEnvironment())?.os??Po;await e.setEditable(S,{validationMessage:k=>yfo(p,S,k,w),onFinish:async(k,T)=>{b.removeChild(S),await e.setEditable(S,null),T&&y(k)}})}$e.registerCommand({id:Yhe,handler:async a=>{await wfo(a,!1)}});$e.registerCommand({id:hNe,handler:async a=>{await wfo(a,!0)}});var Cfo=async a=>{let i=a.get(Oa),e=a.get(Ne),t=a.get(bo),o=a.get(An),n=a.get(B),r=i.getContext(!1),s=r.length>0?r[0]:void 0;if(!s)return;let l=(await t.getEnvironment())?.os??Po;await i.setEditable(s,{validationMessage:c=>yfo(o,s,c,l),onFinish:async(c,u)=>{if(u){let p=s.parent.resource,h=Ge(p,c);if(s.resource.toString()!==h.toString())try{await i.applyBulkEdit([new Cu(s.resource,h)],{confirmBeforeUndo:n.getValue().explorer.confirmUndo==="verbose",undoLabel:d(10886,null,s.name,c),progressLabel:d(10887,null,s.name,c)}),await Sfo(c,i)}catch(g){e.error(g)}}await i.setEditable(s,null)}})},xfo=async a=>{let e=a.get(Oa).getContext(!0).filter(t=>!t.isRoot);e.length&&await P_i(a.get(Oa),a.get(qp),a.get(at),a.get(B),a.get(gr),e,!0)},A_i=async a=>{let e=a.get(Oa).getContext(!0).filter(t=>!t.isRoot);e.length&&await P_i(a.get(Oa),a.get(qp),a.get(at),a.get(B),a.get(gr),e,!1)},Qhe=!1,kfo=async a=>{let i=a.get(Oa),e=i.getContext(!0);e.length>0&&(await i.setToCopy(e,!1),Qhe=!1)},Efo=async a=>{let i=a.get(Oa),e=i.getContext(!0);e.length>0&&(await i.setToCopy(e,!0),Qhe=!0)},men=async a=>{let i=a.get(Oa),e=a.get(Ne),t=a.get(F),o=i.getContext(!0),n=o.length?o:i.roots,r=t.createInstance(V8);try{await r.download(n)}catch(s){throw e.error(s),s}};$e.registerCommand({id:R_i,handler:men});var hen=async a=>{let i=a.get(Oa),e=a.get(Ne),t=a.get(F),o=i.getContext(!1),n=o.length?o[0]:i.roots[0];try{let r=await t$i();r&&await t.createInstance(jH).upload(n,r)}catch(r){throw e.error(r),r}};$e.registerCommand({id:M_i,handler:hen});var Tfo=async(a,i)=>{let e=a.get(Fi),t=a.get(Oa),o=a.get(fe),n=a.get(Ne),r=a.get(ee),s=a.get(B),l=a.get(ht),c=a.get(at),u=a.get(Zt),p=t.getContext(!1),g=i&&i.length>0&&s.getValue("explorer.confirmPasteNative"),f=await gen(i,e,u);if(g&&f.files.length>=1){let w=f.files.length>1?d(10832,null,f.files.length):d(10834,null,jo(f.type==="paths"?f.files[0].fsPath:f.files[0].name)),k=f.files.length>1?kC(f.files.map(P=>{if(A.isUri(P))return P.fsPath;if(f.type==="paths"){let O=L_(P);if(O)return O}return P.name})):void 0,T=await c.confirm({message:w,detail:k,checkbox:{label:d(10858,null)},primaryButton:d(10880,null)});if(!T.confirmed)return;T.checkboxChecked===!0&&await s.updateValue("explorer.confirmPasteNative",!1)}let v=p.length?p[0]:t.roots[0],b=s.getValue().explorer.incrementalNaming;if(t.getEditable())return;try{let w=[];if(f.type==="paths"){let k=di(await Promise.all(f.files.map(async T=>{if(v.resource.toString()!==T.toString()&&ws(v.resource,T))throw new Error(d(10862,null));let P=await o.stat(T),O;l.extUri.isEqual(v.resource,T)?O=v.parent:O=v.isDirectory?v:v.parent;let V=await mzt(t,o,c,O,{resource:T,isDirectory:P.isDirectory,allowOverwrite:Qhe||b==="disabled"},b);if(V)return{source:T,target:V}})));if(k.length>=1)if(Qhe){let T=k.map(O=>new Cu(O.source,O.target,{overwrite:b==="disabled"})),P={confirmBeforeUndo:s.getValue().explorer.confirmUndo==="verbose",progressLabel:k.length>1?d(10873,null,k.length):d(10874,null,Ga(k[0].target)),undoLabel:k.length>1?d(10871,null,k.length):d(10872,null,Ga(k[0].target))};await t.applyBulkEdit(T,P)}else{let T=k.map(P=>new Cu(P.source,P.target,{copy:!0,overwrite:b==="disabled"}));await y(k.map(P=>P.target),T)}w=k.map(T=>T.target)}else{let k=di(await Promise.all(f.files.map(async T=>{let P=v.isDirectory?v:v.parent,O=await mzt(t,o,c,P,{resource:T.name,isDirectory:!1,allowOverwrite:Qhe||b==="disabled"},b);if(O)return{target:O,edit:new Cu(void 0,O,{overwrite:b==="disabled",contents:(async()=>qe.wrap(new Uint8Array(await T.arrayBuffer())))()})}})));await y(k.map(T=>T.target),k.map(T=>T.edit)),w=k.map(T=>T.target)}if(w.length){let k=w[0];if(await t.select(k),w.length===1){let T=t.findClosest(k);T&&!T.isDirectory&&await r.openEditor({resource:T.resource,options:{pinned:!0,preserveFocus:!0}})}}}catch(w){n.error(xn(new Error(d(10861,null,Pn(w))),!1))}finally{Qhe&&(await t.setToCopy([],!1),Qhe=!1)}async function y(w,k){let T=s.getValue().explorer.confirmUndo,P={confirmBeforeUndo:T==="default"||T==="verbose",progressLabel:w.length>1?d(10840,null,w.length):d(10841,null,Ga(w[0])),undoLabel:w.length>1?d(10837,null,w.length):d(10839,null,Ga(w[0]))};await t.applyBulkEdit(k,P)}};async function gen(a,i,e){if(a&&a.length>0){let t=[...a].map(o=>L_(o)).filter(o=>!!o&&Zl(o)).map(o=>A.file(o));return t.length?{type:"paths",files:t}:{type:"data",files:[...a].filter(o=>!L_(o))}}else return{type:"paths",files:y$e(await i.readResources(),t=>t)}}var _fo=async a=>{let i=a.get(ee),t=a.get(Oa).getContext(!0);await i.openEditors(t.filter(o=>!o.isDirectory).map(o=>({resource:o.resource,options:{preserveFocus:!0}})))},mNe=class extends K{constructor(e,t,o){super({id:e,title:t,f1:!0,category:Ve.File,precondition:WDt});this.newReadonlyState=o}async run(e){let t=e.get(ee),o=e.get(gr),n=po.getOriginalUri(t.activeEditor,{supportSideBySide:1});n&&await o.updateReadonly(n,this.newReadonlyState)}},Izt=class a extends mNe{static{this.ID="workbench.action.files.setActiveEditorReadonlyInSession"}static{this.LABEL=L(10895,"Set Active Editor Read-only in Session")}constructor(){super(a.ID,a.LABEL,!0)}},yzt=class a extends mNe{static{this.ID="workbench.action.files.setActiveEditorWriteableInSession"}static{this.LABEL=L(10896,"Set Active Editor Writeable in Session")}constructor(){super(a.ID,a.LABEL,!1)}},wzt=class a extends mNe{static{this.ID="workbench.action.files.toggleActiveEditorReadonlyInSession"}static{this.LABEL=L(10899,"Toggle Active Editor Read-only in Session")}constructor(){super(a.ID,a.LABEL,"toggle")}},Czt=class a extends mNe{static{this.ID="workbench.action.files.resetActiveEditorReadonlyInSession"}static{this.LABEL=L(10889,"Reset Active Editor Read-only in Session")}constructor(){super(a.ID,a.LABEL,"reset")}};var wI=class extends Ck{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super(e,t,v,u,h,g,f,S,y);this.instantiationService=c;this.textModelService=p;this.pathService=b;this.forceOpenAs=0;this.model=void 0;this.cachedTextFileModelReference=void 0;this.modelListeners=this._register(new N);this.model=this.textFileService.files.get(e),o&&this.setPreferredName(o),n&&this.setPreferredDescription(n),r&&this.setPreferredEncoding(r),s&&this.setPreferredLanguageId(s),typeof l=="string"&&this.setPreferredContents(l),this._register(this.textFileService.files.onDidCreate(w=>this.onDidCreateTextFileModel(w))),this.model&&this.registerModelListeners(this.model)}get typeId(){return Vpe}get editorId(){return la.id}get capabilities(){let e=32;return this.model?this.model.isReadonly()&&(e|=2):this.fileService.hasProvider(this.resource)?this.filesConfigurationService.isReadonly(this.resource)&&(e|=2):e|=4,e&2||(e|=128),e}onDidCreateTextFileModel(e){Qe(e.resource,this.resource)&&(this.model=e,this.registerModelListeners(e))}registerModelListeners(e){this.modelListeners.clear(),this.modelListeners.add(e.onDidChangeDirty(()=>this._onDidChangeDirty.fire())),this.modelListeners.add(e.onDidChangeReadonly(()=>this._onDidChangeCapabilities.fire())),this.modelListeners.add(e.onDidSaveError(()=>this._onDidChangeDirty.fire())),this.modelListeners.add(U.once(e.onWillDispose)(()=>{this.modelListeners.clear(),this.model=void 0}))}getName(){return this.preferredName||super.getName()}setPreferredName(e){this.allowLabelOverride()&&this.preferredName!==e&&(this.preferredName=e,this._onDidChangeLabel.fire())}allowLabelOverride(){return this.resource.scheme!==this.pathService.defaultUriScheme&&this.resource.scheme!==Q.vscodeUserData&&this.resource.scheme!==Q.file&&this.resource.scheme!==Q.vscodeRemote}getPreferredName(){return this.preferredName}isReadonly(){return this.model?this.model.isReadonly():this.filesConfigurationService.isReadonly(this.resource)}getDescription(e){return this.preferredDescription||super.getDescription(e)}setPreferredDescription(e){this.allowLabelOverride()&&this.preferredDescription!==e&&(this.preferredDescription=e,this._onDidChangeLabel.fire())}getPreferredDescription(){return this.preferredDescription}getTitle(e){let t=super.getTitle(e),o=this.getPreferredTitle();return o&&(t=`${o} (${t})`),t}getPreferredTitle(){if(this.preferredName&&this.preferredDescription)return`${this.preferredName} ${this.preferredDescription}`;if(this.preferredName||this.preferredDescription)return this.preferredName??this.preferredDescription}getEncoding(){return this.model?this.model.getEncoding():this.preferredEncoding}getPreferredEncoding(){return this.preferredEncoding}async setEncoding(e,t){return this.setPreferredEncoding(e),this.model?.setEncoding(e,t)}setPreferredEncoding(e){this.preferredEncoding=e,this.setForceOpenAsText()}getLanguageId(){return this.model?this.model.getLanguageId():this.preferredLanguageId}getPreferredLanguageId(){return this.preferredLanguageId}setLanguageId(e,t){this.setPreferredLanguageId(e),this.model?.setLanguageId(e,t)}setPreferredLanguageId(e){this.preferredLanguageId=e,this.setForceOpenAsText()}setPreferredContents(e){this.preferredContents=e,this.setForceOpenAsText()}setForceOpenAsText(){this.forceOpenAs=1}setForceOpenAsBinary(){this.forceOpenAs=2}isDirty(){return!!this.model?.isDirty()}isSaving(){return this.model?.hasState(0)||this.model?.hasState(3)||this.model?.hasState(5)?!1:this.filesConfigurationService.hasShortAutoSaveDelay(this)?!0:super.isSaving()}prefersEditorPane(e){return this.forceOpenAs===2?e.find(t=>t.typeId===FFt):e.find(t=>t.typeId===w0)}resolve(e){return this.forceOpenAs===2?this.doResolveAsBinary():this.doResolveAsText(e)}async doResolveAsText(e){try{let t=this.preferredContents;this.preferredContents=void 0,await this.textFileService.files.resolve(this.resource,{languageId:this.preferredLanguageId,encoding:this.preferredEncoding,contents:typeof t=="string"?Vj(t):void 0,reload:{async:!0},allowBinary:this.forceOpenAs===1,reason:1,limits:this.ensureLimits(e)}),this.cachedTextFileModelReference||(this.cachedTextFileModelReference=await this.textModelService.createModelReference(this.resource));let o=this.cachedTextFileModelReference.object;return this.isDisposed()&&this.disposeModelReference(),o}catch(t){if(t.textFileOperationResult===0)return this.doResolveAsBinary();throw t}}async doResolveAsBinary(){let e=this.instantiationService.createInstance(B2,this.preferredResource,this.getName());return await e.resolve(),e}isResolved(){return!!this.model}async rename(e,t){return{editor:{resource:t,encoding:this.getEncoding(),options:{viewState:Y5(this,e,this.editorService)}}}}toUntyped(e){let t={resource:this.preferredResource,forceFile:!0,options:{override:this.editorId}};return typeof e?.preserveViewState=="number"&&(t.encoding=this.getEncoding(),t.languageId=this.getLanguageId(),t.contents=(()=>{let o=this.textFileService.files.get(this.resource);if(o?.isDirty()&&!o.textEditorModel.isTooLargeForHeapOperation())return o.textEditorModel.getValue()})(),t.options={...t.options,viewState:Y5(this,e.preserveViewState,this.editorService)}),t}matches(e){return this===e?!0:e instanceof wI?Qe(e.resource,this.resource):Sf(e)?super.matches(e):!1}dispose(){this.model=void 0,this.disposeModelReference(),super.dispose()}disposeModelReference(){Be(this.cachedTextFileModelReference),this.cachedTextFileModelReference=void 0}};wI=I([m(7,F),m(8,Uo),m(9,Bt),m(10,rt),m(11,fe),m(12,gr),m(13,ee),m(14,An),m(15,Fn),m(16,Rv)],wI);var U_i="saveConflictResolutionContext",N_i="conflictResolution",z_i="learnMoreDirtyWriteError",Dfo=d(10800,null),Xhe=class extends x{constructor(e,t,o,n,r,s,l){super();this.notificationService=e;this.textFileService=t;this.editorService=n;this.instantiationService=s;this.storageService=l;this.messages=new gt;this.activeConflictResolutionResource=void 0;this.conflictResolutionContext=new Y(U_i,!1,!0).bindTo(o);let c=this._register(s.createInstance(sM));this._register(r.registerTextModelContentProvider(N_i,c)),this.textFileService.files.saveErrorHandler=this,this.registerListeners()}static{this.ID="workbench.contrib.textFileSaveErrorHandler"}registerListeners(){this._register(this.textFileService.files.onDidSave(e=>this.onFileSavedOrReverted(e.model.resource))),this._register(this.textFileService.files.onDidRevert(e=>this.onFileSavedOrReverted(e.resource))),this._register(this.editorService.onDidActiveEditorChange(()=>this.onActiveEditorChanged()))}onActiveEditorChanged(){let e=!1,t,o=this.editorService.activeEditor;o instanceof Pa&&o.original.resource?.scheme===N_i&&(e=!0,t=o.modified.resource),this.conflictResolutionContext.set(e),this.activeConflictResolutionResource=t}onFileSavedOrReverted(e){let t=this.messages.get(e);t&&(t.close(),this.messages.delete(e))}onSaveError(e,t,o){let n=e,r=t.resource,s,l=[],c=[];if(n.fileOperationResult===3)if(this.activeConflictResolutionResource&&Qe(this.activeConflictResolutionResource,t.resource)){if(this.storageService.getBoolean(z_i,-1))return;s=Dfo,l.push(this.instantiationService.createInstance(gNe)),c.push(this.instantiationService.createInstance(oot))}else s=d(10799,null,He(r)),l.push(this.instantiationService.createInstance(not,t)),l.push(this.instantiationService.createInstance(H_i,t,o)),c.push(this.instantiationService.createInstance(sot));else{let h=n.fileOperationResult===5,g=h&&n.options?.unlock,f=n.fileOperationResult===6,v=r.scheme===Q.file;v&&(f||g)?l.push(this.instantiationService.createInstance(F_i,t,o,!!g)):h?l.push(this.instantiationService.createInstance(B_i,t,o)):l.push(this.instantiationService.createInstance(W_i,t,o)),l.push(this.instantiationService.createInstance(rot,t)),l.push(this.instantiationService.createInstance(V_i,t)),h?g&&v?s=ei?d(10792,null,He(r)):d(10793,null,He(r)):s=d(10791,null,He(r)):v&&f?s=ei?d(10789,null,He(r)):d(10790,null,He(r)):s=d(10784,null,He(r),xn(e,!1))}let u={primary:l,secondary:c},p=this.notificationService.notify({id:`${_r(t.resource.toString())}`,severity:ft.Error,message:s,actions:u});U.once(p.onDidClose)(()=>{Be(l),Be(c)}),this.messages.set(t.resource,p)}dispose(){super.dispose(),this.messages.clear()}};Xhe=I([m(0,Ne),m(1,Uo),m(2,X),m(3,ee),m(4,Bt),m(5,F),m(6,ce)],Xhe);var O_i=[];function fen(){for(;O_i.length>0;)O_i.pop()?.close()}var gNe=class extends it{constructor(e){super("workbench.files.action.resolveConflictLearnMore",d(10785,null));this.openerService=e}async run(){await this.openerService.open(A.parse("https://go.microsoft.com/fwlink/?linkid=868264"))}};gNe=I([m(0,Je)],gNe);var oot=class extends it{constructor(e){super("workbench.files.action.resolveConflictLearnMoreDoNotShowAgain",d(10783,null));this.storageService=e}async run(e){this.storageService.store(z_i,!0,-1,0),e.dispose()}};oot=I([m(0,ce)],oot);var not=class extends it{constructor(e,t,o,n,r){super("workbench.files.action.resolveConflict",d(10781,null));this.model=e;this.editorService=t;this.notificationService=o;this.instantiationService=n;this.productService=r}async run(){if(!this.model.isDisposed()){let e=this.model.resource,t=He(e),o=d(10796,null,t,t,this.productService.nameLong);await sM.open(e,N_i,o,this.editorService,{pinned:!0});let n={primary:[this.instantiationService.createInstance(gNe)]},r=this.notificationService.notify({id:`${_r(e.toString())}`,severity:ft.Info,message:Dfo,actions:n,neverShowAgain:{id:z_i,isSecondary:!0}});U.once(r.onDidClose)(()=>Be(n.primary)),O_i.push(r)}}};not=I([m(1,ee),m(2,Ne),m(3,F),m(4,tt)],not);var F_i=class extends it{constructor(e,t,o){super("workbench.files.action.saveModelElevated",o?ei?d(10787,null):d(10788,null):ei?d(10797,null):d(10798,null));this.model=e;this.options=t;this.triedToUnlock=o}async run(){this.model.isDisposed()||await this.model.save({...this.options,writeElevated:!0,writeUnlock:this.triedToUnlock,reason:1})}},W_i=class extends it{constructor(e,t){super("workbench.files.action.saveModel",d(10794,null));this.model=e;this.options=t}async run(){this.model.isDisposed()||await this.model.save({...this.options,reason:1})}},V_i=class extends it{constructor(e){super("workbench.files.action.revertModel",d(10795,null));this.model=e}async run(){this.model.isDisposed()||await this.model.revert()}},rot=class extends it{constructor(e,t){super("workbench.files.action.saveModelAs",ozt.value);this.model=e;this.editorService=t}async run(){if(!this.model.isDisposed()){let e=this.findEditor();e&&await this.editorService.save(e,{saveAs:!0,reason:1})}}findEditor(){let e,t=this.editorService.findEditors(this.model.resource,{supportSideBySide:1});for(let o of t)if(o.editor instanceof wI){e=o;break}else e||(e=o);return e}};rot=I([m(1,ee)],rot);var B_i=class extends it{constructor(e,t){super("workbench.files.action.unlock",d(10786,null));this.model=e;this.options=t}async run(){this.model.isDisposed()||await this.model.save({...this.options,writeUnlock:!0,reason:1})}},H_i=class extends it{constructor(e,t){super("workbench.files.action.saveIgnoreModifiedSince",d(10786,null));this.model=e;this.options=t}async run(){this.model.isDisposed()||await this.model.save({...this.options,ignoreModifiedSince:!0,reason:1})}},sot=class extends it{constructor(e){super("workbench.files.action.configureSaveConflict",d(10782,null));this.preferencesService=e}async run(){this.preferencesService.openSettings({query:"files.saveConflictResolution"})}};sot=I([m(0,Go)],sot);var Lfo=(a,i)=>Mfo(a,i,!0),Rfo=(a,i)=>Mfo(a,i,!1);async function Mfo(a,i,e){let t=a.get(ee);if(!A.isUri(i))return;let o=t.activeEditorPane;if(!o)return;let n=o.input,r=o.group;if(fen(),e){let s={ignoreModifiedSince:!0,reason:1};await t.save({editor:n,groupId:r.id},s)}else await t.revert({editor:n,groupId:r.id});return await t.openEditor({resource:i},r),r.closeEditor(n)}var Ezt=_,Zw=class extends Gs{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super(e,l,n,s,c,o,t,v,u,h);this.editorGroupService=r;this.telemetryService=p;this.workingCopyService=g;this.filesConfigurationService=f;this.fileService=b;this.needsRefresh=!1;this.elements=[];this.blockFocusActiveEditorTracking=!1;this.structuralRefreshDelay=0,this.sortOrder=s.getValue("explorer.openEditors.sortOrder"),this.registerUpdateEvents(),this._register(this.configurationService.onDidChangeConfiguration(S=>this.onConfigurationChange(S))),this._register(this.workingCopyService.onDidChangeDirty(S=>this.updateDirtyIndicator(S)))}static{this.DEFAULT_VISIBLE_OPEN_EDITORS=9}static{this.DEFAULT_MIN_VISIBLE_OPEN_EDITORS=0}static{this.ID="workbench.explorer.openEditorsView"}static{this.NAME=L(11134,"Open Editors")}registerUpdateEvents(){let e=()=>{if(!this.isBodyVisible()||!this.list){this.needsRefresh=!0;return}this.listRefreshScheduler?.schedule(this.structuralRefreshDelay)},t=this._register(new Vt),o=n=>{let r=n.onDidModelChange(s=>{if(this.listRefreshScheduler?.isScheduled())return;if(!this.isBodyVisible()||!this.list){this.needsRefresh=!0;return}let l=this.getIndex(n,s.editor);switch(s.kind){case 8:this.focusActiveEditor();break;case 1:case 2:l>=0&&this.list.splice(l,1,[n]);break;case 14:case 13:case 10:case 11:case 9:this.list.splice(l,1,[new Rh(s.editor,n)]),this.focusActiveEditor();break;case 5:case 7:case 6:e();break}});t.set(n.id,r)};this.editorGroupService.groups.forEach(n=>o(n)),this._register(this.editorGroupService.onDidAddGroup(n=>{o(n),e()})),this._register(this.editorGroupService.onDidMoveGroup(()=>e())),this._register(this.editorGroupService.onDidChangeActiveGroup(()=>this.focusActiveEditor())),this._register(this.editorGroupService.onDidRemoveGroup(n=>{t.deleteAndDispose(n.id),e()}))}renderHeaderTitle(e){super.renderHeaderTitle(e,this.title);let t=M(e,Ezt(".open-editors-dirty-count-container"));this.dirtyCountElement=M(t,Ezt(".dirty-count.monaco-count-badge.long")),this.dirtyCountElement.style.backgroundColor=kt(bv),this.dirtyCountElement.style.color=kt(CC),this.dirtyCountElement.style.border=`1px solid ${kt(bi)}`,this.updateDirtyIndicator()}renderBody(e){super.renderBody(e),e.classList.add("open-editors"),e.classList.add("show-file-icons");let t=new aot;this.list&&this.list.dispose(),this.listLabels&&this.listLabels.clear(),this.dnd=new kzt(this.sortOrder,this.instantiationService,this.editorGroupService),this.listLabels=this.instantiationService.createInstance(Nl,{onDidChangeVisibility:this.onDidChangeBodyVisibility}),this.list=this.instantiationService.createInstance(Vl,"OpenEditors",e,t,[new Tzt(this.keybindingService,this.instantiationService),new _zt(this.listLabels,this.instantiationService,this.keybindingService,this.configurationService)],{identityProvider:{getId:r=>r instanceof Rh?r.getId():r.id.toString()},dnd:this.dnd,overrideStyles:this.getLocationBasedColors().listOverrideStyles,accessibilityProvider:new G_i}),this._register(this.list),this._register(this.listLabels);let o=[];this.listRefreshScheduler=this._register(new Dt(()=>{if(!this.list)return;o=Be(o);let r=this.list.length,s=this.getElements();this.list.splice(0,this.list.length,s),this.focusActiveEditor(),r!==this.list.length&&this.updateSize(),this.needsRefresh=!1,(this.sortOrder==="alphabetical"||this.sortOrder==="fullPath")&&s.forEach(l=>{l instanceof Rh&&o.push(l.editor.onDidChangeLabel(()=>this.listRefreshScheduler?.schedule()))})},this.structuralRefreshDelay)),this.updateSize(),this.handleContextKeys(),this._register(this.list.onContextMenu(r=>this.onListContextMenu(r))),this._register(this.list.onMouseMiddleClick(r=>{if(r&&r.element instanceof Rh){if(REe(r.element.group,r.element.editor,2,this.editorGroupService.partOptions))return;r.element.group.closeEditor(r.element.editor,{preserveFocus:!0})}})),this._register(this.list.onDidOpen(r=>{let s=r.element;if(s)if(s instanceof Rh){if(Ru(r.browserEvent)&&r.browserEvent.button===1)return;this.withActiveEditorFocusTrackingDisabled(()=>{this.openEditor(s,{preserveFocus:r.editorOptions.preserveFocus,pinned:r.editorOptions.pinned,sideBySide:r.sideBySide})})}else this.withActiveEditorFocusTrackingDisabled(()=>{this.editorGroupService.activateGroup(s),r.editorOptions.preserveFocus||s.focus()});else return})),this.listRefreshScheduler.schedule(0),this._register(this.onDidChangeBodyVisibility(r=>{r&&this.needsRefresh&&this.listRefreshScheduler?.schedule(0)}));let n=this.viewDescriptorService.getViewContainerModel(this.viewDescriptorService.getViewContainerByViewId(this.id));this._register(n.onDidChangeAllViewDescriptors(()=>{this.updateSize()}))}handleContextKeys(){if(!this.list)return;sco.bindTo(this.list.contextKeyService),dJe.bindTo(this.list.contextKeyService);let e=F8.bindTo(this.contextKeyService),t=dNe.bindTo(this.contextKeyService),o=Jit.bindTo(this.contextKeyService),n=szt.bindTo(this.contextKeyService),r=this.instantiationService.createInstance(Wo);this._register(r),this._register(this.list.onDidChangeFocus(s=>{r.reset(),e.reset(),t.reset(),o.reset();let l=s.elements.length?s.elements[0]:void 0;if(l instanceof Rh){let c=l.getResource();t.set(l.editor.isDirty()&&!l.editor.isSaving()),o.set(!!l.editor.isReadonly()),r.set(c??null)}else l&&e.set(!0)})),this._register(this.list.onDidChangeSelection(s=>{let l=s.elements.every(c=>{if(c instanceof Rh){let u=c.getResource();return u&&(u.scheme===Q.untitled||this.fileService.hasProvider(u))}return!1});n.set(l)}))}focus(){super.focus(),this.list?.domFocus()}layoutBody(e,t){super.layoutBody(e,t),this.list?.layout(e,t)}get showGroups(){return this.editorGroupService.groups.length>1}getElements(){return this.elements=[],this.editorGroupService.getGroups(2).forEach(e=>{this.showGroups&&this.elements.push(e);let t=e.editors.map(o=>new Rh(o,e));this.sortOrder==="alphabetical"?t=t.sort((o,n)=>tJe(o.editor.getName(),n.editor.getName())):this.sortOrder==="fullPath"&&(t=t.sort((o,n)=>{let r=o.editor.resource,s=n.editor.resource;if(r===void 0&&s===void 0)return tJe(o.editor.getName(),n.editor.getName());if(r===void 0)return-1;if(s===void 0)return 1;{let l=r.scheme,c=s.scheme;return l!==Q.file&&c!==Q.file?Ax.compare(r,s):l!==Q.file?-1:c!==Q.file?1:Ax.compare(r,s)}})),this.elements.push(...t)}),this.elements}getIndex(e,t){return t?this.elements.findIndex(o=>o instanceof Rh&&o.editor===t&&o.group.id===e.id):this.elements.findIndex(o=>!(o instanceof Rh)&&o.id===e.id)}openEditor(e,t){e&&(this.telemetryService.publicLog2("workbenchActionExecuted",{id:"workbench.files.openFile",from:"openEditors"}),t.sideBySide&&t.preserveFocus||this.editorGroupService.activateGroup(e.group),(t.sideBySide?this.editorGroupService.sideGroup:e.group).openEditor(e.editor,t))}onListContextMenu(e){if(!e.element)return;let t=e.element;this.contextMenuService.showContextMenu({menuId:D.OpenEditorsContext,menuActionOptions:{shouldForwardArgs:!0,arg:t instanceof Rh?po.getOriginalUri(t.editor):{}},contextKeyService:this.list?.contextKeyService,getAnchor:()=>e.anchor,getActionsContext:()=>t instanceof Rh?{groupId:t.groupId,editorIndex:t.group.getIndexOfEditor(t.editor)}:{groupId:t.id}})}withActiveEditorFocusTrackingDisabled(e){this.blockFocusActiveEditorTracking=!0;try{e()}finally{this.blockFocusActiveEditorTracking=!1}}focusActiveEditor(){if(!(!this.list||this.blockFocusActiveEditorTracking)){if(this.list.length&&this.editorGroupService.activeGroup){let e=this.getIndex(this.editorGroupService.activeGroup,this.editorGroupService.activeGroup.activeEditor);if(e>=0){try{this.list.setFocus([e]),this.list.setSelection([e]),this.list.reveal(e)}catch{}return}}this.list.setFocus([]),this.list.setSelection([])}}onConfigurationChange(e){e.affectsConfiguration("explorer.openEditors")&&this.updateSize(),(e.affectsConfiguration("explorer.decorations")||e.affectsConfiguration("explorer.openEditors.sortOrder"))&&(this.sortOrder=this.configurationService.getValue("explorer.openEditors.sortOrder"),this.dnd&&(this.dnd.sortOrder=this.sortOrder),this.listRefreshScheduler?.schedule())}updateSize(){this.minimumBodySize=this.orientation===0?this.getMinExpandedBodySize():170,this.maximumBodySize=this.orientation===0?this.getMaxExpandedBodySize():Number.POSITIVE_INFINITY}updateDirtyIndicator(e){if(e&&e.isDirty()&&!(e.capabilities&2)&&this.filesConfigurationService.hasShortAutoSaveDelay(e.resource))return;let t=this.workingCopyService.dirtyCount;t===0?this.dirtyCountElement.classList.add("hidden"):(this.dirtyCountElement.textContent=d(11129,null,t),this.dirtyCountElement.classList.remove("hidden"))}get elementCount(){return this.editorGroupService.groups.map(e=>e.count).reduce((e,t)=>e+t,this.showGroups?this.editorGroupService.groups.length:0)}getMaxExpandedBodySize(){let e=this.configurationService.getValue("explorer.openEditors.minVisible");return typeof e!="number"&&(e=Zw.DEFAULT_MIN_VISIBLE_OPEN_EDITORS),this.viewDescriptorService.getViewContainerModel(this.viewDescriptorService.getViewContainerByViewId(this.id)).visibleViewDescriptors.length<=1?Number.POSITIVE_INFINITY:Math.max(this.elementCount,e)*aot.ITEM_HEIGHT}getMinExpandedBodySize(){let e=this.configurationService.getValue("explorer.openEditors.visible");return typeof e!="number"&&(e=Zw.DEFAULT_VISIBLE_OPEN_EDITORS),this.computeMinExpandedBodySize(e)}computeMinExpandedBodySize(e=Zw.DEFAULT_VISIBLE_OPEN_EDITORS){return Math.min(Math.max(e,1),this.elementCount)*aot.ITEM_HEIGHT}setStructuralRefreshDelay(e){this.structuralRefreshDelay=e}getOptimalWidth(){if(!this.list)return super.getOptimalWidth();let e=this.list.getHTMLElement(),t=[].slice.call(e.querySelectorAll(".open-editor > a"));return MIe(e,t)}};Zw=I([m(1,F),m(2,Bi),m(3,Xe),m(4,wt),m(5,B),m(6,_e),m(7,X),m(8,Le),m(9,Te),m(10,nt),m(11,Xa),m(12,gr),m(13,Je),m(14,fe)],Zw);var K_i=class extends rs{async run(i){if(this.editor)return super.run(i,{groupId:this.editor.groupId,editorIndex:this.editor.group.getIndexOfEditor(this.editor.editor)})}},aot=class a{static{this.ITEM_HEIGHT=22}getHeight(i){return a.ITEM_HEIGHT}getTemplateId(i){return i instanceof Rh?_zt.ID:Tzt.ID}},Tzt=class a{constructor(i,e){this.keybindingService=i;this.instantiationService=e}static{this.ID="editorgroup"}get templateId(){return a.ID}renderTemplate(i){let e=Object.create(null);e.root=M(i,Ezt(".editor-group")),e.name=M(e.root,Ezt("span.name")),e.actionBar=new Zi(i);let t=this.instantiationService.createInstance(pNe,pNe.ID,pNe.LABEL),o=this.keybindingService.lookupKeybinding(t.id);e.actionBar.push(t,{icon:!0,label:!1,keybinding:o?o.getLabel():void 0});let n=this.instantiationService.createInstance(Gte,Gte.ID,Gte.LABEL),r=this.keybindingService.lookupKeybinding(n.id);return e.actionBar.push(n,{icon:!0,label:!1,keybinding:r?r.getLabel():void 0}),e}renderElement(i,e,t){t.editorGroup=i,t.name.textContent=i.label,t.actionBar.context={groupId:i.id}}disposeTemplate(i){i.actionBar.dispose()}},_zt=class a{constructor(i,e,t,o){this.labels=i;this.instantiationService=e;this.keybindingService=t;this.configurationService=o;this.closeEditorAction=this.instantiationService.createInstance(tee,tee.ID,tee.LABEL),this.unpinEditorAction=this.instantiationService.createInstance(x0,x0.ID,x0.LABEL)}static{this.ID="openeditor"}get templateId(){return a.ID}renderTemplate(i){let e=Object.create(null);return e.container=i,e.actionRunner=new K_i,e.actionBar=new Zi(i,{actionRunner:e.actionRunner}),e.root=this.labels.create(i),e}renderElement(i,e,t){let o=i.editor;t.actionRunner.editor=i,t.container.classList.toggle("dirty",o.isDirty()&&!o.isSaving()),t.container.classList.toggle("sticky",i.isSticky()),t.root.setResource({resource:po.getOriginalUri(o,{supportSideBySide:3}),name:o.getName(),description:o.getDescription(1)},{italic:i.isPreview(),extraClasses:["open-editor"].concat(i.editor.getLabelExtraClasses()),fileDecorations:this.configurationService.getValue().explorer.decorations,title:o.getTitle(2),icon:o.getIcon()});let n=i.isSticky()?this.unpinEditorAction:this.closeEditorAction;t.actionBar.hasAction(n)||(t.actionBar.isEmpty()||t.actionBar.clear(),t.actionBar.push(n,{icon:!0,label:!1,keybinding:this.keybindingService.lookupKeybinding(n.id)?.getLabel()}))}disposeTemplate(i){i.actionBar.dispose(),i.root.dispose(),i.actionRunner.dispose()}},kzt=class{constructor(i,e,t){this.instantiationService=e;this.editorGroupService=t;this._sortOrder=i}set sortOrder(i){this._sortOrder=i}get dropHandler(){return this.instantiationService.createInstance(a0,{allowWorkspaceOpen:!1})}getDragURI(i){if(i instanceof Rh){let e=i.getResource();if(e)return e.toString()}return null}getDragLabel(i){if(i.length>1)return String(i.length);let e=i[0];return e instanceof Rh?e.editor.getName():e.label}onDragStart(i,e){let t=i.elements,o=[];if(t)for(let n of t)n instanceof Rh&&o.push(n);o.length&&this.instantiationService.invokeFunction(tv,o,e)}onDragOver(i,e,t,o,n){if(i instanceof Cz&&!Ip(n,yl.FILES,hc.FILES))return!1;if(this._sortOrder!=="editorOrder")return i instanceof uw?!1:{accept:!0,effect:{type:1},feedback:[-1]};let r;switch(o){case 0:case 1:r=t===0&&e instanceof Wb?"drop-target-after":"drop-target-before";break;case 2:case 3:r="drop-target-after";break}return{accept:!0,effect:{type:1,position:r},feedback:[t]}}drop(i,e,t,o,n){let r=e instanceof Rh?e.group:e||this.editorGroupService.groups[this.editorGroupService.count-1],s=e instanceof Rh?e.group.getIndexOfEditor(e.editor):0;switch(o){case 0:case 1:e instanceof Wb&&r.index!==0&&(r=this.editorGroupService.groups[r.index-1],s=r.count);break;case 3:case 2:e instanceof Rh&&s++;break}if(i instanceof uw){for(let l of i.elements){let c=l.group.getIndexOfEditor(l.editor);l.group===r&&c<s&&s--,l.group.moveEditor(l.editor,r,{index:s,preserveFocus:!0}),s++}this.editorGroupService.activateGroup(r)}else this.dropHandler.handleDrop(n,ut,()=>r,()=>r.focus(),{index:s})}dispose(){}};I([hi],kzt.prototype,"dropHandler",1);var G_i=class{getWidgetAriaLabel(){return d(11135,null)}getAriaLabel(i){return i instanceof Rh?`${i.editor.getName()}, ${i.editor.getDescription()}`:i.ariaLabel}},ven="workbench.action.toggleEditorGroupLayout";W(class extends K{constructor(){super({id:"workbench.action.toggleEditorGroupLayout",title:L(11130,"Toggle Vertical/Horizontal Editor Layout"),f1:!0,keybinding:{primary:1557,mac:{primary:2581},weight:200},icon:R.editorLayout,menu:{id:D.ViewTitle,group:"navigation",when:C.and(C.equals("view",Zw.ID),SS),order:10}})}async run(a){let i=a.get(wt),e=i.orientation===1?0:1;i.setGroupOrientation(e),i.activeGroup.focus()}});ve.appendMenuItem(D.MenubarLayoutMenu,{group:"5_flip",command:{id:ven,title:{...L(11132,"Flip Layout"),mnemonicTitle:d(11131,null)}},order:1});W(class extends K{constructor(){super({id:"workbench.action.files.saveAll",title:ifo,f1:!0,icon:R.saveAll,menu:{id:D.ViewTitle,group:"navigation",when:C.equals("view",Zw.ID),order:20}})}async run(a){await a.get(ge).executeCommand(cNe)}});W(class extends K{constructor(){super({id:"openEditors.closeAll",title:Kpe.LABEL,f1:!1,icon:R.closeAll,menu:{id:D.ViewTitle,group:"navigation",when:C.equals("view",Zw.ID),order:30}})}async run(a){let i=a.get(F),e=new Kpe;await i.invokeFunction(t=>e.run(t))}});W(class extends K{constructor(){super({id:"openEditors.newUntitledFile",title:L(11133,"New Untitled Text File"),f1:!1,icon:R.newFile,menu:{id:D.ViewTitle,group:"navigation",when:C.equals("view",Zw.ID),order:5}})}async run(a){await a.get(ge).executeCommand(cW)}});var Afo=(a,i,e)=>{if(Array.isArray(i)){let t=a.get(Zt),o=a.get(Eo);i=i.map(n=>QCe(n)&&n.workspaceUri.scheme===Q.untitled?{workspaceUri:Ge(o.untitledWorkspacesHome,n.workspaceUri.path,B6i)}:n),t.openWindow(i,e)}},Nfo=(a,i)=>{a.get(Zt).openWindow(i)};Ct.registerCommandAndKeybindingRule({weight:200,when:lco,primary:2051,mac:{primary:259},id:J1t,handler:async(a,i)=>{let e=a.get(ee),t=a.get(fe),o=a.get(Oa),n=dW(i,a.get(Io),e,a.get(wt),o);if(n.length){let r=n.filter(p=>p.scheme===Q.untitled),s=n.filter(p=>p.scheme!==Q.untitled),u=(await Promise.all(s.map(async p=>{let h=o.findClosest(p);return h||await t.stat(p)}))).filter(p=>!p.isDirectory).map(p=>({resource:p.resource,options:{pinned:!0}})).concat(...r.map(p=>({resource:p,options:{pinned:!0}})));await e.openEditors(u,In)}}});Ct.registerCommandAndKeybindingRule({weight:210,when:C.and(px,Gd.toNegated()),primary:3,mac:{primary:2066},id:"explorer.openAndPassFocus",handler:async(a,i)=>{let e=a.get(ee),o=a.get(Oa).getContext(!0);o.length&&await e.openEditors(o.map(n=>({resource:n.resource,options:{preserveFocus:!1,pinned:!0}})))}});var q_i="showModifications",qte=[];Ct.registerCommandAndKeybindingRule({id:Yit,when:void 0,weight:200,primary:Vi(2089,34),handler:async(a,i)=>{let e=a.get(F),t=a.get(Bt),o=a.get(ee),n=a.get(fe),r=a.get(Io),s=!1;if(qte.length===0){s=!0;let c=e.createInstance(sM);qte.push(c),qte.push(t.registerTextModelContentProvider(q_i,c))}let l=jhe(i,o,r);if(l&&n.hasProvider(l)){let c=He(l),u=d(10948,null,c,c);try{await sM.open(l,q_i,u,o,{pinned:!0}),s&&qte.push(o.onDidVisibleEditorsChange(()=>{o.editors.some(p=>!!po.getCanonicalUri(p,{supportSideBySide:2,filterByScheme:q_i}))||(qte=Be(qte))}))}catch{qte=Be(qte)}}}});var j_i,$_i;$e.registerCommand({id:ezt,handler:(a,i)=>{j_i=jhe(i,a.get(ee),a.get(Io)),$_i||($_i=Zit.bindTo(a.get(X))),$_i.set(!0)}});$e.registerCommand({id:tzt,handler:async(a,i)=>{let e=a.get(ee),t=dW(i,a.get(Io),e,a.get(wt),a.get(Oa));return t.length===2?e.openEditor({original:{resource:t[0]},modified:{resource:t[1]},options:{pinned:!0}}):!0}});$e.registerCommand({id:izt,handler:(a,i)=>{let e=a.get(ee),t=jhe(i,e,a.get(Io));j_i&&t&&e.openEditor({original:{resource:j_i},modified:{resource:t},options:{pinned:!0}})}});async function Q_i(a,i,e,t,o){if(a.length){let n=ei?`\r
`:`
`,r,s=i?"explorer.copyRelativePathSeparator":"explorer.copyPathSeparator",l=o.getValue(s);(l==="/"||l==="\\")&&(r=l);let c=a.map(u=>t.getUriLabel(u,{relative:i,noPrefix:!0,separator:r})).join(n);await e.writeText(c)}}var Ofo=async(a,i)=>{let e=dW(i,a.get(Io),a.get(ee),a.get(wt),a.get(Oa));await Q_i(e,!1,a.get(Fi),a.get(rt),a.get(B))};Ct.registerCommandAndKeybindingRule({weight:200,when:pe.focus.toNegated(),primary:2593,win:{primary:1569},id:Ghe,handler:Ofo});Ct.registerCommandAndKeybindingRule({weight:200,when:pe.focus,primary:Vi(2089,2593),win:{primary:1569},id:Ghe,handler:Ofo});var Ffo=async(a,i)=>{let e=dW(i,a.get(Io),a.get(ee),a.get(wt),a.get(Oa));await Q_i(e,!0,a.get(Fi),a.get(rt),a.get(B))};Ct.registerCommandAndKeybindingRule({weight:200,when:pe.focus.toNegated(),primary:3617,win:{primary:Vi(2089,3105)},id:qhe,handler:Ffo});Ct.registerCommandAndKeybindingRule({weight:200,when:pe.focus,primary:Vi(2089,3617),win:{primary:Vi(2089,3105)},id:qhe,handler:Ffo});Ct.registerCommandAndKeybindingRule({weight:200,when:void 0,primary:Vi(2089,46),id:"workbench.action.files.copyPathOfActiveFile",handler:async a=>{let e=a.get(ee).activeEditor,t=po.getOriginalUri(e,{supportSideBySide:1});await Q_i(t?[t]:[],!1,a.get(Fi),a.get(rt),a.get(B))}});$e.registerCommand({id:lW,handler:async(a,i)=>{let e=a.get($t),t=a.get(Pe),o=a.get(Oa),n=a.get(ee),r=a.get(Io),s=jhe(i,n,r);if(s&&t.isInsideWorkspace(s)){let l=await e.openView(Fb,!1);if(l){let c=l.autoReveal;l.autoReveal=!1,l.setExpanded(!0),await o.select(s,"force"),l.focus(),l.autoReveal=c}}else{let l=e.getViewWithId(Zw.ID);l&&(l.setExpanded(!0),l.focus())}}});$e.registerCommand({id:Z1t,handler:async(a,i)=>{let e=a.get(ee),t=a.get(Io),o=jhe(i,e,t);if(o)return e.openEditor({resource:o,options:{override:0,source:1}})}});async function Y_i(a,i){let e=a.get(wt),t=a.get(qt),o=a.get(Uo),n=E_i(a);if(!n){let s=e.activeGroup;s.activeEditor&&(n=[],s.activeEditor instanceof Ma&&!i?.saveAs&&!(s.activeEditor.primary.hasCapability(4)||s.activeEditor.secondary.hasCapability(4))&&s.activeEditor.secondary.isModified()?(n.push({groupId:s.id,editor:s.activeEditor.primary}),n.push({groupId:s.id,editor:s.activeEditor.secondary})):n.push({groupId:s.id,editor:s.activeEditor}))}if(!n||n.length===0)return;await X_i(a,n,i);let r=t.getFocusedCodeEditor();if(r instanceof id&&!r.isSimpleWidget){let s=r.getModel()?.uri;s&&!n.some(({editor:l})=>Qe(po.getCanonicalUri(l,{supportSideBySide:1}),s))&&(o.files.get(s)?.isReadonly()||await o.save(s,i))}}function Wfo(a,i,e){let t=[];for(let o of i)for(let n of o.getEditors(0))n.isDirty()&&t.push({groupId:o.id,editor:n});return X_i(a,t,e)}async function X_i(a,i,e){let t=a.get(ee),o=a.get(Ne),n=a.get(F);try{await t.save(i,e)}catch(r){if(!ao(r)){let s=[ii({id:"workbench.action.files.saveEditors",label:d(10950,null),run:()=>n.invokeFunction(c=>X_i(c,i,e))})],l=i.filter(({editor:c})=>!c.hasCapability(4));l.length>0&&s.push(ii({id:"workbench.action.files.revertEditors",label:l.length>1?d(10952,null):d(10951,null),run:()=>t.revert(l)})),o.notify({id:i.map(({editor:c})=>_r(c.resource?.toString())).join(),severity:ft.Error,message:d(10947,null,i.map(({editor:c})=>c.getName()).join(", "),xn(r,!1)),actions:{primary:s}})}}}Ct.registerCommandAndKeybindingRule({when:void 0,weight:200,primary:2097,id:lNe,handler:a=>Y_i(a,{reason:1,force:!0})});Ct.registerCommandAndKeybindingRule({when:void 0,weight:200,primary:Vi(2089,49),win:{primary:Vi(2089,3121)},id:nzt,handler:a=>Y_i(a,{reason:1,force:!0,skipSaveParticipants:!0})});Ct.registerCommandAndKeybindingRule({id:Xit,weight:200,when:void 0,primary:3121,handler:a=>Y_i(a,{reason:1,saveAs:!0})});Ct.registerCommandAndKeybindingRule({when:void 0,weight:200,primary:void 0,mac:{primary:2609},win:{primary:Vi(2089,49)},id:cNe,handler:a=>Wfo(a,a.get(wt).getGroups(1),{reason:1})});$e.registerCommand({id:$he,handler:(a,i,e)=>{let t=a.get(wt),o=Dp([e],a.get(ee),t,a.get(Io)),n;return o.groupedEditors.length?n=o.groupedEditors.map(({group:r})=>r):n=t.getGroups(1),Wfo(a,n,{reason:1})}});$e.registerCommand({id:rzt,handler:async a=>(await a.get(ee).saveAll({includeUntitled:!1,reason:1})).success});$e.registerCommand({id:aNe,handler:async a=>{let i=a.get(wt),e=a.get(ee),t=E_i(a);if(!t){let o=i.activeGroup;o.activeEditor&&(t=[{groupId:o.id,editor:o.activeEditor}])}if(!(!t||t.length===0))try{await e.revert(t.filter(({editor:o})=>!o.hasCapability(4)),{force:!0})}catch(o){a.get(Ne).error(d(10946,null,t.map(({editor:r})=>r.getName()).join(", "),xn(o,!1)))}}});$e.registerCommand({id:azt,handler:(a,i)=>{let e=a.get(Pe),t=a.get(ht),o=e.getWorkspace(),n=dW(i,a.get(Io),a.get(ee),a.get(wt),a.get(Oa)).filter(s=>o.folders.some(l=>t.extUri.isEqual(l.uri,s)));return n.length===0?a.get(ge).executeCommand(XXe.ID):a.get(Db).removeFolders(n)}});Ct.registerCommandAndKeybindingRule({weight:210,when:C.and(px,Wpe,uJe.negate()),primary:15,id:nfo,handler:a=>{let e=a.get(us).getActivePaneComposite(0);if(e?.getId()!==nv)return;e.getViewPaneContainer().getExplorerView().previousCompressedStat()}});Ct.registerCommandAndKeybindingRule({weight:210,when:C.and(px,Wpe,pJe.negate()),primary:17,id:rfo,handler:a=>{let e=a.get(us).getActivePaneComposite(0);if(e?.getId()!==nv)return;e.getViewPaneContainer().getExplorerView().nextCompressedStat()}});Ct.registerCommandAndKeybindingRule({weight:210,when:C.and(px,Wpe,uJe.negate()),primary:14,id:sfo,handler:a=>{let e=a.get(us).getActivePaneComposite(0);if(e?.getId()!==nv)return;e.getViewPaneContainer().getExplorerView().firstCompressedStat()}});Ct.registerCommandAndKeybindingRule({weight:210,when:C.and(px,Wpe,pJe.negate()),primary:13,id:afo,handler:a=>{let e=a.get(us).getActivePaneComposite(0);if(e?.getId()!==nv)return;e.getViewPaneContainer().getExplorerView().lastCompressedStat()}});Ct.registerCommandAndKeybindingRule({weight:200,when:null,primary:Wt?ei?Vi(2089,44):2604:2092,secondary:Wt?[2092]:void 0,id:cW,metadata:{description:lzt,args:[{isOptional:!0,name:"New Untitled Text File arguments",description:"The editor view type or language ID if known",schema:{type:"object",properties:{viewType:{type:"string"},languageId:{type:"string"}}}}]},handler:async(a,i)=>{await a.get(ee).openEditor({resource:void 0,options:{override:i?.viewType,pinned:!0},languageId:i?.languageId})}});$e.registerCommand({id:lfo,handler:async(a,i)=>{let e=a.get(ee),t=a.get(rn),o=a.get(fe),n=d(10949,null),r=Ge(await t.defaultFilePath(),i?.fileName??"Untitled.txt"),s=await t.showSaveDialog({saveLabel:n,title:n,defaultUri:r});s&&(await o.createFile(s,void 0,{overwrite:!0}),await e.openEditor({resource:s,options:{override:i?.viewType,pinned:!0},languageId:i?.languageId}))}});W(hzt);W(gzt);W(fzt);W(Szt);W(bzt);W(iot);W(vzt);W(Izt);W(yzt);W(wzt);W(Czt);$e.registerCommand("_files.windowOpen",Afo);$e.registerCommand("_files.newWindow",Nfo);var B8=10,Vfo="renameFile";Ct.registerCommandAndKeybindingRule({id:Vfo,weight:200+B8,when:C.and(px,ux.toNegated(),y0),primary:60,mac:{primary:3},handler:Cfo});var Bfo="moveFileToTrash";Ct.registerCommandAndKeybindingRule({id:Bfo,weight:200+B8,when:C.and(px,Fpe),primary:20,mac:{primary:2049,secondary:[20]},handler:xfo});var Dzt="deleteFile";Ct.registerCommandAndKeybindingRule({id:Dzt,weight:200+B8,when:px,primary:1044,mac:{primary:2561},handler:A_i});Ct.registerCommandAndKeybindingRule({id:Dzt,weight:200+B8,when:C.and(px,Fpe.toNegated()),primary:20,mac:{primary:2049},handler:A_i});var Hfo="filesExplorer.cut";Ct.registerCommandAndKeybindingRule({id:Hfo,weight:200+B8,when:C.and(px,ux.toNegated(),y0),primary:2102,handler:Efo});var Ufo="filesExplorer.copy";Ct.registerCommandAndKeybindingRule({id:Ufo,weight:200+B8,when:C.and(px,ux.toNegated()),primary:2081,handler:kfo});var J_i="filesExplorer.paste";$e.registerCommand(J_i,Tfo);Ct.registerKeybindingRule({id:`^${J_i}`,weight:200+B8,when:C.and(px,y0),primary:2100});Ct.registerCommandAndKeybindingRule({id:"filesExplorer.cancelCut",weight:200+B8,when:C.and(px,NFt),primary:9,handler:async a=>{await a.get(Oa).setToCopy([],!0)}});Ct.registerCommandAndKeybindingRule({id:"filesExplorer.openFilePreserveFocus",weight:200+B8,when:C.and(px,Gd.toNegated()),primary:10,handler:_fo});var lot={id:Ghe,title:d(10919,null)},cot={id:qhe,title:d(10921,null)},fNe={id:lW,title:d(10939,null)};dot(Ghe,lot.title,Wo.IsFileSystemResource,"1_cutcopypaste",!0);dot(qhe,cot.title,Wo.IsFileSystemResource,"1_cutcopypaste",!0);dot(fNe.id,fNe.title,Wo.IsFileSystemResource,"2_files",!1,1);function dot(a,i,e,t,o,n){let r=o!==!0?o4.negate():void 0;ve.appendMenuItem(D.EditorTitleContext,{command:{id:a,title:i,precondition:r},when:e,group:t,order:n})}zfo("workbench.files.action.acceptLocalChanges",d(10908,null),R.check,-10,Lfo);zfo("workbench.files.action.revertLocalChanges",d(10942,null),R.discard,-9,Rfo);function zfo(a,i,e,t,o){$e.registerCommand(a,o),ve.appendMenuItem(D.EditorTitle,{command:{id:a,title:i,icon:e},when:C.equals(U_i,!0),group:"navigation",order:t})}function TM({id:a,title:i,category:e,metadata:t},o){ve.appendMenuItem(D.CommandPalette,{command:{id:a,title:i,category:e,metadata:t},when:o})}TM({id:Ghe,title:L(10920,"Copy Path of Active File"),category:Ve.File});TM({id:qhe,title:L(10922,"Copy Relative Path of Active File"),category:Ve.File});TM({id:lNe,title:x_i,category:Ve.File});TM({id:nzt,title:tfo,category:Ve.File});TM({id:$he,title:L(10944,"Save All in Group"),category:Ve.File});TM({id:rzt,title:L(10945,"Save All Files"),category:Ve.File});TM({id:aNe,title:L(10940,"Revert File"),category:Ve.File});TM({id:Yit,title:L(10913,"Compare Active File with Saved"),category:Ve.File,metadata:{description:L(10914,"Opens a new diff editor to compare the active file with the version on disk.")}});TM({id:Xit,title:ozt,category:Ve.File});TM({id:Yhe,title:D_i,category:Ve.File},sT.notEqualsTo("0"));TM({id:hNe,title:L_i,category:Ve.File,metadata:{description:L(10935,"Create a new folder or directory")}},sT.notEqualsTo("0"));TM({id:cW,title:lzt,category:Ve.File});var Z_i=C.or(Wo.IsFileSystemResource,Wo.Scheme.isEqualTo(Q.untitled)),Lzt={id:J1t,title:d(10937,null)};ve.appendMenuItem(D.OpenEditorsContext,{group:"navigation",order:10,command:Lzt,when:Z_i});ve.appendMenuItem(D.OpenEditorsContext,{group:"1_open",order:10,command:{id:LLe,title:d(10938,null)},when:C.and(MF,F8.toNegated())});ve.appendMenuItem(D.OpenEditorsContext,{group:"1_cutcopypaste",order:10,command:lot,when:Wo.IsFileSystemResource});ve.appendMenuItem(D.OpenEditorsContext,{group:"1_cutcopypaste",order:20,command:cot,when:Wo.IsFileSystemResource});ve.appendMenuItem(D.OpenEditorsContext,{group:"2_save",order:10,command:{id:lNe,title:x_i,precondition:dNe},when:C.or(Wo.Scheme.isEqualTo(Q.untitled),C.and(F8.toNegated(),Jit.toNegated(),b6e.toNegated()))});ve.appendMenuItem(D.OpenEditorsContext,{group:"2_save",order:20,command:{id:aNe,title:d(10941,null),precondition:dNe},when:C.and(F8.toNegated(),Jit.toNegated(),Wo.Scheme.notEqualsTo(Q.untitled),b6e.toNegated())});ve.appendMenuItem(D.OpenEditorsContext,{group:"2_save",order:30,command:{id:$he,title:d(10943,null),precondition:k6e},when:F8});ve.appendMenuItem(D.OpenEditorsContext,{group:"3_compare",order:10,command:{id:Yit,title:d(10917,null),precondition:dNe},when:C.and(Wo.IsFileSystemResource,b6e.toNegated(),oB.toNegated())});var Kfo={id:izt,title:d(10918,null)};ve.appendMenuItem(D.OpenEditorsContext,{group:"3_compare",order:20,command:Kfo,when:C.and(Wo.HasResource,Zit,Z_i,oB.toNegated())});var Gfo={id:ezt,title:d(10916,null)};ve.appendMenuItem(D.OpenEditorsContext,{group:"3_compare",order:30,command:Gfo,when:C.and(Wo.HasResource,Z_i,oB.toNegated())});var eDi={id:tzt,title:d(10915,null)};ve.appendMenuItem(D.OpenEditorsContext,{group:"3_compare",order:30,command:eDi,when:C.and(Wo.HasResource,oB,szt)});ve.appendMenuItem(D.EditorTitleContext,{group:"1_compare",order:30,command:eDi,when:C.and(Wo.HasResource,HDt,UDt)});ve.appendMenuItem(D.OpenEditorsContext,{group:"4_close",order:10,command:{id:dx,title:d(10909,null)},when:F8.toNegated()});ve.appendMenuItem(D.OpenEditorsContext,{group:"4_close",order:20,command:{id:DLe,title:d(10911,null)},when:F8.toNegated()});ve.appendMenuItem(D.OpenEditorsContext,{group:"4_close",order:30,command:{id:Ope,title:d(10912,null)}});ve.appendMenuItem(D.OpenEditorsContext,{group:"4_close",order:40,command:{id:C3,title:d(10910,null)}});ve.appendMenuItem(D.ExplorerContext,{group:"navigation",order:4,command:{id:Yhe,title:D_i,precondition:y0},when:Gd});ve.appendMenuItem(D.ExplorerContext,{group:"navigation",order:6,command:{id:hNe,title:L_i,precondition:y0},when:Gd});ve.appendMenuItem(D.ExplorerContext,{group:"navigation",order:10,command:Lzt,when:C.and(Gd.toNegated(),Wo.HasResource)});ve.appendMenuItem(D.ExplorerContext,{group:"navigation",order:20,command:{id:Z1t,title:d(10925,null)},when:C.and(Gd.toNegated(),AFt)});ve.appendMenuItem(D.ExplorerContext,{group:"3_compare",order:20,command:Kfo,when:C.and(Gd.toNegated(),Wo.HasResource,Zit,oB.toNegated())});ve.appendMenuItem(D.ExplorerContext,{group:"3_compare",order:30,command:Gfo,when:C.and(Gd.toNegated(),Wo.HasResource,oB.toNegated())});ve.appendMenuItem(D.ExplorerContext,{group:"3_compare",order:30,command:eDi,when:C.and(Gd.toNegated(),Wo.HasResource,oB)});ve.appendMenuItem(D.ExplorerContext,{group:"5_cutcopypaste",order:8,command:{id:Hfo,title:d(10923,null)},when:C.and(ux.toNegated(),y0)});ve.appendMenuItem(D.ExplorerContext,{group:"5_cutcopypaste",order:10,command:{id:Ufo,title:gfo},when:ux.toNegated()});ve.appendMenuItem(D.ExplorerContext,{group:"5_cutcopypaste",order:20,command:{id:J_i,title:ffo,precondition:C.and(y0,xzt)},when:Gd});ve.appendMenuItem(D.ExplorerContext,{group:"5b_importexport",order:10,command:{id:R_i,title:vfo},when:C.or(C.and(Fu.toNegated(),Wo.Scheme.notEqualsTo(Q.file)),C.and(Fu,Gd.toNegated(),ux.toNegated()),C.and(Fu,NDt))});ve.appendMenuItem(D.ExplorerContext,{group:"5b_importexport",order:20,command:{id:M_i,title:bfo},when:C.and(Fu,Gd,y0)});ve.appendMenuItem(D.ExplorerContext,{group:"6_copypath",order:10,command:lot,when:Wo.IsFileSystemResource});ve.appendMenuItem(D.ExplorerContext,{group:"6_copypath",order:20,command:cot,when:Wo.IsFileSystemResource});ve.appendMenuItem(D.ExplorerContext,{group:"2_workspace",order:10,command:{id:mLe,title:tFt},when:C.and(ux,C.or(iD,za.isEqualTo("workspace")))});ve.appendMenuItem(D.ExplorerContext,{group:"2_workspace",order:30,command:{id:azt,title:ofo},when:C.and(ux,Gd,C.and(sT.notEqualsTo("0"),C.or(iD,za.isEqualTo("workspace"))))});ve.appendMenuItem(D.ExplorerContext,{group:"7_modification",order:10,command:{id:Vfo,title:mfo,precondition:y0},when:ux.toNegated()});ve.appendMenuItem(D.ExplorerContext,{group:"7_modification",order:20,command:{id:Bfo,title:hfo},alt:{id:Dzt,title:d(10924,null)},when:C.and(ux.toNegated(),Fpe)});ve.appendMenuItem(D.ExplorerContext,{group:"7_modification",order:20,command:{id:Dzt,title:d(10924,null)},when:C.and(ux.toNegated(),Fpe.toNegated())});for(let a of[D.EmptyEditorGroupContext,D.EditorTabsBarContext])ve.appendMenuItem(a,{command:{id:cW,title:d(10934,null)},group:"1_file",order:10}),ve.appendMenuItem(a,{command:{id:"workbench.action.quickOpen",title:d(10936,null)},group:"1_file",order:20});ve.appendMenuItem(D.MenubarFileMenu,{group:"1_new",command:{id:cW,title:d(10929,null)},order:1});ve.appendMenuItem(D.MenubarFileMenu,{group:"4_save",command:{id:lNe,title:d(10931,null),precondition:C.or(fr,C.and(D3,kB))},order:1});ve.appendMenuItem(D.MenubarFileMenu,{group:"4_save",command:{id:Xit,title:d(10933,null),precondition:C.or(fr,C.and(D3,kB))},order:2});ve.appendMenuItem(D.MenubarFileMenu,{group:"4_save",command:{id:cNe,title:d(10932,null),precondition:k6e},order:3});ve.appendMenuItem(D.MenubarFileMenu,{group:"5_autosave",command:{id:iot.ID,title:d(10926,null),toggled:C.notEquals("config.files.autoSave","off")},order:1});ve.appendMenuItem(D.MenubarFileMenu,{group:"6_close",command:{id:aNe,title:d(10930,null),precondition:C.or(C.and(VDt),C.and(Wo.Scheme.notEqualsTo(Q.untitled),D3,kB))},order:1});ve.appendMenuItem(D.MenubarFileMenu,{group:"6_close",command:{id:dx,title:d(10927,null),precondition:C.or(fr,C.and(D3,kB))},order:2});ve.appendMenuItem(D.MenubarGoMenu,{group:"3_global_nav",command:{id:"workbench.action.quickOpen",title:d(10928,null)},order:1});ve.appendMenuItem(D.ChatAttachmentsContext,{group:"navigation",order:10,command:Lzt,when:C.and(Wo.IsFileSystemResource,Gd.toNegated())});ve.appendMenuItem(D.ChatAttachmentsContext,{group:"navigation",order:20,command:fNe,when:Wo.IsFileSystemResource});ve.appendMenuItem(D.ChatAttachmentsContext,{group:"1_cutcopypaste",order:10,command:lot,when:Wo.IsFileSystemResource});ve.appendMenuItem(D.ChatAttachmentsContext,{group:"1_cutcopypaste",order:20,command:cot,when:Wo.IsFileSystemResource});for(let a of[D.ChatInlineResourceAnchorContext,D.ChatInputResourceAttachmentContext])ve.appendMenuItem(a,{group:"navigation",order:10,command:Lzt,when:C.and(Wo.HasResource,Gd.toNegated())}),ve.appendMenuItem(a,{group:"navigation",order:20,command:fNe,when:Wo.IsFileSystemResource}),ve.appendMenuItem(a,{group:"1_cutcopypaste",order:10,command:lot,when:Wo.IsFileSystemResource}),ve.appendMenuItem(a,{group:"1_cutcopypaste",order:20,command:cot,when:Wo.IsFileSystemResource});function pot(a){return Array.isArray(a.repositories)&&Array.isArray(a.visibleRepositories)}function Ad(a){return!!a.provider&&!!a.input}function aN(a){return!!a.validateInput&&typeof a.value=="string"}function lN(a){return a.type==="actionButton"}function Ny(a){return!!a.provider&&!!a.resources}function cN(a){return!!a.sourceUri&&Ny(a.resourceGroup)}function H8(a){return fm.isResourceNode(a)&&Ny(a.context)}function dN(a){return a.type==="historyItemViewModel"}function vNe(a){return a.type==="historyItemLoadMore"}function U8(a){return a.type==="historyItemChangeViewModel"}function bNe(a){return fm.isResourceNode(a)&&dN(a.context)}function QH(a){return a.type==="artifactGroup"}function z8(a){return fm.isResourceNode(a)&&QH(a.context)}function _M(a){return a.type==="artifact"}var qfo=(a,i)=>a instanceof Lo&&i instanceof Lo?a.id===i.id&&a.enabled===i.enabled&&a.hideActions?.isHidden===i.hideActions?.isHidden:a.id===i.id&&a.enabled===i.enabled;function $te(a,i,e,t){let o=[],n=[],r=()=>{let{primary:s,secondary:l}=ml(a.getActions({arg:t,shouldForwardArgs:!0}),e);$i(o,s,qfo)&&$i(n,l,qfo)||(o=s,n=l,i(s,l))};return r(),a.onDidChange(r)}function K8(a,i){return zp(a.getActions({arg:i,shouldForwardArgs:!0}),"inline").secondary}var uot=class extends it{constructor(e,t){super(`statusbaraction{${e.id}}`,iDi(e),"",!0);this.command=e;this.commandService=t;this.commandTitle=e.title,this.tooltip=e.tooltip||""}run(){return this.commandService.executeCommand(this.command.id,...this.command.arguments||[])}},tDi=class extends hs{constructor(i,e){super(null,i,{...e,icon:!1,label:!0}),this._commandTitle=i.commandTitle}render(i){i.classList.add("scm-status-bar-action"),super.render(i)}updateLabel(){if(this.options.label&&this.label){let i=Un(this._commandTitle??this.action.label).map(e=>{if(typeof e=="string"){let t=document.createElement("span");return t.textContent=e,t}return e});vi(this.label,...i)}}};function jte(a){return(i,e)=>i instanceof uot?new tDi(i,e):Bs(a,i,e)}function G8(a){return`${a.providerId}:${a.label}${a.rootUri?`:${a.rootUri.toString()}`:""}`}function Rzt(a){return a.groups.reduce((i,e)=>i+e.resources.length,0)}function Mzt(a){return`${a.displayId??a.id} - ${a.subject}`}function Pzt(a,i){return q.isThemeIcon(i.provider.iconPath)?a?.pinned===!0&&a?.repository.id===i.id&&i.provider.iconPath.id===R.repo.id?R.repoPinned:i.provider.iconPath:R.repo}function iDi(a){let i;if(typeof a.arguments?.[0]=="string"){let e=a.arguments[0].lastIndexOf("/");if(i=e!==-1?a.arguments[0].substring(0,e):a.arguments[0],i=i.replace(/^(?:git\.|remoteHub\.)/,"").trim(),i.length===0)return;i=i[0].toLocaleUpperCase()+i.slice(1)}return i}async function $fo(a,i){let e=[];for(let n of a.response.value)if(n.kind==="toolInvocation"||n.kind==="toolInvocationSerialized"){let r=mot(n,a.sessionResource);e.push(...r);let s=await ben(n,i);e.push(...s)}else if(n.kind==="inlineReference"){let r=await Ien(n,i);r&&e.push(r)}let t=a.session.getItems().find(n=>Sr(n)&&n.id===a.requestId),o=t?t.messageText:d(8195,null);return{id:a.sessionResource.toString()+"_"+a.id,title:o,images:e}}function mot(a,i){let e=[],t=Pi.resultDetails(a),o=a.pastTenseMessage??a.invocationMessage,n=o?typeof o=="string"?o:o.value:void 0,r=(s,l,c)=>{let u=yP(s),p=u?`file${u}`:"file.bin",h=CT.createUri(i,a.toolCallId,c,p);e.push({id:`${a.toolCallId}_${c}`,uri:h,name:d(8196,null,e.length+1),mimeType:s,data:l,source:d(8198,null,a.toolId),caption:n})};if(cD(t))for(let s=0;s<t.output.length;s++){let l=t.output[s];l.type==="embed"&&l.mimeType?.startsWith("image/")&&!l.isText&&r(l.mimeType,qa(l.value),s)}else if(_B(t)){let s=t.output;if(s.mimeType?.startsWith("image/")){let l=Sen(t,a);l&&r(s.mimeType,l,0)}}return e}async function ben(a,i){let e=a.pastTenseMessage??a.invocationMessage;if(!e||typeof e=="string"||!e.uris||Object.keys(e.uris).length===0)return[];let t=[];for(let o of Object.values(e.uris)){let n=A.revive(o),r=GI(n.path);if(r?.startsWith("image/")){let s;try{s=await i(n)}catch{continue}let l=n.path.split("/").pop()??"image";t.push({id:n.toString(),uri:n,name:l,mimeType:r,data:s,source:d(8198,null,a.toolId),caption:e.value})}}return t}function Sen(a,i){if(i.kind==="toolInvocationSerialized"){let e=a;return e.output.base64Data?qa(e.output.base64Data):void 0}else return a.output.value}async function Ien(a,i){let e=a.inlineReference,t=A.isUri(e)?e:lf(e)?e.uri:e.location.uri,o=GI(t.path);if(!o?.startsWith("image/"))return;let n;try{n=await i(t)}catch{return}let r=a.name??t.path.split("/").pop()??"image";return{id:t.toString(),uri:t,name:r,mimeType:o,data:n,source:d(8197,null),caption:void 0}}function oDi(a){return a instanceof Uint8Array?a:a instanceof ArrayBuffer?new Uint8Array(a):a&&typeof a=="object"&&!Array.isArray(a)?new Uint8Array(Object.keys(a).sort((i,e)=>Number(i)-Number(e)).map(i=>a[i])):void 0}function nDi(a){let i=[];for(let e of a.variables){if(!bk(e))continue;let t=oDi(e.value);if(!t)continue;let o=e.mimeType??GI(e.name)??"image/png",n=e.references?.[0]?.reference,r=A.isUri(n)?n:A.from({scheme:"data",path:e.name});i.push({id:r.toString(),uri:r,name:e.name,mimeType:o,data:qe.wrap(t),source:d(8199,null),caption:void 0})}return i}var Qte=le("chatImageCarouselService");async function yen(a,i){let e=[],t=new Map;for(let n of a)Sr(n)&&t.set(n.id,n);for(let n of a){if(!Ui(n))continue;let{title:r,images:s}=await $fo(n,async h=>qe.wrap(await i(h))),l=t.get(n.requestId),u=[...l?nDi(l):[],...s],p=jfo(u);p.length>0&&e.push({title:l?.messageText??r,images:p.map(({uri:h,name:g,mimeType:f,data:v,caption:b})=>({id:h.toString(),name:g,mimeType:f,data:v.buffer,caption:b}))})}let o=new Set(a.filter(Ui).map(n=>n.requestId));for(let n of a){if(!Sr(n)||o.has(n.id))continue;let r=nDi(n),s=jfo(r);s.length>0&&e.push({title:n.messageText,images:s.map(({uri:l,name:c,mimeType:u,data:p,caption:h})=>({id:l.toString(),name:c,mimeType:u,data:p.buffer,caption:h}))})}return e}function jfo(a){return a.filter((i,e)=>e===0?!0:!Qe(a[e-1].uri,i.uri))}function wen(a,i,e){let t=0;for(let o of a){let n=Cen(o.images,i);if(n>=0)return t+n;t+=o.images.length}if(!e)return-1;t=0;for(let o of a){let n=xen(o.images,e);if(n>=0)return t+n;t+=o.images.length}return-1}function Cen(a,i){let e=i.toString(),t=a.findIndex(n=>n.id===e);if(t>=0)return t;let o=a.findIndex(n=>{try{return Qe(A.parse(n.id),i)}catch{return!1}});return o>=0?o:-1}function xen(a,i){let e=qe.wrap(i);return a.findIndex(t=>qe.wrap(t.data).equals(e))}function ken(a,i,e){let t=e.toString()+"_carousel",o=d(6998,null);return{collection:{id:t,title:a.length===1&&a[0].title||o,sections:a},startIndex:i}}function Een(a,i){let e=a.path.split("/").pop()??"image",t=GI(a.path)??GI(e)??"image/png";return{name:e,mimeType:t,data:i,title:e}}var Qfo="workbench.action.chat.openImageInCarousel",SNe=class{constructor(i,e,t){this.chatWidgetService=i;this.commandService=e;this.fileService=t}async openCarouselAtResource(i,e){let t=this.chatWidgetService.lastFocusedWidget;if(!t?.viewModel){await this.openSingleImage(i,e);return}let o=t.viewModel.getItems().filter(c=>Sr(c)||Ui(c)),r=await yen(o,async c=>(await this.fileService.readFile(c)).value.buffer),s=wen(r,i,e);if(s===-1||r.length===0){await this.openSingleImage(i,e);return}let l=ken(r,s,t.viewModel.sessionResource);await this.commandService.executeCommand(Qfo,l)}async openSingleImage(i,e){e||(e=(await this.fileService.readFile(i)).value.buffer);let t=Een(i,e);await this.commandService.executeCommand(Qfo,t)}};SNe=I([m(0,Pt),m(1,ge),m(2,fe)],SNe);var q8={style:1,position:{hoverPosition:2},trapFocus:!0},cie={groupId:"chat-attachments"},Yfo=["display","position","margin","padding","font-size","font-family","color","background-color"],qk=class extends x{constructor(e,t,o,n,r,s,l,c,u){super();this.attachment=e;this.options=t;this.currentLanguageModel=r;this.commandService=s;this.openerService=l;this.configurationService=c;this.terminalService=u;this._onDidDelete=this._register(new E);this._onDidOpen=this._register(new E);this._hasClearButton=!1;this.element=M(o,_(".chat-attached-context-attachment.show-file-icons")),this.attachClearButton(),this.label=n.create(this.element,{supportIcons:!0,hoverTargetOverride:this.element}),this._register(this.label),this.element.tabIndex=0,this.element.role="button",this._register(j(this.element,re.AUXCLICK,p=>{p.button===1&&this.options.supportsDeletion&&!this.attachment.range&&(p.preventDefault(),p.stopPropagation(),this._onDidDelete.fire(p))}))}get onDidDelete(){return this._onDidDelete.event}get onDidOpen(){return this._onDidOpen.event}modelSupportsVision(){return Xfo(this.currentLanguageModel)}appendDeletionHint(e){return this._hasClearButton?d(6447,null,e):e}attachClearButton(){if(this.attachment.range||!this.options.supportsDeletion)return;this._hasClearButton=!0;let e=new Wi(this.element,{supportIcons:!0,hoverDelegate:Qh(),title:d(6446,null)});e.element.tabIndex=-1,e.icon=R.close,this._register(e),this._register(U.once(e.onDidClick)(t=>{this._onDidDelete.fire(t)})),this._register(Jo(this.element,re.KEY_DOWN,t=>{(t.keyCode===1||t.keyCode===20)&&(t.preventDefault(),t.stopPropagation(),this._onDidDelete.fire(t.browserEvent))}))}addResourceOpenHandlers(e,t){this.element.style.cursor="pointer",this._register(Qit(this.element,async o=>{this.attachment.kind==="directory"?await this.openResource(e,o,!0):await this.openResource(e,o,!1,t)}))}async openResource(e,t,o,n){if(o){this.commandService.executeCommand(fNe.id,e);return}if(e.scheme===Q.vscodeTerminal){this.terminalService?.openResource(e);return}let r=n?{selection:n}:void 0,s={fromUserGesture:!0,openToSide:t.openToSide,editorOptions:{...r,...t.editorOptions}};await this.openerService.open(e,s),this._onDidOpen.fire(),this.element.focus()}};qk=I([m(5,ge),m(6,Je),m(7,B),m(8,nn)],qk);function Xfo(a){return a?.metadata.capabilities?.vision??!1}var Yte=class extends qk{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super(o,s,l,c,r,u,p,h);this.themeService=g;this.hoverService=f;this.languageModelsService=v;this.instantiationService=b;let S=jo(e.path),y=ad(e.path),w=`${S} ${y}`,k=t?d(6459,null,w,t.startLineNumber,t.endLineNumber):d(6457,null,w);if(o.omittedState===2)k=d(6468,null,o.name),this.renderOmittedWarning(w,k);else{let T={hidePath:!0,title:n?.options?.status?.description};this.label.setFile(e,o.kind==="file"?{...T,fileKind:0,range:t}:{...T,fileKind:1,icon:this.themeService.getFileIconTheme().hasFolderIcons?void 0:wj})}this.element.ariaLabel=this.appendDeletionHint(k),this.instantiationService.invokeFunction(T=>{this._register(hot(T,this.element,e))}),this.addResourceOpenHandlers(e,t)}renderOmittedWarning(e,t){let o=_("div.chat-attached-context-pill",{},_("span.codicon.codicon-warning")),n=_("span.chat-attached-context-custom-text",{},e);this.element.appendChild(o),this.element.appendChild(n);let r=_("div.chat-attached-context-hover");r.setAttribute("aria-label",t),this.element.classList.add("warning"),r.textContent=d(6458,null,this.currentLanguageModel?this.languageModelsService.lookupLanguageModel(this.currentLanguageModel.identifier)?.name:this.currentLanguageModel??"This model"),this._register(this.hoverService.setupDelayedHover(this.element,{...q8,content:r},cie))}};Yte=I([m(8,ge),m(9,Je),m(10,B),m(11,Le),m(12,nt),m(13,ds),m(14,F)],Yte);var Xte=class extends qk{constructor(e,t,o,n,r,s,l,c,u,p){super(e,o,n,r,t,s,l,c,p);this.hoverService=u;this.terminalService=p;let h=d(6474,null,e.command),g=()=>this.openResource(e.resource,{editorOptions:{preserveFocus:!0}},!1,void 0);this._register(Ten(this.element,e,h,this.hoverService,g)),this._register(j(this.element,re.KEY_DOWN,async f=>{let v=new gi(f);(v.equals(3)||v.equals(10))&&(Xt.stop(f,!0),await g())})),this.element.ariaLabel=this.appendDeletionHint(h)}};Xte=I([m(5,ge),m(6,Je),m(7,B),m(8,nt),m(9,nn)],Xte);function Ten(a,i,e,t,o){let n=new N;a.ariaLabel=e,a.style.cursor="pointer";let r=_("span");r.classList.add(...q.asClassNameArray(R.terminal));let s=_("div.chat-attached-context-pill",{},r),l=_("span.chat-attached-context-custom-text",{},i.command);return a.appendChild(s),a.appendChild(l),n.add(j(a,re.CLICK,c=>{c.preventDefault(),c.stopPropagation(),o()})),n.add(t.setupDelayedHover(a,()=>_en(e,i),cie)),n}function _en(a,i){{let e=_("div.chat-attached-context-hover");e.setAttribute("aria-label",a);let t=_("div",{},typeof i.exitCode=="number"?d(6476,null,i.command,i.exitCode):d(6475,null));t.classList.add("attachment-additional-info");let o=_("pre.chat-terminal-command-block");if(e.append(t,o),i.output&&i.output.trim().length>0){let n=_("div",{},d(6477,null));n.classList.add("attachment-additional-info");let r=_("pre.chat-terminal-command-output"),s=i.output.split(`
`),l=[];for(let c of s){if(l.length>=5){l.push("...");break}let u=c.trim();u.length!==0&&(u.length>80?l.push(`${u.slice(0,80)}...`):l.push(u))}r.textContent=l.join(`
`),e.append(n,r)}return{...q8,content:e}}}var Jte=class extends qk{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super(t,n,r,s,o,l,c,u);this.hoverService=p;this.languageModelsService=h;this.labelService=f;this.chatEntitlementService=v;this.chatImageCarouselService=b;let S;t.omittedState===2?S=d(6469,null,t.name):t.omittedState===1?S=d(6471,null,t.name):t.omittedState===3?S=d(6464,null,t.name):S=d(6460,null,t.name);let y=t.references?.[0]?.reference;e=y&&A.isUri(y)?y:void 0;let w=oDi(t.value),k=async()=>{(e||w)&&u.getValue("imageCarousel.chat.enabled")?await this.openInCarousel(t.name,w,e):e&&await this.openResource(e,{editorOptions:{preserveFocus:!0}},!1,void 0)},T=this.currentLanguageModel?this.languageModelsService.lookupLanguageModel(this.currentLanguageModel.identifier)?.name??this.currentLanguageModel.identifier:"Current model",P=e?this.labelService.getUriLabel(e):t.fullName||t.name;this._register(Jfo(e,t.name,P,this.element,w??t.value,this.hoverService,S,T,k,this.currentLanguageModel,t.omittedState,this.chatEntitlementService.previewFeaturesDisabled)),this.element.ariaLabel=this.appendDeletionHint(S),(w&&u.getValue("imageCarousel.chat.enabled")||e)&&(this.element.style.cursor="pointer",this._register(Qit(this.element,async()=>{await k()}))),e&&g.invokeFunction(V=>{this._register(hot(V,this.element,e))})}async openInCarousel(e,t,o){let n=o??A.from({scheme:"data",path:e});await this.chatImageCarouselService.openCarouselAtResource(n,t)}};Jte=I([m(6,ge),m(7,Je),m(8,B),m(9,nt),m(10,ds),m(11,F),m(12,rt),m(13,rr),m(14,Qte)],Jte);function Jfo(a,i,e,t,o,n,r,s,l,c,u,p){let h=new N;u===1&&t.classList.add("partial-warning"),t.ariaLabel=r,t.style.position="relative",a&&(t.style.cursor="pointer");let g=Xfo(c),f=_("div.chat-attached-context-pill",{},_(g&&!p?"span.codicon.codicon-file-media":"span.codicon.codicon-warning")),v=_("span.chat-attached-context-custom-text",{},i);t.appendChild(f),t.appendChild(v);let b=_("div.chat-attached-context-hover");if(b.setAttribute("aria-label",r),p)t.classList.add("warning"),b.textContent=d(6462,null),h.add(n.setupDelayedHover(t,{content:b,style:1}));else if(!g&&c||u===2)t.classList.add("warning"),b.textContent=d(6461,null,s??"This model"),h.add(n.setupDelayedHover(t,{content:b,style:1}));else if(u===3)t.classList.add("warning"),b.textContent=d(6465,null,ZX),h.add(n.setupDelayedHover(t,{content:b,style:1}));else{h.add(n.setupDelayedHover(t,{content:b,style:1}));let S=new Blob([o],{type:"image/png"}),y=URL.createObjectURL(S),w=_("img.chat-attached-context-pill-image",{src:y,alt:""}),k=_("div.chat-attached-context-pill",{},w),T=t.querySelector(".chat-attached-context-pill");T&&T.replaceWith(k);let P=_("img.chat-attached-context-image",{src:y,alt:""}),O=_("div.chat-attached-context-image-container",{},P);if(b.appendChild(O),a){let V=_("a.chat-attached-context-url",{},u===1?d(6463,null):e),H=_("div.chat-attached-context-url-separator");h.add(j(V,"click",()=>l())),b.append(H,V)}P.onload=()=>{URL.revokeObjectURL(y)},P.onerror=()=>{let V=_("div.chat-attached-context-pill",{},_("span.codicon.codicon-file-media")),H=_("div.chat-attached-context-pill",{},V),G=t.querySelector(".chat-attached-context-pill");G&&G.replaceWith(H)}}return h}var Zte=class extends qk{constructor(e,t,o,n,r,s,l,c,u,p){super(e,o,n,r,t,s,l,c);this.hoverService=u;this.instantiationService=p;let h=d(6445,null,e.name);this.element.ariaLabel=this.appendDeletionHint(h);let g=["file-icon",`${e.language}-lang-file-icon`],f,v;if(e.copiedFrom){f=e.copiedFrom.uri,v=e.copiedFrom.range;let w=jo(f.path);this.label.setLabel(w,void 0,{extraClasses:g})}else this.label.setLabel(e.fileName,void 0,{extraClasses:g});this.element.appendChild(_("span.attachment-additional-info",{},`Pasted ${e.pastedLines}`)),this.element.style.position="relative";let b=e.copiedFrom?.uri,S=new Ie(`${b?this.instantiationService.invokeFunction(w=>w.get(rt).getUriLabel(b,{relative:!0})):e.fileName}

---

\`\`\`${e.language}

${e.code}
\`\`\``);this._register(this.hoverService.setupDelayedHover(this.element,{...q8,content:S},cie));let y=e.copiedFrom?.uri;y&&(this._register(this.instantiationService.invokeFunction(hot,this.element,y)),this.addResourceOpenHandlers(y,v))}};Zte=I([m(5,ge),m(6,Je),m(7,B),m(8,nt),m(9,F)],Zte);var eie=class extends qk{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super(o,s,l,c,r,u,p,h);this.contextKeyService=g;this.instantiationService=f;this.hoverService=v;this.modelService=b;this.languageService=S;this._tooltipHover=this._register(new me);let y=o.fullName??o.name;if(LK(o)&&o.icon&&(q.isFile(o.icon)||q.isFolder(o.icon))&&o.resourceUri){let w=q.isFolder(o.icon)?1:0,k=aa(this.modelService,this.languageService,o.resourceUri,w);this.label.setLabel(y,n?.options?.status?.description,{extraClasses:k})}else{let w=o.icon?.id?`$(${o.icon.id})\xA0${y}`:y;this.label.setLabel(w,n?.options?.status?.description)}if(this.element.ariaLabel=this.appendDeletionHint(d(6445,null,o.name)),o.kind==="diagnostic"&&(o.filterUri?(e=o.filterUri?A.revive(o.filterUri):void 0,t=o.filterRange):(this.element.style.cursor="pointer",this._register(j(this.element,re.CLICK,()=>{this.commandService.executeCommand("workbench.panel.markers.view.focus")})))),o.kind==="symbol"&&this._register(this.instantiationService.invokeFunction(rDi,this.element,this.contextKeyService,{...o,kind:o.symbolKind},D.ChatInputSymbolAttachmentContext)),LK(o)&&o.commandId){this.element.style.cursor="pointer";let w=o.handle;this._register(j(this.element,re.CLICK,async()=>{await this.instantiationService.invokeFunction(T=>T.get(ED)).executeChatContextItemCommand(w)}))}o.kind==="debugEvents"&&(this.element.style.cursor="pointer",this._register(j(this.element,re.CLICK,()=>{let w=new Date(o.snapshotTime),k=`before:${w.getFullYear()}-${String(w.getMonth()+1).padStart(2,"0")}-${String(w.getDate()).padStart(2,"0")}T${String(w.getHours()).padStart(2,"0")}:${String(w.getMinutes()).padStart(2,"0")}:${String(w.getSeconds()).padStart(2,"0")}`;this.commandService.executeCommand("workbench.action.chat.openAgentDebugPanelForSession",o.sessionResource,k)}))),(LK(o)||o.kind==="generic")&&o.tooltip&&this._setupTooltipHover(o.tooltip),e&&this.addResourceOpenHandlers(e,t)}_setupTooltipHover(e){this._tooltipHover.value=this.hoverService.setupDelayedHover(this.element,{content:e,appearance:{showPointer:!0}})}};eie=I([m(8,ge),m(9,Je),m(10,B),m(11,X),m(12,F),m(13,nt),m(14,Tt),m(15,_t)],eie);var tie=class extends qk{constructor(e,t,o,n,r,s,l,c,u,p){super(e,o,n,r,t,s,l,c);this.labelService=u;this.instantiationService=p;this.hintElement=M(this.element,_("span.prompt-type")),this.updateLabel(e),this.instantiationService.invokeFunction(h=>{this._register(hot(h,this.element,e.value))}),this.addResourceOpenHandlers(e.value,void 0)}updateLabel(e){let t=e.value,o=jo(t.path),n=ad(t.path),r=`${o} ${n}`,s=e.id.startsWith("vscode.prompt.file"),l=s?d(6473,null,r):d(6466,null,r),c=s?d(6480,null):d(6478,null),u=this.labelService.getUriLabel(t)+(e.originLabel?`
${e.originLabel}`:"");this.element.classList.remove("warning","error");let p=wf(t);this.label.setFile(A.file(p),{fileKind:0,hidePath:!0,range:void 0,title:u,icon:q.fromId(R.bookmark.id),extraClasses:[]}),this.hintElement.innerText=c,this.element.ariaLabel=this.appendDeletionHint(l)}};tie=I([m(5,ge),m(6,Je),m(7,B),m(8,rt),m(9,F)],tie);var iie=class extends qk{constructor(i,e,t,o,n,r,s,l,c,u){if(super(i,t,o,n,e,r,s,l),i.settingId){let p=()=>c.openSettings({jsonEditor:!1,query:`@id:${i.settingId}`});this.element.style.cursor="pointer",this._register(j(this.element,re.CLICK,async h=>{Xt.stop(h,!0),p()})),this._register(j(this.element,re.KEY_DOWN,async h=>{let g=new gi(h);(g.equals(3)||g.equals(10))&&(Xt.stop(h,!0),p())}))}this.label.setLabel(d(6479,null),void 0,void 0),this.element.ariaLabel=this.appendDeletionHint(d(6445,null,i.name)),this._register(u.setupDelayedHover(this.element,{...q8,content:i.value},cie))}};iie=I([m(5,ge),m(6,Je),m(7,B),m(8,Go),m(9,nt)],iie);var oie=class extends qk{constructor(i,e,t,o,n,r,s,l,c,u){super(i,t,o,n,e,s,l,c);let p=vt.find(r.getTools(e?.metadata),v=>v.id===i.id)??vt.find(r.getToolSetsForModel(e?.metadata),v=>v.id===i.id),h=i.name,g=i.icon??R.tools;Xm(p)?h=p.referenceName:p&&(h=p.toolReferenceName??h),this.label.setLabel(`$(${g.id})\xA0${h}`,void 0),this.element.style.cursor="pointer",this.element.ariaLabel=this.appendDeletionHint(d(6445,null,h));let f;Xm(p)?f=d(6483,null,p.description??p.referenceName,p.source.label):p&&(f=d(6482,null,p.userDescription??p.modelDescription,p.source.label)),f&&this._register(u.setupDelayedHover(this.element,{...q8,content:f},cie))}};oie=I([m(5,Vn),m(6,ge),m(7,Je),m(8,B),m(9,nt)],oie);var nie=class extends qk{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super(t,n,r,s,o,l,c,u);this.hoverService=p;this.languageModelsService=h;this.notebookService=g;this.instantiationService=f;this.chatEntitlementService=v;switch(t.mimeType){case"application/vnd.code.notebook.error":{this.renderErrorOutput(e,t);break}case"image/png":case"image/jpeg":case"image/svg":{this.renderImageOutput(e,t);break}default:this.renderGenericOutput(e,t)}this.instantiationService.invokeFunction(b=>{this._register(hot(b,this.element,e))}),this.addResourceOpenHandlers(e,void 0)}getAriaLabel(e){return d(6467,null,e.name)}renderErrorOutput(e,t){let o=t.name,n=t.icon?.id?`$(${t.icon.id})\xA0${o}`:o,r=this.getOutputItem(e,t)?.data.buffer??new Uint8Array,s;try{let l=JSON.parse(new TextDecoder().decode(r));l.name&&l.message&&(s=`${l.name}: ${l.message}`)}catch{}this.label.setLabel(n,void 0,{title:s}),this.element.ariaLabel=this.appendDeletionHint(this.getAriaLabel(t))}renderGenericOutput(e,t){this.element.ariaLabel=this.appendDeletionHint(this.getAriaLabel(t)),this.label.setFile(e,{hidePath:!0,icon:q.fromId("output")})}renderImageOutput(e,t){let o;t.omittedState===2?o=d(6470,null,t.name):t.omittedState===1?o=d(6472,null,t.name):o=this.getAriaLabel(t);let n=async()=>await this.openResource(e,{editorOptions:{preserveFocus:!0}},!1,void 0),r=this.currentLanguageModel?this.languageModelsService.lookupLanguageModel(this.currentLanguageModel.identifier)?.name??this.currentLanguageModel.identifier:void 0,s=this.getOutputItem(e,t)?.data.buffer??new Uint8Array;this._register(Jfo(e,t.name,t.name,this.element,s,this.hoverService,o,r,n,this.currentLanguageModel,t.omittedState,this.chatEntitlementService.previewFeaturesDisabled)),this.element.ariaLabel=this.appendDeletionHint(o)}getOutputItem(e,t){let o=Zo.parseCellOutputUri(e);if(!o||typeof o.cellHandle!="number"||typeof o.outputIndex!="number")return;let n=this.notebookService.getNotebookTextModel(o.notebook);if(!n)return;let r=n.cells.find(l=>l.handle===o.cellHandle);return r?(r.outputs.length>o.outputIndex?r.outputs[o.outputIndex]:void 0)?.outputs.find(l=>l.mime===t.mimeType):void 0}};nie=I([m(6,ge),m(7,Je),m(8,B),m(9,nt),m(10,ds),m(11,bn),m(12,F),m(13,rr)],nie);var rie=class extends qk{constructor(e,t,o,n,r,s,l,c,u,p){super(e,o,n,r,t,s,l,c);this.editorService=u;this.hoverService=p;let h=d(6449,null,e.name);this.element.ariaLabel=this.appendDeletionHint(h),this.element.style.position="relative",this.element.style.cursor="pointer";let g=e.name,f=e.icon?.id?`$(${e.icon.id})\xA0${g}`:g;this.label.setLabel(f,void 0,{title:d(6448,null,g)}),this._register(this.hoverService.setupDelayedHover(this.element,this.getHoverContent(e),cie)),this._register(j(this.element,re.CLICK,async()=>{await this.openElementAttachment(e)}))}getHoverContent(e){if(!this.shouldRenderRichElementHover(e))return this.getSimpleHoverContent(e);let t=_("div.chat-attached-context-hover.chat-element-hover"),o=_("div.chat-element-hover-content"),n=[];{let c=_("div.chat-element-hover-section"),u=_("div.chat-element-hover-header",{},d(6452,null));c.appendChild(u);let p=_("pre.chat-element-hover-code"),h=_("code"),g=this.formatElementTag(e);h.textContent=g,p.appendChild(h);let f=this._register(new ms(p,{horizontal:1,vertical:2}));n.push(f),c.appendChild(f.getDomNode()),o.appendChild(c)}let r=this.getComputedStyleEntriesForHover(e.computedStyles);if(r.length>0){let c=_("div.chat-element-hover-section"),u=_("div.chat-element-hover-header",{},d(6451,null));c.appendChild(u);let p=_("div.chat-element-hover-table");for(let[g,f]of r){let v=_("div.chat-element-hover-row");v.appendChild(_("span.chat-element-hover-label",{},`${g}:`));let b=_("span.chat-element-hover-value");if((g==="color"||g==="background-color")&&f){let S=_("span.chat-element-hover-color-swatch");S.style.backgroundColor=f,b.appendChild(S)}b.appendChild(document.createTextNode(f)),v.appendChild(b),p.appendChild(v)}c.appendChild(p);let h=_("button.chat-element-hover-show-more",{type:"button"},d(6456,null));this._register(j(h,re.CLICK,async g=>{Xt.stop(g,!0),await this.openElementAttachment(e)})),c.appendChild(h),o.appendChild(c)}if(e.ancestors&&e.ancestors.length>1){let c=_("div.chat-element-hover-section"),u=_("div.chat-element-hover-header",{},d(6453,null));c.appendChild(u);let p=[];for(let v=0;v<e.ancestors.length;v++){let b=e.ancestors[v],S="  ".repeat(v),y=this.formatAncestorTag(b);p.push(`${S}${y}`)}let h=_("pre.chat-element-hover-code"),g=_("code");g.textContent=p.join(`
`),h.appendChild(g);let f=this._register(new ms(h,{horizontal:1,vertical:2}));n.push(f),c.appendChild(f.getDomNode()),o.appendChild(c)}if(e.attributes&&Object.keys(e.attributes).length>0){let c=_("div.chat-element-hover-section"),u=_("div.chat-element-hover-header",{},d(6450,null));c.appendChild(u);let p=_("div.chat-element-hover-table");for(let[h,g]of Object.entries(e.attributes)){let f=_("div.chat-element-hover-row");f.appendChild(_("span.chat-element-hover-label",{},`${h}:`)),f.appendChild(_("span.chat-element-hover-value",{},g)),p.appendChild(f)}c.appendChild(p),o.appendChild(c)}if(e.dimensions){let c=_("div.chat-element-hover-section"),u=_("div.chat-element-hover-header",{},d(6455,null));c.appendChild(u);let p=_("div.chat-element-hover-table"),h=[["top:",e.dimensions.top],["left:",e.dimensions.left],["width:",e.dimensions.width],["height:",e.dimensions.height]];for(let[g,f]of h){let v=_("div.chat-element-hover-row");v.appendChild(_("span.chat-element-hover-label",{},g)),v.appendChild(_("span.chat-element-hover-value",{},`${Math.round(f)}px`)),p.appendChild(v)}c.appendChild(p),o.appendChild(c)}if(e.innerText){let c=_("div.chat-element-hover-section"),u=_("div.chat-element-hover-header",{},d(6454,null));c.appendChild(u),c.appendChild(_("div.chat-element-hover-text",{},e.innerText)),o.appendChild(c)}let s=this._register(new ms(o,{vertical:1,horizontal:2,consumeMouseWheelIfScrollbarIsNeeded:!0})),l=s.getDomNode();return l.classList.add("chat-element-hover-scrollable"),t.appendChild(l),{...q8,content:t,additionalClasses:["chat-element-data-hover"],onDidShow:()=>{for(let c of n)c.scanDomNode();s.scanDomNode()}}}shouldRenderRichElementHover(e){return!!(e.dimensions||e.innerText||e.ancestors&&e.ancestors.length>0||e.attributes&&Object.keys(e.attributes).length>0||e.computedStyles&&Object.keys(e.computedStyles).length>0)}getSimpleHoverContent(e){let t=e.value?.toString()??"",o=new Ie;return o.appendText(e.fullName??e.name),t.trim().length>0&&(o.appendMarkdown(`

`),o.appendCodeblock("text",t)),{...q8,content:o}}getComputedStyleEntriesForHover(e){if(!e)return[];let t=[];for(let o of Yfo){if(o==="margin"||o==="padding"){let r=this.getBoxShorthandValue(e,o);if(typeof r=="string"){t.push([o,r]);continue}}let n=e[o];typeof n=="string"&&t.push([o,n])}return t.length>0?t:Object.entries(e).slice(0,Yfo.length)}getBoxShorthandValue(e,t){let o=e[`${t}-top`],n=e[`${t}-right`],r=e[`${t}-bottom`],s=e[`${t}-left`];return typeof o=="string"&&typeof n=="string"&&typeof r=="string"&&typeof s=="string"?`${o} ${n} ${r} ${s}`:e[t]}async openElementAttachment(e){let t=e.value?.toString()||"";await this.editorService.openEditor({resource:void 0,contents:t,options:{pinned:!0}})}formatElementTag(e){let t=e.value?.toString()??"",o=t.match(/\n\n(<[^>]+>)/);if(o)return o[1];let n=t.match(/<([^>]+)>/);return n?`<${n[1]}>`:`<${e.name}>`}formatAncestorTag(e){let t=[`<${e.tagName}`];return e.classNames?.length&&t.push(` class="${e.classNames.join(" ")}"`),e.id&&t.push(` id="${e.id}"`),t.join("")+">"}};rie=I([m(5,ge),m(6,Je),m(7,B),m(8,ee),m(9,nt)],rie);var sie=class extends qk{constructor(i,e,t,o,n,r,s,l,c,u,p){super(i,t,o,n,e,r,c,u),this.label.setLabel(i.name,void 0),this.element.style.cursor="pointer",this.element.ariaLabel=this.appendDeletionHint(d(6445,null,i.name));let{content:h,disposables:g}=Q7e(s,i.historyItem,!1);this._store.add(l.setupDelayedHover(this.element,{...q8,content:h},cie)),this._store.add(g),this._store.add(j(this.element,re.CLICK,f=>{Xt.stop(f,!0),this._openAttachment(i)})),this._store.add(j(this.element,re.KEY_DOWN,f=>{let v=new gi(f);(v.equals(3)||v.equals(10))&&(Xt.stop(f,!0),this._openAttachment(i))}))}async _openAttachment(i){await this.commandService.executeCommand("_workbench.openMultiDiffEditor",{title:Mzt(i.historyItem),multiDiffSourceUri:i.value})}};sie=I([m(5,ge),m(6,On),m(7,nt),m(8,Je),m(9,B),m(10,Le)],sie);var aie=class extends qk{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super(e,o,n,r,t,s,u,p);this.editorService=g;let f=`\xA0$(${R.gitCommit.id})${e.historyItem.displayId??e.historyItem.id}`;this.label.setFile(e.value,{fileKind:0,hidePath:!0,nameSuffix:f}),this.element.ariaLabel=this.appendDeletionHint(d(6445,null,e.name));let{content:v,disposables:b}=Q7e(c,e.historyItem,!1);this._store.add(l.setupDelayedHover(this.element,{...q8,content:v},cie)),this._store.add(b),this.addResourceOpenHandlers(e.value,void 0)}async openResource(e,t,o,n){let s=this.attachment.historyItem;await this.editorService.openEditor({resource:e,label:`${jo(e.path)} (${s.displayId??s.id})`,options:{...t.editorOptions}},t.openToSide?In:void 0)}};aie=I([m(5,ge),m(6,nt),m(7,On),m(8,Je),m(9,B),m(10,Le),m(11,ee)],aie);var lie=class extends qk{constructor(e,t,o,n,r,s,l,c,u){super(e,o,n,r,t,s,l,c);this.editorService=u;let p=e.historyItemChangeStart.historyItem.displayId??e.historyItemChangeStart.historyItem.id,h=e.historyItemChangeEnd.historyItem.displayId??e.historyItemChangeEnd.historyItem.id,g=`\xA0$(${R.gitCommit.id})${p}..${h}`;this.label.setFile(e.value,{fileKind:0,hidePath:!0,nameSuffix:g}),this.element.ariaLabel=this.appendDeletionHint(d(6445,null,e.name)),this.addResourceOpenHandlers(e.value,void 0)}async openResource(e,t,o,n){let r=this.attachment,s=r.historyItemChangeStart,l=r.historyItemChangeEnd,c=`${jo(s.uri.fsPath)} (${s.historyItem.displayId??s.historyItem.id})`,u=`${jo(l.uri.fsPath)} (${l.historyItem.displayId??l.historyItem.id})`;await this.editorService.openEditor({original:{resource:s.uri},modified:{resource:l.uri},label:`${c} \u2194 ${u}`,options:{...t.editorOptions}},t.openToSide?In:void 0)}};lie=I([m(5,ge),m(6,Je),m(7,B),m(8,ee)],lie);function hot(a,i,e){let t=a.get(X),o=a.get(F),n=new N,r=n.add(t.createScoped(i));return Zfo(a,r,e),i.draggable=!0,n.add(j(i,"dragstart",s=>{o.invokeFunction(l=>tv(l,[e],s)),s.dataTransfer?.setDragImage(i,0,0)})),n.add(Den(a,i,r,D.ChatInputResourceAttachmentContext,e)),n}function rDi(a,i,e,t,o){let n=a.get(F),r=a.get(Qt),s=a.get(Bt),l=a.get(Xe),c=a.get(Kt),u=new N;i.draggable=!0,u.add(j(i,"dragstart",b=>{n.invokeFunction(S=>tv(S,[{resource:t.value.uri,selection:t.value.range}],b)),mwe([{fsPath:t.value.uri.fsPath,range:t.value.range,name:t.name,kind:t.kind}],b),b.dataTransfer?.setDragImage(i,0,0)}));let p,h,g=()=>(p||(p=u.add(e.createScoped(i)),got.bindTo(p).set(t.value.uri.toString()),Zfo(a,p,t.value.uri)),p),f=()=>{let b=g();h||(h=[[pe.hasDefinitionProvider.bindTo(b),r.definitionProvider],[pe.hasReferenceProvider.bindTo(b),r.referenceProvider],[pe.hasImplementationProvider.bindTo(b),r.implementationProvider],[pe.hasTypeDefinitionProvider.bindTo(b),r.typeDefinitionProvider]])},v=async()=>{f();let b=await s.createModelReference(t.value.uri);try{let S=b.object.textEditorModel;for(let[y,w]of h)y.set(w.has(S))}finally{b.dispose()}};return u.add(j(i,re.CONTEXT_MENU,async b=>{let S=new Cn(Re(b),b);Xt.stop(b,!0);let y=g();try{await v()}catch(w){console.error(w)}l.showContextMenu({contextKeyService:y,getAnchor:()=>S,getActions:()=>{let w=c.getMenuActions(o,y,{arg:t.value});return tu(w)}})})),u}function Zfo(a,i,e){let t=a.get(fe),o=a.get(_t),n=a.get(Tt);new UX(i,t,o,n).set(e)}function Den(a,i,e,t,o,n){let r=a.get(Xe),s=a.get(Kt);return j(i,re.CONTEXT_MENU,async l=>{let c=new Cn(Re(l),l);Xt.stop(l,!0);try{await n?.()}catch(u){console.error(u)}r.showContextMenu({contextKeyService:e,getAnchor:()=>c,getActions:()=>{let u=s.getMenuActions(t,e,{arg:o});return tu(u)}})})}var got=new Y("chatAttachmentResource",void 0,{type:"URI",description:d(6481,null)});var Jhe=class extends x{constructor(e,t,o,n,r,s,l,c){super();this.codeEditorService=e;this.editorService=t;this.chatWidgetService=o;this.chatService=n;this.chatEditingService=r;this.configurationService=s;this.ignoredFilesService=l;this.chatContextService=c;this._currentCancelTokenSource=this._register(new me),this._implicitContextEnablement=this.configurationService.getValue("chat.implicitContext.enabled");let u=this._register(new N);this._register(U.runAndSubscribe(t.onDidActiveEditorChange,(()=>{u.clear();let p=this.findActiveCodeEditor();p&&u.add(U.debounce(U.any(p.onDidChangeModel,p.onDidChangeModelLanguage,p.onDidChangeCursorSelection,p.onDidScrollChange),()=>{},500)(()=>this.updateImplicitContext()));let h=this.findActiveNotebookEditor();if(h){let f=u.add(new N);u.add(h.onDidChangeActiveCell(()=>{f.clear();let v=this.codeEditorService.getActiveCodeEditor();v&&v.getModel()?.uri.scheme===Q.vscodeNotebookCell&&f.add(U.debounce(U.any(v.onDidChangeModel,v.onDidChangeCursorSelection,v.onDidScrollChange),()=>{},500)(()=>this.updateImplicitContext()))})),u.add(U.debounce(U.any(h.onDidChangeModel,h.onDidChangeActiveCell),()=>{},500)(()=>this.updateImplicitContext()))}let g=this.findActiveWebviewEditor();g&&u.add(U.debounce(g.input.webview.onMessage,()=>{},500)(()=>{this.updateImplicitContext()})),this.updateImplicitContext()}))),this._register(be(p=>{this.chatEditingService.editingSessionsObs.read(p),this.updateImplicitContext()})),this._register(this.configurationService.onDidChangeConfiguration(p=>{p.affectsConfiguration("chat.implicitContext.enabled")&&(this._implicitContextEnablement=this.configurationService.getValue("chat.implicitContext.enabled"),this.updateImplicitContext())})),this._register(this.chatService.onDidSubmitRequest(({chatSessionResource:p})=>{let h=this.chatWidgetService.getWidgetBySessionResource(p);h?.input.implicitContext&&this._implicitContextEnablement[h.location]==="first"&&h.viewModel?.getItems().length!==0&&h.input.implicitContext.setValues([])})),this._register(this.chatWidgetService.onDidAddWidget(async p=>{await this.updateImplicitContext(p)}))}static{this.ID="chat.implicitContext"}findActiveCodeEditor(){let e=this.codeEditorService.getActiveCodeEditor();if(e){let t=e.getModel();if(t?.uri.scheme===Q.vscodeNotebookCell)return;if(t)return e}for(let t of this.editorService.getVisibleTextEditorControls(0)){let o=ha(t);if(!o)continue;if(o.getModel())return o}}findActiveWebviewEditor(){let e=this.editorService.activeEditorPane;if(e?.input instanceof Hu)return e}findActiveNotebookEditor(){return Jn(this.editorService.activeEditorPane)}async updateImplicitContext(e){let t=this._currentCancelTokenSource.value=new Ye,o=this.findActiveCodeEditor(),n=o?.getModel(),r=o?.getSelection(),s,l=!1,c,u;if(n){if(c=n.getLanguageId(),r&&!r.isEmpty())s={uri:n.uri,range:r},l=!0;else if(this.configurationService.getValue("chat.implicitContext.suggestedContext"))s=n.uri;else{let v=o?.getVisibleRanges();if(v&&v.length>0){let b=v[0];v.slice(1).forEach(S=>{b=b.plusRange(S)}),s={uri:n.uri,range:b}}else s=n.uri}u=await this.chatContextService.contextForResource(n.uri,c)}let p=this.findActiveNotebookEditor();if(p?.isReplHistory)s=void 0;else if(p){let v=p.getActiveCell();if(v){let b=this.codeEditorService.getActiveCodeEditor(),S=b?.getSelection(),y=b?.getVisibleRanges()||[];s=v.uri;let w=b?.getModel();if(w&&Qe(w.uri,v.uri)){if(S&&!S.isEmpty())s={uri:v.uri,range:S},l=!0;else if(y.length>0&&!Len(w,y)){let k=y[0];y.slice(1).forEach(T=>{k=k.plusRange(T)}),s={uri:v.uri,range:k}}}}else s=p.textModel?.uri}let h=this.findActiveWebviewEditor();if(h?.input?.resource){let v=await this.chatContextService.contextForResource(h.input.resource);v&&(s=v)}let g=s instanceof A?s:Sk(s)?void 0:s?.uri;if(g&&(await this.ignoredFilesService.fileIsIgnored(g,t.token)||g.path.endsWith(".copilotmd"))&&(s=void 0),t.token.isCancellationRequested)return;let f=e?[e]:[...this.chatWidgetService.getWidgetsByLocations("panel"),...this.chatWidgetService.getWidgetsByLocations("editor")];for(let v of f){if(!v.input.implicitContext)continue;let b=this._implicitContextEnablement[v.location],S=v.viewModel?.getItems().length===0;if(b==="always"||b==="first"&&S){let y=!!this.editorService.activeEditor;(s!==void 0||!v.input.implicitContext.hasValue||!y)&&v.input.implicitContext.setValues([{value:s,isSelection:l},{value:u,isSelection:!1}])}else v.input.implicitContext.setValues([])}}};Jhe=I([m(0,qt),m(1,ee),m(2,Pt),m(3,mi),m(4,ud),m(5,B),m(6,FEe),m(7,ED)],Jhe);function Len(a,i){return i.length===1&&i[0].startLineNumber===1&&i[0].startColumn===1&&i[0].endLineNumber===a.getLineCount()&&i[0].endColumn===a.getLineMaxColumn(i[0].endLineNumber)}var Azt=class extends x{constructor(){super(...arguments);this._onDidChangeValue=this._register(new E);this.onDidChangeValue=this._onDidChangeValue.event;this._values=this._register(new Vt);this._valuesDisposables=this._register(new N);this._enabled=!1}setValues(e){if(this._valuesDisposables.clear(),this._values.clearAndDisposeAll(),!e||e.length===0){this._onDidChangeValue.fire();return}let t=e.filter(o=>o.value!==void 0);for(let o of t){let n=new sDi;n.setValue(o.value,o.isSelection),n.enabled=this._enabled;let r=new N;r.add(n.onDidChangeValue(()=>{this._onDidChangeValue.fire()})),r.add(n),this._values.set(n,r)}this._onDidChangeValue.fire()}get values(){return Array.from(this._values.keys())}get hasEnabled(){return Array.from(this._values.keys()).some(e=>e.enabled)}setEnabled(e){this._enabled=e,this.values.forEach(t=>t.enabled=e)}get hasValue(){return this.values.some(e=>e.value!==void 0)}get hasNonUri(){return this.values.some(e=>e.value!==void 0&&!A.isUri(e.value))}getLocations(){return this.values.filter(e=>lf(e.value)).map(e=>e.value)}getUris(){return this.values.filter(e=>A.isUri(e.value)).map(e=>e.value)}get hasNonStringContext(){return this.values.some(e=>e.value!==void 0&&!Sk(e.value))}enabledBaseEntries(e){return this.values.flatMap(t=>t.enabled||e&&lf(t.value)?t.toBaseEntries():[])}},sDi=class extends x{constructor(){super(...arguments);this.kind="implicit";this.isFile=!0;this._isSelection=!1;this._onDidChangeValue=this._register(new E);this.onDidChangeValue=this._onDidChangeValue.event;this._enabled=!1}get id(){return A.isUri(this.value)?"vscode.implicit.file":Sk(this.value)?"vscode.implicit.string":this.value?this._isSelection?"vscode.implicit.selection":"vscode.implicit.viewport":"vscode.implicit"}get name(){if(A.isUri(this.value))return`file:${He(this.value)}`;if(lf(this.value))return`file:${He(this.value.uri)}`;if(Sk(this.value)){if(this.value.name===void 0&&this.value.resourceUri===void 0)throw new Error("ChatContextItem must have either a label or a resourceUri");return this.value.name??He(this.value.resourceUri)}return"implicit"}get modelDescription(){if(A.isUri(this.value))return"User's active file";if(Sk(this.value)){if(this.value.name===void 0&&this.value.resourceUri===void 0)throw new Error("ChatContextItem must have either a label or a resourceUri");let e=this.value.name??He(this.value.resourceUri);return this.value.modelDescription??`User's active context from ${e}`}else return this._isSelection?"User's active selection":"User's current visible code"}get isSelection(){return this._isSelection}get value(){return this._value}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this._onDidChangeValue.fire()}get uri(){return Sk(this.value)?this.value.uri:this._uri}get icon(){if(Sk(this.value))return this.value.icon}setValue(e,t){Sk(e)?this._value=e:(this._value=e,this._uri=A.isUri(e)?e:e?.uri),this._isSelection=t,this._onDidChangeValue.fire()}toBaseEntries(){return this.value?Sk(this.value)?[{kind:"string",id:this.id,name:this.name,value:this.value.value??this.name,modelDescription:this.modelDescription,icon:this.value.icon,uri:this.value.uri,resourceUri:this.value.resourceUri,handle:this.value.handle,commandId:this.value.commandId}]:[{kind:"file",id:this.id,name:this.name,value:this.value,modelDescription:this.modelDescription}]:[]}};var INe=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super();this.widgetRef=e;this.isAttachmentAlreadyAttached=t;this.attachment=o;this.resourceLabels=n;this.attachmentModel=r;this.domNode=s;this.contextKeyService=l;this.contextMenuService=c;this.labelService=u;this.menuService=p;this.fileService=h;this.languageService=g;this.modelService=f;this.hoverService=v;this.configService=b;this.chatContextService=S;this.renderDisposables=this._register(new N);this.renderedCount=0;this.render()}render(){this.renderDisposables.clear(),this.renderedCount=0;for(let e of this.attachment.values){let t=e.uri,o=lf(e.value)?e.value.range:void 0,n=Sk(e.value)?e.value.handle:void 0;this.isAttachmentAlreadyAttached(t,o,n)||(this.renderMainContext(e,e.isSelection),this.renderedCount++)}}get hasRenderedContexts(){return this.renderedCount>0}renderMainContext(e,t){let o=_(".chat-attached-context-attachment.show-file-icons.implicit");this.domNode.appendChild(o),o.tabIndex=0,o.classList.toggle("disabled",!e.enabled);let n=e.uri,r=n?.scheme===Q.vscodeNotebookCell?d(6486,null):d(6494,null),s=e.name??(n?He(n):d(6495,null));if(this.configService.getValue("chat.implicitContext.suggestedContext")){if(t){let f=d(6498,null),v=this.renderDisposables.add(new Wi(o,{supportIcons:!0,title:f}));v.icon=R.pinned,this.renderDisposables.add(v.onDidClick(async b=>{b.stopPropagation(),b.preventDefault(),await this.pinSelection()}))}else{let f=e.enabled?d(6491,null,r,s):d(6485,null,s),v=this.renderDisposables.add(new Wi(o,{supportIcons:!0,title:f}));v.icon=e.enabled?R.x:R.plus,this.renderDisposables.add(v.onDidClick(async b=>{b.stopPropagation(),b.preventDefault(),e.enabled||await this.convertToRegularAttachment(e),e.enabled=!1}))}!e.enabled&&t&&o.classList.remove("disabled"),this.renderDisposables.add(j(o,re.CLICK,async f=>{!e.enabled&&!t&&await this.convertToRegularAttachment(e)})),this.renderDisposables.add(j(o,re.KEY_DOWN,async f=>{let v=new gi(f);(v.equals(3)||v.equals(10))&&!e.enabled&&!t&&(f.preventDefault(),f.stopPropagation(),await this.convertToRegularAttachment(e))}))}else{let f=e.enabled?d(6490,null,r):d(6492,null,r),v=this.renderDisposables.add(new Wi(o,{supportIcons:!0,title:f}));v.icon=e.enabled?R.eye:R.eyeClosed,this.renderDisposables.add(v.onDidClick(b=>{b.stopPropagation(),e.enabled=!e.enabled}))}let c=this.resourceLabels.create(o,{supportIcons:!0}),u,p;Sk(e.value)?(p=e.value.tooltip,u=this.renderString(c,e.name,e.icon,e.value.resourceUri,p,d(6497,null)),o.ariaLabel=d(6489,null,e.name)):u=this.renderResource(e.value,e.isSelection,e.enabled,c,o),(p||u)&&this.renderDisposables.add(this.hoverService.setupDelayedHover(o,{content:p??u,appearance:{showPointer:!0}}));let h=this.renderDisposables.add(this.contextKeyService.createScoped(o));this.renderDisposables.add(new Wo(h,this.fileService,this.languageService,this.modelService)).set(n),this.renderDisposables.add(j(o,re.CONTEXT_MENU,async f=>{let v=new Cn(Re(f),f);Xt.stop(f,!0),this.contextMenuService.showContextMenu({contextKeyService:h,getAnchor:()=>v,getActions:()=>{let b=this.menuService.getMenuActions(D.ChatInputResourceAttachmentContext,h,{arg:n});return tu(b)}})}))}renderString(e,t,o,n,r,s){let l=r?void 0:s;if(o&&(q.isFile(o)||q.isFolder(o))&&n){let c=q.isFolder(o)?1:0,u=aa(this.modelService,this.languageService,n,c);e.setLabel(t,void 0,{extraClasses:u,title:l})}else e.setLabel(t,void 0,{iconPath:o,title:l});return l}renderResource(e,t,o,n,r){let s=A.isUri(e)?e:e.uri,l=A.isUri(e)||!t?void 0:e.range,c=s.scheme===Q.vscodeNotebookCell?d(6486,null):d(6494,null),u=He(s),p=ci(s),h=`${u} ${p}`,g=l?d(6488,null,c,h,l.startLineNumber,l.endLineNumber):d(6487,null,c,h),f=this.labelService.getUriLabel(s,{relative:!0}),v=d(6496,null,c),b=d(6493,null,c),y=`${o||t?v:b}
${f}`;return n.setFile(s,{fileKind:0,hidePath:!0,range:l,title:y}),r.ariaLabel=g,y}async convertToRegularAttachment(e){if(e.value){if(Sk(e.value)){e.value.value===void 0&&await this.chatContextService.resolveChatContext(e.value);let t={kind:"string",value:e.value.value,id:e.id,name:e.name,icon:e.value.icon,modelDescription:e.modelDescription,uri:e.value.uri,resourceUri:e.value.resourceUri,tooltip:e.value.tooltip,commandId:e.value.commandId,handle:e.value.handle};this.attachmentModel.addContext(t)}else{let t=A.isUri(e.value)?e.value:e.value.uri;t.scheme===Q.vscodeNotebookCell&&lf(e.value)?this.attachmentModel.addFile(t,e.value.range):this.attachmentModel.addFile(t)}this.widgetRef()?.focusInput()}}async pinSelection(){for(let e of this.attachment.values)if(!(!e.value||!e.isSelection)&&!A.isUri(e.value)&&!Sk(e.value)){let t=e.value;this.attachmentModel.addFile(t.uri,t.range)}this.widgetRef()?.focusInput()}};INe=I([m(6,X),m(7,Xe),m(8,rt),m(9,Kt),m(10,fe),m(11,_t),m(12,Tt),m(13,nt),m(14,B),m(15,ED)],INe);var die=class extends aW{constructor(e,t,o,n,r,s,l,c,u){let{group:p,item:h}=t,g={...e,label:h?.name||p.name,tooltip:h?.description??p.description??p.name,run:()=>{}},f={actionProvider:{getActions:()=>this.getDropdownActions()},actionBarActionProvider:void 0,reporter:{id:p.id,name:`ChatSession:${p.name}`,includeOptions:!1},getAnchor:()=>this._getAnchorElement()};super(g,f,r,l,s,u);this.delegate=o;this._pickerOptions=n;this.commandService=c;this.currentOption=h,this._register(this.delegate.onDidChangeOption(v=>{this.currentOption=v,this.element&&this.renderLabel(this.element),this.updateEnabled()}))}getDropdownActions(){let e=this.delegate.getCurrentOption();if(e?.locked)return[this.createLockedOptionAction(e)];let t=this.delegate.getOptionGroup();if(!t)return[];let o=t.items.map(n=>{let r=n.id===e?.id;return{id:n.id,enabled:!n.locked,icon:n.icon,checked:r,class:void 0,description:n.description,tooltip:n.description??n.name,label:n.name,run:()=>{this.delegate.setOption(n)}}});if(t.commands?.length){let n=o.length>0;for(let r of t.commands){let s=r.arguments?[...r.arguments]:[],l=this.delegate.getSessionResource();l&&s.unshift(l),o.push({id:r.command,enabled:!0,checked:!1,class:void 0,description:void 0,tooltip:r.tooltip??r.title,label:r.title,category:n?{label:"",order:Number.MAX_SAFE_INTEGER}:void 0,run:()=>{this.commandService.executeCommand(r.command,...s)}})}}return o}createLockedOptionAction(e){return{id:e.id,enabled:!1,icon:e.icon,checked:!0,class:void 0,description:e.description,tooltip:e.description??e.name,label:e.name,run:()=>{}}}_getAnchorElement(){return this.element&&Ki().document.contains(this.element)?this.element:this._pickerOptions?.getOverflowAnchor?.()??this.element}renderLabel(e){let t=[];e.classList.add("chat-session-option-picker");let o=this.delegate.getOptionGroup(),n=this.currentOption?.default&&this.currentOption?.icon;return this.currentOption?.icon&&t.push(Sn(this.currentOption.icon)),n||t.push(_("span.chat-session-option-label",void 0,this.currentOption?.name??o?.description??d(7131,null))),t.push(...Un("$(chevron-down)")),vi(e,...t),this.setAriaLabelAttributes(e),null}render(e){this.container=e,super.render(e),e.classList.add(this.getContainerClass()),this.currentOption?.locked&&e.classList.add("locked")}getContainerClass(){return"chat-sessionPicker-item"}updateEnabled(){let e=this.action.enabled;this.currentOption?.locked&&(this.action.enabled=!1),super.updateEnabled(),this.action.enabled=e,this.container&&this.container.classList.toggle("locked",!!this.currentOption?.locked)}};die=I([m(4,td),m(5,X),m(6,_e),m(7,ge),m(8,Te)],die);function Ren(a){return!!a&&typeof a.optionItem=="object"}var uie=class extends die{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,t,o,n,r,s,l,p,h);this.quickInputService=c;this.logService=u}static{this.SEE_MORE_ID="__see_more__"}getDropdownActions(){let e=this.delegate.getCurrentOption();if(e?.locked)return[this.createLockedOptionAction(e)];let t=this.delegate.getOptionGroup();if(!t)return[];let o=t.items.map(n=>{let r=n.id===e?.id;return{id:n.id,enabled:!n.locked,icon:n.icon,checked:r,class:void 0,description:n.description,tooltip:n.description??n.name,label:n.name,run:()=>{this.delegate.setOption(n)}}});return t.onSearch&&o.push({id:uie.SEE_MORE_ID,enabled:!0,checked:!1,class:"searchable-picker-see-more",description:void 0,tooltip:d(7176,null),label:d(7175,null),run:()=>{this.showSearchableQuickPick(t)}}),o}renderLabel(e){let t=[],o=this.delegate.getOptionGroup();e.classList.add("chat-session-option-picker"),o?.icon&&t.push(Sn(o.icon));let n=this.currentOption?.name??o?.name??d(7177,null);return t.push(_("span.chat-session-option-label",void 0,n)),t.push(...Un("$(chevron-down)")),vi(e,...t),this.setAriaLabelAttributes(e),null}getContainerClass(){return"chat-searchable-option-picker-item"}async showSearchableQuickPick(e){if(e.onSearch){let t=new N,o=this.quickInputService.createQuickPick();t.add(o),o.placeholder=e.description??d(7178,null,e.name),o.matchOnDescription=!0,o.matchOnDetail=!0,o.matchOnLabelMode="fuzzy",o.ignoreFocusOut=!0,o.busy=!0,o.show();let n,r=t.add(new Xo(300)),s=async l=>{n?.cancel(),n?.dispose(),n=new Ye;let c=n.token;o.busy=!0;try{let u=await e.onSearch(l,c);c.isCancellationRequested||(o.items=u.map(p=>this.createQuickPickItem(p)))}catch(u){c.isCancellationRequested||this.logService.error("Error fetching searchable option items:",u)}finally{c.isCancellationRequested||(o.busy=!1)}};return await s(""),t.add(o.onDidChangeValue(l=>{r.trigger(()=>s(l))})),new Promise(l=>{t.add(o.onDidAccept(()=>{let c=o.selectedItems[0];if(Ren(c)){let u=c.optionItem;u.locked||this.delegate.setOption(u)}o.hide()})),t.add(o.onDidHide(()=>{n?.cancel(),n?.dispose(),t.dispose(),l()}))})}}createQuickPickItem(e){let t=e.icon?q.asClassName(e.icon):void 0;return{label:e.name,description:e.description,iconClass:t,disabled:e.locked,optionItem:e}}show(){let e=this.delegate.getOptionGroup();e&&this.showSearchableQuickPick(e)}};uie=I([m(4,td),m(5,X),m(6,_e),m(7,Ue),m(8,se),m(9,ge),m(10,Te)],uie);var uW=class{constructor(i,e,t,o,n,r,s){this.questions=i;this.allowSkip=e;this.resolveId=t;this.data=o;this.isUsed=n;this.message=r;this.source=s;this.kind="questionCarousel";this.completion=new Ko}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 Men="workbench.action.chat.previousQuestion",Pen="workbench.action.chat.nextQuestion",$8=class extends x{constructor(e,t,o,n,r,s,l,c){super();this.carousel=e;this._options=o;this._markdownRendererService=n;this._hoverService=r;this._accessibilityService=s;this._contextKeyService=l;this._keybindingService=c;this._onDidChangeHeight=this._register(new E);this.onDidChangeHeight=this._onDidChangeHeight.event;this._currentIndex=0;this._answers=new Map;this._isCollapsed=!1;this._isSkipped=!1;this._textInputBoxes=new Map;this._singleSelectItems=new Map;this._multiSelectCheckboxes=new Map;this._freeformTextareas=new Map;this._inputBoxes=this._register(new N);this._questionRenderStore=this._register(new me);this._interactiveUIStore=this._register(new me);this.domNode=_(".chat-question-carousel-container"),this.domNode.id=xt(),this._inChatQuestionCarouselContextKey=ie.inChatQuestionCarousel.bindTo(this._contextKeyService);let u=this._register(qn(this.domNode));if(this._register(u.onDidFocus(()=>this._inChatQuestionCarouselContextKey.set(!0))),this._register(u.onDidBlur(()=>this._inChatQuestionCarouselContextKey.set(!1))),this._register({dispose:()=>this._inChatQuestionCarouselContextKey.reset()}),this.domNode.tabIndex=0,this.domNode.setAttribute("role","region"),this.domNode.setAttribute("aria-roledescription",d(7730,null)),this._updateAriaLabel(),e instanceof uW&&(typeof e.draftCurrentIndex=="number"&&(this._currentIndex=Math.max(0,Math.min(e.draftCurrentIndex,e.questions.length-1))),typeof e.draftCollapsed=="boolean"&&(this._isCollapsed=e.draftCollapsed),e.draftAnswers))for(let[v,b]of Object.entries(e.draftAnswers))this._answers.set(v,b);if(e.data)for(let[v,b]of Object.entries(e.data))this._answers.set(v,b);let p=Ui(t.element)&&t.element.isComplete;if(e.isUsed||p){this._isSkipped=!0,this.domNode.classList.add("chat-question-carousel-used"),this.renderSummary();return}let h=new N;this._interactiveUIStore.value=h,this._questionContainer=_(".chat-question-carousel-content"),this.domNode.append(this._questionContainer),this._headerActionsContainer=_(".chat-question-header-actions");let g=d(7717,null),f=h.add(new Wi(this._headerActionsContainer,{...Qo,secondary:!0,supportIcons:!0}));if(f.element.classList.add("chat-question-collapse-toggle"),f.element.setAttribute("aria-label",g),this._collapseButton=f,e.allowSkip){this._closeButtonContainer=_(".chat-question-close-container");let v=d(7732,null),b=h.add(new Wi(this._closeButtonContainer,{...Qo,secondary:!0,supportIcons:!0}));b.label=`$(${R.close.id})`,b.element.classList.add("chat-question-close"),b.element.setAttribute("aria-label",v),h.add(this._hoverService.setupDelayedHover(b.element,{content:v})),this._skipAllButton=b}h.add(f.onDidClick(()=>this.toggleCollapsed())),this._skipAllButton&&h.add(this._skipAllButton.onDidClick(()=>this.ignore())),h.add(j(this.domNode,re.KEY_DOWN,v=>{let b=new gi(v);if(b.keyCode===9&&this.carousel.allowSkip)v.preventDefault(),v.stopPropagation(),this.ignore();else if(b.keyCode===3&&(b.metaKey||b.ctrlKey))v.preventDefault(),v.stopPropagation(),this.submit();else if(b.keyCode===3&&!b.shiftKey){let S=v.target,y=S.tagName==="INPUT"&&S.type==="text",w=S.tagName==="TEXTAREA"&&S.classList.contains("chat-question-freeform-textarea");(y||w)&&(v.preventDefault(),v.stopPropagation(),this.handleNextOrSubmit())}else(b.ctrlKey||b.metaKey)&&(b.keyCode===1||b.keyCode===20)&&v.stopPropagation()})),this.renderCurrentQuestion()}saveCurrentAnswer(){let e=this.carousel.questions[this._currentIndex],t=this.getCurrentAnswer();if(t!==void 0?this._answers.set(e.id,t):this._answers.delete(e.id),e?.validation&&typeof t=="string"&&t!==""){let o=this.getValidationError(t,e.validation);o?this.showValidationError(o):this.clearValidationError()}else this.clearValidationError();this.updateFooterState(),this.persistDraftState()}persistDraftState(){this.carousel.isUsed||!(this.carousel instanceof uW)||(this.carousel.draftAnswers=Object.fromEntries(this._answers.entries()),this.carousel.draftCurrentIndex=this._currentIndex,this.carousel.draftCollapsed=this._isCollapsed)}toggleCollapsed(){this._isCollapsed=!this._isCollapsed,this.persistDraftState(),this.updateCollapsedPresentation(),this._onDidChangeHeight.fire()}updateCollapsedPresentation(){if(this.domNode.classList.toggle("chat-question-carousel-collapsed",this._isCollapsed),this._collapseButton){let e=this._isCollapsed,t=e?d(7720,null):d(7717,null),o=this.domNode.id;this._collapseButton.label=e?`$(${R.chevronUp.id})`:`$(${R.chevronDown.id})`,this._collapseButton.element.setAttribute("aria-label",t),this._collapseButton.element.setAttribute("aria-expanded",String(!e)),this._collapseButton.element.setAttribute("aria-controls",o),this._collapseButton.setTitle(t)}}navigate(e){let t=this._currentIndex+e;t>=0&&t<this.carousel.questions.length&&(this.saveCurrentAnswer(),this._currentIndex=t,this.persistDraftState(),this.renderCurrentQuestion(!0),this.domNode.focus())}handleNextOrSubmit(){if(this.saveCurrentAnswer(),!!this.validateCurrentQuestion())if(this._currentIndex<this.carousel.questions.length-1)this._currentIndex++,this.persistDraftState(),this.renderCurrentQuestion(!0);else{if(!this.validateRequiredFields())return;this._options.onSubmit(this._answers),this.hideAndShowSummary()}}submit(){this.saveCurrentAnswer(),this.validateCurrentQuestion()&&this.validateRequiredFields()&&(this._options.onSubmit(this._answers),this.hideAndShowSummary())}_focusContainerAndAnnounce(){this.domNode.focus();let e=this.carousel.questions[this._currentIndex];if(e){let t=e.message??e.title,o=this.getQuestionText(t),n=this.carousel.questions.length,r=n===1?o:d(7728,null,this._currentIndex+1,n,o);this._accessibilityService.alert(r)}}hideAndShowSummary(){this._isSkipped=!0,this.domNode.classList.add("chat-question-carousel-used"),this.clearInteractiveResources(),Rt(this.domNode),this.renderSummary(),this._onDidChangeHeight.fire()}clearInteractiveResources(){this._interactiveUIStore.clear(),this._questionRenderStore.clear(),this._inputBoxes.clear(),this._textInputBoxes.clear(),this._singleSelectItems.clear(),this._multiSelectCheckboxes.clear(),this._freeformTextareas.clear(),this._prevButton=void 0,this._nextButton=void 0,this._submitButton=void 0,this._skipAllButton=void 0,this._questionContainer=void 0,this._headerActionsContainer=void 0,this._closeButtonContainer=void 0,this._collapseButton=void 0,this._footerRow=void 0,this._stepIndicator=void 0,this._submitHint=void 0,this._inputScrollable=void 0}layoutInputScrollable(e){if(!this._questionContainer)return;let t=e.getDomNode(),o=t.firstElementChild;if(!Do(o))return;(t.style.height!==""||t.style.maxHeight!=="")&&(t.style.height="",t.style.maxHeight=""),(o.style.height!==""||o.style.maxHeight!=="")&&(o.style.height="",o.style.maxHeight="");let n=this._questionContainer.clientHeight,r=Re(this._questionContainer).getComputedStyle(this._questionContainer),s=Number.parseFloat(r.paddingTop||"0")+Number.parseFloat(r.paddingBottom||"0"),l=Array.from(this._questionContainer.children).filter(g=>g!==t).reduce((g,f)=>g+f.offsetHeight,0),c=Math.floor(n-s-l),u=o.scrollHeight,h=`${Math.max(0,Math.min(c,u))}px`;(t.style.height!==h||t.style.maxHeight!==h)&&(t.style.height=h,t.style.maxHeight=h),(o.style.height!==h||o.style.maxHeight!==h)&&(o.style.height=h,o.style.maxHeight=h),e.scanDomNode()}skip(){if(this._isSkipped||!this.carousel.allowSkip)return!1;let e=this.getDefaultAnswers();this._options.onSubmit(e),this._answers.clear();for(let[t,o]of e)this._answers.set(t,o);return this.hideAndShowSummary(),!0}ignore(){return this._isSkipped||!this.carousel.allowSkip?!1:(this._isSkipped=!0,this._options.onSubmit(void 0),this.clearInteractiveResources(),this.domNode.classList.add("chat-question-carousel-used"),Rt(this.domNode),this.renderSkippedMessage(),this._onDidChangeHeight.fire(),!0)}getDefaultAnswers(){let e=new Map;for(let t of this.carousel.questions){let o=this.getDefaultAnswerForQuestion(t);o!==void 0&&e.set(t.id,o)}return e}getDefaultAnswerForQuestion(e){switch(e.type){case"text":return typeof e.defaultValue=="string"?e.defaultValue:void 0;case"singleSelect":{let t=typeof e.defaultValue=="string"?e.defaultValue:void 0,n=(t!==void 0?e.options?.find(r=>r.id===t):void 0)?.value;return n!==void 0?{selectedValue:n,freeformValue:void 0}:void 0}case"multiSelect":{let t=Array.isArray(e.defaultValue)?e.defaultValue:typeof e.defaultValue=="string"?[e.defaultValue]:[],o=e.options?.filter(n=>t.includes(n.id)).map(n=>n.value).filter(n=>n!==void 0)??[];return o.length>0?{selectedValues:o,freeformValue:void 0}:void 0}default:return typeof e.defaultValue=="string"?e.defaultValue:Array.isArray(e.defaultValue)?{selectedValues:e.defaultValue}:void 0}}_shouldAutoFocus(){return this._options.shouldAutoFocus===!1?!1:!this._accessibilityService.isScreenReaderOptimized()}_updateAriaLabel(){let e=this.carousel.questions[this._currentIndex];if(!e){this.domNode.setAttribute("aria-label",d(7721,null));return}let t=e.message??e.title,o=this.getQuestionText(t),n=this.carousel.questions.length;n===1?this.domNode.setAttribute("aria-label",d(7731,null,o)):this.domNode.setAttribute("aria-label",d(7724,null,this._currentIndex+1,n,o))}focus(){this.domNode.focus()}hasFocus(){return Gr(this.domNode)}navigateToPreviousQuestion(){return this._currentIndex<=0?!1:(this.navigate(-1),!0)}navigateToNextQuestion(){return this._currentIndex>=this.carousel.questions.length-1?!1:(this.navigate(1),!0)}renderCurrentQuestion(e=!1){if(!this._questionContainer)return;let t=new N;this._questionRenderStore.value=t,this._inputScrollable=void 0,this._inputBoxes.clear(),this._textInputBoxes.clear(),this._singleSelectItems.clear(),this._multiSelectCheckboxes.clear(),this._freeformTextareas.clear(),Rt(this._questionContainer);let o=this.carousel.questions[this._currentIndex];if(!o)return;let n=_(".chat-question-header-row"),r=_(".chat-question-title-row");if(this.carousel.message&&this._currentIndex===0){let b=Ar(this.carousel.message)?Ie.lift(this.carousel.message):new Ie(this.carousel.message),S=_(".chat-question-carousel-message"),y=t.add(this._markdownRendererService.render(b));S.appendChild(y.element),n.appendChild(S)}let s=o.message??o.title;if(s){let b=_(".chat-question-title"),S=this.getQuestionText(s);b.setAttribute("aria-label",S);let y=o.required?new Ie(`${Ar(s)?s.value:s} *`):Ar(s)?Ie.lift(s):new Ie(s),w=t.add(this._markdownRendererService.render(y));b.appendChild(w.element),r.appendChild(b)}if(n.appendChild(r),this._headerActionsContainer&&(Rt(this._headerActionsContainer),this._closeButtonContainer&&this._headerActionsContainer.appendChild(this._closeButtonContainer),this._collapseButton&&this._headerActionsContainer.appendChild(this._collapseButton.element),r.appendChild(this._headerActionsContainer)),this._questionContainer.appendChild(n),o.description){let b=_(".chat-question-description");b.textContent=o.description,this._questionContainer.appendChild(b)}let l=_(".chat-question-input-container");this.renderInput(l,o);let c=t.add(new ms(l,{vertical:3,horizontal:2,consumeMouseWheelIfScrollbarIsNeeded:!0}));this._inputScrollable=c;let u=c.getDomNode();u.classList.add("chat-question-input-scrollable"),this._questionContainer.appendChild(u),this._validationMessageElement=_(".chat-question-validation-message"),this._validationMessageElement.style.display="none",this._questionContainer.appendChild(this._validationMessageElement),this.carousel.questions.length===1?this.renderSingleQuestionFooter():this.renderFooter();let h=!1,g=t.add(new me),f=()=>{h||(h=!0,g.value=zh(Re(this.domNode),()=>{h=!1,this.layoutInputScrollable(c)}))},v=t.add(new WL(()=>f()));t.add(v.observe(u)),t.add(v.observe(l)),t.add(j(Re(this.domNode),re.RESIZE,()=>f())),f(),t.add(zh(Re(this.domNode),()=>{l.scrollTop=0,l.scrollLeft=0,c.setScrollPosition({scrollTop:0,scrollLeft:0}),c.scanDomNode()})),this._updateAriaLabel(),this.updateCollapsedPresentation(),e&&this._accessibilityService.isScreenReaderOptimized()&&this._focusContainerAndAnnounce(),this._onDidChangeHeight.fire()}renderFooter(){if(!this._footerRow){let e=this._interactiveUIStore.value;if(!e)return;this._footerRow=_(".chat-question-footer-row");let t=_(".chat-question-footer-left.chat-question-carousel-nav");t.setAttribute("role","navigation"),t.setAttribute("aria-label",d(7725,null));let o=_(".chat-question-nav-arrows"),n=this.getLabelWithKeybinding(d(7750,null),Men),r=e.add(new Wi(o,{...Qo,secondary:!0,supportIcons:!0}));r.element.classList.add("chat-question-nav-arrow","chat-question-nav-prev"),r.label=`$(${R.chevronLeft.id})`,r.element.setAttribute("aria-label",n),e.add(this._hoverService.setupDelayedHover(r.element,{content:n})),e.add(r.onDidClick(()=>this.navigate(-1))),this._prevButton=r;let s=this.getLabelWithKeybinding(d(7749,null),Pen),l=e.add(new Wi(o,{...Qo,secondary:!0,supportIcons:!0}));l.element.classList.add("chat-question-nav-arrow","chat-question-nav-next"),l.label=`$(${R.chevronRight.id})`,l.element.setAttribute("aria-label",s),e.add(this._hoverService.setupDelayedHover(l.element,{content:s})),e.add(l.onDidClick(()=>this.navigate(1))),this._nextButton=l,t.appendChild(o),this._stepIndicator=_(".chat-question-step-indicator"),t.appendChild(this._stepIndicator),this._footerRow.appendChild(t);let c=_(".chat-question-footer-right"),u=_("span.chat-question-submit-hint");u.textContent=Ze?d(7735,null):d(7736,null),c.appendChild(u),this._submitHint=u;let p=e.add(new Wi(c,{...Qo}));p.element.classList.add("chat-question-submit-button"),p.label=d(7751,null),e.add(p.onDidClick(()=>this.submit())),this._submitButton=p,this._footerRow.appendChild(c),this.domNode.append(this._footerRow)}this.updateFooterState()}updateFooterState(){if(this._prevButton&&(this._prevButton.enabled=this._currentIndex>0),this._nextButton){let e=this._currentIndex<this.carousel.questions.length-1,t=this.carousel.questions[this._currentIndex],o=this._answers.get(t?.id),n=o!==void 0&&o!=="",r=!!this._currentValidationError;this._nextButton.enabled=e&&(!t?.required||n)&&!r}if(this._stepIndicator&&(this._stepIndicator.textContent=d(7734,null,this._currentIndex+1,this.carousel.questions.length)),this._submitButton){let e=this._currentIndex===this.carousel.questions.length-1;this._submitButton.element.style.display=e?"":"none",this._submitHint&&(this._submitHint.style.display=e?"":"none")}}renderSingleQuestionFooter(){if(!this._footerRow){let e=this._interactiveUIStore.value;if(!e)return;this._footerRow=_(".chat-question-footer-row");let t=_(".chat-question-footer-left.chat-question-carousel-nav");t.setAttribute("role","navigation"),t.setAttribute("aria-label",d(7725,null)),this._footerRow.appendChild(t);let o=_(".chat-question-footer-right"),n=_("span.chat-question-submit-hint");n.textContent=Ze?d(7735,null):d(7736,null),o.appendChild(n),this._submitHint=n;let r=e.add(new Wi(o,{...Qo}));r.element.classList.add("chat-question-submit-button"),r.label=d(7751,null),e.add(r.onDidClick(()=>this.submit())),this._submitButton=r,this._footerRow.appendChild(o),this.domNode.append(this._footerRow)}}getLabelWithKeybinding(e,t){let o=this._keybindingService.lookupKeybinding(t,this._contextKeyService)?.getLabel();return o?d(7722,null,e,o):e}renderInput(e,t){switch(t.type){case"text":this.renderTextInput(e,t);break;case"singleSelect":this.renderSingleSelect(e,t);break;case"multiSelect":this.renderMultiSelect(e,t);break}}setupTextareaAutoResize(e){let t=()=>{e.style.height="auto",e.style.height=`${Math.min(e.scrollHeight,200)}px`,this._inputScrollable&&this.layoutInputScrollable(this._inputScrollable),this._onDidChangeHeight.fire()};return this._inputBoxes.add(j(e,re.INPUT,t)),t}renderTextInput(e,t){let o=this._inputBoxes.add(new Vc(e,void 0,{placeholder:d(7719,null),inputBoxStyles:Cl,validationOptions:t.validation?{validation:r=>{if(!r&&!t.required)return null;let s=this.getValidationError(r,t.validation);return s?{type:2,content:s}:null}}:void 0}));this._inputBoxes.add(o.onDidChange(()=>{this.saveCurrentAnswer()}));let n=this._answers.get(t.id);n!==void 0?o.value=String(n):t.defaultValue!==void 0&&(o.value=String(t.defaultValue)),this._textInputBoxes.set(t.id,o),this._shouldAutoFocus()&&this._inputBoxes.add(zh(Re(o.element),()=>o.focus()))}renderSingleSelect(e,t){let o=this.getOptionsWithDefaultsFirst(t),n=_(".chat-question-list");n.setAttribute("role","listbox"),n.setAttribute("aria-label",t.title),n.tabIndex=0,e.appendChild(n);let r=this._answers.get(t.id),s=typeof r=="object"&&r!==null&&No(r,{selectedValue:!0})?r:void 0,l=s?.freeformValue,c=s?.selectedValue,u=typeof t.defaultValue=="string"?t.defaultValue:void 0,p=-1;o.forEach(({option:b},S)=>{(c!==void 0&&b.value===c||p===-1&&!l&&u!==void 0&&b.id===u)&&(p=S)});let h=[],g=[],f=b=>{h.forEach((y,w)=>{let k=w===b;y.classList.toggle("selected",k),y.setAttribute("aria-selected",String(k));let T=g[w];T.classList.toggle("codicon",k),T.classList.toggle("codicon-check",k)}),b>=0&&b<h.length&&n.setAttribute("aria-activedescendant",h[b].id);let S=this._singleSelectItems.get(t.id);S&&(S.selectedIndex=b),this.saveCurrentAnswer()};o.forEach(({option:b},S)=>{let y=S===p,w=_(".chat-question-list-item");w.setAttribute("role","option"),w.setAttribute("aria-selected",String(y)),w.setAttribute("aria-label",d(7727,null,S+1,b.label)),w.id=`option-${t.id}-${S}`,w.tabIndex=-1;let k=_(".chat-question-list-number");k.textContent=`${S+1}`,w.appendChild(k);let T=_(".chat-question-list-indicator");y&&T.classList.add("codicon","codicon-check"),g.push(T);let P=_(".chat-question-list-label"),O=b.label.indexOf(" - ");if(O!==-1){w.classList.add("has-description");let V=_("span.chat-question-list-label-title");V.textContent=b.label.substring(0,O),P.appendChild(V);let H=_("span.chat-question-list-label-desc");H.textContent=b.label.substring(O+3),P.appendChild(H)}else P.textContent=b.label;w.appendChild(P),w.appendChild(T),y&&w.classList.add("selected"),this._inputBoxes.add(j(w,re.CLICK,V=>{V.preventDefault(),V.stopPropagation(),f(S);let H=this._freeformTextareas.get(t.id);H&&(H.value=""),this.handleNextOrSubmit()})),this._inputBoxes.add(this._hoverService.setupDelayedHover(w,{content:b.label,position:{hoverPosition:2},appearance:{showPointer:!0}})),n.appendChild(w),h.push(w)}),this._singleSelectItems.set(t.id,{items:h,selectedIndex:p,optionIndices:o.map(b=>b.originalIndex)}),p>=0&&p<h.length&&n.setAttribute("aria-activedescendant",h[p].id);let v;if(t.allowFreeformInput!==!1){let b=_(".chat-question-freeform"),S=_(".chat-question-freeform-number");S.textContent=`${o.length+1}`,b.appendChild(S),v=_("textarea.chat-question-freeform-textarea"),v.placeholder=d(7718,null),v.rows=1,l!==void 0&&(v.value=l);let y=this.setupTextareaAutoResize(v),w=v;this._inputBoxes.add(j(w,re.INPUT,()=>{w.value.length>0?f(-1):this.saveCurrentAnswer()})),b.appendChild(v),e.appendChild(b),this._freeformTextareas.set(t.id,v),l!==void 0&&this._inputBoxes.add(zh(Re(w),()=>y()))}if(this._inputBoxes.add(j(n,re.KEY_DOWN,b=>{let S=new gi(b),y=this._singleSelectItems.get(t.id);if(!y||!h.length)return;let w=y.selectedIndex;if(S.keyCode===18)b.preventDefault(),w=Math.min(y.selectedIndex+1,h.length-1);else if(S.keyCode===16)b.preventDefault(),w=Math.max(y.selectedIndex-1,0);else if((S.keyCode===3||S.keyCode===10)&&!S.metaKey&&!S.ctrlKey){b.preventDefault(),b.stopPropagation(),this.handleNextOrSubmit();return}else if(S.keyCode>=22&&S.keyCode<=30){let k=S.keyCode-22;k<h.length?(b.preventDefault(),f(k)):v&&k===h.length&&(b.preventDefault(),f(-1),v.focus());return}w!==y.selectedIndex&&w>=0&&f(w)})),this._shouldAutoFocus()){if(v&&l){let b=v;this._inputBoxes.add(zh(Re(b),()=>{b.focus()}))}else if(h.length>0){let b=p>=0?p:0;p<0&&f(0),this._inputBoxes.add(zh(Re(n),()=>{h[b]?.focus()}))}}}renderMultiSelect(e,t){let o=this.getOptionsWithDefaultsFirst(t),n=_(".chat-question-list");n.setAttribute("role","listbox"),n.setAttribute("aria-multiselectable","true"),n.setAttribute("aria-label",t.title),n.tabIndex=0,e.appendChild(n);let r=this._answers.get(t.id),s=typeof r=="object"&&r!==null&&No(r,{selectedValues:!0})?r:void 0,l=s?.freeformValue,c=s?.selectedValues??[],u=Array.isArray(t.defaultValue)?t.defaultValue:typeof t.defaultValue=="string"?[t.defaultValue]:[],p=[],h=[],g=0,f=-1;o.forEach(({option:b},S)=>{let y=!1;c&&c.length>0?y=c.includes(b.value):!l&&u.includes(b.id)&&(y=!0);let w=_(".chat-question-list-item.multi-select");w.setAttribute("role","option"),w.setAttribute("aria-selected",String(y)),w.setAttribute("aria-label",d(7727,null,S+1,b.label)),w.id=`option-${t.id}-${S}`,w.tabIndex=-1;let k=_(".chat-question-list-number");k.textContent=`${S+1}`,w.appendChild(k);let T=this._inputBoxes.add(new Ev(b.label,y,qf));T.domNode.classList.add("chat-question-list-checkbox"),T.domNode.tabIndex=-1,w.appendChild(T.domNode);let P=_(".chat-question-list-label"),O=b.label.indexOf(" - ");if(O!==-1){w.classList.add("has-description");let V=_("span.chat-question-list-label-title");V.textContent=b.label.substring(0,O),P.appendChild(V);let H=_("span.chat-question-list-label-desc");H.textContent=b.label.substring(O+3),P.appendChild(H)}else P.textContent=b.label;w.appendChild(P),y&&(w.classList.add("checked"),f===-1&&(f=S)),this._inputBoxes.add(T.onChange(()=>{w.classList.toggle("checked",T.checked),w.setAttribute("aria-selected",String(T.checked)),this.saveCurrentAnswer()})),this._inputBoxes.add(j(w,re.CLICK,V=>{g=S,V.target!==T.domNode&&!T.domNode.contains(V.target)&&T.domNode.click()})),this._inputBoxes.add(this._hoverService.setupDelayedHover(w,{content:b.label,position:{hoverPosition:2},appearance:{showPointer:!0}})),n.appendChild(w),p.push(T),h.push(w)}),this._multiSelectCheckboxes.set(t.id,{checkboxes:p,optionIndices:o.map(b=>b.originalIndex)});let v;if(t.allowFreeformInput!==!1){let b=_(".chat-question-freeform"),S=_(".chat-question-freeform-number");S.textContent=`${o.length+1}`,b.appendChild(S),v=_("textarea.chat-question-freeform-textarea"),v.placeholder=d(7718,null),v.rows=1,l!==void 0&&(v.value=l);let y=this.setupTextareaAutoResize(v);this._inputBoxes.add(j(v,re.INPUT,()=>this.saveCurrentAnswer())),b.appendChild(v),e.appendChild(b),this._freeformTextareas.set(t.id,v),l!==void 0&&this._inputBoxes.add(zh(Re(v),()=>y()))}if(this._inputBoxes.add(j(n,re.KEY_DOWN,b=>{let S=new gi(b);if(h.length){if(S.keyCode===18)b.preventDefault(),g=Math.min(g+1,h.length-1),h[g].focus();else if(S.keyCode===16)b.preventDefault(),g=Math.max(g-1,0),h[g].focus();else if(S.keyCode===3&&!S.metaKey&&!S.ctrlKey)b.preventDefault(),b.stopPropagation(),this.handleNextOrSubmit();else if(S.keyCode===10)b.preventDefault(),g>=0&&g<p.length&&p[g].domNode.click();else if(S.keyCode>=22&&S.keyCode<=30){let y=S.keyCode-22;y<p.length?(b.preventDefault(),p[y].domNode.click()):v&&y===p.length&&(b.preventDefault(),v.focus())}}})),this._shouldAutoFocus()){if(v&&l){let b=v;this._inputBoxes.add(zh(Re(b),()=>{b.focus()}))}else if(h.length>0){let b=f>=0?f:0;g=b,this._inputBoxes.add(zh(Re(n),()=>{h[b]?.focus()}))}}}getCurrentAnswer(){let e=this.carousel.questions[this._currentIndex];if(e)switch(e.type){case"text":return this._textInputBoxes.get(e.id)?.value??(typeof e.defaultValue=="string"?e.defaultValue:Array.isArray(e.defaultValue)?{selectedValues:e.defaultValue}:void 0);case"singleSelect":{let t=this._singleSelectItems.get(e.id),o;if(t&&t.selectedIndex>=0){let s=t.optionIndices[t.selectedIndex];o=s!==void 0?e.options?.[s]?.value:void 0}o===void 0&&typeof e.defaultValue=="string"&&(o=e.options?.find(l=>l.id===e.defaultValue)?.value);let n=this._freeformTextareas.get(e.id),r=n?.value!==""?n?.value:void 0;return r?{selectedValue:void 0,freeformValue:r}:o!==void 0?{selectedValue:o,freeformValue:void 0}:void 0}case"multiSelect":{let t=this._multiSelectCheckboxes.get(e.id),o=[];t&&t.checkboxes.forEach((s,l)=>{if(s.checked){let c=t.optionIndices[l],u=c!==void 0?e.options?.[c]?.value:void 0;u!==void 0&&o.push(u)}});let n=this._freeformTextareas.get(e.id),r=n?.value!==""?n?.value:void 0;return r||o.length>0?{selectedValues:o,freeformValue:r}:void 0}default:return typeof e.defaultValue=="string"?e.defaultValue:Array.isArray(e.defaultValue)?{selectedValues:e.defaultValue}:void 0}}getOptionsWithDefaultsFirst(e){let o=(e.options??[]).map((c,u)=>({option:c,originalIndex:u})),n=Array.isArray(e.defaultValue)?e.defaultValue:typeof e.defaultValue=="string"?[e.defaultValue]:[];if(n.length===0)return o;let r=new Set(n),s=[],l=[];for(let c of o)r.has(c.option.id)?s.push(c):l.push(c);return[...s,...l]}renderSkippedMessage(){let e=_(".chat-question-carousel-summary"),t=_(".chat-question-summary-skipped");t.textContent=d(7733,null),e.appendChild(t),this.domNode.appendChild(e)}renderSummary(){if(this._answers.size===0){this.carousel.isUsed&&this.renderSkippedMessage();return}let e=_(".chat-question-carousel-summary");for(let t of this.carousel.questions){let o=this._answers.get(t.id),n=_(".chat-question-summary-item"),r=_("div.chat-question-summary-label"),s=t.message??t.title,l=typeof s=="string"?s:s.value;if(l=l.replace(/[:\s]+$/,""),r.textContent=d(7738,null,l),n.appendChild(r),o!==void 0){let c=this.formatAnswerForSummary(t,o),u=_("div.chat-question-summary-answer-title");u.textContent=d(7737,null,c),n.appendChild(u)}else{let c=_("div.chat-question-summary-unanswered");c.textContent=d(7726,null),n.appendChild(c)}e.appendChild(n)}this.domNode.appendChild(e)}formatAnswerForSummary(e,t){switch(e.type){case"text":return String(t);case"singleSelect":{if(typeof t=="object"){let{selectedValue:n,freeformValue:r}=t,s=n!==void 0?e.options?.find(l=>l.value===n)?.label:void 0;return r||(s??String(n??""))}return e.options?.find(n=>n.value===t)?.label??String(t)}case"multiSelect":{if(typeof t=="object"&&No(t,{selectedValues:!0})){let{selectedValues:o,freeformValue:n}=t,r=o.map(s=>e.options?.find(l=>l.value===s)?.label??String(s));return n&&r.push(n),r.join(d(7723,null))}return String(t)}default:return String(t)}}getQuestionText(e){let t=typeof e=="string"?new Ie(e):e;return Da(t)}validateCurrentQuestion(){let e=this.carousel.questions[this._currentIndex];if(!e)return!0;let t=this._answers.get(e.id);if(e.required&&(t===void 0||t===""))return this.showValidationError(d(7729,null)),!1;if(e.type==="text"&&e.validation&&typeof t=="string"&&t!==""){let o=this.getValidationError(t,e.validation);if(o)return this.showValidationError(o),!1}return this.clearValidationError(),!0}validateRequiredFields(){for(let e=0;e<this.carousel.questions.length;e++){let t=this.carousel.questions[e];if(!t.required)continue;let o=this._answers.get(t.id);if(o===void 0||o==="")return this.saveCurrentAnswer(),this._currentIndex=e,this.persistDraftState(),this.renderCurrentQuestion(!0),this.showValidationError(d(7729,null)),!1}return!0}getValidationError(e,t){if(t.minLength!==void 0&&e.length<t.minLength)return d(7746,null,t.minLength);if(t.maxLength!==void 0&&e.length>t.maxLength)return d(7744,null,t.maxLength);if(t.format)switch(t.format){case"email":if(!e.includes("@"))return d(7741,null);break;case"uri":if(!URL.canParse(e))return d(7748,null);break;case"date":{if(!/^\d{4}-\d{2}-\d{2}$/.test(e)||isNaN(new Date(e).getTime()))return d(7739,null);break}case"date-time":if(isNaN(new Date(e).getTime()))return d(7740,null);break}if(t.isInteger!==void 0||t.minimum!==void 0||t.maximum!==void 0){let o=Number(e);if(isNaN(o))return d(7747,null);if(t.isInteger&&!Number.isInteger(o))return d(7742,null);if(t.minimum!==void 0&&o<t.minimum)return d(7745,null,t.minimum);if(t.maximum!==void 0&&o>t.maximum)return d(7743,null,t.maximum)}}showValidationError(e){this._currentValidationError=e,this._validationMessageElement&&(this._validationMessageElement.textContent=e,this._validationMessageElement.style.display="")}clearValidationError(){this._currentValidationError=void 0,this._validationMessageElement&&(this._validationMessageElement.textContent="",this._validationMessageElement.style.display="none")}hasSameContent(e,t,o){return!this._isSkipped&&!this.carousel.isUsed&&Ui(o)&&o.isComplete?!1:e.kind==="questionCarousel"&&e===this.carousel}addDisposable(e){this._register(e)}dispose(){!this._isSkipped&&!this.carousel.isUsed&&this.saveCurrentAnswer(),super.dispose()}};$8=I([m(3,On),m(4,nt),m(5,Oi),m(6,X),m(7,_e)],$8);var Nzt=class{constructor(i,e,t,o=!1){this.location=e;this.parent=t;this.ignoreCase=o;if(e[e.length-1]==="\\")throw Error("Unexpected path format, do not use trailing backslashes");e[e.length-1]!=="/"&&(e+="/"),this.isPathIgnored=this.parseIgnoreFile(i,this.location,this.parent)}updateContents(i){this.isPathIgnored=this.parseIgnoreFile(i,this.location,this.parent)}isPathIncludedInTraversal(i,e){if(i[0]!=="/"||i[i.length-1]==="/")throw Error("Unexpected path format, expected to begin with slash and end without. got:"+i);return!this.isPathIgnored(i,e)}isArbitraryPathIgnored(i,e){if(i[0]!=="/"||i[i.length-1]==="/")throw Error("Unexpected path format, expected to begin with slash and end without. got:"+i);let t=i.split("/").filter(r=>r),o=!1,n="";for(let r=0;r<t.length;r++){let s=r===t.length-1,l=t[r];if(n=n+"/"+l,!this.isPathIncludedInTraversal(n,s?e:!0)){o=!0;break}}return o}gitignoreLinesToExpression(i,e,t){let o=i.map(r=>this.gitignoreLineToGlob(r,e)),n=Object.create(null);for(let r of o)n[r]=!0;return Ym(n,{trimForExclusions:t,ignoreCase:this.ignoreCase})}parseIgnoreFile(i,e,t){let o=i.split(`
`).map(v=>v.trim()).filter(v=>v&&v[0]!=="#"),n=o.filter(v=>!v.endsWith("/")),r=n.filter(v=>!v.includes("!")),s=this.gitignoreLinesToExpression(r,e,!0),l=n.filter(v=>v.includes("!")).map(v=>v.replace(/!/g,"")),c=this.gitignoreLinesToExpression(l,e,!1),u=o.filter(v=>!v.includes("!")),p=this.gitignoreLinesToExpression(u,e,!0),h=o.filter(v=>v.includes("!")).map(v=>v.replace(/!/g,"")),g=this.gitignoreLinesToExpression(h,e,!1);return(v,b)=>(this.ignoreCase?mE(v,e):v.startsWith(e))?b&&p(v)&&!g(v)||s(v)&&!c(v)?!0:t?t.isPathIgnored(v,b):!1:!1}gitignoreLineToGlob(i,e){let t=i.indexOf("/");return t===-1||t===i.length-1?i="**/"+i:(t===0?e.slice(-1)==="/"&&(i=i.slice(1)):e.slice(-1)!=="/"&&(i="/"+i),i=e+i),i}};var aDi=class extends x{constructor(){super(...arguments);this._onDidRegisterDescriptor=this._register(new E);this.onDidRegisterDescriptor=this._onDidRegisterDescriptor.event;this.descriptors=[]}register(e){this.descriptors.push(e),this._onDidRegisterDescriptor.fire(e)}create(e,t,o){return this.descriptors.map(n=>{let r=n.create(e,t);return o.add(r),r})}},Ozt=new aDi;ne.add("workbench.registry.explorer.fileContributions",Ozt);var fot=class a{static{this.ITEM_HEIGHT=22}getHeight(i){return a.ITEM_HEIGHT}getTemplateId(i){return j8.ID}},Fzt=new E,yNe=class{constructor(i,e,t,o,n,r,s,l,c,u){this.fileFilter=i;this.findProvider=e;this.progressService=t;this.configService=o;this.notificationService=n;this.layoutService=r;this.fileService=s;this.explorerService=l;this.contextService=c;this.filesConfigService=u}getParent(i){if(i.parent)return i.parent;throw new Error("getParent only supported for cached parents")}hasChildren(i){return Array.isArray(i)||i.hasChildren(e=>this.fileFilter.filter(e,1))}getChildren(i){if(Array.isArray(i))return i;if(this.findProvider.isShowingFilterResults())return Array.from(i.children.values());let e=i.error,t=this.explorerService.sortOrderConfiguration.sortOrder,o=i.fetchChildren(t);if(Array.isArray(o))return o;let n=o.then(r=>(i instanceof qg&&i.isRoot&&!i.error&&e&&this.contextService.getWorkbenchState()!==2&&Fzt.fire(i.resource),r),r=>{if(i instanceof qg&&i.isRoot)if(this.contextService.getWorkbenchState()===2){let s=new qg(i.resource,this.fileService,this.configService,this.filesConfigService,void 0,void 0,!1);return s.error=r,[s]}else Fzt.fire(i.resource);else this.notificationService.error(r);return[]});return this.progressService.withProgress({location:1,delay:this.layoutService.isRestored()?800:1500},r=>n),n}};yNe=I([m(2,Fo),m(3,B),m(4,Ne),m(5,yi),m(6,fe),m(7,Oa),m(8,Pe),m(9,gr)],yNe);var Wzt=class extends qg{},lDi=class{constructor(){this._tree=new Map;this._highlightedItems=new Map}get highlightedItems(){return Array.from(this._highlightedItems.values())}get(i){let e=this.find(i);if(e===void 0)return 0;let{treeLayer:t,relPath:o}=e;return this._highlightedItems.set(o,i),t.childMatches}find(i){let e=this._tree.get(i.root.name);if(e===void 0)return;let t=Wd(i.root.resource,i.resource);if(t===void 0||t.startsWith(".."))throw new Error("Resource is not a child of the root");if(t==="")return{treeLayer:e,relPath:t};let o=e;for(let n of t.split("/")){if(!o.stats[n])return;o=o.stats[n]}return{treeLayer:o,relPath:t}}add(i,e){let t=Wd(e.resource,i);if(t===void 0||t.startsWith(".."))throw new Error("Resource is not a child of the root");let o=this._tree.get(e.name);o||(o={childMatches:0,stats:{},isMatch:!1},this._tree.set(e.name,o)),o.childMatches++;let n=o;for(let r of t.split("/"))n.stats[r]||(n.stats[r]={childMatches:0,stats:{},isMatch:!1}),n=n.stats[r],n.childMatches++;n.childMatches--,n.isMatch=!0}isMatch(i){let e=this.find(i);if(e===void 0)return!1;let{treeLayer:t}=e;return t.isMatch}clear(){this._tree.clear()}},wNe=class{constructor(i,e,t,o,n,r,s,l,c){this.filesFilter=i;this.treeProvider=e;this.searchService=t;this.fileService=o;this.configurationService=n;this.filesConfigService=r;this.progressService=s;this.explorerService=l;this.sessionId=0;this.phantomParents=new Set;this.findHighlightTree=new lDi;this.explorerFindActiveContextKey=OFt.bindTo(c)}get highlightTree(){return this.findHighlightTree}isShowingFilterResults(){return!!this.filterSessionStartState}isVisible(i){return!this.filterSessionStartState||this.explorerService.isEditable(i)?!0:this.filterSessionStartState.rootsWithProviders.has(i.root)?i.isMarkedAsFiltered():!0}startSession(){this.sessionId++}async endSession(){this.filterSessionStartState&&await this.endFilterSession(),this.highlightSessionStartState&&this.endHighlightSession()}async find(i,e,t){let o=this.doFind(i,e,t);return await this.progressService.withProgress({location:1,delay:750},n=>o)}async doFind(i,e,t){return e.findMode===0?(this.filterSessionStartState&&await this.endFilterSession(),this.highlightSessionStartState||this.startHighlightSession(),await this.doHighlightFind(i,e.matchType,t)):(this.highlightSessionStartState&&this.endHighlightSession(),this.filterSessionStartState||this.startFilterSession(),await this.doFilterFind(i,e.matchType,t))}startFilterSession(){let i=this.treeProvider(),e=i.getInput();if(!e)return;let t=this.explorerService.roots.filter(o=>this.searchSupportsScheme(o.resource.scheme));this.filterSessionStartState={viewState:i.getViewState(),input:e,rootsWithProviders:new Set(t)},this.explorerFindActiveContextKey.set(!0)}async doFilterFind(i,e,t){if(!this.filterSessionStartState)throw new Error("ExplorerFindProvider: no session state");let o=Array.from(this.filterSessionStartState.rootsWithProviders),n=await this.getSearchResults(i,o,e,t);if(t.isCancellationRequested)return;this.clearPhantomElements();for(let{explorerRoot:l,files:c,directories:u}of n)this.addWorkspaceFilterResults(l,c,u);await this.treeProvider().setInput(this.filterSessionStartState.input);let s=n.some(({hitMaxResults:l})=>l);return{isMatch:l=>l.isMarkedAsFiltered(),matchCount:n.reduce((l,{files:c,directories:u})=>l+c.length+u.length,0),warningMessage:s?d(11127,null):void 0}}addWorkspaceFilterResults(i,e,t){let o=[...e.map(n=>({resource:n,isDirectory:!1})),...t.map(n=>({resource:n,isDirectory:!0}))];for(let{resource:n,isDirectory:r}of o){let s=i.find(n);if(s&&s.root===i){s.markItemAndParentsAsFiltered();continue}let l=this.createPhantomItems(n,i,r);if(l.length===0)throw new Error("Phantom item was not created even though it is not in the model");let c=l[0].parent;c instanceof Wzt||this.phantomParents.add(c),l[l.length-1].markItemAndParentsAsFiltered()}}createPhantomItems(i,e,t){let o=Wd(e.resource,i);if(!o)throw new Error("Resource is not a child of the root");let n=[],r=e,s=e.resource,l=o.split("/");for(let c of l){s=s.with({path:`${s.path}/${c}`});let u=r.getChild(c);if(!u){let p=l[l.length-1]===c?t:!0;u=new Wzt(s,this.fileService,this.configurationService,this.filesConfigService,r,p),r.addChild(u),n.push(u)}r=u}return n}async endFilterSession(){if(this.clearPhantomElements(),this.explorerFindActiveContextKey.set(!1),!this.filterSessionStartState)throw new Error("ExplorerFindProvider: no session state to restore");await this.treeProvider().setInput(this.filterSessionStartState.input,this.filterSessionStartState.viewState),this.filterSessionStartState=void 0,this.explorerService.refresh()}clearPhantomElements(){for(let i of this.phantomParents)i.forgetChildren();this.phantomParents.clear(),this.explorerService.roots.forEach(i=>i.unmarkItemAndChildren())}startHighlightSession(){let i=this.explorerService.roots.filter(e=>this.searchSupportsScheme(e.resource.scheme));this.highlightSessionStartState={rootsWithProviders:new Set(i)}}async doHighlightFind(i,e,t){if(!this.highlightSessionStartState)throw new Error("ExplorerFindProvider: no highlight session state");let o=Array.from(this.highlightSessionStartState.rootsWithProviders),n=await this.getSearchResults(i,o,e,t);if(t.isCancellationRequested)return;this.clearHighlights();for(let{explorerRoot:s,files:l,directories:c}of n)this.addWorkspaceHighlightResults(s,l.concat(c));let r=n.some(({hitMaxResults:s})=>s);return{isMatch:s=>this.findHighlightTree.isMatch(s)||this.findHighlightTree.get(s)>0&&this.treeProvider().isCollapsed(s),matchCount:n.reduce((s,{files:l,directories:c})=>s+l.length+c.length,0),warningMessage:r?d(11127,null):void 0}}addWorkspaceHighlightResults(i,e){let t=new Set,o=r=>{for(;r;)t.add(r),r=r.parent};for(let r of e){let s=i.find(r);if(s&&s.root===i){this.findHighlightTree.add(r,i),o(s.parent);continue}let l=Nen(r,i);l&&(this.findHighlightTree.add(r,i),o(l.parent))}let n=this.treeProvider();for(let r of t)n.hasNode(r)&&n.rerender(r)}endHighlightSession(){this.highlightSessionStartState=void 0,this.clearHighlights()}clearHighlights(){let i=this.treeProvider();for(let e of this.findHighlightTree.highlightedItems)i.hasNode(e)&&i.rerender(e);this.findHighlightTree.clear()}searchSupportsScheme(i){return i!==Q.file&&i!==Q.vscodeRemote?!1:this.searchService.schemeHasFileSearchProvider(i)}async getSearchResults(i,e,t,o){let n=i.toLowerCase(),r=t===0;return await Promise.all(e.map((s,l)=>this.searchInWorkspace(n,s,l,r,o)))}async searchInWorkspace(i,e,t,o,n){let r=o?Oen(i):Fen(i),s=KB(this.configurationService.getValue({resource:e.resource}))||{},l={folderQueries:[{folder:e.resource,disregardIgnoreFiles:!this.configurationService.getValue("explorer.excludeGitIgnore")}],type:1,shouldGlobMatchFilePattern:!0,cacheKey:`explorerfindprovider:${e.name}:${t}:${this.sessionId}`,excludePattern:s,ignoreGlobCase:!0},c,u;try{[c,u]=await Promise.all([this.searchService.fileSearch({...l,filePattern:`**/${r}`,maxResults:512},n),this.searchService.fileSearch({...l,filePattern:`**/${r}/**`},n)])}catch(v){if(!ao(v))throw v}if(!c||!u||n.isCancellationRequested)return{explorerRoot:e,files:[],directories:[],hitMaxResults:!1};let p=c.results.map(v=>v.resource),h=Aen(u.results.map(v=>v.resource),e,r),g=p.filter(v=>!this.filesFilter.isIgnored(v,e.resource,!1)),f=h.filter(v=>!this.filesFilter.isIgnored(v,e.resource,!0));return{explorerRoot:e,files:g,directories:f,hitMaxResults:!!c.limitHit||!!u.limitHit}}};wNe=I([m(2,gg),m(3,fe),m(4,B),m(5,gr),m(6,Fo),m(7,Oa),m(8,X)],wNe);function Aen(a,i,e){let t=new En;for(let n of a){let r=Wd(i.resource,n);if(!r)throw new Error("Resource is not a child of the root");let s=i.resource,l=r.split("/").slice(0,-1);for(let c of l)s=s.with({path:`${s.path}/${c}`}),t.add(s)}let o=[];for(let n of t){let r=n.path.split("/"),s=r[r.length-1];!s||!Ed(e,s,{ignoreCase:!0})||o.push(n)}return o}function Nen(a,i){let e=Wd(i.resource,a);if(!e)throw new Error("Resource is not a child of the root");let t=i,o=i.resource,n=e.split("/");for(let r of n){o=o.with({path:`${o.path}/${r}`});let s=t.getChild(r);if(!s)return t;t=s}}function Oen(a){return a?"*"+a.split("").join("*")+"*":"*"}function Fen(a){return a?"*"+a+"*":"*"}var Vzt=class{constructor(i,e,t,o,n){this.id=i;this.items=e;this.depth=o;this.collapsed=n;this._onDidChange=new E;this.onDidChange=this._onDidChange.event;this._index=e.length-1,this.updateLabels(t),this._updateLabelDisposable=t.label.onDidRender(()=>this.updateLabels(t))}static{this.ID=0}get index(){return this._index}get count(){return this.items.length}get current(){return this.items[this._index]}get currentId(){return`${this.id}_${this.index}`}get labels(){return this._labels}updateLabels(i){this._labels=Array.from(i.container.querySelectorAll(".label-name"));let e="";for(let t=0;t<this.labels.length;t++){let o=e.length?`${this.items[t].name}, compact, ${e}`:this.items[t].name;this.labels[t].setAttribute("aria-label",o),this.labels[t].setAttribute("aria-level",`${this.depth+t}`),e=e.length?`${this.items[t].name} ${e}`:this.items[t].name}this.updateCollapsed(this.collapsed),this._index<this.labels.length&&this.labels[this._index].classList.add("active")}previous(){this._index<=0||this.setIndex(this._index-1)}next(){this._index>=this.items.length-1||this.setIndex(this._index+1)}first(){this._index!==0&&this.setIndex(0)}last(){this._index!==this.items.length-1&&this.setIndex(this.items.length-1)}setIndex(i){i<0||i>=this.items.length||(this.labels[this._index].classList.remove("active"),this._index=i,this.labels[this._index].classList.add("active"),this._onDidChange.fire())}updateCollapsed(i){this.collapsed=i;for(let e=0;e<this.labels.length;e++)this.labels[e].setAttribute("aria-expanded",i?"false":"true")}dispose(){this._onDidChange.dispose(),this._updateLabelDisposable.dispose()}},j8=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h){this.labels=e;this.highlightTree=t;this.updateWidth=o;this.contextViewService=n;this.themeService=r;this.configurationService=s;this.explorerService=l;this.labelService=c;this.contextService=u;this.contextMenuService=p;this.instantiationService=h;this.compressedNavigationControllers=new Map;this._onDidChangeActiveDescendant=new AI;this.onDidChangeActiveDescendant=this._onDidChangeActiveDescendant.event;this.config=this.configurationService.getValue();let g=()=>{let f=this.configurationService.getValue("workbench.tree.indent"),v=Math.max(22-f,0);i.style.setProperty("--vscode-explorer-align-offset-margin-left",`${v}px`)};this.configListener=this.configurationService.onDidChangeConfiguration(f=>{f.affectsConfiguration("explorer")&&(this.config=this.configurationService.getValue()),f.affectsConfiguration("workbench.tree.indent")&&g()}),g()}static{this.ID="file"}getWidgetAriaLabel(){return d(11128,null)}get templateId(){return j8.ID}renderTemplate(i){let e=new N,t=e.add(this.labels.create(i,{supportHighlights:!0}));e.add(t.onDidRender(()=>{Wr(Re(n.container),()=>{try{n.currentContext&&this.updateWidth(n.currentContext)}catch{}})}));let o=Ozt.create(this.instantiationService,i,e);e.add(Ozt.onDidRegisterDescriptor(r=>{let s=r.create(this.instantiationService,i);o.push(e.add(s)),s.setResource(n.currentContext?.resource)}));let n={templateDisposables:e,elementDisposables:e.add(new N),label:t,container:i,contribs:o};return n}renderElement(i,e,t){let o=i.element;t.currentContext=o;let n=this.explorerService.getEditableData(o);t.label.element.classList.remove("compressed"),n?(t.label.element.style.display="none",t.contribs.forEach(r=>r.setResource(void 0)),t.elementDisposables.add(this.renderInputBox(t.container,o,n))):(t.label.element.style.display="flex",this.renderStat(o,o.name,void 0,i.filterData,t))}renderCompressedElements(i,e,t){let o=i.element.elements[i.element.elements.length-1];t.currentContext=o;let n=i.element.elements.filter(s=>this.explorerService.isEditable(s)),r=n.length===0?void 0:this.explorerService.getEditableData(n[0]);if(r)t.label.element.classList.remove("compressed"),t.label.element.style.display="none",t.contribs.forEach(s=>s.setResource(void 0)),t.elementDisposables.add(this.renderInputBox(t.container,n[0],r));else{t.label.element.classList.add("compressed"),t.label.element.style.display="flex";let s=`compressed-explorer_${Vzt.ID++}`,l=i.element.elements.map(h=>h.name),c=i.filterData;if(c&&c.length>2){let h=l.join("/").length-l[l.length-1].length;c=[c[0],c[1]+h,...c.slice(2)]}this.renderStat(o,l,s,c,t);let u=new Vzt(s,i.element.elements,t,i.depth,i.collapsed);t.elementDisposables.add(u);let p=this.compressedNavigationControllers.get(o)??[];this.compressedNavigationControllers.set(o,[...p,u]),t.elementDisposables.add(this._onDidChangeActiveDescendant.add(u.onDidChange)),t.elementDisposables.add(j(t.container,"mousedown",h=>{let g=Bzt(h.target);g&&u.setIndex(g.index)})),t.elementDisposables.add(Z(()=>{let h=this.compressedNavigationControllers.get(o)??[],g=h.findIndex(f=>f===u);if(g<0)throw new Error("Disposing unknown navigation controller");h.length===1?this.compressedNavigationControllers.delete(o):h.splice(g,1)}))}}renderStat(i,e,t,o,n){n.label.element.style.display="flex";let r=["explorer-item"];this.explorerService.isCut(i)&&r.push("cut");let s=this.themeService.getFileIconTheme();n.container.parentElement?.parentElement?.querySelector(".monaco-tl-twistie")?.classList.toggle("force-twistie",i.hasNests&&s.hidesExplorerArrows);let c=s.hasFileIcons&&(s.hidesExplorerArrows||!s.hasFolderIcons),u=i.nestedParent&&c;n.contribs.forEach(h=>h.setResource(i.resource)),n.label.setResource({resource:i.resource,name:e},{fileKind:i.isRoot?2:i.isDirectory?1:0,extraClasses:u?[...r,"align-nest-icon-with-parent-icon"]:r,fileDecorations:this.config.explorer.decorations,matches:xa(o),separator:this.labelService.getSeparator(i.resource.scheme,i.resource.authority),domId:t});let p=i.isDirectory?this.highlightTree.get(i):0;if(p>0){let h=new _v(n.label.element.lastElementChild,{},{...iI,badgeBackground:kt(n4i),badgeBorder:kt(r4i)});h.setCount(p),h.setTitleFormat(d(11120,null,p)),n.elementDisposables.add(h)}n.label.element.classList.toggle("highlight-badge",p>0)}renderInputBox(i,e,t){let o=this.labels.create(i),n=["explorer-item","explorer-item-edited"],r=e.isRoot?2:e.isDirectory?1:0,s=this.themeService.getFileIconTheme(),l=s.hasFileIcons&&(s.hidesExplorerArrows||!s.hasFolderIcons),c=e.nestedParent&&l,u={hidePath:!0,hideLabel:!0,fileKind:r,extraClasses:c?[...n,"align-nest-icon-with-parent-icon"]:n},p=e.name?ci(e.resource):e.resource,h=e.name||"";o.setFile(Ge(p,h||" "),u),o.element.firstElementChild.style.display="none";let g=new Vc(o.element,this.contextViewService,{validationOptions:{validation:w=>{let k=t.validationMessage(w);return!k||k.severity!==ft.Error?null:{content:k.content,formatContent:!0,type:3}}},ariaLabel:d(11121,null),inputBoxStyles:Cl}),f=h.lastIndexOf("."),v="prefix";g.value=h,g.focus(),g.select({start:0,end:f>0&&!e.isDirectory?f:h.length});let b=$c((w,k)=>{o.element.style.display="none";let T=g.value;Be(y),o.element.remove(),k&&t.onFinish(T,w)}),S=()=>{if(g.isInputValid()){let w=t.validationMessage(g.value);w?g.showMessage({content:w.content,formatContent:!0,type:w.severity===ft.Info?1:w.severity===ft.Warning?2:3}):g.hideMessage()}};S();let y=[g,g.onDidChange(w=>{o.setFile(Ge(p,w||" "),u)}),Jo(g.inputElement,re.KEY_DOWN,w=>{if(w.equals(60)){let k=g.value.lastIndexOf(".");if(e.isDirectory||k===-1)return;v==="prefix"?(v="all",g.select({start:0,end:g.value.length})):v==="all"?(v="suffix",g.select({start:k+1,end:g.value.length})):(v="prefix",g.select({start:0,end:k}))}else w.equals(3)?g.validate()||b(!0,!0):w.equals(9)&&b(!1,!0)}),Jo(g.inputElement,re.KEY_UP,w=>{S()}),j(g.inputElement,re.BLUR,async()=>{for(;;){await Li(0);let w=g.inputElement.ownerDocument;if(!w.hasFocus())break;if(wa(g.inputElement))return;if(Do(w.activeElement)&&PIe(w.activeElement,"context-view"))await U.toPromise(this.contextMenuService.onDidHideContextMenu);else break}b(g.isInputValid(),!0)}),o];return Z(()=>{b(!1,!1)})}disposeElement(i,e,t){t.currentContext=void 0,t.elementDisposables.clear()}disposeCompressedElements(i,e,t){t.currentContext=void 0,t.elementDisposables.clear()}disposeTemplate(i){i.templateDisposables.dispose()}getCompressedNavigationController(i){return this.compressedNavigationControllers.get(i)}getAriaLabel(i){return i.name}getAriaLevel(i){let e=0,t=i.parent;for(;t;)t=t.parent,e++;return this.contextService.getWorkbenchState()===3&&(e=e+1),e}getActiveDescendantId(i){return this.compressedNavigationControllers.get(i)?.[0]?.currentId??void 0}dispose(){this.configListener.dispose()}};j8=I([m(4,Wn),m(5,Le),m(6,B),m(7,Oa),m(8,rt),m(9,Pe),m(10,Xe),m(11,F)],j8);var CNe=class{constructor(i,e,t,o,n,r){this.contextService=i;this.configurationService=e;this.explorerService=t;this.editorService=o;this.uriIdentityService=n;this.fileService=r;this.hiddenExpressionPerRoot=new Map;this.editorsAffectingFilter=new Set;this._onDidChange=new E;this.toDispose=[];this.ignoreFileResourcesPerRoot=new Map;this.ignoreTreesPerRoot=new Map;this.toDispose.push(this._onDidChange),this.toDispose.push(this.contextService.onDidChangeWorkspaceFolders(()=>this.updateConfiguration())),this.toDispose.push(this.configurationService.onDidChangeConfiguration(s=>{(s.affectsConfiguration("files.exclude")||s.affectsConfiguration("explorer.excludeGitIgnore"))&&this.updateConfiguration()})),this.toDispose.push(this.fileService.onDidFilesChange(s=>{for(let[l,c]of this.ignoreFileResourcesPerRoot.entries())c.forEach(async u=>{s.contains(u,0)&&await this.processIgnoreFile(l,u,!0),s.contains(u,2)&&(this.ignoreTreesPerRoot.get(l)?.delete(ci(u)),c.delete(u),this._onDidChange.fire())})})),this.toDispose.push(this.editorService.onDidVisibleEditorsChange(()=>{let s=this.editorService.visibleEditors,l=!1;for(let c of s){if(!c.resource)continue;if(this.explorerService.findClosest(c.resource)?.isExcluded){l=!0;break}}for(let c of this.editorsAffectingFilter)if(!s.includes(c)){l=!0;break}l&&(this.editorsAffectingFilter.clear(),this._onDidChange.fire())})),this.updateConfiguration()}get onDidChange(){return this._onDidChange.event}updateConfiguration(){let i=!1,e=!1;this.contextService.getWorkspace().folders.forEach(t=>{let o=this.configurationService.getValue({resource:t.uri}),n=o?.files?.exclude||Object.create(null),r=o.explorer.excludeGitIgnore;if(r&&!this.ignoreTreesPerRoot.has(t.uri.toString())&&(e=!0,this.ignoreFileResourcesPerRoot.set(t.uri.toString(),new En),this.ignoreTreesPerRoot.set(t.uri.toString(),Sp.forUris(l=>this.uriIdentityService.extUri.ignorePathCasing(l)))),!r&&this.ignoreTreesPerRoot.has(t.uri.toString())&&(e=!0,this.ignoreFileResourcesPerRoot.delete(t.uri.toString()),this.ignoreTreesPerRoot.delete(t.uri.toString())),!i){let l=this.hiddenExpressionPerRoot.get(t.uri.toString());i=!l||!eo(l.original,n)}let s=Ji(n);this.hiddenExpressionPerRoot.set(t.uri.toString(),{original:s,parsed:Ym(s)})}),(i||e)&&(this.editorsAffectingFilter.clear(),this._onDidChange.fire())}async processIgnoreFile(i,e,t){let o=ci(e),n=this.ignoreTreesPerRoot.get(i);if(!n||!t&&n.has(o))return;let r=await this.fileService.readFile(e);if(t)n.get(o)?.updateContents(r.value.toString());else{let s=n.findSubstr(o),l=!this.fileService.hasCapability(e,1024),c=new Nzt(r.value.toString(),o.path,s,l);n.set(o,c),this.ignoreFileResourcesPerRoot.get(i)?.has(e)||this.ignoreFileResourcesPerRoot.get(i)?.add(e)}this._onDidChange.fire()}filter(i,e){return i.name===".gitignore"&&this.ignoreTreesPerRoot.has(i.root.resource.toString())?(this.processIgnoreFile(i.root.resource.toString(),i.resource,!1),!0):this.isVisible(i,e)}isVisible(i,e){if(i.isExcluded=!1,e===0)return i.isExcluded=!0,!1;if(this.explorerService.getEditableData(i))return!0;if((this.hiddenExpressionPerRoot.get(i.root.resource.toString())?.parsed(dP(i.root.resource.path,i.resource.path),i.name,r=>!!i.parent?.getChild(r))?!0:this.isIgnored(i.resource,i.root.resource,i.isDirectory))||i.parent?.isExcluded){i.isExcluded=!0;let s=this.editorService.visibleEditors.find(l=>l.resource&&this.uriIdentityService.extUri.isEqualOrParent(l.resource,i.resource));return s&&i.root===this.explorerService.findClosestRoot(i.resource)?(this.editorsAffectingFilter.add(s),!0):!1}return!0}isIgnored(i,e,t){let n=this.ignoreTreesPerRoot.get(e.toString())?.findSubstr(i)?.isPathIncludedInTraversal(i.path,t);return n===void 0?!1:!n}dispose(){Be(this.toDispose)}};CNe=I([m(0,Pe),m(1,B),m(2,Oa),m(3,ee),m(4,ht),m(5,fe)],CNe);var xNe=class{constructor(i,e){this.explorerService=i;this.contextService=e}compare(i,e){if(i.isRoot){if(e.isRoot){let l=this.contextService.getWorkspaceFolder(i.resource),c=this.contextService.getWorkspaceFolder(e.resource);return l&&c?l.index-c.index:-1}return-1}if(e.isRoot)return 1;let t=this.explorerService.sortOrderConfiguration.sortOrder,o=this.explorerService.sortOrderConfiguration.lexicographicOptions;this.explorerService.sortOrderConfiguration.reverse&&([i,e]=[e,i]);let r,s;switch(o){case"upper":r=Tlo,s=Rlo;break;case"lower":r=_lo,s=Mlo;break;case"unicode":r=Dlo,s=Plo;break;default:r=tJe,s=Llo}switch(t){case"type":if(i.isDirectory&&!e.isDirectory)return-1;if(e.isDirectory&&!i.isDirectory)return 1;if(i.isDirectory&&e.isDirectory)return r(i.name,e.name);break;case"filesFirst":if(i.isDirectory&&!e.isDirectory)return 1;if(e.isDirectory&&!i.isDirectory)return-1;break;case"foldersNestsFiles":if(i.isDirectory&&!e.isDirectory)return-1;if(e.isDirectory&&!i.isDirectory)return 1;if(i.hasNests&&!e.hasNests)return-1;if(e.hasNests&&!i.hasNests)return 1;break;case"mixed":break;default:if(i.isDirectory&&!e.isDirectory)return-1;if(e.isDirectory&&!i.isDirectory)return 1;break}switch(t){case"type":return s(i.name,e.name);case"modified":return i.mtime!==e.mtime?i.mtime&&e.mtime&&i.mtime<e.mtime?1:-1:r(i.name,e.name);default:return r(i.name,e.name)}}};xNe=I([m(0,Oa),m(1,Pe)],xNe);var HT=class{constructor(i,e,t,o,n,r,s,l,c,u){this.isCollapsed=i;this.explorerService=e;this.editorService=t;this.dialogService=o;this.contextService=n;this.fileService=r;this.configurationService=s;this.instantiationService=l;this.workspaceEditingService=c;this.uriIdentityService=u;this.compressedDropTargetDisposable=x.None;this.disposables=new N;this.dropEnabled=!1;let p=h=>{(!h||h.affectsConfiguration("explorer.enableDragAndDrop"))&&(this.dropEnabled=this.configurationService.getValue("explorer.enableDragAndDrop"))};p(void 0),this.disposables.add(this.configurationService.onDidChangeConfiguration(h=>p(h)))}static{this.CONFIRM_DND_SETTING_KEY="explorer.confirmDragAndDrop"}onDragOver(i,e,t,o,n){if(!this.dropEnabled)return!1;if(e){let r=HT.getCompressedStatFromDragEvent(e,n);if(r){let s=Bzt(n.target);if(s&&s.index<s.count-1){let l=this.handleDragOver(i,r,t,o,n);return l?(s.element!==this.compressedDragOverElement&&(this.compressedDragOverElement=s.element,this.compressedDropTargetDisposable.dispose(),this.compressedDropTargetDisposable=Z(()=>{s.element.classList.remove("drop-target"),this.compressedDragOverElement=void 0}),s.element.classList.add("drop-target")),typeof l=="boolean"?l:{...l,feedback:[]}):(this.compressedDropTargetDisposable.dispose(),!1)}}}return this.compressedDropTargetDisposable.dispose(),this.handleDragOver(i,e,t,o,n)}handleDragOver(i,e,t,o,n){let r=n&&(n.ctrlKey&&!Ze||n.altKey&&Ze),s=i instanceof Cz,c={type:s||r?0:1,position:"drop-target"};if(s){if(!Ip(n,yl.FILES,hc.FILES,yl.RESOURCES))return!1}else{if(i instanceof J5e)return!1;{let u=HT.getStatsFromDragAndDropData(i),p=u.every(h=>h.isRoot);if(!e)return!r&&u.every(h=>!!h.parent&&h.parent.isRoot)?!1:p?{accept:!0,effect:{type:1,position:"drop-target-after"}}:{accept:!0,bubble:0,effect:c,autoExpand:!1};if(!Array.isArray(u)||!r&&u.every(h=>h.isReadonly)||u.some(h=>h.isRoot?!1:!!(this.uriIdentityService.extUri.isEqual(h.resource,e.resource)||!r&&this.uriIdentityService.extUri.isEqual(ci(h.resource),e.resource)||this.uriIdentityService.extUri.isEqualOrParent(e.resource,h.resource))))return!1;if(p){if(!e.isRoot)return!1;let h;switch(o){case 0:case 1:h="drop-target-before";break;case 2:case 3:h="drop-target-after";break}return{accept:!0,effect:{type:1,position:h}}}}}if(e){if(e.isDirectory)return e.isReadonly?!1:{accept:!0,bubble:0,effect:c,autoExpand:!0};if(this.contextService.getWorkspace().folders.every(u=>u.uri.toString()!==e.resource.toString()))return{accept:!0,bubble:1,effect:c}}else return{accept:!0,bubble:0,effect:c};return!1}getDragURI(i){return this.explorerService.isEditable(i)?null:i.resource.toString()}getDragLabel(i,e){return i.length===1?HT.getCompressedStatFromDragEvent(i[0],e).name:String(i.length)}onDragStart(i,e){let t=HT.getStatsFromDragAndDropData(i,e);if(t.length&&e.dataTransfer){this.instantiationService.invokeFunction(n=>tv(n,t,e));let o=t.filter(n=>n.resource.scheme===Q.file).map(n=>n.resource.fsPath);o.length&&e.dataTransfer.setData(hc.FILES,JSON.stringify(o))}}async drop(i,e,t,o,n){if(this.compressedDropTargetDisposable.dispose(),e){let s=HT.getCompressedStatFromDragEvent(e,n);s&&(e=s)}if(e||(e=this.explorerService.roots[this.explorerService.roots.length-1],o=3),!e.isDirectory&&e.parent&&(e=e.parent),e.isReadonly)return;let r=e;if(r)try{i instanceof Cz?!Wt||gw(this.contextService.getWorkspace())&&$x.supported(ut)?await this.instantiationService.createInstance(uNe).import(r,n,ut):await this.instantiationService.createInstance(jH).upload(e,n):await this.handleExplorerDrop(i,r,t,o,n)}catch(s){this.dialogService.error(xn(s))}}async handleExplorerDrop(i,e,t,o,n){let r=HT.getStatsFromDragAndDropData(i),s=new Map(r.map(h=>[h,this.isCollapsed(h)]));for(let[h,g]of s)if(g){let f=h.nestedChildren;if(f)for(let v of f)s.set(v,!0)}let l=y$e([...s.keys()],h=>h.resource),c=n.ctrlKey&&!Ze||n.altKey&&Ze;if(!c&&this.configurationService.getValue(HT.CONFIRM_DND_SETTING_KEY)){let h=l.length>1&&l.every(v=>v.isRoot)?d(11116,null):l.length>1?d(11114,null,l.length,e.name):l[0].isRoot?d(11115,null,l[0].name):d(11113,null,l[0].name,e.name),g=l.length>1&&!l.every(v=>v.isRoot)?kC(l.map(v=>v.resource)):void 0,f=await this.dialogService.confirm({message:h,detail:g,checkbox:{label:d(11119,null)},primaryButton:d(11123,null)});if(!f.confirmed)return;f.checkboxChecked===!0&&await this.configurationService.updateValue(HT.CONFIRM_DND_SETTING_KEY,!1)}await this.doHandleRootDrop(l.filter(h=>h.isRoot),e,o);let p=l.filter(h=>!h.isRoot);return c?this.doHandleExplorerDropOnCopy(p,e):this.doHandleExplorerDropOnMove(p,e)}async doHandleRootDrop(i,e,t){if(i.length===0)return;let o=this.contextService.getWorkspace().folders,n,r=[],s=[],l=[];for(let c=0;c<o.length;c++){let u={uri:o[c].uri,name:o[c].name};e instanceof qg&&this.uriIdentityService.extUri.isEqual(o[c].uri,e.resource)&&(n=c);for(let p of i)if(this.uriIdentityService.extUri.isEqual(o[c].uri,p.resource)){r.push(c);break}i.every(p=>p.resource.toString()!==o[c].uri.toString())?s.push(u):l.push(u)}if(n===void 0)n=s.length;else{switch(t){case 3:case 2:n++;break}for(let c of r)c<n&&n--}return s.splice(n,0,...l),this.workspaceEditingService.updateFolders(0,s.length,s)}async doHandleExplorerDropOnCopy(i,e){let t=this.configurationService.getValue().explorer,o=[];for(let{resource:s,isDirectory:l}of i){let c=t.incrementalNaming==="disabled",u=await mzt(this.explorerService,this.fileService,this.dialogService,e,{resource:s,isDirectory:l,allowOverwrite:c},t.incrementalNaming);if(!u)continue;let p=new Cu(s,u,{copy:!0,overwrite:c});o.push(p)}let n=evo(i);await this.explorerService.applyBulkEdit(o,{confirmBeforeUndo:t.confirmUndo==="default"||t.confirmUndo==="verbose",undoLabel:d(11117,null,n),progressLabel:d(11118,null,n)});let r=o.filter(s=>{let l=s.newResource?this.explorerService.findClosest(s.newResource):void 0;return l&&!l.isDirectory}).map(s=>({resource:s.newResource,options:{pinned:!0}}));await this.editorService.openEditors(r)}async doHandleExplorerDropOnMove(i,e){let t=i.filter(r=>!r.isReadonly).map(r=>new Cu(r.resource,Ge(e.resource,r.name))),o=evo(i),n={confirmBeforeUndo:this.configurationService.getValue().explorer.confirmUndo==="verbose",undoLabel:d(11122,null,o),progressLabel:d(11124,null,o)};try{await this.explorerService.applyBulkEdit(t,n)}catch(r){if(r.fileOperationResult===4){let s=[];for(let u of t)u.newResource&&await this.fileService.exists(u.newResource)&&s.push(u.newResource);let l=ufo(s),{confirmed:c}=await this.dialogService.confirm(l);c&&await this.explorerService.applyBulkEdit(t.map(u=>new Cu(u.oldResource,u.newResource,{overwrite:!0})),n)}else throw r}}static getStatsFromDragAndDropData(i,e){return i.context?i.context:e&&i.elements.length===1?(i.context=[HT.getCompressedStatFromDragEvent(i.elements[0],e)],i.context):i.elements}static getCompressedStatFromDragEvent(i,e){let t=Re(e).document.elementFromPoint(e.clientX,e.clientY),o=Bzt(t);if(o){let{count:n,index:r}=o,s=n-1;for(;s>r&&i.parent;)i=i.parent,s--;return i}return i}onDragEnd(){this.compressedDropTargetDisposable.dispose()}dispose(){this.compressedDropTargetDisposable.dispose()}};HT=I([m(1,Oa),m(2,ee),m(3,at),m(4,Pe),m(5,fe),m(6,B),m(7,F),m(8,Db),m(9,ht)],HT);function Bzt(a){if(!Do(a))return null;let i=a;for(;i&&!i.classList.contains("monaco-list-row");){if(i.classList.contains("label-name")&&i.hasAttribute("data-icon-label-count")){let e=Number(i.getAttribute("data-icon-label-count")),t=Number(i.getAttribute("data-icon-label-index"));if(Yo(e)&&Yo(t))return{element:i,count:e,index:t}}i=i.parentElement}return null}function tvo(a){return!!Bzt(a)}var Hzt=class{isIncompressible(i){return i.isRoot||!i.isDirectory||i instanceof W8||!i.parent||i.parent.isRoot}};function evo(a){return a.length===1?a[0].name:a.every(i=>i.isDirectory)?d(11126,null,a.length):a.every(i=>!i.isDirectory)?d(11125,null,a.length):`${a.length} files and folders`}function Wen(a){if(a.isRoot&&a.error)return{tooltip:d(11102,null,xn(a.error)),letter:"!",color:Z5i};if(a.isSymbolicLink)return{tooltip:d(11104,null),letter:"\u2937"};if(a.isUnknown)return{tooltip:d(11105,null),letter:"?"};if(a.isExcluded)return{color:Kvt}}var kNe=class{constructor(i,e){this.explorerService=i;this.label=d(11103,null);this._onDidChange=new E;this.toDispose=new N;this.toDispose.add(this._onDidChange),this.toDispose.add(e.onDidChangeWorkspaceFolders(t=>{this._onDidChange.fire(t.changed.concat(t.added).map(o=>o.uri))})),this.toDispose.add(Fzt.event((t=>{this._onDidChange.fire([t])})))}get onDidChange(){return this._onDidChange.event}async provideDecorations(i){let e=this.explorerService.findClosest(i);if(!e)throw new Error("ExplorerItem not found");return Wen(e)}dispose(){this.toDispose.dispose()}};kNe=I([m(0,Oa),m(1,Pe)],kNe);function Ven(a,i){for(let e of i)if(a.hasNode(e)&&!a.isCollapsed(e)){for(let[,t]of e.children.entries())if(a.hasNode(t)&&a.isCollapsible(t)&&!a.isCollapsed(t))return!0}return!1}function Ben(a,i){for(let e of i)if(a.hasNode(e)&&!a.isCollapsed(e))return!0;return!1}var Hen={getId:a=>a instanceof W8?`new:${a.getId()}`:a.getId()};function Uen(a,i,e,t){let o;o=a.length?a[0]:void 0,e&&i.length>1&&(o=void 0);let n=o&&t.getCompressedNavigationController(o),r=n?.length?n[0]:void 0;o=r?r.current:o;let s=[];for(let l of i){let u=t.getCompressedNavigationController(l)?.at(0);if(u&&o&&u===r){l===o&&s.push(l);continue}u?s.push(...u.items):s.push(l)}return o?e&&s.indexOf(o)>=0?s:[o]:e?s:[]}var pW=class extends Gs{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,P,O,V,H,G){super(e,p,t,g,h,o,n,H,b,y);this.contextService=r;this.progressService=s;this.editorService=l;this.editorResolverService=c;this.layoutService=u;this.decorationService=f;this.labelService=v;this.telemetryService=S;this.explorerService=w;this.storageService=k;this.clipboardService=T;this.fileService=P;this.uriIdentityService=O;this.commandService=V;this.accessibilityService=G;this._autoReveal=!1;this.delegate=e.delegate,this.resourceContext=n.createInstance(Wo),this._register(this.resourceContext),this.parentReadonlyContext=twi.bindTo(h),this.folderContext=Gd.bindTo(h),this.readonlyContext=ewi.bindTo(h),this.availableEditorIdsContext=AFt.bindTo(h),this.rootContext=ux.bindTo(h),this.resourceMoveableToTrash=Fpe.bindTo(h),this.compressedFocusContext=Wpe.bindTo(h),this.compressedFocusFirstContext=uJe.bindTo(h),this.compressedFocusLastContext=pJe.bindTo(h),this.viewHasSomeCollapsibleRootItem=aco.bindTo(h),this.viewVisibleContextKey=D3.bindTo(h),this.explorerService.registerView(this)}static{this.TREE_VIEW_STATE_STORAGE_KEY="workbench.explorer.treeViewState"}get singleViewPaneContainerTitle(){return this.name}get autoReveal(){return this._autoReveal}set autoReveal(e){this._autoReveal=e}get name(){return this.labelService.getWorkspaceLabel(this.contextService.getWorkspace())}get title(){return this.name}set title(e){}setVisible(e){this.viewVisibleContextKey.set(e),super.setVisible(e)}get fileCopiedContextKey(){return xzt.bindTo(this.contextKeyService)}get resourceCutContextKey(){return NFt.bindTo(this.contextKeyService)}renderHeader(e){super.renderHeader(e),this.dragHandler=new rwe(e,()=>this.setExpanded(!0));let t=e.querySelector(".title"),o=()=>{t.textContent=this.name,this.updateTitle(this.name),this.ariaHeaderLabel=d(11110,null,this.name),t.setAttribute("aria-label",this.ariaHeaderLabel)};this._register(this.contextService.onDidChangeWorkspaceName(o)),this._register(this.labelService.onDidChangeFormatters(o)),o()}layoutBody(e,t){super.layoutBody(e,t),this.tree.layout(e,t)}renderBody(e){super.renderBody(e),this.container=e,this.treeContainer=M(e,_(".explorer-folders-view")),this.createTree(this.treeContainer),this._register(this.labelService.onDidChangeFormatters(()=>{this._onDidChangeTitleArea.fire()})),this.onConfigurationUpdated(void 0),this._register(this.editorService.onDidActiveEditorChange(()=>{this.selectActiveFile()})),this._register(this.configurationService.onDidChangeConfiguration(t=>this.onConfigurationUpdated(t))),this._register(this.onDidChangeBodyVisibility(async t=>{t&&(await this.setTreeInput(),this.updateAnyCollapsedContext(),this.selectActiveFile(!0))})),this._register(j(Re(this.container),re.PASTE,async t=>{!this.hasFocus()||this.readonlyContext.get()||t.clipboardData?.files?.length&&await this.commandService.executeCommand("filesExplorer.paste",t.clipboardData?.files)}))}focus(){if(super.focus(),this.tree.domFocus(),this.tree.getFocusedPart()===0){let e=this.tree.getFocus();e.length===1&&this._autoReveal&&this.tree.reveal(e[0],.5)}}hasFocus(){return Gr(this.container)}getFocus(){return this.tree.getFocus()}focusNext(){this.tree.focusNext()}focusLast(){this.tree.focusLast()}getContext(e){let t=this.tree.getFocusedPart()===1?this.tree.getStickyScrollFocus():this.tree.getFocus();return Uen(t,this.tree.getSelection(),e,this.renderer)}isItemVisible(e){return this.filter?this.filter.filter(e,1):!1}isItemCollapsed(e){return this.tree.isCollapsed(e)}async setEditable(e,t){t?(this.horizontalScrolling=this.tree.options.horizontalScrolling,this.horizontalScrolling&&this.tree.updateOptions({horizontalScrolling:!1}),await this.tree.expand(e.parent)):(this.horizontalScrolling!==void 0&&this.tree.updateOptions({horizontalScrolling:this.horizontalScrolling}),this.horizontalScrolling=void 0,this.treeContainer.classList.remove("highlight")),await this.refresh(!1,e.parent,!1),t?(this.treeContainer.classList.add("highlight"),this.tree.reveal(e)):this.tree.domFocus()}async selectActiveFile(e=this._autoReveal){if(this._autoReveal){let t=po.getCanonicalUri(this.editorService.activeEditor,{supportSideBySide:1});if(t){let o=this.tree.getFocus(),n=this.tree.getSelection();return o.length===1&&this.uriIdentityService.extUri.isEqual(o[0].resource,t)&&n.length===1&&this.uriIdentityService.extUri.isEqual(n[0].resource,t)?void 0:this.explorerService.select(t,e)}}}createTree(e){this.filter=this.instantiationService.createInstance(CNe),this._register(this.filter),this._register(this.filter.onDidChange(()=>this.refresh(!0)));let t=this.instantiationService.createInstance(Nl,{onDidChangeVisibility:this.onDidChangeBodyVisibility});this._register(t),this.findProvider=this.instantiationService.createInstance(wNe,this.filter,()=>this.tree);let o=l=>this.tree.updateWidth(l);this.renderer=this.instantiationService.createInstance(j8,e,t,this.findProvider.highlightTree,o),this._register(this.renderer),this._register(Q8(e,this.themeService));let n=()=>{let l=this.configurationService.getValue("explorer.compactFolders");return this.accessibilityService.isScreenReaderOptimized()?!1:l},r=l=>this.configurationService.getValue({resource:l?.root.resource}).explorer.fileNesting;this.tree=this.instantiationService.createInstance(sy,"FileExplorer",e,new fot,new Hzt,[this.renderer],this.instantiationService.createInstance(yNe,this.filter,this.findProvider),{compressionEnabled:n(),accessibilityProvider:this.renderer,identityProvider:Hen,keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:l=>{if(!this.explorerService.isEditable(l))return l.name},getCompressedNodeKeyboardNavigationLabel:l=>{if(!l.some(c=>this.explorerService.isEditable(c)))return l.map(c=>c.name).join("/")}},multipleSelectionSupport:!0,filter:this.filter,sorter:this.instantiationService.createInstance(xNe),dnd:this.instantiationService.createInstance(HT,l=>this.isItemCollapsed(l)),collapseByDefault:l=>!(l instanceof qg&&(l.hasNests&&r(l).expand||this.findProvider.isShowingFilterResults())),autoExpandSingleChildren:!0,expandOnlyOnTwistieClick:l=>{if(l instanceof qg){if(l.hasNests)return!0;if(this.configurationService.getValue("workbench.tree.expandMode")==="doubleClick")return!0}return!1},paddingBottom:fot.ITEM_HEIGHT,overrideStyles:this.getLocationBasedColors().listOverrideStyles,findProvider:this.findProvider}),this._register(this.tree),this._register(this.themeService.onDidColorThemeChange(()=>this.tree.rerender()));let s=U.filter(this.configurationService.onDidChangeConfiguration,l=>l.affectsConfiguration("explorer.compactFolders"));this._register(s(l=>this.tree.updateOptions({compressionEnabled:n()}))),this._register(this.accessibilityService.onDidChangeScreenReaderOptimized(()=>{this.tree.updateOptions({compressionEnabled:n()})})),iwi.bindTo(this.tree.contextKeyService),dJe.bindTo(this.tree.contextKeyService),this._register(this.tree.onDidChangeFocus(l=>this.onFocusChanged(l.elements))),this.onFocusChanged([]),this._register(this.tree.onDidOpen(async l=>{let c=l.element;if(!c)return;if(!(xg(l.browserEvent)&&l.browserEvent.shiftKey)){if(c.isDirectory||this.explorerService.isEditable(void 0))return;this.telemetryService.publicLog2("workbenchActionExecuted",{id:"workbench.files.openFile",from:"explorer"});try{this.delegate?.willOpenElement(l.browserEvent),await this.editorService.openEditor({resource:c.resource,options:{preserveFocus:l.editorOptions.preserveFocus,pinned:l.editorOptions.pinned,source:1}},l.sideBySide?In:jn)}finally{this.delegate?.didOpenElement()}}})),this._register(this.tree.onContextMenu(l=>this.onContextMenu(l))),this._register(this.tree.onDidScroll(async l=>{let c=this.explorerService.getEditable();l.scrollTopChanged&&c&&this.tree.getRelativeTop(c.stat)===null&&await c.data.onFinish("",!1)})),this._register(this.tree.onDidChangeCollapseState(l=>{let c=l.node.element?.element;c&&this.renderer.getCompressedNavigationController(Array.isArray(c)?c[0]:c)?.forEach(p=>p.updateCollapsed(l.node.collapsed)),this.updateAnyCollapsedContext()})),this.updateAnyCollapsedContext(),this._register(this.tree.onMouseDblClick(l=>{let c=this.configurationService.getValue("workbench.list.scrollByPage");l.element===null&&!c&&this.commandService.executeCommand(Yhe)})),this._register(this.storageService.onWillSaveState(()=>{this.storeTreeViewState()}))}onConfigurationUpdated(e){if(!e||e.affectsConfiguration("explorer.autoReveal")){let t=this.configurationService.getValue();this._autoReveal=t?.explorer?.autoReveal}e&&(e.affectsConfiguration("explorer.decorations.colors")||e.affectsConfiguration("explorer.decorations.badges"))&&this.refresh(!0)}storeTreeViewState(){this.storageService.store(pW.TREE_VIEW_STATE_STORAGE_KEY,JSON.stringify(this.tree.getViewState()),1,1)}setContextKeys(e){let t=this.contextService.getWorkspace().folders,o=e?e.resource:t[t.length-1].uri;if(e=e||this.explorerService.findClosest(o),this.resourceContext.set(o),this.folderContext.set(!!e&&e.isDirectory),this.readonlyContext.set(!!e&&!!e.isReadonly),this.parentReadonlyContext.set(!!e?.parent?.isReadonly),this.rootContext.set(!!e&&e.isRoot),o){let n=o?this.editorResolverService.getEditors(o).map(r=>r.id):[];this.availableEditorIdsContext.set(n.join(","))}else this.availableEditorIdsContext.reset()}async onContextMenu(e){if(Kh(e.browserEvent.target))return;let t=e.element,o=e.anchor;if(Do(o)&&t){let l=this.renderer.getCompressedNavigationController(t);l&&l.length>0&&(xg(e.browserEvent)||tvo(e.browserEvent.target)?o=l[0].labels[l[0].index]:l.forEach(c=>c.last()))}this.fileCopiedContextKey.set(await this.clipboardService.hasResources()),this.setContextKeys(t);let n=this.tree.getSelection(),r=this.explorerService.roots,s;if(t instanceof qg){let l=this.renderer.getCompressedNavigationController(t);s=l?.length?l[0].current.resource:t.resource}else s=r.length===1?r[0].resource:{};this.contextMenuService.showContextMenu({menuId:D.ExplorerContext,menuActionOptions:{arg:s,shouldForwardArgs:!0},contextKeyService:this.tree.contextKeyService,getAnchor:()=>o,onHide:l=>{l&&this.tree.domFocus()},getActionsContext:()=>t&&n&&n.indexOf(t)>=0?n.map(l=>l.resource):t instanceof qg?[t.resource]:[]})}onFocusChanged(e){let t=e.at(0);if(this.setContextKeys(t),t){let n=!!this.configurationService.getValue().files?.enableTrash,r=this.fileService.hasCapability(t.resource,4096);this.resourceMoveableToTrash.set(n&&r)}else this.resourceMoveableToTrash.reset();let o=t&&this.renderer.getCompressedNavigationController(t);if(!o){this.compressedFocusContext.set(!1);return}this.compressedFocusContext.set(!0),o.forEach(n=>{this.updateCompressedNavigationContextKeys(n)})}refresh(e,t,o=!0){if(!this.tree||!this.isBodyVisible()||t&&!this.tree.hasNode(t)||this.findProvider?.isShowingFilterResults()&&e)return Promise.resolve(void 0);o&&this.explorerService.isEditable(void 0)&&this.tree.domFocus();let n=t||this.tree.getInput();return this.tree.updateChildren(n,e,!!t)}getOptimalWidth(){let e=this.tree.getHTMLElement(),t=[].slice.call(e.querySelectorAll(".explorer-item .label-name"));return MIe(e,t)}async setTreeInput(){if(!this.isBodyVisible())return Promise.resolve(void 0);this.setTreeInputPromise&&await this.setTreeInputPromise;let e=!this.tree.getInput();e&&Mo("code/willResolveExplorer");let t=this.explorerService.roots,o=t[0];(this.contextService.getWorkbenchState()!==2||t[0].error)&&(o=t);let n;if(this.tree?.getInput())n=this.tree.getViewState();else{let l=this.storageService.get(pW.TREE_VIEW_STATE_STORAGE_KEY,1);l&&(n=JSON.parse(l))}let r=this.tree.getInput(),s=this.setTreeInputPromise=this.tree.setInput(o,n).then(async()=>{if(Array.isArray(o)){if(!n||r instanceof qg)for(let l=0;l<Math.min(o.length,5);l++)try{await this.tree.expand(o[l])}catch{}if(!r&&o.length===1&&this.configurationService.getValue().explorer.expandSingleFolderWorkspaces&&await this.tree.expand(o[0]).catch(()=>{}),Array.isArray(r)){let l=new gt;r.forEach(c=>l.set(c.resource,!0)),await Promise.all(o.map(async c=>{if(!l.has(c.resource))try{await this.tree.expand(c)}catch{}}))}}e&&Mo("code/didResolveExplorer")});this.progressService.withProgress({location:1,delay:this.layoutService.isRestored()?800:1500},l=>s),await s,this.decorationsProvider||(this.decorationsProvider=new kNe(this.explorerService,this.contextService),this._register(this.decorationService.registerDecorationsProvider(this.decorationsProvider)))}async selectResource(e,t=this._autoReveal,o=0){if(o===2||!e||!this.isBodyVisible())return;this.setTreeInputPromise&&await this.setTreeInputPromise;let n=this.explorerService.findClosestRoot(e);for(;n&&n.resource.toString()!==e.toString();){try{await this.tree.expand(n)}catch{return this.selectResource(e,t,o+1)}if(!n.children.size)n=null;else for(let r of n.children.values()){if(this.uriIdentityService.extUri.isEqualOrParent(e,r.resource)){n=r;break}n=null}}if(n){if(n===this.tree.getInput()){this.tree.setFocus([]),this.tree.setSelection([]);return}try{n.nestedParent&&await this.tree.expand(n.nestedParent),(t===!0||t==="force")&&this.tree.getRelativeTop(n)===null&&this.tree.reveal(n,.5),this.tree.setFocus([n]),this.tree.setSelection([n])}catch{return this.selectResource(e,t,o+1)}}}itemsCopied(e,t,o){this.fileCopiedContextKey.set(e.length>0),this.resourceCutContextKey.set(t&&e.length>0),o?.forEach(n=>this.tree.rerender(n)),t&&e.forEach(n=>this.tree.rerender(n))}expandAll(){this.explorerService.isEditable(void 0)&&this.tree.domFocus(),this.tree.expandAll()}collapseAll(){this.explorerService.isEditable(void 0)&&this.tree.domFocus();let e=this.tree.getInput();if(Array.isArray(e)&&Ven(this.tree,e)){e.forEach(t=>{t.children.forEach(o=>this.tree.hasNode(o)&&this.tree.collapse(o,!0))});return}this.tree.collapseAll()}previousCompressedStat(){let e=this.tree.getFocus();if(!e.length)return;this.renderer.getCompressedNavigationController(e[0]).forEach(o=>{o.previous(),this.updateCompressedNavigationContextKeys(o)})}nextCompressedStat(){let e=this.tree.getFocus();if(!e.length)return;this.renderer.getCompressedNavigationController(e[0]).forEach(o=>{o.next(),this.updateCompressedNavigationContextKeys(o)})}firstCompressedStat(){let e=this.tree.getFocus();if(!e.length)return;this.renderer.getCompressedNavigationController(e[0]).forEach(o=>{o.first(),this.updateCompressedNavigationContextKeys(o)})}lastCompressedStat(){let e=this.tree.getFocus();if(!e.length)return;this.renderer.getCompressedNavigationController(e[0]).forEach(o=>{o.last(),this.updateCompressedNavigationContextKeys(o)})}updateCompressedNavigationContextKeys(e){this.compressedFocusFirstContext.set(e.index===0),this.compressedFocusLastContext.set(e.index===e.count-1)}updateAnyCollapsedContext(){let e=this.tree.getInput();if(e===void 0)return;let t=Array.isArray(e)?e:Array.from(e.children.values());this.viewHasSomeCollapsibleRootItem.set(Ben(this.tree,t)),this.storeTreeViewState()}hasPhantomElements(){return!!this.findProvider?.isShowingFilterResults()}dispose(){this.dragHandler?.dispose(),super.dispose()}};I([hi],pW.prototype,"fileCopiedContextKey",1),I([hi],pW.prototype,"resourceCutContextKey",1),pW=I([m(1,Xe),m(2,Bi),m(3,F),m(4,Pe),m(5,Fo),m(6,ee),m(7,Ka),m(8,yi),m(9,_e),m(10,X),m(11,B),m(12,Ov),m(13,rt),m(14,Le),m(15,Te),m(16,nt),m(17,Oa),m(18,ce),m(19,Fi),m(20,fe),m(21,ht),m(22,ge),m(23,Je),m(24,Oi)],pW);function Q8(a,i){a.classList.add("file-icon-themable-tree"),a.classList.add("show-file-icons");let e=t=>{a.classList.toggle("align-icons-and-twisties",t.hasFileIcons&&!t.hasFolderIcons),a.classList.toggle("hide-arrows",t.hidesExplorerArrows===!0)};return e(i.getFileIconTheme()),i.onDidFileIconThemeChange(e)}var ivo=C.or(C.and(Gd,y0),C.and(Gd.toNegated(),twi.toNegated()));W(class extends K{constructor(){super({id:"workbench.files.action.createFileFromExplorer",title:d(11108,null),f1:!1,icon:R.newFile,precondition:ivo,menu:{id:D.ViewTitle,group:"navigation",when:C.equals("view",Fb),order:10}})}run(a){a.get(ge).executeCommand(Yhe)}});W(class extends K{constructor(){super({id:"workbench.files.action.createFolderFromExplorer",title:d(11109,null),f1:!1,icon:R.newFolder,precondition:ivo,menu:{id:D.ViewTitle,group:"navigation",when:C.equals("view",Fb),order:20}})}run(a){a.get(ge).executeCommand(hNe)}});W(class extends K{constructor(){super({id:"workbench.files.action.refreshFilesExplorer",title:L(11111,"Refresh Explorer"),f1:!0,icon:R.refresh,menu:{id:D.ViewTitle,group:"navigation",when:C.equals("view",Fb),order:30},metadata:{description:L(11112,"Forces a refresh of the Explorer.")},precondition:OFt.negate()})}async run(a){let i=a.get($t),e=a.get(Oa);await i.openView(Fb),await e.refresh()}});W(class extends K{constructor(){super({id:"workbench.files.action.collapseExplorerFolders",title:L(11106,"Collapse Folders in Explorer"),f1:!0,icon:R.collapseAll,menu:{id:D.ViewTitle,group:"navigation",when:C.equals("view",Fb),order:40},metadata:{description:L(11107,"Folds all folders in the Explorer.")}})}run(a){let e=a.get($t).getViewWithId(Fb);e!==null&&e.collapseAll()}});var Gv=le("chatMarkdownAnchorService"),Uzt=class extends x{constructor(){super(...arguments);this._widgets=[];this._lastFocusedWidget=void 0}get lastFocusedAnchor(){return this._lastFocusedWidget}setLastFocusedList(e){this._lastFocusedWidget=e}register(e){if(this._widgets.some(o=>o===e))throw new Error("Cannot register the same widget multiple times");this._widgets.push(e);let t=e.getHTMLElement();return wa(t)&&this.setLastFocusedList(e),wn(j(t,"focus",()=>this.setLastFocusedList(e)),Z(()=>this._widgets.splice(this._widgets.indexOf(e),1)),j(t,"blur",()=>{this._lastFocusedWidget===e&&this.setLastFocusedList(void 0)}))}};function zzt(a,i){let e=i.getValue("chat.editorAssociations")??{},t=Object.keys(e).sort((o,n)=>n.length-o.length);for(let o of t)if(CJ(o,a))return e[o]}function $k(a,i,e,t){a.querySelectorAll("a").forEach(n=>{let r=n.textContent?.trim(),s=!1,l,c=n.getAttribute("data-href"),u;if(c)try{u=A.parse(c)}catch{}if(!r)s=!0;else if(u){let p=new URLSearchParams(u.query),h=p.get("vscodeLinkType");if(h){l={vscodeLinkType:h,linkText:r},s=!0,p.delete("vscodeLinkType");let g=p.toString();u=u.with({query:g})}}if(s&&u?.scheme){let p=i.createInstance(YH,n,{kind:"inlineReference",inlineReference:u},l);t.add(e.register(p)),t.add(p)}})}var YH=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w){super();this.element=e;this.inlineReference=t;this.metadata=o;this.chatImageCarouselService=n;this.configurationService=r;this.notebookDocumentService=y;this.openerService=w;this.data="uri"in t.inlineReference?t.inlineReference:"name"in t.inlineReference?{kind:"symbol",symbol:t.inlineReference}:{uri:t.inlineReference},e.classList.add(YH.className,"show-file-icons");let k,T,P;if(this.data.kind==="symbol"){let G=this.data.symbol;P=this.data.symbol.location,k=[this.data.symbol.name],T=["codicon",...aa(v,g,void 0,void 0,_m.toIcon(G.kind))],this._store.add(p.invokeFunction($=>rDi($,e,s,{value:G.location,name:G.name,kind:G.kind},D.ChatInlineSymbolAnchorContext)))}else{P=this.data;let G=this.metadata?.linkText??h.getUriBasenameLabel(P.uri);if(P.range&&this.data.kind!=="symbol"){let ze=P.range.startLineNumber===P.range.endLineNumber?`:${P.range.startLineNumber}`:`:${P.range.startLineNumber}-${P.range.endLineNumber}`;k=[G,_("span.label-suffix",void 0,ze)]}else P.uri.scheme==="vscode-notebook-cell"&&this.data.kind!=="symbol"?k=[`${G} \u2022 cell${this.getCellIndex(P.uri)}`]:k=[G];let $=P.uri.path.endsWith("/")?1:0,J=()=>aa(v,g,P.uri,$,$===1&&!S.getFileIconTheme().hasFolderIcons?wj:void 0);T=J();let ae=()=>{O.classList.remove(...T),T=J(),O.classList.add(...T)},he=!1;c.stat(P.uri).then(ze=>{he=ze.isDirectory,ze.isDirectory&&($=1,ae())}).catch(()=>{});let oe,de,Ce=!1,xe=()=>(oe||(oe=this._register(s.createScoped(e)),got.bindTo(oe).set(P.uri.toString()),de=Gd.bindTo(oe)),oe);this._register(j(e,re.CONTEXT_MENU,async ze=>{let De=new Cn(Re(ze),ze);Xt.stop(ze,!0);let Oe=xe();Ce||(Ce=!0,new UX(Oe,c,g,v).set(P.uri)),de.set(he),!this._store.isDisposed&&l.showContextMenu({contextKeyService:Oe,getAnchor:()=>De,getActions:()=>{let pt=f.getMenuActions(D.ChatInlineResourceAnchorContext,Oe,{arg:P.uri});return tu(pt)}})})),P.range&&(P.range.startLineNumber===P.range.endLineNumber?e.setAttribute("aria-label",d(7684,null,G,P.range.startLineNumber)):e.setAttribute("aria-label",d(7685,null,G,P.range.startLineNumber,P.range.endLineNumber)))}let O=_("span.icon");O.classList.add(...T),e.replaceChildren(O,_("span.icon-label",{},...k));let V=P.range?`${P.range.startLineNumber},${P.range.startColumn}`:"";e.setAttribute("data-href",(V?P.uri.with({fragment:V}):P.uri).toString());let H=h.getUriLabel(P.uri,{relative:!0});this._register(u.setupManagedHover(Ri("element"),e,H)),this.data.kind!=="symbol"&&(e.draggable=!0,this._register(j(e,"dragstart",G=>{let $={resource:P.uri,selection:P.range};p.invokeFunction(J=>tv(J,[$],G)),G.dataTransfer?.setDragImage(e,0,0)}))),this._register(j(e,"click",async G=>{if(Xt.stop(G,!0),GI(P.uri.path)?.startsWith("image/")&&this.configurationService.getValue("imageCarousel.chat.enabled")){await this.chatImageCarouselService.openCarouselAtResource(P.uri);return}let ae={override:zzt(P.uri,this.configurationService)};P.range&&(ae.selection=P.range),await this.openerService.open(P.uri,{fromUserGesture:!0,editorOptions:ae})}))}static{this.className="chat-inline-anchor-widget"}getHTMLElement(){return this.element}getCellIndex(e){let o=this.notebookDocumentService.getNotebook(e)?.getCellIndex(e)??-1;return o>=0?` ${o+1}`:""}};YH=I([m(3,Qte),m(4,B),m(5,X),m(6,Xe),m(7,fe),m(8,nt),m(9,F),m(10,rt),m(11,_t),m(12,Kt),m(13,Tt),m(14,Te),m(15,Le),m(16,U5),m(17,Je)],YH);W(class ovo extends K{static{this.id="chat.inlineResourceAnchor.addFileToChat"}constructor(){super({id:ovo.id,title:L(7680,"Add File to Chat"),menu:[{id:D.ChatInlineResourceAnchorContext,group:"chat",order:1,when:Gd.negate()}]})}async run(i,e){let o=i.get(Pt).lastFocusedWidget;o&&o.attachmentModel.addFile(e)}});W(class nvo extends K{static{this.id="chat.inlineResourceAnchor.copyResource"}constructor(){super({id:nvo.id,title:L(7681,"Copy"),f1:!1,precondition:got,keybinding:{weight:200,primary:2081}})}async run(i){let e=i.get(Gv),t=i.get(Fi),o=e.lastFocusedAnchor;if(!o)return;let n=o.data.kind==="symbol"?o.data.symbol.location.uri:o.data.uri;t.writeResources([n])}});W(class rvo extends K{static{this.id="chat.inlineResourceAnchor.openToSide"}constructor(){super({id:rvo.id,title:L(7683,"Open to the Side"),f1:!1,precondition:got,keybinding:{weight:402,primary:2051,mac:{primary:259}},menu:[D.ChatInlineSymbolAnchorContext,D.ChatInputSymbolAttachmentContext].map(i=>({id:i,group:"navigation",order:1}))})}async run(i,e){let t=i.get(ee),o=i.get(B),n=this.getTarget(i,e);if(!n)return;let r=A.isUri(n)?n:n.uri,s=zzt(r,o),l=A.isUri(n)?{resource:n,options:{override:s}}:{resource:n.uri,options:{override:s,selection:{startColumn:n.range.startColumn,startLineNumber:n.range.startLineNumber}}};await t.openEditors([l],In)}getTarget(i,e){let t=i.get(Gv);if(e)return e;let o=t.lastFocusedAnchor;if(o)return o.data.kind==="symbol"?o.data.symbol.location:o.data.uri}});W(class svo extends K{static{this.id="chat.inlineSymbolAnchor.goToDefinition"}constructor(){super({id:svo.id,title:{...L(7682,"Go to Definition"),mnemonicTitle:d(7689,null)},menu:[D.ChatInlineSymbolAnchorContext,D.ChatInputSymbolAttachmentContext].map(i=>({id:i,group:"4_symbol_nav",order:1.1,when:pe.hasDefinitionProvider}))})}async run(i,e){let t=i.get(qt),o=i.get(F);await avo(t,e);let n=new nB({openToSide:!1,openInPeek:!1,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0});return o.invokeFunction(r=>n.run(r))}});async function avo(a,i){await a.openCodeEditor({resource:i.uri,options:{selection:{startColumn:i.range.startColumn,startLineNumber:i.range.startLineNumber}}},null)}async function cDi(a,i,e){let t=a.get(qt),o=a.get(ge);return await avo(t,e),o.executeCommand(i)}W(class lvo extends K{static{this.id="chat.inlineSymbolAnchor.goToTypeDefinitions"}constructor(){super({id:lvo.id,title:{...L(7688,"Go to Type Definitions"),mnemonicTitle:d(7692,null)},menu:[D.ChatInlineSymbolAnchorContext,D.ChatInputSymbolAttachmentContext].map(i=>({id:i,group:"4_symbol_nav",order:1.1,when:pe.hasTypeDefinitionProvider}))})}async run(i,e){await cDi(i,"editor.action.goToTypeDefinition",e)}});W(class cvo extends K{static{this.id="chat.inlineSymbolAnchor.goToImplementations"}constructor(){super({id:cvo.id,title:{...L(7686,"Go to Implementations"),mnemonicTitle:d(7690,null)},menu:[D.ChatInlineSymbolAnchorContext,D.ChatInputSymbolAttachmentContext].map(i=>({id:i,group:"4_symbol_nav",order:1.2,when:pe.hasImplementationProvider}))})}async run(i,e){await cDi(i,"editor.action.goToImplementation",e)}});W(class dvo extends K{static{this.id="chat.inlineSymbolAnchor.goToReferences"}constructor(){super({id:dvo.id,title:{...L(7687,"Go to References"),mnemonicTitle:d(7691,null)},menu:[D.ChatInlineSymbolAnchorContext,D.ChatInputSymbolAttachmentContext].map(i=>({id:i,group:"4_symbol_nav",order:1.3,when:pe.hasReferenceProvider}))})}async run(i,e){await cDi(i,"editor.action.goToReferences",e)}});var UT=class extends x{constructor(e,t,o,n,r){super();this.title=e;this.hoverMessage=o;this.hoverService=n;this._renderedTitleWithWidgets=this._register(new me);this._isExpanded=Me(this,!1);this._overrideIcon=Me(this,void 0);this._contentInitialized=!1;this.element=t.element,this.hasFollowingContent=t.contentIndex+1<t.content.length,this._showCheckmarks=hr("accessibility.chat.showCheckmarks",!1,r)}get icon(){return this._overrideIcon.get()}set icon(e){this._overrideIcon.set(e,void 0)}get domNode(){return this._domNode??=this.init(),this._domNode}init(){let e=this.title,t=_(".chat-used-context-label",void 0),o=this._register(new mR(t,{buttonBackground:void 0,buttonBorder:void 0,buttonForeground:void 0,buttonHoverBackground:void 0,buttonSecondaryBackground:void 0,buttonSecondaryForeground:void 0,buttonSecondaryHoverBackground:void 0,buttonSeparator:void 0}));this._collapseButton=o,this._domNode=_(".chat-used-context",void 0,t),o.label=e;let n=_("span.chat-collapsible-hover-chevron.codicon.codicon-chevron-right",{"aria-hidden":"true"});return o.element.appendChild(n),this.hoverMessage&&this._register(this.hoverService.setupDelayedHover(o.iconElement,{content:this.hoverMessage,style:1})),this._register(o.onDidClick(()=>{let r=this._isExpanded.get();this._isExpanded.set(!r,void 0)})),this._isExpanded.set(this.isExpanded(),void 0),this._register(be(r=>{let s=this._isExpanded.read(r),l=this._overrideIcon.read(r),c=this._showCheckmarks.read(r);l&&(o.icon=l),this._domNode?.classList.toggle("show-checkmarks",c),n.classList.toggle("codicon-chevron-right",!s),n.classList.toggle("codicon-chevron-down",s),this._domNode?.classList.toggle("chat-used-context-collapsed",!s),this.updateAriaLabel(o.element,typeof e=="string"?e:e.value,s),(s||this.shouldInitEarly())&&!this._contentInitialized&&(this._contentInitialized=!0,this._contentElement=this.initContent(),this._domNode?.appendChild(this._contentElement))})),this._domNode}shouldInitEarly(){return!1}updateAriaLabel(e,t,o){e.ariaLabel=t,e.ariaExpanded=String(o)}addDisposable(e){this._register(e)}get expanded(){return this._isExpanded}isExpanded(){return this._isExpanded.get()}setExpanded(e){this._isExpanded.set(e,void 0)}setTitle(e){this.title=e,this._collapseButton&&(this._collapseButton.label=e,this.updateAriaLabel(this._collapseButton.element,e,this.isExpanded()))}setTitleWithWidgets(e,t,o,n){if(this._store.isDisposed||!this._collapseButton)return;let r=n.render(e);r.element.classList.add("collapsible-title-content"),$k(r.element,t,o,this._store);let s=this._collapseButton.labelElement;s.textContent="",s.appendChild(r.element);let l=r.element.textContent||"";this.updateAriaLabel(this._collapseButton.element,l,this.isExpanded()),this._renderedTitleWithWidgets.value=r}};UT=I([m(3,nt),m(4,B)],UT);var XH=class{constructor(i){this._itemFactory=i;this.pool=[];this._inUse=new Set}get inUse(){return this._inUse}get(){if(this.pool.length>0){let e=this.pool.pop();return this._inUse.add(e),e}let i=this._itemFactory();return this._inUse.add(i),i}release(i){this._inUse.delete(i),this.pool.push(i)}clear(){for(let i of this.pool)i.dispose();this.pool.length=0}dispose(){this.clear();for(let i of this._inUse)i.dispose();this._inUse.clear()}};var dDi=_,Y8=class extends UT{constructor(e,t,o,n,r,s,l,c,u,p,h){super(t??(e.length>1?d(7761,null,e.length):d(7762,null,1)),o,r,p,h);this.data=e;this.contentReferencesListPool=n;this.openerService=s;this.menuService=l;this.instantiationService=c;this.contextMenuService=u;this.icon=R.check}initContent(){let t=this._register(this.contentReferencesListPool.get()).object;this._register(t.onDidOpen(l=>{if(l.element&&"reference"in l.element&&typeof l.element.reference=="object"){let c="variableName"in l.element.reference?l.element.reference.value:l.element.reference,u=A.isUri(c)?c:c?.uri;u&&this.openerService.open(u,{fromUserGesture:!0,editorOptions:{...l.editorOptions,selection:c&&"range"in c?c.range:void 0}})}})),this._register(t.onContextMenu(l=>{Xt.stop(l.browserEvent,!0);let c=l.element&&vot(l.element);c&&this.contextMenuService.showContextMenu({getAnchor:()=>l.anchor,getActions:()=>{let u=this.menuService.getMenuActions(D.ChatAttachmentsContext,t.contextKeyService,{shouldForwardArgs:!0,arg:c});return tu(u)}})}));let o=this._register(this.instantiationService.createInstance(Wo));this._register(t.onDidChangeFocus(l=>{o.reset();let c=l.elements.length?l.elements[0]:void 0,u=c&&vot(c);o.set(u??null)}));let s=Math.min(this.data.length,6)*22;return t.layout(s),t.getHTMLElement().style.height=`${s}px`,t.splice(0,t.length,this.data),t.getHTMLElement().parentElement}hasSameContent(e,t,o){return e.kind==="references"&&e.references.length===this.data.length&&!!t.length===this.hasFollowingContent}};Y8=I([m(5,Je),m(6,Kt),m(7,F),m(8,Xe),m(9,nt),m(10,B)],Y8);var ENe=class extends Y8{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,t,o,n,void 0,s,l,c,u,p,h);this.options=r;e.length===0&&vo(this.domNode)}isExpanded(){let e=this.element;return e.usedReferencesExpanded??!!(this.options.expandedWhenEmptyResponse&&e.response.value.length===0)}setExpanded(e){let t=this.element;t.usedReferencesExpanded=!this.isExpanded()}};ENe=I([m(5,Je),m(6,Kt),m(7,F),m(8,Xe),m(9,nt),m(10,B)],ENe);var mie=class extends x{constructor(e,t,o,n,r,s){super();this._onDidChangeVisibility=e;this.menuId=t;this.listOptions=o;this.instantiationService=n;this.themeService=r;this.labelService=s;this._pool=this._register(new XH(()=>this.listFactory()))}get inUse(){return this._pool.inUse}listFactory(){let e=new N,t=e.add(this.instantiationService.createInstance(Nl,{onDidChangeVisibility:this._onDidChangeVisibility})),o=dDi(".chat-used-context-list");return e.add(Q8(o,this.themeService)),{list:this.instantiationService.createInstance(Vl,"ChatListRenderer",o,new uDi,[this.instantiationService.createInstance(hie,t,this.menuId)],{...this.listOptions,alwaysConsumeMouseWheel:!1,accessibilityProvider:{getAriaLabel:r=>{if(r.kind==="warning")return r.content.value;let s=r.reference;return typeof s=="string"?s:"variableName"in s?s.variableName:A.isUri(s)?jo(s.path):jo(s.uri.path)},getWidgetAriaLabel:()=>d(7757,null)},dnd:{getDragURI:r=>vot(r)?.toString()??null,getDragLabel:(r,s)=>{let l=di(r.map(vot));if(l.length)return l.length===1?this.labelService.getUriLabel(l[0],{relative:!0}):`${l.length}`},dispose:()=>{},onDragOver:()=>!1,drop:()=>{},onDragStart:(r,s)=>{try{let l=r.getData(),c=di(l.map(vot));this.instantiationService.invokeFunction(u=>tv(u,c,s))}catch{}}}}),dispose:()=>e.dispose()}}get(){let e=this._pool.get(),t=!1;return{object:e.list,isStale:()=>t,dispose:()=>{t=!0,this._pool.release(e)}}}clear(){this._pool.clear()}};mie=I([m(3,F),m(4,Le),m(5,rt)],mie);var uDi=class{getHeight(i){return 22}getTemplateId(i){return hie.TEMPLATE_ID}},hie=class{constructor(i,e,t,o,n,r){this.labels=i;this.menuId=e;this.themeService=t;this.productService=o;this.instantiationService=n;this.contextKeyService=r;this.templateId=hie.TEMPLATE_ID}static{this.TEMPLATE_ID="chatCollapsibleListRenderer"}renderTemplate(i){let e=new N,t=e.add(this.labels.create(i,{supportHighlights:!0,supportIcons:!0})),o=dDi(".working-set-line-counts"),n=_(".working-set-lines-added"),r=_(".working-set-lines-removed");o.appendChild(n),o.appendChild(r),t.element.appendChild(o);let s,l,c;if(this.menuId){l=dDi(".chat-collapsible-list-action-bar"),c=e.add(this.contextKeyService.createScoped(l));let u=e.add(this.instantiationService.createChild(new _o([X,c])));s=e.add(u.createInstance(or,l,this.menuId,{menuOptions:{shouldForwardArgs:!0,arg:void 0}})),t.element.appendChild(l)}return{templateDisposables:e,label:t,toolbar:s,actionBarContainer:l,contextKeyService:c,fileDiffsContainer:o,addedSpan:n,removedSpan:r}}getReferenceIcon(i){return q.isThemeIcon(i.iconPath)?i.iconPath:Bp(this.themeService.getColorTheme().type)&&i.iconPath?.dark?i.iconPath?.dark:i.iconPath?.light}renderElement(i,e,t){if(i.kind==="warning"){t.label.setResource({name:i.content.value},{icon:R.warning});return}let o=i.reference,n=this.getReferenceIcon(i);t.label.element.style.display="flex";let r;if(typeof o=="object"&&"variableName"in o)if(o.value){let s=A.isUri(o.value)?o.value:o.value.uri;t.label.setResource({resource:s,name:Ga(s),description:`#${o.variableName}`,range:"range"in o.value?o.value.range:void 0},{icon:n,title:i.options?.status?.description??i.title})}else if(o.variableName.startsWith("kernelVariable")){let l=`${o.variableName.split(":")[1]}`;t.label.setLabel("Kernel variable",l,{title:i.options?.status?.description})}else t.label.setLabel(o.variableName,void 0,{title:i.options?.status?.description??i.title});else if(typeof o=="string")t.label.setLabel(o,void 0,{iconPath:A.isUri(n)?n:void 0,title:i.options?.status?.description??i.title});else{let s="uri"in o?o.uri:o;r=s;let l=i.excluded?["excluded"]:[];if(s.scheme==="https"&&gV(s.authority,"github.com")&&s.path.includes("/tree/"))t.label.setResource(Ken(s),{icon:R.github,title:i.title,strikethrough:i.excluded,extraClasses:l});else if(s.scheme===this.productService.urlProtocol&&gV(s.authority,E_e)){let c=s.path.substring(1);t.label.setResource({resource:s,name:c},{icon:R.settingsGear,title:d(7760,null,c),strikethrough:i.excluded,extraClasses:l})}else mV(s,Q.mailto,Q.http,Q.https)?t.label.setResource({resource:s,name:s.toString(!0)},{icon:n??R.globe,title:i.options?.status?.description??i.title??s.toString(!0),strikethrough:i.excluded,extraClasses:l}):t.label.setFile(s,{fileKind:0,fileDecorations:void 0,range:"range"in o?o.range:void 0,title:i.options?.status?.description??i.title,strikethrough:i.excluded,extraClasses:l})}for(let s of[".monaco-icon-suffix-container",".monaco-icon-name-container"]){let l=t.label.element.querySelector(s);l&&(i.options?.status?.kind===3||i.options?.status?.kind===2?l.classList.add("warning"):l.classList.remove("warning"))}if(i.state!==void 0){if(t.actionBarContainer||i.showModifiedState){let s=i?.options?.diffMeta;if(s){if(!t.fileDiffsContainer||!t.addedSpan||!t.removedSpan)return;t.addedSpan.textContent=`+${s.added}`,t.removedSpan.textContent=`-${s.removed}`,t.fileDiffsContainer.setAttribute("aria-label",d(7758,null,s.added,s.removed))}t.label.element.querySelector(".monaco-icon-name-container")?.classList.add("modified")}t.toolbar&&(t.toolbar.context=r),t.contextKeyService&&i.state!==void 0&&jK.bindTo(t.contextKeyService).set(i.state)}}disposeTemplate(i){i.templateDisposables.dispose()}};hie=I([m(2,Le),m(3,tt),m(4,F),m(5,X)],hie);function Ken(a){let i=a.path.split("/").slice(1,3).join("/"),e=a.path.split("/").slice(5),t=e.at(-1),o=Gen(a);return{resource:a,name:t??e.join("/"),description:[i,...e.slice(0,-1)].join("/"),range:o}}function Gen(a){if(!a.fragment)return;let i=a.fragment.match(/\bL(\d+)(?:-L(\d+))?/);if(!i)return;let e=parseInt(i[1]);if(isNaN(e))return;let t=i[2]?parseInt(i[2]):e;if(!isNaN(t))return{startLineNumber:e,startColumn:1,endLineNumber:t,endColumn:1}}function vot(a){if(a.kind==="warning")return null;let{reference:i}=a;return typeof i=="string"||"variableName"in i?null:A.isUri(i)?i:i.uri}W(class uvo extends K{static{this.id="workbench.action.chat.addToChatAction"}constructor(){super({id:uvo.id,title:{...L(7756,"Add File to Chat")},f1:!1,menu:[{id:D.ChatAttachmentsContext,group:"chat",order:1,when:C.and(Wo.IsFileSystemResource,Gd.negate())}]})}async run(i,e){let t=i.get(Pt);if(!e)return;let o=t.lastFocusedWidget;o&&o.attachmentModel.addFile(e)}});W(class pvo extends K{static{this.id="workbench.action.chat.copyLink"}constructor(){super({id:pvo.id,title:{...L(7759,"Copy Link")},f1:!1,menu:[{id:D.ChatAttachmentsContext,group:"chat",order:0,when:C.or(Wo.Scheme.isEqualTo(Q.http),Wo.Scheme.isEqualTo(Q.https))}]})}async run(i,e){await i.get(Fi).writeResources([e])}});var pDi=class{getHeight(i){return 22}getTemplateId(i){return Kzt.TEMPLATE_ID}},Kzt=class a{constructor(){this.templateId=a.TEMPLATE_ID}static{this.TEMPLATE_ID="todoListRenderer"}renderTemplate(i){let e=new N,t=M(i,_("li.todo-item"));t.setAttribute("role","listitem");let o=M(t,_(".todo-status-icon.codicon"));o.setAttribute("aria-hidden","true");let n=M(t,_(".todo-content")),r=e.add(new Bc(n,{supportIcons:!1}));return{templateDisposables:e,todoElement:t,statusIcon:o,iconLabel:r}}renderElement(i,e,t){let{todoElement:o,statusIcon:n,iconLabel:r}=t;n.className=`todo-status-icon codicon ${this.getStatusIconClass(i.status)}`,n.style.color=this.getStatusIconColor(i.status),r.setLabel(i.title);let s=this.getStatusText(i.status),l=d(7828,null,i.title,s);o.setAttribute("aria-label",l)}disposeTemplate(i){i.templateDisposables.dispose()}getStatusText(i){switch(i){case"completed":return d(7829,null);case"in-progress":return d(7830,null);default:return d(7831,null)}}getStatusIconClass(i){switch(i){case"completed":return"codicon-pass";case"in-progress":return"codicon-record";default:return"codicon-circle-outline"}}getStatusIconColor(i){switch(i){case"completed":return"var(--vscode-charts-green)";case"in-progress":return"var(--vscode-charts-blue)";default:return"var(--vscode-foreground)"}}},TNe=class extends x{constructor(e,t,o,n){super();this.chatTodoListService=e;this.instantiationService=t;this.contextKeyService=o;this.telemetryService=n;this._isExpanded=!1;this._userManuallyExpanded=!1;this._inChatTodoListContextKey=ie.inChatTodoList.bindTo(o),this.domNode=this.createChatTodoWidget();let r=this._register(qn(this.domNode));this._register(r.onDidFocus(()=>this._inChatTodoListContextKey.set(!0))),this._register(r.onDidBlur(()=>this._inChatTodoListContextKey.set(!1))),this._register(this.contextKeyService.onDidChangeContext(s=>{s.affectsSome(new Set([ie.requestInProgress.key]))&&this.updateClearButtonState()}))}get height(){return this.domNode.style.display==="none"?0:this.domNode.offsetHeight}hideWidget(){this.domNode.style.display="none"}createChatTodoWidget(){let e=_(".chat-todo-list-widget");e.style.display="none";let t=_(".todo-list-expand");this.expandoButton=this._register(new Wi(t,{supportIcons:!0})),this.expandoButton.element.setAttribute("aria-expanded",String(this._isExpanded)),this.expandoButton.element.setAttribute("aria-controls","todo-list-container");let o=_(".todo-list-title-section");return this.expandIcon=_(".expand-icon.codicon"),this.expandIcon.classList.add(this._isExpanded?"codicon-chevron-down":"codicon-chevron-right"),this.expandIcon.setAttribute("aria-hidden","true"),this.titleElement=_(".todo-list-title"),this.titleElement.id="todo-list-title",this.titleElement.textContent=d(7832,null),this.clearButtonContainer=_(".todo-clear-button-container"),this.createClearButton(),o.appendChild(this.expandIcon),o.appendChild(this.titleElement),this.expandoButton.element.appendChild(o),this.expandoButton.element.appendChild(this.clearButtonContainer),this.todoListContainer=_(".todo-list-container"),this.todoListContainer.style.display=this._isExpanded?"block":"none",this.todoListContainer.id="todo-list-container",this.todoListContainer.setAttribute("role","list"),this.todoListContainer.setAttribute("aria-labelledby","todo-list-title"),e.appendChild(t),e.appendChild(this.todoListContainer),this._register(this.expandoButton.onDidClick(()=>{this.toggleExpanded()})),e}createClearButton(){this.clearButton=new Wi(this.clearButtonContainer,{supportIcons:!0,ariaLabel:d(7823,null)}),this.clearButton.element.tabIndex=0,this.clearButton.icon=R.clearAll,this._register(this.clearButton),this._register(this.clearButton.onDidClick(()=>{let e=this._currentSessionResource?this.chatTodoListService.getTodos(this._currentSessionResource).length:0;this.telemetryService.publicLog2("chatTodoListWidget",{action:"clear",todoCount:e}),this.clearAllTodos()}))}render(e){if(!e){this.hideWidget();return}Qe(this._currentSessionResource,e)||(this._userManuallyExpanded=!1,this._currentSessionResource=e,this.hideWidget()),this.updateTodoDisplay()}clear(e,t=!1){if(!e||this.domNode.style.display==="none")return;let o=this.chatTodoListService.getTodos(e);(t||o.length>0&&!o.some(r=>r.status!=="completed"))&&this.clearAllTodos()}hasTodos(){return this.domNode.classList.contains("has-todos")&&!!this._todoList&&this._todoList.length>0}hasFocus(){return Gr(this.todoListContainer)}focus(){return this.hasTodos()?(this._isExpanded||this.toggleExpanded(),this._todoList?.domFocus(),this.hasFocus()):!1}updateTodoDisplay(){if(!this._currentSessionResource)return;let e=this.chatTodoListService.getTodos(this._currentSessionResource);if(!(e.length>0)){this.domNode.classList.remove("has-todos");return}this.domNode.classList.add("has-todos"),this.renderTodoList(e),this.domNode.style.display="block"}renderTodoList(e){this.updateTitleElement(this.titleElement,e),e.every(c=>c.status==="not-started")&&(this._userManuallyExpanded=!1),this._todoList||(this._todoList=this._register(this.instantiationService.createInstance(Vl,"ChatTodoListRenderer",this.todoListContainer,new pDi,[new Kzt],{alwaysConsumeMouseWheel:!1,accessibilityProvider:{getAriaLabel:c=>{let u=this.getStatusText(c.status);return d(7828,null,c.title,u)},getWidgetAriaLabel:()=>d(7834,null)}})));let r=Math.min(e.length,6)*22;this._todoList.layout(r),this._todoList.getHTMLElement().style.height=`${r}px`,this._todoList.splice(0,this._todoList.length,e);let s=e.some(c=>c.status==="in-progress"),l=e.some(c=>c.status==="completed");this.updateClearButtonState(),(s||l)&&this._isExpanded&&!this._userManuallyExpanded&&(this._isExpanded=!1,this.expandoButton.element.setAttribute("aria-expanded","false"),this.todoListContainer.style.display="none",this.expandIcon.classList.remove("codicon-chevron-down"),this.expandIcon.classList.add("codicon-chevron-right"),this.updateTitleElement(this.titleElement,e))}toggleExpanded(){this._isExpanded=!this._isExpanded,this._userManuallyExpanded=!0,this.expandIcon.classList.toggle("codicon-chevron-down",this._isExpanded),this.expandIcon.classList.toggle("codicon-chevron-right",!this._isExpanded),this.todoListContainer.style.display=this._isExpanded?"block":"none";let e=this._currentSessionResource?this.chatTodoListService.getTodos(this._currentSessionResource).length:0;if(this.telemetryService.publicLog2("chatTodoListWidget",{action:this._isExpanded?"expand":"collapse",todoCount:e}),this._currentSessionResource){let t=this.chatTodoListService.getTodos(this._currentSessionResource);this.updateTitleElement(this.titleElement,t)}}clearAllTodos(){this._currentSessionResource&&(this.chatTodoListService.setTodos(this._currentSessionResource,[]),this.hideWidget())}updateClearButtonState(){if(!this._currentSessionResource)return;let t=this.chatTodoListService.getTodos(this._currentSessionResource).some(r=>r.status==="in-progress"),n=(ie.requestInProgress.getValue(this.contextKeyService)??!1)&&t;this.clearButton.enabled=!n,n?this.clearButton.setTitle(d(7824,null)):this.clearButton.setTitle(d(7823,null))}updateTitleElement(e,t){e.textContent="";let o=t.filter(h=>h.status==="completed").length,n=t.length,r=t.filter(h=>h.status==="in-progress"),s=r.length>0?r[0]:void 0,l=t.filter(h=>h.status==="not-started"),c=l.length>0?l[0]:void 0,u=r.length>0?o+1:Math.max(1,o),p=this._isExpanded?d(7825,null):d(7827,null);if(this.expandoButton.element.setAttribute("aria-label",p),this.expandoButton.element.setAttribute("aria-expanded",this._isExpanded?"true":"false"),this._isExpanded){let h=_("span");h.textContent=n>0?d(7833,null,u,n):d(7832,null),e.appendChild(h)}else{let h=s||c;if(h){let g=_(".codicon");h===s?(g.classList.add("codicon-record"),g.style.color="var(--vscode-charts-blue)"):(g.classList.add("codicon-circle-outline"),g.style.color="var(--vscode-foreground)"),g.style.marginRight="4px",g.style.verticalAlign="middle",e.appendChild(g);let f=_("span");f.textContent=d(7826,null,h.title,u,n),f.style.verticalAlign="middle",f.style.overflow="hidden",f.style.textOverflow="ellipsis",f.style.whiteSpace="nowrap",f.style.minWidth="0",e.appendChild(f)}else if(o>0&&o===n){let g=_("span");g.textContent=d(7833,null,n,n),g.style.verticalAlign="middle",e.appendChild(g)}}}getStatusText(e){switch(e){case"completed":return d(7829,null);case"in-progress":return d(7830,null);default:return d(7831,null)}}};TNe=I([m(0,h0),m(1,F),m(2,X),m(3,Te)],TNe);var mvo={devServer:R.globe,screenshot:R.file,plan:R.book};function bot(a){return"kind"in a&&a.kind==="group"}var RG=class extends x{constructor(e,t,o,n,r,s,l){super();this._chatArtifactsService=e;this._instantiationService=t;this._openerService=o;this._configurationService=n;this._fileService=r;this._fileDialogService=s;this._chatImageCarouselService=l;this._autorunDisposable=this._register(new me);this._isCollapsed=!1;this._treeStore=this._register(new N);this.domNode=_(".chat-artifacts-widget"),this.domNode.style.display="none"}static{this.ELEMENT_HEIGHT=22}static{this.MAX_ITEMS_SHOWN=6}render(e){this._currentArtifacts=this._chatArtifactsService.getArtifacts(e),Rt(this.domNode),this._treeStore.clear();let t=_(".chat-artifacts-expand"),o=this._treeStore.add(new Wi(t,{supportIcons:!0}));o.element.setAttribute("aria-expanded",String(!this._isCollapsed));let n=_(".chat-artifacts-title-section");this._expandIcon=_(".expand-icon.codicon"),this._expandIcon.classList.add(this._isCollapsed?"codicon-chevron-right":"codicon-chevron-down"),this._expandIcon.setAttribute("aria-hidden","true"),this._titleElement=_(".chat-artifacts-title"),n.appendChild(this._expandIcon),n.appendChild(this._titleElement),o.element.appendChild(n);let r=_(".artifacts-clear-button-container");this._clearButton=this._treeStore.add(new Wi(r,{supportIcons:!0,ariaLabel:d(7656,null)})),this._clearButton.element.tabIndex=0,this._clearButton.icon=R.clearAll,this._treeStore.add(this._clearButton.onDidClick(()=>{this._clearAllArtifacts()})),o.element.appendChild(r),this.domNode.appendChild(t);let s=_(".chat-artifacts-list");s.style.display=this._isCollapsed?"none":"block",this.domNode.appendChild(s),this._tree=this._treeStore.add(this._instantiationService.createInstance(Rg,"ChatArtifactsTree",s,new mDi,[new Gzt,new qzt(l=>this._saveArtifact(l))],{alwaysConsumeMouseWheel:!1,accessibilityProvider:new hDi})),this._treeStore.add(this._tree.onDidOpen(l=>{if(l.element)if(bot(l.element))l.element.onlyShowGroup&&this._openGroupInCarousel(l.element);else{let c=l.element;if(c.type==="screenshot"&&this._configurationService.getValue("imageCarousel.chat.enabled"))this._openScreenshotInCarousel(c);else if(c.uri){let u=A.parse(c.uri),p=zzt(u,this._configurationService);this._openerService.open(u,{fromUserGesture:!0,editorOptions:{override:p}})}}})),this._treeStore.add(o.onDidClick(()=>{this._isCollapsed=!this._isCollapsed,this._expandIcon.classList.toggle("codicon-chevron-down",!this._isCollapsed),this._expandIcon.classList.toggle("codicon-chevron-right",this._isCollapsed),o.element.setAttribute("aria-expanded",String(!this._isCollapsed)),s.style.display=this._isCollapsed?"none":"block"})),this._autorunDisposable.value=be(l=>{let c=this._currentArtifacts.artifacts.read(l),u=this._currentArtifacts.mutable.read(l);if(c.length===0){this.domNode.style.display="none";return}this.domNode.style.display="",this._clearButton.element.style.display=u?"":"none",this._titleElement.textContent=c.length===1?d(7659,null):d(7657,null,c.length);let p=qen(c),h=hvo(p),f=Math.min(h,RG.MAX_ITEMS_SHOWN)*RG.ELEMENT_HEIGHT;this._tree.layout(f),this._tree.getHTMLElement().style.height=`${f}px`,this._tree.setChildren(null,p)})}async _openGroupInCarousel(e){let t=e.artifacts[0];t?.uri&&await this._chatImageCarouselService.openCarouselAtResource(A.parse(t.uri))}async _openScreenshotInCarousel(e){e.uri&&await this._chatImageCarouselService.openCarouselAtResource(A.parse(e.uri))}_clearAllArtifacts(){this._currentArtifacts?.mutable.get()&&this._currentArtifacts.clear()}async _saveArtifact(e){let t=A.parse(e.uri),o=t.path.split("/").pop()??e.label,n=await this._fileDialogService.defaultFilePath(),r=A.joinPath(n,o),s=await this._fileDialogService.showSaveDialog({defaultUri:r,title:d(7661,null)});if(s){let l=await this._fileService.readFile(t);await this._fileService.writeFile(s,l.value)}}hide(){this._autorunDisposable.clear(),this.domNode.style.display="none"}};RG=I([m(0,LZ),m(1,F),m(2,Je),m(3,B),m(4,fe),m(5,rn),m(6,Qte)],RG);function qen(a){let i=new Map,e=[];for(let o of a)if(o.groupName){let n=i.get(o.groupName);n||(n={config:{groupName:o.groupName,onlyShowGroup:o.onlyShowGroup??!1},artifacts:[]},i.set(o.groupName,n)),n.artifacts.push(o)}else e.push(o);let t=[];for(let[,o]of i){let n={kind:"group",groupName:o.config.groupName,artifacts:o.artifacts,onlyShowGroup:o.config.onlyShowGroup};o.config.onlyShowGroup?t.push({element:n,collapsible:!1,collapsed:!1}):t.push({element:n,collapsible:!0,collapsed:!1,children:o.artifacts.map(r=>({element:r}))})}for(let o of e)t.push({element:o});return t}function hvo(a){let i=0;for(let e of a)i++,e.children&&!e.collapsed&&(i+=hvo([...e.children]));return i}var mDi=class{getHeight(){return RG.ELEMENT_HEIGHT}getTemplateId(i){return bot(i)?Gzt.TEMPLATE_ID:qzt.TEMPLATE_ID}},hDi=class{getAriaLabel(i){return bot(i)?d(7658,null,i.groupName,i.artifacts.length):i.label}getWidgetAriaLabel(){return d(7662,null)}},Gzt=class a{constructor(){this.templateId=a.TEMPLATE_ID}static{this.TEMPLATE_ID="chatArtifactGroupRenderer"}renderTemplate(i){let e=M(i,_(".chat-artifacts-list-row")),t=M(e,_(".chat-artifacts-list-icon")),o=M(e,_(".chat-artifacts-list-label"));return{container:e,iconElement:t,labelElement:o}}renderElement(i,e,t){let o=i.element;if(!bot(o))return;let n=o.artifacts[0]?.type,r=n&&mvo[n]||R.archive;t.iconElement.className="chat-artifacts-list-icon "+q.asClassName(r),t.labelElement.textContent=`${o.groupName} (${o.artifacts.length})`,t.container.title=o.groupName}disposeTemplate(){}},qzt=class a{constructor(i){this._onSave=i;this.templateId=a.TEMPLATE_ID}static{this.TEMPLATE_ID="chatArtifactLeafRenderer"}renderTemplate(i){let e=M(i,_(".chat-artifacts-list-row")),t=M(e,_(".chat-artifacts-list-icon")),o=M(e,_(".chat-artifacts-list-label")),n=M(e,_(".chat-artifacts-list-save"+q.asCSSSelector(R.save)));return n.title=d(7660,null),{container:e,iconElement:t,labelElement:o,saveButton:n}}renderElement(i,e,t){let o=i.element;if(bot(o))return;let n=o.type&&mvo[o.type]||R.archive;t.iconElement.className="chat-artifacts-list-icon "+q.asClassName(n),t.labelElement.textContent=o.label,t.container.title=o.uri,t.saveButton.onclick=r=>{r.stopPropagation(),this._onSave(o)}}disposeTemplate(){}};var $en=/^data:image\/[a-z]+;base64,/,jen=/^https?:\/\/.+/,_Ne=class extends yu{constructor(e,t,o,n,r,s,l,c){super(n);this.widgetRef=e;this.attachmentModel=t;this.styles=o;this.extensionService=r;this.webContentExtractorService=s;this.logService=l;this.chatAttachmentResolveService=c;this.overlays=new Map;this.overlayTextBackground="";this.disableOverlay=!1;this.currentActiveTarget=void 0;this.updateStyles(),this._register(Z(()=>{this.overlays.forEach(({overlay:u,disposable:p})=>{p.dispose(),u.remove()}),this.overlays.clear(),this.currentActiveTarget=void 0,this.overlayText?.remove(),this.overlayText=void 0}))}addOverlay(e,t){this.removeOverlay(e);let{overlay:o,disposable:n}=this.createOverlay(e,t);this.overlays.set(e,{overlay:o,disposable:n})}removeOverlay(e){this.currentActiveTarget===e&&(this.currentActiveTarget=void 0);let t=this.overlays.get(e);t&&(t.overlay.remove(),t.disposable.dispose(),this.overlays.delete(e))}setDisabledOverlay(e){this.disableOverlay=e}createOverlay(e,t){let o=document.createElement("div");o.classList.add("chat-dnd-overlay"),this.updateOverlayStyles(o),t.appendChild(o);let n=new Uh(e,{onDragOver:r=>{this.disableOverlay||(r.stopPropagation(),r.preventDefault(),e!==this.currentActiveTarget&&(this.currentActiveTarget&&this.setOverlay(this.currentActiveTarget,void 0),this.currentActiveTarget=e,this.onDragEnter(r,e)))},onDragLeave:r=>{this.disableOverlay||(e===this.currentActiveTarget&&(this.currentActiveTarget=void 0),this.onDragLeave(r,e))},onDrop:r=>{this.disableOverlay||(r.stopPropagation(),r.preventDefault(),e===this.currentActiveTarget&&(this.currentActiveTarget=void 0,this.onDrop(r,e)))}});return{overlay:o,disposable:n}}onDragEnter(e,t){let o=this.guessDropType(e);this.updateDropFeedback(e,t,o)}onDragLeave(e,t){this.updateDropFeedback(e,t,void 0)}onDrop(e,t){this.updateDropFeedback(e,t,void 0),this.drop(e)}async drop(e){let t=await this.resolveAttachmentsFromDragEvent(e);t.length!==0&&this.attachmentModel.addContext(...t)}updateDropFeedback(e,t,o){let n=o!==void 0;e.dataTransfer&&(e.dataTransfer.dropEffect=n?"copy":"none"),this.setOverlay(t,o)}guessDropType(e){if(Ip(e,hc.NOTEBOOK_CELL_OUTPUT))return 7;if(Ip(e,hc.SCM_HISTORY_ITEM))return 8;if(Qen(e))return this.extensionService.extensions.some(t=>Ua(t,"chatReferenceBinaryData"))?3:void 0;if(Ip(e,"text/html"))return 5;if(Ip(e,hc.SYMBOLS))return 4;if(Ip(e,hc.MARKERS))return 6;if(Ip(e,yl.FILES))return 1;if(Ip(e,hc.EDITORS))return 0;if(Ip(e,tr.uriList,hc.FILES,yl.RESOURCES,yl.INTERNAL_URI_LIST))return 2}isDragEventSupported(e){return this.guessDropType(e)!==void 0}getDropTypeName(e){switch(e){case 0:return d(7934,null);case 1:return d(7934,null);case 2:return d(7935,null);case 3:return d(7936,null);case 4:return d(7940,null);case 6:return d(7938,null);case 5:return d(7941,null);case 7:return d(7937,null);case 8:return d(7939,null)}}async resolveAttachmentsFromDragEvent(e){if(!this.isDragEventSupported(e))return[];if(Ip(e,hc.NOTEBOOK_CELL_OUTPUT)){let r=n3i(e);if(r)return this.chatAttachmentResolveService.resolveNotebookOutputAttachContext(r)}if(Ip(e,hc.SCM_HISTORY_ITEM)){let r=Fso(e);if(r)return this.chatAttachmentResolveService.resolveSourceControlHistoryItemAttachContext(r)}let t=i3i(e);if(t)return this.chatAttachmentResolveService.resolveMarkerAttachContext(t);if(Ip(e,hc.SYMBOLS)){let r=t3i(e);return this.chatAttachmentResolveService.resolveSymbolsAttachContext(r)}let o=iii(e);if(o.length>0)return di(await Promise.all(o.map(r=>this.chatAttachmentResolveService.resolveEditorAttachContext(r))));let n=e.dataTransfer?.getData(yl.INTERNAL_URI_LIST);if(n){let r=aw.parse(n);if(r.length)return di(await Promise.all(r.map(s=>this.chatAttachmentResolveService.resolveEditorAttachContext({resource:A.parse(s)}))))}return!Ip(e,yl.INTERNAL_URI_LIST)&&Ip(e,tr.uriList)&&(Ip(e,tr.html)||Ip(e,tr.text))?this.resolveHTMLAttachContext(e):[]}async downloadImageAsUint8Array(e){try{let n=await this.webContentExtractorService.readImage(A.parse(e),Se.None);if(n)return n.buffer}catch(n){this.logService.warn("Fetch failed:",n)}let t=this.widgetRef(),o=t?.inputEditor.getSelection();o&&t&&t.inputEditor.executeEdits("chatInsertUrl",[{range:o,text:e}]),this.logService.warn(`Image URLs must end in .jpg, .png, .gif, .webp, or .bmp. Failed to fetch image from this URL: ${e}`)}async resolveHTMLAttachContext(e){let t=new Set(this.attachmentModel.attachments.map(u=>u.name)),o=()=>{let u=d(7933,null),p=u,h=1;for(;t.has(p);)p=`${u} ${++h}`;return t.add(p),p},n=async u=>{let p=A.parse(u);if($en.test(u))return{data:thi(u),name:o(),resource:p};if(jen.test(u)){let h=await this.downloadImageAsUint8Array(u);if(h)return{data:h,name:o(),resource:p,id:u}}},r=async u=>{try{let p=await u.arrayBuffer();return{data:new Uint8Array(p),name:o()}}catch(p){this.logService.error("Error reading file:",p)}},s=[],l=Xen(e);if(l.length){let u=await Promise.all(l.map(p=>r(p)));s.push(...u.filter(p=>!!p))}let c=Yen(e);if(c.length){let u=await Promise.all(c.map(n));s.push(...u.filter(p=>!!p))}return await this.chatAttachmentResolveService.resolveImageAttachContext(s)}setOverlay(e,t){this.overlayText?.remove(),this.overlayText=void 0;let{overlay:o}=this.overlays.get(e);if(t!==void 0){let r=Un(`$(${R.attach.id}) ${this.getOverlayText(t)}`).map(s=>typeof s=="string"?_("span.overlay-text",void 0,s):s);this.overlayText=_("span.attach-context-overlay-text",void 0,...r),this.overlayText.style.backgroundColor=this.overlayTextBackground,o.appendChild(this.overlayText)}o.classList.toggle("visible",t!==void 0)}getOverlayText(e){let t=this.getDropTypeName(e);return d(7932,null,t)}updateOverlayStyles(e){e.style.backgroundColor=this.getColor(this.styles.overlayBackground)||"",e.style.color=this.getColor(this.styles.listForeground)||""}updateStyles(){this.overlays.forEach(e=>this.updateOverlayStyles(e.overlay)),this.overlayTextBackground=this.getColor(this.styles.listBackground)||""}};_Ne=I([m(3,Le),m(4,lt),m(5,DG),m(6,se),m(7,rW)],_Ne);function Qen(a){if(Ip(a,"image"))return!0;if(Ip(a,yl.FILES)){let i=a.dataTransfer?.files;if(i&&i.length>0)return Array.from(i).some(t=>t.type.startsWith("image/"));let e=a.dataTransfer?.items;if(e&&e.length>0)return Array.from(e).some(t=>t.type.startsWith("image/"))}return!1}function Yen(a,i){let e=a.dataTransfer?.getData("text/uri-list");if(e)try{let t=aw.parse(e);if(t.length>0)return t}catch(t){return i?.error("Error parsing URI list:",t),[]}return[]}function Xen(a){let i=a.dataTransfer?.files;return i?Array.from(i).filter(e=>e.type.startsWith("image/")):[]}var Jen=_,DNe=class extends x{constructor(e,t,o,n,r,s){super();this.location=o;this.options=n;this.clickHandler=r;this.chatAgentService=s;let l=M(e,Jen(".interactive-session-followups"));t.forEach(c=>this.renderFollowup(l,c))}renderFollowup(e,t){if(!this.chatAgentService.getDefaultAgent(this.location))return;let o=fLt(this.chatAgentService,this.location,"",t.agentId,t.subCommand);if(o===void 0)return;let n=t.kind==="reply"?t.title||t.message:t.title,r=t.kind==="reply"?t.message:t.title,s=(o+(t.tooltip||r)).trim(),l=this._register(new Wi(e,{...this.options,title:s}));t.kind==="reply"?l.element.classList.add("interactive-followup-reply"):t.kind==="command"&&l.element.classList.add("interactive-followup-command"),l.element.ariaLabel=d(7977,null,n),l.label=new Ie(n),this._register(l.onDidClick(()=>this.clickHandler(t)))}};DNe=I([m(5,cr)],DNe);var Sot=new class{constructor(){this.widgets=[]}register(a,i,e){this.widgets.push({id:a,ctor:i,when:e})}getWidgets(){return this.widgets}},LNe=class extends x{constructor(e,t,o){super();this.container=e;this.contextKeyService=t;this.instantiationService=o;this.renderedWidgets=new Map;this.update(),this._register(this.contextKeyService.onDidChangeContext(n=>{let r=new Set;for(let s of Sot.getWidgets())if(s.when)for(let l of s.when.keys())r.add(l);n.affectsSome(r)&&this.update()}))}update(){let e=new Set;for(let t of Sot.getWidgets())this.contextKeyService.contextMatchesRules(t.when)&&e.add(t.id);for(let[t,o]of this.renderedWidgets)e.has(t)||(o.widget.domNode.remove(),o.disposables.dispose(),this.renderedWidgets.delete(t));for(let t of Sot.getWidgets())if(e.has(t.id)&&!this.renderedWidgets.has(t.id)){let o=new N,n=this.instantiationService.createInstance(t.ctor);o.add(n),this.renderedWidgets.set(t.id,{descriptor:t,widget:n,disposables:o}),this.container.appendChild(n.domNode)}}get height(){let e=0;for(let t of this.renderedWidgets.values())e+=t.widget.height;return e}dispose(){for(let e of this.renderedWidgets.values())e.widget.domNode.remove(),e.disposables.dispose();this.renderedWidgets.clear(),super.dispose()}};LNe=I([m(1,X),m(2,F)],LNe);var gvo=/^[\w\/\.-]+$/;function $zt(a,i){switch(i){case"'":return`'${a}'`;case'"':return`"${a}"`}return gvo.test(a)?a:`'${a}'`}function fvo(a,i){let e=a.items.find(o=>o.type==="scalar"&&gvo.test(o.value)),t=e?i.getValueInRange(e.range).charAt(0):void 0;return t==="'"||t==='"'?t:""}var MG=class{constructor(i,e,t){this._codeEditorService=i;this._promptsService=e;this._languageModelToolsService=t}async openAndRewriteTools(i,e,t){let o=await this._codeEditorService.openCodeEditor({resource:i},this._codeEditorService.getFocusedCodeEditor());if(!o||!o.hasModel())return;let n=o.getModel(),r=this._promptsService.getParsedPromptFile(n);if(!r.header)return;let s=r.header.getAttribute(io.tools);if(s)if(o.setSelection(s.range),e===void 0){this.rewriteAttribute(n,"",s.range);return}else this.rewriteTools(n,e,s.value.range,s.value.type==="scalar")}rewriteTools(i,e,t,o){let r=this._languageModelToolsService.toFullReferenceNames(e).map(l=>$zt(l)).join(", "),s=o?r:`[${r}]`;this.rewriteAttribute(i,s,t)}rewriteAttribute(i,e,t){i.pushStackElement(),i.pushEditOperations(null,[Hn.replaceMove(t,e)],()=>null),i.pushStackElement()}async openAndRewriteName(i,e,t){let o=await this._codeEditorService.openCodeEditor({resource:i},this._codeEditorService.getFocusedCodeEditor());if(!o||!o.hasModel())return;let n=o.getModel(),r=this._promptsService.getParsedPromptFile(n);if(!r.header)return;let s=r.header.getAttribute(io.name);s&&(s.value.type==="scalar"&&s.value.value===e||(o.setSelection(s.range),this.rewriteAttribute(n,e,s.value.range)))}};MG=I([m(0,qt),m(1,Or),m(2,Vn)],MG);var Zhe;(n=>{function a(r){let s=new Map,l=new Map;for(let[c,u]of r.entries())Xm(c)?s.set(c.id,u):l.set(c.id,u);return{toolSets:s,tools:l}}n.fromMap=a;function i(r){return xi(r)&&r.version===void 0&&(r.disabledTools===void 0||Array.isArray(r.disabledTools))&&(r.disabledToolSets===void 0||Array.isArray(r.disabledToolSets))}function e(r){return xi(r)&&r.version===2&&Array.isArray(r.toolSetEntries)&&Array.isArray(r.toolEntries)}function t(r){try{let s=JSON.parse(r);if(e(s))return{toolSets:new Map(s.toolSetEntries),tools:new Map(s.toolEntries)};if(i(s)){let l=s.disabledToolSets?.map(u=>[u,!1]),c=s.disabledTools?.map(u=>[u,!1]);return{toolSets:new Map(l),tools:new Map(c)}}}catch{}return{toolSets:new Map,tools:new Map}}n.fromStorage=t;function o(r){let s={version:2,toolSetEntries:Array.from(r.toolSets.entries()),toolEntries:Array.from(r.tools.entries())};return JSON.stringify(s)}n.toStorage=o})(Zhe||={});var RNe=class extends x{constructor(e,t,o,n,r){super();this._mode=e;this.languageModel=t;this._toolsService=o;this._instantiationService=r;this._sessionStates=new G$;this.entriesMap=ke(e=>{let t=new Map,o=this.languageModel.read(e)?.metadata,n=this._mode.read(e),r=this._sessionStates.observable.read(e).get(n.id);if(!r&&n.kind==="agent"){let s=n.customTools?.read(e);s&&(r=Zhe.fromMap(this._toolsService.toToolAndToolSetEnablementMap(s,o)))}r||(r=this._globalState.read(e));for(let s of this._currentTools.read(e))s.canBeReferencedInPrompt&&t.set(s,r.tools.get(s.id)!==!1);for(let s of this._toolsService.getToolSetsForModel(o,e)){let l=r.toolSets.get(s.id)!==!1;t.set(s,l);for(let c of s.getTools(e))t.set(c,l||r.tools.get(c.id)===!0)}return t});this.userSelectedTools=ke(e=>{let t={},o=this.entriesMap.read(e);for(let[n,r]of o)Xm(n)||(t[n.id]=r);return t});let s=rN({key:"chat/selectedTools",defaultValue:{toolSets:new Map,tools:new Map},fromStorage:Zhe.fromStorage,toStorage:Zhe.toStorage});this._globalState=this._store.add(s(0,1,n)),this._currentTools=t.map(l=>o.observeTools(l?.metadata)).map((l,c)=>l.read(c))}get entriesScope(){let e=this._mode.get();return this._sessionStates.has(e.id)?1:e.kind==="agent"&&e.customTools?.get()&&e.uri?e.source?.storage!=="extension"?2:3:0}get currentMode(){return this._mode.get()}resetSessionEnablementState(){let e=this._mode.get();this._sessionStates.delete(e.id)}set(e,t){let o=this._mode.get();if(t||this._sessionStates.has(o.id)){this._sessionStates.set(o.id,Zhe.fromMap(e));return}if(o.kind==="agent"&&o.customTools?.get()&&o.uri)if(o.source?.storage!=="extension"){this.updateCustomModeTools(o.uri.get(),e);return}else{this._sessionStates.set(o.id,Zhe.fromMap(e));return}this._globalState.set(Zhe.fromMap(e),void 0)}async updateCustomModeTools(e,t){await this._instantiationService.createInstance(MG).openAndRewriteTools(e,t,Se.None)}};RNe=I([m(2,Vn),m(3,ce),m(4,F)],RNe);var mW=class extends aW{constructor(e,t,o,n,r,s,l){let c={...t,getAnchor:()=>this.getAnchorElement()};super(e,c,n,r,s,l);this.pickerOptions=o;this._register(be(u=>{let p=this.pickerOptions.hideChevrons.read(u);this.element&&(this.element.classList.toggle("hide-chevrons",p),this.renderLabel(this.element))}))}getAnchorElement(){return this.element&&Ki().document.contains(this.element)?this.element:this.pickerOptions.getOverflowAnchor?.()??this.element}render(e){super.render(e),e.classList.add("chat-input-picker-item");let t=this.pickerOptions.hideChevrons.get();this.element&&(this.element.classList.toggle("hide-chevrons",t),this.renderLabel(this.element))}};mW=I([m(3,td),m(4,_e),m(5,X),m(6,Te)],mW);var Zen={label:d(8078,null),order:1},etn={label:d(8079,null),order:2},X8=class extends mW{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,{actionProvider:{getActions:()=>{let b=this._getSelectedSessionType(),S=[...this._getAdditionalActions().map(y=>({...e,...y}))];for(let y of this._sessionTypeItems)this._isVisible(y.type)&&S.push({...e,id:y.commandId,label:y.label,checked:b===y.type,icon:this._getSessionIcon(y),enabled:this._isSessionTypeEnabled(y.type),category:this._getSessionCategory(y),description:this._getSessionDescription(y),tooltip:"",hover:{content:y.hoverDescription,position:this.pickerOptions.hoverPosition},run:async()=>{this._run(y)}});return S}},actionBarActionProvider:{getActions:()=>[this._getLearnMore()]},showItemKeybindings:!0,reporter:{id:"ChatSessionTypePicker",name:"ChatSessionTypePicker",includeOptions:!0}},n,r,s,l,h);this.chatSessionPosition=t;this.delegate=o;this.keybindingService=s;this.chatSessionsService=c;this.commandService=u;this.openerService=p;this._sessionTypeItems=[];this._register(this.chatSessionsService.onDidChangeAvailability(()=>{this._updateAgentSessionItems()})),this._updateAgentSessionItems()}_run(e){this.delegate.setActiveSessionProvider?this.delegate.setActiveSessionProvider(e.type):this.commandService.executeCommand(e.commandId,this.chatSessionPosition),this.element&&this.renderLabel(this.element)}_getSelectedSessionType(){return this.delegate.getActiveSessionProvider()}_getAdditionalActions(){return[]}_getLearnMore(){let e="https://code.visualstudio.com/docs/copilot/agents/overview";return{id:"workbench.action.chat.agentOverview.learnMore",label:d(8077,null),tooltip:e,class:void 0,enabled:!0,run:async()=>{await this.openerService.open(A.parse(e))}}}_updateAgentSessionItems(){let t=[{type:"local",label:IS("local"),hoverDescription:mhi("local"),commandId:"workbench.action.chat.openNewChatSessionInPlace.local"}],o=this.chatSessionsService.getAllChatSessionContributions();for(let n of o){let r=lg(n.type);r?t.push({type:r,label:IS(r),hoverDescription:mhi(r),commandId:n.canDelegate?`workbench.action.chat.openNewChatSessionInPlace.${n.type}`:`workbench.action.chat.openNewChatSessionExternal.${n.type}`}):t.push({type:n.type,label:n.displayName??n.name??n.type,hoverDescription:n.description??"",commandId:`workbench.action.chat.openNewChatSessionInPlace.${n.type}`})}this._sessionTypeItems=t}_isVisible(e){return!0}_isSessionTypeEnabled(e){return e==="local"?!0:!!this.chatSessionsService.getChatSessionContribution(e)}_getSessionCategory(e){let t=lg(e.type);return t&&eLt(t)?Zen:etn}_getSessionDescription(e){}_getSessionIcon(e){let t=lg(e.type);if(t)return lT(t);let o=this.chatSessionsService.getChatSessionContribution(e.type);return o&&q.isThemeIcon(o.icon)?o.icon:R.extensions}render(e){super.render(e),e.classList.add("chat-session-target-picker-item")}renderLabel(e){this.setAriaLabelAttributes(e);let t=this._getSelectedSessionType()??"local",o=lg(t),n=o?IS(o):this.chatSessionsService.getChatSessionContribution(t)?.displayName??t,r=this._getSessionIcon({type:t,label:n,hoverDescription:"",commandId:""}),s=[];return s.push(...Un(`$(${r.id})`)),s.push(_("span.chat-input-picker-label",void 0,n)),s.push(...Un("$(chevron-down)")),vi(e,...s),null}};X8=I([m(4,td),m(5,_e),m(6,X),m(7,Us),m(8,ge),m(9,Je),m(10,Te)],X8);var ege=class extends X8{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super(e,t,o,n,r,s,l,c,u,p,h);this.gitService=g;this._isSessionsWindow=wb.getValue(l)===!0}_run(e){this.delegate.setPendingDelegationTarget&&this.delegate.setPendingDelegationTarget(e.type),this.element&&this.renderLabel(this.element)}_getSelectedSessionType(){let e=this.delegate.getPendingDelegationTarget?this.delegate.getPendingDelegationTarget():void 0;return e||this.delegate.getActiveSessionProvider()}_isSessionTypeEnabled(e){let o=this.chatSessionsService.getAllChatSessionContributions().find(r=>lg(r.type)===e),n=this.delegate.getActiveSessionProvider();return!this._isSessionsWindow&&n!=="local"||this._isSessionsWindow&&n!=="copilotcli"||this._isSessionsWindow&&e==="copilot-cloud-agent"&&!this._hasGitRepository()||o&&!o.canDelegate&&n!==e?!1:this._getSelectedSessionType()!==e}_hasGitRepository(){return!vt.isEmpty(this.gitService.repositories)}_isVisible(e){return this._isSessionsWindow&&e==="local"?!1:this.delegate.getActiveSessionProvider()===e?!0:tLt(e)}_getSessionCategory(e){return eLt(e.type)?{label:d(8024,null),order:1,showHeader:!0}:{label:d(8025,null),order:2,showHeader:!1}}_getSessionDescription(e){if(this._isSessionsWindow&&e.type==="copilot-cloud-agent"&&!this._hasGitRepository())return d(8020,null)}_getLearnMore(){let e="https://aka.ms/vscode-continue-chat-in";return{id:"workbench.action.chat.agentOverview.learnMoreHandOff",label:d(8021,null),tooltip:e,class:void 0,enabled:!0,run:async()=>{await this.openerService.open(A.parse(e))}}}_getAdditionalActions(){return this._isSessionsWindow?[]:[{id:"newChatSession",class:void 0,label:d(8022,null),tooltip:"",hover:{content:"",position:this.pickerOptions.hoverPosition},checked:!1,icon:R.plus,enabled:!0,category:{label:d(8023,null),order:0,showHeader:!1},description:this.keybindingService.lookupKeybinding(Zm)?.getLabel()||void 0,run:async()=>{this.commandService.executeCommand(Zm,this.chatSessionPosition)}}]}};ege=I([m(4,td),m(5,_e),m(6,X),m(7,Us),m(8,ge),m(9,Je),m(10,Te),m(11,jDe)],ege);function Iot(a,i,e){let t=e.defaultChatAgent?.chatExtensionId;if(!t)return!1;let o=Ii.equals(i,t),n=a.path.includes("/github/");return o&&n}function vvo(a,i,e){if(a.storage!=="extension")return!1;let t=e.defaultChatAgent?.chatExtensionId;return!t||!Ii.equals(a.extensionId,t)?!1:!Iot(i,a.extensionId,e)}var bvo=a=>{switch(a.name.get().toLowerCase()){case"ask":return R.ask;case"edit":return R.edit;case"plan":return R.tasklist;default:return}},MNe=class extends mW{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){let S=Me("modePickerAssignments",{showOldAskMode:!1}),y=t.customAgentTarget?.()??"undefined",w={label:d(8047,null),order:0},k={label:d(8048,null),order:1},T={label:d(8050,null),order:999,showHeader:!0},P=l.inspect("chat.agent.enabled").policyValue===!1,O=(J,ae)=>{let he=J.kind==="agent"&&P,oe=r.getDefaultAgent("panel",J.kind)?.description??e.tooltip,de=[];if(J.kind==="agent"&&!he&&J.uri){let Ce,xe,ze;J.source?.storage==="extension"?(xe=R.file,ze=`viewAgent:${J.id}`,Ce=d(8051,null,J.label.get())):(xe=R.edit,ze=`editAgent:${J.id}`,Ce=d(8049,null,J.label.get()));let De=J.uri;de.push({id:ze,label:Ce,tooltip:Ce,class:q.asClassName(xe),enabled:!0,run:async()=>{v.open(De.get())}})}return{...e,id:USi(J),label:J.label.get(),icon:he?q.fromId(R.lock.id):J.icon.get(),class:he?"disabled-by-policy":void 0,enabled:!he,checked:!he&&ae.id===J.id,tooltip:"",hover:{content:oe,position:this.pickerOptions.hoverPosition},toolbarActions:de,run:async()=>{if(he)return;let Ce=await h.executeCommand(w_i,{modeId:J.id,sessionResource:this.delegate.sessionResource()});return this.element&&this.renderLabel(this.element),Ce},category:he?T:w}},V=(J,ae)=>({...O(J,ae),tooltip:"",hover:{content:J.description.get()??r.getDefaultAgent("panel",J.kind)?.description??e.tooltip,position:this.pickerOptions.hoverPosition},icon:J.icon.get()??(yot(J,this._productService)?bvo(J):void 0),category:P?T:k}),H={getActions:()=>{let J=u.getModes(),ae=t.currentMode.get(),he=J.custom.filter(De=>{let Oe=De.target.get();return Oe===y||Oe==="undefined"}),oe=MI(he,De=>yot(De,this._productService)?"builtin":"custom"),de=ae.id===Tl.Agent.id,Ce={...O(Tl.Agent,Tl.Agent),checked:de};Ce.category=w;let xe=oe.builtin?.map(De=>{let Oe=V(De,ae);return Oe.category=w,Oe})??[],ze=oe.custom?.map(De=>V(De,ae))??[];return[Ce,...xe,...ze]}},G={getActions:()=>{let J=u.getModes(),ae=t.currentMode.get(),he=J.builtin.find(Oe=>Oe.id===Tl.Agent.id),oe=J.builtin.filter(Oe=>Oe.id!==Tl.Agent.id&&Svo(Oe,S.get(),P)),de=J.custom.filter(Oe=>yot(Oe,this._productService)?Svo(Oe,S.get(),P):!0),Ce=MI(de,Oe=>yot(Oe,this._productService)?"builtin":"custom"),xe=Ce.builtin?.map(Oe=>{let pt=V(Oe,ae);return pt.category=P?T:w,pt})??[];xe.sort((Oe,pt)=>Oe.label.localeCompare(pt.label));let ze=Ce.custom?.map(Oe=>V(Oe,ae))??[];return ze.sort((Oe,pt)=>Oe.label.localeCompare(pt.label)),di([he&&O(he,ae),...oe.map(Oe=>Oe&&O(Oe,ae)),...xe,...ze])}},$={actionProvider:y!=="undefined"?H:G,actionBarActionProvider:{getActions:()=>this.getModePickerActionBarActions()},showItemKeybindings:!0,reporter:{id:"ChatModePicker",name:"ChatModePicker",includeOptions:!0}};super(e,$,o,n,s,c,f);this.delegate=t;this.contextKeyService=c;this.menuService=p;this._productService=g;this._register(be(J=>{this.delegate.currentMode.read(J).label.read(J),this.element&&this.renderLabel(this.element)})),b.getTreatment("chat.showOldAskMode").then(J=>{S.set({showOldAskMode:J==="enabled"},void 0)}),this._register(b.onDidRefetchAssignments(async()=>{S.set({showOldAskMode:await b.getTreatment("chat.showOldAskMode")==="enabled"},void 0)}))}getModePickerActionBarActions(){let e=this.menuService.createMenu(D.ChatModePicker,this.contextKeyService),t=jm(e.getActions({renderShortTitle:!0}));return e.dispose(),t}render(e){super.render(e),e.classList.add("chat-mode-picker-item")}renderLabel(e){this.setAriaLabelAttributes(e);let t=this.delegate.currentMode.get(),o=t.label.get(),n=t.icon.get();!n&&yot(t,this._productService)&&(n=bvo(t));let r=[],s=this.pickerOptions.hideChevrons.get();return n&&r.push(...Un(`$(${n.id})`)),(!s||!n)&&r.push(_("span.chat-input-picker-label",void 0,o)),s||r.push(...Un("$(chevron-down)")),vi(e,...r),null}};MNe=I([m(3,td),m(4,cr),m(5,_e),m(6,B),m(7,X),m(8,Fg),m(9,Kt),m(10,ge),m(11,tt),m(12,Te),m(13,Je),m(14,yD)],MNe);function yot(a,i){if(a.isBuiltin)return!0;if(a.source?.storage!=="extension")return!1;let e=i.defaultChatAgent?.chatExtensionId;if(!e||a.source.extensionId.value!==e)return!1;let t=a.uri?.get();return t?!Iot(t,a.source.extensionId,i):!0}function Svo(a,i,e){return a.id===Tl.Edit.id||a.name.get().toLowerCase()==="edit"?a.id===Tl.Edit.id?e:!e:a.id===Tl.Ask.id||a.name.get().toLowerCase()==="ask"?a.id===Tl.Ask.id?i.showOldAskMode||e:!(i.showOldAskMode||e):!0}var jzt=new Set;function Ivo(a){return!!(jzt.has(a)||a==="autoApprove"&&jzt.has("autopilot"))}var PNe=class extends mW{constructor(e,t,o,n,r,s,l,c,u,p){let h=()=>c.inspect("chat.tools.global.autoApprove").policyValue===!1,g=()=>c.getValue("chat.autopilot.enabled")!==!1;super(e,{actionProvider:{getActions:()=>{let v=t.currentPermissionLevel.get(),b=h(),S=[{...e,id:"chat.permissions.default",label:d(8072,null),description:d(8075,null),icon:q.fromId(R.shield.id),checked:v==="default",tooltip:"",hover:{content:d(8073,null),position:o.hoverPosition},run:async()=>{t.setPermissionLevel("default"),this.element&&this.renderLabel(this.element)}},{...e,id:"chat.permissions.autoApprove",label:d(8052,null),description:d(8057,null),icon:q.fromId(R.warning.id),checked:v==="autoApprove",enabled:!b,tooltip:b?d(8056,null):"",hover:{content:b?d(8055,null):d(8053,null),position:o.hoverPosition},run:async()=>{if(!Ivo("autoApprove")){if((await this.dialogService.prompt({type:bt.Warning,message:d(8061,null),buttons:[{label:d(8059,null),run:()=>!0},{label:d(8058,null),run:()=>!1}],custom:{icon:R.warning,markdownDetails:[{markdown:new Ie(d(8060,null))}]}})).result!==!0)return;jzt.add("autoApprove")}t.setPermissionLevel("autoApprove"),this.element&&this.renderLabel(this.element)}}];return g()&&S.push({...e,id:"chat.permissions.autopilot",label:d(8062,null),description:d(8067,null),icon:q.fromId(R.rocket.id),checked:v==="autopilot",enabled:!b,tooltip:b?d(8066,null):"",hover:{content:b?d(8065,null):d(8063,null),position:o.hoverPosition},run:async()=>{if(!Ivo("autopilot")){if((await this.dialogService.prompt({type:bt.Warning,message:d(8071,null),buttons:[{label:d(8069,null),run:()=>!0},{label:d(8068,null),run:()=>!1}],custom:{icon:R.rocket,markdownDetails:[{markdown:new Ie(d(8070,null))}]}})).result!==!0)return;jzt.add("autopilot")}t.setPermissionLevel("autopilot"),this.element&&this.renderLabel(this.element)}}),S}},actionBarActions:[{id:"chat.permissions.learnMore",label:d(8076,null),tooltip:d(8076,null),class:void 0,enabled:!0,run:async()=>{await p.open(A.parse("https://code.visualstudio.com/docs/copilot/agents/agent-tools#_permission-levels"))}}],reporter:{id:"ChatPermissionPicker",name:"ChatPermissionPicker",includeOptions:!0},listOptions:{descriptionBelow:!0,minWidth:255}},o,n,r,s,l);this.delegate=t;this.dialogService=u}renderLabel(e){this.setAriaLabelAttributes(e);let t=this.delegate.currentPermissionLevel.get(),o,n;switch(t){case"autopilot":o=R.rocket,n=d(8064,null);break;case"autoApprove":o=R.warning,n=d(8054,null);break;default:o=R.shield,n=d(8074,null);break}let r=[];return r.push(...Un(`$(${o.id})`)),r.push(_("span.chat-input-picker-label",void 0,n)),r.push(...Un("$(chevron-down)")),vi(e,...r),e.classList.toggle("warning",t==="autopilot"),e.classList.toggle("info",t==="autoApprove"),null}refresh(){this.element&&this.renderLabel(this.element)}};PNe=I([m(3,td),m(4,_e),m(5,X),m(6,Te),m(7,B),m(8,at),m(9,Je)],PNe);var tge=class extends mW{constructor(e,t,o,n,r,s,l,c){super(e,{actionProvider:{getActions:()=>{let g=this.delegate.getSelectedWorkspace(),v=this.delegate.getWorkspaces().map(b=>({...e,id:`workspace.${b.uri.toString()}`,label:b.label,checked:g?.uri.toString()===b.uri.toString(),icon:b.isFolder?{id:"folder"}:{id:"file-symlink-directory"},enabled:!0,tooltip:b.uri.fsPath,run:async()=>{this.delegate.setSelectedWorkspace(b),this.element&&this.renderLabel(this.element)}}));return v.push({...e,id:"workspace.openFolder",label:d(8080,null),checked:!1,enabled:!0,tooltip:d(8081,null),run:async()=>{this.commandService.executeCommand(this.delegate.openFolderCommand)}}),v}},actionBarActionProvider:{getActions:()=>[]},showItemKeybindings:!1,reporter:{id:"ChatWorkspacePicker",name:"ChatWorkspacePicker",includeOptions:!1}},o,n,r,s,c);this.delegate=t;this.commandService=l;this._register(this.delegate.onDidChangeSelectedWorkspace(()=>{this.element&&this.renderLabel(this.element)})),this._register(this.delegate.onDidChangeWorkspaces(()=>{this.element&&this.renderLabel(this.element)}))}renderLabel(e){this.setAriaLabelAttributes(e);let t=this.delegate.getSelectedWorkspace(),o=[];if(t){let n=t.label||He(t.uri);o.push(...Un("$(folder)")),o.push(_("span.chat-input-picker-label",void 0,n))}else o.push(...Un("$(folder)")),o.push(_("span.chat-input-picker-label",void 0,d(8082,null)));return this.pickerOptions.hideChevrons.get()||o.push(...Un("$(chevron-down)")),vi(e,...o),null}};tge=I([m(3,td),m(4,_e),m(5,X),m(6,ge),m(7,Te)],tge);var CI=_,ANe=class extends x{constructor(e,t,o){super();this.instantiationService=e;this.menuService=t;this.contextKeyService=o;this.domNode=CI(".chat-context-usage-details"),this.quotaItem=this.domNode.appendChild(CI(".quota-indicator"));let n=this.domNode.insertBefore(CI("div.header"),this.quotaItem);n.textContent=d(8094,null);let r=this.quotaItem.appendChild(CI(".quota-label"));this.tokenCountLabel=r.appendChild(CI("span")),this.percentageLabel=r.appendChild(CI("span.quota-value"));let s=this.quotaItem.appendChild(CI(".quota-bar"));this.progressFill=s.appendChild(CI(".quota-bit")),this.outputBufferFill=s.appendChild(CI(".quota-bit.output-buffer")),this.outputBufferLegend=this.quotaItem.appendChild(CI(".output-buffer-legend")),this.outputBufferLegend.appendChild(CI(".output-buffer-swatch"));let l=this.outputBufferLegend.appendChild(CI("span"));l.textContent=d(8096,null),this.outputBufferLegend.style.display="none",this.tokenDetailsContainer=this.domNode.appendChild(CI(".token-details-container")),this.warningMessage=this.domNode.appendChild(CI("div.description")),this.warningMessage.textContent=d(8097,null),this.warningMessage.style.display="none",this.actionsSection=this.domNode.appendChild(CI(".actions-section"));let c=this.actionsSection.appendChild(CI(".button-bar-container"));this._register(this.instantiationService.createInstance(LG,c,D.ChatContextUsageActions,{toolbarOptions:{primaryGroup:()=>!0},buttonConfigProvider:()=>({isSecondary:!0})}));let u=this._register(this.menuService.createMenu(D.ChatContextUsageActions,this.contextKeyService)),p=()=>{let h=u.getActions(),g=h.length>0&&h.some(([,f])=>f.length>0);this.actionsSection.style.display=g?"":"none"};this._register(u.onDidChange(p)),p()}update(e){let{percentage:t,usedTokens:o,totalContextWindow:n,outputBufferPercentage:r,promptTokenDetails:s}=e;this.tokenCountLabel.textContent=d(8099,null,this.formatTokenCount(o,1),this.formatTokenCount(n,0)),this.percentageLabel.textContent=d(8098,null,Math.min(100,t).toFixed(0));let l=Math.max(0,Math.min(100,t));this.progressFill.style.width=`${l}%`,r!==void 0&&r>0?(this.outputBufferFill.style.width=`${Math.max(0,Math.min(100-l,r))}%`,this.outputBufferFill.style.display="",this.outputBufferLegend.style.display=""):(this.outputBufferFill.style.width="0",this.outputBufferFill.style.display="none",this.outputBufferLegend.style.display="none"),this.quotaItem.classList.remove("warning","error"),t>=90?this.quotaItem.classList.add("error"):t>=75&&this.quotaItem.classList.add("warning"),this.renderTokenDetails(s,t),this.warningMessage.style.display=t>=75?"":"none"}formatTokenCount(e,t){let o=1e6-500*Math.pow(10,-t);return e>=o?`${(e/1e6).toFixed(t)}M`:e>=1e3?`${(e/1e3).toFixed(t)}K`:e.toString()}renderTokenDetails(e,t){if(Rt(this.tokenDetailsContainer),!e||e.length===0){this.tokenDetailsContainer.style.display="none";return}this.tokenDetailsContainer.style.display="";let o=new Map,n=0;for(let r of e){let s=o.get(r.category)||[];s.push({label:r.label,percentageOfPrompt:r.percentageOfPrompt}),o.set(r.category,s),n+=r.percentageOfPrompt}if(n<100){let r=100-n;o.set(d(8100,null),[{label:d(8095,null),percentageOfPrompt:r}])}for(let[r,s]of o){let l=s.filter(p=>p.percentageOfPrompt/100*t>=.05);if(l.length===0)continue;let c=this.tokenDetailsContainer.appendChild(CI(".token-category")),u=c.appendChild(CI(".token-category-header"));u.textContent=r;for(let p of l){let h=c.appendChild(CI(".token-detail-item")),g=h.appendChild(CI(".token-detail-label"));g.textContent=p.label;let f=p.percentageOfPrompt/100*t,v=h.appendChild(CI(".token-detail-value"));v.textContent=`${f.toFixed(1)}%`}}}focus(){this.domNode.focus()}};ANe=I([m(0,F),m(1,Kt),m(2,X)],ANe);var gDi=_,fDi=class a{static{this.CENTER_X=18}static{this.CENTER_Y=18}static{this.RADIUS=14}constructor(){let i=a.RADIUS;this.circumference=2*Math.PI*i,this.domNode=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.domNode.setAttribute("viewBox","0 0 36 36"),this.domNode.classList.add("circular-progress");let e=document.createElementNS("http://www.w3.org/2000/svg","circle");e.setAttribute("cx",String(a.CENTER_X)),e.setAttribute("cy",String(a.CENTER_Y)),e.setAttribute("r",String(i)),e.classList.add("progress-bg"),this.domNode.appendChild(e),this.progressCircle=document.createElementNS("http://www.w3.org/2000/svg","circle"),this.progressCircle.setAttribute("cx",String(a.CENTER_X)),this.progressCircle.setAttribute("cy",String(a.CENTER_Y)),this.progressCircle.setAttribute("r",String(i)),this.progressCircle.classList.add("progress-arc"),this.progressCircle.setAttribute("stroke-dasharray",String(this.circumference)),this.progressCircle.setAttribute("stroke-dashoffset",String(this.circumference)),this.domNode.appendChild(this.progressCircle)}setProgress(i){let e=Math.max(0,Math.min(100,i)),t=this.circumference-e/100*this.circumference;this.progressCircle.setAttribute("stroke-dashoffset",String(t))}},PG=class extends x{constructor(e,t,o,n,r,s){super();this.hoverService=e;this.instantiationService=t;this.languageModelsService=o;this.contextKeyService=n;this.storageService=r;this.configurationService=s;this._onDidChangeVisibility=this._register(new E);this.onDidChangeVisibility=this._onDidChangeVisibility.event;this._isVisible=Me(this,!1);this._lastRequestDisposable=this._register(new me);this._hoverDisposable=this._register(new me);this._contextUsageDetails=this._register(new me);this._hoverOptions={id:PG._HOVER_ID,appearance:{showPointer:!0,compact:!0},persistence:{hideOnHover:!1},trapFocus:!0};this.domNode=gDi(".chat-context-usage-widget"),this.domNode.style.display="none",this.domNode.setAttribute("tabindex","0"),this.domNode.setAttribute("role","button"),this.domNode.setAttribute("aria-label",d(8101,null));let l=this.domNode.appendChild(gDi(".icon-container"));this.progressIndicator=new fDi,l.appendChild(this.progressIndicator.domNode),this.percentageLabel=this.domNode.appendChild(gDi(".percentage-label")),this._contextUsageOpenedKey=ie.contextUsageHasBeenOpened.bindTo(this.contextKeyService),this.storageService.getBoolean(PG._OPENED_STORAGE_KEY,1,!1)&&this._contextUsageOpenedKey.set(!0),this._enabled=this.configurationService.getValue("chat.contextUsage.enabled")!==!1,this._register(this.configurationService.onDidChangeConfiguration(c=>{c.affectsConfiguration("chat.contextUsage.enabled")&&(this._enabled=this.configurationService.getValue("chat.contextUsage.enabled")!==!1,this._enabled?this.currentData&&this.show():this.hide())})),this.setupHover()}get isVisible(){return this._isVisible}static{this._OPENED_STORAGE_KEY="chat.contextUsage.hasBeenOpened"}static{this._HOVER_ID="chat.contextUsage"}showDetails(){let e=this._createDetails();return e?(this.hoverService.showInstantHover({...this._hoverOptions,content:e.domNode,target:this.domNode,persistence:{hideOnHover:!1,sticky:!0}},!0),this._markOpened(),!0):!1}_createDetails(){if(!(!this._isVisible.get()||!this.currentData))return this._contextUsageDetails.value||(this._contextUsageDetails.value=this.instantiationService.createInstance(ANe)),this._contextUsageDetails.value.update(this.currentData),this._contextUsageDetails.value}_markOpened(){this._contextUsageOpenedKey.set(!0),this.storageService.store(PG._OPENED_STORAGE_KEY,!0,1,1)}setupHover(){this._hoverDisposable.clear();let e=new N;this._hoverDisposable.value=e,e.add(this.hoverService.setupDelayedHover(this.domNode,()=>({...this._hoverOptions,content:this._createDetails()?.domNode??""}))),e.add(j(this.domNode,re.CLICK,t=>{t.stopPropagation(),this.showDetails()})),e.add(j(this.domNode,re.KEY_DOWN,t=>{let o=new gi(t);(o.equals(10)||o.equals(3))&&(t.preventDefault(),this.showDetails())}))}update(e){if(this._lastRequestDisposable.clear(),!e){this.currentData=void 0,this.hide();return}if(!e.response||!e.modelId){this.currentData||this.hide();return}let t=e.response,o=e.modelId;this.updateFromResponse(t,o),this._lastRequestDisposable.value=t.onDidChange(()=>{this.updateFromResponse(t,o)})}updateFromResponse(e,t){let o=e.usage,n=this.languageModelsService.lookupLanguageModel(t),r=n?.maxInputTokens,s=n?.maxOutputTokens;if(!o||!r||r<=0||!s||s<=0){this.currentData||this.hide();return}let l=o.promptTokens,c=o.completionTokens,u=o.promptTokenDetails,p=o.outputBuffer,h=r+s,g=l+c,f=g/h*100,v=p!==void 0?Math.max(0,p-c)/h*100:void 0;this.render(f,c,g,h,v,u),this.show()}render(e,t,o,n,r,s){this.currentData={usedTokens:o,completionTokens:t,totalContextWindow:n,percentage:e,outputBufferPercentage:r,promptTokenDetails:s},this.progressIndicator.setProgress(e);let l=Math.min(100,Math.round(e));this.percentageLabel.textContent=`${l}%`,this.domNode.setAttribute("aria-label",d(8102,null,l)),this.domNode.classList.remove("warning","error"),e>=90?this.domNode.classList.add("error"):e>=75&&this.domNode.classList.add("warning")}show(){this._enabled&&this.domNode.style.display==="none"&&(this.domNode.style.display="",this._isVisible.set(!0,void 0),this._onDidChangeVisibility.fire())}hide(){this.domNode.style.display!=="none"&&(this.domNode.style.display="none",this._isVisible.set(!1,void 0),this._onDidChangeVisibility.fire())}};PG=I([m(0,nt),m(1,F),m(2,ds),m(3,X),m(4,ce),m(5,B)],PG);function NNe(a,i){let e=bto(a);return e?VLt(e,i):!1}function ttn(a){let i=new Ie("",{isTrusted:!0,supportThemeIcons:!0});switch(a){case"available for download":i.appendMarkdown(d(7998,null));break;case"downloaded":case"ready":i.appendMarkdown(d(8000,null));break;default:i.appendMarkdown(d(7997,null));break}return i}var ige={Other:"other"};function ONe(a,i,e,t){return{item:a,kind:"action",label:a.label,description:a.description,group:{title:"",icon:a.icon??q.fromId(a.checked?R.check.id:R.blank.id)},hideIcon:!1,section:a.section,hover:i?{content:stn(i,t),position:e}:void 0,submenuActions:a.toolbarActions}}function wvo(a,i){let e=a.metadata.configurationSchema;if(!e?.properties)return;let t=i.getModelConfiguration(a.identifier)??{},o=[];for(let[n,r]of Object.entries(e.properties)){if(r.group!=="navigation")continue;let s=t[n]??r.default;if(s===void 0)continue;let l=r.enumItemLabels,c=r.enum?.indexOf(s)??-1,u=l?.[c]??String(s);o.push(u)}return o.length>0?o.join(", "):void 0}function wot(a,i,e,t,o){let n=t.getModelConfigurationActions(a.identifier),r=wvo(a,t),s=a.metadata.multiplier??a.metadata.detail,l=r&&s?`${r} \xB7 ${s}`:r??s;return{id:a.identifier,enabled:!0,icon:a.metadata.statusIcon,checked:a.identifier===i,class:void 0,description:l,tooltip:a.metadata.name,label:a.metadata.name,section:o,toolbarActions:n&&n.length>0?n:void 0,run:()=>e(a)}}function itn(a){return a.entitlement===5||a.entitlement===10||a.entitlement===6||a.entitlement===7||a.entitlement===8||a.entitlement===9||a.isInternal}function otn(a){return{id:"manageModels",enabled:!0,checked:!1,class:q.asClassName(R.gear),tooltip:d(7991,null),label:d(7990,null),run:()=>{a.executeCommand(A6e)}}}function ntn(a,i,e,t,o,n,r,s,l,c,u,p,h,g,f){let v=[];if(a.length===0&&v.push(ONe({id:"auto",enabled:!0,checked:!0,class:void 0,tooltip:d(7996,null),label:d(7996,null),run:()=>{}})),l){let b=[];if(a.length){let S=new Map,y=new Map;for(let G of a)S.set(G.identifier,G),y.set(G.metadata.id,G);let w=new Set,k=(G,$)=>{w.add(G),$&&w.add($)},T=G=>S.get(G)??y.get(G),P=G=>u.entitlement===8||u.entitlement===9?G.minVSCodeVersion&&!NNe(o,G.minVSCodeVersion)?"update":"admin":"upgrade",O=a.find(G=>G.metadata.id==="auto"&&G.metadata.vendor==="copilot");O&&(k(O.identifier,O.metadata.id),v.push(ONe(wot(O,i,r,f),O,g,f)));let V=[],H=G=>{if(w.has(G))return!1;let $=T(G);if($&&!w.has($.identifier)){k($.identifier,$.metadata.id);let J=t[$.metadata.id];return J?.minVSCodeVersion&&!NNe(o,J.minVSCodeVersion)?V.push({kind:"unavailable",id:$.metadata.id,entry:J,reason:"update"}):V.push({kind:"available",model:$}),!0}if(!$){let J=t[G];if(J&&!J.exists)return k(G),V.push({kind:"unavailable",id:G,entry:J,reason:P(J)}),!0}return!1};i&&i!==O?.identifier&&H(i);for(let G of e)H(G);if(h)for(let[G,$]of Object.entries(t)){if(!$.featured||w.has(G))continue;let J=T(G);J&&!w.has(J.identifier)?$.minVSCodeVersion&&!NNe(o,$.minVSCodeVersion)?p&&(k(J.identifier,J.metadata.id),V.push({kind:"unavailable",id:G,entry:$,reason:"update"})):(k(J.identifier,J.metadata.id),V.push({kind:"available",model:J})):!J&&!$.exists&&p&&(k(G),V.push({kind:"unavailable",id:G,entry:$,reason:P($)}))}if(V.length>0){V.sort((G,$)=>{let J=G.kind==="available"?0:1,ae=$.kind==="available"?0:1;if(J!==ae)return J-ae;let he=G.kind==="available"?G.model.metadata.name:G.entry.label,oe=$.kind==="available"?$.model.metadata.name:$.entry.label;return he.localeCompare(oe)});for(let G of V)G.kind==="available"?v.push(ONe(wot(G.model,i,r,f),G.model,g,f)):v.push(yvo(G.id,G.entry,G.reason,s,n,void 0,g))}if(b=a.filter(G=>!w.has(G.identifier)&&!w.has(G.metadata.id)).sort((G,$)=>{let J=t[G.metadata.id]??t[G.identifier],ae=t[$.metadata.id]??t[$.identifier],he=J?.minVSCodeVersion&&!NNe(o,J.minVSCodeVersion)?1:0,oe=ae?.minVSCodeVersion&&!NNe(o,ae.minVSCodeVersion)?1:0;if(he!==oe)return he-oe;let de=G.metadata.vendor==="copilot"?0:1,Ce=$.metadata.vendor==="copilot"?0:1;if(de!==Ce)return de-Ce;let xe=G.metadata.vendor.localeCompare($.metadata.vendor);return xe!==0?xe:G.metadata.name.localeCompare($.metadata.name)}),b.length>0){v.length>0&&v.push({kind:"separator"}),v.push({item:{id:"otherModels",enabled:!0,checked:!1,class:void 0,tooltip:d(7999,null),label:d(7999,null),run:()=>{}},kind:"action",label:d(7999,null),group:{title:"",icon:R.chevronDown},hideIcon:!1,section:ige.Other,isSectionToggle:!0});for(let G of b){let $=t[G.metadata.id]??t[G.identifier];$?.minVSCodeVersion&&!NNe(o,$.minVSCodeVersion)?v.push(yvo(G.metadata.id,$,"update",s,n,ige.Other,g)):v.push(ONe(wot(G,i,r,f,ige.Other),G,g,f))}}}c&&(v.push({kind:"separator",section:b.length?ige.Other:void 0}),v.push({item:c,kind:"action",label:c.label,group:{title:"",icon:R.blank},hideIcon:!1,section:b.length?ige.Other:void 0,showAlways:!0}))}else{let b=a.find(y=>y.metadata.id==="auto"&&y.metadata.vendor==="copilot");b&&v.push(ONe(wot(b,i,r,f),b,g,f));let S=a.filter(y=>y!==b).sort((y,w)=>{let k=y.metadata.vendor.localeCompare(w.metadata.vendor);return k!==0?k:y.metadata.name.localeCompare(w.metadata.name)});for(let y of S)v.push(ONe(wot(y,i,r,f),y,g,f))}return v}function rtn(){return{isChecked(a){if(!a.isSectionToggle)return a.kind==="action"?!!a?.item?.checked:void 0},getRole:a=>{if(a.isSectionToggle)return"menuitem";switch(a.kind){case"action":return"menuitemradio";case"separator":return"separator";default:return"separator"}},getWidgetRole:()=>"menu"}}function yvo(a,i,e,t,o,n,r){let s;e==="upgrade"?s=new Ie(d(8004,null),{isTrusted:!0}):e==="update"?s=d(8002,null):s=t?new Ie(d(7994,null,t),{isTrusted:!0}):d(7992,null);let l;return e==="upgrade"?(l=new Ie("",{isTrusted:!0,supportThemeIcons:!0}),l.appendMarkdown(d(8003,null))):e==="update"?l=ttn(o):(l=new Ie("",{isTrusted:!0,supportThemeIcons:!0}),l.appendMarkdown(d(7993,null))),{item:{id:a,enabled:!1,checked:!1,class:void 0,tooltip:i.label,label:i.label,description:typeof s=="string"?s:void 0,run:()=>{}},kind:"action",label:i.label,description:s,group:{title:"",icon:q.fromId(R.blank.id)},disabled:!0,hideIcon:!1,className:"chat-model-picker-unavailable",section:n,hover:{content:l,position:r}}}var FNe=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this._delegate=e;this._hoverPosition=t;this._actionWidgetService=o;this._commandService=n;this._openerService=r;this._telemetryService=s;this._languageModelsService=l;this._productService=c;this._entitlementService=u;this._updateService=p;this._uriIdentityService=h;this._onDidChangeSelection=this._register(new E);this.onDidChangeSelection=this._onDidChangeSelection.event;this._register(this._languageModelsService.onDidChangeLanguageModels(()=>{this._renderLabel()}))}get selectedModel(){return this._selectedModel}get domNode(){return this._domNode}setHideChevrons(e){this._hideChevrons=e,this._register(be(t=>{let o=e.read(t);this._domNode&&this._domNode.classList.toggle("hide-chevrons",o),this._renderLabel()}))}setSelectedModel(e){this._selectedModel=e,this._renderLabel()}setEnabled(e){this._domNode&&(this._domNode.classList.toggle("disabled",!e),this._domNode.setAttribute("aria-disabled",String(!e)))}setBadge(e){this._badge=e,this._updateBadge()}render(e){this._domNode=M(e,_("a.action-label")),this._domNode.tabIndex=0,this._domNode.setAttribute("role","button"),this._domNode.setAttribute("aria-haspopup","true"),this._domNode.setAttribute("aria-expanded","false"),this._hideChevrons?.get()&&this._domNode.classList.toggle("hide-chevrons",!0),this._badgeIcon=M(this._domNode,_("span.model-picker-badge")),this._updateBadge(),this._renderLabel(),this._register(j(this._domNode,re.MOUSE_DOWN,t=>{t.button===0&&(Xt.stop(t,!0),this.show())})),this._register(j(this._domNode,re.KEY_DOWN,t=>{let o=new gi(t);(o.equals(3)||o.equals(10))&&(Xt.stop(t,!0),this.show())}))}show(e){let t=e??this._domNode;if(!t||this._domNode?.classList.contains("disabled"))return;let o=this._selectedModel,n=k=>{this._telemetryService.publicLog2("chat.modelChange",{fromModel:o?.metadata.vendor==="copilot"?new sg(o.identifier):"unknown",toModel:k.metadata.vendor==="copilot"?new sg(k.identifier):"unknown"}),this._selectedModel=k,this._renderLabel(),this._onDidChangeSelection.fire(k)},r=this._delegate.getModels(),s=r.length>=10,l=AF(this._entitlementService.entitlement),c=this._languageModelsService.getModelsControlManifest(),u=l?c.paid:c.free,h=this._delegate.showManageModelsAction()&&itn(this._entitlementService)?otn(this._commandService):void 0,g=k=>{this._telemetryService.publicLog2("chat.modelPickerInteraction",{interaction:k})},f=this._productService.defaultChatAgent?.manageSettingsUrl,v=ntn(r,this._selectedModel?.identifier,this._languageModelsService.getRecentlyUsedModelIds(),u,this._productService.version,this._updateService.state.type,n,f,this._delegate.useGroupedModelPicker(),s?void 0:h,this._entitlementService,this._delegate.showUnavailableFeatured(),this._delegate.showFeatured(),this._hoverPosition,this._languageModelsService),b={showFilter:s,filterPlaceholder:d(8001,null),filterActions:s&&h?[h]:void 0,focusFilterOnOpen:!0,collapsedByDefault:new Set([ige.Other]),onDidToggleSection:(k,T)=>{k===ige.Other&&g(T?"otherModelsCollapsed":"otherModelsExpanded")},linkHandler:k=>{k.scheme==="command"&&k.path==="workbench.action.chat.upgradePlan"?g("premiumModelUpgradePlanClicked"):f&&this._uriIdentityService.extUri.isEqual(k,A.parse(f))&&g("disabledModelContactAdminClicked"),this._openerService.open(k,{allowCommands:!0})},minWidth:200},S=Nn(),y={onSelect:k=>{this._actionWidgetService.hide(),k.run()},onHide:()=>{this._domNode?.setAttribute("aria-expanded","false"),Do(S)&&S.focus()}};this._domNode?.setAttribute("aria-expanded","true"),this._actionWidgetService.show("ChatModelPicker",!1,v,y,t,void 0,[],rtn(),b);let w=Nn();mae(w)&&w.classList.contains("action-list-filter-input")&&w.classList.add("chat-model-picker-filter-input")}_updateBadge(){if(this._badgeIcon)if(this._badge){let e=this._badge==="info"?R.info:R.warning;vi(this._badgeIcon,Sn(e)),this._badgeIcon.style.display="",this._badgeIcon.classList.toggle("info",this._badge==="info"),this._badgeIcon.classList.toggle("warning",this._badge==="warning")}else this._badgeIcon.style.display="none"}_renderLabel(){if(!this._domNode)return;let{name:e,statusIcon:t}=this._selectedModel?.metadata||{},o=[];if(t){let l=Sn(t);o.push(l)}let n=e??d(7996,null),r=this._selectedModel?wvo(this._selectedModel,this._languageModelsService):void 0,s=r?`${n} \xB7 ${r}`:n;o.push(_("span.chat-input-picker-label",void 0,s)),this._badgeIcon&&o.push(this._badgeIcon),o.push(...Un("$(chevron-down)")),vi(this._domNode,...o),this._domNode.ariaLabel=d(7995,null,s)}};FNe=I([m(2,td),m(3,ge),m(4,Je),m(5,Te),m(6,ds),m(7,tt),m(8,rr),m(9,zd),m(10,ht)],FNe);function stn(a,i){let e=a.metadata.id==="auto"&&a.metadata.vendor==="copilot",t=new Ie("",{isTrusted:!0,supportThemeIcons:!0});if(t.appendMarkdown(`**${a.metadata.name}**`),t.appendText(`
`),a.metadata.statusIcon&&a.metadata.tooltip&&(a.metadata.statusIcon&&t.appendMarkdown(`$(${a.metadata.statusIcon.id})&nbsp;`),t.appendMarkdown(`${a.metadata.tooltip}`),t.appendText(`
`)),a.metadata.multiplier&&(t.appendMarkdown(`${d(8006,null,a.metadata.multiplier)}`),t.appendText(`
`)),!e&&(a.metadata.maxInputTokens||a.metadata.maxOutputTokens)){let o=(a.metadata.maxInputTokens??0)+(a.metadata.maxOutputTokens??0);t.appendMarkdown(`${d(8005,null)}: `),t.appendMarkdown(`${atn(o)}`),t.appendText(`
`)}if(i){let o=a.metadata.configurationSchema;if(o?.properties){let n=i.getModelConfiguration(a.identifier)??{};for(let[r,s]of Object.entries(o.properties)){let l=n[r]??s.default;if(l===void 0)continue;let c=s.enumItemLabels,u=s.enum?.indexOf(l)??-1,p=c?.[u]??String(l),h=s.title??r;t.appendText(`${h}: ${p}`),t.appendText(`
`)}}}return t}function atn(a){return a>=1e6?`${(a/1e6).toFixed(1)}M`:a>=1e3?`${(a/1e3).toFixed(0)}K`:a.toString()}var WNe=class extends wl{constructor(e,t,o,n,r,s){super(void 0,e);this.pickerOptions=o;this._contextKeyService=r;this.keybindingService=s;this._managedHover=this._register(new me);this._pickerWidget=this._register(n.createInstance(FNe,t,o.hoverPosition)),this._pickerWidget.setSelectedModel(t.currentModel.get()),this._pickerWidget.setHideChevrons(o.hideChevrons),this._register(be(l=>{let c=t.currentModel.read(l);this._pickerWidget.setSelectedModel(c),this._updateTooltip()})),this._register(this._pickerWidget.onDidChangeSelection(l=>t.setModel(l)))}render(e){this._pickerWidget.render(e),this.element=this._pickerWidget.domNode,this._updateTooltip(),e.classList.add("chat-input-picker-item")}_getAnchorElement(){return this.element&&Ki().document.contains(this.element)?this.element:this.pickerOptions.getOverflowAnchor?.()??this.element}openModelPicker(){this._showPicker()}show(){this._showPicker()}setEnabled(e){this._pickerWidget.setEnabled(e)}_showPicker(){this._pickerWidget.show(this._getAnchorElement())}_updateTooltip(){if(!this.element)return;let e=this._getHoverContents();typeof e=="string"&&e?this._managedHover.value=Up().setupManagedHover(Ri("mouse"),this.element,e):this._managedHover.clear()}_getHoverContents(){let e=d(8046,null),t=this.keybindingService.lookupKeybinding(this._action.id,this._contextKeyService)?.getLabel();t&&(e+=` (${t})`);let{statusIcon:o,tooltip:n}=this._pickerWidget.selectedModel?.metadata||{};return o&&n?`${e} \u2022 ${n}`:e}};WNe=I([m(3,F),m(4,X),m(5,_e)],WNe);function Qzt(a,i,e=5e3){return new Promise((t,o)=>{let n=new N;n.add(be(r=>{let l=a.servers.read(r).find(i);l&&(l.start({promptType:"all-untrusted"}).then(c=>{c.state===dr.Kind.Error&&l.showOutput()}),t(),n.dispose())})),n.add(tn(()=>{n.dispose(),o(new go)},e))})}async function hW(a,i,e){let t=await a.start(i),o=new N,n=await new Promise(r=>{if(e?.isCancellationRequested||t.state===dr.Kind.Error||t.state===dr.Kind.Stopped)return r(!1);e&&o.add(e.onCancellationRequested(()=>{r(!1)})),o.add(be(s=>{let l=a.connectionState.read(s).state;(l===dr.Kind.Error||l===dr.Kind.Stopped)&&r(!1),a.cacheState.read(s)===5&&r(!0)}))});return o.dispose(),n&&await Li(0),n}function BNe(a,i){let e=a.serverMetadata.read(i);return{type:"mcp",serverLabel:e?.serverName,instructions:e?.serverInstructions,label:a.definition.label,collectionId:a.collection.id,definitionId:a.definition.id}}function Cvo(a,i){let e=!1;if(a.protocol==="http:"){let t=i?.connection.get()?.launchDefinition;t&&t.type===2&&t.uri.authority.toLowerCase()===a.host.toLowerCase()&&(e=!0)}else a.protocol==="https:"&&(e=!0);return e}function xvo(a){return a.task!==void 0}function kvo(a,i,e){return new Promise(t=>{Ox(o=>{if(e){if(e.isCancellationRequested){o.dispose(),t(void 0);return}o.store.add(e.onCancellationRequested(()=>{o.dispose(),t(void 0)}))}let r=a.servers.read(o).find(i);r&&(t(r),o.dispose())})})}function Yzt(a,i,e=""){let t=typeof i.data=="string"?i.data:JSON.stringify(i.data);switch(i.logger&&(t=`${i.logger}: ${t}`),e&&(t=`${e} ${t}`),i?.level){case"debug":a.debug(t);break;case"info":case"notice":a.info(t);break;case"warning":a.warn(t);break;case"error":case"critical":case"alert":case"emergency":a.error(t);break;default:a.info(t);break}}var ltn=/("[^"\\]*(?:\\.[^"\\]*)*")|('[^'\\]*(?:\\.[^'\\]*)*')|(\/\*[^\/\*]*(?:(?:\*|\/)[^\/\*]*)*?\*\/)|(\/{2,}.*?(?:(?:\r?\n)|$))|(,\s*[}\]])/g;function ctn(a){return a.replace(ltn,function(i,e,t,o,n,r){if(o)return"";if(n){let s=n.length;return n[s-1]===`
`?n[s-2]==="\r"?`\r
`:`
`:""}else return r?i.substring(1):i})}function zT(a){let i=ctn(a);try{return JSON.parse(i)}catch{let t=i.replace(/,\s*([}\]])/g,"$1");return JSON.parse(t)}}var vDi=[],bDi=[],Evo="vscode://schemas/toolsets",dtn={id:Evo,allowComments:!0,allowTrailingCommas:!0,defaultSnippets:[{label:d(7636,null),body:{"${1:toolSetName}":{tools:["${2:someTool}","${3:anotherTool}"],description:"${4:description}",icon:"${5:tools}"}}}],type:"object",description:d(7641,null),additionalProperties:{type:"object",required:["tools"],additionalProperties:!1,properties:{tools:{description:d(7639,null),type:"array",minItems:1,items:{type:"string",enum:vDi,enumDescriptions:bDi}},icon:{description:d(7638,null),type:"string",enum:Array.from(j$(),a=>a.id),markdownEnumDescriptions:Array.from(j$(),a=>`$(${a.id})`)},description:{description:d(7637,null),type:"string"}}}},utn=ne.as(ma.JSONContribution),Cot=class a{static{this.suffix=".toolsets.jsonc"}static isToolSetFileName(i){return He(i).endsWith(a.suffix)}static from(i,e){if(!xi(i))throw new Error("Invalid tool set data");let t=new Map;for(let[o,n]of Object.entries(i))uc(o)&&e.error("Tool set name cannot be empty"),$N(n.tools)&&e.error(`Tool set '${o}' cannot have an empty tools array`),t.set(o,{name:o,tools:n.tools,description:n.description,icon:n.icon});return new class extends a{}(t)}constructor(i){this.entries=Object.freeze(new Map(i))}},oge=class extends x{constructor(e,t,o,n,r,s){super();this._languageModelToolsService=o;this._userDataProfileService=n;this._fileService=r;this._logService=s;Promise.allSettled([e.whenInstalledExtensionsRegistered,t.when(3)]).then(()=>this._initToolSets());let l=ui(this,o.onDidChangeTools,()=>Array.from(o.getAllToolsIncludingDisabled())),c=this._store.add(new N);this._store.add(be(u=>{let p=l.read(u),h=this._languageModelToolsService.toolSets.read(u),g=[];for(let f of p)f.canBeReferencedInPrompt&&g.push({name:f.toolReferenceName??f.displayName,sourceLabel:kn.classify(f.source).label,sourceOrdinal:kn.classify(f.source).ordinal,description:f.userDescription??f.modelDescription});for(let f of h)g.push({name:f.referenceName,sourceLabel:kn.classify(f.source).label,sourceOrdinal:kn.classify(f.source).ordinal,description:f.description});vDi.length=0,bDi.length=0,g.sort((f,v)=>f.sourceOrdinal!==v.sourceOrdinal?f.sourceOrdinal-v.sourceOrdinal:f.sourceLabel!==v.sourceLabel?f.sourceLabel.localeCompare(v.sourceLabel):f.name.localeCompare(v.name));for(let f of g)vDi.push(f.name),bDi.push(d(7640,null,f.sourceLabel,f.name,f.description));c.clear(),utn.registerSchema(Evo,dtn,c)}))}static{this.ID="chat.userToolSets"}_initToolSets(){let e=ui(this,this._userDataProfileService.onDidChangeCurrentProfile,()=>this._userDataProfileService.currentProfile.promptsHome),t=Fr(this,this._languageModelToolsService.onDidChangeTools),o=Fr(this,U.filter(this._fileService.onDidFilesChange,s=>s.affects(e.get()))),n=this._store.add(new N),r=async s=>{try{return(await this._fileService.resolve(s)).children??[]}catch{return[]}};this._store.add(be(async s=>{n.clear(),t.read(s),o.read(s);let l=e.read(s),c=new Ye;n.add(Z(()=>c.dispose(!0)));let u=await r(l);if(!c.token.isCancellationRequested)for(let p of u){if(!p.isFile||!Cot.isToolSetFileName(p.resource))continue;n.add(this._fileService.watch(p.resource));let h;try{let g=await this._fileService.readFile(p.resource,void 0,c.token),f=zT(g.value.toString());h=Cot.from(f,this._logService)}catch(g){this._logService.error(`Error reading tool set file ${p.resource.toString()}:`,g);continue}if(c.token.isCancellationRequested)return;for(let[g,f]of h.entries){let v=[],b=[];if(f.tools.forEach(y=>{let w=this._languageModelToolsService.getToolByName(y);if(w){v.push(w);return}let k=this._languageModelToolsService.getToolSetByName(y);if(k){b.push(k);return}}),v.length===0&&b.length===0)continue;let S=this._languageModelToolsService.createToolSet({type:"user",file:p.resource,label:He(p.resource)},`user/${p.resource.toString()}/${g}`,g,{icon:f.icon?q.fromId(f.icon):void 0,description:f.description});Gi(y=>{n.add(S),v.forEach(w=>n.add(S.addTool(w,y))),b.forEach(w=>n.add(S.addToolSet(w,y)))})}}}))}};oge=I([m(0,lt),m(1,ji),m(2,Vn),m(3,ln),m(4,fe),m(5,se)],oge);var HNe=class a extends K{static{this.ID="chat.configureToolSets"}constructor(){super({id:a.ID,title:L(7631,"Configure Tool Sets..."),shortTitle:d(7634,null),category:Si,f1:!0,precondition:C.and(ie.enabled,ie.Tools.toolsCount.greater(0)),menu:[{id:ky,when:C.equals("view",Dr),order:11,group:"2_level"},{id:D.ViewTitle,when:C.and(ie.enabled,C.equals("view",Dr),C.has("config.chat.customizationsMenu.enabled")),order:11,group:"2_level"}]})}async run(i){let e=i.get(Vn),t=i.get(Ue),o=i.get(ee),n=i.get(ln),r=i.get(fe),s=i.get(Uo),l=[];l.push({label:d(7632,null),alwaysShow:!0,iconClass:q.asClassName(R.plus)});for(let p of e.toolSets.get())p.source.type==="user"&&l.push({label:p.referenceName,toolset:p,tooltip:p.description,iconClass:q.asClassName(p.icon)});let c=await t.pick(l,{canPickMany:!1,placeHolder:d(7633,null)});if(!c)return;let u;if(c.toolset)wo(c.toolset.source.type==="user"),u=c.toolset.source.file;else{let p=await t.input({placeHolder:d(7635,null),validateInput:async h=>{if(!h)return d(7629,null);if(!v1(h))return d(7630,null,h)}});if(uc(p))return;u=Ge(n.currentProfile.promptsHome,`${p}${Cot.suffix}`),await r.exists(u)||await s.write(u,["// Place your tool sets here...","// Example:","// {",'// 	"toolSetName": {','// 		"tools": [','// 			"someTool",','// 			"anotherTool"',"// 		],",'// 		"description": "description",','// 		"icon": "tools"',"// 	}","// }"].join(`
`))}await o.openEditor({resource:u,options:{pinned:!0}})}};function mtn(a){return a.itemType==="bucket"}function Xzt(a){return a.itemType==="toolset"}function xot(a){return a.itemType==="tool"}function htn(a){return a.itemType==="callback"}function _vo(a,i=!1){return a?q.isThemeIcon(a)?{iconClass:q.asClassName(a)}:{iconPath:a}:i?{iconClass:q.asClassName(R.tools)}:{}}function Tvo(a,i){let e=_vo(a.icon,!0);return{itemType:"tool",tool:a,id:a.id,label:a.toolReferenceName??a.displayName,description:a.userDescription??a.modelDescription,checked:i,...e}}function gtn(a,i,e){let t=_vo(a.icon),o=[];if(a.source.type==="user"){let n=a.source.file;o.push({iconClass:q.asClassName(R.edit),tooltip:d(5951,null),action:()=>e.openEditor({resource:n})})}return{itemType:"toolset",toolset:a,buttons:o,id:a.id,label:a.referenceName,description:a.description,checked:i,children:void 0,collapsed:!0,...t}}async function Jzt(a,i,e,t,o,n,r){let s=a.get(Ue),l=a.get(_s),c=a.get(Lc),u=a.get(ge),p=a.get(Hi),h=a.get(ee),g=a.get(Ng),f=a.get(Vn),v=a.get(_D),b=a.get(Te),S=new Map;for(let J of l.servers.get())for(let ae of J.tools.get())S.set(ae.id,J);function y(J){let ae=o?new Map([...o()].map(([Oe,pt])=>[Oe.id,pt])):void 0;if(!ae){let Oe=new Map;for(let pt of f.getTools(n))pt.canBeReferencedInPrompt&&Oe.set(pt,!1);for(let pt of f.getToolSetsForModel(n))Oe.set(pt,!1);ae=Oe}J?.forEach((Oe,pt)=>{ae.set(pt.id,Oe)});let he=[],oe=new Map,de=Oe=>{switch(Oe.type){case"mcp":case"extension":return kn.toKey(Oe);case"internal":return 1 .toString();case"user":return 0 .toString();case"external":throw new Error("should not be reachable");default:os(Oe)}},Ce=new Map(l.servers.get().map(Oe=>[Oe.definition.id,{server:Oe,seen:!1}])),xe=(Oe,pt)=>{if(Oe.type==="mcp"){let et=Ce.get(Oe.definitionId);if(!et)return;et.seen=!0;let Ti=et.server,Ht=[],zi=c.collections.get().find(yo=>yo.id===Ti.collection.id);zi?.source?Ht.push({iconClass:q.asClassName(R.settingsGear),tooltip:d(5947,null,zi.label),action:()=>zi.source?zi.source instanceof Ii?p.open(zi.source.value,{tab:"features",feature:"mcp"}):g.open(zi.source,{tab:"configuration"}):void 0}):zi?.presentation?.origin&&Ht.push({iconClass:q.asClassName(R.settingsGear),tooltip:d(5947,null,zi.label),action:()=>h.openEditor({resource:zi.presentation.origin})}),Ti.connectionState.get().state===dr.Kind.Error&&Ht.push({iconClass:q.asClassName(R.warning),tooltip:d(5953,null),action:()=>Ti.showOutput()});let Vo=Ti.cacheState.get(),sn=[],_n=!0;(Vo===0||Vo===2)&&(_n=!1,sn.push({itemType:"callback",iconClass:q.asClassName(R.sync),label:d(5954,null),pickable:!1,run:()=>(k.busy=!0,(async()=>{if(!await hW(Ti,{promptType:"all-untrusted"})){Ti.showOutput(),k.hide();return}k.busy=!1,y(T())})(),!1)}));let mn={itemType:"bucket",ordinal:2,id:pt,label:Oe.label,checked:void 0,collapsed:_n,children:sn,buttons:Ht,sortOrder:2},hn=Ti.serverMetadata.get()?.icons.getUrl(22);return hn?mn.iconPath=hn:mn.iconClass=q.asClassName(R.mcp),mn}else return Oe.type==="extension"?{itemType:"bucket",ordinal:3,id:pt,label:Oe.label,checked:void 0,children:[],buttons:[],collapsed:!0,iconClass:q.asClassName(R.extensions),sortOrder:3}:Oe.type==="internal"?{itemType:"bucket",ordinal:1,id:pt,label:d(5950,null),checked:void 0,children:[],buttons:[],collapsed:!1,sortOrder:1}:{itemType:"bucket",ordinal:0,id:pt,label:d(5956,null),checked:void 0,children:[],buttons:[],collapsed:!0,sortOrder:4}},ze=Oe=>{let pt=de(Oe),et=oe.get(pt);return et||(et=xe(Oe,pt),et&&oe.set(pt,et)),et};for(let Oe of f.getToolSetsForModel(n)){if(!ae.has(Oe.id))continue;let pt=ze(Oe.source);if(!pt)continue;let et=ae.get(Oe.id)===!0;if(Oe.source.type==="mcp")pt.toolset=Oe,et&&(pt.checked=et);else{let Ti=gtn(Oe,et,h);pt.children.push(Ti);let Ht=[];for(let zi of Oe.getTools()){let Vo=et||ae.get(zi.id)===!0,sn=Tvo(zi,Vo);Ht.push(sn)}Ht.length>0&&(Ti.children=Ht)}}for(let Oe of f.getAllToolsIncludingDisabled()){if(!Oe.canBeReferencedInPrompt||!ae.has(Oe.id))continue;let pt=ze(Oe.source);if(!pt)continue;let et=pt.checked===!0||ae.get(Oe.id)===!0,Ti=Tvo(Oe,et);pt.children.push(Ti)}for(let{server:Oe,seen:pt}of Ce.values()){let et=Oe.cacheState.get();!pt&&(et===0||et===2)&&ze({type:"mcp",definitionId:Oe.definition.id,label:Oe.definition.label,instructions:"",serverLabel:"",collectionId:Oe.collection.id})}let De=Array.from(oe.values()).sort((Oe,pt)=>Oe.sortOrder!==pt.sortOrder?Oe.sortOrder-pt.sortOrder:Oe.label.localeCompare(pt.label));for(let Oe of De){he.push(Oe),Oe.children.sort((pt,et)=>pt.label.localeCompare(et.label));for(let pt of Oe.children)Xzt(pt)&&pt.children&&pt.children.sort((et,Ti)=>et.label.localeCompare(Ti.label))}for(let Oe of De){let pt=Oe.ordinal===2,et=Ti=>{if(!v.toolCanManageConfirmation(Ti.tool))return;let Ht=Ti.tool,zi=pt?Oe.children.flatMap(sn=>xot(sn)?[sn.tool]:Xzt(sn)&&sn.children?sn.children.filter(xot).map(_n=>_n.tool):[]):[Ht],Vo=Ti.buttons?[...Ti.buttons]:[];Vo.push({iconClass:q.asClassName(R.pass),tooltip:d(5952,null),keepOpen:!0,action:()=>v.manageConfirmationPreferences(zi,{focusToolId:Ht.id})}),Ti.buttons=Vo};for(let Ti of Oe.children)if(xot(Ti))et(Ti);else if(Xzt(Ti)&&Ti.children)for(let Ht of Ti.children)xot(Ht)&&et(Ht)}he.length===0?k.placeholder=d(5955,null):k.placeholder=i,k.setItemTree(he)}let w=new N,k=w.add(s.createQuickTree());k.placeholder=i,k.description=t,k.matchOnDescription=!0,k.matchOnLabel=!0,k.sortByLabel=!1,y(),w.add(k.onDidTriggerItemButton(J=>{J.button&&typeof J.button.action=="function"&&(J.button.action(),w.dispose())}));let T=()=>{let J=new Map,ae=he=>{for(let oe of he)if(mtn(oe)){if(oe.toolset){let de=oe.checked===!0;J.set(oe.toolset,de)}ae(oe.children)}else Xzt(oe)?(J.set(oe.toolset,oe.checked===!0),oe.children&&ae(oe.children)):xot(oe)&&J.set(oe.tool,oe.checked||J.get(oe.tool)===!0)};return ae(k.itemTree),J},P=!1,O=w.add(new E);w.add(k.onDidAccept(()=>{let ae=k.activeItems.find(htn);if(!ae){P=!0,k.hide();return}ae.run()!==!1&&O.fire()}));let V={iconClass:q.asClassName(R.mcp),tooltip:d(5946,null)},H={iconClass:q.asClassName(R.extensions),tooltip:d(5945,null)},G={iconClass:q.asClassName(R.gear),tooltip:d(5948,null)};k.title=d(5949,null),k.buttons=[V,H,G],w.add(k.onDidTriggerButton(J=>{J===V?u.executeCommand("workbench.mcp.addConfiguration"):J===H?p.openSearch("@tag:language-model-tools"):J===G&&u.executeCommand(HNe.ID),k.hide()})),r&&w.add(r.onCancellationRequested(()=>{k.hide()}));let $=T();return k.show(),await Promise.race([U.toPromise(U.any(k.onDidHide,O.event),w)]),btn(e,b,$,T(),c),w.dispose(),P?T():void 0}function ftn(a,i){let e=a.source;switch(e.type){case"internal":return{category:"builtin",name:a.id};case"extension":return{category:"extension",name:a.id,extensionId:e.extensionId.value};case"mcp":{let t=i.collections.get().find(o=>o.id===e.collectionId);return t?.source instanceof Ii?{category:"extension-mcp",extensionId:t.source.value}:{category:"user-mcp"}}case"user":return{category:"user-toolset"};case"external":return{category:"user-toolset"};default:os(e)}}function vtn(a,i,e){let t={builtinEnabled:0,builtinDisabled:0,extensionEnabled:0,extensionDisabled:0,extensionMcpEnabled:0,extensionMcpDisabled:0,userMcpEnabled:0,userMcpDisabled:0,userToolsetEnabled:0,userToolsetDisabled:0,details:""},o=[];for(let[n,r]of i){if((a.get(n)??!1)===r)continue;let l=ftn(n,e),c=r;switch(l.category){case"builtin":c?t.builtinEnabled++:t.builtinDisabled++,o.push({category:"builtin",name:l.name,enabled:c});break;case"extension":c?t.extensionEnabled++:t.extensionDisabled++,o.push({category:"extension",name:l.name,extensionId:l.extensionId,enabled:c});break;case"extension-mcp":c?t.extensionMcpEnabled++:t.extensionMcpDisabled++,o.push({category:"extension-mcp",extensionId:l.extensionId,enabled:c});break;case"user-mcp":c?t.userMcpEnabled++:t.userMcpDisabled++,o.push({category:"user-mcp",enabled:c});break;case"user-toolset":c?t.userToolsetEnabled++:t.userToolsetDisabled++,o.push({category:"user-toolset",enabled:c});break}}return t.details=JSON.stringify(o),t}function btn(a,i,e,t,o){let n=vtn(e,t,o),r=n.builtinEnabled>0||n.builtinDisabled>0||n.extensionEnabled>0||n.extensionDisabled>0||n.extensionMcpEnabled>0||n.extensionMcpDisabled>0||n.userMcpEnabled>0||n.userMcpDisabled>0||n.userToolsetEnabled>0||n.userToolsetDisabled>0;i.publicLog2("chatToolPickerClosed",{source:a,changed:r,builtinEnabled:n.builtinEnabled,builtinDisabled:n.builtinDisabled,extensionEnabled:n.extensionEnabled,extensionDisabled:n.extensionDisabled,extensionMcpEnabled:n.extensionMcpEnabled,extensionMcpDisabled:n.extensionMcpDisabled,userMcpEnabled:n.userMcpEnabled,userMcpDisabled:n.userMcpDisabled,userToolsetEnabled:n.userToolsetEnabled,userToolsetDisabled:n.userToolsetDisabled,details:n.details})}var JH="workbench.action.chat.acceptTool",rge="workbench.action.chat.skipTool",Dvo="workbench.action.chat.acceptToolPostExecution",Lvo="workbench.action.chat.skipToolPostExecution",Zzt=class extends K{run(i,e){let t=i.get(Pt),o=e?.sessionResource?t.getWidgetBySessionResource(e.sessionResource):t.lastFocusedWidget,n=o?.viewModel?.getItems().at(-1);if(Ui(n)){for(let r of n.model.response.value){let s=r.kind==="toolInvocation"?r.state.get():void 0;if(s?.type===Pi.StateKind.WaitingForConfirmation||s?.type===Pi.StateKind.WaitingForPostApproval){s.confirm(this.getReason());break}}o?.focusInput()}}},SDi=class extends Zzt{constructor(){super({id:JH,title:L(5934,"Accept"),f1:!1,category:Si,keybinding:{when:C.and(ie.inChatSession,ie.Editing.hasToolConfirmation),primary:2051,weight:201}})}getReason(){return{type:4}}},IDi=class extends Zzt{constructor(){super({id:rge,title:L(5935,"Skip"),f1:!1,category:Si,keybinding:{when:C.and(ie.inChatSession,ie.Editing.hasToolConfirmation),primary:2563,weight:201}})}getReason(){return{type:5}}},nge=class a extends K{static{this.ID="workbench.action.chat.configureTools"}constructor(){super({id:a.ID,title:d(5944,null),icon:R.settings,f1:!1,category:Si,precondition:ie.chatModeKind.isEqualTo("agent"),menu:[{when:C.and(ie.chatModeKind.isEqualTo("agent"),ie.lockedToCodingAgent.negate()),id:D.ChatInput,group:"navigation",order:100}]})}async run(i,...e){let t=i.get(F),o=i.get(Pt),n=i.get(Te),r=o.lastFocusedWidget;if(r||(r=this.extractWidget(e)),!r)return;let s=this.extractSource(e)??"chatInput",l,c,{entriesScope:u,entriesMap:p}=r.input.selectedToolsModel;switch(u){case 1:l=d(5943,null),c=d(5939,null);break;case 2:l=d(5940,null),c=d(5936,null,r.input.currentModeObs.get().label.get());break;case 3:l=d(5942,null),c=d(5938,null,r.input.currentModeObs.get().label.get());break;case 0:l=d(5941,null),c=d(5937,null);break}let h=new Ye,g=r.input.currentModeObs.get(),f=be(b=>{g.id!==r.input.currentModeObs.read(b).id&&h.cancel()});try{let b=await t.invokeFunction(Jzt,l,s,c,()=>p.get(),r.input.selectedLanguageModel.get()?.metadata,h.token);b&&r.input.selectedToolsModel.set(b,!1)}finally{f.dispose(),h.dispose()}let v=r.input.selectedToolsModel.entriesMap.get();n.publicLog2("chat/selectedTools",{total:v.size,enabled:vt.reduce(v,(b,[S,y])=>y?b+1:b,0)})}extractWidget(i){function e(t){return!!t&&typeof t=="object"&&!!t.widget}for(let t of i)if(e(t))return t.widget}extractSource(i){function e(t){return!!t&&typeof t=="object"&&!!t.source}for(let t of i)if(e(t))return t.source}};function Rvo(){W(SDi),W(IDi),W(nge)}var UNe=_,Mvo=250,Pvo=20,eKt={compact:{top:2,bottom:2},default:{top:12,bottom:12}},Avo="chat.cachedLanguageModels.v2",Stn=320;var Itn=rN({defaultValue:void 0,key:"chat.untitledInputState",toStorage:JSON.stringify,fromStorage(a){let i=JSON.parse(a);if(i.selectedModel&&!i.selectedModel.metadata.isDefaultForLocation){let e=i.selectedModel.metadata.isDefault,t={panel:!!e};Xu(i.selectedModel.metadata,{isDefaultForLocation:t}),delete i.selectedModel.metadata.isDefault}return i}}),J8=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,P,O,V,H,G,$,J,ae,he,oe,de){super();this.location=e;this.options=t;this.inline=n;this.modelService=r;this.instantiationService=s;this.contextKeyService=l;this.configurationService=c;this.keybindingService=u;this.accessibilityService=p;this.languageModelsService=h;this.logService=g;this.fileService=f;this.editorService=v;this.themeService=b;this.textModelResolverService=S;this.storageService=y;this.agentService=w;this.sharedWebExtracterService=k;this.experimentService=T;this.entitlementService=P;this.chatModeService=O;this.toolService=V;this.chatService=H;this.chatSessionsService=G;this.chatContextService=$;this.agentSessionsService=J;this.workspaceContextService=ae;this.layoutService=he;this.viewDescriptorService=oe;this._chatAttachmentWidgetRegistry=de;this._workingSetCollapsed=Me("chatInputPart.workingSetCollapsed",!0);this._stableInputPartWidth=Me("chatInputPart.stableInputPartWidth",0);this._chatInputTodoListWidget=this._register(new me);this._chatArtifactsWidget=this._register(new me);this._chatQuestionCarouselWidgets=this._register(new Vt);this._questionCarouselResponseIds=new Map;this._questionCarouselSessionResources=new Map;this._chatEditingTodosDisposables=this._register(new N);this._onDidLoadInputState=this._register(new E);this.onDidLoadInputState=this._onDidLoadInputState.event;this._toolbarRelayoutScheduler=this._register(new Dt(()=>{typeof this.cachedWidth=="number"&&this.layout(this.cachedWidth)},0));this._onDidFocus=this._register(new E);this.onDidFocus=this._onDidFocus.event;this._onDidBlur=this._register(new E);this.onDidBlur=this._onDidBlur.event;this._onDidChangeContext=this._register(new E);this.onDidChangeContext=this._onDidChangeContext.event;this._onDidAcceptFollowup=this._register(new E);this.onDidAcceptFollowup=this._onDidAcceptFollowup.event;this._onDidClickOverlay=this._register(new E);this.onDidClickOverlay=this._onDidClickOverlay.event;this._indexOfLastAttachedContextDeletedWithKeyboard=-1;this._indexOfLastOpenedContext=-1;this._onDidChangeVisibility=this._register(new E);this.inputEditorHeight=0;this.followupsDisposables=this._register(new N);this.overlayClickListener=this._register(new me);this.attachedContextDisposables=this._register(new me);this._widgetController=this._register(new me);this._contextUsageDisposables=this._register(new me);this.height=Me(this,0);this._forceVisibleScrollbarUntilAccept=!1;this._modelSyncDisposables=this._register(new N);this._isSyncingToOrFromInputModel=!1;this.chatSessionPickerWidgets=this._register(new Vt);this._waitForPersistedLanguageModel=this._register(new me);this._chatSessionOptionEmitters=this._register(new Vt);this._optionContextKeys=new Map;this._currentLanguageModel=Me("_currentLanguageModel",void 0);this._onDidChangeCurrentChatMode=this._register(new E);this.onDidChangeCurrentChatMode=this._onDidChangeCurrentChatMode.event;this.inputUri=A.parse(`${Q.vscodeChatInput}:input-${J8._counter++}`);this._workingSetLinesAddedSpan=new co(()=>_(".working-set-lines-added"));this._workingSetLinesRemovedSpan=new co(()=>_(".working-set-lines-removed"));this._chatEditsActionsDisposables=this._register(new N);this._chatEditsDisposables=this._register(new N);this._renderingChatEdits=this._register(new me);this._attemptedWorkingSetEntriesCount=0;this._chatSessionIsEmpty=!1;this._pendingDelegationTarget=void 0;this._currentSessionType=void 0;this._syncTextDebounced=this._register(new Dt(()=>this._syncInputStateToModel(),150)),this._emptyInputState=this._register(Itn(1,0,this.storageService)),this._contextResourceLabels=this._register(this.instantiationService.createInstance(Nl,{onDidChangeVisibility:this._onDidChangeVisibility.event})),this._currentModeObservable=Me("currentMode",this.options.defaultMode??Tl.Agent),this._currentPermissionLevel=Me("permissionLevel","default"),this._register(this.editorService.onDidActiveEditorChange(()=>{this._indexOfLastOpenedContext=-1,this.refreshChatSessionPickers()})),this._register(this.chatSessionsService.onDidChangeSessionOptions(xe=>{let ze=this._widget?.viewModel?.model.sessionResource;ze&&Qe(ze,xe.sessionResource)&&this.refreshChatSessionPickers()})),this._register(this.chatSessionsService.onDidChangeOptionGroups(xe=>{let ze=this._widget?.viewModel?.model.sessionResource;if(ze){let De=this.chatService.getChatSessionFromInternalUri(ze),Oe=this.options.sessionTypePickerDelegate?.getActiveSessionProvider?.();(De&&gl(De.chatSessionResource)===xe||Oe===xe)&&this.refreshChatSessionPickers()}})),this.options.sessionTypePickerDelegate?.onDidChangeActiveSessionProvider&&this._register(this.options.sessionTypePickerDelegate.onDidChangeActiveSessionProvider(async xe=>{this.computeVisibleOptionGroups(),this.agentSessionTypeKey.set(xe),this.chatSessionSupportsDelegationKey.set(this.chatSessionsService.supportsDelegationForSessionType(xe)),this.updateWidgetLockStateFromSessionType(xe),this.refreshChatSessionPickers()})),this._attachmentModel=this._register(this.instantiationService.createInstance(rNe)),this._register(this._attachmentModel.onDidChange(()=>this._syncInputStateToModel())),this.selectedToolsModel=this._register(this.instantiationService.createInstance(RNe,this.currentModeObs,this._currentLanguageModel)),this.dnd=this._register(this.instantiationService.createInstance(_Ne,()=>this._widget,this._attachmentModel,o)),this.inputEditorMaxHeight=this.options.renderStyle==="compact"?Mvo/3:Mvo;let Ce=this.options.renderStyle==="compact"?eKt.compact:eKt.default;if(this.inputEditorMinHeight=this.options.inputEditorMinLines?this.options.inputEditorMinLines*Pvo+Ce.top+Ce.bottom:void 0,this.inputEditorHasText=ie.inputHasText.bindTo(l),this.chatCursorAtTop=ie.inputCursorAtTop.bindTo(l),this.inputEditorHasFocus=ie.inputHasFocus.bindTo(l),this._hasQuestionCarouselContextKey=ie.Editing.hasQuestionCarousel.bindTo(l),this.chatModeKindKey=ie.chatModeKind.bindTo(l),this.chatModeNameKey=ie.chatModeName.bindTo(l),this.chatModelIdKey=ie.chatModelId.bindTo(l),this.permissionLevelKey=ie.chatPermissionLevel.bindTo(l),this.withinEditSessionKey=ie.withinEditSessionDiff.bindTo(l),this.filePartOfEditSessionKey=ie.filePartOfEditSession.bindTo(l),this.chatSessionHasOptions=ie.chatSessionHasModels.bindTo(l),this.chatSessionOptionsValid=ie.chatSessionOptionsValid.bindTo(l),this.agentSessionTypeKey=ie.agentSessionType.bindTo(l),this.chatSessionSupportsDelegationKey=ie.chatSessionSupportsDelegation.bindTo(l),this.options.sessionTypePickerDelegate?.getActiveSessionProvider){let xe=this.options.sessionTypePickerDelegate.getActiveSessionProvider();xe&&(this.agentSessionTypeKey.set(xe),this.chatSessionSupportsDelegationKey.set(this.chatSessionsService.supportsDelegationForSessionType(xe)))}this.chatSessionHasCustomAgentTarget=ie.chatSessionHasCustomAgentTarget.bindTo(l),this.chatSessionHasTargetedModels=ie.chatSessionHasTargetedModels.bindTo(l),this.history=this._register(this.instantiationService.createInstance(WDe,this.location)),this._register(this.configurationService.onDidChangeConfiguration(xe=>{let ze={};xe.affectsConfiguration("accessibility.verbosity.panelChat")&&(ze.ariaLabel=this._getAriaLabel()),xe.affectsConfiguration("editor.wordSegmenterLocales")&&(ze.wordSegmenterLocales=this.configurationService.getValue("editor.wordSegmenterLocales")),xe.affectsConfiguration("editor.autoClosingBrackets")&&(ze.autoClosingBrackets=this.configurationService.getValue("editor.autoClosingBrackets")),xe.affectsConfiguration("editor.autoClosingQuotes")&&(ze.autoClosingQuotes=this.configurationService.getValue("editor.autoClosingQuotes")),xe.affectsConfiguration("editor.autoSurround")&&(ze.autoSurround=this.configurationService.getValue("editor.autoSurround")),this.inputEditor.updateOptions(ze)})),this._chatEditsListPool=this._register(this.instantiationService.createInstance(mie,this._onDidChangeVisibility.event,D.ChatEditingWidgetModifiedFilesToolbar,{verticalScrollMode:3})),this._hasFileAttachmentContextKey=ie.hasFileAttachments.bindTo(l),this.initSelectedModel(),this._register(this.languageModelsService.onDidChangeLanguageModels(()=>{qgo(this._currentLanguageModel.get()?.identifier,this.getModels())&&this.setCurrentLanguageModelToDefault()})),this._register(this.onDidChangeCurrentChatMode(()=>{this.accessibilityService.alert(this._currentModeObservable.get().label.get()),this._inputEditor&&this._inputEditor.updateOptions({ariaLabel:this._getAriaLabel()}),this.setImplicitContextEnablement()})),this._register(be(xe=>{let ze=this._currentLanguageModel.read(xe);this.chatModelIdKey.set(ze?.metadata.id.toLowerCase()??""),ze?.metadata.name&&this.accessibilityService.alert(ze.metadata.name),this._inputEditor?.updateOptions({ariaLabel:this._getAriaLabel()})})),this._register(this.chatModeService.onDidChangeChatModes(()=>this.validateCurrentChatMode())),this._register(be(xe=>{let ze=this._currentModeObservable.read(xe);this.chatModeKindKey.set(ze.kind),this.chatModeNameKey.set(ze.name.read(xe));let De=ze.model?.read(xe);De&&this.switchModelByQualifiedName(De)})),this._register(be(xe=>{let ze=this._currentModeObservable.read(xe),De=ze.name.read(xe),Oe=this._widget?.viewModel?.model.sessionResource;if(Oe){let pt=this.chatService.getChatSessionFromInternalUri(Oe);if(pt){let et=!0,Ti=this.chatSessionsService.getSessionOption(pt.chatSessionResource,YDt);if(typeof Ti<"u"){let Ht=(typeof Ti=="string"?Ti:Ti.id)||Tl.Agent.id;et=Ht===Tl.Agent.id?ze.id!==Tl.Agent.id:ze.label.read(void 0)!==Ht}et&&this.chatSessionsService.updateSessionOptions(pt.chatSessionResource,new Map([[YDt,ze.isBuiltin?"":De]]))}}})),this.validateCurrentChatMode()}static{this._counter=0}get attachmentModel(){return this._attachmentModel}getAttachedContext(){let e=new d4;return e.add(...this.attachmentModel.attachments,...this.chatContextService.getWorkspaceContextItems()),e}getAttachedAndImplicitContext(){let e=this.getAttachedContext();if(this.implicitContext){let t=this.implicitContext.enabledBaseEntries(this.configurationService.getValue("chat.implicitContext.suggestedContext"));e.add(...t)}return e}get implicitContext(){return this._implicitContext}get inputContainerElement(){return this.inputContainer}get gettingStartedTipContainerElement(){return this.chatGettingStartedTipContainer}get inputEditor(){return this._inputEditor}get currentLanguageModel(){return this._currentLanguageModel.get()?.identifier}get selectedLanguageModel(){return this._currentLanguageModel}get currentModeKind(){let e=this._currentModeObservable.get();return e.kind==="agent"&&!this.agentService.hasToolsAgent?"edit":e.kind}get currentModeObs(){return this._currentModeObservable}get currentPermissionLevelObs(){return this._currentPermissionLevel}get currentModeInfo(){let e=this._currentModeObservable.get(),t=e.isBuiltin?this.currentModeKind:"custom",o=e.modeInstructions?.get();return{kind:this.currentModeKind,isBuiltin:e.isBuiltin,modeInstructions:o?{uri:e.uri?.get(),name:e.name.get(),content:o.content,toolReferences:this.toolService.toToolReferences(o.toolReferences),metadata:o.metadata,isBuiltin:e.isBuiltin}:void 0,modeId:t,modeName:d3(e),applyCodeBlockSuggestionId:void 0,permissionLevel:this._currentPermissionLevel.get()}}get selectedElements(){let e=[],o=this._chatEditList?.object?.getSelectedElements()??[];for(let n of o)n.kind==="reference"&&A.isUri(n.reference)&&e.push(n.reference);return e}get attemptedWorkingSetEntriesCount(){return this._attemptedWorkingSetEntriesCount}get pendingDelegationTarget(){return this._pendingDelegationTarget}setImplicitContextEnablement(){this.implicitContext&&this.configurationService.getValue("chat.implicitContext.suggestedContext")&&this.implicitContext.setEnabled(this._currentModeObservable.get().name.get().toLowerCase()==="ask")}setIsWithinEditSession(e,t){this.withinEditSessionKey.set(e),this.filePartOfEditSessionKey.set(t)}getSelectedModelStorageKey(){let e=this._currentSessionType;return e&&this.hasModelsTargetingSessionType()?`chat.currentLanguageModel.${this.location}.${e}`:`chat.currentLanguageModel.${this.location}`}getSelectedModelIsDefaultStorageKey(){let e=this._currentSessionType;return e&&this.hasModelsTargetingSessionType()?`chat.currentLanguageModel.${this.location}.${e}.isDefault`:`chat.currentLanguageModel.${this.location}.isDefault`}initSelectedModel(){let e=this.storageService.get(this.getSelectedModelStorageKey(),-1),t=this.storageService.getBoolean(this.getSelectedModelIsDefaultStorageKey(),-1,!0);if(e){let o=n_i(e,t,this.getModels(),this.location);o.shouldRestore&&o.model?(this.setCurrentLanguageModel(o.model),this.checkModelSupported()):o.model||(this._waitForPersistedLanguageModel.value=this.languageModelsService.onDidChangeLanguageModels(n=>{let r=this.languageModelsService.lookupLanguageModel(e);if(r){this._waitForPersistedLanguageModel.clear();let s={metadata:r,identifier:e};$go(e,t,s,this.location)&&(this.setCurrentLanguageModel(s),this.checkModelSupported())}else this.setCurrentLanguageModelToDefault()}))}this._register(this._onDidChangeCurrentChatMode.event(()=>{this.checkModelSupported()}))}setEditing(e,t){this.currentlyEditingInputKey?.set(e),this.editingSentRequestKey?.set(t)}switchModel(e){let o=this.getModels().find(n=>n.metadata.vendor===e.vendor&&n.metadata.id===e.id&&n.metadata.family===e.family);o&&this.setCurrentLanguageModel(o)}switchModelByQualifiedName(e){let t=this.getModels();for(let o of e){let n=t.find(r=>nD.matchesQualifiedName(o,r.metadata));if(n)return this.setCurrentLanguageModel(n),!0}return this.logService.warn(`[chat] Node of the models "${e.join(", ")}" not found. Use format "<name> (<vendor>)", e.g. "GPT-4o (copilot)".`),!1}switchToNextModel(){let e=this.getModels();if(e.length>0){let o=(e.findIndex(n=>n.identifier===this._currentLanguageModel.get()?.identifier)+1)%e.length;this.setCurrentLanguageModel(e[o])}}openModelPicker(){this.modelWidget?.show()}openModePicker(){this.modeWidget?.show()}openPermissionPicker(){this.permissionWidget?.show()}setPermissionLevel(e){this._currentPermissionLevel.set(e,void 0),this.permissionLevelKey.set(e),this.permissionWidget?.refresh(),this._syncInputStateToModel()}openSessionTargetPicker(){this.sessionTargetWidget?.show()}openDelegationPicker(){this.delegationWidget?.show()}openChatSessionPicker(){this.chatSessionPickerWidgets?.values()?.next().value?.show()}createChatSessionPickerWidgets(e,t){this._lastSessionPickerAction=e,this._lastSessionPickerOptions=t;let o=this.computeVisibleOptionGroups();if(!o)return[];let{visibleGroupIds:n,optionGroups:r,effectiveSessionType:s}=o;this.chatSessionPickerWidgets.clearAndDisposeAll();let l=[];for(let c of r){if(!n.has(c.id))continue;let u=this.getCurrentOptionForGroup(c.id),p={group:c,item:u},h={getCurrentOption:()=>this.getCurrentOptionForGroup(c.id),onDidChangeOption:this.getOrCreateOptionEmitter(c.id).event,setOption:f=>{this.updateOptionContextKey(c.id,f.id),this.getOrCreateOptionEmitter(c.id).fire(f);let v=this._widget?.viewModel?.model.sessionResource,b=v?this.chatService.getChatSessionFromInternalUri(v):void 0;b&&this.chatSessionsService.setSessionOption(b.chatSessionResource,c.id,f),this.refreshChatSessionPickers()},getOptionGroup:()=>this.chatSessionsService.getOptionGroupsForSessionType(s)?.find(v=>v.id===c.id),getSessionResource:()=>this._widget?.viewModel?.model.sessionResource},g=this.instantiationService.createInstance(c.searchable?uie:die,e,p,h,t);this.chatSessionPickerWidgets.set(c.id,g),l.push(g)}return l}setInputModel(e,t){this._inputModel&&this._syncInputStateToModel(),this._inputModel=e,this._modelSyncDisposables.clear(),this.selectedToolsModel.resetSessionEnablementState(),this._chatSessionIsEmpty=t,t&&this._setEmptyModelState(),this._modelSyncDisposables.add(be(o=>{let n=e.state.read(o);!n&&this._chatSessionIsEmpty&&(n=this._emptyInputState.read(void 0)),this._syncFromModel(n)}))}_setEmptyModelState(){let e=this.getDefaultModeExperimentStorageKey();if(!this.storageService.getBoolean(e,1,!1)){let o=this.entitlementService.anonymous;this.experimentService.getTreatment("chat.defaultMode").then((n=>{if(o&&(n="agent"),typeof n=="string"){this.storageService.store(e,!0,1,1);let r=Deo(n);r&&(this.logService.trace(`Applying default mode from experiment: ${r}`),this.setChatMode(r,!1),this.checkModelSupported())}}))}}_syncFromModel(e){if(!this._isSyncingToOrFromInputModel)try{if(this._isSyncingToOrFromInputModel=!0,e&&this._currentModeObservable.get().id!==e.mode.id&&this.setChatMode(e.mode.id,!1),e?.selectedModel){let o=this.getAllMergedModels(),n=this.getCurrentSessionType(),r=Kgo(e.selectedModel,this._currentLanguageModel.get(),o,n,{location:this.location,currentModeKind:this.currentModeKind,isInlineChatV2Enabled:!!this.configurationService.getValue("inlineChat.enableV2"),sessionType:n});r.action==="apply"?this.setCurrentLanguageModel(e.selectedModel):r.action==="default"&&this.setCurrentLanguageModelToDefault()}let t=this._attachmentModel.attachments;if(e?$i(t,e.attachments)||this._attachmentModel.clearAndSetContext(...e.attachments):this._attachmentModel.clear(),this._inputEditor&&(this._inputEditor.setValue(e?.inputText||""),e?.selections.length&&this._inputEditor.setSelections(e.selections)),!this.configurationService.getValue("chat.tools.global.autoApprove")){let o=e?.permissionLevel??"default";this._currentPermissionLevel.get()!==o&&(this._currentPermissionLevel.set(o,void 0),this.permissionLevelKey.set(o),this.permissionWidget?.refresh())}e&&this._widget?.contribs.forEach(o=>{o.setInputState?.(e.contrib)})}finally{this._isSyncingToOrFromInputModel=!1}}_syncInputStateToModel(){if(this._isSyncingToOrFromInputModel)return;this._isSyncingToOrFromInputModel=!0;let e=this.getCurrentInputState();this._chatSessionIsEmpty&&this._emptyInputState.set(e,void 0),this._inputModel?.setState(e),this._isSyncingToOrFromInputModel=!1,queueMicrotask(()=>this.inputActionsToolbar?.relayout())}setCurrentLanguageModel(e){this._currentLanguageModel.set(e,void 0),this.cachedWidth&&this.layout(this.cachedWidth),this.storageService.store(this.getSelectedModelStorageKey(),e.identifier,-1,0),this.storageService.store(this.getSelectedModelIsDefaultStorageKey(),!!e.metadata.isDefaultForLocation[this.location],-1,0),this._syncInputStateToModel()}checkModelSupported(){let e=this._currentLanguageModel.get(),t=this.getAllMergedModels();zgo(e,this.getModels(),{location:this.location,currentModeKind:this.currentModeKind,isInlineChatV2Enabled:!!this.configurationService.getValue("inlineChat.enableV2"),sessionType:this.getCurrentSessionType()},t)&&this.setCurrentLanguageModelToDefault()}setChatMode(e,t=!0){if(!this.options.supportsChangingModes)return;let o=this.chatModeService.findModeById(e)??this.chatModeService.findModeByName(e)??this.chatModeService.findModeById("agent")??Tl.Ask;this.setChatMode2(o,t)}setChatMode2(e,t=!0){this.options.supportsChangingModes&&(this._currentModeObservable.set(e,void 0),this._onDidChangeCurrentChatMode.fire(),this._syncInputStateToModel())}getAllMergedModels(){let e=this.storageService.getObject(Avo,-1,[]),t=this.languageModelsService.getLanguageModelIds().map(r=>({identifier:r,metadata:this.languageModelsService.lookupLanguageModel(r)})),o=new Set(this.languageModelsService.getVendors().map(r=>r.vendor)),n=Ggo(t,e,o);return t.length>0&&this.storageService.store(Avo,n,-1,1),n}getModels(){let e=this.getAllMergedModels();return e.sort((t,o)=>t.metadata.name.localeCompare(o.metadata.name)),Hgo(e,this.getCurrentSessionType(),this.currentModeKind,this.location,!!this.configurationService.getValue("inlineChat.enableV2"))}getCurrentSessionType(){let e=this.options.sessionTypePickerDelegate?.getActiveSessionProvider?.();if(e)return e;let t=this._widget?.viewModel?.model.sessionResource,o=t?this.chatService.getChatSessionFromInternalUri(t):void 0;return o?gl(o.chatSessionResource):void 0}hasModelsTargetingSessionType(){return q1t(this.getAllMergedModels(),this.getCurrentSessionType())}isModelValidForCurrentSession(e){return $1t(e,this.getAllMergedModels(),this.getCurrentSessionType())}checkModelInSessionPool(){let e=this._currentLanguageModel.get();e&&!this.isModelValidForCurrentSession(e)&&this.setCurrentLanguageModelToDefault()}preselectModelFromSessionHistory(){let e=this._widget?.viewModel?.model.getRequests();if(!e||e.length===0)return;let t=fd(e,s=>!!s.modeInfo)?.modeInfo;t&&t.modeInstructions?.uri&&this.setChatMode(t.modeInstructions.uri.toString());let o=fd(e,s=>!!s.modelId)?.modelId;if(!o)return;let n=()=>{let s=this.getModels(),l=s.find(c=>c.identifier===o);return l||(l=s.find(c=>c.metadata.id===o)),l},r=n();if(r){this.setCurrentLanguageModel(r);return}this._waitForPersistedLanguageModel.value=this.languageModelsService.onDidChangeLanguageModels(()=>{let s=n();s&&(this._waitForPersistedLanguageModel.clear(),this.setCurrentLanguageModel(s))})}setCurrentLanguageModelToDefault(){let e=this.getModels(),t=Ugo(e,this.location);t&&this.setCurrentLanguageModel(t)}getCurrentInputState(){let e=this._currentModeObservable.get(),t={inputText:this._inputEditor?.getValue()??"",attachments:this._attachmentModel.attachments,mode:{id:e.id,kind:e.kind},selectedModel:this._currentLanguageModel.get(),selections:this._inputEditor?.getSelections()||[],permissionLevel:this._currentPermissionLevel.get(),contrib:{}};for(let o of this._widget?.contribs||vt.empty())o.getInputState?.(t.contrib);return t}_getAriaLabel(){let e=this.configurationService.getValue("accessibility.verbosity.panelChat"),t;e&&(t=this.keybindingService.lookupKeybinding("editor.action.accessibilityHelp")?.getLabel());let o=this._currentModeObservable.get(),n=this._currentLanguageModel.get()?.metadata.name,r=n?d(7989,null,n):"",s="";if(o.isBuiltin)switch(this.currentModeKind){case"agent":s=d(7985,null);break;case"edit":s=d(7988,null);break;case"ask":default:s=d(7986,null);break}else{let l=this.currentModeObs.get();s=d(7987,null,l.label.get(),l.description.get())}return e?t?d(7978,null,s,r,t):d(7984,null,s,r):d(7983,null,s,r)}validateCurrentChatMode(){let e=this._currentModeObservable.get(),t=this.chatModeService.findModeById(e.id),o=this.configurationService.getValue("chat.agent.enabled");if(!t){this.setChatMode(o?"agent":"ask");return}if(e.kind==="agent"&&!o){this.setChatMode("ask");return}}getDefaultModeExperimentStorageKey(){return`chat.${this.options.widgetViewKindTag}.hasSetDefaultModeByExperiment`}logInputHistory(){let e=this.history.values.map(t=>JSON.stringify(t)).join(`
`);this.logService.info(`[${this.location}] Chat input history:`,e)}setVisible(e){this._onDidChangeVisibility.fire(e)}get generating(){return this._generating?.defer.p}startGenerating(){return this.logService.trace("ChatWidget#startGenerating"),this._generating?this._generating.rc++:this._generating={rc:1,defer:new Ko},Z(()=>{this.logService.trace("ChatWidget#doneGenerating"),this._generating&&!--this._generating.rc&&(this._generating.defer.complete(),this._generating=void 0)})}get element(){return this.container}async showPreviousValue(){if(this.history.isAtStart())return;let e=this.getCurrentInputState();(e.inputText||e.attachments.length)&&this.history.overlay(e),this.navigateHistory(!0)}async showNextValue(){if(this.history.isAtEnd())return;let e=this.getCurrentInputState();(e.inputText||e.attachments.length)&&this.history.overlay(e),this.navigateHistory(!1)}async restoreAttachments(e){let t=[...e];t.length>0&&(t=(await Promise.all(t.map(async o=>{if(bk(o)&&!o.value&&o.references?.length&&A.isUri(o.references[0].reference)){let n=o.references[0].reference;try{let r=n.toString(!0).startsWith("http")?await this.sharedWebExtracterService.readImage(n,Se.None):(await this.fileService.readFile(n)).value;if(!r)return;let s={...o};return s.value=bk(o)&&o.isPasted?r.buffer:await JP(r.buffer),s}catch(r){this.logService.error("Failed to fetch and reference.",r);return}}return o}))).filter(lo)),this._attachmentModel.clearAndSetContext(...t)}async navigateHistory(e){let t=e?this.history.previous():this.history.next();await this.restoreAttachments(t?.attachments??[]);let o=t?.inputText??"",n=t?.contrib??{};qr(o),this.setValue(o,!0),this._widget?.contribs.forEach(s=>{s.setInputState?.(n)}),this._onDidLoadInputState.fire();let r=this._inputEditor.getModel();r&&(e?this._inputEditor.setPosition({lineNumber:1,column:1}):this._inputEditor.setPosition(yDi(r)))}setValue(e,t){this.inputEditor.setValue(e);let o=this.inputEditor.getModel();o&&this.inputEditor.setPosition(yDi(o))}focus(){this._inputEditor.focus()}hasFocus(){return this._inputEditor.hasWidgetFocus()}focusTodoList(){return this._chatInputTodoListWidget.value?.focus()??!1}isTodoListFocused(){return this._chatInputTodoListWidget.value?.hasFocus()??!1}hasVisibleTodos(){return this._chatInputTodoListWidget.value?.hasTodos()??!1}async acceptInput(e){if(e){let t=this.getCurrentInputState();this.history.append(this._getFilteredEntry(t))}this.resetScrollbarVisibilityAfterAccept(),this._chatSessionIsEmpty&&(this._chatSessionIsEmpty=!1,this._emptyInputState.set(void 0,void 0)),this.attachmentModel.clear(),this._onDidLoadInputState.fire(),this.accessibilityService.isScreenReaderOptimized()&&Ze?this._acceptInputForVoiceover():(this._inputEditor.focus(),this._inputEditor.setValue(""))}validateAgentMode(){!this.agentService.hasToolsAgent&&this._currentModeObservable.get().kind==="agent"&&this.setChatMode("edit")}_getFilteredEntry(e){let t=e.attachments.map(o=>{if(bk(o)&&o.references?.length&&o.value){let n={...o};return n.value=void 0,n}return o});return{...e,attachments:t}}_acceptInputForVoiceover(){let e=this._inputEditor.getDomNode();e&&(e.remove(),this._inputEditor.setValue(""),this._inputEditorElement.appendChild(e),this._inputEditor.focus())}_handleAttachedContextChange(){this._hasFileAttachmentContextKey.set(!!this._attachmentModel.attachments.find(e=>e.kind==="file")),this.renderAttachedContext()}getOrCreateOptionEmitter(e){let t=this._chatSessionOptionEmitters.get(e);return t||(t=new E,this._chatSessionOptionEmitters.set(e,t)),t}getOrCreateOptionContextKey(e){if(!this._scopedContextKeyService)return;let t=this._optionContextKeys.get(e);return t||(t=new Y(`chatSessionOption.${e}`,"").bindTo(this._scopedContextKeyService),this._optionContextKeys.set(e,t)),t}updateOptionContextKey(e,t){let o=t.trim(),n=this.getOrCreateOptionContextKey(e);n&&n.set(o)}evaluateOptionGroupVisibility(e){if(!e.when||!this._scopedContextKeyService)return!0;let t=C.deserialize(e.when);return t?this._scopedContextKeyService.contextMatchesRules(t):!0}computeVisibleOptionGroups(){let e=()=>{this.chatSessionHasOptions.set(!1),this.chatSessionOptionsValid.set(!0)},t=this._widget?.viewModel?.model.sessionResource,o=t?this.chatService.getChatSessionFromInternalUri(t):void 0,n=o&&this.chatSessionsService.getCustomAgentTargetForSessionType(gl(o.chatSessionResource));this.chatSessionHasCustomAgentTarget.set(n!=="undefined");let r=o&&this.chatSessionsService.requiresCustomModelsForSessionType(gl(o.chatSessionResource));if(this.chatSessionHasTargetedModels.set(!!r),n){let h=o&&this.chatSessionsService.getChatSessionContribution(gl(o.chatSessionResource)),g=this.chatSessionsService.getSessionOption(o.chatSessionResource,YDt);if(typeof g<"u"&&!h?.useRequestToPopulateBuiltInPickers){let f=(typeof g=="string"?g:g.id)||Tl.Agent.id,v=this._currentModeObservable.get();(f===Tl.Agent.id?v.id!==Tl.Agent.id:v.label.get()!==f)&&this.setChatMode(f)}}let l=this.options.sessionTypePickerDelegate?.getActiveSessionProvider?.()??(o?gl(o.chatSessionResource):void 0);if(!l){e();return}let c=this.chatSessionsService.getOptionGroupsForSessionType(l);if(!c||c.length===0){e();return}if(o)for(let h of c){let g=this.chatSessionsService.getSessionOption(o.chatSessionResource,h.id);if(g){let f=typeof g=="string"?g:g.id;this.updateOptionContextKey(h.id,f)}}let u=new Set;for(let h of c){let g=h.items.length>0||(h.commands||[]).length>0,f=this.evaluateOptionGroupVisibility(h),v=!o||this.chatSessionsService.getSessionOption(o.chatSessionResource,h.id)!==void 0;g&&f&&v&&u.add(h.id)}if(u.size===0){e();return}let p=!0;if(o)for(let h of u){let g=c.find(v=>v.id===h),f=this.chatSessionsService.getSessionOption(o.chatSessionResource,h);if(g&&f){let v=typeof f=="string"?f:f.id;if(!g.items.some(b=>b.id===v)&&typeof f=="string"){p=!1;break}}}return this.chatSessionHasOptions.set(!0),this.chatSessionOptionsValid.set(p),{visibleGroupIds:u,optionGroups:c,ctx:o,effectiveSessionType:l}}refreshChatSessionPickers(){let e=this.computeVisibleOptionGroups();if(!e){this.hideAllSessionPickerWidgets();return}let{visibleGroupIds:t,optionGroups:o,ctx:n}=e,r=new Set(this.chatSessionPickerWidgets.keys());if((r.size!==t.size||!Array.from(t).every(l=>r.has(l)))&&this._lastSessionPickerAction&&this.chatSessionPickerContainer){let l=this.createChatSessionPickerWidgets(this._lastSessionPickerAction,this._lastSessionPickerOptions);Rt(this.chatSessionPickerContainer);for(let c of l){let u=_(".action-item.chat-sessionPicker-item");c.render(u),this.chatSessionPickerContainer.appendChild(u)}}if(this.chatSessionPickerContainer&&(this.chatSessionPickerContainer.style.display=""),n)for(let[l]of this.chatSessionPickerWidgets){let c=this.chatSessionsService.getSessionOption(n.chatSessionResource,l);if(c){let u=o.find(p=>p.id===l);if(u){let p=typeof c=="string"?c:c.id,h=u.items.find(g=>g.id===p);h&&typeof c=="string"?this.getOrCreateOptionEmitter(l).fire(h):typeof c!="string"&&this.getOrCreateOptionEmitter(l).fire(c)}}}}hideAllSessionPickerWidgets(){this.chatSessionPickerContainer&&(this.chatSessionPickerContainer.style.display="none")}getCurrentOptionForGroup(e){let t=this._widget?.viewModel?.model.sessionResource;if(!t)return;let o=this.chatService.getChatSessionFromInternalUri(t);if(!o||this.chatSessionsService.getSessionOption(o.chatSessionResource,e)===void 0)return;let n=this.getEffectiveSessionType(o,this.options.sessionTypePickerDelegate),s=this.chatSessionsService.getOptionGroupsForSessionType(n)?.find(c=>c.id===e);if(!s||s.items.length===0)return;let l=this.chatSessionsService.getSessionOption(o.chatSessionResource,e);if(!l)return s.items.find(u=>u.default);if(typeof l=="string"){let c=l.trim();return s.items.find(u=>u.id===c)}else return l}getEffectiveSessionType(e,t){return this.options.sessionTypePickerDelegate?.getActiveSessionProvider?.()||e&&gl(e.chatSessionResource)||""}updateAgentSessionTypeContextKey(){let e=this._widget?.viewModel?.model.sessionResource,t=this.options.sessionTypePickerDelegate,n=t?.setActiveSessionProvider&&t?.getActiveSessionProvider?.()||(e?gl(e):"");this.agentSessionTypeKey.set(n),this.chatSessionSupportsDelegationKey.set(this.chatSessionsService.supportsDelegationForSessionType(n))}updateWidgetLockStateFromSessionType(e){if(e===sc){this._widget?.unlockFromCodingAgent();return}let t=this.chatSessionsService.getChatSessionContribution(e);t?this._widget?.lockToCodingAgent(t.name,t.displayName,t.type):this._widget?.unlockFromCodingAgent()}tryUpdateWidgetController(){let e=this._widget?.viewModel?.model.sessionResource;if(!e)return;let t=this.options.sessionTypePickerDelegate;if(!((t?.setActiveSessionProvider&&t?.getActiveSessionProvider?.()||this._pendingDelegationTarget||gl(e))===sc)){this._widgetController.clear();return}this._widgetController.value||(this._widgetController.value=this.instantiationService.createInstance(LNe,this.chatInputWidgetsContainer))}showContextUsageDetails(){return this.contextUsageWidget?.showDetails()??!1}updateContextUsageWidget(){this._contextUsageDisposables.clear();let e=this._widget?.viewModel?.model;if(!e||!this.contextUsageWidget)return;let t=new N;this._contextUsageDisposables.value=t,t.add(e.onDidChange(o=>{(o.kind==="addRequest"||o.kind==="completedRequest")&&this.contextUsageWidget?.update(e.lastRequest)})),this.contextUsageWidget.update(e.lastRequest)}render(e,t,o){this._widget=o,this.computeVisibleOptionGroups();let n=this.options.sessionTypePickerDelegate;if(n?.setActiveSessionProvider&&n?.getActiveSessionProvider){let H=n.getActiveSessionProvider();H&&this.updateWidgetLockStateFromSessionType(H)}this._register(o.onDidChangeViewModel(H=>{this._pendingDelegationTarget=void 0,this.updateAgentSessionTypeContextKey(),this.refreshChatSessionPickers(),this.tryUpdateWidgetController(),this.updateContextUsageWidget();let G=!1;if(H.currentSessionResource){for(let J of this._questionCarouselSessionResources.values())if(Qe(J,H.currentSessionResource)){G=!0;break}}this._questionCarouselSessionResources.size>0&&(!H.currentSessionResource||!G)&&this.clearQuestionCarousel();let $=this.getCurrentSessionType();H.currentSessionResource&&$!==this._currentSessionType&&(this._currentSessionType=$,this.initSelectedModel(),this.checkModelInSessionPool()),this.preselectModelFromSessionHistory()}));let r;this.options.renderStyle==="compact"?r=ct(".interactive-input-part",[ct(".interactive-input-and-edit-session",[ct(".chat-question-carousel-widget-container@chatQuestionCarouselContainer"),ct(".chat-input-widgets-container@chatInputWidgetsContainer"),ct(".chat-todo-list-widget-container@chatInputTodoListWidgetContainer"),ct(".chat-artifacts-widget-container@chatArtifactsWidgetContainer"),ct(".chat-editing-session@chatEditingSessionWidgetContainer"),ct(".chat-getting-started-tip-container@chatGettingStartedTipContainer"),ct(".interactive-input-and-side-toolbar@inputAndSideToolbar",[ct(".chat-input-container@inputContainer",[ct(".chat-editor-container@editorContainer"),ct(".chat-input-toolbars@inputToolbars")])]),ct(".chat-secondary-toolbar@secondaryToolbar",[ct(".chat-context-usage-container@contextUsageWidgetContainer")]),ct(".chat-attachments-container@attachmentsContainer",[ct(".chat-attached-context@attachedContextContainer")]),ct(".interactive-input-followups@followupsContainer")])]):r=ct(".interactive-input-part",[ct(".chat-question-carousel-widget-container@chatQuestionCarouselContainer"),ct(".interactive-input-followups@followupsContainer"),ct(".chat-input-widgets-container@chatInputWidgetsContainer"),ct(".chat-todo-list-widget-container@chatInputTodoListWidgetContainer"),ct(".chat-artifacts-widget-container@chatArtifactsWidgetContainer"),ct(".chat-editing-session@chatEditingSessionWidgetContainer"),ct(".chat-getting-started-tip-container@chatGettingStartedTipContainer"),ct(".interactive-input-and-side-toolbar@inputAndSideToolbar",[ct(".chat-input-container@inputContainer",[ct(".chat-attachments-container@attachmentsContainer",[ct(".chat-attached-context@attachedContextContainer")]),ct(".chat-editor-container@editorContainer"),ct(".chat-input-toolbars@inputToolbars")])]),ct(".chat-secondary-toolbar@secondaryToolbar",[ct(".chat-context-usage-container@contextUsageWidgetContainer")])]),this.container=r.root,this.chatInputOverlay=_(".chat-input-overlay"),e.append(this.container),this.container.append(this.chatInputOverlay),this.container.classList.toggle("compact",this.options.renderStyle==="compact"),this._scopedContextKeyService=this._register(this.contextKeyService.createScoped(this.container)),this.followupsContainer=r.followupsContainer;let s=r.inputAndSideToolbar,l=r.inputContainer;this.inputContainer=l;let c=r.editorContainer;this.attachmentsContainer=r.attachmentsContainer,this.attachedContextContainer=r.attachedContextContainer;let u=r.inputToolbars;this.secondaryToolbarContainer=r.secondaryToolbar,this.options.renderStyle==="compact"&&(this.secondaryToolbarContainer.style.display="none"),this.chatEditingSessionWidgetContainer=r.chatEditingSessionWidgetContainer,this.chatInputTodoListWidgetContainer=r.chatInputTodoListWidgetContainer,this.chatArtifactsWidgetContainer=r.chatArtifactsWidgetContainer,this.chatGettingStartedTipContainer=r.chatGettingStartedTipContainer,this.chatGettingStartedTipContainer.style.display="none",this.chatQuestionCarouselContainer=r.chatQuestionCarouselContainer,this.chatInputWidgetsContainer=r.chatInputWidgetsContainer,this.contextUsageWidgetContainer=r.contextUsageWidgetContainer,(this.options.isSessionsWindow||this.options.renderStyle==="compact")&&u.prepend(this.contextUsageWidgetContainer),this.contextUsageWidget=this._register(this.instantiationService.createInstance(PG)),this.contextUsageWidgetContainer.appendChild(this.contextUsageWidget.domNode),this.options.enableImplicitContext&&!this._implicitContext?(this._implicitContext=this._register(this.instantiationService.createInstance(Azt)),this.setImplicitContextEnablement(),this._register(this._implicitContext.onDidChangeValue(()=>{this._indexOfLastAttachedContextDeletedWithKeyboard=-1,this._handleAttachedContextChange()}))):!this.options.enableImplicitContext&&this._implicitContext&&(this._implicitContext?.dispose(),this._implicitContext=void 0),this.tryUpdateWidgetController(),this._register(this._attachmentModel.onDidChange(H=>{H.added.length>0&&(this._indexOfLastAttachedContextDeletedWithKeyboard=-1),this._handleAttachedContextChange()})),this.renderChatEditingSessionState(null),this.dnd.addOverlay(this.options.dndContainer??e,this.options.dndContainer??e);let p=this._register(this.contextKeyService.createScoped(l));ie.inChatInput.bindTo(p).set(!0),this.currentlyEditingInputKey=ie.currentlyEditingInput.bindTo(p),this.editingSentRequestKey=ie.editingRequestType.bindTo(this.contextKeyService);let h=this._register(this.instantiationService.createChild(new _o([X,p]))),{historyNavigationBackwardsEnablement:g,historyNavigationForwardsEnablement:f}=this._register(XV(p,this));this.historyNavigationBackwardsEnablement=g,this.historyNavigationForewardsEnablement=f;let v=Vb(this.configurationService);v.overflowWidgetsDomNode=this.options.editorOverflowWidgetsDomNode,v.pasteAs=iS.pasteAs.defaultValue,v.readOnly=!1,v.ariaLabel=this._getAriaLabel(),v.fontFamily=NO,v.fontSize=13,v.lineHeight=Pvo,v.padding=this.options.renderStyle==="compact"?eKt.compact:eKt.default,v.cursorWidth=1,v.wrappingStrategy="advanced",v.bracketPairColorization={enabled:!1},v.autoClosingBrackets=this.configurationService.getValue("editor.autoClosingBrackets"),v.autoClosingQuotes=this.configurationService.getValue("editor.autoClosingQuotes"),v.autoSurround=this.configurationService.getValue("editor.autoSurround"),v.suggest={showIcons:!0,showSnippets:!1,showWords:!0,showStatusBar:!1,insertMode:"insert"},v.scrollbar=this.options.renderStyle==="compact"?{...v.scrollbar??{},vertical:"hidden"}:{...v.scrollbar??{},vertical:"auto",verticalScrollbarSize:7},v.stickyScroll={enabled:!1},this._inputEditorElement=M(c,UNe(Nvo));let b=BMe();b.contributions?.push(...Ba.getSomeEditorContributions([Pl.ID,ff.ID,fh.ID,ku.ID,dk.ID])),this._inputEditor=this._register(h.createInstance(Xr,this._inputEditorElement,v,b)),nc.get(this._inputEditor)?.forceRenderingAbove(),v.overflowWidgetsDomNode?.classList.add("hideSuggestTextIcons"),this._inputEditorElement.classList.add("hideSuggestTextIcons"),this._register(this._inputEditor.onKeyDown(H=>{if(H.keyCode===3&&!Mht(H))for(let G of this.keybindingService.lookupKeybindings(BT.ID)){let $=G.getDispatchChords();if($.length===1&&$[0]==="[Enter]"){H.preventDefault();break}}})),this._register(this._inputEditor.onDidChangeModelContent(()=>{let H=Math.min(this._inputEditor.getContentHeight(),this._effectiveInputEditorMaxHeight);H!==this.inputEditorHeight&&(this.inputEditorHeight=H,this.cachedWidth&&this._layout(this.cachedWidth));let G=this._inputEditor.getModel(),$=!!G&&G.getValue().trim().length>0;this.inputEditorHasText.set($),this._syncTextDebounced.schedule()})),this._register(this._inputEditor.onDidContentSizeChange(H=>{H.contentHeightChanged&&(this.inputEditorHeight=this.inline?this.inputEditorHeight:H.contentHeight,this.cachedWidth&&this._layout(this.cachedWidth))})),this._register(this._inputEditor.onDidFocusEditorText(()=>{this.inputEditorHasFocus.set(!0),this._onDidFocus.fire(),l.classList.toggle("focused",!0)})),this._register(this._inputEditor.onDidBlurEditorText(()=>{this.inputEditorHasFocus.set(!1),l.classList.toggle("focused",!1),this._onDidBlur.fire()})),this._register(this._inputEditor.onDidBlurEditorWidget(()=>{ku.get(this._inputEditor)?.clearWidgets(),fh.get(this._inputEditor)?.clearWidgets()}));let S=this._register(Qh()),{location:y,isMaximized:w}=this.getWidgetLocationInfo(o),k={getOverflowAnchor:()=>this.inputActionsToolbar.getElement(),actionContext:{widget:o},hideChevrons:ke(H=>this._stableInputPartWidth.read(H)<Stn),hoverPosition:{forcePosition:!0,hoverPosition:y==="sidebarRight"&&!w?0:1}};this._register(Jo(u,re.CLICK,H=>this.inputEditor.focus())),this._register(Jo(this.attachmentsContainer,re.CLICK,H=>this.inputEditor.focus()));let T=new Set([Ute.ID,nge.ID]);if(this.inputActionsToolbar=this._register(this.instantiationService.createInstance(or,this.options.renderInputToolbarBelowInput?this.attachmentsContainer:u,D.ChatInput,{telemetrySource:this.options.menus.telemetrySource,menuOptions:{shouldForwardArgs:!0},hiddenItemStrategy:-1,hoverDelegate:S,responsiveBehavior:{enabled:!0,kind:"last",minItems:1,actionMinWidth:48,getActionMinWidth:H=>T.has(H.id)?22:void 0},actionViewItemProvider:(H,G)=>{if(H.id===Khe.ID&&H instanceof Lo){this._currentLanguageModel||this.setCurrentLanguageModelToDefault();let $={currentModel:this._currentLanguageModel,setModel:J=>{this._waitForPersistedLanguageModel.clear(),this.setCurrentLanguageModel(J),this.renderAttachedContext()},getModels:()=>this.getModels(),useGroupedModelPicker:()=>{let J=this.getCurrentSessionType();return!J||J===sc},showManageModelsAction:()=>{let J=this.getCurrentSessionType();return!J||J===sc},showUnavailableFeatured:()=>{let J=this.getCurrentSessionType();return!J||J===sc},showFeatured:()=>{let J=this.getCurrentSessionType();return!J||J===sc}};return this.modelWidget=this.instantiationService.createInstance(WNe,H,$,k)}else if(H.id===Ute.ID&&H instanceof Lo){let $={currentMode:this._currentModeObservable,sessionResource:()=>this._widget?.viewModel?.sessionResource,customAgentTarget:()=>{let J=this._widget?.viewModel?.model.sessionResource,ae=J&&this.chatService.getChatSessionFromInternalUri(J);return(ae&&this.chatSessionsService.getCustomAgentTargetForSessionType(gl(ae.chatSessionResource)))??"undefined"}};return this.modeWidget=this.instantiationService.createInstance(MNe,H,$,k)}else if((H.id===zte.ID||H.id===oNe.ID)&&H instanceof Lo){let $=()=>{let oe=this._widget?.viewModel?.sessionResource;return oe?lg(oe)??gl(oe):void 0},J=this.options.sessionTypePickerDelegate??{getActiveSessionProvider:()=>$(),getPendingDelegationTarget:()=>this._pendingDelegationTarget,setPendingDelegationTarget:oe=>{let de=$()===oe;this._pendingDelegationTarget=de?void 0:oe,this.updateWidgetLockStateFromSessionType(oe),this.updateAgentSessionTypeContextKey(),this.refreshChatSessionPickers()}},ae=!!this.options.sessionTypePickerDelegate?.setActiveSessionProvider,he=H.id===zte.ID||ae?X8:ege;return this.sessionTargetWidget=this.instantiationService.createInstance(he,H,y==="editor"?"editor":"sidebar",J,k)}else{if(H.id===nNe.ID&&H instanceof Lo)return this.workspaceContextService.getWorkbenchState()===1&&this.options.workspacePickerDelegate?this.instantiationService.createInstance(tge,H,this.options.workspacePickerDelegate,k):new tKt(H);if(H.id===qit.ID&&H instanceof Lo){let $=this.createChatSessionPickerWidgets(H,k);return $.length===0?new tKt(H):this.instantiationService.createInstance(wDi,H,$)}}}})),this.inputActionsToolbar.getElement().classList.add("chat-input-toolbar"),this.inputActionsToolbar.context={widget:o},this._register(this.inputActionsToolbar.onDidChangeMenuItems(()=>{let G=this.inputActionsToolbar.getElement().querySelector(".chat-sessionPicker-container");this.chatSessionPickerContainer=G,this.cachedWidth&&typeof this.cachedInputToolbarWidth=="number"&&this.cachedInputToolbarWidth!==this.inputActionsToolbar.getItemsWidth()&&this._toolbarRelayoutScheduler.schedule()})),this._register(be(H=>{k.hideChevrons.read(H),queueMicrotask(()=>this.inputActionsToolbar.relayout())})),this.executeToolbar=this._register(this.instantiationService.createInstance(or,u,this.options.menus.executeToolbar,{telemetrySource:this.options.menus.telemetrySource,menuOptions:{shouldForwardArgs:!0},hoverDelegate:S,hiddenItemStrategy:-1})),this.executeToolbar.getElement().classList.add("chat-execute-toolbar"),this.executeToolbar.context={widget:o},this._register(this.executeToolbar.onDidChangeMenuItems(()=>{this.cachedWidth&&typeof this.cachedExecuteToolbarWidth=="number"&&this.cachedExecuteToolbarWidth!==this.executeToolbar.getItemsWidth()&&this._toolbarRelayoutScheduler.schedule()})),this.options.menus.inputSideToolbar){let H=this._register(this.instantiationService.createInstance(or,s,this.options.menus.inputSideToolbar,{telemetrySource:this.options.menus.telemetrySource,menuOptions:{shouldForwardArgs:!0},hoverDelegate:S}));this.inputSideToolbarContainer=H.getElement(),H.getElement().classList.add("chat-side-toolbar"),H.context={widget:o}}this.secondaryToolbar=this._register(this.instantiationService.createInstance(or,this.secondaryToolbarContainer,D.ChatInputSecondary,{telemetrySource:this.options.menus.telemetrySource,menuOptions:{shouldForwardArgs:!0},hiddenItemStrategy:-1,hoverDelegate:S,actionViewItemProvider:(H,G)=>{if((H.id===zte.ID||H.id===oNe.ID)&&H instanceof Lo){let $=()=>{let oe=this._widget?.viewModel?.sessionResource;return oe?lg(oe)??gl(oe):void 0},J=this.options.sessionTypePickerDelegate??{getActiveSessionProvider:()=>$(),getPendingDelegationTarget:()=>this._pendingDelegationTarget,setPendingDelegationTarget:oe=>{let de=$()===oe;this._pendingDelegationTarget=de?void 0:oe,this.updateWidgetLockStateFromSessionType(oe),this.updateAgentSessionTypeContextKey(),this.refreshChatSessionPickers()}},ae=!!this.options.sessionTypePickerDelegate?.setActiveSessionProvider,he=H.id===zte.ID||ae?X8:ege;return this.sessionTargetWidget=this.instantiationService.createInstance(he,H,y==="editor"?"editor":"sidebar",J,k)}else if(H.id===nNe.ID&&H instanceof Lo){if(this.workspaceContextService.getWorkbenchState()===1&&this.options.workspacePickerDelegate)return this.instantiationService.createInstance(tge,H,this.options.workspacePickerDelegate,k);{let $=new wl(void 0,H);return $.element&&($.element.style.display="none"),$}}else if(H.id===Git.ID&&H instanceof Lo){let $={currentPermissionLevel:this._currentPermissionLevel,setPermissionLevel:J=>{this.setPermissionLevel(J)}};return this.permissionWidget=this.instantiationService.createInstance(PNe,H,$,k)}}})),this.secondaryToolbar.getElement().classList.add("chat-secondary-input-toolbar"),this.secondaryToolbar.context={widget:o};let P=this.modelService.getModel(this.inputUri);if(P||(P=this.modelService.createModel("",null,this.inputUri,!0)),this.textModelResolverService.createModelReference(this.inputUri).then(H=>{if(this._store.isDisposed){H.dispose();return}this._register(H)}),this.inputModel=P,this.inputModel.updateOptions({bracketColorizationOptions:{enabled:!1,independentColorPoolPerBracketType:!1}}),this._inputEditor.setModel(this.inputModel),t){this.inputModel.setValue(t);let H=this.inputModel.getLineCount();this._inputEditor.setPosition({lineNumber:H,column:this.inputModel.getLineMaxColumn(H)})}let O=()=>{let H=this._inputEditor.getModel();if(!H)return;let G=this._inputEditor.getPosition();if(!G)return;let $=G.lineNumber===1&&G.column===1;this.chatCursorAtTop.set($),this.historyNavigationBackwardsEnablement.set($),this.historyNavigationForewardsEnablement.set(G.equals(yDi(H))),this._syncInputStateToModel()};this._register(this._inputEditor.onDidChangeCursorPosition(H=>O())),O(),this._register(this.themeService.onDidFileIconThemeChange(()=>{this.renderAttachedContext()})),this.renderAttachedContext();let V=this._register(new WL(()=>{let H=this.container.offsetHeight;this.height.set(H,void 0)}));if(this._register(V.observe(this.container)),this.options.renderStyle==="compact"){let H=this._register(new WL(()=>{this.cachedWidth&&this.layout(this.cachedWidth)}));this._register(H.observe(u))}}toggleChatInputOverlay(e){this.chatInputOverlay.classList.toggle("disabled",e),e?this.overlayClickListener.value=Jo(this.chatInputOverlay,re.CLICK,t=>{t.preventDefault(),t.stopPropagation(),this._onDidClickOverlay.fire()}):this.overlayClickListener.clear()}renderAttachedContext(){let e=this.attachedContextContainer,t=new N;this.attachedContextDisposables.value=t,Rt(e),t.add(Jo(this.attachmentsContainer,re.KEY_DOWN,u=>{this.handleAttachmentNavigation(u)}));let o=[...this.attachmentModel.attachments.entries()],n=!!o.length,r=!1,l=this.configurationService.getValue("chat.implicitContext.suggestedContext")?this._implicitContext?.hasValue??!1:this._implicitContext?.values.some(u=>u.enabled||u.isSelection)??!1;if(this._implicitContext&&l){let u=(h,g,f)=>this._attachmentModel.attachments.some(v=>{let b=A.isUri(v.value)?v.value:lf(v.value)?v.value.uri:void 0,S=lf(v.value)?v.value.range:void 0;return f!==void 0&&LK(v)&&v.handle===f?!0:h&&b&&Qe(h,b)?g&&S?z.equalsRange(g,S):!g&&!S:!1}),p=this.instantiationService.createInstance(INe,()=>this._widget,u,this._implicitContext,this._contextResourceLabels,this._attachmentModel,e);t.add(p),r=p.hasRenderedContexts}hh(!!(this.options.renderInputToolbarBelowInput||n||r),this.attachmentsContainer),hh(n||r,this.attachedContextContainer),o.length||(this._indexOfLastAttachedContextDeletedWithKeyboard=-1,this._indexOfLastOpenedContext=-1);let c=o.filter(([,u])=>bk(u));if(c.length>ZX){let u=c.length-ZX;for(let p=0;p<u;p++){let h=c[p][1];(h.omittedState===0||h.omittedState===3)&&(h.omittedState=3)}for(let p=u;p<c.length;p++)c[p][1].omittedState===3&&(c[p][1].omittedState=0)}else for(let[,u]of c)u.omittedState===3&&(u.omittedState=0);for(let[u,p]of o){let h=A.isUri(p.value)?p.value:lf(p.value)?p.value.uri:void 0,g=lf(p.value)?p.value.range:void 0,f=u===Math.min(this._indexOfLastAttachedContextDeletedWithKeyboard,this.attachmentModel.size-1)&&this._indexOfLastAttachedContextDeletedWithKeyboard>-1,v,b={shouldFocusClearButton:f,supportsDeletion:!0},S=this._currentLanguageModel.get();p.kind==="tool"||p.kind==="toolset"?v=this.instantiationService.createInstance(oie,p,S,b,e,this._contextResourceLabels):h&&cLt(p)?v=this.instantiationService.createInstance(nie,h,p,S,b,e,this._contextResourceLabels):lD(p)?v=this.instantiationService.createInstance(tie,p,S,b,e,this._contextResourceLabels):RK(p)?v=this.instantiationService.createInstance(iie,p,void 0,b,e,this._contextResourceLabels):h&&(p.kind==="file"||p.kind==="directory")?v=this.instantiationService.createInstance(Yte,h,g,p,void 0,S,b,e,this._contextResourceLabels):p.kind==="terminalCommand"?v=this.instantiationService.createInstance(Xte,p,S,b,e,this._contextResourceLabels):bk(p)?v=this.instantiationService.createInstance(Jte,h,p,S,b,e,this._contextResourceLabels):dLt(p)?v=this.instantiationService.createInstance(rie,p,S,b,e,this._contextResourceLabels):lLt(p)?v=this.instantiationService.createInstance(Zte,p,S,b,e,this._contextResourceLabels):uLt(p)?v=this.instantiationService.createInstance(sie,p,S,b,e,this._contextResourceLabels):pLt(p)?v=this.instantiationService.createInstance(aie,p,S,b,e,this._contextResourceLabels):mLt(p)?v=this.instantiationService.createInstance(lie,p,S,b,e,this._contextResourceLabels):v=this._chatAttachmentWidgetRegistry.createWidget(p,b,e)??this.instantiationService.createInstance(eie,h,g,p,void 0,S,b,e,this._contextResourceLabels),f&&v.element.focus(),u===Math.min(this._indexOfLastOpenedContext,this.attachmentModel.size-1)&&v.element.focus(),t.add(v),t.add(v.onDidDelete(y=>{this.handleAttachmentDeletion(y,u,p)})),t.add(v.onDidOpen(y=>{this.handleAttachmentOpen(u,p)}))}this._indexOfLastOpenedContext=-1}handleAttachmentDeletion(e,t,o){if(xg(e)&&(this._indexOfLastAttachedContextDeletedWithKeyboard=t),this._attachmentModel.delete(o.id),this.configurationService.getValue("chat.implicitContext.enableImplicitContext"))for(let n of this._implicitContext?.values||[]){let r=A.isUri(n?.value)&&A.isUri(o.value)&&Qe(n.value,o.value);n?.isFile&&r&&(n.enabled=!1)}this._attachmentModel.size===0&&this.focus(),this._onDidChangeContext.fire({removed:[o]}),this.renderAttachedContext()}handleAttachmentOpen(e,t){this._indexOfLastOpenedContext=e,this._indexOfLastAttachedContextDeletedWithKeyboard=-1,this._attachmentModel.size===0&&this.focus()}handleAttachmentNavigation(e){if(!e.equals(15)&&!e.equals(17))return;let t=Array.from(this.attachedContextContainer.querySelectorAll(".chat-attached-context-attachment"));if(!t.length)return;let o=Re(this.attachmentsContainer).document.activeElement,n=t.findIndex(s=>s===o),r=n;e.equals(15)?r=n>0?n-1:t.length-1:e.equals(17)&&(r=n<t.length-1?n+1:0),r!==-1&&(t[r].focus(),e.preventDefault(),e.stopPropagation())}async renderChatTodoListWidget(e){if(this.configurationService.getValue("chat.tools.todos.showWidget")!==!1){if(!this._chatInputTodoListWidget.value){let o=this._chatEditingTodosDisposables.add(this.instantiationService.createInstance(TNe));this._chatInputTodoListWidget.value=o,Rt(this.chatInputTodoListWidgetContainer),M(this.chatInputTodoListWidgetContainer,o.domNode)}this._chatInputTodoListWidget.value.render(e)}}clearTodoListWidget(e,t){this._chatInputTodoListWidget.value?.clear(e,t)}renderArtifactsWidget(e){if(this.configurationService.getValue("chat.artifacts.enabled")){if(!this._chatArtifactsWidget.value){let t=this._register(this.instantiationService.createInstance(RG));this._chatArtifactsWidget.value=t,Rt(this.chatArtifactsWidgetContainer),M(this.chatArtifactsWidgetContainer,t.domNode)}this._chatArtifactsWidget.value.render(e)}}clearArtifactsWidget(){this._chatArtifactsWidget.value?.hide()}renderQuestionCarousel(e,t,o){let n=e.resolveId??`${Ui(t.element)?t.element.requestId:""}_${t.contentIndex}`,r=this._chatQuestionCarouselWidgets.get(n);if(r)return r;Ui(t.element)&&(this._questionCarouselResponseIds.set(n,t.element.requestId),this._questionCarouselSessionResources.set(n,t.element.sessionResource));let s=this.instantiationService.createInstance($8,e,t,o);return this._chatQuestionCarouselWidgets.set(n,s),this._hasQuestionCarouselContextKey?.set(!0),M(this.chatQuestionCarouselContainer,s.domNode),s}clearQuestionCarousel(e,t){if(t!==void 0){let o=this._chatQuestionCarouselWidgets.get(t);o&&(o.domNode.remove(),this._chatQuestionCarouselWidgets.deleteAndDispose(t)),this._questionCarouselResponseIds.delete(t),this._questionCarouselSessionResources.delete(t)}else if(e!==void 0){for(let[o,n]of this._questionCarouselResponseIds)if(n===e){let r=this._chatQuestionCarouselWidgets.get(o);r&&(r.domNode.remove(),this._chatQuestionCarouselWidgets.deleteAndDispose(o)),this._questionCarouselResponseIds.delete(o),this._questionCarouselSessionResources.delete(o)}}else this._chatQuestionCarouselWidgets.clearAndDisposeAll(),this._questionCarouselResponseIds.clear(),this._questionCarouselSessionResources.clear(),Rt(this.chatQuestionCarouselContainer);this._hasQuestionCarouselContextKey?.set(this._chatQuestionCarouselWidgets.size>0)}get questionCarousel(){for(let e of this._chatQuestionCarouselWidgets.values())if(e.hasFocus())return e;return this._chatQuestionCarouselWidgets.size>0?this._chatQuestionCarouselWidgets.values().next().value:void 0}focusQuestionCarousel(){let e=this.questionCarousel;return e?(e.focus(),!0):!1}isQuestionCarouselFocused(){for(let e of this._chatQuestionCarouselWidgets.values())if(e.hasFocus())return!0;return!1}navigateToPreviousQuestion(){return this.questionCarousel?.navigateToPreviousQuestion()??!1}navigateToNextQuestion(){return this.questionCarousel?.navigateToNextQuestion()??!1}setWorkingSetCollapsed(e){this._workingSetCollapsed.set(e,void 0)}renderChatEditingSessionState(e){hh(!!e,this.chatEditingSessionWidgetContainer),e&&(Qe(e.chatSessionResource,this._lastEditingSessionResource)||this._workingSetCollapsed.set(!0,void 0),this._lastEditingSessionResource=e.chatSessionResource);let t=Os({equalsFn:$i},l=>{let c=e?.chatSessionResource??this._widget?.viewModel?.model.sessionResource;return c&&gl(c)==="copilotcli"?[]:e?.entries.read(l).filter(u=>u.state.read(l)===0)||[]}),o=ke(l=>{let c=new En,u=[];for(let p of t.read(l))if(p.state.read(l)===0&&!c.has(p.modifiedURI)){c.add(p.modifiedURI);let h=p.linesAdded?.read(l),g=p.linesRemoved?.read(l);u.push({reference:p.modifiedURI,state:0,kind:"reference",options:{status:void 0,diffMeta:{added:h??0,removed:g??0},isDeletion:!!p.isDeletion,originalUri:p.isDeletion?p.originalURI:void 0}})}return u.sort((p,h)=>p.kind==="reference"&&h.kind==="reference"?p.state===h.state||p.state===void 0||h.state===void 0?p.reference.toString().localeCompare(h.reference.toString()):p.state-h.state:0),u}),n=ui(this,this.agentSessionsService.model.onDidChangeSessions,()=>{let l=this._widget?.viewModel?.model?.sessionResource;if(!l)return vt.empty();let c=this.agentSessionsService.getSession(l);return c?.changes instanceof Array?c.changes:vt.empty()}),r=ke(l=>n.read(l).map(c=>({reference:_eo(c)?c.modifiedUri??c.uri:c.modifiedUri,state:1,kind:"reference",options:{diffMeta:{added:c.insertions,removed:c.deletions},isDeletion:c.modifiedUri===void 0,originalUri:c.originalUri,status:void 0}}))),s=ke(l=>o.read(l).length>0||r.read(l).length>0);this._renderingChatEdits.value=be(l=>{this.options.renderWorkingSet&&s.read(l)?this.renderChatEditingSessionWithEntries(l.store,e,o,r):(Rt(this.chatEditingSessionWidgetContainer),this._chatEditsDisposables.clear(),this._chatEditList=void 0)})}renderChatEditingSessionWithEntries(e,t,o,n){let r=this.chatEditingSessionWidgetContainer.querySelector(".chat-editing-session-container.show-file-icons")??M(this.chatEditingSessionWidgetContainer,UNe(".chat-editing-session-container.show-file-icons")),s=r.querySelector(".chat-editing-session-overview")??M(r,UNe(".chat-editing-session-overview")),l=s.querySelector(".working-set-title")??M(s,UNe(".working-set-title"));this._chatEditsActionsDisposables.clear();let c=s.querySelector(".chat-editing-session-actions")??M(s,UNe(".chat-editing-session-actions")),u=t?.chatSessionResource||this._widget?.viewModel?.model.sessionResource,p=this._chatEditsActionsDisposables.add(this.contextKeyService.createScoped(c));u&&p.createKey(ie.agentSessionType.key,gl(u)),this._chatEditsActionsDisposables.add(Vd(ie.hasAgentSessionChanges,p,w=>!!n.read(w)?.length));let h=this._chatEditsActionsDisposables.add(this.instantiationService.createChild(new _o([X,p]))),g=r.querySelector(".chat-editing-session-list")??M(r,UNe(".chat-editing-session-list")),f=this._chatEditsActionsDisposables.add(new mR(l,{supportIcons:!0,secondary:!0,ariaLabel:d(7982,null)})),v=ke(w=>{let k=o.read(w),T=n.read(w),P=0,O=0;if(k.length>0)for(let $ of k)$.kind==="reference"&&$.options?.diffMeta&&(P+=$.options.diffMeta.added,O+=$.options.diffMeta.removed);else for(let $ of T)$.kind==="reference"&&$.options?.diffMeta&&(P+=$.options.diffMeta.added,O+=$.options.diffMeta.removed);let V=k.length>0?k.length:T.length,H=k.length===0&&T.length>0,G=k.length>0||T.length>0;return{files:V,added:P,removed:O,shouldShowEditingSession:G,topLevelIsSessionMenu:H}}),b=v.map(w=>w.topLevelIsSessionMenu);e.add(be(w=>{let k=b.read(w);w.store.add(h.createInstance(LG,c,k?D.ChatEditingSessionChangesToolbar:D.ChatEditingWidgetToolbar,{telemetrySource:this.options.menus.telemetrySource,small:!0,menuOptions:u?k?{args:[u,this.agentSessionsService.getSession(u)?.metadata]}:{arg:{$mid:19,sessionResource:u}}:void 0,disableWhileRunning:k,buttonConfigProvider:T=>{if(T.id===Hhe.ID||T.id===Uhe.Id||T.id===zit.ID)return{showIcon:!0,showLabel:!1,isSecondary:!0}}}))})),e.add(be(w=>{let{files:k,added:T,removed:P,shouldShowEditingSession:O}=v.read(w),V=k===1?d(7981,null):d(7980,null,k);f.label=V,f.element.setAttribute("aria-label",d(7979,null,V,T,P)),this._workingSetLinesAddedSpan.value.textContent=`+${T}`,this._workingSetLinesRemovedSpan.value.textContent=`-${P}`,hh(O,this.chatEditingSessionWidgetContainer)}));let S=_(".working-set-line-counts");f.element.appendChild(S),S.appendChild(this._workingSetLinesAddedSpan.value),S.appendChild(this._workingSetLinesRemovedSpan.value);let y=()=>{this._workingSetCollapsed.set(!this._workingSetCollapsed.get(),void 0)};if(this._chatEditsActionsDisposables.add(f.onDidClick(y)),this._chatEditsActionsDisposables.add(j(s,"click",w=>{w.defaultPrevented||w.target.closest(".monaco-button")||y()})),this._chatEditsActionsDisposables.add(be(w=>{let k=this._workingSetCollapsed.read(w);f.icon=k?R.chevronRight:R.chevronDown,g.classList.toggle("collapsed",k)})),!this._chatEditList){this._chatEditList=this._chatEditsListPool.get();let w=this._chatEditList.object;this._chatEditsDisposables.add(this._chatEditList),this._chatEditsDisposables.add(w.onDidFocus(()=>{this._onDidFocus.fire()})),this._chatEditsDisposables.add(w.onDidOpen(async k=>{if(k.element?.kind==="reference"&&A.isUri(k.element.reference)){let T=k.element.reference,P=k.element.options?.originalUri;if(k.element.options?.isDeletion&&P){await this.editorService.openEditor({resource:P,options:k.editorOptions},k.sideBySide?In:jn);return}if(P){await this.editorService.openEditor({original:{resource:P},modified:{resource:T},options:k.editorOptions},k.sideBySide?In:jn);return}let O=t?.getEntry(T),V=await this.editorService.openEditor({resource:T,options:k.editorOptions},k.sideBySide?In:jn);V&&O?.getEditorIntegration(V).reveal(!0,k.editorOptions.preserveFocus)}})),this._chatEditsDisposables.add(j(w.getHTMLElement(),"click",k=>{this.hasFocus()||this._onDidFocus.fire()},!0)),M(g,w.getHTMLElement()),M(r,g)}e.add(be(w=>{let k=o.read(w),T=n.read(w),P=k.concat(T),H=Math.min(P.length,6)*22,G=this._chatEditList.object;G.layout(H),G.getHTMLElement().style.height=`${H}px`,G.splice(0,G.length,P)}))}async renderFollowups(e,t){this.options.renderFollowups&&(this.followupsDisposables.clear(),Rt(this.followupsContainer),e&&e.length>0&&this.followupsDisposables.add(this.instantiationService.createInstance(DNe,this.followupsContainer,e,this.location,void 0,o=>this._onDidAcceptFollowup.fire({followup:o,response:t}))))}setMaxHeight(e){this._maxHeight=e}layout(e){return this.cachedWidth=e,this._stableInputPartWidth.set(e,void 0),this._layout(e)}get _effectiveInputEditorMaxHeight(){if(this._maxHeight===void 0)return this.inputEditorMaxHeight;let e=this.previousInputEditorDimension?.height??0,t=Math.max(0,this.height.get()-e),o=this._maxHeight-t;return Math.min(this.inputEditorMaxHeight,Math.max(0,o))}_layout(e,t=!0){let o=this.getLayoutData(),n=e-o.inputPartHorizontalPadding;this.followupsContainer.style.width=`${n}px`;let r=this._inputEditor.getScrollWidth(),s=e-o.inputPartHorizontalPadding-o.editorBorder-o.inputPartHorizontalPaddingInside-o.toolbarsWidth-o.sideToolbarWidth,l=this._effectiveInputEditorMaxHeight,c=Math.min(this._inputEditor.getContentHeight(),l),u=this.inputEditorMinHeight?Math.min(Math.max(this.inputEditorMinHeight,c),l):c,p={width:s,height:u};if((!this.previousInputEditorDimension||this.previousInputEditorDimension.width!==p.width||this.previousInputEditorDimension.height!==p.height)&&(this._inputEditor.layout(p),this.previousInputEditorDimension=p),t&&r<10)return this._layout(e,!1)}getLayoutData(){let e=this.inputSideToolbarContainer?zl(this.inputSideToolbarContainer):0,t=()=>{let n=this.cachedExecuteToolbarWidth=this.executeToolbar.getItemsWidth(),r=this.cachedInputToolbarWidth=this.inputActionsToolbar.getItemsWidth(),s=(this.executeToolbar.getItemsLength()-1)*4,l=this.inputActionsToolbar.getItemsLength()?(this.inputActionsToolbar.getItemsLength()-1)*4:0,c=zl(this.contextUsageWidgetContainer);return n+s+c+(this.options.renderInputToolbarBelowInput?0:r+l+12)};return{editorBorder:2,inputPartHorizontalPadding:this.options.renderStyle==="compact"?16:24,inputPartHorizontalPaddingInside:this.options.renderStyle==="compact"?12:10,toolbarsWidth:this.options.renderStyle==="compact"?t():0,sideToolbarWidth:e>0?e+4:0}}getWidgetLocationInfo(e){if(Zde(e.viewContext))return{location:"editor",isMaximized:!1};if(py(e.viewContext)){let t=this.viewDescriptorService.getViewLocationById(e.viewContext.viewId),o=this.layoutService.getSideBarPosition();switch(t){case 1:return{location:"panel",isMaximized:this.layoutService.isPanelMaximized()};case 2:return{location:o===0?"sidebarRight":"sidebarLeft",isMaximized:this.layoutService.isAuxiliaryBarMaximized()};case 0:default:return{location:o===0?"sidebarLeft":"sidebarRight",isMaximized:!1}}}return{location:"editor",isMaximized:!1}}getDefaultScrollbarOptions(){let e=this._inputEditor.getRawOptions().scrollbar??{};return this.options.renderStyle==="compact"?{...e,vertical:"hidden"}:{...e,vertical:"auto",verticalScrollbarSize:7}}getVisibleScrollbarOptions(){let e=this._inputEditor.getRawOptions().scrollbar??{};return this.options.renderStyle==="compact"?{...e,vertical:"hidden"}:{...e,vertical:"visible",verticalScrollbarSize:7}}updateInputEditorScrollbarOptions(){this._inputEditor.updateOptions({scrollbar:this._forceVisibleScrollbarUntilAccept?this.getVisibleScrollbarOptions():this.getDefaultScrollbarOptions()})}showScrollbarUntilAccept(){this._forceVisibleScrollbarUntilAccept=!0,this.updateInputEditorScrollbarOptions()}resetScrollbarVisibilityAfterAccept(){this._forceVisibleScrollbarUntilAccept&&(this._forceVisibleScrollbarUntilAccept=!1,this.updateInputEditorScrollbarOptions())}};J8=I([m(4,Tt),m(5,F),m(6,X),m(7,B),m(8,_e),m(9,Oi),m(10,ds),m(11,se),m(12,fe),m(13,ee),m(14,Le),m(15,Bt),m(16,ce),m(17,cr),m(18,DG),m(19,yD),m(20,rr),m(21,Fg),m(22,Vn),m(23,mi),m(24,Us),m(25,ED),m(26,md),m(27,Pe),m(28,yi),m(29,Bi),m(30,sNe)],J8);function yDi(a){return{lineNumber:a.getLineCount(),column:a.getLineLength(a.getLineCount())+1}}var Nvo=".interactive-input-editor";HMe(Nvo);var wDi=class extends hs{constructor(e,t,o){super(null,e,o??{});this.widgets=t}render(e){e.classList.add("chat-sessionPicker-container");for(let t of this.widgets){let o=_(".action-item.chat-sessionPicker-item");t.render(o),e.appendChild(o)}}dispose(){for(let e of this.widgets)e.dispose();super.dispose()}},tKt=class extends wl{constructor(i){super(void 0,i)}render(i){super.render(i),i.style.display="none"}};var CDi=(a,i)=>{let e=a.get(_e),t=a.get(X),o=e.lookupKeybinding(JH,t)?.getAriaLabel(),n=e.lookupKeybinding(jit,t)?.getAriaLabel(),r=i.map(l=>{let c=l.state.get();if(c.type===Pi.StateKind.WaitingForPostApproval){let g=cD(c.resultDetails)?c.resultDetails.input:_B(c.resultDetails)?void 0:SLt(c.contentForModel);return{title:d(5619,null),detail:g}}if(!(c.type===Pi.StateKind.WaitingForConfirmation&&c.confirmationMessages?.message))return;let u="";if(l.toolSpecificData)if(l.toolSpecificData.kind==="terminal"){let g=iM(l.toolSpecificData);u=g.commandLine.toolEdited??g.commandLine.original}else l.toolSpecificData.kind==="extensions"?u=JSON.stringify(l.toolSpecificData.extensions):l.toolSpecificData.kind==="input"?u=JSON.stringify(l.toolSpecificData.rawInput):l.toolSpecificData.kind==="modifiedFilesConfirmation"&&(u=d(5605,null,l.toolSpecificData.modifiedFiles.length));let p=c.confirmationMessages?.title;return{title:((typeof p=="string"?p:p?.value||"")+(u?": "+u:"")).trim(),detail:void 0}}).filter(lo),s=o&&n?d(5618,null,r.map(l=>l.title).join(", "),o,n):d(5616,null,r.map(l=>l.title).join(", "));return r.some(l=>l.detail)&&(s+=" "+d(5617,null,r.map(l=>l.detail?l.detail:"").join(" "))),s},zNe=class{constructor(i,e){this._accessibleViewService=i;this._instantiationService=e}getWidgetRole(){return"list"}getRole(i){return"listitem"}getWidgetAriaLabel(){return d(5604,null)}getAriaLabel(i){return Sr(i)?i.messageText:Ui(i)?this._getLabelWithInfo(i):""}_getLabelWithInfo(i){let e=this._accessibleViewService.getOpenAriaHint("accessibility.verbosity.panelChat"),t="",o=i.response.value.filter(g=>g.kind==="toolInvocation"),n="";o.length&&o.filter(f=>{let v=f.state.get().type;return v===Pi.StateKind.WaitingForConfirmation||v===Pi.StateKind.WaitingForPostApproval}).length&&(n=this._instantiationService.invokeFunction(CDi,o));let r=oc.lexer(i.response.toString()).filter(g=>g.type==="table")?.length??0,s="";switch(r){case 0:break;case 1:s=d(5615,null);break;default:s=d(5609,null,r);break}let l=i.response.value.filter(g=>g.kind==="treeData").length??0,c="";switch(l){case 0:break;case 1:c=d(5614,null);break;default:c=d(5608,null,l);break}let u=i.response.value.filter(g=>g.kind==="elicitation2"||g.kind==="elicitationSerialized"),p="";for(let g of u){let f=typeof g.title=="string"?g.title:g.title.value,v=typeof g.message=="string"?g.message:g.message.value;p+=f+" "+v}let h=oc.lexer(i.response.toString()).filter(g=>g.type==="code")?.length??0;switch(h){case 0:t=e?d(5611,null,n,c,p,s,i.response.toString(),e):d(5610,null,c,p,s,i.response.toString());break;case 1:t=e?d(5613,null,n,c,p,s,i.response.toString(),e):d(5612,null,c,p,s,i.response.toString());break;default:t=e?d(5607,null,n,c,p,s,h,i.response.toString(),e):d(5606,null,c,p,h,s,i.response.toString());break}return t}};zNe=I([m(0,ou),m(1,F)],zNe);var Ovo="workbench.action.chat.markHelpful",ytn="workbench.action.chat.markUnhelpful",KNe="config.telemetry.feedback.enabled";function Fvo(){W(class extends K{constructor(){super({id:"workbench.action.chat.markHelpful",title:L(5930,"Helpful"),f1:!1,category:Si,icon:R.thumbsup,toggled:ie.responseVote.isEqualTo("up"),menu:[{id:D.ChatMessageFooter,group:"navigation",order:2,when:C.and(ie.extensionParticipantRegistered,ie.isResponse,ie.responseHasError.negate(),C.has(KNe),ie.lockedToCodingAgent.negate())},{id:qH,group:"navigation",order:1,when:C.and(ie.extensionParticipantRegistered,ie.isResponse,ie.responseHasError.negate(),C.has(KNe),ie.lockedToCodingAgent.negate())}]})}run(i,...e){let t=e[0];if(!Ui(t))return;i.get(mi).notifyUserAction({agentId:t.agent?.id,command:t.slashCommand?.name,sessionResource:t.session.sessionResource,requestId:t.requestId,result:t.result,action:{kind:"vote",direction:1}}),t.setVote(1)}}),W(class extends K{constructor(){super({id:ytn,title:L(5933,"Unhelpful"),f1:!1,category:Si,icon:R.thumbsdown,toggled:ie.responseVote.isEqualTo("down"),menu:[{id:D.ChatMessageFooter,group:"navigation",order:3,when:C.and(ie.extensionParticipantRegistered,ie.isResponse,C.has(KNe),ie.lockedToCodingAgent.negate())},{id:qH,group:"navigation",order:2,when:C.and(ie.extensionParticipantRegistered,ie.isResponse,ie.responseHasError.negate(),C.has(KNe),ie.lockedToCodingAgent.negate())}]})}run(i,...e){let t=e[0];if(!Ui(t))return;t.setVote(0),i.get(mi).notifyUserAction({agentId:t.agent?.id,command:t.slashCommand?.name,sessionResource:t.session.sessionResource,requestId:t.requestId,result:t.result,action:{kind:"vote",direction:0}})}}),W(class extends K{constructor(){super({id:"workbench.action.chat.reportIssueForBug",title:L(5932,"Report Issue"),f1:!1,category:Si,icon:R.report,menu:[{id:D.ChatMessageFooter,group:"navigation",order:4,when:C.and(ie.responseSupportsIssueReporting,ie.isResponse,C.has(KNe))},{id:qH,group:"navigation",order:3,when:C.and(ie.responseSupportsIssueReporting,ie.isResponse,C.has(KNe))}]})}run(i,...e){let t=e[0];if(!Ui(t))return;i.get(mi).notifyUserAction({agentId:t.agent?.id,command:t.slashCommand?.name,sessionResource:t.session.sessionResource,requestId:t.requestId,result:t.result,action:{kind:"bug"}})}}),W(class extends K{constructor(){super({id:"workbench.action.chat.retry",title:L(5927,"Retry"),f1:!1,category:Si,icon:R.refresh,menu:[{id:D.ChatMessageFooter,group:"navigation",when:C.and(ie.isResponse,C.in(ie.itemId.key,ie.lastItemId.key),ie.lockedToCodingAgent.negate())},{id:D.ChatEditingWidgetToolbar,group:"navigation",when:C.and(S4,ie.lockedToCodingAgent.negate()),order:0}]})}async run(i,...e){let t=i.get(Pt),o=i.get(NF),n=i.get(mi),r=i.get(B),s=i.get(at),l=e[0];if(Xto(l)&&(l=t.getWidgetBySessionResource(l.sessionResource)?.viewModel?.getItems().at(-1)),!Ui(l))return;let c=n.getSession(l.sessionResource),u=c?.getRequests();if(!u)return;let p=u?.findIndex(b=>b.id===l.requestId),h=t.getWidgetBySessionResource(l.sessionResource),g=h?.input.currentModeKind;if(c&&(g==="edit"||g==="agent")){let b=h?.viewModel?.model.editingSession;if(!b)return;let S=b.entries.get().filter(T=>T.lastModifyingRequestId===l.requestId),w=S.length>0&&r.getValue("chat.editing.confirmEditRequestRetry")===!0?await s.confirm({title:d(5929,null),message:S.length===1?d(5925,null,He(S[0].modifiedURI)):d(5928,null,S.length),primaryButton:d(5926,null),checkbox:{label:d(5924,null),checked:!1},type:"info"}):{confirmed:!0};if(!w.confirmed)return;w.checkboxChecked&&await r.updateValue("chat.editing.confirmEditRequestRetry",!1);let k=u[p];k&&await b.restoreSnapshot(k.id,void 0)}let f=c?.getRequests().find(b=>b.id===l.requestId),v=h?.input.currentLanguageModel;o.acceptRequest(l.sessionResource),n.resendRequest(f,{userSelectedModelId:v,attempt:(f?.attempt??-1)+1,...h?.getModeRequestOptions()})}}),W(class extends K{constructor(){super({id:"workbench.action.chat.insertIntoNotebook",title:L(5931,"Insert into Notebook"),f1:!1,category:Si,icon:R.insert,menu:{id:D.ChatMessageFooter,group:"navigation",isHiddenByDefault:!0,when:C.and(Za,ie.isResponse,ie.responseIsFiltered.negate(),ie.lockedToCodingAgent.negate())}})}async run(i,...e){let t=e[0];if(!Ui(t))return;let o=i.get(ee);if(o.activeEditorPane?.getId()===MR){let n=o.activeEditorPane.getControl();if(!n.hasModel()||n.isReadOnly)return;let r=t.response.toString(),s=wtn(r),l=n.getFocus(),c=Math.max(l.end,0);await i.get(La).apply([new Mv(n.textModel.uri,{editType:1,index:c,count:0,cells:s.map(p=>{let h=p.type==="markdown"?1:2,g=p.type==="markdown"?"markdown":p.language,f=p.type==="markdown"?"text/markdown":`text/x-${p.language}`;return{cellKind:h,language:g,mime:f,source:p.content,outputs:[],metadata:{}}})})],{quotableLabel:"Insert into Notebook"})}}})}function wtn(a){let e=new oc.Lexer().lex(a),t=[],o="";return e.forEach(n=>{n.type==="code"?(o.trim()&&(t.push({type:"markdown",content:o}),o=""),t.push({type:"code",language:n.lang||"",content:n.text})):o+=n.raw}),o.trim()&&t.push({type:"markdown",content:o}),t}var iKt=Ae("extension-default-icon",R.extensionsLarge,d(17629,null)),gW=Ae("extensions-verified-publisher",R.verifiedFilled,d(17631,null)),kot=te("extensionIcon.verifiedForeground",nS,d(17630,null),!1);var AG=class extends x{constructor(e,t,o){super();this.chatAgentService=e;this.extensionService=t;this.chatAgentNameService=o;this._onDidChangeContents=this._register(new E);this.onDidChangeContents=this._onDidChangeContents.event;let n=ct(".chat-agent-hover@root",[ct(".chat-agent-hover-header",[ct(".chat-agent-hover-icon@icon"),ct(".chat-agent-hover-details",[ct(".chat-agent-hover-name@name"),ct(".chat-agent-hover-extension",[ct(".chat-agent-hover-extension-name@extensionName"),ct(".chat-agent-hover-separator@separator"),ct(".chat-agent-hover-publisher@publisher")])])]),ct(".chat-agent-hover-warning@warning"),ct("span.chat-agent-hover-description@description")]);this.domNode=n.root,this.icon=n.icon,this.name=n.name,this.extensionName=n.extensionName,this.description=n.description,n.separator.textContent="|";let r=_("span.extension-verified-publisher",void 0,Sn(gW));this.publisherName=_("span.chat-agent-hover-publisher-name"),M(n.publisher,r,this.publisherName),n.warning.appendChild(Sn(R.warning)),n.warning.appendChild(_("span",void 0,d(7654,null)))}setAgent(e){let t=this.chatAgentService.getAgent(e);if(t.metadata.icon instanceof A){let r=_("img.icon");r.src=vn.uriToBrowserUri(t.metadata.icon).toString(!0),this.icon.replaceChildren(_(".avatar",void 0,r))}else if(t.metadata.themeIcon){let r=_(q.asCSSSelector(t.metadata.themeIcon));this.icon.replaceChildren(_(".avatar.codicon-avatar",void 0,r))}this.domNode.classList.toggle("noExtensionName",!!t.isDynamic);let o=this.chatAgentNameService.getAgentNameRestriction(t);this.name.textContent=o?`@${t.name}`:c4(t),this.extensionName.textContent=t.extensionDisplayName,this.publisherName.textContent=t.publisherDisplayName??t.extensionPublisherId;let n=t.description??"";if(n&&(n.match(/[\.\?\!] *$/)||(n+=".")),this.description.textContent=n,this.domNode.classList.toggle("allowedName",o),this.domNode.classList.toggle("verifiedPublisher",!1),!t.isDynamic){let r=this._register(new Ye);this.extensionService.getExtensions([{id:t.extensionId.value}],r.token).then(s=>{r.dispose(),s[0]?.publisherDomain?.verified&&(this.domNode.classList.toggle("verifiedPublisher",!0),this._onDidChangeContents.fire())})}}};AG=I([m(0,cr),m(1,Hi),m(2,_K)],AG);function GNe(a,i){return{actions:[{commandId:LPe,label:d(7655,null),run:()=>{let e=a();e&&i.executeCommand(LPe,[e.extensionId.value])}}]}}var Ctn=()=>!1,Eot=Object.freeze(["b","blockquote","br","code","del","em","h1","h2","h3","h4","h5","h6","hr","i","ins","li","ol","p","pre","s","strong","sub","sup","table","tbody","td","th","thead","tr","ul","a","img","span","div","input"]),gie=class{constructor(i,e,t,o,n){this.hoverService=o;this.markdownRendererService=n}render(i,e,t){e={...e,sanitizerConfig:{replaceWithPlaintext:!0,allowedTags:{override:Eot},...e?.sanitizerConfig,allowedLinkSchemes:{augment:[ro.urlProtocol,"copilot-skill"]},remoteImageIsAllowed:Ctn}};let o=i&&i.supportHtml?{...i,value:`<body>

${i.value}</body>`}:i,n=this.markdownRendererService.render(o,e,t);n.element.normalize();for(let r of n.element.childNodes)r.nodeType===Node.TEXT_NODE&&r.textContent?.trim()&&r.replaceWith(_("p",void 0,r.textContent));return this.attachCustomHover(n)}attachCustomHover(i){let e=new N;return i.element.querySelectorAll("a").forEach(t=>{if(t.title){let o=t.title;t.title="",e.add(this.hoverService.setupManagedHover(Ri("element"),t,o))}}),{element:i.element,dispose:()=>{i.dispose(),e.dispose()}}}};gie=I([m(0,_t),m(1,Je),m(2,B),m(3,nt),m(4,On)],gie);var qNe=class extends x{constructor(e,t,o){super();this._hoverService=o;this.domNode=document.createElement("span");this.domNode.classList.add("chat-agent-command"),this.domNode.setAttribute("aria-label",e.name),this.domNode.setAttribute("role","button");let n=xt(),r=document.createElement("span");this.domNode.appendChild(r),r.innerText=Bu+e.name,this._store.add(this._hoverService.setupDelayedHover(r,{content:e.description,style:1},{groupId:n}));let s=d(7663,null,Bu,e.name),l=new Wi(this.domNode,{ariaLabel:s});l.icon=R.close,this._store.add(l.onDidClick(()=>t())),this._store.add(l),this._store.add(this._hoverService.setupDelayedHover(l.element,{content:s,style:1},{groupId:n}))}hasSameContent(e,t,o){return!1}};qNe=I([m(2,nt)],qNe);var $Ne=class extends x{constructor(e,t,o,n){super();this.content=e;this.domNode=_(".chat-rate-limited-widget"),M(this.domNode,_("span")).classList.add(...q.asClassNameArray(R.info));let s=M(this.domNode,_(".chat-rate-limited-message")),l=M(s,_("div"));l.textContent=d(7664,null);let c=this._register(new Wi(s,{...Qo,supportIcons:!0}));c.label=d(7665,null),c.element.classList.add("chat-rate-limited-button"),this._register(c.onDidClick(async()=>{let u="workbench.action.chat.triggerSetup";o.publicLog2("workbenchActionExecuted",{id:u,from:"chat-response"}),await t.executeCommand(u)}))}hasSameContent(e){return e.kind===this.content.kind&&!!e.errorDetails.isRateLimited}addDisposable(e){this._register(e)}};$Ne=I([m(1,ge),m(2,Te),m(3,rr)],$Ne);var fie=class extends x{constructor(e,t,o){super();this.instantiationService=t;this.chatAttachmentWidgetRegistry=o;this.attachedContextDisposables=this._register(new N);this._onDidChangeVisibility=this._register(new E);this._showingAll=!1;this._variables=e.variables,this.contentReferences=e.contentReferences??[],this.limit=e.limit,this.domNode=e.domNode??_(".chat-attached-context"),this._contextResourceLabels=this._register(this.instantiationService.createInstance(Nl,{onDidChangeVisibility:this._onDidChangeVisibility.event})),this.initAttachedContext(this.domNode),this.domNode.childElementCount||(this.domNode=void 0)}updateVariables(e){this._variables=e,this.domNode&&this.initAttachedContext(this.domNode)}initAttachedContext(e){Rt(e),this.attachedContextDisposables.clear();let t=this.getVisibleAttachments(),o=this.limit&&this._variables.length>this.limit&&!this._showingAll;this.markImageLimitExceeded(this._variables);for(let n of t)this.renderAttachment(n,e);o&&this.renderShowMoreButton(e)}getVisibleAttachments(){return!this.limit||this._showingAll?this._variables:this._variables.slice(0,this.limit)}markImageLimitExceeded(e){let t=e.filter(bk);if(t.length<=ZX)return;let o=t.length-ZX;for(let n=0;n<o;n++)(t[n].omittedState===0||t[n].omittedState===3)&&(t[n].omittedState=3)}renderShowMoreButton(e){let t=this._variables.length-(this.limit??0),o=_("div.chat-attached-context-attachment.chat-attachments-show-more-button");o.setAttribute("role","button"),o.setAttribute("tabindex","0"),o.style.cursor="pointer";let n=_("div.chat-attached-context-pill",{},_("span.codicon.codicon-ellipsis")),r=_("span.chat-attached-context-custom-text");r.textContent=`${t} more`,o.appendChild(n),o.appendChild(r);let s=()=>{this._showingAll=!0,this.initAttachedContext(e)};this.attachedContextDisposables.add(j(o,"click",s)),this.attachedContextDisposables.add(j(o,"keydown",l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),s())})),e.appendChild(o),this.attachedContextDisposables.add({dispose:()=>o.remove()})}renderAttachment(e,t){let o=A.isUri(e.value)?e.value:e.value&&typeof e.value=="object"&&"uri"in e.value&&A.isUri(e.value.uri)?e.value.uri:void 0,n=e.value&&typeof e.value=="object"&&"range"in e.value&&z.isIRange(e.value.range)?e.value.range:void 0,r=this.contentReferences.find(h=>typeof h.reference=="object"&&"variableName"in h.reference&&h.reference.variableName===e.name||A.isUri(h.reference)&&jo(h.reference.path)===e.name),l=r?.options?.status?.kind===3||r?.options?.status?.kind===2,c;if(e.kind==="tool"||e.kind==="toolset")c=this.instantiationService.createInstance(oie,e,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels);else if(dLt(e))c=this.instantiationService.createInstance(rie,e,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels);else if(bk(e))e.omittedState=l?2:e.omittedState,c=this.instantiationService.createInstance(Jte,o,e,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels);else if(lD(e)){if(e.automaticallyAdded)return;c=this.instantiationService.createInstance(tie,e,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels)}else if(RK(e)){if(e.automaticallyAdded)return;c=this.instantiationService.createInstance(iie,e,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels)}else if(o&&(e.kind==="file"||e.kind==="directory"))c=this.instantiationService.createInstance(Yte,o,n,e,r,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels);else if(Keo(e))c=this.instantiationService.createInstance(Xte,e,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels);else if(lLt(e))c=this.instantiationService.createInstance(Zte,e,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels);else if(o&&cLt(e))c=this.instantiationService.createInstance(nie,o,e,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels);else if(uLt(e))c=this.instantiationService.createInstance(sie,e,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels);else if(pLt(e))c=this.instantiationService.createInstance(aie,e,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels);else if(mLt(e))c=this.instantiationService.createInstance(lie,e,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels);else{if(tTe(e))return;c=this.chatAttachmentWidgetRegistry.createWidget(e,{shouldFocusClearButton:!1,supportsDeletion:!1},t)??this.instantiationService.createInstance(eie,o,n,e,r,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels)}let u=null;l&&c.element.classList.add("warning");let p=r?.options?.status?.description;if(l){u=`${u}${p?` ${p}`:""}`;for(let h of[".monaco-icon-suffix-container",".monaco-icon-name-container"]){let g=c.label?.element.querySelector(h);g&&g.classList.add("warning")}}if(this._register(j(c.element,"contextmenu",h=>this.contextMenuHandler?.(e,h))),this.attachedContextDisposables.isDisposed){c.dispose();return}u&&(c.element.ariaLabel=u),this.attachedContextDisposables.add(c)}};fie=I([m(1,F),m(2,sNe)],fie);var jNe=class extends x{constructor(e,t,o,n,r,s){super();this.content=e;this.hoverService=o;this.chatService=n;this.editorService=r;this.instantiationService=s;this.ELEMENT_HEIGHT=22;this.MAX_ITEMS_SHOWN=6;this.diffsBetweenRequests=new Map;this.isCollapsed=!0;this.fileChangesDiffsObservable=this.computeFileChangesDiffs(e);let l=_(".checkpoint-file-changes-summary-header");this.domNode=_(".checkpoint-file-changes-summary",void 0,l),this.domNode.tabIndex=0,this._register(this.renderHeader(l)),this._register(this.renderFilesList(this.domNode))}computeFileChangesDiffs({requestId:e,sessionResource:t}){return this.chatService.chatModels.map(o=>vt.find(o,n=>Qe(n.sessionResource,t))).map(o=>o?.editingSession?.getDiffsForFilesInRequest(e)).map((o,n)=>o?.read(n)||vt.empty())}getCachedEntryDiffBetweenRequests(e,t,o,n){let r=`${t}\0${o}\0${n}`,s=this.diffsBetweenRequests.get(r);return s||(s=e.getEntryDiffBetweenRequests(t,o,n),this.diffsBetweenRequests.set(r,s)),s}renderHeader(e){let t=e.appendChild(_(".chat-file-changes-label")),o=new mR(t,{});this._register(be(s=>{let l=this.fileChangesDiffsObservable.read(s);o.label=l.length===1?"Changed 1 file":`Changed ${l.length} files`}));let n=()=>{o.icon=this.isCollapsed?R.chevronRight:R.chevronDown,this.domNode.classList.toggle("chat-file-changes-collapsed",this.isCollapsed)};n();let r=new N;return r.add(o),r.add(o.onDidClick(()=>{this.isCollapsed=!this.isCollapsed,n()})),r.add(this.renderViewAllFileChangesButton(o.element)),Z(()=>r.dispose())}renderViewAllFileChangesButton(e){let t=e.appendChild(_(".chat-view-changes-icon")),o=this.hoverService.setupDelayedHover(t,()=>({content:L(7666,"View All File Changes")}));return t.classList.add(...q.asClassNameArray(R.diffMultiple)),t.setAttribute("role","button"),t.tabIndex=0,wn(o,j(t,"click",n=>{let r=this.fileChangesDiffsObservable.get().map(c=>({originalUri:c.originalURI,modifiedUri:c.modifiedURI})),s=A.parse(`multi-diff-editor:${new Date().getMilliseconds().toString()+Math.random().toString()}`),l=this.instantiationService.createInstance(au,s,"Checkpoint File Changes",r.map(c=>new xk(c.originalUri,c.modifiedUri,void 0)),!1);this.editorService.openEditor(l),Xt.stop(n,!0)}))}renderFilesList(e){let t=new N;this.list=t.add(this.instantiationService.createInstance(Tot)).get();let o=this.list.getHTMLElement();return e.appendChild(o.parentElement),t.add(this.list.onDidOpen(n=>{let r=n.element;if(!r)return;let s={original:{resource:r.originalURI},modified:{resource:r.modifiedURI},options:{preserveFocus:!0}};this.editorService.openEditor(s)})),t.add(this.list.onContextMenu(n=>{Xt.stop(n.browserEvent,!0)})),t.add(be(n=>{let r=this.fileChangesDiffsObservable.read(n),l=Math.min(r.length,this.MAX_ITEMS_SHOWN)*this.ELEMENT_HEIGHT;this.list.layout(l),o.style.height=l+"px",this.list.splice(0,this.list.length,r)})),t}hasSameContent(e,t,o){return e.kind==="changesSummary"&&e.requestId===this.content.requestId}addDisposable(e){this._register(e)}};jNe=I([m(2,nt),m(3,mi),m(4,ee),m(5,F)],jNe);var Tot=class extends x{constructor(e,t){super();this.instantiationService=e;this.themeService=t;this._resourcePool=this._register(new XH(()=>this.listFactory()))}listFactory(){let e=_(".chat-summary-list"),t=new N;t.add(Q8(e,this.themeService));let o=t.add(this.instantiationService.createInstance(Nl,{onDidChangeVisibility:()=>x.None}));return{list:t.add(this.instantiationService.createInstance(Vl,"ChatListRenderer",e,new kDi,[this.instantiationService.createInstance(oKt,o)],{alwaysConsumeMouseWheel:!1})),dispose:()=>{t.dispose()}}}get(){return this._resourcePool.get().list}};Tot=I([m(0,F),m(1,Le)],Tot);var kDi=class{getHeight(i){return 22}getTemplateId(i){return oKt.TEMPLATE_ID}},oKt=class a{constructor(i){this.labels=i;this.templateId=a.TEMPLATE_ID}static{this.TEMPLATE_ID="collapsibleChangesSummaryListRenderer"}static{this.CHANGES_SUMMARY_CLASS_NAME="insertions-and-deletions"}renderTemplate(i){let e=this.labels.create(i,{supportHighlights:!0,supportIcons:!0});return{label:e,dispose:()=>e.dispose()}}renderElement(i,e,t){let o=t.label;o.setFile(i.modifiedURI,{fileKind:0,title:i.modifiedURI.path});let n=o.element;if(t.changesElement?.remove(),!i.identical&&!i.isBusy){let r=n.appendChild(_(`.${a.CHANGES_SUMMARY_CLASS_NAME}`)),s=r.appendChild(_(".insertions"));s.textContent=`+${i.added}`;let l=r.appendChild(_(".deletions"));l.textContent=`-${i.removed}`,t.changesElement=r}}disposeTemplate(i){i.dispose()}};var QNe=class extends x{constructor(e,t,o,n){super();this.editorService=o;this.telemetryService=n;let r=JSi(e.citations),s=ct(".chat-code-citation-message@root",[ct("span.chat-code-citation-label@label"),ct(".chat-code-citation-button-container@button")]);s.label.textContent=r+" - ";let l=this._register(new Wi(s.button,{buttonBackground:void 0,buttonBorder:void 0,buttonForeground:void 0,buttonHoverBackground:void 0,buttonSecondaryBackground:void 0,buttonSecondaryForeground:void 0,buttonSecondaryHoverBackground:void 0,buttonSeparator:void 0}));l.label=d(7667,null),this._register(l.onDidClick(()=>{let c=`# Code Citations

`+e.citations.map(u=>`## License: ${u.license}
${u.value.toString()}

\`\`\`
${u.snippet}
\`\`\`

`).join(`
`);this.editorService.openEditor({resource:void 0,contents:c,languageId:"markdown"}),this.telemetryService.publicLog2("openedChatCodeCitations")})),this.domNode=s.root}hasSameContent(e,t,o){return e.kind==="codeCitations"}};QNe=I([m(2,ee),m(3,Te)],QNe);var xtn=_,YNe=class extends x{constructor(e,t,o){super();this.commandService=o;this.domNode=xtn(".chat-command-button");let n=!Ui(t.element)||!t.element.isStale;if(this.renderButton(this.domNode,e.command,n),e.additionalCommands)for(let r of e.additionalCommands)this.renderButton(this.domNode,r,n,!0)}renderButton(e,t,o,n){let r=o?t.tooltip:d(7668,null),s=this._register(new Wi(e,{...Qo,supportIcons:!0,title:r,secondary:n}));s.label=t.title,s.enabled=o,this._register(s.onDidClick(()=>this.commandService.executeCommand(t.id,...t.arguments??[])))}hasSameContent(e){return e.kind==="command"}};YNe=I([m(2,ge)],YNe);function Wvo(a,i){let e=new N;for(let t of a.querySelectorAll("table")){if(!Do(t))continue;Etn(t);let o=t.parentElement,n=t.nextSibling,r=document.createElement("div");r.appendChild(t);let s=e.add(new ms(r,{vertical:2,horizontal:1})),l=s.getDomNode();l.classList.add("rendered-markdown-table-scroll-wrapper"),o?.insertBefore(l,n),i.value.add(()=>{s.scanDomNode()}),s.scanDomNode()}return e}var ktn=3;function Etn(a){let i=a.rows,e=[];for(let o of i)for(let n=0;n<o.cells.length;n++){let r=o.cells[n].textContent?.length??0;r>(e[n]??0)&&(e[n]=r)}let t=i[0];if(t)for(let o=0;o<t.cells.length;o++){let n=e[o];n!==void 0&&n>1&&(t.cells[o].style.minWidth=Math.min(n,ktn)+"ch")}}var sge=class{static getSanitizerOptions(i){return{allowedTags:{override:[...i.allowedTags,...Ttn]},allowedAttributes:{override:[...i.allowedAttributes,"stretchy","encoding","accent",IXe,"d","viewBox","preserveAspectRatio","class",{attributeName:"style",shouldKeep:(e,t)=>this.sanitizeKatexStyles(t.attrValue)}]}}}static{this.tempSanitizerRule=new co(()=>{let i=new CSSStyleSheet;i.insertRule(".temp{}");let e=i.cssRules[0];if(!(e instanceof CSSStyleRule))throw new Error("Invalid CSS rule");return e.style})}static sanitizeStyles(i,e){let t=this.tempSanitizerRule.value;t.cssText=i;let o=[];for(let n=0;n<t.length;n++){let r=t[n];if(e.includes(r)){let s=t.getPropertyValue(r);/^(([\d\.\-]+\w*\s?)+|\w+)$/.test(s)&&o.push(`${r}: ${s}`)}}return o.join("; ")}static sanitizeKatexStyles(i){let e=["display","position","font-family","font-style","font-weight","font-size","height","min-height","max-height","width","min-width","max-width","margin","margin-top","margin-right","margin-bottom","margin-left","padding","padding-top","padding-right","padding-bottom","padding-left","top","left","right","bottom","vertical-align","transform","border","border-top-width","border-right-width","border-bottom-width","border-left-width","color","white-space","text-align","line-height","float","clear"];return this.sanitizeStyles(i,e)}static{this._katexPromise=new co(async()=>(this._katex=await Pg("katex","dist/katex.min.js"),this._katex))}static getExtension(i,e={}){if(this._katex)return this.ensureKatexStyles(i),$Nt.extension(this._katex,e)}static async loadExtension(i,e={}){let t=await this._katexPromise.value;return this.ensureKatexStyles(i),$Nt.extension(t,e)}static ensureKatexStyles(i){let e=i.document;if(!e.querySelector("link.katex")){let t=document.createElement("link");t.classList.add("katex"),t.rel="stylesheet",t.href=HRt("katex","dist/katex.min.css"),e.head.appendChild(t)}}},Ttn=Object.freeze(["semantics","annotation","math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts","svg","altglyph","altglyphdef","altglyphitem","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]);function Vvo(a){let i=a.split(`
`),e=[],t=[];for(let o of i)if(o.startsWith("- "))e.push(o.substring(2));else if(o.startsWith("-"))e.push(o.substring(1));else if(o.startsWith("+ "))t.push(o.substring(2));else if(o.startsWith("+"))t.push(o.substring(1));else if(o.startsWith(" ")){let n=o.substring(1);e.push(n),t.push(n)}else!o.startsWith("@@")&&!o.startsWith("---")&&!o.startsWith("+++")&&!o.startsWith("diff ")&&(e.push(o),t.push(o));return{before:e.join(`
`),after:t.join(`
`)}}var EDi=class extends wh{constructor(e,t){super();this._original=e;this._modified=t;this.original=this._original.object.textEditorModel,this.modified=this._modified.object.textEditorModel}dispose(){super.dispose(),this._original.dispose(),this._modified.dispose()}},age=class extends x{constructor(e,t,o,n,r,s){super();this.modelService=n;this.textModelService=r;this.languageService=s;this.modelRef=this._register(new me);this.comparePart=this._register(t.get());let l=A.from({scheme:Q.vscodeChatCodeBlock,path:`/chat-diff-original-${e.codeBlockIndex}-${xt()}`}),c=A.from({scheme:Q.vscodeChatCodeBlock,path:`/chat-diff-modified-${e.codeBlockIndex}-${xt()}`}),u=this.languageService.createById(e.languageId);this._register(this.modelService.createModel(e.beforeContent,u,l,!1)),this._register(this.modelService.createModel(e.afterContent,u,c,!1));let p=Promise.all([this.textModelService.createModelReference(l),this.textModelService.createModelReference(c)]).then(([g,f])=>new EDi(g,f)),h={element:e.element,isReadOnly:e.isReadOnly,horizontalPadding:e.horizontalPadding,edit:{uri:e.codeBlockResource||c,edits:[],kind:"textEditGroup",done:!0},diffData:p.then(async g=>(this.modelRef.value=g,{original:g.original,modified:g.modified,originalSha1:await vV(g.original.getValue())}))};this.comparePart.object.render(h,o,Se.None),this.element=this.comparePart.object.element}layout(e){this.comparePart.object.layout(e)}reset(){this.modelRef.clear()}};age=I([m(3,Tt),m(4,Bt),m(5,_t)],age);var _xp=te("agentStatusIndicator.background",{dark:We.white.transparent(.05),light:We.black.transparent(.05),hcDark:null,hcLight:null},d(8702,null)),Dxp=te("chat.requestBorder",{dark:new We(new zt(255,255,255,.1)),light:new We(new zt(0,0,0,.1)),hcDark:bi,hcLight:bi},d(8709,null)),Bvo=te("chat.requestBackground",{dark:ai(Ho,.62),light:ai(Ho,.62),hcDark:Su,hcLight:null},d(8708,null)),vie=te("chat.slashCommandBackground",{dark:"#26477866",light:"#adceff7a",hcDark:We.white,hcLight:bv},d(8713,null)),bie=te("chat.slashCommandForeground",{dark:"#85b6ff",light:"#26569e",hcDark:We.black,hcLight:CC},d(8714,null)),Lxp=te("chat.avatarBackground",{dark:"#1f1f1f",light:"#f2f2f2",hcDark:We.black,hcLight:We.white},d(8703,null)),Rxp=te("chat.avatarForeground",To,d(8704,null)),Mxp=te("chat.editedFileForeground",{light:"#895503",dark:"#E2C08D",hcDark:"#E2C08D",hcLight:"#895503"},d(8705,null)),Pxp=te("chat.requestCodeBorder",{dark:"#004972B8",light:"#0e639c40",hcDark:null,hcLight:null},d(8712,null),!0),Axp=te("chat.requestBubbleBackground",{light:ai(Sv,.3),dark:ai(Sv,.3),hcDark:null,hcLight:null},d(8710,null),!0),Nxp=te("chat.requestBubbleHoverBackground",{dark:ai(Sv,.6),light:ai(Sv,.6),hcDark:null,hcLight:null},d(8711,null),!0),Oxp=te("chat.checkpointSeparator",{dark:"#585858",light:"#a9a9a9",hcDark:"#a9a9a9",hcLight:"#a5a5a5"},d(8716,null)),Fxp=te("chat.linesAddedForeground",{dark:"#54B054",light:"#107C10",hcDark:"#54B054",hcLight:"#107C10"},d(8706,null),!0),Wxp=te("chat.linesRemovedForeground",{dark:"#FC6A6A",light:"#BC2F32",hcDark:"#F48771",hcLight:"#B5200D"},d(8707,null),!0),Vxp=te("chat.thinkingShimmer",{dark:"#ffffff",light:"#000000",hcDark:"#ffffff",hcLight:"#000000"},d(8715,null),!0);var TDi="http://_vscodedecoration_",nKt="http://_chatagent_",Hvo="http://_chatslash_";function _Di(a,i,e,t){let o=t.get(_K),n=t.get(cr),r=o.getAgentNameRestriction(a),s=`${r?a.name:c4(a)}`;r&&n.agentHasDupeName(a.id)&&(s+=` (${a.publisherDisplayName})`);let c={agentId:a.id,sessionResource:i,name:s,isClickable:e};return`[${a.name}](${nKt}?${encodeURIComponent(JSON.stringify(c))})`}function Uvo(a,i,e){let t=`${Bu}${i.name}`,o={agentId:a.id,command:i.name,sessionResource:e};return`[${t}](${Hvo}?${encodeURIComponent(JSON.stringify(o))})`}var Sie=class{constructor(i,e,t,o,n,r,s,l,c,u,p){this.keybindingService=i;this.logService=e;this.chatAgentService=t;this.instantiationService=o;this.hoverService=n;this.chatService=r;this.chatWidgetService=s;this.commandService=l;this.labelService=c;this.toolsService=u;this.chatMarkdownAnchorService=p}convertParsedRequestToMarkdown(i,e){let t="";for(let o of e.parts)o instanceof Pv?t+=o.text:o instanceof lp?t+=this.instantiationService.invokeFunction(n=>_Di(o.agent,i,!1,n)):t+=this.genericDecorationToMarkdown(o);return t}genericDecorationToMarkdown(i){let e=i instanceof HR&&i.data instanceof A?i.data:void 0,o={title:e?this.labelService.getUriLabel(e,{relative:!0}):i instanceof UC?i.slashCommand.detail:i instanceof Xf?i.command.description:i instanceof dT?i.name:i instanceof dI?this.toolsService.getTool(i.toolId)?.userDescription:""};return`[${i.text}](${TDi}?${encodeURIComponent(JSON.stringify(o))})`}walkTreeAndAnnotateReferenceLinks(i,e){let t=new N;return e.querySelectorAll("a").forEach(o=>{let n=o.getAttribute("data-href");if(n)if(n.startsWith(nKt)){let r;try{r=JSON.parse(decodeURIComponent(n.slice(nKt.length+1)))}catch(s){this.logService.error("Invalid chat widget render data JSON",xn(s))}r&&o.replaceWith(this.renderAgentWidget(r,t))}else if(n.startsWith(Hvo)){let r;try{r=JSON.parse(decodeURIComponent(n.slice(nKt.length+1)))}catch(s){this.logService.error("Invalid chat slash command render data JSON",xn(s))}r&&o.replaceWith(this.renderSlashCommandWidget(o.textContent,r,t))}else if(n.startsWith(TDi)){let r;try{r=JSON.parse(decodeURIComponent(n.slice(TDi.length+1)))}catch{}o.replaceWith(this.renderResourceWidget(o.textContent,r,t))}else n.startsWith(G1t)?this.renderFileWidget(i,n,o,t):n.startsWith("command:")&&this.injectKeybindingHint(o,n,this.keybindingService)}),t}renderAgentWidget(i,e){let t=`${zc}${i.name}`,o;if(i.isClickable){o=_("span.chat-agent-widget");let s=e.add(new Wi(o,{buttonBackground:kt(vie),buttonForeground:kt(bie),buttonHoverBackground:void 0}));s.label=t,e.add(s.onDidClick(()=>{let l=this.chatAgentService.getAgent(i.agentId),c=this.chatWidgetService.getWidgetBySessionResource(i.sessionResource)||this.chatWidgetService.lastFocusedWidget;!c||!l||this.chatService.sendRequest(c.viewModel.sessionResource,l.metadata.sampleRequest??"",{location:c.location,agentId:l.id,userSelectedModelId:c.input.currentLanguageModel,modeInfo:c.input.currentModeInfo})}))}else o=this.renderResourceWidget(t,void 0,e);let n=this.chatAgentService.getAgent(i.agentId),r=new co(()=>e.add(this.instantiationService.createInstance(AG)));return e.add(this.hoverService.setupManagedHover(Ri("element"),o,()=>(r.value.setAgent(i.agentId),r.value.domNode),n&&GNe(()=>n,this.commandService))),o}renderSlashCommandWidget(i,e,t){let o=_("span.chat-agent-widget.chat-command-widget"),n=this.chatAgentService.getAgent(e.agentId),r=t.add(new Wi(o,{buttonBackground:kt(vie),buttonForeground:kt(bie),buttonHoverBackground:void 0}));return r.label=i,t.add(r.onDidClick(()=>{let s=this.chatWidgetService.getWidgetBySessionResource(e.sessionResource)||this.chatWidgetService.lastFocusedWidget;if(!s||!n)return;let l=n.slashCommands.find(c=>c.name===e.command);this.chatService.sendRequest(s.viewModel.sessionResource,l?.sampleRequest??"",{location:s.location,agentId:n.id,slashCommand:e.command,userSelectedModelId:s.input.currentLanguageModel,modeInfo:s.input.currentModeInfo})})),o}renderFileWidget(i,e,t,o){let n=A.parse(e),r=i.inlineReferences?.[n.path.slice(1)];if(!r){this.logService.error("Invalid chat widget render data JSON");return}let s=o.add(this.instantiationService.createInstance(YH,t,r,void 0));o.add(this.chatMarkdownAnchorService.register(s))}renderResourceWidget(i,e,t){let o=_("span.chat-resource-widget"),n=_("span",void 0,i);return e?.title&&t.add(this.hoverService.setupManagedHover(Ri("element"),o,e.title)),o.appendChild(n),o}injectKeybindingHint(i,e,t){let o=e.match(/command:([^\)]+)/)?.[1];o&&(i.textContent=t.appendKeybinding(i.textContent||"",o))}};Sie=I([m(0,_e),m(1,se),m(2,cr),m(3,F),m(4,nt),m(5,mi),m(6,Pt),m(7,ge),m(8,rt),m(9,Vn),m(10,Gv)],Sie);function rKt(a,i,e=!0){for(let t=i.length-1;t>=0;t--){let o=i.slice(0,t),n=i[t],r=_tn(a,n,o,e);if(r)return r}return null}function _tn(a,i,e,t){let o=null;for(let n=a.tokenColors.length-1;n>=0;n--){let r=a.tokenColors[n];if(t&&!r.settings.foreground)continue;let s;if(typeof r.scope=="string")s=r.scope.split(/,/).map(l=>l.trim());else if(Array.isArray(r.scope))s=r.scope;else continue;for(let l=0,c=s.length;l<c;l++){let u=s[l],p=new DDi(u,r.settings);p.matches(i,e)&&p.isMoreSpecific(o)&&(o=p)}}return o}var DDi=class a{constructor(i,e){this.rawSelector=i,this.settings=e;let t=this.rawSelector.split(/ /);this.scope=t[t.length-1],this.parentScopes=t.slice(0,t.length-1)}matches(i,e){return a._matches(this.scope,this.parentScopes,i,e)}static _cmp(i,e){if(i===null&&e===null)return 0;if(i===null)return-1;if(e===null)return 1;if(i.scope.length!==e.scope.length)return i.scope.length-e.scope.length;let t=i.parentScopes.length,o=e.parentScopes.length;if(t!==o)return t-o;for(let n=0;n<t;n++){let r=i.parentScopes[n].length,s=e.parentScopes[n].length;if(r!==s)return r-s}return 0}isMoreSpecific(i){return a._cmp(this,i)>0}static _matchesOne(i,e){let t=i+".";return i===e||e.substring(0,t.length)===t}static _matches(i,e,t,o){if(!this._matchesOne(i,t))return!1;let n=e.length-1,r=o.length-1;for(;n>=0&&r>=0;)this._matchesOne(e[n],o[r])&&n--,r--;return n===-1}};var Zr=_,fW=class extends x{static{this.ID="editor.contrib.inspectEditorTokens"}static get(i){return i.getContribution(fW.ID)}constructor(i,e,t,o,n,r,s){super(),this._editor=i,this._textMateService=e,this._themeService=o,this._languageService=t,this._notificationService=n,this._configurationService=r,this._languageFeaturesService=s,this._widget=null,this._register(this._editor.onDidChangeModel(l=>this.stop())),this._register(this._editor.onDidChangeModelLanguage(l=>this.stop())),this._register(this._editor.onKeyUp(l=>l.keyCode===9&&this.stop()))}dispose(){this.stop(),super.dispose()}launch(){this._widget||this._editor.hasModel()&&this._editor.getModel().uri.scheme!==Q.vscodeNotebookCell&&(this._widget=new RDi(this._editor,this._textMateService,this._languageService,this._themeService,this._notificationService,this._configurationService,this._languageFeaturesService))}stop(){this._widget&&(this._widget.dispose(),this._widget=null)}toggle(){this._widget?this.stop():this.launch()}};fW=I([m(1,Z3),m(2,_t),m(3,sp),m(4,Ne),m(5,B),m(6,Qt)],fW);var LDi=class extends Di{constructor(){super({id:"editor.action.inspectTMScopes",label:L(8937,"Developer: Inspect Editor Tokens and Scopes"),precondition:void 0})}run(i,e){fW.get(e)?.toggle()}};function zvo(a){a.length>40&&(a=a.substr(0,20)+"\u2026"+a.substr(a.length-20));let i="";for(let e=0,t=a.length;e<t;e++){let o=a.charCodeAt(e);switch(o){case 9:i+="\u2192";break;case 32:i+="\xB7";break;default:i+=String.fromCharCode(o)}}return i}var RDi=class a extends x{constructor(e,t,o,n,r,s,l){super();this.allowEditorOverflow=!0;this._isDisposed=!1,this._editor=e,this._languageService=o,this._themeService=n,this._textMateService=t,this._notificationService=r,this._configurationService=s,this._languageFeaturesService=l,this._model=this._editor.getModel(),this._domNode=document.createElement("div"),this._domNode.className="token-inspect-widget",this._currentRequestCancellationTokenSource=new Ye,this._beginCompute(this._editor.getPosition()),this._register(this._editor.onDidChangeCursorPosition(c=>this._beginCompute(this._editor.getPosition()))),this._register(n.onDidColorThemeChange(c=>this._beginCompute(this._editor.getPosition()))),this._register(s.onDidChangeConfiguration(c=>c.affectsConfiguration("editor.semanticHighlighting.enabled")&&this._beginCompute(this._editor.getPosition()))),this._editor.addContentWidget(this)}static{this._ID="editor.contrib.inspectEditorTokensWidget"}dispose(){this._isDisposed=!0,this._editor.removeContentWidget(this),this._currentRequestCancellationTokenSource.cancel(),super.dispose()}getId(){return a._ID}_beginCompute(e){let t=this._textMateService.createTokenizer(this._model.getLanguageId()),o=this._computeSemanticTokens(e),n=this._model.tokenization.tokens.get(),r=n instanceof pz?n:void 0;Rt(this._domNode),this._domNode.appendChild(document.createTextNode(d(8938,null))),Promise.all([t,o]).then(([s,l])=>{if(this._isDisposed)return;let c=r?.tree.get();this._compute(s,l,c,e),this._domNode.style.maxWidth=`${Math.max(this._editor.getLayoutInfo().width*.66,500)}px`,this._editor.layoutContentWidget(this)},s=>{this._notificationService.warn(s),setTimeout(()=>{fW.get(this._editor)?.stop()})})}_isSemanticColoringEnabled(){let e=this._configurationService.getValue(pde,{overrideIdentifier:this._model.getLanguageId(),resource:this._model.uri})?.enabled;return typeof e=="boolean"?e:this._themeService.getColorTheme().semanticHighlighting}_compute(e,t,o,n){let r=e&&this._getTokensAtPosition(e,n),s=t&&this._getSemanticTokenAtPosition(t,n),l=o&&this._getTreeSitterTokenAtPosition(o,n);if(!r&&!s&&!l){vi(this._domNode,"No grammar or semantic tokens available.");return}let c=r?.metadata,u=s?.metadata,p=s&&zvo(this._model.getValueInRange(s.range)),h=r&&zvo(this._model.getLineContent(n.lineNumber).substring(r.token.startIndex,r.token.endIndex)),g=s&&this._model.getValueLengthInRange(s.range),f=r&&r.token.endIndex-r.token.startIndex,v=p||h||"",b=g||f||0;if(vi(this._domNode,Zr("h2.tiw-token",void 0,v,Zr("span.tiw-token-length",void 0,`${b} ${b===1?"char":"chars"}`))),M(this._domNode,Zr("hr.tiw-metadata-separator",{style:"clear:both"})),M(this._domNode,Zr("table.tiw-metadata-table",void 0,Zr("tbody",void 0,Zr("tr",void 0,Zr("td.tiw-metadata-key",void 0,"language"),Zr("td.tiw-metadata-value",void 0,c?.languageId||"")),Zr("tr",void 0,Zr("td.tiw-metadata-key",void 0,"standard token type"),Zr("td.tiw-metadata-value",void 0,this._tokenTypeToString(c?.tokenType||0))),...this._formatMetadata(u,c)))),s){M(this._domNode,Zr("hr.tiw-metadata-separator"));let S=M(this._domNode,Zr("table.tiw-metadata-table",void 0)),y=M(S,Zr("tbody",void 0,Zr("tr",void 0,Zr("td.tiw-metadata-key",void 0,"semantic token type"),Zr("td.tiw-metadata-value",void 0,s.type))));if(s.modifiers.length&&M(y,Zr("tr",void 0,Zr("td.tiw-metadata-key",void 0,"modifiers"),Zr("td.tiw-metadata-value",void 0,s.modifiers.join(" ")))),s.metadata){let w=["foreground","bold","italic","underline","strikethrough"],k={},T=new Array;for(let P of w)if(s.metadata[P]!==void 0){let O=s.definitions[P],V=this._renderTokenStyleDefinition(O,P),H=V.map($=>Do($)?$.outerHTML:$).join(),G=k[H];G||(k[H]=G=[],T.push([V,H])),G.push(P)}for(let[P,O]of T)M(y,Zr("tr",void 0,Zr("td.tiw-metadata-key",void 0,k[O].join(", ")),Zr("td.tiw-metadata-value",void 0,...P)))}}if(r){let S=this._themeService.getColorTheme();M(this._domNode,Zr("hr.tiw-metadata-separator"));let y=M(this._domNode,Zr("table.tiw-metadata-table")),w=M(y,Zr("tbody"));h&&h!==v&&M(w,Zr("tr",void 0,Zr("td.tiw-metadata-key",void 0,"textmate token"),Zr("td.tiw-metadata-value",void 0,`${h} (${h.length})`)));let k=new Array;for(let O=r.token.scopes.length-1;O>=0;O--)k.push(r.token.scopes[O]),O>0&&k.push(Zr("br"));M(w,Zr("tr",void 0,Zr("td.tiw-metadata-key",void 0,"textmate scopes"),Zr("td.tiw-metadata-value.tiw-metadata-scopes",void 0,...k)));let T=rKt(S,r.token.scopes,!1),P=s?.metadata?.foreground;if(T){if(P!==r.metadata.foreground){let O=Zr("code.tiw-theme-selector",void 0,T.rawSelector,Zr("br"),JSON.stringify(T.settings,null,"	"));P&&(O=Zr("s",void 0,O)),M(w,Zr("tr",void 0,Zr("td.tiw-metadata-key",void 0,"foreground"),Zr("td.tiw-metadata-value",void 0,O)))}}else P||M(w,Zr("tr",void 0,Zr("td.tiw-metadata-key",void 0,"foreground"),Zr("td.tiw-metadata-value",void 0,"No theme selector")))}if(l){let S=l[l.length-1];M(this._domNode,Zr("hr.tiw-metadata-separator"));let y=M(this._domNode,Zr("table.tiw-metadata-table")),w=M(y,Zr("tbody"));M(w,Zr("tr",void 0,Zr("td.tiw-metadata-key",void 0,`tree-sitter token ${S.id}`),Zr("td.tiw-metadata-value",void 0,`${S.text}`)));let k=new Array,T=l.length-1,P=l[T];for(;P.parent||T>0;)k.push(P.type),P=P.parent??l[--T],P&&k.push(Zr("br"));M(w,Zr("tr",void 0,Zr("td.tiw-metadata-key",void 0,"tree-sitter tree"),Zr("td.tiw-metadata-value.tiw-metadata-scopes",void 0,...k)));let V=this._model.tokenization.tokens.get().tokenizationImpl.get()?.captureAtPosition(n.lineNumber,n.column);V&&V.length>0&&M(w,Zr("tr",void 0,Zr("td.tiw-metadata-key",void 0,"foreground"),Zr("td.tiw-metadata-value",void 0,V.map(H=>H.name).join(" "))))}}_formatMetadata(e,t){let o=new Array;function n(u){let p=e?.[u]||t?.[u];if(p!==void 0){let h=e?.[u]?"tiw-metadata-semantic":"";o.push(Zr("tr",void 0,Zr("td.tiw-metadata-key",void 0,u),Zr(`td.tiw-metadata-value.${h}`,void 0,p)))}return p}let r=n("foreground"),s=n("background");if(r&&s){let u=We.fromHex(s),p=We.fromHex(r);u.isOpaque()?o.push(Zr("tr",void 0,Zr("td.tiw-metadata-key",void 0,"contrast ratio"),Zr("td.tiw-metadata-value",void 0,u.getContrastRatio(p.makeOpaque(u)).toFixed(2)))):o.push(Zr("tr",void 0,Zr("td.tiw-metadata-key",void 0,"Contrast ratio cannot be precise for background colors that use transparency"),Zr("td.tiw-metadata-value")))}let l=new Array;function c(u){let p;e&&e[u]?p=Zr("span.tiw-metadata-semantic",void 0,u):t&&t[u]&&(p=u),p&&(l.length&&l.push(" "),l.push(p))}return c("bold"),c("italic"),c("underline"),c("strikethrough"),l.length&&o.push(Zr("tr",void 0,Zr("td.tiw-metadata-key",void 0,"font style"),Zr("td.tiw-metadata-value",void 0,...l))),o}_decodeMetadata(e){let t=this._themeService.getColorTheme().tokenColorMap,o=bp.getLanguageId(e),n=bp.getTokenType(e),r=bp.getFontStyle(e),s=bp.getForeground(e),l=bp.getBackground(e);return{languageId:this._languageService.languageIdCodec.decodeLanguageId(o),tokenType:n,bold:r&2?!0:void 0,italic:r&1?!0:void 0,underline:r&4?!0:void 0,strikethrough:r&8?!0:void 0,foreground:t[s],background:t[l]}}_tokenTypeToString(e){switch(e){case 0:return"Other";case 1:return"Comment";case 2:return"String";case 3:return"RegEx";default:return"??"}}_getTokensAtPosition(e,t){let o=t.lineNumber,n=this._getStateBeforeLine(e,o),r=e.tokenizeLine(this._model.getLineContent(o),n),s=e.tokenizeLine2(this._model.getLineContent(o),n),l=0;for(let u=r.tokens.length-1;u>=0;u--){let p=r.tokens[u];if(t.column-1>=p.startIndex){l=u;break}}let c=0;for(let u=s.tokens.length>>>1;u>=0;u--)if(t.column-1>=s.tokens[u<<1]){c=u;break}return{token:r.tokens[l],metadata:this._decodeMetadata(s.tokens[(c<<1)+1])}}_getStateBeforeLine(e,t){let o=null;for(let n=1;n<t;n++)o=e.tokenizeLine(this._model.getLineContent(n),o).ruleStack;return o}isSemanticTokens(e){return e&&e.data}async _computeSemanticTokens(e){if(!this._isSemanticColoringEnabled())return null;let t=this._languageFeaturesService.documentSemanticTokensProvider.ordered(this._model);if(t.length){let n=t[0],r=await Promise.resolve(n.provideDocumentSemanticTokens(this._model,null,this._currentRequestCancellationTokenSource.token));if(this.isSemanticTokens(r))return{tokens:r,legend:n.getLegend()}}let o=this._languageFeaturesService.documentRangeSemanticTokensProvider.ordered(this._model);if(o.length){let n=o[0],r=e.lineNumber,s=new z(r,1,r,this._model.getLineMaxColumn(r)),l=await Promise.resolve(n.provideDocumentRangeSemanticTokens(this._model,s,this._currentRequestCancellationTokenSource.token));if(this.isSemanticTokens(l))return{tokens:l,legend:n.getLegend()}}return null}_getSemanticTokenAtPosition(e,t){let o=e.tokens.data,n=this._model.getLanguageId(),r=0,s=0,l=t.lineNumber-1,c=t.column-1;for(let u=0;u<o.length;u+=5){let p=o[u],h=o[u+1],g=o[u+2],f=o[u+3],v=o[u+4],b=r+p,S=p===0?s+h:h;if(l===b&&S<=c&&c<S+g){let y=e.legend.tokenTypes[f]||"not in legend (ignored)",w=[],k=v;for(let $=0;k>0&&$<e.legend.tokenModifiers.length;$++)k&1&&w.push(e.legend.tokenModifiers[$]),k=k>>1;k>0&&w.push("not in legend (ignored)");let T=new z(b+1,S+1,b+1,S+1+g),P={},O=this._themeService.getColorTheme().tokenColorMap,H=this._themeService.getColorTheme().getTokenStyleMetadata(y,w,n,!0,P),G;return H&&(G={languageId:void 0,tokenType:0,bold:H?.bold,italic:H?.italic,underline:H?.underline,strikethrough:H?.strikethrough,foreground:O[H?.foreground||0],background:void 0}),{type:y,modifiers:w,range:T,metadata:G,definitions:P}}r=b,s=S}return null}_walkTreeforPosition(e,t){let o=this._model.getOffsetAt(t);e.gotoFirstChild();let n=!1,r=null;do e.currentNode.startIndex<=o&&o<e.currentNode.endIndex?(n=!0,r=e.currentNode):n=!1;while(n?e.gotoFirstChild():e.gotoNextSibling());return r}_getTreeSitterTokenAtPosition(e,t){let o=[],n=e?.tree.get();for(;n;){let r=n.walk(),s=this._walkTreeforPosition(r,t);r.delete(),s?(o.push(s),e=e?.getInjectionTrees(s.startIndex,e.languageId),n=e?.tree.get()):n=void 0}return o.length>0?o:null}_renderTokenStyleDefinition(e,t){let o=new Array;if(e===void 0)return o;let n=this._themeService.getColorTheme();if(Array.isArray(e)){let r={};n.resolveScopes(e,r);let s=r[t];if(s&&r.scope){let l=Zr("ul.tiw-metadata-values"),c=Array.isArray(s.scope)?s.scope:[String(s.scope)];for(let u of c)l.appendChild(Zr("li.tiw-metadata-value.tiw-metadata-scopes",void 0,u));return o.push(r.scope.join(" "),l,Zr("code.tiw-theme-selector",void 0,JSON.stringify(s.settings,null,"	"))),o}return o}else if(Yke.is(e)){let r=n.getTokenStylingRuleScope(e);return r==="setting"?(o.push(`User settings: ${e.selector.id} - ${this._renderStyleProperty(e.style,t)}`),o):(r==="theme"&&o.push(`Color theme: ${e.selector.id} - ${this._renderStyleProperty(e.style,t)}`),o)}else{let r=n.resolveTokenStyleValue(e);return o.push(`Default: ${r?this._renderStyleProperty(r,t):""}`),o}}_renderStyleProperty(e,t){return t==="foreground"?e.foreground?We.Format.CSS.formatHexA(e.foreground,!0):"":e[t]!==void 0?String(e[t]):""}getDomNode(){return this._domNode}getPosition(){return{position:this._editor.getPosition(),preference:[2,1]}}};xo(fW.ID,fW,4);ni(LDi);var vW=_,Kvo="vscode-local-file";function Gvo(a){let i;try{i=JSON.parse(a)}catch{throw new Error("Could not parse code block local file data")}let e;try{e=A.revive(i?.uri)}catch{throw new Error("Invalid code block local file data URI")}let t;return i.range&&(t=new z(i.range.startLineNumber+1,i.range.startColumn+1,i.range.endLineNumber+1,i.range.endColumn+1)),{uri:e,range:t}}var XNe=10,Z8=class extends x{constructor(e,t,o,n,r=!1,s,l,c,u,p){super();this.editorOptions=e;this.menuId=t;this.isSimpleWidget=r;this.modelService=c;this.configurationService=u;this.accessibilityService=p;this.currentScrollWidth=0;this.isDisposed=!1;this.element=vW(".interactive-result-code-block"),this.resourceContextKey=s.createInstance(UX),this.contextKeyService=this._register(l.createScoped(this.element));let h=this._register(s.createChild(new _o([X,this.contextKeyService]))),g=M(this.element,vW(".interactive-result-editor"));this.editor=this.createEditor(h,g,{...Vb(this.configurationService),readOnly:!0,lineNumbers:"off",selectOnLineNumbers:!0,scrollBeyondLastLine:!1,lineDecorationsWidth:8,dragAndDrop:!1,padding:{top:this.verticalPadding,bottom:this.verticalPadding},mouseWheelZoom:!1,scrollbar:{vertical:"hidden",alwaysConsumeMouseWheel:!1},definitionLinkOpensInPeek:!1,gotoLocation:{multiple:"goto",multipleDeclarations:"goto",multipleDefinitions:"goto",multipleImplementations:"goto"},ariaLabel:d(7842,null),overflowWidgetsDomNode:n,tabFocusMode:!0,...this.getEditorOptionsFromConfig()});let f=M(this.element,vW(".interactive-result-code-block-toolbar")),v=this._register(this.editor.contextKeyService.createScoped(f)),b=this._register(h.createChild(new _o([X,v])));this.toolbar=this._register(b.createInstance(or,f,t,{menuOptions:{shouldForwardArgs:!0}}));let S=M(this.element,vW(".interactive-result-vulns")),y=M(S,vW(".interactive-result-vulns-header",void 0));this.vulnsButton=this._register(new Wi(y,{buttonBackground:void 0,buttonBorder:void 0,buttonForeground:void 0,buttonHoverBackground:void 0,buttonSecondaryBackground:void 0,buttonSecondaryForeground:void 0,buttonSecondaryHoverBackground:void 0,buttonSeparator:void 0,supportIcons:!0})),this.vulnsListElement=M(S,vW("ul.interactive-result-vulns-list")),this._register(this.vulnsButton.onDidClick(()=>{let w=this.currentCodeBlockData.element;w.vulnerabilitiesListExpanded=!w.vulnerabilitiesListExpanded,this.vulnsButton.label=this.getVulnerabilitiesLabel(),this.element.classList.toggle("chat-vulnerabilities-collapsed",!w.vulnerabilitiesListExpanded),this.layout()})),this._register(this.toolbar.onDidChangeDropdownVisibility(w=>{f.classList.toggle("force-visibility",w)})),this._configureForScreenReader(),this._register(this.accessibilityService.onDidChangeScreenReaderOptimized(()=>this._configureForScreenReader())),this._register(this.configurationService.onDidChangeConfiguration(w=>{w.affectedKeys.has("accessibility.verbosity.panelChat")&&this._configureForScreenReader()})),this._register(this.editorOptions.onDidChange(()=>{this.editor.updateOptions(this.getEditorOptionsFromConfig())})),this._register(this.editor.onDidScrollChange(w=>{this.currentScrollWidth=w.scrollWidth})),this._register(this.editor.onDidContentSizeChange(w=>{w.contentHeightChanged&&this.layout()})),this._register(this.editor.onDidBlurEditorWidget(()=>{this.element.classList.remove("focused"),hS.get(this.editor)?.stopHighlighting(),this.clearWidgets()})),this._register(this.editor.onDidFocusEditorWidget(()=>{this.element.classList.add("focused"),hS.get(this.editor)?.restoreViewState(!0)})),this._register(U.any(this.editor.onDidChangeModel,this.editor.onDidChangeModelContent)(()=>{this.currentCodeBlockData&&this.updateContexts(this.currentCodeBlockData)})),o.onDidScroll&&this._register(o.onDidScroll(w=>{this.clearWidgets()}))}get verticalPadding(){return this.currentCodeBlockData?.renderOptions?.verticalPadding??XNe}dispose(){this.isDisposed=!0,super.dispose()}get uri(){return this.editor.getModel()?.uri}createEditor(e,t,o){return this._register(e.createInstance(Xr,t,o,{isSimpleWidget:this.isSimpleWidget,contributions:Ba.getSomeEditorContributions([yy.ID,xy,og.ID,hS.ID,hB.ID,Rz.ID,fF.ID,Pl.ID,ff.ID,xu.ID,Y_.ID,nc.ID,vs.ID,Iw.ID,dk.ID,fW.ID])}))}focus(){this.editor.focus()}updatePaddingForLayout(){let e=this.currentScrollWidth>this.editor.getLayoutInfo().contentWidth,t=this.editor.getLayoutInfo().horizontalScrollbarHeight,o=e?Math.max(this.verticalPadding-t,2):this.verticalPadding;this.editor.updateOptions({padding:{top:this.verticalPadding,bottom:o}})}_configureForScreenReader(){let e=this.toolbar.getElement();this.accessibilityService.isScreenReaderOptimized()?e.style.display="block":e.style.display=""}getEditorOptionsFromConfig(){return{wordWrap:this.editorOptions.configuration.resultEditor.wordWrap,fontLigatures:this.editorOptions.configuration.resultEditor.fontLigatures,bracketPairColorization:this.editorOptions.configuration.resultEditor.bracketPairColorization,fontFamily:this.editorOptions.configuration.resultEditor.fontFamily==="default"?fu.fontFamily:this.editorOptions.configuration.resultEditor.fontFamily,fontSize:this.editorOptions.configuration.resultEditor.fontSize,fontWeight:this.editorOptions.configuration.resultEditor.fontWeight,lineHeight:this.editorOptions.configuration.resultEditor.lineHeight,...this.currentCodeBlockData?.renderOptions?.editorOptions}}layout(e=this.lastLayoutWidth){if(e===void 0)return;this.lastLayoutWidth=e;let t=this.getContentHeight(),o=t;this.currentCodeBlockData?.renderOptions?.maxHeightInLines&&(o=Math.min(t,this.editor.getOption(75)*this.currentCodeBlockData?.renderOptions?.maxHeightInLines)),e=e-2-(this.currentCodeBlockData?.renderOptions?.reserveWidth??0),this.editor.layout({width:Sr(this.currentCodeBlockData?.element)?e*.9:e,height:o},!0),this.updatePaddingForLayout()}getContentHeight(){if(this.currentCodeBlockData?.range){let e=this.currentCodeBlockData.range.endLineNumber-this.currentCodeBlockData.range.startLineNumber+1,t=this.editor.getOption(75);return e*t+2*this.verticalPadding}return this.editor.getContentHeight()}async render(e,t){this.currentCodeBlockData=e,e.parentContextKeyService&&this.contextKeyService.updateParent(e.parentContextKeyService),this.getEditorOptionsFromConfig().wordWrap==="on"&&this.layout(t),!(!await this.updateEditor(e)||this.isDisposed||this.currentCodeBlockData!==e)&&(this.editor.updateOptions({...this.getEditorOptionsFromConfig()}),this.editor.getOption(8)||this.editor.updateOptions({ariaLabel:d(7843,null,e.codeBlockIndex+1)}),this.layout(t),this.toolbar.setAriaLabel(d(7844,null,e.codeBlockIndex+1)),e.renderOptions?.hideToolbar?vo(this.toolbar.getElement()):un(this.toolbar.getElement()),e.vulns?.length&&Ui(e.element)?(Rt(this.vulnsListElement),this.element.classList.remove("no-vulns"),this.element.classList.toggle("chat-vulnerabilities-collapsed",!e.element.vulnerabilitiesListExpanded),M(this.vulnsListElement,...e.vulns.map(n=>vW("li",void 0,vW("span.chat-vuln-title",void 0,n.title)," "+n.description))),this.vulnsButton.label=this.getVulnerabilitiesLabel()):this.element.classList.add("no-vulns"),this.layout())}reset(){this.clearWidgets(),this.currentCodeBlockData=void 0}onDidRemount(){this.currentCodeBlockData&&this.editor.renderAsync(!0)}clearWidgets(){Pl.get(this.editor)?.hideContentHover(),ff.get(this.editor)?.hideGlyphHover()}async updateEditor(e){let t=await e.textModel;return this.isDisposed||this.currentCodeBlockData!==e||!t||t.isDisposed()?!1:(this.editor.setModel(t),e.range&&(this.editor.setSelection(e.range),this.editor.revealRangeInCenter(e.range,1)),this.updateContexts(e),!0)}getVulnerabilitiesLabel(){return!this.currentCodeBlockData||!this.currentCodeBlockData.vulns?"":`${this.currentCodeBlockData.vulns.length>1?d(7853,null,this.currentCodeBlockData.vulns.length):d(7854,null,1)} $(${(o=>o.vulnerabilitiesListExpanded?R.chevronDown:R.chevronRight)(this.currentCodeBlockData.element).id})`}updateContexts(e){let t=this.editor.getModel();t&&(this.toolbar.context={code:t.getTextBuffer().getValueInRange(e.range??t.getFullModelRange(),0),codeBlockIndex:e.codeBlockIndex,element:e.element,languageId:t.getLanguageId(),codemapperUri:e.codemapperUri,chatSessionResource:e.chatSessionResource},this.resourceContextKey.set(t.uri))}};Z8=I([m(5,F),m(6,X),m(7,Tt),m(8,B),m(9,Oi)],Z8);var JNe=class extends x{constructor(e,t){super();this._modelService=t;this._register(e.registerTextModelContentProvider(Q.vscodeChatCodeBlock,this))}async provideTextContent(e){let t=this._modelService.getModel(e);return t||this._modelService.createModel("",null,e)}};JNe=I([m(0,Bt),m(1,Tt)],JNe);var ZNe=class extends x{constructor(e,t,o,n,r=!1,s,l,c,u,p,h,g){super();this.options=e;this.menuId=t;this.isSimpleWidget=r;this.modelService=c;this.configurationService=u;this.accessibilityService=p;this.labelService=h;this.openerService=g;this._lastDiffEditorViewModel=this._store.add(new me);this.currentScrollWidth=0;this.currentHorizontalPadding=0;this.element=vW(".interactive-result-code-block"),this.element.classList.add("compare"),this.messageElement=M(this.element,vW(".message")),this.messageElement.setAttribute("role","status"),this.messageElement.tabIndex=0,this.contextKeyService=this._register(l.createScoped(this.element));let f=this._register(s.createChild(new _o([X,this.contextKeyService],[wd,new class{show(w,k){return Iyt}async showWhile(w,k){await w}}]))),v=this.editorHeader=M(this.element,vW(".interactive-result-header.show-file-icons")),b=M(this.element,vW(".interactive-result-editor"));this.diffEditor=this.createDiffEditor(f,b,{...Vb(this.configurationService),lineNumbers:"on",selectOnLineNumbers:!0,scrollBeyondLastLine:!1,lineDecorationsWidth:12,dragAndDrop:!1,padding:{top:XNe,bottom:XNe},mouseWheelZoom:!1,scrollbar:{vertical:"hidden",alwaysConsumeMouseWheel:!1},definitionLinkOpensInPeek:!1,gotoLocation:{multiple:"goto",multipleDeclarations:"goto",multipleDefinitions:"goto",multipleImplementations:"goto"},ariaLabel:d(7842,null),overflowWidgetsDomNode:n,...this.getEditorOptionsFromConfig()}),this.resourceLabel=this._register(f.createInstance(Tk,v,{supportIcons:!0}));let S=this._register(this.diffEditor.getModifiedEditor().contextKeyService.createScoped(v)),y=this._register(f.createChild(new _o([X,S])));this.toolbar=this._register(y.createInstance(or,v,t,{menuOptions:{shouldForwardArgs:!0}})),this._configureForScreenReader(),this._register(this.accessibilityService.onDidChangeScreenReaderOptimized(()=>this._configureForScreenReader())),this._register(this.configurationService.onDidChangeConfiguration(w=>{w.affectedKeys.has("accessibility.verbosity.panelChat")&&this._configureForScreenReader()})),this._register(this.options.onDidChange(()=>{this.diffEditor.updateOptions(this.getEditorOptionsFromConfig())})),this._register(this.diffEditor.getModifiedEditor().onDidScrollChange(w=>{this.currentScrollWidth=w.scrollWidth})),this._register(this.diffEditor.getModifiedEditor().onDidBlurEditorWidget(()=>{this.element.classList.remove("focused"),hS.get(this.diffEditor.getModifiedEditor())?.stopHighlighting(),this.clearWidgets()})),this._register(this.diffEditor.getModifiedEditor().onDidFocusEditorWidget(()=>{this.element.classList.add("focused"),hS.get(this.diffEditor.getModifiedEditor())?.restoreViewState(!0)})),o.onDidScroll&&this._register(o.onDidScroll(w=>{this.clearWidgets()}))}get uri(){return this.diffEditor.getModifiedEditor().getModel()?.uri}createDiffEditor(e,t,o){let n={isSimpleWidget:this.isSimpleWidget,contributions:Ba.getSomeEditorContributions([yy.ID,xy,og.ID,hS.ID,hB.ID,Rz.ID,fF.ID,Pl.ID,ff.ID,Y_.ID])};return this._register(e.createInstance(op,t,{scrollbar:{useShadows:!1,alwaysConsumeMouseWheel:!1,ignoreHorizontalScrollbarInContentHeight:!0},renderMarginRevertIcon:!1,diffCodeLens:!1,scrollBeyondLastLine:!1,stickyScroll:{enabled:!1},originalAriaLabel:d(7852,null),modifiedAriaLabel:d(7851,null),diffAlgorithm:"advanced",readOnly:!1,isInEmbeddedEditor:!0,useInlineViewWhenSpaceIsLimited:!0,experimental:{useTrueInlineView:!0},renderSideBySideInlineBreakpoint:300,renderOverviewRuler:!1,compactMode:!0,hideUnchangedRegions:{enabled:!0,contextLineCount:1},renderGutterMenu:!1,lineNumbersMinChars:1,...o},{originalEditor:n,modifiedEditor:n}))}focus(){this.diffEditor.focus()}updatePaddingForLayout(){let e=this.currentScrollWidth>this.diffEditor.getModifiedEditor().getLayoutInfo().contentWidth,t=this.diffEditor.getModifiedEditor().getLayoutInfo().horizontalScrollbarHeight,o=e?Math.max(XNe-t,2):XNe;this.diffEditor.updateOptions({padding:{top:XNe,bottom:o}})}_configureForScreenReader(){let e=this.toolbar.getElement();e.style.display="block",this.accessibilityService.isScreenReaderOptimized()&&(e.ariaLabel=d(7841,null))}getEditorOptionsFromConfig(){return{wordWrap:this.options.configuration.resultEditor.wordWrap,fontLigatures:this.options.configuration.resultEditor.fontLigatures,bracketPairColorization:this.options.configuration.resultEditor.bracketPairColorization,fontFamily:this.options.configuration.resultEditor.fontFamily==="default"?fu.fontFamily:this.options.configuration.resultEditor.fontFamily,fontSize:this.options.configuration.resultEditor.fontSize,fontWeight:this.options.configuration.resultEditor.fontWeight,lineHeight:this.options.configuration.resultEditor.lineHeight}}layout(e=this.lastLayoutWidth){if(e===void 0)return;this.lastLayoutWidth=e;let t=2,o=mh(this.editorHeader),n=this.diffEditor.getModel()?this.diffEditor.getContentHeight():mh(this.messageElement),r=new si(e-t-this.currentHorizontalPadding*2,o+n);this.element.style.width=`${r.width}px`,this.diffEditor.layout(r.with(void 0,n-t)),this.updatePaddingForLayout()}async render(e,t,o){this.currentHorizontalPadding=e.horizontalPadding||0,e.parentContextKeyService&&this.contextKeyService.updateParent(e.parentContextKeyService),this.options.configuration.resultEditor.wordWrap==="on"&&this.layout(t),await this.updateEditor(e,o),this.layout(t),this.diffEditor.updateOptions({ariaLabel:d(7845,null),readOnly:!!e.isReadOnly}),this.resourceLabel.element.setFile(e.edit.uri,{fileKind:0,fileDecorations:{colors:!0,badges:!1}})}reset(){this.clearWidgets()}clearWidgets(){Pl.get(this.diffEditor.getOriginalEditor())?.hideContentHover(),Pl.get(this.diffEditor.getModifiedEditor())?.hideContentHover(),ff.get(this.diffEditor.getOriginalEditor())?.hideGlyphHover(),ff.get(this.diffEditor.getModifiedEditor())?.hideGlyphHover()}async updateEditor(e,t){if(!Ui(e.element))return;let o=!!(e.edit.state?.applied??0);if(ie.editApplied.bindTo(this.contextKeyService).set(o),this.element.classList.toggle("no-diff",o),o){wo(e.edit.state?.applied);let r=this.labelService.getUriLabel(e.edit.uri,{relative:!0,noPrefix:!0}),s;e.edit.state.applied===1?s=d(7846,null,r):e.edit.state.applied<0?s=d(7848,null,r):s=d(7847,null,e.edit.state.applied,r);let l=zE(s,{renderCodeSegments:!0,actionHandler:{callback:()=>{this.openerService.open(e.edit.uri,{fromUserGesture:!0,allowCommands:!1})},disposables:this._store}});vi(this.messageElement,l)}let n=await e.diffData;if(!o&&n){let r=this.diffEditor.createViewModel({original:n.original,modified:n.modified});if(await r.waitForDiff(),t.isCancellationRequested)return;let s=U.any(n.original.onWillDispose,n.modified.onWillDispose)(()=>{this.diffEditor.setModel(null)});this.diffEditor.setModel(r),this._lastDiffEditorViewModel.value=wn(s,r)}else this.diffEditor.setModel(null),this._lastDiffEditorViewModel.value=void 0;this.toolbar.context={edit:e.edit,element:e.element,diffEditor:this.diffEditor,toggleDiffViewMode:()=>{let s=!!this.diffEditor.getModifiedEditor().contextKeyService.getContextKeyValue(pe.diffEditorInlineMode.key);this.diffEditor.updateOptions({renderSideBySide:s,compactMode:!s,useInlineViewWhenSpaceIsLimited:!1}),this.layout()}}}};ZNe=I([m(5,F),m(6,X),m(7,Tt),m(8,B),m(9,Oi),m(10,rt),m(11,Je)],ZNe);var eOe=class{constructor(i,e,t){this.modelService=i;this.editorService=e;this.dialogService=t;this._sha1=new ume}async apply(i,e,t){if(!i.response.value.includes(e)||e.state?.applied)return;if(!t)for(let n of this.editorService.listDiffEditors()){if(!n.getContainerDomNode().isConnected)continue;let r=n.getModel();if(!r||!Qe(r.original.uri,e.uri)||r.modified.uri.scheme!==Q.vscodeChatCodeCompareBlock){t=n;break}}let o=t?await this._applyWithDiffEditor(t,e):await this._apply(e);i.setEditApplied(e,o)}async _applyWithDiffEditor(i,e){let t=i.getModel();if(!t)return 0;let o=i.getDiffComputationResult();if(!o||o.identical||!await this._checkSha1(t.original,e))return 0;let n=new pR(t.modified),r=o.changes2.map(s=>s.toRangeMapping().toTextEdit(n).toSingleEditOperation());return t.original.pushStackElement(),t.original.pushEditOperations(null,r,()=>null),t.original.pushStackElement(),r.length}async _apply(i){let e=await this.modelService.createModelReference(i.uri);try{if(!await this._checkSha1(e.object.textEditorModel,i))return 0;e.object.textEditorModel.pushStackElement();let t=0;for(let o of i.edits){let n=o.map(SE.asEditOperation);e.object.textEditorModel.pushEditOperations(null,n,()=>null),t+=n.length}return e.object.textEditorModel.pushStackElement(),t}finally{e.dispose()}}async _checkSha1(i,e){return!(e.state?.sha1&&this._sha1.computeSHA1(i)&&this._sha1.computeSHA1(i)!==e.state.sha1&&!(await this.dialogService.confirm({message:d(7849,null),detail:d(7850,null)})).confirmed)}discard(i,e){i.response.value.includes(e)&&(e.state?.applied||i.setEditApplied(e,-1))}};eOe=I([m(0,Bt),m(1,qt),m(2,at)],eOe);var xI=class extends x{constructor(){super(...arguments);this._extension=null}get extension(){return this._extension}set extension(e){this._extension=e,this.update()}update(){this.render()}};function bW(a,i){let e=new N;return e.add(j(a,re.CLICK,AIe(i))),e.add(j(a,re.KEY_UP,t=>{let o=new gi(t);(o.equals(10)||o.equals(3))&&(t.preventDefault(),t.stopPropagation(),i())})),e}var NG=class extends xI{constructor(e){super();this.iconLoadingDisposable=this._register(new me);this.iconErrorDisposable=this._register(new me);this.element=M(e,_(".extension-icon")),this.iconElement=M(this.element,_("img.icon",{alt:""})),this.iconElement.style.display="none",this.defaultIconElement=M(this.element,_(q.asCSSSelector(iKt))),this.defaultIconElement.style.display="none",this.render(),this._register(Z(()=>this.clear()))}clear(){this.iconUrl=void 0,this.iconElement.src="",this.iconElement.style.display="none",this.defaultIconElement.style.display="none",this.iconErrorDisposable.clear(),this.iconLoadingDisposable.clear()}render(){if(!this.extension){this.clear();return}this.extension.iconUrl?this.iconUrl!==this.extension.iconUrl&&(this.iconElement.style.display="inherit",this.defaultIconElement.style.display="none",this.iconUrl=this.extension.iconUrl,this.iconErrorDisposable.value=j(this.iconElement,"error",()=>{this.extension?.iconUrlFallback?this.iconElement.src=this.extension.iconUrlFallback:(this.iconElement.style.display="none",this.defaultIconElement.style.display="inherit")},{once:!0}),this.iconElement.src=this.iconUrl,this.iconElement.complete?this.iconElement.style.visibility="inherit":(this.iconElement.style.visibility="hidden",this.iconLoadingDisposable.value=j(this.iconElement,"load",()=>{this.iconElement.style.visibility="inherit"}))):(this.iconUrl=void 0,this.iconElement.style.display="none",this.iconElement.src="",this.defaultIconElement.style.display="inherit",this.iconErrorDisposable.clear(),this.iconLoadingDisposable.clear())}},ZH=class extends xI{constructor(e,t,o){super();this.container=e;this.small=t;this.hoverService=o;this.disposables=this._register(new N);this.render(),this._register(Z(()=>this.clear()))}clear(){this.container.innerText="",this.disposables.clear()}render(){if(this.clear(),!this.extension||this.small&&this.extension.state!==3)return;let e=ZH.getInstallLabel(this.extension,this.small);if(!e)return;let t=this.small?this.container:M(this.container,_("span.install",{tabIndex:0}));M(t,_("span"+q.asCSSSelector(fEi)));let o=M(t,_("span.count"));o.textContent=e,this.small||this.disposables.add(this.hoverService.setupManagedHover(Ri("mouse"),this.container,d(10597,null)))}static getInstallLabel(e,t){let o=e.installCount;if(!o)return;let n;return t?o>1e6?n=`${Math.floor(o/1e5)/10}M`:o>1e3?n=`${Math.floor(o/1e3)}K`:n=String(o):n=o.toLocaleString(wr),n}};ZH=I([m(2,nt)],ZH);var Iie=class extends xI{constructor(e,t,o,n){super();this.container=e;this.small=t;this.hoverService=o;this.openerService=n;this.disposables=this._register(new N);e.classList.add("extension-ratings"),this.small&&e.classList.add("small"),this.render(),this._register(Z(()=>this.clear()))}clear(){this.container.innerText="",this.disposables.clear()}render(){if(this.clear(),!this.extension||this.small&&this.extension.state!==3||this.extension.rating===void 0||this.small&&!this.extension.ratingCount||!this.extension.url)return;let e=Math.round(this.extension.rating*2)/2;if(this.small){M(this.container,_("span"+q.asCSSSelector(Ctt)));let t=M(this.container,_("span.count"));t.textContent=String(e)}else{let t=M(this.container,_("span.rating.clickable",{tabIndex:0}));for(let o=1;o<=5;o++)e>=o?M(t,_("span"+q.asCSSSelector(Ctt))):e>=o-.5?M(t,_("span"+q.asCSSSelector(jmo))):M(t,_("span"+q.asCSSSelector(bUt)));if(this.extension.ratingCount){let o=M(t,_("span",void 0,` (${this.extension.ratingCount})`));o.style.paddingLeft="1px"}this.containerHover=this._register(this.hoverService.setupManagedHover(Ri("mouse"),t,"")),this.containerHover.update(d(10604,null,e)),t.setAttribute("role","link"),this.extension.ratingUrl&&this.disposables.add(bW(t,()=>this.openerService.open(A.parse(this.extension.ratingUrl))))}}};Iie=I([m(2,nt),m(3,Je)],Iie);var yie=class extends xI{constructor(e,t,o,n,r){super();this.container=e;this.small=t;this.extensionsWorkbenchService=o;this.hoverService=n;this.openerService=r;this.disposables=this._register(new N);this.render(),this._register(Z(()=>this.clear()))}clear(){this.element?.remove(),this.disposables.clear()}render(){if(this.clear(),!this.extension||this.extension.resourceExtension||this.extension.local?.source==="resource")return;this.element=M(this.container,_(".publisher"));let e=_(".publisher-name.ellipsis");e.textContent=this.extension.publisherDisplayName;let t=_(".verified-publisher");if(M(t,_("span.extension-verified-publisher.clickable"),Sn(gW)),this.small)this.extension.publisherDomain?.verified&&M(this.element,t),M(this.element,e);else{if(this.element.classList.toggle("clickable",!!this.extension.url),this.element.setAttribute("role","button"),this.element.tabIndex=0,this.containerHover=this.disposables.add(this.hoverService.setupManagedHover(Ri("mouse"),this.element,d(10602,null,this.extension.publisherDisplayName))),M(this.element,e),this.extension.publisherDomain?.verified){M(this.element,t);let o=A.parse(this.extension.publisherDomain.link);t.tabIndex=0,t.setAttribute("role","button"),this.containerHover.update(d(10616,null,this.extension.publisherDomain.link)),t.setAttribute("role","link"),M(t,_("span.extension-verified-publisher-domain",void 0,o.authority.startsWith("www.")?o.authority.substring(4):o.authority)),this.disposables.add(bW(t,()=>this.openerService.open(o)))}this.extension.url&&this.disposables.add(bW(this.element,()=>this.extensionsWorkbenchService.openSearch(`publisher:"${this.extension?.publisherDisplayName}"`)))}}};yie=I([m(2,Hi),m(3,nt),m(4,Je)],yie);var tOe=class extends xI{constructor(e,t,o){super();this.container=e;this.hoverService=t;this.openerService=o;this.disposables=this._register(new N);this.render()}render(){if(vi(this.container),this.disposables.clear(),!this.extension?.publisherSponsorLink)return;let e=M(this.container,_("span.sponsor.clickable",{tabIndex:0}));this.disposables.add(this.hoverService.setupManagedHover(Ri("mouse"),e,this.extension?.publisherSponsorLink.toString()??"")),e.setAttribute("role","link");let t=Sn(wtt),o=_("span",void 0,d(10609,null));M(e,t,o),this.disposables.add(bW(e,()=>{this.openerService.open(this.extension.publisherSponsorLink)}))}};tOe=I([m(1,nt),m(2,Je)],tOe);var iOe=class extends xI{constructor(e,t){super();this.parent=e;this.extensionRecommendationsService=t;this.disposables=this._register(new N);this.render(),this._register(Z(()=>this.clear())),this._register(this.extensionRecommendationsService.onDidChangeRecommendations(()=>this.render()))}clear(){this.element?.remove(),this.element=void 0,this.disposables.clear()}render(){if(this.clear(),!this.extension||this.extension.state===1||this.extension.deprecationInfo)return;if(this.extensionRecommendationsService.getAllRecommendationsWithReason()[this.extension.identifier.id.toLowerCase()]){this.element=M(this.parent,_("div.extension-bookmark"));let t=M(this.element,_(".recommendation"));M(t,_("span"+q.asCSSSelector($mo)))}}};iOe=I([m(1,BD)],iOe);var sKt=class extends xI{constructor(e){super();this.parent=e;this.disposables=this._register(new N);this.render(),this._register(Z(()=>this.clear()))}clear(){this.element?.remove(),this.element=void 0,this.disposables.clear()}render(){if(this.clear(),this.extension?.state===1?this.extension.preRelease:this.extension?.hasPreReleaseVersion){this.element=M(this.parent,_("div.extension-bookmark"));let e=M(this.element,_(".pre-release"));M(e,_("span"+q.asCSSSelector(bEi)))}}},wie=class extends xI{constructor(e,t,o,n){super();this.tooltip=t;this.extensionManagementServerService=o;this.instantiationService=n;this.remoteBadge=this._register(new me);this.element=M(e,_("")),this.render(),this._register(Z(()=>this.clear()))}clear(){this.remoteBadge.value?.element.remove(),this.remoteBadge.clear()}render(){if(this.clear(),!this.extension||!this.extension.local||!this.extension.server||!(this.extensionManagementServerService.localExtensionManagementServer&&this.extensionManagementServerService.remoteExtensionManagementServer)||this.extension.server!==this.extensionManagementServerService.remoteExtensionManagementServer)return;let e;this.tooltip&&this.extensionManagementServerService.remoteExtensionManagementServer&&(e=d(10606,null,this.extensionManagementServerService.remoteExtensionManagementServer.label)),this.remoteBadge.value=this.instantiationService.createInstance(lge,qmo,e),M(this.element,this.remoteBadge.value.element)}};wie=I([m(2,Ec),m(3,F)],wie);var lge=class extends x{constructor(e,t,o,n,r){super();this.icon=e;this.tooltip=t;this.labelService=n;this.themeService=r;this.element=_("div.extension-badge.extension-icon-badge"),this.elementHover=this._register(o.setupManagedHover(Ri("mouse"),this.element,"")),this.render()}render(){M(this.element,_("span"+q.asCSSSelector(this.icon)));let e=()=>{if(!this.element)return;let t=this.themeService.getColorTheme().getColor(PZi),o=this.themeService.getColorTheme().getColor(AZi);this.element.style.backgroundColor=t?t.toString():"",this.element.style.color=o?o.toString():""};if(e(),this._register(this.themeService.onDidColorThemeChange(()=>e())),this.tooltip){let t=()=>{this.element&&this.elementHover.update(this.tooltip)};this._register(this.labelService.onDidChangeFormatters(()=>t())),t()}}};lge=I([m(2,nt),m(3,rt),m(4,Le)],lge);var aKt=class extends xI{constructor(e){super();this.parent=e;this.render(),this._register(Z(()=>this.clear()))}clear(){this.element?.remove(),this.countBadge?.dispose(),this.countBadge=void 0}render(){this.clear(),!(!this.extension||!this.extension.categories?.some(e=>e.toLowerCase()==="extension packs")||!this.extension.extensionPack.length)&&(this.element=M(this.parent,_(".extension-badge.extension-pack-badge")),this.countBadge=new _v(this.element,{},iI),this.countBadge.setCount(this.extension.extensionPack.length))}},Cie=class extends xI{constructor(e,t,o,n,r,s,l,c){super();this.container=e;this.small=t;this.hoverService=o;this.contextService=n;this.uriIdentityService=r;this.explorerService=s;this.viewsService=l;this.extensionGalleryManifest=null;this.disposables=this._register(new N);this.render(),this._register(Z(()=>this.clear())),c.getExtensionGalleryManifest().then(u=>{this._store.isDisposed||(this.extensionGalleryManifest=u,this.render())})}clear(){this.element?.remove(),this.disposables.clear()}render(){if(this.clear(),!this.extension)return;if(this.extension?.private){this.element=M(this.container,_(".extension-kind-indicator")),(!this.small||this.extensionGalleryManifest?.capabilities.extensions?.includePublicExtensions&&this.extensionGalleryManifest?.capabilities.extensions?.includePrivateExtensions)&&M(this.element,_("span"+q.asCSSSelector(vEi))),this.small||M(this.element,_("span.private-extension-label",void 0,d(10601,null)));return}if(!this.small)return;let e=this.extension.resourceExtension?.location??(this.extension.local?.source==="resource"?this.extension.local?.location:void 0);if(!e)return;this.element=M(this.container,_(".extension-kind-indicator"));let t=this.contextService.getWorkspaceFolder(e);t&&this.extension.isWorkspaceScoped?(this.element.textContent=d(10617,null),this.element.classList.add("clickable"),this.element.setAttribute("role","button"),this.disposables.add(this.hoverService.setupManagedHover(Ri("mouse"),this.element,this.uriIdentityService.extUri.relativePath(t.uri,e))),this.disposables.add(bW(this.element,()=>{this.viewsService.openView(Fb,!0).then(()=>this.explorerService.select(e,!0))}))):(this.disposables.add(this.hoverService.setupManagedHover(Ri("mouse"),this.element,e.path)),this.element.textContent=d(10598,null))}};Cie=I([m(2,nt),m(3,Pe),m(4,ht),m(5,Oa),m(6,$t),m(7,Dv)],Cie);var oOe=class extends xI{constructor(e,t,o,n,r){super();this.container=e;this.configurationService=t;this.extensionsWorkbenchService=o;this.hoverService=n;this.userDataSyncEnablementService=r;this.disposables=this._register(new N);this._register(U.filter(this.configurationService.onDidChangeConfiguration,s=>s.affectsConfiguration("settingsSync.ignoredExtensions"))(()=>this.render())),this._register(r.onDidChangeEnablement(()=>this.update())),this.render()}render(){if(this.disposables.clear(),this.container.innerText="",this.extension&&this.extension.state===1&&this.userDataSyncEnablementService.isEnabled()&&this.extensionsWorkbenchService.isExtensionIgnoredToSync(this.extension)){let e=M(this.container,_("span.extension-sync-ignored"+q.asCSSSelector(ytt)));this.disposables.add(this.hoverService.setupManagedHover(Ri("mouse"),e,d(10611,null))),e.classList.add(...q.asClassNameArray(ytt))}}};oOe=I([m(1,B),m(2,Hi),m(3,nt),m(4,Fl)],oOe);var nOe=class extends xI{constructor(e,t){super();this.container=e;this.hoverService=t;this.disposables=this._register(new N)}render(){this.disposables.clear(),this.container.innerText="";let e=this.extension?.runtimeState,t=typeof e?.reason=="string"?e.reason:"";if(e&&/restart|reload/i.test(t)){let o=M(this.container,_("span.extension-restart-required"+q.asCSSSelector(Ymo)));M(this.container,_("span.extension-restart-required-label",void 0,d(10607,null))),this.disposables.add(this.hoverService.setupManagedHover(Ri("mouse"),o,t))}}};nOe=I([m(1,nt)],nOe);var rOe=class extends xI{constructor(e,t,o,n,r){super();this.extensionViewState=e;this.container=t;this.extensionFeaturesManagementService=n;this.extensionsWorkbenchService=r;this._register(o.onDidChangeExtensionsStatus(s=>{this.extension&&s.some(l=>Ut({id:l.value},this.extension.identifier))&&this.update()})),this._register(n.onDidChangeAccessData(s=>{this.extension&&Ii.equals(this.extension.identifier.id,s.extension)&&this.update()}))}render(){if(this.container.innerText="",!this.extension)return;if(this.extensionViewState.filters.featureId&&this.extension.state===1){let t=this.extensionFeaturesManagementService.getAllAccessDataForExtension(new Ii(this.extension.identifier.id)).get(this.extensionViewState.filters.featureId),o=ne.as(As.ExtensionFeaturesRegistry).getExtensionFeature(this.extensionViewState.filters.featureId);if(o?.icon&&t){let n=M(this.container,_("span.activationTime"));n.textContent=d(10594,null,t.accessTimes.length);let r=M(this.container,_("span"+q.asCSSSelector(o.icon)));r.style.paddingLeft="4px";return}}let e=this.extensionsWorkbenchService.getExtensionRuntimeStatus(this.extension);if(e?.activationTimes){let t=e.activationTimes.codeLoadingTime+e.activationTimes.activateCallTime;M(this.container,_("span"+q.asCSSSelector(Qmo)));let o=M(this.container,_("span.activationTime"));o.textContent=`${t}ms`}}};rOe=I([m(2,lt),m(3,cy),m(4,Hi)],rOe);var xie=class extends xI{constructor(e,t,o,n,r,s,l,c,u){super();this.options=e;this.extensionStatusAction=t;this.extensionsWorkbenchService=o;this.extensionFeaturesManagementService=n;this.hoverService=r;this.configurationService=s;this.extensionRecommendationsService=l;this.themeService=c;this.contextService=u;this.hover=this._register(new me)}render(){this.hover.value=void 0,this.extension&&(this.hover.value=this.hoverService.setupManagedHover({delay:this.configurationService.getValue("workbench.hover.delay"),showHover:(e,t)=>this.hoverService.showInstantHover({...e,additionalClasses:["extension-hover"],position:{hoverPosition:this.options.position(),forcePosition:!0},persistence:{hideOnKeyDown:!0}},t),placement:"element"},this.options.target,{markdown:()=>Promise.resolve(this.getHoverMarkdown()),markdownNotSupportedFallback:void 0},{appearance:{showHoverHint:!0}}))}getHoverMarkdown(){if(!this.extension)return;let e=new Ie("",{isTrusted:!0,supportThemeIcons:!0});e.appendMarkdown(`**${this.extension.displayName}**`),dTe(this.extension.version)&&e.appendMarkdown(`&nbsp;<span style="background-color:#8080802B;">**&nbsp;_v${this.extension.version}${this.extension.isPreReleaseVersion?" (pre-release)":""}_**&nbsp;</span>`),e.appendText(`
`);let t=!1;if(this.extension.private&&(e.appendMarkdown(`$(${vEi.id}) ${d(10601,null)}`),t=!0),this.extension.state===1){let p=ZH.getInstallLabel(this.extension,!0);if(p&&(t&&e.appendText("  |  "),e.appendMarkdown(`$(${fEi.id}) ${p}`),t=!0),this.extension.rating){t&&e.appendText("  |  ");let h=Math.round(this.extension.rating*2)/2;e.appendMarkdown(`$(${Ctt.id}) [${h}](${this.extension.url}&ssr=false#review-details)`),t=!0}this.extension.publisherSponsorLink&&(t&&e.appendText("  |  "),e.appendMarkdown(`$(${wtt.id}) [${d(10609,null)}](${this.extension.publisherSponsorLink})`),t=!0)}t&&e.appendText(`
`);let o=this.extension.resourceExtension?.location??(this.extension.local?.source==="resource"?this.extension.local?.location:void 0);if(o&&(this.extension.isWorkspaceScoped&&this.contextService.isInsideWorkspace(o)?e.appendMarkdown(d(10617,null)):e.appendMarkdown(d(10598,null)),e.appendText(`
`)),this.extension.description&&(e.appendMarkdown(`${this.extension.description}`),e.appendText(`
`)),this.extension.publisherDomain?.verified){let p=this.themeService.getColorTheme().getColor(kot),h=d(10603,null,`[${A.parse(this.extension.publisherDomain.link).authority}](${this.extension.publisherDomain.link})`);e.appendMarkdown(`<span style="color:${p?We.Format.CSS.formatHex(p):"#ffffff"};">$(${gW.id})</span>&nbsp;${h}`),e.appendText(`
`)}this.extension.outdated&&(e.appendMarkdown(d(10615,null)),e.appendMarkdown(`&nbsp;<span style="background-color:#8080802B;">**&nbsp;_v${this.extension.latestVersion}_**&nbsp;</span>`),e.appendText(`
`));let n=xie.getPreReleaseMessage(this.extension),r=this.extensionsWorkbenchService.getExtensionRuntimeStatus(this.extension),s=this.extensionFeaturesManagementService.getAllAccessDataForExtension(new Ii(this.extension.identifier.id)),l=this.extensionStatusAction.status,c=this.extension.runtimeState,u=this.getRecommendationMessage(this.extension);if(r||s.size||l.length||c||u||n){if(e.appendMarkdown("---"),e.appendText(`
`),r){if(r.activationTimes){let p=r.activationTimes.codeLoadingTime+r.activationTimes.activateCallTime;e.appendMarkdown(`${d(10589,null)}${r.activationTimes.activationReason.startup?` (${d(10610,null)})`:""}: \`${p}ms\``),e.appendText(`
`)}if(r.runtimeErrors.length||r.messages.length){let p=r.runtimeErrors.length||r.messages.some(v=>v.type===bt.Error),h=r.messages.some(v=>v.type===bt.Warning),g=r.runtimeErrors.length?`[${r.runtimeErrors.length===1?d(10613,null):d(10614,null,r.runtimeErrors.length)}](${fc("extension.open",this.extension.identifier.id,"features")})`:void 0,f=r.messages.length?`[${r.messages.length===1?d(10599,null):d(10600,null,r.messages.length)}](${fc("extension.open",this.extension.identifier.id,"features")})`:void 0;e.appendMarkdown(`$(${p?OS.id:h?Gu.id:Ug.id}) This extension has reported `),g&&f?e.appendMarkdown(`${g} and ${f}`):e.appendMarkdown(`${g||f}`),e.appendText(`
`)}}if(s.size){let p=ne.as(As.ExtensionFeaturesRegistry);for(let[h,g]of s)if(g?.accessTimes.length){let f=p.getExtensionFeature(h);f&&(e.appendMarkdown(d(10595,null,f.label)),e.appendMarkdown(`: [${d(10612,null,g.accessTimes.length,f.accessDataLabel??f.label)}](${fc("extension.open",this.extension.identifier.id,"features")})`),e.appendText(`
`))}}for(let p of l)p.icon&&e.appendMarkdown(`$(${p.icon.id})&nbsp;`),e.appendMarkdown(p.message.value),e.appendText(`
`);if(c&&(e.appendMarkdown(`$(${Ug.id})&nbsp;`),e.appendMarkdown(`${c.reason}`),e.appendText(`
`)),n){let p=this.themeService.getColorTheme().getColor(Ltn);e.appendMarkdown(`<span style="color:${p?We.Format.CSS.formatHex(p):"#ffffff"};">$(${bEi.id})</span>&nbsp;${n}`),e.appendText(`
`)}u&&(e.appendMarkdown(u),e.appendText(`
`))}return e}getRecommendationMessage(e){if(e.state===1||e.deprecationInfo)return;let t=this.extensionRecommendationsService.getAllRecommendationsWithReason()[e.identifier.id.toLowerCase()];if(!t?.reasonText)return;let o=this.themeService.getColorTheme().getColor(Jmo);return`<span style="color:${o?We.Format.CSS.formatHex(o):"#ffffff"};">$(${bUt.id})</span>&nbsp;${t.reasonText}`}static getPreReleaseMessage(e){if(!e.hasPreReleaseVersion||e.isBuiltin||e.isPreReleaseVersion||e.preRelease)return;let t=`[${d(10608,null)}](${fc("workbench.extensions.action.showPreReleaseVersion",e.identifier.id)})`;return d(10596,null,t)}};xie=I([m(2,Hi),m(3,cy),m(4,nt),m(5,B),m(6,BD),m(7,Le),m(8,Pe)],xie);var sOe=class extends xI{constructor(e,t,o){super();this.container=e;this.extensionStatusAction=t;this.markdownRendererService=o;this.renderDisposables=this._register(new me);this._onDidRender=this._register(new E);this.onDidRender=this._onDidRender.event;this.render(),this._register(t.onDidChangeStatus(()=>this.render()))}render(){vi(this.container),this.renderDisposables.value=void 0;let e=new N;this.renderDisposables.value=e;let t=this.extensionStatusAction.status;if(t.length){let o=new Ie("",{isTrusted:!0,supportThemeIcons:!0});for(let r=0;r<t.length;r++){let s=t[r];s.icon&&o.appendMarkdown(`$(${s.icon.id})&nbsp;`),o.appendMarkdown(s.message.value),r<t.length-1&&o.appendText(`
`)}let n=e.add(this.markdownRendererService.render(o));M(this.container,n.element)}this._onDidRender.fire()}};sOe=I([m(2,On)],sOe);var aOe=class extends xI{constructor(e,t,o){super();this.container=e;this.extensionRecommendationsService=t;this.extensionIgnoredRecommendationsService=o;this._onDidRender=this._register(new E);this.onDidRender=this._onDidRender.event;this.render(),this._register(this.extensionRecommendationsService.onDidChangeRecommendations(()=>this.render()))}render(){vi(this.container);let e=this.getRecommendationStatus();e&&(e.icon&&M(this.container,_(`div${q.asCSSSelector(e.icon)}`)),M(this.container,_("div.recommendation-text",void 0,e.message))),this._onDidRender.fire()}getRecommendationStatus(){if(!this.extension||this.extension.deprecationInfo||this.extension.state===1)return;let e=this.extensionRecommendationsService.getAllRecommendationsWithReason();if(e[this.extension.identifier.id.toLowerCase()]){let t=e[this.extension.identifier.id.toLowerCase()].reasonText;if(t)return{icon:bUt,message:t}}else if(this.extensionIgnoredRecommendationsService.globalIgnoredRecommendations.indexOf(this.extension.identifier.id.toLowerCase())!==-1)return{icon:void 0,message:d(10605,null)}}};aOe=I([m(1,BD),m(2,Ok)],aOe);var Dtn=te("extensionIcon.starForeground",{light:"#DF6100",dark:"#FF8E00",hcDark:"#FF8E00",hcLight:nS},d(10592,null),!1),Ltn=te("extensionIcon.preReleaseForeground",{dark:"#1d9271",light:"#1d9271",hcDark:"#1d9271",hcLight:nS},d(10593,null),!1),y_p=te("extensionIcon.sponsorForeground",{light:"#B51E78",dark:"#D758B3",hcDark:null,hcLight:"#B51E78"},d(10591,null),!1),Rtn=te("extensionIcon.privateForeground",{dark:"#ffffff60",light:"#00000060",hcDark:"#ffffff60",hcLight:"#00000060"},d(10590,null));is((a,i)=>{let e=a.getColor(Dtn);e&&(i.addRule(`.extension-ratings .codicon-extensions-star-full, .extension-ratings .codicon-extensions-star-half { color: ${e}; }`),i.addRule(`.monaco-hover.extension-hover .markdown-hover .hover-contents ${q.asCSSSelector(Ctt)} { color: ${e}; }`));let t=a.getColor(kot);t&&i.addRule(`${q.asCSSSelector(gW)} { color: ${t}; }`),i.addRule(`.monaco-hover.extension-hover .markdown-hover .hover-contents ${q.asCSSSelector(wtt)} { color: var(--vscode-extensionIcon-sponsorForeground); }`),i.addRule(`.extension-editor > .header > .details > .subtitle .sponsor ${q.asCSSSelector(wtt)} { color: var(--vscode-extensionIcon-sponsorForeground); }`);let o=a.getColor(Rtn);o&&i.addRule(`.extension-private-badge { color: ${o}; }`)});var Mtn=72,lOe=class{getHeight(){return Mtn}getTemplateId(){return"extension"}},cge=class{constructor(i,e,t,o,n,r,s,l){this.extensionViewState=i;this.options=e;this.instantiationService=t;this.notificationService=o;this.extensionService=n;this.extensionsWorkbenchService=r;this.extensionEnablementService=s;this.contextMenuService=l}get templateId(){return"extension"}renderTemplate(i){let e=this.instantiationService.createInstance(iOe,M(i,_(".extension-bookmark-container"))),t=this.instantiationService.createInstance(sKt,M(i,_(".extension-bookmark-container"))),o=M(i,_(".extension-list-item")),n=M(o,_(".icon-container")),r=this.instantiationService.createInstance(NG,n),s=this.instantiationService.createInstance(wie,n,!1),l=this.instantiationService.createInstance(aKt,n),c=M(o,_(".details")),u=M(c,_(".header-container")),p=M(u,_(".header")),h=M(p,_("span.name")),g=M(p,_("span.restart-required")),f=M(p,_("span.install-count")),v=M(p,_("span.ratings")),b=M(p,_("span.sync-ignored")),S=M(p,_("span")),y=M(p,_("span.activation-status")),w=M(c,_(".description.ellipsis")),k=M(c,_(".footer")),T=this.instantiationService.createInstance(yie,M(k,_(".publisher-container")),!0),P=new Zi(k,{actionViewItemProvider:(he,oe)=>{if(he instanceof IG)return new TPe(he,{...oe,icon:!0,label:!0,menuActionsOrProvider:{getActions:()=>he.menuActions},menuActionClassNames:he.menuActionClassNames},this.contextMenuService);if(he instanceof UH)return he.createActionViewItem(oe)},focusOnlyEnabledItems:!0});P.setFocusable(!1);let O=P.onDidRun(({error:he})=>he&&this.notificationService.error(he)),V=this.instantiationService.createInstance(qD),H=[this.instantiationService.createInstance(Z0),this.instantiationService.createInstance(J0,!0),this.instantiationService.createInstance(YA,!1),this.instantiationService.createInstance(cte),this.instantiationService.createInstance(_Pe),this.instantiationService.createInstance(wM),this.instantiationService.createInstance(vx),this.instantiationService.createInstance(u8,!1),this.instantiationService.createInstance(dte),this.instantiationService.createInstance(ute),V,this.instantiationService.createInstance(XA)],G=this.instantiationService.createInstance(xie,{target:i,position:this.options.hoverOptions.position},V),$=[r,e,t,s,l,T,G,this.instantiationService.createInstance(oOe,b),this.instantiationService.createInstance(nOe,g),this.instantiationService.createInstance(rOe,this.extensionViewState,y),this.instantiationService.createInstance(ZH,f,!0),this.instantiationService.createInstance(Iie,v,!0),this.instantiationService.createInstance(Cie,S,!0)],J=this.instantiationService.createInstance(PJ,[...H,...$]);P.push(H,{icon:!0,label:!0});let ae=wn(...H,...$,P,O,J);return{root:i,element:o,name:h,installCount:f,ratings:v,description:w,disposables:[ae],actionbar:P,extensionDisposables:[],set extension(he){J.extension=he}}}renderPlaceholder(i,e){e.element.classList.add("loading"),e.root.removeAttribute("aria-label"),e.root.removeAttribute("data-extension-id"),e.extensionDisposables=Be(e.extensionDisposables),e.name.textContent="",e.description.textContent="",e.installCount.style.display="none",e.ratings.style.display="none",e.extension=null}renderElement(i,e,t){t.element.classList.remove("loading"),t.root.setAttribute("data-extension-id",i.identifier.id),i.state!==3&&!i.server&&(i=this.extensionsWorkbenchService.local.filter(n=>n.server===i.server&&Ut(n.identifier,i.identifier))[0]||i),t.extensionDisposables=Be(t.extensionDisposables);let o=()=>{let n=i.state===1&&!!i.local&&!this.extensionEnablementService.isEnabled(i.local),r=!!i.deprecationInfo;t.element.classList.toggle("deprecated",r),t.root.classList.toggle("disabled",n)};o(),this.extensionService.onDidChangeExtensions(()=>o(),this,t.extensionDisposables),t.name.textContent=i.displayName,t.description.textContent=i.description,t.installCount.style.display="",t.ratings.style.display="",t.extension=i,i.gallery&&i.gallery.properties&&i.gallery.properties.localizedLanguages&&i.gallery.properties.localizedLanguages.length&&(t.description.textContent=i.gallery.properties.localizedLanguages.map(n=>n[0].toLocaleUpperCase()+n.slice(1)).join(", ")),this.extensionViewState.onFocus(n=>{Ut(i.identifier,n.identifier)&&t.actionbar.setFocusable(!0)},this,t.extensionDisposables),this.extensionViewState.onBlur(n=>{Ut(i.identifier,n.identifier)&&t.actionbar.setFocusable(!1)},this,t.extensionDisposables)}disposeElement(i,e,t){t.extensionDisposables=Be(t.extensionDisposables)}disposeTemplate(i){i.extensionDisposables=Be(i.extensionDisposables),i.disposables=Be(i.disposables)}};cge=I([m(2,F),m(3,Ne),m(4,lt),m(5,Hi),m(6,Js),m(7,Xe)],cge);is((a,i)=>{let e=a.getColor(kot);if(e){let t=e.transparent(.5).makeOpaque(CF(a));i.addRule(`.extensions-list .monaco-list .monaco-list-row.disabled:not(.selected) .author .verified-publisher ${q.asCSSSelector(gW)} { color: ${t}; }`)}});function qvo(a){return{isResolved:!!a,promise:null,cts:null,promiseIndexes:new Set,elements:a||[]}}function MDi(a){return{firstPage:a,total:a.length,pageSize:a.length,getPage:(i,e)=>Promise.resolve(a)}}var Wm=class{constructor(i){this.pages=[];this.onDidIncrementLength=U.None;this.pager=Array.isArray(i)?MDi(i):i;let e=Math.ceil(this.pager.total/this.pager.pageSize);this.pages=[qvo(this.pager.firstPage.slice()),...Ig(e-1).map(()=>qvo())]}get length(){return this.pager.total}isResolved(i){let e=Math.floor(i/this.pager.pageSize);return!!this.pages[e].isResolved}get(i){let e=Math.floor(i/this.pager.pageSize),t=i%this.pager.pageSize;return this.pages[e].elements[t]}resolve(i,e){if(e.isCancellationRequested)return Promise.reject(new go);let t=Math.floor(i/this.pager.pageSize),o=i%this.pager.pageSize,n=this.pages[t];if(n.isResolved)return Promise.resolve(n.elements[o]);n.promise||(n.cts=new Ye,n.promise=this.pager.getPage(t,n.cts.token).then(s=>{n.elements=s,n.isResolved=!0,n.promise=null,n.cts=null},s=>(n.isResolved=!1,n.promise=null,n.cts=null,Promise.reject(s))));let r=e.onCancellationRequested(()=>{n.cts&&(n.promiseIndexes.delete(i),n.promiseIndexes.size===0&&n.cts.cancel())});return n.promiseIndexes.add(i),n.promise.then(()=>n.elements[o]).finally(()=>r.dispose())}},eQ=class{constructor(i,e=500){this.model=i;this.timeout=e}get length(){return this.model.length}get onDidIncrementLength(){return this.model.onDidIncrementLength}isResolved(i){return this.model.isResolved(i)}get(i){return this.model.get(i)}resolve(i,e){return new Promise((t,o)=>{if(e.isCancellationRequested)return o(new go);let n=setTimeout(()=>{if(e.isCancellationRequested)return o(new go);r.dispose(),this.model.resolve(i,e).then(t,o)},this.timeout),r=e.onCancellationRequested(()=>{clearTimeout(n),r.dispose(),o(new go)})})}};var lKt=class{constructor(i){this.items=[];this._hasNextPage=!0;this._onDidIncrementLength=new E;this.loadingPromise=null;this.pager=i,this.items=[...i.firstPage.items],this._hasNextPage=i.firstPage.hasMore}get onDidIncrementLength(){return this._onDidIncrementLength.event}get length(){return this.items.length+(this._hasNextPage?1:0)}isResolved(i){return i===this.items.length&&this._hasNextPage?!1:i<this.items.length}get(i){if(i<this.items.length)return this.items[i];throw new Error("Item not resolved yet")}async resolve(i,e){if(e.isCancellationRequested)return Promise.reject(new go);if(i===this.items.length&&this._hasNextPage&&await this.loadNextPage(e),i<this.items.length)return this.items[i];throw new Error("Index out of bounds")}async loadNextPage(i){if(!this._hasNextPage)return;if(this.loadingPromise){await this.loadingPromise;return}let e=this.pager.getNextPage(i);this.loadingPromise=e.then(t=>{this.items.push(...t.items),this._hasNextPage=t.hasMore,this.loadingPromise=null,this._onDidIncrementLength.fire(this.length)},t=>{throw this.loadingPromise=null,t}),await this.loadingPromise}dispose(){this._onDidIncrementLength.dispose()}};function $vo(a){if(!a)return"";let i=a.publisherDomain?.verified?d(10532,null,a.publisherDisplayName):d(10530,null,a.publisherDisplayName),e=a?.deprecationInfo?d(10529,null):"",t=a?.rating?d(10531,null,a.rating.toFixed(2),a.ratingCount):"";return`${a.displayName}, ${e?`${e}, `:""}${a.version}, ${i}, ${a.description} ${t?`, ${t}`:""}`}var kie=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this.extensionsWorkbenchService=r;this.contextMenuService=u;this.contextKeyService=p;this.instantiationService=h;this.logService=g;this.contextMenuActionRunner=this._register(new rs);this.modalNavigationDisposable=this._register(new me);this._register(this.contextMenuActionRunner.onDidRun(({error:b})=>b&&c.error(b)));let f=new lOe,v=h.createInstance(cge,n,{hoverOptions:{position:()=>{let b=s.getViewLocationById(t);return b===0?l.getSideBarPosition()===0?1:0:b===2?l.getSideBarPosition()===0?0:1:1}}});this.list=h.createInstance(Qz,`${t}-Extensions`,e,f,[v],{multipleSelectionSupport:!1,setRowLineHeight:!1,horizontalScrolling:!1,accessibilityProvider:{getAriaLabel(b){return $vo(b)},getWidgetAriaLabel(){return d(10533,null)}},overrideStyles:h2(s.getViewLocationById(t)).listOverrideStyles,openOnSingleClick:!0,...o}),this._register(this.list.onContextMenu(b=>this.onContextMenu(b),this)),this._register(this.list),this._register(U.debounce(U.filter(this.list.onDidOpen,b=>b.element!==null),(b,S)=>S,75,!0)(b=>{this.openExtension(b.element,{sideByside:b.sideBySide,...b.editorOptions})}))}setModel(e){this.list.model=new eQ(e)}layout(e,t){this.list.layout(e,t)}openExtension(e,t){e=this.extensionsWorkbenchService.local.filter(o=>Ut(o.identifier,e.identifier))[0]||e,this.extensionsWorkbenchService.open(e,{...t,modal:t.sideByside?void 0:NDi(e,()=>this.list.model,(o,n)=>Ut(o.identifier,n.identifier),(o,n)=>this.extensionsWorkbenchService.open(o,{pinned:!1,modal:n}),this.modalNavigationDisposable,this.logService)})}async onContextMenu(e){if(e.element){let t=new N,o=t.add(this.instantiationService.createInstance(XA)),n=e.element&&this.extensionsWorkbenchService.local.find(l=>Ut(l.identifier,e.element.identifier)&&(!e.element.server||e.element.server===l.server))||e.element;o.extension=n;let r=[];o.enabled?r=await o.getActionGroups():n&&(r=await yEi(n,this.contextKeyService,this.instantiationService),r.forEach(l=>l.forEach(c=>{c instanceof Sa&&(c.extension=n)})));let s=[];for(let l of r){for(let c of l)s.push(c),jc(c)&&t.add(c);s.push(new ri)}s.pop(),this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>s,actionRunner:this.contextMenuActionRunner,onHide:()=>t.dispose()})}}};kie=I([m(4,Hi),m(5,Bi),m(6,yi),m(7,Ne),m(8,Xe),m(9,X),m(10,F),m(11,se)],kie);var cOe=class extends x{constructor(e,t,o){super();this.instantiationService=o;this.element=M(e,_(".extensions-grid-view")),this.renderer=this.instantiationService.createInstance(cge,{onFocus:U.None,onBlur:U.None,filters:{}},{hoverOptions:{position(){return 2}}}),this.delegate=t,this.disposableStore=this._register(new N)}setExtensions(e){this.disposableStore.clear(),e.forEach((t,o)=>this.renderExtension(t,o))}renderExtension(e,t){let o=M(this.element,_(".extension-container"));o.style.height=`${this.delegate.getHeight()}px`,o.setAttribute("tabindex","0");let n=this.renderer.renderTemplate(o);this.disposableStore.add(Z(()=>this.renderer.disposeTemplate(n)));let r=this.instantiationService.createInstance(dOe);r.extension=e,n.name.setAttribute("tabindex","0");let s=l=>{l instanceof gi&&l.keyCode!==3||(r.run(l.ctrlKey||l.metaKey),l.stopPropagation(),l.preventDefault())};this.disposableStore.add(j(n.name,re.CLICK,l=>s(new Cn(Re(n.name),l)))),this.disposableStore.add(j(n.name,re.KEY_DOWN,l=>s(new gi(l)))),this.disposableStore.add(j(o,re.KEY_DOWN,l=>s(new gi(l)))),this.renderer.renderElement(e,t,n)}};cOe=I([m(2,F)],cOe);var PDi=class{hasChildren({hasChildren:i}){return i}getChildren(i){return i.getChildren()}},ADi=class{getHeight(i){return 62}getTemplateId({extension:i}){return i?Eie.TEMPLATE_ID:cKt.TEMPLATE_ID}},Eie=class{constructor(i){this.instantiationService=i}static{this.TEMPLATE_ID="extension-template"}get templateId(){return Eie.TEMPLATE_ID}renderTemplate(i){i.classList.add("extension");let e=this.instantiationService.createInstance(NG,i),t=M(i,_(".details")),o=M(t,_(".header")),n=M(o,_("span.name")),r=this.instantiationService.createInstance(dOe),s=[j(n,"click",p=>{r.run(p.ctrlKey||p.metaKey),p.stopPropagation(),p.preventDefault()}),e,r],l=M(o,_("span.identifier")),c=M(t,_(".footer")),u=M(c,_(".author"));return{name:n,identifier:l,author:u,extensionDisposables:s,set extensionData(p){e.extension=p.extension,r.extension=p.extension}}}renderElement(i,e,t){let o=i.element.extension;t.name.textContent=o.displayName,t.identifier.textContent=o.identifier.id,t.author.textContent=o.publisherDisplayName,t.extensionData=i.element}disposeTemplate(i){i.extensionDisposables=Be(i.extensionDisposables)}};Eie=I([m(0,F)],Eie);var cKt=class a{static{this.TEMPLATE_ID="unknown-extension-template"}get templateId(){return a.TEMPLATE_ID}renderTemplate(i){let e=M(i,_("div.unknown-extension"));return M(e,_("span.error-marker")).textContent=d(10528,null),M(e,_("span.message")).textContent=d(10534,null),{identifier:M(e,_("span.message"))}}renderElement(i,e,t){t.identifier.textContent=i.element.extension.identifier.id}disposeTemplate(i){}},dOe=class extends it{constructor(e){super("extensions.action.openExtension","");this.extensionsWorkdbenchService=e}set extension(e){this._extension=e}run(e){return this._extension?this.extensionsWorkdbenchService.open(this._extension,{sideByside:e}):Promise.resolve()}};dOe=I([m(0,Hi)],dOe);var uOe=class extends rp{constructor(i,e,t,o,n,r,s,l){let c=new ADi,u=new PDi,p=[r.createInstance(Eie),r.createInstance(cKt)],h={getId({extension:g,parent:f}){return f?this.getId(f)+"/"+g.identifier.id:g.identifier.id}};super("ExtensionsTree",e,c,p,u,{indent:40,identityProvider:h,multipleSelectionSupport:!1,overrideStyles:t,accessibilityProvider:{getAriaLabel(g){return $vo(g.extension)},getWidgetAriaLabel(){return d(10533,null)}}},r,o,n,s),this.setInput(i),this.disposables.add(this.onDidChangeSelection(g=>{xg(g.browserEvent)&&l.open(g.elements[0].extension,{sideByside:!1})}))}};uOe=I([m(3,X),m(4,Io),m(5,F),m(6,B),m(7,Hi)],uOe);var dKt=class a{constructor(i,e,t,o){this.extension=i,this.parent=e,this.getChildrenExtensionIds=t,this.extensionsWorkbenchService=o,this.childrenExtensionIds=this.getChildrenExtensionIds(i)}get hasChildren(){return yr(this.childrenExtensionIds)}async getChildren(){return this.hasChildren?(await _ot(this.childrenExtensionIds,this.extensionsWorkbenchService)).map(e=>new a(e,this,this.getChildrenExtensionIds,this.extensionsWorkbenchService)):null}};async function _ot(a,i){let e=i.local.reduce((n,r)=>(n.set(r.identifier.id.toLowerCase(),r),n),new Map),t=[],o=[];for(let n of a){let r=n.toLowerCase(),s=e.get(r);s?t.push(s):o.push(r)}if(o.length){let n=await i.getExtensions(o.map(r=>({id:r})),Se.None);t.push(...n)}return t}function NDi(a,i,e,t,o,n){let r=i();if(!r)return;let s=r.length;if(s<=1)return;let l=-1;for(let h=0;h<s;h++)if(r.isResolved(h)&&e(r.get(h),a)){l=h;break}if(l===-1)return;let c=(h,g)=>{let f=i()?.length??0;t(g,{navigation:{total:f,current:h,navigate:p}})},u,p=h=>{u?.cancel(),u=o.value=new Ye;let g=u.token,f=i();!f||h<0||h>=f.length||(f.isResolved(h)?c(h,f.get(h)):f.resolve(h,g).then(v=>{g.isCancellationRequested||c(h,v)},v=>{ao(v)||n.error(`Error while resolving item at index ${h} for modal navigation`,v)}))};return{navigation:{total:s,current:l,navigate:p}}}is((a,i)=>{let e=a.getColor(R7);e&&i.addRule(`.extensions-grid-view .extension-container:focus { background-color: ${e}; outline: none; }`);let t=a.getColor(Fye);t&&i.addRule(`.extensions-grid-view .extension-container:focus { color: ${t}; }`);let o=a.getColor(To),n=a.getColor(Ho);if(o&&n){let r=o.transparent(.9).makeOpaque(n);i.addRule(`.extensions-grid-view .extension-container:not(.disabled) .author { color: ${r}; }`);let s=o.transparent(.5).makeOpaque(n);i.addRule(`.extensions-grid-view .extension-container.disabled { color: ${s}; }`)}});var OG=class extends x{constructor(e,t,o){super();this.extensionsContent=e;this.domNode=_(".chat-extensions-content-part");let n=M(this.domNode,_(".loading-extensions-element"));M(n,_(q.asCSSSelector(q.modify(R.loading,"spin"))),_("span.loading-message",void 0,d(7675,null)));let r=M(this.domNode,_(".extensions-list")),s=this._register(o.createInstance(kie,r,Dr,{alwaysConsumeMouseWheel:!1},{onFocus:U.None,onBlur:U.None,filters:{}}));_ot(e.extensions,t).then(l=>{n.remove(),!this._store.isDisposed&&(s.setModel(new Wm(l)),s.layout())})}get codeblocks(){return[]}get codeblocksPartId(){}hasSameContent(e,t,o){return e.kind==="extensions"&&e.extensions.length===this.extensionsContent.extensions.length&&e.extensions.every(n=>this.extensionsContent.extensions.includes(n))}addDisposable(e){this._register(e)}};OG=I([m(1,Hi),m(2,F)],OG);var pOe=_,KT=class extends x{constructor(e,t,o,n=!1,r=0,s,l,c,u,p,h,g,f,v,b){super();this.markdown=e;this.editorPool=o;this.codeBlockModelCollection=u;this.rendererOptions=p;this.textModelService=f;this.instantiationService=v;this.aiEditTelemetryService=b;this.codeblocksPartId=String(++KT.ID_POOL);this._onDidChangeHeight=this._register(new E);this.onDidChangeHeight=this._onDidChangeHeight.event;this._onDidChangeDiff=this._register(new E);this.onDidChangeDiff=this._onDidChangeDiff.event;this.allRefs=[];this._codeblocks=[];this.mathLayoutParticipants=new Set;let S=t.element,y=fd(t.content,V=>V.kind==="undoStop",t.contentIndex)?.id,w=r,k=0;this.domNode=pOe("div.chat-markdown-part"),this.rendererOptions.accessibilityOptions?.statusMessage&&(this.domNode.ariaLabel=this.rendererOptions.accessibilityOptions.statusMessage,g.getValue("accessibility.verboseChatProgressUpdates")&&qr(this.rendererOptions.accessibilityOptions.statusMessage));let T=g.getValue("chat.math.enabled"),P=this._register(new me),O=()=>{if(this._store.isDisposed)return;let V=new N;P.value=V,Rt(this.domNode),this.allRefs.length=0,this._codeblocks.length=0,this.mathLayoutParticipants.clear(),w=r,k=0;let H=[],G=T?di([sge.getExtension(Re(t.container),{throwOnError:!1})]):[],$={gfm:!0,breaks:!0},J=V.add(s.render(e.content,{sanitizerConfig:sge.getSanitizerOptions({allowedTags:Eot,allowedAttributes:g4e}),fillInIncompleteTokens:n,codeBlockRendererSync:(oe,de,Ce)=>{let xe=!Ui(t.element)||t.element.isComplete||!Ce||uKt(Ce);if((!de||de.startsWith("<vscode_codeblock_uri")&&!de.includes(`
`))&&!xe){let sn=pOe("div");return sn.style.display="none",sn}if(oe==="diff"&&Ce&&this.rendererOptions.allowInlineDiffs){let sn=Ce.match(/^```diff:(\w+)/);if(sn&&Ui(t.element)){let _n=sn[1],mn=JAe(de),{before:hn,after:yo}=Vvo(mn?.textWithoutResult??de),Mr={element:t.element,codeBlockIndex:w++,languageId:_n,beforeContent:hn,afterContent:yo,codeBlockResource:mn?.uri,isReadOnly:!0,horizontalPadding:this.rendererOptions.horizontalPadding},cn=this.instantiationService.createInstance(age,Mr,t.diffEditorPool,t.currentWidth.get()),er={object:cn,isStale:()=>!1,dispose:()=>cn.dispose()};return this.allRefs.push(er),H.push(er),cn.element}}if(oe==="vscode-extensions")return V.add(v.createInstance(OG,{kind:"extensions",extensions:de.split(",")})).domNode;let ze=w++,De=k++,Oe,pt,et,Ti;if(vr(oe,Kvo))try{let sn=Gvo(de);pt=sn.range&&z.lift(sn.range),Oe=this.textModelService.createModelReference(sn.uri).then(mn=>(V.isDisposed||V.add(mn),mn.object.textEditorModel))}catch{return pOe("div")}else if(Ui(S)||Sr(S)){let sn=this.codeBlockModelCollection.getOrCreate(S.sessionResource,S,ze),_n=this.codeBlockModelCollection.updateSync(S.sessionResource,S,ze,{text:de,languageId:oe,isComplete:xe});et=sn.vulns,Ti=_n,Oe=sn.model}else Oe=void 0;let Ht=Ui(S)&&S.errorDetails?.responseIsFiltered,zi={...this.rendererOptions.codeBlockRenderOptions};Ht!==void 0&&(zi.hideToolbar=Ht);let Vo={languageId:oe,textModel:Oe,codeBlockIndex:ze,codeBlockPartIndex:De,element:S,range:pt,parentContextKeyService:h,vulns:et,codemapperUri:Ti?.codemapperUri,renderOptions:zi,chatSessionResource:S.sessionResource};if(S.isCompleteAddedRequest||!Ti?.codemapperUri||!Ti.isEdit){let sn=this.renderCodeBlock(Vo,de,xe,c);this.allRefs.push(sn);let _n=this.codeblocksPartId,mn=new class{constructor(){this.ownerMarkdownPartId=_n;this.codeBlockIndex=ze;this.elementId=S.id;this.chatSessionResource=S.sessionResource;this.languageId=oe;this.isStreamingEdit=!1;this.editDeltaInfo=lw.fromText(de);this.codemapperUri=void 0;this.uriPromise=Oe?.then(hn=>hn.uri)??Promise.resolve(void 0)}get uri(){return sn.object.uri}focus(){sn.object.focus()}};return this._codeblocks.push(mn),H.push(sn),sn.object.element}else{let sn=Sr(S)?S.id:S.requestId,_n=this.renderCodeBlockPill(S.sessionResource,sn,y,Vo.codemapperUri);Ui(Vo.element)&&this.codeBlockModelCollection.update(Vo.element.sessionResource,Vo.element,Vo.codeBlockIndex,{text:de,languageId:Vo.languageId,isComplete:xe}).then(yo=>{this._codeblocks[Vo.codeBlockPartIndex].codemapperUri=yo.codemapperUri});let mn=this.codeblocksPartId,hn=new class{constructor(){this.ownerMarkdownPartId=mn;this.codeBlockIndex=ze;this.elementId=S.id;this.codemapperUri=Ti?.codemapperUri;this.chatSessionResource=S.sessionResource;this.isStreamingEdit=!xe;this.uriPromise=Promise.resolve(void 0);this.languageId=oe;this.editDeltaInfo=lw.fromText(de)}get uri(){}focus(){return _n.object.element.focus()}};return this._codeblocks.push(hn),H.push(_n),_n.object.element}},markedOptions:$,markedExtensions:G,...l},this.domNode));Ui(S)&&!S.model.codeBlockInfos&&S.model.isComplete&&S.model.initializeCodeBlockInfos(this._codeblocks.map(oe=>({suggestionId:this.aiEditTelemetryService.createSuggestionId({presentation:"codeBlock",feature:"sideBarChat",editDeltaInfo:oe.editDeltaInfo,languageId:oe.languageId,modeId:S.model.request?.modeInfo?.modeId,modelId:S.model.request?.modelId,applyCodeBlockSuggestionId:void 0,source:void 0})})));let ae=v.createInstance(Sie);V.add(ae.walkTreeAndAnnotateReferenceLinks(e,J.element));let he=new co(()=>{let oe=new ResizeObserver(()=>this.mathLayoutParticipants.forEach(de=>de()));return oe.observe(this.domNode),V.add(Z(()=>oe.disconnect())),this.mathLayoutParticipants});for(let oe of this.domNode.querySelectorAll(".katex-display")){if(!Do(oe))continue;let de=new ms(oe.cloneNode(!0),{vertical:2,horizontal:1});H.push(de),oe.replaceWith(de.getDomNode()),he.value.add(()=>{de.scanDomNode()}),de.scanDomNode()}H.push(Wvo(this.domNode,he)),H.reverse().forEach(oe=>V.add(oe))};O(),T&&!sge.getExtension(Re(t.container))&&sge.loadExtension(Re(t.container)).then(()=>{O()}).catch(V=>{console.error("Failed to load MarkedKatexSupport extension:",V)})}static{this.ID_POOL=0}get codeblocks(){return this._codeblocks}dispose(){super.dispose(),Be(this.allRefs),this.allRefs.length=0}renderCodeBlockPill(e,t,o,n){let r=this.instantiationService.createInstance(dge,e,t,o),s=new N,l={object:r,isStale:()=>!1,dispose:()=>{r.dispose(),s.dispose()}};return this.allRefs.push(l),s.add(r.onDidChangeDiff(()=>this.fireAggregatedDiff())),n&&r.render(n),l}fireAggregatedDiff(){let e=0,t=0;for(let o of this.allRefs)o.object instanceof dge&&o.object.diff&&(e+=o.object.diff.added,t+=o.object.diff.removed);this._onDidChangeDiff.fire({added:e,removed:t})}renderCodeBlock(e,t,o,n){let r=this.editorPool.get(),s=r.object;return this.codeBlockModelCollection.update(e.element.sessionResource,e.element,e.codeBlockIndex,{text:t,languageId:e.languageId,isComplete:o}).then(l=>{this._codeblocks[e.codeBlockPartIndex].codemapperUri=l.codemapperUri}),s.render(e,n).then(()=>{!this._store.isDisposed&&Sr(e.element)&&this._onDidChangeHeight.fire()}),r}hasSameContent(e){if(e.kind!=="markdownContent")return!1;if(e.content.value===this.markdown.content.value)return!0;let t=this._codeblocks.at(-1);return t&&t.codemapperUri!==void 0&&t.isStreamingEdit?e.content.value.lastIndexOf("```")===this.markdown.content.value.lastIndexOf("```"):!1}layout(e){this.allRefs.forEach((t,o)=>{if(t.object instanceof Z8)t.object.layout(e);else if(t.object instanceof age)t.object.layout(e);else if(t.object instanceof dge){let n=this._codeblocks[o];n.codemapperUri&&!Qe(t.object.uri,n.codemapperUri)&&t.object.render(n.codemapperUri)}}),this.mathLayoutParticipants.forEach(t=>t())}onDidRemount(){for(let e of this.allRefs)e.object instanceof Z8&&e.object.onDidRemount()}addDisposable(e){this._register(e)}};KT=I([m(10,X),m(11,B),m(12,Bt),m(13,F),m(14,xS)],KT);function uKt(a){return a=a.trim(),!!a.match(/\n```+$/)}var dge=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.sessionResource=e;this.requestId=t;this.inUndoStop=o;this.labelService=n;this.editorService=r;this.modelService=s;this.languageService=l;this.contextMenuService=c;this.contextKeyService=u;this.menuService=p;this.hoverService=h;this.chatService=g;this.configurationService=f;this.hover=this._register(new me);this._onDidChangeDiff=this._register(new E);this.onDidChangeDiff=this._onDidChangeDiff.event;this.progressStore=this._store.add(new N);this.element=pOe("div.chat-codeblock-pill-container"),this.statusIndicatorContainer=pOe("div.status-indicator-container"),this.pillElement=pOe(".chat-codeblock-pill-widget"),this.pillElement.tabIndex=0,this.pillElement.classList.add("show-file-icons"),this.pillElement.role="button",this.element.appendChild(this.statusIndicatorContainer),this.element.appendChild(this.pillElement),this.registerListeners()}get uri(){return this._uri}get diff(){return this.currentDiff}registerListeners(){this._register(Qit(this.pillElement,e=>this.showDiff(e))),this._register(j(this.pillElement,re.CONTEXT_MENU,e=>{let t=new Cn(Re(e),e);Xt.stop(e,!0),this.contextMenuService.showContextMenu({contextKeyService:this.contextKeyService,getAnchor:()=>t,getActions:()=>{if(!this.uri)return[];let o=this.menuService.getMenuActions(D.ChatEditingCodeBlockContext,this.contextKeyService,{arg:{sessionResource:this.sessionResource,requestId:this.requestId,uri:this.uri,stopId:this.inUndoStop}});return tu(o)}})}))}showDiff({editorOptions:e,openToSide:t}){this.currentDiff?this.editorService.openEditor({original:{resource:this.currentDiff.originalURI},modified:{resource:this.currentDiff.modifiedURI},options:e},t?In:void 0):this.uri&&this.editorService.openEditor({resource:this.uri,options:e},t?In:void 0)}render(e){this.progressStore.clear(),this._uri=e;let t=this.chatService.getSession(this.sessionResource),o=this.labelService.getUriBasenameLabel(e),n=_("span.status-icon"),r=_("span.status-label",{},"");this.statusIndicatorContainer.replaceChildren(n,r);let s=_("span.icon"),l=_("span.icon-label",{},o),c=_("span.label-detail",{},""),u=_("span.progress-fill");this.pillElement.replaceChildren(u,s,l,c);let p=this.labelService.getUriLabel(e,{relative:!0});this.updateTooltip(p);let h=t?.editingSession;if(!h)return;let g=ke(S=>{let y=h.readEntry(e,S);return y&&h.getEntryDiffBetweenStops(y.modifiedURI,this.requestId,this.inUndoStop)}).map((S,y)=>S?.read(y)),f=ke(S=>{let w=h.readEntry(e,S)?.isCurrentlyBeingModifiedBy.read(S);return!!w&&w.responseModel.requestId===this.requestId&&w.undoStopId===this.inUndoStop}),v=[],b=[];this.progressStore.add(be(S=>{if(n.classList.remove(...v),s.classList.remove(...b),f.read(S)){let y=q.modify(R.loading,"spin");v=q.asClassNameArray(y),n.classList.add(...v);let w=h.readEntry(e,S),k=Math.floor((w?.rewriteRatio.read(S)||0)*100);r.textContent=d(7693,null),this.configurationService.getValue("chat.agent.codeBlockProgress")?(u.style.width=`${k}%`,this.pillElement.classList.add("progress-filling"),c.textContent=""):(u.style.width="0%",this.pillElement.classList.remove("progress-filling"),c.textContent=k===0||!k?d(7698,null):d(7694,null,k))}else{let y=R.check;v=q.asClassNameArray(y),n.classList.add(...v),r.textContent=d(7697,null);let w=e.path.endsWith("/")?1:0;b=aa(this.modelService,this.languageService,e,w),s.classList.add(...b),this.pillElement.classList.remove("progress-filling"),u.style.width="0%",c.textContent=""}})),this.progressStore.add(Ox(S=>{let y=g.read(S);if(y===void 0)return;let w=this.pillElement.querySelector(".label-added")??this.pillElement.appendChild(_("span.label-added")),k=this.pillElement.querySelector(".label-removed")??this.pillElement.appendChild(_("span.label-removed"));if(y&&!y?.identical&&!y?.quitEarly){this.currentDiff=y,this._onDidChangeDiff.fire(y),w.textContent=`+${y.added}`,k.textContent=`-${y.removed}`;let T=y.added===1?d(7700,null):d(7699,null,y.added),P=y.removed===1?d(7696,null):d(7695,null,y.removed),O=d(7701,null,o,T,P);this.element.ariaLabel=O,y.isFinal&&S.dispose()}}))}updateTooltip(e){this.tooltip=e,this.hover.value||(this.hover.value=this.hoverService.setupDelayedHover(this.pillElement,()=>({content:this.tooltip,style:1,position:{hoverPosition:2},persistence:{hideOnKeyDown:!0}})))}};dge=I([m(3,rt),m(4,ee),m(5,Tt),m(6,_t),m(7,Xe),m(8,X),m(9,Kt),m(10,nt),m(11,mi),m(12,B)],dge);var FG=class extends x{constructor(e,t,o,n){super();this.element=e;this._title=t;this._renderer=n;this._onDidChangeHeight=this._register(new E);this.onDidChangeHeight=this._onDidChangeHeight.event;this._renderedTitle=this._register(new me);if(e.classList.add("chat-query-title-part"),this._renderedTitle.value=n.render(this.toMdString(t),{asyncRenderCallback:()=>this._onDidChangeHeight.fire()}),e.append(this._renderedTitle.value.element),o){let r=this.toMdString(o),s=this._register(n.render(r,{asyncRenderCallback:()=>this._onDidChangeHeight.fire()})),l=document.createElement("small");l.appendChild(s.element),e.append(l)}}get title(){return this._title}set title(e){this._title=e;let t=this._renderer.render(this.toMdString(e),{asyncRenderCallback:()=>this._onDidChangeHeight.fire()}),o=this._renderedTitle.value?.element;o?.parentElement?o.replaceWith(t.element):this.element.appendChild(t.element),this._renderedTitle.value=t}toMdString(e){return typeof e=="string"?new Ie("",{supportThemeIcons:!0}).appendText(e):new Ie(e.value,{supportThemeIcons:!0,isTrusted:e.isTrusted})}};FG=I([m(3,On)],FG);var Dot=class extends x{constructor(e,t,o,n,r,s){super();this.context=e;this.instantiationService=o;this._markdownRendererService=n;this._onDidClick=this._register(new E);let{title:l,subtitle:c,message:u,buttons:p}=t,h=ct(".chat-confirmation-widget-container@container",[ct(".chat-confirmation-widget@root",[ct(".chat-confirmation-widget-title@title"),ct(".chat-confirmation-widget-message-container",[ct(".chat-confirmation-widget-message@message"),ct(".chat-buttons-container@buttonsContainer",[ct(".chat-buttons@buttons"),ct(".chat-toolbar@toolbar")])])])]);if(jvo(h.container,l,u),this._domNode=h.root,this._register(o.createInstance(FG,h.title,l,c)),this.messageElement=h.message,p.forEach(g=>{let f={...Qo,small:!0,secondary:g.isSecondary,title:g.tooltip,disabled:g.disabled},v;g.moreActions?v=new ry(h.buttons,{...f,contextMenuProvider:r,addPrimaryActionToDropdown:!1,actions:g.moreActions.map(b=>b instanceof ri?b:this._register(new it(b.label,b.label,void 0,!b.disabled,()=>(this._onDidClick.fire(b),Promise.resolve()))))}):v=new Wi(h.buttons,f),this._register(v),v.label=g.label,this._register(v.onDidClick(()=>this._onDidClick.fire(g))),g.onDidChangeDisablement&&this._register(g.onDidChangeDisablement(b=>v.enabled=!b))}),t?.toolbarData){let g=s.createOverlay([["chatConfirmationPartType",t.toolbarData.partType],["chatConfirmationPartSource",t.toolbarData.partSource]]),f=this._register(o.createChild(new _o([X,g])));this._register(f.createInstance(or,h.toolbar,D.ChatConfirmationMenu,{menuOptions:{arg:t.toolbarData.arg,shouldForwardArgs:!0}}))}}get onDidClick(){return this._onDidClick.event}get domNode(){return this._domNode}setShowButtons(e){this.domNode.classList.toggle("hideButtons",!e)}renderMessage(e){this.messageElement.append(e)}};Dot=I([m(2,F),m(3,On),m(4,Xe),m(5,X)],Dot);var mOe=class extends Dot{constructor(i,e,t,o,n,r){super(i,e,t,o,n,r),this.updateMessage(e.message)}updateMessage(i){this._renderedMessage?.remove();let e=this._register(this._markdownRendererService.render(typeof i=="string"?new Ie(i):i));this.renderMessage(e.element),this._renderedMessage=e.element}};mOe=I([m(2,F),m(3,On),m(4,Xe),m(5,X)],mOe);var hOe=class extends x{constructor(e,t,o,n,r,s,l){super();this._context=e;this.instantiationService=o;this.markdownRendererService=n;this.contextMenuService=r;this.chatMarkdownAnchorService=l;this._onDidClick=this._register(new E);this.markdownContentPart=this._register(new me);let{title:c,subtitle:u,message:p,buttons:h,icon:g}=t,f=ct(".chat-confirmation-widget-container@container",[ct(".chat-confirmation-widget2@root",[ct(".chat-confirmation-widget-title",[ct(".chat-title@title"),ct(".chat-toolbar-container@buttonsContainer",[ct(".chat-toolbar@toolbar")])]),ct(".chat-confirmation-widget-message@message"),ct(".chat-confirmation-widget-buttons",[ct(".chat-buttons@buttons")])])]);if(jvo(f.container,c,p),this._domNode=f.root,this._buttonsDomNode=f.buttons,this._register(o.createInstance(FG,f.title,new Ie(g?`$(${g.id}) ${typeof c=="string"?c:c.value}`:typeof c=="string"?c:c.value),u)),this.messageElement=f.message,this.updateButtons(h),t?.toolbarData){let v=s.createOverlay([["chatConfirmationPartType",t.toolbarData.partType],["chatConfirmationPartSource",t.toolbarData.partSource]]),b=this._register(o.createChild(new _o([X,v])));this._register(b.createInstance(or,f.toolbar,D.ChatConfirmationMenu,{menuOptions:{arg:t.toolbarData.arg,shouldForwardArgs:!0}}))}}get onDidClick(){return this._onDidClick.event}get domNode(){return this._domNode}setShowButtons(e){this.domNode.classList.toggle("hideButtons",!e)}get codeblocksPartId(){return this.markdownContentPart.value?.codeblocksPartId}get codeblocks(){return this.markdownContentPart.value?.codeblocks}updateButtons(e){for(;this._buttonsDomNode.children.length>0;)this._buttonsDomNode.children[0].remove();for(let t of e){let o={...Qo,small:!0,secondary:t.isSecondary,title:t.tooltip,disabled:t.disabled},n;t.moreActions?n=new ry(this._buttonsDomNode,{...o,contextMenuProvider:this.contextMenuService,addPrimaryActionToDropdown:!1,actions:t.moreActions.map(r=>r instanceof ri?r:this._register(new it(r.label,r.label,void 0,!r.disabled,()=>(this._onDidClick.fire(r),Promise.resolve()))))}):n=new Wi(this._buttonsDomNode,o),this._register(n),n.label=t.label,this._register(n.onDidClick(()=>this._onDidClick.fire(t))),t.onDidChangeDisablement&&this._register(t.onDidChangeDisablement(r=>n.enabled=!r))}}renderMessage(e){if(this.markdownContentPart.clear(),!Do(e)){let t=this._register(this.instantiationService.createInstance(KT,{kind:"markdownContent",content:typeof e=="string"?new Ie().appendMarkdown(e):e},this._context,this._context.editorPool,!1,this._context.codeBlockStartIndex,this.markdownRendererService,void 0,this._context.currentWidth.get(),this._context.codeBlockModelCollection,{allowInlineDiffs:!0,horizontalPadding:6}));$k(t.domNode,this.instantiationService,this.chatMarkdownAnchorService,this._store),this.markdownContentPart.value=t,e=t.domNode}for(let t of this.messageElement.children)t.remove();this.messageElement.append(e)}};hOe=I([m(2,F),m(3,On),m(4,Xe),m(5,X),m(6,Gv)],hOe);var Tie=class extends hOe{constructor(i,e,t,o,n,r,s){super(i,e,t,o,n,r,s),this.renderMessage(e.message)}updateMessage(i){this._renderedMessage?.remove();let e=this._register(this.markdownRendererService.render(typeof i=="string"?new Ie(i):i));this.renderMessage(e.element),this._renderedMessage=e.element}};Tie=I([m(2,F),m(3,On),m(4,Xe),m(5,X),m(6,Gv)],Tie);var WG=class extends hOe{constructor(i,e,t,o,n,r,s){super(i,e,t,o,n,r,s),this.renderMessage(e.message)}};WG=I([m(2,F),m(3,On),m(4,Xe),m(5,X),m(6,Gv)],WG);function jvo(a,i,e){a.tabIndex=0;let t=typeof i=="string"?i:i.value,o=typeof e=="string"?e:e&&"value"in e?e.value:e&&"textContent"in e?e.textContent:"";a.setAttribute("aria-label",d(7671,null,t,o)),a.classList.add("chat-confirmation-widget-container")}var gOe=class extends x{constructor(e,t,o,n,r){super();this.instantiationService=o;this.chatService=n;let s=t.element,l=e.buttons?e.buttons.map(u=>({label:u,data:e.data,isSecondary:u!==e.buttons?.[0]})):[{label:d(7669,null),data:e.data},{label:d(7670,null),data:e.data,isSecondary:!0}],c=this._register(this.instantiationService.createInstance(mOe,t,{title:e.title,buttons:l,message:e.message}));c.setShowButtons(!e.isUsed),this._register(c.onDidClick(async u=>{if(Ui(s)){let p=`${u.label}: "${e.title}"`,h=u.isSecondary?{rejectedConfirmationData:[u.data]}:{acceptedConfirmationData:[u.data]};h.agentId=s.agent?.id,h.slashCommand=s.slashCommand?.name,h.confirmation=u.label;let g=r.getWidgetBySessionResource(s.sessionResource);h.userSelectedModelId=g?.input.currentLanguageModel,h.modeInfo=g?.input.currentModeInfo,h.location=g?.location,Object.assign(h,g?.getModeRequestOptions());let f=await this.chatService.sendRequest(s.sessionResource,p,h);p4.isSent(f)&&(e.isUsed=!0,c.setShowButtons(!1))}})),this.domNode=c.domNode}hasSameContent(e){return e.kind==="confirmation"}addDisposable(e){this._register(e)}};gOe=I([m(2,F),m(3,mi),m(4,Pt)],gOe);var uge=class extends x{constructor(e,t,o,n=!1,r){super();this.isSimpleWidget=n;this._pool=this._register(new XH(()=>r.createInstance(Z8,e,D.ChatCodeBlock,t,o,this.isSimpleWidget)))}inUse(){return this._pool.inUse}get(){let e=this._pool.get(),t=!1;return{object:e,isStale:()=>t,dispose:$c(()=>{e.reset(),t=!0,this._pool.release(e)})}}clear(){this._pool.clear()}};uge=I([m(4,F)],uge);var fOe=class extends x{constructor(e,t,o,n=!1,r){super();this.isSimpleWidget=n;this._pool=this._register(new XH(()=>r.createInstance(ZNe,e,D.ChatCompareBlock,t,o,this.isSimpleWidget)))}inUse(){return this._pool.inUse}get(){let e=this._pool.get(),t=!1;return{object:e,isStale:()=>t,dispose:$c(()=>{e.reset(),t=!0,this._pool.release(e)})}}clear(){this._pool.clear()}};fOe=I([m(4,F)],fOe);var vOe=class extends x{constructor(i){super(),this._collection=new ODi(i)}acquire(i,e,t,o){return this._collection.acquire(i.toString(),i,e,t,o)}};vOe=I([m(0,Tt)],vOe);var ODi=class extends uC{constructor(e){super();this.modelService=e}createReferencedObject(e,t,o,n,r){return this.modelService.createModel(o,n,t,r)}destroyReferencedObject(e,t){t.dispose()}};var WDi="workbench.action.chat.acceptElicitation",FDi=class extends K{constructor(){super({id:WDi,title:L(5813,"Accept Request"),f1:!1,category:Si,keybinding:{when:C.and(ie.inChatSession,ie.Editing.hasElicitationRequest),primary:2051,weight:201}})}async run(i){let t=i.get(Pt).lastFocusedWidget;if(!t)return;let o=t.viewModel?.getItems();if(o?.length)for(let n=o.length-1;n>=0;n--){let r=o[n];if(Ui(r)){for(let s of r.response.value)if(s.kind==="elicitation2"&&s.state.get()==="pending"){await s.accept(!0),t.focusInput();return}}}}};function Qvo(){W(FDi)}var bOe=class extends x{constructor(e,t,o,n,r,s){super();this.elicitation=e;this.instantiationService=o;this.chatAccessibilityService=n;this.contextKeyService=r;this.keybindingService=s;let l=[];if(e.kind==="elicitation2"){let p=this.keybindingService.appendKeybinding(e.acceptButtonLabel,WDi);l.push({label:e.acceptButtonLabel,tooltip:p,data:!0,moreActions:e.moreActions?.map(g=>({label:g.label,data:g,run:g.run}))}),e.rejectButtonLabel&&e.reject&&l.push({label:e.rejectButtonLabel,data:!1,isSecondary:!0}),this._register(be(g=>{e.isHidden?.read(g)&&this.domNode.remove()}));let h=ie.Editing.hasElicitationRequest.bindTo(this.contextKeyService);this._register(be(g=>{h.set(e.state.read(g)==="pending")})),this._register(Z(()=>h.reset())),this.chatAccessibilityService.acceptElicitation(e)}let c=this._register(this.instantiationService.createInstance(Tie,t,{title:e.title,subtitle:e.subtitle,buttons:l,message:this.getMessageToRender(e),toolbarData:{partType:"elicitation",partSource:e.source?.type,arg:e}}));this._confirmWidget=c,c.setShowButtons(e.kind==="elicitation2"&&e.state.get()==="pending"),this._register(c.onDidClick(async p=>{if(e.kind!=="elicitation2")return;let h;typeof p.data=="boolean"&&p.data===!0||p.data&&typeof p.data=="object"&&"run"in p.data&&"label"in p.data?h=p.data:h=void 0,h!==void 0?await e.accept(h):e.reject&&await e.reject(),c.setShowButtons(!1),c.updateMessage(this.getMessageToRender(e))})),this.domNode=c.domNode,this.domNode.tabIndex=0;let u=this.getMessageToRender(e);this.domNode.ariaLabel=e.title+" "+(typeof u=="string"?u:u.value||"")}get codeblocks(){return this._confirmWidget.codeblocks}get codeblocksPartId(){return this._confirmWidget.codeblocksPartId}getMessageToRender(e){if(!e.acceptedResult)return e.message;let t=Ar(e.message)?Ie.lift(e.message):new Ie(e.message);return t.appendCodeblock("json",JSON.stringify(e.acceptedResult,null,2)),t}hasSameContent(e){return e===this.elicitation}addDisposable(e){this._register(e)}};bOe=I([m(2,F),m(3,NF),m(4,X),m(5,_e)],bOe);var Yvo=_,SOe=class extends x{constructor(e,t,o,n){super();this.errorDetails=o;this.domNode=this._register(new pge(e,t,n)).domNode}hasSameContent(e){return e.kind===this.errorDetails.kind}},pge=class extends x{constructor(i,e,t){super(),this.domNode=Yvo(".chat-notification-widget"),this.domNode.tabIndex=0;let o,n;switch(i){case 1:o=R.warning,n=".chat-warning-codicon";break;case 2:o=R.error,n=".chat-error-codicon";break;case 0:o=R.info,n=".chat-info-codicon";break}this.domNode.appendChild(Yvo(n,void 0,Sn(o)));let r=this._register(t.render(e));this.domNode.appendChild(r.element)}};var Jvo=_,IOe=class extends x{constructor(e,t,o,n,r,s,l,c,u,p){super();this.errorDetails=o;this.chatAccessibilityService=p;let h=s.element;Yso(h),this.domNode=Jvo(".chat-error-confirmation"),this.domNode.append(this._register(new pge(e,t,r)).domNode);let g={...Qo},f=M(this.domNode,Jvo(".chat-buttons-container"));n.forEach(v=>{let b=this._register(new Wi(f,g));b.label=v.label,this._register(b.onDidClick(async()=>{let S=v.label,y=v.isSecondary?{rejectedConfirmationData:[v.data]}:{acceptedConfirmationData:[v.data]};y.agentId=h.agent?.id,y.slashCommand=h.slashCommand?.name,y.confirmation=v.label;let w=c.getWidgetBySessionResource(h.sessionResource);y.userSelectedModelId=w?.input.currentLanguageModel,Object.assign(y,w?.getModeRequestOptions()),this.chatAccessibilityService.acceptRequest(h.sessionResource),await u.sendRequest(h.sessionResource,S,y)}))})}hasSameContent(e){return e.kind===this.errorDetails.kind&&e.isLast===this.errorDetails.isLast}addDisposable(e){this._register(e)}};IOe=I([m(6,F),m(7,Pt),m(8,mi),m(9,NF)],IOe);function pKt(a){return a.source?.type==="mcp"||a.toolId.toLowerCase().includes("mcp")}function yOe(a){return pKt(a)?!Pi.isComplete(a):(a.toolId==="copilot_askQuestions"||a.toolId==="vscode_askQuestions",!1)}function _ie(a){let i=Pi.executionConfirmedOrDenied(a);if(!(!i||typeof i=="boolean"))return Ptn(i)}function Ptn(a){let i;switch(a.type){case 2:i=d(7923,null,pw({text:"`"+a.id+"`",id:"workbench.action.openSettings",arguments:[a.id],tooltip:d(7926,null)},!1));break;case 3:i=a.scope==="session"?d(7921,null):a.scope==="workspace"?d(7922,null):d(7920,null),i+=" ("+pw({text:d(7924,null),id:"workbench.action.chat.editToolApproval",arguments:[a.scope],tooltip:d(7925,null)})+")";break;case 1:return a.reason?typeof a.reason=="string"?new Ie(a.reason,{isTrusted:!0}):a.reason:void 0;case 4:case 0:default:return}return new Ie(i,{isTrusted:!0})}var Atn=100,SW=class extends x{constructor(e,t,o,n){super();this._instantiationService=t;this._contextMenuService=o;this._fileService=n;this._onDidChangeHeight=this._register(new E);this.onDidChangeHeight=this._onDidChangeHeight.event;let r=ct(".chat-collapsible-io-resource-group",[ct(".chat-collapsible-io-resource-items@items"),ct(".chat-collapsible-io-resource-actions@actions")]);this.domNode=r.root,this._fillInResourceGroup(e,r.items,r.actions)}async _fillInResourceGroup(e,t,o){let n=[],r=[];for(let c=0;c<e.length;c++){let u=e[c];if(u.mimeType&&f3(u.mimeType))if(u.base64Value)n.push({kind:"file",id:xt(),name:He(u.uri),fullName:u.uri.path,value:u.uri}),r.push({index:c,part:u});else if(u.value)n.push({kind:"image",id:xt(),name:He(u.uri),value:u.value,mimeType:u.mimeType,isURL:!1,references:[{kind:"reference",reference:u.uri}]});else{let p=await this._fileService.readFile(u.uri).then(h=>h.value.buffer,()=>{});p?n.push({kind:"image",id:xt(),name:He(u.uri),value:p,mimeType:u.mimeType,isURL:!1,references:[{kind:"reference",reference:u.uri}]}):n.push({kind:"file",id:xt(),name:He(u.uri),fullName:u.uri.path,value:u.uri})}else n.push({kind:"file",id:xt(),name:He(u.uri),fullName:u.uri.path,value:u.uri})}if(this._store.isDisposed)return;let s=this._register(this._instantiationService.createInstance(fie,{variables:n,limit:5,contentReferences:void 0,domNode:void 0}));s.contextMenuHandler=(c,u)=>{let p=n.indexOf(c),h=e[p];h&&(u.preventDefault(),u.stopPropagation(),this._contextMenuService.showContextMenu({menuId:D.ChatToolOutputResourceContext,menuActionOptions:{shouldForwardArgs:!0},getAnchor:()=>({x:u.pageX,y:u.pageY}),getActionsContext:()=>({parts:[h]})}))},t.appendChild(s.domNode),this._onDidChangeHeight.fire();let l=this._register(this._instantiationService.createInstance(or,o,D.ChatToolOutputResourceToolbar,{menuOptions:{shouldForwardArgs:!0}}));l.context={parts:e},r.length>0&&this._register(tn(()=>{for(let{index:c,part:u}of r)try{let p=qa(u.base64Value).buffer;n[c]={kind:"image",id:xt(),name:He(u.uri),value:p,mimeType:u.mimeType,isURL:!1,references:[{kind:"reference",reference:u.uri}]}}catch{}s.updateVariables(n),this._onDidChangeHeight.fire()},Atn))}};SW=I([m(1,F),m(2,Xe),m(3,fe)],SW);var VDi=class a extends K{static{this.ID="chat.toolOutput.save"}constructor(){super({id:a.ID,title:L(7763,"Save..."),icon:R.cloudDownload,menu:[{id:D.ChatToolOutputResourceToolbar,group:"navigation",order:1},{id:D.ChatToolOutputResourceContext}]})}async run(i,e){let t=i.get(rn),o=i.get(fe),n=i.get(Ne),r=i.get(Fo),s=i.get(Pe),l=i.get(ge),c=i.get(rt),u=await t.defaultFilePath(),p=async(g,f,v)=>{let b=f?Ge(v,He(g.uri)):v;try{if(g.kind==="data")await o.copy(g.uri,b,!0);else{let S=await o.readFile(g.uri);await o.writeFile(b,S.value)}}catch(S){n.error(d(7764,null,He(g.uri),S))}},h=async(g,f)=>{await r.withProgress({location:15,delay:5e3,title:d(7765,null)},async v=>{for(let b of f)await b(),v.report({increment:1,total:f.length})}),s.isInsideWorkspace(g)?l.executeCommand(lW,g):n.info(d(7766,null,c.getUriLabel(g)))};if(e.parts.length===1){let g=e.parts[0],f=await t.pickFileToSave(Ge(u,He(g.uri)));if(!f)return;await h(f,[()=>p(g,!1,f)])}else{let g=await t.showOpenDialog({title:d(7767,null),canSelectFiles:!1,canSelectFolders:!0,canSelectMany:!1,defaultUri:s.getWorkspace().folders[0]?.uri});if(!g?.length)return;await h(g[0],e.parts.map(f=>()=>p(f,!0,g[0])))}}};W(VDi);var wOe=class extends x{constructor(e){super();this.instantiationService=e;this._onDidChangeHeight=this._register(new E);this.onDidChangeHeight=this._onDidChangeHeight.event;this.resourcePartsByToolCallId=new Map;this.resourceGroupWidget=this._register(new me);this.resourceGroupWidgetHeightListener=this._register(new me);this.isCollapsed=!0;this.domNode=_(".chat-thinking-external-resources"),vo(this.domNode)}setToolInvocationParts(e,t){t.length!==0&&(this.resourcePartsByToolCallId.set(e,t),this.rebuild())}removeToolInvocation(e){this.resourcePartsByToolCallId.delete(e)&&this.rebuild()}setCollapsed(e){if(this.isCollapsed=e,!this.resourceGroupWidget.value){vo(this.domNode);return}this.isCollapsed?un(this.domNode):vo(this.domNode)}rebuild(){let e=[];for(let o of this.resourcePartsByToolCallId.values())e.push(...o);if(this.resourceGroupWidgetHeightListener.clear(),this.resourceGroupWidget.clear(),Rt(this.domNode),e.length===0){vo(this.domNode),this._onDidChangeHeight.fire();return}let t=this.instantiationService.createInstance(SW,e);this.resourceGroupWidgetHeightListener.value=t.onDidChangeHeight(()=>this._onDidChangeHeight.fire()),this.resourceGroupWidget.value=t,this.domNode.appendChild(t.domNode),this.setCollapsed(this.isCollapsed),this._onDidChangeHeight.fire()}};wOe=I([m(0,F)],wOe);function Zvo(a){return(Array.isArray(a.value)?a.value.join(""):a.value||"").trim()}function Ntn(a){let i=a.toLowerCase();return i.includes("edit")||i.includes("create")||i.includes("replace")||i.includes("patch")}function Otn(a){let i=a.toLowerCase();return i.includes("create")||i.includes("notebook")?!1:i.includes("replace")||i.includes("patch")||i.includes("insertedit")||i.includes("insert_edit")||i.includes("editfile")}function HDi(a,i){if(i)return i;let e=a.toLowerCase();return e.includes("search")||e.includes("grep")||e.includes("find")||e.includes("list")||e.includes("semantic")||e.includes("changes")||e.includes("codebase")?R.search:e.includes("read")||e.includes("get_file")||e.includes("problems")?R.book:Ntn(a)?R.pencil:e.includes("terminal")?R.terminal:R.tools}function tQ(a){let i=_("span.chat-thinking-icon");return i.classList.add(...q.asClassNameArray(a)),i}function ebo(a){let i=a.match(/^\*\*([^*]+)\*\*/);return i?i[1]:void 0}var mge=200,BDi="chat.thinkingTitleCache",tbo=10080*60*1e3,ibo=1e3;var Ftn=[d(7803,null),d(7804,null),d(7805,null),d(7806,null),d(7807,null)],Wtn=[d(7800,null),d(7801,null),d(7802,null)],Vtn=[d(7809,null),d(7810,null),d(7811,null),d(7812,null),d(7813,null)];function UDi(a,i){let e=i.getValue("chat.agent.thinking.phrases"),t=Array.isArray(e?.phrases)?e.phrases.filter(o=>typeof o=="string").map(o=>o.trim()).filter(o=>o.length>0):[];return t.length>0?e?.mode==="replace"?[...t]:[...a,...t]:[...a]}var jk=class extends UT{constructor(e,t,o,n,r,s,l,c,u,p){let h=Zvo(e),g=ebo(h)??d(7793,null);super(g,t,void 0,u,s);this.chatContentMarkdownRenderer=o;this.streamingCompleted=n;this.instantiationService=r;this.configurationService=s;this.chatMarkdownAnchorService=l;this.languageModelsService=c;this.storageService=p;this._onDidChangeHeight=this._register(new E);this._asyncRenderCallback=()=>this._onDidChangeHeight.fire();this.defaultTitle=d(7792,null);this.workingTitle=d(7794,null);this._markdownResult=this._register(new me);this.fixedScrollingMode=!1;this.autoScrollEnabled=!0;this.extractedTitles=[];this.toolInvocationCount=0;this.appendedItemCount=0;this.isActive=!0;this.toolInvocations=[];this.allThinkingParts=[];this.hookCount=0;this.lazyItems=[];this.hasExpandedOnce=!1;this.availableMessagesByCategory=new Map;this.toolWrappersByCallId=new Map;this.toolIconsByCallId=new Map;this.toolLabelsByCallId=new Map;this.toolDisposables=this._register(new Vt);this.ownedToolParts=new Map;this.pendingRemovals=[];this.isUpdatingDimensions=!1;this.lastKnownContentHeight=0;this.lastKnownScrollTop=0;this._titleDetailRendered=this._register(new me);this.diffStatsByPartId=new Map;this._aggregatedDiff={added:0,removed:0};this.id=e.id,this.content=e,this.allThinkingParts.push(e);let f=this.configurationService.getValue("chat.agent.thinkingStyle")??"collapsed";this.fixedScrollingMode=f==="fixedScrolling",this.currentTitle=g,g!==this.defaultTitle&&(this.lastExtractedTitle=g),this.currentThinkingValue=h,h.trim()&&this.appendedItemCount++,this.configurationService.getValue("accessibility.verboseChatProgressUpdates")&&en(d(7799,null)),f==="collapsed"?this.setExpanded(!1):f==="collapsedPreview"?this.setExpanded(!this.streamingCompleted&&!this.element.isComplete):this.setExpanded(!1);let v=this.domNode;if(v.classList.add("chat-thinking-box"),this._externalResourceWidget=this._register(this.instantiationService.createInstance(wOe)),this._register(this._externalResourceWidget.onDidChangeHeight(()=>this._onDidChangeHeight.fire())),v.appendChild(this._externalResourceWidget.domNode),!this.streamingCompleted&&!this.element.isComplete&&(this.fixedScrollingMode||v.classList.add("chat-thinking-active")),!this.fixedScrollingMode&&!this.streamingCompleted&&!this.element.isComplete&&this._collapseButton){let S=this._collapseButton.labelElement;S.textContent="",this.titleShimmerSpan=_("span.chat-thinking-title-shimmer"),this.titleShimmerSpan.textContent=g,S.appendChild(this.titleShimmerSpan)}this.fixedScrollingMode&&(v.classList.add("chat-thinking-fixed-mode"),this.currentTitle=this.defaultTitle),this._register(Z(()=>{for(let S of this.ownedToolParts.values())S.dispose();this.ownedToolParts.clear()})),this._register(be(S=>{let y=this.expanded.read(S);this._collapseButton&&(this.streamingCompleted||this.element.isComplete?this._collapseButton.icon=R.check:this.fixedScrollingMode||(y?this._collapseButton.icon=R.chevronDown:this._collapseButton.icon=R.circleFilled))})),this._register(be(S=>{let y=this._isExpanded.read(S);if(y&&!this.hasExpandedOnce&&this.lazyItems.length>0){this.hasExpandedOnce=!0,this.processPendingRemovals();for(let w of this.lazyItems)this.materializeLazyItem(w)}if(y&&!this.shouldAllowExpansion()&&(this.streamingCompleted||this.element.isComplete)){this.setExpanded(!1);return}this._externalResourceWidget.setCollapsed(!y),this._onDidChangeHeight.fire()}));let b=this.lastExtractedTitle??"";!this.fixedScrollingMode&&!this._isExpanded.get()&&this.setTitle(b),this._collapseButton&&this._register(this._collapseButton.onDidClick(()=>{if(this.streamingCompleted||this.fixedScrollingMode)return;this.isExpanded()?(this.setTitle(this.defaultTitle,!0),this.currentTitle=this.defaultTitle):this.lastExtractedTitle?this.setTitle(this.lastExtractedTitle):(this.setTitle(this.defaultTitle,!0),this.currentTitle=this.defaultTitle)}))}static _codeBlockRendererSync(e,t,o){let n=_("code");return n.textContent=t,n}get aggregatedDiff(){return this._aggregatedDiff}getRandomWorkingMessage(e="tool"){let t=this.availableMessagesByCategory.get(e);if(!t||t.length===0){let n;switch(e){case"thinking":n=Ftn;break;case"terminal":n=Wtn;break;default:n=Vtn;break}t=UDi(n,this.configurationService),this.availableMessagesByCategory.set(e,t)}let o=Math.floor(Math.random()*t.length);return t.splice(o,1)[0]}shouldInitEarly(){return this.fixedScrollingMode&&!this.streamingCompleted}initContent(){this.wrapper=_(".chat-used-context-list.chat-thinking-collapsible"),this.streamingCompleted||this.wrapper.classList.add("chat-thinking-streaming");let e=this.lazyItems.some(t=>t.kind==="thinking");if(this.currentThinkingValue&&!e&&(this.textContainer=_(".chat-thinking-item.markdown-content"),this.wrapper.appendChild(this.textContainer),this.renderMarkdown(this.currentThinkingValue)),!this.streamingCompleted&&!this.element.isComplete){this.workingSpinnerElement=_(".chat-thinking-item.chat-thinking-spinner-item");let t=tQ(R.circleFilled);this.workingSpinnerElement.appendChild(t),this.workingSpinnerLabel=_("span.chat-thinking-spinner-label"),this.workingSpinnerLabel.textContent=this.getRandomWorkingMessage("thinking"),this.workingSpinnerElement.appendChild(this.workingSpinnerLabel),this.wrapper.appendChild(this.workingSpinnerElement)}if(this.fixedScrollingMode){this.scrollableElement=this._register(new ms(this.wrapper,{vertical:1,horizontal:2,handleMouseWheel:!0,alwaysConsumeMouseWheel:!1})),this._register(this.scrollableElement.onScroll(o=>this.handleScroll(o.scrollTop)));let t=new MutationObserver(()=>{!this.streamingCompleted&&this.domNode.classList.contains("chat-used-context-collapsed")&&this.syncDimensionsAndScheduleScroll()});return t.observe(this.wrapper,{childList:!0,subtree:!0,characterData:!0}),this.mutationObserverDisposable={dispose:()=>t.disconnect()},this._register(this.mutationObserverDisposable),this._register(this._onDidChangeHeight.event(()=>{this.syncDimensionsAndScheduleScroll()})),this.syncDimensionsAndScheduleScroll(),this.updateDropdownClickability(),this.scrollableElement.getDomNode()}return this.updateDropdownClickability(),this.wrapper}handleScroll(e){if(!this.scrollableElement||this.isUpdatingDimensions)return;this.lastKnownScrollTop=e;let t=this.lastKnownContentHeight,o=Math.min(t,mge),n=t-o;this.autoScrollEnabled=n<=0||e>=n-10,this.updateFadeClasses(e,t,o)}updateFadeClasses(e,t,o){if(!this.fixedScrollingMode||this.streamingCompleted){this.domNode.classList.remove("chat-thinking-fade-top","chat-thinking-fade-bottom");return}let n=e??this.lastKnownScrollTop,r=t??this.lastKnownContentHeight,s=o??Math.min(r,mge),l=r-s;this.domNode.classList.toggle("chat-thinking-fade-top",n>5),this.domNode.classList.toggle("chat-thinking-fade-bottom",l>0&&n<l-5)}syncDimensionsAndScheduleScroll(){this.pendingScrollDisposable||(this.pendingScrollDisposable=Wr(Re(this.domNode),()=>{if(this.pendingScrollDisposable=void 0,!this._store.isDisposed){this.isUpdatingDimensions=!0;try{let e=this.updateScrollDimensions();this.autoScrollEnabled&&e!==void 0&&this.scrollToBottom(e)}finally{this.isUpdatingDimensions=!1}this.updateFadeClasses(this.lastKnownScrollTop,this.lastKnownContentHeight)}}))}updateScrollDimensions(){if(!this.scrollableElement||!this.domNode.classList.contains("chat-used-context-collapsed"))return;let t=this.wrapper.scrollHeight;this.lastKnownContentHeight=t;let o=Math.min(t,mge);return this.scrollableElement.setScrollDimensions({width:this.scrollableElement.getDomNode().clientWidth,scrollWidth:this.wrapper.scrollWidth,height:o,scrollHeight:t}),this.lastKnownScrollTop=this.scrollableElement.getScrollPosition().scrollTop,this.updateDropdownClickability(t),t}scrollToBottom(e){if(!this.scrollableElement)return;let t=Math.min(e,mge);if(e>t){let o=e-t;this.lastKnownScrollTop=o,this.scrollableElement.setScrollPosition({scrollTop:o})}}updateScrollDimensionsForCompletion(){if(!this.scrollableElement||!this.fixedScrollingMode)return;let e=this.wrapper.scrollHeight,t=Math.min(e,mge);this.scrollableElement.setScrollDimensions({width:this.scrollableElement.getDomNode().clientWidth,scrollWidth:this.wrapper.scrollWidth,height:t,scrollHeight:e}),e<=mge&&this.scrollableElement.setScrollPosition({scrollTop:0})}renderMarkdown(e,t){if(this._store.isDisposed)return;let o=e.trim();if(!o){this._markdownResult.clear(),this.textContainer&&Rt(this.textContainer);return}let n=o;o.startsWith("**")&&o.endsWith("**")&&(n=o.slice(2,-2));let r=t?this._markdownResult.value?.element:void 0,s=this.chatContentMarkdownRenderer.render(new Ie(n),{fillInIncompleteTokens:!0,asyncRenderCallback:this._asyncRenderCallback,codeBlockRendererSync:jk._codeBlockRendererSync},r);this._markdownResult.value=s,r||this.textContainer&&(Rt(this.textContainer),this.textContainer.appendChild(tQ(R.circleFilled)),this.textContainer.appendChild(s.element))}setFinalizedTitle(e){if(!this._collapseButton)return;let t=this._collapseButton.labelElement;t.textContent="";let o=e.indexOf(" ");if(o===-1)t.textContent=e;else{let n=e.substring(0,o),r=e.substring(o),s=_("span");s.textContent=n,t.appendChild(s);let l=_("span.chat-thinking-title-detail-text");l.textContent=r,t.appendChild(l)}if(this.diffStatsByPartId.size>0){let{added:n,removed:r}=this._aggregatedDiff;if(n>0||r>0){let s=_("span.chat-thinking-title-diff");s.appendChild(_("span.label-added",{},`+${n}`)),s.appendChild(_("span.label-removed",{},`-${r}`)),t.appendChild(s);let l=n===1?d(7796,null):d(7795,null,n),c=r===1?d(7785,null):d(7784,null,r);this._collapseButton.element.ariaLabel=d(7808,null,e,l,c)}else this._collapseButton.element.ariaLabel=e}else this._collapseButton.element.ariaLabel=e}setDropdownClickable(e){this._collapseButton&&(this._collapseButton.element.style.pointerEvents=e?"auto":"none"),!e&&this.streamingCompleted&&this.setFinalizedTitle(this.lastExtractedTitle??this.currentTitle)}shouldAllowExpansion(){if(this.toolInvocationCount>0||this.lazyItems.length>0||this.wrapper&&Array.from(this.wrapper.children).filter(s=>s!==this.workingSpinnerElement).length>1)return!0;let e=this.currentThinkingValue.trim(),t=this.lastExtractedTitle??this.currentTitle,n=(r=>r.replace(/\*\*(.+?)\*\*/g,"$1").replace(/\*(.+?)\*/g,"$1").replace(/`(.+?)`/g,"$1").trim())(e);return!(!n||n===t)}updateDropdownClickability(e){let t=this.shouldAllowExpansion();t&&this.fixedScrollingMode&&!this.streamingCompleted&&!this.element.isComplete&&this.wrapper&&(e??this.wrapper.scrollHeight)<=mge&&(t=!1),!t&&this.isExpanded()&&(this.streamingCompleted||this.element.isComplete)&&this.setExpanded(!1),this.setDropdownClickable(t)}appendToWrapper(e){this.wrapper&&(this.workingSpinnerElement&&this.workingSpinnerElement.parentNode===this.wrapper?this.wrapper.insertBefore(e,this.workingSpinnerElement):this.wrapper.appendChild(e))}resetId(){this.id=void 0}collapseContent(){this.setExpanded(!1)}updateThinking(e){if(this._store.isDisposed)return;this.content=e;for(let c of this.lazyItems)if(c.kind==="thinking"&&c.content.id===e.id){c.content=e;break}let t=Zvo(e),o=t;if(o===this.currentThinkingValue)return;let n=this.currentThinkingValue,r=!!(this._markdownResult.value&&o.startsWith(n)&&o.length>n.length);this.currentThinkingValue=o,this.renderMarkdown(o,r),this.fixedScrollingMode&&this.scrollableElement&&this.syncDimensionsAndScheduleScroll();let s=ebo(t);if(s&&s!==this.currentTitle&&(this.extractedTitles.includes(s)||this.extractedTitles.push(s),this.lastExtractedTitle=s),!s||s===this.currentTitle)return;let l=this.lastExtractedTitle??"";!this.fixedScrollingMode&&!this._isExpanded.get()&&this.setTitle(l),this.updateDropdownClickability()}getIsActive(){return this.isActive}isEffectivelyEmpty(){return!(this.toolInvocationCount>0||this.lazyItems.length>0||this.hookCount>0||this.currentThinkingValue.trim().length>0)}markAsInactive(){this.isActive=!1,this.domNode.classList.remove("chat-thinking-active"),this.domNode.classList.remove("chat-thinking-fade-top","chat-thinking-fade-bottom"),this.processPendingRemovals(),this.workingSpinnerElement&&(this.workingSpinnerElement.remove(),this.workingSpinnerElement=void 0,this.workingSpinnerLabel=void 0);for(let e of this.toolInvocations)e.isAttachedToThinking=!1}finalizeTitleIfDefault(){if(this.processPendingRemovals(),this.wrapper&&this.wrapper.classList.remove("chat-thinking-streaming"),this.domNode.classList.remove("chat-thinking-active"),this.domNode.classList.remove("chat-thinking-fade-top","chat-thinking-fade-bottom"),this.streamingCompleted=!0,this.mutationObserverDisposable&&(this.mutationObserverDisposable.dispose(),this.mutationObserverDisposable=void 0),this.workingSpinnerElement&&(this.workingSpinnerElement.remove(),this.workingSpinnerElement=void 0,this.workingSpinnerLabel=void 0),this._collapseButton&&(this._collapseButton.icon=R.check),this.updateScrollDimensionsForCompletion(),this.updateDropdownClickability(),this.content.generatedTitle){this.currentTitle=this.content.generatedTitle,this.setFinalizedTitle(this.content.generatedTitle);return}let e=this.toolInvocations.find(n=>n.generatedTitle)?.generatedTitle??this.allThinkingParts.find(n=>n.generatedTitle)?.generatedTitle;if(e){this.currentTitle=e,this.content.generatedTitle=e,this.setGeneratedTitleOnAllParts(e),this.setFinalizedTitle(e);return}if(this.toolInvocations.length>0&&this.toolInvocations.every(n=>n.kind==="toolInvocationSerialized")&&!Jr.isLocalSession(this.element.sessionResource)){let n=this.toolInvocations[this.toolInvocations.length-1];if(n){let r=this.getCachedTitle(n.toolCallId);if(r){this.currentTitle=r,this.content.generatedTitle=r,this.setGeneratedTitleOnAllParts(r),this.setFinalizedTitle(r);return}}}if(this.toolInvocationCount===1&&this.hookCount===0&&this.currentThinkingValue.trim()===""){if(!this.singleItemInfo){let r=this.lazyItems.find(s=>s.kind==="tool"&&s.originalParent);if(r&&r.kind==="tool"){let s=r.toolInvocationOrMarkdown&&(r.toolInvocationOrMarkdown.kind==="toolInvocation"||r.toolInvocationOrMarkdown.kind==="toolInvocationSerialized")?r.toolInvocationOrMarkdown:void 0,l=r.lazy.value;if(this.singleItemInfo={element:l.domNode,originalParent:r.originalParent,originalNextSibling:this.domNode,toolInvocation:s},l.disposable){let c=s?.toolCallId;c?this.ownedToolParts.set(c,l.disposable):this._register(l.disposable)}}}if((!this.singleItemInfo?.toolInvocation||Pi.isComplete(this.singleItemInfo.toolInvocation))&&this.singleItemInfo&&this.restoreSingleItemToOriginalPosition())return}if(this.extractedTitles.length===1&&this.toolInvocationCount===0){let n=this.extractedTitles[0];this.currentTitle=n,this.content.generatedTitle=n,this.setGeneratedTitleOnAllParts(n),this.setFinalizedTitle(n);return}if(!(this.configurationService.getValue("chat.agent.thinking.generateTitles")??!0)){this.setFallbackTitle();return}this.generateTitleViaLLM()}setGeneratedTitleOnAllParts(e){for(let t of this.toolInvocations)t.generatedTitle=e;for(let t of this.allThinkingParts)t.generatedTitle=e}loadTitleCache(){return this.storageService.getObject(BDi,0)??{}}saveTitleCache(e){Object.keys(e).length===0?this.storageService.remove(BDi,0):this.storageService.store(BDi,JSON.stringify(e),0,1)}getTitleCacheKey(e){return`${ap(this.element.sessionResource)}:${e}`}getCachedTitle(e){let t=this.loadTitleCache()[this.getTitleCacheKey(e)];if(!(!t||Date.now()-t.storedAt>tbo))return t.title}setCachedTitle(e,t){let o=this.loadTitleCache(),n=Date.now();for(let s of Object.keys(o))n-o[s].storedAt>tbo&&delete o[s];o[this.getTitleCacheKey(e)]={title:t,storedAt:n};let r=Object.keys(o);if(r.length>ibo){let s=r.sort((l,c)=>o[l].storedAt-o[c].storedAt);for(let l=0;l<s.length-ibo;l++)delete o[s[l]]}this.saveTitleCache(o)}async generateTitleViaLLM(){let e=new Ye,t=setTimeout(()=>e.cancel(),5e3);try{let o=await this.languageModelsService.selectLanguageModels({vendor:"copilot",id:"copilot-fast"});if(!o.length){this.setFallbackTitle();return}if(e.token.isCancellationRequested){this.setFallbackTitle();return}let n;this.extractedTitles.length>0?n=this.extractedTitles.join(", "):n=this.currentThinkingValue.substring(0,1e3);let r=`Summarize the following content in a SINGLE sentence (under 10 words) using past tense. Follow these rules strictly:

			OUTPUT FORMAT:
			- MUST be a single sentence
			- MUST be under 10 words
			- The FIRST word MUST be a past tense verb (e.g. "Updated", "Reviewed", "Created", "Searched", "Analyzed")
			- No quotes, no trailing punctuation

			GENERAL:
			- The content may include tool invocations (file edits, reads, searches, terminal commands), reasoning headers, or raw thinking text
			- For reasoning headers or thinking text (no tool calls), summarize WHAT was considered/analyzed, NOT that thinking occurred
			- For thinking-only summaries, use phrases like: "Considered...", "Planned...", "Analyzed...", "Reviewed..."

			TOOL NAME FILTERING:
			- NEVER include tool names like "Replace String in File", "Multi Replace String in File", "Create File", "Read File", etc. in the output
			- If an action says "Edited X and used Replace String in File", output ONLY the action on X
			- Tool names describe HOW something was done, not WHAT was done - always omit them

			VOCABULARY - Use varied synonyms for natural-sounding summaries:
			- For edits: "Updated", "Modified", "Changed", "Refactored", "Fixed", "Adjusted"
			- For reads: "Reviewed", "Examined", "Checked", "Inspected", "Analyzed", "Explored"
			- For creates: "Created", "Added", "Generated"
			- For searches: "Searched for", "Looked up", "Investigated"
			- For terminal: "Ran command", "Executed"
			- For reasoning/thinking: "Considered", "Planned", "Analyzed", "Reviewed", "Evaluated"
			- Choose the synonym that best fits the context

${this.hookCount>0?`BLOCKED/DENIED CONTENT (hooks detected):
			- Only mention "blocked" if the content explicitly includes hook results that blocked or warned about a tool (e.g. "Blocked terminal" or "Warning for read_file")
			- If blocked items are present alongside normal tool calls, briefly note the block but do NOT let it dominate the summary: e.g. "Updated file.ts, blocked terminal"

			`:`IMPORTANT: Do NOT use words like "blocked", "denied", or "tried" in the summary - there are no hooks or blocked items in this content. Just summarize normally.

			`}RULES FOR TOOL CALLS:
			1. If the SAME file was both edited AND read: Use a combined phrase like "Reviewed and updated <filename>"
			2. If exactly ONE file was edited: Start with an edit synonym + "<filename>" (include actual filename)
			3. If exactly ONE file was read: Start with a read synonym + "<filename>" (include actual filename)
			4. If MULTIPLE files were edited: Start with an edit synonym + "X files"
			5. If MULTIPLE files were read: Start with a read synonym + "X files"
			6. If BOTH edits AND reads occurred on DIFFERENT files: Combine them naturally
			7. For searches: Say "searched for <term>" or "looked up <term>" with the actual search term, NOT "searched for files"
			8. After the file info, you may add a brief summary of other actions if space permits
			9. NEVER say "1 file" - always use the actual filename when there's only one file

			RULES FOR REASONING HEADERS (no tool calls):
			1. If the input contains reasoning/analysis headers without actual tool invocations, summarize the main topic and what was considered
			2. Use past tense verbs that indicate thinking, not doing: "Considered", "Planned", "Analyzed", "Evaluated"
			3. Focus on WHAT was being thought about, not that thinking occurred

			RULES FOR RAW THINKING TEXT:
			1. Extract the main topic or question being considered from the text
			2. Identify any specific files, functions, or concepts mentioned
			3. Summarize as "Analyzed <topic>" or "Considered <specific thing>"
			4. If discussing code structure: "Reviewed <component/architecture>"
			5. If discussing a problem: "Analyzed <problem description>"
			6. If discussing implementation: "Planned <feature/change>"

			EXAMPLES WITH TOOLS:
			- "Read HomePage.tsx, Edited HomePage.tsx" \u2192 "Reviewed and updated HomePage.tsx"
			- "Edited HomePage.tsx" \u2192 "Updated HomePage.tsx"
			- "Edited config.css and used Replace String in File" \u2192 "Modified config.css"
			- "Edited App.tsx, used Multi Replace String in File" \u2192 "Refactored App.tsx"
			- "Read config.json, Read package.json" \u2192 "Reviewed 2 files"
			- "Edited App.tsx, Read utils.ts" \u2192 "Updated App.tsx and checked utils.ts"
			- "Edited App.tsx, Read utils.ts, Read types.ts" \u2192 "Updated App.tsx and reviewed 2 files"
			- "Edited index.ts, Edited styles.css, Ran terminal command" \u2192 "Modified 2 files and ran command"
			- "Read README.md, Searched for AuthService" \u2192 "Checked README.md and searched for AuthService"
			- "Searched for login, Searched for authentication" \u2192 "Searched for login and authentication"
			- "Edited api.ts, Edited models.ts, Read schema.json" \u2192 "Updated 2 files and reviewed schema.json"
			- "Edited Button.tsx, Edited Button.css, Edited index.ts" \u2192 "Modified 3 files"
			- "Searched codebase for error handling" \u2192 "Looked up error handling"

${this.hookCount>0?`EXAMPLES WITH BLOCKED CONTENT (from hooks):
			- "Blocked terminal, Edited config.ts" \u2192 "Edited config.ts, terminal was blocked"
			- "Blocked terminal, Blocked read_file" \u2192 "Two tools were blocked by hooks"
			- "Warning for read_file, Edited utils.ts" \u2192 "Edited utils.ts with a hook warning"

			`:""}EXAMPLES WITH REASONING HEADERS (no tools):
			- "Analyzing component architecture" \u2192 "Considered component architecture"
			- "Planning refactor strategy" \u2192 "Planned refactor strategy"
			- "Reviewing error handling approach, Considering edge cases" \u2192 "Analyzed error handling approach"
			- "Understanding the codebase structure" \u2192 "Reviewed codebase structure"
			- "Thinking about implementation options" \u2192 "Considered implementation options"

			EXAMPLES WITH RAW THINKING TEXT:
			- "I need to understand how the authentication flow works in this app..." \u2192 "Analyzed authentication flow"
			- "Let me think about how to refactor this component to be more maintainable..." \u2192 "Planned component refactoring"
			- "The error seems to be coming from the database connection..." \u2192 "Investigated database connection issue"
			- "Looking at the UserService class, I see it handles..." \u2192 "Reviewed UserService implementation"

			Content: ${n}`,s=await this.languageModelsService.sendChatRequest(o[0],void 0,[{role:1,content:[{type:"text",value:r}]}],{},e.token),l="";for await(let c of s.stream){if(e.token.isCancellationRequested)break;if(Array.isArray(c))for(let u of c)u.type==="text"&&(l+=u.value);else c.type==="text"&&(l+=c.value)}if(e.token.isCancellationRequested){this.setFallbackTitle();return}if(await s.result,l=l.trim(),l.includes("can't assist with that")){this.setFallbackTitle();return}if(l&&!this._store.isDisposed){if(this.currentTitle=l,this.setFinalizedTitle(l),this.content.generatedTitle=l,this.setGeneratedTitleOnAllParts(l),!Jr.isLocalSession(this.element.sessionResource)){let c=this.toolInvocations[this.toolInvocations.length-1];c&&this.setCachedTitle(c.toolCallId,l)}return}}catch{}finally{clearTimeout(t),e.dispose()}this.setFallbackTitle()}restoreSingleItemToOriginalPosition(){if(!this.singleItemInfo)return!1;let{element:e,originalParent:t,originalNextSibling:o,toolInvocation:n}=this.singleItemInfo;return e.childElementCount>1?(this.singleItemInfo=void 0,!1):(o&&o.parentNode===t?t.insertBefore(e,o):t.appendChild(e),n&&(n.isAttachedToThinking=!1),vo(this.domNode),this.singleItemInfo=void 0,!0)}updateAggregatedDiff(){let e=0,t=0;for(let o of this.diffStatsByPartId.values())e+=o.added,t+=o.removed;this._aggregatedDiff={added:e,removed:t},(this.streamingCompleted||this.element.isComplete)&&this.setFinalizedTitle(this.currentTitle)}setFallbackTitle(){let e=this.appendedItemCount>0?this.appendedItemCount===1?d(7791,null):d(7790,null,this.appendedItemCount):d(7789,null);this.currentTitle=e,this.wrapper&&this.wrapper.classList.remove("chat-thinking-streaming"),this.domNode.classList.remove("chat-thinking-active"),this.streamingCompleted=!0,this._collapseButton&&(this._collapseButton.icon=R.check,this.setFinalizedTitle(e)),this.updateDropdownClickability()}appendItem(e,t,o,n,r){if(this.processPendingRemovals(),this.trackToolMetadata(t,o),this.appendedItemCount++,r&&t&&this._register(r(s=>{this.diffStatsByPartId.set(t,s),this.updateAggregatedDiff()})),this.workingSpinnerLabel){let l=o&&(o.kind==="toolInvocation"||o.kind==="toolInvocationSerialized")&&o.toolSpecificData?.kind==="terminal"?"terminal":"tool";this.workingSpinnerLabel.textContent=this.getRandomWorkingMessage(l)}if(this.isExpanded()||this.hasExpandedOnce||this.fixedScrollingMode&&!this.streamingCompleted){let s=e();if(this.appendItemToDOM(s.domNode,t,o,n),s.disposable){let l=o&&(o.kind==="toolInvocation"||o.kind==="toolInvocationSerialized")?o.toolCallId:void 0;l?this.ownedToolParts.set(l,s.disposable):this._register(s.disposable)}}else{let s={kind:"tool",lazy:new co(e),toolInvocationId:t,toolInvocationOrMarkdown:o,originalParent:n,isHook:!o&&!!t};this.lazyItems.push(s)}this.updateDropdownClickability()}removeMaterializedItem(e){this.toolDisposables.deleteAndDispose(e),this.ownedToolParts.delete(e),this.toolWrappersByCallId.get(e)&&(this.toolWrappersByCallId.delete(e),this.toolIconsByCallId.delete(e)),this.appendedItemCount=Math.max(0,this.appendedItemCount-1),this.toolInvocationCount=Math.max(0,this.toolInvocationCount-1);let o=this.toolInvocations.findIndex(n=>(n.kind==="toolInvocation"||n.kind==="toolInvocationSerialized")&&n.toolCallId===e);if(o!==-1){let n=this.toolLabelsByCallId.get(e);if(n){let r=this.extractedTitles.indexOf(n);r!==-1&&this.extractedTitles.splice(r,1)}this.toolInvocations.splice(o,1)}this.toolLabelsByCallId.delete(e),this._externalResourceWidget.removeToolInvocation(e),this.updateDropdownClickability(),this._onDidChangeHeight.fire()}removeLazyItem(e){let t=this.lazyItems.findIndex(r=>r.kind==="tool"&&r.toolInvocationId===e);if(t===-1)return!1;let o=this.lazyItems[t];if(this.lazyItems.splice(t,1),this.appendedItemCount--,o.kind==="tool"&&o.isHook?this.hookCount=Math.max(0,this.hookCount-1):this.toolInvocationCount--,o.kind==="tool"&&o.toolInvocationOrMarkdown&&(o.toolInvocationOrMarkdown.kind==="toolInvocation"||o.toolInvocationOrMarkdown.kind==="toolInvocationSerialized")){o.toolInvocationOrMarkdown.isAttachedToThinking=!1;let r=o.toolInvocationOrMarkdown.toolCallId;this._externalResourceWidget.removeToolInvocation(r);let s=this.toolLabelsByCallId.get(r);if(s){let l=this.extractedTitles.indexOf(s);l!==-1&&this.extractedTitles.splice(l,1)}this.toolLabelsByCallId.delete(r)}let n=this.toolInvocations.findIndex(r=>(r.kind==="toolInvocation"||r.kind==="toolInvocationSerialized")&&r.toolId===e);return n!==-1&&this.toolInvocations.splice(n,1),this.updateDropdownClickability(),!0}processPendingRemovals(){if(this.pendingRemovalFlushDisposable?.dispose(),this.pendingRemovalFlushDisposable=void 0,this.pendingRemovals.length===0)return;let e=this.pendingRemovals;this.pendingRemovals=[];for(let t of e)this.removeStreamingToolEntry(t.toolCallId,t.toolLabel)}schedulePendingRemovalsFlush(){this.pendingRemovalFlushDisposable||(this.pendingRemovalFlushDisposable=Wr(Re(this.domNode),()=>{this.pendingRemovalFlushDisposable=void 0,!this._store.isDisposed&&this.processPendingRemovals()}))}removeStreamingToolEntry(e,t){this.toolDisposables.deleteAndDispose(e),this.ownedToolParts.get(e)?.dispose(),this.ownedToolParts.delete(e);let o=this.toolWrappersByCallId.get(e);o&&(o.remove(),this.toolWrappersByCallId.delete(e),this.toolIconsByCallId.delete(e));let n=this.lazyItems.findIndex(l=>l.kind==="tool"&&l.toolInvocationOrMarkdown&&(l.toolInvocationOrMarkdown.kind==="toolInvocation"||l.toolInvocationOrMarkdown.kind==="toolInvocationSerialized")&&l.toolInvocationOrMarkdown.toolCallId===e);if(n!==-1){let l=this.lazyItems[n];l.kind==="tool"&&l.toolInvocationOrMarkdown&&(l.toolInvocationOrMarkdown.kind==="toolInvocation"||l.toolInvocationOrMarkdown.kind==="toolInvocationSerialized")&&(l.toolInvocationOrMarkdown.isAttachedToThinking=!1),this.lazyItems.splice(n,1)}this.appendedItemCount=Math.max(0,this.appendedItemCount-1),this.toolInvocationCount=Math.max(0,this.toolInvocationCount-1);let r=this.toolInvocations.findIndex(l=>(l.kind==="toolInvocation"||l.kind==="toolInvocationSerialized")&&l.toolCallId===e);r!==-1&&this.toolInvocations.splice(r,1);let s=this.extractedTitles.indexOf(t);s!==-1&&this.extractedTitles.splice(s,1),this.toolLabelsByCallId.delete(e),this._externalResourceWidget.removeToolInvocation(e),this.updateDropdownClickability(),this._onDidChangeHeight.fire()}trackToolMetadata(e,t){if(!e)return;!t?this.hookCount++:this.toolInvocationCount++,this.toolInvocationCount===1&&(this.defaultTitle=this.workingTitle);let n;if(t&&(t.kind==="toolInvocation"||t.kind==="toolInvocationSerialized")&&t.invocationMessage){let s=typeof t.invocationMessage=="string"?t.invocationMessage:t.invocationMessage.value;t.kind==="toolInvocation"&&Pi.isStreaming(t)&&Otn(t.toolId)?n=d(7788,null):n=s,this.toolInvocations.push(t);let c=t.toolCallId;if(this.toolLabelsByCallId.set(c,n),t.kind==="toolInvocationSerialized"&&this.updateExternalResourceParts(t),t.kind==="toolInvocation"){let u=n,p=!1,h=Pi.isStreaming(t),g=new N;this.toolDisposables.set(t.toolCallId,g);let f=b=>{if(b&&b!==u){let S=this.extractedTitles.indexOf(u),y=this.extractedTitles.indexOf(b);S!==-1?y!==-1&&y!==S?this.extractedTitles.splice(S,1):this.extractedTitles[S]=b:y===-1&&this.extractedTitles.push(b),u=b,this.toolLabelsByCallId.set(c,b),this.lastExtractedTitle=b,!this.fixedScrollingMode&&!this._isExpanded.read(void 0)&&this.setTitle(b)}},v=be(b=>{if(p)return;let S=t.state.read(b);if(h&&S.type!==Pi.StateKind.Streaming){h=!1;let w=t.toolSpecificData;if(w?.kind==="terminal"){let k=this.toolIconsByCallId.get(c);if(k){let T=w.commandLine?.isSandboxWrapped?R.terminalSecure:R.terminal;k.className="chat-thinking-icon",k.classList.add(...q.asClassNameArray(T))}}if(t.presentation==="hidden"){this.pendingRemovals.push({toolCallId:t.toolCallId,toolLabel:u}),this.schedulePendingRemovalsFlush(),p=!0;return}}if(S.type===Pi.StateKind.Completed||S.type===Pi.StateKind.Cancelled){(t.presentation==="hidden"||t.presentation==="hiddenAfterComplete")&&(this.pendingRemovals.push({toolCallId:t.toolCallId,toolLabel:u}),this.schedulePendingRemovalsFlush()),S.type===Pi.StateKind.Completed&&this.updateExternalResourceParts(t),p=!0;return}if(S.type===Pi.StateKind.Streaming){h=!0;let w=S.streamingMessage.read(b);if(w){let k=typeof w=="string"?w:w.value;f(k)}return}if(S.type===Pi.StateKind.Executing){let w=S.progress.read(b);if(w.message){let k=typeof w.message=="string"?w.message:w.message.value;f(k)}else{let k=t.invocationMessage;if(k){let T=typeof k=="string"?k:k.value;f(T)}}return}let y=t.invocationMessage;if(y){let w=typeof y=="string"?y:y.value;f(w)}});g.add(v)}}else if(t?.kind==="markdownContent"){let s=JAe(t.content.value);if(s?.uri){let l=He(s.uri);n=d(7786,null,l)}else n=d(7787,null)}else n=e;this.extractedTitles.includes(n)||this.extractedTitles.push(n),this.lastExtractedTitle=n,!this.fixedScrollingMode&&!this._isExpanded.get()&&this.setTitle(n)}updateExternalResourceParts(e){let t=mot(e,this.element.sessionResource);if(t.length===0)return;let o=t.map(n=>({kind:"data",value:n.data.buffer,mimeType:n.mimeType,uri:n.uri}));this._externalResourceWidget.setToolInvocationParts(e.toolCallId,o)}appendItemToDOM(e,t,o,n){if(!e.hasChildNodes()||e.textContent?.trim()==="")return;if(this.toolInvocationCount===1&&this.hookCount===0&&n){let g=o&&(o.kind==="toolInvocation"||o.kind==="toolInvocationSerialized")?o:void 0;this.singleItemInfo={element:e,originalParent:n,originalNextSibling:this.domNode,toolInvocation:g}}else this.singleItemInfo=void 0;let r=_(".chat-thinking-tool-wrapper"),s=o?.kind==="markdownContent",l=o&&(o.kind==="toolInvocation"||o.kind==="toolInvocationSerialized")&&o.toolSpecificData?.kind==="terminal",c=o&&(o.kind==="toolInvocation"||o.kind==="toolInvocationSerialized")?o.icon:void 0,u;if(s)u=R.pencil;else if(l){let g=o.toolSpecificData,f=g?.terminalCommandState?.exitCode,v=g?.commandLine?.isSandboxWrapped;f!==void 0&&f!==0?u=R.error:v?u=R.terminalSecure:u=c??R.terminal}else e.classList.contains("chat-hook-outcome-blocked")?u=R.error:e.classList.contains("chat-hook-outcome-warning")?u=R.warning:u=t?HDi(t,c):R.tools;let p=tQ(u);r.appendChild(p),r.appendChild(e),o&&(o.kind==="toolInvocation"||o.kind==="toolInvocationSerialized")&&o.toolCallId&&(this.toolWrappersByCallId.set(o.toolCallId,r),this.toolIconsByCallId.set(o.toolCallId,p)),this.appendToWrapper(r),this.fixedScrollingMode&&this.scrollableElement&&this.syncDimensionsAndScheduleScroll()}materializeLazyItem(e){if(e.kind==="thinking"){this.appendToWrapper(e.textContainer),this.textContainer=e.textContainer,this.id=e.content.id,this.updateThinking(e.content);return}if(this.workingSpinnerLabel){let n=e.toolInvocationOrMarkdown&&(e.toolInvocationOrMarkdown.kind==="toolInvocation"||e.toolInvocationOrMarkdown.kind==="toolInvocationSerialized")&&e.toolInvocationOrMarkdown.toolSpecificData?.kind==="terminal"?"terminal":"tool";this.workingSpinnerLabel.textContent=this.getRandomWorkingMessage(n)}if(e.lazy.hasValue){let o=e.lazy.value;o.domNode.parentElement||this.appendItemToDOM(o.domNode,e.toolInvocationId,e.toolInvocationOrMarkdown,e.originalParent);return}let t=e.lazy.value;if(this.appendItemToDOM(t.domNode,e.toolInvocationId,e.toolInvocationOrMarkdown,e.originalParent),t.disposable){let o=e.toolInvocationOrMarkdown&&(e.toolInvocationOrMarkdown.kind==="toolInvocation"||e.toolInvocationOrMarkdown.kind==="toolInvocationSerialized")?e.toolInvocationOrMarkdown.toolCallId:void 0;o?this.ownedToolParts.set(o,t.disposable):this._register(t.disposable)}}setupThinkingContainer(e){if(!this._store.isDisposed){if(this.appendedItemCount++,this.allThinkingParts.push(e),this.textContainer=_(".chat-thinking-item.markdown-content"),e.value){if(this.isExpanded()||this.hasExpandedOnce||this.fixedScrollingMode&&!this.streamingCompleted)this.appendToWrapper(this.textContainer),this.id=e.id,this.updateThinking(e);else{this.content=e,this.id=e.id;let t={kind:"thinking",textContainer:this.textContainer,content:e};this.lazyItems.push(t)}this.workingSpinnerLabel&&(this.workingSpinnerLabel.textContent=this.getRandomWorkingMessage("thinking"))}this.updateDropdownClickability()}}setTitle(e,t){if(!e||this.element.isComplete)return;if(t){if(this._collapseButton){let s=this._collapseButton.labelElement;s.textContent="";let l=_("span");l.textContent=e,s.appendChild(l),this._collapseButton.element.ariaLabel=e}this.titleShimmerSpan=void 0,this.titleDetailContainer=void 0,this._titleDetailRendered.clear(),this.currentTitle=e;return}this.lastExtractedTitle=e;let o=d(7797,null,this.defaultTitle,e);if(this.currentTitle=o,!this._collapseButton)return;let n=this._collapseButton.labelElement;(!this.titleShimmerSpan||!this.titleShimmerSpan.parentElement)&&(n.textContent="",this.titleShimmerSpan=_("span.chat-thinking-title-shimmer"),n.appendChild(this.titleShimmerSpan)),this.titleShimmerSpan.textContent=d(7798,null,this.defaultTitle),this._titleDetailRendered.clear();let r=this.chatContentMarkdownRenderer.render(new Ie(e));r.element.classList.add("collapsible-title-content","chat-thinking-title-detail"),$k(r.element,this.instantiationService,this.chatMarkdownAnchorService,this._store),this._titleDetailRendered.value=r,this.titleDetailContainer?this.titleDetailContainer.replaceWith(r.element):n.appendChild(r.element),this.titleDetailContainer=r.element,this._collapseButton.element.ariaLabel=o,this._collapseButton.element.ariaExpanded=String(this.isExpanded())}hasSameContent(e,t,o){return o.isComplete||e.kind==="toolInvocation"||e.kind==="toolInvocationSerialized"||e.kind==="markdownContent"||e.kind==="hook"?!0:e.kind!=="thinking"?!1:e?.id!==this.id}dispose(){this.isActive=!1,this.workingSpinnerElement&&(this.workingSpinnerElement.remove(),this.workingSpinnerElement=void 0,this.workingSpinnerLabel=void 0),this.pendingRemovalFlushDisposable?.dispose(),this.pendingRemovalFlushDisposable=void 0,this.pendingScrollDisposable?.dispose(),super.dispose()}};jk=I([m(4,F),m(5,B),m(6,Gv),m(7,ds),m(8,nt),m(9,ce)],jk);var XD=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this.chatContentMarkdownRenderer=t;this.toolInvocation=l;this.instantiationService=u;this.chatMarkdownAnchorService=p;this.configurationService=h;this.renderedMessage=this._register(new me);this._fileWidgetStore=this._register(new N);this.currentContent=e.content;let g=o.content.slice(o.contentIndex+1);if(this.showSpinner=n??nbo(g,o.element),this.isHidden=r!==!0&&g.some(k=>k.kind!=="progressMessage"),this.isHidden){this.domNode=_("");return}this.showSpinner&&this.configurationService.getValue("accessibility.verboseChatProgressUpdates")&&en(Nu(Da(e.content)));let f=s&&q.isEqual(s,q.modify(R.loading,"spin")),v=(c??(!s||f))&&this.showSpinner,b=v?R.check:s??(this.showSpinner?q.modify(R.loading,"spin"):R.check),S=this.chatContentMarkdownRenderer.render(e.content);S.element.classList.add("progress-step"),$k(S.element,this.instantiationService,this.chatMarkdownAnchorService,this._fileWidgetStore);let y=this.createApprovalMessage(),w=this._register(u.createInstance(uN,S.element,b,y));this.domNode=w.domNode,v&&this.domNode.classList.add("shimmer-progress"),this.renderedMessage.value=S}updateMessage(e){if(this.isHidden)return;let t=this._register(this.chatContentMarkdownRenderer.render(e));t.element.classList.add("progress-step"),this._fileWidgetStore.clear(),$k(t.element,this.instantiationService,this.chatMarkdownAnchorService,this._fileWidgetStore),this.renderedMessage.value?this.renderedMessage.value.element.replaceWith(t.element):this.domNode.appendChild(t.element),this.renderedMessage.value=t}hasSameContent(e,t,o){if(t.some(r=>r.kind!=="progressMessage")&&!this.isHidden)return!1;let n=nbo(t,o);return e.kind==="progressMessage"&&e.content.value!==this.currentContent.value?!1:e.kind==="progressMessage"&&this.showSpinner===n}createApprovalMessage(){return this.toolInvocation&&_ie(this.toolInvocation)}};XD=I([m(8,F),m(9,Gv),m(10,B)],XD);function nbo(a,i){return Ui(i)&&!i.isComplete&&a.length===0}var uN=class extends x{constructor(i,e,t,o){super(),this.domNode=_(".progress-container");let n=_("div");n.classList.add(...q.asClassNameArray(e)),t&&(this._register(o.setupDelayedHover(n,{content:t,style:1})),this._register(o.setupDelayedHover(i,{content:t,style:1}))),M(this.domNode,n),i.classList.add("progress-step"),M(this.domNode,i)}};uN=I([m(3,nt)],uN);var hge=class extends XD{constructor(i,e,t,o,n,r,s){let l=d(7716,null),c=UDi([l],r),u=c[Math.floor(Math.random()*c.length)],p={kind:"progressMessage",content:new Ie().appendText(u)};super(p,e,t,void 0,void 0,void 0,void 0,!0,o,n,r),this._register(s.onDidPrepareToolCallBecomeUnresponsive(h=>{Qe(t.element.sessionResource,h.sessionResource)&&this.updateMessage(new Ie(d(7715,null,h.toolData.displayName)))}))}hasSameContent(i,e,t){return i.kind==="working"}};hge=I([m(3,F),m(4,Gv),m(5,B),m(6,Vn)],hge);var COe=class extends x{constructor(e,t,o,n,r,s){super();this.data=e;this.context=t;this.mcpService=o;this.instantiationService=n;this._openerService=r;this._markdownRendererService=s;this.interactionMd=this._register(new me);this.showSpecificServersScheduler=this._register(new Dt(()=>this.updateDetailedProgress(this.data.state.get()),2500));this.previousParts=new co(()=>Ui(this.context.element)?this.context.element.session.getItems().filter((e,t)=>Ui(e)&&t<this.context.elementIndex).flatMap(e=>e.response.value.filter(t=>t.kind==="mcpServersStarting")).map(e=>e.state?.get()):[]);this.domNode=_(".chat-mcp-servers-interaction"),e.state&&this._register(be(l=>{let c=e.state.read(l);this.updateForState(c)}))}updateForState(e){e.working?this.workingProgressPart?this.workingProgressPart&&this.updateDetailedProgress(e):this.showSpecificServersScheduler.isScheduled()||this.showSpecificServersScheduler.schedule():(this.workingProgressPart?.domNode.remove(),this.workingProgressPart=void 0,this.showSpecificServersScheduler.cancel());let t=e.serversRequiringInteraction.filter(o=>!(this.data.didStartServerIds?.includes(o.id)||this.previousParts.value.some(n=>n?.serversRequiringInteraction.some(r=>o.id===r.id))));t.length>0?this.interactionMd.value?this.updateInteractionRequired(this.interactionMd.value.element,t):this.renderInteractionRequired(t):t.length===0&&this.interactionContainer&&(this.interactionContainer.remove(),this.interactionContainer=void 0)}createServerCommandLinks(e){return e.map(t=>pw({text:"`"+PP(t.label)+"`",id:"workbench.mcp.serverOptions",arguments:[t.id],tooltip:d(7702,null,t.label)},!1)).join(", ")}updateDetailedProgress(e){let t=pw({text:d(7703,null),id:"workbench.mcp.skipAutostart",tooltip:d(7704,null)}),o;if(e.starting.length===0)o=new Ie(void 0,{isTrusted:!0}).appendText(d(7709,null)+" ").appendMarkdown(t);else{let n=this.createServerCommandLinks(e.starting);o=new Ie(void 0,{isTrusted:!0}).appendMarkdown(d(7708,null,n)+" ").appendMarkdown(t)}this.workingProgressPart?this.workingProgressPart.updateMessage(o):(this.workingProgressPart=this._register(this.instantiationService.createInstance(XD,{kind:"progressMessage",content:o},this._markdownRendererService,this.context,!0,!0,void 0,void 0,!1)),this.domNode.appendChild(this.workingProgressPart.domNode))}renderInteractionRequired(e){this.interactionContainer=_(".chat-mcp-servers-interaction-hint");let t=_(".chat-mcp-servers-message"),o=_(".chat-mcp-servers-icon");o.classList.add(...q.asClassNameArray(R.mcp));let{messageMd:n}=this.createInteractionMessage(e);t.appendChild(o),t.appendChild(n.element),this.interactionContainer.appendChild(t),this.domNode.prepend(this.interactionContainer)}updateInteractionRequired(e,t){let{messageMd:o}=this.createInteractionMessage(t);e.replaceWith(o.element)}createInteractionMessage(e){let t=e.length,o=this.createServerCommandLinks(e),n=t===1?d(7706,null,o,"#start"):d(7705,null,o,"#start"),r=new Ie(n,{isTrusted:!0}),s=this.interactionMd.value=this._markdownRendererService.render(r,{actionHandler:c=>c.startsWith("command:")?U_(this._openerService,c,!0):(this._start(l),Promise.resolve(!0))}),l=[...s.element.querySelectorAll("a")].find(c=>!c.getAttribute("data-href")?.startsWith("command:"));return l?(l.setAttribute("role","button"),l.href="",{messageMd:s,startLink:l}):{messageMd:s,startLink:void 0}}async _start(e){e.style.pointerEvents="none",e.style.opacity="0.7";try{if(!this.data.state)return;let o=this.data.state.get().serversRequiringInteraction;for(let n=0;n<o.length;n++){let r=o[n];e.textContent=d(7707,null,r.label);let s=this.mcpService.servers.get().find(l=>l.definition.id===r.id);s&&(await hW(s,{promptType:"all-untrusted"}),this.data.didStartServerIds??=[],this.data.didStartServerIds.push(r.id))}this.interactionContainer&&(this.interactionContainer.remove(),this.interactionContainer=void 0)}catch{e.style.pointerEvents="",e.style.opacity="",e.textContent="Start now?"}}hasSameContent(e){return e.kind==="mcpServersStarting"}addDisposable(e){this._register(e)}};COe=I([m(2,_s),m(3,F),m(4,Je),m(5,On)],COe);var xOe=class extends x{constructor(e,t,o){super();this._openerService=t;this._markdownRendererService=o;this.domNode=_(".chat-disabled-claude-hooks");let n=_(".chat-disabled-claude-hooks-message"),r=_(".chat-disabled-claude-hooks-icon");r.classList.add(...q.asClassNameArray(R.info));let s=pw({text:d(7672,null),id:"workbench.action.openSettings",arguments:[Ss.USE_CLAUDE_HOOKS],tooltip:d(7673,null)}),l=d(7674,null,s),c=new Ie(l,{isTrusted:!0}),u=this._register(this._markdownRendererService.render(c,{actionHandler:p=>U_(this._openerService,p,!0)}));n.appendChild(r),n.appendChild(u.element),this.domNode.appendChild(n)}hasSameContent(e){return e.kind==="disabledClaudeHooks"}addDisposable(e){this._register(e)}};xOe=I([m(1,Je),m(2,On)],xOe);var iQ=_,Btn=22,Htn=6,kOe=class extends x{constructor(e,t,o,n,r,s){super();this.content=e;this._element=t;this.instantiationService=o;this.editorService=n;this.themeService=r;this.contextKeyService=s;this.isCollapsed=!1;this.readOnly=e.readOnly??!1,this.diffData=rO(this.content.multiDiffData)?this.content.multiDiffData.map(c=>c):So(this.content.multiDiffData);let l=iQ(".checkpoint-file-changes-summary-header");this.domNode=iQ(".checkpoint-file-changes-summary",void 0,l),this.domNode.tabIndex=0,this.isCollapsed=e?.collapsed??!1,this._register(this.renderHeader(l)),this._register(this.renderFilesList(this.domNode))}renderHeader(e){let t=e.appendChild(iQ(".chat-file-changes-label")),o=new mR(t,{});this._register(be(s=>{let l=this.diffData.read(s).resources.length;o.label=l===1?d(7712,null):d(7711,null,l)}));let n=()=>{o.icon=this.isCollapsed?R.chevronRight:R.chevronDown,this.domNode.classList.toggle("chat-file-changes-collapsed",this.isCollapsed)};n();let r=new N;return r.add(o),r.add(o.onDidClick(()=>{this.isCollapsed=!this.isCollapsed,n()})),this.readOnly||r.add(this.renderViewAllFileChangesButton(o.element)),r.add(this.renderContributedButtons(o.element)),Z(()=>r.dispose())}renderViewAllFileChangesButton(e){let t=e.appendChild(iQ(".chat-view-changes-icon"));return t.classList.add(...q.asClassNameArray(R.diffMultiple)),t.title=d(7713,null),j(t,"click",o=>{let n=A.parse(`multi-diff-editor:${new Date().getMilliseconds().toString()+Math.random().toString()}`),{title:r,resources:s}=this.diffData.get(),l=this.instantiationService.createInstance(au,n,r||"Multi-Diff",s.map(u=>new xk(u.originalUri,u.modifiedUri,u.goToFileUri)),!1),c=o.altKey;this.editorService.openEditor(l,c?In:jn),Xt.stop(o,!0)})}renderContributedButtons(e){let t=e.appendChild(iQ(".chat-multidiff-contributed-buttons")),o=new N,n=gl(this._element.sessionResource),r=this.contextKeyService.createOverlay([[ie.agentSessionType.key,n]]),s=o.add(this.instantiationService.createChild(new _o([X,r]))),l={...this._element.sessionResource,$mid:1};return o.add(s.createInstance(or,t,D.ChatMultiDiffContext,{menuOptions:{arg:l,shouldForwardArgs:!0},toolbarOptions:{primaryGroup:()=>!0}})),o}renderFilesList(e){let t=new N,o=e.appendChild(iQ(".chat-summary-list"));t.add(Q8(o,this.themeService));let n=t.add(this.instantiationService.createInstance(Nl,{onDidChangeVisibility:U.None}));return this.list=t.add(this.instantiationService.createInstance(Vl,"ChatMultiDiffList",o,new zDi,[this.instantiationService.createInstance(KDi,n)],{identityProvider:{getId:r=>r.uri.toString()},setRowLineHeight:!0,horizontalScrolling:!1,supportDynamicHeights:!1,mouseSupport:!this.readOnly,alwaysConsumeMouseWheel:!1,accessibilityProvider:{getAriaLabel:r=>r.uri.path,getWidgetAriaLabel:()=>d(7714,null)}})),this._register(be(r=>{let{resources:s}=this.diffData.read(r),l=[];for(let u of s){let p=u.modifiedUri||u.originalUri||u.goToFileUri;if(!p)continue;let h={uri:p};u.originalUri&&u.modifiedUri&&(h.diff={originalURI:u.originalUri,modifiedURI:u.modifiedUri,isFinal:!0,quitEarly:!1,identical:!1,added:u.added||0,removed:u.removed||0,isBusy:!1}),l.push(h)}this.list.splice(0,this.list.length,l);let c=Math.min(l.length,Htn)*Btn;this.list.layout(c),o.style.height=`${c}px`})),this.readOnly||t.add(this.list.onDidOpen(r=>{r.element&&(r.element.diff?this.editorService.openEditor({original:{resource:r.element.diff.originalURI},modified:{resource:r.element.diff.modifiedURI},options:{preserveFocus:!0}}):this.editorService.openEditor({resource:r.element.uri,options:{preserveFocus:!0}}))})),t}hasSameContent(e){return e.kind==="multiDiffData"&&this.diffData.get().resources.length===(rO(e.multiDiffData)?e.multiDiffData.get().resources.length:e.multiDiffData.resources.length)}addDisposable(e){this._register(e)}};kOe=I([m(2,F),m(3,ee),m(4,Le),m(5,X)],kOe);var zDi=class{getHeight(){return 22}getTemplateId(){return"chatMultiDiffItem"}},KDi=class a{constructor(i){this.labels=i;this.templateId=a.TEMPLATE_ID}static{this.TEMPLATE_ID="chatMultiDiffItem"}static{this.CHANGES_SUMMARY_CLASS_NAME="insertions-and-deletions"}renderTemplate(i){let e=this.labels.create(i,{supportHighlights:!0,supportIcons:!0});return{label:e,dispose:()=>e.dispose()}}renderElement(i,e,t){t.label.setFile(i.uri,{fileKind:0,title:i.uri.path});let o=t.label.element;if(t.changesElement?.remove(),i.diff?.added||i.diff?.removed){let n=o.appendChild(iQ(`.${a.CHANGES_SUMMARY_CLASS_NAME}`)),r=n.appendChild(iQ(".insertions"));r.textContent=`+${i.diff.added}`;let s=n.appendChild(iQ(".deletions"));s.textContent=`-${i.diff.removed}`,n.setAttribute("aria-label",d(7710,null,i.diff.added,i.diff.removed)),t.changesElement=n}}disposeTemplate(i){i.dispose()}};var EOe=class extends x{constructor(e,t){super();this.pullRequestContent=e;this.commandService=t;this.domNode=_(".chat-pull-request-content-part");let o=M(this.domNode,_(".container")),n=M(o,_(".content-container")),r=M(n,_(".title-container"));M(r,_(".icon")).classList.add(...q.asClassNameArray(R.gitPullRequest));let l=M(r,_("a.title"));l.textContent=`${this.pullRequestContent.title} - ${this.pullRequestContent.author}`,this.pullRequestContent.uri&&(l.href=this.pullRequestContent.uri?.toString()),this._register(j(l,"click",c=>{c.preventDefault(),c.stopPropagation(),this.commandService.executeCommand(this.pullRequestContent.command.id,...this.pullRequestContent.command.arguments??[])}))}hasSameContent(e,t,o){return e.kind==="pullRequest"}addDisposable(e){this._register(e)}};EOe=I([m(1,ge)],EOe);var mKt=_,rbo=!1,sbo=!1,TOe=class extends x{constructor(e,t,o,n,r,s,l){super();this.content=t;let c=e.errorDetails;wo(!!c,"errorDetails"),this.domNode=mKt(".chat-quota-error-widget"),M(this.domNode,mKt("span")).classList.add(...q.asClassNameArray(R.warning));let p=M(this.domNode,mKt(".chat-quota-error-message")),h=this._register(o.render(new Ie(c.message)));M(p,h.element);let g;switch(l.entitlement){case 10:case 6:case 7:g=d(7753,null);break;case 5:g=d(7754,null);break}let f=!1,v=()=>{!sbo||f||(f=!0,M(p,mKt(".chat-quota-wait-warning",void 0,d(7755,null))))},b=!1,S=()=>{if(!rbo||b)return;b=!0;let y=this._register(new Wi(p,{buttonBackground:void 0,buttonForeground:kt(nS)}));y.element.classList.add("chat-quota-error-secondary-button"),y.label=d(7752,null),this._register(y.onDidClick(()=>{let w=n.getWidgetBySessionResource(e.sessionResource);w&&(w.rerunLastRequest(),sbo=!0,v())}))};if(g){let y=this._register(new Wi(p,{...Qo,supportIcons:!0}));y.label=g,y.element.classList.add("chat-quota-error-button"),this._register(y.onDidClick(async()=>{let w=l.entitlement===5?"workbench.action.chat.upgradePlan":"workbench.action.chat.manageOverages";s.publicLog2("workbenchActionExecuted",{id:w,from:"chat-response"}),await r.executeCommand(w),rbo=!0,S()}))}S(),v()}hasSameContent(e){return e.kind===this.content.kind&&!!e.errorDetails.isQuotaExceeded}addDisposable(e){this._register(e)}};TOe=I([m(3,Pt),m(4,ge),m(5,Te),m(6,rr)],TOe);var _Oe=class extends x{constructor(e,t,o,n,r){super();this.task=e;if(e.progress.length){this.isSettled=!0;let s=this._register(r.createInstance(Y8,e.progress,e.content.value,n,t,void 0));this.domNode=_(".chat-progress-task"),this.domNode.appendChild(s.domNode)}else{let s=e.kind==="progressTask"?e.isSettled():!0;this.isSettled=s;let l=!s&&!n.element.isComplete,c=this._register(r.createInstance(XD,e,o,n,l,!0,void 0,void 0,void 0));this.domNode=c.domNode}}hasSameContent(e){return e.kind==="progressTask"&&this.task.kind==="progressTask"&&e.isSettled()!==this.isSettled?!1:e.kind===this.task.kind&&e.progress.length===this.task.progress.length}addDisposable(e){this._register(e)}};_Oe=I([m(4,F)],_Oe);var abo=_,lbo=le("ICodeCompareModelService"),DOe=class extends x{constructor(e,t,o,n,r,s){super();this.codeCompareModelService=s;let l=t.element;if(wo(Ui(l)),o.renderTextEditsAsSummary?.(e.uri))l.response.value.every(c=>c.kind==="textEditGroup")?this.domNode=abo(".interactive-edits-summary",void 0,l.isComplete?l.isCanceled?d(7782,null):d(7783,null):""):this.domNode=abo("div");else{let c=new Ye,u=!1;this._register(Z(()=>{u=!0,c.dispose(!0)})),this.comparePart=this._register(n.get());let p={element:l,edit:e,diffData:(async()=>{let h=await this.codeCompareModelService.createModel(l,e);if(u){h.dispose();return}return this._register(h),{modified:h.object.modified.textEditorModel,original:h.object.original.textEditorModel,originalSha1:h.object.originalSha1}})()};this.comparePart.object.render(p,r,c.token),this.domNode=this.comparePart.object.element}}layout(e){this.comparePart?.object.layout(e)}hasSameContent(e){return e.kind==="textEditGroup"}addDisposable(e){this._register(e)}};DOe=I([m(5,lbo)],DOe);var Lot=class{constructor(i,e,t){this.textModelService=i;this.modelService=e;this.chatService=t}async createModel(i,e){let t=await this.textModelService.createModelReference(e.uri),o=await this.textModelService.createModelReference(this.modelService.createModel(Yx(t.object.textEditorModel.createSnapshot()),{languageId:t.object.textEditorModel.getLanguageId(),onDidChange:U.None},A.from({scheme:Q.vscodeChatCodeBlock,path:e.uri.path,query:xt()}),!1).uri),n=new s1(Z(()=>{t.dispose(),o.dispose()})),r="";if(e.state)r=e.state.sha1;else{let c=new ume;c.canComputeSHA1(t.object.textEditorModel)&&(r=c.computeSHA1(t.object.textEditorModel),e.state={sha1:r,applied:0})}let s=this.chatService.getSession(i.sessionResource),l=[];for(let c of s.getRequests())if(c.response){for(let u of c.response.response.value)if(!(u.kind!=="textEditGroup"||u.state?.applied||!Qe(u.uri,e.uri)))for(let p of u.edits){let h=p.map(SE.asEditOperation);l.push(h)}if(c.response===i.model)break}for(let c of l)o.object.textEditorModel.pushEditOperations(null,c,()=>null);return n.acquire(),setTimeout(()=>n.release(),5e3),{object:{originalSha1:r,original:t.object,modified:o.object},dispose(){n.release()}}}};Lot=I([m(0,Bt),m(1,Tt),m(2,mi)],Lot);Ee(lbo,Lot,1);var gge=class extends UT{constructor(e,t,o,n,r,s){super(e,o,void 0,r,s);this.markdownContent=t;this.chatContentMarkdownRenderer=n;this.icon=R.check}initContent(){let e=_(".chat-collapsible-markdown-content.chat-used-context-list");if(this.markdownContent){this.contentElement=_(".chat-collapsible-markdown-body");let t=this._register(this.chatContentMarkdownRenderer.render(new Ie(this.markdownContent)));this.contentElement.appendChild(t.element),e.appendChild(this.contentElement)}return e}hasSameContent(e,t,o){return!1}};gge=I([m(4,nt),m(5,B)],gge);var qv=class a extends x{constructor(e){super();this.toolInvocation=e;this._onNeedsRerender=this._register(new E);this.onNeedsRerender=this._onNeedsRerender.event;this._codeBlocksPartId="tool-"+a.idPool++}static{this.idPool=0}get codeblocksPartId(){return this._codeBlocksPartId}getIcon(){let e=this.toolInvocation,t=Pi.executionConfirmedOrDenied(e);return t?.type===5?R.circleSlash:t?.type===0?R.error:Pi.isComplete(e)?R.check:q.modify(R.loading,"spin")}};var fge=class extends qv{get codeblocks(){return this._confirmWidget?.codeblocks||[]}get codeblocksPartId(){return this._confirmWidget?.codeblocksPartId||"<none>"}constructor(i,e,t,o,n,r,s){if(super(i),i.toolSpecificData?.kind!=="extensions")throw new Error("Tool specific data is missing or not of kind extensions");let l=i.toolSpecificData;this.domNode=_("");let c=this._register(s.createInstance(OG,l));M(this.domNode,c.domNode);let u=i.state.get();if(u.type===Pi.StateKind.WaitingForConfirmation){let p=d(7856,null),h=t.appendKeybinding(p,JH),g=d(7857,null),f=t.appendKeybinding(g,jit),v=this._register(new E),b=[{label:p,data:{type:4},tooltip:h,disabled:!0,onDidChangeDisablement:v.event},{label:g,data:{type:0},isSecondary:!0,tooltip:f}],S=this._register(s.createInstance(Tie,e,{title:u.confirmationMessages?.title??d(7858,null),message:u.confirmationMessages?.message??d(7859,null),buttons:b}));this._confirmWidget=S,M(this.domNode,S.domNode),this._register(S.onDidClick(k=>{Pi.confirmWith(i,k.data),n.getWidgetBySessionResource(e.element.sessionResource)?.focusInput()}));let y=ie.Editing.hasToolConfirmation.bindTo(o);y.set(!0),this._register(Z(()=>y.reset()));let w=this._register(r.onInstallExtension(k=>{l.extensions.some(T=>Ut({id:T},k.identifier))&&(w.dispose(),v.fire(!1))}))}}};fge=I([m(2,_e),m(3,X),m(4,Pt),m(5,Cs),m(6,F)],fge);var oQ=class extends x{constructor(e,t,o,n,r,s,l){super();this.context=e;this.parts=t;this._instantiationService=o;this.contextKeyService=n;this._markdownRendererService=r;this.modelService=s;this.languageService=l;this._editorReferences=[];this.codeblocks=[];this.domNode=this.createOutputContents()}toMdString(e){return typeof e=="string"?new Ie("").appendText(e):new Ie(e.value,{isTrusted:e.isTrusted})}createOutputContents(){let e=_("div");for(let t=0;t<this.parts.length;t++){let o=this.parts[t];if(o.kind==="code"){let r=[o];for(;t+1<this.parts.length&&this.parts[t+1].kind==="code";)r.push(this.parts[++t]);this.addCodeBlock(r,e);continue}let n=[];for(let r=t;r<this.parts.length;r++){let s=this.parts[r];if(s.kind!=="data")break;n.push(s)}this.addResourceGroup(n,e),t+=n.length-1}return e}addResourceGroup(e,t){let o=this._register(this._instantiationService.createInstance(SW,e));t.appendChild(o.domNode)}addCodeBlock(e,t){let o=e[0];if(o.title){let c=_("div.chat-confirmation-widget-title"),u=this._register(this._markdownRendererService.render(this.toMdString(o.title)));c.appendChild(u.element),t.appendChild(c)}let n=e.map(c=>c.data).join(`
`),r=this._register(this.modelService.createModel(n,this.languageService.createById(o.languageId),void 0,!0)),s={languageId:o.languageId,textModel:Promise.resolve(r),codeBlockIndex:o.codeBlockIndex,codeBlockPartIndex:0,element:this.context.element,parentContextKeyService:this.contextKeyService,renderOptions:o.options,chatSessionResource:this.context.element.sessionResource},l=this._register(this.context.editorPool.get());l.object.render(s,this.context.currentWidth.get()),t.appendChild(l.object.element),this._editorReferences.push(l),this.codeblocks.push({ownerMarkdownPartId:o.ownerMarkdownPartId,codeBlockIndex:o.codeBlockIndex,elementId:this.context.element.id,uri:r.uri,uriPromise:Promise.resolve(r.uri),codemapperUri:void 0,chatSessionResource:this.context.element.sessionResource,focus:()=>{}})}layout(e){this._editorReferences.forEach(t=>t.object.layout(e))}};oQ=I([m(2,F),m(3,X),m(4,On),m(5,Tt),m(6,_t)],oQ);var Die=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super();this.context=n;this.input=r;this.output=s;this.contextKeyService=p;this._instantiationService=h;this.modelService=f;this.languageService=v;this.chatMarkdownAnchorService=b;this.configurationService=S;this._editorReferences=[];this._contentInitialized=!1;let y=ct(".chat-confirmation-widget-container"),w=ct(".chat-confirmation-widget-title-inner"),k=ct(".chat-confirmation-widget");this.domNode=y.root,y.root.appendChild(k.root),this._titlePart=this._register(h.createInstance(FG,w.root,e,t)),$k(w.root,this._instantiationService,this.chatMarkdownAnchorService,this._store);let T=document.createElement("span");T.style.flexGrow="1";let P=this._register(new mR(k.root,{}));P.element.classList.add("chat-confirmation-widget-title","monaco-text-button"),P.labelElement.append(w.root);let O=_("span.chat-collapsible-hover-chevron.codicon.codicon-chevron-right");O.setAttribute("aria-hidden","true"),P.element.appendChild(O);let V=hr("accessibility.chat.showCheckmarks",!1,this.configurationService),H=this._expanded=Me(this,c);this._register(be(J=>{let ae=H.read(J),he=V.read(J);k.root.classList.toggle("collapsed",!ae);let oe=!s&&!l;if(l?P.icon=R.error:P.icon=s?R.check:q.modify(R.loading,"spin"),k.root.classList.toggle("shimmer-progress",u&&oe),y.root.classList.toggle("show-checkmarks",he),O.classList.toggle("codicon-chevron-right",!ae),O.classList.toggle("codicon-chevron-down",ae),ae&&!this._contentInitialized){this._contentInitialized=!0;let de=ct(".chat-confirmation-widget-message");de.root.appendChild(this.createMessageContents()),k.root.appendChild(de.root)}}));let G=J=>{if(!J.defaultPrevented){let ae=H.get();H.set(!ae,void 0),J.preventDefault()}};this._register(P.onDidClick(G));let $=this.output?.parts.filter(J=>J.kind==="data").filter(J=>!J.audience||J.audience.includes(1));if($?.length){let ae=this._register(this._instantiationService.createInstance(oQ,this.context,$)).domNode;ae.classList.add("chat-collapsible-top-level-resource-group"),y.root.appendChild(ae),this._register(be(he=>{ae.style.display=H.read(he)?"none":""}))}}get codeblocks(){return this._outputSubPart?.codeblocks??[]}set title(e){this._titlePart.title=e}get title(){return this._titlePart.title}get expanded(){return this._expanded.get()}createMessageContents(){let e=ct("div",[ct("h3@inputTitle"),ct("div@input"),ct("h3@outputTitle"),ct("div@output")]),{input:t,output:o}=this;if(e.inputTitle.textContent=d(7835,null),this.addCodeBlock(t,e.input),!o)e.output.remove(),e.outputTitle.remove();else{e.outputTitle.textContent=d(7836,null);let n=this._register(this._instantiationService.createInstance(oQ,this.context,o.parts));this._outputSubPart=n,e.output.appendChild(n.domNode)}return e.root}addCodeBlock(e,t){let o=this._register(this.modelService.createModel(e.data,this.languageService.createById(e.languageId),void 0,!0)),n={languageId:e.languageId,textModel:Promise.resolve(o),codeBlockIndex:e.codeBlockIndex,codeBlockPartIndex:0,element:this.context.element,parentContextKeyService:this.contextKeyService,renderOptions:e.options,chatSessionResource:this.context.element.sessionResource},r=this._register(this.context.editorPool.get());r.object.render(n,this.context.currentWidth.get()||300),t.appendChild(r.object.element),this._editorReferences.push(r)}hasSameContent(e,t,o){return!1}layout(e){this._editorReferences.forEach(t=>t.object.layout(e)),this._outputSubPart?.layout(e)}};Die=I([m(9,X),m(10,F),m(11,nt),m(12,Tt),m(13,_t),m(14,Gv),m(15,B)],Die);var VG=class extends qv{static{this._expandedByDefault=new WeakMap}get codeblocks(){return this.collapsibleListPart.codeblocks}constructor(i,e,t,o,n,r,s,l,c,u,p,h,g){super(i);let f=t,v=(k,T="json")=>({kind:"code",data:k,languageId:T,codeBlockIndex:f++,ownerMarkdownPartId:this.codeblocksPartId,options:{hideToolbar:!0,reserveWidth:19,maxHeightInLines:13,verticalPadding:5,editorOptions:{wordWrap:"on"}}}),b=l;typeof l=="string"&&(b=[{type:"embed",value:l,isText:!0}]);let S=this.collapsibleListPart=this._register(u.createInstance(Die,o,n,this.getAutoApproveMessageContent(),e,v(r,s),b&&b.length>0?{parts:b.map((k,T)=>{let P=k.type==="ref"||k.uri?He(k.uri):k.mimeType&&yP(k.mimeType)?`file${yP(k.mimeType)}`:"file"+(k.isText?".txt":".bin");if(k.type==="ref")return{kind:"data",uri:k.uri,mimeType:k.mimeType};if(k.isText&&!k.asResource)return v(k.value);{let O=CT.createUri(e.element.sessionResource,i.toolCallId,T,P);return k.isText?{kind:"data",value:new TextEncoder().encode(k.value),mimeType:k.mimeType,uri:O,audience:k.audience}:{kind:"data",base64Value:k.value,mimeType:k.mimeType,uri:O,audience:k.audience}}})}:void 0,c,c&&g.getValue("chat.tools.autoExpandFailures")||(VG._expandedByDefault.get(i)??!1),yOe(i)));this._register(Z(()=>VG._expandedByDefault.set(i,S.expanded)));let y=i.kind==="toolInvocation"?i.state.map((k,T)=>k.type===Pi.StateKind.Executing?k.progress.read(T):void 0):void 0,w=new co(()=>this._register(new Zf(S.domNode)));y&&this._register(be(k=>{let T=y?.read(k);T?.message&&(S.title=T.message),T?.progress&&!Pi.isComplete(i,k)&&w.value.setWorked(T.progress*100)})),this.domNode=S.domNode}getAutoApproveMessageContent(){return _ie(this.toolInvocation)}};VG=I([m(9,F),m(10,Tt),m(11,_t),m(12,B)],VG);var Rot=le("chatResponseResourceFileSystemProvider"),LOe=class extends x{constructor(e,t){super();this.chatService=e;this._fileService=t;this.onDidChangeCapabilities=U.None;this.onDidChangeFile=U.None;this.capabilities=19474;this._associated=new gt;this._sessionAssociations=new gt;this._register(this.chatService.onDidDisposeSession(o=>{for(let n of o.sessionResources){let r=this._sessionAssociations.get(n);if(r){for(let s of r)this._associated.delete(s);this._sessionAssociations.delete(n)}}}))}associate(e,t,o){let n=xt(),r=A.from({scheme:CT.scheme,path:`/assoc/${n}`+(o?`/${o}`:"")});this._associated.set(r,t);let s=this._sessionAssociations.get(e);return s||(s=new En,this._sessionAssociations.set(e,s)),s.add(r),r}readFile(e){return Promise.resolve(this.lookupURI(e))}readFileStream(e){let t=VI(o=>qe.concat(o.map(n=>qe.wrap(n))).buffer);return Promise.resolve(this.lookupURI(e)).then(o=>t.end(o)),t}async stat(e){let t=await this.lookupURI(e);return{type:1,ctime:0,mtime:0,size:t.length}}delete(){throw Ps("fs is readonly","NoPermissions")}watch(){return x.None}mkdir(){throw Ps("fs is readonly","NoPermissions")}readdir(){return Promise.resolve([])}rename(){throw Ps("fs is readonly","NoPermissions")}writeFile(){throw Ps("fs is readonly","NoPermissions")}findMatchingInvocation(e){let t=CT.parseUri(e);if(!t)throw Ps("File not found","EntryNotFound");let{sessionResource:o,toolCallId:n,index:r}=t,s=this.chatService.getSession(o);if(!s)throw Ps("File not found","EntryNotFound");let l=s.getRequests();for(let c=l.length-1;c>=0;c--){let p=l[c].response?.entireResponse.value.find(h=>(h.kind==="toolInvocation"||h.kind==="toolInvocationSerialized")&&h.toolCallId===n);if(p)return{result:p,index:r}}throw Ps("File not found","EntryNotFound")}lookupURI(e){let t=this._associated.get(e);if(t){if(t instanceof Uint8Array)return t;let l=qa(t.base64).buffer;return this._associated.set(e,l),l}let{result:o,index:n}=this.findMatchingInvocation(e),r=Pi.resultDetails(o);if(!cD(r))throw Ps("Tool does not have I/O","EntryNotFound");let s=r.output.at(n);if(!s)throw Ps("Tool does not have part","EntryNotFound");return s.type==="ref"?this._fileService.readFile(s.uri).then(l=>l.value.buffer):s.isText?new TextEncoder().encode(s.value):qa(s.value).buffer}};LOe=I([m(0,mi),m(1,fe)],LOe);var vge=class extends x{static{this.ID="chatResponseResourceWorkbenchContribution"}constructor(i,e){super(),this._register(e.registerProvider(CT.scheme,i))}};vge=I([m(0,Rot),m(1,fe)],vge);function Utn(a){return{transformIncoming:i=>i.scheme==="vscode-remote"?{scheme:"file",path:i.path,query:i.query,fragment:i.fragment}:i.scheme==="file"?{scheme:"vscode-local",path:i.path,query:i.query,fragment:i.fragment}:i,transformOutgoing:i=>i.scheme==="file"?{scheme:"vscode-remote",authority:a,path:i.path,query:i.query,fragment:i.fragment}:i.scheme==="vscode-local"?{scheme:"file",path:i.path,query:i.query,fragment:i.fragment}:i,transformOutgoingScheme:i=>i==="file"?"vscode-remote":i==="vscode-local"?"file":i}}function dbo(a){return new cBt(Utn(a))}var ROe=class extends x{constructor(i,e,t,o,n){super();let r=i.readDefinitions().map(({collection:h})=>h?.presentation?.origin&&n.getWorkspaceFolder(h.presentation?.origin)?.uri),s=async()=>{let h=e.lastModeDebugged;await i.stop(),await i.start({debug:h})},l=!1;this._register(be(h=>{let g=i.readDefinitions().read(h);if(!g.collection||!g.server||!g.server.devMode){l=!1;return}l||!t.delegates.read(h).some(v=>v.canStart(g.collection,g.server))||(i.start(),l=!0)}));let c=i.readDefinitions().map(h=>!!h.server?.devMode?.debug);this._register(sae(c,({lastValue:h,newValue:g})=>{g&&!eo(h,g)&&s()}));let u=Os({equalsFn:$i},h=>{let f=i.readDefinitions().read(h).server?.devMode?.watch;return typeof f=="string"?[f]:f}),p=this._register(new gu);this._register(be(h=>{let g=u.read(h),f=r.read(h);if(!g||!f)return;let v=g.filter(k=>!k.startsWith("!")),b=g.filter(k=>k.startsWith("!")).map(k=>k.slice(1));h.store.add(o.watch(f,{includes:v,excludes:b,recursive:!0}));let S=!o.hasCapability(f,1024),y=v.map(k=>Ym({base:f.fsPath,pattern:k},{ignoreCase:S})),w=b.map(k=>Ym({base:f.fsPath,pattern:k},{ignoreCase:S}));h.store.add(o.onDidFilesChange(k=>{for(let T of[k.rawAdded,k.rawDeleted,k.rawUpdated])for(let P of T)if(y.some(O=>O(P.fsPath))&&!w.some(O=>O(P.fsPath))){p.queue(s);break}}))}))}};ROe=I([m(2,Lc),m(3,fe),m(4,Pe)],ROe);var MOe=le("mcpDevModeDebugging"),hKt="127.0.0.1",Lie=class{constructor(i,e){this._debugService=i;this._commandService=e}async transform(i,e){if(!i.devMode?.debug||e.type!==1)return e;let t=await this.getDebugPort(),o=`MCP: ${i.label}`,n={startedByUser:!1,suppressDebugView:!0},r={internalConsoleOptions:"neverOpen",suppressMultipleSessionWarning:!0};switch(i.devMode.debug.type){case"node":{if(!/node[0-9]*$/.test(e.command))throw new Error(d(12069,null,e.command));return this._debugService.startDebugging(void 0,{type:"pwa-node",request:"attach",name:o,port:t,host:hKt,timeout:3e4,continueOnAttach:!0,...r},n),{...e,args:[`--inspect-brk=${hKt}:${t}`,...e.args]}}case"debugpy":{if(!/python[0-9.]*$/.test(e.command))throw new Error(d(12070,null,e.command));let s,l=["--wait-for-client","--connect",`${hKt}:${t}`,...e.args];if(i.devMode.debug.debugpyPath)s=i.devMode.debug.debugpyPath;else try{let c=await this._commandService.executeCommand("python.getDebugpyPackagePath");c&&(s=e.command,l=[c,...l])}catch{}return s||(s="debugpy"),await Promise.race([this._debugService.startDebugging(void 0,{type:"debugpy",name:o,request:"attach",listen:{host:hKt,port:t},...r},n),this.ensureListeningOnPort(t)]),{...e,command:s,args:l}}default:os(i.devMode.debug,`Unknown debug type ${JSON.stringify(i.devMode.debug)}`)}}ensureListeningOnPort(i){return Promise.resolve()}getDebugPort(){return Promise.resolve(9230)}};Lie=I([m(0,Ni),m(1,ge)],Lie);var ubo=["image/webp","image/png","image/jpeg","image/jpg","image/gif"];function ztn(a,i,e){let t=a.mimeType?.toLowerCase()||GI(a.src);if(!t||!ubo.includes(t)){e.debug(`Ignoring icon with unsupported mime type: ${a.src} (${t}), allowed: ${ubo.join(", ")}`);return}let o=A.parse(a.src);if(o.scheme==="data")return o;if(o.scheme==="https"||o.scheme==="http"){if(i.type!==2){e.debug(`Ignoring icon with HTTP/HTTPS URL: ${a.src} as the MCP server is not launched with HTTP transport.`);return}let n=i.uri.authority.toLowerCase();if(o.authority.toLowerCase()!==n){e.debug(`Ignoring icon with untrusted authority: ${a.src}, expected authority: ${n}`);return}return o}if(o.scheme==="file"){if(i.type!==1){e.debug(`Ignoring icon with file URL: ${a.src} as the MCP server is not launched as a local process.`);return}return o}e.debug(`Ignoring icon with unsupported scheme: ${a.src}. Allowed: data:, http:, https:, file:`)}function pbo(a,i,e){let t=[];for(let o of a.icons||[]){let n=ztn(o,i,e);if(!n)continue;let r=typeof o.sizes=="string"?o.sizes.split(" "):Array.isArray(o.sizes)?o.sizes:[];t.push({src:n,theme:o.theme==="light"?0:o.theme==="dark"?1:2,sizes:r.map(s=>{let[l,c]=s.toLowerCase().split("x");return{width:Number(l)||0,height:Number(c)||0}}).sort((s,l)=>s.width-l.width)})}return t.sort((o,n)=>o.sizes[0]?.width-n.sizes[0]?.width),t}var BG=class a{constructor(i){this._icons=i}static fromStored(i){return a.fromParsed(i?.map(e=>({src:A.revive(e.src),theme:e.theme,sizes:e.sizes})))}static fromParsed(i){return new a(i||[])}getUrl(i){let e=this.getSizeWithTheme(i,1);if(e?.theme===2)return{dark:e.src};let t=this.getSizeWithTheme(i,0);if(!(!t&&!e))return{dark:(e||t).src,light:t?.src}}getSizeWithTheme(i,e){let t;for(let o of this._icons)if(o.theme===e||o.theme===2||o.theme===void 0){t=o;let n=o.sizes.find(r=>r.width>=i);if(n)return{...o,sizes:[n]}}return t}};var AOe=le("mcpSandboxService"),POe=class extends x{constructor(e,t,o,n,r){super();this._fileService=e;this._environmentService=t;this._logService=o;this._mcpResourceScannerService=n;this._remoteAgentService=r;this._defaultAllowedDomains=["registry.npmjs.org"];this._defaultAllowWritePaths=["~/.npm"];this._sandboxConfigPerConfigurationTarget=new Map;this._pathJoin=(e,...t)=>(e===1?$s:Oo).join(...t);this._getPathDelimiter=async e=>await this._getOperatingSystem(e)===1?$s.delimiter:Oo.delimiter;this._sandboxSettingsId=xt(),this._remoteEnvDetailsPromise=this._remoteAgentService.getEnvironment()}async isEnabled(e,t){return await this._getOperatingSystem(t)===1?!1:!!e.sandboxEnabled}async launchInSandboxIfEnabled(e,t,o,n){if(t.type!==1)return t;if(await this.isEnabled(e,o)){this._logService.trace(`McpSandboxService: Launching with config target ${n}`);let r=await this._resolveSandboxLaunchDetails(n,o,t.sandbox,t.cwd),s=this._quoteShellArgument(t.command),l=t.args.map(p=>this._quoteShellArgument(p)),c=this._getSandboxCommandArgs(s,l,r.sandboxConfigPath),u=await this._getSandboxEnvVariables(t.env,r.tempDir,r.rgPath,o);if(r.srtPath)return r.execPath?{...t,command:r.execPath,args:[r.srtPath,...c],env:u,type:1}:{...t,command:r.srtPath,args:c,env:u,type:1};r.execPath||this._logService.warn("McpSandboxService: execPath is unavailable, launching without sandbox runtime wrapper"),this._logService.debug(`McpSandboxService: launch details for server ${e.label} - command: ${t.command}, args: ${t.args.join(" ")}`)}return t}getSandboxConfigSuggestionMessage(e,t,o){let n=this._getSandboxConfigSuggestions(t,o);if(!n)return;let r=n.allowWrite,s=n.allowedDomains,l=[];if(s.length){let u=s.map(p=>`"${p}"`).join(", ");l.push(d(12100,null,u))}if(r.length){let u=r.map(p=>`"${p}"`).join(", ");l.push(d(12101,null,u))}let c={};return s.length&&(c.network={allowedDomains:[...s]}),r.length&&(c.filesystem={allowWrite:[...r]}),{message:d(12102,null,e,l.join(`
`)),sandboxConfig:c}}async applySandboxConfigSuggestion(e,t,o,n,r){let s=this._toMcpResourceTarget(o),l=!1;return await this._mcpResourceScannerService.updateSandboxConfig(c=>{let u=c.sandbox,p=r?.network?.allowedDomains??[],h=r?.filesystem?.allowWrite??[],g=new Set(u?.network?.allowedDomains??[]);for(let b of p)b&&!g.has(b)&&g.add(b);let f=new Set(u?.filesystem?.allowWrite??[]);for(let b of h)b&&!f.has(b)&&f.add(b);if(p.length===0&&h.length===0)return c;l=!0;let v={};return g.size>0&&(v.network={...u?.network,allowedDomains:[...g]}),f.size>0&&(v.filesystem={...u?.filesystem,allowWrite:[...f]}),{...c,sandbox:v}},t,s),l}_getSandboxConfigSuggestions(e,t){if(!e.length)return;let o=new Set,n=new Set,r=new Set(t?.filesystem?.allowWrite??[]),s=new Set(t?.network?.allowedDomains??[]);for(let l of e)l.kind==="network"&&l.host&&!s.has(l.host)&&n.add(l.host),l.kind==="filesystem"&&l.path&&!r.has(l.path)&&o.add(l.path);if(!(!o.size&&!n.size))return{allowWrite:[...o],allowedDomains:[...n]}}_toMcpResourceTarget(e){switch(e){case 2:case 3:case 4:return 2;case 5:return 5;case 6:return 6;default:return 2}}async _resolveSandboxLaunchDetails(e,t,o,n){let r=await this._getOperatingSystem(t);if(r===1)return{execPath:void 0,srtPath:void 0,rgPath:void 0,sandboxConfigPath:void 0,tempDir:void 0};let s=await this._getAppRoot(t),l=await this._getExecPath(r,s,t),c=await this._getTempDir(t),u=this._pathJoin(r,s,"node_modules","@anthropic-ai","sandbox-runtime","dist","cli.js"),p=this._pathJoin(r,s,"node_modules","@vscode","ripgrep","bin","rg"),h=c?await this._updateSandboxConfig(c,e,o,n):void 0;return this._logService.debug(`McpSandboxService: Updated sandbox config path: ${h}`),{execPath:l,srtPath:u,rgPath:p,sandboxConfigPath:h,tempDir:c}}async _getExecPath(e,t,o){if(o)return this._pathJoin(e,t,"node")}async _getSandboxEnvVariables(e,t,o,n){let r={...e};return t&&(r={...r,TMPDIR:t.path,SRT_DEBUG:"true",NODE_USE_ENV_PROXY:"1"}),o&&(r={...r,PATH:r.PATH?`${r.PATH}${await this._getPathDelimiter(n)}${ad(o)}`:ad(o)}),n||(r={...r,ELECTRON_RUN_AS_NODE:"1"}),r.VSCODE_INSPECTOR_OPTIONS=null,r}_getSandboxCommandArgs(e,t,o){let n=[];return o&&(n.push("--settings",o),n.push("--")),n.push(e,...t),n}async _getRemoteEnv(e){return e?this._remoteEnvDetailsPromise:null}async _getOperatingSystem(e){let t=await this._getRemoteEnv(e);return t?t.os:Po}async _getAppRoot(e){let t=await this._getRemoteEnv(e);return t?t.appRoot.path:ad(vn.asFileUri("").path)}async _getTempDir(e){let t=await this._getRemoteEnv(e);if(t)return t.tmpDir;let n=this._environmentService.tmpDir;return n||this._logService.warn("McpSandboxService: Cannot create sandbox settings file because no tmpDir is available in this environment"),n}async _updateSandboxConfig(e,t,o,n){let r=this._withDefaultSandboxConfig(o,n),s,l=p7(t);return this._sandboxConfigPerConfigurationTarget.has(l)?s=A.parse(this._sandboxConfigPerConfigurationTarget.get(l)):(s=A.joinPath(e,`vscode-${l}-mcp-sandbox-settings-${this._sandboxSettingsId}.json`),this._sandboxConfigPerConfigurationTarget.set(l,s.toString())),await this._fileService.createFile(s,qe.fromString(JSON.stringify(r,null,"	")),{overwrite:!0}),s.path}_withDefaultSandboxConfig(e,t){let o=new Set(e?.filesystem?.allowWrite??[]);for(let r of this._getDefaultAllowWrite(t?[t]:void 0))r&&o.add(r);let n=new Set(e?.network?.allowedDomains??[]);for(let r of this._defaultAllowedDomains)r&&n.add(r);return{...e,network:{allowedDomains:[...n],deniedDomains:e?.network?.deniedDomains??[]},filesystem:{allowWrite:[...o],denyRead:e?.filesystem?.denyRead??[],denyWrite:e?.filesystem?.denyWrite??[]}}}_getDefaultAllowWrite(e){for(let t of e??[]){let o=t.trim();o&&this._defaultAllowWritePaths.push(o)}return this._defaultAllowWritePaths}_quoteShellArgument(e){return`'${e.replace(/'/g,"'\\''")}'`}};POe=I([m(0,fe),m(1,Eo),m(2,se),m(3,mee),m(4,bo)],POe);var gKt=class extends x{constructor(){super(...arguments);this._serverTasks=this._register(new Vt);this._clientTasks=this._register(new Vt);this._onDidUpdateTask=this._register(new E);this.onDidUpdateTask=this._onDidUpdateTask.event}setHandler(e){for(let t of this._clientTasks.values())t.setHandler(e)}getClientTask(e){return this._clientTasks.get(e)}adoptClientTask(e){this._clientTasks.set(e.id,e)}abandonClientTask(e){this._clientTasks.deleteAndDispose(e)}createTask(e,t){let o=xt(),n=new Date().toISOString(),r=Date.now(),s={taskId:o,status:"working",createdAt:n,ttl:e,lastUpdatedAt:new Date().toISOString(),pollInterval:1e3},l=new N,c=new Ye;l.add(Z(()=>c.dispose(!0)));let u=this._executeTask(o,t,c.token);return e?l.add(tn(()=>this._serverTasks.deleteAndDispose(o),e)):u.finally(()=>{let p=this._register(tn(()=>{this._serverTasks.deleteAndDispose(o),this._store.delete(p)},6e4))}),this._serverTasks.set(o,{task:s,cts:c,dispose:()=>l.dispose(),createdAtTime:r,executionPromise:u}),{task:s}}async _executeTask(e,t,o){try{let n=await t(o);this._updateTaskStatus(e,"completed",void 0,n)}catch(n){n instanceof go?this._updateTaskStatus(e,"cancelled","Task was cancelled by the client"):n instanceof Tb?this._updateTaskStatus(e,"failed",n.message,void 0,{code:n.code,message:n.message,data:n.data}):n instanceof Error?this._updateTaskStatus(e,"failed",n.message,void 0,{code:Bv.INTERNAL_ERROR,message:n.message}):this._updateTaskStatus(e,"failed","Unknown error",void 0,{code:Bv.INTERNAL_ERROR,message:"Unknown error"})}}_updateTaskStatus(e,t,o,n,r){let s=this._serverTasks.get(e);s&&(s.task.status=t,s.task.lastUpdatedAt=new Date().toISOString(),o!==void 0&&(s.task.statusMessage=o),n!==void 0&&(s.result=n),r!==void 0&&(s.error=r),this._onDidUpdateTask.fire({...s.task}))}getTask(e){let t=this._serverTasks.get(e);if(!t)throw new Tb(Bv.INVALID_PARAMS,`Task not found: ${e}`);return{...t.task}}async getTaskResult(e){let t=this._serverTasks.get(e);if(!t)throw new Tb(Bv.INVALID_PARAMS,`Task not found: ${e}`);(t.task.status==="working"||t.task.status==="input_required")&&await t.executionPromise;let o=this._serverTasks.get(e);if(!o)throw new Tb(Bv.INVALID_PARAMS,`Task not found: ${e}`);if(o.error)throw new Tb(o.error.code,o.error.message,o.error.data);if(!o.result)throw new Tb(Bv.INTERNAL_ERROR,"Task completed but no result available");return o.result}cancelTask(e){let t=this._serverTasks.get(e);if(!t)throw new Tb(Bv.INVALID_PARAMS,`Task not found: ${e}`);if(t.task.status==="completed"||t.task.status==="failed"||t.task.status==="cancelled")throw new Tb(Bv.INVALID_PARAMS,`Cannot cancel task in ${t.task.status} status`);return t.task.status="cancelled",t.task.statusMessage="Task was cancelled by the client",t.cts.cancel(),{...t.task}}listTasks(){let e=[];for(let t of this._serverTasks.values())e.push({...t.task});return{tasks:e}}};var fKt=class a{constructor(i,e){this.template=i;this.template=i,this.components=e}static parse(i){let e=[],t=/\{([^{}]+)\}/g,o,n=0;for(;o=t.exec(i);){let[r,s]=o;if(e.push(i.slice(n,o.index)),n=o.index+r.length,i[o.index-1]==="{"||i[n]==="}"){e.push(s);continue}let l="",c=s;c.length>0&&a._isOperator(c[0])&&(l=c[0],c=c.slice(1));let u=c.split(",").map(p=>{let h=p,g=!1,f=!1,v,b=!1;h.endsWith("*")&&(g=!0,f=!0,h=h.slice(0,-1));let S=h.match(/^(.*?):(\d+)$/);return S&&(h=S[1],v=parseInt(S[2],10)),h.endsWith("?")&&(b=!0,h=h.slice(0,-1)),{explodable:g,name:h,optional:b,prefixLength:v,repeatable:f}});e.push({expression:r,operator:l,variables:u})}return e.push(i.slice(n)),new a(i,e)}static{this._operators=["+","#",".","/",";","?","&"]}static _isOperator(i){return a._operators.includes(i)}resolve(i){let e="";for(let t of this.components)typeof t=="string"?e+=t:e+=this._expand(t,i);return e}_expand(i,e){let t=i.operator,o=i.variables;if(o.length===0)return i.expression;let n=[],r=t===";"||t==="?"||t==="&",s=t==="+"||t==="#",l=t==="#",c=t===".",u=t==="/",p=t==="?",h=t==="&",g=t===";",f="";t==="+"?f="":t==="#"?f="#":t==="."?f=".":t==="/"?f="":t===";"?f=";":t==="?"?f="?":t==="&"&&(f="&");for(let b of o){let S=e[b.name],y=Object.prototype.hasOwnProperty.call(e,b.name);if(S==null||Array.isArray(S)&&S.length===0){if(g){y&&S==null&&n.push(b.name);continue}if(p||h){y&&n.push(a._formPair(b.name,"",r));continue}continue}if(typeof S=="object"&&!Array.isArray(S)){if(b.explodable){let T=[];for(let P in S)if(Object.prototype.hasOwnProperty.call(S,P)){let O=String(S[P]);g||p||h||c?T.push(P+"="+O):u?T.push("/"+P+"="+a._encode(O,s)):T.push(P+"="+a._encode(O,s))}c?n.push(T.join(".")):u?n.push(T.join("")):g?n.push(T.join(";")):p||h?n.push(T.join("&")):n.push(T.join(","))}else{let T=[];for(let O in S)Object.prototype.hasOwnProperty.call(S,O)&&(T.push(O),T.push(String(S[O])));let P=T.join(",");c?n.push(P):g||p||h?n.push(b.name+"="+P):n.push(P)}continue}if(Array.isArray(S)){b.explodable?c?n.push(S.join(".")):u?n.push(S.map(T=>"/"+a._encode(T,s)).join("")):g?n.push(S.map(T=>b.name+"="+String(T)).join(";")):p||h?n.push(S.map(T=>b.name+"="+String(T)).join("&")):n.push(S.map(T=>a._encode(T,s)).join(",")):c?n.push(S.join(",")):g||p||h?n.push(b.name+"="+S.join(",")):n.push(S.map(T=>a._encode(T,s)).join(","));continue}let w=String(S);b.prefixLength!==void 0&&(w=w.substring(0,b.prefixLength));let k=a._encode(w,t==="+"||t==="#");g||p||h?n.push(b.name+"="+k):c?n.push(k):u?n.push("/"+k):n.push(k)}let v="";if(c){let b=n.filter(S=>S!=="");v=b.length?f+b.join("."):""}else if(u){let b=n.filter(S=>S!=="");v=b.length?b.join(""):"",v&&!v.startsWith("/")&&(v="/"+v)}else g?v=n.length?f+n.map(b=>b.replace(/=\s*$/,"")).join(";"):"":p||h?v=n.length?f+n.join("&"):"":l?v=f+n.join(","):v=n.join(",");return v}static _encode(i,e){return e?encodeURI(i):Ktn(i)}static _formPair(i,e,t){return t?i+"="+encodeURIComponent(String(e)):encodeURIComponent(String(e))}};function Ktn(a){let i="";for(let e=0;e<a.length;e++){let t=a.charCodeAt(e);t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122||t===45||t===46||t===95||t===126?i+=a[e]:i+="%"+t.toString(16).toUpperCase()}return i}var $tn={serverName:void 0,serverIcons:[],serverInstructions:void 0,trustedAtNonce:void 0,nonce:void 0,tools:[],prompts:void 0,capabilities:void 0},mbo=/[^a-z0-9_-]/gi,bge=class extends x{constructor(e,t){super();this.didChange=!1;this.cache=new dl(128);this.extensionServers=new Map;let o="mcpToolCache";this._register(t.onWillSaveState(()=>{this.didChange&&(t.store(o,{extensionServers:[...this.extensionServers],serverTools:this.cache.toJSON()},e,1),this.didChange=!1)}));try{let n=t.getObject(o,e);this.extensionServers=new Map(n?.extensionServers??[]),n?.serverTools?.forEach(([r,s])=>this.cache.set(r,s))}catch{}}reset(){this.cache.clear(),this.extensionServers.clear(),this.didChange=!0}get(e){return this.cache.get(e)}store(e,t){let o=this.get(e)||$tn;this.cache.set(e,{...o,...t}),this.didChange=!0}getServers(e){return this.extensionServers.get(e)}storeServers(e,t){t?this.extensionServers.set(e,t):this.extensionServers.delete(e),this.didChange=!0}};bge=I([m(1,ce)],bge);var NOe=class{constructor(i,e,t,o,n,r){this._definitionId=i;this._cache=e;this._fromStaticDefinition=t;this._fromCache=o;this._toT=n;this.defaultValue=r;this.fromServerPromise=Me(this,void 0);this.fromServer=ke(i=>this.fromServerPromise.read(i)?.promiseResult.read(i)?.data);this.value=ke(i=>{let t=this.fromServer.read(i)?.data??this._fromStaticDefinition?.read(i)??this.fromCache?.data??this.defaultValue;return this._toT(t,i)})}get fromCache(){let i=this._cache.get(this._definitionId);return i?{data:this._fromCache(i),nonce:i.nonce}:void 0}hasStaticDefinition(i){return!!this._fromStaticDefinition?.read(i)}},$v=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,P,O){super();this.definition=t;this._requiresExtensionActivation=n;this._primitiveCache=r;this._mcpRegistry=c;this._extensionService=p;this._loggerService=h;this._outputService=g;this._telemetryService=f;this._commandService=v;this._instantiationService=b;this._dialogService=S;this._notificationService=y;this._openerService=w;this._samplingService=k;this._elicitationService=T;this._mcpSandboxService=P;this._taskManager=this._register(new gKt);this._connectionSequencer=new rm;this._connection=this._register(SV(this,void 0));this.connection=this._connection;this.connectionState=ke(e=>this._connection.read(e)?.state.read(e)??{state:dr.Kind.Stopped});this.cacheState=ke(e=>{let t=()=>this._fullDefinitions.read(e)?.server?.cacheNonce,o=()=>this._tools.hasStaticDefinition(e)?1:this._tools.fromCache?t()===this._tools.fromCache.nonce?1:2:0,n=this._tools.fromServerPromise.read(e),r=this.connectionState.read(e);if(dr.canBeStarted(r.state)||!n)return o();let l=n?.promiseResult.read(e);return l?l.error?o():l.data?.nonce===t()?5:2:this._tools.fromCache?4:3});this._lastModeDebugged=!1;this._isQuietStart=!1;this._isSandboxSuggestionDialogVisible=!1;this._potentialSandboxBlocks=[];this._potentialSandboxBlockListener=this._register(new me);this.runningToolCalls=new Set;this.collection=e,this._fullDefinitions=this._mcpRegistry.getServerDefinition(this.collection,this.definition),this.enablement=ke(J=>l.readEnabled(t.id,J)),this._loggerId=`mcpServer.${t.id}`,this._logger=this._register(h.createLogger(this._loggerId,{hidden:!0,name:`MCP: ${t.label}`}));let V=this;this._register(this._instantiationService.createInstance(ROe,this,{get lastModeDebugged(){return V._lastModeDebugged}})),this._register(Z(()=>h.deregisterLogger(this._loggerId)));let H=o?Me(this,o.map(J=>({uri:J,name:He(J)}))):ui(this,u.onDidChangeWorkspaceFolders,()=>u.getWorkspace().folders),G=O.remoteAuthority?dbo(O.remoteAuthority):void 0;this._register(be(J=>{let ae=this._connection.read(J)?.handler.read(J);ae&&(ae.roots=H.read(J).filter(he=>he.uri.authority===(e.remoteAuthority||"")).map(he=>{let oe=A.from(G?.transformIncoming(he.uri)??he.uri);return oe.scheme===Q.file&&(oe=A.file(Hp(oe.fsPath,!0))),{name:he.name,uri:oe.toString()}}))})),this._register(be(J=>{let ae=this._connection.read(J),he=ae?.handler.read(J);he?this._populateLiveData(he,ae?.definition.cacheNonce,J.store):this._tools&&this.resetLiveData()})),this._register(be(J=>{let ae=this._connection.read(J);this._potentialSandboxBlockListener.value=ae?.onPotentialSandboxBlock(he=>this.recordPotentialSandboxBlock(he))}));let $=ke(J=>{let ae=this._fullDefinitions.read(J).server;return ae&&ae.cacheNonce!==this._tools.fromCache?.nonce?ae.staticMetadata:void 0});this._tools=new NOe(this.definition.id,this._primitiveCache,$.map(J=>{let ae=J?.tools?.filter(he=>he.availability===0).map(he=>he.definition);return ae?.length?new bd(this._getValidatedTools(ae)):void 0}).map((J,ae)=>J?.promiseResult.read(ae)?.data),J=>J.tools,J=>J.map(ae=>this._instantiationService.createInstance(Mot,this,s,ae)).sort((ae,he)=>ae.compare(he)),[]),this._prompts=new NOe(this.definition.id,this._primitiveCache,void 0,J=>J.prompts||[],J=>J.map(ae=>new GDi(this,ae)),[]),this._serverMetadata=new NOe(this.definition.id,this._primitiveCache,$.map(J=>J?this._toStoredMetadata(J?.serverInfo,J?.instructions):void 0),J=>({serverName:J.serverName,serverInstructions:J.serverInstructions,serverIcons:J.serverIcons}),J=>({serverName:J?.serverName,serverInstructions:J?.serverInstructions,icons:BG.fromStored(J?.serverIcons)}),void 0),this._capabilities=new NOe(this.definition.id,this._primitiveCache,$.map(J=>J?.capabilities!==void 0?hbo(J.capabilities):void 0),J=>J.capabilities,J=>J,void 0)}static async callOn(e,t,o=Se.None){await e.start({promptType:"all-untrusted"});let n=!1,r,s=new Promise((l,c)=>{r=be(u=>{let p=e.connection.read(u);if(!p||n)return;let h=p.handler.read(u);if(!h){let g=p.state.read(u);if(g.state===dr.Kind.Error){c(new S7e(`MCP server could not be started: ${g.message}`));return}else if(g.state===dr.Kind.Stopped){c(new S7e("MCP server has stopped"));return}else return}l(t(h,p)),n=!0})});return Wp(s,o).finally(()=>r.dispose())}get capabilities(){return this._capabilities.value}get tools(){return this._tools.value}get prompts(){return this._prompts.value}get serverMetadata(){return this._serverMetadata.value}get trustedAtNonce(){return this._primitiveCache.get(this.definition.id)?.trustedAtNonce}set trustedAtNonce(e){this._primitiveCache.store(this.definition.id,{trustedAtNonce:e})}get logger(){return this._logger}readDefinitions(){return this._fullDefinitions}showOutput(e){return this._loggerService.setVisibility(this._loggerId,!0),this._outputService.showChannel(this._loggerId,e)}resources(e){let t=new Ye(e);return new fp(async o=>{await $v.callOn(this,async n=>{for await(let r of n.listResourcesIterable({},t.token))if(o.emitOne(r.map(s=>new qDi(this,s,BG.fromParsed(this._parseIcons(s))))),t.token.isCancellationRequested)return})},()=>t.dispose(!0))}resourceTemplates(e){return $v.callOn(this,async t=>(await t.listResourceTemplates({},e)).map(n=>new $Di(this,n,BG.fromParsed(this._parseIcons(n)))),e)}start({interaction:e,autoTrustChanges:t,promptType:o,debug:n,errorOnUserInteraction:r}={}){return e?.participants.set(this.definition.id,{s:"unknown"}),this._connectionSequencer.queue(async()=>{let s=$et(this.collection.id.slice(Too.length));if(this._requiresExtensionActivation&&!this._extensionService.activationEventIsDone(s)&&(await this._extensionService.activateByEvent(s),await Promise.all(this._mcpRegistry.delegates.get().map(p=>p.waitForInitialProviderPromises())),this._store.isDisposed))return{state:dr.Kind.Stopped};let l=this._connection.get();if(this._isQuietStart=!!r,l&&dr.canBeStarted(l.state.get().state)&&(l.dispose(),l=void 0,this._connection.set(l,void 0)),!l){this._lastModeDebugged=!!n;let p=this;if(l=await this._mcpRegistry.resolveConnection({interaction:e,autoTrustChanges:t,promptType:o,trustNonceBearer:{get trustedAtNonce(){return p.trustedAtNonce},set trustedAtNonce(h){p.trustedAtNonce=h}},logger:this._logger,collectionRef:this.collection,definitionRef:this.definition,debug:n,errorOnUserInteraction:r,taskManager:this._taskManager}),!l)return{state:dr.Kind.Stopped};if(this._store.isDisposed)return l.dispose(),{state:dr.Kind.Stopped};this._connection.set(l,void 0),l.definition.devMode&&this.showOutput()}this._potentialSandboxBlocks.length=0;let c=Date.now(),u=await l.start({createMessageRequestHandler:(p,h)=>this._samplingService.sample({isDuringToolCall:this.runningToolCalls.size>0,server:this,params:p},h).then(g=>g.sample),elicitationRequestHandler:async(p,h)=>{let g=l.handler.get()?.serverInfo;g&&this._telemetryService.publicLog2("mcp.elicitationRequested",{serverName:g.name,serverVersion:g.version});let f=await this._elicitationService.elicit(this,vt.first(this.runningToolCalls),p,h||Se.None);return f.dispose(),f.value}});if(this._telemetryService.publicLog2("mcp/serverBootState",{state:dr.toKindString(u.state),time:Date.now()-c}),r&&u.state===dr.Kind.Running){let p;u=await new Promise((h,g)=>{p=be(f=>{l.handler.read(f)&&h(u);let b=l.state.read(f);b.state===dr.Kind.Stopped&&b.reason==="needs-user-interaction"&&g(new Vw("auth")),dr.isRunning(b)||h(b)})}).finally(()=>p.dispose())}if(u.state===dr.Kind.Error){let p;u=await new Promise((h,g)=>{p=be(f=>{let v=this._connection.read(f),b=v?.state.read(f);v&&b?.state===dr.Kind.Error&&(this._isQuietStart?g(new Vw("start")):this.showInteractiveError(v,b,this._lastModeDebugged))})}).finally(()=>p.dispose())}return u}).finally(()=>{e?.participants.set(this.definition.id,{s:"resolved"})})}showInteractiveError(e,t,o){if(e.definition.sandboxEnabled){this.showSandboxConfigSuggestionFromPotentialBlocks(e,this._potentialSandboxBlocks)||this._notificationService.warn(d(12114,null,e.definition.label,t.message));return}if(t.code==="ENOENT"&&e.launchDefinition.type===1){let n;switch(e.launchDefinition.command){case"uvx":n="https://aka.ms/vscode-mcp-install/uvx";break;case"npx":n="https://aka.ms/vscode-mcp-install/npx";break;case"dnx":n="https://aka.ms/vscode-mcp-install/dnx";break;case"dotnet":n="https://aka.ms/vscode-mcp-install/dotnet";break}let r=[{label:d(12103,null),run:()=>this.showOutput()}];if(e.definition.devMode?.debug?.type==="debugpy"&&o){this._notificationService.prompt(ft.Error,d(12107,null,e.launchDefinition.command,e.definition.label),[...r,{label:d(12117,null),run:()=>this._openerService.open(A.parse("https://aka.ms/vscode-mcp-install/debugpy"))}]);return}n&&r.push({label:d(12115,null,e.launchDefinition.command),run:()=>this._openerService.open(A.parse(n))}),this._notificationService.prompt(ft.Error,d(12116,null,e.launchDefinition.command,e.definition.label),r)}else this._notificationService.warn(d(12114,null,e.definition.label,t.message))}showSandboxConfigSuggestionFromPotentialBlocks(e,t){if(!e.definition.sandboxEnabled||!t.length||this._isSandboxSuggestionDialogVisible)return!1;if(this._isQuietStart)throw new Vw("sandbox-suggestion");let o=this._fullDefinitions.get().collection?.sandbox,n=this._mcpSandboxService.getSandboxConfigSuggestionMessage(e.definition.label,t,o);return n?(this._confirmAndApplySandboxConfigSuggestion(e,t,n),!0):(this._removePotentialSandboxBlocks(t),!1)}_confirmAndApplySandboxConfigSuggestion(e,t,o){let n=e.definition.presentation?.origin?.uri??this.collection.presentation?.origin,r=this._fullDefinitions.get().collection?.configTarget;this._isSandboxSuggestionDialogVisible=!0,this._dialogService.confirm({type:"warning",message:d(12111,null,e.definition.label),detail:o.message,primaryButton:d(12113,null),cancelButton:d(12112,null)}).then(async s=>{if(s.confirmed){if(!n||r===void 0){this._notificationService.warn(d(12110,null,e.definition.label));return}try{await this._mcpSandboxService.applySandboxConfigSuggestion(e.definition,n,r,t,o.sandboxConfig)&&(this._removePotentialSandboxBlocks(t),this._notificationService.info(d(12109,null,e.definition.label)))}catch(l){this._notificationService.error(d(12108,null,e.definition.label,l instanceof Error?l.message:String(l)))}}}).finally(()=>{this._isSandboxSuggestionDialogVisible=!1})}recordPotentialSandboxBlock(e){this._potentialSandboxBlocks.push(e),this._potentialSandboxBlocks.length>200&&this._potentialSandboxBlocks.splice(0,this._potentialSandboxBlocks.length-200);let t=this._connection.get();t?.state.get().state===dr.Kind.Running&&this.showSandboxConfigSuggestionFromPotentialBlocks(t,this._potentialSandboxBlocks)}_removePotentialSandboxBlocks(e){if(!e.length||!this._potentialSandboxBlocks.length)return;let t=new Set(e);this._potentialSandboxBlocks=this._potentialSandboxBlocks.filter(o=>!t.has(o))}stop(){return this._connection.get()?.stop()||Promise.resolve()}awaitToolRefresh(){return new Promise(e=>{Ox(t=>{this._tools.fromServerPromise.read(t)?.promiseResult.read(t)&&e()})})}resetLiveData(){Gi(e=>{this._tools.fromServerPromise.set(void 0,e),this._prompts.fromServerPromise.set(void 0,e)})}async _normalizeTool(e){let t=e._meta?.ui,o=3;t?.visibility&&Array.isArray(t.visibility)&&(o&=0,t.visibility.includes("model")&&(o|=1),t.visibility.includes("app")&&(o|=2));let n={...e,serverToolName:e.name,_icons:this._parseIcons(e),visibility:o,uiResourceUri:t?.resourceUri};n.description||(this._logger.warn(`Tool ${n.name} does not have a description. Tools must be accurately described to be called`),n.description="<empty>"),mbo.test(n.name)&&(this._logger.warn(`Tool ${JSON.stringify(n.name)} is invalid. Tools names may only contain [a-z0-9_-]`),n.name=n.name.replace(mbo,"_")),n.inputSchema&&!n.inputSchema.properties&&(n.inputSchema={...n.inputSchema,properties:{}});let r=[],s=JSON.stringify(n.inputSchema);try{let u=A.parse("https://json-schema.org/draft-07/schema");r=await this._commandService.executeCommand("json.validate",u,s)||[]}catch{}if(!r.length)return n;let l=_R(s);return{error:r.map(u=>{let p=Emi(l,u.range[0].character),h=p&&`/${kmi(p).join("/")}`;return u.message+(h?` (at ${h})`:"")})}}async _getValidatedTools(e){let t="",o=await Promise.all(e.map(r=>this._normalizeTool(r))),n=[];for(let[r,s]of o.entries())if("error"in s){t+=d(12106,null,e[r].name)+`
`;for(let l of s.error)t+=`	- ${l}
`;t+=`	- Schema: ${JSON.stringify(e[r].inputSchema)}

`}else n.push(s);return t&&(this._logger.warn(`${e.length-n.length} tools have invalid JSON schemas and will be omitted`),jtn(this._instantiationService,this.definition.label,t)),n}_parseIcons(e){let t=this._connection.get();return t?pbo(e,t.launchDefinition,this._logger):[]}_setServerTools(e,t,o){let n=t.then(async r=>{this._logger.info(`Discovered ${r.length} tools`);let s=await this._getValidatedTools(r);return this._primitiveCache.store(this.definition.id,{tools:s,nonce:e}),{data:s,nonce:e}});return this._tools.fromServerPromise.set(new bd(n),o),n}_setServerPrompts(e,t,o){let n=t.then(r=>{let s=r.map(l=>({...l,_icons:this._parseIcons(l)}));return this._primitiveCache.store(this.definition.id,{prompts:s,nonce:e}),{data:s,nonce:e}});return this._prompts.fromServerPromise.set(new bd(n),o),n}_toStoredMetadata(e,t){return{serverName:e?e.title||e.name:void 0,serverInstructions:t,serverIcons:e?this._parseIcons(e):void 0}}_setServerMetadata(e,{serverInfo:t,instructions:o,capabilities:n},r){let s=this._toStoredMetadata(t,o);this._serverMetadata.fromServerPromise.set(bd.resolved({nonce:e,data:s}),r);let l=hbo(n);this._capabilities.fromServerPromise.set(bd.resolved({data:l,nonce:e}),r),this._primitiveCache.store(this.definition.id,{...s,nonce:e,capabilities:l})}_populateLiveData(e,t,o){let n=new Ye;o.add(Z(()=>n.dispose(!0)));let r=l=>{let c=e.capabilities.tools?e.listTools({},n.token):Promise.resolve([]);return this._setServerTools(t,c,l)},s=l=>{let c=e.capabilities.prompts?e.listPrompts({},n.token):Promise.resolve([]);return this._setServerPrompts(t,c,l)};o.add(e.onDidChangeToolList(()=>{this._logger.info("Tool list changed, refreshing tools..."),r(void 0)})),o.add(e.onDidChangePromptList(()=>{this._logger.info("Prompts list changed, refreshing prompts..."),s(void 0)})),Gi(l=>{this._setServerMetadata(t,{serverInfo:e.serverInfo,instructions:e.serverInstructions,capabilities:e.capabilities},l),s(l),r(l).then(u=>{this._telemetryService.publicLog2("mcp/serverBoot",{supportsLogging:!!e.capabilities.logging,supportsPrompts:!!e.capabilities.prompts,supportsResources:!!e.capabilities.resources,toolCount:u.data.length,serverName:e.serverInfo.name,serverVersion:e.serverInfo.version})})})}};$v=I([m(7,Lc),m(8,Pe),m(9,lt),m(10,Il),m(11,kl),m(12,Te),m(13,ge),m(14,F),m(15,at),m(16,Ne),m(17,Je),m(18,F4),m(19,y7e),m(20,AOe),m(21,At)],$v);var GDi=class{constructor(i,e){this._server=i;this._definition=e;this.id=lfi(this._server.definition.label+"."+e.name),this.name=e.name,this.title=e.title,this.description=e.description,this.arguments=e.arguments||[],this.icons=BG.fromStored(this._definition._icons)}async resolve(i,e){return(await $v.callOn(this._server,o=>o.getPrompt({name:this._definition.name,arguments:i},e),e)).messages}async complete(i,e,t,o){return(await $v.callOn(this._server,r=>r.complete({ref:{type:"ref/prompt",name:this._definition.name},argument:{name:i,value:e},context:{arguments:t}},o),o)).completion.values}};function hbo(a){let i=0;return a.logging&&(i|=1),a.completions&&(i|=2),a.prompts&&(i|=4,a.prompts.listChanged&&(i|=8)),a.resources&&(i|=16,a.resources.subscribe&&(i|=32),a.resources.listChanged&&(i|=64)),a.tools&&(i|=128,a.tools.listChanged&&(i|=256)),i}var Mot=class{constructor(i,e,t,o){this._server=i;this._definition=t;this._elicitationService=o;this.referenceName=t.name.replaceAll(".","_"),this.id=(e+t.name).replaceAll(".","_").slice(0,64),this.icons=BG.fromStored(this._definition._icons),this.visibility=t.visibility??3}get definition(){return this._definition}get uiResourceUri(){return this._definition.uiResourceUri}async call(i,e,t){e&&this._server.runningToolCalls.add(e);try{return await this._callWithProgress(i,void 0,e,t)}finally{e&&this._server.runningToolCalls.delete(e)}}async callWithProgress(i,e,t,o){t&&this._server.runningToolCalls.add(t);try{return await this._callWithProgress(i,e,t,o)}finally{t&&this._server.runningToolCalls.delete(t)}}_callWithProgress(i,e,t,o=Se.None,n=!0){let r=this._definition.serverToolName??this._definition.name,s=e?xt():void 0,l=new N;return $v.callOn(this._server,async c=>{e&&l.add(c.onDidReceiveProgressNotification(f=>{f.params.progressToken===s&&e.report({message:f.params.message,progress:f.params.total!==void 0&&f.params.progress!==void 0?f.params.progress/f.params.total:void 0})}));let u={progressToken:s};t?.chatSessionResource&&(u["vscode.conversationId"]=ap(t.chatSessionResource)),t?.chatRequestId&&(u["vscode.requestId"]=t.chatRequestId);let p=this._definition.execution?.taskSupport,g=c.capabilities.tasks?.requests?.tools?.call!==void 0&&(p==="required"||p==="optional");try{let f=await c.callTool({name:r,arguments:i,task:g?{}:void 0,_meta:u},o,e?v=>e.report({message:v}):void 0);return await this._server.awaitToolRefresh(),f}catch(f){if(f instanceof WJ&&f.code===Bv.URL_ELICITATION_REQUIRED&&n)return await this._handleElicitationErr(f,t,o),this._callWithProgress(i,e,t,o,!1);let v=this._server.connectionState.get();if(n&&v.state===dr.Kind.Error&&v.shouldRetry)return this._callWithProgress(i,e,t,o,!1);throw f}finally{l.dispose()}},o)}async _handleElicitationErr(i,e,t){let o=i.data?.elicitations;if(Array.isArray(o)&&o.length>0)for(let n of o){let r=await this._elicitationService.elicit(this._server,e,n,t);try{if(r.value.action!=="accept")throw i;r.kind===1&&await r.wait}finally{r.dispose()}}}compare(i){return this._definition.name.localeCompare(i.definition.name)}};Mot=I([m(3,y7e)],Mot);function jtn(a,i,e){a.invokeFunction(t=>{let o=t.get(Ne),n=t.get(ee);o.notify({severity:ft.Warning,message:d(12104,null,i),actions:{primary:[{class:void 0,enabled:!0,id:"mcpBadSchema.show",tooltip:"",label:d(12105,null),run:()=>{n.openEditor({resource:void 0,contents:e})}}]}})})}var qDi=class{constructor(i,e,t){this.icons=t;this.mcpUri=e.uri,this.title=e.title,this.uri=Bw.fromServer(i.definition,e.uri),this.name=e.name,this.description=e.description,this.mimeType=e.mimeType,this.sizeInBytes=e.size}},$Di=class{constructor(i,e,t){this._server=i;this._definition=e;this.icons=t;this.name=e.name,this.description=e.description,this.mimeType=e.mimeType,this.title=e.title,this.template=fKt.parse(e.uriTemplate)}resolveURI(i){let e=this.template.resolve(i);return Bw.fromServer(this._server.definition,e)}async complete(i,e,t,o){return(await $v.callOn(this._server,r=>r.complete({ref:{type:"ref/resource",uri:this._definition.uriTemplate},argument:{name:i,value:e},context:{arguments:HIe(t,s=>Array.isArray(s)?s.join("/"):s)}},o),o)).completion.values}};var FOe=class extends x{constructor(e,t,o){super();this._uiData=e;this._mcpService=t;let n=ui(o.onDidColorThemeChange,()=>{let r=o.getColorTheme().type;return r==="dark"||r==="hcDark"?"dark":"light"});this.hostContext=ke(r=>({theme:n.read(r),styles:{variables:{"--color-background-primary":"var(--vscode-editor-background)","--color-background-secondary":"var(--vscode-sideBar-background)","--color-background-tertiary":"var(--vscode-activityBar-background)","--color-background-inverse":"var(--vscode-editor-foreground)","--color-background-ghost":"transparent","--color-background-info":"var(--vscode-inputValidation-infoBackground)","--color-background-danger":"var(--vscode-inputValidation-errorBackground)","--color-background-success":"var(--vscode-diffEditor-insertedTextBackground)","--color-background-warning":"var(--vscode-inputValidation-warningBackground)","--color-background-disabled":"var(--vscode-editor-inactiveSelectionBackground)","--color-text-primary":"var(--vscode-foreground)","--color-text-secondary":"var(--vscode-descriptionForeground)","--color-text-tertiary":"var(--vscode-disabledForeground)","--color-text-inverse":"var(--vscode-editor-background)","--color-text-info":"var(--vscode-textLink-foreground)","--color-text-danger":"var(--vscode-errorForeground)","--color-text-success":"var(--vscode-testing-iconPassed)","--color-text-warning":"var(--vscode-editorWarning-foreground)","--color-text-disabled":"var(--vscode-disabledForeground)","--color-text-ghost":"var(--vscode-descriptionForeground)","--color-border-primary":"var(--vscode-widget-border)","--color-border-secondary":"var(--vscode-editorWidget-border)","--color-border-tertiary":"var(--vscode-panel-border)","--color-border-inverse":"var(--vscode-foreground)","--color-border-ghost":"transparent","--color-border-info":"var(--vscode-inputValidation-infoBorder)","--color-border-danger":"var(--vscode-inputValidation-errorBorder)","--color-border-success":"var(--vscode-testing-iconPassed)","--color-border-warning":"var(--vscode-inputValidation-warningBorder)","--color-border-disabled":"var(--vscode-disabledForeground)","--color-ring-primary":"var(--vscode-focusBorder)","--color-ring-secondary":"var(--vscode-focusBorder)","--color-ring-inverse":"var(--vscode-focusBorder)","--color-ring-info":"var(--vscode-inputValidation-infoBorder)","--color-ring-danger":"var(--vscode-inputValidation-errorBorder)","--color-ring-success":"var(--vscode-testing-iconPassed)","--color-ring-warning":"var(--vscode-inputValidation-warningBorder)","--font-sans":"var(--vscode-font-family)","--font-mono":"var(--vscode-editor-font-family)","--font-weight-normal":"normal","--font-weight-medium":"500","--font-weight-semibold":"600","--font-weight-bold":"bold","--font-text-xs-size":"10px","--font-text-sm-size":"11px","--font-text-md-size":"13px","--font-text-lg-size":"14px","--font-heading-xs-size":"16px","--font-heading-sm-size":"18px","--font-heading-md-size":"20px","--font-heading-lg-size":"24px","--font-heading-xl-size":"32px","--font-heading-2xl-size":"40px","--font-heading-3xl-size":"48px","--border-radius-xs":"2px","--border-radius-sm":"3px","--border-radius-md":"4px","--border-radius-lg":"6px","--border-radius-xl":"8px","--border-radius-full":"9999px","--border-width-regular":"1px","--font-text-xs-line-height":"1.5","--font-text-sm-line-height":"1.5","--font-text-md-line-height":"1.5","--font-text-lg-line-height":"1.5","--font-heading-xs-line-height":"1.25","--font-heading-sm-line-height":"1.25","--font-heading-md-line-height":"1.25","--font-heading-lg-line-height":"1.25","--font-heading-xl-line-height":"1.25","--font-heading-2xl-line-height":"1.25","--font-heading-3xl-line-height":"1.25","--shadow-hairline":"0 0 0 1px var(--vscode-widget-shadow)","--shadow-sm":"0 1px 2px 0 var(--vscode-widget-shadow)","--shadow-md":"0 4px 6px -1px var(--vscode-widget-shadow)","--shadow-lg":"0 10px 15px -3px var(--vscode-widget-shadow)"}},displayMode:"inline",availableDisplayModes:["inline"],locale:GSe,platform:Wt?"web":KSe?"mobile":"desktop",deviceCapabilities:{touch:Ms.isTouchDevice(),hover:Ms.isHoverDevice()}}))}get uiData(){return this._uiData}async log(e){let t=await this._getServer(Se.None);t&&Yzt(t.logger,e,"[App UI]")}async _getServer(e){return kvo(this._mcpService,t=>t.definition.id===this._uiData.serverDefinitionId&&t.collection.id===this._uiData.collectionId,e)}async loadResource(e){let t=await this._getServer(e);if(!t)throw new Error("MCP server not found for UI resource");let o=await $v.callOn(t,c=>c.readResource({uri:this._uiData.resourceUri},e),e);if(!o.contents||o.contents.length===0)throw new Error("UI resource not found on server");let n=o.contents[0],r,s=n.mimeType||"text/html";if(No(n,{text:!0}))r=n.text;else if(No(n,{blob:!0}))r=qa(n.blob).toString();else throw new Error("UI resource has no content");return{...n._meta?.ui,html:r,mimeType:s}}async callTool(e,t,o){let n=await this._getServer(o);if(!n)throw new Error("MCP server not found for tool call");await hW(n,void 0,o);let r=n.tools.get().find(l=>l.definition.name===e);if(!r||!(r.visibility&2))throw new Error(`Tool not found on server: ${e}`);let s=await r.call(t,void 0,o);return{content:s.content,isError:s.isError,_meta:s._meta,structuredContent:s.structuredContent}}async readResource(e,t){let o=await this._getServer(t);if(!o)throw new Error("MCP server not found");return await $v.callOn(o,n=>n.readResource({uri:e},t),t)}};FOe=I([m(1,_s),m(2,Le)],FOe);var vKt;(S=>(S.LATEST_PROTOCOL_VERSION="2026-01-26",S.OPEN_LINK_METHOD="ui/open-link",S.MESSAGE_METHOD="ui/message",S.SANDBOX_PROXY_READY_METHOD="ui/notifications/sandbox-proxy-ready",S.SANDBOX_RESOURCE_READY_METHOD="ui/notifications/sandbox-resource-ready",S.SIZE_CHANGED_METHOD="ui/notifications/size-changed",S.TOOL_INPUT_METHOD="ui/notifications/tool-input",S.TOOL_INPUT_PARTIAL_METHOD="ui/notifications/tool-input-partial",S.TOOL_RESULT_METHOD="ui/notifications/tool-result",S.TOOL_CANCELLED_METHOD="ui/notifications/tool-cancelled",S.HOST_CONTEXT_CHANGED_METHOD="ui/notifications/host-context-changed",S.RESOURCE_TEARDOWN_METHOD="ui/resource-teardown",S.INITIALIZE_METHOD="ui/initialize",S.INITIALIZED_METHOD="ui/notifications/initialized",S.REQUEST_DISPLAY_MODE_METHOD="ui/request-display-mode",S.UPDATE_MODEL_CONTEXT_METHOD="ui/update-model-context",S.DOWNLOAD_FILE_METHOD="ui/download-file"))(vKt||={});var Qtn="chatMcpApp.origins",nQ=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.toolInvocation=e;this.renderData=t;this._container=o;this._instantiationService=s;this._chatWidgetService=l;this._webviewService=c;this._chatResponseResourceFsProvider=p;this._logService=h;this._productService=g;this._openerService=f;this._disposeCts=this._register(new Ye);this._announcedCapabilities=!1;this._latestCsp=void 0;this._loadState=Me(this,{status:"loading"});this.loadState=this._loadState;this._onDidChangeHeight=this._register(new E);this.onDidChangeHeight=this._onDidChangeHeight.event;this._downloadParts=Me(this,[]);this.downloadParts=this._downloadParts;this._originStore=new g4(Qtn,u),this._webviewOrigin=this._originStore.getOrigin("mcpApp",t.serverDefinitionId),this._mcpToolCallUI=this._register(this._instantiationService.createInstance(FOe,t)),this._height=nQ.heightCache.get(this.toolInvocation)??300,this._webview=this._register(this._webviewService.createWebviewElement({origin:this._webviewOrigin,title:d(7860,null),options:{purpose:"chatOutputItem",enableFindWidget:!1,disableServiceWorker:!0,retainContextWhenHidden:!0},contentOptions:{allowMultipleAPIAcquire:!0,allowScripts:!0,allowForms:!0},extension:void 0}));let v=Re(this._container);this._webview.mountTo(this._container,v),this.hostContext=this._mcpToolCallUI.hostContext.map((b,S)=>({...b,containerDimensions:{width:r.read(S),maxHeight:n.read(S)},toolCall:{toolCallId:this.toolInvocation.toolCallId,toolName:this.toolInvocation.toolId}})),this._register(be(b=>{let S=this.hostContext.read(b);this._announcedCapabilities&&this._sendNotification({method:"ui/notifications/host-context-changed",params:S})})),this._register(this._webview.onMessage(async({message:b})=>{await this._handleWebviewMessage(b)})),this._loadContent()}static{this.heightCache=new WeakMap}get height(){return this._height}remount(){this._webview.reinitializeAfterDismount(),this._announcedCapabilities=!1}retry(){this._loadState.set({status:"loading"},void 0),this._loadContent()}async _loadContent(){let e=this._disposeCts.token;try{let t=await this._mcpToolCallUI.loadResource(e);if(e.isCancellationRequested)return;let o=this._injectPreamble(t);this._announcedCapabilities=!1,this._latestCsp=t.csp,this._webview.setHtml(o),this._loadState.set({status:"loaded"},void 0)}catch(t){this._logService.error("[MCP App] Error loading app:",t),this._loadState.set({status:"error",error:t},void 0)}}_injectPreamble({html:e,csp:t}){let o=l=>(l?.join(" ")||"").replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;"),r=`<meta http-equiv="Content-Security-Policy" content="${`
			default-src 'none';
			script-src 'self' 'unsafe-inline' ${o(t?.resourceDomains)};
			style-src 'self' 'unsafe-inline' ${o(t?.resourceDomains)};
			connect-src 'self' ${o(t?.connectDomains)};
			img-src 'self' data: ${o(t?.resourceDomains)};
			font-src 'self' ${o(t?.resourceDomains)};
			media-src 'self' data: ${o(t?.resourceDomains)};
			frame-src ${o(t?.frameDomains)||"'none'"};
			object-src 'none';
			base-uri ${o(t?.baseUriDomains)||"'self'"};
		`}">`;return this._prependToHead(e,r+`
			<script>(() => {
				const api = acquireVsCodeApi();
				const setMessageSource = (obj, src) => new Proxy(obj, {
					get: (target, prop) => {
						if (prop === 'source')  {
							return src;
						}
						return target[prop];
					}
				});

				const wrappedFns = new WeakMap();

				let patchedPostMessage = (message, transfer) => api.postMessage(message, transfer);
				const wrap = target => new Proxy(target, {
					set: (obj, prop, value) => {
						if (prop === 'postMessage') {
							patchedPostMessage = (message, transfer) => value.call(target, message, transfer);
						} else {
							obj[prop] = value;
						}
						return true;
					},
					get: (obj, prop) => {
						if (prop === 'postMessage') {
							return patchedPostMessage;
						}
						return obj[prop];
					},
				});

				const originalAddEventListener = window.addEventListener.bind(window);
				window.addEventListener = (type, listener, options) => {
					if (type === 'message') {
						const originalListener = listener;
						const wrappedListener = (event) => {
							if (event.origin === document.location.origin && event.source !== window) { event = setMessageSource(event, window.parent); }
							originalListener(event);
						};
						wrappedFns.set(originalListener, wrappedListener);
						listener = wrappedListener;
					}

					return originalAddEventListener(type, listener, options);
				};

				const originalRemoveEventListener = window.removeEventListener.bind(window);
				window.removeEventListener = (type, listener, options) => {
					const wrappedListener = wrappedFns.get(listener) || listener;
					return originalRemoveEventListener(type, wrappedListener, options);
				};

				window.parent = wrap(window.parent);

				// Scroll boundary detection: bubble wheel events to parent when at scroll boundaries
				const shouldBubbleScroll = (event) => {
					// First check element-level scrolling (for elements with overflow: auto/scroll)
					for (let node = event.target; node; node = node.parentNode) {
						if (!(node instanceof Element)) {
							continue;
						}

						// Skip HTML and BODY - we check document-level scroll separately
						if (node === document.documentElement || node === document.body) {
							continue;
						}

						// Check if the element can actually scroll
						const overflow = window.getComputedStyle(node).overflowY;
						if (overflow === 'hidden' || overflow === 'visible') {
							continue;
						}

						// Scroll up: if there's content above (scrollTop > 0), don't bubble
						if (event.deltaY < 0 && node.scrollTop > 0) {
							return false;
						}

						// Scroll down: if there's content below, don't bubble
						if (event.deltaY > 0 && node.scrollTop + node.clientHeight < node.scrollHeight) {
							// Account for rounding: scrollTop isn't rounded but scrollHeight/clientHeight are
							if (node.scrollHeight - node.scrollTop - node.clientHeight < 2) {
								continue;
							}
							return false;
						}
					}

					// Check document-level scrolling (works even with overflow: visible on html/body)
					const docEl = document.documentElement;
					const scrollTop = window.scrollY || docEl.scrollTop || document.body.scrollTop || 0;
					const scrollHeight = Math.max(docEl.scrollHeight, document.body.scrollHeight);
					const clientHeight = docEl.clientHeight;
					const scrollableDistance = scrollHeight - clientHeight;

					if (scrollableDistance > 2) {
						// Document is scrollable
						if (event.deltaY < 0 && scrollTop > 0) {
							return false;
						}
						if (event.deltaY > 0 && scrollTop < scrollableDistance - 2) {
							return false;
						}
					}

					return true;
				};

				window.addEventListener('wheel', (event) => {
					if (event.defaultPrevented || !shouldBubbleScroll(event)) {
						return;
					}
					api.postMessage({
						method: 'ui/notifications/sandbox-wheel',
						params: {
							deltaMode: event.deltaMode,
							deltaX: event.deltaX,
							deltaY: event.deltaY,
							deltaZ: event.deltaZ,
						}
					});
				}, { passive: true });
			})();</script>
		`)}_prependToHead(e,t){let o=e.match(/<head[^>]*>/i);if(o){let r=o.index+o[0].length;return e.slice(0,r)+`
`+t+e.slice(r)}let n=e.match(/<html[^>]*>/i);if(n){let r=n.index+n[0].length;return e.slice(0,r)+`
<head>`+t+"</head>"+e.slice(r)}return`<!DOCTYPE html><html><head>${t}</head><body>${e}</body></html>`}async _handleWebviewMessage(e){let t=e,o=this._disposeCts.token;try{let n={};switch(t.method){case"ui/initialize":n=await this._handleInitialize(t.params);break;case"tools/call":n=await this._handleToolsCall(t.params,o);break;case"resources/read":n=await this._handleResourcesRead(t.params,o);break;case"ping":break;case"ui/notifications/size-changed":this._handleSizeChanged(t.params);break;case"ui/open-link":n=await this._handleOpenLink(t.params);break;case"ui/download-file":n=await this._handleDownloadFile(t.params);break;case"ui/request-display-mode":n={mode:"inline"};break;case"ui/notifications/initialized":break;case"ui/message":n=await this._handleUiMessage(t.params);break;case"ui/update-model-context":n=await this._handleUpdateModelContext(t.params);break;case"notifications/message":await this._mcpToolCallUI.log(t.params);break;case"ui/notifications/sandbox-wheel":this._handleSandboxWheel(t.params);break;default:{let r=t;r.id!==void 0&&await this._sendError(r.id,-32601,`Method not found: ${r.method}`);return}}No(t,{id:!0})&&await this._sendResponse(t.id,n)}catch(n){if(this._logService.error(`[MCP App] Error handling ${t.method}:`,n),No(t,{id:!0})){let r=n instanceof Error?n.message:String(n);await this._sendError(t.id,-32e3,r)}}}async _handleInitialize(e){this._announcedCapabilities=!0;let t;try{t=JSON.parse(this.renderData.input)}catch{t=this.renderData.input}let o=this._register(tn(async()=>{if(this._store.delete(o),await this._sendNotification({method:"ui/notifications/tool-input",params:{arguments:t}}),this.toolInvocation.kind==="toolInvocationSerialized")this._sendToolResult(this.toolInvocation.resultDetails);else if(this.toolInvocation.kind==="toolInvocation"){let n=this.toolInvocation;this._register(Ox(r=>{let s=n.state.read(r);s.type===Pi.StateKind.Completed&&(this._sendToolResult(s.resultDetails),r.dispose())}))}}));return{protocolVersion:vKt.LATEST_PROTOCOL_VERSION,hostInfo:{name:this._productService.nameLong,version:this._productService.version},hostCapabilities:{openLinks:{},serverTools:{listChanged:!0},serverResources:{listChanged:!0},logging:{},sandbox:{csp:this._latestCsp,permissions:{clipboardWrite:{}}},updateModelContext:{audio:{},image:{},resourceLink:{},resource:{},structuredContent:{}},downloadFile:{}},hostContext:this.hostContext.get()}}_sendToolResult(e){cD(e)&&e.mcpOutput&&this._sendNotification({method:"ui/notifications/tool-result",params:e.mcpOutput})}async _handleUiMessage(e){let t=this._chatWidgetService.getWidgetBySessionResource(this.renderData.sessionResource);return t?uc(t.getInput())?(t.setInput(e.content.filter(o=>o.type==="text").map(o=>o.text).join(`

`)),t.attachmentModel.clearAndSetContext(...e.content.map((o,n)=>{let r=`mcpui-${n}-${Date.now()}`;if(o.type==="image")return{kind:"image",value:qa(o.data).buffer,id:r,name:"Image"};if(o.type==="resource_link"){let s=Bw.fromServer({id:this.renderData.serverDefinitionId,label:""},o.uri);return{kind:"file",value:s,id:r,name:He(s)}}else return}).filter(lo)),t.focusInput(),{isError:!1}):{isError:!0}:{isError:!0}}async _handleUpdateModelContext(e){let t=this._chatWidgetService.getWidgetBySessionResource(this.renderData.sessionResource);if(!t)return{};let o=`mcpui-context-${_r(this.renderData.serverDefinitionId)}-`,n=t.attachmentModel.getAttachmentIDs(),r=Array.from(n).filter(c=>c.startsWith(o)),s=[],l=0;if(e.content)for(let c of e.content){let u=`${o}${l++}`;if(c.type==="image")s.push({kind:"image",value:qa(c.data).buffer,id:u,name:"Image",mimeType:c.mimeType});else if(c.type==="resource_link"){let p=Bw.fromServer({id:this.renderData.serverDefinitionId,label:""},c.uri);s.push({kind:"file",value:p,id:u,name:He(p)})}else if(c.type==="text"){let p=c.text.replaceAll(/\s+/g," ").trim(),h=20;s.push({kind:"generic",value:c.text,id:u,tooltip:new Ie().appendCodeblock("plaintext",c.text),name:p.length>h?p.slice(0,h)+"\u2026":p})}}if(e.structuredContent&&Object.keys(e.structuredContent).length>0){let c=`${o}structured`,u=JSON.stringify(e.structuredContent,null,2);s.push({kind:"generic",value:u,tooltip:new Ie().appendCodeblock("json",u),id:c,name:"UI Data"})}return t.attachmentModel.updateContext(r,s),{}}_handleSizeChanged(e){e.height!==void 0&&e.height!==this._height&&(this._height=e.height,nQ.heightCache.set(this.toolInvocation,e.height),this._onDidChangeHeight.fire())}_handleSandboxWheel(e){let t=!1,o={wheelDeltaX:e.deltaX,wheelDeltaY:-e.deltaY,wheelDelta:Math.abs(e.deltaY),deltaX:e.deltaX,deltaY:-e.deltaY,deltaZ:e.deltaZ,deltaMode:e.deltaMode,preventDefault:()=>{t=!0},stopPropagation:()=>{},get defaultPrevented(){return t}};this._chatWidgetService.getWidgetBySessionResource(this.renderData.sessionResource)?.delegateScrollFromMouseWheelEvent(o)}async _handleDownloadFile(e){let t=[],o=!1;for(let n of e.contents)try{if(n.type==="resource"){let r=n.resource,s=A.parse(r.uri),l=No(r,{text:!0})?new TextEncoder().encode(r.text):{base64:r.blob},c=this._chatResponseResourceFsProvider.associate(this.renderData.sessionResource,l,He(s));t.push({kind:"data",mimeType:r.mimeType,uri:c})}else if(n.type==="resource_link"){let r=Bw.fromServer({id:this.renderData.serverDefinitionId,label:""},n.uri);t.push({kind:"data",mimeType:n.mimeType,uri:r})}}catch(r){o=!0,this._logService.warn("[MCP App] Failed to process ui/download-file content",r)}if(t.length>0){let n=this._downloadParts.get();this._downloadParts.set([...n,...t],void 0)}return o?{isError:!0}:{}}async _handleOpenLink(e){return{isError:!await this._openerService.open(e.url)}}async _handleToolsCall(e,t){if(!e?.name)throw new Error("Missing tool name in tools/call request");return this._mcpToolCallUI.callTool(e.name,e.arguments||{},t)}async _handleResourcesRead(e,t){if(!e?.uri)throw new Error("Missing uri in resources/read request");return this._mcpToolCallUI.readResource(e.uri,t)}async _sendResponse(e,t){await this._webview.postMessage({jsonrpc:"2.0",id:e,result:t})}async _sendError(e,t,o){await this._webview.postMessage({jsonrpc:"2.0",id:e,error:{code:t,message:o}})}async _sendNotification(e){await this._webview.postMessage({jsonrpc:"2.0",...e})}dispose(){this._disposeCts.dispose(!0),super.dispose()}};nQ=I([m(5,F),m(6,Pt),m(7,cp),m(8,ce),m(9,Rot),m(10,se),m(11,tt),m(12,Je)],nQ);var gbo=.75,WOe=class extends qv{constructor(e,t,o,n,r,s){super(e);this._renderData=n;this._instantiationService=r;this._markdownRendererService=s;this.codeblocks=[];this._progressPart=this._register(new me);this._downloadWidget=this._register(new me);this.domNode=_("div.mcp-app-part"),this._webviewContainer=_("div.mcp-app-webview"),this._webviewContainer.style.maxHeight=`${gbo*100}vh`,this._webviewContainer.style.minHeight="100px",this._webviewContainer.style.height="300px",this.domNode.appendChild(this._webviewContainer),this._downloadContainer=_("div.mcp-app-downloads"),this.domNode.appendChild(this._downloadContainer);let l=Re(this.domNode),c=()=>gbo*l.innerHeight,u=Me("mcpAppMaxHeight",c());j(l,"resize",()=>u.set(c(),void 0)),this._model=this._register(this._instantiationService.createInstance(nQ,e,this._renderData,this._webviewContainer,u,o.currentWidth)),this._updateContainerHeight(),this._register(be(p=>{let h=this._model.loadState.read(p);this._handleLoadStateChange(this._webviewContainer,h)})),this._register(this._model.onDidChangeHeight(()=>{this._updateContainerHeight()})),this._register(be(p=>{let h=this._model.downloadParts.read(p);if(h.length===0){this._downloadWidget.clear(),Rt(this._downloadContainer);return}Rt(this._downloadContainer);let g=this._instantiationService.createInstance(SW,h);this._downloadWidget.value=g,this._downloadContainer.appendChild(g.domNode)})),this._register(t(()=>{this._model.remount()})),this._register(o.onDidChangeVisibility(p=>{p&&this._model.remount()}))}_handleLoadStateChange(e,t){switch(this._progressPart.value&&this._progressPart.value.domNode.remove(),this._progressPart.clear(),this._errorNode&&(this._errorNode.remove(),this._errorNode=void 0),t.status){case"loading":{e.style.display="none";let o=_("span");o.textContent=d(7861,null);let n=this._instantiationService.createInstance(uN,o,q.modify(R.loading,"spin"),void 0);this._progressPart.value=n,this.domNode.appendChild(n.domNode);break}case"loaded":{e.style.display="";break}case"error":{e.style.display="none",this._showError(this.domNode,t.error);break}}}_updateContainerHeight(){this._webviewContainer.style.height=`${this._model.height}px`}_showError(e,t){let o=_(".mcp-app-error"),n=new Ie;n.appendText(d(7862,null,t.message||String(t)));let r=this._register(new pge(2,n,this._markdownRendererService));o.appendChild(r.domNode);let s=M(o,_(".chat-buttons-container")),l=this._register(new Wi(s,Qo));l.label=d(7863,null),this._register(l.onDidClick(()=>{this._model.retry()})),e.appendChild(o),this._errorNode=o}};WOe=I([m(4,F),m(5,On)],WOe);var Sge=class extends qv{constructor(e,t,o,n,r,s){super(e);this.codeblocks=[];let l=this._register(s.createInstance(Y8,n.map(c=>({kind:"reference",reference:c})),o,t,r,_ie(e)));l.icon=R.check,this.domNode=l.domNode}};Sge=I([m(5,F)],Sge);var rQ=class extends qv{static{this._expandedByDefault=new WeakMap}get codeblocks(){return this.collapsibleListPart.codeblocks}constructor(i,e,t,o,n,r,s,l,c,u,p){super(i);let h=t,g=(w,k)=>({kind:"code",data:w,languageId:"plaintext",codeBlockIndex:h++,ownerMarkdownPartId:this.codeblocksPartId,options:{hideToolbar:!0,reserveWidth:19,maxHeightInLines:13,verticalPadding:5,editorOptions:{wordWrap:"on"}}}),f=g(r.input,"Input"),v=r.output?[g(r.output,"Output")]:void 0,b=this.collapsibleListPart=this._register(l.createInstance(Die,o,n,this.getAutoApprovalMessageContent(),e,f,v?{parts:v}:void 0,s,s&&p.getValue("chat.tools.autoExpandFailures")||(rQ._expandedByDefault.get(i)??!1),yOe(i)));this._register(Z(()=>rQ._expandedByDefault.set(i,b.expanded)));let S=i.kind==="toolInvocation"?i.state.map((w,k)=>w.type===Pi.StateKind.Executing?w.progress.read(k):void 0):void 0,y=new co(()=>this._register(new Zf(b.domNode)));S&&this._register(be(w=>{let k=S?.read(w);k?.message&&(b.title=k.message),k?.progress&&!Pi.isComplete(i,w)&&y.value.setWorked(k.progress*100)})),this.domNode=b.domNode}getAutoApprovalMessageContent(){return _ie(this.toolInvocation)}};rQ=I([m(7,F),m(8,Tt),m(9,_t),m(10,B)],rQ);var IW=class extends qv{constructor(e,t,o,n,r,s,l){super(e);this.toolInvocation=e;this.context=t;this.instantiationService=o;this.keybindingService=n;this.contextKeyService=r;this.chatWidgetService=s;this.languageModelToolsService=l;if(e.kind!=="toolInvocation")throw new Error("Confirmation only works with live tool invocations")}render(e){let{keybindingService:t,languageModelToolsService:o,toolInvocation:n}=this,r=n.state.get(),s=r.type===Pi.StateKind.WaitingForConfirmation?r.confirmationMessages?.customButtons:void 0,l;if(s&&s.length>0)l=s.map((g,f)=>({label:g,data:()=>{this.confirmWith(n,{type:4,selectedButton:g})},isSecondary:f>0}));else{let g=t.appendKeybinding(e.allowLabel,e.allowActionId),f=t.appendKeybinding(e.skipLabel,e.skipActionId),v=this.additionalPrimaryActions(),b=this.useAllowOnceAsPrimary()?void 0:v.find(k=>"scope"in k&&k.scope==="session"),S={label:e.allowLabel,tooltip:g,data:()=>{this.confirmWith(n,{type:4})}},y=b??S,w=b?[S,...v.filter(k=>k!==b)]:v;l=[{label:y.label,tooltip:y.tooltip,data:y.data,moreActions:w.length>0?w:void 0},{label:d(7855,null),tooltip:f,data:()=>{this.confirmWith(n,{type:5})},isSecondary:!0}]}let c=this.createContentElement(),u=o.getTool(n.toolId),p=this._register(this.instantiationService.createInstance(WG,this.context,{title:this.getTitle(),icon:u?.icon&&"id"in u.icon?u.icon:R.tools,subtitle:e.subtitle,buttons:l,message:c,toolbarData:{arg:n,partType:e.partType,partSource:n.source.type}})),h=ie.Editing.hasToolConfirmation.bindTo(this.contextKeyService);h.set(!0),this._register(p.onDidClick(g=>{g.data(),this.chatWidgetService.getWidgetBySessionResource(this.context.element.sessionResource)?.focusInput()})),this._register(Z(()=>h.reset())),this.domNode=p.domNode}confirmWith(e,t){Pi.confirmWith(e,t)}additionalPrimaryActions(){return[]}useAllowOnceAsPrimary(){return!1}};IW=I([m(2,F),m(3,_e),m(4,X),m(5,Pt),m(6,Vn)],IW);var Ige=class extends IW{constructor(e,t,o,n,r,s,l,c,u){super(e,o,r,s,l,c,u);this.renderer=n;this.codeblocks=[];this.render({allowActionId:JH,skipActionId:rge,allowLabel:d(7865,null),skipLabel:d(7864,null),partType:"chatMissingSandboxDepsConfirmation"})}createContentElement(){let e=this.toolInvocation.state.get(),t=e.type===Pi.StateKind.WaitingForConfirmation?e.confirmationMessages?.message:void 0,o=_(".chat-missing-sandbox-deps-confirmation");if(t){let n=typeof t=="string"?new Ie(t):t,r=this.renderer.render(n);this._register(r),o.appendChild(r.element)}return o}getTitle(){let e=this.toolInvocation.state.get();return e.type===Pi.StateKind.WaitingForConfirmation&&e.confirmationMessages?.title?typeof e.confirmationMessages.title=="string"?e.confirmationMessages.title:e.confirmationMessages.title.value:""}};Ige=I([m(4,F),m(5,_e),m(6,X),m(7,Pt),m(8,Vn)],Ige);var yge=class extends IW{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,t,n,r,s,l,c);this.listPool=o;this.markdownRendererService=u;this.editorService=p;this.commandService=h;this.codeblocks=[];let g=e.state.get();if(g.type!==Pi.StateKind.WaitingForConfirmation||!g.confirmationMessages?.title)throw new Error("Modified files confirmation messages are missing");let f=e.toolSpecificData;if(!f||f.kind!=="modifiedFilesConfirmation")throw new Error("Modified files confirmation data is missing");let v=c.getTool(e.toolId),b=this._register(this.instantiationService.createInstance(WG,this.context,{title:this.getTitle(),icon:v?.icon&&No(v.icon,{id:!0})?v.icon:R.tools,subtitle:typeof e.originMessage=="string"?e.originMessage:e.originMessage?.value,buttons:this.createButtons(f.options),message:this.createWidgetContentElement(g.confirmationMessages.message,f)})),S=ie.Editing.hasToolConfirmation.bindTo(this.contextKeyService);S.set(!0),this._register(b.onDidClick(y=>{y.data(),this.chatWidgetService.getWidgetBySessionResource(this.context.element.sessionResource)?.focusInput()})),this._register(Z(()=>S.reset())),this.domNode=b.domNode}createButtons(e){let[t,...o]=e;return[{label:t,data:()=>this.confirmWith(this.toolInvocation,{type:4,selectedButton:t}),moreActions:o.map(n=>({label:n,data:()=>this.confirmWith(this.toolInvocation,{type:4,selectedButton:n})}))}]}createWidgetContentElement(e,t){let o=_(".chat-modified-files-confirmation");if(e){let n=this._register(this.markdownRendererService.render(typeof e=="string"?new Ie(e):e));o.append(n.element)}return o.append(this.createModifiedFilesElement(t)),o}createModifiedFilesElement(e){let t=_(".chat-modified-files-confirmation-list.chat-editing-session-container.show-file-icons"),o=M(t,_(".chat-editing-session-overview")),n=M(o,_(".working-set-title")),r=this._register(new mR(n,{buttonBackground:void 0,buttonBorder:void 0,buttonForeground:void 0,buttonHoverBackground:void 0,buttonSecondaryBackground:void 0,buttonSecondaryForeground:void 0,buttonSecondaryHoverBackground:void 0,buttonSeparator:void 0,supportIcons:!0})),s=M(o,_(".chat-editing-session-actions")),l=_(".working-set-line-counts"),c=M(l,_(".working-set-lines-added")),u=M(l,_(".working-set-lines-removed"));r.element.appendChild(l);let p=e.modifiedFiles.length===1?d(7870,null):d(7866,null,e.modifiedFiles.length);r.label=p;let h=0,g=0,f=!1;for(let G of e.modifiedFiles)(typeof G.insertions=="number"||typeof G.deletions=="number")&&(f=!0,h+=G.insertions??0,g+=G.deletions??0);f?(c.textContent=`+${h}`,u.textContent=`-${g}`,r.element.setAttribute("aria-label",d(7869,null,p,h,g)),l.setAttribute("aria-label",d(7868,null,h,g))):(l.remove(),r.element.setAttribute("aria-label",p));let v=this._register(new Wi(s,{...Qo,secondary:!0,small:!0,supportIcons:!0,ariaLabel:d(7871,null),title:d(7871,null)}));v.element.classList.add("default-colors"),v.icon=R.diffMultiple,v.label=" ",this._register(v.onDidClick(async()=>{await this.openAllChanges(e)}));let S=this._register(this.listPool.get()).object,y=e.modifiedFiles.map(G=>{let $=A.revive(G.uri),J=G.originalUri?A.revive(G.originalUri):void 0;return{kind:"reference",reference:$,title:G.title,description:G.description,state:1,showModifiedState:!0,options:{diffMeta:typeof G.insertions=="number"||typeof G.deletions=="number"?{added:G.insertions??0,removed:G.deletions??0}:void 0,originalUri:J,status:void 0}}});this._register(S.onDidOpen(async G=>{if(G.element?.kind!=="reference"||!A.isUri(G.element.reference))return;let $=G.element.reference,J=G.element.options?.originalUri;if(J){await this.editorService.openEditor({original:{resource:J},modified:{resource:$},options:G.editorOptions});return}await this.editorService.openEditor({resource:$,options:G.editorOptions})}));let T=Math.min(y.length,6)*22,P=M(t,_(".chat-editing-session-list.collapsed"));S.layout(T),S.getHTMLElement().style.height=`${T}px`,S.splice(0,S.length,y),P.append(S.getHTMLElement());let O=!0,V=()=>{r.icon=O?R.chevronRight:R.chevronDown,P.classList.toggle("collapsed",O)};V();let H=()=>{O=!O,V()};return this._register(r.onDidClick(H)),this._register(j(o,"click",G=>{G.defaultPrevented||G.target.closest(".monaco-button")||H()})),t}async openAllChanges(e){await this.commandService.executeCommand("_workbench.openMultiDiffEditor",{title:d(7867,null),resources:e.modifiedFiles.map(t=>({originalUri:t.originalUri?A.revive(t.originalUri):void 0,modifiedUri:A.revive(t.uri)}))})}createContentElement(){throw new Error("Not used")}getTitle(){let e=this.toolInvocation.state.get();if(e.type!==Pi.StateKind.WaitingForConfirmation)return"";let t=e.confirmationMessages?.title;return typeof t=="string"?t:t?.value??""}};yge=I([m(3,F),m(4,_e),m(5,X),m(6,Pt),m(7,Vn),m(8,On),m(9,ee),m(10,ge)],yge);var wge=class extends qv{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,P){super(e);this.context=o;this.renderer=n;this.editorPool=r;this.currentWidthDelegate=s;this.codeBlockModelCollection=l;this.codeBlockStartIndex=c;this.instantiationService=u;this.dialogService=p;this.keybindingService=h;this.modelService=g;this.languageService=f;this.configurationService=v;this.contextKeyService=b;this.chatWidgetService=S;this.preferencesService=y;this.storageService=w;this.terminalChatService=k;this.codeblocks=[];let O=e.state.get();if(O.type!==Pi.StateKind.WaitingForConfirmation||!O.confirmationMessages?.title)throw new Error("Confirmation messages are missing");t=iM(t);let{title:V,message:H,disclaimer:G,terminalCustomActions:$}=O.confirmationMessages,J=t.presentationOverrides?.commandLine??t.confirmation?.commandLine??(t.commandLine.toolEdited??t.commandLine.original).trimStart(),ae=t.confirmation?.cdPrefix??"",he=!!t.presentationOverrides,oe=this.configurationService.getValue(jl.EnableAutoApprove)===!0,de=this.storageService.getBoolean("chat.tools.terminal.autoApprove.warningAccepted",-1,!1),Ce;if(oe){if(Ce=[],!de&&(Ce.push({label:d(7873,null),data:{type:"enable"}}),Ce.push(new ri),$))for(let Ht of $)Ht instanceof ri||(Ht.disabled=!0);$&&Ce.push(...$),Ce.length===0&&(Ce=void 0)}let xe={hideToolbar:!0,reserveWidth:19,verticalPadding:5,editorOptions:{wordWrap:"on",readOnly:he,tabFocusMode:!0,ariaLabel:typeof V=="string"?V:V.value}},ze=this.languageService.getLanguageIdByLanguageName(t.presentationOverrides?.language??t.language??"sh")??"shellscript",De=this._register(this.modelService.createModel(J,this.languageService.createById(ze),this._getUniqueCodeBlockUri(),!0));Iht(T.createModelReference(De.uri),this._store);let Oe=this._register(this.editorPool.get());Oe.object.render({codeBlockIndex:this.codeBlockStartIndex,codeBlockPartIndex:0,element:this.context.element,languageId:ze,renderOptions:xe,textModel:Promise.resolve(De),chatSessionResource:this.context.element.sessionResource},this.currentWidthDelegate()),this.codeblocks.push({codeBlockIndex:this.codeBlockStartIndex,codemapperUri:void 0,elementId:this.context.element.id,focus:()=>Oe.object.focus(),ownerMarkdownPartId:this.codeblocksPartId,uri:De.uri,uriPromise:Promise.resolve(De.uri),chatSessionResource:this.context.element.sessionResource}),this._register(De.onDidChangeContent(Ht=>{let zi=De.getValue();zi!==J?t.commandLine.userEdited=ae+zi:t.commandLine.userEdited=void 0}));let pt=ct(".chat-confirmation-message-terminal",[ct(".chat-confirmation-message-terminal-editor@editor"),ct(".chat-confirmation-message-terminal-disclaimer@disclaimer")]);M(pt.editor,Oe.object.element),this._register(P.setupDelayedHover(pt.editor,{content:H||"",style:1,position:{hoverPosition:0}}));let et=this._register(this.instantiationService.createInstance(WG,this.context,{title:V,icon:R.terminal,message:pt.root,buttons:this._createButtons(Ce)}));if(t.requestUnsandboxedExecution){let Ht=t.requestUnsandboxedExecutionReason&&t.requestUnsandboxedExecutionReason.trim()||d(7877,null),zi=new Ie(void 0,{supportThemeIcons:!0});zi.appendMarkdown(`$(${R.info.id}) `),zi.appendText(Ht),this._appendMarkdownPart(pt.disclaimer,zi,xe)}G&&this._appendMarkdownPart(pt.disclaimer,G,xe);let Ti=ie.Editing.hasToolConfirmation.bindTo(this.contextKeyService);Ti.set(!0),this._register(Z(()=>Ti.reset())),this._register(et.onDidClick(async Ht=>{let zi=!0,Vo=Ht.data,sn=0;if(typeof Vo=="boolean")Vo&&(sn=4,t.autoApproveInfo&&(t.autoApproveInfo=void 0));else if(typeof Vo!="boolean")switch(Vo.type){case"enable":{if(await this._showAutoApproveWarning()){if(this.storageService.store("chat.tools.terminal.autoApprove.warningAccepted",!0,-1,0),t.autoApproveInfo)sn=4;else if($){for(let mn of $)mn instanceof ri||(mn.disabled=!1);et.updateButtons(this._createButtons($)),zi=!1}}else zi=!1;break}case"skip":{sn=5;break}case"newRule":{let cn=function(ua,xm){return ua.map(tm=>{if(xm==="session")return`\`${tm.key}\``;let Lu=xm==="workspace"?5:2,jg=fc(Ow.OpenTerminalSettingsLink,Lu);return`[\`${tm.key}\`](${jg.toString()} "${d(7884,null)}")`}).join(", ")},_n=cc(Vo.rule),mn=_n.filter(ua=>ua.scope==="session"),hn=_n.filter(ua=>ua.scope==="workspace"),yo=_n.filter(ua=>ua.scope==="user"),Mr=this.context.element.sessionResource;for(let ua of mn)this.terminalChatService.addSessionAutoApproveRule(Mr,ua.key,ua.value);if(hn.length>0){let xm=this.configurationService.inspect(jl.AutoApprove).workspaceValue??{};if(xi(xm)){let tm={...xm};for(let Lu of hn)tm[Lu.key]=Lu.value;await this.configurationService.updateValue(jl.AutoApprove,tm,5)}else throw this.preferencesService.openSettings({jsonEditor:!0,target:5,revealSetting:{key:jl.AutoApprove}}),new pa("Cannot add new rule, existing workspace setting is unexpected format")}if(yo.length>0){let xm=this.configurationService.inspect(jl.AutoApprove).userValue??{};if(xi(xm)){let tm={...xm};for(let Lu of yo)tm[Lu.key]=Lu.value;await this.configurationService.updateValue(jl.AutoApprove,tm,2)}else throw this.preferencesService.openSettings({jsonEditor:!0,target:2,revealSetting:{key:jl.AutoApprove}}),new pa("Cannot add new rule, existing setting is unexpected format")}let er={isTrusted:{enabledCommands:[Ow.OpenTerminalSettingsLink]}},Ns=[];mn.length>0&&Ns.push(mn.length===1?d(7878,null,cn(mn,"session")):d(7879,null,cn(mn,"session"))),hn.length>0&&Ns.push(hn.length===1?d(7882,null,cn(hn,"workspace")):d(7883,null,cn(hn,"workspace"))),yo.length>0&&Ns.push(yo.length===1?d(7880,null,cn(yo,"user")):d(7881,null,cn(yo,"user"))),Ns.length>0&&(t.autoApproveInfo=new Ie(Ns.join(", "),er)),sn=4;break}case"configure":{this.preferencesService.openSettings({target:2,query:`@id:${jl.AutoApprove}`}),zi=!1;break}case"sessionApproval":{let _n=this.context.element.sessionResource;this.terminalChatService.setChatSessionAutoApproval(_n,!0);let mn=fc(Ow.DisableSessionAutoApproval,_n),hn={isTrusted:{enabledCommands:[Ow.DisableSessionAutoApproval]}};t.autoApproveInfo=new Ie(`${d(7885,null)} ([${d(7886,null)}](${mn.toString()}))`,hn),sn=4;break}}zi&&(Pi.confirmWith(e,{type:sn}),this.chatWidgetService.getWidgetBySessionResource(this.context.element.sessionResource)?.focusInput())})),this.domNode=et.domNode}_createButtons(e){let t=(o,n,r=o)=>{let s=this.keybindingService.appendKeybinding(r,n);return{label:o,tooltip:s}};return[{...t(d(7888,null),JH),data:!0,moreActions:e},{...t(d(7889,null),rge,d(7887,null)),data:{type:"skip"},isSecondary:!0}]}async _showAutoApproveWarning(){return(await this.dialogService.prompt({type:bt.Info,message:d(7876,null),buttons:[{label:d(7872,null),run:()=>!0}],cancelButton:!0,custom:{icon:R.shield,markdownDetails:[{markdown:new Ie(d(7874,null))},{markdown:new Ie(`[${d(7875,null)}](https://code.visualstudio.com/docs/copilot/security#_security-considerations)`)}]}})).result===!0}_getUniqueCodeBlockUri(){return A.from({scheme:Q.vscodeChatCodeBlock,path:xt()})}_appendMarkdownPart(e,t,o){let n=this._register(this.instantiationService.createInstance(KT,{kind:"markdownContent",content:typeof t=="string"?new Ie().appendMarkdown(t):t},this.context,this.editorPool,!1,this.codeBlockStartIndex,this.renderer,void 0,this.currentWidthDelegate(),this.codeBlockModelCollection,{codeBlockRenderOptions:o}));M(e,n.domNode)}};wge=I([m(8,F),m(9,at),m(10,_e),m(11,Tt),m(12,_t),m(13,B),m(14,X),m(15,Pt),m(16,Go),m(17,ce),m(18,Wv),m(19,Bt),m(20,nt)],wge);var bKt=class extends x{constructor(e){super();this._options=e;this._commandFinished=!1;this._receivedData=!1;this._onDidRequestExpand=this._register(new E);this.onDidRequestExpand=this._onDidRequestExpand.event;this._setupListeners()}_setupListeners(){let e=this._register(new N),t=this._options.commandDetection;e.add(t.onCommandExecuted(()=>{this._options.shouldAutoExpand()&&!this._noDataTimeout&&(this._noDataTimeout=tn(()=>{this._noDataTimeout=void 0;let o=this._options.shouldAutoExpand(),n=this._options.hasRealOutput();o&&n&&(this._dataEventTimeout?.dispose(),this._dataEventTimeout=void 0,this._onDidRequestExpand.fire())},500,e))})),e.add(this._options.onWillData(()=>{this._receivedData||(this._receivedData=!0,this._options.shouldAutoExpand()&&!this._dataEventTimeout&&(this._dataEventTimeout=tn(()=>{this._dataEventTimeout=void 0;let o=this._options.shouldAutoExpand(),n=this._options.hasRealOutput();!this._commandFinished&&o&&n&&(this._noDataTimeout?.dispose(),this._noDataTimeout=void 0,this._onDidRequestExpand.fire())},50,e)))})),e.add(t.onCommandFinished(()=>{this._commandFinished=!0,this._clearAutoExpandTimeouts()}))}_clearAutoExpandTimeouts(){this._dataEventTimeout?.dispose(),this._dataEventTimeout=void 0,this._noDataTimeout?.dispose(),this._noDataTimeout=void 0}};var QDi=Ae("terminal-view-icon",R.terminal,d(14811,null)),fbo=Ae("terminal-rename",R.edit,d(14802,null)),SKt=Ae("terminal-kill",R.trash,d(14800,null)),vbo=Ae("terminal-new",R.add,d(14801,null)),bbo=Ae("terminal-configure-profile",R.gear,d(14799,null)),Sbo=Ae("terminal-decoration-mark",R.circleSmallFilled,d(14809,null)),YDi=Ae("terminal-decoration-incomplete",R.circle,d(14808,null)),Ibo=Ae("terminal-decoration-error",R.errorSmall,d(14807,null)),ybo=Ae("terminal-decoration-success",R.circleFilled,d(14810,null)),wbo=Ae("terminal-command-history-remove",R.close,d(14806,null)),Cbo=Ae("terminal-command-history-output",R.output,d(14805,null)),xbo=Ae("terminal-command-history-fuzzy-search",R.searchFuzzy,d(14803,null)),kbo=Ae("terminal-command-history-open-file",R.symbolReference,d(14804,null));function JDi(a,i,e){let t=e?`${d(14937,null)}

---

`:"";if(a)if(a.markProperties||i)if(a.markProperties?.hoverMessage||i)t=a.markProperties?.hoverMessage||i||"";else return"";else if(Yo(a.duration)){let o=u7(a.duration);a.exitCode?a.exitCode===-1?t+=d(14931,null,ea(a.timestamp,!0),o):t+=d(14933,null,ea(a.timestamp,!0),o,a.exitCode):t+=d(14936,null,ea(a.timestamp,!0),o)}else a.exitCode?a.exitCode===-1?t+=d(14930,null,ea(a.timestamp,!0)):t+=d(14932,null,ea(a.timestamp,!0),a.exitCode):t+=d(14934,null);else if(i)t=i;else return"";return t}var XDi=d(14929,null),Ebo=d(14928,null);function IKt(a,i){if(a)return JDi(a);if(!i)return"";let e=i.timestamp,t=i.exitCode,o=i.duration;if(typeof e!="number"||e===void 0)return"";let n="",r=ea(e,!0);if(typeof o=="number"){let s=u7(Math.max(o,0));t?t===-1?n+=d(14931,null,r,s):n+=d(14933,null,r,s,t):n+=d(14936,null,r,s)}else t?t===-1?n+=d(14930,null,r):n+=d(14932,null,r,t):n+=d(14935,null,r);return n}function yKt(a,i,e=Date.now()){let t="unknown",o=a?.exitCode??i?.exitCode,n=XDi,r=a?.timestamp??i?.timestamp,s=XDi,l,c=XDi;typeof r=="number"&&(s=new Date(r).toLocaleString()),a?a.exitCode===void 0?(t="running",n=Ebo,l=r!==void 0?Math.max(0,e-r):void 0):a.exitCode!==0?(t="error",n=String(a.exitCode),l=a.duration??(r!==void 0?Math.max(0,e-r):void 0)):(t="success",n=String(a.exitCode),l=a.duration??(r!==void 0?Math.max(0,e-r):void 0)):i&&(i.exitCode===void 0?(t="running",n=Ebo,l=r!==void 0?Math.max(0,e-r):void 0):i.exitCode!==0?(t="error",n=String(i.exitCode),l=i.duration):(t="success",n=String(i.exitCode),l=i.duration)),typeof l=="number"&&(c=u7(Math.max(l,0)));let u=[],p=YDi;switch(t){case"running":case"unknown":u.push("default-color","default"),p=YDi;break;case"error":u.push("error"),p=Ibo;break;case"success":u.push("success"),p=ybo;break}let h=IKt(a,i);return{status:t,icon:p,classNames:u,exitCode:o,exitCodeText:n,startTimestamp:r,startText:s,duration:l,durationText:c,hoverMessage:h}}function VOe(a,i){if(!i)return;let e=a.inspect("terminal.integrated.fontSize").value,t=a.inspect("terminal.integrated.fontSize").defaultValue,o=a.inspect("terminal.integrated.lineHeight").value;if(Yo(e)&&Yo(t)&&Yo(o)){let n=e/t<=1?e/t:1;i.style.width=`${n*16}px`,i.style.height=`${n*16*o}px`,i.style.fontSize=`${n*16}px`,i.style.marginLeft=`${n*-17}px`}}var Sx=class extends x{constructor(){super(...arguments);this._map=new Map;this._onDidAddCapability=this._register(new E);this._onDidRemoveCapability=this._register(new E)}get onDidAddCapability(){return this._onDidAddCapability.event}get onDidRemoveCapability(){return this._onDidRemoveCapability.event}get onDidChangeCapabilities(){return U.map(U.any(this._onDidAddCapability.event,this._onDidRemoveCapability.event),()=>{},this._store)}get onDidAddCommandDetectionCapability(){return U.map(U.filter(this.onDidAddCapability,e=>e.id===2,this._store),e=>e.capability,this._store)}get onDidRemoveCommandDetectionCapability(){return U.map(U.filter(this.onDidRemoveCapability,e=>e.id===2,this._store),()=>{},this._store)}get onDidAddCwdDetectionCapability(){return U.map(U.filter(this.onDidAddCapability,e=>e.id===0,this._store),e=>e.capability,this._store)}get onDidRemoveCwdDetectionCapability(){return U.map(U.filter(this.onDidRemoveCapability,e=>e.id===0,this._store),()=>{},this._store)}get items(){return this._map.keys()}createOnDidRemoveCapabilityOfTypeEvent(e){return U.map(U.filter(this.onDidRemoveCapability,t=>t.id===e),t=>t.capability)}createOnDidAddCapabilityOfTypeEvent(e){return U.map(U.filter(this.onDidAddCapability,t=>t.id===e),t=>t.capability)}add(e,t){this._map.set(e,t),this._onDidAddCapability.fire(ZDi(e,t))}get(e){return this._map.get(e)}remove(e){let t=this._map.get(e);t&&(this._map.delete(e),this._onDidRemoveCapability.fire(ZDi(e,t)))}has(e){return this._map.has(e)}};I([hi],Sx.prototype,"onDidChangeCapabilities",1),I([hi],Sx.prototype,"onDidAddCommandDetectionCapability",1),I([hi],Sx.prototype,"onDidRemoveCommandDetectionCapability",1),I([hi],Sx.prototype,"onDidAddCwdDetectionCapability",1),I([hi],Sx.prototype,"onDidRemoveCwdDetectionCapability",1);var sQ=class extends x{constructor(){super(...arguments);this._stores=[];this._onDidAddCapability=this._register(new E);this._onDidRemoveCapability=this._register(new E)}get onDidAddCapability(){return this._onDidAddCapability.event}get onDidRemoveCapability(){return this._onDidRemoveCapability.event}get onDidChangeCapabilities(){return U.map(U.any(this._onDidAddCapability.event,this._onDidRemoveCapability.event),()=>{},this._store)}get onDidAddCommandDetectionCapability(){return U.map(U.filter(this.onDidAddCapability,e=>e.id===2,this._store),e=>e.capability,this._store)}get onDidRemoveCommandDetectionCapability(){return U.map(U.filter(this.onDidRemoveCapability,e=>e.id===2,this._store),()=>{},this._store)}get onDidAddCwdDetectionCapability(){return U.map(U.filter(this.onDidAddCapability,e=>e.id===0,this._store),e=>e.capability,this._store)}get onDidRemoveCwdDetectionCapability(){return U.map(U.filter(this.onDidRemoveCapability,e=>e.id===0,this._store),()=>{},this._store)}get items(){return this._items()}createOnDidRemoveCapabilityOfTypeEvent(e){return U.map(U.filter(this.onDidRemoveCapability,t=>t.id===e),t=>t.capability)}createOnDidAddCapabilityOfTypeEvent(e){return U.map(U.filter(this.onDidAddCapability,t=>t.id===e),t=>t.capability)}*_items(){for(let e of this._stores)for(let t of e.items)yield t}has(e){for(let t of this._stores)for(let o of t.items)if(o===e)return!0;return!1}get(e){for(let t of this._stores){let o=t.get(e);if(o)return o}}add(e){this._stores.push(e);for(let t of e.items)this._onDidAddCapability.fire(ZDi(t,e.get(t)));this._register(e.onDidAddCapability(t=>this._onDidAddCapability.fire(t))),this._register(e.onDidRemoveCapability(t=>this._onDidRemoveCapability.fire(t)))}};I([hi],sQ.prototype,"onDidChangeCapabilities",1),I([hi],sQ.prototype,"onDidAddCommandDetectionCapability",1),I([hi],sQ.prototype,"onDidRemoveCommandDetectionCapability",1),I([hi],sQ.prototype,"onDidAddCwdDetectionCapability",1),I([hi],sQ.prototype,"onDidRemoveCwdDetectionCapability",1);function ZDi(a,i){return{id:a,capability:i}}function Mp(a,i,e=!1){Pot.INSTANCE.registerTerminalContribution({id:a,ctor:i,canRunInDetachedTerminals:e})}var Aot;(i=>{function a(){return Pot.INSTANCE.getTerminalContributions()}i.getTerminalContributions=a})(Aot||={});var Pot=class a{constructor(){this._terminalContributions=[]}static{this.INSTANCE=new a}registerTerminalContribution(i){this._terminalContributions.push(i)}getTerminalContributions(){return this._terminalContributions.slice(0)}};ne.add("terminal.contributions",Pot.INSTANCE);var BOe=class{constructor(){this._attached=new Map}attachToElement(i){this._container||(this._container=document.createElement("div"),this._container.classList.add("terminal-widget-container"),i.appendChild(this._container))}dispose(){this._container&&(this._container.remove(),this._container=void 0),this._attached.forEach(i=>i.dispose()),this._attached.clear()}attachWidget(i){if(this._container)return this._attached.get(i.id)?.dispose(),i.attach(this._container),this._attached.set(i.id,i),{dispose:()=>{this._attached.get(i.id)===i&&(this._attached.delete(i.id),i.dispose())}}}};var HOe=class extends x{constructor(e,t,o){super();this._xterm=e;this._widgets=this._register(new BOe);this._contributions=new Map;this._attachDisposables=this._register(new me);this.onData=this._xterm.raw.onData;let n=t.capabilities??new Sx;this._register(n),this.capabilities=n,this._register(e);let r=Aot.getTerminalContributions();for(let s of r){if(this._contributions.has(s.id)){mt(new Error(`Cannot have two terminal contributions with the same id ${s.id}`));continue}if(s.canRunInDetachedTerminals===!1)continue;let l;try{l=o.createInstance(s.ctor,{instance:this,processManager:t.processInfo,widgetManager:this._widgets}),this._contributions.set(s.id,l),this._register(l)}catch(c){mt(c)}}this._register(new Xo(ML)).trigger(()=>{for(let s of this._contributions.values())s.xtermReady?.(this._xterm)})}get xterm(){return this._xterm}get selection(){return this._xterm&&this.hasSelection()?this._xterm.raw.getSelection():void 0}hasSelection(){return this._xterm.hasSelection()}clearSelection(){this._xterm.clearSelection()}focus(e){(e||!Ki().getSelection()?.toString())&&this.xterm.focus()}attachToElement(e,t){this.domElement=e;let o=this._xterm.attachToElement(e,t);this._widgets.attachToElement(o);let n=new N,r=()=>{setTimeout(()=>this.focus(!0),0)};n.add(j(e,re.MOUSE_DOWN,r)),this._attachDisposables.value=n}forceScrollbarVisibility(){this.domElement?.classList.add("force-scrollbar")}resetScrollbarVisibility(){this.domElement?.classList.remove("force-scrollbar")}getContribution(e){return this._contributions.get(e)}};HOe=I([m(2,F)],HOe);var Cge=class extends x{constructor(e){super();this.processState=3;this.ptyProcessReady=Promise.resolve();this.initialCwd="";this.shouldPersist=!1;this.hasWrittenData=!1;this.hasChildProcesses=!1;this.shellIntegrationNonce="";Object.assign(this,e),this.capabilities=this._register(new Sx)}};function _bo(a,i,e){if(e){let n=We.fromHex(e);if(n)return n}let t=a.getColor(RJ);if(t)return t;let o=ie.inChatEditor.getValue(i);return a.getColor(o?Ho:lI)}function Dbo(a,i){let e=0;for(let t=0;t<a.length;t++){let o=a.getLine(t);if(!o)continue;let n=Math.min(o.length,i);for(let r=n-1;r>=0;r--)if(o.getCell(r)?.getChars()){e=Math.max(e,r+1);break}}return e}function Ytn(a,i,e,t=50){let o=Math.max(0,e-t),n=e;for(let r=o;r<n;r++)if(a.charCodeAt(r)!==i.charCodeAt(r))return!1;return!0}function wKt(a,i){return Math.max(i-a,0)}async function Lbo(a,i,e){let t=i.executedMarker,o=i.endMarker;if(!o||o.isDisposed)return;if(!t||t.isDisposed){let c=a.raw,u=c.buffer.active,p=[-(u.baseY+u.cursorY),-u.baseY,0],h;for(let S of p)if(h=c.registerMarker(S),h)break;if(!h||h.isDisposed)return{text:"",lineCount:0};let g=h.line,f;try{f=await a.getRangeAsVT(h,o,!0)}catch(S){e?.("fallback",S);return}finally{h.dispose()}if(!f)return{text:"",lineCount:0};let v=o.line,b=wKt(g,v);return{text:f,lineCount:b}}let n=t.line,r=o.line,s=wKt(n,r),l;try{l=await a.getRangeAsVT(t,o,!0)}catch(c){e?.("primary",c);return}return l?{text:l,lineCount:s}:{text:"",lineCount:0}}var UOe=class extends x{constructor(e,t,o,n){super();this._xtermTerminal=e;this._command=t;this._terminalService=o;this._contextKeyService=n;this._streamingDisposables=this._register(new N);this._onDidUpdateEmitter=this._register(new E);this.onDidUpdate=this._onDidUpdateEmitter.event;this._onDidInputEmitter=this._register(new E);this.onDidInput=this._onDidInputEmitter.event;this._lastVT="";this._lineCount=0;this._maxColumnWidth=0;this._dirtyScheduled=!1;this._isStreaming=!1;this._register(Z(()=>{this._stopStreaming()}))}async attach(e){if(this._store.isDisposed)return;let t;try{t=await this._getOrCreateTerminal()}catch(o){if(o instanceof go)return;throw o}this._store.isDisposed||this._attachedContainer!==e&&(e.classList.add("chat-terminal-output-terminal"),t.attachToElement(e,{enableGpu:!1}),this._attachedContainer=e)}async renderCommand(){if(this._store.isDisposed)return;let e;try{e=await this._getOrCreateTerminal()}catch(r){if(r instanceof go)return;throw r}if(this._store.isDisposed)return;let t;try{t=await this._getCommandOutputAsVT(this._xtermTerminal)}catch{}if(!t||this._store.isDisposed)return;await new Promise(r=>{if(!!this._lastVT&&t.text.length>=this._lastVT.length&&this._vtBoundaryMatches(t.text,this._lastVT.length)){let l=t.text.slice(this._lastVT.length);l?e.xterm.write(l,r):r()}else{let l=this._lastVT?`\x1Bc${t.text}`:t.text;l?e.xterm.write(l,r):r()}}),this._lastVT=t.text;let o=this._xtermTerminal.raw;return o&&(this._sourceRaw=o,this._lastUpToDateCursorY=this._getAbsoluteCursorY(o),!this._isStreaming&&(!this._command.endMarker||this._command.endMarker.isDisposed)&&this._startStreaming(o)),this._lineCount=this._getRenderedLineCount(),this._command.endMarker&&!this._command.endMarker.isDisposed&&this._lineCount<=100&&(this._maxColumnWidth=this._computeMaxColumnWidth()),{lineCount:this._lineCount,maxColumnWidth:this._maxColumnWidth}}async _getCommandOutputAsVT(e){if(this._store.isDisposed)return;let t=this._command.executedMarker??this._command.commandExecutedMarker;if(!t)return;let o=this._command.endMarker,n=await e.getRangeAsVT(t,o,o?.line!==t.line);if(!this._store.isDisposed)return n?{text:n}:{text:""}}_getRenderedLineCount(){let e=this._command.endMarker;if(this._command.executedMarker&&e&&!e.isDisposed){let o=this._command.executedMarker.line,n=e.line;return wKt(o,n)}let t=this._command.executedMarker??this._command.commandExecutedMarker;if(t&&this._sourceRaw){let o=this._sourceRaw.buffer.active,n=o.baseY+o.cursorY;return wKt(t.line,n)}return this._lineCount}_computeMaxColumnWidth(){let e=this._detachedTerminal;return e?Dbo(e.xterm.buffer.active,e.xterm.cols):0}async _getOrCreateTerminal(){if(this._detachedTerminal)return this._detachedTerminal;if(this._detachedTerminalPromise)return this._detachedTerminalPromise;if(this._store.isDisposed)throw new go;let e=(async()=>{let t={getBackgroundColor:r=>_bo(r,this._contextKeyService)},o=new Cge({initialCwd:""}),n=await this._terminalService.createDetachedTerminal({cols:this._xtermTerminal.raw.cols??80,rows:10,readonly:!1,processInfo:o,disableOverviewRuler:!0,colorProvider:t});if(this._store.isDisposed)throw o.dispose(),n.dispose(),new go;return this._detachedTerminal=n,this._register(o),this._register(n),this._register(n.onData(r=>this._onDidInputEmitter.fire(r))),n})();return this._detachedTerminalPromise=e,e}_startStreaming(e){this._store.isDisposed||this._isStreaming||(this._isStreaming=!0,this._streamingDisposables.add(U.any(e.onCursorMove,e.onLineFeed,e.onWriteParsed)(()=>this._handleCursorEvent())),this._streamingDisposables.add(e.onData(()=>this._handleCursorEvent())))}_stopStreaming(){this._isStreaming&&(this._streamingDisposables.clear(),this._isStreaming=!1,this._lowestDirtyCursorY=void 0,this._sourceRaw=void 0)}_handleCursorEvent(){if(this._store.isDisposed||!this._sourceRaw)return;let e=this._getAbsoluteCursorY(this._sourceRaw);this._lowestDirtyCursorY=this._lowestDirtyCursorY===void 0?e:Math.min(this._lowestDirtyCursorY,e),this._scheduleFlush()}_scheduleFlush(){this._dirtyScheduled||this._store.isDisposed||(this._dirtyScheduled=!0,queueMicrotask(()=>{this._dirtyScheduled=!1,!this._store.isDisposed&&this._flushDirtyRange()}))}_flushDirtyRange(){this._store.isDisposed||this._flushPromise||(this._flushPromise=this._doFlushDirtyRange().finally(()=>{this._flushPromise=void 0}))}async _doFlushDirtyRange(){if(this._store.isDisposed)return;let e=this._xtermTerminal.raw,t=this._detachedTerminal;if(!t)try{t=await this._getOrCreateTerminal()}catch(h){if(h instanceof go)return;throw h}if(this._store.isDisposed)return;let o=t?.xterm;if(!e||!o)return;this._sourceRaw=e;let n=this._getAbsoluteCursorY(e),r=this._lastUpToDateCursorY??n,s=this._lowestDirtyCursorY??n;this._lowestDirtyCursorY=void 0;let l=Math.min(r,s),c=await this._getCommandOutputAsVT(this._xtermTerminal);if(!c||this._store.isDisposed)return;if(c.text===this._lastVT){this._lastUpToDateCursorY=n,this._command.endMarker&&!this._command.endMarker.isDisposed&&this._stopStreaming();return}let u=!!this._lastVT&&l>=r&&c.text.length>=this._lastVT.length&&this._vtBoundaryMatches(c.text,this._lastVT.length);await new Promise(h=>{if(u){let g=c.text.slice(this._lastVT.length);g?o.write(g,h):h()}else{let g=this._lastVT?`\x1Bc${c.text}`:c.text;g?o.write(g,h):h()}}),this._lastVT=c.text,this._lineCount=this._getRenderedLineCount(),this._lastUpToDateCursorY=n,this._command.endMarker&&!this._command.endMarker.isDisposed&&(this._lineCount<=100&&(this._maxColumnWidth=this._computeMaxColumnWidth()),this._stopStreaming()),this._onDidUpdateEmitter.fire({lineCount:this._lineCount,maxColumnWidth:this._maxColumnWidth})}_getAbsoluteCursorY(e){return e.buffer.active.baseY+e.buffer.active.cursorY}_vtBoundaryMatches(e,t){return Ytn(e,this._lastVT,t)}};UOe=I([m(2,nn),m(3,X)],UOe);var zOe=class extends x{constructor(e,t,o,n){super();this._getTheme=t;this._terminalService=o;this._contextKeyService=n;this._dirty=!0;this._output=e;let r=this._register(new Cge({initialCwd:""}));this._detachedTerminal=this._terminalService.createDetachedTerminal({cols:80,rows:10,readonly:!0,processInfo:r,disableOverviewRuler:!0,colorProvider:{getBackgroundColor:s=>{let l=this._getTheme()?.background;return _bo(s,this._contextKeyService,l)}}}).then(s=>this._store.isDisposed?(s.dispose(),s):this._register(s))}async _getTerminal(){if(!this._detachedTerminal)throw new Error("Detached terminal not initialized");return this._detachedTerminal}setOutput(e){this._output=e,this._dirty=!0}async attach(e){let t=await this._getTerminal();if(this._store.isDisposed)return;e.classList.add("chat-terminal-output-terminal"),(this._attachedContainer!==e||e.firstChild===null)&&(t.attachToElement(e,{enableGpu:!1}),this._attachedContainer=e),this._container=e,this._applyTheme(e)}async render(){let e=this._output;if(!e)return;if(!this._dirty)return{lineCount:this._lastRenderedLineCount??e.lineCount,maxColumnWidth:this._lastRenderedMaxColumnWidth};let t=await this._getTerminal();if(this._store.isDisposed)return;this._container&&this._applyTheme(this._container);let o=e.text??"",n=e.lineCount??this._estimateLineCount(o);if(!o)return this._dirty=!1,this._lastRenderedLineCount=n,this._lastRenderedMaxColumnWidth=0,{lineCount:0,maxColumnWidth:0};if(await new Promise(r=>t.xterm.write(o,r)),!this._store.isDisposed)return this._dirty=!1,this._lastRenderedLineCount=n,this._shouldComputeMaxColumnWidth(n)&&(this._lastRenderedMaxColumnWidth=this._computeMaxColumnWidth(t)),{lineCount:n,maxColumnWidth:this._lastRenderedMaxColumnWidth}}_computeMaxColumnWidth(e){return Dbo(e.xterm.buffer.active,e.xterm.cols)}_estimateLineCount(e){if(!e)return 0;let t=e.replace(/\r/g,""),o=t.split(`
`),n=t.endsWith(`
`)?o.length-1:o.length;return Math.max(n,1)}_shouldComputeMaxColumnWidth(e){return e<=100}_applyTheme(e){let t=this._getTheme();if(!t){e.style.removeProperty("background-color"),e.style.removeProperty("color");return}t.background&&(e.style.backgroundColor=t.background),t.foreground&&(e.style.color=t.foreground)}};zOe=I([m(2,nn),m(3,X)],zOe);var Rbo=1,Xtn=10,Mbo=50,Jtn=10,Ztn=100,ein=2,eLi=new WeakMap,Not=class extends x{constructor(e,t){super();this._options=e;this._hoverService=t;let o=ct("span.chat-terminal-command-decoration@decoration",{role:"img",tabIndex:0});this._element=o.decoration,this._attachElementToContainer()}_attachElementToContainer(){let e=this._options.getCommandBlock();if(!e)return;let t=this._element;if(!t.isConnected||t.parentElement!==e){let o=this._options.getIconElement();o&&o.parentElement===e?o.insertAdjacentElement("afterend",t):e.insertBefore(t,e.firstElementChild??null)}this._register(this._hoverService.setupDelayedHover(t,()=>({content:this._getHoverText()}))),this._attachInteractionHandlers(t)}_getHoverText(){let e=this._options.getResolvedCommand(),t=this._options.terminalData.terminalCommandState;return IKt(e,t)||""}update(e){this._attachElementToContainer();let t=this._element,o=e??this._options.getResolvedCommand();this._apply(t,o)}_apply(e,t){let o=this._options.terminalData,n=o.terminalCommandState;if(t){let u=o.terminalCommandState??{};o.terminalCommandState={...u,exitCode:t.exitCode,timestamp:t.timestamp??u.timestamp,duration:t.duration??u.duration},n=o.terminalCommandState}else if(!n){let u=Date.now();o.terminalCommandState={exitCode:void 0,timestamp:u},n=o.terminalCommandState}let r=yKt(t,n),s=IKt(t,n);e.className="chat-terminal-command-decoration terminal-command-decoration",e.classList.add("codicon");for(let u of r.classNames)e.classList.add(u);e.classList.add(...q.asClassNameArray(r.icon));let l=!e.classList.contains("default");e.tabIndex=l?0:-1,l?e.removeAttribute("aria-disabled"):e.setAttribute("aria-disabled","true");let c=s||r.hoverMessage;c?e.setAttribute("aria-label",c):e.removeAttribute("aria-label")}_attachInteractionHandlers(e){this._interactionElement!==e&&(this._interactionElement=e)}};Not=I([m(1,nt)],Not);var KOe=class extends qv{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super(e);this._instantiationService=u;this._terminalChatService=p;this._terminalService=h;this._contextKeyService=g;this._chatWidgetService=f;this._keybindingService=v;this._configurationService=b;this._showOutputAction=this._register(new me);this._showOutputActionAdded=!1;this._focusAction=this._register(new me);this._continueInBackgroundAction=this._register(new me);this._userToggledOutput=!1;this._isInThinkingContainer=!1;this._usesCollapsibleWrapper=!1;this._elementIndex=o.elementIndex,this._contentIndex=o.contentIndex,this._sessionResource=o.element.sessionResource,t=iM(t),this._terminalData=t,this._terminalCommandUri=t.terminalCommandUri?A.revive(t.terminalCommandUri):void 0,this._storedCommandId=this._terminalCommandUri?new URLSearchParams(this._terminalCommandUri.query??"").get("command")??void 0:void 0,this._isSerializedInvocation=e.kind==="toolInvocationSerialized";let S=ct(".chat-terminal-content-part@container",[ct(".chat-terminal-content-title@title",[ct(".chat-terminal-command-block@commandBlock")]),ct(".chat-terminal-content-message@message")]);this._titleElement=S.title;let y=(t.commandLine.forDisplay??t.commandLine.userEdited??t.commandLine.toolEdited??t.commandLine.original).trimStart();this._commandText=y,this._terminalOutputContextKey=ie.inChatTerminalToolOutput.bindTo(this._contextKeyService),this._decoration=this._register(this._instantiationService.createInstance(Not,{terminalData:this._terminalData,getCommandBlock:()=>S.commandBlock,getIconElement:()=>{},getResolvedCommand:()=>this._getResolvedCommand()}));let w=t.presentationOverrides?.commandLine??y,k=t.presentationOverrides?.language??t.language,T=this._register(u.createInstance(FG,S.commandBlock,new Ie([`\`\`\`${k}`,`${w.replaceAll("```","\\`\\`\\`")}`,"```"].join(`
`),{supportThemeIcons:!0}),void 0));this._register(T.onDidChangeHeight(()=>{this._decoration.update()})),this._outputView=this._register(this._instantiationService.createInstance(Oot,()=>this._ensureTerminalInstance(),()=>this._getResolvedCommand(),()=>this._terminalData.terminalCommandOutput,()=>this._commandText,()=>this._terminalData.terminalTheme,!!this._terminalData.terminalToolSessionId)),(this._terminalData.terminalToolSessionId||this._terminalData.terminalCommandOutput)&&S.container.append(this._outputView.domNode),this._register(this._outputView.onDidFocus(()=>this._handleOutputFocus())),this._register(this._outputView.onDidBlur(Ce=>this._handleOutputBlur(Ce))),this._register(Z(()=>this._handleDispose())),this._register(this._keybindingService.onDidUpdateKeybindings(()=>{this._focusAction.value?.refreshKeybindingTooltip(),this._showOutputAction.value?.refreshKeybindingTooltip()}));let P=ct(".chat-terminal-action-bar@actionBar");S.title.append(P.root),this._actionBar=this._register(new Zi(P.actionBar,{})),this._initializeTerminalActions(),this._terminalService.whenConnected.then(()=>this._initializeTerminalActions());let O;e.pastTenseMessage&&(O=`${typeof e.pastTenseMessage=="string"?e.pastTenseMessage:e.pastTenseMessage.value}`);let H={kind:"markdownContent",content:new Ie(O,{supportThemeIcons:!0,isTrusted:Ar(e.pastTenseMessage)?e.pastTenseMessage.isTrusted:!1})},$={codeBlockRenderOptions:{hideToolbar:!0,reserveWidth:19,verticalPadding:5,editorOptions:{wordWrap:"on"}},accessibilityOptions:O?{statusMessage:d(7910,null,Nu(O))}:void 0};this.markdownPart=this._register(u.createInstance(KT,H,o,r,!1,l,n,{},s(),c,$)),S.message.append(this.markdownPart.domNode);let J=this._register(u.createInstance(uN,S.container,this.getIcon(),t.autoApproveInfo));this._decoration.update();let ae=this._configurationService.getValue("chat.agent.thinking.terminalTools"),he=this._configurationService.getValue("chat.tools.terminal.simpleCollapsible"),oe=e.kind==="toolInvocation"&&Pi.getConfirmationMessages(e);this._isInThinkingContainer=ae&&!oe,this._usesCollapsibleWrapper=this._isInThinkingContainer||he,this._usesCollapsibleWrapper?this.domNode=this._createCollapsibleWrapper(J.domNode,w,e,o):this.domNode=J.domNode,this._renderImagePills(e,o,S.container);let de=!!t.terminalCommandOutput;(eLi.get(e)||this._isInThinkingContainer&&Pi.isComplete(e)&&de)&&this._toggleOutput(!0),this._register(this._terminalChatService.registerProgressPart(this))}get codeblocks(){return this.markdownPart?.codeblocks??[]}get elementIndex(){return this._elementIndex}get contentIndex(){return this._contentIndex}_renderImagePills(e,t,o){let n=()=>{let s=mot(e,t.element.sessionResource).map(c=>({kind:"data",value:c.data.buffer,mimeType:c.mimeType,uri:c.uri}));if(s.length===0)return;let l=this._register(this._instantiationService.createInstance(SW,s));if(this._thinkingCollapsibleWrapper){let c=this._thinkingCollapsibleWrapper,u=p=>{p?o.appendChild(l.domNode):c.domNode.appendChild(l.domNode)};u(c.expanded.get()),this._register(be(p=>{u(c.expanded.read(p))}))}else o.appendChild(l.domNode)};e.kind==="toolInvocationSerialized"?n():this._register(be(r=>{e.state.read(r).type===Pi.StateKind.Completed&&n()}))}_createCollapsibleWrapper(e,t,o,n){let r=t.length>Mbo?t.substring(0,Mbo)+"...":t,s=Pi.isComplete(o),c=this._configurationService.getValue("chat.tools.autoExpandFailures")&&this._terminalData.terminalCommandState?.exitCode!==void 0&&this._terminalData.terminalCommandState.exitCode!==0,u=!s||c,p=this._register(this._instantiationService.createInstance(Bot,r,this._terminalData.commandLine.isSandboxWrapped===!0,e,n,u,s));this._thinkingCollapsibleWrapper=p;let h=!0;return this._register(be(g=>{let f=p.expanded.read(g);if(h){h=!1;return}this._toggleOutput(f)})),p.domNode}expandCollapsibleWrapper(){this._thinkingCollapsibleWrapper?.expand()}markCollapsibleWrapperComplete(){this._thinkingCollapsibleWrapper?.markComplete()}async _initializeTerminalActions(){if(this._store.isDisposed)return;let e=this._terminalData.terminalToolSessionId;if(!e){this._addActions();return}let t=async n=>{if(this._store.isDisposed)return;if(!n){this._isSerializedInvocation&&this._clearCommandAssociation(),this._addActions(void 0,e);return}this._terminalInstance!==n&&(this._terminalInstance=n,this._registerInstanceListener(n)),this._addActions(n,e)},o=await this._terminalChatService.getTerminalInstanceByToolSessionId(e);if(await t(o),o||this._addActions(void 0,e),!this._store.isDisposed){if(!this._terminalSessionRegistration){let n=this._terminalChatService.onDidRegisterTerminalInstanceWithToolSession(async r=>{let s=await this._terminalChatService.getTerminalInstanceByToolSessionId(e);r===s&&(this._terminalSessionRegistration?.dispose(),this._terminalSessionRegistration=void 0,await t(r))});this._terminalSessionRegistration=this._store.add(n)}this._store.add(this._terminalChatService.onDidContinueInBackground(n=>{n===e&&(this._terminalData.didContinueInBackground=!0,this._removeContinueInBackgroundAction())}))}}_addActions(e,t){if(this._store.isDisposed)return;let o=this._actionBar;this._removeFocusAction();let n=this._getResolvedCommand(e);if(this._removeContinueInBackgroundAction(),e){let r=e&&t?this._terminalChatService.isBackgroundTerminal(t):!1,s=this._instantiationService.createInstance(Wot,e,n,this._terminalCommandUri,this._storedCommandId,r);if(this._focusAction.value=s,o.push(s,{icon:!0,label:!1,index:0}),t&&!this._terminalData.isBackground&&!this._terminalData.didContinueInBackground&&n?.exitCode===void 0&&this._terminalData.terminalCommandState?.exitCode===void 0){let c=this._instantiationService.createInstance(Vot,t);this._continueInBackgroundAction.value=c,o.push(c,{icon:!0,label:!1,index:0})}}this._ensureShowOutputAction(n),this._decoration.update(n)}_getResolvedCommand(e){let t=e??this._terminalInstance;if(t)return this._resolveCommand(t)}_ensureShowOutputAction(e){if(this._store.isDisposed||this._usesCollapsibleWrapper)return;let t=e??this._getResolvedCommand(),o=!!this._terminalData.terminalCommandOutput;if(!t&&!o)return;let n=this._showOutputAction.value;if(!n){n=this._instantiationService.createInstance(Fot,()=>this._toggleOutputFromAction()),this._showOutputAction.value=n;let s=this._configurationService.getValue("chat.tools.autoExpandFailures"),l=t?.exitCode??this._terminalData.terminalCommandState?.exitCode;l!==void 0&&l!==0&&s&&this._toggleOutput(!0)}n.syncPresentation(this._outputView.isExpanded);let r=this._actionBar;if(this._showOutputActionAdded){let s=r.viewItems.findIndex(l=>l.action===n);if(s>=0&&s!==r.length()-1)r.pull(s),this._showOutputActionAdded=!1;else if(s>=0)return}this._showOutputActionAdded||(r.push([n],{icon:!0,label:!1}),this._showOutputActionAdded=!0)}_clearCommandAssociation(e){this._terminalCommandUri=void 0,this._storedCommandId=void 0,e?.clearPersistentData&&(this._terminalData.terminalCommandUri&&delete this._terminalData.terminalCommandUri,this._terminalData.terminalToolSessionId&&delete this._terminalData.terminalToolSessionId),this._decoration.update()}_shouldAutoExpand(){return!this._outputView.isExpanded&&!this._userToggledOutput&&!this._store.isDisposed&&!eLi.get(this.toolInvocation)}_registerInstanceListener(e){let t=this._register(new me),o=async()=>{let s=this._resolveCommand(e);return this._addActions(e,this._terminalData.terminalToolSessionId),s},n=async s=>{if(t.clear(),!s){await o();return}let l=new N,c=0,u=()=>{if(this._terminalData.terminalCommandOutput?.text?.trim())return!0;let g=this._getResolvedCommand(e);if(!g?.executedMarker||e.isDisposed)return!1;let f=e.xterm?.raw.buffer.active;return f?f.baseY+f.cursorY>g.executedMarker.line?!0:c>ein:!1},p=l.add(new bKt({commandDetection:s,onWillData:e.onWillData,shouldAutoExpand:()=>this._shouldAutoExpand(),hasRealOutput:u}));l.add(p.onDidRequestExpand(()=>{this._usesCollapsibleWrapper&&this.expandCollapsibleWrapper(),this._toggleOutput(!0)})),l.add(e.onWillData(()=>{c++})),l.add(s.onCommandExecuted(()=>{this._addActions(e,this._terminalData.terminalToolSessionId)})),l.add(s.onCommandFinished(()=>{this._addActions(e,this._terminalData.terminalToolSessionId);let g=this._getResolvedCommand(e);this._handleCommandCompletion(g),g?.endMarker&&t.clear()})),t.value=l;let h=await o();if(h?.endMarker){t.clear(),this._handleCommandCompletion(h);return}};n(e.capabilities.get(2)),this._register(e.capabilities.onDidAddCommandDetectionCapability(s=>n(s)));let r=this._register(e.onDisposed(()=>{this._terminalInstance===e&&(this._terminalInstance=void 0),this._clearCommandAssociation({clearPersistentData:!0}),t.clear(),this._store.isDisposed||this._actionBar.clear(),this._removeFocusAction(),this._showOutputActionAdded=!1,this._showOutputAction.clear(),this._addActions(void 0,this._terminalData.terminalToolSessionId),r.dispose()}))}_removeFocusAction(){if(this._store.isDisposed)return;let e=this._actionBar,t=this._focusAction.value;if(e&&t){let o=e.viewItems.findIndex(n=>n.action===t);o>=0&&e.pull(o)}this._focusAction.clear()}_removeContinueInBackgroundAction(){if(this._store.isDisposed)return;let e=this._actionBar,t=this._continueInBackgroundAction.value;if(e&&t){let o=e.viewItems.findIndex(n=>n.action===t);o>=0&&e.pull(o)}this._continueInBackgroundAction.clear()}_handleCommandCompletion(e){this.markCollapsibleWrapperComplete(),e?.exitCode===0&&this._outputView.isExpanded&&!this._userToggledOutput&&this._toggleOutput(!1),this._configurationService.getValue("chat.tools.autoExpandFailures")&&e?.exitCode!==void 0&&e.exitCode!==0&&this._thinkingCollapsibleWrapper&&this.expandCollapsibleWrapper()}async _toggleOutput(e){let t=await this._outputView.toggle(e),o=this._outputView.isExpanded;return this._titleElement.classList.toggle("chat-terminal-content-title-no-bottom-radius",o),this._showOutputAction.value?.syncPresentation(o),t&&eLi.set(this.toolInvocation,o),t}async _ensureTerminalInstance(){return this._terminalInstance?.isDisposed&&(this._terminalInstance=void 0),!this._terminalInstance&&this._terminalData.terminalToolSessionId&&(this._terminalInstance=await this._terminalChatService.getTerminalInstanceByToolSessionId(this._terminalData.terminalToolSessionId),this._terminalInstance?.isDisposed&&(this._terminalInstance=void 0)),this._terminalInstance}_handleOutputFocus(){this._terminalOutputContextKey.set(!0),this._terminalChatService.setFocusedProgressPart(this),this._outputView.updateAriaLabel()}_handleOutputBlur(e){let t=e.relatedTarget;this._outputView.containsElement(t)||(this._terminalOutputContextKey.reset(),this._terminalChatService.clearFocusedProgressPart(this))}_handleDispose(){this._terminalOutputContextKey.reset(),this._terminalChatService.clearFocusedProgressPart(this)}getCommandAndOutputAsText(){return this._outputView.getCommandAndOutputAsText()}focusOutput(){this._outputView.focus()}_focusChatInput(){this._chatWidgetService.getWidgetBySessionResource(this._sessionResource)?.focusInput()}async focusTerminal(){if(this._focusAction.value){await this._focusAction.value.run();return}this._terminalCommandUri&&this._terminalService.openResource(this._terminalCommandUri)}async toggleOutputFromKeyboard(){if(this._userToggledOutput=!0,!this._outputView.isExpanded){await this._toggleOutput(!0),this.focusOutput();return}await this._collapseOutputAndFocusInput()}async _toggleOutputFromAction(){if(this._userToggledOutput=!0,!this._outputView.isExpanded){await this._toggleOutput(!0);return}await this._toggleOutput(!1)}async _collapseOutputAndFocusInput(){this._outputView.isExpanded&&await this._toggleOutput(!1),this._focusChatInput()}_resolveCommand(e){if(e.isDisposed)return;let t=e.capabilities.get(2);if(!t)return;let o=this._terminalData.terminalCommandId;if(!o)return;let n=t.commands;if(n&&n.length>0){let s=n.find(l=>l.id===o);if(s)return s}let r=t.executingCommandObject;if(r&&r.id===o)return r}};KOe=I([m(8,F),m(9,Wv),m(10,nn),m(11,X),m(12,Pt),m(13,_e),m(14,B)],KOe);var Oot=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this._ensureTerminalInstance=e;this._resolveCommand=t;this._getTerminalCommandOutput=o;this._getCommandText=n;this._getStoredTheme=r;this._hasTerminalSession=s;this._accessibleViewService=l;this._instantiationService=c;this._terminalConfigurationService=u;this._themeService=p;this._contextKeyService=h;this._isAtBottom=!0;this._isProgrammaticScroll=!1;this._onDidFocusEmitter=this._register(new E);this._onDidBlurEmitter=this._register(new E);let g=ct(".chat-terminal-output-container@container",[ct(".chat-terminal-output-body@body",[ct(".chat-terminal-output-content@content",[ct(".chat-terminal-output-terminal@terminal"),ct(".chat-terminal-output-empty@empty")])])]);this.domNode=g.container,this.domNode.classList.add("collapsed"),this._outputBody=g.body,this._contentContainer=g.content,this._terminalContainer=g.terminal,this._emptyElement=g.empty,this._contentContainer.appendChild(this._emptyElement),this._register(j(this.domNode,re.FOCUS_IN,()=>this._onDidFocusEmitter.fire())),this._register(j(this.domNode,re.FOCUS_OUT,v=>this._onDidBlurEmitter.fire(v)));let f=new ResizeObserver(()=>this._handleResize());f.observe(this.domNode),this._register(Z(()=>f.disconnect())),this._applyBackgroundColor(),this._register(this._themeService.onDidColorThemeChange(()=>this._applyBackgroundColor()))}get isExpanded(){return this.domNode.classList.contains("expanded")}get onDidFocus(){return this._onDidFocusEmitter.event}get onDidBlur(){return this._onDidBlurEmitter.event}async toggle(e){let t=this.isExpanded;return e===t?(e&&await this._updateTerminalContent(),!1):e?(this._scrollableContainer||await this._createScrollableContainer(),await this._updateTerminalContent(),this._setExpanded(!0),this._layoutOutput(),this._scrollOutputToBottom(),this._scheduleOutputRelayout(),!0):(this._setExpanded(!1),this._isAtBottom=!0,!0)}focus(){this._scrollableContainer?.getDomNode().focus()}containsElement(e){return!!e&&this.domNode.contains(e)}updateAriaLabel(){if(!this._scrollableContainer)return;let t=this._resolveCommand()?.command??this._getCommandText();if(!t)return;let o=d(7901,null,t),n=this._scrollableContainer.getDomNode();n.setAttribute("role","region");let r=this._accessibleViewService.getOpenAriaHint("accessibility.verbosity.terminalChatOutput"),s=r?o+", "+r:o;n.setAttribute("aria-label",s)}getCommandAndOutputAsText(){let e=this._resolveCommand(),t=e?.command??this._getCommandText();if(!t)return;let o=d(7900,null,t);if(e){let l=e.getOutput();if(!l||l.trim().length===0)return`${o}
${d(7898,null)}`;let c=l.split(`
`);return`${o}
${c.join(`
`).trimEnd()}`}let n=this._getTerminalCommandOutput();if(!n)return`${o}
${d(7903,null)}`;let r=zS(n.text??"");if(!r.trim().length)return`${o}
${d(7898,null)}`;let s=r.trimEnd();return n.truncated&&(s+=`
${d(7902,null)}`),`${o}
${s}`}_setExpanded(e){this.domNode.classList.toggle("expanded",e),this.domNode.classList.toggle("collapsed",!e)}async _createScrollableContainer(){this._scrollableContainer=this._register(new ms(this._outputBody,{vertical:2,horizontal:2,handleMouseWheel:!0}));let e=this._scrollableContainer.getDomNode();e.tabIndex=0,this.domNode.appendChild(e),this.updateAriaLabel(),this._register(j(this.domNode,re.MOUSE_ENTER,()=>{this._scrollableContainer?.updateOptions({horizontal:1})})),this._register(j(this.domNode,re.MOUSE_LEAVE,()=>{this._scrollableContainer?.updateOptions({horizontal:2})})),this._register(j(this.domNode,re.FOCUS_IN,()=>{this._scrollableContainer?.updateOptions({horizontal:1})})),this._register(j(this.domNode,re.FOCUS_OUT,()=>{this._scrollableContainer?.updateOptions({horizontal:2})})),this._register(this._scrollableContainer.onScroll(()=>{this._isProgrammaticScroll||(this._isAtBottom=this._computeIsAtBottom())}))}async _updateTerminalContent(){let e=await this._resolveLiveTerminal(),t=e?this._resolveCommand():void 0,o=this._getTerminalCommandOutput();if(!(e&&t&&await this._renderLiveOutput(e,t))){if(this._disposeLiveMirror(),o){await this._renderSnapshotOutput(o);return}this._hasTerminalSession&&this._renderUnavailableMessage(e)}}async _renderLiveOutput(e,t){if(this._mirror)return!0;if(await e.xtermReadyPromise,this._store.isDisposed||e.isDisposed||!e.xterm)return this._disposeLiveMirror(),!1;let o=this._register(this._instantiationService.createInstance(UOe,e.xterm,t));this._mirror=o,this._register(o.onDidUpdate(l=>{l.lineCount&&l.lineCount>0&&this._hideEmptyMessage(),this._layoutOutput(l.lineCount),this._isAtBottom&&this._scrollOutputToBottom()})),this._register(o.onDidInput(l=>{e.isDisposed||e.sendText(l,!1)})),await o.attach(this._terminalContainer);let n=await o.renderCommand(),r=!!t.endMarker,s=n&&n.lineCount&&n.lineCount>0;if(!s)for(let l=0;l<Jtn&&!s;l++){if(await Li(Ztn),this._store.isDisposed)return!0;if(n=await o.renderCommand(),s=n&&n.lineCount&&n.lineCount>0,r=!!t.endMarker,r)break}return s?this._hideEmptyMessage():r&&this._showEmptyMessage(d(7898,null)),this._layoutOutput(n?.lineCount??0),!0}async _renderSnapshotOutput(e){if(this._snapshotMirror){this._layoutOutput(e.lineCount??this._lastRenderedLineCount??0);return}if(this._store.isDisposed)return;Rt(this._terminalContainer),this._snapshotMirror=this._register(this._instantiationService.createInstance(zOe,e,this._getStoredTheme)),await this._snapshotMirror.attach(this._terminalContainer),this._snapshotMirror.setOutput(e);let t=await this._snapshotMirror.render();!!e.text&&e.text.length>0?this._hideEmptyMessage():this._showEmptyMessage(d(7898,null));let n=t?.lineCount??e.lineCount??0;this._layoutOutput(n)}_renderUnavailableMessage(e){Rt(this._terminalContainer),this._lastRenderedLineCount=void 0,e?this._showEmptyMessage(d(7897,null)):this._showEmptyMessage(d(7899,null))}async _resolveLiveTerminal(){let e=await this._ensureTerminalInstance();return e&&!e.isDisposed?e:void 0}_showEmptyMessage(e){this._emptyElement.textContent=e,this._terminalContainer.classList.add("chat-terminal-output-terminal-no-output"),this.domNode.classList.add("chat-terminal-output-container-no-output")}_hideEmptyMessage(){this._emptyElement.textContent="",this._terminalContainer.classList.remove("chat-terminal-output-terminal-no-output"),this.domNode.classList.remove("chat-terminal-output-container-no-output")}_disposeLiveMirror(){this._mirror&&(this._mirror.dispose(),this._mirror=void 0)}_scheduleOutputRelayout(){Ki().requestAnimationFrame(()=>{this._layoutOutput(),this._scrollOutputToBottom()})}_handleResize(){this._scrollableContainer&&(this.isExpanded?(this._layoutOutput(),this._scrollOutputToBottom()):this._scrollableContainer.scanDomNode())}_layoutOutput(e){if(!this._scrollableContainer||(e!==void 0?this._lastRenderedLineCount=e:e=this._lastRenderedLineCount,this._scrollableContainer.scanDomNode(),!this.isExpanded||e===void 0))return;let t=this._scrollableContainer.getDomNode(),o=this._computeRowHeightPx(),n=this._getOutputPadding(),r=o*Rbo+n,s=o*Xtn+n,l=this._getOutputContentHeight(e,o,n),c=Math.min(l,s),u=Math.max(this._outputBody.clientHeight,r),p=Math.min(c,u);t.style.height=p<s?`${p}px`:"",this._scrollableContainer.scanDomNode()}_computeIsAtBottom(){if(!this._scrollableContainer)return!0;let e=this._scrollableContainer.getScrollDimensions();return this._scrollableContainer.getScrollPosition().scrollTop>=e.scrollHeight-e.height-5}_scrollOutputToBottom(){if(!this._scrollableContainer)return;this._isProgrammaticScroll=!0;let e=this._scrollableContainer.getScrollDimensions();this._scrollableContainer.setScrollPosition({scrollTop:e.scrollHeight}),this._isProgrammaticScroll=!1}_getOutputContentHeight(e,t,o){return(Math.max(e,Rbo)+1)*t+o}_getOutputPadding(){let e=y1(this._outputBody),t=Number.parseFloat(e.paddingTop||"0"),o=Number.parseFloat(e.paddingBottom||"0");return t+o}_computeRowHeightPx(){let e=Ki(),t=this._terminalConfigurationService.getFont(e),o=Yo(t.charHeight)&&t.charHeight>0,n=Yo(t.fontSize)&&t.fontSize>0,r=Yo(t.lineHeight)&&t.lineHeight>0,s=(o?t.charHeight:n?t.fontSize:1)??1,l=r?t.lineHeight:1,c=Math.ceil(s*l);return Math.max(c,1)}_applyBackgroundColor(){let e=this._themeService.getColorTheme(),t=ie.inChatEditor.getValue(this._contextKeyService),o=e.getColor(t?Ho:lI);o&&(this.domNode.style.backgroundColor=o.toString())}};Oot=I([m(6,ou),m(7,F),m(8,Uu),m(9,Le),m(10,X)],Oot);var Fot=class extends it{constructor(e,t,o){super(Ow.ToggleChatTerminalOutput,d(7909,null),q.asClassName(R.chevronRight),!0);this._toggle=e;this._keybindingService=t;this._telemetryService=o;this._expanded=!1;this._updateTooltip()}async run(){this._telemetryService.publicLog2("terminal/chatToggleOutput",{previousExpanded:this._expanded}),await this._toggle()}syncPresentation(e){this._expanded=e,this._updatePresentation(),this._updateTooltip()}refreshKeybindingTooltip(){this._updateTooltip()}_updatePresentation(){this._expanded?(this.label=d(7906,null),this.class=q.asClassName(R.chevronDown)):(this.label=d(7909,null),this.class=q.asClassName(R.chevronRight))}_updateTooltip(){this.tooltip=this._keybindingService.appendKeybinding(this.label,Ow.FocusMostRecentChatTerminalOutput)}};Fot=I([m(1,_e),m(2,Te)],Fot);var Wot=class extends it{constructor(e,t,o,n,r,s,l,c,u,p){super(Ow.FocusChatInstanceAction,r?d(7908,null):d(7905,null),q.asClassName(R.openInProduct),!0);this._instance=e;this._command=t;this._commandUri=o;this._commandId=n;this._terminalService=s;this._terminalEditorService=l;this._terminalGroupService=c;this._keybindingService=u;this._telemetryService=p;this._updateTooltip()}async run(){this.label=this._instance?.shellLaunchConfig.hideFromUser?d(7907,null):d(7905,null),this._updateTooltip();let e="none",t="panel";if(this._instance?(e="instance",t=this._instance.target===2?"editor":"panel"):this._commandUri&&(e="commandUri"),this._telemetryService.publicLog2("terminal/chatFocusInstance",{target:e,location:t}),this._instance){this._terminalService.setActiveInstance(this._instance),this._instance.target===2?this._terminalEditorService.openEditor(this._instance):await this._terminalGroupService.showPanel(!0),this._terminalService.setActiveInstance(this._instance),await this._instance.focusWhenReady(!0);let o=this._resolveCommand();o&&this._instance.xterm?.markTracker.revealCommand(o);return}this._commandUri&&this._terminalService.openResource(this._commandUri)}refreshKeybindingTooltip(){this._updateTooltip()}_resolveCommand(){if(this._command&&!this._command.endMarker?.isDisposed)return this._command;if(!this._instance||!this._commandId)return this._command;let t=this._instance.capabilities.get(2)?.commands.find(o=>o.id===this._commandId);return t&&(this._command=t),this._command}_updateTooltip(){this.tooltip=this._keybindingService.appendKeybinding(this.label,Ow.FocusMostRecentChatTerminal)}};Wot=I([m(5,nn),m(6,Fv),m(7,lc),m(8,_e),m(9,Te)],Wot);var Vot=class extends it{constructor(e,t){super(Ow.ContinueInBackground,d(7904,null),q.asClassName(R.debugContinue),!0);this._terminalToolSessionId=e;this._terminalChatService=t}async run(){this._terminalChatService.continueInBackground(this._terminalToolSessionId)}};Vot=I([m(1,Wv)],Vot);var Bot=class extends UT{constructor(i,e,t,o,n,r,s,l){let c=r?d(7890,null,i):d(7893,null,i);super(c,o,void 0,s,l),this._terminalContentElement=t,this._commandText=i,this._isSandboxWrapped=e,this._isComplete=r,this.domNode.classList.add("chat-terminal-thinking-collapsible"),r&&(this.icon=R.check),this._setCodeFormattedTitle(),this.setExpanded(n)}_setCodeFormattedTitle(){if(!this._collapseButton)return;let i=this._collapseButton.labelElement;if(i.textContent="",this._isSandboxWrapped){let n=this._isComplete?d(7892,null):d(7895,null),r=d(7896,null);i.appendChild(document.createTextNode(n));let s=document.createElement("code");s.textContent=this._commandText,i.appendChild(s),i.appendChild(document.createTextNode(r));return}let e=this._isComplete?d(7891,null):d(7894,null),t=document.createTextNode(e),o=document.createElement("code");o.textContent=this._commandText,i.appendChild(t),i.appendChild(o)}markComplete(){this._isComplete||(this._isComplete=!0,this.icon=R.check,this._setCodeFormattedTitle())}initContent(){let i=_(".chat-used-context-list.chat-terminal-thinking-content");return i.appendChild(this._terminalContentElement),i}expand(){this.setExpanded(!0)}hasSameContent(i,e,t){return!1}};Bot=I([m(6,nt),m(7,B)],Bot);var tin=100,xge=class extends IW{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){let w=e.state.get();if(w.type!==Pi.StateKind.WaitingForConfirmation||!w.confirmationMessages?.title)throw new Error("Confirmation messages are missing");super(e,t,c,u,h,g,b);this.renderer=o;this.editorPool=n;this.currentWidthDelegate=r;this.codeBlockModelCollection=s;this.codeBlockStartIndex=l;this.languageService=p;this.commandService=f;this.markerService=v;this.chatMarkdownAnchorService=S;this.confirmationService=y;this.markdownParts=[];this.render({allowActionId:JH,skipActionId:rge,allowLabel:w.confirmationMessages.confirmResults?d(7912,null):d(7911,null),skipLabel:d(7917,null),partType:"chatToolConfirmation",subtitle:typeof e.originMessage=="string"?e.originMessage:e.originMessage?.value})}get codeblocks(){return this.markdownParts.flatMap(e=>e.codeblocks)}additionalPrimaryActions(){let e=super.additionalPrimaryActions(),t=this.toolInvocation.state.get();if(t.type!==Pi.StateKind.WaitingForConfirmation)return e;if(t.confirmationMessages?.allowAutoConfirm!==!1){let o=t.confirmationMessages?.approveCombination,n=o?{label:typeof o.label=="string"?o.label:o.label.value,key:o.key}:void 0,r=this.confirmationService.getPreConfirmActions({toolId:this.toolInvocation.toolId,source:this.toolInvocation.source,parameters:t.parameters,chatSessionResource:this.context.element.sessionResource,combination:n});for(let s of r)s.divider&&e.push(new ri),e.push({label:s.label,tooltip:s.detail,scope:s.scope,data:async()=>{await s.select()&&this.confirmWith(this.toolInvocation,{type:4})}})}return t.confirmationMessages?.confirmResults&&e.unshift({label:d(7913,null),data:()=>{t.confirmationMessages.confirmResults=void 0,this.confirmWith(this.toolInvocation,{type:4})}},new ri),e}useAllowOnceAsPrimary(){let e=this.toolInvocation.state.get();return e.type===Pi.StateKind.WaitingForConfirmation?!!e.confirmationMessages?.approveCombination:!1}createContentElement(){let e=this.toolInvocation.state.get();if(e.type!==Pi.StateKind.WaitingForConfirmation)return"";let{message:t,disclaimer:o}=e.confirmationMessages,n=this.toolInvocation;if(typeof t=="string"&&!o)return t;{let r={hideToolbar:!0,reserveWidth:19,verticalPadding:5,editorOptions:{tabFocusMode:!0,ariaLabel:this.getTitle()}},s=ct("div",[ct(".message@messageContainer",[ct(".message-wrapper@message"),ct(".see-more@showMore",[ct("a",[d(7916,null)])])]),ct(".editor@editor"),ct(".disclaimer@disclaimer")]);if(n.toolSpecificData?.kind==="input"&&n.toolSpecificData.rawInput&&!Of(n.toolSpecificData.rawInput)){let p=document.createElement("h3");p.textContent=d(7914,null),s.editor.appendChild(p);let h=n.toolSpecificData,g={hideToolbar:!0,reserveWidth:19,maxHeightInLines:13,verticalPadding:5,editorOptions:{wordWrap:"off",readOnly:!1,ariaLabel:this.getTitle()}},f=this.languageService.getLanguageIdByLanguageName("json"),v=JSON.stringify(h.rawInput??{},null,1),b=DL(v,`
`)>2,y=this._register(this.context.inlineTextModels.acquire(Xeo(n.toolCallId),v.replace(/\n */g," "),this.languageService.createById(f),!0)).object,w=xt(),k=K6e(n.toolId),T=new Dt(async()=>{let O=[],V=await this.commandService.executeCommand("json.validate",k,y.getValue());for(let H of V??[])H.range&&H.message&&O.push({severity:H.severity==="Error"?8:4,message:H.message,startLineNumber:H.range[0].line+1,startColumn:H.range[0].character+1,endLineNumber:H.range[1].line+1,endColumn:H.range[1].character+1,code:H.code?String(H.code):void 0});this.markerService.changeOne(w,y.uri,O)},500);T.schedule(),this._register(y.onDidChangeContent(()=>T.schedule())),this._register(Z(()=>this.markerService.remove(w,[y.uri]))),this._register(T);let P=this._register(this.editorPool.get());if(P.object.render({codeBlockIndex:this.codeBlockStartIndex,codeBlockPartIndex:0,element:this.context.element,languageId:f??"json",renderOptions:g,textModel:Promise.resolve(y),chatSessionResource:this.context.element.sessionResource},this.currentWidthDelegate()),this.codeblocks.push({codeBlockIndex:this.codeBlockStartIndex,codemapperUri:void 0,elementId:this.context.element.id,focus:()=>P.object.focus(),ownerMarkdownPartId:this.codeblocksPartId,uri:y.uri,uriPromise:Promise.resolve(y.uri),chatSessionResource:this.context.element.sessionResource}),this._register(y.onDidChangeContent(O=>{try{h.rawInput=JSON.parse(y.getValue())}catch{}})),s.editor.append(P.object.element),b){let O=ct("div.see-more",[ct("a@link")]);O.link.textContent=d(7915,null),this._register(q$(O.link,()=>{try{let V=JSON.parse(y.getValue());y.setValue(JSON.stringify(V,null,2)),P.object.editor.updateOptions({tabFocusMode:!1}),P.object.editor.updateOptions({wordWrap:"on"})}catch{}O.root.remove()})),s.editor.append(O.root)}}let l=this._makeMarkdownPart(s.message,t,r),c=this._register(new C7(l.domNode,void 0)),u=()=>{let p=c.getHeight()>tin;s.messageContainer.classList.contains("can-see-more")!==p&&s.messageContainer.classList.toggle("can-see-more",p)};return this._register(j(s.showMore,"click",()=>{s.messageContainer.classList.toggle("can-see-more",!1),c.dispose()})),this._register(c.onDidChange(u)),c.startObserving(),o?this._makeMarkdownPart(s.disclaimer,o,r):s.disclaimer.remove(),s.root}}getTitle(){let e=this.toolInvocation.state.get();if(e.type!==Pi.StateKind.WaitingForConfirmation)return"";let t=e.confirmationMessages?.title;return t?typeof t=="string"?t:t.value:""}_makeMarkdownPart(e,t,o){let n=this._register(this.instantiationService.createInstance(KT,{kind:"markdownContent",content:typeof t=="string"?new Ie().appendMarkdown(t):t},this.context,this.editorPool,!1,this.codeBlockStartIndex,this.renderer,void 0,this.currentWidthDelegate(),this.codeBlockModelCollection,{codeBlockRenderOptions:o}));return $k(n.domNode,this.instantiationService,this.chatMarkdownAnchorService,this._store),e.append(n.domNode),n}};xge=I([m(7,F),m(8,_e),m(9,_t),m(10,X),m(11,Pt),m(12,ge),m(13,oa),m(14,Vn),m(15,Gv),m(16,_D)],xge);var tLi=le("IChatToolOutputStateCache"),Abo="chat/toolOutputStateCache",iin=100,Hot=class{constructor(i){this._cache=new dl(iin,.75);let e=i.get(Abo,1,"{}");this._deserialize(e);let t=U.filter(i.onWillSaveState,o=>o.reason===1);U.once(t)(()=>{i.store(Abo,this._serialize(),1,1)})}get(i){return this._cache.get(i)}set(i,e){this._cache.set(i,e)}_serialize(){let i=Object.create(null);for(let[e,t]of this._cache)i[e]=t;return JSON.stringify(i)}_deserialize(i){try{let e=JSON.parse(i);for(let t in e){let o=e[t];typeof o.webviewOrigin=="string"&&typeof o.height=="number"&&this._cache.set(t,o)}}catch{}}};Hot=I([m(0,ce)],Hot);Ee(tLi,Hot,1);var GOe=class extends qv{constructor(e,t,o,n,r,s,l){super(e);this.context=t;this.onDidRemount=o;this.chatOutputItemRendererService=n;this.chatWidgetService=r;this.instantiationService=s;this.stateCache=l;this.codeblocks=[];this._disposeCts=this._register(new Ye);let c=e.kind==="toolInvocation"?Pi.resultDetails(e):{output:{type:"data",mimeType:e.resultDetails.output.mimeType,value:qa(e.resultDetails.output.base64Data)}};if(this.domNode=_("div.tool-output-part"),e.invocationMessage){let u=_(".output-title");if(this.domNode.appendChild(u),typeof e.invocationMessage=="string")u.textContent=e.invocationMessage;else{let p=this._register(Gf(e.invocationMessage));u.appendChild(p.element)}}this.domNode.appendChild(this.createOutputPart(e,c))}dispose(){this._disposeCts.dispose(!0),super.dispose()}createOutputPart(e,t){let o=_("div.webview-output");o.style.maxHeight="80vh";let n=this.stateCache.get(e.toolCallId)??{height:0,webviewOrigin:xt()};this.stateCache.set(e.toolCallId,n),n.height&&(o.style.height=`${n.height}px`),n.webviewOrigin&&(n.webviewOrigin=n.webviewOrigin);let r=_("span");r.textContent=d(7919,null);let s=this._register(this.instantiationService.createInstance(uN,r,q.modify(R.loading,"spin"),void 0));return o.appendChild(s.domNode),this.chatOutputItemRendererService.renderOutputPart(t.output.mimeType,t.output.value.buffer,o,{origin:n.webviewOrigin,webviewState:n.webviewState},this._disposeCts.token).then(l=>{this._disposeCts.token.isCancellationRequested||(this._register(l),s.domNode.remove(),this._register(l.webview.onDidUpdateState(c=>{n.webviewState=c})),this._register(l.onDidChangeHeight(c=>{n.height=c})),this._register(l.webview.onDidWheel(c=>{this.chatWidgetService.getWidgetBySessionResource(this.context.element.sessionResource)?.delegateScrollFromMouseWheelEvent({...c,preventDefault:()=>{},stopPropagation:()=>{}})})),this._register(this.context.onDidChangeVisibility(c=>{c&&l.reinitialize()})),this._register(this.onDidRemount(()=>{l.reinitialize()})))},l=>{if(ao(l))return;console.error("Error rendering tool output:",l);let c=_(".output-error"),u=_(".output-error-header");M(c,u);let p=_("div");p.classList.add(...q.asClassNameArray(R.error)),u.append(p);let h=_(".output-error-title");h.textContent=d(7918,null),u.append(h);let g=_(".output-error-details");g.textContent=l?.message||String(l),c.append(g),s.domNode.replaceWith(c)}),o}};GOe=I([m(3,A_e),m(4,Pt),m(5,F),m(6,tLi)],GOe);var kge=class extends IW{constructor(e,t,o,n,r,s,l,c){super(e,t,o,n,r,s,l);this.confirmationService=c;this._codeblocks=[];let u=e.pastTenseMessage||e.invocationMessage;this.render({allowActionId:Dvo,skipActionId:Lvo,allowLabel:d(7927,null),skipLabel:d(7931,null),partType:"chatToolPostConfirmation",subtitle:typeof u=="string"?u:u?.value})}get codeblocks(){return this._codeblocks}createContentElement(){if(this.toolInvocation.kind!=="toolInvocation")throw new Error("post-approval not supported for serialized data");let e=this.toolInvocation.state.get();if(e.type!==Pi.StateKind.WaitingForPostApproval)throw new Error("Tool invocation is not waiting for post-approval");return this.createResultsDisplay(this.toolInvocation,e.contentForModel)}getTitle(){return d(7928,null)}additionalPrimaryActions(){let e=super.additionalPrimaryActions(),t=this.toolInvocation.state.get();if(t.type!==Pi.StateKind.WaitingForPostApproval)return e;let o=this.confirmationService.getPostConfirmActions({toolId:this.toolInvocation.toolId,source:this.toolInvocation.source,parameters:t.parameters});for(let n of o)n.divider&&e.push(new ri),e.push({label:n.label,tooltip:n.detail,scope:n.scope,data:async()=>{await n.select()&&this.confirmWith(this.toolInvocation,{type:4})}});return e}createResultsDisplay(e,t){let o=_(".tool-postconfirm-display");if(!t||t.length===0)return o.textContent=d(7930,null),o;let n=[];for(let[r,s]of t.entries())if(s.kind==="text")n.push({kind:"code",title:s.title,data:s.value,languageId:"plaintext",codeBlockIndex:r,ownerMarkdownPartId:this.codeblocksPartId,options:{hideToolbar:!0,reserveWidth:19,maxHeightInLines:13,verticalPadding:5,editorOptions:{wordWrap:"on",readOnly:!0}}});else if(s.kind==="promptTsx"){let l=z6e(s);n.push({kind:"code",data:l,languageId:"json",codeBlockIndex:r,ownerMarkdownPartId:this.codeblocksPartId,options:{hideToolbar:!0,reserveWidth:19,maxHeightInLines:13,verticalPadding:5,editorOptions:{wordWrap:"on",readOnly:!0}}})}else if(s.kind==="data"){let l=s.value.mimeType,c=s.value.data;if(l?.startsWith("image/")){let u=yP(l)?`image${yP(l)}`:"image.bin",p=CT.createUri(this.context.element.sessionResource,e.toolCallId,r,u);n.push({kind:"data",value:c.buffer,mimeType:l,uri:p,audience:s.audience})}else{let u=new TextDecoder("utf-8",{fatal:!0});try{let p=u.decode(c.buffer);n.push({kind:"code",data:p,languageId:"plaintext",codeBlockIndex:r,ownerMarkdownPartId:this.codeblocksPartId,options:{hideToolbar:!0,reserveWidth:19,maxHeightInLines:13,verticalPadding:5,editorOptions:{wordWrap:"on",readOnly:!0}}})}catch{let p=c.toString();n.push({kind:"code",data:p,languageId:"plaintext",codeBlockIndex:r,ownerMarkdownPartId:this.codeblocksPartId,options:{hideToolbar:!0,reserveWidth:19,maxHeightInLines:13,verticalPadding:5,editorOptions:{wordWrap:"on",readOnly:!0}}})}}}if(n.length>0){let r=this._register(this.instantiationService.createInstance(oQ,this.context,n));return this._codeblocks.push(...r.codeblocks),r.domNode.classList.add("tool-postconfirm-display"),r.domNode}return o.textContent=d(7929,null),o}};kge=I([m(2,F),m(3,_e),m(4,X),m(5,Pt),m(6,Vn),m(7,_D)],kge);var qOe=class extends qv{constructor(e,t,o,n,r,s){super(e);this.context=t;this.renderer=o;this.announcedToolProgressKeys=n;this.instantiationService=r;this.configurationService=s;this.codeblocks=[];this.domNode=this.createProgressPart()}createProgressPart(){if(Pi.isComplete(this.toolInvocation)&&this.toolIsConfirmed&&this.toolInvocation.pastTenseMessage){let t=this.getAnnouncementKey("complete"),o=this.toolInvocation.pastTenseMessage??this.toolInvocation.invocationMessage;if(!this.hasMeaningfulContent(o))return document.createElement("div");let n=this.toolInvocation.kind==="toolInvocation"&&this.hasMeaningfulContent(o)?this.computeShouldAnnounce(t):!1,r=this.renderProgressContent(o,n);return this._register(r),r.domNode}else{let t=document.createElement("div");return this._register(be(o=>{let n,r=this.getAnnouncementKey("progress");if(this.toolInvocation.kind==="toolInvocation"){let c=this.toolInvocation.state.read(o);c.type===Pi.StateKind.Cancelled&&c.reasonMessage?n=c.reasonMessage:c.type===Pi.StateKind.Executing?n=c.progress.read(o)?.message??this.toolInvocation.invocationMessage:n=this.toolInvocation.invocationMessage}else n=this.toolInvocation.invocationMessage;if(!this.hasMeaningfulContent(n)){Rt(t);return}let s=this.toolInvocation.kind==="toolInvocation"&&this.hasMeaningfulContent(n)?this.computeShouldAnnounce(r):!1,l=o.store.add(this.renderProgressContent(n,s));vi(t,l.domNode)})),t}}get toolIsConfirmed(){let e=Pi.executionConfirmedOrDenied(this.toolInvocation);return!!e&&e.type!==0}renderProgressContent(e,t){typeof e=="string"&&(e=new Ie().appendText(e));let o={kind:"progressMessage",content:e};return t&&this.provideScreenReaderStatus(e),this.instantiationService.createInstance(XD,o,this.renderer,this.context,void 0,!0,this.getIcon(),this.toolInvocation,yOe(this.toolInvocation))}getAnnouncementKey(e){return`${e}:${this.toolInvocation.toolCallId}`}computeShouldAnnounce(e){return!this.announcedToolProgressKeys||!this.configurationService.getValue("accessibility.verboseChatProgressUpdates")||this.announcedToolProgressKeys.has(e)?!1:(this.announcedToolProgressKeys.add(e),!0)}provideScreenReaderStatus(e){let t=typeof e=="string"?e:Nu(Da(e,{useLinkFormatter:!0}));qr(t)}hasMeaningfulContent(e){return e?(typeof e=="string"?e:e.value).trim().length>0:!1}};qOe=I([m(4,F),m(5,B)],qOe);var $Oe=class extends qv{constructor(e,t,o,n){super(e);this.context=t;this.renderer=o;this.instantiationService=n;this.codeblocks=[];this.domNode=this.createStreamingPart()}createStreamingPart(){let e=document.createElement("div");if(this.toolInvocation.kind!=="toolInvocation")return e;let t=this.toolInvocation;return t.state.get().type!==Pi.StateKind.Streaming||this._register(be(n=>{let r=t.state.read(n);if(r.type!==Pi.StateKind.Streaming){Rt(e),this._onNeedsRerender.fire();return}let l=r.streamingMessage.read(n)??t.invocationMessage,c=typeof l=="string"?l:l.value;if(!c||c.trim().length===0){Rt(e);return}let p={kind:"progressMessage",content:typeof l=="string"?new Ie().appendText(l):l},h=n.store.add(this.instantiationService.createInstance(XD,p,this.renderer,this.context,void 0,!0,this.getIcon(),t,!1));vi(e,h.domNode)})),e}};$Oe=I([m(3,F)],$Oe);var Rie=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this.toolInvocation=e;this.context=t;this.renderer=o;this.listPool=n;this.editorPool=r;this.currentWidthDelegate=s;this.codeBlockModelCollection=l;this.announcedToolProgressKeys=c;this.codeBlockStartIndex=u;this.instantiationService=p;this.chatTodoListService=h;this._onDidRemount=this._register(new E);if(this.domNode=_(".chat-tool-invocation-part"),e.presentation==="hidden")return;if(e.toolSpecificData?.kind==="todoList"){let S=t.element.sessionResource,y=e.toolSpecificData.todoList.map((w,k)=>{let T=parseInt(w.id,10);return{id:Number.isNaN(T)?k+1:T,title:w.title,status:w.status}});this.chatTodoListService.setTodos(S,y)}if(e.kind==="toolInvocation"){let S=e.state.get().type;this._register(be(y=>{e.state.read(y).type!==S&&v()}))}let g=this._register(new N),f=document.createElement("div");this.domNode.appendChild(f);let v=()=>{if(g.clear(),e.presentation==="hiddenAfterComplete"&&Pi.isComplete(e)){vo(this.domNode);return}un(this.domNode),this.subPart=g.add(this.createToolInvocationSubPart()),f.replaceWith(this.subPart.domNode),f=this.subPart.domNode;let S=this.subPart instanceof xge||this.subPart instanceof wge||this.subPart instanceof yge||this.subPart instanceof Ige||this.subPart instanceof fge||this.subPart instanceof kge;this.domNode.classList.toggle("has-confirmation",S),g.add(this.subPart.onNeedsRerender(v))},b=this.getMcpAppRenderData();if(b){let S=ke(w=>{let k=Pi.executionConfirmedOrDenied(e,w);return!!k&&k.type!==0&&k.type!==5}),y=document.createElement("div");this.domNode.appendChild(y),this._register(be(w=>{S.read(w)?(this.mcpAppPart=w.store.add(this.instantiationService.createInstance(WOe,this.toolInvocation,this._onDidRemount.event,t,b)),y.replaceWith(this.mcpAppPart.domNode),y=this.mcpAppPart.domNode):(this.mcpAppPart=void 0,Rt(y))}))}v()}get codeblocks(){let e=this.subPart?.codeblocks??[];return this.mcpAppPart&&e.push(...this.mcpAppPart.codeblocks),e}get codeblocksPartId(){return this.subPart?.codeblocksPartId}createToolInvocationSubPart(){if(this.toolInvocation.kind==="toolInvocation"){if(this.toolInvocation.toolSpecificData?.kind==="extensions")return this.instantiationService.createInstance(fge,this.toolInvocation,this.context);let t=this.toolInvocation.state.get();if(t.type===Pi.StateKind.Streaming)return this.instantiationService.createInstance($Oe,this.toolInvocation,this.context,this.renderer);if(t.type===Pi.StateKind.WaitingForConfirmation)return this.toolInvocation.toolSpecificData?.kind==="terminal"&&!rTe(this.toolInvocation.toolSpecificData)&&this.toolInvocation.toolSpecificData.missingSandboxDependencies?.length?this.instantiationService.createInstance(Ige,this.toolInvocation,this.toolInvocation.toolSpecificData,this.context,this.renderer):this.toolInvocation.toolSpecificData?.kind==="terminal"?this.instantiationService.createInstance(wge,this.toolInvocation,this.toolInvocation.toolSpecificData,this.context,this.renderer,this.editorPool,this.currentWidthDelegate,this.codeBlockModelCollection,this.codeBlockStartIndex):this.toolInvocation.toolSpecificData?.kind==="modifiedFilesConfirmation"?this.instantiationService.createInstance(yge,this.toolInvocation,this.context,this.listPool):this.instantiationService.createInstance(xge,this.toolInvocation,this.context,this.renderer,this.editorPool,this.currentWidthDelegate,this.codeBlockModelCollection,this.codeBlockStartIndex);if(t.type===Pi.StateKind.WaitingForPostApproval)return this.instantiationService.createInstance(kge,this.toolInvocation,this.context)}if(this.toolInvocation.toolSpecificData?.kind==="terminal")return this.instantiationService.createInstance(KOe,this.toolInvocation,this.toolInvocation.toolSpecificData,this.context,this.renderer,this.editorPool,this.currentWidthDelegate,this.codeBlockStartIndex,this.codeBlockModelCollection);if(this.toolInvocation.toolSpecificData?.kind==="resources"&&this.toolInvocation.toolSpecificData.values.length>0)return this.instantiationService.createInstance(Sge,this.toolInvocation,this.context,this.toolInvocation.pastTenseMessage??this.toolInvocation.invocationMessage,this.toolInvocation.toolSpecificData.values,this.listPool);if(this.toolInvocation.toolSpecificData?.kind==="simpleToolInvocation")return this.instantiationService.createInstance(rQ,this.toolInvocation,this.context,this.codeBlockStartIndex,this.toolInvocation.pastTenseMessage??this.toolInvocation.invocationMessage,this.toolInvocation.originMessage,this.toolInvocation.toolSpecificData,!1);let e=Pi.resultDetails(this.toolInvocation);return Array.isArray(e)&&e.length?this.instantiationService.createInstance(Sge,this.toolInvocation,this.context,this.toolInvocation.pastTenseMessage??this.toolInvocation.invocationMessage,e,this.listPool):_B(e)?this.instantiationService.createInstance(GOe,this.toolInvocation,this.context,this._onDidRemount.event):cD(e)?this.instantiationService.createInstance(VG,this.toolInvocation,this.context,this.codeBlockStartIndex,this.toolInvocation.pastTenseMessage??this.toolInvocation.invocationMessage,this.toolInvocation.originMessage,e.input,e.inputLanguage,e.output,!!e.isError):this.toolInvocation.kind==="toolInvocation"&&this.toolInvocation.toolSpecificData?.kind==="input"&&!Pi.isComplete(this.toolInvocation)?this.instantiationService.createInstance(VG,this.toolInvocation,this.context,this.codeBlockStartIndex,this.toolInvocation.invocationMessage,this.toolInvocation.originMessage,typeof this.toolInvocation.toolSpecificData.rawInput=="string"?this.toolInvocation.toolSpecificData.rawInput:JSON.stringify(this.toolInvocation.toolSpecificData.rawInput,null,2),void 0,void 0,!1):this.instantiationService.createInstance(qOe,this.toolInvocation,this.context,this.renderer,this.announcedToolProgressKeys)}getMcpAppRenderData(){let e=this.toolInvocation.toolSpecificData;if(e?.kind==="input"&&e.mcpAppData){let t=typeof e.rawInput=="string"?e.rawInput:JSON.stringify(e.rawInput,null,2);return{resourceUri:e.mcpAppData.resourceUri,serverDefinitionId:e.mcpAppData.serverDefinitionId,collectionId:e.mcpAppData.collectionId,input:t,sessionResource:this.context.element.sessionResource}}}onDidRemount(){this._onDidRemount.fire()}hasSameContent(e,t,o){return(e.kind==="toolInvocation"||e.kind==="toolInvocationSerialized")&&this.toolInvocation.toolCallId===e.toolCallId}addDisposable(e){this._register(e)}};Rie=I([m(9,F),m(10,h0)],Rie);var CKt=100,DM=class extends UT{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){let{description:v,agentName:b,prompt:S,modelName:y}=DM.extractSubagentInfo(t),k=`${b||d(7770,null)}: ${v}`;super(k,o,void 0,g,f);this.subAgentInvocationId=e;this.context=o;this.chatContentMarkdownRenderer=n;this.listPool=r;this.editorPool=s;this.currentWidthDelegate=l;this.codeBlockModelCollection=c;this.announcedToolProgressKeys=u;this.instantiationService=p;this.chatMarkdownAnchorService=h;this.isActive=!0;this.hasToolItems=!1;this.lazyItems=[];this.hasExpandedOnce=!1;this.pendingPromptRender=!1;this._hoverDisposable=this._register(new me);this.toolsWaitingForConfirmation=0;this.userManuallyExpanded=!1;this.autoExpandedForConfirmation=!1;this._titleDetailRendered=this._register(new me);this.description=v,this.agentName=b,this.prompt=S,this.modelName=y,this.isInitiallyComplete=this.element.isComplete;let T=this.domNode;if(T.classList.add("chat-thinking-box","chat-thinking-fixed-mode","chat-subagent-part"),this.element.isComplete||T.classList.add("chat-thinking-active"),!this.element.isComplete&&this._collapseButton){let P=this._collapseButton.labelElement;P.textContent="",this.titleShimmerSpan=_("span.chat-thinking-title-shimmer"),this.titleShimmerSpan.textContent=k,P.appendChild(this.titleShimmerSpan)}this._collapseButton&&!this.element.isComplete&&(this._collapseButton.icon=R.circleFilled),this._register(be(P=>{this.expanded.read(P),this._collapseButton&&(!this.element.isComplete&&this.isActive?this._collapseButton.icon=R.circleFilled:this._collapseButton.icon=R.check)})),this._register(be(P=>{this._isExpanded.read(P)&&!this.hasExpandedOnce&&(this.hasExpandedOnce=!0,this.materializePendingContent())})),this.setExpanded(!1),this._register(be(P=>{this._isExpanded.read(P)?this.autoExpandedForConfirmation||(this.userManuallyExpanded=!0):(this.autoExpandedForConfirmation&&(this.autoExpandedForConfirmation=!1),this.userManuallyExpanded&&(this.userManuallyExpanded=!1))})),this.layoutScheduler=this._register(new Igt(this.domNode,()=>this.performLayout())),this.updateHover(),this.renderPromptSection(),this.watchToolCompletion(t)}static isParentSubagentTool(e){return e.toolSpecificData?.kind==="subagent"&&!e.subAgentInvocationId}static extractSubagentInfo(e){let t=d(7768,null);if(!DM.isParentSubagentTool(e))return{description:t,agentName:void 0,prompt:void 0,modelName:void 0};if(e.toolSpecificData?.kind==="subagent")return{description:e.toolSpecificData.description??t,agentName:e.toolSpecificData.agentName,prompt:e.toolSpecificData.prompt,modelName:e.toolSpecificData.modelName};if(e.kind==="toolInvocation"){let o=e.state.get(),n=o.type!==Pi.StateKind.Streaming?o.parameters:void 0;return{description:n?.description??t,agentName:n?.agentName,prompt:n?.prompt,modelName:void 0}}return{description:t,agentName:void 0,prompt:void 0,modelName:void 0}}initContent(){this.wrapper=_(".chat-used-context-list.chat-thinking-collapsible"),this.hasToolItems||(this.wrapper.style.display="none"),this.materializePendingContent();let e=this._register(new WL(()=>this.layoutScheduler.schedule()));return this._register(e.observe(this.wrapper)),this.wrapper}renderPromptSection(){if(!(!this.prompt||this.promptContainer)){if(!this.wrapper||this.isInitiallyComplete&&!this.isExpanded()&&!this.hasExpandedOnce){this.pendingPromptRender=!0;return}this.pendingPromptRender=!1,this.doRenderPromptSection()}}doRenderPromptSection(){if(!this.prompt||this.promptContainer)return;let e=this.prompt.split(`
`),t=e[0]||d(7771,null),o=e.slice(1).join(`
`).trim(),n=GXt(t,CKt),s=t.length>CKt?n+"\u2026":n,l=t.length>n.length?t.slice(n.length).trim():"",c=l?l+(o?`
`+o:""):o||this.prompt,u=this._register(this.instantiationService.createInstance(gge,s,c,this.context,this.chatContentMarkdownRenderer));this.promptContainer=_(".chat-thinking-tool-wrapper.chat-subagent-section");let p=tQ(R.comment);this.promptContainer.appendChild(p),this.promptContainer.appendChild(u.domNode),this.wrapper&&(this.wrapper.firstChild?this.wrapper.insertBefore(this.promptContainer,this.wrapper.firstChild):M(this.wrapper,this.promptContainer),this.wrapper.style.display==="none"&&(this.wrapper.style.display=""))}getIsActive(){return this.isActive}markAsInactive(){this.isActive=!1,this.domNode.classList.remove("chat-thinking-active"),this._collapseButton&&(this._collapseButton.icon=R.check),this.finalizeTitle(),this.setExpanded(!1)}finalizeTitle(){this.updateTitle(),this._collapseButton&&(this._collapseButton.icon=R.check)}updateTitle(){let e=this.agentName||d(7770,null),t=`${e}: ${this.description}`,o=this.currentRunningToolMessage&&this.isActive?` \u2014 ${this.currentRunningToolMessage}`:"";if(!this._collapseButton)return;let n=this._collapseButton.labelElement;if(!this.isActive){n.textContent="",this.titleShimmerSpan=void 0,this._titleDetailRendered.clear(),this.titleDetailContainer=void 0;let s=_("span");s.textContent=`${e}:`,n.appendChild(s);let l=_("span.chat-thinking-title-detail-text");l.textContent=` ${this.description}`,n.appendChild(l),this._collapseButton.element.ariaLabel=t,this._collapseButton.element.ariaExpanded=String(this.isExpanded());return}if((!this.titleShimmerSpan||!this.titleShimmerSpan.parentElement)&&(n.textContent="",this.titleShimmerSpan=_("span.chat-thinking-title-shimmer"),n.appendChild(this.titleShimmerSpan)),this.titleShimmerSpan.textContent=t,this._titleDetailRendered.clear(),!o)this.titleDetailContainer&&(this.titleDetailContainer.remove(),this.titleDetailContainer=void 0);else{let s=this.chatContentMarkdownRenderer.render(new Ie(o));s.element.classList.add("collapsible-title-content","chat-thinking-title-detail"),$k(s.element,this.instantiationService,this.chatMarkdownAnchorService,this._store),this._titleDetailRendered.value=s,this.titleDetailContainer?this.titleDetailContainer.replaceWith(s.element):n.appendChild(s.element),this.titleDetailContainer=s.element}let r=`${t}${o}`;this._collapseButton.element.ariaLabel=r,this._collapseButton.element.ariaExpanded=String(this.isExpanded())}updateHover(){!this.modelName||!this._collapseButton||(this._hoverDisposable.value=this.hoverService.setupDelayedHover(this._collapseButton.element,{content:d(7769,null,this.modelName)}))}trackToolState(e){if(e.kind!=="toolInvocation")return;let t=e.invocationMessage,o=typeof t=="string"?t:t.value;this.currentRunningToolMessage=o,this.updateTitle();let n=!1;this._register(be(r=>{let s=e.state.read(r),l=s.type===Pi.StateKind.WaitingForConfirmation||s.type===Pi.StateKind.WaitingForPostApproval;l&&!n?(this.toolsWaitingForConfirmation++,this.isExpanded()||(this.autoExpandedForConfirmation=!0,this.setExpanded(!0))):!l&&n&&(this.toolsWaitingForConfirmation--,this.toolsWaitingForConfirmation===0&&this.autoExpandedForConfirmation&&!this.userManuallyExpanded&&(this.autoExpandedForConfirmation=!1,this.setExpanded(!1))),n=l}))}watchToolCompletion(e){if(DM.isParentSubagentTool(e))if(e.kind==="toolInvocation"){let t=e.state.get().type===Pi.StateKind.Streaming;this._register(be(o=>{let n=e.state.read(o);if(n.type===Pi.StateKind.Completed){t=!1;let r=(n.contentForModel||[]).filter(s=>s.kind==="text").map(s=>s.value);r.length>0&&this.renderResultText(r.join(`
`)),e.toolSpecificData?.kind==="subagent"&&e.toolSpecificData.modelName&&(this.modelName=e.toolSpecificData.modelName,this.updateHover()),this.markAsInactive()}else if(t&&n.type!==Pi.StateKind.Streaming){t=!1;let{description:r,agentName:s,prompt:l,modelName:c}=DM.extractSubagentInfo(e);this.description=r,this.agentName=s,this.prompt=l,c&&(this.modelName=c,this.updateHover()),this.renderPromptSection(),this.updateTitle()}}))}else e.toolSpecificData?.kind==="subagent"&&e.toolSpecificData.result&&(this.renderResultText(e.toolSpecificData.result),this.markAsInactive())}renderResultText(e){if(!(this.resultContainer||!e)){if(!this.wrapper||this.isInitiallyComplete&&!this.isExpanded()&&!this.hasExpandedOnce){this.pendingResultText=e;return}this.pendingResultText=void 0,this.doRenderResultText(e)}}doRenderResultText(e){if(this.resultContainer||!e)return;let t=e.split(`
`),o=t[0]||"",n=t.slice(1).join(`
`).trim(),r=GXt(o,CKt),l=o.length>CKt?r+"\u2026":r,c=o.length>r.length?o.slice(r.length).trim():"",u=c?c+(n?`
`+n:""):n,p=this._register(this.instantiationService.createInstance(gge,l,u,this.context,this.chatContentMarkdownRenderer));this.resultContainer=_(".chat-thinking-tool-wrapper.chat-subagent-section");let h=tQ(R.check);this.resultContainer.appendChild(h),this.resultContainer.appendChild(p.domNode),this.wrapper&&(M(this.wrapper,this.resultContainer),this.wrapper.style.display==="none"&&(this.wrapper.style.display=""))}appendToolInvocation(e,t){if(this.hasToolItems||(this.hasToolItems=!0,this.wrapper&&(this.wrapper.style.display="")),this.trackToolState(e),this.isExpanded()||this.hasExpandedOnce){let o=this.createToolPart(e,t);this.appendToolPartToDOM(o,e)}else{let o={kind:"tool",lazy:new co(()=>this.createToolPart(e,t)),toolInvocation:e,codeBlockStartIndex:t};this.lazyItems.push(o)}}appendMarkdownItem(e,t,o,n){if(this.isExpanded()||this.hasExpandedOnce){let r=e();this.appendMarkdownItemToDOM(r.domNode),r.disposable&&this._register(r.disposable)}else{let r={kind:"markdown",lazy:new co(e)};this.lazyItems.push(r)}}appendHookItem(e,t){let o=t.stopReason?t.toolDisplayName?d(7772,null,t.toolDisplayName):d(7773,null):t.toolDisplayName?d(7774,null,t.toolDisplayName):d(7775,null);if(this.currentRunningToolMessage=o,this.updateTitle(),this.isExpanded()||this.hasExpandedOnce){let n=e();this.appendHookItemToDOM(n.domNode,t),n.disposable&&this._register(n.disposable)}else{let n={kind:"hook",lazy:new co(e),hookPart:t};this.lazyItems.push(n)}}appendHookItemToDOM(e,t){let o=_(".chat-thinking-tool-wrapper"),n=t.stopReason?R.error:R.warning,r=tQ(n);o.appendChild(r),o.appendChild(e),this.hasToolItems||(this.hasToolItems=!0,this.wrapper&&(this.wrapper.style.display="")),this.wrapper&&(this.resultContainer?this.wrapper.insertBefore(o,this.resultContainer):this.wrapper.appendChild(o)),this.lastItemWrapper=o,this.layoutScheduler.schedule()}appendMarkdownItemToDOM(e){if(!e.hasChildNodes()||e.textContent?.trim()==="")return;let t=_(".chat-thinking-tool-wrapper"),o=tQ(R.edit);t.appendChild(e),t.insertBefore(o,t.firstChild),this.wrapper&&(this.resultContainer?this.wrapper.insertBefore(t,this.resultContainer):this.wrapper.appendChild(t)),this.lastItemWrapper=t,this.layoutScheduler.schedule()}shouldInitEarly(){return!1}createToolPart(e,t){let o=this.instantiationService.createInstance(Rie,e,this.context,this.chatContentMarkdownRenderer,this.listPool,this.editorPool,this.currentWidthDelegate,this.codeBlockModelCollection,this.announcedToolProgressKeys,t);return this._register(o),o}appendToolPartToDOM(e,t){let o=e.domNode;if(!o.hasChildNodes()||o.textContent?.trim()==="")return;let n=_(".chat-thinking-tool-wrapper"),r=HDi(t.toolId,t.icon),s=tQ(r);n.appendChild(o),t.kind==="toolInvocation"?this._register(be(l=>{let c=t.state.read(l);c.type===Pi.StateKind.WaitingForConfirmation||c.type===Pi.StateKind.WaitingForPostApproval?s.remove():s.parentElement||n.insertBefore(s,n.firstChild)})):n.insertBefore(s,n.firstChild),this.wrapper&&(this.resultContainer?this.wrapper.insertBefore(n,this.resultContainer):this.wrapper.appendChild(n)),this.lastItemWrapper=n,this.layoutScheduler.schedule()}materializeLazyItem(e){if(!e.lazy.hasValue){if(e.kind==="tool"){let t=e.lazy.value;this.appendToolPartToDOM(t,e.toolInvocation)}else if(e.kind==="markdown"){let t=e.lazy.value;this.appendMarkdownItemToDOM(t.domNode),t.disposable&&this._register(t.disposable)}else if(e.kind==="hook"){let t=e.lazy.value;this.appendHookItemToDOM(t.domNode,e.hookPart),t.disposable&&this._register(t.disposable)}}}materializePendingContent(){if(this.wrapper){this.pendingPromptRender&&(this.pendingPromptRender=!1,this.doRenderPromptSection());for(let e of this.lazyItems)this.materializeLazyItem(e);if(this.pendingResultText){let e=this.pendingResultText;this.pendingResultText=void 0,this.doRenderResultText(e)}}}performLayout(){if(this.lastItemWrapper&&this.wrapper){let e=this.lastItemWrapper.offsetHeight;e>0&&this.wrapper.style.setProperty("--chat-subagent-last-item-height",`${e}px`)}if(this.isActive&&!this.isInitiallyComplete&&this.wrapper){let e=this.wrapper.scrollHeight;this.wrapper.scrollTop=e}}hasSameContent(e,t,o){if(e.kind==="markdownContent")return!0;if(e.kind==="hook"&&e.subAgentInvocationId)return this.subAgentInvocationId===e.subAgentInvocationId;if((e.kind==="toolInvocation"||e.kind==="toolInvocationSerialized")&&(e.subAgentInvocationId||DM.isParentSubagentTool(e))){let n=e.subAgentInvocationId??e.toolCallId;return this.subAgentInvocationId&&n?this.subAgentInvocationId===n:!this.subAgentInvocationId&&!n}return!1}};DM=I([m(9,F),m(10,Gv),m(11,nt),m(12,B)],DM);var oin=_,Ege=class extends x{constructor(e,t,o){super();this.openerService=o;let n=this._register(t.get());this.tree=n.object,this.onDidFocus=this.tree.onDidFocus,this._register(this.tree.onDidOpen(r=>{r.element&&!("children"in r.element)&&this.openerService.open(r.element.uri)})),this._register(this.tree.onContextMenu(r=>{r.browserEvent.preventDefault(),r.browserEvent.stopPropagation()})),this.tree.setInput(e).then(()=>{n.isStale()||this.tree.layout()}),this.domNode=this.tree.getHTMLElement().parentElement}domFocus(){this.tree.domFocus()}hasSameContent(e){return e.kind==="treeData"}addDisposable(e){this._register(e)}};Ege=I([m(2,Je)],Ege);var jOe=class extends x{constructor(e,t,o,n){super();this._onDidChangeVisibility=e;this.instantiationService=t;this.configService=o;this.themeService=n;this._pool=this._register(new XH(()=>this.treeFactory()))}get inUse(){return this._pool.inUse}treeFactory(){let e=new N,t=e.add(this.instantiationService.createInstance(Nl,{onDidChangeVisibility:this._onDidChangeVisibility})),o=oin(".interactive-response-progress-tree");return e.add(Q8(o,this.themeService)),{tree:this.instantiationService.createInstance(sy,"ChatListRenderer",o,new iLi,new oLi,[new nLi(t,this.configService.getValue("explorer.decorations"))],new rLi,{collapseByDefault:()=>!1,expandOnlyOnTwistieClick:()=>!1,identityProvider:{getId:r=>r.uri.toString()},accessibilityProvider:{getAriaLabel:r=>r.label,getWidgetAriaLabel:()=>d(7837,null)},alwaysConsumeMouseWheel:!1}),dispose:()=>e.dispose()}}get(){let e=this._pool.get(),t=!1;return{object:e.tree,isStale:()=>t,dispose:()=>{t=!0,this._pool.release(e)}}}clear(){this._pool.clear()}};jOe=I([m(1,F),m(2,B),m(3,Le)],jOe);var iLi=class a{static{this.ITEM_HEIGHT=22}getHeight(i){return a.ITEM_HEIGHT}getTemplateId(i){return"chatListTreeTemplate"}},oLi=class{isIncompressible(i){return!i.children}},nLi=class{constructor(i,e){this.labels=i;this.decorations=e;this.templateId="chatListTreeTemplate"}renderCompressedElements(i,e,t){t.label.element.style.display="flex";let o=i.element.elements.map(n=>n.label);t.label.setResource({resource:i.element.elements[0].uri,name:o},{title:i.element.elements[0].label,fileKind:i.children?1:0,extraClasses:["explorer-item"],fileDecorations:this.decorations})}renderTemplate(i){let e=new N,t=e.add(this.labels.create(i,{supportHighlights:!0}));return{templateDisposables:e,label:t}}renderElement(i,e,t){t.label.element.style.display="flex",!i.children.length&&i.element.type!==2?t.label.setFile(i.element.uri,{fileKind:0,hidePath:!0,fileDecorations:this.decorations}):t.label.setResource({resource:i.element.uri,name:i.element.label},{title:i.element.label,fileKind:1,fileDecorations:this.decorations})}disposeTemplate(i){i.templateDisposables.dispose()}},rLi=class{hasChildren(i){return!!i.children}async getChildren(i){return i.children??[]}};var QOe=class extends x{constructor(e,t,o,n,r,s){super();this.workspaceEdit=e;this.instantiationService=n;this.chatMarkdownAnchorService=r;this.labelService=s;this.domNode=_(".chat-workspace-edit-content-part");let l=(c,u)=>{let p=this._register(o.render(new Ie(c,{isTrusted:!0})));p.element.classList.add("progress-step"),$k(p.element,this.instantiationService,this.chatMarkdownAnchorService,this._store);let h=this._register(this.instantiationService.createInstance(uN,p.element,u,void 0));M(this.domNode,h.domNode)};for(let c of e.edits)c.oldResource&&!c.newResource?l(d(7839,null,this.labelService.getUriBasenameLabel(c.oldResource)),R.trash):!c.oldResource&&c.newResource?l(d(7838,null,c.newResource.toString()),R.newFile):c.oldResource&&c.newResource&&l(d(7840,null,this.labelService.getUriBasenameLabel(c.oldResource),c.newResource.toString()),R.arrowRight)}hasSameContent(e,t,o){if(e.kind!=="workspaceEdit"||e.edits.length!==this.workspaceEdit.edits.length)return!1;for(let n=0;n<e.edits.length;n++){let r=e.edits[n],s=this.workspaceEdit.edits[n];if(r.oldResource?.toString()!==s.oldResource?.toString()||r.newResource?.toString()!==s.newResource?.toString())return!1}return!0}};QOe=I([m(3,F),m(4,Gv),m(5,rt)],QOe);function nin(a){return XC[a]?.label??a}var Mie=class extends UT{constructor(e,t,o,n){let r=nin(e.hookType),s=!!e.stopReason,l=!!e.systemMessage,c=e.toolDisplayName,u=s?c?d(7677,null,c,r):d(7676,null,r):c?d(7679,null,c,r):d(7678,null,r);super(u,t,void 0,o,n);this.hookPart=e;this.icon=s?R.error:l?R.warning:R.check,s?this.domNode.classList.add("chat-hook-outcome-blocked"):l&&this.domNode.classList.add("chat-hook-outcome-warning"),this.setExpanded(!1)}initContent(){let e=_(".chat-hook-details.chat-used-context-list");if(this.hookPart.stopReason){let o=_(".chat-hook-reason",void 0,this.hookPart.stopReason);e.appendChild(o)}let t=this.hookPart.hookType==="PreToolUse"||this.hookPart.hookType==="PostToolUse";if(this.hookPart.systemMessage&&(t||!this.hookPart.stopReason)){let o=_(".chat-hook-message",void 0,this.hookPart.systemMessage);e.appendChild(o)}return e}hasSameContent(e,t,o){return e.kind!=="hook"?!1:e.hookType===this.hookPart.hookType&&e.stopReason===this.hookPart.stopReason&&e.systemMessage===this.hookPart.systemMessage&&e.toolDisplayName===this.hookPart.toolDisplayName}};Mie=I([m(2,nt),m(3,B)],Mie);var Lf=_,Nbo="GitHub Copilot",rin=50,sin=!1,ain="chat-most-recent-response";function lin(a){switch(a){case"confetti":return 1;case"floatingThumbs":return 2;case"pulseWave":return 3;case"radiantLines":return 4;default:return}}var aQ=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k){super();this.rendererOptions=t;this.delegate=o;this.codeBlockModelCollection=n;this.viewModel=s;this.instantiationService=l;this.configService=c;this.logService=u;this.contextKeyService=p;this.themeService=h;this.commandService=g;this.hoverService=f;this.chatWidgetService=v;this.chatEntitlementService=b;this.chatService=S;this.accessibilitySignalService=y;this.accessibilityService=w;this.environmentService=k;this.codeBlocksByResponseId=new Map;this.codeBlocksByEditorUri=new gt;this.fileTreesByResponseId=new Map;this.focusedFileTreesByResponseId=new Map;this.templateDataByRequestId=new Map;this.responseTemplateDataByRequestId=new Map;this.pendingQuestionCarousels=new gt;this._notifiedQuestionCarousels=new Set;this._onDidClickFollowup=this._register(new E);this.onDidClickFollowup=this._onDidClickFollowup.event;this._onDidClickRerunWithAgentOrCommandDetection=this._register(new E);this.onDidClickRerunWithAgentOrCommandDetection=this._onDidClickRerunWithAgentOrCommandDetection.event;this._onDidClickRequest=this._register(new E);this.onDidClickRequest=this._onDidClickRequest.event;this._onDidRerender=this._register(new E);this.onDidRerender=this._onDidRerender.event;this._onDidDispose=this._register(new E);this.onDidDispose=this._onDidDispose.event;this._onDidFocusOutside=this._register(new E);this.onDidFocusOutside=this._onDidFocusOutside.event;this._onDidChangeItemHeight=this._register(new E);this.onDidChangeItemHeight=this._onDidChangeItemHeight.event;this._onDidUpdateViewModel=this._register(new E);this._currentLayoutWidth=Me(this,0);this._isVisible=!0;this._onDidChangeVisibility=this._register(new E);this._announcedToolProgressKeys=new Set;this.chatContentMarkdownRenderer=this.instantiationService.createInstance(gie),this.markdownDecorationsRenderer=this.instantiationService.createInstance(Sie),this._editorPool=this._register(this.instantiationService.createInstance(uge,e,o,r,!1)),this._toolEditorPool=this._register(this.instantiationService.createInstance(uge,e,o,r,!0)),this._diffEditorPool=this._register(this.instantiationService.createInstance(fOe,e,o,r,!1)),this._treePool=this._register(this.instantiationService.createInstance(jOe,this._onDidChangeVisibility.event)),this._contentReferencesListPool=this._register(this.instantiationService.createInstance(mie,this._onDidChangeVisibility.event,void 0,void 0)),this._register(this.instantiationService.createInstance(JNe)),this._inlineTextModels=this._register(this.instantiationService.createInstance(vOe)),this._toolInvocationCodeBlockCollection=this._register(this.instantiationService.createInstance(sW,"tools")),this._register(this.chatService.onDidSubmitRequest(T=>{let P=this.pendingQuestionCarousels.get(T.chatSessionResource);if(P){for(let O of P)O.skip();P.clear()}})),this._register(this.configService.onDidChangeConfiguration(T=>{if(T.affectsConfiguration("chat.autoReply")&&this.configService.getValue("chat.autoReply"))for(let[,P]of this.pendingQuestionCarousels){for(let O of P)O.skip();P.clear()}}))}static{this.ID="item"}set pendingDragController(e){this._pendingDragController=e}updateOptions(e){this.rendererOptions={...this.rendererOptions,...e}}get templateId(){return aQ.ID}editorsInUse(){return vt.concat(this._editorPool.inUse(),this._toolEditorPool.inUse())}traceLayout(e,t){sin?this.logService.info(`ChatListItemRenderer#${e}: ${t}`):this.logService.trace(`ChatListItemRenderer#${e}: ${t}`)}fireItemHeightChange(e,t){if(!e.currentElement||!e.rowContainer.isConnected)return;let o=t??e.rowContainer.getBoundingClientRect().height;if(o===0||!o)return;let n=Math.ceil(o);e.currentElement.currentRenderedHeight=n,e.currentElement!==this._elementBeingRendered&&this._onDidChangeItemHeight.fire({element:e.currentElement,height:n})}getProgressiveRenderRate(e){let t;(l=>(l[l.Min=40]="Min",l[l.Max=2e3]="Max"))(t||={});let o=80,n=e.contentUpdateTimings?.impliedWordLoadRate;return e.isComplete?typeof n=="number"?Bn(n,80,2e3):80:typeof n=="number"?Bn(n,40,2e3):8}getCodeBlockInfosForResponse(e){return this.codeBlocksByResponseId.get(e.id)??[]}updateViewModel(e){this.viewModel=e,this._announcedToolProgressKeys.clear(),this._notifiedQuestionCarousels.clear(),this.codeBlocksByEditorUri.clear(),this.codeBlocksByResponseId.clear(),this.fileTreesByResponseId.clear(),this.focusedFileTreesByResponseId.clear(),this.responseTemplateDataByRequestId.clear(),this._editorPool.clear(),this._toolEditorPool.clear(),this._diffEditorPool.clear(),this._treePool.clear(),this._contentReferencesListPool.clear(),this._onDidUpdateViewModel.fire()}getCodeBlockInfoForEditor(e){return this.codeBlocksByEditorUri.get(e)}getFileTreeInfosForResponse(e){return this.fileTreesByResponseId.get(e.id)??[]}getLastFocusedFileTreeForResponse(e){let t=this.fileTreesByResponseId.get(e.id),o=this.focusedFileTreesByResponseId.get(e.id);if(t?.length&&o!==void 0&&o<t.length)return t[o]}getTemplateDataForRequestId(e){if(!e)return;let t=this.templateDataByRequestId.get(e);if(t&&t.currentElement?.id===e)return t;t&&this.templateDataByRequestId.delete(e)}setVisible(e){this._isVisible=e,this._onDidChangeVisibility.fire(e)}layout(e){let t=e-40;if(t!==this._currentLayoutWidth.get()){this._currentLayoutWidth.set(t,void 0);for(let o of this._editorPool.inUse())o.layout(t);for(let o of this._toolEditorPool.inUse())o.layout(t);for(let o of this._diffEditorPool.inUse())o.layout(t)}}renderTemplate(e){let t=new N,o=M(e,Lf(".chat-row-disabled-overlay")),n=M(e,Lf(".interactive-item-container"));this.rendererOptions.renderStyle==="compact"&&n.classList.add("interactive-item-compact");let r=n,s=n,l;if(this.rendererOptions.renderStyle==="minimal"){n.classList.add("interactive-item-compact"),n.classList.add("minimal");let De=M(n,Lf(".column.left")),Oe=M(n,Lf(".column.right"));r=De,l=Oe,s=Oe}let c=M(r,Lf(".header")),u=t.add(this.contextKeyService.createScoped(n)),p=t.add(this.instantiationService.createChild(new _o([X,u]))),h=M(n,Lf(".request-hover")),g;this.rendererOptions.noHeader?c.classList.add("hidden"):g=t.add(p.createInstance(or,h,D.ChatMessageTitle,{menuOptions:{shouldForwardArgs:!0},toolbarOptions:{shouldInlineSubmenu:De=>De.actions.length<=1}})),this.hoverHidden(h);let f=M(n,Lf(".checkpoint-container"));M(f,Lf(".checkpoint-line-left"));let v=t.add(p.createInstance(or,f,D.ChatMessageCheckpoint,{actionViewItemProvider:(De,Oe)=>{if(De instanceof Lo)return this.instantiationService.createInstance(xM,De,{hoverDelegate:Oe.hoverDelegate})},renderDropdownAsChildElement:!0,menuOptions:{shouldForwardArgs:!0},toolbarOptions:{shouldInlineSubmenu:De=>De.actions.length<=1}}));M(f,Lf(".checkpoint-line-right"));let b=M(c,Lf(".user")),S=M(b,Lf(".avatar-container")),y=M(b,Lf("h3.username"));y.tabIndex=0;let w=M(l??b,Lf("span.detail-container")),k=M(w,Lf("span.detail"));M(w,Lf("span.chat-animated-ellipsis"));let T=M(s,Lf(".value")),P=t.add(new N),O=M(n,Lf(".chat-footer-toolbar"));this.rendererOptions.noFooter&&O.classList.add("hidden");let V=t.add(p.createInstance(or,O,D.ChatMessageFooter,{menuOptions:{shouldForwardArgs:!0,renderShortTitle:!0},toolbarOptions:{shouldInlineSubmenu:De=>De.actions.length<=1},actionViewItemProvider:(De,Oe)=>{if(De instanceof Lo&&De.item.id===Ovo){let pt=lin(this.configService.getValue("chat.upvoteAnimation"));return p.createInstance(xl,De,{...Oe,onClickAnimation:pt})}return Bs(p,De,Oe)}})),H=M(V.getElement(),Lf(".chat-footer-details"));H.tabIndex=0;let G=M(n,Lf(".checkpoint-restore-container"));M(G,Lf(".checkpoint-line-left"));let $=M(G,Lf("span.checkpoint-label-text"));$.textContent=d(7948,null);let J=M(G,Lf("span.checkpoint-dot-separator"));J.textContent="\xB7",J.setAttribute("aria-hidden","true");let ae=t.add(p.createInstance(or,G,D.ChatMessageRestoreCheckpoint,{actionViewItemProvider:(De,Oe)=>{if(De instanceof Lo)return this.instantiationService.createInstance(xM,De,{hoverDelegate:Oe.hoverDelegate})},renderDropdownAsChildElement:!0,menuOptions:{shouldForwardArgs:!0},toolbarOptions:{shouldInlineSubmenu:De=>De.actions.length<=1}}));M(G,Lf(".checkpoint-line-right"));let he=t.add(this.instantiationService.createInstance(AG)),oe=()=>{if(Ui(xe.currentElement)&&xe.currentElement.agent&&!xe.currentElement.agent.isDefault)return he.setAgent(xe.currentElement.agent.id),he.domNode},de=GNe(()=>Ui(xe.currentElement)?xe.currentElement.agent:void 0,this.commandService);t.add(this.hoverService.setupManagedHover(Ri("element"),b,oe,de)),t.add(j(b,re.KEY_DOWN,De=>{let Oe=new gi(De);if(Oe.equals(10)||Oe.equals(3)){let pt=oe();pt&&this.hoverService.showInstantHover({content:pt,target:b,trapFocus:!0,actions:de.actions},!0)}else Oe.equals(9)&&this.hoverService.hideHover()}));let Ce=document.createElement("connection-observer");M(e,Ce);let xe={header:c,avatarContainer:S,requestHover:h,username:y,detail:k,value:T,rowContainer:n,elementDisposables:P,templateDisposables:t,contextKeyService:u,instantiationService:p,agentHover:he,titleToolbar:g,footerToolbar:V,footerDetailsContainer:H,disabledOverlay:o,checkpointToolbar:v,checkpointRestoreToolbar:ae,checkpointContainer:f,checkpointRestoreContainer:G};Ce.onDidDisconnect=()=>{xe.renderedPartsMounted=!1},t.add(this._onDidUpdateViewModel.event(()=>{(!xe.currentElement||!this.viewModel?.sessionResource||!Qe(xe.currentElement.sessionResource,this.viewModel.sessionResource))&&this.clearRenderedParts(xe)})),t.add(j(o,re.CLICK,De=>{if(!this.viewModel?.editing)return;let Oe=xe.currentElement;!Oe||Oe.id===this.viewModel.editing.id||o.classList.contains("disabled")&&(De.preventDefault(),De.stopPropagation(),this._onDidFocusOutside.fire())}));let ze=t.add(new WL(De=>{let Oe=De[0];Oe&&this.fireItemHeightChange(xe,Oe.borderBoxSize.at(0)?.blockSize)}));return t.add(ze.observe(n)),xe}renderElement(e,t,o){this._elementBeingRendered=e.element;try{this.renderChatTreeItem(e.element,t,o)}finally{this._elementBeingRendered=void 0}}clearRenderedParts(e){e.renderedParts?(Be(di(e.renderedParts)),e.renderedParts=void 0,Rt(e.value)):yXe(e.currentElement)&&Rt(e.value),e.titleToolbar&&(e.titleToolbar.context=void 0),e.footerToolbar.context=void 0,e.checkpointToolbar.context=void 0,e.checkpointRestoreToolbar.context=void 0}renderChatTreeItem(e,t,o){if(o.currentElement&&o.currentElement.id!==e.id){this.traceLayout("renderChatTreeItem",`Rendering a different element into the template, index=${t}`);let y=this.templateDataByRequestId.get(o.currentElement.id);y&&y.currentElement?.id!==o.currentElement.id&&this.templateDataByRequestId.delete(o.currentElement.id),this.clearRenderedParts(o)}if(o.currentElement=e,this.templateDataByRequestId.set(e.id,o),o.rowContainer.classList.remove("pending-item","pending-divider","pending-request","chat-pending-dragging"),o.dragHandle?.remove(),o.dragHandle=void 0,delete o.rowContainer.dataset.pendingRequestId,delete o.rowContainer.dataset.pendingKind,yXe(e)){this.renderPendingDivider(e,o);return}let n=Sr(e)?"request":Ui(e)?"response":yXe(e)?"pendingDivider":"welcome";this.traceLayout("renderElement",`${n}, index=${t}`),ie.isResponse.bindTo(o.contextKeyService).set(Ui(e)),ie.itemId.bindTo(o.contextKeyService).set(e.id),ie.isRequest.bindTo(o.contextKeyService).set(Sr(e)),ie.isFirstRequest.bindTo(o.contextKeyService).set(Sr(e)&&this.viewModel?.model.getRequests()[0]?.id===e.id),ie.isPendingRequest.bindTo(o.contextKeyService).set(Sr(e)&&!!e.pendingKind),ie.responseDetectedAgentCommand.bindTo(o.contextKeyService).set(Ui(e)&&e.agentOrSlashCommandDetected),Ui(e)?(ie.responseSupportsIssueReporting.bindTo(o.contextKeyService).set(!!e.agent?.metadata.supportIssueReporting),ie.responseVote.bindTo(o.contextKeyService).set(e.vote===1?"up":e.vote===0?"down":"")):ie.responseVote.bindTo(o.contextKeyService).set(""),o.titleToolbar&&(o.titleToolbar.context=e),o.footerToolbar.context=e,Ui(e)&&e.result?.details?(o.footerDetailsContainer.textContent=e.result.details,o.footerDetailsContainer.classList.remove("hidden")):o.footerDetailsContainer.classList.add("hidden"),ie.responseHasError.bindTo(o.contextKeyService).set(Ui(e)&&!!e.errorDetails);let r=!!(Ui(e)&&e.errorDetails?.responseIsFiltered);ie.responseIsFiltered.bindTo(o.contextKeyService).set(r);let s=this.chatWidgetService.getWidgetBySessionResource(e.sessionResource)?.location;o.rowContainer.classList.toggle("editing-session",s==="panel"),o.rowContainer.classList.toggle("interactive-request",Sr(e)),o.rowContainer.classList.toggle("interactive-response",Ui(e));let l=_Z(this.delegate.currentChatMode(),this.rendererOptions.progressMessageAtBottomOfResponse);o.rowContainer.classList.toggle("show-detail-progress",Ui(e)&&!e.isComplete&&!e.progressMessages.length&&!l);let c=()=>o.rowContainer.classList.toggle("show-checkmarks",!!this.configService.getValue("accessibility.chat.showCheckmarks"));c(),o.elementDisposables.add(this.configService.onDidChangeConfiguration(y=>{y.affectsConfiguration("accessibility.chat.showCheckmarks")&&c()})),this.rendererOptions.noHeader||this.renderAvatar(e,o),o.username.textContent=e.username,o.username.classList.toggle("hidden",e.username===Nbo||this.environmentService.isSessionsWindow),o.avatarContainer.classList.toggle("hidden",e.username===Nbo||this.environmentService.isSessionsWindow),this.hoverHidden(o.requestHover),Rt(o.detail),Ui(e)&&this.renderDetail(e,o),o.checkpointToolbar.context=e;let u=this.rendererOptions.supportsFork||(this.rendererOptions.restorable??!0),p=this.configService.getValue("chat.checkpoints.enabled")&&u,h=Sr(e)&&!!e.pendingKind;if(o.checkpointContainer.classList.toggle("hidden",Ui(e)||h||!p),o.footerToolbar.refresh(),o.checkpointToolbar.refresh(),o.checkpointRestoreToolbar.refresh(),Ui(e)&&(this.responseTemplateDataByRequestId.set(e.requestId,o),o.elementDisposables.add(Z(()=>this.responseTemplateDataByRequestId.delete(e.requestId)))),!h){let y=w=>{let k=Sr(e)?e.id:Ui(e)?e.requestId:void 0;if(!k)return;let T=this.templateDataByRequestId.get(k),P=this.responseTemplateDataByRequestId.get(k);T?.checkpointContainer.classList.toggle("group-hovered",w),P?.rowContainer.classList.toggle("group-hovered",w)};o.elementDisposables.add(j(o.rowContainer,re.MOUSE_ENTER,()=>y(!0))),o.elementDisposables.add(j(o.rowContainer,re.MOUSE_LEAVE,()=>y(!1))),o.elementDisposables.add(Z(()=>y(!1)))}let g=this.viewModel?.model.checkpoint&&!this.viewModel?.editing&&t===this.delegate.getListLength()-1&&!h;o.checkpointRestoreContainer.classList.toggle("hidden",!(g&&p));let f=e.id===this.viewModel?.editing?.id,v=this.configService.getValue("chat.editRequests")==="input";o.elementDisposables.add(be(y=>{let w=e.shouldBeBlocked.read(y);o.disabledOverlay.classList.toggle("disabled",w&&!f&&this.viewModel?.editing!==void 0)})),o.rowContainer.classList.toggle("editing",f&&!v),o.rowContainer.classList.toggle("editing-input",f&&v),o.requestHover.classList.toggle("editing",f&&v),o.requestHover.classList.toggle("hidden",!!this.viewModel?.editing&&!f||Ui(e)||!this.rendererOptions.editable),o.requestHover.classList.toggle("expanded",this.configService.getValue("chat.editRequests")==="hover"),o.requestHover.classList.toggle("checkpoints-enabled",p),o.elementDisposables.add(Jo(o.rowContainer,re.CLICK,y=>{let w=o.currentElement;w&&this.viewModel?.editing&&w.id!==this.viewModel.editing.id&&(y.stopPropagation(),y.preventDefault(),this._onDidFocusOutside.fire())}));let b=o.rowContainer.parentElement?.parentElement?.parentElement;b?.classList.toggle("request",Sr(e)),b?.classList.toggle("response",Ui(e)),o.rowContainer.classList.toggle(ain,t===this.delegate.getListLength()-1),o.rowContainer.classList.toggle("confirmation-message",Sr(e)&&!!e.confirmation);let S=Ui(e)&&!this.rendererOptions.noHeader;if(o.header?.classList.toggle("header-disabled",!S),Sr(e)&&e.confirmation&&this.renderConfirmationAction(e,o),Ui(e)&&t===this.delegate.getListLength()-1&&(!e.isComplete||e.renderData)){this.traceLayout("renderElement",`start progressive render, index=${t}`);let y=o.elementDisposables.add(new FL),w=k=>{try{this.doNextProgressiveRender(e,t,o,!!k)&&y.cancel()}catch(T){y.cancel(),this.logService.error(T)}};y.cancelAndSet(w,50,Re(o.rowContainer)),w(!0)}else Ui(e)?this.renderChatResponseBasic(e,t,o):Sr(e)&&this.renderChatRequest(e,t,o);o.renderedPartsMounted=!0}renderPendingDivider(e,t){t.rowContainer.classList.add("pending-item"),t.rowContainer.classList.add("pending-divider"),t.rowContainer.classList.remove("interactive-request","interactive-response","pending-request"),t.avatarContainer.classList.add("hidden"),t.username.classList.add("hidden"),t.requestHover.classList.add("hidden"),t.checkpointContainer.classList.add("hidden"),t.checkpointRestoreContainer.classList.add("hidden"),t.footerToolbar.getElement().classList.add("hidden"),t.titleToolbar&&t.titleToolbar.getElement().classList.add("hidden"),Rt(t.value),Rt(t.detail);let o=_(".pending-divider-content"),n=M(o,_("span.pending-divider-label"));e.dividerKind==="steering"?(n.textContent=d(7957,null),n.title=d(7958,null)):(n.textContent=d(7953,null),n.title=d(7954,null)),t.value.appendChild(o)}renderDetail(e,t){if(Rt(t.detail),e.agentOrSlashCommandDetected){let o=e.slashCommand?d(7960,null,`${Bu}${e.slashCommand.name}`):d(7959,null);vi(t.detail,zE(o,{actionHandler:{disposables:t.elementDisposables,callback:n=>{this._onDidClickRerunWithAgentOrCommandDetection.fire(e)}}},Lf("span.agentOrSlashCommandDetected")))}else this.rendererOptions.renderStyle!=="minimal"&&!e.isComplete&&!_Z(this.delegate.currentChatMode(),this.rendererOptions.progressMessageAtBottomOfResponse)&&(t.detail.textContent=d(7961,null))}renderConfirmationAction(e,t){Rt(t.detail),e.confirmation&&(M(t.detail,Lf("span.codicon.codicon-check",{"aria-hidden":"true"})),M(t.detail,Lf("span.confirmation-text",void 0,d(7947,null,e.confirmation))),t.header?.classList.remove("header-disabled"),t.header?.classList.add("partially-disabled"))}renderAvatar(e,t){if(yXe(e))return;let o;if(Ui(e)?o=this.getAgentIcon(e.agent?.metadata):Sr(e)?o=e.avatarIcon??R.account:o=R.account,o instanceof A){let n=_("img.icon");n.src=vn.uriToBrowserUri(o).toString(!0),t.avatarContainer.replaceChildren(_(".avatar",void 0,n))}else{let n=_(q.asCSSSelector(o));t.avatarContainer.replaceChildren(_(".avatar.codicon-avatar",void 0,n))}}getAgentIcon(e){return e?.themeIcon?e.themeIcon:e?.iconDark&&Bp(this.themeService.getColorTheme().type)?e.iconDark:e?.icon?e.icon:R.chatSparkle}renderChatResponseBasic(e,t,o){if(o.rowContainer.classList.toggle("chat-response-loading",Ui(e)&&!e.isComplete),e.isComplete||e.isCanceled){let c=this.getLastThinkingPart(o.renderedParts);c?.domNode&&c.getIsActive()&&(c.finalizeTitleIfDefault(),c.markAsInactive()),this.finalizeAllSubagentParts(o)}let n=[];e.errorDetails?.responseIsFiltered||(n.push({kind:"references",references:e.contentReferences}),n.push(...YTi(e.response.value)),e.codeCitations.length&&n.push({kind:"codeCitations",citations:e.codeCitations})),e.model.response===e.model.entireResponse&&e.errorDetails?.message&&e.errorDetails.message!==x9&&n.push({kind:"errorDetails",errorDetails:e.errorDetails,isLast:t===this.delegate.getListLength()-1});let s=this.getChatFileChangesSummaryPart(e);s&&n.push(s);let l=this.diff(o.renderedParts??[],n,e);this.renderChatContentDiff(l,n,e,t,o)}shouldShowWorkingProgress(e,t,o,n){if(e.agentOrSlashCommandDetected||this.rendererOptions.renderStyle==="minimal"||e.isComplete||!_Z(this.delegate.currentChatMode(),this.rendererOptions.progressMessageAtBottomOfResponse)||t.some(u=>u.kind==="toolInvocation"&&Pi.isStreaming(u))||t.some(u=>u.kind==="toolInvocation"&&!Pi.isComplete(u)&&pKt(u)))return!1;let r=fd(t,u=>u.kind!=="markdownContent"||u.content.value.trim().length>0);if(this.getLastThinkingPart(n.renderedParts)||r&&(r.kind==="toolInvocation"||r.kind==="toolInvocationSerialized")&&(r.isAttachedToThinking||this.configService.getValue("chat.agent.thinking.collapsedTools")!=="off"&&this.shouldPinPart(r,Ui(e)?e:void 0)))return!1;let l=(n.renderedParts??[]).some(u=>u instanceof jk),c=t.some(u=>u.kind==="markdownContent"&&this.hasEditCodeblockUri(u));return l&&c||this.getSubagentPart(n.renderedParts)?!1:!!(!r||r.kind==="references"||r.kind==="markdownContent"&&!o&&this.hasBeenCaughtUpLongEnough(e)||(r.kind==="toolInvocation"||r.kind==="toolInvocationSerialized")&&(Pi.isComplete(r)||r.presentation==="hidden")||(r.kind==="textEditGroup"||r.kind==="notebookEditGroup")&&r.done&&!t.some(u=>u.kind==="toolInvocation"&&!Pi.isComplete(u))||r.kind==="progressTask"&&r.deferred.isSettled||r.kind==="mcpServersStarting"||r.kind==="disabledClaudeHooks"||r.kind==="hook")}hasBeenCaughtUpLongEnough(e){let t=e.renderData?.lastRenderTime;return typeof t!="number"||t===0?!1:Date.now()-t>=rin}getChatFileChangesSummaryPart(e){if(this.shouldShowFileChangesSummary(e)&&e.model.entireResponse.value.some(t=>t.kind==="textEditGroup"||t.kind==="notebookEditGroup"))return{kind:"changesSummary",requestId:e.requestId,sessionResource:e.sessionResource}}renderChatRequest(e,t,o){if(o.rowContainer.classList.toggle("chat-response-loading",!1),o.rowContainer.classList.toggle("pending-request",!!e.pendingKind),e.pendingKind&&this._pendingDragController&&(o.rowContainer.dataset.pendingRequestId=e.id,o.rowContainer.dataset.pendingKind=e.pendingKind,(this.viewModel?.model.getPendingRequests()??[]).filter(u=>u.kind===e.pendingKind).length>1)){let u=_(".chat-pending-drag-handle"+q.asCSSSelector(R.gripper));o.rowContainer.prepend(u),o.dragHandle=u,this._pendingDragController.attachDragHandle(e,u,o.rowContainer,o.elementDisposables)}e.id===this.viewModel?.editing?.id&&this._onDidRerender.fire(o),this.configService.getValue("chat.editRequests")!=="none"&&this.rendererOptions.editable&&o.elementDisposables.add(j(o.rowContainer,re.KEY_DOWN,c=>{let u=new gi(c);(u.equals(10)||u.equals(3))&&this.viewModel?.editing?.id!==e.id&&(u.preventDefault(),u.stopPropagation(),this._onDidClickRequest.fire(o))}));let n=[];if(!e.confirmation){let c=eto(e.message)?e.message.message:this.markdownDecorationsRenderer.convertParsedRequestToMarkdown(e.sessionResource,e.message);n=[{content:new Ie(c),kind:"markdownContent"}],this.rendererOptions.renderStyle==="minimal"&&!e.isComplete?(o.value.classList.add("inline-progress"),o.elementDisposables.add(Z(()=>o.value.classList.remove("inline-progress"))),n.push({content:new Ie("<span></span>",{supportHtml:!0}),kind:"markdownContent"})):o.value.classList.remove("inline-progress")}Rt(o.value);let r=[],s=!1,l=0;if(n.forEach((c,u)=>{let p={element:e,elementIndex:t,contentIndex:u,content:n,container:o.rowContainer,editorPool:this._editorPool,diffEditorPool:this._diffEditorPool,codeBlockModelCollection:this.codeBlockModelCollection,currentWidth:this._currentLayoutWidth,onDidChangeVisibility:this._onDidChangeVisibility.event,inlineTextModels:this._inlineTextModels,codeBlockStartIndex:l,treeStartIndex:0},h=this.renderChatContentPart(c,o,p);if(h){if(this.rendererOptions.renderDetectedCommandsWithRequest&&!s&&e.agentOrSlashCommandDetected&&e.slashCommand&&c.kind==="markdownContent"){h.domNode&&(h.domNode.style.display="inline-flex");let g=this.instantiationService.createInstance(qNe,e.slashCommand,()=>this._onDidClickRerunWithAgentOrCommandDetection.fire({sessionResource:e.sessionResource,requestId:e.id}));o.value.appendChild(g.domNode),r.push(g),s=!0}h.domNode&&!h.domNode.parentElement&&o.value.appendChild(h.domNode),r.push(h),l+=h.codeblocks?.length??0}}),o.renderedParts&&Be(o.renderedParts),o.renderedParts=r,e.variables.length){let c=this.renderAttachments(e.variables,e.contentReferences,o);c.domNode&&o.value.appendChild(c.domNode),o.elementDisposables.add(c)}}doNextProgressiveRender(e,t,o,n){if(!this._isVisible)return!0;if(e.isCanceled)return this.traceLayout("doNextProgressiveRender",`canceled, index=${t}`),e.renderData=void 0,this.renderChatResponseBasic(e,t,o),!0;o.rowContainer.classList.toggle("chat-response-loading",!0),this.traceLayout("doNextProgressiveRender",`START progressive render, index=${t}`);let r=this.getNextProgressiveRenderContent(e,o),s=this.diff(o.renderedParts??[],r.content,e);return s.every(c=>c===null)?r.moreContentAvailable?(this.traceLayout("doNextProgressiveRender","not rendering any new content this tick, but more available"),!1):e.isComplete?(this.traceLayout("doNextProgressiveRender",`END progressive render, index=${t} and clearing renderData, response is complete`),e.renderData=void 0,this.renderChatResponseBasic(e,t,o),!0):(this.traceLayout("doNextProgressiveRender","caught up with the stream- no new content to render"),!0):(this.traceLayout("doNextProgressiveRender",`doing progressive render, ${s.length} parts to render`),this.renderChatContentDiff(s,r.content,e,t,o),!1)}renderChatContentDiff(e,t,o,n,r){let s=r.renderedParts??[];r.renderedParts=s;let l=0,c=0;e.forEach((u,p)=>{if(p>0){let b=s[p-1];b&&(l+=b.codeblocks?.length??0,b instanceof Ege&&c++)}let h=r.renderedParts?.[p];if(!u){r.renderedPartsMounted||h?.onDidRemount?.();return}if(h){if(u.kind==="thinking"&&h instanceof jk){Array.isArray(u.value)||h.updateThinking(u),s[p]=h;return}else if(h instanceof jk&&this.shouldPinPart(u,o)){s[p]=h;return}if(h.dispose(),h.domNode){let b=Cg(h.domNode,"chat-thinking-tool-wrapper");b&&b.replaceWith(h.domNode)}}let g={element:o,elementIndex:n,content:t,contentIndex:p,container:r.rowContainer,editorPool:this._editorPool,diffEditorPool:this._diffEditorPool,codeBlockModelCollection:this.codeBlockModelCollection,currentWidth:this._currentLayoutWidth,onDidChangeVisibility:this._onDidChangeVisibility.event,inlineTextModels:this._inlineTextModels,codeBlockStartIndex:l,treeStartIndex:c};if(this.getLastThinkingPart(s)&&(u.kind==="toolInvocation"||u.kind==="toolInvocationSerialized"||u.kind==="markdownContent"||u.kind==="textEditGroup"||u.kind==="hook")&&this.shouldPinPart(u,o)){let b=this.renderChatContentPart(u,r,g);b&&(s[p]=b,h instanceof hge&&h?.domNode&&h.domNode.remove());return}let v=this.renderChatContentPart(u,r,g);if(v){s[p]=v;try{h?.domNode?v.domNode?h.domNode.replaceWith(v.domNode):h.domNode.remove():v.domNode&&!v.domNode.parentElement&&r.value.appendChild(v.domNode)}catch(b){this.logService.error("ChatListItemRenderer#renderChatContentDiff: error replacing part",b)}}else h?.domNode?.remove()});for(let u=e.length;u<s.length;u++){let p=s[u];p&&(p.dispose(),p.domNode?.remove(),delete s[u])}}getNextProgressiveRenderContent(e,t){let o=this.getDataForProgressiveRender(e),n=this.configService.getValue("chat.experimental.renderMarkdownImmediately")===!0,r=YTi(e.response.value);this.traceLayout("getNextProgressiveRenderContent",`Want to render ${o.numWordsToRender} at ${o.rate} words/s, counting...`);let s=o.numWordsToRender,l=[];l.push({kind:"references",references:e.contentReferences});let c=!1;for(let f=0;f<r.length;f++){let v=r[f];if(v.kind==="markdownContent"&&!n){let b=FSi(v.content.value,s);if(this.traceLayout("getNextProgressiveRenderContent",`  Chunk ${f}: Want to render ${s} words and found ${b.returnedWordCount} words. Total words in chunk: ${b.totalWordCount}`),s-=b.returnedWordCount,b.isFullString){l.push(v);for(let S of r.slice(f+1))if(S.kind!=="markdownContent")f++,l.push(S);else break}else c=!0,l.push({...v,content:new Ie(b.value,v.content)});if(s<=0){r.slice(f+1).some(S=>S.kind==="markdownContent")&&(c=!0);break}}else l.push(v)}let u=e.contentUpdateTimings?.lastWordCount??0,p=o.numWordsToRender-s,h=u-p;this.traceLayout("getNextProgressiveRenderContent",`Want to render ${o.numWordsToRender} words. Rendering ${p} words. Buffer: ${h} words`),p>0&&p!==e.renderData?.renderedWordCount&&(e.renderData={lastRenderTime:Date.now(),renderedWordCount:p,renderedParts:l}),this.shouldShowWorkingProgress(e,l,c,t)&&l.push({kind:"working"});let g=this.getChatFileChangesSummaryPart(e);return g&&l.push(g),{content:l,moreContentAvailable:c}}shouldShowFileChangesSummary(e){let t=gl(e.sessionResource),o=t===sc||Neo(t);return e.isComplete&&o&&this.configService.getValue("chat.checkpoints.showFileChanges")}getDataForProgressiveRender(e){let t=e.response.value.some(s=>s.kind==="markdownContent"&&s.content.value.trim().length>0);if(!e.isComplete&&t&&(e.contentUpdateTimings?e.contentUpdateTimings.lastWordCount:0)===0)return{numWordsToRender:Number.MAX_SAFE_INTEGER,rate:Number.MAX_SAFE_INTEGER};let o=e.renderData??{lastRenderTime:0,renderedWordCount:0},n=this.getProgressiveRenderRate(e);return{numWordsToRender:o.lastRenderTime===0?1:o.renderedWordCount+Math.floor((Date.now()-o.lastRenderTime)/1e3*n),rate:n}}diff(e,t,o){let n=[];for(let r=0;r<t.length;r++){let s=t[r],l=e[r];!l||!l.hasSameContent(s,t.slice(r+1),o)?n.push(s):n.push(null)}return n}hasEditCodeblockUri(e){return e.kind!=="markdownContent"?!1:Fgo(e.content.value)}isCodeblockComplete(e,t){return e.kind!=="markdownContent"?!0:!Ui(t)||t.isComplete||uKt(e.content.value)}shouldPinPart(e,t){let o=this.configService.getValue("chat.agent.thinking.collapsedTools");if(e.kind==="thinking"||e.kind==="working"||e.kind==="undoStop")return!0;if(e.kind==="hook")return e.subAgentInvocationId?!1:e.hookType==="PreToolUse"||e.hookType==="PostToolUse";if(o==="off")return!1;if(this.hasEditCodeblockUri(e)||e.kind==="textEditGroup")return!0;if((e.kind==="toolInvocation"||e.kind==="toolInvocationSerialized")&&pKt(e)||(e.kind==="toolInvocation"||e.kind==="toolInvocationSerialized")&&e.toolId.toLowerCase().includes("mermaid")||(e.kind==="toolInvocation"||e.kind==="toolInvocationSerialized")&&(e.toolId==="copilot_askQuestions"||e.toolId==="vscode_askQuestions")||(e.kind==="toolInvocation"||e.kind==="toolInvocationSerialized")&&Obo(e))return!1;let l=(e.kind==="toolInvocation"||e.kind==="toolInvocationSerialized")&&e.toolSpecificData?.kind==="terminal",c=t&&t.sessionResource.scheme!==Q.vscodeChatInput&&t.sessionResource.scheme!==Q.vscodeLocalChatSession&&e.kind==="toolInvocationSerialized"&&e.toolSpecificData?.kind==="terminal";if(l&&!c)return e.kind==="toolInvocation"&&Pi.getConfirmationMessages(e)?!1:!!this.configService.getValue("chat.agent.thinking.terminalTools");if(e.kind==="toolInvocation"){if(Pi.isStreaming(e))return!0;let u=e.state.get();return u.type===Pi.StateKind.WaitingForConfirmation||u.type===Pi.StateKind.WaitingForPostApproval?!1:!Pi.getConfirmationMessages(e)}return e.kind==="toolInvocationSerialized"}getLastThinkingPart(e){if(!(!e||e.length===0))for(let t=e.length-1;t>=0;t--){let o=e[t];if(o instanceof jk&&o.getIsActive())return o}}isThinkingLookAheadComplete(e,t){if(t?.isComplete)return!0;for(let o=e.contentIndex+1;o<e.content.length;o++){let n=e.content[o];if(!this.shouldPinPart(n,t))return!0}return!1}getSubagentPart(e,t){if(!(!e||e.length===0))for(let o=e.length-1;o>=0;o--){let n=e[o];if(n instanceof DM&&(t&&n.subAgentInvocationId===t||!t&&n.getIsActive()))return n}}finalizeAllSubagentParts(e){if(e.renderedParts)for(let t of e.renderedParts)t instanceof DM&&t.getIsActive()&&t.markAsInactive()}handleSubagentToolGrouping(e,t,o,n,r){this.finalizeCurrentThinkingPart(o,n);let s=this.getSubagentPart(n.renderedParts,t);if(s)return sLi(e)||s.appendToolInvocation(e,r),s;let l=this.instantiationService.createInstance(DM,t,e,o,this.chatContentMarkdownRenderer,this._contentReferencesListPool,this._toolEditorPool,()=>this._currentLayoutWidth.get(),this._toolInvocationCodeBlockCollection,this._announcedToolProgressKeys);return sLi(e)||l.appendToolInvocation(e,r),l}finalizeCurrentThinkingPart(e,t){let o=this.getLastThinkingPart(t.renderedParts);if(!o)return;this.configService.getValue("chat.agent.thinkingStyle")==="collapsedPreview"&&o.collapseContent(),o.finalizeTitleIfDefault(),o.resetId(),o.markAsInactive()}renderChatContentPart(e,t,o){try{if(e.kind==="thinking"&&(Array.isArray(e.value)?e.value.length===0:e.value===""))return this.getLastThinkingPart(t.renderedParts)?.resetId(),this.renderNoContent(c=>e.kind===c.kind);let n=Ui(o.element),r=this.shouldPinPart(e,n?o.element:void 0);if(o.element.isComplete&&!r)for(let l of this.templateDataByRequestId.values())l.renderedParts&&this.getLastThinkingPart(l.renderedParts)?.getIsActive()&&this.finalizeCurrentThinkingPart(o,l);let s=(e.kind==="toolInvocation"||e.kind==="toolInvocationSerialized")&&Obo(e);if(o.element.isComplete&&!s)for(let l of this.templateDataByRequestId.values())this.finalizeAllSubagentParts(l);return e.kind==="treeData"?this.renderTreeData(e,t,o):e.kind==="multiDiffData"?this.renderMultiDiffData(e,t,o):e.kind==="progressMessage"?this.instantiationService.createInstance(XD,e,this.chatContentMarkdownRenderer,o,void 0,void 0,void 0,void 0,e.shimmer):e.kind==="working"?this.instantiationService.createInstance(hge,e,this.chatContentMarkdownRenderer,o):e.kind==="progressTask"||e.kind==="progressTaskSerialized"?this.renderProgressTask(e,t,o):e.kind==="command"?this.instantiationService.createInstance(YNe,e,o):e.kind==="textEditGroup"?this.renderTextEdit(o,e,t):e.kind==="confirmation"?this.renderConfirmation(o,e,t):e.kind==="warning"?this.instantiationService.createInstance(SOe,1,e.content,e,this.chatContentMarkdownRenderer):e.kind==="hook"?this.renderHookPart(e,o,t):e.kind==="markdownContent"?this.renderMarkdown(e,t,o):e.kind==="references"?Ui(o.element)&&o.element.agent?.isDefault&&!o.element.agent.modes.includes("ask")?this.renderNoContent(l=>l.kind===e.kind):this.renderContentReferencesListData(e,void 0,o,t):e.kind==="codeCitations"?this.renderCodeCitations(e,o,t):e.kind==="toolInvocation"||e.kind==="toolInvocationSerialized"?this.renderToolInvocation(e,o,t):e.kind==="extensions"?this.renderExtensionsContent(e,o,t):e.kind==="pullRequest"?this.renderPullRequestContent(e,o,t):e.kind==="undoStop"?this.renderUndoStop(e):e.kind==="errorDetails"?this.renderChatErrorDetails(o,e,t):e.kind==="elicitation2"||e.kind==="elicitationSerialized"?this.renderElicitation(o,e,t):e.kind==="questionCarousel"?this.renderQuestionCarousel(o,e,t):e.kind==="changesSummary"?this.renderChangesSummary(e,o,t):e.kind==="mcpServersStarting"?this.renderMcpServersInteractionRequired(e,o,t):e.kind==="disabledClaudeHooks"?this.renderDisabledClaudeHooks(e,o):e.kind==="thinking"?this.renderThinkingPart(e,o,t):e.kind==="workspaceEdit"?this.instantiationService.createInstance(QOe,e,o,this.chatContentMarkdownRenderer):this.renderNoContent(l=>e.kind===l.kind)}catch(n){en(`Chat error: ${xn(n,!1)}`),this.logService.error("ChatListItemRenderer#renderChatContentPart: error rendering content",xn(n,!0));let r=this.instantiationService.createInstance(SOe,2,new Ie(d(7955,null)+`: ${xn(n,!1)}`),e,this.chatContentMarkdownRenderer);return{dispose:()=>r.dispose(),domNode:r.domNode,hasSameContent:(s=>e.kind===s.kind)}}}dispose(){this._announcedToolProgressKeys.clear(),super.dispose()}renderChatErrorDetails(e,t,o){if(!Ui(e.element))return this.renderNoContent(r=>t.kind===r.kind);let n=e.elementIndex===this.delegate.getListLength()-1;if(t.errorDetails.isQuotaExceeded)return this.instantiationService.createInstance(TOe,e.element,t,this.chatContentMarkdownRenderer);if(t.errorDetails.isRateLimited&&this.chatEntitlementService.anonymous)return this.instantiationService.createInstance($Ne,t);if(t.errorDetails.confirmationButtons&&n){let r=t.errorDetails.level??2;return this.instantiationService.createInstance(IOe,r,new Ie(t.errorDetails.message),t,t.errorDetails.confirmationButtons,this.chatContentMarkdownRenderer,e)}else{let r=t.errorDetails.level??2;return this.instantiationService.createInstance(SOe,r,new Ie(t.errorDetails.message),t,this.chatContentMarkdownRenderer)}}renderUndoStop(e){return this.renderNoContent(t=>t.kind===e.kind&&t.id===e.id)}renderNoContent(e){return{dispose:()=>{},domNode:void 0,hasSameContent:e}}renderTreeData(e,t,o){let n=e.treeData,r=this.instantiationService.createInstance(Ege,n,this._treePool);if(Ui(o.element)){let s={treeDataId:n.uri.toString(),treeIndex:o.treeStartIndex,focus(){r.domFocus()}};r.addDisposable(r.onDidFocus(()=>{this.focusedFileTreesByResponseId.set(o.element.id,s.treeIndex)}));let l=this.fileTreesByResponseId.get(o.element.id)??[];l.push(s),this.fileTreesByResponseId.set(o.element.id,zo(l,c=>c.treeDataId)),r.addDisposable(Z(()=>this.fileTreesByResponseId.set(o.element.id,l.filter(c=>c.treeDataId!==n.uri.toString()))))}return r}renderMultiDiffData(e,t,o){return this.instantiationService.createInstance(kOe,e,o.element)}renderContentReferencesListData(e,t,o,n){return this.instantiationService.createInstance(ENe,e.references,t,o,this._contentReferencesListPool,{expandedWhenEmptyResponse:_Z(this.delegate.currentChatMode(),this.rendererOptions.referencesExpandedWhenEmptyResponse)})}renderCodeCitations(e,t,o){return this.instantiationService.createInstance(QNe,e,t)}handleRenderedCodeblocks(e,t,o){if(!t.addDisposable||t.codeblocksPartId===void 0)return;let n=this.codeBlocksByResponseId.get(e.id)??[];this.codeBlocksByResponseId.set(e.id,n),t.addDisposable(Z(()=>{let r=this.codeBlocksByResponseId.get(e.id);r&&t.codeblocks?.forEach((s,l)=>{r[o+l]?.ownerMarkdownPartId===t.codeblocksPartId&&delete r[o+l]})})),t.codeblocks?.forEach((r,s)=>{n[o+s]=r,t.addDisposable(USe(r.uriPromise,l=>{l&&(this.codeBlocksByEditorUri.set(l,r),t.addDisposable(Z(()=>{this.codeBlocksByEditorUri.get(l)?.ownerMarkdownPartId===t.codeblocksPartId&&this.codeBlocksByEditorUri.delete(l)})))}))})}renderToolInvocation(e,t,o){this.configService.getValue("chat.agent.thinking.collapsedTools")==="off"&&this.finalizeCurrentThinkingPart(t,o);let n=t.codeBlockStartIndex,r,s=()=>(r=this.instantiationService.createInstance(Rie,e,t,this.chatContentMarkdownRenderer,this._contentReferencesListPool,this._toolEditorPool,()=>this._currentLayoutWidth.get(),this._toolInvocationCodeBlockCollection,this._announcedToolProgressKeys,n),this.handleRenderedCodeblocks(t.element,r,n),{domNode:r.domNode,disposable:r,part:r}),l=this.configService.getValue("chat.agent.thinking.collapsedTools");if(Ui(t.element)&&l!=="off"){let p=this.getLastThinkingPart(o.renderedParts);if(!p&&e.presentation!=="hidden"&&this.shouldPinPart(e,t.element)&&l==="always"){let h=this.renderThinkingPart({kind:"thinking"},t,o);return h instanceof jk&&(e.isAttachedToThinking=!0,h.appendItem(s,e.toolId,e,o.value),this.setupConfirmationTransitionWatcher(e,h,()=>r,s,t,o)),h}if(this.shouldPinPart(e,t.element)){if(p&&e.presentation!=="hidden")return e.isAttachedToThinking=!0,p.appendItem(s,e.toolId,e,o.value),this.setupConfirmationTransitionWatcher(e,p,()=>r,s,t,o),this.renderNoContent((h,g,f)=>r?r.hasSameContent(h,g,f):e.kind===h.kind)}else this.finalizeCurrentThinkingPart(t,o)}let c=Fbo(e);if(c&&Ui(t.element)&&e.presentation!=="hidden")return this.handleSubagentToolGrouping(e,c,t,o,n);let{part:u}=s();return u}setupConfirmationTransitionWatcher(e,t,o,n,r,s){if(e.kind!=="toolInvocation")return;let l=()=>{let g=o();if(e.isAttachedToThinking=!1,g?.domNode){let f=g.domNode.parentElement;f?.classList.contains("chat-thinking-tool-wrapper")&&f.remove(),s.value.appendChild(g.domNode),t.removeMaterializedItem(e.toolCallId)}else{t.removeLazyItem(e.toolId);let{domNode:f}=n();s.value.appendChild(f)}this.finalizeCurrentThinkingPart(r,s),t.isEffectivelyEmpty()&&(t.domNode?.remove(),t.dispose())},c=e.state.get();if(c.type===Pi.StateKind.WaitingForConfirmation||c.type===Pi.StateKind.WaitingForPostApproval){l();return}if(!(g=>g===Pi.StateKind.Streaming||g===Pi.StateKind.Executing)(c.type))return;let p=!1,h=be(g=>{let f=e.state.read(g);if(f.type===Pi.StateKind.WaitingForConfirmation||f.type===Pi.StateKind.WaitingForPostApproval){if(p)return;p=!0,h.dispose(),l()}});t.addDisposable(h)}renderExtensionsContent(e,t,o){return this.instantiationService.createInstance(OG,e)}renderHookPart(e,t,o){if(!(e.stopReason||e.systemMessage))return this.renderNoContent(s=>s.kind==="hook"&&s.hookType===e.hookType);if(e.subAgentInvocationId){let s=this.getSubagentPart(o.renderedParts,e.subAgentInvocationId);if(s)return s.appendHookItem(()=>{let l=this.instantiationService.createInstance(Mie,e,t);return{domNode:l.domNode,disposable:l}},e),this.renderNoContent(l=>l.kind==="hook"&&l.hookType===e.hookType&&l.subAgentInvocationId===e.subAgentInvocationId)}if(e.hookType==="PreToolUse"||e.hookType==="PostToolUse"){let s=e.stopReason?e.toolDisplayName?d(7949,null,e.toolDisplayName):d(7950,null):e.toolDisplayName?d(7951,null,e.toolDisplayName):d(7952,null),l=this.getLastThinkingPart(o.renderedParts);if(!l){let c=this.renderThinkingPart({kind:"thinking"},t,o);c instanceof jk&&(l=c)}if(l)return l.appendItem(()=>{let c=this.instantiationService.createInstance(Mie,e,t);return{domNode:c.domNode,disposable:c}},s,void 0,o.value),l}return this.instantiationService.createInstance(Mie,e,t)}renderPullRequestContent(e,t,o){return this.instantiationService.createInstance(EOe,e)}renderProgressTask(e,t,o){return Ui(o.element)?this.instantiationService.createInstance(_Oe,e,this._contentReferencesListPool,this.chatContentMarkdownRenderer,o):void 0}renderConfirmation(e,t,o){return this.instantiationService.createInstance(gOe,t,e)}renderElicitation(e,t,o){return(t.kind==="elicitationSerialized"?t.isHidden:t.isHidden?.get())?this.renderNoContent(r=>t.kind===r.kind):(this.finalizeCurrentThinkingPart(e,o),this.instantiationService.createInstance(bOe,t,e))}renderQuestionCarousel(e,t,o){this.finalizeCurrentThinkingPart(e,o),this._notifyOnQuestionCarousel(e,t);let n=Ui(e.element)?this.chatWidgetService.getWidgetBySessionResource(e.element.sessionResource):void 0,r=n?n.getInput()==="":!0,s=Ui(e.element)?e.element.requestId:void 0,l=async(g,f)=>{let v=g?Object.fromEntries(g):void 0;t.data=v??{},t.isUsed=!0,t instanceof uW&&(t.draftAnswers=void 0,t.draftCurrentIndex=void 0,t.completion.complete({answers:v})),Ui(e.element)&&t.resolveId&&this.chatService.notifyQuestionCarouselAnswer(e.element.requestId,t.resolveId,v),this.removeCarouselFromTracking(e,f);let b=t.resolveId??`${s}_${e.contentIndex}`;n?.input.clearQuestionCarousel(void 0,b)},c=Ui(e.element)&&e.element.isComplete,u=n?.input.questionCarousel!==void 0;if(t.isUsed||c){c&&!t.isUsed&&Ui(e.element)&&t.resolveId&&(t.data={},t.isUsed=!0,t instanceof uW&&(t.draftAnswers=void 0,t.draftCurrentIndex=void 0,t.completion.complete({answers:void 0})),this.chatService.notifyQuestionCarouselAnswer(e.element.requestId,t.resolveId,void 0),this.pendingQuestionCarousels.get(e.element.sessionResource)?.clear()),c&&u&&s&&n?.input.clearQuestionCarousel(s);let g=this.instantiationService.createInstance($8,t,e,{shouldAutoFocus:!1,onSubmit:async f=>l(f,g)});return g}let h=!!this.viewModel?.editing?void 0:n?.input.renderQuestionCarousel(t,e,{shouldAutoFocus:r,onSubmit:async g=>l(g,h)});if(!h){let g=this.instantiationService.createInstance($8,t,e,{shouldAutoFocus:r,onSubmit:async f=>l(f,g)});return g}if(Ui(e.element)&&t.allowSkip&&!t.isUsed){let g=this.pendingQuestionCarousels.get(e.element.sessionResource);g||(g=new Set,this.pendingQuestionCarousels.set(e.element.sessionResource,g)),g.has(h)||(g.add(h),h.addDisposable({dispose:()=>this.removeCarouselFromTracking(e,h)}))}return this.renderNoContent((g,f,v)=>{if(t.isUsed||Ui(v)&&v.isComplete)return!1;if(g.kind==="questionCarousel"){let b=g;return t.resolveId&&b.resolveId?t.resolveId===b.resolveId:g===t}return!1})}_getCarouselStableKey(e,t){let o=Ui(e.element)?e.element.requestId:void 0;if(!(!o||!t.resolveId))return`${o}::${t.resolveId}`}_notifyOnQuestionCarousel(e,t){if(t.isUsed)return;let o=this._getCarouselStableKey(e,t);if(o&&this._notifiedQuestionCarousels.has(o))return;let n=t.questions.length,r=t.questions.length>0&&t.questions[0].message?t.questions[0].message:d(7944,null),s=typeof r=="string"?r:r.value,l=n===1?d(7943,null,s):d(7942,null,n,s);this.accessibilityService.alert(l),o&&this._notifiedQuestionCarousels.add(o);let c=n===1?d(7946,null):d(7945,null,n);this.accessibilitySignalService.playSignal($o.chatUserActionRequired,{allowManyInParallel:!0,customAlertMessage:c})}removeCarouselFromTracking(e,t){if(Ui(e.element)){let o=this.pendingQuestionCarousels.get(e.element.sessionResource);o&&o.delete(t)}}renderChangesSummary(e,t,o){return this.instantiationService.createInstance(jNe,e,t)}renderAttachments(e,t,o){return this.instantiationService.createInstance(fie,{variables:e,contentReferences:t,domNode:void 0})}renderTextEdit(e,t,o){return this.instantiationService.createInstance(DOe,t,e,this.rendererOptions,this._diffEditorPool,this._currentLayoutWidth.get())}renderMarkdown(e,t,o){let n=o.element,r=!e.content.value.trim(),s=Ui(n)&&!n.isComplete&&Ogo(e.content.value)&&!uKt(e.content.value);!this.hasEditCodeblockUri(e)&&!r&&!s&&this.finalizeCurrentThinkingPart(o,t);let l=Ui(n)&&(!n.isComplete||n.isCanceled||n.errorDetails?.responseIsFiltered||n.errorDetails?.responseIsIncomplete||!!n.renderData),c=o.codeBlockStartIndex,u=t.instantiationService.createInstance(KT,e,o,this._editorPool,l,c,this.chatContentMarkdownRenderer,void 0,this._currentLayoutWidth.get(),this.codeBlockModelCollection,{});u.addDisposable(u.onDidChangeHeight(()=>this.fireItemHeightChange(t))),Sr(n)&&(u.domNode.tabIndex=0,this.configService.getValue("chat.editRequests")==="inline"&&this.rendererOptions.editable&&(u.domNode.classList.add("clickable"),u.addDisposable(j(u.domNode,re.CLICK,h=>{if(this.viewModel?.editing?.id===n.id)return;let g=h.target;if(g.tagName==="A")return;let f=Re(t.rowContainer).getSelection();if(f&&!f.isCollapsed&&f.toString().length>0)return;let v=Cg(g,"monaco-editor");v&&Array.from(this.editorsInUse()).find(S=>S.element.contains(v))?.editor.getSelection()?.isEmpty()===!1||(h.preventDefault(),h.stopPropagation(),this._onDidClickRequest.fire(t))})),u.addDisposable(this.hoverService.setupManagedHover(Ri("element"),u.domNode,d(7956,null),{trapFocus:!0}))),u.addDisposable(j(u.domNode,re.FOCUS,()=>{this.hoverVisible(t.requestHover)})),u.addDisposable(j(u.domNode,re.BLUR,()=>{this.hoverHidden(t.requestHover)}))),this.handleRenderedCodeblocks(n,u,c);let p=this.configService.getValue("chat.agent.thinking.collapsedTools");if(Ui(o.element)&&p!=="off"){let h=this.isCodeblockComplete(e,o.element),g=Ngo(e.content.value);if(g){let v=this.getSubagentPart(t.renderedParts,g);if(v&&u?.domNode&&h)return v.appendMarkdownItem(()=>({domNode:u.domNode,disposable:u}),u.codeblocksPartId,e,t.value),v}let f=this.getLastThinkingPart(t.renderedParts);if(!f&&u?.domNode&&this.shouldPinPart(e,o.element)&&p==="always"&&h){let v=this.renderThinkingPart({kind:"thinking"},o,t);return v instanceof jk&&v.appendItem(()=>({domNode:u.domNode,disposable:u}),u.codeblocksPartId,e,t.value,u.onDidChangeDiff),v}this.shouldPinPart(e,o.element)&&h?f&&u?.domNode&&f.appendItem(()=>({domNode:u.domNode,disposable:u}),u.codeblocksPartId,e,t.value,u.onDidChangeDiff):!this.shouldPinPart(e,o.element)&&!r&&!s&&this.finalizeCurrentThinkingPart(o,t)}return u}renderThinkingPart(e,t,o){e.id||(e.id=Date.now().toString());let n=Ui(t.element)?t.element:void 0,r=this.isThinkingLookAheadComplete(t,n);if(Array.isArray(e.value)){if(e.value.length<1)return this.getLastThinkingPart(o.renderedParts)?.finalizeTitleIfDefault(),this.renderNoContent(c=>e.kind===c.kind);let s;for(let l of e.value)if(l){let c=s instanceof jk&&s.getIsActive()?s:void 0;if(c)c.setupThinkingContainer({...e,value:l});else{let u={...e,value:l};s=o.instantiationService.createInstance(jk,u,t,this.chatContentMarkdownRenderer,r)}}return s??this.renderNoContent(l=>e.kind===l.kind)}else{let s=this.getLastThinkingPart(o.renderedParts);return s?(s.setupThinkingContainer(e),s):o.instantiationService.createInstance(jk,e,t,this.chatContentMarkdownRenderer,r)}}disposeElement(e,t,o,n){this.traceLayout("disposeElement",`Disposing element, index=${t}`),o.elementDisposables.clear(),o.currentElement&&!this.viewModel?.editing&&this.templateDataByRequestId.delete(o.currentElement.id),Sr(e.element)&&e.element.id===this.viewModel?.editing?.id&&n?.onScroll&&this._onDidDispose.fire(o),o.titleToolbar&&(o.titleToolbar.context=void 0),o.footerToolbar.context=void 0,o.checkpointToolbar.context=void 0,o.checkpointRestoreToolbar.context=void 0}renderMcpServersInteractionRequired(e,t,o){return this.instantiationService.createInstance(COe,e,t)}renderDisabledClaudeHooks(e,t){return this.instantiationService.createInstance(xOe,t)}disposeTemplate(e){this.clearRenderedParts(e),e.templateDisposables.dispose()}hoverVisible(e){e.style.opacity="1"}hoverHidden(e){e.style.opacity="0"}};aQ=I([m(6,F),m(7,B),m(8,se),m(9,X),m(10,Le),m(11,ge),m(12,nt),m(13,Pt),m(14,rr),m(15,mi),m(16,lr),m(17,Oi),m(18,At)],aQ);var xKt=class extends yz{constructor(e){super();this.defaultElementHeight=e}estimateHeight(e){return e.currentRenderedHeight??this.defaultElementHeight}getTemplateId(e){return aQ.ID}hasDynamicHeight(e){return!0}};function sLi(a){return a.toolSpecificData?.kind==="subagent"&&!a.subAgentInvocationId}function Fbo(a){return sLi(a)?a.toolCallId:a.subAgentInvocationId}function Obo(a){return!!Fbo(a)}var eU=class extends x{constructor(e,t,o,n,r,s,l){super();this.foreground=t;this.inputEditorBackgroundColor=o;this.resultEditorBackgroundColor=n;this.configurationService=r;this.themeService=s;this.viewDescriptorService=l;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._register(this.themeService.onDidColorThemeChange(c=>this.update())),this._register(this.viewDescriptorService.onDidChangeLocation(c=>{c.views.some(u=>u.id===e)&&this.update()})),this._register(this.configurationService.onDidChangeConfiguration(c=>{eU.relevantSettingIds.some(u=>c.affectsConfiguration(u))&&this.update()})),this.update()}static{this.lineHeightEm=1.4}get configuration(){return this._config}static{this.relevantSettingIds=["chat.editor.lineHeight","chat.editor.fontSize","chat.editor.fontFamily","chat.editor.fontWeight","chat.editor.wordWrap","editor.cursorBlinking","editor.fontLigatures","editor.accessibilitySupport","editor.bracketPairColorization.enabled","editor.bracketPairColorization.independentColorPoolPerBracketType"]}update(){let e=this.configurationService.getValue("editor"),t=this.configurationService.getValue("chat")?.editor,o=this.configurationService.getValue("editor.accessibilitySupport");this._config={foreground:this.themeService.getColorTheme().getColor(this.foreground),inputEditor:{backgroundColor:this.themeService.getColorTheme().getColor(this.inputEditorBackgroundColor),accessibilitySupport:o},resultEditor:{backgroundColor:this.themeService.getColorTheme().getColor(this.resultEditorBackgroundColor),fontSize:t.fontSize,fontFamily:t.fontFamily==="default"?e.fontFamily:t.fontFamily,fontWeight:t.fontWeight,lineHeight:t.lineHeight?t.lineHeight:eU.lineHeightEm*t.fontSize,bracketPairColorization:{enabled:this.configurationService.getValue("editor.bracketPairColorization.enabled"),independentColorPoolPerBracketType:this.configurationService.getValue("editor.bracketPairColorization.independentColorPoolPerBracketType")},wordWrap:t.wordWrap,fontLigatures:e.fontLigatures}},this._onDidChange.fire()}};eU=I([m(4,B),m(5,Le),m(6,Bi)],eU);var Wbo="data-pending-request-id",cin="data-pending-kind",Vbo="chat-pending-dragging",YOe=class extends x{constructor(e,t,o){super();this._getViewModel=t;this._chatService=o;this._insertIndicator=_(".chat-pending-insert-indicator"),e.append(this._insertIndicator),this._register(Z(()=>this._insertIndicator.remove())),this._register(new Uh(e,{onDragOver:n=>this._onDragOver(n),onDragLeave:()=>this._hideIndicator(),onDragEnd:()=>this._onDragEnd(),onDrop:n=>this._onDrop(n)}))}attachDragHandle(e,t,o,n){t.setAttribute("draggable","true"),n.add(j(t,re.DRAG_START,r=>{!r.dataTransfer||!e.pendingKind||(this._dragState={element:e,pendingKind:e.pendingKind},o.classList.add(Vbo),r.dataTransfer.setDragImage(o,0,0),r.dataTransfer.effectAllowed="move")})),n.add(j(t,re.DRAG_END,()=>{o.classList.remove(Vbo),this._onDragEnd()}))}_onDragOver(e){if(!this._dragState)return;let t=this._findDropTarget(e);if(!t){this._hideIndicator();return}e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="move");let o=t.row.getBoundingClientRect(),n=o.top+o.height/2,r=e.clientY<n;this._showIndicator(t.row,r)}_onDrop(e){if(this._hideIndicator(),!this._dragState)return;let t=this._findDropTarget(e);if(!t)return;e.preventDefault();let o=t.row.getBoundingClientRect(),n=o.top+o.height/2,r=e.clientY<n;this._reorder(this._dragState.element,t.requestId,r),this._dragState=void 0}_onDragEnd(){this._hideIndicator(),this._dragState=void 0}_showIndicator(e,t){let o=e.getBoundingClientRect(),n=this._insertIndicator.parentElement.getBoundingClientRect();this._insertIndicator.style.display="block",this._insertIndicator.style.left=`${o.left-n.left}px`,this._insertIndicator.style.width=`${o.width}px`,this._insertIndicator.style.top=t?`${o.top-n.top}px`:`${o.bottom-n.top}px`}_hideIndicator(){this._insertIndicator.style.display="none"}_findDropTarget(e){if(!this._dragState)return;let t=e.target?.closest?.(`[${Wbo}]`);if(!t)return;let o=t.getAttribute(Wbo);if(!(t.getAttribute(cin)!==this._dragState.pendingKind||o===this._dragState.element.id))return{row:t,requestId:o}}_reorder(e,t,o){let n=this._getViewModel();if(!n)return;let r=n.model.getPendingRequests(),s=e.pendingKind,l=[],c=[];for(let f of r)(f.kind===s?l:c).push(f);let u=l.findIndex(f=>f.request.id===e.id);if(u===-1)return;let[p]=l.splice(u,1),h=l.findIndex(f=>f.request.id===t);if(h===-1)return;o||h++,l.splice(h,0,p);let g=(s==="steering"?[...l,...c]:[...c,...l]).map(f=>({requestId:f.request.id,kind:f.kind}));this._chatService.setPendingRequests(n.sessionResource,g)}};YOe=I([m(2,mi)],YOe);var Pie=class extends x{constructor(e,t,o,n,r,s,l,c,u){super();this.instantiationService=o;this.contextKeyService=n;this.chatService=r;this.contextMenuService=s;this.logService=l;this.configurationService=c;this.chatAccessibilityService=u;this._onDidScroll=this._register(new E);this.onDidScroll=this._onDidScroll.event;this._onDidChangeContentHeight=this._register(new E);this.onDidChangeContentHeight=this._onDidChangeContentHeight.event;this._onDidClickFollowup=this._register(new E);this.onDidClickFollowup=this._onDidClickFollowup.event;this._onDidFocus=this._register(new E);this.onDidFocus=this._onDidFocus.event;this._onDidChangeItemHeight=this._register(new E);this.onDidChangeItemHeight=this._onDidChangeItemHeight.event;this._visible=!0;this._mostRecentlyFocusedItemIndex=-1;this._scrollLock=!0;this._suppressAutoScroll=!1;this._settingChangeCounter=0;this._visibleChangeCount=0;this._bodyDimension=null;this._previousLastItemMinHeight=null;this._viewModel=t.viewModel,this._codeBlockModelCollection=t.codeBlockModelCollection??this._register(this.instantiationService.createInstance(sW,"chatListWidget")),this._location=t.location,this._getCurrentLanguageModelId=t.getCurrentLanguageModelId,this._getCurrentModeInfo=t.getCurrentModeInfo,this._lastItemIdContextKey=ie.lastItemId.bindTo(this.contextKeyService),this._container=e;let p=()=>{let y=this.configurationService.getValue("chat.inlineReferences.style");this._container.classList.toggle("chat-inline-references-link-style",y==="link")};p(),this._register(this.configurationService.onDidChangeConfiguration(y=>{y.affectsConfiguration("chat.inlineReferences.style")&&p()}));let h=this._register(this.instantiationService.createChild(new _o([X,this.contextKeyService])));this._renderStyle=t.renderStyle;let g=t.overflowWidgetsDomNode??document.createElement("div");t.overflowWidgetsDomNode||(g.classList.add("chat-overflow-widget-container","monaco-editor"),this._container.append(g),this._register(Z(()=>g.remove())));let f=t.editorOptions??this._register(h.createInstance(eU,t.viewId,"foreground",t.inputEditorBackground??"chat.requestEditor.background",t.resultEditorBackground??"chat.responseEditor.background")),v=h.createInstance(xKt,t.defaultElementHeight??200),b={getListLength:()=>this._tree.getNode(null).visibleChildrenCount,onDidScroll:this.onDidScroll,container:this._container,currentChatMode:t.currentChatMode??(()=>"ask")};this._renderer=this._register(h.createInstance(aQ,f,t.rendererOptions??{},b,this._codeBlockModelCollection,g,this._viewModel)),this._register(this._renderer.onDidClickFollowup(y=>{this._onDidClickFollowup.fire(y)})),this._register(this._renderer.onDidChangeItemHeight(y=>{this._updateElementHeight(y.element,y.height);let w=this._viewModel?.getItems().at(-2);y.element.id===w?.id&&this.updateLastItemMinHeight(),this._onDidChangeItemHeight.fire(y)})),this._register(this._renderer.onDidClickRerunWithAgentOrCommandDetection(y=>{let w=this.chatService.getSession(y.sessionResource)?.getRequests().find(k=>k.id===y.requestId);if(w){let k={noCommandDetection:!0,attempt:w.attempt+1,location:this._location,userSelectedModelId:this._getCurrentLanguageModelId?.(),modeInfo:this._getCurrentModeInfo?.()};this.chatAccessibilityService.acceptRequest(y.sessionResource),this.chatService.resendRequest(w,k).catch(T=>this.logService.error("FAILED to rerun request",T))}})),this._renderer.pendingDragController=this._register(h.createInstance(YOe,this._container,()=>this._viewModel));let S=t.styles??{};this._tree=this._register(h.createInstance(Rg,"ChatList",this._container,v,[this._renderer],{identityProvider:{getId:y=>y.id},horizontalScrolling:!1,alwaysConsumeMouseWheel:!1,supportDynamicHeights:!0,hideTwistiesOfChildlessElements:!0,accessibilityProvider:this.instantiationService.createInstance(zNe),keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:y=>Sr(y)?y.message:Ui(y)?y.response.value:""},setRowLineHeight:!1,scrollToActiveElement:!0,filter:t.filter,overrideStyles:{listFocusBackground:S.listBackground,listInactiveFocusBackground:S.listBackground,listActiveSelectionBackground:S.listBackground,listFocusAndSelectionBackground:S.listBackground,listInactiveSelectionBackground:S.listBackground,listHoverBackground:S.listBackground,listBackground:S.listBackground,listFocusForeground:S.listForeground,listHoverForeground:S.listForeground,listInactiveFocusForeground:S.listForeground,listInactiveSelectionForeground:S.listForeground,listActiveSelectionForeground:S.listForeground,listFocusAndSelectionForeground:S.listForeground,listActiveSelectionIconForeground:void 0,listInactiveSelectionIconForeground:void 0}})),this._scrollDownButton=this._register(new Wi(this._container,{buttonBackground:kt(pj),buttonForeground:kt(ple),buttonHoverBackground:kt(mle),buttonSecondaryBackground:void 0,buttonSecondaryForeground:void 0,buttonSecondaryHoverBackground:void 0,buttonSeparator:void 0,supportIcons:!0})),this._scrollDownButton.element.classList.add("chat-scroll-down"),this._scrollDownButton.label=`$(${R.chevronDown.id})`,this._scrollDownButton.element.style.display="none",this._register(this._scrollDownButton.onDidClick(()=>{this.setScrollLock(!0),this.scrollToEnd()})),this._register(this._tree.onDidChangeContentHeight(()=>{this._onDidChangeContentHeight.fire()})),this._register(this._tree.onDidFocus(()=>{this._onDidFocus.fire()})),this._register(this._tree.onDidChangeFocus(()=>{let y=this.getFocus();if(y&&y.length>0){let w=y[0],T=this.getItems().findIndex(P=>P===w);T!==-1&&(this._mostRecentlyFocusedItemIndex=T)}})),this._register(this._tree.onDidScroll(y=>{this._onDidScroll.fire(y),this.updateScrollDownButtonVisibility()})),this._register(this._tree.onContextMenu(y=>{this.handleContextMenu(y)})),this._register(this.configurationService.onDidChangeConfiguration(y=>{(y.affectsConfiguration("chat.editRequests")||y.affectsConfiguration("chat.checkpoints.enabled"))&&(this._settingChangeCounter++,this.refresh())}))}get onDidClickRequest(){return this._renderer.onDidClickRequest}get onDidRerender(){return this._renderer.onDidRerender}get onDidDispose(){return this._renderer.onDidDispose}get onDidFocusOutside(){return this._renderer.onDidFocusOutside}get domNode(){return this._container}get scrollTop(){return this._tree.scrollTop}set scrollTop(e){this._tree.scrollTop=e}get scrollHeight(){return this._tree.scrollHeight}get renderHeight(){return this._tree.renderHeight}get contentHeight(){return this._tree.contentHeight}get isScrolledToBottom(){return this._tree.scrollTop+this._tree.renderHeight>=this._tree.scrollHeight-2}get lastItem(){return this._lastItem}updateScrollDownButtonVisibility(){let e=!this.isScrolledToBottom&&!this._scrollLock;this._scrollDownButton.element.style.display=e?"":"none"}handleContextMenu(e){e.browserEvent.preventDefault(),e.browserEvent.stopPropagation();let t=e.element,n=e.browserEvent.target.closest(`.${NDe}`)!==null,r=this.contextKeyService.createOverlay([[ie.isResponse.key,Ui(t)],[ie.responseIsFiltered.key,Ui(t)&&!!t.errorDetails?.responseIsFiltered],[ie.isKatexMathElement.key,n]]);this.contextMenuService.showContextMenu({menuId:D.ChatContext,menuActionOptions:{shouldForwardArgs:!0},contextKeyService:r,getAnchor:()=>e.anchor,getActionsContext:()=>t})}setViewModel(e){this._viewModel=e,this._renderer.updateViewModel(e)}refresh(){if(!this._viewModel){this._tree.setChildren(null,[]),this._lastItem=void 0,this._lastItemIdContextKey.set([]);return}let e=this._viewModel.getItems();this._lastItem=e.at(-1),this._lastItemIdContextKey.set(this._lastItem?[this._lastItem.id]:[]);let t=e.map(n=>({element:n,collapsed:!1,collapsible:!1})),o=this._viewModel.editing;this._withPersistedAutoScroll(()=>{this._tree.setChildren(null,t,{diffIdentityProvider:{getId:n=>{let r=Sr(n)||Ui(n)?n.dataId:n.id,s=Sr(n)||Ui(n)?n.shouldBeRemovedOnSend:void 0,l=Sr(n)&&o?.id===n.id,c=Sr(n)||Ui(n)?n.shouldBeBlocked.get():!1;return r+`${Ui(n)&&n.renderData?`_${this._visibleChangeCount}`:""}`+(Ui(n)?`_${n.contentReferences.length}`:"")+`_${s?`${s.afterUndoStop||"1"}`:"0"}_${l?"edit":""}_${c?"blocked":""}`+(Sr(n)?`_${o?"1":"0"}`:"")+`_setting${this._settingChangeCounter}`+(Sr(n)&&n.contentReferences?`_${n.contentReferences?.length}`:"")}}})})}setScrollLock(e){this._scrollLock=e,this.updateScrollDownButtonVisibility()}get scrollLock(){return this._scrollLock}setVisibleChangeCount(e){this._visibleChangeCount=e}scrollToCurrentItem(e){if(!this._viewModel?.editing||!e||!this._tree.hasElement(e))return;let t=this._tree.getRelativeTop(e);(t===null||t<0||t>1)&&this._tree.reveal(e,0)}rerender(){this._tree.rerender()}getItems(){let e=[],t=this._tree.getNode(null);for(let o of t.children)o.element&&e.push(o.element);return e}delegateScrollFromMouseWheelEvent(e){this._tree.delegateScrollFromMouseWheelEvent(e)}hasElement(e){return this._tree.hasElement(e)}_updateElementHeight(e,t){this._tree.hasElement(e)&&this._visible&&this._withPersistedAutoScroll(()=>{this._tree.updateElementHeight(e,t)})}reveal(e,t){this._tree.reveal(e,t)}getFocus(){return this._tree.getFocus().filter(e=>e!==null)}setFocus(e){this._tree.setFocus(e)}focusItem(e){this.hasElement(e)&&(this._tree.setFocus([e]),this._tree.domFocus())}focusLastItem(e){let t=this.getItems();if(t.length===0)return-1;let o;return e&&this._mostRecentlyFocusedItemIndex>=0&&this._mostRecentlyFocusedItemIndex<t.length?o=this._mostRecentlyFocusedItemIndex:o=t.length-1,this._tree.setFocus([t[o]]),this._tree.domFocus(),o}scrollToEnd(){if(this._lastItem){let e=Math.max(this._lastItem.currentRenderedHeight??0,1e6);this._tree.hasElement(this._lastItem)&&this._tree.reveal(this._lastItem,e)}}set suppressAutoScroll(e){this._suppressAutoScroll=e}_withPersistedAutoScroll(e){if(this._suppressAutoScroll){e();return}let t=this.isScrolledToBottom;e(),t&&this.scrollToEnd()}focus(){this._tree.domFocus()}isDOMFocused(){return this._tree.isDOMFocused()}getCodeBlockInfosForResponse(e){return this._renderer.getCodeBlockInfosForResponse(e)}getCodeBlockInfoForEditor(e){return this._renderer.getCodeBlockInfoForEditor(e)}getFileTreeInfosForResponse(e){return this._renderer.getFileTreeInfosForResponse(e)}getLastFocusedFileTreeForResponse(e){return this._renderer.getLastFocusedFileTreeForResponse(e)}editorsInUse(){return this._renderer.editorsInUse()}getTemplateDataForRequestId(e){if(e)return this._renderer.getTemplateDataForRequestId(e)}updateRendererOptions(e){this._renderer.updateOptions(e)}setVisible(e){this._visible=e,this._renderer.setVisible(e)}layout(e,t){this._bodyDimension=new si(t??this._container.clientWidth,e),this.updateLastItemMinHeight(),this._tree.layout(e,t),this._renderer.layout(t??this._container.clientWidth)}updateLastItemMinHeight(){if(!this._bodyDimension)return;let e=this._bodyDimension.height;if(this._renderStyle==="compact"||this._renderStyle==="minimal")this._container.style.removeProperty("--chat-current-response-min-height");else{let t=this._viewModel?.getItems().at(-2),n=Math.min(Sr(t)||Ui(t)?t.currentRenderedHeight??150:150,200),r=Math.max(e-(n+10),0);if(this._container.style.setProperty("--chat-current-response-min-height",r+"px"),r!==this._previousLastItemMinHeight){this._previousLastItemMinHeight=r;let s=this._viewModel?.getItems().at(-1);s&&this._visible&&this._tree.hasElement(s)&&this._updateElementHeight(s,void 0)}}}};Pie=I([m(2,F),m(3,X),m(4,mi),m(5,Xe),m(6,se),m(7,B),m(8,NF)],Pie);var aLi=class extends x{constructor(){super(...arguments);this.descriptors=[];this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event}register(e){this.descriptors.push(e),this._onDidChange.fire()}get(){return this.descriptors}},tU=new aLi;ne.add("workbench.registry.chat.viewsWelcome",tU);var Uot=_,XOe=class extends x{constructor(e,t,o,n,r){super();this.container=e;this.delegate=t;this.location=o;this.contextKeyService=n;this.instantiationService=r;this.enabled=!1;this.enabledDisposables=this._register(new N);this.renderDisposables=this._register(new N);this._isShowingWelcome=Me(this,!1);this.element=M(this.container,_(".chat-view-welcome")),this._register(U.runAndSubscribe(t.onDidChangeViewWelcomeState,()=>this.update())),this._register(tU.onDidChange(()=>this.update(!0)))}get isShowingWelcome(){return this._isShowingWelcome}getMatchingWelcomeView(){return tU.get().filter(o=>this.contextKeyService.contextMatchesRules(o.when)).at(0)}update(e){let t=this.delegate.shouldShowWelcome();if(this.enabled===t&&!e)return;if(this.enabled=t,this.enabledDisposables.clear(),!t){this.container.classList.toggle("chat-view-welcome-visible",!1),this.renderDisposables.clear(),this._isShowingWelcome.set(!1,void 0);return}let o=tU.get();if(o.length){this.render(o);let n=new Set(o.flatMap(r=>r.when.keys()));this.enabledDisposables.add(this.contextKeyService.onDidChangeContext(r=>{r.affectsSome(n)&&this.render(o)}))}}render(e){this.renderDisposables.clear(),Rt(this.element);let o=e.filter(n=>this.contextKeyService.contextMatchesRules(n.when)).at(0);if(o){let n={icon:o.icon,title:o.title,message:o.content},r=this.renderDisposables.add(this.instantiationService.createInstance(Tge,n,{firstLinkToButton:!0,location:this.location}));this.element.appendChild(r.element),this.container.classList.toggle("chat-view-welcome-visible",!0),this._isShowingWelcome.set(!0,void 0)}else this.container.classList.toggle("chat-view-welcome-visible",!1),this._isShowingWelcome.set(!1,void 0)}};XOe=I([m(3,X),m(4,F)],XOe);var Tge=class extends x{constructor(e,t,o,n,r){super();this.content=e;this.openerService=o;this.logService=n;this.markdownRendererService=r;this.element=_(".chat-welcome-view");try{let s=M(this.element,Uot(".chat-welcome-view-icon"));if(e.useLargeIcon&&s.classList.add("large-icon"),e.icon){if(q.isThemeIcon(e.icon)){let p=Sn(e.icon);s.appendChild(p)}else if(A.isUri(e.icon)){let p=Qa(e.icon),h=new Yy;h.update(p);let g=`chat-welcome-icon-${h.digest()}`,f=`.chat-welcome-view-icon.${g}`;$h(f,`
					mask: ${p} no-repeat 50% 50%;
					-webkit-mask: ${p} no-repeat 50% 50%;
					background-color: var(--vscode-icon-foreground);
				`),s.classList.add(g,"custom-icon")}}let l=M(this.element,Uot(".chat-welcome-view-title"));l.textContent=e.title;let c=M(this.element,Uot(".chat-welcome-view-message")),u=this.renderMarkdownMessageContent(e.message,t);if(M(c,u.element),e.additionalMessage){let p=M(this.element,Uot(".chat-welcome-view-disclaimer"));if(typeof e.additionalMessage=="string")p.textContent=e.additionalMessage;else{let h=this.renderMarkdownMessageContent(e.additionalMessage,t);p.appendChild(h.element)}}if(e.tips){let p=M(this.element,Uot(".chat-welcome-view-tips")),h=this._register(this.markdownRendererService.render(e.tips));p.appendChild(h.element)}}catch(s){this.logService.error("Failed to render chat view welcome content",s)}}needsRerender(e){return this.content.title!==e.title||this.content.message.value!==e.message.value||this.content.additionalMessage!==e.additionalMessage||this.content.tips?.value!==e.tips?.value}renderMarkdownMessageContent(e,t){let o=this._register(this.markdownRendererService.render(e)),n=t?.firstLinkToButton?o.element.querySelector("a"):void 0;if(n){let r=n.getAttribute("data-href"),s=this._register(new Wi(n.parentElement,Qo));s.label=n.textContent??"",r&&this._register(s.onDidClick(()=>{this.openerService.open(r,{allowCommands:!0})})),n.replaceWith(s.element)}return o}};Tge=I([m(2,Je),m(3,se),m(4,On)],Tge);var kKt=class a extends x{constructor(e,t,o){super();this._chatService=e;this._storageService=t;this._getActiveContextKeyService=o;this._register(this._chatService.onDidSubmitRequest(n=>{let r=n.message??this._chatService.getSession(n.chatSessionResource)?.lastRequest?.message;if(!r)return;for(let c of r.parts)if(c.kind===UC.Kind){let u=c;if(a._isCreateSlashCommand(u.slashCommand.command)){this._markUsed();return}}let s=r.text.trimStart(),l=/^\/(create-(?:instructions|prompt|agent|skill))(?:\s|$)/.exec(s);l&&a._isCreateSlashCommand(l[1])&&this._markUsed()}))}static{this._USED_CREATE_SLASH_COMMANDS_KEY="chat.tips.usedCreateSlashCommands"}syncContextKey(e){let t=this._storageService.getBoolean(a._USED_CREATE_SLASH_COMMANDS_KEY,-1,!1);ie.hasUsedCreateSlashCommands.bindTo(e).set(t)}_markUsed(){if(this._storageService.getBoolean(a._USED_CREATE_SLASH_COMMANDS_KEY,-1,!1))return;this._storageService.store(a._USED_CREATE_SLASH_COMMANDS_KEY,!0,-1,1);let e=this._getActiveContextKeyService();e&&ie.hasUsedCreateSlashCommands.bindTo(e).set(!0)}static _isCreateSlashCommand(e){switch(e){case"create-instructions":case"create-prompt":case"create-agent":case"create-skill":return!0;default:return!1}}};var pN={DismissedTips:"chat.tip.dismissed",LastTipId:"chat.tip.lastTipId",ThinkingPhrasesEverModified:"chat.tip.thinkingPhrasesEverModified"},_ge={ExecutedCommands:"chat.tips.executedCommands",UsedModes:"chat.tips.usedModes",InvokedTools:"chat.tips.invokedTools"},JD={AttachFilesReferenceUsed:"chat.tips.attachFiles.referenceUsed",CreateAgentInstructionsUsed:"chat.tips.createAgentInstructions.commandUsed",CreatePromptUsed:"chat.tips.createPrompt.commandUsed",CreateAgentUsed:"chat.tips.createAgent.commandUsed",CreateSkillUsed:"chat.tips.createSkill.commandUsed",ForkConversationUsed:"chat.tips.forkConversation.commandUsed"};var Dge=class extends x{constructor(e,t,o,n,r,s){super();this._storageService=o;this._promptsService=n;this._languageModelToolsService=r;this._logService=s;this._commandListener=this._register(new me);this._toolListener=this._register(new me);this._excludedByFiles=new Set;this._fileCheckGeneration=new Map;this._fileChecksInFlight=new Map;let l=this._readApplicationWithProfileFallback(_ge.ExecutedCommands);this._executedCommands=new Set(l?JSON.parse(l):[]);let c=this._readApplicationWithProfileFallback(_ge.UsedModes);this._usedModes=new Set(c?JSON.parse(c):[]);let u=this._readApplicationWithProfileFallback(_ge.InvokedTools);this._invokedTools=new Set(u?JSON.parse(u):[]),this._pendingCommands=new Set;for(let p of e)for(let h of p.excludeWhenCommandsExecuted??[])this._executedCommands.has(h)||this._pendingCommands.add(h);this._pendingModes=new Set;for(let p of e)for(let h of p.excludeWhenModesUsed??[])this._usedModes.has(h)||this._pendingModes.add(h);this._pendingTools=new Set;for(let p of e)for(let h of p.excludeWhenToolsInvoked??[])this._invokedTools.has(h)||this._pendingTools.add(h);this._pendingCommands.size>0&&(this._commandListener.value=t.onDidExecuteCommand(p=>{this.recordCommandExecuted(p.commandId)})),this._pendingTools.size>0&&(this._toolListener.value=this._languageModelToolsService.onDidInvokeTool(p=>{this._pendingTools.has(p.toolId)&&(this._invokedTools.add(p.toolId),this._pendingTools.delete(p.toolId),this._persistSet(_ge.InvokedTools,this._invokedTools)),this._pendingTools.size===0&&this._toolListener.clear()})),this._tipsWithFileExclusions=e.filter(p=>p.excludeWhenPromptFilesExist);for(let p of this._tipsWithFileExclusions)p.excludeWhenPromptFilesExist.excludeUntilChecked&&this._excludedByFiles.add(p.id),this._checkForPromptFiles(p);this._register(this._promptsService.onDidChangeCustomAgents(()=>{for(let p of this._tipsWithFileExclusions)p.excludeWhenPromptFilesExist.promptType==="agent"&&this._checkForPromptFiles(p)}))}recordCommandExecuted(e){this._pendingCommands.has(e)&&(this._executedCommands.add(e),this._persistSet(_ge.ExecutedCommands,this._executedCommands),this._pendingCommands.delete(e),this._pendingCommands.size===0&&this._commandListener.clear())}recordCurrentMode(e){if(this._pendingModes.size===0)return;let t=!1,o=e.getContextKeyValue(ie.chatModeKind.key);o&&!this._usedModes.has(o)&&(this._usedModes.add(o),this._pendingModes.delete(o),t=!0);let n=e.getContextKeyValue(ie.chatModeName.key);n&&!this._usedModes.has(n)&&(this._usedModes.add(n),this._pendingModes.delete(n),t=!0),t&&this._persistSet(_ge.UsedModes,this._usedModes)}isExcluded(e){if(e.excludeWhenCommandsExecuted){for(let t of e.excludeWhenCommandsExecuted)if(this._executedCommands.has(t))return this._logService.debug("#ChatTips: tip excluded because command was executed",e.id,t),!0}if(e.excludeWhenModesUsed){for(let t of e.excludeWhenModesUsed)if(this._usedModes.has(t))return this._logService.debug("#ChatTips: tip excluded because mode was used",e.id,t),!0}if(e.excludeWhenToolsInvoked){for(let t of e.excludeWhenToolsInvoked)if(this._invokedTools.has(t))return this._logService.debug("#ChatTips: tip excluded because tool was invoked",e.id,t),!0}return e.excludeWhenPromptFilesExist&&this._excludedByFiles.has(e.id)?(this._logService.debug("#ChatTips: tip excluded because prompt files exist",e.id),!0):!1}refreshPromptFileExclusions(){for(let e of this._tipsWithFileExclusions)e.excludeWhenPromptFilesExist.excludeUntilChecked&&this._excludedByFiles.add(e.id),this._checkForPromptFiles(e)}async _checkForPromptFiles(e){let t=this._fileChecksInFlight.get(e.id);if(t){await t;return}let o=this._doCheckForPromptFiles(e);this._fileChecksInFlight.set(e.id,o);try{await o}finally{this._fileChecksInFlight.get(e.id)===o&&this._fileChecksInFlight.delete(e.id)}}async _doCheckForPromptFiles(e){let t=e.excludeWhenPromptFilesExist,o=(this._fileCheckGeneration.get(e.id)??0)+1;this._fileCheckGeneration.set(e.id,o);try{let[n,r]=await Promise.all([this._promptsService.listPromptFiles(t.promptType,Se.None),t.agentFileType?this._promptsService.listAgentInstructions(Se.None):Promise.resolve([])]);if(this._fileCheckGeneration.get(e.id)!==o)return;let s=n.length>0,l=t.agentFileType?r.some(u=>u.type===t.agentFileType):!1;s||l?this._excludedByFiles.add(e.id):this._excludedByFiles.delete(e.id)}catch{if(this._fileCheckGeneration.get(e.id)!==o)return;t.excludeUntilChecked&&this._excludedByFiles.add(e.id)}}_persistSet(e,t){this._storageService.store(e,JSON.stringify([...t]),-1,1)}_readApplicationWithProfileFallback(e){let t=this._storageService.get(e,-1);if(t)return t;let o=this._storageService.get(e,0);return o&&this._storageService.store(e,o,-1,1),o}};Dge=I([m(1,ge),m(2,ce),m(3,Or),m(4,Vn),m(5,se)],Dge);function Lge(a,i){let e=a.keybindingService.lookupKeybinding(i);return e?` (${e.getLabel()})`:""}function lLi(a){let i=/\[.*?\]\(command:([^?\s)]+)/g,e=new Set,t;for(;(t=i.exec(a))!==null;)e.add(t[1]);return[...e]}var yW=[{id:"tip.switchToAuto",tier:"foundational",priority:0,buildMessage(a){return new Ie(d(7347,null))},onlyWhenModelIds:["gpt-4.1"]},{id:"tip.init",tier:"foundational",priority:50,buildMessage(a){let i=Lge(a,x2);return new Ie(d(7342,null,"/init",x2,i))},when:ie.chatSessionType.isEqualTo(sc),excludeWhenCommandsExecuted:[x2,JD.CreateAgentInstructionsUsed]},{id:"tip.createPrompt",tier:"foundational",buildMessage(a){let i=Lge(a,m3);return new Ie(d(7339,null,"/create-prompt",m3,i))},when:ie.chatSessionType.isEqualTo(sc),excludeWhenCommandsExecuted:[m3,JD.CreatePromptUsed]},{id:"tip.createAgent",tier:"foundational",priority:30,buildMessage(a){let i=Lge(a,g3);return new Ie(d(7338,null,"/create-agent",g3,i))},when:ie.chatSessionType.isEqualTo(sc),excludeWhenCommandsExecuted:[g3,JD.CreateAgentUsed]},{id:"tip.createSkill",tier:"foundational",priority:40,buildMessage(a){let i=Lge(a,h3);return new Ie(d(7340,null,"/create-skill",h3,i))},when:ie.chatSessionType.isEqualTo(sc),excludeWhenCommandsExecuted:[h3,JD.CreateSkillUsed]},{id:"tip.planMode",tier:"foundational",priority:20,buildMessage(a){let i=Lge(a,"workbench.action.chat.openPlan");return new Ie(d(7345,null,"Plan agent",i))},when:ie.chatModeName.notEqualsTo("Plan"),excludeWhenCommandsExecuted:["workbench.action.chat.openPlan"],excludeWhenModesUsed:["Plan"]},{id:"tip.attachFiles",tier:"qol",buildMessage(){return new Ie(d(7335,null))},excludeWhenCommandsExecuted:["workbench.action.chat.attachContext","workbench.action.chat.attachFile","workbench.action.chat.attachFolder","workbench.action.chat.attachSelection",JD.AttachFilesReferenceUsed]},{id:"tip.codeActions",tier:"qol",buildMessage(){return new Ie(d(7337,null))},excludeWhenCommandsExecuted:["inlineChat.start"]},{id:"tip.undoChanges",tier:"qol",buildMessage(){return new Ie(d(7350,null))},when:C.and(ie.chatSessionType.isEqualTo(sc),C.or(ie.chatModeKind.isEqualTo("agent"),ie.chatModeKind.isEqualTo("edit"))),excludeWhenCommandsExecuted:["workbench.action.chat.restoreCheckpoint","workbench.action.chat.restoreLastCheckpoint"]},{id:"tip.messageQueueing",tier:"qol",buildMessage(){return new Ie(d(7344,null))},when:ie.chatModeKind.isEqualTo("agent"),excludeWhenCommandsExecuted:["workbench.action.chat.queueMessage","workbench.action.chat.steerWithMessage"]},{id:"tip.forkConversation",tier:"qol",buildMessage(a){let i=Lge(a,xXe);return new Ie(d(7341,null,"/fork",xXe,i))},excludeWhenCommandsExecuted:[xXe,"workbench.action.chat.forkConversation",JD.ForkConversationUsed]},{id:"tip.agenticBrowser",tier:"qol",buildMessage(){return new Ie(d(7334,null,"agentic browser integration"))},when:C.and(ie.chatModeKind.isEqualTo("agent"),C.notEquals("config.workbench.browser.enableChatTools",!0)),excludeWhenSettingsChanged:["workbench.browser.enableChatTools"],dismissWhenCommandsClicked:["workbench.action.openSettings"]},{id:"tip.mermaid",tier:"qol",buildMessage(){return new Ie(d(7343,null))},when:ie.chatModeKind.isEqualTo("agent"),excludeWhenToolsInvoked:["renderMermaidDiagram"]},{id:"tip.subagents",tier:"qol",buildMessage(){return new Ie(d(7346,null))},when:ie.chatModeKind.isEqualTo("agent"),excludeWhenToolsInvoked:["runSubagent"]},{id:"tip.thinkingPhrases",tier:"qol",buildMessage(){return new Ie(d(7348,null,"thinking phrases","chat.agent.thinking.phrases"))},when:ie.chatModeKind.isEqualTo("agent"),excludeWhenSettingsChanged:["chat.agent.thinking.phrases"],dismissWhenCommandsClicked:["workbench.action.openSettings"]},{id:"tip.autoAcceptDelay",tier:"qol",buildMessage(){return new Ie(d(7336,null,"auto-accept delay"))},when:C.or(ie.chatModeKind.isEqualTo("agent"),ie.chatModeKind.isEqualTo("edit")),excludeWhenSettingsChanged:["chat.editing.autoAcceptDelay"],dismissWhenCommandsClicked:["workbench.action.openSettings"]},{id:"tip.troubleshoot",tier:"qol",buildMessage(a){let i=Lge(a,nOt);return new Ie(d(7349,null,"/troubleshoot",nOt,i))},when:ie.chatSessionType.isEqualTo(sc),excludeWhenToolsInvoked:["listDebugEvents"]}];var RQp=JD.AttachFilesReferenceUsed,din=JD.CreateAgentInstructionsUsed,uin=JD.CreatePromptUsed,pin=JD.CreateAgentUsed,min=JD.CreateSkillUsed,hin=JD.ForkConversationUsed,wW=le("chatTipService"),JOe=class extends x{constructor(e,t,o,n,r,s,l,c,u,p){super();this._productService=e;this._configurationService=t;this._storageService=o;this._chatService=n;this._logService=s;this._chatEntitlementService=l;this._commandService=c;this._telemetryService=u;this._keybindingService=p;this._onDidDismissTip=this._register(new E);this.onDidDismissTip=this._onDidDismissTip.event;this._onDidNavigateTip=this._register(new E);this.onDidNavigateTip=this._onDidNavigateTip.event;this._onDidHideTip=this._register(new E);this.onDidHideTip=this._onDidHideTip.event;this._onDidDisableTips=this._register(new E);this.onDidDisableTips=this._onDidDisableTips.event;this._tipsHiddenForSession=!1;this._tipCommandListener=this._register(new me);this._tracker=this._register(r.createInstance(Dge,yW)),this._createSlashCommandsUsageTracker=this._register(new kKt(this._chatService,this._storageService,()=>this._contextKeyService)),this._register(this._chatEntitlementService.onDidChangeQuotaExceeded(()=>{this._chatEntitlementService.quotas.chat?.percentRemaining===0&&this._shownTip&&this.hideTip()})),this._register(this._chatService.onDidSubmitRequest(h=>{let g=h.message??this._chatService.getSession(h.chatSessionResource)?.lastRequest?.message;if(!g)return;this._hasFileOrFolderReference(g)&&this._tracker.recordCommandExecuted(JD.AttachFilesReferenceUsed);let f=this._getSlashCommandTrackingId(g);f&&this._tracker.recordCommandExecuted(f),this._hideShownTipIfNowIneligible()})),this._thinkingPhrasesEverModified=this._storageService.getBoolean(pN.ThinkingPhrasesEverModified,-1,!1),!this._thinkingPhrasesEverModified&&this._isSettingModified("chat.agent.thinking.phrases")&&(this._thinkingPhrasesEverModified=!0,this._storageService.store(pN.ThinkingPhrasesEverModified,!0,-1,1)),this._thinkingPhrasesEverModified||this._register(this._configurationService.onDidChangeConfiguration(h=>{h.affectsConfiguration("chat.agent.thinking.phrases")&&(this._thinkingPhrasesEverModified=!0,this._storageService.store(pN.ThinkingPhrasesEverModified,!0,-1,1))}))}_hasFileOrFolderReference(e){return e.parts.some(t=>{if(t.kind!==HR.Kind)return!1;let o=t;return o.isFile===!0||o.isDirectory===!0})}_getSlashCommandTrackingId(e){for(let n of e.parts){if(n.kind===UC.Kind){let r=n.slashCommand.command;return this._toSlashCommandTrackingId(r)}if(n.kind===Xf.Kind){let r=n.command.name;return this._toSlashCommandTrackingId(r)}}let t=e.text.trimStart(),o=/^(?:@\S+\s+)?\/(init|create-(?:instructions|prompt|agent|skill)|fork)(?:\s|$)/.exec(t);return o?this._toSlashCommandTrackingId(o[1]):void 0}_toSlashCommandTrackingId(e){switch(e){case"init":case"create-instructions":return din;case"create-prompt":return uin;case"create-agent":return pin;case"create-skill":return min;case"fork":return hin;default:return}}recordSlashCommandUsage(e){let t=this._toSlashCommandTrackingId(e);t&&(this._tracker.recordCommandExecuted(t),this._hideShownTipIfNowIneligible())}resetSession(){this._shownTip=void 0,this._tipRequestId=void 0,this._contextKeyService=void 0,this._tipsHiddenForSession=!1}dismissTip(){if(this._shownTip){this._logTipTelemetry(this._shownTip.id,"dismissed");let e=new Set(this._getDismissedTipIds());e.add(this._shownTip.id),this._storageService.store(pN.DismissedTips,JSON.stringify([...e]),-1,1)}this._tipRequestId=void 0,this._onDidDismissTip.fire()}dismissTipForSession(){this.dismissTip(),this.hideTipsForSession()}clearDismissedTips(){this._storageService.remove(pN.DismissedTips,-1),this._storageService.remove(pN.DismissedTips,0),this._shownTip=void 0,this._tipRequestId=void 0,this._contextKeyService=void 0,this._tipsHiddenForSession=!1,this._onDidDismissTip.fire()}_getDismissedTipIds(){let e=this._readApplicationWithProfileFallback(pN.DismissedTips);if(!e)return[];try{let t=JSON.parse(e);if(this._logService.debug("#ChatTips dismissed:",t),!Array.isArray(t))return[];let o=new Set(yW.map(r=>r.id)),n=new Set;for(let r of t)typeof r=="string"&&o.has(r)&&n.add(r);return[...n]}catch{return[]}}hideTip(){this._shownTip&&this._logTipTelemetry(this._shownTip.id,"hidden"),this._shownTip=void 0,this._tipRequestId=void 0,this._onDidHideTip.fire()}hideTipsForSession(){this._tipsHiddenForSession||(this._tipsHiddenForSession=!0,this._shownTip=void 0,this._tipRequestId=void 0,this._onDidHideTip.fire())}async disableTips(){this._shownTip&&this._logTipTelemetry(this._shownTip.id,"disabled"),this._shownTip=void 0,this._tipRequestId=void 0,await this._configurationService.updateValue("chat.tips.enabled",!1,1),this._onDidDisableTips.fire()}getWelcomeTip(e){if(this._createSlashCommandsUsageTracker.syncContextKey(e),this._tracker.recordCurrentMode(e),this._tracker.refreshPromptFileExclusions(),!this._configurationService.getValue("chat.tips.enabled")||this._tipsHiddenForSession||(this._contextKeyService=e,!this._isCopilotEnabled())||this._chatEntitlementService.entitlement===1||!this._isChatLocation(e)||e.getContextKeyValue(ie.foregroundSessionCount.key)!==1||this._isChatQuotaExceeded(e))return;if(this._tipRequestId==="welcome"&&this._shownTip){if(this._shownTip.id!=="tip.switchToAuto"){let n=yW.find(r=>r.id==="tip.switchToAuto");if(n&&!new Set(this._getDismissedTipIds()).has(n.id)&&this._isEligible(n,e)){this._shownTip=n,this._storageService.store(pN.LastTipId,n.id,-1,0);let s=this._createTip(n);return this._logTipTelemetry(n.id,"shown"),this._trackTipCommandClicks(n),this._onDidNavigateTip.fire(s),s}}if(!this._isEligible(this._shownTip,e)){if(this._tracker.isExcluded(this._shownTip)){this.hideTip();return}let n=this._findNextEligibleTip(this._shownTip.id,e);if(n){this._shownTip=n,this._storageService.store(pN.LastTipId,n.id,-1,0);let r=this._createTip(n);return this._onDidNavigateTip.fire(r),r}this.hideTip();return}return this._createTip(this._shownTip)}return this._pickTip("welcome",e)}_findNextEligibleTip(e,t){this._createSlashCommandsUsageTracker.syncContextKey(t);let o=yW.findIndex(r=>r.id===e);if(o===-1)return;let n=new Set(this._getDismissedTipIds());for(let r=1;r<yW.length;r++){let s=(o+r)%yW.length,l=yW[s];if(!n.has(l.id)&&this._isEligible(l,t))return l}}_hideShownTipIfNowIneligible(){!this._shownTip||!this._contextKeyService||this._tipsHiddenForSession||this._isEligible(this._shownTip,this._contextKeyService)||this.hideTip()}_pickTip(e,t){this._createSlashCommandsUsageTracker.syncContextKey(t),this._tracker.recordCurrentMode(t);let o=new Set(this._getDismissedTipIds()),n=yW.filter(s=>!o.has(s.id)&&this._isEligible(s,t)),r=this._selectTipByTier(n);if(r)return this._storageService.store(pN.LastTipId,r.id,-1,0),this._tipRequestId=e,this._shownTip=r,this._logTipTelemetry(r.id,"shown"),this._trackTipCommandClicks(r),this._createTip(r)}_selectTipByTier(e){let t=e.filter(r=>r.tier==="foundational");if(t.length)return this._sortByPriorityAndCatalogOrder(t)[0];let o=e.filter(r=>r.tier==="qol");if(!o.length)return;let n=Math.floor(Math.random()*o.length);return o[n]}navigateToNextTip(){if(this._contextKeyService)return this._navigateTip(1,this._contextKeyService)}navigateToPreviousTip(){if(this._contextKeyService)return this._navigateTip(-1,this._contextKeyService)}getNextEligibleTip(){if(!this._contextKeyService||!this._shownTip)return;let e=this._contextKeyService;this._createSlashCommandsUsageTracker.syncContextKey(e);let t=this._shownTip.id,o=this._getOrderedEligibleTips(e,{includeTipId:t});if(!o.length)return;let n=o.findIndex(s=>s.id===t),r=this._getNextTipFromOrderedList(o,n,t);if(r)return this._shownTip=r,this._tipRequestId="welcome",this._storageService.store(pN.LastTipId,r.id,-1,0),this._logTipTelemetry(r.id,"shown"),this._trackTipCommandClicks(r),this._createTip(r)}_getNextTipFromOrderedList(e,t,o){if(!e.length)return;let r=t===-1?0:t;for(let s=1;s<=e.length;s++){let l=(r+s)%e.length,c=e[l];if(c.id!==o)return c}}hasMultipleTips(){return this._contextKeyService?(this._createSlashCommandsUsageTracker.syncContextKey(this._contextKeyService),this._hasNavigableTip(this._contextKeyService)):!1}_navigateTip(e,t){if(this._createSlashCommandsUsageTracker.syncContextKey(t),!this._shownTip)return;let o=this._getOrderedEligibleTips(t);if(!o.length)return;let n=o.findIndex(c=>c.id===this._shownTip.id);if(o.length===1&&n!==-1)return;let r=e===1?0:o.length-1,s=n===-1?r:(n+e+o.length)%o.length,l=o[s];if(l){this._logTipTelemetry(this._shownTip.id,e===1?"navigateNext":"navigatePrevious"),this._shownTip=l,this._tipRequestId="welcome",this._storageService.store(pN.LastTipId,l.id,-1,0),this._logTipTelemetry(l.id,"shown"),this._trackTipCommandClicks(l);let c=this._createTip(l);return this._onDidNavigateTip.fire(c),c}}_hasNavigableTip(e){let t=this._getOrderedEligibleTips(e);return t.length?this._shownTip?t.length>1?!0:t[0].id!==this._shownTip.id:t.length>1:!1}_getOrderedEligibleTips(e,t){let o=new Set(this._getDismissedTipIds()),n=yW.filter(l=>t?.includeTipId&&l.id===t.includeTipId?!0:t?.excludeShownTip&&this._shownTip&&l.id===this._shownTip.id?!1:!o.has(l.id)&&this._isEligible(l,e)),r=this._sortByPriorityAndCatalogOrder(n.filter(l=>l.tier==="foundational")),s=this._sortByPriorityAndCatalogOrder(n.filter(l=>l.tier==="qol"));return[...r,...s]}_sortByPriorityAndCatalogOrder(e){return[...e].sort((t,o)=>{let n=t.priority??Number.POSITIVE_INFINITY,r=o.priority??Number.POSITIVE_INFINITY;if(n!==r)return n-r;let s=yW.findIndex(c=>c.id===t.id),l=yW.findIndex(c=>c.id===o.id);return s-l})}_isEligible(e,t){if(e.onlyWhenModelIds?.length){let o=this._getCurrentChatModelId(t);if(!e.onlyWhenModelIds.some(r=>o===r||o.startsWith(`${r}-`)))return!1}return e.excludeWhenSettingsChanged?.some(o=>this._isSettingModified(o))?(this._logService.debug("#ChatTips: tip excluded because setting was modified",e.id,e.excludeWhenSettingsChanged),!1):e.when&&!t.contextMatchesRules(e.when)?(this._logService.debug("#ChatTips: tip is not eligible due to when clause",e.id,e.when.serialize()),!1):this._tracker.isExcluded(e)?!1:e.id==="tip.thinkingPhrases"&&this._thinkingPhrasesEverModified?(this._logService.debug("#ChatTips: tip excluded because thinking phrases setting was previously modified",e.id),!1):(this._logService.debug("#ChatTips: tip is eligible",e.id),!0)}_isSettingModified(e){let t=this._configurationService.inspect(e);return t.userValue!==void 0||t.userLocalValue!==void 0||t.userRemoteValue!==void 0||t.workspaceValue!==void 0||t.workspaceFolderValue!==void 0}_getCurrentChatModelId(e){let t=l=>{let c=l?.toLowerCase()??"";return c?c.includes("/")?c.split("/").at(-1)??"":c:""},o=t(e.getContextKeyValue(ie.chatModelId.key));if(o)return o;let n=e.getContextKeyValue(ie.location.key)??"panel",r=e.getContextKeyValue(ie.chatSessionType.key)??"",s=r?[`chat.currentLanguageModel.${n}.${r}`,`chat.currentLanguageModel.${n}`]:[`chat.currentLanguageModel.${n}`];for(let l of s){let c=this._storageService.get(l,-1),u=t(c);if(u)return u}return""}_isChatLocation(e){let t=e.getContextKeyValue(ie.location.key);return!t||t==="panel"}_isChatQuotaExceeded(e){return e.getContextKeyValue(ie.chatQuotaExceeded.key)===!0}_isCopilotEnabled(){return!!this._productService.defaultChatAgent?.chatExtensionId}_createTip(e){let t={keybindingService:this._keybindingService},o=e.buildMessage(t),n=d(7351,null,o.value),r=lLi(n),s=new Ie(n,{isTrusted:r.length>0?{enabledCommands:r}:!1});return{id:e.id,content:s,enabledCommands:r}}_logTipTelemetry(e,t,o){this._telemetryService.publicLog2("chatTip",{tipId:e,action:t,commandId:o})}_trackTipCommandClicks(e){this._tipCommandListener.clear();let t={keybindingService:this._keybindingService},o=e.buildMessage(t),n=lLi(o.value);if(!n.length)return;let r=new Set(n);this._tipCommandListener.value=this._commandService.onDidExecuteCommand(s=>{r.has(s.commandId)&&this._shownTip?.id===e.id&&(this._logTipTelemetry(e.id,"commandClicked",s.commandId),this.dismissTip())})}_readApplicationWithProfileFallback(e){let t=this._storageService.get(e,-1);if(t)return t;let o=this._storageService.get(e,0);return o&&this._storageService.store(e,o,-1,1),o}};JOe=I([m(0,tt),m(1,B),m(2,ce),m(3,mi),m(4,F),m(5,se),m(6,rr),m(7,ge),m(8,Te),m(9,_e)],JOe);var Bbo=_,ZOe=class extends x{constructor(e,t,o,n,r,s,l,c,u,p){super();this._renderer=t;this._chatTipService=o;this._contextMenuService=n;this._menuService=r;this._contextKeyService=s;this._instantiationService=l;this._openerService=c;this._commandService=u;this._chatEntitlementService=p;this._onDidHide=this._register(new E);this.onDidHide=this._onDidHide.event;this._renderedContent=this._register(new me);this._toolbar=this._register(new me);this.domNode=Bbo(".chat-tip-widget"),this.domNode.tabIndex=0,this.domNode.setAttribute("role","region"),this.domNode.setAttribute("aria-roledescription",d(7821,null)),this._inChatTipContextKey=ie.inChatTip.bindTo(this._contextKeyService),this._multipleChatTipsContextKey=ie.multipleChatTips.bindTo(this._contextKeyService);let h=this._register(qn(this.domNode));this._register(h.onDidFocus(()=>this._inChatTipContextKey.set(!0))),this._register(h.onDidBlur(()=>this._inChatTipContextKey.set(!1))),this._register({dispose:()=>{this._inChatTipContextKey.reset(),this._multipleChatTipsContextKey.reset()}}),this._renderTip(e),this._register(this._chatTipService.onDidDismissTip(()=>{this._onDidHide.fire()})),this._register(this._chatTipService.onDidNavigateTip(g=>{this._renderTip(g),zh(Re(this.domNode),()=>this.focus())})),this._register(this._chatTipService.onDidHideTip(()=>{this._onDidHide.fire()})),this._register(this._chatTipService.onDidDisableTips(()=>{this._onDidHide.fire()})),this._register(j(this.domNode,re.CONTEXT_MENU,g=>{Xt.stop(g,!0);let f=new Cn(Re(this.domNode),g);this._contextMenuService.showContextMenu({getAnchor:()=>f,getActions:()=>{let v=this._menuService.getMenuActions(D.ChatTipContext,this._contextKeyService);return tu(v)}})}))}hasFocus(){return Gr(this.domNode)}focus(){this.domNode.focus()}_renderTip(e){Rt(this.domNode),this._toolbar.clear(),this._multipleChatTipsContextKey.set(this._chatTipService.hasMultipleTips());let t=this._renderer.render(e.content,{actionHandler:(l,c)=>{this._handleTipAction(l,c).catch(mt)}});this._renderedContent.value=t,this.domNode.appendChild(t.element);let o=Bbo(".chat-tip-toolbar");this._toolbar.value=this._instantiationService.createInstance(or,o,D.ChatTipToolbar,{menuOptions:{shouldForwardArgs:!0}}),this.domNode.appendChild(o);let n=t.element.textContent??d(7814,null),s=/\[.*?\]\(.*?\)/.test(e.content.value)?d(7822,null,n):n;this.domNode.setAttribute("aria-label",s)}async _handleTipAction(e,t){e.startsWith("command:")&&this._shouldTriggerSetup()&&!await this._commandService.executeCommand(Ab)||await U_(this._openerService,e,t.isTrusted)}_shouldTriggerSetup(){return this._chatEntitlementService.sentiment?.installed?this._chatEntitlementService.entitlement===1:!0}};ZOe=I([m(2,wW),m(3,Xe),m(4,Kt),m(5,X),m(6,F),m(7,Je),m(8,ge),m(9,rr)],ZOe);W(class extends K{constructor(){super({id:"workbench.action.chat.previousTip",title:L(7819,"Previous tip"),icon:R.chevronLeft,precondition:ie.multipleChatTips,f1:!1,menu:[{id:D.ChatTipToolbar,group:"navigation",order:1}]})}async run(i){i.get(wW).navigateToPreviousTip()}});W(class extends K{constructor(){super({id:"workbench.action.chat.nextTip",title:L(7818,"Next tip"),icon:R.chevronRight,precondition:ie.multipleChatTips,f1:!1,menu:[{id:D.ChatTipToolbar,group:"navigation",order:2}]})}async run(i){i.get(wW).navigateToNextTip()}});W(class extends K{constructor(){super({id:"workbench.action.chat.dismissTipToolbar",title:L(7817,"Dismiss tip"),icon:R.check,f1:!1,menu:[{id:D.ChatTipToolbar,group:"navigation",order:3}]})}async run(i){i.get(wW).dismissTipForSession()}});W(class extends K{constructor(){super({id:"workbench.action.chat.dismissTip",title:L(7816,"Dismiss this tip"),f1:!1,menu:[{id:D.ChatTipContext,group:"chatTip",order:1}]})}async run(i){i.get(wW).dismissTipForSession()}});W(class extends K{constructor(){super({id:"workbench.action.chat.disableTips",title:L(7815,"Disable tips"),icon:R.bellSlash,f1:!1,menu:[{id:D.ChatTipContext,group:"chatTip",order:2},{id:D.ChatTipToolbar,group:"navigation",order:5}]})}async run(i){let e=i.get(wW),t=i.get(ge);await e.disableTips(),await t.executeCommand("workbench.action.openSettings","chat.tips.enabled")}});W(class extends K{constructor(){super({id:"workbench.action.chat.resetDismissedTips",title:L(7820,"Reset Dismissed Tips"),f1:!0,precondition:ie.enabled})}async run(i){i.get(wW).clearDismissedTips()}});var EKt=_;function TKt(a){return Zde(a.viewContext)&&!!a.viewContext.isQuickChat}function gin(a){return Zde(a.viewContext)&&!!a.viewContext.isInlineChat}var Hbo={supportsFileAttachments:!0,supportsToolAttachments:!0,supportsMCPAttachments:!0,supportsImageAttachments:!0,supportsSearchResultAttachments:!0,supportsInstructionAttachments:!0,supportsSourceControlAttachments:!0,supportsProblemAttachments:!0,supportsSymbolAttachments:!0,supportsTerminalAttachments:!0,supportsPromptAttachments:!0,supportsHandOffs:!0},cLi=d(7970,null),kI=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,P,O,V,H,G,$,J,ae,he,oe){super();this.viewOptions=o;this.styles=n;this.codeEditorService=r;this.configurationService=s;this.dialogService=l;this.contextKeyService=c;this.instantiationService=u;this.chatService=p;this.chatAgentService=h;this.chatWidgetService=g;this.chatAccessibilityService=f;this.logService=v;this.themeService=b;this.chatSlashCommandService=S;this.telemetryService=w;this.promptsService=k;this.toolsService=T;this.chatModeService=P;this.chatLayoutService=O;this.chatEntitlementService=V;this.chatSessionsService=H;this.agentSessionsService=G;this.chatTodoListService=$;this.lifecycleService=J;this.chatAttachmentResolveService=ae;this.chatTipService=he;this.chatDebugService=oe;this._onDidSubmitAgent=this._register(new E);this.onDidSubmitAgent=this._onDidSubmitAgent.event;this._onDidChangeAgent=this._register(new E);this.onDidChangeAgent=this._onDidChangeAgent.event;this._onDidFocus=this._register(new E);this.onDidFocus=this._onDidFocus.event;this._onDidChangeViewModel=this._register(new E);this.onDidChangeViewModel=this._onDidChangeViewModel.event;this._onDidScroll=this._register(new E);this.onDidScroll=this._onDidScroll.event;this._onDidAcceptInput=this._register(new E);this.onDidAcceptInput=this._onDidAcceptInput.event;this._onDidHide=this._register(new E);this.onDidHide=this._onDidHide.event;this._onDidShow=this._register(new E);this.onDidShow=this._onDidShow.event;this._onDidChangeParsedInput=this._register(new E);this.onDidChangeParsedInput=this._onDidChangeParsedInput.event;this._onDidChangeActiveInputEditor=this._register(new E);this.onDidChangeActiveInputEditor=this._onDidChangeActiveInputEditor.event;this._onWillMaybeChangeHeight=this._register(new E);this.onWillMaybeChangeHeight=this._onWillMaybeChangeHeight.event;this._onDidChangeHeight=this._register(new E);this.onDidChangeHeight=this._onDidChangeHeight.event;this._onDidChangeContentHeight=this._register(new E);this.onDidChangeContentHeight=this._onDidChangeContentHeight.event;this._onDidChangeEmptyState=this._register(new E);this.onDidChangeEmptyState=this._onDidChangeEmptyState.event;this.contribs=[];this.visibilityTimeoutDisposable=this._register(new me);this.visibilityAnimationFrameDisposable=this._register(new me);this.inputPartDisposable=this._register(new me);this.inlineInputPartDisposable=this._register(new me);this.recentlyRestoredCheckpoint=!1;this.welcomePart=this._register(new me);this._gettingStartedTipPart=this._register(new me);this.visibleChangeCount=0;this._visible=!1;this._isRenderingWelcome=!1;this._attachmentCapabilities=Hbo;this.viewModelDisposables=this._register(new N);this._editingSession=Me(this,void 0);this._viewModelObs=ui(this,this.onDidChangeViewModel,()=>this.viewModel);this._lockedToCodingAgentContextKey=ie.lockedToCodingAgent.bindTo(this.contextKeyService),this._lockedCodingAgentIdContextKey=ie.lockedCodingAgentId.bindTo(this.contextKeyService),this._chatSessionSupportsForkContextKey=ie.chatSessionSupportsFork.bindTo(this.contextKeyService),this._agentSupportsAttachmentsContextKey=ie.agentSupportsAttachments.bindTo(this.contextKeyService),this._sessionIsEmptyContextKey=ie.chatSessionIsEmpty.bindTo(this.contextKeyService),this._hasPendingRequestsContextKey=ie.hasPendingRequests.bindTo(this.contextKeyService),this._sessionHasDebugDataContextKey=ie.chatSessionHasDebugData.bindTo(this.contextKeyService),this._register(this.chatDebugService.onDidAddEvent(Ce=>{let xe=this.viewModel?.sessionResource;xe&&Ce.sessionResource.toString()===xe.toString()&&this._sessionHasDebugDataContextKey.set(!0)})),this.viewContext=t??{};let de=this._viewModelObs;typeof e=="object"?this._location=e:this._location={location:e},ie.inChatSession.bindTo(c).set(!0),ie.location.bindTo(c).set(this._location.location),ie.inQuickChat.bindTo(c).set(TKt(this)),this.agentInInput=ie.inputHasAgent.bindTo(c),this.requestInProgress=ie.requestInProgress.bindTo(c),this._register(this.chatEntitlementService.onDidChangeAnonymous(()=>this.renderWelcomeViewContentIfNeeded())),this._register(this.configurationService.onDidChangeConfiguration(Ce=>{if(Ce.affectsConfiguration("chat.tips.enabled")){if(this.configurationService.getValue("chat.tips.enabled"))this.updateChatViewVisibility();else if(this.inputPart){this._gettingStartedTipPartRef=void 0,this._gettingStartedTipPart.clear();let xe=this.inputPart.gettingStartedTipContainerElement;Rt(xe),hh(!1,xe)}}})),this._register(Vd(R9e,c,Ce=>{let xe=this._editingSession.read(Ce);return xe?xe.entries.read(Ce).filter(Oe=>Oe.state.read(Ce)!==0).map(Oe=>Oe.entryId):void 0})),this._register(Vd(mD,c,Ce=>(this._editingSession.read(Ce)?.entries.read(Ce)??[]).filter(Oe=>Oe.state.read(Ce)===0).length>0)),this._register(Vd(M9e,c,Ce=>{let xe=this._editingSession.read(Ce);return xe?xe.entries.read(Ce).length>0:!1})),this._register(Vd(kRt,c,Ce=>this._editingSession.read(Ce)!==null)),this._register(Vd(ie.chatEditingCanUndo,c,Ce=>this._editingSession.read(Ce)?.canUndo.read(Ce)||!1)),this._register(Vd(ie.chatEditingCanRedo,c,Ce=>this._editingSession.read(Ce)?.canRedo.read(Ce)||!1)),this._register(Vd(S4,c,Ce=>{let xe=de.read(Ce)?.model;if(!this._editingSession.read(Ce)||!xe)return!1;let De=ui(this,xe.onDidChange,()=>xe.getRequests().at(-1)?.response).read(Ce);return De?.result?.errorDetails&&!De?.result?.errorDetails.responseIsIncomplete})),this._codeBlockModelCollection=this._register(u.createInstance(sW,void 0)),this.chatSuggestNextWidget=this._register(this.instantiationService.createInstance(eNe)),this._register(be(Ce=>{let xe=de.read(Ce),De=y.editingSessionsObs.read(Ce).find(pt=>Qe(pt.chatSessionResource,xe?.sessionResource));if(this._editingSession.set(void 0,void 0),this.renderChatEditingSessionState(),!De)return;let Oe=De.entries.read(Ce);for(let pt of Oe)pt.state.read(Ce);this._editingSession.set(De,void 0),Ce.store.add(De.onDidDispose(()=>{this._editingSession.set(void 0,void 0),this.renderChatEditingSessionState()})),Ce.store.add(this.inputEditor.onDidChangeModelContent(()=>{this.getInput()===""&&this.refreshParsedInput()})),this.renderChatEditingSessionState()})),this._register(this.codeEditorService.registerCodeEditorOpenHandler(async(Ce,xe,ze)=>{let De=Ce.resource;if(De.scheme!==Q.vscodeChatCodeBlock)return null;let Oe=De.path.split("/").at(1);if(!Oe)return null;let pt=this.viewModel?.getItems().find(et=>et.id===Oe);if(!pt)return null;this.reveal(pt),await Li(0);for(let et of this.listWidget.editorsInUse())if(ar.isEqual(et.uri,De,!0)){let Ti=et.editor,Ht=0,zi=Ti.getDomNode();if(zi){let Vo=Cg(zi,"monaco-list-row");Vo&&(Ht=cO(zi).top-cO(Vo).top)}if(Ce.options?.selection){let Vo=Ti.getTopForPosition(Ce.options.selection.startLineNumber,Ce.options.selection.startColumn);Ht+=Vo,Ti.focus(),Ti.setSelection({startLineNumber:Ce.options.selection.startLineNumber,startColumn:Ce.options.selection.startColumn,endLineNumber:Ce.options.selection.endLineNumber??Ce.options.selection.startLineNumber,endColumn:Ce.options.selection.endColumn??Ce.options.selection.startColumn})}return this.reveal(pt,Ht),Ti}return null})),this._register(this.onDidChangeParsedInput(()=>this.updateChatInputContext())),this._register(this.chatTodoListService.onDidUpdateTodos(Ce=>{Qe(this.viewModel?.sessionResource,Ce)&&this.inputPart.renderChatTodoListWidget(Ce)}))}static{this.CONTRIBS=[]}get domNode(){return this.container}get visible(){return this._visible}set viewModel(e){if(this._viewModel===e)return;let t=this._viewModel?.sessionResource;this.viewModelDisposables.clear(),this._viewModel=e,e?(this.viewModelDisposables.add(e),this.logService.debug("ChatWidget#setViewModel: have viewModel"),e.model.requestInProgress.get()&&this.chatAccessibilityService.acceptRequest(e.sessionResource,!0)):this.logService.debug("ChatWidget#setViewModel: no viewModel"),this._onDidChangeViewModel.fire({previousSessionResource:t,currentSessionResource:this._viewModel?.sessionResource})}get viewModel(){return this._viewModel}get parsedInput(){if(this.parsedChatRequest===void 0){if(!this.viewModel)return{text:"",parts:[]};this.parsedChatRequest=this.instantiationService.createInstance(uT).parseChatRequestWithReferences(HF(this),MK(this),this.getInput(),this.location,{selectedAgent:this._lastSelectedAgent,mode:this.input.currentModeKind,attachmentCapabilities:this.attachmentCapabilities,forcedAgent:this._lockedAgent?.id?this.chatAgentService.getAgent(this._lockedAgent.id):void 0}),this._onDidChangeParsedInput.fire()}return this.parsedChatRequest}get scopedContextKeyService(){return this.contextKeyService}get location(){return this._location.location}get supportsChangingModes(){return!!this.viewOptions.supportsChangingModes}get locationData(){return this._location.resolveData?.()}set lastSelectedAgent(e){this.parsedChatRequest=void 0,this._lastSelectedAgent=e,this._updateAgentCapabilitiesContextKeys(e),this._onDidChangeParsedInput.fire()}get lastSelectedAgent(){return this._lastSelectedAgent}_updateAgentCapabilitiesContextKeys(e){let t=e?.capabilities??(this._lockedAgent?this.chatSessionsService.getCapabilitiesForSessionType(this._lockedAgent.id):void 0);this._attachmentCapabilities=t??Hbo;let o=Object.keys(IP(this._attachmentCapabilities,(n,r)=>r===!0)).length>0;this._agentSupportsAttachmentsContextKey.set(o)}get supportsFileReferences(){return!!this.viewOptions.supportsFileReferences}get attachmentCapabilities(){return this._attachmentCapabilities}get input(){return this.viewModel?.editing&&this.configurationService.getValue("chat.editRequests")!=="input"?this.inlineInputPart:this.inputPart}get inputPart(){return this.inputPartDisposable.value}get inlineInputPart(){return this.inlineInputPartDisposable.value}get inputEditor(){return this.input.inputEditor}get contentHeight(){return this.input.height.get()+this.listWidget.contentHeight+this.chatSuggestNextWidget.height}get scrollTop(){return this.listWidget.scrollTop}set scrollTop(e){this.listWidget.scrollTop=e}get attachmentModel(){return this.input.attachmentModel}render(e){let t=py(this.viewContext)?this.viewContext.viewId:void 0;this.editorOptions=this._register(this.instantiationService.createInstance(eU,t,this.styles.listForeground,this.styles.inputEditorBackground,this.styles.resultEditorBackground));let o=this.viewOptions.renderInputOnTop??!1,n=this.viewOptions.renderFollowups??!o,r=this.viewOptions.renderStyle,s=this.viewOptions.renderInputToolbarBelowInput??!1;this.container=M(e,EKt(".interactive-session")),this.welcomeMessageContainer=M(this.container,EKt(".chat-welcome-view-container",{style:"display: none"})),this._register(Jo(this.welcomeMessageContainer,re.CLICK,()=>this.focusInput())),this._register(this.chatSuggestNextWidget.onDidChangeHeight(()=>{this.bodyDimension&&this.layout(this.bodyDimension.height,this.bodyDimension.width)})),this._register(this.chatSuggestNextWidget.onDidSelectPrompt(({handoff:c,agentId:u,withAutopilot:p})=>{this.handleNextPromptSelection(c,u,p)})),o?(this.createInput(this.container,{renderFollowups:n,renderStyle:r,renderInputToolbarBelowInput:s}),this.listContainer=M(this.container,EKt(".interactive-list"))):(this.listContainer=M(this.container,EKt(".interactive-list")),M(this.container,this.chatSuggestNextWidget.domNode),this.createInput(this.container,{renderFollowups:n,renderStyle:r,renderInputToolbarBelowInput:s})),this.renderWelcomeViewContentIfNeeded(),this.createList(this.listContainer,{editable:!gin(this)&&!TKt(this),...this.viewOptions.rendererOptions,renderStyle:r}),this._register(j(e,re.MOUSE_WHEEL,c=>{c.defaultPrevented||ts(c.target,this.container)||this.listWidget.delegateScrollFromMouseWheelEvent(c)})),this._register(be(c=>{let u=this.chatLayoutService.fontFamily.read(c),p=this.chatLayoutService.fontSize.read(c);this.container.style.setProperty("--vscode-chat-font-family",u),this.container.style.fontSize=`${p}px`,this.visible&&this.listWidget.rerender()})),this._register(U.runAndSubscribe(this.editorOptions.onDidChange,()=>this.onDidStyleChange())),this.viewModel&&(this.onDidChangeItems(),this.listWidget.scrollToEnd()),this.contribs=kI.CONTRIBS.map(c=>{try{return this._register(this.instantiationService.createInstance(c,this))}catch(u){this.logService.error("Failed to instantiate chat widget contrib",xn(u));return}}).filter(lo),this._register(this.chatWidgetService.register(this));let l=ui(this.onDidChangeParsedInput,()=>this.parsedInput);this._register(be(c=>{let u=l.read(c),p=new Map,h=new Set;for(let g of this.attachmentModel.attachments)g.range&&h.add(g.id);for(let g of u.parts)if(g instanceof dI||g instanceof VF||g instanceof HR){let f=g.toVariableEntry();p.set(f.id,f),h.delete(f.id)}this.attachmentModel.updateContext(h,p.values())})),this.focusedInputDOM||(this.focusedInputDOM=this.container.appendChild(_(".focused-input-dom")))}focusInput(){this.input.focus(),this._onDidFocus.fire()}focusTodosView(){return this.input.hasVisibleTodos()?this.input.focusTodoList():!1}toggleTodosViewFocus(){return this.input.hasVisibleTodos()?this.input.isTodoListFocused()?(this.focusInput(),!0):this.input.focusTodoList():!1}focusQuestionCarousel(){return this.input.questionCarousel?this.input.focusQuestionCarousel():!1}toggleQuestionCarouselFocus(){return this.input.questionCarousel?this.input.isQuestionCarouselFocused()?(this.focusInput(),!0):this.input.focusQuestionCarousel():!1}navigateToPreviousQuestion(){return this.input.questionCarousel?this.input.navigateToPreviousQuestion():!1}navigateToNextQuestion(){return this.input.questionCarousel?this.input.navigateToNextQuestion():!1}toggleTipFocus(){return this._gettingStartedTipPartRef?.hasFocus()?(this.focusInput(),!0):this._gettingStartedTipPartRef?(this._gettingStartedTipPartRef.focus(),!0):!1}hasInputFocus(){return this.input.hasFocus()}refreshParsedInput(){if(!this.viewModel)return;let e=this.parsedChatRequest;this.parsedChatRequest=this.instantiationService.createInstance(uT).parseChatRequestWithReferences(HF(this),MK(this),this.getInput(),this.location,{selectedAgent:this._lastSelectedAgent,mode:this.input.currentModeKind,attachmentCapabilities:this.attachmentCapabilities}),(!e||!whi.equals(e,this.parsedChatRequest))&&this._onDidChangeParsedInput.fire()}getSibling(e,t){if(!Ui(e))return;let o=this.viewModel?.getItems();if(!o)return;let n=o.filter(l=>Ui(l)),r=n.indexOf(e);if(r===void 0)return;let s=t==="next"?r+1:r-1;if(!(s<0||s>n.length-1))return n[s]}async clear(){this.logService.debug("ChatWidget#clear"),this._dynamicMessageLayoutData&&(this._dynamicMessageLayoutData.enabled=!0),this.viewModel?.editing&&this.finishedEditing(),this.viewModel&&this.viewModel.resetInputPlaceholder(),this._lockedAgent?this.lockToCodingAgent(this._lockedAgent.name,this._lockedAgent.displayName,this._lockedAgent.id):this.unlockFromCodingAgent(),this.inputPart.clearTodoListWidget(this.viewModel?.sessionResource,!0),this.inputPart.clearArtifactsWidget(),this.chatSuggestNextWidget.hide(),await this.viewOptions.clear?.()}onDidChangeItems(e){(this._visible||!this.viewModel)&&((this.viewModel?.getItems()??[]).length>0?this.updateChatViewVisibility():this.renderWelcomeViewContentIfNeeded(),this._onWillMaybeChangeHeight.fire(),this.listWidget.setVisibleChangeCount(this.visibleChangeCount),this.listWidget.refresh(),!e&&this._dynamicMessageLayoutData&&this.layoutDynamicChatTreeItemMode(),this.renderFollowups())}updateChatViewVisibility(){if(this.viewModel){let e=this.viewOptions.renderStyle!=="compact"&&this.viewOptions.renderStyle!=="minimal",t=this.viewModel.getItems().length;if(hh(t===0,this.welcomeMessageContainer),hh(t!==0,this.listContainer),e&&this.inputPart){let o=this.inputPart.gettingStartedTipContainerElement;t===0?this.renderGettingStartedTipIfNeeded():(this._gettingStartedTipPartRef=void 0,this._gettingStartedTipPart.clear(),Rt(o),hh(!1,o))}}this.container.classList.toggle("chat-view-getting-started-disabled",this.chatEntitlementService.sentiment.installed),this._onDidChangeEmptyState.fire()}isEmpty(){return(this.viewModel?.getItems().length??0)===0}renderWelcomeViewContentIfNeeded(){if(!this._isRenderingWelcome){this._isRenderingWelcome=!0;try{if(this.viewOptions.renderStyle==="compact"||this.viewOptions.renderStyle==="minimal"||this.lifecycleService.willShutdown)return;if(!(this.viewModel?.getItems().length??0)){let t=this.chatAgentService.getDefaultAgent(this.location,this.input.currentModeKind),o;if(this.chatEntitlementService.anonymous&&!this.chatEntitlementService.sentiment.installed){let r=ro.defaultChatAgent.provider;o=new Ie(d(7976,null,r.default.name,r.default.name,ro.defaultChatAgent.termsStatementUrl,ro.defaultChatAgent.privacyStatementUrl),{isTrusted:!0})}else o=t?.metadata.additionalWelcomeMessage;!o&&!this._lockedAgent&&(o=this._getGenerateInstructionsMessage());let n=this.getWelcomeViewContent(o);(!this.welcomePart.value||this.welcomePart.value.needsRerender(n))&&(Rt(this.welcomeMessageContainer),this.welcomePart.value=this.instantiationService.createInstance(Tge,n,{location:this.location,isWidgetAgentWelcomeViewContent:this.input?.currentModeKind==="agent"}),M(this.welcomeMessageContainer,this.welcomePart.value.element))}this.updateChatViewVisibility()}finally{this._isRenderingWelcome=!1}}}renderGettingStartedTipIfNeeded(){if(!this.inputPart)return;let e=this.inputPart.gettingStartedTipContainerElement,t=this.chatTipService.getWelcomeTip(this.contextKeyService);if(!t){this._gettingStartedTipPart.value&&(this._gettingStartedTipPartRef=void 0,this._gettingStartedTipPart.clear(),Rt(e)),hh(!1,e);return}if(this._gettingStartedTipPart.value){hh(!0,e);return}let o=new N,n=this.instantiationService.createInstance(gie),r=o.add(this.instantiationService.createInstance(ZOe,t,n));this._gettingStartedTipPartRef=r,o.add(r.onDidHide(()=>{r.domNode.remove(),this._gettingStartedTipPartRef=void 0,this._gettingStartedTipPart.clear(),hh(!1,e),this.focusInput()})),this._gettingStartedTipPart.value=o,Rt(e),e.appendChild(r.domNode),hh(!0,e)}_getGenerateInstructionsMessage(){return this._instructionFilesCheckPromise||(this._instructionFilesCheckPromise=this._checkForAgentInstructionFiles(),this._register(USe(this._instructionFilesCheckPromise,e=>{this._instructionFilesExist=e,(this.viewModel?.getItems().length??0)===0&&this.renderWelcomeViewContentIfNeeded()}))),this._instructionFilesExist===!0?new Ie(""):this._instructionFilesExist===!1?new Ie(d(7971,null,`command:${x2}`),{isTrusted:{enabledCommands:[x2]}}):new Ie("")}async _checkForAgentInstructionFiles(){try{return(await this.promptsService.listAgentInstructions(Se.None)).length>0}catch(e){return this.logService.warn("[ChatWidget] Error checking for instruction files:",e),!1}}getWelcomeViewContent(e){if(this.isLockedToCodingAgent){let o=this._lockedAgent?this.chatSessionsService.getChatSessionContribution(this._lockedAgent.id):void 0,n=o?.icon,r=o?.welcomeTitle,s=o?.welcomeMessage,l=s?new Ie(s):this._lockedAgent?.prefix==="@copilot "?new Ie(d(7973,null,this._lockedAgent.prefix,"https://aka.ms/coding-agent-docs")+cLi,{isTrusted:!0}):new Ie(d(7975,null,this._lockedAgent?.prefix)+cLi);return{title:r??d(7972,null,this._lockedAgent?.prefix),message:l,icon:n??R.sendToRemoteAgent,additionalMessage:e,useLargeIcon:!!n}}let t;return this.input.currentModeKind==="ask"?t=d(7969,null):this.input.currentModeKind==="edit"?t=d(7974,null):t=d(7962,null),{title:t,message:new Ie(cLi),icon:R.chatSparkle,additionalMessage:e}}async renderChatEditingSessionState(){this.input&&this.input.renderChatEditingSessionState(this._editingSession.get()??null)}async renderFollowups(){let e=this.listWidget.lastItem;e&&Ui(e)&&e.isComplete?this.input.renderFollowups(e.replyFollowups,e):this.input.renderFollowups(void 0,void 0)}renderChatSuggestNextWidget(){if(this.lifecycleService.willShutdown)return;if(this.isLockedToCodingAgent&&!this._attachmentCapabilities.supportsHandOffs){this.chatSuggestNextWidget.hide();return}let e=this.viewModel?.getItems()??[];if(!e.length)return;let t=e[e.length-1];if(!(t&&Ui(t)&&t.isComplete)||t.isCanceled){this.chatSuggestNextWidget.hide();return}let n=t.model.request?.modeInfo,r;n?.modeInstructions?.name?r=this.chatModeService.findModeByName(n.modeInstructions.name):n?.modeId?r=this.chatModeService.findModeById(n.modeId):r=this.input.currentModeObs.get();let s=r?.handOffs?.get();if(r&&s&&s.length>0){if(this.inputPart.currentModeInfo.permissionLevel==="autopilot"){let u=s.find(p=>p.send);if(u){this.handleNextPromptSelection(u);return}}let c=this.chatSuggestNextWidget.domNode.style.display==="none";this.chatSuggestNextWidget.render(r),c&&this.telemetryService.publicLog2("chat.handoffWidgetShown",{agent:d3(r),handoffCount:s.length})}else this.chatSuggestNextWidget.hide();this.bodyDimension&&this.layout(this.bodyDimension.height,this.bodyDimension.width)}handleNextPromptSelection(e,t,o){this.chatSuggestNextWidget.hide(),o&&this.inputPart.setPermissionLevel("autopilot");let n=e.prompt,r=this.input.currentModeObs.get(),s=e.agent?this.chatModeService.findModeByName(e.agent):void 0;this.telemetryService.publicLog2("chat.handoffClicked",{fromAgent:d3(r),toAgent:t||(s?d3(s):""),hasPrompt:!!n,autoSend:!!e.send}),this.executeHandoff(e,t).catch(l=>{let c=t??e.agent??"unknown";this.logService.error(`[Handoff] Failed to execute handoff '${e.label}' to '${c}'`,l)})}async executeHandoff(e,t){this.chatSuggestNextWidget.hide();let o=e.prompt;t?(this.input.setValue(`@${t} ${o}`,!1),this.input.focus(),this.acceptInput().catch(n=>this.logService.error(`[Handoff] Failed to submit delegated handoff to '@${t}'`,n))):e.agent&&(this._switchToAgentByName(e.agent),e.model&&this.input.switchModelByQualifiedName([e.model]),this.input.setValue(o,!1),this.input.focus(),e.send&&this.acceptInput())}async handleDelegationExitIfNeeded(e,t){if(this._shouldExitAfterDelegation(e,t)){this.logService.debug(`[Delegation] Will exit after delegation: sourceAgent=${e?.id}, targetAgent=${t?.id}`);try{await this._handleDelegationExit()}catch(o){this.logService.error("[Delegation] Failed to handle delegation exit",o)}}}_shouldExitAfterDelegation(e,t){if(!t)return this.logService.debug("[Delegation] _shouldExitAfterDelegation: false (no targetAgent)"),!1;if(!this.configurationService.getValue("chat.exitAfterDelegation"))return this.logService.debug("[Delegation] _shouldExitAfterDelegation: false (ExitAfterDelegation config disabled)"),!1;if(e&&e.id===t.id)return this.logService.debug("[Delegation] _shouldExitAfterDelegation: false (source and target agents are the same)"),!1;if(!py(this.viewContext))return this.logService.debug("[Delegation] _shouldExitAfterDelegation: false (not in chat view context)"),!1;let o=this.chatSessionsService.getChatSessionContribution(t.id);return o?o.canDelegate!==!0?(this.logService.debug(`[Delegation] _shouldExitAfterDelegation: false (contribution.canDelegate=${o.canDelegate}, expected true)`),!1):(this.logService.debug("[Delegation] _shouldExitAfterDelegation: true"),!0):(this.logService.debug(`[Delegation] _shouldExitAfterDelegation: false (no contribution found for targetAgent.id=${t.id})`),!1)}async _handleDelegationExit(){let e=this.viewModel;if(!e){this.logService.debug("[Delegation] _handleDelegationExit: no viewModel, returning");return}let t=e.sessionResource;this.logService.debug(`[Delegation] _handleDelegationExit: parentSessionResource=${t.toString()}`);let o=()=>{let r=e.getItems(),s=r[r.length-1];return s&&Ui(s)&&s.model&&s.isComplete&&!s.model.isPendingConfirmation.get()?!!!s.result?.errorDetails:!1};if(o()){this.logService.debug("[Delegation] Response complete, archiving session before clearing"),await this.archiveLocalParentSession(t),await this.clear();return}this.logService.debug("[Delegation] Waiting for response to complete..."),await new Promise(r=>{let s=e.onDidChange(()=>{o()&&(c(),r(!0))}),l=setTimeout(()=>{this.logService.debug("[Delegation] Timeout waiting for response to complete"),c(),r(!1)},3e4),c=()=>{clearTimeout(l),s.dispose()}})?(this.logService.debug("[Delegation] Response completed, archiving session before clearing"),await this.archiveLocalParentSession(t),await this.clear()):this.logService.debug("[Delegation] Not clearing (timeout or error)")}async archiveLocalParentSession(e){if(e.scheme!==Q.vscodeLocalChatSession&&!wb.getValue(this.contextKeyService))return;this.logService.debug(`[Delegation] archiveLocalParentSession: archiving session ${e.toString()}`),await this.chatService.getSession(e)?.editingSession?.accept();let t=this.agentSessionsService.getSession(e);t?(t.setArchived(!0),this.logService.debug("[Delegation] archiveLocalParentSession: session archived successfully")):this.logService.warn(`[Delegation] archiveLocalParentSession: session not found in agentSessionsService for ${e.toString()}`)}setVisible(e){let t=this._visible;this._visible=e,this.visibleChangeCount++,this.listWidget.setVisible(e),this.input.setVisible(e),e?t||(this.visibilityTimeoutDisposable.value=tn(()=>{this._visible&&this.onDidChangeItems(!0)},0),this.visibilityAnimationFrameDisposable.value=Wr(Re(this.listContainer),()=>{this._onDidShow.fire()})):t&&this._onDidHide.fire()}createList(e,t){let o=document.createElement("div");o.classList.add("chat-overflow-widget-container","monaco-editor"),e.append(o),this.listWidget=this._register(this.instantiationService.createInstance(Pie,e,{rendererOptions:t,renderStyle:this.viewOptions.renderStyle,defaultElementHeight:this.viewOptions.defaultElementHeight??200,overflowWidgetsDomNode:o,styles:{listForeground:this.styles.listForeground,listBackground:this.styles.listBackground},currentChatMode:()=>this.input.currentModeKind,filter:this.viewOptions.filter?{filter:this.viewOptions.filter.bind(this.viewOptions)}:void 0,codeBlockModelCollection:this._codeBlockModelCollection,viewModel:this.viewModel,editorOptions:this.editorOptions,location:this.location,getCurrentLanguageModelId:()=>this.input.currentLanguageModel,getCurrentModeInfo:()=>this.input.currentModeInfo})),this._register(this.listWidget.onDidClickRequest(async n=>{this.clickedRequest(n)})),this._register(this.listWidget.onDidRerender(n=>{Sr(n.currentElement)&&this.configurationService.getValue("chat.editRequests")!=="input"&&(n.rowContainer.contains(this.inputContainer)||n.rowContainer.appendChild(this.inputContainer),this.input.focus())})),this._register(this.listWidget.onDidDispose(()=>{this.focusedInputDOM.appendChild(this.inputContainer),this.input.focus()})),this._register(this.listWidget.onDidFocusOutside(()=>{this.finishedEditing()})),this._register(this.listWidget.onDidClickFollowup(n=>{this.acceptInput(n.message)})),this._register(this.listWidget.onDidChangeContentHeight(()=>{this._onDidChangeContentHeight.fire()})),this._register(this.listWidget.onDidFocus(()=>{this._onDidFocus.fire()})),this._register(this.listWidget.onDidScroll(()=>{this._onDidScroll.fire()}))}startEditing(e){let t=this.listWidget.getTemplateDataForRequestId(e);t&&this.clickedRequest(t)}clickedRequest(e){let t=e.currentElement;if(Sr(t)&&!this.viewModel?.editing){let o=this.viewModel?.model.getRequests();if(!o||!this.viewModel?.sessionResource)return;this.viewModel?.model.checkpoint&&(this.recentlyRestoredCheckpoint=!0),this.viewModel?.model.setCheckpoint(t.id);let n=[],r=new Set,s=h=>{let g=h.range?`${h.id}:${h.range.start}-${h.range.endExclusive}`:h.id;r.has(g)||tTe(h)||(lD(h)||RK(h))&&h.automaticallyAdded||(r.add(g),n.push(h))};for(let h=o.length-1;h>=0;h-=1){let g=o[h];g.id===t.id&&(g.setShouldBeBlocked(!1),g.attachedContext?.forEach(s))}t.variables.forEach(s),this.viewModel?.setEditing(t),e?.contextKeyService&&ie.currentlyEditing.bindTo(e.contextKeyService).set(!0);let l=t.pendingKind===void 0?ie.EditingRequestType.Sent:t.pendingKind==="queued"?ie.EditingRequestType.Queue:ie.EditingRequestType.Steer,c=this.configurationService.getValue("chat.editRequests")==="input";if(this.inputPart?.setEditing(!!this.viewModel?.editing&&c,l),c)this.inputPart.element.classList.add("editing");else{let h=e.rowContainer;this.inputContainer=_(".chat-edit-input-container"),h.appendChild(this.inputContainer),this.createInput(this.inputContainer),this.input.setChatMode(this.inputPart.currentModeObs.get().id),this.input.setPermissionLevel(this.inputPart.currentModeInfo.permissionLevel??"default"),this.input.setEditing(!0,l),this._onDidChangeActiveInputEditor.fire()}this.inputPart.toggleChatInputOverlay(!c),n.length>0&&this.input.attachmentModel.addContext(...n),this.inputPart.dnd.setDisabledOverlay(!c),this.input.renderAttachedContext(),this.input.setValue(t.messageText,!1);let u=this.getContrib(yS.ID),p=this.input.inputEditor.getModel();if(u&&p){let h=p.getValueLength();for(let g of n)if(g.range){if(g.range.start>=g.range.endExclusive||g.range.start<0||g.range.endExclusive>h)continue;let f=p.getPositionAt(g.range.start),v=p.getPositionAt(g.range.endExclusive);u.addReference({id:g.id,range:new z(f.lineNumber,f.column,v.lineNumber,v.column),data:g.value,fullName:g.fullName,icon:g.icon,modelDescription:g.modelDescription,isFile:g.kind==="file",isDirectory:g.kind==="directory"})}}this.listWidget.suppressAutoScroll=!0,this.onDidChangeItems(),this.input.inputEditor.focus(),this._register(this.inputPart.onDidClickOverlay(()=>{this.viewModel?.editing&&this.configurationService.getValue("chat.editRequests")!=="input"&&this.finishedEditing()})),c||(this._register(this.inlineInputPart.inputEditor.onDidChangeModelContent(()=>{this.listWidget.scrollToCurrentItem(t)})),this._register(this.inlineInputPart.inputEditor.onDidChangeCursorSelection(h=>{this.listWidget.scrollToCurrentItem(t)})))}this.telemetryService.publicLog2("chat.startEditingRequests",{editRequestType:this.configurationService.getValue("chat.editRequests")})}finishedEditing(e){this.listWidget.suppressAutoScroll=!1;let t=this.listWidget.getTemplateDataForRequestId(this.viewModel?.editing?.id);this.recentlyRestoredCheckpoint?this.recentlyRestoredCheckpoint=!1:this.viewModel?.model.setCheckpoint(void 0),this.inputPart.dnd.setDisabledOverlay(!1),t?.contextKeyService&&ie.currentlyEditing.bindTo(t.contextKeyService).set(!1);let o=this.configurationService.getValue("chat.editRequests")==="input";if(!o){this.inputPart.setChatMode(this.input.currentModeObs.get().id),this.inputPart.setPermissionLevel(this.input.currentModeInfo.permissionLevel??"default");let n=this.input.selectedLanguageModel.get();n&&this.inputPart.switchModel(n.metadata),this.inputPart?.toggleChatInputOverlay(!1);try{t?.rowContainer?.contains(this.inputContainer)?t.rowContainer.removeChild(this.inputContainer):this.inputContainer.parentElement&&this.inputContainer.parentElement.removeChild(this.inputContainer)}catch(r){this.logService.error("Error occurred while finishing editing:",r)}this.inputContainer=_(".empty-chat-state"),this.input.dispose()}o&&this.inputPart.element.classList.remove("editing"),this.viewModel?.setEditing(void 0),this.inputPart?.setEditing(!1,void 0),o||this._onDidChangeActiveInputEditor.fire(),this.onDidChangeItems(),this.telemetryService.publicLog2("chat.editRequestsFinished",{editRequestType:this.configurationService.getValue("chat.editRequests"),editCanceled:!e}),this.inputPart.focus()}getWidgetViewKindTag(){return this.viewContext?py(this.viewContext)?"view":"quick":"editor"}createInput(e,t){let o={renderFollowups:t?.renderFollowups??!0,renderStyle:t?.renderStyle==="minimal"?"compact":t?.renderStyle,renderInputToolbarBelowInput:t?.renderInputToolbarBelowInput??!1,menus:{executeToolbar:D.ChatExecute,telemetrySource:"chatWidget",...this.viewOptions.menus},editorOverflowWidgetsDomNode:this.viewOptions.editorOverflowWidgetsDomNode,enableImplicitContext:this.viewOptions.enableImplicitContext,renderWorkingSet:this.viewOptions.enableWorkingSet==="explicit",supportsChangingModes:this.viewOptions.supportsChangingModes,dndContainer:this.viewOptions.dndContainer,inputEditorMinLines:this.viewOptions.inputEditorMinLines,widgetViewKindTag:this.getWidgetViewKindTag(),defaultMode:this.viewOptions.defaultMode,sessionTypePickerDelegate:this.viewOptions.sessionTypePickerDelegate,workspacePickerDelegate:this.viewOptions.workspacePickerDelegate,isSessionsWindow:this.viewOptions.isSessionsWindow};if(this.viewModel?.editing){let s=this.listWidget.getTemplateDataForRequestId(this.viewModel?.editing?.id),l=this._register(this.instantiationService.createChild(new _o([X,s?.contextKeyService])));this.inlineInputPartDisposable.value=l.createInstance(J8,this.location,o,this.styles,!0)}else this.inputPartDisposable.value=this.instantiationService.createInstance(J8,this.location,o,this.styles,!1),this._register(be(s=>{this.inputPart.height.read(s),this.listWidget&&(this.bodyDimension&&this._layoutListForInputHeight(),this._onDidChangeContentHeight.fire())}));this.input.render(e,"",this),this.bodyDimension?.width&&this.input.layout(this.bodyDimension.width),this._register(this.input.onDidLoadInputState(()=>{this.refreshParsedInput()})),this._register(this.input.onDidFocus(()=>this._onDidFocus.fire())),this._register(this.input.onDidAcceptFollowup(s=>{if(!this.viewModel)return;let l="";if(s.followup.agentId&&s.followup.agentId!==this.chatAgentService.getDefaultAgent(this.location,this.input.currentModeKind)?.id){let c=this.chatAgentService.getAgent(s.followup.agentId);if(!c)return;this.lastSelectedAgent=c,l=`${zc}${c.name} `,s.followup.subCommand&&(l+=`${Bu}${s.followup.subCommand} `)}else!s.followup.agentId&&s.followup.subCommand&&this.chatSlashCommandService.hasCommand(s.followup.subCommand)&&(l=`${Bu}${s.followup.subCommand} `);l+=s.followup.message,this.acceptInput(l),s.response&&this.chatService.notifyUserAction({sessionResource:this.viewModel.sessionResource,requestId:s.response.requestId,agentId:s.response.agent?.id,command:s.response.slashCommand?.name,result:s.response.result,action:{kind:"followUp",followup:s.followup}})})),this._register(this.inputEditor.onDidChangeModelContent(()=>{this.parsedChatRequest=void 0,this.updateChatInputContext()})),this._register(this.chatAgentService.onDidChangeAgents(()=>{this.parsedChatRequest=void 0,this.renderWelcomeViewContentIfNeeded()})),this._register(this.input.onDidChangeCurrentChatMode(()=>{this.renderWelcomeViewContentIfNeeded(),this.refreshParsedInput(),this.renderFollowups(),this.renderChatSuggestNextWidget()}));let n=new Set([ie.foregroundSessionCount.key]);this._register(this.contextKeyService.onDidChangeContext(s=>{s.affectsSome(n)&&this.isEmpty()&&this.renderGettingStartedTipIfNeeded()}));let r;this._register(be(s=>{let l=this.inputPart.selectedLanguageModel.read(s)?.identifier;if(r===void 0){r=l;return}r!==l&&(r=l,this._gettingStartedTipPartRef&&this.chatTipService.getWelcomeTip(this.contextKeyService))})),this._register(be(s=>{let l=new Set,c=new Set;for(let[p,h]of this.input.selectedToolsModel.entriesMap.read(s))h&&(Xm(p)?l.add(p.id):c.add(p.id));let u=this.input.attachmentModel.attachments.filter(p=>p.kind==="tool"&&!c.has(p.id)||p.kind==="toolset"&&!l.has(p.id)).map(p=>p.id);this.input.attachmentModel.updateContext(u,vt.empty()),this.refreshParsedInput()}))}onDidStyleChange(){this.container.style.setProperty("--vscode-interactive-result-editor-background-color",this.editorOptions.configuration.resultEditor.backgroundColor?.toString()??""),this.container.style.setProperty("--vscode-interactive-session-foreground",this.editorOptions.configuration.foreground?.toString()??""),this.container.style.setProperty("--vscode-chat-list-background",this.themeService.getColorTheme().getColor(this.styles.listBackground)?.toString()??"")}setModel(e){if(!this.container)throw new Error("Call render() before setModel()");if(!e){this.viewModel?.editing&&this.finishedEditing(),this.viewModel=void 0,this.onDidChangeItems(),this._hasPendingRequestsContextKey.set(!1);return}if(Qe(e.sessionResource,this.viewModel?.sessionResource))return;this.viewModel?.editing&&this.finishedEditing(),this.inputPart.clearTodoListWidget(e.sessionResource,!1),this.inputPart.clearArtifactsWidget(),this.chatSuggestNextWidget.hide(),this.chatTipService.resetSession(),this._gettingStartedTipPartRef=void 0,this._gettingStartedTipPart.clear();let t=this.inputPart.gettingStartedTipContainerElement;if(Rt(t),hh(!1,t),this._codeBlockModelCollection.clear(),this.inputPart.setInputModel(e.inputModel,e.getRequests().length===0),this.viewModel=this.instantiationService.createInstance(xZ,e,this._codeBlockModelCollection,void 0),this.listWidget.setViewModel(this.viewModel),this._lockedAgent){let c=this.chatSessionsService.getChatSessionContribution(this._lockedAgent.id)?.inputPlaceholder;c||(c=d(7963,null,this._lockedAgent.displayName||this._lockedAgent.name)),this.viewModel.setInputPlaceholder(c),this.inputEditor.updateOptions({placeholder:c})}else this.viewModel.inputPlaceholder&&this.inputEditor.updateOptions({placeholder:this.viewModel.inputPlaceholder});let n=this.configurationService.getValue("chat.experimental.renderMarkdownImmediately")?ML:0;this.viewModelDisposables.add(U.runAndSubscribe(U.accumulate(this.viewModel.onDidChange,n),(c=>{!this.viewModel||this._store.isDisposed||(this.requestInProgress.set(this.viewModel.model.requestInProgress.get()),c?.some(u=>u?.kind==="changePlaceholder")&&this.inputEditor.updateOptions({placeholder:this.viewModel.inputPlaceholder}),this.onDidChangeItems(),c?.some(u=>u?.kind==="addRequest")&&this.visible&&this.listWidget.scrollToEnd())}))),this.viewModelDisposables.add(this.viewModel.onDidDisposeModel(()=>{this.viewModel?.editing&&this.finishedEditing(),this.viewModel=void 0,this.onDidChangeItems()})),this._sessionIsEmptyContextKey.set(e.getRequests().length===0);let r=this.chatSessionsService.sessionSupportsFork(e.sessionResource);this._chatSessionSupportsForkContextKey.set(r),this.listWidget?.updateRendererOptions({supportsFork:r}),this._sessionHasDebugDataContextKey.set(this.chatDebugService.getEvents(e.sessionResource).length>0);let s=0,l=c=>{let u=e.getPendingRequests(),p=u.length;this._hasPendingRequestsContextKey.set(p>0);let h=u.filter(g=>g.kind==="steering").length;c&&h>0&&s===0&&qr(d(7968,null)),s=h};l(!1),this.viewModelDisposables.add(e.onDidChangePendingRequests(()=>l(!0))),this.refreshParsedInput(),this.viewModelDisposables.add(e.onDidChange(c=>{c.kind==="setAgent"&&(this._onDidChangeAgent.fire({agent:c.agent,slashCommand:c.command}),this._updateAgentCapabilitiesContextKeys(c.agent)),c.kind==="addRequest"&&(this.inputPart.clearTodoListWidget(this.viewModel?.sessionResource,!1),this._sessionIsEmptyContextKey.set(!1),this.chatSuggestNextWidget.hide()),c.kind==="removeRequest"&&(this.inputPart.clearTodoListWidget(this.viewModel?.sessionResource,!0),this.chatSuggestNextWidget.hide(),this._sessionIsEmptyContextKey.set((this.viewModel?.model.getRequests().length??0)===0)),c.kind==="completedRequest"&&((this.viewModel?.model.getRequests().at(-1)?.response?.isCanceled??!1)&&this.inputPart.clearTodoListWidget(this.viewModel?.sessionResource,!0),this.renderChatSuggestNextWidget(),this.visible&&this.viewModel?.sessionResource&&this.agentSessionsService.getSession(this.viewModel.sessionResource)?.setRead(!0))})),this.listWidget&&this.visible&&(this.onDidChangeItems(),this.listWidget.scrollToEnd()),this.renderChatSuggestNextWidget(),this.updateChatInputContext(),this.input.renderChatTodoListWidget(this.viewModel.sessionResource),this.input.renderArtifactsWidget(this.viewModel.sessionResource)}getFocus(){return this.listWidget.getFocus()[0]??void 0}reveal(e,t){this.listWidget.reveal(e,t)}focus(e){this.listWidget.hasElement(e)&&this.listWidget.focusItem(e)}setInputPlaceholder(e){this.viewModel?.setInputPlaceholder(e)}resetInputPlaceholder(){this.viewModel?.resetInputPlaceholder()}setInput(e=""){this.input.setValue(e,!1),this.refreshParsedInput()}getInput(){return this.input.inputEditor.getValue()}getContrib(e){return this.contribs.find(t=>t.id===e)}lockToCodingAgent(e,t,o){this._lockedAgent={id:o,name:e,prefix:`@${e} `,displayName:t},this._lockedToCodingAgentContextKey.set(!0),this._lockedCodingAgentIdContextKey.set(o),this.renderWelcomeViewContentIfNeeded();let n=this.chatAgentService.getAgent(o);this._updateAgentCapabilitiesContextKeys(n),this.listWidget?.updateRendererOptions({restorable:!1,editable:!1,noFooter:!0,progressMessageAtBottomOfResponse:!0}),this.visible&&this.listWidget?.rerender()}unlockFromCodingAgent(){this._lockedAgent=void 0,this._lockedToCodingAgentContextKey.set(!1),this._lockedCodingAgentIdContextKey.set(""),this._chatSessionSupportsForkContextKey.set(!1),this._updateAgentCapabilitiesContextKeys(void 0),this.renderWelcomeViewContentIfNeeded(),this.viewModel&&this.viewModel.resetInputPlaceholder(),this.inputEditor?.updateOptions({placeholder:void 0}),this.listWidget?.updateRendererOptions({restorable:!0,editable:!0,noFooter:!1,progressMessageAtBottomOfResponse:e=>e!=="ask"}),this.visible&&this.listWidget?.rerender()}get isLockedToCodingAgent(){return!!this._lockedAgent}get lockedAgentId(){return this._lockedAgent?.id}logInputHistory(){this.input.logInputHistory()}async acceptInput(e,t){return this.viewModel&&FF(this.viewModel.sessionResource,OF.RequestStart),this._acceptInput(e?{query:e}:void 0,t)}async rerunLastRequest(){if(!this.viewModel)return;let e=this.viewModel.sessionResource,t=this.chatService.getSession(e)?.getRequests().at(-1);if(!t)return;let o={attempt:t.attempt+1,location:this.location,userSelectedModelId:this.input.currentLanguageModel,modeInfo:this.input.currentModeInfo},n=await this.chatService.resendRequest(t,o);return this.logThinkingStyleUsage("rerun"),n}getConfiguredThinkingStyle(){let e=this.configurationService.getValue("chat.agent.thinkingStyle");switch(e){case"collapsed":case"collapsedPreview":case"fixedScrolling":return e;default:return"fixedScrolling"}}logThinkingStyleUsage(e){this.telemetryService.publicLog2("chat.thinkingStyleUsage",{thinkingStyle:this.getConfiguredThinkingStyle(),location:this.location,requestKind:e})}async _applyPromptFileIfSet(e){let t=this.parsedInput.parts.find(u=>u instanceof dT);if(!t)return;this.chatTipService.recordSlashCommandUsage(t.name);let o=await this.promptsService.resolvePromptSlashCommand(t.name,Se.None);if(!o)return;let n=o.parsedPromptFile,r=n.body?.variableReferences.map(({name:u,offset:p})=>({name:u,range:new pi(p,p+u.length+1)}))??[],s=this.toolsService.toToolReferences(r);e.attachedContext.insertFirst(WF(n.uri,"vscode.prompt.file",void 0,!0,s));let l=o.promptPath,c={storage:l.storage};l.storage==="extension"?(c.extensionId=l.extension.identifier.value,c.promptName=o.name):c.promptNameHash=_r(o.name).toString(16),this.telemetryService.publicLog2("chat.promptRun",c),n.header&&await this._applyPromptMetadata(n.header,e)}async _acceptInput(e,t={}){if(!e&&this.input.generating){let v=Date.now();if(await this.input.generating,Date.now()-v>500)return}for(;!this._viewModel&&!this._store.isDisposed;)await U.toPromise(this.onDidChangeViewModel,this._store);if(!this.viewModel)return;if(this.viewOptions.submitHandler){let f=e?e.query:this.getInput();if(await this.viewOptions.submitHandler(f,this.input.currentModeKind))return}this._onDidAcceptInput.fire(),this.listWidget.setScrollLock(this.isLockedToCodingAgent||!!_Z(this.input.currentModeKind,this.viewOptions.autoScroll));let o=this.getInput(),n={input:e?e.query:o,attachedContext:t?.enableImplicitContext===!1?this.input.getAttachedContext():this.input.getAttachedAndImplicitContext()},r=!e,s=this.viewModel?.editing;if(s){let f=this.viewModel.editing.pendingKind;if(f!==void 0){let v=this.viewModel.editing.id;this.chatService.removePendingRequest(this.viewModel.sessionResource,v),t.queue??=f}else await this.chatService.cancelCurrentRequestForSession(this.viewModel.sessionResource,"acceptInput-editing"),t.queue=void 0;this.finishedEditing(!0),this.viewModel.model?.setCheckpoint(void 0)}let l=this.viewModel.model,c=l.requestInProgress.get();if(l.requestNeedsInput.get()&&!l.getPendingRequests().length&&(await this.chatService.cancelCurrentRequestForSession(this.viewModel.sessionResource,"acceptInput-needsInput"),t.queue??="queued"),c&&(t.queue??="queued"),!c&&!s&&!await this.confirmPendingRequestsBeforeSend(l,t))return;if(await this._applyPromptFileIfSet(n),FF(this.viewModel.sessionResource,OF.WillCollectInstructions),await this._autoAttachInstructions(n),FF(this.viewModel.sessionResource,OF.DidCollectInstructions),this.viewOptions.enableWorkingSet!==void 0&&this.input.currentModeKind==="edit"){let f=new En,v=n.attachedContext,b=this.viewModel.model.getRequests();for(let S of b)for(let y of S.variableData.variables)if(A.isUri(y.value)&&y.kind==="file"){let w=y.value;f.has(w)||(v.add(y),f.add(y.value))}n.attachedContext=v,this.telemetryService.publicLog2("chatEditing/workingSetSize",{originalSize:f.size,actualSize:f.size})}if(this.input.validateAgentMode(),this.viewModel.model.checkpoint){let f=this.viewModel.model.getRequests();for(let v=f.length-1;v>=0;v-=1){let b=f[v];b.shouldBeBlocked&&this.chatService.removeRequest(this.viewModel.sessionResource,b.id)}}let u=await this._resolveDirectoryImageAttachments(n.attachedContext.asArray()),p=this.viewModel.sessionResource,h=await this.chatService.sendRequest(this.viewModel.sessionResource,n.input,{userSelectedModelId:this.input.currentLanguageModel,location:this.location,locationData:this._location.resolveData?.(),parserContext:{selectedAgent:this._lastSelectedAgent,mode:this.input.currentModeKind,attachmentCapabilities:this._lastSelectedAgent?.capabilities??this.attachmentCapabilities},attachedContext:n.attachedContext.asArray(),resolvedVariables:u,noCommandDetection:t?.noCommandDetection,...this.getModeRequestOptions(),modeInfo:this.input.currentModeInfo,agentIdSilent:this._lockedAgent?.id,queue:t?.queue});if(p4.isRejected(h))return;this.logThinkingStyleUsage("submit"),this.updateChatViewVisibility(),this.input.acceptInput(t?.storeToHistory??r);let g=p4.isQueued(h)?await h.deferred:h;if(p4.isSent(g)){if(this._onDidSubmitAgent.fire({agent:g.data.agent,slashCommand:g.data.slashCommand}),this.handleDelegationExitIfNeeded(this._lockedAgent,g.data.agent),g.newSessionResource){let f=this.chatService.getSession(g.newSessionResource);f&&this.setModel(f)}return g.data.responseCreatedPromise.then(()=>{this.chatAccessibilityService.acceptRequest(p),g.data.responseCompletePromise.then(()=>{let f=this.viewModel?.getItems().filter(Ui),v=f?.[f.length-1];if(this.chatAccessibilityService.acceptResponse(this,this.container,v,p,t?.isVoiceInput),v?.result?.nextQuestion){let{prompt:b,participant:S,command:y}=v.result.nextQuestion,w=fLt(this.chatAgentService,this.location,b,S,y);w&&this.input.setValue(w,!1)}})}),g.data.responseCreatedPromise}}async _resolveDirectoryImageAttachments(e){let t=[];for(let n of e)n.kind==="directory"&&A.isUri(n.value)&&t.push(this.chatAttachmentResolveService.resolveDirectoryImages(n.value));return t.length===0?[]:(await Promise.all(t)).flat()}async confirmPendingRequestsBeforeSend(e,t){if(t.queue||!(e.getPendingRequests().length>0))return!0;let n=await this.dialogService.prompt({type:"question",message:d(7966,null),detail:d(7964,null),buttons:[{label:d(7965,null),run:()=>"keep"},{label:d(7967,null),run:()=>"remove"}],cancelButton:!0});if(!n.result)return!1;if(n.result==="remove")for(let r of[...e.getPendingRequests()])this.chatService.removePendingRequest(e.sessionResource,r.request.id);return!0}getModeRequestOptions(){let e=this.viewModel?.sessionResource,t=this.input.currentModeObs.get().id,o=this.input.selectedToolsModel.userSelectedTools,n=o.get(),r=ke(s=>{let l=this._viewModelObs.read(s)?.sessionResource,c=this.input.currentModeObs.read(s).id;if(Qe(l,e)&&c===t){let u=o.read(s);return n=u,u}return n});return{modeInfo:this.input.currentModeInfo,userSelectedTools:r}}getCodeBlockInfosForResponse(e){return this.listWidget.getCodeBlockInfosForResponse(e)}getCodeBlockInfoForEditor(e){return this.listWidget.getCodeBlockInfoForEditor(e)}getFileTreeInfosForResponse(e){return this.listWidget.getFileTreeInfosForResponse(e)}getLastFocusedFileTreeForResponse(e){return this.listWidget.getLastFocusedFileTreeForResponse(e)}focusResponseItem(e){this.listWidget.focusLastItem(e)}setInputPartMaxHeightOverride(e){this.inputPartMaxHeightOverride=e}layout(e,t){t=Math.min(t,this.viewOptions.renderStyle==="minimal"?t:950),this.bodyDimension=new si(t,e),this.viewModel?.editing&&this.inlineInputPart?.layout(t);let o=this.chatSuggestNextWidget.height,n=this._dynamicMessageLayoutData||this.location!=="panel"?void 0:this.inputPartMaxHeightOverride!==void 0?Math.max(0,this.inputPartMaxHeightOverride-o-Ubo):Math.max(0,e-o-Ubo);this.inputPart.setMaxHeight(n),this.inputPart.layout(t),this._layoutListForInputHeight()}_layoutListForInputHeight(){if(!this.bodyDimension)return;let{height:e,width:t}=this.bodyDimension,o=this.chatSuggestNextWidget.height,n=this.inputPart.height.get(),r=this.listWidget.isScrolledToBottom,s=this.listWidget.lastItem,l=Math.max(0,e-n-o);this.listWidget.layout(l,t),this.welcomeMessageContainer.style.height=`${l}px`;let c=Ui(s)&&s.renderData;r&&(!c||_Z(this.input.currentModeKind,this.viewOptions.autoScroll))&&this.listWidget.scrollToEnd(),this.listContainer.style.height=`${l}px`,this._onDidChangeHeight.fire(e)}setDynamicChatTreeItemLayout(e,t){this._dynamicMessageLayoutData={numOfMessages:e,maxHeight:t,enabled:!0},this._register(this.listWidget.onDidChangeItemHeight(()=>this.layoutDynamicChatTreeItemMode()));let o=this._register(new me);this._register(this.listWidget.onDidScroll(n=>{this._dynamicMessageLayoutData?.enabled&&(o.value=Wr(Re(this.listContainer),()=>{if(!n.scrollTopChanged||n.heightChanged||n.scrollHeightChanged)return;let r=n.height,s=n.scrollHeight-r-n.scrollTop;if(s===0)return;let l=this._dynamicMessageLayoutData?.maxHeight??t,c=this.bodyDimension?.width??this.container.offsetWidth;this.input.layout(c);let u=this.input.height.get(),p=this.chatSuggestNextWidget.height,h=Math.min(r+s,l-u-p);this.layout(h+u+p,c)}))}))}updateDynamicChatTreeItemLayout(e,t){this._dynamicMessageLayoutData={numOfMessages:e,maxHeight:t,enabled:!0};let o=!1,n=this.bodyDimension.height,r=this.bodyDimension.width;t<this.bodyDimension.height&&(n=t,o=!0);let s=this.container.offsetWidth;this.bodyDimension?.width!==s&&(r=s,o=!0),o&&this.layout(n,r)}get isDynamicChatTreeItemLayoutEnabled(){return this._dynamicMessageLayoutData?.enabled??!1}set isDynamicChatTreeItemLayoutEnabled(e){this._dynamicMessageLayoutData&&(this._dynamicMessageLayoutData.enabled=e)}layoutDynamicChatTreeItemMode(){if(!this.viewModel||!this._dynamicMessageLayoutData?.enabled)return;let e=this.bodyDimension?.width??this.container.offsetWidth;this.input.layout(e);let t=this.input.height.get(),o=this.chatSuggestNextWidget.height,n=this.viewModel.getItems(),r=n.slice(-this._dynamicMessageLayoutData.numOfMessages),s=r.some(c=>c.currentRenderedHeight===void 0),l=s?this._dynamicMessageLayoutData.maxHeight:r.reduce((c,u)=>c+u.currentRenderedHeight,0);this.layout(Math.min(t+o+l+(n.length>2?18:0),this._dynamicMessageLayoutData.maxHeight),e),(s||!l)&&this.listWidget.scrollToEnd()}saveState(){}getViewState(){return this.input.getCurrentInputState()}updateChatInputContext(){let e=this.parsedInput.parts.find(t=>t instanceof lp);this.agentInInput.set(!!e)}async _switchToAgentByName(e){let t=this.input.currentModeObs.get();if(e!==t.name.get()){let o=this.chatModeService.findModeByName(e);if(o){if(t.kind!==o.kind){let n=await this.instantiationService.invokeFunction(EXe,t.kind,o.kind,this.viewModel?.model.getRequests().length??0,this.viewModel?.model);if(!n)return;n.needToClearSession&&await this.clear()}this.input.setChatMode(o.id)}}}async _applyPromptMetadata({agent:e,tools:t,model:o},n){if(t!==void 0&&!e&&this.input.currentModeKind!=="agent"&&(e=Tl.Agent.name.get()),e&&this._switchToAgentByName(e),t!==void 0&&this.input.currentModeKind==="agent"){let r=this.toolsService.toToolAndToolSetEnablementMap(t,this.input.selectedLanguageModel.get()?.metadata);this.input.selectedToolsModel.set(r,!0)}o!==void 0&&this.input.switchModelByQualifiedName(o)}async _autoAttachInstructions({attachedContext:e}){let t=this._lockedAgent?this.chatSessionsService.getChatSessionContribution(this._lockedAgent.id):void 0;if(!(!!t?t.autoAttachReferences===!0:!0)){this.logService.debug("ChatWidget#_autoAttachInstructions: skipped, autoAttachReferences is disabled");return}try{this.logService.debug("ChatWidget#_autoAttachInstructions: prompt files are enabled");let r=this.input.currentModeKind==="agent"?this.input.selectedToolsModel.userSelectedTools.get():void 0,s=this.input.currentModeKind==="agent"?this.input.currentModeObs.get().agents?.get():void 0,l=this._viewModel?.model.sessionResource;await this.instantiationService.createInstance(Bte,this.input.currentModeKind,r,s,l).collect(e,Se.None)}catch(r){this.logService.error("ChatWidget#_autoAttachInstructions: failed to compute automatic instructions",r)}}delegateScrollFromMouseWheelEvent(e){this.listWidget.delegateScrollFromMouseWheelEvent(e)}};kI=I([m(4,qt),m(5,B),m(6,at),m(7,X),m(8,F),m(9,mi),m(10,cr),m(11,Pt),m(12,NF),m(13,se),m(14,Le),m(15,BF),m(16,ud),m(17,Te),m(18,Or),m(19,Vn),m(20,Fg),m(21,z1t),m(22,rr),m(23,Us),m(24,md),m(25,h0),m(26,ji),m(27,rW),m(28,wW),m(29,Yp)],kI);var Ubo=50;var Rge=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g){this._options=e;this._instantiationService=t;this._contextKeyService=o;this._keybindingService=n;this._accessibilityService=r;this._configurationService=s;this._accessibleViewService=l;this._textModelResolverService=c;this._chatService=u;this._hoverService=p;this._chatEntitlementService=h;this._markdownRendererService=g;this._elements=ct("div.inline-chat@root",[ct("div.chat-widget@chatWidget"),ct("div.accessibleViewer@accessibleViewer"),ct("div.status@status",[ct("div.label.info.hidden@infoLabel"),ct("div.actions.hidden@toolbar1"),ct("div.label.status.hidden@statusLabel"),ct("div.actions.secondary.hidden@toolbar2"),ct("div.label.disclaimer.hidden@disclaimerLabel")])]);this._store=new N;this._onDidChangeHeight=this._store.add(new E);this.onDidChangeHeight=U.filter(this._onDidChangeHeight.event,i=>!this._isLayouting);this._requestInProgress=Me(this,!1);this.requestInProgress=this._requestInProgress;this._isLayouting=!1;this.scopedContextKeyService=this._store.add(o.createScoped(this._elements.chatWidget));let f=t.createChild(new _o([X,this.scopedContextKeyService]),this._store);this._chatWidget=f.createInstance(kI,i,{isInlineChat:!0},{autoScroll:!0,defaultElementHeight:32,renderStyle:"minimal",renderInputOnTop:!1,renderFollowups:!0,supportsFileReferences:!0,filter:G=>!Ui(G)||G.errorDetails?!0:!(G.response.value.length===0||G.response.value.every(J=>J.kind==="textEditGroup"&&e.chatWidgetViewOptions?.rendererOptions?.renderTextEditsAsSummary?.(J.uri))),dndContainer:this._elements.root,defaultMode:Tl.Ask,...e.chatWidgetViewOptions},{listForeground:bgo,listBackground:xTi,overlayBackground:oT,inputEditorBackground:yv,resultEditorBackground:Ho}),this._elements.root.classList.toggle("in-zone-widget",!!e.inZoneWidget),this._chatWidget.render(this._elements.chatWidget),this._elements.chatWidget.style.setProperty(yO(Bvo),kt(xTi)),this._chatWidget.setVisible(!0),this._store.add(this._chatWidget);let v=ie.isResponse.bindTo(this.scopedContextKeyService),b=ie.responseVote.bindTo(this.scopedContextKeyService),S=ie.responseSupportsIssueReporting.bindTo(this.scopedContextKeyService),y=ie.responseHasError.bindTo(this.scopedContextKeyService),w=ie.responseIsFiltered.bindTo(this.scopedContextKeyService),k=this._store.add(new N);this._store.add(this._chatWidget.onDidChangeViewModel(()=>{k.clear();let G=this._chatWidget.viewModel;G&&(k.add(Z(()=>{H.context=void 0,v.reset(),b.reset(),y.reset(),w.reset(),S.reset()})),k.add(G.onDidChange(()=>{this._requestInProgress.set(G.model.requestInProgress.get(),void 0);let $=G.getItems().at(-1);H.context=$,v.set(Ui($)),b.set(Ui($)?$.vote===0?"down":$.vote===1?"up":"":""),y.set(Ui($)&&$.errorDetails!==void 0),w.set(!!(Ui($)&&$.errorDetails?.responseIsFiltered)),S.set(Ui($)&&($.agent?.metadata.supportIssueReporting??!1)),this._onDidChangeHeight.fire()})),this._onDidChangeHeight.fire())})),this._store.add(this.chatWidget.onDidChangeContentHeight(()=>{this._onDidChangeHeight.fire()})),this._ctxResponseFocused=C1t.bindTo(this._contextKeyService);let T=this._store.add(qn(this.domNode));this._store.add(T.onDidBlur(()=>this._ctxResponseFocused.set(!1))),this._store.add(T.onDidFocus(()=>this._ctxResponseFocused.set(!0))),this._ctxInputEditorFocused=_G.bindTo(o),this._store.add(this._chatWidget.inputEditor.onDidFocusEditorWidget(()=>this._ctxInputEditorFocused.set(!0))),this._store.add(this._chatWidget.inputEditor.onDidBlurEditorWidget(()=>this._ctxInputEditorFocused.set(!1)));let P=e.statusMenuId instanceof D?e.statusMenuId:e.statusMenuId.menu,O=e.statusMenuId instanceof D?void 0:e.statusMenuId.options,V=f.createInstance(LG,this._elements.toolbar1,P,{toolbarOptions:{primaryGroup:"0_main"},telemetrySource:e.chatWidgetViewOptions?.menus?.telemetrySource,menuOptions:{renderShortTitle:!0},...O});this._store.add(V.onDidChange(()=>this._onDidChangeHeight.fire())),this._store.add(V);let H=f.createInstance(or,this._elements.toolbar2,e.secondaryMenuId??D.for(""),{telemetrySource:e.chatWidgetViewOptions?.menus?.telemetrySource,menuOptions:{renderShortTitle:!0,shouldForwardArgs:!0},actionViewItemProvider:(G,$)=>Bs(f,G,$)});this._store.add(H.onDidChangeMenuItems(()=>this._onDidChangeHeight.fire())),this._store.add(H),this._store.add(this._configurationService.onDidChangeConfiguration(G=>{G.affectsConfiguration("accessibility.verbosity.inlineChat")&&this._updateAriaLabel()})),this._elements.root.tabIndex=0,this._elements.statusLabel.tabIndex=0,this._updateAriaLabel(),this._setupDisclaimer(),this._store.add(this._hoverService.setupManagedHover(Ri("element"),this._elements.statusLabel,()=>this._elements.statusLabel.dataset.title)),this._store.add(this._chatService.onDidPerformUserAction(G=>{Qe(G.sessionResource,this._chatWidget.viewModel?.model.sessionResource)&&G.action.kind==="vote"&&this.updateStatus(d(11269,null),{resetAfter:1250})}))}_updateAriaLabel(){if(this._elements.root.ariaLabel=this._accessibleViewService.getOpenAriaHint("accessibility.verbosity.inlineChat"),this._accessibilityService.isScreenReaderOptimized()){let i=fin;if(this._configurationService.getValue("accessibility.verbosity.inlineChat")){let e=this._keybindingService.lookupKeybinding("editor.action.accessibilityHelp")?.getLabel();i=e?d(11270,null,e):d(11271,null)}this._chatWidget.inputEditor.updateOptions({ariaLabel:i})}}_setupDisclaimer(){let i=this._store.add(new N);this._store.add(be(e=>{i.clear(),vi(this._elements.disclaimerLabel);let t=this._chatEntitlementService.sentimentObs.read(e),o=this._chatEntitlementService.anonymousObs.read(e),n=this._chatService.requestInProgressObs.read(e),r=!t.installed&&o&&!n;if(this._elements.disclaimerLabel.classList.toggle("hidden",!r),r){let s=i.add(this._markdownRendererService.render(new Ie(d(11272,null,ro.defaultChatAgent?.provider?.default?.name??"",ro.defaultChatAgent?.provider?.default?.name??"",ro.defaultChatAgent?.termsStatementUrl??"",ro.defaultChatAgent?.privacyStatementUrl??""),{isTrusted:!0})));this._elements.disclaimerLabel.appendChild(s.element)}this._onDidChangeHeight.fire()}))}dispose(){this._store.dispose()}get domNode(){return this._elements.root}get chatWidget(){return this._chatWidget}saveState(){this._chatWidget.saveState()}layout(i){let e=this.contentHeight;this._isLayouting=!0;try{this._doLayout(i)}finally{this._isLayouting=!1,this.contentHeight!==e&&this._onDidChangeHeight.fire()}}_doLayout(i){let e=this._getExtraHeight(),t=mh(this._elements.status);this._elements.root.style.height=`${i.height-e}px`,this._elements.root.style.width=`${i.width}px`,this._chatWidget.layout(i.height-t-e,i.width)}get contentHeight(){let i={chatWidgetContentHeight:this._chatWidget.contentHeight,statusHeight:mh(this._elements.status),extraHeight:this._getExtraHeight()};return i.chatWidgetContentHeight+i.statusHeight+i.extraHeight}get minHeight(){let i=100;for(let t of this._chatWidget.viewModel?.getItems()??[])if(Ui(t)&&t.response.value.some(o=>o.kind==="textEditGroup"&&!o.state?.applied)){i=270;break}let e=this.contentHeight;return e-=this._chatWidget.contentHeight,e+=Math.min(this._chatWidget.input.height.get()+i,this._chatWidget.contentHeight),e}_getExtraHeight(){return this._options.inZoneWidget?1:6}get value(){return this._chatWidget.getInput()}set value(i){this._chatWidget.setInput(i)}selectAll(){this._chatWidget.inputEditor.setSelection(new ti(1,1,Number.MAX_SAFE_INTEGER,1))}set placeholder(i){this._chatWidget.setInputPlaceholder(i)}toggleStatus(i){this._elements.toolbar1.classList.toggle("hidden",!i),this._elements.toolbar2.classList.toggle("hidden",!i),this._elements.status.classList.toggle("hidden",!i),this._elements.infoLabel.classList.toggle("hidden",!i),this._onDidChangeHeight.fire()}updateToolbar(i){this._elements.root.classList.toggle("toolbar",i),this._elements.toolbar1.classList.toggle("hidden",!i),this._elements.toolbar2.classList.toggle("hidden",!i),this._elements.status.classList.toggle("actions",i),this._elements.infoLabel.classList.toggle("hidden",i),this._onDidChangeHeight.fire()}async getCodeBlockInfo(i){let{viewModel:e}=this._chatWidget;if(!e)return;let o=e.getItems().filter(u=>Ui(u)).at(-1);if(!o)return;let n=e.codeBlockModelCollection.get(e.sessionResource,o,i);if(n)return n.model;let r=o.response.getMarkdown(),s=0,l;return FQi(uY(r),u=>{u.type==="code"&&(s===i&&(l={text:u.text,lang:u.lang||""}),s++)}),l?e.codeBlockModelCollection.updateSync(e.sessionResource,o,i,{text:l.text,languageId:l.lang,isComplete:!0}).model:void 0}get responseContent(){return this._chatWidget.viewModel?.model.getRequests()?.at(-1)?.response?.response.toString()}getChatModel(){return this._chatWidget.viewModel?.model}setChatModel(i){i.inputModel.setState({inputText:"",selections:[]}),this._chatWidget.setModel(i)}updateInfo(i){this._elements.infoLabel.classList.toggle("hidden",!i);let e=Un(i);vi(this._elements.infoLabel,...e),this._onDidChangeHeight.fire()}updateStatus(i,e={}){let t=typeof e.resetAfter=="number";if(t&&!this._elements.statusLabel.dataset.state){let n=this._elements.statusLabel.innerText,r=this._elements.statusLabel.dataset.title,s=Array.from(this._elements.statusLabel.classList.values());setTimeout(()=>{this.updateStatus(n,{classes:s,keepMessage:!0,title:r})},e.resetAfter)}let o=Un(i);vi(this._elements.statusLabel,...o),this._elements.statusLabel.className=`label status ${(e.classes??[]).join(" ")}`,this._elements.statusLabel.classList.toggle("hidden",!i),t?this._elements.statusLabel.dataset.state="temp":delete this._elements.statusLabel.dataset.state,e.title?this._elements.statusLabel.dataset.title=e.title:delete this._elements.statusLabel.dataset.title,this._onDidChangeHeight.fire()}reset(){this._chatWidget.attachmentModel.clear(!0),this._chatWidget.saveState(),vi(this._elements.statusLabel),this._elements.statusLabel.classList.toggle("hidden",!0),this._elements.toolbar1.classList.add("hidden"),this._elements.toolbar2.classList.add("hidden"),this.updateInfo(""),this._elements.accessibleViewer.classList.toggle("hidden",!0),this._onDidChangeHeight.fire()}focus(){this._chatWidget.focusInput()}hasFocus(){return this.domNode.contains(Nn())}};Rge=I([m(2,F),m(3,X),m(4,_e),m(5,Oi),m(6,B),m(7,ou),m(8,Bt),m(9,mi),m(10,nt),m(11,rr),m(12,On)],Rge);var fin=d(11268,null),eFe=class extends Rge{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v){let b=g.getContainer(Re(e.getContainerDomNode())).appendChild(_(".inline-chat-overflow.monaco-editor"));super(i,{...t,chatWidgetViewOptions:{...t.chatWidgetViewOptions,editorOverflowWidgetsDomNode:b}},r,o,n,s,l,c,u,p,h,f,v),this._store.add(Z(()=>{b.remove()}))}_doLayout(i){let e=i.height;super._doLayout(i.with(void 0,e)),this._elements.root.style.height=`${i.height-this._getExtraHeight()}px`}reset(){this.chatWidget.setInput(),super.reset()}};eFe=I([m(3,X),m(4,_e),m(5,F),m(6,Oi),m(7,B),m(8,ou),m(9,Bt),m(10,mi),m(11,nt),m(12,Kl),m(13,rr),m(14,On)],eFe);var Aie=class extends ZO{constructor(e,t,o,n,r,s,l){super(o.editor,Aie._options);this._instaService=r;this._logService=s;this.notebookEditor=o.notebookEditor,this._ctxCursorPosition=mit.bindTo(l),this._disposables.add(Z(()=>{this._ctxCursorPosition.reset()})),this.widget=this._instaService.createInstance(eFe,e,this.editor,{statusMenuId:{menu:Ate,options:{buttonConfigProvider:(p,h)=>{let g=h>0;return new Set([hgo,ggo,fgo]).has(p.id)?{isSecondary:g,showIcon:!0,showLabel:!1}:{isSecondary:g}}}},secondaryMenuId:qH,inZoneWidget:!0,chatWidgetViewOptions:{menus:{telemetrySource:"interactiveEditorWidget-toolbar",inputSideToolbar:vgo},clear:n,...t,rendererOptions:{renderTextEditsAsSummary:p=>Qe(p,o.editor.getModel()?.uri),renderDetectedCommandsWithRequest:!0,...t?.rendererOptions},defaultMode:Tl.Ask}}),this._disposables.add(this.widget);let c;this._disposables.add(this.widget.chatWidget.onWillMaybeChangeHeight(()=>{this.position&&(c=this._createZoneAndScrollRestoreFn(this.position))})),this._disposables.add(this.widget.onDidChangeHeight(()=>{if(this.position&&!this._usesResizeHeight){c??=this._createZoneAndScrollRestoreFn(this.position);let p=this._computeHeight();this._relayout(p.linesValue),c?.(),c=void 0}})),this.create(),this._disposables.add(be(p=>{let h=this.widget.requestInProgress.read(p);this.domNode.firstElementChild?.classList.toggle("busy",h)})),this._disposables.add(j(this.domNode,"click",p=>{!this.editor.hasWidgetFocus()&&!this.widget.hasFocus()&&this.editor.focus()},!0));let u=()=>{!this.position||!this.editor.hasModel()?this._ctxCursorPosition.reset():this.position.lineNumber===this.editor.getPosition().lineNumber?this._ctxCursorPosition.set("above"):this.position.lineNumber+1===this.editor.getPosition().lineNumber?this._ctxCursorPosition.set("below"):this._ctxCursorPosition.reset()};this._disposables.add(this.editor.onDidChangeCursorPosition(p=>u())),this._disposables.add(this.editor.onDidFocusEditorText(p=>u())),u()}static{this._options={showFrame:!0,frameWidth:1,isResizeable:!0,showArrow:!1,isAccessible:!0,className:"inline-chat-widget",keepEditorSelection:!0,showInHiddenAreas:!0,ordinal:5e4}}_fillContainer(e){e.style.setProperty("--vscode-inlineChat-background","var(--vscode-editor-background)"),e.appendChild(this.widget.domNode)}_doLayout(e){this._updatePadding();let t=this.editor.getLayoutInfo(),o=t.contentWidth-t.verticalScrollbarWidth;this._dimension=new si(o,e),this.widget.layout(this._dimension)}_computeHeight(){let e=this.widget.contentHeight,t=this.notebookEditor?.getLayoutInfo().height??this.editor.getLayoutInfo().height,o=this._decoratingElementsHeight()+Math.min(e,Math.max(this.widget.minHeight,t*.42));return{linesValue:o/this.editor.getOption(75),pixelsValue:o}}_getResizeBounds(){let e=this.editor.getOption(75),t=this._decoratingElementsHeight(),o=t+this.widget.minHeight,n=t+this.widget.contentHeight;return{minLines:o/e,maxLines:n/e}}_onWidth(e){this._dimension&&this._doLayout(this._dimension.height)}show(e){wo(this.container),this._updatePadding();let t=this._createZoneAndScrollRestoreFn(e);super.show(e,this._computeHeight().linesValue),this.widget.chatWidget.setVisible(!0),this.widget.focus(),t()}_updatePadding(){wo(this.container);let e=this.editor.getLayoutInfo(),t=e.glyphMarginWidth+e.lineNumbersWidth+e.decorationsWidth;this.container.style.paddingLeft=`${t}px`}reveal(e){let t=this.editor.getOption(131),o=t.enabled?t.maxLineCount:0;this.editor.revealLines(e.lineNumber+o,e.lineNumber+o,1),this.updatePositionAndHeight(e)}updatePositionAndHeight(e){let t=this._createZoneAndScrollRestoreFn(e);super.updatePositionAndHeight(e,this._usesResizeHeight?void 0:this._computeHeight().linesValue),t()}_createZoneAndScrollRestoreFn(e){let t=j5e.capture(this.editor),o=e.lineNumber<=1?1:1+e.lineNumber;return()=>{t.restore(this.editor);let n=this.editor.getScrollTop(),r=this.editor.getTopForLineNumber(o),s=r-this._computeHeight().pixelsValue,l=this.editor.getLayoutInfo().height,c=this.editor.getBottomForLineNumber(o),u=s,p=!1;c>=n+l&&(u=c-l,p=!0),(u<n||p)&&(this._logService.trace("[IE] REVEAL zone",{zoneTop:s,lineTop:r,lineBottom:c,scrollTop:n,newScrollTop:u,forceScrollTop:p}),this.editor.setScrollTop(u,1))}}revealRange(e,t){}hide(){let e=j5e.capture(this.editor);this._ctxCursorPosition.reset(),this.widget.chatWidget.setVisible(!1),super.hide(),qr(d(11273,null)),e.restore(this.editor)}};Aie=I([m(4,F),m(5,se),m(6,X)],Aie);var zot=class{static isInlineChatRunOptions(i){if(typeof i!="object"||i===null)return!1;let{initialSelection:e,initialRange:t,message:o,autoSend:n,position:r,attachments:s,modelSelector:l,resolveOnResponse:c,attachDiagnostics:u}=i;return!(typeof o<"u"&&typeof o!="string"||typeof n<"u"&&typeof n!="boolean"||typeof t<"u"&&!z.isIRange(t)||typeof e<"u"&&!ti.isISelection(e)||typeof r<"u"&&!ye.isIPosition(r)||typeof s<"u"&&(!Array.isArray(s)||!s.every(p=>p instanceof A))||typeof l<"u"&&!Peo(l)||typeof c<"u"&&typeof c!="boolean"||typeof u<"u"&&typeof u!="boolean")}};function vin(a,i){return`${a.getId()},${i.id}`}var Nd=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){this._editor=i;this._instaService=e;this._notebookEditorService=t;this._inlineChatSessionService=o;this._configurationService=s;this._webContentExtractorService=l;this._fileService=c;this._chatAttachmentResolveService=u;this._editorService=p;this._markerDecorationsService=h;this._languageModelService=g;this._logService=f;this._chatEditingService=v;this._chatService=b;this._store=new N;this._isActiveController=Me(this,!1);let S=gs(i),y=nW.bindTo(r),w=Py.bindTo(r),k=x1t.bindTo(r),T=Mhe.bindTo(r),P=hr("inlineChat.notebookAgent",!1,this._configurationService);this._renderMode=hr("inlineChat.renderMode","zone",this._configurationService),this._store.add(be(oe=>{let de=S.model.read(oe);if(!de){w.set(!1);return}let Ce=this._chatEditingService.editingSessionsObs.read(oe),xe=!1;for(let ze of Ce){let De=ze.entries.read(oe);for(let Oe of De)if(Qe(Oe.modifiedURI,de.uri)){xe=!0;break}if(xe)break}w.set(xe)}));let O=this._inputWidget=this._store.add(this._instaService.createInstance(YAe,S)),V=this._store.add(this._instaService.createInstance(XAe,S));this.inputOverlayWidget=this._store.add(this._instaService.createInstance(KAe,this._editor,O)),this._zone=new co(()=>{wo(this._editor.hasModel(),"[Illegal State] widget should only be created when the editor has a model");let oe={location:"editor",resolveData:()=>{wo(this._editor.hasModel());let xe=this._editor.getSelection(),ze=this._editor.getModel().uri;return{type:"editor",id:vin(this._editor,this._editor.getModel()),selection:this._editor.getSelection(),document:ze,wholeRange:xe}}},de=this._notebookEditorService.getNotebookForPossibleCell(this._editor);de&&(oe.location="notebook",P.get()&&(oe.resolveData=()=>(wo(this._editor.hasModel()),{type:"notebook",sessionInputUri:this._editor.getModel().uri})));let Ce=this._instaService.createInstance(Aie,oe,{enableWorkingSet:"implicit",enableImplicitContext:!1,renderInputOnTop:!1,renderInputToolbarBelowInput:!0,filter:xe=>Ui(xe)?!!xe.model.isPendingConfirmation.get():!1,menus:{telemetrySource:"inlineChatWidget",executeToolbar:D.ChatEditorInlineExecute,inputSideToolbar:D.ChatEditorInlineInputSide},defaultMode:Tl.Ask},{editor:this._editor,notebookEditor:de},()=>Promise.resolve());return this._store.add(Ce),Ce.domNode.classList.add("inline-chat-2"),Ce});let H=Fr(this,o.onDidChangeSessions);this._currentSession=ke(oe=>{H.read(oe);let de=S.model.read(oe);return(de&&o.getSessionByTextModel(de.uri))??void 0});let G;this._store.add(be(oe=>{let de=this._currentSession.read(oe);if(!de){if(this._isActiveController.set(!1,void 0),G&&!G.chatModel.hasRequests){let xe=G.chatModel.inputModel.state.read(void 0);(!xe||!xe.inputText&&xe.attachments.length===0)&&(G.dispose(),G=void 0)}return}G=de;let Ce=!1;for(let xe of n.listCodeEditors())if(Nd.get(xe)?._isActiveController.read(void 0)){Ce=!0;break}!Ce&&S.isFocused.read(oe)&&this._isActiveController.set(!0,void 0)}));let $=Me(this,void 0);this._store.add(be(oe=>{let de=S.model.read(oe),Ce=this._currentSession.read(oe),xe=this._isActiveController.read(oe);!Ce||!xe||!de?$.set(void 0,void 0):$.set(Ce,void 0)}));let J=$.map((oe,de)=>oe?.initialSelection.isEmpty()?d(11245,null):d(11247,null));this._store.add(be(oe=>{let de=$.read(oe);T.set(!!de?.terminationState.read(oe))})),this._store.add(be(oe=>{let de=$.read(oe),Ce=this._renderMode.read(oe);de?Ce==="hover"?(this._zone.value.widget.chatWidget.setModel(de.chatModel),this._zone.rawValue?.hide(),y.set(!0)):(y.set(!0),this._zone.value.widget.chatWidget.setModel(de.chatModel),this._zone.value.position||(this._zone.value.widget.chatWidget.setInputPlaceholder(J.read(oe)),this._zone.value.widget.chatWidget.input.renderAttachedContext(),this._zone.value.show(de.initialPosition)),this._zone.value.reveal(this._zone.value.position),this._zone.value.widget.focus()):(this._zone.rawValue?.hide(),this._zone.rawValue?.widget.chatWidget.setModel(void 0),i.focus(),y.reset())})),this._store.add(be(oe=>{let de=$.read(oe),Ce=this._renderMode.read(oe);if(!de||Ce!=="hover"){k.set(!1),V.hide();return}let xe=de.chatModel.lastRequestObs.read(oe),ze=xe?.response?.isInProgress.read(oe),De=!!xe?.response?.isPendingConfirmation.read(oe),Oe=!!xe?.response?.result?.errorDetails,pt=!!de.terminationState.read(oe);k.set(De);let et=de.editingSession.readEntry(de.uri,oe),Ti=et?et.state.read(oe)===0:!1;ze||Ti||De||Oe||pt?V.show(de):V.hide()})),this._store.add(be(oe=>{let de=$.read(oe);if(de){let Ce=de.editingSession.entries.read(oe),xe=Zo.parse(de.uri),ze=Ce.filter(De=>!(Qe(De.modifiedURI,de.uri)||xe&&Qe(xe.notebook,De.modifiedURI)));for(let De of ze)this._editorService.openEditor({resource:De.modifiedURI},In).catch(mt)}}));let ae=$.map((oe,de)=>oe?ui(this,oe.chatModel.onDidChange,()=>oe.chatModel.getRequests().at(-1)).read(de)?.response:void 0),he=ae.map((oe,de)=>{if(oe)return ui(this,oe.onDidChange,()=>oe.response.value.findLast(Ce=>Ce.kind==="progressMessage")).read(de)});this._store.add(be(oe=>{let de=$.read(oe),Ce=ae.read(oe),xe=de?.terminationState.read(oe);if(this._zone.rawValue?.widget.updateInfo(""),!Ce?.isInProgress.read(oe))Ce?.result?.errorDetails?(this._zone.rawValue?.widget.updateInfo(`$(error) ${Ce.result.errorDetails.message}`),en(Ce.result.errorDetails.message)):xe&&this._zone.rawValue?.widget.updateInfo(`$(info) ${Da(xe)}`),this._zone.rawValue?.widget.domNode.classList.toggle("request-in-progress",!1),this._zone.rawValue?.widget.chatWidget.setInputPlaceholder(J.read(oe));else{this._zone.rawValue?.widget.domNode.classList.toggle("request-in-progress",!0);let ze=Ce.request?.message.text,De=he.read(oe);De&&(ze=Da(De.content)),this._zone.rawValue?.widget.chatWidget.setInputPlaceholder(ze||d(11244,null))}})),this._store.add(be(oe=>{let de=$.read(oe);if(!de)return;let Ce=de.editingSession.readEntry(de.uri,oe);Ce?.state.read(oe)===0&&Ce?.enableReviewModeUntilSettled()})),this._store.add(be(oe=>{let de=$.read(oe),Ce=de?.editingSession.readEntry(de.uri,oe),xe=this._editorService.visibleEditorPanes.find(ze=>ze.getControl()===this._editor||Zmo(ze,this._editor));if(xe&&Ce&&Ce?.getEditorIntegration(xe),Ce?.diffInfo&&this._zone.value.position){let{position:ze}=this._zone.value,De=Ce.diffInfo.read(oe);for(let Oe of De.changes)if(Oe.modified.contains(ze.lineNumber)){this._zone.value.updatePositionAndHeight(new ye(Oe.modified.startLineNumber-1,1));break}}}))}static{this.ID="editor.contrib.inlineChatController"}static get(i){return i.getContribution(Nd.ID)??void 0}get widget(){return this._zone.value.widget}get isActive(){return!!this._currentSession.get()}get inputWidget(){return this._inputWidget}dispose(){this._store.dispose()}getWidgetPosition(){return this._zone.rawValue?.position}focus(){this._zone.rawValue?.widget.focus()}async run(i){wo(this._editor.hasModel());let e=this._editor.getModel().uri,t=this._inlineChatSessionService.getSessionByTextModel(e);t&&(await t.editingSession.accept(),t.dispose()),this._isActiveController.set(!0,void 0);let o=this._inlineChatSessionService.createSession(this._editor),n=new N;try{if(await this._applyModelDefaults(o,n),i&&(i.attachDiagnostics??=this._configurationService.getValue("inlineChat.renderMode")==="zone"),i?.attachDiagnostics){let r=[];for(let[s,l]of this._markerDecorationsService.getLiveMarkers(e))if(s.intersectRanges(this._editor.getSelection())){let c=nA.fromMarker(l);r.push(nA.toEntry(c))}if(r.length>0){this._zone.value.widget.chatWidget.attachmentModel.addContext(...r);let s=r.length>1?d(11243,null):d(11242,null);this._zone.value.widget.chatWidget.input.setValue(s,!0),i.message=s,this._zone.value.widget.chatWidget.inputEditor.setSelection(new ti(1,1,Number.MAX_SAFE_INTEGER,1))}}if(i&&zot.isInlineChatRunOptions(i)){if(i.initialRange&&this._editor.revealRange(i.initialRange),i.initialSelection&&this._editor.setSelection(i.initialSelection),i.attachments&&(await Promise.all(i.attachments.map(async r=>{await this._zone.value.widget.chatWidget.attachmentModel.addFile(r)})),delete i.attachments),i.modelSelector){let r=(await this._languageModelService.selectLanguageModels(i.modelSelector)).sort().at(0);if(!r)throw new Error(`No language models found matching selector: ${JSON.stringify(i.modelSelector)}.`);let s=this._languageModelService.lookupLanguageModel(r);if(!s)throw new Error(`Language model not loaded: ${r}.`);this._zone.value.widget.chatWidget.input.setCurrentLanguageModel({metadata:s,identifier:r})}i.message&&(this._zone.value.widget.chatWidget.setInput(i.message),i.autoSend&&await this._zone.value.widget.chatWidget.acceptInput())}if(i?.resolveOnResponse){let r=ke(s=>{let l=o.editingSession.readEntry(e,s);return l?.state.read(s)===0&&!l?.isCurrentlyBeingModifiedBy.read(s)});return await Wf(r,s=>s===!0),!0}else return await U.toPromise(o.editingSession.onDidDispose),!(o.editingSession.getEntry(e)?.state.get()===2)}finally{n.dispose()}}async acceptSession(){let i=this._currentSession.get();i&&(await i.editingSession.accept(),i.dispose())}async rejectSession(){let i=this._currentSession.get();i&&(await this._chatService.cancelCurrentRequestForSession(i.chatModel.sessionResource,"inlineChatReject"),await i.editingSession.reject(),i.dispose())}async continueSessionInChat(){let i=this._currentSession.get();i&&await this._instaService.invokeFunction(OUt,i)}async rephraseSession(){let i=this._currentSession.get();if(!i)return;let e=i.chatModel.getRequests().at(-1)?.message.text;if(i.dispose(),!e)return;let t=this._editor.getSelection(),o=t&&!t.isEmpty()?d(11248,null):d(11246,null);await this.inputOverlayWidget.showMenuAtSelection(o,e)}async _selectVendorDefaultModel(i){let e=this._zone.value.widget.chatWidget.input.selectedLanguageModel.get();if(e&&!e.metadata.isDefaultForLocation[i.chatModel.initialLocation]){let t=await this._languageModelService.selectLanguageModels({vendor:e.metadata.vendor});for(let o of t){let n=this._languageModelService.lookupLanguageModel(o);if(n?.isDefaultForLocation[i.chatModel.initialLocation]){this._zone.value.widget.chatWidget.input.setCurrentLanguageModel({metadata:n,identifier:o});break}}}}async _applyModelDefaults(i,e){let t=Nd._userSelectedModel,o=this._configurationService.getValue("inlineChat.defaultModel"),n=!1;t&&(n=this._zone.value.widget.chatWidget.input.switchModelByQualifiedName([t]),n||(Nd._userSelectedModel=void 0)),!n&&o&&(n=this._zone.value.widget.chatWidget.input.switchModelByQualifiedName([o]),n||this._logService.warn(`inlineChat.defaultModel setting value '${o}' did not match any available model. Falling back to vendor default.`)),n||await this._selectVendorDefaultModel(i);let r;e.add(be(s=>{let l=this._zone.value.widget.chatWidget.input.selectedLanguageModel.read(s);if(l){if(!r){r=l.identifier;return}r!==l.identifier&&(Nd._userSelectedModel=nD.asQualifiedName(l.metadata),r=l.identifier)}}))}async createImageAttachment(i){if(this._currentSession.get()){if(i.scheme===Q.file){if(await this._fileService.canHandleResource(i))return await this._chatAttachmentResolveService.resolveImageEditorAttachContext(i)}else if(i.scheme===Q.http||i.scheme===Q.https){let t=await this._webContentExtractorService.readImage(i,Se.None);if(t)return await this._chatAttachmentResolveService.resolveImageEditorAttachContext(i,t)}}}};Nd=I([m(1,F),m(2,Gc),m(3,yI),m(4,qt),m(5,X),m(6,B),m(7,DG),m(8,fe),m(9,rW),m(10,ee),m(11,H1),m(12,ds),m(13,se),m(14,ud),m(15,mi)],Nd);async function _Kt(a,i,e,t,o){if(!i.hasModel())return!1;let n=a.get(mi),r=i.getModel().uri,s=n.startNewLocalSession("editor"),l=s.object;l.startEditingSession(!0);let c=new N;c.add(s);let u=l?.addRequest({text:"",parts:[]},{variables:[]},0,{kind:void 0,modeId:"applyCodeBlock",modeInstructions:void 0,isBuiltin:!0,applyCodeBlockSuggestionId:o});wo(u.response),u.response.updateContent({kind:"textEdit",uri:r,edits:[],done:!1});for await(let g of e){if(t.isCancellationRequested){u.response.cancel();break}u.response.updateContent({kind:"textEdit",uri:r,edits:g,done:!1})}u.response.updateContent({kind:"textEdit",uri:r,edits:[],done:!0}),t.isCancellationRequested||u.response.complete();let p=ke(g=>{let f=l.editingSession?.readEntry(r,g);if(!f)return!1;let v=f.state.read(g);return v===1||v===2}),h=Wf(p,Boolean);return await Va(h,t),c.dispose(),!0}async function zbo(a,i,e,t){let o=a.get(mi),r=a.get(bn).hasSupportedNotebooks(i),s=o.startNewLocalSession("editor"),l=s.object;l.startEditingSession(!0);let c=new N;c.add(s);let u=l?.addRequest({text:"",parts:[]},{variables:[]},0);wo(u.response),r?u.response.updateContent({kind:"notebookEdit",uri:i,edits:[],done:!1}):u.response.updateContent({kind:"textEdit",uri:i,edits:[],done:!1});for await(let g of e){if(t.isCancellationRequested){u.response.cancel();break}g.every(bin)?u.response.updateContent({kind:"notebookEdit",uri:i,edits:g,done:!1}):u.response.updateContent({kind:"textEdit",uri:g[0],edits:g[1],done:!1})}r?u.response.updateContent({kind:"notebookEdit",uri:i,edits:[],done:!0}):u.response.updateContent({kind:"textEdit",uri:i,edits:[],done:!0}),t.isCancellationRequested||u.response.complete();let p=ke(g=>{let f=l.editingSession?.readEntry(i,g);if(!f)return!1;let v=f.state.read(g);return v===1||v===2}),h=Wf(p,Boolean);return await Va(h,t),c.dispose(),!0}function bin(a){return!(A.isUri(a)||Array.isArray(a))}var Kot=class a extends K{static{this.ID="notebook.action.indentUsingTabs"}constructor(){super({id:a.ID,title:d(12532,null),precondition:void 0})}run(i,...e){dLi(i,!1,!1)}},Got=class a extends K{static{this.ID="notebook.action.indentUsingSpaces"}constructor(){super({id:a.ID,title:d(12531,null),precondition:void 0})}run(i,...e){dLi(i,!0,!1)}},qot=class a extends K{static{this.ID="notebook.action.changeTabDisplaySize"}constructor(){super({id:a.ID,title:d(12527,null),precondition:void 0})}run(i,...e){dLi(i,!0,!0)}},$ot=class a extends K{static{this.ID="notebook.action.convertIndentationToSpaces"}constructor(){super({id:a.ID,title:d(12529,null),precondition:void 0})}run(i,...e){Kbo(i,!0)}},jot=class a extends K{static{this.ID="notebook.action.convertIndentationToTabs"}constructor(){super({id:a.ID,title:d(12530,null),precondition:void 0})}run(i,...e){Kbo(i,!1)}};function dLi(a,i,e){let t=a.get(ee),o=a.get(B),n=a.get(Gc),r=a.get(Ue),s=t.activeEditorPane?.input;if(!S6e(s)||!n.retrieveExistingWidgetFromURI(s.resource)?.value)return;let u=[1,2,3,4,5,6,7,8].map(g=>({id:g.toString(),label:g.toString()})),p=o.getValue(yt.cellEditorOptionsCustomizations),h=p["editor.insertSpaces"];delete p["editor.indentSize"],delete p["editor.tabSize"],delete p["editor.insertSpaces"],setTimeout(()=>{r.pick(u,{placeHolder:d(12533,null)}).then(g=>{if(g){let f=parseInt(g.label,10);e?o.updateValue(yt.cellEditorOptionsCustomizations,{...p,"editor.tabSize":f,"editor.indentSize":f,"editor.insertSpaces":h}):o.updateValue(yt.cellEditorOptionsCustomizations,{...p,"editor.tabSize":f,"editor.indentSize":f,"editor.insertSpaces":i})}})},50)}function Kbo(a,i){let e=a.get(ee),t=a.get(B),o=a.get(se),n=a.get(Bt),r=a.get(Gc),s=a.get(La),l=e.activeEditorPane?.input;if(!S6e(l))return;let u=r.retrieveExistingWidgetFromURI(l.resource)?.value?.textModel;if(!u)return;let p=new N;try{Promise.all(u.cells.map(async h=>{let g=await n.createModelReference(h.uri);p.add(g);let f=g.object.textEditorModel,v=h.textModel?.getOptions();if(!v)return;let b=Sin(f,v.tabSize,i);s.apply(b,{label:d(12528,null),code:"undoredo.convertIndentation"})})).then(()=>{let h=t.getValue(yt.cellEditorOptionsCustomizations),g=h["editor.indentSize"],f=h["editor.tabSize"];delete h["editor.indentSize"],delete h["editor.tabSize"],delete h["editor.insertSpaces"],t.updateValue(yt.cellEditorOptionsCustomizations,{...h,"editor.tabSize":f,"editor.indentSize":g,"editor.insertSpaces":i}),p.dispose()})}catch{o.error("Failed to convert indentation to spaces for notebook cells.")}}function Sin(a,i,e){if(a.getLineCount()===1&&a.getLineMaxColumn(1)===1)return[];let t="";for(let r=0;r<i;r++)t+=" ";let o=new RegExp(t,"gi"),n=[];for(let r=1,s=a.getLineCount();r<=s;r++){let l=a.getLineFirstNonWhitespaceColumn(r);if(l===0&&(l=a.getLineMaxColumn(r)),l===1)continue;let c=new z(r,1,r,l),u=a.getValueInRange(c),p=e?u.replace(/\t/ig,t):u.replace(o,"	");n.push(new nl(a.uri,{range:c,text:p}))}return n}W(Got);W(Kot);W(qot);W($ot);W(jot);var Nie=_;function Oie(a){let i=Nie(".");return i.classList.add("debug-view-content","file-icon-themable-tree"),a.appendChild(i),i}var Gbo=(a,i)=>{let e=a.name.length,t=a.name.length+2,o=[],n=[];for(let r of i)r.start<e&&o.push({start:r.start,end:Math.min(r.end,e)}),r.end>t&&n.push({start:Math.max(r.start-t,0),end:r.end-t});return{name:o,value:n}},DKt={getKeyboardNavigationLabel(a){let i=a.getSession()?.rememberedCapabilities?.supportsANSIStyling;return`${a.name}: ${i?zS(a.value):a.value}`}},HG=class{constructor(i,e){this.debugService=i;this.debugVisualizer=e}async getChildren(i){let e=this.debugService.getViewModel(),t=await this.doGetChildren(i);return Promise.all(t.map(async o=>{let n=e.getVisualizedExpression(o);if(typeof n=="string"){let r=await this.debugVisualizer.getVisualizedNodeFor(n,o);if(r)return e.setVisualizedExpression(o,r),r}else if(n)return n;return o}))}};HG=I([m(0,Ni),m(1,hJ)],HG);var iU=class{constructor(i,e,t){this.debugService=i;this.contextViewService=e;this.hoverService=t}renderTemplate(i){let e=new N,t=M(i,Nie(".expression")),o=M(t,Nie("span.name")),n=M(t,Nie("span.lazy-button"));n.classList.add(...q.asClassNameArray(R.eye)),e.add(this.hoverService.setupManagedHover(Ri("mouse"),n,d(9216,null)));let r=M(t,Nie("span.type")),s=M(t,Nie("span.value")),l=e.add(new Ya(o)),c=M(t,Nie(".inputBoxContainer")),u;this.renderActionBar&&(M(t,Nie(".span.actionbar-spacer")),u=e.add(new Zi(t)));let p={expression:t,name:o,type:r,value:s,label:l,inputBoxContainer:c,actionBar:u,elementDisposable:new N,templateDisposable:e,lazyButton:n,currentElement:void 0};return e.add(j(n,re.CLICK,()=>{p.currentElement&&this.debugService.getViewModel().evaluateLazyExpression(p.currentElement)})),p}renderExpressionElement(i,e,t){t.currentElement=i,this.renderExpression(e.element,t,xa(e.filterData)),t.actionBar&&this.renderActionBar(t.actionBar,i,t);let o=this.debugService.getViewModel().getSelectedExpression();if(i===o?.expression||i instanceof $l&&i.errorMessage){let n=this.getInputBoxOptions(i,!!o?.settingWatch);n&&t.elementDisposable.add(this.renderInputBox(t.name,t.value,t.inputBoxContainer,n))}}renderInputBox(i,e,t,o){i.style.display="none",e.style.display="none",t.style.display="initial",Rt(t);let n=new Vc(t,this.contextViewService,{...o,inputBoxStyles:Cl});n.value=o.initialValue,n.focus(),n.select();let r=$c((l,c)=>{i.style.display="",e.style.display="",t.style.display="none";let u=n.value;Be(s),c&&(this.debugService.getViewModel().setSelectedExpression(void 0,!1),o.onFinish(u,l))}),s=[n,Jo(n.inputElement,re.KEY_DOWN,l=>{let c=l.equals(9),u=l.equals(3);(c||u)&&(l.preventDefault(),l.stopPropagation(),r(u,!0))}),j(n.inputElement,re.BLUR,()=>{r(!0,!0)}),j(n.inputElement,re.CLICK,l=>{l.preventDefault(),l.stopPropagation()})];return Z(()=>{r(!1,!1)})}disposeElement(i,e,t){t.elementDisposable.clear()}disposeTemplate(i){i.elementDisposable.dispose(),i.templateDisposable.dispose()}};iU=I([m(0,Ni),m(1,Wn),m(2,nt)],iU);var Iin=0,Qot=()=>`topReplElement:${Iin++}`,eC=class{constructor(i,e,t,o,n,r){this.session=i;this.id=e;this.value=t;this.severity=o;this.sourceData=n;this.expression=r;this._count=1;this._onDidChangeCount=new E}toString(i=!1){let e=this.value;for(let o=1;o<this.count;o++)e+=(e.endsWith(`
`)?"":`
`)+this.value;let t=this.sourceData&&i?` ${this.sourceData.source.name}`:"";return e+t}getId(){return this.id}getChildren(){return this.expression?.getChildren()||Promise.resolve([])}set count(i){this._count=i,this._onDidChangeCount.fire()}get count(){return this._count}get onDidChangeCount(){return this._onDidChangeCount.event}get hasChildren(){return!!this.expression?.hasChildren}},Pge=class{constructor(i,e,t,o){this.session=i;this.expression=e;this.severity=t;this.sourceData=o;this.id=xt();this.hasChildren=e.hasChildren}getSession(){return this.session}getChildren(){return this.expression.getChildren()}toString(){return this.expression.toString()}getId(){return this.id}},LKt=class a{constructor(i,e,t,o,n){this.id=i;this.name=e;this.valueObj=t;this.sourceData=o;this.annotation=n}static{this.MAX_CHILDREN=1e3}getId(){return this.id}getSession(){}get value(){return this.valueObj===null?"null":Array.isArray(this.valueObj)?`Array[${this.valueObj.length}]`:xi(this.valueObj)?"Object":Fe(this.valueObj)?`"${this.valueObj}"`:String(this.valueObj)||""}get hasChildren(){return Array.isArray(this.valueObj)&&this.valueObj.length>0||xi(this.valueObj)&&Object.getOwnPropertyNames(this.valueObj).length>0}evaluateLazy(){throw new Error("Method not implemented.")}getChildren(){let i=[];return Array.isArray(this.valueObj)?i=this.valueObj.slice(0,a.MAX_CHILDREN).map((e,t)=>new a(`${this.id}:${t}`,String(t),e)):xi(this.valueObj)&&(i=Object.getOwnPropertyNames(this.valueObj).slice(0,a.MAX_CHILDREN).map((e,t)=>new a(`${this.id}:${t}`,e,this.valueObj[e]))),Promise.resolve(i)}toString(){return`${this.name}
${this.value}`}},Fie=class{constructor(i){this.value=i;this.id=xt()}toString(){return this.value}getId(){return this.id}},mN=class extends lA{constructor(e){super(void 0,void 0,0,xt());this.originalExpression=e;this._available=!0}get available(){return this._available}async evaluateExpression(e,t,o,n){let r=await super.evaluateExpression(e,t,o,n);return this._available=r,r}toString(){return`${this.value}`}},UG=class a{constructor(i,e,t,o){this.session=i;this.name=e;this.autoExpand=t;this.sourceData=o;this.children=[];this.ended=!1;this.id=`replGroup:${a.COUNTER++}`}static{this.COUNTER=0}get hasChildren(){return!0}getId(){return this.id}toString(i=!1){let e=i&&this.sourceData?` ${this.sourceData.source.name}`:"";return this.name+e}addChild(i){let e=this.children.length?this.children[this.children.length-1]:void 0;e instanceof a&&!e.hasEnded?e.addChild(i):this.children.push(i)}getChildren(){return this.children}end(){let i=this.children.length?this.children[this.children.length-1]:void 0;i instanceof a&&!i.hasEnded?i.end():this.ended=!0}get hasEnded(){return this.ended}};function Mge(a,i){return!a&&!i?!0:a&&i?a.column===i.column&&a.lineNumber===i.lineNumber&&a.source.uri.toString()===i.source.uri.toString():!1}var RKt=class a{constructor(i){this.configurationService=i;this.replElements=[];this._onDidChangeElements=new E;this.onDidChangeElements=this._onDidChangeElements.event}getReplElements(){return this.replElements}async addReplExpression(i,e,t){this.addReplElement(new Fie(t));let o=new mN(t);await o.evaluateExpression(t,i,e,"repl"),this.addReplElement(o)}appendToRepl(i,{output:e,expression:t,sev:o,source:n}){let r="\x1B[2J",s=e.lastIndexOf(r);if(s!==-1&&(this.removeReplExpressions(),this.appendToRepl(i,{output:d(9977,null),sev:bt.Ignore}),e=e.substring(s+r.length)),t){this.addReplElement(e?new eC(i,Qot(),e,o,n,t):new Pge(i,t,o,n));return}this.appendOutputToRepl(i,e,o,n)}appendOutputToRepl(i,e,t,o){let n=this.configurationService.getValue("debug"),r=this.replElements.length?this.replElements[this.replElements.length-1]:void 0;if(r instanceof eC&&r.severity===t&&Mge(r.sourceData,o)&&!r.value.endsWith(`
`)&&!r.value.endsWith(`\r
`)&&r.count===1){let s=r.value+e;this.replElements[this.replElements.length-1]=new eC(i,Qot(),s,t,o),this._onDidChangeElements.fire(void 0),n.console.collapseIdenticalLines&&s.endsWith(`
`)&&this.tryCollapseCompleteLine(t,o),n.console.collapseIdenticalLines&&s.includes(`
`)&&this.splitIntoLines(s).length>1&&this.applyLineLevelCollapsing(i,t,o);return}if(n.console.collapseIdenticalLines&&e.includes(`
`))this.processMultiLineOutput(i,e,t,o);else{if(r instanceof eC&&r.severity===t&&Mge(r.sourceData,o)&&r.value===e&&n.console.collapseIdenticalLines){r.count++;return}let s=new eC(i,Qot(),e,t,o);this.addReplElement(s)}}tryCollapseCompleteLine(i,e){if(this.replElements.length<2)return;let t=this.replElements[this.replElements.length-1],o=this.replElements[this.replElements.length-2];t instanceof eC&&o instanceof eC&&t.severity===i&&o.severity===i&&Mge(t.sourceData,e)&&Mge(o.sourceData,e)&&t.value===o.value&&t.count===1&&t.value.endsWith(`
`)&&(o.count+=t.count,this.replElements.pop(),this._onDidChangeElements.fire(void 0))}processMultiLineOutput(i,e,t,o){let n=this.splitIntoLines(e);for(let r of n){if(r.length===0)continue;let s=this.replElements.length?this.replElements[this.replElements.length-1]:void 0;if(s instanceof eC&&s.severity===t&&Mge(s.sourceData,o)&&s.value===r)s.count++;else{let l=new eC(i,Qot(),r,t,o);this.addReplElement(l)}}}splitIntoLines(i){let e=[],t=0;for(;t<i.length;){let o=i.indexOf(`
`,t);if(o===-1){e.push(i.substring(t));break}e.push(i.substring(t,o+1)),t=o+1}return e}applyLineLevelCollapsing(i,e,t){let o=this.replElements[this.replElements.length-1];if(!(o instanceof eC)||o.severity!==e||!Mge(o.sourceData,t))return;let n=this.splitIntoLines(o.value);if(!(n.length<=1)){this.replElements.pop();for(let r of n){if(r.length===0)continue;let s=this.replElements.length?this.replElements[this.replElements.length-1]:void 0;if(s instanceof eC&&s.severity===e&&Mge(s.sourceData,t)&&s.value===r)s.count++;else{let l=new eC(i,Qot(),r,e,t);this.addReplElement(l)}}this._onDidChangeElements.fire(void 0)}}startGroup(i,e,t,o){let n=new UG(i,e,t,o);this.addReplElement(n)}endGroup(){let i=this.replElements[this.replElements.length-1];i instanceof UG&&i.end()}addReplElement(i){let e=this.replElements.length?this.replElements[this.replElements.length-1]:void 0;if(e instanceof UG&&!e.hasEnded)e.addChild(i);else{this.replElements.push(i);let t=this.configurationService.getValue("debug");this.replElements.length>t.console.maximumLines&&this.replElements.splice(0,this.replElements.length-t.console.maximumLines)}this._onDidChangeElements.fire(i)}removeReplExpressions(){this.replElements.length>0&&(this.replElements=[],this._onDidChangeElements.fire(void 0))}clone(){let i=new a(this.configurationService);return i.replElements=this.replElements.slice(),i}};function uLi(a,i,e,t,o){let n=document.createElement("span"),r=a.length,s=[],l,c,u,p=!1,h=0,g=0,f="";for(;h<r;){let T=!1;if(a.charCodeAt(h)===27&&a.charAt(h+1)==="["){let P=h;h+=2;let O="";for(;h<r;){let V=a.charAt(h);if(O+=V,h++,V.match(/^[ABCDHIJKfhmpsu]$/)){T=!0;break}}if(T){if(g+=2+O.length,qbo(n,f,s,i,e,l,c,u,t,h-f.length-g,o),f="",O.match(/^(?:[34][0-8]|9[0-7]|10[0-7]|[0-9]|2[1-5,7-9]|[34]9|5[8,9]|1[0-9])(?:;[349][0-7]|10[0-7]|[013]|[245]|[34]9)?(?:;[012]?[0-9]?[0-9])*;?m$/)){let V=O.slice(0,-1).split(";").filter(H=>H!=="").map(H=>parseInt(H,10));if(V[0]===38||V[0]===48||V[0]===58){let H=V[0]===38?"foreground":V[0]===48?"background":"underline";V[1]===5?w(V,H):V[1]===2&&y(V,H)}else S(V)}}else h=P}T===!1&&(f+=a.charAt(h),h++)}return f&&qbo(n,f,s,i,e,l,c,u,t,h-f.length,o),n;function v(T,P){T==="foreground"?l=P:T==="background"?c=P:T==="underline"&&(u=P),s=s.filter(O=>O!==`code-${T}-colored`),P!==void 0&&s.push(`code-${T}-colored`)}function b(){let T=l;v("foreground",c),v("background",T)}function S(T){for(let P of T)switch(P){case 0:{s=[],l=void 0,c=void 0;break}case 1:{s=s.filter(O=>O!=="code-bold"),s.push("code-bold");break}case 2:{s=s.filter(O=>O!=="code-dim"),s.push("code-dim");break}case 3:{s=s.filter(O=>O!=="code-italic"),s.push("code-italic");break}case 4:{s=s.filter(O=>O!=="code-underline"&&O!=="code-double-underline"),s.push("code-underline");break}case 5:{s=s.filter(O=>O!=="code-blink"),s.push("code-blink");break}case 6:{s=s.filter(O=>O!=="code-rapid-blink"),s.push("code-rapid-blink");break}case 7:{p||(p=!0,b());break}case 8:{s=s.filter(O=>O!=="code-hidden"),s.push("code-hidden");break}case 9:{s=s.filter(O=>O!=="code-strike-through"),s.push("code-strike-through");break}case 10:{s=s.filter(O=>!O.startsWith("code-font"));break}case 11:case 12:case 13:case 14:case 15:case 16:case 17:case 18:case 19:case 20:{s=s.filter(O=>!O.startsWith("code-font")),s.push(`code-font-${P-10}`);break}case 21:{s=s.filter(O=>O!=="code-underline"&&O!=="code-double-underline"),s.push("code-double-underline");break}case 22:{s=s.filter(O=>O!=="code-bold"&&O!=="code-dim");break}case 23:{s=s.filter(O=>O!=="code-italic"&&O!=="code-font-10");break}case 24:{s=s.filter(O=>O!=="code-underline"&&O!=="code-double-underline");break}case 25:{s=s.filter(O=>O!=="code-blink"&&O!=="code-rapid-blink");break}case 27:{p&&(p=!1,b());break}case 28:{s=s.filter(O=>O!=="code-hidden");break}case 29:{s=s.filter(O=>O!=="code-strike-through");break}case 53:{s=s.filter(O=>O!=="code-overline"),s.push("code-overline");break}case 55:{s=s.filter(O=>O!=="code-overline");break}case 39:{v("foreground",void 0);break}case 49:{v("background",void 0);break}case 59:{v("underline",void 0);break}case 73:{s=s.filter(O=>O!=="code-superscript"&&O!=="code-subscript"),s.push("code-superscript");break}case 74:{s=s.filter(O=>O!=="code-superscript"&&O!=="code-subscript"),s.push("code-subscript");break}case 75:{s=s.filter(O=>O!=="code-superscript"&&O!=="code-subscript");break}default:{k(P);break}}}function y(T,P){if(T.length>=5&&T[2]>=0&&T[2]<=255&&T[3]>=0&&T[3]<=255&&T[4]>=0&&T[4]<=255){let O=new zt(T[2],T[3],T[4]);v(P,O)}}function w(T,P){let O=T[2],V=yin(O);if(V)v(P,V);else if(O>=0&&O<=15){if(P==="underline"){let H=CS[O];v(P,`--vscode-debug-ansi-${H}`);return}O+=30,O>=38&&(O+=52),P==="background"&&(O+=10),k(O)}}function k(T){let P,O;if(T>=30&&T<=37?(O=T-30,P="foreground"):T>=90&&T<=97?(O=T-90+8,P="foreground"):T>=40&&T<=47?(O=T-40,P="background"):T>=100&&T<=107&&(O=T-100+8,P="background"),O!==void 0&&P){let V=CS[O];v(P,`--vscode-debug-ansi-${V.replaceAll(".","-")}`)}}}function qbo(a,i,e,t,o,n,r,s,l,c,u){if(!a||!i)return;let p=t.linkify(i,u,!0,o,void 0,l?.map(h=>({start:h.start-c,end:h.end-c,extraClasses:h.extraClasses})));p.className=e.join(" "),n&&(p.style.color=typeof n=="string"?`var(${n})`:We.Format.CSS.formatRGB(new We(n))),r&&(p.style.backgroundColor=typeof r=="string"?`var(${r})`:We.Format.CSS.formatRGB(new We(r))),s&&(p.style.textDecorationColor=typeof s=="string"?`var(${s})`:We.Format.CSS.formatRGB(new We(s))),a.appendChild(p)}function yin(a){if(a%1===0)if(a>=16&&a<=231){a-=16;let i=a%6;a=(a-i)/6;let e=a%6;a=(a-e)/6;let t=a,o=255/5;return i=Math.round(i*o),e=Math.round(e*o),t=Math.round(t*o),new zt(t,e,i)}else if(a>=232&&a<=255){a-=232;let i=Math.round(a/23*255);return new zt(i,i,i)}else return}is((a,i)=>{let e=[{selector:".monaco-workbench .sidebar, .monaco-workbench .auxiliarybar",bg:a.getColor(bf)},{selector:".monaco-workbench .panel",bg:a.getColor(lI)},{selector:".monaco-workbench .monaco-list-row.selected",bg:a.getColor(Kf)},{selector:".monaco-workbench .monaco-list-row.focused",bg:a.getColor(Uvt)},{selector:".monaco-workbench .monaco-list:focus .monaco-list-row.focused",bg:a.getColor(R7)},{selector:".monaco-workbench .monaco-list:focus .monaco-list-row.selected",bg:a.getColor(ow)},{selector:".debug-hover-widget",bg:a.getColor(wO)}];for(let{selector:t,bg:o}of e){let n=CS.map(r=>{let s=a.getColor(r);if(s)return`--vscode-debug-ansi-${r.replaceAll(".","-")}:${o?o.ensureConstrast(s,4):s}`}).filter(lo);i.addRule(`${t} { ${n.join(";")} }`)}});var ZD=le("extensionHostDebugService");async function jbo(a){let i=a.get(Ue),e=a.get(Ni),t=a.get(ee),o=e.getModel().getSessions(!1),n=a.get(Tt),r=a.get(_t),s=a.get(rt),l=new N,c=i.createQuickPick({useSeparators:!0});l.add(c),c.matchOnLabel=c.matchOnDescription=c.matchOnDetail=c.sortByLabel=!1,c.placeholder=d(9976,null),c.items=await $bo(c.value,o,t,n,r,s),l.add(c.onDidChangeValue(async()=>{c.items=await $bo(c.value,o,t,n,r,s)})),l.add(c.onDidAccept(()=>{c.selectedItems[0].accept(),c.hide()})),l.add(c.onDidHide(()=>l.dispose())),c.show()}async function win(a,i,e,t,o,n){let r=[];return r.push({type:"separator",label:a.name}),(await a.getLoadedSources()).forEach(l=>{let c=Cin(l,i,e,t,o,n);c&&r.push(c)}),r}async function $bo(a,i,e,t,o,n){let r=[],s=await Promise.all(i.map(l=>win(l,a,e,t,o,n)));for(let l of s)for(let c of l)r.push(c);return r}function Cin(a,i,e,t,o,n){let r=n.getUriBasenameLabel(a.uri),s=n.getUriLabel(ci(a.uri)),l=lm(i,r,!0),c=lm(i,s,!0);if(l||c)return{label:r,description:s==="."?void 0:s,highlights:{label:l??void 0,description:c??void 0},iconClasses:aa(t,o,a.uri),accept:()=>{a.available&&a.openInEditor(e,{startLineNumber:0,startColumn:0,endLineNumber:0,endColumn:0})}}}var Od=_;function zie(a){let i=new Ev("",!1,qf);return i.domNode.tabIndex=-1,a.add(i),i}var kin=9;var oU=class{constructor(i,e){this.uri=i;this.breakpoints=e}getId(){return this.uri.toString()}get enabled(){return this.breakpoints.every(i=>i.enabled)}get indeterminate(){let i=this.breakpoints.filter(e=>e.enabled).length;return i>0&&i<this.breakpoints.length}};function Qbo(a){return a instanceof Nv?"source":a instanceof hI?"instruction":"exception"}var tFe=class extends Gs{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super(e,n,t,u,h,p,r,g,s,b);this.debugService=o;this.editorService=l;this.contextViewService=c;this.labelService=f;this.languageService=S;this.needsRefresh=!1;this.needsStateChange=!1;this.ignoreLayout=!1;this.collapsedState=new Set;this.menu=v.createMenu(D.DebugBreakpointsContext,h),this._register(this.menu),this.breakpointItemType=uD.bindTo(h),this.breakpointIsDataBytes=zhi.bindTo(h),this.breakpointHasMultipleModes=Khi.bindTo(h),this.breakpointSupportsCondition=eRt.bindTo(h),this.breakpointInputFocused=JLt.bindTo(h),this._register(this.debugService.getModel().onDidChangeBreakpoints(()=>this.onBreakpointsChange())),this._register(this.debugService.getViewModel().onDidFocusSession(()=>this.onBreakpointsChange())),this._register(this.debugService.onDidChangeState(()=>this.onStateChange())),this.hintDelayer=this._register(new Dt(()=>this.updateBreakpointsHint(!0),4e3))}getPresentation(){return this.configurationService.getValue("debug.breakpointsView.presentation")}renderBody(e){super.renderBody(e),this.element.classList.add("debug-pane"),e.classList.add("debug-breakpoints"),this.tree=this.instantiationService.createInstance(nF,"BreakpointsView",e,new pLi(this),[this.instantiationService.createInstance(Wie),this.instantiationService.createInstance(Vie,this.menu,this.breakpointHasMultipleModes,this.breakpointSupportsCondition,this.breakpointItemType),new MKt(this.menu,this.breakpointHasMultipleModes,this.breakpointSupportsCondition,this.breakpointItemType,this.debugService,this.hoverService),new NKt(this,this.debugService,this.contextViewService),this.instantiationService.createInstance(Bie,this.menu,this.breakpointSupportsCondition,this.breakpointItemType),new PKt(this,this.debugService,this.contextViewService,this.hoverService,this.labelService),this.instantiationService.createInstance(Hie,this.menu,this.breakpointHasMultipleModes,this.breakpointSupportsCondition,this.breakpointItemType,this.breakpointIsDataBytes),new AKt(this,this.debugService,this.contextViewService,this.hoverService,this.labelService),this.instantiationService.createInstance(Uie)],{compressionEnabled:this.getPresentation()==="tree",hideTwistiesOfChildlessElements:!0,identityProvider:{getId:o=>o.getId()},keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:o=>o instanceof oU?Ga(o.uri):o instanceof Nv?`${Ga(o.uri)}:${o.lineNumber}`:o instanceof mI?o.name:o instanceof hy?o.description:o instanceof dA?o.label||o.filter:o instanceof hI?`0x${o.address.toString(16)}`:"",getCompressedNodeKeyboardNavigationLabel:o=>o.map(n=>n instanceof oU?Ga(n.uri):"").join("/")},accessibilityProvider:new mLi(this.debugService,this.labelService),multipleSelectionSupport:!1,overrideStyles:this.getLocationBasedColors().listOverrideStyles}),this._register(this.tree),fTe.bindTo(this.tree.contextKeyService),this._register(this.tree.onContextMenu(this.onTreeContextMenu,this)),this._register(this.tree.onMouseMiddleClick(async({element:o})=>{o instanceof Nv?await this.debugService.removeBreakpoints(o.getId()):o instanceof mI?await this.debugService.removeFunctionBreakpoints(o.getId()):o instanceof hy?await this.debugService.removeDataBreakpoints(o.getId()):o instanceof hI?await this.debugService.removeInstructionBreakpoints(o.instructionReference,o.offset):o instanceof oU&&await this.debugService.removeBreakpoints(o.breakpoints.map(n=>n.getId()))})),this._register(this.tree.onDidOpen(async o=>{let n=o.element;n&&(Ru(o.browserEvent)&&o.browserEvent.button===1||(n instanceof Nv&&iFe(n,o.sideBySide,o.editorOptions.preserveFocus||!1,o.editorOptions.pinned||!o.editorOptions.preserveFocus,this.debugService,this.editorService),n instanceof hI&&(await this.editorService.openEditor(GR.instance)).goToInstructionAndOffset(n.instructionReference,n.offset,Ru(o.browserEvent)&&o.browserEvent.detail===2),Ru(o.browserEvent)&&o.browserEvent.detail===2&&n instanceof mI&&n!==this.inputBoxData?.breakpoint&&this.renderInputBox({breakpoint:n,type:"name"})))})),this._register(this.tree.onDidChangeCollapseState(o=>{let n=o.node.element;n instanceof oU&&(o.node.collapsed?this.collapsedState.add(n.getId()):this.collapsedState.delete(n.getId()),this.updateSize())})),this._register(this.configurationService.onDidChangeConfiguration(o=>{if(o.affectsConfiguration("debug.breakpointsView.presentation")){let n=this.getPresentation();this.tree.updateOptions({compressionEnabled:n==="tree"}),this.onBreakpointsChange()}})),this.setTreeInput(),this._register(this.onDidChangeBodyVisibility(o=>{o&&(this.needsRefresh&&this.onBreakpointsChange(),this.needsStateChange&&this.onStateChange())}));let t=this.viewDescriptorService.getViewContainerModel(this.viewDescriptorService.getViewContainerByViewId(this.id));this._register(t.onDidChangeAllViewDescriptors(()=>{this.updateSize()}))}renderHeaderTitle(e,t){super.renderHeaderTitle(e,t);let o=M(e,Od("span.breakpoint-warning"));this.hintContainer=this._register(new Bc(o,{supportIcons:!0,hoverDelegate:{showHover:(n,r)=>this.hoverService.showInstantHover({content:n.content,target:this.hintContainer.element},r),delay:this.configurationService.getValue("workbench.hover.delay")}})),vo(this.hintContainer.element)}focus(){super.focus(),this.tree?.domFocus()}renderInputBox(e){this._inputBoxData=e,this.onBreakpointsChange(),this._inputBoxData=void 0}get inputBoxData(){return this._inputBoxData}layoutBody(e,t){if(!this.ignoreLayout){super.layoutBody(e,t),this.tree?.layout(e,t);try{this.ignoreLayout=!0,this.updateSize()}finally{this.ignoreLayout=!1}}}onTreeContextMenu(e){let t=e.element;if(t instanceof oU){this.breakpointItemType.set("breakpointFolder");let{secondary:l}=zp(this.menu.getActions({arg:t,shouldForwardArgs:!1}),"inline");this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>l,getActionsContext:()=>t});return}let o=t instanceof Nv?"breakpoint":t instanceof dA?"exceptionBreakpoint":t instanceof mI?"functionBreakpoint":t instanceof hy?"dataBreakpoint":t instanceof hI?"instructionBreakpoint":void 0;this.breakpointItemType.set(o);let n=this.debugService.getViewModel().focusedSession,r=t instanceof dA?t.supportsCondition:!n||!!n.capabilities.supportsConditionalBreakpoints;this.breakpointSupportsCondition.set(r),this.breakpointIsDataBytes.set(t instanceof hy&&t.src.type===1),this.breakpointHasMultipleModes.set(this.debugService.getModel().getBreakpointModes(Qbo(t)).length>1);let{secondary:s}=zp(this.menu.getActions({arg:e.element,shouldForwardArgs:!1}),"inline");this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>s,getActionsContext:()=>t})}updateSize(){let e=this.viewDescriptorService.getViewContainerModel(this.viewDescriptorService.getViewContainerByViewId(this.id)),t=22;this.minimumBodySize=this.orientation===0?Math.min(kin*t,this.tree.contentHeight):170,this.maximumBodySize=this.orientation===0&&e.visibleViewDescriptors.length>1?this.tree.contentHeight:Number.POSITIVE_INFINITY}updateBreakpointsHint(e=!1){if(!this.hintContainer)return;let t=this.debugService.getViewModel().focusedSession?.configuration.type,o=t?this.debugService.getAdapterManager().getDebugger(t):void 0,n=o?.strings?.unverifiedBreakpoints,r=n&&this.debugService.getModel().getBreakpoints().filter(s=>{if(s.verified||!s.enabled)return!1;let l=this.languageService.guessLanguageIdByFilepathOrFirstLine(s.uri);return l&&o.interestedInLanguage(l)});if(n&&r?.length&&this.debugService.getModel().areBreakpointsActivated())if(e){let s=new Ie(void 0,{isTrusted:!0}).appendMarkdown(n);this.hintContainer.setLabel("$(warning)",void 0,{title:{markdown:s,markdownNotSupportedFallback:n}}),un(this.hintContainer.element)}else this.hintDelayer.schedule();else vo(this.hintContainer.element)}onBreakpointsChange(){this.isBodyVisible()?(this.tree&&(this.setTreeInput(),this.needsRefresh=!1),this.updateBreakpointsHint(),this.updateSize()):this.needsRefresh=!0}onStateChange(){if(this.isBodyVisible()){this.needsStateChange=!1;let e=this.debugService.getViewModel().focusedThread,t=!1;if(e&&e.stoppedDetails&&e.stoppedDetails.hitBreakpointIds&&e.stoppedDetails.hitBreakpointIds.length>0){let o=e.stoppedDetails.hitBreakpointIds,r=this.flatElements.find(s=>{let l=s.getIdFromAdapter(e.session.getId());return typeof l=="number"&&o.indexOf(l)!==-1});r&&(this.tree.setFocus([r]),this.tree.setSelection([r]),t=!0,this.autoFocusedElement=r)}if(!t){let o=this.tree.getFocus(),n=this.tree.getSelection();this.autoFocusedElement&&$i(o,n)&&n.includes(this.autoFocusedElement)&&(this.tree.setFocus([]),this.tree.setSelection([])),this.autoFocusedElement=void 0}this.updateBreakpointsHint()}else this.needsStateChange=!0}setTreeInput(){let e=this.getTreeElements();this.tree.setChildren(null,e)}getTreeElements(){let e=this.debugService.getModel(),t=this.debugService.getViewModel().focusedSession?.getId(),o=this.getPresentation()==="tree",n=[];for(let s of e.getExceptionBreakpointsForSession(t))n.push({element:s,incompressible:!0});for(let s of e.getFunctionBreakpoints())n.push({element:s,incompressible:!0});for(let s of e.getDataBreakpoints())n.push({element:s,incompressible:!0});let r=e.getBreakpoints();if(o&&r.length>0){let s=new Map;for(let l of r){let c=l.uri.toString();s.has(c)||s.set(c,[]),s.get(c).push(l)}for(let[l,c]of s){let u=A.parse(l),p=new oU(u,c);c.sort((g,f)=>g.lineNumber-f.lineNumber);let h=c.map(g=>({element:g,incompressible:!1}));n.push({element:p,incompressible:!1,collapsed:this.collapsedState.has(p.getId()),children:h})}}else for(let s of r)n.push({element:s,incompressible:!0});for(let s of e.getInstructionBreakpoints())n.push({element:s,incompressible:!0});return n}get flatElements(){let e=this.debugService.getModel(),t=this.debugService.getViewModel().focusedSession?.getId();return e.getExceptionBreakpointsForSession(t).concat(e.getFunctionBreakpoints()).concat(e.getDataBreakpoints()).concat(e.getBreakpoints()).concat(e.getInstructionBreakpoints())}};tFe=I([m(1,Xe),m(2,Ni),m(3,_e),m(4,F),m(5,Le),m(6,ee),m(7,Wn),m(8,B),m(9,Bi),m(10,X),m(11,Je),m(12,rt),m(13,Kt),m(14,nt),m(15,_t)],tFe);var pLi=class{constructor(i){this.view=i}getHeight(i){return 22}getTemplateId(i){if(i instanceof oU)return Wie.ID;if(i instanceof Nv)return Vie.ID;if(i instanceof mI){let e=this.view.inputBoxData?.breakpoint;return!i.name||e&&e.getId()===i.getId()?PKt.ID:Bie.ID}if(i instanceof dA){let e=this.view.inputBoxData?.breakpoint;return e&&e.getId()===i.getId()?NKt.ID:MKt.ID}if(i instanceof hy){let e=this.view.inputBoxData?.breakpoint;return e&&e.getId()===i.getId()?AKt.ID:Hie.ID}return i instanceof hI?Uie.ID:""}},Yot=new Map,Wie=class{constructor(i,e,t){this.debugService=i;this.labelService=e;this.hoverService=t}static{this.ID="breakpointFolder"}get templateId(){return Wie.ID}renderTemplate(i){let e=Object.create(null);return e.elementDisposables=new N,e.templateDisposables=new N,e.templateDisposables.add(e.elementDisposables),e.container=i,i.classList.add("breakpoint","breakpoint-folder"),e.templateDisposables.add(Z(()=>{i.classList.remove("breakpoint","breakpoint-folder")})),e.checkbox=new FY("",!1,qf),e.checkbox.domNode.tabIndex=-1,e.templateDisposables.add(e.checkbox),e.templateDisposables.add(e.checkbox.onChange(()=>{let t=e.checkbox.checked,o=t==="mixed"?!0:t;for(let n of e.context.breakpoints)this.debugService.enableOrDisableBreakpoints(o,n)})),M(e.container,e.checkbox.domNode),e.name=M(e.container,Od("span.name")),M(e.container,Od("span.file-path")),e.actionBar=new Zi(e.container),e.templateDisposables.add(e.actionBar),e}renderElement(i,e,t){let o=i.element;t.context=o,t.name.textContent=this.labelService.getUriBasenameLabel(o.uri),t.container.classList.toggle("disabled",!this.debugService.getModel().areBreakpointsActivated());let n=this.labelService.getUriLabel(o.uri,{relative:!0});t.elementDisposables.add(this.hoverService.setupManagedHover(Ri("mouse"),t.container,n)),o.indeterminate?t.checkbox.checked="mixed":t.checkbox.checked=o.enabled,t.actionBar.clear();let r=t.elementDisposables.add(new it("debug.removeBreakpointsInFile",d(9317,null),q.asClassName(R.close),!0,async()=>{for(let s of o.breakpoints)await this.debugService.removeBreakpoints(s.getId())}));t.actionBar.push(r,{icon:!0,label:!1})}renderCompressedElements(i,e,t){let o=i.element.elements,n=o[o.length-1];t.context=n;let r=o.map(c=>Ga(c.uri));t.name.textContent=r.join("/");let s=this.labelService.getUriLabel(n.uri,{relative:!0});t.elementDisposables.add(this.hoverService.setupManagedHover(Ri("mouse"),t.container,s)),n.indeterminate?t.checkbox.checked="mixed":t.checkbox.checked=n.enabled,t.actionBar.clear();let l=t.elementDisposables.add(new it("debug.removeBreakpointsInFile",d(9317,null),q.asClassName(R.close),!0,async()=>{for(let c of n.breakpoints)await this.debugService.removeBreakpoints(c.getId())}));t.actionBar.push(l,{icon:!0,label:!1})}disposeElement(i,e,t){t.elementDisposables.clear()}disposeCompressedElements(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.templateDisposables.dispose()}};Wie=I([m(0,Ni),m(1,rt),m(2,nt)],Wie);var Vie=class{constructor(i,e,t,o,n,r,s,l){this.menu=i;this.breakpointHasMultipleModes=e;this.breakpointSupportsCondition=t;this.breakpointItemType=o;this.debugService=n;this.hoverService=r;this.labelService=s;this.textModelService=l}static{this.ID="breakpoints"}get templateId(){return Vie.ID}renderTemplate(i){let e=Object.create(null);e.elementDisposables=new N,e.templateDisposables=new N,e.templateDisposables.add(e.elementDisposables),e.breakpoint=i,i.classList.add("breakpoint"),e.templateDisposables.add(Z(()=>{i.classList.remove("breakpoint")})),e.icon=Od(".icon"),e.checkbox=zie(e.templateDisposables),e.templateDisposables.add(e.checkbox.onChange(()=>{this.debugService.enableOrDisableBreakpoints(!e.context.enabled,e.context)})),M(e.breakpoint,e.icon),M(e.breakpoint,e.checkbox.domNode),e.name=M(e.breakpoint,Od("span.name")),e.filePath=M(e.breakpoint,Od("span.file-path")),e.actionBar=new Zi(e.breakpoint),e.templateDisposables.add(e.actionBar);let t=M(e.breakpoint,Od(".badge-container"));return e.badge=M(t,Od("span.line-number.monaco-count-badge")),e}renderElement(i,e,t){let o=i.element;t.context=o,i.depth>1?this.renderBreakpointLineLabel(o,t):this.renderBreakpointFileLabel(o,t),this.renderBreakpointCommon(o,t)}renderCompressedElements(i,e,t){let o=i.element.elements[i.element.elements.length-1];t.context=o,this.renderBreakpointFileLabel(o,t),this.renderBreakpointCommon(o,t)}renderBreakpointCommon(i,e){e.breakpoint.classList.toggle("disabled",!this.debugService.getModel().areBreakpointsActivated());let t=i.lineNumber.toString();i.column&&(t+=`:${i.column}`),i.modeLabel&&(t=`${i.modeLabel}: ${t}`),e.badge.textContent=t,e.checkbox.checked=i.enabled;let{message:o,icon:n}=zG(this.debugService.state,this.debugService.getModel().areBreakpointsActivated(),i,this.labelService,this.debugService.getModel());e.icon.className=q.asClassName(n),e.elementDisposables.add(this.hoverService.setupManagedHover(Ri("mouse"),e.breakpoint,i.message||o||"")),(this.debugService.state===3||this.debugService.state===2)&&!i.verified&&e.breakpoint.classList.add("disabled");let s=this.debugService.getViewModel().focusedSession;this.breakpointSupportsCondition.set(!s||!!s.capabilities.supportsConditionalBreakpoints),this.breakpointItemType.set("breakpoint"),this.breakpointHasMultipleModes.set(this.debugService.getModel().getBreakpointModes("source").length>1);let{primary:l}=ml(this.menu.getActions({arg:i,shouldForwardArgs:!0}),"inline");e.actionBar.clear(),e.actionBar.push(l,{icon:!0,label:!1}),Yot.set(i.getId(),e.actionBar.domNode)}renderBreakpointFileLabel(i,e){e.name.textContent=Ga(i.uri),e.filePath.textContent=this.labelService.getUriLabel(ci(i.uri),{relative:!0})}renderBreakpointLineLabel(i,e){e.name.textContent=d(9306,null),e.filePath.textContent="",this.textModelService.createModelReference(i.uri).then(t=>{if(e.context!==i){t.dispose();return}e.elementDisposables.add(t);let o=t.object.textEditorModel;if(o&&i.lineNumber<=o.getLineCount()){let n=o.getLineContent(i.lineNumber).trim();e.name.textContent=n||d(9285,null)}else e.name.textContent=d(9305,null)}).catch(()=>{e.context===i&&(e.name.textContent=d(9261,null))})}disposeElement(i,e,t){t.elementDisposables.clear()}disposeCompressedElements(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.templateDisposables.dispose()}};Vie=I([m(4,Ni),m(5,nt),m(6,rt),m(7,Bt)],Vie);var MKt=class a{constructor(i,e,t,o,n,r){this.menu=i;this.breakpointHasMultipleModes=e;this.breakpointSupportsCondition=t;this.breakpointItemType=o;this.debugService=n;this.hoverService=r}static{this.ID="exceptionbreakpoints"}get templateId(){return a.ID}renderTemplate(i){let e=Object.create(null);e.elementDisposables=new N,e.templateDisposables=new N,e.templateDisposables.add(e.elementDisposables),e.breakpoint=M(i,Od(".breakpoint")),e.checkbox=zie(e.templateDisposables),e.templateDisposables.add(e.checkbox.onChange(()=>{this.debugService.enableOrDisableBreakpoints(!e.context.enabled,e.context)})),M(e.breakpoint,e.checkbox.domNode),e.name=M(e.breakpoint,Od("span.name")),e.condition=M(e.breakpoint,Od("span.condition")),e.breakpoint.classList.add("exception"),e.actionBar=new Zi(e.breakpoint),e.templateDisposables.add(e.actionBar);let t=M(e.breakpoint,Od(".badge-container"));return e.badge=M(t,Od("span.line-number.monaco-count-badge")),e}renderElement(i,e,t){let o=i.element;this.renderExceptionBreakpoint(o,t)}renderCompressedElements(i,e,t){let o=i.element.elements[i.element.elements.length-1];this.renderExceptionBreakpoint(o,t)}renderExceptionBreakpoint(i,e){e.context=i,e.name.textContent=i.label||`${i.filter} exceptions`;let t=i.verified?i.description||e.name.textContent:i.message||d(9322,null);e.elementDisposables.add(this.hoverService.setupManagedHover(Ri("mouse"),e.breakpoint,t)),e.breakpoint.classList.toggle("disabled",!i.verified),e.checkbox.checked=i.enabled,e.condition.textContent=i.condition||"",e.elementDisposables.add(this.hoverService.setupManagedHover(Ri("mouse"),e.condition,d(9291,null,i.condition))),i.modeLabel?(e.badge.textContent=i.modeLabel,e.badge.style.display="block"):e.badge.style.display="none",this.breakpointSupportsCondition.set(i.supportsCondition),this.breakpointItemType.set("exceptionBreakpoint"),this.breakpointHasMultipleModes.set(this.debugService.getModel().getBreakpointModes("exception").length>1);let{primary:o}=ml(this.menu.getActions({arg:i,shouldForwardArgs:!0}),"inline");e.actionBar.clear(),e.actionBar.push(o,{icon:!0,label:!1}),Yot.set(i.getId(),e.actionBar.domNode)}disposeElement(i,e,t){t.elementDisposables.clear()}disposeCompressedElements(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.templateDisposables.dispose()}},Bie=class{constructor(i,e,t,o,n,r){this.menu=i;this.breakpointSupportsCondition=e;this.breakpointItemType=t;this.debugService=o;this.hoverService=n;this.labelService=r}static{this.ID="functionbreakpoints"}get templateId(){return Bie.ID}renderTemplate(i){let e=Object.create(null);e.elementDisposables=new N,e.templateDisposables=new N,e.templateDisposables.add(e.elementDisposables),e.breakpoint=M(i,Od(".breakpoint")),e.icon=Od(".icon"),e.checkbox=zie(e.templateDisposables),e.templateDisposables.add(e.checkbox.onChange(()=>{this.debugService.enableOrDisableBreakpoints(!e.context.enabled,e.context)})),M(e.breakpoint,e.icon),M(e.breakpoint,e.checkbox.domNode),e.name=M(e.breakpoint,Od("span.name")),e.condition=M(e.breakpoint,Od("span.condition")),e.actionBar=new Zi(e.breakpoint),e.templateDisposables.add(e.actionBar);let t=M(e.breakpoint,Od(".badge-container"));return e.badge=M(t,Od("span.line-number.monaco-count-badge")),e}renderElement(i,e,t){this.renderFunctionBreakpoint(i.element,t)}renderCompressedElements(i,e,t){this.renderFunctionBreakpoint(i.element.elements[i.element.elements.length-1],t)}renderFunctionBreakpoint(i,e){e.context=i,e.name.textContent=i.name;let{icon:t,message:o}=zG(this.debugService.state,this.debugService.getModel().areBreakpointsActivated(),i,this.labelService,this.debugService.getModel());e.icon.className=q.asClassName(t),e.elementDisposables.add(this.hoverService.setupManagedHover(Ri("mouse"),e.icon,o||"")),e.checkbox.checked=i.enabled,e.elementDisposables.add(this.hoverService.setupManagedHover(Ri("mouse"),e.breakpoint,o||"")),i.condition&&i.hitCondition?e.condition.textContent=d(9290,null,i.condition,i.hitCondition):e.condition.textContent=i.condition||i.hitCondition||"",i.modeLabel?(e.badge.textContent=i.modeLabel,e.badge.style.display="block"):e.badge.style.display="none";let n=this.debugService.getViewModel().focusedSession;e.breakpoint.classList.toggle("disabled",n&&!n.capabilities.supportsFunctionBreakpoints||!this.debugService.getModel().areBreakpointsActivated()),n&&!n.capabilities.supportsFunctionBreakpoints&&e.elementDisposables.add(this.hoverService.setupManagedHover(Ri("mouse"),e.breakpoint,d(9299,null))),this.breakpointSupportsCondition.set(!n||!!n.capabilities.supportsConditionalBreakpoints),this.breakpointItemType.set("functionBreakpoint");let{primary:r}=ml(this.menu.getActions({arg:i,shouldForwardArgs:!0}),"inline");e.actionBar.clear(),e.actionBar.push(r,{icon:!0,label:!1}),Yot.set(i.getId(),e.actionBar.domNode)}disposeElement(i,e,t){t.elementDisposables.clear()}disposeCompressedElements(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.templateDisposables.dispose()}};Bie=I([m(3,Ni),m(4,nt),m(5,rt)],Bie);var Hie=class{constructor(i,e,t,o,n,r,s,l){this.menu=i;this.breakpointHasMultipleModes=e;this.breakpointSupportsCondition=t;this.breakpointItemType=o;this.breakpointIsDataBytes=n;this.debugService=r;this.hoverService=s;this.labelService=l}static{this.ID="databreakpoints"}get templateId(){return Hie.ID}renderTemplate(i){let e=Object.create(null);e.breakpoint=M(i,Od(".breakpoint")),e.elementDisposables=new N,e.templateDisposables=new N,e.templateDisposables.add(e.elementDisposables),e.icon=Od(".icon"),e.checkbox=zie(e.templateDisposables),e.templateDisposables.add(e.checkbox.onChange(()=>{this.debugService.enableOrDisableBreakpoints(!e.context.enabled,e.context)})),M(e.breakpoint,e.icon),M(e.breakpoint,e.checkbox.domNode),e.name=M(e.breakpoint,Od("span.name")),e.accessType=M(e.breakpoint,Od("span.access-type")),e.condition=M(e.breakpoint,Od("span.condition")),e.actionBar=new Zi(e.breakpoint),e.templateDisposables.add(e.actionBar);let t=M(e.breakpoint,Od(".badge-container"));return e.badge=M(t,Od("span.line-number.monaco-count-badge")),e}renderElement(i,e,t){this.renderDataBreakpoint(i.element,t)}renderCompressedElements(i,e,t){this.renderDataBreakpoint(i.element.elements[i.element.elements.length-1],t)}renderDataBreakpoint(i,e){e.context=i,e.name.textContent=i.description;let{icon:t,message:o}=zG(this.debugService.state,this.debugService.getModel().areBreakpointsActivated(),i,this.labelService,this.debugService.getModel());e.icon.className=q.asClassName(t),e.elementDisposables.add(this.hoverService.setupManagedHover(Ri("mouse"),e.icon,o||"")),e.checkbox.checked=i.enabled,e.elementDisposables.add(this.hoverService.setupManagedHover(Ri("mouse"),e.breakpoint,o||"")),i.modeLabel?(e.badge.textContent=i.modeLabel,e.badge.style.display="block"):e.badge.style.display="none";let n=this.debugService.getViewModel().focusedSession;if(e.breakpoint.classList.toggle("disabled",n&&!n.capabilities.supportsDataBreakpoints||!this.debugService.getModel().areBreakpointsActivated()),n&&!n.capabilities.supportsDataBreakpoints&&e.elementDisposables.add(this.hoverService.setupManagedHover(Ri("mouse"),e.breakpoint,d(9274,null))),i.accessType){let s=i.accessType==="read"?d(9313,null):i.accessType==="write"?d(9324,null):d(9253,null);e.accessType.textContent=s}else e.accessType.textContent="";i.condition&&i.hitCondition?e.condition.textContent=d(9290,null,i.condition,i.hitCondition):e.condition.textContent=i.condition||i.hitCondition||"",this.breakpointSupportsCondition.set(!n||!!n.capabilities.supportsConditionalBreakpoints),this.breakpointHasMultipleModes.set(this.debugService.getModel().getBreakpointModes("data").length>1),this.breakpointItemType.set("dataBreakpoint"),this.breakpointIsDataBytes.set(i.src.type===1);let{primary:r}=ml(this.menu.getActions({arg:i,shouldForwardArgs:!0}),"inline");e.actionBar.clear(),e.actionBar.push(r,{icon:!0,label:!1}),Yot.set(i.getId(),e.actionBar.domNode),this.breakpointIsDataBytes.reset()}disposeElement(i,e,t){t.elementDisposables.clear()}disposeCompressedElements(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.templateDisposables.dispose()}};Hie=I([m(5,Ni),m(6,nt),m(7,rt)],Hie);var Uie=class{constructor(i,e,t){this.debugService=i;this.hoverService=e;this.labelService=t}static{this.ID="instructionBreakpoints"}get templateId(){return Uie.ID}renderTemplate(i){let e=Object.create(null);e.elementDisposables=new N,e.templateDisposables=new N,e.templateDisposables.add(e.elementDisposables),e.breakpoint=M(i,Od(".breakpoint")),e.icon=Od(".icon"),e.checkbox=zie(e.templateDisposables),e.templateDisposables.add(e.checkbox.onChange(()=>{this.debugService.enableOrDisableBreakpoints(!e.context.enabled,e.context)})),M(e.breakpoint,e.icon),M(e.breakpoint,e.checkbox.domNode),e.name=M(e.breakpoint,Od("span.name")),e.address=M(e.breakpoint,Od("span.file-path")),e.actionBar=new Zi(e.breakpoint),e.templateDisposables.add(e.actionBar);let t=M(e.breakpoint,Od(".badge-container"));return e.badge=M(t,Od("span.line-number.monaco-count-badge")),e}renderElement(i,e,t){this.renderInstructionBreakpoint(i.element,t)}renderCompressedElements(i,e,t){this.renderInstructionBreakpoint(i.element.elements[i.element.elements.length-1],t)}renderInstructionBreakpoint(i,e){e.context=i,e.breakpoint.classList.toggle("disabled",!this.debugService.getModel().areBreakpointsActivated()),e.name.textContent="0x"+i.address.toString(16),e.elementDisposables.add(this.hoverService.setupManagedHover(Ri("mouse"),e.name,d(9276,null,i.address.toString()))),e.checkbox.checked=i.enabled;let{message:t,icon:o}=zG(this.debugService.state,this.debugService.getModel().areBreakpointsActivated(),i,this.labelService,this.debugService.getModel());e.icon.className=q.asClassName(o),e.elementDisposables.add(this.hoverService.setupManagedHover(Ri("mouse"),e.breakpoint,i.message||t||"")),(this.debugService.state===3||this.debugService.state===2)&&!i.verified&&e.breakpoint.classList.add("disabled"),i.modeLabel?(e.badge.textContent=i.modeLabel,e.badge.style.display="block"):e.badge.style.display="none"}disposeElement(i,e,t){t.elementDisposables.clear()}disposeCompressedElements(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.templateDisposables.dispose()}};Uie=I([m(0,Ni),m(1,nt),m(2,rt)],Uie);var PKt=class a{constructor(i,e,t,o,n){this.view=i;this.debugService=e;this.contextViewService=t;this.hoverService=o;this.labelService=n}static{this.ID="functionbreakpointinput"}get templateId(){return a.ID}renderTemplate(i){let e=Object.create(null),t=new N,o=M(i,Od(".breakpoint"));e.icon=Od(".icon"),e.checkbox=zie(t),M(o,e.icon),M(o,e.checkbox.domNode),this.view.breakpointInputFocused.set(!0);let n=M(o,Od(".inputBoxContainer")),r=new Vc(n,this.contextViewService,{inputBoxStyles:Cl});t.add(r);let s=l=>{e.updating=!0;try{this.view.breakpointInputFocused.set(!1);let c=e.breakpoint.getId();l?(e.type==="name"&&this.debugService.updateFunctionBreakpoint(c,{name:r.value}),e.type==="condition"&&this.debugService.updateFunctionBreakpoint(c,{condition:r.value}),e.type==="hitCount"&&this.debugService.updateFunctionBreakpoint(c,{hitCondition:r.value})):e.type==="name"&&!e.breakpoint.name?this.debugService.removeFunctionBreakpoints(c):this.view.renderInputBox(void 0)}finally{e.updating=!1}};return t.add(Jo(r.inputElement,"keydown",l=>{let c=l.equals(9),u=l.equals(3);(c||u)&&(l.preventDefault(),l.stopPropagation(),s(u))})),t.add(j(r.inputElement,"blur",()=>{e.updating||s(!!r.value)})),e.inputBox=r,e.elementDisposables=new N,e.templateDisposables=t,e.templateDisposables.add(e.elementDisposables),e}renderElement(i,e,t){let o=i.element;t.breakpoint=o,t.type=this.view.inputBoxData?.type||"name";let{icon:n,message:r}=zG(this.debugService.state,this.debugService.getModel().areBreakpointsActivated(),o,this.labelService,this.debugService.getModel());t.icon.className=q.asClassName(n),t.elementDisposables.add(this.hoverService.setupManagedHover(Ri("mouse"),t.icon,r||"")),t.checkbox.checked=o.enabled,t.checkbox.disable(),t.inputBox.value=o.name||"";let s=d(9298,null),l=d(9297,null);t.type==="condition"?(t.inputBox.value=o.condition||"",s=d(9294,null),l=d(9293,null)):t.type==="hitCount"&&(t.inputBox.value=o.hitCondition||"",s=d(9296,null),l=d(9295,null)),t.inputBox.setAriaLabel(l),t.inputBox.setPlaceHolder(s),setTimeout(()=>{t.inputBox.focus(),t.inputBox.select()},0)}renderCompressedElements(i,e,t){}disposeElement(i,e,t){t.elementDisposables.clear()}disposeCompressedElements(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.templateDisposables.dispose()}},AKt=class a{constructor(i,e,t,o,n){this.view=i;this.debugService=e;this.contextViewService=t;this.hoverService=o;this.labelService=n}static{this.ID="databreakpointinput"}get templateId(){return a.ID}renderTemplate(i){let e=Object.create(null),t=new N,o=M(i,Od(".breakpoint"));e.icon=Od(".icon"),e.checkbox=zie(t),M(o,e.icon),M(o,e.checkbox.domNode),this.view.breakpointInputFocused.set(!0);let n=M(o,Od(".inputBoxContainer")),r=new Vc(n,this.contextViewService,{inputBoxStyles:Cl});t.add(r);let s=l=>{e.updating=!0;try{this.view.breakpointInputFocused.set(!1);let c=e.breakpoint.getId();l?(e.type==="condition"&&this.debugService.updateDataBreakpoint(c,{condition:r.value}),e.type==="hitCount"&&this.debugService.updateDataBreakpoint(c,{hitCondition:r.value})):this.view.renderInputBox(void 0)}finally{e.updating=!1}};return t.add(Jo(r.inputElement,"keydown",l=>{let c=l.equals(9),u=l.equals(3);(c||u)&&(l.preventDefault(),l.stopPropagation(),s(u))})),t.add(j(r.inputElement,"blur",()=>{e.updating||s(!!r.value)})),e.inputBox=r,e.elementDisposables=new N,e.templateDisposables=t,e.templateDisposables.add(e.elementDisposables),e}renderElement(i,e,t){let o=i.element;t.breakpoint=o,t.type=this.view.inputBoxData?.type||"condition";let{icon:n,message:r}=zG(this.debugService.state,this.debugService.getModel().areBreakpointsActivated(),o,this.labelService,this.debugService.getModel());t.icon.className=q.asClassName(n),t.elementDisposables.add(this.hoverService.setupManagedHover(Ri("mouse"),t.icon,r??"")),t.checkbox.checked=o.enabled,t.checkbox.disable(),t.inputBox.value="";let s="",l="";t.type==="condition"?(t.inputBox.value=o.condition||"",s=d(9269,null),l=d(9268,null)):t.type==="hitCount"&&(t.inputBox.value=o.hitCondition||"",s=d(9271,null),l=d(9270,null)),t.inputBox.setAriaLabel(l),t.inputBox.setPlaceHolder(s),setTimeout(()=>{t.inputBox.focus(),t.inputBox.select()},0)}renderCompressedElements(i,e,t){}disposeElement(i,e,t){t.elementDisposables.clear()}disposeCompressedElements(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.templateDisposables.dispose()}},NKt=class a{constructor(i,e,t){this.view=i;this.debugService=e;this.contextViewService=t}static{this.ID="exceptionbreakpointinput"}get templateId(){return a.ID}renderTemplate(i){let e=new N,t=M(i,Od(".breakpoint"));t.classList.add("exception");let o=zie(e);M(t,o.domNode),this.view.breakpointInputFocused.set(!0);let n=M(t,Od(".inputBoxContainer")),r=new Vc(n,this.contextViewService,{ariaLabel:d(9287,null),inputBoxStyles:Cl});e.add(r);let s=u=>{if(!c.currentBreakpoint)return;this.view.breakpointInputFocused.set(!1);let p=c.currentBreakpoint.condition;u&&(p=r.value!==""?r.value:void 0),this.debugService.setExceptionBreakpointCondition(c.currentBreakpoint,p)};e.add(Jo(r.inputElement,"keydown",u=>{let p=u.equals(9),h=u.equals(3);(p||h)&&(u.preventDefault(),u.stopPropagation(),s(h))})),e.add(j(r.inputElement,"blur",()=>{setTimeout(()=>{s(!0)})}));let l=new N;e.add(l);let c={inputBox:r,checkbox:o,templateDisposables:e,elementDisposables:new N};return c}renderElement(i,e,t){let o=i.element,n=o.conditionDescription||d(9288,null);t.inputBox.setPlaceHolder(n),t.currentBreakpoint=o,t.checkbox.checked=o.enabled,t.checkbox.disable(),t.inputBox.value=o.condition||"",setTimeout(()=>{t.inputBox.focus(),t.inputBox.select()},0)}renderCompressedElements(i,e,t){}disposeElement(i,e,t){t.elementDisposables.clear()}disposeCompressedElements(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.templateDisposables.dispose()}},mLi=class{constructor(i,e){this.debugService=i;this.labelService=e}getWidgetAriaLabel(){return d(9259,null)}getRole(){return"checkbox"}isChecked(i){return i instanceof oU,i.enabled}getAriaLabel(i){if(i instanceof oU)return d(9258,null,Ga(i.uri),i.breakpoints.length);if(i instanceof dA)return i.toString();let{message:e}=zG(this.debugService.state,this.debugService.getModel().areBreakpointsActivated(),i,this.labelService,this.debugService.getModel()),t=i.toString();return e?`${t}, ${e}`:t}};function iFe(a,i,e,t,o,n){if(a.uri.scheme===KC&&o.state===0)return Promise.resolve(void 0);let r=a.endLineNumber?{startLineNumber:a.lineNumber,endLineNumber:a.endLineNumber,startColumn:a.column||1,endColumn:a.endColumn||1073741824}:{startLineNumber:a.lineNumber,startColumn:a.column||1,endLineNumber:a.lineNumber,endColumn:a.column||1073741824};return n.openEditor({resource:a.uri,options:{preserveFocus:e,selection:r,revealIfOpened:!0,selectionRevealType:1,pinned:t}},i?In:jn)}function zG(a,i,e,t,o){let n=a===3||a===2,r=e instanceof hy?FEi:e instanceof mI?NEi:e.logMessage?DUt:eW;if(!e.enabled||!i)return{icon:r.disabled,message:e.logMessage?d(9279,null):d(9278,null)};let s=u=>e.message?u.concat(", "+e.message):u;if(n&&e instanceof Nv&&e.pending)return{icon:eW.pending};if(n&&!e.verified)return{icon:r.unverified,message:e.message?e.message:e.logMessage?d(9323,null):d(9321,null),showAdapterUnverifiedMessage:!0};if(e instanceof hy)return e.supported?{icon:r.regular,message:e.message||d(9262,null)}:{icon:r.unverified,message:d(9275,null)};if(e instanceof mI){if(!e.supported)return{icon:r.unverified,message:d(9300,null)};let u=[];return u.push(e.message||d(9292,null)),e.condition&&u.push(d(9289,null,e.condition)),e.hitCondition&&u.push(d(9301,null,e.hitCondition)),{icon:r.regular,message:s(u.join(`
`))}}if(e instanceof hI){if(!e.supported)return{icon:r.unverified,message:d(9304,null)};let u=[];return e.message?u.push(e.message):e.instructionReference?u.push(d(9303,null,e.instructionReference)):u.push(d(9302,null)),e.hitCondition&&u.push(d(9301,null,e.hitCondition)),{icon:r.regular,message:s(u.join(`
`))}}let l;if(e instanceof Nv&&e.triggeredBy&&(l=o.getBreakpoints().find(u=>u.getId()===e.triggeredBy)),e.logMessage||e.condition||e.hitCondition||l){let u=[],p=e.logMessage?DUt.regular:OEi.regular;return e.supported||(p=LUt,u.push(d(9260,null))),e.logMessage&&u.push(d(9307,null,e.logMessage)),e.condition&&u.push(d(9289,null,e.condition)),e.hitCondition&&u.push(d(9301,null,e.hitCondition)),l&&u.push(d(9320,null,`${t.getUriLabel(l.uri,{relative:!0})}: ${l.lineNumber}`)),{icon:p,message:s(u.join(`
`))}}let c=e.message?e.message:e instanceof Nv&&t?t.getUriLabel(e.uri):d(9257,null);return{icon:r.regular,message:c}}W(class extends K{constructor(){super({id:"workbench.debug.viewlet.action.addFunctionBreakpointAction",title:{...L(9256,"Add Function Breakpoint"),mnemonicTitle:d(9311,null)},f1:!0,icon:fho,menu:[{id:D.ViewTitle,group:"navigation",order:10,when:C.equals("view",yk)},{id:D.MenubarNewBreakpointMenu,group:"1_breakpoints",order:3,when:Aa}]})}async run(a){let i=a.get(Ni);await a.get($t).openView(yk),i.addFunctionBreakpoint()}});var OKt=class extends K{async run(i,e){let t=i.get(Ni),o=t.getViewModel().focusedSession;if(!o)return;let n;e&&e.src.type===1&&(n=`${e.src.address} + ${e.src.bytes}`);let r=i.get(Ue),s=i.get(Ne),l=await this.getRange(r,n);if(!l)return;let c;try{c=await o.dataBytesBreakpointInfo(l.address,l.bytes)}catch(h){s.error(d(9267,null,l.address,h.message))}if(!c?.dataId)return;let u="write";if(c.accessTypes&&c.accessTypes?.length>1){let h=c.accessTypes.map(f=>({label:f})),g=await r.pick(h,{placeHolder:d(9263,null)});if(!g)return;u=g.label}let p={type:1,...l};e&&await t.removeDataBreakpoints(e.getId()),await t.addDataBreakpoint({description:c.description,src:p,canPersist:!0,accessTypes:c.accessTypes,accessType:u,initialSessionData:{session:o,dataId:c.dataId}})}getRange(i,e){return new Promise(t=>{let o=new N,n=o.add(i.createInputBox());n.prompt=d(9273,null),n.placeholder=d(9272,null),e&&(n.value=e,n.valueSelection=[0,e.length]),o.add(n.onDidChangeValue(r=>{let s=this.parseAddress(r,!1);n.validationMessage=s?.error})),o.add(n.onDidAccept(()=>{let r=this.parseAddress(n.value,!0);No(r,{error:!0})?n.validationMessage=r.error:t(r),n.dispose()})),o.add(n.onDidHide(()=>{t(void 0),o.dispose()})),n.ignoreFocusOut=!0,n.show()})}parseAddress(i,e){let t=/^(\S+)\s*(?:([+-])\s*(\S+))?/.exec(i);if(!t)return{error:d(9264,null)};let o=p=>e?/^0x[0-9a-f]*|[0-9]*$/i.test(p):/^0x[0-9a-f]+|[0-9]+$/i.test(p),[,n,r="+",s="1"]=t;for(let p of[n,s])if(!o(p))return{error:d(9266,null,p)};if(!e)return;let l=BigInt(n),c=BigInt(s),u=`0x${l.toString(16)}`;return r==="-"?l>c?{error:d(9265,null,n,s)}:{address:u,bytes:Number(c-l)}:{address:u,bytes:Number(c)}}};W(class extends OKt{constructor(){super({id:"workbench.debug.viewlet.action.addDataBreakpointOnAddress",title:{...L(9255,"Add Data Breakpoint at Address"),mnemonicTitle:d(9308,null)},f1:!0,icon:vho,menu:[{id:D.ViewTitle,group:"navigation",order:11,when:C.and(vTe,C.equals("view",yk))},{id:D.MenubarNewBreakpointMenu,group:"1_breakpoints",order:4,when:vTe}]})}});W(class extends OKt{constructor(){super({id:"workbench.debug.viewlet.action.editDataBreakpointOnAddress",title:L(9282,"Edit Address..."),menu:[{id:D.DebugBreakpointsContext,when:C.and(vTe,zhi),group:"navigation",order:15}]})}});W(class extends K{constructor(){super({id:"workbench.debug.viewlet.action.toggleBreakpointsActivatedAction",title:L(9254,"Toggle Activate Breakpoints"),f1:!0,icon:Sho,menu:{id:D.ViewTitle,group:"navigation",order:20,when:C.equals("view",yk)}})}run(a){let i=a.get(Ni);i.setBreakpointsActivated(!i.getModel().areBreakpointsActivated())}});W(class extends K{constructor(){super({id:"workbench.debug.viewlet.action.removeBreakpoint",title:d(9316,null),icon:R.removeClose,menu:[{id:D.DebugBreakpointsContext,group:"3_modification",order:10,when:uD.notEqualsTo("exceptionBreakpoint")},{id:D.DebugBreakpointsContext,group:"inline",order:20,when:uD.notEqualsTo("exceptionBreakpoint")}]})}async run(a,i){let e=a.get(Ni);i instanceof Nv?await e.removeBreakpoints(i.getId()):i instanceof mI?await e.removeFunctionBreakpoints(i.getId()):i instanceof hy?await e.removeDataBreakpoints(i.getId()):i instanceof hI&&await e.removeInstructionBreakpoints(i.instructionReference,i.offset)}});W(class extends K{constructor(){super({id:"workbench.debug.viewlet.action.removeAllBreakpoints",title:{...L(9315,"Remove All Breakpoints"),mnemonicTitle:d(9312,null)},f1:!0,icon:bho,menu:[{id:D.ViewTitle,group:"navigation",order:30,when:C.equals("view",yk)},{id:D.DebugBreakpointsContext,group:"3_modification",order:20,when:C.and(v4,uD.notEqualsTo("exceptionBreakpoint"))},{id:D.MenubarDebugMenu,group:"5_breakpoints",order:3,when:Aa}]})}run(a){let i=a.get(Ni);i.removeBreakpoints(),i.removeFunctionBreakpoints(),i.removeDataBreakpoints(),i.removeInstructionBreakpoints()}});W(class extends K{constructor(){super({id:"workbench.debug.viewlet.action.enableAllBreakpoints",title:{...L(9286,"Enable All Breakpoints"),mnemonicTitle:d(9310,null)},f1:!0,precondition:Aa,menu:[{id:D.DebugBreakpointsContext,group:"z_commands",order:10,when:C.and(v4,uD.notEqualsTo("exceptionBreakpoint"))},{id:D.MenubarDebugMenu,group:"5_breakpoints",order:1,when:Aa}]})}async run(a){await a.get(Ni).enableOrDisableBreakpoints(!0)}});W(class extends K{constructor(){super({id:"workbench.debug.viewlet.action.disableAllBreakpoints",title:{...L(9277,"Disable All Breakpoints"),mnemonicTitle:d(9309,null)},f1:!0,precondition:Aa,menu:[{id:D.DebugBreakpointsContext,group:"z_commands",order:20,when:C.and(v4,uD.notEqualsTo("exceptionBreakpoint"))},{id:D.MenubarDebugMenu,group:"5_breakpoints",order:2,when:Aa}]})}async run(a){await a.get(Ni).enableOrDisableBreakpoints(!1)}});W(class extends K{constructor(){super({id:"workbench.debug.viewlet.action.reapplyBreakpointsAction",title:L(9314,"Reapply All Breakpoints"),f1:!0,precondition:sl,menu:[{id:D.DebugBreakpointsContext,group:"z_commands",order:30,when:C.and(v4,uD.notEqualsTo("exceptionBreakpoint"))}]})}async run(a){await a.get(Ni).setBreakpointsActivated(!0)}});W(class extends K{constructor(){super({id:"workbench.debug.viewlet.action.toggleBreakpointsPresentation",title:L(9319,"Toggle Breakpoints View Presentation"),f1:!0,icon:_Ut,menu:{id:D.ViewTitle,group:"navigation",order:10,when:C.equals("view",yk)}})}async run(a){let i=a.get(B),t=i.getValue("debug.breakpointsView.presentation")==="tree"?"list":"tree";await i.updateValue("debug.breakpointsView.presentation",t)}});W(class extends Yn{constructor(){super({id:"debug.editBreakpoint",viewId:yk,title:d(9281,null),icon:R.edit,precondition:eRt,menu:[{id:D.DebugBreakpointsContext,when:uD.notEqualsTo("functionBreakpoint"),group:"navigation",order:10},{id:D.DebugBreakpointsContext,group:"inline",order:10}]})}async runInView(a,i,e){let t=a.get(Ni),o=a.get(ee);if(e instanceof Nv){let n=await iFe(e,!1,!1,!0,t,o);if(n){let r=n.getControl();pn(r)&&r.getContribution(aA)?.showBreakpointWidget(e.lineNumber,e.column)}}else if(e instanceof mI){let n=a.get(Xe),r=[new it("breakpoint.editCondition",d(9281,null),void 0,!0,async()=>i.renderInputBox({breakpoint:e,type:"condition"})),new it("breakpoint.editCondition",d(9283,null),void 0,!0,async()=>i.renderInputBox({breakpoint:e,type:"hitCount"}))],s=Yot.get(e.getId());s&&n.showContextMenu({getActions:()=>r,getAnchor:()=>s,onHide:()=>Be(r)})}else i.renderInputBox({breakpoint:e,type:"condition"})}});W(class extends Yn{constructor(){super({id:"debug.editFunctionBreakpoint",viewId:yk,title:d(9280,null),menu:[{id:D.DebugBreakpointsContext,group:"navigation",order:10,when:uD.isEqualTo("functionBreakpoint")}]})}runInView(a,i,e){i.renderInputBox({breakpoint:e,type:"name"})}});W(class extends Yn{constructor(){super({id:"debug.editFunctionBreakpointHitCount",viewId:yk,title:d(9283,null),precondition:eRt,menu:[{id:D.DebugBreakpointsContext,group:"navigation",order:20,when:C.or(uD.isEqualTo("functionBreakpoint"),uD.isEqualTo("dataBreakpoint"))}]})}runInView(a,i,e){i.renderInputBox({breakpoint:e,type:"hitCount"})}});W(class extends Yn{constructor(){super({id:"debug.editBreakpointMode",viewId:yk,title:d(9284,null),menu:[{id:D.DebugBreakpointsContext,group:"navigation",order:20,when:C.and(Khi,C.or(uD.isEqualTo("breakpoint"),uD.isEqualTo("exceptionBreakpoint"),uD.isEqualTo("instructionBreakpoint")))}]})}async runInView(a,i,e){let t=a.get(Ni),o=Qbo(e),n=t.getModel().getBreakpointModes(o),r=await a.get(Ue).pick(n.map(s=>({label:s.label,description:s.description,mode:s.mode})),{placeHolder:d(9318,null)});if(r)if(o==="source"){let s=new Map;s.set(e.getId(),{mode:r.mode,modeLabel:r.label}),t.updateBreakpoints(e.originalUri,s,!1)}else e instanceof hI?(t.removeInstructionBreakpoints(e.instructionReference,e.offset),t.addInstructionBreakpoint({...e.toJSON(),mode:r.mode,modeLabel:r.label})):e instanceof dA&&(e.mode=r.mode,e.modeLabel=r.label,t.setExceptionBreakpointCondition(e,e.condition))}});async function Xbo(a,i){let e=a.get(Ue),t=a.get(Ni),o=a.get($t),n=a.get(ge),r=new N,s=e.createQuickPick({useSeparators:!0});r.add(s),s.matchOnLabel=s.matchOnDescription=s.matchOnDetail=s.sortByLabel=!1,s.placeholder=d(9677,null);let l=Ybo(s.value,i,t,o,n);s.items=l.picks,s.activeItems=l.activeItems,r.add(s.onDidChangeValue(async()=>{s.items=Ybo(s.value,i,t,o,n).picks})),r.add(s.onDidAccept(()=>{s.selectedItems[0].accept(),s.hide(),r.dispose()})),s.show()}function Ybo(a,i,e,t,o){let n=[],r=[],s=e.getViewModel().focusedSession,l=e.getModel().getSessions(!1),c=[];l.forEach(p=>{p.compact&&p.parentSession&&r.push(p.parentSession)}),l.forEach(p=>{let h=r.includes(p);if(p.parentSession||n.push({type:"separator",label:h?p.name:void 0}),!h){let g=Tin(p,a,e,t,o);g&&(n.push(g),p.getId()===s?.getId()&&c.push(g))}}),n.length&&n.push({type:"separator"});let u=d(9679,null);return n.push({label:`$(plus) ${u}`,ariaLabel:u,accept:()=>o.executeCommand(i)}),{picks:n,activeItems:c}}function Ein(a){let i=a.configuration.name.length?a.configuration.name:a.name,e=a.compact?void 0:a.parentSession?.configuration.name,t="",o="";return e&&(o=d(9678,null,i,e),t=e),{label:i,description:t,ariaLabel:o}}function Tin(a,i,e,t,o){let n=Ein(a),r=lm(i,n.label,!0);if(r)return{label:n.label,description:n.description,ariaLabel:n.ariaLabel,highlights:{label:r},accept:()=>{e.focusStackFrame(void 0,void 0,a,{explicit:!0}),t.isViewVisible(Td)||t.openView(Td,!0)}}}var Age="debug.addConfiguration",FKt="editor.debug.action.copyAddress",WKt="editor.debug.action.toggleBreakpoint",Xot="editor.debug.action.toggleInlineBreakpoint",gLi="debug.copyStackTrace",fLi="workbench.action.debug.reverseContinue",vLi="workbench.action.debug.stepBack",KG="workbench.action.debug.restart",VKt="workbench.action.debug.terminateThread",GG="workbench.action.debug.stepOver",qG="workbench.action.debug.stepInto",bLi="workbench.action.debug.stepIntoTarget",$G="workbench.action.debug.stepOut",lQ="workbench.action.debug.pause",LM="workbench.action.debug.disconnect",oFe="workbench.action.debug.disconnectAndSuspend",qT="workbench.action.debug.stop",SLi="workbench.action.debug.restartFrame",jG="workbench.action.debug.continue",Jbo="workbench.debug.action.focusRepl",Jot="debug.jumpToCursor",nFe="workbench.action.debug.focusProcess",cQ="workbench.action.debug.selectandstart",BKt="workbench.action.debug.selectDebugConsole",ILi="workbench.action.debug.selectDebugSession",QG="workbench.action.debug.configure",xW="workbench.action.debug.start",Zot="workbench.action.debug.run",yLi="debug.renameWatchExpression",Zbo="debug.copyWatchExpression",wLi="debug.setWatchExpression",CLi="debug.removeWatchExpression",xLi="workbench.action.debug.nextConsole",kLi="workbench.action.debug.prevConsole",ELi="workbench.action.debug.showLoadedScripts",TLi="workbench.action.debug.callStackTop",_Li="workbench.action.debug.callStackBottom",DLi="workbench.action.debug.callStackUp",LLi="workbench.action.debug.callStackDown",ent="debug.addToWatchExpressions",Kie="debug.copyEvaluatePath",dQ="workbench.debug.viewlet.action.copyValue",tnt="debug.breakWhenValueChanges",int="debug.breakWhenValueIsAccessed",ont="debug.breakWhenValueIsRead",_in="debug.toggleExceptionBreakpoints",Din="debug.attachToCurrentCodeRenderer",Gie=L(9522,"Debug"),qie=L(9534,"Restart"),$ie=L(9544,"Step Over"),jie=L(9541,"Step Into"),eSo=L(9542,"Step Into Target"),Qie=L(9543,"Step Out"),Yie=L(9532,"Pause"),uQ=L(9523,"Disconnect"),nnt=L(9524,"Disconnect and Suspend"),YG=L(9545,"Stop"),Xie=L(9518,"Continue"),tSo=L(9526,"Focus Session"),iSo=L(9535,"Select and Start Debugging"),rFe=d(9530,null,"launch.json"),rnt=L(9539,"Start Debugging"),RLi=L(9540,"Start Without Debugging"),oSo=L(9528,"Focus Next Debug Console"),nSo=L(9533,"Focus Previous Debug Console"),rSo=L(9531,"Open Loaded Script..."),sSo=L(9515,"Navigate to Top of Call Stack"),aSo=L(9513,"Navigate to Bottom of Call Stack"),lSo=L(9516,"Navigate Up Call Stack"),cSo=L(9514,"Navigate Down Call Stack"),sFe=L(9520,"Copy as Expression"),snt=L(9521,"Copy Value"),HKt=L(9519,"Copy Address"),ant=L(9511,"Add to Watch"),dSo=L(9536,"Select Debug Console"),uSo=L(9537,"Select Debug Session"),lnt="debug ",cnt="debug consoles ",GT;function UKt(a){GT=a}function Lin(a){return a&&typeof a.sessionId=="string"&&typeof a.threadId=="string"}async function CW(a,i,e){let t=a.get(Ni),o;if(Lin(i)){let n=t.getModel().getSession(i.sessionId);n&&(o=n.getAllThreads().find(r=>r.getId()===i.threadId))}else if(MLi(i)){let n=t.getModel().getSession(i.sessionId);if(n){let r=n.getAllThreads();o=r.length>0?r[0]:void 0}}if(!o&&(o=t.getViewModel().focusedThread,!o)){let n=t.getViewModel().focusedSession,r=n?n.getAllThreads():void 0;o=r&&r.length?r[0]:void 0}o&&await e(o)}function Rin(a){return a&&typeof a.sessionId=="string"&&typeof a.threadId=="string"&&typeof a.frameId=="string"}function pSo(a,i){if(Rin(i)){let e=a.getModel().getSession(i.sessionId);if(e){let t=e.getAllThreads().find(o=>o.getId()===i.threadId);if(t)return t.getCallStack().find(o=>o.getId()===i.frameId)}}else return a.getViewModel().focusedStackFrame}function MLi(a){return a&&typeof a.sessionId=="string"}async function mSo(a,i){let e=a.get(Ni),t=a.get($t),o=e.getModel().getSessions(!0).filter(s=>s.hasSeparateRepl()),n=e.getViewModel().focusedSession,r=0;if(o.length>0&&n){for(;n&&!n.hasSeparateRepl();)n=n.parentSession;if(n){let s=o.indexOf(n);i?r=s===o.length-1?0:s+1:r=s===0?o.length-1:s-1}}await e.focusStackFrame(void 0,void 0,o[r],{explicit:!0}),t.isViewVisible(Td)||await t.openView(Td,!0)}async function hSo(a,i){let e=a.getViewModel().focusedStackFrame;if(e){let t=e.thread.getCallStack(),o=t.findIndex(r=>r.frameId===e.frameId),n;if(i){if(o>=t.length-1)if(e.thread.reachedEndOfCallStack){fSo(a);return}else await a.getModel().fetchCallstack(e.thread,20),t=e.thread.getCallStack(),o=t.findIndex(r=>r.frameId===e.frameId);n=hLi(!0,t,o)}else{if(o<=0){gSo(a);return}n=hLi(!1,t,o)}n&&a.focusStackFrame(n,void 0,void 0,{preserveFocus:!1})}}async function gSo(a){let i=a.getViewModel().focusedThread;if(i){await a.getModel().fetchCallstack(i);let e=i.getCallStack();if(e.length>0){let t=hLi(!1,e,0);t&&a.focusStackFrame(t,void 0,void 0,{preserveFocus:!1})}}}function fSo(a){let i=a.getViewModel().focusedThread;i&&a.focusStackFrame(i.getTopStackFrame(),void 0,void 0,{preserveFocus:!1})}function hLi(a,i,e){e>=i.length?e=i.length-1:e<0&&(e=0);let t=e,o;do if(a?t===i.length-1?t=0:t++:t===0?t=i.length-1:t--,o=i[t],!KK(o))return o;while(t!==e)}$e.registerCommand({id:gLi,handler:async(a,i,e)=>{let t=a.get(KL),o=a.get(Fi),n=a.get(Ni),r=pSo(n,e);if(r){let s=t.getEOL(r.source.uri);await o.writeText(r.thread.getCallStack().map(l=>l.toString()).join(s))}}});$e.registerCommand({id:fLi,handler:async(a,i,e)=>{await CW(a,e,t=>t.reverseContinue())}});$e.registerCommand({id:vLi,handler:async(a,i,e)=>{let t=a.get(X);zK.getValue(t)?await CW(a,e,o=>o.stepBack("instruction")):await CW(a,e,o=>o.stepBack())}});$e.registerCommand({id:VKt,handler:async(a,i,e)=>{await CW(a,e,t=>t.terminate())}});$e.registerCommand({id:Jot,handler:async a=>{let e=a.get(Ni).getViewModel().focusedStackFrame,o=a.get(ee).activeTextEditorControl,n=a.get(Ne),r=a.get(Ue);if(e&&pn(o)&&o.hasModel()){let s=o.getPosition(),l=o.getModel().uri,c=e.thread.session.getSourceForUri(l);if(c){let p=(await e.thread.session.gotoTargets(c.raw,s.lineNumber,s.column))?.body.targets;if(p&&p.length){let h=p[0].id;if(p.length>1){let g=p.map(v=>({label:v.label,_id:v.id})),f=await r.pick(g,{placeHolder:d(9517,null)});if(!f)return;h=f._id}return await e.thread.session.goto(e.thread.threadId,h).catch(g=>n.warn(g))}}}return n.warn(d(9529,null))}});$e.registerCommand({id:TLi,handler:async(a,i,e)=>{let t=a.get(Ni);fSo(t)}});$e.registerCommand({id:_Li,handler:async(a,i,e)=>{let t=a.get(Ni);await gSo(t)}});$e.registerCommand({id:DLi,handler:async(a,i,e)=>{let t=a.get(Ni);hSo(t,!1)}});$e.registerCommand({id:LLi,handler:async(a,i,e)=>{let t=a.get(Ni);hSo(t,!0)}});ve.appendMenuItem(D.EditorContext,{command:{id:Jot,title:d(9527,null),category:Gie},when:C.and(sue,pe.editorTextFocus),group:"debug",order:3});Ct.registerCommandAndKeybindingRule({id:xLi,weight:201,when:GF,primary:2060,mac:{primary:3166},handler:async(a,i,e)=>{mSo(a,!0)}});Ct.registerCommandAndKeybindingRule({id:kLi,weight:201,when:GF,primary:2059,mac:{primary:3164},handler:async(a,i,e)=>{mSo(a,!1)}});Ct.registerCommandAndKeybindingRule({id:KG,weight:200,primary:3135,when:sl,handler:async(a,i,e)=>{let t=a.get(Ni),o=a.get(B),n;if(MLi(e)?n=t.getModel().getSession(e.sessionId):n=t.getViewModel().focusedSession,n){let r=o.getValue("debug").showSubSessionsInToolBar;for(;!r&&n.lifecycleManagedByParent&&n.parentSession;)n=n.parentSession;n.removeReplExpressions(),await t.restartSession(n)}else{let{launch:r,name:s}=t.getConfigurationManager().selectedConfiguration;await t.startDebugging(r,s,{noDebug:!1,startedByUser:!0})}}});Ct.registerCommandAndKeybindingRule({id:GG,weight:200,primary:68,when:Zs.isEqualTo("stopped"),handler:async(a,i,e)=>{let t=a.get(X);zK.getValue(t)?await CW(a,e,o=>o.next("instruction")):await CW(a,e,o=>o.next())}});var vSo=Wt&&ei?581:69;Ct.registerCommandAndKeybindingRule({id:qG,weight:210,primary:vSo,when:Zs.notEqualsTo("inactive"),handler:async(a,i,e)=>{let t=a.get(X);zK.getValue(t)?await CW(a,e,o=>o.stepIn("instruction")):await CW(a,e,o=>o.stepIn())}});Ct.registerCommandAndKeybindingRule({id:$G,weight:200,primary:1093,when:Zs.isEqualTo("stopped"),handler:async(a,i,e)=>{let t=a.get(X);zK.getValue(t)?await CW(a,e,o=>o.stepOut("instruction")):await CW(a,e,o=>o.stepOut())}});Ct.registerCommandAndKeybindingRule({id:lQ,weight:202,primary:64,when:Zs.isEqualTo("running"),handler:async(a,i,e)=>{await CW(a,e,t=>t.pause())}});Ct.registerCommandAndKeybindingRule({id:bLi,primary:vSo|2048,when:C.and(aJ,sl,Zs.isEqualTo("stopped")),weight:200,handler:async(a,i,e)=>{let t=a.get(Ue),o=a.get(Ni),n=o.getViewModel().focusedSession,r=o.getViewModel().focusedStackFrame;if(!r||!n)return;let s=await a.get(ee).openEditor({resource:r.source.uri,options:{revealIfOpened:!0}}),l;if(s){let p=s?.getControl();pn(p)&&(l=p)}let c=new N,u=c.add(t.createQuickPick());u.busy=!0,u.show(),c.add(u.onDidChangeActive(([p])=>{l&&p&&p.target.line!==void 0&&(l.revealLineInCenterIfOutsideViewport(p.target.line),l.setSelection({startLineNumber:p.target.line,startColumn:p.target.column||1,endLineNumber:p.target.endLine||p.target.line,endColumn:p.target.endColumn||p.target.column||1}))})),c.add(u.onDidAccept(()=>{u.activeItems.length&&n.stepIn(r.thread.threadId,u.activeItems[0].target.id)})),c.add(u.onDidHide(()=>c.dispose())),n.stepInTargets(r.frameId).then(p=>{u.busy=!1,p?.length?u.items=p?.map(h=>({target:h,label:h.label})):u.placeholder=d(9525,null)})}});async function PLi(a,i,e,t,o){let n=a.get(Ni),r;MLi(e)?r=n.getModel().getSession(e.sessionId):r=n.getViewModel().focusedSession;let l=a.get(B).getValue("debug").showSubSessionsInToolBar;for(;!l&&r&&r.lifecycleManagedByParent&&r.parentSession;)r=r.parentSession;await n.stopSession(r,t,o)}Ct.registerCommandAndKeybindingRule({id:LM,weight:200,primary:1087,when:C.and(zC,sl),handler:(a,i,e)=>PLi(a,i,e,!0)});$e.registerCommand({id:oFe,handler:(a,i,e)=>PLi(a,i,e,!0,!0)});Ct.registerCommandAndKeybindingRule({id:qT,weight:200,primary:1087,when:C.and(zC.toNegated(),sl),handler:(a,i,e)=>PLi(a,i,e,!1)});$e.registerCommand({id:SLi,handler:async(a,i,e)=>{let t=a.get(Ni),o=a.get(Ne),n=pSo(t,e);if(n)try{await n.restart()}catch(r){o.error(r)}}});Ct.registerCommandAndKeybindingRule({id:jG,weight:210,primary:63,when:Zs.isEqualTo("stopped"),handler:async(a,i,e)=>{await CW(a,e,t=>t.continue())}});$e.registerCommand({id:ELi,handler:async a=>{await jbo(a)}});$e.registerCommand({id:"debug.startFromConfig",handler:async(a,i)=>{await a.get(Ni).startDebugging(void 0,i)}});$e.registerCommand({id:nFe,handler:async(a,i)=>{let e=a.get(Ni),t=a.get(ee);i=mRt(i,e.getModel().getSessions()),await e.focusStackFrame(void 0,void 0,i,{explicit:!0});let o=e.getViewModel().focusedStackFrame;o&&await o.openInEditor(t,!0)}});$e.registerCommand({id:cQ,handler:async(a,i,e)=>{let t=a.get(Ue),o=a.get(Ni);if(i){let n=o.getConfigurationManager(),r=await n.getDynamicProviders();for(let s of r)if(s.type===i){let l=await s.pick();if(l){await n.selectConfiguration(l.launch,l.config.name,l.config,{type:s.type}),o.startDebugging(l.launch,l.config,{noDebug:e?.noDebug,startedByUser:!0});return}}}t.quickAccess.show(lnt)}});$e.registerCommand({id:BKt,handler:async a=>{a.get(Ue).quickAccess.show(cnt)}});$e.registerCommand({id:ILi,handler:async a=>{Xbo(a,cQ)}});Ct.registerCommandAndKeybindingRule({id:xW,weight:200,primary:63,when:C.and(Aa,Zs.isEqualTo("inactive")),handler:async(a,i)=>{let e=a.get(Ni);await S9e(a.get(B),a.get(ee));let{launch:t,name:o,getConfig:n}=e.getConfigurationManager().selectedConfiguration,r=await n(),s=r?Object.assign(Ji(r),i?.config):o;await e.startDebugging(t,s,{noDebug:i?.noDebug,startedByUser:!0},!1)}});Ct.registerCommandAndKeybindingRule({id:Zot,weight:200,primary:2111,mac:{primary:319},when:C.and(Aa,Zs.notEqualsTo(KR(1))),handler:async a=>{await a.get(ge).executeCommand(xW,{noDebug:!0})}});Ct.registerCommandAndKeybindingRule({id:"debug.toggleBreakpoint",weight:205,when:C.and(fTe,ig.toNegated()),primary:10,handler:a=>{let i=a.get(Io),e=a.get(Ni),t=i.lastFocusedList;if(t instanceof Cc){let o=t.getFocusedElements();o&&o.length&&e.enableOrDisableBreakpoints(!o[0].enabled,o[0])}}});Ct.registerCommandAndKeybindingRule({id:"debug.enableOrDisableBreakpoint",weight:200,primary:void 0,when:pe.editorTextFocus,handler:a=>{let i=a.get(Ni),t=a.get(ee).activeTextEditorControl;if(pn(t)){let o=t.getModel();if(o){let n=t.getPosition();if(n){let r=i.getModel().getBreakpoints({uri:o.uri,lineNumber:n.lineNumber});r.length&&i.enableOrDisableBreakpoints(!r[0].enabled,r[0])}}}}});Ct.registerCommandAndKeybindingRule({id:yLi,weight:205,when:u9e,primary:60,mac:{primary:3},handler:(a,i)=>{let e=a.get(Ni);if(!(i instanceof dd)){let o=a.get(Io).lastFocusedList;if(o){let n=o.getFocus();Array.isArray(n)&&n[0]instanceof dd&&(i=n[0])}}i instanceof dd&&e.getViewModel().setSelectedExpression(i,!1)}});$e.registerCommand({id:wLi,handler:async(a,i)=>{let e=a.get(Ni);(i instanceof dd||i instanceof $l)&&e.getViewModel().setSelectedExpression(i,!0)}});Ct.registerCommandAndKeybindingRule({id:"debug.setVariable",weight:205,when:XLt,primary:60,mac:{primary:3},handler:a=>{let i=a.get(Io),e=a.get(Ni),t=i.lastFocusedList;if(t){let o=t.getFocus();Array.isArray(o)&&o[0]instanceof $l&&e.getViewModel().setSelectedExpression(o[0],!1)}}});Ct.registerCommandAndKeybindingRule({id:CLi,weight:200,when:C.and(u9e,nJ.toNegated()),primary:20,mac:{primary:2049},handler:(a,i)=>{let e=a.get(Ni);if(i instanceof dd){e.removeWatchExpressions(i.getId());return}let o=a.get(Io).lastFocusedList;if(o){let n=o.getFocus();if(Array.isArray(n)&&n[0]instanceof dd){let r=o.getSelection();r&&r.indexOf(n[0])>=0&&(n=r),n.forEach(s=>e.removeWatchExpressions(s.getId()))}}}});$e.registerCommand({id:tnt,handler:async a=>{let i=a.get(Ni);GT&&await i.addDataBreakpoint({description:GT.description,src:{type:0,dataId:GT.dataId},canPersist:!!GT.canPersist,accessTypes:GT.accessTypes,accessType:"write"})}});$e.registerCommand({id:int,handler:async a=>{let i=a.get(Ni);GT&&await i.addDataBreakpoint({description:GT.description,src:{type:0,dataId:GT.dataId},canPersist:!!GT.canPersist,accessTypes:GT.accessTypes,accessType:"readWrite"})}});$e.registerCommand({id:ont,handler:async a=>{let i=a.get(Ni);GT&&await i.addDataBreakpoint({description:GT.description,src:{type:0,dataId:GT.dataId},canPersist:!!GT.canPersist,accessTypes:GT.accessTypes,accessType:"read"})}});Ct.registerCommandAndKeybindingRule({id:"debug.removeBreakpoint",weight:200,when:C.and(fTe,JLt.toNegated()),primary:20,mac:{primary:2049},handler:a=>{let i=a.get(Io),e=a.get(Ni),t=i.lastFocusedList;if(t instanceof Cc){let o=t.getFocusedElements(),n=o.length?o[0]:void 0;n instanceof Nv?e.removeBreakpoints(n.getId()):n instanceof mI?e.removeFunctionBreakpoints(n.getId()):n instanceof hy&&e.removeDataBreakpoints(n.getId())}}});Ct.registerCommandAndKeybindingRule({id:"debug.installAdditionalDebuggers",weight:200,when:void 0,primary:void 0,handler:async(a,i)=>{let e=a.get(Hi),t="@category:debuggers";return typeof i=="string"&&(t+=` ${i}`),e.openSearch(t)}});W(class extends K{constructor(){super({id:Age,title:L(9509,"Add Configuration..."),category:Gie,f1:!0,menu:{id:D.EditorContent,when:C.and(C.regex(Wo.Path.key,/\.vscode[/\\]launch\.json$/),fr.isEqualTo(w0))}})}async run(i,e){let t=i.get(Ni).getConfigurationManager(),o=t.getLaunches().find(n=>n.uri.toString()===e)||t.selectedConfiguration.launch;if(o){let{editor:n,created:r}=await o.openConfigFile({preserveFocus:!1});if(n&&!r){let s=n.getControl();s&&await s.getContribution(RB)?.addLaunchConfiguration()}}}});var Min=a=>{let i=a.get(Ni),t=a.get(ee).activeTextEditorControl;if(pn(t)){let o=t.getPosition();if(o&&t.hasModel()&&i.canSetBreakpointsIn(t.getModel())){let n=t.getModel().uri;i.getModel().getBreakpoints({lineNumber:o.lineNumber,uri:n}).some(s=>s.sessionAgnosticData.column===o.column||!s.column&&o.column<=1)||i.addBreakpoints(n,[{lineNumber:o.lineNumber,column:o.column>1?o.column:void 0}])}}};Ct.registerCommandAndKeybindingRule({weight:200,primary:1091,when:pe.editorTextFocus,id:Xot,handler:Min});ve.appendMenuItem(D.EditorContext,{command:{id:Xot,title:d(9510,null),category:Gie},when:C.and(sl,Xde.toNegated(),pe.editorTextFocus,ie.inChatSession.toNegated()),group:"debug",order:1});Ct.registerCommandAndKeybindingRule({id:"debug.openBreakpointToSide",weight:200,when:fTe,primary:2051,secondary:[515],handler:a=>{let e=a.get(Io).lastFocusedList;if(e instanceof Cc){let t=e.getFocusedElements();if(t.length&&t[0]instanceof Nv)return iFe(t[0],!0,!1,!0,a.get(Ni),a.get(ee))}}});W(class extends K{constructor(){super({id:_in,title:L(9546,"Toggle Exception Breakpoints"),category:Gie,f1:!0,precondition:Aa})}async run(i){let e=i.get(Ni),t=i.get(Ue),o=e.getModel(),n=e.getViewModel().focusedSession||o.getSessions()[0],r=n?o.getExceptionBreakpointsForSession(n.getId()):o.getExceptionBreakpoints();if(r.length===0)return;if(r.length===1){let c=r[0];await e.enableOrDisableBreakpoints(!c.enabled,c);return}let s=new N,l=s.add(t.createQuickPick());l.placeholder=d(9538,null),l.canSelectMany=!0,l.matchOnDescription=!0,l.matchOnDetail=!0,l.items=r.map(c=>({label:c.label,description:c.description,picked:c.enabled,breakpoint:c})),l.selectedItems=l.items.filter(c=>c.picked),s.add(l.onDidAccept(()=>{let c=l.selectedItems,u=[],p=[];for(let g of r){let f=c.some(v=>v.breakpoint===g);f&&!g.enabled?u.push(g):!f&&g.enabled&&p.push(g)}let h=[];for(let g of u)h.push(e.enableOrDisableBreakpoints(!0,g));for(let g of p)h.push(e.enableOrDisableBreakpoints(!1,g));Promise.all(h).then(()=>s.dispose())})),s.add(l.onDidHide(()=>s.dispose())),l.show()}});Ct.registerCommandAndKeybindingRule({id:"debug.openView",weight:200,when:Aa.toNegated(),primary:63,secondary:[2111],handler:async a=>{await a.get(us).openPaneComposite(cg,0,!0)}});W(class extends K{constructor(){super({id:Din,title:L(9512,"Attach to Current Code Renderer")})}async run(a){let i=a.get(Eo);if(!i.isExtensionDevelopment&&!i.extensionTestsLocationURI)throw new Error("Refusing to attach to renderer outside of development context");let e=gv(ut);return await a.get(ZD).attachToCurrentWindowRenderer(e)}});var bSo="\\u0000-\\u0020\\u007f-\\u009f",Pin=new RegExp("(?:[a-zA-Z][a-zA-Z0-9+.-]{2,}:\\/\\/|data:|www\\.)[^\\s"+bSo+'"]{2,}[^\\s'+bSo+`"')}\\],:;.!?]`,"ug"),Ain=/(?:[a-zA-Z]:(?:(?:\\|\/)[\w\s\.@\-\(\)\[\]{}!#$%^&'`~+=]+)+)/,Nin=/(?:(?:\~|\.+)(?:(?:\\|\/)[\w\s\.@\-\(\)\[\]{}!#$%^&'`~+=]+)+)/,Oin=new RegExp(`(${Ain.source}|${Nin.source})`),Fin=/((?:\~|\.+)?(?:\/[\w\s\.@\-\(\)\[\]{}!#$%^&'`~+=]+)+)/,Win=/(?::(?:line\s+)?([\d]+))?(?::([\d]+))?/,Vin=new RegExp(`${ei?Oin.source:Fin.source}${Win.source}`,"g"),Bin=/:(?:line\s+)?([\d]+)(?::([\d]+))?$/,Hin=2e3;var Jie=class{constructor(i,e,t,o,n,r,s,l){this.editorService=i;this.fileService=e;this.openerService=t;this.pathService=o;this.tunnelService=n;this.environmentService=r;this.configurationService=s;this.hoverService=l}linkify(i,e,t,o,n,r){return this._linkify(i,e,t,o,n,r)}_linkify(i,e,t,o,n,r,s){if(t){let c=i.split(`
`);for(let h=0;h<c.length-1;h++)c[h]=c[h]+`
`;c[c.length-1]||c.pop();let u=c.map(h=>this._linkify(h,e,!1,o,n,r,s));if(u.length===1)return u[0];let p=document.createElement("span");return u.forEach(h=>p.appendChild(h)),p}let l=document.createElement("span");for(let c of this.detectLinks(i))try{let u;switch(c.kind){case"text":u=s?this.linkifyLocation(c.value,s.locationReference,s.session,e):document.createTextNode(c.value);break;case"web":u=this.createWebLink(n?i:void 0,c.value,e);break;case"path":{let p=c.captures[0],h=c.captures[1]?Number(c.captures[1]):0,g=c.captures[2]?Number(c.captures[2]):0;u=this.createPathLink(n?i:void 0,c.value,p,h,g,o,e);break}default:u=document.createTextNode(c.value)}l.append(...this.applyHighlights(u,c.index,c.value.length,r))}catch{l.appendChild(document.createTextNode(c.value))}return l}applyHighlights(i,e,t,o){let n=[],r=e,s=e+t;for(let l of o||[]){if(l.end<=r||l.start>=s)continue;l.start>r&&(n.push(i.textContent.substring(r-e,l.start-e)),r=l.start);let c=Math.min(l.end,s),u=i.textContent.substring(r-e,c-e),p=document.createElement("span");p.classList.add("highlight"),l.extraClasses&&p.classList.add(...l.extraClasses),p.textContent=u,n.push(p),r=c}return r===e?vt.single(i):(r<s&&n.push(i.textContent.substring(r-e)),Do(i)?(vi(i,...n),vt.single(i)):n)}linkifyLocation(i,e,t,o){let n=this.createLink(i);return this.decorateLink(n,void 0,i,o,async r=>{let s=await t.resolveLocationReference(e);await s.source.openInEditor(this.editorService,{startLineNumber:s.line,startColumn:s.column,endLineNumber:s.endLine??s.line,endColumn:s.endColumn??s.column},r)}),n}makeReferencedLinkDetector(i,e){return{linkify:(t,o,n,r,s,l)=>this._linkify(t,o,n,r,s,l,{locationReference:i,session:e}),linkifyLocation:this.linkifyLocation.bind(this)}}createWebLink(i,e,t){let o=this.createLink(e),n=A.parse(e),r=Bin.exec(n.path);return r&&(n=n.with({path:n.path.slice(0,r.index),fragment:`L${r[0].slice(1)}`})),this.decorateLink(o,n,i,t,async()=>{if(n.scheme===Q.file){let s=n.fsPath,l=await this.pathService.path,c=ch(l.sep===Oo.sep&&ei?s.replace(/\\/g,Oo.sep):s),u=A.parse(c);if(!await this.fileService.exists(u))return;await this.editorService.openEditor({resource:u,options:{pinned:!0,selection:r?{startLineNumber:+r[1],startColumn:r[2]?+r[2]:1}:void 0}});return}this.openerService.open(e,{allowTunneling:!!this.environmentService.remoteAuthority&&this.configurationService.getValue("remote.forwardOnOpen")})}),o}createPathLink(i,e,t,o,n,r,s){if(t[0]==="/"&&t[1]==="/")return document.createTextNode(e);let l=o>0?{selection:{startLineNumber:o,startColumn:n>0?n:1}}:{};if(t[0]==="."){if(!r)return document.createTextNode(e);let p=r.toResource(t),h=this.createLink(e);return this.decorateLink(h,p,i,s,g=>this.editorService.openEditor({resource:p,options:{...l,preserveFocus:g}})),h}if(t[0]==="~"){let p=this.pathService.resolvedUserHome;p&&(t=Yc(p.fsPath,t.substring(1)))}let c=this.createLink(e);c.tabIndex=0;let u=A.file(ch(t));return this.fileService.stat(u).then(p=>{p.isDirectory||this.decorateLink(c,u,i,s,h=>this.editorService.openEditor({resource:u,options:{...l,preserveFocus:h}}))}).catch(()=>{}),c}createLink(i){let e=document.createElement("a");return e.textContent=i,e}decorateLink(i,e,t,o,n){if(o.store.isDisposed)return;i.classList.add("link");let r=e&&this.tunnelService.canTunnel(e)?d(9723,null):d(9724,null),s=i.ariaLabel=t?Ze?d(9722,null,r,t):d(9721,null,r,t):Ze?d(9720,null,r):d(9719,null,r);o.type===0?o.store.add(this.hoverService.setupManagedHover(Ri("element"),i,s)):o.type!==2&&(i.title=s),o.store.add(j(i,"mousemove",l=>{i.classList.toggle("pointer",Ze?l.metaKey:l.ctrlKey)})),o.store.add(j(i,"mouseleave",()=>{i.classList.remove("pointer")})),o.store.add(j(i,"click",l=>{let c=Re(i).getSelection();!c||c.type==="Range"||(Ze?l.metaKey:l.ctrlKey)&&(l.preventDefault(),l.stopImmediatePropagation(),n(!1))})),o.store.add(j(i,"keydown",l=>{let c=new gi(l);(c.keyCode===3||c.keyCode===10)&&(c.preventDefault(),c.stopPropagation(),n(c.keyCode===10))}))}detectLinks(i){if(i.length>Hin)return[{kind:"text",value:i,captures:[],index:0}];let e=[Pin,Vin],t=["web","path"],o=[],n=(r,s,l)=>{if(s>=e.length){o.push({value:r,kind:"text",captures:[],index:l});return}let c=e[s],u=0,p;for(c.lastIndex=0;(p=c.exec(r))!==null;){let g=r.substring(u,p.index);g&&n(g,s+1,l+u);let f=p[0];o.push({value:f,kind:t[s],captures:p.slice(1),index:l+p.index}),u=p.index+f.length}let h=r.substring(u);h&&n(h,s+1,l+u)};return n(i,0,0),o}};Jie=I([m(0,ee),m(1,fe),m(2,Je),m(3,An),m(4,_p),m(5,At),m(6,B),m(7,nt)],Jie);var zin=1024,Kin=/^(true|false)$/i,Gin=/^(['"]).*\1$/;var qin=Object.keys({value:0,unavailable:0,error:0,changed:0,boolean:0,string:0,number:0}),RM=class{constructor(i,e,t,o){this.commandService=i;this.hoverService=o;this.linkDetector=t.createInstance(Jie),this.displayType=hr("debug.showVariableTypes",!1,e)}renderVariable(i,e,t={}){let o=this.displayType.get(),n=Gbo(e,t.highlights||[]);if(e.available){i.type.textContent="";let s=e.name;e.value&&typeof e.name=="string"&&(e.type&&o?(s+=": ",i.type.textContent=e.type+" ="):s+=" ="),i.label.set(s,n.name,e.type&&!o?e.type:e.name),i.name.classList.toggle("virtual",e.presentationHint?.kind==="virtual"),i.name.classList.toggle("internal",e.presentationHint?.visibility==="internal")}else e.value&&typeof e.name=="string"&&e.name&&i.label.set(":");i.expression.classList.toggle("lazy",!!e.presentationHint?.lazy);let r=[{id:dQ,args:[e,[e]]}];return e.evaluateName&&r.push({id:Kie,args:[{variable:e}]}),this.renderValue(i.value,e,{showChanged:t.showChanged,maxValueLength:zin,hover:{commands:r},highlights:n.value,colorize:!0,session:e.getSession()})}renderValue(i,e,t={}){let o=new N,n=t.session?.rememberedCapabilities?.supportsANSIStyling??t.wasANSI??!1,r=typeof e=="string"?e:e.value;for(let p of qin)i.classList.remove(p);i.classList.add("value"),r===null||(e instanceof dd||e instanceof $l||e instanceof mN)&&!e.available?(i.classList.add("unavailable"),r!==dd.DEFAULT_VALUE&&i.classList.add("error")):(typeof e!="string"&&t.showChanged&&e.valueChanged&&r!==dd.DEFAULT_VALUE&&(i.classList.add("changed"),e.valueChanged=!1),t.colorize&&typeof e!="string"&&(e.type==="number"||e.type==="boolean"||e.type==="string"?i.classList.add(e.type):isNaN(+r)?Kin.test(r)?i.classList.add("boolean"):Gin.test(r)&&i.classList.add("string"):i.classList.add("number"))),t.maxValueLength&&r&&r.length>t.maxValueLength&&(r=r.substring(0,t.maxValueLength)+"..."),r||(r="");let s=t.session??(e instanceof lA?e.getSession():void 0),l=t.hover===!1?{type:0,store:o}:{type:2,store:o};Rt(i);let c=t.locationReference??(e instanceof lA&&e.valueLocationReference),u=this.linkDetector;if(c&&s&&(u=this.linkDetector.makeReferencedLinkDetector(c,s)),n?i.appendChild(uLi(r,u,s?s.root:void 0,t.highlights,l)):i.appendChild(u.linkify(r,l,!1,s?.root,!0,t.highlights)),t.hover!==!1){let{commands:p=[]}=t.hover||{};o.add(this.hoverService.setupManagedHover(Ri("mouse"),i,()=>{let h=_("div"),g=_("div.hover-row"),f=M(g,_("div.hover-contents")),v=M(f,_("pre.debug-var-hover-pre"));return n?v.appendChild(uLi(r,this.linkDetector,s?s.root:void 0,t.highlights,l)):v.textContent=r,h.appendChild(g),h},{actions:p.map(({id:h,args:g})=>{let f=$e.getCommand(h)?.metadata?.description;return{label:typeof f=="string"?f:f?f.value:h,commandId:h,run:()=>this.commandService.executeCommand(h,...g)}})}))}return o}};RM=I([m(0,ge),m(1,B),m(2,F),m(3,nt)],RM);var ALi=_,zKt=!0,KKt,aFe=class extends Gs{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super(e,n,t,r,c,l,s,u,p,h);this.debugService=o;this.menuService=g;this.needsRefresh=!1;this.savedViewState=new Map;this.autoExpandedScopes=new Set;this.updateTreeScheduler=this._register(new Dt(async()=>{let f=this.debugService.getViewModel().focusedStackFrame;this.needsRefresh=!1;let v=this.tree.getInput();if(v&&this.savedViewState.set(v.getId(),this.tree.getViewState()),!f){await this.tree.setInput(null);return}let b=this.savedViewState.get(f.getId());await this.tree.setInput(f,b);let y=(await f.getScopes()).find(w=>!w.expensive);y&&this.tree.hasNode(y)&&(this.autoExpandedScopes.add(y.getId()),await this.tree.expand(y))},400))}get treeSelection(){return this.tree.getSelection()}renderBody(e){super.renderBody(e),this.element.classList.add("debug-pane"),e.classList.add("debug-variables");let t=Oie(e),o=this.instantiationService.createInstance(RM);this.tree=this.instantiationService.createInstance(rp,"VariablesView",t,new OLi,[this.instantiationService.createInstance(MM,o),this.instantiationService.createInstance(Qk,o),new qKt,new $Kt],this.instantiationService.createInstance(NLi),{accessibilityProvider:new FLi,identityProvider:{getId:r=>r.getId()},keyboardNavigationLabelProvider:DKt,overrideStyles:this.getLocationBasedColors().listOverrideStyles}),this._register(Qk.rendererOnVisualizationRange(this.debugService.getViewModel(),this.tree)),this.tree.setInput(this.debugService.getViewModel().focusedStackFrame??null),XLt.bindTo(this.tree.contextKeyService),this._register(this.debugService.getViewModel().onDidFocusStackFrame(r=>{if(!this.isBodyVisible()){this.needsRefresh=!0;return}let s=r.explicit?0:void 0;this.updateTreeScheduler.schedule(s)})),this._register(this.debugService.getViewModel().onWillUpdateViews(()=>{let r=this.debugService.getViewModel().focusedStackFrame;r&&zKt&&r.forgetScopes(),zKt=!0,this.tree.updateChildren()})),this._register(this.tree),this._register(this.tree.onMouseDblClick(r=>this.onMouseDblClick(r))),this._register(this.tree.onContextMenu(async r=>await this.onContextMenu(r))),this._register(this.onDidChangeBodyVisibility(r=>{r&&this.needsRefresh&&this.updateTreeScheduler.schedule()}));let n;this._register(this.debugService.getViewModel().onDidSelectExpression(r=>{let s=r?.expression;s&&this.tree.hasNode(s)?(n=this.tree.options.horizontalScrolling,n&&this.tree.updateOptions({horizontalScrolling:!1}),this.tree.rerender(s)):!r&&n!==void 0&&(this.tree.updateOptions({horizontalScrolling:n}),n=void 0)})),this._register(this.debugService.getViewModel().onDidEvaluateLazyExpression(async r=>{r instanceof $l&&this.tree.hasNode(r)&&(await this.tree.updateChildren(r,!1,!0),await this.tree.expand(r))})),this._register(this.debugService.onDidEndSession(()=>{this.savedViewState.clear(),this.autoExpandedScopes.clear()}))}layoutBody(e,t){super.layoutBody(t,e),this.tree.layout(e,t)}focus(){super.focus(),this.tree.domFocus()}collapseAll(){this.tree.collapseAll()}onMouseDblClick(e){this.canSetExpressionValue(e.element)&&this.debugService.getViewModel().setSelectedExpression(e.element,!1)}canSetExpressionValue(e){let t=this.debugService.getViewModel().focusedSession;return t?e instanceof qR?!!e.treeItem.canEdit:!t.capabilities?.supportsSetVariable&&!t.capabilities?.supportsSetExpression?!1:e instanceof $l&&!e.presentationHint?.attributes?.includes("readOnly")&&!e.presentationHint?.lazy:!1}async onContextMenu(e){let t=e.element;if(t instanceof qK)return this.openContextMenuForScope(e,t);if(!(!(t instanceof $l)||!t.value))return WLi(this.contextKeyService,this.menuService,this.contextMenuService,D.DebugVariablesContext,e)}openContextMenuForScope(e,t){let o={scope:{name:t.name}},n=this.menuService.getMenuActions(D.DebugScopesContext,this.contextKeyService,{arg:o,shouldForwardArgs:!1}),{secondary:r}=zp(n,"inline");this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>r})}};aFe=I([m(1,Xe),m(2,Ni),m(3,_e),m(4,B),m(5,F),m(6,Bi),m(7,X),m(8,Je),m(9,Le),m(10,nt),m(11,Kt)],aFe);async function WLi(a,i,e,t,o){let n=o.element;if(!(n instanceof $l)||!n.value)return;let r=await $in(a,n),s=VLi(n),l=i.getMenuActions(t,r,{arg:s,shouldForwardArgs:!1}),{secondary:c}=zp(l,"inline");e.showContextMenu({getAnchor:()=>o.anchor,getActions:()=>c})}var VLi=a=>({sessionId:a.getSession()?.getId(),container:a.parent instanceof dd?{expression:a.parent.name}:a.parent.toDebugProtocolObject(),variable:a.toDebugProtocolObject()});async function $in(a,i){let e=i.getSession();if(!e||!e.capabilities.supportsDataBreakpoints)return GKt(a,i);let t=[],o=await e.dataBreakpointInfo(i.name,i.parent.reference),n=o?.dataId,r=o?.accessTypes;if(UKt(o),!r)t.push([UK.key,!!n]);else for(let s of r)switch(s){case"read":t.push([cJ.key,!!n]);break;case"write":t.push([UK.key,!!n]);break;case"readWrite":t.push([lJ.key,!!n]);break}return GKt(a,i,t)}function GKt(a,i,e=[]){return KKt=i,hRt(a,i,e)}function SSo(a){return a instanceof pT}var NLi=class extends HG{hasChildren(i){return i?SSo(i)?!0:i.hasChildren:!1}doGetChildren(i){return SSo(i)?i.getScopes():i.getChildren()}},OLi=class{getHeight(i){return 22}getTemplateId(i){return i instanceof C9e?$Kt.ID:i instanceof qK?qKt.ID:i instanceof qR?Qk.ID:MM.ID}},qKt=class a{static{this.ID="scope"}get templateId(){return a.ID}renderTemplate(i){let e=M(i,ALi(".scope")),t=new Ya(e);return{name:e,label:t}}renderElement(i,e,t){t.label.set(i.element.name,xa(i.filterData))}disposeTemplate(i){i.label.dispose()}},$Kt=class a{static{this.ID="scopeError"}get templateId(){return a.ID}renderTemplate(i){let e=M(i,ALi(".scope"));return{error:M(e,ALi(".error"))}}renderElement(i,e,t){t.error.innerText=i.element.name}disposeTemplate(){}},Qk=class extends iU{constructor(e,t,o,n,r,s){super(t,o,n);this.expressionRenderer=e;this.menuService=r;this.contextKeyService=s}static{this.ID="viz"}static rendererOnVisualizationRange(e,t){return e.onDidChangeVisualization(({original:o})=>{if(!t.hasNode(o))return;let n=t.getParentElement(o);t.updateChildren(n,!1,!1)})}get templateId(){return Qk.ID}renderElement(e,t,o){o.elementDisposable.clear(),super.renderExpressionElement(e.element,e,o)}renderExpression(e,t,o){let n=e,r=n.name;n.value&&typeof n.name=="string"&&(r+=":"),t.label.set(r,o,n.name),t.elementDisposable.add(this.expressionRenderer.renderValue(t.value,n,{showChanged:!1,maxValueLength:1024,colorize:!0,session:e.getSession()}))}getInputBoxOptions(e){let t=e;return{initialValue:e.value,ariaLabel:d(9822,null),validationOptions:{validation:()=>t.errorMessage?{content:t.errorMessage}:null},onFinish:(o,n)=>{t.errorMessage=void 0,n&&t.edit(o).then(()=>{zKt=!1,this.debugService.getViewModel().updateViews()})}}}renderActionBar(e,t,o){let n=t,r=n.original?GKt(this.contextKeyService,n.original):this.contextKeyService,s=n.original?VLi(n.original):void 0,l=this.menuService.getMenuActions(D.DebugVariablesContext,r,{arg:s,shouldForwardArgs:!1}),{primary:c}=zp(l,"inline");if(n.original){let u=ii({id:"debugViz",label:d(9817,null),class:q.asClassName(R.eye),run:()=>this.debugService.getViewModel().setVisualizedExpression(n.original,void 0)});u.checked=!0,c.push(u),e.domNode.style.display="initial"}e.clear(),e.context=s,e.push(c,{icon:!0,label:!1})}};Qk=I([m(1,Ni),m(2,Wn),m(3,nt),m(4,Kt),m(5,X)],Qk);var MM=class extends iU{constructor(e,t,o,n,r,s,l,c){super(s,l,c);this.expressionRenderer=e;this.menuService=t;this.contextKeyService=o;this.visualization=n;this.contextMenuService=r}static{this.ID="variable"}get templateId(){return MM.ID}renderExpression(e,t,o){t.elementDisposable.add(this.expressionRenderer.renderVariable(t,e,{highlights:o,showChanged:!0}))}renderElement(e,t,o){o.elementDisposable.clear(),super.renderExpressionElement(e.element,e,o)}getInputBoxOptions(e){let t=e;return{initialValue:e.value,ariaLabel:d(9822,null),validationOptions:{validation:()=>t.errorMessage?{content:t.errorMessage}:null},onFinish:(o,n)=>{t.errorMessage=void 0;let r=this.debugService.getViewModel().focusedStackFrame;n&&t.value!==o&&r&&t.setVariable(o,r).then(()=>{zKt=!1,this.debugService.getViewModel().updateViews()})}}}renderActionBar(e,t,o){let n=t,r=GKt(this.contextKeyService,n),s=VLi(n),l=this.menuService.getMenuActions(D.DebugVariablesContext,r,{arg:s,shouldForwardArgs:!1}),{primary:c}=zp(l,"inline");e.clear(),e.context=s,e.push(c,{icon:!0,label:!1});let u=new Ye;o.elementDisposable.add(Z(()=>u.dispose(!0))),this.visualization.getApplicableFor(t,u.token).then(p=>{o.elementDisposable.add(p);let h=t instanceof qR&&t.original||t,g=p.object.map(f=>ii({id:"debugViz",label:f.name,class:f.iconClass||"debug-viz-icon",run:this.useVisualizer(f,h,u.token)}));g.length===0||(g.length===1?e.push(g[0],{icon:!0,label:!1}):e.push(ii({id:"debugViz",label:d(9818,null),class:q.asClassName(R.eye),run:()=>this.pickVisualizer(g,h,o)}),{icon:!0,label:!1}))})}pickVisualizer(e,t,o){this.contextMenuService.showContextMenu({getAnchor:()=>o.actionBar.getContainer(),getActions:()=>e})}useVisualizer(e,t,o){return async()=>{let n=await e.resolve(o);if(!o.isCancellationRequested)if(n.type===0)e.execute();else{let r=await this.visualization.getVisualizedNodeFor(n.id,t);r&&this.debugService.getViewModel().setVisualizedExpression(t,r)}}}};MM=I([m(1,Kt),m(2,X),m(3,hJ),m(4,Xe),m(5,Ni),m(6,Wn),m(7,nt)],MM);var FLi=class{getWidgetAriaLabel(){return d(9820,null)}getAriaLabel(i){return i instanceof qK?d(9821,null,i.name):i instanceof $l?d(9819,null,i.name,i.value):null}},BLi="debug.setVariable";$e.registerCommand({id:BLi,handler:a=>{a.get(Ni).getViewModel().setSelectedExpression(KKt,!1)}});$e.registerCommand({metadata:{description:snt},id:dQ,handler:async(a,i,e)=>{let t=a.get(Ni),o=a.get(Fi),n="",r;if(i)i instanceof $l||i instanceof dd?(n="watch",r=[i]):(n="variables",r=KKt?[KKt]:[]);else{let p=a.get($t),h=p.getFocusedView(),g;if(h?.id===Ik?(g=p.getActiveViewWithId(Ik),n="watch"):h?.id===VK&&(g=p.getActiveViewWithId(VK),n="variables"),!g)return;r=g.treeSelection.filter(f=>f instanceof dd||f instanceof $l)}let s=t.getViewModel().focusedStackFrame,l=t.getViewModel().focusedSession;if(!s||!l||r.length===0)return;let c=l.capabilities.supportsClipboardContext?"clipboard":n,u=r.map(p=>p instanceof $l?p.evaluateName||p.value:p.name);try{let p=await Promise.all(u.map(g=>l.evaluate(g,s.frameId,c))),h=di(p).map(g=>g.body.result);h.length&&o.writeText(h.join(`
`))}catch{let h=r.map(g=>g.value);o.writeText(h.join(`
`))}}});var dnt="workbench.debug.viewlet.action.viewMemory",ISo="ms-vscode.hexeditor",jin="hexEditor.hexedit";$e.registerCommand({id:dnt,handler:async(a,i,e)=>{let t=a.get(Ni),o,n;if("sessionId"in i){if(!i.sessionId||!i.variable.memoryReference)return;o=i.sessionId,n=i.variable.memoryReference}else{if(!i.memoryReference)return;let h=t.getViewModel().focusedSession;if(!h)return;o=h.getId(),n=i.memoryReference}let r=a.get(Hi),s=a.get(ee),l=a.get(Ne),c=a.get(lt),u=a.get(Te);(await c.getExtension(ISo)||await Qin(r,l))&&(u.publicLog("debug/didViewMemory",{debugType:t.getModel().getSession(o)?.configuration.type}),await s.openEditor({resource:Kto(o,n),options:{revealIfOpened:!0,override:jin}},In))}});async function Qin(a,i){try{return await a.install(ISo,{justification:d(9823,null),enable:!0},15),!0}catch(e){return i.error(e),!1}}$e.registerCommand({metadata:{description:sFe},id:Kie,handler:async(a,i)=>{let e=a.get(Fi);i instanceof $l?await e.writeText(i.evaluateName):await e.writeText(i.variable.evaluateName)}});$e.registerCommand({metadata:{description:ant},id:ent,handler:async(a,i)=>{a.get(Ni).addWatchExpression(i.variable.evaluateName)}});W(class extends Yn{constructor(){super({id:"variables.collapse",viewId:VK,title:d(9816,null),f1:!1,icon:R.collapseAll,menu:{id:D.ViewTitle,group:"navigation",when:C.equals("view",VK)}})}runInView(a,i){i.collapseAll()}});var lFe=_;async function ySo(a,i){if(!a)return null;let t=(await a.getChildren()).filter(o=>i[0]===o.name);return t.length!==1?null:i.length===1?t[0]:ySo(t[0],i.slice(1))}async function Yin(a,i){let t=(await a.getScopes()).filter(n=>!n.expensive),o=di(await Promise.all(t.map(n=>ySo(n,i))));return o.length>0&&o.every(n=>n.value===o[0].value)?o[0]:void 0}var nU=class{constructor(i,e,t,o,n,r){this.editor=i;this.debugService=e;this.instantiationService=t;this.menuService=o;this.contextKeyService=n;this.contextMenuService=r;this.allowEditorOverflow=!0;this.isUpdatingTree=!1;this.highlightDecorations=this.editor.createDecorationsCollection(),this.toDispose=[],this.showAtPosition=null,this.positionPreference=[1,2],this.debugHoverComputer=this.instantiationService.createInstance(unt,this.editor),this.expressionRenderer=this.instantiationService.createInstance(RM)}static{this.ID="debug.hoverWidget"}get isShowingComplexValue(){return this.complexValueContainer?.hidden===!1}create(){this.domNode=lFe(".debug-hover-widget"),this.complexValueContainer=M(this.domNode,lFe(".complex-value")),this.complexValueTitle=M(this.complexValueContainer,lFe(".title")),this.treeContainer=M(this.complexValueContainer,lFe(".debug-hover-tree")),this.treeContainer.setAttribute("role","tree");let i=M(this.complexValueContainer,lFe(".tip"));i.textContent=d(9580,null,Ze?"Option":"Alt");let e=this.instantiationService.createInstance(ULi);this.tree=this.instantiationService.createInstance(rp,"DebugHover",this.treeContainer,new zLi,[this.instantiationService.createInstance(MM,this.expressionRenderer),this.instantiationService.createInstance(Qk,this.expressionRenderer)],e,{accessibilityProvider:new HLi,mouseSupport:!1,horizontalScrolling:!0,useShadows:!1,keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:t=>t.name},overrideStyles:{listBackground:wO}}),this.toDispose.push(Qk.rendererOnVisualizationRange(this.debugService.getViewModel(),this.tree)),this.toDispose.push(this.tree),this.valueContainer=lFe(".value"),this.valueContainer.tabIndex=0,this.valueContainer.setAttribute("role","tooltip"),this.scrollbar=new ms(this.valueContainer,{horizontal:2}),this.domNode.appendChild(this.scrollbar.getDomNode()),this.toDispose.push(this.scrollbar),this.editor.applyFontInfo(this.domNode),this.domNode.style.backgroundColor=kt(wO),this.domNode.style.border=`1px solid ${kt(G1)}`,this.domNode.style.color=kt(_7),this.toDispose.push(this.tree.onContextMenu(async t=>await this.onContextMenu(t))),this.toDispose.push(this.tree.onDidChangeContentHeight(()=>{this.isUpdatingTree||this.layoutTreeAndContainer()})),this.toDispose.push(this.tree.onDidChangeContentWidth(()=>{this.isUpdatingTree||this.layoutTreeAndContainer()})),this.registerListeners(),this.editor.addContentWidget(this)}async onContextMenu(i){let e=i.element;if(!(!(e instanceof $l)||!e.value))return WLi(this.contextKeyService,this.menuService,this.contextMenuService,D.DebugHoverContext,i)}registerListeners(){this.toDispose.push(Jo(this.domNode,"keydown",i=>{i.equals(9)&&this.hide()})),this.toDispose.push(this.editor.onDidChangeConfiguration(i=>{i.hasChanged(59)&&this.editor.applyFontInfo(this.domNode)})),this.toDispose.push(this.debugService.getViewModel().onDidEvaluateLazyExpression(async i=>{i instanceof $l&&this.tree.hasNode(i)&&(await this.tree.updateChildren(i,!1,!0),await this.tree.expand(i))}))}isHovered(){return!!this.domNode?.matches(":hover")}isVisible(){return!!this._isVisible}willBeVisible(){return!!this.showCancellationSource}getId(){return nU.ID}getDomNode(){return this.domNode}isInSafeTriangle(i,e){return this._isVisible&&!!this.safeTriangle?.contains(i,e)}async showAt(i,e,t){this.showCancellationSource?.dispose(!0);let o=this.showCancellationSource=new Ye,n=this.debugService.getViewModel().focusedSession;if(!n||!this.editor.hasModel())return this.hide(),1;let r=await this.debugHoverComputer.compute(i,o.token);if(o.token.isCancellationRequested)return this.hide(),2;if(!r.range)return this.hide(),1;if(this.isVisible()&&!r.rangeChanged)return 0;let s=await this.debugHoverComputer.evaluate(n);return o.token.isCancellationRequested?(this.hide(),2):!s||s instanceof dd&&!s.available?(this.hide(),1):(this.highlightDecorations.set([{range:r.range,options:nU._HOVER_HIGHLIGHT_DECORATION_OPTIONS}]),this.doShow(n,r.range.getStartPosition(),s,e,t))}static{this._HOVER_HIGHLIGHT_DECORATION_OPTIONS=mo.register({description:"bdebug-hover-highlight",className:"hoverHighlight"})}async doShow(i,e,t,o,n){this.domNode||this.create(),this.showAtPosition=e;let r=new N;if(this._isVisible={store:r},!t.hasChildren){this.complexValueContainer.hidden=!0,this.valueContainer.hidden=!1,r.add(this.expressionRenderer.renderValue(this.valueContainer,t,{showChanged:!1,colorize:!0,hover:!1,session:i})),this.valueContainer.title="",this.editor.layoutContentWidget(this),this.safeTriangle=n&&new O$e(n.posx,n.posy,this.domNode),this.scrollbar.scanDomNode(),o&&(this.editor.render(),this.valueContainer.focus());return}this.valueContainer.hidden=!0,this.expressionToRender=t,r.add(this.expressionRenderer.renderValue(this.complexValueTitle,t,{hover:!1,session:i})),this.editor.layoutContentWidget(this),this.safeTriangle=n&&new O$e(n.posx,n.posy,this.domNode),this.tree.scrollTop=0,this.tree.scrollLeft=0,this.complexValueContainer.hidden=!1,o&&(this.editor.render(),this.tree.domFocus())}layoutTreeAndContainer(){this.layoutTree(),this.editor.layoutContentWidget(this)}layoutTree(){let e=1/0;if(this.showAtPosition){let r=this.editor.getDomNode()?.offsetTop||0,s=this.treeContainer.offsetTop+r,l=this.editor.getTopForLineNumber(this.showAtPosition.lineNumber,!0)-this.editor.getScrollTop();s<l&&(e=l+r-22)}let t=Math.min(Math.max(266,this.editor.getLayoutInfo().height*.55),this.tree.contentHeight+10,e),o=this.tree.contentWidth,n=Bn(o,400,550);this.tree.layout(t,n),this.treeContainer.style.height=`${t}px`,this.scrollbar.scanDomNode()}beforeRender(){if(this.expressionToRender){let i=this.expressionToRender;this.expressionToRender=void 0,this.isUpdatingTree=!0,this.tree.setInput(i).finally(()=>{this.isUpdatingTree=!1})}return null}afterRender(i){i&&(this.positionPreference=[i])}hide(){this.showCancellationSource&&(this.showCancellationSource.dispose(!0),this.showCancellationSource=void 0),this._isVisible&&(Gr(this.domNode)&&this.editor.focus(),this._isVisible.store.dispose(),this._isVisible=void 0,this.highlightDecorations.clear(),this.editor.layoutContentWidget(this),this.positionPreference=[1,2])}getPosition(){return this._isVisible?{position:this.showAtPosition,preference:this.positionPreference}:null}dispose(){this.toDispose=Be(this.toDispose)}};nU=I([m(1,Ni),m(2,F),m(3,Kt),m(4,X),m(5,Xe)],nU);var HLi=class{getWidgetAriaLabel(){return d(9581,null)}getAriaLabel(i){return d(9582,null,i.name,i.value)}},ULi=class extends HG{hasChildren(i){return i.hasChildren}doGetChildren(i){return i.getChildren()}},zLi=class{getHeight(i){return 18}getTemplateId(i){return i instanceof qR?Qk.ID:MM.ID}},unt=class{constructor(i,e,t,o){this.editor=i;this.debugService=e;this.languageFeaturesService=t;this.logService=o}async compute(i,e){if(!this.debugService.getViewModel().focusedSession||!this.editor.hasModel())return{rangeChanged:!1};let o=this.editor.getModel(),n=await pRt(this.languageFeaturesService,o,i,e);if(!n)return{rangeChanged:!1};let{range:r,matchingExpression:s}=n,l=!this._current?.range.equalsRange(r);return this._current={expression:s,range:z.lift(r)},{rangeChanged:l,range:this._current.range}}async evaluate(i){if(!this._current){this.logService.error("No expression to evaluate");return}let e=this.editor.getModel(),t=e&&i.getSourceForUri(e?.uri);if(i.capabilities.supportsEvaluateForHovers){let o=new dd(this._current.expression);return await o.evaluate(i,this.debugService.getViewModel().focusedStackFrame,"hover",void 0,t?{line:this._current.range.startLineNumber,column:this._current.range.startColumn,source:t.raw}:void 0),o}else{let o=this.debugService.getViewModel().focusedStackFrame;if(o)return await Yin(o,di(this._current.expression.split(".").map(n=>n.trim())))}}};unt=I([m(1,Ni),m(2,Qt),m(3,se)],unt);var pnt=_,Xin=te("debugExceptionWidget.border","#a31515",d(9716,null)),Jin=te("debugExceptionWidget.background",{dark:"#420b0d",light:"#f1dfde",hcDark:"#420b0d",hcLight:"#f1dfde"},d(9715,null)),Zie=class extends ZO{constructor(e,t,o,n,r,s){super(e,{showFrame:!0,showArrow:!0,isAccessible:!0,frameWidth:1,className:"exception-widget-container"});this.exceptionInfo=t;this.debugSession=o;this.shouldScroll=n;this.instantiationService=s;this.applyTheme(r.getColorTheme()),this._disposables.add(r.onDidColorThemeChange(this.applyTheme.bind(this))),this.create();let l=new Dt(()=>this._doLayout(void 0,void 0),50);this._disposables.add(this.editor.onDidLayoutChange(()=>l.schedule())),this._disposables.add(l)}applyTheme(e){this.backgroundColor=e.getColor(Jin);let t=e.getColor(Xin);this.style({arrowColor:t,frameColor:t})}_applyStyles(){this.container&&(this.container.style.backgroundColor=this.backgroundColor?this.backgroundColor.toString():""),super._applyStyles()}_fillContainer(e){this.setCssClass("exception-widget");let t=this.editor.getOption(59);e.style.fontSize=`${t.fontSize}px`,e.style.lineHeight=`${t.lineHeight}px`,e.tabIndex=0;let o=pnt(".title"),n=pnt(".label");M(o,n);let r=pnt(".actions");M(o,r),n.textContent=this.exceptionInfo.id?d(9718,null,this.exceptionInfo.id):d(9717,null);let s=n.textContent;if(this._disposables.add(new Zi(r)).push(new it("editor.closeExceptionWidget",d(9714,null),q.asClassName(PE),!0,async()=>{this.editor.getContribution(RB)?.closeExceptionWidget()}),{label:!1,icon:!0}),M(e,o),this.exceptionInfo.description){let c=pnt(".description");c.textContent=this.exceptionInfo.description,s+=", "+this.exceptionInfo.description,M(e,c)}if(this.exceptionInfo.details&&this.exceptionInfo.details.stackTrace){let c=pnt(".stack-trace"),u=this.instantiationService.createInstance(Jie),p={store:this._disposables,type:0},h=u.linkify(this.exceptionInfo.details.stackTrace,p,!0,this.debugSession?this.debugSession.root:void 0,void 0);c.appendChild(h),M(e,c),s+=", "+this.exceptionInfo.details.stackTrace}e.setAttribute("aria-label",s)}_doLayout(e,t){this.container.style.height="initial";let o=this.editor.getOption(75),n=Math.round(o/3),r=Math.ceil((this.container.offsetHeight+n)/o);this._relayout(r)}revealRange(e,t){this.shouldScroll()&&super.revealRange(e,t)}focus(){this.container?.focus()}hasFocus(){return this.container?Gr(this.container):!1}getWhitespaceHeight(){if(!this._viewZone||!this._viewZone.id)return 0;let t=this.editor.getWhitespaces().find(o=>o.id===this._viewZone.id);return t?t.height:0}};Zie=I([m(4,Le),m(5,F)],Zie);var Zin=100,eon=150,ton=500,wSo=200,grm=te("editor.inlineValuesForeground",{dark:"#ffffff80",light:"#00000080",hcDark:"#ffffff80",hcLight:"#00000080"},d(9579,null)),frm=te("editor.inlineValuesBackground","#ffc80033",d(9578,null)),KLi=class{constructor(i,e){this.column=i;this.text=e}};function ion(a){if(a.includes(",")&&a.includes("=")){let t=(o=>{let n=[],r=0,s=0;for(let u=0;u<o.length;u++)if(o[u]==="="){if(r===0){r++;continue}let p=o.lastIndexOf(",",u);p!==-1&&p>=s&&(n.push(p),s=p+1),r++}let l=[],c=0;for(let u of n)l.push(o.substring(c,u).trim()),c=u+1;return c<o.length&&l.push(o.substring(c).trim()),l})(a).map(o=>{let n=o.indexOf("=");if(n!==-1){let r=" ".repeat(n+2),[s,...l]=o.split(/\r?\n/);return[s,...l.map(c=>r+c)].join(`
`)}return o});return new Ie().appendCodeblock("",t.join(`,
`))}return new Ie().appendCodeblock("",a)}function Nge(a,i,e,t=1073741824,o=eon){let n=i;return i.length>o&&(i=i.substring(0,o)+"..."),[{range:{startLineNumber:a,endLineNumber:a,startColumn:t,endColumn:t},options:{description:`${e}-inline-value-decoration-spacer`,after:{content:eO,cursorStops:3},showIfCollapsed:!0}},{range:{startLineNumber:a,endLineNumber:a,startColumn:t,endColumn:t},options:{description:`${e}-inline-value-decoration`,after:{content:oon(i),inlineClassName:`${e}-inline-value`,inlineClassNameAffectsLetterSpacing:!0,cursorStops:3},showIfCollapsed:!0,hoverMessage:ion(n)}}]}function oon(a){return a.replace(/[ \t\n]/g,eO)}function non(a,i,e,t){let o=new Map;for(let r of a)if(o.set(r.name,r.value),o.size>=Zin)break;let n=new Map;return o.forEach((r,s)=>{let l=t.get(s);if(l)for(let c of l)i.some(u=>c>=u.startLineNumber&&c<=u.endLineNumber)&&(n.has(c)||n.set(c,[]),n.get(c).indexOf(s)===-1&&n.get(c).push(s))}),[...n].map(([r,s])=>({line:r,variables:s.sort((l,c)=>{let u=e.getLineContent(r);return u.indexOf(l)-u.indexOf(c)}).map(l=>({name:l,value:o.get(l)}))}))}function ron(a,i,e){if(a.getLineLength(i)>ton)return;let o=a.getLineContent(i);a.tokenization.forceTokenization(i);let n=a.tokenization.getLineTokens(i);for(let r=0,s=n.getCount();r<s;r++)if(n.getStandardTokenType(r)===0){r7.lastIndex=0;let c=n.getStartOffset(r),u=n.getEndOffset(r),p=o.substring(c,u),h=r7.exec(p);if(h){let g=h[0];e.has(g)||e.set(g,[]),e.get(g).push(i)}}}var pQ=class{constructor(i,e,t,o,n,r,s,l,c,u,p){this.editor=i;this.debugService=e;this.instantiationService=t;this.commandService=o;this.configurationService=n;this.hostService=r;this.uriIdentityService=s;this.languageFeaturesService=c;this.editorService=p;this.mouseDown=!1;this.gutterIsHovered=!1;this.altListener=new me;this.altPressed=!1;this.displayedStore=new N;this.allowScrollToExceptionWidget=!0;this.shouldScrollToExceptionWidget=()=>this.allowScrollToExceptionWidget;this.defaultHoverLockout=new me;this.oldDecorations=this.editor.createDecorationsCollection(),this.debounceInfo=u.for(c.inlineValuesProvider,"InlineValues",{min:wSo}),this.hoverWidget=this.instantiationService.createInstance(nU,this.editor),this.toDispose=[this.defaultHoverLockout,this.altListener,this.displayedStore],this.registerListeners(),this.exceptionWidgetVisible=rRt.bindTo(l),this.toggleExceptionWidget()}registerListeners(){this.toDispose.push(this.debugService.getViewModel().onDidFocusStackFrame(i=>this.onFocusStackFrame(i.stackFrame))),this.toDispose.push(this.editor.onMouseDown(i=>this.onEditorMouseDown(i))),this.toDispose.push(this.editor.onMouseUp(()=>this.mouseDown=!1)),this.toDispose.push(this.editor.onMouseMove(i=>this.onEditorMouseMove(i))),this.toDispose.push(this.editor.onMouseLeave(i=>{let e=this.hoverWidget.getDomNode();if(!e)return;let t=e.getBoundingClientRect();(i.event.posx<t.left||i.event.posx>t.right||i.event.posy<t.top||i.event.posy>t.bottom)&&this.hideHoverWidget()})),this.toDispose.push(this.editor.onKeyDown(i=>this.onKeyDown(i))),this.toDispose.push(this.editor.onDidChangeModelContent(()=>{this._wordToLineNumbersMap=void 0,this.updateInlineValuesScheduler.schedule()})),this.toDispose.push(this.debugService.getViewModel().onWillUpdateViews(()=>this.updateInlineValuesScheduler.schedule())),this.toDispose.push(this.debugService.getViewModel().onDidEvaluateLazyExpression(()=>this.updateInlineValuesScheduler.schedule())),this.toDispose.push(this.editor.onDidChangeModel(async()=>{this.addDocumentListeners(),this.toggleExceptionWidget(),this.hideHoverWidget(),this._wordToLineNumbersMap=void 0;let i=this.debugService.getViewModel().focusedStackFrame;await this.updateInlineValueDecorations(i)})),this.toDispose.push(this.editor.onDidScrollChange(()=>{this.hideHoverWidget();let i=this.editor.getModel();i&&this.languageFeaturesService.inlineValuesProvider.has(i)&&this.updateInlineValuesScheduler.schedule()})),this.toDispose.push(this.configurationService.onDidChangeConfiguration(i=>{i.affectsConfiguration("editor.hover")&&this.updateHoverConfiguration()})),this.toDispose.push(this.debugService.onDidChangeState(i=>{i!==2&&this.toggleExceptionWidget()})),this.updateHoverConfiguration()}updateHoverConfiguration(){let i=this.editor.getModel();i&&(this.editorHoverOptions=this.configurationService.getValue("editor.hover",{resource:i.uri,overrideIdentifier:i.getLanguageId()}))}addDocumentListeners(){let i=this.debugService.getViewModel().focusedStackFrame,e=this.editor.getModel();e&&this.applyDocumentListeners(e,i)}applyDocumentListeners(i,e){if(!e||!this.uriIdentityService.extUri.isEqual(i.uri,e.source.uri)){this.altListener.clear();return}let t=this.editor.getContainerDomNode().ownerDocument;this.altListener.value=j(t,"keydown",o=>{if(new gi(o).keyCode===6){this.altPressed=!0;let r=this.hoverWidget.isVisible();this.hoverWidget.hide(),this.defaultHoverLockout.clear(),r&&this.hoverPosition&&this.showEditorHover(this.hoverPosition.position,!1);let s=new Gn(t,"keyup"),l=U.any(this.hostService.onDidChangeFocus,s.event)(c=>{let u;xg(c)&&(u=new gi(c)),(!u||u.keyCode===6)&&(this.altPressed=!1,this.preventDefaultEditorHover(),l.dispose(),s.dispose())})}})}async showHover(i,e,t){this.preventDefaultEditorHover();let o=this.debugService.getViewModel().focusedStackFrame,n=this.editor.getModel();o&&n&&this.uriIdentityService.extUri.isEqual(o.source.uri,n.uri)?await this.hoverWidget.showAt(i,e,t)===1&&this.showEditorHover(i,e):this.showEditorHover(i,e)}preventDefaultEditorHover(){if(this.defaultHoverLockout.value||this.editorHoverOptions?.enabled==="off")return;this.editor.getContribution(Pl.ID)?.hideContentHover(),this.editor.updateOptions({hover:{enabled:"off"}}),this.defaultHoverLockout.value={dispose:()=>{this.editor.updateOptions({hover:{enabled:this.editorHoverOptions?.enabled??"on"}})}}}showEditorHover(i,e){let t=this.editor.getContribution(Pl.ID),o=new z(i.lineNumber,i.column,i.lineNumber,i.column);this.defaultHoverLockout.clear(),t?.showContentHover(o,1,0,e)}async onFocusStackFrame(i){let e=this.editor.getModel();e&&(this.applyDocumentListeners(e,i),i&&this.uriIdentityService.extUri.isEqual(i.source.uri,e.uri)?await this.toggleExceptionWidget():this.hideHoverWidget()),await this.updateInlineValueDecorations(i)}get hoverDelay(){let i=this.editorHoverOptions?.delay||0,e=Bn(2-(i-300)/600,1,2);return i*e}get showHoverScheduler(){let i=new Dt(()=>{this.hoverPosition&&!this.altPressed&&this.showHover(this.hoverPosition.position,!1,this.hoverPosition.event)},this.hoverDelay);return this.toDispose.push(i),i}hideHoverWidget(){this.hoverWidget.willBeVisible()&&this.hoverWidget.hide(),this.showHoverScheduler.cancel(),this.defaultHoverLockout.clear()}onEditorMouseDown(i){this.mouseDown=!0,!(i.target.type===9&&i.target.detail===nU.ID)&&this.hideHoverWidget()}onEditorMouseMove(i){if(this.debugService.state!==2)return;let e=i.target,t=Ze?"metaKey":"ctrlKey";this.altPressed||(e.type===2?(this.defaultHoverLockout.clear(),this.gutterIsHovered=!0):this.gutterIsHovered&&(this.gutterIsHovered=!1,this.updateHoverConfiguration())),!((e.type===9&&e.detail===nU.ID||this.hoverWidget.isInSafeTriangle(i.event.posx,i.event.posy))&&((this.editorHoverOptions?.sticky??!0)||this.hoverWidget.isShowingComplexValue||i.event[t]))&&(e.type===6?e.position&&!ye.equals(e.position,this.hoverPosition?.position||null)&&!this.hoverWidget.isInSafeTriangle(i.event.posx,i.event.posy)&&(this.hoverPosition={position:e.position,event:i.event},this.preventDefaultEditorHover(),this.showHoverScheduler.schedule(this.hoverDelay)):this.mouseDown||this.hideHoverWidget())}onKeyDown(i){let e=Ze?57:5;i.keyCode!==e&&i.keyCode!==6&&this.hideHoverWidget()}async toggleExceptionWidget(){let i=this.editor.getModel(),e=this.debugService.getViewModel().focusedStackFrame,t=e?e.thread.getCallStack():null;if(!i||!e||!t||t.length===0){this.closeExceptionWidget();return}let o=t.find(r=>!!(r&&r.source&&r.source.available&&r.source.presentationHint!=="deemphasize"));if(!o||o!==e){this.closeExceptionWidget();return}let n=this.uriIdentityService.extUri.isEqual(o.source.uri,i.uri);if(this.exceptionWidget&&!n)this.closeExceptionWidget();else if(n){let s=this.editorService.activeTextEditorControl===this.editor,l=await e.thread.exceptionInfo;l&&(s?this.showExceptionWidget(l,this.debugService.getViewModel().focusedSession,o.range.startLineNumber,o.range.startColumn):this.showExceptionWidgetWithoutScroll(l,this.debugService.getViewModel().focusedSession,o.range.startLineNumber,o.range.startColumn))}}showExceptionWidget(i,e,t,o){this.exceptionWidget&&this.exceptionWidget.dispose(),this.exceptionWidget=this.instantiationService.createInstance(Zie,this.editor,i,e,this.shouldScrollToExceptionWidget),this.exceptionWidget.show({lineNumber:t,column:o},0),this.exceptionWidget.focus(),this.editor.revealRangeInCenter({startLineNumber:t,startColumn:o,endLineNumber:t,endColumn:o}),this.exceptionWidgetVisible.set(!0)}showExceptionWidgetWithoutScroll(i,e,t,o){this.exceptionWidget&&this.exceptionWidget.dispose(),this.allowScrollToExceptionWidget=!1;let n=this.editor.getScrollTop(),r=this.editor.getVisibleRanges();if(r.length===0){this.exceptionWidget=this.instantiationService.createInstance(Zie,this.editor,i,e,this.shouldScrollToExceptionWidget),this.exceptionWidget.show({lineNumber:t,column:o},0),this.exceptionWidgetVisible.set(!0),this.allowScrollToExceptionWidget=!0;return}let s=r[0].startLineNumber;if(this.exceptionWidget=this.instantiationService.createInstance(Zie,this.editor,i,e,this.shouldScrollToExceptionWidget),this.exceptionWidget.show({lineNumber:t,column:o},0),this.exceptionWidgetVisible.set(!0),t<s){let l=this.exceptionWidget.getWhitespaceHeight();this.editor.setScrollTop(n+l,1)}this.allowScrollToExceptionWidget=!0}closeExceptionWidget(){if(this.exceptionWidget){let i=this.exceptionWidget.hasFocus();this.exceptionWidget.dispose(),this.exceptionWidget=void 0,this.exceptionWidgetVisible.set(!1),i&&this.editor.focus()}}async addLaunchConfiguration(){let i=this.editor.getModel();if(!i)return;let e,t,o=()=>{let r=0;uk(i.getValue(),{onObjectProperty:s=>{t=s},onArrayBegin:s=>{t==="configurations"&&r===0&&(e=i.getPositionAt(s+1)),r++},onArrayEnd:()=>{r--}})};if(o(),!e){let{tabSize:r,insertSpaces:s}=i.getOptions(),l=i.getEOL(),c=jo(i.uri.fsPath)==="launch.json"?Mb(i.getValue(),["configurations"],[],{tabSize:r,insertSpaces:s,eol:l})[0]:Mb(i.getValue(),["launch"],{configurations:[]},{tabSize:r,insertSpaces:s,eol:l})[0],u=i.getPositionAt(c.offset),p=u.lineNumber,h=new z(p,u.column,p,i.getLineMaxColumn(p));i.pushEditOperations(null,[Hn.replace(h,c.content)],()=>null),o()}if(!e)return;this.editor.focus(),await(r=>(i.getLineLastNonWhitespaceColumn(r.lineNumber)>r.column&&(this.editor.setPosition(r),this.instantiationService.invokeFunction(s=>{zL.LineBreakInsert.runEditorCommand(s,this.editor,null)})),this.editor.setPosition(r),this.commandService.executeCommand(Jce.ID)))(e),await this.commandService.executeCommand("editor.action.triggerSuggest")}get removeInlineValuesScheduler(){return new Dt(()=>{this.displayedStore.clear(),this.oldDecorations.clear()},100)}get updateInlineValuesScheduler(){let i=this.editor.getModel();return new Dt(async()=>await this.updateInlineValueDecorations(this.debugService.getViewModel().focusedStackFrame),i?this.debounceInfo.get(i):wSo)}async updateInlineValueDecorations(i){let e="{0} = {1}",o=this.editor.getModel(),n=this.configurationService.getValue("debug").inlineValues;if(!(n===!0||n==="on"||n==="auto"&&o&&this.languageFeaturesService.inlineValuesProvider.has(o))||!o||!i||o.uri.toString()!==i.source.uri.toString()){this.removeInlineValuesScheduler.isScheduled()||this.removeInlineValuesScheduler.schedule();return}this.removeInlineValuesScheduler.cancel(),this.displayedStore.clear();let s=this.editor.getVisibleRangesPlusViewportAboveBelow(),l,c=new Ye;if(this.displayedStore.add(Z(()=>c.dispose(!0))),this.languageFeaturesService.inlineValuesProvider.has(o)){let p=async(S,y)=>{let w=await i.getMostSpecificScopes(i.range),k=y?S:S.toLowerCase();for(let T of w){let O=(await T.getChildren()).find(V=>y?V.name===k:V.name.toLowerCase()===k);if(O)return O.value}},h={frameId:i.frameId,stoppedLocation:new z(i.range.startLineNumber,i.range.startColumn+1,i.range.endLineNumber,i.range.endColumn+1)},g=this.languageFeaturesService.inlineValuesProvider.ordered(o).reverse();l=[];let f=new Map,v=g.flatMap(S=>s.map(y=>Promise.resolve(S.provideInlineValues(o,y,h,c.token)).then(async w=>{if(w)for(let k of w){let T;switch(k.type){case"text":T=k.text;break;case"variable":{let P=k.variableName;P||(P=o.getLineContent(k.range.startLineNumber).substring(k.range.startColumn-1,k.range.endColumn-1));let O=await p(P,k.caseSensitiveLookup);O&&(T=vd(e,P,O));break}case"expression":{let P=k.expression;if(P||(P=o.getLineContent(k.range.startLineNumber).substring(k.range.startColumn-1,k.range.endColumn-1)),P){let O=new dd(P);await O.evaluate(i.thread.session,i,"watch",!0),O.available&&(T=vd(e,P,O.value))}break}}if(T){let P=k.range.startLineNumber,O=f.get(P);O||(O=[],f.set(P,O)),O.some(V=>V.text===T)||O.push(new KLi(k.range.startColumn,T))}}},w=>{ys(w)}))),b=Date.now();await Promise.all(v),this.updateInlineValuesScheduler.delay=this.debounceInfo.update(o,Date.now()-b),f.forEach((S,y)=>{if(S.length>0){S=S.sort((O,V)=>O.column-V.column);let w=S.map(O=>O.text).join(", "),k=this.editor.getLayoutInfo().width,T=this.editor.getOption(59),P=Math.floor((k-50)/T.typicalHalfwidthCharacterWidth);l.push(...Nge(y,w,"debug",void 0,P))}})}else{let p=await i.getMostSpecificScopes(i.range),h=await Promise.all(p.map(async f=>({scope:f,variables:await f.getChildren()}))),g=new Map;for(let{scope:f,variables:v}of h){let b=new z(0,0,i.range.startLineNumber,i.range.startColumn);f.range&&(b=b.setStartPosition(f.range.startLineNumber,f.range.startColumn));let S=s.map(w=>w.intersectRanges(b)).filter(lo);this._wordToLineNumbersMap??=new GLi(o);for(let w of S)this._wordToLineNumbersMap.ensureRangePopulated(w);let y=non(v,S,o,this._wordToLineNumbersMap.value);for(let{line:w,variables:k}of y){let T=g.get(w);T||(T=new Map,g.set(w,T));for(let{name:P,value:O}of k)T.has(P)||T.set(P,O)}}l=[...g.entries()].flatMap(([f,v])=>{let b=[...v].map(([k,T])=>`${k} = ${T}`).join(", "),S=this.editor.getLayoutInfo().width,y=this.editor.getOption(59),w=Math.floor((S-50)/y.typicalHalfwidthCharacterWidth);return Nge(f,b,"debug",void 0,w)})}if(c.token.isCancellationRequested)return;let u;if(this.editor.getOption(149)!=="off"){let p=this.editor.getPosition();p&&this.editor.getVisibleRanges().some(h=>h.containsPosition(p))&&(u={position:p,top:this.editor.getTopForPosition(p.lineNumber,p.column)})}if(this.oldDecorations.set(l),u){let p=this.editor.getTopForPosition(u.position.lineNumber,u.position.column);this.editor.setScrollTop(this.editor.getScrollTop()-(u.top-p),1)}}dispose(){this.hoverWidget?.dispose(),this.configurationWidget?.dispose(),this.exceptionWidget?.dispose(),this.toDispose=Be(this.toDispose)}};I([hi],pQ.prototype,"showHoverScheduler",1),I([hi],pQ.prototype,"removeInlineValuesScheduler",1),I([hi],pQ.prototype,"updateInlineValuesScheduler",1),pQ=I([m(1,Ni),m(2,F),m(3,ge),m(4,B),m(5,Zt),m(6,ht),m(7,X),m(8,Qt),m(9,hf),m(10,ee)],pQ);var GLi=class{constructor(i){this.model=i;this.value=new Map;this.intervals=new Uint8Array(Math.ceil(i.getLineCount()/8))}ensureRangePopulated(i){for(let e=i.startLineNumber;e<=i.endLineNumber;e++){let t=e>>3,o=1<<(e&7);this.intervals[t]&o||(ron(this.model,e,this.value),this.intervals[t]|=o)}}};$e.registerCommand("_executeInlineValueProvider",async(a,i,e,t)=>{if(wo(A.isUri(i)),wo(z.isIRange(e)),!t||typeof t.frameId!="number"||!z.isIRange(t.stoppedLocation))throw Yr("context");let o=a.get(Tt).getModel(i);if(!o)throw Yr("uri");let n=z.lift(e),{inlineValuesProvider:r}=a.get(Qt),s=r.ordered(o);return(await Promise.all(s.map(c=>c.provideInlineValues(o,n,t,Se.None)))).flat().filter(lo)});var jKt=class{constructor(i,e){this.column=i;this.text=e}},kW=class extends x{constructor(e,t,o,n,r,s){super();this.notebookEditor=e;this.notebookKernelService=t;this.notebookExecutionStateService=o;this.languageFeaturesService=n;this.configurationService=r;this.debugService=s;this.cellDecorationIds=new Map;this.cellContentListeners=new gt;this.currentCancellationTokenSources=new gt;this._register(this.notebookExecutionStateService.onDidChangeExecution(async l=>{this.configurationService.getValue(yt.notebookInlineValues)!=="off"&&l.type===0&&await this.updateInlineVariables(l)})),this._register(U.runAndSubscribe(this.configurationService.onDidChangeConfiguration,l=>{(!l||l.affectsConfiguration(yt.notebookInlineValues))&&this.configurationService.getValue(yt.notebookInlineValues)==="off"&&this.clearNotebookInlineDecorations()}))}static{this.id="notebook.inlineVariablesController"}static{this.MAX_CELL_LINES=5e3}async updateInlineVariables(e){if(e.changed)return;let t=this.notebookEditor.getCellByHandle(e.cellHandle);if(!t)return;let o=this.currentCancellationTokenSources.get(t.uri);o&&o.cancel(),this.currentCancellationTokenSources.set(t.uri,new Ye);let n=this.currentCancellationTokenSources.get(t.uri).token;if(this.debugService.state!==0){this._clearNotebookInlineDecorations();return}if(!this.notebookEditor.textModel?.uri||!Qe(this.notebookEditor.textModel.uri,e.notebook))return;let r=await t.resolveTextModel();if(!r)return;let s=this.configurationService.getValue(yt.notebookInlineValues),l=this.languageFeaturesService.inlineValuesProvider.has(r);if(s==="off"||s==="auto"&&!l)return;this.clearCellInlineDecorations(t);let c=[];if(l){let u=r.getLineCount(),p=r.getLineMaxColumn(u),h={frameId:0,stoppedLocation:new z(u,p,u,p)},g=this.languageFeaturesService.inlineValuesProvider.ordered(r).reverse(),f=new Map,v=new z(1,1,u,p),b=g.flatMap(S=>Promise.resolve(S.provideInlineValues(r,v,h,n)).then(async y=>{if(!y)return;let w=this.notebookEditor.textModel;if(!w)return;let k=this.notebookKernelService.getMatchingKernel(w),T=[];if(y.some(P=>P.type==="variable")){if(!this.notebookEditor.hasModel())return;let P=k.selected?.provideVariables(e.notebook,void 0,"named",0,n);if(P)for await(let O of P)T.push(O)}for(let P of y){let O;switch(P.type){case"text":O=P.text;break;case"variable":{let V=P.variableName;if(!V)continue;let H=T.find(G=>G.name===V)?.value;if(!H)continue;O=vd("{0} = {1}",V,H);break}case"expression":continue}if(O){let V=P.range.startLineNumber,H=f.get(V);H||(H=[],f.set(V,H)),H.some(G=>G.text===O)||H.push(new jKt(P.range.startColumn,O))}}},y=>{ys(y)}));await Promise.all(b),f.forEach((S,y)=>{if(S.length>0){S.sort((P,O)=>P.column-O.column);let w=S.map(P=>P.text).join(", "),k=t.layoutInfo.editorWidth,T=t.layoutInfo.fontInfo;if(T&&t.textModel){let P=Math.floor((k-50)/T.typicalHalfwidthCharacterWidth),O=t.textModel.getLineLength(y),V=Math.max(0,P-O);c.push(...Nge(y,w,"nb",void 0,V))}else c.push(...Nge(y,w,"nb"))}})}else if(s==="on"){if(!this.notebookEditor.hasModel())return;let p=this.notebookKernelService.getMatchingKernel(this.notebookEditor.textModel)?.selected?.provideVariables(e.notebook,void 0,"named",0,n);if(!p)return;let h=[];for await(let k of p)h.push(k);let g=h.map(k=>k.name),f=t.textModel;if(!f||f.getLineCount()>kW.MAX_CELL_LINES)return;let v=new Set,b=this.getFunctionRanges(f),S=this.getCommentedRanges(f),y=[...b,...S],w=new Map;for(let k of g){if(v.has(k))continue;let T=new RegExp(`\\b${k}\\b(?!\\w)`,"g"),P=null,O=!1,V=f.getValue().split(`
`);for(let H=V.length-1;H>=0;H--){let G=V[H],$;for(;($=T.exec(G))!==null;){let J=$.index,ae=new ye(H+1,J+1);if(!this.isPositionInRanges(ae,y)){P={line:H+1,column:J+1},O=!0;break}}if(O)break}if(P){let H=k+" = "+h.find($=>$.name===k)?.value,G=w.get(P.line);G||(G=[],w.set(P.line,G)),G.some($=>$.text===H)||G.push(new jKt(P.column,H))}v.add(k)}w.forEach((k,T)=>{if(k.length>0){k.sort((H,G)=>H.column-G.column);let P=k.map(H=>H.text).join(", "),O=t.layoutInfo.editorWidth,V=t.layoutInfo.fontInfo;if(V&&t.textModel){let H=Math.floor((O-50)/V.typicalHalfwidthCharacterWidth),G=t.textModel.getLineLength(T),$=Math.max(0,H-G);c.push(...Nge(T,P,"nb",void 0,$))}else c.push(...Nge(T,P,"nb"))}})}c.length>0&&(this.updateCellInlineDecorations(t,c),this.initCellContentListener(t))}getFunctionRanges(e){return e.getLanguageId()==="python"?this.getPythonFunctionRanges(e.getValue()):this.getBracedFunctionRanges(e.getValue())}getPythonFunctionRanges(e){let t=[],o=e.split(`
`),n=-1,r=!1,s=-1,l=/^(\s*)(async\s+)?(?:def\s+\w+|class\s+\w+)\s*\([^)]*\)\s*:/;for(let c=0;c<o.length;c++){let u=o[c],p=u.match(l);if(p){r&&p[1].length<=s&&(t.push(new z(n+1,1,c,u.length+1)),r=!1),r||(r=!0,n=c,s=p[1].length);continue}if(r){if(u.trim()==="")continue;(u.match(/^\s*/)?.[0].length??0)<=s&&(t.push(new z(n+1,1,c,u.length+1)),r=!1,s=-1)}}return r&&t.push(new z(n+1,1,o.length,o[o.length-1].length+1)),t}getBracedFunctionRanges(e){let t=[],o=e.split(`
`),n=0,r=-1,s=!1,l=/\b(?:function\s+\w+|(?:async\s+)?(?:\w+\s*=\s*)?\([^)]*\)\s*=>|class\s+\w+|(?:public|private|protected|static)?\s*\w+\s*\([^)]*\)\s*{)/;for(let c=0;c<o.length;c++){let u=o[c];for(let p of u)p==="{"?(!s&&l.test(u)&&(s=!0,r=c),n++):p==="}"&&(n--,n===0&&s&&(t.push(new z(r+1,1,c+1,u.length+1)),s=!1))}return t}getCommentedRanges(e){return this._getCommentedRanges(e)}_getCommentedRanges(e){try{return this.getCommentedRangesByAccurateTokenization(e)}catch{return this.getCommentedRangesByManualParsing(e)}}getCommentedRangesByAccurateTokenization(e){let t=[],o=e.getLineCount();if(o>kW.MAX_CELL_LINES)return t;for(let n=1;n<=o;n++){e.tokenization.hasAccurateTokensForLine(n)||e.tokenization.forceTokenization(n);let r=e.tokenization.getLineTokens(n);if(r.getCount()===0)continue;let s;for(let l=0;l<r.getCount();l++){let c=r.getStandardTokenType(l);if(c===1||c===2||c===3){s===void 0&&(s=r.getStartOffset(l));let u=r.getEndOffset(l),p=l===r.getCount()-1,h=!p&&r.getStandardTokenType(l+1)!==c;(p||h)&&(t.push(new z(n,s+1,n,u+1)),s=void 0)}else s=void 0}}return t}getCommentedRangesByManualParsing(e){let t=[],o=e.getValue().split(`
`),n=e.getLanguageId(),r=n==="python"?"#":n==="javascript"||n==="typescript"?"//":null,s=n==="javascript"||n==="typescript"?{start:"/*",end:"*/"}:null,l=!1,c=-1,u=-1;for(let p=0;p<o.length;p++){let h=o[p];if(h.trim().length!==0){if(s){if(!l){let f=h.indexOf(s.start);f!==-1&&(l=!0,c=p,u=f)}if(l){let f=h.indexOf(s.end);f!==-1&&(t.push(new z(c+1,u+1,p+1,f+s.end.length+1)),l=!1);continue}}if(!l&&r&&h.trimLeft().startsWith(r)){let f=h.indexOf(r);t.push(new z(p+1,f+1,p+1,h.length+1))}}}return l&&t.push(new z(c+1,u+1,o.length,o[o.length-1].length+1)),t}isPositionInRanges(e,t){return t.some(o=>o.containsPosition(e))}updateCellInlineDecorations(e,t){let o=this.cellDecorationIds.get(e)??[];this.cellDecorationIds.set(e,e.deltaModelDecorations(o,t))}initCellContentListener(e){let t=e.textModel;t&&this.cellContentListeners.set(e.uri,t.onDidChangeContent(()=>{this.clearCellInlineDecorations(e)}))}clearCellInlineDecorations(e){let t=this.cellDecorationIds.get(e)??[];t&&(e.deltaModelDecorations(t,[]),this.cellDecorationIds.delete(e));let o=this.cellContentListeners.get(e.uri);o&&(o.dispose(),this.cellContentListeners.delete(e.uri))}_clearNotebookInlineDecorations(){this.cellDecorationIds.forEach((e,t)=>{this.clearCellInlineDecorations(t)})}clearNotebookInlineDecorations(){this._clearNotebookInlineDecorations()}dispose(){super.dispose(),this._clearNotebookInlineDecorations(),this.currentCancellationTokenSources.forEach(e=>e.cancel()),this.currentCancellationTokenSources.clear(),this.cellContentListeners.forEach(e=>e.dispose()),this.cellContentListeners.clear()}};kW=I([m(1,Ol),m(2,bs),m(3,Qt),m(4,B),m(5,Ni)],kW);bm(kW.id,kW);W(class extends mp{constructor(){super({id:"notebook.clearAllInlineValues",title:d(12393,null)})}runWithContext(i,e){return e.notebookEditor.getContribution(kW.id).clearNotebookInlineDecorations(),Promise.resolve()}});var son="notebook.clearAllCellsOutputs",aon="notebook.cell.edit",lon="notebook.cell.delete",CSo="notebook.quitEditAllCells",con="notebook.cell.clearOutputs",qLi="notebook.selectIndentation",don="notebook.commentSelectedCells";W(class extends Pd{constructor(){super({id:aon,title:d(12467,null),keybinding:{when:C.and(pp,C.not(np),pe.hoverFocused.toNegated(),ote.toNegated()),primary:3,weight:200},menu:{id:D.NotebookCellTitle,when:C.and(Xl.isEqualTo(!0),NS.isEqualTo("markup"),nte.toNegated(),jw),order:1,group:Y0},icon:xmo})}async runWithContext(i,e){if(!e.notebookEditor.hasModel())return;await e.notebookEditor.focusNotebookCell(e.cell,"editor");let t=e.cell?ste(e,e.cell):void 0;t&&t.hasTextFocus()&&Nd.get(t)?.getWidgetPosition()?.lineNumber===t.getPosition()?.lineNumber&&Nd.get(t)?.focus()}});var xSo=C.and(pr,ig,_G.toNegated());W(class extends Pd{constructor(){super({id:Zmi,title:d(12468,null),menu:{id:D.NotebookCellTitle,when:C.and(NS.isEqualTo("markup"),nte,jw),order:4,group:Y0},icon:kmo,keybinding:[{when:C.and(xSo,pe.hoverVisible.toNegated(),pe.hasNonEmptySelection.toNegated(),pe.hasMultipleSelections.toNegated()),primary:9,weight:Df-5},{when:C.and(pr,bM),primary:9,weight:205},{when:C.and(xSo,NS.isEqualTo("markup")),primary:259,win:{primary:2563},weight:Df-5}]})}async runWithContext(i,e){e.cell.cellKind===1&&e.cell.updateEditState(0,Zmi),await e.notebookEditor.focusNotebookCell(e.cell,"container",{skipReveal:!0})}});W(class extends mp{constructor(){super({id:CSo,title:d(12469,null)})}async runWithContext(i,e){if(!e.notebookEditor.hasModel())return;let t=e.notebookEditor.getViewModel();if(!t)return;let o=e.notebookEditor.getActiveCell();t.viewCells.filter(r=>r.cellKind===1&&r.getEditState()===1).forEach(r=>{r.updateEditState(0,CSo)}),o&&await e.notebookEditor.focusNotebookCell(o,"container",{skipReveal:!0})}});W(class extends Pd{constructor(){super({id:lon,title:d(12466,null),keybinding:{primary:20,mac:{primary:2049},when:C.and(pr,C.not(np),ote.toNegated()),weight:200},menu:[{id:D.NotebookCellDelete,when:Xl,group:Y0},{id:D.InteractiveCellDelete,group:Y0}],icon:wmo})}async runWithContext(i,e){if(!e.notebookEditor.hasModel())return;let t,n=i.get(bs).getCellExecution(e.cell.uri)?.state,r=i.get(B);if(n===3&&r.getValue(yt.confirmDeleteRunningCell)){let s=i.get(at),l=d(12455,null);t=await s.confirm({type:"question",message:d(12456,null),primaryButton:l,checkbox:{label:d(12458,null)}})}else t={confirmed:!0};t.confirmed&&(t.checkboxChecked===!0&&await r.updateValue(yt.confirmDeleteRunningCell,!1),lgo(e.notebookEditor,e.cell))}});W(class extends Pd{constructor(){super({id:con,title:d(12453,null),menu:[{id:D.NotebookCellTitle,when:C.and(NS.isEqualTo("code"),lEi,Bk,Xl,jw,htt.toNegated()),order:6,group:vmo},{id:D.NotebookOutputToolbar,when:C.and(Bk,Xl,jw,oUt,htt)}],keybinding:{when:C.and(pr,C.not(np),Bk,Xl,jw),primary:532,weight:200},icon:dEi})}async runWithContext(i,e){let t=i.get(bs),o=e.notebookEditor;if(!o.hasModel()||!o.textModel.length)return;let n=e.cell,r=o.textModel.cells.indexOf(n.model);if(r<0)return;let s=!o.isReadOnly;o.textModel.applyEdits([{editType:2,index:r,outputs:[]}],!0,void 0,()=>{},void 0,s),t.getCellExecution(e.cell.uri)?.state!==3&&e.notebookEditor.textModel.applyEdits([{editType:9,index:r,internalMetadata:{runStartTime:null,runStartTimeAdjustment:null,runEndTime:null,executionOrder:null,lastRunSuccess:null}}],!0,void 0,()=>{},void 0,s)}});W(class extends mp{constructor(){super({id:son,title:d(12452,null),precondition:sUt,menu:[{id:D.EditorTitle,when:C.and(Za,C.notEquals("config.notebook.globalToolbar",!0)),group:"navigation",order:0},{id:D.NotebookToolbar,when:C.and(lEi,C.equals("config.notebook.globalToolbar",!0)),group:"navigation/execute",order:10}],icon:dEi})}async runWithContext(i,e){let t=i.get(bs),o=e.notebookEditor;if(!o.hasModel()||!o.textModel.length)return;let n=!o.isReadOnly;o.textModel.applyEdits(o.textModel.cells.map((l,c)=>({editType:2,index:c,outputs:[]})),!0,void 0,()=>{},void 0,n);let r=o.textModel.cells.map((l,c)=>{if(t.getCellExecution(l.uri)?.state!==3)return{editType:9,index:c,internalMetadata:{runStartTime:null,runStartTimeAdjustment:null,runEndTime:null,executionOrder:null,lastRunSuccess:null}}}).filter(l=>!!l);r.length&&e.notebookEditor.textModel.applyEdits(r,!0,void 0,()=>{},void 0,n),o.getContribution(kW.id).clearNotebookInlineDecorations()}});W(class extends Pd{constructor(){super({id:wDt,title:d(12451,null),keybinding:{weight:200,primary:Vi(2089,43),when:C.and(pr,Xl,jw)},metadata:{description:d(12451,null),args:[{name:"range",description:"The cell range",schema:{type:"object",required:["start","end"],properties:{start:{type:"number"},end:{type:"number"}}}},{name:"language",description:"The target cell language",schema:{type:"string"}}]}})}getCellContextFromArgs(i,e,...t){if(!e||typeof e.start!="number"||typeof e.end!="number"||e.start>=e.end)return;let o=t.length&&typeof t[0]=="string"?t[0]:void 0,n=this.getEditorContextFromArgsOrActive(i);if(!(!n||!n.notebookEditor.hasModel()||e.start>=n.notebookEditor.getLength()))return{notebookEditor:n.notebookEditor,cell:n.notebookEditor.cellAt(e.start),language:o}}async runWithContext(i,e){e.language?await this.setLanguage(e,e.language):await this.showLanguagePicker(i,e)}async showLanguagePicker(i,e){let t=[],o=[],n=i.get(_t),r=i.get(Tt),s=i.get(Ue),l=i.get(vS),c=i.get(Ol),u=e.notebookEditor.activeKernel?.supportedLanguages;if(!u){let S=c.getMatchingKernel(e.notebookEditor.textModel).all.flatMap(y=>y.supportedLanguages);u=S.length>0?S:n.getRegisteredLanguageIds()}new Set([...u,"markdown"]).forEach(b=>{let S;(e.cell.cellKind===1?b==="markdown":b===e.cell.language)?S=d(12461,null,b):S=d(12462,null,b);let y=n.getLanguageName(b);if(!y)return;let w={label:y,iconClasses:aa(r,n,this.getFakeResource(y,n)),description:S,languageId:b};b==="markdown"||b===e.cell.language?t.push(w):o.push(w)}),o.sort((b,S)=>b.description.localeCompare(S.description));let h={label:d(12450,null)},g=[h,{type:"separator",label:d(12463,null)},...t,{type:"separator"},...o],f=await s.pick(g,{placeHolder:d(12472,null)}),v=f===h?await l.detectLanguage(e.cell.uri):f?.languageId;v&&await this.setLanguage(e,v)}async setLanguage(i,e){await kSo(e,i)}getFakeResource(i,e){let t,o=e.getLanguageIdByLanguageName(i);if(o){let n=e.getExtensions(o);if(n.length)t=A.file(n[0]);else{let r=e.getFilenames(o);r.length&&(t=A.file(r[0]))}}return t}});W(class extends Pd{constructor(){super({id:y6e,title:L(12457,"Accept Detected Language for Cell"),f1:!0,precondition:C.and(Xl,jw),keybinding:{primary:1570,weight:200}})}async runWithContext(i,e){let t=i.get(vS),o=i.get(Ne),s=[...i.get(Ol).getSelectedOrSuggestedKernel(e.notebookEditor.textModel)?.supportedLanguages??[]];s.push("markdown");let l=await t.detectLanguage(e.cell.uri,s);l?kSo(l,e):o.warn(d(12464,null))}});async function kSo(a,i){if(a==="markdown"&&i.cell?.language!=="markdown"){let e=i.notebookEditor.getCellIndex(i.cell);await NAe(1,{cell:i.cell,notebookEditor:i.notebookEditor,ui:!0},"markdown",tr.markdown);let t=i.notebookEditor.cellAt(e);t&&await i.notebookEditor.focusNotebookCell(t,"editor")}else if(a!=="markdown"&&i.cell?.cellKind===1)await NAe(2,{cell:i.cell,notebookEditor:i.notebookEditor,ui:!0},a);else{let e=i.notebookEditor.textModel.cells.indexOf(i.cell.model);i.notebookEditor.textModel.applyEdits([{editType:4,index:e,language:a}],!0,void 0,()=>{},void 0,!i.notebookEditor.isReadOnly)}}W(class extends mp{constructor(){super({id:qLi,title:L(12473,"Select Indentation"),f1:!0,precondition:C.and(Za,Xl,jw)})}async runWithContext(i,e){await this.showNotebookIndentationPicker(i,e)}async showNotebookIndentationPicker(i,e){let t=i.get(Ue),o=i.get(ee),n=i.get(F),r=Jn(o.activeEditorPane);if(!r||r.isDisposed)return t.pick([{label:d(12465,null)}]);if(r.isReadOnly)return t.pick([{label:d(12470,null)}]);let s=[new Kot,new Got,new qot,new jot,new $ot].map(c=>({id:c.desc.id,label:c.desc.title.toString(),run:()=>{n.invokeFunction(c.run)}}));s.splice(3,0,{type:"separator",label:d(12459,null)}),s.unshift({type:"separator",label:d(12460,null)});let l=await t.pick(s,{placeHolder:d(12471,null),matchOnDetail:!0});l&&(l.run(),e.notebookEditor.focus())}});W(class extends Hg{constructor(){super({id:don,title:d(12454,null),keybinding:{when:C.and(pr,Xl,C.not(np)),primary:2138,weight:200}})}async runWithContext(i,e){let t=i.get(Rs);e.selectedCells.forEach(async o=>{let n=await o.resolveTextModel(),r=o.commentOptions,s=new jxe(t,new ti(1,1,n.getLineCount(),n.getLineMaxColumn(n.getLineCount())),n.getOptions().tabSize,0,r.insertSpace??!0,r.ignoreEmptyLines??!0,!1),l=o.getSelections(),c=l.map(p=>n._setTrackedRange(null,p,1));oY.executeCommands(n,l,[s]);let u=c.map(p=>n._getTrackedRange(p)).filter(p=>!!p).map(p=>new ti(p.startLineNumber,p.startColumn,p.endLineNumber,p.endColumn));o.setSelections(u??[])})}});$e.registerCommand("_resolveNotebookContentProvider",a=>a.get(bn).getContributedNotebookTypes().map(t=>{let o=t.selectors.map(n=>typeof n=="string"||qP(n)?n:QTt(n)?{include:n.include,exclude:n.exclude}:null).filter(n=>n!==null);return{viewType:t.id,displayName:t.displayName,filenamePattern:o,options:{transientCellMetadata:t.options.transientCellMetadata,transientDocumentMetadata:t.options.transientDocumentMetadata,transientOutputs:t.options.transientOutputs}}}));$e.registerCommand("_resolveNotebookKernels",async(a,i)=>{let e=a.get(Ol),t=A.revive(i.uri);return e.getMatchingKernel({uri:t,notebookType:i.viewType}).all.map(n=>({id:n.id,label:n.label,description:n.description,detail:n.detail,isPreferred:!1,preloads:n.preloadUris}))});function mQ(a){return a.replace(/[-\\^\]]/g,"\\$&")}function PM(a,i,e,t=!1){let o=Wx(i.column,e,a.getLineContent(i.lineNumber),0);if(!o&&a.getWordUntilPosition(i).word||!o&&i.column>1&&a.getValueInRange(new z(i.lineNumber,i.column-1,i.lineNumber,i.column))!==" "||o&&t&&a.getWordUntilPosition({lineNumber:i.lineNumber,column:o.startColumn}).word)return;let n,r;return o?(n=new z(i.lineNumber,o.startColumn,i.lineNumber,i.column),r=new z(i.lineNumber,o.startColumn,i.lineNumber,o.endColumn)):n=r=z.fromPositions(i),{insert:n,replace:r,varWord:o}}function eoe(a,i){let e=new z(1,1,i.replace.startLineNumber,i.replace.startColumn);return!!a.getValueInRange(e).match(/^\s*$/)}var Oge=new Y("notebookChatAgentRegistered",!1,d(12445,null));async function ESo(a,i,e,t,o,n){let r=a.get(B),s=a.get(ge);if(r.getValue(yt.cellGenerate)||r.getValue(yt.cellChat)){let l=i.notebookEditor.getActiveCell(),c=l?.getTextLength()===0&&n!=="insertToolbar"?l:await ITi(a,i,2,"below",!0);if(c){c.enableAutoLanguageDetection(),await i.notebookEditor.revealFirstLineIfOutsideViewport(c);let u=i.notebookEditor.codeEditors.find(p=>p[0]===c)?.[1];u&&(u.focus(),s.executeCommand("inlineChat.start"))}}}W(class extends mp{constructor(){super({id:"notebook.cell.chat.start",title:{value:"$(sparkle) "+d(12437,null),original:"$(sparkle) Generate"},tooltip:d(12438,null),metadata:{description:d(12438,null),args:[{name:"args",schema:{type:"object",required:["index"],properties:{index:{type:"number"},input:{type:"string"},autoSend:{type:"boolean"}}}}]},f1:!1,keybinding:{when:C.and(pr,Xl.isEqualTo(!0),C.not(np),Oge,C.or(C.equals(`config.${yt.cellChat}`,!0),C.equals(`config.${yt.cellGenerate}`,!0))),weight:200,primary:2087,secondary:[Vi(2089,39)]},menu:[{id:D.NotebookCellBetween,group:"inline",order:-1,when:C.and(Xl.isEqualTo(!0),Oge,C.or(C.equals(`config.${yt.cellChat}`,!0),C.equals(`config.${yt.cellGenerate}`,!0)))}]})}getEditorContextFromArgsOrActive(a,...i){let[e]=i;if(!e){let n=SPe(a);if(!n)return;let r=n.getActiveCell();return r?{cell:r,notebookEditor:n,input:void 0,autoSend:void 0}:void 0}if(typeof e!="object"||typeof e.index!="number")return;let t=SPe(a);return t?{cell:e.index<=0?void 0:t.cellAt(e.index-1),notebookEditor:t,input:e.input,autoSend:e.autoSend}:void 0}async runWithContext(a,i){let e=Math.max(0,i.cell?i.notebookEditor.getCellIndex(i.cell)+1:0);await ESo(a,i,e,i.input,i.autoSend,i.source)}});W(class extends mp{constructor(){super({id:"notebook.cell.chat.startAtTop",title:{value:"$(sparkle) "+d(12437,null),original:"$(sparkle) Generate"},tooltip:d(12438,null),f1:!1,menu:[{id:D.NotebookCellListTop,group:"inline",order:-1,when:C.and(Xl.isEqualTo(!0),Oge,C.or(C.equals(`config.${yt.cellChat}`,!0),C.equals(`config.${yt.cellGenerate}`,!0)))}]})}async runWithContext(a,i){await ESo(a,i,0,"",!1)}});ve.appendMenuItem(D.NotebookToolbar,{command:{id:"notebook.cell.chat.start",icon:R.sparkle,title:d(12435,null),tooltip:d(12436,null)},order:-10,group:"navigation/add",when:C.and(Xl.isEqualTo(!0),C.notEquals("config.notebook.insertToolbarLocation","betweenCells"),C.notEquals("config.notebook.insertToolbarLocation","hidden"),Oge,C.or(C.equals(`config.${yt.cellChat}`,!0),C.equals(`config.${yt.cellGenerate}`,!0)))});var $Li=class extends pl{constructor(){super({id:"notebook.inlineChat.acceptChangesAndRun",title:L(12432,"Accept and Run"),shortTitle:d(12433,null),tooltip:d(12434,null),icon:R.check,f1:!0,precondition:C.and(Xl.isEqualTo(!0),nW),keybinding:void 0,menu:[{id:Ate,group:"0_main",order:2,when:C.and(Xl.isEqualTo(!0),ie.inputHasText.toNegated(),OAe.toNegated(),pgo.isEqualTo("messagesAndEdits"))}]})}runEditorCommand(i,e){let t=ehe(i.get(ee)),o=Nd.get(e);if(!t||!o)return;let r=t.notebookEditor.codeEditors.find(s=>s[1]===e)?.[0];if(r)return o.acceptSession(),t.notebookEditor.executeNotebookCells(vt.single(r))}};W($Li);var QKt="kernelVariable",cFe=class extends x{constructor(e,t,o,n,r,s,l){super();this.editorService=o;this.chatWidgetService=n;this.notebookKernelService=r;this.languageFeaturesService=s;this._register(l.registerChatContextItem(new mnt(this.editorService,this.notebookKernelService))),this._ctxHasProvider=Oge.bindTo(e);let c=()=>{let u=!!t.getDefaultAgent("notebook");this._ctxHasProvider.set(u)};c(),this._register(t.onDidChangeAgents(c)),this._register(this.languageFeaturesService.completionProvider.register({scheme:Q.vscodeChatInput,hasAccessToAllModels:!0},{_debugDisplayName:"chatKernelDynamicCompletions",triggerCharacters:[Tu],provideCompletionItems:async(u,p,h,g)=>{let f=this.chatWidgetService.getWidgetByInputUri(u.uri);if(!f||!f.supportsFileReferences||f.location!=="notebook")return null;let v=new RegExp(`${Tu}\\w*`,"g"),b=PM(u,p,v,!0);if(!b)return null;let S={suggestions:[]},y=new z(p.lineNumber,b.replace.startColumn,p.lineNumber,b.replace.startColumn+`${Tu}${QKt}:`.length);return S.suggestions.push({label:`${Tu}${QKt}`,insertText:`${Tu}${QKt}:`,detail:d(12443,null),range:b,kind:18,command:{id:Fge.ID,title:Fge.ID,arguments:[{widget:f,range:y}]},sortText:"z"}),await this.addKernelVariableCompletion(f,S,b,g),S}})),aEi.bindTo(e).set(xit)}static{this.ID="workbench.contrib.notebookChatContribution"}async addKernelVariableCompletion(e,t,o,n){let r;o.varWord?.word&&o.varWord.word.startsWith(Tu)&&(r=o.varWord.word.toLowerCase().slice(1));let s=Jn(this.editorService.activeEditorPane)?.getViewModel()?.notebookDocument;if(!s)return;let l=this.notebookKernelService.getMatchingKernel(s).selected;if(!l?.hasVariableProvider)return;let u=l.provideVariables(s.uri,void 0,"named",0,Se.None);for await(let p of u)r&&!p.name.toLowerCase().includes(r)||t.suggestions.push({label:{label:p.name,description:p.type},insertText:`${Tu}${QKt}:${p.name} `,filterText:`${Tu}${p.name}`,range:o,kind:4,sortText:"z",command:{id:Fge.ID,title:Fge.ID,arguments:[{widget:e,range:o.insert,variable:p.name}]},detail:p.type,documentation:p.value})}};cFe=I([m(0,X),m(1,cr),m(2,ee),m(3,Pt),m(4,Ol),m(5,Qt),m(6,DS)],cFe);var Fge=class a extends K{constructor(){super({id:a.ID,title:""})}static{this.ID="notebook.chat.selectAndInsertKernelVariable"}async run(i,...e){let t=i.get(ee),o=i.get(Ol),n=i.get(Ue),r=Jn(t.activeEditorPane)?.getViewModel()?.notebookDocument;if(!r)return;let s=e[0];if(!s||!("widget"in s)||!("range"in s))return;let l=s.widget,c=s.range,u=s.variable;if(u!==void 0){this.addVariableReference(l,u,c,!1);return}let p=o.getMatchingKernel(r).selected;if(!p?.hasVariableProvider)return;let g=p.provideVariables(r.uri,void 0,"named",0,Se.None),f=[];for await(let S of g)f.push({label:S.name,description:S.value,detail:S.type});let v=f.length>0?d(12444,null):d(12441,null),b=await n.pick(f,{placeHolder:v});b&&this.addVariableReference(l,b.label,c,!0)}addVariableReference(i,e,t,o){if(t){let n=`#kernelVariable:${e}`;if(o&&!i.inputEditor.executeEdits("chatInsertFile",[{range:t,text:n+" "}]))return;i.getContrib(yS.ID)?.addReference({id:"vscode.notebook.variable",range:{startLineNumber:t.startLineNumber,startColumn:t.startColumn,endLineNumber:t.endLineNumber,endColumn:t.startColumn+n.length},data:e,fullName:e,icon:Z9.variable})}else i.attachmentModel.addContext({id:"vscode.notebook.variable",name:e,value:e,icon:Z9.variable,kind:"generic"})}},mnt=class{constructor(i,e){this.editorService=i;this.notebookKernelService=e;this.type="pickerPick";this.label=d(12439,null);this.icon=R.serverEnvironment}isEnabled(i){return i.location==="notebook"&&!!Jn(this.editorService.activeEditorPane)?.getViewModel()?.notebookDocument}asPicker(){let i=(async()=>{let e=Jn(this.editorService.activeEditorPane)?.getViewModel()?.notebookDocument;if(!e)return[];let t=this.notebookKernelService.getMatchingKernel(e).selected;if(!t?.hasVariableProvider)return[];let n=t.provideVariables(e.uri,void 0,"named",0,Se.None),r=[];for await(let s of n)r.push({label:s.name,description:s.value,asAttachment:()=>({kind:"generic",id:"vscode.notebook.variable",name:s.name,value:s.value,icon:Z9.variable})});return r})();return{placeholder:d(12440,null),picks:i}}};mnt=I([m(0,ee),m(1,Ol)],mnt);W(class extends K{constructor(){super({id:"notebook.cellOutput.addToChat",title:d(12442,null),menu:{id:D.NotebookOutputToolbar,when:C.and(Bk,C.in(hPe.key,aEi.key)),order:10,group:"notebook_chat_actions"},category:th,icon:Stt,precondition:ie.enabled})}getNoteboookEditor(i,e){return e&&"notebookEditor"in e?e.notebookEditor:Jn(i.activeEditorPane)}async run(i,e){let t=this.getNoteboookEditor(i.get(ee),e);if(!t)return;let o;if(e&&"outputId"in e&&typeof e.outputId=="string"?o=jtt(e.outputId,t):e&&"outputViewModel"in e&&(o=e.outputViewModel),!o){let l=t.getActiveCell();if(!l)return;l.focusedOutputId!==void 0?o=l.outputsViewModels.find(c=>c.model.outputId===l.focusedOutputId):o=l.outputsViewModels.find(c=>c.pickedMimeType?.isTrusted)}if(!o)return;let n=o.pickedMimeType?.mimeType,r=i.get(Pt),s=await r.revealWidget();if(s&&n&&xit.includes(n)){let l=M1t(o,n,t);if(!l)return;s.attachmentModel.addContext(l),(await r.revealWidget())?.focusInput()}}});W(Fge);It(cFe.ID,cFe,St.BlockRestore);var Wge=new Y("notebookVariableViewEnabled",!1);var uon="notebook.openVariablesView";W(class extends mp{constructor(){super({id:uon,title:L(12546,"Variables"),icon:hUt,menu:[{id:D.InteractiveToolbar,group:"navigation",when:C.and(bPe,C.notEquals("jupyter.kernel.isjupyter",!0),Wge)},{id:D.EditorTitle,order:-1,group:"navigation",when:C.and(bPe,C.notEquals("jupyter.kernel.isjupyter",!0),C.notEquals("config.notebook.globalToolbar",!0),Wge)},{id:D.NotebookToolbar,order:-1,group:"navigation",when:C.and(bPe,C.notEquals("jupyter.kernel.isjupyter",!0),C.equals("config.notebook.globalToolbar",!0),Wge)}]})}async runWithContext(i,e){i.get($t).openView("workbench.notebook.variables",!0)}});var jLi="workbench.editor.empty.hint",toe=class extends x{constructor(e,t,o,n,r){super();this.editor=e;this.configurationService=t;this.inlineChatSessionService=o;this.chatAgentService=n;this.instantiationService=r;this._register(this.editor.onDidChangeModel(()=>this.update())),this._register(this.editor.onDidChangeModelLanguage(()=>this.update())),this._register(this.editor.onDidChangeModelContent(()=>this.update())),this._register(this.chatAgentService.onDidChangeAgents(()=>this.update())),this._register(this.editor.onDidChangeModelDecorations(()=>this.update())),this._register(this.editor.onDidChangeConfiguration(s=>{s.hasChanged(104)&&this.update()})),this._register(this.configurationService.onDidChangeConfiguration(s=>{s.affectsConfiguration(jLi)&&this.update()})),this._register(o.onWillStartSession(s=>{this.editor===s&&this.textHintContentWidget?.dispose()})),this._register(o.onDidChangeSessions(()=>{this.update()}))}static{this.ID="editor.contrib.emptyTextEditorHint"}shouldRenderHint(){if(this.configurationService.getValue(jLi)==="hidden"||this.editor.getOption(104))return!1;let t=this.editor.getModel(),o=t?.getLanguageId();if(!t||o===d_e||o===u_e||o===a2||this.inlineChatSessionService.getSessionByTextModel(t.uri)||this.editor.getModel()?.getValueLength()||!!this.editor.getLineDecorations(1)?.find(l=>l.options.beforeContentClassName||l.options.afterContentClassName||l.options.before?.content||l.options.after?.content))return!1;let r=!!this.chatAgentService.getDefaultAgent("editor"),s=t?.uri.scheme===Q.untitled&&o===$r;return r||s}update(){let e=this.shouldRenderHint();e&&!this.textHintContentWidget?this.textHintContentWidget=this.instantiationService.createInstance(Vge,this.editor):!e&&this.textHintContentWidget&&(this.textHintContentWidget.dispose(),this.textHintContentWidget=void 0)}dispose(){super.dispose(),this.textHintContentWidget?.dispose()}};toe=I([m(1,B),m(2,yI),m(3,cr),m(4,F)],toe);var Vge=class extends x{constructor(e,t,o,n,r,s,l){super();this.editor=e;this.commandService=t;this.configurationService=o;this.keybindingService=n;this.chatAgentService=r;this.telemetryService=s;this.contextMenuService=l;this.isVisible=!1;this.ariaLabel="";this._register(this.editor.onDidChangeConfiguration(u=>{this.domNode&&u.hasChanged(59)&&this.editor.applyFontInfo(this.domNode)}));let c=U.debounce(this.editor.onDidFocusEditorText,()=>{},500);this._register(c(()=>{this.editor.hasTextFocus()&&this.isVisible&&this.ariaLabel&&this.configurationService.getValue("accessibility.verbosity.emptyEditorHint")&&qr(this.ariaLabel)})),this.editor.addContentWidget(this)}static{this.ID="editor.widget.emptyHint"}getId(){return Vge.ID}disableHint(e){let t=()=>{this.configurationService.updateValue(jLi,"hidden"),this.dispose(),this.editor.focus()};if(!e){t();return}this.contextMenuService.showContextMenu({getAnchor:()=>new Cn(Ki(),e),getActions:()=>[{id:"workench.action.disableEmptyEditorHint",label:d(8922,null),tooltip:d(8922,null),enabled:!0,class:void 0,run:()=>{t()}}]})}getHint(){let e=this.chatAgentService.getActivatedAgents().filter(h=>h.locations.includes("editor")).length>0,t={disposables:this._store,callback:(h,g)=>{switch(h){case"0":e?n(g.browserEvent):r(g.browserEvent);break;case"1":e?r(g.browserEvent):this.disableHint();break;case"2":this.disableHint();break}}},o="inlineChat.start",n=async h=>{h.stopPropagation(),this.telemetryService.publicLog2("workbenchActionExecuted",{id:o,from:"hint"}),await this.commandService.executeCommand(o,{from:"hint"})},r=async h=>{h.stopPropagation(),this.editor.focus(),this.telemetryService.publicLog2("workbenchActionExecuted",{id:eee.ID,from:"hint"}),await this.commandService.executeCommand(eee.ID),this.editor.focus()},l=[o,eee.ID].map(h=>this.keybindingService.lookupKeybinding(h)?.getLabel()),c=(e?d(8924,null,l.at(0)??"",l.at(1)??""):d(8925,null,l.at(1)??"")).replaceAll(" ()",""),u=zE(c,{actionHandler:t,renderCodeSegments:!1});u.style.fontStyle="italic";let p=e?d(8920,null,...l):d(8921,null,...l);for(let h of u.querySelectorAll("a"))h.style.cursor="pointer";return{hintElement:u,ariaLabel:p}}getDomNode(){if(!this.domNode){this.domNode=_(".empty-editor-hint"),this.domNode.style.width="max-content",this.domNode.style.paddingLeft="4px";let{hintElement:e,ariaLabel:t}=this.getHint();this.domNode.append(e),this.ariaLabel=t.concat(d(8923,null,"accessibility.verbosity.emptyEditorHint")),this._register(j(this.domNode,"click",()=>{this.editor.focus()})),this.editor.applyFontInfo(this.domNode);let o=this.editor.getLineHeightForPosition(new ye(1,1));this.domNode.style.lineHeight=o+"px"}return this.domNode}getPosition(){return{position:{lineNumber:1,column:1},preference:[0]}}dispose(){super.dispose(),this.editor.removeContentWidget(this)}};Vge=I([m(1,ge),m(2,B),m(3,_e),m(4,cr),m(5,Te),m(6,Xe)],Vge);xo(toe.ID,toe,0);var dFe=class extends toe{constructor(e,t,o,n,r,s){super(e,o,n,r,s);this._editorService=t;let l=Jn(this._editorService.activeEditorPane);l&&this._register(l.onDidChangeActiveCell(()=>this.update()))}static{this.CONTRIB_ID="notebook.editor.contrib.emptyCellEditorHint"}shouldRenderHint(){let e=this.editor.getModel();if(!e||!(e?.uri.scheme===Q.vscodeNotebookCell))return!1;let o=Jn(this._editorService.activeEditorPane);return!(!o||!o.isDisposed||!super.shouldRenderHint()||o.getActiveCell()?.uri.fragment!==e.uri.fragment)}};dFe=I([m(1,ee),m(2,B),m(3,yI),m(4,cr),m(5,F)],dFe);xo(dFe.CONTRIB_ID,dFe,0);var YKt=!1;function mon(){YKt=!YKt}function hQ(a,i){YKt&&a.info(`[NotebookClipboard]: ${i}`)}function TSo(a){let i=a.get(se),e=a.get(ee),t=Jn(e.activeEditorPane);if(!t){hQ(i,"[Revive Webview] No notebook editor found for active editor pane, bypass");return}if(!t.hasEditorFocus()){hQ(i,"[Revive Webview] Notebook editor is not focused, bypass");return}if(!t.hasWebviewFocus()){hQ(i,"[Revive Webview] Notebook editor backlayer webview is not focused, bypass");return}let o=t.getViewModel();if(!(o&&o.viewCells.every(n=>!n.outputIsFocused&&!n.outputIsHovered)))return{editor:t,loggerService:i}}function hon(a){let i=TSo(a);if(!i)return;let e=i.editor.getInnerWebview();return hQ(i.loggerService,"[Revive Webview] Notebook editor backlayer webview is focused"),e}function hnt(a,i){let e=hon(a);return e?(i(e),!0):!1}function gon(a,i){let e=TSo(a);return e?i(e.editor):!1}var gnt=105;S_.addImplementation(gnt,"notebook-webview",a=>hnt(a,i=>i.undo()));I_.addImplementation(gnt,"notebook-webview",a=>hnt(a,i=>i.redo()));VP?.addImplementation(gnt,"notebook-webview",a=>hnt(a,i=>i.copy()));WP?.addImplementation(gnt,"notebook-webview",a=>hnt(a,i=>i.paste()));$V?.addImplementation(gnt,"notebook-webview",a=>hnt(a,i=>i.cut()));function _So(a,i,e){if(!a.hasModel())return!1;let t=a.textModel;if(a.isReadOnly)return!1;let o={kind:1,focus:a.getFocus(),selections:a.getSelections()};if(i){let n=a.getCellIndex(i),r=typeof n=="number"?n+1:0;t.applyEdits([{editType:1,index:r,count:0,cells:e.items.map(s=>yG(s))}],!0,o,()=>({kind:1,focus:{start:r,end:r+1},selections:[{start:r,end:r+e.items.length}]}),void 0,!0)}else{if(a.getLength()!==0)return!1;t.applyEdits([{editType:1,index:0,count:0,cells:e.items.map(n=>yG(n))}],!0,o,()=>({kind:1,focus:{start:0,end:1},selections:[{start:1,end:e.items.length+1}]}),void 0,!0)}return!0}function DSo(a,i,e){if(!i.hasModel())return!1;if(i.hasOutputTextSelection())return Re(i.getDomNode()).document.execCommand("copy"),!0;let t=a.get(Fi),o=a.get(bn),n=i.getSelections();if(e){let l=i.getCellIndex(e);if(!n.find(u=>u.start<=l&&l<u.end))return t.writeText(e.getText()),o.setToCopy([e.model],!0),!0}let r=HX(i,i.getSelections()),s=w6e(i,r);return s.length?(t.writeText(s.map(l=>l.getText()).join(`
`)),o.setToCopy(s.map(l=>l.model),!0),!0):!1}function LSo(a,i,e){if(!i.hasModel()||i.isReadOnly)return!1;let t=i.textModel,o=a.get(Fi),n=a.get(bn),r=i.getSelections();if(e){let f=i.getCellIndex(e);if(!r.find(b=>b.start<=f&&f<b.end)){o.writeText(e.getText());let b=i.getFocus(),S=b.end<=f?b:{start:b.start-1,end:b.end-1},y=r.map(w=>w.end<=f?w:{start:w.start-1,end:w.end-1});return t.applyEdits([{editType:1,index:f,count:1,cells:[]}],!0,{kind:1,focus:i.getFocus(),selections:r},()=>({kind:1,focus:S,selections:y}),void 0,!0),n.setToCopy([e.model],!1),!0}}let s=i.getFocus();if(!r.find(f=>f.start<=s.start&&s.end<=f.end)){let f=i.cellAt(s.start);o.writeText(f.getText());let v=s.end===i.getLength()?{start:s.start-1,end:s.end-1}:s,b=r.map(S=>S.end<=s.start?S:{start:S.start-1,end:S.end-1});return t.applyEdits([{editType:1,index:s.start,count:1,cells:[]}],!0,{kind:1,focus:i.getFocus(),selections:r},()=>({kind:1,focus:v,selections:b}),void 0,!0),n.setToCopy([f.model],!1),!0}let c=HX(i,i.getSelections()),u=w6e(i,c);if(!u.length)return!1;o.writeText(u.map(f=>f.getText()).join(`
`));let p=c.map(f=>({editType:1,index:f.start,count:f.end-f.start,cells:[]})),h=c[0].start,g=h<t.cells.length-1?h:Math.max(t.cells.length-2,0);return t.applyEdits(p,!0,{kind:1,focus:i.getFocus(),selections:c},()=>({kind:1,focus:{start:g,end:g+1},selections:[{start:g,end:g+1}]}),void 0,!0),n.setToCopy(u.map(f=>f.model),!1),!0}var uFe=class extends x{constructor(e){super();this._editorService=e;let t=105;VP&&this._register(VP.addImplementation(t,"notebook-clipboard",o=>this.runCopyAction(o))),WP&&this._register(WP.addImplementation(t,"notebook-clipboard",o=>this.runPasteAction(o))),$V&&this._register($V.addImplementation(t,"notebook-clipboard",o=>this.runCutAction(o)))}static{this.ID="workbench.contrib.notebookClipboard"}_getContext(){let e=Jn(this._editorService.activeEditorPane),t=e?.getActiveCell();return{editor:e,activeCell:t}}_focusInsideEmebedMonaco(e){let t=Re(e.getDomNode()).getSelection();if(t?.rangeCount!==1)return!1;let o=t.getRangeAt(0);if(o.startContainer===o.endContainer&&o.endOffset-o.startOffset===0)return!1;let n=o.commonAncestorContainer,r=e.getDomNode();if(!r.contains(n))return!1;for(;n&&n!==r;){if(n.classList&&n.classList.contains("monaco-editor"))return!0;n=n.parentNode}return!1}runCopyAction(e){let t=e.get(se),o=Nn();if(Do(o)&&Kh(o))return hQ(t,"[NotebookEditor] focus is on input or textarea element, bypass"),!1;let{editor:n}=this._getContext();return n?n.hasEditorFocus()?this._focusInsideEmebedMonaco(n)?(hQ(t,"[NotebookEditor] focus is on embed monaco editor, bypass"),!1):(hQ(t,"[NotebookEditor] run copy actions on notebook model"),DSo(e,n,void 0)):(hQ(t,"[NotebookEditor] focus is outside of the notebook editor, bypass"),!1):(hQ(t,"[NotebookEditor] no active notebook editor, bypass"),!1)}runPasteAction(e){let t=Nn();if(t&&Kh(t))return!1;let{editor:o,activeCell:n}=this._getContext();if(!o||!o.hasEditorFocus()||this._focusInsideEmebedMonaco(o))return!1;let s=e.get(bn).getToCopy();return s?_So(o,n,s):!1}runCutAction(e){let t=Nn();if(t&&Kh(t))return!1;let{editor:o}=this._getContext();return!o||!o.hasEditorFocus()||this._focusInsideEmebedMonaco(o)?!1:LSo(e,o,void 0)}};uFe=I([m(0,ee)],uFe);It(uFe.ID,uFe,St.BlockRestore);var fon="notebook.cell.copy",von="notebook.cell.cut",bon="notebook.cell.paste",Son="notebook.cell.pasteAbove";W(class extends Pd{constructor(){super({id:fon,title:d(12331,null),menu:{id:D.NotebookCellTitle,when:pr,group:"1_copy",order:2},keybinding:Vr?void 0:{primary:2081,win:{primary:2081,secondary:[2067]},when:C.and(pr,C.not(np)),weight:200}})}async runWithContext(a,i){DSo(a,i.notebookEditor,i.cell)}});W(class extends Pd{constructor(){super({id:von,title:d(12332,null),menu:{id:D.NotebookCellTitle,when:C.and(pr,Xl,jw),group:"1_copy",order:1},keybinding:Vr?void 0:{when:C.and(pr,C.not(np)),primary:2102,win:{primary:2102,secondary:[1044]},weight:200}})}async runWithContext(a,i){LSo(a,i.notebookEditor,i.cell)}});W(class extends mp{constructor(){super({id:bon,title:d(12333,null),menu:{id:D.NotebookCellTitle,when:C.and(pr,Xl),group:"1_copy",order:3},keybinding:Vr?void 0:{when:C.and(pr,C.not(np)),primary:2100,win:{primary:2100,secondary:[1043]},linux:{primary:2100,secondary:[1043]},weight:100}})}async runWithContext(a,i){let t=a.get(bn).getToCopy();!i.notebookEditor.hasModel()||i.notebookEditor.isReadOnly||t&&_So(i.notebookEditor,i.cell,t)}});W(class extends Pd{constructor(){super({id:Son,title:d(12334,null),keybinding:{when:C.and(pr,C.not(np)),primary:3124,weight:Df}})}async runWithContext(a,i){let t=a.get(bn).getToCopy(),o=i.notebookEditor,n=o.textModel;if(o.isReadOnly||!t)return;let r={kind:1,focus:o.getFocus(),selections:o.getSelections()},s=i.notebookEditor.getCellIndex(i.cell),l=s;n.applyEdits([{editType:1,index:s,count:0,cells:t.items.map(c=>yG(c))}],!0,r,()=>({kind:1,focus:{start:l,end:l+1},selections:[{start:l,end:l+t.items.length}]}),void 0,!0)}});W(class extends K{constructor(){super({id:"workbench.action.toggleNotebookClipboardLog",title:L(12335,"Toggle Notebook Clipboard Troubleshooting"),category:Ve.Developer,f1:!0})}run(a){mon(),YKt&&a.get(ge).executeCommand(T2)}});W(class extends Pd{constructor(){super({id:"notebook.cell.output.selectAll",title:d(12330,null),keybinding:{primary:2079,when:C.and(pr,bM),weight:bmo}})}async runWithContext(a,i){gon(a,e=>{if(!e.hasEditorFocus())return!1;if(e.hasEditorFocus()&&!e.hasWebviewFocus())return!0;let t=e.getActiveCell();return!t||!t.outputIsFocused||!e.hasWebviewFocus()||(t.inputInOutputIsFocused?e.selectInputContents(t):e.selectOutputContent(t)),!0})}});var pFe=class extends x{constructor(e,t,o,n,r){super();this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._markupInput=!0;this._markupPreview=!0;this._codeInput=!0;this._codeOutput=!0;this._findScope={findScopeType:"none"};this._markupInput=e,this._markupPreview=t,this._codeInput=o,this._codeOutput=n,this._findScope=r,this._initialMarkupInput=e,this._initialMarkupPreview=t,this._initialCodeInput=o,this._initialCodeOutput=n}get markupInput(){return this._markupInput}set markupInput(e){this._markupInput!==e&&(this._markupInput=e,this._onDidChange.fire({markupInput:e}))}get markupPreview(){return this._markupPreview}set markupPreview(e){this._markupPreview!==e&&(this._markupPreview=e,this._onDidChange.fire({markupPreview:e}))}get codeInput(){return this._codeInput}set codeInput(e){this._codeInput!==e&&(this._codeInput=e,this._onDidChange.fire({codeInput:e}))}get codeOutput(){return this._codeOutput}set codeOutput(e){this._codeOutput!==e&&(this._codeOutput=e,this._onDidChange.fire({codeOutput:e}))}get findScope(){return this._findScope}set findScope(e){this._findScope!==e&&(this._findScope=e,this._onDidChange.fire({findScope:!0}))}isModified(){return this._markupInput!==this._initialMarkupInput||this._markupPreview!==this._initialMarkupPreview||this._codeInput!==this._initialCodeInput||this._codeOutput!==this._initialCodeOutput}update(e){this._markupInput=e.markupInput,this._markupPreview=e.markupPreview,this._codeInput=e.codeInput,this._codeOutput=e.codeOutput,this._findScope=e.findScope}};var Ion=d(12351,null),yon=d(12364,null),won=d(12353,null),Con=d(12352,null),xon=d(12358,null),kon=d(12350,null),Eon=d(12357,null),Ton=d(12354,null),_on=d(12365,null),Don=d(12356,null),Lon=d(12355,null),cum=Ae("find-filter",R.filter,d(12349,null)),Ron=d(12359,null),Mon=d(12362,null),Pon=d(12363,null),Aon=d(12360,null),Non=d(12361,null),mFe=419,RSo=4,fnt=class extends Pm{constructor(e,t,o,n,r){super(t,{getActions:()=>this.getActions()},r,{...o,actionRunner:n,classNames:t.class,anchorAlignmentProvider:()=>1});this.filters=e}render(e){super.render(e),this.updateChecked()}getActions(){let e={checked:this.filters.markupInput,class:void 0,enabled:!0,id:"findInMarkdownInput",label:Mon,run:async()=>{this.filters.markupInput=!this.filters.markupInput},tooltip:""},t={checked:this.filters.markupPreview,class:void 0,enabled:!0,id:"findInMarkdownInput",label:Pon,run:async()=>{this.filters.markupPreview=!this.filters.markupPreview},tooltip:""},o={checked:this.filters.codeInput,class:void 0,enabled:!0,id:"findInCodeInput",label:Aon,run:async()=>{this.filters.codeInput=!this.filters.codeInput},tooltip:""},n={checked:this.filters.codeOutput,class:void 0,enabled:!0,id:"findInCodeOutput",label:Non,run:async()=>{this.filters.codeOutput=!this.filters.codeOutput},tooltip:"",dispose:()=>null};return $Se?[e,o]:[e,t,new ri,o,n]}updateChecked(){this.element.classList.toggle("checked",this._action.checked)}};fnt=I([m(4,Xe)],fnt);var vnt=class extends x{constructor(e,t,o,n,r=Ron){super();this.filters=e;this.contextMenuService=t;this.instantiationService=o;this._actionbar=null;this._toggleStyles=n.toggleStyles,this._filtersAction=this._register(new it("notebookFindFilterAction",r,"notebook-filters "+q.asClassName(vUt))),this._filtersAction.checked=!1,this._filterButtonContainer=_(".find-filter-button"),this._filterButtonContainer.classList.add("monaco-custom-toggle"),this.createFilters(this._filterButtonContainer)}get container(){return this._filterButtonContainer}width(){return 22}enable(){this.container.setAttribute("aria-disabled",String(!1))}disable(){this.container.setAttribute("aria-disabled",String(!0))}set visible(e){this._filterButtonContainer.style.display=e?"":"none"}get visible(){return this._filterButtonContainer.style.display!=="none"}applyStyles(e){let t=this._toggleStyles;this._filterButtonContainer.style.border="1px solid transparent",this._filterButtonContainer.style.borderRadius="3px",this._filterButtonContainer.style.borderColor=e&&t.inputActiveOptionBorder||"",this._filterButtonContainer.style.color=e&&t.inputActiveOptionForeground||"inherit",this._filterButtonContainer.style.backgroundColor=e&&t.inputActiveOptionBackground||""}createFilters(e){this._actionbar=this._register(new Zi(e,{actionViewItemProvider:(t,o)=>{if(t.id===this._filtersAction.id)return this.instantiationService.createInstance(fnt,this.filters,t,o,this._register(new rs))}})),this._actionbar.push(this._filtersAction,{icon:!0,label:!1})}},QLi=class extends Vz{constructor(e,t,o,n,r,s,l){super(r,s,l);this.filters=e;this.contextMenuService=o;this.instantiationService=n;this._filterChecked=!1;this._register(XV(t,this.inputBox)),this._findFilter=this._register(new vnt(e,o,n,l)),this.inputBox.paddingRight=(this.caseSensitive?.width()??0)+(this.wholeWords?.width()??0)+(this.regex?.width()??0)+this._findFilter.width(),this.controls.appendChild(this._findFilter.container)}setEnabled(e){super.setEnabled(e),e&&!this._filterChecked?this.regex?.enable():this.regex?.disable()}updateFilterState(e){this._filterChecked=e,this.regex&&(this._filterChecked?(this.regex.disable(),this.regex.domNode.tabIndex=-1,this.regex.domNode.classList.toggle("disabled",!0)):(this.regex.enable(),this.regex.domNode.tabIndex=0,this.regex.domNode.classList.toggle("disabled",!1))),this._findFilter.applyStyles(this._filterChecked)}getCellToolbarActions(e){return ml(e.getActions({shouldForwardArgs:!0}),t=>/^inline/.test(t))}},hFe=class extends ja{constructor(e,t,o,n,r,s,l=new iK,c,u,p){super();this._contextViewService=e;this._configurationService=o;this.contextMenuService=n;this.instantiationService=r;this._state=l;this._notebookEditor=c;this._findWidgetSearchHistory=u;this._replaceWidgetHistory=p;this._resizeOriginalWidth=mFe;this._isVisible=!1;this._isReplaceVisible=!1;this.foundMatch=!1;this.cellSelectionDecorationIds=[];this.textSelectionDecorationIds=[];this._register(this._state);let h=this._configurationService.getValue(yt.findFilters)??{markupSource:!0,markupPreview:!0,codeSource:!0,codeOutput:!0},g=this._configurationService.getValue("editor.find.history"),f=this._configurationService.getValue("editor.find.replaceHistory");this._filters=this._register(new pFe(h.markupSource,h.markupPreview,h.codeSource,h.codeOutput,{findScopeType:"none"})),this._state.change({filters:this._filters},!1),this._register(this._filters.onDidChange(()=>{this._state.change({filters:this._filters},!1)})),this._domNode=document.createElement("div"),this._domNode.classList.add("simple-fr-find-part-wrapper"),this._register(U.runAndSubscribe(this._configurationService.onDidChangeConfiguration,w=>{(!w||w.affectsConfiguration(yt.globalToolbar))&&(this._notebookEditor.notebookOptions.getLayoutConfiguration().globalToolbar?this._domNode.style.top="26px":this._domNode.style.top="0px")})),this._register(this._state.onFindReplaceStateChange(w=>this._onStateChanged(w))),this._scopedContextKeyService=this._register(t.createScoped(this._domNode));let v=_(".find-replace-progress");this._progressBar=this._register(new Zf(v,vw)),this._domNode.appendChild(v);let b=t.getContextKeyValue("notebookType")==="interactive",S={groupId:"simple-find-widget"};this._toggleReplaceBtn=this._register(new rI({label:Eon,className:"codicon toggle left",hoverLifecycleOptions:S,onTrigger:b?()=>{}:()=>{this._isReplaceVisible=!this._isReplaceVisible,this._state.change({isReplaceRevealed:this._isReplaceVisible},!1),this._updateReplaceViewDisplay()}},s)),this._toggleReplaceBtn.setEnabled(!b),this._toggleReplaceBtn.setExpanded(this._isReplaceVisible),this._domNode.appendChild(this._toggleReplaceBtn.domNode),this._innerFindDomNode=document.createElement("div"),this._innerFindDomNode.classList.add("simple-fr-find-part"),this._findInput=this._register(new QLi(this._filters,this._scopedContextKeyService,this.contextMenuService,this.instantiationService,null,this._contextViewService,{label:Ion,placeholder:yon,validation:w=>{if(w.length===0||!this._findInput.getRegex())return null;try{return new RegExp(w),null}catch(k){return this.foundMatch=!1,this.updateButtons(this.foundMatch),{content:k.message}}},flexibleWidth:!0,showCommonFindToggles:!0,inputBoxStyles:Cl,toggleStyles:gh,history:g==="workspace"?this._findWidgetSearchHistory:new Set([])})),this._updateFindHistoryDelayer=new Xo(500),this.oninput(this._findInput.domNode,w=>{this.foundMatch=this.onInputChanged(),this.updateButtons(this.foundMatch),this._delayedUpdateFindHistory()}),this._register(this._findInput.inputBox.onDidChange(()=>{this._state.change({searchString:this._findInput.getValue()},!0)})),this._findInput.setRegex(!!this._state.isRegex),this._findInput.setCaseSensitive(!!this._state.matchCase),this._findInput.setWholeWords(!!this._state.wholeWord),this._register(this._findInput.onDidOptionChange(()=>{this._state.change({isRegex:this._findInput.getRegex(),wholeWord:this._findInput.getWholeWords(),matchCase:this._findInput.getCaseSensitive()},!0)})),this._register(this._state.onFindReplaceStateChange(()=>{this._findInput.setRegex(this._state.isRegex),this._findInput.setWholeWords(this._state.wholeWord),this._findInput.setCaseSensitive(this._state.matchCase),this._replaceInput.setPreserveCase(this._state.preserveCase)})),this._matchesCount=document.createElement("div"),this._matchesCount.className="matchesCount",this._updateMatchesCount(),this.prevBtn=this._register(new rI({label:won,icon:b3e,hoverLifecycleOptions:S,onTrigger:()=>{this.find(!0)}},s)),this.nextBtn=this._register(new rI({label:Con,icon:S3e,hoverLifecycleOptions:S,onTrigger:()=>{this.find(!1)}},s)),this.inSelectionToggle=this._register(new cm({icon:rai,title:xon,isChecked:!1,hoverLifecycleOptions:S,inputActiveOptionBackground:kt(PV),inputActiveOptionBorder:kt(MV),inputActiveOptionForeground:kt(dj)})),this.inSelectionToggle.domNode.style.display="inline",this._register(this.inSelectionToggle.onChange(()=>{if(this.inSelectionToggle.checked){let k=this._notebookEditor.getSelections(),T=this._notebookEditor.getSelectionViewModels()[0].getSelections();k.length>1||k.some(P=>P.end-P.start>1)?(this._filters.findScope={findScopeType:"cells",selectedCellRanges:k},this.setCellSelectionDecorations()):T.length>1||T.some(P=>P.endLineNumber-P.startLineNumber>=1)?(this._filters.findScope={findScopeType:"text",selectedCellRanges:k,selectedTextRanges:T},this.setTextSelectionDecorations(T,this._notebookEditor.getSelectionViewModels()[0])):(this._filters.findScope={findScopeType:"cells",selectedCellRanges:k},this.setCellSelectionDecorations())}else this._filters.findScope={findScopeType:"none"},this.clearCellSelectionDecorations(),this.clearTextSelectionDecorations()}));let y=this._register(new rI({label:kon,icon:PE,hoverLifecycleOptions:S,onTrigger:()=>{this.hide()}},s));this._innerFindDomNode.appendChild(this._findInput.domNode),this._innerFindDomNode.appendChild(this._matchesCount),this._innerFindDomNode.appendChild(this.prevBtn.domNode),this._innerFindDomNode.appendChild(this.nextBtn.domNode),this._innerFindDomNode.appendChild(this.inSelectionToggle.domNode),this._innerFindDomNode.appendChild(y.domNode),this._domNode.appendChild(this._innerFindDomNode),this.onkeyup(this._innerFindDomNode,w=>{if(w.equals(9)){this.hide(),w.preventDefault();return}}),this._focusTracker=this._register(qn(this._domNode)),this._register(this._focusTracker.onDidFocus(this.onFocusTrackerFocus.bind(this))),this._register(this._focusTracker.onDidBlur(this.onFocusTrackerBlur.bind(this))),this._findInputFocusTracker=this._register(qn(this._findInput.domNode)),this._register(this._findInputFocusTracker.onDidFocus(this.onFindInputFocusTrackerFocus.bind(this))),this._register(this._findInputFocusTracker.onDidBlur(this.onFindInputFocusTrackerBlur.bind(this))),this._register(j(this._innerFindDomNode,"click",w=>{w.stopPropagation()})),this._innerReplaceDomNode=document.createElement("div"),this._innerReplaceDomNode.classList.add("simple-fr-replace-part"),this._replaceInput=this._register(new Uz(null,void 0,{label:Ton,placeholder:_on,history:f==="workspace"?this._replaceWidgetHistory:new Set([]),inputBoxStyles:Cl,toggleStyles:gh,hoverLifecycleOptions:S},t,!1)),this._innerReplaceDomNode.appendChild(this._replaceInput.domNode),this._replaceInputFocusTracker=this._register(qn(this._replaceInput.domNode)),this._register(this._replaceInputFocusTracker.onDidFocus(this.onReplaceInputFocusTrackerFocus.bind(this))),this._register(this._replaceInputFocusTracker.onDidBlur(this.onReplaceInputFocusTrackerBlur.bind(this))),this._updateReplaceHistoryDelayer=new Xo(500),this.oninput(this._replaceInput.domNode,w=>{this._delayedUpdateReplaceHistory()}),this._register(this._replaceInput.inputBox.onDidChange(()=>{this._state.change({replaceString:this._replaceInput.getValue()},!0)})),this._domNode.appendChild(this._innerReplaceDomNode),this._updateReplaceViewDisplay(),this._replaceBtn=this._register(new rI({label:Don,icon:sai,hoverLifecycleOptions:S,onTrigger:()=>{this.replaceOne()}},s)),this._replaceAllBtn=this._register(new rI({label:Lon,icon:aai,hoverLifecycleOptions:S,onTrigger:()=>{this.replaceAll()}},s)),this._innerReplaceDomNode.appendChild(this._replaceBtn.domNode),this._innerReplaceDomNode.appendChild(this._replaceAllBtn.domNode),this._resizeSash=this._register(new Jh(this._domNode,{getVerticalSashLeft:()=>0},{orientation:0,size:2})),this._register(this._resizeSash.onDidStart(()=>{this._resizeOriginalWidth=this._getDomWidth()})),this._register(this._resizeSash.onDidChange(w=>{let k=this._resizeOriginalWidth+w.startX-w.currentX;k<mFe&&(k=mFe);let T=this._getMaxWidth();k>T&&(k=T),this._domNode.style.width=`${k}px`,this._isReplaceVisible&&(this._replaceInput.width=zl(this._findInput.domNode)),this._findInput.inputBox.layout()})),this._register(this._resizeSash.onDidReset(()=>{let w=this._getDomWidth(),k=mFe;w<=mFe&&(k=this._getMaxWidth()),this._domNode.style.width=`${k}px`,this._isReplaceVisible&&(this._replaceInput.width=zl(this._findInput.domNode)),this._findInput.inputBox.layout()}))}_getMaxWidth(){return this._notebookEditor.getLayoutInfo().width-64}_getDomWidth(){return zl(this._domNode)-RSo*2}getCellToolbarActions(e){return ml(e.getActions({shouldForwardArgs:!0}),t=>/^inline/.test(t))}get inputValue(){return this._findInput.getValue()}get replaceValue(){return this._replaceInput.getValue()}get replacePattern(){return this._state.isRegex?SCt(this.replaceValue):VY.fromStaticValue(this.replaceValue)}get focusTracker(){return this._focusTracker}get isVisible(){return this._isVisible}_onStateChanged(e){this._updateButtons(),this._updateMatchesCount()}_updateButtons(){this._findInput.setEnabled(this._isVisible),this._replaceInput.setEnabled(this._isVisible&&this._isReplaceVisible);let e=this._state.searchString.length>0;this._replaceBtn.setEnabled(this._isVisible&&this._isReplaceVisible&&e),this._replaceAllBtn.setEnabled(this._isVisible&&this._isReplaceVisible&&e),this._domNode.classList.toggle("replaceToggled",this._isReplaceVisible),this._toggleReplaceBtn.setExpanded(this._isReplaceVisible),this.foundMatch=this._state.matchesCount>0,this.updateButtons(this.foundMatch)}setCellSelectionDecorations(){let e=[];this._notebookEditor.getSelectionViewModels().forEach(o=>{e.push(o.handle)});let t=[];for(let o of e)t.push({handle:o,options:{className:"nb-multiCellHighlight",outputClassName:"nb-multiCellHighlight"}});this.cellSelectionDecorationIds=this._notebookEditor.deltaCellDecorations([],t)}clearCellSelectionDecorations(){this._notebookEditor.deltaCellDecorations(this.cellSelectionDecorationIds,[])}setTextSelectionDecorations(e,t){this._notebookEditor.changeModelDecorations(o=>{let n=[];for(let r of e)n.push({ownerId:t.handle,decorations:[{range:r,options:{description:"text search range for notebook search scope",isWholeLine:!0,className:"nb-findScope"}}]});this.textSelectionDecorationIds=o.deltaDecorations([],n)})}clearTextSelectionDecorations(){this._notebookEditor.changeModelDecorations(e=>{e.deltaDecorations(this.textSelectionDecorationIds,[])})}_updateMatchesCount(){}dispose(){super.dispose(),this._domNode.remove()}getDomNode(){return this._domNode}reveal(e){if(e&&this._findInput.setValue(e),this._isVisible){this._findInput.select();return}this._isVisible=!0,this.updateButtons(this.foundMatch),setTimeout(()=>{this._domNode.classList.add("visible","visible-transition"),this._domNode.setAttribute("aria-hidden","false"),this._findInput.select()},0)}focus(){this._findInput.focus()}show(e,t){e&&this._findInput.setValue(e),this._isVisible=!0,setTimeout(()=>{this._domNode.classList.add("visible","visible-transition"),this._domNode.setAttribute("aria-hidden","false"),(t?.focus??!0)&&this.focus()},0)}showWithReplace(e,t){e&&this._findInput.setValue(e),t&&this._replaceInput.setValue(t),this._isVisible=!0,this._isReplaceVisible=!0,this._state.change({isReplaceRevealed:this._isReplaceVisible},!1),this._updateReplaceViewDisplay(),setTimeout(()=>{this._domNode.classList.add("visible","visible-transition"),this._domNode.setAttribute("aria-hidden","false"),this._updateButtons(),this._replaceInput.focus()},0)}_updateReplaceViewDisplay(){this._isReplaceVisible?this._innerReplaceDomNode.style.display="flex":this._innerReplaceDomNode.style.display="none",this._replaceInput.width=zl(this._findInput.domNode)}hide(){this._isVisible&&(this.inSelectionToggle.checked=!1,this._notebookEditor.deltaCellDecorations(this.cellSelectionDecorationIds,[]),this._notebookEditor.changeModelDecorations(e=>{e.deltaDecorations(this.textSelectionDecorationIds,[])}),this._domNode.classList.remove("visible-transition"),this._domNode.setAttribute("aria-hidden","true"),setTimeout(()=>{this._isVisible=!1,this.updateButtons(this.foundMatch),this._domNode.classList.remove("visible")},200))}_delayedUpdateFindHistory(){this._updateFindHistoryDelayer.trigger(this._updateFindHistory.bind(this))}_updateFindHistory(){this._findInput.inputBox.addToHistory()}_delayedUpdateReplaceHistory(){this._updateReplaceHistoryDelayer.trigger(this._updateReplaceHistory.bind(this))}_updateReplaceHistory(){this._replaceInput.inputBox.addToHistory()}_getRegexValue(){return this._findInput.getRegex()}_getWholeWordValue(){return this._findInput.getWholeWords()}_getCaseSensitiveValue(){return this._findInput.getCaseSensitive()}updateButtons(e){let t=this.inputValue.length>0;this.prevBtn.setEnabled(this._isVisible&&t&&e),this.nextBtn.setEnabled(this._isVisible&&t&&e)}};hFe=I([m(0,Wn),m(1,X),m(2,B),m(3,Xe),m(4,F),m(5,nt)],hFe);is((a,i)=>{i.addRule(`
	.notebook-editor {
		--notebook-find-width: ${mFe}px;
		--notebook-find-horizontal-padding: ${RSo}px;
	}
	`)});var bnt="find-hide-transition",gFe="find-show-transition",YLi=69,XLi=200,tC=class extends x{constructor(e,t){super();this.notebookEditor=e;this.instantiationService=t;this._widget=new co(()=>this._register(this.instantiationService.createInstance(Snt,this.notebookEditor)))}static{this.id="workbench.notebook.find"}get widget(){return this._widget.value}show(e,t){return this._widget.value.show(e,t)}hide(){this._widget.rawValue?.hide()}replace(e){return this._widget.value.replace(e)}isVisible(){return this._widget.rawValue?.isVisible??!1}findNext(){this._widget.rawValue&&this._widget.value.findNext()}findPrevious(){this._widget.rawValue&&this._widget.value.findPrevious()}};tC=I([m(1,F)],tC);var Snt=class extends hFe{constructor(e,t,o,n,r,s,l,c){let u=q_.getOrCreate(c),p=$_.getOrCreate(c);super(t,o,n,r,l,s,new iK,e,u,p);this._isFocused=!1;this._showTimeout=null;this._hideTimeout=null;this._findModel=new ZPe(this._notebookEditor,this._state,this._configurationService),M(this._notebookEditor.getDomNode(),this.getDomNode()),this._findWidgetFocused=eUt.bindTo(o),this._findWidgetVisible=UE.bindTo(o),this._register(this._findInput.onKeyDown(h=>this._onFindInputKeyDown(h))),this._register(this._replaceInput.onKeyDown(h=>this._onReplaceInputKeyDown(h))),this._register(this._state.onFindReplaceStateChange(h=>{if(this.onInputChanged(),h.isSearching&&(this._state.isSearching?this._progressBar.infinite().show(XLi):this._progressBar.stop().hide()),this._findModel.currentMatch>=0){let f=this._findModel.getCurrentMatch();this._replaceBtn.setEnabled(f.isModelMatch)}let g=this._findModel.findMatches;this._replaceAllBtn.setEnabled(g.length>0&&g.find(f=>f.webviewMatches.length>0)===void 0),h.filters&&this._findInput.updateFilterState(this._state.filters?.isModified()??!1)})),this._register(j(this.getDomNode(),re.FOCUS,h=>{this._previousFocusElement=Do(h.relatedTarget)?h.relatedTarget:void 0},!0))}get findModel(){return this._findModel}get isFocused(){return this._isFocused}_onFindInputKeyDown(e){if(e.equals(3)){this.find(!1),e.preventDefault();return}else if(e.equals(1027)){this.find(!0),e.preventDefault();return}}_onReplaceInputKeyDown(e){if(e.equals(3)){this.replaceOne(),e.preventDefault();return}}onInputChanged(){this._state.change({searchString:this.inputValue},!1);let e=this._findModel.findMatches;return!!(e&&e.length)}findIndex(e){this._findModel.find({index:e})}find(e){this._findModel.find({previous:e})}findNext(){this.find(!1)}findPrevious(){this.find(!0)}replaceOne(){if(!this._notebookEditor.hasModel()||!this._findModel.findMatches.length)return;this._findModel.ensureFindMatches(),this._findModel.currentMatch<0&&this._findModel.find({previous:!1});let e=this._findModel.getCurrentMatch(),t=e.cell;if(e.isModelMatch){let o=e.match;this._progressBar.infinite().show(XLi);let r=this.replacePattern.buildReplaceString(o.matches,this._state.preserveCase);this._notebookEditor.getViewModel().replaceOne(t,o.range,r).then(()=>{this._progressBar.stop()})}else console.error("Replace does not work for output match")}replaceAll(){if(!this._notebookEditor.hasModel())return;this._progressBar.infinite().show(XLi);let e=this.replacePattern,t=this._findModel.findMatches,o=[];t.forEach(r=>{r.contentMatches.forEach(s=>{let l=s.matches;o.push(e.buildReplaceString(l,this._state.preserveCase))})}),this._notebookEditor.getViewModel().replaceAll(this._findModel.findMatches,o).then(()=>{this._progressBar.stop()})}findFirst(){}onFocusTrackerFocus(){this._findWidgetFocused.set(!0),this._isFocused=!0}onFocusTrackerBlur(){this._previousFocusElement=void 0,this._findWidgetFocused.reset(),this._isFocused=!1}onReplaceInputFocusTrackerFocus(){}onReplaceInputFocusTrackerBlur(){}onFindInputFocusTrackerFocus(){}onFindInputFocusTrackerBlur(){}async show(e,t){let o=this._state.searchString!==e;super.show(e,t),this._state.change({searchString:e??this._state.searchString,isRevealed:!0},!1),this._findWidgetVisible.set(!0),typeof t?.matchIndex=="number"?(this._findModel.findMatches.length||await this._findModel.research(),this.findIndex(t.matchIndex)):t?.focus!==!1&&this._findInput.select(),!o&&t?.searchStringSeededFrom&&this._findModel.refreshCurrentMatch(t.searchStringSeededFrom),this._showTimeout===null&&(this._hideTimeout!==null&&(Re(this.getDomNode()).clearTimeout(this._hideTimeout),this._hideTimeout=null,this._notebookEditor.removeClassName(bnt)),this._notebookEditor.addClassName(gFe),this._showTimeout=Re(this.getDomNode()).setTimeout(()=>{this._notebookEditor.removeClassName(gFe),this._showTimeout=null},200))}replace(e,t){super.showWithReplace(e,t),this._state.change({searchString:e??"",replaceString:t??"",isRevealed:!0},!1),this._replaceInput.select(),this._showTimeout===null&&(this._hideTimeout!==null&&(Re(this.getDomNode()).clearTimeout(this._hideTimeout),this._hideTimeout=null,this._notebookEditor.removeClassName(bnt)),this._notebookEditor.addClassName(gFe),this._showTimeout=Re(this.getDomNode()).setTimeout(()=>{this._notebookEditor.removeClassName(gFe),this._showTimeout=null},200))}hide(){if(super.hide(),this._state.change({isRevealed:!1},!1),this._findWidgetVisible.set(!1),this._findModel.clear(),this._notebookEditor.findStop(),this._progressBar.stop(),this._hideTimeout===null&&(this._showTimeout!==null&&(Re(this.getDomNode()).clearTimeout(this._showTimeout),this._showTimeout=null,this._notebookEditor.removeClassName(gFe)),this._notebookEditor.addClassName(bnt),this._hideTimeout=Re(this.getDomNode()).setTimeout(()=>{this._notebookEditor.removeClassName(bnt)},200)),this._previousFocusElement&&this._previousFocusElement.offsetParent&&(this._previousFocusElement.focus(),this._previousFocusElement=void 0),this._notebookEditor.hasModel())for(let e=0;e<this._notebookEditor.getLength();e++){let t=this._notebookEditor.cellAt(e);t.getEditState()===1&&t.editStateSource==="find"&&t.updateEditState(0,"closeFind")}}_updateMatchesCount(){if(!this._findModel||!this._findModel.findMatches)return;this._matchesCount.style.minWidth=YLi+"px",this._matchesCount.title="",this._matchesCount.firstChild?.remove();let e;if(this._state.matchesCount>0){let t=String(this._state.matchesCount);this._state.matchesCount>=XO&&(t+="+");let o=this._findModel.currentMatch<0?"?":String(this._findModel.currentMatch+1);e=vd(I3e,o,t)}else e=Kz;this._matchesCount.appendChild(document.createTextNode(e)),en(this._getAriaLabel(e,this._state.currentMatch,this._state.searchString)),YLi=Math.max(YLi,this._matchesCount.clientWidth)}_getAriaLabel(e,t,o){return e===Kz?o===""?d(12367,null,e):d(12366,null,e,o):d(12368,null,e,o)}dispose(){this._notebookEditor?.removeClassName(gFe),this._notebookEditor?.removeClassName(bnt),this._findModel.dispose(),super.dispose()}};Snt=I([m(1,Wn),m(2,X),m(3,B),m(4,Xe),m(5,nt),m(6,F),m(7,ce)],Snt);bm(tC.id,tC);W(class extends K{constructor(){super({id:"notebook.hideFind",title:L(12348,"Hide Find in Notebook"),keybinding:{when:C.and(pr,UE),primary:9,weight:105}})}async run(a){let i=a.get(ee),e=Jn(i.activeEditorPane);if(!e)return;e.getContribution(tC.id).hide(),e.focus()}});W(class extends Hg{constructor(){super({id:"notebook.find",title:L(12347,"Find in Notebook"),keybinding:{when:C.and(pr,C.or(Za,mtt),pe.focus.toNegated()),primary:2084,weight:200}})}async runWithContext(a,i){let e=a.get(ee),t=Jn(e.activeEditorPane);if(!t)return;t.getContribution(tC.id).show(void 0,{findScope:{findScopeType:"none"}})}});function Oon(a,i){if(i.uri.scheme===Q.vscodeNotebookCell){let e=Zo.parse(i.uri);if(e&&Qe(e.notebook,a))return!0}return!1}function MSo(a,i){if(i.seedSearchStringFromSelection==="single"){let e=YY(a,i.seedSearchStringFromSelection,i.seedSearchStringFromNonEmptySelection);if(e)return{searchString:e,selection:a.getSelection()}}else if(i.seedSearchStringFromSelection==="multiple"&&!i.updateSearchScope){let e=YY(a,i.seedSearchStringFromSelection);if(e)return{searchString:e,selection:a.getSelection()}}}function PSo(a,i,e){if(!i||!e.hasModel())return!1;if(!i.hasEditorFocus()&&!i.hasWebviewFocus()){let t=a.get(qt),o=t.getFocusedCodeEditor()||t.getActiveCodeEditor();return!!(i.hasModel()&&o&&o.hasModel()&&Oon(i.textModel.uri,o.getModel()))}return!0}function ASo(a,i,e,t=!0){if(!i||!e||!a||!e.hasModel())return!1;let o=MSo(e,{forceRevealReplace:!1,seedSearchStringFromSelection:e.getOption(50).seedSearchStringFromSelection!=="never"?"single":"none",seedSearchStringFromNonEmptySelection:e.getOption(50).seedSearchStringFromSelection==="selection",seedSearchStringFromGlobalClipboard:e.getOption(50).globalFindClipboard,shouldFocus:1,shouldAnimate:!0,updateSearchScope:!1,loop:e.getOption(50).loop}),n,r=e.getModel().uri,s=Zo.parse(r);if(o?.selection&&s){let l=i.getCellByHandle(s.handle);l&&(n={searchStringSeededFrom:{cell:l,range:o.selection},focus:t})}else n={focus:t};return a.show(o?.searchString,n),!0}function NSo(a,i,e){let t=a.get(ee),o=Jn(t.activeEditorPane);if(!PSo(a,o,i))return!1;let n=o?.getContribution(tC.id);return n?n.isVisible()?(e?n.findNext():n.findPrevious(),!0):ASo(n,o,i,!1):!1}async function OSo(a,i){let e=a.get(ee),t=Jn(e.activeEditorPane);if(!t)return;let o=t.getContribution(tC.id);o&&o.isVisible()&&(i?o.findNext():o.findPrevious())}Xli.addImplementation(100,(a,i,e)=>{let t=a.get(ee),o=Jn(t.activeEditorPane);if(!PSo(a,o,i))return!1;let n=o?.getContribution(tC.id);return ASo(n,o,i,!0)});eci.addImplementation(100,(a,i,e)=>{let t=a.get(ee),o=Jn(t.activeEditorPane);if(!o||!i.hasModel())return!1;let n=o.getContribution(tC.id),r=MSo(i,{forceRevealReplace:!1,seedSearchStringFromSelection:i.getOption(50).seedSearchStringFromSelection!=="never"?"single":"none",seedSearchStringFromNonEmptySelection:i.getOption(50).seedSearchStringFromSelection==="selection",seedSearchStringFromGlobalClipboard:i.getOption(50).globalFindClipboard,shouldFocus:1,shouldAnimate:!0,updateSearchScope:!1,loop:i.getOption(50).loop});return n?(n.replace(r?.searchString),!0):!1});Jli.addImplementation(100,(a,i,e)=>NSo(a,i,!0));Zli.addImplementation(100,(a,i,e)=>NSo(a,i,!1));W(class extends K{constructor(){super({id:"notebook.findNext.fromWidget",title:L(12345,"Find Next"),keybinding:{when:C.and(pr,UE),primary:61,mac:{primary:2085,secondary:[61]},weight:201}})}async run(a){return OSo(a,!0)}});W(class extends K{constructor(){super({id:"notebook.findPrevious.fromWidget",title:L(12346,"Find Previous"),keybinding:{when:C.and(pr,UE),primary:1085,mac:{primary:3109,secondary:[1085]},weight:201}})}async run(a){return OSo(a,!1)}});var Fon="notebook.addFindMatchToSelection",Won="notebook.selectAllFindMatches";var Ix={IsNotebookMultiCursor:new Y("isNotebookMultiSelect",!1),NotebookMultiSelectCursorState:new Y("notebookMultiSelectCursorState",0)},eL=class extends x{constructor(e,t,o,n,r,s,l){super();this.notebookEditor=e;this.contextKeyService=t;this.textModelService=o;this.languageConfigurationService=n;this.accessibilityService=r;this.configurationService=s;this.undoRedoService=l;this.word="",this.trackedCells=[],this.totalMatchesCount=0,this._onDidChangeAnchorCell=this._register(new E),this.onDidChangeAnchorCell=this._onDidChangeAnchorCell.event,this.anchorDisposables=this._register(new N),this.cursorsDisposables=this._register(new N),this.cursorsControllers=new gt,this.state=0,this._nbIsMultiSelectSession=Ix.IsNotebookMultiCursor.bindTo(this.contextKeyService),this._nbMultiSelectState=Ix.NotebookMultiSelectCursorState.bindTo(this.contextKeyService),this.anchorCell=this.notebookEditor.activeCellAndCodeEditor,this._register(this.onDidChangeAnchorCell(async()=>{await this.syncCursorsControllers(),this.syncAnchorListeners()}))}static{this.id="notebook.multiCursorController"}getState(){return this.state}syncAnchorListeners(){if(this.anchorDisposables.clear(),!this.anchorCell)throw new Error("Anchor cell is undefined");this.anchorDisposables.add(this.anchorCell[1].onWillType(e=>{let t=new RP;this.trackedCells.forEach(o=>{let n=this.cursorsControllers.get(o.cellViewModel.uri);n&&o.cellViewModel.handle!==this.anchorCell?.[0].handle&&n.type(t,e,"keyboard")})})),this.anchorDisposables.add(this.anchorCell[1].onDidType(()=>{this.state=2,this._nbMultiSelectState.set(2);let e=this.cursorsControllers.get(this.anchorCell[0].uri);if(!e)return;let t=this.notebookEditor.activeCodeEditor?.getSelections();t&&(e.setSelections(new RP,"keyboard",t,3),this.trackedCells.forEach(o=>{let n=this.cursorsControllers.get(o.cellViewModel.uri);n&&(o.initialSelection=n.getSelection(),o.matchSelections=[])}),this.updateLazyDecorations())})),this.anchorDisposables.add(this.anchorCell[1].onDidChangeCursorSelection(e=>{if(e.source==="mouse"){this.resetToIdleState();return}if(!e.oldSelections||e.reason===0||e.reason===2)return;let t={deltaStartCol:e.selection.startColumn-e.oldSelections[0].startColumn,deltaStartLine:e.selection.startLineNumber-e.oldSelections[0].startLineNumber,deltaEndCol:e.selection.endColumn-e.oldSelections[0].endColumn,deltaEndLine:e.selection.endLineNumber-e.oldSelections[0].endLineNumber},o=e.selection.getDirection();this.trackedCells.forEach(n=>{let r=this.cursorsControllers.get(n.cellViewModel.uri);if(!r)return;let s=r.getSelections().map(l=>{let c=l.startColumn+t.deltaStartCol,u=l.startLineNumber+t.deltaStartLine,p=l.endColumn+t.deltaEndCol,h=l.endLineNumber+t.deltaEndLine;return ti.createWithDirection(u,c,h,p,o)});r.setSelections(new RP,e.source,s,3)}),this.updateLazyDecorations()})),this.anchorDisposables.add(this.anchorCell[1].onWillTriggerEditorOperationEvent(e=>{this.handleEditorOperationEvent(e)})),this.anchorDisposables.add(this.anchorCell[1].onDidBlurEditorWidget(()=>{(this.state===1||this.state===2)&&this.resetToIdleState()}))}async syncCursorsControllers(){this.cursorsDisposables.clear(),await Promise.all(this.trackedCells.map(async e=>{let t=await this.createCursorController(e);if(!t)return;this.cursorsControllers.set(e.cellViewModel.uri,t);let o=e.matchSelections;t.setSelections(new RP,void 0,o,3)})),this.updateLazyDecorations()}async createCursorController(e){let o=(await this.textModelService.createModelReference(e.cellViewModel.uri)).object.textEditorModel;if(!o)return;let n=this.constructCursorSimpleModel(e.cellViewModel),r=this.constructCoordinatesConverter(),s=e.editorConfig,l=this.cursorsDisposables.add(new dCe(o,n,r,new _V(o.getLanguageId(),o.getOptions(),s,this.languageConfigurationService)));return l.setSelections(new RP,void 0,e.matchSelections,3),l}constructCoordinatesConverter(){return{convertViewPositionToModelPosition(e){return e},convertViewRangeToModelRange(e){return e},validateViewPosition(e,t){return e},validateViewRange(e,t){return e},convertModelPositionToViewPosition(e,t,o,n){return e},convertModelRangeToViewRange(e,t){return e},modelPositionIsVisible(e){return!0},getModelLineViewLineCount(e){return 1},getViewLineNumberOfModelPosition(e,t){return e}}}constructCursorSimpleModel(e){return{getLineCount(){return e.textBuffer.getLineCount()},getLineContent(t){return e.textBuffer.getLineContent(t)},getLineMinColumn(t){return e.textBuffer.getLineMinColumn(t)},getLineMaxColumn(t){return e.textBuffer.getLineMaxColumn(t)},getLineFirstNonWhitespaceColumn(t){return e.textBuffer.getLineFirstNonWhitespaceColumn(t)},getLineLastNonWhitespaceColumn(t){return e.textBuffer.getLineLastNonWhitespaceColumn(t)},normalizePosition(t,o){return t},getLineIndentColumn(t){return cCe(e.textBuffer.getLineContent(t))+1}}}handleEditorOperationEvent(e){this.trackedCells.forEach(t=>{if(t.cellViewModel.handle===this.anchorCell?.[0].handle)return;let o=new RP,n=this.cursorsControllers.get(t.cellViewModel.uri);n&&this.executeEditorOperation(n,o,e)})}executeEditorOperation(e,t,o){switch(o.handlerId){case"compositionStart":e.startComposition(t);break;case"compositionEnd":e.endComposition(t,o.source);break;case"replacePreviousChar":{let n=o.payload;e.compositionType(t,n.text||"",n.replaceCharCnt||0,0,0,o.source);break}case"compositionType":{let n=o.payload;e.compositionType(t,n.text||"",n.replacePrevCharCnt||0,n.replaceNextCharCnt||0,n.positionDelta||0,o.source);break}case"paste":{let n=o.payload;e.paste(t,n.text||"",n.pasteOnNewLine||!1,n.multicursorText||null,o.source);break}case"cut":e.cut(t,o.source);break}}updateViewModelSelections(){for(let e of this.trackedCells){let t=this.cursorsControllers.get(e.cellViewModel.uri);if(!t)return;e.cellViewModel.setSelections(t.getSelections())}}updateFinalUndoRedo(){if(!this.anchorCell?.[1].getModel())return;let t=new gt,o=[];this.trackedCells.forEach(n=>{if(!n.undoRedoHistory)return;o.push(n.cellViewModel.uri);let s=this.undoRedoService.getElements(n.cellViewModel.uri).past.slice(),l=n.undoRedoHistory.past.slice(),c=s.slice(l.length);c.length!==0&&(t.set(n.cellViewModel.uri,c),this.undoRedoService.removeElements(n.cellViewModel.uri),l.forEach(u=>{this.undoRedoService.pushElement(u)}))}),this.undoRedoService.pushElement({type:1,resources:o,label:"Multi Cursor Edit",code:"multiCursorEdit",confirmBeforeUndo:!1,undo:async()=>{t.forEach(async n=>{n.reverse().forEach(async r=>{await r.undo()})})},redo:async()=>{t.forEach(async n=>{n.forEach(async r=>{await r.redo()})})}})}resetToIdleState(){this.state=0,this._nbMultiSelectState.set(0),this._nbIsMultiSelectSession.set(!1),this.updateFinalUndoRedo(),this.trackedCells.forEach(e=>{this.clearDecorations(e),e.cellViewModel.setSelections([e.initialSelection])}),this.anchorDisposables.clear(),this.anchorCell=void 0,this.cursorsDisposables.clear(),this.cursorsControllers.clear(),this.trackedCells=[],this.totalMatchesCount=0,this.startPosition=void 0,this.word=""}async findAndTrackNextSelection(e){if(this.state===0){let t=e.textModel;if(!t)return;let o=e.getSelections()[0],n=this.getWord(o,t);if(!n)return;this.word=n.word;let r=this.notebookEditor.textModel;if(r){let c=r.findMatches(this.word,!1,!0,xV);this.totalMatchesCount=c.reduce((u,p)=>u+p.matches.length,0)}let s=this.notebookEditor.getCellIndex(e);if(s===void 0)return;this.startPosition={cellIndex:s,position:new ye(o.startLineNumber,n.startColumn)};let l=new ti(o.startLineNumber,n.startColumn,o.startLineNumber,n.endColumn);if(e.setSelections([l]),this.anchorCell=this.notebookEditor.activeCellAndCodeEditor,!this.anchorCell||this.anchorCell[0].handle!==e.handle)throw new Error("Active cell is not the same as the cell passed as context");if(!(this.anchorCell[1]instanceof Xr))throw new Error("Active cell is not an instance of CodeEditorWidget");await this.updateTrackedCell(e,[l]),this._nbIsMultiSelectSession.set(!0),this.state=1,this._nbMultiSelectState.set(1),this._onDidChangeAnchorCell.fire()}else if(this.state===1){let t=this.notebookEditor.textModel;if(!t)return;let o=this.notebookEditor.getCellIndex(e);if(o===void 0||!this.startPosition||this.trackedCells.reduce((l,c)=>l+c.matchSelections.length,0)>=this.totalMatchesCount)return;let r=t.findNextMatch(this.word,{cellIndex:o,position:e.getSelections()[e.getSelections().length-1].getEndPosition()},!1,!0,xV,this.startPosition);if(!r)return;let s=this.notebookEditor.getCellByHandle(r.cell.handle);if(!s)return;if(r.cell.handle===e.handle){let l=[...e.getSelections(),ti.fromRange(r.match.range,0)],c=await this.updateTrackedCell(e,l);s.setSelections(c.matchSelections)}else if(r.cell.handle!==e.handle){await this.notebookEditor.revealRangeInViewAsync(s,r.match.range),await this.notebookEditor.focusNotebookCell(s,"editor");let l=await this.updateTrackedCell(s,[ti.fromRange(r.match.range,0)]);if(s.setSelections(l.matchSelections),this.anchorCell=this.notebookEditor.activeCellAndCodeEditor,!this.anchorCell||!(this.anchorCell[1]instanceof Xr))throw new Error("Active cell is not an instance of CodeEditorWidget");this._onDidChangeAnchorCell.fire(),this.initializeMultiSelectDecorations(this.trackedCells.find(c=>c.cellViewModel.handle===e.handle))}}}async selectAllMatches(e,t){let o=this.notebookEditor.textModel;o&&(t?await this.handleFindWidgetSelectAllMatches(t):await this.handleCellEditorSelectAllMatches(o,e),await this.syncCursorsControllers(),this.syncAnchorListeners(),this.updateLazyDecorations())}async handleFindWidgetSelectAllMatches(e){if(this.state===0&&e.length){await this.notebookEditor.focusNotebookCell(e[0].cell,"editor"),this.anchorCell=this.notebookEditor.activeCellAndCodeEditor,this.trackedCells=[];for(let t of e)this.updateTrackedCell(t.cell,t.contentMatches.map(o=>ti.fromRange(o.range,0))),this.anchorCell&&t.cell.handle===this.anchorCell[0].handle&&t.cell.setSelections(t.contentMatches.map(o=>ti.fromRange(o.range,0)));this._nbIsMultiSelectSession.set(!0),this.state=1,this._nbMultiSelectState.set(1)}}async handleCellEditorSelectAllMatches(e,t){if(this.state===0){let o=t.textModel;if(!o)return;let n=t.getSelections()[0],r=this.getWord(n,o);if(!r)return;this.word=r.word;let s=this.notebookEditor.getCellIndex(t);if(s===void 0)return;if(this.startPosition={cellIndex:s,position:new ye(n.startLineNumber,r.startColumn)},this.anchorCell=this.notebookEditor.activeCellAndCodeEditor,!this.anchorCell||this.anchorCell[0].handle!==t.handle)throw new Error("Active cell is not the same as the cell passed as context");if(!(this.anchorCell[1]instanceof Xr))throw new Error("Active cell is not an instance of CodeEditorWidget");let l=e.findMatches(this.word,!1,!0,xV);this.trackedCells=[];for(let c of l)if(await this.updateTrackedCell(c.cell,c.matches.map(u=>ti.fromRange(u.range,0))),c.cell.handle===t.handle){let u=this.notebookEditor.getCellByHandle(c.cell.handle);u&&u.setSelections(c.matches.map(p=>ti.fromRange(p.range,0)))}this._nbIsMultiSelectSession.set(!0),this.state=1,this._nbMultiSelectState.set(1)}else if(this.state===1){let o=e.findMatches(this.word,!1,!0,xV);for(let n of o)await this.updateTrackedCell(n.cell,n.matches.map(r=>ti.fromRange(r.range,0)))}}async updateTrackedCell(e,t){let o=e instanceof f8?this.notebookEditor.getCellByHandle(e.handle):e;if(!o)throw new Error("Cell not found");let n=this.trackedCells.find(r=>r.cellViewModel.handle===o.handle);if(n)this.clearDecorations(n),n.matchSelections=t;else{let r=o.getSelections()[0];(await o.resolveTextModel()).pushStackElement();let l=this.constructCellEditorOptions(o),c=l.getRawOptions(),u={cursorStyle:Zgt(c.cursorStyle),cursorBlinking:JZt(c.cursorBlinking),cursorSmoothCaretAnimation:c.cursorSmoothCaretAnimation};n={cellViewModel:o,initialSelection:r,matchSelections:t,editorConfig:l,cursorConfig:u,decorationIds:[],undoRedoHistory:this.undoRedoService.getElements(o.uri)},this.trackedCells.push(n)}return n}async deleteLeft(){this.trackedCells.forEach(e=>{let t=this.cursorsControllers.get(e.cellViewModel.uri);if(!t)return;let[,o]=gO.deleteLeft(t.getPrevEditOperationType(),t.context.cursorConfig,t.context.model,t.getSelections(),t.getAutoClosedCharacters()),n=oY.executeCommands(t.context.model,t.getSelections(),o);n&&t.setSelections(new RP,void 0,n,3)}),this.updateLazyDecorations()}async deleteRight(){this.trackedCells.forEach(e=>{let t=this.cursorsControllers.get(e.cellViewModel.uri);if(!t)return;let[,o]=gO.deleteRight(t.getPrevEditOperationType(),t.context.cursorConfig,t.context.model,t.getSelections());if(e.cellViewModel.handle!==this.anchorCell?.[0].handle){let n=oY.executeCommands(t.context.model,t.getSelections(),o);if(!n)return;t.setSelections(new RP,void 0,n,3)}else t.setSelections(new RP,void 0,e.cellViewModel.getSelections(),3)}),this.updateLazyDecorations()}async undo(){let e=[];for(let t of this.trackedCells){let o=await t.cellViewModel.resolveTextModel();o&&e.push(o)}await Promise.all(e.map(t=>t.undo())),this.updateViewModelSelections(),this.updateLazyDecorations()}async redo(){let e=[];for(let t of this.trackedCells){let o=await t.cellViewModel.resolveTextModel();o&&e.push(o)}await Promise.all(e.map(t=>t.redo())),this.updateViewModelSelections(),this.updateLazyDecorations()}constructCellEditorOptions(e){let t=new oW(this.notebookEditor.getBaseCellEditorOptions(e.language),this.notebookEditor.notebookOptions,this.configurationService),o=t.getUpdatedValue(e.internalMetadata,e.uri);return t.dispose(),new x7(!1,D.EditorContent,o,null,this.accessibilityService)}initializeMultiSelectDecorations(e){if(!e)return;let t=[];e.matchSelections.forEach(o=>{t.push({range:ti.fromPositions(o.getEndPosition()),options:{description:"",className:this.getClassName(e.cursorConfig,!0)}})}),e.decorationIds=e.cellViewModel.deltaModelDecorations(e.decorationIds,t)}updateLazyDecorations(){this.trackedCells.forEach(e=>{if(e.cellViewModel.handle===this.anchorCell?.[0].handle)return;let t=this.cursorsControllers.get(e.cellViewModel.uri);if(!t)return;let o=t.getSelections(),n=[];o?.map(r=>{r.isEmpty()||n.push({range:r,options:{description:"",className:this.getClassName(e.cursorConfig,!1)}}),n.push({range:ti.fromPositions(r.getPosition()),options:{description:"",zIndex:1e4,className:this.getClassName(e.cursorConfig,!0)}})}),e.decorationIds=e.cellViewModel.deltaModelDecorations(e.decorationIds,n)})}clearDecorations(e){e.decorationIds=e.cellViewModel.deltaModelDecorations(e.decorationIds,[])}getWord(e,t){let o=e.startLineNumber,n=e.startColumn;return t.isDisposed()?null:t.getWordAtPosition({lineNumber:o,column:n})}getClassName(e,t){let o=t?".nb-multicursor-cursor":".nb-multicursor-selection";if(t){switch(e.cursorStyle){case 1:break;case 2:o+=".nb-cursor-block-style";break;case 3:o+=".nb-cursor-underline-style";break;case 4:o+=".nb-cursor-line-thin-style";break;case 5:o+=".nb-cursor-block-outline-style";break;case 6:o+=".nb-cursor-underline-thin-style";break;default:break}switch(e.cursorBlinking){case 1:o+=".nb-blink";break;case 2:o+=".nb-smooth";break;case 3:o+=".nb-phase";break;case 4:o+=".nb-expand";break;case 5:o+=".nb-solid";break;default:o+=".nb-solid";break}(e.cursorSmoothCaretAnimation==="on"||e.cursorSmoothCaretAnimation==="explicit")&&(o+=".nb-smooth-caret-animation")}return o}dispose(){super.dispose(),this.anchorDisposables.dispose(),this.cursorsDisposables.dispose(),this.trackedCells.forEach(e=>{this.clearDecorations(e)}),this.trackedCells=[]}};eL=I([m(1,X),m(2,Bt),m(3,Rs),m(4,Oi),m(5,B),m(6,Ml)],eL);var JLi=class extends mp{constructor(){super({id:Won,title:d(12379,null),precondition:C.and(C.equals("config.notebook.multiCursor.enabled",!0)),keybinding:{when:C.or(C.and(C.equals("config.notebook.multiCursor.enabled",!0),Za,SM),C.and(C.equals("config.notebook.multiCursor.enabled",!0),eUt)),primary:3114,weight:200}})}async runWithContext(i,e){let t=i.get(ee),o=Jn(t.activeEditorPane);if(!o||!e.cell)return;let n=o.getContribution(eL.id),r=o.getContribution(tC.id);if(r.widget.isFocused){let s=r.widget.findModel;n.selectAllMatches(e.cell,s.findMatches)}else n.selectAllMatches(e.cell)}},ZLi=class extends mp{constructor(){super({id:Fon,title:d(12375,null),precondition:C.and(C.equals("config.notebook.multiCursor.enabled",!0),Za,SM),keybinding:{when:C.and(C.equals("config.notebook.multiCursor.enabled",!0),Za,SM),primary:2082,weight:200}})}async runWithContext(i,e){let t=i.get(ee),o=Jn(t.activeEditorPane);if(!o||!e.cell)return;o.getContribution(eL.id).findAndTrackNextSelection(e.cell)}},eRi=class extends mp{constructor(){super({id:"noteMultiCursor.exit",title:d(12378,null),precondition:C.and(C.equals("config.notebook.multiCursor.enabled",!0),Za,Ix.IsNotebookMultiCursor),keybinding:{when:C.and(C.equals("config.notebook.multiCursor.enabled",!0),Za,Ix.IsNotebookMultiCursor),primary:9,weight:200}})}async runWithContext(i,e){let t=i.get(ee),o=Jn(t.activeEditorPane);if(!o)return;o.getContribution(eL.id).resetToIdleState()}},tRi=class extends mp{constructor(){super({id:"noteMultiCursor.deleteLeft",title:d(12376,null),precondition:C.and(C.equals("config.notebook.multiCursor.enabled",!0),Za,Ix.IsNotebookMultiCursor,C.or(Ix.NotebookMultiSelectCursorState.isEqualTo(1),Ix.NotebookMultiSelectCursorState.isEqualTo(2))),keybinding:{when:C.and(C.equals("config.notebook.multiCursor.enabled",!0),Za,Ix.IsNotebookMultiCursor,C.or(Ix.NotebookMultiSelectCursorState.isEqualTo(1),Ix.NotebookMultiSelectCursorState.isEqualTo(2))),primary:1,weight:200}})}async runWithContext(i,e){let t=i.get(ee),o=Jn(t.activeEditorPane);if(!o)return;o.getContribution(eL.id).deleteLeft()}},iRi=class extends mp{constructor(){super({id:"noteMultiCursor.deleteRight",title:d(12377,null),precondition:C.and(C.equals("config.notebook.multiCursor.enabled",!0),Za,Ix.IsNotebookMultiCursor,C.or(Ix.NotebookMultiSelectCursorState.isEqualTo(1),Ix.NotebookMultiSelectCursorState.isEqualTo(2))),keybinding:{when:C.and(C.equals("config.notebook.multiCursor.enabled",!0),Za,Ix.IsNotebookMultiCursor,C.or(Ix.NotebookMultiSelectCursorState.isEqualTo(1),Ix.NotebookMultiSelectCursorState.isEqualTo(2))),primary:20,weight:200}})}async runWithContext(i,e){let t=i.get(ee),o=Jn(t.activeEditorPane);if(!o)return;let n=o.activeCodeEditor;if(!n)return;zL.DeleteRight.runEditorCommand(i,n,null),o.getContribution(eL.id).deleteRight()}},fFe=class extends x{constructor(e,t){super();this._editorService=e;this.configurationService=t;if(!this.configurationService.getValue("notebook.multiCursor.enabled"))return;let o=10005;this._register(S_.addImplementation(o,"notebook-multicursor-undo-redo",()=>{let n=Jn(this._editorService.activeEditorPane);return!n||!n.hasModel()?!1:n.getContribution(eL.id).undo()},C.and(C.equals("config.notebook.multiCursor.enabled",!0),Za,Ix.IsNotebookMultiCursor))),this._register(I_.addImplementation(o,"notebook-multicursor-undo-redo",()=>{let n=Jn(this._editorService.activeEditorPane);return!n||!n.hasModel()?!1:n.getContribution(eL.id).redo()},C.and(C.equals("config.notebook.multiCursor.enabled",!0),Za,Ix.IsNotebookMultiCursor)))}static{this.ID="workbench.contrib.notebook.multiCursorUndoRedo"}};fFe=I([m(0,ee),m(1,B)],fFe);bm(eL.id,eL);It(fFe.ID,fFe,St.BlockRestore);W(JLi);W(ZLi);W(eRi);W(tRi);W(iRi);var Ent=class{constructor(i){this._editorService=i}canParticipate(){let e=Jn(this._editorService.activeEditorPane)?.getContribution(eL.id);return e?e.getState()!==2:!0}},Int=class{constructor(i,e,t,o,n,r){this.editorWorkerService=i;this.languageFeaturesService=e;this.instantiationService=t;this.textModelService=o;this.bulkEditService=n;this.configurationService=r}async participate(i,e,t,o){if(!i.model||!(i.model instanceof XB)||e.reason===2||!this.configurationService.getValue(yt.formatOnSave))return;t.report({message:d(12415,null)});let r=i.model.notebookModel,s=await this.instantiationService.invokeFunction(Bge.checkAndRunFormatCodeAction,r,t,o),l=new N;try{if(!s){let c=await Promise.all(r.cells.map(async u=>{let p=await this.textModelService.createModelReference(u.uri);l.add(p);let h=p.object.textEditorModel,g=await n8e(this.editorWorkerService,this.languageFeaturesService,h,2,o),f=[];return g?(f.push(...g.map(v=>new nl(h.uri,v,h.getVersionId()))),f):[]}));await this.bulkEditService.apply(c.flat(),{label:d(12413,null),code:"undoredo.formatNotebook"})}}finally{t.report({increment:100}),l.dispose()}}};Int=I([m(0,Qs),m(1,Qt),m(2,F),m(3,Bt),m(4,La),m(5,B)],Int);var ynt=class extends Ent{constructor(e,t,o,n){super(t);this.configurationService=e;this.editorService=t;this.textModelService=o;this.bulkEditService=n}async participate(e,t,o,n){let r=this.configurationService.getValue("files.trimTrailingWhitespace"),s=this.configurationService.getValue("files.trimTrailingWhitespaceInRegexAndStrings");r&&this.canParticipate()&&await this.doTrimTrailingWhitespace(e,t.reason===2,s,o)}async doTrimTrailingWhitespace(e,t,o,n){if(!e.model||!(e.model instanceof XB))return;let r=new N,s=e.model.notebookModel,l=oRi(this.editorService),c=[],u=[];try{let h=(await Promise.all(s.cells.map(async g=>{if(g.cellKind!==2)return[];let f=await this.textModelService.createModelReference(g.uri);r.add(f);let v=f.object.textEditorModel;if(l&&g.uri.toString()===l.getModel()?.uri.toString()&&(u=l.getSelections()??[],t)){c=u.map(w=>w.getPosition());let y=vs.get(l)?.getSessionEnclosingRange();if(y)for(let w=y.startLineNumber;w<=y.endLineNumber;w++)c.push(new ye(w,v.getLineMaxColumn(w)))}let S=u8e(v,c,o);return S.length?S.map(y=>new nl(v.uri,{...y,text:y.text||""},v.getVersionId())):[]}))).flat().filter(g=>g!==void 0);await this.bulkEditService.apply(h,{label:d(12420,null),code:"undoredo.notebookTrimTrailingWhitespace"})}finally{n.report({increment:100}),r.dispose()}}};ynt=I([m(0,B),m(1,ee),m(2,Bt),m(3,La)],ynt);var wnt=class extends Ent{constructor(e,t,o){super(t);this.configurationService=e;this.editorService=t;this.bulkEditService=o}async participate(e,t,o,n){this.configurationService.getValue("files.trimFinalNewlines")&&this.canParticipate()&&await this.doTrimFinalNewLines(e,t.reason===2,o)}findLastNonEmptyLine(e){for(let t=e.getLineCount();t>=1;t--)if(e.getLineLength(t))return t;return 0}async doTrimFinalNewLines(e,t,o){if(!e.model||!(e.model instanceof XB))return;let n=new N,r=e.model.notebookModel,s=oRi(this.editorService);try{let c=(await Promise.all(r.cells.map(async u=>{if(u.cellKind!==2)return;let p=0,h=s&&u.uri.toString()===s.getModel()?.uri.toString();if(t&&h){let S=s.getSelections()??[];for(let y of S)p=Math.max(p,y.selectionStartLineNumber)}let g=u.textBuffer,f=this.findLastNonEmptyLine(g),v=Math.max(f+1,p+1);if(v>g.getLineCount())return;let b=new z(v,1,g.getLineCount(),g.getLineLastNonWhitespaceColumn(g.getLineCount()));if(!b.isEmpty())return new nl(u.uri,{range:b,text:""},u.textModel?.getVersionId())}))).flat().filter(u=>u!==void 0);await this.bulkEditService.apply(c,{label:d(12419,null),code:"undoredo.trimFinalNewLines"})}finally{o.report({increment:100}),n.dispose()}}};wnt=I([m(0,B),m(1,ee),m(2,La)],wnt);var Cnt=class extends Ent{constructor(e,t,o){super(o);this.configurationService=e;this.bulkEditService=t;this.editorService=o}async participate(e,t,o,n){this.configurationService.getValue(yt.insertFinalNewline)&&this.canParticipate()&&await this.doInsertFinalNewLine(e,t.reason===2,o)}async doInsertFinalNewLine(e,t,o){if(!e.model||!(e.model instanceof XB))return;let n=new N,r=e.model.notebookModel,s=oRi(this.editorService),l;s&&(l=s.getSelections()??[]);try{let u=(await Promise.all(r.cells.map(async p=>{if(p.cellKind!==2)return;let h=p.textBuffer.getLineCount(),g=p.textBuffer.getLineFirstNonWhitespaceColumn(h)===0;if(!(!h||g))return new nl(p.uri,{range:new z(h+1,p.textBuffer.getLineLength(h),h+1,p.textBuffer.getLineLength(h)),text:p.textBuffer.getEOL()},p.textModel?.getVersionId())}))).filter(p=>p!==void 0);await this.bulkEditService.apply(u,{label:d(12414,null),code:"undoredo.insertFinalNewLine"}),s&&l&&s.setSelections(l)}finally{o.report({increment:100}),n.dispose()}}};Cnt=I([m(0,B),m(1,La),m(2,ee)],Cnt);var xnt=class{constructor(i,e,t,o,n){this.configurationService=i;this.logService=e;this.workspaceTrustManagementService=t;this.textModelService=o;this.instantiationService=n}async participate(i,e,t,o){if(!this.workspaceTrustManagementService.isWorkspaceTrusted()||!i.model||!(i.model instanceof XB))return;let r="";if(e.reason===2)return;if(e.reason===1)r="explicit";else return;let s=i.model.notebookModel,l=this.configurationService.getValue(yt.codeActionsOnSave),c=Array.isArray(l)?l:Object.keys(l).filter(v=>l[v]),u=this.createCodeActionsOnSave(c),p=u.filter(v=>l[v.value]==="never"||l[v.value]===!1),h=u.filter(v=>l[v.value]===r||l[v.value]===!0),g=h.filter(v=>!xr.Notebook.contains(v)),f=h.filter(v=>xr.Notebook.contains(v));if(f.length){let v=new N;t.report({message:d(12418,null)});try{let b=s.cells[0],S=await this.textModelService.createModelReference(b.uri);v.add(S);let y=S.object.textEditorModel;await this.instantiationService.invokeFunction(Bge.applyOnSaveGenericCodeActions,y,f,p,t,o)}catch{this.logService.error("Failed to apply notebook code action on save")}finally{t.report({increment:100}),v.dispose()}}if(g.length){Array.isArray(l)||g.sort((b,S)=>xr.SourceFixAll.contains(b)?xr.SourceFixAll.contains(S)?0:-1:xr.SourceFixAll.contains(S)?1:0);let v=new N;t.report({message:d(12416,null)});try{await Promise.all(s.cells.map(async b=>{let S=await this.textModelService.createModelReference(b.uri);v.add(S);let y=S.object.textEditorModel;await this.instantiationService.invokeFunction(Bge.applyOnSaveGenericCodeActions,y,g,p,t,o)}))}catch{this.logService.error("Failed to apply code action on save")}finally{t.report({increment:100}),v.dispose()}}}createCodeActionsOnSave(i){let e=i.map(t=>new fs(t));return e.filter(t=>e.every(o=>o.equals(t)||!o.contains(t)))}};xnt=I([m(0,B),m(1,se),m(2,Nr),m(3,Bt),m(4,F)],xnt);var Bge=class a{static async checkAndRunFormatCodeAction(i,e,t,o){let n=i.get(F),r=i.get(Bt),s=i.get(se),l=i.get(B),c=new N,u=!1;t.report({message:d(12417,null)});try{let p=e.cells[0],h=await r.createModelReference(p.uri);c.add(h);let g=h.object.textEditorModel,f=l.getValue(yt.defaultFormatter);u=await n.invokeFunction(a.applyOnSaveFormatCodeAction,g,new fs("notebook.format"),[],f,t,o)}catch{s.error("Failed to apply notebook format action on save")}finally{t.report({increment:100}),c.dispose()}return u}static async applyOnSaveGenericCodeActions(i,e,t,o,n,r){let s=i.get(F),l=i.get(Qt),c=i.get(se),u=new class{constructor(){this._names=new Set}_report(){n.report({message:d(12412,null,[...this._names].map(p=>`'${p}'`).join(", "),"command:workbench.action.openSettings?%5B%22notebook.codeActionsOnSave%22%5D")})}report(p){p.displayName&&!this._names.has(p.displayName)&&(this._names.add(p.displayName),this._report())}};for(let p of t){let h=await a.getActionsToRun(e,p,o,l,u,r);if(r.isCancellationRequested){h.dispose();return}try{for(let g of h.validActions){let f=g.action.edit?.edits,v=!1;if(!g.action.kind?.startsWith("notebook"))for(let b of f??[]){let S=b;if(!(S.resource&&Qe(S.resource,e.uri))){v=!0;break}}if(v){c.warn("Failed to apply code action on save, applied to multiple resources.");continue}if(n.report({message:d(12411,null,g.action.title)}),await s.invokeFunction(i5,g,"onSave",{},r),r.isCancellationRequested)return}}catch{}finally{h.dispose()}}}static async applyOnSaveFormatCodeAction(i,e,t,o,n,r,s){let l=i.get(F),c=i.get(Qt),u=i.get(se),p=new class{constructor(){this._names=new Set}_report(){r.report({message:d(12412,null,[...this._names].map(g=>`'${g}'`).join(", "),"command:workbench.action.openSettings?%5B%22notebook.defaultFormatter%22%5D")})}report(g){g.displayName&&!this._names.has(g.displayName)&&(this._names.add(g.displayName),this._report())}},h=await a.getActionsToRun(e,t,o,c,p,s);if(h.validActions.length>1&&!n&&u.warn("More than one format code action is provided, the 0th one will be used. A default can be specified via `notebook.defaultFormatter` in your settings."),s.isCancellationRequested)return h.dispose(),!1;try{let g=n?h.validActions.find(f=>f.provider?.extensionId===n):h.validActions[0];if(!g||(r.report({message:d(12411,null,g.action.title)}),await l.invokeFunction(i5,g,"onSave",{},s),s.isCancellationRequested))return!1}catch{return u.error("Failed to apply notebook format code action on save"),!1}finally{h.dispose()}return!0}static getActionsToRun(i,e,t,o,n,r){return hR(o.codeActionProvider,i,i.getFullModelRange(),{type:1,triggerAction:"save participants",filter:{include:e,excludes:t,includeSourceActions:!0}},n,r)}};function oRi(a){let i=a.activeEditorPane;return Jn(i)?.activeCodeEditor}var knt=class extends x{constructor(e,t){super();this.instantiationService=e;this.workingCopyFileService=t;this.registerSaveParticipants()}registerSaveParticipants(){this._register(this.workingCopyFileService.addSaveParticipant(this.instantiationService.createInstance(ynt))),this._register(this.workingCopyFileService.addSaveParticipant(this.instantiationService.createInstance(xnt))),this._register(this.workingCopyFileService.addSaveParticipant(this.instantiationService.createInstance(Int))),this._register(this.workingCopyFileService.addSaveParticipant(this.instantiationService.createInstance(Cnt))),this._register(this.workingCopyFileService.addSaveParticipant(this.instantiationService.createInstance(wnt)))}};knt=I([m(0,F),m(1,qp)],knt);var Von=ne.as(Qi.Workbench);Von.registerWorkbenchContribution(knt,3);W(class extends K{constructor(){super({id:"notebook.format",title:L(12369,"Format Notebook"),category:th,precondition:C.and(Za,Xl),keybinding:{when:pe.editorTextFocus.toNegated(),primary:1572,linux:{primary:3111},weight:200},f1:!0,menu:{id:D.EditorContext,when:C.and(pe.inCompositeEditor,pe.hasDocumentFormattingProvider),group:"1_modification",order:1.3}})}async run(a){let i=a.get(ee),e=a.get(Bt),t=a.get(Qs),o=a.get(Qt),n=a.get(La),r=a.get(F),s=Jn(i.activeEditorPane);if(!s||!s.hasModel())return;let l=s.textModel,c=await r.invokeFunction(Bge.checkAndRunFormatCodeAction,l,Mm.None,Se.None),u=new N;try{if(!c){let p=await Promise.all(l.cells.map(async h=>{let g=await e.createModelReference(h.uri);u.add(g);let f=g.object.textEditorModel,v=await n8e(t,o,f,1,Se.None),b=[];if(v){for(let S of v)b.push(new nl(f.uri,S,f.getVersionId()));return b}return[]}));await n.apply(p.flat(),{label:d(12372,null),code:"undoredo.formatNotebook"})}}finally{u.dispose()}}});ni(class extends Di{constructor(){super({id:"notebook.formatCell",label:L(12370,"Format Cell"),precondition:C.and(Za,Xl,pe.inCompositeEditor,pe.writable,pe.hasDocumentFormattingProvider),kbOpts:{kbExpr:C.and(pe.editorTextFocus),primary:1572,linux:{primary:3111},weight:100},contextMenuOpts:{group:"1_modification",order:1.301}})}async run(i,e){e.hasModel()&&await i.get(F).invokeFunction(jce,e,1,Mm.None,Se.None,!0)}});var Tnt=class{constructor(i,e,t,o,n,r){this.bulkEditService=i;this.languageFeaturesService=e;this.textModelService=t;this.editorWorkerService=o;this.configurationService=n;this._notebookService=r}async onWillExecuteCell(i){if(!this.configurationService.getValue(yt.formatOnCellExecution))return;let t=new N;try{let o=await Promise.all(i.map(async n=>{let r=this._notebookService.getNotebookTextModel(n.notebook);if(!r)return[];let s;for(let h of r.cells)if(h.handle===n.cellHandle){s=h;break}if(!s)return[];let l=await this.textModelService.createModelReference(s.uri);t.add(l);let c=l.object.textEditorModel,u=await n8e(this.editorWorkerService,this.languageFeaturesService,c,2,Se.None),p=[];return u?(p.push(...u.map(h=>new nl(c.uri,h,c.getVersionId()))),p):[]}));await this.bulkEditService.apply(o.flat(),{label:d(12371,null),code:"undoredo.notebooks.onWillExecuteFormat"})}finally{t.dispose()}}};Tnt=I([m(0,La),m(1,Qt),m(2,Bt),m(3,Qs),m(4,B),m(5,bn)],Tnt);var _nt=class extends x{constructor(e,t){super();this.instantiationService=e;this.notebookExecutionService=t;this.registerKernelExecutionParticipants()}registerKernelExecutionParticipants(){this._register(this.notebookExecutionService.registerExecutionParticipant(this.instantiationService.createInstance(Tnt)))}};_nt=I([m(0,F),m(1,eJ)],_nt);var Bon=ne.as(Qi.Workbench);Bon.registerWorkbenchContribution(_nt,3);var XKt="hasOpenedNotebook",FSo="hasShownNotebookGettingStarted",Dnt=class extends x{constructor(i,e,t,o,n){super();let r=umo.bindTo(t),s=new Al("notebookGettingStarted2",e),l=s.getMemento(0,0);l[XKt]&&r.set(!0);let c=n.getValue(yt.openGettingStarted)&&!l[FSo];if(!l[XKt]||c){let u=()=>{r.set(!0),l[XKt]=!0,c&&(o.executeCommand("workbench.action.openWalkthrough",{category:"notebooks",step:"notebookProfile"},!0),l[FSo]=!0),s.saveMemento()};if(i.activeEditor?.typeId===Ra.ID){u();return}let p=this._register(i.onDidActiveEditorChange(()=>{i.activeEditor?.typeId===Ra.ID&&(p.dispose(),u())}))}}};Dnt=I([m(0,ee),m(1,ce),m(2,X),m(3,ge),m(4,B)],Dnt);ne.as(Qi.Workbench).registerWorkbenchContribution(Dnt,3);W(class extends K{constructor(){super({id:"workbench.notebook.layout.gettingStarted",title:L(12373,"Reset notebook getting started"),f1:!0,precondition:C.equals(`config.${yt.openGettingStarted}`,!0),category:Ve.Developer})}run(i){let e=i.get(ce),t=new Al("notebookGettingStarted",e),o=t.getMemento(0,0);o[XKt]=void 0,t.saveMemento()}});var Hon="notebook.toggleCellToolbarPosition",nRi=class extends K{constructor(){super({id:Hon,title:L(12374,"Toggle Cell Toolbar Position"),menu:[{id:D.NotebookCellTitle,group:"View",order:1}],category:th,f1:!1})}async run(i,e){let t=e&&e.ui?e.notebookEditor:void 0;if(t&&t.hasModel()){let o=t.textModel.viewType,n=i.get(B),r=n.getValue(yt.cellToolbarLocation),s=this.togglePosition(o,r);await n.updateValue(yt.cellToolbarLocation,s)}}togglePosition(i,e){if(typeof e=="string")if(["left","right","hidden"].indexOf(e)>=0){let t=e==="right"?"left":"right",o={default:e};return o[i]=t,o}else{let t={default:"right"};return t[i]="left",t}else{let o=(e[i]??e.default??"right")==="right"?"left":"right",n={...e};return n[i]=o,n}}};W(nRi);var vFe=class{constructor(i,e,t){this._markerService=i;this._configService=t;this._dispoables=e.registerProvider(this)}static{this.ID="workbench.contrib.markerListProvider"}dispose(){this._dispoables.dispose()}getMarkerList(i){if(!i)return;let e=Zo.parse(i);if(e)return new Oce(t=>Zo.parse(t)?.notebook.toString()===e.notebook.toString(),this._markerService,this._configService)}};vFe=I([m(0,oa),m(1,K3e),m(2,B)],vFe);var Hge=class extends x{constructor(e,t){super();this._notebookEditor=e;this._markerService=t;this._markersOverviewRulerDecorations=[];this._update(),this._register(this._notebookEditor.onDidChangeModel(()=>this._update())),this._register(this._markerService.onMarkerChanged(o=>{o.some(n=>this._notebookEditor.getCellsInRange().some(r=>Qe(r.uri,n)))&&this._update()}))}static{this.id="workbench.notebook.markerDecoration"}_update(){if(!this._notebookEditor.hasModel())return;let e=[];this._notebookEditor.getCellsInRange().forEach(t=>{this._markerService.read({resource:t.uri,severities:12}).forEach(n=>{let r=n.severity===8?Iv:jh,s={startLineNumber:n.startLineNumber,startColumn:n.startColumn,endLineNumber:n.endLineNumber,endColumn:n.endColumn};e.push({handle:t.handle,options:{overviewRuler:{color:r,modelRanges:[s],includeOutput:!1,position:4}}})})}),this._markersOverviewRulerDecorations=this._notebookEditor.deltaCellDecorations(this._markersOverviewRulerDecorations,e)}};I([_P(100)],Hge.prototype,"_update",1),Hge=I([m(1,oa)],Hge);It(vFe.ID,vFe,St.BlockRestore);bm(Hge.id,Hge);var Uon="notebook.focusTop",zon="notebook.focusBottom",Kon="notebook.focusPreviousEditor",Gon="notebook.focusNextEditor",qon="notebook.cell.focusInOutput",$on="notebook.cell.focusOutOutput",rRi="notebook.centerActiveCell",jon="notebook.cell.cursorPageUp",Qon="notebook.cell.cursorPageUpSelect",Yon="notebook.cell.cursorPageDown",Xon="notebook.cell.cursorPageDownSelect";W(class extends K{constructor(){super({id:"notebook.cell.nullAction",title:d(12390,null),keybinding:[{when:ote,primary:18,weight:201},{when:ote,primary:16,weight:201}],f1:!1})}run(){}});W(class extends Pd{constructor(){super({id:Gon,title:d(12380,null),keybinding:[{when:C.and(pr,$a.negate(),C.equals("config.notebook.navigation.allowNavigateToSurroundingCells",!0),C.and(C.has(np),pe.editorTextFocus,Lde.notEqualsTo("top"),Lde.notEqualsTo("none"),C.or(Rde.isEqualTo("end"),Rde.isEqualTo("both"))),pe.isEmbeddedDiffEditor.negate()),primary:18,weight:Df},{when:C.and(pr,$a.negate(),C.equals("config.notebook.navigation.allowNavigateToSurroundingCells",!0),C.and(NS.isEqualTo("markup"),nte.isEqualTo(!1),gtt),pe.isEmbeddedDiffEditor.negate()),primary:18,weight:200},{when:C.and(pr,bM),primary:2066,mac:{primary:2322},weight:200},{when:C.and(SM,$a),primary:2060,mac:{primary:267},weight:201}]})}async runWithContext(i,e){let t=e.notebookEditor,o=e.cell,n=t.getCellIndex(o);if(typeof n!="number"||n>=t.getLength()-1)return;let r=o.textBuffer.getLineCount(),s=e.cell??e.selectedCells?.[0],l=s?ste(e,s):void 0;if(l&&l.hasTextFocus()&&Nd.get(l)?.getWidgetPosition()?.lineNumber===r)Nd.get(l)?.focus();else{let c=t.cellAt(n+1),u=c.cellKind===1&&c.getEditState()===0?"container":"editor";await t.focusNotebookCell(c,u,{focusEditorLine:1})}}});W(class extends Pd{constructor(){super({id:Kon,title:d(12381,null),keybinding:[{when:C.and(pr,$a.negate(),C.equals("config.notebook.navigation.allowNavigateToSurroundingCells",!0),C.and(C.has(np),pe.editorTextFocus,Lde.notEqualsTo("bottom"),Lde.notEqualsTo("none"),C.or(Rde.isEqualTo("start"),Rde.isEqualTo("both"))),pe.isEmbeddedDiffEditor.negate()),primary:16,weight:Df},{when:C.and(pr,$a.negate(),C.equals("config.notebook.navigation.allowNavigateToSurroundingCells",!0),C.and(NS.isEqualTo("markup"),nte.isEqualTo(!1),gtt),pe.isEmbeddedDiffEditor.negate()),primary:16,weight:200},{when:C.and(SM,$a),primary:2059,mac:{primary:267},weight:201}]})}async runWithContext(i,e){let t=e.notebookEditor,o=e.cell,n=t.getCellIndex(o);if(typeof n!="number"||n<1||t.getLength()===0)return;let r=t.cellAt(n-1),s=r.cellKind===1&&r.getEditState()===0?"container":"editor",l=r.textBuffer.getLineCount();await t.focusNotebookCell(r,s,{focusEditorLine:l});let c=ste(e,r);c&&Nd.get(c)?.getWidgetPosition()?.lineNumber===l&&Nd.get(c)?.focus()}});W(class extends mp{constructor(){super({id:Uon,title:d(12386,null),keybinding:[{when:C.and(pr,C.not(np)),primary:2062,weight:200},{when:C.and(pr,C.not(np)),mac:{primary:2064},weight:200}]})}async runWithContext(a,i){let e=i.notebookEditor;if(e.getLength()===0)return;let t=e.cellAt(0);await e.focusNotebookCell(t,"container")}});W(class extends mp{constructor(){super({id:zon,title:d(12387,null),keybinding:[{when:C.and(pr,C.not(np)),primary:2061,mac:void 0,weight:200},{when:C.and(pr,C.not(np)),mac:{primary:2066},weight:200}]})}async runWithContext(a,i){let e=i.notebookEditor;if(!e.hasModel()||e.getLength()===0)return;let t=e.getLength()-1,o=e.getPreviousVisibleCellIndex(t);if(o){let n=e.cellAt(o);await e.focusNotebookCell(n,"container")}}});W(class extends Pd{constructor(){super({id:qon,title:L(12388,"Focus In Active Cell Output"),f1:!0,keybinding:[{when:C.and(AS.negate(),ww,Bk),primary:2066,weight:200},{primary:3090,mac:{primary:2322},weight:200}],precondition:pmo})}async runWithContext(a,i){let e=i.notebookEditor,t=i.cell;return Li(0).then(()=>e.focusNotebookCell(t,"output"))}});W(class extends Pd{constructor(){super({id:$on,title:d(12389,null),keybinding:{primary:3088,mac:{primary:2320},weight:200},precondition:C.and(pr,bM)})}async runWithContext(a,i){let e=i.notebookEditor,t=i.cell;await e.focusNotebookCell(t,"editor")}});W(class extends Pd{constructor(){super({id:rRi,title:d(12392,null),keybinding:{when:pr,primary:2090,mac:{primary:298},weight:200}})}async runWithContext(i,e){return e.notebookEditor.revealInCenter(e.cell)}});W(class extends Pd{constructor(){super({id:jon,title:d(12384,null),keybinding:[{when:C.and(pr,C.has(np),pe.editorTextFocus),primary:11,weight:Df}]})}async runWithContext(a,i){Ba.getEditorCommand("cursorPageUp").runCommand(a,{pageSize:JKt(i)})}});W(class extends Pd{constructor(){super({id:Qon,title:d(12385,null),keybinding:[{when:C.and(pr,C.has(np),pe.editorTextFocus,bM.negate()),primary:1035,weight:Df}]})}async runWithContext(a,i){Ba.getEditorCommand("cursorPageUpSelect").runCommand(a,{pageSize:JKt(i)})}});W(class extends Pd{constructor(){super({id:Yon,title:d(12382,null),keybinding:[{when:C.and(pr,C.has(np),pe.editorTextFocus),primary:12,weight:Df}]})}async runWithContext(a,i){Ba.getEditorCommand("cursorPageDown").runCommand(a,{pageSize:JKt(i)})}});W(class extends Pd{constructor(){super({id:Xon,title:d(12383,null),keybinding:[{when:C.and(pr,C.has(np),pe.editorTextFocus,bM.negate()),primary:1036,weight:Df}]})}async runWithContext(a,i){Ba.getEditorCommand("cursorPageDownSelect").runCommand(a,{pageSize:JKt(i)})}});function JKt(a){let e=a.notebookEditor.getViewModel().layoutInfo,t=e?.fontInfo.lineHeight||17;return Math.max(1,Math.floor((e?.height||0)/t)-2)}ne.as(Jt.Configuration).registerConfiguration({id:"notebook",order:100,type:"object",properties:{"notebook.navigation.allowNavigateToSurroundingCells":{type:"boolean",default:!0,markdownDescription:d(12391,null)}}});var Jon={default:{[yt.focusIndicator]:"gutter",[yt.insertToolbarLocation]:"both",[yt.globalToolbar]:!0,[yt.cellToolbarLocation]:{default:"right"},[yt.compactView]:!0,[yt.showCellStatusBar]:"visible",[yt.consolidatedRunButton]:!0,[yt.undoRedoPerCell]:!1},jupyter:{[yt.focusIndicator]:"gutter",[yt.insertToolbarLocation]:"notebookToolbar",[yt.globalToolbar]:!0,[yt.cellToolbarLocation]:{default:"left"},[yt.compactView]:!0,[yt.showCellStatusBar]:"visible",[yt.consolidatedRunButton]:!1,[yt.undoRedoPerCell]:!0},colab:{[yt.focusIndicator]:"border",[yt.insertToolbarLocation]:"betweenCells",[yt.globalToolbar]:!1,[yt.cellToolbarLocation]:{default:"right"},[yt.compactView]:!1,[yt.showCellStatusBar]:"hidden",[yt.consolidatedRunButton]:!0,[yt.undoRedoPerCell]:!1}};async function Zon(a,i){let e=[];for(let t in i)e.push(a.updateValue(t,i[t]));await Promise.all(e)}W(class extends K{constructor(){super({id:"notebook.setProfile",title:d(12410,null)})}async run(a,i){if(!enn(i))return;let e=a.get(B);return Zon(e,Jon[i.profile])}});function enn(a){let i=a;return i.profile==="colab"||i.profile==="default"||i.profile==="jupyter"}var Lnt=class{constructor(i,e){this._notebookService=i;this._languageService=e;this.viewType="*"}async provideCellStatusBarItems(i,e,t){let n=this._notebookService.getNotebookTextModel(i)?.cells[e];if(!n)return;let r=[],s=n.language;if(n.cellKind===1)s="markdown";else if(this._languageService.getLanguageIdByLanguageName(n.language))s=this._languageService.getLanguageName(s)??s;else{let c=d(12328,null,n.language);r.push({text:"$(dialog-warning)",command:{id:"workbench.extensions.search",arguments:[`@tag:${n.language}`],title:"Search Extensions"},tooltip:c,alignment:2,priority:-Number.MAX_SAFE_INTEGER+1})}return r.push({text:s,command:wDt,tooltip:d(12327,null),alignment:2,priority:-Number.MAX_SAFE_INTEGER}),{items:r}}};Lnt=I([m(0,bn),m(1,_t)],Lnt);var Rnt=class{constructor(i,e,t,o,n,r){this._notebookService=i;this._notebookKernelService=e;this._languageService=t;this._configurationService=o;this._languageDetectionService=n;this._keybindingService=r;this.viewType="*";this.cache=new gt}async provideCellStatusBarItems(i,e,t){let o=this._notebookService.getNotebookTextModel(i),n=o?.cells[e];if(!n)return;let r=this._configurationService.getValue("workbench.editor.languageDetectionHints");if(!(typeof r=="object"&&r?.notebookEditors))return;let l=n.uri,c=n.textModel?.getVersionId();if(!c)return;let u=n.cellKind===1?"markdown":this._languageService.getLanguageIdByLanguageName(n.language)||n.language;this.cache.has(l)||this.cache.set(l,{cellLanguage:u,updateTimestamp:0,contentVersion:1});let p=this.cache.get(l);if(p.cellLanguage!==u||p.updateTimestamp<Date.now()-1e3&&p.contentVersion!==c){p.updateTimestamp=Date.now(),p.cellLanguage=u,p.contentVersion=c;let g=this._notebookKernelService.getSelectedOrSuggestedKernel(o);if(g){let f=[...g.supportedLanguages,"markdown"];p.guess=await this._languageDetectionService.detectLanguage(n.uri,f)}}let h=[];if(p.guess&&u!==p.guess){let g=this._languageService.getLanguageName(p.guess)||p.guess,f=this._keybindingService.appendKeybinding(d(12326,null,g),y6e);h.push({text:"$(lightbulb-autofix)",command:y6e,tooltip:f,alignment:2,priority:-Number.MAX_SAFE_INTEGER+1})}return{items:h}}};Rnt=I([m(0,bn),m(1,Ol),m(2,_t),m(3,B),m(4,vS),m(5,_e)],Rnt);var Mnt=class extends x{constructor(i,e){super(),[Lnt,Rnt].forEach(o=>{this._register(e.registerCellStatusBarItemProvider(i.createInstance(o)))})}};Mnt=I([m(0,F),m(1,gZ)],Mnt);ne.as(Qi.Workbench).registerWorkbenchContribution(Mnt,3);var bFe=class extends x{constructor(e){super();this._notebookEditor=e;this._onDidChangeVisibleCells=this._register(new E);this.onDidChangeVisibleCells=this._onDidChangeVisibleCells.event;this._viewModelDisposables=this._register(new N);this._visibleCells=[];this._register(this._notebookEditor.onDidChangeVisibleRanges(this._updateVisibleCells,this)),this._register(this._notebookEditor.onDidChangeModel(this._onModelChange,this)),this._updateVisibleCells()}get visibleCells(){return this._visibleCells}_onModelChange(){this._viewModelDisposables.clear(),this._notebookEditor.hasModel()&&this._viewModelDisposables.add(this._notebookEditor.onDidChangeViewCells(()=>this.updateEverything())),this.updateEverything()}updateEverything(){this._onDidChangeVisibleCells.fire({added:[],removed:Array.from(this._visibleCells)}),this._visibleCells=[],this._updateVisibleCells()}_updateVisibleCells(){if(!this._notebookEditor.hasModel())return;let e=Yf(this._notebookEditor.visibleRanges).map(l=>this._notebookEditor.cellAt(l)).filter(lo),t=new Set(e.map(l=>l.handle)),o=new Set(this._visibleCells.map(l=>l.handle)),n=t1(o,t),r=n.added.map(l=>this._notebookEditor.getCellByHandle(l)).filter(lo),s=n.removed.map(l=>this._notebookEditor.getCellByHandle(l)).filter(lo);this._visibleCells=e,this._onDidChangeVisibleCells.fire({added:r,removed:s})}};var SFe=class extends x{constructor(e,t){super();this._notebookEditor=e;this._notebookCellStatusBarService=t;this._visibleCells=new Map;this._observer=this._register(new bFe(this._notebookEditor)),this._register(this._observer.onDidChangeVisibleCells(this._updateVisibleCells,this)),this._updateEverything(),this._register(this._notebookCellStatusBarService.onDidChangeProviders(this._updateEverything,this)),this._register(this._notebookCellStatusBarService.onDidChangeItems(this._updateEverything,this))}static{this.id="workbench.notebook.statusBar.contributed"}_updateEverything(){let e=this._observer.visibleCells.filter(s=>!this._visibleCells.has(s.handle)),t=new Set(this._observer.visibleCells.map(s=>s.handle)),o=Array.from(this._visibleCells.keys()),n=o.filter(s=>!t.has(s)),r=o.filter(s=>t.has(s));this._updateVisibleCells({added:e,removed:n.map(s=>({handle:s}))}),r.forEach(s=>this._visibleCells.get(s)?.update())}_updateVisibleCells(e){let t=this._notebookEditor.getViewModel();if(t){for(let o of e.added){let n=new sRi(t,o,this._notebookCellStatusBarService);this._visibleCells.set(o.handle,n)}for(let o of e.removed)this._visibleCells.get(o.handle)?.dispose(),this._visibleCells.delete(o.handle)}}dispose(){super.dispose(),this._visibleCells.forEach(e=>e.dispose()),this._visibleCells.clear()}};SFe=I([m(1,gZ)],SFe);var sRi=class extends x{constructor(e,t,o){super();this._notebookViewModel=e;this._cell=t;this._notebookCellStatusBarService=o;this._currentItemIds=[];this._currentItemLists=[];this._isDisposed=!1;this._updateThrottler=this._register(new gu);this._register(Z(()=>this._activeToken?.dispose(!0))),this._updateSoon(),this._register(this._cell.model.onDidChangeContent(()=>this._updateSoon())),this._register(this._cell.model.onDidChangeLanguage(()=>this._updateSoon())),this._register(this._cell.model.onDidChangeMetadata(()=>this._updateSoon())),this._register(this._cell.model.onDidChangeInternalMetadata(()=>this._updateSoon())),this._register(this._cell.model.onDidChangeOutputs(()=>this._updateSoon()))}update(){this._updateSoon()}_updateSoon(){setTimeout(()=>{this._isDisposed||this._updateThrottler.queue(()=>this._update())},0)}async _update(){let e=this._notebookViewModel.getCellIndex(this._cell),t=this._notebookViewModel.notebookDocument.uri,o=this._notebookViewModel.notebookDocument.viewType;this._activeToken?.dispose(!0);let n=this._activeToken=new Ye,r=await this._notebookCellStatusBarService.getStatusBarItemsForCell(t,e,o,n.token);if(n.token.isCancellationRequested){r.forEach(c=>c.dispose&&c.dispose());return}let s=r.map(c=>c.items).flat(),l=this._notebookViewModel.deltaCellStatusBarItems(this._currentItemIds,[{handle:this._cell.handle,items:s}]);this._currentItemLists.forEach(c=>c.dispose&&c.dispose()),this._currentItemLists=r,this._currentItemIds=l}dispose(){super.dispose(),this._isDisposed=!0,this._activeToken?.dispose(!0),this._notebookViewModel.deltaCellStatusBarItems(this._currentItemIds,[{handle:this._cell.handle,items:[]}]),this._currentItemLists.forEach(e=>e.dispose&&e.dispose())}};bm(SFe.id,SFe);function Uge(a,i=!0){if(i&&a<1e3)return`${a}ms`;let e=Math.floor(a/1e3/60),t=Math.floor(a/1e3)%60,o=Math.floor(a%1e3/100);return e>0?`${e}m ${t}.${o}s`:`${t}.${o}s`}var IFe=class extends x{constructor(e,t){super();this._notebookEditor=e;this._itemFactory=t;this._visibleCells=new Map;this._observer=this._register(new bFe(this._notebookEditor)),this._register(this._observer.onDidChangeVisibleCells(this._updateVisibleCells,this)),this._updateEverything()}_updateEverything(){this._visibleCells.forEach(Be),this._visibleCells.clear(),this._updateVisibleCells({added:this._observer.visibleCells,removed:[]})}_updateVisibleCells(e){let t=this._notebookEditor.getViewModel();if(t){for(let o of e.removed)this._visibleCells.get(o.handle)?.dispose(),this._visibleCells.delete(o.handle);for(let o of e.added)this._visibleCells.set(o.handle,this._itemFactory(t,o))}}dispose(){super.dispose(),this._visibleCells.forEach(Be),this._visibleCells.clear()}},XG=class extends x{static{this.id="workbench.notebook.statusBar.execState"}constructor(i,e){super(),this._register(new IFe(i,(t,o)=>e.createInstance(zge,t,o)))}};XG=I([m(1,F)],XG);bm(XG.id,XG);var zge=class extends x{constructor(e,t,o){super();this._notebookViewModel=e;this._cell=t;this._executionStateService=o;this._currentItemIds=[];this._clearExecutingStateTimer=this._register(new me);this._update(),this._register(this._executionStateService.onDidChangeExecution(n=>{n.type===0&&n.affectsCell(this._cell.uri)&&this._update()})),this._register(this._cell.model.onDidChangeInternalMetadata(()=>this._update()))}static{this.MIN_SPINNER_TIME=500}async _update(){let e=this._getItemsForCell();Array.isArray(e)&&(this._currentItemIds=this._notebookViewModel.deltaCellStatusBarItems(this._currentItemIds,[{handle:this._cell.handle,items:e}]))}_getItemsForCell(){let e=this._executionStateService.getCellExecution(this._cell.uri);if(e?.state===3&&typeof this._showedExecutingStateTime!="number")this._showedExecutingStateTime=Date.now();else if(e?.state!==3&&typeof this._showedExecutingStateTime=="number"){let o=zge.MIN_SPINNER_TIME-(Date.now()-this._showedExecutingStateTime);if(o>0){this._clearExecutingStateTimer.value||(this._clearExecutingStateTimer.value=tn(()=>{this._showedExecutingStateTime=void 0,this._clearExecutingStateTimer.clear(),this._update()},o));return}else this._showedExecutingStateTime=void 0}return this._getItemForState(e,this._cell.internalMetadata)}_getItemForState(e,t){let o=e?.state,{lastRunSuccess:n}=t;return!o&&n?[{text:`$(${cUt.id})`,color:Xs(Qho),tooltip:d(12322,null),alignment:1,priority:Number.MAX_SAFE_INTEGER}]:!o&&n===!1?[{text:`$(${IPe.id})`,color:Xs(Xho),tooltip:d(12320,null),alignment:1,priority:Number.MAX_SAFE_INTEGER}]:o===2||o===1?[{text:`$(${dUt.id})`,tooltip:d(12321,null),alignment:1,priority:Number.MAX_SAFE_INTEGER}]:o===3?[{text:`$(${(e?.didPause?Qw:q.modify(Qw,"spin")).id})`,tooltip:d(12319,null),alignment:1,priority:Number.MAX_SAFE_INTEGER}]:[]}dispose(){super.dispose(),this._notebookViewModel.deltaCellStatusBarItems(this._currentItemIds,[{handle:this._cell.handle,items:[]}])}};zge=I([m(2,bs)],zge);var JG=class extends x{static{this.id="workbench.notebook.statusBar.execTimer"}constructor(i,e){super(),this._register(new IFe(i,(t,o)=>e.createInstance(Kge,t,o)))}};JG=I([m(1,F)],JG);bm(JG.id,JG);var tnn=200,Kge=class extends x{constructor(e,t,o,n,r){super();this._notebookViewModel=e;this._cell=t;this._executionStateService=o;this._notebookService=n;this._configurationService=r;this._currentItemIds=[];this._isVerbose=this._configurationService.getValue(yt.cellExecutionTimeVerbosity)==="verbose",this._scheduler=this._register(new Dt(()=>this._update(),Kge.UPDATE_INTERVAL)),this._update(),this._register(this._cell.model.onDidChangeInternalMetadata(()=>this._update())),this._register(this._configurationService.onDidChangeConfiguration(s=>{s.affectsConfiguration(yt.cellExecutionTimeVerbosity)&&(this._isVerbose=this._configurationService.getValue(yt.cellExecutionTimeVerbosity)==="verbose",this._update())}))}static{this.UPDATE_INTERVAL=100}async _update(){let e,t=this._executionStateService.getCellExecution(this._cell.uri),o=t?.state,n=this._cell.internalMetadata.runStartTime,r=this._cell.internalMetadata.runStartTimeAdjustment??0,s=this._cell.internalMetadata.runEndTime;if(t?.didPause)e=void 0;else if(o===3)typeof n=="number"&&(e=this._getTimeItem(n,Date.now(),r),this._scheduler.schedule());else if(!o&&typeof n=="number"&&typeof s=="number"){let c=Date.now()-n+r,u=s-n,p=this._cell.internalMetadata.renderDuration??{};e=this._getTimeItem(n,s,void 0,{timerDuration:c,executionDuration:u,renderDuration:p})}let l=e?[e]:[];!l.length&&t?this._deferredUpdate||(this._deferredUpdate=tn(()=>{this._deferredUpdate=void 0,this._currentItemIds=this._notebookViewModel.deltaCellStatusBarItems(this._currentItemIds,[{handle:this._cell.handle,items:l}])},tnn,this._store)):(this._deferredUpdate?.dispose(),this._deferredUpdate=void 0,this._currentItemIds=this._notebookViewModel.deltaCellStatusBarItems(this._currentItemIds,[{handle:this._cell.handle,items:l}]))}_getTimeItem(e,t,o=0,n){let r=t-e+o,s,l=new Date(t).toLocaleTimeString(wr);if(n){let{renderDuration:u,executionDuration:p,timerDuration:h}=n,g="";for(let f in u){let v=this._notebookService.getRendererInfo(f),b=encodeURIComponent(JSON.stringify({extensionId:v?.extensionId.value??"",issueBody:`Auto-generated text from notebook cell performance - Please add an explanation for the performance issue, including cell content if possible.
The duration for the renderer, ${v?.displayName??f}, is slower than expected.
Execution Time: ${Uge(p)}
Renderer Duration: ${Uge(u[f])}
`})),S=u[f]>200&&p<2e3||u[f]>1e3,y=v?.displayName??f,w=S?`[${y}](command:workbench.action.openIssueReporter?${b})`:`**${y}**`;g+=`- ${w} ${Uge(u[f])}
`}g+=`
*${d(12324,null)}*
`,s={value:d(12323,null,l,Uge(p),Uge(h-p),g),isTrusted:!0}}return{text:this._isVerbose?d(12325,null,l,Uge(r,!1)):Uge(r,!1),alignment:1,priority:Number.MAX_SAFE_INTEGER-5,tooltip:s}}dispose(){super.dispose(),this._deferredUpdate?.dispose(),this._notebookViewModel.deltaCellStatusBarItems(this._currentItemIds,[{handle:this._cell.handle,items:[]}])}};Kge=I([m(2,bs),m(3,bn),m(4,B)],Kge);var Pnt=class{constructor(i,e,t,o,n){let r=new N;this.dispose=r.dispose.bind(r);let s=()=>{r.clear(),t.selectKernelForNotebook(e,i)};r.add(i.onDidChangeContent(l=>{for(let c of l.rawEvents)switch(c.kind){case 10:case 1:case 2:case 5:n.trace("IMPLICIT kernel selection because of change event",c.kind),s();break}})),r.add(o.hoverProvider.register({scheme:Q.vscodeNotebookCell,pattern:i.uri.path},{provideHover(){n.trace("IMPLICIT kernel selection because of hover"),s()}}))}};Pnt=I([m(2,Ol),m(3,Qt),m(4,se)],Pnt);var Ant=class extends x{constructor(e,t,o,n){super();this._editorService=e;this._statusbarService=t;this._notebookKernelService=o;this._instantiationService=n;this._editorDisposables=this._register(new N);this._kernelInfoElement=this._register(new N);this._register(this._editorService.onDidActiveEditorChange(()=>this._updateStatusbar())),this._updateStatusbar()}_updateStatusbar(){this._editorDisposables.clear();let e=Jn(this._editorService.activeEditorPane);if(!e){this._kernelInfoElement.clear();return}let t=()=>{if(e.notebookOptions.getDisplayOptions().globalToolbar){this._kernelInfoElement.clear();return}let o=e.textModel;o?this._showKernelStatus(o):this._kernelInfoElement.clear()};this._editorDisposables.add(this._notebookKernelService.onDidAddKernel(t)),this._editorDisposables.add(this._notebookKernelService.onDidChangeSelectedNotebooks(t)),this._editorDisposables.add(this._notebookKernelService.onDidChangeNotebookAffinity(t)),this._editorDisposables.add(e.onDidChangeModel(t)),this._editorDisposables.add(e.notebookOptions.onDidChangeOptions(t)),t()}_showKernelStatus(e){this._kernelInfoElement.clear();let{selected:t,suggestions:o,all:n}=this._notebookKernelService.getMatchingKernel(e),r=(o.length===1?o[0]:void 0)??n.length===1?n[0]:void 0,s=!1;if(n.length!==0)if(t||r){let l=t;l||(l=r,s=!0,this._kernelInfoElement.add(this._instantiationService.createInstance(Pnt,e,l)));let c=l.description??l.detail??l.label;this._kernelInfoElement.add(this._statusbarService.addEntry({name:d(12339,null),text:`$(notebook-kernel-select) ${l.label}`,ariaLabel:l.label,tooltip:s?d(12344,null,c):c,command:NT},NT,1,10)),this._kernelInfoElement.add(l.onDidChange(()=>this._showKernelStatus(e)))}else this._kernelInfoElement.add(this._statusbarService.addEntry({name:d(12341,null),text:d(12336,null),ariaLabel:d(12336,null),command:NT,kind:"prominent"},NT,1,10))}};Ant=I([m(0,ee),m(1,kr),m(2,Ol),m(3,F)],Ant);var Nnt=class extends x{constructor(e,t){super();this._editorService=e;this._statusbarService=t;this._itemDisposables=this._register(new N);this._accessor=this._register(new me);this._register(this._editorService.onDidActiveEditorChange(()=>this._update())),this._update()}_update(){this._itemDisposables.clear();let e=Jn(this._editorService.activeEditorPane);e?(this._itemDisposables.add(e.onDidChangeSelection(()=>this._show(e))),this._itemDisposables.add(e.onDidChangeActiveCell(()=>this._show(e))),this._show(e)):this._accessor.clear()}_show(e){if(!e.hasModel()){this._accessor.clear();return}let t=this._getSelectionsText(e);if(!t){this._accessor.clear();return}let o={name:d(12337,null),text:t,ariaLabel:t,command:rRi};this._accessor.value?this._accessor.value.update(o):this._accessor.value=this._statusbarService.addEntry(o,"notebook.activeCellStatus",1,100)}_getSelectionsText(e){if(!e.hasModel())return;let t=e.getActiveCell();if(!t)return;let o=e.getCellIndex(t)+1,n=e.getSelections().reduce((s,l)=>s+(l.end-l.start),0),r=e.getLength();return n>1?d(12340,null,o,n):d(12342,null,o,r)}};Nnt=I([m(0,ee),m(1,kr)],Nnt);var Ont=class extends x{constructor(e,t,o){super();this._editorService=e;this._statusbarService=t;this._configurationService=o;this._itemDisposables=this._register(new N);this._accessor=this._register(new me);this._register(this._editorService.onDidActiveEditorChange(()=>this._update())),this._register(this._configurationService.onDidChangeConfiguration(n=>{(n.affectsConfiguration("editor")||n.affectsConfiguration("notebook"))&&this._update()})),this._update()}static{this.ID="selectNotebookIndentation"}_update(){this._itemDisposables.clear();let e=Jn(this._editorService.activeEditorPane);e?(this._show(e),this._itemDisposables.add(e.onDidChangeSelection(()=>{this._accessor.clear(),this._show(e)}))):this._accessor.clear()}_show(e){if(!e.hasModel()){this._accessor.clear();return}let t=e.getActiveCell()?.textModel?.getOptions();if(!t){this._accessor.clear();return}let o=e.notebookOptions.getDisplayOptions().editorOptionsCustomizations,n=o?.["editor.indentSize"]??t?.indentSize,r=o?.["editor.insertSpaces"]??t?.insertSpaces,s=o?.["editor.tabSize"]??t?.tabSize,l=typeof n=="number"?n:s,u=r?`Spaces: ${l}`:`Tab Size: ${l}`;if(!u){this._accessor.clear();return}let p={name:d(12338,null),text:u,ariaLabel:u,tooltip:d(12343,null),command:qLi};this._accessor.value?this._accessor.value.update(p):this._accessor.value=this._statusbarService.addEntry(p,"notebook.status.indentation",1,100.4)}};Ont=I([m(0,ee),m(1,kr),m(2,B)],Ont);var yFe=class extends x{constructor(e){super();this.editorGroupService=e;for(let t of e.parts)this.createNotebookStatus(t);this._register(e.onDidCreateAuxiliaryEditorPart(t=>this.createNotebookStatus(t)))}static{this.ID="notebook.contrib.editorStatus"}createNotebookStatus(e){let t=new N;U.once(e.onWillDispose)(()=>t.dispose());let o=this.editorGroupService.getScopedInstantiationService(e);t.add(o.createInstance(Ant)),t.add(o.createInstance(Nnt)),t.add(o.createInstance(Ont))}};yFe=I([m(0,wt)],yFe);It(yFe.ID,yFe,St.AfterRestored);var wFe=class extends x{constructor(e){super();this._editorService=e;let t=105;this._register(S_.addImplementation(t,"notebook-undo-redo",()=>{let o=Jn(this._editorService.activeEditorPane),n=o?.getViewModel();return o&&o.hasEditorFocus()&&o.hasModel()&&n?n.undo().then(r=>{if(r?.length){for(let s=0;s<o.getLength();s++){let l=o.cellAt(s);l.cellKind===1&&r.find(c=>c.fragment===l.model.uri.fragment)&&l.updateEditState(1,"undo")}o?.setOptions({cellOptions:{resource:r[0]},preserveFocus:!0})}}):!1})),this._register(I_.addImplementation(t,"notebook-undo-redo",()=>{let o=Jn(this._editorService.activeEditorPane),n=o?.getViewModel();return o&&o.hasEditorFocus()&&o.hasModel()&&n?n.redo().then(r=>{if(r?.length){for(let s=0;s<o.getLength();s++){let l=o.cellAt(s);l.cellKind===1&&r.find(c=>c.fragment===l.model.uri.fragment)&&l.updateEditState(1,"redo")}o?.setOptions({cellOptions:{resource:r[0]},preserveFocus:!0})}}):!1}))}static{this.ID="workbench.contrib.notebookUndoRedo"}};wFe=I([m(0,ee)],wFe);It(wFe.ID,wFe,St.BlockRestore);var inn="notebook.cell.moveUp",onn="notebook.cell.moveDown",nnn="notebook.cell.copyUp",rnn="notebook.cell.copyDown";W(class extends Pd{constructor(){super({id:inn,title:L(12309,"Move Cell Up"),icon:Emo,keybinding:{primary:528,when:C.and(pr,ig.toNegated()),weight:200},menu:{id:D.NotebookCellTitle,when:C.equals("config.notebook.dragAndDropEnabled",!1),group:"3_edit",order:14}})}async runWithContext(a,i){return gTi(i,"up")}});W(class extends Pd{constructor(){super({id:onn,title:L(12308,"Move Cell Down"),icon:Tmo,keybinding:{primary:530,when:C.and(pr,ig.toNegated()),weight:200},menu:{id:D.NotebookCellTitle,when:C.equals("config.notebook.dragAndDropEnabled",!1),group:"3_edit",order:14}})}async runWithContext(a,i){return gTi(i,"down")}});W(class extends Pd{constructor(){super({id:nnn,title:L(12300,"Copy Cell Up"),keybinding:{primary:1552,when:C.and(pr,ig.toNegated()),weight:200}})}async runWithContext(a,i){return fTi(i,"up")}});W(class extends Pd{constructor(){super({id:rnn,title:L(12299,"Copy Cell Down"),keybinding:{primary:1554,when:C.and(pr,ig.toNegated()),weight:200},menu:{id:D.NotebookCellTitle,when:C.and(pr,Xl,jw),group:"3_edit",order:13}})}async runWithContext(a,i){return fTi(i,"down")}});var snn="notebook.cell.split",ann="notebook.cell.joinSelected",lnn="notebook.cell.joinAbove",cnn="notebook.cell.joinBelow";W(class extends Pd{constructor(){super({id:snn,title:L(12310,"Split Cell"),menu:{id:D.NotebookCellTitle,when:C.and(Xl,jw,gPe.toNegated()),order:5,group:Y0},icon:_mo,keybinding:{when:C.and(pr,Xl,jw,pe.editorTextFocus),primary:Vi(2089,3165),weight:200}})}async runWithContext(a,i){if(i.notebookEditor.isReadOnly)return;let e=a.get(La),t=i.cell,o=i.notebookEditor.getCellIndex(t),n=t.focusMode===0?[{lineNumber:1,column:1}]:t.getSelectionsStartPosition();if(n&&n.length>0){if(await t.resolveTextModel(),!t.hasModel())return;let r=dgo(t,n);if(r){let s=t.language,l=t.cellKind,c=t.mime,u=await t.resolveTextModel();await e.apply([new nl(t.uri,{range:u.getFullModelRange(),text:r[0]}),new Mv(i.notebookEditor.textModel.uri,{editType:1,index:o+1,count:0,cells:r.slice(1).map(p=>({cellKind:l,language:s,mime:c,source:p,outputs:[],metadata:{}}))})],{quotableLabel:"Split Notebook Cell"}),i.notebookEditor.cellAt(o+1)?.updateEditState(t.getEditState(),"splitCell")}}}});W(class extends Pd{constructor(){super({id:lnn,title:L(12305,"Join With Previous Cell"),keybinding:{when:pr,primary:1832,weight:200},menu:{id:D.NotebookCellTitle,when:C.and(pr,Xl),group:"3_edit",order:10}})}async runWithContext(a,i){let e=a.get(La);return vTi(e,i,"above")}});W(class extends Pd{constructor(){super({id:cnn,title:L(12306,"Join With Next Cell"),keybinding:{when:pr,primary:808,weight:200},menu:{id:D.NotebookCellTitle,when:C.and(pr,Xl),group:"3_edit",order:11}})}async runWithContext(a,i){let e=a.get(La);return vTi(e,i,"below")}});W(class extends Pd{constructor(){super({id:ann,title:L(12307,"Join Selected Cells"),menu:{id:D.NotebookCellTitle,when:C.and(pr,Xl),group:"3_edit",order:12}})}async runWithContext(a,i){let e=a.get(La),t=a.get(Ne);return cgo(e,t,i)}});var dnn="notebook.cell.changeToCode",unn="notebook.cell.changeToMarkdown";W(class extends Hg{constructor(){super({id:dnn,title:L(12293,"Change Cell to Code"),keybinding:{when:C.and(pr,C.not(np),bM.toNegated()),primary:55,weight:200},precondition:C.and(Za,NS.isEqualTo("markup")),menu:{id:D.NotebookCellTitle,when:C.and(pr,Xl,jw,NS.isEqualTo("markup")),group:"3_edit"}})}async runWithContext(i,e){await NAe(2,e)}});W(class extends Hg{constructor(){super({id:unn,title:L(12294,"Change Cell to Markdown"),keybinding:{when:C.and(pr,C.not(np),bM.toNegated()),primary:43,weight:200},precondition:C.and(Za,NS.isEqualTo("code")),menu:{id:D.NotebookCellTitle,when:C.and(pr,Xl,jw,NS.isEqualTo("code")),group:"3_edit"}})}async runWithContext(i,e){await NAe(1,e,"markdown",tr.markdown)}});var pnn="notebook.cell.collapseCellInput",mnn="notebook.cell.collapseCellOutput",hnn="notebook.cell.collapseAllCellInputs",gnn="notebook.cell.expandAllCellInputs",fnn="notebook.cell.collapseAllCellOutputs",vnn="notebook.cell.expandAllCellOutputs",bnn="notebook.cell.toggleOutputs",Snn="notebook.cell.toggleOutputScrolling";W(class extends Hg{constructor(){super({id:pnn,title:L(12297,"Collapse Cell Input"),keybinding:{when:C.and(pp,gPe.toNegated(),ig.toNegated()),primary:Vi(2089,2081),weight:200}})}parseArgs(i,...e){return mG(i,...e)}async runWithContext(i,e){e.ui?e.cell.isInputCollapsed=!0:e.selectedCells.forEach(t=>t.isInputCollapsed=!0)}});W(class extends Hg{constructor(){super({id:PEe,title:L(12303,"Expand Cell Input"),keybinding:{when:C.and(pp,gPe),primary:Vi(2089,2081),weight:200}})}parseArgs(i,...e){return mG(i,...e)}async runWithContext(i,e){e.ui?e.cell.isInputCollapsed=!1:e.selectedCells.forEach(t=>t.isInputCollapsed=!1)}});W(class extends Hg{constructor(){super({id:mnn,title:L(12298,"Collapse Cell Output"),keybinding:{when:C.and(pp,vtt.toNegated(),ig.toNegated(),Bk),primary:Vi(2089,50),weight:200}})}async runWithContext(i,e){e.ui?e.cell.isOutputCollapsed=!0:e.selectedCells.forEach(t=>t.isOutputCollapsed=!0)}});W(class extends Hg{constructor(){super({id:CDt,title:L(12304,"Expand Cell Output"),keybinding:{when:C.and(pp,vtt),primary:Vi(2089,50),weight:200}})}async runWithContext(i,e){e.ui?e.cell.isOutputCollapsed=!1:e.selectedCells.forEach(t=>t.isOutputCollapsed=!1)}});W(class extends Hg{constructor(){super({id:bnn,precondition:pp,title:L(12311,"Toggle Outputs"),metadata:{description:d(12312,null),args:btt}})}parseArgs(a,...i){return mG(a,...i)}async runWithContext(a,i){let e=[];i.ui?e=[i.cell]:i.selectedCells&&(e=i.selectedCells);for(let t of e)t.isOutputCollapsed=!t.isOutputCollapsed}});W(class extends Hg{constructor(){super({id:hnn,title:L(12295,"Collapse All Cell Inputs"),f1:!0})}async runWithContext(i,e){ZKt(e.notebookEditor,t=>t.isInputCollapsed=!0)}});W(class extends Hg{constructor(){super({id:gnn,title:L(12301,"Expand All Cell Inputs"),f1:!0})}async runWithContext(i,e){ZKt(e.notebookEditor,t=>t.isInputCollapsed=!1)}});W(class extends Hg{constructor(){super({id:fnn,title:L(12296,"Collapse All Cell Outputs"),f1:!0})}async runWithContext(i,e){ZKt(e.notebookEditor,t=>t.isOutputCollapsed=!0)}});W(class extends Hg{constructor(){super({id:vnn,title:L(12302,"Expand All Cell Outputs"),f1:!0})}async runWithContext(i,e){ZKt(e.notebookEditor,t=>t.isOutputCollapsed=!1)}});W(class extends Hg{constructor(){super({id:Snn,title:L(12313,"Toggle Scroll Cell Output"),keybinding:{when:C.and(pp,ig.toNegated(),Bk),primary:Vi(2089,55),weight:200}})}toggleOutputScrolling(i,e,t){let o=i.model.metadata;if(o){let n=o.scrollable!==void 0?o.scrollable:e,r=t||!n;o.scrollable=r,i.resetRenderer()}}async runWithContext(i,e){let t=i.get(B).getValue(yt.outputScrolling);e.ui?(e.cell.outputsViewModels.forEach(o=>{this.toggleOutputScrolling(o,t,e.cell.isOutputCollapsed)}),e.cell.isOutputCollapsed=!1):e.selectedCells.forEach(o=>{o.outputsViewModels.forEach(n=>{this.toggleOutputScrolling(n,t,o.isOutputCollapsed)}),o.isOutputCollapsed=!1})}});function ZKt(a,i){for(let e=0;e<a.getLength();e++){let t=a.cellAt(e);i(t,e)}}var CFe=class extends x{constructor(e,t,o){super();this._notebookEditor=e;this._notebookService=t;this._warmupDocument=null;this._warmupViewport=new Dt(()=>this._warmupViewportNow(),200),this._register(this._warmupViewport),this._register(this._notebookEditor.onDidScroll(()=>{this._warmupViewport.schedule()})),this._warmupDocument=new Dt(()=>this._warmupDocumentNow(),200),this._register(this._warmupDocument),this._register(this._notebookEditor.onDidAttachViewModel(()=>{this._notebookEditor.hasModel()&&this._warmupDocument?.schedule()})),this._notebookEditor.hasModel()&&this._warmupDocument?.schedule()}static{this.id="workbench.notebook.viewportWarmup"}_warmupDocumentNow(){if(this._notebookEditor.hasModel())for(let e=0;e<this._notebookEditor.getLength();e++){let t=this._notebookEditor.cellAt(e);t?.cellKind===1&&t?.getEditState()===0&&!t.isInputCollapsed||t?.cellKind===2&&this._warmupCodeCell(t)}}_warmupViewportNow(){if(this._notebookEditor.isDisposed||!this._notebookEditor.hasModel())return;let e=this._notebookEditor.getVisibleRangesPlusViewportAboveAndBelow();Yf(e).forEach(t=>{let o=this._notebookEditor.cellAt(t);o?.cellKind===1&&o?.getEditState()===0&&!o.isInputCollapsed?this._notebookEditor.createMarkupPreview(o):o?.cellKind===2&&this._warmupCodeCell(o)})}_warmupCodeCell(e){if(e.isOutputCollapsed)return;let t=e.outputsViewModels;for(let o of t.slice(0,APe)){let[n,r]=o.resolveMimeTypes(this._notebookEditor.textModel,void 0);if(!n.find(u=>u.isTrusted)||n.length===0)continue;let s=n[r];if(!s||!this._notebookEditor.hasModel())return;let l=this._notebookService.getRendererInfo(s.rendererId);if(!l)return;let c={type:1,renderer:l,source:o,mimeType:s.mimeType};this._notebookEditor.createOutput(e,c,0,!0)}}};CFe=I([m(1,bn),m(2,Oi)],CFe);bm(CFe.id,CFe);var Fnt=class extends x{constructor(e){super();this._notebookEditor=e;this._localStore=this._register(new N);this._cellDisposables=[];this._enabled=!1;this._cellStatusItems=[];this._register(this._notebookEditor.onDidChangeModel(()=>{this._update()})),this._update()}static{this.id="workbench.notebook.troubleshoot"}toggle(){this._enabled=!this._enabled,this._update()}_update(){this._localStore.clear(),this._cellDisposables.forEach(e=>e.dispose()),this._cellDisposables=[],this._removeNotebookOverlay(),this._notebookEditor.hasModel()&&this._enabled&&(this._updateListener(),this._createNotebookOverlay(),this._createCellOverlays())}_log(e,t){if(this._enabled){let o=this._notebookEditor.getViewHeight(e);console.log(`cell#${e.handle}`,t,`${o} -> ${e.layoutInfo.totalHeight}`)}}_createCellOverlays(){if(this._notebookEditor.hasModel()){for(let e=0;e<this._notebookEditor.getLength();e++){let t=this._notebookEditor.cellAt(e);this._createCellOverlay(t,e)}this._localStore.add(this._notebookEditor.onDidChangeViewCells(e=>{let t=e.splices.reduce((o,[,,n])=>[...o,...n],[]);for(let o=0;o<t.length;o++){let n=this._notebookEditor.getCellIndex(t[o]);n!==void 0&&this._createCellOverlay(t[o],n)}}))}}_createNotebookOverlay(){if(!this._notebookEditor.hasModel())return;let e=this._notebookEditor.getLayoutInfo().listViewOffsetTop,t=this._notebookEditor.scrollTop,o=Bo.div({style:{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",pointerEvents:"none",zIndex:"1000"}},[Bo.div({style:{position:"absolute",top:`${e}px`,left:"0",width:"100%",height:"2px",backgroundColor:"rgba(0, 0, 255, 0.7)"}}),Bo.div({style:{position:"absolute",top:`${e}px`,left:"10px",backgroundColor:"rgba(0, 0, 255, 0.7)",color:"white",fontSize:"11px",fontWeight:"bold",padding:"2px 6px",borderRadius:"3px",whiteSpace:"nowrap",pointerEvents:"none",zIndex:"1001"}},[`ScrollTop: ${t}px`])]).keepUpdated(this._store);this._notebookOverlayDomNode=o.element,this._notebookOverlayDomNode&&this._notebookEditor.getDomNode().appendChild(this._notebookOverlayDomNode),this._localStore.add(this._notebookEditor.onDidScroll(()=>{let n=this._notebookEditor.scrollTop,r=this._notebookEditor.getLayoutInfo().listViewOffsetTop;if(this._notebookOverlayDomNode){let s=this._notebookOverlayDomNode.querySelector("div:nth-child(2)");s&&(s.textContent=`ScrollTop: ${n}px`,s.style.top=`${r}px`);let l=this._notebookOverlayDomNode.querySelector("div:first-child");l&&(l.style.top=`${r}px`)}}))}_createCellOverlay(e,t){let o=document.createElement("div");o.style.position="absolute",o.style.top="0",o.style.left="0",o.style.width="100%",o.style.height="100%",o.style.pointerEvents="none",o.style.zIndex="1000";let n=document.createElement("div");n.style.position="absolute",n.style.top="0",n.style.left="0",n.style.width="100%",n.style.height="2px",n.style.backgroundColor="rgba(255, 0, 0, 0.7)",o.appendChild(n);let r=()=>{let c=e.textBuffer.getEOL()===`
`?"LF":"CRLF",u="";return e.layoutInfo.layoutState>0&&(u=`| AbsoluteTopOfElement: ${this._notebookEditor.getAbsoluteTopOfElement(e)}px`),`cell #${t} (handle: ${e.handle}) ${u} | EOL: ${c}`},s=document.createElement("div");s.textContent=r(),s.style.position="absolute",s.style.top="0px",s.style.right="10px",s.style.backgroundColor="rgba(255, 0, 0, 0.5)",s.style.color="white",s.style.fontSize="11px",s.style.fontWeight="bold",s.style.padding="2px 6px",s.style.borderRadius="3px",s.style.whiteSpace="nowrap",s.style.pointerEvents="none",s.style.zIndex="1001",o.appendChild(s);let l;if(this._notebookEditor.changeCellOverlays(c=>{l=c.addOverlay({cell:e,domNode:o})}),l){let c=()=>{s.textContent=r(),l&&this._notebookEditor.changeCellOverlays(p=>{p.layoutOverlay(l)})},u=this._cellDisposables[t];u.add(e.onDidChangeLayout(p=>{c()})),u.add(e.textBuffer.onDidChangeContent(()=>{c()})),e.textModel&&u.add(e.textModel.onDidChangeContent(()=>{c()})),u.add(this._notebookEditor.onDidChangeLayout(()=>{c()})),u.add(Z(()=>{this._notebookEditor.changeCellOverlays(p=>{l&&p.removeOverlay(l)})}))}}_removeNotebookOverlay(){this._notebookOverlayDomNode&&(this._notebookOverlayDomNode.remove(),this._notebookOverlayDomNode=void 0)}_updateListener(){if(!this._notebookEditor.hasModel())return;for(let o=0;o<this._notebookEditor.getLength();o++){let n=this._notebookEditor.cellAt(o),r=new N;this._cellDisposables.push(r),r.add(n.onDidChangeLayout(s=>{this._log(n,s)}))}this._localStore.add(this._notebookEditor.onDidChangeViewCells(o=>{[...o.splices].reverse().forEach(r=>{let[s,l,c]=r,u=this._cellDisposables.splice(s,l,...c.map(p=>{let h=new N;return h.add(p.onDidChangeLayout(g=>{this._log(p,g)})),h}));Be(u)});let n=o.splices.reduce((r,[,,s])=>[...r,...s],[]);for(let r=0;r<n.length;r++){let s=this._notebookEditor.getCellIndex(n[r]);s!==void 0&&this._createCellOverlay(n[r],s)}}));let e=this._notebookEditor.getViewModel(),t=[];this._enabled&&(t=this._getItemsForCells()),this._cellStatusItems=e.deltaCellStatusBarItems(this._cellStatusItems,t)}_getItemsForCells(){let e=[];for(let t=0;t<this._notebookEditor.getLength();t++)e.push({handle:t,items:[{text:`index: ${t}`,alignment:1,priority:Number.MAX_SAFE_INTEGER}]});return e}dispose(){Be(this._cellDisposables),this._removeNotebookOverlay(),this._localStore.clear(),super.dispose()}};bm(Fnt.id,Fnt);W(class extends K{constructor(){super({id:"notebook.toggleLayoutTroubleshoot",title:L(12423,"Toggle Notebook Layout Troubleshoot"),category:Ve.Developer,f1:!0})}async run(a){let i=a.get(ee),e=Jn(i.activeEditorPane);if(!e)return;e.getContribution(Fnt.id)?.toggle()}});W(class extends K{constructor(){super({id:"notebook.inspectLayout",title:L(12422,"Inspect Notebook Layout"),category:Ve.Developer,f1:!0})}async run(a){let i=a.get(ee),e=Jn(i.activeEditorPane);if(!(!e||!e.hasModel()))for(let t=0;t<e.getLength();t++){let o=e.cellAt(t);console.log(`cell#${o.handle}`,o.layoutInfo)}}});W(class extends K{constructor(){super({id:"notebook.clearNotebookEdtitorTypeCache",title:L(12421,"Clear Notebook Editor Type Cache"),category:Ve.Developer,f1:!0})}async run(a){a.get(bn).clearEditorCache()}});var Wnt=class extends x{constructor(e,t,o){super();this._debugService=e;this._editorService=o;let n=new gt;this._register(t.onWillAddNotebookDocument(r=>{n.set(r.uri,r.onWillAddRemoveCells(s=>{let l=this._debugService.getModel();if(l.getBreakpoints().length&&s.rawEvent.kind===1)for(let c of s.rawEvent.changes){let[u,p]=c;if(p>0){let h=r.cells.slice(u,u+p);for(let g of h)l.getBreakpoints({uri:g.uri}).forEach(v=>this._debugService.removeBreakpoints(v.getId()))}}}))})),this._register(t.onWillRemoveNotebookDocument(r=>{this.updateBreakpoints(r),n.get(r.uri)?.dispose(),n.delete(r.uri)})),this._register(this._debugService.getModel().onDidChangeBreakpoints(r=>{let s=r?.added?.find(l=>No(l,{uri:!0})&&l.uri.scheme===Q.vscodeNotebookCell);if(s){let l=Zo.parse(s.uri);if(!l)return;let c=Jn(this._editorService.activeEditorPane);if(!c||!c.hasModel()||c.textModel.uri.toString()!==l.notebook.toString())return;let u=c.getCellByHandle(l.handle);if(!u)return;c.focusElement(u)}}))}updateBreakpoints(e){let t=this._debugService.getModel().getBreakpoints();if(!t.length||!e.cells.length)return;let o=new gt;e.cells.forEach((n,r)=>{o.set(n.uri,r)}),t.forEach(n=>{let r=o.get(n.uri);if(typeof r!="number")return;let s=Zo.parse(n.uri)?.notebook;if(!s)return;let l=Zo.generate(s,r);Qe(l,n.uri)||(this._debugService.removeBreakpoints(n.getId()),this._debugService.addBreakpoints(l,[{column:n.column,condition:n.condition,enabled:n.enabled,hitCondition:n.hitCondition,logMessage:n.logMessage,lineNumber:n.lineNumber}]))})}};Wnt=I([m(0,Ni),m(1,bn),m(2,ee)],Wnt);ne.as(Qi.Workbench).registerWorkbenchContribution(Wnt,3);var Vnt=class extends x{constructor(e,t){super();this._debugService=e;this._notebookExecutionStateService=t;this._pausedCells=new Set;this._register(e.getModel().onDidChangeCallStack(()=>{this.onDidChangeCallStack(!0),this._scheduler.schedule()})),this._scheduler=this._register(new Dt(()=>this.onDidChangeCallStack(!1),2e3))}async onDidChangeCallStack(e){let t=new Set;for(let o of this._debugService.getModel().getSessions())for(let n of o.getAllThreads()){let r=n.getCallStack();e&&!r.length&&(r=n.getStaleCallStack()),r.forEach(s=>{Zo.parse(s.source.uri)&&(t.add(s.source.uri.toString()),this.editIsPaused(s.source.uri,!0))})}for(let o of this._pausedCells)t.has(o)||(this.editIsPaused(A.parse(o),!1),this._pausedCells.delete(o));t.forEach(o=>this._pausedCells.add(o))}editIsPaused(e,t){if(Zo.parse(e)){let n=this._notebookExecutionStateService.getCellExecution(e);n&&(n.isPaused!==t||!n.didPause)&&n.update([{editType:3,didPause:!0,isPaused:t}])}}};Vnt=I([m(0,Ni),m(1,bs)],Vnt);ne.as(Qi.Workbench).registerWorkbenchContribution(Vnt,3);var aRi=class{constructor(){this._registeredGutterActionsGenerators=new Set}registerGutterActionsGenerator(i){return this._registeredGutterActionsGenerators.add(i),{dispose:()=>{this._registeredGutterActionsGenerators.delete(i)}}}getGutterActionsGenerators(){return Array.from(this._registeredGutterActionsGenerators.values())}};ne.add("gutterActionsRegistry",new aRi);var Bnt=ne.as("gutterActionsRegistry"),ioe=class extends x{constructor(e,t,o,n,r){super();this.editor=e;this.contextMenuService=t;this.menuService=o;this.contextKeyService=n;this.instantiationService=r;this._register(this.editor.onMouseDown(s=>this.doShow(s,!1)))}static{this.ID="workbench.contrib.editorLineNumberContextMenu"}show(e){this.doShow(e,!0)}doShow(e,t){let o=this.editor.getModel();if(!e.event.rightButton&&!(Ze&&e.event.leftButton&&e.event.ctrlKey)&&!t||e.target.type!==3&&e.target.type!==2||!e.target.position||!o)return;let n=e.target.position.lineNumber,r=this.contextKeyService.createOverlay([["editorLineNumber",n]]),s=this.menuService.createMenu(D.EditorLineNumberContext,r),l=[];this.instantiationService.invokeFunction(c=>{for(let p of Bnt.getGutterActionsGenerators()){let h=new Map;p({lineNumber:n,editor:this.editor,accessor:c},{push:(g,f="navigation")=>{let v=h.get(f)??[];v.push(g),h.set(f,v)}});for(let[g,f]of h.entries())l.push([g,f])}l.sort((p,h)=>p[0].localeCompare(h[0]));let u=s.getActions({arg:{lineNumber:n,uri:o.uri},shouldForwardArgs:!0});if(l.push(...u),e.target.type===3){let p=this.editor.getSelections(),h={startLineNumber:n,endLineNumber:n,startColumn:1,endColumn:o.getLineLength(n)+1};p?.some(f=>!f.isEmpty()&&f.intersectRanges(h)!==null)||this.editor.setSelection(h,"api")}this.contextMenuService.showContextMenu({getAnchor:()=>e.event,getActions:()=>ri.join(...l.map(p=>p[1])),onHide:()=>s.dispose()})})}};ioe=I([m(1,Xe),m(2,Kt),m(3,X),m(4,F)],ioe);xo(ioe.ID,ioe,1);var xFe=_,lRi=le("privateBreakpointWidgetService"),WSo="breakpointwidgetdecoration";function Inn(a){return a.getModel().bracketPairs.getBracketPairsInRange(z.fromPositions(a.getPosition())).some(t=>t.openingBracketInfo.bracketText==="{")}function ynn(a,i){let e=a.getColor(Id)?.transparent(.4);return[{range:{startLineNumber:0,endLineNumber:0,startColumn:0,endColumn:1},renderOptions:{after:{contentText:i,color:e?e.toString():void 0}}}]}var kFe=class extends ZO{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super(e,{showFrame:!0,showArrow:!1,frameWidth:1,isAccessible:!0});this.lineNumber=t;this.column=o;this.contextViewService=r;this.debugService=s;this.themeService=l;this.instantiationService=c;this.modelService=u;this.codeEditorService=p;this._configurationService=h;this.languageFeaturesService=g;this.keybindingService=f;this.labelService=v;this.textModelService=b;this.hoverService=S;this.conditionInput="";this.hitCountInput="";this.logMessageInput="";this.availableBreakpoints=[];this.store=new N;let y=this.editor.getModel();if(y){let w=y.uri,k=this.debugService.getModel().getBreakpoints({lineNumber:this.lineNumber,column:this.column,uri:w});this.breakpoint=k.length?k[0]:void 0}n===void 0?this.breakpoint&&!this.breakpoint.condition&&!this.breakpoint.hitCondition&&this.breakpoint.logMessage?this.context=2:this.breakpoint&&!this.breakpoint.condition&&this.breakpoint.hitCondition?this.context=1:this.breakpoint&&this.breakpoint.triggeredBy?this.context=3:this.context=0:this.context=n,this.store.add(this.debugService.getModel().onDidChangeBreakpoints(w=>{this.breakpoint&&w&&w.removed&&w.removed.indexOf(this.breakpoint)>=0&&this.dispose(),this.context===3&&this.selectBreakpointBox&&this.updateTriggerBreakpointList()})),this.store.add(this.codeEditorService.registerDecorationType("breakpoint-widget",WSo,{})),this.create()}get placeholder(){let e=this.keybindingService.lookupKeybinding(e2t.ID)?.getLabel()||"Enter",t=this.keybindingService.lookupKeybinding(t2t.ID)?.getLabel()||"Escape";switch(this.context){case 2:return d(9329,null,e,t);case 1:return d(9328,null,e,t);default:return d(9327,null,e,t)}}getInputValue(e){switch(this.context){case 2:return e&&e.logMessage?e.logMessage:this.logMessageInput;case 1:return e&&e.hitCondition?e.hitCondition:this.hitCountInput;default:return e&&e.condition?e.condition:this.conditionInput}}rememberInput(){if(this.context!==3){let e=this.input.getModel().getValue();switch(this.context){case 2:this.logMessageInput=e;break;case 1:this.hitCountInput=e;break;default:this.conditionInput=e}}}setInputMode(){if(this.editor.hasModel()){let e=this.context===2?$r:this.editor.getModel().getLanguageId();this.input.getModel().setLanguage(e)}}show(e){let t=this.input.getModel().getLineCount();super.show(e,t+1)}fitHeightToContent(){let e=this.input.getModel().getLineCount();this._relayout(e+1)}_fillContainer(e){this.setCssClass("breakpoint-widget");let t=this.store.add(new ME([{text:d(9330,null)},{text:d(9331,null)},{text:d(9332,null)},{text:d(9338,null)}],this.context,this.contextViewService,WE,{ariaLabel:d(9326,null),useCustomDrawn:!oI(this._configurationService)}));this.selectContainer=xFe(".breakpoint-select-container"),t.render(M(e,this.selectContainer)),this.store.add(t.onDidSelect(o=>{this.rememberInput(),this.context=o.index,this.updateContextInput()})),this.createModesInput(e),this.inputContainer=xFe(".inputContainer"),this.store.add(this.hoverService.setupManagedHover(Ri("mouse"),this.inputContainer,this.placeholder)),this.createBreakpointInput(M(e,this.inputContainer)),this.input.getModel().setValue(this.getInputValue(this.breakpoint)),this.store.add(this.input.getModel().onDidChangeContent(()=>{this.fitHeightToContent()})),this.input.setPosition({lineNumber:1,column:this.input.getModel().getLineMaxColumn(1)}),this.createTriggerBreakpointInput(e),this.updateContextInput(),setTimeout(()=>this.focusInput(),150)}createModesInput(e){let t=this.debugService.getModel().getBreakpointModes("source");if(t.length<=1)return;let o=this.selectModeBox=new ME([{text:d(9325,null),isDisabled:!0},...t.map(s=>({text:s.label,description:s.description}))],t.findIndex(s=>s.mode===this.breakpoint?.mode)+1,this.contextViewService,WE,{useCustomDrawn:!oI(this._configurationService)});this.store.add(o),this.store.add(o.onDidSelect(s=>{this.modeInput=t[s.index-1]}));let n=xFe(".select-mode-container"),r=xFe(".select-box-container");M(n,r),o.render(r),M(e,n)}createTriggerBreakpointInput(e){this.availableBreakpoints=this.debugService.getModel().getBreakpoints().filter(l=>l!==this.breakpoint&&!l.logMessage);let t=this.buildBreakpointOptions(),o=this.availableBreakpoints.findIndex(l=>this.breakpoint?.triggeredBy===l.getId()),n=this.selectBreakpointBox=this.store.add(new ME(t,o+1,this.contextViewService,WE,{ariaLabel:d(9336,null),useCustomDrawn:!oI(this._configurationService)}));this.store.add(n.onDidSelect(l=>{l.index===0?this.triggeredByBreakpointInput=void 0:this.triggeredByBreakpointInput=this.availableBreakpoints[l.index-1]})),this.selectBreakpointContainer=xFe(".select-breakpoint-container"),this.store.add(j(this.selectBreakpointContainer,re.KEY_DOWN,l=>{new gi(l).equals(9)&&this.close(!1)}));let r=xFe(".select-box-container");M(this.selectBreakpointContainer,r),n.render(r),M(e,this.selectBreakpointContainer);let s=new Wi(this.selectBreakpointContainer,Qo);s.label=d(9335,null),this.store.add(s.onDidClick(()=>this.close(!0))),this.store.add(s)}buildBreakpointOptions(){let e=[{text:d(9334,null),isDisabled:!0},...this.availableBreakpoints.map(t=>({text:`${this.labelService.getUriLabel(t.uri,{relative:!0})}: ${t.lineNumber}`,description:d(9337,null)}))];for(let[t,o]of this.availableBreakpoints.entries())this.textModelService.createModelReference(o.uri).then(n=>{try{e[t+1].description=n.object.textEditorModel.getLineContent(o.lineNumber).trim()}finally{n.dispose()}}).catch(()=>{e[t+1].description=d(9333,null)});return e}updateTriggerBreakpointList(){this.availableBreakpoints=this.debugService.getModel().getBreakpoints().filter(o=>o!==this.breakpoint&&!o.logMessage);let e=0;if(this.triggeredByBreakpointInput){let o=this.availableBreakpoints.findIndex(n=>n.getId()===this.triggeredByBreakpointInput?.getId());o!==-1?e=o+1:this.triggeredByBreakpointInput=void 0}let t=this.buildBreakpointOptions();this.selectBreakpointBox.setOptions(t,e)}updateContextInput(){if(this.context===3)this.inputContainer.hidden=!0,this.selectBreakpointContainer.hidden=!1,this.selectBreakpointBox&&this.updateTriggerBreakpointList();else{this.inputContainer.hidden=!1,this.selectBreakpointContainer.hidden=!0,this.setInputMode();let e=this.getInputValue(this.breakpoint);this.input.getModel().setValue(e),this.focusInput()}}_doLayout(e,t){this.heightInPx=e,this.input.layout({height:e,width:t-113}),this.centerInputVertically()}_onWidth(e){typeof this.heightInPx=="number"&&this._doLayout(this.heightInPx,e)}createBreakpointInput(e){let t=this.instantiationService.createChild(new _o([lRi,this]));this.store.add(t);let o=this.createEditorOptions(),n=BMe();this.input=t.createInstance(Xr,e,o,n),Hhi.bindTo(this.input.contextKeyService).set(!0);let r=this.modelService.createModel("",null,A.parse(`${KC}:${this.editor.getId()}:breakpointinput`),!0);this.editor.hasModel()&&r.setLanguage(this.editor.getModel().getLanguageId()),this.input.setModel(r),this.setInputMode(),this.store.add(r);let s=()=>{let c=this.input.getModel().getValue()?[]:ynn(this.themeService.getColorTheme(),this.placeholder);this.input.setDecorationsByType("breakpoint-widget",WSo,c)};this.store.add(this.input.getModel().onDidChangeContent(()=>s())),this.store.add(this.themeService.onDidColorThemeChange(()=>s())),this.store.add(this.languageFeaturesService.completionProvider.register({scheme:KC,hasAccessToAllModels:!0},{_debugDisplayName:"breakpointWidget",provideCompletionItems:(l,c,u,p)=>{let h,g=this.editor.getModel();return g&&(this.context===0||this.context===2&&Inn(this.input))?h=Yce(this.languageFeaturesService.completionProvider,g,new ye(this.lineNumber,1),new I5(void 0,new Set().add(28)),u,p).then(f=>{let v=0;if(this.context===0)v=c.column-1;else{let b=this.input.getModel().getValue();for(;c.column-2-v>=0&&b[c.column-2-v]!=="{"&&b[c.column-2-v]!==" ";)v++}return{suggestions:f.items.map(b=>(b.completion.range=z.fromPositions(c.delta(0,-v),c),b.completion))}}):h=Promise.resolve({suggestions:[]}),h}})),this.store.add(this._configurationService.onDidChangeConfiguration(l=>{(l.affectsConfiguration("editor.fontSize")||l.affectsConfiguration("editor.lineHeight"))&&(this.input.updateOptions(this.createEditorOptions()),this.centerInputVertically())}))}createEditorOptions(){let e=this._configurationService.getValue("editor"),t=Vb(this._configurationService);return t.fontSize=e.fontSize,t.fontFamily=e.fontFamily,t.lineHeight=e.lineHeight,t.fontLigatures=e.fontLigatures,t.ariaLabel=this.placeholder,t}centerInputVertically(){if(this.container&&typeof this.heightInPx=="number"){let e=this.input.getOption(75),t=this.input.getModel().getLineCount(),o=(this.heightInPx-t*e)/2;this.inputContainer.style.marginTop=o+"px"}}close(e){if(e){let t,o,n,r,s,l;if(this.rememberInput(),(this.conditionInput||this.context===0)&&(t=this.conditionInput),(this.hitCountInput||this.context===1)&&(o=this.hitCountInput),(this.logMessageInput||this.context===2)&&(n=this.logMessageInput),this.selectModeBox&&(s=this.modeInput?.mode,l=this.modeInput?.label),this.context===3&&(t=void 0,o=void 0,n=void 0,r=this.triggeredByBreakpointInput?.getId()),this.breakpoint){let c=new Map;c.set(this.breakpoint.getId(),{condition:t,hitCondition:o,logMessage:n,triggeredBy:r,mode:s,modeLabel:l}),this.debugService.updateBreakpoints(this.breakpoint.originalUri,c,!1).then(void 0,mt)}else{let c=this.editor.getModel();c&&this.debugService.addBreakpoints(c.uri,[{lineNumber:this.lineNumber,column:this.column,enabled:!0,condition:t,hitCondition:o,logMessage:n,triggeredBy:r,mode:s,modeLabel:l}])}}this.dispose()}focusInput(){this.context===3?this.selectBreakpointBox.focus():this.input.focus()}dispose(){super.dispose(),this.input.dispose(),Be(this.store),setTimeout(()=>this.editor.focus(),0)}};kFe=I([m(4,Wn),m(5,Ni),m(6,Le),m(7,F),m(8,Tt),m(9,qt),m(10,B),m(11,Qt),m(12,_e),m(13,rt),m(14,Bt),m(15,nt)],kFe);var e2t=class a extends Oc{static{this.ID="breakpointWidget.action.acceptInput"}constructor(){super({id:a.ID,precondition:d9e,kbOpts:{kbExpr:Hhi,primary:3,weight:100}})}runEditorCommand(i,e){i.get(lRi).close(!0)}},t2t=class a extends Oc{static{this.ID="closeBreakpointWidget"}constructor(){super({id:a.ID,precondition:d9e,kbOpts:{kbExpr:pe.textInputFocus,primary:9,secondary:[1033],weight:100}})}runEditorCommand(i,e,t){let o=e.getContribution(aA);if(o)return o.closeBreakpointWidget();i.get(lRi).close(!1)}};Xi(new e2t);Xi(new t2t);var wnn=_,Cnn={description:"breakpoint-helper-decoration",glyphMarginClassName:q.asClassName(Ltt),glyphMargin:{position:3},glyphMarginHoverMessage:new Ie().appendText(d(9224,null)),stickiness:1};function xnn(a,i,e,t,o,n){let r=[];return e.forEach(s=>{if(s.lineNumber>i.getLineCount())return;let l=e.some(p=>p!==s&&p.lineNumber===s.lineNumber),c=i.getLineFirstNonWhitespaceColumn(s.lineNumber),u=i.validateRange(s.column?new z(s.lineNumber,s.column,s.lineNumber,s.column+1):new z(s.lineNumber,c,s.lineNumber,c+1));r.push({options:knn(a,i,s,t,o,n,l),range:u})}),r}function knn(a,i,e,t,o,n,r){let s=a.get(Ni),l=a.get(_t),c=a.get(rt),{icon:u,message:p,showAdapterUnverifiedMessage:h}=zG(t,o,e,c,s.getModel()),g,f;if(h){let S;f=s.getModel().getSessions().map(y=>{let w=s.getAdapterManager().getDebugger(y.configuration.type),k=w?.strings?.unverifiedBreakpoints;if(k)return S||(S=l.guessLanguageIdByFilepathOrFirstLine(e.uri)??void 0),S&&w.interestedInLanguage(S)?k:void 0}).find(y=>!!y)}if(p)if(g=new Ie(void 0,{isTrusted:!0,supportThemeIcons:!0}),e.condition||e.hitCondition){let S=i.getLanguageId();g.appendCodeblock(S,p),f&&g.appendMarkdown("$(warning) "+f)}else g.appendText(p),f&&g.appendMarkdown(`

$(warning) `+f);else f&&(g=new Ie(void 0,{isTrusted:!0,supportThemeIcons:!0}).appendMarkdown(f));let v=null;n&&(v={color:Xs(i2t),position:1});let b=e.column&&(r||e.column>i.getLineFirstNonWhitespaceColumn(e.lineNumber));return{description:"breakpoint-decoration",glyphMargin:{position:3},glyphMarginClassName:q.asClassName(u),glyphMarginHoverMessage:g,stickiness:1,before:b?{content:eO,inlineClassName:"debug-breakpoint-placeholder",inlineClassNameAffectsLetterSpacing:!0}:void 0,overviewRuler:v,zIndex:9999}}async function Enn(a,i,e){return e.capabilities.supportsBreakpointLocationsRequest?await Promise.all(zo(i,t=>t).map(async t=>{try{return{lineNumber:t,positions:await e.breakpointsLocations(a.uri,t)}}catch{return{lineNumber:t,positions:[]}}})):[]}function Tnn(a,i,e){let t=[];for(let{positions:o,lineNumber:n}of e){if(o.length===0)continue;let r=a.getLineFirstNonWhitespaceColumn(n),s=a.getLineLastNonWhitespaceColumn(n);o.forEach(l=>{let c=new z(l.lineNumber,l.column,l.lineNumber,l.column+1);if(l.column<=r&&!i.some(p=>p.range.startColumn>r&&p.range.startLineNumber===l.lineNumber)||l.column>s)return;let u=i.find(p=>p.range.equalsRange(c));u&&u.inlineWidget||t.push({range:c,options:{description:"breakpoint-placeholder-decoration",stickiness:1,before:u?void 0:{content:eO,inlineClassName:"debug-breakpoint-placeholder",inlineClassNameAffectsLetterSpacing:!0}},breakpoint:u?u.breakpoint:void 0})})}return t}var EFe=class{constructor(i,e,t,o,n,r,s,l){this.editor=i;this.debugService=e;this.contextMenuService=t;this.instantiationService=o;this.dialogService=r;this.configurationService=s;this.labelService=l;this.breakpointHintDecoration=null;this.toDispose=[];this.ignoreDecorationsChangedEvent=!1;this.ignoreBreakpointsChangeEvent=!1;this.breakpointDecorations=[];this.candidateDecorations=[];this.breakpointWidgetVisible=d9e.bindTo(n),this.setDecorationsScheduler=new Dt(()=>this.setDecorations(),30),this.setDecorationsScheduler.schedule(),this.registerListeners()}getContextMenuActionsAtPosition(i,e){if(!this.debugService.getAdapterManager().hasEnabledDebuggers())return[];if(!this.debugService.canSetBreakpointsIn(e))return[];let t=this.debugService.getModel().getBreakpoints({lineNumber:i,uri:e.uri});return this.getContextMenuActions(t,e.uri,i)}registerListeners(){this.toDispose.push(this.editor.onMouseDown(async i=>{if(!this.debugService.getAdapterManager().hasEnabledDebuggers())return;let e=this.editor.getModel();if(!i.target.position||!e||i.target.type!==2||i.target.detail.isAfterLines||!this.marginFreeFromNonDebugDecorations(i.target.position.lineNumber)&&!i.target.element?.className.includes("breakpoint"))return;let t=this.debugService.canSetBreakpointsIn(e),o=i.target.position.lineNumber,n=e.uri;if(!(i.event.rightButton||Ze&&i.event.leftButton&&i.event.ctrlKey)){let r=this.debugService.getModel().getBreakpoints({uri:n,lineNumber:o});if(r.length){let s=i.event.shiftKey,l=r.some(c=>c.enabled);if(s)r.forEach(c=>this.debugService.enableOrDisableBreakpoints(!l,c));else if(!fn&&r.some(c=>!!c.condition||!!c.logMessage||!!c.hitCondition||!!c.triggeredBy)){let c=r.every(g=>!!g.logMessage),u=c?d(9245,null):d(9221,null),p=d(9222,null,u.toLowerCase(),c?d(9246,null):d(9225,null)),h=d(9223,null,u.toLowerCase(),c?d(9246,null):d(9225,null));await this.dialogService.prompt({type:bt.Info,message:l?h:p,buttons:[{label:d(9251,null,u),run:()=>r.forEach(g=>this.debugService.removeBreakpoints(g.getId()))},{label:d(9235,null,l?d(9231,null):d(9240,null),u),run:()=>r.forEach(g=>this.debugService.enableOrDisableBreakpoints(!l,g))}],cancelButton:!0})}else l?r.forEach(c=>this.debugService.removeBreakpoints(c.getId())):r.forEach(c=>this.debugService.enableOrDisableBreakpoints(!l,c))}else if(t)if(i.event.middleButton){let s=this.configurationService.getValue("debug").gutterMiddleClickAction;if(s!=="none"){let l;switch(s){case"logpoint":l=2;break;case"conditionalBreakpoint":l=0;break;case"triggeredBreakpoint":l=3}this.showBreakpointWidget(o,void 0,l)}}else this.debugService.addBreakpoints(n,[{lineNumber:o}])}})),yg.pointerEvents&&Jb||(this.toDispose.push(this.editor.onMouseMove(i=>{if(!this.debugService.getAdapterManager().hasEnabledDebuggers())return;let e=-1,t=this.editor.getModel();t&&i.target.position&&(i.target.type===2||i.target.type===3)&&this.debugService.canSetBreakpointsIn(t)&&this.marginFreeFromNonDebugDecorations(i.target.position.lineNumber)&&(i.target.detail.isAfterLines||(e=i.target.position.lineNumber)),this.ensureBreakpointHintDecoration(e)})),this.toDispose.push(this.editor.onMouseLeave(()=>{this.ensureBreakpointHintDecoration(-1)}))),this.toDispose.push(this.editor.onDidChangeModel(async()=>{this.closeBreakpointWidget(),await this.setDecorations()})),this.toDispose.push(this.debugService.getModel().onDidChangeBreakpoints(()=>{!this.ignoreBreakpointsChangeEvent&&!this.setDecorationsScheduler.isScheduled()&&this.setDecorationsScheduler.schedule()})),this.toDispose.push(this.debugService.onDidChangeState(()=>{this.setDecorationsScheduler.isScheduled()||this.setDecorationsScheduler.schedule()})),this.toDispose.push(this.editor.onDidChangeModelDecorations(()=>this.onModelDecorationsChanged())),this.toDispose.push(this.configurationService.onDidChangeConfiguration(async i=>{(i.affectsConfiguration("debug.showBreakpointsInOverviewRuler")||i.affectsConfiguration("debug.showInlineBreakpointCandidates"))&&await this.setDecorations()}))}getContextMenuActions(i,e,t,o){let n=[];if(i.length===1){let r=i[0].logMessage?d(9245,null):d(9221,null);n.push(ii({id:"debug.removeBreakpoint",label:d(9247,null,r),enabled:!0,run:async()=>{await this.debugService.removeBreakpoints(i[0].getId())}})),n.push(ii({id:"workbench.debug.action.editBreakpointAction",label:d(9236,null,r),enabled:!0,run:()=>Promise.resolve(this.showBreakpointWidget(i[0].lineNumber,i[0].column))})),n.push(ii({id:"workbench.debug.viewlet.action.toggleBreakpoint",label:i[0].enabled?d(9232,null,r):d(9241,null,r),enabled:!0,run:()=>this.debugService.enableOrDisableBreakpoints(!i[0].enabled,i[0])}))}else if(i.length>1){let r=i.slice().sort((s,l)=>s.column&&l.column?s.column-l.column:1);n.push(new Fs("debug.removeBreakpoints",d(9248,null),r.map(s=>ii({id:"removeInlineBreakpoint",label:s.column?d(9249,null,s.column):d(9250,null),enabled:!0,run:()=>this.debugService.removeBreakpoints(s.getId())})))),n.push(new Fs("debug.editBreakpoints",d(9237,null),r.map(s=>ii({id:"editBreakpoint",label:s.column?d(9238,null,s.column):d(9239,null),enabled:!0,run:()=>Promise.resolve(this.showBreakpointWidget(s.lineNumber,s.column))})))),n.push(new Fs("debug.enableDisableBreakpoints",d(9244,null),r.map(s=>ii({id:s.enabled?"disableColumnBreakpoint":"enableColumnBreakpoint",label:s.enabled?s.column?d(9234,null,s.column):d(9233,null):s.column?d(9243,null,s.column):d(9242,null),enabled:!0,run:()=>this.debugService.enableOrDisableBreakpoints(!s.enabled,s)}))))}else n.push(ii({id:"addBreakpoint",label:d(9217,null),enabled:!0,run:()=>this.debugService.addBreakpoints(e,[{lineNumber:t,column:o}])})),n.push(ii({id:"addConditionalBreakpoint",label:d(9218,null),enabled:!0,run:()=>Promise.resolve(this.showBreakpointWidget(t,o,0))})),n.push(ii({id:"addLogPoint",label:d(9219,null),enabled:!0,run:()=>Promise.resolve(this.showBreakpointWidget(t,o,2))})),n.push(ii({id:"addTriggeredBreakpoint",label:d(9220,null),enabled:!0,run:()=>Promise.resolve(this.showBreakpointWidget(t,o,3))}));return this.debugService.state===2&&(n.push(new ri),n.push(ii({id:"runToLine",label:d(9252,null),enabled:!0,run:()=>this.debugService.runTo(e,t).catch(mt)}))),n}marginFreeFromNonDebugDecorations(i){let e=this.editor.getLineDecorations(i);if(e)for(let{options:t}of e){let o=t.glyphMarginClassName;if(!o)continue;if(!(o.includes("codicon-")||o.startsWith("coverage-deco-"))||o.includes("codicon-testing-")||o.includes("codicon-merge-")||o.includes("codicon-arrow-")||o.includes("codicon-loading")||o.includes("codicon-fold")||o.includes("codicon-gutter-lightbulb")||o.includes("codicon-lightbulb-sparkle"))return!1}return!0}ensureBreakpointHintDecoration(i){this.editor.changeDecorations(e=>{this.breakpointHintDecoration&&(e.removeDecoration(this.breakpointHintDecoration),this.breakpointHintDecoration=null),i!==-1&&(this.breakpointHintDecoration=e.addDecoration({startLineNumber:i,startColumn:1,endLineNumber:i,endColumn:1},Cnn))})}async setDecorations(){if(!this.editor.hasModel())return;let i=(u,p)=>{let h=Tnn(t,this.breakpointDecorations,p),g=u.deltaDecorations(this.candidateDecorations.map(f=>f.decorationId),h);this.candidateDecorations.forEach(f=>{f.inlineWidget.dispose()}),this.candidateDecorations=g.map((f,v)=>{let b=h[v],S=b.breakpoint?zG(this.debugService.state,this.debugService.getModel().areBreakpointsActivated(),b.breakpoint,this.labelService,this.debugService.getModel()).icon:eW.disabled,y=()=>this.getContextMenuActions(b.breakpoint?[b.breakpoint]:[],e.getModel().uri,b.range.startLineNumber,b.range.startColumn),w=new Hnt(e,f,q.asClassName(S),b.breakpoint,this.debugService,this.contextMenuService,y);return{decorationId:f,inlineWidget:w}})},e=this.editor,t=e.getModel(),o=this.debugService.getModel().getBreakpoints({uri:t.uri}),n=this.configurationService.getValue("debug"),r=this.instantiationService.invokeFunction(u=>xnn(u,t,o,this.debugService.state,this.debugService.getModel().areBreakpointsActivated(),n.showBreakpointsInOverviewRuler)),s=this.debugService.getViewModel().focusedSession,l=n.showInlineBreakpointCandidates&&s?Enn(this.editor.getModel(),r.map(u=>u.range.startLineNumber),s):Promise.resolve([]),c=await Promise.race([l,Li(500).then(()=>{})]);c===void 0&&l.then(u=>e.changeDecorations(p=>i(p,u)));try{this.ignoreDecorationsChangedEvent=!0,e.changeDecorations(u=>{let p=u.deltaDecorations(this.breakpointDecorations.map(h=>h.decorationId),r);this.breakpointDecorations.forEach(h=>{h.inlineWidget?.dispose()}),this.breakpointDecorations=p.map((h,g)=>{let f,v=o[g];if(r[g].options.before){let b=()=>this.getContextMenuActions([v],e.getModel().uri,v.lineNumber,v.column);f=new Hnt(e,h,r[g].options.glyphMarginClassName,v,this.debugService,this.contextMenuService,b)}return{decorationId:h,breakpoint:v,range:r[g].range,inlineWidget:f}}),c&&i(u,c)})}finally{this.ignoreDecorationsChangedEvent=!1}for(let u of this.breakpointDecorations)u.inlineWidget&&this.editor.layoutContentWidget(u.inlineWidget)}async onModelDecorationsChanged(){if(this.breakpointDecorations.length===0||this.ignoreDecorationsChangedEvent||!this.editor.hasModel())return;let i=!1,e=this.editor.getModel();if(this.breakpointDecorations.forEach(o=>{if(i)return;let n=e.getDecorationRange(o.decorationId);n&&!o.range.equalsRange(n)&&(i=!0,o.range=n)}),!i)return;let t=new Map;for(let o=0,n=this.breakpointDecorations.length;o<n;o++){let r=this.breakpointDecorations[o],s=e.getDecorationRange(r.decorationId);s&&r.breakpoint&&t.set(r.breakpoint.getId(),{lineNumber:s.startLineNumber,column:r.breakpoint.column?s.startColumn:void 0})}try{this.ignoreBreakpointsChangeEvent=!0,await this.debugService.updateBreakpoints(e.uri,t,!0)}finally{this.ignoreBreakpointsChangeEvent=!1}}showBreakpointWidget(i,e,t){this.breakpointWidget?.dispose(),this.breakpointWidget=this.instantiationService.createInstance(kFe,this.editor,i,e,t),this.breakpointWidget.show({lineNumber:i,column:1}),this.breakpointWidgetVisible.set(!0)}closeBreakpointWidget(){this.breakpointWidget&&(this.breakpointWidget.dispose(),this.breakpointWidget=void 0,this.breakpointWidgetVisible.reset(),this.editor.focus())}dispose(){this.breakpointWidget?.dispose(),this.setDecorationsScheduler.dispose(),this.editor.removeDecorations(this.breakpointDecorations.map(i=>i.decorationId)),Be(this.toDispose)}};EFe=I([m(1,Ni),m(2,Xe),m(3,F),m(4,X),m(5,at),m(6,B),m(7,rt)],EFe);Bnt.registerGutterActionsGenerator(({lineNumber:a,editor:i,accessor:e},t)=>{let o=i.getModel(),n=e.get(Ni);if(!o||!n.getAdapterManager().hasEnabledDebuggers()||!n.canSetBreakpointsIn(o))return;let r=i.getContribution(aA);if(!r)return;let s=r.getContextMenuActionsAtPosition(a,o);for(let l of s)t.push(l,"2_debug")});var Hnt=class{constructor(i,e,t,o,n,r,s){this.editor=i;this.decorationId=e;this.breakpoint=o;this.debugService=n;this.contextMenuService=r;this.getContextMenuActions=s;this.allowEditorOverflow=!1;this.suppressMouseDown=!0;this.toDispose=[];this.range=this.editor.getModel().getDecorationRange(e),this.toDispose.push(this.editor.onDidChangeModelDecorations(()=>{let c=this.editor.getModel().getDecorationRange(this.decorationId);this.range&&!this.range.equalsRange(c)&&(this.range=c,this.editor.layoutContentWidget(this),this.updateSize())})),this.create(t),this.editor.addContentWidget(this),this.editor.layoutContentWidget(this)}create(i){this.domNode=wnn(".inline-breakpoint-widget"),i&&this.domNode.classList.add(...i.split(" ")),this.toDispose.push(j(this.domNode,re.CLICK,async e=>{switch(this.breakpoint?.enabled){case void 0:await this.debugService.addBreakpoints(this.editor.getModel().uri,[{lineNumber:this.range.startLineNumber,column:this.range.startColumn}]);break;case!0:await this.debugService.removeBreakpoints(this.breakpoint.getId());break;case!1:this.debugService.enableOrDisableBreakpoints(!0,this.breakpoint);break}})),this.toDispose.push(j(this.domNode,re.CONTEXT_MENU,e=>{let t=new Cn(Re(this.domNode),e),o=this.getContextMenuActions();this.contextMenuService.showContextMenu({getAnchor:()=>t,getActions:()=>o,getActionsContext:()=>this.breakpoint,onHide:()=>a1(o)})})),this.updateSize(),this.toDispose.push(this.editor.onDidChangeConfiguration(e=>{(e.hasChanged(61)||e.hasChanged(75))&&this.updateSize()}))}updateSize(){let i=this.range?this.editor.getLineHeightForPosition(this.range.getStartPosition()):this.editor.getOption(75);this.domNode.style.height=`${i}px`,this.domNode.style.width=`${Math.ceil(.8*i)}px`,this.domNode.style.marginLeft="4px"}getId(){return xt()}getDomNode(){return this.domNode}getPosition(){return this.range?(this.domNode.classList.toggle("line-start",this.range.startColumn===1),{position:{lineNumber:this.range.startLineNumber,column:this.range.startColumn-1},preference:[0]}):null}dispose(){this.editor.removeContentWidget(this),Be(this.toDispose)}};I([hi],Hnt.prototype,"getId",1);is((a,i)=>{let e=".monaco-editor .glyph-margin-widgets, .monaco-workbench .debug-breakpoints, .monaco-workbench .disassembly-view, .monaco-editor .contentWidgets",t=a.getColor(i2t);t&&(i.addRule(`${e} {
			${RUt.map(l=>`${q.asCSSSelector(l.regular)}`).join(`,
		`)},
			${q.asCSSSelector(LUt)},
			${q.asCSSSelector(Ltt)}:not([class*='codicon-debug-breakpoint']):not([class*='codicon-debug-stackframe']),
			${q.asCSSSelector(eW.regular)}${q.asCSSSelector(che)}::after,
			${q.asCSSSelector(eW.regular)}${q.asCSSSelector(lhe)}::after {
				color: ${t} !important;
			}
		}`),i.addRule(`${e} {
			${q.asCSSSelector(eW.pending)} {
				color: ${t} !important;
				font-size: 12px !important;
			}
		}`));let o=a.getColor(_nn);o&&i.addRule(`${e} {
			${RUt.map(l=>q.asCSSSelector(l.disabled)).join(`,
		`)} {
				color: ${o};
			}
		}`);let n=a.getColor(Dnn);n&&i.addRule(`${e} {
			${RUt.map(l=>q.asCSSSelector(l.unverified)).join(`,
		`)} {
				color: ${n};
			}
		}`);let r=a.getColor(Lnn);r&&i.addRule(`
		.monaco-editor .debug-top-stack-frame-column {
			color: ${r} !important;
		}
		${e} {
			${q.asCSSSelector(lhe)} {
				color: ${r} !important;
			}
		}
		`);let s=a.getColor(Rnn);s&&i.addRule(`${e} {
			${q.asCSSSelector(che)} {
				color: ${s} !important;
			}
		}`)});var i2t=te("debugIcon.breakpointForeground","#E51400",d(9228,null)),_nn=te("debugIcon.breakpointDisabledForeground","#848484",d(9227,null)),Dnn=te("debugIcon.breakpointUnverifiedForeground","#848484",d(9230,null)),Lnn=te("debugIcon.breakpointCurrentStackframeForeground",{dark:"#FFCC00",light:"#BE8700",hcDark:"#FFCC00",hcLight:"#BE8700"},d(9226,null)),Rnn=te("debugIcon.breakpointStackframeForeground","#89D185",d(9229,null));var _Fe=te("editor.stackFrameHighlightBackground",{dark:"#ffff0033",light:"#ffff6673",hcDark:"#ffff0033",hcLight:"#ffff6673"},d(9340,null)),DFe=te("editor.focusedStackFrameHighlightBackground",{dark:"#7abd7a4d",light:"#cee7ce73",hcDark:"#7abd7a4d",hcLight:"#cee7ce73"},d(9339,null)),o2t=1,Mnn={description:"top-stack-frame-margin",glyphMarginClassName:q.asClassName(lhe),glyphMargin:{position:3},zIndex:9999,stickiness:o2t,overviewRuler:{position:7,color:Xs(_Fe)}},Pnn={description:"focused-stack-frame-margin",glyphMarginClassName:q.asClassName(che),glyphMargin:{position:3},zIndex:9999,stickiness:o2t,overviewRuler:{position:7,color:Xs(DFe)}},cRi={description:"top-stack-frame-decoration",isWholeLine:!0,className:"debug-top-stack-frame-line",stickiness:o2t},Ann={description:"focused-stack-frame-decoration",isWholeLine:!0,className:"debug-focused-stack-frame-line",stickiness:o2t},dRi=a=>({description:"top-stack-frame-inline-decoration",before:{content:"\uEB8B",inlineClassName:a?"debug-top-stack-frame-column start-of-line":"debug-top-stack-frame-column",inlineClassNameAffectsLetterSpacing:!0}});function Nnn(a,i,e){let t=[],o=new z(a.range.startLineNumber,a.range.startColumn,a.range.startLineNumber,1073741824),n=new z(a.range.startLineNumber,a.range.startColumn,a.range.startLineNumber,a.range.startColumn+1),r=a.thread.getTopStackFrame();return a.getId()===r?.getId()?(i&&t.push({options:Mnn,range:n}),t.push({options:cRi,range:o}),a.range.startColumn>1&&t.push({options:dRi(e),range:o})):(i&&t.push({options:Pnn,range:n}),t.push({options:Ann,range:o})),t}var TFe=class extends x{constructor(e,t,o,n){super();this.editor=e;this.debugService=t;this.uriIdentityService=o;this.logService=n;this.decorations=this.editor.createDecorationsCollection();let r=()=>this.decorations.set(this.createCallStackDecorations());this._register(U.any(this.debugService.getViewModel().onDidFocusStackFrame,this.debugService.getModel().onDidChangeCallStack)(()=>{r()})),this._register(this.editor.onDidChangeModel(s=>{s.newModelUrl&&r()})),r()}createCallStackDecorations(){let e=this.editor;if(!e.hasModel())return[];let t=this.debugService.getViewModel().focusedStackFrame,o=[];return this.debugService.getModel().getSessions().forEach(n=>{let r=n===t?.thread.session;n.getAllThreads().forEach(s=>{if(s.stopped){let l=s.getCallStack(),c=[];l.length>0&&(t&&!t.equals(l[0])&&c.push(t),c.push(l[0])),c.forEach(u=>{if(u&&this.uriIdentityService.extUri.isEqual(u.source.uri,e.getModel()?.uri)){if(u.range.startLineNumber>e.getModel()?.getLineCount()||u.range.startLineNumber<1){this.logService.warn(`CallStackEditorContribution: invalid stack frame line number: ${u.range.startLineNumber}`);return}let p=e.getModel().getLineFirstNonWhitespaceColumn(u.range.startLineNumber)>=u.range.startColumn;o.push(...Nnn(u,r,p))}})}})}),zo(o,n=>`${n.options.className} ${n.options.glyphMarginClassName} ${n.range.startLineNumber} ${n.range.startColumn}`)}dispose(){super.dispose(),this.decorations.clear()}};TFe=I([m(1,Ni),m(2,ht),m(3,se)],TFe);var LFe=class extends x{constructor(e,t,o){super();this._notebookEditor=e;this._debugService=t;this._notebookExecutionStateService=o;this._currentTopDecorations=[];this._currentOtherDecorations=[];this._executingCellDecorations=[];let n=this._register(new Xo(200));this._register(t.getModel().onDidChangeCallStack(()=>this.updateExecutionDecorations())),this._register(t.getViewModel().onDidFocusStackFrame(()=>this.updateExecutionDecorations())),this._register(o.onDidChangeExecution(r=>{r.type===0&&this._notebookEditor.textModel&&r.affectsNotebook(this._notebookEditor.textModel.uri)&&n.trigger(()=>this.updateExecutionDecorations())}))}static{this.id="workbench.notebook.debug.pausedCellDecorations"}updateExecutionDecorations(){let e=this._notebookEditor.textModel?this._notebookExecutionStateService.getCellExecutionsByHandleForNotebook(this._notebookEditor.textModel.uri):void 0,t=[],o,n=l=>{let c=Zo.parse(l.source.uri);if(c&&c.notebook.toString()===this._notebookEditor.textModel?.uri.toString())return{handle:c.handle,range:l.range}};for(let l of this._debugService.getModel().getSessions())for(let c of l.getAllThreads()){let u=c.getTopStackFrame();if(u){let p=n(u);p&&(t.push(p),e?.delete(p.handle))}}let r=this._debugService.getViewModel().focusedStackFrame;if(r&&r.thread.stopped){let l=n(r);l&&!t.some(c=>c.handle===l?.handle&&z.equalsRange(c.range,l?.range))&&(o=l,e?.delete(o.handle))}this.setTopFrameDecoration(t),this.setFocusedFrameDecoration(o);let s=e?Array.from(e.entries()).filter(([l,c])=>c.state===3).map(([l])=>l):[];this.setExecutingCellDecorations(s)}setTopFrameDecoration(e){let t=e.map(({handle:o,range:n})=>{let r={overviewRuler:{color:_Fe,includeOutput:!1,modelRanges:[n],position:7}};return{handle:o,options:r}});this._currentTopDecorations=this._notebookEditor.deltaCellDecorations(this._currentTopDecorations,t)}setFocusedFrameDecoration(e){let t=[];if(e){let o={overviewRuler:{color:DFe,includeOutput:!1,modelRanges:[e.range],position:7}};t=[{handle:e.handle,options:o}]}this._currentOtherDecorations=this._notebookEditor.deltaCellDecorations(this._currentOtherDecorations,t)}setExecutingCellDecorations(e){let t=e.map(o=>{let n={overviewRuler:{color:Yho,includeOutput:!1,modelRanges:[new z(0,0,0,0)],position:1}};return{handle:o,options:n}});this._executingCellDecorations=this._notebookEditor.deltaCellDecorations(this._executingCellDecorations,t)}};LFe=I([m(1,Ni),m(2,bs)],LFe);bm(LFe.id,LFe);var RFe=class extends x{constructor(e,t,o){super();this._notebookEditor=e;this._debugService=t;this._configService=o;this._currentDecorations=[];this._register(t.getModel().onDidChangeBreakpoints(()=>this.updateDecorations())),this._register(o.onDidChangeConfiguration(n=>n.affectsConfiguration("debug.showBreakpointsInOverviewRuler")&&this.updateDecorations()))}static{this.id="workbench.notebook.debug.notebookBreakpointDecorations"}updateDecorations(){let t=this._configService.getValue("debug.showBreakpointsInOverviewRuler")?this._debugService.getModel().getBreakpoints().map(o=>{let n=Zo.parse(o.uri);if(!n||n.notebook.toString()!==this._notebookEditor.textModel.uri.toString())return null;let r={overviewRuler:{color:i2t,includeOutput:!1,modelRanges:[new z(o.lineNumber,0,o.lineNumber,0)],position:1}};return{handle:n.handle,options:r}}).filter(o=>!!o):[];this._currentDecorations=this._notebookEditor.deltaCellDecorations(this._currentDecorations,t)}};RFe=I([m(1,Ni),m(2,B)],RFe);bm(RFe.id,RFe);var Gge=class extends x{constructor(e,t,o){super();this._notebookEditor=e;this._notebookExecutionStateService=t;this._userActivity=o;this._activityMutex=this._register(new me);this._register(e.onDidScroll(()=>this._update())),this._register(t.onDidChangeExecution(n=>{n.notebook.toString()===this._notebookEditor.textModel?.uri.toString()&&this._update()})),this._register(e.onDidChangeModel(()=>this._update()))}static{this.id="workbench.notebook.executionEditorProgress"}_update(){if(!this._notebookEditor.hasModel())return;let e=this._notebookExecutionStateService.getCellExecutionsForNotebook(this._notebookEditor.textModel?.uri).filter(l=>l.state===3),t=this._notebookExecutionStateService.getExecution(this._notebookEditor.textModel?.uri),o=l=>{for(let c of this._notebookEditor.visibleRanges)for(let u of this._notebookEditor.getCellsInRange(c))if(u.handle===l.cellHandle){let p=this._notebookEditor.getAbsoluteTopOfElement(u);if(this._notebookEditor.scrollTop<p+5)return!0}return!1},n=e.length||t;n&&!this._activityMutex.value?this._activityMutex.value=this._userActivity.markActive():!n&&this._activityMutex.value&&this._activityMutex.clear();let r=e.length&&!e.some(o)&&!e.some(l=>l.isPaused);!!t||r?this._notebookEditor.showProgress():this._notebookEditor.hideProgress()}};I([_P(100)],Gge.prototype,"_update",1),Gge=I([m(1,bs),m(2,$ue)],Gge);bm(Gge.id,Gge);var Unt=class extends x{constructor(e,t,o){super();this._notebookKernelService=e;this._extensionService=t;this._notebookLoggingService=o;this._detectionMap=new Map;this._localDisposableStore=this._register(new N);this._registerListeners()}_registerListeners(){this._localDisposableStore.clear(),this._localDisposableStore.add(this._extensionService.onWillActivateByEvent(t=>{if(t.event.startsWith("onNotebook:")){if(this._extensionService.activationEventIsDone(t.event))return;let o=t.event.substring(11);if(o==="*")return;let n=!1,r=this._extensionService.getExtensionsStatus();if(this._extensionService.extensions.forEach(s=>{r[s.identifier.value].activationTimes||s.activationEvents?.includes(t.event)&&(n=!0)}),n&&!this._detectionMap.has(o)){this._notebookLoggingService.debug("KernelDetection",`start extension activation for ${o}`);let s=this._notebookKernelService.registerNotebookKernelDetectionTask({notebookType:o});this._detectionMap.set(o,s)}}}));let e=null;this._localDisposableStore.add(this._extensionService.onDidChangeExtensionsStatus(()=>{e&&clearTimeout(e),e=setTimeout(()=>{let t=[];for(let[o,n]of this._detectionMap)this._extensionService.activationEventIsDone(`onNotebook:${o}`)&&(this._notebookLoggingService.debug("KernelDetection",`finish extension activation for ${o}`),t.push(o),n.dispose());t.forEach(o=>{this._detectionMap.delete(o)})})})),this._localDisposableStore.add({dispose:()=>{e&&clearTimeout(e)}})}};Unt=I([m(0,Ol),m(1,lt),m(2,Uv)],Unt);ne.as(Qi.Workbench).registerWorkbenchContribution(Unt,3);var gQ=class extends x{constructor(e,t,o,n,r){super();this.notebookEditor=e;this.notebookExecutionStateService=t;this.markerService=o;this.chatAgentService=n;this.configurationService=r;this.enabled=!1;this.listening=!1;this.diagnosticsByHandle=new Map;this.updateEnabled(),this._register(n.onDidChangeAgents(()=>this.updateEnabled())),this._register(r.onDidChangeConfiguration(s=>{s.affectsConfiguration(yt.cellFailureDiagnostics)&&this.updateEnabled()}))}static{this.ID="workbench.notebook.cellDiagnostics"}hasNotebookAgent(){return!!this.chatAgentService.getAgents().find(t=>t.locations.includes("notebook"))}updateEnabled(){let e=this.configurationService.getValue(yt.cellFailureDiagnostics);this.enabled&&(!e||!this.hasNotebookAgent())?(this.enabled=!1,this.clearAll()):!this.enabled&&e&&this.hasNotebookAgent()&&(this.enabled=!0,this.listening||(this.listening=!0,this._register(U.accumulate(this.notebookExecutionStateService.onDidChangeExecution,200)(t=>this.handleChangeExecutionState(t)))))}handleChangeExecutionState(e){if(!this.enabled)return;let t=new Set;for(let o of e.reverse()){let n=this.notebookEditor.textModel?.uri;o.type===0&&n&&o.affectsNotebook(n)&&!t.has(o.cellHandle)&&(t.add(o.cellHandle),o.changed?this.clear(o.cellHandle):this.setDiagnostics(o.cellHandle))}}clearAll(){for(let e of this.diagnosticsByHandle.keys())this.clear(e)}clear(e){let t=this.diagnosticsByHandle.get(e);if(t){for(let o of t)o.dispose();this.diagnosticsByHandle.delete(e)}}setDiagnostics(e){if(this.diagnosticsByHandle.has(e))return;let t=this.notebookEditor.getCellByHandle(e);if(!t||t.cellKind!==2)return;let o=t.model.internalMetadata;if(t instanceof ih&&!o.lastRunSuccess&&o?.error?.location){let n=[],r=o.error.name?`${o.error.name}: ${o.error.message}`:o.error.message,s=this.createMarkerData(r,o.error.location);this.markerService.changeOne(gQ.ID,t.uri,[s]),n.push(Z(()=>this.markerService.changeOne(gQ.ID,t.uri,[]))),t.executionErrorDiagnostic.set(o.error,void 0),n.push(Z(()=>t.executionErrorDiagnostic.set(void 0,void 0))),n.push(be(l=>{t.executionErrorDiagnostic.read(l)||this.clear(e)})),n.push(t.model.onDidChangeOutputs(()=>{t.model.outputs.length===0&&this.clear(e)})),n.push(t.model.onDidChangeContent(()=>{this.clear(e)})),this.diagnosticsByHandle.set(e,n)}}createMarkerData(e,t){return{severity:8,message:e,startLineNumber:t.startLineNumber+1,startColumn:t.startColumn+1,endLineNumber:t.endLineNumber+1,endColumn:t.endColumn+1,source:"Cell Execution Error"}}dispose(){super.dispose(),this.clearAll()}};gQ=I([m(1,bs),m(2,oa),m(3,cr),m(4,B)],gQ);bm(gQ.ID,gQ);var n2t="notebook.cell.openFailureActions",Onn="notebook.cell.chat.fixError",Fnn="notebook.cell.chat.explainError";W(class extends Pd{constructor(){super({id:n2t,title:L(12315,"Show Cell Failure Actions"),precondition:C.and(Xme,Zme,SM.toNegated()),f1:!0,keybinding:{when:C.and(Xme,Zme,SM.toNegated()),primary:2137,weight:200}})}async runWithContext(a,i){if(i.cell instanceof ih){let e=i.cell.executionErrorDiagnostic.get();if(e?.location){let t=z.lift({startLineNumber:e.location.startLineNumber+1,startColumn:e.location.startColumn+1,endLineNumber:e.location.endLineNumber+1,endColumn:e.location.endColumn+1});i.notebookEditor.setCellEditorSelection(i.cell,z.lift(t));let o=ste(i,i.cell);o&&Cp.get(o)?.manualTriggerAtCurrentPosition(d(12314,null),"other (default)",{include:xr.QuickFix})}}}});W(class extends Pd{constructor(){super({id:Onn,title:L(12317,"Fix Cell Error"),precondition:C.and(Xme,Zme,SM.toNegated()),f1:!0})}async runWithContext(a,i){if(i.cell instanceof ih){let e=i.cell.executionErrorDiagnostic.get();if(e?.location){let t=z.lift({startLineNumber:e.location.startLineNumber+1,startColumn:e.location.startColumn+1,endLineNumber:e.location.endLineNumber+1,endColumn:e.location.endColumn+1});i.notebookEditor.setCellEditorSelection(i.cell,z.lift(t));let o=ste(i,i.cell);if(o){let n=Nd.get(o),r=e.name?`${e.name}: ${e.message}`:e.message;n&&await n.run({message:"/fix "+r,initialRange:t,autoSend:!0})}}}}});W(class extends Pd{constructor(){super({id:Fnn,title:L(12316,"Explain Cell Error"),precondition:C.and(Xme,Zme,SM.toNegated()),f1:!0})}async runWithContext(a,i){if(i.cell instanceof ih){let e=i.cell.executionErrorDiagnostic.get();if(e?.message){let o=await a.get(Pt).revealWidget(),n=e.name?`${e.name}: ${e.message}`:e.message;o?.acceptInput("@workspace /explain "+n)}}}});var MFe=class extends x{static{this.id="workbench.notebook.statusBar.diagtnostic"}constructor(i,e){super(),this._register(new IFe(i,(t,o)=>o instanceof ih?e.createInstance(znt,t,o):x.None))}};MFe=I([m(1,F)],MFe);bm(MFe.id,MFe);var znt=class extends x{constructor(e,t,o,n){super();this._notebookViewModel=e;this.cell=t;this.keybindingService=o;this.chatAgentService=n;this._currentItemIds=[];this._register(be(r=>this.updateSparkleItem(r.readObservable(t.executionErrorDiagnostic))))}hasNotebookAgent(){return!!this.chatAgentService.getAgents().find(t=>t.locations.includes("notebook"))}async updateSparkleItem(e){let t;e?.location&&this.hasNotebookAgent()&&(t={text:"$(sparkle)",tooltip:this.keybindingService.appendKeybinding(d(12318,null),n2t),alignment:1,command:n2t,priority:Number.MAX_SAFE_INTEGER-1});let o=t?[t]:[];this._currentItemIds=this._notebookViewModel.deltaCellStatusBarItems(this._currentItemIds,[{handle:this.cell.handle,items:o}])}dispose(){super.dispose(),this._notebookViewModel.deltaCellStatusBarItems(this._currentItemIds,[{handle:this.cell.handle,items:[]}])}};znt=I([m(2,_e),m(3,cr)],znt);var PFe=class extends x{constructor(e,t){super();this.notebookEditor=e;this.configurationService=t;this.isEnabled=!1;this.cellDecorationIds=new Map;this.anchorDisposables=new N;this.isEnabled=this.configurationService.getValue("editor.selectionHighlight"),this._register(this.configurationService.onDidChangeConfiguration(o=>{o.affectsConfiguration("editor.selectionHighlight")&&(this.isEnabled=this.configurationService.getValue("editor.selectionHighlight"))})),this._register(this.notebookEditor.onDidChangeActiveCell(async()=>{if(!this.isEnabled||(this.anchorCell=this.notebookEditor.activeCellAndCodeEditor,!this.anchorCell))return;let o=this.notebookEditor.getActiveCell();o&&(o.editorAttached||await U.toPromise(o.onDidChangeEditorAttachState),this.clearNotebookSelectionDecorations(),this.anchorDisposables.clear(),this.anchorDisposables.add(this.anchorCell[1].onDidChangeCursorPosition(n=>{if(n.reason!==3){this.clearNotebookSelectionDecorations();return}this.anchorCell&&this.notebookEditor.hasModel()&&(this.clearNotebookSelectionDecorations(),this._update(this.notebookEditor))})),this.notebookEditor.getEditorViewState().editorFocused&&this.notebookEditor.hasModel()&&this._update(this.notebookEditor))}))}static{this.id="notebook.selectionHighlighter"}_update(e){if(!this.anchorCell||!this.isEnabled)return;let t=this.anchorCell[0].textModel;if(!t||t.isTooLargeForTokenization())return;let o=this.anchorCell[0].getSelections()[0];if(o.startLineNumber!==o.endLineNumber||o.isEmpty())return;let n=this.getSearchText(o,t);if(!n)return;let r=e.textModel.findMatches(n,!1,!0,null);for(let s of r){let l=e.getCellByHandle(s.cell.handle);l&&this.updateCellDecorations(l,s.matches)}}updateCellDecorations(e,t){let o=t.map(s=>ti.fromRange(s.range,0)),n=[];o?.map(s=>{s.isEmpty()||n.push({range:s,options:{description:"",className:".nb-selection-highlight"}})});let r=this.cellDecorationIds.get(e)??[];this.cellDecorationIds.set(e,e.deltaModelDecorations(r,n))}clearNotebookSelectionDecorations(){this.cellDecorationIds.forEach((e,t)=>{let o=this.cellDecorationIds.get(t)??[];o&&(t.deltaModelDecorations(o,[]),this.cellDecorationIds.delete(t))})}getSearchText(e,t){return t.getValueInRange(e).replace(/\r\n/g,`
`)}dispose(){super.dispose(),this.anchorDisposables.dispose()}};PFe=I([m(1,B)],PFe);bm(PFe.id,PFe);var Sm=class extends Ts{constructor(e,t,o,n,r,s,l,c,u){super(Sm.ID,e,l,o,c);this.instantiationService=t;this._parentContextKeyService=n;this.notebookEditorWorkerService=r;this.configurationService=s;this.notebookService=u;this.modelSpecificResources=this._register(new N),this.ctxAllCollapsed=this._parentContextKeyService.createKey(ego.key,!1),this.ctxHasUnchangedCells=this._parentContextKeyService.createKey(Dhe.key,!1),this.ctxHiddenUnchangedCells=this._parentContextKeyService.createKey(tit.key,!0),this._notebookOptions=t.createInstance(VT,this.window,!1,void 0),this._register(this._notebookOptions)}static{this.ID=AJi}get textModel(){return this._model?.modified.notebook}get notebookOptions(){return this._notebookOptions}get fontInfo(){return this._fontInfo||(this._fontInfo=this.createFontInfo()),this._fontInfo}layout(e,t){this._multiDiffEditorWidget.layout(e)}createFontInfo(){let e=this.configurationService.getValue("editor");return iw.readFontInfo(this.window,QS(e,bu.getInstance(this.window).value))}createEditor(e){this._multiDiffEditorWidget=this._register(this.instantiationService.createInstance(Fte,e,this.instantiationService.createInstance(Knt))),this._register(this._multiDiffEditorWidget.onDidChangeActiveControl(()=>{this._onDidChangeControl.fire()}))}async setInput(e,t,o,n){super.setInput(e,t,o,n);let r=await e.resolve();this._model!==r&&(this._detachModel(),this._model=r);let s=this.modelSpecificResources.add(new hAe),l=this.instantiationService.createInstance(Dte,this.fontInfo.lineHeight);this.viewModel=this.modelSpecificResources.add(new CAe(r,this.notebookEditorWorkerService,this.configurationService,s,this.notebookService,l,void 0,!0)),await this.viewModel.computeDiff(this.modelSpecificResources.add(new Ye).token),this.ctxHasUnchangedCells.set(this.viewModel.hasUnchangedCells),this.ctxHasUnchangedCells.set(this.viewModel.hasUnchangedCells);let c=this.modelSpecificResources.add(vte.createInput(this.viewModel,this.instantiationService));this.widgetViewModel=this.modelSpecificResources.add(await c.getViewModel());let u=new WeakSet;this.modelSpecificResources.add(be(p=>{if(!this.widgetViewModel||!this.viewModel)return;let h=this.widgetViewModel.items.read(p),g=this.viewModel.value;h.length===g.length&&Gi(f=>{h.forEach(v=>{if(u.has(v))return;u.add(v);let b=g.find(S=>S.modifiedUri?.toString()===v.modifiedUri?.toString()&&S.originalUri?.toString()===v.originalUri?.toString());b&&b.type==="unchanged"&&v.collapsed.set(!0,f)})})})),this._multiDiffEditorWidget.setViewModel(this.widgetViewModel)}_detachModel(){this.viewModel=void 0,this.modelSpecificResources.clear()}_generateFontFamily(){return this.fontInfo.fontFamily??'"SF Mono", Monaco, Menlo, Consolas, "Ubuntu Mono", "Liberation Mono", "DejaVu Sans Mono", "Courier New", monospace'}setOptions(e){super.setOptions(e)}getControl(){return this._multiDiffEditorWidget.getActiveControl()}focus(){super.focus(),this._multiDiffEditorWidget?.getActiveControl()?.focus()}hasFocus(){return this._multiDiffEditorWidget?.getActiveControl()?.hasTextFocus()||super.hasFocus()}clearInput(){super.clearInput(),this._multiDiffEditorWidget.setViewModel(void 0),this.modelSpecificResources.clear(),this.viewModel=void 0,this.widgetViewModel=void 0}expandAll(){this.widgetViewModel&&(this.widgetViewModel.expandAll(),this.ctxAllCollapsed.set(!1))}collapseAll(){this.widgetViewModel&&(this.widgetViewModel.collapseAll(),this.ctxAllCollapsed.set(!0))}hideUnchanged(){this.viewModel&&(this.viewModel.includeUnchanged=!1,this.ctxHiddenUnchangedCells.set(!0))}showUnchanged(){this.viewModel&&(this.viewModel.includeUnchanged=!0,this.ctxHiddenUnchangedCells.set(!1))}getDiffElementViewModel(e){if(e.scheme===Q.vscodeNotebookCellOutput||e.scheme===Q.vscodeNotebookCellOutputDiff||e.scheme===Q.vscodeNotebookCellMetadata||e.scheme===Q.vscodeNotebookCellMetadataDiff){let t=Zo.parseCellPropertyUri(e,e.scheme);t&&(e=Zo.generate(t.notebook,t.handle))}return e.scheme===Q.vscodeNotebookMetadata?this.viewModel?.items.find(t=>t.type==="modifiedMetadata"||t.type==="unchangedMetadata"):this.viewModel?.items.find(t=>{switch(t.type){case"delete":return t.original?.uri.toString()===e.toString();case"insert":return t.modified?.uri.toString()===e.toString();case"modified":case"unchanged":return t.modified?.uri.toString()===e.toString()||t.original?.uri.toString()===e.toString();default:return}})}};Sm=I([m(1,F),m(2,Le),m(3,X),m(4,kG),m(5,B),m(6,Te),m(7,ce),m(8,bn)],Sm);var Knt=class{constructor(i,e,t){this._instantiationService=i;this.notebookDocumentService=e;this.notebookService=t}createResourceLabel(i){let e=this._instantiationService.createInstance(Tk,i,{}),t=this;return{setUri(o,n={}){if(!o)e.element.clear();else{let r="",s="",l;if(o.scheme===Q.vscodeNotebookCell){let c=o.scheme===Q.vscodeNotebookCell?t.notebookDocumentService.getNotebook(o):void 0,u=Q.vscodeNotebookCell?t.notebookDocumentService.getNotebook(o)?.getCellIndex(o):void 0;if(c&&u!==void 0){r=d(12585,null,`${u+1}`);let p=c?t.notebookService.getNotebookTextModel(c?.uri):void 0,h=p&&u!==void 0?p.cells[u].language:void 0;l=h?lK(h):void 0}}else o.scheme===Q.vscodeNotebookCellMetadata||o.scheme===Q.vscodeNotebookCellMetadataDiff?s=d(12586,null):(o.scheme===Q.vscodeNotebookCellOutput||o.scheme===Q.vscodeNotebookCellOutputDiff)&&(s=d(12587,null));e.element.setResource({name:r,description:s},{strikethrough:n.strikethrough,forceLabel:!0,hideIcon:!l,extraClasses:l})}},dispose(){e.dispose()}}}};Knt=I([m(0,F),m(1,U5),m(2,bn)],Knt);W(class extends K{constructor(){super({id:"notebook.diff.openFile",icon:R.goToFile,title:L(12571,"Open File"),precondition:C.or(fr.isEqualTo(nh.ID),fr.isEqualTo(Sm.ID)),menu:[{id:D.EditorTitle,group:"navigation",when:C.or(fr.isEqualTo(nh.ID),fr.isEqualTo(Sm.ID))}]})}async run(a){let i=a.get(ee),e=i.activeEditorPane;if(e&&(e instanceof nh||e instanceof Sm)){let o=e.input.modified.resource;await i.openEditor({resource:o})}}});W(class extends K{constructor(){super({id:"notebook.diff.cell.toggleCollapseUnchangedRegions",title:L(12567,"Toggle Collapse Unchanged Regions"),icon:R.map,toggled:C.has("config.diffEditor.hideUnchangedRegions.enabled"),precondition:fr.isEqualTo(nh.ID),menu:{id:D.EditorTitle,group:"navigation",when:fr.isEqualTo(nh.ID)}})}run(a,...i){let e=a.get(B),t=!e.getValue("diffEditor.hideUnchangedRegions.enabled");e.updateValue("diffEditor.hideUnchangedRegions.enabled",t)}});W(class extends K{constructor(){super({id:"notebook.diff.switchToText",icon:Dmo,title:L(12575,"Open Text Diff Editor"),precondition:C.or(fr.isEqualTo(nh.ID),fr.isEqualTo(Sm.ID)),menu:[{id:D.EditorTitle,group:"navigation",when:C.or(fr.isEqualTo(nh.ID),fr.isEqualTo(Sm.ID))}]})}async run(a){let i=a.get(ee),e=i.activeEditorPane;if(e&&(e instanceof nh||e instanceof Sm)){let t=e.input;await i.openEditor({original:{resource:t.original.resource},modified:{resource:t.resource},label:t.getName(),options:{preserveFocus:!1,override:la.id}})}}});W(class extends K{constructor(){super({id:"notebook.diffEditor.showUnchangedCells",title:L(12577,"Show Unchanged Cells"),icon:R.unfold,precondition:C.and(fr.isEqualTo(Sm.ID),C.has(Dhe.key)),menu:{when:C.and(fr.isEqualTo(Sm.ID),C.has(Dhe.key),C.equals(tit.key,!0)),id:D.EditorTitle,order:22,group:"navigation"}})}run(a,...i){let e=a.get(ee).activeEditorPane;e&&e instanceof Sm&&e.showUnchanged()}});W(class extends K{constructor(){super({id:"notebook.diffEditor.hideUnchangedCells",title:L(12559,"Hide Unchanged Cells"),icon:R.fold,precondition:C.and(fr.isEqualTo(Sm.ID),C.has(Dhe.key)),menu:{when:C.and(fr.isEqualTo(Sm.ID),C.has(Dhe.key),C.equals(tit.key,!1)),id:D.EditorTitle,order:22,group:"navigation"}})}run(a,...i){let e=a.get(ee).activeEditorPane;e&&e instanceof Sm&&e.hideUnchanged()}});W(class extends K{constructor(){super({id:"notebook.diffEditor.2.goToCell",title:L(12558,"Go To Cell"),icon:R.goToFile,menu:{when:C.and(fr.isEqualTo(Sm.ID),C.equals(k8.key,"Cell"),C.notEquals(E8.key,"delete")),id:D.MultiDiffEditorFileToolbar,order:0,group:"navigation"}})}async run(i,...e){let t=e[0],o=i.get(ee);o.activeEditorPane instanceof Sm&&await o.openEditor({resource:t,options:{selectionRevealType:1}})}});W(class extends K{constructor(){super({id:"notebook.diff.revertMetadata",title:d(12572,null),icon:ate,f1:!1,menu:{id:D.NotebookDiffDocumentMetadata,when:eit},precondition:eit})}run(a,i){!i||!(a.get(ee).activeEditorPane instanceof nh)||i.modifiedDocumentTextModel.applyEdits([{editType:5,metadata:i.originalMetadata.metadata}],!0,void 0,()=>{},void 0,!0)}});var BSo=d(12563,null);W(class extends K{constructor(){super({id:"notebook.diffEditor.2.cell.revertInput",title:BSo,icon:ate,menu:{when:C.and(fr.isEqualTo(Sm.ID),C.equals(k8.key,"Cell"),C.equals(E8.key,"modified")),id:D.MultiDiffEditorFileToolbar,order:2,group:"navigation"}})}async run(a,...i){let e=i[0],o=a.get(ee).activeEditorPane;if(!(o instanceof Sm))return;let n=o.getDiffElementViewModel(e);if(n&&n instanceof bx){let r=n.modified,s=n.original;if(!s||!r)return;await a.get(La).apply([new nl(r.uri,{range:r.textModel.getFullModelRange(),text:s.textModel.getValue()})],{quotableLabel:"Revert Notebook Cell Content Change"})}}});var Wnn=d(12565,null);W(class extends K{constructor(){super({id:"notebook.diffEditor.2.cell.revertOutputs",title:Wnn,icon:ate,f1:!1,menu:{when:C.and(fr.isEqualTo(Sm.ID),C.equals(k8.key,"Output"),C.equals(E8.key,"modified")),id:D.MultiDiffEditorFileToolbar,order:2,group:"navigation"}})}async run(a,...i){let e=i[0],o=a.get(ee).activeEditorPane;if(!(o instanceof Sm))return;let n=o.getDiffElementViewModel(e);if(n&&n instanceof bx){let r=n.original,s=n.modifiedDocument.cells.findIndex(l=>l.handle===n.modified.handle);if(s===-1)return;n.mainDocumentTextModel.applyEdits([{editType:2,index:s,outputs:r.outputs}],!0,void 0,()=>{},void 0,!0)}}});var HSo=d(12564,null);W(class extends K{constructor(){super({id:"notebook.diffEditor.2.cell.revertMetadata",title:HSo,icon:ate,f1:!1,menu:{when:C.and(fr.isEqualTo(Sm.ID),C.equals(k8.key,"Metadata"),C.equals(E8.key,"modified")),id:D.MultiDiffEditorFileToolbar,order:2,group:"navigation"}})}async run(a,...i){let e=i[0],o=a.get(ee).activeEditorPane;if(!(o instanceof Sm))return;let n=o.getDiffElementViewModel(e);if(n&&n instanceof bx){let r=n.original,s=n.modifiedDocument.cells.findIndex(l=>l.handle===n.modified.handle);if(s===-1)return;n.mainDocumentTextModel.applyEdits([{editType:3,index:s,metadata:r.metadata}],!0,void 0,()=>{},void 0,!0)}}});W(class extends K{constructor(){super({id:"notebook.diff.cell.revertMetadata",title:HSo,icon:ate,f1:!1,menu:{id:D.NotebookDiffCellMetadataTitle,when:_he},precondition:_he})}run(a,i){if(!i||!(i instanceof bx))return;let e=i.original,t=i.modified,o=i.mainDocumentTextModel.cells.indexOf(t.textModel);if(o===-1)return;let n=[{editType:3,index:o,metadata:e.metadata}];i.original.language&&i.modified.language!==i.original.language&&n.push({editType:4,index:o,language:i.original.language}),i.modifiedDocument.applyEdits(n,!0,void 0,()=>{},void 0,!0)}});W(class extends K{constructor(){super({id:"notebook.diff.cell.switchOutputRenderingStyleToText",title:d(12566,null),icon:Rmo,f1:!1,menu:{id:D.NotebookDiffCellOutputsTitle,when:l1t}})}run(a,i){i&&(i.renderOutput=!i.renderOutput)}});W(class extends K{constructor(){super({id:"notebook.diff.cell.revertOutputs",title:d(12565,null),icon:ate,f1:!1,menu:{id:D.NotebookDiffCellOutputsTitle,when:_he},precondition:_he})}run(a,i){if(!i||!(i instanceof bx))return;let e=i.original,t=i.modified,o=i.mainDocumentTextModel.cells.indexOf(t.textModel);o!==-1&&i.mainDocumentTextModel.applyEdits([{editType:2,index:o,outputs:e.outputs}],!0,void 0,()=>{},void 0,!0)}});W(class extends K{constructor(){super({id:"notebook.toggle.diff.cell.ignoreTrimWhitespace",title:d(12560,null),icon:Lmo,f1:!1,menu:{id:D.NotebookDiffCellInputTitle,when:The,order:1},precondition:The,toggled:C.equals(nTi,!1)})}run(a,i){let e=i;if(!e?.modified)return;let t=e.modified.uri,o=a.get(Fn),n="diffEditor.ignoreTrimWhitespace",r=o.getValue(t,n);o.updateValue(t,n,!r)}});W(class extends K{constructor(){super({id:"notebook.diff.cell.revertInput",title:BSo,icon:ate,f1:!1,menu:{id:D.NotebookDiffCellInputTitle,when:The,order:2},precondition:The})}run(a,i){if(!i)return;let e=i.original,t=i.modified;return!e||!t?void 0:a.get(La).apply([new nl(t.uri,{range:t.textModel.getFullModelRange(),text:e.textModel.getValue()})],{quotableLabel:"Revert Notebook Cell Content Change"})}});var r2t=class extends K{constructor(e,t,o,n,r,s,l){super({id:e,title:t,precondition:o,menu:[{id:D.EditorTitle,group:"notebook",when:o,order:r}],toggled:n});this.toggleOutputs=s;this.toggleMetadata=l}async run(e){let t=e.get(B);if(this.toggleOutputs!==void 0){let o=t.getValue("notebook.diff.ignoreOutputs");t.updateValue("notebook.diff.ignoreOutputs",!o)}if(this.toggleMetadata!==void 0){let o=t.getValue("notebook.diff.ignoreMetadata");t.updateValue("notebook.diff.ignoreMetadata",!o)}}};W(class extends r2t{constructor(){super("notebook.diff.showOutputs",L(12574,"Show Outputs Differences"),C.or(fr.isEqualTo(nh.ID),fr.isEqualTo(Sm.ID)),C.notEquals("config.notebook.diff.ignoreOutputs",!0),2,!0,void 0)}});W(class extends r2t{constructor(){super("notebook.diff.showMetadata",L(12573,"Show Metadata Differences"),C.or(fr.isEqualTo(nh.ID),fr.isEqualTo(Sm.ID)),C.notEquals("config.notebook.diff.ignoreMetadata",!0),1,void 0,!0)}});W(class extends K{constructor(){super({id:"notebook.diff.action.previous",title:d(12562,null),icon:Pmo,f1:!1,keybinding:{primary:1597,weight:200,when:fr.isEqualTo(nh.ID)},menu:{id:D.EditorTitle,group:"navigation",when:fr.isEqualTo(nh.ID)}})}run(a){let i=a.get(ee);if(i.activeEditorPane?.getId()!==TX)return;i.activeEditorPane.getControl()?.previousChange()}});W(class extends K{constructor(){super({id:"notebook.diff.action.next",title:d(12561,null),icon:Amo,f1:!1,keybinding:{primary:573,weight:200,when:fr.isEqualTo(nh.ID)},menu:{id:D.EditorTitle,group:"navigation",when:fr.isEqualTo(nh.ID)}})}run(a){let i=a.get(ee);if(i.activeEditorPane?.getId()!==TX)return;i.activeEditorPane.getControl()?.nextChange()}});W(class extends K{constructor(){super({id:"notebook.diff.inline.toggle",title:d(12570,null),menu:{id:D.EditorTitle,group:"1_diff",order:10,when:C.and(fr.isEqualTo(nh.ID),C.equals("config.notebook.diff.experimental.toggleInline",!0),Kg.negate(),Gk.negate())}})}run(a){let i=a.get(ee);if(i.activeEditorPane?.getId()!==TX)return;i.activeEditorPane.getControl()?.toggleInlineView()}});ne.as(Jt.Configuration).registerConfiguration({id:"notebook",order:100,type:"object",properties:{"notebook.diff.ignoreMetadata":{type:"boolean",default:!1,markdownDescription:d(12568,null)},"notebook.diff.ignoreOutputs":{type:"boolean",default:!1,markdownDescription:d(12569,null)},"notebook.diff.experimental.toggleInline":{type:"boolean",default:typeof ro.quality=="string"&&ro.quality!=="stable",markdownDescription:d(12576,null)}}});var AFe=class extends x{constructor(e,t,o,n){super();this._instantiationService=e;this._logService=t;this._notebookService=o;this._accessibilitySignalService=n;this._executions=new gt;this._notebookExecutions=new gt;this._notebookListeners=new gt;this._cellListeners=new gt;this._lastFailedCells=new gt;this._lastCompletedCellHandles=new gt;this._onDidChangeExecution=this._register(new E);this.onDidChangeExecution=this._onDidChangeExecution.event;this._onDidChangeLastRunFailState=this._register(new E);this.onDidChangeLastRunFailState=this._onDidChangeLastRunFailState.event}getLastFailedCellForNotebook(e){let t=this._lastFailedCells.get(e);return t?.visible?t.cellHandle:void 0}getLastCompletedCellForNotebook(e){return this._lastCompletedCellHandles.get(e)}forceCancelNotebookExecutions(e){let t=this._executions.get(e);if(t)for(let o of t.values())this._onCellExecutionDidComplete(e,o.cellHandle,o);this._notebookExecutions.has(e)&&this._onExecutionDidComplete(e)}getCellExecution(e){let t=Zo.parse(e);if(!t)throw new Error(`Not a cell URI: ${e}`);let o=this._executions.get(t.notebook);if(o)return o.get(t.handle)}getExecution(e){return this._notebookExecutions.get(e)?.[0]}getCellExecutionsForNotebook(e){let t=this._executions.get(e);return t?Array.from(t.values()):[]}getCellExecutionsByHandleForNotebook(e){let t=this._executions.get(e);return t?new Map(t.entries()):void 0}_onCellExecutionDidChange(e,t,o){this._onDidChangeExecution.fire(new $nt(e,t,o))}_onCellExecutionDidComplete(e,t,o,n){let r=this._executions.get(e);if(!r){this._logService.debug(`NotebookExecutionStateService#_onCellExecutionDidComplete - unknown notebook ${e.toString()}`);return}o.dispose();let s=Zo.generate(e,t);this._cellListeners.get(s)?.dispose(),this._cellListeners.delete(s),r.delete(t),r.size===0&&(this._executions.delete(e),this._notebookListeners.get(e)?.dispose(),this._notebookListeners.delete(e)),n!==void 0&&(n?(this._executions.size===0&&this._accessibilitySignalService.playSignal($o.notebookCellCompleted),this._clearLastFailedCell(e)):(this._accessibilitySignalService.playSignal($o.notebookCellFailed),this._setLastFailedCell(e,t)),this._lastCompletedCellHandles.set(e,t)),this._onDidChangeExecution.fire(new $nt(e,t))}_onExecutionDidChange(e,t){this._onDidChangeExecution.fire(new jnt(e,t))}_onExecutionDidComplete(e){let t=this._notebookExecutions.get(e);if(!Array.isArray(t)){this._logService.debug(`NotebookExecutionStateService#_onCellExecutionDidComplete - unknown notebook ${e.toString()}`);return}this._notebookExecutions.delete(e),this._onDidChangeExecution.fire(new jnt(e)),t.forEach(o=>o.dispose())}createCellExecution(e,t){let o=this._notebookService.getNotebookTextModel(e);if(!o)throw new Error(`Notebook not found: ${e.toString()}`);let n=this._executions.get(e);if(!n){let s=this._instantiationService.createInstance(NFe,e);this._notebookListeners.set(e,s),n=new Map,this._executions.set(e,n)}let r=n.get(t);return r||(r=this._createNotebookCellExecution(o,t),n.set(t,r),r.initialize(),this._onDidChangeExecution.fire(new $nt(e,t,r))),r}createExecution(e){let t=this._notebookService.getNotebookTextModel(e);if(!t)throw new Error(`Notebook not found: ${e.toString()}`);if(!this._notebookListeners.has(e)){let n=this._instantiationService.createInstance(NFe,e);this._notebookListeners.set(e,n)}let o=this._notebookExecutions.get(e);return o||(o=this._createNotebookExecution(t),this._notebookExecutions.set(e,o),this._onDidChangeExecution.fire(new jnt(e,o[0]))),o[0]}_createNotebookCellExecution(e,t){let o=e.uri,n=this._instantiationService.createInstance(Gnt,t,e),r=wn(n.onDidUpdate(()=>this._onCellExecutionDidChange(o,t,n)),n.onDidComplete(s=>this._onCellExecutionDidComplete(o,t,n,s)));return this._cellListeners.set(Zo.generate(o,t),r),n}_createNotebookExecution(e){let t=e.uri,o=this._instantiationService.createInstance(qnt,e),n=wn(o.onDidUpdate(()=>this._onExecutionDidChange(t,o)),o.onDidComplete(()=>this._onExecutionDidComplete(t)));return[o,n]}_setLastFailedCell(e,t){let o=this._lastFailedCells.get(e),n=this._notebookService.getNotebookTextModel(e);if(!n)return;let r={cellHandle:t,disposable:o?o.disposable:this._getFailedCellListener(n),visible:!0};this._lastFailedCells.set(e,r),this._onDidChangeLastRunFailState.fire({visible:!0,notebook:e})}_setLastFailedCellVisibility(e,t){let o=this._lastFailedCells.get(e);o&&this._lastFailedCells.set(e,{cellHandle:o.cellHandle,disposable:o.disposable,visible:t}),this._onDidChangeLastRunFailState.fire({visible:t,notebook:e})}_clearLastFailedCell(e){let t=this._lastFailedCells.get(e);t&&(t.disposable?.dispose(),this._lastFailedCells.delete(e)),this._onDidChangeLastRunFailState.fire({visible:!1,notebook:e})}_getFailedCellListener(e){return e.onWillAddRemoveCells(t=>{let o=this._lastFailedCells.get(e.uri)?.cellHandle;if(o!==void 0){let n=e.cells.findIndex(r=>r.handle===o);t.rawEvent.changes.forEach(([r,s,l])=>{s&&n>=r&&n<r+s&&this._setLastFailedCellVisibility(e.uri,!1),l.some(c=>c.handle===o)&&this._setLastFailedCellVisibility(e.uri,!0)})}})}dispose(){super.dispose(),this._executions.forEach(e=>{e.forEach(t=>t.dispose()),e.clear()}),this._executions.clear(),this._notebookExecutions.forEach(e=>{e.forEach(t=>t.dispose())}),this._notebookExecutions.clear(),this._cellListeners.forEach(e=>e.dispose()),this._notebookListeners.forEach(e=>e.dispose()),this._lastFailedCells.forEach(e=>e.disposable.dispose())}};AFe=I([m(0,F),m(1,se),m(2,bn),m(3,lr)],AFe);var $nt=class{constructor(i,e,t){this.notebook=i;this.cellHandle=e;this.changed=t;this.type=0}affectsCell(i){let e=Zo.parse(i);return!!e&&Qe(this.notebook,e.notebook)&&this.cellHandle===e.handle}affectsNotebook(i){return Qe(this.notebook,i)}},jnt=class{constructor(i,e){this.notebook=i;this.changed=e;this.type=1}affectsNotebook(i){return Qe(this.notebook,i)}},NFe=class extends x{constructor(e,t,o,n,r,s){super();this._notebookService=t;this._notebookKernelService=o;this._notebookExecutionService=n;this._notebookExecutionStateService=r;this._logService=s;this._logService.debug(`NotebookExecution#ctor ${e.toString()}`);let l=this._notebookService.getNotebookTextModel(e);if(!l)throw new Error("Notebook not found: "+e);this._notebookModel=l,this._register(this._notebookModel.onWillAddRemoveCells(c=>this.onWillAddRemoveCells(c))),this._register(this._notebookModel.onWillDispose(()=>this.onWillDisposeDocument()))}cancelAll(){this._logService.debug("NotebookExecutionListeners#cancelAll");let e=this._notebookExecutionStateService.getCellExecutionsForNotebook(this._notebookModel.uri);this._notebookExecutionService.cancelNotebookCellHandles(this._notebookModel,e.map(t=>t.cellHandle))}onWillDisposeDocument(){this._logService.debug("NotebookExecution#onWillDisposeDocument"),this.cancelAll()}onWillAddRemoveCells(e){let t=this._notebookExecutionStateService.getCellExecutionsByHandleForNotebook(this._notebookModel.uri),o=new Set,n=new Set;if(t&&e.rawEvent.changes.forEach(([r,s])=>{s&&this._notebookModel.cells.slice(r,r+s).map(c=>c.handle).forEach(c=>{let u=t.get(c);u?.state===3?o.add(c):u&&n.add(c)})}),o.size||n.size){let r=this._notebookKernelService.getSelectedOrSuggestedKernel(this._notebookModel);if(r){let l=r.implementsInterrupt?[...o]:[...o,...n];this._logService.debug(`NotebookExecution#onWillAddRemoveCells, ${JSON.stringify([...l])}`),l.length&&r.cancelNotebookCellExecution(this._notebookModel.uri,l)}}}};NFe=I([m(1,bn),m(2,Ol),m(3,eJ),m(4,bs),m(5,se)],NFe);function Vnn(a,i){if(a.editType===1)return{editType:2,handle:a.cellHandle,append:a.append,outputs:a.outputs};if(a.editType===2)return{editType:7,items:a.items,append:a.append,outputId:a.outputId};if(a.editType===3){let e={};return typeof a.executionOrder<"u"&&(e.executionOrder=a.executionOrder),typeof a.runStartTime<"u"&&(e.runStartTime=a.runStartTime),{editType:9,handle:i,internalMetadata:e}}throw new Error("Unknown cell update type")}var Gnt=class extends x{constructor(e,t,o){super();this.cellHandle=e;this._notebookModel=t;this._logService=o;this._onDidUpdate=this._register(new E);this.onDidUpdate=this._onDidUpdate.event;this._onDidComplete=this._register(new E);this.onDidComplete=this._onDidComplete.event;this._state=1;this._didPause=!1;this._isPaused=!1;this._logService.debug(`CellExecution#ctor ${this.getCellLog()}`)}get state(){return this._state}get notebook(){return this._notebookModel.uri}get didPause(){return this._didPause}get isPaused(){return this._isPaused}initialize(){let e={editType:9,handle:this.cellHandle,internalMetadata:{executionId:xt(),runStartTime:null,runEndTime:null,lastRunSuccess:null,executionOrder:null,renderDuration:null}};this._applyExecutionEdits([e])}getCellLog(){return`${this._notebookModel.uri.toString()}, ${this.cellHandle}`}logUpdates(e){let t=e.map(o=>q6e[o.editType]).join(", ");this._logService.debug(`CellExecution#updateExecution ${this.getCellLog()}, [${t}]`)}confirm(){this._logService.debug(`CellExecution#confirm ${this.getCellLog()}`),this._state=2,this._onDidUpdate.fire()}update(e){this.logUpdates(e),e.some(n=>n.editType===3)&&(this._state=3),!this._didPause&&e.some(n=>n.editType===3&&n.didPause)&&(this._didPause=!0);let t=[...e].reverse().find(n=>n.editType===3&&typeof n.isPaused=="boolean");if(t&&(this._isPaused=t.isPaused),!this._notebookModel.cells.find(n=>n.handle===this.cellHandle))this._logService.debug(`CellExecution#update, updating cell not in notebook: ${this._notebookModel.uri.toString()}, ${this.cellHandle}`);else{let n=e.map(r=>Vnn(r,this.cellHandle));this._applyExecutionEdits(n)}e.some(n=>n.editType===3)&&this._onDidUpdate.fire()}complete(e){let t=this._notebookModel.cells.find(o=>o.handle===this.cellHandle);if(!t)this._logService.debug(`CellExecution#complete, completing cell not in notebook: ${this._notebookModel.uri.toString()}, ${this.cellHandle}`);else{let o={editType:9,handle:this.cellHandle,internalMetadata:{lastRunSuccess:e.lastRunSuccess,runStartTime:this._didPause?null:t.internalMetadata.runStartTime,runEndTime:this._didPause?null:e.runEndTime,error:e.error}};this._applyExecutionEdits([o])}this._onDidComplete.fire(e.lastRunSuccess)}_applyExecutionEdits(e){this._notebookModel.applyEdits(e,!0,void 0,()=>{},void 0,!1)}};Gnt=I([m(2,se)],Gnt);var qnt=class extends x{constructor(e,t){super();this._notebookModel=e;this._logService=t;this._onDidUpdate=this._register(new E);this.onDidUpdate=this._onDidUpdate.event;this._onDidComplete=this._register(new E);this.onDidComplete=this._onDidComplete.event;this._state=1;this._logService.debug("NotebookExecution#ctor")}get state(){return this._state}get notebook(){return this._notebookModel.uri}debug(e){this._logService.debug(`${e} ${this._notebookModel.uri.toString()}`)}confirm(){this.debug("Execution#confirm"),this._state=2,this._onDidUpdate.fire()}begin(){this.debug("Execution#begin"),this._state=3,this._onDidUpdate.fire()}complete(){this.debug("Execution#begin"),this._state=1,this._onDidComplete.fire()}};qnt=I([m(1,se)],qnt);var OFe=class{constructor(i,e,t,o,n,r){this._commandService=i;this._notebookKernelService=e;this._notebookKernelHistoryService=t;this._workspaceTrustRequestService=o;this._logService=n;this._notebookExecutionStateService=r;this.cellExecutionParticipants=new Set}async executeNotebookCells(i,e,t){let o=Array.from(e).filter(u=>u.cellKind===2);if(!o.length)return;this._logService.debug("Execution",`${JSON.stringify(o.map(u=>u.handle))}`);let n=d(12766,null);if(!await this._workspaceTrustRequestService.requestWorkspaceTrust({message:n}))return;let s=[];for(let u of o)this._notebookExecutionStateService.getCellExecution(u.uri)||s.push([u,this._notebookExecutionStateService.createCellExecution(i.uri,u.handle)]);let l=await d8.resolveKernel(i,this._notebookKernelService,this._notebookKernelHistoryService,this._commandService);if(!l){s.forEach(u=>u[1].complete({}));return}this._notebookKernelHistoryService.addMostRecentKernel(l);let c=[];for(let[u,p]of s)l.supportedLanguages.includes(u.language)?c.push(p):p.complete({});if(c.length>0){await this.runExecutionParticipants(c),this._notebookKernelService.selectKernelForNotebook(l,i),await l.executeNotebookCellsRequest(i.uri,c.map(p=>p.cellHandle));let u=c.filter(p=>p.state===1);u.length&&(this._logService.debug("Execution",`Completing unconfirmed executions ${JSON.stringify(u.map(p=>p.cellHandle))}`),u.forEach(p=>p.complete({}))),this._logService.debug("Execution",`Completed executions ${JSON.stringify(c.map(p=>p.cellHandle))}`)}}async cancelNotebookCellHandles(i,e){let t=Array.from(e);this._logService.debug("Execution",`CancelNotebookCellHandles ${JSON.stringify(t)}`);let o=this._notebookKernelService.getSelectedOrSuggestedKernel(i);o&&await o.cancelNotebookCellExecution(i.uri,t)}async cancelNotebookCells(i,e){this.cancelNotebookCellHandles(i,Array.from(e,t=>t.handle))}registerExecutionParticipant(i){return this.cellExecutionParticipants.add(i),Z(()=>this.cellExecutionParticipants.delete(i))}async runExecutionParticipants(i){for(let e of this.cellExecutionParticipants)await e.onWillExecuteCell(i)}dispose(){this._activeProxyKernelExecutionToken?.dispose(!0)}};OFe=I([m(0,ge),m(1,Ol),m(2,eM),m(3,Vu),m(4,Uv),m(5,bs)],OFe);var USo=le("notebookKeymapService");var FFe=class extends x{constructor(e,t,o,n,r){super();this.instantiationService=e;this.extensionEnablementService=t;this.tipsService=o;this.notificationService=r;this._register(n.onDidShutdown(()=>this.dispose())),this._register(e.invokeFunction(Bnn)((s=>{Promise.all(s.map(l=>this.checkForOtherKeymaps(l))).then(void 0,mt)})))}checkForOtherKeymaps(e){return this.instantiationService.invokeFunction(uRi).then(t=>{let o=t.filter(r=>Hnn(this.tipsService,r)),n=o.find(r=>Ut(r.identifier,e));if(n&&n.globallyEnabled){let r=o.filter(s=>!Ut(s.identifier,e)&&s.globallyEnabled);if(r.length)return this.promptForDisablingOtherKeymaps(n,r)}})}promptForDisablingOtherKeymaps(e,t){let o=n=>{n&&this.extensionEnablementService.setEnablement(t.map(r=>r.local),10)};this.notificationService.prompt(ft.Info,d(10707,null,t.map(n=>`'${n.local.manifest.displayName}'`).join(", ")),[{label:d(10709,null),run:()=>o(!0)},{label:d(10708,null),run:()=>o(!1)}])}};FFe=I([m(0,F),m(1,Js),m(2,BD),m(3,ji),m(4,Ne)],FFe);function Bnn(a){let i=a.get(Cs),e=a.get(Js),t=U.chain(i.onDidInstallExtensions,o=>o.filter(n=>n.some(({operation:r})=>r===2)).map(n=>n.map(({identifier:r})=>r)));return U.debounce(U.any(U.any(t,U.map(i.onDidUninstallExtension,o=>[o.identifier])),U.map(e.onEnablementChanged,o=>o.map(n=>n.identifier))),(o,n)=>{o=o||[];for(let r of n)o.some(s=>!Ut(s,r))&&o.push(r);return o})}async function uRi(a){let i=a.get(Cs),e=a.get(Js);return(await i.getInstalled()).map(o=>({identifier:o.identifier,local:o,globallyEnabled:e.isEnabled(o)}))}function Hnn(a,i){let e=i.local.manifest.categories;return e&&e.indexOf("Keymaps")!==-1||a.getKeymapRecommendations().some(t=>Ut({id:t},i.local.identifier))}function Unn(a){let i=a.get(Cs),e=a.get(Js),t=U.chain(i.onDidInstallExtensions,o=>o.filter(n=>n.some(({operation:r})=>r===2)).map(n=>n.map(({identifier:r})=>r)));return U.debounce(U.any(U.any(t,U.map(i.onDidUninstallExtension,o=>[o.identifier])),U.map(e.onEnablementChanged,o=>o.map(n=>n.identifier))),(o,n)=>{o=o||(n.length?[n[0]]:[]);for(let r of n)o.some(s=>!Ut(s,r))&&o.push(r);return o})}var znn="hasRecommendedKeymap",WFe=class extends x{constructor(e,t,o,n,r){super();this.instantiationService=e;this.extensionEnablementService=t;this.notificationService=o;this.notebookKeymapMemento=new Al("notebookKeymap",n),this.notebookKeymap=this.notebookKeymapMemento.getMemento(0,0),this._register(r.onDidShutdown(()=>this.dispose())),this._register(this.instantiationService.invokeFunction(Unn)((s=>{Promise.all(s.map(l=>this.checkForOtherKeymaps(l))).then(void 0,mt)})))}checkForOtherKeymaps(e){return this.instantiationService.invokeFunction(uRi).then(t=>{let o=t.filter(r=>Knn(r)),n=o.find(r=>Ut(r.identifier,e));if(n&&n.globallyEnabled){this.notebookKeymap[znn]=!0,this.notebookKeymapMemento.saveMemento();let r=o.filter(s=>!Ut(s.identifier,e)&&s.globallyEnabled);if(r.length)return this.promptForDisablingOtherKeymaps(n,r)}})}promptForDisablingOtherKeymaps(e,t){let o=n=>{n&&this.extensionEnablementService.setEnablement(t.map(r=>r.local),10)};this.notificationService.prompt(ft.Info,d(12768,null,zo(t.map(n=>n.local.manifest.displayName)).map(n=>`'${n}'`).join(", ")),[{label:d(12770,null),run:()=>o(!0)},{label:d(12769,null),run:()=>o(!1)}])}};WFe=I([m(0,F),m(1,Js),m(2,Ne),m(3,ce),m(4,ji)],WFe);function Knn(a){if(a.local.manifest.extensionPack)return!1;let i=a.local.manifest.keywords;return i?i.indexOf("notebook-keymap")!==-1:!1}var zSo=5,rU=class extends x{constructor(e,t,o){super();this._storageService=e;this._notebookKernelService=t;this._notebookLoggingService=o;this._mostRecentKernelsMap={};this._loadState(),this._register(this._storageService.onWillSaveState(()=>this._saveState())),this._register(this._storageService.onDidChangeValue(1,rU.STORAGE_KEY,this._store)(()=>{this._loadState()}))}static{this.STORAGE_KEY="notebook.kernelHistory"}getKernels(e){let t=this._notebookKernelService.getMatchingKernel(e),o=t.all,n=t.selected,r=t.all.length===1?t.all[0]:void 0;this._notebookLoggingService.debug("History",`getMatchingKernels: ${t.all.length} kernels available for ${e.uri.path}. Selected: ${t.selected?.label}. Suggested: ${r?.label}`);let s=this._mostRecentKernelsMap[e.notebookType]?[...this._mostRecentKernelsMap[e.notebookType].values()]:[],l=s.map(c=>o.find(u=>u.id===c)).filter(c=>!!c);return this._notebookLoggingService.debug("History",`mru: ${s.length} kernels in history, ${l.length} registered already.`),{selected:n??r,all:l}}addMostRecentKernel(e){let t=e.id,o=e.viewType,n=this._mostRecentKernelsMap[o]??new o1;if(n.set(t,t,1),n.size>zSo){let r=[...n.entries()].slice(0,zSo);n.fromJSON(r)}this._mostRecentKernelsMap[o]=n}_saveState(){let e=!1;for(let[t,o]of Object.entries(this._mostRecentKernelsMap))e=e||o.size>0;if(e){let t=this._serialize();this._storageService.store(rU.STORAGE_KEY,JSON.stringify(t),1,0)}else this._storageService.remove(rU.STORAGE_KEY,1)}_loadState(){let e=this._storageService.get(rU.STORAGE_KEY,1);if(e)try{this._deserialize(JSON.parse(e))}catch{this._mostRecentKernelsMap={}}else this._mostRecentKernelsMap={}}_serialize(){let e=Object.create(null);for(let[t,o]of Object.entries(this._mostRecentKernelsMap))e[t]={entries:[...o.values()]};return e}_deserialize(e){this._mostRecentKernelsMap={};for(let[t,o]of Object.entries(e)){let n=new o1,r=[];for(let s of o.entries)r.push([s,s]);n.fromJSON(r),this._mostRecentKernelsMap[t]=n}}_clear(){this._mostRecentKernelsMap={},this._saveState()}};rU=I([m(0,ce),m(1,Ol),m(2,Uv)],rU);W(class extends K{constructor(){super({id:"notebook.clearNotebookKernelsMRUCache",title:L(12767,"Clear Notebook Kernels MRU Cache"),category:Ve.Developer,f1:!0})}async run(a){a.get(eM)._clear()}});var Gnn="notebook.rendering",VFe=class extends x{static{this.ID="notebook"}constructor(i){super(),this._logger=this._register(i.createLogger(Gnn,{name:d(12771,null),group:oM}))}trace(i,e){this._logger.trace(`[${i}] ${e}`)}debug(i,e){this._logger.debug(`[${i}] ${e}`)}info(i,e){this._logger.info(`[${i}] ${e}`)}warn(i,e){this._logger.warn(`[${i}] ${e}`)}error(i,e){this._logger.error(`[${i}] ${e}`)}};VFe=I([m(0,Il)],VFe);var s2t=class{constructor(i){this.notebookKernelService=i;this.cancellationTokenSource=new Ye}hasChildren(i){return i.kind==="root"||i.hasNamedChildren||i.indexedChildrenCount>0}cancel(){this.cancellationTokenSource.cancel(),this.cancellationTokenSource.dispose(),this.cancellationTokenSource=new Ye}async getChildren(i){return i.kind==="empty"?[]:i.kind==="root"?this.getRootVariables(i.notebook):this.getVariables(i)}async getVariables(i){let e=this.notebookKernelService.getMatchingKernel(i.notebook).selected;if(e&&e.hasVariableProvider){let t=[];if(i.hasNamedChildren){let o=e.provideVariables(i.notebook.uri,i.extHostId,"named",0,this.cancellationTokenSource.token);for await(let n of o)t.push(this.createVariableElement(n,i.notebook))}if(i.indexedChildrenCount>0){let o=await this.getIndexedChildren(i,e);t=t.concat(o)}return t}return[]}async getIndexedChildren(i,e){let t=[];if(i.indexedChildrenCount>FAt){let o=Math.floor(Math.max(i.indexedChildrenCount/FAt,100)),n=1e6,r=i.indexStart??0,s=r+Math.min(i.indexedChildrenCount,n);for(;r<s;r+=o){let l=r+o;l>s&&(l=s),t.push({kind:"variable",notebook:i.notebook,id:i.id+`${r}`,extHostId:i.extHostId,name:`[${r}..${l-1}]`,value:"",indexedChildrenCount:l-r,indexStart:r,hasNamedChildren:!1})}i.indexedChildrenCount>n&&t.push({kind:"variable",notebook:i.notebook,id:i.id+`${s+1}`,extHostId:i.extHostId,name:d(12397,null),value:"",indexedChildrenCount:0,hasNamedChildren:!1})}else if(i.indexedChildrenCount>0){let o=e.provideVariables(i.notebook.uri,i.extHostId,"indexed",i.indexStart??0,this.cancellationTokenSource.token);for await(let n of o)if(t.push(this.createVariableElement(n,i.notebook)),t.length>=FAt)break}return t}async getRootVariables(i){let e=this.notebookKernelService.getMatchingKernel(i).selected;if(e&&e.hasVariableProvider){let t=e.provideVariables(i.uri,void 0,"named",0,this.cancellationTokenSource.token),o=[];for await(let n of t)o.push(this.createVariableElement(n,i));return o}return[]}createVariableElement(i,e){return{...i,kind:"variable",notebook:e,extHostId:i.id,id:`${i.id}`}}};var pRi=_,qnn=1024,c2t=L(12398,"Notebook Variables"),mRi=L(12399,"REPL Variables");var a2t=class{getHeight(i){return 22}getTemplateId(i){return fQ.ID}},fQ=class{static{this.ID="variableElement"}get templateId(){return fQ.ID}constructor(i){this.expressionRenderer=i.createInstance(RM)}renderTemplate(i){let e=M(i,pRi(".expression")),t=M(e,pRi("span.name")),o=M(e,pRi("span.value"));return{expression:e,name:t,value:o,elementDisposables:new N}}renderElement(i,e,t){let o=i.element.value.trim()!==""?`${i.element.name}:`:i.element.name;t.name.textContent=o,t.name.title=i.element.type??"",t.elementDisposables.add(this.expressionRenderer.renderValue(t.value,i.element,{colorize:!0,maxValueLength:qnn,session:void 0}))}disposeElement(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.elementDisposables.dispose()}};fQ=I([m(0,F)],fQ);var l2t=class{constructor(){this._widgetAriaLabel=Me("widgetAriaLabel",c2t.value)}getWidgetAriaLabel(){return this._widgetAriaLabel}updateWidgetAriaLabel(i){this._widgetAriaLabel.set(i,void 0)}getAriaLabel(i){return d(12400,null,i.name,i.value)}};var BFe=class extends Gs{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super(e,r,s,c,l,p,u,h,v,b);this.editorService=t;this.notebookKernelService=o;this.notebookExecutionStateService=n;this.quickInputService=g;this.commandService=f;this.menuService=S;this._register(this.editorService.onDidActiveEditorChange(()=>this.handleActiveEditorChange())),this._register(this.notebookKernelService.onDidNotebookVariablesUpdate(this.handleVariablesChanged.bind(this))),this._register(this.notebookExecutionStateService.onDidChangeExecution(this.handleExecutionStateChange.bind(this))),this._register(this.editorService.onDidCloseEditor(y=>this.handleCloseEditor(y))),this.accessibilityProvider=new l2t,this.handleActiveEditorChange(!1),this.dataSource=new s2t(this.notebookKernelService),this.updateScheduler=this._register(new Dt(()=>this.tree?.updateChildren(),100))}static{this.ID="notebookVariablesView"}renderBody(e){super.renderBody(e),this.element.classList.add("debug-pane"),this.tree=this.instantiationService.createInstance(rp,"notebookVariablesTree",e,new a2t,[this.instantiationService.createInstance(fQ)],this.dataSource,{accessibilityProvider:this.accessibilityProvider,identityProvider:{getId:t=>t.id}}),this.tree.layout(),this.activeNotebook&&this.tree.setInput({kind:"root",notebook:this.activeNotebook}),this._register(this.tree.onContextMenu(t=>this.onContextMenu(t)))}onContextMenu(e){if(!e.element)return;let t=e.element,o={source:t.notebook.uri.toString(),name:t.name,value:t.value,type:t.type,expression:t.expression,language:t.language,extensionId:t.extensionId},n=this.contextKeyService.createOverlay([[nRt.key,t.name],[bTe.key,t.value],[uJ.key,t.type],[Dto.key,t.interfaces],[Lto.key,t.language],[Rto.key,t.extensionId]]),r=this.menuService.getMenuActions(D.NotebookVariablesContext,n,{arg:o,shouldForwardArgs:!0}),s=tu(r);this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>s})}focus(){super.focus(),this.tree?.domFocus()}layoutBody(e,t){super.layoutBody(e,t),this.tree?.layout(e,t)}setActiveNotebook(e,t,o=!0){this.activeNotebook=e,i4(t.input)?(this.updateTitle(mRi.value),this.accessibilityProvider.updateWidgetAriaLabel(mRi.value)):(this.updateTitle(c2t.value),this.accessibilityProvider.updateWidgetAriaLabel(c2t.value)),o&&(this.tree?.setInput({kind:"root",notebook:e}),this.updateScheduler.schedule())}getActiveNotebook(){let e=this.editorService.activeEditorPane,t=Jn(e)?.textModel;return t&&e?{notebookDocument:t,notebookEditor:e}:void 0}handleCloseEditor(e){e.editor.resource&&e.editor.resource.toString()===this.activeNotebook?.uri.toString()&&(this.tree?.setInput({kind:"empty"}),this.updateScheduler.schedule())}handleActiveEditorChange(e=!0){let t=this.getActiveNotebook();t&&t.notebookDocument!==this.activeNotebook&&this.setActiveNotebook(t.notebookDocument,t.notebookEditor,e)}handleExecutionStateChange(e){this.activeNotebook&&e.affectsNotebook(this.activeNotebook.uri)?(this.dataSource.cancel(),e.changed===void 0?this.updateScheduler.schedule():this.updateScheduler.cancel()):this.getActiveNotebook()||this.editorService.visibleEditorPanes.forEach(t=>{let o=Jn(t)?.textModel;o&&e.affectsNotebook(o.uri)&&this.setActiveNotebook(o,t)})}handleVariablesChanged(e){this.activeNotebook&&e.toString()===this.activeNotebook.uri.toString()?this.updateScheduler.schedule():this.getActiveNotebook()||this.editorService.visibleEditorPanes.forEach(t=>{let o=Jn(t)?.textModel;o&&o.uri.toString()===e.toString()&&this.setActiveNotebook(o,t)})}};BFe=I([m(1,ee),m(2,Ol),m(3,bs),m(4,_e),m(5,Xe),m(6,X),m(7,B),m(8,F),m(9,Bi),m(10,Je),m(11,Ue),m(12,ge),m(13,Le),m(14,nt),m(15,Kt)],BFe);var HFe=class extends x{constructor(e,t,o,n,r,s,l){super();this.configurationService=t;this.editorService=o;this.notebookExecutionStateService=n;this.notebookKernelService=r;this.notebookDocumentService=s;this.viewDescriptorService=l;this.listeners=[];this.initialized=!1;this.viewEnabled=Wge.bindTo(e),this.listeners.push(this.editorService.onDidActiveEditorChange(()=>this.handleInitEvent())),this.listeners.push(this.notebookExecutionStateService.onDidChangeExecution(c=>this.handleInitEvent(c.notebook))),this.configListener=t.onDidChangeConfiguration(c=>this.handleConfigChange(c))}handleConfigChange(e){e.affectsConfiguration(yt.notebookVariablesView)&&this.handleInitEvent()}handleInitEvent(e){(this.editorService.activeEditorPane?.getId()==="workbench.editor.repl"||this.configurationService.getValue(yt.notebookVariablesView)||this.configurationService.getValue("notebook.experimental.variablesView"))&&(e||this.editorService.activeEditorPane?.getId()==="workbench.editor.notebook")&&this.hasVariableProvider(e)&&!this.initialized&&this.initializeView()&&(this.viewEnabled.set(!0),this.initialized=!0,this.listeners.forEach(o=>o.dispose()))}hasVariableProvider(e){let t=e?this.notebookDocumentService.getNotebookTextModel(e):Jn(this.editorService.activeEditorPane)?.getViewModel()?.notebookDocument;return t&&this.notebookKernelService.getMatchingKernel(t).selected?.hasVariableProvider}initializeView(){let e=this.viewDescriptorService.getViewContainerById(cg);if(e){let t=ne.as(Mn.ViewsRegistry),o={id:"workbench.notebook.variables",name:L(12396,"Notebook Variables"),containerIcon:hUt,ctorDescriptor:new Ft(BFe),order:50,weight:5,canToggleVisibility:!0,canMoveView:!0,collapsed:!1,when:Wge};return t.registerViews([o],e),!0}return!1}dispose(){super.dispose(),this.listeners.forEach(e=>e.dispose()),this.configListener.dispose()}};HFe=I([m(0,X),m(1,B),m(2,ee),m(3,bs),m(4,Ol),m(5,bn),m(6,Bi)],HFe);var d2t=class{constructor(){this.priority=105;this.name="notebook";this.when=C.and(pr,AS.negate());this.type="help"}getProvider(i){let e=i.get(qt).getActiveCodeEditor()||i.get(qt).getFocusedCodeEditor()||i.get(ee).activeEditorPane;if(e)return jnn(i,e)}};function $nn(){return[d(12665,null),d(12656,null,"<keybinding:notebook.cell.edit>"),d(12660,null,"<keybinding:notebook.cell.quitEdit>"),d(12658,null,"<keybinding:notebook.cell.focusInOutput>"),d(12663,null,"<keybinding:notebook.focusNextEditor>"),d(12664,null,"<keybinding:notebook.focusPreviousEditor>"),d(12661,null),d(12657,null,"<keybinding:notebook.cell.executeAndFocusContainer>"),d(12659,null,"<keybinding:notebook.cell.insertCodeCellAbove>","<keybinding:notebook.cell.insertCodeCellBelow>"),d(12662,null)].join(`
`)}function jnn(a,i){let e=$nn();return new xp("notebook",{type:"help"},()=>e,()=>i.focus(),"accessibility.verbosity.notebook")}var u2t=class{constructor(){this.priority=100;this.name="notebook";this.type="view";this.when=C.and(pp,ig.toNegated())}getProvider(i){let e=i.get(ee);return Qnn(e)}};function Qnn(a){let i=a.activeEditorPane,e=Jn(i),t=e?.getViewModel(),o=t?.getSelections(),n=t?.notebookDocument;if(!o||!n||!e?.textModel)return;let r=t.viewCells[o[0].start],s=FPe(n,r);if(s)return new xp("notebook",{type:"view"},()=>s,()=>{e?.setFocus(o[0]),e.focus()},"accessibility.verbosity.notebook")}var Vm=class extends x{constructor(e,t,o,n,r,s,l,c,u,p){super();this._extensionService=e;this._extensionEnablementService=t;this._configService=o;this._notificationService=n;this._dialogService=r;this._quickInputService=s;this._languageService=l;this._languageFeaturesService=c;this._languageStatusService=u;this._editorService=p;this._languageStatusStore=this._store.add(new N);this._store.add(this._extensionService.onDidChangeExtensions(this._updateConfigValues,this)),this._store.add(qce.setFormatterSelector((h,g,f,v)=>this._selectFormatter(h,g,f,v))),this._store.add(p.onDidActiveEditorChange(this._updateStatus,this)),this._store.add(c.documentFormattingEditProvider.onDidChange(this._updateStatus,this)),this._store.add(c.documentRangeFormattingEditProvider.onDidChange(this._updateStatus,this)),this._store.add(c.documentFormattingEditProvider.onDidChange(this._updateConfigValues,this)),this._store.add(c.documentRangeFormattingEditProvider.onDidChange(this._updateConfigValues,this)),this._store.add(o.onDidChangeConfiguration(h=>h.affectsConfiguration(Vm.configName)&&this._updateStatus())),this._updateConfigValues()}static{this.configName="editor.defaultFormatter"}static{this.extensionIds=[]}static{this.extensionItemLabels=[]}static{this.extensionDescriptions=[]}async _updateConfigValues(){await this._extensionService.whenInstalledExtensionsRegistered();let e=[...this._extensionService.extensions],t=this._languageFeaturesService.documentFormattingEditProvider.allNoModel(),o=this._languageFeaturesService.documentRangeFormattingEditProvider.allNoModel(),n=new Set;for(let r of t)r.extensionId&&n.add(Ii.toKey(r.extensionId));for(let r of o)r.extensionId&&n.add(Ii.toKey(r.extensionId));e=e.sort((r,s)=>{let l=n.has(Ii.toKey(r.identifier)),c=n.has(Ii.toKey(s.identifier));if(l&&!c)return-1;if(!l&&c)return 1;let u=r.categories?.find(h=>h==="Formatters"||h==="Programming Languages"),p=s.categories?.find(h=>h==="Formatters"||h==="Programming Languages");return u&&!p?-1:!u&&p?1:r.name.localeCompare(s.name)}),Vm.extensionIds.length=0,Vm.extensionItemLabels.length=0,Vm.extensionDescriptions.length=0,Vm.extensionIds.push(null),Vm.extensionItemLabels.push(d(11181,null)),Vm.extensionDescriptions.push(d(11182,null));for(let r of e)(r.main||r.browser)&&(Vm.extensionIds.push(r.identifier.value),Vm.extensionItemLabels.push(r.displayName??""),Vm.extensionDescriptions.push(r.description??""))}static _maybeQuotes(e){return e.match(/\s/)?`'${e}'`:e}async _analyzeFormatter(e,t,o){let n=this._configService.getValue(Vm.configName,{resource:o.uri,overrideIdentifier:o.getLanguageId()});if(n){let l=t.find(u=>Ii.equals(u.extensionId,n));if(l)return l;let c=await this._extensionService.getExtension(n);if(c&&this._extensionEnablementService.isEnabled(ZE(c))){let u=this._languageService.getLanguageName(o.getLanguageId())||o.getLanguageId();return e===1?d(11179,null,c.displayName||c.name,u):d(11180,null,c.displayName||c.name,u)}}else if(t.length===1)return t[0];let r=this._languageService.getLanguageName(o.getLanguageId())||o.getLanguageId();return n?d(11167,null,n):d(11168,null,Vm._maybeQuotes(r))}async _selectFormatter(e,t,o,n){let r=await this._analyzeFormatter(n,e,t);if(typeof r!="string")return r;if(o!==2){let{confirmed:s}=await this._dialogService.confirm({message:d(11178,null),detail:r,primaryButton:d(11170,null)});if(s)return this._pickAndPersistDefaultFormatter(e,t)}else this._notificationService.prompt(ft.Info,r,[{label:d(11172,null),run:()=>this._pickAndPersistDefaultFormatter(e,t)}],{priority:2})}async _pickAndPersistDefaultFormatter(e,t){let o=e.map((s,l)=>({index:l,label:s.displayName||(s.extensionId?s.extensionId.value:"?"),description:s.extensionId&&s.extensionId.value})),n=this._languageService.getLanguageName(t.getLanguageId())||t.getLanguageId(),r=await this._quickInputService.pick(o,{placeHolder:d(11183,null,Vm._maybeQuotes(n))});if(!(!r||!e[r.index].extensionId))return this._configService.updateValue(Vm.configName,e[r.index].extensionId.value,{resource:t.uri,overrideIdentifier:t.getLanguageId()}),e[r.index]}_updateStatus(){this._languageStatusStore.clear();let e=ha(this._editorService.activeTextEditorControl);if(!e||!e.hasModel())return;let t=e.getModel(),o=eke(this._languageFeaturesService.documentFormattingEditProvider,this._languageFeaturesService.documentRangeFormattingEditProvider,t);if(o.length===0)return;let n=new Ye;this._languageStatusStore.add(Z(()=>n.dispose(!0))),this._analyzeFormatter(1,o,t).then(r=>{if(n.token.isCancellationRequested||typeof r!="string")return;let s={id:`formatter/configure/dfl/${xt()}`,title:d(11171,null)};this._languageStatusStore.add($e.registerCommand(s.id,()=>this._pickAndPersistDefaultFormatter(o,t))),this._languageStatusStore.add(this._languageStatusService.addStatus({id:"formatter.conflict",name:d(11184,null),selector:{language:t.getLanguageId(),pattern:t.uri.fsPath},severity:ft.Error,label:d(11176,null),detail:r,busy:!1,source:"",command:s,accessibilityInfo:void 0}))})}};Vm=I([m(0,lt),m(1,Js),m(2,B),m(3,Ne),m(4,at),m(5,Ue),m(6,_t),m(7,Qt),m(8,HB),m(9,ee)],Vm);ne.as(Qi.Workbench).registerWorkbenchContribution(Vm,3);ne.as(Jt.Configuration).registerConfiguration({...RC,properties:{[Vm.configName]:{description:d(11177,null),type:["string","null"],default:null,enum:Vm.extensionIds,enumItemLabels:Vm.extensionItemLabels,markdownEnumDescriptions:Vm.extensionDescriptions}}});async function KSo(a,i,e){let t=a.get(Ue),o=a.get(B),n=a.get(_t),r={resource:i.uri,overrideIdentifier:i.getLanguageId()},s=o.getValue(Vm.configName,r),l,c=e.map((h,g)=>{let f=Ii.equals(h.extensionId,s),v={index:g,label:h.displayName||"",description:f?d(11169,null):void 0};return f&&(l=v),v}),u={label:d(11166,null)},p=await t.pick([...c,{type:"separator"},u],{placeHolder:d(11173,null),activeItem:l});if(p)if(p===u){let h=n.getLanguageName(i.getLanguageId())||i.getLanguageId(),g=await t.pick(c,{placeHolder:d(11183,null,Vm._maybeQuotes(h))});g&&e[g.index].extensionId&&o.updateValue(Vm.configName,e[g.index].extensionId.value,r);return}else return p.index;else return}ni(class extends Di{constructor(){super({id:"editor.action.formatDocument.multiple",label:d(11174,null),alias:"Format Document...",precondition:C.and(pe.writable,pe.hasMultipleDocumentFormattingProvider),contextMenuOpts:{group:"1_modification",order:1.3}})}async run(i,e,t){if(!e.hasModel())return;let o=i.get(F),n=i.get(Qt),r=e.getModel(),s=eke(n.documentFormattingEditProvider,n.documentRangeFormattingEditProvider,r),l=await o.invokeFunction(KSo,r,s);typeof l=="number"&&await o.invokeFunction(Mci,s[l],e,1,Se.None)}});ni(class extends Di{constructor(){super({id:"editor.action.formatSelection.multiple",label:d(11175,null),alias:"Format Code...",precondition:C.and(C.and(pe.writable),pe.hasMultipleDocumentSelectionFormattingProvider),contextMenuOpts:{when:C.and(pe.hasNonEmptySelection),group:"1_modification",order:1.31}})}async run(i,e){if(!e.hasModel())return;let t=i.get(F),o=i.get(Qt),n=e.getModel(),r=e.getSelection();r.isEmpty()&&(r=new z(r.startLineNumber,1,r.startLineNumber,n.getLineMaxColumn(r.startLineNumber)));let s=o.documentRangeFormattingEditProvider.ordered(n),l=await t.invokeFunction(KSo,n,s);typeof l=="number"&&await t.invokeFunction(Rci,s[l],e,r,Se.None,!0)}});var hRi=class{constructor(i,e,t,o){this.resolvedNotebookEditorModel=i;this.notebookUri=e;this.cell=t;this.outputId=o}dispose(){this.resolvedNotebookEditorModel.dispose()}},AM=class extends ls{constructor(e,t,o,n,r){super();this.notebookEditorModelResolverService=r;this._notebookUri=e,this.cellUri=void 0,this.cellIndex=t,this.outputId=o,this.outputIndex=n}static{this.ID="workbench.input.notebookOutputEditorInput"}get typeId(){return AM.ID}async resolve(){this._notebookRef||(this._notebookRef=await this.notebookEditorModelResolverService.resolve(this._notebookUri));let e=this._notebookRef.object.notebook.cells[this.cellIndex];if(!e)throw new Error("Cell not found");this.cellUri=e.uri;let t=e.outputs[this.outputIndex]?.outputId;if(!t)throw new Error("Output not found");return this.outputId||(this.outputId=t),new hRi(this._notebookRef.object,this._notebookUri,e,t)}getSerializedData(){if(!this._notebookRef)return;let e=this._notebookRef.object.notebook.cells.findIndex(n=>Qe(n.uri,this.cellUri)),t=this._notebookRef.object.notebook.cells[e];if(!t)return;let o=t.outputs.findIndex(n=>n.outputId===this.outputId);if(o!==-1)return{notebookUri:this._notebookUri,cellIndex:e,outputIndex:o}}getName(){return d(12765,null)}get editorId(){return"notebookOutputEditor"}get resource(){}get capabilities(){return 2}dispose(){super.dispose()}};AM=I([m(4,yh)],AM);var gRi=class a extends x{constructor(){super();this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._value=Object.freeze({...a.fixedEditorOptions,padding:{top:12,bottom:12},readOnly:!0})}static{this.fixedEditorOptions={scrollBeyondLastLine:!1,scrollbar:{verticalScrollbarSize:14,horizontal:"auto",useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,alwaysConsumeMouseWheel:!1},renderLineHighlightOnlyWhenFocus:!0,overviewRulerLanes:0,lineDecorationsWidth:0,folding:!0,fixedOverflowWidgets:!0,minimap:{enabled:!1},renderValidationDecorations:"on",lineNumbersMinChars:3}}get value(){return this._value}},vQ=class extends Ts{constructor(e,t,o,n,r,s,l){super(vQ.ID,e,n,o,r);this.instantiationService=t;this.configurationService=s;this.notebookService=l;this.creationOptions=kte();this._outputWebview=null;this._isDisposed=!1;this._notebookOptions=this.instantiationService.createInstance(VT,this.window,!1,void 0),this._register(this._notebookOptions)}static{this.ID=NJi}get isDisposed(){return this._isDisposed}createEditor(e){this._rootElement=M(e,_(".notebook-output-editor"))}get fontInfo(){return this._fontInfo||(this._fontInfo=this.createFontInfo()),this._fontInfo}createFontInfo(){let e=this.configurationService.getValue("editor");return iw.readFontInfo(this.window,QS(e,bu.getInstance(this.window).value))}async _createOriginalWebview(e,t,o){this._outputWebview?.dispose(),this._outputWebview=this.instantiationService.createInstance(oN,this,e,t,o,{...this._notebookOptions.computeDiffWebviewOptions(),fontFamily:this._generateFontFamily()},void 0),M(this._rootElement,this._outputWebview.element),this._outputWebview.createWebview(this.window),this._outputWebview.element.style.width="calc(100% - 16px)",this._outputWebview.element.style.left="16px"}_generateFontFamily(){return this.fontInfo.fontFamily??'"SF Mono", Monaco, Menlo, Consolas, "Ubuntu Mono", "Liberation Mono", "DejaVu Sans Mono", "Courier New", monospace'}getTitle(){return this.input?this.input.getName():d(12764,null)}async setInput(e,t,o,n){await super.setInput(e,t,o,n);let r=await e.resolve();if(!r)throw new Error("Invalid notebook output editor input");let s=r.resolvedNotebookEditorModel;await this._createOriginalWebview(xt(),s.viewType,A.from({scheme:Q.vscodeNotebookCellOutput,path:"",query:"openIn=notebookOutputEditor"}));let l=s.notebook,c=this._register(new YPe),u=this._register(new gRi),p=new eAe(this._notebookOptions,c,w=>u);this._notebookViewModel=this.instantiationService.createInstance(Cte,l.viewType,l,p,null,{isReadOnly:!0});let h=this._notebookViewModel.getCellByHandle(r.cell.handle);if(!h)throw new Error("Invalid NotebookOutputEditorInput, no matching cell view model");let g=h.outputsViewModels.find(w=>w.model.outputId===r.outputId);if(!g)throw new Error("Invalid NotebookOutputEditorInput, no matching cell output view model");let f,[v,b]=g.resolveMimeTypes(l,void 0),S=g.pickedMimeType||v[b];if(v.length!==0){let w=this.notebookService.getRendererInfo(S.rendererId);f=w?{type:1,renderer:w,source:g,mimeType:S.mimeType}:this._renderMissingRenderer(g,S.mimeType)}if(!f)throw new Error("No InsetRenderInfo for output");let y={cellId:h.id,cellHandle:r.cell.handle,cellUri:r.cell.uri};this._outputWebview?.createOutput(y,f,0,0)}_renderMissingRenderer(e,t){if(!e.model.outputs.length)return this._renderMessage(e,d(12762,null));if(!t){let n=e.model.outputs.map(r=>r.mime).join(", ");return this._renderMessage(e,d(12763,null,n))}return this._renderSearchForMimetype(e,t)}_renderMessage(e,t){let o=_("p",void 0,t);return{type:0,source:e,htmlContent:o.outerHTML}}_renderSearchForMimetype(e,t){let o=`@tag:notebookRenderer ${t}`,n=_("p",void 0,`No renderer could be found for mimetype "${t}", but one might be available on the Marketplace.`),r=_("a",{href:`command:workbench.extensions.search?%22${o}%22`,class:"monaco-button monaco-text-button",tabindex:0,role:"button",style:"padding: 8px; text-decoration: none; color: rgb(255, 255, 255); background-color: rgb(14, 99, 156); max-width: 200px;"},"Search Marketplace");return{type:0,source:e,htmlContent:n.outerHTML+r.outerHTML}}scheduleOutputHeightAck(e,t,o){Wr(this.window,()=>{this._outputWebview?.ackHeight([{cellId:e.cellId,outputId:t,height:o}])},10)}async focusNotebookCell(e,t){}async focusNextNotebookCell(e,t){}toggleNotebookCellSelection(e){throw new Error("Not implemented.")}getCellById(e){throw new Error("Not implemented")}getCellByInfo(e){return this._notebookViewModel?.getCellByHandle(e.cellHandle)}layout(e,t){}setScrollTop(e){}triggerScroll(e){}getOutputRenderer(){}updateOutputHeight(e,t,o,n,r){}updateMarkupCellHeight(e,t,o){}setMarkupCellEditState(e,t){}didResizeOutput(e){}didStartDragMarkupCell(e,t){}didDragMarkupCell(e,t){}didDropMarkupCell(e,t){}didEndDragMarkupCell(e){}updatePerformanceMetadata(e,t,o,n){}didFocusOutputInputChange(e){}dispose(){this._isDisposed=!0,super.dispose()}};vQ=I([m(1,F),m(2,Le),m(3,Te),m(4,ce),m(5,B),m(6,bn)],vQ);var UFe=class{constructor(i,e,t){this.instantiationService=e;this.uriIdentityService=t;i.registerEditor(`${Q.vscodeNotebookCellOutput}:/**`,{id:"notebookOutputEditor",label:"Notebook Output Editor",priority:"default"},{canSupportResource:o=>o.scheme===Q.vscodeNotebookCellOutput?new URLSearchParams(o.query).get("openIn")==="notebookOutputEditor":!1},{createEditorInput:async({resource:o,options:n})=>{let r=Zo.parseCellOutputUri(o);if(!r||!r.notebook||r.cellIndex===void 0||r.outputIndex===void 0||!r.outputId)throw new Error("Invalid output uri for notebook output editor");let s=this.uriIdentityService.asCanonicalUri(r.notebook),l=r.cellIndex,c=r.outputId,u=r.outputIndex;return{editor:this.instantiationService.createInstance(AM,s,l,c,u),options:n}}})}static{this.ID="workbench.contribution.notebookOutputEditorContribution"}};UFe=I([m(0,Ka),m(1,F),m(2,ht)],UFe);It(UFe.ID,UFe,St.BlockRestore);ne.as(qo.EditorPane).registerEditorPane(Br.create(jD,jD.ID,"Notebook Editor"),[new Ft(Ra)]);ne.as(qo.EditorPane).registerEditorPane(Br.create(nh,nh.ID,"Notebook Diff Editor"),[new Ft(Xw)]);ne.as(qo.EditorPane).registerEditorPane(Br.create(vQ,vQ.ID,"Notebook Output Editor"),[new Ft(AM)]);ne.as(qo.EditorPane).registerEditorPane(Br.create(Sm,Sm.ID,"Notebook Diff Editor"),[new Ft(ahe)]);var Qnt=class{constructor(i){this._configurationService=i}canSerialize(){return!0}serialize(i){return wo(i instanceof Xw),JSON.stringify({resource:i.resource,originalResource:i.original.resource,name:i.getName(),originalName:i.original.getName(),textDiffName:i.getName(),viewType:i.viewType})}deserialize(i,e){let t=am(e);if(!t)return;let{resource:o,originalResource:n,name:r,viewType:s}=t;if(!(!t||!A.isUri(o)||!A.isUri(n)||typeof r!="string"||typeof s!="string"))return this._configurationService.getValue("notebook.experimental.enableNewDiffEditor")?ahe.create(i,o,r,void 0,n,s):Xw.create(i,o,r,void 0,n,s)}static canResolveBackup(i,e){return!1}};Qnt=I([m(0,B)],Qnt);var fRi=class{canSerialize(i){return i.typeId===Ra.ID}serialize(i){wo(i instanceof Ra);let e={resource:i.resource,preferredResource:i.preferredResource,viewType:i.viewType,options:i.options};return JSON.stringify(e)}deserialize(i,e){let t=am(e);if(!t)return;let{resource:o,preferredResource:n,viewType:r,options:s}=t;return!t||!A.isUri(o)||typeof r!="string"?void 0:Ra.getOrCreate(i,o,n,r,s)}},vRi=class{canSerialize(i){return i.typeId===AM.ID}serialize(i){wo(i instanceof AM);let e=i.getSerializedData();if(e)return JSON.stringify(e)}deserialize(i,e){let t=am(e);return t?i.createInstance(AM,t.notebookUri,t.cellIndex,void 0,t.outputIndex):void 0}};ne.as(qo.EditorFactory).registerEditorSerializer(Ra.ID,fRi);ne.as(qo.EditorFactory).registerEditorSerializer(Xw.ID,Qnt);ne.as(qo.EditorFactory).registerEditorSerializer(AM.ID,vRi);var ooe=class extends x{constructor(e,t,o){super();this.codeEditorService=o;this.updateCellUndoRedoComparisonKey(t,e),this._register(t.onDidChangeConfiguration(n=>{n.affectsConfiguration(yt.undoRedoPerCell)&&this.updateCellUndoRedoComparisonKey(t,e)})),this._register(this.codeEditorService.registerDecorationType("comment-controller",IAt,{}))}static{this.ID="workbench.contrib.notebook"}updateCellUndoRedoComparisonKey(e,t){let o=e.getValue(yt.undoRedoPerCell);o?(this._uriComparisonKeyComputer?.dispose(),this._uriComparisonKeyComputer=void 0):this._uriComparisonKeyComputer||(this._uriComparisonKeyComputer=t.registerUriComparisonKeyComputer(Zo.scheme,{getComparisonKey:n=>o?n.toString():ooe._getCellUndoRedoComparisonKey(n)}))}static _getCellUndoRedoComparisonKey(e){let t=Zo.parse(e);return t?t.notebook.toString():e.toString()}dispose(){super.dispose(),this._uriComparisonKeyComputer?.dispose()}};ooe=I([m(0,Ml),m(1,B),m(2,qt)],ooe);var zFe=class{constructor(i,e,t,o){this._modelService=e;this._languageService=t;this._notebookModelResolverService=o;this._registration=i.registerTextModelContentProvider(Zo.scheme,this)}static{this.ID="workbench.contrib.cellContentProvider"}dispose(){this._registration.dispose()}async provideTextContent(i){let e=this._modelService.getModel(i);if(e)return e;let t=Zo.parse(i);if(!t)return null;let o=await this._notebookModelResolverService.resolve(t.notebook),n=null;if(!o.object.isResolved())return null;for(let s of o.object.notebook.cells)if(s.uri.toString()===i.toString()){let l={create:p=>({textBuffer:s.textBuffer,disposable:x.None}),getFirstLineText:p=>s.textBuffer.getLineContent(1).substring(0,p)},c=this._languageService.getLanguageIdByLanguageName(s.language),u=c?this._languageService.createById(c):s.cellKind===1?this._languageService.createById("markdown"):this._languageService.createByFilepathOrFirstLine(i,s.textBuffer.getLineContent(1));n=this._modelService.createModel(l,u,i);break}if(!n)return o.dispose(),null;let r=U.any(n.onWillDispose,o.object.notebook.onWillDispose)(()=>{r.dispose(),o.dispose()});return n}};zFe=I([m(0,Bt),m(1,Tt),m(2,_t),m(3,yh)],zFe);var KFe=class{constructor(i,e,t,o,n){this._modelService=e;this._languageService=t;this._labelService=o;this._notebookModelResolverService=n;this._disposables=[];this._disposables.push(i.registerTextModelContentProvider(Q.vscodeNotebookCellMetadata,{provideTextContent:this.provideMetadataTextContent.bind(this)})),this._disposables.push(i.registerTextModelContentProvider(Q.vscodeNotebookCellOutput,{provideTextContent:this.provideOutputTextContent.bind(this)})),this._disposables.push(this._labelService.registerFormatter({scheme:Q.vscodeNotebookCellMetadata,formatting:{label:"${path} (metadata)",separator:"/"}})),this._disposables.push(this._labelService.registerFormatter({scheme:Q.vscodeNotebookCellOutput,formatting:{label:"${path} (output)",separator:"/"}}))}static{this.ID="workbench.contrib.cellInfoContentProvider"}dispose(){Be(this._disposables)}async provideMetadataTextContent(i){let e=this._modelService.getModel(i);if(e)return e;let t=Zo.parseCellPropertyUri(i,Q.vscodeNotebookCellMetadata);if(!t)return null;let o=await this._notebookModelResolverService.resolve(t.notebook),n=null,r=this._languageService.createById("json"),s=new N;for(let c of o.object.notebook.cells)if(c.handle===t.handle){let u=o.object.notebook.cells.indexOf(c),p=wG(o.object.notebook.transientOptions.transientCellMetadata,c.metadata,c.language,!0);n=this._modelService.createModel(p,r,i),this._disposables.push(s.add(o.object.notebook.onDidChangeContent(h=>{if(n&&h.rawEvents.some(g=>(g.kind===7||g.kind===5)&&g.index===u)){let g=wG(o.object.notebook.transientOptions.transientCellMetadata,c.metadata,c.language,!0);n.getValue()!==g&&n.setValue(g)}})));break}if(!n)return o.dispose(),null;let l=n.onWillDispose(()=>{s.dispose(),l.dispose(),o.dispose()});return n}parseStreamOutput(i){if(!i)return;let e=sTi(i.outputs);if(e)return{content:e,mode:this._languageService.createById($r)}}_getResult(i,e){let t,o=this._languageService.createById("json"),n=e.outputs.find(c=>c.outputId===i.outputId||c.alternativeOutputId===i.outputId),r=this.parseStreamOutput(n);if(r)return t=r,t;let s=e.outputs.map(c=>({metadata:c.metadata,outputItems:c.outputs.map(u=>({mimeType:u.mime,data:u.data.toString()}))}));return t={content:s0(s,{}),mode:o},t}async provideOutputsTextContent(i){let e=this._modelService.getModel(i);if(e)return e;let t=Zo.parseCellPropertyUri(i,Q.vscodeNotebookCellOutput);if(!t)return null;let o=await this._notebookModelResolverService.resolve(t.notebook),n=o.object.notebook.cells.find(u=>u.handle===t.handle);if(!n)return o.dispose(),null;let r=this._languageService.createById("json"),s=this._modelService.createModel(Ete(n.outputs||[]),r,i,!0),l=U.any(n.onDidChangeOutputs??U.None,n.onDidChangeOutputItems??U.None)(()=>{s.setValue(Ete(n.outputs||[]))}),c=s.onWillDispose(()=>{c.dispose(),l.dispose(),o.dispose()});return s}async provideOutputTextContent(i){let e=this._modelService.getModel(i);if(e)return e;let t=Zo.parseCellOutputUri(i);if(!t)return this.provideOutputsTextContent(i);let o=await this._notebookModelResolverService.resolve(t.notebook),n=o.object.notebook.cells.find(u=>!!u.outputs.find(p=>p.outputId===t.outputId||p.alternativeOutputId===t.outputId));if(!n)return o.dispose(),null;let r=this._getResult(t,n);if(!r)return o.dispose(),null;let s=this._modelService.createModel(r.content,r.mode,i),l=U.any(n.onDidChangeOutputs??U.None,n.onDidChangeOutputItems??U.None)(()=>{let u=this._getResult(t,n);u&&(s.setValue(u.content),s.setLanguage(u.mode.languageId))}),c=s.onWillDispose(()=>{c.dispose(),l.dispose(),o.dispose()});return s}};KFe=I([m(0,Bt),m(1,Tt),m(2,_t),m(3,rt),m(4,yh)],KFe);var GFe=class{constructor(i,e,t,o,n){this._modelService=e;this._languageService=t;this._labelService=o;this._notebookModelResolverService=n;this._disposables=[];this._disposables.push(i.registerTextModelContentProvider(Q.vscodeNotebookMetadata,{provideTextContent:this.provideMetadataTextContent.bind(this)})),this._disposables.push(this._labelService.registerFormatter({scheme:Q.vscodeNotebookMetadata,formatting:{label:"${path} (metadata)",separator:"/"}}))}static{this.ID="workbench.contrib.notebookMetadataContentProvider"}dispose(){Be(this._disposables)}async provideMetadataTextContent(i){let e=this._modelService.getModel(i);if(e)return e;let t=PQe.parse(i);if(!t)return null;let o=await this._notebookModelResolverService.resolve(t),n=null,r=this._languageService.createById("json"),s=new N,l=c1t(o.object.notebook.transientOptions.transientDocumentMetadata,o.object.notebook.metadata);if(n=this._modelService.createModel(l,r,i),!n)return o.dispose(),null;this._disposables.push(s.add(o.object.notebook.onDidChangeContent(u=>{if(n&&u.rawEvents.some(p=>p.kind===10||p.kind===11||p.kind===1)){let p=c1t(o.object.notebook.transientOptions.transientDocumentMetadata,o.object.notebook.metadata);n.getValue()!==p&&n.setValue(p)}})));let c=n.onWillDispose(()=>{s.dispose(),c.dispose(),o.dispose()});return n}};GFe=I([m(0,Bt),m(1,Tt),m(2,_t),m(3,rt),m(4,yh)],GFe);var p2t=class extends x{static{this.ID="workbench.contrib.registerCellSchemas"}constructor(){super(),this.registerMetadataSchemas()}registerMetadataSchemas(){let i=ne.as(ma.JSONContribution),e={properties:{language:{type:"string",description:"The language for the cell"}},additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0};i.registerSchema("vscode://schemas/notebook/cellmetadata",e)}},qFe=class{constructor(i,e,t){this._editorService=i;this._notebookEditorModelService=e;this._disposables=new N;this._disposables.add(U.debounce(this._notebookEditorModelService.onDidChangeDirty,(o,n)=>o?[...o,n]:[n],100)(this._openMissingDirtyNotebookEditors,this)),this._disposables.add(e.onWillFailWithConflict(o=>{for(let n of t.groups){let r=n.editors.filter(l=>l instanceof Ra&&l.viewType!==o.viewType&&Qe(l.resource,o.resource)),s=n.closeEditors(r);o.waitUntil(s)}}))}static{this.ID="workbench.contrib.notebookEditorManager"}dispose(){this._disposables.dispose()}_openMissingDirtyNotebookEditors(i){let e=[];for(let t of i)t.isDirty()&&!this._editorService.isOpened({resource:t.resource,typeId:Ra.ID,editorId:t.viewType})&&es(t.resource)!==".interactive"&&e.push({resource:t.resource,options:{inactive:!0,preserveFocus:!0,pinned:!0,override:t.viewType}});e.length>0&&this._editorService.openEditors(e)}};qFe=I([m(0,ee),m(1,yh),m(2,wt)],qFe);var $Fe=class extends x{constructor(e,t,o,n){super();this._instantiationService=e;this._workingCopyEditorService=t;this._extensionService=o;this._notebookService=n;this._installHandler()}static{this.ID="workbench.contrib.simpleNotebookWorkingCopyEditorHandler"}async handles(e){let t=this.handlesSync(e);return t?this._notebookService.canResolve(t):!1}handlesSync(e){let t=this._getViewType(e);if(!(!t||t==="interactive"))return t}isOpen(e,t){return this.handlesSync(e)?t instanceof Ra&&t.viewType===this._getViewType(e)&&Qe(e.resource,t.resource):!1}createEditor(e){return Ra.getOrCreate(this._instantiationService,e.resource,void 0,this._getViewType(e))}async _installHandler(){await this._extensionService.whenInstalledExtensionsRegistered(),this._register(this._workingCopyEditorService.registerHandler(this))}_getViewType(e){let t=yF.parse(e.typeId);if(t&&t.viewType===t.notebookType)return t?.viewType}};$Fe=I([m(0,F),m(1,iv),m(2,lt),m(3,bn)],$Fe);var jFe=class{constructor(i,e){this._notebookService=i;e.setNotebookTypeResolver(this._getNotebookInfo.bind(this))}static{this.ID="workbench.contrib.notebookLanguageSelectorScoreRefine"}_getNotebookInfo(i){let e=Zo.parse(i);if(!e)return;let t=this._notebookService.getNotebookTextModel(e.notebook);if(t)return{uri:t.uri,type:t.viewType}}};jFe=I([m(0,bn),m(1,Qt)],jFe);var Ynn=ne.as(Qi.Workbench);It(ooe.ID,ooe,St.BlockStartup);It(zFe.ID,zFe,St.BlockStartup);It(KFe.ID,KFe,St.BlockStartup);It(GFe.ID,GFe,St.BlockStartup);It(p2t.ID,p2t,St.BlockStartup);It(qFe.ID,qFe,St.BlockRestore);It(jFe.ID,jFe,St.BlockRestore);It($Fe.ID,$Fe,St.BlockRestore);Ynn.registerWorkbenchContribution(HFe,4);ga.register(new u2t);ga.register(new d2t);Ee(bn,bte,1);Ee(kG,DAe,1);Ee(yh,PAe,1);Ee(gZ,S1t,1);Ee(Gc,LAe,1);Ee(Ol,KH,1);Ee(eM,rU,1);Ee(eJ,OFe,1);Ee(bs,AFe,1);Ee(aDe,AAe,1);Ee(USo,WFe,1);Ee(Uv,VFe,1);Ee(lAe,aAe,1);Ee(t1t,rAe,1);var bRi={};function Xnn(a){return typeof a.type<"u"||typeof a.anyOf<"u"}for(let a of k1){let i=a.schema;if(i)if(Xnn(i))bRi[`editor.${a.name}`]=i;else for(let e in i)Object.hasOwnProperty.call(i,e)&&(bRi[e]=i[e])}var Jnn={description:d(12610,null),default:{},allOf:[{properties:bRi}],tags:["notebookLayout"]},Znn=ne.as(Jt.Configuration);Znn.registerConfiguration({id:"notebook",order:100,title:d(12651,null),type:"object",properties:{[yt.displayOrder]:{description:d(12608,null),type:"array",items:{type:"string"},default:[]},[yt.cellToolbarLocation]:{description:d(12598,null),type:"object",additionalProperties:{markdownDescription:d(12599,null),type:"string",enum:["left","right","hidden"]},default:{default:"right"},tags:["notebookLayout"]},[yt.showCellStatusBar]:{description:d(12639,null),type:"string",enum:["hidden","visible","visibleAfterExecute"],enumDescriptions:[d(12640,null),d(12641,null),d(12642,null)],default:"visible",tags:["notebookLayout"]},[yt.cellExecutionTimeVerbosity]:{description:d(12594,null),type:"string",enum:["default","verbose"],enumDescriptions:[d(12593,null),d(12595,null)],default:"default",tags:["notebookLayout"]},[yt.textDiffEditorPreview]:{description:d(12606,null),type:"boolean",default:!0,tags:["notebookLayout"]},[yt.diffOverviewRuler]:{description:d(12605,null),type:"boolean",default:!1,tags:["notebookLayout"]},[yt.cellToolbarVisibility]:{markdownDescription:d(12600,null),type:"string",enum:["hover","click"],default:"click",tags:["notebookLayout"]},[yt.undoRedoPerCell]:{description:d(12649,null),type:"boolean",default:!0,tags:["notebookLayout"]},[yt.compactView]:{description:d(12601,null),type:"boolean",default:!0,tags:["notebookLayout"]},[yt.focusIndicator]:{description:d(12612,null),type:"string",enum:["border","gutter"],default:"gutter",tags:["notebookLayout"]},[yt.insertToolbarLocation]:{description:d(12622,null),type:"string",enum:["betweenCells","notebookToolbar","both","hidden"],enumDescriptions:[d(12588,null),d(12591,null),d(12589,null),d(12590,null)],default:"both",tags:["notebookLayout"]},[yt.globalToolbar]:{description:d(12615,null),type:"boolean",default:!0,tags:["notebookLayout"]},[yt.stickyScrollEnabled]:{description:d(12644,null),type:"boolean",default:!1,tags:["notebookLayout"]},[yt.stickyScrollMode]:{description:d(12645,null),type:"string",enum:["flat","indented"],enumDescriptions:[d(12646,null),d(12647,null)],default:"indented",tags:["notebookLayout"]},[yt.consolidatedOutputButton]:{description:d(12603,null),type:"boolean",default:!0,tags:["notebookLayout"]},[yt.showFoldingControls]:{description:d(12643,null),type:"string",enum:["always","never","mouseover"],enumDescriptions:[d(12653,null),d(12655,null),d(12654,null)],default:"mouseover",tags:["notebookLayout"]},[yt.dragAndDropEnabled]:{description:d(12609,null),type:"boolean",default:!0,tags:["notebookLayout"]},[yt.consolidatedRunButton]:{description:d(12604,null),type:"boolean",default:!1,tags:["notebookLayout"]},[yt.globalToolbarShowLabel]:{description:d(12616,null),type:"string",enum:["always","never","dynamic"],default:"always",tags:["notebookLayout"]},[yt.textOutputLineLimit]:{markdownDescription:d(12648,null,"`#notebook.output.scrolling#`"),type:"number",default:30,tags:["notebookLayout","notebookOutputLayout"],minimum:1},[yt.LinkifyOutputFilePaths]:{description:d(12607,null),type:"boolean",default:!0,tags:["notebookOutputLayout"]},[yt.minimalErrorRendering]:{description:d(12627,null),type:"boolean",default:!1,tags:["notebookOutputLayout"]},[yt.markupFontSize]:{markdownDescription:d(12626,null,"`0`","`#editor.fontSize#`"),type:"number",default:0,tags:["notebookLayout"]},[yt.markdownLineHeight]:{markdownDescription:d(12624,null,"`0`","`normal`"),type:"number",default:0,tags:["notebookLayout"]},[yt.cellEditorOptionsCustomizations]:Jnn,[yt.interactiveWindowCollapseCodeCells]:{markdownDescription:d(12623,null),type:"string",enum:["always","never","fromEditor"],default:"fromEditor"},[yt.outputLineHeight]:{markdownDescription:d(12631,null),type:"number",default:0,tags:["notebookLayout","notebookOutputLayout"]},[yt.outputFontSize]:{markdownDescription:d(12630,null,"`#editor.fontSize#`"),type:"number",default:0,tags:["notebookLayout","notebookOutputLayout"]},[yt.outputFontFamily]:{markdownDescription:d(12629,null,"`#editor.fontFamily#`"),type:"string",tags:["notebookLayout","notebookOutputLayout"]},[yt.outputScrolling]:{markdownDescription:d(12632,null),type:"boolean",tags:["notebookLayout","notebookOutputLayout"],default:typeof ro.quality=="string"&&ro.quality!=="stable"},[yt.outputWordWrap]:{markdownDescription:d(12633,null),type:"boolean",tags:["notebookLayout","notebookOutputLayout"],default:!1},[yt.defaultFormatter]:{description:d(12652,null),type:["string","null"],default:null,enum:Vm.extensionIds,enumItemLabels:Vm.extensionItemLabels,markdownEnumDescriptions:Vm.extensionDescriptions},[yt.formatOnSave]:{markdownDescription:d(12614,null,"`#files.autoSave#`"),type:"boolean",tags:["notebookLayout"],default:!1},[yt.insertFinalNewline]:{markdownDescription:d(12621,null),type:"boolean",tags:["notebookLayout"],default:!1},[yt.formatOnCellExecution]:{markdownDescription:d(12613,null),type:"boolean",default:!1},[yt.confirmDeleteRunningCell]:{markdownDescription:d(12602,null),type:"boolean",default:!0},[yt.findFilters]:{markdownDescription:d(12611,null),type:"object",properties:{markupSource:{type:"boolean",default:!0},markupPreview:{type:"boolean",default:!0},codeSource:{type:"boolean",default:!0},codeOutput:{type:"boolean",default:!0}},default:{markupSource:!0,markupPreview:!0,codeSource:!0,codeOutput:!0},tags:["notebookLayout"]},[yt.remoteSaving]:{markdownDescription:d(12634,null),type:"boolean",default:typeof ro.quality=="string"&&ro.quality!=="stable",tags:["experimental"]},[yt.scrollToRevealCell]:{markdownDescription:d(12635,null,"notebook.cell.executeAndSelectBelow"),type:"string",enum:["fullCell","firstLine","none"],markdownEnumDescriptions:[d(12637,null),d(12636,null),d(12638,null)],default:"fullCell"},[yt.cellGenerate]:{markdownDescription:d(12597,null),type:"boolean",default:!0},[yt.notebookVariablesView]:{markdownDescription:d(12650,null),type:"boolean",default:!1},[yt.notebookInlineValues]:{markdownDescription:d(12618,null),type:"string",enum:["on","auto","off"],enumDescriptions:[d(12620,null),d(12617,null),d(12619,null)],default:"off"},[yt.cellFailureDiagnostics]:{markdownDescription:d(12596,null),type:"boolean",default:!0},[yt.outputBackupSizeLimit]:{markdownDescription:d(12592,null),type:"number",default:1e4},[yt.multiCursor]:{markdownDescription:d(12628,null),type:"boolean",default:!1},[yt.markupFontFamily]:{markdownDescription:d(12625,null),type:"string",default:"",tags:["notebookLayout"]}}});var trn=Rn.registerExtensionPoint({extensionPoint:"speechProviders",jsonSchema:{description:d(14246,null),type:"array",items:{additionalProperties:!1,type:"object",defaultSnippets:[{body:{name:"",description:""}}],required:["name"],properties:{name:{description:d(14245,null),type:"string"},description:{description:d(14244,null),type:"string"}}}}}),QFe=class extends x{constructor(e,t,o,n,r,s){super();this.logService=e;this.hostService=o;this.telemetryService=n;this.configurationService=r;this.extensionService=s;this._onDidChangeHasSpeechProvider=this._register(new E);this.onDidChangeHasSpeechProvider=this._onDidChangeHasSpeechProvider.event;this.providers=new Map;this.providerDescriptors=new Map;this._onDidStartSpeechToTextSession=this._register(new E);this.onDidStartSpeechToTextSession=this._onDidStartSpeechToTextSession.event;this._onDidEndSpeechToTextSession=this._register(new E);this.onDidEndSpeechToTextSession=this._onDidEndSpeechToTextSession.event;this.activeSpeechToTextSessions=0;this._onDidStartTextToSpeechSession=this._register(new E);this.onDidStartTextToSpeechSession=this._onDidStartTextToSpeechSession.event;this._onDidEndTextToSpeechSession=this._register(new E);this.onDidEndTextToSpeechSession=this._onDidEndTextToSpeechSession.event;this.activeTextToSpeechSessions=0;this._onDidStartKeywordRecognition=this._register(new E);this.onDidStartKeywordRecognition=this._onDidStartKeywordRecognition.event;this._onDidEndKeywordRecognition=this._register(new E);this.onDidEndKeywordRecognition=this._onDidEndKeywordRecognition.event;this.activeKeywordRecognitionSessions=0;this.hasSpeechProviderContext=zB.bindTo(t),this.textToSpeechInProgress=SPt.bindTo(t),this.speechToTextInProgress=QJ.bindTo(t),this.handleAndRegisterSpeechExtensions()}get hasSpeechProvider(){return this.providerDescriptors.size>0||this.providers.size>0}handleAndRegisterSpeechExtensions(){trn.setHandler((e,t)=>{let o=this.hasSpeechProvider;for(let n of t.removed)for(let r of n.value)this.providerDescriptors.delete(r.name);for(let n of t.added)for(let r of n.value)this.providerDescriptors.set(r.name,r);o!==this.hasSpeechProvider&&this.handleHasSpeechProviderChange()})}registerSpeechProvider(e,t){if(this.providers.has(e))throw new Error(`Speech provider with identifier ${e} is already registered.`);let o=this.hasSpeechProvider;return this.providers.set(e,t),o!==this.hasSpeechProvider&&this.handleHasSpeechProviderChange(),Z(()=>{let n=this.hasSpeechProvider;this.providers.delete(e),n!==this.hasSpeechProvider&&this.handleHasSpeechProviderChange()})}handleHasSpeechProviderChange(){this.hasSpeechProviderContext.set(this.hasSpeechProvider),this._onDidChangeHasSpeechProvider.fire()}get hasActiveSpeechToTextSession(){return this.activeSpeechToTextSessions>0}async createSpeechToTextSession(e,t="speech"){let o=await this.getProvider(),n=IPt(this.configurationService.getValue(svi)),r=o.createSpeechToTextSession(e,typeof n=="string"?{language:n}:void 0),s=Date.now(),l=!1,c=!1,u=0,p=new N,h=()=>{this.activeSpeechToTextSessions=Math.max(0,this.activeSpeechToTextSessions-1),this.hasActiveSpeechToTextSession||this.speechToTextInProgress.reset(),this._onDidEndSpeechToTextSession.fire(),this.telemetryService.publicLog2("speechToTextSession",{context:t,sessionDuration:Date.now()-s,sessionRecognized:l,sessionError:c,sessionContentLength:u,sessionLanguage:n}),p.dispose()};return p.add(e.onCancellationRequested(()=>h())),e.isCancellationRequested&&h(),p.add(r.onDidChange(g=>{switch(g.status){case 1:this.activeSpeechToTextSessions++,this.speechToTextInProgress.set(!0),this._onDidStartSpeechToTextSession.fire();break;case 2:l=!0;break;case 3:typeof g.text=="string"&&(u+=g.text.length);break;case 4:h();break;case 5:this.logService.error(`Speech provider error in speech to text session: ${g.text}`),c=!0;break}})),r}async getProvider(){await this.extensionService.activateByEvent("onSpeech");let e=Array.from(this.providers.values()).at(0);if(e)this.providers.size>1&&this.logService.warn(`Multiple speech providers registered. Picking first one: ${e.metadata.displayName}`);else throw new Error("No Speech provider is registered.");return e}get hasActiveTextToSpeechSession(){return this.activeTextToSpeechSessions>0}async createTextToSpeechSession(e,t="speech"){let o=await this.getProvider(),n=IPt(this.configurationService.getValue(svi)),r=o.createTextToSpeechSession(e,typeof n=="string"?{language:n}:void 0),s=Date.now(),l=!1,c=new N,u=p=>{this.activeTextToSpeechSessions=Math.max(0,this.activeTextToSpeechSessions-1),this.hasActiveTextToSpeechSession||this.textToSpeechInProgress.reset(),this._onDidEndTextToSpeechSession.fire(),this.telemetryService.publicLog2("textToSpeechSession",{context:t,sessionDuration:Date.now()-s,sessionError:l,sessionLanguage:n}),p&&c.dispose()};return c.add(e.onCancellationRequested(()=>u(!0))),e.isCancellationRequested&&u(!0),c.add(r.onDidChange(p=>{switch(p.status){case 1:this.activeTextToSpeechSessions++,this.textToSpeechInProgress.set(!0),this._onDidStartTextToSpeechSession.fire();break;case 2:u(!1);break;case 3:this.logService.error(`Speech provider error in text to speech session: ${p.text}`),l=!0;break}})),r}get hasActiveKeywordRecognition(){return this.activeKeywordRecognitionSessions>0}async recognizeKeyword(e){let t=new Ko,o=new N;o.add(e.onCancellationRequested(()=>{o.dispose(),t.complete(3)}));let n=o.add(new N),r,s=()=>{n.clear();let c=new Ye(e);n.add(Z(()=>c.dispose(!0)));let u=r=this.doRecognizeKeyword(c.token).then(p=>{u===r&&t.complete(p)},p=>{u===r&&t.error(p)})};o.add(this.hostService.onDidChangeFocus(c=>{!c&&r?(n.clear(),r=void 0):r||s()})),this.hostService.hasFocus&&s();let l;try{l=await t.p}finally{o.dispose()}return this.telemetryService.publicLog2("keywordRecognition",{keywordRecognized:l===1}),l}async doRecognizeKeyword(e){let o=(await this.getProvider()).createKeywordRecognitionSession(e);this.activeKeywordRecognitionSessions++,this._onDidStartKeywordRecognition.fire();let n=new N,r=()=>{this.activeKeywordRecognitionSessions=Math.max(0,this.activeKeywordRecognitionSessions-1),this._onDidEndKeywordRecognition.fire(),n.dispose()};n.add(e.onCancellationRequested(()=>r())),e.isCancellationRequested&&r(),n.add(o.onDidChange(s=>{s.status===2&&r()}));try{return(await U.toPromise(o.onDidChange)).status}finally{r()}}};QFe=I([m(0,se),m(1,X),m(2,Zt),m(3,Te),m(4,B),m(5,lt)],QFe);Ee(ZC,QFe,0);var YFe="chat.agentHost.enabled",m2t="chat.agentHost.ipcLoggingEnabled",ZG;(t=>{function a(o,n){return A.from({scheme:o,path:`/${n}`})}t.uri=a;function i(o){return(typeof o=="string"?A.parse(o):o).path.substring(1)}t.id=i;function e(o){return(typeof o=="string"?A.parse(o):o).scheme||void 0}t.provider=e})(ZG||={});var QPm=le("agentService"),h2t=le("agentHostService");var XFe=class extends x{constructor(e){super();this.logService=e}getMcpServerConfigurationFromManifest(e,t){if(t==="remote"&&e.remotes?.length){let c=e.remotes[0].url,u=e.remotes[0].headers??[],{inputs:p,variables:h}=this.processKeyValueInputs(c.startsWith("https://api.githubcopilot.com/mcp")?u.filter(g=>g.name.toLowerCase()!=="authorization"):u);return{mcpServerConfiguration:{config:{type:"http",url:e.remotes[0].url,headers:Object.keys(p).length?p:void 0},inputs:h.length?h:void 0},notices:[]}}let o=e.packages?.find(c=>c.registryType===t)??e.packages?.[0];if(!o)throw new Error("No server package found");let n=[],r=[],s={},l=[];if(o.registryType==="oci"&&(n.push("run"),n.push("-i"),n.push("--rm")),o.runtimeArguments?.length){let c=this.processArguments(o.runtimeArguments??[]);n.push(...c.args),r.push(...c.variables),l.push(...c.notices)}if(o.environmentVariables?.length){let{inputs:c,variables:u,notices:p}=this.processKeyValueInputs(o.environmentVariables??[]);r.push(...u),l.push(...p);for(let[h,g]of Object.entries(c))s[h]=g,o.registryType==="oci"&&(n.push("-e"),n.push(h))}switch(o.registryType){case"npm":o.registryBaseUrl&&n.push("--registry",o.registryBaseUrl),n.push(o.version?`${o.identifier}@${o.version}`:o.identifier);break;case"pypi":o.registryBaseUrl&&n.push("--index-url",o.registryBaseUrl),n.push(o.version?`${o.identifier}@${o.version}`:o.identifier);break;case"oci":{let c=o.registryBaseUrl?`${o.registryBaseUrl}/${o.identifier}`:o.identifier;n.push(o.version?`${c}:${o.version}`:c);break}case"nuget":n.push(o.version?`${o.identifier}@${o.version}`:o.identifier),n.push("--yes"),o.registryBaseUrl&&n.push("--source",o.registryBaseUrl),o.packageArguments?.length&&n.push("--");break}if(o.packageArguments?.length){let c=this.processArguments(o.packageArguments);n.push(...c.args),r.push(...c.variables),l.push(...c.notices)}return{notices:l,mcpServerConfiguration:{config:{type:"stdio",command:this.getCommandName(o.registryType),args:n.length?n:void 0,env:Object.keys(s).length?s:void 0},inputs:r.length?r:void 0}}}getCommandName(e){switch(e){case"npm":return"npx";case"oci":return"docker";case"pypi":return"uvx";case"nuget":return"dnx"}return e}getVariables(e){let t=[];for(let[o,n]of Object.entries(e))t.push({id:o,type:n.choices?"pickString":"promptString",description:n.description??"",password:!!n.isSecret,default:n.default,options:n.choices});return t}processKeyValueInputs(e){let t=[],o={},n=[];for(let r of e){let s=r.variables?this.getVariables(r.variables):[],l=r.value||"";if(s.length){for(let c of s)l=l.replace(`{${c.id}}`,`\${input:${c.id}}`);n.push(...s)}else!l&&(r.description||r.choices||r.default!==void 0)&&(n.push({id:r.name,type:r.choices?"pickString":"promptString",description:r.description??"",password:!!r.isSecret,default:r.default,options:r.choices}),l=`\${input:${r.name}}`);o[r.name]=l}return{inputs:o,variables:n,notices:t}}processArguments(e){let t=[],o=[],n=[];for(let r of e){let s=r.variables?this.getVariables(r.variables):[];if(r.type==="positional"){let l=r.value;if(l){for(let c of s)l=l.replace(`{${c.id}}`,`\${input:${c.id}}`);t.push(l),s.length&&o.push(...s)}else r.valueHint&&(r.description||r.default!==void 0)?(o.push({id:r.valueHint,type:"promptString",description:r.description??"",password:!1,default:r.default}),t.push(`\${input:${r.valueHint}}`)):t.push(r.valueHint??"")}else if(r.type==="named"){if(!r.name){n.push(`Named argument is missing a name. ${JSON.stringify(r)}`);continue}if(t.push(r.name),r.value){let l=r.value;for(let c of s)l=l.replace(`{${c.id}}`,`\${input:${c.id}}`);t.push(l),s.length&&o.push(...s)}else if(r.description||r.default!==void 0){let l=r.name.replace(/^--?/,"");o.push({id:l,type:"promptString",description:r.description??"",password:!1,default:r.default}),t.push(`\${input:${l}}`)}}}return{args:t,variables:o,notices:n}}};XFe=I([m(0,se)],XFe);var qge=class extends XFe{constructor(e,t,o,n,r,s,l){super(s);this.mcpResource=e;this.target=t;this.mcpGalleryService=o;this.fileService=n;this.uriIdentityService=r;this.mcpResourceScannerService=l;this.local=new Map;this._onInstallMcpServer=this._register(new E);this.onInstallMcpServer=this._onInstallMcpServer.event;this._onDidInstallMcpServers=this._register(new E);this._onDidUpdateMcpServers=this._register(new E);this._onUninstallMcpServer=this._register(new E);this._onDidUninstallMcpServer=this._register(new E);this.reloadConfigurationScheduler=this._register(new Dt(()=>this.updateLocal(),50))}get onDidInstallMcpServers(){return this._onDidInstallMcpServers.event}get onDidUpdateMcpServers(){return this._onDidUpdateMcpServers.event}get onUninstallMcpServer(){return this._onUninstallMcpServer.event}get onDidUninstallMcpServer(){return this._onDidUninstallMcpServer.event}initialize(){return this.initializePromise||(this.initializePromise=(async()=>{try{this.local=await this.populateLocalServers()}finally{this.startWatching()}})()),this.initializePromise}async populateLocalServers(){this.logService.trace("AbstractMcpResourceManagementService#populateLocalServers",this.mcpResource.toString());let e=new Map;try{let t=await this.mcpResourceScannerService.scanMcpServers(this.mcpResource,this.target);t.servers&&await Promise.allSettled(Object.entries(t.servers).map(async([o,n])=>{let r=await this.scanLocalServer(o,n,t.sandbox);e.set(o,r)}))}catch(t){throw this.logService.debug("Could not read user MCP servers:",t),t}return e}startWatching(){this._register(this.fileService.watch(this.mcpResource)),this._register(this.fileService.onDidFilesChange(e=>{e.affects(this.mcpResource)&&this.reloadConfigurationScheduler.schedule()}))}async updateLocal(){try{let e=await this.populateLocalServers(),t=[],o=[],n=[...this.local.keys()].filter(r=>!e.has(r));for(let r of n)this.local.delete(r);for(let[r,s]of e){let l=this.local.get(r);l?eo(l,s)||(o.push(s),this.local.set(r,s)):(t.push(s),this.local.set(r,s))}for(let r of n)this.local.delete(r),this._onDidUninstallMcpServer.fire({name:r,mcpResource:this.mcpResource});o.length&&this._onDidUpdateMcpServers.fire(o.map(r=>({name:r.name,local:r,mcpResource:this.mcpResource}))),t.length&&this._onDidInstallMcpServers.fire(t.map(r=>({name:r.name,local:r,mcpResource:this.mcpResource})))}catch(e){this.logService.error("Failed to load installed MCP servers:",e)}}async getInstalled(){return await this.initialize(),Array.from(this.local.values())}async scanLocalServer(e,t,o){let n=await this.getLocalServerInfo(e,t);return n||(n={name:e,version:t.version,galleryUrl:Fe(t.gallery)?t.gallery:void 0}),{name:e,config:t,rootSandbox:o,mcpResource:this.mcpResource,version:n.version,location:n.location,displayName:n.displayName,description:n.description,publisher:n.publisher,publisherDisplayName:n.publisherDisplayName,galleryUrl:n.galleryUrl,galleryId:n.galleryId,repositoryUrl:n.repositoryUrl,readmeUrl:n.readmeUrl,icon:n.icon,codicon:n.codicon,manifest:n.manifest,source:t.gallery?"gallery":"local"}}async install(e,t){this.logService.trace("MCP Management Service: install",e.name),this._onInstallMcpServer.fire({name:e.name,mcpResource:this.mcpResource});try{await this.mcpResourceScannerService.addMcpServers([e],this.mcpResource,this.target),await this.updateLocal();let o=this.local.get(e.name);if(!o)throw new Error(`Failed to install MCP server: ${e.name}`);return o}catch(o){throw this._onDidInstallMcpServers.fire([{name:e.name,error:o,mcpResource:this.mcpResource}]),o}}async uninstall(e,t){this.logService.trace("MCP Management Service: uninstall",e.name),this._onUninstallMcpServer.fire({name:e.name,mcpResource:this.mcpResource});try{if(!(await this.mcpResourceScannerService.scanMcpServers(this.mcpResource,this.target)).servers)return;await this.mcpResourceScannerService.removeMcpServers([e.name],this.mcpResource,this.target),e.location&&await this.fileService.del(A.revive(e.location),{recursive:!0}),await this.updateLocal()}catch(o){throw this._onDidUninstallMcpServer.fire({name:e.name,error:o,mcpResource:this.mcpResource}),o}}};qge=I([m(2,sG),m(3,fe),m(4,ht),m(5,se),m(6,mee)],qge);var Ynt=class extends qge{constructor(i,e,t,o,n,r,s){super(i,2,e,t,o,n,r),this.mcpLocation=o.extUri.joinPath(s.userRoamingDataHome,"mcp")}async installFromGallery(i,e){throw new Error("Not supported")}async updateMetadata(i,e){await this.updateMetadataFromGallery(e),await this.updateLocal();let t=(await this.getInstalled()).find(o=>o.name===i.name);if(!t)throw new Error(`Failed to find MCP server: ${i.name}`);return t}async updateMetadataFromGallery(i){let e=i.configuration,t=this.getLocation(i.name,i.version),o=this.uriIdentityService.extUri.joinPath(t,"manifest.json"),n={galleryUrl:i.galleryUrl,galleryId:i.id,name:i.name,displayName:i.displayName,description:i.description,version:i.version,publisher:i.publisher,publisherDisplayName:i.publisherDisplayName,repositoryUrl:i.repositoryUrl,licenseUrl:i.license,icon:i.icon,codicon:i.codicon,manifest:e};if(await this.fileService.writeFile(o,qe.fromString(JSON.stringify(n))),i.readmeUrl||i.readme){let r=i.readme?i.readme:await this.mcpGalleryService.getReadme(i,Se.None);await this.fileService.writeFile(this.uriIdentityService.extUri.joinPath(t,"README.md"),qe.fromString(r))}return e}async getLocalServerInfo(i,e){let t,o,n;if(e.gallery){o=this.getLocation(i,e.version);let r=this.uriIdentityService.extUri.joinPath(o,"manifest.json");try{let s=await this.fileService.readFile(r);t=JSON.parse(s.value.toString()),t.galleryUrl?.includes("/v0/")&&(t.galleryUrl=t.galleryUrl.substring(0,t.galleryUrl.indexOf("/v0/")),await this.fileService.writeFile(r,qe.fromString(JSON.stringify(t)))),t.location=o,n=this.uriIdentityService.extUri.joinPath(o,"README.md"),await this.fileService.exists(n)||(n=void 0),t.readmeUrl=n}catch(s){this.logService.error("MCP Management Service: failed to read manifest",o.toString(),s)}}return t}getLocation(i,e){return i=i.replace("/","."),this.uriIdentityService.extUri.joinPath(this.mcpLocation,e?`${i}-${e}`:i)}installFromUri(i,e){throw new Error("Method not supported.")}canInstall(){throw new Error("Not supported")}};Ynt=I([m(1,sG),m(2,fe),m(3,ht),m(4,se),m(5,mee),m(6,Eo)],Ynt);var eq=class extends XFe{constructor(e,t){super(t);this.allowedMcpServersService=e}canInstall(e){let t=this.allowedMcpServersService.isAllowed(e);return t!==!0?new Ie(d(2226,null,t.value)):!0}};eq=I([m(0,vM),m(1,se)],eq);var g2t=class extends eq{constructor(e,t,o,n){super(e,t);this.userDataProfilesService=o;this.instantiationService=n;this._onInstallMcpServer=this._register(new E);this.onInstallMcpServer=this._onInstallMcpServer.event;this._onDidInstallMcpServers=this._register(new E);this.onDidInstallMcpServers=this._onDidInstallMcpServers.event;this._onDidUpdateMcpServers=this._register(new E);this.onDidUpdateMcpServers=this._onDidUpdateMcpServers.event;this._onUninstallMcpServer=this._register(new E);this.onUninstallMcpServer=this._onUninstallMcpServer.event;this._onDidUninstallMcpServer=this._register(new E);this.onDidUninstallMcpServer=this._onDidUninstallMcpServer.event;this.mcpResourceManagementServices=new gt}getMcpResourceManagementService(e){let t=this.mcpResourceManagementServices.get(e);if(!t){let o=new N,n=o.add(this.createMcpResourceManagementService(e));o.add(n.onInstallMcpServer(r=>this._onInstallMcpServer.fire(r))),o.add(n.onDidInstallMcpServers(r=>this._onDidInstallMcpServers.fire(r))),o.add(n.onDidUpdateMcpServers(r=>this._onDidUpdateMcpServers.fire(r))),o.add(n.onUninstallMcpServer(r=>this._onUninstallMcpServer.fire(r))),o.add(n.onDidUninstallMcpServer(r=>this._onDidUninstallMcpServer.fire(r))),this.mcpResourceManagementServices.set(e,t={service:n,dispose:()=>o.dispose()})}return t.service}async getInstalled(e){let t=e||this.userDataProfilesService.defaultProfile.mcpResource;return this.getMcpResourceManagementService(t).getInstalled()}async install(e,t){let o=t?.mcpResource||this.userDataProfilesService.defaultProfile.mcpResource;return this.getMcpResourceManagementService(o).install(e,t)}async uninstall(e,t){let o=t?.mcpResource||this.userDataProfilesService.defaultProfile.mcpResource;return this.getMcpResourceManagementService(o).uninstall(e,t)}async installFromGallery(e,t){let o=t?.mcpResource||this.userDataProfilesService.defaultProfile.mcpResource;return this.getMcpResourceManagementService(o).installFromGallery(e,t)}async updateMetadata(e,t,o){return this.getMcpResourceManagementService(o||this.userDataProfilesService.defaultProfile.mcpResource).updateMetadata(e,t)}dispose(){this.mcpResourceManagementServices.forEach(e=>e.dispose()),this.mcpResourceManagementServices.clear(),super.dispose()}createMcpResourceManagementService(e){return this.instantiationService.createInstance(Ynt,e)}};g2t=I([m(0,vM),m(1,se),m(2,an),m(3,F)],g2t);function Xnt(a,i){return a?A.revive(i?i.transformIncoming(a):a):void 0}function JFe(a,i){i=i||dBt;let e=a.manifest;return{...uBt({...a,manifest:void 0},i),manifest:e}}var noe=class extends eq{constructor(e,t,o){super(t,o);this.channel=e;this._onInstallMcpServer=this._register(new E);this._onDidInstallMcpServers=this._register(new E);this._onUninstallMcpServer=this._register(new E);this._onDidUninstallMcpServer=this._register(new E);this._onDidUpdateMcpServers=this._register(new E);this._register(this.channel.listen("onInstallMcpServer")(n=>this._onInstallMcpServer.fire({...n,mcpResource:Xnt(n.mcpResource,null)}))),this._register(this.channel.listen("onDidInstallMcpServers")(n=>this._onDidInstallMcpServers.fire(n.map(r=>({...r,local:r.local?JFe(r.local,null):r.local,mcpResource:Xnt(r.mcpResource,null)}))))),this._register(this.channel.listen("onDidUpdateMcpServers")(n=>this._onDidUpdateMcpServers.fire(n.map(r=>({...r,local:r.local?JFe(r.local,null):r.local,mcpResource:Xnt(r.mcpResource,null)}))))),this._register(this.channel.listen("onUninstallMcpServer")(n=>this._onUninstallMcpServer.fire({...n,mcpResource:Xnt(n.mcpResource,null)}))),this._register(this.channel.listen("onDidUninstallMcpServer")(n=>this._onDidUninstallMcpServer.fire({...n,mcpResource:Xnt(n.mcpResource,null)})))}get onInstallMcpServer(){return this._onInstallMcpServer.event}get onDidInstallMcpServers(){return this._onDidInstallMcpServers.event}get onUninstallMcpServer(){return this._onUninstallMcpServer.event}get onDidUninstallMcpServer(){return this._onDidUninstallMcpServer.event}get onDidUpdateMcpServers(){return this._onDidUpdateMcpServers.event}install(e,t){return Promise.resolve(this.channel.call("install",[e,t])).then(o=>JFe(o,null))}installFromGallery(e,t){return Promise.resolve(this.channel.call("installFromGallery",[e,t])).then(o=>JFe(o,null))}uninstall(e,t){return Promise.resolve(this.channel.call("uninstall",[e,t]))}getInstalled(e){return Promise.resolve(this.channel.call("getInstalled",[e])).then(t=>t.map(o=>JFe(o,null)))}updateMetadata(e,t,o){return Promise.resolve(this.channel.call("updateMetadata",[e,t,o])).then(n=>JFe(n,null))}};noe=I([m(1,vM),m(2,se)],noe);var SRi="usrlocal",IRi="usrremote",yRi="workspace",wRi="ws";var bQ=Puo,ZFe=class extends eq{constructor(e,t,o,n,r,s,l,c,u,p){super(t,o);this.mcpManagementService=e;this.userDataProfileService=n;this.uriIdentityService=r;this.workspaceContextService=s;this.userDataProfilesService=c;this.remoteUserDataProfilesService=u;this._onInstallMcpServer=this._register(new E);this.onInstallMcpServer=this._onInstallMcpServer.event;this._onDidInstallMcpServers=this._register(new E);this.onDidInstallMcpServers=this._onDidInstallMcpServers.event;this._onDidUpdateMcpServers=this._register(new E);this.onDidUpdateMcpServers=this._onDidUpdateMcpServers.event;this._onUninstallMcpServer=this._register(new E);this.onUninstallMcpServer=this._onUninstallMcpServer.event;this._onDidUninstallMcpServer=this._register(new E);this.onDidUninstallMcpServer=this._onDidUninstallMcpServer.event;this._onInstallMcpServerInCurrentProfile=this._register(new E);this.onInstallMcpServerInCurrentProfile=this._onInstallMcpServerInCurrentProfile.event;this._onDidInstallMcpServersInCurrentProfile=this._register(new E);this.onDidInstallMcpServersInCurrentProfile=this._onDidInstallMcpServersInCurrentProfile.event;this._onDidUpdateMcpServersInCurrentProfile=this._register(new E);this.onDidUpdateMcpServersInCurrentProfile=this._onDidUpdateMcpServersInCurrentProfile.event;this._onUninstallMcpServerInCurrentProfile=this._register(new E);this.onUninstallMcpServerInCurrentProfile=this._onUninstallMcpServerInCurrentProfile.event;this._onDidUninstallMcpServerInCurrentProfile=this._register(new E);this.onDidUninstallMcpServerInCurrentProfile=this._onDidUninstallMcpServerInCurrentProfile.event;this._onDidChangeProfile=this._register(new E);this.onDidChangeProfile=this._onDidChangeProfile.event;this.workspaceMcpManagementService=this._register(p.createInstance(Znt));let h=l.getConnection();h&&(this.remoteMcpManagementService=this._register(p.createInstance(noe,h.getChannel("mcpManagement")))),this._register(this.mcpManagementService.onInstallMcpServer(g=>{this._onInstallMcpServer.fire(g),r.extUri.isEqual(g.mcpResource,this.userDataProfileService.currentProfile.mcpResource)&&this._onInstallMcpServerInCurrentProfile.fire({...g,scope:"user"})})),this._register(this.mcpManagementService.onDidInstallMcpServers(g=>{let{mcpServerInstallResult:f,mcpServerInstallResultInCurrentProfile:v}=this.createInstallMcpServerResultsFromEvent(g,"user");this._onDidInstallMcpServers.fire(f),v.length&&this._onDidInstallMcpServersInCurrentProfile.fire(v)})),this._register(this.mcpManagementService.onDidUpdateMcpServers(g=>{let{mcpServerInstallResult:f,mcpServerInstallResultInCurrentProfile:v}=this.createInstallMcpServerResultsFromEvent(g,"user");this._onDidUpdateMcpServers.fire(f),v.length&&this._onDidUpdateMcpServersInCurrentProfile.fire(v)})),this._register(this.mcpManagementService.onUninstallMcpServer(g=>{this._onUninstallMcpServer.fire(g),r.extUri.isEqual(g.mcpResource,this.userDataProfileService.currentProfile.mcpResource)&&this._onUninstallMcpServerInCurrentProfile.fire({...g,scope:"user"})})),this._register(this.mcpManagementService.onDidUninstallMcpServer(g=>{this._onDidUninstallMcpServer.fire(g),r.extUri.isEqual(g.mcpResource,this.userDataProfileService.currentProfile.mcpResource)&&this._onDidUninstallMcpServerInCurrentProfile.fire({...g,scope:"user"})})),this._register(this.workspaceMcpManagementService.onInstallMcpServer(async g=>{this._onInstallMcpServer.fire(g),this._onInstallMcpServerInCurrentProfile.fire({...g,scope:"workspace"})})),this._register(this.workspaceMcpManagementService.onDidInstallMcpServers(async g=>{let{mcpServerInstallResult:f}=this.createInstallMcpServerResultsFromEvent(g,"workspace");this._onDidInstallMcpServers.fire(f),this._onDidInstallMcpServersInCurrentProfile.fire(f)})),this._register(this.workspaceMcpManagementService.onUninstallMcpServer(async g=>{this._onUninstallMcpServer.fire(g),this._onUninstallMcpServerInCurrentProfile.fire({...g,scope:"workspace"})})),this._register(this.workspaceMcpManagementService.onDidUninstallMcpServer(async g=>{this._onDidUninstallMcpServer.fire(g),this._onDidUninstallMcpServerInCurrentProfile.fire({...g,scope:"workspace"})})),this._register(this.workspaceMcpManagementService.onDidUpdateMcpServers(g=>{let{mcpServerInstallResult:f}=this.createInstallMcpServerResultsFromEvent(g,"workspace");this._onDidUpdateMcpServers.fire(f),this._onDidUpdateMcpServersInCurrentProfile.fire(f)})),this.remoteMcpManagementService&&(this._register(this.remoteMcpManagementService.onInstallMcpServer(async g=>{this._onInstallMcpServer.fire(g);let f=await this.getRemoteMcpResource(this.userDataProfileService.currentProfile.mcpResource);(f?r.extUri.isEqual(g.mcpResource,f):this.userDataProfileService.currentProfile.isDefault)&&this._onInstallMcpServerInCurrentProfile.fire({...g,scope:"remoteUser"})})),this._register(this.remoteMcpManagementService.onDidInstallMcpServers(g=>this.handleRemoteInstallMcpServerResultsFromEvent(g,this._onDidInstallMcpServers,this._onDidInstallMcpServersInCurrentProfile))),this._register(this.remoteMcpManagementService.onDidUpdateMcpServers(g=>this.handleRemoteInstallMcpServerResultsFromEvent(g,this._onDidInstallMcpServers,this._onDidInstallMcpServersInCurrentProfile))),this._register(this.remoteMcpManagementService.onUninstallMcpServer(async g=>{this._onUninstallMcpServer.fire(g);let f=await this.getRemoteMcpResource(this.userDataProfileService.currentProfile.mcpResource);(f?r.extUri.isEqual(g.mcpResource,f):this.userDataProfileService.currentProfile.isDefault)&&this._onUninstallMcpServerInCurrentProfile.fire({...g,scope:"remoteUser"})})),this._register(this.remoteMcpManagementService.onDidUninstallMcpServer(async g=>{this._onDidUninstallMcpServer.fire(g);let f=await this.getRemoteMcpResource(this.userDataProfileService.currentProfile.mcpResource);(f?r.extUri.isEqual(g.mcpResource,f):this.userDataProfileService.currentProfile.isDefault)&&this._onDidUninstallMcpServerInCurrentProfile.fire({...g,scope:"remoteUser"})}))),this._register(n.onDidChangeCurrentProfile(g=>{this.uriIdentityService.extUri.isEqual(g.previous.mcpResource,g.profile.mcpResource)||this._onDidChangeProfile.fire()}))}createInstallMcpServerResultsFromEvent(e,t){let o=[],n=[];for(let r of e){let s={...r,local:r.local?this.toWorkspaceMcpServer(r.local,t):void 0};o.push(s),this.uriIdentityService.extUri.isEqual(r.mcpResource,this.userDataProfileService.currentProfile.mcpResource)&&n.push(s)}return{mcpServerInstallResult:o,mcpServerInstallResultInCurrentProfile:n}}async handleRemoteInstallMcpServerResultsFromEvent(e,t,o){let n=[],r=[],s=await this.getRemoteMcpResource(this.userDataProfileService.currentProfile.mcpResource);for(let l of e){let c={...l,local:l.local?this.toWorkspaceMcpServer(l.local,"remoteUser"):void 0};n.push(c),(s?this.uriIdentityService.extUri.isEqual(l.mcpResource,s):this.userDataProfileService.currentProfile.isDefault)&&r.push(c)}t.fire(n),r.length&&o.fire(r)}async getInstalled(){let e=[],[t,o,n]=await Promise.all([this.mcpManagementService.getInstalled(this.userDataProfileService.currentProfile.mcpResource),this.remoteMcpManagementService?.getInstalled(await this.getRemoteMcpResource())??Promise.resolve([]),this.workspaceMcpManagementService?.getInstalled()??Promise.resolve([])]);for(let r of t)e.push(this.toWorkspaceMcpServer(r,"user"));for(let r of o)e.push(this.toWorkspaceMcpServer(r,"remoteUser"));for(let r of n)e.push(this.toWorkspaceMcpServer(r,"workspace"));return e}toWorkspaceMcpServer(e,t){return{...e,id:`mcp.config.${this.getConfigId(e,t)}.${e.name}`,scope:t}}getConfigId(e,t){if(t==="user")return SRi;if(t==="remoteUser")return IRi;if(t==="workspace"){let o=this.workspaceContextService.getWorkspace();if(o.configuration&&this.uriIdentityService.extUri.isEqual(o.configuration,e.mcpResource))return yRi;let n=o.folders;for(let r=0;r<n.length;r++){let s=n[r];if(this.uriIdentityService.extUri.isEqual(this.uriIdentityService.extUri.joinPath(s.uri,RD[zv]),e.mcpResource))return`${wRi}${r}`}}return"unknown"}async install(e,t){if(t=t??{},t.target===5||hw(t.target)){let n=t.target===5?this.workspaceContextService.getWorkspace().configuration:t.target.toResource(RD[zv]);if(!n)throw new Error(`Illegal target: ${t.target}`);t.mcpResource=n;let r=await this.workspaceMcpManagementService.install(e,t);return this.toWorkspaceMcpServer(r,"workspace")}if(t.target===4){if(!this.remoteMcpManagementService)throw new Error(`Illegal target: ${t.target}`);t.mcpResource=await this.getRemoteMcpResource(t.mcpResource);let n=await this.remoteMcpManagementService.install(e,t);return this.toWorkspaceMcpServer(n,"remoteUser")}if(t.target&&t.target!==2&&t.target!==3)throw new Error(`Illegal target: ${t.target}`);t.mcpResource=this.userDataProfileService.currentProfile.mcpResource;let o=await this.mcpManagementService.install(e,t);return this.toWorkspaceMcpServer(o,"user")}async installFromGallery(e,t){if(t=t??{},t.target===5||hw(t.target)){let n=t.target===5?this.workspaceContextService.getWorkspace().configuration:t.target.toResource(RD[zv]);if(!n)throw new Error(`Illegal target: ${t.target}`);t.mcpResource=n;let r=await this.workspaceMcpManagementService.installFromGallery(e,t);return this.toWorkspaceMcpServer(r,"workspace")}if(t.target===4){if(!this.remoteMcpManagementService)throw new Error(`Illegal target: ${t.target}`);t.mcpResource=await this.getRemoteMcpResource(t.mcpResource);let n=await this.remoteMcpManagementService.installFromGallery(e,t);return this.toWorkspaceMcpServer(n,"remoteUser")}if(t.target&&t.target!==2&&t.target!==3)throw new Error(`Illegal target: ${t.target}`);t.mcpResource||(t.mcpResource=this.userDataProfileService.currentProfile.mcpResource);let o=await this.mcpManagementService.installFromGallery(e,t);return this.toWorkspaceMcpServer(o,"user")}async updateMetadata(e,t,o){if(e.scope==="workspace"){let r=await this.workspaceMcpManagementService.updateMetadata(e,t,o);return this.toWorkspaceMcpServer(r,"workspace")}if(e.scope==="remoteUser"){if(!this.remoteMcpManagementService)throw new Error(`Illegal target: ${e.scope}`);let r=await this.remoteMcpManagementService.updateMetadata(e,t,o);return this.toWorkspaceMcpServer(r,"remoteUser")}let n=await this.mcpManagementService.updateMetadata(e,t,o);return this.toWorkspaceMcpServer(n,"user")}async uninstall(e){if(e.scope==="workspace")return this.workspaceMcpManagementService.uninstall(e);if(e.scope==="remoteUser"){if(!this.remoteMcpManagementService)throw new Error(`Illegal target: ${e.scope}`);return this.remoteMcpManagementService.uninstall(e)}return this.mcpManagementService.uninstall(e,{mcpResource:this.userDataProfileService.currentProfile.mcpResource})}async getRemoteMcpResource(e){if(!e&&this.userDataProfileService.currentProfile.isDefault)return;e=e??this.userDataProfileService.currentProfile.mcpResource;let t=this.userDataProfilesService.profiles.find(o=>this.uriIdentityService.extUri.isEqual(o.mcpResource,e));return t?t=await this.remoteUserDataProfilesService.getRemoteProfile(t):t=(await this.remoteUserDataProfilesService.getRemoteProfiles()).find(o=>this.uriIdentityService.extUri.isEqual(o.mcpResource,e)),t?.mcpResource}};ZFe=I([m(1,vM),m(2,se),m(3,ln),m(4,ht),m(5,Pe),m(6,bo),m(7,an),m(8,GA),m(9,F)],ZFe);var Jnt=class extends qge{constructor(i,e,t,o,n,r,s){super(i,e,t,o,n,r,s)}async installFromGallery(i,e){this.logService.trace("MCP Management Service: installGallery",i.name,i.galleryUrl),this._onInstallMcpServer.fire({name:i.name,mcpResource:this.mcpResource});try{let t=e?.packageType??i.configuration.packages?.[0]?.registryType??"remote",{mcpServerConfiguration:o,notices:n}=this.getMcpServerConfigurationFromManifest(i.configuration,t);n.length>0&&this.logService.warn(`MCP Management Service: Warnings while installing ${i.name}`,n);let r={name:i.name,config:{...o.config,gallery:i.galleryUrl??!0,version:i.version},inputs:o.inputs};await this.mcpResourceScannerService.addMcpServers([r],this.mcpResource,this.target),await this.updateLocal();let s=(await this.getInstalled()).find(l=>l.name===i.name);if(!s)throw new Error(`Failed to install MCP server: ${i.name}`);return s}catch(t){throw this._onDidInstallMcpServers.fire([{name:i.name,source:i,error:t,mcpResource:this.mcpResource}]),t}}updateMetadata(){throw new Error("Not supported")}installFromUri(){throw new Error("Not supported")}async getLocalServerInfo(i,e){if(!e.gallery)return;let[t]=await this.mcpGalleryService.getMcpServersFromGallery([{name:i}]);if(t)return{name:t.name,version:e.version,displayName:t.displayName,description:t.description,galleryUrl:t.galleryUrl,manifest:t.configuration,publisher:t.publisher,publisherDisplayName:t.publisherDisplayName,repositoryUrl:t.repositoryUrl,icon:t.icon}}canInstall(i){throw new Error("Not supported")}};Jnt=I([m(2,sG),m(3,fe),m(4,ht),m(5,se),m(6,mee)],Jnt);var Znt=class extends eq{constructor(e,t,o,n,r){super(e,o);this.uriIdentityService=t;this.workspaceContextService=n;this.instantiationService=r;this._onInstallMcpServer=this._register(new E);this.onInstallMcpServer=this._onInstallMcpServer.event;this._onDidInstallMcpServers=this._register(new E);this.onDidInstallMcpServers=this._onDidInstallMcpServers.event;this._onDidUpdateMcpServers=this._register(new E);this.onDidUpdateMcpServers=this._onDidUpdateMcpServers.event;this._onUninstallMcpServer=this._register(new E);this.onUninstallMcpServer=this._onUninstallMcpServer.event;this._onDidUninstallMcpServer=this._register(new E);this.onDidUninstallMcpServer=this._onDidUninstallMcpServer.event;this.allMcpServers=[];this.workspaceMcpManagementServices=new gt;this.initialize()}async initialize(){try{await this.onDidChangeWorkbenchState(),await this.onDidChangeWorkspaceFolders({added:this.workspaceContextService.getWorkspace().folders,removed:[],changed:[]}),this._register(this.workspaceContextService.onDidChangeWorkspaceFolders(e=>this.onDidChangeWorkspaceFolders(e))),this._register(this.workspaceContextService.onDidChangeWorkbenchState(e=>this.onDidChangeWorkbenchState()))}catch(e){this.logService.error("Failed to initialize workspace folders",e)}}async onDidChangeWorkbenchState(){this.workspaceConfiguration&&await this.removeWorkspaceService(this.workspaceConfiguration),this.workspaceConfiguration=this.workspaceContextService.getWorkspace().configuration,this.workspaceConfiguration&&await this.addWorkspaceService(this.workspaceConfiguration,5)}async onDidChangeWorkspaceFolders(e){try{await Promise.allSettled(e.removed.map(t=>this.removeWorkspaceService(t.toResource(RD[zv]))))}catch(t){this.logService.error(t)}try{await Promise.allSettled(e.added.map(t=>this.addWorkspaceService(t.toResource(RD[zv]),6)))}catch(t){this.logService.error(t)}}async addWorkspaceService(e,t){if(this.workspaceMcpManagementServices.has(e))return;let o=new N,n=o.add(this.instantiationService.createInstance(Jnt,e,t));try{let r=await n.getInstalled();if(this.allMcpServers.push(...r),r.length>0){let s=r.map(l=>({name:l.name,local:l,mcpResource:l.mcpResource}));this._onDidInstallMcpServers.fire(s)}}catch(r){this.logService.warn("Failed to get installed servers from",e.toString(),r)}o.add(n.onInstallMcpServer(r=>this._onInstallMcpServer.fire(r))),o.add(n.onDidInstallMcpServers(r=>{for(let{local:s}of r)s&&this.allMcpServers.push(s);this._onDidInstallMcpServers.fire(r)})),o.add(n.onDidUpdateMcpServers(r=>{for(let{local:s,mcpResource:l}of r)if(s){let c=this.allMcpServers.findIndex(u=>this.uriIdentityService.extUri.isEqual(u.mcpResource,l)&&u.name===s.name);c!==-1&&this.allMcpServers.splice(c,1,s)}this._onDidUpdateMcpServers.fire(r)})),o.add(n.onUninstallMcpServer(r=>this._onUninstallMcpServer.fire(r))),o.add(n.onDidUninstallMcpServer(r=>{let s=this.allMcpServers.findIndex(l=>this.uriIdentityService.extUri.isEqual(l.mcpResource,r.mcpResource)&&l.name===r.name);s!==-1&&(this.allMcpServers.splice(s,1),this._onDidUninstallMcpServer.fire(r))})),this.workspaceMcpManagementServices.set(e,{service:n,dispose:()=>o.dispose()})}async removeWorkspaceService(e){let t=this.workspaceMcpManagementServices.get(e);if(t){try{let o=await t.service.getInstalled();this.allMcpServers=this.allMcpServers.filter(n=>!o.some(r=>this.uriIdentityService.extUri.isEqual(r.mcpResource,n.mcpResource)));for(let n of o)this._onDidUninstallMcpServer.fire({name:n.name,mcpResource:n.mcpResource})}catch(o){this.logService.warn("Failed to get installed servers from",e.toString(),o)}this.workspaceMcpManagementServices.delete(e),t.dispose()}}async getInstalled(){return this.allMcpServers}async install(e,t){if(!t?.mcpResource)throw new Error("MCP resource is required");let o=this.workspaceMcpManagementServices.get(t?.mcpResource);if(!o)throw new Error(`No MCP management service found for resource: ${t?.mcpResource.toString()}`);return o.service.install(e,t)}async uninstall(e,t){let o=e.mcpResource,n=this.workspaceMcpManagementServices.get(o);if(!n)throw new Error(`No MCP management service found for resource: ${o.toString()}`);return n.service.uninstall(e,t)}installFromGallery(e,t){if(!t?.mcpResource)throw new Error("MCP resource is required");let o=this.workspaceMcpManagementServices.get(t?.mcpResource);if(!o)throw new Error(`No MCP management service found for resource: ${t?.mcpResource.toString()}`);return o.service.installFromGallery(e,t)}updateMetadata(){throw new Error("Not supported")}dispose(){this.workspaceMcpManagementServices.forEach(e=>e.dispose()),this.workspaceMcpManagementServices.clear(),super.dispose()}};Znt=I([m(0,vM),m(1,ht),m(2,se),m(3,Pe),m(4,F)],Znt);var ert={2:{title:d(11816,null),placeholder:d(11815,null),pickLabel:d(11833,null),pickDescription:d(11834,null),enabledConfigKey:null},3:{title:d(11820,null),placeholder:d(11819,null),pickLabel:d(11837,null),pickDescription:d(11838,null),enabledConfigKey:null},4:{title:d(11818,null),placeholder:d(11817,null),pickLabel:d(11835,null),pickDescription:d(11836,null),enabledConfigKey:"chat.mcp.assisted.nuget.enabled"},5:{title:d(11800,null),placeholder:d(11799,null),pickLabel:d(11828,null),pickDescription:d(11829,null),enabledConfigKey:null}};var e0e=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v){this.workspaceFolder=i;this._quickInputService=e;this._mcpManagementService=t;this._workspaceService=o;this._environmentService=n;this._commandService=r;this._mcpRegistry=s;this._openerService=l;this._editorService=c;this._fileService=u;this._notificationService=p;this._telemetryService=h;this._mcpService=g;this._label=f;this._configurationService=v}async getServerType(){let i=[{kind:0,label:d(11825,null),description:d(11826,null)},{kind:1,label:d(11830,null),description:d(11831,null)}],e;try{e=await this._commandService.executeCommand("github.copilot.chat.mcp.setup.check")}catch{}if(e){i.unshift({type:"separator",label:d(11832,null)});let n=Object.entries(ert).map(([r,{pickLabel:s,pickDescription:l,enabledConfigKey:c}])=>{if(!(c&&!(this._configurationService.getValue(c)??!1)))return{kind:Number(r),label:s,description:l}}).filter(r=>!!r);i.push({type:"separator",label:d(11827,null)},...n)}i.push({type:"separator"});let t=this._configurationService.getValue(Kee);t&&typeof t=="object"&&$Me.some(n=>!t[n])&&i.push({kind:"discovery",label:d(11824,null)}),i.push({kind:"browse",label:d(11823,null)});let o=await this._quickInputService.pick(i,{placeHolder:d(11839,null)});if(o?.kind==="browse"){this._commandService.executeCommand("workbench.mcp.browseServers");return}if(o?.kind==="discovery"){this._commandService.executeCommand("workbench.action.openSettings",Kee);return}return o?.kind}async getStdioConfig(){let i=await this._quickInputService.input({title:d(11797,null),placeHolder:d(11796,null),ignoreFocusLost:!0});if(!i)return;this._telemetryService.publicLog2("mcp.addserver",{packageType:"stdio"});let e=i.match(/(?:[^\s"]+|"[^"]*")+/g);return{type:"stdio",command:e[0].replace(/"/g,""),args:e.slice(1).map(t=>t.replace(/"/g,""))}}async getSSEConfig(){let i=await this._quickInputService.input({title:d(11850,null),placeHolder:d(11849,null),ignoreFocusLost:!0});if(i)return this._telemetryService.publicLog2("mcp.addserver",{packageType:"sse"}),{url:i,type:"http"}}async getServerId(i=`my-mcp-server-${xt().split("-")[0]}`){return await this._quickInputService.input({title:d(11822,null),placeHolder:d(11821,null),value:i,ignoreFocusLost:!0})}async getConfigurationTarget(){let i=[{target:3,label:d(11844,null),description:d(11845,null)}],e=this._environmentService.remoteAuthority&&this._label.getHostLabel(Q.vscodeRemote,this._environmentService.remoteAuthority);e&&i.push({target:4,label:d(11842,null),description:d(11840,null,e)});let t=this._workspaceService.getWorkbenchState();if(t!==1){let n=t===2?this._workspaceService.getWorkspace().folders[0]:5;this._environmentService.remoteAuthority?i.push({target:n,label:d(11846,null),description:d(11848,null,e)}):i.push({target:n,label:d(11846,null),description:d(11847,null)})}return i.length===1?i[0].target:(await this._quickInputService.pick(i,{title:d(11843,null),placeHolder:d(11841,null)}))?.target}async getAssistedConfig(i){let e=await this._quickInputService.input({ignoreFocusLost:!0,title:ert[i].title,placeHolder:ert[i].placeholder});if(!e)return;let t;(g=>(g.Retry="retry",g.Cancel="cancel",g.Allow="allow",g.OpenUri="openUri"))(t||={});let o=new N,n=o.add(this._quickInputService.createQuickPick());n.title=d(11814,null),n.busy=!0,n.ignoreFocusOut=!0;let r=this.getPackageType(i);this._telemetryService.publicLog2("mcp.addserver",{packageType:r}),this._commandService.executeCommand("github.copilot.chat.mcp.setup.validatePackage",{type:r,name:e,targetConfig:{...Qet,properties:{...Qet.properties,name:{type:"string",description:"Suggested name of the server, alphanumeric and hyphen only"}},required:[...Qet.required||[],"name"]}}).then(c=>{if(!c||c.state==="error"){n.title=c?.error||"Unknown error loading package";let u=[];c?.helpUri&&u.push({id:"openUri",label:c.helpUriLabel??d(11801,null),helpUri:A.parse(c.helpUri)}),u.push({id:"retry",label:d(11802,null)},{id:"cancel",label:d(11789,null)}),n.items=u}else n.title=d(11798,null,c.name??e,c.version?`@${c.version}`:"",c.publisher),n.items=[{id:"allow",label:d(11788,null)},{id:"cancel",label:d(11789,null)}];n.busy=!1});let s=await new Promise(c=>{o.add(n.onDidAccept(()=>c(n.selectedItems[0]))),o.add(n.onDidHide(()=>c(void 0))),n.show()}).finally(()=>o.dispose());switch(s?.id){case"retry":return this.getAssistedConfig(i);case"openUri":s.helpUri&&this._openerService.open(s.helpUri);return;case"allow":break;default:return}let l=await this._commandService.executeCommand("github.copilot.chat.mcp.setup.flow",{name:e,type:r});if(l?.type==="mapped")return{name:l.name,server:l.server,inputs:l.inputs};if(l?.type==="assisted"||!l?.type)return l;os(l?.type)}showOnceDiscovered(i){let e=new N;e.add(be(t=>{let o=this._mcpRegistry.collections.read(t),n=this._mcpService.servers.read(t),r=d_(o,l=>d_(l.serverDefinitions.read(t),c=>c.label===i?{server:c,collection:l}:void 0)),s=r&&n.find(l=>l.definition.id===r.server.id);r&&s&&(r.collection.presentation?.origin?this._editorService.openEditor({resource:r.collection.presentation.origin,options:{selection:r.server.presentation?.origin?.range,preserveFocus:!0}}):this._commandService.executeCommand("workbench.mcp.serverOptions",i),s.start({promptType:"all-untrusted"}).then(l=>{l.state===dr.Kind.Error&&s.showOutput()}),e.dispose())})),e.add(tn(()=>e.dispose(),5e3))}async run(){let i=await this.getServerType();if(i===void 0)return;let e,t,o,n;switch(i){case 0:e=await this.getStdioConfig();break;case 1:e=await this.getSSEConfig();break;case 2:case 3:case 4:case 5:{let c=await this.getAssistedConfig(i);e=c?.server?{...c.server,type:"stdio"}:void 0,t=c?.name,o=c?.inputs,n=c?.inputValues;break}default:os(i)}if(!e)return;let r=await this.getServerId(t);if(!r)return;let s=this.workspaceFolder;if(!s&&(s=await this.getConfigurationTarget(),!s))return;if(await this._mcpManagementService.install({name:r,config:e,inputs:o},{target:s}),n)for(let[c,u]of Object.entries(n))await this._mcpRegistry.setSavedInput(c,(hw(s)?6:s)??5,u);let l=this.getPackageType(i);l&&this._telemetryService.publicLog2("mcp.addserver.completed",{packageType:l,serverType:e.type,target:s===5?"workspace":"user"}),this.showOnceDiscovered(r)}async pickForUrlHandler(i,e=!1){let t=decodeURIComponent(He(i)).replace(/\.json$/,""),o=d(11795,null,t),n=[{id:"install",label:d(11794,null)},{id:"show",label:d(11793,null,t)},{id:"rename",label:d(11792,null,t)},{id:"cancel",label:d(11789,null)}];e&&([n[0],n[1]]=[n[1],n[0]]);let r=await this._quickInputService.pick(n,{placeHolder:o,ignoreFocusLost:!0}),s=()=>this._editorService.findEditors(i);switch(r?.id){case"show":await this._editorService.openEditor({resource:i});break;case"install":await this._editorService.save(s());try{let l=await this._fileService.readFile(i),{inputs:c,...u}=zT(l.value.toString());await this._mcpManagementService.install({name:t,config:u,inputs:c}),this._editorService.closeEditors(s()),this.showOnceDiscovered(t)}catch(l){this._notificationService.error(d(11790,null,t,l.message)),await this._editorService.openEditor({resource:i})}break;case"rename":{let l=await this._quickInputService.input({placeHolder:d(11791,null),value:t});if(l){let c=i.with({path:`/${encodeURIComponent(l)}.json`});return await this._editorService.save(s()),await this._fileService.move(i,c),this.pickForUrlHandler(c,e)}break}}}getPackageType(i){switch(i){case 2:return"npm";case 3:return"pip";case 4:return"nuget";case 5:return"docker";case 0:return"stdio";case 1:return"sse";default:return}}};e0e=I([m(1,Ue),m(2,bQ),m(3,Pe),m(4,At),m(5,ge),m(6,Lc),m(7,Je),m(8,ee),m(9,fe),m(10,Ne),m(11,Te),m(12,_s),m(13,rt),m(14,B)],e0e);var t0e=class{constructor(i,e,t,o,n,r){this._fileDialogService=i;this._fileService=e;this._quickInputService=t;this._notificationService=o;this._mcpManagementService=n;this._logService=r}async run(){let i=await this._fileDialogService.showOpenDialog({title:d(11813,null),filters:[{name:d(11803,null),extensions:["json"]}],canSelectFiles:!0,canSelectMany:!1,openLabel:d(11807,null)});if(!i?.[0])return;let e=i[0],t;try{let c=await this._fileService.readFile(e);t=zT(c.value.toString())}catch(c){this._notificationService.error(d(11809,null,c.message));return}if(!t||typeof t!="object"){this._notificationService.error(d(11805,null));return}let o=t,n;if(Array.isArray(o.packages)&&o.packages.length>0)n=o.packages[0].registryType;else if(Array.isArray(o.remotes)&&o.remotes.length>0)n="remote";else{this._notificationService.error(d(11806,null));return}let r,s;try{let{mcpServerConfiguration:c,notices:u}=this._mcpManagementService.getMcpServerConfigurationFromManifest(o,n);r=c.config,s=c.inputs,u.length>0&&this._logService.warn(`MCP Management Service: Warnings while installing the MCP server from ${e.path}`,u)}catch(c){this._notificationService.error(d(11808,null,c.message));return}let l=o.name;if(!(!l&&(l=await this._quickInputService.input({title:d(11811,null),placeHolder:d(11810,null),value:He(e).replace(/\.json$/i,""),ignoreFocusLost:!0}),!l)))try{await this._mcpManagementService.install({name:l,config:r,inputs:s}),this._notificationService.info(d(11812,null,l))}catch(c){this._notificationService.error(d(11804,null,c.message))}}};t0e=I([m(0,rn),m(1,fe),m(2,Ue),m(3,Ne),m(4,bQ),m(5,se)],t0e);var i0e=class extends x{constructor(e,t){super();this.delegate=e;this.logService=t;this._models=new G$;this._modelsToDispose=new Set;this._pendingDisposals=new Set;this._onDidDisposeModel=this._register(new E);this.onDidDisposeModel=this._onDidDisposeModel.event;this._onDidCreateModel=this._register(new E);this.onDidCreateModel=this._onDidCreateModel.event;let o=this;this._refCollection=new class extends uC{createReferencedObject(n,r){return o.createReferencedObject(n,r)}destroyReferencedObject(n,r){return o.destroyReferencedObject(n,r)}}}get observable(){return this._models.observable}values(){return this._models.values()}get(e){return this._models.get(this.toKey(e))}has(e){return this._models.has(this.toKey(e))}acquireExisting(e){let t=this.toKey(e);if(this._models.has(t))return this._refCollection.acquire(t)}acquireOrCreate(e){return this._refCollection.acquire(this.toKey(e.sessionResource),e)}createReferencedObject(e,t){this._modelsToDispose.delete(e);let o=this._models.get(e);if(o)return o;if(!t)throw new Error(`No start session props provided for chat session ${e}`);this.logService.trace(`Creating chat session ${e}`);let n=this.delegate.createModel(t);if(n.sessionResource.toString()!==e)throw new Error(`Chat session key mismatch for ${e}`);return this._models.set(e,n),this._onDidCreateModel.fire(n),n}destroyReferencedObject(e,t){this._modelsToDispose.add(e);let o=this.doDestroyReferencedObject(e,t);this._pendingDisposals.add(o),o.finally(()=>{this._pendingDisposals.delete(o)})}async doDestroyReferencedObject(e,t){try{await this.delegate.willDisposeModel(t)}catch(o){this.logService.error(o)}finally{this._modelsToDispose.has(e)&&(this.logService.trace(`Disposing chat session ${e}`),this._models.delete(e),this._onDidDisposeModel.fire(t),t.dispose()),this._modelsToDispose.delete(e)}}async waitForModelDisposals(){await Promise.all(this._pendingDisposals)}toKey(e){return e.toString()}dispose(){super.dispose(),this._models.forEach(e=>e.dispose())}};i0e=I([m(1,se)],i0e);var o0e=class{constructor(i){this.telemetryService=i}notifyUserAction(i){i.action.kind==="vote"?this.telemetryService.publicLog2("interactiveSessionVote",{direction:i.action.direction===1?"up":"down",agentId:i.agentId??"",command:i.command}):i.action.kind==="copy"?this.telemetryService.publicLog2("interactiveSessionCopy",{copyKind:i.action.copyKind===1?"action":"toolbar",agentId:i.agentId??"",command:i.command}):i.action.kind==="insert"?this.telemetryService.publicLog2("interactiveSessionInsert",{newFile:!!i.action.newFile,agentId:i.agentId??"",command:i.command}):i.action.kind==="apply"?this.telemetryService.publicLog2("interactiveSessionApply",{newFile:!!i.action.newFile,codeMapper:i.action.codeMapper,agentId:i.agentId??"",command:i.command,editsProposed:!!i.action.editsProposed}):i.action.kind==="runInTerminal"?this.telemetryService.publicLog2("interactiveSessionRunInTerminal",{languageId:i.action.languageId??"",agentId:i.agentId??"",command:i.command}):i.action.kind==="followUp"?this.telemetryService.publicLog2("chatFollowupClicked",{agentId:i.agentId??"",command:i.command}):i.action.kind==="chatEditingHunkAction"&&this.telemetryService.publicLog2("chatEditHunk",{agentId:i.agentId??"",outcome:i.action.outcome,lineCount:i.action.lineCount,hasRemainingEdits:i.action.hasRemainingEdits})}retrievedFollowups(i,e,t){this.telemetryService.publicLog2("chatFollowupsRetrieved",{agentId:i,command:e,numFollowups:t})}};o0e=I([m(0,Te)],o0e);function orn(a){let i=a.split(`
`),e=[],t;for(let o=0;o<i.length;o++){let n=i[o];if(t)new RegExp(`^\\s*${t.delimiter}\\s*$`).test(n)&&(e.push(t.languageId),t=void 0);else{let r=n.match(/^(\s*)(`{3,}|~{3,})(\w*)/);r&&(t={delimiter:r[2],languageId:r[3]})}}return e}var n0e=class{constructor(i,e,t){this.opts=i;this.telemetryService=e;this.languageModelsService=t;this.isComplete=!1}complete({timeToFirstProgress:i,totalTime:e,result:t,requestType:o,request:n,detectedAgent:r}){this.isComplete||(this.isComplete=!0,this.telemetryService.publicLog2("interactiveSessionProviderInvoked",{timeToFirstProgress:i,totalTime:e,result:t,requestType:o,agent:r?.id??this.opts.agent.id,agentExtensionId:r?.extensionId.value??this.opts.agent.extensionId.value,slashCommand:this.opts.agentSlashCommandPart?this.opts.agentSlashCommandPart.command.name:this.opts.commandPart?.slashCommand.command,chatSessionId:ap(this.opts.sessionResource),enableCommandDetection:this.opts.enableCommandDetection,isParticipantDetected:!!r,location:this.opts.location,citations:n.response?.codeCitations.length??0,numCodeBlocks:orn(n.response?.response.toString()??"").length,attachmentKinds:this.attachmentKindsForTelemetry(n.variableData),model:this.resolveModelId(this.opts.options?.userSelectedModelId),permissionLevel:this.opts.options?.modeInfo?.kind==="ask"?void 0:this.opts.options?.modeInfo?.permissionLevel,chatMode:this.opts.options?.modeInfo?.modeName??this.opts.options?.modeInfo?.modeId,sessionType:this.opts.sessionResource.scheme}))}attachmentKindsForTelemetry(i){return i.variables.map(e=>e.kind==="implicit"?"implicit":e.range?e.kind==="tool"?"toolInPrompt":e.kind==="toolset"?"toolsetInPrompt":"fileInPrompt":e.kind==="command"?"command":e.kind==="symbol"?"symbol":bk(e)?"image":e.kind==="directory"?"directory":e.kind==="tool"?"tool":e.kind==="toolset"?"toolset":A.isUri(e.value)?"file":lf(e.value)?"location":"otherAttachment")}resolveModelId(i){return i&&this.languageModelsService.lookupLanguageModel(i)?.id}};n0e=I([m(1,Te),m(2,ds)],n0e);function GSo(a,i){if(a.message=i+a.message,a.stack){let e=a.stack.indexOf(`
`);a.stack=e!==-1?`${a.name}: ${a.message}${a.stack.slice(e)}`:`${a.name}: ${a.message}`}}function qSo(a,i){if(a instanceof Error){let e=typeof i=="number"?`[${i}]`:`.${i}`,t=!a.message.startsWith("[")&&!a.message.startsWith(".");GSo(a,e+(t?": ":""))}throw a}function CRi(a){return{kind:0,extract:i=>i,equals:a??((i,e)=>i===e)}}function v2t(a){return{kind:1,extract:i=>{let e=i;return e&&typeof e=="object"&&(e=JSON.parse(JSON.stringify(e))),e},equals:a??((i,e)=>i===e)}}function r0e(a){return{kind:2,itemSchema:a,extract:i=>i?.map((e,t)=>{try{return a.extract(e)}catch(o){qSo(o,t)}})}}function roe(a,i){let e=Object.entries(a).sort(([,t],[,o])=>t.kind-o.kind);return{kind:3,children:e,sealed:i?.sealed,extract:t=>{if(nr(t))return t;let o=Object.create(null);for(let[n,r]of e)try{o[n]=r.extract(t)}catch(s){qSo(s,n)}return o}}}function hN(a,i){return{...i,extract:e=>i.extract(a(e))}}function gd(a,i){let e=v2t(i);return{...e,extract:t=>e.extract(a(t))}}var nrn=qe.fromString(`
`),f2t=class{constructor(i,e=512){this._transform=i;this._compactAfterEntries=e;this._entryCount=0}createInitial(i){return this.createInitialFromSerialized(this._transform.extract(i))}createInitialFromSerialized(i){this._previous=i,this._entryCount=1;let e={kind:0,v:i};return qe.fromString(JSON.stringify(e)+`
`)}read(i){let e,t=0,o=0,n=i.byteLength;for(;o<n;){let r=i.indexOf(nrn,o);if(r===-1&&(r=n),r>o){let s=i.slice(o,r);if(s.byteLength>0){t++;let l=JSON.parse(s.toString());switch(l.kind){case 0:e=l.v;break;case 1:this._applySet(e,l.k,l.v);break;case 2:this._applyPush(e,l.k,l.v,l.i);break;case 3:this._applySet(e,l.k,void 0);break;default:os(l)}}}o=r+1}if(t===0)throw new Error("Empty log file");return this._previous=e,this._entryCount=t,e}write(i){let e=this._transform.extract(i);if(!this._previous||this._entryCount>this._compactAfterEntries){this._previous=e,this._entryCount=1;let r={kind:0,v:e};return{op:"replace",data:qe.fromString(JSON.stringify(r)+`
`)}}let t=[],o=[];try{this._diff(this._transform,o,this._previous,e,t)}catch(r){if(r instanceof Error){let s=o.map(l=>typeof l=="number"?`[${l}]`:`.${l}`).join("")||"<root>";GSo(r,`error diffing at ${s}: `)}throw r}if(t.length===0)return{op:"append",data:qe.fromString("")};this._entryCount+=t.length,this._previous=e;let n="";for(let r of t)n+=JSON.stringify(r)+`
`;return{op:"append",data:qe.fromString(n)}}_applySet(i,e,t){if(e.length===0)return;let o=i;for(let n=0;n<e.length-1;n++)o=o[e[n]];o[e[e.length-1]]=t}_applyPush(i,e,t,o){let n=i;for(let l=0;l<e.length-1;l++)n=n[e[l]];let r=e[e.length-1],s=n[r]||[];o!==void 0&&(s.length=o),t&&t.length>0&&s.push(...t),n[r]=s}_diff(i,e,t,o,n){if(i.kind===0||i.kind===1)i.equals(t,o)||n.push({kind:1,k:e.slice(),v:o});else if(nr(t)||nr(o))t!==o&&(o===void 0?n.push({kind:3,k:e.slice()}):o===null?n.push({kind:1,k:e.slice(),v:null}):n.push({kind:1,k:e.slice(),v:o}));else if(i.kind===2)this._diffArray(i,e,t,o,n);else if(i.kind===3)this._diffObject(i.children,e,t,o,n,i.sealed);else throw new Error(`Unknown transform kind ${JSON.stringify(i)}`)}_diffObject(i,e,t,o,n,r){let s=t,l=o,c=0;for(;c<i.length;c++){let[u,p]=i[c];if(p.kind!==0)break;if(!p.equals(s?.[u],l[u])){n.push({kind:1,k:e.slice(),v:o});return}}if(!(r&&r(t,!0)&&r(o,!1)))for(;c<i.length;c++){let[u,p]=i[c];e.push(u),this._diff(p,e,s?.[u],l[u],n),e.pop()}}_diffArray(i,e,t,o,n){let r=t||[],s=o||[],l=i.itemSchema,c=Math.min(r.length,s.length);if(l.kind===3){let u=l.children;for(let p=0;p<c;p++){let h=r[p],g=s[p];if(this._hasKeyMismatch(u,h,g)){let f=s.slice(p);n.push({kind:2,k:e.slice(),v:f.length>0?f:void 0,i:p});return}e.push(p),this._diffObject(u,e,h,g,n,l.sealed),e.pop()}s.length>r.length?n.push({kind:2,k:e.slice(),v:s.slice(r.length)}):s.length<r.length&&n.push({kind:2,k:e.slice(),i:s.length})}else{let u=-1;for(let p=0;p<c;p++)if(!l.equals(r[p],s[p])){u=p;break}if(u===-1)s.length>r.length?n.push({kind:2,k:e.slice(),v:s.slice(r.length)}):s.length<r.length&&n.push({kind:2,k:e.slice(),i:s.length});else{let p=s.slice(u);n.push({kind:2,k:e.slice(),v:p.length>0?p:void 0,i:u})}}}_hasKeyMismatch(i,e,t){let o=e,n=t;for(let[r,s]of i){if(s.kind!==0)break;if(!s.equals(o?.[r],n[r]))return!0}return!1}};var srn=a=>{let i=a;return i&&typeof i.toJSON=="function"?i.toJSON():a},arn=gd(a=>a.kind==="markdownContent"?a.content:srn(a),(a,i)=>{if(Ar(a)&&Ar(i))return a.value===i.value;if(No(a,{kind:!0})&&No(i,{kind:!0})){if(a.kind!==i.kind)return!1;switch(a.kind){case"markdownContent":return a.content===i.content;case"toolInvocationSerialized":case"elicitationSerialized":case"progressTaskSerialized":case"textEditGroup":case"multiDiffData":case"mcpServersStarting":case"thinking":return eo(a,i);case"clearToPreviousToolInvocation":case"codeblockUri":case"command":case"confirmation":case"extensions":case"hook":case"inlineReference":case"markdownVuln":case"notebookEditGroup":case"progressMessage":case"pullRequest":case"questionCarousel":case"undoStop":case"warning":case"treeData":case"workspaceEdit":case"disabledClaudeHooks":return a.kind===i.kind;default:return eo(a,i)}}return!1}),lrn=(a,i)=>Qe(A.from(a),A.from(i)),crn=roe({text:gd(a=>a.text),parts:gd(a=>a.parts,(a,i)=>a.length===i.length&&a.every((e,t)=>e.text===i[t].text))}),drn=roe({uri:gd(a=>a.uri,lrn),eventKind:gd(a=>a.eventKind)}),urn=roe({variables:hN(a=>a.variables.map(aD.toExport),r0e(v2t((a,i)=>a.name===i.name)))}),$So=roe({requestId:hN(a=>a.id,CRi()),timestamp:gd(a=>a.timestamp),confirmation:gd(a=>a.confirmation),message:hN(a=>a.message,crn),shouldBeRemovedOnSend:gd(a=>a.shouldBeRemovedOnSend,eo),agent:gd(a=>a.response?.agent,(a,i)=>a?.id===i?.id),modelId:gd(a=>a.modelId),editedFileEvents:hN(a=>a.editedFileEvents,r0e(drn)),variableData:hN(a=>a.variableData,urn),isHidden:gd(()=>{}),isCanceled:gd(()=>{}),response:hN(a=>a.response?.entireResponse.value,r0e(arn)),responseId:gd(a=>a.response?.id),result:gd(a=>a.response?.result,eo),responseMarkdownInfo:gd(a=>a.response?.codeBlockInfos?.map(i=>({suggestionId:i.suggestionId})),eo),followups:gd(a=>a.response?.followups,eo),modelState:gd(a=>a.response?.stateT,eo),vote:gd(a=>a.response?.vote),slashCommand:hN(a=>a.response?.slashCommand,v2t((a,i)=>a?.name===i?.name)),usedContext:gd(a=>a.response?.usedContext,eo),contentReferences:gd(a=>a.response?.contentReferences,eo),codeCitations:gd(a=>a.response?.codeCitations,eo),timeSpentWaiting:gd(a=>a.response?.timestamp),modeInfo:gd(a=>a.modeInfo,eo)},{sealed:a=>a.modelState?.value===2||a.modelState?.value===3||a.modelState?.value===1}),prn=roe({attachments:gd(a=>a.attachments.map(aD.toExport),eo),mode:gd(a=>a.mode,(a,i)=>a.id===i.id),selectedModel:gd(a=>a.selectedModel,(a,i)=>a?.identifier===i?.identifier),inputText:gd(a=>a.inputText),selections:gd(a=>a.selections,eo),permissionLevel:gd(a=>a.permissionLevel),contrib:gd(a=>a.contrib,eo)}),mrn=roe({id:hN(a=>a.request.id,CRi()),request:hN(a=>a.request,$So),kind:gd(a=>a.kind),sendOptions:gd(a=>fao(a.sendOptions),eo)}),hrn=roe({version:gd(()=>3),creationDate:gd(a=>a.timestamp),customTitle:gd(a=>a.hasCustomTitle?a.title:void 0),initialLocation:gd(a=>a.initialLocation),inputState:hN(a=>a.inputModel.toJSON(),prn),responderUsername:gd(a=>a.responderUsername),sessionId:gd(a=>a.sessionId),requests:hN(a=>a.getRequests(),r0e($So)),hasPendingEdits:gd(a=>a.editingSession?.entries.get().some(i=>i.state.get()===0)),repoData:gd(a=>a.repoData,eo),pendingRequests:hN(a=>a.getPendingRequests(),r0e(mrn))}),SQ=class extends f2t{constructor(){super(hrn,1024)}};var jSo=50,b2t="chat.ChatSessionStore.index",xRi="ChatSessionStore.transferIndex",soe=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this.fileService=e;this.environmentService=t;this.logService=o;this.workspaceContextService=n;this.telemetryService=r;this.storageService=s;this.lifecycleService=l;this.userDataProfilesService=c;this.configurationService=u;this.workspaceEditingService=p;this.dialogService=h;this.openerService=g;this.storeQueue=new rm;this.shuttingDown=!1;this._didReportIssue=!1;let f=this.workspaceContextService.getWorkspace(),v=!f.configuration&&f.folders.length===0,b=this.workspaceContextService.getWorkspace().id;this.storageRoot=v?Ge(this.userDataProfilesService.defaultProfile.globalStorageHome,"emptyWindowChatSessions"):Ge(this.environmentService.workspaceStorageHome,b,"chatSessions"),this.previousEmptyWindowStorageRoot=v?Ge(this.environmentService.workspaceStorageHome,"no-workspace","chatSessions"):void 0,this.transferredSessionStorageRoot=Ge(this.userDataProfilesService.defaultProfile.globalStorageHome,"transferredChatSessions"),this._register(this.workspaceEditingService.onDidEnterWorkspace(S=>{let y=this.storeQueue.queue(()=>this.handleWorkspaceTransition(S.oldWorkspace,S.newWorkspace));S.join(y)})),this._register(this.lifecycleService.onWillShutdown(S=>{this.shuttingDown=!0,this.storeTask&&S.join(this.storeTask,{id:"join.chatSessionStore",label:d(8249,null)})}))}async handleWorkspaceTransition(e,t){let o=Yj(e),n=Yj(t),r=e.id,s=t.id;this.logService.info(`ChatSessionStore: Workspace transition from ${r} to ${s}`);let l=o?Ge(this.userDataProfilesService.defaultProfile.globalStorageHome,"emptyWindowChatSessions"):Ge(this.environmentService.workspaceStorageHome,r,"chatSessions"),c=n?Ge(this.userDataProfilesService.defaultProfile.globalStorageHome,"emptyWindowChatSessions"):Ge(this.environmentService.workspaceStorageHome,s,"chatSessions");if(Qe(l,c)){this.storageRoot=c;return}this.storageRoot=c,await this.migrateSessionsToNewWorkspace(l,o,n)}async migrateSessionsToNewWorkspace(e,t,o){try{if(!await this.fileService.exists(e)){this.logService.info("ChatSessionStore: Old storage location does not exist, skipping migration");return}let r=await this.fileService.resolve(e);if(!r.children){this.logService.info("ChatSessionStore: No children in old storage location, skipping migration");return}this.logService.info(`ChatSessionStore: Found ${r.children.length} files in old storage location`);let s=0;for(let l of r.children)if(!l.isDirectory&&(l.name.endsWith(".json")||l.name.endsWith(".jsonl"))){let c=l.resource,u=Ge(this.storageRoot,l.name);try{await this.fileService.copy(c,u,!1),s++}catch(p){Au(p)===4?this.logService.trace(`ChatSessionStore: Session file ${l.name} already exists at target, skipping`):this.reportError("sessionMigration",`Error migrating chat session file ${l.name}`,p)}}this.logService.info(`ChatSessionStore: Copied ${s} chat session files from ${t?"empty window":e.toString()} to ${o?"empty window":this.storageRoot.toString()} (originals preserved at old location)`),this.indexCache=void 0;try{await this.flushIndex()}catch(l){this.reportError("migrateWorkspace","Error flushing chat session index after workspace migration",l)}}catch(n){this.reportError("migrateWorkspace","Error migrating chat sessions to new workspace",n)}}async storeSessions(e){if(!this.shuttingDown)try{this.storeTask=this.storeQueue.queue(async()=>{try{await Promise.all(e.map(t=>this.writeSession(t))),await this.trimEntries(),await this.flushIndex()}catch(t){this.reportError("storeSessions","Error storing chat sessions",t)}}),await this.storeTask}finally{this.storeTask=void 0}}async storeSessionsMetadataOnly(e){if(!this.shuttingDown)try{this.storeTask=this.storeQueue.queue(async()=>{try{await Promise.all(e.map(t=>this.writeSessionMetadataOnly(t))),await this.flushIndex()}catch(t){this.reportError("storeSessions","Error storing chat sessions",t)}}),await this.storeTask}finally{this.storeTask=void 0}}async storeTransferSession(e,t){let o=this.getTransferredSessionIndex(),n=e.toWorkspace.toString(),r=o[n];if(r)try{let s=A.revive(r.sessionResource);if(s&&Jr.parseLocalSessionId(s)){let l=this.getTransferredSessionStorageLocation(s);await this.fileService.del(l)}}catch(s){Au(s)!==1&&this.reportError("storeTransferSession","Error deleting old transferred session file",s)}try{let s=JSON.stringify(t,void 0,2),l=this.getTransferredSessionStorageLocation(t.sessionResource);await this.fileService.writeFile(l,qe.fromString(s))}catch(s){this.reportError("sessionWrite","Error writing chat session",s);return}o[n]=e;try{this.storageService.store(xRi,o,0,1)}catch(s){this.reportError("storeTransferSession","Error storing chat transfer session",s)}}getTransferredSessionIndex(){try{return this.storageService.getObject(xRi,0,{})}catch(e){return this.reportError("getTransferredSessionIndex","Error reading chat transfer index",e),{}}}static{this.TRANSFER_EXPIRATION_MS=60*1e3*5}getTransferredSessionData(){try{let e=this.getTransferredSessionIndex(),t=this.workspaceContextService.getWorkspace().folders;if(t.length!==1)return;let o=t[0].uri.toString(),n=e[o];if(!n)return;let r=$n(n);if(Date.now()-n.timestampInMilliseconds>soe.TRANSFER_EXPIRATION_MS){this.logService.info("ChatSessionStore: Transferred session has expired"),this.cleanupTransferredSession(r.sessionResource);return}return!!Jr.parseLocalSessionId(r.sessionResource)&&r.sessionResource}catch(e){this.reportError("getTransferredSession","Error getting transferred chat session URI",e);return}}async readTransferredSession(e){try{let t=this.getTransferredSessionStorageLocation(e),o=Jr.parseLocalSessionId(e);if(!o)return;let n=await this.readSessionFromLocation(t,void 0,o);return await this.cleanupTransferredSession(e),n}catch(t){this.reportError("getTransferredSession","Error getting transferred chat session",t);return}}async cleanupTransferredSession(e){try{let t=this.getTransferredSessionIndex(),o=this.workspaceContextService.getWorkspace().folders;if(o.length===1){let r=o[0].uri.toString();delete t[r],this.storageService.store(xRi,t,0,1)}let n=this.getTransferredSessionStorageLocation(e);await this.fileService.del(n)}catch(t){Au(t)!==1&&this.reportError("cleanupTransferredSession","Error cleaning up transferred session",t)}}async writeSession(e){try{let t=this.internalGetIndex(),o=this.getStorageLocation(e.sessionId);if(o.log)if(e instanceof Ef){e.dataSerializer||(e.dataSerializer=new SQ);let r,s;try{({op:r,data:s}=e.dataSerializer.write(e))}catch(l){throw this._didReportIssue||(this._didReportIssue=!0,this.dialogService.prompt({custom:!0,title:d(8247,null),message:d(8248,null,l.stack||xn(l)),buttons:[{label:d(8251,null),run:()=>this.openerService.open("https://github.com/microsoft/vscode/issues/new?template=bug_report.md")}]})),l}s.byteLength>0&&await this.fileService.writeFile(o.log,s,{append:r==="append"})}else{let r=new SQ().createInitialFromSerialized(e);await this.fileService.writeFile(o.log,r)}else await this.fileService.writeFile(o.flat,qe.fromString(JSON.stringify(e)));let n=await QSo(e);t.entries[e.sessionId]=n}catch(t){this.reportError("sessionWrite","Error writing chat session",t)}}async writeSessionMetadataOnly(e){if(!Jr.parseLocalSessionId(e.sessionResource))try{let t=this.internalGetIndex(),o=e.sessionResource.toString();t.entries[o]=await QSo(e)}catch(t){this.reportError("sessionMetadataWrite","Error writing chat session metadata",t)}}async flushIndex(){let e=this.internalGetIndex();try{this.storageService.store(b2t,e,this.getIndexStorageScope(),1)}catch(t){this.reportError("indexWrite","Error writing index",t)}}getIndexStorageScope(){let e=this.workspaceContextService.getWorkspace();return!e.configuration&&e.folders.length===0?-1:1}async trimEntries(){let e=this.internalGetIndex(),t=Object.entries(e.entries).filter(([o,n])=>!n.isExternal).sort((o,n)=>n[1].lastMessageDate-o[1].lastMessageDate).map(([o])=>o);if(t.length>jSo){let o=t.slice(jSo);for(let n of o)delete e.entries[n];this.logService.trace(`ChatSessionStore: Trimmed ${o.length} old chat sessions from index`)}}async internalDeleteSession(e){let t=this.internalGetIndex();if(!t.entries[e])return;let o=this.getStorageLocation(e);for(let n of[o.flat,o.log]){try{n&&await this.fileService.del(n)}catch(r){Au(r)!==1&&this.reportError("sessionDelete","Error deleting chat session",r)}delete t.entries[e]}}hasSessions(){return Object.keys(this.internalGetIndex().entries).length>0}isSessionEmpty(e){return this.internalGetIndex().entries[e]?.isEmpty??!0}async deleteSession(e){await this.storeQueue.queue(async()=>{await this.internalDeleteSession(e),await this.flushIndex()})}async clearAllSessions(){await this.storeQueue.queue(async()=>{let e=this.internalGetIndex(),t=Object.keys(e.entries);this.logService.info(`ChatSessionStore: Clearing ${t.length} chat sessions`),await Promise.all(t.map(o=>this.internalDeleteSession(o))),await this.flushIndex()})}async setSessionTitle(e,t){await this.storeQueue.queue(async()=>{let o=this.internalGetIndex();o.entries[e]&&(o.entries[e].title=t)})}reportError(e,t,o){let n=o&&Au(o);n===1?this.logService.trace("ChatSessionStore: "+t,xn(o)):this.logService.error("ChatSessionStore: "+t,xn(o)),this.telemetryService.publicLog2("chatSessionStoreError",{reason:e,fileOperationReason:n??-1})}internalGetIndex(){if(this.indexCache)return this.indexCache;let e=this.storageService.get(b2t,this.getIndexStorageScope(),void 0);if(!e)return this.indexCache={version:1,entries:{}},this.indexCache;try{let t=JSON.parse(e);frn(t)?this.indexCache=t:(this.reportError("invalidIndexFormat",`Invalid index format: ${e}`),this.indexCache={version:1,entries:{}})}catch(t){this.reportError("invalidIndexJSON",`Index corrupt: ${e}`,t),this.indexCache={version:1,entries:{}}}for(let t of Object.values(this.indexCache.entries))t.timing??={created:t.lastMessageDate,lastRequestStarted:void 0,lastRequestEnded:t.lastMessageDate},t.lastResponseState??=t.lastResponseState===0||t.lastResponseState===4?1:t.lastResponseState||1;return this.indexCache}async getIndex(){return this.storeQueue.queue(async()=>this.internalGetIndex().entries)}getMetadataForSessionSync(e){return this.internalGetIndex().entries[this.getIndexKey(e)]}getIndexKey(e){return Jr.parseLocalSessionId(e)??e.toString()}logIndex(){let e=this.storageService.get(b2t,this.getIndexStorageScope(),void 0);this.logService.info("ChatSessionStore index: ",e)}async migrateDataIfNeeded(e){await this.storeQueue.queue(async()=>{if(!this.storageService.get(b2t,this.getIndexStorageScope(),void 0)){let n=e();n&&await this.migrate(n)}})}async migrate(e){let t=Object.keys(e).length;this.logService.info(`ChatSessionStore: Migrating ${t} chat sessions from storage service to file system`),await Promise.all(Object.values(e).map(async o=>{await this.writeSession(o)})),await this.flushIndex()}async readSession(e){return await this.storeQueue.queue(async()=>{let t=this.getStorageLocation(e);return this.readSessionFromLocation(t.flat,t.log,e)})}async readSessionFromLocation(e,t,o){let n=e,r;if(t)try{r=(await this.fileService.readFile(t)).value,n=t}catch(s){this.reportError("sessionReadFile",`Error reading log chat session file ${o}`,s)}if(!r)try{r=(await this.fileService.readFile(e)).value,n=e}catch(s){this.reportError("sessionReadFile",`Error reading flat chat session file ${o}`,s),Au(s)===1&&this.previousEmptyWindowStorageRoot&&(r=await this.readSessionFromPreviousLocation(o))}if(r)try{let s,l=new SQ;n===t?s=$n(l.read(r)):s=$n(JSON.parse(r.toString()));for(let c of s.requests)Array.isArray(c.response)?c.response=c.response.map(u=>typeof u=="string"?new Ie(u):u):typeof c.response=="string"&&(c.response=[new Ie(c.response)]);return{value:pOt(s),serializer:l}}catch(s){this.reportError("malformedSession",`Malformed session data in ${n.fsPath}: [${r.slice(0,20).toString()}${r.byteLength>20?"...":""}]`,s);return}}async readSessionFromPreviousLocation(e){let t;if(this.previousEmptyWindowStorageRoot){let o=Ge(this.previousEmptyWindowStorageRoot,`${e}.json`);try{t=(await this.fileService.readFile(o)).value,this.logService.info(`ChatSessionStore: Read chat session ${e} from previous location`)}catch(n){this.reportError("sessionReadFile",`Error reading chat session file ${e} from previous location`,n);return}}return t}getStorageLocation(e){return{flat:Ge(this.storageRoot,`${e}.json`),log:this.configurationService.getValue("chat.useLogSessionStorage")!==!1?Ge(this.storageRoot,`${e}.jsonl`):void 0}}getTransferredSessionStorageLocation(e){let t=Jr.parseLocalSessionId(e);return Ge(this.transferredSessionStorageRoot,`${t}.json`)}getChatStorageFolder(){return this.storageRoot}};soe=I([m(0,fe),m(1,Eo),m(2,se),m(3,Pe),m(4,Te),m(5,ce),m(6,ji),m(7,an),m(8,B),m(9,Db),m(10,at),m(11,Je)],soe);function grn(a){return!!a&&typeof a=="object"&&typeof a.sessionId=="string"&&typeof a.title=="string"&&typeof a.lastMessageDate=="number"}function frn(a){if(typeof a!="object"||a===null)return!1;let i=a;if(i.version!==1||typeof i.entries!="object"||i.entries===null)return!1;for(let e in i.entries)if(!grn(i.entries[e]))return!1;return!0}async function QSo(a){let i=a.customTitle||(a instanceof Ef?a.title:void 0),e;a instanceof Ef&&(e=await aOt(a));let t=a instanceof Ef?a.lastMessageDate:a.requests.at(-1)?.timestamp??a.creationDate,o=a instanceof Ef?a.timing:{created:a.creationDate,lastRequestStarted:a.requests.at(-1)?.timestamp,lastRequestEnded:t},n=a instanceof Ef?a.lastRequest?.response?.state??1:1;return(n===0||n===4)&&(n=2),{sessionId:a.sessionId,title:i||d(8250,null),lastMessageDate:t,timing:o,initialLocation:a.initialLocation,hasPendingEdits:a instanceof Ef?a.editingSession?.entries.get().some(r=>r.state.get()===0):!1,isEmpty:a instanceof Ef?a.getRequests().length===0:a.requests.length===0,stats:e,isExternal:a instanceof Ef&&!Jr.parseLocalSessionId(a.sessionResource),lastResponseState:n,permissionLevel:a instanceof Ef?a.inputModel.state.get()?.permissionLevel:void 0}}async function YSo(a,i){for(let e of a.folders){let t=await i.resolve(e.uri);if(t.children&&t.children.length>0)return!1}return!0}var a0e=le("chatTransferService"),trt="chat.transferedWorkspaces",s0e=class{constructor(i,e,t,o){this.workspaceService=i;this.storageService=e;this.fileService=t;this.workspaceTrustManagementService=o}deleteWorkspaceFromTransferredList(i){let t=this.storageService.getObject(trt,0,[]).filter(o=>o!==i.toString());this.storageService.store(trt,t,0,1)}addWorkspaceToTransferred(i){let e=this.storageService.getObject(trt,0,[]);e.push(i.toString()),this.storageService.store(trt,e,0,1)}async checkAndSetTransferredWorkspaceTrust(){let i=this.workspaceService.getWorkspace(),e=i.folders[0]?.uri;e&&this.isChatTransferredWorkspace(e,this.storageService)&&await YSo(i,this.fileService)&&(await this.workspaceTrustManagementService.setWorkspaceTrust(!0),this.deleteWorkspaceFromTransferredList(e))}isChatTransferredWorkspace(i,e){return i?e.getObject(trt,0,[]).some(o=>o.toString()===i.toString()):!1}};s0e=I([m(0,Pe),m(1,ce),m(2,fe),m(3,Nr)],s0e);var vrn="interactive.sessions",aoe=class{constructor(i,e,t,o,n){this.cancellationTokenSource=i;this.requestId=e;this.responseCompletePromise=t;this.sendOptions=o;this.toolsService=n;this._yieldRequested=Me(this,!1)}get yieldRequested(){return this._yieldRequested}dispose(){this.requestId&&this.toolsService.cancelToolCallsForRequest(this.requestId),this.cancellationTokenSource.dispose()}cancel(){this.requestId&&this.toolsService.cancelToolCallsForRequest(this.requestId),this.cancellationTokenSource.cancel()}setYieldRequested(){this._yieldRequested.set(!0,void 0)}resetYieldRequested(){this._yieldRequested.set(!1,void 0)}};aoe=I([m(4,Vn)],aoe);var l0e=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super();this.storageService=e;this.logService=t;this.telemetryService=o;this.extensionService=n;this.instantiationService=r;this.workspaceContextService=s;this.chatSlashCommandService=l;this.chatAgentService=c;this.configurationService=u;this.chatTransferService=p;this.chatSessionService=h;this.mcpService=g;this.promptsService=f;this.chatEntitlementService=v;this.languageModelsService=b;this.chatDebugService=S;this._pendingRequests=this._register(new Xb);this._queuedRequestDeferreds=new Map;this._saveModelsEnabled=!0;this._onDidSubmitRequest=this._register(new E);this.onDidSubmitRequest=this._onDidSubmitRequest.event;this._onDidPerformUserAction=this._register(new E);this.onDidPerformUserAction=this._onDidPerformUserAction.event;this._onDidReceiveQuestionCarouselAnswer=this._register(new E);this.onDidReceiveQuestionCarouselAnswer=this._onDidReceiveQuestionCarouselAnswer.event;this._onDidDisposeSession=this._register(new E);this.onDidDisposeSession=this._onDidDisposeSession.event;this._sessionFollowupCancelTokens=this._register(new Xb);this._sessionModels=this._register(r.createInstance(i0e,{createModel:w=>this._startSession(w),willDisposeModel:async w=>{let k=Jr.parseLocalSessionId(w.sessionResource);k&&this.shouldStoreSession(w)?w.getRequests().length===0&&!w.customTitle?await this._chatSessionStore.deleteSession(k):this._saveModelsEnabled&&await this._chatSessionStore.storeSessions([w]):!k&&w.getRequests().length>0&&await this._chatSessionStore.storeSessionsMetadataOnly([w])}})),this._register(this._sessionModels.onDidDisposeModel(w=>{vhi(w.sessionResource),this.chatDebugService.endSession(w.sessionResource),this._onDidDisposeSession.fire({sessionResources:[w.sessionResource],reason:"cleared"})})),this._chatServiceTelemetry=this.instantiationService.createInstance(o0e),this._chatSessionStore=this._register(this.instantiationService.createInstance(soe)),this._chatSessionStore.migrateDataIfNeeded(()=>this.migrateData());let y=this._chatSessionStore.getTransferredSessionData();y&&(this.trace("constructor",`Transferred session ${y}`),this._transferredSessionResource=y),this.reviveSessionsWithEdits(),this._register(e.onWillSaveState(()=>this.saveState())),this.chatModels=ke(this,w=>[...this._sessionModels.observable.read(w).values()]),this.requestInProgressObs=ke(w=>{let k=this._sessionModels.observable.read(w).values();return vt.some(k,T=>T.requestInProgress.read(w))})}get transferredSessionResource(){return this._transferredSessionResource}get onDidCreateModel(){return this._sessionModels.onDidCreateModel}setSaveModelsEnabled(e){this._saveModelsEnabled=e}waitForModelDisposals(){return this._sessionModels.waitForModelDisposals()}get isEmptyWindow(){let e=this.workspaceContextService.getWorkspace();return!e.configuration&&e.folders.length===0}get editingSessions(){return[...this._sessionModels.values()].map(e=>e.editingSession).filter(lo)}isEnabled(e){return this.chatAgentService.getContributedDefaultAgent(e)!==void 0}migrateData(){let e=this.storageService.get(vrn,this.isEmptyWindow?-1:1,"");if(e){let t=this.deserializeChats(e),o=Object.keys(t).length;return o>0&&this.info("migrateData",`Restored ${o} persisted sessions`),t}}saveState(){if(!this._saveModelsEnabled)return;let e=Array.from(this._sessionModels.values()).filter(o=>this.shouldStoreSession(o));this._chatSessionStore.storeSessions(e);let t=Array.from(this._sessionModels.values()).filter(o=>!Jr.parseLocalSessionId(o.sessionResource));this._chatSessionStore.storeSessionsMetadataOnly(t)}shouldStoreSession(e){return Jr.parseLocalSessionId(e.sessionResource)?e.initialLocation==="panel"&&!e.isImported:!1}notifyUserAction(e){if(this._chatServiceTelemetry.notifyUserAction(e),this._onDidPerformUserAction.fire(e),e.action.kind==="chatEditingSessionAction"){let t=this._sessionModels.get(e.sessionResource);t&&t.notifyEditingAction(e.action)}}notifyQuestionCarouselAnswer(e,t,o){this._onDidReceiveQuestionCarouselAnswer.fire({requestId:e,resolveId:t,answers:o})}async setChatSessionTitle(e,t){let o=this._sessionModels.get(e);o&&o.setCustomTitle(t);let n=Jr.parseLocalSessionId(e);n&&(await this._chatSessionStore.setSessionTitle(n,t),this.saveState())}trace(e,t){t?this.logService.trace(`ChatService#${e}: ${t}`):this.logService.trace(`ChatService#${e}`)}info(e,t){t?this.logService.info(`ChatService#${e}: ${t}`):this.logService.info(`ChatService#${e}`)}error(e,t){this.logService.error(`ChatService#${e} ${t}`)}deserializeChats(e){try{let t=$n(JSON.parse(e));if(!Array.isArray(t))throw new Error("Expected array");return t.reduce((n,r)=>{for(let s of r.requests)Array.isArray(s.response)?s.response=s.response.map(l=>typeof l=="string"?new Ie(l):l):typeof s.response=="string"&&(s.response=[new Ie(s.response)]);return n[r.sessionId]=pOt(r),n},{})}catch(t){return this.error("deserializeChats",`Malformed session data: ${t}. [${e.substring(0,20)}${e.length>20?"...":""}]`),{}}}async reviveSessionsWithEdits(){let e=await this._chatSessionStore.getIndex();await Promise.all(Object.values(e).map(async t=>{if(!t.hasPendingEdits)return;let o;if(t.sessionId.includes(":"))try{o=A.parse(t.sessionId,!0)}catch{}o??=Jr.forSession(t.sessionId);let n=await this.acquireOrLoadSession(o,"panel",Se.None);n?.object.editingSession&&(await b4(n.object.editingSession),n.dispose())}))}async getLocalSessionHistory(){let e=await this.getLiveSessionItems(),t=await this.getHistorySessionItems();return[...e,...t]}async getLiveSessionItems(){return await Promise.all(Array.from(this._sessionModels.values()).filter(e=>this.shouldBeInHistory(e)).map(kRi))}async getHistorySessionItems(){let e=await this._chatSessionStore.getIndex();return Object.values(e).filter(t=>!t.isExternal).filter(t=>!this._sessionModels.has(Jr.forSession(t.sessionId))&&t.initialLocation==="panel"&&!t.isEmpty).map(t=>{let o=Jr.forSession(t.sessionId);return{...t,sessionResource:o,isActive:this._sessionModels.has(o)}})}async getMetadataForSession(e){let o=(await this._chatSessionStore.getIndex())[e.toString()];if(o)return{...o,sessionResource:e,isActive:this._sessionModels.has(e)}}shouldBeInHistory(e){return!e.isImported&&!!Jr.parseLocalSessionId(e.sessionResource)&&e.initialLocation==="panel"}async removeHistoryEntry(e){await this._chatSessionStore.deleteSession(this.toLocalSessionId(e)),this._onDidDisposeSession.fire({sessionResources:[e],reason:"cleared"})}async clearAllHistoryEntries(){await this._chatSessionStore.clearAllSessions()}startNewLocalSession(e,t){this.trace("startNewLocalSession");let o=Jr.forSession(xt());return this._sessionModels.acquireOrCreate({initialData:void 0,location:e,sessionResource:o,canUseTools:t?.canUseTools??!0,disableBackgroundKeepAlive:t?.disableBackgroundKeepAlive})}_startSession(e){let{initialData:t,location:o,sessionResource:n,canUseTools:r,transferEditingSession:s,disableBackgroundKeepAlive:l,inputState:c}=e,u=this.instantiationService.createInstance(Ef,t,{initialLocation:o,canUseTools:r,resource:n,disableBackgroundKeepAlive:l,inputState:c});return o==="panel"&&u.startEditingSession(!0,s),this.initializeSession(u),u}initializeSession(e){this.trace("initializeSession",`Initialize session ${e.sessionResource}`),this.activateDefaultAgent(e.initialLocation).catch(t=>this.logService.error(t))}async activateDefaultAgent(e){await this.extensionService.whenInstalledExtensionsRegistered();let t=this.chatAgentService.getContributedDefaultAgent(e)??this.chatAgentService.getContributedDefaultAgent("panel");if(!t)throw new pa("No default agent contributed");if(t.isCore||await this.extensionService.activateById(t.extensionId,{activationEvent:`onChatParticipant:${t.id}`,extensionId:t.extensionId,startup:!1}),!this.chatAgentService.getActivatedAgents().find(n=>n.id===t.id))throw new pa("No default agent registered")}getSession(e){return this._sessionModels.get(e)}acquireExistingSession(e){return this._sessionModels.acquireExisting(e)}async acquireOrRestoreLocalSession(e){this.trace("acquireOrRestoreSession",`${e}`);let t=this.acquireExistingSession(e);if(t)return t;let o;if(Qe(this.transferredSessionResource,e))this._transferredSessionResource=void 0,o=await this._chatSessionStore.readTransferredSession(e);else{let r=Jr.parseLocalSessionId(e);r&&(o=await this._chatSessionStore.readSession(r))}return o?this._sessionModels.acquireOrCreate({initialData:o,location:o.value.initialLocation??"panel",sessionResource:e,canUseTools:!0}):void 0}getSessionTitle(e){if(Jr.parseLocalSessionId(e))return this._sessionModels.get(e)?.title??this._chatSessionStore.getMetadataForSessionSync(e)?.title}loadSessionFromData(e){let t=e.sessionId??xt(),o=Jr.forSession(t);return this._sessionModels.acquireOrCreate({initialData:{value:e,serializer:new SQ},location:e.initialLocation??"panel",sessionResource:o,canUseTools:!0})}async acquireOrLoadSession(e,t,o){return e.scheme===Q.vscodeLocalChatSession?this.acquireOrRestoreLocalSession(e):this.loadRemoteSession(e,t,o)}async loadRemoteSession(e,t,o){{let S=this.acquireExistingSession(e);if(S)return S}if(!await this.chatSessionService.canResolveChatSession(e.scheme))return;let n=await this.chatSessionService.getOrCreateChatSession(e,o);{let S=this.acquireExistingSession(e);if(S)return n.dispose(),S}let r=gl(e),s=this.chatSessionService.getChatSessionContribution(r),l=fd(n.history.filter(S=>S.type==="request"),S=>S.modelId)?.modelId,c=fd(n.history.filter(S=>S.type==="request"),S=>S.modeInstructions?.uri)?.modeInstructions?.uri,u=this._chatSessionStore.getMetadataForSessionSync(e)?.permissionLevel,p;if((l||c)&&s?.useRequestToPopulateBuiltInPickers){let S=c?{kind:"agent",id:c.toString()}:{kind:"agent",id:Tl.Agent.id},y=l?this.languageModelsService.lookupLanguageModel(l):void 0,w=l&&y?{identifier:l,metadata:y}:void 0;p={serializer:new SQ,value:{creationDate:Date.now(),initialLocation:void 0,customTitle:void 0,requests:[],responderUsername:"",sessionId:"",version:3,hasPendingEdits:void 0,inputState:{attachments:[],contrib:{},inputText:"",mode:S,selectedModel:w,selections:[],permissionLevel:u},pendingRequests:void 0,repoData:void 0}}}let h=this._sessionModels.acquireOrCreate({initialData:p,location:t,sessionResource:e,canUseTools:!1,transferEditingSession:n.transferredState?.editingSession,inputState:n.transferredState?.inputState});u&&!p&&h.object.inputModel.setState({permissionLevel:u}),h.object.setContributedChatSession({chatSessionResource:e}),n.title&&h.object.setCustomTitle(n.title);let g=h.object,f=new N;f.add(h.object.onDidDispose(()=>{f.dispose(),n.dispose()}));let v;for(let S of n.history)if(S.type==="request"){v&&v.response?.complete();let y=S.prompt,w={text:y,parts:[new Pv(new pi(0,y.length),{startLineNumber:1,startColumn:1,endLineNumber:1,endColumn:y.length+1},y)]},k=S.participant?this.chatAgentService.getAgent(S.participant):this.chatAgentService.getAgent(r),T=S.modeInstructions?{kind:"agent",isBuiltin:S.modeInstructions.isBuiltin??!1,modeInstructions:S.modeInstructions,modeId:"custom",applyCodeBlockSuggestionId:void 0}:void 0;v=g.addRequest(w,S.variableData??{variables:[]},0,T,k,void 0,void 0,void 0,void 0,!1,S.modelId,void 0,S.id)}else if(v)for(let y of S.parts)g.acceptResponseProgress(v,y);if(n.isCompleteObs?.get()&&v?.response?.complete(),n.progressObs&&n.interruptActiveResponseCallback){let S=0,y=f.add(new me),w=T=>T.onCancellationRequested(()=>{n.interruptActiveResponseCallback?.().then(P=>{if(!P){let O=this.instantiationService.createInstance(aoe,new Ye,void 0,void 0,void 0);this._pendingRequests.set(g.sessionResource,O),this.telemetryService.publicLog2(UF,{action:"add",source:"remoteSession",chatSessionId:ap(g.sessionResource)}),y.value=w(O.cancellationTokenSource.token)}})}),k=()=>{if(!this._pendingRequests.has(g.sessionResource)){let T=this.instantiationService.createInstance(aoe,new Ye,void 0,void 0,void 0);this._pendingRequests.set(g.sessionResource,T),this.telemetryService.publicLog2(UF,{action:"add",source:"remoteSession",chatSessionId:ap(g.sessionResource)}),y.value=w(T.cancellationTokenSource.token)}};if(v){let T=this.instantiationService.createInstance(aoe,new Ye,void 0,void 0,void 0);this._pendingRequests.set(g.sessionResource,T),this.telemetryService.publicLog2(UF,{action:"add",source:"remoteSession",chatSessionId:ap(g.sessionResource)}),y.value=w(T.cancellationTokenSource.token)}n.onDidStartServerRequest&&f.add(n.onDidStartServerRequest(({prompt:T})=>{v?.response&&!v.response.isComplete&&v.response.complete();let P=T,O={text:P,parts:[new Pv(new pi(0,P.length),{startLineNumber:1,startColumn:1,endLineNumber:1,endColumn:P.length+1},P)]},V=this.chatAgentService.getAgent(r);v=g.addRequest(O,{variables:[]},0,void 0,V),S=0,k()})),f.add(be(T=>{let P=n.progressObs?.read(T)??[],O=n.isCompleteObs?.read(T)??!1;if(v&&P.length>S){let V=P.slice(S);for(let H of V)g?.acceptResponseProgress(v,H);S=P.length}O&&v&&(v.response?.complete(),y.clear())}))}else this.telemetryService.publicLog2(UF,{action:"notCancelable",source:"remoteSession",chatSessionId:ap(g.sessionResource)}),v&&g.editingSession&&(await b4(g.editingSession),v.response?.complete());return h}getChatSessionFromInternalUri(e){let t=this._sessionModels.get(e);if(!t)return;let{contributedChatSession:o}=t;return o}async resendRequest(e,t){let o=this._sessionModels.get(e.session.sessionResource);if(!o&&o!==e.session)throw new Error(`Unknown session: ${e.session.sessionResource}`);let n=this._pendingRequests.get(e.session.sessionResource);n&&(this.trace("resendRequest",`Session ${e.session.sessionResource} already has a pending request, cancelling...`),n.cancel());let r=t?.location??o.initialLocation,s=t?.attempt??0,l=!t?.noCommandDetection,c=this.chatAgentService.getDefaultAgent(r,t?.modeInfo?.kind);o.removeRequest(e.id,1);let u={...t,locationData:e.locationData,attachedContext:e.attachedContext};await this._sendRequestAsync(o,o.sessionResource,e.message,s,l,c,r,u).responseCompletePromise}queuePendingRequest(e,t,o,n){let r=n.location??e.initialLocation,s=this.parseChatRequest(t,o,r,n),l=new oH({session:e,message:s,variableData:{variables:n.attachedContext??[]},timestamp:Date.now(),modeInfo:n.modeInfo,locationData:n.locationData,attachedContext:n.attachedContext,modelId:n.userSelectedModelId,userSelectedTools:n.userSelectedTools?.get()}),c=new Ko;return this._queuedRequestDeferreds.set(l.id,c),e.addPendingRequest(l,n.queue??"queued",{...n,queue:void 0}),n.queue==="steering"&&this.setYieldRequested(t),this.trace("sendRequest",`Queued message for session ${t}`),{kind:"queued",deferred:c.p}}async sendRequest(e,t,o){if(this.trace("sendRequest",`sessionResource: ${e.toString()}, message: ${t.substring(0,20)}${t.length>20?"[...]":""}}`),!t.trim()&&!o?.slashCommand&&!o?.agentId&&!o?.agentIdSilent)return this.trace("sendRequest","Rejected empty message"),{kind:"rejected",reason:"Empty message"};let n=this._sessionModels.get(e);if(!n)throw new Error(`Unknown session: ${e}`);let r;if(!n.hasRequests&&TK(e)&&gl(e)!==sc){let b=this.parseChatRequest(e,t,o?.location??n.initialLocation,o),S=b.parts.find(T=>T instanceof UC),y=H6e(b).message,w=this.chatSessionService.getSessionOptions(e),k=await this.chatSessionService.createNewChatSessionItem(gl(e),{prompt:y,command:S?.text,initialSessionOptions:w},Se.None);if(k){if(n=(await this.loadRemoteSession(k.resource,n.initialLocation,Se.None))?.object,!n)throw new Error(`Failed to load session for resource: ${k.resource}`);this.chatSessionService.registerSessionResourceAlias(e,k.resource),n.setContributedChatSession({chatSessionResource:k.resource,initialSessionOptions:w}),e=k.resource,r=k.resource}}let s=this._pendingRequests.has(e);if(o?.queue){let b=this.queuePendingRequest(n,e,t,o);return o.pauseQueue||this.processPendingRequests(e),b}else if(s)return this.trace("sendRequest",`Session ${e} already has a pending request`),{kind:"rejected",reason:"Request already in progress"};let l=n.getRequests();for(let b=l.length-1;b>=0;b-=1){let S=l[b];S.shouldBeRemovedOnSend&&(S.shouldBeRemovedOnSend.afterUndoStop?S.response?.finalizeUndoState():await this.removeRequest(e,S.id))}let c=o?.location??n.initialLocation,u=o?.attempt??0,p=this.chatAgentService.getDefaultAgent(c,o?.modeInfo?.kind),h=this.parseChatRequest(e,t,c,o),g=o?.agentIdSilent?this.chatAgentService.getAgent(o.agentIdSilent):void 0,f=g??h.parts.find(b=>b instanceof lp)?.agent??p,v=h.parts.find(b=>b instanceof Xf);return{kind:"sent",newSessionResource:r,data:{...this._sendRequestAsync(n,e,h,u,!o?.noCommandDetection,g??p,c,o),agent:f,slashCommand:v?.command}}}parseChatRequest(e,t,o,n){let r=n?.parserContext;if(n?.agentId){let l=this.chatAgentService.getAgent(n.agentId);if(!l)throw new Error(`Unknown agent: ${n.agentId}`);r={selectedAgent:l,mode:n.modeInfo?.kind};let c=n.slashCommand?` ${Bu}${n.slashCommand}`:"";t=`${zc}${l.name}${c} ${t}`}else if(n?.agentIdSilent&&!r?.forcedAgent){let l=this.chatAgentService.getAgent(n.agentIdSilent);l&&(r={...r,forcedAgent:l})}return this.instantiationService.createInstance(uT).parseChatRequest(e,t,o,r)}refreshFollowupsCancellationToken(e){this._sessionFollowupCancelTokens.get(e)?.cancel();let t=new Ye;return this._sessionFollowupCancelTokens.set(e,t),t.token}_sendRequestAsync(e,t,o,n,r,s,l,c){let u=this.refreshFollowupsCancellationToken(t),p,h=o.parts.find(ae=>ae instanceof lp),g=o.parts.find(ae=>ae instanceof Xf),f=o.parts.find(ae=>ae instanceof UC),v=[...e.getRequests()],b=this.instantiationService.createInstance(n0e,{agent:h?.agent??s,agentSlashCommandPart:g,commandPart:f,sessionResource:e.sessionResource,location:e.initialLocation,options:c,enableCommandDetection:r}),S=!1,y=f?"slashCommand":"string",w=new Ko,k=!1;function T(){!k&&p?.response&&(w.complete(p.response),k=!0)}let P=new N,O=P.add(new Ye),V=O.token,H=async()=>{let ae=De=>{if(!V.isCancellationRequested){S||FF(t,OF.FirstToken),S=!0;for(let Oe=0;Oe<De.length;Oe++){let pt=Oe===De.length-1,et=De[Oe];et.kind==="markdownContent"?this.trace("sendRequest",`Provider returned progress for session ${e.sessionResource}, ${et.content.value.length} chars`):this.trace("sendRequest",`Provider returned progress: ${JSON.stringify(et)}`),p&&e.acceptResponseProgress(p,et,!pt)}T()}},he,oe;{let De=this.configurationService.getValue(BR),Oe=this.configurationService.getValue(eTe);if(!De||!Oe){let pt=g?.command.name===yhi,et=c?.attachedContext?.some(Ti=>{let Ht=aD.toUri(Ti);return Ht&&(Ht.scheme===Heo||Ht.path.includes(sLt))});if(pt||et){p=e.addRequest(o,{variables:[]},n,c?.modeInfo),T();let Ti=[];De||Ti.push("`"+BR+"`"),Oe||Ti.push("`"+eTe+"`");let Ht=!De&&!Oe?BR:De?"@id:"+eTe:"@id:"+BR,zi=encodeURIComponent(JSON.stringify(Ht));e.acceptResponseProgress(p,{kind:"markdownContent",content:new Ie(d(8203,null,yhi,Ti.join(", "),zi),{isTrusted:{enabledCommands:["workbench.action.openSettings"]}})}),e.setResponse(p,{}),p.response?.complete();return}}}let de,Ce=!1;try{let De=await this.promptsService.getHooks(V,e.sessionResource);De&&(de=De.hooks,Ce=De.hasDisabledClaudeHooks)}catch(De){this.logService.warn("[ChatService] Failed to collect hooks:",De)}let xe=c?.modeInfo?.modeInstructions?.name;if(xe)try{let Oe=(await this.promptsService.getCustomAgents(V,e.sessionResource)).find(pt=>pt.name===xe);Oe?.hooks&&(de=CMt(de,Oe.hooks))}catch(De){this.logService.warn("[ChatService] Failed to collect agent hooks:",De)}let ze=new Dn(!1);P.add(V.onCancellationRequested(()=>{this.trace("sendRequest",`Request for session ${e.sessionResource} was cancelled`),p&&(b.complete({timeToFirstProgress:void 0,result:"cancelled",totalTime:ze.elapsed(),requestType:y,detectedAgent:he,request:p}),e.cancelRequest(p))}));try{let De,Oe;if(h||s&&!f){let pt=(mn,hn,yo,Mr,cn)=>{let er={variables:[]};p=Mr??e.addRequest(o,er,n,c?.modeInfo,mn,hn,c?.confirmation,c?.locationData,c?.attachedContext,void 0,c?.userSelectedModelId,c?.userSelectedTools?.get());let Ns,ua;if(Mr)Ns=Mr.variableData,ua=H6e(p.message).message;else{Ns={variables:this.prepareContext(p.attachedContext)},e.updateRequest(p,Ns),c?.resolvedVariables?.length&&(Ns={variables:[...Ns.variables,...c.resolvedVariables]});let Lu=H6e(p.message);Ns=XSi(Ns,Lu.diff),ua=Lu.message}let xm={sessionResource:e.sessionResource,requestId:p.id,agentId:mn.id,message:ua,command:hn?.name,variables:Ns,enableCommandDetection:yo,isParticipantDetected:cn,attempt:n,location:l,locationData:p.locationData,acceptedConfirmationData:c?.acceptedConfirmationData,rejectedConfirmationData:c?.rejectedConfirmationData,userSelectedModelId:c?.userSelectedModelId,modelConfiguration:c?.userSelectedModelId?this.languageModelsService.getModelConfiguration(c.userSelectedModelId):void 0,userSelectedTools:c?.userSelectedTools?.get(),modeInstructions:c?.modeInfo?.modeInstructions,permissionLevel:c?.modeInfo?.permissionLevel,editedFileEvents:p.editedFileEvents,hooks:de,hasHooksEnabled:!!de&&Object.values(de).some(Lu=>Lu.length>0)},tm=!0;return P.add(be(Lu=>{let jg=c?.userSelectedTools?.read(Lu);if(tm){tm=!1;return}jg&&p&&(this.chatAgentService.setRequestTools(mn.id,p.id,jg),xm.userSelectedTools=jg)})),xm};if(this.configurationService.getValue("chat.detectParticipant.enabled")!==!1&&this.chatAgentService.hasChatParticipantDetectionProviders()&&!h&&!f&&!g&&r&&(l!=="editor"||!this.configurationService.getValue("inlineChat.enableV2"))&&c?.modeInfo?.kind!=="agent"&&c?.modeInfo?.kind!=="edit"&&!c?.agentIdSilent){let mn=this.getHistoryEntriesFromModel(v,l,s.id),hn=pt(s,void 0,r,void 0,!1),yo=await this.chatAgentService.detectAgentOrCommand(hn,mn,{location:l},V);yo&&this.chatAgentService.getAgent(yo.agent.id)?.locations?.includes(l)&&(p?.response?.setAgent(yo.agent,yo.command),he=yo.agent,oe=yo.command)}let et=he??h?.agent??s,Ti=oe??g?.command;await this.extensionService.activateByEvent(`onChatParticipant:${et.id}`);let Ht=this.getHistoryEntriesFromModel(v,l,et.id),zi=pt(et,Ti,r,p,!!he);this.generateInitialChatTitleIfNeeded(e,zi,s,V);let Vo=this._pendingRequests.get(t);Vo&&(P.add(be(mn=>{let hn=Vo.yieldRequested.read(mn);p&&this.chatAgentService.setYieldRequested(et.id,p.id,hn)})),Vo.requestId??=zi.requestId,Vo.requestId&&this.telemetryService.publicLog2(UF,{action:"add",source:"sendRequestId",requestId:Vo.requestId,chatSessionId:ap(t)})),T();let sn="chat.disabledClaudeHooks.notification";if(Ce&&!this.storageService.getBoolean(sn,1)&&(this.storageService.store(sn,!0,1,0),ae([{kind:"disabledClaudeHooks"}])),e.canUseTools){let mn=new ILt(this.mcpService.autostart(V));mn.isEmpty||(ae([mn]),await mn.wait())}let _n=await this.chatAgentService.invokeAgent(et.id,zi,ae,Ht,V);De=_n,Oe=this.chatAgentService.getFollowups(et.id,zi,_n,Ht,u)}else if(f&&this.chatSlashCommandService.hasCommand(f.slashCommand.command)){f.slashCommand.silent!==!0&&(p=e.addRequest(o,{variables:[]},n,c?.modeInfo),T());let pt=[];for(let Ht of e.getRequests())Ht.response&&(pt.push({role:1,content:[{type:"text",value:Ht.message.text}]}),pt.push({role:2,content:[{type:"text",value:Ht.response.response.toString()}]}));let et=o.text,Ti=await this.chatSlashCommandService.executeCommand(f.slashCommand.command,et.substring(f.slashCommand.command.length+1).trimStart(),new Mm(Ht=>{ae([Ht])}),pt,l,e.sessionResource,V,c);Oe=Promise.resolve(Ti?.followUp),De={}}else throw new Error("Cannot handle request");if(V.isCancellationRequested&&!De)return;if(p){De||(this.trace("sendRequest",`Provider returned no response for session ${e.sessionResource}`),De={errorDetails:{message:d(8204,null)}});let pt=De.errorDetails?.responseIsFiltered?"filtered":De.errorDetails&&S?"errorWithOutput":De.errorDetails?"error":"success";b.complete({timeToFirstProgress:De.timings?.firstProgress,totalTime:De.timings?.totalElapsed,result:pt,requestType:y,detectedAgent:he,request:p}),e.setResponse(p,De),T(),this.trace("sendRequest",`Provider returned response for session ${e.sessionResource}`),De.errorDetails?.isRateLimited&&this.chatEntitlementService.markAnonymousRateLimited(),G=!De.errorDetails&&!V.isCancellationRequested,p.response?.complete(),Oe&&Oe.then(et=>{e.setFollowups(p,et);let Ti=g?g.command.name:f?.slashCommand.command;this._chatServiceTelemetry.retrievedFollowups(h?.agent.id??"",Ti,et?.length??0)})}else{G=!V.isCancellationRequested;return}}catch(De){if(this.logService.error(`Error while handling chat request: ${xn(De,!0)}`),p){b.complete({timeToFirstProgress:void 0,totalTime:void 0,result:"error",requestType:y,detectedAgent:he,request:p});let Oe={errorDetails:{message:De.message}};e.setResponse(p,Oe),T(),p.response?.complete()}}finally{P.dispose()}},G=!1,$=H(),J=this.instantiationService.createInstance(aoe,O,void 0,$,c);return this._pendingRequests.set(e.sessionResource,J),this.telemetryService.publicLog2(UF,{action:"add",source:"sendRequest",chatSessionId:ap(e.sessionResource)}),$.finally(()=>{FF(t,OF.RequestComplete),vhi(t),this._pendingRequests.get(e.sessionResource)===J&&(this._pendingRequests.deleteAndDispose(e.sessionResource),this.telemetryService.publicLog2(UF,{action:"remove",source:"sendRequestComplete",requestId:J.requestId,chatSessionId:ap(e.sessionResource)})),G&&this.processNextPendingRequest(e)}),c?.userSelectedModelId&&this.languageModelsService.addToRecentlyUsedList(c.userSelectedModelId),this._onDidSubmitRequest.fire({chatSessionResource:e.sessionResource,message:o}),{responseCreatedPromise:w.p,responseCompletePromise:$}}processPendingRequests(e){let t=this._sessionModels.get(e);t&&!this._pendingRequests.has(e)&&this.processNextPendingRequest(t)}_isServerManagedQueue(e){return e.scheme.startsWith("agent-host-")}processNextPendingRequest(e){if(this._isServerManagedQueue(e.sessionResource))return;let t=e.dequeueAllSteeringRequests(),o=t.length===0?e.dequeuePendingRequest():void 0,n=t.length>0?t:o?[o]:[];if(n.length===0)return;this.trace("processNextPendingRequest",`Processing ${n.length} queued request(s) for session ${e.sessionResource}`);let r=[];for(let S of n){let y=this._queuedRequestDeferreds.get(S.request.id);this._queuedRequestDeferreds.delete(S.request.id),y&&r.push(y)}let s=n[0],l={...s.sendOptions,attachedContext:n.flatMap(S=>S.request.variableData.variables.slice())},c=l.location??l.locationData?.type??e.initialLocation,u=this.chatAgentService.getDefaultAgent(c,l.modeInfo?.kind);if(!u){this.logService.warn("processNextPendingRequest",`No default agent for location ${c}`);for(let S of r)S.complete({kind:"rejected",reason:"No default agent available"});return}let p;try{if(n.length>1){let S=n.map(y=>y.request.message.text).join(`

`);p=this.parseChatRequest(e.sessionResource,S,c,{...l,agentId:void 0,slashCommand:void 0})}else p=s.request.message}catch(S){this.logService.error("processNextPendingRequest: failed to parse combined chat request",S);let y=xn(S);for(let w of r)w.complete({kind:"rejected",reason:y});return}let h=l.agentIdSilent?this.chatAgentService.getAgent(l.agentIdSilent):void 0,g=h??p.parts.find(S=>S instanceof lp)?.agent??u,f=p.parts.find(S=>S instanceof Xf),b={kind:"sent",data:{...this._sendRequestAsync(e,e.sessionResource,p,s.request.attempt,!l.noCommandDetection,h??u,c,l),agent:g,slashCommand:f?.command}};for(let S of r)S.complete(b)}generateInitialChatTitleIfNeeded(e,t,o,n){if(e.getRequests().length!==1||e.customTitle)return;let r=[{request:t,response:[],result:{}}];(async()=>{let l=await this.chatAgentService.getChatTitle(o.id,r,n);l&&!e.customTitle&&e.setCustomTitle(l)})()}prepareContext(e){return e??=[],e.sort((t,o)=>!t.range&&!o.range?0:t.range?o.range?o.range.start-t.range.start:-1:1),e}getHistoryEntriesFromModel(e,t,o){let n=[],r=this.chatAgentService.getAgent(o);for(let s of e){if(!s.response||o!==s.response.agent?.id&&!r?.isDefault&&!r?.canAccessPreviousChatHistory||t==="editor")continue;let l=H6e(s.message),c={sessionResource:s.session.sessionResource,requestId:s.id,agentId:s.response.agent?.id??"",message:l.message,command:s.response.slashCommand?.name,variables:XSi(s.variableData,l.diff),location:"panel",editedFileEvents:s.editedFileEvents,modeInstructions:s.modeInfo?.modeInstructions};n.push({request:c,response:gao(s.response.response.value),result:s.response.result??{}})}return n}async removeRequest(e,t){let o=this._sessionModels.get(e);if(!o)throw new Error(`Unknown session: ${e}`);let n=this._pendingRequests.get(e);n?.requestId===t&&(n.cancel(),this._pendingRequests.deleteAndDispose(e),this.telemetryService.publicLog2(UF,{action:"remove",source:"removeRequest",requestId:t,chatSessionId:ap(o.sessionResource)})),o.removeRequest(t)}async adoptRequest(e,t){if(!(t instanceof oH))throw new TypeError("Can only adopt requests of type ChatRequestModel");let o=this._sessionModels.get(e);if(!o)throw new Error(`Unknown session: ${e}`);let n=t.session;if(o.adoptRequest(t),t.response&&!t.response.isComplete){let r=this._pendingRequests.deleteAndLeak(n.sessionResource);r&&(r.requestId=t.id,this._pendingRequests.set(o.sessionResource,r),this.telemetryService.publicLog2(UF,{action:"remove",source:"adoptRequest",requestId:t.id,chatSessionId:ap(n.sessionResource)}),this.telemetryService.publicLog2(UF,{action:"add",source:"adoptRequest",requestId:t.id,chatSessionId:ap(o.sessionResource)}))}}async addCompleteRequest(e,t,o,n,r){this.trace("addCompleteRequest",`message: ${t}`);let s=this._sessionModels.get(e);if(!s)throw new Error(`Unknown session: ${e}`);let l=typeof t=="string"?this.instantiationService.createInstance(uT).parseChatRequest(e,t):t,c=s.addRequest(l,o||{variables:[]},n??0,void 0,void 0,void 0,void 0,void 0,void 0,!0);if(typeof r.message=="string")s.acceptResponseProgress(c,{content:new Ie(r.message),kind:"markdownContent"});else for(let u of r.message)s.acceptResponseProgress(c,u,!0);s.setResponse(c,r.result||{}),r.followups!==void 0&&s.setFollowups(c,r.followups),c.response?.complete()}async cancelCurrentRequestForSession(e,t){this.trace("cancelCurrentRequestForSession",`session: ${e}`);let o=this._pendingRequests.get(e);if(!o){let r=this._sessionModels.get(e),s=r?.requestInProgress.get(),l=r?.getPendingRequests().length??0,c=r?.lastRequest;this.telemetryService.publicLog2(G6e,{source:t??"chatService",reason:"noPendingRequest",requestInProgress:s===void 0?"unknown":s?"true":"false",pendingRequests:l,sessionScheme:e.scheme,lastRequestId:c?.id,chatSessionId:ap(e)}),this.info("cancelCurrentRequestForSession",`No pending request was found for session ${e}. requestInProgress=${s??"unknown"}, pendingRequests=${l}`);return}let n=o.responseCompletePromise;o.cancel(),this._pendingRequests.deleteAndDispose(e),this.telemetryService.publicLog2(UF,{action:"remove",source:t??"cancelRequest",requestId:o.requestId,chatSessionId:ap(e)}),n&&await vp(n,1e3)}setYieldRequested(e){let t=this._pendingRequests.get(e);t&&t.setYieldRequested()}migrateRequests(e,t){let o=this._sessionModels.get(e);if(!o)return;let n=[...o.getPendingRequests()];if(n.length!==0){for(let r of n)this.removePendingRequest(e,r.request.id);for(let r of n)this.sendRequest(t,r.request.message.text,{...r.sendOptions,queue:r.kind})}}removePendingRequest(e,t){let o=this._sessionModels.get(e);o&&(o.removePendingRequest(t),o.getPendingRequests().some(s=>s.kind==="steering")||this._pendingRequests.get(e)?.resetYieldRequested());let n=this._queuedRequestDeferreds.get(t);n&&(n.complete({kind:"rejected",reason:"Request was removed from queue"}),this._queuedRequestDeferreds.delete(t))}setPendingRequests(e,t){let o=this._sessionModels.get(e);o&&o.setPendingRequests(t)}hasSessions(){return this._chatSessionStore.hasSessions()}async transferChatSession(e,t){if(!Jr.isLocalSession(e))throw new Error(`Can only transfer local chat sessions. Invalid session: ${e}`);let o=this._sessionModels.get(e);if(!o)throw new Error(`Failed to transfer session. Unknown session: ${e}`);if(o.initialLocation!=="panel")throw new Error(`Can only transfer chat sessions located in the Chat view. Session ${e} has location=${o.initialLocation}`);await this._chatSessionStore.storeTransferSession({sessionResource:o.sessionResource,timestampInMilliseconds:Date.now(),toWorkspace:t},o),this.chatTransferService.addWorkspaceToTransferred(t),this.trace("transferChatSession",`Transferred session ${o.sessionResource} to workspace ${t.toString()}`)}getChatStorageFolder(){return this._chatSessionStore.getChatStorageFolder()}logChatIndex(){this._chatSessionStore.logIndex()}setSessionTitle(e,t){this._sessionModels.get(e)?.setCustomTitle(t)}appendProgress(e,t){let o=this._sessionModels.get(e.session.sessionResource);if(!(e instanceof oH))throw new li("Can only append progress to requests of type ChatRequestModel");o?.acceptResponseProgress(e,t)}toLocalSessionId(e){let t=Jr.parseLocalSessionId(e);if(!t)throw new Error(`Invalid local chat session resource: ${e}`);return t}};l0e=I([m(0,ce),m(1,se),m(2,Te),m(3,lt),m(4,F),m(5,Pe),m(6,BF),m(7,cr),m(8,B),m(9,a0e),m(10,Us),m(11,_s),m(12,Or),m(13,rr),m(14,ds),m(15,Yp)],l0e);async function kRi(a){let i=a.title||d(8205,null);return{sessionResource:a.sessionResource,title:i,lastMessageDate:a.lastMessageDate,timing:a.timing,isActive:!0,stats:await aOt(a),lastResponseState:a.lastRequest?.response?.state??0}}function S2t(a){return Rn.registerExtensionPoint({extensionPoint:a,jsonSchema:{description:d(8270,null,a),type:"array",items:{additionalProperties:!1,type:"object",defaultSnippets:[{body:{path:a==="chatSkills"?"./relative/path/to/skill-name/SKILL.md":"./relative/path/to/file.md"}}],required:["path"],properties:{path:{description:a==="chatSkills"?d(8268,null):d(8267,null),type:"string"},name:{description:d(8265,null),deprecationMessage:d(8266,null),type:"string"},description:{description:d(8263,null),deprecationMessage:d(8264,null),type:"string"},when:{description:d(8269,null),type:"string"}}}}})}var brn=S2t("chatPromptFiles"),Srn=S2t("chatInstructions"),Irn=S2t("chatAgents"),yrn=S2t("chatSkills");function XSo(a){switch(a){case"chatPromptFiles":return"prompt";case"chatInstructions":return"instructions";case"chatAgents":return"agent";case"chatSkills":return"skill";default:{let i=a;throw new Error(`Unknown contribution point: ${i}`)}}}function JSo(a,i,e){return`${a.value}/${i}/${e}`}var $ge=class{constructor(i){this.promptsService=i;this.registrations=new Vt;this.handle(brn,"chatPromptFiles"),this.handle(Srn,"chatInstructions"),this.handle(Irn,"chatAgents"),this.handle(yrn,"chatSkills")}static{this.ID="workbench.contrib.chatPromptFilesExtensionPointHandler"}handle(i,e){i.setHandler((t,o)=>{for(let n of o.added){let r=XSo(e);for(let s of n.value){if(!s.path){n.collector.error(d(8279,null,n.description.identifier.value,e));continue}let l=Ge(n.description.extensionLocation,s.path);if(!ws(l,n.description.extensionLocation)){n.collector.error(d(8277,null,n.description.identifier.value,e,s.path));continue}if(s.when&&!C.deserialize(s.when)){n.collector.error(d(8278,null,n.description.identifier.value,e,s.path,s.when));continue}try{let c=this.promptsService.registerContributedFile(r,l,n.description,s.name,s.description,s.when);this.registrations.set(JSo(n.description.identifier,r,s.path),c)}catch(c){let u=c instanceof Error?c.message:String(c);n.collector.error(d(8280,null,n.description.identifier.value,e,s.path,u))}}}for(let n of o.removed){let r=XSo(e);for(let s of n.value)this.registrations.deleteAndDispose(JSo(n.description.identifier,r,s.path))}})}};$ge=I([m(0,Or)],$ge);$e.registerCommand("_listExtensionPromptFiles",async a=>{let i=a.get(Or),[e,t,o,n,r]=await Promise.all([i.listPromptFiles("agent",Se.None),i.listPromptFiles("instructions",Se.None),i.listPromptFiles("prompt",Se.None),i.listPromptFiles("skill",Se.None),i.listPromptFiles("hook",Se.None)]),s=[];for(let l of[...e,...t,...o,...n,...r])l.storage==="extension"&&s.push({uri:l.uri.toJSON(),type:l.type,extensionId:l.extension.identifier.value});return s});var c0e=class extends x{constructor(e){super();this.contributionPoint=e;this.type="table"}shouldRender(e){return!!e.contributes?.[this.contributionPoint]}render(e){let t=e.contributes?.[this.contributionPoint]??[];if(!t.length)return{data:{headers:[],rows:[]},dispose:()=>{}};let o=[d(8272,null),d(8271,null),d(8273,null)],n=t.map(r=>[r.name??"-",r.description??"-",r.path]);return{data:{headers:o,rows:n},dispose:()=>{}}}};ne.as(As.ExtensionFeaturesRegistry).registerExtensionFeature({id:"chatPromptFiles",label:d(8275,null),access:{canToggle:!1},renderer:new Ft(c0e,["chatPromptFiles"])});ne.as(As.ExtensionFeaturesRegistry).registerExtensionFeature({id:"chatInstructions",label:d(8274,null),access:{canToggle:!1},renderer:new Ft(c0e,["chatInstructions"])});ne.as(As.ExtensionFeaturesRegistry).registerExtensionFeature({id:"chatAgents",label:d(8262,null),access:{canToggle:!1},renderer:new Ft(c0e,["chatAgents"])});ne.as(As.ExtensionFeaturesRegistry).registerExtensionFeature({id:"chatSkills",label:d(8276,null),access:{canToggle:!1},renderer:new Ft(c0e,["chatSkills"])});var d0e=class{constructor(i){this.promptsService=i}async provideLinks(i,e){let t=this.promptsService.getParsedPromptFile(i);if(!t.body)return;let o=[];for(let n of t.body.fileReferences)if(!n.isMarkdownLink){let r=t.body.resolveFilePath(n.content);r&&o.push({range:n.range,url:r})}return{links:o}}};d0e=I([m(0,Or)],d0e);var u0e=class{constructor(i,e){this.fileService=i;this.languageModelToolsService=e;this._debugDisplayName="PromptBodyAutocompletion";this.triggerCharacters=[":",".","/","\\"]}async provideCompletionItems(i,e,t,o){let n=Mw(i.getLanguageId());if(!n)return;let r=await this.findVariableReference(i,e,o);if(!r)return;let s=[];switch(r.type){case"file":r.contentRange.containsPosition(e)?await this.collectFilePathCompletions(i,e,r.contentRange,s):await this.collectDefaultCompletions(i,r.range,n,s);break;case"tool":r.contentRange.containsPosition(e)?(n==="agent"||n==="prompt")&&await this.collectToolCompletions(i,e,r.contentRange,s):await this.collectDefaultCompletions(i,r.range,n,s);break;default:await this.collectDefaultCompletions(i,r.range,n,s)}return{suggestions:s}}async collectToolCompletions(i,e,t,o){for(let n of this.languageModelToolsService.getFullReferenceNames())o.push({label:n,kind:13,filterText:n,insertText:n,range:t})}async collectFilePathCompletions(i,e,t,o){let n=i.getValueInRange(t.setEndPosition(e.lineNumber,e.column)),r=n.includes("/")||!n.includes("\\")?"/":"\\",s;if(n.match(/[^\/]\.\.$/i))s=n+r;else{let c=n.length-1;for(;c>=0&&![47,92].includes(n.charCodeAt(c));)c--;s=n.substring(0,c+1)}let l={id:"editor.action.triggerSuggest",title:"Suggest"};try{let c=ar.resolvePath(ci(i.uri),s),{children:u}=await this.fileService.resolve(c);if(u)for(let p of u){let h=(s||"."+r)+p.name;o.push({label:p.name+(p.isDirectory?r:""),kind:p.isDirectory?23:20,range:t,insertText:h+(p.isDirectory?r:""),filterText:h,command:p.isDirectory?l:void 0})}}catch{}o.push({label:"..",kind:23,insertText:s+".."+r,range:t,filterText:s+"..",command:l})}async findVariableReference(i,e,t){if(i.getLineContent(1).trimEnd()==="---"){let l=2;for(;l<=i.getLineCount()&&i.getLineContent(l).trimEnd()!=="---";)l++;if(l>=e.lineNumber)return}let o=new RegExp(`${Tu}[^\\s#]*`,"g"),n=Wx(e.column,o,i.getLineContent(e.lineNumber),0);if(!n)return;let r=new z(e.lineNumber,n.startColumn+1,e.lineNumber,n.endColumn),s=n.word.match(/^#(\w+:)?/);if(s){let l=n.startColumn+s[0].length;if(s[1]==="file:")return{type:"file",contentRange:new z(e.lineNumber,l,e.lineNumber,n.endColumn),range:r};if(s[1]==="tool:")return{type:"tool",contentRange:new z(e.lineNumber,l,e.lineNumber,n.endColumn),range:r}}return{type:"",contentRange:r,range:r}}async collectDefaultCompletions(i,e,t,o){(t==="instructions"?["file"]:["file","tool"]).forEach(r=>{o.push({label:`${r}:`,kind:17,insertText:`${r}:`,range:e,command:{id:"editor.action.triggerSuggest",title:"Suggest"}})})}};u0e=I([m(0,fe),m(1,Vn)],u0e);var p0e=class{constructor(i,e,t,o,n,r){this.promptsService=i;this.languageModelsService=e;this.languageModelToolsService=t;this.chatModeService=o;this.environmentService=n;this.configurationService=r;this._debugDisplayName="PromptHeaderAutocompletion";this.triggerCharacters=[":"]}async provideCompletionItems(i,e,t,o){let n=Mw(i.getLanguageId());if(!n)return;if(/^\s*$/.test(i.getValue()))return{suggestions:[{label:d(8405,null),kind:28,insertText:["---","description: $1","---","$0"].join(`
`),insertTextRules:4,range:i.getFullModelRange()}]};let r=this.promptsService.getParsedPromptFile(i),s=r.header;if(!s)return;let l=r.header.range;if(e.lineNumber<l.startLineNumber||e.lineNumber>=l.endLineNumber)return;let u=i.getLineContent(e.lineNumber).indexOf(":"),p=u!==-1?new ye(e.lineNumber,u+1):void 0;if(!p||e.isBeforeOrEqual(p)){let h=s.attributes.find(({range:g})=>g.startLineNumber<e.lineNumber&&e.lineNumber<=g.endLineNumber);if(!h)for(let g=s.attributes.length-1;g>=0;g--){let f=s.attributes[g];if(f.range.endLineNumber<e.lineNumber&&f.value.type==="map"){let v=s.attributes[g+1],b=v?v.range.startLineNumber:l.endLineNumber;e.lineNumber<b&&(h=f);break}}if(h){let f=i.getLineContent(h.range.startLineNumber).indexOf(":");if(f!==-1)return this.provideValueCompletions(i,e,s,new ye(h.range.startLineNumber,f+1),n,h)}return this.provideAttributeNameCompletions(i,e,s,p,n)}else if(p&&p.isBefore(e))return this.provideValueCompletions(i,e,s,p,n)}async provideAttributeNameCompletions(i,e,t,o,n){let r=[],s=TD(n,t),l=new Set(PSi(n,!1,s));this.configurationService.getValue(Ss.USE_CUSTOM_AGENT_HOOKS)||l.delete(io.hooks);for(let u of t.attributes)l.delete(u.key);let c=u=>{if(o)return u;if(u===io.hooks&&n==="agent"&&s!=="claude"){let h=Object.keys(hg[s]??hg.undefined);return`${u}:
  \${1|${h.join(",")}|}:
    - type: command
      command: "$2"`}let p=this.getValueSuggestions(n,u,s);return p.length>0?`${u}: \${0:${p[0].name}}`:`${u}: $0`};for(let u of l){let p={label:u,documentation:PDe(u,n,s)?.description,kind:9,insertText:c(u),insertTextRules:4,range:new z(e.lineNumber,1,e.lineNumber,o?o.column:i.getLineMaxColumn(e.lineNumber))};r.push(p)}return{suggestions:r}}async provideValueCompletions(i,e,t,o,n,r){let s=[],l=e.lineNumber,c=r??t.attributes.find(({range:f})=>f.startLineNumber<=l&&l<=f.endLineNumber);if(!c)return;let u=TD(n,t);if(!PSi(n,!0,u).includes(c.key))return;if(n==="prompt"||n==="agent"){if(c.key===io.model&&c.value.type==="sequence"){let f=async()=>u==="claude"?wZ:this.getModelNames(n==="agent");return this.provideArrayCompletions(i,e,c.value,f)}if(c.key===io.tools||c.key===bXe.disallowedTools){let f=c.value;if(f.type==="scalar"&&(f=tH(f)),f.type==="sequence"){let v=async()=>u==="github-copilot"||this.environmentService.isSessionsWindow?zso:u==="claude"?wZ:Array.from(this.languageModelToolsService.getFullReferenceNames()).map(b=>({name:b}));return this.provideArrayCompletions(i,e,f,v)}}}if(c.key===io.agents&&c.value.type==="sequence")return this.provideArrayCompletions(i,e,c.value,async()=>await this.promptsService.getCustomAgents(Se.None));if(c.key===io.hooks){if(c.value.type==="map")return this.provideHookEventCompletions(i,e,c.value,u);if(e.lineNumber!==c.range.startLineNumber){let f={type:"map",properties:[],range:c.value.range};return this.provideHookEventCompletions(i,e,f,u)}}let h=i.getLineContent(c.range.startLineNumber).substring(o.column).match(/^\s*/)?.[0].length??0,g=this.getValueSuggestions(n,c.key,u);for(let f of g){let v={label:f.name,documentation:f.description,kind:13,insertText:h===0?` ${f.name}`:f.name,range:new z(e.lineNumber,o.column+h+1,e.lineNumber,i.getLineMaxColumn(e.lineNumber))};s.push(v)}if(c.key===io.handOffs){let f=["","  - label: Start Implementation","    agent: agent","    prompt: Implement the plan","    send: true"].join(`
`),v={label:d(8406,null),kind:13,insertText:h===0?` ${f}`:f,range:new z(e.lineNumber,o.column+h+1,e.lineNumber,i.getLineMaxColumn(e.lineNumber))};s.push(v)}if(c.key===io.hooks&&n==="agent"){let f=["","  ${1|"+Object.keys(hg[u]??hg.undefined).join(",")+"|}:","    - type: command",'      command: "$2"'].join(`
`),v={label:d(8409,null),kind:28,insertText:h===0?` ${f}`:f,insertTextRules:4,range:new z(e.lineNumber,o.column+h+1,e.lineNumber,i.getLineMaxColumn(e.lineNumber))};s.push(v)}return{suggestions:s}}provideHookEventCompletions(i,e,t,o){if(t.properties.find(b=>b.key.range.startLineNumber===e.lineNumber)){let b=i.getLineContent(e.lineNumber),S=b.indexOf(":");if(S!==-1&&e.column>S+1){let y=b.substring(S+1).match(/^\s*/)?.[0].length??0,w=["","  - type: command",'    command: "$1"'].join(`
`);return{suggestions:[{label:d(8407,null),documentation:d(8408,null),kind:28,insertText:y===0?` ${w}`:w,insertTextRules:4,range:new z(e.lineNumber,S+1+y+1,e.lineNumber,i.getLineMaxColumn(e.lineNumber))}]}}}let r=this.provideHookCommandFieldCompletions(i,e,t,o);if(r)return r;let s=[],l=hg[o]??hg.undefined,c=i.getLineContent(e.lineNumber),u=c.search(/\S/),p=u===-1,h=p?e.column:u+1,g=new Set(t.properties.filter(b=>b.key.range.startLineNumber!==e.lineNumber).map(b=>b.key.value)),f=t.properties.length>0?t.properties[0].key.range.startColumn-1:-1;if(f>=0){let b=i.getLineCount();for(let S=t.range.endLineNumber+1;S<=b;S++){if(S===e.lineNumber)continue;let y=i.getLineContent(S),w=y.search(/\S/);if(w!==-1){if(w<f)break;if(w===f){let k=y.match(/^\s+(\S+)\s*:/);k&&g.add(k[1])}}}}let v=c.indexOf(":")!==-1;for(let[b,S]of Object.entries(l)){if(g.has(b))continue;let y=XC[S],w;p?w=[`${b}:`,"  - type: command",'    command: "$1"'].join(`
`):v?w=`${b}:`:w=b,s.push({label:b,documentation:y?.description,kind:9,insertText:w,insertTextRules:4,range:new z(e.lineNumber,h,e.lineNumber,i.getLineMaxColumn(e.lineNumber))})}return{suggestions:s}}provideHookCommandFieldCompletions(i,e,t,o){let n=this.findContainingCommandMap(i,e,t);if(!n)return;let s=o==="github-copilot"?["type","bash","powershell","cwd","env","timeoutSec"]:["type","command","windows","linux","osx","bash","powershell","cwd","env","timeout"],l=new Set(n.properties.filter(S=>S.key.range.startLineNumber!==e.lineNumber).map(S=>S.key.value)),c=i.getLineContent(e.lineNumber),u=c.search(/\S/),p=u===-1,h=c.match(/^(\s*-\s+)/),g=h?h[1].length:u,f=p?e.column:g+1,v=c.indexOf(":"),b=[];for(let S of s){if(l.has(S))continue;let y=JC[S],w=v!==-1?S:`${S}: $0`;b.push({label:S,documentation:y,kind:9,insertText:w,insertTextRules:4,range:new z(e.lineNumber,f,e.lineNumber,v!==-1?v+1:i.getLineMaxColumn(e.lineNumber))})}return b.length>0?{suggestions:b}:void 0}findContainingCommandMap(i,e,t){for(let o=0;o<t.properties.length;o++){let n=t.properties[o];if(n.value.type!=="sequence")continue;let r=n.value.range,s=t.properties[o+1],l=r.containsPosition(e),c=!l&&r.endLineNumber<e.lineNumber&&(!s||s.key.range.startLineNumber>e.lineNumber);if(l||c){if(c){let h=i.getLineContent(e.lineNumber).search(/\S/),g=h===-1?e.column-1:h,f=n.key.range.startColumn-1;if(g<=f)continue}let u=this.findCommandMapInSequence(e,n.value);if(u)return u}}}findCommandMapInSequence(i,e){for(let t=0;t<e.items.length;t++){let o=e.items[t];if(o.type!=="map"){if(o.type==="scalar"&&o.range.startLineNumber===i.lineNumber)return{type:"map",properties:[],range:o.range};continue}let n=o.range.containsPosition(i),r=!n&&o.range.endLineNumber<i.lineNumber&&(t+1>=e.items.length||e.items[t+1].range.startLineNumber>i.lineNumber);if(!n&&!r)continue;let s=o.properties.find(l=>l.key.value==="hooks");if(s?.value.type==="sequence"){let l=this.findCommandMapInSequence(i,s.value);if(l)return l}return o}}getValueSuggestions(i,e,t){let o=PDe(e,i,t);if(o?.enums)return o.enums;if(o?.defaults)return o.defaults.map(n=>({name:n}));switch(e){case io.agent:case io.mode:if(i==="prompt"){let n=this.chatModeService.getModes(),r=[];for(let s of vt.concat(n.builtin,n.custom))r.push({name:s.name.get(),description:s.label.get()});return r}break;case io.model:if(i==="prompt"||i==="agent")return this.getModelNames(i==="agent");break}return[]}getModelNames(i){let e=[];for(let t of this.languageModelsService.getLanguageModelIds()){let o=this.languageModelsService.lookupLanguageModel(t);o&&o.isUserSelectable!==!1&&!o.targetChatSessionType&&(!i||nD.suitableForAgentMode(o))&&e.push({name:nD.asQualifiedName(o),description:o.tooltip})}return e}async provideArrayCompletions(i,e,t,o){let n=async(s,l)=>{let c=[],u=await o(),p=fvo(t,i),h=new Set(t.items.filter(g=>g!==l).filter(g=>g.type==="scalar").map(g=>g.value));for(let g of u){let f=g.name;if(h.has(f))continue;let v;if(s.isEmpty())v=$zt(f,p);else{let b=i.getValueInRange(s).charCodeAt(0);v=b===39?`'${f}'`:b===34?`"${f}"`:f}c.push({label:f,documentation:g.description,kind:13,filterText:v,insertText:v,range:s})}return{suggestions:c}};for(let s of t.items)if(s.range.containsPosition(e))return await n(s.range,s);if(i.getValueInRange(new z(e.lineNumber,1,e.lineNumber,e.column)).match(/[:,[]\s*$/))return await n(new z(e.lineNumber,e.column,e.lineNumber,e.column))}};p0e=I([m(0,Or),m(1,ds),m(2,Vn),m(3,Fg),m(4,At),m(5,B)],p0e);var m0e=class{constructor(i,e,t,o,n){this.promptsService=i;this.languageModelToolsService=e;this.languageModelsService=t;this.chatModeService=o;this.configurationService=n;this._debugDisplayName="PromptHoverProvider"}createHover(i,e){return{contents:[new Ie(i)],range:e}}async provideHover(i,e,t,o){let n=Mw(i.getLanguageId());if(!n)return;let r=this.promptsService.getParsedPromptFile(i),s=TD(n,r.header??i.uri);if(r.header?.range.containsPosition(e))return this.provideHeaderHover(e,n,r.header,s);if(r.body?.range.containsPosition(e))return this.provideBodyHover(e,r.body,s)}async provideBodyHover(i,e,t){for(let o of e.variableReferences)if(o.range.containsPosition(i)){let n=o.name;return this.getToolHoverByName(n,o.range,t)}}async provideHeaderHover(i,e,t,o){for(let n of t.attributes)if(n.range.containsPosition(i)){let r=PDe(n.key,e,o)?.description;if(r)switch(n.key){case io.model:return this.getModelHover(n,i,r,o);case io.tools:case bXe.disallowedTools:return this.getToolHover(n,i,r,o);case io.agent:case io.mode:return this.getAgentHover(n,i,r);case io.handOffs:return this.getHandsOffHover(n,i,o);case io.hooks:return this.configurationService.getValue(Ss.USE_CUSTOM_AGENT_HOOKS)?this.getHooksHover(n,i,r,o):void 0;case io.infer:return this.createHover(r+`

`+d(8416,null),n.range);default:return this.createHover(r,n.range)}}}getToolHover(i,e,t,o){let n=i.value;if(n.type==="scalar"&&(n=tH(n)),n.type==="sequence"){for(let r of n.items)if(r.type==="scalar"&&r.range.containsPosition(e)){let s=this.getToolHoverByName(r.value,r.range,o);if(s)return s}}return this.createHover(t,i.range)}getToolHoverByName(i,e,t){if(t==="claude"){let n=wZ.find(r=>r.name===i)?.description;return n?this.createHover(n,e):void 0}let o=this.languageModelToolsService.getToolByFullReferenceName(i);if(o!==void 0)return Xm(o)?this.getToolsetHover(o,e):this.createHover(o.userDescription??o.modelDescription,e)}getToolsetHover(i,e){let t=[];t.push(d(8421,null,i.referenceName)),i.description&&t.push(i.description);for(let o of i.getTools())t.push(`- ${o.toolReferenceName??o.displayName}`);return this.createHover(t.join(`
`),e)}getModelHover(i,e,t,o){if(o==="github-copilot")return this.createHover(t+`

`+d(8415,null),i.range);let n=r=>{let s=[];if(s.push(t+`
`),o==="claude"){let c=KNt.find(u=>u.name===r);if(!c)return this.createHover(s.join(`
`),i.range);if(c.modelEquivalent)s.push(d(8410,null,r)),r=c.modelEquivalent;else return s.push(c.description),this.createHover(s.join(`
`),i.range)}let l=this.languageModelsService.lookupLanguageModelByQualifiedName(r);if(l){let c=l.metadata;return s.push(d(8412,null,c.name)),s.push(d(8411,null,c.family)),s.push(d(8413,null,c.vendor)),c.tooltip&&s.push("","",c.tooltip),this.createHover(s.join(`
`),i.range)}};if(i.value.type==="scalar"){let r=n(i.value.value);if(r)return r}else if(i.value.type==="sequence"){for(let r of i.value.items)if(r.type==="scalar"&&r.range.containsPosition(e)){let s=n(r.value);if(s)return s}}return this.createHover(t,i.range)}getAgentHover(i,e,t){let o=[],n=i.value;if(n.type==="scalar"&&n.range.containsPosition(e)){let r=this.chatModeService.findModeByName(n.value);if(r){let s=r.description.get()||(qNt(r)?d(8418,null):d(8420,null));o.push(`\`${r.name.get()}\`: ${s}`)}}else{let r=this.chatModeService.getModes();o.push(t),o.push(""),o.push(d(8417,null));for(let s of r.builtin)o.push(`- \`${s.name.get()}\`: ${s.description.get()||s.label.get()}`);if(r.custom.length>0){o.push(""),o.push(d(8419,null));for(let s of r.custom){let l=s.description.get();o.push(`- \`${s.name.get()}\`: ${l||d(8420,null)}`)}}}return this.createHover(o.join(`
`),i.range)}getHooksHover(i,e,t,o){let n=i.value;if(n.type==="map"){let r=hg[o]??hg.undefined;for(let s of n.properties){if(s.key.range.containsPosition(e)){let l=r[s.key.value];if(l){let c=XC[l];return this.createHover(`**${c.label}**

${c.description}`,s.key.range)}}if(s.value.type==="sequence"){let l=this.getHookCommandItemHover(s.value,e);if(l)return l}}}return this.createHover(t,i.range)}getHookCommandItemHover(i,e){for(let t of i.items){if(t.type!=="map"||!t.range.containsPosition(e))continue;let o=t.properties.find(n=>n.key.value==="hooks");if(o&&o.value.type==="sequence"){let n=this.getHookCommandItemHover(o.value,e);if(n)return n}for(let n of t.properties)if(n.key.range.containsPosition(e)||n.value.range.containsPosition(e)){let r=JC[n.key.value];if(r)return this.createHover(r,n.key.range)}}}getHandsOffHover(i,e,t){let o=PDe(io.handOffs,"agent",t)?.description;return CZ(t)?this.createHover(o,i.range):this.createHover(o+`

`+d(8414,null),i.range)}};m0e=I([m(0,Or),m(1,Vn),m(2,ds),m(3,Fg),m(4,B)],m0e);var h0e=class{constructor(i,e){this.promptsService=i;this.chatModeService=e;this._debugDisplayName="PromptHeaderDefinitionProvider"}async provideDefinition(i,e,t){if(!Mw(i.getLanguageId()))return;let r=this.promptsService.getParsedPromptFile(i).header;if(!r)return;let s=r.getAttribute(io.agent)??r.getAttribute(io.mode);if(s&&s.value.type==="scalar"&&s.range.containsPosition(e)){let l=this.chatModeService.findModeByName(s.value.value);if(l&&l.uri)return{uri:l.uri.get(),range:new z(1,1,1,1)}}}};h0e=I([m(0,Or),m(1,Fg)],h0e);var ort="prompts-diagnostics-provider",g0e=class{constructor(i,e,t,o,n,r,s){this.languageModelsService=i;this.languageModelToolsService=e;this.chatModeService=t;this.fileService=o;this.labelService=n;this.promptsService=r;this.configurationService=s}async validate(i,e,t){i.header?.errors.forEach(n=>t(Tn(n.message,n.range,8)));let o=Ern(e,i.header??i.uri);await this.validateHeader(i,e,o,t),await this.validateBody(i,o,t),await this.validateFileName(i,e,t),await this.validateSkillAttributes(i,e,t)}async validateFileName(i,e,t){if(e==="agent"&&i.uri.path.endsWith(AK)){let o=this.promptsService.getAgentFileURIFromModeFile(i.uri);o&&await this.fileService.canCreateFile(o)?t(Tn(d(8513,null,o.toString()),new z(1,1,1,4),4)):t(Tn(d(8514,null,NK),new z(1,1,1,4),4))}}async validateSkillAttributes(i,e,t){if(e!=="skill")return;let o=i.header?.attributes.find(r=>r.key===io.name);if(!o){t(Tn(d(8577,null),new z(1,1,1,4),8));return}if(!i.header?.attributes.find(r=>r.key===io.description)){t(Tn(d(8574,null),new z(1,1,1,4),8));return}if(o.value.type==="scalar"){let r=o.value.value.trim();if(r.length>0){wLt.test(r)||t(Tn(d(8576,null),o.value.range,8));let s=i.uri.path.split("/"),l=s.findIndex(c=>c==="SKILL.md");if(l>0){let c=s[l-1];c&&r!==c&&t(Tn(d(8575,null,r,c),o.value.range,4))}}}}async validateBody(i,e,t){let o=i.body;if(!o)return;let n=[];for(let r of o.fileReferences){let s=o.resolveFilePath(r.content);if(!s){t(Tn(d(8554,null,r.content),r.range,4));continue}i.uri.scheme===s.scheme&&n.push((async()=>{try{if(await this.fileService.exists(s))return}catch{}let l=this.labelService.getUriLabel(s);t(Tn(d(8529,null,r.content,l),r.range,4))})())}if(o.variableReferences.length&&tIo(e)){let r=i.header?.tools,s=r?this.languageModelToolsService.toToolAndToolSetEnablementMap(r,void 0):void 0,l=new Set(this.languageModelToolsService.getFullReferenceNames()),c=this.languageModelToolsService.getDeprecatedFullReferenceNames();for(let u of o.variableReferences)if(l.has(u.name)){if(s){let p=this.languageModelToolsService.getToolByFullReferenceName(u.name);p&&s.get(p)===!1&&t(Tn(d(8521,null,u.name),u.range,4))}}else if(c.has(u.name)){let p=c.get(u.name);if(p&&p.size>0)if(p.size===1){let h=Array.from(p)[0];t(Tn(d(8517,null,u.name,h),u.range,2))}else{let h=Array.from(p).sort((g,f)=>g.localeCompare(f)).join(", ");t(Tn(d(8518,null,u.name,h),u.range,2))}}else t(Tn(d(8598,null,u.name),u.range,4))}await Promise.all(n)}async validateHeader(i,e,t,o){let n=i.header;if(!n)return;let r=n.attributes;switch(this.checkForInvalidArguments(r,e,t,o),this.validateName(r,o),this.validateDescription(r,o),this.validateArgumentHint(r,o),e){case"prompt":{let s=this.validateAgent(r,o);this.validateTools(r,s?.kind??"agent",t,o),this.validateModel(r,s?.kind??"agent",o);break}case"instructions":t==="claude"?this.validatePaths(r,o):this.validateApplyTo(r,o),this.validateExcludeAgent(r,o);break;case"agent":{this.validateTarget(r,o),this.validateInfer(r,o),this.validateUserInvocable(r,o),this.validateDisableModelInvocation(r,o),this.validateTools(r,"agent",t,o),this.configurationService.getValue(Ss.USE_CUSTOM_AGENT_HOOKS)&&this.validateHooks(r,t,o),tIo(t)?(this.validateModel(r,"agent",o),this.validateHandoffs(r,o),await this.validateAgentsAttribute(r,n,o),this.validateGithubPermissions(r,o)):t==="claude"?this.validateClaudeAttributes(r,o):t==="github-copilot"&&this.validateGithubPermissions(r,o);break}case"skill":this.validateUserInvocable(r,o),this.validateDisableModelInvocation(r,o);break}}checkForInvalidArguments(i,e,t,o){let n=ERi(e,!0,t);this.configurationService.getValue(Ss.USE_CUSTOM_AGENT_HOOKS)||(n=n.filter(l=>l!==io.hooks));let r=this.configurationService.getValue(Ss.USE_CUSTOM_AGENT_HOOKS),s=new co(()=>new Set(ERi(e,!1,"github-copilot")));for(let l of i)if(!n.includes(l.key)){let c=new co(()=>{let u=ERi(e,!1,t);return r||(u=u.filter(p=>p!==io.hooks)),u.sort().join(", ")});switch(e){case"prompt":o(Tn(d(8588,null,l.key,c.value),l.range,4));break;case"agent":t==="github-copilot"?o(Tn(d(8586,null,l.key,c.value),l.range,4)):t==="claude"||(s.value.has(l.key)?o(Tn(d(8551,null,l.key),l.range,2)):o(Tn(d(8591,null,l.key,c.value),l.range,4)));break;case"instructions":t==="claude"?o(Tn(d(8589,null,l.key,c.value),l.range,4)):o(Tn(d(8587,null,l.key,c.value),l.range,4));break;case"skill":o(Tn(d(8590,null,l.key,c.value),l.range,4));break}}}validateName(i,e){let t=i.find(o=>o.key===io.name);if(t){if(t.value.type!=="scalar"){e(Tn(d(8566,null),t.range,8));return}if(t.value.value.trim().length===0){e(Tn(d(8567,null),t.value.range,8));return}}}validateDescription(i,e){let t=i.find(o=>o.key===io.description);if(t){if(t.value.type!=="scalar"){e(Tn(d(8519,null),t.range,8));return}if(t.value.value.trim().length===0){e(Tn(d(8520,null),t.value.range,8));return}}}validateArgumentHint(i,e){let t=i.find(o=>o.key===io.argumentHint);if(t){if(t.value.type!=="scalar"){e(Tn(d(8509,null),t.range,8));return}if(t.value.value.trim().length===0){e(Tn(d(8510,null),t.value.range,8));return}}}validateModel(i,e,t){let o=i.find(s=>s.key===io.model);if(!o)return;if(o.value.type!=="scalar"&&o.value.type!=="sequence"){t(Tn(d(8563,null),o.value.range,8));return}let n=[];if(o.value.type==="scalar"){let s=o.value.value.trim();if(s.length===0){t(Tn(d(8562,null),o.value.range,8));return}n.push([s,o.value.range])}else if(o.value.type==="sequence"){if(o.value.items.length===0){t(Tn(d(8561,null),o.value.range,8));return}for(let s of o.value.items){if(s.type!=="scalar"){t(Tn(d(8560,null),s.range,8));return}let l=s.value.trim();if(l.length===0){t(Tn(d(8559,null),s.range,8));return}n.push([l,s.range])}}if(this.languageModelsService.getLanguageModelIds().length!==0)for(let[s,l]of n){let c=this.findModelByName(s);c?e==="agent"&&!nD.suitableForAgentMode(c)&&t(Tn(d(8565,null,s),l,4)):t(Tn(d(8564,null,s),l,4))}}validateClaudeAttributes(i,e){for(let t in TRi){let n=TRi[t].enums;if(n){let r=i.find(s=>s.key===t);if(!r)continue;if(r.value.type!=="scalar"){e(Tn(d(8515,null,t),r.value.range,8));continue}else{let s=r.value.value.trim();if(n.every(l=>l.name!==s)){let l=n.map(c=>c.name).join(", ");e(Tn(d(8516,null,s,l),r.value.range,4))}}}}}findModelByName(i){let e=this.languageModelsService.lookupLanguageModelByQualifiedName(i);if(e&&e.metadata.isUserSelectable!==!1)return e.metadata}validateAgent(i,e){let t=i.find(s=>s.key===io.agent),o=i.find(s=>s.key===io.mode);o&&e(t?Tn(d(8557,null),o.range,4):Tn(d(8558,null),o.range,8));let n=i.find(s=>s.key===io.agent)??o;if(!n)return;if(n.value.type!=="scalar"){e(Tn(d(8512,null,n.key),n.value.range,8));return}if(n.value.value.trim().length===0){e(Tn(d(8511,null,n.key),n.value.range,8));return}return this.validateAgentValue(n.value,e)}validateAgentValue(i,e){let t=this.chatModeService.getModes(),o=[];for(let r of vt.concat(t.builtin,t.custom)){if(r.name.get()===i.value)return r;o.push(r.name.get())}let n=d(8503,null,i.value,o.join(", "));e(Tn(n,i.range,4))}validateTools(i,e,t,o){let n=i.find(s=>s.key===io.tools);if(!n)return;e!=="agent"&&o(Tn(d(8585,null),n.range,4));let r=n.value;if(r.type==="scalar"&&(r=tH(r)),r.type!=="sequence"){o(Tn(d(8584,null),n.value.range,8));return}t==="github-copilot"||t==="claude"||this.validateVSCodeTools(r,o)}validateVSCodeTools(i,e){if(i.items.length>0){let t=new Set(this.languageModelToolsService.getFullReferenceNames()),o=this.languageModelToolsService.getDeprecatedFullReferenceNames();for(let n of i.items)if(n.type!=="scalar")e(Tn(d(8527,null),n.range,8));else if(n.value&&!t.has(n.value)){let r=o.get(n.value);if(r)if(r?.size===1){let s=Array.from(r)[0];e(Tn(d(8581,null,n.value,s),n.range,2))}else{let s=Array.from(r).sort((l,c)=>l.localeCompare(c)).join(", ");e(Tn(d(8582,null,n.value,s),n.range,2))}else e(Tn(d(8583,null,n.value),n.range,4))}}}validateApplyTo(i,e){let t=i.find(n=>n.key===io.applyTo);if(!t)return;if(t.value.type!=="scalar"){e(Tn(d(8507,null),t.value.range,8));return}let o=t.value.value;try{let n=ER(o,",");if(n.length===0){e(Tn(d(8508,null),t.value.range,8));return}for(let r of n){let s=Ym(r);if(kpi(s)){e(Tn(d(8508,null),t.value.range,8));return}}}catch{e(Tn(d(8508,null),t.value.range,8))}}validatePaths(i,e){let t=i.find(o=>o.key===io.paths);if(t){if(t.value.type!=="sequence"){e(Tn(d(8571,null),t.value.range,8));return}for(let o of t.value.items){if(o.type!=="scalar"){e(Tn(d(8526,null),o.range,8));continue}let n=o.value.trim();if(n.length===0){e(Tn(d(8569,null),o.range,8));continue}try{let r=Ym(n);kpi(r)&&e(Tn(d(8570,null,n),o.range,8))}catch{e(Tn(d(8570,null,n),o.range,8))}}}}validateExcludeAgent(i,e){let t=i.find(o=>o.key===io.excludeAgent);if(t&&t.value.type!=="sequence"&&t.value.type!=="scalar"){e(Tn(d(8528,null),t.value.range,8));return}}validateHooks(i,e,t){let o=i.find(r=>r.key===io.hooks);if(!o)return;if(o.value.type!=="map"){t(Tn(d(8547,null),o.value.range,8));return}let n=new Set(Object.keys(hg[e]??hg.undefined));for(let r of o.value.properties){if(n.has(r.key.value)||t(Tn(d(8595,null,r.key.value,Array.from(n).join(", ")),r.key.range,4)),r.value.type!=="sequence"){t(Tn(d(8550,null,r.key.value),r.value.range,8));continue}for(let s of r.value.items)this.validateHookCommand(s,e,t)}}validateHookCommand(i,e,t){if(i.type!=="map"){t(Tn(d(8540,null),i.range,8));return}let o=i.properties.find(u=>u.key.value==="hooks");if(o){for(let u of i.properties)u.key.value!=="hooks"&&u.key.value!=="matcher"&&t(Tn(d(8596,null,u.key.value),u.key.range,4));if(o.value.type!=="sequence"){t(Tn(d(8568,null),o.value.range,8));return}for(let u of o.value.items)this.validateHookCommand(u,e,t);return}let n=e==="github-copilot",r=n?new Set(["bash","powershell"]):new Set(["command","windows","linux","osx","bash","powershell"]),s=n?new Set(["type","bash","powershell","cwd","env","timeoutSec"]):new Set(["type","command","windows","linux","osx","bash","powershell","cwd","env","timeout"]),l=!1,c=!1;for(let u of i.properties){let p=u.key.value;if(s.has(p)||t(Tn(d(8594,null,p),u.key.range,4)),p==="type")l=!0,(u.value.type!=="scalar"||u.value.value!=="command")&&t(Tn(d(8549,null),u.value.range,8));else if(r.has(p))c=!0,(u.value.type!=="scalar"||u.value.value.trim().length===0)&&t(Tn(d(8539,null,p),u.value.range,8));else if(p==="cwd")u.value.type!=="scalar"&&t(Tn(d(8541,null),u.value.range,8));else if(p==="env")if(u.value.type!=="map")t(Tn(d(8542,null),u.value.range,8));else for(let h of u.value.properties)h.value.type!=="scalar"&&t(Tn(d(8543,null,h.key.value),h.value.range,8));else(p==="timeout"||p==="timeoutSec")&&(u.value.type!=="scalar"||isNaN(Number(u.value.value)))&&t(Tn(d(8548,null,p),u.value.range,8))}l||t(Tn(d(8546,null),i.range,8)),c||t(n?Tn(d(8545,null),i.range,8):Tn(d(8544,null),i.range,8))}validateHandoffs(i,e){let t=i.find(n=>n.key===io.handOffs);if(!t)return;if(t.value.type!=="sequence"){e(Tn(d(8538,null),t.value.range,8));return}let o=new Map;for(let n of t.value.items){if(n.type!=="map"){e(Tn(d(8525,null),n.range,8));continue}let r=new Set(["label","agent","prompt"]);for(let l of n.properties){switch(l.key.value){case"label":l.value.type!=="scalar"||l.value.value.trim().length===0?e(Tn(d(8532,null),l.value.range,8)):/[a-zA-Z0-9]/.test(l.value.value)||e(Tn(d(8533,null),l.value.range,8));break;case"agent":l.value.type!=="scalar"||l.value.value.trim().length===0?e(Tn(d(8531,null),l.value.range,8)):this.validateAgentValue(l.value,e);break;case"prompt":l.value.type!=="scalar"&&e(Tn(d(8535,null),l.value.range,8));break;case"send":I2t(l.value)||e(Tn(d(8536,null),l.value.range,8));break;case"showContinueOn":I2t(l.value)||e(Tn(d(8537,null),l.value.range,8));break;case"model":l.value.type!=="scalar"&&e(Tn(d(8534,null),l.value.range,8));break;default:e(Tn(d(8593,null,l.key.value),l.value.range,4))}r.delete(l.key.value)}r.size>0&&e(Tn(d(8556,null,Array.from(r).map(l=>`'${l}'`).join(", ")),n.range,8));let s=n.properties.find(l=>l.key.value==="label");if(s?.value.type==="scalar"){let l=s.value.value.toLowerCase();l&&o.has(l)?e(Tn(d(8523,null,s.value.value),s.value.range,8)):l&&o.set(l,s.value.range)}}}validateInfer(i,e){let t=i.find(o=>o.key===io.infer);t&&e(Tn(d(8552,null),t.value.range,8))}validateTarget(i,e){let t=i.find(r=>r.key===io.target);if(!t)return;if(t.value.type!=="scalar"){e(Tn(d(8580,null),t.value.range,8));return}let o=t.value.value.trim();if(o.length===0){e(Tn(d(8579,null),t.value.range,8));return}let n=["github-copilot","vscode"];n.includes(o)||e(Tn(d(8578,null,n.join(", ")),t.value.range,8))}validateUserInvocable(i,e){let t=i.find(o=>o.key===io.userInvocable);if(t&&!I2t(t.value)){e(Tn(d(8599,null),t.value.range,8));return}}validateDisableModelInvocation(i,e){let t=i.find(o=>o.key===io.disableModelInvocation);if(t){if(!I2t(t.value)){e(Tn(d(8522,null),t.value.range,8));return}t.value.type==="scalar"&&t.value.value==="false"&&(this.isCustomAgentInSubagentEnabled()||e(Tn(d(8553,null),t.value.range,4)))}}async validateAgentsAttribute(i,e,t){let o=i.find(l=>l.key===io.agents);if(!o)return;if(o.value.type!=="sequence"){t(Tn(d(8504,null),o.value.range,8));return}this.isCustomAgentInSubagentEnabled()||t(Tn(d(8506,null),o.range,4));let n=await this.promptsService.getCustomAgents(Se.None),r=new Set(n.map(l=>l.name));r.add(Tl.Agent.name.get());let s=[];for(let l of o.value.items)l.type!=="scalar"?t(Tn(d(8524,null),l.range,8)):l.value&&(s.push(l.value),l.value!=="*"&&!r.has(l.value)&&t(Tn(d(8502,null,l.value,Array.from(r).join(", ")),l.range,4)));if(s.length>0){let l=e.tools;l&&!l.includes(pm.agent)&&t(Tn(d(8505,null),o.value.range,4))}}isCustomAgentInSubagentEnabled(){return!!this.configurationService.getValue("chat.customAgentInSubagent.enabled")}validateGithubPermissions(i,e){let t=i.find(o=>o.key===l3.github);if(t){if(t.value.type!=="map"){e(Tn(d(8530,null),t.value.range,8));return}for(let o of t.value.properties){if(o.key.value!=="permissions"){e(Tn(d(8592,null,o.key.value),o.key.range,4));continue}if(o.value.type!=="map"){e(Tn(d(8572,null),o.value.range,8));continue}for(let n of o.value.properties){let r=n.key.value,s=ZSo[r];if(!s){let c=Object.keys(ZSo).sort().join(", ");e(Tn(d(8597,null,r,c),n.key.range,4));continue}if(n.value.type!=="scalar"){e(Tn(d(8573,null,r),n.value.range,8));continue}let l=n.value.value;s.allowedValues.includes(l)||e(Tn(d(8555,null,l,r,s.allowedValues.join(", ")),n.value.range,8))}}}}};g0e=I([m(0,ds),m(1,Vn),m(2,Fg),m(3,fe),m(4,rt),m(5,Or),m(6,B)],g0e);var ZSo={actions:{allowedValues:["read","write","none"],description:d(8466,null)},checks:{allowedValues:["read","none"],description:d(8467,null)},contents:{allowedValues:["read","write","none"],description:d(8468,null)},discussions:{allowedValues:["read","write","none"],description:d(8469,null)},issues:{allowedValues:["read","write","none"],description:d(8470,null)},metadata:{allowedValues:["read"],description:d(8471,null)},"pull-requests":{allowedValues:["read","write","none"],description:d(8472,null)},"security-events":{allowedValues:["read","none"],description:d(8473,null)},workflows:{allowedValues:["write","none"],description:d(8474,null)}};function I2t(a){return a.type==="scalar"?(a.value==="true"||a.value==="false")&&a.format==="none":!1}var irt={prompt:[io.name,io.description,io.model,io.tools,io.mode,io.agent,io.argumentHint],instructions:[io.name,io.description,io.applyTo,io.excludeAgent],agent:[io.name,io.description,io.model,io.tools,io.advancedOptions,io.handOffs,io.argumentHint,io.target,io.infer,io.agents,io.hooks,io.userInvocable,io.disableModelInvocation,l3.github],skill:[io.name,io.description,io.license,io.compatibility,io.metadata,io.argumentHint,io.userInvocable,io.disableModelInvocation],hook:[]},wrn=[io.name,io.description,io.tools,io.target,l3.mcpServers,l3.github,io.infer],Crn={prompt:irt.prompt.filter(a=>!y2t(a)),instructions:irt.instructions.filter(a=>!y2t(a)),agent:irt.agent.filter(a=>!y2t(a)),skill:irt.skill.filter(a=>!y2t(a)),hook:[]};function ERi(a,i,e){return e==="claude"?a==="instructions"?Object.keys(krn):Object.keys(TRi):e==="github-copilot"&&a==="agent"?wrn:i?irt[a]:Crn[a]}function y2t(a){return a===io.advancedOptions||a===io.excludeAgent||a===io.mode||a===io.infer}var MHm=[{name:pm.execute,description:d(8463,null)},{name:pm.read,description:d(8464,null)},{name:pm.edit,description:d(8462,null)},{name:pm.search,description:d(8465,null)},{name:pm.agent,description:d(8461,null)}],eIo=[{name:"Bash",description:d(8435,null),toolEquivalent:[pm.execute]},{name:"Edit",description:d(8436,null),toolEquivalent:["edit/editNotebook","edit/editFiles"]},{name:"Glob",description:d(8437,null),toolEquivalent:["search/fileSearch"]},{name:"Grep",description:d(8438,null),toolEquivalent:["search/textSearch"]},{name:"Read",description:d(8454,null),toolEquivalent:["read/readFile","read/getNotebookSummary"]},{name:"Write",description:d(8460,null),toolEquivalent:["edit/createDirectory","edit/createFile","edit/createJupyterNotebook"]},{name:"WebFetch",description:d(8458,null),toolEquivalent:[pm.web]},{name:"WebSearch",description:d(8459,null),toolEquivalent:[pm.web]},{name:"Task",description:d(8457,null),toolEquivalent:[pm.agent]},{name:"Skill",description:d(8455,null),toolEquivalent:[]},{name:"LSP",description:d(8441,null),toolEquivalent:[]},{name:"NotebookEdit",description:d(8446,null),toolEquivalent:["edit/editNotebook"]},{name:"AskUserQuestion",description:d(8434,null),toolEquivalent:["vscode/askQuestions"]},{name:"MCPSearch",description:d(8442,null),toolEquivalent:[]}],xrn=[{name:"sonnet",description:d(8456,null),modelEquivalent:"Claude Sonnet 4.5 (copilot)"},{name:"opus",description:d(8447,null),modelEquivalent:"Claude Opus 4.6 (copilot)"},{name:"haiku",description:d(8439,null),modelEquivalent:"Claude Haiku 4.5 (copilot)"},{name:"inherit",description:d(8440,null),modelEquivalent:void 0}];var TRi={name:{type:"scalar",description:d(8428,null)},description:{type:"scalar",description:d(8422,null)},tools:{type:"sequence",description:d(8433,null),defaults:["Read, Edit, Bash"],items:eIo},disallowedTools:{type:"sequence",description:d(8423,null),defaults:["Write, Edit, Bash"],items:eIo},model:{type:"scalar",description:d(8427,null),defaults:["sonnet","opus","haiku","inherit"],enums:xrn},permissionMode:{type:"scalar",description:d(8429,null),defaults:["default","acceptEdits","dontAsk","bypassPermissions","plan"],enums:[{name:"default",description:d(8450,null)},{name:"acceptEdits",description:d(8448,null)},{name:"plan",description:d(8453,null)},{name:"delegate",description:d(8451,null)},{name:"dontAsk",description:d(8452,null)},{name:"bypassPermissions",description:d(8449,null)}]},skills:{type:"sequence",description:d(8432,null)},mcpServers:{type:"sequence",description:d(8425,null)},hooks:{type:"object",description:d(8424,null)},memory:{type:"scalar",description:d(8426,null),defaults:["user","project","local"],enums:[{name:"user",description:d(8445,null)},{name:"project",description:d(8444,null)},{name:"local",description:d(8443,null)}]}},krn={description:{type:"scalar",description:d(8430,null)},paths:{type:"sequence",description:d(8431,null)}};function tIo(a){return a==="vscode"||a==="undefined"}function Ern(a,i){let e=i instanceof A?i:i.uri;if(a==="agent"){if(ci(e).path.endsWith(`/${PK}`))return"claude";if(!(i instanceof A)){let o=i.target;if(o==="github-copilot"||o==="vscode")return o}return"undefined"}else if(a==="instructions"&&DB(e))return"claude";return"undefined"}function Tn(a,i,e=8){return{severity:e,message:a,...i}}var f0e=class{constructor(i){this.promptsService=i;this._debugDisplayName="PromptDocumentSemanticTokensProvider"}provideDocumentSemanticTokens(i,e,t){let o=Mw(i.getLanguageId());if(!o)return;let n=this.promptsService.getParsedPromptFile(i);if(!n.body)return;let r=TD(o,n.header??i.uri);if(!CZ(r))return;let s=n.body.variableReferences;if(!s.length)return;let l=[],c=0,u=0,p=[...s].sort((h,g)=>h.range.startLineNumber===g.range.startLineNumber?h.range.startColumn-g.range.startColumn:h.range.startLineNumber-g.range.startLineNumber);for(let h of p){let f=h.range.startLineNumber-1,v=h.range.startColumn-6-1,b=h.range.endColumn-h.range.startColumn+6,S=f-c,y=S===0?v-u:v;if(l.push(S,y,b,0,0),c=f,u=v,t.isCancellationRequested)break}return{data:new Uint32Array(l)}}getLegend(){return{tokenTypes:["variable"],tokenModifiers:[]}}releaseDocumentSemanticTokens(i){}};f0e=I([m(0,Or)],f0e);var v0e=class{constructor(i,e,t,o){this.promptsService=i;this.languageModelToolsService=e;this.fileService=t;this.markerService=o;this._debugDisplayName="PromptCodeActionProvider"}async provideCodeActions(i,e,t,o){let n=Mw(i.getLanguageId());if(!n||n==="instructions")return;let r=[],s=this.promptsService.getParsedPromptFile(i);switch(n){case"agent":this.getUpdateToolsCodeActions(s,n,i,e,r),await this.getMigrateModeFileCodeActions(i,r);break;case"prompt":this.getUpdateModeCodeActions(s,i,e,r),this.getUpdateToolsCodeActions(s,n,i,e,r);break}if(r.length!==0)return{actions:r,dispose:()=>{}}}getMarkers(i,e){return this.markerService.read({resource:i.uri,owner:ort}).filter(o=>e.containsRange(o))}createCodeAction(i,e,t,o){return{title:t,edit:{edits:o},ranges:[e],diagnostics:this.getMarkers(i,e),kind:xr.QuickFix.value}}getUpdateModeCodeActions(i,e,t,o){let n=i.header?.getAttribute(io.mode);if(!n?.range.containsRange(t))return;let r=new z(n.range.startLineNumber,n.range.startColumn,n.range.startLineNumber,n.range.startColumn+n.key.length);o.push(this.createCodeAction(e,r,d(8326,null),[w2t(e,{range:r,text:"agent"})]))}async getMigrateModeFileCodeActions(i,e){if(i.uri.path.endsWith(AK)){let t=this.promptsService.getAgentFileURIFromModeFile(i.uri);if(t&&await this.fileService.canMove(i.uri,t)){let o={oldResource:i.uri,newResource:t,options:{overwrite:!1,copy:!1}};e.push(this.createCodeAction(i,new z(1,1,1,4),d(8325,null),[o]))}}}getUpdateToolsCodeActions(i,e,t,o,n){if(!i.header)return;let r=i.header.getAttribute(io.tools);if(!r||!r.value.range.containsRange(o))return;let s=TD(e,i.header);if(!CZ(s))return;let l=r.value;if(l.type==="scalar"&&(l=tH(l)),l.type!=="sequence")return;let c=l.items,u=new co(()=>this.languageModelToolsService.getDeprecatedFullReferenceNames()),p=[];for(let h of c){if(h.type!=="scalar")continue;let g=u.value.get(h.value);if(g&&g.size>0){let f=t.getValueInRange(new z(h.range.startLineNumber,h.range.startColumn,h.range.endLineNumber,h.range.startColumn+1));if(g.size===1){let v=Array.from(g)[0],b=f==="'"||f==='"'?f+v+f:v,S={range:h.range,text:b};p.push(S),h.range.containsRange(o)&&n.push(this.createCodeAction(t,h.range,d(8328,null,v),[w2t(t,S)]))}else{let v=Array.from(g).sort((T,P)=>T.localeCompare(P)),y=t.getValueInRange(new z(h.range.startLineNumber,h.range.endColumn,h.range.endLineNumber,h.range.endColumn+2)).includes(",")?", ":",",w=v.map(T=>f==="'"||f==='"'?f+T+f:T).join(y),k={range:h.range,text:w};p.push(k),h.range.containsRange(o)&&n.push(this.createCodeAction(t,h.range,d(8324,null,g.size),[w2t(t,k)]))}}}(p.length&&n.length===0||p.length>1)&&n.push(this.createCodeAction(t,l.range,d(8327,null),p.map(h=>w2t(t,h))))}};v0e=I([m(0,Or),m(1,Vn),m(2,fe),m(3,oa)],v0e);function w2t(a,i){return{versionId:a.getVersionId(),resource:a.uri,textEdit:i}}var jge=class extends x{static{this.ID="chat.promptLanguageFeatures"}constructor(i,e){super(),this._register(i.linkProvider.register(DK,e.createInstance(d0e))),this._register(i.completionProvider.register(DK,e.createInstance(u0e))),this._register(i.completionProvider.register(DK,e.createInstance(p0e))),this._register(i.hoverProvider.register(DK,e.createInstance(m0e))),this._register(i.definitionProvider.register(DK,e.createInstance(h0e))),this._register(i.documentSemanticTokensProvider.register(DK,e.createInstance(f0e))),this._register(i.codeActionProvider.register(DK,e.createInstance(v0e))),this._register(e.createInstance(nrt))}};jge=I([m(0,Qt),m(1,F)],jge);var nrt=class extends x{constructor(e,t,o,n,r,s,l){super();this.codeEditorService=e;this.markerService=o;this.promptsService=n;this.languageModelsService=r;this.languageModelToolsService=s;this.chatModeService=l;this.localDisposables=this._register(new N);this.validator=t.createInstance(g0e),this.updateRegistration()}updateRegistration(){this.localDisposables.clear();let e=new gt;this.localDisposables.add(Z(()=>{e.forEach(l=>l.dispose()),e.clear()}));let t=l=>{let c=l.getModel();if(!c)return;let u=Mw(c.getLanguageId());if(u){let p=e.get(c.uri);if(p){p.refCount++;return}e.set(c.uri,new _Ri(c,u,this.validator,this.promptsService,this.markerService))}},o=l=>{let c=e.get(l);c&&--c.refCount===0&&(c.dispose(),e.delete(l))},n=new Vt;this.localDisposables.add(n);let r=l=>{t(l);let c=new N;c.add(l.onDidChangeModel(u=>{u.oldModelUrl&&o(u.oldModelUrl),t(l)})),c.add(l.onDidChangeModelLanguage(u=>{let p=l.getModel();p&&(o(p.uri),t(l))})),n.set(l.getId(),c)};for(let l of this.codeEditorService.listCodeEditors())r(l);this.localDisposables.add(this.codeEditorService.onCodeEditorAdd(l=>{r(l)})),this.localDisposables.add(this.codeEditorService.onCodeEditorRemove(l=>{n.deleteAndDispose(l.getId());let c=l.getModel();c&&o(c.uri)}));let s=()=>e.forEach(l=>l.validate());this.localDisposables.add(this.languageModelToolsService.onDidChangeTools(()=>s())),this.localDisposables.add(this.chatModeService.onDidChangeChatModes(()=>s())),this.localDisposables.add(this.languageModelsService.onDidChangeLanguageModels(()=>s()))}};nrt=I([m(0,qt),m(1,F),m(2,oa),m(3,Or),m(4,ds),m(5,Vn),m(6,Fg)],nrt);var _Ri=class extends x{constructor(e,t,o,n,r){super();this.textModel=e;this.promptType=t;this.validator=o;this.promptsService=n;this.markerService=r;this.refCount=1;this.delayer=this._register(new Xo(200)),this._register(e.onDidChangeContent(()=>this.validate())),this.validate()}validate(){this.delayer.trigger(async()=>{let e=[],t=this.promptsService.getParsedPromptFile(this.textModel);await this.validator.validate(t,this.promptType,o=>e.push(o)),this._store.isDisposed||this.markerService.changeOne(ort,this.textModel.uri,e)})}dispose(){this.markerService.remove(ort,[this.textModel.uri]),super.dispose()}};var Trn=5,b0e=class{constructor(i,e,t,o,n,r,s,l,c){this.fileService=i;this.configService=e;this.workspaceService=t;this.environmentService=o;this.searchService=n;this.userDataService=r;this.logService=s;this.pathService=l;this.workspaceTrustManagementService=c;let u=this.userDataService.currentProfile.promptsHome;this.userDataFolder={uri:u,parent:u,filePattern:void 0,source:"copilot-personal",storage:"user",displayPath:d(8618,null),isDefault:!0}}getWorkspaceFolders(){return this.workspaceService.getWorkspace().folders}getWorkspaceFolder(i){return this.workspaceService.getWorkspaceFolder(i)??void 0}onDidChangeWorkspaceFolders(){return U.map(this.workspaceService.onDidChangeWorkspaceFolders,()=>{})}async getWorkspaceFolderRoots(i,e){let t=this.getWorkspaceFolders();if(i){let o=new En,n=await this.pathService.userHome();for(let r of t){o.add(r.uri);let s=await this.findParentRepoFolders(r.uri,n,o,e);for(let l of s)o.add(l)}return[...o]}return t.map(o=>o.uri)}async findParentRepoFolders(i,e,t,o){let n=[],r=i;for(;;){try{if(await this.fileService.exists(Ge(r,".git")))return(await this.workspaceTrustManagementService.getUriTrustInfo(r)).trusted?(n.push(r),n):(o?.logInfo(`Repository root found at ${r.toString()}, but it is not trusted. Skipping parent folder inclusion for this workspace folder.`),[])}catch(l){let c=l instanceof Error?l.message:String(l);return o?.logInfo(`No repository root found for folder ${i.toString()}. Error accessing ${Ge(r,".git")}: ${c}.`),[]}n.push(r);let s=ci(r);if(Qe(r,s)||r.path==="/"||Qe(e,s)||t.has(s))break;r=s}return o?.logInfo(`No repository root found for folder ${i.toString()}.`),[]}async listFiles(i,e,t){if(e!=="user"&&e!=="local")throw new Error(`Unsupported prompt file storage: ${e}`);let o=Ss.promptSourceFolders(this.configService,i),n=await this.toAbsoluteLocations(i,o.filter(s=>s.storage===e));e==="user"&&(i==="agent"||i==="instructions"||i==="prompt")&&n.push(this.userDataFolder);let r=new En;for(let{parent:s,filePattern:l}of n){let c=l===void 0?await this.resolveFilesAtLocation(s,i,t):await this.searchFilesInLocation(s,l,t);for(let u of c)e9e(u)===i&&r.add(u);if(t.isCancellationRequested)return[]}return[...r]}createFilesUpdatedEvent(i){let e=new N,t=e.add(new E),o=e.add(new Ye).token,n=e.add(new N),r=XTi(i),s=this.userDataService.currentProfile.promptsHome,l=[],c=()=>{n.clear();for(let p of l)if(!this.getWorkspaceFolder(p.parent)){let h=p.filePattern!==void 0||i==="instructions";n.add(this.fileService.watch(p.parent,{recursive:h,excludes:[]}))}},u=async()=>{try{let p=Ss.promptSourceFolders(this.configService,i);if(l=await this.toAbsoluteLocations(i,p,void 0),o.isCancellationRequested)return;c()}catch(p){this.logService.error("Error updating prompt file watchers after config change:",p)}};return e.add(this.configService.onDidChangeConfiguration(p=>{(p.affectsConfiguration(r)||p.affectsConfiguration(Ss.USE_CUSTOMIZATIONS_IN_PARENT_REPOS))&&(u(),t.fire())})),e.add(this.onDidChangeWorkspaceFolders()(()=>{u(),t.fire()})),e.add(this.workspaceTrustManagementService.onDidChangeTrustedFolders(()=>{u(),t.fire()})),e.add(this.fileService.onDidFilesChange(p=>{if(p.affects(s)){t.fire();return}if(l.some(h=>p.affects(h.parent))){t.fire();return}})),e.add(this.fileService.watch(s)),u(),{event:t.event,dispose:()=>e.dispose()}}async getHookSourceFolders(){let e=Ss.promptSourceFolders(this.configService,"hook").filter(n=>!n.path.startsWith(".claude/")&&!n.path.includes("/.claude/")),t=new En,o=await this.toAbsoluteLocations("hook",e);for(let n of o)t.add(n.parent);return[...t]}async getConfigBasedSourceFolders(i){let e=Ss.promptSourceFolders(this.configService,i),t=await this.toAbsoluteLocations(i,e);if(i!=="prompt"&&i!=="instructions")return t.map(n=>n.uri);let o=new En;for(let n of t){let r=n.uri,s=He(r),l=["*.md",`*${DLt(i)}`];for(let c of l)if(s===c){r=ci(r);continue}s==="*"&&(r=ci(r)),oIo(r.path)!==!0&&o.add(r)}return[...o]}async getResolvedSourceFolders(i){let e=await this.getLocalStorageFolders(i),t=e.filter(n=>n.storage==="local"),o=e.filter(n=>n.storage==="user");return this.dedupeSourceFolders([...t,...o])}async getSourceFoldersInDiscoveryOrder(i){let e=await this.getLocalStorageFolders(i),t=e.filter(n=>n.storage==="user"),o=e.filter(n=>n.storage==="local");return this.dedupeSourceFolders([...t,...o])}async getLocalStorageFolders(i){let e=Ss.promptSourceFolders(this.configService,i),t=aTe(i),o=[...t,...e.filter(r=>!t.some(s=>s.path===r.path))],n=await this.toAbsoluteLocations(i,o,t);return(i==="agent"||i==="instructions"||i==="prompt")&&n.push(this.userDataFolder),n}dedupeSourceFolders(i){let e=new En,t=[];for(let o of i)e.has(o.uri)||(e.add(o.uri),t.push(o));return t}async toAbsoluteLocations(i,e,t){let o=[],n=new En,r=await this.pathService.userHome(),s=await this.getWorkspaceFolderRoots(this.configService.getValue(Ss.USE_CUSTOMIZATIONS_IN_PARENT_REPOS)===!0),l=new Set(t?.map(u=>u.path)),c=e.filter(u=>{if(i==="instructions"||i==="prompt"){let h=u.path;return iIo(h)&&(i==="prompt"?this.logService.warn(`[Deprecated] Glob patterns (* and **) in prompt file locations are deprecated: "${h}". Consider using explicit paths instead.`):i==="instructions"&&this.logService.info(`Glob patterns (* and **) detected in instruction file location: "${h}". Consider using explicit paths for better performance.`)),!0}let p=u.path;return Drn(p)?!0:(this.logService.warn(`Skipping invalid path (glob patterns and absolute paths not supported): ${p}`),!1)});for(let u of c){let p=u.path,h=l?.has(p);try{if(Bit(p)){let g=Ge(r,p.substring(2));if(!n.has(g)){n.add(g);let{parent:f,filePattern:v}=DRi(i,g);o.push({uri:g,parent:f,filePattern:v,source:u.source,storage:u.storage,displayPath:p,isDefault:h})}continue}if(Zl(p)){let g=A.file(p),f=this.environmentService.remoteAuthority;if(f&&(g=g.with({scheme:Q.vscodeRemote,authority:f})),!n.has(g)){n.add(g);let{parent:v,filePattern:b}=DRi(i,g);o.push({uri:g,parent:v,filePattern:b,source:u.source,storage:u.storage,displayPath:p,isDefault:h})}}else for(let g of s){let f=Ge(g,p);if(!n.has(f)){n.add(f);let{parent:v,filePattern:b}=DRi(i,f);o.push({uri:f,parent:v,filePattern:b,source:u.source,storage:u.storage,displayPath:p,isDefault:h})}}}catch(g){this.logService.error(`Failed to resolve prompt file location: ${p}`,g)}}return o}async resolveFilesAtLocation(i,e,t,o=0){if(e==="skill")return this.findAgentSkillsInFolder(i,t);let n=o===0&&this.getWorkspaceFolders().some(s=>Qe(s.uri,i)),r=e==="instructions"&&!n&&!iIo(i.path)&&o<Trn;try{let s=await this.fileService.resolve(i);if(t.isCancellationRequested)return[];if(s.isFile)return[s.resource];if(s.isDirectory&&s.children){let l=[];for(let c of s.children)if(c.isFile)l.push(c.resource);else if(r&&c.isDirectory){let u=await this.resolveFilesAtLocation(c.resource,e,t,o+1);l.push(...u)}return l}}catch(s){s instanceof ta&&s.fileOperationResult===1||this.logService.error(`Failed to resolve files at location: ${i.toString()}`,s)}return[]}async searchFilesInLocation(i,e,t){if(!this.searchService.schemeHasFileSearchProvider(i.scheme))return this.logService.warn(`[PromptFilesLocator] No FileSearchProvider available for scheme '${i.scheme}'. Cannot search for pattern '${e}' in ${i.toString()}`),[];let o=this.configService.getValue("explorer.excludeGitIgnore"),n=this.getWorkspaceFolder(i),r=l=>KB(this.configService.getValue({resource:l}))||{},s={folderQueries:[{folder:i,disregardIgnoreFiles:o}],type:1,shouldGlobMatchFilePattern:!0,excludePattern:n?r(n.uri):void 0,ignoreGlobCase:!0,sortByScore:!0,filePattern:e};try{let l=await this.searchService.fileSearch(s,t);return t.isCancellationRequested?[]:l.results.map(c=>c.resource)}catch(l){if(!ao(l))throw l}return[]}async findAgentMDsInWorkspace(i){return(await Promise.all(this.getWorkspaceFolders().map(t=>this.findAgentMDsInFolder(t.uri,i)))).flat(1)}async findAgentMDsInFolder(i,e){if(this.searchService.schemeHasFileSearchProvider(i.scheme)){let t=this.configService.getValue("explorer.excludeGitIgnore"),o=r=>KB(this.configService.getValue({resource:r}))||{},n={folderQueries:[{folder:i,disregardIgnoreFiles:t}],type:1,shouldGlobMatchFilePattern:!0,excludePattern:o(i),filePattern:"**/AGENTS.md",ignoreGlobCase:!0};try{let r=await this.searchService.fileSearch(n,e);if(e.isCancellationRequested)return[];let s=[];for(let l of r.results)s.push({uri:l.resource,realPath:void 0,type:"agentsMd"});return s}catch(r){if(!ao(r))throw r}return[]}else return this.findAgentMDsUsingFileService(i,e)}async findAgentMDsUsingFileService(i,e){let t=[],o="agents.md",n=async r=>{if(!e.isCancellationRequested)try{let s=await this.fileService.resolve(r);if(s.isFile&&s.name.toLowerCase()===o){let l=s.isSymbolicLink?await this.fileService.realpath(s.resource):void 0;t.push({uri:s.resource,realPath:l,type:"agentsMd"})}else if(s.isDirectory&&s.children)for(let l of s.children)await n(l.resource)}catch(s){this.logService.trace(`[PromptFilesLocator] Error traversing ${r.toString()}: ${s}`)}};return await n(i),t}async findFilesInRoots(i,e,t,o,n=[]){let r=i.map(l=>({resource:e!==void 0?Ge(l,e):l})),s=await this.fileService.resolveAll(r);if(o.isCancellationRequested)return n;for(let l of s)if(l.success&&l.stat?.children){for(let c of l.stat.children)if(c.isFile){let u=t.find(p=>vr(p.fileName,c.name));if(u){let p=c.isSymbolicLink?await this.fileService.realpath(c.resource):void 0;n.push({uri:c.resource,realPath:p,type:u.type})}}}return n}getAgentFileURIFromModeFile(i){if(i.path.endsWith(AK)){let e,t=this.getWorkspaceFolder(i);return t?e=Ge(t.uri,NK,wf(i)+tJ):ws(i,this.userDataService.currentProfile.promptsHome)&&(e=Ge(this.userDataService.currentProfile.promptsHome,wf(i)+tJ)),e}}async findAgentSkillsInFolder(i,e){try{let t=[],o=await this.fileService.resolve(i);if(o.isDirectory&&o.children)for(let n of o.children)try{if(e.isCancellationRequested)return[];if(n.isDirectory){let r=Ge(n.resource,m4),s=await this.fileService.resolve(r);s.isFile&&t.push(s.resource)}}catch{}return t}catch(t){return ao(t)||this.logService.trace(`[PromptFilesLocator] Error searching for skills in ${i.toString()}: ${t}`),[]}}async findAgentSkills(i){let e=Ss.promptSourceFolders(this.configService,"skill"),t=await this.toAbsoluteLocations("skill",e),o=[];for(let{uri:n,source:r,storage:s}of t){if(i.isCancellationRequested)return[];let l=await this.findAgentSkillsInFolder(n,i);for(let c of l)o.push({uri:c,source:r,storage:s,type:"skill"})}return o}};b0e=I([m(0,fe),m(1,B),m(2,Pe),m(3,At),m(4,gg),m(5,ln),m(6,se),m(7,An),m(8,Nr)],b0e);function iIo(a){return a.includes("*")}function oIo(a){let i=!1,e=0,t=!1,o=0,n;for(let r of a){if(n==="\\"){n=r;continue}if(r==="*"||r==="?")return!0;if(r==="["){i=!0,e++,n=r;continue}if(r==="]"){i=!0,e--,n=r;continue}if(r==="{"){t=!0,o++;continue}if(r==="}"){t=!0,o--,n=r;continue}n=r}return!!(i&&e===0||t&&o===0)}function DRi(a,i){if(a==="hook"&&es(i)===".json"&&(i=ci(i)),a!=="instructions"&&a!=="prompt")return{parent:i};let e=i.path.split("/"),t=0;for(;t<e.length&&oIo(e[t])===!1;)t++;if(t===e.length)return{parent:i};let o=i.with({path:e.slice(0,t).join("/")});return t===e.length-1&&e[t]==="*"||e[t]===""?{parent:o}:{parent:o,filePattern:e.slice(t).join("/")}}var Qge="^(?![A-Za-z]:[\\\\/])(?!/)(?!~(?!/))(?!.*\\\\)(?!.*[*?\\[\\]{}]).*\\S.*$",_rn=new RegExp(Qge);function Drn(a){return _rn.test(a)}var C2t;function Lrn(){if(!C2t){C2t=new Map;for(let[a,i]of Object.entries(hg.claude))C2t.set(i,a)}return C2t}function LRi(a){return hg.claude[a]}function RRi(a){return Lrn().get(a)}function rrt(a,i,e){let t=new Map;if(!a||typeof a!="object")return{hooks:t,disabledAllHooks:!1};let o=a;if(o.disableAllHooks===!0)return{hooks:t,disabledAllHooks:!0};let n=o.hooks;if(!n||typeof n!="object")return{hooks:t,disabledAllHooks:!1};let r=n;for(let s of Object.keys(r)){let l=LRi(s)??v7e(s);if(!l)continue;let c=r[s];if(!Array.isArray(c))continue;let u=[];for(let p of c){let h=b7e(p,i,e);u.push(...h)}if(u.length>0){let p=t.get(l);p?p.hooks.push(...u):t.set(l,{hooks:u,originalId:s})}}return{hooks:t,disabledAllHooks:!1}}var nIo=hg["github-copilot"],x2t;function Rrn(){if(!x2t){x2t=new Map;for(let[a,i]of Object.entries(nIo))x2t.set(i,a)}return x2t}function srt(a){return nIo[a]}function MRi(a){return Rrn().get(a)}function Yge(a){let i=jo(a.path).toLowerCase(),e=ad(a.path);return(i==="settings.json"||i==="settings.local.json")&&e.endsWith(".claude")?"claude":"copilot"}function k2t(a,i,e){let t=new Map;if(!a||typeof a!="object")return t;let n=a.hooks;if(!n||typeof n!="object")return t;let r=n;for(let s of Object.keys(r)){let l=srt(s)??v7e(s);if(!l)continue;let c=r[s];if(!Array.isArray(c))continue;let u=[];for(let p of c){let h=b7e(p,i,e);u.push(...h)}u.length>0&&t.set(l,{hooks:u,originalId:s})}return t}function Xge(a,i,e,t){let o=Yge(a),n,r=!1;if(o==="claude"){let s=rrt(i,e,t);n=s.hooks,r=s.disabledAllHooks}else n=k2t(i,e,t);return{format:o,hooks:n,disabledAllHooks:r}}function rIo(a,i,e,t){let o=Yge(a),n;switch(o){case"claude":{if(i&&typeof i=="object"){let{disableAllHooks:r,...s}=i;n=rrt(s,e,t).hooks}else n=new Map;break}default:n=k2t(i,e,t);break}return{format:o,hooks:n,disabledAllHooks:!0}}function PRi(a){let i={type:"command",command:""};return a==="claude"?{matcher:"",hooks:[i]}:i}function Ub(a){return a===2||a===3}function gN(a){return!Ub(a)}function Mrn(a){return JSON.stringify([...a])}function Prn(a){let i=JSON.parse(a);return new Map(Array.isArray(i)?i:[])}var loe=class extends x{constructor(i,e){super();let t=rN({key:i,defaultValue:new Map,toStorage:Mrn,fromStorage:Prn});this._profileState=this._register(t(0,1,e)),this._workspaceState=this._register(t(1,1,e))}readEnabled(i,e){let t=this._workspaceState.read(e);if(t.has(i))return t.get(i)?3:1;let o=this._profileState.read(e);return o.has(i)?o.get(i)?2:0:2}setEnabled(i,e){switch(e){case 2:{this._deleteFromMap(this._profileState,i),this._deleteFromMap(this._workspaceState,i);break}case 0:{this._setInMap(this._profileState,i,!1),this._deleteFromMap(this._workspaceState,i);break}case 3:{this._setInMap(this._workspaceState,i,!0);break}case 1:{this._setInMap(this._workspaceState,i,!1);break}}}remove(i){this._deleteFromMap(this._profileState,i),this._deleteFromMap(this._workspaceState,i)}_setInMap(i,e,t){let o=i.get();if(o.get(e)===t)return;let n=new Map(o);n.set(e,t),i.set(n,void 0)}_deleteFromMap(i,e){let t=i.get();if(!t.has(e))return;let o=new Map(t);o.delete(e),i.set(o,void 0)}};loe=I([m(1,ce)],loe);var ARi=class extends Error{constructor(e){super("Skill file must have a name attribute");this.uri=e}},NRi=class extends Error{constructor(e){super("Skill file must have a description attribute");this.uri=e}},ORi=class extends Error{constructor(e,t,o){super(`Skill name must match folder name: expected "${o}" but got "${t}"`);this.uri=e;this.skillName=t;this.folderName=o}},S0e=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super();this.logger=e;this.labelService=t;this.modelService=o;this.instantiationService=n;this.userDataService=r;this.configurationService=s;this.fileService=l;this.filesConfigService=c;this.storageService=u;this.extensionService=p;this.telemetryService=h;this.workspaceService=g;this.pathService=f;this.contextKeyService=v;this.agentPluginService=b;this.workspaceTrustService=S;this.cachedParsedPromptFromModels=new gt;this._onDidLogDiscovery=this._register(new E);this.onDidLogDiscovery=this._onDidLogDiscovery.event;this.cachedFileLocations={};this.fileLocatorEvents={};this.contributedFiles={prompt:new gt,instructions:new gt,agent:new gt,skill:new gt,hook:new gt};this._contributedWhenKeys=new Set;this._contributedWhenClauses=new Map;this._onDidContributedWhenChange=this._register(new E);this._onDidChangeInstructions=this._register(new E);this._onDidPluginPromptFilesChange=this._register(new E);this._onDidPluginHooksChange=this._register(new E);this._pluginPromptFilesByType=new Map;this.promptFileProviders=[];this.disabledPromptsStorageKeyPrefix="chat.disabledPromptFiles.";this.fileLocator=this.createPromptFilesLocator(),this._register(this.modelService.onModelRemoved(w=>{this.cachedParsedPromptFromModels.delete(w.uri)})),this._register(this.contextKeyService.onDidChangeContext(w=>{if(w.affectsSome(this._contributedWhenKeys)){for(let k of Object.keys(this.cachedFileLocations))this.cachedFileLocations[k]=void 0;this._onDidContributedWhenChange.fire()}}));let y=this._register(new FRi(this.modelService)).onDidPromptChange;this.cachedCustomAgents=this._register(new Jge(w=>this.computeCustomAgents(w),()=>U.any(this.getFileLocatorEvent("agent"),U.filter(y,w=>w.promptType==="agent"),this._onDidContributedWhenChange.event,U.filter(this.configurationService.onDidChangeConfiguration,w=>w.affectsConfiguration(Ss.USE_CUSTOM_AGENT_HOOKS)),this._onDidPluginPromptFilesChange.event))),this.cachedSlashCommands=this._register(new Jge(w=>this.computePromptSlashCommands(w),()=>U.any(this.getFileLocatorEvent("prompt"),this.getFileLocatorEvent("skill"),U.filter(y,w=>w.promptType==="prompt"),U.filter(y,w=>w.promptType==="skill"),this._onDidContributedWhenChange.event,this._onDidPluginPromptFilesChange.event))),this.cachedSkills=this._register(new Jge(w=>this.computeAgentSkills(w),()=>U.any(this.getFileLocatorEvent("skill"),U.filter(y,w=>w.promptType==="skill"),this._onDidContributedWhenChange.event,this._onDidPluginPromptFilesChange.event))),this.cachedHooks=this._register(new Jge(w=>this.computeHooks(w),()=>U.any(this.getFileLocatorEvent("hook"),U.filter(this.configurationService.onDidChangeConfiguration,w=>w.affectsConfiguration(Ss.USE_CHAT_HOOKS)||w.affectsConfiguration(Ss.USE_CLAUDE_HOOKS)),this._onDidPluginHooksChange.event,this.workspaceTrustService.onDidChangeTrust))),this.cachedInstructions=this._register(new Jge(w=>this.computeInstructionFiles(w),()=>U.any(this.getFileLocatorEvent("instructions"),this._onDidContributedWhenChange.event,this._onDidChangeInstructions.event,this._onDidPluginPromptFilesChange.event))),this._register(this.watchPluginPromptFilesForType("prompt",(w,k)=>w.commands.read(k))),this._register(this.watchPluginPromptFilesForType("skill",(w,k)=>w.skills.read(k))),this._register(this.watchPluginPromptFilesForType("agent",(w,k)=>w.agents.read(k))),this._register(this.watchPluginPromptFilesForType("instructions",(w,k)=>w.instructions.read(k))),this._register(be(w=>{let k=this.agentPluginService.plugins.read(w),T=[];for(let P of k)if(Ub(P.enablement.read(w)))for(let O of P.hooks.read(w))T.push({uri:O.uri,storage:"plugin",type:"hook",name:ZTi(P,O.originalId),pluginUri:P.uri,source:"plugin"});this._pluginPromptFilesByType.set("hook",T),this.cachedFileLocations.hook=void 0,this._onDidPluginHooksChange.fire()}))}watchPluginPromptFilesForType(e,t){return be(o=>{let n=this.agentPluginService.plugins.read(o),r=[];for(let s of n)if(Ub(s.enablement.read(o)))for(let l of t(s,o))r.push({uri:l.uri,storage:"plugin",type:e,name:ZTi(s,l.name),pluginUri:s.uri,source:"plugin"});r.sort((s,l)=>`${s.name??""}|${s.uri.toString()}`.localeCompare(`${l.name??""}|${l.uri.toString()}`)),this._pluginPromptFilesByType.set(e,r),this.cachedFileLocations[e]=void 0,this._onDidPluginPromptFilesChange.fire()})}createPromptFilesLocator(){return this.instantiationService.createInstance(b0e)}getFileLocatorEvent(e){let t=this.fileLocatorEvents[e];return t||(t=this.fileLocatorEvents[e]=this._register(this.fileLocator.createFilesUpdatedEvent(e)).event,this._register(t(()=>{this.cachedFileLocations[e]=void 0}))),t}getParsedPromptFile(e){let t=this.cachedParsedPromptFromModels.get(e.uri);if(t&&t[0]===e.getVersionId())return t[1];let o=new gXe().parse(e.uri,e.getValue());return(!t||t[0]<e.getVersionId())&&this.cachedParsedPromptFromModels.set(e.uri,[e.getVersionId(),o]),o}async listPromptFiles(e,t){let o=this.cachedFileLocations[e];return o||(o=this.computeListPromptFiles(e,t),this.fileLocatorEvents[e]&&(this.cachedFileLocations[e]=o),o)}async computeListPromptFiles(e,t){return(await Promise.all([this.fileLocator.listFiles(e,"user",t).then(n=>n.map(r=>({uri:r,storage:"user",type:e}))),this.fileLocator.listFiles(e,"local",t).then(n=>n.map(r=>({uri:r,storage:"local",type:e}))),this.getExtensionPromptFiles(e,t),this._pluginPromptFilesByType.get(e)??[]])).flat()}async _collectSourceFolderDiagnostics(e){return(await this.fileLocator.getSourceFoldersInDiscoveryOrder(e)).map(o=>({uri:o.uri,storage:o.storage}))}registerPromptFileProvider(e,t,o){let n={extension:e,type:t,...o};this.promptFileProviders.push(n);let r=new N;return o.onDidChangePromptFiles&&r.add(o.onDidChangePromptFiles(()=>{this.invalidatePromptFileCache(t)})),this.invalidatePromptFileCache(t),r.add({dispose:()=>{let s=this.promptFileProviders.findIndex(l=>l===n);s>=0&&(this.promptFileProviders.splice(s,1),this.invalidatePromptFileCache(t))}}),r}invalidatePromptFileCache(e){e==="agent"?(this.cachedFileLocations.agent=void 0,this.cachedCustomAgents.refresh()):e==="instructions"?(this.cachedFileLocations.instructions=void 0,this._onDidChangeInstructions.fire()):e==="prompt"?(this.cachedFileLocations.prompt=void 0,this.cachedSlashCommands.refresh()):e==="skill"&&(this.cachedFileLocations.skill=void 0,this.cachedSkills.refresh(),this.cachedSlashCommands.refresh())}async listFromProviders(e,t,o){let n=[];await this.extensionService.activateByEvent(t);let r=this.promptFileProviders.filter(s=>s.type===e);if(r.length===0)return n;for(let s of r)try{let l=await s.providePromptFiles({},o);if(!l||o.isCancellationRequested)continue;for(let c of l){try{await this.filesConfigService.updateReadonly(c.uri,!0)}catch(u){let p=u instanceof Error?u.message:String(u);this.logger.error(`[listFromProviders] Failed to make file readonly: ${c.uri}`,p)}n.push({uri:c.uri,storage:"extension",type:e,extension:s.extension,source:"extension-api",name:c.name,description:c.description})}}catch(l){this.logger.error(`[listFromProviders] Failed to get ${e} files from provider`,l instanceof Error?l.message:String(l))}return n}async listPromptFilesForStorage(e,t,o){switch(t){case"extension":return this.getExtensionPromptFiles(e,o);case"local":return this.fileLocator.listFiles(e,"local",o).then(n=>n.map(r=>({uri:r,storage:"local",type:e})));case"user":return this.fileLocator.listFiles(e,"user",o).then(n=>n.map(r=>({uri:r,storage:"user",type:e})));case"plugin":return this._pluginPromptFilesByType.get(e)??[];default:throw new Error(`[listPromptFilesForStorage] Unsupported prompt storage type: ${t}`)}}async getExtensionPromptFiles(e,t){await this.extensionService.whenInstalledExtensionsRegistered();let n=(await Promise.allSettled(this.contributedFiles[e].values())).filter(l=>l.status==="fulfilled").map(l=>l.value).filter(l=>{if(!l.when)return!0;let c=C.deserialize(l.when);return c?this.contextKeyService.contextMatchesRules(c):(this.logger.warn(`[getExtensionPromptFiles] Ignoring contributed prompt file with invalid when clause: ${l.when}`),!1)}),r=this.getProviderActivationEvent(e);if(!r)return n;let s=await this.listFromProviders(e,r,t);return[...n,...s]}getProviderActivationEvent(e){switch(e){case"agent":return Oeo;case"instructions":return Feo;case"prompt":return Weo;case"skill":return Veo;case"hook":return}}async getSourceFolders(e){let t=[];if(e==="hook"){let o=await this.fileLocator.getHookSourceFolders();for(let n of o)t.push({uri:n,storage:"local",type:e})}else for(let o of await this.fileLocator.getConfigBasedSourceFolders(e))t.push({uri:o,storage:"local",type:e});if(e!=="skill"&&e!=="hook"){let o=this.userDataService.currentProfile.promptsHome;t.push({uri:o,storage:"user",type:e})}return t}async getResolvedSourceFolders(e){return this.fileLocator.getResolvedSourceFolders(e)}get onDidChangeSlashCommands(){return this.cachedSlashCommands.onDidChangePromise}async getPromptSlashCommands(e,t){let o=Dn.create(),n=await this.cachedSlashCommands.get(e);if(t){let r=o.elapsed();this.getPromptSlashCommandDiscoveryInfo(e).catch(()=>{}).then(s=>{let l=n.length===1?d(8615,null,n.length,r.toFixed(1)):d(8616,null,n.length,r.toFixed(1));this._onDidLogDiscovery.fire({sessionResource:t,name:d(8606,null),details:l,discoveryInfo:s,category:"discovery"})})}return n}async computePromptSlashCommands(e){let t=await this.listPromptFiles("prompt",e),n=this.configurationService.getValue(Ss.USE_AGENT_SKILLS)?await this.listPromptFiles("skill",e):[],r=this.getDisabledPromptFiles("skill"),s=[...t,...n.filter(p=>!r.has(p.uri))],l=await Promise.all(s.map(async p=>{try{let h=await this.parseNew(p.uri,e);return this.asChatPromptSlashCommand(h,p)}catch(h){this.logger.error(`[computePromptSlashCommands] Failed to parse prompt file for slash command: ${p.uri}`,h instanceof Error?h.message:String(h));return}})),c=[],u=new En;for(let p of l)p&&(c.push(p),u.add(p.promptPath.uri));for(let p of this.modelService.getModels())if(p.getLanguageId()===cT&&p.uri.scheme===Q.untitled&&!u.has(p.uri)){let h=this.getParsedPromptFile(p);c.push(this.asChatPromptSlashCommand(h,{uri:p.uri,storage:"local",type:"prompt"}))}return c}isValidSlashCommandName(e){return e.match(/^[\p{L}\d_\-\.:]+$/u)!==null}async resolvePromptSlashCommand(e,t){return(await this.getPromptSlashCommands(t)).find(n=>n.name===e)}asChatPromptSlashCommand(e,t){let o=e?.header?.name??t.name??wf(t.uri);return o=o.replace(/[^\p{L}\d_\-\.:]+/gu,"-"),{name:o,description:e?.header?.description??t.description,argumentHint:e?.header?.argumentHint,parsedPromptFile:e,promptPath:t,when:void 0}}async getPromptSlashCommandName(e,t){let n=(await this.getPromptSlashCommands(t)).find(r=>Qe(r.promptPath.uri,e));return n?n.name:wf(e)}get onDidChangeCustomAgents(){return this.cachedCustomAgents.onDidChangePromise}get onDidChangeInstructions(){return this.cachedInstructions.onDidChangePromise}async getCustomAgents(e,t){let o=Dn.create(),n=await this.cachedCustomAgents.get(e);if(t){let r=o.elapsed();this.getAgentDiscoveryInfo(e).catch(()=>{}).then(s=>{let l=n.length===1?d(8607,null,n.length,r.toFixed(1)):d(8608,null,n.length,r.toFixed(1));this._onDidLogDiscovery.fire({sessionResource:t,name:d(8602,null),details:l,discoveryInfo:s,category:"discovery"})})}return n}async computeCustomAgents(e){let t=await this.listPromptFiles("agent",e),o=this.getDisabledPromptFiles("agent");t=t.filter(u=>!o.has(u.uri));let n=await this.pathService.userHome(),r=n.scheme===Q.file?n.fsPath:n.path,s=this.workspaceService.getWorkspace().folders[0],l=await Promise.allSettled(t.map(async u=>{let p=u.uri,h=await this.parseNew(p,e),g;if(h.header){let ae=h.header.getAttribute(io.advancedOptions);if(ae&&ae.value.type==="map"){g={};for(let[he,oe]of Object.entries(ae.value))oe.type==="scalar"&&(g[he]=oe)}}let f=[];if(h.body){let ae=h.body.offset,he=h.body.variableReferences;for(let oe=he.length-1;oe>=0;oe--){let{name:de,offset:Ce}=he[oe],xe=new pi(Ce-ae,Ce-ae+de.length+1);f.push({name:de,range:xe})}}let v={content:h.body?.getContent()??"",toolReferences:f,metadata:g},b=h.header?.name??u.name??wf(p),S=TD("agent",h.header??p),y=sIo.fromPromptPath(u);if(!h.header)return{uri:p,name:b,agentInstructions:v,source:y,target:S,visibility:{userInvocable:!0,agentInvocable:!0}};let w={userInvocable:h.header.userInvocable!==!1,agentInvocable:h.header.infer!==void 0?h.header.infer===!0:h.header.disableModelInvocation!==!0},k=h.header.model;S==="claude"&&k&&(k=Kso(k));let{description:T,tools:P,handOffs:O,argumentHint:V,agents:H}=h.header;S==="claude"&&P&&(P=Gso(P));let G,$=this.configurationService.getValue(Ss.USE_CUSTOM_AGENT_HOOKS),J=h.header.hooksRaw;if($&&J){let he=(this.workspaceService.getWorkspaceFolder(p)??s)?.uri;G=Eoo(J,he,r,S)}return{uri:p,name:b,description:T,model:k,tools:P,handOffs:O,argumentHint:V,target:S,visibility:w,agents:H,hooks:G,agentInstructions:v,source:y}})),c=[];for(let u=0;u<l.length;u++){let p=l[u];if(p.status==="fulfilled")c.push(p.value);else{let h=t[u].uri,g=p.reason;g instanceof ta&&g.fileOperationResult===1?this.logger.warn(`[computeCustomAgents] Skipping agent file that does not exist: ${h}`,g.message):this.logger.error(`[computeCustomAgents] Failed to parse agent file: ${h}`,g)}}return c}async parseNew(e,t){let o=this.modelService.getModel(e);if(o)return this.getParsedPromptFile(o);let n=await this.fileService.readFile(e);if(t.isCancellationRequested)throw new go;return new gXe().parse(e,n.value.toString())}registerContributedFile(e,t,o,n,r,s){let l=this.contributedFiles[e];if(l.has(t))return x.None;let c=(async()=>{if(e==="skill")try{let p=await this.validateAndSanitizeSkillFile(t,Se.None);n=p.name,r=p.description}catch(p){let h=p instanceof Error?p.message:String(p);throw this.logger.error(`[registerContributedFile] Extension '${o.identifier.value}' failed to validate skill file: ${t}`,h),p}try{await this.filesConfigService.updateReadonly(t,!0)}catch(p){let h=p instanceof Error?p.message:String(p);this.logger.error(`[registerContributedFile] Failed to make prompt file readonly: ${t}`,h)}return{uri:t,name:n,description:r,when:s,storage:"extension",type:e,extension:o,source:"extension-contribution"}})();l.set(t,c),s&&this._contributedWhenClauses.set(`${e}/${t.toString()}`,s);let u=()=>{switch(this._updateContributedWhenKeys(),this.cachedFileLocations[e]=void 0,e){case"agent":this.cachedCustomAgents.refresh();break;case"prompt":this.cachedSlashCommands.refresh();break;case"skill":this.cachedSkills.refresh(),this.cachedSlashCommands.refresh();break}};return u(),{dispose:()=>{l.delete(t),this._contributedWhenClauses.delete(`${e}/${t.toString()}`),u()}}}_updateContributedWhenKeys(){this._contributedWhenKeys.clear();for(let e of this._contributedWhenClauses.values()){let t=C.deserialize(e);for(let o of t?.keys()??[])this._contributedWhenKeys.add(o)}}getPromptLocationLabel(e){switch(e.storage){case"local":return this.labelService.getUriLabel(ci(e.uri),{relative:!0});case"user":return d(8617,null);case"extension":return d(8600,null,e.extension.displayName??e.extension.id);case"plugin":return d(8601,null);default:os(e,"Unknown prompt storage type")}}async listNestedAgentMDs(e){return this.configurationService.getValue(Ss.USE_AGENT_MD)?this.configurationService.getValue(Ss.USE_NESTED_AGENT_MD)?await this.fileLocator.findAgentMDsInWorkspace(e):[]:[]}async listAgentInstructions(e,t){let o=[],n=[],r=this.configurationService.getValue(Ss.USE_CUSTOMIZATIONS_IN_PARENT_REPOS)===!0,s=await this.fileLocator.getWorkspaceFolderRoots(r,t),l=[];if(this.configurationService.getValue(Ss.USE_AGENT_MD)?l.push({fileName:h4,type:"agentsMd"}):t?.logInfo("Agent MD files are disabled via configuration."),!this.configurationService.getValue(Ss.USE_CLAUDE_MD))t?.logInfo("Claude MD files are disabled via configuration.");else{let b={fileName:CLt,type:"claudeMd"};l.push(b),l.push({fileName:xLt,type:"claudeMd"}),n.push(this.fileLocator.findFilesInRoots(s,Y6e,[b],e,o)),n.push(this.fileLocator.findFilesInRoots([await this.pathService.userHome()],Y6e,[b],e,o))}if(!this.configurationService.getValue(Ss.USE_COPILOT_INSTRUCTION_FILES))t?.logInfo("Copilot instructions files are disabled via configuration.");else{let b=[{fileName:sTe,type:"copilotInstructionsMd"}];n.push(this.fileLocator.findFilesInRoots(s,ito,b,e,o))}if(n.push(this.fileLocator.findFilesInRoots(s,void 0,l,e,o)),await Promise.all(n),e.isCancellationRequested)return[];let h=new En,g=[],f=[],v=b=>(b.realPath?g.push(b):(f.push(b),h.add(b.uri)),!0);o.forEach(v);for(let b of g)h.has(b.realPath)?t?.logInfo(`Skipping symlinked agent instructions file ${b.uri} as target already included: ${b.realPath}`):(f.push(b),h.add(b.realPath));return f.sort((b,S)=>b.uri.toString().localeCompare(S.uri.toString()))}getAgentFileURIFromModeFile(e){return this.fileLocator.getAgentFileURIFromModeFile(e)}getDisabledPromptFiles(e){let t=this.disabledPromptsStorageKeyPrefix+e,o=this.storageService.get(t,0,"[]"),n=new En;try{let r=JSON.parse(o);if(Array.isArray(r))for(let s of r)try{n.add(A.revive(s))}catch{}}catch{}return n}setDisabledPromptFiles(e,t){let o=Array.from(t).map(n=>n.toJSON());this.storageService.store(this.disabledPromptsStorageKeyPrefix+e,JSON.stringify(o),0,0),e==="agent"?this.cachedCustomAgents.refresh():e==="skill"&&(this.cachedSkills.refresh(),this.cachedSlashCommands.refresh())}sanitizeAgentSkillText(e){return e.replace(/<[^>]+>/g,"")}async validateAndSanitizeSkillFile(e,t){let o=await this.parseNew(e,t),n=o.header?.name;if(!n)throw this.logger.error(`[validateAndSanitizeSkillFile] Agent skill file missing name attribute: ${e}`),new ARi(e);if(!o.header?.description)throw this.logger.error(`[validateAndSanitizeSkillFile] Agent skill file missing description attribute: ${e}`),new NRi(e);let s=this.truncateAgentSkillName(n,e),l=t9e(e);if(s!==l)throw this.logger.error(`[validateAndSanitizeSkillFile] Agent skill name "${s}" does not match folder name "${l}": ${e}`),new ORi(e,s,l);let c=this.truncateAgentSkillDescription(o.header?.description,e);return{name:s,description:c}}truncateAgentSkillName(e,t){let n=this.sanitizeAgentSkillText(e);return n!==e&&this.logger.debug(`[findAgentSkills] Agent skill name contains XML tags, removed: ${t}`),n.length>64?(this.logger.debug(`[findAgentSkills] Agent skill name exceeds 64 characters, truncated: ${t}`),n.substring(0,64)):n}truncateAgentSkillDescription(e,t){if(!e)return;let o=1024,n=this.sanitizeAgentSkillText(e);return n!==e&&this.logger.debug(`[findAgentSkills] Agent skill description contains XML tags, removed: ${t}`),n.length>o?(this.logger.debug(`[findAgentSkills] Agent skill description exceeds ${o} characters, truncated: ${t}`),n.substring(0,o)):n}get onDidChangeSkills(){return this.cachedSkills.onDidChangePromise}async findAgentSkills(e,t){if(!this.configurationService.getValue(Ss.USE_AGENT_SKILLS))return;let n=Dn.create(),r=await this.cachedSkills.get(e);if(t){let s=n.elapsed();this.getSkillDiscoveryInfo(e).catch(()=>{}).then(l=>{let c=r.length===1?d(8613,null,r.length,s.toFixed(1)):d(8614,null,r.length,s.toFixed(1));this._onDidLogDiscovery.fire({sessionResource:t,name:d(8605,null),details:c,discoveryInfo:l,category:"discovery"})})}return r}async computeAgentSkills(e){let t=await this.computeSkillDiscoveryInfo(e),o=[],n=new Map;for(let p of t)if(p.status==="loaded"&&p.promptPath.name){let h=this.truncateAgentSkillDescription(p.promptPath.description,p.promptPath.uri);o.push({uri:p.promptPath.uri,storage:p.promptPath.storage,name:p.promptPath.name,description:h,disableModelInvocation:p.disableModelInvocation??!1,userInvocable:p.userInvocable??!0,when:void 0,pluginUri:p.promptPath.pluginUri,extension:p.promptPath.extension});let g=p.promptPath.source;g&&n.set(g,(n.get(g)||0)+1)}let r=0,s=0,l=0,c=0,u=0;for(let p of t)if(p.status==="skipped")switch(p.skipReason){case"missing-name":r++;break;case"missing-description":s++;break;case"duplicate-name":l++;break;case"name-mismatch":u++;break;case"parse-error":c++;break}return this.telemetryService.publicLog2("agentSkillsFound",{totalSkillsFound:o.length,claudePersonal:n.get("claude-personal")??0,claudeWorkspace:n.get("claude-workspace")??0,copilotPersonal:n.get("copilot-personal")??0,githubWorkspace:n.get("github-workspace")??0,agentsPersonal:n.get("agents-personal")??0,agentsWorkspace:n.get("agents-workspace")??0,configWorkspace:n.get("config-workspace")??0,configPersonal:n.get("config-personal")??0,extensionContribution:n.get("extension-contribution")??0,extensionAPI:n.get("extension-api")??0,plugin:n.get("plugin")??0,skippedDuplicateName:l,skippedMissingName:r,skippedMissingDescription:s,skippedNameMismatch:u,skippedParseFailed:c}),o}async getHooks(e,t){let o=Dn.create(),n=await this.cachedHooks.get(e);if(t){let r=o.elapsed();this.getHookDiscoveryInfo(e).catch(()=>{}).then(s=>{let l=n?Object.values(n.hooks).reduce((u,p)=>u+p.length,0):0,c=l===1?d(8609,null,l,r.toFixed(1)):d(8610,null,l,r.toFixed(1));this._onDidLogDiscovery.fire({sessionResource:t,name:d(8603,null),details:c,discoveryInfo:s,category:"discovery"})})}return n}async getInstructionFiles(e,t){let o=Dn.create(),n=await this.cachedInstructions.get(e),r=n.files.filter(s=>s.status==="loaded").map(s=>s.promptPath);if(t){let s=o.elapsed(),l=r.length===1?d(8611,null,r.length,s.toFixed(1)):d(8612,null,r.length,s.toFixed(1));this._onDidLogDiscovery.fire({sessionResource:t,name:d(8604,null),details:l,discoveryInfo:n,category:"discovery"})}return r}withPromptPathMetadata(e,t,o){return{...e,name:t,description:o}}async computeInstructionFiles(e){return await this.getInstructionsDiscoveryInfo(e)}async computeHooks(e){if(!this.configurationService.getValue(Ss.USE_CHAT_HOOKS)||!this.workspaceTrustService.isWorkspaceTrusted())return;let o=this.configurationService.getValue(Ss.USE_CLAUDE_HOOKS),n=await this.listPromptFiles("hook",e);this.logger.trace(`[PromptsService] Found ${n.length} hook file(s).`);let r=await this.pathService.userHome(),s=r.scheme===Q.file?r.fsPath:r.path,l=!1,c=new Map,u=this.workspaceService.getWorkspace().folders[0];for(let g of n)if(g.storage!=="plugin")try{let f=await this.fileService.readFile(g.uri),v=jr(f.value.toString()),S=(this.workspaceService.getWorkspaceFolder(g.uri)??u)?.uri,{format:y,hooks:w,disabledAllHooks:k}=Xge(g.uri,v,S,s);if(k){this.logger.trace(`[PromptsService] Skipping hook file with disableAllHooks: ${g.uri}`);continue}if(y==="claude"&&o===!1){[...w.values()].some(({hooks:P})=>P.length>0)&&(l=!0),this.logger.trace(`[PromptsService] Skipping Claude hook file (disabled via setting): ${g.uri}`);continue}for(let[T,{hooks:P}]of w)for(let O of P){let V=c.get(T);V||(V=[],c.set(T,V)),V.push(O),this.logger.trace(`[PromptsService] Collected ${T} hook from ${g.uri} (format: ${y})`)}}catch(f){this.logger.warn(`[PromptsService] Failed to parse hook file: ${g.uri}`,f)}let p=this.agentPluginService.plugins.get();for(let g of p)if(Ub(g.enablement.get()))for(let f of g.hooks.get()){let v=c.get(f.type);v||(v=[],c.set(f.type,v)),v.push(...f.hooks)}if(c.size===0){this.logger.trace("[PromptsService] No valid hooks collected.");return}let h=Object.fromEntries(c);return this.logger.trace(`[PromptsService] Collected hooks: ${JSON.stringify(Object.keys(h))}`),{hooks:h,hasDisabledClaudeHooks:l}}async getSkillDiscoveryInfo(e){if(!this.configurationService.getValue(Ss.USE_AGENT_SKILLS)){let s=(await this.listPromptFiles("skill",e)).map(c=>({status:"skipped",skipReason:"disabled",promptPath:c})),l=await this._collectSourceFolderDiagnostics("skill");return{type:"skill",files:s,sourceFolders:l}}let o=await this.computeSkillDiscoveryInfo(e),n=await this._collectSourceFolderDiagnostics("skill");return{type:"skill",files:o,sourceFolders:n}}async computeSkillDiscoveryInfo(e){let t=[],o=new Set,n=new Map,r=[],s=await this.fileLocator.findAgentSkills(e),l=await this.getExtensionPromptFiles("skill",e),c=this._pluginPromptFilesByType.get("skill")??[];r.push(...s,...l,...c);let u=p=>p.storage==="local"?0:p.storage==="user"?1:p.storage==="plugin"?2:p.source==="extension-api"?3:p.source==="extension-contribution"?4:5;r.sort((p,h)=>u(p)-u(h));for(let p of r){let h=p.uri,g=p;try{let f=await this.parseNew(h,e),v=t9e(h),b=f.header?.name,S=f.header?.description;b||(this.logger.debug(`[computeSkillDiscoveryInfo] Agent skill file missing name attribute, using folder name "${v}": ${h}`),b=v);let y=this.truncateAgentSkillName(b,h);if(y!==v&&(this.logger.debug(`[computeSkillDiscoveryInfo] Agent skill name "${y}" does not match folder name "${v}", using folder name: ${h}`),y=v),o.has(y)){this.logger.debug(`[computeSkillDiscoveryInfo] Skipping duplicate agent skill name: ${y} at ${h}`),t.push({status:"skipped",skipReason:"duplicate-name",duplicateOf:n.get(y),promptPath:this.withPromptPathMetadata(g,y,S)});continue}o.add(y),n.set(y,h);let w=f.header?.disableModelInvocation===!0,k=f.header?.userInvocable!==!1;t.push({status:"loaded",promptPath:this.withPromptPathMetadata(g,y,S),disableModelInvocation:w,userInvocable:k})}catch(f){let v=f instanceof Error?f.message:String(f);this.logger.error(`[computeSkillDiscoveryInfo] Failed to validate Agent skill file: ${h}`,v),t.push({status:"skipped",skipReason:"parse-error",errorMessage:v,promptPath:g})}}return t}async getAgentDiscoveryInfo(e){let t=[],o=this.getDisabledPromptFiles("agent"),n=await this.listPromptFiles("agent",e);for(let s of n){let{uri:l}=s;if(o.has(l)){t.push({status:"skipped",skipReason:"disabled",promptPath:s});continue}try{let c=await this.parseNew(l,e),u=c.header?.name??s.name??wf(l),p=c.header?.description??s.description;t.push({status:"loaded",promptPath:this.withPromptPathMetadata(s,u,p)})}catch(c){t.push({status:"skipped",skipReason:"parse-error",errorMessage:c instanceof Error?c.message:String(c),promptPath:s})}}let r=await this._collectSourceFolderDiagnostics("agent");return{type:"agent",files:t,sourceFolders:r}}async getPromptSlashCommandDiscoveryInfo(e){let t=[],o=await this.listPromptFiles("prompt",e);for(let r of o){let{uri:s}=r;try{let l=await this.parseNew(s,e),c=l?.header?.name??r.name??wf(s),u=l?.header?.description??r.description;t.push({status:"loaded",promptPath:this.withPromptPathMetadata(r,c,u)})}catch(l){t.push({status:"skipped",skipReason:"parse-error",errorMessage:l instanceof Error?l.message:String(l),promptPath:r})}}let n=await this._collectSourceFolderDiagnostics("prompt");return{type:"prompt",files:t,sourceFolders:n}}async getInstructionsDiscoveryInfo(e){let t=[],o=await this.listPromptFiles("instructions",e);for(let r of o){let s=r.uri;try{let l=await this.parseNew(s,e),c=l?.header?.name??r.name??wf(s),u=l?.header?.description??r.description;t.push({status:"loaded",promptPath:this.withPromptPathMetadata(r,c,u)})}catch(l){t.push({status:"skipped",skipReason:"parse-error",errorMessage:l instanceof Error?l.message:String(l),promptPath:r})}}let n=await this._collectSourceFolderDiagnostics("instructions");return{type:"instructions",files:t,sourceFolders:n}}async getHookDiscoveryInfo(e){let t=[],o=await this.pathService.userHome(),n=o.scheme===Q.file?o.fsPath:o.path,r=this.configurationService.getValue(Ss.USE_CLAUDE_HOOKS),s=await this.listPromptFiles("hook",e);for(let c of s){let{uri:u}=c,p=He(u);if(!this.workspaceTrustService.isWorkspaceTrusted()){t.push({status:"skipped",skipReason:"workspace-untrusted",promptPath:this.withPromptPathMetadata(c,He(c.uri),c.description)});continue}if(Yge(u)==="claude"&&r===!1){t.push({status:"skipped",skipReason:"claude-hooks-disabled",promptPath:this.withPromptPathMetadata(c,p,c.description)});continue}try{let h=await this.fileService.readFile(u),g=jr(h.value.toString());if(!g||typeof g!="object"){t.push({status:"skipped",skipReason:"parse-error",errorMessage:"Invalid hooks file: must be a JSON object",promptPath:this.withPromptPathMetadata(c,p,c.description)});continue}let v=(this.workspaceService.getWorkspaceFolder(u)??this.workspaceService.getWorkspace().folders[0])?.uri,{disabledAllHooks:b}=Xge(u,g,v,n);if(b){t.push({status:"skipped",skipReason:"all-hooks-disabled",promptPath:this.withPromptPathMetadata(c,p,c.description)});continue}t.push({status:"loaded",promptPath:this.withPromptPathMetadata(c,p,c.description)})}catch(h){t.push({status:"skipped",skipReason:"parse-error",errorMessage:h instanceof Error?h.message:String(h),promptPath:this.withPromptPathMetadata(c,p,c.description)})}}let l=await this._collectSourceFolderDiagnostics("hook");return{type:"hook",files:t,sourceFolders:l}}};S0e=I([m(0,se),m(1,rt),m(2,Tt),m(3,F),m(4,ln),m(5,B),m(6,fe),m(7,gr),m(8,ce),m(9,lt),m(10,Te),m(11,Pe),m(12,An),m(13,X),m(14,Gg),m(15,Nr)],S0e);var Jge=class extends x{constructor(e,t,o=0){super();this.computeFn=e;this.getEvent=t;this.delay=o;this.cachedPromise=void 0;this.onDidUpdatePromiseEmitter=this._register(new E);let n=this._register(new Xo(this.delay));this._register(this.getEvent()(()=>{this.cachedPromise=void 0,n.trigger(()=>this.onDidUpdatePromiseEmitter.fire())}))}get onDidChangePromise(){return this.onDidUpdatePromiseEmitter.event}get(e){if(this.cachedPromise!==void 0)return this.cachedPromise;let t=this.computeFn(e).catch(o=>{throw this.cachedPromise===t&&(this.cachedPromise=void 0),o});return this.cachedPromise=t,t}refresh(){this.cachedPromise=void 0,this.onDidUpdatePromiseEmitter?.fire()}},FRi=class extends x{constructor(e){super();this.listeners=new gt;this.onDidPromptModelChange=this._register(new E);let t=n=>{let r=Mw(n.getLanguageId());return r!==void 0&&this.listeners.set(n.uri,n.onDidChangeContent(()=>this.onDidPromptModelChange.fire({uri:n.uri,promptType:r}))),r},o=(n,r)=>{let s=Mw(n);return s!==void 0&&(this.listeners.get(r)?.dispose(),this.listeners.delete(r)),s};this._register(e.onModelAdded(n=>t(n))),this._register(e.onModelLanguageChanged(n=>{let r=o(n.oldLanguageId,n.model.uri),s=t(n.model);r!==s&&(r&&this.onDidPromptModelChange.fire({uri:n.model.uri,promptType:r}),s&&this.onDidPromptModelChange.fire({uri:n.model.uri,promptType:s}))})),this._register(e.onModelRemoved(n=>o(n.getLanguageId(),n.uri)))}get onDidPromptChange(){return this.onDidPromptModelChange.event}dispose(){super.dispose(),this.listeners.forEach(e=>e.dispose()),this.listeners.clear()}},sIo;(i=>{function a(e){return e.storage==="extension"?{storage:"extension",extensionId:e.extension.identifier,type:e.source}:e.storage==="plugin"?{storage:"plugin",pluginUri:e.pluginUri}:{storage:e.storage}}i.fromPromptPath=a})(sIo||={});var aIo="The user is not available to respond and will review your work later. Work autonomously and make good decisions.",lIo="vscode_askQuestions",cIo={header:50,question:200},dIo={header:75,question:300};function uIo(a,i){if(a!==void 0)return a.length>i?a.slice(0,i-3)+"...":a}function Nrn(){let i={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:cIo.header},question:{type:"string",description:"The question text to display to the user. Keep it concise, ideally one sentence.",maxLength:cIo.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:lIo,toolReferenceName:"askQuestions",legacyToolReferenceFullNames:[lIo,"vscode/askQuestions"],canBeReferencedInPrompt:!1,icon:q.fromId(R.question.id),displayName:d(8626,null),userDescription:d(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:i}}var WRi=Nrn(),I0e=class extends x{constructor(e,t,o,n){super();this.chatService=e;this.telemetryService=t;this.logService=o;this.configService=n}async invoke(e,t,o,n){let r=Dn.create(!0),s=e.parameters,{questions:l}=s;if(this.logService.trace(`[AskQuestionsTool] Invoking with ${l?.length??0} question(s)`),!l||l.length===0)throw new Error(d(8624,null));let c=e.context?.sessionResource,u=e.chatRequestId,{request:p,sessionResource:h}=this.getRequest(c,u);if(!h||!p)return this.logService.warn("[AskQuestionsTool] Missing chat context; marking all questions as skipped."),this.createSkippedResult(l);if(p.modeInfo?.permissionLevel==="autopilot"||this.configService.getValue("chat.autoReply")){let O=p.modeInfo?.permissionLevel==="autopilot"?"Autopilot mode":"Auto-reply enabled";this.logService.info(`[AskQuestionsTool] ${O}: auto-responding to questions`);let{carousel:V,idToHeaderMap:H}=this.toQuestionCarousel(l);return V.data=this.buildAutopilotCarouselAnswers(l,V,H),V.isUsed=!0,this.chatService.appendProgress(p,V),this.createAutopilotResult(l)}let{carousel:g,idToHeaderMap:f}=this.toQuestionCarousel(l);this.chatService.appendProgress(p,g);let v=await Va(g.completion.p,n);if(n.isCancellationRequested)throw new go;o.report({message:d(8625,null)});let b=this.convertCarouselAnswers(l,v?.answers,f),{answeredCount:S,skippedCount:y,freeTextCount:w,recommendedAvailableCount:k,recommendedSelectedCount:T}=this.collectMetrics(l,b);this.sendTelemetry(e.chatRequestId,l.length,S,y,w,k,T,r.elapsed());let P=JSON.stringify(b);return this.logService.trace(`[AskQuestionsTool] Returning tool result with metrics: questions=${l.length}, answered=${S}, skipped=${y}, freeText=${w}, recommendedAvailable=${k}, recommendedSelected=${T}`),{content:[{kind:"text",value:P}]}}async prepareToolInvocation(e,t){let o=e.parameters,{questions:n}=o;if(!n||n.length===0)throw new Error(d(8624,null));for(let u of n){if(u.options&&u.options.length===1)throw new Error(d(8619,null,u.header));u.question=uIo(u.question,dIo.question)??u.question}let r=n.length,s=n.map(u=>u.header).join(", "),l=r===1?d(8622,null,s):d(8620,null,r,s),c=r===1?d(8623,null,s):d(8621,null,r,s);return{invocationMessage:new Ie(l),pastTenseMessage:new Ie(c)}}getRequest(e,t){if(!e)return{request:void 0,sessionResource:void 0};let o=this.chatService.getSession(e),n;return o&&(t&&(n=o.getRequests().find(r=>r.id===t)),n||(n=o.getRequests().at(-1))),n?{request:n,sessionResource:e}:{request:void 0,sessionResource:e}}toQuestionCarousel(e){let t=new Map,o=e.map(n=>this.toChatQuestion(n,t));return{carousel:new uW(o,!0,xt()),idToHeaderMap:t}}toChatQuestion(e,t){let o;!e.options||e.options.length===0?o="text":e.multiSelect?o="multiSelect":o="singleSelect";let n;if(e.options){let l=e.options.filter(c=>c.recommended);l.length>0&&(n=e.multiSelect?l.map(c=>c.label):l[0].label)}let r=xt();t.set(r,e.header);let s=uIo(e.header,dIo.header)??e.header;return{id:r,type:o,title:s,message:e.question,options:e.options?.map(l=>({id:l.label,label:l.description?`${l.label} - ${l.description}`:l.label,value:l.label})),defaultValue:n,allowFreeformInput:e.allowFreeformInput??!0}}convertCarouselAnswers(e,t,o){let n={answers:{}};t&&(this.logService.trace(`[AskQuestionsTool] Carousel answer keys: ${Object.keys(t).join(", ")}`),this.logService.trace(`[AskQuestionsTool] Question headers: ${e.map(s=>s.header).join(", ")}`));let r=new Map;for(let[s,l]of o)r.set(l,s);for(let s of e){if(!t){n.answers[s.header]={selected:[],freeText:null,skipped:!0};continue}let l=r.get(s.header),c=l?t[l]:void 0;if(this.logService.trace(`[AskQuestionsTool] Processing question "${s.header}" (internal ID: ${l}), raw answer: ${JSON.stringify(c)}, type: ${typeof c}`),c===void 0)n.answers[s.header]={selected:[],freeText:null,skipped:!0};else if(typeof c=="string")s.options?.some(u=>u.label===c)?n.answers[s.header]={selected:[c],freeText:null,skipped:!1}:n.answers[s.header]={selected:[],freeText:c,skipped:!1};else if(Array.isArray(c))n.answers[s.header]={selected:c.map(u=>String(u)),freeText:null,skipped:!1};else if(typeof c=="object"&&No(c,{selectedValues:!0})){let{selectedValues:u,freeformValue:p}=c;n.answers[s.header]={selected:u,freeText:p??null,skipped:!1}}else if(typeof c=="object"&&(No(c,{selectedValue:!0})||No(c,{freeformValue:!0}))){let{selectedValue:u,freeformValue:p}=c;p?n.answers[s.header]={selected:[],freeText:p,skipped:!1}:u!==void 0?s.options?.some(h=>h.label===u)?n.answers[s.header]={selected:[u],freeText:null,skipped:!1}:n.answers[s.header]={selected:[],freeText:u,skipped:!1}:n.answers[s.header]={selected:[],freeText:null,skipped:!0}}else this.logService.warn(`[AskQuestionsTool] Unknown answer format for "${s.header}": ${JSON.stringify(c)}`),n.answers[s.header]={selected:[],freeText:null,skipped:!0}}return n}collectMetrics(e,t){let o=Object.values(t.answers),n=o.filter(u=>!u.skipped).length,r=o.filter(u=>u.skipped).length,s=o.filter(u=>u.freeText!==null).length,l=e.filter(u=>u.options?.some(p=>p.recommended)).length,c=e.filter(u=>{let p=t.answers[u.header],h=u.options?.find(g=>g.recommended);return p&&!p.skipped&&h&&p.selected.includes(h.label)}).length;return{answeredCount:n,skippedCount:r,freeTextCount:s,recommendedAvailableCount:l,recommendedSelectedCount:c}}createSkippedResult(e){let t={};for(let o of e)t[o.header]={selected:[],freeText:null,skipped:!0};return{content:[{kind:"text",value:JSON.stringify({answers:t})}]}}createAutopilotResult(e){let t={};for(let o of e){let n=o.options?.find(l=>l.recommended),r=o.options?.[0],s=n?.label??r?.label;t[o.header]={selected:s?[s]:[],freeText:s?null:aIo,skipped:!1}}return{content:[{kind:"text",value:JSON.stringify({answers:t})}]}}buildAutopilotCarouselAnswers(e,t,o){let n={},r=new Map;for(let[s,l]of o)r.set(l,s);for(let s of e){let l=r.get(s.header);if(!l)continue;let c=t.questions.find(g=>g.id===l);if(!c)continue;let u=s.options?.find(g=>g.recommended),p=s.options?.[0],h=u?.label??p?.label;c.type==="text"||!h?n[l]=aIo:c.type==="multiSelect"?n[l]={selectedValues:[h]}:n[l]={selectedValue:h}}return n}sendTelemetry(e,t,o,n,r,s,l,c){this.telemetryService.publicLog2("askQuestionsToolInvoked",{requestId:e,questionCount:t,answeredCount:o,skippedCount:n,freeTextCount:r,recommendedAvailableCount:s,recommendedSelectedCount:l,duration:c})}};I0e=I([m(0,mi),m(1,Te),m(2,se),m(3,B)],I0e);var Orn="vscode_get_confirmation",Frn="vscode_get_confirmation_with_options",Wrn="vscode_get_modified_files_confirmation",pIo={id:Orn,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}},mIo={id:Frn,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}},hIo={id:Wrn,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}},E2t=class{async prepareToolInvocation(i,e){let t=i.parameters;if(!t.title||!t.message)throw new Error("Missing required parameters for ConfirmationTool");let o=t.confirmationType??"basic",n;return o==="terminal"?n={kind:"terminal",commandLine:{original:t.terminalCommand??""},language:"bash"}:n=void 0,{confirmationMessages:{title:t.title,message:new Ie(t.message),allowAutoConfirm:!(t.buttons||[]).length,customButtons:t.buttons},toolSpecificData:n,presentation:"hiddenAfterComplete"}}async invoke(i,e,t,o){return i.selectedCustomButton?{content:[{kind:"text",value:i.selectedCustomButton}]}:{content:[{kind:"text",value:"yes"}]}}},T2t=class{async prepareToolInvocation(i,e){let t=i.parameters;if(!t.title||!t.message)throw new Error("Missing required parameters for ModifiedFilesConfirmationTool");if(!t.options?.length)throw new Error("ModifiedFilesConfirmationTool requires at least one option");let o={kind:"modifiedFilesConfirmation",options:t.options,modifiedFiles:t.modifiedFiles.map(n=>({uri:A.parse(n.uri).toJSON(),originalUri:n.originalUri?A.parse(n.originalUri).toJSON():void 0,insertions:n.insertions,deletions:n.deletions,title:n.title,description:n.description}))};return{confirmationMessages:{title:t.title,message:new Ie(t.message),allowAutoConfirm:!1},toolSpecificData:o,presentation:"hiddenAfterComplete"}}async invoke(i,e,t,o){return i.selectedCustomButton?{content:[{kind:"text",value:i.selectedCustomButton}]}:{content:[{kind:"text",value:"yes"}]}}};var Vrn="vscode_editFile_internal",gIo={id:Vrn,displayName:"",modelDescription:"",source:kn.Internal},y0e=class{constructor(i,e,t){this.chatService=i;this.codeMapperService=e;this.notebookService=t}async invoke(i,e,t,o){if(!i.context)throw new Error("toolInvocationToken is required for this tool");let n=i.parameters,r=A.revive(n.uri),s=Zo.parse(r)?.notebook||r,l=this.chatService.getSession(i.context.sessionResource),c=l.getRequests().at(-1);l.acceptResponseProgress(c,{kind:"markdownContent",content:new Ie("\n````\n")}),l.acceptResponseProgress(c,{kind:"codeblockUri",uri:s,isEdit:!0}),l.acceptResponseProgress(c,{kind:"markdownContent",content:new Ie("\n````\n")}),this.notebookService.hasSupportedNotebooks(s)&&this.notebookService.getNotebookTextModel(s)?l.acceptResponseProgress(c,{kind:"notebookEdit",edits:[],uri:s}):l.acceptResponseProgress(c,{kind:"textEdit",edits:[],uri:s});let u=l.editingSession;if(!u)throw new Error("This tool must be called from within an editing session");let p=await this.codeMapperService.mapCode({codeBlocks:[{code:n.code,resource:s,markdownBeforeBlock:n.explanation}],location:"tool",chatRequestId:i.chatRequestId,chatRequestModel:i.modelId,chatSessionResource:i.context.sessionResource},{textEdit:(g,f)=>{l.acceptResponseProgress(c,{kind:"textEdit",uri:g,edits:f})},notebookEdit(g,f){l.acceptResponseProgress(c,{kind:"notebookEdit",uri:g,edits:f})}},o);if(this.notebookService.hasSupportedNotebooks(s)&&this.notebookService.getNotebookTextModel(s)?l.acceptResponseProgress(c,{kind:"notebookEdit",uri:s,edits:[],done:!0}):l.acceptResponseProgress(c,{kind:"textEdit",uri:s,edits:[],done:!0}),p?.errorMessage)throw new Error(p.errorMessage);let h;return await new Promise(g=>{let f=!1;h=be(v=>{let S=u.entries.read(v)?.find(y=>Qe(y.modifiedURI,s));S&&(S.isCurrentlyBeingModifiedBy.read(v)?f=!0:f&&g(!0))})}).finally(()=>{h.dispose()}),{content:[{kind:"text",value:"The file was edited successfully"}]}}async prepareToolInvocation(i,e){return{presentation:"hidden"}}};y0e=I([m(0,mi),m(1,iJ),m(2,bn)],y0e);var VRi="manage_todo_list";function BRi(){let a={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:VRi,toolReferenceName:"todo",legacyToolReferenceFullNames:["todos"],canBeReferencedInPrompt:!0,icon:q.fromId(R.checklist.id),displayName:d(8663,null),userDescription:d(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:a}}var S2m=BRi(),w0e=class extends x{constructor(e,t,o){super();this.chatTodoListService=e;this.logService=t;this.telemetryService=o}async invoke(e,t,o,n){let r=e.parameters,s=e.context?.sessionResource;if(!s&&r.operation==="read"&&r.chatSessionResource)try{s=A.parse(r.chatSessionResource)}catch(l){this.logService.error("ManageTodoListTool: Invalid chatSessionResource URI",l)}if(!s)return{content:[{kind:"text",value:"Error: No session resource available"}]};this.logService.debug(`ManageTodoListTool: Invoking with options ${JSON.stringify(r)}`);try{return r.operation==="read"?this.handleReadOperation(s):this.handleWriteOperation(r,s)}catch(l){return{content:[{kind:"text",value:`Error: ${l instanceof Error?l.message:"Unknown error"}`}]}}}async prepareToolInvocation(e,t){let o=e.parameters,n=e.chatSessionResource;if(!n)return;let r=this.chatTodoListService.getTodos(n),s;o.operation==="read"?s=d(8658,null):o.todoList&&(s=this.generatePastTenseMessage(r,o.todoList));let c=(o.todoList??r).map(h=>({id:h.id.toString(),title:h.title,status:h.status})),u=s?.replace(/^(Starting|Completed): /i,"")??d(8662,null);return{invocationMessage:new Ie(u),pastTenseMessage:new Ie(s??d(8661,null)),toolSpecificData:{kind:"todoList",todoList:c}}}generatePastTenseMessage(e,t){if(e.length===0)return t.length===1?d(8657,null):d(8656,null,t.length);let o=new Map(e.map(l=>[l.id,l])),n=t.filter(l=>{let c=o.get(l.id);return c&&c.status!=="in-progress"&&l.status==="in-progress"});if(n.length>0){let l=n[0],c=t.length,u=t.findIndex(p=>p.id===l.id)+1;return d(8659,null,l.title,u,c)}let r=t.filter(l=>{let c=o.get(l.id);return c&&c.status!=="completed"&&l.status==="completed"});if(r.length>0){let l=r[0],c=t.length,u=t.findIndex(p=>p.id===l.id)+1;return d(8655,null,l.title,u,c)}let s=t.filter(l=>!o.has(l.id));return s.length>0?s.length===1?d(8654,null):d(8653,null,s.length):d(8660,null)}handleRead(e,t){return e.length===0?"No todo list found.":`# Todo List

${this.formatTodoListAsMarkdownTaskList(e)}`}handleReadOperation(e){let t=this.chatTodoListService.getTodos(e),o=this.handleRead(t,e),n=this.calculateStatusCounts(t);return this.telemetryService.publicLog2("todoListToolInvoked",{operation:"read",notStartedCount:n.notStartedCount,inProgressCount:n.inProgressCount,completedCount:n.completedCount}),{content:[{kind:"text",value:o}]}}handleWriteOperation(e,t){if(!e.todoList)return{content:[{kind:"text",value:"Error: todoList is required for write operation"}]};let o=e.todoList.map(c=>({id:c.id,title:c.title,status:c.status})),n=this.chatTodoListService.getTodos(t),r=this.calculateTodoChanges(n,o);this.chatTodoListService.setTodos(t,o);let s=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."),r>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:s.notStartedCount,inProgressCount:s.inProgressCount,completedCount:s.completedCount}),{content:[{kind:"text",value:`Successfully wrote todo list${l.length?`

`+l.join(`
`):""}`}],toolMetadata:{warnings:l}}}calculateStatusCounts(e){let t=e.filter(r=>r.status==="not-started").length,o=e.filter(r=>r.status==="in-progress").length,n=e.filter(r=>r.status==="completed").length;return{notStartedCount:t,inProgressCount:o,completedCount:n}}formatTodoListAsMarkdownTaskList(e){return e.length===0?"":e.map(t=>{let o;switch(t.status){case"completed":o="[x]";break;case"in-progress":o="[-]";break;default:o="[ ]";break}return[`- ${o} ${t.title}`].join(`
`)}).join(`
`)}calculateTodoChanges(e,t){let o=0,n=Math.min(e.length,t.length);for(let c=0;c<n;c++){let u=e[c],p=t[c];(u.title!==p.title||u.status!==p.status)&&o++}let r=Math.max(0,t.length-e.length),s=Math.max(0,e.length-t.length);return r+s+o}};w0e=I([m(0,h0),m(1,se),m(2,Te)],w0e);function sU(a){return{content:[{kind:"text",value:a}]}}var Brn=`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`,Hrn=5,aU=class extends x{constructor(e,t,o,n,r,s,l,c,u,p){super();this.chatAgentService=e;this.chatService=t;this.languageModelToolsService=o;this.languageModelsService=n;this.logService=r;this.toolsService=s;this.configurationService=l;this.promptsService=c;this.instantiationService=u;this.productService=p;this._resolvedModels=new Map;this._sessionDepth=new Map;this.onDidUpdateToolData=U.filter(this.configurationService.onDidChangeConfiguration,h=>h.affectsConfiguration("chat.customAgentInSubagent.enabled"))}static{this.Id="runSubagent"}getToolData(){let e=Brn,t={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")&&(t.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:aU.Id,toolReferenceName:u4.runSubagent,icon:q.fromId(R.organization.id),displayName:d(8665,null),userDescription:d(8666,null),modelDescription:e,source:kn.Internal,inputSchema:t}}async invoke(e,t,o,n){let r=e.parameters;if(this.logService.debug(`RunSubagentTool: Invoking with prompt: ${r.prompt.substring(0,100)}...`),!e.context)throw new Error("toolInvocationToken is required for this tool");let s=this.chatService.getSession(e.context.sessionResource);if(!s)throw new Error("Chat model not found for session");let l=s.getRequests().at(-1),c=new N;try{let u=this.chatAgentService.getDefaultAgent("panel","agent");if(!u)return sU("Error: No default agent available");let p=e.modelId,h=e.userSelectedTools,g,f,v,b=r.agentName;if(b)if(f=await this.getSubAgentByName(b),f){let Ce=this._resolvedModels.get(e.callId);if(Ce)this._resolvedModels.delete(e.callId),p=Ce.modeModelId,v=Ce.resolvedModelName;else{let De=this.resolveSubagentModel(f,e.modelId);p=De.modeModelId,v=De.resolvedModelName}let xe=f.tools;if(xe){let De=this.languageModelToolsService.toToolAndToolSetEnablementMap(xe,void 0);h={};for(let[Oe,pt]of De)Xm(Oe)||(h[Oe.id]=pt)}let ze=f.agentInstructions;g=ze&&{name:b,content:ze.content,toolReferences:this.toolsService.toToolReferences(ze.toolReferences),metadata:ze.metadata,isBuiltin:vvo(f.source,f.uri,this.productService)}}else throw new Error(`Requested agent '${b}' not found. Try again with the correct agent name, or omit the agentName to use the current agent.`);else{let Ce=this._resolvedModels.get(e.callId);Ce?(this._resolvedModels.delete(e.callId),v=Ce.resolvedModelName):v=(p?this.languageModelsService.lookupLanguageModel(p):void 0)?.name}let S=[],y=e.chatStreamToolCallId??e.callId??`subagent-${xt()}`,w=!1,k=Ce=>{for(let xe of Ce)xe.kind==="textEdit"||xe.kind==="notebookEdit"||xe.kind==="codeblockUri"?(xe.kind==="codeblockUri"&&!w&&(w=!0,s.acceptResponseProgress(l,{kind:"markdownContent",content:new Ie("```\n")})),xe.kind==="codeblockUri"?s.acceptResponseProgress(l,{...xe,subAgentInvocationId:y}):s.acceptResponseProgress(l,xe)):xe.kind==="hook"?s.acceptResponseProgress(l,{...xe,subAgentInvocationId:y}):xe.kind==="markdownContent"&&(w&&(s.acceptResponseProgress(l,{kind:"markdownContent",content:new Ie("\n```\n\n")}),w=!1),S.push(xe.content.value))},T=this.configurationService.getValue("chat.subagents.allowInvocationsFromSubagents")??!1,P=T?Hrn:0,O=e.context.sessionResource.toString(),V=this._sessionDepth.get(O)??0,H=V+1<=P;h||(h={}),h[aU.Id]!==!1&&(h[aU.Id]=H),h[VRi]=!1,h.copilot_askQuestions=!1,P>0&&this.logService.debug(`RunSubagentTool: Nested subagents enabling ${h[aU.Id]}: session ${O}, currentDepth: ${V}, maxDepth: ${P}, allowInvocationsFromSubagents: ${T}`);let $=new d4;await this.instantiationService.createInstance(Bte,"agent",h,void 0,e.context.sessionResource).collect($,n);let ae;try{ae=(await this.promptsService.getHooks(n,e.context.sessionResource))?.hooks}catch(Ce){this.logService.warn("[ChatService] Failed to collect hooks:",Ce)}if(f?.hooks){let Ce={...f.hooks};if(Ce.Stop){let xe=Ce.Stop;Ce.SubagentStop=Ce.SubagentStop?[...Ce.SubagentStop,...xe]:xe,Ce.Stop=void 0}ae=CMt(ae,Ce)}let he={sessionResource:e.context.sessionResource,requestId:e.callId??`subagent-${Date.now()}`,agentId:u.id,message:r.prompt,variables:{variables:$.asArray()},location:"panel",subAgentInvocationId:y,subAgentName:b,userSelectedModelId:p,modelConfiguration:p?this.languageModelsService.getModelConfiguration(p):void 0,userSelectedTools:h,modeInstructions:g,parentRequestId:e.chatRequestId,hooks:ae,hasHooksEnabled:!!ae&&Object.values(ae).some(Ce=>Ce&&Ce.length>0)};c.add(this.languageModelToolsService.onDidInvokeTool(Ce=>{Ce.subagentInvocationId===y&&(S.length=0)})),this._sessionDepth.set(O,V+1);let oe;try{oe=await this.chatAgentService.invokeAgent(u.id,he,k,[],n)}finally{let Ce=(this._sessionDepth.get(O)??1)-1;Ce<=0?this._sessionDepth.delete(O):this._sessionDepth.set(O,Ce)}if(oe?.errorDetails)return sU(`Agent error: ${oe.errorDetails.message}`);let de=S.join("").replace(/^\n*```\n+```\n*/g,"").trim()||"Agent completed with no output";return e.toolSpecificData?.kind==="subagent"&&(e.toolSpecificData.result=de,e.toolSpecificData.modelName=v),{content:[{kind:"text",value:de}],toolMetadata:{subAgentInvocationId:y,description:r.description,agentName:he.subAgentName,modelName:v}}}catch(u){let p=`Error invoking subagent: ${u instanceof Error?u.message:"Unknown error"}`;return this.logService.error(p,u),sU(p)}finally{c.dispose()}}async getSubAgentByName(e){return(await this.promptsService.getCustomAgents(Se.None)).find(o=>o.name===e)}resolveSubagentModel(e,t){let o=t;if(e){let r=e.model;if(r)e:for(let s of r){let l=this.languageModelsService.lookupLanguageModelByQualifiedName(s);if(l?.identifier){o=l.identifier;break e}}if(o&&o!==t){let s=t?this.languageModelsService.lookupLanguageModel(t):void 0,l=this.languageModelsService.lookupLanguageModel(o),c=s?.multiplierNumeric,u=l?.multiplierNumeric;c!==void 0&&u!==void 0&&u>c&&(this.logService.warn(`[RunSubagentTool] Subagent '${e.name}' requested model '${l?.name}' (multiplier: ${u}) which has a larger multiplier than the main agent model '${s?.name}' (multiplier: ${c}). Falling back to the main agent model.`),o=t)}}let n=o?this.languageModelsService.lookupLanguageModel(o):void 0;return{modeModelId:o,resolvedModelName:n?.name}}async prepareToolInvocation(e,t){let o=e.parameters,n=o.agentName?await this.getSubAgentByName(o.agentName):void 0,r=this.resolveSubagentModel(n,e.modelId);return this._resolvedModels.set(e.toolCallId,r),{invocationMessage:o.description,toolSpecificData:{kind:"subagent",description:o.description,agentName:n?.name,prompt:o.prompt,modelName:r.resolvedModelName}}}};aU=I([m(0,cr),m(1,mi),m(2,Vn),m(3,ds),m(4,se),m(5,Vn),m(6,B),m(7,Or),m(8,F),m(9,tt)],aU);var Urn="setArtifacts",zrn={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"]},fIo={id:Urn,toolReferenceName:"artifacts",legacyToolReferenceFullNames:["Set Session Artifacts"],displayName:d(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:zrn},C0e=class{constructor(i,e){this._chatArtifactsService=i;this._fileService=e}async prepareToolInvocation(i,e){return{pastTenseMessage:new Ie(d(8668,null)),presentation:"hidden"}}async invoke(i,e,t,o){let n=i.parameters,r=i.context?.sessionResource;if(!r)return{content:[{kind:"text",value:"Error: No session resource available"}]};let s=[];for(let l of n.artifacts??[]){let c=l.uri;if(c||(c=""),c){let u=A.parse(c);if(u.scheme!=="http"&&u.scheme!=="https"&&!await this._fileService.exists(u))throw new Error(d(8670,null,c))}s.push({label:l.label,uri:c,type:l.type})}return this._chatArtifactsService.getArtifacts(r).set(s),{content:[{kind:"text",value:d(8669,null,s.length)}]}}};C0e=I([m(0,LZ),m(1,fe)],C0e);var Krn="task_complete";var vIo={id:Krn,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."}}}},_2t=class{async prepareToolInvocation(i,e){return{presentation:"hidden"}}async invoke(i,e,t,o){return{content:[{kind:"text",value:i.parameters?.summary??"All done!"}]}}};var Zge=class extends x{static{this.ID="chat.builtinTools"}constructor(i,e,t){super();let o=e.createInstance(y0e);this._register(i.registerTool(gIo,o));let n=this._register(e.createInstance(I0e));this._register(i.registerTool(WRi,n)),this._register(i.vscodeToolSet.addTool(WRi));let r=BRi(),s=this._register(e.createInstance(w0e));this._register(i.registerTool(r,s));let l=e.createInstance(E2t);this._register(i.registerTool(pIo,l)),this._register(i.registerTool(mIo,l));let c=e.createInstance(T2t);this._register(i.registerTool(hIo,c));let u=e.createInstance(_2t);this._register(i.registerTool(vIo,u));let p=e.createInstance(C0e),h=this._register(new me),g=()=>{t.getValue("chat.artifacts.enabled")&&t.getValue("chat.artifacts.mode")==="tool"?h.value||(h.value=i.registerTool(fIo,p)):h.clear()};g(),this._register(t.onDidChangeConfiguration(y=>{(y.affectsConfiguration("chat.artifacts.enabled")||y.affectsConfiguration("chat.artifacts.mode"))&&g()}));let f=this._register(e.createInstance(aU)),v,b,S=()=>{v?.dispose(),b?.dispose(),i.flushToolUpdates();let y=f.getToolData();v=i.registerTool(y,f),b=i.agentToolSet.addTool(y)};S(),this._register(f.onDidUpdateToolData(S)),this._register({dispose:()=>{v?.dispose(),b?.dispose()}})}};Zge=I([m(0,Vn),m(1,F),m(2,B)],Zge);var art="vscode_fetchWebPage_internal";function D2t(a,i){if(a.uri)return A.parse(a.uri);if(a.filePath){let e=i.getWorkspace().folders;if(e.length===1)return e[0].toResource(a.filePath);for(let t of e)return t.toResource(a.filePath)}}function L2t(a,i){let t=i.trim().split(/\s+/).map(ns).join("\\s+"),o=a.findMatches(t,!1,!0,!1,null,!1,1);if(o.length!==0)return o[0].range.startLineNumber}function R2t(a,i){let t=new RegExp(`\\b${ns(i)}\\b`).exec(a);if(t)return t.index+1}function EW(a){let i=sU(a);return i.toolResultMessage=new Ie(a),i}var Grn="vscode_renameSymbol",qrn=`Rename a code symbol across the workspace using the language server's rename functionality. This performs a precise, semantics-aware rename that updates all references.

Input:
- "symbol": The exact current name of the symbol to rename.
- "newName": The new name for the symbol.
- "uri": A full URI (e.g. "file:///path/to/file.ts") of a file where the symbol appears. Provide either "uri" or "filePath".
- "filePath": A workspace-relative file path (e.g. "src/utils/helpers.ts") of a file where the symbol appears. Provide either "uri" or "filePath".
- "lineContent": A substring of the line of code where the symbol appears. This is used to locate the exact position in the file. Must be the actual text from the file - do NOT fabricate it.

IMPORTANT: The file and line do NOT need to be the definition of the symbol. Any occurrence works - a usage, an import, a call site, etc. You can pick whichever occurrence is most convenient.

If the tool returns an error, retry with corrected input - ensure the file path is correct, the line content matches the actual file content, and the symbol name appears in that line.`,lrt=class extends x{constructor(e,t,o,n,r,s){super();this._languageFeaturesService=e;this._languageService=t;this._textModelService=o;this._workspaceContextService=n;this._chatService=r;this._bulkEditService=s;this._onDidUpdateToolData=this._store.add(new E);this.onDidUpdateToolData=this._onDidUpdateToolData.event;this._store.add(U.debounce(this._languageFeaturesService.renameProvider.onDidChange,()=>{},2e3)((()=>this._onDidUpdateToolData.fire())))}getToolData(){let e=this._languageFeaturesService.renameProvider.registeredLanguageIds;if(e.size===0)return;let t=qrn,o;if(e.has("*"))t+=`

Supported for all languages.`,o=d(7627,null);else{let n=[...e].sort();t+=`

Currently supported for: ${n.join(", ")}.`;let r=n.map(s=>this._languageService.getLanguageName(s)??s);o=d(7628,null,r.join(", "))}return{id:Grn,toolReferenceName:"rename",canBeReferencedInPrompt:!1,icon:q.fromId(R.rename.id),displayName:d(7623,null),userDescription:o,modelDescription:t,source:kn.Internal,when:C.has("config.chat.tools.renameTool.enabled"),inputSchema:{type:"object",properties:{symbol:{type:"string",description:"The exact current name of the symbol to rename."},newName:{type:"string",description:"The new name for the symbol."},uri:{type:"string",description:'A full URI of a file where the symbol appears (e.g. "file:///path/to/file.ts"). Provide either "uri" or "filePath".'},filePath:{type:"string",description:'A workspace-relative file path where the symbol appears (e.g. "src/utils/helpers.ts"). Provide either "uri" or "filePath".'},lineContent:{type:"string",description:"A substring of the line of code where the symbol appears. Used to locate the exact position. Must be actual text from the file."}},required:["symbol","newName","lineContent"]}}}async prepareToolInvocation(e,t){let o=e.parameters;return{invocationMessage:d(7625,null,o.symbol,o.newName)}}async invoke(e,t,o,n){let r=e.parameters,s=D2t(r,this._workspaceContextService);if(!s)return EW('Provide either "uri" (a full URI) or "filePath" (a workspace-relative path) to identify the file.');let l=await this._textModelService.createModelReference(s);try{let c=l.object.textEditorModel;if(!this._languageFeaturesService.renameProvider.has(c))return EW("No rename provider available for this file's language. The rename tool may not support this language.");let u=L2t(c,r.lineContent);if(u===void 0)return EW(`Could not find line content "${r.lineContent}" in ${s.toString()}. Provide the exact text from the line where the symbol appears.`);let p=c.getLineContent(u),h=R2t(p,r.symbol);if(h===void 0)return EW(`Could not find symbol "${r.symbol}" in the matched line. Ensure the symbol name is correct and appears in the provided line content.`);let g=new ye(u,h),f=await Ldi(this._languageFeaturesService.renameProvider,c,g,r.newName);if(f.rejectReason)return EW(`Rename rejected: ${f.rejectReason}`);if(f.edits.length===0)return EW("Rename produced no edits.");if(e.context){let b=this._chatService.getSession(e.context.sessionResource),S=b?.getRequests().at(-1);if(b&&S){let y=new gt;for(let w of f.edits)if(nl.is(w)){let k=y.get(w.resource);k||(k=[],y.set(w.resource,k)),k.push(w.textEdit)}for(let[w,k]of y)b.acceptResponseProgress(S,{kind:"textEdit",uri:w,edits:[]}),b.acceptResponseProgress(S,{kind:"textEdit",uri:w,edits:k}),b.acceptResponseProgress(S,{kind:"textEdit",uri:w,edits:[],done:!0});return this._successResult(r,y.size,f.edits.length)}}await this._bulkEditService.apply(f);let v=new En(f.edits.filter(nl.is).map(b=>b.resource)).size;return this._successResult(r,v,f.edits.length)}finally{l.dispose()}}_successResult(e,t,o){let n=o===1?d(7626,null,e.symbol,e.newName,t):d(7624,null,e.symbol,e.newName,o,t),r=sU(n);return r.toolResultMessage=new Ie(n),r}};lrt=I([m(0,Qt),m(1,_t),m(2,Bt),m(3,Pe),m(4,mi),m(5,La)],lrt);var efe=class extends x{static{this.ID="chat.renameTool"}constructor(i,e){super();let t=this._store.add(e.createInstance(lrt)),o,n=()=>{o?.dispose(),o=void 0,i.flushToolUpdates();let r=t.getToolData();r&&(o=i.registerTool(r,t))};n(),this._store.add(t.onDidUpdateToolData(n)),this._store.add({dispose:()=>{o?.dispose()}})}};efe=I([m(0,Vn),m(1,F)],efe);var $rn="vscode_listCodeUsages",jrn=`Find all usages (references, definitions, and implementations) of a code symbol across the workspace. This tool locates where a symbol is referenced, defined, or implemented.

Input:
- "symbol": The exact name of the symbol to search for (function, class, method, variable, type, etc.).
- "uri": A full URI (e.g. "file:///path/to/file.ts") of a file where the symbol appears. Provide either "uri" or "filePath".
- "filePath": A workspace-relative file path (e.g. "src/utils/helpers.ts") of a file where the symbol appears. Provide either "uri" or "filePath".
- "lineContent": A substring of the line of code where the symbol appears. This is used to locate the exact position in the file. Must be the actual text from the file - do NOT fabricate it.

IMPORTANT: The file and line do NOT need to be the definition of the symbol. Any occurrence works - a usage, an import, a call site, etc. You can pick whichever occurrence is most convenient.

If the tool returns an error, retry with corrected input - ensure the file path is correct, the line content matches the actual file content, and the symbol name appears in that line.`,crt=class extends x{constructor(e,t,o,n,r,s){super();this._languageFeaturesService=e;this._languageService=t;this._modelService=o;this._searchService=n;this._textModelService=r;this._workspaceContextService=s;this._onDidUpdateToolData=this._store.add(new E);this.onDidUpdateToolData=this._onDidUpdateToolData.event;this._store.add(U.debounce(this._languageFeaturesService.referenceProvider.onDidChange,()=>{},2e3)((()=>this._onDidUpdateToolData.fire())))}getToolData(){let e=this._languageFeaturesService.referenceProvider.registeredLanguageIds;if(e.size===0)return;let t=jrn,o;if(e.has("*"))t+=`

Supported for all languages.`,o=d(7647,null);else{let n=[...e].sort();t+=`

Currently supported for: ${n.join(", ")}.`;let r=n.map(s=>this._languageService.getLanguageName(s)??s);o=d(7648,null,r.join(", "))}return{id:$rn,toolReferenceName:"usages",canBeReferencedInPrompt:!1,icon:q.fromId(R.references.id),displayName:d(7642,null),userDescription:o,modelDescription:t,source:kn.Internal,when:C.has("config.chat.tools.usagesTool.enabled"),inputSchema:{type:"object",properties:{symbol:{type:"string",description:"The exact name of the symbol (function, class, method, variable, type, etc.) to find usages of."},uri:{type:"string",description:'A full URI of a file where the symbol appears (e.g. "file:///path/to/file.ts"). Provide either "uri" or "filePath".'},filePath:{type:"string",description:'A workspace-relative file path where the symbol appears (e.g. "src/utils/helpers.ts"). Provide either "uri" or "filePath".'},lineContent:{type:"string",description:"A substring of the line of code where the symbol appears. Used to locate the exact position. Must be actual text from the file."}},required:["symbol","lineContent"]}}}async prepareToolInvocation(e,t){let o=e.parameters;return{invocationMessage:d(7643,null,o.symbol)}}async invoke(e,t,o,n){let r=e.parameters,s=D2t(r,this._workspaceContextService);if(!s)return EW('Provide either "uri" (a full URI) or "filePath" (a workspace-relative path) to identify the file.');let l=await this._textModelService.createModelReference(s);try{let c=l.object.textEditorModel;if(!this._languageFeaturesService.referenceProvider.has(c))return EW("No reference provider available for this file's language. The usages tool may not support this language.");let u=L2t(c,r.lineContent);if(u===void 0)return EW(`Could not find line content "${r.lineContent}" in ${s.toString()}. Provide the exact text from the line where the symbol appears.`);let p=c.getLineContent(u),h=R2t(p,r.symbol);if(h===void 0)return EW(`Could not find symbol "${r.symbol}" in the matched line. Ensure the symbol name is correct and appears in the provided line content.`);let g=new ye(u,h),[f,v,b]=await Promise.all([sF(this._languageFeaturesService.definitionProvider,c,g,!1,n),qY(this._languageFeaturesService.referenceProvider,c,g,!1,!1,n),Uxe(this._languageFeaturesService.implementationProvider,c,g,!1,n)]);if(v.length===0){let T=sU(`No usages found for \`${r.symbol}\`.`);return T.toolResultMessage=new Ie(d(7644,null,r.symbol)),T}let S=await this._getLinePreviews(r.symbol,v,n),y=[];y.push(`${v.length} usages of \`${r.symbol}\`:
`);for(let T=0;T<v.length;T++){let P=v[T],O=this._classifyReference(P,f,b),V=z.lift(P.range).startLineNumber,H=S[T];H?(y.push(`<usage type="${O}" uri="${P.uri.toString()}" line="${V}">`),y.push(`	${H}`),y.push("</usage>")):y.push(`<usage type="${O}" uri="${P.uri.toString()}" line="${V}" />`)}let w=y.join(`
`),k=sU(w);return k.toolResultMessage=v.length===1?new Ie(d(7645,null,r.symbol)):new Ie(d(7646,null,r.symbol,v.length)),k.toolResultDetails=v.map(T=>({uri:T.uri,range:T.range})),k}finally{l.dispose()}}async _getLinePreviews(e,t,o){let n=new Array(t.length),r=new Map,s=new En;for(let l=0;l<t.length;l++){let c=t[l],u=z.lift(c.range).startLineNumber,p=this._modelService.getModel(c.uri);p?n[l]=p.getLineContent(u).trim():(r.set(`${c.uri.toString()}:${u}`,l),s.add(c.uri))}if(s.size===0||o.isCancellationRequested)return n;try{let l=this._workspaceContextService.getWorkspace().folders,c=[];for(let u of s){let p=this._workspaceContextService.getWorkspaceFolder(u);if(p){let h=Wd(p.uri,u);h&&c.push(h)}}if(c.length>0){let u={};c.length===1?u[c[0]]=!0:u[`{${c.join(",")}}`]=!0;let p=await this._searchService.textSearch({type:2,contentPattern:{pattern:ns(e),isRegExp:!0,isWordMatch:!0},folderQueries:l.map(h=>({folder:h.uri})),includePattern:u},o);for(let h of p.results)if(h.results){for(let g of h.results)if(e0(g))for(let f of g.rangeLocations){let v=f.source.startLineNumber+1,b=`${h.resource.toString()}:${v}`,S=r.get(b);S!==void 0&&(n[S]=g.previewText.trim(),r.delete(b))}}}}catch{}return n}_classifyReference(e,t,o){return t.some(n=>this._overlaps(e,n))?"definition":o.some(n=>this._overlaps(e,n))?"implementation":"reference"}_overlaps(e,t){return Qe(e.uri,t.uri)?z.areIntersectingOrTouching(e.range,t.range):!1}};crt=I([m(0,Qt),m(1,_t),m(2,Tt),m(3,gg),m(4,Bt),m(5,Pe)],crt);var tfe=class extends x{static{this.ID="chat.usagesTool"}constructor(i,e){super();let t=this._store.add(e.createInstance(crt)),o,n=()=>{o?.dispose(),o=void 0,i.flushToolUpdates();let r=t.getToolData();r&&(o=i.registerTool(r,t))};n(),this._store.add(t.onDidUpdateToolData(n)),this._store.add({dispose:()=>o?.dispose()})}};tfe=I([m(0,Vn),m(1,F)],tfe);var M2t=le("voiceChatService");var P2t=new Y("voiceChatInProgress",!1,{type:"boolean",description:d(8701,null)}),jv=class extends x{constructor(e,t,o){super();this.speechService=e;this.chatAgentService=t;this.activeVoiceChatSessions=0;this.voiceChatInProgress=P2t.bindTo(o)}static{this.AGENT_PREFIX=zc}static{this.COMMAND_PREFIX=Bu}static{this.PHRASES_LOWER={[this.AGENT_PREFIX]:"at",[this.COMMAND_PREFIX]:"slash"}}static{this.PHRASES_UPPER={[this.AGENT_PREFIX]:"At",[this.COMMAND_PREFIX]:"Slash"}}static{this.CHAT_AGENT_ALIAS=new Map([["vscode","code"]])}createPhrases(e){let t=new Map;for(let o of this.chatAgentService.getActivatedAgents()){let n=`${jv.PHRASES_LOWER[jv.AGENT_PREFIX]} ${jv.CHAT_AGENT_ALIAS.get(o.name)??o.name}`.toLowerCase();t.set(n,{agent:o.name});for(let r of o.slashCommands){let s=`${jv.PHRASES_LOWER[jv.COMMAND_PREFIX]} ${r.name}`.toLowerCase();t.set(s,{agent:o.name,command:r.name});let l=`${n} ${s}`.toLowerCase();t.set(l,{agent:o.name,command:r.name})}}return t}toText(e,t){switch(t){case 1:return`${jv.AGENT_PREFIX}${e.agent}`;case 2:return`${jv.COMMAND_PREFIX}${e.command}`;case 3:return`${jv.AGENT_PREFIX}${e.agent} ${jv.COMMAND_PREFIX}${e.command}`}}async createVoiceChatSession(e,t){let o=new N,n=p=>{this.activeVoiceChatSessions=Math.max(0,this.activeVoiceChatSessions-1),this.activeVoiceChatSessions===0&&this.voiceChatInProgress.reset(),p&&o.dispose()};o.add(e.onCancellationRequested(()=>n(!0)));let r=!1,s=!1,l=o.add(new E),c=await this.speechService.createSpeechToTextSession(e,"chat");e.isCancellationRequested&&n(!0);let u=this.createPhrases(t.model);return o.add(c.onDidChange(p=>{switch(p.status){case 2:case 3:{let h=p;if(p.text){let g=p.text.startsWith(jv.PHRASES_UPPER[jv.AGENT_PREFIX])||p.text.startsWith(jv.PHRASES_LOWER[jv.AGENT_PREFIX]),f=p.text.startsWith(jv.PHRASES_UPPER[jv.COMMAND_PREFIX])||p.text.startsWith(jv.PHRASES_LOWER[jv.COMMAND_PREFIX]);if(g||f){let v=p.text.split(" "),b,S=!1;if(t.usesAgents&&g&&!r&&!s&&v.length>=4){let y=u.get(v.slice(0,4).map(w=>this.normalizeWord(w)).join(" "));y&&(b=[this.toText(y,3),...v.slice(4)],S=v.length===4,p.status===3&&(r=!0,s=!0))}if(t.usesAgents&&g&&!r&&!b&&v.length>=2){let y=u.get(v.slice(0,2).map(w=>this.normalizeWord(w)).join(" "));y&&(b=[this.toText(y,1),...v.slice(2)],S=v.length===2,p.status===3&&(r=!0))}if(f&&!s&&!b&&v.length>=2){let y=u.get(v.slice(0,2).map(w=>this.normalizeWord(w)).join(" "));y&&(b=[this.toText(y,t.usesAgents&&!r?3:2),...v.slice(2)],S=v.length===2,p.status===3&&(s=!0))}h={status:p.status,text:(b??v).join(" "),waitingForInput:S}}}l.fire(h);break}case 1:this.activeVoiceChatSessions++,this.voiceChatInProgress.set(!0),l.fire(p);break;case 4:n(!1),l.fire(p);break;case 5:l.fire(p);break}})),{onDidChange:l.event}}normalizeWord(e){return e=dh(e,"."),e=dh(e,","),e=dh(e,"?"),e.toLowerCase()}};jv=I([m(0,ZC),m(1,cr),m(2,X)],jv);var A2t=class{constructor(){this.priority=100;this.name="panelChat";this.type="view";this.when=ie.inChatSession}getProvider(i){let e=i.get(Pt),t=i.get(ce),o=e.lastFocusedWidget;if(!o)return;let n=o.hasInputFocus();n&&o.focusResponseItem();let r=o,s=r.getFocus();if(!s||!Ui(s)){let c=r.viewModel?.getItems().filter(Ui)?.at(-1);c&&(s=c,r.focus(c))}if(!(!s||!Ui(s)))return new HRi(r,s,n,t)}},N2t="chat.accessibleView.includeThinking",Qrn=!0;function URi(a){return a.getBoolean(N2t,0,Qrn)}function Yrn(a){return typeof a=="object"&&a!==null&&"output"in a&&typeof a.output=="object"&&a.output?.type==="data"&&typeof a.output?.base64Data=="string"}function SIo(a){if(!a)return"";if(rTe(a)||a.kind==="terminal"){let i=iM(a);return i.commandLine.userEdited??i.commandLine.toolEdited??i.commandLine.original}switch(a.kind){case"subagent":{let i=[];return a.agentName&&i.push(d(5632,null,a.agentName)),a.description&&i.push(a.description),a.prompt&&i.push(d(5633,null,a.prompt)),i.join(". ")||""}case"extensions":return a.extensions.length>0?d(5625,null,a.extensions.join(", ")):"";case"todoList":{let i=a.todoList;if(i.length===0)return"";let e=i.map(t=>d(5635,null,t.title,t.status));return d(5636,null,i.length,e.join("; "))}case"pullRequest":return d(5629,null,a.title,a.author);case"input":return typeof a.rawInput=="string"?a.rawInput:JSON.stringify(a.rawInput);case"resources":{let i=a.values;if(i.length===0)return"";let e=i.map(t=>"uri"in t&&"range"in t?`${t.uri.fsPath||t.uri.path}:${t.range.startLineNumber}`:t.fsPath||t.path).join(", ");return d(5630,null,e)}case"simpleToolInvocation":{let i=a.input,e=a.output;return d(5631,null,i,e)}case"modifiedFilesConfirmation":return a.modifiedFiles.length===0?"":d(5628,null,a.modifiedFiles.map(i=>{let e=A.revive(i.uri);return e.fsPath||e.path}).join(", "));default:return""}}function Xrn(a){return a?Array.isArray(a)?{files:a.map(e=>A.isUri(e)?e.fsPath||e.path:e.uri.fsPath||e.uri.path)}:cD(a)?{input:a.input,isError:a.isError}:Yrn(a)?{input:d(5623,null,a.output.mimeType)}:_B(a)?{input:d(5623,null,a.output.mimeType)}:{}:{}}function bIo(a,i,e,t,o){let n=[],r=o&&i?i:a;r&&n.push(r);let s=SIo(e);if(s&&n.push(s),o&&t){let l=Xrn(t);l.isError&&n.unshift(d(5624,null)),l.input&&!s&&n.push(d(5627,null,l.input)),l.files&&l.files.length>0&&n.push(d(5626,null,l.files.join(", ")))}return n.join(". ")}var HRi=class extends x{constructor(e,t,o,n){super();this._widget=e;this._wasOpenedFromInput=o;this._storageService=n;this._focusedItemDisposables=this._register(new N);this._storageDisposables=this._register(new N);this._onDidChangeContent=this._register(new E);this.onDidChangeContent=this._onDidChangeContent.event;this.id="panelChat";this.verbositySettingKey="accessibility.verbosity.panelChat";this.options={type:"view"};this._storageDisposables.add(this._storageService.onDidChangeValue(0,N2t,this._storageDisposables)(()=>{this._onDidChangeContent.fire()})),this._setFocusedItem(t)}provideContent(){return this._getContent(this._focusedItem)}_setFocusedItem(e){this._focusedItem=e,this._focusedItemDisposables.clear(),Ui(e)&&this._focusedItemDisposables.add(e.model.onDidChange(()=>this._onDidChangeContent.fire()))}_renderMessageAsPlaintext(e){return typeof e=="string"?e:Nu(Da(e,{useLinkFormatter:!0}))}_getContent(e){let t=[];if(!Ui(e))return"";"errorDetails"in e&&e.errorDetails&&t.push(e.errorDetails.message);for(let o of e.response.value)switch(o.kind){case"thinking":{if(!this._shouldIncludeThinkingContent())break;let r=(Array.isArray(o.value)?o.value.join(""):o.value||"").trim();r&&t.push(d(5634,null,r));break}case"markdownContent":{let n=Da(o.content,{includeCodeBlocksFences:!0,useLinkFormatter:!0});n.trim()&&t.push(n);break}case"inlineReference":{let n=o.inlineReference,r;if(A.isUri(n)){let s=o.name||He(n),l=n.scheme==="file"?n.path:n.toString(!0);r=s!==l?`${s} (${l})`:l}else if(lf(n)){let s=o.name||He(n.uri),l=n.uri.scheme==="file"?n.uri.path:n.uri.toString(!0);r=`${s} (${l}:${n.range.startLineNumber})`}else{let s=n.location.uri.scheme==="file"?n.location.uri.fsPath||n.location.uri.path:n.location.uri.toString(!0);r=`${n.name} (${s}:${n.location.range.startLineNumber})`}t.push(r);break}case"elicitation2":case"elicitationSerialized":{let n=o.title,r="";typeof n=="string"?r+=`${n}
`:Ar(n)&&(r+=Da(n,{includeCodeBlocksFences:!0})+`
`);let s=o.message;Ar(s)?r+=Da(s,{includeCodeBlocksFences:!0}):r+=s,r.trim()&&t.push(r);break}case"toolInvocation":{let n=o.state.get();if(n.type===Pi.StateKind.WaitingForConfirmation&&n.confirmationMessages?.title){let r=this._renderMessageAsPlaintext(n.confirmationMessages.title),s=n.confirmationMessages.message?this._renderMessageAsPlaintext(n.confirmationMessages.message):"",l=SIo(o.toolSpecificData),c=r;l&&(c+=`: ${l}`),s&&(c+=`
${s}`),t.push(c)}else if(n.type===Pi.StateKind.WaitingForPostApproval){let r=cD(n.resultDetails)?n.resultDetails.input:_B(n.resultDetails)?void 0:SLt(n.contentForModel);t.push(d(5637,null,o.toolId)+(r??""))}else{let r=Pi.resultDetails(o),s=Pi.isComplete(o),l=bIo(this._renderMessageAsPlaintext(o.invocationMessage),o.pastTenseMessage?this._renderMessageAsPlaintext(o.pastTenseMessage):void 0,o.toolSpecificData,r,s);l&&t.push(l)}break}case"toolInvocationSerialized":{let n=bIo(this._renderMessageAsPlaintext(o.invocationMessage),o.pastTenseMessage?this._renderMessageAsPlaintext(o.pastTenseMessage):void 0,o.toolSpecificData,o.resultDetails,o.isComplete);n&&t.push(n);break}}return this._normalizeWhitespace(t.join(`
`))}_normalizeWhitespace(e){let t=e.split(/\r?\n/),o=[];for(let n of t)n.trim().length!==0&&o.push(n);return o.join(`
`)}_shouldIncludeThinkingContent(){return URi(this._storageService)}onClose(){this._widget.reveal(this._focusedItem),this._wasOpenedFromInput?this._widget.focusInput():this._widget.focus(this._focusedItem)}provideNextContent(){let e=this._widget.getSibling(this._focusedItem,"next");if(e)return this._setFocusedItem(e),this._getContent(e)}providePreviousContent(){let e=this._widget.getSibling(this._focusedItem,"previous");if(e)return this._setFocusedItem(e),this._getContent(e)}};var Jrn="workbench.action.chat.focusConfirmation",Zrn="workbench.action.chat.toggleThinkingContentAccessibleView",zRi=class extends K{constructor(){super({id:Jrn,title:{value:d(5640,null),original:"Focus Chat Confirmation"},category:{value:d(5638,null),original:"Chat"},precondition:ie.enabled,f1:!0,keybinding:{weight:200,primary:3103,when:C.and($a,ie.Editing.hasQuestionCarousel.negate())}})}async run(i){let t=i.get(Pt).getAllWidgets().find(s=>s.viewModel?.model.requestNeedsInput.get());if(!t){en(d(5641,null));return}let o=t.viewModel;if(!o){en(d(5639,null));return}let n,r=o.getItems()[o.getItems().length-1];if(Ui(r)){let s=t.domNode.querySelectorAll(".chat-confirmation-widget-container");s.length>0&&(n=s[0])}n?n.contains(t.domNode.ownerDocument.activeElement)?t.focusInput():n.focus():en(d(5642,null))}},KRi=class extends K{constructor(){super({id:Zrn,title:{value:d(5645,null),original:"Toggle Thinking Content in Accessible View"},category:{value:d(5638,null),original:"Chat"},precondition:ie.enabled,f1:!0,keybinding:{primary:562,weight:200,when:C.and(Dd,C.equals(cu.key,"panelChat"))}})}async run(i){let e=i.get(ce),o=!URi(e);e.store(N2t,o,0,0),en(o?d(5644,null):d(5643,null))}};function IIo(){W(zRi),W(KRi)}var GRi=class{constructor(){this.participants=new Set}registerParticipant(i){return this.participants.add(i),{dispose:()=>{this.participants.delete(i)}}}getParticipants(){return Array.from(this.participants)}},qRi=new GRi;async function x0e(a,i,e){let t=a.get(F),o=a.get(se);for(let n of qRi.getParticipants())try{if(await t.invokeFunction(s=>n.handleOpenSession(s,i,e)))return}catch(r){o.error(r)}return t.invokeFunction(n=>esn(n,i,e))}async function esn(a,i,e){let t=a.get(Us),o=a.get(Pt),n=a.get(Ne);try{i.setRead(!0);let r;LDe(i)?r={}:r={title:{preferred:i.label}};let s={...r,...e?.editorOptions,revealIfOpened:!0};await t.activateChatSessionItemProvider(i.providerType);let l;return e?.sideBySide?l=jn:l=rD,!(i.resource.scheme===Q.vscodeChatEditor||i.resource.scheme===Q.vscodeLocalChatSession)&&!await t.canResolveChatSession(i.resource.scheme)&&(l=e?.sideBySide?In:jn,s={...s,revealIfOpened:!0}),await o.openSession(i.resource,l,s)}catch(r){n.error(d(6107,null,xn(r)));return}}var tsn=60,$Ri=240,jRi=500,k0e=class extends x{constructor(e,t,o,n){super();this.session=e;this.chatService=t;this.instantiationService=o;this.chatWidgetService=n;this.hasRendered=!1;this.domNode=_(".agent-session-hover.interactive-session"),this.domNode.style.width=`${jRi}px`,this.domNode.style.height=`${tsn+$Ri}px`,this.domNode.style.overflow="hidden",this.cts=new Ye,this._register(Z(()=>this.cts.cancel())),this.buildHeader(),this.contentElement=M(this.domNode,_(".agent-session-hover-content")),this.loadingElement=M(this.contentElement,_(".agent-session-hover-loading")),M(this.loadingElement,Sn(q.modify(R.loading,"spin"))),this.renderScheduler=this._register(new Dt(()=>this.render(),200))}onRendered(){this.modelRef??=this.loadModel(),this.hasRendered?this.listWidget?.layout($Ri,jRi):(this.hasRendered=!0,this.renderScheduler.schedule())}async loadModel(){let e=await this.chatService.acquireOrLoadSession(this.session.resource,"panel",this.cts.token);if(this._store.isDisposed){e?.dispose();return}if(!e){this.loadingElement.remove();let t=this.buildFallbackTooltip(this.session);this.domNode.textContent=typeof t=="string"?t:t.value;return}return this._register(e),e.object}async render(){this.modelRef??=this.loadModel();let e=await this.modelRef;if(!e||this._store.isDisposed)return;this.loadingElement.remove();let t=this._register(this.instantiationService.createInstance(sW,"agentSessionHover")),o=this._register(this.instantiationService.createInstance(xZ,e,t,{maxVisibleItems:2})),n=M(this.contentElement,_(".interactive-list")),r=this._register(this.instantiationService.createInstance(Pie,n,{rendererOptions:{renderStyle:"compact",noHeader:!0,editable:!1},currentChatMode:()=>"ask"}));r.layout($Ri,jRi),r.setScrollLock(!0),r.setViewModel(o),r.refresh();let s=this._register(new Dt(()=>r.refresh(),500));this._register(o.onDidChange(()=>{s.isScheduled()||s.schedule()})),this._register(r.onDidClickFollowup(async l=>{let c=await this.chatWidgetService.openSession(e.sessionResource);c&&c.acceptInput(l.message)}))}buildHeader(){let e=this.session,t=M(this.domNode,_(".agent-session-hover-header")),o=M(t,_(".agent-session-hover-title"));M(o,_("span",void 0,e.label));let n=M(t,_(".agent-session-hover-details")),s=lg(e.providerType)??"local",l=lT(s);if(M(n,Sn(l)),M(n,_("span",void 0,IS(s))),M(n,_("span.separator",void 0,"\u2022")),e.timing.lastRequestEnded&&e.timing.lastRequestStarted){let u=this.toDuration(e.timing.lastRequestStarted,e.timing.lastRequestEnded,!0);u&&M(n,_("span",void 0,u))}else{let u=e.timing.lastRequestStarted??e.timing.created;M(n,_("span",void 0,ea(u,!0,!0)))}let c=DDe(e.changes);if(c&&Ipe(e.changes)){M(n,_("span.separator",void 0,"\u2022"));let u=M(n,_(".agent-session-hover-diff"));c.files>0&&M(u,_("span",void 0,c.files===1?d(6028,null):d(6029,null,c.files))),c.insertions>0&&M(u,_("span.insertions",void 0,`+${c.insertions}`)),c.deletions>0&&M(u,_("span.deletions",void 0,`-${c.deletions}`))}e.status!==1&&(M(n,_("span.separator",void 0,"\u2022")),M(n,_("span",void 0,this.toStatusLabel(e.status)))),e.isArchived()&&(M(n,_("span.separator",void 0,"\u2022")),M(n,Sn(R.archive)),M(n,_("span",void 0,d(6027,null))))}buildFallbackTooltip(e){let t=[];if(t.push(`**${e.label}**`),e.tooltip){let p=typeof e.tooltip=="string"?e.tooltip:e.tooltip.value;t.push(p)}else{if(e.description){let p=typeof e.description=="string"?e.description:e.description.value;t.push(p)}if(e.badge){let p=typeof e.badge=="string"?e.badge:e.badge.value;t.push(p)}}let o=[],r=lg(e.providerType)??"local",s=lT(r),l=IS(r),c;if(e.timing.lastRequestEnded&&e.timing.lastRequestStarted)c=this.toDuration(e.timing.lastRequestStarted,e.timing.lastRequestEnded,!0)??ea(e.timing.lastRequestStarted,!0,!0);else{let p=e.timing.lastRequestStarted??e.timing.created;c=ea(p,!0,!0)}o.push(`$(${s.id}) ${l} \u2022 ${c}`);let u=DDe(e.changes);if(u&&Ipe(e.changes)){let p=[];u.files>0&&p.push(u.files===1?d(6028,null):d(6029,null,u.files)),u.insertions>0&&p.push(`+${u.insertions}`),u.deletions>0&&p.push(`-${u.deletions}`),p.length>0&&o.push(p.join(" "))}return e.status!==1&&o.push(this.toStatusLabel(e.status)),t.push(o.join(" \u2022 ")),e.isArchived()&&t.push(`$(archive) ${d(6027,null)}`),new Ie(t.join(`

`),{supportThemeIcons:!0})}toDuration(e,t,o){let n=Math.round((t-e)/1e3)*1e3;if(!(n<1e3))return u7(n,o)}toStatusLabel(e){let t;switch(e){case 3:t=d(6026,null);break;case 2:t=d(6025,null);break;case 0:t=d(6024,null);break;default:t=d(6023,null)}return t}};k0e=I([m(1,mi),m(2,F),m(3,Pt)],k0e);var E0e=Object.freeze({providers:[],states:[],archived:!0,read:!1,repositoryGroupCapped:!0}),TW=class extends x{constructor(e,t,o){super();this.options=e;this.chatSessionsService=t;this.storageService=o;this.STORAGE_KEY="agentSessions.filterExcludes.agentsessionsviewerfiltersubmenu";this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this.limitResults=()=>this.options.limitResults?.();this.groupResults=()=>this.options.groupResults?.();this.sortResults=()=>this.options.sortResults?.();this.excludes=E0e;this.isStoringExcludes=!1;this.actionDisposables=this._register(new N);this.updateExcludes(!1),this.registerListeners()}registerListeners(){this._register(this.chatSessionsService.onDidChangeItemsProviders(()=>this.updateFilterActions())),this._register(this.chatSessionsService.onDidChangeAvailability(()=>this.updateFilterActions())),this._register(this.storageService.onDidChangeValue(0,this.STORAGE_KEY,this._store)(()=>this.updateExcludes(!0)))}updateExcludes(e){if(!this.isStoringExcludes){let t=this.storageService.get(this.STORAGE_KEY,0);if(t)try{this.excludes=JSON.parse(t)}catch{this.excludes={...E0e}}else this.excludes={...E0e}}this.updateFilterActions(),e&&this._onDidChange.fire()}storeExcludes(e){this.excludes=e,this.isStoringExcludes=!0;try{eo(this.excludes,E0e)?this.storageService.remove(this.STORAGE_KEY,0):this.storageService.store(this.STORAGE_KEY,JSON.stringify(this.excludes),0,0)}finally{this.isStoringExcludes=!1}}updateFilterActions(){this.actionDisposables.clear();let e=this.options.filterMenuId;e&&(this.registerProviderActions(this.actionDisposables,e),this.registerStateActions(this.actionDisposables,e),this.registerArchivedActions(this.actionDisposables,e),this.registerReadActions(this.actionDisposables,e),this.registerResetAction(this.actionDisposables,e))}registerProviderActions(e,t){let o=this.options.providerLabelOverrides,n=c=>{if(o?.has(c))return o.get(c);let u=lg(c);return u?IS(u):c},r;if(this.options.allowedProviders)r=this.options.allowedProviders.map(c=>({id:c,label:n(c)}));else{r=[{id:"local",label:n("local")}];for(let c of this.chatSessionsService.getAllChatSessionContributions())r.find(u=>u.id===c.type)||r.push({id:c.type,label:n(c.type)})}let s=this,l=0;for(let c of r)e.add(W(class extends K{constructor(){super({id:`agentSessions.filter.toggleExclude:${c.id}.${t.id.toLowerCase()}`,title:c.label,menu:{id:t,group:"1_providers",order:l++},toggled:s.excludes.providers.includes(c.id)?C.false():C.true()})}run(){let u=new Set(s.excludes.providers);u.delete(c.id)||u.add(c.id),s.storeExcludes({...s.excludes,providers:Array.from(u)})}}))}registerStateActions(e,t){let o=[{id:1,label:d(6102,null)},{id:2,label:d(6104,null)},{id:3,label:d(6105,null)},{id:0,label:d(6103,null)}],n=this,r=0;for(let s of o)e.add(W(class extends K{constructor(){super({id:`agentSessions.filter.toggleExcludeState:${s.id}.${t.id.toLowerCase()}`,title:s.label,menu:{id:t,group:"2_states",order:r++},toggled:n.excludes.states.includes(s.id)?C.false():C.true()})}run(){let l=new Set(n.excludes.states);l.delete(s.id)||l.add(s.id),n.storeExcludes({...n.excludes,states:Array.from(l)})}}))}registerArchivedActions(e,t){let o=this;e.add(W(class extends K{constructor(){super({id:`agentSessions.filter.toggleExcludeArchived.${t.id.toLowerCase()}`,title:d(6099,null),menu:{id:t,group:"3_props",order:1e3},toggled:o.excludes.archived?C.false():C.true()})}run(){o.storeExcludes({...o.excludes,archived:!o.excludes.archived})}}))}registerReadActions(e,t){let o=this;e.add(W(class extends K{constructor(){super({id:`agentSessions.filter.toggleExcludeRead.${t.id.toLowerCase()}`,title:d(6100,null),menu:{id:t,group:"3_props",order:0},toggled:o.excludes.read?C.false():C.true()})}run(){o.storeExcludes({...o.excludes,read:!o.excludes.read})}}))}setRepositoryGroupCapped(e){this.excludes.repositoryGroupCapped!==e&&this.storeExcludes({...this.excludes,repositoryGroupCapped:e})}registerResetAction(e,t){let o=this;e.add(W(class extends K{constructor(){super({id:`agentSessions.filter.resetExcludes.${t.id.toLowerCase()}`,title:d(6101,null),menu:{id:t,group:"4_reset",order:0}})}run(){o.reset()}}))}isDefault(){return eo(this.excludes,E0e)}getExcludes(){return this.excludes}exclude(e){let t=this.options?.overrideExclude?.(e);return typeof t=="boolean"?t:!!(this.options.allowedProviders&&!this.options.allowedProviders.includes(e.providerType)||this.excludes.read&&e.isRead()||this.excludes.providers.includes(e.providerType)||this.excludes.states.includes(e.status)||this.excludes.archived&&this.groupResults?.()==="capped"&&e.isArchived())}notifyResults(e){this.options.notifyResults?.(e)}reset(){this.storeExcludes({...E0e})}};TW=I([m(1,Us),m(2,ce)],TW);var NM=class extends x{constructor(e,t,o,n,r,s,l,c){super();this.options=e;this._approvalModel=t;this._activeSessionResource=o;this.markdownRendererService=n;this.productService=r;this.hoverService=s;this.instantiationService=l;this.contextKeyService=c;this.templateId=NM.TEMPLATE_ID;this.sessionHover=this._register(new me);this._onDidChangeItemHeight=this._register(new E);this.onDidChangeItemHeight=this._onDidChangeItemHeight.event}static{this.TEMPLATE_ID="agent-session"}static{this.APPROVAL_ROW_MAX_LINES=3}static{this._APPROVAL_ROW_LINE_HEIGHT=18}static{this._APPROVAL_ROW_OVERHEAD=14}static getApprovalRowHeight(e){return Math.min(e.split(/\r?\n/).length,NM.APPROVAL_ROW_MAX_LINES)*NM._APPROVAL_ROW_LINE_HEIGHT+NM._APPROVAL_ROW_OVERHEAD}renderTemplate(e){let t=new N,o=t.add(new N),n=ct("div.agent-session-item@item",[ct("div.agent-session-icon-col",[ct("div.agent-session-icon@icon")]),ct("div.agent-session-main-col",[ct("div.agent-session-title-row",[ct("div.agent-session-title@title"),ct("div.agent-session-pinned-indicator@pinnedIndicator"),ct("div.agent-session-title-toolbar@titleToolbar")]),ct("div.agent-session-details-row",[ct("div.agent-session-details-icon@detailsIcon"),ct("div.agent-session-badge@badge"),ct("span.agent-session-separator@separator"),ct("div.agent-session-diff-container@diffContainer",[ct("span.agent-session-diff-added@addedSpan"),ct("span.agent-session-diff-removed@removedSpan")]),ct("div.agent-session-description@description"),ct("div.agent-session-status@statusContainer",[ct("span.agent-session-status-time@statusTime")])]),ct("div.agent-session-approval-row@approvalRow",[ct("span.agent-session-approval-label@approvalLabel"),ct("div.agent-session-approval-button@approvalButtonContainer")])])]),r=t.add(this.contextKeyService.createScoped(n.item)),s=t.add(this.instantiationService.createChild(new _o([X,r]))),l=t.add(s.createInstance(or,n.titleToolbar,D.AgentSessionItemToolbar,{menuOptions:{shouldForwardArgs:!0}}));return e.appendChild(n.item),{element:n.item,icon:n.icon,title:t.add(new Bc(n.title,{supportHighlights:!0,supportIcons:!0})),pinnedIndicator:n.pinnedIndicator,titleToolbar:l,detailsIcon:n.detailsIcon,badge:n.badge,separator:n.separator,diffContainer:n.diffContainer,diffAddedSpan:n.addedSpan,diffRemovedSpan:n.removedSpan,description:n.description,statusContainer:n.statusContainer,statusTime:n.statusTime,approvalRow:n.approvalRow,approvalLabel:n.approvalLabel,approvalButtonContainer:n.approvalButtonContainer,contextKeyService:r,elementDisposable:o,disposables:t}}renderElement(e,t,o,n){if(o.elementDisposable.clear(),o.diffAddedSpan.textContent="",o.diffRemovedSpan.textContent="",o.badge.textContent="",o.description.textContent="",o.element.classList.toggle("archived",e.element.isArchived()),this.options.isGroupedByRepository?.()){let v=_0e(e.element);v?o.element.setAttribute("data-section-label",v):o.element.removeAttribute("data-section-label")}else o.element.removeAttribute("data-section-label");if(this.options.useStatusOnlyIcons){let v=this.getIcon(e.element,!0);o.icon.className=`agent-session-icon ${q.asClassName(v)}${e.element.status===3?" needs-input":""}`,o.icon.style.color=v.color?kt(v.color.id):"",e.element.providerType==="copilotcli"?o.detailsIcon.className="agent-session-details-icon":(o.detailsIcon.className=`agent-session-details-icon ${q.asClassName(e.element.icon)}`,o.detailsIcon.classList.add("visible"))}else{let v=this.getIcon(e.element);o.icon.className=`agent-session-icon ${q.asClassName(v)}${e.element.status===3?" needs-input":""}`,o.icon.style.color=v.color?kt(v.color.id):"",o.detailsIcon.className="agent-session-details-icon"}let r=new Ie(e.element.label);o.title.setLabel(Da(r),void 0,{matches:xa(e.filterData)}),ie.isArchivedAgentSession.bindTo(o.contextKeyService).set(e.element.isArchived()),ie.isPinnedAgentSession.bindTo(o.contextKeyService).set(e.element.isPinned()),ie.isReadAgentSession.bindTo(o.contextKeyService).set(e.element.isRead()),ie.agentSessionType.bindTo(o.contextKeyService).set(e.element.providerType),o.titleToolbar.context=e.element;let s=e.element.isPinned();o.pinnedIndicator.className="agent-session-pinned-indicator "+q.asClassName(R.pinned),o.pinnedIndicator.classList.toggle("visible",s);let l=this.renderBadge(e,o),c=!1,{changes:u}=e.element;!HC(e.element.status)&&u&&Ipe(u)&&this.renderDiff(e,o)&&(c=!0);let p=!1;e.element.providerType==="copilotcli"||e.element.providerType==="copilot-cloud-agent"?p=Array.isArray(u)&&u.length>0:p=c,ie.hasAgentSessionChanges.bindTo(o.contextKeyService).set(p);let h=this.renderDescription(e,o),g=this.renderStatus(e,o),f=h&&HC(e.element.status);o.badge.classList.toggle("has-badge",l&&!f),o.diffContainer.classList.toggle("has-diff",c&&!f),o.statusContainer.classList.toggle("hidden",f),o.separator.classList.toggle("has-separator",!f&&l&&c),o.description.classList.toggle("has-separator",h&&!f&&(l||c)),o.statusContainer.classList.toggle("has-separator",!f&&g&&(l||c||h)),this.renderHover(e,o),this._approvalModel&&this.renderApprovalRow(e,o)}renderBadge(e,t){if(this.options.hideSessionBadge)return!1;let o=e.element.badge;if(!o)return!1;if(this.options.isGroupedByRepository?.()&&!e.element.isArchived()&&!e.element.isPinned()){let l=(typeof o=="string"?o:o.value).match(/^\$\((?:repo|folder|worktree)\)\s*(.+)/);if(l){let c=l[1].trim(),u=_0e(e.element);if(c===u)return!1}}let n=this.stripCodicons(o);return(typeof n=="string"?n:n.value)?(this.renderMarkdownOrText(n,t.badge,t.elementDisposable),!0):!1}stripCodicons(e){let o=(typeof e=="string"?e:e.value).replace(/\$\([a-z0-9\-]+\)\s*/gi,"").trim();return typeof e=="string"?o:Ie.lift({...e,value:o})}renderMarkdownOrText(e,t,o){typeof e=="string"?t.textContent=e:o.add(this.markdownRendererService.render(e,{sanitizerConfig:{replaceWithPlaintext:!0,allowedTags:{override:Eot},allowedLinkSchemes:{augment:[this.productService.urlProtocol]}}},t))}renderDiff(e,t){let o=DDe(e.element.changes);return!o||o.insertions===0&&o.deletions===0?!1:(o.insertions>=0&&(t.diffAddedSpan.textContent=`+${o.insertions}`),o.deletions>=0&&(t.diffRemovedSpan.textContent=`-${o.deletions}`),!0)}getIcon(e,t){if(e.status===2)return{...R.sessionInProgress,color:Yu("textLink.foreground")};if(e.status===3)return{...R.circleFilled,color:Yu("list.warningForeground")};if(e.status===0)return{...R.error,color:Yu("errorForeground")};if(t){let o=e.metadata;if(o?.pullRequestUrl||o?.pullRequestNumber)switch(o?.pullRequestState){case"merged":return{...R.gitPullRequestDone,color:Yu("charts.purple")};case"closed":return{...R.gitPullRequestClosed,color:Yu("charts.red")};case"draft":return{...R.gitPullRequestDraft,color:Yu("descriptionForeground")};default:return{...R.gitPullRequest,color:Yu("charts.green")}}}return!e.isRead()&&!e.isArchived()?{...R.circleFilled,color:Yu("textLink.foreground")}:!t&&e.providerType==="local"?{...R.circleSmallFilled,color:Yu("agentSessionReadIndicator.foreground")}:t?{...R.circleSmallFilled,color:Yu("agentSessionReadIndicator.foreground")}:e.icon}renderDescription(e,t){let o=e.element.description;return o?(this.renderMarkdownOrText(o,t.description,t.elementDisposable),!0):e.element.status===2?(t.description.textContent=d(6139,null),!0):e.element.status===3?(t.description.textContent=d(6140,null),!0):e.element.status===0?(t.description.textContent=d(6138,null),!0):(t.description.textContent="",!1)}toDuration(e,t,o,n){let r=Math.max(Math.round((t-e)/1e3)*1e3,1e3);return!n&&r<6e4?d(6145,null):u7(r,o)}renderStatus(e,t){let o=e.element.isPinned()&&this.options.isGroupedByRepository?.()?_0e(e.element):void 0,n=s=>{let l;if(s.status===2&&s.timing.lastRequestStarted&&(l=this.toDuration(s.timing.lastRequestStarted,Date.now(),!1,!1)),!l){let c=this.options.isSortedByUpdated?.()?s.timing.lastRequestEnded??s.timing.created:s.timing.created;Math.round((new Date().getTime()-c)/1e3)<60?l=d(6145,null):l=QRi(c,!0)}return o?`${o} \xB7 ${l}`:l};return t.statusTime.textContent=n(e.element),t.elementDisposable.add(new FI).cancelAndSet(()=>t.statusTime.textContent=n(e.element),e.element.status===2?1e3:60*1e3),!0}renderHover(e,t){if(this.options.disableHover||!HC(e.element.status)&&e.element.isRead())return;let o=e.element.status===3;t.elementDisposable.add(this.hoverService.setupDelayedHover(t.element,()=>this.buildHoverContent(e.element),{groupId:"agent.sessions",reducedDelay:o}))}buildHoverContent(e){this.sessionHover.value?.session.resource.toString()!==e.resource.toString()&&(this.sessionHover.value=this.instantiationService.createInstance(k0e,e));let t=this.sessionHover.value;return{id:`agent.session.hover.${e.resource.toString()}`,content:t.domNode,style:1,onDidShow:()=>t.onRendered(),position:{hoverPosition:this.options.getHoverPosition()}}}renderApprovalRow(e,t){if(this._approvalModel===void 0)throw new li("Approval model is required to render approval row");let o=this._approvalModel,r=!!o.getApproval(e.element.resource).get();t.approvalRow.classList.toggle("visible",r);let s=t.elementDisposable.add(new N);t.elementDisposable.add(be(l=>{s.clear();let c=o.getApproval(e.element.resource).read(l),u=!!c;if(t.approvalRow.classList.toggle("visible",u),c){let p=c.label.split(`
`),h=NM.APPROVAL_ROW_MAX_LINES,g=p.slice(0,h);p.length>h&&(g[h-1]=`${g[h-1]} \u2026`);let f=c.languageId??"json",v=new Ie;for(let w of g)v.appendCodeblock(f,w);this.renderMarkdownOrText(v,t.approvalLabel,s);let b=new Ie().appendCodeblock(c.languageId??"json",c.label);s.add(this.hoverService.setupDelayedHover(t.approvalLabel,{content:b,style:1,position:{hoverPosition:2}})),t.approvalButtonContainer.textContent="";let S=this._activeSessionResource.read(l)?.toString()===e.element.resource.toString(),y=s.add(new Wi(t.approvalButtonContainer,{title:d(6137,null),secondary:S,...Qo}));y.label=d(6136,null),s.add(y.onDidClick(()=>c.confirm()))}r!==u&&(r=u,this._onDidChangeItemHeight.fire(e.element))}))}renderCompressedElements(e,t,o,n){throw new Error("Should never happen since session is incompressible")}disposeElement(e,t,o,n){o.elementDisposable.clear()}disposeTemplate(e){e.disposables.dispose()}};NM=I([m(3,On),m(4,tt),m(5,nt),m(6,F),m(7,X)],NM);function osn(a){let i;switch(a){case 3:i=d(6118,null);break;case 2:i=d(6116,null);break;case 0:i=d(6115,null);break;default:i=d(6114,null)}return i}var IQ=class{constructor(i,e,t){this.sectionOptions=i;this.instantiationService=e;this.contextKeyService=t;this.templateId=IQ.TEMPLATE_ID}static{this.TEMPLATE_ID="agent-session-section"}renderTemplate(i){let e=new N,t=ct("div.agent-session-section@container",[ct("span.agent-session-section-label@label"),ct("span.agent-session-section-count@count"),ct("div.agent-session-section-toolbar@toolbar")]),o=e.add(this.contextKeyService.createScoped(t.container)),n=e.add(this.instantiationService.createChild(new _o([X,o]))),r=e.add(n.createInstance(or,t.toolbar,D.AgentSessionSectionToolbar,{menuOptions:{shouldForwardArgs:!0}}));return i.appendChild(t.container),{container:t.container,label:t.label,count:t.count,toolbar:r,contextKeyService:o,disposables:e}}renderElement(i,e,t,o){t.label.textContent=i.element.label,this.sectionOptions.hideSectionCount?t.count.textContent="":t.count.textContent=String(i.element.sessions.length),ie.agentSessionSection.bindTo(t.contextKeyService).set(i.element.section),t.toolbar.context=i.element}renderCompressedElements(i,e,t,o){throw new Error("Should never happen since section header is incompressible")}disposeElement(i,e,t,o){}disposeTemplate(i){i.disposables.dispose()}};IQ=I([m(1,F),m(2,X)],IQ);var OM=class a{constructor(i){this.options=i;this.templateId=a.TEMPLATE_ID}static{this.TEMPLATE_ID="agent-session-show-more"}static{this.HEIGHT=26}static{this.COLLAPSED_HEIGHT=1}renderTemplate(i){let e=new N,t=ct("div.agent-session-show-more@container",[ct("span.agent-session-show-more-label@label")]);return i.appendChild(t.container),{container:t.container,label:t.label,disposables:e}}renderElement(i,e,t){t.label.textContent=this.options?.compactLabel?d(6128,null,i.element.remainingCount):d(6127,null,i.element.remainingCount),t.container.setAttribute("data-section-label",i.element.sectionLabel)}renderCompressedElements(){throw new Error("Should never happen since show-more is incompressible")}disposeElement(){}disposeTemplate(i){i.disposables.dispose()}},drt=class a{constructor(){this.templateId=a.TEMPLATE_ID}static{this.TEMPLATE_ID="agent-session-show-less"}static{this.HEIGHT=OM.HEIGHT}renderTemplate(i){let e=new N,t=ct("div.agent-session-show-more@container",[ct("span.agent-session-show-more-label@label")]);return i.appendChild(t.container),{container:t.container,label:t.label,disposables:e}}renderElement(i,e,t){t.label.textContent=d(6126,null),t.container.setAttribute("data-section-label",i.element.sectionLabel)}renderCompressedElements(){throw new Error("Should never happen since show-less is incompressible")}disposeElement(){}disposeTemplate(i){i.disposables.dispose()}},ife=class a{constructor(i,e){this._approvalModel=i;this._compactShowMore=e}static{this.ITEM_HEIGHT=54}static{this.SECTION_HEIGHT=26}getHeight(i){if(LS(i))return a.SECTION_HEIGHT;if(u0(i)||p0(i))return this._compactShowMore?OM.COLLAPSED_HEIGHT:OM.HEIGHT;let e=a.ITEM_HEIGHT,t=this._approvalModel?.getApproval(i.resource).get();return t&&(e+=NM.getApprovalRowHeight(t.label)),e}hasDynamicHeight(i){return u0(i)||p0(i)?!0:!!this._approvalModel&&d0(i)}getTemplateId(i){return LS(i)?IQ.TEMPLATE_ID:u0(i)?OM.TEMPLATE_ID:p0(i)?drt.TEMPLATE_ID:NM.TEMPLATE_ID}},F2t=class{getWidgetRole(){return"list"}getRole(i){return"listitem"}getWidgetAriaLabel(){return d(6119,null)}getAriaLabel(i){if(LS(i)){let e=i.sessions.length;return e===1?d(6133,null,i.label,e):d(6132,null,i.label,e)}return u0(i)?d(6135,null,i.remainingCount):p0(i)?d(6134,null):d(6117,null,i.providerLabel,i.label,osn(i.status),new Date(i.timing.created).toLocaleString())}},W2t=class a extends x{constructor(e,t,o){super();this.filter=e;this.sorter=t;this.repositoryGroupLimit=o;this._onDidGetChildren=this._register(new E);this.onDidGetChildren=this._onDidGetChildren.event;this._onDidExpandRepositoryGroup=this._register(new E);this.onDidExpandRepositoryGroup=this._onDidExpandRepositoryGroup.event;this.expandedRepositoryGroups=new Set;if(this.filter){let n=this.filter.getExcludes().repositoryGroupCapped;this._register(this.filter.onDidChange(()=>{let r=this.filter.getExcludes().repositoryGroupCapped;r&&!n&&this.expandedRepositoryGroups.clear(),n=r}))}}static{this.CAPPED_SESSIONS_LIMIT=3}static{this.REPOSITORY_GROUP_LIMIT=5}expandRepositoryGroup(e){this.expandedRepositoryGroups.add(e),this._onDidExpandRepositoryGroup.fire()}collapseRepositoryGroup(e){this.expandedRepositoryGroups.delete(e),this._onDidExpandRepositoryGroup.fire()}hasChildren(e){return WNt(e)?!0:LS(e)?e.sessions.length>0:!1}getChildren(e){if(WNt(e)){let t=e.sessions.filter(n=>!this.filter?.exclude(n)),o=this.filter?.limitResults?.();return(!this.filter?.groupResults?.()||typeof o=="number")&&t.sort(this.sorter.compare.bind(this.sorter)),typeof o=="number"&&(t=t.slice(0,o)),this.filter?.notifyResults?.(t.length),this._onDidGetChildren.fire(t.length),this.filter?.groupResults?.()?this.groupSessionsIntoSections(t):t}else if(LS(e)){if(this.repositoryGroupLimit&&this.filter?.getExcludes().repositoryGroupCapped&&e.section==="repository"&&e.sessions.length>this.repositoryGroupLimit){if(this.expandedRepositoryGroups.has(e.label))return[...e.sessions,{showLess:!0,sectionLabel:e.label}];{let o=e.sessions.slice(0,this.repositoryGroupLimit),n=e.sessions.length-this.repositoryGroupLimit;return[...o,{showMore:!0,sectionLabel:e.label,remainingCount:n}]}}return e.sessions}else return[]}groupSessionsIntoSections(e){let t=this.filter?.groupResults?.()==="capped",o=this.sorter,n=o instanceof yQ?e.sort((r,s)=>o.compare(r,s,!0)):e.sort(o.compare.bind(o));return t?this.filter?.getExcludes().read?n:this.groupSessionsCapped(n):this.filter?.groupResults?.()==="repository"?this.groupSessionsByRepository(n):this.groupSessionsByDate(n)}groupSessionsCapped(e){let t=[],o=e.findIndex(g=>g.isArchived()),n=o===-1?e.length:o,r=e.slice(0,n),s=e.slice(n),l=r.filter(g=>g.isPinned()),c=r.filter(g=>!g.isPinned()),u=c.slice(0,a.CAPPED_SESSIONS_LIMIT),p=c.slice(a.CAPPED_SESSIONS_LIMIT);t.push(...l,...u);let h=[...p,...s];return h.length>0&&t.push({section:"more",label:lU.more,sessions:h}),t}groupSessionsByDate(e){let t=[],o=this.filter?.sortResults?.(),n=urt(e,o);for(let{sessions:r,section:s,label:l}of n.values())r.length!==0&&t.push({section:s,label:l,sessions:r});return t}groupSessionsByRepository(e){let t=new Map,o=[],n=[],r=[];for(let c of e){if(c.isArchived()){n.push(c);continue}if(c.isPinned()){o.push(c);continue}let u=_0e(c);if(u){let p=t.get(u);p||(p={label:u,sessions:[]},t.set(u,p)),p.sessions.push(c)}else r.push(c)}let s=[];s.push(...o);let l=[...t.values()].sort((c,u)=>OI(c.label,u.label));for(let{label:c,sessions:u}of l)s.push({section:"repository",label:c,sessions:u});return r.length>0&&s.push({section:"repository",label:lU.repository,sessions:r}),n.length>0&&s.push({section:"archived",label:lU.archived,sessions:n}),s}};function _0e(a){let i=a.metadata;if(i){let t=i.remoteAgentHost;if(t){let h=i.workingDirectoryPath;if(h){let g=O2t(h);if(g)return`${g} [${t}]`}return t}let o=i.owner,n=i.name;if(o&&n)return n;let r=i.repositoryNwo;if(r&&r.includes("/"))return r.split("/").pop();let s=i.repository;if(s){let h=yIo(s);if(h)return h}let l=i.repositoryUrl;if(l){let h=yIo(l);if(h)return h}let c=i.repositoryPath;if(c){let h=O2t(c);if(h)return h}let u=i.worktreePath;if(u){let h=O2t(u);if(h)return h}let p=i.workingDirectoryPath;if(p){let h=O2t(p);if(h)return h}}let e=a.badge;if(e){let o=(typeof e=="string"?e:e.value).match(/\$\((?:repo|folder|worktree)\)\s*(.+)/);if(o)return o[1].trim()}}function yIo(a){if(a.includes("/")&&!a.includes("://")&&!a.startsWith("git@")){let i=a.split("/").filter(Boolean).pop();return i?.endsWith(".git")&&(i=i.slice(0,-4)),i||void 0}try{let e=new URL(a).pathname.split("/").filter(Boolean);if(e.length>=2){let t=e[1];return t.endsWith(".git")&&(t=t.slice(0,-4)),t||void 0}}catch{}if(a.startsWith("git@")){let i=a.indexOf(":");if(i!==-1&&i<a.length-1){let t=a.substring(i+1).split("/").filter(Boolean).pop();return t?.endsWith(".git")&&(t=t.slice(0,-4)),t||void 0}}}function O2t(a){let i=a.split(/[/\\]/).filter(Boolean);if(i.length<2)return i[0];let e=i[i.length-2];return e.endsWith(".worktrees")?e.slice(0,-10)||void 0:i[i.length-1]}var lU={pinned:d(6125,null),today:d(6129,null),yesterday:d(6131,null),week:d(6130,null),older:d(6124,null),archived:d(6120,null),more:d(6122,null),repository:d(6123,null)},V2t=1440*60*1e3,nsn=7*V2t;function urt(a,i){let e=Date.now(),t=new Date(e).setHours(0,0,0,0),o=t-V2t,n=e-nsn,r=[],s=[],l=[],c=[],u=[],p=[];for(let h of a)if(h.isArchived())p.push(h);else if(h.isPinned())r.push(h);else{let g=i==="updated"?h.timing.lastRequestEnded??h.timing.created:h.timing.created;g>=t?s.push(h):g>=o?l.push(h):g>=n?c.push(h):u.push(h)}return new Map([["pinned",{section:"pinned",label:lU.pinned,sessions:r}],["today",{section:"today",label:lU.today,sessions:s}],["yesterday",{section:"yesterday",label:lU.yesterday,sessions:l}],["week",{section:"week",label:lU.week,sessions:c}],["older",{section:"older",label:lU.older,sessions:u}],["archived",{section:"archived",label:lU.archived,sessions:p}]])}function QRi(a,i){let e=Date.now(),t=new Date(e).setHours(0,0,0,0),o=t-V2t,n=o-V2t;return a<t&&a>=o?i?d(6144,null):d(6143,null):a<o&&a>=n?i?d(6142,null):d(6141,null):ea(a,i)}var B2t=class{getId(i){return LS(i)?`section-${i.section}-${i.label}`:u0(i)?`show-more-${i.sectionLabel}`:p0(i)?`show-less-${i.sectionLabel}`:d0(i)?i.resource.toString():"agent-sessions-id"}getGroupId(i){return LS(i)||WNt(i)?Hle:1}},H2t=class{isIncompressible(i){return!0}},yQ=class{constructor(i){this.getSortBy=i??(()=>"created")}compare(i,e,t=!1){if(t){let p=i.status===3,h=e.status===3;if(p&&!h)return-1;if(!p&&h)return 1}let o=i.isArchived(),n=e.isArchived();if(!o&&n)return-1;if(o&&!n)return 1;let r=!o&&i.isPinned(),s=!n&&e.isPinned();if(r&&!s)return-1;if(!r&&s)return 1;let l=this.getSortBy(),c=t?i.timing.lastRequestStarted??i.timing.created:l==="updated"?i.timing.lastRequestEnded??i.timing.created:i.timing.created;return(t?e.timing.lastRequestStarted??e.timing.created:l==="updated"?e.timing.lastRequestEnded??e.timing.created:e.timing.created)-c}},U2t=class{getKeyboardNavigationLabel(i){return LS(i)?i.label:u0(i)||p0(i)?i.sectionLabel:i.label}getCompressedNodeKeyboardNavigationLabel(i){}},T0e=class extends x{constructor(e){super();this.instantiationService=e}onDragStart(e,t){let o=e.getData().filter(r=>d0(r)),n=di(o.map(r=>r.resource));this.instantiationService.invokeFunction(r=>tv(r,n,t))}getDragURI(e){return LS(e)||u0(e)||p0(e)?null:e.resource.toString()}getDragLabel(e,t){let o=e.filter(n=>d0(n));return o.length===1?o[0].label:d(6121,null,o.length)}onDragOver(e,t,o,n,r){return!1}drop(e,t,o,n,r){}};T0e=I([m(0,F)],T0e);var YRi={iconClass:q.asClassName(R.archive),tooltip:d(6108,null)},XRi={iconClass:q.asClassName(R.inbox),tooltip:d(6112,null)},z2t={iconClass:q.asClassName(R.edit),tooltip:d(6111,null)},K2t={iconClass:q.asClassName(R.trash),tooltip:d(6110,null)};function JRi(a){let i=typeof a.description=="string"?a.description:a.description?Da(a.description):void 0,e=QRi(a.timing.created);return[i,a.providerLabel,e].filter(o=>!!o).join(" \u2022 ")}function ZRi(a){let i=[];return LDe(a)&&(i.push(z2t),i.push(K2t)),i.push(a.isArchived()?XRi:YRi),i}var coe=class{constructor(i,e,t,o,n,r){this.anchor=i;this.options=e;this.agentSessionsService=t;this.quickInputService=o;this.instantiationService=n;this.commandService=r;this.sorter=new yQ}async pickAgentSession(){let i=new N,e=i.add(this.quickInputService.createQuickPick({useSeparators:!0})),t=i.add(this.instantiationService.createInstance(TW,{}));e.anchor=this.anchor,e.items=this.createPickerItems(t),e.canAcceptInBackground=!0,e.placeholder=d(6109,null),i.add(e.onDidAccept(o=>{let n=e.selectedItems[0];if(n){let r={sideBySide:o.inBackground,editorOptions:{preserveFocus:o.inBackground,pinned:o.inBackground}};this.options?.overrideSessionOpen?this.options.overrideSessionOpen(n.session,r):this.instantiationService.invokeFunction(x0e,n.session,r)}o.inBackground||e.hide()})),i.add(e.onDidTriggerItemButton(async o=>{let n=o.item.session,r=!1;if(o.button===z2t)r=!0,await this.commandService.executeCommand(QEe,n);else if(o.button===K2t)r=!0,await this.commandService.executeCommand(YEe,n);else{let s=!n.isArchived();n.setArchived(s)}r?(await this.agentSessionsService.model.resolve(n.providerType),this.pickAgentSession()):e.items=this.createPickerItems(t)})),i.add(e.onDidHide(()=>i.dispose())),e.show()}createPickerItems(i){let e=this.agentSessionsService.model.sessions.filter(n=>!i.exclude(n)).sort(this.sorter.compare.bind(this.sorter)),t=[],o=urt(e);for(let n of o.values())n.sessions.length>0&&(t.push({type:"separator",label:n.label}),t.push(...n.sessions.map(r=>this.toPickItem(r))));return t}toPickItem(i){let e=JRi(i),t=ZRi(i);return{id:i.resource.toString(),label:i.label,tooltip:i.tooltip,description:e,iconClass:q.asClassName(i.icon),buttons:t,session:i}}};coe=I([m(2,md),m(3,Ue),m(4,F),m(5,ge)],coe);var uoe=L(6068,"Chat Agent Sessions"),G2t=class extends K{constructor(){super({id:"workbench.action.chat.toggleShowAgentSessions",title:L(6067,"Show Sessions"),toggled:C.equals("config.chat.viewSessions.enabled",!0),menu:{id:D.ChatWelcomeContext,group:"0_sessions",order:2,when:ie.inChatEditor.negate()}})}async run(i){let e=i.get(B),t=e.getValue("chat.viewSessions.enabled");await e.updateValue("chat.viewSessions.enabled",!t)}},tMi=new D("chatAgentSessionsOrientationSubmenu");ve.appendMenuItem(D.ChatWelcomeContext,{submenu:tMi,title:L(6064,"Sessions Orientation"),group:"0_sessions",order:1,when:ie.inChatEditor.negate()});var q2t=class extends K{constructor(){super({id:"workbench.action.chat.setAgentSessionsOrientationStacked",title:L(6066,"Stacked"),toggled:C.equals("config.chat.viewSessions.orientation","stacked"),precondition:C.equals("config.chat.viewSessions.enabled",!0),menu:{id:tMi,group:"navigation",order:2}})}async run(i){await i.get(ge).executeCommand(tq.ID)}},$2t=class extends K{constructor(){super({id:"workbench.action.chat.setAgentSessionsOrientationSideBySide",title:L(6065,"Side by Side"),toggled:C.notEquals("config.chat.viewSessions.orientation","stacked"),precondition:C.equals("config.chat.viewSessions.enabled",!0),menu:{id:tMi,group:"navigation",order:1}})}async run(i){await i.get(ge).executeCommand(tL.ID)}},j2t=class extends K{constructor(){super({id:"workbench.action.chat.history",title:L(6046,"Open Agent Session..."),menu:[{id:D.ViewTitle,when:C.and(C.equals("view",Dr),C.equals("config.chat.viewSessions.enabled",!1)),group:"navigation",order:2},{id:D.EditorTitle,when:fr.isEqualTo(Na.EditorID)}],category:uoe,icon:R.history,f1:!0,precondition:ie.enabled})}async run(i){await i.get(F).createInstance(coe,void 0,void 0).pickAgentSession()}},Q2t=class extends K{constructor(){super({id:"workbench.action.chat.archiveAllAgentSessions",title:L(6048,"Archive All Workspace Agent Sessions"),precondition:ie.enabled,category:uoe,f1:!0})}async run(i){let e=i.get(md),t=i.get(at),o=e.model.sessions.filter(r=>!r.isArchived());if(!(o.length===0||!(await t.confirm({message:o.length===1?d(6051,null):d(6050,null,o.length),detail:d(6052,null),primaryButton:d(6049,null)})).confirmed))for(let r of o)r.setArchived(!0)}},Y2t=class extends K{constructor(){super({id:"workbench.action.chat.markAllAgentSessionsRead",title:L(6082,"Mark All as Read"),precondition:ie.enabled,category:uoe,f1:!0,menu:{id:D.AgentSessionsContext,group:"0_read",order:2,when:ie.isArchivedAgentSession.negate()}})}async run(i){let t=i.get(md).model.sessions.filter(o=>!o.isArchived()&&!o.isRead());if(t.length!==0)for(let o of t)o.setRead(!0)}},X2t="chat.sessions.confirmArchive",J2t=class extends K{constructor(){super({id:"agentSessionSection.archive",title:L(6053,"Archive All"),icon:R.archive,menu:[{id:D.AgentSessionSectionToolbar,group:"navigation",order:1,when:ie.agentSessionSection.notEqualsTo("archived")},{id:D.AgentSessionSectionContext,group:"1_edit",order:2,when:ie.agentSessionSection.notEqualsTo("archived")}]})}async run(i,e){if(!e||!LS(e))return;let t=i.get(at),o=i.get(ce);if(!o.getBoolean(X2t,0,!1)){let r=await t.confirm({message:e.sessions.length===1?d(6056,null,e.label):d(6055,null,e.sessions.length,e.label),detail:d(6057,null),primaryButton:d(6054,null),checkbox:{label:d(6079,null)}});if(!r.confirmed)return;r.checkboxChecked&&o.store(X2t,!0,0,0)}for(let r of e.sessions)r.setArchived(!0)}},Z2t=class extends K{constructor(){super({id:"agentSessionSection.unarchive",title:L(6093,"Unarchive All"),icon:R.unarchive,menu:[{id:D.AgentSessionSectionToolbar,group:"navigation",order:1,when:ie.agentSessionSection.isEqualTo("archived")},{id:D.AgentSessionSectionContext,group:"1_edit",order:2,when:ie.agentSessionSection.isEqualTo("archived")}]})}async run(i,e){if(!e||!LS(e))return;let t=i.get(at),o=i.get(ce);if(e.sessions.length>1&&!o.getBoolean(X2t,0,!1)){let r=await t.confirm({message:d(6094,null,e.sessions.length),primaryButton:d(6095,null),checkbox:{label:d(6079,null)}});if(!r.confirmed)return;r.checkboxChecked&&o.store(X2t,!0,0,0)}for(let n of e.sessions)n.setArchived(!1)}},eGt=class extends K{constructor(){super({id:"agentSessionSection.markRead",title:L(6084,"Mark All as Read"),menu:[{id:D.AgentSessionSectionContext,group:"1_edit",order:1,when:ie.agentSessionSection.notEqualsTo("archived")}]})}async run(i,e){if(!(!e||!LS(e)))for(let t of e.sessions)t.setRead(!0)}},tGt=class extends K{constructor(){super({id:"agentSessionSection.collapseAll",title:L(6069,"Collapse All"),menu:[{id:D.AgentSessionSectionContext,group:"2_collapse",order:1}]})}async run(i,e,t){t?.collapseAllSections()}},cU=class extends K{async run(i,e){let t=i.get(md),o=i.get($t),n=[];if(VNt(e)?n=di((e.sessions??[e.session]).map(r=>t.getSession(r.resource))):e&&(n=[e]),n.length===0){let s=o.getActiveViewWithId(Dr)?.getFocusedSessions().at(0);s&&(n=[s])}n.length>0&&await this.runWithSessions(n,i)}},iGt=class extends cU{constructor(){super({id:"agentSession.markUnread",title:L(6085,"Mark as Unread"),menu:{id:D.AgentSessionsContext,group:"0_read",order:1,when:C.and(ie.isReadAgentSession,ie.isArchivedAgentSession.negate())}})}runWithSessions(i){for(let e of i)e.setRead(!1)}},oGt=class extends cU{constructor(){super({id:"agentSession.markRead",title:L(6083,"Mark as Read"),menu:{id:D.AgentSessionsContext,group:"0_read",order:1,when:C.and(ie.isReadAgentSession.negate(),ie.isArchivedAgentSession.negate())}})}runWithSessions(i){for(let e of i)e.setRead(!0)}},nGt=class extends cU{constructor(){super({id:"agentSession.archive",title:L(6047,"Archive"),icon:R.archive,keybinding:{primary:20,mac:{primary:2049},weight:201,when:C.and(ie.agentSessionsViewerFocused,ie.isArchivedAgentSession.negate())},menu:[{id:D.AgentSessionItemToolbar,group:"navigation",order:1,when:ie.isArchivedAgentSession.negate()},{id:D.AgentSessionsContext,group:"1_edit",order:2,when:ie.isArchivedAgentSession.negate()}]})}async runWithSessions(i,e){let t=e.get(mi),o=e.get(at);for(let n of i){let r=t.getSession(n.resource);if(r&&!await K9e(r,o,{isArchiveAction:!0,titleOverride:d(6058,null),messageOverride:d(6059,null)}))return;n.setArchived(!0)}}},rGt=class extends cU{constructor(){super({id:"agentSession.unarchive",title:L(6092,"Unarchive"),icon:R.unarchive,keybinding:{primary:1044,mac:{primary:3073},weight:201,when:C.and(ie.agentSessionsViewerFocused,ie.isArchivedAgentSession)},menu:[{id:D.AgentSessionItemToolbar,group:"navigation",order:1,when:ie.isArchivedAgentSession},{id:D.AgentSessionsContext,group:"1_edit",order:2,when:ie.isArchivedAgentSession}]})}runWithSessions(i){for(let e of i)e.setArchived(!1)}},sGt=class extends cU{constructor(){super({id:"agentSession.pin",title:L(6087,"Pin"),icon:R.pin,menu:[{id:D.AgentSessionItemToolbar,group:"navigation",order:0,when:C.and(ie.isPinnedAgentSession.negate(),ie.isArchivedAgentSession.negate())},{id:D.AgentSessionsContext,group:"0_pin",order:1,when:C.and(ie.isPinnedAgentSession.negate(),ie.isArchivedAgentSession.negate())}]})}runWithSessions(i){for(let e of i)e.setPinned(!0)}},aGt=class extends cU{constructor(){super({id:"agentSession.unpin",title:L(6096,"Unpin"),icon:R.pinned,menu:[{id:D.AgentSessionItemToolbar,group:"navigation",order:0,when:C.and(ie.isPinnedAgentSession,ie.isArchivedAgentSession.negate())},{id:D.AgentSessionsContext,group:"0_pin",order:1,when:C.and(ie.isPinnedAgentSession,ie.isArchivedAgentSession.negate())}]})}runWithSessions(i){for(let e of i)e.setPinned(!1)}},lGt=class extends cU{constructor(){super({id:QEe,title:L(6089,"Rename..."),precondition:ie.hasMultipleAgentSessionsSelected.negate(),keybinding:{primary:60,mac:{primary:3},weight:201,when:C.and(ie.agentSessionsViewerFocused,ie.agentSessionType.isEqualTo("local"))},menu:{id:D.AgentSessionsContext,group:"1_edit",order:3,when:ie.agentSessionType.isEqualTo("local")}})}async runWithSessions(i,e){let t=i.at(0);if(!t)return;let o=e.get(Ue),n=e.get(mi),r=await o.input({prompt:d(6086,null),value:t.label});r&&n.setChatSessionTitle(t.resource,r)}},cGt=class extends cU{constructor(){super({id:YEe,title:L(6070,"Delete..."),menu:{id:D.AgentSessionsContext,group:"1_edit",order:4,when:ie.agentSessionType.isEqualTo("local")}})}async runWithSessions(i,e){if(i.length===0)return;let t=e.get(mi),o=e.get(at),n=e.get(Pt);if((await o.confirm({message:i.length===1?d(6075,null):d(6078,null,i.length),detail:d(6077,null),primaryButton:d(6076,null)})).confirmed)for(let s of i)await n.getWidgetBySessionResource(s.resource)?.clear(),await t.removeHistoryEntry(s.resource)}},dGt=class extends K{constructor(){super({id:"workbench.action.chat.clearHistory",title:L(6045,"Delete All Local Workspace Chat Sessions"),precondition:ie.enabled,category:uoe,f1:!0})}async run(i,...e){let t=i.get(mi),o=i.get(Pt),n=i.get(at),s=i.get(md).model.sessions.filter(c=>LDe(c)).length;s===0||!(await n.confirm({message:s===1?d(6073,null):d(6072,null,s),detail:d(6074,null),primaryButton:d(6071,null)})).confirmed||(await Promise.all(o.getAllWidgets().map(c=>c.clear())),await t.clearAllHistoryEntries())}},prt=class extends cU{async runWithSessions(i,e){let t=e.get(Pt),o=this.getTargetGroup();for(let n of i){let r=n.resource;await t.openSession(r,o,{...this.getOptions(),pinned:!0})}}},uGt=class a extends prt{static{this.id="workbench.action.chat.openSessionInEditorGroup"}constructor(){super({id:a.id,title:L(6061,"Open as Editor"),keybinding:{primary:2051,mac:{primary:259},weight:201,when:C.and(ie.agentSessionsViewerFocused,wb.negate())},menu:{id:D.AgentSessionsContext,when:wb.negate(),order:1,group:"navigation"}})}getTargetGroup(){return jn}getOptions(){return{}}},pGt=class a extends prt{static{this.id="workbench.action.chat.openSessionInNewEditorGroup"}constructor(){super({id:a.id,title:L(6062,"Open to the Side"),keybinding:{primary:2563,mac:{primary:771},weight:201,when:C.and(ie.agentSessionsViewerFocused,wb.negate())},menu:{id:D.AgentSessionsContext,when:wb.negate(),order:2,group:"navigation"}})}getTargetGroup(){return In}getOptions(){return{}}},mGt=class a extends prt{static{this.id="workbench.action.chat.openSessionInNewWindow"}constructor(){super({id:a.id,title:L(6063,"Open in New Window"),menu:{id:D.AgentSessionsContext,order:3,group:"navigation"}})}getTargetGroup(){return Mg}getOptions(){return{auxiliary:{compact:!0,bounds:{width:800,height:640}}}}},hGt=class extends K{constructor(){super({id:"agentSessionsViewer.refresh",title:L(6088,"Refresh Agent Sessions"),icon:R.refresh,menu:{id:D.AgentSessionsToolbar,group:"navigation",order:1}})}run(i,e){e.refresh()}},gGt=class extends K{constructor(){super({id:"agentSessionsViewer.find",title:L(6080,"Find Agent Session"),icon:R.search,menu:{id:D.AgentSessionsToolbar,group:"navigation",order:2}})}run(i,e){return e.openFind()}},fGt=class extends K{async run(i){let e=i.get(yi),t=i.get(Bi),o=i.get(B),n=i.get($t),r=i.get(us),s=t.getViewLocationById(Dr);if(typeof s!="number")return;let l=e.getPanelPosition(),c=s!==1||l===0||l===1;o.getValue("chat.viewSessions.enabled")||await o.updateValue("chat.viewSessions.enabled",!0);let p=n.getActiveViewWithId(Dr);if(p||(p=await n.openView(Dr,!1)),!p)return;let h=o.getValue("chat.viewSessions.orientation"),g;h==="stacked"||h==="sideBySide"?g=h:g="sideBySide";let f=this.getOrientation(),v=p?.getLastDimensions(f)?.width;if((!c||g==="sideBySide")&&f===1?p.updateConfiguredSessionsViewerOrientation("stacked"):(!c||g==="stacked")&&f===2&&p.updateConfiguredSessionsViewerOrientation("sideBySide"),!c)return;let b=r.getPartId(s),S=e.getSize(b),y=300,w=y,k=y+w+1;if(f===2&&S.width>=k||f===1&&s===2&&e.isAuxiliaryBarMaximized())return;s===2&&(e.setAuxiliaryBarMaximized(!1),S=e.getSize(b));let T;f===2?T=Math.max(k,v||Math.round(e.mainContainerDimension.width/2)):T=v||Math.max(y,S.width-w),e.setSize(b,{width:T,height:S.height});let P=e.getSize(b);s===2&&f===2&&P.width<k&&e.setAuxiliaryBarMaximized(!0)}},tL=class a extends fGt{static{this.ID="agentSessions.showAgentSessionsSidebar"}static{this.TITLE=L(6090,"Show Agent Sessions Sidebar")}constructor(){super({id:a.ID,title:a.TITLE,precondition:C.and(ie.enabled,ie.agentSessionsViewerOrientation.isEqualTo(1)),f1:!0,category:uoe})}getOrientation(){return 2}},tq=class a extends fGt{static{this.ID="agentSessions.hideAgentSessionsSidebar"}static{this.TITLE=L(6081,"Hide Agent Sessions Sidebar")}constructor(){super({id:a.ID,title:a.TITLE,precondition:C.and(ie.enabled,ie.agentSessionsViewerOrientation.isEqualTo(2)),f1:!0,category:uoe})}getOrientation(){return 1}},vGt=class a extends K{static{this.ID="agentSessions.toggleAgentSessionsSidebar"}static{this.TITLE=L(6091,"Toggle Agent Sessions Sidebar")}constructor(){super({id:a.ID,title:a.TITLE,precondition:ie.enabled,f1:!0,category:uoe})}async run(i){let e=i.get(ge);i.get($t).getActiveViewWithId(Dr)?.getSessionsViewerOrientation()===2?await e.executeCommand(tq.ID):await e.executeCommand(tL.ID)}},doe=class a extends K{static{this.id="workbench.action.chat.focusAgentSessionsViewer"}constructor(){super({id:a.id,title:L(6060,"Focus Agent Sessions"),precondition:C.and(ie.enabled,C.equals("config.chat.viewSessions.enabled",!0)),category:uoe,f1:!0})}async run(i){let e=i.get($t),t=i.get(B),o=i.get(ge),n=await e.openView(Dr,!0);if(n?.focusSessions())return;t.getValue("chat.viewSessions.orientation")==="stacked"?await o.executeCommand(Zm):await o.executeCommand(tL.ID),n?.focusSessions()}};var bGt=class{constructor(){this.priority=107;this.name="panelChat";this.type="help";this.when=C.and(ie.location.isEqualTo("panel"),ie.inQuickChat.negate(),ie.chatModeKind.isEqualTo("ask"),C.or(ie.inChatSession,ie.isResponse,ie.isRequest))}getProvider(i){return D0e(i,void 0,"panelChat")}},SGt=class{constructor(){this.priority=107;this.name="quickChat";this.type="help";this.when=C.and(ie.inQuickChat,C.or(ie.inChatSession,ie.isResponse,ie.isRequest))}getProvider(i){return D0e(i,void 0,"quickChat")}},IGt=class{constructor(){this.priority=119;this.name="editsView";this.type="help";this.when=C.and(lhi.inEditingMode,ie.inChatInput)}getProvider(i){return D0e(i,void 0,"editsView")}},yGt=class{constructor(){this.priority=120;this.name="agentView";this.type="help";this.when=C.and(ie.chatModeKind.isEqualTo("agent"),ie.inChatInput)}getProvider(i){return D0e(i,void 0,"agentView")}};function rsn(a,i){let e=[];return(a==="panelChat"||a==="quickChat"||a==="agentView")&&(a==="quickChat"?(e.push(d(5657,null)),e.push(d(5649,null))):(e.push(d(5648,null)),e.push(d(5699,null,"<keybinding:workbench.action.chat.newChat>")),e.push(d(5698,null,"<keybinding:workbench.action.chat.history>")),e.push(d(5695,null,`<keybinding:${doe.id}>`))),e.push(d(5660,null)),e.push(d(5647,null)),e.push(d(5654,null,"<keybinding:editor.action.accessibleView>")),e.push(d(5655,null)),e.push(d(5694,null,iMi(i,a,"last"))),e.push(d(5697,null,iMi(i,a,"lastFocused"))),e.push(d(5696,null,iMi(i,a,"input"))),e.push(d(5659,null)),e.push(d(5646,null)),e.push(d(5700,null,"<keybinding:workbench.action.chat.nextCodeBlock>")),e.push(d(5701,null,"<keybinding:workbench.action.chat.nextUserPrompt>")),e.push(d(5702,null,"<keybinding:workbench.action.chat.previousUserPrompt>")),e.push(d(5692,null,"<keybinding:workbench.action.chat.focusConfirmation>")),e.push(d(5661,null,"<keybinding:workbench.action.terminal.chat.viewHiddenChatTerminals>")),e.push(d(5650,null,`<keybinding:${Ow.FocusMostRecentChatTerminal}>`)),e.push(d(5651,null,`<keybinding:${Ow.FocusMostRecentChatTerminalOutput}>`)),e.push(d(5652,null,"<keybinding:workbench.action.chat.focusQuestionCarousel>")),e.push(d(5658,null,"<keybinding:workbench.action.chat.previousQuestion>")),e.push(d(5656,null,"<keybinding:workbench.action.chat.nextQuestion>")),e.push(d(5653,null,"<keybinding:workbench.action.chat.focusTip>"))),a==="editsView"||a==="agentView"?(a==="agentView"?e.push(d(5667,null)):e.push(d(5678,null)),e.push(d(5675,null)),e.push(d(5674,null)),e.push(d(5680,null)),e.push(d(5682,null,"<keybinding:chatEditor.action.navigatePrevious>","<keybinding:chatEditor.action.navigateNext>")),e.push(d(5672,null,"<keybinding:chatEditor.action.acceptHunk>","<keybinding:chatEditor.action.undoHunk>","<keybinding:chatEditor.action.toggleDiff>")),e.push(d(5683,null)),a==="agentView"&&(e.push(d(5669,null)),e.push(d(5668,null,"<keybinding:workbench.action.chat.acceptTool>")),e.push(d(5664,null,"chat.tools.global.autoApprove","true")),e.push(d(5663,null,"<keybinding:workbench.action.chat.acceptTool>")),e.push(d(5666,null)),e.push(d(5665,null,"<keybinding:workbench.action.chat.focusTodosView>"))),e.push(d(5676,null)),e.push(d(5704,null,"<keybinding:workbench.action.chat.undoEdits>")),e.push(d(5703,null,"<keybinding:workbench.action.chat.restoreLastCheckpoint>")),e.push(d(5693,null,"<keybinding:workbench.action.chat.editing.attachFiles>")),e.push(d(5679,null,"<keybinding:chatEditing.removeFileFromWorkingSet>")),e.push(d(5671,null,"<keybinding:chatEditing.acceptFile>","<keybinding:chatEditing.discardFile>")),e.push(d(5681,null,"<keybinding:chatEditing.saveAllFiles>")),e.push(d(5670,null,"<keybinding:chatEditing.acceptAllFiles>")),e.push(d(5673,null,"<keybinding:chatEditing.discardAllFiles>")),e.push(d(5677,null,"<keybinding:chatEditing.openFileInDiff>")),e.push(`- ${Hhe.LABEL}<keybinding:chatEditing.viewChanges>`),e.push(`- ${Uhe.Label}<keybinding:chatEditing.viewPreviousEdits>`)):(e.push(d(5689,null)),e.push(d(5684,null,"<keybinding:inlineChat.start>")),e.push(d(5690,null,"<keybinding:history.showPrevious>","<keybinding:history.showNext>")),e.push(d(5688,null,"<keybinding:editor.action.accessibleView>")),e.push(d(5685,null)),e.push(d(5687,null)),e.push(d(5686,null,Lz.id)),e.push(d(5691,null))),e.push(d(5662,null)),e.join(`
`)}function D0e(a,i,e){let t=a.get(Pt),o=a.get(_e),n=t.lastFocusedWidget?.inputEditor;if(!n||!(n.getDomNode()??void 0))return;let s=n.getPosition();n.getSupportedActions();let l=rsn(e,o);return new xp(e==="panelChat"?"panelChat":e==="inlineChat"?"inlineChat":e==="agentView"?"agentChat":"quickChat",{type:"help"},()=>l,()=>{e==="quickChat"||e==="editsView"||e==="agentView"||e==="panelChat"?(s&&n.setPosition(s),n.focus()):e==="inlineChat"&&i?.getContribution(y1t)?.focus()},e==="inlineChat"?"accessibility.verbosity.inlineChat":"accessibility.verbosity.panelChat")}function iMi(a,i,e){let t,o=" (unassigned keybinding)";if(e==="input"?t=a.lookupKeybindings("workbench.action.chat.focusInput"):e==="lastFocused"?t=a.lookupKeybindings("workbench.chat.action.focusLastFocused"):t=a.lookupKeybindings("chat.action.focus"),!t?.length)return o;let n;return i==="agentView"||i==="panelChat"?e!=="input"?n=t.find(r=>r.getAriaLabel()?.includes("UpArrow"))?.getAriaLabel():n=t.find(r=>r.getAriaLabel()?.includes("DownArrow"))?.getAriaLabel():e!=="input"?n=t.find(r=>r.getAriaLabel()?.includes("DownArrow"))?.getAriaLabel():n=t.find(r=>r.getAriaLabel()?.includes("UpArrow"))?.getAriaLabel(),n?` (${n})`:o}var L0e=class{constructor(i,e,t,o,n,r,s,l){this.editorService=i;this.textFileService=e;this.bulkEditService=t;this.codeEditorService=o;this.chatService=n;this.languageService=r;this.dialogService=s;this.aiEditTelemetryService=l}async run(i){let e=EIo(this.editorService);if(e)await this.handleTextEditor(e,i);else{let t=oMi(this.editorService);t?await this.handleNotebookEditor(t,i):this.notify(d(5967,null))}if(Ui(i.element)){let t=i.element.requestId,o=i.element.session.getItems().find(r=>r.id===t&&Sr(r));kIo(this.chatService,i,{kind:"insert",codeBlockIndex:i.codeBlockIndex,totalCharacters:i.code.length,totalLines:i.code.split(`
`).length,languageId:i.languageId,modelId:o?.modelId??""});let n=i.element.model.codeBlockInfos?.at(i.codeBlockIndex);this.aiEditTelemetryService.handleCodeAccepted({acceptanceMethod:"insertAtCursor",suggestionId:n?.suggestionId,editDeltaInfo:lw.fromText(i.code),feature:"sideBarChat",languageId:i.languageId,modeId:i.element.model.request?.modeInfo?.modeId,modelId:o?.modelId,presentation:"codeBlock",applyCodeBlockSuggestionId:void 0,source:void 0})}}async handleNotebookEditor(i,e){if(i.isReadOnly)return this.notify(d(5969,null)),!1;let t=i.getFocus(),o=Math.max(t.end-1,0);return GH(this.languageService,i,o,2,"below",e.code,!0),!0}async handleTextEditor(i,e){let t=i.getModel();if(TIo(t,this.textFileService))return this.notify(d(5968,null)),!1;let o=i.getSelection()??new z(t.getLineCount(),1,t.getLineCount(),1),n=ssn(e.code,t,o.startLineNumber),r=[new nl(t.uri,{range:o,text:n})];return await this.bulkEditService.apply(r),this.codeEditorService.listCodeEditors().find(s=>Qe(s.getModel()?.uri,t.uri))?.focus(),!0}notify(i){this.dialogService.info(i)}};L0e=I([m(0,ee),m(1,Uo),m(2,La),m(3,qt),m(4,mi),m(5,_t),m(6,at),m(7,xS)],L0e);var R0e=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h){this.editorService=i;this.textFileService=e;this.chatService=t;this.fileService=o;this.dialogService=n;this.logService=r;this.codeMapperService=s;this.progressService=l;this.quickInputService=c;this.labelService=u;this.instantiationService=p;this.notebookService=h}async run(i){let e=EIo(this.editorService),t=await this.evaluateURIToUse(i.codemapperUri,e);if(!t)return;if(t&&!Qe(e?.getModel().uri,t)&&!this.notebookService.hasSupportedNotebooks(t))try{let r=await this.editorService.openEditor({resource:t}),s=ha(r?.getControl());if(s&&s.hasModel())this.tryToRevealCodeBlock(s,i.code),e=s;else{this.notify(d(5959,null,t.toString()));return}}catch(r){this.logService.info("[ApplyCodeBlockOperation] error opening code mapper file",t,r);return}let o;if(Ui(i.element)){let r=i.element.model.codeBlockInfos?.at(i.codeBlockIndex);r&&(o=r.suggestionId)}let n;if(e&&!this.notebookService.hasSupportedNotebooks(t))n=await this.handleTextEditor(e,i.chatSessionResource,i.code,o);else{let r=oMi(this.editorService);r?n=await this.handleNotebookEditor(r,i.chatSessionResource,i.code):this.notify(d(5961,null))}if(Ui(i.element)){let r=i.element.requestId,s=i.element.session.getItems().find(l=>l.id===r&&Sr(l));kIo(this.chatService,i,{kind:"apply",codeBlockIndex:i.codeBlockIndex,totalCharacters:i.code.length,codeMapper:n?.codeMapper,editsProposed:!!n?.editsProposed,totalLines:i.code.split(`
`).length,modelId:s?.modelId??"",languageId:i.languageId})}}async evaluateURIToUse(i,e){if(i&&await this.fileService.exists(i))return i;let t=e?.getModel().uri?{label:d(5957,null,this.labelService.getUriLabel(e.getModel().uri,{relative:!0})),id:"activeEditor"}:void 0,o={label:d(5970,null),id:"newUntitledFile"},n=[];i?(n.push({label:d(5966,null,this.labelService.getUriLabel(i,{relative:!0})),id:"createFile"}),n.push(o),t&&n.push(t)):(t&&n.push(t),n.push(o));let r=n.length>1?await this.quickInputService.pick(n,{placeHolder:d(5971,null)}):n[0];if(r)switch(r.id){case"createFile":if(i)try{await this.fileService.writeFile(i,qe.fromString(""))}catch(s){return this.notify(d(5960,null,s.message)),A.from({scheme:"untitled",path:i.path})}return i;case"newUntitledFile":return A.from({scheme:"untitled",path:i?i.path:"Untitled-1"});case"activeEditor":return e?.getModel().uri}}async handleNotebookEditor(i,e,t){if(i.isReadOnly){this.notify(d(5965,null));return}let o=i.textModel.uri,n={code:t,resource:o,markdownBeforeBlock:void 0},r=this.codeMapperService.providers[0]?.displayName;if(!r){this.notify(d(5962,null));return}let s=!1,l=new Ye;try{let c=await this.progressService.withProgress({location:15,delay:500,sticky:!0,cancellable:!0},async u=>{u.report({message:d(5963,null,r)});let p=this.getNotebookEdits(n,e,l.token);return await this.waitForFirstElement(p)},()=>l.cancel());s=await this.applyNotebookEditsWithInlinePreview(c,o,l)}catch(c){ao(c)||this.notify(d(5958,null,c.message))}finally{l.dispose()}return{editsProposed:s,codeMapper:r}}async handleTextEditor(i,e,t,o){let n=i.getModel();if(TIo(n,this.textFileService)){this.notify(d(5964,null));return}let r={code:t,resource:n.uri,chatSessionResource:e,markdownBeforeBlock:void 0},s=this.codeMapperService.providers[0]?.displayName;if(!s){this.notify(d(5962,null));return}let l=!1,c=new Ye;try{let u=await this.progressService.withProgress({location:15,delay:500,sticky:!0,cancellable:!0},async p=>{p.report({message:d(5963,null,s)});let h=this.getTextEdits(r,e,c.token);return await this.waitForFirstElement(h)},()=>c.cancel());l=await this.applyWithInlinePreview(u,i,c,o)}catch(u){ao(u)||this.notify(d(5958,null,u.message))}finally{c.dispose()}return{editsProposed:l,codeMapper:s}}getTextEdits(i,e,t){return new fp(async o=>{let n={codeBlocks:[i],chatSessionResource:e},r={textEdit:(l,c)=>{o.emitOne(c)},notebookEdit(l,c){}},s=await this.codeMapperService.mapCode(n,r,t);s?.errorMessage&&o.reject(new Error(s.errorMessage))})}getNotebookEdits(i,e,t){return new fp(async o=>{let n={codeBlocks:[i],chatSessionResource:e,location:"panel"},r={textEdit:(l,c)=>{o.emitOne([l,c])},notebookEdit(l,c){o.emitOne(c)}},s=await this.codeMapperService.mapCode(n,r,t);s?.errorMessage&&o.reject(new Error(s.errorMessage))})}async waitForFirstElement(i){let e=i[Symbol.asyncIterator](),t=await e.next();return t.done?{async*[Symbol.asyncIterator](){}}:{async*[Symbol.asyncIterator](){for(;!t.done;)yield t.value,t=await e.next()}}}async applyWithInlinePreview(i,e,t,o){return this.instantiationService.invokeFunction(_Kt,e,i,t.token,o)}async applyNotebookEditsWithInlinePreview(i,e,t){return this.instantiationService.invokeFunction(zbo,e,i,t.token)}tryToRevealCodeBlock(i,e){let t=e.match(/(\S[^\n]*)\n/);if(t&&t[1].length>10){let o=i.getModel().findNextMatch(t[1],{lineNumber:1,column:1},!1,!1,null,!1);o&&i.revealRangeInCenter(o.range)}}notify(i){this.dialogService.info(i)}};R0e=I([m(0,ee),m(1,Uo),m(2,mi),m(3,fe),m(4,at),m(5,se),m(6,iJ),m(7,Fo),m(8,Ue),m(9,rt),m(10,F),m(11,bn)],R0e);function kIo(a,i,e){Ui(i.element)&&a.notifyUserAction({agentId:i.element.agent?.id,command:i.element.slashCommand?.name,sessionResource:i.element.sessionResource,requestId:i.element.requestId,result:i.element.result,action:e})}function oMi(a){let i=a.activeEditorPane;if(i?.getId()===MR){let e=i.getControl();if(e.hasModel())return e}}function EIo(a){let i=oMi(a)?.activeCodeEditor;if(i&&i.hasTextFocus()&&i.hasModel())return i;let e=ha(a.activeTextEditorControl);if(!e){for(let t of a.visibleTextEditorControls)if(e=ha(t),e)break}if(!(!e||!e.hasModel()))return e}function TIo(a,i){return!!(i.files.get(a.uri)??i.untitled.get(a.uri))?.isReadonly()}function ssn(a,i,e){let t=yc(a);if(t.length===0)return a;let o=i.getFormattingOptions(),n=xIo(i.getLineContent(e),o.tabSize).level,r=t.map(c=>xIo(c,o.tabSize)),s=r.reduce((c,u,p)=>u.length!==t[p].length?Math.min(u.level,c):c,Number.MAX_VALUE);if(s===Number.MAX_VALUE||s===n)return a;let l=[];for(let c=0;c<t.length;c++){let{level:u,length:p}=r[c],h=Math.max(0,n+u-s),g=o.insertSpaces?" ".repeat(o.tabSize*h):"	".repeat(h);l.push(g+t[c].substring(p))}return l.join(`
`)}function xIo(a,i){let e=0,t=0,o=0,n=0,r=a.length;for(;o<r;){let s=a.charCodeAt(o);if(s===32)e++,e===i&&(t++,e=0,n=o+1);else if(s===9)t++,e=0,n=o+1;else break;o++}return{level:t,length:n}}var wGt=["fish","ps1","pwsh","powershell","sh","shellscript","zsh"];function CGt(a){return typeof a=="object"&&a!==null&&"code"in a&&"element"in a}function asn(a){return typeof a=="object"&&a!==null&&"element"in a&&"diffEditor"in a&&"toggleDiffViewMode"in a}function nMi(a){return Ui(a.element)&&a.element.errorDetails?.responseIsFiltered}var M0e=class extends K{run(i,...e){let t=e[0];if(!CGt(t)){let o=i.get(qt),n=o.getFocusedCodeEditor()||o.getActiveCodeEditor();if(!n||(t=LIo(n,i),!CGt(t)))return}return this.runWithContext(i,t)}},_Io="workbench.action.chat.applyInEditor",ofe=class extends x{static{this.ID="chat.codeBlockActionRendering"}constructor(i,e,t){super();let o=i.register(D.ChatCodeBlock,_Io,(n,r)=>{if(n instanceof Lo)return e.createInstance(class extends xl{getTooltip(){let s=this._context;if(CGt(s)&&s.codemapperUri){let l=t.getUriLabel(s.codemapperUri,{relative:!0});return d(5769,null,l)}return super.getTooltip()}setActionContext(s){super.setActionContext(s),this.updateTooltip()}},n,void 0)});im(o)}};ofe=I([m(0,Zx),m(1,F),m(2,rt)],ofe);function DIo(){W(class extends K{constructor(){super({id:"workbench.action.chat.copyCodeBlock",title:L(5774,"Copy"),f1:!1,category:Si,icon:R.copy,menu:{id:D.ChatCodeBlock,group:"navigation",order:30}})}run(e,...t){let o=t[0];if(!CGt(o)||nMi(o))return;let n=e.get(Fi),r=e.get(xS);if(n.writeText(o.code),Ui(o.element)){let s=e.get(mi),l=o.element.requestId,c=o.element.session.getItems().find(p=>p.id===l&&Sr(p));s.notifyUserAction({agentId:o.element.agent?.id,command:o.element.slashCommand?.name,sessionResource:o.element.sessionResource,requestId:o.element.requestId,result:o.element.result,action:{kind:"copy",codeBlockIndex:o.codeBlockIndex,copyKind:2,copiedCharacters:o.code.length,totalCharacters:o.code.length,copiedText:o.code,copiedLines:o.code.split(`
`).length,languageId:o.languageId,totalLines:o.code.split(`
`).length,modelId:c?.modelId??""}});let u=o.element.model.codeBlockInfos?.at(o.codeBlockIndex);r.handleCodeAccepted({acceptanceMethod:"copyButton",suggestionId:u?.suggestionId,editDeltaInfo:lw.fromText(o.code),feature:"sideBarChat",languageId:o.languageId,modeId:o.element.model.request?.modeInfo?.modeId,modelId:c?.modelId,presentation:"codeBlock",applyCodeBlockSuggestionId:void 0,source:void 0})}}}),VP?.addImplementation(5e4,"chat-codeblock",i=>{let e=i.get(qt).getFocusedCodeEditor();if(!e)return!1;let t=e.getModel();if(!t)return!1;let o=LIo(e,i);if(!o)return!1;let n=e.getSelections()?.length===1&&e.getSelection()?.isEmpty(),r=n?t.getValue():e.getSelections()?.reduce((p,h)=>p+t.getValueInRange(h),"")??"",s=t.getValueLength(),l=i.get(mi),c=i.get(xS),u=o.element;if(Ui(u)){let p=u.requestId,h=u.session.getItems().find(f=>f.id===p&&Sr(f));l.notifyUserAction({agentId:u.agent?.id,command:u.slashCommand?.name,sessionResource:u.sessionResource,requestId:u.requestId,result:u.result,action:{kind:"copy",codeBlockIndex:o.codeBlockIndex,copyKind:1,copiedText:r,copiedCharacters:r.length,totalCharacters:s,languageId:o.languageId,totalLines:o.code.split(`
`).length,copiedLines:r.split(`
`).length,modelId:h?.modelId??""}});let g=u.model.codeBlockInfos?.at(o.codeBlockIndex);c.handleCodeAccepted({acceptanceMethod:"copyManual",suggestionId:g?.suggestionId,editDeltaInfo:lw.fromText(r),feature:"sideBarChat",languageId:o.languageId,modeId:u.model.request?.modeInfo?.modeId,modelId:h?.modelId,presentation:"codeBlock",applyCodeBlockSuggestionId:void 0,source:void 0})}return n?(i.get(Fi).writeText(o.code),!0):!1}),W(class extends M0e{constructor(){super({id:_Io,title:L(5768,"Apply in Editor"),precondition:ie.enabled,f1:!1,category:Si,icon:R.gitPullRequestGoToChanges,menu:[{id:D.ChatCodeBlock,group:"navigation",when:C.and(...wGt.map(e=>C.notEquals(pe.languageId.key,e))),order:10},{id:D.ChatCodeBlock,when:C.or(...wGt.map(e=>C.equals(pe.languageId.key,e)))}],keybinding:{when:C.or(C.and(ie.inChatSession,ie.inChatInput.negate()),eDe),primary:2051,mac:{primary:259},weight:401}})}runWithContext(e,t){return this.operation||(this.operation=e.get(F).createInstance(R0e)),this.operation.run(t)}}),W(class extends M0e{constructor(){super({id:"workbench.action.chat.insertCodeBlock",title:L(5775,"Insert At Cursor"),precondition:ie.enabled,f1:!0,category:Si,icon:R.insert,menu:[{id:D.ChatCodeBlock,group:"navigation",when:C.and(ie.inChatSession,ie.location.notEqualsTo("terminal")),order:20},{id:D.ChatCodeBlock,group:"navigation",when:C.and(ie.inChatSession,ie.location.isEqualTo("terminal")),isHiddenByDefault:!0,order:20}],keybinding:{when:C.or(C.and(ie.inChatSession,ie.inChatInput.negate()),eDe),primary:2051,mac:{primary:259},weight:401}})}runWithContext(e,t){return e.get(F).createInstance(L0e).run(t)}}),W(class extends M0e{constructor(){super({id:"workbench.action.chat.insertIntoNewFile",title:L(5776,"Insert into New File"),precondition:ie.enabled,f1:!0,category:Si,icon:R.newFile,menu:{id:D.ChatCodeBlock,group:"navigation",isHiddenByDefault:!0,order:40}})}async runWithContext(e,t){if(nMi(t))return;let o=e.get(ee),n=e.get(mi),r=e.get(xS);if(o.openEditor({contents:t.code,languageId:t.languageId,resource:void 0}),Ui(t.element)){let s=t.element.requestId,l=t.element.session.getItems().find(u=>u.id===s&&Sr(u));n.notifyUserAction({agentId:t.element.agent?.id,command:t.element.slashCommand?.name,sessionResource:t.element.sessionResource,requestId:t.element.requestId,result:t.element.result,action:{kind:"insert",codeBlockIndex:t.codeBlockIndex,totalCharacters:t.code.length,newFile:!0,totalLines:t.code.split(`
`).length,languageId:t.languageId,modelId:l?.modelId??""}});let c=t.element.model.codeBlockInfos?.at(t.codeBlockIndex);r.handleCodeAccepted({acceptanceMethod:"insertInNewFile",suggestionId:c?.suggestionId,editDeltaInfo:lw.fromText(t.code),feature:"sideBarChat",languageId:t.languageId,modeId:t.element.model.request?.modeInfo?.modeId,modelId:l?.modelId,presentation:"codeBlock",applyCodeBlockSuggestionId:void 0,source:void 0})}}}),W(class extends M0e{constructor(){super({id:"workbench.action.chat.runInTerminal",title:L(5779,"Insert into Terminal"),precondition:ie.enabled,f1:!0,category:Si,icon:R.terminal,menu:[{id:D.ChatCodeBlock,group:"navigation",when:C.and(ie.inChatSession,C.or(...wGt.map(e=>C.equals(pe.languageId.key,e))))},{id:D.ChatCodeBlock,group:"navigation",isHiddenByDefault:!0,when:C.and(ie.inChatSession,...wGt.map(e=>C.notEquals(pe.languageId.key,e)))}],keybinding:[{primary:2563,mac:{primary:771},weight:100,when:C.or(ie.inChatSession,eDe)}]})}async runWithContext(e,t){if(nMi(t))return;let o=e.get(mi),n=e.get(nn),r=e.get(ee),s=e.get(Fv),l=e.get(lc),c=await n.getActiveOrCreateInstance({acceptsInput:!0});if(c.xterm?.isStdinDisabled||c.shellLaunchConfig.isFeatureTerminal?c=await n.createAndFocusTerminal({location:1}):await n.focusInstance(c),c.target===2){let u=r.findEditors(c.resource);s.openEditor(c,{viewColumn:u?.[0].groupId})}else await l.showPanel(!0);c.runCommand(t.code,!1),Ui(t.element)&&o.notifyUserAction({agentId:t.element.agent?.id,command:t.element.slashCommand?.name,sessionResource:t.element.sessionResource,requestId:t.element.requestId,result:t.element.result,action:{kind:"runInTerminal",codeBlockIndex:t.codeBlockIndex,languageId:t.languageId}})}});function a(i,e){let t=i.get(qt),n=i.get(Pt).lastFocusedWidget;if(!n)return;let s=t.getFocusedCodeEditor()?.getModel()?.uri,l=s?n.getCodeBlockInfoForEditor(s):void 0,c=!n.inputEditor.hasWidgetFocus()&&n.getFocus(),u=Ui(c)?c:void 0,p=l?.elementId,g=(p?n.viewModel?.getItems().find(b=>b.id===p):void 0)??u??n.viewModel?.getItems().reverse().find(b=>Ui(b));if(!g||!Ui(g))return;n.reveal(g);let f=n.getCodeBlockInfosForResponse(g),v=l?(l.codeBlockIndex+(e?-1:1)+f.length)%f.length:e?f.length-1:0;f[v]?.focus()}W(class extends K{constructor(){super({id:"workbench.action.chat.nextCodeBlock",title:L(5777,"Next Code Block"),keybinding:{primary:2572,mac:{primary:2572},weight:200,when:ie.inChatSession},precondition:ie.enabled,f1:!0,category:Si})}run(e,...t){a(e)}}),W(class extends K{constructor(){super({id:"workbench.action.chat.previousCodeBlock",title:L(5778,"Previous Code Block"),keybinding:{primary:2571,mac:{primary:2571},weight:200,when:ie.inChatSession},precondition:ie.enabled,f1:!0,category:Si})}run(e,...t){a(e,!0)}})}function LIo(a,i){let e=i.get(Pt),t=i.get(XX),o=a.getModel();if(!o)return;let n=e.lastFocusedWidget,r=n?.getCodeBlockInfoForEditor(o.uri);if(!r){for(let l of t.providers){let c=l.getCodeBlockContext(a);if(c)return c}return}return{element:n?.viewModel?.getItems().find(l=>l.id===r.elementId),codeBlockIndex:r.codeBlockIndex,code:a.getValue(),languageId:a.getModel().getLanguageId(),codemapperUri:r.codemapperUri,chatSessionResource:r.chatSessionResource}}function RIo(){class a extends K{run(e,...t){let o=t[0];if(asn(o))return this.runWithContext(e,o)}}W(class extends a{constructor(){super({id:"workbench.action.chat.applyCompareEdits",title:L(5770,"Apply Edits"),f1:!1,category:Si,icon:R.gitPullRequestGoToChanges,precondition:C.and(pe.hasChanges,ie.editApplied.negate(),pe.readOnly.negate()),menu:{id:D.ChatCompareBlock,group:"navigation",order:10,when:pe.readOnly.negate()}})}async runWithContext(e,t){let o=e.get(F),n=e.get(qt),r=t.edit,s=t.element;if(r.state?.applied||!s.response.value.includes(r))return!1;let l=r.edits[0]?.[0];if(!l)return!1;let c=fp.fromArray(r.edits),u=await n.openCodeEditor({resource:r.uri},null);return u?(u.revealLineInCenterIfOutsideViewport(l.range.startLineNumber),o.invokeFunction(_Kt,u,c,Se.None,void 0),s.setEditApplied(r,1),!0):!1}}),W(class extends a{constructor(){super({id:"workbench.action.chat.discardCompareEdits",title:L(5771,"Discard Edits"),f1:!1,category:Si,icon:R.trash,precondition:C.and(pe.hasChanges,ie.editApplied.negate(),pe.readOnly.negate()),menu:{id:D.ChatCompareBlock,group:"navigation",order:11,when:pe.readOnly.negate()}})}async runWithContext(e,t){e.get(F).createInstance(eOe).discard(t.element,t.edit)}}),W(class extends a{constructor(){super({id:"workbench.action.chat.toggleCompareBlockDiffViewMode",title:L(5773,"Toggle Inline/Side-by-Side Diff"),f1:!1,category:Si,icon:R.diffSingle,toggled:{condition:pe.diffEditorInlineMode,icon:R.diff},menu:{id:D.ChatCompareBlock,group:"navigation",order:1}})}runWithContext(e,t){t.toggleDiffViewMode()}}),W(class extends a{constructor(){super({id:"workbench.action.chat.openCompareBlockInDiffEditor",title:L(5772,"Open in Diff Editor"),f1:!1,category:Si,icon:R.goToFile,menu:{id:D.ChatCompareBlock,group:"navigation",order:2}})}async runWithContext(e,t){let o=e.get(ee),n=t.diffEditor.getModel();n&&await o.openEditor({original:{resource:n.original.uri},modified:{resource:n.modified.uri}})}})}async function poe(a,i,e,t,o){let n=a.get(Ue),r=a.get(fe),s=p=>{let h=p.trim();if(!h)return;let g=o??DLt(i);return h.endsWith(g)?h:`${h}${g}`},l=async p=>{let h=s(p);if(!h)return{content:d(7472,null),severity:bt.Warning};if(!v1(h))return{content:d(7474,null),severity:bt.Error};let g=A.joinPath(e,h);if(await r.exists(g))return{content:d(7473,null),severity:bt.Error}},c=t?csn(i):lsn(i),u=await n.input({placeHolder:c,validateInput:l,value:t});if(u)return s(u)}function lsn(a){switch(a){case"instructions":return d(7471,null);case"prompt":return d(7475,null);case"agent":return d(7470,null);default:throw new Error("Unknown prompt type")}}function csn(a){switch(a){case"instructions":return d(7477,null);case"prompt":return d(7478,null);case"agent":return d(7476,null);default:throw new Error("Unknown prompt type")}}async function wQ(a,i,e,t=!1){let o=a.get(Ue),n=a.get(Or),r=a.get(rt),s=a.get(Pe),l=await n.getSourceFolders(i);if(l.length===0){await psn(a,i);return}let c={placeHolder:e?usn(i,t):dsn(i),canPickMany:!1,matchOnDescription:!0},u=l.map(h=>{let g=h.uri,f=e&&Qe(g,e)?d(7492,null):void 0;if(h.storage!=="local")return{type:"item",label:n.getPromptLocationLabel(h),detail:f,tooltip:r.getUriLabel(g),folder:h};let{folders:v}=s.getWorkspace(),b=v.length>1,S=v[0];return b||!S||!ar.isEqual(S.uri,g)?{type:"item",label:r.getUriLabel(g,{relative:!0}),detail:f,tooltip:r.getUriLabel(g),folder:h}:{type:"item",label:d(7489,null),detail:f,tooltip:r.getUriLabel(g),folder:h}}),p=await o.pick(u,c);if(p)return p.folder}function dsn(a){switch(a){case"instructions":return d(7501,null);case"prompt":return d(7502,null);case"agent":return d(7499,null);case"skill":return d(7503,null);case"hook":return d(7500,null);default:throw new Error("Unknown prompt type")}}function usn(a,i){if(i)switch(a){case"instructions":return d(7494,null);case"prompt":return d(7496,null);case"agent":return d(7480,null);case"skill":return d(7498,null);case"hook":throw new Error("Hooks cannot be moved");default:throw new Error("Unknown prompt type")}switch(a){case"instructions":return d(7493,null);case"prompt":return d(7495,null);case"agent":return d(7479,null);case"skill":return d(7497,null);case"hook":throw new Error("Hooks cannot be copied");default:throw new Error("Unknown prompt type")}}async function psn(a,i){let e=a.get(Ue),t=a.get(Je),o={type:"item",label:msn(i),description:JX,tooltip:JX,value:A.parse(JX)},n=await e.pick([o],{placeHolder:hsn(i),canPickMany:!1});n&&await t.open(n.value)}function msn(a){switch(a){case"prompt":return d(7487,null);case"instructions":return d(7485,null);case"agent":return d(7481,null);case"skill":return d(7490,null);case"hook":return d(7483,null);default:throw new Error("Unknown prompt type")}}function hsn(a){switch(a){case"instructions":return d(7486,null);case"prompt":return d(7488,null);case"agent":return d(7482,null);case"skill":return d(7491,null);case"hook":return d(7484,null);default:throw new Error("Unknown prompt type")}}var mrt=class extends K{constructor(e,t,o){super({id:e,title:t,f1:!1,precondition:ie.enabled,category:Si,keybinding:{weight:200},menu:{id:D.CommandPalette,when:ie.enabled}});this.type=o}async run(e,t){let o=e.get(se),n=e.get(Je),r=e.get(ge),s=e.get(Ne),l=e.get(Fl),c=e.get(ee),u=e.get(fe),p=e.get(F),h,g;if(t?.targetFolder)h=t.targetFolder,g=t.targetStorage??"local";else{let k=await p.invokeFunction(wQ,this.type);if(!k)return;h=k.uri,g=k.storage}let f=await p.invokeFunction(poe,this.type,h,void 0,t?.fileExtension);if(!f)return;await u.createFolder(h);let v=A.joinPath(h,f);await u.createFile(v);let b=wf(v),S;if(t?.openFile?S=await t.openFile(v):(await n.open(v),S=ha(c.activeTextEditorControl)),S&&S.hasModel()&&Qe(S.getModel().uri,v)&&vs.get(S)?.apply([{range:S.getModel().getFullModelRange(),template:dMi(this.type,b,TD(this.type,v))}]),g!=="user")return;let y=l.isResourceEnablementConfigured("prompts"),w=l.isEnabled();y===!0||w===!1||s.prompt(ft.Info,d(7469,null),[{label:d(7467,null),run:()=>{r.executeCommand(set).catch(k=>{o.error(`Failed to run '${set}' command: ${k}.`)})}},{label:d(7468,null),run:()=>{n.open(A.parse("https://aka.ms/vscode-settings-sync-help"))}}],{neverShowAgain:{id:"workbench.command.prompts.create.user.enable-sync-notification",scope:1}})}};function dMi(a,i,e){switch(a){case"prompt":return["---",`name: ${i??"${1:prompt-name}"}`,"description: ${2:Describe when to use this prompt}","---","","<!-- Tip: Use /create-prompt in chat to generate content with agent assistance -->","","${3:Define the prompt content here. You can include instructions, examples, and any other relevant information to guide the AI's responses.}"].join(`
`);case"instructions":return e==="claude"?["---","description: ${1:Describe when these instructions should be loaded}","paths:",'. - "src/**/*.ts"',"---","","<!-- Tip: Use /create-instructions in chat to generate content with agent assistance -->","","${2:Provide coding guidelines that AI should follow when generating code, answering questions, or reviewing changes.}"].join(`
`):["---","description: ${1:Describe when these instructions should be loaded by the agent based on task context}","# applyTo: '${1|**,**/*.ts|}' # when provided, instructions will automatically be added to the request context when the pattern matches an attached file","---","","<!-- Tip: Use /create-instructions in chat to generate content with agent assistance -->","","${2:Provide project context and coding guidelines that AI should follow when generating code, answering questions, or reviewing changes.}"].join(`
`);case"agent":return e==="claude"?["---",`name: ${i??"${1:agent-name}"}`,"description: ${2:Describe what this custom agent does and when to use it.}","tools: Read, Grep, Glob, Bash # specify the tools this agent can use. If not set, all enabled tools are allowed.","---","","<!-- Tip: Use /create-agent in chat to generate content with agent assistance -->","","${4:Define what this custom agent does, including its behavior, capabilities, and any specific instructions for its operation.}"].join(`
`):["---",`name: ${i??"${1:agent-name}"}`,"description: ${2:Describe what this custom agent does and when to use it.}",'argument-hint: ${3:The inputs this agent expects, e.g., "a task to implement" or "a question to answer".}',"# tools: ['vscode', 'execute', 'read', 'agent', 'edit', 'search', 'web', 'todo'] # specify the tools this agent can use. If not set, all enabled tools are allowed.","---","","<!-- Tip: Use /create-agent in chat to generate content with agent assistance -->","","${4:Define what this custom agent does, including its behavior, capabilities, and any specific instructions for its operation.}"].join(`
`);case"skill":return["---",`name: ${i??"${1:skill-name}"}`,"description: ${2:Describe what this skill does and when to use it. Include keywords that help agents identify relevant tasks.}","---","","<!-- Tip: Use /create-skill in chat to generate content with agent assistance -->","","${3:Define the functionality provided by this skill, including detailed instructions and examples}"].join(`
`);default:throw new Error(`Unsupported prompt type: ${a}`)}}var hrt="workbench.command.new.prompt",grt="workbench.command.new.instructions",frt="workbench.command.new.agent",vrt="workbench.command.new.skill",rMi=class extends mrt{constructor(){super(hrt,d(7457,null),"prompt")}},sMi=class extends mrt{constructor(){super(grt,d(7456,null),"instructions")}},aMi=class extends mrt{constructor(){super(frt,d(7455,null),"agent")}},lMi=class extends K{constructor(){super({id:vrt,title:d(7458,null),f1:!1,precondition:ie.enabled,category:Si,keybinding:{weight:200},menu:{id:D.CommandPalette,when:ie.enabled}})}async run(i,e){let t=i.get(Je),o=i.get(ee),n=i.get(fe),r=i.get(F),s=i.get(Ue),l;if(e?.targetFolder)l=e.targetFolder;else{let f=await r.invokeFunction(wQ,"skill");if(!f)return;l=f.uri}let c=await s.input({prompt:d(7463,null),placeHolder:d(7462,null),validateInput:async f=>{if(!f||!f.trim())return d(7464,null);let v=f.trim();if(v.length>64)return d(7465,null);if(!wLt.test(v))return d(7461,null);if(v.startsWith("-")||v.endsWith("-"))return d(7460,null);if(v.includes("--"))return d(7459,null)}});if(!c)return;let u=c.trim(),p=A.joinPath(l,u);await n.createFolder(p);let h=A.joinPath(p,m4);await n.createFile(h);let g;e?.openFile?g=await e.openFile(h):(await t.open(h),g=ha(o.activeTextEditorControl)),g&&g.hasModel()&&Qe(g.getModel().uri,h)&&vs.get(g)?.apply([{range:g.getModel().getFullModelRange(),template:dMi("skill",u,"undefined")}])}},cMi=class extends K{constructor(){super({id:"workbench.command.new.untitled.prompt",title:L(7466,"New Untitled Prompt File"),f1:!0,precondition:ie.enabled,category:Si,keybinding:{weight:200}})}async run(i){let e=i.get(ee),t=Ueo("prompt"),o=await e.openEditor({resource:void 0,languageId:t,options:{pinned:!0}}),n="prompt",r=ha(e.activeTextEditorControl);return r&&r.hasModel()&&vs.get(r)?.apply([{range:r.getModel().getFullModelRange(),template:dMi(n,void 0,"undefined")}]),o}};function MIo(){W(rMi),W(sMi),W(aMi),W(lMi),W(cMi)}function CQ(a){let i=q.asClassName(R.question);switch(a){case"prompt":return{tooltip:d(7519,null),helpURI:A.parse(JX),iconClass:i};case"instructions":return{tooltip:d(7518,null),helpURI:A.parse(oLt),iconClass:i};case"agent":return{tooltip:d(7516,null),helpURI:A.parse(W6e),iconClass:i};case"skill":return{tooltip:d(7520,null),helpURI:A.parse(nLt),iconClass:i};case"hook":return{tooltip:d(7517,null),helpURI:A.parse(rLt),iconClass:i}}}function gsn(a){return a.helpURI!==void 0}function PIo(a){return a.type==="item"&&!!a.promptFileUri}function fsn(a){return a.storage==="extension"&&!!a.extension}var vsn={type:"item",label:`$(plus) ${d(7511,null)}`,pickable:!1,alwaysShow:!0,buttons:[CQ("prompt")],commandId:hrt},bsn={type:"item",label:`$(plus) ${d(7510,null)}`,pickable:!1,alwaysShow:!0,buttons:[CQ("instructions")],commandId:grt},Ssn={type:"item",label:`$(sparkle) ${d(7504,null)}`,pickable:!1,alwaysShow:!0,buttons:[CQ("instructions")],commandId:x2},Isn={type:"item",label:`$(sparkle) ${d(7506,null)}`,pickable:!1,alwaysShow:!0,buttons:[CQ("instructions")],commandId:CXe},ysn={type:"item",label:`$(plus) ${d(7509,null)}`,pickable:!1,alwaysShow:!0,buttons:[CQ("agent")],commandId:frt},wsn={type:"item",label:`$(plus) ${d(7512,null)}`,pickable:!1,alwaysShow:!0,buttons:[CQ("skill")],commandId:vrt},Csn={type:"item",label:`$(sparkle) ${d(7507,null)}`,pickable:!1,alwaysShow:!0,buttons:[CQ("prompt")],commandId:m3},xsn={type:"item",label:`$(sparkle) ${d(7508,null)}`,pickable:!1,alwaysShow:!0,buttons:[CQ("skill")],commandId:h3},ksn={type:"item",label:`$(sparkle) ${d(7505,null)}`,pickable:!1,alwaysShow:!0,buttons:[CQ("agent")],commandId:g3},uMi={tooltip:d(7526,null),iconClass:q.asClassName(R.fileCode)},AIo={tooltip:d(7515,null),iconClass:q.asClassName(R.trash)},xGt={tooltip:d(7527,null),iconClass:q.asClassName(R.replace)},kGt={tooltip:d(7523,null),iconClass:q.asClassName(R.copy)},pMi={tooltip:d(7525,null),iconClass:q.asClassName(R.eyeClosed),alwaysVisible:!0},NIo={tooltip:d(7524,null),iconClass:q.asClassName(R.eye)},mMi={tooltip:d(7528,null),iconClass:q.asClassName(R.play)},fN=class{constructor(i,e,t,o,n,r,s,l,c){this._quickInputService=i;this._openerService=e;this._fileService=t;this._dialogService=o;this._commandService=n;this._instaService=r;this._promptsService=s;this._labelService=l;this._productService=c}async selectPromptFile(i){let e=new Ye,t=this._quickInputService.createQuickPick({useSeparators:!0});t.busy=!0,t.placeholder=d(7529,null);try{let o=await this._createPromptPickItems(i,e.token),n=i.resource&&o.find(r=>r.type==="item"&&ar.isEqual(r.promptFileUri,i.resource));n&&(t.activeItems=[n]),t.placeholder=i.placeholder,t.matchOnDescription=!0,t.items=o}finally{t.busy=!1}return new Promise(o=>{let n=new N,r=!1,s=!1;n.add(t),n.add(e);let l=async()=>{let c=t.activeItems,u=await this._createPromptPickItems(i,Se.None);t.items=u,t.activeItems=c};n.add(t.onDidAccept(async()=>{let{selectedItems:c}=t,{keyMods:u}=t,p=c[0];if(PIo(p))o({promptFile:p.promptFileUri,keyMods:{...u}}),r=!0;else if(p.commandId){await this._commandService.executeCommand(p.commandId);return}t.hide()})),n.add(t.onDidTriggerItemButton(async c=>{let u=await this._handleButtonClick(t,c,i);!s&&u&&await l()})),n.add(t.onDidHide(()=>{t.ignoreFocusOut||(n.dispose(),s=!0,r||(o(void 0),r=!0))})),t.show()})}async _createPromptPickItems(i,e){let t=[];i.type==="prompt"&&i.optionRun!==!1&&t.push(mMi),i.optionEdit!==!1&&t.push(uMi),i.optionCopy!==!1&&t.push(kGt),i.optionRename!==!1&&t.push(xGt),i.optionDelete!==!1&&t.push(AIo);let o=[];i.optionNew!==!1&&o.push(...this._getNewItems(i.type));let n=()=>{};if(i.optionVisibility){let h=this._promptsService.getDisabledPromptFiles(i.type);n=g=>!h.has(g.uri)}let r=h=>h.sort((g,f)=>g.label.localeCompare(f.label)),s=await this._promptsService.listPromptFilesForStorage(i.type,"local",e);s.length&&(o.push({type:"separator",label:d(7534,null)}),o.push(...r(await Promise.all(s.map(h=>this._createPromptPickItem(h,t,n(h),e))))));let l=[];if(i.type==="instructions"&&(l=(await this._promptsService.listAgentInstructions(e)).map(g=>{let f=this._labelService.getUriLabel(ci(g.uri),{relative:!0});return{uri:g.uri,description:g.type!=="copilotInstructionsMd"?f:void 0,storage:"local",type:i.type}})),l.length){let h=t.filter(g=>g!==xGt);o.push({type:"separator",label:d(7535,null)}),o.push(...r(await Promise.all(l.map(g=>this._createPromptPickItem(g,h,n(g),e)))))}let c=(await this._promptsService.listPromptFilesForStorage(i.type,"extension",e)).filter(fsn);if(c.length){let h=[];i.type==="prompt"&&i.optionRun!==!1&&h.push(mMi),i.optionEdit!==!1&&h.push(uMi),i.optionCopy!==!1&&h.push(kGt);let g=new Map;for(let v of c){let b=this._getExtensionGroupLabel(v);g.has(b)||g.set(b,[]),g.get(b).push(v)}let f=Array.from(g.entries()).sort((v,b)=>v[0].localeCompare(b[0]));for(let[v,b]of f)o.push({type:"separator",label:v}),o.push(...r(await Promise.all(b.map(S=>this._createPromptPickItem(S,h,n(S),e)))))}let u=await this._promptsService.listPromptFilesForStorage(i.type,"user",e);u.length&&(o.push({type:"separator",label:d(7533,null)}),o.push(...r(await Promise.all(u.map(h=>this._createPromptPickItem(h,t,n(h),e))))));let p=await this._promptsService.listPromptFilesForStorage(i.type,"plugin",e);if(p.length){let h=[];i.optionCopy!==!1&&h.push(kGt),o.push({type:"separator",label:d(7532,null)}),o.push(...r(await Promise.all(p.map(g=>this._createPromptPickItem(g,h,n(g),e)))))}return o}_getExtensionGroupLabel(i){return Iot(i.uri,i.extension.identifier,this._productService)?d(7531,null):d(7530,null)}_getNewItems(i){switch(i){case"prompt":return[vsn,Csn];case"instructions":return[bsn,Isn,Ssn];case"agent":return[ysn,ksn];case"skill":return[wsn,xsn];default:throw new Error(`Unknown prompt type '${i}'.`)}}async _createPromptPickItem(i,e,t,o){let n=await this._promptsService.parseNew(i.uri,o).catch(()=>{}),r=(n?.header?.name??i.name)||(i.type==="skill"?t9e(i.uri):wf(i.uri)),s=n?.header?.description??i.description,l;switch(i.storage){case"extension":l=i.extension.displayName??i.extension.id;break;case"local":l=this._labelService.getUriLabel(ci(i.uri),{relative:!0});break;case"user":l=void 0;break;case"plugin":l=i.name;break;default:os(i)}let c;return t===!1?(e=(e??[]).concat(pMi),r=d(7522,null,r),l=d(7521,null)):t===!0&&(e=(e??[]).concat(NIo)),{id:i.uri.toString(),type:"item",label:r,description:s,iconClass:c,tooltip:l,promptFileUri:i.uri,buttons:e}}async keepQuickPickOpen(i,e){let t=i.ignoreFocusOut;i.ignoreFocusOut=!0;try{return await e()}finally{i.ignoreFocusOut=t,i.show()}}async _handleButtonClick(i,e,t){let{item:o,button:n}=e;if(!PIo(o)){if(gsn(n))return await this._openerService.open(n.helpURI),!1;throw new Error(`Unknown button '${JSON.stringify(n)}'.`)}let r=o.promptFileUri;if(n===mMi){let s=i.keyMods.ctrlCmd===!0?"workbench.action.chat.run-in-new-chat.prompt.current":"workbench.action.chat.run.prompt.current";return await this._commandService.executeCommand(s,r),i.hide(),!1}if(n===uMi)return await this._openerService.open(r),!1;if(n===xGt||n===kGt)return await this.keepQuickPickOpen(i,async()=>{let s=ci(r),l=n===xGt&&i.keyMods.ctrlCmd,c=await this._instaService.invokeFunction(wQ,t.type,s,l);if(!c)return!1;let u=await this._instaService.invokeFunction(poe,t.type,c.uri,o.label);if(!u)return!1;let p=Ge(c.uri,u);return l?await this._fileService.move(r,p):await this._fileService.copy(r,p),await this._openerService.open(p),await this._instaService.createInstance(MG).openAndRewriteName(p,wf(p),Se.None),!0});if(n===AIo)return await this.keepQuickPickOpen(i,async()=>{let s=t.type==="skill",l=s?He(ci(r)):o.label,c=s?d(7514,null,l):d(7513,null,l),{confirmed:u}=await this._dialogService.confirm({message:c});if(!u)return!1;let p=s?ci(r):r;return await this._fileService.del(p,{recursive:s,useTrash:!0}),!0});if(n===pMi||n===NIo){let s=this._promptsService.getDisabledPromptFiles(t.type);return n===pMi?s.delete(r):s.add(r),this._promptsService.setDisabledPromptFiles(t.type,s),!0}throw new Error(`Unknown button '${JSON.stringify(n)}'.`)}async managePromptFiles(i,e){let t=new Ye,o=this._quickInputService.createQuickPick({useSeparators:!0});o.placeholder=e,o.canSelectMany=!0,o.matchOnDescription=!0,o.sortByLabel=!1,o.busy=!0;let n={placeholder:"",type:i,optionNew:!0,optionEdit:!0,optionDelete:!0,optionRename:!0,optionCopy:!0,optionVisibility:!1,optionRun:!1};try{let r=await this._createPromptPickItems(n,t.token);o.items=r}finally{o.busy=!1}return new Promise(r=>{let s=new N;s.add(o),s.add(t);let l=!1,c=!1,u=async()=>{let p=o.activeItems,h=await this._createPromptPickItems(n,Se.None);o.items=h,o.activeItems=p};s.add(o.onDidAccept(async()=>{let p=o.activeItems;if(p.length===1&&p[0].commandId){let h=p[0].commandId;await this.keepQuickPickOpen(o,async()=>{await this._commandService.executeCommand(h)}),l||await u();return}c=!0,r(!0),o.hide()})),s.add(o.onDidTriggerItemButton(async p=>{let h=await this._handleButtonClick(o,p,n);!l&&h&&await u()})),s.add(o.onDidHide(()=>{o.ignoreFocusOut||(s.dispose(),l=!0,c||(r(!1),c=!0))})),o.show()})}};fN=I([m(0,Ue),m(1,Je),m(2,fe),m(3,at),m(4,ge),m(5,F),m(6,Or),m(7,rt),m(8,tt)],fN);var Esn="workbench.action.chat.attach.instructions",EGt="workbench.action.chat.configure.instructions",hMi=class extends K{constructor(){super({id:EGt,title:L(7420,"Configure Instructions & Rules..."),shortTitle:L(7421,"Instructions & Rules"),icon:R.bookmark,f1:!0,precondition:ie.enabled,category:Si,menu:{id:ky,when:C.and(ie.enabled,C.equals("view",Dr)),order:10,group:"1_level"}})}async run(i){let e=i.get(Je),o=i.get(F).createInstance(fN),n=d(7419,null),r=await o.selectPromptFile({placeholder:n,type:"instructions",optionEdit:!1});r!==void 0&&await e.open(r.promptFile)}};function OIo(){W(hMi)}var P0e=class{constructor(i){this.promptsService=i;this.type="pickerPick";this.label=d(7418,null);this.icon=R.bookmark;this.commandId=Esn}isEnabled(i){return!!i.attachmentCapabilities.supportsInstructionAttachments}asPicker(){let i=this.promptsService.listPromptFiles("instructions",Se.None).then(e=>{let t=[];e=e.slice(0).sort((n,r)=>Hl(n.storage,r.storage));let o;for(let n of e)o!==n.storage&&(o=n.storage,t.push({type:"separator",label:this.promptsService.getPromptLocationLabel(n)})),t.push({label:n.name??wf(n.uri),asAttachment:()=>WF(n.uri,"vscode.instructions.file.root")});return t});return{placeholder:d(7423,null),picks:i,configure:{label:d(7422,null),commandId:EGt}}}};P0e=I([m(0,Or)],P0e);var Tsn={generic:`- generic (category: "discovery"): File discovery for instructions, skills, agents, hooks. Resolving returns a fileList with full file paths, load status, skip reasons, and source folders. Always resolve these for questions about customization files.
- generic (other): Miscellaneous logs. Resolving returns additional text details.`,toolCall:"- toolCall: A tool invocation. Resolving returns tool name, input, output, status, and duration.",modelTurn:"- modelTurn: An LLM round-trip. Resolving returns model name, token usage, timing, errors, and prompt sections.",subagentInvocation:"- subagentInvocation: A sub-agent spawn. Resolving returns agent name, status, duration, and counts.",userMessage:"- userMessage: The full prompt sent to the model. Resolving returns the complete message and all prompt sections (system prompt, instructions, context). Essential for understanding what the model received.",agentResponse:"- agentResponse: The model's response. Resolving returns the full response text and sections."};function WIo(a){let i=[];for(let e of a){let t=e.created.toISOString(),o=e.id?` [id=${e.id}]`:"";switch(e.kind){case"generic":i.push(`[${t}]${o} ${e.level>=3?"ERROR":e.level>=2?"WARN":"INFO"}: ${e.name}${e.details?" - "+e.details:""}${e.category?" (category: "+e.category+")":""}`);break;case"toolCall":i.push(`[${t}]${o} TOOL_CALL: ${e.toolName}${e.result?" result="+e.result:""}${e.durationInMillis!==void 0?" duration="+e.durationInMillis+"ms":""}`);break;case"modelTurn":i.push(`[${t}]${o} MODEL_TURN: ${e.requestName??"unknown"}${e.model?" model="+e.model:""}${e.inputTokens!==void 0?" tokens(in="+e.inputTokens+",out="+(e.outputTokens??"?")+")":""}${e.durationInMillis!==void 0?" duration="+e.durationInMillis+"ms":""}`);break;case"subagentInvocation":i.push(`[${t}]${o} SUBAGENT: ${e.agentName}${e.status?" status="+e.status:""}${e.durationInMillis!==void 0?" duration="+e.durationInMillis+"ms":""}`);break;case"userMessage":i.push(`[${t}]${o} USER_MESSAGE: ${e.message.substring(0,200)}${e.message.length>200?"...":""} (${e.sections.length} sections)`);break;case"agentResponse":i.push(`[${t}]${o} AGENT_RESPONSE: ${e.message.substring(0,200)}${e.message.length>200?"...":""} (${e.sections.length} sections)`);break;default:{let n=e;break}}}return i.join(`
`)}function VIo(){return`These are the debug event logs from the current chat conversation. Analyze them to help answer the user's troubleshooting question.

CRITICAL INSTRUCTION: You MUST call the resolveDebugEventDetails tool on relevant events BEFORE answering. The log lines below are only summaries \u2014 they do NOT contain the actual data (file paths, prompt content, tool I/O, etc.). The real information is only available by resolving events. Never answer based solely on the summary lines. Always resolve first, then answer.

Call resolveDebugEventDetails in parallel on all events that could be relevant to the user's question. When in doubt, resolve more events rather than fewer.

IMPORTANT: Do NOT mention event IDs, tool resolution steps, or internal debug mechanics in your response. The user does not know about debug events or event IDs. Present your findings directly and naturally, as if you simply know the answer. Never say things like "I need to resolve events" or show event IDs.

Event types and what resolving them returns:
`+Object.values(Tsn).join(`
`)}function FIo(a,i){if(a.kind.toLowerCase().includes(i))return!0;switch(a.kind){case"toolCall":return a.toolName.toLowerCase().includes(i)||(a.input?.toLowerCase().includes(i)??!1)||(a.output?.toLowerCase().includes(i)??!1);case"modelTurn":return(a.model?.toLowerCase().includes(i)??!1)||(a.requestName?.toLowerCase().includes(i)??!1);case"generic":return a.name.toLowerCase().includes(i)||(a.details?.toLowerCase().includes(i)??!1)||(a.category?.toLowerCase().includes(i)??!1);case"subagentInvocation":return a.agentName.toLowerCase().includes(i)||(a.description?.toLowerCase().includes(i)??!1);case"userMessage":case"agentResponse":return a.message.toLowerCase().includes(i)||a.sections.some(e=>e.name.toLowerCase().includes(i)||e.content.toLowerCase().includes(i))}}var _sn=/\b(?:before|after):\d{4}(?:-\d{2}(?:-\d{2}(?:t\d{1,2}(?::\d{2}(?::\d{2})?)?)?)?)?(\b|$)/g;function brt(a,i){let t=new RegExp(`${i}:(\\d{4})(?:-(\\d{2})(?:-(\\d{2})(?:t(\\d{1,2})(?::(\\d{2})(?::(\\d{2}))?)?)?)?)?(?!\\w)`).exec(a);if(!t)return;let o=parseInt(t[1],10),n=t[2]!==void 0?parseInt(t[2],10)-1:void 0,r=t[3]!==void 0?parseInt(t[3],10):void 0,s=t[4]!==void 0?parseInt(t[4],10):void 0,l=t[5]!==void 0?parseInt(t[5],10):void 0,c=t[6]!==void 0?parseInt(t[6],10):void 0;return i==="before"?c!==void 0?new Date(o,n,r,s,l,c,999).getTime():l!==void 0?new Date(o,n,r,s,l,59,999).getTime():s!==void 0?new Date(o,n,r,s,59,59,999).getTime():r!==void 0?new Date(o,n,r,23,59,59,999).getTime():n!==void 0?new Date(o,n+1,0,23,59,59,999).getTime():new Date(o,11,31,23,59,59,999).getTime():new Date(o,n??0,r??1,s??0,l??0,c??0,0).getTime()}function gMi(a){return a.replace(_sn,"").trim()}function BIo(a,i){let e=brt(i,"before"),t=brt(i,"after"),n=gMi(i).split(/\s*,\s*/).filter(l=>l.length>0),r=n.filter(l=>!l.startsWith("!")).map(l=>l.trim()),s=n.filter(l=>l.startsWith("!")).map(l=>l.slice(1).trim()).filter(l=>l.length>0);return a.filter(l=>{let c=l.created.getTime();return e!==void 0&&c>e||t!==void 0&&c<t||s.some(u=>FIo(l,u))?!1:r.length>0?r.some(u=>FIo(l,u)):!0})}async function A0e(a,i){i.markDebugDataAttached(a),i.hasInvokedProviders(a)||await i.invokeProviders(a);let e=i.getEvents(a),t=e.length>0?WIo(e):d(6725,null);return{id:"chatDebugEvents",name:d(6724,null),icon:R.output,kind:"debugEvents",snapshotTime:Date.now(),sessionResource:a,value:t,modelDescription:VIo()}}var nfe=class extends x{static{this.ID="chat.contextContributions"}constructor(i,e){super(),this._store.add(e.registerChatContextItem(i.createInstance(fMi))),this._store.add(e.registerChatContextItem(i.createInstance(P0e))),this._store.add(e.registerChatContextItem(i.createInstance(Srt))),this._store.add(e.registerChatContextItem(i.createInstance(Irt))),this._store.add(e.registerChatContextItem(i.createInstance(yrt))),this._store.add(e.registerChatContextItem(i.createInstance(wrt))),this._store.add(e.registerChatContextItem(i.createInstance(Crt)))}};nfe=I([m(0,F),m(1,DS)],nfe);var fMi=class{constructor(){this.type="pickerPick";this.label=d(5786,null);this.icon=R.tools;this.ordinal=-500}isEnabled(i){return!!i.attachmentCapabilities.supportsToolAttachments}asPicker(i){let e=[];for(let[n,r]of i.input.selectedToolsModel.entriesMap.get())r&&(Xm(n)?e.push({toolInfo:kn.classify(n.source),label:n.referenceName,description:n.description,asAttachment:()=>hLt(n)}):e.push({toolInfo:kn.classify(n.source),label:n.toolReferenceName??n.displayName,description:n.userDescription??n.modelDescription,asAttachment:()=>eue(n)}));e.sort((n,r)=>{let s=n.toolInfo.ordinal-r.toolInfo.ordinal;return s===0&&(s=n.toolInfo.label.localeCompare(r.toolInfo.label)),s===0&&(s=n.label.localeCompare(r.label)),s});let t,o=[];for(let n of e)t!==n.toolInfo.label&&(o.push({type:"separator",label:n.toolInfo.label}),t=n.toolInfo.label),o.push(n);return{placeholder:d(5787,null),picks:Promise.resolve(o)}}},Srt=class{constructor(i,e){this._editorService=i;this._labelService=e;this.type="valuePick";this.label=d(5783,null);this.icon=R.file;this.ordinal=800}isEnabled(){return this._editorService.editors.filter(i=>i instanceof wI||i instanceof Pa||i instanceof eh).length>0}async asAttachment(){let i=[];for(let e of this._editorService.editors){if(!(e instanceof wI||e instanceof Pa||e instanceof eh||e instanceof Ra))continue;let t=po.getOriginalUri(e,{supportSideBySide:1});t&&i.push({kind:"file",id:t.toString(),value:t,name:this._labelService.getUriBasenameLabel(t)})}return i}};Srt=I([m(0,ee),m(1,rt)],Srt);var Irt=class{constructor(i){this._clipboardService=i;this.type="valuePick";this.label=d(5788,null);this.icon=R.fileMedia}async isEnabled(i){if(!i.attachmentCapabilities.supportsImageAttachments||!i.input.selectedLanguageModel.get()?.metadata.capabilities?.vision)return!1;let e=await this._clipboardService.readImage();return Ego(e)}async asAttachment(){let i=await this._clipboardService.readImage();return{id:await _it(i),name:d(5789,null),fullName:d(5789,null),value:i,kind:"image"}}};Irt=I([m(0,Fi)],Irt);var N0e=class{constructor(i,e){this._resource=i;this._terminalService=e;this.type="valuePick";this.icon=R.terminal;this.label=d(5790,null)}isEnabled(i){let e=this._terminalService.getInstanceFromResource(this._resource);return!!i.attachmentCapabilities.supportsTerminalAttachments&&e?.isDisposed===!1}async asAttachment(i){let e=this._terminalService.getInstanceFromResource(this._resource);if(!e)return;let t=new URLSearchParams(this._resource.query),o=e.capabilities.get(2)?.commands.find(c=>c.id===t.get("command"));if(!o)return;let n={kind:"terminalCommand",id:`terminalCommand:${Date.now()}}`,value:this.asValue(o),name:o.command,command:o.command,output:o.getOutput(),exitCode:o.exitCode,resource:this._resource},r=new N,s=!1,l=()=>{s||(s=!0,r.dispose())};return r.add(i.attachmentModel.onDidChange(c=>{c.deleted.includes(n.id)&&l()})),r.add(e.onDisposed(()=>{i.attachmentModel.delete(n.id),i.refreshParsedInput(),l()})),n}asValue(i){let e=`Command: ${i.command}`,t=i.getOutput();return t&&(e+=`
Output:
${t}`),typeof i.exitCode=="number"&&(e+=`
Exit Code: ${i.exitCode}`),e}};N0e=I([m(1,nn)],N0e);var yrt=class{constructor(i){this._hostService=i;this.type="valuePick";this.icon=R.deviceCamera;this.label=Cht?d(5780,null):d(5781,null)}async isEnabled(i){return!!i.attachmentCapabilities.supportsImageAttachments&&!!i.input.selectedLanguageModel.get()?.metadata.capabilities?.vision}async asAttachment(){let i=await this._hostService.getScreenshot();return i&&eOt(i)}};yrt=I([m(0,Zt)],yrt);var wrt=class{constructor(i){this._chatDebugService=i;this.type="valuePick";this.icon=R.output;this.label=d(5782,null);this.ordinal=-600}isEnabled(i){let e=i.viewModel?.sessionResource;return!!e&&this._chatDebugService.getEvents(e).length>0}async asAttachment(i){let e=i.viewModel?.sessionResource;if(e)return A0e(e,this._chatDebugService)}};wrt=I([m(0,Yp)],wrt);var Crt=class{constructor(i){this._chatSessionsService=i;this.type="pickerPick";this.icon=R.comment;this.label=d(5784,null);this.ordinal=-400}isEnabled(i){return i.location==="panel"}asPicker(i){let e=i.viewModel?.sessionResource;return{placeholder:d(5785,null),picks:(async()=>{let t=[],o=["local","copilotcli","claude-code"];for await(let n of this._chatSessionsService.getChatSessionItems(o,Se.None)){let r=lT(n.chatSessionType);for(let s of n.items){if(e&&s.resource.toString()===e.toString())continue;let l=s.resource,c=s.iconPath??r;t.push({label:s.label,description:new Date(s.timing.lastRequestEnded??s.timing.created).toLocaleString(),asAttachment:()=>({kind:"sessionReference",id:l.toString(),name:s.label,value:l,icon:c})})}}return t.sort((n,r)=>(r.description??"").localeCompare(n.description??"")),t})()}}};Crt=I([m(0,Us)],Crt);var O0e=class{constructor(i){this.options=i;this.rangeHighlightDecorationId=void 0}provide(i,e,t){let o=new N;i.canAcceptInBackground=!!this.options?.canAcceptInBackground,i.matchOnLabel=i.matchOnDescription=i.matchOnDetail=i.sortByLabel=!1;let n=o.add(new me);return n.value=this.doProvide(i,e,t),o.add(this.onDidActiveTextEditorControlChange(()=>{n.value=void 0,n.value=this.doProvide(i,e)})),o}doProvide(i,e,t){let o=new N,n=this.activeTextEditorControl;if(n&&this.canProvideWithTextEditor(n)){let r={editor:n},s=ha(n);if(s){let l=n.saveViewState()??void 0;o.add(s.onDidChangeCursorPosition(()=>{l=n.saveViewState()??void 0})),r.restoreViewState=()=>{l&&n===this.activeTextEditorControl&&n.restoreViewState(l)},o.add($c(e.onCancellationRequested)(()=>r.restoreViewState?.()))}o.add(Z(()=>this.clearDecorations(n))),o.add(this.provideWithTextEditor(r,i,e,t))}else o.add(this.provideWithoutTextEditor(i,e));return o}canProvideWithTextEditor(i){return!0}gotoLocation({editor:i},e){i.setSelection(e.range,"code.jump"),i.revealRangeInCenter(e.range,0),e.preserveFocus||i.focus();let t=this.getModel(i);if(t){let o=t.getLineContent(e.range.startLineNumber);qr(d(1498,null,e.range.startLineNumber,e.range.startColumn,o))}}getModel(i){return mc(i)?i.getModel()?.modified:i.getModel()}addDecorations(i,e){i.changeDecorations(t=>{let o=[];this.rangeHighlightDecorationId&&(o.push(this.rangeHighlightDecorationId.overviewRulerDecorationId),o.push(this.rangeHighlightDecorationId.rangeHighlightId),this.rangeHighlightDecorationId=void 0);let n=[{range:e,options:{description:"quick-access-range-highlight",className:"rangeHighlight",isWholeLine:!0}},{range:e,options:{description:"quick-access-range-highlight-overview",overviewRuler:{color:Xs(Iwe),position:7}}}],[r,s]=t.deltaDecorations(o,n);this.rangeHighlightDecorationId={rangeHighlightId:r,overviewRulerDecorationId:s}})}clearDecorations(i){let e=this.rangeHighlightDecorationId;e&&(i.changeDecorations(t=>{t.deltaDecorations([e.overviewRulerDecorationId,e.rangeHighlightId],[])}),this.rangeHighlightDecorationId=void 0)}};var iL=class extends O0e{constructor(e,t,o=Object.create(null)){super(o);this._languageFeaturesService=e;this._outlineModelService=t;this.options=o,this.options.canAcceptInBackground=!0}static{this.PREFIX="@"}static{this.SCOPE_PREFIX=":"}static{this.PREFIX_BY_CATEGORY=`${this.PREFIX}${this.SCOPE_PREFIX}`}provideWithoutTextEditor(e){return this.provideLabelPick(e,d(1512,null)),x.None}provideWithTextEditor(e,t,o,n){let r=e.editor,s=this.getModel(r);return s?this._languageFeaturesService.documentSymbolProvider.has(s)?this.doProvideWithEditorSymbols(e,s,t,o,n):this.doProvideWithoutEditorSymbols(e,s,t,o):x.None}doProvideWithoutEditorSymbols(e,t,o,n){let r=new N;return this.provideLabelPick(o,d(1513,null)),(async()=>!await this.waitForLanguageSymbolRegistry(t,r)||n.isCancellationRequested||r.add(this.doProvideWithEditorSymbols(e,t,o,n)))(),r}provideLabelPick(e,t){e.items=[{label:t,index:0,kind:14}],e.ariaLabel=t}async waitForLanguageSymbolRegistry(e,t){if(this._languageFeaturesService.documentSymbolProvider.has(e))return!0;let o=new Ko,n=t.add(this._languageFeaturesService.documentSymbolProvider.onDidChange(()=>{this._languageFeaturesService.documentSymbolProvider.has(e)&&(n.dispose(),o.complete(!0))}));return t.add(Z(()=>o.complete(!1))),o.p}doProvideWithEditorSymbols(e,t,o,n,r){let s=e.editor,l=new N;l.add(o.onDidAccept(h=>{let[g]=o.selectedItems;if(g&&g.range){if(o.keyMods.shift&&g.attach){g.attach(o.keyMods,h);return}this.gotoLocation(e,{range:g.range.selection,keyMods:o.keyMods,preserveFocus:h.inBackground}),r?.handleAccept?.(g,h.inBackground),h.inBackground||o.hide()}})),l.add(o.onDidTriggerItemButton(({item:h})=>{h&&h.range&&(this.gotoLocation(e,{range:h.range.selection,keyMods:o.keyMods,forceSideBySide:!0}),o.hide())}));let c=this.getDocumentSymbols(t,n),u=l.add(new me),p=async h=>{u?.value?.cancel(),o.busy=!1,u.value=new Ye,o.busy=!0;try{let g=I0(o.value.substr(iL.PREFIX.length).trim()),f=await this.doGetSymbolPicks(c,g,void 0,u.value.token,t);if(n.isCancellationRequested)return;if(f.length>0){if(o.items=f,h&&g.original.length===0){let v=fd(f,b=>!!(b.type!=="separator"&&b.range&&z.containsPosition(b.range.decoration,h)));v&&(o.activeItems=[v])}}else g.original.length>0?this.provideLabelPick(o,d(1527,null)):this.provideLabelPick(o,d(1528,null))}finally{n.isCancellationRequested||(o.busy=!1)}};return l.add(o.onDidChangeValue(()=>p(void 0))),p(s.getSelection()?.getPosition()),l.add(o.onDidChangeActive(()=>{let[h]=o.activeItems;h&&h.range&&(s.revealRangeInCenter(h.range.selection,0),this.addDecorations(s,h.range.decoration))})),l}async doGetSymbolPicks(e,t,o,n,r){let s=await e;if(n.isCancellationRequested)return[];let l=t.original.indexOf(iL.SCOPE_PREFIX)===0,c=l?1:0,u,p;t.values&&t.values.length>1?(u=TLe(t.values[0]),p=TLe(t.values.slice(1))):u=t;let h,g=this.options?.openSideBySideDirection?.();g&&(h=[{iconClass:g==="right"?q.asClassName(R.splitHorizontal):q.asClassName(R.splitVertical),tooltip:g==="right"?d(1532,null):d(1531,null)}]);let f=[];for(let S=0;S<s.length;S++){let y=s[S],w=LL(y.name),k=`$(${_m.toIcon(y.kind).id}) ${w}`,T=k.length-w.length,P=y.containerName;o?.extraContainerLabel&&(P?P=`${o.extraContainerLabel} \u2022 ${P}`:P=o.extraContainerLabel);let O,V,H,G;if(t.original.length>c){let J=!1;if(u!==t&&([O,V]=qZ(k,{...t,values:void 0},c,T),typeof O=="number"&&(J=!0)),typeof O!="number"&&([O,V]=qZ(k,u,c,T),typeof O!="number"))continue;if(!J&&p){if(P&&p.original.length>0&&([H,G]=qZ(P,p)),typeof H!="number")continue;typeof O=="number"&&(O+=H)}}let $=y.tags&&y.tags.indexOf(1)>=0;f.push({index:S,kind:y.kind,score:O,label:k,ariaLabel:pvt(y.name,y.kind),description:P,highlights:$?void 0:{label:V,description:G},range:{selection:z.collapseToStart(y.selectionRange),decoration:y.range},uri:r.uri,symbolName:w,strikethrough:$,buttons:h})}let v=f.sort((S,y)=>l?this.compareByKindAndScore(S,y):this.compareByScore(S,y)),b=[];if(l){let k=function(){y&&typeof S=="number"&&w>0&&(y.label=vd(bMi[S]||vMi,w))},S,y,w=0;for(let T of v)S!==T.kind?(k(),S=T.kind,w=1,y={type:"separator"},b.push(y)):w++,b.push(T);k()}else v.length>0&&(b=[{label:d(1538,null,f.length),type:"separator"},...v]);return b}compareByScore(e,t){if(typeof e.score!="number"&&typeof t.score=="number")return 1;if(typeof e.score=="number"&&typeof t.score!="number")return-1;if(typeof e.score=="number"&&typeof t.score=="number"){if(e.score>t.score)return-1;if(e.score<t.score)return 1}return e.index<t.index?-1:e.index>t.index?1:0}compareByKindAndScore(e,t){let o=bMi[e.kind]||vMi,n=bMi[t.kind]||vMi,r=o.localeCompare(n);return r===0?this.compareByScore(e,t):r}async getDocumentSymbols(e,t){let o=await this._outlineModelService.getOrCreate(e,t);return t.isCancellationRequested?[]:o.asListOfDocumentSymbols()}};iL=I([m(0,Qt),m(1,AC)],iL);var vMi=d(1535,null),bMi={5:d(1524,null),11:d(1521,null),8:d(1509,null),12:d(1540,null),4:d(1514,null),22:d(1537,null),23:d(1518,null),24:d(1533,null),10:d(1522,null),2:d(1526,null),3:d(1534,null),25:d(1539,null),1:d(1525,null),6:d(1535,null),9:d(1516,null),21:d(1517,null),14:d(1536,null),0:d(1520,null),17:d(1510,null),15:d(1529,null),16:d(1511,null),18:d(1530,null),19:d(1523,null),7:d(1519,null),13:d(1515,null)};var TGt=class{constructor(i,e,t,o){this.cacheQuery=i;this.loadFn=e;this.disposeFn=t;this.previousCacheState=o;if(this._cacheKey=Uj.nextId(),this.query=this.cacheQuery(this._cacheKey),this.loadingPhase=1,this.previousCacheState){let n=Object.assign({},this.query,{cacheKey:null}),r=Object.assign({},this.previousCacheState.query,{cacheKey:null});eo(n,r)||(this.previousCacheState.dispose(),this.previousCacheState=void 0)}}get cacheKey(){return this.loadingPhase===3||!this.previousCacheState?this._cacheKey:this.previousCacheState.cacheKey}get isLoaded(){let i=this.loadingPhase===3;return i||!this.previousCacheState?i:this.previousCacheState.isLoaded}get isUpdating(){let i=this.loadingPhase===2;return i||!this.previousCacheState?i:this.previousCacheState.isUpdating}load(){return this.isUpdating?this:(this.loadingPhase=2,this.loadPromise=(async()=>{try{await this.loadFn(this.query),this.loadingPhase=3,this.previousCacheState&&(this.previousCacheState.dispose(),this.previousCacheState=void 0)}catch(i){throw this.loadingPhase=4,i}})(),this)}dispose(){this.loadPromise?(async()=>{try{await this.loadPromise}catch{}this.loadingPhase=5,this.disposeFn(this._cacheKey)})():this.loadingPhase=5,this.previousCacheState&&(this.previousCacheState.dispose(),this.previousCacheState=void 0)}};var Yk=class extends Lh{constructor(e,t,o,n,r,s){super(Yk.PREFIX,{canAcceptInBackground:!0,noResultsPick:{label:d(14134,null)}});this.labelService=e;this.openerService=t;this.editorService=o;this.configurationService=n;this.codeEditorService=r;this.chatWidgetService=s;this.delayer=this._register(new ya(Yk.TYPING_SEARCH_DELAY))}static{this.PREFIX="#"}static{this.TYPING_SEARCH_DELAY=200}static{this.TREAT_AS_GLOBAL_SYMBOL_TYPES=new Set([4,9,0,10,2,3,1])}get defaultFilterValue(){let e=this.codeEditorService.getFocusedCodeEditor();if(e)return YY(e)??void 0}get configuration(){let e=this.configurationService.getValue().workbench?.editor;return{openEditorPinned:!e?.enablePreviewFromQuickOpen||!e?.enablePreview,openSideBySideDirection:e?.openSideBySideDirection}}_getPicks(e,t,o){return this.getSymbolPicks(e,void 0,o)}async getSymbolPicks(e,t,o){return this.delayer.trigger(async()=>o.isCancellationRequested?[]:this.doGetSymbolPicks(I0(e),t,o),t?.delay)}async doGetSymbolPicks(e,t,o){let n,r;e.values&&e.values.length>1?(n=TLe(e.values[0]),r=TLe(e.values.slice(1))):n=e;let s=await VMt(n.original,o);if(o.isCancellationRequested)return[];let l=[],c=this.configuration.openSideBySideDirection;for(let{symbol:u,provider:p}of s){if(t?.skipLocal&&!Yk.TREAT_AS_GLOBAL_SYMBOL_TYPES.has(u.kind)&&u.containerName)continue;let h=u.name,g,f,v=!1;if(n.original.length>0&&(n!==e&&([g,f]=qZ(h,{...e,values:void 0},0,0),typeof g=="number"&&(v=!0)),typeof g!="number"&&([g,f]=qZ(h,n,0,0),typeof g!="number")))continue;let b=u.location.uri,S;if(b){let T=this.labelService.getUriLabel(b,{relative:!0});u.containerName?S=`${u.containerName} \u2022 ${T}`:S=T}let y,w;if(!v&&r&&r.original.length>0){if(S&&([y,w]=qZ(S,r)),typeof y!="number")continue;typeof g=="number"&&(g+=y)}let k=u.tags?u.tags.indexOf(1)>=0:!1;l.push({symbol:u,resource:b,score:g,iconClass:q.asClassName(_m.toIcon(u.kind)),label:h,ariaLabel:h,highlights:k?void 0:{label:f,description:w},description:S,strikethrough:k,buttons:[{iconClass:c==="right"?q.asClassName(R.splitHorizontal):q.asClassName(R.splitVertical),tooltip:c==="right"?d(14136,null):d(14135,null)}],trigger:(T,P)=>(this.openSymbol(p,u,o,{keyMods:P,forceOpenSideBySide:!0}),1),accept:async(T,P)=>this.openSymbol(p,u,o,{keyMods:T,preserveFocus:P.inBackground,forcePinned:P.inBackground}),attach:(T,P)=>{if(T.shift){let O=this.chatWidgetService.lastFocusedWidget;if(O){let V={kind:"symbol",id:JSON.stringify({uri:b.toString(),range:u.location.range}),name:u.name,value:u.location,symbolKind:u.kind};O.attachmentModel.addContext(V)}return}this.openSymbol(p,u,o,{keyMods:T,preserveFocus:P.inBackground,forcePinned:P.inBackground})}})}return t?.skipSorting||l.sort((u,p)=>this.compareSymbols(u,p)),l}async openSymbol(e,t,o,n){let r=t;typeof e.resolveWorkspaceSymbol=="function"&&(r=await e.resolveWorkspaceSymbol(t,o)||t,o.isCancellationRequested)||(r.location.uri.scheme===Q.http||r.location.uri.scheme===Q.https?await this.openerService.open(r.location.uri,{fromUserGesture:!0,allowContributedOpeners:!0}):await this.editorService.openEditor({resource:r.location.uri,options:{preserveFocus:n?.preserveFocus,pinned:n.keyMods.ctrlCmd||n.forcePinned||this.configuration.openEditorPinned,selection:r.location.range?z.collapseToStart(r.location.range):void 0}},n.keyMods.alt||this.configuration.openEditorPinned&&n.keyMods.ctrlCmd||n?.forceOpenSideBySide?In:jn))}compareSymbols(e,t){if(typeof e.score=="number"&&typeof t.score=="number"){if(e.score>t.score)return-1;if(e.score<t.score)return 1}if(e.symbol&&t.symbol){let o=e.symbol.name.toLowerCase(),n=t.symbol.name.toLowerCase(),r=o.localeCompare(n);if(r!==0)return r}if(e.symbol&&t.symbol){let o=_m.toIcon(e.symbol.kind).id,n=_m.toIcon(t.symbol.kind).id;return o.localeCompare(n)}return 0}};Yk=I([m(0,rt),m(1,Je),m(2,ee),m(3,B),m(4,qt),m(5,Pt)],Yk);var Xk=class extends iL{constructor(e,t,o,n,r,s){super(o,r,{openSideBySideDirection:()=>this.configuration.openSideBySideDirection});this.editorService=e;this.configurationService=t;this.outlineService=n;this.chatWidgetService=s;this.onDidActiveTextEditorControlChange=this.editorService.onDidActiveEditorChange}get configuration(){let e=this.configurationService.getValue().workbench?.editor;return{openEditorPinned:!e?.enablePreviewFromQuickOpen||!e?.enablePreview,openSideBySideDirection:e?.openSideBySideDirection}}get activeTextEditorControl(){if(!SO(this.editorService.activeEditorPane?.getControl()))return this.editorService.activeTextEditorControl}gotoLocation(e,t){if((t.keyMods.alt||this.configuration.openEditorPinned&&t.keyMods.ctrlCmd||t.forceSideBySide)&&this.editorService.activeEditor){e.restoreViewState?.();let o={selection:t.range,pinned:t.keyMods.ctrlCmd||this.configuration.openEditorPinned,preserveFocus:t.preserveFocus};this.editorService.openEditor(this.editorService.activeEditor,o,In)}else super.gotoLocation(e,t)}static{this.SYMBOL_PICKS_TIMEOUT=8e3}async getSymbolPicks(e,t,o,n,r){return!await Promise.race([this.waitForLanguageSymbolRegistry(e,n),Li(Xk.SYMBOL_PICKS_TIMEOUT)])||r.isCancellationRequested?[]:this.doGetSymbolPicks(this.getDocumentSymbols(e,r),I0(t),o,r,e)}async doGetSymbolPicks(e,t,o,n,r){let s=await super.doGetSymbolPicks(e,t,o,n,r),l=r.uri;for(let c of s){let u=c;u.range&&!u.attach&&(u.attach=()=>{let p=this.chatWidgetService.lastFocusedWidget;if(!p)return;let h={kind:"symbol",id:JSON.stringify({uri:l.toString(),range:u.range.decoration}),name:u.symbolName??u.label,value:{uri:l,range:u.range.decoration},symbolKind:u.kind};p.attachmentModel.addContext(h)})}return s}provideWithoutTextEditor(e){return this.canPickWithOutlineService()?this.doGetOutlinePicks(e):super.provideWithoutTextEditor(e)}canPickWithOutlineService(){return this.editorService.activeEditorPane?this.outlineService.canCreateOutline(this.editorService.activeEditorPane):!1}doGetOutlinePicks(e){let t=this.editorService.activeEditorPane;if(!t)return x.None;let o=new Ye,n=new N;return n.add(Z(()=>o.dispose(!0))),e.busy=!0,this.outlineService.createOutline(t,4,o.token).then(r=>{if(!r)return;if(o.token.isCancellationRequested){r.dispose();return}n.add(r);let s=r.captureViewState();n.add(Z(()=>{e.selectedItems.length===0&&s.dispose()}));let l=r.config.quickPickDataSource.getQuickPickElements(),c=l.map((h,g)=>({kind:0,index:g,score:0,label:h.label,description:h.description,ariaLabel:h.ariaLabel,iconClasses:h.iconClasses}));n.add(e.onDidAccept(()=>{e.hide();let[h]=e.selectedItems;h&&l[h.index]&&r.reveal(l[h.index].element,{},!1,!1)}));let u=()=>{let h=c.filter(g=>{if(e.value==="@")return g.score=0,g.highlights=void 0,!0;let f=e.value.substring(iL.PREFIX.length).trim(),v=HV(g.label),b=rR(f,f.toLowerCase(),0,v.text,v.text.toLowerCase(),0,{firstMatchCanBeWeak:!0,boostFullMatch:!0});return b?(g.score=b[1],g.highlights={label:Hj(f,v)??void 0},!0):!1});if(h.length===0){let g=d(8954,null);e.items=[{label:g,index:-1,kind:14}],e.ariaLabel=g}else e.items=h};u(),n.add(e.onDidChangeValue(u));let p=new me;n.add(p),n.add(e.onDidChangeActive(()=>{let[h]=e.activeItems;h&&l[h.index]?p.value=r.preview(l[h.index].element):p.clear()}))}).catch(r=>{mt(r),e.hide()}).finally(()=>{e.busy=!1}),n}};Xk=I([m(0,ee),m(1,B),m(2,Qt),m(3,cM),m(4,AC),m(5,Pt)],Xk);var _Gt=class a extends K{static{this.ID="workbench.action.gotoSymbol"}constructor(){super({id:a.ID,title:{...L(8955,"Go to Symbol in Editor..."),mnemonicTitle:d(8959,null)},f1:!0,keybinding:{when:C.and(Dd.negate(),ox.negate()),weight:200,primary:3117},menu:[{id:D.MenubarGoMenu,group:"4_symbol_nav",order:1}]})}run(i){i.get(Ue).quickAccess.show(Xk.PREFIX,{itemActivation:0})}};W(_Gt);ne.as(Ku.Quickaccess).registerQuickAccessProvider({ctor:Xk,prefix:iL.PREFIX,contextKey:"inFileSymbolsPicker",placeholder:d(8958,null),helpEntries:[{description:d(8957,null),prefix:iL.PREFIX,commandId:_Gt.ID,commandCenterOrder:40},{description:d(8956,null),prefix:iL.PREFIX_BY_CATEGORY}]});var xrt="workbench.action.quickchat.toggle";function HIo(){W(SMi),W(IMi),W(class extends K{constructor(){super({id:"workbench.action.quickchat.openInChatView",title:L(5918,"Open in Chat View"),f1:!1,category:Si,icon:R.chatSparkle,menu:{id:D.ChatInputSide,group:"navigation",order:10}})}run(i){i.get(sD).openInChatView()}}),W(class extends K{constructor(){super({id:"workbench.action.quickchat.close",title:L(5917,"Close Quick Chat"),f1:!1,category:Si,icon:R.close,menu:{id:D.ChatInputSide,group:"navigation",order:20}})}run(i){i.get(sD).close()}})}var SMi=class extends K{constructor(){super({id:xrt,title:L(5920,"Open Quick Chat"),precondition:ie.enabled,icon:R.chatSparkle,f1:!1,category:Si,keybinding:{weight:200,primary:3626},menu:{id:D.ChatTitleBarMenu,group:"a_open",order:4},metadata:{description:d(5921,null),args:[{name:"args",schema:{anyOf:[{type:"object",required:["query"],properties:{query:{description:d(5923,null),type:"string"},isPartialQuery:{description:d(5922,null),type:"boolean"}}},{type:"string",description:d(5923,null)}]}}]}})}run(i,e){let t=i.get(sD),o;switch(typeof e){case"string":o={query:e};break;case"object":o=e;break}o?.query&&(o.selection=new ti(1,o.query.length+1,1,o.query.length+1)),t.toggle(o)}},IMi=class extends K{constructor(){super({id:"workbench.action.openQuickChat",category:Si,title:L(5919,"Open Quick Chat"),precondition:ie.enabled,f1:!0})}run(i,e){i.get(sD).toggle(e?{query:e,selection:new ti(1,e.length+1,1,e.length+1)}:void 0)}};function yMi(a){let i=a;return!!i?.range&&!!i.resource}var iC=class extends Lh{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,P,O,V){super(iC.PREFIX,{canAcceptInBackground:!0,noResultsPick:iC.NO_RESULTS_PICK});this.instantiationService=e;this.searchService=t;this.contextService=o;this.pathService=n;this.environmentService=r;this.fileService=s;this.labelService=l;this.modelService=c;this.languageService=u;this.workingCopyService=p;this.configurationService=h;this.editorService=g;this.historyService=f;this.filesConfigurationService=v;this.textModelService=b;this.uriIdentityService=S;this.quickInputService=y;this.keybindingService=w;this.contextKeyService=k;this.quickChatService=T;this.logService=P;this.customEditorLabelService=O;this.chatWidgetService=V;this.labelOnlyEditorHistoryPickAccessor=new z4e({skipDescription:!0});this.fileQueryDelayer=this._register(new ya(iC.TYPING_SEARCH_DELAY));this.lazyRegistry=new co(()=>ne.as(Ku.Quickaccess));this.pickState=this._register(new class extends x{constructor(G,$){super();this.provider=G;this.picker=void 0;this.scorerCache=Object.create(null);this.fileQueryCache=void 0;this.lastOriginalFilter=void 0;this.lastFilter=void 0;this.lastRange=void 0;this.lastGlobalPicks=void 0;this.isQuickNavigating=void 0;this.editorViewState=this._register($.createInstance(L2))}set(G){this.picker=G,U.once(G.onDispose)(()=>{G===this.picker&&(this.picker=void 0)});let $=!!G.quickNavigate;$||(this.fileQueryCache=this.provider.createFileQueryCache(),this.scorerCache=Object.create(null)),this.isQuickNavigating=$,this.lastOriginalFilter=void 0,this.lastFilter=void 0,this.lastRange=void 0,this.lastGlobalPicks=void 0,this.editorViewState.reset()}}(this,e)),this.fileQueryBuilder=this.instantiationService.createInstance(kS),this.workspaceSymbolsQuickAccess=this._register(e.createInstance(Yk)),this.editorSymbolsQuickAccess=this.instantiationService.createInstance(Xk)}static{this.PREFIX=""}static{this.NO_RESULTS_PICK={label:d(13827,null)}}static{this.MAX_RESULTS=512}static{this.TYPING_SEARCH_DELAY=200}static{this.SYMBOL_PICKS_MERGE_DELAY=200}get defaultFilterValue(){if(this.configuration.preserveInput)return 1}get configuration(){let e=this.configurationService.getValue().workbench?.editor,t=this.configurationService.getValue().search,o=this.configurationService.getValue().workbench.quickOpen;return{openEditorPinned:!e?.enablePreviewFromQuickOpen||!e?.enablePreview,openSideBySideDirection:e?.openSideBySideDirection,includeSymbols:t?.quickOpen.includeSymbols,includeHistory:t?.quickOpen.includeHistory,historyFilterSortOrder:t?.quickOpen.history.filterSortOrder,preserveInput:o.preserveInput}}provide(e,t,o){let n=new N;this.pickState.set(e);let r=n.add(new me);return n.add(e.onDidChangeActive(()=>{r.value=void 0;let[s]=e.activeItems;yMi(s)&&(r.value=this.decorateAndRevealSymbolRange(s))})),n.add(U.once(e.onDidHide)(({reason:s})=>{s===2&&this.pickState.editorViewState.restore()})),n.add(super.provide(e,t,o)),n}decorateAndRevealSymbolRange(e){let t=this.editorService.activeEditor;if(!this.uriIdentityService.extUri.isEqual(e.resource,t?.resource))return x.None;let o=this.editorService.activeTextEditorControl;return o?(this.pickState.editorViewState.set(),o.revealRangeInCenter(e.range.selection,0),this.addDecorations(o,e.range.decoration),Z(()=>this.clearDecorations(o))):x.None}_getPicks(e,t,o,n){let r=Cno(e,[Xk.PREFIX]),s;if(r?s=r.filter:s=e,this.pickState.lastRange=r?.range,e!==this.pickState.lastOriginalFilter&&s===this.pickState.lastFilter)return null;let l=!!this.pickState.lastOriginalFilter;this.pickState.lastOriginalFilter=e,this.pickState.lastFilter=s;let c=this.pickState.picker?.items,u=this.pickState.picker?.activeItems[0];if(c&&u){let p=yMi(u),h=u===iC.NO_RESULTS_PICK&&s.indexOf(Xk.PREFIX)>=0;!p&&!h&&(this.pickState.lastGlobalPicks={items:c,active:u})}return this.doGetPicks(s,{...n,enableEditorSymbolSearch:l},t,o)}doGetPicks(e,t,o,n){let r=I0(e);if(t.enableEditorSymbolSearch){let u=this.getEditorSymbolPicks(r,o,n);if(u)return u}let s=this.pickState.picker?.activeItems[0];if(yMi(s)&&this.pickState.lastGlobalPicks)return this.pickState.lastGlobalPicks;let l=this.getEditorHistoryPicks(r),c=new Array;if(t.additionPicks)for(let u of t.additionPicks){if(u.type==="separator"){c.push(u);continue}if(!r.original){u.highlights=void 0,c.push(u);continue}let{score:p,labelMatch:h,descriptionMatch:g}=GZ(u,r,!0,EY,this.pickState.scorerCache);p&&(u.highlights={label:h,description:g},c.push(u))}return this.pickState.isQuickNavigating?(c.length>0&&c.push({type:"separator",label:d(13830,null)}),c=l):(t.includeHelp&&c.push(...this.getHelpPicks(r,n,t)),l.length!==0&&(c.push({type:"separator",label:d(13830,null)}),c.push(...l))),{picks:t.filter?c.filter(u=>t.filter?.(u)):c,additionalPicks:(async()=>{let u=new gt(h=>this.uriIdentityService.extUri.getComparisonKey(h));for(let h of l)h.resource&&u.set(h.resource,!0);let p=await this.getAdditionalPicks(r,u,this.configuration.includeSymbols,n);return t.filter&&(p=p.filter(h=>t.filter?.(h))),n.isCancellationRequested?[]:p.length>0?[{type:"separator",label:this.configuration.includeSymbols?d(13823,null):d(13825,null)},...p]:[]})(),mergeDelay:iC.SYMBOL_PICKS_MERGE_DELAY}}async getAdditionalPicks(e,t,o,n){let[r,s]=await Promise.all([this.getFilePicks(e,t,n),this.getWorkspaceSymbolPicks(e,o,n)]);if(n.isCancellationRequested)return[];let l=k2i([...r,...s],(u,p)=>iJe(u,p,e,!0,EY,this.pickState.scorerCache),iC.MAX_RESULTS),c=[];for(let u of l)if(u.highlights)c.push(u);else{let{score:p,labelMatch:h,descriptionMatch:g}=GZ(u,e,!0,EY,this.pickState.scorerCache);if(!p)continue;u.highlights={label:h,description:g},c.push(u)}return c}getEditorHistoryPicks(e){let t=this.configuration;if(!e.normalized)return this.historyService.getHistory().map(r=>this.createAnythingPick(r,t));if(!this.configuration.includeHistory)return[];let o=e.containsPathSeparator?EY:this.labelOnlyEditorHistoryPickAccessor,n=[];for(let r of this.historyService.getHistory()){if(!r.resource)continue;let l=this.createAnythingPick(r,t),{score:c,labelMatch:u,descriptionMatch:p}=GZ(l,e,!1,o,this.pickState.scorerCache);c&&(l.highlights={label:u,description:p},n.push(l))}return this.configuration.historyFilterSortOrder==="recency"?n:n.sort((r,s)=>iJe(r,s,e,!1,o,this.pickState.scorerCache))}createFileQueryCache(){return new TGt(e=>this.fileQueryBuilder.file(this.contextService.getWorkspace().folders,this.getFileQueryOptions({cacheKey:e})),e=>this.searchService.fileSearch(e),e=>this.searchService.clearCache(e),this.pickState.fileQueryCache).load()}async getFilePicks(e,t,o){if(!e.normalized)return[];let n=await this.getAbsolutePathFileResult(e,o);if(o.isCancellationRequested)return[];let r;if(n){if(t.has(n))return[];let l=this.createAnythingPick(n,this.configuration);return l.highlights={label:[{start:0,end:l.label.length}],description:l.description?[{start:0,end:l.description.length}]:void 0},[l]}if(this.pickState.fileQueryCache?.isLoaded?r=await this.doFileSearch(e,o):r=await this.fileQueryDelayer.trigger(async()=>o.isCancellationRequested?[]:this.doFileSearch(e,o)),o.isCancellationRequested)return[];let s=this.configuration;return r.filter(l=>!t.has(l)).map(l=>this.createAnythingPick(l,s))}async doFileSearch(e,t){let[o,n]=await Promise.all([this.getFileSearchResults(e,t),this.getRelativePathFileResults(e,t)]);if(t.isCancellationRequested)return[];if(!n)return o;let r=new gt(s=>this.uriIdentityService.extUri.getComparisonKey(s));for(let s of n)r.set(s,!0);return[...o.filter(s=>!r.has(s)),...n]}async getFileSearchResults(e,t){let o="";e.values&&e.values.length>1?o=e.values[0].original:o=e.original;let n=await this.doGetFileSearchResults(o,t);if(t.isCancellationRequested)return[];if(n.limitHit&&e.values&&e.values.length>1){let r=await this.doGetFileSearchResults(e.original,t);if(t.isCancellationRequested)return[];let s=new gt(l=>this.uriIdentityService.extUri.getComparisonKey(l));for(let l of n.results)s.set(l.resource,!0);for(let l of r.results)s.has(l.resource)||n.results.push(l)}return n.results.map(r=>r.resource)}doGetFileSearchResults(e,t){let o=Date.now();return this.searchService.fileSearch(this.fileQueryBuilder.file(this.contextService.getWorkspace().folders,this.getFileQueryOptions({filePattern:e,cacheKey:this.pickState.fileQueryCache?.cacheKey,maxResults:iC.MAX_RESULTS})),t).finally(()=>{this.logService.trace(`QuickAccess fileSearch ${Date.now()-o}ms`)})}getFileQueryOptions(e){return{_reason:"openFileHandler",extraFileResources:this.instantiationService.invokeFunction(UJ),filePattern:e.filePattern||"",cacheKey:e.cacheKey,maxResults:e.maxResults||0,sortByScore:!0}}async getAbsolutePathFileResult(e,t){if(!e.containsPathSeparator)return;let o=await this.pathService.userHome(),n=F7(e.original,o.scheme===Q.file?o.fsPath:o.path);if(t.isCancellationRequested)return;let r=(await this.pathService.path).isAbsolute(n);if(!t.isCancellationRequested&&r){let s=of(await this.pathService.fileURI(n),this.environmentService.remoteAuthority,this.pathService.defaultUriScheme);if(t.isCancellationRequested)return;try{if((await this.fileService.stat(s)).isFile)return await this.matchFilenameCasing(s)}catch{}}}async getRelativePathFileResults(e,t){if(!e.containsPathSeparator)return;if(!(await this.pathService.path).isAbsolute(e.original)){let n=[];for(let r of this.contextService.getWorkspace().folders){if(t.isCancellationRequested)break;let s=of(r.toResource(e.original),this.environmentService.remoteAuthority,this.pathService.defaultUriScheme);try{(await this.fileService.stat(s)).isFile&&n.push(await this.matchFilenameCasing(s))}catch{}}return n}}async matchFilenameCasing(e){let t=ci(e),o=await this.fileService.resolve(t,{resolveTo:[e]});if(o?.children){let n=o.children.find(r=>this.uriIdentityService.extUri.isEqual(r.resource,e));if(n)return A.joinPath(t,n.name)}return e}getHelpPicks(e,t,o){if(e.normalized)return[];let n=this.lazyRegistry.value.getQuickAccessProviders(this.contextKeyService).filter(r=>r.helpEntries.some(s=>s.commandCenterOrder!==void 0)).flatMap(r=>r.helpEntries.filter(s=>s.commandCenterOrder!==void 0).map(s=>{let l={...o,includeHelp:r.prefix===iC.PREFIX?!1:o?.includeHelp},c=s.commandCenterLabel??s.description;return{label:c,description:s.prefix??r.prefix,commandCenterOrder:s.commandCenterOrder,keybinding:s.commandId?this.keybindingService.lookupKeybinding(s.commandId):void 0,ariaLabel:d(13826,null,c,s.description),accept:()=>{this.quickInputService.quickAccess.show(r.prefix,{preserveValue:!0,providerOptions:l})}}}));return this.quickChatService.enabled&&n.push({label:d(13821,null),commandCenterOrder:30,keybinding:this.keybindingService.lookupKeybinding(xrt),accept:()=>this.quickChatService.toggle()}),n.sort((r,s)=>r.commandCenterOrder-s.commandCenterOrder)}async getWorkspaceSymbolPicks(e,t,o){return!e.normalized||!t||this.pickState.lastRange?[]:this.workspaceSymbolsQuickAccess.getSymbolPicks(e.original,{skipLocal:!0,skipSorting:!0,delay:iC.TYPING_SEARCH_DELAY},o)}getEditorSymbolPicks(e,t,o){let n=e.original.split(Xk.PREFIX),r=n.length>1?n[n.length-1].trim():void 0;if(typeof r!="string")return null;let s=this.pickState.lastGlobalPicks?.active;if(!s)return null;let l=s.resource;return!l||!this.fileService.hasProvider(l)&&l.scheme!==Q.untitled||(s.label.includes(Xk.PREFIX)||s.description?.includes(Xk.PREFIX))&&n.length<3?null:this.doGetEditorSymbolPicks(s,l,r,t,o)}async doGetEditorSymbolPicks(e,t,o,n,r){try{this.pickState.editorViewState.set(),await this.pickState.editorViewState.openTransientEditor({resource:t,options:{preserveFocus:!0,revealIfOpened:!0,ignoreError:!0}})}catch{return[]}if(r.isCancellationRequested)return[];let s=this.modelService.getModel(t);if(!s)try{let c=n.add(await this.textModelService.createModelReference(t));if(r.isCancellationRequested)return[];s=c.object.textEditorModel}catch{return[]}let l=await this.editorSymbolsQuickAccess.getSymbolPicks(s,o,{extraContainerLabel:Nu(e.label)},n,r);return r.isCancellationRequested?[]:l.map(c=>c.type==="separator"?c:{...c,resource:t,description:c.description,trigger:(u,p)=>(this.openAnything(t,{keyMods:p,range:c.range?.selection,forceOpenSideBySide:!0}),1),accept:(u,p)=>this.openAnything(t,{keyMods:u,range:c.range?.selection,preserveFocus:p.inBackground,forcePinned:p.inBackground})})}addDecorations(e,t){this.editorSymbolsQuickAccess.addDecorations(e,t)}clearDecorations(e){this.editorSymbolsQuickAccess.clearDecorations(e)}createAnythingPick(e,t){let o=!A.isUri(e),n,r,s,l,c,u;if(ka(e))n=po.getOriginalUri(e),r=e.getName(),s=e.getDescription(),l=e.isDirty()&&!e.isSaving(),c=e.getLabelExtraClasses(),u=e.getIcon();else{n=A.isUri(e)?e:e.resource;let f=this.customEditorLabelService.getName(n);r=f||Ga(n),s=this.labelService.getUriLabel(f?n:ci(n),{relative:!0}),l=this.workingCopyService.isDirty(n)&&!this.filesConfigurationService.hasShortAutoSaveDelay(n),c=[]}let p=s?`${r} ${s}`:r,h=new co(()=>aa(this.modelService,this.languageService,n,void 0,u).concat(c)),g=new co(()=>{let f=t.openSideBySideDirection,v=[];return v.push({iconClass:f==="right"?q.asClassName(R.splitHorizontal):q.asClassName(R.splitVertical),tooltip:f==="right"?d(13829,null):d(13828,null)}),o&&v.push({iconClass:l?"dirty-anything "+q.asClassName(R.circleFilled):q.asClassName(R.close),tooltip:d(13822,null),alwaysVisible:l}),v});return{resource:n,label:r,ariaLabel:l?d(13824,null,p):p,description:s,get iconClasses(){return h.value},get buttons(){return g.value},trigger:(f,v)=>{switch(f){case 0:return this.openAnything(e,{keyMods:v,range:this.pickState.lastRange,forceOpenSideBySide:!0}),1;case 1:if(!A.isUri(e))return this.historyService.removeFromHistory(e),3}return 0},accept:(f,v)=>this.openAnything(e,{keyMods:f,range:this.pickState.lastRange,preserveFocus:v.inBackground,forcePinned:v.inBackground}),attach:(f,v)=>{if(f.shift){let b=this.chatWidgetService.lastFocusedWidget;b&&n&&b.attachmentModel.addContext(b.attachmentModel.asFileVariableEntry(n));return}this.openAnything(e,{keyMods:f,range:this.pickState.lastRange,preserveFocus:v.inBackground,forcePinned:v.inBackground})}}}async openAnything(e,t){let o={preserveFocus:t.preserveFocus,pinned:t.keyMods?.ctrlCmd||t.forcePinned||this.configuration.openEditorPinned,selection:t.range?z.collapseToStart(t.range):void 0},n=t.keyMods?.alt||this.configuration.openEditorPinned&&t.keyMods?.ctrlCmd||t.forceOpenSideBySide?In:jn;if(n===In&&await this.pickState.editorViewState.restore(),ka(e))await this.editorService.openEditor(e,o,n);else{let r;A.isUri(e)?r={resource:e,options:o}:r={...e,options:{...e.options,...o}},await this.editorService.openEditor(r,n)}}};iC=I([m(0,F),m(1,gg),m(2,Pe),m(3,An),m(4,At),m(5,fe),m(6,rt),m(7,Tt),m(8,_t),m(9,Xa),m(10,B),m(11,ee),m(12,na),m(13,gr),m(14,Bt),m(15,ht),m(16,Ue),m(17,_e),m(18,X),m(19,sD),m(20,se),m(21,Rv),m(22,Pt)],iC);function xQ(a,i){do if(i.includes(a))return!0;while(!vN(a.parent())&&(a=a.parent()));return!1}var UIo="plainTextSearch",zIo="aiTextSearch";function wMi(a){let i=[],e=a;for(;!lv(e);)i.push(e),e=e.parent();return i}var KIo="SEARCH_MODEL_",CMi="SEARCH_RESULT_",F0e="TEXT_SEARCH_HEADING_",krt="FOLDER_MATCH_",Ert="FILE_MATCH_",Trt="MATCH_";function DGt(a){let i={elements:[],added:!1,removed:!1};return a.forEach(e=>{e.added&&(i.added=!0),e.removed&&(i.removed=!0),i.elements=i.elements.concat(e.elements)}),i}function vN(a){return typeof a=="object"&&a!==null&&typeof a.id=="function"&&a.id().startsWith(CMi)}function lv(a){return typeof a=="object"&&a!==null&&typeof a.id=="function"&&a.id().startsWith(F0e)}function GIo(a){return lv(a)&&typeof a.replace=="function"&&typeof a.replaceAll=="function"}function Fd(a){return typeof a=="object"&&a!==null&&typeof a.id=="function"&&a.id().startsWith(krt)}function kQ(a){return Fd(a)&&a.resource instanceof A}function iq(a){return kQ(a)&&typeof a.createAndConfigureFileMatch=="function"}function _W(a){return Fd(a)&&typeof a.createAndConfigureFileMatch=="function"}function _l(a){return typeof a=="object"&&a!==null&&typeof a.id=="function"&&a.id().startsWith(Ert)}function el(a){return typeof a=="object"&&a!==null&&typeof a.id=="function"&&a.id().startsWith(Trt)}function qIo(a){return typeof a=="object"&&a!==null&&typeof a.id=="function"&&a.id().startsWith(F0e)}function _rt(a){let i=[],e=[];return a.forEach(t=>{_l(t)?e.push(t):i.push(t)}),e.concat(i.map(t=>t.allDownstreamFileMatches()).flat())}var W0e=class extends K{async run(i){let e=i.get(F),t=i.get(Je),o=e.createInstance(fN),n=d(7426,null),r=await o.selectPromptFile({placeholder:n,type:"agent",optionEdit:!1,optionVisibility:!0});r!==void 0&&await t.open(r.promptFile)}},$Io="workbench.action.chat.picker.customagents";function QIo(a){return{id:a?$Io+".disabled":$Io,title:L(7428,"Configure Custom Agents..."),tooltip:a?d(7427,null):void 0,icon:a?R.lock:void 0,category:Si,f1:!1,precondition:a?C.false():ie.Modes.agentModeDisabledByPolicy.negate(),menu:{id:D.ChatModePicker,when:a?ie.Modes.agentModeDisabledByPolicy:ie.Modes.agentModeDisabledByPolicy.negate()}}}var xMi=class extends W0e{constructor(){super(QIo(!1))}},kMi=class extends W0e{constructor(){super(QIo(!0))}},jIo="workbench.action.chat.configure.customagents";function YIo(a){let i={id:a?jIo+".disabled":jIo,title:L(7424,"Configure Custom Agents..."),shortTitle:d(7425,null),icon:a?R.lock:R.bookmark,f1:!a,precondition:a?C.false():C.and(ie.enabled,ie.Modes.agentModeDisabledByPolicy.negate()),category:Si,menu:[{id:ky,when:C.and(ie.enabled,C.equals("view",Dr),a?ie.Modes.agentModeDisabledByPolicy:ie.Modes.agentModeDisabledByPolicy.negate()),order:10,group:"0_level"}]};return a?{...i,tooltip:d(7427,null)}:i}var EMi=class extends W0e{constructor(){super(YIo(!1))}},TMi=class extends W0e{constructor(){super(YIo(!0))}};function XIo(){W(EMi),W(TMi),W(xMi),W(kMi)}var JIo=C.and(ie.enabled,Wo.HasResource,Wo.LangId.isEqualTo(cT)),MMi=858,ZIo="workbench.action.chat.run.prompt.current",Dsn="workbench.action.chat.run.prompt",PMi="workbench.action.chat.configure.prompts",LGt=class extends K{constructor(i){super({id:i.id,title:i.title,f1:!1,precondition:ie.enabled,category:Si,icon:i.icon,keybinding:{when:C.and(pe.editorTextFocus,JIo),weight:200,primary:i.keybinding},menu:[{id:D.EditorTitleRun,group:"navigation",order:i.alt?0:1,alt:i.alt,when:JIo}]})}async execute(i,e,t){let o=t.get(ge),n=t.get(Or),r=t.get(Pt);i||=Lsn(t),CXt(i,"Cannot find URI resource for an active text editor."),e===!0&&await o.executeCommand(Zm);let s=await r.revealWidget();return s&&(s.setInput(`/${await n.getPromptSlashCommandName(i,Se.None)}`),await s.acceptInput()),s}},eyo=L(7553,"Run Prompt in Current Chat"),tyo=R.playCircle,_Mi=class extends LGt{constructor(){super({id:ZIo,title:eyo,icon:tyo,keybinding:MMi})}async run(i,e){return await super.execute(e,!1,i)}},DMi=class extends K{constructor(){super({id:Dsn,title:L(7554,"Run Prompt..."),icon:R.bookmark,f1:!0,precondition:ie.enabled,keybinding:{when:ie.enabled,weight:200,primary:MMi},category:Si})}async run(i){let e=i.get(ge),t=i.get(F),o=i.get(Or),n=i.get(Pt),r=t.createInstance(fN),s=d(7549,null,cR.modifierLabels[Po].ctrlKey),l=await r.selectPromptFile({placeholder:s,type:"prompt"});if(l===void 0)return;let{promptFile:c,keyMods:u}=l;u.ctrlCmd===!0&&await e.executeCommand(Zm);let p=await n.revealWidget();p&&(p.setInput(`/${await o.getPromptSlashCommandName(c,Se.None)}`),await p.acceptInput(),p.focusInput())}},LMi=class extends K{constructor(){super({id:PMi,title:L(7550,"Configure Prompt Files..."),shortTitle:L(7551,"Prompt Files"),icon:R.bookmark,f1:!0,precondition:ie.enabled,category:Si,menu:{id:ky,when:C.and(ie.enabled,C.equals("view",Dr)),order:11,group:"0_level"}})}async run(i){let e=i.get(Je),o=i.get(F).createInstance(fN),n=d(7548,null),r=await o.selectPromptFile({placeholder:n,type:"prompt",optionEdit:!1});r!==void 0&&await e.open(r.promptFile)}};function Lsn(a){let e=a.get(qt).getActiveCodeEditor()?.getModel();if(e?.getLanguageId()===cT)return e.uri}var Rsn="workbench.action.chat.run-in-new-chat.prompt.current",Msn=L(7552,"Run Prompt In New Chat"),Psn=R.play,RMi=class extends LGt{constructor(){super({id:Rsn,title:Msn,icon:Psn,keybinding:MMi|2048,alt:{id:ZIo,title:eyo,icon:tyo}})}async run(i,e){return await super.execute(e,!0,i)}};function iyo(){W(RMi),W(_Mi),W(DMi),W(LMi)}var NMi="workbench.action.chat.configure.skills",AMi=class extends K{constructor(){super({id:NMi,title:L(7562,"Configure Skills..."),shortTitle:L(7563,"Skills"),icon:R.lightbulb,f1:!0,precondition:ie.enabled,category:Si,menu:{id:ky,when:C.and(ie.enabled,C.equals("view",Dr)),order:9,group:"1_level"}})}async run(i){let e=i.get(Je),o=i.get(F).createInstance(fN),n=d(7561,null),r=await o.selectPromptFile({placeholder:n,type:"skill",optionEdit:!1});r!==void 0&&await e.open(r.promptFile)}};function oyo(){W(AMi)}function nyo(a,i){let e=1,t=1;for(let o=0;o<i&&o<a.length;o++)a[o]===`
`?(e++,t=1):t++;return{line:e,column:t}}function Asn(a,i,e,t){let o=OC(a,["hooks",i]);if(!o||o.type!=="array"||!o.children)return;let n=0;for(let r=0;r<o.children.length;r++){if(o.children[r].type!=="object")continue;let l=OC(a,["hooks",i,r,"hooks"]);if(l&&l.type==="array"&&l.children)for(let c=0;c<l.children.length;c++){if(n===e)return OC(a,["hooks",i,r,"hooks",c,t]);n++}else{if(n===e)return OC(a,["hooks",i,r,t]);n++}}}function V0e(a,i,e,t){let o=_R(a);if(!o)return;let n=Asn(o,i,e,t);if(!n||n.type!=="string")return;let r=n.offset+1,s=n.offset+n.length-1,l=nyo(a,r),c=nyo(a,s);return{startLineNumber:l.line,startColumn:l.column,endLineNumber:c.line,endColumn:c.column}}function ryo(a,i){let e=["command","windows","linux","osx","bash","powershell"],t=a.split(`
`);for(let o=0;o<t.length;o++){let n=t[o],r=n.trimStart();if(!e.find(u=>r.startsWith(`${u}:`)||r.startsWith(`- ${u}:`)))continue;let l=n.indexOf(":"),c=n.indexOf(i,l+1);if(c!==-1){let u=c+i.length,p=u<n.length?n.charCodeAt(u):-1;if(p===-1||p===34||p===39||p===32||p===9)return{startLineNumber:o+1,startColumn:c+1,endLineNumber:o+1,endColumn:c+1+i.length}}}}async function syo(a,i,e,t,o,n,r,s){let l=await a.listPromptFiles("hook",r),c=[];for(let u of l)try{let p=await i.readFile(u.uri),h=jr(p.value.toString()),{hooks:g}=Xge(u.uri,h,t,o);for(let[f,{hooks:v,originalId:b}]of g){let S=XC[f];if(S)for(let y=0;y<v.length;y++){let w=v[y],k=N4(w,n)||d(7454,null);c.push({hookType:f,hookTypeLabel:S.label,command:w,commandLabel:k,fileUri:u.uri,filePath:e.getUriLabel(u.uri,{relative:!0}),index:y,originalHookTypeId:b})}}}catch(p){console.error("Failed to read or parse hook file",u.uri.toString(),p)}if(s?.additionalDisabledFileUris)for(let u of s.additionalDisabledFileUris)try{let p=await i.readFile(u),h=jr(p.value.toString()),{hooks:g}=rIo(u,h,t,o);for(let[f,{hooks:v,originalId:b}]of g){let S=XC[f];if(S)for(let y=0;y<v.length;y++){let w=v[y],k=N4(w,n)||d(7454,null);c.push({hookType:f,hookTypeLabel:S.label,command:w,commandLabel:k,fileUri:u,filePath:e.getUriLabel(u,{relative:!0}),index:y,originalHookTypeId:b,disabled:!0})}}}catch(p){console.error("Failed to read or parse disabled hook file",u.toString(),p)}if(s?.includeAgentHooks){let u=await a.getCustomAgents(r);for(let p of u)if(p.hooks)for(let h of Object.values(IA)){let g=p.hooks[h];if(!g||g.length===0)continue;let f=XC[h];if(f)for(let v=0;v<g.length;v++){let b=g[v],S=N4(b,n)||d(7454,null);c.push({hookType:h,hookTypeLabel:f.label,command:b,commandLabel:S,fileUri:p.uri,filePath:e.getUriLabel(p.uri,{relative:!0}),index:v,originalHookTypeId:h,agentName:p.name})}}}return c}var Nsn="workbench.action.chat.configure.hooks";function Osn(a){for(let i of Object.keys(a))if(srt(i)!==void 0)return!0;return!1}function Fsn(a,i){if(i){let e=MRi(a);if(e)return e}return a}async function ayo(a,i,e,t,o,n,r){let s,l=await e.exists(a);if(l){let k=await e.readFile(a);try{s=zT(k.value.toString()),s.hooks||(s.hooks={})}catch{o.error(d(7446,null)),await t.openEditor({resource:a});return}}else s={hooks:{}};let c=Yge(a),u=c==="claude",p=!u&&Osn(s.hooks),h=u?RRi(i)??i:Fsn(i,p),g;for(let k of Object.keys(s.hooks))if((u?LRi(k):srt(k))===i||k===i){g=k;break}let f=g??h,v=PRi(c),b=s.hooks[f],S=Array.isArray(b)?b.length:0,y;if(l){let k=(await e.readFile(a)).value.toString(),P={tabSize:1,insertSpaces:!1,eol:k.includes(`\r
`)?`\r
`:`
`},O=Mb(k,["hooks",f,S],v,P);y=rpe(k,O)}else{let k={hooks:{[f]:[v]}};y=JSON.stringify(k,null,"	")}if(t.editors.find(k=>Qe(k.resource,a))){await t.openEditor({resource:a,options:{pinned:!1}});let k=ha(t.activeTextEditorControl);if(k&&k.hasModel()&&Qe(k.getModel().uri,a)){let T=k.getModel();T.pushEditOperations([],[{range:T.getFullModelRange(),text:y}],()=>null);let P=V0e(y,f,S,"command");P&&P.endLineNumber!==void 0&&P.endColumn!==void 0&&(k.setSelection({startLineNumber:P.startLineNumber,startColumn:P.startColumn,endLineNumber:P.endLineNumber,endColumn:P.endColumn}),k.revealLineInCenter(P.startLineNumber))}else{await n.apply([new nl(a,{range:new z(1,1,Number.MAX_SAFE_INTEGER,1),text:y})],{label:d(7429,null)});let T=V0e(y,f,S,"command");await t.openEditor({resource:a,options:{selection:T,pinned:!1}})}}else{l?(await t.openEditor({resource:a,options:{pinned:!1}}),await n.apply([new nl(a,{range:new z(1,1,Number.MAX_SAFE_INTEGER,1),text:y})],{label:d(7429,null)})):await e.writeFile(a,qe.fromString(y));let k=V0e(y,f,S,"command");r?await r(a,{selection:k}):await t.openEditor({resource:a,options:{selection:k,pinned:!1}})}}function RGt(a,i){return new Promise(e=>{let t=!1,o=r=>{t||(t=!0,n.dispose(),e(r))},n=new N;n.add(a.onDidAccept(()=>{o(a.activeItems[0])})),n.add(a.onDidTriggerButton(r=>{r===i&&o("back")})),n.add(a.onDidHide(()=>{o(void 0)}))})}async function B0e(a,i){let e=a.get(Or),t=a.get(Ue),o=a.get(fe),n=a.get(rt),r=a.get(ee),s=a.get(Pe),l=a.get(An),c=a.get(Ne),u=a.get(La),g=(await a.get(bo).getEnvironment())?.os??Po,v=s.getWorkspace().folders[0]?.uri,b=await l.userHome(),S=b.fsPath??b.path,y=await syo(e,o,n,v,S,g,Se.None,{includeAgentHooks:!0}),w=new Map;for(let he of y)w.set(he.hookType,(w.get(he.hookType)??0)+1);let k=new N,T=k.add(t.createQuickPick({useSeparators:!0})),P=t.backButton;T.show();let O=1,V,H,G,$,J=[],ae=()=>J.pop();try{for(;;)switch(O){case 1:{let he=([Ce,xe])=>{let ze=w.get(Ce)??0,De=ze>0?` (${ze})`:"";return{label:`${xe.label}${De}`,description:xe.description,hookType:Ce,hookTypeMeta:xe}},oe;if(i?.target){let Ce=new Set(Object.values(hg[i.target]));oe=Object.entries(XC).filter(([xe])=>Ce.has(xe)).map(he)}else{let Ce=new Set(Object.values(hg.vscode)),xe=new Set(Object.values(hg["github-copilot"])),ze=Object.entries(XC),De=ze.filter(([et])=>Ce.has(et)&&xe.has(et)),Oe=ze.filter(([et])=>Ce.has(et)&&!xe.has(et)),pt=ze.filter(([et])=>!Ce.has(et)&&xe.has(et));oe=[],De.length>0&&(oe.push({type:"separator",label:d(7452,null)}),oe.push(...De.map(he))),Oe.length>0&&(oe.push({type:"separator",label:d(7453,null)}),oe.push(...Oe.map(he))),pt.length>0&&(oe.push({type:"separator",label:d(7451,null)}),oe.push(...pt.map(he)))}T.items=oe,T.value="",T.placeholder=d(7442,null),T.title=d(7445,null),T.buttons=[];let de=await RGt(T,P);if(!de||de==="back")return;V=de,J.push(1),O=2;break}case 2:{let he=y.filter(xe=>xe.hookType===V.hookType),oe=he.filter(xe=>!xe.agentName),de=he.filter(xe=>xe.agentName),Ce=[];if(Ce.push({label:`$(plus) ${d(7431,null)}`,isAddNewHook:!0,alwaysShow:!0}),oe.length>0){Ce.push({type:"separator",label:d(7450,null)});for(let xe of oe){let ze=n.getUriLabel(xe.fileUri,{relative:!0});Ce.push({label:xe.commandLabel,description:ze,hookEntry:xe})}}if(de.length>0){let xe=[...new Set(de.map(ze=>ze.agentName))];for(let ze of xe){Ce.push({type:"separator",label:d(7430,null,ze)});for(let De of de.filter(Oe=>Oe.agentName===ze)){let Oe=n.getUriLabel(De.fileUri,{relative:!0});Ce.push({label:De.commandLabel,description:Oe,hookEntry:De})}}}if(he.length===0)H=Ce[0];else{T.items=Ce,T.value="",T.placeholder=d(7444,null),T.title=V.hookTypeMeta.label,T.buttons=[P];let xe=await RGt(T,P);if(xe==="back"){O=ae()??1;break}if(!xe)return;H=xe,J.push(2)}if(H.hookEntry){let xe=H.hookEntry,ze;if(xe.agentName)try{let De=await o.readFile(xe.fileUri),Oe=N4(xe.command,g);Oe&&(ze=ryo(De.value.toString(),Oe))}catch{}else{let De=koo(xe.command,g);if(De)try{let Oe=await o.readFile(xe.fileUri);ze=V0e(Oe.value.toString(),xe.originalHookTypeId,xe.index,De)}catch{}}i?.openEditor?await i.openEditor(xe.fileUri,{selection:ze}):await r.openEditor({resource:xe.fileUri,options:{selection:ze,pinned:!1}});return}O=3;break}case 3:{let he=await e.listPromptFilesForStorage("hook","local",Se.None),oe=[];if(oe.push({label:`$(new-file) ${d(7432,null)}`,isCreateNewFile:!0,alwaysShow:!0}),he.length>0){oe.push({type:"separator",label:d(7449,null)});for(let de of he){let Ce=n.getUriLabel(de.uri,{relative:!0});oe.push({label:Ce,fileUri:de.uri})}}if(he.length===0)G=oe[0];else{T.items=oe,T.value="",T.placeholder=d(7443,null),T.title=d(7441,null),T.buttons=[P];let de=await RGt(T,P);if(de==="back"){O=ae()??2;break}if(!de)return;G=de,J.push(3)}if(G.fileUri){await ayo(G.fileUri,V.hookType,o,r,c,u,i?.openEditor);return}O=4;break}case 4:{let oe=(await e.getSourceFolders("hook")).filter(de=>de.storage==="local");if(oe.length===0){c.error(d(7438,null));return}if($=oe[0],oe.length>1){let de=oe.map(xe=>({label:n.getUriLabel(xe.uri,{relative:!0}),folder:xe}));T.items=de,T.value="",T.placeholder=d(7439,null),T.title=d(7440,null),T.buttons=[P];let Ce=await RGt(T,P);if(Ce==="back"){O=ae()??3;break}if(!Ce)return;$=Ce.folder,J.push(4)}O=5;break}case 5:{T.hide();let he=await new Promise(zi=>{let Vo=!1,sn=hn=>{Vo||(Vo=!0,_n.dispose(),zi(hn))},_n=new N,mn=_n.add(t.createInputBox());mn.prompt=d(7435,null),mn.placeholder=d(7434,null),mn.title=d(7437,null),mn.buttons=[P],mn.ignoreFocusOut=!0,_n.add(mn.onDidAccept(async()=>{let hn=mn.value;if(!hn||!hn.trim()){mn.validationMessage=d(7436,null);return}let yo=hn.trim();if(/[/\\:*?"<>|]/.test(yo)){mn.validationMessage=d(7433,null);return}sn(yo)})),_n.add(mn.onDidChangeValue(()=>{mn.validationMessage=void 0})),_n.add(mn.onDidTriggerButton(hn=>{hn===P&&sn("back")})),_n.add(mn.onDidHide(()=>{sn(void 0)})),mn.show()});if(he==="back"){T.show(),O=ae()??4;break}if(!he)return;await o.createFolder($.uri);let oe=he.endsWith(".json")?he:`${he}.json`,de=A.joinPath($.uri,oe);if(await o.exists(de)){await ayo(de,V.hookType,o,r,c,u,i?.openEditor);return}let Ce=Yge(de),xe=Ce==="claude",ze=!xe&&!new Set(Object.values(hg.vscode)).has(V.hookType)&&new Set(Object.values(hg["github-copilot"])).has(V.hookType),De=xe?RRi(V.hookType)??V.hookType:ze?MRi(V.hookType)??V.hookType:V.hookType,Oe=ze?{type:"command",[g===1?"powershell":"bash"]:""}:PRi(Ce),pt=ze?g===1?"powershell":"bash":"command",et={...ze?{version:1}:{},hooks:{[De]:[Oe]}},Ti=JSON.stringify(et,null,"	");await o.writeFile(de,qe.fromString(Ti)),i?.onHookFileCreated?.(de);let Ht=V0e(Ti,De,0,pt);i?.openEditor?await i.openEditor(de,{selection:Ht}):await r.openEditor({resource:de,options:{selection:Ht,pinned:!1}});return}}}finally{k.dispose()}}var OMi=class extends K{constructor(){super({id:Nsn,title:L(7447,"Configure Hooks..."),shortTitle:L(7448,"Hooks"),icon:R.zap,f1:!0,precondition:ie.enabled,category:Si,menu:{id:ky,when:C.and(ie.enabled,C.equals("view",Dr)),order:12,group:"1_level"}})}async run(i){return B0e(i)}};function lyo(){W(OMi)}var Drt=class extends K{constructor(e,t){super(e);this.promptType=t}async run(e,t){let o=e.get(F),n=e.get(qt),r=e.get(Uo),s=e.get(fe),l=n.getActiveCodeEditor();if(!l)return;let c=l.getModel();if(!c)return;let u=await o.invokeFunction(wQ,this.promptType,void 0,!0);if(!u)return;let p=await o.invokeFunction(poe,this.promptType,u.uri,wf(c.uri));if(!p)return;let h=Ge(u.uri,p);c.uri.scheme===Q.untitled?await r.saveAs(c.uri,h,{from:c.uri}):await s.copy(c.uri,h),await n.openCodeEditor({resource:h},l)}};function FMi(a,i,e,t){return{id:a,title:i,metadata:{description:e},category:Si,f1:!1,menu:{id:D.EditorContent,when:C.and(C.equals(Wo.Scheme.key,Q.untitled),C.equals(Wo.LangId.key,t),C.notEquals(jK.key,0))}}}var Wsn="workbench.action.chat.save-as-prompt",MGt=class extends Drt{constructor(){super(FMi(Wsn,L(7559,"Save As Prompt File"),L(7560,"Save as prompt file"),cT),"prompt")}},Vsn="workbench.action.chat.save-as-agent",PGt=class extends Drt{constructor(){super(FMi(Vsn,L(7555,"Save As Agent File"),L(7556,"Save as agent file"),B6e),"agent")}},Bsn="workbench.action.chat.save-as-instructions",AGt=class extends Drt{constructor(){super(FMi(Bsn,L(7557,"Save As Instructions File"),L(7558,"Save as instructions file"),V6e),"instructions")}};function cyo(){iyo(),OIo(),oyo(),lyo(),W(MGt),W(AGt),W(PGt),XIo(),MIo()}function Lrt(a){switch(a){case 1:return"file";case 2:return"workspace";case 3:return"exe"}}var moe=le("IExtensionRecommendationNotificationService");var Oy=le("pluginInstallService");var oq=class a{constructor(i,e){this.value=i;this.sortBy=e;this.value=i.trim()}static suggestions(i,e){let t=["installed","updates","enabled","disabled","builtin","contribute"];e?.capabilities.extensionQuery?.filtering?.some(p=>p.name==="Featured")&&t.push("featured"),t.push("mcp","agentPlugins","popular","recommended","recentlyPublished","workspaceUnsupported","deprecated","sort");let o=e?.capabilities.extensionQuery?.filtering?.some(p=>p.name==="Category");o&&t.push("category"),t.push("tag","ext","id","outdated","recentlyUpdated","restartRequired");let n=[];e?.capabilities.extensionQuery?.sorting?.some(p=>p.name==="InstallCount")&&n.push("installs"),e?.capabilities.extensionQuery?.sorting?.some(p=>p.name==="WeightedRating")&&n.push("rating"),n.push("name","publishedDate","updateDate");let r=[];for(let p of ne.as(As.ExtensionFeaturesRegistry).getExtensionFeatures())r.push(p.id);let s={sort:n,category:o?cF.map(p=>`"${p.toLowerCase()}"`):[],tag:[""],ext:[""],id:[""],contribute:r},l=p=>i.indexOf(p)>-1,c=s.sort.some(p=>l(`@sort:${p}`)),u=s.category.some(p=>l(`@category:${p}`));return t.flatMap(p=>c&&p==="sort"||u&&p==="category"?[]:p in s?s[p].map(h=>`@${p}:${h}${h===""?"":" "}`):l(`@${p}`)?[]:[`@${p} `])}static parse(i){let e="";return i=i.replace(/@sort:(\w+)(-\w*)?/g,(t,o,n)=>(e=o,"")),new a(i,e)}toString(){let i=this.value;return this.sortBy&&(i=`${i}${i?" ":""}@sort:${this.sortBy}`),i}isValid(){return!/@outdated/.test(this.value)}equals(i){return this.value===i.value&&this.sortBy===i.sortBy}};var Hsn=Ae("extensions-editor-label-icon",R.extensions,d(10705,null)),nq=class a extends ls{constructor(e){super();this._extension=e}static{this.ID="workbench.extensions.input2"}get typeId(){return a.ID}get capabilities(){return 10}get resource(){return A.from({scheme:Q.extension,path:Yc(this._extension.identifier.id,"extension")})}get extension(){return this._extension}getName(){return d(10706,null,this._extension.displayName)}getIcon(){return Hsn}matches(e){return super.matches(e)?!0:e instanceof a&&Ut(this._extension.identifier,e._extension.identifier)}};var Usn="vscode_searchExtensions_internal",WMi={id:Usn,toolReferenceName:"extensions",legacyToolReferenceFullNames:["extensions"],icon:q.fromId(R.extensions.id),displayName:d(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:d(10715,null),source:kn.Internal,inputSchema:{type:"object",properties:{category:{type:"string",description:"The category of extensions to search for",enum:cF},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"}}}},H0e=class{constructor(i){this.extensionWorkbenchService=i}async invoke(i,e,t,o){let n=i.parameters;if(!n.keywords?.length&&!n.category&&!n.ids?.length)return{content:[{kind:"text",value:d(10714,null)}]};let r=new Map,s=u=>{for(let p of u)p.deprecationInfo||p.isMalicious||r.set(p.identifier.id.toLowerCase(),{id:p.identifier.id,name:p.displayName,description:p.description,installed:p.state===1,installCount:p.installCount??0,rating:p.rating??0,categories:p.categories??[],tags:p.gallery?.tags??[]})},l=async u=>{let p=await this.extensionWorkbenchService.queryGallery({text:u,pageSize:10,sortBy:"InstallCount"},o);p.firstPage.length&&s(p.firstPage)};if(n.ids?.length){let u=await this.extensionWorkbenchService.getExtensions(n.ids.map(p=>({id:p})),o);s(u)}if(n.keywords?.length)for(let u of n.keywords??[])if(u==="featured")await l("featured");else{let p=n.category?`category:"${n.category}"`:"";p=u?`${p} ${u}`.trim():p,await l(p)}else await l(`category:"${n.category}"`);let c=Array.from(r.values());return{content:[{kind:"text",value:`Here are the list of extensions:
${JSON.stringify(c)}
. 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(n),output:[{type:"embed",isText:!0,value:JSON.stringify(c.map(u=>u.id))}]}}}};H0e=I([m(0,Hi)],H0e);var hoe=class{constructor(i){this.affinity=i;this.kind=1}equals(i){return this.kind===i.kind&&this.affinity===i.affinity}asString(){return this.affinity===0?"LocalProcess":`LocalProcess${this.affinity}`}},rq=class{constructor(i){this.affinity=i;this.kind=2}equals(i){return this.kind===i.kind&&this.affinity===i.affinity}asString(){return this.affinity===0?"LocalWebWorker":`LocalWebWorker${this.affinity}`}},goe=class{constructor(){this.kind=3;this.affinity=0}equals(i){return this.kind===i.kind}asString(){return"Remote"}};var zsn=Ae("runtime-extensions-editor-label-icon",R.extensions,d(10712,null)),DW=class a extends ls{constructor(){super(...arguments);this.resource=A.from({scheme:"runtime-extensions",path:"default"})}static{this.ID="workbench.runtimeExtensions.input"}get typeId(){return a.ID}get capabilities(){return 10}static get instance(){return(!a._instance||a._instance.isDisposed())&&(a._instance=new a),a._instance}getName(){return d(10711,null)}getIcon(){return zsn}matches(e){return super.matches(e)?!0:e instanceof a}};var foe=class extends Ts{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super(foe.ID,e,t,o,p);this.contextKeyService=n;this._extensionsWorkbenchService=r;this._extensionService=s;this._notificationService=l;this._contextMenuService=c;this._instantiationService=u;this._labelService=h;this._environmentService=g;this._clipboardService=f;this._extensionFeaturesManagementService=v;this._hoverService=b;this._menuService=S;this._list=null,this._elements=null,this._updateSoon=this._register(new Dt(()=>this._updateExtensions(),200)),this._register(this._extensionService.onDidChangeExtensionsStatus(()=>this._updateSoon.schedule())),this._register(this._extensionFeaturesManagementService.onDidChangeAccessData(()=>this._updateSoon.schedule())),this._updateExtensions()}static{this.ID="workbench.editor.runtimeExtensions"}async _updateExtensions(){this._elements=await this._resolveExtensions(),this._list?.splice(0,this._list.length,this._elements)}async _resolveExtensions(){await this._extensionService.whenInstalledExtensionsRegistered();let e=this._extensionService.extensions.filter(h=>!!h.main||!!h.browser),t=new iu,o=await this._extensionsWorkbenchService.queryLocal();for(let h of o)t.set(h.identifier.id,h);let n=this._extensionService.getExtensionsStatus(),r=new iu,s=this._getProfileInfo();if(s){let h=s.startTime;for(let g=0,f=s.deltas.length;g<f;g++){let v=s.ids[g],b=s.deltas[g],S=r.get(v);S||(S=[],r.set(v,S)),S.push(h),h=h+b,S.push(h)}}let l=[];for(let h=0,g=e.length;h<g;h++){let f=e[h],v=null;if(s){let b=r.get(f.identifier)||[],S=0;for(let y=0,w=b.length/2;y<w;y++){let k=b[2*y],T=b[2*y+1];S+=T-k}v={segments:b,totalTime:S}}l[h]={originalIndex:h,description:f,marketplaceInfo:t.get(f.identifier),status:n[f.identifier.value],profileInfo:v||void 0,unresponsiveProfile:this._getUnresponsiveProfile(f.identifier)}}l=l.filter(h=>h.status.activationStarted);let c=h=>h.unresponsiveProfile===s,u=h=>h.profileInfo?.totalTime??0,p=h=>(h.status.activationTimes?.codeLoadingTime??0)+(h.status.activationTimes?.activateCallTime??0);return l=l.sort((h,g)=>c(h)||c(g)?+c(g)-+c(h):u(h)||u(g)?u(g)-u(h):p(h)||p(g)?p(g)-p(h):h.originalIndex-g.originalIndex),l}createEditor(e){e.classList.add("runtime-extensions-editor");let t="runtimeExtensionElementTemplate",o=new class{getHeight(r){return 70}getTemplateId(r){return t}},n={templateId:t,renderTemplate:r=>{let s=M(r,_(".extension")),l=M(s,_(".icon-container")),c=this._instantiationService.createInstance(NG,l),u=M(s,_("div.desc")),p=M(u,_(".header-container")),h=M(p,_(".header")),g=M(h,_("div.name")),f=M(h,_("span.version")),v=M(u,_("div.msg")),b=new Zi(u),S=b.onDidRun(({error:P})=>P&&this._notificationService.error(P)),y=M(s,_(".time")),w=M(y,_("div.activation-time")),k=M(y,_("div.profile-time"));return{root:r,element:s,name:g,version:f,actionbar:b,activationTime:w,profileTime:k,msgContainer:v,set extension(P){c.extension=P||null},disposables:[c,b,S],elementDisposables:[]}},renderElement:(r,s,l)=>{l.elementDisposables=Be(l.elementDisposables),l.extension=r.marketplaceInfo,l.root.classList.toggle("odd",s%2===1),l.name.textContent=(r.marketplaceInfo?.displayName||r.description.identifier.value).substr(0,50),l.version.textContent=r.description.version;let c=r.status.activationTimes;if(c){let f=c.codeLoadingTime+c.activateCallTime;l.activationTime.textContent=c.activationReason.startup?`Startup Activation: ${f}ms`:`Activation: ${f}ms`}else l.activationTime.textContent="Activating...";l.actionbar.clear();let u=this._createSlowExtensionAction(r);if(u&&l.actionbar.push(u,{icon:!1,label:!0}),yr(r.status.runtimeErrors)){let f=this._createReportExtensionIssueAction(r);f&&l.actionbar.push(f,{icon:!1,label:!0})}let p;if(c){let f=c.activationReason.extensionId.value,v=c.activationReason.activationEvent;if(v==="*")p=d(10097,null,f);else if(/^workspaceContains:/.test(v)){let b=v.substr(18);b.indexOf("*")>=0||b.indexOf("?")>=0?p=d(10101,null,b,f):p=d(10100,null,b,f)}else if(/^workspaceContainsTimeout:/.test(v)){let b=v.substr(25);p=d(10102,null,b,f)}else if(v==="onStartupFinished")p=d(10098,null,f);else if(/^onLanguage:/.test(v)){let b=v.substr(11);p=d(10091,null,b,f)}else p=d(10103,null,v,f)}else p=d(10090,null);if(l.elementDisposables.push(this._hoverService.setupManagedHover(Ri("mouse"),l.activationTime,p)),Rt(l.msgContainer),this._getUnresponsiveProfile(r.description.identifier)){let f=_("span",void 0,...Un(" $(alert) Unresponsive")),v=d(10099,null);l.elementDisposables.push(this._hoverService.setupManagedHover(Ri("mouse"),f,v)),l.msgContainer.appendChild(f)}if(yr(r.status.runtimeErrors)){let f=_("span",void 0,...Un(`$(bug) ${d(10089,null,r.status.runtimeErrors.length)}`));l.msgContainer.appendChild(f)}if(r.status.messages&&r.status.messages.length>0){let f=_("span",void 0,...Un(`$(alert) ${r.status.messages[0].message}`));l.msgContainer.appendChild(f)}let h=null;if(r.status.runningLocation&&r.status.runningLocation.equals(new rq(0)))h="$(globe) web worker";else if(r.description.extensionLocation.scheme===Q.vscodeRemote){let f=this._labelService.getHostLabel(Q.vscodeRemote,this._environmentService.remoteAuthority);f?h=`$(remote) ${f}`:h=`$(remote) ${r.description.extensionLocation.authority}`}else r.status.runningLocation&&r.status.runningLocation.affinity>0&&(h=r.status.runningLocation instanceof rq?`$(globe) web worker ${r.status.runningLocation.affinity+1}`:`$(server-process) local process ${r.status.runningLocation.affinity+1}`);if(h){let f=_("span",void 0,...Un(h));l.msgContainer.appendChild(f)}let g=ne.as(As.ExtensionFeaturesRegistry).getExtensionFeatures();for(let f of g){let v=this._extensionFeaturesManagementService.getAccessData(r.description.identifier,f.id);if(v){let b=v?.current?.status;if(b&&(l.msgContainer.appendChild(_("span",void 0,`${f.label}: `)),l.msgContainer.appendChild(_("span",void 0,...Un(`$(${b.severity===ft.Error?OS.id:Gu.id}) ${b.message}`)))),v?.accessTimes.length>0){let S=_("span",void 0,`${d(10092,null,f.label,v.accessTimes.length)}${v.current?d(10095,null,v.current.accessTimes.length):""}`);if(v.current){let y=d(10093,null,ea(v.current.lastAccessed,!0,!0));l.elementDisposables.push(this._hoverService.setupManagedHover(Ri("mouse"),S,y))}l.msgContainer.appendChild(S)}}}r.profileInfo?l.profileTime.textContent=`Profile: ${(r.profileInfo.totalTime/1e3).toFixed(2)}ms`:l.profileTime.textContent=""},disposeTemplate:r=>{r.disposables=Be(r.disposables)}};this._list=this._instantiationService.createInstance(Vl,"RuntimeExtensions",e,o,[n],{multipleSelectionSupport:!1,setRowLineHeight:!1,horizontalScrolling:!1,overrideStyles:{listBackground:Ho},accessibilityProvider:new class{getWidgetAriaLabel(){return d(10094,null)}getAriaLabel(r){return r.description.name}}}),this._list.splice(0,this._list.length,this._elements||void 0),this._register(this._list.onContextMenu(r=>{if(!r.element)return;let s=[];s.push(new it("runtimeExtensionsEditor.action.copyId",d(10086,null,r.element.description.identifier.value),void 0,!0,()=>{this._clipboardService.writeText(r.element.description.identifier.value)}));let l=this._createReportExtensionIssueAction(r.element);l&&s.push(l),s.push(new ri),r.element.marketplaceInfo&&(s.push(new it("runtimeExtensionsEditor.action.disableWorkspace",d(10088,null),void 0,!0,()=>this._extensionsWorkbenchService.setEnablement(r.element.marketplaceInfo,11))),s.push(new it("runtimeExtensionsEditor.action.disable",d(10087,null),void 0,!0,()=>this._extensionsWorkbenchService.setEnablement(r.element.marketplaceInfo,10)))),s.push(new ri);let c=this._menuService.getMenuActions(D.ExtensionEditorContextMenu,this.contextKeyService);s.push(...zp(c).secondary),this._contextMenuService.showContextMenu({getAnchor:()=>r.anchor,getActions:()=>s})}))}layout(e){this._list?.layout(e.height)}};foe=I([m(1,Te),m(2,Le),m(3,X),m(4,Hi),m(5,lt),m(6,Ne),m(7,Xe),m(8,F),m(9,ce),m(10,rt),m(11,At),m(12,Fi),m(13,cy),m(14,nt),m(15,Kt)],foe);var NGt=class extends K{constructor(){super({id:"workbench.action.showRuntimeExtensions",title:L(10096,"Show Running Extensions"),category:Ve.Developer,f1:!0,menu:{id:D.ViewContainerTitle,when:C.equals("viewContainer","workbench.view.extensions"),group:"2_enablement",order:3}})}async run(i){await i.get(ee).openEditor(DW.instance,{pinned:!0})}};var U0e=class extends x{constructor(e,t,o,n){super();this.extensionService=e;this.hoverService=t;this.extensionFeaturesManagementService=o;this.markdownRendererService=n;this.type="element"}static{this.ID="runtimeStatus"}shouldRender(e){let t=new Ii(gS(e.publisher,e.name));return this.extensionService.extensions.some(o=>Ii.equals(o.identifier,t))?!!e.main||!!e.browser:!1}render(e){let t=new N,o=new Ii(gS(e.publisher,e.name)),n=t.add(new E);return t.add(this.extensionService.onDidChangeExtensionsStatus(r=>{r.some(s=>Ii.equals(s,o))&&n.fire(this.createElement(e,t))})),t.add(this.extensionFeaturesManagementService.onDidChangeAccessData(r=>n.fire(this.createElement(e,t)))),{onDidChange:n.event,data:this.createElement(e,t),dispose:()=>t.dispose()}}createElement(e,t){let o=_(".runtime-status"),n=new Ii(gS(e.publisher,e.name)),r=this.extensionService.getExtensionsStatus()[n.value];if(this.extensionService.extensions.some(l=>Ii.equals(l.identifier,n))){let l=new Ie;l.appendMarkdown(`### ${d(10151,null)}

`),r.activationTimes?r.activationTimes.activationReason.startup?l.appendMarkdown(`Activated on Startup: \`${r.activationTimes.activateCallTime}ms\``):l.appendMarkdown(`Activated by \`${r.activationTimes.activationReason.activationEvent}\` event: \`${r.activationTimes.activateCallTime}ms\``):l.appendMarkdown("Not yet activated"),this.renderMarkdown(l,o,t)}let s=ne.as(As.ExtensionFeaturesRegistry).getExtensionFeatures();for(let l of s){let c=this.extensionFeaturesManagementService.getAccessData(n,l.id);if(c){if(this.renderMarkdown(new Ie(`
 ### ${d(10159,null,l.label)}

`),o,t),c.accessTimes.length){let p=M(o,_(".feature-chart-description",void 0,d(10153,null,c?.accessTimes.length,l.accessDataLabel??l.label)));p.style.marginBottom="8px",this.renderRequestsChart(o,c.accessTimes,t)}let u=c?.current?.status;if(u){let p=new Ie;u?.severity===bt.Error&&p.appendMarkdown(`$(${OS.id}) ${u.message}

`),u?.severity===bt.Warning&&p.appendMarkdown(`$(${Gu.id}) ${u.message}

`),p.value&&this.renderMarkdown(p,o,t)}}}if(r.runtimeErrors.length||r.messages.length){let l=new Ie;if(r.runtimeErrors.length){l.appendMarkdown(`
 ### ${d(10165,null,r.runtimeErrors.length)}
`);for(let c of r.runtimeErrors)l.appendMarkdown(`$(${R.error.id})&nbsp;${Pn(c)}

`)}if(r.messages.length){l.appendMarkdown(`
 ### ${d(10160,null,r.messages.length)}
`);for(let c of r.messages)l.appendMarkdown(`$(${(c.type===bt.Error?R.error:c.type===bt.Warning?R.warning:R.info).id})&nbsp;${c.message}

`)}l.value&&this.renderMarkdown(l,o,t)}return o}renderMarkdown(e,t,o){let{element:n}=o.add(this.markdownRendererService.render({value:e.value,isTrusted:e.isTrusted,supportThemeIcons:!0}));M(t,n)}renderRequestsChart(e,t,o){let s={top:0,right:4,bottom:20,left:4},l=450-s.left-s.right,c=250-s.top-s.bottom,u=M(e,_(".feature-chart-container"));u.style.position="relative";let p=M(u,_(".feature-chart-tooltip"));p.style.position="absolute",p.style.width="0px",p.style.height="0px";let h=100,g=new Map;for(let H of t){let G=`${H.getDate()} ${H.toLocaleString("default",{month:"short"})}`;g.set(G,(g.get(G)??0)+1),h=Math.max(h,g.get(G))}let f=new Date,v=[];for(let H=0;H<=30;H++){let G=new Date(f);G.setDate(f.getDate()-(30-H));let $=`${G.getDate()} ${G.toLocaleString("default",{month:"short"})}`,J=g.get($)??0,ae=H/30*l,he=c-J/h*c;v.push({x:ae,y:he,date:$,count:J})}let b=M(u,_(".feature-chart")),S=M(b,_.SVG("svg"));S.setAttribute("width","450px"),S.setAttribute("height","250px"),S.setAttribute("viewBox","0 0 450 250");let y=_.SVG("g");y.setAttribute("transform",`translate(${s.left},${s.top})`),S.appendChild(y);let w=_.SVG("line");w.setAttribute("x1","0"),w.setAttribute("y1",`${c}`),w.setAttribute("x2",`${l}`),w.setAttribute("y2",`${c}`),w.setAttribute("stroke",kt(Cti)),w.setAttribute("stroke-width","1px"),y.appendChild(w);for(let H=1;H<=30;H+=7){let G=new Date(f);G.setDate(f.getDate()-(30-H));let $=`${G.getDate()} ${G.toLocaleString("default",{month:"short"})}`,J=H/30*l,ae=_.SVG("line");ae.setAttribute("x1",`${J}`),ae.setAttribute("y1",`${c}`),ae.setAttribute("x2",`${J}`),ae.setAttribute("y2",`${c+10}`),ae.setAttribute("stroke",kt(Cti)),ae.setAttribute("stroke-width","1px"),y.appendChild(ae);let he=_.SVG("line");he.setAttribute("x1",`${J}`),he.setAttribute("y1","0"),he.setAttribute("x2",`${J}`),he.setAttribute("y2",`${c}`),he.setAttribute("stroke",kt(f5i)),he.setAttribute("stroke-width","1px"),y.appendChild(he);let oe=_.SVG("text");oe.setAttribute("x",`${J}`),oe.setAttribute("y","250"),oe.setAttribute("text-anchor","middle"),oe.setAttribute("fill",kt(To)),oe.setAttribute("font-size","10px"),oe.textContent=$,y.appendChild(oe)}let k=_.SVG("polyline");k.setAttribute("fill","none"),k.setAttribute("stroke",kt(g5i)),k.setAttribute("stroke-width","2px"),k.setAttribute("points",v.map(H=>`${H.x},${H.y}`).join(" ")),y.appendChild(k);let T=_.SVG("circle");T.setAttribute("r","4px"),T.style.display="none",y.appendChild(T);let P=o.add(new me),O=H=>{let G=S.getBoundingClientRect(),$=H.clientX-G.left-s.left,J,ae=1/0;v.forEach(he=>{let oe=Math.abs(he.x-$);oe<ae&&(ae=oe,J=he)}),J?(T.setAttribute("cx",`${J.x}`),T.setAttribute("cy",`${J.y}`),T.style.display="block",p.style.left=`${J.x+24}px`,p.style.top=`${J.y+14}px`,P.value=this.hoverService.showInstantHover({content:new Ie(`${J.date}: ${J.count} requests`),target:p,appearance:{showPointer:!0,skipFadeInAnimation:!0}})):P.value=void 0};o.add(j(S,re.MOUSE_MOVE,O));let V=()=>{T.style.display="none",P.value=void 0};o.add(j(S,re.MOUSE_LEAVE,V))}};U0e=I([m(0,lt),m(1,nt),m(2,cy),m(3,On)],U0e);var VMi={id:U0e.ID,label:d(10164,null),access:{canToggle:!1},renderer:new Ft(U0e)},z0e=class extends yu{constructor(e,t,o,n){super(o);this.manifest=e;this.feature=t;this.instantiationService=n;this.featureView=this._register(new me);this.layoutParticipants=[];this.extensionId=new Ii(gS(e.publisher,e.name)),this.domNode=_("div.subcontent.feature-contributions"),this.create()}layout(e,t){this.layoutParticipants.forEach(o=>o.layout(e,t))}create(){let e=this.getFeatures();if(e.length===0){M(_(".no-features"),this.domNode).textContent=d(10161,null);return}let t=this._register(new Ou(this.domNode,{orientation:1,proportionalLayout:!0}));this.layoutParticipants.push({layout:(l,c)=>{t.el.style.height=`${l-14}px`,t.layout(c)}});let o=_(".features-list-container"),n=this._register(this.createFeaturesList(o));n.splice(0,n.length,e);let r=_(".feature-view-container");this._register(n.onDidChangeSelection(l=>{let c=l.elements[0];c&&this.showFeatureView(c,r)}));let s=this.feature?e.findIndex(l=>l.id===this.feature):0;n.setSelection([s===-1?0:s]),t.addView({onDidChange:U.None,element:o,minimumSize:100,maximumSize:Number.POSITIVE_INFINITY,layout:(l,c,u)=>{o.style.width=`${l}px`,n.layout(u,l)}},200,void 0,!0),t.addView({onDidChange:U.None,element:r,minimumSize:500,maximumSize:Number.POSITIVE_INFINITY,layout:(l,c,u)=>{r.style.width=`${l}px`,this.featureViewDimension={height:u,width:l},this.layoutFeatureView()}},Gl.Distribute,void 0,!0),t.style({separatorBorder:this.theme.getColor(dDt)})}createFeaturesList(e){let t=this.instantiationService.createInstance(Rrt,this.extensionId),o=new BMi;return this.instantiationService.createInstance(Vl,"ExtensionFeaturesList",M(e,_(".features-list-wrapper")),o,[t],{multipleSelectionSupport:!1,setRowLineHeight:!1,horizontalScrolling:!1,accessibilityProvider:{getAriaLabel(r){return r?.label??""},getWidgetAriaLabel(){return d(10157,null)}},openOnSingleClick:!0})}layoutFeatureView(){this.featureView.value?.layout(this.featureViewDimension?.height,this.featureViewDimension?.width)}showFeatureView(e,t){this.featureView.value?.feature.id!==e.id&&(Rt(t),this.featureView.value=this.instantiationService.createInstance(Mrt,this.extensionId,this.manifest,e),t.appendChild(this.featureView.value.domNode),this.layoutFeatureView())}getFeatures(){let e=ne.as(As.ExtensionFeaturesRegistry).getExtensionFeatures().filter(o=>{let n=this.getRenderer(o),r=n?.shouldRender(this.manifest);return n?.dispose(),r}).sort((o,n)=>o.label.localeCompare(n.label)),t=this.getRenderer(VMi);return t?.shouldRender(this.manifest)&&e.splice(0,0,VMi),t?.dispose(),e}getRenderer(e){return e.renderer?this.instantiationService.createInstance(e.renderer):void 0}};z0e=I([m(2,Le),m(3,F)],z0e);var BMi=class{getHeight(){return 22}getTemplateId(){return"extensionFeatureDescriptor"}},Rrt=class{constructor(i,e){this.extensionId=i;this.extensionFeaturesManagementService=e;this.templateId="extensionFeatureDescriptor"}renderTemplate(i){i.classList.add("extension-feature-list-item");let e=M(i,_(".extension-feature-label")),t=M(i,_(".extension-feature-disabled-label"));t.textContent=d(10163,null);let o=M(i,_(".extension-feature-status"));return{label:e,disabledElement:t,statusElement:o,disposables:new N}}renderElement(i,e,t){t.disposables.clear(),t.label.textContent=i.label,t.disabledElement.style.display=i.id===VMi.id||this.extensionFeaturesManagementService.isEnabled(this.extensionId,i.id)?"none":"inherit",t.disposables.add(this.extensionFeaturesManagementService.onDidChangeEnablement(({extension:r,featureId:s,enabled:l})=>{Ii.equals(r,this.extensionId)&&s===i.id&&(t.disabledElement.style.display=l?"none":"inherit")}));let o=t.statusElement.className,n=()=>{let r=this.extensionFeaturesManagementService.getAccessData(this.extensionId,i.id);r?.current?.status?(t.statusElement.style.display="inherit",t.statusElement.className=`${o} ${sk.className(r.current.status.severity)}`):t.statusElement.style.display="none"};n(),t.disposables.add(this.extensionFeaturesManagementService.onDidChangeAccessData(({extension:r,featureId:s})=>{Ii.equals(r,this.extensionId)&&s===i.id&&n()}))}disposeElement(i,e,t){t.disposables.dispose()}disposeTemplate(i){i.disposables.dispose()}};Rrt=I([m(1,cy)],Rrt);var Mrt=class extends x{constructor(e,t,o,n,r,s,l){super();this.extensionId=e;this.manifest=t;this.feature=o;this.instantiationService=n;this.extensionFeaturesManagementService=r;this.dialogService=s;this.markdownRendererService=l;this.layoutParticipants=[];this.domNode=_(".extension-feature-content"),this.create(this.domNode)}create(e){let t=M(e,_(".feature-header")),o=M(t,_(".feature-title"));if(o.textContent=this.feature.label,this.feature.access.canToggle){let u=M(t,_(".feature-actions")),p=new Wi(u,Qo);this.updateButtonLabel(p),this._register(this.extensionFeaturesManagementService.onDidChangeEnablement(({extension:h,featureId:g})=>{Ii.equals(h,this.extensionId)&&g===this.feature.id&&this.updateButtonLabel(p)})),this._register(p.onDidClick(async()=>{let h=this.extensionFeaturesManagementService.isEnabled(this.extensionId,this.feature.id);(await this.dialogService.confirm({title:d(10150,null,this.feature.label),message:h?d(10154,null,this.manifest.displayName??this.extensionId.value,this.feature.label):d(10156,null,this.manifest.displayName??this.extensionId.value,this.feature.label),custom:!0,primaryButton:h?d(10162,null):d(10158,null),cancelButton:d(10152,null)})).confirmed&&this.extensionFeaturesManagementService.setEnablement(this.extensionId,this.feature.id,!h)}))}let n=M(e,_(".feature-body")),r=_(".feature-body-content"),s=this._register(new ms(r,{}));if(M(n,s.getDomNode()),this.layoutParticipants.push({layout:()=>s.scanDomNode()}),s.scanDomNode(),this.feature.description){let u=M(r,_(".feature-description"));u.textContent=this.feature.description}let l=this.extensionFeaturesManagementService.getAccessData(this.extensionId,this.feature.id);l?.current?.status&&M(r,_(".feature-status",void 0,_(`span${q.asCSSSelector(l.current.status.severity===bt.Error?OS:l.current.status.severity===bt.Warning?Gu:Ug)}`,void 0),_("span",void 0,l.current.status.message)));let c=M(r,_(".feature-content"));if(this.feature.renderer){let u=this.instantiationService.createInstance(this.feature.renderer);u.type==="table"?this.renderTableData(c,u):u.type==="markdown"?this.renderMarkdownData(c,u):u.type==="markdown+table"?this.renderMarkdownAndTableData(c,u):u.type==="element"&&this.renderElementData(c,u)}}updateButtonLabel(e){e.label=this.extensionFeaturesManagementService.isEnabled(this.extensionId,this.feature.id)?d(10162,null):d(10155,null)}renderTableData(e,t){let o=this._register(t.render(this.manifest)),n=this._register(new me);o.onDidChange&&this._register(o.onDidChange(r=>{Rt(e),n.value=this.renderTable(r,e)})),n.value=this.renderTable(o.data,e)}renderTable(e,t){let o=new N;return M(t,_("table",void 0,_("tr",void 0,...e.headers.map(n=>_("th",void 0,n))),...e.rows.map(n=>_("tr",void 0,...n.map(r=>{if(typeof r=="string")return _("td",void 0,_("p",void 0,r));let s=Array.isArray(r)?r:[r];return _("td",void 0,...s.map(l=>{let c=[];if(Ar(r)){let u=_("",void 0);this.renderMarkdown(r,u),c.push(u)}else if(l instanceof rIe){let u=_("");o.add(new Am(u,Po,Jx)).set(l),c.push(u)}else l instanceof We&&(c.push(_("span",{class:"colorBox",style:"background-color: "+We.Format.CSS.format(l)},"")),c.push(_("code",void 0,We.Format.CSS.formatHex(l))));return c}).flat())}))))),o}renderMarkdownAndTableData(e,t){let o=this._register(t.render(this.manifest));o.onDidChange&&this._register(o.onDidChange(n=>{Rt(e),this.renderMarkdownAndTable(n,e)})),this.renderMarkdownAndTable(o.data,e)}renderMarkdownData(e,t){e.classList.add("markdown");let o=this._register(t.render(this.manifest));o.onDidChange&&this._register(o.onDidChange(n=>{Rt(e),this.renderMarkdown(n,e)})),this.renderMarkdown(o.data,e)}renderMarkdown(e,t){let{element:o}=this._register(this.markdownRendererService.render({value:e.value,isTrusted:e.isTrusted,supportThemeIcons:!0}));M(t,o)}renderMarkdownAndTable(e,t){for(let o of e)if(Ar(o)){let n=_("",void 0);this.renderMarkdown(o,n),M(t,n)}else{let n=M(t,_("table"));this.renderTable(o,n)}}renderElementData(e,t){let o=this._register(t.render(this.manifest));o.onDidChange&&this._register(o.onDidChange(n=>{Rt(e),e.appendChild(n)})),e.appendChild(o.data)}layout(e,t){this.layoutParticipants.forEach(o=>o.layout(e,t))}};Mrt=I([m(3,F),m(4,cy),m(5,at),m(6,On)],Mrt);var Ksn=/[\0-\x1F!-,\.\/:-@\[-\^`\{-\xA9\xAB-\xB4\xB6-\xB9\xBB-\xBF\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0378\u0379\u037E\u0380-\u0385\u0387\u038B\u038D\u03A2\u03F6\u0482\u0530\u0557\u0558\u055A-\u055F\u0589-\u0590\u05BE\u05C0\u05C3\u05C6\u05C8-\u05CF\u05EB-\u05EE\u05F3-\u060F\u061B-\u061F\u066A-\u066D\u06D4\u06DD\u06DE\u06E9\u06FD\u06FE\u0700-\u070F\u074B\u074C\u07B2-\u07BF\u07F6-\u07F9\u07FB\u07FC\u07FE\u07FF\u082E-\u083F\u085C-\u085F\u086B-\u089F\u08B5\u08C8-\u08D2\u08E2\u0964\u0965\u0970\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA\u09BB\u09C5\u09C6\u09C9\u09CA\u09CF-\u09D6\u09D8-\u09DB\u09DE\u09E4\u09E5\u09F2-\u09FB\u09FD\u09FF\u0A00\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A\u0A3B\u0A3D\u0A43-\u0A46\u0A49\u0A4A\u0A4E-\u0A50\u0A52-\u0A58\u0A5D\u0A5F-\u0A65\u0A76-\u0A80\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA\u0ABB\u0AC6\u0ACA\u0ACE\u0ACF\u0AD1-\u0ADF\u0AE4\u0AE5\u0AF0-\u0AF8\u0B00\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A\u0B3B\u0B45\u0B46\u0B49\u0B4A\u0B4E-\u0B54\u0B58-\u0B5B\u0B5E\u0B64\u0B65\u0B70\u0B72-\u0B81\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BBD\u0BC3-\u0BC5\u0BC9\u0BCE\u0BCF\u0BD1-\u0BD6\u0BD8-\u0BE5\u0BF0-\u0BFF\u0C0D\u0C11\u0C29\u0C3A-\u0C3C\u0C45\u0C49\u0C4E-\u0C54\u0C57\u0C5B-\u0C5F\u0C64\u0C65\u0C70-\u0C7F\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA\u0CBB\u0CC5\u0CC9\u0CCE-\u0CD4\u0CD7-\u0CDD\u0CDF\u0CE4\u0CE5\u0CF0\u0CF3-\u0CFF\u0D0D\u0D11\u0D45\u0D49\u0D4F-\u0D53\u0D58-\u0D5E\u0D64\u0D65\u0D70-\u0D79\u0D80\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0DC9\u0DCB-\u0DCE\u0DD5\u0DD7\u0DE0-\u0DE5\u0DF0\u0DF1\u0DF4-\u0E00\u0E3B-\u0E3F\u0E4F\u0E5A-\u0E80\u0E83\u0E85\u0E8B\u0EA4\u0EA6\u0EBE\u0EBF\u0EC5\u0EC7\u0ECE\u0ECF\u0EDA\u0EDB\u0EE0-\u0EFF\u0F01-\u0F17\u0F1A-\u0F1F\u0F2A-\u0F34\u0F36\u0F38\u0F3A-\u0F3D\u0F48\u0F6D-\u0F70\u0F85\u0F98\u0FBD-\u0FC5\u0FC7-\u0FFF\u104A-\u104F\u109E\u109F\u10C6\u10C8-\u10CC\u10CE\u10CF\u10FB\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B\u135C\u1360-\u137F\u1390-\u139F\u13F6\u13F7\u13FE-\u1400\u166D\u166E\u1680\u169B-\u169F\u16EB-\u16ED\u16F9-\u16FF\u170D\u1715-\u171F\u1735-\u173F\u1754-\u175F\u176D\u1771\u1774-\u177F\u17D4-\u17D6\u17D8-\u17DB\u17DE\u17DF\u17EA-\u180A\u180E\u180F\u181A-\u181F\u1879-\u187F\u18AB-\u18AF\u18F6-\u18FF\u191F\u192C-\u192F\u193C-\u1945\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19CF\u19DA-\u19FF\u1A1C-\u1A1F\u1A5F\u1A7D\u1A7E\u1A8A-\u1A8F\u1A9A-\u1AA6\u1AA8-\u1AAF\u1AC1-\u1AFF\u1B4C-\u1B4F\u1B5A-\u1B6A\u1B74-\u1B7F\u1BF4-\u1BFF\u1C38-\u1C3F\u1C4A-\u1C4C\u1C7E\u1C7F\u1C89-\u1C8F\u1CBB\u1CBC\u1CC0-\u1CCF\u1CD3\u1CFB-\u1CFF\u1DFA\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FBD\u1FBF-\u1FC1\u1FC5\u1FCD-\u1FCF\u1FD4\u1FD5\u1FDC-\u1FDF\u1FED-\u1FF1\u1FF5\u1FFD-\u203E\u2041-\u2053\u2055-\u2070\u2072-\u207E\u2080-\u208F\u209D-\u20CF\u20F1-\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F-\u215F\u2189-\u24B5\u24EA-\u2BFF\u2C2F\u2C5F\u2CE5-\u2CEA\u2CF4-\u2CFF\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D70-\u2D7E\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF\u2E00-\u2E2E\u2E30-\u3004\u3008-\u3020\u3030\u3036\u3037\u303D-\u3040\u3097\u3098\u309B\u309C\u30A0\u30FB\u3100-\u3104\u3130\u318F-\u319F\u31C0-\u31EF\u3200-\u33FF\u4DC0-\u4DFF\u9FFD-\u9FFF\uA48D-\uA4CF\uA4FE\uA4FF\uA60D-\uA60F\uA62C-\uA63F\uA673\uA67E\uA6F2-\uA716\uA720\uA721\uA789\uA78A\uA7C0\uA7C1\uA7CB-\uA7F4\uA828-\uA82B\uA82D-\uA83F\uA874-\uA87F\uA8C6-\uA8CF\uA8DA-\uA8DF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA954-\uA95F\uA97D-\uA97F\uA9C1-\uA9CE\uA9DA-\uA9DF\uA9FF\uAA37-\uAA3F\uAA4E\uAA4F\uAA5A-\uAA5F\uAA77-\uAA79\uAAC3-\uAADA\uAADE\uAADF\uAAF0\uAAF1\uAAF7-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F\uAB5B\uAB6A-\uAB6F\uABEB\uABEE\uABEF\uABFA-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uD7FF\uE000-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB29\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBB2-\uFBD2\uFD3E-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFC-\uFDFF\uFE10-\uFE1F\uFE30-\uFE32\uFE35-\uFE4C\uFE50-\uFE6F\uFE75\uFEFD-\uFF0F\uFF1A-\uFF20\uFF3B-\uFF3E\uFF40\uFF5B-\uFF65\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFFF]|\uD800[\uDC0C\uDC27\uDC3B\uDC3E\uDC4E\uDC4F\uDC5E-\uDC7F\uDCFB-\uDD3F\uDD75-\uDDFC\uDDFE-\uDE7F\uDE9D-\uDE9F\uDED1-\uDEDF\uDEE1-\uDEFF\uDF20-\uDF2C\uDF4B-\uDF4F\uDF7B-\uDF7F\uDF9E\uDF9F\uDFC4-\uDFC7\uDFD0\uDFD6-\uDFFF]|\uD801[\uDC9E\uDC9F\uDCAA-\uDCAF\uDCD4-\uDCD7\uDCFC-\uDCFF\uDD28-\uDD2F\uDD64-\uDDFF\uDF37-\uDF3F\uDF56-\uDF5F\uDF68-\uDFFF]|\uD802[\uDC06\uDC07\uDC09\uDC36\uDC39-\uDC3B\uDC3D\uDC3E\uDC56-\uDC5F\uDC77-\uDC7F\uDC9F-\uDCDF\uDCF3\uDCF6-\uDCFF\uDD16-\uDD1F\uDD3A-\uDD7F\uDDB8-\uDDBD\uDDC0-\uDDFF\uDE04\uDE07-\uDE0B\uDE14\uDE18\uDE36\uDE37\uDE3B-\uDE3E\uDE40-\uDE5F\uDE7D-\uDE7F\uDE9D-\uDEBF\uDEC8\uDEE7-\uDEFF\uDF36-\uDF3F\uDF56-\uDF5F\uDF73-\uDF7F\uDF92-\uDFFF]|\uD803[\uDC49-\uDC7F\uDCB3-\uDCBF\uDCF3-\uDCFF\uDD28-\uDD2F\uDD3A-\uDE7F\uDEAA\uDEAD-\uDEAF\uDEB2-\uDEFF\uDF1D-\uDF26\uDF28-\uDF2F\uDF51-\uDFAF\uDFC5-\uDFDF\uDFF7-\uDFFF]|\uD804[\uDC47-\uDC65\uDC70-\uDC7E\uDCBB-\uDCCF\uDCE9-\uDCEF\uDCFA-\uDCFF\uDD35\uDD40-\uDD43\uDD48-\uDD4F\uDD74\uDD75\uDD77-\uDD7F\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDFF\uDE12\uDE38-\uDE3D\uDE3F-\uDE7F\uDE87\uDE89\uDE8E\uDE9E\uDEA9-\uDEAF\uDEEB-\uDEEF\uDEFA-\uDEFF\uDF04\uDF0D\uDF0E\uDF11\uDF12\uDF29\uDF31\uDF34\uDF3A\uDF45\uDF46\uDF49\uDF4A\uDF4E\uDF4F\uDF51-\uDF56\uDF58-\uDF5C\uDF64\uDF65\uDF6D-\uDF6F\uDF75-\uDFFF]|\uD805[\uDC4B-\uDC4F\uDC5A-\uDC5D\uDC62-\uDC7F\uDCC6\uDCC8-\uDCCF\uDCDA-\uDD7F\uDDB6\uDDB7\uDDC1-\uDDD7\uDDDE-\uDDFF\uDE41-\uDE43\uDE45-\uDE4F\uDE5A-\uDE7F\uDEB9-\uDEBF\uDECA-\uDEFF\uDF1B\uDF1C\uDF2C-\uDF2F\uDF3A-\uDFFF]|\uD806[\uDC3B-\uDC9F\uDCEA-\uDCFE\uDD07\uDD08\uDD0A\uDD0B\uDD14\uDD17\uDD36\uDD39\uDD3A\uDD44-\uDD4F\uDD5A-\uDD9F\uDDA8\uDDA9\uDDD8\uDDD9\uDDE2\uDDE5-\uDDFF\uDE3F-\uDE46\uDE48-\uDE4F\uDE9A-\uDE9C\uDE9E-\uDEBF\uDEF9-\uDFFF]|\uD807[\uDC09\uDC37\uDC41-\uDC4F\uDC5A-\uDC71\uDC90\uDC91\uDCA8\uDCB7-\uDCFF\uDD07\uDD0A\uDD37-\uDD39\uDD3B\uDD3E\uDD48-\uDD4F\uDD5A-\uDD5F\uDD66\uDD69\uDD8F\uDD92\uDD99-\uDD9F\uDDAA-\uDEDF\uDEF7-\uDFAF\uDFB1-\uDFFF]|\uD808[\uDF9A-\uDFFF]|\uD809[\uDC6F-\uDC7F\uDD44-\uDFFF]|[\uD80A\uD80B\uD80E-\uD810\uD812-\uD819\uD824-\uD82B\uD82D\uD82E\uD830-\uD833\uD837\uD839\uD83D\uD83F\uD87B-\uD87D\uD87F\uD885-\uDB3F\uDB41-\uDBFF][\uDC00-\uDFFF]|\uD80D[\uDC2F-\uDFFF]|\uD811[\uDE47-\uDFFF]|\uD81A[\uDE39-\uDE3F\uDE5F\uDE6A-\uDECF\uDEEE\uDEEF\uDEF5-\uDEFF\uDF37-\uDF3F\uDF44-\uDF4F\uDF5A-\uDF62\uDF78-\uDF7C\uDF90-\uDFFF]|\uD81B[\uDC00-\uDE3F\uDE80-\uDEFF\uDF4B-\uDF4E\uDF88-\uDF8E\uDFA0-\uDFDF\uDFE2\uDFE5-\uDFEF\uDFF2-\uDFFF]|\uD821[\uDFF8-\uDFFF]|\uD823[\uDCD6-\uDCFF\uDD09-\uDFFF]|\uD82C[\uDD1F-\uDD4F\uDD53-\uDD63\uDD68-\uDD6F\uDEFC-\uDFFF]|\uD82F[\uDC6B-\uDC6F\uDC7D-\uDC7F\uDC89-\uDC8F\uDC9A-\uDC9C\uDC9F-\uDFFF]|\uD834[\uDC00-\uDD64\uDD6A-\uDD6C\uDD73-\uDD7A\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDE41\uDE45-\uDFFF]|\uD835[\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3\uDFCC\uDFCD]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85-\uDE9A\uDEA0\uDEB0-\uDFFF]|\uD838[\uDC07\uDC19\uDC1A\uDC22\uDC25\uDC2B-\uDCFF\uDD2D-\uDD2F\uDD3E\uDD3F\uDD4A-\uDD4D\uDD4F-\uDEBF\uDEFA-\uDFFF]|\uD83A[\uDCC5-\uDCCF\uDCD7-\uDCFF\uDD4C-\uDD4F\uDD5A-\uDFFF]|\uD83B[\uDC00-\uDDFF\uDE04\uDE20\uDE23\uDE25\uDE26\uDE28\uDE33\uDE38\uDE3A\uDE3C-\uDE41\uDE43-\uDE46\uDE48\uDE4A\uDE4C\uDE50\uDE53\uDE55\uDE56\uDE58\uDE5A\uDE5C\uDE5E\uDE60\uDE63\uDE65\uDE66\uDE6B\uDE73\uDE78\uDE7D\uDE7F\uDE8A\uDE9C-\uDEA0\uDEA4\uDEAA\uDEBC-\uDFFF]|\uD83C[\uDC00-\uDD2F\uDD4A-\uDD4F\uDD6A-\uDD6F\uDD8A-\uDFFF]|\uD83E[\uDC00-\uDFEF\uDFFA-\uDFFF]|\uD869[\uDEDE-\uDEFF]|\uD86D[\uDF35-\uDF3F]|\uD86E[\uDC1E\uDC1F]|\uD873[\uDEA2-\uDEAF]|\uD87A[\uDFE1-\uDFFF]|\uD87E[\uDE1E-\uDFFF]|\uD884[\uDF4B-\uDFFF]|\uDB40[\uDC00-\uDCFF\uDDF0-\uDFFF]/g;function Gsn(a){return a.trim().toLowerCase().replace(Ksn,"").replace(/\s/g,"-")}var qsn=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function $sn(a){return a.replace(qsn,(i,e)=>(e=e.toLowerCase(),e==="colon"?":":e.charAt(0)==="#"?e.charAt(1)==="x"?String.fromCharCode(parseInt(e.substring(2),16)):String.fromCharCode(+e.substring(1)):""))}function OGt({prefix:a="",globalSlugs:i=!1}={}){return{renderer:{heading({tokens:e,depth:t}){let o=this.parser.parseInline(e),n=$sn(this.parser.parseInline(e,this.parser.textRenderer)).trim().replace(/<[!\/a-z].*?>/gi,""),r=t,s=`${a}${Gsn(n)}`;return`<h${r} id="${s}">${o}</h${r}>
`}}}}var dU=`
body {
	padding: 10px 20px;
	line-height: 22px;
	max-width: 882px;
	margin: 0 auto;
}

body *:last-child {
	margin-bottom: 0;
}

img {
	max-width: 100%;
	max-height: 100%;
}

a {
	text-decoration: var(--text-link-decoration);
}

a:hover {
	text-decoration: underline;
}

a:focus,
input:focus,
select:focus,
textarea:focus {
	outline: 1px solid -webkit-focus-ring-color;
	outline-offset: -1px;
}

hr {
	border: 0;
	height: 2px;
	border-bottom: 2px solid;
}

h1 {
	padding-bottom: 0.3em;
	line-height: 1.2;
	border-bottom-width: 1px;
	border-bottom-style: solid;
}

h1, h2, h3 {
	font-weight: normal;
}

table {
	border-collapse: collapse;
}

th {
	text-align: left;
	border-bottom: 1px solid;
}

th,
td {
	padding: 5px 10px;
}

table > tbody > tr + tr > td {
	border-top-width: 1px;
	border-top-style: solid;
}

blockquote {
	margin: 0 7px 0 5px;
	padding: 0 16px 0 10px;
	border-left-width: 5px;
	border-left-style: solid;
}

code {
	font-family: "SF Mono", Monaco, Menlo, Consolas, "Ubuntu Mono", "Liberation Mono", "DejaVu Sans Mono", "Courier New", monospace;
}

pre {
	padding: 16px;
	border-radius: 3px;
	overflow: auto;
}

pre code {
	font-family: var(--vscode-editor-font-family);
	font-weight: var(--vscode-editor-font-weight);
	font-size: var(--vscode-editor-font-size);
	line-height: 1.5;
	color: var(--vscode-editor-foreground);
	tab-size: 4;
}

.monaco-tokenized-source {
	white-space: pre;
}

/** Theming */

.pre {
	background-color: var(--vscode-textCodeBlock-background);
}

.vscode-high-contrast h1 {
	border-color: rgb(0, 0, 0);
}

.vscode-light th {
	border-color: rgba(0, 0, 0, 0.69);
}

.vscode-dark th {
	border-color: rgba(255, 255, 255, 0.69);
}

.vscode-light h1,
.vscode-light hr,
.vscode-light td {
	border-color: rgba(0, 0, 0, 0.18);
}

.vscode-dark h1,
.vscode-dark hr,
.vscode-dark td {
	border-color: rgba(255, 255, 255, 0.18);
}

@media (forced-colors: active) and (prefers-color-scheme: light){
	body {
		forced-color-adjust: none;
	}
}

@media (forced-colors: active) and (prefers-color-scheme: dark){
	body {
		forced-color-adjust: none;
	}
}
`,jsn=Object.freeze([Q.http,Q.https]);function Qsn(a,i){return Hyt(a,{allowedLinkProtocols:{override:i?.allowedLinkProtocols?.override??jsn},allowRelativeLinkPaths:i?.allowRelativeLinkPaths,allowedMediaProtocols:i?.allowedMediaProtocols,allowRelativeMediaPaths:i?.allowRelativeMediaPaths,allowedTags:{override:Sri,augment:i?.allowedTags?.augment},allowedAttributes:{override:[...g4e,"name","id","class","role","tabindex","placeholder"],augment:i?.allowedAttributes?.augment??[]}})}async function sq(a,i,e,t,o=Se.None){let n=new Gj(dyo.markedHighlight({async:!0,async highlight(s,l){if(typeof l!="string")return mr(s);if(await i.whenInstalledExtensionsRegistered(),o?.isCancellationRequested)return"";let c=e.getLanguageIdByLanguageName(l)??e.getLanguageIdByLanguageName(l.split(/\s+|:|,|(?!^)\{|\?]/,1)[0]);return fz(e,s,c)}}),OGt(),...t?.markedExtensions??[]),r=await Wp(n.parse(a,{async:!0}),o??Se.None);return Qsn(r,t?.sanitizerConfig)}var dyo;(c=>{function a(u){if(typeof u=="function"&&(u={highlight:u}),!u||typeof u.highlight!="function")throw new Error("Must provide highlight function");return{async:!!u.async,walkTokens(p){if(p.type!=="code")return;if(u.async)return Promise.resolve(u.highlight(p.text,p.lang)).then(i(p));let h=u.highlight(p.text,p.lang);if(h instanceof Promise)throw new Error("markedHighlight is not set to async but the highlight function is async. Set the async option to true on markedHighlight to await the async highlight function.");i(p)(h)},renderer:{code({text:p,lang:h,escaped:g}){let f=h?` class="language-${l(h)}"`:"";return p=p.replace(/\n$/,""),`<pre><code${f}>${g?p:l(p,!0)}
</code></pre>`}}}}c.markedHighlight=a;function i(u){return p=>{typeof p=="string"&&p!==u.text&&(u.escaped=!0,u.text=p)}}let e=/[&<>"']/,t=new RegExp(e.source,"g"),o=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,n=new RegExp(o.source,"g"),r={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},s=u=>r[u];function l(u,p){if(p){if(e.test(u))return u.replace(t,s)}else if(o.test(u))return u.replace(n,s);return u}})(dyo||={});var K0e="update.showCurrentReleaseNotes",uyo="developer.showCurrentFileAsReleaseNotes";var HMi=class extends x{constructor(e){super();this._onChange=this._register(new E);this.onChange=this._onChange.event;this._currentId=null;let t=M(e,_(".navbar"));this.actions=[],this.actionbar=this._register(new Zi(t))}get currentId(){return this._currentId}push(e,t,o){let n=new it(e,t,void 0,!0,()=>this.update(e,!0));n.tooltip=o,this.actions.push(n),this.actionbar.push(n),this.actions.length===1&&this.update(e)}clear(){this.actions=Be(this.actions),this.actionbar.clear()}switch(e){let t=this.actions.find(o=>o.id===e);return t?(t.run(),!0):!1}update(e,t){this._currentId=e,this._onChange.fire({id:e,focus:!!t}),this.actions.forEach(o=>o.checked=o.id===e)}dispose(){this.clear(),super.dispose()}};var Ysn=new Y("showPreReleaseVersion",!1),UMi=class extends xI{constructor(){super(...arguments);this._gallery=null}get gallery(){return this._gallery}set gallery(e){this.extension&&e&&!Ut(this.extension.identifier,e.identifier)||(this._gallery=e,this.update())}},zMi=class extends UMi{constructor(i,e){super(),this.element=M(i,_("code.version",void 0,"pre-release")),this._register(e.setupManagedHover(Ri("mouse"),this.element,d(10118,null))),this.render()}render(){this.extension?.preRelease?un(this.element):vo(this.element)}},LW=class extends Ts{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super(LW.ID,e,t,s,p);this.instantiationService=o;this.extensionsWorkbenchService=n;this.extensionGalleryService=r;this.notificationService=l;this.openerService=c;this.extensionRecommendationsService=u;this.extensionService=h;this.webviewService=g;this.languageService=f;this.contextMenuService=v;this.contextKeyService=b;this.hoverService=S;this._scopedContextKeyService=this._register(new me);this.initialScrollProgress=new Map;this.currentIdentifier="";this.layoutParticipants=[];this.contentDisposables=this._register(new N);this.transientDisposables=this._register(new N);this.activeElement=null;this.extensionReadme=null,this.extensionChangelog=null,this.extensionManifest=null}static{this.ID="workbench.editor.extension"}get scopedContextKeyService(){return this._scopedContextKeyService.value}createEditor(e){let t=M(e,_(".extension-editor"));this._scopedContextKeyService.value=this.contextKeyService.createScoped(t),this._scopedContextKeyService.value.createKey("inExtensionEditor",!0),this.showPreReleaseVersionContextKey=Ysn.bindTo(this._scopedContextKeyService.value),t.tabIndex=0,t.style.outline="none",t.setAttribute("role","document");let o=M(t,_(".header")),n=M(o,_(".icon-container")),r=this.instantiationService.createInstance(NG,n),s=this.instantiationService.createInstance(wie,n,!0),l=M(o,_(".details")),c=M(l,_(".title")),u=M(c,_("span.name.clickable",{role:"heading",tabIndex:0}));this._register(this.hoverService.setupManagedHover(Ri("mouse"),u,d(10134,null)));let p=new zMi(c,this.hoverService),h=M(c,_("span.preview"));this._register(this.hoverService.setupManagedHover(Ri("mouse"),h,d(10139,null))),h.textContent=d(10139,null);let g=M(c,_("span.builtin"));g.textContent=d(10106,null);let f=M(l,_(".subtitle")),v=[],b=M(f,_(".subtitle-entry"));v.push(b);let S=this.instantiationService.createInstance(yie,b,!1),y=M(f,_(".subtitle-entry"));v.push(y);let w=this.instantiationService.createInstance(Cie,y,!1),k=M(f,_(".subtitle-entry"));v.push(k);let T=this.instantiationService.createInstance(ZH,k,!1),P=M(f,_(".subtitle-entry"));v.push(P);let O=this.instantiationService.createInstance(Iie,P,!1),V=M(f,_(".subtitle-entry"));v.push(V);let H=this.instantiationService.createInstance(tOe,V),G=[r,s,p,S,w,T,O,H],$=M(l,_(".description")),J=this.instantiationService.createInstance(cte),ae=[this.instantiationService.createInstance(fG),this.instantiationService.createInstance(Z0),this.instantiationService.createInstance(YA,!0),this.instantiationService.createInstance(Hk),this.instantiationService.createInstance(Uk),this.instantiationService.createInstance(zk),this.instantiationService.createInstance(wM),this.instantiationService.createInstance(vx),this.instantiationService.createInstance(yPe),this.instantiationService.createInstance($D),this.instantiationService.createInstance(wPe),this.instantiationService.createInstance(u8,!1),this.instantiationService.createInstance(dte),this.instantiationService.createInstance(ute),J,this.instantiationService.createInstance(_Pe),this.instantiationService.createInstance(IG,"extensions.uninstall",FT.UninstallClass,[[this.instantiationService.createInstance(J0,!1),this.instantiationService.createInstance(FT),this.instantiationService.createInstance(WT,null,!0)]]),this.instantiationService.createInstance(fx),new SUt(this.scopedContextKeyService||this.contextKeyService,this.instantiationService)],he=M(l,_(".actions-status-container")),oe=this._register(new Zi(he,{actionViewItemProvider:(Ht,zi)=>{if(Ht instanceof UH)return Ht.createActionViewItem(zi);if(Ht instanceof IG)return new TPe(Ht,{...zi,icon:!0,label:!0,menuActionsOrProvider:{getActions:()=>Ht.menuActions},menuActionClassNames:Ht.menuActionClassNames},this.contextMenuService);if(Ht instanceof fx)return new fCt(void 0,Ht,{...zi,icon:!0,label:!0,checkboxStyles:qf})},focusOnlyEnabledItems:!0}));oe.push(ae,{icon:!0,label:!0}),oe.setFocusable(!0),this._register(U.any(...ae.map(Ht=>U.filter(Ht.onDidChange,zi=>zi.enabled!==void 0)))(()=>{oe.setFocusable(!1),oe.setFocusable(!0)}));let de=[],Ce=this.instantiationService.createInstance(qD),xe=this._register(this.instantiationService.createInstance(sOe,M(he,_(".status")),Ce));de.push(Ce,new class extends xI{render(){he.classList.toggle("list-layout",this.extension?.state===1)}});let ze=this.instantiationService.createInstance(aOe,M(l,_(".recommendation")));G.push(ze),this._register(U.any(xe.onDidRender,ze.onDidRender)(()=>{this.dimension&&this.layout(this.dimension)}));let De=this.instantiationService.createInstance(PJ,[...ae,...G,...de]);for(let Ht of[...ae,...G,...de,De])this._register(Ht);let Oe=U.chain(oe.onDidRun,Ht=>Ht.map(({error:zi})=>zi).filter(zi=>!!zi));this._register(Oe(this.onError,this));let pt=M(t,_(".body")),et=this._register(new HMi(pt)),Ti=M(pt,_(".content"));Ti.id=xt(),this.template={builtin:g,content:Ti,description:$,header:o,name:u,navbar:et,preview:h,actionsAndStatusContainer:he,extensionActionBar:oe,set extension(Ht){De.extension=Ht;let zi;for(let Vo of v)Vo.classList.remove("last-non-empty"),Vo.children.length>0&&(zi=Vo);zi&&zi.classList.add("last-non-empty")},set gallery(Ht){p.gallery=Ht},set manifest(Ht){J.manifest=Ht}}}async setInput(e,t,o,n){await super.setInput(e,t,o,n),this.updatePreReleaseVersionContext(),this.template&&await this.render(e.extension,this.template,!!t?.preserveFocus)}setOptions(e){let t=this.options;if(super.setOptions(e),this.updatePreReleaseVersionContext(),this.input&&this.template&&t?.showPreReleaseVersion!==e?.showPreReleaseVersion){this.render(this.input.extension,this.template,!!e?.preserveFocus);return}e?.tab&&this.template?.navbar.switch(e.tab)}updatePreReleaseVersionContext(){let e=this.options?.showPreReleaseVersion;gn(e)&&(e=!!this.input.extension.gallery?.properties.isPreReleaseVersion),this.showPreReleaseVersionContextKey?.set(e)}async openTab(e){!this.input||!this.template||this.template.navbar.switch(e)||e==="extensionPack"&&this.template.navbar.switch("readme")}async getGalleryVersionToShow(e,t){return e.resourceExtension||e.local?.source==="resource"||gn(t)||t===e.gallery?.properties.isPreReleaseVersion||t&&!e.hasPreReleaseVersion||!t&&!e.hasReleaseVersion?null:(await this.extensionGalleryService.getExtensions([{...e.identifier,preRelease:t,hasPreRelease:e.hasPreReleaseVersion}],Se.None))[0]||null}async render(e,t,o){this.activeElement=null,this.transientDisposables.clear();let n=this.transientDisposables.add(new Ye).token,r=await this.getGalleryVersionToShow(e,this.options?.showPreReleaseVersion);if(n.isCancellationRequested)return;this.extensionReadme=new dV(()=>r?this.extensionGalleryService.getReadme(r,n):e.getReadme(n)),this.extensionChangelog=new dV(()=>r?this.extensionGalleryService.getChangelog(r,n):e.getChangelog(n)),this.extensionManifest=new dV(()=>r?this.extensionGalleryService.getManifest(r,n):e.getManifest(n)),t.extension=e,t.gallery=r,t.manifest=null,t.name.textContent=e.displayName,t.name.classList.toggle("clickable",!!e.url),t.name.classList.toggle("deprecated",!!e.deprecationInfo),t.preview.style.display=e.preview?"inherit":"none",t.builtin.style.display=e.isBuiltin?"inherit":"none",t.description.textContent=e.description,e.url&&this.transientDisposables.add(bW(t.name,()=>this.openerService.open(A.parse(e.url))));let s=await this.extensionManifest.get().promise;if(n.isCancellationRequested)return;s&&(t.manifest=s),this.renderNavbar(e,s,t,o);let l=this.extensionRecommendationsService.getAllRecommendationsWithReason(),c={};l[e.identifier.id.toLowerCase()]&&(c={recommendationReason:l[e.identifier.id.toLowerCase()].reasonId}),this.telemetryService.publicLog("extensionGallery:openExtension",{...e.telemetryData,...c})}renderNavbar(e,t,o,n){o.content.innerText="",o.navbar.clear(),this.currentIdentifier!==e.identifier.id&&(this.initialScrollProgress.clear(),this.currentIdentifier=e.identifier.id),o.navbar.push("readme",d(10114,null),d(10115,null)),t&&o.navbar.push("features",d(10121,null),d(10122,null)),e.hasChangelog()&&o.navbar.push("changelog",d(10109,null),d(10111,null)),e.dependencies.length&&o.navbar.push("dependencies",d(10112,null),d(10113,null)),t&&t.extensionPack?.length&&!this.shallRenderAsExtensionPack(t)&&o.navbar.push("extensionPack",d(10119,null),d(10120,null)),this.options?.tab&&o.navbar.switch(this.options.tab),o.navbar.currentId&&this.onNavbarChange(e,{id:o.navbar.currentId,focus:!n},o),o.navbar.onChange(r=>this.onNavbarChange(e,r,o),this,this.transientDisposables)}clearInput(){this.contentDisposables.clear(),this.transientDisposables.clear(),super.clearInput()}focus(){super.focus(),this.activeElement?.focus()}showFind(){this.activeWebview?.showFind()}runFindAction(e){this.activeWebview?.runFindAction(e)}get activeWebview(){if(!(!this.activeElement||!this.activeElement.runFindAction))return this.activeElement}onNavbarChange(e,{id:t,focus:o},n){if(this.contentDisposables.clear(),n.content.innerText="",this.activeElement=null,t){let r=new Ye;this.contentDisposables.add(Z(()=>r.dispose(!0))),this.open(t,e,n,r.token).then(s=>{r.token.isCancellationRequested||(this.activeElement=s,o&&this.focus())})}}open(e,t,o,n){let r=M(o.content,_(".details")),s=M(r,_(".content-container")),l=M(r,_(".additional-details-container")),c=()=>r.classList.toggle("narrow",this.dimension&&this.dimension.width<500);switch(c(),this.contentDisposables.add(Z(ah(this.layoutParticipants,{layout:c}))),this.renderAdditionalDetails(l,t),e){case"readme":return this.openDetails(t,s,n);case"features":return this.openFeatures(t,s,n);case"changelog":return this.openChangelog(t,s,n);case"dependencies":return this.openExtensionDependencies(t,s,n);case"extensionPack":return this.openExtensionPack(t,s,n)}return Promise.resolve(null)}async openMarkdown(e,t,o,n,r,s,l){try{let c=await this.renderMarkdown(e,t,n,l);if(l.isCancellationRequested)return Promise.resolve(null);let u=this.contentDisposables.add(this.webviewService.createWebviewOverlay({title:s,options:{enableFindWidget:!0,tryRestoreScrollPosition:!0,disableServiceWorker:!0},contentOptions:{},extension:void 0}));u.initialScrollProgress=this.initialScrollProgress.get(r)||0,u.claim(this,this.window,this.scopedContextKeyService),dO(u.container,n),u.layoutWebviewOverElement(n),u.setHtml(c),u.claim(this,this.window,void 0),this.contentDisposables.add(u.onDidFocus(()=>this._onDidFocus?.fire())),this.contentDisposables.add(u.onDidScroll(()=>this.initialScrollProgress.set(r,u.initialScrollProgress)));let p=ah(this.layoutParticipants,{layout:()=>{u.layoutWebviewOverElement(n)}});this.contentDisposables.add(Z(p));let h=!1;return this.contentDisposables.add(Z(()=>{h=!0})),this.contentDisposables.add(this.themeService.onDidColorThemeChange(async()=>{let g=await this.renderMarkdown(e,t,n);h||u.setHtml(g)})),this.contentDisposables.add(u.onDidClickLink(g=>{g&&(ec(g,Q.http)||ec(g,Q.https)||ec(g,Q.mailto)?this.openerService.open(g):ec(g,Q.command)&&e.type===0&&this.openerService.open(g,{allowCommands:[K0e]}))})),u}catch{let u=M(n,_("p.nocontent"));return u.textContent=o,u}}async renderMarkdown(e,t,o,n){let r=await this.loadContents(()=>t,o);if(n?.isCancellationRequested)return"";let s=[Q.http,Q.https,Q.mailto],l=await sq(r,this.extensionService,this.languageService,{sanitizerConfig:{allowedLinkProtocols:{override:e.type===0?[...s,Q.command]:s}}},n);return n?.isCancellationRequested?"":this.renderBody(l)}renderBody(e){let t=xt(),o=ic.getColorMap(),n=o?A_(o):"";return`<!DOCTYPE html>
		<html>
			<head>
				<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
				<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src https: data:; media-src https:; script-src 'none'; style-src 'nonce-${t}';">
				<style nonce="${t}">
					${dU}

					/* prevent scroll-to-top button from blocking the body text */
					body {
						padding-bottom: 75px;
					}

					#scroll-to-top {
						position: fixed;
						width: 32px;
						height: 32px;
						right: 25px;
						bottom: 25px;
						background-color: var(--vscode-button-secondaryBackground);
						border-color: var(--vscode-button-border);
						border-radius: 50%;
						cursor: pointer;
						box-shadow: 1px 1px 1px rgba(0,0,0,.25);
						outline: none;
						display: flex;
						justify-content: center;
						align-items: center;
					}

					#scroll-to-top:hover {
						background-color: var(--vscode-button-secondaryHoverBackground);
						box-shadow: 2px 2px 2px rgba(0,0,0,.25);
					}

					body.vscode-high-contrast #scroll-to-top {
						border-width: 2px;
						border-style: solid;
						box-shadow: none;
					}

					#scroll-to-top span.icon::before {
						content: "";
						display: block;
						background: var(--vscode-button-secondaryForeground);
						/* Chevron up icon */
						webkit-mask-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjIuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAxNiAxNiIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTYgMTY7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4KCS5zdDB7ZmlsbDojRkZGRkZGO30KCS5zdDF7ZmlsbDpub25lO30KPC9zdHlsZT4KPHRpdGxlPnVwY2hldnJvbjwvdGl0bGU+CjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik04LDUuMWwtNy4zLDcuM0wwLDExLjZsOC04bDgsOGwtMC43LDAuN0w4LDUuMXoiLz4KPHJlY3QgY2xhc3M9InN0MSIgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2Ii8+Cjwvc3ZnPgo=');
						-webkit-mask-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjIuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAxNiAxNiIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTYgMTY7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4KCS5zdDB7ZmlsbDojRkZGRkZGO30KCS5zdDF7ZmlsbDpub25lO30KPC9zdHlsZT4KPHRpdGxlPnVwY2hldnJvbjwvdGl0bGU+CjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik04LDUuMWwtNy4zLDcuM0wwLDExLjZsOC04bDgsOGwtMC43LDAuN0w4LDUuMXoiLz4KPHJlY3QgY2xhc3M9InN0MSIgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2Ii8+Cjwvc3ZnPgo=');
						width: 16px;
						height: 16px;
					}
					${n}
				</style>
			</head>
			<body>
				<a id="scroll-to-top" role="button" aria-label="scroll to top" href="#"><span class="icon"></span></a>
				${e}
			</body>
		</html>`}async openDetails(e,t,o){let n=null,r=await this.extensionManifest.get().promise;return r&&r.extensionPack?.length&&this.shallRenderAsExtensionPack(r)?n=await this.openExtensionPackReadme(e,r,t,o):n=await this.openMarkdown(e,this.extensionReadme.get(),d(10137,null),t,0,d(10141,null),o),n}shallRenderAsExtensionPack(e){return!!e.categories?.some(t=>t.toLowerCase()==="extension packs")}async openExtensionPackReadme(e,t,o,n){if(n.isCancellationRequested)return Promise.resolve(null);let r=M(o,_("div",{class:"extension-pack-readme"}));r.style.margin="0 auto",r.style.maxWidth="882px";let s=M(r,_("div",{class:"extension-pack"})),l=t.extensionPack.length,c=37,u=200,p=()=>{r.classList.remove("one-row","two-rows","three-rows","more-rows");let v=o.clientHeight,b=Math.max(v-c-u,0),S="one-row";b>=302&&l>6?S="more-rows":b>=282&&l>4?S="three-rows":b>=200&&l>2?S="two-rows":S="one-row",r.classList.add(S)};p(),this.contentDisposables.add(Z(ah(this.layoutParticipants,{layout:p})));let h=M(s,_("div.header"));h.textContent=d(10117,null,t.extensionPack.length);let g=M(s,_("div",{class:"extension-pack-content"}));g.setAttribute("tabindex","0");let f=M(r,_("div.readme-content"));return await Promise.all([this.renderExtensionPack(t,g,n),this.openMarkdown(e,this.extensionReadme.get(),d(10137,null),f,0,d(10141,null),n)]),{focus:()=>g.focus()}}renderAdditionalDetails(e,t){let o=_("div",{class:"additional-details-content",tabindex:"0"}),n=new ms(o,{}),r=()=>n.scanDomNode(),s=ah(this.layoutParticipants,{layout:r});this.contentDisposables.add(Z(s)),this.contentDisposables.add(n),this.contentDisposables.add(this.instantiationService.createInstance(Prt,o,t)),M(e,n.getDomNode()),n.scanDomNode()}async openChangelog(e,t,o){return await this.openMarkdown(e,this.extensionChangelog.get(),d(10135,null),t,1,d(10110,null),o)}async openFeatures(e,t,o){let n=await this.loadContents(()=>this.extensionManifest.get(),t);if(o.isCancellationRequested||!n)return null;let r=this.contentDisposables.add(this.instantiationService.createInstance(z0e,n,this.options?.feature)),s=()=>r.layout(t.clientHeight,t.clientWidth),l=ah(this.layoutParticipants,{layout:s});return this.contentDisposables.add(Z(l)),M(t,r.domNode),s(),r.domNode}openExtensionDependencies(e,t,o){if(o.isCancellationRequested)return Promise.resolve(null);if($N(e.dependencies))return M(t,_("p.nocontent")).textContent=d(10136,null),Promise.resolve(t);let n=_("div",{class:"subcontent"}),r=new ms(n,{});M(t,r.getDomNode()),this.contentDisposables.add(r);let s=this.instantiationService.createInstance(uOe,new dKt(e,null,u=>u.dependencies||[],this.extensionsWorkbenchService),n,{listBackground:Ho}),l=()=>{r.scanDomNode();let u=r.getScrollDimensions();s.layout(u.height)},c=ah(this.layoutParticipants,{layout:l});return this.contentDisposables.add(Z(c)),this.contentDisposables.add(s),l(),Promise.resolve({focus(){s.domFocus()}})}async openExtensionPack(e,t,o){if(o.isCancellationRequested)return Promise.resolve(null);let n=await this.loadContents(()=>this.extensionManifest.get(),t);return o.isCancellationRequested||!n?null:this.renderExtensionPack(n,t,o)}async renderExtensionPack(e,t,o){if(o.isCancellationRequested)return null;let n=_("div",{class:"subcontent"}),r=new ms(n,{useShadows:!1});M(t,r.getDomNode());let s=this.instantiationService.createInstance(cOe,n,new lOe),l=await _ot(e.extensionPack,this.extensionsWorkbenchService);return s.setExtensions(l),r.scanDomNode(),this.contentDisposables.add(r),this.contentDisposables.add(s),this.contentDisposables.add(Z(ah(this.layoutParticipants,{layout:()=>r.scanDomNode()}))),n}loadContents(e,t){t.classList.add("loading");let o=this.contentDisposables.add(e()),n=()=>t.classList.remove("loading");return o.promise.then(n,n),o.promise}layout(e){this.dimension=e,this.layoutParticipants.forEach(t=>t.layout())}onError(e){ao(e)||this.notificationService.error(e)}};LW=I([m(1,Te),m(2,F),m(3,Hi),m(4,fa),m(5,Le),m(6,Ne),m(7,Je),m(8,BD),m(9,ce),m(10,lt),m(11,cp),m(12,_t),m(13,Xe),m(14,X),m(15,nt)],LW);var Prt=class extends x{constructor(e,t,o,n,r,s,l,c,u,p){super();this.container=e;this.hoverService=o;this.openerService=n;this.userDataProfilesService=r;this.remoteAgentService=s;this.fileService=l;this.uriIdentityService=c;this.extensionsWorkbenchService=u;this.extensionGalleryManifestService=p;this.disposables=this._register(new N);this.render(t),this._register(this.extensionsWorkbenchService.onChange(h=>{h&&Ut(h.identifier,t.identifier)&&h.server===t.server&&this.render(h)}))}render(e){this.container.innerText="",this.disposables.clear(),e.local&&this.renderInstallInfo(this.container,e.local),e.gallery&&this.renderMarketplaceInfo(this.container,e),this.renderCategories(this.container,e),this.renderExtensionResources(this.container,e)}renderCategories(e,t){if(t.categories.length){let o=M(e,_(".categories-container.additional-details-element"));M(o,_(".additional-details-title",void 0,d(10108,null)));let n=M(o,_(".categories"));this.extensionGalleryManifestService.getExtensionGalleryManifest().then(r=>{let s=r?.capabilities.extensionQuery.filtering?.some(({name:l})=>l==="Category");for(let l of t.categories){let c=M(n,_("span.category",{tabindex:"0"},l));s&&(c.classList.add("clickable"),this.disposables.add(bW(c,()=>this.extensionsWorkbenchService.openSearch(`@category:"${l}"`))))}})}}renderExtensionResources(e,t){let o=[];if(t.repository)try{o.push([d(10142,null),q.fromId(R.repo.id),A.parse(t.repository)])}catch{}if(t.supportUrl)try{o.push([d(10128,null),q.fromId(R.issues.id),A.parse(t.supportUrl)])}catch{}if(t.licenseUrl)try{o.push([d(10131,null),q.fromId(R.linkExternal.id),A.parse(t.licenseUrl)])}catch{}if(t.publisherUrl&&o.push([t.publisherDisplayName,q.fromId(R.linkExternal.id),t.publisherUrl]),t.url&&o.push([d(10132,null),q.fromId(R.linkExternal.id),A.parse(t.url)]),o.length||t.publisherSponsorLink){let n=M(e,_(".resources-container.additional-details-element"));M(n,_(".additional-details-title",void 0,d(10143,null)));let r=M(n,_(".resources"));for(let[s,l,c]of o){let u=M(r,_(".resource"));M(u,_(q.asCSSSelector(l))),M(u,_("a",{tabindex:"0"},s)),this.disposables.add(bW(u,()=>this.openerService.open(c))),this.disposables.add(this.hoverService.setupManagedHover(Ri("mouse"),u,c.toString()))}}}renderInstallInfo(e,t){let o=M(e,_(".more-info-container.additional-details-element"));M(o,_(".additional-details-title",void 0,d(10127,null)));let n=M(o,_(".more-info"));if(M(n,_(".more-info-entry",void 0,_("div.more-info-entry-name",void 0,d(10126,null)),_("code",void 0,t.identifier.id))),t.type!==0&&M(n,_(".more-info-entry",void 0,_("div.more-info-entry-name",void 0,d(10147,null)),_("code",void 0,t.manifest.version))),t.installedTimestamp&&M(n,_(".more-info-entry",void 0,_("div.more-info-entry-name",void 0,d(10130,null)),_("div",{title:new Date(t.installedTimestamp).toString()},ea(t.installedTimestamp,!0,!0,!0)))),!t.isBuiltin&&t.source!=="gallery"){let r=_("div",void 0,t.source==="vsix"?d(10148,null):d(10138,null));M(n,_(".more-info-entry",void 0,_("div.more-info-entry-name",void 0,d(10146,null)),r)),Vr&&t.source==="resource"&&t.location.scheme===Q.file&&(r.classList.add("link"),r.tabIndex=0,r.setAttribute("role","link"),r.title=t.location.fsPath,this.disposables.add(bW(r,()=>this.openerService.open(t.location,{openExternal:!0}))))}if(t.size){let r=_("div",void 0,vl.formatSize(t.size));M(n,_(".more-info-entry",void 0,_("div.more-info-entry-name",{title:d(10145,null)},d(10144,null)),r)),Vr&&t.location.scheme===Q.file&&(r.classList.add("link"),r.tabIndex=0,r.setAttribute("role","link"),r.title=t.location.fsPath,this.disposables.add(bW(r,()=>this.openerService.open(t.location,{openExternal:!0}))))}this.getCacheLocation(t).then(r=>{r&&dmi(r,this.fileService).then(s=>{if(!s)return;let l=_("div",void 0,vl.formatSize(s));M(n,_(".more-info-entry",void 0,_("div.more-info-entry-name",{title:d(10116,null)},d(10107,null)),l)),Vr&&t.location.scheme===Q.file&&(l.classList.add("link"),l.tabIndex=0,l.setAttribute("role","link"),l.title=r.fsPath,this.disposables.add(bW(l,()=>this.openerService.open(r.with({scheme:Q.file}),{openExternal:!0}))))})})}async getCacheLocation(e){let t=this.uriIdentityService.extUri.joinPath(this.userDataProfilesService.defaultProfile.globalStorageHome,e.identifier.id.toLowerCase());if(e.location.scheme===Q.vscodeRemote){let o=await this.remoteAgentService.getEnvironment();if(!o)return;t=this.uriIdentityService.extUri.joinPath(o.globalStorageHome,e.identifier.id.toLowerCase())}return t}renderMarketplaceInfo(e,t){let o=t.gallery,n=M(e,_(".more-info-container.additional-details-element"));M(n,_(".additional-details-title",void 0,d(10133,null)));let r=M(n,_(".more-info"));o&&(t.local||(M(r,_(".more-info-entry",void 0,_("div.more-info-entry-name",void 0,d(10126,null)),_("code",void 0,t.identifier.id))),M(r,_(".more-info-entry",void 0,_("div.more-info-entry-name",void 0,d(10147,null)),_("code",void 0,o.version)))),M(r,_(".more-info-entry",void 0,_("div.more-info-entry-name",void 0,d(10140,null)),_("div",{title:new Date(o.releaseDate).toString()},ea(o.releaseDate,!0,!0,!0))),_(".more-info-entry",void 0,_("div.more-info-entry-name",void 0,d(10129,null)),_("div",{title:new Date(o.lastUpdated).toString()},ea(o.lastUpdated,!0,!0,!0)))))}};Prt=I([m(2,nt),m(3,Je),m(4,an),m(5,bo),m(6,fe),m(7,ht),m(8,Hi),m(9,Dv)],Prt);var KMi=C.and(C.equals("activeEditor",LW.ID),pe.focus.toNegated());W(class extends K{constructor(){super({id:"editor.action.extensioneditor.showfind",title:d(10123,null),keybinding:{when:KMi,weight:100,primary:2084}})}run(i){GMi(i)?.showFind()}});W(class extends K{constructor(){super({id:"editor.action.extensioneditor.findNext",title:d(10124,null),keybinding:{when:C.and(KMi,FK),primary:3,weight:100}})}run(i){GMi(i)?.runFindAction(!1)}});W(class extends K{constructor(){super({id:"editor.action.extensioneditor.findPrevious",title:d(10125,null),keybinding:{when:C.and(KMi,FK),primary:1027,weight:100}})}run(i){GMi(i)?.runFindAction(!0)}});is((a,i)=>{let e=a.getColor(nS);e&&(i.addRule(`.monaco-workbench .extension-editor .content .details .additional-details-container .resources-container a.resource { color: ${e}; }`),i.addRule(`.monaco-workbench .extension-editor .content .feature-contributions a { color: ${e}; }`));let t=a.getColor(Mvt);t&&(i.addRule(`.monaco-workbench .extension-editor .content .details .additional-details-container .resources-container a.resource:hover,
			.monaco-workbench .extension-editor .content .details .additional-details-container .resources-container a.resource:active { color: ${t}; }`),i.addRule(`.monaco-workbench .extension-editor .content .feature-contributions a:hover,
			.monaco-workbench .extension-editor .content .feature-contributions a:active { color: ${t}; }`));let o=a.getColor(uj);o&&i.addRule(`.monaco-workbench .extension-editor .content > .details > .additional-details-container .categories-container > .categories > .category.clickable:hover { background-color: ${o}; border-color: ${o}; }`);let n=a.getColor(__);n&&i.addRule(`.monaco-workbench .extension-editor .content > .details > .additional-details-container .categories-container > .categories > .category.clickable:hover { color: ${n}; }`)});function GMi(a){let i=a.get(ee).activeEditorPane;return i instanceof LW?i:null}var G0e=class extends x{constructor(i,e,t,o,n,r){super(),n.isWorkspaceTrustEnabled()&&r.workspaceTrustInitialized.then(()=>{let s=new class{async participate(l){if(l)await o.updateExtensionsEnablementsWhenWorkspaceTrustChanges();else if(t.remoteAuthority)e.reload();else{let c=await i.stopExtensionHosts(d(10149,null));await o.updateExtensionsEnablementsWhenWorkspaceTrustChanges(),c&&i.startExtensionHosts()}}};this._register(r.addWorkspaceTrustTransitionParticipant(s))})}};G0e=I([m(0,lt),m(1,Zt),m(2,At),m(3,Js),m(4,kR),m(5,Nr)],G0e);var pyo="extensionsAssistant/importantRecommendationsIgnore",myo="extensionsAssistant/workspaceRecommendationsIgnore",qMi=class extends x{constructor(e,t,o,n){super();this.severity=e;this.message=t;this.choices=o;this.notificationService=n;this._onDidClose=this._register(new E);this.onDidClose=this._onDidClose.event;this._onDidChangeVisibility=this._register(new E);this.onDidChangeVisibility=this._onDidChangeVisibility.event;this.cancelled=!1;this.onDidCloseDisposable=this._register(new me);this.onDidChangeVisibilityDisposable=this._register(new me)}show(){this.notificationHandle||this.updateNotificationHandle(this.notificationService.prompt(this.severity,this.message,this.choices,{sticky:!0,priority:1,onCancel:()=>this.cancelled=!0}))}hide(){this.notificationHandle&&(this.onDidCloseDisposable.clear(),this.notificationHandle.close(),this.cancelled=!1,this.updateNotificationHandle(this.notificationService.prompt(this.severity,this.message,this.choices,{priority:2,onCancel:()=>this.cancelled=!0})))}isCancelled(){return this.cancelled}updateNotificationHandle(e){this.onDidCloseDisposable.clear(),this.onDidChangeVisibilityDisposable.clear(),this.notificationHandle=e,this.onDidCloseDisposable.value=this.notificationHandle.onDidClose(()=>{this.onDidCloseDisposable.dispose(),this.onDidChangeVisibilityDisposable.dispose(),this._onDidClose.fire(),this._onDidClose.dispose(),this._onDidChangeVisibility.dispose()}),this.onDidChangeVisibilityDisposable.value=this.notificationHandle.onDidChangeVisibility(t=>this._onDidChangeVisibility.fire(t))}},q0e=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this.configurationService=e;this.storageService=t;this.notificationService=o;this.telemetryService=n;this.extensionsWorkbenchService=r;this.extensionManagementService=s;this.extensionEnablementService=l;this.extensionIgnoredRecommendationsService=c;this.userDataSyncEnablementService=u;this.workbenchEnvironmentService=p;this.uriIdentityService=h;this.recommendedExtensions=[];this.recommendationSources=[];this.pendingNotificaitons=[]}get ignoredRecommendations(){return zo([...JSON.parse(this.storageService.get(pyo,0,"[]"))].map(e=>e.toLowerCase()))}hasToIgnoreRecommendationNotifications(){let e=this.configurationService.getValue("extensions");return e.ignoreRecommendations||!!e.showRecommendationsOnlyOnDemand}async promptImportantExtensionsInstallNotification(e){let t=[...this.extensionIgnoredRecommendationsService.ignoredRecommendations,...this.ignoredRecommendations],o=e.extensions.filter(n=>!t.includes(n));return o.length?this.promptRecommendationsNotification({...e,extensions:o},{onDidInstallRecommendedExtensions:n=>n.forEach(r=>this.telemetryService.publicLog2("extensionRecommendations:popup",{userReaction:"install",extensionId:r.identifier.id,source:Lrt(e.source)})),onDidShowRecommendedExtensions:n=>n.forEach(r=>this.telemetryService.publicLog2("extensionRecommendations:popup",{userReaction:"show",extensionId:r.identifier.id,source:Lrt(e.source)})),onDidCancelRecommendedExtensions:n=>n.forEach(r=>this.telemetryService.publicLog2("extensionRecommendations:popup",{userReaction:"cancelled",extensionId:r.identifier.id,source:Lrt(e.source)})),onDidNeverShowRecommendedExtensionsAgain:n=>{for(let r of n)this.addToImportantRecommendationsIgnore(r.identifier.id),this.telemetryService.publicLog2("extensionRecommendations:popup",{userReaction:"neverShowAgain",extensionId:r.identifier.id,source:Lrt(e.source)});this.notificationService.prompt(ft.Info,d(10175,null),[{label:d(10174,null),run:()=>this.setIgnoreRecommendationsConfig(!0)},{label:d(10178,null),run:()=>this.setIgnoreRecommendationsConfig(!1)}])}}):"ignored"}async promptWorkspaceRecommendations(e){if(this.storageService.getBoolean(myo,1,!1))return;let t=await this.extensionManagementService.getInstalled();t=t.filter(o=>this.extensionEnablementService.getEnablementState(o)!==1),e=e.filter(o=>t.every(n=>Fe(o)?!Ut({id:o},n.identifier):!this.uriIdentityService.extUri.isEqual(o,n.location))),e.length&&await this.promptRecommendationsNotification({extensions:e,source:2,name:d(10181,null)},{onDidInstallRecommendedExtensions:()=>this.telemetryService.publicLog2("extensionWorkspaceRecommendations:popup",{userReaction:"install"}),onDidShowRecommendedExtensions:()=>this.telemetryService.publicLog2("extensionWorkspaceRecommendations:popup",{userReaction:"show"}),onDidCancelRecommendedExtensions:()=>this.telemetryService.publicLog2("extensionWorkspaceRecommendations:popup",{userReaction:"cancelled"}),onDidNeverShowRecommendedExtensionsAgain:()=>{this.telemetryService.publicLog2("extensionWorkspaceRecommendations:popup",{userReaction:"neverShowAgain"}),this.storageService.store(myo,!0,1,1)}})}async promptRecommendationsNotification({extensions:e,source:t,name:o,searchValue:n},r){if(this.hasToIgnoreRecommendationNotifications())return"ignored";if(t===3&&this.workbenchEnvironmentService.remoteAuthority)return"incompatibleWindow";if(t===3&&(this.recommendationSources.includes(3)||this.recommendationSources.length>=2))return"toomany";if(this.recommendationSources.push(t),t===3&&e.every(p=>Fe(p)&&this.recommendedExtensions.includes(p)))return"ignored";let s=await this.getInstallableExtensions(e);if(!s.length)return"ignored";this.recommendedExtensions=zo([...this.recommendedExtensions,...e.filter(Fe)]);let l="";if(s.length===1)l=d(10170,null,s[0].displayName,s[0].publisherDisplayName);else{let p=[...s.reduce((h,g)=>h.add(g.publisherDisplayName),new Set)];p.length>2?l=d(10171,null,p[0],p[1]):p.length===2?l=d(10173,null,p[0],p[1]):l=d(10172,null,p[0])}let c=d(10179,null,l,o);t===3&&(c=d(10169,null,o,l)),n||(n=t===2?"@recommended":s.map(p=>`@id:${p.identifier.id}`).join(" "));let u=t===2?d(10166,null):s.length>1?d(10167,null):d(10168,null);return oae([this._registerP(this.showRecommendationsNotification(s,c,n,u,t,r)),this._registerP(this.waitUntilRecommendationsAreInstalled(s))])}showRecommendationsNotification(e,t,o,n,r,{onDidInstallRecommendedExtensions:s,onDidShowRecommendedExtensions:l,onDidCancelRecommendedExtensions:c,onDidNeverShowRecommendedExtensionsAgain:u}){return Ln(async p=>{let h=!1,g=[],f=async v=>{this.extensionsWorkbenchService.openSearch(o),s(e);let b=[],S=[];for(let y of e)y.gallery?b.push(y.gallery):y.resourceExtension&&S.push(y);await dn.settled([dn.settled(e.map(y=>this.extensionsWorkbenchService.open(y,{pinned:!0}))),b.length?this.extensionManagementService.installGalleryExtensions(b.map(y=>({extension:y,options:{isMachineScoped:v}}))):Promise.resolve(),S.length?Promise.allSettled(S.map(y=>this.extensionsWorkbenchService.install(y))):Promise.resolve()])};g.push({label:d(10176,null),run:()=>f(!1),menu:this.userDataSyncEnablementService.isEnabled()&&this.userDataSyncEnablementService.isResourceEnabled("extensions")?[{label:d(10177,null),run:()=>f(!0)}]:void 0}),g.push({label:d(10180,null),run:async()=>{l(e);for(let v of e)this.extensionsWorkbenchService.open(v,{pinned:!0});this.extensionsWorkbenchService.openSearch(o)}},{label:n,isSecondary:!0,run:()=>{u(e)}});try{h=await this.doShowRecommendationsNotification(ft.Info,t,g,r,p)}catch(v){if(!ao(v))throw v}return h?"reacted":(c(e),"cancelled")})}waitUntilRecommendationsAreInstalled(e){let t=[],o=new N;return Ln(async n=>(o.add(n.onCancellationRequested(r=>o.dispose())),new Promise((r,s)=>{o.add(this.extensionManagementService.onInstallExtension(l=>{t.push(l.identifier.id.toLowerCase()),e.every(c=>t.includes(c.identifier.id.toLowerCase()))&&r("reacted")}))})))}async doShowRecommendationsNotification(e,t,o,n,r){let s=new N;try{let l=s.add(new qMi(e,t,o,this.notificationService));if(s.add(U.once(U.filter(l.onDidChangeVisibility,c=>!c))(()=>this.showNextNotification())),this.visibleNotification){let c=this.pendingNotificaitons.length;s.add(r.onCancellationRequested(()=>this.pendingNotificaitons.splice(c,1))),this.pendingNotificaitons.push({recommendationsNotification:l,source:n,token:r}),n!==3&&n<=this.visibleNotification.source&&this.hideVisibleNotification(3e3)}else this.visibleNotification={recommendationsNotification:l,source:n,from:Date.now()},l.show();return await Va(new Promise(c=>s.add(U.once(l.onDidClose)(c))),r),!l.isCancelled()}finally{s.dispose()}}showNextNotification(){let e=this.getNextPendingNotificationIndex(),[t]=e>-1?this.pendingNotificaitons.splice(e,1):[];Li(t?500:0).then(()=>{this.unsetVisibileNotification(),t&&(this.visibleNotification={recommendationsNotification:t.recommendationsNotification,source:t.source,from:Date.now()},t.recommendationsNotification.show())})}getNextPendingNotificationIndex(){let e=this.pendingNotificaitons.length-1;if(this.pendingNotificaitons.length)for(let t=0;t<this.pendingNotificaitons.length;t++)this.pendingNotificaitons[t].source<=this.pendingNotificaitons[e].source&&(e=t);return e}hideVisibleNotification(e){if(this.visibleNotification&&!this.hideVisibleNotificationPromise){let t=this.visibleNotification;this.hideVisibleNotificationPromise=Li(Math.max(e-(Date.now()-t.from),0)),this.hideVisibleNotificationPromise.then(()=>t.recommendationsNotification.hide())}}unsetVisibileNotification(){this.hideVisibleNotificationPromise?.cancel(),this.hideVisibleNotificationPromise=void 0,this.visibleNotification=void 0}async getInstallableExtensions(e){let t=[];if(e.length){let o=[],n=[];for(let r of e)typeof r=="string"?o.push(r):n.push(r);if(o.length){let r=await this.extensionsWorkbenchService.getExtensions(o.map(s=>({id:s})),{source:"install-recommendations"},Se.None);for(let s of r)s.gallery&&await this.extensionManagementService.canInstall(s.gallery)===!0&&t.push(s)}if(n.length){let r=await this.extensionsWorkbenchService.getResourceExtensions(n,!0);for(let s of r)await this.extensionsWorkbenchService.canInstall(s)===!0&&t.push(s)}}return t}addToImportantRecommendationsIgnore(e){let t=[...this.ignoredRecommendations];t.includes(e.toLowerCase())||(t.push(e.toLowerCase()),this.storageService.store(pyo,JSON.stringify(t),0,0))}setIgnoreRecommendationsConfig(e){this.configurationService.updateValue("extensions.ignoreRecommendations",e)}_registerP(e){return this._register(Z(()=>e.cancel())),e}};q0e=I([m(0,B),m(1,ce),m(2,Ne),m(3,Te),m(4,Hi),m(5,ru),m(6,Js),m(7,Ok),m(8,Fl),m(9,At),m(10,ht)],q0e);var yx=class extends x{constructor(){super(...arguments);this._activationPromise=null}get activated(){return this._activationPromise!==null}activate(){return this._activationPromise||(this._activationPromise=this.doActivate()),this._activationPromise}};var $0e=class extends yx{constructor(e){super();this.extensionTipsService=e;this._otherTips=[];this._importantTips=[]}get otherRecommendations(){return this._otherTips.map(e=>this.toExtensionRecommendation(e))}get importantRecommendations(){return this._importantTips.map(e=>this.toExtensionRecommendation(e))}get recommendations(){return[...this.importantRecommendations,...this.otherRecommendations]}getRecommendations(e){let t=this._importantTips.filter(n=>n.exeName.toLowerCase()===e.toLowerCase()).map(n=>this.toExtensionRecommendation(n)),o=this._otherTips.filter(n=>n.exeName.toLowerCase()===e.toLowerCase()).map(n=>this.toExtensionRecommendation(n));return{important:t,others:o}}async doActivate(){this._otherTips=await this.extensionTipsService.getOtherExecutableBasedTips(),await this.fetchImportantExeBasedRecommendations()}async fetchImportantExeBasedRecommendations(){return this._importantExeBasedRecommendations||(this._importantExeBasedRecommendations=this.doFetchImportantExeBasedRecommendations()),this._importantExeBasedRecommendations}async doFetchImportantExeBasedRecommendations(){let e=new Map;return this._importantTips=await this.extensionTipsService.getImportantExecutableBasedTips(),this._importantTips.forEach(t=>e.set(t.extensionId.toLowerCase(),t)),e}toExtensionRecommendation(e){return{extension:e.extensionId.toLowerCase(),reason:{reasonId:2,reasonText:d(10105,null,e.exeFriendlyName)}}}};$0e=I([m(0,jke)],$0e);var $Mi=".vscode/extensions",j0e=class extends yx{constructor(e,t,o,n,r,s){super();this.workspaceExtensionsConfigService=e;this.contextService=t;this.uriIdentityService=o;this.fileService=n;this.workbenchExtensionManagementService=r;this.notificationService=s;this._recommendations=[];this._onDidChangeRecommendations=this._register(new E);this.onDidChangeRecommendations=this._onDidChangeRecommendations.event;this._ignoredRecommendations=[];this.workspaceExtensions=[];this.onDidChangeWorkspaceExtensionsScheduler=this._register(new Dt(()=>this.onDidChangeWorkspaceExtensionsFolders(),1e3))}get recommendations(){return this._recommendations}get ignoredRecommendations(){return this._ignoredRecommendations}async doActivate(){this.workspaceExtensions=await this.fetchWorkspaceExtensions(),await this.fetch(),this._register(this.workspaceExtensionsConfigService.onDidChangeExtensionsConfigs(()=>this.onDidChangeExtensionsConfigs()));for(let e of this.contextService.getWorkspace().folders)this._register(this.fileService.watch(this.uriIdentityService.extUri.joinPath(e.uri,$Mi)));this._register(this.contextService.onDidChangeWorkspaceFolders(()=>this.onDidChangeWorkspaceExtensionsScheduler.schedule())),this._register(this.fileService.onDidFilesChange(e=>{this.contextService.getWorkspace().folders.some(t=>e.affects(this.uriIdentityService.extUri.joinPath(t.uri,$Mi),1,2))&&this.onDidChangeWorkspaceExtensionsScheduler.schedule()}))}async onDidChangeWorkspaceExtensionsFolders(){let e=this.workspaceExtensions;this.workspaceExtensions=await this.fetchWorkspaceExtensions(),$i(e,this.workspaceExtensions,(t,o)=>this.uriIdentityService.extUri.isEqual(t,o))||this.onDidChangeExtensionsConfigs()}async fetchWorkspaceExtensions(){let e=[];for(let t of this.contextService.getWorkspace().folders){let o=this.uriIdentityService.extUri.joinPath(t.uri,$Mi);try{let n=await this.fileService.resolve(o);for(let r of n.children??[])r.isDirectory&&e.push(r.resource)}catch{}}return e.length?(await this.workbenchExtensionManagementService.getExtensions(e)).map(o=>o.location):[]}async fetch(){let e=await this.workspaceExtensionsConfigService.getExtensionsConfigs(),{invalidRecommendations:t,message:o}=await this.validateExtensions(e);t.length&&this.notificationService.warn(`The ${t.length} extension(s) below, in workspace recommendations have issues:
${o}`),this._recommendations=[],this._ignoredRecommendations=[];for(let n of e){if(n.unwantedRecommendations)for(let r of n.unwantedRecommendations)t.indexOf(r)===-1&&this._ignoredRecommendations.push(r);if(n.recommendations)for(let r of n.recommendations)t.indexOf(r)===-1&&this._recommendations.push({extension:r,reason:{reasonId:0,reasonText:d(10699,null)}})}for(let n of this.workspaceExtensions)this._recommendations.push({extension:n,reason:{reasonId:0,reasonText:d(10699,null)}})}async validateExtensions(e){let t=[],o=[],n="",r=zo(e.flatMap(({recommendations:l})=>l||[])),s=new RegExp(vF);for(let l of r)s.test(l)?t.push(l):(o.push(l),n+=`${l} (bad format) Expected: <provider>.<name>
`);return{validRecommendations:t,invalidRecommendations:o,message:n}}async onDidChangeExtensionsConfigs(){await this.fetch(),this._onDidChangeRecommendations.fire()}};j0e=I([m(0,Z2),m(1,Pe),m(2,ht),m(3,fe),m(4,ru),m(5,Ne)],j0e);var fyo="fileBasedRecommendations/promptedRecommendations",vyo="extensionsAssistant/recommendations",Xsn=1e3*60*60*24,Jsn=1e3,Q0e=class extends yx{constructor(e,t,o,n,r,s,l,c,u){super();this.extensionsWorkbenchService=e;this.modelService=t;this.languageService=o;this.storageService=r;this.extensionRecommendationNotificationService=s;this.extensionIgnoredRecommendationsService=l;this.workspaceContextService=c;this.untitledTextEditorService=u;this.recommendationsByPattern=new Map;this.fileBasedRecommendations=new Map;this.fileBasedImportantRecommendations=new Set;if(this.fileOpenRecommendations={},n.extensionRecommendations)for(let[p,h]of Object.entries(n.extensionRecommendations))h.onFileOpen&&(this.fileOpenRecommendations[p.toLowerCase()]=h.onFileOpen)}get recommendations(){let e=[];return[...this.fileBasedRecommendations.keys()].sort((t,o)=>{if(this.fileBasedRecommendations.get(t).recommendedTime===this.fileBasedRecommendations.get(o).recommendedTime){if(this.fileBasedImportantRecommendations.has(t))return-1;if(this.fileBasedImportantRecommendations.has(o))return 1}return this.fileBasedRecommendations.get(t).recommendedTime>this.fileBasedRecommendations.get(o).recommendedTime?-1:1}).forEach(t=>{e.push({extension:t,reason:{reasonId:1,reasonText:d(10696,null)}})}),e}get importantRecommendations(){return this.recommendations.filter(e=>this.fileBasedImportantRecommendations.has(e.extension))}get otherRecommendations(){return this.recommendations.filter(e=>!this.fileBasedImportantRecommendations.has(e.extension))}async doActivate(){if(Of(this.fileOpenRecommendations))return;await this.extensionsWorkbenchService.whenInitialized;let e=this.getCachedRecommendations(),t=Date.now();Object.entries(e).forEach(([o,n])=>{(t-n)/Xsn<=7&&this.fileOpenRecommendations[o]&&this.fileBasedRecommendations.set(o.toLowerCase(),{recommendedTime:n})}),this._register(this.modelService.onModelAdded(o=>this.onModelAdded(o))),this.modelService.getModels().forEach(o=>this.onModelAdded(o))}onModelAdded(e){let t=e.uri.scheme===Q.vscodeNotebookCell?Zo.parse(e.uri)?.notebook:e.uri;if(!t)return;let o=zo([Q.untitled,Q.file,Q.vscodeRemote,...this.workspaceContextService.getWorkspace().folders.map(n=>n.uri.scheme)]);!t||!o.includes(t.scheme)||tn(()=>this.promptImportantRecommendations(t,e),0,this._store)}promptImportantRecommendations(e,t,o){if(t.isDisposed())return;let n=es(e).toLowerCase();o=o??this.recommendationsByPattern.get(n)??this.fileOpenRecommendations;let r=Object.entries(o);if(r.length===0)return;let s=new Map,l=this.extensionsWorkbenchService.local,c={},u={},p={},h=!1,g=t.getLanguageId(),f=this.untitledTextEditorService.get(e),v=!f||f.hasLanguageSetExplicitly||t.getValueLength()>Jsn;for(let[b,S]of r){let y=[],w=[],k=[];for(let T of S){let P=!1,O=!1,V=!!T.languages,H=!!T.contentPattern;(V||H)&&y.push(T),V&&v&&T.languages.includes(g)&&(P=!0);let G=T.pathGlob;G&&((s.get(G)??Ed(G,e.with({fragment:""}).toString(),{ignoreCase:!0}))&&(O=!0),s.set(G,O));let $=P||O;n&&!$||($&&T.whenInstalled&&(T.whenInstalled.every(J=>l.some(ae=>Ut({id:J},ae.identifier)))||($=!1)),$&&T.whenNotInstalled&&l.some(J=>T.whenNotInstalled?.some(ae=>Ut({id:ae},J.identifier)))&&($=!1),$&&H&&(t.findMatches(T.contentPattern,!1,!0,!1,null,!1).length||($=!1)),$?(w.push(T),y.pop()):(V||H)&&(k.push(T),V&&(h=!0)))}w.length&&(u[b]=w),k.length&&(p[b]=k),y.length&&(c[b]=y)}if(n&&this.recommendationsByPattern.set(n,c),Object.keys(p).length&&h){let b=new N;b.add(t.onDidChangeLanguage(()=>{tn(()=>{b.isDisposed||(this.promptImportantRecommendations(e,t,p),b.dispose())},0,b)})),b.add(t.onWillDispose(()=>b.dispose()))}Object.keys(u).length&&this.promptFromRecommendations(e,t,u)}promptFromRecommendations(e,t,o){let n=!1,r=new Set,s=new Set;for(let[u,p]of Object.entries(o))for(let h of p)s.add(u),h.important&&(r.add(u),this.fileBasedImportantRecommendations.add(u)),h.languages&&(n=!0);for(let u of s){let p=this.fileBasedRecommendations.get(u)||{recommendedTime:Date.now(),sources:[]};p.recommendedTime=Date.now(),this.fileBasedRecommendations.set(u,p)}if(this.storeCachedRecommendations(),this.extensionRecommendationNotificationService.hasToIgnoreRecommendationNotifications())return;let l=t.getLanguageId(),c=this.languageService.getLanguageName(l);r.size&&this.promptRecommendedExtensionForFileType(c&&n&&l!==$r?d(10697,null,c):He(e),l,[...r])}promptRecommendedExtensionForFileType(e,t,o){if(o=this.filterIgnoredOrNotAllowed(o),o.length===0)return!1;o=this.filterInstalled(o,this.extensionsWorkbenchService.local).filter(r=>this.fileBasedImportantRecommendations.has(r));let n=t!==$r?this.getPromptedRecommendations()[t]:void 0;return n&&(o=o.filter(r=>!n.includes(r))),o.length===0?!1:(this.promptImportantExtensionsInstallNotification(o,e,t),!0)}async promptImportantExtensionsInstallNotification(e,t,o){try{await this.extensionRecommendationNotificationService.promptImportantExtensionsInstallNotification({extensions:e,name:t,source:1})==="reacted"&&this.addToPromptedRecommendations(o,e)}catch{}}getPromptedRecommendations(){return JSON.parse(this.storageService.get(fyo,0,"{}"))}addToPromptedRecommendations(e,t){let o=this.getPromptedRecommendations();o[e]=zo([...o[e]??[],...t]),this.storageService.store(fyo,JSON.stringify(o),0,0)}filterIgnoredOrNotAllowed(e){let t=[...this.extensionIgnoredRecommendationsService.ignoredRecommendations,...this.extensionRecommendationNotificationService.ignoredRecommendations];return e.filter(o=>!t.includes(o))}filterInstalled(e,t){let o=t.reduce((n,r)=>(r.enablementState!==1&&n.add(r.identifier.id.toLowerCase()),n),new Set);return e.filter(n=>!o.has(n.toLowerCase()))}getCachedRecommendations(){let e=JSON.parse(this.storageService.get(vyo,0,"[]"));Array.isArray(e)&&(e=e.reduce((o,n)=>(o[n]=Date.now(),o),{}));let t={};return Object.entries(e).forEach(([o,n])=>{typeof n=="number"&&(t[o.toLowerCase()]=n)}),t}storeCachedRecommendations(){let e={};this.fileBasedRecommendations.forEach((t,o)=>e[o]=t.recommendedTime),this.storageService.store(vyo,JSON.stringify(e),0,1)}};Q0e=I([m(0,Hi),m(1,Tt),m(2,_t),m(3,tt),m(4,ce),m(5,moe),m(6,Ok),m(7,Pe),m(8,fD)],Q0e);var Y0e=class extends yx{constructor(e){super();this.productService=e;this._recommendations=[]}get recommendations(){return this._recommendations}async doActivate(){this.productService.keymapExtensionTips&&(this._recommendations=this.productService.keymapExtensionTips.map(e=>({extension:e.toLowerCase(),reason:{reasonId:6,reasonText:""}})))}};Y0e=I([m(0,tt)],Y0e);var X0e=class extends yx{constructor(e){super();this.productService=e;this._recommendations=[]}get recommendations(){return this._recommendations}async doActivate(){this.productService.languageExtensionTips&&(this._recommendations=this.productService.languageExtensionTips.map(e=>({extension:e.toLowerCase(),reason:{reasonId:6,reasonText:""}})))}};X0e=I([m(0,tt)],X0e);var J0e=class extends yx{constructor(e,t){super();this.extensionTipsService=e;this.workspaceContextService=t;this.importantTips=[];this.otherTips=[];this._onDidChangeRecommendations=this._register(new E);this.onDidChangeRecommendations=this._onDidChangeRecommendations.event;this._otherRecommendations=[];this._importantRecommendations=[]}get otherRecommendations(){return this._otherRecommendations}get importantRecommendations(){return this._importantRecommendations}get recommendations(){return[...this.importantRecommendations,...this.otherRecommendations]}async doActivate(){await this.fetch(),this._register(this.workspaceContextService.onDidChangeWorkspaceFolders(e=>this.onWorkspaceFoldersChanged(e)))}async fetch(){let e=this.workspaceContextService.getWorkspace(),t=new Map,o=new Map;for(let n of e.folders){let r=await this.extensionTipsService.getConfigBasedTips(n.uri);for(let s of r)s.important?t.set(s.extensionId,s):o.set(s.extensionId,s)}this.importantTips=[...t.values()],this.otherTips=[...o.values()].filter(n=>!t.has(n.extensionId)),this._otherRecommendations=this.otherTips.map(n=>this.toExtensionRecommendation(n)),this._importantRecommendations=this.importantTips.map(n=>this.toExtensionRecommendation(n))}async onWorkspaceFoldersChanged(e){if(e.added.length){let t=this.importantTips;await this.fetch(),this.importantTips.some(o=>t.every(n=>o.extensionId!==n.extensionId))&&this._onDidChangeRecommendations.fire()}}toExtensionRecommendation(e){return{extension:e.extensionId,reason:{reasonId:3,reasonText:d(10104,null)},whenNotInstalled:e.whenNotInstalled}}};J0e=I([m(0,jke),m(1,Pe)],J0e);var Z0e=class extends yx{constructor(e,t){super();this.productService=e;this.extensionManagementServerService=t;this._recommendations=[]}get recommendations(){return this._recommendations}async doActivate(){this.extensionManagementServerService.webExtensionManagementServer&&!this.extensionManagementServerService.localExtensionManagementServer&&!this.extensionManagementServerService.remoteExtensionManagementServer&&Array.isArray(this.productService.webExtensionTips)&&(this._recommendations=this.productService.webExtensionTips.map(t=>({extension:t.toLowerCase(),reason:{reasonId:6,reasonText:d(10698,null,this.productService.nameLong)}})))}};Z0e=I([m(0,tt),m(1,Ec)],Z0e);var eWe=class extends yx{constructor(e){super();this.productService=e;this._recommendations=[]}get recommendations(){return this._recommendations}async doActivate(){let e={...this.productService.remoteExtensionTips,...this.productService.virtualWorkspaceExtensionTips},t=u_(om);this._recommendations=Object.values(e).filter(({supportedPlatforms:o})=>!o||o.includes(t)).map(o=>({extension:o.extensionId.toLowerCase(),reason:{reasonId:6,reasonText:""}}))}};eWe=I([m(0,tt)],eWe);var tWe=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this.lifecycleService=t;this.galleryService=o;this.telemetryService=n;this.environmentService=r;this.extensionManagementService=s;this.extensionRecommendationsManagementService=l;this.extensionRecommendationNotificationService=c;this.extensionsWorkbenchService=u;this.remoteExtensionsScannerService=p;this.userDataInitializationService=h;this._onDidChangeRecommendations=this._register(new E);this.onDidChangeRecommendations=this._onDidChangeRecommendations.event;if(this.workspaceRecommendations=this._register(e.createInstance(j0e)),this.fileBasedRecommendations=this._register(e.createInstance(Q0e)),this.configBasedRecommendations=this._register(e.createInstance(J0e)),this.exeBasedRecommendations=this._register(e.createInstance($0e)),this.keymapRecommendations=this._register(e.createInstance(Y0e)),this.webRecommendations=this._register(e.createInstance(Z0e)),this.languageRecommendations=this._register(e.createInstance(X0e)),this.remoteRecommendations=this._register(e.createInstance(eWe)),!this.isEnabled()){this.sessionSeed=0,this.activationPromise=Promise.resolve();return}this.sessionSeed=+new Date,this.activationPromise=this.activate(),this._register(this.extensionManagementService.onDidInstallExtensions(g=>this.onDidInstallExtensions(g)))}async activate(){try{await Promise.allSettled([this.remoteExtensionsScannerService.whenExtensionsReady(),this.userDataInitializationService.whenInitializationFinished(),this.lifecycleService.when(3)])}catch{}await Promise.all([this.workspaceRecommendations.activate(),this.configBasedRecommendations.activate(),this.fileBasedRecommendations.activate(),this.keymapRecommendations.activate(),this.languageRecommendations.activate(),this.webRecommendations.activate(),this.remoteRecommendations.activate()]),this._register(U.any(this.workspaceRecommendations.onDidChangeRecommendations,this.configBasedRecommendations.onDidChangeRecommendations,this.extensionRecommendationsManagementService.onDidChangeIgnoredRecommendations)(()=>this._onDidChangeRecommendations.fire())),this.promptWorkspaceRecommendations()}isEnabled(){return this.galleryService.isEnabled()&&!this.environmentService.isExtensionDevelopment}async activateProactiveRecommendations(){await Promise.all([this.exeBasedRecommendations.activate(),this.configBasedRecommendations.activate()])}getAllRecommendationsWithReason(){this.activateProactiveRecommendations();let e=Object.create(null),t=[...this.configBasedRecommendations.recommendations,...this.exeBasedRecommendations.recommendations,...this.fileBasedRecommendations.recommendations,...this.workspaceRecommendations.recommendations,...this.keymapRecommendations.recommendations,...this.languageRecommendations.recommendations,...this.webRecommendations.recommendations];for(let{extension:o,reason:n}of t)Fe(o)&&this.isExtensionAllowedToBeRecommended(o)&&(e[o.toLowerCase()]=n);return e}async getConfigBasedRecommendations(){return await this.configBasedRecommendations.activate(),{important:this.toExtensionIds(this.configBasedRecommendations.importantRecommendations),others:this.toExtensionIds(this.configBasedRecommendations.otherRecommendations)}}async getOtherRecommendations(){await this.activationPromise,await this.activateProactiveRecommendations();let e=[...this.configBasedRecommendations.otherRecommendations,...this.exeBasedRecommendations.otherRecommendations,...this.webRecommendations.recommendations],t=this.toExtensionIds(e);return R9(t,this.sessionSeed),t}async getImportantRecommendations(){await this.activateProactiveRecommendations();let e=[...this.fileBasedRecommendations.importantRecommendations,...this.configBasedRecommendations.importantRecommendations,...this.exeBasedRecommendations.importantRecommendations],t=this.toExtensionIds(e);return R9(t,this.sessionSeed),t}getKeymapRecommendations(){return this.toExtensionIds(this.keymapRecommendations.recommendations)}getLanguageRecommendations(){return this.toExtensionIds(this.languageRecommendations.recommendations)}getRemoteRecommendations(){return this.toExtensionIds(this.remoteRecommendations.recommendations)}async getWorkspaceRecommendations(){if(!this.isEnabled())return[];await this.workspaceRecommendations.activate();let e=[];for(let{extension:t}of this.workspaceRecommendations.recommendations)Fe(t)?!e.includes(t.toLowerCase())&&this.isExtensionAllowedToBeRecommended(t)&&e.push(t.toLowerCase()):e.push(t);return e}async getExeBasedRecommendations(e){await this.exeBasedRecommendations.activate();let{important:t,others:o}=e?this.exeBasedRecommendations.getRecommendations(e):{important:this.exeBasedRecommendations.importantRecommendations,others:this.exeBasedRecommendations.otherRecommendations};return{important:this.toExtensionIds(t),others:this.toExtensionIds(o)}}getFileBasedRecommendations(){return this.toExtensionIds(this.fileBasedRecommendations.recommendations)}onDidInstallExtensions(e){for(let t of e)if(t.source&&!A.isUri(t.source)&&t.operation===2){let n=(this.getAllRecommendationsWithReason()||{})[t.source.identifier.id.toLowerCase()];n&&this.telemetryService.publicLog("extensionGallery:install:recommendations",{...t.source.telemetryData,recommendationReason:n.reasonId})}}toExtensionIds(e){let t=[];for(let{extension:o}of e)Fe(o)&&this.isExtensionAllowedToBeRecommended(o)&&!t.includes(o.toLowerCase())&&t.push(o.toLowerCase());return t}isExtensionAllowedToBeRecommended(e){return!this.extensionRecommendationsManagementService.ignoredRecommendations.includes(e.toLowerCase())}async promptWorkspaceRecommendations(){let e=await this.extensionsWorkbenchService.queryLocal(),t=[...this.workspaceRecommendations.recommendations,...this.configBasedRecommendations.importantRecommendations.filter(o=>!o.whenNotInstalled||o.whenNotInstalled.every(n=>e.every(r=>!Ut(r.identifier,{id:n}))))].map(({extension:o})=>o).filter(o=>!Fe(o)||this.isExtensionAllowedToBeRecommended(o));t.length&&(await this._registerP(Li(5e3)),await this.extensionRecommendationNotificationService.promptWorkspaceRecommendations(t))}_registerP(e){return this._register(Z(()=>e.cancel())),e}};tWe=I([m(0,F),m(1,ji),m(2,fa),m(3,Te),m(4,Eo),m(5,Cs),m(6,Ok),m(7,moe),m(8,Hi),m(9,tG),m(10,U3)],tWe);var iWe=class{constructor(i,e,t){let o={location:10,title:d(10492,null)},n,r=0;this._listener=i.onWillActivateByEvent(s=>{t.trace("onWillActivateByEvent: ",s.event),n||(n=new Ko,e.withProgress(o,l=>n.p)),r++,Promise.race([s.activation,Li(5e3,Se.None)]).finally(()=>{--r===0&&(n.complete(void 0),n=void 0)})})}dispose(){this._listener.dispose()}};iWe=I([m(0,lt),m(1,Fo),m(2,se)],iWe);var oWe=class extends x{constructor(e,t){super();this.extensionManagementService=e;this._register(t.completionProvider.register({language:"jsonc",pattern:"**/settings.json"},{_debugDisplayName:"extensionsCompletionProvider",provideCompletionItems:async(o,n,r,s)=>{let l=(p,h)=>{let g=p.getWordAtPosition(h);return g?new z(h.lineNumber,g.startColumn,h.lineNumber,g.endColumn):null},c=vJi(o.getValue(),o.getOffsetAt(n)),u=l(o,n)??z.fromPositions(n,n);if(c.path[0]==="extensions.supportUntrustedWorkspaces"&&c.path.length===2&&c.isAtPropertyKey){let p=[];try{p=Object.keys(jr(o.getValue())["extensions.supportUntrustedWorkspaces"])}catch{}return{suggestions:await this.provideSupportUntrustedWorkspacesExtensionProposals(p,u)}}return{suggestions:[]}}}))}async provideSupportUntrustedWorkspacesExtensionProposals(e,t){let o=[],r=(await this.extensionManagementService.getInstalled()).filter(s=>s.manifest.main).filter(s=>e.indexOf(s.identifier.id)===-1);if(r.length)o.push(...r.map(s=>{let l=`"${s.identifier.id}": {
	"supported": true,
	"version": "${s.manifest.version}"
},`;return{label:s.identifier.id,kind:13,insertText:l,filterText:l,range:t}}));else{let s=`"vscode.csharp": {
	"supported": true,
	"version": "0.0.0"
},`;o.push({label:d(10493,null),kind:13,insertText:s,filterText:s,range:t})}return o}};oWe=I([m(0,Cs),m(1,Qt)],oWe);var nWe=class extends x{constructor(e,t,o,n){super();this.extensionService=e;this.extensionsWorkbenchService=t;this.notificationService=o;this.hostService=n;$e.registerCommand("workbench.extensions.installMissingDependencies",()=>this.installMissingDependencies()),ve.appendMenuItem(D.CommandPalette,{command:{id:"workbench.extensions.installMissingDependencies",category:d(10495,null),title:d(10494,null)}})}async getUninstalledMissingDependencies(){let e=await this.getAllMissingDependencies(),t=await this.extensionsWorkbenchService.queryLocal();return e.filter(o=>t.every(n=>!Ut(n.identifier,{id:o})))}async getAllMissingDependencies(){await this.extensionService.whenInstalledExtensionsRegistered();let e=this.extensionService.extensions.reduce((o,n)=>(o.add(n.identifier.value.toLowerCase()),o),new Set),t=new Set;for(let o of this.extensionService.extensions)o.extensionDependencies&&o.extensionDependencies.forEach(n=>{e.has(n.toLowerCase())||t.add(n)});return[...t.values()]}async installMissingDependencies(){let e=await this.getUninstalledMissingDependencies();if(e.length){let t=await this.extensionsWorkbenchService.getExtensions(e.map(o=>({id:o})),Se.None);t.length&&(await dn.settled(t.map(o=>this.extensionsWorkbenchService.install(o))),this.notificationService.notify({severity:ft.Info,message:d(10496,null),actions:{primary:[new it("realod",d(10498,null),"",!0,()=>this.hostService.reload())]}}))}else this.notificationService.info(d(10497,null))}};nWe=I([m(0,lt),m(1,Hi),m(2,Ne),m(3,Zt)],nWe);var EQ=class extends Lh{constructor(e,t,o,n,r){super(EQ.PREFIX);this.extensionsWorkbenchService=e;this.galleryService=t;this.extensionsService=o;this.notificationService=n;this.logService=r}static{this.PREFIX="ext install "}_getPicks(e,t,o){if(!e)return[{label:d(10527,null)}];let n={label:d(10526,null,e),accept:()=>this.extensionsWorkbenchService.openSearch(e)};return/\./.test(e)?this.getPicksForExtensionId(e,n,o):[n]}async getPicksForExtensionId(e,t,o){try{let[n]=await this.galleryService.getExtensions([{id:e}],o);return o.isCancellationRequested?[]:n?[{label:d(10524,null,e),accept:()=>this.installExtension(n,e)}]:[t]}catch(n){return o.isCancellationRequested?[]:(this.logService.error(n),[t])}}async installExtension(e,t){try{await this.extensionsWorkbenchService.openSearch(`@id:${t}`),await this.extensionsService.installFromGallery(e)}catch(o){this.notificationService.error(o)}}};EQ=I([m(0,Hi),m(1,fa),m(2,Cs),m(3,Ne),m(4,se)],EQ);var TQ=class extends Lh{constructor(e){super(TQ.PREFIX);this.extensionsWorkbenchService=e}static{this.PREFIX="ext "}_getPicks(){return[{label:d(10525,null),accept:()=>this.extensionsWorkbenchService.openSearch("")}]}};TQ=I([m(0,Hi)],TQ);var YMi="none",jMi=class extends x{constructor(){super(...arguments);this._onFocus=this._register(new E);this.onFocus=this._onFocus.event;this._onBlur=this._register(new E);this.onBlur=this._onBlur.event;this.currentlyFocusedItems=[];this.filters={}}onFocusChange(e){this.currentlyFocusedItems.forEach(t=>this._onBlur.fire(t)),this.currentlyFocusedItems=e,this.currentlyFocusedItems.forEach(t=>this._onFocus.fire(t))}};function Zsn(a){if(a==="UpdateDate")return!0}var _Q=class extends Gs{},Lr=class extends _Q{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,P,O,V,H,G,$,J,ae){super({...t,showActions:2,maximumBodySize:e.flexibleHeight?V.getNumber(`${t.id}.size`,0,0)?void 0:0:void 0},n,r,f,T,P,s,O,l,g);this.options=e;this.notificationService=o;this.extensionService=c;this.extensionsWorkbenchService=u;this.extensionRecommendationsService=p;this.telemetryService=h;this.contextService=v;this.extensionManagementServerService=b;this.extensionManifestPropertiesService=S;this.extensionManagementService=y;this.workspaceService=w;this.productService=k;this.storageService=V;this.workspaceTrustManagementService=H;this.extensionEnablementService=G;this.extensionFeaturesManagementService=$;this.uriIdentityService=J;this.logService=ae;this.list=null;this.queryRequest=null;this.contextMenuActionRunner=this._register(new rs);this.options.onDidChangeTitle&&this._register(this.options.onDidChangeTitle(he=>this.updateTitle(he))),this._register(this.contextMenuActionRunner.onDidRun(({error:he})=>he&&this.notificationService.error(he))),this.registerActions()}static{this.RECENT_UPDATE_DURATION=10080*60*1e3}registerActions(){}renderHeader(e){e.classList.add("extension-view-header"),super.renderHeader(e),this.options.hideBadge||(this.badge=this._register(new _v(M(e,_(".count-badge-wrapper")),{},iI)))}renderBody(e){super.renderBody(e);let t=M(e,_(".message-container")),o=M(t,_("")),n=M(t,_(".message")),r=M(e,_(".extensions-list"));this.extensionsViewState=this._register(new jMi),this.list=this._register(this.instantiationService.createInstance(kie,r,this.id,{},this.extensionsViewState)).list,hoo.bindTo(this.list.contextKeyService),this._register(this.list.onDidChangeFocus(s=>this.extensionsViewState?.onFocusChange(di(s.elements)),this)),this.bodyTemplate={extensionsList:r,messageBox:n,messageContainer:t,messageSeverityIcon:o},this.queryResult&&this.setModel(this.queryResult.model)}layoutBody(e,t){super.layoutBody(e,t),this.bodyTemplate&&(this.bodyTemplate.extensionsList.style.height=e+"px"),this.list?.layout(e,t)}async show(e,t){if(this.queryRequest){if(!t&&this.queryRequest.query===e)return this.queryRequest.request;this.queryRequest.request.cancel(),this.queryRequest=null}this.queryResult&&(this.queryResult.disposables.dispose(),this.queryResult=void 0,this.extensionsViewState&&(this.extensionsViewState.filters={}));let o=oq.parse(e),n={sortOrder:0};switch(o.sortBy){case"installs":n.sortBy="InstallCount";break;case"rating":n.sortBy="WeightedRating";break;case"name":n.sortBy="Title";break;case"publishedDate":n.sortBy="PublishedDate";break;case"updateDate":n.sortBy="UpdateDate";break}let r=Ln(async s=>{try{this.queryResult=await this.query(o,n,s);let l=this.queryResult.model;return this.setModel(l,this.queryResult.message),this.queryResult.onDidChangeModel&&this.queryResult.disposables.add(this.queryResult.onDidChangeModel(c=>{this.queryResult&&(this.queryResult.model=c,this.updateModel(c))})),l}catch(l){let c=new Wm([]);return ao(l)||(this.logService.error(l),this.setModel(c,this.getMessage(l))),this.list?this.list.model:c}});return r.finally(()=>this.queryRequest=null),this.queryRequest={query:e,request:r},r}count(){return this.queryResult?.model.length??0}showEmptyModel(){let e=new Wm([]);return this.setModel(e),Promise.resolve(e)}async query(e,t,o){let n=/@id:(([a-z0-9A-Z][a-z0-9\-A-Z]*)\.([a-z0-9A-Z][a-z0-9\-A-Z]*))/g,r=[],s;for(;(s=n.exec(e.value))!==null;){let c=s[1];r.push(c)}if(r.length)return{model:await this.queryByIds(r,t,o),disposables:new N};if(Lr.isLocalExtensionsQuery(e.value,e.sortBy))return this.queryLocal(e,t);Lr.isSearchPopularQuery(e.value)?(e.value=e.value.replace("@popular",""),t.sortBy=t.sortBy?t.sortBy:"InstallCount"):Lr.isSearchRecentlyPublishedQuery(e.value)&&(e.value=e.value.replace("@recentlyPublished",""),t.sortBy=t.sortBy?t.sortBy:"PublishedDate");let l={...t,sortBy:Zsn(t.sortBy)?void 0:t.sortBy};return this.queryGallery(e,l,o)}async queryByIds(e,t,o){let n=e.reduce((l,c)=>(l.add(c.toLowerCase()),l),new Set),r=(await this.extensionsWorkbenchService.queryLocal(this.options.server)).filter(l=>n.has(l.identifier.id.toLowerCase())),s=r.length?e.filter(l=>r.every(c=>!Ut(c.identifier,{id:l}))):e;if(s.length){let l=await this.extensionsWorkbenchService.getExtensions(s.map(c=>({id:c})),{source:"queryById"},o);r.push(...l)}return new Wm(r)}async queryLocal(e,t){let o=await this.extensionsWorkbenchService.queryLocal(this.options.server),{extensions:n,canIncludeInstalledExtensions:r,description:s}=await this.filterLocal(o,this.extensionService.extensions,e,t),l=new N,c=l.add(new E);if(r){let u=!1;l.add(Z(()=>u=!0)),l.add(U.debounce(U.any(U.filter(this.extensionsWorkbenchService.onChange,p=>p?.state===1),this.extensionService.onDidChangeExtensions),()=>{})(async()=>{let p=this.options.server?this.extensionsWorkbenchService.installed.filter(g=>g.server===this.options.server):this.extensionsWorkbenchService.local,{extensions:h}=await this.filterLocal(p,this.extensionService.extensions,e,t);if(!u){let g=this.mergeAddedExtensions(n,h);g&&(n=g,c.fire(new Wm(n)))}}))}return{model:new Wm(n),message:s?{text:s,severity:ft.Info}:void 0,onDidChangeModel:c.event,disposables:l}}async filterLocal(e,t,o,n){let r=o.value,s=[],l,c=/@builtin/i.test(r),u=!c;return/@installed/i.test(r)?s=this.filterInstalledExtensions(e,t,o,n):/@outdated/i.test(r)?s=this.filterOutdatedExtensions(e,o,n):/@disabled/i.test(r)?s=this.filterDisabledExtensions(e,t,o,n,c):/@enabled/i.test(r)?s=this.filterEnabledExtensions(e,t,o,n,c):/@workspaceUnsupported/i.test(r)?s=this.filterWorkspaceUnsupportedExtensions(e,o,n):/@deprecated/i.test(o.value)?s=await this.filterDeprecatedExtensions(e,o,n):/@recentlyUpdated/i.test(o.value)?s=this.filterRecentlyUpdatedExtensions(e,o,n):/@restartrequired/i.test(o.value)?s=this.filterRestartRequiredExtensions(e,o,n):/@contribute:/i.test(o.value)?s=this.filterExtensionsByFeature(e,o):c&&(s=this.filterBuiltinExtensions(e,o,n)),{extensions:s,canIncludeInstalledExtensions:u,description:l}}filterBuiltinExtensions(e,t,o){let{value:n,includedCategories:r,excludedCategories:s}=this.parseCategories(t.value);n=n.replaceAll(/@builtin/gi,"").replaceAll(/@sort:(\w+)(-\w*)?/g,"").trim().toLowerCase();let l=e.filter(c=>c.isBuiltin&&(c.name.toLowerCase().indexOf(n)>-1||c.displayName.toLowerCase().indexOf(n)>-1)&&this.filterExtensionByCategory(c,r,s));return this.sortExtensions(l,o)}filterExtensionByCategory(e,t,o){return!t.length&&!o.length?!0:e.categories.length?o.length&&e.categories.some(n=>o.includes(n.toLowerCase()))?!1:e.categories.some(n=>t.includes(n.toLowerCase())):t.includes(YMi)}parseCategories(e){let t=[],o=[];return e=e.replace(/\bcategory:("([^"]*)"|([^"]\S*))(\s+|\b|$)/g,(n,r,s)=>{let l=(s||r||"").toLowerCase();return l.startsWith("-")?o.indexOf(l)===-1&&o.push(l):t.indexOf(l)===-1&&t.push(l),""}),{value:e,includedCategories:t,excludedCategories:o}}filterInstalledExtensions(e,t,o,n){let{value:r,includedCategories:s,excludedCategories:l}=this.parseCategories(o.value);r=r.replace(/@installed/g,"").replace(/@sort:(\w+)(-\w*)?/g,"").trim().toLowerCase();let c=p=>(p.name.toLowerCase().indexOf(r)>-1||p.displayName.toLowerCase().indexOf(r)>-1||p.description.toLowerCase().indexOf(r)>-1)&&this.filterExtensionByCategory(p,s,l),u;if(n.sortBy!==void 0)u=e.filter(p=>!p.isBuiltin&&c(p)),u=this.sortExtensions(u,n);else{u=e.filter(y=>(!y.isBuiltin||y.outdated||y.runtimeState!==void 0)&&c(y));let p=t.reduce((y,w)=>(y.set(w.identifier.value,w),y),new iu),h=(y,w)=>{let k=p.get(y.identifier.id),T=!!k&&this.extensionManagementServerService.getExtensionManagementServer(ZE(k))===y.server,P=p.get(w.identifier.id),O=P&&this.extensionManagementServerService.getExtensionManagementServer(ZE(P))===w.server;if(T&&O)return y.displayName.localeCompare(w.displayName);let V=y.local&&IR(y.local.manifest),H=w.local&&IR(w.local.manifest);return!T&&!O?V?-1:H?1:y.displayName.localeCompare(w.displayName):T&&H||O&&V?y.displayName.localeCompare(w.displayName):T?-1:1},g=[],f=[],v=[],b=[],S=[];for(let y of u)y.enablementState===6?g.push(y):y.deprecationInfo?f.push(y):y.outdated&&this.extensionEnablementService.isEnabledEnablementState(y.enablementState)?v.push(y):y.runtimeState?b.push(y):S.push(y);u=[...g.sort(h),...f.sort(h),...v.sort(h),...b.sort(h),...S.sort(h)]}return u}filterOutdatedExtensions(e,t,o){let{value:n,includedCategories:r,excludedCategories:s}=this.parseCategories(t.value);n=n.replace(/@outdated/g,"").replace(/@sort:(\w+)(-\w*)?/g,"").trim().toLowerCase();let l=e.sort((c,u)=>c.displayName.localeCompare(u.displayName)).filter(c=>c.outdated&&(c.name.toLowerCase().indexOf(n)>-1||c.displayName.toLowerCase().indexOf(n)>-1)&&this.filterExtensionByCategory(c,r,s));return this.sortExtensions(l,o)}filterDisabledExtensions(e,t,o,n,r){let{value:s,includedCategories:l,excludedCategories:c}=this.parseCategories(o.value);s=s.replaceAll(/@disabled|@builtin/gi,"").replaceAll(/@sort:(\w+)(-\w*)?/g,"").trim().toLowerCase(),r&&(e=e.filter(p=>p.isBuiltin));let u=e.sort((p,h)=>p.displayName.localeCompare(h.displayName)).filter(p=>t.every(h=>!Ut({id:h.identifier.value,uuid:h.uuid},p.identifier))&&(p.name.toLowerCase().indexOf(s)>-1||p.displayName.toLowerCase().indexOf(s)>-1)&&this.filterExtensionByCategory(p,l,c));return this.sortExtensions(u,n)}filterEnabledExtensions(e,t,o,n,r){let{value:s,includedCategories:l,excludedCategories:c}=this.parseCategories(o.value);s=s?s.replaceAll(/@enabled|@builtin/gi,"").replaceAll(/@sort:(\w+)(-\w*)?/g,"").trim().toLowerCase():"",e=e.filter(p=>p.isBuiltin===r);let u=e.sort((p,h)=>p.displayName.localeCompare(h.displayName)).filter(p=>t.some(h=>Ut({id:h.identifier.value,uuid:h.uuid},p.identifier))&&(p.name.toLowerCase().indexOf(s)>-1||p.displayName.toLowerCase().indexOf(s)>-1)&&this.filterExtensionByCategory(p,l,c));return this.sortExtensions(u,n)}filterWorkspaceUnsupportedExtensions(e,t,o){let r=t.value.match(/^\s*@workspaceUnsupported(?::(untrusted|virtual)(Partial)?)?(?:\s+([^\s]*))?/i);if(!r)return[];let s=r[1]?.toLowerCase(),l=!!r[2],c=r[3]?.toLowerCase();c&&(e=e.filter(f=>f.name.toLowerCase().indexOf(c)>-1||f.displayName.toLowerCase().indexOf(c)>-1));let u=(f,v)=>f.local&&this.extensionManifestPropertiesService.getExtensionVirtualWorkspaceSupportType(f.local.manifest)===v,p=(f,v)=>{if(!f.local)return!1;let b=this.extensionEnablementService.getEnablementState(f.local);return b!==12&&b!==13&&b!==0&&b!==8?!1:this.extensionManifestPropertiesService.getExtensionUntrustedWorkspaceSupportType(f.local.manifest)===v?!0:v===!1?kde(e.map(y=>y.local),f.local).some(y=>this.extensionManifestPropertiesService.getExtensionUntrustedWorkspaceSupportType(y.manifest)===v):!1},h=_F(this.workspaceService.getWorkspace()),g=!this.workspaceTrustManagementService.isWorkspaceTrusted();return s==="virtual"?e=e.filter(f=>h&&u(f,l?"limited":!1)&&!(g&&p(f,!1))):s==="untrusted"?e=e.filter(f=>p(f,l?"limited":!1)&&!(h&&u(f,!1))):e=e.filter(f=>h&&!u(f,!0)||g&&!p(f,!0)),this.sortExtensions(e,o)}async filterDeprecatedExtensions(e,t,o){let n=t.value.replace(/@deprecated/g,"").replace(/@sort:(\w+)(-\w*)?/g,"").trim().toLowerCase(),r=await this.extensionManagementService.getExtensionsControlManifest(),s=Object.keys(r.deprecated);return e=e.filter(l=>s.includes(l.identifier.id)&&(!n||l.name.toLowerCase().indexOf(n)>-1||l.displayName.toLowerCase().indexOf(n)>-1)),this.sortExtensions(e,o)}filterRecentlyUpdatedExtensions(e,t,o){let{value:n,includedCategories:r,excludedCategories:s}=this.parseCategories(t.value),l=Date.now();e=e.filter(u=>!u.isBuiltin&&!u.outdated&&u.local?.updated&&u.local?.installedTimestamp!==void 0&&l-u.local.installedTimestamp<Lr.RECENT_UPDATE_DURATION),n=n.replace(/@recentlyUpdated/g,"").replace(/@sort:(\w+)(-\w*)?/g,"").trim().toLowerCase();let c=e.filter(u=>(u.name.toLowerCase().indexOf(n)>-1||u.displayName.toLowerCase().indexOf(n)>-1)&&this.filterExtensionByCategory(u,r,s));return o.sortBy=o.sortBy??"UpdateDate",this.sortExtensions(c,o)}filterRestartRequiredExtensions(e,t,o){let{value:n,includedCategories:r,excludedCategories:s}=this.parseCategories(t.value);e=e.filter(c=>c.runtimeState!==void 0),n=n.replace(/@restartrequired/gi,"").replace(/@sort:(\w+)(-\w*)?/g,"").trim().toLowerCase();let l=e.filter(c=>(c.name.toLowerCase().indexOf(n)>-1||c.displayName.toLowerCase().indexOf(n)>-1)&&this.filterExtensionByCategory(c,r,s));return this.sortExtensions(l,o)}filterExtensionsByFeature(e,t){let n=t.value.replace(/@contribute:/g,"").trim().split(" ")[0],r=ne.as(As.ExtensionFeaturesRegistry).getExtensionFeature(n);if(!r)return[];this.extensionsViewState&&(this.extensionsViewState.filters.featureId=n);let s=r.renderer?this.instantiationService.createInstance(r.renderer):void 0;try{let l=[];for(let c of e){if(!c.local)continue;let u=this.extensionFeaturesManagementService.getAccessData(new Ii(c.identifier.id),n),p=s?.shouldRender(c.local.manifest);(u||p)&&l.push([c,u?.accessTimes.length??0])}return l.sort(([,c],[,u])=>u-c).map(([c])=>c)}finally{s?.dispose()}}mergeAddedExtensions(e,t){let o=[...e],n=s=>{let l=-1,c=t[s];return c&&(l=o.findIndex(u=>Ut(u.identifier,c.identifier)),l===-1)?n(s-1):l},r=!1;for(let s=0;s<t.length;s++){let l=t[s];e.every(c=>!Ut(c.identifier,l.identifier))&&(r=!0,e.splice(n(s-1)+1,0,l))}return r?e:void 0}async queryGallery(e,t,o){let n=t.sortBy!==void 0;if(!n&&!e.value.trim()&&(t.sortBy="InstallCount"),this.isRecommendationsQuery(e))return{model:await this.queryRecommendations(e,t,o),disposables:new N};let r=e.value;if(!r){t.source="viewlet";let s=await this.extensionsWorkbenchService.queryGallery(t,o);return{model:new Wm(s),disposables:new N}}if(/\bext:([^\s]+)\b/g.test(r)){t.text=r,t.source="file-extension-tags";let s=await this.extensionsWorkbenchService.queryGallery(t,o);return{model:new Wm(s),disposables:new N}}if(t.text=r.substring(0,350),t.source="searchText",n||/\b(category|tag):([^\s]+)\b/gi.test(r)||/\bfeatured(\s+|\b|$)/gi.test(r)){let s=await this.extensionsWorkbenchService.queryGallery(t,o);return{model:new Wm(s),disposables:new N}}try{let[s,l]=await Promise.all([this.extensionsWorkbenchService.queryGallery(t,o),this.getPreferredExtensions(t.text.toLowerCase(),o).catch(()=>[])]);return{model:l.length?new QMi(l,s):new Wm(s),disposables:new N}}catch(s){if(ao(s)||!(s instanceof XE))throw s;let l=t.text.toLowerCase(),c=this.extensionsWorkbenchService.local.filter(u=>!u.isBuiltin&&(u.name.toLowerCase().indexOf(l)>-1||u.displayName.toLowerCase().indexOf(l)>-1||u.description.toLowerCase().indexOf(l)>-1));if(c.length){let u=this.getMessage(s);return{model:new Wm(c),disposables:new N,message:{text:d(10588,null,u.text),severity:u.severity}}}throw s}}async getPreferredExtensions(e,t){let o=this.extensionsWorkbenchService.local.filter(s=>!s.isBuiltin&&(s.name.toLowerCase().indexOf(e)>-1||s.displayName.toLowerCase().indexOf(e)>-1||s.description.toLowerCase().indexOf(e)>-1)),n=new Set;if(o.length){let s=[];for(let l of o)l.identifier.uuid&&n.add(l.identifier.uuid),!l.gallery&&l.identifier.uuid&&s.push(l.identifier);s.length&&this.extensionsWorkbenchService.getExtensions(s,Se.None).catch(l=>null)}let r=[];try{let s=await this.extensionManagementService.getExtensionsControlManifest();if(Array.isArray(s.search)){for(let l of s.search)if(l.query&&l.query.toLowerCase()===e&&Array.isArray(l.preferredResults)){r.push(...l.preferredResults);break}}if(r.length){let l=await this.extensionsWorkbenchService.getExtensions(r.map(c=>({id:c})),t);for(let c of l)c.identifier.uuid&&!n.has(c.identifier.uuid)&&o.push(c)}}catch(s){this.logService.warn("Failed to get preferred results from the extensions control manifest.",s)}return o}sortExtensions(e,t){switch(t.sortBy){case"InstallCount":e=e.sort((o,n)=>typeof n.installCount=="number"&&typeof o.installCount=="number"?n.installCount-o.installCount:NaN);break;case"UpdateDate":e=e.sort((o,n)=>typeof n.local?.installedTimestamp=="number"&&typeof o.local?.installedTimestamp=="number"?n.local.installedTimestamp-o.local.installedTimestamp:typeof n.local?.installedTimestamp=="number"?1:typeof o.local?.installedTimestamp=="number"?-1:NaN);break;case"AverageRating":case"WeightedRating":e=e.sort((o,n)=>typeof n.rating=="number"&&typeof o.rating=="number"?n.rating-o.rating:NaN);break;default:e=e.sort((o,n)=>o.displayName.localeCompare(n.displayName));break}return t.sortOrder===2&&(e=e.reverse()),e}isRecommendationsQuery(e){return Lr.isWorkspaceRecommendedExtensionsQuery(e.value)||Lr.isKeymapsRecommendedExtensionsQuery(e.value)||Lr.isLanguageRecommendedExtensionsQuery(e.value)||Lr.isExeRecommendedExtensionsQuery(e.value)||Lr.isRemoteRecommendedExtensionsQuery(e.value)||/@recommended:all/i.test(e.value)||Lr.isSearchRecommendedExtensionsQuery(e.value)||Lr.isRecommendedExtensionsQuery(e.value)}async queryRecommendations(e,t,o){return Lr.isWorkspaceRecommendedExtensionsQuery(e.value)?this.getWorkspaceRecommendationsModel(e,t,o):Lr.isKeymapsRecommendedExtensionsQuery(e.value)?this.getKeymapRecommendationsModel(e,t,o):Lr.isLanguageRecommendedExtensionsQuery(e.value)?this.getLanguageRecommendationsModel(e,t,o):Lr.isExeRecommendedExtensionsQuery(e.value)?this.getExeRecommendationsModel(e,t,o):Lr.isRemoteRecommendedExtensionsQuery(e.value)?this.getRemoteRecommendationsModel(e,t,o):/@recommended:all/i.test(e.value)?this.getAllRecommendationsModel(t,o):Lr.isSearchRecommendedExtensionsQuery(e.value)||Lr.isRecommendedExtensionsQuery(e.value)&&t.sortBy!==void 0?this.searchRecommendations(e,t,o):Lr.isRecommendedExtensionsQuery(e.value)?this.getOtherRecommendationsModel(e,t,o):new Wm([])}async getInstallableRecommendations(e,t,o){let n=[];if(e.length){let r=[],s=[];for(let l of e)typeof l=="string"?r.push(l):s.push(l);if(r.length)try{let l=await this.extensionsWorkbenchService.getExtensions(r.map(c=>({id:c})),{source:t.source},o);for(let c of l)c.gallery&&!c.deprecationInfo&&await this.extensionManagementService.canInstall(c.gallery)===!0&&n.push(c)}catch(l){if(!s.length||!this.isOfflineError(l))throw l}if(s.length){let l=await this.extensionsWorkbenchService.getResourceExtensions(s,!0);for(let c of l)await this.extensionsWorkbenchService.canInstall(c)===!0&&n.push(c)}}return n}async getWorkspaceRecommendations(){let e=await this.extensionRecommendationsService.getWorkspaceRecommendations(),{important:t}=await this.extensionRecommendationsService.getConfigBasedRecommendations();for(let o of t)e.find(n=>n===o)||e.push(o);return e}async getWorkspaceRecommendationsModel(e,t,o){let n=await this.getWorkspaceRecommendations(),r=await this.getInstallableRecommendations(n,{...t,source:"recommendations-workspace"},o);return new Wm(r)}async getKeymapRecommendationsModel(e,t,o){let n=e.value.replace(/@recommended:keymaps/g,"").trim().toLowerCase(),r=this.extensionRecommendationsService.getKeymapRecommendations(),s=(await this.getInstallableRecommendations(r,{...t,source:"recommendations-keymaps"},o)).filter(l=>l.identifier.id.toLowerCase().indexOf(n)>-1);return new Wm(s)}async getLanguageRecommendationsModel(e,t,o){let n=e.value.replace(/@recommended:languages/g,"").trim().toLowerCase(),r=this.extensionRecommendationsService.getLanguageRecommendations(),s=(await this.getInstallableRecommendations(r,{...t,source:"recommendations-languages"},o)).filter(l=>l.identifier.id.toLowerCase().indexOf(n)>-1);return new Wm(s)}async getRemoteRecommendationsModel(e,t,o){let n=e.value.replace(/@recommended:remotes/g,"").trim().toLowerCase(),r=this.extensionRecommendationsService.getRemoteRecommendations(),s=(await this.getInstallableRecommendations(r,{...t,source:"recommendations-remotes"},o)).filter(l=>l.identifier.id.toLowerCase().indexOf(n)>-1);return new Wm(s)}async getExeRecommendationsModel(e,t,o){let n=e.value.replace(/@exe:/g,"").trim().toLowerCase(),{important:r,others:s}=await this.extensionRecommendationsService.getExeBasedRecommendations(n.startsWith('"')?n.substring(1,n.length-1):n),l=await this.getInstallableRecommendations([...r,...s],{...t,source:"recommendations-exe"},o);return new Wm(l)}async getOtherRecommendationsModel(e,t,o){let n=await this.getOtherRecommendations(),r=await this.getInstallableRecommendations(n,{...t,source:"recommendations-other",sortBy:void 0},o),s=di(n.map(l=>r.find(c=>Ut(c.identifier,{id:l}))));return new Wm(s)}async getOtherRecommendations(){let e=(await this.extensionsWorkbenchService.queryLocal(this.options.server)).map(o=>o.identifier.id.toLowerCase()),t=(await this.getWorkspaceRecommendations()).map(o=>Fe(o)?o.toLowerCase():o);return zo((await Promise.all([this.extensionRecommendationsService.getImportantRecommendations(),this.extensionRecommendationsService.getFileBasedRecommendations(),this.extensionRecommendationsService.getOtherRecommendations()])).flat().filter(o=>!e.includes(o.toLowerCase())&&!t.includes(o.toLowerCase())),o=>o.toLowerCase())}async getAllRecommendationsModel(e,t){let o=await this.extensionsWorkbenchService.queryLocal(this.options.server),n=o.map(c=>c.identifier.id.toLowerCase()),r=zo((await Promise.all([this.getWorkspaceRecommendations(),this.extensionRecommendationsService.getImportantRecommendations(),this.extensionRecommendationsService.getFileBasedRecommendations(),this.extensionRecommendationsService.getOtherRecommendations()])).flat().filter(c=>Fe(c)?!n.includes(c.toLowerCase()):!o.some(u=>u.local&&this.uriIdentityService.extUri.isEqual(u.local.location,c)))),s=await this.getInstallableRecommendations(r,{...e,source:"recommendations-all",sortBy:void 0},t),l=[];for(let c=0;c<s.length&&l.length<8;c++){let u=r[c];if(Fe(u)){let p=s.find(h=>Ut(h.identifier,{id:u}));p&&l.push(p)}else{let p=s.find(h=>h.resourceExtension&&this.uriIdentityService.extUri.isEqual(h.resourceExtension.location,u));p&&l.push(p)}}return new Wm(l)}async searchRecommendations(e,t,o){let n=e.value.replace(/@recommended/g,"").trim().toLowerCase(),r=zo([...await this.getWorkspaceRecommendations(),...await this.getOtherRecommendations()]),s=(await this.getInstallableRecommendations(r,{...t,source:"recommendations",sortBy:void 0},o)).filter(l=>l.identifier.id.toLowerCase().indexOf(n)>-1);return new Wm(this.sortExtensions(s,t))}setModel(e,t,o){this.list&&(this.list.model=new eQ(e),this.updateBody(t),o||(this.list.scrollTop=0)),this.badge&&this.badge.setCount(this.count())}updateModel(e){this.list&&(this.list.model=new eQ(e),this.updateBody()),this.badge&&this.badge.setCount(this.count())}updateBody(e){if(this.bodyTemplate){let t=this.count();this.bodyTemplate.extensionsList.classList.toggle("hidden",t===0),this.bodyTemplate.messageContainer.classList.toggle("hidden",!e&&t>0),this.isBodyVisible()&&(e?(this.bodyTemplate.messageSeverityIcon.className=sk.className(e.severity),this.bodyTemplate.messageBox.textContent=e.text):this.count()===0&&(this.bodyTemplate.messageSeverityIcon.className="",this.bodyTemplate.messageBox.textContent=d(10585,null)),this.bodyTemplate.messageBox.textContent&&en(this.bodyTemplate.messageBox.textContent))}this.updateSize()}getMessage(e){return this.isOfflineError(e)?{text:d(10587,null),severity:ft.Warning}:{text:d(10584,null,Pn(e)),severity:ft.Error}}isOfflineError(e){return e instanceof XE?e.code==="Offline":RZe(e)}updateSize(){this.options.flexibleHeight&&(this.maximumBodySize=this.list?.model.length?Number.POSITIVE_INFINITY:0,this.storageService.store(`${this.id}.size`,this.list?.model.length||0,0,1))}dispose(){super.dispose(),this.queryRequest&&(this.queryRequest.request.cancel(),this.queryRequest=null),this.queryResult&&(this.queryResult.disposables.dispose(),this.queryResult=void 0),this.list=null}static isLocalExtensionsQuery(e,t){return this.isInstalledExtensionsQuery(e)||this.isSearchInstalledExtensionsQuery(e)||this.isOutdatedExtensionsQuery(e)||this.isEnabledExtensionsQuery(e)||this.isDisabledExtensionsQuery(e)||this.isBuiltInExtensionsQuery(e)||this.isSearchBuiltInExtensionsQuery(e)||this.isBuiltInGroupExtensionsQuery(e)||this.isSearchDeprecatedExtensionsQuery(e)||this.isSearchWorkspaceUnsupportedExtensionsQuery(e)||this.isSearchRecentlyUpdatedQuery(e)||this.isRestartRequiredQuery(e)||this.isSearchExtensionUpdatesQuery(e)||this.isSortInstalledExtensionsQuery(e,t)||this.isFeatureExtensionsQuery(e)}static isSearchBuiltInExtensionsQuery(e){return/@builtin\s.+|.+\s@builtin/i.test(e)}static isBuiltInExtensionsQuery(e){return/^@builtin$/i.test(e.trim())}static isBuiltInGroupExtensionsQuery(e){return/^@builtin:.+$/i.test(e.trim())}static isSearchWorkspaceUnsupportedExtensionsQuery(e){return/^\s*@workspaceUnsupported(:(untrusted|virtual)(Partial)?)?(\s|$)/i.test(e)}static isInstalledExtensionsQuery(e){return/@installed$/i.test(e)&&!/@mcp/i.test(e)&&!/@agentPlugins/i.test(e)}static isSearchInstalledExtensionsQuery(e){return/@installed\s./i.test(e)&&!/@mcp/i.test(e)&&!/@agentPlugins/i.test(e)||this.isFeatureExtensionsQuery(e)}static isOutdatedExtensionsQuery(e){return/@outdated/i.test(e)}static isEnabledExtensionsQuery(e){return/@enabled/i.test(e)&&!/@builtin/i.test(e)}static isDisabledExtensionsQuery(e){return/@disabled/i.test(e)&&!/@builtin/i.test(e)}static isSearchDeprecatedExtensionsQuery(e){return/@deprecated\s?.*/i.test(e)}static isRecommendedExtensionsQuery(e){return/^@recommended$/i.test(e.trim())}static isSearchRecommendedExtensionsQuery(e){return/@recommended\s.+/i.test(e)}static isWorkspaceRecommendedExtensionsQuery(e){return/@recommended:workspace/i.test(e)}static isExeRecommendedExtensionsQuery(e){return/@exe:.+/i.test(e)}static isRemoteRecommendedExtensionsQuery(e){return/@recommended:remotes/i.test(e)}static isKeymapsRecommendedExtensionsQuery(e){return/@recommended:keymaps/i.test(e)}static isLanguageRecommendedExtensionsQuery(e){return/@recommended:languages/i.test(e)}static isSortInstalledExtensionsQuery(e,t){return t!==void 0&&t!==""&&e===""||!t&&/^@sort:\S*$/i.test(e)}static isSearchPopularQuery(e){return/@popular/i.test(e)}static isSearchRecentlyPublishedQuery(e){return/@recentlyPublished/i.test(e)}static isSearchRecentlyUpdatedQuery(e){return/@recentlyUpdated/i.test(e)}static isRestartRequiredQuery(e){return/@restartrequired/i.test(e)}static isSearchExtensionUpdatesQuery(e){return/@updates/i.test(e)}static isSortUpdateDateQuery(e){return/@sort:updateDate/i.test(e)}static isFeatureExtensionsQuery(e){return/@contribute:/i.test(e)}focus(){super.focus(),this.list&&(this.list.getFocus().length||this.list.getSelection().length||this.list.focusNext(),this.list.domFocus())}};Lr=I([m(2,Ne),m(3,_e),m(4,Xe),m(5,F),m(6,Le),m(7,lt),m(8,Hi),m(9,BD),m(10,Te),m(11,nt),m(12,B),m(13,Pe),m(14,Ec),m(15,Gp),m(16,ru),m(17,Pe),m(18,tt),m(19,X),m(20,Bi),m(21,Je),m(22,ce),m(23,Nr),m(24,Js),m(25,cy),m(26,ht),m(27,se)],Lr);var FGt=class extends Lr{async show(){let i=this.extensionManagementServerService.webExtensionManagementServer&&!this.extensionManagementServerService.localExtensionManagementServer&&!this.extensionManagementServerService.remoteExtensionManagementServer?"@web":"";return super.show(i)}},WGt=class extends Lr{async show(i){return i=i||"@installed",(!Lr.isLocalExtensionsQuery(i)||Lr.isSortInstalledExtensionsQuery(i))&&(i=i+=" @installed"),super.show(i.trim())}},VGt=class extends Lr{async show(i){return i=i||"@enabled",Lr.isEnabledExtensionsQuery(i)?super.show(i):Lr.isSortInstalledExtensionsQuery(i)?super.show("@enabled "+i):this.showEmptyModel()}},BGt=class extends Lr{async show(i){return i=i||"@disabled",Lr.isDisabledExtensionsQuery(i)?super.show(i):Lr.isSortInstalledExtensionsQuery(i)?super.show("@disabled "+i):this.showEmptyModel()}},HGt=class extends Lr{async show(i){return i=i||"@outdated",Lr.isSearchExtensionUpdatesQuery(i)&&(i=i.replace("@updates","@outdated")),super.show(i.trim())}updateSize(){super.updateSize(),this.setExpanded(this.count()>0)}},UGt=class extends Lr{async show(i){return i=i||"@recentlyUpdated",Lr.isSearchExtensionUpdatesQuery(i)&&(i=i.replace("@updates","@recentlyUpdated")),super.show(i.trim())}},voe=class extends Lr{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,P,O,V,H,G,$,J,ae){super(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,P,O,V,H,G,$,J,ae);this.options=e}show(){return super.show(this.options.query)}};voe=I([m(2,Ne),m(3,_e),m(4,Xe),m(5,F),m(6,Le),m(7,lt),m(8,Hi),m(9,BD),m(10,Te),m(11,nt),m(12,B),m(13,Pe),m(14,Ec),m(15,Gp),m(16,ru),m(17,Pe),m(18,tt),m(19,X),m(20,Bi),m(21,Je),m(22,ce),m(23,Nr),m(24,Js),m(25,cy),m(26,ht),m(27,se)],voe);function JGt(a,i){if(!a)return"@workspaceUnsupported:"+i;let e=a.match(new RegExp(`@workspaceUnsupported(:${i})?(\\s|$)`,"i"));if(e)return e[1]?a:a.replace(/@workspaceUnsupported/gi,"@workspaceUnsupported:"+i)}var zGt=class extends Lr{async show(i){let e=JGt(i,"untrusted");return e?super.show(e):this.showEmptyModel()}},KGt=class extends Lr{async show(i){let e=JGt(i,"untrustedPartial");return e?super.show(e):this.showEmptyModel()}},GGt=class extends Lr{async show(i){let e=JGt(i,"virtual");return e?super.show(e):this.showEmptyModel()}},qGt=class extends Lr{async show(i){let e=JGt(i,"virtualPartial");return e?super.show(e):this.showEmptyModel()}},$Gt=class extends Lr{async show(i){return Lr.isSearchDeprecatedExtensionsQuery(i)?super.show(i):this.showEmptyModel()}},jGt=class extends Lr{constructor(){super(...arguments);this.reportSearchFinishedDelayer=this._register(new ya(2e3));this.searchWaitPromise=Promise.resolve()}async show(e){let t=super.show(e);return this.reportSearchFinishedDelayer.trigger(()=>this.reportSearchFinished()),this.searchWaitPromise=t.then(null,null),t}async reportSearchFinished(){await this.searchWaitPromise,this.telemetryService.publicLog2("extensionsView:MarketplaceSearchFinished")}},QGt=class extends Lr{constructor(){super(...arguments);this.recommendedExtensionsQuery="@recommended:all"}renderBody(e){super.renderBody(e),this._register(this.extensionRecommendationsService.onDidChangeRecommendations(()=>{this.show("")}))}async show(e){if(e&&e.trim()!==this.recommendedExtensionsQuery)return this.showEmptyModel();let t=await super.show(this.recommendedExtensionsQuery);return this.extensionsWorkbenchService.local.some(o=>!o.isBuiltin)||this.setExpanded(t.length>0),t}},YGt=class extends Lr{constructor(){super(...arguments);this.recommendedExtensionsQuery="@recommended"}renderBody(e){super.renderBody(e),this._register(this.extensionRecommendationsService.onDidChangeRecommendations(()=>{this.show("")}))}async show(e){return e&&e.trim()!==this.recommendedExtensionsQuery?this.showEmptyModel():super.show(this.recommendedExtensionsQuery)}},XGt=class extends Lr{constructor(){super(...arguments);this.recommendedExtensionsQuery="@recommended:workspace"}renderBody(e){super.renderBody(e),this._register(this.extensionRecommendationsService.onDidChangeRecommendations(()=>this.show(this.recommendedExtensionsQuery))),this._register(this.contextService.onDidChangeWorkbenchState(()=>this.show(this.recommendedExtensionsQuery)))}async show(e){let o=await(e&&e.trim()!=="@recommended"&&e.trim()!=="@recommended:workspace"?this.showEmptyModel():super.show(this.recommendedExtensionsQuery));return this.setExpanded(o.length>0),o}async getInstallableWorkspaceRecommendations(){let e=(await this.extensionsWorkbenchService.queryLocal()).filter(o=>o.enablementState!==1),t=(await this.getWorkspaceRecommendations()).filter(o=>e.every(n=>Fe(o)?!Ut({id:o},n.identifier):!this.uriIdentityService.extUri.isEqual(o,n.local?.location)));return this.getInstallableRecommendations(t,{source:"install-all-workspace-recommendations"},Se.None)}async installWorkspaceRecommendations(){let e=await this.getInstallableWorkspaceRecommendations();if(e.length){let t=[],o=[];for(let n of e)n.gallery?t.push({extension:n.gallery,options:{}}):o.push(n);await Promise.all([this.extensionManagementService.installGalleryExtensions(t),...o.map(n=>this.extensionsWorkbenchService.install(n))])}else this.notificationService.notify({severity:ft.Info,message:d(10586,null)})}},QMi=class{constructor(i,e){this.preferredExtensions=i;this.pager=e;this.resolved=new Map;this.preferredGalleryExtensions=new Set;this.resolvedGalleryExtensionsFromQuery=[];for(let o=0;o<this.preferredExtensions.length;o++)this.resolved.set(o,this.preferredExtensions[o]);for(let o of i)o.identifier.uuid&&this.preferredGalleryExtensions.add(o.identifier.uuid);this.length=i.length-this.preferredGalleryExtensions.size+this.pager.total;let t=Math.ceil(this.pager.total/this.pager.pageSize);this.populateResolvedExtensions(0,this.pager.firstPage),this.pages=Ig(t-1).map(()=>({promise:null,cts:null,promiseIndexes:new Set}))}get onDidIncrementLength(){return U.None}isResolved(i){return this.resolved.has(i)}get(i){return this.resolved.get(i)}async resolve(i,e){if(e.isCancellationRequested)throw new go;if(this.isResolved(i))return this.get(i);let t=i-this.preferredExtensions.length+this.resolvedGalleryExtensionsFromQuery.length,o=Math.floor(t/this.pager.pageSize),n=this.pages[o];n.promise||(n.cts=new Ye,n.promise=this.pager.getPage(o,n.cts.token).then(s=>this.populateResolvedExtensions(o,s)).catch(s=>{throw n.promise=null,s}).finally(()=>n.cts=null));let r=e.onCancellationRequested(()=>{n.cts&&(n.promiseIndexes.delete(i),n.promiseIndexes.size===0&&n.cts.cancel())});n.promiseIndexes.add(i);try{await n.promise}finally{r.dispose()}return this.get(i)}populateResolvedExtensions(i,e){let t=0,o=i*this.pager.pageSize;for(let n=0;n<e.length;n++){let r=e[n];r.gallery?.identifier.uuid&&this.preferredGalleryExtensions.has(r.gallery.identifier.uuid)?(this.resolvedGalleryExtensionsFromQuery.push(r),t++):this.resolved.set(this.preferredExtensions.length-this.resolvedGalleryExtensionsFromQuery.length+o+n,r)}if(i!==0&&t){let n=(i+1)*this.pager.pageSize,r=[...this.resolved.keys()].sort();for(let s of r)if(s>=n){let l=this.resolved.get(s);l&&(this.resolved.delete(s),this.resolved.set(s-t,l))}}}};var JMi=new Y("extensionsSortByValue",""),ZMi=new Y("searchMarketplaceExtensions",!1),ePi=new Y("extensionSearchHasText",!1),ean=new Y("installedExtensions",!1),tan=new Y("searchInstalledExtensions",!1),ian=new Y("searchRecentlyUpdatedExtensions",!1),XMi=new Y("searchExtensionUpdates",!1),oan=new Y("searchOutdatedExtensions",!1),nan=new Y("searchEnabledExtensions",!1),ran=new Y("searchDisabledExtensions",!1),san=new Y("hasInstalledExtensions",!0),rfe=new Y("builtInExtensions",!1),aan=new Y("searchBuiltInExtensions",!1),Art=new Y("searchUnsupportedWorkspaceExtensions",!1),Syo=new Y("searchDeprecatedExtensions",!1),Iyo=new Y("searchRestartRequiredExtensions",!1),tPi=new Y("recommendedExtensions",!1),yyo=new Y("sortByUpdateDate",!1),iPi=new Y("extensionsSearchValue",""),byo=L(10568,"Remote"),rWe=class extends x{constructor(e,t,o){super();this.extensionManagementServerService=e;this.labelService=t;this.contextKeyService=o;this.container=ne.as(Mn.ViewContainersRegistry).get(pg),this.registerViews()}registerViews(){let e=[];e.push(...this.createDefaultExtensionsViewDescriptors()),e.push(...this.createSearchExtensionsViewDescriptors()),e.push(...this.createRecommendedExtensionsViewDescriptors()),e.push(...this.createBuiltinExtensionsViewDescriptors()),e.push(...this.createUnsupportedWorkspaceExtensionsViewDescriptors()),e.push(...this.createOtherLocalFilteredExtensionsViewDescriptors()),e.push({id:"workbench.views.extensions.marketplaceAccess",name:L(10561,"Marketplace"),ctorDescriptor:new Ft(class extends Gs{shouldShowWelcome(){return!0}}),when:C.and(C.or(C.has("searchMarketplaceExtensions"),C.and(QC)),C.or(AJ.isEqualTo("requiresSignIn"),AJ.isEqualTo("accessDenied"))),order:-1});let t=ne.as(Mn.ViewsRegistry);t.registerViews(e,this.container),t.registerViewWelcomeContent("workbench.views.extensions.marketplaceAccess",{content:d(10574,null,`command:${Aet}`),when:AJ.isEqualTo("requiresSignIn")}),t.registerViewWelcomeContent("workbench.views.extensions.marketplaceAccess",{content:d(10535,null),when:AJ.isEqualTo("accessDenied")})}createDefaultExtensionsViewDescriptors(){let e=[],t=[];this.extensionManagementServerService.localExtensionManagementServer&&t.push(this.extensionManagementServerService.localExtensionManagementServer),this.extensionManagementServerService.remoteExtensionManagementServer&&t.push(this.extensionManagementServerService.remoteExtensionManagementServer),this.extensionManagementServerService.webExtensionManagementServer&&t.push(this.extensionManagementServerService.webExtensionManagementServer);let o=(s,l)=>t.length>1?`${l.label} - ${s}`:s,n=U.None;if(this.extensionManagementServerService.webExtensionManagementServer&&this.extensionManagementServerService.remoteExtensionManagementServer){let s=new Set;s.add("hasInstalledWebExtensions"),n=U.filter(this.contextKeyService.onDidChangeContext,l=>l.affectsSome(s))}let r=U.any(this.labelService.onDidChangeFormatters,n);for(let s of t){let l=()=>o(d(10557,null),s),c=U.map(r,()=>l()),u=t.length>1?`workbench.views.extensions.${s.id}.installed`:"workbench.views.extensions.installed";e.push({id:u,get name(){return{value:l(),original:o("Installed",s)}},weight:100,order:1,when:C.and(QC),ctorDescriptor:new Ft(WGt,[{server:s,flexibleHeight:!0,onDidChangeTitle:c}]),canToggleVisibility:t.length===1}),s===this.extensionManagementServerService.remoteExtensionManagementServer&&this.extensionManagementServerService.localExtensionManagementServer&&this._register(W(class extends K{constructor(){super({id:"workbench.extensions.installLocalExtensions",get title(){return L(10572,"Install Local Extensions in '{0}'...",s.label)},category:byo,icon:zmo,f1:!0,menu:{id:D.ViewTitle,when:C.equals("view",u),group:"navigation"}})}run(h){return h.get(F).createInstance(kPe).run()}}))}return this.extensionManagementServerService.localExtensionManagementServer&&this.extensionManagementServerService.remoteExtensionManagementServer&&this._register(W(class extends K{constructor(){super({id:"workbench.extensions.actions.installLocalExtensionsInRemote",title:L(10556,"Install Remote Extensions Locally..."),category:byo,f1:!0})}run(l){return l.get(F).createInstance(EPe,"workbench.extensions.actions.installLocalExtensionsInRemote").run()}})),e.push({id:"workbench.views.extensions.popular",name:L(10564,"Popular"),ctorDescriptor:new Ft(FGt,[{hideBadge:!0}]),when:C.and(QC,C.not("hasInstalledExtensions"),kh),weight:60,order:2,canToggleVisibility:!1}),e.push({id:"extensions.recommendedList",name:L(10566,"Recommended"),ctorDescriptor:new Ft(QGt,[{flexibleHeight:!0}]),when:C.and(QC,yyo.negate(),C.not("config.extensions.showRecommendationsOnlyOnDemand"),kh),weight:40,order:3,canToggleVisibility:!0}),t.length===1&&(e.push({id:"workbench.views.extensions.enabled",name:L(10547,"Enabled"),ctorDescriptor:new Ft(VGt,[{}]),when:C.and(QC,C.has("hasInstalledExtensions")),hideByDefault:!0,weight:40,order:4,canToggleVisibility:!0}),e.push({id:"workbench.views.extensions.disabled",name:L(10545,"Disabled"),ctorDescriptor:new Ft(BGt,[{}]),when:C.and(QC,C.has("hasInstalledExtensions")),hideByDefault:!0,weight:10,order:5,canToggleVisibility:!0})),e}createSearchExtensionsViewDescriptors(){let e=[];return e.push({id:"workbench.views.extensions.marketplace",name:L(10561,"Marketplace"),ctorDescriptor:new Ft(jGt,[{}]),when:C.and(C.has("searchMarketplaceExtensions"),kh)}),e.push({id:"workbench.views.extensions.searchInstalled",name:L(10558,"Installed"),ctorDescriptor:new Ft(Lr,[{}]),when:C.or(C.has("searchInstalledExtensions"),C.has("installedExtensions"))}),e.push({id:"workbench.views.extensions.searchRecentlyUpdated",name:L(10565,"Recently Updated"),ctorDescriptor:new Ft(UGt,[{}]),when:C.or(XMi,C.has("searchRecentlyUpdatedExtensions")),order:2}),e.push({id:"workbench.views.extensions.searchEnabled",name:L(10546,"Enabled"),ctorDescriptor:new Ft(Lr,[{}]),when:C.and(C.has("searchEnabledExtensions"))}),e.push({id:"workbench.views.extensions.searchDisabled",name:L(10544,"Disabled"),ctorDescriptor:new Ft(Lr,[{}]),when:C.and(C.has("searchDisabledExtensions"))}),e.push({id:gMt,name:L(10537,"Available Updates"),ctorDescriptor:new Ft(HGt,[{}]),when:C.or(XMi,C.has("searchOutdatedExtensions")),order:1}),e.push({id:"workbench.views.extensions.searchBuiltin",name:L(10538,"Builtin"),ctorDescriptor:new Ft(Lr,[{}]),when:C.and(C.has("searchBuiltInExtensions"))}),e.push({id:"workbench.views.extensions.searchWorkspaceUnsupported",name:L(10583,"Workspace Unsupported"),ctorDescriptor:new Ft(Lr,[{}]),when:C.and(C.has("searchWorkspaceUnsupportedExtensions"))}),e}createRecommendedExtensionsViewDescriptors(){let e=[];return e.push({id:QTe,name:L(10582,"Workspace Recommendations"),ctorDescriptor:new Ft(XGt,[{}]),when:C.and(C.has("recommendedExtensions"),za.notEqualsTo("empty")),order:1}),e.push({id:"workbench.views.extensions.otherRecommendations",name:L(10563,"Other Recommendations"),ctorDescriptor:new Ft(YGt,[{}]),when:C.has("recommendedExtensions"),order:2}),e}createBuiltinExtensionsViewDescriptors(){let e=[],t=["themes","programming languages"],o=cF.filter(r=>!t.includes(r.toLowerCase()));o.push(YMi);let n=`${o.map(r=>`category:"${r}"`).join(" ")} ${t.map(r=>`category:"-${r}"`).join(" ")}`;return e.push({id:"workbench.views.extensions.builtinFeatureExtensions",name:L(10539,"Features"),ctorDescriptor:new Ft(voe,[{query:`@builtin ${n}`}]),when:C.has("builtInExtensions")}),e.push({id:"workbench.views.extensions.builtinThemeExtensions",name:L(10541,"Themes"),ctorDescriptor:new Ft(voe,[{query:"@builtin category:themes"}]),when:C.has("builtInExtensions")}),e.push({id:"workbench.views.extensions.builtinProgrammingLanguageExtensions",name:L(10540,"Programming Languages"),ctorDescriptor:new Ft(voe,[{query:'@builtin category:"programming languages"'}]),when:C.has("builtInExtensions")}),e}createUnsupportedWorkspaceExtensionsViewDescriptors(){let e=[];return e.push({id:"workbench.views.extensions.untrustedUnsupportedExtensions",name:L(10579,"Disabled in Restricted Mode"),ctorDescriptor:new Ft(zGt,[{}]),when:C.and(Art)}),e.push({id:"workbench.views.extensions.untrustedPartiallySupportedExtensions",name:L(10578,"Limited in Restricted Mode"),ctorDescriptor:new Ft(KGt,[{}]),when:C.and(Art)}),e.push({id:"workbench.views.extensions.virtualUnsupportedExtensions",name:L(10581,"Disabled in Virtual Workspaces"),ctorDescriptor:new Ft(GGt,[{}]),when:C.and(WR,Art)}),e.push({id:"workbench.views.extensions.virtualPartiallySupportedExtensions",name:L(10580,"Limited in Virtual Workspaces"),ctorDescriptor:new Ft(qGt,[{}]),when:C.and(WR,Art)}),e}createOtherLocalFilteredExtensionsViewDescriptors(){let e=[];return e.push({id:"workbench.views.extensions.deprecatedExtensions",name:L(10543,"Deprecated"),ctorDescriptor:new Ft($Gt,[{}]),when:C.and(Syo)}),e.push({id:"workbench.views.extensions.restartRequired",name:L(10569,"Restart Required"),ctorDescriptor:new Ft(Lr,[{}]),when:C.and(Iyo)}),e}};rWe=I([m(0,Ec),m(1,rt),m(2,X)],rWe);var sWe=class extends Dc{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,P){super(pg,{mergeViewWithContainerWhenSingleView:!0},n,g,e,S,t,y,h,f,v,w,P);this.progressService=o;this.editorGroupService=r;this.extensionsWorkbenchService=l;this.extensionManagementServerService=c;this.notificationService=u;this.paneCompositeService=p;this.contextKeyService=b;this.preferencesService=k;this.commandService=T;this.extensionGalleryManifest=null;this.notificationDisposables=this._register(new me);this.searchDelayer=this._register(new Xo(500)),this.extensionsSearchValueContextKey=iPi.bindTo(b),this.defaultViewsContextKey=QC.bindTo(b),this.sortByContextKey=JMi.bindTo(b),this.searchMarketplaceExtensionsContextKey=ZMi.bindTo(b),this.searchMcpServersContextKey=u7e.bindTo(b),this.searchAgentPluginsContextKey=SMt.bindTo(b),this.searchHasTextContextKey=ePi.bindTo(b),this.sortByUpdateDateContextKey=yyo.bindTo(b),this.installedExtensionsContextKey=ean.bindTo(b),this.searchInstalledExtensionsContextKey=tan.bindTo(b),this.searchRecentlyUpdatedExtensionsContextKey=ian.bindTo(b),this.searchExtensionUpdatesContextKey=XMi.bindTo(b),this.searchWorkspaceUnsupportedExtensionsContextKey=Art.bindTo(b),this.searchDeprecatedExtensionsContextKey=Syo.bindTo(b),this.searchRestartRequiredExtensionsContextKey=Iyo.bindTo(b),this.searchOutdatedExtensionsContextKey=oan.bindTo(b),this.searchEnabledExtensionsContextKey=nan.bindTo(b),this.searchDisabledExtensionsContextKey=ran.bindTo(b),this.hasInstalledExtensionsContextKey=san.bindTo(b),this.builtInExtensionsContextKey=rfe.bindTo(b),this.searchBuiltInExtensionsContextKey=aan.bindTo(b),this.recommendedExtensionsContextKey=tPi.bindTo(b),this._register(this.paneCompositeService.onDidPaneCompositeOpen(O=>{O.viewContainerLocation===0&&this.onViewletOpen(O.composite)},this)),this._register(l.onReset(()=>this.refresh())),this.searchViewletState=this.getMemento(1,1),s.getExtensionGalleryManifest().then(O=>{this.extensionGalleryManifest=O,this._register(s.onDidChangeExtensionGalleryManifest(V=>{this.extensionGalleryManifest=V,this.refresh()}))})}get searchValue(){return this.searchBox?.getValue()}create(e){e.classList.add("extensions-viewlet"),this.root=e;let t=M(this.root,_(".overlay")),o=this.getColor(j5)??"";t.style.backgroundColor=o,vo(t),this.header=M(this.root,_(".header"));let n=d(10571,null),r=this.searchViewletState["query.value"]?this.searchViewletState["query.value"]:"",s=M(this.header,_(".extensions-search-container"));this.searchBox=this._register(this.instantiationService.createInstance($A,`${pg}.searchbox`,s,{triggerCharacters:["@"],sortKey:p=>p.indexOf(":")===-1?"a":/ext:/.test(p)||/id:/.test(p)||/tag:/.test(p)?"b":/sort:/.test(p)?"c":"d",provideResults:p=>oq.suggestions(p,this.extensionGalleryManifest)},n,"extensions:searchinput",{placeholderText:n,value:r})),this.notificationContainer=M(this.header,_(".notification-container.hidden",{tabindex:"0"})),this.renderNotificaiton(),this._register(this.extensionsWorkbenchService.onDidChangeExtensionsNotification(()=>this.renderNotificaiton())),this.updateInstalledExtensionsContexts(),this.searchBox.getValue()&&this.triggerSearch(),this._register(this.searchBox.onInputDidChange(()=>{this.sortByContextKey.set(oq.parse(this.searchBox?.getValue()??"").sortBy),this.triggerSearch()},this)),this._register(this.searchBox.onShouldFocusResults(()=>this.focusListView(),this));let l=M(s,_(".extensions-search-actions-container"));this._register(this.instantiationService.createInstance(or,l,m7e,{toolbarOptions:{primaryGroup:()=>!0},actionViewItemProvider:(p,h)=>Bs(this.instantiationService,p,h)})),this._register(new Uh(this.root,{onDragEnter:p=>{this.isSupportedDragElement(p)&&un(t)},onDragLeave:p=>{this.isSupportedDragElement(p)&&vo(t)},onDragOver:p=>{this.isSupportedDragElement(p)&&(p.dataTransfer.dropEffect="copy")},onDrop:async p=>{if(this.isSupportedDragElement(p)){vo(t);let h=di((await this.instantiationService.invokeFunction(g=>pwe(g,p))).map(g=>g.resource&&es(g.resource)===".vsix"?g.resource:void 0));if(h.length>0)try{await this.commandService.executeCommand(d7e,h)}catch(g){this.notificationService.error(g)}}}})),super.create(M(this.root,_(".extensions")));let c=this._register(qn(this.root)),u=()=>this.searchBox?.inputWidget.hasWidgetFocus();this._register(bT({name:"extensionsView",focusNotifiers:[c],focusNextWidget:()=>{u()&&this.focusListView()},focusPreviousWidget:()=>{u()||this.searchBox?.focus()}}))}focus(){super.focus(),this.searchBox?.focus()}layout(e){this._dimension=e,this.root&&(this.root.classList.toggle("narrow",e.width<=250),this.root.classList.toggle("mini",e.width<=200)),this.searchBox?.layout(new si(e.width-34-8-48,20));let t=41,o=this.header&&this.notificationContainer?.childNodes.length?this.notificationContainer.clientHeight+t+10:t;this.header.style.height=`${o}px`,super.layout(new si(e.width,e.height-o))}getOptimalWidth(){return 400}search(e){this.searchBox&&this.searchBox.getValue()!==e&&this.searchBox.setValue(e)}async refresh(){await this.updateInstalledExtensionsContexts(),this.doSearch(!0),this.configurationService.getValue(c7e)&&this.extensionsWorkbenchService.checkForUpdates()}renderNotificaiton(){if(!this.notificationContainer)return;Rt(this.notificationContainer),this.notificationDisposables.value=new N;let e=this.extensionsWorkbenchService.getExtensionsNotification(),t=e?.query??e?.extensions.map(o=>`@id:${o.identifier.id}`).join(" ");if(e&&(t===this.searchBox?.getValue()||!this.searchMarketplaceExtensionsContextKey.get())){this.notificationContainer.setAttribute("aria-label",e.message),this.notificationContainer.classList.remove("hidden");let o=M(this.notificationContainer,_(".message-container"));M(o,_("span")).className=sk.className(e.severity);let n=M(o,_("span.message-text"));M(n,_("span.message",void 0,e.message));let r=M(n,_("span.message-text-action",{tabindex:"0",role:"button","aria-label":`${e.message}. ${d(10542,null)}`},d(10573,null)));this.notificationDisposables.value.add(j(r,re.CLICK,()=>this.search(t??""))),this.notificationDisposables.value.add(j(r,re.KEY_DOWN,l=>{let c=new gi(l);(c.keyCode===3||c.keyCode===10)&&this.search(t??""),c.stopPropagation()}));let s=M(this.notificationContainer,_(".notification-actions"));if(e.action){let l=M(s,_("span.message-action-button",{tabindex:"0",role:"button","aria-label":e.action.label},e.action.label));this.notificationDisposables.value.add(j(l,re.CLICK,()=>{Promise.resolve(e.action.run()).catch(c=>this.notificationService.error(c))})),this.notificationDisposables.value.add(j(l,re.KEY_DOWN,c=>{let u=new gi(c);(u.keyCode===3||u.keyCode===10)&&Promise.resolve(e.action.run()).catch(p=>this.notificationService.error(p)),u.stopPropagation()}))}}else this.notificationContainer.removeAttribute("aria-label"),this.notificationContainer.classList.add("hidden"),this.searchBox&&Lr.isRestartRequiredQuery(this.searchBox.getValue())&&this.search("");this._dimension&&this.layout(this._dimension)}async updateInstalledExtensionsContexts(){let e=await this.extensionsWorkbenchService.queryLocal();this.hasInstalledExtensionsContextKey.set(e.some(t=>!t.isBuiltin))}triggerSearch(){this.searchDelayer.trigger(()=>this.doSearch(),this.searchBox&&this.searchBox.getValue()?500:0).then(void 0,e=>this.onError(e))}normalizedQuery(){return this.searchBox?this.searchBox.getValue().trim().replace(/@category/g,"category").replace(/@tag:/g,"tag:").replace(/@ext:/g,"ext:").replace(/@featured/g,"featured").replace(/@popular/g,this.extensionManagementServerService.webExtensionManagementServer&&!this.extensionManagementServerService.localExtensionManagementServer&&!this.extensionManagementServerService.remoteExtensionManagementServer?"@web":"@popular"):""}saveState(){let e=this.searchBox?this.searchBox.getValue():"";Lr.isLocalExtensionsQuery(e)?this.searchViewletState["query.value"]=e:this.searchViewletState["query.value"]="",super.saveState()}doSearch(e){let t=this.normalizedQuery();return this.contextKeyService.bufferChangeEvents(()=>{let o=Lr.isRecommendedExtensionsQuery(t);this.searchHasTextContextKey.set(t.trim()!==""),this.extensionsSearchValueContextKey.set(t),this.installedExtensionsContextKey.set(Lr.isInstalledExtensionsQuery(t)),this.searchInstalledExtensionsContextKey.set(Lr.isSearchInstalledExtensionsQuery(t)),this.searchRecentlyUpdatedExtensionsContextKey.set(Lr.isSearchRecentlyUpdatedQuery(t)&&!Lr.isSearchExtensionUpdatesQuery(t)),this.searchOutdatedExtensionsContextKey.set(Lr.isOutdatedExtensionsQuery(t)&&!Lr.isSearchExtensionUpdatesQuery(t)),this.searchExtensionUpdatesContextKey.set(Lr.isSearchExtensionUpdatesQuery(t)),this.searchEnabledExtensionsContextKey.set(Lr.isEnabledExtensionsQuery(t)),this.searchDisabledExtensionsContextKey.set(Lr.isDisabledExtensionsQuery(t)),this.searchBuiltInExtensionsContextKey.set(Lr.isSearchBuiltInExtensionsQuery(t)),this.searchWorkspaceUnsupportedExtensionsContextKey.set(Lr.isSearchWorkspaceUnsupportedExtensionsQuery(t)),this.searchDeprecatedExtensionsContextKey.set(Lr.isSearchDeprecatedExtensionsQuery(t)),this.searchRestartRequiredExtensionsContextKey.set(Lr.isRestartRequiredQuery(t)),this.builtInExtensionsContextKey.set(Lr.isBuiltInExtensionsQuery(t)),this.recommendedExtensionsContextKey.set(o),this.searchMcpServersContextKey.set(!!t&&/@mcp\s?.*/i.test(t)),this.searchAgentPluginsContextKey.set(!!t&&/@agentPlugins\s?.*/i.test(t)),this.searchMarketplaceExtensionsContextKey.set(!!t&&!Lr.isLocalExtensionsQuery(t)&&!o&&!this.searchMcpServersContextKey.get()&&!this.searchAgentPluginsContextKey.get()),this.sortByUpdateDateContextKey.set(Lr.isSortUpdateDateQuery(t)),this.defaultViewsContextKey.set(!t||Lr.isSortInstalledExtensionsQuery(t))}),this.renderNotificaiton(),this.showExtensionsViews(this.panes)}onDidAddViewDescriptors(e){let t=super.onDidAddViewDescriptors(e);return this.showExtensionsViews(t),t}async showExtensionsViews(e){await this.progress(Promise.all(e.map(async t=>{if(t instanceof _Q){let o=await t.show(this.normalizedQuery());this.alertSearchResult(o.length,t.id)}})))}alertSearchResult(e,t){let o=this.viewContainerModel.visibleViewDescriptors.find(n=>n.id===t);switch(e){case 0:break;case 1:o?en(d(10549,null,o.name.value)):en(d(10548,null));break;default:o?en(d(10551,null,e,o.name.value)):en(d(10550,null,e));break}}getFirstExpandedPane(){for(let e of this.panes)if(e.isExpanded()&&e instanceof Lr)return e}focusListView(){let e=this.getFirstExpandedPane();e&&e.count()>0&&e.focus()}onViewletOpen(e){if(!(!e||e.getId()===pg)&&this.configurationService.getValue(moo)){let t=this.editorGroupService.groups.map(o=>{let n=o.editors.filter(r=>r instanceof nq);return o.closeEditors(n)});Promise.all(t)}}progress(e){return this.progressService.withProgress({location:5},()=>e)}onError(e){if(ao(e))return;let t=e&&e.message||"";if(/ECONNREFUSED/.test(t)){let o=w1(d(10577,null),[new it("open user settings",d(10562,null),void 0,!0,()=>this.preferencesService.openUserSettings())]);this.notificationService.error(o);return}this.notificationService.error(e)}isSupportedDragElement(e){return e.dataTransfer?e.dataTransfer.types.map(o=>o.toLocaleLowerCase()).indexOf("files")!==-1:!1}};sWe=I([m(0,yi),m(1,Te),m(2,Fo),m(3,F),m(4,wt),m(5,Dv),m(6,Hi),m(7,Ec),m(8,Ne),m(9,us),m(10,Le),m(11,B),m(12,ce),m(13,Pe),m(14,X),m(15,Xe),m(16,lt),m(17,Bi),m(18,Go),m(19,ge),m(20,se)],sWe);var aWe=class extends x{constructor(e,t,o,n){super();this.activityService=e;this.extensionsWorkbenchService=t;this.extensionEnablementService=o;this.configurationService=n;this.badgeHandle=this._register(new me);this.onServiceChange(),this._register(U.any(U.debounce(t.onChange,()=>{},100,void 0,void 0,void 0,this._store),t.onDidChangeExtensionsNotification)(this.onServiceChange,this))}onServiceChange(){this.badgeHandle.clear();let e,t=this.extensionsWorkbenchService.getExtensionsNotification();if(t&&t.severity===bt.Warning&&(e=new sXe(()=>t.message)),!e){let o=this.configurationService.getValue(OB)===!0?[]:this.extensionsWorkbenchService.installed.filter(s=>s.runtimeState!==void 0),n=this.extensionsWorkbenchService.outdated.reduce((s,l)=>s+(this.extensionEnablementService.isEnabled(l.local)&&!o.includes(l)?1:0),0),r=n+o.length;if(r>0){let s="";n&&(s+=n===1?d(10555,null,n):d(10553,null,n)),n>0&&o.length>0&&(s+=", "),o.length&&(s+=o.length===1?d(10554,null,o.length):d(10552,null,o.length)),e=new Rd(r,()=>s)}}e&&(this.badgeHandle.value=this.activityService.showViewContainerActivity(pg,{badge:e}))}};aWe=I([m(0,Sl),m(1,Hi),m(2,Js),m(3,B)],aWe);var lWe=class{constructor(i,e,t,o,n,r){this.extensionsManagementService=i;this.extensionsWorkbenchService=e;this.hostService=t;this.logService=o;this.notificationService=n;this.commandService=r;this.loopCheckForMaliciousExtensions()}loopCheckForMaliciousExtensions(){this.checkForMaliciousExtensions().then(()=>Li(1e3*60*5)).then(()=>this.loopCheckForMaliciousExtensions())}async checkForMaliciousExtensions(){try{let i=[],e=!1,t=!1;for(let o of this.extensionsWorkbenchService.installed)o.isMalicious&&o.local&&(i.push([o.local,o.maliciousInfoLink]),e=e||o.runtimeState?.action==="restartExtensions",t=t||o.runtimeState?.action==="reloadWindow");if(i.length){await this.extensionsManagementService.uninstallExtensions(i.map(o=>({extension:o[0],options:{remove:!0}})));for(let[o,n]of i){let r=[];(e||t)&&r.push({label:e?d(10570,null):d(10567,null),run:()=>e?this.extensionsWorkbenchService.updateRunningExtensions():this.hostService.reload()}),n&&r.push({label:d(10559,null),run:()=>this.commandService.executeCommand("vscode.open",A.parse(n))}),this.notificationService.prompt(bt.Warning,d(10560,null,o.manifest.displayName||o.identifier.id),r,{sticky:!0,priority:3})}}}catch(i){this.logService.error(i)}}};lWe=I([m(0,Cs),m(1,Hi),m(2,Zt),m(3,se),m(4,Ne),m(5,ge)],lWe);var cWe=class extends x{constructor(e,t){super();this.activityService=e;this.extensionGalleryManifestService=t;this.badgeHandle=this._register(new me);this.accountBadgeDisposable=this._register(new me);this.updateBadge(),this._register(this.extensionGalleryManifestService.onDidChangeExtensionGalleryManifestStatus(()=>this.updateBadge()))}async updateBadge(){this.badgeHandle.clear();let e=this.extensionGalleryManifestService.extensionGalleryManifestStatus,t;switch(e){case"requiresSignIn":t=new Rd(1,()=>d(10576,null));break;case"accessDenied":t=new sXe(()=>d(10536,null));break}if(t&&(this.badgeHandle.value=this.activityService.showViewContainerActivity(pg,{badge:t})),this.accountBadgeDisposable.clear(),e==="requiresSignIn"){let o=new Rd(1,()=>d(10575,null));this.accountBadgeDisposable.value=this.activityService.showAccountsActivity({badge:o})}}};cWe=I([m(0,Sl),m(1,Dv)],cWe);var RW=class{constructor(i,e,t,o,n,r,s,l,c,u,p){this.stateProvider=i;this.runtimeStateProvider=e;this.server=t;this.local=o;this._gallery=n;this.resourceExtensionInfo=r;this.galleryService=s;this.telemetryService=l;this.logService=c;this.fileService=u;this.productService=p;this.enablementState=12;this.galleryResourcesCache=new Map}get resourceExtension(){if(this.resourceExtensionInfo)return this.resourceExtensionInfo.resourceExtension;if(this.local?.isWorkspaceScoped)return{type:"resource",identifier:this.local.identifier,location:this.local.location,manifest:this.local.manifest,changelogUri:this.local.changelogUrl,readmeUri:this.local.readmeUrl}}get gallery(){return this._gallery}set gallery(i){this._gallery=i,this.galleryResourcesCache.clear()}get missingFromGallery(){return!!this._missingFromGallery}set missingFromGallery(i){this._missingFromGallery=i}get type(){return this.local?this.local.type:1}get isBuiltin(){return this.local?this.local.isBuiltin:!1}get isWorkspaceScoped(){return this.local?this.local.isWorkspaceScoped:this.resourceExtensionInfo?this.resourceExtensionInfo.isWorkspaceScoped:!1}get name(){return this.gallery?this.gallery.name:this.getManifestFromLocalOrResource()?.name??""}get displayName(){return this.gallery?this.gallery.displayName||this.gallery.name:this.getManifestFromLocalOrResource()?.displayName??this.name}get identifier(){return this.gallery?this.gallery.identifier:this.resourceExtension?this.resourceExtension.identifier:this.local?.identifier??{id:""}}get uuid(){return this.gallery?this.gallery.identifier.uuid:this.local?.identifier.uuid}get publisher(){return this.gallery?this.gallery.publisher:this.getManifestFromLocalOrResource()?.publisher??""}get publisherDisplayName(){return this.gallery?this.gallery.publisherDisplayName||this.gallery.publisher:this.local?.publisherDisplayName?this.local.publisherDisplayName:this.publisher}get publisherUrl(){return this.gallery?.publisherLink?A.parse(this.gallery.publisherLink):void 0}get publisherDomain(){return this.gallery?.publisherDomain}get publisherSponsorLink(){return this.gallery?.publisherSponsorLink?A.parse(this.gallery.publisherSponsorLink):void 0}get version(){return this.local?this.local.manifest.version:this.latestVersion}get private(){return this.gallery?this.gallery.private:this.local?this.local.private:!1}get pinned(){return!!this.local?.pinned}get latestVersion(){return this.gallery?this.gallery.version:this.getManifestFromLocalOrResource()?.version??""}get description(){return this.gallery?this.gallery.description:this.getManifestFromLocalOrResource()?.description??""}get url(){return this.gallery?.detailsLink}get iconUrl(){return this.galleryIconUrl||this.resourceExtensionIconUrl||this.localIconUrl||this.defaultIconUrl}get iconUrlFallback(){return this.gallery?.assets.icon?.fallbackUri}get localIconUrl(){if(this.local&&this.local.manifest.icon)return vn.uriToBrowserUri(Ge(this.local.location,this.local.manifest.icon)).toString(!0)}get resourceExtensionIconUrl(){if(this.resourceExtension?.manifest.icon)return vn.uriToBrowserUri(Ge(this.resourceExtension.location,this.resourceExtension.manifest.icon)).toString(!0)}get galleryIconUrl(){return this.gallery?.assets.icon?.uri}get defaultIconUrl(){if(this.type===0&&this.local&&this.local.manifest&&this.local.manifest.contributes){if(Array.isArray(this.local.manifest.contributes.themes)&&this.local.manifest.contributes.themes.length)return vn.asBrowserUri("vs/workbench/contrib/extensions/browser/media/theme-icon.png").toString(!0);if(Array.isArray(this.local.manifest.contributes.grammars)&&this.local.manifest.contributes.grammars.length)return vn.asBrowserUri("vs/workbench/contrib/extensions/browser/media/language-icon.svg").toString(!0)}}get repository(){return this.gallery&&this.gallery.assets.repository?this.gallery.assets.repository.uri:void 0}get licenseUrl(){return this.gallery&&this.gallery.assets.license?this.gallery.assets.license.uri:void 0}get supportUrl(){return this.gallery&&this.gallery.supportLink?this.gallery.supportLink:void 0}get state(){return this.stateProvider(this)}get isMalicious(){return!!this.malicious||this.enablementState===4}get maliciousInfoLink(){return this.malicious?.learnMoreLink}get installCount(){return this.gallery?this.gallery.installCount:void 0}get rating(){return this.gallery?this.gallery.rating:void 0}get ratingCount(){return this.gallery?this.gallery.ratingCount:void 0}get ratingUrl(){return this.gallery?.ratingLink}get outdated(){try{if(!this.gallery||!this.local||this.type===0&&this.productService.quality==="stable"||!this.local.preRelease&&this.gallery.properties.isPreReleaseVersion)return!1;if(zR(this.latestVersion,this.version)||this.outdatedTargetPlatform)return!0}catch{}return!1}get outdatedTargetPlatform(){return!!this.local&&!!this.gallery&&!["undefined","web"].includes(this.local.targetPlatform)&&this.gallery.properties.targetPlatform!=="web"&&this.local.targetPlatform!==this.gallery.properties.targetPlatform&&BLt(this.latestVersion,this.version)}get runtimeState(){return this.runtimeStateProvider(this)}get telemetryData(){let{local:i,gallery:e}=this;return e?xde(e):i?PTt(i):{}}get preview(){return this.local?.manifest.preview??this.gallery?.preview??!1}get preRelease(){return!!this.local?.preRelease}get isPreReleaseVersion(){return this.local?this.local.isPreReleaseVersion:!!this.gallery?.properties.isPreReleaseVersion}get hasPreReleaseVersion(){return this.gallery?this.gallery.hasPreReleaseVersion:!!this.local?.hasPreReleaseVersion}get hasReleaseVersion(){return!!this.resourceExtension||!!this.gallery?.hasReleaseVersion}getLocal(){return this.local&&!this.outdated?this.local:void 0}async getManifest(i){let e=this.getLocal();return e?e.manifest:this.gallery?this.getGalleryManifest(i):this.resourceExtension?this.resourceExtension.manifest:null}async getGalleryManifest(i=Se.None){if(this.gallery){let e=this.galleryResourcesCache.get("manifest");return e||(this.gallery.assets.manifest?this.galleryResourcesCache.set("manifest",e=this.galleryService.getManifest(this.gallery,i).catch(t=>{throw this.galleryResourcesCache.delete("manifest"),t})):this.logService.error(d(10658,null),this.identifier.id)),e}return null}hasReadme(){return this.local&&this.local.readmeUrl||this.gallery&&this.gallery.assets.readme||this.resourceExtension?.readmeUri?!0:this.type===0}async getReadme(i){let e=this.getLocal();if(e?.readmeUrl)return(await this.fileService.readFile(e.readmeUrl)).value.toString();if(this.gallery){if(this.gallery.assets.readme)return this.galleryService.getReadme(this.gallery,i);this.telemetryService.publicLog("extensions:NotFoundReadMe",this.telemetryData)}return this.type===0?Promise.resolve(`# ${this.displayName||this.name}
**Notice:** This extension is bundled with Visual Studio Code. It can be disabled but not uninstalled.
## Features
${this.description}
`):this.resourceExtension?.readmeUri?(await this.fileService.readFile(this.resourceExtension?.readmeUri)).value.toString():Promise.reject(new Error("not available"))}hasChangelog(){return this.local&&this.local.changelogUrl||this.gallery&&this.gallery.assets.changelog?!0:this.type===0}async getChangelog(i){let e=this.getLocal();return e?.changelogUrl?(await this.fileService.readFile(e.changelogUrl)).value.toString():this.gallery?.assets.changelog?this.galleryService.getChangelog(this.gallery,i):this.type===0?Promise.resolve(`Please check the [VS Code Release Notes](command:${K0e}) for changes to the built-in extensions.`):Promise.reject(new Error("not available"))}get categories(){let{local:i,gallery:e,resourceExtension:t}=this;return i&&i.manifest.categories&&!this.outdated?i.manifest.categories:e?e.categories:t?t.manifest.categories??[]:[]}get tags(){let{gallery:i}=this;return i?i.tags.filter(e=>!e.startsWith("_")):[]}get dependencies(){let{local:i,gallery:e,resourceExtension:t}=this;return i&&i.manifest.extensionDependencies&&!this.outdated?i.manifest.extensionDependencies:e?e.properties.dependencies||[]:t?t.manifest.extensionDependencies||[]:[]}get extensionPack(){let{local:i,gallery:e,resourceExtension:t}=this;return i&&i.manifest.extensionPack&&!this.outdated?i.manifest.extensionPack:e?e.properties.extensionPack||[]:t?t.manifest.extensionPack||[]:[]}setExtensionsControlManifest(i){this.malicious=Dmi(this.identifier,i.malicious),this.deprecationInfo=i.deprecated?i.deprecated[this.identifier.id.toLowerCase()]:void 0}getManifestFromLocalOrResource(){return this.local?this.local.manifest:this.resourceExtension?this.resourceExtension.manifest:null}};RW=I([m(6,fa),m(7,Te),m(8,se),m(9,fe),m(10,tt)],RW);var oPi="extensions.autoUpdate",nPi="extensions.donotAutoUpdate",rPi="extensions.dismissedNotifications",sfe=class extends x{constructor(e,t,o,n,r,s,l,c,u){super();this.server=e;this.stateProvider=t;this.runtimeStateProvider=o;this.isWorkspaceServer=n;this.galleryService=r;this.extensionEnablementService=s;this.workbenchExtensionManagementService=l;this.telemetryService=c;this.instantiationService=u;this._onChange=this._register(new E);this._onReset=this._register(new E);this.installing=[];this.uninstalling=[];this.installed=[];this._register(e.extensionManagementService.onInstallExtension(p=>this.onInstallExtension(p))),this._register(e.extensionManagementService.onDidInstallExtensions(p=>this.onDidInstallExtensions(p))),this._register(e.extensionManagementService.onUninstallExtension(p=>this.onUninstallExtension(p.identifier))),this._register(e.extensionManagementService.onDidUninstallExtension(p=>this.onDidUninstallExtension(p))),this._register(e.extensionManagementService.onDidUpdateExtensionMetadata(p=>this.onDidUpdateExtensionMetadata(p.local))),this._register(e.extensionManagementService.onDidChangeProfile(()=>this.reset())),this._register(s.onEnablementChanged(p=>this.onEnablementChanged(p))),this._register(U.any(this.onChange,this.onReset)(()=>this._local=void 0)),this.isWorkspaceServer&&(this._register(this.workbenchExtensionManagementService.onInstallExtension(p=>{p.workspaceScoped&&this.onInstallExtension(p)})),this._register(this.workbenchExtensionManagementService.onDidInstallExtensions(p=>{let h=p.filter(g=>g.workspaceScoped);h.length&&this.onDidInstallExtensions(h)})),this._register(this.workbenchExtensionManagementService.onUninstallExtension(p=>{p.workspaceScoped&&this.onUninstallExtension(p.identifier)})),this._register(this.workbenchExtensionManagementService.onDidUninstallExtension(p=>{p.workspaceScoped&&this.onDidUninstallExtension(p)})))}get onChange(){return this._onChange.event}get onReset(){return this._onReset.event}get local(){if(!this._local){this._local=[];for(let e of this.installed)this._local.push(e);for(let e of this.installing)this.installed.some(t=>Ut(t.identifier,e.identifier))||this._local.push(e)}return this._local}async queryInstalled(e){return await this.fetchInstalledExtensions(e),this._onChange.fire(void 0),this.local}async syncInstalledExtensionsWithGallery(e,t,o){let n=await this.mapInstalledExtensionWithCompatibleGalleryExtension(e,t);for(let[r,s]of n)r.local&&!r.local.identifier.uuid&&(r.local=await this.updateMetadata(r.local,s)),(!r.gallery||r.gallery.version!==s.version||r.gallery.properties.targetPlatform!==s.properties.targetPlatform)&&(r.gallery=s,this._onChange.fire({extension:r}));if(o){let r=[];for(let s of this.local)s.gallery||s.missingFromGallery||s.identifier.uuid&&o.some(l=>Ut(l,s.identifier))&&r.push(s);if(r.length){let s=await this.galleryService.getExtensions(r.map(u=>({...u.identifier,version:u.version})),Se.None),l=[],c=[];for(let u of r){l.push(u.identifier.id);let p=s.find(h=>Ut(h.identifier,u.identifier));p?u.gallery=p:(u.missingFromGallery=!0,c.push(u.identifier.id)),this._onChange.fire({extension:u})}this.telemetryService.publicLog2("extensions:missingFromGallery",{queriedIds:new sg(l.join(";")),missingIds:new sg(c.join(";"))})}}}async mapInstalledExtensionWithCompatibleGalleryExtension(e,t){let o=this.mapInstalledExtensionWithGalleryExtension(e),n=await this.server.extensionManagementService.getTargetPlatform(),r=[],s=[];if(await Promise.allSettled(o.map(async([l,c])=>{l.local&&(await this.galleryService.isExtensionCompatible(c,l.local.preRelease,n,t)?r.push(c):s.push({...l.local.identifier,preRelease:l.local.preRelease}))})),s.length){let l=await this.galleryService.getExtensions(s,{targetPlatform:n,compatible:!0,queryAllVersions:!0,productVersion:t},Se.None);r.push(...l)}return this.mapInstalledExtensionWithGalleryExtension(r)}mapInstalledExtensionWithGalleryExtension(e){let t=[],o=new Map,n=new Map;for(let r of e)o.set(r.identifier.uuid,r),n.set(r.identifier.id.toLowerCase(),r);for(let r of this.installed){if(r.uuid){let s=o.get(r.uuid);if(s){t.push([r,s]);continue}}if(r.local?.source!=="resource"){let s=n.get(r.identifier.id.toLowerCase());s&&t.push([r,s])}}return t}async updateMetadata(e,t){let o=!1;return e.manifest.version!==t.version&&(this.telemetryService.publicLog2("galleryService:updateMetadata"),o=!!(await this.galleryService.getExtensions([{...e.identifier,version:e.manifest.version}],Se.None))[0]?.properties?.isPreReleaseVersion),this.workbenchExtensionManagementService.updateMetadata(e,{id:t.identifier.uuid,publisherDisplayName:t.publisherDisplayName,publisherId:t.publisherId,isPreReleaseVersion:o})}canInstall(e){return this.server.extensionManagementService.canInstall(e)}onInstallExtension(e){let{source:t}=e;if(t&&!A.isUri(t)){let o=this.installed.find(n=>Ut(n.identifier,t.identifier))??this.instantiationService.createInstance(RW,this.stateProvider,this.runtimeStateProvider,this.server,void 0,t,void 0);this.installing.push(o),this._onChange.fire({extension:o})}}async fetchInstalledExtensions(e){let t=await this.server.extensionManagementService.getExtensionsControlManifest(),o=await this.server.extensionManagementService.getInstalled(void 0,void 0,e);this.isWorkspaceServer&&o.push(...await this.workbenchExtensionManagementService.getInstalledWorkspaceExtensions(!0));let n=_mi(o,s=>s.identifier).reduce((s,l)=>{if(l.length===1)s.push(l[0]);else{let c,u,p;for(let g of l)g.isWorkspaceScoped?c=g:g.type===1?u=g:p=g;let h=c??u??p;h&&s.push(h)}return s},[]),r=L9(this.installed,s=>s.local?s.local.identifier.id:s.identifier.id);this.installed=n.map(s=>{let l=r[s.identifier.id]||this.instantiationService.createInstance(RW,this.stateProvider,this.runtimeStateProvider,this.server,s,void 0,void 0);return l.local=s,l.enablementState=this.extensionEnablementService.getEnablementState(s),l.setExtensionsControlManifest(t),l})}async reset(){this.installed=[],this.installing=[],this.uninstalling=[],await this.fetchInstalledExtensions(),this._onReset.fire()}async onDidInstallExtensions(e){let t=[];for(let o of e){let{local:n,source:r}=o,s=r&&!A.isUri(r)?r:void 0,l=r&&A.isUri(r)?r:void 0,c=s?this.installing.filter(p=>Ut(p.identifier,s.identifier))[0]:null;this.installing=c?this.installing.filter(p=>p!==c):this.installing;let u=c||(l||n?this.instantiationService.createInstance(RW,this.stateProvider,this.runtimeStateProvider,this.server,n,void 0,void 0):void 0);if(u){if(n){let p=this.installed.filter(h=>Ut(h.identifier,u.identifier))[0];p?u=p:this.installed.push(u),u.local=n,u.gallery||(u.gallery=s),u.enablementState=this.extensionEnablementService.getEnablementState(n)}t.push(u)}this._onChange.fire(!n||!u?void 0:{extension:u,operation:o.operation})}if(t.length){let o=await this.server.extensionManagementService.getExtensionsControlManifest();for(let n of t)n.setExtensionsControlManifest(o);this.matchInstalledExtensionsWithGallery(t)}}async onDidUpdateExtensionMetadata(e){let t=this.installed.find(o=>Ut(o.identifier,e.identifier));t?.local&&(t.local=e,this._onChange.fire({extension:t}))}async matchInstalledExtensionsWithGallery(e){let t=e.filter(n=>n.local&&!n.gallery&&n.local.source!=="resource");if(!t.length||!this.galleryService.isEnabled())return;let o=await this.galleryService.getExtensions(t.map(n=>({...n.identifier,preRelease:n.local?.preRelease})),{compatible:!0,targetPlatform:await this.server.extensionManagementService.getTargetPlatform()},Se.None);for(let n of e){let r=o.find(s=>Ut(s.identifier,n.identifier));r&&(n.gallery=r,this._onChange.fire({extension:n}))}}onUninstallExtension(e){let t=this.installed.filter(o=>Ut(o.identifier,e))[0];if(t){let o=this.uninstalling.filter(n=>Ut(n.identifier,e))[0]||t;this.uninstalling=[o,...this.uninstalling.filter(n=>!Ut(n.identifier,e))],this._onChange.fire(o?{extension:o}:void 0)}}onDidUninstallExtension({identifier:e,error:t}){let o=this.uninstalling.find(n=>Ut(n.identifier,e))||this.installed.find(n=>Ut(n.identifier,e));this.uninstalling=this.uninstalling.filter(n=>!Ut(n.identifier,e)),t||(this.installed=this.installed.filter(n=>!Ut(n.identifier,e))),o&&this._onChange.fire({extension:o})}onEnablementChanged(e){let t=this.local.filter(o=>e.some(n=>Ut(o.identifier,n.identifier)));for(let o of t)if(o.local){let n=this.extensionEnablementService.getEnablementState(o.local);n!==o.enablementState&&(o.enablementState=n,this._onChange.fire({extension:o}))}}getExtensionState(e){return e.gallery&&this.installing.some(o=>!!o.gallery&&Ut(o.gallery.identifier,e.gallery.identifier))?0:this.uninstalling.some(o=>Ut(o.identifier,e.identifier))?2:this.installed.filter(o=>o===e||o.gallery&&e.gallery&&Ut(o.gallery.identifier,e.gallery.identifier))[0]?1:3}};sfe=I([m(4,fa),m(5,Js),m(6,ru),m(7,Te),m(8,F)],sfe);var DQ=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,P,O,V,H,G,$,J,ae,he,oe,de,Ce,xe,ze,De,Oe,pt){super();this.instantiationService=e;this.editorService=t;this.extensionManagementService=o;this.galleryService=n;this.extensionGalleryManifestService=r;this.configurationService=s;this.telemetryService=l;this.notificationService=c;this.extensionEnablementService=p;this.hostService=h;this.progressService=g;this.extensionManagementServerService=f;this.languageService=v;this.extensionsSyncManagementService=b;this.userDataAutoSyncService=S;this.productService=y;this.extensionManifestPropertiesService=k;this.logService=T;this.extensionService=P;this.localeService=O;this.lifecycleService=V;this.fileService=H;this.userDataProfileService=G;this.userDataProfilesService=$;this.storageService=J;this.dialogService=ae;this.userDataSyncEnablementService=he;this.updateService=oe;this.uriIdentityService=de;this.workspaceContextService=Ce;this.viewsService=xe;this.fileDialogService=ze;this.quickInputService=De;this.allowedExtensionsService=Oe;this.meteredConnectionService=pt;this.localExtensions=null;this.remoteExtensions=null;this.webExtensions=null;this.extensionsServers=[];this._onChange=this._register(new E);this._onDidChangeExtensionsNotification=this._register(new E);this.onDidChangeExtensionsNotification=this._onDidChangeExtensionsNotification.event;this._onReset=this._register(new E);this.installing=[];this.tasksInProgress=[];this.autoRestartListenerDisposable=this._register(new me);this.hasOutdatedExtensionsContextKey=bMt.bindTo(w),f.localExtensionManagementServer&&(this.localExtensions=this._register(e.createInstance(sfe,f.localExtensionManagementServer,et=>this.getExtensionState(et),et=>this.getRuntimeState(et),!f.remoteExtensionManagementServer)),this._register(this.localExtensions.onChange(et=>this.onDidChangeExtensions(et?.extension))),this._register(this.localExtensions.onReset(et=>this.reset())),this.extensionsServers.push(this.localExtensions)),f.remoteExtensionManagementServer&&(this.remoteExtensions=this._register(e.createInstance(sfe,f.remoteExtensionManagementServer,et=>this.getExtensionState(et),et=>this.getRuntimeState(et),!0)),this._register(this.remoteExtensions.onChange(et=>this.onDidChangeExtensions(et?.extension))),this._register(this.remoteExtensions.onReset(et=>this.reset())),this.extensionsServers.push(this.remoteExtensions)),f.webExtensionManagementServer&&(this.webExtensions=this._register(e.createInstance(sfe,f.webExtensionManagementServer,et=>this.getExtensionState(et),et=>this.getRuntimeState(et),!(f.remoteExtensionManagementServer||f.localExtensionManagementServer))),this._register(this.webExtensions.onChange(et=>this.onDidChangeExtensions(et?.extension))),this._register(this.webExtensions.onReset(et=>this.reset())),this.extensionsServers.push(this.webExtensions)),this.updatesCheckDelayer=new ya(DQ.UpdatesCheckInterval),this.autoUpdateDelayer=new ya(1e3),this._register(Z(()=>{this.updatesCheckDelayer.cancel(),this.autoUpdateDelayer.cancel()})),u.registerHandler(this),this.whenInitialized=this.initialize()}static{this.UpdatesCheckInterval=1e3*60*60*12}get onChange(){return this._onChange.event}get onReset(){return this._onReset.event}async initialize(){await Promise.all([this.queryLocal(),this.extensionService.whenInstalledExtensionsRegistered()]),!this._store.isDisposed&&(this.onDidChangeRunningExtensions(this.extensionService.extensions,[]),this._register(this.extensionService.onDidChangeExtensions(({added:e,removed:t})=>this.onDidChangeRunningExtensions(e,t))),await this.lifecycleService.when(4),!this._store.isDisposed&&(this.initializeAutoUpdate(),this.updateExtensionsNotificaiton(),this.reportInstalledExtensionsTelemetry(),this._register(this.storageService.onDidChangeValue(0,rPi,this._store)(e=>this.onDidDismissedNotificationsValueChange())),this._register(this.storageService.onDidChangeValue(-1,oPi,this._store)(e=>this.onDidSelectedExtensionToAutoUpdateValueChange())),this._register(this.storageService.onDidChangeValue(-1,nPi,this._store)(e=>this.onDidSelectedExtensionToAutoUpdateValueChange())),this._register(U.debounce(this.onChange,()=>{},100)(()=>{this.updateExtensionsNotificaiton(),this.reportProgressFromOtherSources()}))))}initializeAutoUpdate(){this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration(Fw)&&this.isAutoUpdateEnabled()&&this.eventuallyAutoUpdateExtensions(),e.affectsConfiguration(c7e)&&this.isAutoCheckUpdatesEnabled()&&this.checkForUpdates("Enabled auto check updates")})),this._register(this.extensionEnablementService.onEnablementChanged(e=>{this.isAutoCheckUpdatesEnabled()&&this.getAutoUpdateValue()==="onlyEnabledExtensions"&&e.some(t=>this.extensionEnablementService.isEnabled(t))&&this.checkForUpdates("Extension enablement changed")})),this._register(U.debounce(this.onChange,()=>{},100)(()=>this.hasOutdatedExtensionsContextKey.set(this.outdated.length>0))),this._register(this.updateService.onStateChange(e=>{(e.type==="checking for updates"&&e.explicit||e.type==="available for download"||e.type==="downloaded")&&(this.telemetryService.publicLog2("extensions:updatecheckonproductupdate"),this.isAutoCheckUpdatesEnabled()&&this.checkForUpdates("Product update"))})),this._register(this.allowedExtensionsService.onDidChangeAllowedExtensionsConfigValue(()=>{this.isAutoCheckUpdatesEnabled()&&this.checkForUpdates("Allowed extensions changed")})),this._register(this.meteredConnectionService.onDidChangeIsConnectionMetered(()=>{this.isAutoCheckUpdatesEnabled()&&this.checkForUpdates("Connection is no longer metered"),Wt&&!this.isAutoUpdateEnabled()&&this.autoUpdateBuiltinExtensions()})),this.hasOutdatedExtensionsContextKey.set(this.outdated.length>0),this.eventuallyCheckForUpdates(!0),Wt&&(this.syncPinnedBuiltinExtensions(),this.isAutoUpdateEnabled()||this.autoUpdateBuiltinExtensions()),this.registerAutoRestartListener(),this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration(OB)&&this.registerAutoRestartListener()}))}isAutoUpdateEnabled(){return this.meteredConnectionService.isConnectionMetered?!1:this.getAutoUpdateValue()!==!1}getAutoUpdateValue(){let e=this.configurationService.getValue(Fw);return e==="onlySelectedExtensions"?!1:Wa(e)||e==="onlyEnabledExtensions"?e:!0}async updateAutoUpdateForAllExtensions(e){this.isAutoUpdateEnabled()===e||!(await this.dialogService.confirm({title:d(10622,null),message:e?d(10621,null):d(10620,null),detail:d(10623,null)})).confirmed||(this.setEnabledAutoUpdateExtensions([]),await this.configurationService.updateValue(Fw,e),this.setDisabledAutoUpdateExtensions([]),await this.updateExtensionsPinnedState(!e),this._onChange.fire(void 0))}registerAutoRestartListener(){this.autoRestartListenerDisposable.value=void 0,this.configurationService.getValue(OB)===!0&&(this.autoRestartListenerDisposable.value=this.hostService.onDidChangeFocus(e=>{!e&&this.configurationService.getValue(OB)===!0&&this.updateRunningExtensions(void 0,!0)}))}reportInstalledExtensionsTelemetry(){let e=this.installed.filter(t=>!t.isBuiltin&&(t.enablementState===13||t.enablementState===12)).map(t=>Ii.toKey(t.identifier.id));this.telemetryService.publicLog2("installedExtensions",{extensionIds:new sg(e.join(";")),count:e.length})}async onDidChangeRunningExtensions(e,t){let o=[],n=[];for(let s of e){let l=this.installed.find(c=>Ut({id:s.identifier.value,uuid:s.uuid},c.identifier));l?o.push(l):n.push(s)}let r=[];for(let s of t)this.workspaceContextService.isInsideWorkspace(s.extensionLocation)?r.push(s):n.push(s);if(n.length){let s=await this.getExtensions(n.map(l=>({id:l.identifier.value,uuid:l.uuid})),Se.None);o.push(...s)}if(r.length){let s=await this.getResourceExtensions(r.map(l=>l.extensionLocation),!0);o.push(...s)}for(let s of o)this._onChange.fire(s)}updateExtensionsPinnedState(e){return this.progressService.withProgress({location:5,title:d(10695,null)},()=>this.extensionManagementService.resetPinnedStateForAllUserExtensions(e))}reset(){for(let e of this.tasksInProgress)e.cancel();this.tasksInProgress=[],this.installing=[],this.onDidChangeExtensions(),this._onReset.fire()}onDidChangeExtensions(e){this._installed=void 0,this._local=void 0,this._onChange.fire(e)}get local(){if(!this._local)if(this.extensionsServers.length===1)this._local=this.installed;else{this._local=[];let e=_mi(this.installed,t=>t.identifier);for(let t of e)this._local.push(this.getPrimaryExtension(t))}return this._local}get installed(){if(!this._installed){this._installed=[];for(let e of this.extensionsServers)for(let t of e.local)this._installed.push(t)}return this._installed}get outdated(){return this.installed.filter(e=>e.outdated&&e.local&&e.state===1)}async queryLocal(e){if(e){if(this.localExtensions&&this.extensionManagementServerService.localExtensionManagementServer===e)return this.localExtensions.queryInstalled(this.getProductVersion());if(this.remoteExtensions&&this.extensionManagementServerService.remoteExtensionManagementServer===e)return this.remoteExtensions.queryInstalled(this.getProductVersion());if(this.webExtensions&&this.extensionManagementServerService.webExtensionManagementServer===e)return this.webExtensions.queryInstalled(this.getProductVersion())}if(this.localExtensions)try{await this.localExtensions.queryInstalled(this.getProductVersion())}catch(t){this.logService.error(t)}if(this.remoteExtensions)try{await this.remoteExtensions.queryInstalled(this.getProductVersion())}catch(t){this.logService.error(t)}if(this.webExtensions)try{await this.webExtensions.queryInstalled(this.getProductVersion())}catch(t){this.logService.error(t)}return this.local}async queryGallery(e,t){if(!this.galleryService.isEnabled())return MDi([]);let o=Se.isCancellationToken(e)?{}:e,n=Se.isCancellationToken(e)?e:t;o.text=o.text?this.resolveQueryText(o.text):o.text,o.includePreRelease=gn(o.includePreRelease)?this.extensionManagementService.preferPreReleases:o.includePreRelease;let r=await this.extensionManagementService.getExtensionsControlManifest(),s=await this.galleryService.query(o,n);return this.syncInstalledExtensionsWithGallery(s.firstPage),{firstPage:s.firstPage.map(l=>this.fromGallery(l,r)),total:s.total,pageSize:s.pageSize,getPage:async(l,c)=>{let u=await s.getPage(l,c);return this.syncInstalledExtensionsWithGallery(u),u.map(p=>this.fromGallery(p,r))}}}async getExtensions(e,t,o){if(!this.galleryService.isEnabled())return[];e.forEach(s=>s.preRelease=s.preRelease??this.extensionManagementService.preferPreReleases);let n=await this.extensionManagementService.getExtensionsControlManifest(),r=await this.galleryService.getExtensions(e,t,o);return this.syncInstalledExtensionsWithGallery(r),r.map(s=>this.fromGallery(s,n))}async getResourceExtensions(e,t){return(await this.extensionManagementService.getExtensions(e)).map(n=>this.getInstalledExtensionMatchingLocation(n.location)??this.instantiationService.createInstance(RW,r=>this.getExtensionState(r),r=>this.getRuntimeState(r),void 0,void 0,void 0,{resourceExtension:n,isWorkspaceScoped:t}))}onDidDismissedNotificationsValueChange(){this.dismissedNotificationsValue!==this.getDismissedNotificationsValue()&&(this._dismissedNotificationsValue=void 0,this.updateExtensionsNotificaiton())}updateExtensionsNotificaiton(){let e=this.computeExtensionsNotifications(),t=[],o;if(e.length){for(let n of this.getDismissedNotifications())e.some(r=>r.key===n)&&t.push(n);t.includes(e[0].key)||(o={message:e[0].message,severity:e[0].severity,extensions:e[0].extensions,query:e[0].query,action:e[0].action,key:e[0].key,dismiss:()=>{this.setDismissedNotifications([...this.getDismissedNotifications(),e[0].key]),this.updateExtensionsNotificaiton()}})}this.setDismissedNotifications(t),this.extensionsNotification?.key!==o?.key&&(this.extensionsNotification=o,this._onDidChangeExtensionsNotification.fire(this.extensionsNotification))}computeExtensionsNotifications(){let e=[],t=this.local.filter(r=>r.enablementState===7);t.length&&e.push({message:this.configurationService.inspect(Ide).policy?d(10631,null):d(10630,null),severity:ft.Warning,extensions:t,key:"disallowedExtensions:"+t.sort((r,s)=>r.identifier.id.localeCompare(s.identifier.id)).map(r=>r.identifier.id.toLowerCase()).join("-")});let o=this.local.filter(r=>r.enablementState===6&&!r.isWorkspaceScoped);if(o.length&&(o.some(r=>r.local&&r.local.manifest.engines?.vscode&&(!vme(r.local.manifest.engines.vscode,this.productService.version,this.productService.date)||z3([...r.local.manifest.enabledApiProposals??[]])))?e.push({message:d(10648,null),severity:ft.Warning,extensions:o,key:"incompatibleExtensions:"+o.sort((r,s)=>r.identifier.id.localeCompare(s.identifier.id)).map(r=>`${r.identifier.id.toLowerCase()}@${r.local?.manifest.version}`).join("-")}):e.push({message:d(10656,null),severity:ft.Warning,extensions:o,key:"invalidExtensions:"+o.sort((r,s)=>r.identifier.id.localeCompare(s.identifier.id)).map(r=>`${r.identifier.id.toLowerCase()}@${r.local?.manifest.version}`).join("-")})),!this.configurationService.getValue(OB)){let r=this.local.filter(s=>s.runtimeState!==void 0&&(s.runtimeState.action==="restartExtensions"||s.runtimeState.action==="reloadWindow"));if(r.length){let s=r.some(l=>l.runtimeState?.action==="reloadWindow");e.push({message:s?d(10644,null):d(10645,null),severity:ft.Info,extensions:r,query:"@restartrequired",action:{label:s?d(10677,null):d(10681,null),run:()=>{s?this.hostService.reload():this.updateRunningExtensions()}},key:"restartRequired:"+r.sort((l,c)=>l.identifier.id.localeCompare(c.identifier.id)).map(l=>l.identifier.id.toLowerCase()).join("-")})}}let n=this.local.filter(r=>!!r.deprecationInfo&&r.local&&this.extensionEnablementService.isEnabled(r.local));return n.length&&e.push({message:d(10626,null),severity:ft.Warning,extensions:n,key:"deprecatedExtensions:"+n.sort((r,s)=>r.identifier.id.localeCompare(s.identifier.id)).map(r=>r.identifier.id.toLowerCase()).join("-")}),e}getExtensionsNotification(){return this.extensionsNotification}resolveQueryText(e){e=e.replace(/@web/g,`tag:"${hTt}"`);let t=/\bext:([^\s]+)\b/g;return t.test(e)&&(e=e.replace(t,(o,n)=>{let s=(this.productService.extensionKeywords||{})[n]||[],l=this.languageService.guessLanguageIdByFilepathOrFirstLine(A.file(`.${n}`)),c=l&&this.languageService.getLanguageName(l),u=c?` tag:"${c}"`:"";return`tag:"__ext_${n}" tag:"__ext_.${n}" ${s.map(p=>`tag:"${p}"`).join(" ")}${u} tag:"${n}"`})),e.substr(0,350)}fromGallery(e,t){let o=this.getInstalledExtensionMatchingGallery(e);return o||(o=this.instantiationService.createInstance(RW,n=>this.getExtensionState(n),n=>this.getRuntimeState(n),void 0,void 0,e,void 0),o.setExtensionsControlManifest(t)),o}getInstalledExtensionMatchingGallery(e){for(let t of this.local)if(t.identifier.uuid){if(t.identifier.uuid===e.identifier.uuid)return t}else if(t.local?.source!=="resource"&&Ut(t.identifier,e.identifier))return t;return null}getInstalledExtensionMatchingLocation(e){return this.local.find(t=>t.local&&this.uriIdentityService.extUri.isEqualOrParent(e,t.local?.location))??null}async open(e,t){if(typeof e=="string"){let n=e;e=this.installed.find(r=>Ut(r.identifier,{id:n}))??(await this.getExtensions([{id:e}],Se.None))[0]}if(!e)throw new Error(`Extension not found. ${e}`);let o=this.configurationService.getValue("extensions.allowOpenInModalEditor");await this.editorService.openEditor(this.instantiationService.createInstance(nq,e),t,t?.sideByside?In:o?OR:jn)}async openSearch(e,t){let o=(await this.viewsService.openViewContainer(pg,!0))?.getViewPaneContainer();o.search(e),t||o.focus()}getExtensionRuntimeStatus(e){let t=this.extensionService.getExtensionsStatus();for(let o of Object.keys(t))if(Ut({id:o},e.identifier))return t[o]}async updateRunningExtensions(e=d(10679,null),t=!1){let o=[],n=[],r=[...this.local];for(let s of r){let l=s.runtimeState;if(!l||l.action!=="restartExtensions")continue;if(s.state===3){n.push(s.identifier.id);continue}if(!s.local)continue;if(this.extensionEnablementService.isEnabled(s.local)){let u=this.extensionService.extensions.find(p=>Ut({id:p.identifier.value,uuid:p.uuid},s.identifier));u&&n.push(u.identifier.value),o.push(s.local)}else n.push(s.identifier.id)}for(let s of this.extensionService.extensions)s.isUnderDevelopment||r.some(l=>Ut({id:s.identifier.value,uuid:s.uuid},l.local?.identifier??l.identifier))||n.push(s.identifier.value);(o.length||n.length)&&await this.extensionService.stopExtensionHosts(e,t)&&(await this.extensionService.startExtensionHosts({toAdd:o,toRemove:n}),t&&this.notificationService.notify({severity:ft.Info,message:d(10646,null),priority:2}),this.telemetryService.publicLog2("extensions:autorestart",{count:o.length+n.length,auto:t}))}getRuntimeState(e){let t=e.state===3,o=this.extensionService.extensions.find(s=>Ut({id:s.identifier.value},e.identifier)),n=this.extensionManagementServerService.remoteExtensionManagementServer?"reloadWindow":"restartExtensions",r=n==="reloadWindow"?d(10676,null):d(10680,null);if(t){let s=o&&this.extensionService.canRemoveExtension(o),l=o&&(!e.server||e.server===this.extensionManagementServerService.getExtensionManagementServer(ZE(o)))&&(!e.resourceExtension||this.uriIdentityService.extUri.isEqual(e.resourceExtension.location,o.extensionLocation));return!s&&l&&!o.isUnderDevelopment?{action:n,reason:d(10670,null,r)}:void 0}if(e.local){let s=o&&e.server===this.extensionManagementServerService.getExtensionManagementServer(ZE(o)),l=this.extensionEnablementService.isEnabled(e.local);if(o){if(l){if(this.extensionService.canAddExtension(bF(e.local)))return;let c=this.extensionManagementServerService.getExtensionManagementServer(ZE(o));if(s){if(!o.isUnderDevelopment&&(e.version!==o.version||e.local.targetPlatform!==o.targetPlatform)){let u=this.getProductCurrentVersion(),p=this.getProductUpdateVersion();if(p&&!vme(e.local.manifest.engines.vscode,u.version,u.date)&&vme(e.local.manifest.engines.vscode,p.version,p.date)){let h=this.updateService.state;return h.type==="available for download"?{action:"downloadUpdate",reason:d(10671,null,this.productService.nameLong)}:h.type==="downloaded"?{action:"applyUpdate",reason:d(10674,null,this.productService.nameLong)}:h.type==="ready"?{action:"quitAndInstall",reason:d(10672,null,this.productService.nameLong)}:void 0}return{action:n,reason:d(10673,null,r)}}if(this.extensionsServers.length>1){let u=this.installed.filter(p=>Ut(p.identifier,e.identifier)&&p.server!==e.server)[0];if(u){if(c===this.extensionManagementServerService.remoteExtensionManagementServer&&this.extensionManifestPropertiesService.prefersExecuteOnUI(e.local.manifest)&&u.server===this.extensionManagementServerService.localExtensionManagementServer)return{action:n,reason:d(10637,null,r)};if(c===this.extensionManagementServerService.localExtensionManagementServer&&this.extensionManifestPropertiesService.prefersExecuteOnWorkspace(e.local.manifest)&&u.server===this.extensionManagementServerService.remoteExtensionManagementServer)return{action:n,reason:d(10638,null,r,this.extensionManagementServerService.remoteExtensionManagementServer?.label)}}}}else{if(e.server===this.extensionManagementServerService.localExtensionManagementServer&&c===this.extensionManagementServerService.remoteExtensionManagementServer&&this.extensionManifestPropertiesService.prefersExecuteOnUI(e.local.manifest))return{action:n,reason:d(10669,null,r)};if(e.server===this.extensionManagementServerService.remoteExtensionManagementServer&&c===this.extensionManagementServerService.localExtensionManagementServer&&this.extensionManifestPropertiesService.prefersExecuteOnWorkspace(e.local.manifest))return{action:n,reason:d(10669,null,r)}}return}else if(s)return{action:n,reason:d(10668,null,r)};return}else{if(l&&!this.extensionService.canAddExtension(bF(e.local)))return{action:n,reason:d(10669,null,r)};let c=e.server?e.server===this.extensionManagementServerService.localExtensionManagementServer?this.extensionManagementServerService.remoteExtensionManagementServer:this.extensionManagementServerService.localExtensionManagementServer:null;if(c&&e.enablementState===1){let u=this.local.filter(p=>Ut(p.identifier,e.identifier)&&p.server===c)[0];if(u&&u.local&&this.extensionEnablementService.isEnabled(u.local))return{action:n,reason:d(10669,null,r)}}}}}getPrimaryExtension(e){if(e.length===1)return e[0];let t=e.filter(l=>l.local&&this.extensionEnablementService.isEnabled(l.local));if(t.length===1)return t[0];let o=t.length?t:e,n=o.find(l=>l.local&&l.local.manifest)?.local?.manifest;if(!n)return o[0];let r=this.extensionManifestPropertiesService.getExtensionKind(n),s=o.find(l=>{for(let c of r)switch(c){case"ui":return l.server===this.extensionManagementServerService.localExtensionManagementServer;case"workspace":return l.server===this.extensionManagementServerService.remoteExtensionManagementServer;case"web":return l.server===this.extensionManagementServerService.webExtensionManagementServer}return!1});return!s&&this.extensionManagementServerService.localExtensionManagementServer&&(s=o.find(l=>{for(let c of r)switch(c){case"workspace":return l.server===this.extensionManagementServerService.localExtensionManagementServer;case"web":return l.server===this.extensionManagementServerService.localExtensionManagementServer}return!1})),!s&&this.extensionManagementServerService.webExtensionManagementServer&&(s=o.find(l=>{for(let c of r)if(c==="web")return l.server===this.extensionManagementServerService.webExtensionManagementServer;return!1})),!s&&this.extensionManagementServerService.remoteExtensionManagementServer&&(s=o.find(l=>{for(let c of r)if(c==="web")return l.server===this.extensionManagementServerService.remoteExtensionManagementServer;return!1})),s||e[0]}getExtensionState(e){if(this.installing.some(t=>Ut(t.identifier,e.identifier)&&(!e.server||t.server===e.server)))return 0;if(this.remoteExtensions){let t=this.remoteExtensions.getExtensionState(e);if(t!==3)return t}if(this.webExtensions){let t=this.webExtensions.getExtensionState(e);if(t!==3)return t}return this.localExtensions?this.localExtensions.getExtensionState(e):3}async checkForUpdates(e,t){if(e?this.logService.trace(`[Extensions]: Checking for updates. Reason: ${e}`):this.logService.trace("[Extensions]: Checking for updates"),!this.galleryService.isEnabled())return;let o=[];if(this.localExtensions&&o.push(this.localExtensions),this.remoteExtensions&&o.push(this.remoteExtensions),this.webExtensions&&o.push(this.webExtensions),!o.length)return;let n=[];for(let r of this.local)t&&!r.isBuiltin||r.isBuiltin&&!r.local?.pinned&&(r.type===0||!r.local?.identifier.uuid)||r.local?.source!=="resource"&&n.push({...r.identifier,preRelease:!!r.local?.preRelease});if(n.length){let r=await o[0].server.extensionManagementService.getTargetPlatform();this.telemetryService.publicLog2("galleryService:checkingForUpdates",{count:n.length}),this.logService.trace("Checking updates for extensions",n.map(l=>l.id).join(", "));let s=await this.galleryService.getExtensions(n,{targetPlatform:r,compatible:!0,productVersion:this.getProductVersion()},Se.None);s.length&&await this.syncInstalledExtensionsWithGallery(s,n)}}async updateAll(){let e=[];return this.outdated.forEach(t=>{t.gallery&&e.push({extension:t.gallery,options:{operation:3,installPreReleaseVersion:t.local?.isPreReleaseVersion,profileLocation:this.userDataProfileService.currentProfile.extensionsResource,isApplicationScoped:t.local?.isApplicationScoped,context:{[TR]:!0}}})}),this.extensionManagementService.installGalleryExtensions(e)}async downloadVSIX(e,t){let o;if(t==="any"&&(o=await this.pickVersionToDownload(e),!o))return;let n=o?{id:e,version:o.version}:{id:e,preRelease:t==="prerelease"},r=o?{}:{compatible:!0},[s]=await this.galleryService.getExtensions([n],r,Se.None);if(!s)throw new Error(d(10643,null,e));let l=s.properties.targetPlatform,c=[];for(let p of o?.targetPlatforms??s.allTargetPlatforms)p!=="unknown"&&p!=="universal"&&c.push({label:p==="undefined"?d(10618,null):wQe(p),id:p});if(c.length>1){let p=d(10667,null),h=await this.quickInputService.pick(c.sort((g,f)=>g.label.localeCompare(f.label)),{placeHolder:p});if(!h)return;l=h.id}l!==s.properties.targetPlatform&&([s]=await this.galleryService.getExtensions([n],{...r,targetPlatform:l},Se.None));let u=await this.fileDialogService.showOpenDialog({title:d(10633,null),canSelectFiles:!1,canSelectFolders:!0,canSelectMany:!1,openLabel:d(10632,null)});u?.[0]&&this.progressService.withProgress({location:15},async p=>{try{p.report({message:d(10636,null)});let h=`${s.identifier.id}-${s.version}${l!=="undefined"&&l!=="universal"&&l!=="unknown"?`-${l}`:""}.vsix`;await this.galleryService.download(s,this.uriIdentityService.extUri.joinPath(u[0],h),1),this.notificationService.info(d(10634,null))}catch(h){this.notificationService.error(d(10635,null,Pn(h)))}})}async pickVersionToDownload(e){let t=await this.galleryService.getAllVersions({id:e});if(!t.length){await this.dialogService.info(d(10661,null));return}let o=t.map((r,s)=>({id:r.version,label:r.version,description:`${ea(new Date(Date.parse(r.date)),!0)}${r.isPreReleaseVersion?` (${d(10675,null)})`:""}`,ariaLabel:`${r.isPreReleaseVersion?"Pre-Release version":"Release version"} ${r.version}`,data:r}));return(await this.quickInputService.pick(o,{placeHolder:d(10682,null),matchOnDetail:!0}))?.data}async syncInstalledExtensionsWithGallery(e,t){let o=[];this.localExtensions&&o.push(this.localExtensions),this.remoteExtensions&&o.push(this.remoteExtensions),this.webExtensions&&o.push(this.webExtensions),o.length&&(await Promise.allSettled(o.map(n=>n.syncInstalledExtensionsWithGallery(e,this.getProductVersion(),t))),this.outdated.length&&(this.logService.info("Auto updating outdated extensions.",this.outdated.map(n=>n.identifier.id).join(", ")),this.eventuallyAutoUpdateExtensions()))}isAutoCheckUpdatesEnabled(){return this.meteredConnectionService.isConnectionMetered?!1:this.configurationService.getValue(c7e)}eventuallyCheckForUpdates(e=!1){this.updatesCheckDelayer.cancel(),this.updatesCheckDelayer.trigger(async()=>{this.isAutoCheckUpdatesEnabled()&&await this.checkForUpdates(),this.eventuallyCheckForUpdates()},e?0:this.getUpdatesCheckInterval()).then(void 0,t=>null)}getUpdatesCheckInterval(){return this.productService.quality==="insider"&&this.getProductUpdateVersion()?1e3*60*60*1:DQ.UpdatesCheckInterval}eventuallyAutoUpdateExtensions(){this.autoUpdateDelayer.trigger(()=>this.autoUpdateExtensions()).then(void 0,e=>null)}async autoUpdateBuiltinExtensions(){if(this.meteredConnectionService.isConnectionMetered)return;await this.checkForUpdates(void 0,!0);let e=this.outdated.filter(t=>t.isBuiltin);await dn.settled(e.map(t=>this.install(t,t.local?.preRelease?{installPreReleaseVersion:!0}:void 0)))}async syncPinnedBuiltinExtensions(){let e=[];for(let t of this.local)t.isBuiltin&&t.local?.pinned&&t.local?.identifier.uuid&&e.push({...t.identifier,version:t.version});if(e.length){let t=await this.galleryService.getExtensions(e,Se.None);t.length&&await this.syncInstalledExtensionsWithGallery(t)}}async autoUpdateExtensions(){if(this.meteredConnectionService.isConnectionMetered){this.logService.trace("[Extensions]: Skipping auto-update because connection is metered");return}let e=[],t=[],o=[];for(let r of this.outdated){if(!this.shouldAutoUpdateExtension(r)){t.push(r.identifier.id);continue}if(await this.shouldRequireConsentToUpdate(r)){o.push(r.identifier.id);continue}e.push(r)}if(t.length&&this.logService.trace("Auto update disabled for extensions",t.join(", ")),o.length&&this.logService.info("Auto update consent required for extensions",o.join(", ")),!e.length)return;let n=this.getProductVersion();await dn.settled(e.map(r=>this.install(r,r.local?.preRelease?{installPreReleaseVersion:!0,productVersion:n}:{productVersion:n})))}getProductVersion(){return this.getProductUpdateVersion()??this.getProductCurrentVersion()}getProductCurrentVersion(){return{version:this.productService.version,date:this.productService.date}}getProductUpdateVersion(){switch(this.updateService.state.type){case"available for download":case"downloaded":case"updating":case"ready":{let e=this.updateService.state.update.productVersion;if(e&&dTe(e))return{version:e,date:this.updateService.state.update.timestamp?new Date(this.updateService.state.update.timestamp).toISOString():void 0}}}}shouldAutoUpdateExtension(e){if(e.deprecationInfo?.disallowInstall)return!1;let t=this.getAutoUpdateValue();if(t===!1){let n=this.getEnabledAutoUpdateExtensions(),r=e.identifier.id.toLowerCase();return!!(n.includes(r)||this.isAutoUpdateEnabledForPublisher(e.publisher)&&!n.includes(`-${r}`))}return e.pinned||this.getDisabledAutoUpdateExtensions().includes(e.identifier.id.toLowerCase())?!1:t===!0?!0:t==="onlyEnabledExtensions"?e.enablementState!==10&&e.enablementState!==11:!1}async shouldRequireConsentToUpdate(e){if(e.outdated&&!(!e.gallery||!e.local)){if(e.local.identifier.uuid&&e.local.identifier.uuid!==e.gallery.identifier.uuid)return d(10625,null);if(!(!e.local.manifest.engines.vscode||e.local.manifest.main||e.local.manifest.browser)){if(lo(e.gallery.properties?.executesCode)){if(!e.gallery.properties.executesCode)return}else{let t=e instanceof RW?await e.getGalleryManifest():await this.galleryService.getManifest(e.gallery,Se.None);if(!t?.main&&!t?.browser)return}return d(10624,null,e.displayName)}}}isAutoUpdateEnabledFor(e){if(Fe(e)){if(N5.test(e))throw new Error("Expected publisher string, found extension identifier");return this.isAutoUpdateEnabled()?!0:this.isAutoUpdateEnabledForPublisher(e)}return this.shouldAutoUpdateExtension(e)}isAutoUpdateEnabledForPublisher(e){return this.getPublishersToAutoUpdate().includes(e.toLowerCase())}async updateAutoUpdateEnablementFor(e,t){if(this.isAutoUpdateEnabled()){if(Fe(e))throw new Error("Expected extension, found publisher string");let o=this.getDisabledAutoUpdateExtensions(),n=e.identifier.id.toLowerCase(),r=o.indexOf(n);t?r!==-1&&o.splice(r,1):r===-1&&o.push(n),this.setDisabledAutoUpdateExtensions(o),t&&e.local&&e.pinned&&await this.extensionManagementService.updateMetadata(e.local,{pinned:!1}),this._onChange.fire(e)}else{let o=this.getEnabledAutoUpdateExtensions();if(Fe(e)){if(N5.test(e))throw new Error("Expected publisher string, found extension identifier");e=e.toLowerCase(),this.isAutoUpdateEnabledFor(e)!==t&&(t?o.push(e):o.includes(e)&&o.splice(o.indexOf(e),1)),this.setEnabledAutoUpdateExtensions(o);for(let n of this.installed)n.publisher.toLowerCase()===e&&this._onChange.fire(n)}else{let n=e.identifier.id.toLowerCase(),r=this.isAutoUpdateEnabledFor(e.publisher.toLowerCase()),s=o.includes(n),l=o.includes(`-${n}`);t?(l&&o.splice(o.indexOf(`-${n}`),1),r?s&&o.splice(o.indexOf(n),1):s||o.push(n)):(s&&o.splice(o.indexOf(n),1),r?l||o.push(`-${n}`):l&&o.splice(o.indexOf(`-${n}`),1)),this.setEnabledAutoUpdateExtensions(o),this._onChange.fire(e)}}t&&this.autoUpdateExtensions()}onDidSelectedExtensionToAutoUpdateValueChange(){if(this.enabledAuotUpdateExtensionsValue!==this.getEnabledAutoUpdateExtensionsValue()||this.disabledAutoUpdateExtensionsValue!==this.getDisabledAutoUpdateExtensionsValue()){let e=this.installed.filter(l=>!l.isBuiltin),t=l=>{let c=[],u=[];for(let p of l)this.shouldAutoUpdateExtension(p)?c.push(p):u.push(p);return[c,u]},[o,n]=t(e);this._enabledAutoUpdateExtensionsValue=void 0,this._disabledAutoUpdateExtensionsValue=void 0;let[r,s]=t(e);for(let l of o??[])s?.includes(l)&&this._onChange.fire(l);for(let l of n??[])r?.includes(l)&&this._onChange.fire(l)}}async canInstall(e){if(!(e instanceof RW))return new Ie().appendText(d(10662,null));if(e.isMalicious)return new Ie().appendText(d(10657,null));if(e.deprecationInfo?.disallowInstall)return new Ie().appendText(d(10629,null));if(e.gallery){if(!e.gallery.isSigned&&CQe(e.private,await this.extensionGalleryManifestService.getExtensionGalleryManifest()))return new Ie().appendText(d(10665,null));let t=this.localExtensions?await this.localExtensions.canInstall(e.gallery):void 0;if(t===!0)return!0;let o=this.remoteExtensions?await this.remoteExtensions.canInstall(e.gallery):void 0;if(o===!0)return!0;let n=this.webExtensions?await this.webExtensions.canInstall(e.gallery):void 0;return n===!0?!0:t??o??n??new Ie().appendText(d(10619,null,e.displayName??e.identifier.id))}return e.resourceExtension&&await this.extensionManagementService.canInstall(e.resourceExtension)===!0?!0:new Ie().appendText(d(10619,null,e.displayName??e.identifier.id))}async install(e,t={},o){let n,r,s;if(e instanceof A)n=e;else{let l,c;if(Fe(e)?(r=this.local.find(u=>Ut(u.identifier,{id:e})),r?.isBuiltin||(l={id:e,version:t.version,preRelease:t.installPreReleaseVersion??this.extensionManagementService.preferPreReleases})):e.gallery?(r=e,c=e.gallery,t.version&&t.version!==c?.version&&(l={id:r.identifier.id,version:t.version})):e.resourceExtension&&(r=e,n=e.resourceExtension),l){let u=r?.server?await r.server.extensionManagementService.getTargetPlatform():void 0;c=(await this.galleryService.getExtensions([l],{targetPlatform:u},Se.None)).at(0)}if(!r&&c&&(r=this.instantiationService.createInstance(RW,u=>this.getExtensionState(u),u=>this.getRuntimeState(u),void 0,void 0,c,void 0),r.setExtensionsControlManifest(await this.extensionManagementService.getExtensionsControlManifest())),r?.isMalicious)throw new Error(d(10657,null));if(c){if(t.installEverywhere){s=[];let u=await this.extensionManagementService.getInstallableServers(c);for(let p of this.extensionsServers)u.includes(p.server)&&!p.local.find(h=>Ut(h.identifier,c.identifier))&&s.push(p.server)}else if(t.enable&&r?.local&&(s=[],r.enablementState===1)){let[u]=await this.extensionManagementService.getInstallableServers(c);u&&s.push(u)}}if(!s||s.length){if(!n){if(!c){let u=Fe(e)?e:e.identifier.id,p=await this.extensionGalleryManifestService.getExtensionGalleryManifest(),h=p?YP(p,"ContactSupportUri"):void 0,g=h?d(10678,null,h.toString()):"";if(t.version){let f=d(10664,null,u,t.version);throw new vh(g?`${f} ${g}`:f,"NotFound")}else{let f=d(10663,null,u);throw new vh(g?`${f} ${g}`:f,"NotFound")}}n=c}t.version&&(t.installGivenVersion=!0),r?.isWorkspaceScoped&&(t.isWorkspaceScoped=!0)}}if(n){if(t.justification){let l=gn(t.isMachineScoped)&&this.userDataSyncEnablementService.isEnabled()&&this.userDataSyncEnablementService.isResourceEnabled("extensions"),c=[];c.push({label:Fe(t.justification)||!t.justification.action?d(10649,null):d(10650,null,t.justification.action),run:()=>!0}),r||c.push({label:d(10666,null),run:()=>(this.open(r),!1)});let u=await this.dialogService.prompt({title:d(10652,null),message:r?d(10651,null,r.displayName,r.publisherDisplayName):d(10655,null),detail:Fe(t.justification)?t.justification:t.justification.reason,cancelButton:!0,buttons:c,checkbox:l?{label:d(10685,null),checked:!0}:void 0});if(!u.result)throw new go;l&&(t.isMachineScoped=!u.checkboxChecked)}n instanceof A?r=await this.doInstall(void 0,()=>this.installFromVSIX(n,t),o):r&&(r.resourceExtension?r=await this.doInstall(r,()=>this.extensionManagementService.installResourceExtension(n,t),o):r=await this.doInstall(r,()=>this.installFromGallery(r,n,t,s),o))}if(!r)throw new Error(d(10694,null));if(t.enable){if(r.enablementState===11||r.enablementState===10){if(t.justification&&!(await this.dialogService.confirm({title:d(10642,null),message:d(10641,null,r.displayName),detail:Fe(t.justification)?t.justification:t.justification.reason,primaryButton:Fe(t.justification)?d(10639,null):d(10640,null,t.justification.action)})).confirmed)throw new go;await this.setEnablement(r,r.enablementState===11?13:12)}await this.waitUntilExtensionIsEnabled(r)}return r}async installInServer(e,t,o){await this.doInstall(e,async()=>{let n=e.local;if(!n)throw new Error("Extension not found");if(e.gallery||(e=(await this.getExtensions([{...e.identifier,preRelease:n.preRelease}],Se.None))[0]??e),e.gallery)return t.extensionManagementService.installFromGallery(e.gallery,{installPreReleaseVersion:n.preRelease,...o});let r=await t.extensionManagementService.getTargetPlatform();if(!Sde(n.targetPlatform,[n.targetPlatform],r))throw new Error(d(10647,null,e.identifier.id));let s=await this.extensionManagementService.zip(n);try{return await t.extensionManagementService.install(s)}finally{try{await this.fileService.del(s)}catch(l){this.logService.error(l)}}})}canSetLanguage(e){return!(!Wt||!e.gallery||!OX(e.gallery))}async setLanguage(e){if(!this.canSetLanguage(e))throw new Error("Can not set language");let t=OX(e.gallery);if(t===wr)return;let o=e.gallery?.properties?.localizedLanguages?.[0];return this.localeService.setLocale({id:t,galleryExtension:e.gallery,extensionId:e.identifier.id,label:o??e.displayName})}setEnablement(e,t){return e=Array.isArray(e)?e:[e],this.promptAndSetEnablement(e,t)}async uninstall(e){let t=e.local?e:this.local.find(s=>Ut(s.identifier,e.identifier));if(!t?.local)throw new Error("Missing local");if(t.local.isApplicationScoped&&this.userDataProfilesService.profiles.length>1){let{confirmed:s}=await this.dialogService.confirm({title:d(10690,null),type:ft.Info,message:d(10691,null,t.displayName),primaryButton:d(10689,null)});if(!s)throw new go}let o=[{extension:t.local}];if(!Ut(t.identifier,{id:this.productService.defaultChatAgent.extensionId}))for(let s of this.getAllPackedExtensions(t,this.local))s.local&&!o.some(l=>Ut(l.extension.identifier,s.identifier))&&o.push({extension:s.local});let n=[],r;for(let{extension:s}of o){let l=[];if(s.isApplicationScoped&&this.userDataProfilesService.profiles.length>1)r||(r=[],await Promise.allSettled(this.userDataProfilesService.profiles.map(async c=>{let u=await this.extensionManagementService.getInstalled(1,c.extensionsResource);for(let p of u)r?.push([p,c.extensionsResource])}))),l.push(...r);else for(let{local:c}of this.local)c&&l.push([c,void 0]);for(let[c,u]of l)Ut(c.identifier,s.identifier)||!c.manifest.extensionDependencies||c.manifest.extensionDependencies.length===0||s.manifest.extensionPack?.some(p=>Ut({id:p},c.identifier))||n.some(p=>p.manifest.extensionPack?.some(h=>Ut({id:h},c.identifier)))||c.manifest.extensionDependencies.some(p=>Ut(s.identifier,{id:p}))&&(n.push(c),o.push({extension:c,options:{profileLocation:u}}))}if(n.length){let{result:s}=await this.dialogService.prompt({title:d(10692,null),type:ft.Warning,message:this.getErrorMessageForUninstallingAnExtensionWithDependents(t,n),buttons:[{label:d(10688,null),run:()=>!0}],cancelButton:{run:()=>!1}});if(!s)throw new go}return this.withProgress({location:5,title:d(10693,null),source:`${t.identifier.id}`},()=>this.extensionManagementService.uninstallExtensions(o).then(()=>{}))}getAllPackedExtensions(e,t,o=[]){if(o.some(r=>Ut(r.identifier,e.identifier)))return[];o.push(e);let n=e.extensionPack??[];if(n.length){let r=[];for(let l of t)!l.isBuiltin&&n.some(c=>Ut({id:c},l.identifier))&&r.push(l);let s=[];for(let l of r)s.push(...this.getAllPackedExtensions(l,t,o));return[...r,...s]}return[]}getErrorMessageForUninstallingAnExtensionWithDependents(e,t){return t.length===1?d(10684,null,e.displayName,t[0].manifest.displayName):t.length===2?d(10687,null,e.displayName,t[0].manifest.displayName,t[1].manifest.displayName):d(10660,null,e.displayName,t[0].manifest.displayName,t[1].manifest.displayName)}isExtensionIgnoredToSync(e){return e.local?!this.isInstalledExtensionSynced(e.local):this.extensionsSyncManagementService.hasToNeverSyncExtension(e.identifier.id)}async togglePreRelease(e){if(e.local){if(e.preRelease!==e.isPreReleaseVersion){await this.extensionManagementService.updateMetadata(e.local,{preRelease:!e.preRelease});return}await this.install(e,{installPreReleaseVersion:!e.preRelease,preRelease:!e.preRelease})}}async toggleExtensionIgnoredToSync(e){let t=[e,...this.getAllPackedExtensions(e,this.local)];for(let o of t){let n=this.isExtensionIgnoredToSync(o);o.local&&n&&o.local.isMachineScoped?await this.extensionManagementService.updateMetadata(o.local,{isMachineScoped:!1}):await this.extensionsSyncManagementService.updateIgnoredExtensions(o.identifier.id,!n)}await this.userDataAutoSyncService.triggerSync(["IgnoredExtensionsUpdated"])}async toggleApplyExtensionToAllProfiles(e){let t=[e,...this.getAllPackedExtensions(e,this.local)],o=this.getAllExtensionServers();await Promise.allSettled(t.map(async n=>{if(!n.local||S5(n.local.manifest)||n.isBuiltin)return;let r=n.local.isApplicationScoped;await Promise.all(o.map(async s=>{let l=s.local.find(c=>Ut(n.identifier,c.identifier))?.local;l&&l.isApplicationScoped===r&&await this.extensionManagementService.toggleApplicationScope(l,this.userDataProfileService.currentProfile.extensionsResource)}))}))}getAllExtensionServers(){let e=[];return this.localExtensions&&e.push(this.localExtensions),this.remoteExtensions&&e.push(this.remoteExtensions),this.webExtensions&&e.push(this.webExtensions),e}isInstalledExtensionSynced(e){return e.isMachineScoped?!1:this.extensionsSyncManagementService.hasToAlwaysSyncExtension(e.identifier.id)?!0:!this.extensionsSyncManagementService.hasToNeverSyncExtension(e.identifier.id)}doInstall(e,t,o){let n=e?d(10654,null,e.displayName):d(10653,null);return this.withProgress({location:o??5,title:n},async()=>{try{e&&(this.installing.push(e),this._onChange.fire(e));let r=await t();return await this.waitAndGetInstalledExtension(r.identifier)}finally{e&&(this.installing=this.installing.filter(r=>r!==e),this._onChange.fire(void 0))}})}async installFromVSIX(e,t){let o=await this.extensionManagementService.getManifest(e),n=this.local.find(r=>Ut(r.identifier,{id:Qf(o.publisher,o.name)}));return n&&(t=t||{},n.latestVersion===o.version?t.pinned=t.pinned??(n.local?.pinned||!this.shouldAutoUpdateExtension(n)):t.installGivenVersion=!0),this.extensionManagementService.installVSIX(e,o,t)}installFromGallery(e,t,o,n){return o=o??{},o.pinned=o.pinned??(e.local?.pinned||!this.shouldAutoUpdateExtension(e)),e.local&&!n?(o.productVersion=this.getProductVersion(),o.operation=3,this.extensionManagementService.updateFromGallery(t,e.local,o)):this.extensionManagementService.installFromGallery(t,o,n)}async waitAndGetInstalledExtension(e){let t=this.local.find(o=>Ut(o.identifier,e));if(t||await U.toPromise(U.filter(this.onChange,o=>!!o&&this.local.some(n=>Ut(n.identifier,e)))),t=this.local.find(o=>Ut(o.identifier,e)),!t)throw new Error("Extension should have been installed");return t}async waitUntilExtensionIsEnabled(e){this.extensionService.extensions.find(t=>Ii.equals(t.identifier,e.identifier.id))||!e.local||!this.extensionService.canAddExtension(bF(e.local))||await new Promise((t,o)=>{let n=this.extensionService.onDidChangeExtensions(()=>{try{this.extensionService.extensions.find(r=>Ii.equals(r.identifier,e.identifier.id))&&(n.dispose(),t())}catch(r){o(r)}})})}promptAndSetEnablement(e,t){if(t===12||t===13){let n=this.getExtensionsRecursively(e,this.local,t,{dependencies:!0,pack:!0});return this.checkAndSetEnablement(e,n,t)}else{let n=this.getExtensionsRecursively(e,this.local,t,{dependencies:!1,pack:!0});return n.length?this.checkAndSetEnablement(e,n,t):this.checkAndSetEnablement(e,[],t)}}async checkAndSetEnablement(e,t,o){let n=[...e,...t];if(!(o===12||o===13))for(let s of e){let l=this.getDependentsAfterDisablement(s,n,this.local);if(l.length){let{result:c}=await this.dialogService.prompt({title:d(10628,null),type:ft.Warning,message:this.getDependentsErrorMessageForDisablement(s,n,l),buttons:[{label:d(10627,null),run:()=>!0}],cancelButton:{run:()=>!1}});if(!c)throw new go;await this.checkAndSetEnablement(l,[s],o)}}return this.doSetEnablement(n,o)}getExtensionsRecursively(e,t,o,n,r=[]){let s=e.filter(l=>r.indexOf(l)===-1);if(s.length){for(let c of s)r.push(c);let l=t.filter(c=>{if(r.indexOf(c)!==-1)return!1;let u=o===12||o===13,p=c.enablementState===12||c.enablementState===13;return u===p?!1:(u||!c.isBuiltin)&&(n.dependencies||n.pack)&&e.some(h=>n.dependencies&&h.dependencies.some(g=>Ut({id:g},c.identifier))||n.pack&&h.extensionPack.some(g=>Ut({id:g},c.identifier)))});return l.length&&l.push(...this.getExtensionsRecursively(l,t,o,n,r)),l}return[]}getDependentsAfterDisablement(e,t,o){return o.filter(n=>n.dependencies.length===0||n===e||!this.extensionEnablementService.isEnabledEnablementState(n.enablementState)||t.indexOf(n)!==-1?!1:n.dependencies.some(r=>[e,...t].some(s=>Ut(s.identifier,{id:r}))))}getDependentsErrorMessageForDisablement(e,t,o){for(let n of[e,...t]){let r=o.filter(s=>s.dependencies.some(l=>Ut({id:l},n.identifier)));if(r.length)return this.getErrorMessageForDisablingAnExtensionWithDependents(n,r)}return""}getErrorMessageForDisablingAnExtensionWithDependents(e,t){return t.length===1?d(10683,null,e.displayName,t[0].displayName):t.length===2?d(10686,null,e.displayName,t[0].displayName,t[1].displayName):d(10659,null,e.displayName,t[0].displayName,t[1].displayName)}async doSetEnablement(e,t){return await this.extensionEnablementService.setEnablement(e.map(o=>o.local),t)}reportProgressFromOtherSources(){this.installed.some(e=>e.state===0||e.state===2)?this._activityCallBack||this.withProgress({location:5},()=>new Promise(e=>this._activityCallBack=e)):(this._activityCallBack?.(),this._activityCallBack=void 0)}withProgress(e,t){return this.progressService.withProgress(e,async()=>{let o=Ln(()=>t());this.tasksInProgress.push(o);try{return await o}finally{let n=this.tasksInProgress.indexOf(o);n!==-1&&this.tasksInProgress.splice(n,1)}})}onError(e){if(ao(e))return;let t=e&&e.message||"";/getaddrinfo ENOTFOUND|getaddrinfo ENOENT|connect EACCES|connect ECONNREFUSED/.test(t)||this.notificationService.error(e)}handleURL(e,t){return/^extension/.test(e.path)?(this.onOpenExtensionUrl(e),Promise.resolve(!0)):Promise.resolve(!1)}onOpenExtensionUrl(e){let t=/^extension\/([^/]+)$/.exec(e.path);if(!t)return;let o=t[1];this.queryLocal().then(async n=>{let r=n.find(s=>Ut(s.identifier,{id:o}));r||([r]=await this.getExtensions([{id:o}],{source:"uri"},Se.None)),r&&(await this.hostService.focus(ut),await this.open(r))}).then(void 0,n=>this.onError(n))}getPublishersToAutoUpdate(){return this.getEnabledAutoUpdateExtensions().filter(e=>!N5.test(e))}getEnabledAutoUpdateExtensions(){try{let e=JSON.parse(this.enabledAuotUpdateExtensionsValue);if(Array.isArray(e))return e}catch{}return[]}setEnabledAutoUpdateExtensions(e){this.enabledAuotUpdateExtensionsValue=JSON.stringify(e)}get enabledAuotUpdateExtensionsValue(){return this._enabledAutoUpdateExtensionsValue||(this._enabledAutoUpdateExtensionsValue=this.getEnabledAutoUpdateExtensionsValue()),this._enabledAutoUpdateExtensionsValue}set enabledAuotUpdateExtensionsValue(e){this.enabledAuotUpdateExtensionsValue!==e&&(this._enabledAutoUpdateExtensionsValue=e,this.setEnabledAutoUpdateExtensionsValue(e))}getEnabledAutoUpdateExtensionsValue(){return this.storageService.get(oPi,-1,"[]")}setEnabledAutoUpdateExtensionsValue(e){this.storageService.store(oPi,e,-1,0)}getDisabledAutoUpdateExtensions(){try{let e=JSON.parse(this.disabledAutoUpdateExtensionsValue);if(Array.isArray(e))return e}catch{}return[]}setDisabledAutoUpdateExtensions(e){this.disabledAutoUpdateExtensionsValue=JSON.stringify(e)}get disabledAutoUpdateExtensionsValue(){return this._disabledAutoUpdateExtensionsValue||(this._disabledAutoUpdateExtensionsValue=this.getDisabledAutoUpdateExtensionsValue()),this._disabledAutoUpdateExtensionsValue}set disabledAutoUpdateExtensionsValue(e){this.disabledAutoUpdateExtensionsValue!==e&&(this._disabledAutoUpdateExtensionsValue=e,this.setDisabledAutoUpdateExtensionsValue(e))}getDisabledAutoUpdateExtensionsValue(){return this.storageService.get(nPi,-1,"[]")}setDisabledAutoUpdateExtensionsValue(e){this.storageService.store(nPi,e,-1,0)}getDismissedNotifications(){try{let e=JSON.parse(this.dismissedNotificationsValue);if(Array.isArray(e))return e}catch{}return[]}setDismissedNotifications(e){this.dismissedNotificationsValue=JSON.stringify(e)}get dismissedNotificationsValue(){return this._dismissedNotificationsValue||(this._dismissedNotificationsValue=this.getDismissedNotificationsValue()),this._dismissedNotificationsValue}set dismissedNotificationsValue(e){this.dismissedNotificationsValue!==e&&(this._dismissedNotificationsValue=e,this.setDismissedNotificationsValue(e))}getDismissedNotificationsValue(){return this.storageService.get(rPi,0,"[]")}setDismissedNotificationsValue(e){this.storageService.store(rPi,e,0,0)}};DQ=I([m(0,F),m(1,ee),m(2,ru),m(3,fa),m(4,Dv),m(5,B),m(6,Te),m(7,Ne),m(8,_b),m(9,Js),m(10,Zt),m(11,Fo),m(12,Ec),m(13,_t),m(14,rG),m(15,PT),m(16,tt),m(17,X),m(18,Gp),m(19,se),m(20,lt),m(21,DH),m(22,ji),m(23,fe),m(24,ln),m(25,an),m(26,ce),m(27,at),m(28,Fl),m(29,zd),m(30,ht),m(31,Pe),m(32,$t),m(33,rn),m(34,Ue),m(35,dm),m(36,k2)],DQ);async function sPi(a,i,e,t,o,n){try{let r=await i.getExtensionsControlManifest();if(!r.deprecated)return;let s=await i.getInstalled(1,a?.extensionsResource);for(let[l,c]of Object.entries(r.deprecated)){if(!c?.extension)continue;let{id:u,autoMigrate:p,preRelease:h}=c.extension;if(!p)continue;let g=s.find(v=>Ut(v.identifier,{id:l}));if(!g)continue;let f=(await e.getExtensions([{id:u,preRelease:h}],{targetPlatform:await i.getTargetPlatform(),compatible:!0},Se.None))[0];if(!f){n.info(`Skipping migrating '${g.identifier.id}' extension because, the comaptible target '${u}' extension is not found`);continue}try{n.info(`Migrating '${g.identifier.id}' extension to '${u}' extension...`);let v=!o.getDisabledExtensions().some(S=>Ut(S,g.identifier));await i.uninstall(g,{profileLocation:a?.extensionsResource}),n.info(`Uninstalled the unsupported extension '${g.identifier.id}'`);let b=s.find(S=>Ut(S.identifier,{id:u}));(!b||b.isPreReleaseVersion!==!!h&&v)&&(b=await i.installFromGallery(f,{installPreReleaseVersion:h,isMachineScoped:g.isMachineScoped,operation:4,profileLocation:a?.extensionsResource,context:{[TR]:!0}}),n.info(`Installed the pre-release extension '${b.identifier.id}'`),!p.donotDisable&&!v&&(await o.disableExtension(b.identifier),n.info(`Disabled the pre-release extension '${b.identifier.id}' because the unsupported extension '${g.identifier.id}' is disabled`)),p.storage&&(t.addToMigrationList(gS(g.manifest.publisher,g.manifest.name),gS(b.manifest.publisher,b.manifest.name)),n.info("Added pre-release extension to the storage migration list"))),n.info(`Migrated '${g.identifier.id}' extension to '${u}' extension.`)}catch(v){n.error(v)}}if(r.autoUpdate)for(let[l,c]of Object.entries(r.autoUpdate))try{let u=s.find(h=>Ut(h.identifier,{id:l})&&Sto(h.manifest.version,c));if(!u)continue;let p=(await e.getExtensions([{id:l,preRelease:u.preRelease}],{targetPlatform:await i.getTargetPlatform(),compatible:!0},Se.None))[0];if(!p){n.info(`Skipping updating '${u.identifier.id}' extension because, the compatible target '${l}' extension is not found`);continue}await i.installFromGallery(p,{installPreReleaseVersion:u.preRelease,isMachineScoped:u.isMachineScoped,operation:3,profileLocation:a?.extensionsResource,context:{[TR]:!0}}),n.info(`Autoupdated '${u.identifier.id}' extension to '${p.version}' extension.`)}catch(u){n.error(u)}}catch(r){n.error(r)}}var dWe=class{constructor(i,e,t,o,n){i.remoteExtensionManagementServer&&sPi(void 0,i.remoteExtensionManagementServer.extensionManagementService,e,t,o,n),i.webExtensionManagementServer&&sPi(void 0,i.webExtensionManagementServer.extensionManagementService,e,t,o,n)}};dWe=I([m(0,Ec),m(1,fa),m(2,l2),m(3,fK),m(4,se)],dWe);Ee(Hi,DQ,0);Ee(moe,q0e,1);Ee(BD,tWe,0);ne.as(Ku.Quickaccess).registerQuickAccessProvider({ctor:TQ,prefix:TQ.PREFIX,placeholder:d(10273,null),helpEntries:[{description:d(10272,null)}]});ne.as(qo.EditorPane).registerEditorPane(Br.create(LW,LW.ID,d(10202,null)),[new Ft(nq)]);var pWe=ne.as(Mn.ViewContainersRegistry).registerViewContainer({id:pg,title:L(10210,"Extensions"),openCommandActionDescriptor:{id:pg,mnemonicTitle:d(10275,null),keybindings:{primary:3126},order:4},ctorDescriptor:new Ft(sWe),icon:Bmo,order:4,rejectAddedViews:!0,alwaysUseContainerInfo:!0},0);ne.as(Jt.Configuration).registerConfiguration({id:"extensions",order:30,title:d(10228,null),type:"object",properties:{"extensions.autoUpdate":{enum:[!0,"onlyEnabledExtensions",!1],enumItemLabels:[d(10182,null),d(10199,null),d(10278,null)],enumDescriptions:[d(10216,null),d(10214,null),d(10215,null)],description:d(10213,null),default:!0,scope:1,tags:["usesOnlineServices"]},"extensions.autoCheckUpdates":{type:"boolean",description:d(10226,null),default:!0,scope:1,tags:["usesOnlineServices"]},"extensions.ignoreRecommendations":{type:"boolean",description:d(10230,null),default:!1},"extensions.showRecommendationsOnlyOnDemand":{type:"boolean",deprecationMessage:d(10233,null),default:!1,tags:["usesOnlineServices"]},"extensions.closeExtensionDetailsOnViewChange":{type:"boolean",description:d(10227,null),default:!1},"extensions.confirmedUriHandlerExtensionIds":{type:"array",items:{type:"string"},description:d(10244,null),default:[],scope:1},"extensions.webWorker":{type:["boolean","string"],enum:[!0,!1,"auto"],enumDescriptions:[d(10238,null),d(10237,null),d(10236,null)],description:d(10235,null),default:"auto"},"extensions.supportVirtualWorkspaces":{type:"object",markdownDescription:d(10224,null),patternProperties:{"([a-z0-9A-Z][a-z0-9-A-Z]*)\\.([a-z0-9A-Z][a-z0-9-A-Z]*)$":{type:"boolean",default:!1}},additionalProperties:!1,default:{},defaultSnippets:[{body:{"pub.name":!1}}]},"extensions.experimental.affinity":{type:"object",markdownDescription:d(10211,null),patternProperties:{"([a-z0-9A-Z][a-z0-9-A-Z]*)\\.([a-z0-9A-Z][a-z0-9-A-Z]*)$":{type:"integer",default:1}},additionalProperties:!1,default:{},defaultSnippets:[{body:{"pub.name":1}}]},[ULt]:{type:"object",scope:1,markdownDescription:d(10218,null),patternProperties:{"([a-z0-9A-Z][a-z0-9-A-Z]*)\\.([a-z0-9A-Z][a-z0-9-A-Z]*)$":{type:"object",properties:{supported:{type:["boolean","string"],enum:[!0,!1,"limited"],enumDescriptions:[d(10222,null),d(10219,null),d(10220,null)],description:d(10221,null)},version:{type:"string",description:d(10223,null)}}}}},"extensions.experimental.deferredStartupFinishedActivation":{type:"boolean",description:d(10229,null),default:!1},"extensions.experimental.issueQuickAccess":{type:"boolean",description:d(10231,null),default:!0},"extensions.allowOpenInModalEditor":{type:"boolean",description:d(10212,null),default:!1,tags:["experimental"],experiment:{mode:"auto"}},[Qke]:{type:"boolean",description:d(10225,null),default:!0,scope:1,included:Vr},[OB]:{type:"boolean",description:d(10183,null),default:!1,included:ro.quality!=="stable"},[TQe]:{type:"string",description:d(10217,null),default:"",scope:1,tags:["usesOnlineServices"],included:!1,policy:{name:"ExtensionGalleryServiceUrl",category:"Extensions",minimumVersion:"1.99",localization:{description:{key:"extensions.gallery.serviceUrl",value:d(10217,null)}}}},"extensions.supportNodeGlobalNavigator":{type:"boolean",description:d(10234,null),default:!1},[vTt]:{type:"number",description:d(10232,null),default:6e4,scope:1,tags:["advanced","usesOnlineServices"]}}});var lan=ne.as(ma.JSONContribution);lan.registerSchema(mEi,Vmo);$e.registerCommand("_extensions.manage",(a,i,e,t,o)=>{let n=a.get(Hi),r=n.local.find(s=>Ut(s.identifier,{id:i}));if(r)n.open(r,{tab:e,preserveFocus:t,feature:o});else throw new Error(d(10279,null,i))});$e.registerCommand("extension.open",async(a,i,e,t,o,n)=>{let r=a.get(Hi),s=a.get(ge),[l]=await r.getExtensions([{id:i}],Se.None);return l?r.open(l,{tab:e,preserveFocus:t,feature:o,sideByside:n}):s.executeCommand("_extensions.manage",i,e,t,o)});$e.registerCommand({id:"workbench.extensions.installExtension",metadata:{description:d(10325,null),args:[{name:"extensionIdOrVSIXUri",description:d(10324,null),constraint:a=>typeof a=="string"||a instanceof A},{name:"options",description:"(optional) Options for installing the extension. Object with the following properties: `installOnlyNewlyAddedFromExtensionPackVSIX`: When enabled, VS Code installs only newly added extensions from the extension pack VSIX. This option is considered only when installing VSIX. ",isOptional:!0,schema:{type:"object",properties:{installOnlyNewlyAddedFromExtensionPackVSIX:{type:"boolean",description:d(10329,null),default:!1},installPreReleaseVersion:{type:"boolean",description:d(10330,null),default:!1},donotSync:{type:"boolean",description:d(10327,null),default:!1},justification:{type:["string","object"],description:d(10331,null)},enable:{type:"boolean",description:d(10328,null),default:!1},context:{type:"object",description:d(10326,null)}}}}]},handler:async(a,i,e)=>{let t=a.get(Hi),o=a.get(ru),n=a.get(fa);try{if(typeof i=="string"){let[r,s]=kQe(i);if(t.local.find(c=>Ut(c.identifier,{id:r,uuid:s}))?.enablementState===1){let[c]=await n.getExtensions([{id:r,preRelease:e?.installPreReleaseVersion}],Se.None);if(!c)throw new Error(d(10279,null,i));await o.installFromGallery(c,{isMachineScoped:e?.donotSync?!0:void 0,installPreReleaseVersion:e?.installPreReleaseVersion,installGivenVersion:!!s,context:{...e?.context,[bB]:"command"}})}else await t.install(r,{version:s,installPreReleaseVersion:e?.installPreReleaseVersion,context:{...e?.context,[bB]:"command"},justification:e?.justification,enable:e?.enable,isMachineScoped:e?.donotSync?!0:void 0},15)}else{let r=A.revive(i);await t.install(r,{installGivenVersion:!0})}}catch(r){throw mt(r),r}}});$e.registerCommand({id:"workbench.extensions.uninstallExtension",metadata:{description:d(10335,null),args:[{name:d(10334,null),schema:{type:"string"}}]},handler:async(a,i)=>{if(!i)throw new Error(d(10245,null));let e=a.get(Cs),t=await e.getInstalled(),[o]=t.filter(n=>Ut(n.identifier,{id:i}));if(!o)throw new Error(d(10280,null,i));if(o.isBuiltin)throw new Error(d(10184,null,i));try{await e.uninstall(o)}catch(n){throw mt(n),n}}});$e.registerCommand({id:"workbench.extensions.search",metadata:{description:d(10333,null),args:[{name:d(10332,null),schema:{type:"string"}}]},handler:async(a,i="")=>a.get(Hi).openSearch(i)});function cPi(a,i){a?.addImplementation(105,"extensions-editor",e=>{let o=e.get(ee).activeEditorPane;return o instanceof LW&&o.activeWebview?.isFocused?(i(o.activeWebview),!0):!1})}cPi(VP,a=>a.copy());cPi($V,a=>a.cut());cPi(WP,a=>a.paste());var wx=new Y("hasLocalServer",!1),Jk=new Y("hasRemoteServer",!1),bN=new Y("hasWebServer",!1),wyo=new Y("gallerySortCapabilities",""),aPi=new Y("galleryFilterCapabilities",""),Cyo=new Y("galleryAllPublicRepositorySigned",!1),xyo=new Y("galleryAllPrivateRepositorySigned",!1),kyo=new Y("galleryHasExtensionLink",!1);async function lPi(a){try{await a.run()}finally{jc(a)&&a.dispose()}}var Nrt=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this.extensionManagementService=e;this.extensionManagementServerService=t;this.extensionGalleryManifestService=o;this.contextKeyService=n;this.viewsService=r;this.extensionsWorkbenchService=s;this.extensionEnablementService=l;this.instantiationService=c;this.dialogService=u;this.commandService=p;this.productService=h;this.pluginInstallService=g;let f=wx.bindTo(n);this.extensionManagementServerService.localExtensionManagementServer&&f.set(!0);let v=Jk.bindTo(n);this.extensionManagementServerService.remoteExtensionManagementServer&&v.set(!0);let b=bN.bindTo(n);this.extensionManagementServerService.webExtensionManagementServer&&b.set(!0),this.updateExtensionGalleryStatusContexts(),this._register(o.onDidChangeExtensionGalleryManifestStatus(()=>this.updateExtensionGalleryStatusContexts())),o.getExtensionGalleryManifest().then(S=>{this.updateGalleryCapabilitiesContexts(S),this._register(o.onDidChangeExtensionGalleryManifest(y=>this.updateGalleryCapabilitiesContexts(y)))}),this.registerGlobalActions(),this.registerContextMenuActions(),this.registerQuickAccessProvider()}async updateExtensionGalleryStatusContexts(){kh.bindTo(this.contextKeyService).set(this.extensionGalleryManifestService.extensionGalleryManifestStatus==="available"),AJ.bindTo(this.contextKeyService).set(this.extensionGalleryManifestService.extensionGalleryManifestStatus)}async updateGalleryCapabilitiesContexts(e){wyo.bindTo(this.contextKeyService).set(`_${e?.capabilities.extensionQuery.sorting?.map(t=>t.name)?.join("_")}_UpdateDate_`),aPi.bindTo(this.contextKeyService).set(`_${e?.capabilities.extensionQuery.filtering?.map(t=>t.name)?.join("_")}_`),Cyo.bindTo(this.contextKeyService).set(!!e?.capabilities?.signing?.allPublicRepositorySigned),xyo.bindTo(this.contextKeyService).set(!!e?.capabilities?.signing?.allPrivateRepositorySigned),kyo.bindTo(this.contextKeyService).set(!!(e&&YP(e,"ExtensionDetailsViewUriTemplate")))}registerQuickAccessProvider(){(this.extensionManagementServerService.localExtensionManagementServer||this.extensionManagementServerService.remoteExtensionManagementServer||this.extensionManagementServerService.webExtensionManagementServer)&&ne.as(Ku.Quickaccess).registerQuickAccessProvider({ctor:EQ,prefix:EQ.PREFIX,placeholder:d(10255,null),helpEntries:[{description:d(10254,null)}]})}registerGlobalActions(){this._register(ve.appendMenuItem(D.MenubarPreferencesMenu,{command:{id:pg,title:d(10274,null)},group:"2_configuration",order:3})),this._register(ve.appendMenuItem(D.GlobalActivity,{command:{id:pg,title:d(10290,null)},group:"2_configuration",order:3})),this.registerExtensionAction({id:"workbench.extensions.action.focusExtensionsView",title:L(10243,"Focus on Extensions View"),category:bh,f1:!0,run:async l=>{await l.get(Hi).openSearch("")}}),this.registerExtensionAction({id:"workbench.extensions.action.installExtensions",title:L(10256,"Install Extensions"),category:bh,menu:{id:D.CommandPalette,when:C.and(kh,C.or(wx,Jk,bN))},run:async l=>{l.get($t).openViewContainer(pg,!0)}}),this.registerExtensionAction({id:"workbench.extensions.action.showRecommendedKeymapExtensions",title:L(10295,"Keymaps"),category:umi,menu:[{id:D.CommandPalette,when:kh},{id:D.EditorTitle,when:C.and(Bg,kh),group:"2_keyboard_discover_actions"}],menuTitles:{[D.EditorTitle.id]:d(10246,null)},run:()=>this.extensionsWorkbenchService.openSearch("@recommended:keymaps ")}),this.registerExtensionAction({id:"workbench.extensions.action.showLanguageExtensions",title:L(10292,"Language Extensions"),category:umi,menu:{id:D.CommandPalette,when:kh},run:()=>this.extensionsWorkbenchService.openSearch("@recommended:languages ")}),this.registerExtensionAction({id:"workbench.extensions.action.checkForUpdates",title:L(10186,"Check for Extension Updates"),category:bh,menu:[{id:D.CommandPalette,when:C.and(kh,C.or(wx,Jk,bN))},{id:D.ViewContainerTitle,when:C.and(C.equals("viewContainer",pg),kh),group:"1_updates",order:1}],run:async()=>{let[,l]=await Promise.all([this.extensionsWorkbenchService.checkForUpdates(),this.pluginInstallService.updateAllPlugins({silent:!0},Se.None)]);if(this.extensionsWorkbenchService.outdated.length)return this.extensionsWorkbenchService.openSearch("@outdated ");if(l.updatedNames.length===0&&l.failedNames.length===0)return this.dialogService.info(d(10281,null))}});let e=C.equals(`config.${Fw}`,!1);this.registerExtensionAction({id:"workbench.extensions.action.enableAutoUpdate",title:L(10198,"Enable Auto Update for All Extensions"),category:bh,precondition:e,menu:[{id:D.ViewContainerTitle,order:5,group:"1_updates",when:C.and(C.equals("viewContainer",pg),e)},{id:D.CommandPalette}],run:l=>l.get(Hi).updateAutoUpdateForAllExtensions(!0)});let t=C.notEquals(`config.${Fw}`,!1);this.registerExtensionAction({id:"workbench.extensions.action.disableAutoUpdate",title:L(10190,"Disable Auto Update for All Extensions"),precondition:t,category:bh,menu:[{id:D.ViewContainerTitle,order:5,group:"1_updates",when:C.and(C.equals("viewContainer",pg),t)},{id:D.CommandPalette}],run:l=>l.get(Hi).updateAutoUpdateForAllExtensions(!1)}),this.registerExtensionAction({id:"workbench.extensions.action.updateAllExtensions",title:L(10306,"Update All Extensions"),category:bh,precondition:bMt,menu:[{id:D.CommandPalette,when:C.and(kh,C.or(wx,Jk,bN))},{id:D.ViewContainerTitle,when:C.and(C.equals("viewContainer",pg),C.or(C.has(`config.${Fw}`).negate(),C.equals(`config.${Fw}`,"onlyEnabledExtensions"))),group:"1_updates",order:2},{id:D.ViewTitle,when:C.equals("view",gMt),group:"navigation",order:1}],icon:gEi,run:async()=>{await this.extensionsWorkbenchService.updateAll()}}),this.registerExtensionAction({id:"workbench.extensions.action.enableAll",title:L(10196,"Enable All Extensions"),category:bh,menu:[{id:D.CommandPalette,when:C.or(wx,Jk,bN)},{id:D.ViewContainerTitle,when:C.equals("viewContainer",pg),group:"2_enablement",order:1}],run:async()=>{let l=this.extensionsWorkbenchService.local.filter(c=>!!c.local&&this.extensionEnablementService.canChangeEnablement(c.local)&&!this.extensionEnablementService.isEnabled(c.local));l.length&&await this.extensionsWorkbenchService.setEnablement(l,12)}}),this.registerExtensionAction({id:"workbench.extensions.action.enableAllWorkspace",title:L(10197,"Enable All Extensions for this Workspace"),category:bh,menu:{id:D.CommandPalette,when:C.and(za.notEqualsTo("empty"),C.or(wx,Jk,bN))},run:async()=>{let l=this.extensionsWorkbenchService.local.filter(c=>!!c.local&&this.extensionEnablementService.canChangeEnablement(c.local)&&!this.extensionEnablementService.isEnabled(c.local));l.length&&await this.extensionsWorkbenchService.setEnablement(l,13)}}),this.registerExtensionAction({id:"workbench.extensions.action.disableAll",title:L(10188,"Disable All Installed Extensions"),category:bh,menu:[{id:D.CommandPalette,when:C.or(wx,Jk,bN)},{id:D.ViewContainerTitle,when:C.equals("viewContainer",pg),group:"2_enablement",order:2}],run:async()=>{let l=this.extensionsWorkbenchService.local.filter(c=>!c.isBuiltin&&!!c.local&&this.extensionEnablementService.isEnabled(c.local)&&this.extensionEnablementService.canChangeEnablement(c.local));l.length&&await this.extensionsWorkbenchService.setEnablement(l,10)}}),this.registerExtensionAction({id:"workbench.extensions.action.disableAllWorkspace",title:L(10189,"Disable All Installed Extensions for this Workspace"),category:bh,menu:{id:D.CommandPalette,when:C.and(za.notEqualsTo("empty"),C.or(wx,Jk,bN))},run:async()=>{let l=this.extensionsWorkbenchService.local.filter(c=>!c.isBuiltin&&!!c.local&&this.extensionEnablementService.isEnabled(c.local)&&this.extensionEnablementService.canChangeEnablement(c.local));l.length&&await this.extensionsWorkbenchService.setEnablement(l,11)}}),this.registerExtensionAction({id:vMt,title:L(10260,"Install from VSIX..."),category:bh,menu:[{id:D.CommandPalette,when:C.or(wx,Jk)},{id:D.ViewContainerTitle,when:C.and(C.equals("viewContainer",pg),C.or(wx,Jk)),group:"3_install",order:1}],run:async l=>{let c=l.get(rn),u=l.get(ge),p=await c.showOpenDialog({title:d(10259,null),filters:[{name:"VSIX Extensions",extensions:["vsix"]}],canSelectFiles:!0,canSelectMany:!0,openLabel:vj(d(10250,null))});p&&await u.executeCommand(d7e,p)}}),this.registerExtensionAction({id:d7e,title:d(10262,null),menu:[{id:D.ExplorerContext,group:"extensions",when:C.and(Wo.Extension.isEqualTo(".vsix"),C.or(wx,Jk))}],run:async(l,c)=>{let u=l.get(Hi),p=l.get(Zt),h=l.get(Ne),g=Array.isArray(c)?c:[c],f=await Promise.allSettled(g.map(async y=>await u.install(y,{installGivenVersion:!0}))),v,b=!1,S=!1;for(let y of f){if(y.status==="rejected"){v=new Error(y.reason);break}b=b||y.value.runtimeState?.action==="reloadWindow",S=S||y.value.runtimeState?.action==="restartExtensions"}if(v)throw v;b?h.prompt(ft.Info,g.length>1?d(10269,null):d(10266,null),[{label:d(10263,null),run:()=>p.reload()}]):S?h.prompt(ft.Info,g.length>1?d(10270,null):d(10267,null),[{label:d(10264,null),run:()=>u.updateRunningExtensions()}]):h.prompt(ft.Info,g.length>1?d(10268,null):d(10265,null),[])}}),this.registerExtensionAction({id:"workbench.extensions.action.installExtensionFromLocation",title:L(10253,"Install Extension from Location..."),category:Ve.Developer,menu:[{id:D.CommandPalette,when:C.or(bN,wx)}],run:async l=>{let c=l.get(ru);if(Wt)return new Promise((u,p)=>{let h=l.get(Ue),g=new N,f=g.add(h.createQuickPick());f.title=d(10257,null),f.customButton=!0,f.customLabel=d(10248,null),f.placeholder=d(10258,null),f.ignoreFocusOut=!0,g.add(U.any(f.onDidAccept,f.onDidCustom)(async()=>{if(f.hide(),f.value)try{await c.installFromLocation(A.parse(f.value))}catch(v){p(v);return}u()})),g.add(f.onDidHide(()=>g.dispose())),f.show()});{let p=await l.get(rn).showOpenDialog({canSelectFolders:!0,canSelectFiles:!1,canSelectMany:!1,title:d(10257,null)});p?.[0]&&await c.installFromLocation(p[0])}}}),ve.appendMenuItem(m7e,{submenu:mg,title:d(10242,null),group:"navigation",order:2,icon:vUt});let o="extensions.filter.featured",n=C.and(kh,C.regex(aPi.key,new RegExp("_Featured_")));this.registerExtensionAction({id:o,title:L(10291,"Show Featured Extensions"),category:bh,menu:[{id:D.CommandPalette,when:n},{id:mg,when:n,group:"1_predefined",order:1}],menuTitles:{[mg.id]:d(10240,null)},run:()=>this.extensionsWorkbenchService.openSearch("@featured ")}),this.registerExtensionAction({id:"workbench.extensions.action.showPopularExtensions",title:L(10293,"Show Popular Extensions"),category:bh,menu:[{id:D.CommandPalette,when:kh},{id:mg,when:kh,group:"1_predefined",order:2}],menuTitles:{[mg.id]:d(10276,null)},run:()=>this.extensionsWorkbenchService.openSearch("@popular ")}),this.registerExtensionAction({id:"workbench.extensions.action.showRecommendedExtensions",title:L(10294,"Show Recommended Extensions"),category:bh,menu:[{id:D.CommandPalette,when:kh},{id:mg,when:kh,group:"1_predefined",order:2}],menuTitles:{[mg.id]:d(10277,null)},run:()=>this.extensionsWorkbenchService.openSearch("@recommended ")}),this.registerExtensionAction({id:"workbench.extensions.action.recentlyPublishedExtensions",title:L(10283,"Show Recently Published Extensions"),category:bh,menu:[{id:D.CommandPalette,when:kh},{id:mg,when:kh,group:"1_predefined",order:2}],menuTitles:{[mg.id]:d(10282,null)},run:()=>this.extensionsWorkbenchService.openSearch("@recentlyPublished ")});let r=new D("extensionsCategoryFilterSubMenu");ve.appendMenuItem(mg,{submenu:r,title:d(10241,null),when:C.and(kh,C.regex(aPi.key,new RegExp("_Category_"))),group:"2_categories",order:1}),cF.forEach((l,c)=>{this.registerExtensionAction({id:`extensions.actions.searchByCategory.${l}`,title:l,menu:[{id:r,when:kh,order:c}],run:()=>this.extensionsWorkbenchService.openSearch(`@category:"${l.toLowerCase()}"`)})}),this.registerExtensionAction({id:"workbench.extensions.action.installedExtensions",title:L(10252,"Show Installed Extensions"),category:bh,f1:!0,menu:[{id:mg,group:"3_installed",order:1}],menuTitles:{[mg.id]:d(10251,null)},run:()=>this.extensionsWorkbenchService.openSearch("@installed ")}),this.registerExtensionAction({id:"workbench.extensions.action.listBuiltInExtensions",title:L(10287,"Show Built-in Extensions"),category:bh,menu:[{id:D.CommandPalette,when:C.or(wx,Jk,bN)},{id:mg,group:"3_installed",order:3}],menuTitles:{[mg.id]:d(10185,null)},run:()=>this.extensionsWorkbenchService.openSearch("@builtin ")}),this.registerExtensionAction({id:"workbench.extensions.action.extensionUpdates",title:L(10239,"Show Extension Updates"),category:bh,precondition:kh,f1:!0,menu:[{id:mg,group:"3_installed",when:kh,order:2}],menuTitles:{[mg.id]:d(10203,null)},run:()=>this.extensionsWorkbenchService.openSearch("@updates")}),this.registerExtensionAction({id:FB,title:L(10296,"Show Extensions Unsupported By Workspace"),category:bh,menu:[{id:D.CommandPalette,when:C.or(wx,Jk)},{id:mg,group:"3_installed",order:6,when:C.or(wx,Jk)}],menuTitles:{[mg.id]:d(10336,null)},run:()=>this.extensionsWorkbenchService.openSearch("@workspaceUnsupported")}),this.registerExtensionAction({id:"workbench.extensions.action.showEnabledExtensions",title:L(10289,"Show Enabled Extensions"),category:bh,menu:[{id:D.CommandPalette,when:C.or(wx,Jk,bN)},{id:mg,group:"3_installed",order:4}],menuTitles:{[mg.id]:d(10200,null)},run:()=>this.extensionsWorkbenchService.openSearch("@enabled ")}),this.registerExtensionAction({id:"workbench.extensions.action.showDisabledExtensions",title:L(10288,"Show Disabled Extensions"),category:bh,menu:[{id:D.CommandPalette,when:C.or(wx,Jk,bN)},{id:mg,group:"3_installed",order:5}],menuTitles:{[mg.id]:d(10191,null)},run:()=>this.extensionsWorkbenchService.openSearch("@disabled ")});let s=new D("extensionsSortSubMenu");ve.appendMenuItem(mg,{submenu:s,title:d(10303,null),when:C.and(C.or(kh,QC)),group:"4_sort",order:1}),[{id:"installs",title:d(10298,null),precondition:rfe.negate(),sortCapability:"InstallCount"},{id:"rating",title:d(10301,null),precondition:rfe.negate(),sortCapability:"WeightedRating"},{id:"name",title:d(10299,null),precondition:rfe.negate(),sortCapability:"Title"},{id:"publishedDate",title:d(10300,null),precondition:rfe.negate(),sortCapability:"PublishedDate"},{id:"updateDate",title:d(10302,null),precondition:C.and(ZMi.negate(),tPi.negate(),rfe.negate()),sortCapability:"UpdateDate"}].map(({id:l,title:c,precondition:u,sortCapability:p},h)=>{let g=C.regex(wyo.key,new RegExp(`_${p}_`));this.registerExtensionAction({id:`extensions.sort.${l}`,title:c,precondition:C.and(u,C.regex(iPi.key,/^@contribute:/).negate(),g),menu:[{id:s,when:C.and(C.or(kh,QC),g),order:h}],toggled:JMi.isEqualTo(l),run:async()=>{let f=(await this.viewsService.openViewContainer(pg,!0))?.getViewPaneContainer(),v=oq.parse(f?.searchValue??"");f?.search(new oq(v.value,l).toString()),f?.focus()}})}),this.registerExtensionAction({id:"workbench.extensions.action.clearExtensionsSearchResults",title:L(10187,"Clear Extensions Search Results"),category:bh,icon:Hmo,f1:!0,precondition:ePi,menu:{id:m7e,group:"navigation",order:1},run:async l=>{let c=l.get($t).getActiveViewPaneContainerWithId(pg);if(c){let u=c;u.search(""),u.focus()}}}),this.registerExtensionAction({id:"workbench.extensions.action.refreshExtension",title:L(10284,"Refresh"),category:bh,icon:Umo,f1:!0,menu:{id:D.ViewContainerTitle,when:C.equals("viewContainer",pg),group:"navigation",order:2},run:async l=>{let c=l.get($t).getActiveViewPaneContainerWithId(pg);c&&await c.refresh()}}),this.registerExtensionAction({id:"workbench.extensions.action.installWorkspaceRecommendedExtensions",title:d(10271,null),icon:gEi,menu:{id:D.ViewTitle,when:C.equals("view",QTe),group:"navigation",order:1},run:async l=>l.get($t).getActiveViewWithId(QTe).installWorkspaceRecommendations()}),this.registerExtensionAction({id:bG.ID,title:bG.LABEL,icon:Kmo,menu:[{id:D.CommandPalette,when:za.notEqualsTo("empty")},{id:D.ViewTitle,when:C.equals("view",QTe),group:"navigation",order:2}],run:()=>lPi(this.instantiationService.createInstance(bG,bG.ID,bG.LABEL))}),this.registerExtensionAction({id:ZA.ID,title:{value:ZA.LABEL,original:"Install Specific Version of Extension..."},category:bh,menu:{id:D.CommandPalette,when:C.and(kh,C.or(wx,Jk,bN))},run:()=>lPi(this.instantiationService.createInstance(ZA,ZA.ID,ZA.LABEL))})}registerContextMenuActions(){this.registerExtensionAction({id:Hk.ID,title:Hk.TITLE,menu:{id:D.ExtensionContext,group:YTe,order:0,when:C.and(C.not("inExtensionEditor"),C.equals("extensionStatus","installed"),C.has("extensionHasColorThemes"))},run:async(e,t)=>{let o=e.get(Hi),n=e.get(F),r=o.local.find(s=>Ut(s.identifier,{id:t}));if(r){let s=n.createInstance(Hk);return s.extension=r,s.run()}}}),this.registerExtensionAction({id:Uk.ID,title:Uk.TITLE,menu:{id:D.ExtensionContext,group:YTe,order:0,when:C.and(C.not("inExtensionEditor"),C.equals("extensionStatus","installed"),C.has("extensionHasFileIconThemes"))},run:async(e,t)=>{let o=e.get(Hi),n=e.get(F),r=o.local.find(s=>Ut(s.identifier,{id:t}));if(r){let s=n.createInstance(Uk);return s.extension=r,s.run()}}}),this.registerExtensionAction({id:zk.ID,title:zk.TITLE,menu:{id:D.ExtensionContext,group:YTe,order:0,when:C.and(C.not("inExtensionEditor"),C.equals("extensionStatus","installed"),C.has("extensionHasProductIconThemes"))},run:async(e,t)=>{let o=e.get(Hi),n=e.get(F),r=o.local.find(s=>Ut(s.identifier,{id:t}));if(r){let s=n.createInstance(zk);return s.extension=r,s.run()}}}),this.registerExtensionAction({id:"workbench.extensions.action.showPreReleaseVersion",title:L(10285,"Show Pre-Release Version"),menu:{id:D.ExtensionContext,group:NJ,order:0,when:C.and(C.has("inExtensionEditor"),C.has("galleryExtensionHasPreReleaseVersion"),C.has("isPreReleaseExtensionAllowed"),C.not("showPreReleaseVersion"),C.not("isBuiltinExtension"))},run:async(e,t)=>{let o=e.get(Hi),n=(await o.getExtensions([{id:t}],Se.None))[0];o.open(n,{showPreReleaseVersion:!0})}}),this.registerExtensionAction({id:"workbench.extensions.action.showReleasedVersion",title:L(10286,"Show Release Version"),menu:{id:D.ExtensionContext,group:NJ,order:1,when:C.and(C.has("inExtensionEditor"),C.has("galleryExtensionHasPreReleaseVersion"),C.has("extensionHasReleaseVersion"),C.has("showPreReleaseVersion"),C.not("isBuiltinExtension"))},run:async(e,t)=>{let o=e.get(Hi),n=(await o.getExtensions([{id:t}],Se.None))[0];o.open(n,{showPreReleaseVersion:!1})}}),this.registerExtensionAction({id:fx.ID,title:fx.LABEL,category:bh,precondition:C.and(C.or(C.notEquals(`config.${Fw}`,"onlyEnabledExtensions"),C.equals("isExtensionEnabled",!0)),C.not("extensionDisallowInstall"),C.has("isExtensionAllowed")),menu:{id:D.ExtensionContext,group:p7e,order:1,when:C.and(C.not("inExtensionEditor"),C.equals("extensionStatus","installed"),C.not("isBuiltinExtension"))},run:async(e,t)=>{let o=e.get(F),r=e.get(Hi).local.find(s=>Ut(s.identifier,{id:t}));if(r){let s=o.createInstance(fx);return s.extension=r,s.run()}}}),this.registerExtensionAction({id:X0.ID,title:{value:X0.LABEL,original:"Auto Update (Publisher)"},category:bh,precondition:C.equals(`config.${Fw}`,!1),menu:{id:D.ExtensionContext,group:p7e,order:2,when:C.and(C.equals("extensionStatus","installed"),C.not("isBuiltinExtension"))},run:async(e,t)=>{let o=e.get(F),r=e.get(Hi).local.find(s=>Ut(s.identifier,{id:t}));if(r){let s=o.createInstance(X0);return s.extension=r,s.run()}}}),this.registerExtensionAction({id:"workbench.extensions.action.switchToPreRlease",title:d(10201,null),category:bh,menu:{id:D.ExtensionContext,group:NJ,order:2,when:C.and(kh,C.has("galleryExtensionHasPreReleaseVersion"),C.has("isPreReleaseExtensionAllowed"),C.not("installedExtensionIsOptedToPreRelease"),C.not("inExtensionEditor"),C.equals("extensionStatus","installed"),C.not("isBuiltinExtension"))},run:async(e,t)=>{let o=e.get(F),r=e.get(Hi).local.find(s=>Ut(s.identifier,{id:t}));if(r){let s=o.createInstance($D);return s.extension=r,s.run()}}}),this.registerExtensionAction({id:"workbench.extensions.action.switchToRelease",title:d(10192,null),category:bh,menu:{id:D.ExtensionContext,group:NJ,order:2,when:C.and(kh,C.has("galleryExtensionHasPreReleaseVersion"),C.has("isExtensionAllowed"),C.has("installedExtensionIsOptedToPreRelease"),C.not("inExtensionEditor"),C.equals("extensionStatus","installed"),C.not("isBuiltinExtension"))},run:async(e,t)=>{let o=e.get(F),r=e.get(Hi).local.find(s=>Ut(s.identifier,{id:t}));if(r){let s=o.createInstance($D);return s.extension=r,s.run()}}}),this.registerExtensionAction({id:vx.ID,title:vx.TITLE,menu:{id:D.ExtensionContext,group:NJ,order:0,when:C.and(C.not("inExtensionEditor"),C.has("canSetLanguage"),C.has("isActiveLanguagePackExtension"))},run:async(e,t)=>{let o=e.get(F),r=(await e.get(Hi).getExtensions([{id:t}],Se.None))[0],s=o.createInstance(vx);return s.extension=r,s.run()}}),this.registerExtensionAction({id:"workbench.extensions.action.installUnsigned",title:d(10247,null),menu:{id:D.ExtensionContext,group:"0_install",when:C.and(C.equals("extensionStatus","uninstalled"),C.has("isGalleryExtension"),C.not("extensionDisallowInstall"),C.has("extensionIsUnsigned"),C.or(C.and(Cyo,C.not("extensionIsPrivate")),C.and(xyo,C.has("extensionIsPrivate")))),order:1},run:async(e,t)=>{let o=e.get(F),n=this.extensionsWorkbenchService.local.filter(r=>Ut(r.identifier,{id:t}))[0]||(await this.extensionsWorkbenchService.getExtensions([{id:t}],Se.None))[0];if(n){let r=o.createInstance(Yw,{installPreReleaseVersion:this.extensionManagementService.preferPreReleases});return r.extension=n,r.run()}}}),this.registerExtensionAction({id:"workbench.extensions.action.installAndDonotSync",title:d(10249,null),menu:{id:D.ExtensionContext,group:"0_install",when:C.and(C.equals("extensionStatus","uninstalled"),C.has("isGalleryExtension"),C.has("isExtensionAllowed"),C.not("extensionDisallowInstall"),HD),order:1},run:async(e,t)=>{let o=e.get(F),n=this.extensionsWorkbenchService.local.filter(r=>Ut(r.identifier,{id:t}))[0]||(await this.extensionsWorkbenchService.getExtensions([{id:t}],Se.None))[0];if(n){let r=o.createInstance(Yw,{installPreReleaseVersion:this.extensionManagementService.preferPreReleases,isMachineScoped:!0});return r.extension=n,r.run()}}}),this.registerExtensionAction({id:"workbench.extensions.action.installPrereleaseAndDonotSync",title:d(10261,null),menu:{id:D.ExtensionContext,group:"0_install",when:C.and(C.equals("extensionStatus","uninstalled"),C.has("isGalleryExtension"),C.has("extensionHasPreReleaseVersion"),C.has("isPreReleaseExtensionAllowed"),C.not("extensionDisallowInstall"),HD),order:2},run:async(e,t)=>{let o=e.get(F),n=this.extensionsWorkbenchService.local.filter(r=>Ut(r.identifier,{id:t}))[0]||(await this.extensionsWorkbenchService.getExtensions([{id:t}],Se.None))[0];if(n){let r=o.createInstance(Yw,{isMachineScoped:!0,preRelease:!0});return r.extension=n,r.run()}}}),this.registerExtensionAction({id:WT.ID,title:WT.LABEL,menu:{id:D.ExtensionContext,group:"0_install",when:C.and(C.equals("extensionStatus","uninstalled"),C.has("isGalleryExtension"),C.has("isExtensionAllowed"),C.not("extensionDisallowInstall")),order:3},run:async(e,t)=>{let o=e.get(F),n=this.extensionsWorkbenchService.local.filter(r=>Ut(r.identifier,{id:t}))[0]||(await this.extensionsWorkbenchService.getExtensions([{id:t}],Se.None))[0];if(n)return o.createInstance(WT,n,!1).run()}}),this.registerExtensionAction({id:"workbench.extensions.action.copyExtension",title:L(10315,"Copy"),menu:{id:D.ExtensionContext,group:"1_copy"},run:async(e,t)=>{let o=e.get(Fi),n=this.extensionsWorkbenchService.local.filter(r=>Ut(r.identifier,{id:t}))[0]||(await this.extensionsWorkbenchService.getExtensions([{id:t}],Se.None))[0];if(n){let r=d(10206,null,n.displayName),s=d(10205,null,t),l=d(10204,null,n.description),c=d(10208,null,n.version),u=d(10207,null,n.publisherDisplayName),p=n.url?d(10209,null,`${n.url}`):null,h=`${r}
${s}
${l}
${c}
${u}${p?`
`+p:""}`;await o.writeText(h)}}}),this.registerExtensionAction({id:"workbench.extensions.action.copyExtensionId",title:L(10316,"Copy Extension ID"),menu:{id:D.ExtensionContext,group:"1_copy"},run:async(e,t)=>e.get(Fi).writeText(t)}),this.registerExtensionAction({id:"workbench.extensions.action.copyLink",title:L(10317,"Copy Link"),menu:{id:D.ExtensionContext,group:"1_copy",when:C.and(C.has("isGalleryExtension"),kyo)},run:async(e,t,o)=>{let n=e.get(Fi);o.galleryLink&&await n.writeText(o.galleryLink)}}),this.registerExtensionAction({id:"workbench.extensions.action.configure",title:L(10313,"Settings"),menu:{id:D.ExtensionContext,group:"2_configure",when:C.and(C.equals("extensionStatus","installed"),C.has("extensionHasConfiguration")),order:1},run:async(e,t)=>e.get(Go).openSettings({jsonEditor:!1,query:`@ext:${t}`})}),this.registerExtensionAction({id:"workbench.extensions.action.download",title:d(10195,null),menu:{id:D.ExtensionContext,when:C.and(C.not("extensionDisallowInstall"),C.has("isGalleryExtension")),order:this.productService.quality==="stable"?0:1},run:async(e,t)=>{e.get(Hi).downloadVSIX(t,"release")}}),this.registerExtensionAction({id:"workbench.extensions.action.downloadPreRelease",title:d(10193,null),menu:{id:D.ExtensionContext,when:C.and(C.not("extensionDisallowInstall"),C.has("isGalleryExtension"),C.has("extensionHasPreReleaseVersion")),order:this.productService.quality==="stable"?1:0},run:async(e,t)=>{e.get(Hi).downloadVSIX(t,"prerelease")}}),this.registerExtensionAction({id:"workbench.extensions.action.downloadSpecificVersion",title:d(10194,null),menu:{id:D.ExtensionContext,when:C.and(C.not("extensionDisallowInstall"),C.has("isGalleryExtension")),order:2},run:async(e,t)=>{e.get(Hi).downloadVSIX(t,"any")}}),this.registerExtensionAction({id:"workbench.extensions.action.manageAccountPreferences",title:L(10312,"Account Preferences"),menu:{id:D.ExtensionContext,group:"2_configure",when:C.and(C.equals("extensionStatus","installed"),C.has("extensionHasAccountPreferences")),order:2},run:(e,t)=>e.get(ge).executeCommand("_manageAccountPreferencesForExtension",t)}),this.registerExtensionAction({id:"workbench.extensions.action.configureKeybindings",title:L(10314,"Keyboard Shortcuts"),menu:{id:D.ExtensionContext,group:"2_configure",when:C.and(C.equals("extensionStatus","installed"),C.has("extensionHasKeybindings")),order:2},run:async(e,t)=>e.get(Go).openGlobalKeybindingSettings(!1,{query:`@ext:${t}`})}),this.registerExtensionAction({id:"workbench.extensions.action.toggleApplyToAllProfiles",title:L(10321,"Apply Extension to all Profiles"),toggled:C.has("isApplicationScopedExtension"),menu:{id:D.ExtensionContext,group:"2_configure",when:C.and(C.equals("extensionStatus","installed"),C.has("isDefaultApplicationScopedExtension").negate(),C.has("isBuiltinExtension").negate(),C.equals("isWorkspaceScopedExtension",!1)),order:3},run:async(e,t,o)=>{let n=e.get(ht),r=o.location?this.extensionsWorkbenchService.installed.find(s=>n.extUri.isEqual(s.local?.location,o.location)):void 0;if(r)return this.extensionsWorkbenchService.toggleApplyExtensionToAllProfiles(r)}}),this.registerExtensionAction({id:fMt,title:L(10322,"Sync This Extension"),menu:{id:D.ExtensionContext,group:"2_configure",when:C.and(C.equals("extensionStatus","installed"),HD,C.equals("isWorkspaceScopedExtension",!1)),order:4},run:async(e,t)=>{let o=this.extensionsWorkbenchService.local.find(n=>Ut({id:t},n.identifier));if(o)return this.extensionsWorkbenchService.toggleExtensionIgnoredToSync(o)}}),this.registerExtensionAction({id:"workbench.extensions.action.ignoreRecommendation",title:L(10318,"Ignore Recommendation"),menu:{id:D.ExtensionContext,group:"3_recommendations",when:C.has("isExtensionRecommended"),order:1},run:async(e,t)=>e.get(Ok).toggleGlobalIgnoredRecommendation(t,!0)}),this.registerExtensionAction({id:"workbench.extensions.action.undoIgnoredRecommendation",title:L(10323,"Undo Ignored Recommendation"),menu:{id:D.ExtensionContext,group:"3_recommendations",when:C.has("isUserIgnoredRecommendation"),order:1},run:async(e,t)=>e.get(Ok).toggleGlobalIgnoredRecommendation(t,!1)}),this.registerExtensionAction({id:"workbench.extensions.action.addExtensionToWorkspaceRecommendations",title:L(10307,"Add to Workspace Recommendations"),menu:{id:D.ExtensionContext,group:"3_recommendations",when:C.and(za.notEqualsTo("empty"),C.has("isBuiltinExtension").negate(),C.has("isExtensionWorkspaceRecommended").negate(),C.has("isUserIgnoredRecommendation").negate(),C.notEquals("extensionSource","resource")),order:2},run:(e,t)=>e.get(Z2).toggleRecommendation(t)}),this.registerExtensionAction({id:"workbench.extensions.action.removeExtensionFromWorkspaceRecommendations",title:L(10320,"Remove from Workspace Recommendations"),menu:{id:D.ExtensionContext,group:"3_recommendations",when:C.and(za.notEqualsTo("empty"),C.has("isBuiltinExtension").negate(),C.has("isExtensionWorkspaceRecommended")),order:2},run:(e,t)=>e.get(Z2).toggleRecommendation(t)}),this.registerExtensionAction({id:"workbench.extensions.action.addToWorkspaceRecommendations",title:L(10311,"Add Extension to Workspace Recommendations"),category:M4,menu:{id:D.CommandPalette,when:C.and(za.isEqualTo("workspace"),C.equals("resourceScheme",Q.extension))},async run(e){let t=e.get(ee),o=e.get(Z2);if(!(t.activeEditor instanceof nq))return;let n=t.activeEditor.extension.identifier.id.toLowerCase();(await o.getRecommendations()).includes(n)||await o.toggleRecommendation(n)}}),this.registerExtensionAction({id:"workbench.extensions.action.addToWorkspaceFolderRecommendations",title:L(10309,"Add Extension to Workspace Folder Recommendations"),category:M4,menu:{id:D.CommandPalette,when:C.and(za.isEqualTo("folder"),C.equals("resourceScheme",Q.extension))},run:()=>this.commandService.executeCommand("workbench.extensions.action.addToWorkspaceRecommendations")}),this.registerExtensionAction({id:"workbench.extensions.action.addToWorkspaceIgnoredRecommendations",title:L(10310,"Add Extension to Workspace Ignored Recommendations"),category:M4,menu:{id:D.CommandPalette,when:C.and(za.isEqualTo("workspace"),C.equals("resourceScheme",Q.extension))},async run(e){let t=e.get(ee),o=e.get(Z2);if(!(t.activeEditor instanceof nq))return;let n=t.activeEditor.extension.identifier.id.toLowerCase();(await o.getUnwantedRecommendations()).includes(n)||await o.toggleUnwantedRecommendation(n)}}),this.registerExtensionAction({id:"workbench.extensions.action.addToWorkspaceFolderIgnoredRecommendations",title:L(10308,"Add Extension to Workspace Folder Ignored Recommendations"),category:M4,menu:{id:D.CommandPalette,when:C.and(za.isEqualTo("folder"),C.equals("resourceScheme",Q.extension))},run:()=>this.commandService.executeCommand("workbench.extensions.action.addToWorkspaceIgnoredRecommendations")}),this.registerExtensionAction({id:vG.ID,title:{value:vG.LABEL,original:"Configure Recommended Extensions (Workspace)"},category:M4,menu:{id:D.CommandPalette,when:za.isEqualTo("workspace")},run:()=>lPi(this.instantiationService.createInstance(vG,vG.ID,vG.LABEL))}),this.registerExtensionAction({id:"workbench.extensions.action.manageTrustedPublishers",title:L(10319,"Manage Trusted Extension Publishers"),category:M4,f1:!0,run:async e=>{let t=e.get(Ue),o=e.get(ru),n=o.getTrustedPublishers(),r=n.map(l=>({id:l.publisher,label:l.publisherDisplayName,description:l.publisher,picked:!0})).sort((l,c)=>l.label.localeCompare(c.label)),s=await t.pick(r,{canPickMany:!0,title:d(10304,null),placeHolder:d(10305,null)});if(s){let l=[];for(let{publisher:c}of n)s.some(u=>u.id===c)||l.push(c);n.filter(c=>!s.some(u=>u.id===c.publisher)),o.untrustPublishers(...l)}}})}registerExtensionAction(e){let t=e.menu?Array.isArray(e.menu)?e.menu:[e.menu]:[],o=[],n=[];if(e.menuTitles)for(let s=0;s<t.length;s++){let l=t[s],c=e.menuTitles[l.id.id];c?n.push({id:l.id,item:{...l,command:{id:e.id,title:c}}}):o.push(l)}else o=t;let r=new N;return r.add(W(class extends K{constructor(){super({...e,menu:o})}run(s,...l){return e.run(s,...l)}})),n.length&&r.add(ve.appendMenuItems(n)),r}};Nrt=I([m(0,Cs),m(1,Ec),m(2,Dv),m(3,X),m(4,$t),m(5,Hi),m(6,Js),m(7,F),m(8,at),m(9,ge),m(10,tt),m(11,Oy)],Nrt);var Ort=class{constructor(i,e){Hw.removeOutdatedExtensionVersions(i,e)}};Ort=I([m(0,Cs),m(1,ce)],Ort);var Frt=class{constructor(i,e,t,o){let n="trusted-publishers-init-migration";if(!o.get(n,-1))for(let r of e.profiles)i.getInstalled(1,r.extensionsResource).then(async s=>{let l=new Map;for(let c of s){if(!c.publisherDisplayName)continue;let u=c.manifest.publisher.toLowerCase();t.trustedExtensionPublishers?.includes(u)||c.publisherDisplayName&&t.trustedExtensionPublishers?.includes(c.publisherDisplayName.toLowerCase())||l.set(u,{publisher:u,publisherDisplayName:c.publisherDisplayName})}l.size&&i.trustPublishers(...l.values()),o.store(n,"true",-1,1)})}};Frt=I([m(0,ru),m(1,an),m(2,tt),m(3,ce)],Frt);var uWe=class extends x{static{this.ID="extensions.chat.toolsContribution"}constructor(i,e){super();let t=e.createInstance(H0e);this._register(i.registerTool(WMi,t)),this._register(i.vscodeToolSet.addTool(WMi))}};uWe=I([m(0,Vn),m(1,F)],uWe);var SN=ne.as(Qi.Workbench);SN.registerWorkbenchContribution(Nrt,3);SN.registerWorkbenchContribution(aWe,4);SN.registerWorkbenchContribution(lWe,4);SN.registerWorkbenchContribution(FFe,3);SN.registerWorkbenchContribution(rWe,3);SN.registerWorkbenchContribution(iWe,4);SN.registerWorkbenchContribution(nWe,4);SN.registerWorkbenchContribution(G0e,3);SN.registerWorkbenchContribution(oWe,3);SN.registerWorkbenchContribution(dWe,4);SN.registerWorkbenchContribution(Frt,4);SN.registerWorkbenchContribution(cWe,4);Wt&&SN.registerWorkbenchContribution(Ort,4);It(uWe.ID,uWe,St.AfterRestored);W(NGt);W(class extends K{constructor(){super({id:"workbench.extensions.actions.gallery.signIn",title:L(10297,"Sign in to access Extensions Marketplace"),menu:{id:D.AccountsContext,when:AJ.isEqualTo("requiresSignIn")}})}run(i){return i.get(ge).executeCommand(Aet)}});ne.as(Ep.ConfigurationMigration).registerConfigurationMigrations([{key:Fw,migrateFn:(a,i)=>a==="onlySelectedExtensions"?{value:!1}:[]}]);var aq=le("agentPluginRepositoryService");var can="installed.json",dan=1,Tyo="chat.plugins.installed.v1",uan="chat.plugins.marketplaces.index.v1",ZGt=class extends x{constructor(e,t,o,n,r){super();this._agentPluginsHome=e;this._oldCacheRoot=t;this._fileService=o;this._logService=n;this._storageService=r;this._installed=Me("file/installed.json",[]);this._suppressFileWatch=!1;this._initialized=!1;this.value=this._installed;this._fileUri=Ge(e,can),this._writeDelayer=this._register(new ya(100)),this._initialize()}get(){return this._installed.get()}set(e,t){this._setValue(e,t,!0)}async _initialize(){try{let e=await this._readFromFile();e!==void 0?this._setValue(e,void 0,!1):await this._migrateFromStorage()}catch(e){this._logService.error("[FileBackedInstalledPluginsStore] Initialization failed",e)}this._initialized=!0,this._setupFileWatcher()}async _readFromFile(){try{if(!await this._fileService.exists(this._fileUri))return;let t=await this._fileService.readFile(this._fileUri),o=JSON.parse(t.value.toString());if(!o||!Array.isArray(o.installed)){this._logService.warn("[FileBackedInstalledPluginsStore] installed.json has unexpected format, ignoring");return}return o.installed.filter(n=>typeof n.pluginUri=="string"&&typeof n.marketplace=="string").map(n=>({pluginUri:A.parse(n.pluginUri),marketplace:n.marketplace}))}catch{return}}_scheduleWrite(){this._writeDelayer.trigger(async()=>{await this._writeToFile()})}async _writeToFile(){let e=this.get().map(o=>({pluginUri:o.pluginUri.toString(),marketplace:o.marketplace})),t={version:dan,installed:e};try{this._suppressFileWatch=!0;let o=JSON.stringify(t,void 0,"	");return await this._fileService.createFolder(this._agentPluginsHome),await this._fileService.writeFile(this._fileUri,qe.fromString(o)),!0}catch(o){return this._logService.error("[FileBackedInstalledPluginsStore] Failed to write installed.json",o),!1}finally{this._suppressFileWatch=!1}}_setupFileWatcher(){if(typeof this._fileService.createWatcher!="function")return;let e=this._agentPluginsHome,t=this._fileService.createWatcher(e,{recursive:!1,excludes:[]});this._register(t);let o=this._register(new Dt(()=>this._onFileChanged(),100));this._register(t.onDidChange(n=>{!this._suppressFileWatch&&n.affects(this._fileUri)&&o.schedule()}))}async _onFileChanged(){let e=await this._readFromFile();if(e!==void 0){this._suppressFileWatch=!0;try{this._setValue(e,void 0,!1)}finally{this._suppressFileWatch=!1}}}_setValue(e,t,o){this._installed.set(e,t),o&&this._initialized&&!this._suppressFileWatch&&this._scheduleWrite()}async _migrateFromStorage(){let e=this._storageService.get(Tyo,-1);if(e)try{let t=JSON.parse(e);if(!Array.isArray(t)||t.length===0)return;let o=$n(t).map(r=>{let s=A.revive(r.pluginUri);return{pluginUri:this._rebasePluginUri(s)??s,marketplace:r.plugin?.marketplaceReference?.rawValue??""}}).filter(r=>!!r.marketplace);if(this._logService.info(`[FileBackedInstalledPluginsStore] Migrating ${o.length} plugin(s) from storage to installed.json`),this._setValue(o,void 0,!1),!await this._writeToFile())return;this._storageService.remove(Tyo,-1),this._storageService.remove(uan,-1)}catch(t){this._logService.error("[FileBackedInstalledPluginsStore] Migration from storage failed",t)}}_rebasePluginUri(e){if(!this._oldCacheRoot)return;let t=this._oldCacheRoot;if(!Qe(e,t)&&e.scheme===t.scheme&&e.path.startsWith(t.path+"/")){let o=e.path.substring(t.path.length);return e.with({path:this._agentPluginsHome.path+o})}}};function LQ(a){let i=new Map;for(let e of a){if(typeof e!="string")continue;let t=Fy(e);t&&(i.has(t.canonicalId)||i.set(t.canonicalId,t))}return[...i.values()]}function dPi(a,i){let e=new Map;for(let t of a)e.set(t.canonicalId,t);for(let t of i)e.has(t.canonicalId)||e.set(t.canonicalId,t);return[...e.values()]}function Fy(a){let i=a.trim();if(!i)return;let e=pan(i);if(e)return e;let t=man(i);if(t)return t;let o=/^([A-Za-z0-9_.-]+)\/([A-Za-z0-9_.-]+)$/.exec(i);if(o){let n=o[1],r=o[2];return{rawValue:i,displayLabel:`${n}/${r}`,cloneUrl:`https://github.com/${n}/${r}.git`,canonicalId:gan(n,r),cacheSegments:["github.com",n,r],kind:"githubShorthand",githubRepo:`${n}/${r}`}}}function pan(a){let i;try{i=A.parse(a)}catch{return}let e=i.scheme.toLowerCase();if(e==="file"&&/^file:\/\//i.test(a)){let p=A.file(i.fsPath);return{rawValue:a,displayLabel:p.fsPath,cloneUrl:a,canonicalId:`file:${p.toString().toLowerCase()}`,cacheSegments:[],kind:"localFileUri",localRepositoryUri:p}}if(e!=="http"&&e!=="https"&&e!=="ssh"||!i.authority)return;let t=han(i.path);if(!t)return;let o=".git",n=eqt(i.authority.toLowerCase()),r=t.toLowerCase().endsWith(o),s=r?t.slice(1,t.length-o.length):t.slice(1),l=s.split("/").map(eqt),c=r?t.slice(1).toLowerCase():`${t.slice(1).toLowerCase()}${o}`,u=_yo(i.authority,s);return{rawValue:a,displayLabel:a,cloneUrl:a,canonicalId:`git:${i.authority.toLowerCase()}/${c}`,cacheSegments:[n,...l],kind:"gitUri",githubRepo:u}}function man(a){let i=/^([^@\s]+)@([^:\s]+):(.+\.git)$/i.exec(a);if(!i)return;let e=".git",t=i[2],o=i[3].replace(/^\/+/,"");if(!o.toLowerCase().endsWith(e))return;let n=o.slice(0,-e.length),r=n.split("/").map(eqt),s=_yo(t,n);return{rawValue:a,displayLabel:a,cloneUrl:a,canonicalId:`git:${t.toLowerCase()}/${o.toLowerCase()}`,cacheSegments:[eqt(t.toLowerCase()),...r],kind:"gitUri",githubRepo:s}}function han(a){let i=".git",e=a.replace(/\/+/g,"/").replace(/\/+$/g,""),t=e.startsWith("/")?e:`/${e}`,o=t.toLowerCase().endsWith(i)?t.slice(1,t.length-i.length):t.slice(1);if(!(!o||!o.includes("/")))return t}function _yo(a,i){if(a.toLowerCase()!=="github.com")return;let e=i.split("/");if(e.length>=2&&e[0]&&e[1])return`${e[0]}/${e[1]}`}function gan(a,i){return`github:${a.toLowerCase()}/${i.toLowerCase()}`}function eqt(a){return a.replace(/[\\/:*?"<>|]/g,"_")}var Dyo="settings.json",Lyo="settings.local.json",fan=".github/copilot",iqt=le("workspacePluginSettingsService");function van(a){let i,e,t;if(typeof a.source=="object"&&a.source!==null){let o=a.source;i=o.source,e=o.repo,t=o.url}else i=a.source,e=a.repo,t=a.url;if(i==="github"&&typeof e=="string")return Fy(e);if(i==="git"&&typeof t=="string")return Fy(t)}function ban(a){let i=new Map;if(!a||typeof a!="object"||Array.isArray(a))return i;let e=a;for(let[t,o]of Object.entries(e))typeof o=="boolean"&&i.set(t,o);return i}function San(a,i,e){let t=[];if(!a||typeof a!="object"||Array.isArray(a))return t;let o=a;for(let[n,r]of Object.entries(o)){if(!r||typeof r!="object"){e.debug(`${i} Ignoring non-object extraKnownMarketplaces entry: ${n}`);continue}let s=van(r);if(!s){e.debug(`${i} Could not parse marketplace reference for: ${n}`);continue}t.push({name:n,reference:{...s,displayLabel:n}})}return t}var Ian={marketplaces:[],enabledPlugins:new Map},tqt=class extends x{constructor(e,t,o,n,r){super();this._logService=r;this._data=Me("data",Ian);this.data=this._data;let s=ui(this,n.onDidChangeWorkspaceFolders,()=>n.getWorkspace().folders.map(c=>Ge(c.uri,e))),l=this._register(new N);this._register(be(c=>{let u=s.read(c);l.clear();let p=new Dt(()=>this._readSettings(u,t,o),100);l.add(p);for(let h of u){let g=o.createWatcher(h,{recursive:!1,excludes:[]});l.add(g),l.add(g.onDidChange(f=>{(f.affects(Ge(h,Dyo))||f.affects(Ge(h,Lyo)))&&p.schedule()}))}this._readSettings(u,t,o)}))}async _readSettings(e,t,o){let n=[],r=new Map;for(let s of e){let l=Ge(s,Dyo),c=Ge(s,Lyo);for(let u of[l,c])try{let p=await o.readFile(u),h=jr(p.value.toString());if(!h||typeof h!="object")continue;let g=h,f=San(g.extraKnownMarketplaces,t,this._logService);for(let b of f)n.some(S=>S.reference.canonicalId===b.reference.canonicalId)||n.push(b);let v=ban(g.enabledPlugins);for(let[b,S]of v)r.set(b,S)}catch{this._logService.debug(`${t} Could not read ${u.toString()}`)}}this._data.set({marketplaces:n,enabledPlugins:r},void 0)}},mWe=class extends x{constructor(i,e,t){super();let o=this._register(new tqt(Y6e,"[ClaudePluginSettings]",i,e,t)),n=this._register(new tqt(fan,"[CopilotPluginSettings]",i,e,t));this.extraMarketplaces=ke(r=>{let s=o.data.read(r).marketplaces,l=n.data.read(r).marketplaces,c=new Map;for(let u of[...s,...l])c.has(u.reference.canonicalId)||c.set(u.reference.canonicalId,u);return[...c.values()]}),this.enabledPlugins=ke(r=>{let s=o.data.read(r).enabledPlugins,l=n.data.read(r).enabledPlugins,c=new Map;for(let[u,p]of s)c.set(u,p);for(let[u,p]of l)c.has(u)||c.set(u,p);return c})}};mWe=I([m(0,fe),m(1,Pe),m(2,se)],mWe);var Zk=le("pluginMarketplaceService"),yan=[{type:"openPlugin",path:"marketplace.json"},{type:"openPlugin",path:".plugin/marketplace.json"},{type:"copilot",path:".github/plugin/marketplace.json"},{type:"claude",path:".claude-plugin/marketplace.json"}],wan=480*60*1e3,uPi="chat.plugins.marketplaces.githubCache.v1",Ryo=1440*60*1e3,Myo="chat.plugins.lastUpdateCheck.v1";function Pyo(a){return a.sourceDescriptor?a:{...a,sourceDescriptor:{kind:"relativePath",path:a.source}}}var Can=rN({defaultValue:[],key:"chat.plugins.trustedMarketplaces.v1",toStorage:a=>JSON.stringify(a),fromStorage:a=>{let i=JSON.parse(a);return Array.isArray(i)?i:[]}}),xan=rN({defaultValue:{plugins:[],fetchedAt:0},key:"chat.plugins.lastFetchedPlugins.v2",toStorage:a=>JSON.stringify(a),fromStorage:a=>{let i=JSON.parse(a);return i&&Array.isArray(i.plugins)?i:{plugins:[],fetchedAt:0}}}),hWe=class extends x{constructor(e,t,o,n,r,s,l,c,u){super();this._configurationService=e;this._requestService=t;this._fileService=n;this._pluginRepositoryService=r;this._logService=s;this._storageService=l;this._workspacePluginSettingsService=c;this._workspaceTrustService=u;this._gitHubMarketplaceCache=new co(()=>this._loadPersistedGitHubMarketplaceCache());this._pluginMetadata=new Map;this._hasUpdatesAvailable=Me("hasUpdatesAvailable",!1);this.hasUpdatesAvailable=this._hasUpdatesAvailable;let p=Ge(o.cacheHome,"agentPlugins");this._installedPluginsStore=this._register(new ZGt(r.agentPluginsHome,p,n,s,l)),this._trustedMarketplacesStore=this._register(Can(-1,1,l)),this._lastFetchedPluginsStore=this._register(xan(-1,1,l)),this.lastFetchedPlugins=this._lastFetchedPluginsStore.map(g=>$n(g).plugins.map(Pyo)),this.installedPlugins=this._installedPluginsStore.value.map(g=>{let f=[];for(let v of g){let b=this._pluginMetadata.get(v.pluginUri.toString());b&&f.push({pluginUri:v.pluginUri,plugin:b})}return f});let h=ui(this,this._workspaceTrustService.onDidChangeTrust,()=>this._workspaceTrustService.isWorkspaceTrusted());this.recommendedPlugins=ke(g=>{if(!h.read(g))return new Set;let f=this._workspacePluginSettingsService.enabledPlugins.read(g),v=new Set;for(let[b,S]of f)S&&v.add(b);return v}),this.onDidChangeMarketplaces=U.any(U.filter(e.onDidChangeConfiguration,g=>g.affectsConfiguration("chat.plugins.enabled")||g.affectsConfiguration("chat.plugins.marketplaces")),U.fromObservableLight(this._workspacePluginSettingsService.extraMarketplaces),U.map(this._workspaceTrustService.onDidChangeTrust,()=>{})),this._register(PL(()=>{this._scheduleUpdateCheck(),this._register(U.filter(e.onDidChangeConfiguration,g=>g.affectsConfiguration(Fw))(()=>this._scheduleUpdateCheck()))})),this._register(be(g=>{let v=this._installedPluginsStore.value.read(g).filter(b=>!this._pluginMetadata.has(b.pluginUri.toString()));v.length>0&&this._hydratePluginMetadata(v)}))}dispose(){this._updateCheckTimer!==void 0&&(clearTimeout(this._updateCheckTimer),this._updateCheckTimer=void 0),super.dispose()}clearUpdatesAvailable(){this._hasUpdatesAvailable.set(!1,void 0)}async fetchMarketplacePlugins(e){if(!this._configurationService.getValue("chat.plugins.enabled"))return[];let t=this._configurationService.getValue("chat.plugins.marketplaces")??[],o=LQ(t),n;if(this._workspaceTrustService.isWorkspaceTrusted()){let l=this._workspacePluginSettingsService.extraMarketplaces.get();n=dPi(l.map(c=>c.reference),o)}else n=o;for(let l of t)(typeof l!="string"||!Fy(l))&&this._logService.debug(`[PluginMarketplaceService] Ignoring invalid marketplace entry: ${String(l)}`);let s=(await Promise.all(n.map(l=>l.kind==="githubShorthand"&&l.githubRepo?this._fetchFromGitHubRepo(l,l.githubRepo,e):this._fetchFromClonedRepo(l,e)))).flat();return this._lastFetchedPluginsStore.set({plugins:s,fetchedAt:Date.now()},void 0),s}async _fetchFromGitHubRepo(e,t,o){let n=this._gitHubMarketplaceCache.value,r=this._getCachedGitHubMarketplacePlugins(n,e.canonicalId);if(r)return r.map(c=>({...c,marketplace:e.displayLabel,marketplaceReference:e}));let s=!0,l=await this._readPluginsFromDefinitions(e,async c=>{if(o.isCancellationRequested)return;let u=`https://raw.githubusercontent.com/${t}/main/${c}`;try{let p=await this._requestService.request({type:"GET",url:u,callSite:"pluginMarketplaceService.fetchPluginList"},o),h=p.res.statusCode;if(h!==200){s&&=h!==void 0&&h>=400&&h<500,this._logService.debug(`[PluginMarketplaceService] ${u} returned status ${h}, skipping`);return}return await If(p)??void 0}catch(p){this._logService.debug(`[PluginMarketplaceService] Failed to fetch marketplace.json from ${u}:`,p);return}});return l.length>0?(n.set(e.canonicalId,{plugins:l,expiresAt:Date.now()+wan,referenceRawValue:e.rawValue}),this._savePersistedGitHubMarketplaceCache(n),l):s?(this._logService.debug(`[PluginMarketplaceService] ${t} may be private, attempting clone-based marketplace discovery`),this._fetchFromClonedRepo(e,o)):(this._logService.debug(`[PluginMarketplaceService] No marketplace.json found in ${t}`),[])}_getCachedGitHubMarketplacePlugins(e,t){let o=e.get(t);if(o){if(o.expiresAt<=Date.now()){e.delete(t),this._savePersistedGitHubMarketplaceCache(e);return}return[...o.plugins]}}_loadPersistedGitHubMarketplaceCache(){let e=new Map,t=Date.now(),o=this._storageService.getObject(uPi,-1);if(!o)return e;let n=$n(o);for(let[r,s]of Object.entries(n)){if(!s||!Array.isArray(s.plugins)||typeof s.expiresAt!="number"||s.expiresAt<=t||typeof s.referenceRawValue!="string")continue;let l=Fy(s.referenceRawValue);if(!l)continue;let c=s.plugins.map(u=>Pyo({...u,marketplace:l.displayLabel,marketplaceReference:l}));e.set(r,{plugins:c,expiresAt:s.expiresAt,referenceRawValue:s.referenceRawValue})}return e}_savePersistedGitHubMarketplaceCache(e){let t={};for(let[o,n]of e)!n.plugins.length||n.expiresAt<=Date.now()||(t[o]={expiresAt:n.expiresAt,referenceRawValue:n.referenceRawValue,plugins:n.plugins});if(Object.keys(t).length===0){this._storageService.remove(uPi,-1);return}this._storageService.store(uPi,JSON.stringify(t),-1,1)}getMarketplacePluginMetadata(e){return this._pluginMetadata.get(e.toString())??[...this._pluginMetadata.entries()].find(([t])=>ws(e,A.parse(t)))?.[1]}addInstalledPlugin(e,t){this._pluginMetadata.set(e.toString(),t);let o=this._installedPluginsStore.get(),n=o.find(r=>Qe(r.pluginUri,e));n?this._installedPluginsStore.set(o.map(r=>r===n?{pluginUri:e,marketplace:t.marketplaceReference.rawValue}:r),void 0):this._installedPluginsStore.set([...o,{pluginUri:e,marketplace:t.marketplaceReference.rawValue}],void 0)}removeInstalledPlugin(e){this._pluginMetadata.delete(e.toString());let t=this._installedPluginsStore.get();this._installedPluginsStore.set(t.filter(o=>!Qe(o.pluginUri,e)),void 0)}isMarketplaceTrusted(e){return this._trustedMarketplacesStore.get().includes(e.canonicalId)}async _hydratePluginMetadata(e){let t=0;for(let o of e){let n=o.pluginUri.toString();if(this._pluginMetadata.has(n))continue;let r=Fy(o.marketplace);if(!r){this._logService.debug(`[PluginMarketplaceService] Cannot parse marketplace reference '${o.marketplace}' for ${n}`);continue}try{let s=this._pluginRepositoryService.getRepositoryUri(r),c=(await this._readPluginsFromDirectory(s,r)).find(u=>{let p=this._pluginRepositoryService.getPluginInstallUri(u);return Qe(p,o.pluginUri)});c&&(this._pluginMetadata.set(n,c),t++)}catch(s){this._logService.debug(`[PluginMarketplaceService] Failed to hydrate metadata for ${n}:`,s)}}if(t>0){let o=this._installedPluginsStore.get();this._installedPluginsStore.set([...o],void 0)}}_parseMarketplacePlugins(e,t,o,n){return!e.plugins||!Array.isArray(e.plugins)?[]:e.plugins.filter(r=>typeof r.name=="string"&&!!r.name).flatMap(r=>{let s=kan(r.source,e.metadata?.pluginRoot,{pluginName:r.name,logService:this._logService,logPrefix:"[PluginMarketplaceService]"});if(!s)return[];let l=s.kind==="relativePath"?s.path:"";return[{name:r.name,description:r.description??"",version:r.version??"",source:l,sourceDescriptor:s,marketplace:t.displayLabel,marketplaceReference:t,marketplaceType:o,readmeUri:n?_an(n,l):Tan(t.githubRepo??"",l)}]})}trustMarketplace(e){let t=this._trustedMarketplacesStore.get();t.includes(e.canonicalId)||this._trustedMarketplacesStore.set([...t,e.canonicalId],void 0)}_isAutoUpdateEnabled(){return this._configurationService.getValue(Fw)}_scheduleUpdateCheck(){if(this._updateCheckTimer!==void 0&&(clearTimeout(this._updateCheckTimer),this._updateCheckTimer=void 0),!this._isAutoUpdateEnabled())return;let e=this._storageService.getNumber(Myo,-1,0),t=Date.now()-e,o=Math.max(0,Ryo-t);this._updateCheckTimer=setTimeout(()=>this._runUpdateCheck(),o)}async _runUpdateCheck(){this._updateCheckTimer=void 0;try{let e=this.installedPlugins.get();if(e.length===0)return;let t=new Set,o=!1;for(let n of e){let r=n.plugin.marketplaceReference;if(!t.has(r.canonicalId)){t.add(r.canonicalId);try{if(await this._pluginRepositoryService.fetchRepository(r)){o=!0;break}}catch(s){this._logService.debug(`[PluginMarketplaceService] Update check failed for ${r.displayLabel}:`,s)}}}this._hasUpdatesAvailable.set(o,void 0),this._storageService.store(Myo,Date.now(),-1,1)}catch(e){this._logService.debug("[PluginMarketplaceService] Periodic update check failed:",e)}finally{this._isAutoUpdateEnabled()&&(this._updateCheckTimer=setTimeout(()=>this._runUpdateCheck(),Ryo))}}async _fetchFromClonedRepo(e,t){let o;try{o=await this._pluginRepositoryService.ensureRepository(e)}catch(n){return this._logService.debug(`[PluginMarketplaceService] Failed to prepare marketplace repository ${e.rawValue}:`,n),[]}return this._readPluginsFromDirectory(o,e,t)}async readPluginsFromDirectory(e,t){return this._readPluginsFromDirectory(e,t)}async _readPluginsFromDirectory(e,t,o){return this._readPluginsFromDefinitions(t,async n=>{if(o?.isCancellationRequested)return;let r=Ge(e,n);try{let s=await this._fileService.readFile(r);return jr(s.value.toString())}catch{return}},e)}async _readPluginsFromDefinitions(e,t,o){for(let n of yan){let r=await t(n.path);if(!(!r?.plugins||!Array.isArray(r.plugins)))return this._parseMarketplacePlugins(r,e,n.type,o)}return this._logService.debug(`[PluginMarketplaceService] No marketplace.json found in ${e.rawValue}`),[]}};hWe=I([m(0,B),m(1,Ea),m(2,Eo),m(3,fe),m(4,aq),m(5,se),m(6,ce),m(7,iqt),m(8,Nr)],hWe);function Ayo(a){let i=a.trim().replace(/\\/g,"/");return i=i.replace(/^\.?\/+/,"").replace(/\/+$/g,""),i}function Nyo(a,i){let e=a?Ayo(a):"",t=Ayo(i),o=A.file("/"),n=e?F$(Ge(o,e)):o;if(e&&(t===e||t.startsWith(`${e}/`)))return t;let r=F$(Ge(n,t));return Wd(o,r)??void 0}function kan(a,i,e){if(a==null){let t=Nyo(i,"");return t===void 0?void 0:{kind:"relativePath",path:t}}if(typeof a=="string"){let t=Nyo(i,a);return t===void 0?void 0:{kind:"relativePath",path:t}}if(typeof a!="object"||typeof a.source!="string"){e.logService.warn(`${e.logPrefix} Skipping plugin '${e.pluginName}': source object is missing a 'source' discriminant`);return}switch(a.source){case"github":{if(typeof a.repo!="string"||!a.repo){e.logService.warn(`${e.logPrefix} Skipping plugin '${e.pluginName}': github source is missing required 'repo' field`);return}if(!Ean(a.repo)){e.logService.warn(`${e.logPrefix} Skipping plugin '${e.pluginName}': github source repo must be in 'owner/repo' format`);return}if(!afe(a.ref)){e.logService.warn(`${e.logPrefix} Skipping plugin '${e.pluginName}': github source 'ref' must be a string when provided`);return}if(!Oyo(a.sha)){e.logService.warn(`${e.logPrefix} Skipping plugin '${e.pluginName}': github source 'sha' must be a full 40-character commit hash when provided`);return}if(!afe(a.path)){e.logService.warn(`${e.logPrefix} Skipping plugin '${e.pluginName}': github source 'path' must be a string when provided`);return}return{kind:"github",repo:a.repo,ref:a.ref,sha:a.sha,path:a.path}}case"url":{if(typeof a.url!="string"||!a.url){e.logService.warn(`${e.logPrefix} Skipping plugin '${e.pluginName}': url source is missing required 'url' field`);return}if(!a.url.toLowerCase().endsWith(".git")){e.logService.warn(`${e.logPrefix} Skipping plugin '${e.pluginName}': url source must end with '.git'`);return}if(!afe(a.ref)){e.logService.warn(`${e.logPrefix} Skipping plugin '${e.pluginName}': url source 'ref' must be a string when provided`);return}if(!Oyo(a.sha)){e.logService.warn(`${e.logPrefix} Skipping plugin '${e.pluginName}': url source 'sha' must be a full 40-character commit hash when provided`);return}return{kind:"url",url:a.url,ref:a.ref,sha:a.sha}}case"npm":{if(typeof a.package!="string"||!a.package){e.logService.warn(`${e.logPrefix} Skipping plugin '${e.pluginName}': npm source is missing required 'package' field`);return}if(!afe(a.version)||!afe(a.registry)){e.logService.warn(`${e.logPrefix} Skipping plugin '${e.pluginName}': npm source 'version' and 'registry' must be strings when provided`);return}return{kind:"npm",package:a.package,version:a.version,registry:a.registry}}case"pip":{if(typeof a.package!="string"||!a.package){e.logService.warn(`${e.logPrefix} Skipping plugin '${e.pluginName}': pip source is missing required 'package' field`);return}if(!afe(a.version)||!afe(a.registry)){e.logService.warn(`${e.logPrefix} Skipping plugin '${e.pluginName}': pip source 'version' and 'registry' must be strings when provided`);return}return{kind:"pip",package:a.package,version:a.version,registry:a.registry}}default:e.logService.warn(`${e.logPrefix} Skipping plugin '${e.pluginName}': unknown source kind '${a.source}'`);return}}function afe(a){return a===void 0||typeof a=="string"}function Oyo(a){return a===void 0||typeof a=="string"&&/^[0-9a-fA-F]{40}$/.test(a)}function Ean(a){return/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/.test(a)}function gWe(a,i){if(a.kind!==i.kind)return!0;switch(a.kind){case"github":return a.ref!==i.ref||a.sha!==i.sha||a.path!==i.path;case"url":return a.ref!==i.ref||a.sha!==i.sha;case"npm":return a.version!==i.version;case"pip":return a.version!==i.version;default:return!1}}function Tan(a,i){let e=i.trim().replace(/^\.?\/+|\/+$/g,""),t=e?`${e}/README.md`:"README.md";return A.parse(`https://github.com/${a}/blob/main/${t}`)}function _an(a,i){let e=i.trim().replace(/^\.?\/+|\/+$/g,"");return e?Ge(a,e,"README.md"):Ge(a,"README.md")}var Dan=Ae("agent-plugin-editor-icon",R.extensions,d(6003,null));function pPi(a){return a.kind==="installed"?a.plugin.uri.toString():`${a.marketplaceReference.canonicalId}/${a.source}`}var lq=class a extends ls{constructor(e){super();this._item=e}static{this.ID="workbench.agentPlugin.input"}get typeId(){return a.ID}get capabilities(){return super.capabilities|8|2048}get resource(){return A.from({scheme:Q.extension,path:`/agentPlugin/${encodeURIComponent(pPi(this._item))}`})}get item(){return this._item}getName(){return d(6004,null,this._item.name)}getIcon(){return Dan}matches(e){return super.matches(e)?!0:e instanceof a&&pPi(this._item)===pPi(e._item)}};function Lan(a,i,e){return[new it(`${e}.enable`,d(7370,null),void 0,!0,()=>(i.setEnabled(a,2),Promise.resolve())),new it(`${e}.enableForWorkspace`,d(7371,null),void 0,!0,()=>(i.setEnabled(a,3),Promise.resolve())),new it(`${e}.disable`,d(7368,null),void 0,!0,()=>(i.setEnabled(a,0),Promise.resolve())),new it(`${e}.disableForWorkspace`,d(7369,null),void 0,!0,()=>(i.setEnabled(a,1),Promise.resolve()))]}function Fyo(a,i,e,t,o){let n=t.getWorkbenchState()!==1,[r,s,l,c]=Lan(i,e,o),u=[];return gN(a)?(u.push(r),n&&u.push(s)):(u.push(l),n&&u.push(c)),u}var RQ=class extends it{constructor(i,e){super("agentPlugin.install",d(5996,null),"extension-action label prominent install",!0,()=>e.installPlugin({name:i.name,description:i.description,version:"",source:i.source,sourceDescriptor:i.sourceDescriptor,marketplace:i.marketplace,marketplaceReference:i.marketplaceReference,marketplaceType:i.marketplaceType,readmeUri:i.readmeUri}))}};RQ=I([m(1,Oy)],RQ);var Brt=class extends it{constructor(i){super("agentPlugin.uninstall",d(5999,null),"extension-action label uninstall",!0,()=>(i.remove(),Promise.resolve()))}},Vrt=class extends it{constructor(i,e,t){super("agentPlugin.openFolder",d(5997,null),void 0,!0,async()=>{try{await e.executeCommand("revealFileInOS",i.uri)}catch{await t.open(ci(i.uri))}})}};Vrt=I([m(1,ge),m(2,Je)],Vrt);var lfe=class extends it{constructor(i,e){super("agentPlugin.openReadme",d(5998,null),void 0,!0,()=>e.open(i))}};lfe=I([m(1,Je)],lfe);function Hrt(a,i){return i.invokeFunction(e=>{let t=e.get(Gg),o=e.get(Pe),n=[];return n.push(Fyo(a.enablement.get(),a.uri.toString(),t.enablementModel,o,"agentPlugin")),n.push([i.createInstance(Vrt,a),i.createInstance(lfe,Ge(a.uri,"README.md"))]),a.fromMarketplace&&n.push([new Brt(a)]),n})}var vWe=class extends it{get hidden(){return this._hidden}set hidden(i){this._hidden=i}constructor(i,e,t,o,n){super(i,e,t,o,n),this._hidden=!o}_setEnabled(i){super._setEnabled(i),this.hidden=!i}},bWe=class extends it{constructor(e,t){super(e,void 0,"extension-action label action-dropdown");this.menuActionClassNames=["extension-action","label","action-dropdown"];this._menuActions=[];this._isHidden=!1;this._onDidChange=new E;this.subActions=t;for(let o of t)o.onDidChange(()=>this._updateDropdown());this._updateDropdown()}get menuActions(){return[...this._menuActions]}get isHidden(){return this._isHidden}get onDidChange(){return this._onDidChange.event}_updateDropdown(){let e=this.subActions.filter(o=>!o.hidden),t=e[0];this._menuActions=e.length>1?[...e]:[],t?(this._isHidden=!1,this.enabled=!0,this.label=t.label,this.tooltip=t.tooltip):(this._isHidden=!0,this.enabled=!1),this._onDidChange.fire({menuActions:this._menuActions})}async run(){await this.subActions.find(t=>!t.hidden)?.run()}dispose(){for(let e of this.subActions)e.dispose();super.dispose()}},nqt=class extends IY{constructor(i,e,t){super(null,i,e,t),this._register(i.onDidChange(o=>{No(o,{menuActions:!0})&&this.updateClass()}))}render(i){super.render(i),this.updateClass()}updateClass(){if(super.updateClass(),this.element&&this.dropdownMenuActionViewItem?.element){let i=this._action;this.element.classList.toggle("hide",i.isHidden);let e=i.menuActions.length===0;this.element.classList.toggle("empty",e),this.dropdownMenuActionViewItem.element.classList.toggle("hide",e)}}};function Wyo(a,i,e){let t=a.uri.toString(),o=e.getWorkbenchState()!==1,n=new vWe("agentPlugin.enable",d(5994,null),"extension-action label prominent",gN(a.enablement.get()),()=>(i.setEnabled(t,2),Promise.resolve())),r=new vWe("agentPlugin.enableForWorkspace",d(5995,null),"extension-action label",gN(a.enablement.get())&&o,()=>(i.setEnabled(t,3),Promise.resolve()));return new bWe("agentPlugin.enableDropdown",[n,r])}function Vyo(a,i,e){let t=a.uri.toString(),o=e.getWorkbenchState()!==1,n=new vWe("agentPlugin.disable",d(5992,null),"extension-action label disable",Ub(a.enablement.get()),()=>(i.setEnabled(t,0),Promise.resolve())),r=new vWe("agentPlugin.disableForWorkspace",d(5993,null),"extension-action label disable",Ub(a.enablement.get())&&o,()=>(i.setEnabled(t,1),Promise.resolve()));return new bWe("agentPlugin.disableDropdown",[n,r])}var mPi=new Y("hasInstalledAgentPlugins",!1),pfe="workbench.views.agentPlugins.installed";function Ran(a,i,e){let t=a.label,o=a.fromMarketplace?.description??i.getUriLabel(ci(a.uri),{relative:!0}),n=a.fromMarketplace?.marketplace;return{kind:"installed",name:t,description:o,marketplace:n,plugin:a,outdated:e}}function Man(a){return{kind:"marketplace",name:a.name,description:a.description,source:a.source,sourceDescriptor:a.sourceDescriptor,marketplace:a.marketplace,marketplaceReference:a.marketplaceReference,marketplaceType:a.marketplaceType,readmeUri:a.readmeUri}}var cfe=class extends it{constructor(e,t,o,n){super(cfe.ID,d(6020,null),"extension-action label prominent install");this.plugin=e;this.liveMarketplacePlugin=t;this.pluginInstallService=o;this.pluginMarketplaceService=n}static{this.ID="agentPlugin.update"}async run(){await this.pluginInstallService.updatePlugin(this.liveMarketplacePlugin)&&this.pluginMarketplaceService.addInstalledPlugin(this.plugin.uri,this.liveMarketplacePlugin)}};cfe=I([m(2,Oy),m(3,Zk)],cfe);var MQ=class extends it{constructor(e,t){super(MQ.ID,"",MQ.CLASS,!0);this.getActionGroups=e;this.instantiationService=t;this._actionViewItem=null;this.tooltip=d(6018,null)}static{this.ID="agentPlugin.manage"}static{this.CLASS=`extension-action icon manage ${q.asClassName(ihe)}`}createActionViewItem(e){return this._actionViewItem=this.instantiationService.createInstance(Urt,this,e),this._actionViewItem}async run(){this._actionViewItem?.showMenu(this.getActionGroups())}};MQ=I([m(1,F)],MQ);var Urt=class extends hs{constructor(e,t,o){super(null,e,{...t,icon:!0,label:!1});this.contextMenuService=o}showMenu(e){if(!this.element)return;let t=e.flatMap(s=>[...s,new ri]);t.length>0&&t.pop();let{left:o,top:n,height:r}=ir(this.element);this.contextMenuService.showContextMenu({getAnchor:()=>({x:o,y:n+r+10}),getActions:()=>t,onHide:()=>a1(t)})}};Urt=I([m(2,Xe)],Urt);var boe=class{constructor(i){this.instantiationService=i;this.templateId=boe.templateId}static{this.templateId="agentPlugin"}renderTemplate(i){let e=M(i,_(".agent-plugin-item.extension-list-item")),t=M(e,_(".details")),o=M(t,_(".header-container")),n=M(o,_(".header")),r=M(n,_("span.name")),s=M(t,_(".description.ellipsis")),l=M(t,_(".footer")),c=M(l,_(".publisher-container")),u=M(c,_("span.publisher-name")),p=new Zi(l,{focusOnlyEnabledItems:!0,actionViewItemProvider:(h,g)=>{if(h instanceof MQ)return h.createActionViewItem(g)}});return p.setFocusable(!1),{root:i,name:r,description:s,detail:u,actionbar:p,disposables:[p],elementDisposables:[]}}renderPlaceholder(i,e){e.name.textContent="",e.description.textContent="",e.detail.textContent="",e.actionbar.clear(),this.disposeElement(void 0,0,e)}renderElement(i,e,t){this.disposeElement(void 0,0,t),t.name.textContent=i.name,t.description.textContent=i.description,t.elementDisposables.push(be(n=>{t.root.classList.toggle("disabled",i.kind==="installed"&&!Ub(i.plugin.enablement.read(n)))}));let o=n=>{if(t.actionbar.clear(),i.kind==="marketplace"){t.detail.textContent=i.marketplace;let r=this.instantiationService.createInstance(RQ,i);n.store.add(r),t.actionbar.push([r],{icon:!0,label:!0})}else{t.detail.textContent=i.marketplace??"";let r=[],s=i.outdated?.read(n);if(s){let c=this.instantiationService.createInstance(cfe,i.plugin,s);n.store.add(c),r.push(c)}let l=this.instantiationService.createInstance(MQ,()=>Hrt(i.plugin,this.instantiationService));n.store.add(l),r.push(l),t.actionbar.push(r,{icon:!0,label:!0})}};t.elementDisposables.push(be(o))}disposeElement(i,e,t){for(let o of t.elementDisposables)o.dispose();t.elementDisposables=[]}disposeTemplate(i){for(let e of i.disposables)e.dispose();this.disposeElement(void 0,0,i)}};boe=I([m(0,F)],boe);var dfe=class extends _Q{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super(t,o,n,c,u,p,r,h,s,l);this.listOptions=e;this.agentPluginService=g;this.pluginMarketplaceService=f;this.pluginInstallService=v;this.labelService=b;this.editorService=S;this.actionStore=this._register(new N);this.queryCts=new me;this.list=null;this.listContainer=null;this.currentQuery="@agentPlugins";this.refreshOnPluginsChangedScheduler=this._register(new Dt(()=>{this.list&&this.show(this.currentQuery)},0));this._register(be(y=>{let w=this.agentPluginService.plugins.read(y);for(let k of w)k.enablement.read(y);this.list&&this.isBodyVisible()&&this.refreshOnPluginsChangedScheduler.schedule()})),this._register(this.pluginMarketplaceService.onDidChangeMarketplaces(()=>{this.list&&this.isBodyVisible()&&this.refreshOnPluginsChangedScheduler.schedule()}))}renderBody(e){super.renderBody(e);let t=M(e,_(".message-container")),o=M(t,_(".message")),n=_(".agent-plugins-list");this.bodyTemplate={pluginsList:n,messageBox:o,messageContainer:t},this.listContainer=M(e,n),this.list=this._register(this.instantiationService.createInstance(Qz,`${this.id}-Agent-Plugins`,this.listContainer,{getHeight(){return 72},getTemplateId:()=>boe.templateId},[this.instantiationService.createInstance(boe)],{multipleSelectionSupport:!1,setRowLineHeight:!1,horizontalScrolling:!1,accessibilityProvider:{getAriaLabel(r){return r?.name??""},getWidgetAriaLabel(){return d(6012,null)}},overrideStyles:h2(this.viewDescriptorService.getViewLocationById(this.id)).listOverrideStyles})),this._register(this.list.onContextMenu(r=>this.onContextMenu(r),this)),this._register(U.debounce(U.filter(this.list.onDidOpen,r=>r.element!==null),(r,s)=>s,75,!0)(r=>{this.editorService.openEditor(this.instantiationService.createInstance(lq,r.element),r.editorOptions)}))}onContextMenu(e){if(!e.element)return;let t=this.getContextMenuActions(e.element);t.length!==0&&this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>t})}getContextMenuActions(e){let t;e.kind==="installed"?(t=Hrt(e.plugin,this.instantiationService).flatMap(n=>[...n,new ri]),t.length>0&&t.pop()):(t=[],e.readmeUri&&t.push(this.instantiationService.createInstance(lfe,e.readmeUri)),t.push(this.instantiationService.createInstance(RQ,e))),this.actionStore.clear();for(let o of t)jc(o)&&this.actionStore.add(o);return t}layoutBody(e,t){super.layoutBody(e,t),this.list?.layout(e,t)}async show(e){this.currentQuery=e;let t=e.replace(/@agentPlugins/i,"").trim(),o=/^@recommended$/i.test(t),n=/(?:^|\s)@installed(?:\s|$)/i.test(t),r=o?"":t.replace(/(?:^|\s)@installed(?:\s|$)/gi," ").trim().toLowerCase(),s=this.queryInstalled();if(r&&(s=s.filter(u=>u.name.toLowerCase().includes(r)||u.description.toLowerCase().includes(r)||(u.marketplace??"").toLowerCase().includes(r))),o){let u=this.pluginMarketplaceService.recommendedPlugins.get();s=s.filter(p=>{let h=p.plugin.fromMarketplace;if(!h)return!1;let g=`${h.name}@${h.marketplace}`;return u.has(g)})}let l=s;if(!this.listOptions.installedOnly&&!n){let p=await this.queryMarketplacePlugins();if(o){let v=this.pluginMarketplaceService.recommendedPlugins.get();p=p.filter(b=>{let S=`${b.name}@${b.marketplace}`;return v.has(S)})}else{let v=r.toLowerCase();p=p.filter(b=>b.name.toLowerCase().includes(v)||b.description.toLowerCase().includes(v)||b.marketplace.toLowerCase().includes(v))}let h=p.map(Man),g=new Set(s.map(v=>v.plugin.uri.toString())),f=h.filter(v=>{let b=this.pluginInstallService.getPluginInstallUri({name:v.name,description:v.description,version:"",source:v.source,sourceDescriptor:v.sourceDescriptor,marketplace:v.marketplace,marketplaceReference:v.marketplaceReference,marketplaceType:v.marketplaceType});return!g.has(b.toString())});l=[...s,...f]}let c=new Wm(l);return this.list&&(this.list.model=c),this.updateBody(c.length),c}queryInstalled(){let e=ke(o=>{let n=this.pluginMarketplaceService.lastFetchedPlugins.read(o),r=new Map;for(let l of n)r.set(`${l.marketplaceReference.canonicalId}::${l.name}`,l);let s=new Map;for(let l of this.pluginMarketplaceService.installedPlugins.read(o))s.set(l.pluginUri.toString(),l.plugin);return{marketplaceByKey:r,installedByUri:s}});return this.agentPluginService.plugins.get().map(o=>{let n=ke(r=>{let{marketplaceByKey:s,installedByUri:l}=e.read(r),c=l.get(o.uri.toString())??o.fromMarketplace;if(c){let u=`${c.marketplaceReference.canonicalId}::${c.name}`,p=s.get(u);if(p&&gWe(c.sourceDescriptor,p.sourceDescriptor))return p}});return Ran(o,this.labelService,n)})}async queryMarketplacePlugins(){this.queryCts.value?.cancel();let e=new Ye;this.queryCts.value=e;try{return await this.pluginMarketplaceService.fetchMarketplacePlugins(e.token)}catch{return[]}}updateBody(e){this.bodyTemplate&&(this.bodyTemplate.pluginsList.classList.toggle("hidden",e===0),this.bodyTemplate.messageContainer.classList.toggle("hidden",e>0),e===0&&this.isBodyVisible()&&(this.bodyTemplate.messageBox.textContent=d(6019,null)))}};dfe=I([m(2,_e),m(3,Xe),m(4,F),m(5,Le),m(6,nt),m(7,B),m(8,X),m(9,Bi),m(10,Je),m(11,Gg),m(12,Zk),m(13,Oy),m(14,rt),m(15,ee)],dfe);var hPi=class extends K{constructor(){super({id:"workbench.agentPlugins.browse",title:L(6013,"Agent Plugins"),tooltip:L(6014,"Browse Agent Plugins"),icon:R.search,precondition:ie.Setup.hidden.negate(),menu:[{id:mg,group:"1_predefined",order:2,when:ie.Setup.hidden.negate()},{id:D.ViewTitle,when:C.and(C.equals("view",pfe),ie.Setup.hidden.negate()),group:"navigation"}]})}async run(i){i.get(Hi).openSearch("@agentPlugins ")}},gPi=class extends K{constructor(){super({id:"workbench.agentPlugins.checkForUpdates",title:L(6015,"Update Plugins"),category:L(6017,"Chat"),precondition:ie.enabled,f1:!0})}async run(i){await i.get(Oy).updateAllPlugins({},Se.None)}},fPi=class extends K{constructor(){super({id:"workbench.agentPlugins.forceUpdate",title:L(6016,"Update Plugins (Force)"),category:L(6017,"Chat"),precondition:ie.enabled,f1:!0})}async run(i){await i.get(Oy).updateAllPlugins({force:!0},Se.None)}},ufe=class extends x{static{this.ID="workbench.chat.agentPlugins.views.contribution"}constructor(i,e){super();let t=mPi.bindTo(i);this._register(be(o=>{t.set(e.plugins.read(o).length>0)})),W(hPi),W(gPi),W(fPi),ne.as(Mn.ViewsRegistry).registerViews([{id:pfe,name:L(6011,"Agent Plugins - Installed"),ctorDescriptor:new Ft(dfe,[{installedOnly:!0}]),when:C.and(QC,mPi,ie.Setup.hidden.negate()),weight:30,order:5,canToggleVisibility:!0},{id:"workbench.views.agentPlugins.default.marketplace",name:L(6010,"Agent Plugins"),ctorDescriptor:new Ft(dfe,[{}]),when:C.and(QC,mPi.toNegated(),ie.Setup.hidden.negate()),weight:30,order:5,canToggleVisibility:!0,hideByDefault:!0},{id:"workbench.views.agentPlugins.marketplace",name:L(6010,"Agent Plugins"),ctorDescriptor:new Ft(dfe,[{}]),when:C.and(SMt,ie.Setup.hidden.negate())}],pWe)}};ufe=I([m(0,X),m(1,Gg)],ufe);var Pan=/^[a-z0-9]([a-z0-9\-.]*[a-z0-9])?$/,Aan=/--|[.][.]/;function Nan(a){if(!a)return d(5984,null);if(a.length>64)return d(5985,null);if(!Pan.test(a))return d(5982,null);if(Aan.test(a))return d(5981,null)}function Oan(a){return a==="local"||a==="user"}function Fan(a){let i=a.presentation?.order;return i===200||i===0||i===100}function Byo(a){return a.name?a.name:a.type==="skill"&&He(a.uri).toLowerCase()==="skill.md"?He(ci(a.uri)):He(a.uri)}function rqt(a){let i=Byo(a),e=i.indexOf(":");return e>=0?i.substring(e+1):i}var vPi=class a extends K{static{this.ID="workbench.action.chat.createPlugin"}constructor(){super({id:a.ID,title:L(5973,"Create Plugin"),category:Si,f1:!0,precondition:ie.enabled,icon:R.save,menu:[{id:D.ViewTitle,when:C.and(C.equals("view",pfe),ie.Setup.hidden.negate()),group:"navigation",order:2}]})}async run(i){let e=i.get(Ue),t=i.get(Or),o=i.get(Lc),n=i.get(rn),r=i.get(fe),s=i.get(ge),l=i.get(Ne),[c,u,p,h,g]=await(async()=>{let G=new Ye;try{return await Promise.all([t.listPromptFiles("instructions",G.token),t.listPromptFiles("prompt",G.token),t.listPromptFiles("agent",G.token),t.listPromptFiles("skill",G.token),t.listPromptFiles("hook",G.token)])}finally{G.dispose(!0)}})(),f=o.collections.get(),v=!1,b=()=>{let G=[],$=(ae,he,oe,de)=>{let Ce=v?ae:ae.filter(ze=>Oan(ze.storage));if(Ce.length===0)return;let xe=Ce.map(ze=>({label:Byo(ze),description:ze.storage,resourceType:he,promptPath:ze,checked:!1}));G.push({label:oe,iconClass:q.asClassName(de),checked:void 0,collapsed:!1,pickable:!1,children:xe})};$(c,"instruction",d(5976,null),R.book),$(u,"prompt",d(5986,null),R.comment),$(p,"agent",d(5972,null),R.copilot),$(h,"skill",d(5991,null),R.lightbulb),$(g,"hook",d(5975,null),R.zap);let J=[];for(let ae of f){if(!v&&!Fan(ae))continue;let he=ae.serverDefinitions.get();for(let oe of he)J.push({label:oe.label,description:ae.label,resourceType:"mcp",mcpServer:{collection:ae,definition:oe},checked:!1})}return J.length>0&&G.push({label:d(5977,null),iconClass:q.asClassName(R.mcp),checked:void 0,collapsed:!1,pickable:!1,children:J}),G},S=new N,y=S.add(e.createQuickTree());y.placeholder=d(5989,null),y.matchOnDescription=!0,y.matchOnLabel=!0,y.sortByLabel=!1,y.title=d(5974,null),y.setItemTree(b());let w={iconClass:q.asClassName(R.filter),tooltip:d(5990,null)};y.buttons=[w],S.add(y.onDidTriggerButton(G=>{G===w&&(v=!v,y.setItemTree(b()))}));let k=await new Promise(G=>{S.add(y.onDidAccept(()=>{G(y.checkedLeafItems),y.hide()})),S.add(y.onDidHide(()=>{G(void 0)})),y.show()});if(S.dispose(),!k||k.length===0)return;let T=k.filter(G=>!!G.resourceType),P=await e.input({prompt:d(5983,null),placeHolder:"my-plugin",validateInput:async G=>Nan(G)});if(!P)return;let O=await n.showOpenDialog({canSelectFiles:!1,canSelectFolders:!0,canSelectMany:!1,title:d(5988,null),openLabel:d(5987,null)});if(!O||O.length===0)return;let V=O[0],H=Ge(V,P);if(await r.exists(H)){l.error(d(5980,null,P));return}try{await Wan(r,H,P,T),await Uan(r,V,P);try{await s.executeCommand("revealFileInOS",H)}catch{}l.info(d(5978,null,P))}catch(G){l.error(d(5979,null,String(G)))}}};async function Wan(a,i,e,t){await a.createFolder(i);let o=Ge(i,".plugin");await a.createFolder(o);let n={name:e,version:"1.0.0",description:""};await a.writeFile(Ge(o,"plugin.json"),qe.fromString(JSON.stringify(n,null,"	")));let r={instruction:t.filter(s=>s.resourceType==="instruction"),prompt:t.filter(s=>s.resourceType==="prompt"),agent:t.filter(s=>s.resourceType==="agent"),skill:t.filter(s=>s.resourceType==="skill"),hook:t.filter(s=>s.resourceType==="hook"),mcp:t.filter(s=>s.resourceType==="mcp")};if(r.instruction.length>0){let s=Ge(i,"rules");await a.createFolder(s);for(let l of r.instruction){if(!l.promptPath)continue;let c=rqt(l.promptPath),u=c.endsWith(".instructions.md")||c.endsWith(".mdc")||c.endsWith(".md")?c:c+".instructions.md",p=await a.readFile(l.promptPath.uri);await a.writeFile(Ge(s,u),p.value)}}if(r.prompt.length>0){let s=Ge(i,"commands");await a.createFolder(s);for(let l of r.prompt){if(!l.promptPath)continue;let c=rqt(l.promptPath),u=c.endsWith(".md")?c:c+".md",p=await a.readFile(l.promptPath.uri);await a.writeFile(Ge(s,u),p.value)}}if(r.agent.length>0){let s=Ge(i,"agents");await a.createFolder(s);for(let l of r.agent){if(!l.promptPath)continue;let c=rqt(l.promptPath),u=c.endsWith(".md")?c:c+".md",p=await a.readFile(l.promptPath.uri);await a.writeFile(Ge(s,u),p.value)}}if(r.skill.length>0){let s=Ge(i,"skills");await a.createFolder(s);for(let l of r.skill){if(!l.promptPath)continue;let c=l.promptPath.uri,u=rqt(l.promptPath),g=He(c).toLowerCase()==="skill.md"?Ge(c,".."):c,f=Ge(s,u);await Hyo(a,g,f)}}if(r.hook.length>0){let s=Ge(i,"hooks");await a.createFolder(s);let l={};for(let u of r.hook)if(u.promptPath)try{let p=await a.readFile(u.promptPath.uri),h=zT(p.value.toString()),g=h?.hooks??h;if(g&&typeof g=="object"){for(let[f,v]of Object.entries(g))if(Array.isArray(v)){l[f]||(l[f]=[]);for(let b of v)l[f].push(Van(b))}}}catch{}let c={hooks:l};await a.writeFile(Ge(s,"hooks.json"),qe.fromString(JSON.stringify(c,null,"	")))}if(r.mcp.length>0){let s={};for(let c of r.mcp){if(!c.mcpServer)continue;let u=c.mcpServer.definition;s[u.label]=Ban(u.launch)}let l={mcpServers:s};await a.writeFile(Ge(i,".mcp.json"),qe.fromString(JSON.stringify(l,null,"	")))}}function Van(a){let i={type:"command"};return typeof a.command=="string"&&(i.command=a.command),typeof a.windows=="string"&&(i.windows=a.windows),typeof a.linux=="string"&&(i.linux=a.linux),typeof a.osx=="string"&&(i.osx=a.osx),a.cwd!==void 0&&(i.cwd=km(a.cwd)?A.revive(a.cwd).fsPath:String(a.cwd)),a.env&&typeof a.env=="object"&&Object.keys(a.env).length>0&&(i.env=a.env),typeof a.timeout=="number"&&(i.timeout=a.timeout),i}function Ban(a){if(a.type===1){let i={type:"stdio",command:a.command};return a.args.length>0&&(i.args=[...a.args]),a.cwd&&(i.cwd=a.cwd),Object.keys(a.env).length>0&&(i.env={...a.env}),i}else{let i={type:"http",url:a.uri.toString()};if(a.headers.length>0){let e={};for(let[t,o]of a.headers)e[t]=o;i.headers=e}return i}}async function Hyo(a,i,e){let t=await a.resolve(i);if(t.isDirectory){if(await a.createFolder(e),t.children)for(let o of t.children){let n=He(o.resource);await Hyo(a,o.resource,Ge(e,n))}}else{let o=await a.readFile(i);await a.writeFile(e,o.value)}}var Han=["marketplace.json",".plugin/marketplace.json"];async function Uan(a,i,e){for(let t of Han){let o=Ge(i,t);if(await a.exists(o)){try{let n=await a.readFile(o),r=zT(n.value.toString());if(r&&typeof r=="object"){Array.isArray(r.plugins)||(r.plugins=[]);let s=r.plugins;if(s.some(l=>l.name===e))return;s.push({name:e,source:`./${e}/`}),await a.writeFile(o,qe.fromString(JSON.stringify(r,null,"	")))}}catch{}return}}}function Uyo(){W(vPi)}function Kyo(){W(CPi),W(bPi),W(SPi),W(yPi),W(wPi),W(IPi),cyo(),Uyo()}async function aqt(a){let i=a.get(Pt),e=i.lastFocusedWidget;return!e||e.location==="panel"?i.revealWidget():e}var sqt=class extends K{async run(i,...e){let t=i.get(F),o=await t.invokeFunction(aqt);if(o)return t.invokeFunction(this.runWithWidget.bind(this),o,...e)}_getResources(i,...e){let t=i.get(ee),o=Ude(e[1])?this._getEditorResources(i,e):Array.isArray(e[1])?e[1]:[e[0]],n=[];for(let r of o){let s;A.isUri(r)?s=r:_l(r)?s=r.resource:el(r)?s=r.parent().resource:!r&&t.activeTextEditorControl&&(s=po.getCanonicalUri(t.activeEditor,{supportSideBySide:1})),s&&[Q.file,Q.vscodeRemote,Q.untitled].includes(s.scheme)&&n.push(s)}return n}_getEditorResources(i,...e){return Dp(e,i.get(ee),i.get(wt),i.get(Io)).groupedEditors.flatMap(o=>o.editors).map(o=>po.getCanonicalUri(o,{supportSideBySide:1})).filter(o=>o!==void 0)}},bPi=class a extends sqt{static{this.ID="workbench.action.chat.attachFile"}constructor(){super({id:a.ID,title:L(5795,"Add File to Chat"),category:Si,icon:R.attach,precondition:ie.enabled,f1:!0,menu:[{id:D.SearchContext,group:"z_chat",order:1,when:C.and(ie.enabled,_i.FileMatchOrMatchFocusKey,_i.SearchResultHeaderFocused.negate())},{id:D.ExplorerContext,group:"5_chat",order:1,when:C.and(ie.enabled,Gd.negate(),C.or(Wo.Scheme.isEqualTo(Q.file),Wo.Scheme.isEqualTo(Q.vscodeRemote)))},{id:D.EditorTitleContext,group:"2_chat",order:1,when:C.and(ie.enabled,C.or(Wo.Scheme.isEqualTo(Q.file),Wo.Scheme.isEqualTo(Q.vscodeRemote)))},{id:D.EditorContext,group:"1_chat",order:2,when:C.and(ie.enabled,pe.hasNonEmptySelection.negate(),C.or(Wo.Scheme.isEqualTo(Q.file),Wo.Scheme.isEqualTo(Q.vscodeRemote),Wo.Scheme.isEqualTo(Q.untitled),Wo.Scheme.isEqualTo(Q.vscodeUserData)))},{id:D.InlineChatEditorAffordance,group:"0_chat",order:3,when:C.and(ie.enabled,pe.hasNonEmptySelection.negate())},{id:D.ChatEditorInlineMenu,group:"0_chat",order:3,when:C.and(ie.enabled,pe.hasNonEmptySelection.negate())}]})}async runWithWidget(i,e,...t){let o=this._getResources(i,...t);if(o.length&&e){e.focusInput();for(let n of o)e.attachmentModel.addFile(n)}}},SPi=class a extends sqt{static{this.ID="workbench.action.chat.attachFolder"}constructor(){super({id:a.ID,title:L(5796,"Add Folder to Chat"),category:Si,f1:!1,menu:{id:D.ExplorerContext,group:"5_chat",order:1,when:C.and(ie.enabled,Gd,C.or(Wo.Scheme.isEqualTo(Q.file),Wo.Scheme.isEqualTo(Q.vscodeRemote)))}})}async runWithWidget(i,e,...t){let o=this._getResources(i,...t);if(o.length&&e){e.focusInput();for(let n of o)e.attachmentModel.addFolder(n)}}},IPi=class a extends K{static{this.ID="workbench.action.chat.attachPinnedEditors"}constructor(){super({id:a.ID,title:L(5797,"Add Pinned Editors to Chat"),category:Si,precondition:ie.enabled,f1:!0})}async run(i){let e=i.get(wt),o=await i.get(F).invokeFunction(aqt);if(!o)return;let n=[];for(let r of e.groups)for(let s of r.editors)if(r.isPinned(s)){let l=po.getCanonicalUri(s,{supportSideBySide:1});l&&[Q.file,Q.vscodeRemote,Q.untitled].includes(l.scheme)&&n.push(l)}if(n.length){o.focusInput();for(let r of n)o.attachmentModel.addFile(r)}}},yPi=class a extends K{static{this.ID="workbench.action.chat.attachSelection"}constructor(){super({id:a.ID,title:L(5798,"Add Selection to Chat"),category:Si,icon:R.attach,f1:!0,precondition:ie.enabled,menu:[{id:D.EditorContext,group:"1_chat",order:1,when:C.and(ie.enabled,pe.hasNonEmptySelection,C.or(Wo.Scheme.isEqualTo(Q.file),Wo.Scheme.isEqualTo(Q.vscodeRemote),Wo.Scheme.isEqualTo(Q.untitled),Wo.Scheme.isEqualTo(Q.vscodeUserData)))},{id:D.InlineChatEditorAffordance,group:"0_chat",order:2,when:C.and(ie.enabled,pe.hasNonEmptySelection)},{id:D.ChatEditorInlineMenu,group:"0_chat",order:2,when:C.and(ie.enabled,pe.hasNonEmptySelection)}]})}async run(i,...e){let t=i.get(ee),o=await i.get(F).invokeFunction(aqt);if(!o)return;let[n,r]=e;if(r&&r.length>0){let s=new Map;for(let l of r)if(_l(l))s.set(l.resource,void 0);else{let c={uri:l._parent.resource,range:l._range},u=s.get(c.uri);(!u||u.startLineNumber!==c.range.startLineNumber&&u.endLineNumber!==c.range.endLineNumber)&&(s.set(c.uri,c.range),o.attachmentModel.addFile(c.uri,c.range))}for(let l of s){let[c,u]=l;u||o.attachmentModel.addFile(c)}}else{let s=t.activeTextEditorControl,l=po.getCanonicalUri(t.activeEditor,{supportSideBySide:1});if(s&&l&&[Q.file,Q.vscodeRemote,Q.untitled].includes(l.scheme)){let c=s.getSelection();if(c){o.focusInput();let u=c.isEmpty()?new z(c.startLineNumber,1,c.startLineNumber+1,1):c;o.attachmentModel.addFile(l,u)}}}}},wPi=class a extends K{static{this.Name="searchResults"}constructor(){super({id:"workbench.action.chat.insertSearchResults",title:L(5791,"Add Search Results to Chat"),category:Si,f1:!1,menu:[{id:D.SearchContext,group:"z_chat",order:3,when:C.and(ie.enabled,_i.SearchResultHeaderFocused)}]})}async run(i){let e=i.get(se),t=await i.get(F).invokeFunction(aqt);if(!t){e.trace("InsertSearchResultAction: no chat view available");return}let o=t.inputEditor,n=o.getSelection()??o.getModel()?.getFullModelRange().collapseToEnd();if(!n){e.trace("InsertSearchResultAction: no selection");return}let r=`#${a.Name}`,s=new z(n.startLineNumber,n.startColumn,n.endLineNumber,n.startLineNumber+r.length),l=o.getModel();if(l&&l.getValueInRange(new z(n.startLineNumber,n.startColumn-1,n.startLineNumber,n.startColumn))!==" "&&(r=" "+r),!o.executeEdits("chatInsertSearch",[{range:s,text:r+" "}])){e.trace(`InsertSearchResultAction: failed to insert "${r}"`);return}}};function zan(a){return xi(a)&&typeof a.kind=="string"&&a.kind==="contextPick"}function Kan(a){return xi(a)&&typeof a.symbolName=="string"&&!!a.uri&&!!a.range}function zyo(a){return xi(a)&&A.isUri(a.resource)}var CPi=class extends K{constructor(){super({id:"workbench.action.chat.attachContext",title:L(5794,"Add Context..."),icon:R.add,category:Si,keybinding:{when:C.and(ie.inChatInput,ie.location.isEqualTo("panel")),primary:2138,weight:100},menu:[{when:C.and(ie.inQuickChat.negate(),ie.location.isEqualTo("panel"),C.or(ie.lockedToCodingAgent.negate(),ie.agentSupportsAttachments)),id:D.ChatInput,group:"navigation",order:-1},{when:C.and(ie.inQuickChat.negate(),ie.location.isEqualTo("editor"),Phe,C.or(ie.lockedToCodingAgent.negate(),ie.agentSupportsAttachments)),id:D.ChatInput,group:"navigation",order:2},{when:C.and(ie.inQuickChat,C.or(ie.lockedToCodingAgent.negate(),ie.agentSupportsAttachments)),id:D.ChatExecute,group:"navigation",order:-1}]})}async run(i,...e){let t=i.get(F),o=i.get(Pt),n=i.get(X),r=i.get(_e),s=i.get(DS),l=e[0],c=l?.widget??o.lastFocusedWidget;if(!c)return;let u=[];for(let p of s.items)p.isEnabled&&!await p.isEnabled(c)||u.push({kind:"contextPick",item:p,label:p.label,iconClass:q.asClassName(p.icon),keybinding:p.commandId?r.lookupKeybinding(p.commandId,n):void 0});t.invokeFunction(this._show.bind(this),c,u,l?.placeholder)}_show(i,e,t,o){let n=i.get(Ue),r=i.get(sD),s=i.get(F),l=i.get(ge),c={filter:u=>zyo(u)&&u.resource?s.invokeFunction(p=>KEe(p,u.resource.scheme)):!0,additionPicks:t,handleAccept:async(u,p)=>{if(zan(u)){let h=!0;if(u.item.type==="valuePick"?this._handleContextPick(u.item,e):u.item.type==="pickerPick"&&(h=await this._handleContextPickerItem(n,l,u.item,e)),!h){s.invokeFunction(this._show.bind(this),e,t,o);return}}else s.invokeFunction(this._handleQPPick.bind(this),e,p,u);TKt(e)&&r.open()}};n.quickAccess.show("",{enabledProviderPrefixes:[iC.PREFIX,Yk.PREFIX,iL.PREFIX],placeholder:o??d(5792,null),providerOptions:c})}async _handleQPPick(i,e,t,o){let n=i.get(fe),r=i.get(Bt),s=[];if(zyo(o)&&o.resource)if(/\.(png|jpg|jpeg|bmp|gif|tiff)$/i.test(o.resource.path)){if(A.isUri(o.resource)){let l=await n.readFile(o.resource),c=await JP(l.value.buffer);s.push({id:o.resource.toString(),name:o.label,fullName:o.label,value:c,kind:"image",references:[{reference:o.resource,kind:"reference"}]})}}else{let l=0;try{(await r.createModelReference(o.resource)).dispose()}catch{l=2}s.push({kind:"file",id:o.resource.toString(),value:o.resource,name:o.label,omittedState:l})}else Kan(o)&&o.uri&&o.range&&s.push({kind:"generic",id:JSON.stringify({uri:o.uri,range:o.range.decoration}),value:{uri:o.uri,range:o.range.decoration},fullName:o.label,name:o.symbolName});e.attachmentModel.addContext(...s),t||e.focusInput()}async _handleContextPick(i,e){let t=await i.asAttachment(e);Array.isArray(t)?e.attachmentModel.addContext(...t):t&&e.attachmentModel.addContext(t)}async _handleContextPickerItem(i,e,t,o){let n=t.asPicker(o),r=new N,s={label:d(5793,null),alwaysShow:!0},l=n.configure?{label:n.configure.label,commandId:n.configure.commandId,alwaysShow:!0}:void 0,c=[{type:"separator"}];l&&c.push(l),c.push(s);let u=r.add(i.createQuickPick({useSeparators:!0})),p=new Ye;if(r.add(u.onDidHide(()=>p.cancel())),r.add(Z(()=>p.dispose(!0))),u.placeholder=n.placeholder,u.matchOnDescription=!0,u.matchOnDetail=!0,u.canAcceptInBackground=!0,u.busy=!0,u.show(),f_(n.picks)){let f=await n.picks.then(v=>[].concat(v,c));u.items=f,u.busy=!1}else{let f=Me("attachContext.query",u.value);r.add(u.onDidChangeValue(()=>f.set(u.value,void 0)));let v=n.picks(f,p.token);r.add(be(b=>{let{busy:S,picks:y}=v.read(b);u.items=[].concat(y,c),u.busy=S}))}if(p.token.isCancellationRequested)return n.dispose?.(),!0;let h=new Ko,g=[];r.add(u.onDidAccept(async f=>{let v="noop",[b]=u.selectedItems;if(Oso(b)){let S=b.asAttachment();if(!S||S===v)return;f_(S)?g.push(S.then(y=>{y!==v&&o.attachmentModel.addContext(...cc(y))})):o.attachmentModel.addContext(...cc(S))}if(b===s){if(n.goBack?.())return;h.complete(!1)}b===l&&(h.complete(!0),e.executeCommand(l.commandId)),f.inBackground||h.complete(!0)})),r.add(u.onDidHide(()=>{h.complete(!0),n.dispose?.()}));try{let f=await h.p;return u.busy=!0,await Promise.all(g),f}finally{r.dispose()}}};function Gyo(){W(class extends K{constructor(){super({id:"workbench.action.chat.copyAll",title:L(5806,"Copy All"),f1:!1,category:Si,menu:{id:D.ChatContext,when:ie.responseIsFiltered.negate(),group:"copy"}})}run(i,e){let t=i.get(Fi),o=i.get(Pt),n=(Sr(e)||Ui(e))&&o.getWidgetBySessionResource(e.sessionResource)||o.lastFocusedWidget;if(n){let s=n.viewModel?.getItems().filter(l=>Sr(l)||Ui(l)&&!l.errorDetails?.responseIsFiltered).map(l=>zSi(l)).join(`

`);s&&t.writeText(s)}}}),W(class extends K{constructor(){super({id:"workbench.action.chat.copyItem",title:L(5808,"Copy"),f1:!1,category:Si,icon:R.copy,menu:[{id:D.ChatContext,when:ie.responseIsFiltered.negate(),group:"copy"},{id:D.ChatMessageFooter,group:"navigation",order:1,when:C.and(ie.isResponse,ie.responseIsFiltered.negate())}]})}async run(i,...e){let t=i.get(Pt),o=i.get(Fi),n=t.lastFocusedWidget,r=e[0];if(!Lk(r)&&(r=n?.getFocus(),!r))return;let l=Ki().getSelection()?.toString();if(n&&l&&l.length>0&&ts(Nn(),n.domNode)){await o.writeText(l);return}if(!Sr(r)&&!Ui(r))return;let c=zSi(r,!1);await o.writeText(c)}}),W(class extends K{constructor(){super({id:"workbench.action.chat.copyFinalResponse",title:L(5807,"Copy Final Response"),f1:!1,category:Si,menu:{id:D.ChatContext,when:C.and(ie.isResponse,ie.responseIsFiltered.negate()),group:"copy"}})}async run(i,...e){let t=i.get(Pt),o=i.get(Fi),n=t.lastFocusedWidget,r=e[0];if(!Lk(r)&&(r=n?.getFocus(),!r)||!Ui(r))return;let s=r.response.getFinalResponse();s&&await o.writeText(s)}}),W(class extends K{constructor(){super({id:"workbench.action.chat.copyKatexMathSource",title:L(5805,"Copy Math Source"),f1:!1,category:Si,menu:{id:D.ChatContext,group:"copy",when:ie.isKatexMathElement}})}async run(i,...e){let t=i.get(Pt),o=i.get(Fi),n=t.lastFocusedWidget,r=e[0];if(!Lk(r)&&(r=n?.getFocus(),!r))return;let s=null,l=Nn(),c=Ki().getSelection();n&&c&&c.rangeCount>0&&ts(l,n.domNode)&&(s=c.getRangeAt(0).commonAncestorContainer,s.nodeType===Node.TEXT_NODE&&(s=s.parentElement)),s||(s=l?.querySelector(`.${NDe}`)??null);let p=(Do(s)?s.closest(`.${NDe}`):null)?.getAttribute(IXe)||"";p&&await o.writeText(p)}})}function qyo(a,i){return A.isUri(i)?i.toString():km(i)?A.from(i).toString():i}function $yo(){W(xPi),W(kPi),W(EPi),W(TPi)}var xPi=class a extends K{static{this.ID="workbench.action.chat.logInputHistory"}constructor(){super({id:a.ID,title:L(5812,"Log Chat Input History"),icon:R.attach,category:Ve.Developer,f1:!0,precondition:ie.enabled})}async run(i,...e){i.get(Pt).lastFocusedWidget?.logInputHistory()}},kPi=class a extends K{static{this.ID="workbench.action.chat.logChatIndex"}constructor(){super({id:a.ID,title:L(5811,"Log Chat Index"),icon:R.attach,category:Ve.Developer,f1:!0,precondition:ie.enabled})}async run(i,...e){i.get(mi).logChatIndex()}},EPi=class a extends K{static{this.ID="workbench.action.chat.inspectChatModel"}constructor(){super({id:a.ID,title:L(5810,"Inspect Chat Model"),icon:R.inspect,category:Ve.Developer,f1:!0,precondition:ie.enabled})}async run(i,...e){let t=i.get(Pt),o=i.get(ee),n=t.lastFocusedWidget;if(!n?.viewModel)return;let s=n.viewModel.model.toJSON(),l=`# Chat Model Inspection

`,c=s.requests;if(c&&c.length>0){let u=c[c.length-1];u.response&&(l+=`## Latest Response

`,l+="```json\n"+JSON.stringify(u.response,qyo,2)+"\n```\n\n")}l+=`## Full Chat Model

`,l+="```json\n"+JSON.stringify(s,qyo,2)+"\n```\n",await o.openEditor({resource:void 0,contents:l,languageId:"markdown",options:{pinned:!0}})}},TPi=class a extends K{static{this.ID="workbench.action.chat.clearRecentlyUsedLanguageModels"}constructor(){super({id:a.ID,title:L(5809,"Clear Recently Used Language Models"),category:Ve.Developer,f1:!0,precondition:ie.enabled})}run(i){i.get(ds).clearRecentlyUsedList()}};function Qyo(){W(class extends K{constructor(){super({id:"workbench.action.chat.nextFileTree",title:L(5847,"Next File Tree"),keybinding:{primary:2115,weight:200,when:ie.inChatSession},precondition:ie.enabled,f1:!0,category:Si})}run(i,...e){jyo(i,!1)}}),W(class extends K{constructor(){super({id:"workbench.action.chat.previousFileTree",title:L(5848,"Previous File Tree"),keybinding:{primary:3139,weight:200,when:ie.inChatSession},precondition:ie.enabled,f1:!0,category:Si})}run(i,...e){jyo(i,!0)}})}function jyo(a,i){let t=a.get(Pt).lastFocusedWidget;if(!t)return;let o=!t.inputEditor.hasWidgetFocus()&&t.getFocus(),r=(Ui(o)?o:void 0)??t.viewModel?.getItems().reverse().find(u=>Ui(u));if(!r)return;t.reveal(r);let s=t.getFileTreeInfosForResponse(r),l=t.getLastFocusedFileTreeForResponse(r),c=l?(l.treeIndex+(i?-1:1)+s.length)%s.length:i?s.length-1:0;s[c]?.focus()}var cq=class extends x{constructor(e,t,o,n,r,s){super();this.productService=e;this.extensionService=t;this.extensionManagementService=o;this.storageService=n;this.chatWidgetService=r;this.configurationService=s;this.recentlyInstalled=!1;let l=this.productService.defaultChatAgent,c=this.storageService.getBoolean(cq.hideWelcomeView,-1,!1);!l||c||this.registerListeners(l)}static{this.ID="workbench.contrib.chatGettingStarted"}static{this.hideWelcomeView="workbench.chat.hideWelcomeView"}registerListeners(e){this._register(this.extensionManagementService.onDidInstallExtensions(async t=>{for(let o of t)if(Ii.equals(e.extensionId,o.identifier.id)&&o.operation===2){this.recentlyInstalled=!0;return}})),this._register(this.extensionService.onDidChangeExtensionsStatus(async t=>{for(let o of t)if(Ii.equals(e.extensionId,o.value)&&this.extensionService.getExtensionsStatus()[o.value].activationTimes&&this.recentlyInstalled){this.onDidInstallChat();return}}))}async onDidInstallChat(){this.configurationService.getValue("workbench.startupEditor")!=="agentSessionsWelcomePage"&&this.chatWidgetService.revealWidget(),this.storageService.store(cq.hideWelcomeView,!0,-1,1),this.recentlyInstalled=!1}};cq=I([m(0,tt),m(1,lt),m(2,Cs),m(3,ce),m(4,Pt),m(5,B)],cq);function Xyo(){W(class extends K{constructor(){super({id:"workbench.action.chat.forkConversation",title:L(5849,"Fork Conversation"),tooltip:L(5850,"Fork conversation from this point"),f1:!1,category:Si,icon:R.repoForked,precondition:ie.enabled,menu:[{id:D.ChatMessageCheckpoint,group:"navigation",order:3,when:C.and(ie.isRequest,ie.isFirstRequest.negate(),C.or(ie.lockedToCodingAgent.negate(),ie.chatSessionSupportsFork))}]})}async run(i,...e){let t=i.get(Pt),o=i.get(mi),n=i.get(Us),r=i.get(Fo),s=d(5852,null);if(A.isUri(e[0])){let P=e[0];if(n.getContentProviderSchemes().includes(P.scheme)){await Yyo(P,void 0,!1,n,t,r);return}let V=o.getSession(P);if(!V)return;let H=V.toJSON();if(H.requests.length===0)return;let G=$n(JSON.parse(JSON.stringify(H)));G.sessionId=xt();let $=Date.now();G.creationDate=$,G.customTitle=V.title.startsWith(s)?V.title:d(5851,null,V.title);for(let[he,oe]of G.requests.entries())oe.shouldBeRemovedOnSend=void 0,oe.isHidden=void 0,oe.requestId=xt(),oe.responseId=oe.responseId?xt():void 0,oe.timestamp=$+he,oe.response&&(oe.modelState={value:1,completedAt:$+he});let J=o.loadSessionFromData(G),ae=J.object.sessionResource;setTimeout(async()=>{try{await t.openSession(ae,rD)}finally{J.dispose()}},0);return}let l=e[0],c=Lk(l)?l:Lk(l?.element)?l.element:Lk(l?.context)?l.context:Lk(l?.item)?l.item:void 0,u=c&&t.getWidgetBySessionResource(c.sessionResource)||t.lastFocusedWidget;if(!Ui(c)&&!Sr(c)&&(c=u?.getFocus()),!c)return;let p=u?.viewModel?.sessionResource??(Lk(c)?c.sessionResource:void 0);if(!p)return;let h=Sr(c)?c.id:Ui(c)?c.requestId:void 0;if(!h)return;if(n.getContentProviderSchemes().includes(p.scheme)){let O=(await n.getOrCreateChatSession(p,Se.None)).history.find(V=>V.type==="request"&&V.id===h);if(!O){let H=o.getSession(p)?.toJSON();for(let[,G]of H?.requests.entries()??[])if(G.requestId===h){O={id:G.requestId,type:"request",prompt:typeof G.message=="string"?G.message:G.message.text,participant:G.agent?.id??"",variableData:G.variableData,modelId:G.modelId};break}}await Yyo(p,O,!0,n,t,r);return}let f=o.getSession(p);if(!f)return;let v=f.toJSON(),b=Sr(c),S=-1;if(u?.viewModel){let P=-1;for(let O of u.viewModel.getItems())if(Sr(O)&&(P+=1),O.id===c?.id){S=Sr(O)?Math.max(0,P-1):P;break}}if(S<0){let P=f.getRequests().findIndex(O=>O.id===h);S=b?Math.max(0,P-1):P}if(S<0)return;let y=$n(JSON.parse(JSON.stringify({...v,requests:v.requests.slice(0,S+1)})));y.sessionId=xt();let w=Date.now();y.creationDate=w,y.customTitle=f.title.startsWith(s)?f.title:d(5851,null,f.title);for(let[P,O]of y.requests.entries())O.shouldBeRemovedOnSend=void 0,O.isHidden=void 0,O.requestId=xt(),O.responseId=O.responseId?xt():void 0,O.timestamp=w+P,O.response&&(O.modelState={value:1,completedAt:w+P});let k=o.loadSessionFromData(y);if(!k)return;let T=k.object.sessionResource;await t.openSession(T,rD),k.dispose()}})}async function Yyo(a,i,e,t,o,n){let r=new Ye;try{let s=await t.forkChatSession(a,i,r.token);e?await o.openSession(s.resource,rD):setTimeout(async()=>{await o.openSession(s.resource,rD)},0)}finally{r.dispose()}}var Jyo="chat.json",Zyo=[{name:d(5854,null),extensions:["json"]}];function ewo(){W(class extends K{constructor(){super({id:"workbench.action.chat.export",category:Si,title:L(5853,"Export Chat..."),precondition:ie.enabled,f1:!0})}async run(i,e){let t=i.get(Pt),o=i.get(rn),n=i.get(fe),r=i.get(mi),s=t.lastFocusedWidget;if(!s||!s.viewModel)return;if(!e){let u=Ge(await o.defaultFilePath(),Jyo),p=await o.showSaveDialog({defaultUri:u,filters:Zyo});if(!p)return;e=p}let l=r.getSession(s.viewModel.sessionResource);if(!l)return;let c=qe.fromString(JSON.stringify(l.toExport(),void 0,2));await n.writeFile(e,c)}}),W(class extends K{constructor(){super({id:"workbench.action.chat.import",title:L(5855,"Import Chat..."),category:Si,precondition:ie.enabled,f1:!0})}async run(i,e){let t=i.get(fe),o=i.get(Pt),n=i.get(mi),r=i.get(rn),s=e?.inputPath;if(!s){let c=Ge(await r.defaultFilePath(),Jyo),u=await r.showOpenDialog({defaultUri:c,canSelectFiles:!0,filters:Zyo});if(!u)return;s=u[0]}let l=await t.readFile(s);try{let c=$n(JSON.parse(l.value.toString()));if(!mOt(c))throw new Error("Invalid chat session data");let u,p,h;e?.target==="chatViewPane"?(u=n.loadSessionFromData(c).object.sessionResource,p=rD,h={pinned:!0}):(u=Na.getNewEditorUri(),p=jn,h={target:{data:c},pinned:!0}),await o.openSession(u,p,h)}catch(c){throw c}}})}var _Pi=class a extends K{static{this.ID="workbench.action.chat.manageLanguageModelAuthentication"}constructor(){super({id:a.ID,title:L(5861,"Manage Language Model Access..."),category:Si,precondition:ie.enabled,menu:[{id:D.AccountsContext,order:100}],f1:!0})}async run(i){let e=i.get(Ue),t=i.get(ds),o=i.get(vk),n=i.get(at),r=i.get(lt),s=i.get(Hi),l=i.get(tt),c=t.getLanguageModelIds(),u=new Map,p=new Map;for(let f of c){let v=t.lookupLanguageModel(f);if(!v?.auth)continue;let b=v.extension.value;if(!u.has(b))try{let S=oA+b,y=v.auth.accountLabel||"Language Models";p.set(b,y);let w=o.readAllowedExtensions(S,y).filter(T=>!T.trusted);if(l.trustedExtensionAuthAccess&&!Array.isArray(l.trustedExtensionAuthAccess)){let T=l.trustedExtensionAuthAccess[S];for(let P of T){let O=w.findIndex(H=>H.id===P);O!==-1&&w.splice(O,1);let V=await r.getExtension(P);V&&w.push({id:P,name:V.displayName||V.name,allowed:!0,trusted:!0})}}let k=new Array;for(let T of w)await r.getExtension(T.id)&&k.push(T);u.set(b,k)}catch{u.has(b)||u.set(b,[])}}if(u.size===0){n.prompt({type:"info",message:d(5864,null),detail:d(5865,null)});return}let h=[];for(let[f,v]of u){let b=await r.getExtension(f);if(!b)continue;h.push({type:"separator",id:f,label:d(5856,null,b.displayName||b.name),buttons:[{iconClass:q.asClassName(R.info),tooltip:d(5866,null)}]});let S=!1;if(v.length>0)for(let y of v)y.trusted&&!S&&(h.push({type:"separator",label:d(5867,null)}),S=!0),h.push({label:y.name,ownerId:f,id:y.id,picked:y.allowed??!1,extension:y,disabled:y.trusted,buttons:[{iconClass:q.asClassName(R.info),tooltip:d(5866,null)}]});else h.push({label:d(5863,null),description:d(5862,null,f),pickable:!1})}let g=await e.pick(h,{canPickMany:!0,sortByLabel:!0,onDidTriggerSeparatorButton(f){let v=f.separator.id;v&&s.open(v)},onDidTriggerItemButton(f){let v=f.item.id;v&&s.open(v)},title:d(5858,null),placeHolder:d(5857,null)});if(g)for(let[f,v]of u){let b=new Set(g.filter(S=>S.ownerId===f).filter(S=>!S.extension?.trusted).map(S=>S.id));for(let S of v)S.allowed=b.has(S.id);o.updateAllowedExtensions(oA+f,p.get(f)||"Language Models",v)}}},DPi=class extends K{constructor(){super({id:"lm.addLanguageModelsProviderGroup",title:d(5859,null)})}async run(i,e){let t=i.get(ds);if(!e)throw new Error("Language model group is required");let{name:o,vendor:n,...r}=e;await t.addLanguageModelsProviderGroup(o,n,r)}},LPi=class extends K{constructor(){super({id:"lm.migrateLanguageModelsProviderGroup",title:d(5860,null)})}async run(i,e){let t=i.get(ds);if(!e)throw new Error("Language model group is required");await t.migrateLanguageModelsProviderGroup(e)}};function two(){W(_Pi),W(DPi),W(LPi)}var Krt=class a extends K{static{this.ID="workbench.action.chat.managePlugins"}constructor(){super({id:a.ID,title:L(5900,"Plugins"),category:Si,precondition:ie.enabled,menu:[{id:ky,group:"2_plugins"}],f1:!0})}async run(i){i.get(Hi).openSearch("@agentPlugins ")}},RPi=class a extends K{static{this.ID="workbench.action.chat.installPluginFromSource"}constructor(){super({id:a.ID,title:L(5895,"Install Plugin from Source"),category:Si,icon:R.add,precondition:ie.enabled,f1:!0,menu:[{id:D.ViewTitle,when:C.and(C.equals("view",pfe),ie.Setup.hidden.negate()),group:"navigation",order:1}]})}async run(i){let e=i.get(Ue),t=i.get(Oy),o=new N,n=o.add(e.createInputBox());n.placeholder=d(5901,null),n.prompt=d(5902,null),n.show(),o.add(n.onDidChangeValue(()=>{n.validationMessage=void 0})),o.add(n.onDidHide(()=>{o.dispose()})),o.add(n.onDidAccept(async()=>{let r=n.value.trim();if(!r)return;let s=t.validatePluginSource(r);if(s){n.validationMessage=s;return}n.busy=!0,n.enabled=!1;try{n.hide();let l=await t.installPluginFromValidatedSource(r);if(!l.success)l.message&&(n.validationMessage=l.message),n.show();else{let c=Fy(r);c&&i.get(Hi).openSearch(`@agentPlugins ${c.displayLabel}`)}}finally{n.busy=!1,n.enabled=!0}}))}},MPi=class a extends K{static{this.ID="workbench.action.chat.managePluginMarketplaces"}constructor(){super({id:a.ID,title:L(5897,"Manage Plugin Marketplaces"),icon:R.globe,category:Si,precondition:ie.enabled,f1:!0,menu:[{id:D.ViewTitle,when:C.and(C.equals("view",pfe),ie.Setup.hidden.negate()),group:"navigation",order:2}]})}async run(i){let e=i.get(Ue),t=i.get(B),o=i.get(aq),n=i.get(Hi),r=i.get(ge),s=i.get(fe),l=t.getValue("chat.plugins.marketplaces")??[],c=LQ(l);if(c.length===0){e.pick([],{placeHolder:d(5898,null)});return}let u=c.map(S=>({label:S.displayLabel,description:S.kind==="localFileUri"?d(5896,null):S.cloneUrl,reference:S})),p=await e.pick(u,{placeHolder:d(5904,null)});if(!p)return;let h=p.reference,g=[{id:"showPlugins",label:d(5906,null)}],f=o.getRepositoryUri(h);await s.exists(f)&&g.push({id:"openDirectory",label:d(5899,null)}),g.push({id:"removeMarketplace",label:d(5903,null)});let b=await e.pick(g,{placeHolder:d(5905,null,h.displayLabel)});if(b)switch(b.id){case"showPlugins":n.openSearch(`@agentPlugins ${h.displayLabel}`);break;case"openDirectory":await r.executeCommand("revealFileInOS",f);break;case"removeMarketplace":{let y=(t.getValue("chat.plugins.marketplaces")??[]).filter(w=>typeof w=="string"&&w.trim()!==h.rawValue);await t.updateValue("chat.plugins.marketplaces",y);break}}}};function iwo(){W(Krt),W(RPi),W(MPi)}async function lqt(a,i){let e=a.get(ee);if(!i){let t=e.activeEditor;i=t instanceof Na?t:void 0}if(i instanceof Na){let t=i.sessionResource&&i.sessionResource.scheme!==Q.vscodeLocalChatSession?i.sessionResource.with({path:`/untitled-${xt()}`}):Na.getNewEditorUri(),o=e.findEditors(i.resource)[0];await e.replaceEditors([{editor:i,replacement:{resource:t,options:{pinned:!0}}}],o.groupId)}}var IN=class extends $F{constructor(e,t,o,n,r,s,l,c,u,p,h){super(Na.EditorID,e,IN.VIEW_STATE_KEY,t,n,r,u,o,p,h);this.chatSessionsService=s;this.contextKeyService=l;this.chatService=c;this.dimension=new si(0,0)}static{this.VIEW_STATE_KEY="chatEditorViewState"}get widget(){return this._widget}get scopedContextKeyService(){return this._scopedContextKeyService}async clear(){if(this.input)return this.instantiationService.invokeFunction(lqt,this.input)}createEditor(e){this._editorContainer=e,e.classList.add("chat-editor-relative"),this._scopedContextKeyService=this._register(this.contextKeyService.createScoped(e));let t=this._register(this.instantiationService.createChild(new _o([X,this.scopedContextKeyService])));ie.inChatEditor.bindTo(this._scopedContextKeyService).set(!0),this._widget=this._register(t.createInstance(kI,"panel",void 0,{autoScroll:o=>o!=="ask",renderFollowups:!0,supportsFileReferences:!0,clear:()=>this.clear(),rendererOptions:{renderTextEditsAsSummary:o=>!0,referencesExpandedWhenEmptyResponse:!1,progressMessageAtBottomOfResponse:o=>o!=="ask"},enableImplicitContext:!0,enableWorkingSet:"explicit",supportsChangingModes:!0},{listForeground:Id,listBackground:Ho,overlayBackground:oT,inputEditorBackground:yv,resultEditorBackground:Ho})),this._register(this.widget.onDidSubmitAgent(()=>{this.group.pinEditor(this.input)})),this.widget.render(e),this.widget.setVisible(!0)}setEditorVisible(e){super.setEditorVisible(e),this.widget?.setVisible(e),e&&this.widget&&this.widget.layout(this.dimension.height,this.dimension.width)}focus(){super.focus(),this.widget?.focusInput()}clearInput(){this.widget.setModel(void 0),super.clearInput()}showLoadingInChatWidget(e){if(!this._editorContainer)return;if(this._loadingContainer){let r=this._loadingContainer.querySelector(".chat-loading-content span");if(r){r.textContent=e;return}this.hideLoadingInChatWidget()}this._editorContainer.setAttribute("aria-busy","true"),this._loadingContainer=M(this._editorContainer,_(".chat-loading-overlay")),this._loadingContainer.setAttribute("role","status"),this._loadingContainer.setAttribute("aria-live","polite"),this._loadingContainer.tabIndex=-1;let t=M(this._loadingContainer,_(".chat-loading-content")),o=Sn(q.modify(R.loading,"spin"));o.setAttribute("aria-hidden","true"),t.appendChild(o);let n=M(t,_("span"));n.textContent=e}hideLoadingInChatWidget(){this._loadingContainer&&(this._loadingContainer.remove(),this._loadingContainer=void 0),this._editorContainer&&this._editorContainer.removeAttribute("aria-busy")}async setInput(e,t,o,n){let r=!1,s=e.getSessionType();if(s!==sc){let l=d(8084,null);this.showLoadingInChatWidget(l)}if(await super.setInput(e,t,o,n),n.isCancellationRequested){this.hideLoadingInChatWidget();return}if(!this.widget)throw new Error("ChatEditor lifecycle issue: no editor widget");if(s!==sc)try{await Wp(this.chatSessionsService.canResolveChatSession(e.resource.scheme),n);let c=this.chatSessionsService.getAllChatSessionContributions().find(u=>u.type===s);c?(this.widget.lockToCodingAgent(c.name,c.displayName,c.type),r=!0):this.widget.unlockFromCodingAgent()}catch(l){throw this.hideLoadingInChatWidget(),l}else this.widget.unlockFromCodingAgent();try{let l=await Wp(e.resolve(),n);if(!l)throw new Error(`Failed to get model for chat editor. resource: ${e.sessionResource}`);s!==sc&&this.hideLoadingInChatWidget(),t?.modelInputState&&l.model.inputModel.setState(t.modelInputState),this.updateModel(l.model);let c=this.loadEditorViewState(e,o);c&&(this._widget.scrollTop=c.scrollTop),r&&t?.title?.preferred&&e.sessionResource&&this.chatService.setChatSessionTitle(e.sessionResource,t.title.preferred)}catch(l){throw this.hideLoadingInChatWidget(),l}}updateModel(e){this.widget.setModel(e)}computeEditorViewState(e){if(this._widget)return{scrollTop:this._widget.scrollTop}}tracksEditorViewState(e){return e instanceof Na}toEditorViewStateResource(e){return e.sessionResource}layout(e,t){this.dimension=e,this.widget&&this.widget.layout(e.height,e.width)}};IN=I([m(1,Te),m(2,Le),m(3,F),m(4,ce),m(5,Us),m(6,X),m(7,mi),m(8,Fn),m(9,ee),m(10,wt)],IN);function nwo(){W(class extends K{constructor(){super({id:"workbench.action.chat.openInEditor",title:L(5868,"Move Chat into Editor Area"),category:Si,precondition:ie.enabled,f1:!0,menu:{id:D.ViewTitle,when:C.equals("view",Dr),order:0,group:"1_open"}})}async run(e,...t){let o=t[0];owo(e,"Editor",Bhe(o)?o.sessionResource:void 0)}}),W(class extends K{constructor(){super({id:"workbench.action.chat.openInNewWindow",title:L(5869,"Move Chat into New Window"),category:Si,precondition:ie.enabled,f1:!0,menu:{id:D.ViewTitle,when:C.equals("view",Dr),order:0,group:"1_open"}})}async run(e,...t){let o=t[0];owo(e,"Window",Bhe(o)?o.sessionResource:void 0)}}),W(class extends K{constructor(){super({id:"workbench.action.chat.openInSidebar",title:L(5873,"Move Chat into Side Bar"),category:Si,precondition:ie.enabled,f1:!0})}async run(e,...t){return Gan(e)}});function a(i,e,t,o){ve.appendMenuItem(i,{command:{id:"workbench.action.chat.openInSidebar",title:e,icon:t},when:C.and(fr.isEqualTo(Na.EditorID),o),group:i===D.CompactWindowEditorTitle?"navigation":void 0,order:0})}[D.EditorTitle,D.CompactWindowEditorTitle].forEach(i=>{a(i,d(5872,null),R.layoutSidebarRightDock,ie.panelLocation.isEqualTo(2)),a(i,d(5871,null),R.layoutSidebarLeftDock,ie.panelLocation.isEqualTo(0)),a(i,d(5870,null),R.layoutPanelDock,ie.panelLocation.isEqualTo(1))})}async function owo(a,i,e){let t=a.get(Pt),o={compact:!0,bounds:{width:800,height:640}},n=(e?t.getWidgetBySessionResource(e):void 0)??t.lastFocusedWidget;if(!n||!n.viewModel||n.location!=="panel"){await t.openSession(Na.getNewEditorUri(),i==="Window"?Mg:jn,{pinned:!0,auxiliary:o});return}let r=t.getWidgetBySessionResource(n.viewModel.sessionResource);if(!r){await t.openSession(Na.getNewEditorUri(),i==="Window"?Mg:jn,{pinned:!0,auxiliary:o});return}let s=n.viewModel.sessionResource,l=r.getViewState();await n.clear();let c={pinned:!0,modelInputState:l,auxiliary:o};await t.openSession(s,i==="Window"?Mg:jn,c)}async function Gan(a){let i=a.get($t),e=a.get(ee),t=a.get(wt),o=e.activeEditorPane,n=o?.input,r;if(o instanceof IN&&n instanceof Na&&n.sessionResource){let s=o.widget.getViewState();await e.closeEditor({editor:o.input,groupId:t.activeGroup.id}),r=await i.openView(Dr);let l=await r.loadSession(n.sessionResource);s&&l&&!l.inputModel.state.get()&&l.inputModel.setState(s)}else r=await i.openView(Dr);r.focus()}function PPi(a){if(a&&typeof a=="object"){let i=a;return!(i.inputValue!==void 0&&typeof i.inputValue!="string"||i.agentMode!==void 0&&typeof i.agentMode!="boolean"||i.isPartialQuery!==void 0&&typeof i.isPartialQuery!="boolean")}return!1}function rwo(){ve.appendMenuItem(D.ViewTitle,{submenu:D.ChatNewMenu,title:L(5876,"New Chat"),icon:R.plus,when:C.equals("view",Dr),group:"navigation",order:-1,isSplitButton:!0}),W(class extends K{constructor(){super({id:"workbench.action.chatEditor.newChat",title:L(5875,"New Chat"),icon:R.plus,f1:!1,precondition:ie.enabled})}async run(e,...t){await lqt(e)}}),W(class extends K{constructor(){super({id:Zm,title:L(5876,"New Chat"),category:Si,icon:R.plus,precondition:C.and(ie.enabled,ie.location.isEqualTo("panel")),f1:!0,menu:[{id:D.ChatContext,group:"z_clear"},{id:D.ChatNewMenu,group:"1_open",order:1,when:C.and(ie.newChatButtonExperimentIcon.notEqualsTo("copilot"),ie.newChatButtonExperimentIcon.notEqualsTo("new-session"),ie.newChatButtonExperimentIcon.notEqualsTo("comment"))}],keybinding:{weight:201,primary:2092,secondary:[2090],mac:{primary:2092,secondary:[298]},when:ie.inChatSession}})}async run(e,...t){let o=PPi(t[0])?t[0]:void 0,n=zhe(e,t);await APi(e,n,o)}});let a=[{idSuffix:".copilotIcon",iconValue:"copilot",icon:R.copilot},{idSuffix:".newSessionIcon",iconValue:"new-session",icon:R.newSession},{idSuffix:".commentIcon",iconValue:"comment",icon:R.comment}];for(let i of a)W(class extends K{constructor(){super({id:Zm+i.idSuffix,title:L(5876,"New Chat"),category:Si,icon:i.icon,precondition:C.and(ie.enabled,ie.location.isEqualTo("panel")),f1:!1,menu:[{id:D.ChatNewMenu,group:"1_open",order:1,when:ie.newChatButtonExperimentIcon.isEqualTo(i.iconValue)}]})}async run(e,...t){let o=PPi(t[0])?t[0]:void 0,n=zhe(e,t);await APi(e,n,o)}});$e.registerCommandAlias(rao,Zm),W(class extends K{constructor(){super({id:"workbench.action.chat.newLocalChat",title:L(5877,"New Local Chat"),category:Si,icon:R.plus,precondition:C.and(ie.enabled,ie.location.isEqualTo("panel")),f1:!1})}async run(e,...t){let o=PPi(t[0])?t[0]:void 0,n=zhe(e,t);await APi(e,n,o,"local")}}),ve.appendMenuItem(D.ChatViewSessionTitleNavigationToolbar,{command:{id:Zm,title:L(5874,"Go Back"),icon:R.arrowLeft},when:ie.agentSessionsViewerOrientation.notEqualsTo(2),group:"navigation",order:1}),ve.appendMenuItem(D.ChatTitleBarMenu,{command:{id:Zm,title:L(5876,"New Chat")},when:ie.enabled,group:"b_new",order:-1}),W(class extends sN{constructor(){super({id:"workbench.action.chat.undoEdit",title:L(5881,"Undo Last Edit"),category:Si,icon:R.discard,precondition:C.and(ie.chatEditingCanUndo,ie.enabled),f1:!0,menu:[{id:D.ViewTitle,when:C.equals("view",Dr),group:"navigation",order:-3,isHiddenByDefault:!0}]})}async runEditingSessionAction(e,t){await t.undoInteraction()}}),W(class extends sN{constructor(){super({id:"workbench.action.chat.redoEdit",title:L(5878,"Redo Last Edit"),category:Si,icon:R.redo,precondition:C.and(ie.chatEditingCanRedo,ie.enabled),f1:!0,menu:[{id:D.ViewTitle,when:C.equals("view",Dr),group:"navigation",order:-2,isHiddenByDefault:!0}]})}async runEditingSessionAction(e,t){let o=e.get(mi);await t.redoInteraction(),o.getSession(t.chatSessionResource)?.setCheckpoint(void 0)}}),W(class extends sN{constructor(){super({id:"workbench.action.chat.redoEdit2",title:L(5879,"Redo"),tooltip:L(5880,"Reapply discarded workspace changes and chat"),category:Si,precondition:C.and(ie.chatEditingCanRedo,ie.enabled),f1:!0,menu:[{id:D.ChatMessageRestoreCheckpoint,when:ie.lockedToCodingAgent.negate(),group:"navigation",order:-1}]})}async runEditingSessionAction(e,t){let o=e.get(Pt);for(;t.canRedo.get();)await t.redoInteraction();let n=o.getWidgetBySessionResource(t.chatSessionResource),r=n?.viewModel?.model.checkpoint?.message.text;n?.inputEditor.getValue()===r&&n?.input.setValue("",!1),n?.viewModel?.model.setCheckpoint(void 0),n?.focusInput()}})}async function APi(a,i,e,t){let o=a.get(Oi),n=a.get($t),r=a.get(B),{editingSession:s,chatWidget:l}=i??{};if(!l)return;let c=a.get(at),u=l.viewModel?.model;u&&!await kXe(u,void 0,c)||(await s?.stop(),await rOt(l,n,t),l.attachmentModel.clear(!0),l.focusInput(),o.alert(d(5882,null)),e&&(typeof e.agentMode=="boolean"?l.input.setChatMode(e.agentMode?"agent":"edit"):l.input.currentModeKind==="edit"&&r.getValue("chat.editMode.hidden")&&l.input.setChatMode("agent"),e.inputValue&&(e.isPartialQuery?l.setInput(e.inputValue):l.acceptInput(e.inputValue))))}function awo(){W(class extends K{constructor(){super({id:"workbench.action.chat.nextUserPrompt",title:L(5907,"Next User Prompt"),keybinding:{primary:2578,weight:200,when:ie.inChatSession},precondition:ie.enabled,f1:!0,category:Si})}run(i,...e){swo(i,!1)}}),W(class extends K{constructor(){super({id:"workbench.action.chat.previousUserPrompt",title:L(5908,"Previous User Prompt"),keybinding:{primary:2576,weight:200,when:ie.inChatSession},precondition:ie.enabled,f1:!0,category:Si})}run(i,...e){swo(i,!0)}})}function swo(a,i){let t=a.get(Pt).lastFocusedWidget;if(!t)return;let o=t.viewModel?.getItems();if(!o||o.length===0)return;let n=o.filter(u=>Sr(u));if(n.length===0)return;let r=t.getFocus(),s=-1;r&&(Sr(r)?s=n.findIndex(u=>u.id===r.id):Ui(r)&&(s=n.findIndex(u=>u.id===r.requestId)));let l;if(s===-1)l=i?n.length-1:0;else if(l=i?s-1:s+1,l<0?l=0:l>=n.length&&(l=n.length-1),l===s)return;let c=n[l];c&&(t.focus(c),t.reveal(c))}var lwo=ie.editingRequestType.isEqualTo(ie.EditingRequestType.Queue),cwo=ie.editingRequestType.isEqualTo(ie.EditingRequestType.Steer),WPi=C.or(lwo,cwo),mfe=C.and(C.or(ie.requestInProgress,WPi),ie.editingRequestType.notEqualsTo(ie.EditingRequestType.Sent)),dwo=C.equals("config.chat.requestQueuing.defaultAction","steer"),qan=dwo.negate(),uwo=C.or(C.and(qan,WPi.negate()),lwo),pwo=C.or(C.and(dwo,WPi.negate()),cwo);function $an(a){return!!a&&typeof a=="object"&&"sessionResource"in a&&"pendingRequestId"in a&&A.isUri(a.sessionResource)&&typeof a.pendingRequestId=="string"}var Soe=class a extends K{static{this.ID="workbench.action.chat.queueMessage"}constructor(){super({id:a.ID,title:L(5909,"Add to Queue"),tooltip:d(5910,null),icon:R.add,f1:!1,category:Si,precondition:C.and(mfe,ie.inputHasText),keybinding:[{when:C.and(ie.inChatInput,mfe,pwo),primary:515,weight:101},{when:C.and(ie.inChatInput,mfe,uwo),primary:3,weight:101}]})}run(i,...e){let o=i.get(Pt).lastFocusedWidget;!o?.viewModel||!o.getInput().trim()||o.acceptInput(void 0,{queue:"queued"})}},Ioe=class a extends K{static{this.ID="workbench.action.chat.steerWithMessage"}constructor(){super({id:a.ID,title:L(5915,"Steer with Message"),tooltip:d(5916,null),icon:R.arrowUp,f1:!1,category:Si,precondition:C.and(mfe,ie.inputHasText),keybinding:[{when:C.and(ie.inChatInput,mfe,pwo),primary:3,weight:101},{when:C.and(ie.inChatInput,mfe,uwo),primary:515,weight:101}]})}run(i,...e){let o=i.get(Pt).lastFocusedWidget;!o?.viewModel||!o.getInput().trim()||o.acceptInput(void 0,{queue:"steering"})}},NPi=class a extends K{static{this.ID="workbench.action.chat.removePendingRequest"}constructor(){super({id:a.ID,title:L(5913,"Remove from Queue"),icon:R.close,f1:!1,category:Si,menu:[{id:D.ChatMessageTitle,group:"navigation",order:4,when:C.and(ie.isRequest,ie.isPendingRequest)}]})}run(i,...e){let t=i.get(mi),[o]=e;if(Sr(o)&&o.pendingKind){t.removePendingRequest(o.sessionResource,o.id);return}if($an(o)){t.removePendingRequest(o.sessionResource,o.pendingRequestId);return}}},OPi=class a extends K{static{this.ID="workbench.action.chat.sendPendingImmediately"}constructor(){super({id:a.ID,title:L(5914,"Send Immediately"),icon:R.arrowUp,f1:!1,category:Si,menu:[{id:D.ChatMessageTitle,group:"navigation",order:3,when:C.and(ie.isRequest,ie.isPendingRequest)}]})}async run(i,...e){let t=i.get(mi),o=i.get(Pt),[n]=e;if(!Sr(n)||!n.pendingKind)return;let s=o.getWidgetBySessionResource(n.sessionResource)?.viewModel?.model;if(!s)return;let l=s.getPendingRequests(),c=l.findIndex(h=>h.request.id===n.id);if(c===-1)return;let u=l[c],p=[{requestId:u.request.id,kind:u.kind},...l.filter((h,g)=>g!==c).map(h=>({requestId:h.request.id,kind:h.kind}))];t.setPendingRequests(n.sessionResource,p),await t.cancelCurrentRequestForSession(n.sessionResource,"queueRunNext"),t.processPendingRequests(n.sessionResource)}},FPi=class a extends K{static{this.ID="workbench.action.chat.removeAllPendingRequests"}constructor(){super({id:a.ID,title:L(5912,"Remove All Queued"),icon:R.clearAll,f1:!1,category:Si,menu:[{id:D.ChatContext,group:"navigation",order:3,when:ie.hasPendingRequests}]})}run(i,...e){let t=i.get(mi),o=i.get(Pt),[n]=e,s=(Sr(n)&&o.getWidgetBySessionResource(n.sessionResource)||o.lastFocusedWidget)?.viewModel?.model;if(s)for(let l of[...s.getPendingRequests()])t.removePendingRequest(s.sessionResource,l.request.id)}};function mwo(){W(Soe),W(Ioe),W(NPi),W(OPi),W(FPi),ve.appendMenuItem(D.ChatExecuteQueue,{command:{id:Soe.ID,title:L(5909,"Add to Queue"),icon:R.add},group:"navigation",order:1}),ve.appendMenuItem(D.ChatExecuteQueue,{command:{id:Ioe.ID,title:L(5915,"Steer with Message"),icon:R.arrowUp},group:"navigation",order:2}),ve.appendMenuItem(D.ChatExecute,{submenu:D.ChatExecuteQueue,title:L(5911,"Queue"),icon:R.listOrdered,when:C.and(mfe,ie.inputHasText),group:"navigation",order:4})}var jan="chat.installRecommendationAvailable",hfe=class extends x{constructor(e,t,o,n){super();this.productService=e;this.extensionGalleryService=t;this.extensionManagementService=o;this.contextKeyService=n;this.availabilityContextKeys=new Map;this.refreshRequestId=0;let r=this.productService.chatSessionRecommendations;if(!r?.length||!this.extensionGalleryService.isEnabled())return;for(let l of r)this.registerRecommendation(l);let s=()=>this.refreshInstallAvailability();this._register(this.extensionManagementService.onProfileAwareDidInstallExtensions(s)),this._register(this.extensionManagementService.onProfileAwareDidUninstallExtension(s)),this._register(this.extensionManagementService.onDidChangeProfile(s)),this.refreshInstallAvailability()}static{this.ID="workbench.contrib.chatAgentRecommendation"}registerRecommendation(e){let t=Ii.toKey(e.extensionId),o=`chat.installRecommendation.${t}.${e.name}`,n=`${jan}.${t}`,r=new Y(n,!1).bindTo(this.contextKeyService);this.availabilityContextKeys.set(t,r);let s=L(5767,"New {0}",e.displayName);this._register(W(class extends K{constructor(){super({id:o,title:s,tooltip:e.description,f1:!1,category:Si,icon:R.extensions,menu:[{id:D.ChatNewMenu,group:"4_recommendations",when:C.equals(n,!0)}]})}async run(l){let c=l.get(ge),u=l.get(tt),p=l.get(mi),h=u.quality!=="stable";await c.executeCommand("workbench.extensions.installExtension",e.extensionId,{installPreReleaseVersion:h}),await Qan(c,p,e.postInstallCommand)}}))}refreshInstallAvailability(){if(!this.availabilityContextKeys.size)return;let e=++this.refreshRequestId;this.extensionManagementService.getInstalled().then(t=>{if(e!==this.refreshRequestId)return;let o=new Set(t.map(n=>Ii.toKey(n.identifier.id)));for(let[n,r]of this.availabilityContextKeys)r.set(!o.has(n))},()=>{if(e===this.refreshRequestId)for(let[,t]of this.availabilityContextKeys)t.set(!1)})}};hfe=I([m(0,tt),m(1,fa),m(2,ru),m(3,X)],hfe);async function Qan(a,i,e){if(e){await Yan(e),await i.activateDefaultAgent("panel");try{await a.executeCommand(e)}catch{}}}function Yan(a){return $e.getCommands().has(a)?Promise.resolve():new Promise(i=>{let e=new Ul,t=$e.onDidRegisterCommand(o=>{o===a&&(t.dispose(),e.dispose(),i())});e.cancelAndSet(()=>{t.dispose(),i()},1e4)})}var gfe=class extends x{static{this.ID="workbench.contrib.chatTransfer"}constructor(i){super(),i.checkAndSetTransferredWorkspaceTrust()}};gfe=I([m(0,a0e)],gfe);var Xan=Ae("chat-debug-editor-label-icon",R.bug,d(6729,null)),eE=class a extends ls{constructor(){super(...arguments);this.resource=a.RESOURCE}static{this.ID="workbench.editor.chatDebug"}static{this.RESOURCE=A.from({scheme:"chat-debug",path:"default"})}static get instance(){return(!a._instance||a._instance.isDisposed())&&(a._instance=new a),a._instance}get typeId(){return a.ID}get editorId(){return a.ID}get capabilities(){return 10}getName(){return d(6730,null)}getIcon(){return Xan}matches(e){return super.matches(e)?!0:e instanceof a}},cqt=class{canSerialize(i){return!0}serialize(i){return""}deserialize(i){return eE.instance}};function hwo(){W(class extends K{constructor(){super({id:"workbench.action.chat.openAgentDebugPanel",title:L(5885,"Open Agent Debug Logs"),f1:!0,category:Ve.Developer,precondition:ie.enabled})}async run(t){let o=t.get(ee),n=t.get(Yp);n.activeSessionResource=void 0;let r={pinned:!0,viewHint:"home"};await o.openEditor(eE.instance,r)}}),W(class extends K{constructor(){super({id:"workbench.action.chat.openAgentDebugPanelForSession",title:L(5886,"Show Agent Debug Logs"),f1:!1,category:Si,precondition:ie.enabled,menu:[{id:ky,when:C.and(ie.enabled,C.equals("view",Dr)),order:0,group:"4_logs"},{id:D.ChatWelcomeContext,group:"2_settings",order:0,when:ie.inChatEditor.negate()},{id:D.ViewTitle,when:C.and(ie.enabled,C.equals("view",Dr),C.has("config.chat.customizationsMenu.enabled")),order:0,group:"4_logs"}]})}async run(t,o,n){let r=t.get(ee),s=t.get(Pt),l=t.get(Yp),c;A.isUri(o)?c=o:Bhe(o)&&(c=o.sessionResource),c||(c=s.lastFocusedWidget?.viewModel?.sessionResource),l.activeSessionResource=c;let u={pinned:!0,sessionResource:c,viewHint:"logs",filter:n};await r.openEditor(eE.instance,u)}});let a="agent-debug-log.json",i=[{name:d(5889,null),extensions:["json"]}];W(class extends K{constructor(){super({id:"workbench.action.chat.exportAgentDebugLog",title:L(5883,"Export Agent Debug Log..."),icon:R.chatExport,f1:!0,category:Ve.Developer,precondition:ie.enabled,menu:[{id:D.EditorTitle,group:"navigation",when:fr.isEqualTo(eE.ID),order:10}]})}async run(t){let o=t.get(Yp),n=t.get(rn),r=t.get(fe),s=t.get(Ne),l=t.get(Je),c=t.get(Te),u=o.activeSessionResource;if(!u){s.notify({severity:ft.Info,message:d(5893,null)});return}let g=(Jr.parseLocalSessionId(u)??(u.path.replace(/^\//,"")||u.authority))?.replace(/[/\\:*?"<>|.]+/g,"_").replace(/^_+|_+$/g,""),f=g?`agent-debug-log-${g}.json`:a,v=Ge(await n.defaultFilePath(),f),b=await n.showSaveDialog({defaultUri:v,filters:i});if(!b)return;let S=await o.exportLog(u);if(!S){s.notify({severity:ft.Warning,message:d(5887,null)});return}await r.writeFile(b,qe.wrap(S)),c.publicLog2("chatDebugLogExported",{fileSizeBytes:S.byteLength}),s.prompt(ft.Info,d(5888,null),[{label:d(5894,null),run:()=>l.open(b)}])}}),W(class extends K{constructor(){super({id:"workbench.action.chat.importAgentDebugLog",title:L(5884,"Import Agent Debug Log..."),icon:R.chatImport,f1:!0,category:Ve.Developer,precondition:ie.enabled,menu:[{id:D.EditorTitle,group:"navigation",when:fr.isEqualTo(eE.ID),order:11}]})}async run(t){let o=t.get(Yp),n=t.get(at),r=t.get(ee),s=t.get(rn),l=t.get(fe),c=t.get(Ne),u=t.get(Te),p=Ge(await s.defaultFilePath(),a),h=await s.showOpenDialog({defaultUri:p,canSelectFiles:!0,filters:i});if(!h)return;let g=50*1024*1024,f=await l.stat(h[0]);if(f.size!==void 0&&f.size>g){u.publicLog2("chatDebugLogImported",{fileSizeBytes:f.size,result:"fileTooLarge"}),await n.warn(d(5891,null),d(5890,null,(f.size/(1024*1024)).toFixed(1)));return}let v=await l.readFile(h[0]),b=await o.importLog(v.value.buffer);if(!b){u.publicLog2("chatDebugLogImported",{fileSizeBytes:v.value.byteLength,result:"providerFailed"}),c.notify({severity:ft.Warning,message:d(5892,null)});return}u.publicLog2("chatDebugLogImported",{fileSizeBytes:v.value.byteLength,result:"success"});let S={pinned:!0,sessionResource:b,viewHint:"overview"};await r.openEditor(eE.instance,S)}})}var VPi=class{constructor(i){this.capacity=i;this._head=0;this._size=0;this._buffer=new Array(i)}get size(){return this._size}push(i){let e=(this._head+this._size)%this.capacity;this._buffer[e]=i,this._size<this.capacity?this._size++:this._head=(this._head+1)%this.capacity}toArray(){let i=[];for(let e=0;e<this._size;e++){let t=this._buffer[(this._head+e)%this.capacity];t&&i.push(t)}return i}removeWhere(i){let e=0;for(let t=0;t<this._size;t++){let o=(this._head+t)%this.capacity,n=this._buffer[o];if(!(n&&i(n))){if(e!==t){let r=(this._head+e)%this.capacity;this._buffer[r]=n}e++}}for(let t=e;t<this._size;t++)this._buffer[(this._head+t)%this.capacity]=void 0;this._size=e}clear(){this._buffer.fill(void 0),this._head=0,this._size=0}},dqt=class a extends x{constructor(){super(...arguments);this._sessionBuffers=new gt;this._sessionOrder=[];this._onDidAddEvent=this._register(new E);this.onDidAddEvent=this._onDidAddEvent.event;this._onDidClearProviderEvents=this._register(new E);this.onDidClearProviderEvents=this._onDidClearProviderEvents.event;this._onDidAttachDebugData=this._register(new E);this.onDidAttachDebugData=this._onDidAttachDebugData.event;this._debugDataAttachedSessions=new gt;this._providers=new Set;this._invocationCts=new gt;this._providerEvents=new WeakSet;this._importedSessions=new gt;this._importedSessionTitles=new gt}static{this.MAX_EVENTS_PER_SESSION=1e4}static{this.MAX_SESSIONS=5}static{this._debugEligibleSchemes=new Set([Jr.scheme,"copilotcli","claude-code"])}_isDebugEligibleSession(e){return a._debugEligibleSchemes.has(e.scheme)||this._importedSessions.has(e)}log(e,t,o,n=1,r){this._isDebugEligibleSession(e)&&this.addEvent({kind:"generic",id:r?.id,sessionResource:e,created:new Date,name:t,details:o,level:n,category:r?.category,parentEventId:r?.parentEventId})}addEvent(e){let t=this._sessionBuffers.get(e.sessionResource);if(t){let o=this._sessionOrder.findIndex(n=>ar.isEqual(n,e.sessionResource));o!==-1&&o!==this._sessionOrder.length-1&&(this._sessionOrder.splice(o,1),this._sessionOrder.push(e.sessionResource))}else{if(this._sessionOrder.length>=a.MAX_SESSIONS){let o=this._sessionOrder.shift();this._evictSession(o)}t=new VPi(a.MAX_EVENTS_PER_SESSION),this._sessionBuffers.set(e.sessionResource,t),this._sessionOrder.push(e.sessionResource)}t.push(e),this._onDidAddEvent.fire(e)}addProviderEvent(e){this._providerEvents.add(e),this.addEvent(e)}getEvents(e){let t;if(e){let o=this._sessionBuffers.get(e);t=o?o.toArray():[]}else{t=[];for(let o of this._sessionBuffers.values())t.push(...o.toArray())}return t.sort((o,n)=>o.created.getTime()-n.created.getTime()),t}getSessionResources(){return[...this._sessionOrder]}clear(){this._sessionBuffers.clear(),this._sessionOrder.length=0,this._debugDataAttachedSessions.clear(),this._importedSessions.clear(),this._importedSessionTitles.clear()}_evictSession(e){this._sessionBuffers.delete(e),this._importedSessions.delete(e),this._importedSessionTitles.delete(e),this._debugDataAttachedSessions.delete(e);let t=this._invocationCts.get(e);t&&(t.cancel(),t.dispose(),this._invocationCts.delete(e))}registerProvider(e){this._providers.add(e);for(let[t,o]of this._invocationCts)o.token.isCancellationRequested||this._invokeProvider(e,t,o.token).catch(mt);return Z(()=>{this._providers.delete(e)})}hasInvokedProviders(e){return this._invocationCts.has(e)}async invokeProviders(e){if(!this._isDebugEligibleSession(e))return;let t=this._invocationCts.get(e);t&&(t.cancel(),t.dispose()),this._clearProviderEvents(e);let o=new Ye;this._invocationCts.set(e,o);try{let n=[...this._providers].map(r=>this._invokeProvider(r,e,o.token));await Promise.allSettled(n)}catch(n){mt(n)}}async _invokeProvider(e,t,o){try{let n=await e.provideChatDebugLog(t,o);if(n)for(let s=0;s<n.length&&!o.isCancellationRequested;s++)this.addProviderEvent({...n[s],sessionResource:n[s].sessionResource??t}),s>0&&s%500===0&&await Li(0)}catch(n){mt(n)}}endSession(e){let t=this._invocationCts.get(e);t&&(t.cancel(),t.dispose(),this._invocationCts.delete(e)),this._debugDataAttachedSessions.delete(e)}_clearProviderEvents(e){let t=this._sessionBuffers.get(e);t&&t.removeWhere(o=>this._providerEvents.has(o)),this._onDidClearProviderEvents.fire(e)}markDebugDataAttached(e){this._debugDataAttachedSessions.has(e)||(this._debugDataAttachedSessions.set(e,!0),this._onDidAttachDebugData.fire(e))}hasAttachedDebugData(e){return this._debugDataAttachedSessions.has(e)}async resolveEvent(e){for(let t of this._providers)if(t.resolveChatDebugLogEvent)try{let o=await t.resolveChatDebugLogEvent(e,Se.None);if(o!==void 0)return o}catch(o){mt(o)}}isCoreEvent(e){return!this._providerEvents.has(e)}setImportedSessionTitle(e,t){this._importedSessionTitles.set(e,t)}getImportedSessionTitle(e){return this._importedSessionTitles.get(e)}async exportLog(e){for(let t of this._providers)if(t.provideChatDebugLogExport)try{let o=await t.provideChatDebugLogExport(e,Se.None);if(o!==void 0)return o}catch(o){mt(o)}}async importLog(e){for(let t of this._providers)if(t.resolveChatDebugLogImport)try{let o=await t.resolveChatDebugLogImport(e,Se.None);if(o!==void 0)return this._importedSessions.set(o,!0),o}catch(o){mt(o)}}dispose(){for(let e of this._invocationCts.values())e.cancel(),e.dispose();this._invocationCts.clear(),this.clear(),this._providers.clear(),super.dispose()}};var Jan=_;var uqt=new Y("chatDebugFilterActive",!1),pqt=new Y("chatDebug.kindToolCall",!0),mqt=new Y("chatDebug.kindModelTurn",!0),hqt=new Y("chatDebug.kindPromptDiscovery",!0),gqt=new Y("chatDebug.kindSubagent",!0),fwo="chatDebug.filter.toggleToolCall",vwo="chatDebug.filter.toggleModelTurn",bwo="chatDebug.filter.togglePromptDiscovery",Swo="chatDebug.filter.toggleSubagent",$T=class a extends ree{constructor(e,t=!1){super();this._text=e;this._isLink=t}equals(e){return e instanceof a&&e._text===this._text}dispose(){}render(e){e.classList.add("chat-debug-breadcrumb-item"),this._isLink&&e.classList.add("chat-debug-breadcrumb-item-link"),M(e,Jan("span.chat-debug-breadcrumb-item-label",void 0,this._text))}};function SWe(a,i){return j(a,re.KEY_DOWN,e=>{switch(e.key){case"ArrowLeft":e.preventDefault(),i.focusPrev();break;case"ArrowRight":e.preventDefault(),i.focusNext();break;case"Home":e.preventDefault(),i.setFocused(i.getItems()[0]);break;case"End":{e.preventDefault();let t=i.getItems();i.setFocused(t[t.length-1]);break}case"Enter":case" ":{e.preventDefault();let t=i.getFocused();t&&i.setSelection(t);break}}})}var fqt=class extends x{constructor(){super(...arguments);this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this.filterKindToolCall=!0;this.filterKindModelTurn=!0;this.filterKindPromptDiscovery=!0;this.filterKindSubagent=!0;this.textFilter=""}isKindVisible(e,t){switch(e){case"toolCall":return this.filterKindToolCall;case"modelTurn":return this.filterKindModelTurn;case"generic":return t!=="discovery"?!0:this.filterKindPromptDiscovery;case"subagentInvocation":return this.filterKindSubagent;default:return!0}}isAllKindsVisible(){return this.filterKindToolCall&&this.filterKindModelTurn&&this.filterKindPromptDiscovery&&this.filterKindSubagent}isAllFiltersDefault(){return this.isAllKindsVisible()}setTextFilter(e){let t=e.toLowerCase();this.textFilter!==t&&(this.textFilter=t,this.beforeTimestamp=brt(t,"before"),this.afterTimestamp=brt(t,"after"),this._onDidChange.fire())}get textFilterWithoutTimestamps(){return gMi(this.textFilter)}isTimestampVisible(e){let t=e.getTime();return!(this.beforeTimestamp!==void 0&&t>this.beforeTimestamp||this.afterTimestamp!==void 0&&t<this.afterTimestamp)}fire(){this._onDidChange.fire()}};function Iwo(a,i){let e=new N;uqt.bindTo(i).set(!0);let t=pqt.bindTo(i);t.set(!0);let o=mqt.bindTo(i);o.set(!0);let n=hqt.bindTo(i);n.set(!0);let r=gqt.bindTo(i);r.set(!0);let s=(l,c,u,p,h,g,f)=>{e.add($e.registerCommand(l,()=>{let v=!h();g(v),f.set(v),a.fire()})),e.add(ve.appendMenuItem(ex,{command:{id:l,title:c,toggled:u},group:p,when:uqt}))};return s(fwo,d(6756,null),pqt,"1_kind",()=>a.filterKindToolCall,l=>{a.filterKindToolCall=l},t),s(vwo,d(6753,null),mqt,"1_kind",()=>a.filterKindModelTurn,l=>{a.filterKindModelTurn=l},o),s(bwo,d(6754,null),hqt,"1_kind",()=>a.filterKindPromptDiscovery,l=>{a.filterKindPromptDiscovery=l},n),s(Swo,d(6755,null),gqt,"1_kind",()=>a.filterKindSubagent,l=>{a.filterKindSubagent=l},r),e}function vqt(a,i){uqt.bindTo(i).set(!0);let e=pqt.bindTo(i),t=mqt.bindTo(i),o=hqt.bindTo(i),n=gqt.bindTo(i);return()=>{e.set(a.filterKindToolCall),t.set(a.filterKindModelTurn),o.set(a.filterKindPromptDiscovery),n.set(a.filterKindSubagent)}}var dq=_,IWe=class extends x{constructor(e,t,o,n,r,s){super();this.chatService=t;this.chatDebugService=o;this.chatWidgetService=n;this.configurationService=r;this.preferencesService=s;this._onNavigateToSession=this._register(new E);this.onNavigateToSession=this._onNavigateToSession.event;this.renderDisposables=this._register(new N);this.container=M(e,dq(".chat-debug-home")),this.scrollContent=M(this.container,dq("div.chat-debug-home-content")),this._register(this.configurationService.onDidChangeConfiguration(l=>{l.affectsConfiguration(BR)&&this.render()}))}show(){this.container.style.display="",this.render()}hide(){this.container.style.display="none"}render(){if(Rt(this.scrollContent),this.renderDisposables.clear(),M(this.scrollContent,dq("h2.chat-debug-home-title",void 0,d(6798,null))),!this.configurationService.getValue(BR)){M(this.scrollContent,dq("p.chat-debug-home-subtitle",void 0,d(6790,null)));let s=this.renderDisposables.add(new Wi(this.scrollContent,{...Qo,secondary:!0}));s.element.style.width="auto",s.label=d(6795,null),this.renderDisposables.add(s.onDidClick(()=>{this.preferencesService.openSettings({jsonEditor:!1,query:BR})}));return}let o=this.chatWidgetService.lastFocusedWidget?.viewModel?.sessionResource,n=new Set(["copilotcli","claude-code"]),r=[...this.chatDebugService.getSessionResources()].reverse().filter(s=>!n.has(gl(s))||!TK(s));if(o){let s=r.findIndex(l=>l.toString()===o.toString());s>0&&(r.splice(s,1),r.unshift(o))}if(M(this.scrollContent,dq("p.chat-debug-home-subtitle",void 0,r.length>0?d(6791,null):d(6794,null))),r.length>0){let s=M(this.scrollContent,dq(".chat-debug-home-session-list"));s.setAttribute("role","list"),s.setAttribute("aria-label",d(6797,null));let l=[];for(let c of r){let u=this.chatService.getSessionTitle(c),p=this.chatDebugService.getImportedSessionTitle(c),h;if(u&&!bbt(u))h=u;else if(Jr.isLocalSession(c))h=d(6793,null);else if(p)h=d(6792,null,p);else if(gl(c)==="copilotcli"){let y=c.path.replace(/^\//,"").split("-")[0]||c.authority||c.toString();h=d(6789,null,y)}else if(gl(c)==="claude-code"){let y=c.path.replace(/^\//,"").split("-")[0]||c.authority||c.toString();h=d(6788,null,y)}else h=d(6793,null);let g=o!==void 0&&c.toString()===o.toString(),f=M(s,dq("button.chat-debug-home-session-item"));f.setAttribute("role","listitem"),g&&(f.classList.add("chat-debug-home-session-item-active"),f.setAttribute("aria-current","true")),M(f,dq(`span${q.asCSSSelector(R.comment)}`));let v=M(f,dq("span.chat-debug-home-session-item-title"));v.textContent=h;let b=g?d(6796,null,h):h;f.setAttribute("aria-label",b),g&&M(f,dq("span.chat-debug-home-session-badge",void 0,d(6787,null))),this.renderDisposables.add(j(f,re.CLICK,()=>{this._onNavigateToSession.fire(c)})),l.push(f)}this.renderDisposables.add(j(s,re.KEY_DOWN,c=>{if(l.length===0)return;let u=Nn(),p=l.indexOf(u);if(p===-1)return;let h;switch(c.key){case"ArrowDown":h=p+1<l.length?p+1:p;break;case"ArrowUp":h=p-1>=0?p-1:p;break;case"Home":h=0;break;case"End":h=l.length-1;break}h!==void 0&&(c.preventDefault(),l[h].focus())}))}}};IWe=I([m(1,mi),m(2,Yp),m(3,Pt),m(4,B),m(5,Go)],IWe);var Rf=_,Zan=Jc.NumberFormat();var yWe=class extends x{constructor(e,t,o,n,r){super();this.chatService=t;this.chatDebugService=o;this.chatWidgetService=n;this.chatSessionsService=r;this._onNavigate=this._register(new E);this.onNavigate=this._onNavigate.event;this.loadDisposables=this._register(new N);this.isFirstLoad=!0;this.container=M(e,Rf(".chat-debug-overview")),vo(this.container),this.refreshScheduler=this._register(new Dt(()=>this.doRefresh(),100));let s=M(this.container,Rf(".chat-debug-breadcrumb"));this.breadcrumbWidget=this._register(new K2(s,3,void 0,R.chevronRight,Tz)),this._register(SWe(s,this.breadcrumbWidget)),this._register(this.breadcrumbWidget.onDidSelectItem(l=>{l.type==="select"&&l.item instanceof $T&&(this.breadcrumbWidget.setSelection(void 0),this.breadcrumbWidget.getItems().indexOf(l.item)===0&&this._onNavigate.fire("home"))})),this.content=M(this.container,Rf(".chat-debug-overview-content"))}setSession(e){this.currentSessionResource=e,this.isFirstLoad=!0}show(){un(this.container),this.load()}hide(){vo(this.container),this.refreshScheduler.cancel()}refresh(){this.container.style.display!=="none"&&(this.refreshScheduler.isScheduled()||this.refreshScheduler.schedule())}doRefresh(){if(this.metricsContainer&&this.currentSessionResource){Rt(this.metricsContainer);let e=this.chatDebugService.getEvents(this.currentSessionResource);this.renderMetricsContent(this.metricsContainer,e),this.isFirstLoad=!1}else this.load()}updateBreadcrumb(){if(!this.currentSessionResource)return;let e=this.chatService.getSessionTitle(this.currentSessionResource)||Jr.parseLocalSessionId(this.currentSessionResource)||this.currentSessionResource.toString();this.breadcrumbWidget.setItems([new $T(d(6888,null),!0),new $T(e)])}load(){if(Rt(this.content),this.loadDisposables.clear(),this.updateBreadcrumb(),!this.currentSessionResource)return;let e=this.chatService.getSessionTitle(this.currentSessionResource)||Jr.parseLocalSessionId(this.currentSessionResource)||this.currentSessionResource.toString(),t=M(this.content,Rf(".chat-debug-overview-title-row")),o=M(t,Rf("h2.chat-debug-overview-title"));M(o,Rf(`span${q.asCSSSelector(R.comment)}`)),o.append(e);let n=M(t,Rf(".chat-debug-overview-title-actions")),r=this.loadDisposables.add(new Wi(n,{ariaLabel:d(6882,null),title:d(6882,null)}));r.element.classList.add("chat-debug-icon-button"),r.icon=R.goToFile,this.loadDisposables.add(r.onDidClick(()=>{this.currentSessionResource&&this.chatWidgetService.openSession(this.currentSessionResource)})),this.renderSessionDetails(this.currentSessionResource);let s=this.chatDebugService.getEvents(this.currentSessionResource);this.renderDerivedOverview(s,this.isFirstLoad&&s.length===0),this.isFirstLoad=!1}renderSessionDetails(e){let t=this.chatService.getSession(e),o=[],n=gl(e),s=this.chatSessionsService.getChatSessionContribution(n)?.displayName||(n===sc?d(6884,null):n);if(o.push({label:d(6870,null),value:s}),t){let l=this.getLocationLabel(t.initialLocation);o.push({label:d(6869,null),value:l});let u=t.requestInProgress.get()?d(6886,null):d(6885,null);o.push({label:d(6871,null),value:u});let p=t.timing;o.push({label:d(6867,null),value:new Date(p.created).toLocaleString()}),p.lastRequestEnded?o.push({label:d(6868,null),value:new Date(p.lastRequestEnded).toLocaleString()}):p.lastRequestStarted&&o.push({label:d(6868,null),value:new Date(p.lastRequestStarted).toLocaleString()})}if(o.length>0){let l=M(this.content,Rf(".chat-debug-overview-section"));M(l,Rf("h3.chat-debug-overview-section-label",void 0,d(6883,null)));let c=M(l,Rf(".chat-debug-overview-details"));for(let u of o){let p=M(c,Rf(".chat-debug-overview-detail-row"));M(p,Rf("span.chat-debug-overview-detail-label",void 0,u.label)),M(p,Rf("span.chat-debug-overview-detail-value",void 0,u.value))}}}getLocationLabel(e){switch(e){case"panel":return d(6873,null);case"terminal":return d(6876,null);case"notebook":return d(6875,null);case"editor":return d(6874,null);default:return String(e)}}renderDerivedOverview(e,t){let o=M(this.content,Rf(".chat-debug-overview-section"));M(o,Rf("h3.chat-debug-overview-section-label",void 0,d(6887,null))),this.metricsContainer=M(o,Rf(".chat-debug-overview-metrics")),t?this.renderMetricsShimmer(this.metricsContainer):this.renderMetricsContent(this.metricsContainer,e);let n=M(this.content,Rf(".chat-debug-overview-section"));M(n,Rf("h3.chat-debug-overview-section-label",void 0,d(6872,null)));let r=M(n,Rf(".chat-debug-overview-actions")),s=this.loadDisposables.add(new Wi(r,{...Qo,secondary:!0,supportIcons:!0,title:d(6889,null)}));s.element.classList.add("chat-debug-overview-action-button"),s.label=`$(list-flat) ${d(6889,null)}`,this.loadDisposables.add(s.onDidClick(()=>{this._onNavigate.fire("logs")}));let l=this.loadDisposables.add(new Wi(r,{...Qo,secondary:!0,supportIcons:!0,title:d(6866,null)}));l.element.classList.add("chat-debug-overview-action-button"),l.label=`$(type-hierarchy) ${d(6866,null)}`,this.loadDisposables.add(l.onDidClick(()=>{this._onNavigate.fire("flowchart")}))}renderMetricsShimmer(e){let t=[d(6878,null),d(6879,null),d(6881,null),d(6877,null),d(6880,null)];for(let o of t){let n=M(e,Rf(".chat-debug-overview-metric-card"));M(n,Rf("div.chat-debug-overview-metric-label",void 0,o));let r=M(n,Rf("div.chat-debug-overview-metric-value")),s=M(r,Rf("span.chat-debug-overview-metric-shimmer"));s.textContent="\xA0"}}renderMetricsContent(e,t){let o=t.filter(c=>c.kind==="modelTurn"),n=t.filter(c=>c.kind==="toolCall"),r=t.filter(c=>c.kind==="generic"&&c.level===3||c.kind==="toolCall"&&c.result==="error"),s=o.reduce((c,u)=>c+(u.totalTokens??0),0),l=[{label:d(6878,null),value:String(o.length)},{label:d(6879,null),value:String(n.length)},{label:d(6881,null),value:Zan.value.format(s)},{label:d(6877,null),value:String(r.length)},{label:d(6880,null),value:String(t.length)}];for(let c of l){let u=M(e,Rf(".chat-debug-overview-metric-card"));M(u,Rf("div.chat-debug-overview-metric-label",void 0,c.label)),M(u,Rf("div.chat-debug-overview-metric-value",void 0,c.value))}}};yWe=I([m(1,mi),m(2,Yp),m(3,Pt),m(4,Us)],yWe);var BPi=_;function uU(a,i=""){return a==null||typeof a!="string"?i:a}var eln=Jc.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit"}),tln=Jc.NumberFormat();function HPi(a){return eln.value.format(a.created)}function Sqt(a){switch(a.kind){case"toolCall":return uU(a.toolName,d(6751,null));case"modelTurn":return uU(a.model)||d(6749,null);case"generic":return uU(a.name,d(6751,null));case"subagentInvocation":return uU(a.agentName,d(6751,null));case"userMessage":return d(6752,null);case"agentResponse":return d(6748,null)}}function UPi(a){switch(a.kind){case"toolCall":return uU(a.result);case"modelTurn":return[uU(a.requestName),a.totalTokens!==void 0?d(6750,null,tln.value.format(a.totalTokens)):""].filter(Boolean).join(" \xB7 ");case"generic":return uU(a.details);case"subagentInvocation":return uU(a.description)||uU(a.status);case"userMessage":return uU(a.message);case"agentResponse":return uU(a.message)}}function ywo(a,i){i.created.textContent=HPi(a),i.name.textContent=Sqt(a),i.details.textContent=UPi(a);let e=a.kind==="generic"&&a.level===3||a.kind==="toolCall"&&a.result==="error",t=a.kind==="generic"&&a.level===2,o=a.kind==="generic"&&a.level===0;i.container.classList.toggle("chat-debug-log-error",e),i.container.classList.toggle("chat-debug-log-warning",t),i.container.classList.toggle("chat-debug-log-trace",o)}function wwo(a){a.classList.add("chat-debug-log-row");let i=M(a,BPi("span.chat-debug-log-created")),e=M(a,BPi("span.chat-debug-log-name")),t=M(a,BPi("span.chat-debug-log-details"));return{container:a,created:i,name:e,details:t}}var Grt=class a{static{this.TEMPLATE_ID="chatDebugEvent"}get templateId(){return a.TEMPLATE_ID}renderTemplate(i){return wwo(i)}renderElement(i,e,t){ywo(i,t)}disposeTemplate(i){}},qrt=class{getHeight(i){return 28}getTemplateId(i){return Grt.TEMPLATE_ID}},bqt=class a{static{this.TEMPLATE_ID="chatDebugEvent"}get templateId(){return a.TEMPLATE_ID}renderTemplate(i){return wwo(i)}renderElement(i,e,t){ywo(i.element,t)}disposeTemplate(i){}};var yoe=Jc.NumberFormat();function Cwo(a){switch(a.kind){case"toolCall":{let i=[d(6744,null,a.toolName)];return a.toolCallId&&i.push(d(6733,null,a.toolCallId)),a.result&&i.push(d(6742,null,a.result)),a.durationInMillis!==void 0&&i.push(d(6735,null,yoe.value.format(a.durationInMillis))),a.input&&i.push(`
${d(6736,null)}
${a.input}`),a.output&&i.push(`
${d(6740,null)}
${a.output}`),i.join(`
`)}case"modelTurn":{let i=[a.model??d(6738,null)];return a.inputTokens!==void 0&&i.push(d(6737,null,yoe.value.format(a.inputTokens))),a.outputTokens!==void 0&&i.push(d(6741,null,yoe.value.format(a.outputTokens))),a.totalTokens!==void 0&&i.push(d(6746,null,yoe.value.format(a.totalTokens))),a.durationInMillis!==void 0&&i.push(d(6735,null,yoe.value.format(a.durationInMillis))),i.join(`
`)}case"generic":return`${a.name}
${a.details??""}`;case"subagentInvocation":{let i=[d(6731,null,a.agentName)];return a.description&&i.push(d(6734,null,a.description)),a.status&&i.push(d(6743,null,a.status)),a.durationInMillis!==void 0&&i.push(d(6735,null,yoe.value.format(a.durationInMillis))),a.toolCallCount!==void 0&&i.push(d(6745,null,yoe.value.format(a.toolCallCount))),a.modelTurnCount!==void 0&&i.push(d(6739,null,yoe.value.format(a.modelTurnCount))),i.join(`
`)}case"userMessage":{let i=[d(6747,null,a.message)];for(let e of a.sections)i.push(`
--- ${e.name} ---
${e.content}`);return i.join(`
`)}case"agentResponse":{let i=[d(6732,null,a.message)];for(let e of a.sections)i.push(`
--- ${e.name} ---
${e.content}`);return i.join(`
`)}}}function Iqt(a,i,e,t,o=!1,n){let r=o;i.tabIndex=0,i.role="button",a.setAttribute("aria-hidden","true");let s=()=>{Rt(a);let l=r?R.chevronRight:R.chevronDown;a.classList.add(...q.asClassName(l).split(" ")),e.style.display=r?"none":"block",i.style.borderRadius=r?"":"3px 3px 0 0",i.setAttribute("aria-expanded",String(!r))};s(),t.add(j(i,re.CLICK,()=>{r=!r,a.className="chat-debug-message-section-chevron",s(),n?.scanDomNode()})),t.add(j(i,re.KEY_DOWN,l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),i.click())}))}var Bm=_;function iln(a){switch(a){case"prompt":return"chat.promptFilesLocations";case"instructions":return"chat.instructionsFilesLocations";case"agent":return"chat.agentFilesLocations";case"skill":return"chat.agentSkillsLocations";case"hook":return"chat.hookFilesLocations";default:return}}function oln(a,i,e){if(a.extensionId)return a.extensionId;let t=e==="skill"?ci(ci(a.uri)):ci(a.uri);return i.getUriLabel(t,{relative:!0})}function xwo(a,i,e,t,o,n,r,s,l,c){let u=Bm(`a.${YH.className}.show-file-icons`);u.tabIndex=-1;let p=M(u,Bm("span.icon")),h=aa(o,n,a,e);p.classList.add(...h),M(u,Bm("span.icon-label",void 0,i));let g=s.getUriLabel(a,{relative:!0}),f=c?`${g} ${c}`:g;return l.add(r.setupManagedHover(Ri("element"),u,f)),l.add(j(u,re.CLICK,v=>{v.preventDefault(),v.stopPropagation(),t.open(a)})),u}function kwo(a,i,e){if(i.length!==0){for(let t=0;t<i.length;t++)i[t].element.tabIndex=t===0?0:-1,i[t].element.setAttribute("role","listitem");e.add(j(a,re.KEY_DOWN,t=>{let o=t.target,n=i.findIndex(s=>s.element===o);if(n===-1)return;let r;switch(t.key){case"ArrowDown":r=Math.min(n+1,i.length-1);break;case"ArrowUp":r=Math.max(n-1,0);break;case"Home":r=0;break;case"End":r=i.length-1;break;case"Enter":{i[n].activate(),t.preventDefault();return}}r!==void 0&&r!==n&&(t.preventDefault(),i[n].element.tabIndex=-1,i[r].element.tabIndex=0,i[r].element.focus())}))}}function Ewo(a,i,e,t,o,n,r){let s=new N,l=Bm("div.chat-debug-file-list");l.tabIndex=0;let c=a.discoveryType.charAt(0).toUpperCase()+a.discoveryType.slice(1);M(l,Bm("div.chat-debug-file-list-title",void 0,d(6704,null,c))),M(l,Bm("div.chat-debug-file-list-summary",void 0,d(6722,null,a.files.length)));let u=a.files.filter(h=>h.status==="loaded");if(u.length>0){let h=M(l,Bm("div.chat-debug-file-list-section"));M(h,Bm("div.chat-debug-file-list-section-title",void 0,d(6706,null,u.length)));let g=new Map;for(let b of u){let S=oln(b,n,a.discoveryType),y=g.get(S);y||(y=[],g.set(S,y)),y.push(b)}let f=M(h,Bm("div.chat-debug-file-list-rows"));f.setAttribute("role","list"),f.setAttribute("aria-label",d(6707,null));let v=[];for(let[b,S]of g){let y=M(f,Bm("div.chat-debug-file-list-group-header")),w=S[0];if(w.extensionId){let k=M(y,Bm("a.chat-debug-file-list-group-label.chat-debug-file-list-badge-link"));k.textContent=b,k.tabIndex=-1,s.add(o.setupManagedHover(Ri("element"),k,d(6708,null,w.extensionId))),s.add(j(k,re.CLICK,T=>{T.preventDefault(),T.stopPropagation(),i.open(A.parse(`command:extension.open?${encodeURIComponent(JSON.stringify([w.extensionId]))}`),{allowCommands:!0})}))}else M(y,Bm("span.chat-debug-file-list-group-label",void 0,b));for(let k of S){let T=M(f,Bm("div.chat-debug-file-list-row"));M(T,Bm(`span.chat-debug-file-list-icon${q.asCSSSelector(R.check)}`)),T.appendChild(xwo(k.uri,k.name??k.uri.path,0,i,e,t,o,n,s));let P=n.getUriLabel(k.uri,{relative:!0});T.setAttribute("aria-label",P);let O=k.uri;v.push({element:T,activate:()=>i.open(O)})}}kwo(f,v,s)}let p=a.files.filter(h=>h.status==="skipped");if(p.length>0){let h=M(l,Bm("div.chat-debug-file-list-section"));M(h,Bm("div.chat-debug-file-list-section-title",void 0,d(6717,null,p.length)));let g=new Map;for(let b of p){let S=b.skipReason??d(6723,null),y=g.get(S);y||(y=[],g.set(S,y)),y.push(b)}let f=M(h,Bm("div.chat-debug-file-list-rows"));f.setAttribute("role","list"),f.setAttribute("aria-label",d(6718,null));let v=[];for(let[b,S]of g){let y=M(f,Bm("div.chat-debug-file-list-group-header"));M(y,Bm("span.chat-debug-file-list-group-label",void 0,b));for(let w of S){let k=M(f,Bm("div.chat-debug-file-list-row"));M(k,Bm(`span.chat-debug-file-list-icon${q.asCSSSelector(R.close)}`));let T="";w.errorMessage&&(T+=w.errorMessage),w.duplicateOf&&(T&&(T+=", "),T+=d(6705,null,w.duplicateOf.path)),k.appendChild(xwo(w.uri,w.name??w.uri.path,0,i,e,t,o,n,s)),T&&M(k,Bm("span.chat-debug-file-list-detail",void 0,` (${T})`));let P=n.getUriLabel(w.uri,{relative:!0});k.setAttribute("aria-label",P);let O=w.uri;v.push({element:k,activate:()=>i.open(O)})}}kwo(f,v,s)}if(a.sourceFolders&&a.sourceFolders.length>0){let h=M(l,Bm("div.chat-debug-message-section")),g=M(h,Bm("div.chat-debug-message-section-header")),f=M(g,Bm("span.chat-debug-message-section-chevron"));M(g,Bm("span.chat-debug-message-section-title",void 0,d(6719,null,a.sourceFolders.length)));let v=iln(a.discoveryType);if(v){let w=s.add(new Wi(g,{title:d(6709,null),ariaLabel:d(6703,null),hoverDelegate:Ri("mouse")}));w.icon=R.settingsGear,w.element.classList.add("chat-debug-settings-gear"),s.add(j(w.element,re.MOUSE_ENTER,()=>{g.classList.add("chat-debug-settings-gear-header-passthrough")})),s.add(j(w.element,re.MOUSE_LEAVE,()=>{g.classList.remove("chat-debug-settings-gear-header-passthrough")})),s.add(w.onDidClick(k=>{k&&Xt.stop(k,!0),i.open(A.parse(`command:workbench.action.openSettings?${encodeURIComponent(JSON.stringify([`@id:${v}`]))}`),{allowCommands:!0})}))}let b=M(h,Bm("div.chat-debug-source-folder-content"));b.tabIndex=0,b.setAttribute("role","region"),b.setAttribute("aria-label",d(6720,null));let S=a.discoveryType.charAt(0).toUpperCase()+a.discoveryType.slice(1),y=S.endsWith("s")?S:S+"s";M(b,Bm("div.chat-debug-source-folder-note",void 0,d(6721,null,y)));for(let w=0;w<a.sourceFolders.length;w++){let k=a.sourceFolders[w],T=M(b,Bm("div.chat-debug-source-folder-row"));M(T,Bm("span.chat-debug-source-folder-index",void 0,`${w+1}.`)),M(T,Bm("span.chat-debug-source-folder-label",void 0,k.uri.path))}Iqt(f,g,b,s,!0,r)}return{element:l,disposables:s}}function Two(a){let i=[],e=a.discoveryType.charAt(0).toUpperCase()+a.discoveryType.slice(1);i.push(d(6710,null,e)),i.push(d(6715,null,a.files.length)),i.push("");let t=a.files.filter(n=>n.status==="loaded"),o=a.files.filter(n=>n.status==="skipped");if(t.length>0){i.push(d(6712,null,t.length));let n=new Map;for(let r of t){let s=a.discoveryType==="skill"?ci(ci(r.uri)):ci(r.uri),l=r.extensionId??s.path,c=n.get(l);c||(c=[],n.set(l,c)),c.push(r)}for(let[r,s]of n){i.push(`  ${r}`);for(let l of s){let c=l.name??l.uri.path;i.push(`    \u2713 ${c}`)}}i.push("")}if(o.length>0){i.push(d(6713,null,o.length));let n=new Map;for(let r of o){let s=r.skipReason??d(6716,null),l=n.get(s);l||(l=[],n.set(s,l)),l.push(r)}for(let[r,s]of n){i.push(`  ${r}`);for(let l of s){let u=`    \u2717 ${l.name??l.uri.path}`;if(l.errorMessage||l.duplicateOf){let p=[];l.errorMessage&&p.push(l.errorMessage),l.duplicateOf&&p.push(d(6711,null,l.duplicateOf.path)),u+=` (${p.join(", ")})`}i.push(u)}}}if(a.sourceFolders&&a.sourceFolders.length>0){i.push(""),i.push(d(6714,null,a.sourceFolders.length));for(let n of a.sourceFolders)i.push(`  ${n.uri.path}`)}return i.join(`
`)}var uq=_,nln=pf("chatDebugTokenizer",{createHTML(a){return a}});function rln(a){try{return{parsed:JSON.parse(a),isJSON:!0}}catch{return{isJSON:!1}}}async function yN(a,i){let e=rln(a),t=e.isJSON?JSON.stringify(e.parsed,null,2):a,o=e.isJSON?"json":"markdown",n=await fz(i,t,o);return{plainText:t,tokenizedHtml:n}}function wN(a,i,e,t,o,n=!1,r,s){let l=M(a,uq("div.chat-debug-message-section")),c=M(l,uq("div.chat-debug-message-section-header")),u=M(c,uq("span.chat-debug-message-section-chevron"));if(M(c,uq("span.chat-debug-message-section-title",void 0,i)),r){let g=o.add(new Wi(c,{title:d(6890,null),ariaLabel:d(6890,null),hoverDelegate:Ri("mouse")}));g.icon=R.copy,g.element.classList.add("chat-debug-section-copy-btn"),o.add(j(g.element,re.MOUSE_ENTER,()=>{c.classList.add("chat-debug-section-copy-header-passthrough")})),o.add(j(g.element,re.MOUSE_LEAVE,()=>{c.classList.remove("chat-debug-section-copy-header-passthrough")})),o.add(g.onDidClick(f=>{f&&Xt.stop(f,!0),r.writeText(e)}))}let p=M(l,uq("div.chat-debug-message-section-content-wrapper")),h=M(p,uq("pre.chat-debug-message-section-content"));if(h.tabIndex=0,t){let g=nln?.createHTML(t)??t;h.innerHTML=g}else h.textContent=e;Iqt(u,c,p,o,n,s)}async function _wo(a,i,e,t){let o=new N,n=uq("div.chat-debug-message-content");n.tabIndex=0,M(n,uq("div.chat-debug-message-content-title",void 0,a.toolName));let r=[];a.result&&r.push(a.result==="success"?d(6897,null):d(6894,null)),a.durationInMillis!==void 0&&r.push(d(6892,null,a.durationInMillis)),r.length>0&&M(n,uq("div.chat-debug-message-content-summary",void 0,r.join(" \xB7 ")));let s=M(n,uq("div.chat-debug-message-sections"));if(a.input){let{plainText:l,tokenizedHtml:c}=await yN(a.input,i);wN(s,d(6891,null),l,c,o,!1,e,t)}if(a.output){let{plainText:l,tokenizedHtml:c}=await yN(a.output,i);wN(s,d(6895,null),l,c,o,!1,e,t)}return{element:n,disposables:o}}function Dwo(a){let i=[];if(i.push(d(6898,null,a.toolName)),a.result&&i.push(d(6896,null,a.result)),a.durationInMillis!==void 0&&i.push(d(6893,null,a.durationInMillis)),a.input){i.push(""),i.push(`[${d(6891,null)}]`);try{let e=JSON.parse(a.input);i.push(JSON.stringify(e,null,2))}catch{i.push(a.input)}}if(a.output){i.push(""),i.push(`[${d(6895,null)}]`);try{let e=JSON.parse(a.output);i.push(JSON.stringify(e,null,2))}catch{i.push(a.output)}}return i.join(`
`)}var oL=_;async function Lwo(a,i,e,t){let o=new N,n=oL("div.chat-debug-message-content");if(n.tabIndex=0,M(n,oL("div.chat-debug-message-content-title",void 0,d(6842,null))),M(n,oL("div.chat-debug-message-content-summary",void 0,a.message)),a.sections.length>0){let r=M(n,oL("div.chat-debug-message-sections"));M(r,oL("div.chat-debug-message-sections-label",void 0,d(6840,null,a.sections.length)));for(let s of a.sections){let{plainText:l,tokenizedHtml:c}=await yN(s.content,i);wN(r,s.name,l,c,o,!1,e,t)}}return{element:n,disposables:o}}async function Rwo(a,i,e,t){let o=new N,n=oL("div.chat-debug-message-content");if(n.tabIndex=0,M(n,oL("div.chat-debug-message-content-title",void 0,d(6839,null))),M(n,oL("div.chat-debug-message-content-summary",void 0,a.message)),a.sections.length>0){let r=M(n,oL("div.chat-debug-message-sections"));M(r,oL("div.chat-debug-message-sections-label",void 0,d(6841,null,a.sections.length)));for(let s of a.sections){let{plainText:l,tokenizedHtml:c}=await yN(s.content,i);wN(r,s.name,l,c,o,!1,e,t)}}return{element:n,disposables:o}}function zPi(a){let i=[],e=a.kind==="userMessage"?d(6842,null):d(6839,null);i.push(`${e}: ${a.message}`),i.push("");for(let t of a.sections)i.push(`--- ${t.name} ---`),i.push(t.content),i.push("");return i.join(`
`)}async function Mwo(a,i,e,t){let o=new N,n=oL("div.chat-debug-message-content");n.tabIndex=0;let r=a.type==="user"?d(6842,null):d(6839,null);if(M(n,oL("div.chat-debug-message-content-title",void 0,r)),M(n,oL("div.chat-debug-message-content-summary",void 0,a.message)),a.sections.length>0){let s=M(n,oL("div.chat-debug-message-sections")),l=a.type==="user"?d(6840,null,a.sections.length):d(6841,null,a.sections.length);M(s,oL("div.chat-debug-message-sections-label",void 0,l));for(let c of a.sections){let{plainText:u,tokenizedHtml:p}=await yN(c.content,i);wN(s,c.name,u,p,o,!1,e,t)}}return{element:n,disposables:o}}function Pwo(a){let i=[],e=a.type==="user"?d(6842,null):d(6839,null);i.push(`${e}: ${a.message}`),i.push("");for(let t of a.sections)i.push(`--- ${t.name} ---`),i.push(t.content),i.push("");return i.join(`
`)}var FM=_,jT=Jc.NumberFormat();async function Awo(a,i,e,t){let o=new N,n=FM("div.chat-debug-message-content");n.tabIndex=0,M(n,FM("div.chat-debug-message-content-title",void 0,d(6861,null)));let r=[];a.requestName&&r.push(a.requestName),a.model&&r.push(a.model),a.status&&a.status!=="unknown"&&r.push(a.status),a.durationInMillis!==void 0&&r.push(d(6845,null,jT.value.format(a.durationInMillis))),r.length>0&&M(n,FM("div.chat-debug-message-content-summary",void 0,r.join(" \xB7 ")));let s=M(n,FM("div.chat-debug-model-turn-details"));if(a.inputTokens!==void 0&&M(s,FM("div",void 0,d(6849,null,jT.value.format(a.inputTokens)))),a.outputTokens!==void 0&&M(s,FM("div",void 0,d(6856,null,jT.value.format(a.outputTokens)))),a.cachedTokens!==void 0&&M(s,FM("div",void 0,d(6843,null,jT.value.format(a.cachedTokens)))),a.totalTokens!==void 0&&M(s,FM("div",void 0,d(6862,null,jT.value.format(a.totalTokens)))),a.timeToFirstTokenInMillis!==void 0&&M(s,FM("div",void 0,d(6864,null,jT.value.format(a.timeToFirstTokenInMillis)))),a.maxInputTokens!==void 0&&M(s,FM("div",void 0,d(6851,null,jT.value.format(a.maxInputTokens)))),a.maxOutputTokens!==void 0&&M(s,FM("div",void 0,d(6853,null,jT.value.format(a.maxOutputTokens)))),a.errorMessage&&M(s,FM("div.chat-debug-model-turn-error",void 0,d(6847,null,a.errorMessage))),a.sections&&a.sections.length>0){let l=M(n,FM("div.chat-debug-message-sections"));M(l,FM("div.chat-debug-message-sections-label",void 0,d(6859,null,a.sections.length)));for(let c of a.sections){let{plainText:u,tokenizedHtml:p}=await yN(c.content,i);wN(l,c.name,u,p,o,!1,e,t)}}return{element:n,disposables:o}}function Nwo(a){let i=[];if(i.push(d(6858,null,a.requestName)),a.model&&i.push(d(6855,null,a.model)),a.status&&a.status!=="unknown"&&i.push(d(6860,null,a.status)),a.durationInMillis!==void 0&&i.push(d(6846,null,jT.value.format(a.durationInMillis))),a.timeToFirstTokenInMillis!==void 0&&i.push(d(6865,null,jT.value.format(a.timeToFirstTokenInMillis))),a.inputTokens!==void 0&&i.push(d(6850,null,jT.value.format(a.inputTokens))),a.outputTokens!==void 0&&i.push(d(6857,null,jT.value.format(a.outputTokens))),a.cachedTokens!==void 0&&i.push(d(6844,null,jT.value.format(a.cachedTokens))),a.totalTokens!==void 0&&i.push(d(6863,null,jT.value.format(a.totalTokens))),a.maxInputTokens!==void 0&&i.push(d(6852,null,jT.value.format(a.maxInputTokens))),a.maxOutputTokens!==void 0&&i.push(d(6854,null,jT.value.format(a.maxOutputTokens))),a.errorMessage&&i.push(d(6848,null,a.errorMessage)),a.sections&&a.sections.length>0){i.push("");for(let e of a.sections)i.push(`--- ${e.name} ---`),i.push(e.content),i.push("")}return i.join(`
`)}var yqt=_;async function Owo(a,i,e,t){let o=new N,n=yqt("div.chat-debug-message-content");n.tabIndex=0,M(n,yqt("div.chat-debug-message-content-title",void 0,a.hookType));let r=[];a.result!==void 0&&r.push(Fwo(a.result)),a.exitCode!==void 0&&r.push(d(6803,null,a.exitCode)),a.durationInMillis!==void 0&&r.push(d(6800,null,a.durationInMillis)),r.length>0&&M(n,yqt("div.chat-debug-message-content-summary",void 0,r.join(" \xB7 ")));let s=M(n,yqt("div.chat-debug-message-sections"));if(a.command){let{plainText:l,tokenizedHtml:c}=await yN(a.command,i);wN(s,d(6799,null),l,c,o,!1,e,t)}if(a.input){let{plainText:l,tokenizedHtml:c}=await yN(a.input,i);wN(s,d(6805,null),l,c,o,!1,e,t)}if(a.output){let{plainText:l,tokenizedHtml:c}=await yN(a.output,i);wN(s,d(6806,null),l,c,o,!1,e,t)}if(a.errorMessage){let{plainText:l,tokenizedHtml:c}=await yN(a.errorMessage,i);wN(s,d(6802,null),l,c,o,!1,e,t)}return{element:n,disposables:o}}function Fwo(a){switch(a){case 0:return d(6809,null);case 1:return d(6807,null);case 2:return d(6808,null);default:return String(a)}}function Wwo(a){let i=[];if(i.push(d(6811,null,a.hookType)),a.result!==void 0&&i.push(d(6810,null,Fwo(a.result))),a.exitCode!==void 0&&i.push(d(6804,null,a.exitCode)),a.durationInMillis!==void 0&&i.push(d(6801,null,a.durationInMillis)),a.command&&(i.push(""),i.push(`[${d(6799,null)}]`),i.push(a.command)),a.input){i.push(""),i.push(`[${d(6805,null)}]`);try{let e=JSON.parse(a.input);i.push(JSON.stringify(e,null,2))}catch{i.push(a.input)}}if(a.output){i.push(""),i.push(`[${d(6806,null)}]`);try{let e=JSON.parse(a.output);i.push(JSON.stringify(e,null,2))}catch{i.push(a.output)}}return a.errorMessage&&(i.push(""),i.push(`[${d(6802,null)}]`),i.push(a.errorMessage)),i.join(`
`)}var wqt=_,sln=350,aln=200,lln=800,woe=class extends x{constructor(e,t,o,n,r,s,l,c){super();this.chatDebugService=t;this.instantiationService=o;this.editorService=n;this.clipboardService=r;this.hoverService=s;this.openerService=l;this.languageService=c;this._onDidHide=this._register(new E);this.onDidHide=this._onDidHide.event;this._onDidChangeWidth=this._register(new E);this.onDidChangeWidth=this._onDidChangeWidth.event;this.detailDisposables=this._register(new N);this.currentDetailText="";this._width=sln;this.element=M(e,wqt(".chat-debug-detail-panel")),this.contentContainer=wqt(".chat-debug-detail-content"),this.scrollable=this._register(new ms(this.contentContainer,{horizontal:2,vertical:1})),this.element.style.width=`${this._width}px`,vo(this.element),this.sash=this._register(new Jh(e,{getVerticalSashLeft:()=>e.offsetWidth-this._width},{orientation:0})),this.sash.state=0;let u;this._register(this.sash.onDidStart(()=>u=this._width)),this._register(this.sash.onDidEnd(()=>{u=void 0,this.sash.layout()})),this._register(this.sash.onDidChange(p=>{if(u===void 0)return;let h=p.startX-p.currentX,g=Math.max(aln,Math.min(lln,u+h));this._width=g,this.element.style.width=`${g}px`,this.sash.layout(),this._onDidChangeWidth.fire(g)})),this._register(j(this.element,re.KEY_DOWN,p=>{if((p.ctrlKey||p.metaKey)&&p.key==="a"){let h=p.target;if(h&&this.element.contains(h)){p.preventDefault();let g=Re(h),f=g.getSelection();if(f){let v=g.document.createRange();v.selectNodeContents(h),f.removeAllRanges(),f.addRange(v)}}}}))}get width(){return this._width}async show(e){if(e.id&&e.id===this.currentDetailEventId)return;this.currentDetailEventId=e.id;let t=e.id?await this.chatDebugService.resolveEvent(e.id):void 0;un(this.element),this.sash.state=3,this.sash.layout(),Rt(this.element),Rt(this.contentContainer),this.detailDisposables.clear();let o=M(this.element,wqt(".chat-debug-detail-header"));this.headerElement=o,this.element.appendChild(this.scrollable.getDomNode());let n=this.detailDisposables.add(new Wi(o,{ariaLabel:d(6728,null),title:d(6728,null)}));n.element.classList.add("chat-debug-detail-button"),n.icon=R.goToFile,this.firstFocusableElement=n.element,this.detailDisposables.add(n.onDidClick(()=>{this.editorService.openEditor({contents:this.currentDetailText,resource:void 0})}));let r=this.detailDisposables.add(new Wi(o,{ariaLabel:d(6727,null),title:d(6727,null)}));r.element.classList.add("chat-debug-detail-button"),r.icon=R.copy,this.detailDisposables.add(r.onDidClick(()=>{this.clipboardService.writeText(this.currentDetailText)}));let s=this.detailDisposables.add(new Wi(o,{ariaLabel:d(6726,null),title:d(6726,null)}));if(s.element.classList.add("chat-debug-detail-button"),s.icon=R.close,this.detailDisposables.add(s.onDidClick(()=>{this.hide()})),t&&t.kind==="fileList"){this.currentDetailText=Two(t);let{element:c,disposables:u}=this.instantiationService.invokeFunction(p=>Ewo(t,this.openerService,p.get(Tt),this.languageService,this.hoverService,p.get(rt),this.scrollable));this.detailDisposables.add(u),this.contentContainer.appendChild(c)}else if(t&&t.kind==="toolCall"){this.currentDetailText=Dwo(t);let{element:c,disposables:u}=await _wo(t,this.languageService,this.clipboardService,this.scrollable);if(this.currentDetailEventId!==e.id){u.dispose();return}this.detailDisposables.add(u),this.contentContainer.appendChild(c)}else if(t&&t.kind==="message"){this.currentDetailText=Pwo(t);let{element:c,disposables:u}=await Mwo(t,this.languageService,this.clipboardService,this.scrollable);if(this.currentDetailEventId!==e.id){u.dispose();return}this.detailDisposables.add(u),this.contentContainer.appendChild(c)}else if(t&&t.kind==="modelTurn"){this.currentDetailText=Nwo(t);let{element:c,disposables:u}=await Awo(t,this.languageService,this.clipboardService,this.scrollable);if(this.currentDetailEventId!==e.id){u.dispose();return}this.detailDisposables.add(u),this.contentContainer.appendChild(c)}else if(t&&t.kind==="hook"){this.currentDetailText=Wwo(t);let{element:c,disposables:u}=await Owo(t,this.languageService,this.clipboardService,this.scrollable);if(this.currentDetailEventId!==e.id){u.dispose();return}this.detailDisposables.add(u),this.contentContainer.appendChild(c)}else if(e.kind==="userMessage"){this.currentDetailText=zPi(e);let{element:c,disposables:u}=await Lwo(e,this.languageService,this.clipboardService,this.scrollable);if(this.currentDetailEventId!==e.id){u.dispose();return}this.detailDisposables.add(u),this.contentContainer.appendChild(c)}else if(e.kind==="agentResponse"){this.currentDetailText=zPi(e);let{element:c,disposables:u}=await Rwo(e,this.languageService,this.clipboardService,this.scrollable);if(this.currentDetailEventId!==e.id){u.dispose();return}this.detailDisposables.add(u),this.contentContainer.appendChild(c)}else{let c=M(this.contentContainer,wqt("pre"));c.tabIndex=0,t?this.currentDetailText=t.value:this.currentDetailText=Cwo(e),c.textContent=this.currentDetailText}let l=this.element.parentElement?.clientHeight??0;l>0?this.layout(l):this.scrollable.scanDomNode()}get isVisible(){return this.element.style.display!=="none"}focus(){this.firstFocusableElement?.focus()}layout(e){let t=this.headerElement?.offsetHeight??0,o=Math.max(0,e-t);this.contentContainer.style.height=`${o}px`,this.scrollable.scanDomNode(),this.sash.layout()}layoutSash(){this.sash.layout()}hide(){this.currentDetailEventId=void 0,this.firstFocusableElement=void 0,this.headerElement=void 0,vo(this.element),this.sash.state=0,Rt(this.element),Rt(this.contentContainer),this.detailDisposables.clear(),this._onDidHide.fire()}};woe=I([m(1,Yp),m(2,F),m(3,ee),m(4,Fi),m(5,nt),m(6,Je),m(7,_t)],woe);var Cx=_;var wWe=class extends x{constructor(e,t,o,n,r,s,l,c,u){super();this.filterState=t;this.chatService=o;this.chatDebugService=n;this.instantiationService=r;this.contextKeyService=s;this.chatWidgetService=l;this.clipboardService=c;this.contextMenuService=u;this._onNavigate=this._register(new E);this.onNavigate=this._onNavigate.event;this.logsViewMode="tree";this.events=[];this.eventListener=this._register(new me);this.sessionStateDisposable=this._register(new me);this.refreshScheduler=this._register(new Dt(()=>this.refreshList(),50)),this.container=M(e,Cx(".chat-debug-logs")),vo(this.container);let p=M(this.container,Cx(".chat-debug-breadcrumb"));this.breadcrumbWidget=this._register(new K2(p,3,void 0,R.chevronRight,Tz)),this._register(SWe(p,this.breadcrumbWidget)),this._register(this.breadcrumbWidget.onDidSelectItem(O=>{if(O.type==="select"&&O.item instanceof $T){this.breadcrumbWidget.setSelection(void 0);let H=this.breadcrumbWidget.getItems().indexOf(O.item);H===0?this._onNavigate.fire("home"):H===1&&this._onNavigate.fire("overview")}})),this.headerContainer=M(this.container,Cx(".chat-debug-editor-header"));let h=this._register(this.contextKeyService.createScoped(this.headerContainer)),g=vqt(this.filterState,h);g();let f=this._register(this.instantiationService.createChild(new _o([X,h])));this.filterWidget=this._register(f.createInstance(m2,{placeholder:d(6832,null),ariaLabel:d(6826,null)})),this.viewModeToggle=this._register(new Wi(this.headerContainer,{...Qo,secondary:!0,title:d(6836,null)})),this.viewModeToggle.element.classList.add("chat-debug-view-mode-toggle","monaco-text-button"),this.updateViewModeToggle(),this._register(this.viewModeToggle.onDidClick(()=>{this.toggleViewMode()})),M(this.headerContainer,Cx(".viewpane-filter-container")).appendChild(this.filterWidget.element);let b=this._register(new Wi(this.headerContainer,{...Qo,secondary:!0,title:d(6838,null)}));b.element.classList.add("chat-debug-troubleshoot-button","monaco-text-button"),M(b.element,Cx(`span${q.asCSSSelector(R.chatSparkle)}`)),this._register(b.onDidClick(async()=>{if(!this.currentSessionResource)return;let O=await this.chatWidgetService.openSession(this.currentSessionResource);if(O){let V=await A0e(this.currentSessionResource,this.chatDebugService);O.attachmentModel.addContext(V),O.focusInput()}})),this._register(this.filterWidget.onDidChangeFilterText(O=>{this.filterState.setTextFilter(O)})),this._register(this.filterState.onDidChange(()=>{g(),this.updateMoreFiltersChecked(),this.refreshList()}));let S=M(this.container,Cx(".chat-debug-logs-content")),y=M(S,Cx(".chat-debug-logs-main"));this.tableHeader=M(y,Cx(".chat-debug-table-header")),M(this.tableHeader,Cx("span.chat-debug-col-created",void 0,d(6820,null))),M(this.tableHeader,Cx("span.chat-debug-col-name",void 0,d(6822,null))),M(this.tableHeader,Cx("span.chat-debug-col-details",void 0,d(6821,null))),this.progressBar=this._register(new Zf(y,{...vw,ariaLabel:d(6831,null)})),this.bodyContainer=M(y,Cx(".chat-debug-logs-body")),this.listContainer=M(this.bodyContainer,Cx(".chat-debug-list-container")),vo(this.listContainer);let w={getAriaLabel:O=>{switch(O.kind){case"toolCall":return d(6817,null,O.toolName,O.result?` (${O.result})`:"");case"modelTurn":return d(6814,null,O.model??d(6813,null),O.totalTokens?d(6816,null,O.totalTokens):"");case"generic":return`${O.category?O.category+": ":""}${O.name}: ${O.details??""}`;case"subagentInvocation":return d(6815,null,O.agentName,O.description?` - ${O.description}`:"");case"userMessage":return d(6818,null,O.message);case"agentResponse":return d(6812,null,O.message)}},getWidgetAriaLabel:()=>d(6819,null)},k=0,T=new WeakMap,P={getId:O=>{if(O.id)return O.id;let V=T.get(O);return V||(V=`_fallback_${k++}`,T.set(O,V)),V}};this.list=this._register(this.instantiationService.createInstance(Vl,"ChatDebugEvents",this.listContainer,new qrt,[new Grt],{identityProvider:P,accessibilityProvider:w})),this.treeContainer=M(this.bodyContainer,Cx(".chat-debug-list-container")),this.tree=this._register(this.instantiationService.createInstance(Rg,"ChatDebugEventsTree",this.treeContainer,new qrt,[new bqt],{identityProvider:P,accessibilityProvider:w})),this.detailPanel=this._register(this.instantiationService.createInstance(woe,S)),this._register(this.detailPanel.onDidChangeWidth(()=>{this.currentDimension&&this.layout(this.currentDimension)})),this._register(this.detailPanel.onDidHide(()=>{this.list.getSelection().length>0&&this.list.setSelection([]),this.tree.getSelection().length>0&&this.tree.setSelection([]),this.currentDimension&&this.layout(this.currentDimension)})),this._register(this.list.onContextMenu(O=>{O.element&&this.showEventContextMenu(O.element,O.browserEvent)})),this._register(this.tree.onContextMenu(O=>{O.element&&this.showEventContextMenu(O.element,O.browserEvent)})),this._register(this.list.onDidChangeSelection(O=>{let V=O.elements[0];V?this.detailPanel.show(V):this.detailPanel.hide()})),this._register(this.tree.onDidChangeSelection(O=>{let V=O.elements[0];V?this.detailPanel.show(V):this.detailPanel.hide()}))}setSession(e){this.currentSessionResource=e}setFilterText(e){this.filterWidget.setFilterText(e)}show(){un(this.container),this.loadEvents(),this.refreshList()}hide(){vo(this.container)}focus(){this.logsViewMode==="tree"?this.tree.domFocus():this.list.domFocus()}updateBreadcrumb(){if(!this.currentSessionResource)return;let e=this.chatService.getSessionTitle(this.currentSessionResource)||Jr.parseLocalSessionId(this.currentSessionResource)||this.currentSessionResource.toString();this.breadcrumbWidget.setItems([new $T(d(6835,null),!0),new $T(e,!0),new $T(d(6830,null))])}layout(e){this.currentDimension=e;let t=22,o=this.headerContainer.offsetHeight,n=this.tableHeader.offsetHeight,s=this.detailPanel.isVisible?this.detailPanel.width:0,l=e.height-t-o-n,c=e.width-s;this.logsViewMode==="tree"?this.tree.layout(l,c):this.list.layout(l,c),this.detailPanel.isVisible&&this.detailPanel.layout(l),this.detailPanel.layoutSash()}refreshList(){let e=this.events;e=e.filter(o=>{let n=o.kind==="generic"?o.category:void 0;return this.filterState.isKindVisible(o.kind,n)});let t=this.filterState.textFilter;t&&(e=BIo(e,t)),this.logsViewMode==="list"?this.list.splice(0,this.list.length,e):this.refreshTree(e)}addEvent(e){let t=e.created.getTime(),o=0,n=this.events.length;for(;o<n;){let r=o+n>>>1;this.events[r].created.getTime()<=t?o=r+1:n=r}o===this.events.length?this.events.push(e):this.events.splice(o,0,e),this.scheduleRefresh()}scheduleRefresh(){this.refreshScheduler.isScheduled()||this.refreshScheduler.schedule()}loadEvents(){this.events=[...this.chatDebugService.getEvents(this.currentSessionResource||void 0)];let e=this.chatDebugService.onDidAddEvent(o=>{(!this.currentSessionResource||o.sessionResource.toString()===this.currentSessionResource.toString())&&this.addEvent(o)}),t=this.chatDebugService.onDidClearProviderEvents(o=>{(!this.currentSessionResource||o.toString()===this.currentSessionResource.toString())&&(this.events=[...this.chatDebugService.getEvents(this.currentSessionResource||void 0)],this.refreshList())});this.eventListener.value=wn(e,t),this.updateBreadcrumb(),this.trackSessionState()}trackSessionState(){if(!this.currentSessionResource){this.progressBar.stop(),this.sessionStateDisposable.clear();return}let e=this.chatService.getSession(this.currentSessionResource);if(!e){this.progressBar.stop(),this.sessionStateDisposable.clear();return}this.sessionStateDisposable.value=be(t=>{e.requestInProgress.read(t)?this.progressBar.infinite():this.progressBar.stop()})}refreshTree(e){let t=this.buildTreeHierarchy(e);this.tree.setChildren(null,t)}buildTreeHierarchy(e){let t=new Map,o=new Map,n=[];for(let s of e)s.id&&t.set(s.id,s);for(let s of e)if(s.parentEventId&&t.has(s.parentEventId)){let l=o.get(s.parentEventId);l||(l=[],o.set(s.parentEventId,l)),l.push(s)}else n.push(s);let r=s=>{let l=s.id?o.get(s.id):void 0;return{element:s,children:l?.map(r),collapsible:(l?.length??0)>0,collapsed:!1}};return n.map(r)}toggleViewMode(){this.logsViewMode==="list"?(this.logsViewMode="tree",vo(this.listContainer),un(this.treeContainer)):(this.logsViewMode="list",un(this.listContainer),vo(this.treeContainer)),this.updateViewModeToggle(),this.refreshList(),this.currentDimension&&this.layout(this.currentDimension)}updateViewModeToggle(){let e=this.viewModeToggle.element;Rt(e);let t=this.logsViewMode==="tree";M(e,Cx(`span${q.asCSSSelector(t?R.listTree:R.listFlat)}`));let o=M(e,Cx("span.chat-debug-view-mode-labels")),n=M(o,Cx("span.chat-debug-view-mode-label"));n.textContent=d(6837,null);let r=M(o,Cx("span.chat-debug-view-mode-label"));r.textContent=d(6829,null),t?r.classList.add("hidden"):n.classList.add("hidden");let s=t?d(6833,null):d(6834,null);e.setAttribute("aria-label",s),this.viewModeToggle.setTitle(s)}updateMoreFiltersChecked(){this.filterWidget.checkMoreFilters(!this.filterState.isAllFiltersDefault())}showEventContextMenu(e,t){let o=e.created,n=c=>String(c).padStart(2,"0"),r=`${o.getFullYear()}-${n(o.getMonth()+1)}-${n(o.getDate())}T${n(o.getHours())}:${n(o.getMinutes())}:${n(o.getSeconds())}`,s=[HPi(e),Sqt(e),UPi(e)].filter(Boolean).join("	"),l=Sqt(e);this.contextMenuService.showContextMenu({getAnchor:()=>Ru(t)?new Cn(Re(this.container),t):this.container,getActions:()=>[new it("chatDebug.copyTimestamp",d(6824,null),void 0,!0,()=>this.clipboardService.writeText(r)),new it("chatDebug.copyRow",d(6823,null),void 0,!0,()=>this.clipboardService.writeText(s)),new ri,new it("chatDebug.filterBefore",d(6827,null),void 0,!0,()=>this.applyFilterToken(`before:${r}`)),new it("chatDebug.filterAfter",d(6825,null),void 0,!0,()=>this.applyFilterToken(`after:${r}`)),new it("chatDebug.filterName",d(6828,null),void 0,!!l,()=>this.applyFilterToken(l))]})}applyFilterToken(e){this.filterWidget.setFilterText(e)}};wWe=I([m(2,mi),m(3,Yp),m(4,F),m(5,X),m(6,Pt),m(7,Fi),m(8,Xe)],wWe);function cln(a,i){return a.length<=i?a:a.substring(0,i-1)+"\u2026"}function GPi(a){let i=new Set(["runSubagent","search_subagent"]),e=new Map,t=new Map;for(let u of a)if(u.kind==="subagentInvocation"&&i.has(u.agentName)&&u.description&&u.parentEventId){let p=e.get(u.parentEventId);p||(p=[],e.set(u.parentEventId,p)),p.push(u.description)}function o(u){if(u.kind!=="subagentInvocation"||!u.parentEventId)return;let p=e.get(u.parentEventId);if(!p||p.length===0)return u.description&&u.description!==u.agentName?u.description:void 0;let h=t.get(u.parentEventId)??0;return t.set(u.parentEventId,h+1),p[h]??p[0]}let n=a.filter(u=>!(u.kind==="toolCall"&&i.has(u.toolName.replace(/^\u{1F6E0}\uFE0F?\s*/u,""))||u.kind==="subagentInvocation"&&i.has(u.agentName))),r=new Map,s=new Map,l=[];for(let u of n)u.id&&r.set(u.id,u);for(let u of n)if(u.parentEventId&&r.has(u.parentEventId)){let p=s.get(u.parentEventId);p||(p=[],s.set(u.parentEventId,p)),p.push(u)}else l.push(u);function c(u){let p=u.id?s.get(u.id):void 0,h=uln(u),g=pln(u,h),f=mln(u,h),v=gln(u),b;if(h==="subagentInvocation"&&(b=o(u),g=b?d(6772,null,cln(b,30)):d(6771,null),b&&v&&!v.includes(b))){let S=v.split(`
`);S.splice(1,0,b),v=S.join(`
`)}return{id:u.id??`event-${a.indexOf(u)}`,kind:h,category:u.kind==="generic"?u.category:void 0,label:g,sublabel:f,description:b,tooltip:v,isError:hln(u),created:u.created.getTime(),children:p?.map(c)??[]}}return l.map(c)}function qPi(a,i){let e=KPi(a,i.isKindVisible);return i.textFilter&&(e=Uwo(e,i.textFilter)),e}function KPi(a,i){let e=[],t=!1;for(let o of a){if(!i(o.kind,o.category)){if(t=!0,o.kind==="subagentInvocation")continue;e.push(...KPi(o.children,i));continue}let n=KPi(o.children,i);n!==o.children?(t=!0,e.push({...o,children:n})):e.push(o)}return t?e:a}function dln(a,i){return a.label.toLowerCase().includes(i)||(a.sublabel?.toLowerCase().includes(i)??!1)||(a.tooltip?.toLowerCase().includes(i)??!1)}function Uwo(a,i){let e=[];for(let t of a){if(dln(t,i)){e.push(t);continue}let o=Uwo(t.children,i);o.length>0&&e.push({...t,children:o})}return e}function zwo(a){let i=0;for(let e of a)i+=1+zwo(e.children);return i}function $Pi(a,i){let e=zwo(a);if(e<=i)return{nodes:a,totalCount:e,shownCount:e};let t=i;function o(s){let l=[];for(let c of s){if(t<=0)break;if(t--,c.children.length===0||t<=0)l.push(c.children.length===0?c:{...c,children:[]});else{let u=o(c.children);l.push(u!==c.children?{...c,children:u}:c)}}return l}let n=o(a),r=i-t;return{nodes:n,totalCount:e,shownCount:r}}function Vwo(a){return a.kind==="generic"&&a.category==="discovery"}function xqt(a){let i=[],e=0;for(;e<a.length;){let t=a[e];if(!Vwo(t)){let u=xqt(t.children);i.push(u!==t.children?{...t,children:u}:t),e++;continue}let o=[t],n=e+1;for(;n<a.length&&Vwo(a[n]);)o.push(a[n]),n++;if(o.length<2){i.push(t),e=n;continue}let r=`merged-discovery:${o[0].id}`,s=o.map(u=>u.label),l=[...new Set(s)],c=l.length<=2?l.join(", "):d(6766,null,l[0],o.length-1);i.push({id:r,kind:"generic",category:"discovery",label:c,sublabel:d(6767,null,o.length),tooltip:o.map(u=>u.label+(u.sublabel?`: ${u.sublabel}`:"")).join(`
`),created:o[0].created,children:[],mergedNodes:o}),e=n}return i}function Bwo(a){return a.kind==="toolCall"}function Hwo(a){return a.label}function $rt(a){let i=[],e=0;for(;e<a.length;){let t=a[e];if(!Bwo(t)){let l=$rt(t.children);i.push(l!==t.children?{...t,children:l}:t),e++;continue}let o=Hwo(t),n=[t],r=e+1;for(;r<a.length&&Bwo(a[r])&&Hwo(a[r])===o;)n.push(a[r]),r++;if(n.length<2){let l=$rt(t.children);i.push(l!==t.children?{...t,children:l}:t),e=r;continue}let s=`merged-toolCall:${n[0].id}`;i.push({id:s,kind:"toolCall",label:o,sublabel:d(6775,null,n.length),tooltip:n.map(l=>l.label+(l.sublabel?`: ${l.sublabel}`:"")).join(`
`),created:n[0].created,children:[],mergedNodes:n}),e=r}return i}function uln(a){if(a.kind==="generic"){let i=a.name.toLowerCase().replace(/[\s_-]+/g,"");if(i==="usermessage"||i==="userprompt"||i==="user"||i.startsWith("usermessage"))return"userMessage";if(i==="response"||i.startsWith("agentresponse")||i.startsWith("assistantresponse")||i.startsWith("modelresponse"))return"agentResponse";let e=a.category?.toLowerCase();if(e==="user"||e==="usermessage")return"userMessage";if(e==="response"||e==="agentresponse")return"agentResponse"}return a.kind}function pln(a,i){switch(i??a.kind){case"userMessage":return d(6786,null);case"modelTurn":return a.kind==="modelTurn"?a.model??d(6769,null):d(6769,null);case"toolCall":return a.kind==="toolCall"?a.toolName:a.kind==="generic"?a.name:d(6774,null);case"subagentInvocation":return a.kind==="subagentInvocation"?a.agentName:d(6770,null);case"agentResponse":return d(6765,null);case"generic":return a.kind==="generic"?a.name:d(6768,null)}}function mln(a,i){switch(i??a.kind){case"modelTurn":{let t=[];return a.kind==="modelTurn"&&a.requestName&&t.push(a.requestName),a.kind==="modelTurn"&&a.totalTokens&&t.push(d(6773,null,a.totalTokens)),a.kind==="modelTurn"&&a.durationInMillis&&t.push(Cqt(a.durationInMillis)),t.length>0?t.join(" \xB7 "):void 0}case"toolCall":{let t=[];return a.kind==="toolCall"&&a.result&&t.push(a.result),a.kind==="toolCall"&&a.durationInMillis&&t.push(Cqt(a.durationInMillis)),t.length>0?t.join(" \xB7 "):void 0}case"subagentInvocation":{let t=[];return a.kind==="subagentInvocation"&&a.status&&t.push(a.status),a.kind==="subagentInvocation"&&a.durationInMillis&&t.push(Cqt(a.durationInMillis)),t.length>0?t.join(" \xB7 "):void 0}case"userMessage":case"agentResponse":{let t;if(a.kind==="userMessage"||a.kind==="agentResponse"?t=a.message:a.kind==="generic"&&(t=a.details),!t)return;let o=t.split(`
`),n="";for(let r of o){let s=r.trim();if(s&&s.length>2){n=s;break}}return n||(n=t.replace(/\s+/g," ").trim()),n?n.length>60?n.substring(0,57)+"...":n:void 0}default:return}}function Cqt(a){return a<1e3?`${a}ms`:`${(a/1e3).toFixed(1)}s`}function hln(a){return a.kind==="toolCall"&&a.result==="error"||a.kind==="generic"&&a.level===3||a.kind==="subagentInvocation"&&a.status==="failed"}var Coe=500;function gln(a){switch(a.kind){case"userMessage":{let i=a.message.trim();return i.length>Coe?i.substring(0,Coe)+"\u2026":i||void 0}case"toolCall":{let i=[a.toolName];if(a.input){let e=a.input.trim();i.push(d(6777,null,e.length>Coe?e.substring(0,Coe)+"\u2026":e))}if(a.output){let e=a.output.trim();i.push(d(6780,null,e.length>Coe?e.substring(0,Coe)+"\u2026":e))}return a.result&&i.push(d(6782,null,a.result)),i.join(`
`)}case"subagentInvocation":{let i=[a.agentName];return a.description&&i.push(a.description),a.status&&i.push(d(6783,null,a.status)),a.toolCallCount!==void 0&&i.push(d(6785,null,a.toolCallCount)),a.modelTurnCount!==void 0&&i.push(d(6779,null,a.modelTurnCount)),i.join(`
`)}case"generic":{if(a.details){let i=a.details.trim();return i.length>Coe?i.substring(0,Coe)+"\u2026":i}return}case"modelTurn":{let i=[];return a.model&&i.push(a.model),a.totalTokens&&i.push(d(6784,null,a.totalTokens)),a.inputTokens&&i.push(d(6778,null,a.inputTokens)),a.outputTokens&&i.push(d(6781,null,a.outputTokens)),a.durationInMillis&&i.push(d(6776,null,Cqt(a.durationInMillis))),i.length>0?i.join(`
`):void 0}default:return}}var Eqt=36,fln=52,jwo=140,vln=320,jPi=16,kqt=6,WM=24,xWe=6,bln=1.5,jrt=12,Qrt=10,PQ=12,CWe=24,QPi=40,ffe=22,Kwo=3,Tqt=36,Sln=5e3;function Qwo(a){let i=[];for(let l=0;l<a.length;l++)a[l].kind==="subagentInvocation"&&i.push(l);if(i.length<2)return[{type:"sequential",children:a}];let e=[],t=[i[0]];for(let l=1;l<i.length;l++){let c=a[i[l-1]].created,u=a[i[l]].created;Math.abs(u-c)<=Sln?t.push(i[l]):(t.length>=2&&e.push(t),t=[i[l]])}if(t.length>=2&&e.push(t),e.length===0)return[{type:"sequential",children:a}];let o=new Set;for(let l of e)for(let c of l)o.add(c);let n=[],r=0,s=0;for(;s<a.length;)if(r<e.length&&s===e[r][0]){let l=e[r],c=l[l.length-1],u=[],p=[];for(let h=l[0];h<=c;h++)o.has(h)?p.push(a[h]):u.push(a[h]);u.length>0&&n.push({type:"sequential",children:u}),n.push({type:"parallel",children:p}),s=c+1,r++}else{let l=s,c=r<e.length?e[r][0]:a.length;for(;s<c&&!o.has(s);)s++;s>l&&n.push({type:"sequential",children:a.slice(l,s)})}return n}function Ywo(a){return a==="userMessage"||a==="agentResponse"}function Xwo(a,i){let t=a.length*7+jPi*2,o=i?i.length*6+jPi*2:0;return Math.min(vln,Math.max(jwo,t,o))}function Gwo(a){return a.kind==="subagentInvocation"?a.label:a.description&&a.description!==a.label?`${a.label}: ${a.description}`:a.label}function qwo(a){return a.length*6+PQ*2+20}function Jwo(a){let i=a.children.length;for(let e of a.children)i+=Jwo(e);return i}function Zwo(a,i,e,t,o,n,r,s,l){let c=e,u=0,p=o;for(let h of a)if(h.type==="parallel"){let g=yln(h.children,i,c,t,r,s,l);n.nodes.push(...g.nodes),n.edges.push(...g.edges),n.subgraphs.push(...g.subgraphs);for(let f of p)for(let v of g.entryNodes)n.edges.push(YPi(f,v));p=g.exitNodes,u=Math.max(u,g.width),c+=g.height+WM}else for(let g of h.children){let f=eCo(g,i,c,t,r,s,l);n.nodes.push(...f.nodes),n.edges.push(...f.edges),n.subgraphs.push(...f.subgraphs);for(let v of p)n.edges.push(YPi(v,f.entryNode));p=f.exitNodes,u=Math.max(u,f.width),c+=f.height+WM}return{exitNodes:p,maxWidth:u,endY:c}}function YPi(a,i){return{fromId:a.id,toId:i.id,fromX:a.x+a.width/2,fromY:a.y+a.height,toX:i.x+i.width/2,toY:i.y}}function XPi(a,i){if(a.length===0)return{nodes:[],edges:[],subgraphs:[],width:0,height:0};let e=i?.collapsedIds,t=i?.expandedMergedIds,o=Qwo(a),n=[],r={nodes:[],edges:[],subgraphs:[]},{maxWidth:s,endY:l}=Zwo(o,CWe,CWe,0,[],r,e,t,n);Iln(n,r);let c=s+CWe*2,u=l-WM+CWe;for(let p of r.nodes)c=Math.max(c,p.x+p.width+CWe),u=Math.max(u,p.y+p.height+CWe);return wln(r,c/2),{nodes:r.nodes,edges:r.edges,subgraphs:r.subgraphs,width:c,height:u}}function Iln(a,i){for(let e of a){let{mergedNode:t,children:o}=e,n=o.length*Eqt+(o.length-1)*WM,r=t.y,s=t.y+n,l=t.x+t.width;for(let g of i.nodes)g.y+g.height>r&&g.y<s&&(l=Math.max(l,g.x+g.width));for(let g of i.subgraphs)g.y+g.height>r&&g.y<s&&(l=Math.max(l,g.x+g.width));let c=l+QPi,u=t.y,p=0,h=[];for(let g of o){let f=Xwo(g.label,g.sublabel),v={id:g.id,kind:g.kind,label:g.label,sublabel:g.sublabel,tooltip:g.tooltip,isError:g.isError,x:c,y:u,width:f,height:Eqt};h.push(v),i.nodes.push(v),p=Math.max(p,f),u+=Eqt+WM}i.edges.push({fromId:t.id,toId:h[0].id,fromX:t.x+t.width,fromY:t.y+t.height/2,toX:c,toY:h[0].y+h[0].height/2});for(let g=0;g<h.length-1;g++)i.edges.push(YPi(h[g],h[g+1]))}}function eCo(a,i,e,t,o,n,r){let s=(a.mergedNodes?.length??0)>=2,l=s&&n?.has(a.id),c=s?Tqt:0,u=Xwo(a.label,a.sublabel)+c,p=a.kind==="subagentInvocation",h=p&&o?.has(a.id),g=Ywo(a.kind)&&a.sublabel?fln:Eqt,f={id:a.id,kind:a.kind,label:a.label,sublabel:a.sublabel,tooltip:a.tooltip,isError:a.isError,x:i,y:e,width:u,height:g,mergedCount:s?a.mergedNodes.length:void 0,isMergedExpanded:l},v={nodes:[f],edges:[],subgraphs:[],width:u,height:g,entryNode:f,exitNodes:[f]};if(l&&r)return r.push({mergedNode:f,children:a.mergedNodes}),v;if(a.children.length===0&&!h)return v;if(h){let H=ffe+PQ*2,G=Jwo(a),$=e+g+WM-WM/2,J=Gwo(a),ae=Math.max(jwo,qwo(J))+PQ*2;return v.subgraphs.push({label:J,x:i-PQ,y:$,width:ae,height:H,depth:t,nodeId:a.id,collapsedChildCount:G}),v.edges.push({fromX:i+u/2,fromY:e+g,toX:i-PQ+ae/2,toY:$}),v.width=Math.max(u,ae),v.height=g+WM+H,v}if(a.children.length===0)return v;let b=p?t+1:t,S=p?PQ:0,y=Qwo(a.children),w=e+g+WM;p&&(w+=ffe);let{exitNodes:k,maxWidth:T,endY:P}=Zwo(y,i+S,w,b,[f],v,o,n,r),O=P-w-WM,V=T;if(p){let H=Gwo(a);V=Math.max(T,qwo(H)),v.subgraphs.push({label:H,x:i-PQ,y:e+g+WM-WM/2,width:V+PQ*2,height:O+ffe+WM,depth:t,nodeId:a.id})}return v.width=Math.max(u,T+S*2,p?V+S*2:0),v.height=g+WM+O+(p?ffe:0),v.exitNodes=k,v}function yln(a,i,e,t,o,n,r){let s=[],l=0,c=0;for(let b of a){let S=eCo(b,0,e,t,o,n,r);s.push(S),l+=S.width,c=Math.max(c,S.height)}l+=(a.length-1)*QPi;let u=[],p=[],h=[],g=[],f=[],v=i;for(let b of s){let S=v,y=b.nodes.map(P=>({...P,x:P.x+S})),w=b.edges.map(P=>({fromId:P.fromId,toId:P.toId,fromX:P.fromX+S,fromY:P.fromY,toX:P.toX+S,toY:P.toY})),k=b.subgraphs.map(P=>({...P,x:P.x+S}));u.push(...y),p.push(...w),h.push(...k),g.push(y.find(P=>P.id===b.entryNode.id));let T=new Set(b.exitNodes.map(P=>P.id));f.push(...y.filter(P=>T.has(P.id))),v+=b.width+QPi}return{nodes:u,edges:p,subgraphs:h,entryNodes:g,exitNodes:f,width:l,height:c}}function wln(a,i){if(a.nodes.length===0)return;let e=1/0,t=-1/0;for(let n of a.nodes)e=Math.min(e,n.x),t=Math.max(t,n.x+n.width);let o=i-(e+t)/2;for(let n=0;n<a.nodes.length;n++){let r=a.nodes[n];a.nodes[n]={...r,x:r.x+o}}for(let n=0;n<a.edges.length;n++){let r=a.edges[n];a.edges[n]={fromId:r.fromId,toId:r.toId,fromX:r.fromX+o,fromY:r.fromY,toX:r.toX+o,toY:r.toY}}for(let n=0;n<a.subgraphs.length;n++){let r=a.subgraphs[n];a.subgraphs[n]={...r,x:r.x+o}}}var kWe="http://www.w3.org/2000/svg";function Qv(a,i){let e=document.createElementNS(kWe,a);for(let[t,o]of Object.entries(i))e.setAttribute(t,String(o));return e}function Cln(a,i){if(i)return"var(--vscode-errorForeground)";switch(a){case"userMessage":return"var(--vscode-textLink-foreground)";case"modelTurn":return"var(--vscode-charts-blue, var(--vscode-textLink-foreground))";case"toolCall":return"var(--vscode-testing-iconPassed, #73c991)";case"subagentInvocation":return"var(--vscode-charts-purple, #b267e6)";case"agentResponse":return"var(--vscode-foreground)";case"generic":return"var(--vscode-descriptionForeground)"}}var $wo=["var(--vscode-charts-purple, #b267e6)","var(--vscode-charts-blue, #3dc9b0)","var(--vscode-charts-yellow, #e5c07b)","var(--vscode-charts-orange, #d19a66)"];function JPi(a){let i=new Map,e=Qv("svg",{width:a.width,height:a.height,viewBox:`0 0 ${a.width} ${a.height}`,role:"img","aria-label":`Agent flow chart with ${a.nodes.length} nodes`});e.classList.add("chat-debug-flowchart-svg"),xln(e,a.subgraphs,i),kln(e,a.edges),Eln(e,a.nodes,i);let t=new Map;for(let r of a.subgraphs)t.set(`sg:${r.nodeId}`,{y:r.y,x:r.x});for(let r of a.nodes)t.set(r.id,{y:r.y,x:r.x});let o=new Map([...i.entries()].sort((r,s)=>{let l=t.get(r[0]),c=t.get(s[0]);return!l||!c?0:l.y!==c.y?l.y-c.y:l.x-c.x})),n=new Map;for(let r of a.edges)if(r.fromId&&r.toId){let s=n.get(r.fromId);s||(s={next:[],prev:[]},n.set(r.fromId,s)),s.next.push(r.toId);let l=n.get(r.toId);l||(l={next:[],prev:[]},n.set(r.toId,l)),l.prev.push(r.fromId)}return{svg:e,focusableElements:o,adjacency:n,positions:t}}function xln(a,i,e){for(let t=0;t<i.length;t++){let o=i[t],n=$wo[o.depth%$wo.length],r=o.collapsedChildCount!==void 0,s=document.createElementNS(kWe,"g");s.classList.add("chat-debug-flowchart-subgraph");let l={x:o.x,y:o.y,width:o.width,height:o.height,rx:xWe,ry:xWe},c=`sg-clip-${t}`,u=Qv("clipPath",{id:c});u.appendChild(Qv("rect",l)),a.appendChild(u),s.appendChild(Qv("rect",{...l,fill:n,opacity:.06+o.depth*.02})),s.appendChild(Qv("rect",{...l,fill:"none",stroke:n,"stroke-width":1,"stroke-dasharray":"6,3",opacity:.5})),s.appendChild(Qv("rect",{x:o.x,y:o.y,width:Kwo,height:o.height,fill:n,opacity:.7,"clip-path":`url(#${c})`}));let p=document.createElementNS(kWe,"g");p.setAttribute("data-subgraph-id",o.nodeId),p.classList.add("chat-debug-flowchart-subgraph-header"),p.setAttribute("tabindex","0"),p.setAttribute("role","button"),p.setAttribute("aria-expanded",String(!r)),p.setAttribute("aria-label",`${o.label}: ${r?"collapsed":"expanded"}${r&&o.collapsedChildCount!==void 0?`, ${o.collapsedChildCount} items hidden`:""}`);let h=Qv("rect",{x:o.x,y:o.y,width:o.width,height:ffe,fill:n,opacity:.15,"clip-path":`url(#${c})`});p.appendChild(h);let g=r?"\u25B6":"\u25BC",f=Qv("text",{x:o.x+Kwo+8,y:o.y+ffe/2+4,"font-size":Qrt,fill:n,"font-family":"var(--vscode-font-family, sans-serif)","font-weight":"600"});if(f.textContent=`${g} ${o.label}`,p.appendChild(f),s.appendChild(p),e.set(`sg:${o.nodeId}`,p),r&&o.collapsedChildCount!==void 0){let v=Qv("text",{x:o.x+o.width/2,y:o.y+ffe+PQ+4,"font-size":Qrt,fill:"var(--vscode-descriptionForeground)","font-family":"var(--vscode-font-family, sans-serif)","font-style":"italic","text-anchor":"middle"});v.textContent=`+${o.collapsedChildCount} items`,s.appendChild(v)}a.appendChild(s)}}function kln(a,i){let e={fill:"none",stroke:"var(--vscode-descriptionForeground)","stroke-width":bln,"stroke-linecap":"round"},t=6;for(let o of i){let n=(o.fromY+o.toY)/2,r,s=o.fromY===o.toY;if(s)r=`M ${o.fromX} ${o.fromY} L ${o.toX} ${o.toY}`;else if(o.fromX===o.toX)r=`M ${o.fromX} ${o.fromY} L ${o.toX} ${o.toY}`;else{let u=o.toX-o.fromX,p=u>0?1:-1,h=Math.abs(u),g=Math.min(t,h/2,(o.toY-o.fromY)/4);r=`M ${o.fromX} ${o.fromY} L ${o.fromX} ${n-g} Q ${o.fromX} ${n}, ${o.fromX+p*g} ${n} L ${o.toX-p*g} ${n} Q ${o.toX} ${n}, ${o.toX} ${n+g} L ${o.toX} ${o.toY}`}a.appendChild(Qv("path",{...e,d:r}));let l=5,c;if(s){let u=o.toX>o.fromX?1:-1;c=`M ${o.toX-u*l*1.5} ${o.toY-l} L ${o.toX} ${o.toY} L ${o.toX-u*l*1.5} ${o.toY+l}`}else c=`M ${o.toX-l} ${o.toY-l*1.5} L ${o.toX} ${o.toY} L ${o.toX+l} ${o.toY-l*1.5}`;a.appendChild(Qv("path",{...e,"stroke-linejoin":"round",d:c}))}}function Eln(a,i,e){let t="var(--vscode-font-family, sans-serif)",o="var(--vscode-editor-background, var(--vscode-editorWidget-background))";for(let n of i){let r=document.createElementNS(kWe,"g");r.classList.add("chat-debug-flowchart-node"),r.setAttribute("data-node-id",n.id),r.setAttribute("tabindex","0"),r.setAttribute("role","img");let s=n.sublabel?`${n.label}, ${n.sublabel}`:n.label;if(r.setAttribute("aria-label",s),e.set(n.id,r),n.tooltip){let b=document.createElementNS(kWe,"title");b.textContent=n.tooltip,r.appendChild(b)}let l=Cln(n.kind,n.isError),c=n.id.replace(/[^a-zA-Z0-9]/g,"_"),u={x:n.x,y:n.y,width:n.width,height:n.height,rx:xWe,ry:xWe},p=`clip-${c}`,h=Qv("clipPath",{id:p});h.appendChild(Qv("rect",u)),a.appendChild(h);let g=3;r.appendChild(Qv("rect",{class:"chat-debug-flowchart-focus-ring",x:n.x-g,y:n.y-g,width:n.width+g*2,height:n.height+g*2,rx:xWe+g,ry:xWe+g,fill:"none",stroke:"var(--vscode-focusBorder)","stroke-width":2})),r.appendChild(Qv("rect",{...u,fill:o,stroke:l,"stroke-width":n.isError?2:1.5})),r.appendChild(Qv("rect",{x:n.x,y:n.y,width:4,height:n.height,fill:l,"clip-path":`url(#${p})`}));let f=n.x+jPi;if(Ywo(n.kind)&&n.sublabel){let b=Qv("text",{x:f,y:n.y+kqt+Qrt,"font-size":Qrt,fill:"var(--vscode-descriptionForeground)","font-family":t,"clip-path":`url(#${p})`});b.textContent=n.label,r.appendChild(b);let S=Qv("text",{x:f,y:n.y+n.height-kqt-2,"font-size":jrt,fill:"var(--vscode-foreground)","font-family":t,"clip-path":`url(#${p})`});S.textContent=n.sublabel,r.appendChild(S)}else if(n.sublabel){let b=Qv("text",{x:f,y:n.y+kqt+jrt,"font-size":jrt,fill:"var(--vscode-foreground)","font-family":t,"clip-path":`url(#${p})`});b.textContent=n.label,r.appendChild(b);let S=Qv("text",{x:f,y:n.y+n.height-kqt,"font-size":Qrt,fill:"var(--vscode-descriptionForeground)","font-family":t,"clip-path":`url(#${p})`});S.textContent=n.sublabel,r.appendChild(S)}else{let b=Qv("text",{x:f,y:n.y+n.height/2+jrt/2-1,"font-size":jrt,fill:"var(--vscode-foreground)","font-family":t,"clip-path":`url(#${p})`});b.textContent=n.label,r.appendChild(b)}n.mergedCount&&(r.setAttribute("data-is-toggle","true"),Tln(r,n,l,t)),a.appendChild(r)}}function Tln(a,i,e,t){let o=i.x+i.width-Tqt,n=document.createElementNS(kWe,"g");n.classList.add("chat-debug-flowchart-merged-toggle"),n.setAttribute("data-merged-id",i.id),n.appendChild(Qv("line",{x1:o,y1:i.y+4,x2:o,y2:i.y+i.height-4,stroke:"var(--vscode-descriptionForeground)","stroke-width":.5,opacity:.4}));let r=o+Tqt/2,s=i.y+i.height/2,l=Qv("text",{x:r,y:s+4,"font-size":9,fill:e,"font-family":t,"text-anchor":"middle",cursor:"pointer"});l.textContent=i.isMergedExpanded?"\u25C0":"\u25B6",n.appendChild(l),n.appendChild(Qv("rect",{x:o,y:i.y,width:Tqt,height:i.height,fill:"transparent",cursor:"pointer"})),a.appendChild(n)}var pq=_,tCo=.1,iCo=5,oCo=.15,_ln=.002,Dln=25,_qt=100;var EWe=class extends x{constructor(e,t,o,n,r,s){super();this.filterState=t;this.chatService=o;this.chatDebugService=n;this.contextKeyService=r;this.instantiationService=s;this._onNavigate=this._register(new E);this.onNavigate=this._onNavigate.event;this.loadDisposables=this._register(new N);this.scale=1;this.translateX=0;this.translateY=0;this.isPanning=!1;this.startX=0;this.startY=0;this.mouseDownX=0;this.mouseDownY=0;this.lastEventCount=0;this.hasUserPanned=!1;this.collapsedNodeIds=new Set;this.expandedMergedIds=new Set;this.visibleLimit=_qt;this.eventById=new Map;this.container=M(e,pq(".chat-debug-flowchart")),vo(this.container);let l=M(this.container,pq(".chat-debug-breadcrumb"));this.breadcrumbWidget=this._register(new K2(l,3,void 0,R.chevronRight,Tz)),this._register(SWe(l,this.breadcrumbWidget)),this._register(this.breadcrumbWidget.onDidSelectItem(v=>{if(v.type==="select"&&v.item instanceof $T){this.breadcrumbWidget.setSelection(void 0);let S=this.breadcrumbWidget.getItems().indexOf(v.item);S===0?this._onNavigate.fire("home"):S===1&&this._onNavigate.fire("overview")}})),this.headerContainer=M(this.container,pq(".chat-debug-editor-header"));let c=this.headerContainer,u=this._register(this.contextKeyService.createScoped(c)),p=vqt(this.filterState,u);p();let h=this._register(this.instantiationService.createChild(new _o([X,u])));this.filterWidget=this._register(h.createInstance(m2,{placeholder:d(6761,null),ariaLabel:d(6758,null)})),M(c,pq(".viewpane-filter-container")).appendChild(this.filterWidget.element),this._register(this.filterWidget.onDidChangeFilterText(v=>{this.filterState.setTextFilter(v)})),this._register(this.filterState.onDidChange(()=>{p(),this.filterWidget.checkMoreFilters(!this.filterState.isAllFiltersDefault()),this.visibleLimit=_qt,this.hasUserPanned=!1,this.lastEventCount=0,this.load()}));let f=M(this.container,pq(".chat-debug-flowchart-content-wrapper"));this.content=M(f,pq(".chat-debug-flowchart-content")),this.detailPanel=this._register(this.instantiationService.createInstance(woe,f)),this.setupPanZoom(),this.setupKeyboard(),this.refreshScheduler=this._register(new Dt(()=>this.load(),100))}setSession(e){(!this.currentSessionResource||this.currentSessionResource.toString()!==e.toString())&&(this.scale=1,this.translateX=0,this.translateY=0,this.lastEventCount=0,this.hasUserPanned=!1,this.focusedElementId=void 0,this.collapsedNodeIds.clear(),this.expandedMergedIds.clear(),this.visibleLimit=_qt,this.detailPanel.hide()),this.currentSessionResource=e}show(){un(this.container),this.load()}hide(){vo(this.container),this.refreshScheduler.cancel()}refresh(){this.container.style.display!=="none"&&(this.refreshScheduler.isScheduled()||this.refreshScheduler.schedule())}updateBreadcrumb(){if(!this.currentSessionResource)return;let e=this.chatService.getSessionTitle(this.currentSessionResource)||Jr.parseLocalSessionId(this.currentSessionResource)||this.currentSessionResource.toString();this.breadcrumbWidget.setItems([new $T(d(6764,null),!0),new $T(e,!0),new $T(d(6757,null))])}load(){let e=Gr(this.content);Rt(this.content),this.loadDisposables.clear(),this.updateBreadcrumb();let t=this.chatDebugService.getEvents(this.currentSessionResource),o=this.lastEventCount===0;this.lastEventCount=t.length,this.eventById.clear();for(let u of t)u.id&&this.eventById.set(u.id,u);if(t.length===0){let u=M(this.content,pq(".chat-debug-flowchart-empty"));u.textContent=d(6759,null);return}let n=GPi(t),r=qPi(n,{isKindVisible:(u,p)=>this.filterState.isKindVisible(u,p),textFilter:this.filterState.textFilter});if(r.length===0){let u=M(this.content,pq(".chat-debug-flowchart-empty"));u.textContent=d(6760,null);return}let s=$Pi(r,this.visibleLimit),l=$rt(xqt(s.nodes)),c=XPi(l,{collapsedIds:this.collapsedNodeIds,expandedMergedIds:this.expandedMergedIds});if(this.renderResult=JPi(c),this.svgWrapper=M(this.content,pq(".chat-debug-flowchart-svg-wrapper")),this.svgWrapper.appendChild(this.renderResult.svg),this.svgElement=this.renderResult.svg,s.shownCount<s.totalCount){let u=s.totalCount-s.shownCount,p=M(this.svgWrapper,pq(".chat-debug-flowchart-show-more")),h=this.loadDisposables.add(new Wi(p,{...Qo,secondary:!0,title:d(6763,null)}));h.label=d(6762,null,u),this.loadDisposables.add(h.onDidClick(()=>{this.visibleLimit+=_qt,this.load()}))}o&&!this.hasUserPanned?Re(this.content).requestAnimationFrame(()=>{this.centerContent()}):this.applyTransform(),this.focusedElementId&&e&&!Gr(this.headerContainer)&&this.restoreFocus(this.focusedElementId)}setupPanZoom(){this._register(j(this.content,re.MOUSE_DOWN,t=>this.handleMouseDown(t)));let e=Re(this.content).document;this._register(j(e,re.MOUSE_MOVE,t=>this.handleMouseMove(t))),this._register(j(e,re.MOUSE_UP,t=>this.handleMouseUp(t))),this._register(j(this.content,"wheel",t=>this.handleWheel(t),{passive:!1}))}setupKeyboard(){this._register(j(this.content,re.FOCUS_IN,e=>{let t=e.target;if(!t)return;let o=t.getAttribute?.("data-subgraph-id");if(o){this.focusedElementId=`sg:${o}`;return}let n=t.getAttribute?.("data-node-id");n&&(this.focusedElementId=n)})),this._register(j(this.content,re.KEY_DOWN,e=>{let t=e.target;if(!t)return;let o=t.getAttribute?.("data-subgraph-id");switch(e.key){case"Tab":{this.focusedElementId?this.focusAdjacentElement(this.focusedElementId,e.shiftKey?-1:1)?e.preventDefault():!e.shiftKey&&this.detailPanel.isVisible&&(e.preventDefault(),this.detailPanel.focus()):e.shiftKey||(e.preventDefault(),this.focusFirstElement());break}case"Enter":case" ":if(o)e.preventDefault(),e.stopPropagation(),this.detailPanel.hide(),this.toggleSubgraph(o);else{let n=t.getAttribute?.("data-node-id");if(n)if(e.preventDefault(),t.getAttribute?.("data-is-toggle"))this.detailPanel.hide(),this.toggleMergedDiscovery(n);else{let r=this.eventById.get(n);r&&this.detailPanel.show(r)}}break;case"ArrowDown":e.preventDefault(),this.focusedElementId?this.focusEdgeNeighbor(this.focusedElementId,"next"):this.focusFirstElement();break;case"ArrowRight":if(e.preventDefault(),this.focusedElementId){if(o&&this.collapsedNodeIds.has(o))this.detailPanel.hide(),this.collapsedNodeIds.delete(o),this.focusedElementId=`sg:${o}`,this.load(),this.focusFirstChildOf(`sg:${o}`);else if(t.getAttribute?.("data-is-toggle"))if(this.expandedMergedIds.has(this.focusedElementId))this.focusFirstChildOf(this.focusedElementId);else{this.detailPanel.hide();let n=this.focusedElementId;this.expandedMergedIds.add(n),this.focusedElementId=n,this.load(),this.focusFirstChildOf(n)}}else this.focusFirstElement();break;case"ArrowUp":e.preventDefault(),this.focusedElementId?this.focusEdgeNeighbor(this.focusedElementId,"prev"):this.focusFirstElement();break;case"ArrowLeft":e.preventDefault(),this.focusedElementId&&(o&&!this.collapsedNodeIds.has(o)?(this.detailPanel.hide(),this.toggleSubgraph(o)):t.getAttribute?.("data-is-toggle")&&this.expandedMergedIds.has(this.focusedElementId)?(this.detailPanel.hide(),this.toggleMergedDiscovery(this.focusedElementId)):this.focusEdgeNeighbor(this.focusedElementId,"prev"));break;case"Home":e.preventDefault(),this.focusFirstElement();break;case"End":e.preventDefault(),this.focusLastElement();break;case"=":case"+":!e.ctrlKey&&!e.metaKey&&(e.preventDefault(),this.zoomBy(oCo));break;case"-":!e.ctrlKey&&!e.metaKey&&(e.preventDefault(),this.zoomBy(-oCo));break}}))}toggleSubgraph(e){this.collapsedNodeIds.has(e)?this.collapsedNodeIds.delete(e):this.collapsedNodeIds.add(e),this.focusedElementId=`sg:${e}`,this.load()}toggleMergedDiscovery(e){this.expandedMergedIds.has(e)?this.expandedMergedIds.delete(e):this.expandedMergedIds.add(e),this.focusedElementId=e,this.load()}focusFirstElement(){if(!this.renderResult)return;let e=this.renderResult.focusableElements.values().next();e.done||e.value.focus()}focusLastElement(){if(!this.renderResult)return;let e=[...this.renderResult.focusableElements.values()];e.length>0&&e[e.length-1].focus()}focusAdjacentElement(e,t){if(!this.renderResult)return!1;let o=[...this.renderResult.focusableElements.keys()],n=o.indexOf(e);if(n===-1)return!1;let r=n+t;if(r<0||r>=o.length)return!1;let s=this.renderResult.focusableElements.get(o[r]);return s?(s.focus(),!0):!1}focusEdgeNeighbor(e,t){if(!this.renderResult)return!1;let n=this.renderResult.adjacency.get(e)?.[t];if(!n||n.length===0)return!1;for(let r of n){let s=this.renderResult.focusableElements.get(r);if(s)return s.focus(),!0}return!1}focusFirstChildOf(e){if(!this.renderResult)return;let t=this.renderResult.adjacency.get(e);if(!t?.next||t.next.length===0)return;let o=this.renderResult.positions.get(e),n;for(let r of t.next)if(this.renderResult.focusableElements.has(r)&&(n||(n=r),o)){let s=this.renderResult.positions.get(r);if(s&&s.x>o.x){n=r;break}}if(n){let r=this.renderResult.focusableElements.get(n);r&&(this.focusedElementId=n,r.focus())}}restoreFocus(e){let t=this.renderResult?.focusableElements.get(e);t&&t.focus()}zoomBy(e){let t=this.content.getBoundingClientRect(),o=t.width/2,n=t.height/2,r=Math.min(iCo,Math.max(tCo,this.scale*(1+e))),s=r/this.scale;this.translateX=o-(o-this.translateX)*s,this.translateY=n-(n-this.translateY)*s,this.scale=r,this.hasUserPanned=!0,this.applyTransform()}handleMouseDown(e){e.button===0&&(e.preventDefault(),this.isPanning=!0,this.hasUserPanned=!0,this.startX=e.clientX-this.translateX,this.startY=e.clientY-this.translateY,this.mouseDownX=e.clientX,this.mouseDownY=e.clientY,this.content.style.cursor="grabbing")}handleMouseMove(e){if(this.isPanning){if(e.buttons===0){this.handleMouseUp(e);return}this.translateX=e.clientX-this.startX,this.translateY=e.clientY-this.startY,this.applyTransform()}}handleMouseUp(e){if(this.isPanning){this.isPanning=!1,this.content.style.cursor="grab";let t=e.clientX-this.mouseDownX,o=e.clientY-this.mouseDownY;t*t+o*o<Dln&&this.handleClick(e)}}handleClick(e){let t=e.target;for(;t&&t!==this.content;){let o=t.getAttribute?.("data-merged-id");if(o){this.detailPanel.hide(),this.toggleMergedDiscovery(o);return}let n=t.getAttribute?.("data-subgraph-id");if(n){this.detailPanel.hide(),this.toggleSubgraph(n);return}let r=t.getAttribute?.("data-node-id");if(r){if(t.focus(),t.getAttribute?.("data-is-toggle"))this.detailPanel.hide(),this.toggleMergedDiscovery(r);else{let s=this.eventById.get(r);s&&this.detailPanel.show(s)}return}t=t.parentElement}}handleWheel(e){e.preventDefault(),e.stopPropagation(),this.hasUserPanned=!0;let t=this.content.getBoundingClientRect(),o=e.clientX-t.left,n=e.clientY-t.top,r=-e.deltaY*_ln,s=Math.min(iCo,Math.max(tCo,this.scale*(1+r))),l=s/this.scale;this.translateX=o-(o-this.translateX)*l,this.translateY=n-(n-this.translateY)*l,this.scale=s,this.applyTransform()}applyTransform(){this.svgWrapper&&(this.svgWrapper.style.transform=`translate(${this.translateX}px, ${this.translateY}px) scale(${this.scale})`)}centerContent(){let e=this.content.getBoundingClientRect();if(!this.svgElement)return;let t=parseFloat(this.svgElement.getAttribute("width")||"0"),o=parseFloat(this.svgElement.getAttribute("height")||"0");if(t<=0||o<=0)return;let n=20;this.translateX=Math.max(n,(e.width-t)/2),this.translateY=n,this.applyTransform()}};EWe=I([m(2,mi),m(3,Yp),m(4,X),m(5,F)],EWe);var Lln=_,xoe=class extends Ts{constructor(e,t,o,n,r,s,l,c,u,p){super(xoe.ID,e,t,o,n);this.instantiationService=r;this.chatDebugService=s;this.chatWidgetService=l;this.chatService=c;this.contextKeyService=u;this.configurationService=p;this.viewState="home";this.sessionModelListener=this._register(new me);this.modelChangeListeners=this._register(new Vt)}static{this.ID="workbench.editor.chatDebug"}endActiveSession(){let e=this.chatDebugService.activeSessionResource;e&&this.chatDebugService.endSession(e),this.chatDebugService.activeSessionResource=void 0}createEditor(e){this.container=M(e,Lln(".chat-debug-editor")),this.filterState=this._register(new fqt);let t=this._register(this.contextKeyService.createScoped(this.container));this._register(Iwo(this.filterState,t)),this.homeView=this._register(this.instantiationService.createInstance(IWe,this.container)),this._register(this.homeView.onNavigateToSession(o=>{this.navigateToSession(o)})),this.overviewView=this._register(this.instantiationService.createInstance(yWe,this.container)),this._register(this.overviewView.onNavigate(o=>{switch(o){case"home":this.endActiveSession(),this.showView("home");break;case"logs":this.showView("logs");break;case"flowchart":this.showView("flowchart");break}})),this.logsView=this._register(this.instantiationService.createInstance(wWe,this.container,this.filterState)),this._register(this.logsView.onNavigate(o=>{switch(o){case"home":this.endActiveSession(),this.showView("home");break;case"overview":this.showView("overview");break}})),this.flowChartView=this._register(this.instantiationService.createInstance(EWe,this.container,this.filterState)),this._register(this.flowChartView.onNavigate(o=>{switch(o){case"home":this.endActiveSession(),this.showView("home");break;case"overview":this.showView("overview");break}})),this._register(this.chatDebugService.onDidAddEvent(o=>{this.viewState==="home"?this.homeView?.render():this.chatDebugService.activeSessionResource&&o.sessionResource.toString()===this.chatDebugService.activeSessionResource.toString()&&(this.viewState==="overview"?this.overviewView?.refresh():this.viewState==="logs"?this.logsView?.refreshList():this.viewState==="flowchart"&&this.flowChartView?.refresh())})),this._register(this.chatWidgetService.onDidChangeFocusedSession(()=>{this.viewState==="home"&&this.homeView?.render()})),this._register(this.chatService.onDidCreateModel(o=>{let n=o.sessionResource.toString();this.modelChangeListeners.set(n,o.onDidChange(r=>{r.kind==="setCustomTitle"&&(this.viewState==="home"?this.homeView?.render():(this.viewState==="overview"||this.viewState==="logs"||this.viewState==="flowchart")&&(this.overviewView?.updateBreadcrumb(),this.logsView?.updateBreadcrumb(),this.flowChartView?.updateBreadcrumb()))}))})),this._register(this.chatService.onDidDisposeSession(()=>{this.viewState==="home"&&this.homeView?.render()})),this.showView("home")}showView(e){this.viewState=e,this.telemetryService.publicLog2("chatDebugViewSwitched",{viewState:e}),e==="home"?this.homeView?.show():this.homeView?.hide(),e==="overview"?this.overviewView?.show():this.overviewView?.hide(),e==="logs"?(this.logsView?.show(),this.doLayout(),this.logsView?.focus()):this.logsView?.hide(),e==="flowchart"?this.flowChartView?.show():this.flowChartView?.hide()}navigateToSession(e,t){let o=this.chatDebugService.activeSessionResource;o&&o.toString()!==e.toString()&&this.chatDebugService.endSession(o),this.chatDebugService.activeSessionResource=e,this.chatDebugService.hasInvokedProviders(e)||this.chatDebugService.invokeProviders(e),this.trackSessionModelChanges(e),this.overviewView?.setSession(e),this.logsView?.setSession(e),this.flowChartView?.setSession(e),this.showView(t==="logs"?"logs":t==="flowchart"?"flowchart":"overview")}trackSessionModelChanges(e){let t=this.chatService.getSession(e);if(!t){this.sessionModelListener.clear();return}this.sessionModelListener.value=t.onDidChange(o=>{(o.kind==="addRequest"||o.kind==="completedRequest")&&this.viewState==="overview"&&this.overviewView?.refresh()})}focus(){this.viewState==="logs"?this.logsView?.focus():this.container?.focus()}async setInput(e,t,o,n){await super.setInput(e,t,o,n),t&&this._applyNavigationOptions(t)}setOptions(e){super.setOptions(e),e&&this._applyNavigationOptions(e)}setEditorVisible(e){if(super.setEditorVisible(e),e){if(this.telemetryService.publicLog2("chatDebugPanelOpened"),!this.configurationService.getValue(BR)){this.endActiveSession(),this.showView("home");return}this.showView(this.viewState)}}_applyNavigationOptions(e){if(!this.configurationService.getValue(BR)){this.endActiveSession(),this.showView("home");return}let{sessionResource:t,viewHint:o,filter:n}=e;o==="logs"&&t?this.navigateToSession(t,"logs"):o==="flowchart"&&t?this.navigateToSession(t,"flowchart"):o==="overview"&&t?this.navigateToSession(t,"overview"):o==="home"?(this.endActiveSession(),this.showView("home")):t?this.navigateToSession(t,"overview"):this.viewState==="home"&&this.showView("home"),n!==void 0&&this.filterState&&(this.filterState.setTextFilter(n),this.logsView?.setFilterText(n))}layout(e){this.currentDimension=e,this.container&&(this.container.style.width=`${e.width}px`,this.container.style.height=`${e.height}px`),this.doLayout()}doLayout(){!this.currentDimension||this.viewState!=="logs"||this.logsView?.layout(this.currentDimension)}};xoe=I([m(1,Te),m(2,Le),m(3,ce),m(4,F),m(5,Yp),m(6,Pt),m(7,mi),m(8,X),m(9,B)],xoe);var AQ=class extends x{constructor(e,t){super();this._discoveryEventDetails=new Map;this._register(e.onDidLogDiscovery(o=>{let n;if(o.discoveryInfo&&(n=xt(),this._discoveryEventDetails.set(n,o.discoveryInfo),this._discoveryEventDetails.size>AQ.MAX_DISCOVERY_DETAILS)){let s=this._discoveryEventDetails.keys().next().value;s!==void 0&&this._discoveryEventDetails.delete(s)}let r=o.details;if(o.discoveryInfo){let s=o.discoveryInfo,l=s.files.filter(h=>h.status==="loaded").map(h=>h.promptPath.name??h.promptPath.uri.path.split("/").pop()??h.promptPath.uri.toString()),c=s.files.filter(h=>h.status==="skipped").map(h=>{let g=h.promptPath.uri.toString();return h.skipReason?`${g} (${h.skipReason})`:g}),u=s.sourceFolders?.map(h=>h.uri.path)??[],p=[];r&&p.push(r),l.length>0&&p.push(`loaded: [${eAi(l)}]`),c.length>0&&p.push(`skipped: [${eAi(c)}]`),u.length>0&&p.push(`folders: [${eAi(u)}]`),r=p.join(" | ")||void 0}t.log(o.sessionResource,o.name,r,void 0,{id:n,category:o.category})})),this._register(t.registerProvider({provideChatDebugLog:async()=>{},resolveChatDebugLogEvent:async o=>this._resolveDiscoveryEvent(o)}))}static{this.ID="workbench.contrib.promptsDebug"}static{this.MAX_DISCOVERY_DETAILS=1e4}_resolveDiscoveryEvent(e){let t=this._discoveryEventDetails.get(e);if(t)return{kind:"fileList",discoveryType:t.type,files:t.files.map(o=>({uri:o.promptPath.uri,name:o.promptPath.name,status:o.status,storage:o.promptPath.storage,extensionId:o.promptPath.extension?.identifier.value,skipReason:o.skipReason,errorMessage:o.errorMessage,duplicateOf:o.duplicateOf})),sourceFolders:t.sourceFolders?.map(o=>({uri:o.uri,storage:o.storage}))}}};AQ=I([m(0,Or),m(1,Yp)],AQ);var ZPi=100;function eAi(a){return a.length<=ZPi?a.join(", "):a.slice(0,ZPi).join(", ")+` (+${a.length-ZPi} more)`}var vfe=le("agentTitleBarStatusService"),Dqt=class extends x{constructor(){super(...arguments);this._mode="default";this._onDidChangeMode=this._register(new E);this.onDidChangeMode=this._onDidChangeMode.event;this._onDidChangeSessionInfo=this._register(new E);this.onDidChangeSessionInfo=this._onDidChangeSessionInfo.event}get mode(){return this._mode}get sessionInfo(){return this._sessionInfo}enterSessionMode(e,t){let o={sessionResource:e,title:t},n=this._mode!=="session";this._mode="session",this._sessionInfo=o,n&&this._onDidChangeMode.fire(this._mode),this._onDidChangeSessionInfo.fire(this._sessionInfo)}enterSessionReadyMode(e,t){let o={sessionResource:e,title:t},n=this._mode!=="sessionReady";this._mode="sessionReady",this._sessionInfo=o,n&&this._onDidChangeMode.fire(this._mode),this._onDidChangeSessionInfo.fire(this._sessionInfo)}exitSessionReadyMode(){this._mode==="sessionReady"&&(this._mode="default",this._sessionInfo=void 0,this._onDidChangeMode.fire(this._mode),this._onDidChangeSessionInfo.fire(void 0))}exitSessionMode(){this._mode!=="default"&&(this._mode="default",this._sessionInfo=void 0,this._onDidChangeMode.fire(this._mode),this._onDidChangeSessionInfo.fire(void 0))}updateSessionTitle(e){this._mode!=="session"||!this._sessionInfo||(this._sessionInfo={...this._sessionInfo,title:e},this._onDidChangeSessionInfo.fire(this._sessionInfo))}};var TWe=new Y("chatInAgentSessionProjection",!1,{type:"boolean",description:d(6146,null)});var tAi=new Set(Object.values(yf)),DWe=le("agentSessionProjectionService"),_We=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this.configurationService=t;this.editorGroupsService=o;this.editorService=n;this.logService=r;this.chatWidgetService=s;this.chatSessionsService=l;this.layoutService=c;this.commandService=u;this.chatEditingService=p;this.agentTitleBarStatusService=h;this.agentSessionsService=g;this._isActive=!1;this._isExiting=!1;this._isSwappingSessions=!1;this._onDidChangeProjectionMode=this._register(new E);this.onDidChangeProjectionMode=this._onDidChangeProjectionMode.event;this._onDidChangeActiveSession=this._register(new E);this.onDidChangeActiveSession=this._onDidChangeActiveSession.event;this._sessionWorkingSets=new Map;this._wasAuxiliaryBarMaximized=!1;this._inProjectionModeContextKey=TWe.bindTo(e),this._register(this.editorService.onDidCloseEditor(()=>this._checkForEmptyEditors())),this._register(this.agentSessionsService.model.onDidChangeSessions(()=>this._checkForInProgressSession()))}get isActive(){return this._isActive}get activeSession(){return this._activeSession}_isEnabled(){return this.configurationService.getValue("chat.agentSessionProjection.enabled")===!0}_checkForEmptyEditors(){if(!this._isActive||this._isExiting||this._isSwappingSessions)return;this.editorService.visibleEditors.length>0||(this.logService.trace("[AgentSessionProjection] All editors closed, exiting projection mode"),this.exitProjection())}_checkForInProgressSession(){if(!this._isActive||!this._activeSession)return;let e=this.agentSessionsService.getSession(this._activeSession.resource);e&&HC(e.status)&&(this.logService.trace("[AgentSessionProjection] Active session transitioned to in-progress, exiting projection mode"),this.exitProjection({startNewChat:!1}))}async _openSessionInChatPanel(e){e.setRead(!0),await this.chatSessionsService.activateChatSessionItemProvider(e.providerType),await this.chatWidgetService.openSession(e.resource,void 0,{title:{preferred:e.label},revealIfOpened:!0})}async _openSessionFiles(e){if(this.logService.trace(`[AgentSessionProjection] Opening files for session '${e.label}'`,{hasChanges:!!e.changes,isArray:Array.isArray(e.changes),changeCount:Array.isArray(e.changes)?e.changes.length:0}),e.changes&&Array.isArray(e.changes)&&e.changes.length>0){let t=e.changes.filter(o=>o.originalUri).map(o=>({originalUri:o.originalUri,modifiedUri:o.modifiedUri}));if(this.logService.trace(`[AgentSessionProjection] Found ${t.length} files with diffs to display`),t.length>0){await this.editorService.openEditor({multiDiffSource:e.resource.with({scheme:e.resource.scheme+"-agent-session-projection"}),resources:t.map(r=>({original:{resource:r.originalUri},modified:{resource:r.modifiedUri}})),label:d(6151,null,e.label)},OR),this.logService.trace("[AgentSessionProjection] Multi-diff editor opened successfully in modal view");let o=e.resource.toString(),n=this.editorGroupsService.saveWorkingSet(`agent-session-projection-${o}`);return this._sessionWorkingSets.set(o,n),!0}else return this.logService.trace("[AgentSessionProjection] No files with diffs to display (all changes missing originalUri)"),!1}else return this.logService.trace("[AgentSessionProjection] Session has no changes to display"),!1}async enterProjection(e){if(!this._isEnabled()){this.logService.trace("[AgentSessionProjection] Agent Session Projection is disabled");return}if(!tAi.has(e.providerType)){this.logService.trace(`[AgentSessionProjection] Provider type '${e.providerType}' does not support agent session projection`);return}let t=this.layoutService.isAuxiliaryBarMaximized();if(this.logService.trace("[AgentSessionProjection] enterProjection auxiliary bar state",{isAuxiliaryBarMaximized:t}),HC(e.status)){this.logService.trace("[AgentSessionProjection] Session is in progress, opening chat without projection mode"),this._isActive&&await this.exitProjection({startNewChat:!1}),await this._openSessionInChatPanel(e);return}let o=!0,n=!0;if(e.providerType==="local"){let r=this.chatEditingService.getEditingSession(e.resource);n=!!r,r?(o=r.entries.get().some(s=>s.state.get()===0),o||this.logService.trace("[AgentSessionProjection] Local session has no undecided changes, opening chat without projection mode")):(o=!1,this.logService.trace("[AgentSessionProjection] Local session has no editing session yet"))}if(!o&&this._isActive&&n){this.logService.trace("[AgentSessionProjection] Switching to session without changes while in projection mode, exiting projection"),await this.exitProjection({startNewChat:!1}),await this._openSessionInChatPanel(e);return}if(!o&&this._isActive&&!n){this.logService.trace("[AgentSessionProjection] Switching to session without editing session while in projection mode, staying in projection"),await this._openSessionInChatPanel(e);return}if(o){if(!this._isActive&&!this._preProjectionWorkingSet){let s=this.editorService.visibleEditors.length;this._preProjectionWorkingSet=this.editorGroupsService.saveWorkingSet("agent-session-projection-backup"),this.logService.trace("[AgentSessionProjection] saved pre-projection working set",{id:this._preProjectionWorkingSet.id,visibleEditorsBefore:s})}if(this._isActive&&this._activeSession){this._isSwappingSessions=!0;let s=this._activeSession.resource.toString(),l=this.editorGroupsService.saveWorkingSet(`agent-session-projection-${s}`);this._sessionWorkingSets.set(s,l)}try{let s=!1;if(e.providerType==="local"?s=!0:s=await this._openSessionFiles(e),!s)this.logService.trace("[AgentSessionProjection] No files to display, opening chat without projection mode"),!this._isActive&&this._preProjectionWorkingSet&&(await this.editorGroupsService.applyWorkingSet(this._preProjectionWorkingSet),this.editorGroupsService.deleteWorkingSet(this._preProjectionWorkingSet),this._preProjectionWorkingSet=void 0);else{let l=this._isActive;this._isActive=!0,this._activeSession=e,this._inProjectionModeContextKey.set(!0),this.layoutService.mainContainer.classList.add("agent-session-projection-active"),l||(this._wasAuxiliaryBarMaximized=t,this.logService.trace("[AgentSessionProjection] captured auxiliary bar maximized state",{wasAuxiliaryBarMaximized:this._wasAuxiliaryBarMaximized})),this.agentTitleBarStatusService.enterSessionMode(e.resource,e.label),l||this._onDidChangeProjectionMode.fire(!0),this._onDidChangeActiveSession.fire(e)}}finally{this._isSwappingSessions=!1}}await this._openSessionInChatPanel(e),e.providerType==="local"&&o&&await this.commandService.executeCommand("chatEditing.viewChanges"),this._wasAuxiliaryBarMaximized&&(this.logService.trace("[AgentSessionProjection] hiding maximized auxiliary bar during projection"),this.layoutService.setPartHidden(!0,"workbench.parts.auxiliarybar"))}async exitProjection(e){if(!this._isActive||this._isExiting)return;let t=e?.startNewChat??!0;if(this._isExiting=!0,this.logService.trace("[AgentSessionProjection] exitProjection start",{hasPreProjectionWorkingSet:!!this._preProjectionWorkingSet,activeSession:this._activeSession?.label,startNewChat:t,wasAuxiliaryBarMaximized:this._wasAuxiliaryBarMaximized}),this._activeSession){let n=this._activeSession.resource.toString(),r=this.editorGroupsService.saveWorkingSet(`agent-session-projection-${n}`);this._sessionWorkingSets.set(n,r)}for(let n of this.editorGroupsService.groups)await n.closeAllEditors();this.logService.trace("[AgentSessionProjection] exitProjection closed editors",{visible:this.editorService.visibleEditors.length}),this._preProjectionWorkingSet?(await this.editorGroupsService.applyWorkingSet(this._preProjectionWorkingSet),this.logService.trace("[AgentSessionProjection] exitProjection applied pre-projection working set",{visible:this.editorService.visibleEditors.length,id:this._preProjectionWorkingSet.id}),this.editorGroupsService.deleteWorkingSet(this._preProjectionWorkingSet),this._preProjectionWorkingSet=void 0):(await this.editorGroupsService.applyWorkingSet("empty",{preserveFocus:!0}),this.logService.trace("[AgentSessionProjection] exitProjection no pre-working set, applied empty")),this._isActive=!1,this._activeSession=void 0,this._inProjectionModeContextKey.set(!1);let o=this._wasAuxiliaryBarMaximized;this._wasAuxiliaryBarMaximized=!1,this.layoutService.mainContainer.classList.remove("agent-session-projection-active"),this.agentTitleBarStatusService.exitSessionMode(),this._onDidChangeProjectionMode.fire(!1),this._onDidChangeActiveSession.fire(void 0),t&&await this.commandService.executeCommand(Zm),o&&(this.logService.trace("[AgentSessionProjection] restoring auxiliary bar maximized state"),this.layoutService.setPartHidden(!1,"workbench.parts.auxiliarybar"),await this.commandService.executeCommand("workbench.action.maximizeAuxiliaryBar")),this.logService.trace("[AgentSessionProjection] exitProjection complete"),this._isExiting=!1}};_We=I([m(0,X),m(1,B),m(2,wt),m(3,ee),m(4,se),m(5,Pt),m(6,Us),m(7,yi),m(8,ge),m(9,ud),m(10,vfe),m(11,md)],_We);var MW=class extends K{constructor(e,t,o,n,r){super({id:`toggle.${e}`,title:t,metadata:o?{description:o}:void 0,toggled:C.equals(`config.${e}`,!0),menu:[{id:D.TitleBarContext,when:r,order:n,group:"2_config"},{id:D.TitleBarTitleContext,when:r,order:n,group:"2_config"}]});this.section=e}run(e,...t){let o=e.get(B),n=o.getValue(this.section);o.updateValue(this.section,!n)}};W(class extends MW{constructor(){super("window.commandCenter",d(4512,null),d(4513,null),1,PF.toNegated())}});W(class extends MW{constructor(){super("workbench.navigationControl.enabled",d(4520,null),d(4521,null),2,C.and(PF.toNegated(),C.has("config.window.commandCenter")))}});W(class extends MW{constructor(){super("workbench.layoutControl.enabled",d(4518,null),d(4519,null),4)}});W(class extends MW{constructor(){super("workbench.notifications.showInTitleBar",d(4522,null),d(4523,null),5,C.equals("config.workbench.notifications.position","top-right"))}});W(class extends K{constructor(){super({id:"toggle.window.customTitleBarVisibility",title:d(4516,null),menu:[{id:D.TitleBarContext,order:0,when:C.equals(GX.key,"native"),group:"3_toggle"},{id:D.TitleBarTitleContext,order:0,when:C.equals(GX.key,"native"),group:"3_toggle"}]})}run(i,...e){i.get(B).updateValue("window.customTitleBarVisibility","never")}});W(class extends K{constructor(){super({id:"toggle.window.customTitleBarVisibility.windowed",title:d(4517,null),menu:[{id:D.TitleBarContext,order:1,when:eA,group:"3_toggle"},{id:D.TitleBarTitleContext,order:1,when:eA,group:"3_toggle"}]})}run(i,...e){i.get(B).updateValue("window.customTitleBarVisibility","windowed")}});var iAi=class extends K{constructor(){super({id:"toggle.toggleCustomTitleBar",title:d(4514,null),toggled:r4,menu:[{id:D.MenubarAppearanceMenu,order:6,when:C.or(C.and(C.equals(GX.key,"native"),C.and(C.equals("config.workbench.layoutControl.enabled",!1),C.equals("config.window.commandCenter",!1),C.notEquals("config.workbench.editor.editorActionsLocation","titleBar"),C.notEquals("config.workbench.activityBar.location","top"),C.notEquals("config.workbench.activityBar.location","bottom"))?.negate()),eA),group:"2_workbench_layout"}]})}run(i,...e){let t=i.get(B),o=i.get(X);switch(t.getValue("window.customTitleBarVisibility")){case"never":t.updateValue("window.customTitleBarVisibility","auto");break;case"windowed":{eA.evaluate(o.getContext(null))?t.updateValue("window.customTitleBarVisibility","auto"):t.updateValue("window.customTitleBarVisibility","never");break}case"auto":default:t.updateValue("window.customTitleBarVisibility","never");break}}};W(iAi);W(class extends K{constructor(){super({id:"showCustomTitleBar",title:L(4511,"Show Custom Title Bar"),precondition:r4.negate(),f1:!0})}run(i,...e){i.get(B).updateValue("window.customTitleBarVisibility","auto")}});W(class extends K{constructor(){super({id:"hideCustomTitleBar",title:L(4508,"Hide Custom Title Bar"),precondition:r4,f1:!0})}run(i,...e){i.get(B).updateValue("window.customTitleBarVisibility","never")}});W(class extends K{constructor(){super({id:"hideCustomTitleBarInFullScreen",title:L(4509,"Hide Custom Title Bar In Full Screen"),precondition:C.and(r4,eA),f1:!0})}run(i,...e){i.get(B).updateValue("window.customTitleBarVisibility","windowed")}});W(class pU extends K{static{this.settingsID="workbench.editor.editorActionsLocation"}constructor(){let i=C.and(C.equals("config.workbench.editor.showTabs","none").negate(),C.equals(`config.${pU.settingsID}`,"default"))?.negate();super({id:`toggle.${pU.settingsID}`,title:d(4515,null),toggled:C.equals(`config.${pU.settingsID}`,"hidden").negate(),menu:[{id:D.TitleBarContext,order:3,when:i,group:"2_config"},{id:D.TitleBarTitleContext,order:3,when:i,group:"2_config"}]})}run(i,...e){let t=i.get(B),o=i.get(ce),n=t.getValue(pU.settingsID);if(n==="hidden"){if(t.getValue("workbench.editor.showTabs")!=="none")t.updateValue(pU.settingsID,"titleBar");else{let s=o.get(pU.settingsID,0);t.updateValue(pU.settingsID,s??"default")}o.remove(pU.settingsID,0)}else t.updateValue(pU.settingsID,"hidden"),o.store(pU.settingsID,n,0,0)}});var nCo={id:SH,label:d(4507,null),tooltip:d(4507,null),class:void 0,enabled:!0,run:function(){}},rCo={id:bH,label:d(4510,null),tooltip:d(4510,null),class:void 0,enabled:!0,run:function(){}};var koe=class a extends K{static{this.ID="agentSession.enterAgentSessionProjection"}constructor(){super({id:a.ID,title:L(6147,"Enter Agent Session Projection"),category:Si,f1:!1,precondition:C.and(ie.enabled,C.has("config.chat.agentSessionProjection.enabled"),TWe.negate())})}async run(i,e){let t=i.get(DWe),o=i.get(md),n;e&&(VNt(e)?n=o.getSession(e.session.resource):n=e),n&&await t.enterProjection(n)}},NQ=class a extends K{static{this.ID="agentSession.exitAgentSessionProjection"}constructor(){super({id:a.ID,title:L(6148,"Exit Agent Session Projection"),category:Si,f1:!0,precondition:C.and(ie.enabled,TWe),keybinding:{weight:200,primary:9,when:TWe}})}async run(i){await i.get(DWe).exitProjection()}},Lqt=class extends MW{constructor(){super("chat.unifiedAgentsBar.enabled",d(6149,null),d(6150,null),7,C.and(ie.enabled,PF.negate(),ie.supported,C.has("config.window.commandCenter")))}};var bfe=class extends ja{constructor(e){super();this._onDidSelect=this._register(new E);this.onDidSelect=this._onDidSelect.event;this.items=[];this.buttons=this._register(new Vt);this.hoverDelegate=e.hoverDelegate??this._register(Qh()),this.domNode=_(".monaco-custom-radio"),this.domNode.setAttribute("role","radio"),this.setItems(e.items)}setItems(e){this.buttons.clearAndDisposeAll(),this.items=e,this.activeItem=this.items.find(t=>t.isActive)??this.items[0];for(let t=0;t<this.items.length;t++){let o=this.items[t],n=new N,r=n.add(new Wi(this.domNode,{hoverDelegate:this.hoverDelegate,title:o.tooltip,supportIcons:!0}));r.enabled=!o.disabled,n.add(r.onDidClick(()=>{this.activeItem!==o&&(this.activeItem=o,this.updateButtons(),this._onDidSelect.fire(t))})),this.buttons.set(r,{item:o,dispose:()=>n.dispose()})}this.updateButtons()}setActiveItem(e){if(e<0||e>=this.items.length)throw new Error("Invalid Index");this.activeItem=this.items[e],this.updateButtons()}setEnabled(e){for(let[t]of this.buttons)t.enabled=e}updateButtons(){let e=!1;for(let[t,{item:o}]of this.buttons){let n=e;e=o===this.activeItem,t.element.classList.toggle("active",e),t.element.classList.toggle("previous-active",n),t.label=o.text}}};var Yrt="unified-quick-access-send-to-agent",oAi=[{id:"agentSessions",label:d(6189,null),prefix:"agent ",placeholder:d(6188,null),tooltip:d(6190,null)},{id:"commands",label:d(6192,null),prefix:">",placeholder:d(6191,null),tooltip:d(6193,null)},{id:"files",label:d(6195,null),prefix:"",placeholder:d(6194,null),tooltip:d(6196,null)}],LWe=class extends x{constructor(e,t,o,n,r,s,l,c){super();this.quickInputService=t;this.instantiationService=o;this.contextKeyService=n;this.layoutService=r;this.commandService=s;this.keybindingService=l;this.hoverService=c;this.registry=ne.as(Ku.Quickaccess);this.mapProviderToDescriptor=new Map;this._currentDisposables=this._register(new N);this._providerDisposables=this._register(new N);this._isInternalValueChange=!1;this._isUpdatingSendToAgent=!1;this._tabs=e??oAi}show(e,t){if(this._currentPicker)return;this._currentDisposables.clear();let o=this._currentDisposables.add(this.quickInputService.createQuickPick({useSeparators:!0}));this._currentPicker=o,o.ignoreFocusOut=!1,o.matchOnDescription=!0,o.matchOnDetail=!0,o.sortByLabel=!1;let n=e?this._tabs.find(r=>r.id===e)??this._tabs[0]:this._tabs[0];this._currentTab=n,this._injectTabBar(o),this._isInternalValueChange=!0,o.value=t??"",o.placeholder=n.placeholder,this._isInternalValueChange=!1,this._activateProvider(n,o),this._currentDisposables.add(o.onDidChangeValue(r=>{if(this._isInternalValueChange)return;if(this._arrivedViaShortcut){let l=this._arrivedViaShortcut;if(!r.startsWith(l)){let c=this._tabs.find(u=>u.id==="files");if(c&&c!==this._currentTab){this._arrivedViaShortcut=void 0,this._switchTab(c,o,!1);return}}}let s=this._detectTabFromValue(r);s&&s!==this._currentTab&&this._switchTab(s,o,!0),this._updateSendButtonState(r),this._sendToAgentTimeout&&clearTimeout(this._sendToAgentTimeout),this._sendToAgentTimeout=setTimeout(()=>this._maybeShowSendToAgent(o),150)})),this._currentDisposables.add(o.onDidAccept(()=>{let r=o.selectedItems,s=o.activeItems,l=r.length>0&&r[0].id===Yrt,c=s.some(p=>p.id!==Yrt),u;this._arrivedViaShortcut&&o.value.startsWith(this._arrivedViaShortcut)?u=o.value.substring(1).trim():this._currentTab?u=o.value.substring(this._currentTab.prefix.length).trim():u=o.value.trim(),(l||!c&&u)&&this._sendMessage(o.value)})),this._currentDisposables.add(o.onDidHide(()=>{this._providerDisposables.clear(),this._providerCts?.cancel(),this._providerCts=void 0,this._currentPicker=void 0,this._currentTab=void 0,this._arrivedViaShortcut=void 0,this._sendToAgentTimeout&&(clearTimeout(this._sendToAgentTimeout),this._sendToAgentTimeout=void 0),this._tabBarContainer?.remove(),this._tabBarContainer=void 0,this._sendButton=void 0,this._sendButtonLabel=void 0,this._sendButtonIcon=void 0,this._sendButtonHover=void 0,this._currentDisposables.clear()})),o.show()}hide(){this._currentPicker?.hide()}get isVisible(){return!!this._currentPicker}_injectTabBar(e){let t=this._currentDisposables.add(U.once(this.quickInputService.onShow)(()=>{this._currentDisposables.delete(t);let o=this.layoutService.activeContainer.querySelector(".quick-input-widget");if(!o)return;let n=o.querySelector(".quick-input-header"),r=o.querySelector(".quick-input-list");if(!n||!r)return;let s=_("div.unified-quick-access-tabs");this._tabBarContainer=s;let l=this._currentDisposables.add(Qh()),c=this._tabs.map(h=>({text:h.label,tooltip:h.tooltip,isActive:h===this._currentTab})),u=this._currentDisposables.add(new bfe({items:c,hoverDelegate:l}));s.appendChild(u.domNode),this._currentDisposables.add(u.onDidSelect(h=>{let g=this._tabs[h];g&&g!==this._currentTab&&this._switchTab(g,e,!1)}));let p=this._createSendButton(e);s.appendChild(p),r.parentElement?.insertBefore(s,r),e._unifiedRadio=u}))}_createSendButton(e){let t=_("div.unified-quick-access-send-container"),o=_("button.unified-send-button");o.setAttribute("type","button"),this._sendButton=o;let n=Sn(R.send);n.classList.add("unified-send-icon"),this._sendButtonIcon=n,o.appendChild(n);let r=_("span.unified-send-label");return this._sendButtonLabel=r,o.appendChild(r),t.appendChild(o),this._sendButtonHover=this._currentDisposables.add(this.hoverService.setupManagedHover(Ri("mouse"),o,"")),this._updateSendButtonState(e.value),this._currentDisposables.add(j(o,re.CLICK,s=>{s.preventDefault(),s.stopPropagation(),e.value.trim().length>0?this._sendMessageRaw(e.value):this._openChat()})),t}_updateSendButtonState(e){if(!this._sendButton||!this._sendButtonLabel||!this._sendButtonIcon)return;if(e.trim().length>0)this._sendButtonLabel.textContent=d(6202,null),this._sendButtonHover?.update(d(6205,null)),this._sendButtonIcon.style.display="";else{let n=this.keybindingService.lookupKeybinding(lx)?.getLabel()??"";this._sendButtonLabel.textContent=d(6198,null);let r=n?d(6200,null,n):d(6199,null);this._sendButtonHover?.update(r),this._sendButtonIcon.style.display="none"}}_openChat(){this.hide(),this.commandService.executeCommand(lx)}async _sendMessageRaw(e){let t=e.trim();if(!t)return;this.hide(),await this.commandService.executeCommand(Zm);let o={query:t,isPartialQuery:!1};this.commandService.executeCommand(lx,o)}async _sendMessage(e){let t=e;if(this._arrivedViaShortcut&&t.startsWith(this._arrivedViaShortcut)?t=t.substring(1).trim():this._currentTab&&e.startsWith(this._currentTab.prefix)&&(t=e.substring(this._currentTab.prefix.length).trim()),!t)return;this.hide(),await this.commandService.executeCommand(Zm);let o={query:t,isPartialQuery:!1};this.commandService.executeCommand(lx,o)}_maybeShowSendToAgent(e){if(this._isUpdatingSendToAgent)return;let t;this._arrivedViaShortcut&&e.value.startsWith(this._arrivedViaShortcut)?t=e.value.substring(1).trim():this._currentTab?t=e.value.substring(this._currentTab.prefix.length).trim():t=e.value.trim();let o=e.value.trim();if(!(t||o)||e.busy)return;let r=e.items[0];if(r?.id===Yrt&&r.description===o)return;let s={id:Yrt,label:`$(send) ${d(6204,null)}`,description:o,alwaysShow:!0,ariaLabel:d(6203,null,o)},l=e.items.filter(h=>h.id!==Yrt),c=this._currentTab?.id==="agentSessions",u=l.length>0,p=c||!u;this._isUpdatingSendToAgent=!0;try{p?e.items=[s,...l]:e.items=l}finally{this._isUpdatingSendToAgent=!1}}_switchTab(e,t,o){if(e===this._currentTab)return;let n=this._currentTab;this._currentTab=e;let r=t._unifiedRadio;if(r){let s=this._tabs.indexOf(e);s>=0&&r.setActiveItem(s)}if(this._isInternalValueChange=!0,o&&n){let s=t.value,l=s;s.startsWith(n.prefix)&&(l=s.substring(n.prefix.length)),this._arrivedViaShortcut==="<"&&e.id==="agentSessions"?(l=l.replace(/^<+/,""),t.value="<"+l):this._arrivedViaShortcut===">"&&e.id==="commands"?(l=l.replace(/^>+/,""),t.value=">"+l):t.value=e.prefix+l}else if(n){let s=t.value;s.startsWith(n.prefix)&&(t.value=s.substring(n.prefix.length)),(t.value.startsWith("<")||t.value.startsWith(">"))&&(t.value=t.value.substring(1)),this._arrivedViaShortcut=void 0}this._isInternalValueChange=!1,t.placeholder=e.placeholder,this._activateProvider(e,t)}_detectTabFromValue(e){if(e==="<"||e.startsWith("<")){let o=this._tabs.find(n=>n.id==="agentSessions");if(o&&this._currentTab?.id!=="agentSessions")return this._arrivedViaShortcut="<",o}if(e===">"||e.startsWith(">")){let o=this._tabs.find(n=>n.id==="commands");if(o&&this._currentTab?.id!=="commands")return this._arrivedViaShortcut=">",o}return this._currentTab&&e.startsWith(this._currentTab.prefix)?this._currentTab:[...this._tabs].filter(o=>o.prefix.length>0).sort((o,n)=>n.prefix.length-o.prefix.length).find(o=>e.startsWith(o.prefix))}_activateProvider(e,t){if(this._providerDisposables.clear(),this._providerCts?.cancel(),this._providerCts=new Ye,this._providerDisposables.add(this._providerCts),e.isSendTab){t.busy=!1,t.items=[{label:d(6201,null),alwaysShow:!0}];return}t.items=[],t.busy=!0;let[o]=this._getOrInstantiateProvider(e.prefix);if(o){let n=e.prefix,r=this._arrivedViaShortcut;t.filterValue=l=>r&&l.startsWith(r)?l.substring(1):l.startsWith(n)?l.substring(n.length):l;let s=o.provide(t,this._providerCts.token);this._providerDisposables.add(s)}else t.busy=!1,t.items=[{label:d(6197,null),alwaysShow:!0}]}_getOrInstantiateProvider(e){let t=this.registry.getQuickAccessProvider(e,this.contextKeyService);if(!t)return[void 0,void 0];let o=this.mapProviderToDescriptor.get(t);return o||(o=this.instantiationService.createInstance(t.ctor),this.mapProviderToDescriptor.set(t,o)),[o,t]}dispose(){this._providerCts?.cancel();for(let e of this.mapProviderToDescriptor.values())jc(e)&&e.dispose();super.dispose()}};LWe=I([m(1,Ue),m(2,F),m(3,X),m(4,Kl),m(5,ge),m(6,_e),m(7,nt)],LWe);var nAi;function Rqt(a){return nAi||(nAi=a.createInstance(LWe,oAi)),nAi}var Xrt="workbench.action.unifiedQuickAccess",rAi=class a extends K{static{this.ID=Xrt}constructor(){super({id:a.ID,title:L(6206,"Show Agent Quick Access"),f1:!0,precondition:C.and(ie.enabled,C.has("config.chat.unifiedAgentsBar.enabled"))})}run(i,e){let t=i.get(F);Rqt(t).show(e)}},sAi=class a extends K{static{this.ID="workbench.action.showAgentSessionsQuickAccess"}constructor(){super({id:a.ID,title:L(6207,"Show Agent Sessions"),f1:!0,precondition:C.and(ie.enabled,C.has("config.chat.unifiedAgentsBar.enabled"))})}run(i){let e=i.get(F);Rqt(e).show("agentSessions")}},aAi=class a extends K{static{this.ID="workbench.action.showCommandsQuickAccess"}constructor(){super({id:a.ID,title:L(6208,"Show Commands (Unified)"),f1:!0,precondition:C.and(ie.enabled,C.has("config.chat.unifiedAgentsBar.enabled"))})}run(i){let e=i.get(F);Rqt(e).show("commands")}},lAi=class a extends K{static{this.ID="workbench.action.showFilesQuickAccess"}constructor(){super({id:a.ID,title:L(6209,"Show Files (Unified)"),f1:!0,precondition:C.and(ie.enabled,C.has("config.chat.unifiedAgentsBar.enabled"))})}run(i){let e=i.get(F);Rqt(e).show("files")}};W(rAi);W(sAi);W(aAi);W(lAi);var Rln="workbench.action.chat.toggle",Mln="workbench.action.chat.triggerSetup",Pln="workbench.action.chat.openQuotaExceededDialog",RWe="workbench.action.quickOpenWithModes",sCo="agentSessions.filterExcludes.agentsessionsviewerfiltersubmenu",cAi="agentSessions.filterExcludes.previousUserFilter";function Aln(a){let i=a.getValue("chat.disableAIFeatures")===!0,e=a.getValue("disableAICustomizations")===!0||a.getValue("workbench.disableAICustomizations")===!0||a.getValue("chat.customizationsMenu.enabled")===!1;return i&&e}function aCo(a){if(Aln(a))return"hidden";let i=a.getValue("chat.agentsControl.enabled");return i===!1||i==="hidden"?"hidden":i==="badge"?"badge":"compact"}var Jrt=class extends wl{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w){super(void 0,e,t);this.instantiationService=o;this.agentTitleBarStatusService=n;this.hoverService=r;this.commandService=s;this.keybindingService=l;this.agentSessionsService=c;this.workspaceContextService=u;this.editorGroupsService=p;this.editorService=h;this.menuService=g;this.contextKeyService=f;this.storageService=v;this.configurationService=b;this.chatEntitlementService=S;this.chatWidgetService=y;this.telemetryService=w;this._dynamicDisposables=this._register(new N);this._isRendering=!1;this._rovingElements=[];this._rovingIndex=0;this._badgeFilterAppliedByThisWindow=null;this._commandCenterMenu=this._register(this.menuService.createMenu(D.CommandCenterCenter,this.contextKeyService)),this._chatTitleBarMenu=this._register(this.menuService.createMenu(D.ChatTitleBarMenu,this.contextKeyService)),this._windowTitle=this._register(this.instantiationService.createInstance(Mk,ut)),this._register(this.agentTitleBarStatusService.onDidChangeMode(()=>{this._render()})),this._register(this.agentTitleBarStatusService.onDidChangeSessionInfo(()=>{this._render()})),this._register(this.agentSessionsService.model.onDidChangeSessions(()=>{this._render()})),this._register(this._windowTitle.onDidChange(()=>{this._render()})),this._register(this.editorService.onDidActiveEditorChange(()=>{this._render()})),this._register(this.editorGroupsService.onDidChangeEditorPartOptions(({newPartOptions:k,oldPartOptions:T})=>{k.showTabs!==T.showTabs&&this._render()})),this._register(this._commandCenterMenu.onDidChange(()=>{this._lastRenderState=void 0,this._render()})),this._register(this.storageService.onDidChangeValue(0,"agentSessions.filterExcludes.agentsessionsviewerfiltersubmenu",this._store)(()=>{this._render()})),this._register(this.configurationService.onDidChangeConfiguration(k=>{(k.affectsConfiguration("chat.agentsControl.enabled")||k.affectsConfiguration("chat.unifiedAgentsBar.enabled")||k.affectsConfiguration("chat.viewSessions.enabled")||k.affectsConfiguration("chat.disableAIFeatures")||k.affectsConfiguration("chat.customizationsMenu.enabled")||k.affectsConfiguration("chat.signInTitleBar.enabled")||k.affectsConfiguration("disableAICustomizations")||k.affectsConfiguration("workbench.disableAICustomizations"))&&(this._lastRenderState=void 0,this._render())})),this._register(U.any(this.chatEntitlementService.onDidChangeSentiment,this.chatEntitlementService.onDidChangeQuotaExceeded,this.chatEntitlementService.onDidChangeEntitlement,this.chatEntitlementService.onDidChangeAnonymous)(()=>{this._lastRenderState=void 0,this._render()})),this._register(this.chatWidgetService.onDidAddWidget(()=>{this._render()})),this._register(this.chatWidgetService.onDidBackgroundSession(()=>{this._render()}))}render(e){super.render(e),this._container=e,e.classList.add("agent-status-container"),e.setAttribute("role","toolbar"),e.setAttribute("aria-label",d(6164,null)),e.tabIndex=-1,this._render()}setFocusable(e){}focus(){this._rovingElements[this._rovingIndex]?.focus()}blur(){if(!this._container)return;let e=Re(this._container).document.activeElement;Do(e)&&this._container.contains(e)&&e.blur()}_render(){if(this._container&&!this._isRendering){this._isRendering=!0;try{let e=this.agentTitleBarStatusService.mode,t=this.agentTitleBarStatusService.sessionInfo,{activeSessions:o,unreadSessions:n,attentionNeededSessions:r}=this._getSessionStats(),s=r.length>0?[...r].sort((S,y)=>{let w=S.timing.lastRequestStarted??S.timing.created;return(y.timing.lastRequestStarted??y.timing.created)-w})[0]:void 0,l=s?.description?typeof s.description=="string"?s.description:Da(s.description):s?.label,c=this._getLabel(),{isFilteredToUnread:u,isFilteredToInProgress:p,isFilteredToNeedsInput:h}=this._getCurrentFilterState(),g=aCo(this.configurationService),f=this.configurationService.getValue("chat.unifiedAgentsBar.enabled")===!0,v=this.configurationService.getValue("chat.viewSessions.enabled")!==!1,b=JSON.stringify({mode:e,sessionTitle:t?.title,activeCount:o.length,unreadCount:n.length,attentionCount:r.length,attentionText:l,label:c,isFilteredToUnread:u,isFilteredToInProgress:p,isFilteredToNeedsInput:h,statusMode:g,unifiedAgentsBarEnabled:f,viewSessionsEnabled:v});if(this._lastRenderState===b)return;this._lastRenderState=b,vi(this._container),this._dynamicDisposables.clear(),this._rovingElements=[],this.agentTitleBarStatusService.mode==="session"?this._renderSessionMode(this._dynamicDisposables):this.agentTitleBarStatusService.mode==="sessionReady"?this._renderSessionReadyMode(this._dynamicDisposables):g==="compact"?this._renderChatInputMode(this._dynamicDisposables):g==="badge"&&this._renderStatusBadge(this._dynamicDisposables,o,n,r),this._setupRovingTabIndex(this._dynamicDisposables)}finally{this._isRendering=!1}}}_setupRovingTabIndex(e){if(!(!this._container||this._rovingElements.length===0)){this._rovingIndex>=this._rovingElements.length&&(this._rovingIndex=0);for(let t=0;t<this._rovingElements.length;t++)this._rovingElements[t].tabIndex=t===this._rovingIndex?0:-1;e.add(j(this._container,re.KEY_DOWN,t=>{let o=this._rovingElements.findIndex(r=>r===t.target||r.contains(t.target));if(o===-1)return;let n=this._getNextRovingIndex(o,t.key);n!==void 0&&n!==o&&(t.preventDefault(),t.stopPropagation(),this._moveRovingFocus(o,n))}))}}_moveRovingFocus(e,t){this._rovingElements[e].tabIndex=-1,this._rovingElements[t].tabIndex=0,this._rovingElements[t].focus(),this._rovingIndex=t}_getNextRovingIndex(e,t){let o=this._rovingElements.length;switch(t){case"ArrowRight":return(e+1)%o;case"ArrowLeft":return(e-1+o)%o;case"Home":return 0;case"End":return o-1;default:return}}_getSessionStats(){let e=this.agentSessionsService.model.sessions,o=this._getStoredFilter()?.providers??[],n=o.length>0?e.filter(c=>!o.includes(c.providerType)):e,r=n.filter(c=>HC(c.status)&&!c.isArchived()),s=n.filter(c=>!c.isRead()),l=n.filter(c=>c.status===3&&!this.chatWidgetService.getWidgetBySessionResource(c.resource));return{activeSessions:r,unreadSessions:s,attentionNeededSessions:l,hasActiveSessions:r.length>0,hasUnreadSessions:s.length>0,hasAttentionNeeded:l.length>0}}_renderChatInputMode(e){if(!this._container)return;let{activeSessions:t,unreadSessions:o,attentionNeededSessions:n,hasAttentionNeeded:r}=this._getSessionStats(),s=_("div.agent-status-pill.chat-input-mode");r&&s.classList.add("needs-attention"),this._container.appendChild(s),this._renderCommandCenterToolbar(e,s);let l=!0;s.classList.toggle("compact-mode",l);let c=_("span.agent-status-left-icon");if(r){let b=Sn(R.report),S=_("span.agent-status-attention-count");S.textContent=String(n.length),vi(c,b,S),c.classList.add("has-attention")}else vi(c,Sn(R.searchSparkle));l||s.appendChild(c);let u=_("div.agent-status-input-area");u.setAttribute("role","button"),u.setAttribute("aria-label",d(6179,null)),u.tabIndex=0,this._rovingElements.push(u),s.appendChild(u);let p=_("span.agent-status-label"),{progress:h}=this._getSessionNeedingAttention(n),g=l?this._getLabel():h??this._getLabel();!l&&h&&p.classList.add("has-progress");let f=d(6166,null);if(p.textContent=g,u.appendChild(p),l)e.add(j(u,re.MOUSE_ENTER,()=>{vi(c,Sn(R.searchSparkle)),c.classList.remove("has-attention"),p.classList.remove("has-progress")})),e.add(j(u,re.MOUSE_LEAVE,()=>{vi(c,Sn(R.searchSparkle))}));else{let b=_("span.agent-status-send");vi(b,Sn(R.send)),b.classList.add("hidden"),u.appendChild(b),h||(e.add(j(u,re.MOUSE_ENTER,()=>{vi(c,Sn(R.searchSparkle)),c.classList.remove("has-attention"),p.textContent=f,p.classList.remove("has-progress"),b.classList.remove("hidden")})),e.add(j(u,re.MOUSE_LEAVE,()=>{vi(c,Sn(R.searchSparkle)),p.textContent=g,b.classList.add("hidden")})))}let v=Ri("mouse");e.add(this.hoverService.setupManagedHover(v,u,()=>{let b=this.keybindingService.lookupKeybinding(Xrt)?.getLabel();return b?d(6167,null,b):d(6168,null)})),e.add(j(u,re.CLICK,b=>{b.preventDefault(),b.stopPropagation(),this.telemetryService.publicLog2("agentStatusWidget.click",{source:"pill",action:"quickAccess"});let S=this.configurationService.getValue("chat.unifiedAgentsBar.enabled")===!0;this.commandService.executeCommand(S?Xrt:RWe)})),e.add(j(u,re.KEY_DOWN,b=>{if(b.key==="Enter"||b.key===" "){b.preventDefault(),b.stopPropagation(),this.telemetryService.publicLog2("agentStatusWidget.click",{source:"pill",action:"quickAccess"});let S=this.configurationService.getValue("chat.unifiedAgentsBar.enabled")===!0;this.commandService.executeCommand(S?Xrt:RWe)}})),this._renderStatusBadge(e,t,o,n,s)}_renderSessionMode(e){if(!this._container)return;let{activeSessions:t,unreadSessions:o,attentionNeededSessions:n}=this._getSessionStats();this._renderCommandCenterToolbar(e);let r=_("div.agent-status-pill.session-mode");this._container.appendChild(r),this._renderSearchButton(e,r);let s=_("span.agent-status-title"),l=this.agentTitleBarStatusService.sessionInfo;s.textContent=l?.title??d(6158,null),r.appendChild(s),this._renderEscapeButton(e,r);let c=Ri("mouse");e.add(this.hoverService.setupManagedHover(c,r,()=>{let p=this.agentTitleBarStatusService.sessionInfo;return p?d(6159,null,p.title):d(6158,null)}));let u=p=>{p.preventDefault(),p.stopPropagation(),this.commandService.executeCommand(NQ.ID)};e.add(j(r,re.CLICK,u)),e.add(j(r,re.MOUSE_DOWN,u)),this._renderStatusBadge(e,t,o,n)}_renderSessionReadyMode(e){if(!this._container)return;let{activeSessions:t,unreadSessions:o,attentionNeededSessions:n}=this._getSessionStats(),r=_("div.agent-status-pill.session-ready-mode");this._container.appendChild(r);let s=_("span.agent-status-title"),l=this.agentTitleBarStatusService.sessionInfo;s.textContent=l?.title??d(6160,null),r.appendChild(s),this._renderEnterButton(e,r);let c=Ri("mouse");e.add(this.hoverService.setupManagedHover(c,r,()=>{let p=this.agentTitleBarStatusService.sessionInfo;return p?d(6162,null,p.title):d(6161,null)}));let u=p=>{p.preventDefault(),p.stopPropagation();let h=this.agentTitleBarStatusService.sessionInfo;if(h){let g=this.agentSessionsService.getSession(h.sessionResource);g&&this.commandService.executeCommand(koe.ID,g)}};e.add(j(r,re.CLICK,u)),e.add(j(r,re.MOUSE_DOWN,u)),this._renderStatusBadge(e,t,o,n)}_renderCommandCenterToolbar(e,t){let o=t??this._container;if(!o)return;let n=[];for(let[,c]of this._commandCenterMenu.getActions({shouldForwardArgs:!0}))for(let u of c)u.id!==RWe&&(u instanceof Fs?n.push(...u.actions):n.push(u));if(n.length===0)return;let r=Ri("mouse"),s=_("div.agent-status-command-center-toolbar");o.appendChild(s);let l=this.instantiationService.createInstance(ol,s,{hiddenItemStrategy:-1,telemetrySource:"agentStatusCommandCenter",actionViewItemProvider:(c,u)=>Bs(this.instantiationService,c,{...u,hoverDelegate:r})});if(e.add(l),l.setActions(n),t){let c=_("span.agent-status-line-separator");o.appendChild(c)}else{let c=Sn(R.circleSmallFilled);c.classList.add("agent-status-separator"),o.appendChild(c)}}_renderSearchButton(e,t){let o=t??this._container;if(!o)return;let n=_("span.agent-status-search");vi(n,Sn(R.searchSparkle)),n.setAttribute("role","button"),n.setAttribute("aria-label",d(6180,null)),n.tabIndex=0,this._rovingElements.push(n),o.appendChild(n);let r=Ri("mouse"),s=this.keybindingService.lookupKeybinding(RWe)?.getLabel(),l=s?d(6181,null,s):d(6182,null);e.add(this.hoverService.setupManagedHover(r,n,l)),e.add(j(n,re.CLICK,c=>{c.preventDefault(),c.stopPropagation(),this.commandService.executeCommand(RWe)})),e.add(j(n,re.KEY_DOWN,c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),c.stopPropagation(),this.commandService.executeCommand(RWe))}))}_renderStatusBadge(e,t,o,n,r){if(!this._container)return;let s=t.length>0,l=o.length>0,c=n.length>0;this._clearFilterIfCategoryEmpty(l,s,c);let u;r?u=r:(u=_("div.agent-status-badge"),this._container.appendChild(u));let p=_("span.agent-status-badge-section.sparkle");p.tabIndex=0;let h=ri.join(...this._chatTitleBarMenu.getActions({shouldForwardArgs:!0}).map(([,de])=>de)),g=this.chatEntitlementService.sentiment,f=this.chatEntitlementService.quotas.chat?.percentRemaining===0,v=this.chatEntitlementService.entitlement===1,b=this.chatEntitlementService.anonymous,S=this.chatEntitlementService.entitlement===5,y=Rln,w=d(6185,null),k=R.chatSparkle,T=this.configurationService.getValue("chat.signInTitleBar.enabled");g.installed&&!g.disabled&&(v&&!b&&!T?(y=Mln,w=d(6184,null),k=R.chatSparkleError):f&&S&&(y=Pln,w=d(6169,null),k=R.chatSparkleWarning));let P=this.instantiationService.createInstance(Lo,{id:y,title:w,icon:k},void 0,void 0,void 0,void 0),O=ii({id:"agentStatus.sparkle.dropdown",label:d(6163,null),run(){}}),V=this.instantiationService.createInstance(Jw,P,O,h,"agent-status-sparkle-dropdown",{skipTelemetry:!0});V.render(p),e.add(V),e.add(j(p,re.KEY_DOWN,de=>{if(de.key==="ArrowLeft"||de.key==="ArrowRight"||de.key==="Home"||de.key==="End"){let Ce=this._rovingElements.indexOf(p);if(Ce===-1)return;let xe=this._getNextRovingIndex(Ce,de.key);xe!==void 0&&xe!==Ce&&(de.preventDefault(),de.stopImmediatePropagation(),this._moveRovingFocus(Ce,xe))}},!0)),e.add(j(p,re.KEY_DOWN,de=>{de.key==="Enter"||de.key===" "?(de.preventDefault(),de.stopPropagation(),this.commandService.executeCommand(y)):(de.key==="ArrowDown"||de.key==="ArrowUp")&&(de.preventDefault(),de.stopPropagation(),V.showDropdown())}));let H=Ri("mouse"),G=this.configurationService.getValue("chat.viewSessions.enabled")!==!1,$=!!r;$||u.appendChild(p);let J,ae,he;if(G&&l&&this.workspaceContextService.getWorkbenchState()!==1){let{isFilteredToUnread:de}=this._getCurrentFilterState();J=_("span.agent-status-badge-section.unread"),de&&J.classList.add("filtered"),J.setAttribute("role","button"),J.tabIndex=0;let Ce=_("span.agent-status-icon");vi(Ce,Sn(R.circleFilled)),J.appendChild(Ce);let xe=_("span.agent-status-text");xe.textContent=String(o.length),J.appendChild(xe),e.add(j(J,re.CLICK,De=>{De.preventDefault(),De.stopPropagation(),this._openSessionsWithFilter("unread")})),e.add(j(J,re.KEY_DOWN,De=>{(De.key==="Enter"||De.key===" ")&&(De.preventDefault(),De.stopPropagation(),this._openSessionsWithFilter("unread"))}));let ze=o.length===1?d(6187,null,o.length):d(6186,null,o.length);e.add(this.hoverService.setupManagedHover(H,J,ze))}if(G&&c){let{isFilteredToNeedsInput:de}=this._getCurrentFilterState();he=_("span.agent-status-badge-section.active.needs-input"),de&&he.classList.add("filtered"),he.setAttribute("role","button"),he.tabIndex=0;let Ce=_("span.agent-status-icon");vi(Ce,Sn(R.report)),he.appendChild(Ce);let xe=_("span.agent-status-text");xe.textContent=String(n.length),he.appendChild(xe),e.add(j(he,re.CLICK,De=>{De.preventDefault(),De.stopPropagation(),this._openSessionsWithFilter("needsInput")})),e.add(j(he,re.KEY_DOWN,De=>{(De.key==="Enter"||De.key===" ")&&(De.preventDefault(),De.stopPropagation(),this._openSessionsWithFilter("needsInput"))}));let ze=n.length===1?d(6178,null,n.length):d(6177,null,n.length);e.add(this.hoverService.setupManagedHover(H,he,ze))}let oe=t.filter(de=>de.status!==3);if(G&&oe.length>0){let{isFilteredToInProgress:de}=this._getCurrentFilterState();ae=_("span.agent-status-badge-section.active"),de&&ae.classList.add("filtered"),ae.setAttribute("role","button"),ae.tabIndex=0;let Ce=_("span.agent-status-icon");vi(Ce,Sn(R.sessionInProgress)),ae.appendChild(Ce);let xe=_("span.agent-status-text");xe.textContent=String(oe.length),ae.appendChild(xe),e.add(j(ae,re.CLICK,De=>{De.preventDefault(),De.stopPropagation(),this._openSessionsWithFilter("inProgress")})),e.add(j(ae,re.KEY_DOWN,De=>{(De.key==="Enter"||De.key===" ")&&(De.preventDefault(),De.stopPropagation(),this._openSessionsWithFilter("inProgress"))}));let ze=oe.length===1?d(6157,null,oe.length):d(6156,null,oe.length);e.add(this.hoverService.setupManagedHover(H,ae,ze))}$?(he&&(u.appendChild(he),this._rovingElements.push(he)),ae&&(u.appendChild(ae),this._rovingElements.push(ae)),J&&(u.appendChild(J),this._rovingElements.push(J)),u.appendChild(p),this._rovingElements.push(p)):(this._rovingElements.push(p),J&&(u.appendChild(J),this._rovingElements.push(J)),ae&&(u.appendChild(ae),this._rovingElements.push(ae)),he&&(u.appendChild(he),this._rovingElements.push(he)))}_clearFilterIfCategoryEmpty(e,t,o){this._badgeFilterAppliedByThisWindow==="unread"&&!e?this._restoreUserFilter():this._badgeFilterAppliedByThisWindow==="inProgress"&&!t?this._restoreUserFilter():this._badgeFilterAppliedByThisWindow==="needsInput"&&!o&&this._restoreUserFilter()}_getCurrentFilterState(){let e=this._getStoredFilter();if(!e)return{isFilteredToUnread:!1,isFilteredToInProgress:!1,isFilteredToNeedsInput:!1};let t=e.read===!0&&e.states.length===0,o=e.states?.length===3&&e.states.includes(3)&&e.read===!1,n=e.states?.length===3&&e.states.includes(2)&&e.read===!1;return{isFilteredToUnread:t,isFilteredToInProgress:o,isFilteredToNeedsInput:n}}_getStoredFilter(){let e=this.storageService.get(sCo,0);if(e)try{return JSON.parse(e)}catch{return}}_storeFilter(e){this.storageService.store(sCo,JSON.stringify(e),0,0)}_clearFilter(){this._storeFilter({providers:[],states:[],archived:!0,read:!1})}_saveUserFilter(){let{isFilteredToUnread:e,isFilteredToInProgress:t,isFilteredToNeedsInput:o}=this._getCurrentFilterState();if(e||t||o)return;let n=this._getStoredFilter();n&&this.storageService.store(cAi,JSON.stringify(n),0,0)}_restoreUserFilter(){let e=this.storageService.get(cAi,0);if(e)try{let t=JSON.parse(e);this._storeFilter(t)}catch{this._clearFilter()}else this._clearFilter();this.storageService.remove(cAi,0),this._badgeFilterAppliedByThisWindow=null}_openSessionsWithFilter(e){let{isFilteredToUnread:t,isFilteredToInProgress:o,isFilteredToNeedsInput:n}=this._getCurrentFilterState(),s=this._getStoredFilter()?.providers??[],l=e==="unread"&&t||e==="inProgress"&&o||e==="needsInput"&&n;this.telemetryService.publicLog2("agentStatusWidget.click",{source:e,action:l?"clearFilter":"applyFilter"}),l?this._restoreUserFilter():(this._saveUserFilter(),e==="unread"?this._storeFilter({providers:s,states:[],archived:!0,read:!0}):e==="inProgress"?this._storeFilter({providers:s,states:[1,0,3],archived:!0,read:!1}):this._storeFilter({providers:s,states:[1,0,2],archived:!0,read:!1}),this._badgeFilterAppliedByThisWindow=e),this.commandService.executeCommand(doe.id)}_renderEscapeButton(e,t){let o=_("span.agent-status-esc-button");o.textContent="Esc",o.setAttribute("role","button"),o.setAttribute("aria-label",d(6173,null)),o.tabIndex=0,this._rovingElements.push(o),t.appendChild(o);let n=Ri("mouse");e.add(this.hoverService.setupManagedHover(n,o,d(6174,null))),e.add(j(o,re.MOUSE_DOWN,r=>{r.preventDefault(),r.stopPropagation(),this.commandService.executeCommand(NQ.ID)})),e.add(j(o,re.CLICK,r=>{r.preventDefault(),r.stopPropagation(),this.commandService.executeCommand(NQ.ID)})),e.add(j(o,re.KEY_DOWN,r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),r.stopPropagation(),this.commandService.executeCommand(NQ.ID))}))}_renderEnterButton(e,t){let o=_("span.agent-status-enter-button"),n=this.keybindingService.lookupKeybinding(koe.ID);o.textContent=n?.getLabel()??d(6183,null),o.setAttribute("role","button"),o.setAttribute("aria-label",d(6170,null)),o.tabIndex=0,this._rovingElements.push(o),t.appendChild(o);let r=Ri("mouse"),s=n?d(6171,null,n.getLabel()):d(6172,null);e.add(this.hoverService.setupManagedHover(r,o,s));let l=c=>{c.preventDefault(),c.stopPropagation();let u=this.agentTitleBarStatusService.sessionInfo;if(u){let p=this.agentSessionsService.getSession(u.sessionResource);p&&this.commandService.executeCommand(koe.ID,p)}};e.add(j(o,re.MOUSE_DOWN,l)),e.add(j(o,re.CLICK,l)),e.add(j(o,re.KEY_DOWN,c=>{(c.key==="Enter"||c.key===" ")&&l(c)}))}_getSessionNeedingAttention(e){if(e.length===0)return{session:void 0,progress:void 0};let o=[...e].sort((r,s)=>{let l=r.timing.lastRequestStarted??r.timing.created;return(s.timing.lastRequestStarted??s.timing.created)-l})[0];if(!o.description)return{session:o,progress:o.label};let n=typeof o.description=="string"?o.description:Da(o.description);return{session:o,progress:n}}_getLabel(){let{prefix:e,suffix:t}=this._windowTitle.getTitleDecorations(),o=this._windowTitle.workspaceName;return this._windowTitle.isCustomTitleFormat()?o=this._windowTitle.getWindowTitle():!o&&this.editorGroupsService.partOptions.showTabs==="none"&&(o=this._windowTitle.fileName??""),o||(o=d(6165,null)),e&&(o=d(6175,null,e,o)),t&&(o=d(6176,null,o,t)),o.replaceAll(/\r\n|\r|\n/g,"\u23CE")}};Jrt=I([m(2,F),m(3,vfe),m(4,nt),m(5,ge),m(6,_e),m(7,md),m(8,Pe),m(9,wt),m(10,ee),m(11,Kt),m(12,X),m(13,ce),m(14,B),m(15,rr),m(16,Pt),m(17,Te)],Jrt);var Sfe=class extends x{static{this.ID="workbench.contrib.agentStatus.rendering"}constructor(i,e,t,o){super(),this._register(i.register(D.CommandCenter,D.AgentsTitleBarControlMenu,(l,c)=>{if(l instanceof Nc)return e.createInstance(Jrt,l,c)},void 0));let r=!!o.getContextKeyValue("chatIsEnabled"),s=()=>{let l=t.getValue("window.commandCenter")===!0,c=aCo(t),u=l&&r&&c!=="hidden",p=u&&c==="compact";ut.document.body.classList.toggle("agent-status-enabled",u),ut.document.body.classList.toggle("unified-agents-bar",p)};s(),this._register(t.onDidChangeConfiguration(l=>{(l.affectsConfiguration("chat.agentsControl.enabled")||l.affectsConfiguration("window.commandCenter")||l.affectsConfiguration("chat.disableAIFeatures")||l.affectsConfiguration("chat.customizationsMenu.enabled")||l.affectsConfiguration("disableAICustomizations")||l.affectsConfiguration("workbench.disableAICustomizations"))&&s()})),this._register(o.onDidChangeContext(l=>{l.affectsSome(new Set(["chatIsEnabled"]))&&(r=!!o.getContextKeyValue("chatIsEnabled"),s())}))}};Sfe=I([m(0,Zx),m(1,F),m(2,B),m(3,X)],Sfe);var MWe=class extends x{constructor(e,t,o,n,r,s){super();this.chatWidgetService=e;this.configurationService=t;this.agentTitleBarStatusService=o;this.agentSessionsService=n;this.agentSessionProjectionService=r;this.chatEditingService=s;this._widgetDisposables=this._register(new N);this._suppressSessionReady=!1;for(let l of this.chatWidgetService.getAllWidgets())l.location==="panel"&&this._watchWidget(l);this._register(this.chatWidgetService.onDidAddWidget(l=>{l.location==="panel"&&this._watchWidget(l)})),this._register(this.agentSessionProjectionService.onDidChangeProjectionMode(l=>{l||(this._suppressSessionReady=!0,this._clearEntriesWatcher(),this.agentTitleBarStatusService.exitSessionReadyMode())})),this._register(be(l=>{this.chatEditingService.editingSessionsObs.read(l);let c=this.chatWidgetService.getAllWidgets().find(u=>u.location==="panel");c&&this._checkSession(c.viewModel?.sessionResource)})),this._register(this.agentSessionsService.model.onDidChangeSessions(()=>{let l=this.chatWidgetService.getAllWidgets().find(c=>c.location==="panel");l&&this._checkSession(l.viewModel?.sessionResource)}))}static{this.ID="chat.agentSessionReady"}_watchWidget(e){this._widgetDisposables.clear(),this._checkSession(e.viewModel?.sessionResource),this._widgetDisposables.add(e.onDidChangeViewModel(()=>{this._checkSession(e.viewModel?.sessionResource)}))}_checkSession(e){if(e?.toString()!==this._watchedSessionResource?.toString()&&(this._suppressSessionReady=!1),this.agentSessionProjectionService.isActive){let t=this.agentSessionProjectionService.activeSession;if(e&&t&&e.toString()!==t.resource.toString()){let o=this.agentSessionsService.getSession(e);o&&this.agentSessionProjectionService.enterProjection(o)}return}this._updateSessionReadyState(e)}_clearEntriesWatcher(){this._entriesWatcher?.dispose(),this._entriesWatcher=void 0,this._watchedSessionResource=void 0}_updateSessionReadyState(e){if(!this.configurationService.getValue("chat.agentSessionProjection.enabled")){this._clearEntriesWatcher(),this.agentTitleBarStatusService.exitSessionReadyMode();return}if(this.agentSessionProjectionService.isActive){this._clearEntriesWatcher();return}if(!e){this._clearEntriesWatcher(),this.agentTitleBarStatusService.exitSessionReadyMode();return}let o=this.agentSessionsService.getSession(e);if(!o){this._clearEntriesWatcher(),this.agentTitleBarStatusService.exitSessionReadyMode();return}if(!tAi.has(o.providerType)){this._clearEntriesWatcher(),this.agentTitleBarStatusService.exitSessionReadyMode();return}if(HC(o.status)){this._clearEntriesWatcher(),this.agentTitleBarStatusService.exitSessionReadyMode();return}let n=!1;if(o.providerType==="local"){let r=this.chatEditingService.getEditingSession(e);if(!r){this._clearEntriesWatcher(),this.agentTitleBarStatusService.exitSessionReadyMode();return}n=r.entries.get().some(l=>l.state.get()===0),n&&!this._suppressSessionReady?(this.agentTitleBarStatusService.enterSessionReadyMode(o.resource,o.label),(!this._watchedSessionResource||this._watchedSessionResource.toString()!==e.toString())&&(this._clearEntriesWatcher(),this._watchedSessionResource=e,this._entriesWatcher=be(l=>{r.entries.read(l).some(p=>p.state.read(l)===0)||this.agentTitleBarStatusService.exitSessionReadyMode()}))):(this._clearEntriesWatcher(),this.agentTitleBarStatusService.exitSessionReadyMode())}else this._clearEntriesWatcher(),n=(Array.isArray(o.changes)?o.changes.filter(s=>!!s.originalUri).length:0)>0,n&&!this._suppressSessionReady?this.agentTitleBarStatusService.enterSessionReadyMode(o.resource,o.label):this.agentTitleBarStatusService.exitSessionReadyMode()}};MWe=I([m(0,Pt),m(1,B),m(2,vfe),m(3,md),m(4,DWe),m(5,ud)],MWe);W(koe);W(NQ);W(Lqt);Ee(DWe,_We,1);Ee(vfe,Dqt,1);It(Sfe.ID,Sfe,St.AfterRestored);It(MWe.ID,MWe,St.AfterRestored);ve.appendMenuItem(D.CommandCenter,{submenu:D.AgentsTitleBarControlMenu,title:d(6152,null),icon:R.chatSparkle,when:C.and(ie.enabled,C.notEquals("config.chat.agentsControl.enabled","hidden"),C.notEquals("config.chat.agentsControl.enabled",!1)),order:10002});ve.appendMenuItem(D.TitleBar,{submenu:D.ChatTitleBarMenu,title:d(6154,null),group:"navigation",icon:R.chatSparkle,when:C.and(ie.supported,C.and(ie.Setup.hidden.negate(),ie.Setup.disabled.negate()),C.has("config.window.commandCenter").negate()),order:1});ve.appendMenuItem(D.AgentsTitleBarControlMenu,{command:{id:"workbench.action.chat.toggle",title:d(6153,null)},when:ie.enabled,group:"a_open",order:1});ve.appendMenuItem(D.AgentsTitleBarControlMenu,{command:{id:"toggle.chat.unifiedAgentsBar.enabled",title:d(6155,null),toggled:C.has("config.chat.unifiedAgentsBar.enabled")},when:C.and(ie.enabled,eB.notEqualsTo("stable")),group:"z_experimental",order:10});var Ife=class extends x{constructor(e,t){super();this.chatService=e;this.chatSessionsService=t;this.chatSessionType=sc;this._onDidChangeChatSessionItems=this._register(new E);this.onDidChangeChatSessionItems=this._onDidChangeChatSessionItems.event;this._modelListeners=this._register(new Xb);this._isDisposed=!1;this._items=new gt;this._register(this.chatSessionsService.registerChatSessionItemController(this.chatSessionType,this)),this.registerListeners()}static{this.ID="workbench.contrib.localAgentsSessionsController"}dispose(){this._isDisposed=!0,super.dispose()}get items(){return Array.from(this._items.values())}async refresh(e){let t=await this.provideChatSessionItems(e);this._items.clear();for(let o of t)this._items.set(o.resource,o)}registerListeners(){let e=async t=>{if(gl(t.sessionResource)!==this.chatSessionType||(await this.refresh(Se.None),this._isDisposed))return;this.tryUpdateLiveSessionItem(t);let o=t.lastRequestObs.map(r=>r?.response&&Fr("chatSessions.modelRequestChangeListener",r.response.onDidChange)),n=Fr("chatSessions.modelChangeListener",t.onDidChange);this._modelListeners.set(t.sessionResource,be(r=>{o.read(r)?.read(r),n.read(r),this.tryUpdateLiveSessionItem(t)}))};this._register(this.chatService.onDidCreateModel(t=>e(t)));for(let t of this.chatService.chatModels.get())e(t);this._register(this.chatService.onDidDisposeSession(t=>{for(let n of t.sessionResources)this._modelListeners.deleteAndDispose(n);let o=t.sessionResources.filter(n=>gl(n)===this.chatSessionType);o.length&&this._onDidChangeChatSessionItems.fire({removed:o})}))}async tryUpdateLiveSessionItem(e){let t=this._items.get(e.sessionResource);if(!t)return;let o=new Mqt(await kRi(e),e);t.isEqual(o)||(this._items.set(t.resource,o),this._onDidChangeChatSessionItems.fire({addedOrUpdated:[o]}))}async provideChatSessionItems(e){let t=[],o=new En;for(let n of await this.chatService.getLiveSessionItems()){let r=this.toChatSessionItem(n);r&&(o.add(n.sessionResource),t.push(r))}if(!e.isCancellationRequested){let n=await this.getHistoryItems();t.push(...n.filter(r=>!o.has(r.resource)))}return t}async getHistoryItems(){try{let e=await this.chatService.getHistorySessionItems();return di(e.map(t=>this.toChatSessionItem(t)))}catch{return[]}}toChatSessionItem(e){let t=this.chatService.getSession(e.sessionResource);if(t){if(!t.hasRequests)return}else if(e.isActive)return;return new Mqt(e,t)}};Ife=I([m(0,mi),m(1,Us)],Ife);var Mqt=class{constructor(i,e){this.iconPath=R.chatSparkle;this.resource=i.sessionResource,this.label=i.title,this.description=e?BNt(e):void 0,this.status=(e&&sOt(e))??mao(i.lastResponseState),this.timing=tto(i.timing),this.changes=i.stats?{insertions:i.stats.added,deletions:i.stats.removed,files:i.stats.fileCount}:void 0}isEqual(i){return Qe(this.resource,i.resource)&&this.label===i.label&&this.description===i.description&&this.status===i.status&&this.timing.created===i.timing.created&&this.timing.lastRequestStarted===i.timing.lastRequestStarted&&this.timing.lastRequestEnded===i.timing.lastRequestEnded&&eo(this.changes,i.changes)}};var dAi="agent ",PWe=class extends Lh{constructor(e,t,o){super(dAi,{canAcceptInBackground:!0,noResultsPick:{label:d(6113,null)}});this.agentSessionsService=e;this.instantiationService=t;this.commandService=o;this.sorter=new yQ;this.filter=this._register(this.instantiationService.createInstance(TW,{}))}async _getPicks(e){let t=[],o=this.agentSessionsService.model.sessions.filter(r=>!this.filter.exclude(r)).sort(this.sorter.compare.bind(this.sorter)),n=urt(o);for(let r of n.values())if(r.sessions.length>0){t.push({type:"separator",label:r.label});for(let s of r.sessions){let l=lm(e,s.label,!0);l&&t.push(this.toPickItem(s,l))}}return t}toPickItem(e,t){let o=JRi(e),n=ZRi(e);return{label:e.label,description:o,highlights:{label:t},iconClass:q.asClassName(e.icon),buttons:n,trigger:async r=>{switch(n[r]){case z2t:return await this.commandService.executeCommand(QEe,e),2;case K2t:return await this.commandService.executeCommand(YEe,e),2;case YRi:case XRi:{let l=!e.isArchived();return e.setArchived(l),2}default:return 0}},accept:(r,s)=>{this.instantiationService.invokeFunction(x0e,e,{sideBySide:s.inBackground,editorOptions:{preserveFocus:s.inBackground,pinned:s.inBackground}})}}}};PWe=I([m(0,md),m(1,F),m(2,ge)],PWe);W(doe);W(j2t);W(Q2t);W(Y2t);W(J2t);W(Z2t);W(eGt);W(tGt);W(nGt);W(rGt);W(sGt);W(aGt);W(lGt);W(cGt);W(dGt);W(iGt);W(oGt);W(mGt);W(uGt);W(pGt);W(hGt);W(gGt);W(tL);W(tq);W(vGt);W(G2t);W(q2t);W($2t);ve.appendMenuItem(D.AgentSessionsToolbar,{submenu:D.AgentSessionsViewerFilterSubMenu,title:L(6044,"Filter Agent Sessions"),group:"navigation",order:3,icon:R.filter});ve.appendMenuItem(D.AgentSessionsToolbar,{command:{id:tL.ID,title:tL.TITLE,icon:R.layoutSidebarRightOff},group:"navigation",order:5,when:C.and(ie.agentSessionsViewerOrientation.isEqualTo(1),ie.agentSessionsViewerPosition.isEqualTo(2))});ve.appendMenuItem(D.AgentSessionsToolbar,{command:{id:tL.ID,title:tL.TITLE,icon:R.layoutSidebarLeftOff},group:"navigation",order:5,when:C.and(ie.agentSessionsViewerOrientation.isEqualTo(1),ie.agentSessionsViewerPosition.isEqualTo(1))});ve.appendMenuItem(D.AgentSessionsToolbar,{command:{id:tq.ID,title:tq.TITLE,icon:R.layoutSidebarRight},group:"navigation",order:5,when:C.and(ie.agentSessionsViewerOrientation.isEqualTo(2),ie.agentSessionsViewerPosition.isEqualTo(2))});ve.appendMenuItem(D.AgentSessionsToolbar,{command:{id:tq.ID,title:tq.TITLE,icon:R.layoutSidebarLeft},group:"navigation",order:5,when:C.and(ie.agentSessionsViewerOrientation.isEqualTo(2),ie.agentSessionsViewerPosition.isEqualTo(1))});ve.appendMenuItem(D.ChatViewSessionTitleToolbar,{command:{id:tL.ID,title:tL.TITLE,icon:R.layoutSidebarLeftOff},group:"navigation",order:1,when:C.and(C.or(ie.agentSessionsViewerVisible.negate(),ie.agentSessionsViewerOrientation.isEqualTo(1)),ie.agentSessionsViewerPosition.isEqualTo(1))});ve.appendMenuItem(D.ChatViewSessionTitleToolbar,{command:{id:tL.ID,title:tL.TITLE,icon:R.layoutSidebarRightOff},group:"navigation",order:1,when:C.and(C.or(ie.agentSessionsViewerVisible.negate(),ie.agentSessionsViewerOrientation.isEqualTo(1)),ie.agentSessionsViewerPosition.isEqualTo(2))});ne.as(Ku.Quickaccess).registerQuickAccessProvider({ctor:PWe,prefix:dAi,contextKey:"inAgentSessionsPicker",when:ie.enabled,placeholder:d(6043,null),helpEntries:[{description:d(6042,null),commandId:"workbench.action.chat.history"}]});It(Ife.ID,Ife,St.AfterRestored);Ee(md,RDe,1);var Oln=5e3,Eoe=class extends x{constructor(e,t,o){super();this._accessibilitySignalService=o;this._scheduler=this._register(new Dt(()=>{this._signalLoop=this._accessibilitySignalService.playSignalLoop($o.progress,t??Oln)},e)),this._scheduler.schedule()}dispose(){super.dispose(),this._signalLoop?.dispose(),this._scheduler.dispose()}};Eoe=I([m(2,lr)],Eoe);var ko=le("nativeHostService");var Fln=4e3,AWe=class extends x{constructor(e,t,o,n,r,s){super();this._accessibilitySignalService=e;this._instantiationService=t;this._configurationService=o;this._hostService=n;this._widgetService=r;this._chatService=s;this._pendingSignalMap=this._register(new Vt);this.toasts=this._register(new BSe);this._register(this._widgetService.onDidBackgroundSession(l=>{let c=this._chatService.getSession(l);!c||!c.requestInProgress.get()||this.disposeRequest(l)}))}acceptRequest(e,t){t||this._accessibilitySignalService.playSignal($o.chatRequestSent,{allowManyInParallel:!0}),this._pendingSignalMap.set(e,this._instantiationService.createInstance(Eoe,Fln,void 0))}disposeRequest(e){this._pendingSignalMap.deleteAndDispose(e)}acceptResponse(e,t,o,n,r){this._pendingSignalMap.deleteAndDispose(n);let s=typeof o!="string",l=typeof o=="string"?o:o?.response.toString();if(this._accessibilitySignalService.playSignal($o.chatResponseReceived,{allowManyInParallel:!0}),!o||!l)return;let c=Da(new Ie(l)),u=s&&o.errorDetails?` ${o.errorDetails.message}`:"";this._showOSNotification(e,t,c+u),(!r||this._configurationService.getValue("accessibility.voice.autoSynthesize")!=="on")&&qr(c+u)}acceptElicitation(e){if(e.state.get()!=="pending")return;let t=typeof e.title=="string"?e.title:e.title.value,o=typeof e.message=="string"?e.message:e.message.value;en(t+" "+o),this._accessibilitySignalService.playSignal($o.chatUserActionRequired,{allowManyInParallel:!0})}async _showOSNotification(e,t,o){let n=this._configurationService.getValue("chat.notifyWindowOnResponseReceived");if(n==="off")return;let r=Re(t);if(!r)return;let s=r.document.hasFocus();if(n!=="always"&&s||!o||!o.trim())return;s||await this._hostService.focus(r,{mode:1}),this.toasts.clearAndDisposeAll();let l=e?.viewModel?.model.title?d(5621,null,e.viewModel.model.title):d(5620,null),c=new Ye,u=Z(()=>c.dispose(!0));this.toasts.add(u);let{clicked:p}=await this._hostService.showToast({title:l,body:d(5622,null)},c.token);this.toasts.deleteAndDispose(u),p&&(await this._hostService.focus(r,{mode:2}),await this._widgetService.reveal(e),e.focusInput())}};AWe=I([m(0,lr),m(1,F),m(2,B),m(3,Zt),m(4,Pt),m(5,mi)],AWe);var Aqt=_,NWe=class extends x{constructor(e,t,o,n){super();this.chatEntitlementService=e;this.commandService=t;this.configurationService=o;this.telemetryService=n;this.domNode=Aqt(".chat-status-widget"),this.domNode.style.display="none",this.initializeIfEnabled()}static{this.ID="chatStatusWidget"}initializeIfEnabled(){let e=this.chatEntitlementService.entitlement;if(this.chatEntitlementService.anonymous&&this.configurationService.getValue("chat.statusWidget.anonymous"))this.createWidgetContent("anonymous");else if(e===5)this.createWidgetContent("free");else return;this.domNode.style.display=""}get height(){return this.domNode.style.display==="none"?0:this.domNode.offsetHeight}createWidgetContent(e){let t=Aqt(".chat-status-content");this.messageElement=Aqt(".chat-status-message"),t.appendChild(this.messageElement);let o=Aqt(".chat-status-action");if(this.actionButton=this._register(new Wi(o,{...Qo,supportIcons:!0})),this.actionButton.element.classList.add("chat-status-button"),e==="anonymous"){let n=d(8014,null),r=d(8015,null);this.messageElement.textContent=n,this.actionButton.label=r,this.actionButton.element.ariaLabel=d(8016,null,n,r)}else{let n=d(8017,null),r=d(8018,null);this.messageElement.textContent=n,this.actionButton.label=r,this.actionButton.element.ariaLabel=d(8019,null,n,r)}this._register(this.actionButton.onDidClick(async()=>{let n=this.chatEntitlementService.anonymous?Ab:"workbench.action.chat.upgradePlan";this.telemetryService.publicLog2("workbenchActionExecuted",{id:n,from:"chatStatusWidget"}),await this.commandService.executeCommand(n)})),this.domNode.appendChild(t),this.domNode.appendChild(o)}};NWe=I([m(0,rr),m(1,ge),m(2,B),m(3,Te)],NWe);Sot.register(NWe.ID,NWe,C.and(ie.chatQuotaExceeded,ie.chatSessionIsEmpty,C.or(ie.Entitlement.planFree,cs.chatAnonymous)));var OWe=class extends x{constructor(e,t,o){super();this.modelService=t;this.languageService=o;this._register(e.registerTextModelContentProvider(Q.vscodeChatInput,this))}async provideTextContent(e){let t=this.modelService.getModel(e);return t||this.modelService.createModel("",this.languageService.createById("chatinput"),e)}};OWe=I([m(0,Bt),m(1,Tt),m(2,_t)],OWe);var yfe=class{constructor(i,e,t){this._store=new N;let o=ui(this,e.onDidActiveEditorChange,()=>e.activeEditorPane?.input.resource);this._store.add(be(n=>{let r=o.read(n);if(!r)return;i.editingSessionsObs.read(n).find(l=>l.readEntry(r,n))&&t.playSignal($o.chatEditModifiedFile)}))}static{this.ID="chat.edits.accessibilty"}dispose(){this._store.dispose()}};yfe=I([m(0,ud),m(1,ee),m(2,lr)],yfe);var uAi=class{constructor(i,e,t){this.total=i;this.remaining=e;this.cancel=t}},pAi=te("minimap.chatEditHighlight",ai(Ho,.6),d(6990,null)),tE=class extends x{constructor(e,t,o,n,r,s,l,c,u,p){super();this.modifiedURI=e;this._telemetryInfo=t;this._fileConfigService=r;this._chatService=s;this._fileService=l;this._undoRedoService=c;this._instantiationService=u;this._aiEditTelemetryService=p;this.entryId=`${tE.scheme}::${++tE.lastEntryId}`;this._onDidDelete=this._register(new E);this.onDidDelete=this._onDidDelete.event;this._stateObs=Me(this,0);this.state=this._stateObs;this._waitsForLastEdits=Me(this,!1);this.waitsForLastEdits=this._waitsForLastEdits;this._isCurrentlyBeingModifiedByObs=Me(this,void 0);this.isCurrentlyBeingModifiedBy=this._isCurrentlyBeingModifiedByObs;this._isExternalEditInProgress=!1;this._lastModifyingResponseObs=ph({equalsFn:(e,t)=>e?.requestId===t?.requestId},void 0);this.lastModifyingResponse=this._lastModifyingResponseObs;this._lastModifyingResponseInProgressObs=this._lastModifyingResponseObs.map((e,t)=>e?.isInProgress.read(t)??!1);this._rewriteRatioObs=Me(this,0);this.rewriteRatio=this._rewriteRatioObs;this._reviewModeTempObs=Me(this,void 0);this._autoAcceptCtrl=Me(this,void 0);this.autoAcceptController=this._autoAcceptCtrl;this._refCounter=1;this._userEditScheduler=this._register(new Dt(()=>this._notifySessionAction("userModified"),1e3));this._editorIntegrations=this._register(new Vt);o===0&&(this.createdInRequestId=this._telemetryInfo.requestId),this.modifiedURI.scheme!==Q.untitled&&this.modifiedURI.scheme!==Q.vscodeNotebookCell&&(this._register(this._fileService.watch(this.modifiedURI)),this._register(this._fileService.onDidFilesChange(f=>{f.affects(this.modifiedURI)&&o===0&&f.gotDeleted()&&this._onDidDelete.fire()})));let h=hr("chat.editing.autoAcceptDelay",0,n);this._autoAcceptTimeout=ke(f=>{let v=h.read(f);return Bn(v,0,100)}),this.reviewMode=ke(f=>{let v=this._autoAcceptTimeout.read(f);return this._reviewModeTempObs.read(f)??v===0}),this._store.add(Z(()=>this._lastModifyingResponseObs.set(void 0,void 0)));let g=this._store.add(new me);this._store.add(be(f=>{this._waitsForLastEdits.read(f)?g.value=r.disableAutoSave(this.modifiedURI):g.clear()})),this._store.add(be(f=>{if(this._lastModifyingResponseInProgressObs.read(f)===!1&&!this.reviewMode.read(f)){let b=this._autoAcceptTimeout.read(void 0)*1e3,S=Date.now()+b,y=()=>{if(this.reviewMode.read(void 0)){this._autoAcceptCtrl.set(void 0,void 0);return}let k=Math.round(S-Date.now());if(k<=0)this.accept();else{let T=setTimeout(y,100);this._autoAcceptCtrl.set(new uAi(b,k,()=>{clearTimeout(T),this._autoAcceptCtrl.set(void 0,void 0)}),void 0)}};y()}}))}static{this.scheme="modified-file-entry"}static{this.lastEntryId=0}get telemetryInfo(){return this._telemetryInfo}get lastModifyingRequestId(){return this._telemetryInfo.requestId}dispose(){--this._refCounter===0&&super.dispose()}acquire(){return this._refCounter++,this}enableReviewModeUntilSettled(){if(this.state.get()!==0)return;this._reviewModeTempObs.set(!0,void 0);let e=be(t=>{this.state.read(t)!==0&&(this._store.delete(e),this._reviewModeTempObs.set(void 0,void 0))});this._store.add(e)}updateTelemetryInfo(e){this._telemetryInfo=e}async accept(){let e=await this.acceptDeferred();e&&Gi(e)}async acceptDeferred(){if(this._stateObs.get()===0)return await this._doAccept(),e=>{this._stateObs.set(1,e),this._autoAcceptCtrl.set(void 0,e),this._notifySessionAction("accepted")}}async reject(){let e=await this.rejectDeferred();e&&Gi(e)}async rejectDeferred(){if(this._stateObs.get()===0)return this._notifySessionAction("rejected"),await this._doReject(),e=>{this._stateObs.set(2,e),this._autoAcceptCtrl.set(void 0,e)}}_notifySessionAction(e){this._notifyAction({kind:"chatEditingSessionAction",uri:this.modifiedURI,hasRemainingEdits:!1,outcome:e})}_notifyAction(e){e.kind==="chatEditingHunkAction"&&this._aiEditTelemetryService.handleCodeAccepted({suggestionId:void 0,acceptanceMethod:"accept",presentation:"highlightedEdit",modelId:this._telemetryInfo.modelId,modeId:this._telemetryInfo.modeId,applyCodeBlockSuggestionId:this._telemetryInfo.applyCodeBlockSuggestionId,editDeltaInfo:new lw(e.linesAdded,e.linesRemoved,-1,-1),feature:this._telemetryInfo.feature,languageId:e.languageId,source:void 0}),this._chatService.notifyUserAction({action:e,agentId:this._telemetryInfo.agentId,modelId:this._telemetryInfo.modelId,modeId:this._telemetryInfo.modeId,command:this._telemetryInfo.command,sessionResource:this._telemetryInfo.sessionResource,requestId:this._telemetryInfo.requestId,result:this._telemetryInfo.result})}getEditorIntegration(e){let t=this._editorIntegrations.get(e);return t||(t=this._createEditorIntegration(e),this._editorIntegrations.set(e,t)),t}acceptStreamingEditsStart(e,t,o){this._resetEditsState(o),this._isCurrentlyBeingModifiedByObs.set({responseModel:e,undoStopId:t},o),this._lastModifyingResponseObs.set(e,o),this._autoAcceptCtrl.get()?.cancel();let n=this._createUndoRedoElement(e);n&&this._undoRedoService.pushElement(n)}async acceptStreamingEditsEnd(){this._resetEditsState(void 0),await this._areOriginalAndModifiedIdentical()&&await this.accept()}_resetEditsState(e){this._isCurrentlyBeingModifiedByObs.set(void 0,e),this._rewriteRatioObs.set(0,e),this._waitsForLastEdits.set(!1,e)}startExternalEdit(){this._isExternalEditInProgress=!0}stopExternalEdit(){this._isExternalEditInProgress=!1}};tE=I([m(3,B),m(4,gr),m(5,mi),m(6,fe),m(7,Ml),m(8,F),m(9,xS)],tE);function Zrt(a){let i=Jr.parseLocalSessionId(a);if(i)return i;let e=new Yy;return e.update(a.toString()),e.digest()}var nL=class{constructor(i,e){this._chatEditingService=i;this._modelService=e}static{this.scheme=Q.chatEditingModel}static getFileURI(i,e,t){return A.from({scheme:nL.scheme,path:t,query:JSON.stringify({kind:"doc",documentId:e,chatSessionResource:i})})}async provideTextContent(i){let e=this._modelService.getModel(i);if(e&&!e.isDisposed())return e;let t=JSON.parse(i.query),n=this._chatEditingService.getEditingSession(A.revive(t.chatSessionResource))?.entries.get().find(r=>r.entryId===t.documentId);return n?this._modelService.getModel(n.originalURI):null}};nL=I([m(1,Tt)],nL);var mq=class{constructor(i,e){this._chatEditingService=i;this._modelService=e}static getSnapshotFileURI(i,e,t,o,n){return A.from({scheme:Q.chatEditingSnapshotScheme,path:o,query:JSON.stringify({session:i,requestId:e??"",undoStop:t??"",scheme:n})})}async provideTextContent(i){let e=this._modelService.getModel(i);if(e&&!e.isDisposed())return e;let t=JSON.parse(i.query),o=this._chatEditingService.getEditingSession(A.revive(t.session));return!o||!t.requestId?null:o.getSnapshotModel(t.requestId,t.undoStop||void 0,i)}};mq=I([m(1,Tt)],mq);var dCo="ArrayBuffer-4f56482b-5a03-49ba-8356-210d3b0c1c3d",hAi="chat-editing-notebook-snapshot-model";function gAi(a,i,e,t,o){return A.from({scheme:hAi,path:t,query:JSON.stringify({session:a,requestId:i??"",undoStop:e??"",viewType:o})})}function VM(a,i,e){let t=(typeof e=="number"?e:e.getValue(yt.outputBackupSizeLimit))*1024;return Wln(a.createSnapshot({context:2,outputSizeLimit:t,transientOptions:i}),i)}function BM(a,i){try{let{transientOptions:e,data:t}=FWe(i);a.restoreSnapshot(t,e);let o=[];t.cells.forEach((n,r)=>{let s=n.internalMetadata?.internalId;s&&o.push({editType:9,index:r,internalMetadata:{internalId:s}})}),a.applyEdits(o,!0,void 0,()=>{},void 0,!1)}catch(e){console.error("Error restoring Notebook snapshot",e)}}var Toe=class{constructor(i){let{transientOptions:e,data:t}=FWe(i);this.transientOptions=e,this.data=t}isEqual(i){if(i.cells.length!==this.data.cells.length)return!1;let e=this.transientOptions?.transientDocumentMetadata||{},t=IP(i.metadata||{},r=>!e[r]),o=IP(this.data.metadata||{},r=>!e[r]);if(JSON.stringify(t)!==JSON.stringify(o))return!1;let n=this.transientOptions?.transientCellMetadata||{};for(let r=0;r<i.cells.length;r++){let s=i.cells[r],l=this.data.cells[r];if(s instanceof f8){if(!s.fastEqual(l,!0))return!1}else{if(s.cellKind!==l.cellKind||s.language!==l.language||s.mime!==l.mime||s.source!==l.source||!this.transientOptions?.transientOutputs&&s.outputs.length!==l.outputs.length)return!1;let c=IP(s.metadata||{},p=>!n[p]),u=IP(l.metadata||{},p=>!n[p]);if(JSON.stringify(c)!==JSON.stringify(u)||JSON.stringify(mAi(s,!0,this.transientOptions))!==JSON.stringify(mAi(l,!0,this.transientOptions)))return!1}}return!0}};function mAi(a,i,e){let t=e?.transientCellMetadata||{},o=e?.transientOutputs?[]:a.outputs.map(n=>({outputId:n.outputId,metadata:n.metadata,outputs:n.outputs.map(r=>({data:r.data,mime:r.mime}))}));return{cellKind:a.cellKind,language:a.language,metadata:a.metadata?IP(a.metadata,n=>!t[n]):a.metadata,outputs:o,mime:a.mime,source:a.source,collapseState:a.collapseState,internalMetadata:i?void 0:a.internalMetadata}}function Wln(a,i){let e={cells:a.cells.map(t=>mAi(t)),metadata:a.metadata};return JSON.stringify([JSON.stringify(i),JSON.stringify(e,(t,o)=>o instanceof qe?{type:dCo,data:Yd(o)}:o)])}function FWe(a){let[i,e]=JSON.parse(a),t=i?JSON.parse(i):void 0,o=JSON.parse(e,(n,r)=>r&&r.type===dCo?qa(r.data):r);return{transientOptions:t,data:o}}var uCo="$$start",WWe="__epoch_",VWe=class{constructor(i,e,t,o,n,r,s){this.chatSessionResource=i;this._delegate=e;this._notebookEditorModelResolverService=t;this._notebookService=o;this._textModelService=n;this._editorWorkerService=r;this._configurationService=s;this._epochCounter=0;this._checkpoints=Me(this,[]);this._currentEpoch=Me(this,0);this._operations=ph({equalsFn:()=>!1},[]);this._fileBaselines=new Map;this._refCountedDiffs=new Map;this._finalizedDiffCache=new Map;this._willUndoToCheckpoint=ke(i=>{let e=this._currentEpoch.read(i),t=this._checkpoints.read(i);if(t.length<2||e<=t[1].epoch)return;let o=this._operations.read(i),n=OSe(t,c=>c.epoch<e),r=n===-1?void 0:fd(t,c=>c.undoStopId===void 0,n),s=fd(o,c=>c.epoch<e),l=s&&fd(t,c=>c.epoch<s.epoch);return r?!l||!o.some(c=>c.epoch>r.epoch&&c.epoch<l.epoch)?r:l.epoch>r.epoch?l:r:l});this.canUndo=this._willUndoToCheckpoint.map(i=>!!i);this._willRedoToEpoch=ke(i=>{let e=this._currentEpoch.read(i),t=this._operations.read(i),o=this._checkpoints.read(i),n=Math.max(t.at(-1)?.epoch||0,o.at(-1)?.epoch||0);if(e>n)return;let r=t.find(c=>c.epoch>=e);if(!r){let c=o.find(p=>p.epoch>=e&&p.undoStopId===void 0);if(!c)return n+1;let u=o.find(p=>p.epoch>c.epoch&&p.undoStopId===void 0);return u?u.epoch:n+1}let s=o.find(c=>c.epoch>r.epoch),l=fd(o,c=>c.epoch<e);if(l&&r&&l.requestId!==r.requestId){let c=OSe(o,(p,h)=>p.undoStopId===void 0&&o[h-1]?.requestId===l.requestId),u=c===-1?void 0:o[c];if(u&&r.requestId!==u.requestId){let p=oht(o,h=>h.undoStopId===void 0,c+1);if(p)return p.epoch}}return Math.min(s?.epoch||1/0,n+1)});this.canRedo=this._willRedoToEpoch.map(i=>!!i);this.requestDisablement=Os({equalsFn:(i,e)=>$i(i,e,eo)},i=>{let e=this._currentEpoch.read(i),t=this._operations.read(i),o=this._checkpoints.read(i),n=Math.max(t.at(-1)?.epoch||0,o.at(-1)?.epoch||0);if(e>n)return[];let r=fd(t,u=>u.epoch<e)?.epoch||0,s=fd(o,u=>u.epoch<e&&u.undoStopId===void 0)?.epoch||0,l=Math.max(r,s),c=new Map;for(let u=o.length-1;u>=0;u--){let{undoStopId:p,requestId:h,epoch:g}=o[u];if(g<=l)break;h&&c.set(h,p)}return[...c].map(([u,p])=>({requestId:u,afterUndoStop:p}))});this.createCheckpoint(void 0,void 0,"Initial State","Starting point before any edits")}createCheckpoint(i,e,t,o){let r=this._checkpoints.get().find(p=>p.undoStopId===e&&p.requestId===i);if(r)return r.checkpointId;let{checkpoints:s,operations:l}=this._getVisibleOperationsAndCheckpoints(),c=xt(),u=this.incrementEpoch();return s.push({checkpointId:c,requestId:i,undoStopId:e,epoch:u,label:t,description:o}),Gi(p=>{this._checkpoints.set(s,p),this._operations.set(l,p),this._currentEpoch.set(u+1,p)}),c}async undoToLastCheckpoint(){let i=this._willUndoToCheckpoint.get();i&&await this.navigateToCheckpoint(i.checkpointId)}async redoToNextCheckpoint(){let i=this._willRedoToEpoch.get();i&&await this._navigateToEpoch(i)}navigateToCheckpoint(i){let e=this._getCheckpoint(i);if(!e)throw new Error(`Checkpoint ${i} not found`);return e.undoStopId===void 0?this._navigateToEpoch(e.epoch+1,e.epoch):this._navigateToEpoch(e.epoch+1)}getContentURIAtStop(i,e,t){return mq.getSnapshotFileURI(this.chatSessionResource,i,t,e.path)}async _navigateToEpoch(i,e=i){let t=this._currentEpoch.get();if(t!==i){let o=await this._applyFileSystemOperations(t,i);await this._reconstructAllFileContents(i,o)}this._currentEpoch.set(e,void 0)}_getCheckpoint(i){return this._checkpoints.get().find(e=>e.checkpointId===i)}incrementEpoch(){return this._epochCounter++}recordFileOperation(i){let{currentEpoch:e,checkpoints:t,operations:o}=this._getVisibleOperationsAndCheckpoints();if(i.epoch<e)throw new Error(`Cannot record operation at epoch ${i.epoch} when current epoch is ${e}`);o.push(i),Gi(n=>{this._checkpoints.set(t,n),this._operations.set(o,n),this._currentEpoch.set(i.epoch+1,n)})}_getVisibleOperationsAndCheckpoints(){let i=this._currentEpoch.get(),e=this._checkpoints.get(),t=this._operations.get();return{currentEpoch:i,checkpoints:e.filter(o=>o.epoch<i),operations:t.filter(o=>o.epoch<i)}}recordFileBaseline(i){let e=this._getBaselineKey(i.uri,i.requestId);this._fileBaselines.set(e,i)}_getFileBaseline(i,e){let t=this._getBaselineKey(i,e);return this._fileBaselines.get(t)}hasFileBaseline(i,e){let t=this._getBaselineKey(i,e);return this._fileBaselines.has(t)||this._operations.get().some(o=>o.type==="create"&&o.requestId===e&&Qe(i,o.uri))}async getContentAtStop(i,e,t){let o;t?.startsWith(WWe)?o=Number(t.slice(WWe.length)):o=this._checkpoints.get().find(c=>c.requestId===i&&c.undoStopId===t)?.epoch;let n=this._getTimelineCanonicalUriForPath(e);if(!o||!n)return"";let r=await this._findBestBaselineForFile(n,o,i);if(!r)return"";let s=this._getFileOperationsInRange(n,r.epoch,o),l=await this._replayOperations(r,s);return l.exists?l.content:void 0}_getTimelineCanonicalUriForPath(i){for(let e of[this._fileBaselines.values(),this._operations.get()])for(let t of e)if(t.uri.path===i.path)return t.uri}onDidChangeContentsAtStop(i,e,t,o){if(!t||!t.startsWith(WWe))return x.None;let n=Number(t.slice(WWe.length));if(n<=this._epochCounter)return x.None;let r=new N,s=r.add(new ya(500));return r.add(U.fromObservableLight(this._operations)(()=>{s.trigger(async()=>{this._operations.get().at(-1)?.epoch>=n&&r.dispose();let l=await this.getContentAtStop(i,e,t);l!==void 0&&o(l)})})),r}_getCheckpointBeforeEpoch(i,e){return fd(this._checkpoints.read(e),t=>t.epoch<=i)}async _reconstructFileState(i,e){let t=this._getCheckpointBeforeEpoch(e);if(!t)throw new Error(`Checkpoint for epoch ${e} not found`);let o=await this._findBestBaselineForFile(i,e,t.requestId||"");if(!o)return{exists:!1,uri:i};let n=this._getFileOperationsInRange(i,o.epoch,e);return this._replayOperations(o,n)}getStateForPersistence(){return{checkpoints:this._checkpoints.get(),currentEpoch:this._currentEpoch.get(),fileBaselines:[...this._fileBaselines],operations:this._operations.get(),epochCounter:this._epochCounter}}restoreFromState(i,e){this._checkpoints.set(i.checkpoints,e),this._currentEpoch.set(i.currentEpoch,e),this._operations.set(i.operations.slice(),e),this._epochCounter=i.epochCounter,this._fileBaselines.clear();for(let[t,o]of i.fileBaselines)this._fileBaselines.set(t,o)}getCheckpointIdForRequest(i,e){return this._checkpoints.get().find(o=>o.requestId===i&&o.undoStopId===e)?.checkpointId}async _reconstructAllFileContents(i,e){await Promise.all(Array.from(e).map(async t=>{let o=await this._reconstructFileState(t,i);o.exists&&await this._delegate.setContents(o.uri,o.content,o.telemetryInfo)}))}_getBaselineKey(i,e){return`${i.toString()}::${e}`}async _findBestBaselineForFile(i,e,t){let o=t,n=this._operations.get();for(let r=n.length-1;r>=0;r--){let s=n[r];if(!(s.epoch>e)){if(s.type==="create"&&Qe(s.uri,i))return{uri:s.uri,requestId:s.requestId,content:s.initialContent,epoch:s.epoch,telemetryInfo:s.telemetryInfo};if(s.type==="rename"&&Qe(s.newUri,i)){let l=await this._findBestBaselineForFile(s.oldUri,s.epoch,s.requestId);if(!l)return;let c=this._getFileOperationsInRange(s.oldUri,l.epoch,s.epoch),u=await this._replayOperations(l,c);return{uri:i,epoch:s.epoch,content:u.exists?u.content:"",requestId:s.requestId,telemetryInfo:l.telemetryInfo,notebookViewType:u.exists?u.notebookViewType:void 0}}if(o&&s.requestId!==o){let l=this._getFileBaseline(i,o);if(l)return l}o=s.requestId}}return this._getFileBaseline(i,o)}_getFileOperationsInRange(i,e,t){return this._operations.get().filter(o=>{let n=Zo.parse(o.uri);return o.epoch>=e&&o.epoch<t&&(Qe(o.uri,i)||n&&Qe(n.notebook,i))}).sort((o,n)=>o.epoch-n.epoch)}async _replayOperations(i,e){let t={exists:!0,content:i.content,uri:i.uri,telemetryInfo:i.telemetryInfo};i.notebookViewType&&(t.notebook=await this._notebookEditorModelResolverService.createUntitledNotebookTextModel(i.notebookViewType),i.content&&BM(t.notebook,i.content));for(let o of e)t=await this._applyOperationToState(t,o,i.telemetryInfo);if(t.exists&&t.notebook){let o=await this._notebookService.withNotebookDataProvider(t.notebook.viewType);t.content=VM(t.notebook,o.serializer.options,this._configurationService),t.notebook.dispose()}return t}async _applyOperationToState(i,e,t){switch(e.type){case"create":{i.exists&&i.notebook&&i.notebook.dispose();let o;return e.notebookViewType&&(o=await this._notebookEditorModelResolverService.createUntitledNotebookTextModel(e.notebookViewType),e.initialContent&&BM(o,e.initialContent)),{exists:!0,content:e.initialContent,uri:e.uri,telemetryInfo:t,notebookViewType:e.notebookViewType,notebook:o}}case"delete":return i.exists&&i.notebook&&i.notebook.dispose(),{exists:!1,uri:e.uri};case"rename":return{...i,uri:e.newUri};case"textEdit":{if(!i.exists)throw new Error("Cannot apply text edits to non-existent file");let o=e.cellIndex!==void 0&&i.notebook?.cells.at(e.cellIndex);if(o){let n=this._applyTextEditsToContent(o.getValue(),e.edits);return i.notebook.applyEdits([{editType:1,index:e.cellIndex,count:1,cells:[{cellKind:o.cellKind,language:o.language,mime:o.language,source:n,outputs:o.outputs}]}],!0,void 0,()=>{},void 0),i}return{...i,content:this._applyTextEditsToContent(i.content,e.edits)}}case"notebookEdit":if(!i.exists)throw new Error("Cannot apply notebook edits to non-existent file");if(!i.notebook)throw new Error("Cannot apply notebook edits to non-notebook file");return i.notebook.applyEdits(e.cellEdits.slice(),!0,void 0,()=>{},void 0),i;default:os(e)}}async _applyFileSystemOperations(i,e){let t=e>i,o=this._operations.get().filter(r=>t?r.epoch>=i&&r.epoch<e:r.epoch<i&&r.epoch>=e).sort((r,s)=>t?r.epoch-s.epoch:s.epoch-r.epoch),n=new En;for(let r of o)await this._applyFileSystemOperation(r,t,n);return n}async _applyFileSystemOperation(i,e,t){switch(i.type){case"create":e?(await this._delegate.createFile(i.uri,i.initialContent),t.add(i.uri)):(await this._delegate.deleteFile(i.uri),t.delete(i.uri));break;case"delete":e?(await this._delegate.deleteFile(i.uri),t.delete(i.uri)):(await this._delegate.createFile(i.uri,i.finalContent),t.add(i.uri));break;case"rename":e?(await this._delegate.renameFile(i.oldUri,i.newUri),t.delete(i.oldUri),t.add(i.newUri)):(await this._delegate.renameFile(i.newUri,i.oldUri),t.delete(i.newUri),t.add(i.oldUri));break;case"textEdit":case"notebookEdit":t.add(Zo.parse(i.uri)?.notebook??i.uri);break;default:os(i)}}_applyTextEditsToContent(i,e){let{textBuffer:t,disposable:o}=hz(i,1);try{t.applyEdits(e.map(r=>new c7(null,z.lift(r.range),r.text,!1,!1,!1)),!1,!1);let n=t.getRangeAt(0,t.getLength());return t.getValueInRange(n,0)}finally{o.dispose()}}getEntryDiffBetweenStops(i,e,t){let o=Os({equalsFn:(n,r)=>n.start===r.start&&n.end===r.end},n=>{let r=this._checkpoints.read(n),s=r.findIndex(l=>l.requestId===e&&l.undoStopId===t);return{start:r[s],end:r[s+1]}});return this._getEntryDiffBetweenEpochs(i,`s\0${e}\0${t}`,o)}_getRequestEpochBounds(i,e){return Os({equalsFn:(t,o)=>t.start===o.start&&t.end===o.end},t=>{let o=this._checkpoints.read(t),n=o.findIndex(l=>l.requestId===i),r=n===-1?o[0]:o[n],s;return e===void 0?s=oht(o,l=>l.requestId!==i,n+1):s=o.find(l=>l.requestId===e)||oht(o,l=>l.requestId!==i,n+1)||o[o.length-1],{start:r,end:s}})}getEntryDiffBetweenRequests(i,e,t){return this._getEntryDiffBetweenEpochs(i,`r\0${e}\0${t}`,this._getRequestEpochBounds(e,t))}_getEntryDiffBetweenEpochs(i,e,t){let o=`${i.toString()}\0${e}`,n=this._finalizedDiffCache.get(o);if(n)return So(n);let r=this._refCountedDiffs.get(o);return r||(r=this._getEntryDiffBetweenEpochsInner(i,o,t,()=>this._refCountedDiffs.delete(o)),this._refCountedDiffs.set(o,r)),r}_getEntryDiffBetweenEpochsInner(i,e,t,o){let n=ke(this,s=>{let{start:l,end:c}=t.read(s);if(!l)return;let u=s.store.add(new N),p=this.getContentURIAtStop(l.requestId||uCo,i,WWe+l.epoch),h=this.getContentURIAtStop(c?.requestId||l.requestId||uCo,i,WWe+(c?.epoch||Number.MAX_SAFE_INTEGER)),g=Promise.all([this._textModelService.createModelReference(p),this._textModelService.createModelReference(h)]).then(f=>(u.isDisposed?f.forEach(v=>v.dispose()):f.forEach(v=>u.add(v)),{refs:f.map(v=>({model:v.object.textEditorModel,onChange:Fr(this,v.object.textEditorModel.onDidChangeContent.bind(v.object.textEditorModel))})),isFinal:!!c})).catch(f=>({refs:[],isFinal:!0,error:f}));return{originalURI:p,modifiedURI:h,promise:new bd(g)}}),r=ke(s=>{let l=n.read(s);if(!l)return;let{originalURI:c,modifiedURI:u,promise:p}=l,h=p?.promiseResult.read(s);if(!h?.data)return{originalURI:c,modifiedURI:u,promise:void 0};let{refs:g,isFinal:f,error:v}=h.data;return v?{originalURI:c,modifiedURI:u,promise:new bd(Promise.resolve(bJ(c,u)))}:(g.forEach(b=>b.onChange.read(s)),{originalURI:c,modifiedURI:u,promise:new bd(this._computeDiff(c,u,!!f))})});return Os({onLastObserverRemoved:o},s=>{let l=r.read(s);if(!l)return;let c=l.promise?.promiseResult.read(s);return c?.data?(c.data.isFinal&&this._finalizedDiffCache.set(e,c.data),c.data):c?.error?bJ(l.originalURI,l.modifiedURI):{...bJ(l.originalURI,l.modifiedURI),isBusy:!0}})}_computeDiff(i,e,t){return this._editorWorkerService.computeDiff(i,e,{ignoreTrimWhitespace:!1,computeMoves:!1,maxComputationTimeMs:3e3},"advanced").then(o=>{let n={originalURI:i,modifiedURI:e,identical:!!o?.identical,isFinal:t,quitEarly:!o||o.quitEarly,added:0,removed:0,isBusy:!1};if(o)for(let r of o.changes)n.removed+=r.original.endLineNumberExclusive-r.original.startLineNumber,n.added+=r.modified.endLineNumberExclusive-r.modified.startLineNumber;return n})}hasEditsInRequest(i,e){for(let t of this._fileBaselines.values())if(t.requestId===i)return!0;for(let t of this._operations.read(e))if(t.requestId===i)return!0;return!1}getDiffsForFilesInRequest(i){let e=this._getRequestEpochBounds(i),t=Os({equalsFn:Wse},o=>{let n=new gt;for(let s of this._fileBaselines.values())s.requestId===i&&n.set(s.uri,s.epoch);let r=e.read(o);for(let s of this._operations.read(o))if(!(s.epoch<r.start.epoch)){if(r.end&&s.epoch>=r.end.epoch)break;s.type==="create"&&n.set(s.uri,0)}return n});return this._getDiffsForFilesAtEpochs(t,e.map(o=>o.end))}_getDiffsForFilesAtEpochs(i,e){let t=new gt,o;return ke(this,r=>{let s=this._checkpoints.read(r),l=s[0];if(!l)return[];let c=e.read(r);c!==o&&(t.clear(),o=c);let u=i.read(r),p=[];for(let[h,g]of u){let f=t.get(h)??this._getEntryDiffBetweenEpochs(h,`e\0${g}\0${c?.epoch}`,So({start:s.findLast(v=>v.epoch<=g)||l,end:c}));t.set(h,f),p.push(f)}return p}).map((r,s)=>r.flatMap(l=>l.read(s)).filter(lo))}getDiffsForFilesInSession(){let i=Os({equalsFn:Wse},e=>{let t=new gt;for(let o of this._fileBaselines.values())t.set(o.uri,Math.min(o.epoch,t.get(o.uri)??Number.MAX_SAFE_INTEGER));for(let o of this._operations.read(e))o.type==="create"&&t.set(o.uri,0);return t});return this._getDiffsForFilesAtEpochs(i,So(void 0))}getDiffForSession(){let i=this.getDiffsForFilesInSession();return ke(e=>{let t=i.read(e),o=0,n=0;for(let r of t)o+=r.added,n+=r.removed;return{added:o,removed:n}})}};VWe=I([m(2,yh),m(3,bn),m(4,Bt),m(5,Qs),m(6,B)],VWe);var OQ=class extends tE{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super(e,n,2,c,u,p,h,g,f,v);this._multiDiffEntryDelegate=o;this._languageId=r;this._modelService=s;this._languageService=l;this.linesAdded=So(0);this._changesCount=Me(this,1);this.changesCount=this._changesCount;this.isDeletion=!0;this._originalContent=t,this.initialContent=t,this.originalURI=nL.getFileURI(n.sessionResource,this.entryId,e.path),this.diffInfo=So(this._diffInfo()),this.linesRemoved=So(this._getOrCreateOriginalModel().getLineCount())}dispose(){this._originalModel?.dispose(),this._modifiedModel?.dispose(),super.dispose()}_getOrCreateOriginalModel(){return(!this._originalModel||this._originalModel.isDisposed())&&(this._originalModel=this._modelService.createModel(Yx(ITe(this._originalContent)),this._languageService.createById(this._languageId),this.originalURI,!1)),this._originalModel}_getOrCreateModifiedModel(){return(!this._modifiedModel||this._modifiedModel.isDisposed())&&(this._modifiedModel=this._modelService.createModel("",this._languageService.createById(this._languageId),this.modifiedURI.with({scheme:"deleted-file"}),!1)),this._modifiedModel}_diffInfo(){let e=this._getOrCreateOriginalModel();this._getOrCreateModifiedModel();let t=e.getLineCount();return{changes:[new Uf(new uo(1,t+1),new uo(1,1),void 0)],quitEarly:!1,identical:!1,moves:[]}}getDiffInfo(){return Promise.resolve(this._diffInfo())}equalsSnapshot(e){return!!e&&Qe(this.modifiedURI,e.resource)&&this._languageId===e.languageId&&this._originalContent===e.original&&e.current===""&&this.state.get()===e.state}createSnapshot(e,t,o){return{resource:this.modifiedURI,languageId:this._languageId,snapshotUri:this.originalURI,original:this._originalContent,current:"",state:this.state.get(),telemetryInfo:this._telemetryInfo,isDeleted:!0}}async restoreFromSnapshot(e,t=!0){this._stateObs.set(e.state,void 0),t&&e.current!==""&&await this._fileService.writeFile(this.modifiedURI,qe.fromString(e.current))}async resetToInitialContent(){await this._fileService.writeFile(this.modifiedURI,qe.fromString(this._originalContent))}resetEditTrackerToInitialContent(){return Promise.resolve()}async _areOriginalAndModifiedIdentical(){return this._originalContent===""}_createUndoRedoElement(e){return{type:0,resource:this.modifiedURI,label:"Chat File Deletion",code:"chat.delete",undo:async()=>{await this._fileService.writeFile(this.modifiedURI,qe.fromString(this._originalContent))},redo:async()=>{await this._fileService.del(this.modifiedURI,{useTrash:!1})}}}async acceptAgentEdits(e,t,o,n){Gi(r=>{this._waitsForLastEdits.set(!o,r),this._stateObs.set(0,r),o&&(this._resetEditsState(r),this._rewriteRatioObs.set(1,r))})}async _doAccept(){this._multiDiffEntryDelegate.collapse(void 0)}async _doReject(){await this._fileService.writeFile(this.modifiedURI,qe.fromString(this._originalContent)),this._multiDiffEntryDelegate.collapse(void 0)}_createEditorIntegration(e){return{currentIndex:Me(this,0),reveal:()=>{},next:()=>!1,previous:()=>!1,enableAccessibleDiffView:()=>{},acceptNearestChange:async()=>{},rejectNearestChange:async()=>{},toggleDiff:async()=>{},dispose:()=>{}}}async computeEditsFromSnapshots(e,t){return[]}async save(){}async revertToDisk(){}};OQ=I([m(5,Tt),m(6,_t),m(7,B),m(8,gr),m(9,mi),m(10,fe),m(11,Ml),m(12,F),m(13,xS)],OQ);function pCo(a,i,e){let t=Mwt(a,e);if(!t)return!1;let o=t.getOriginalEditor().getModel(),n=t.getModifiedEditor().getModel();return Qe(o?.uri,i.originalURI)&&Qe(n?.uri,i.modifiedURI)}var fAi=class{constructor(){this._free=new qs}dispose(){Be(this._free)}get(){return this._free.shift()}putBack(i){this._free.push(i)}get free(){return this._free}},hq=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h){this._entry=i;this._editor=e;this._editorService=n;this._accessibilitySignalsService=r;this._explanationModelManager=u;this._chatWidgetService=p;this._viewsService=h;this._currentIndex=Me(this,-1);this.currentIndex=this._currentIndex;this._store=new N;this._diffHunksRenderStore=this._store.add(new N);this._diffHunkWidgetPool=this._store.add(new fAi);this._diffHunkWidgets=[];this._viewZones=[];this._accessibleDiffViewVisible=Me(this,!1);this._diffLineDecorations=e.createDecorationsCollection();let g=gs(e);this._diffLineDecorations=this._editor.createDecorationsCollection(),this._diffVisualDecorations=this._editor.createDecorationsCollection(),this._store.add(new jAe(this._editor,this._chatWidgetService,this._viewsService,this._explanationModelManager,this._entry.modifiedURI));let f=ke(k=>!(!Qe(g.model.read(k)?.uri,t.read(k).modifiedModel.uri)||this._editor.getOption(70)&&!l.invokeFunction(pCo,i,this._editor)));this._store.add(be(k=>{if(!f.read(k)){this._diffLineDecorations.clear();return}let T=[],P=t.read(k);for(let O of P.changes)T.push({range:O.modified.toInclusiveRange()??new z(O.modified.startLineNumber,1,O.modified.startLineNumber,Number.MAX_SAFE_INTEGER),options:hq._diffLineDecorationData});this._diffLineDecorations.set(T)}));let v;this._store.add(be(k=>{if(f.read(k)&&!i.isCurrentlyBeingModifiedBy.read(k)&&v!==i.lastModifyingRequestId&&!t.read(k).identical){v=i.lastModifyingRequestId;let T=e.getPosition()??new ye(1,1),P=this._diffLineDecorations.getRanges(),O=P.findIndex(V=>V.containsPosition(T));if(O<0)for(O=0;O<P.length-1&&!(P[O].endLineNumber>=T.lineNumber);O++);this._currentIndex.set(O,void 0),e.revealRange(P[O])}})),this._store.add(be(k=>{if(!f.read(k)){this._clearDiffRendering();return}if(!i.isCurrentlyBeingModifiedBy.read(k)||o){let T=this._editor.getOption(70);g.getOption(59).read(k),g.getOption(75).read(k);let P=i.reviewMode.read(k),O=t.read(k);this._updateDiffRendering(O,P,T)}}));let b=F1t.bindTo(s);this._store.add(be(k=>{let T=g.positions.read(k)?.at(0);if(!T||!f.read(k)){b.reset();return}let O=t.read(k).changes.find(V=>V.modified.contains(T.lineNumber)||V.modified.isEmpty&&V.modified.startLineNumber===T.lineNumber);if(b.set(!!O),O){let V;O.modified.isEmpty?V=$o.diffLineDeleted:O.original.isEmpty?V=$o.diffLineInserted:V=$o.diffLineModified,this._accessibilitySignalsService.playSignal(V,{source:"chatEditingEditor.cursorPositionChanged"})}})),this._store.add(be(k=>{if(!this._accessibleDiffViewVisible.read(k)||!f.read(k))return;let P=new vAi;e.addOverlayWidget(P),k.store.add(Z(()=>e.removeOverlayWidget(P))),k.store.add(l.createInstance(zO,P.getDomNode(),f,(O,V)=>this._accessibleDiffViewVisible.set(O,V),So(!0),g.layoutInfo.map((O,V)=>O.width),g.layoutInfo.map((O,V)=>O.height),t.map(O=>O.changes.slice()),l.createInstance(bAi,t,e)))}));let S,y=()=>{S!==void 0&&(this._editor.updateOptions(S),S=void 0)};this._store.add(Z(y));let w=ke(this,k=>f.read(k)&&!!i.isCurrentlyBeingModifiedBy.read(k));this._store.add(be(k=>{w.read(k)?(S??={readOnly:this._editor.getOption(104),stickyScroll:this._editor.getOption(131),codeLens:this._editor.getOption(23),guides:this._editor.getOption(22)},this._editor.updateOptions({readOnly:!0,stickyScroll:{enabled:!1},codeLens:!1,guides:{indentation:!1,bracketPairs:!1}})):y()}))}static{this._diffLineDecorationData=mo.register({description:"diff-line-decoration"})}dispose(){this._clear(),this._store.dispose()}_clear(){this._diffLineDecorations.clear(),this._clearDiffRendering(),this._currentIndex.set(-1,void 0)}_clearDiffRendering(){this._editor.changeViewZones(i=>{for(let e of this._viewZones)i.removeZone(e)}),this._viewZones=[],this._diffHunksRenderStore.clear();for(let i of this._diffHunkWidgetPool.free)i.remove();this._diffVisualDecorations.clear()}_updateDiffRendering(i,e,t){let o=mo.createDynamic({...tce,stickiness:1}),n=mo.createDynamic({...ACe,stickiness:1}),r=(v,b)=>mo.createDynamic({description:"chat-editing-decoration",overviewRuler:{color:Yu(v),position:1},minimap:{color:Yu(b),position:2}}),s=r(gJ,ETe),l=r(fJ,TTe),c=r(vJ,_Te);this._diffHunksRenderStore.clear(),this._diffHunkWidgets.length=0;let u=[];this._editor.changeViewZones(v=>{for(let T of this._viewZones)v.removeZone(T);this._viewZones=[];let b=[],S=i.originalModel.mightContainNonBasicASCII(),y=i.originalModel.mightContainRTL(),w=OE.fromEditor(this._editor),k=this._editor.getModel()?.getLineCount();for(let T of i.changes){let P=T.original;i.originalModel.tokenization.forceTokenization(Math.max(1,P.endLineNumberExclusive-1));let O=new NE(P.mapToLineArray($=>i.originalModel.tokenization.getLineTokens($)),[],S,y),V=[];if(e)for(let $ of T.innerChanges||[])V.push(new CE($.originalRange.delta(-(T.original.startLineNumber-1)),jj.className,0)),!($.originalRange.isEmpty()&&$.originalRange.startLineNumber===1&&$.modifiedRange.endLineNumber===k)&&!$.modifiedRange.isEmpty()&&b.push({range:$.modifiedRange,options:o});let H=V.length===1&&V[0].range.isEmpty()&&T.original.startLineNumber===1;T.modified.isEmpty||b.push({range:T.modified.toInclusiveRange(),options:n}),T.original.isEmpty?b.push({range:T.modified.toInclusiveRange(),options:l}):T.modified.isEmpty?b.push({range:new z(T.modified.startLineNumber-1,1,T.modified.startLineNumber,1),options:c}):b.push({range:T.modified.toInclusiveRange(),options:s});let G=0;if(e&&!t){let $=document.createElement("div");$.className="chat-editing-original-zone view-lines line-delete monaco-mouse-cursor-text";let J=lR(O,w,V,$);if(G=J.heightInLines,!H){let ae={afterLineNumber:T.modified.startLineNumber-1,heightInLines:J.heightInLines,domNode:$,ordinal:50002};this._viewZones.push(v.addZone(ae))}}if(e||t){let $=this._diffHunkWidgetPool.get();$?$.update(i,T,this._editor.getModel().getVersionId(),H?0:G):$=this._editor.invokeWithinContext(J=>J.get(F).createInstance(gq,this._editor,i,T,this._editor.getModel().getVersionId(),H?0:G)),this._diffHunksRenderStore.add(Z(()=>{this._diffHunkWidgetPool.putBack($)})),$.layout(T.modified.startLineNumber),this._diffHunkWidgets.push($),u.push({range:T.modified.toInclusiveRange()??new z(T.modified.startLineNumber,1,T.modified.startLineNumber,Number.MAX_SAFE_INTEGER),options:{description:"diff-hunk-widget",stickiness:0}})}}this._diffVisualDecorations.set(t?[]:b)});let p=this._editor.createDecorationsCollection(u);this._diffHunksRenderStore.add(Z(()=>{p.clear()}));for(let v of this._diffHunkWidgetPool.free)v.remove();let h=ui(this._editor.onDidChangeCursorPosition,v=>this._editor.getPosition()),g=ke(v=>{let b=h.read(v);return b?p.getRanges().findIndex(y=>y.containsPosition(b)):-1}),f=v=>{let b=g.get();for(let S=0;S<this._diffHunkWidgets.length;S++){let y=this._diffHunkWidgets[S];y.toggle(y===v||S===b)}};this._diffHunksRenderStore.add(be(v=>{let b=g.read(v),S=this._diffHunkWidgets[b];f(S)})),this._diffHunksRenderStore.add(this._editor.onMouseUp(v=>{if(v.target.type===8){let b=v.target.detail;this._viewZones.findIndex(y=>y===b.viewZoneId)>=0&&(this._editor.setPosition(v.target.position),this._editor.focus())}})),this._diffHunksRenderStore.add(this._editor.onMouseMove(v=>{if(v.target.type===12){let b=v.target.detail,S=this._diffHunkWidgets.find(y=>y.getId()===b);f(S)}else if(v.target.type===8){let b=v.target.detail,S=this._viewZones.findIndex(y=>y===b.viewZoneId);f(this._diffHunkWidgets[S])}else if(v.target.position){let{position:b}=v.target,S=p.getRanges().findIndex(y=>y.containsPosition(b));f(this._diffHunkWidgets[S])}else f(void 0)})),this._diffHunksRenderStore.add(U.any(this._editor.onDidScrollChange,this._editor.onDidLayoutChange)(()=>{for(let v=0;v<this._diffHunkWidgets.length;v++){let b=this._diffHunkWidgets[v],S=p.getRange(v);S?b.layout(S?.startLineNumber):b.dispose()}}))}enableAccessibleDiffView(){this._accessibleDiffViewVisible.set(!0,void 0)}reveal(i,e){let t=this._diffLineDecorations.getRanges().sort((r,s)=>z.compareRangesUsingStarts(r,s)),o=i?0:t.length-1,n=t.at(o);n&&(this._editor.setPosition(n.getStartPosition()),this._editor.revealRange(n),e||this._editor.focus(),this._currentIndex.set(o,void 0))}next(i){return this._reveal(!0,!i)}previous(i){return this._reveal(!1,!i)}_reveal(i,e){let t=this._editor.getPosition();if(!t)return this._currentIndex.set(-1,void 0),!1;let o=this._diffLineDecorations.getRanges().sort((l,c)=>z.compareRangesUsingStarts(l,c));if(o.length===0)return this._currentIndex.set(-1,void 0),!1;let n=-1;for(let l=0;l<o.length;l++){let c=o[l];if(c.containsPosition(t)){n=l+(i?1:-1);break}else if(ye.isBefore(t,c.getStartPosition())){n=i?l:l-1;break}}if(e&&(n<0||n>=o.length))return!1;n=(n+o.length)%o.length,this._currentIndex.set(n,void 0);let r=o[n],s=i?r.getStartPosition():r.getEndPosition();return this._editor.setPosition(s),this._editor.revealPositionInCenter(r.getStartPosition().delta(-1)),this._editor.focus(),!0}_findClosestWidget(){if(!this._editor.hasModel())return;let i=this._editor.getTopForLineNumber(this._editor.getPosition().lineNumber)-this._editor.getScrollTop(),e,t=Number.MAX_VALUE;for(let o of this._diffHunkWidgets){let n=o.getPosition()?.preference?.top;if(n!==void 0){let r=Math.abs(n-i);r<t&&(t=r,e=o)}}return e}async rejectNearestChange(i){i=i??this._findClosestWidget(),i instanceof gq&&(await i.reject(),this.next(!0))}async acceptNearestChange(i){i=i??this._findClosestWidget(),i instanceof gq&&(await i.accept(),this.next(!0))}async toggleDiff(i,e){if(!this._editor.hasModel())return;let t=this._editor.getSelection();if(i instanceof gq){let n=i.getStartLineNumber(),r=n?new ye(n,1):void 0;r&&!t.containsPosition(r)&&(t=ti.fromPositions(r))}let o=this._editor.getOption(70);if(e!==void 0?e:!o){let n=await this._editorService.openEditor({original:{resource:this._entry.originalURI},modified:{resource:this._entry.modifiedURI},options:{selection:t},label:d(6936,null,He(this._entry.modifiedURI))});if(n&&n.input){n.getControl()?.setSelection(t);let r=be(s=>{let l=this._entry.state.read(s);if(l===1||l===2){r.dispose();let c=[];for(let u of this._editorService.getEditors(0))X5(u.editor)&&Qe(u.editor.original.resource,this._entry.originalURI)&&Qe(u.editor.modified.resource,this._entry.modifiedURI)&&c.push(u);this._editorService.closeEditors(c)}})}}else await this._editorService.openEditor({resource:this._entry.modifiedURI,options:{selection:t,selectionRevealType:3}})}};hq=I([m(4,ee),m(5,lr),m(6,X),m(7,F),m(8,ud),m(9,Fhe),m(10,Pt),m(11,$t)],hq);var gq=class{constructor(i,e,t,o,n,r){this._editor=i;this._diffInfo=e;this._change=t;this._versionId=o;this._lineDelta=n;this._id=`diff-change-widget-${gq._idPool++}`;this._store=new N;this._removed=!1;this._domNode=document.createElement("div"),this._domNode.className="chat-diff-change-content-widget";let s=r.createInstance(or,this._domNode,D.ChatEditingEditorHunk,{telemetrySource:"chatEditingEditorHunk",hiddenItemStrategy:-1,toolbarOptions:{primaryGroup:()=>!0},menuOptions:{renderShortTitle:!0,arg:this},actionViewItemProvider:(l,c)=>{let u=l.id==="chatEditor.action.acceptHunk";if(!l.class)return new class extends hs{constructor(){super(void 0,l,{...c,keybindingNotRenderedWithLabel:!0,icon:!1,label:!0})}render(p){super.render(p),u&&this.element?.classList.add("primary")}}}});this._store.add(s),this._store.add(s.actionRunner.onWillRun(l=>i.focus())),this._editor.addOverlayWidget(this)}static{this._idPool=0}update(i,e,t,o){this._diffInfo=i,this._change=e,this._versionId=t,this._lineDelta=o}dispose(){this._store.dispose(),this._editor.removeOverlayWidget(this),this._removed=!0}getId(){return this._id}layout(i){let e=this._editor.getOption(75),{contentLeft:t,contentWidth:o,verticalScrollbarWidth:n}=this._editor.getLayoutInfo(),r=this._editor.getScrollTop();this._position={stackOrdinal:1,preference:{top:this._editor.getTopForLineNumber(i)-r-e*this._lineDelta,left:t+o-(2*n+zl(this._domNode))}},this._removed?(this._removed=!1,this._editor.addOverlayWidget(this)):this._editor.layoutOverlayWidget(this),this._lastStartLineNumber=i}remove(){this._editor.removeOverlayWidget(this),this._removed=!0}toggle(i){this._domNode.classList.toggle("hover",i),this._lastStartLineNumber&&this.layout(this._lastStartLineNumber)}getDomNode(){return this._domNode}getPosition(){return this._position??null}getStartLineNumber(){return this._lastStartLineNumber}async reject(){return this._versionId!==this._editor.getModel()?.getVersionId()?!1:await this._diffInfo.undo(this._change)}async accept(){return this._versionId!==this._editor.getModel()?.getVersionId()?!1:this._diffInfo.keep(this._change)}};gq=I([m(5,F)],gq);var vAi=class{constructor(){this._domNode=document.createElement("div"),this._domNode.className="accessible-diff-view",this._domNode.style.width="100%",this._domNode.style.position="absolute"}getId(){return"chatEdits.accessibleDiffView"}getDomNode(){return this._domNode}getPosition(){return{preference:{top:0,left:0},stackOrdinal:1}}},bAi=class{constructor(i,e){this._documentDiffInfo=i;this._editor=e}getOriginalModel(){return this._documentDiffInfo.get().originalModel}getOriginalOptions(){return this._editor.getOptions()}originalReveal(i){let e=this._documentDiffInfo.get().changes,t=e.findIndex(o=>o.original.intersect(uo.fromRange(i)));t>=0&&(i=e[t].modified.toInclusiveRange()??i),this.modifiedReveal(i)}getModifiedModel(){return this._editor.getModel()}getModifiedOptions(){return this._editor.getOptions()}modifiedReveal(i){i&&(this._editor.revealRange(i),this._editor.setSelection(i)),this._editor.focus()}modifiedSetSelection(i){this._editor.setSelection(i)}modifiedFocus(){this._editor.focus()}getModifiedPosition(){return this._editor.getPosition()??void 0}};var fq=Object.freeze({identical:!0,quitEarly:!1,changes:Object.freeze([]),moves:Object.freeze([])});var PW=class extends x{constructor(e,t,o,n,r,s){super();this.originalModel=e;this.modifiedModel=t;this.state=o;this._editorWorkerService=r;this._accessibilitySignalService=s;this._isEditFromUs=!1;this._allEditsAreFromUs=!0;this._diffOperationIds=0;this._diffInfo=Me(this,fq);this._editDecorationClear=this._register(new Dt(()=>{this._editDecorations=this.modifiedModel.deltaDecorations(this._editDecorations,[])},500));this._editDecorations=[];this._didAcceptOrRejectAllHunks=this._register(new E);this.onDidAcceptOrRejectAllHunks=this._didAcceptOrRejectAllHunks.event;this._didAcceptOrRejectLines=this._register(new E);this.onDidAcceptOrRejectLines=this._didAcceptOrRejectLines.event;this._didUserEditModelFired=!1;this._didUserEditModel=this._register(new E);this.onDidUserEditModel=this._didUserEditModel.event;this._originalToModifiedEdit=ld.empty;this.lineChangeCount=0;this.linesAdded=0;this.linesRemoved=0;this._isExternalEditInProgress=n,this._register(this.modifiedModel.onDidChangeContent(l=>{this._mirrorEdits(l)})),this._register(Z(()=>{this.clearCurrentEditLineDecoration()})),this._register(be(l=>this.updateLineChangeCount(this._diffInfo.read(l)))),e.equalsTextBuffer(t.getTextBuffer())||this._updateDiffInfoSeq()}static{this._lastEditDecorationOptions=mo.register({isWholeLine:!0,description:"chat-last-edit",className:"chat-editing-last-edit-line",marginClassName:"chat-editing-last-edit",overviewRuler:{position:7,color:Yu(Sv)}})}static{this._pendingEditDecorationOptions=mo.register({isWholeLine:!0,description:"chat-pending-edit",className:"chat-editing-pending-edit",minimap:{position:1,color:Yu(pAi)}})}static{this._atomicEditDecorationOptions=mo.register({isWholeLine:!0,description:"chat-atomic-edit",className:"chat-editing-atomic-edit",minimap:{position:1,color:Yu(pAi)}})}get isEditFromUs(){return this._isEditFromUs}get allEditsAreFromUs(){return this._allEditsAreFromUs}get diffInfo(){return this._diffInfo.map(e=>({...e,originalModel:this.originalModel,modifiedModel:this.modifiedModel,keep:t=>this._keepHunk(t),undo:t=>this._undoHunk(t)}))}notifyHunkAction(e,t){t.lineCount>0&&this._didAcceptOrRejectLines.fire({state:e,...t})}updateLineChangeCount(e){this.lineChangeCount=0,this.linesAdded=0,this.linesRemoved=0;for(let t of e.changes){let o=t.modified.endLineNumberExclusive-t.modified.startLineNumber;this.linesAdded+=Math.max(0,o);let n=t.original.endLineNumberExclusive-t.original.startLineNumber;this.linesRemoved+=Math.max(0,n),this.lineChangeCount+=Math.max(o,n)}}clearCurrentEditLineDecoration(){this.modifiedModel.isDisposed()||(this._editDecorations=this.modifiedModel.deltaDecorations(this._editDecorations,[]))}async areOriginalAndModifiedIdentical(){let e=await this._diffOperation;return e?e.identical:!1}async acceptAgentEdits(e,t,o,n){wo(t.every(SE.isTextEdit),"INVALID args, can only handle text edits"),qy(Qe(e,this.modifiedModel.uri)," INVALID args, can only edit THIS document");let r=t.length>0&&o,s=0,l=0,c=this._createEditSource(n);if(r){let p=(await this._editorWorkerService.computeMoreMinimalEdits(this.modifiedModel.uri,t)??t).map(SE.asEditOperation),h=this._applyEdits(p,c);if(h.length>0){let g;for(let f=0;f<h.length;f++){let v=h[f];g?g=z.plusRange(g,v.range):g=z.lift(v.range)}if(g){let f=new Ko,v=j(Re(void 0),"animationend",b=>{b.animationName==="kf-chat-editing-atomic-edit"&&(f.complete(),v.dispose())});this._editDecorations=this.modifiedModel.deltaDecorations(this._editDecorations,[{options:PW._atomicEditDecorationOptions,range:g}]),await Promise.any([f.p,Li(500)]),v.dispose()}}}else{let u=t.map(SE.asEditOperation);s=this._applyEdits(u,c).reduce((g,f)=>Math.max(g,f.range.startLineNumber),0),l=Math.min(1,s/this.modifiedModel.getLineCount());let h=[{options:PW._pendingEditDecorationOptions,range:new z(s+1,1,Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER)}];s>0&&h.push({options:PW._lastEditDecorationOptions,range:new z(s,1,s,Number.MAX_SAFE_INTEGER)}),this._editDecorations=this.modifiedModel.deltaDecorations(this._editDecorations,h)}return o&&(this._updateDiffInfoSeq(),this._editDecorationClear.schedule()),{rewriteRatio:l,maxLineNumber:s}}_createEditSource(e){if(!e)return Wc.unknown({name:"editSessionUndoRedo"});let t=ap(e.session.sessionResource),o=e.session.getRequests().at(-1),n=this.modifiedModel.getLanguageId(),r=e.agent,s=dvt.tryCreate(r?.extensionId.value,r?.extensionVersion);return e.request?.locationData?.type==="editor"?Wc.inlineChatApplyEdit({modelId:o?.modelId,requestId:o?.id,sessionId:t,languageId:n,extensionId:s}):Wc.chatApplyEdits({modelId:o?.modelId,requestId:o?.id,sessionId:t,languageId:n,mode:o?.modeInfo?.modeId,extensionId:s,codeBlockSuggestionId:o?.modeInfo?.applyCodeBlockSuggestionId})}_applyEdits(e,t){if(e.length===0)return[];try{this._isEditFromUs=!0;let o=[];return this.modifiedModel.pushEditOperations(null,e,n=>(o=n,null),void 0,t),o}finally{this._isEditFromUs=!1}}keep(){this.notifyHunkAction("accepted",{linesAdded:this.linesAdded,linesRemoved:this.linesRemoved,lineCount:this.lineChangeCount,hasRemainingEdits:!1}),this.originalModel.setValue(this.modifiedModel.createSnapshot()),this._reset()}undo(){this.notifyHunkAction("rejected",{linesAdded:this.linesAdded,linesRemoved:this.linesRemoved,lineCount:this.lineChangeCount,hasRemainingEdits:!1}),this.modifiedModel.pushStackElement(),this._applyEdits([Hn.replace(this.modifiedModel.getFullModelRange(),this.originalModel.getValue())],Wc.chatUndoEdits()),this.modifiedModel.pushStackElement(),this._reset()}_reset(){this._originalToModifiedEdit=ld.empty,this._diffInfo.set(fq,void 0),this._didUserEditModelFired=!1}async resetDocumentValues(e,t){let o=!1;e!==void 0&&(this.originalModel.setValue(e),o=!0),t!==void 0&&this.modifiedModel.getValue()!==t&&(this.modifiedModel.pushStackElement(),this._applyEdits([Hn.replace(this.modifiedModel.getFullModelRange(),t)],Wc.chatReset()),this.modifiedModel.pushStackElement(),o=!0),o&&await this._updateDiffInfoSeq()}_mirrorEdits(e){let t=eY(e.changes),o=this._isExternalEditInProgress?.();if(this._isEditFromUs||o){let n=this._originalToModifiedEdit,r=t;this._originalToModifiedEdit=n.compose(r),o&&this._updateDiffInfoSeq()}else{let n=this._originalToModifiedEdit,r=t,s=r.tryRebase(n.inverse(this.originalModel.getValue()));if(s===void 0)this._originalToModifiedEdit=n.compose(r);else{let l=A8i(s,this.originalModel);this.originalModel.applyEdits(l),this._originalToModifiedEdit=n.rebaseSkipConflicting(s)}this._allEditsAreFromUs=!1,this._updateDiffInfoSeq(),this._didUserEditModelFired||(this._didUserEditModelFired=!0,this._didUserEditModel.fire())}}async _keepHunk(e){if(!this._diffInfo.get().changes.includes(e))return!1;let t=[];for(let o of e.innerChanges??[]){let n=this.modifiedModel.getValueInRange(o.modifiedRange);t.push(Hn.replace(o.originalRange,n))}return this.originalModel.pushEditOperations(null,t,o=>null),await this._updateDiffInfoSeq("accepted"),this._diffInfo.get().identical&&this._didAcceptOrRejectAllHunks.fire(1),this._accessibilitySignalService.playSignal($o.editsKept,{allowManyInParallel:!0}),!0}async _undoHunk(e){if(!this._diffInfo.get().changes.includes(e))return!1;let t=[];for(let o of e.innerChanges??[]){let n=this.originalModel.getValueInRange(o.originalRange);t.push(Hn.replace(o.modifiedRange,n))}return this.modifiedModel.pushEditOperations(null,t,o=>null),await this._updateDiffInfoSeq("rejected"),this._diffInfo.get().identical&&this._didAcceptOrRejectAllHunks.fire(2),this._accessibilitySignalService.playSignal($o.editsUndone,{allowManyInParallel:!0}),!0}async getDiffInfo(){return this._diffOperation||this._updateDiffInfoSeq(),await this._diffOperation,this._diffInfo.get()}async _updateDiffInfoSeq(e=void 0){let t=++this._diffOperationIds;await Promise.resolve(this._diffOperation);let o=this.lineChangeCount,n=this.linesAdded,r=this.linesRemoved;if(this._diffOperationIds===t){let s=this._updateDiffInfo();if(this._diffOperation=s,await s,e){let l={linesAdded:n-this.linesAdded,linesRemoved:r-this.linesRemoved,lineCount:o-this.lineChangeCount,hasRemainingEdits:this.lineChangeCount>0};this.notifyHunkAction(e,l)}}}hasHunkAt(e){return this._diffInfo.get().changes.some(t=>t.modified.intersectsStrict(uo.fromRangeInclusive(e)))}async _updateDiffInfo(){if(this.originalModel.isDisposed()||this.modifiedModel.isDisposed()||this._store.isDisposed)return;if(this.state.get()!==0)return this._diffInfo.set(fq,void 0),this._originalToModifiedEdit=ld.empty,fq;let e=this.modifiedModel.getVersionId(),t=this.originalModel.getVersionId(),o=await this._editorWorkerService.computeDiff(this.originalModel.uri,this.modifiedModel.uri,{ignoreTrimWhitespace:!1,computeMoves:!1,maxComputationTimeMs:3e3},"advanced");if(!(this.originalModel.isDisposed()||this.modifiedModel.isDisposed()||this._store.isDisposed)&&this.modifiedModel.getVersionId()===e&&this.originalModel.getVersionId()===t){let n=o??fq;return this._diffInfo.set(n,void 0),this._originalToModifiedEdit=N8i(this.originalModel,this.modifiedModel,n.changes),n}}};PW=I([m(4,Qs),m(5,lr)],PW);var _oe=class extends tE{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w){super(e.object.textEditorModel.uri,o,n,p,h,g,v,b,S,y);this._multiDiffEntryDelegate=t;this._textFileService=f;this._editorWorkerService=w;this._docFileEditorModel=this._register(e).object,this.modifiedModel=e.object.textEditorModel,this.originalURI=nL.getFileURI(o.sessionResource,this.entryId,this.modifiedURI.path),this.initialContent=r??this.modifiedModel.getValue();let k=this.originalModel=this._register(l.createModel(Yx(r!==void 0?ITe(r):this.modifiedModel.createSnapshot()),u.createById(this.modifiedModel.getLanguageId()),this.originalURI,!1));this._textModelChangeService=this._register(S.createInstance(PW,this.originalModel,this.modifiedModel,this._stateObs,()=>this._isExternalEditInProgress)),this._register(this._textModelChangeService.onDidAcceptOrRejectAllHunks(P=>{this._stateObs.set(P,void 0),this._notifySessionAction(P===1?"accepted":"rejected")})),this._register(this._textModelChangeService.onDidAcceptOrRejectLines(P=>{this._notifyAction({kind:"chatEditingHunkAction",uri:this.modifiedURI,outcome:P.state,languageId:this.modifiedModel.getLanguageId(),...P})})),(async()=>{let P=await c.createModelReference(k.uri);if(this._store.isDisposed){P.dispose();return}this._register(P)})(),this._register(this._textModelChangeService.onDidUserEditModel(()=>{this._userEditScheduler.schedule();let P=this.modifiedModel.getValue()===this.initialContent;this._stateObs.get()===0&&P&&this._stateObs.set(2,void 0)}));let T=this._register(new me);this._register(be(P=>{if(this._waitsForLastEdits.read(P)){let V=this._lastModifyingResponseObs.read(P),H=V&&V.session.getRequests().find(G=>G.id===V.requestId);T.value=s.installResourceFilter(this.modifiedURI,H?.message.text||d(6989,null))}else T.clear()}))}get changesCount(){return this._textModelChangeService.diffInfo.map(e=>e.changes.length)}get diffInfo(){return this._textModelChangeService.diffInfo}get linesAdded(){return this._textModelChangeService.diffInfo.map(e=>{let t=0;for(let o of e.changes)t+=Math.max(0,o.modified.endLineNumberExclusive-o.modified.startLineNumber);return t})}get linesRemoved(){return this._textModelChangeService.diffInfo.map(e=>{let t=0;for(let o of e.changes)t+=Math.max(0,o.original.endLineNumberExclusive-o.original.startLineNumber);return t})}getDiffInfo(){return this._textModelChangeService.getDiffInfo()}equalsSnapshot(e){return!!e&&Qe(this.modifiedURI,e.resource)&&this.modifiedModel.getLanguageId()===e.languageId&&this.originalModel.getValue()===e.original&&this.modifiedModel.getValue()===e.current&&this.state.get()===e.state}createSnapshot(e,t,o){return{resource:this.modifiedURI,languageId:this.modifiedModel.getLanguageId(),snapshotUri:mq.getSnapshotFileURI(e,t,o,this.modifiedURI.path),original:this.originalModel.getValue(),current:this.modifiedModel.getValue(),state:this.state.get(),telemetryInfo:this._telemetryInfo}}getCurrentContents(){return this.modifiedModel.getValue()}async restoreFromSnapshot(e,t=!0){this._stateObs.set(e.state,void 0),await this._textModelChangeService.resetDocumentValues(e.original,t?e.current:void 0)}async resetToInitialContent(){await this._textModelChangeService.resetDocumentValues(void 0,this.initialContent)}async resetEditTrackerToInitialContent(){await this._textModelChangeService.resetDocumentValues(this.initialContent,void 0)}async _areOriginalAndModifiedIdentical(){return this._textModelChangeService.areOriginalAndModifiedIdentical()}_resetEditsState(e){super._resetEditsState(e),this._textModelChangeService.clearCurrentEditLineDecoration()}_createUndoRedoElement(e){let t=e.session.getRequests().find(n=>n.id===e.requestId),o=t?.message.text?d(6987,null,t.message.text):d(6988,null);return new oR(o,"chat.edit",this.modifiedModel,null)}async acceptAgentEdits(e,t,o,n){let r=await this._textModelChangeService.acceptAgentEdits(e,t,o,n);Gi(s=>{this._waitsForLastEdits.set(!o,s),this._stateObs.set(0,s),o?(this._resetEditsState(s),this._rewriteRatioObs.set(1,s)):this._rewriteRatioObs.set(r.rewriteRatio,s)}),o&&this._shouldAutoSave()&&await this._textFileService.save(this.modifiedModel.uri,{reason:2,skipSaveParticipants:!0})}async _doAccept(){if(this._textModelChangeService.keep(),this._multiDiffEntryDelegate.collapse(void 0),!this._fileConfigService.getAutoSaveConfiguration(this.modifiedURI).autoSave||!this._textFileService.isDirty(this.modifiedURI))try{await this._textFileService.save(this.modifiedURI,{reason:1,force:!0,ignoreErrorHandler:!0})}catch{}}async _doReject(){this.createdInRequestId===this._telemetryInfo.requestId?(y9e(this._docFileEditorModel)&&(await this._docFileEditorModel.revert({soft:!0}),await this._fileService.del(this.modifiedURI).catch(e=>{})),this._onDidDelete.fire()):(this._textModelChangeService.undo(),this._textModelChangeService.allEditsAreFromUs&&y9e(this._docFileEditorModel)&&this._shouldAutoSave()&&await this._docFileEditorModel.save({reason:1,skipSaveParticipants:!0}),this._multiDiffEntryDelegate.collapse(void 0))}_createEditorIntegration(e){let t=ha(e.getControl());wo(t);let o=this._textModelChangeService.diffInfo;return this._instantiationService.createInstance(hq,this,t,o,!1)}_shouldAutoSave(){return this.modifiedURI.scheme!==Q.untitled}async computeEditsFromSnapshots(e,t){let o=await this._editorWorkerService.computeStringEditFromDiff(e,t,{maxComputationTimeMs:5e3},"advanced");return Vp.fromStringEdit(o,new jS(e)).replacements.slice()}async save(){this.modifiedModel.uri.scheme!==Q.untitled&&this._textFileService.isDirty(this.modifiedModel.uri)&&await this._textFileService.save(this.modifiedModel.uri,{reason:1,skipSaveParticipants:!0})}async revertToDisk(){if(this.modifiedModel.uri.scheme===Q.untitled)return;let e=this._textFileService.files.get(this.modifiedModel.uri);e&&!e.isDisposed()&&await e.revert({soft:!1})}};_oe=I([m(5,oa),m(6,Tt),m(7,Bt),m(8,_t),m(9,B),m(10,gr),m(11,mi),m(12,Uo),m(13,fe),m(14,Ml),m(15,F),m(16,xS),m(17,Qs)],_oe);var BWe=class{constructor(i,e){this.notebook=i;this._notebookService=e;this.textEdits=[]}acceptTextEdits(i){i.length&&this.textEdits.push(...i)}async generateEdits(){if(this.notebook.cells.length)return console.error("Notebook edits not generated as notebook already has cells"),[];let i=this.generateContent();if(!i)return[];let e=[];try{let{serializer:t}=await this._notebookService.withNotebookDataProvider(this.notebook.viewType),o=await t.dataToNotebook(qe.fromString(i));for(let n=0;n<o.cells.length;n++)e.push({editType:1,index:n,count:0,cells:[o.cells[n]]})}catch(t){return console.error(`Failed to generate notebook edits from text edits ${i}`,t),[]}return e}generateContent(){try{return Bln(this.textEdits)}catch(i){return console.error("Failed to generate content from text edits",i),""}}};BWe=I([m(1,bn)],BWe);function Bln(a){let i="";for(let e of a)i=i.slice(0,e.range.startColumn)+e.text+i.slice(e.range.endColumn);return i}var HWe=class extends x{constructor(e,t,o,n,r,s,l,c){super();this.notebookUri=e;this.cell=t;this.modifiedModel=o;this.originalModel=n;this.notebookEditorService=l;this.instantiationService=c;this._maxModifiedLineNumber=Me(this,0);this.maxModifiedLineNumber=this._maxModifiedLineNumber;this._stateObs=Me(this,0);this.state=this._stateObs;this.initialContent=this.originalModel.getValue(),this._register(s),this._textModelChangeService=this._register(this.instantiationService.createInstance(PW,this.originalModel,this.modifiedModel,this.state,r)),this._register(this._textModelChangeService.onDidAcceptOrRejectAllHunks(u=>{this.revertMarkdownPreviewState(),this._stateObs.set(u,void 0)})),this._register(this._textModelChangeService.onDidUserEditModel(()=>{let u=this.modifiedModel.getValue()===this.initialContent;this._stateObs.get()===0&&u&&this._stateObs.set(2,void 0)}))}get isDisposed(){return this._store.isDisposed}get isEditFromUs(){return this._textModelChangeService.isEditFromUs}get allEditsAreFromUs(){return this._textModelChangeService.allEditsAreFromUs}get diffInfo(){return this._textModelChangeService.diffInfo}clearCurrentEditLineDecoration(){this.modifiedModel.isDisposed()||this._textModelChangeService.clearCurrentEditLineDecoration()}async acceptAgentEdits(e,t,o){let{maxLineNumber:n}=await this._textModelChangeService.acceptAgentEdits(this.modifiedModel.uri,e,t,o);Gi(r=>{t?this._maxModifiedLineNumber.set(0,r):(this._stateObs.set(0,r),this._maxModifiedLineNumber.set(n,r))})}revertMarkdownPreviewState(){if(this.cell.cellKind!==1)return;let e=this.notebookEditorService.retrieveExistingWidgetFromURI(this.notebookUri)?.value;if(e){let t=e.getCellByHandle(this.cell.handle);t?.getEditState()===1&&(t.editStateSource==="chatEdit"||t.editStateSource==="chatEditNavigation")&&t?.updateEditState(0,"chatEdit")}}async keep(e){return this._textModelChangeService.diffInfo.get().keep(e)}async undo(e){return this._textModelChangeService.diffInfo.get().undo(e)}};HWe=I([m(6,Gc),m(7,F)],HWe);var Nqt=class extends x{constructor(e){super();this.notebookEditor=e;this.decorators=this._register(new N)}apply(e){let t=this.notebookEditor.textModel;if(!t)return;let o=[];for(let r of e)if(r.type==="modified"){let s=t.cells[r.modifiedCellIndex];o.push(s)}let n=this.notebookEditor.deltaCellDecorations([],o.map(r=>({handle:r.handle,options:{overviewRuler:{color:gJ,modelRanges:[],includeOutput:!0,position:7}}})));this.clear(),this.decorators.add(Z(()=>{this.notebookEditor.isDisposed||this.notebookEditor.deltaCellDecorations(n,[])}))}clear(){this.decorators.clear()}};function est(a){return a.reduce((i,e)=>{let t=e.diff.get();if(t.identical)return i;switch(e.type){case"delete":return i+1;case"insert":return i+1;case"modified":return i+t.changes.length;default:return i}},0)}function rL(a){let i=new Map;return a.forEach((e,t)=>i.set(e,t)),[...a].sort((e,t)=>{if((e.type==="unchanged"||e.type==="modified")&&(t.type==="unchanged"||t.type==="modified"))return e.modifiedCellIndex-t.modifiedCellIndex;if(e.type==="delete"&&t.type==="delete")return e.originalCellIndex-t.originalCellIndex;if(e.type==="insert"&&t.type==="insert")return e.modifiedCellIndex-t.modifiedCellIndex;if(e.type==="delete"&&t.type==="insert"||e.type==="insert"&&t.type==="delete")return i.get(e)-i.get(t);if(e.type==="delete"&&t.type!=="insert"||e.type!=="insert"&&t.type==="delete")return e.originalCellIndex-t.originalCellIndex;let o=e.type==="delete"?e.originalCellIndex:(e.type==="insert",e.modifiedCellIndex),n=t.type==="delete"?t.originalCellIndex:(t.type==="insert",t.modifiedCellIndex);return o-n})}var UWe=class extends x{constructor(e,t,o,n){super();this.notebookEditor=e;this.notebookModel=t;this.instantiationService=o;this.accessibilitySignalService=n;this._timeout=void 0;this.overlayDisposables=this._register(new N)}decorate(e){this._timeout!==void 0&&clearTimeout(this._timeout),this._timeout=setTimeout(()=>{this._timeout=void 0,this.createMarkdownPreviewToolbars(e)},100)}createMarkdownPreviewToolbars(e){this.overlayDisposables.clear();let t=this.accessibilitySignalService,o=this.notebookEditor;for(let n of e){let r=this.getCellViewModel(n);if(!r||r.cellKind!==1)continue;let s=document.createElement("div"),l;o.changeCellOverlays(g=>{s.style.right="44px",l=g.addOverlay({cell:r,domNode:s})});let c=()=>{o.changeCellOverlays(g=>{l&&g.removeOverlay(l)})};this.overlayDisposables.add({dispose:c});let u=document.createElement("div");s.appendChild(u),u.className="chat-diff-change-content-widget",u.classList.add("hover"),u.style.position="relative",u.style.top="18px",u.style.zIndex="10",u.style.display=r.getEditState()===1?"none":"block",this.overlayDisposables.add(r.onDidChangeState(g=>{g.editStateChanged&&(r.getEditState()===1?u.style.display="none":u.style.display="block")}));let h=this._register(this.instantiationService.createChild(new _o([X,this.notebookEditor.scopedContextKeyService]))).createInstance(or,u,D.ChatEditingEditorHunk,{telemetrySource:"chatEditingNotebookHunk",hiddenItemStrategy:-1,toolbarOptions:{primaryGroup:()=>!0},menuOptions:{renderShortTitle:!0,arg:{async accept(){t.playSignal($o.editsKept,{allowManyInParallel:!0}),c(),h.dispose();for(let g of n.diff.get().changes)await n.keep(g);return!0},async reject(){t.playSignal($o.editsUndone,{allowManyInParallel:!0}),c(),h.dispose();for(let g of n.diff.get().changes)await n.undo(g);return!0}}},actionViewItemProvider:(g,f)=>{if(!g.class)return new class extends hs{constructor(){super(void 0,g,{...f,keybindingNotRenderedWithLabel:!0,icon:!1,label:!0})}}}});this.overlayDisposables.add(h)}}getCellViewModel(e){if(e.type==="delete"||e.modifiedCellIndex===void 0)return;let t=this.notebookModel.cells[e.modifiedCellIndex];return this.notebookEditor.getViewModel()?.viewCells.find(n=>n.handle===t.handle)}dispose(){super.dispose(),this._timeout!==void 0&&clearTimeout(this._timeout)}};UWe=I([m(2,F),m(3,lr)],UWe);var zWe=class extends x{constructor(e,t,o,n,r,s){super();this.instantiationService=s;let l=Jn(t);wo(l),this.notebookEditor=l,this.integration=this.instantiationService.createInstance(KWe,e,l,o,n,r),this._register(t.onDidChangeControl(()=>{let c=Jn(t);c&&c!==this.notebookEditor&&(this.notebookEditor=c,this.integration.dispose(),this.integration=this.instantiationService.createInstance(KWe,e,c,o,n,r))}))}get currentIndex(){return this.integration.currentIndex}reveal(e){return this.integration.reveal(e)}next(e){return this.integration.next(e)}previous(e){return this.integration.previous(e)}enableAccessibleDiffView(){this.integration.enableAccessibleDiffView()}acceptNearestChange(e){return this.integration.acceptNearestChange(e)}rejectNearestChange(e){return this.integration.rejectNearestChange(e)}toggleDiff(e,t){return this.integration.toggleDiff(e,t)}dispose(){this.integration.dispose(),super.dispose()}};zWe=I([m(5,F)],zWe);var KWe=class extends x{constructor(e,t,o,n,r,s,l,c,u,p){super();this._entry=e;this.notebookEditor=t;this.notebookModel=o;this.cellChanges=r;this.instantiationService=s;this._editorService=l;this.accessibilitySignalService=u;this.logService=p;this._currentIndex=Me(this,-1);this.currentIndex=this._currentIndex;this.cellEditorIntegrations=new Map;this.markdownEditState=Me(this,"");this.markupCellListeners=new Map;this.sortedCellChanges=[];this.changeIndexComputer=new C_(new Uint32Array(0));let h=gP(ui(t.onDidChangeVisibleRanges,()=>t.visibleRanges),50);this._register(Z(()=>{this.markupCellListeners.forEach(y=>y.dispose())}));let g,f=e.isCurrentlyBeingModifiedBy.map(y=>!!y);this._register(be(y=>{let w=f.read(y),k=c.retrieveExistingWidgetFromURI(e.modifiedURI)?.value;if(k){if(w)g??=k.isReadOnly,k.setOptions({isReadOnly:!0});else if(g===!1){k.setOptions({isReadOnly:!1});let T=setTimeout(()=>{k.setOptions({isReadOnly:!0}),k.setOptions({isReadOnly:!1}),P.dispose()},100),P=Z(()=>clearTimeout(T));y.store.add(P)}}}));let v;this._store.add(be(y=>{!e.isCurrentlyBeingModifiedBy.read(y)&&!e.isProcessingResponse.read(y)&&v!==e.lastModifyingRequestId&&r.read(y).some(w=>w.type!=="unchanged"&&!w.diff.read(y).identical)&&(v=e.lastModifyingRequestId,this.sortedCellChanges.find(k=>{if(k.type==="unchanged")return!1;let T=k.modifiedCellIndex??k.originalCellIndex;return this.notebookEditor.visibleRanges.some(P=>T>=P.start&&T<P.end)})||this.reveal(!0))})),this._register(be(y=>{this.sortedCellChanges=rL(r.read(y));let w=[];for(let k of this.sortedCellChanges)w.push(k.type==="insert"||k.type==="delete"?1:k.type==="modified"?k.diff.read(y).changes.length:0);this.changeIndexComputer=new C_(new Uint32Array(w)),this.changeIndexComputer.getTotalSum()===0&&this.revertMarkupCellState()})),this._register(be(y=>{if(this.notebookEditor.textModel!==this.notebookModel)return;let k=rL(r.read(y)).filter(P=>P.type!=="delete");if(h.read(y),!k.length){this.cellEditorIntegrations.forEach(({diff:P})=>{P.set({...P.read(void 0),...fq},void 0)});return}this.markdownEditState.read(y);let T=new Set;k.forEach(P=>{if(P.modifiedCellIndex===void 0||P.modifiedCellIndex>=o.cells.length)return;let O=o.cells[P.modifiedCellIndex],V=t.codeEditors.find(([ae])=>ae.handle===o.cells[P.modifiedCellIndex].handle)?.[1],H=P.modifiedModel.promiseResult.read(y)?.data,G=P.originalModel.promiseResult.read(y)?.data;if(!O||!G||!H)return;if(O.cellKind===1&&!this.markupCellListeners.has(O.handle)){let ae=this.notebookEditor.getViewModel()?.viewCells.find(he=>he.handle===O.handle);if(ae){let he=ae.onDidChangeState(oe=>{oe.editStateChanged&&setTimeout(()=>this.markdownEditState.set(ae.handle+"-"+ae.getEditState(),void 0),0)});this.markupCellListeners.set(O.handle,he)}}if(!V)return;let $={...P.diff.read(y),modifiedModel:H,originalModel:G,keep:P.keep,undo:P.undo};T.add(O);let J=this.cellEditorIntegrations.get(O);if(J)Hln(J.diff.read(void 0),$)||J.diff.set($,void 0);else{let ae=Me(`diff${O.handle}`,$),he=this.instantiationService.createInstance(hq,e,V,ae,!0);this.cellEditorIntegrations.set(O,{integration:he,diff:ae}),this._register(he),this._register(V.onDidDispose(()=>{this.cellEditorIntegrations.get(O)?.integration.dispose(),this.cellEditorIntegrations.delete(O)})),this._register(V.onDidChangeModel(()=>{V.getModel()!==O.textModel&&(this.cellEditorIntegrations.get(O)?.integration.dispose(),this.cellEditorIntegrations.delete(O))}))}}),this.cellEditorIntegrations.forEach((P,O)=>{T.has(O)||(P.integration.dispose(),this.cellEditorIntegrations.delete(O))})}));let b=h.map(y=>y.length>0),S=gP(r,10);this._register(be(y=>{if(this.notebookEditor.textModel!==this.notebookModel||!b.read(y)||!this.notebookEditor.getViewModel())return;let w=S.read(y).filter(T=>T.type==="insert"?!T.diff.read(y).identical:!0),k=w.filter(T=>T.type==="modified");this.createDecorators(),w.every(T=>T.type==="insert")?(this.insertedCellDecorator?.apply([]),this.modifiedCellDecorator?.apply([]),this.deletedCellDecorator?.apply([],n),this.overlayToolbarDecorator?.decorate([])):(this.insertedCellDecorator?.apply(w),this.modifiedCellDecorator?.apply(k),this.deletedCellDecorator?.apply(w,n),this.overlayToolbarDecorator?.decorate(w.filter(T=>T.type==="insert"||T.type==="modified")))}))}getCurrentChange(){let e=Math.min(this._currentIndex.get(),this.changeIndexComputer.getTotalSum()-1),t=this.changeIndexComputer.getIndexOf(e),o=this.sortedCellChanges[t.index];return o?{change:o,index:t.remainder}:void 0}updateCurrentIndex(e,t=0){let o=this.sortedCellChanges.indexOf(e),n=this.changeIndexComputer.getPrefixSum(o-1),r=Math.min(n+t,this.changeIndexComputer.getTotalSum()-1);this._currentIndex.set(r,void 0)}createDecorators(){let e=this.cellChanges.get(),t=this.accessibilitySignalService;this.insertedCellDecorator??=this._register(this.instantiationService.createInstance(EAe,this.notebookEditor)),this.modifiedCellDecorator??=this._register(this.instantiationService.createInstance(Nqt,this.notebookEditor)),this.overlayToolbarDecorator??=this._register(this.instantiationService.createInstance(UWe,this.notebookEditor,this.notebookModel)),this.deletedCellDecorator&&(this._store.delete(this.deletedCellDecorator),this.deletedCellDecorator.dispose()),this.deletedCellDecorator=this._register(this.instantiationService.createInstance(Lte,this.notebookEditor,{className:"chat-diff-change-content-widget",telemetrySource:"chatEditingNotebookHunk",menuId:D.ChatEditingEditorHunk,actionViewItemProvider:(o,n)=>{if(!o.class)return new class extends hs{constructor(){super(void 0,o,{...n,keybindingNotRenderedWithLabel:!0,icon:!1,label:!0})}}},argFactory:o=>({accept(){let n=e.find(r=>r.type==="delete"&&r.originalCellIndex===o);return n?n.keep(n.diff.get().changes[0]):(t.playSignal($o.editsKept,{allowManyInParallel:!0}),Promise.resolve(!0))},reject(){let n=e.find(r=>r.type==="delete"&&r.originalCellIndex===o);return n?n.undo(n.diff.get().changes[0]):(t.playSignal($o.editsUndone,{allowManyInParallel:!0}),Promise.resolve(!0))}})}))}getCell(e){let t=this.notebookModel.cells[e];return this.cellEditorIntegrations.get(t)?.integration}reveal(e){let t=this.sortedCellChanges.filter(n=>n.type!=="unchanged");if(!t.length)return;let o=e?t[0]:t[t.length-1];this._revealFirstOrLast(o,e)}_revealFirstOrLast(e,t=!0){switch(e.type){case"insert":case"modified":{this.blur(this.getCurrentChange()?.change);let o=t||e.type==="insert"?0:e.diff.get().changes.length-1;return this._revealChange(e,o)}case"delete":return this.blur(this.getCurrentChange()?.change),this.deletedCellDecorator?.reveal(e.originalCellIndex),this.updateCurrentIndex(e),!0;default:break}return!1}_revealChange(e,t){switch(e.type){case"insert":case"modified":{let o=e.diff.get().changes[t],n=this.getCellViewModel(e);if(n)return this.updateCurrentIndex(e,t),this.revealChangeInView(n,o?.modified,e).catch(r=>{this.logService.warn(`Error revealing change in view: ${r}`)}),!0;break}case"delete":return this.updateCurrentIndex(e),this.deletedCellDecorator?.reveal(e.originalCellIndex),!0;default:break}return!1}getCellViewModel(e){if(e.type==="delete"||e.modifiedCellIndex===void 0||e.modifiedCellIndex>=this.notebookModel.cells.length)return;let t=this.notebookModel.cells[e.modifiedCellIndex];return this.notebookEditor.getViewModel()?.viewCells.find(n=>n.handle===t.handle)}async revealChangeInView(e,t,o){let n=t??new uo(0,0);o.type==="modified"&&e.cellKind===1&&e.getEditState()===0&&e.updateEditState(1,"chatEditNavigation");let r=e.cellKind===2||o.type==="modified"?"editor":"container";await this.notebookEditor.focusNotebookCell(e,r,{focusEditorLine:n.startLineNumber}),await this.notebookEditor.revealRangeInCenterAsync(e,new z(n.startLineNumber,0,n.endLineNumberExclusive,0))}revertMarkupCellState(){for(let e of this.sortedCellChanges){let t=this.getCellViewModel(e);t?.cellKind===1&&t.getEditState()===1&&(t.editStateSource==="chatEditNavigation"||t.editStateSource==="chatEdit")&&t.updateEditState(0,"chatEdit")}}blur(e){if(!e)return;let t=this.getCellViewModel(e);t?.cellKind===1&&t.getEditState()===1&&t.editStateSource==="chatEditNavigation"&&t.updateEditState(0,"chatEditNavigation")}next(e){let t=this.sortedCellChanges.filter(n=>n.type!=="unchanged"),o=this.getCurrentChange();if(!o){let n=t[0];return n?this._revealFirstOrLast(n):!1}switch(o.change.type){case"modified":{let n=this.getCell(o.change.modifiedCellIndex);if(n&&n.next(!1))return this.updateCurrentIndex(o.change,n.currentIndex.get()),!0;let r=o.index>=mCo(o.change),s=r?0:o.index+1,l=r?t[t.indexOf(o.change)+1]:o.change;if(l&&(r&&this.blur(o.change),this._revealChange(l,s)))return!0}break;case"insert":case"delete":{this.blur(o.change);let n=t[t.indexOf(o.change)+1];if(n&&this._revealFirstOrLast(n,!0))return!0}break;default:break}if(e){let n=t[0];if(n)return this._revealFirstOrLast(n,!0)}return!1}previous(e){let t=this.sortedCellChanges.filter(n=>n.type!=="unchanged"),o=this.getCurrentChange();if(!o){let n=t[t.length-1];return n?this._revealFirstOrLast(n,!1):!1}switch(o.change.type){case"modified":{let n=this.getCell(o.change.modifiedCellIndex);if(n&&n.previous(!1))return this.updateCurrentIndex(o.change,n.currentIndex.get()),!0;let r=o.index<=0,s=r?t[t.indexOf(o.change)-1]:o.change;if(s){let l=r?mCo(s):o.index-1;if(r&&this.blur(o.change),this._revealChange(s,l))return!0}}break;case"insert":case"delete":{this.blur(o.change);let n=t[t.indexOf(o.change)-1];if(n&&this._revealFirstOrLast(n,!1))return!0}break;default:break}if(e){let n=t[t.length-1];if(n)return this._revealFirstOrLast(n,!1)}return!1}enableAccessibleDiffView(){let e=this.notebookEditor.getActiveCell()?.model;e&&this.cellEditorIntegrations.get(e)?.integration?.enableAccessibleDiffView()}getfocusedIntegration(){let e=this.notebookEditor.getSelectionViewModels()[0];if(e)return this.cellEditorIntegrations.get(e.model)?.integration}async acceptNearestChange(e){if(e)await e.accept();else{let t=this.getCurrentChange(),o=this.getfocusedIntegration();t&&!o||t?.change.type==="delete"?t.change.keep(t?.change.diff.get().changes[t.index]):o&&await o.acceptNearestChange(),this._currentIndex.set(this._currentIndex.get()-1,void 0),this.next(!0)}}async rejectNearestChange(e){if(e)await e.reject();else{let t=this.getCurrentChange(),o=this.getfocusedIntegration();t&&!o||t?.change.type==="delete"?t.change.undo(t.change.diff.get().changes[t.index]):o&&await o.rejectNearestChange(),this._currentIndex.set(this._currentIndex.get()-1,void 0),this.next(!0)}}async toggleDiff(e,t){let o={original:{resource:this._entry.originalURI},modified:{resource:this._entry.modifiedURI},label:d(6997,null,He(this._entry.modifiedURI))};await this._editorService.openEditor(o)}};KWe=I([m(5,F),m(6,ee),m(7,Gc),m(8,lr),m(9,se)],KWe);var Oqt=class extends x{constructor(e,t){super();this.notebookDiffEditor=e;this.cellChanges=t;this._currentIndex=Me(this,-1);this.currentIndex=this._currentIndex;this._store.add(be(o=>{let n=e.currentChangedIndex.read(o),r=t.read(o).filter(s=>!s.diff.read(o).identical);if(r.length&&n>=0&&n<r.length){let s=est(r.slice(0,n+1));this._currentIndex.set(s-1,void 0)}else this._currentIndex.set(-1,void 0)}))}reveal(e){rL(this.cellChanges.get().filter(o=>o.type!=="unchanged")).length&&(e?this.notebookDiffEditor.firstChange():this.notebookDiffEditor.lastChange())}next(e){let t=this.cellChanges.get().filter(o=>!o.diff.get().identical).length;return this.notebookDiffEditor.currentChangedIndex.get()===t-1?!1:(this.notebookDiffEditor.nextChange(),!0)}previous(e){let t=this.cellChanges.get().filter(o=>!o.diff.get().identical).length;return this.notebookDiffEditor.currentChangedIndex.get()===t-1?!1:(this.notebookDiffEditor.nextChange(),!0)}enableAccessibleDiffView(){}async acceptNearestChange(e){await e.accept(),this.next(!0)}async rejectNearestChange(e){await e.reject(),this.next(!0)}async toggleDiff(e,t){}};function Hln(a,i){return!(a.changes!==i.changes||a.identical!==i.identical||a.moves!==i.moves||a.originalModel!==i.originalModel||a.modifiedModel!==i.modifiedModel||a.keep!==i.keep||a.undo!==i.undo||a.quitEarly!==i.quitEarly)}function mCo(a){return a.type==="modified"?a.diff.get().changes.length-1:0}var wfe=class extends x{constructor(e,t){super();this.fileService=e;let o=t.createInstance(AW);this._register(this.fileService.registerProvider(hAi,o))}static{this.ID="chatEditingNotebookFileSystemProviderContribution"}};wfe=I([m(0,fe),m(1,F)],wfe);var AW=class{constructor(i){this._chatEditingService=i;this.capabilities=18434;this.onDidChangeCapabilities=U.None;this.onDidChangeFile=U.None}static{this.registeredFiles=new gt}static registerFile(i,e){return AW.registeredFiles.set(i,e),{dispose(){AW.registeredFiles.get(i)===e&&AW.registeredFiles.delete(i)}}}watch(i,e){return x.None}async stat(i){return{type:1,ctime:0,mtime:0,size:0}}mkdir(i){throw new Error("Method not implemented1.")}readdir(i){throw new Error("Method not implemented2.")}delete(i,e){throw new Error("Method not implemented3.")}rename(i,e,t){throw new Error("Method not implemented4.")}copy(i,e,t){throw new Error("Method not implemented5.")}async readFile(i){let e=AW.registeredFiles.get(i);if(e)return e.buffer;let t=JSON.parse(i.query);if(!t.viewType)throw new Error("File not found, viewType not found");let o=this._chatEditingService.getEditingSession(Jr.forSession(t.sessionId));if(!o||!t.requestId)throw new Error("File not found, session not found");let n=await o.getSnapshotContents(t.requestId,i,t.undoStop||void 0);if(!n)throw new Error("File not found, snapshot not found");return n.buffer}writeFile(i,e,t){throw new Error("Method not implemented7.")}readFileStream(i,e,t){throw new Error("Method not implemented8.")}open(i,e){throw new Error("Method not implemented9.")}close(i){throw new Error("Method not implemented10.")}read(i,e,t,o,n){throw new Error("Method not implemented11.")}write(i,e,t,o,n){throw new Error("Method not implemented12.")}cloneFile(i,e){throw new Error("Method not implemented13.")}};AW=I([m(0,ud)],AW);function hCo(a,i,e,t,o){i=rL(i);let n=i.findIndex(s=>s.originalCellIndex===a);if(n===-1)return i;let r=-1;for(let s=0;s<i.length;s++){let l=i[s];if(s<n){r=Math.max(r,l.modifiedCellIndex??r);continue}if(s===n){let c={cells:[e],count:0,editType:1,index:r+1};t([c],!0,void 0,()=>{},void 0,!0),i[s]=o(r+1,a);continue}else typeof l.modifiedCellIndex=="number"&&(l.modifiedCellIndex++,i[s]={...l})}return i}function gCo(a,i,e){if(a===-1)return i;i=rL(i).filter(o=>!(o.type==="insert"&&o.modifiedCellIndex===a)).map(o=>o.type==="insert"&&o.modifiedCellIndex===a?o:o.type!=="delete"&&o.modifiedCellIndex>a?{...o,modifiedCellIndex:o.modifiedCellIndex-1}:o);let t={cells:[],count:1,editType:1,index:a};return e([t],!0,void 0,()=>{},void 0,!0),i}function fCo(a,i,e,t,o){if(i=rL(i),a===-1)return i;let n=i.findIndex(s=>s.modifiedCellIndex===a);if(n===-1)return i;let r=-1;for(let s=0;s<i.length;s++){let l=i[s];if(s<n){r=Math.max(r,l.originalCellIndex??r);continue}if(s===n){let c={cells:[e],count:0,editType:1,index:r+1};t([c],!0,void 0,()=>{},void 0,!0),i[s]=o(a,r+1);continue}else typeof l.originalCellIndex=="number"&&(l.originalCellIndex++,i[s]={...l})}return i}function vCo(a,i,e,t,o,n){i=rL(i);let r=a[2].length,s=a[1],l=a[2].map(p=>({cellKind:p.cellKind,language:p.language,metadata:p.metadata,outputs:p.outputs,source:p.getValue(),mime:void 0,internalMetadata:p.internalMetadata})),c=-1,u;if(l.length){for(let h=0;h<i.length;h++){let g=i[h];if(typeof g.modifiedCellIndex=="number"&&g.modifiedCellIndex===a[0]){c=h,typeof g.originalCellIndex=="number"&&(u=g.originalCellIndex);break}typeof g.originalCellIndex=="number"&&(u=g.originalCellIndex+1)}let p={editType:1,cells:l,index:u??0,count:a[1]};o([p],!0,void 0,()=>{},void 0,!0)}if(s){let p=0,h=0,g=new Set;for(let v=0;v<s;v++)g.add(a[0]+v);let f=new Set;for(let v=0;v<i.length;v++){let b=i[v];if(v<c)continue;let S=!1;if(typeof b.modifiedCellIndex=="number"&&g.has(b.modifiedCellIndex)){h++,typeof b.originalCellIndex=="number"&&p++,f.add(b);continue}typeof b.modifiedCellIndex=="number"&&h&&(b.modifiedCellIndex-=h,S=!0),typeof b.originalCellIndex=="number"&&p&&(b.originalCellIndex-=p,S=!0),S&&(i[v]={...b})}f.size&&Array.from(f).filter(v=>typeof v.originalCellIndex=="number").forEach(v=>{let b={editType:1,cells:[],index:v.originalCellIndex,count:1};o([b],!0,void 0,()=>{},void 0,!0)}),i=i.filter(v=>!f.has(v))}if(r&&c>=0)for(let p=0;p<i.length;p++){let h=i[p];if(p<c)continue;let g=!1;typeof h.modifiedCellIndex=="number"&&(h.modifiedCellIndex+=r,g=!0),typeof h.originalCellIndex=="number"&&(h.originalCellIndex+=r,g=!0),g&&(i[p]={...h})}return l.forEach((p,h)=>{let g=h+(u??0),f=a[0]+h,v=n(f,g);i.splice((c===-1?i.length:c)+h,0,v)}),i}function bCo(a,i){let e=Math.min(a.index,a.newIdx),t=Math.max(a.index,a.newIdx),o=i.slice(),n=o.findIndex(f=>f.modifiedCellIndex===a.index),r=o.findIndex(f=>f.modifiedCellIndex===a.newIdx);if(n===-1||r===-1)return;let s={...o[n]},l=a.newIdx>a.index?"down":"up",c=o.findIndex(f=>f.modifiedCellIndex===e),u=o.findIndex(f=>f.modifiedCellIndex===t),p=typeof s.originalCellIndex=="number",h=!1;for(let f=0;f<o.length;f++){let v=o[f],b=!1;l==="down"?f>c&&f<=u&&(typeof v.modifiedCellIndex=="number"&&(b=!0,v.modifiedCellIndex=v.modifiedCellIndex-1),typeof v.originalCellIndex=="number"&&p&&(v.originalCellIndex=v.originalCellIndex-1,h=!0,b=!0)):f>=c&&f<u&&(typeof v.modifiedCellIndex=="number"&&(b=!0,v.modifiedCellIndex=v.modifiedCellIndex+1),typeof v.originalCellIndex=="number"&&p&&(v.originalCellIndex=v.originalCellIndex+1,h=!0,b=!0)),b&&(o[f]={...v})}s.modifiedCellIndex=a.newIdx;let g=s.originalCellIndex;if(l==="down"?(o.splice(u+1,0,s),o.splice(c,1),typeof s.originalCellIndex=="number"&&(s.originalCellIndex=o.slice(0,u).reduce((f,v)=>typeof v.originalCellIndex=="number"?Math.max(f,v.originalCellIndex):f,-1)+1)):(o.splice(u,1),o.splice(c,0,s),typeof s.originalCellIndex=="number"&&(s.originalCellIndex=o.slice(0,c).reduce((f,v)=>typeof v.originalCellIndex=="number"?Math.max(f,v.originalCellIndex):f,-1)+1)),typeof s.originalCellIndex=="number"&&h&&typeof g=="number"&&s.originalCellIndex!==g){let f={editType:6,index:g,length:a.length,newIdx:s.originalCellIndex};return[o,[f]]}return[o,[]]}function tst(a,i){return i.find(t=>t.modifiedCellIndex===a)?.originalCellIndex}function SCo(a,i){return a!=="jupyter-notebook"?!1:!!i.rawEvents.every(e=>e.kind!==7?!1:(JSON.stringify(e.metadata||{})===JSON.stringify({execution_count:null,metadata:{}}),!0))}function ICo(a,i,e){let t=a.reduce((n,r)=>n+(r.type==="unchanged"?0:r.type==="delete"?i.cells[r.originalCellIndex].textModel?.getLineCount()??0:r.type==="insert"?e.cells[r.modifiedCellIndex].textModel?.getLineCount()??0:r.diff.get().changes.reduce((l,c)=>Math.max(l,c.modified.endLineNumberExclusive),0)),0),o=e.cells.reduce((n,r)=>n+(r.textModel?.getLineCount()??0),0);return o===0?0:Math.min(1,t/o)}var yCo="VSCodeChatNotebookSnapshotLanguage",iE=class extends tE{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k){super(e.object.notebook.uri,r,s,c,u,p,h,b,g,k);this.modifiedResourceRef=e;this._multiDiffEntryDelegate=o;this.transientOptions=n;this.configurationService=c;this.textModelService=f;this.modelService=v;this.notebookEditorWorkerService=S;this.loggingService=y;this.notebookResolver=w;this._isProcessingResponse=Me("isProcessingResponse",!1);this._isEditFromUs=!1;this._allEditsAreFromUs=!0;this._changesCount=Me(this,0);this.changesCount=this._changesCount;this.cellEntryMap=new gt;this.modifiedToOriginalCell=new gt;this._cellsDiffInfo=Me("diffInfo",[]);this.editedCells=new En;this.computeRequestId=0;this.cellTextModelMap=new gt;this.initialContentComparer=new Toe(l),this.modifiedModel=this._register(e).object.notebook,this.originalModel=this._register(t).object.notebook,this.originalURI=this.originalModel.uri,this.initialContent=l,this.initializeModelsFromDiff(),this._register(this.modifiedModel.onDidChangeContent(this.mirrorNotebookEdits,this))}static{this.NewModelCounter=0}get isProcessingResponse(){return this._isProcessingResponse}get cellsDiffInfo(){return this._cellsDiffInfo}get viewType(){return this.modifiedModel.viewType}static async create(e,t,o,n,r,s){return s.invokeFunction(async l=>{let c=l.get(bn),u=l.get(yh),p=l.get(B),h=await u.resolve(e),g=h.object.notebook,f=gAi(o.sessionResource,o.requestId,xt(),g.uri.scheme===Q.untitled?`/${g.uri.path}`:g.uri.path,g.viewType),[v,b]=await Promise.all([c.withNotebookDataProvider(h.object.notebook.notebookType),c.createNotebookTextDocumentSnapshot(g.uri,2,Se.None).then(k=>tb(k))]),S=new N;S.add(AW.registerFile(f,b));let y=await u.resolve(f,g.viewType);if(r!==void 0)try{BM(y.object.notebook,r)}catch(k){console.error(`Error restoring snapshot: ${r}`,k),r=VM(g,v.serializer.options,p)}else{r=VM(g,v.serializer.options,p),BM(y.object.notebook,r);let k=[];g.cells.forEach((T,P)=>{let O=SAi(T.uri);k.push({editType:9,index:P,internalMetadata:{internalId:O}})}),h.object.notebook.applyEdits(k,!0,void 0,()=>{},void 0,!1),y.object.notebook.applyEdits(k,!0,void 0,()=>{},void 0,!1)}let w=s.createInstance(iE,h,y,t,v.serializer.options,o,n,r);return w._register(S),w})}static canHandleSnapshotContent(e){if(!e)return!1;try{return FWe(e),!0}catch{return!1}}static canHandleSnapshot(e){return!!(e.languageId===yCo&&iE.canHandleSnapshotContent(e.current))}initializeModelsFromDiffImpl(e){this.cellEntryMap.forEach(o=>o.dispose()),this.cellEntryMap.clear();let t=e.map((o,n)=>{switch(o.type){case"delete":return this.createDeleteCellDiffInfo(o.originalCellIndex);case"insert":return this.createInsertedCellDiffInfo(o.modifiedCellIndex);default:return this.createModifiedCellDiffInfo(o.modifiedCellIndex,o.originalCellIndex)}});this._cellsDiffInfo.set(t,void 0),this._changesCount.set(est(t),void 0)}getIndexOfCellHandle(e){return this.modifiedModel.cells.findIndex(t=>t.handle===e)}async initializeModelsFromDiff(){let e=++this.computeRequestId;if(this._areOriginalAndModifiedIdenticalImpl()){let o=this.modifiedModel.cells.map((n,r)=>({type:"unchanged",originalCellIndex:r,modifiedCellIndex:r}));this.initializeModelsFromDiffImpl(o);return}let t=[];try{this._isProcessingResponse.set(!0,void 0);let o=await this.notebookEditorWorkerService.computeDiff(this.originalURI,this.modifiedURI);if(e!==this.computeRequestId||this._store.isDisposed)return;let n=wAe(this.originalModel,this.modifiedModel,o);n.cellDiffInfo.length&&t.push(...n.cellDiffInfo)}catch(o){this.loggingService.error("Notebook Chat",`Error computing diff:
`+o)}finally{this._isProcessingResponse.set(!1,void 0)}this.initializeModelsFromDiffImpl(t)}updateCellDiffInfo(e,t){this._cellsDiffInfo.set(rL(e),t),this._changesCount.set(est(e),t)}mirrorNotebookEdits(e){if(this._isEditFromUs||this._isExternalEditInProgress||Array.from(this.cellEntryMap.values()).some(n=>n.isEditFromUs))return;let t=this.initialContentComparer.isEqual(this.modifiedModel),o=this._stateObs.get();if(o===0&&t){this._stateObs.set(2,void 0),this.updateCellDiffInfo([],void 0),this.initializeModelsFromDiff(),this._notifySessionAction("rejected");return}if(e.rawEvents.length&&o!==2&&!SCo(this.modifiedModel.notebookType,e)){this._allEditsAreFromUs=!1,this._userEditScheduler.schedule();for(let n of e.rawEvents.filter(r=>r.kind!==10))switch(n.kind){case 11:{let r={editType:5,metadata:this.modifiedModel.metadata};this.originalModel.applyEdits([r],!0,void 0,()=>{},void 0,!1);break}case 1:{let r=rL(this._cellsDiffInfo.get());this._applyEditsSync(()=>{n.changes.forEach(s=>{s[2].forEach((l,c)=>{if(l.internalMetadata.internalId)return;let u=s[0]+c,p=SAi(l.uri),h=[{editType:9,index:u,internalMetadata:{internalId:p}}];this.modifiedModel.applyEdits(h,!0,void 0,()=>{},void 0,!1),l.internalMetadata??={},l.internalMetadata.internalId=p})})}),n.changes.forEach(s=>{r=vCo(s,r,this.modifiedModel.cells.length,this.originalModel.cells.length,this.originalModel.applyEdits.bind(this.originalModel),this.createModifiedCellDiffInfo.bind(this))}),this.updateCellDiffInfo(r,void 0),this.disposeDeletedCellEntries();break}case 5:{let r=tst(n.index,this._cellsDiffInfo.get());if(typeof r=="number"){let s={editType:4,index:r,language:n.language};this.originalModel.applyEdits([s],!0,void 0,()=>{},void 0,!1)}break}case 7:{let r=tst(n.index,this._cellsDiffInfo.get());if(typeof r=="number"){let s={editType:3,index:r,metadata:n.metadata};this.originalModel.applyEdits([s],!0,void 0,()=>{},void 0,!1)}break}case 13:break;case 12:{let r=tst(n.index,this._cellsDiffInfo.get());if(typeof r=="number"){let s={editType:9,index:r,internalMetadata:n.internalMetadata};this.originalModel.applyEdits([s],!0,void 0,()=>{},void 0,!1)}break}case 8:{let r=tst(n.index,this._cellsDiffInfo.get());if(typeof r=="number"){let s={editType:2,index:r,append:n.append,outputs:n.outputs};this.originalModel.applyEdits([s],!0,void 0,()=>{},void 0,!1)}break}case 9:break;case 2:{let r=bCo(n,this._cellsDiffInfo.get().slice());r&&(this.originalModel.applyEdits(r[1],!0,void 0,()=>{},void 0,!1),this._cellsDiffInfo.set(r[0],void 0));break}default:break}if(t=this.initialContentComparer.isEqual(this.modifiedModel),o===0&&t){this._stateObs.set(2,void 0),this.updateCellDiffInfo([],void 0),this.initializeModelsFromDiff();return}}}async _doAccept(){this.updateCellDiffInfo([],void 0);let e=VM(this.modifiedModel,this.transientOptions,this.configurationService);BM(this.originalModel,e),this.initializeModelsFromDiff(),await this._collapse(void 0);let t=this._fileConfigService.getAutoSaveConfiguration(this.modifiedURI);this.modifiedModel.uri.scheme!==Q.untitled&&(!t.autoSave||!this.notebookResolver.isDirty(this.modifiedURI))&&await this._applyEdits(async()=>{try{await this.modifiedResourceRef.object.save({reason:1,force:!0})}catch{}})}async _doReject(){this.updateCellDiffInfo([],void 0),this.createdInRequestId===this._telemetryInfo.requestId?(await this._applyEdits(async()=>{await this.modifiedResourceRef.object.revert({soft:!0}),await this._fileService.del(this.modifiedURI)}),this._onDidDelete.fire()):(await this._applyEdits(async()=>{let e=VM(this.originalModel,this.transientOptions,this.configurationService);this.restoreSnapshotInModifiedModel(e),this._allEditsAreFromUs&&Array.from(this.cellEntryMap.values()).every(t=>t.allEditsAreFromUs)&&await this.modifiedResourceRef.object.save({reason:1,skipSaveParticipants:!0})}),this.initializeModelsFromDiff(),await this._collapse(void 0))}async _collapse(e){this._multiDiffEntryDelegate.collapse(e)}_createEditorIntegration(e){let t=Jn(e);if(!t&&e.getId()===nh.ID){let o=e.getControl();return this._instantiationService.createInstance(Oqt,o,this._cellsDiffInfo)}return wo(t),this._instantiationService.createInstance(zWe,this,e,this.modifiedModel,this.originalModel,this._cellsDiffInfo)}_resetEditsState(e){super._resetEditsState(e),this.cellEntryMap.forEach(t=>!t.isDisposed&&t.clearCurrentEditLineDecoration())}_createUndoRedoElement(e){let t=e.session.getRequests().find(u=>u.id===e.requestId),o=t?.message.text?d(6991,null,t.message.text):d(6992,null),n=this.transientOptions,r=this.configurationService.getValue(yt.outputBackupSizeLimit)*1024,s=VM(this.modifiedModel,n,r),l="",c=2;return{type:0,resource:this.modifiedURI,label:o,code:"chat.edit",confirmBeforeUndo:!1,undo:async()=>{l=VM(this.modifiedModel,n,r),this._isEditFromUs=!0;try{BM(this.modifiedModel,s),BM(this.originalModel,s)}finally{this._isEditFromUs=!1}c=this._stateObs.get()===1?1:2,this._stateObs.set(2,void 0),this.updateCellDiffInfo([],void 0),this.initializeModelsFromDiff(),this._notifySessionAction("userModified")},redo:async()=>{s=VM(this.modifiedModel,n,r),this._isEditFromUs=!0;try{BM(this.modifiedModel,l),BM(this.originalModel,l)}finally{this._isEditFromUs=!1}this._stateObs.set(c,void 0),this.updateCellDiffInfo([],void 0),this.initializeModelsFromDiff(),this._notifySessionAction("userModified")}}}async _areOriginalAndModifiedIdentical(){return this._areOriginalAndModifiedIdenticalImpl()}_areOriginalAndModifiedIdenticalImpl(){let e=VM(this.originalModel,this.transientOptions,this.configurationService);return new Toe(e).isEqual(this.modifiedModel)}async acceptAgentEdits(e,t,o,n){let r=e.scheme===Q.vscodeNotebookCell,s=r&&this.modifiedModel.cells.find(u=>Qe(u.uri,e)),l;if(s){let u=this.modifiedModel.cells.indexOf(s),p=this._cellsDiffInfo.get().slice().find(h=>h.modifiedCellIndex===u);if(!p){console.error("Original cell model not found");return}l=this.getOrCreateModifiedTextFileEntryForCell(s,await p.modifiedModel.promise,await p.originalModel.promise)}let c=async()=>{await Promise.all(Array.from(this.editedCells).map(async u=>{let p=this.modifiedModel.cells.find(g=>Qe(g.uri,u));await(p&&this.cellEntryMap.get(p.uri))?.acceptAgentEdits([],!0,n)})),this.editedCells.clear()};if(await this._applyEdits(async()=>{await Promise.all(t.map(async(u,p)=>{let h=o&&p===t.length-1;SE.isTextEdit(u)?Qe(e,this.modifiedModel.uri)?(this.newNotebookEditGenerator??=this._instantiationService.createInstance(BWe,this.modifiedModel),this.newNotebookEditGenerator.acceptTextEdits([u])):(this.newNotebookEditGenerator=void 0,this.editedCells.has(e)||(await c(),this.editedCells.add(e)),await l?.acceptAgentEdits([u],h,n)):(this.newNotebookEditGenerator=void 0,this.acceptNotebookEdit(u))}))}),o&&await c(),o=!r&&o,o&&this.newNotebookEditGenerator){let u=await this.newNotebookEditGenerator.generateEdits();this.newNotebookEditGenerator=void 0,u.forEach(p=>this.acceptNotebookEdit(p))}Gi(u=>{if(this._stateObs.set(0,u),o)this.editedCells.clear(),this._resetEditsState(u),this._rewriteRatioObs.set(1,u);else{let p=Math.max(this._rewriteRatioObs.get(),ICo(this._cellsDiffInfo.get(),this.originalModel,this.modifiedModel));this._rewriteRatioObs.set(Math.min(1,p),u)}})}disposeDeletedCellEntries(){let e=new En(this.modifiedModel.cells.map(t=>t.uri));Array.from(this.cellEntryMap.keys()).forEach(t=>{e.has(t)||(this.cellEntryMap.get(t)?.dispose(),this.cellEntryMap.delete(t))})}acceptNotebookEdit(e){if(this.modifiedModel.applyEdits([e],!0,void 0,()=>{},void 0,!1),this.disposeDeletedCellEntries(),e.editType!==1)return;e.cells.forEach((o,n)=>{let r=e.index+n,s=this.modifiedModel.cells[r];if(s.internalMetadata.internalId)return;let l=SAi(s.uri),c=[{editType:9,index:r,internalMetadata:{internalId:l}}];this.modifiedModel.applyEdits(c,!0,void 0,()=>{},void 0,!1)});let t=[];if(e.count===0){t=rL(this._cellsDiffInfo.get()),t.forEach(n=>{n.type!=="delete"&&n.modifiedCellIndex>=e.index&&(n.modifiedCellIndex+=e.cells.length)});let o=e.cells.map((n,r)=>this.createInsertedCellDiffInfo(e.index+r));t.splice(e.index,0,...o)}else t=rL(this._cellsDiffInfo.get()).map(o=>o.type==="unchanged"&&o.modifiedCellIndex>=e.index&&o.modifiedCellIndex<=e.index+e.count-1?this.createDeleteCellDiffInfo(o.originalCellIndex):(o.type!=="delete"&&o.modifiedCellIndex>=e.index+e.count&&(o.modifiedCellIndex-=e.count),o));this.updateCellDiffInfo(t,void 0)}computeStateAfterAcceptingRejectingChanges(e){let t=VM(this.modifiedModel,this.transientOptions,this.configurationService);if(new Toe(t).isEqual(this.originalModel)){let o=e?1:2;this._stateObs.set(o,void 0),this._notifySessionAction(e?"accepted":"rejected")}}createModifiedCellDiffInfo(e,t){let o=this.modifiedModel.cells[e],n=this.originalModel.cells[t];this.modifiedToOriginalCell.set(o.uri,n.uri);let r=this.resolveCellModel(o.uri),s=this.resolveCellModel(n.uri);Promise.all([r,s]).then(([u,p])=>{this.getOrCreateModifiedTextFileEntryForCell(o,u,p)});let l=Me("diff",fq);return{type:"unchanged",modifiedCellIndex:e,originalCellIndex:t,keep:async u=>{let[p,h]=await Promise.all([r,s]),g=this.getOrCreateModifiedTextFileEntryForCell(o,p,h);return g?g.keep(u):!1},undo:async u=>{let[p,h]=await Promise.all([r,s]),g=this.getOrCreateModifiedTextFileEntryForCell(o,p,h);return g?g.undo(u):!1},modifiedModel:new bd(r),originalModel:new bd(s),diff:l}}createInsertedCellDiffInfo(e){let t=this.modifiedModel.cells[e],o=t.getValue().split(/\r?\n/),n=new z(1,0,1,0),r=new z(1,0,o.length,o[o.length-1].length),s=new Eg(n,r),l=[new Uf(new uo(1,1),new uo(1,o.length),[s])],c=this.modifiedModel.uri.with({query:(iE.NewModelCounter++).toString(),scheme:"emptyCell"}),u=this.modelService.getModel(c)||this._register(this.modelService.createModel("",null,c));this.modifiedToOriginalCell.set(t.uri,c);let p=async()=>(this._applyEditsSync(()=>this.keepPreviouslyInsertedCell(t)),this.computeStateAfterAcceptingRejectingChanges(!0),!0),h=async()=>(this._applyEditsSync(()=>this.undoPreviouslyInsertedCell(t)),this.computeStateAfterAcceptingRejectingChanges(!1),!0);return this.resolveCellModel(t.uri).then(g=>{this._store.isDisposed||this.getOrCreateModifiedTextFileEntryForCell(t,g,u)}),{type:"insert",originalCellIndex:void 0,modifiedCellIndex:e,keep:p,undo:h,modifiedModel:new bd(this.resolveCellModel(t.uri)),originalModel:new bd(Promise.resolve(u)),diff:Me("deletedCellDiff",{changes:l,identical:!1,moves:[],quitEarly:!1})}}createDeleteCellDiffInfo(e){let t=this.originalModel.cells[e],o=new Array(t.textBuffer.getLineCount()).fill(0).map((g,f)=>t.textBuffer.getLineContent(f+1)),n=new z(1,0,o.length,o[o.length-1].length),r=new z(1,0,1,0),s=new Eg(r,n),l=[new Uf(new uo(1,o.length),new uo(1,1),[s])],c=this.modifiedModel.uri.with({query:(iE.NewModelCounter++).toString(),scheme:"emptyCell"}),u=this.modelService.getModel(c)||this._register(this.modelService.createModel("",null,c)),p=async()=>(this._applyEditsSync(()=>this.keepPreviouslyDeletedCell(this.originalModel.cells.indexOf(t))),this.computeStateAfterAcceptingRejectingChanges(!0),!0),h=async()=>(this._applyEditsSync(()=>this.undoPreviouslyDeletedCell(this.originalModel.cells.indexOf(t),t)),this.computeStateAfterAcceptingRejectingChanges(!1),!0);return{type:"delete",modifiedCellIndex:void 0,originalCellIndex:e,originalModel:new bd(this.resolveCellModel(t.uri)),modifiedModel:new bd(Promise.resolve(u)),keep:p,undo:h,diff:Me("cellDiff",{changes:l,identical:!1,moves:[],quitEarly:!1})}}undoPreviouslyInsertedCell(e){let t=[];this._applyEditsSync(()=>{let o=this.modifiedModel.cells.indexOf(e);t=gCo(o,this._cellsDiffInfo.get(),this.modifiedModel.applyEdits.bind(this.modifiedModel))}),this.disposeDeletedCellEntries(),this.updateCellDiffInfo(t,void 0)}keepPreviouslyInsertedCell(e){let t=this.modifiedModel.cells.indexOf(e);if(t===-1)return;let o={cellKind:e.cellKind,language:e.language,metadata:e.metadata,outputs:e.outputs,source:e.getValue(),mime:e.mime,internalMetadata:{internalId:e.internalMetadata.internalId}};this.cellEntryMap.get(e.uri)?.dispose(),this.cellEntryMap.delete(e.uri);let n=fCo(t,this._cellsDiffInfo.get().slice(),o,this.originalModel.applyEdits.bind(this.originalModel),this.createModifiedCellDiffInfo.bind(this));this.updateCellDiffInfo(n,void 0)}undoPreviouslyDeletedCell(e,t){let o={cellKind:t.cellKind,language:t.language,metadata:t.metadata,outputs:t.outputs,source:t.getValue(),mime:t.mime,internalMetadata:{internalId:t.internalMetadata.internalId}},n=[];this._applyEditsSync(()=>{n=hCo(e,this._cellsDiffInfo.get(),o,this.modifiedModel.applyEdits.bind(this.modifiedModel),this.createModifiedCellDiffInfo.bind(this))}),this.updateCellDiffInfo(n,void 0)}keepPreviouslyDeletedCell(e){let t={cells:[],count:1,editType:1,index:e};this.originalModel.applyEdits([t],!0,void 0,()=>{},void 0,!1);let o=rL(this._cellsDiffInfo.get()).filter(n=>!(n.type==="delete"&&n.originalCellIndex===e)).map(n=>n.type!=="insert"&&n.originalCellIndex>e?{...n,originalCellIndex:n.originalCellIndex-1}:n);this.updateCellDiffInfo(o,void 0)}async _applyEdits(e){this._isEditFromUs=!0;try{await e()}finally{this._isEditFromUs=!1}}_applyEditsSync(e){this._isEditFromUs=!0;try{e()}finally{this._isEditFromUs=!1}}_safeCreateSnapshot(e){try{return VM(e,this.transientOptions,this.configurationService)}catch(t){return this.loggingService.error("Notebook Chat",`Error creating snapshot: ${t instanceof Error?t.message:t}`),this.initialContent}}getCurrentSnapshot(){return this._safeCreateSnapshot(this.modifiedModel)}createSnapshot(e,t,o){let n=this._safeCreateSnapshot(this.originalModel),r=this.getCurrentSnapshot();return{resource:this.modifiedURI,languageId:yCo,snapshotUri:gAi(e,t,o,this.modifiedURI.path,this.modifiedModel.viewType),original:n,current:r,state:this.state.get(),telemetryInfo:this.telemetryInfo}}equalsSnapshot(e){return!!e&&Qe(this.modifiedURI,e.resource)&&this.state.get()===e.state&&new Toe(e.original).isEqual(this.originalModel)&&new Toe(e.current).isEqual(this.modifiedModel)}async restoreFromSnapshot(e,t=!0){this.updateCellDiffInfo([],void 0),this._stateObs.set(e.state,void 0),BM(this.originalModel,e.original),t&&this.restoreSnapshotInModifiedModel(e.current),this.initializeModelsFromDiff()}async resetEditTrackerToInitialContent(){this.initialContent&&BM(this.originalModel,this.initialContent),this.updateCellDiffInfo([],void 0),this.initializeModelsFromDiff()}async resetToInitialContent(){this.updateCellDiffInfo([],void 0),this.restoreSnapshotInModifiedModel(this.initialContent),this.initializeModelsFromDiff()}restoreModifiedModelFromSnapshot(e){return this.restoreSnapshotInModifiedModel(e),this.initializeModelsFromDiff()}restoreSnapshotInModifiedModel(e){e!==VM(this.modifiedModel,this.transientOptions,this.configurationService)&&this._applyEditsSync(()=>{this.modifiedModel.pushStackElement(),BM(this.modifiedModel,e),this.modifiedModel.pushStackElement()})}async resolveCellModel(e){let t=this.originalModel.cells.concat(this.modifiedModel.cells).find(n=>Qe(n.uri,e));if(!t)throw new Error("Cell not found");let o=this.cellTextModelMap.get(t.uri);if(o)return this.cellTextModelMap.set(t.uri,o),o;{let r=(await Iht(this.textModelService.createModelReference(t.uri),this._store)).object.textEditorModel;return this.cellTextModelMap.set(t.uri,r),r}}getOrCreateModifiedTextFileEntryForCell(e,t,o){let n=this.cellEntryMap.get(e.uri);if(n)return n;if(this._store.isDisposed)return;let r=new N;return n=this._register(this._instantiationService.createInstance(HWe,this.modifiedResourceRef.object.resource,e,t,o,()=>this._isExternalEditInProgress,r)),this.cellEntryMap.set(e.uri,n),r.add(be(s=>{if(this.modifiedModel.cells.indexOf(e)===-1)return;let l=this.cellsDiffInfo.read(void 0).slice(),c=this.modifiedModel.cells.indexOf(e),u=l.find(h=>h.modifiedCellIndex===c);if(!u)return;let p=l.indexOf(u);u.diff.set(n.diffInfo.read(s),void 0),n.diffInfo.read(void 0).identical&&u.type==="modified"&&(u={...u,type:"unchanged"}),!n.diffInfo.read(void 0).identical&&u.type==="unchanged"&&(u={...u,type:"modified"}),l.splice(p,1,{...u}),Gi(h=>{this.updateCellDiffInfo(l,h)})})),r.add(be(s=>{if(this.modifiedModel.cells.indexOf(e)===-1)return;let l=n.state.read(s);l===1?this.computeStateAfterAcceptingRejectingChanges(!0):l===2&&this.computeStateAfterAcceptingRejectingChanges(!1)})),n}async computeEditsFromSnapshots(e,t){let o=FWe(e),n=FWe(t),r=[];return o.data.cells.length>0?r.push({editType:1,index:0,count:o.data.cells.length,cells:n.data.cells}):n.data.cells.length>0&&r.push({editType:1,index:0,count:0,cells:n.data.cells}),r}async save(){this.modifiedModel.uri.scheme!==Q.untitled&&this.notebookResolver.isDirty(this.modifiedModel.uri)&&await this.modifiedResourceRef.object.save({reason:1,skipSaveParticipants:!0})}async revertToDisk(){this.modifiedModel.uri.scheme!==Q.untitled&&await this.modifiedResourceRef.object.revert({soft:!1})}};iE=I([m(7,B),m(8,gr),m(9,mi),m(10,fe),m(11,F),m(12,Bt),m(13,Tt),m(14,Ml),m(15,kG),m(16,Uv),m(17,yh),m(18,xS)],iE);function SAi(a){let i=new Yy;return i.update(a.toString()),i.digest().substring(0,8)}var wCo="contents",CCo="state.json",Doe=class{constructor(i,e,t,o,n){this._chatSessionResource=i;this._fileService=e;this._environmentService=t;this._logService=o;this._workspaceContextService=n;this.storageKey=Zrt(i)}_getStorageLocation(){let i=this._workspaceContextService.getWorkspace().id;return Ge(this._environmentService.workspaceStorageHome,i,"chatEditingSessions",this.storageKey)}async restoreState(){let i=this._getStorageLocation(),e=new Map,t=s=>{let l=e.get(s);return l||(l=this._fileService.readFile(Ge(i,wCo,s)).then(c=>c.value.toString()),e.set(s,l)),l},o=async s=>{let l=new gt;for(let c of s){let u=await r(c);l.set(u.resource,u)}return l},n=async s=>{let l=await o(s.entries);return{stopId:"stopId"in s?s.stopId:void 0,entries:l}},r=async s=>({resource:A.parse(s.resource),languageId:s.languageId,original:await t(s.originalHash),current:await t(s.currentHash),state:s.state,snapshotUri:A.parse(s.snapshotUri),telemetryInfo:{requestId:s.telemetryInfo.requestId,agentId:s.telemetryInfo.agentId,command:s.telemetryInfo.command,sessionResource:this._chatSessionResource,result:void 0,modelId:s.telemetryInfo.modelId,modeId:s.telemetryInfo.modeId,applyCodeBlockSuggestionId:s.telemetryInfo.applyCodeBlockSuggestionId,feature:s.telemetryInfo.feature},isDeleted:s.isDeleted});try{let s=Ge(i,CCo);if(!await this._fileService.exists(s)){this._logService.debug(`chatEditingSession: No editing session state found at ${s.toString()}`);return}this._logService.debug(`chatEditingSession: Restoring editing session at ${s.toString()}`);let l=await this._fileService.readFile(s),c=JSON.parse(l.value.toString());if(!Uln.includes(c.version))return;let u=new gt;for(let h of c.initialFileContents)u.set(A.parse(h[0]),await t(h[1]));let p=await n(c.recentSnapshot);return{initialFileContents:u,recentSnapshot:p,timeline:$n(c.timeline)}}catch(s){this._logService.error(`Error restoring chat editing session from ${i.toString()}`,s)}}async storeState(i){let e=this._getStorageLocation(),t=A.joinPath(e,wCo),o=new Set;try{(await this._fileService.resolve(t)).children?.forEach(h=>{h.isFile&&o.add(h.name)})}catch{try{await this._fileService.createFolder(t)}catch(h){this._logService.error(`Error creating chat editing session content folder ${t.toString()}`,h);return}}let n=new Map,r=async p=>{let h=qe.fromString(p),g=(await vV(h)).substring(0,7);return o.has(g)||await this._fileService.writeFile(Ge(t,g),h),g},s=async p=>{let h=n.get(p);return h||(h=r(p),n.set(p,h)),h},l=async(p,h)=>await Promise.all(Array.from(p.entries()).map(async([g,f])=>[g.toString(),await h(f)])),c=async p=>({stopId:p.stopId,entries:await Promise.all(Array.from(p.entries.values()).map(u))}),u=async p=>({resource:p.resource.toString(),languageId:p.languageId,originalHash:await s(p.original),currentHash:await s(p.current),state:p.state,snapshotUri:p.snapshotUri.toString(),telemetryInfo:{requestId:p.telemetryInfo.requestId,agentId:p.telemetryInfo.agentId,command:p.telemetryInfo.command,modelId:p.telemetryInfo.modelId,modeId:p.telemetryInfo.modeId},isDeleted:p.isDeleted});try{let p={version:zln,initialFileContents:await l(i.initialFileContents,h=>s(h)),timeline:i.timeline,recentSnapshot:await c(i.recentSnapshot)};this._logService.debug(`chatEditingSession: Storing editing session at ${e.toString()}: ${n.size} files`),await this._fileService.writeFile(Ge(e,CCo),qe.fromString(JSON.stringify(p)))}catch(p){this._logService.debug(`Error storing chat editing session to ${e.toString()}`,p)}}async clearState(){let i=this._getStorageLocation();if(await this._fileService.exists(i)){this._logService.debug(`chatEditingSession: Clearing editing session at ${i.toString()}`);try{await this._fileService.del(i,{recursive:!0})}catch(e){this._logService.debug(`Error clearing chat editing session from ${i.toString()}`,e)}}}};Doe=I([m(1,fe),m(2,Eo),m(3,se),m(4,Pe)],Doe);var Uln=[1,2],zln=2;var IAi=class extends rm{constructor(e,t){super();this._minDuration=e;this._maxOverallDelay=t;this._size=0}queue(e){this._size+=1;let t=this._size*this._minDuration>this._maxOverallDelay;return super.queue(async()=>{try{let o=e(),n=t?Promise.resolve(void 0):Li(this._minDuration,Se.None),[r]=await Promise.all([o,n]);return r}finally{this._size-=1}})}};function Kln(a,i,e){return[{kind:"markdownContent",content:new Ie("\n````\n")},{kind:"codeblockUri",uri:a,isEdit:!0,undoStopId:e},i?{kind:"notebookEdit",uri:a,edits:[],done:!1,isExternalEdit:!0}:{kind:"textEdit",uri:a,edits:[],done:!1,isExternalEdit:!0}]}var FQ=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w){super();this.chatSessionResource=e;this.isGlobalEditingSession=t;this._lookupExternalEntry=o;this._instantiationService=r;this._modelService=s;this._languageService=l;this._textModelService=c;this._bulkEditService=u;this._editorGroupsService=p;this._editorService=h;this._notebookService=g;this._accessibilitySignalService=f;this._logService=v;this.configurationService=b;this._fileService=S;this._explanationModelManager=y;this._telemetryService=w;this.supportsKeepUndo=!1;this._state=Me(this,0);this._initialFileContents=new gt;this._baselineCreationLocks=new Nx;this._streamingEditLocks=new Nx;this._externalEditOperations=new Map;this._entriesObs=Me(this,[]);this.entries=ke(e=>{let t=this._state.read(e);return t===3||t===0?[]:this._entriesObs.read(e)});this._onDidDispose=new E;this._timeline=this._instantiationService.createInstance(VWe,e,this._getTimelineDelegate()),this.canRedo=this._timeline.canRedo.map((k,T)=>k&&this._state.read(T)===2),this.canUndo=this._timeline.canUndo.map((k,T)=>k&&this._state.read(T)===2),this._init(n)}get state(){return this._state}get requestDisablement(){return this._timeline.requestDisablement}get onDidDispose(){return this._assertNotDisposed(),this._onDidDispose.event}_getTimelineDelegate(){return{createFile:(e,t)=>this._bulkEditService.apply({edits:[{newResource:e,options:{overwrite:!0,contents:t?Promise.resolve(qe.fromString(t)):void 0}}]}),deleteFile:async e=>{let t=this._entriesObs.get().filter(o=>!Qe(o.modifiedURI,e));this._entriesObs.set(t,void 0),await this._bulkEditService.apply({edits:[{oldResource:e,options:{ignoreIfNotExists:!0}}]})},renameFile:async(e,t)=>{let o=this._entriesObs.get(),n=o.find(r=>Qe(r.modifiedURI,e));if(n){let r=await this._getOrCreateModifiedFileEntry(t,0,n.telemetryInfo,this._getCurrentTextOrNotebookSnapshot(n));n.dispose(),this._entriesObs.set(o.map(s=>s===n?r:s),void 0)}},setContents:async(e,t,o)=>{let n=await this._getOrCreateModifiedFileEntry(e,0,o),r=n.state.get();n instanceof iE?await n.restoreModifiedModelFromSnapshot(t):await n.acceptAgentEdits(e,[{range:new z(1,1,Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER),text:t}],!0,void 0),r!==0&&await n.accept()}}}async _init(e){let t=this._instantiationService.createInstance(Doe,this.chatSessionResource),o;if(e instanceof FQ)o=e._getStoredState(this.chatSessionResource);else if(o=await t.restoreState().catch(n=>{this._logService.error(`Error restoring chat editing session state for ${this.chatSessionResource}`,n)}),this._store.isDisposed)return;if(o){for(let[n,r]of o.initialFileContents)this._initialFileContents.set(n,r);o.timeline&&Gi(n=>this._timeline.restoreFromState(o.timeline,n)),await this._initEntries(o.recentSnapshot)}this._state.set(2,void 0)}_getEntry(e){return e=Zo.parse(e)?.notebook??e,this._entriesObs.get().find(t=>Qe(t.modifiedURI,e))}getEntry(e){return this._getEntry(e)}readEntry(e,t){return e=Zo.parse(e)?.notebook??e,this._entriesObs.read(t).find(o=>Qe(o.modifiedURI,e))}storeState(){let e=this._instantiationService.createInstance(Doe,this.chatSessionResource),t=this._getStoredState();return this._telemetryService.publicLog2("chatEditing/sessionStore",{editSessionId:Zrt(this.chatSessionResource),...this._countEntryStates(this._entriesObs.get())}),e.storeState(t)}_getStoredState(e=this.chatSessionResource){let t=new gt;for(let n of this._entriesObs.get())t.set(n.modifiedURI,n.createSnapshot(e,void 0,void 0));return{initialFileContents:this._initialFileContents,timeline:this._timeline.getStateForPersistence(),recentSnapshot:{entries:t,stopId:void 0}}}getEntryDiffBetweenStops(e,t,o){return this._timeline.getEntryDiffBetweenStops(e,t,o)}getEntryDiffBetweenRequests(e,t,o){return this._timeline.getEntryDiffBetweenRequests(e,t,o)}getDiffsForFilesInSession(){return this._timeline.getDiffsForFilesInSession()}getDiffForSession(){return this._timeline.getDiffForSession()}getDiffsForFilesInRequest(e){return this._timeline.getDiffsForFilesInRequest(e)}hasEditsInRequest(e,t){return this._timeline.hasEditsInRequest(e,t)}createSnapshot(e,t){let o=t?`Request ${e} - Stop ${t}`:`Request ${e}`;this._timeline.createCheckpoint(e,t,o)}async getSnapshotContents(e,t,o){let n=await this._timeline.getContentAtStop(e,t,o);return typeof n=="string"?qe.fromString(n):n}async getSnapshotModel(e,t,o){await this._baselineCreationLocks.peek(o.path);let n=await this._timeline.getContentAtStop(e,o,t);if(n===void 0)return null;let r=typeof n=="string"?n:n.toString(),s=this._modelService.createModel(r,this._languageService.createByFilepathOrFirstLine(o),o,!1),l=new N;return l.add(s.onWillDispose(()=>l.dispose())),l.add(this._timeline.onDidChangeContentsAtStop(e,o,t,c=>s.setValue(c))),s}getSnapshotUri(e,t,o){return this._timeline.getContentURIAtStop(e,t,o)}async restoreSnapshot(e,t){let o=this._timeline.getCheckpointIdForRequest(e,t);o&&await this._timeline.navigateToCheckpoint(o)}_assertNotDisposed(){if(this._state.get()===3)throw new li("Cannot access a disposed editing session")}async accept(...e){await this._operateEntry("accept",e)&&this._accessibilitySignalService.playSignal($o.editsKept,{allowManyInParallel:!0})}async reject(...e){await this._operateEntry("reject",e)&&this._accessibilitySignalService.playSignal($o.editsUndone,{allowManyInParallel:!0})}async _operateEntry(e,t){this._assertNotDisposed();let o=this._entriesObs.get().filter(s=>t.length===0||t.some(l=>Qe(l,s.modifiedURI))).filter(s=>!s.isCurrentlyBeingModifiedBy.get()).filter(s=>s.state.get()===0);if(o.length===0)return 0;let n=e==="accept"?"acceptDeferred":"rejectDeferred",r=await Promise.all(o.map(s=>s[n]().catch(l=>{this._logService.error(`Error calling ${n} on entry ${s.modifiedURI}`,l)})));return Gi(s=>{r.forEach(l=>l?.(s))}),o.length}async show(e){if(this._assertNotDisposed(),this._editorPane){if(this._editorPane.isVisible())return;if(this._editorPane.input){await this._editorService.openEditor(this._editorPane.input,{pinned:!0,activation:1});return}}let t=au.fromResourceMultiDiffEditorInput({multiDiffSource:ERt(this,e),label:d(6996,null)},this._instantiationService);this._editorPane=await this._editorService.openEditor(t,{pinned:!0,activation:1})}async stop(e=!1){this._stopPromise??=Promise.allSettled([this._performStop(),this.storeState()]).then(()=>{}),await this._stopPromise,e&&await this._instantiationService.createInstance(Doe,this.chatSessionResource).clearState()}async _performStop(){let e=[tE.scheme,nL.scheme];await Promise.allSettled(this._editorGroupsService.groups.flatMap(async t=>t.editors.map(async o=>{(o instanceof au&&o.initialResources?.some(n=>n.originalUri&&e.indexOf(n.originalUri.scheme)!==-1)||o instanceof Pa&&o.original.resource&&e.indexOf(o.original.resource.scheme)!==-1)&&await t.closeEditor(o)})))}dispose(){this._assertNotDisposed(),this.clearExplanations(),Be(this._entriesObs.get()),super.dispose(),this._state.set(3,void 0),this._onDidDispose.fire(),this._onDidDispose.dispose()}get isDisposed(){return this._state.get()===3}startStreamingEdits(e,t,o){let n=new Ko,r=new Ko,s=new IAi(15,1e3);s.queue(()=>r.p),this._baselineCreationLocks.queue(e.path,()=>r.p),this._streamingEditLocks.queue(e.toString(),async()=>(await b4(this),this.isDisposed||await this._acceptStreamingEditsStart(t,o,e),r.complete(),n.p));let l=!1;return{pushText:(c,u)=>{s.queue(async()=>{this.isDisposed||await this._acceptEdits(e,c,u,t)})},pushNotebookCellText:(c,u,p)=>{s.queue(async()=>{this.isDisposed||await this._acceptEdits(c,u,p,t)})},pushNotebook:(c,u)=>{s.queue(async()=>{this.isDisposed||await this._acceptEdits(e,c,u,t)})},complete:()=>{l||(l=!0,s.queue(async()=>{this.isDisposed||(await this._acceptEdits(e,[],!0,t),await this._resolve(t.requestId,o,e),n.complete())}))}}}startDeletion(e,t,o){this._assertNotDisposed(),this._streamingEditLocks.queue(e.toString(),async()=>{if(this.isDisposed)return;await b4(this);let n;try{n=(await this._fileService.readFile(e)).value.toString()}catch{this._logService.warn(`Cannot delete file ${e.toString()}: file does not exist`);return}let r=this._getEntry(e);if(r){r.dispose();let p=this._entriesObs.get().filter(h=>h!==r);this._entriesObs.set(p,void 0)}this._initialFileContents.has(e)||this._initialFileContents.set(e,n),await this._bulkEditService.apply({edits:[{oldResource:e,options:{ignoreIfNotExists:!0}}]}),this._timeline.recordFileOperation({type:"delete",uri:e,requestId:t.requestId,epoch:this._timeline.incrementEpoch(),finalContent:n});let s=this._getTelemetryInfoForModel(t),l=this._languageService.createByFilepathOrFirstLine(e),c=this._instantiationService.createInstance(OQ,e,n,{collapse:p=>this._collapse(e,p)},s,l.languageId),u=[...this._entriesObs.get(),c];this._entriesObs.set(u,void 0)})}applyWorkspaceEdit(e,t,o){for(let n of e.edits)n.oldResource&&!n.newResource&&this.startDeletion(n.oldResource,t,o)}async startExternalEdits(e,t,o,n,r){let s=new gt,l=[],c=[],u=[],p=this._getTelemetryInfoForModel(e);await b4(this);for(let h=0;h<o.length;h++){let g=o[h],f=r?.[h],v=new Ko;c.push(v);let b=new Ko;l.push(b),this._streamingEditLocks.queue(g.toString(),async()=>{if(this.isDisposed){b.complete();return}let S;if(f)try{S=(await this._fileService.readFile(f)).value.toString()}catch{S=""}let y=await this._getOrCreateModifiedFileEntry(g,1,p,S);y&&await this._acceptStreamingEditsStart(e,n,g);let w=Zo.parse(g)?.notebook||g;return u.push(...Kln(g,this._notebookService.hasSupportedNotebooks(w),n)),S!==void 0?(y&&(y.initialContent=S,await y.resetEditTrackerToInitialContent()),s.set(g,S)):(await y?.save(),s.set(g,y&&this._getCurrentTextOrNotebookSnapshot(y))),y?.startExternalEdit(),b.complete(),v.p})}return await Promise.all(l.map(h=>h.p)),this.createSnapshot(e.requestId,n),this._externalEditOperations.set(t,{responseModel:e,snapshots:s,undoStopId:n,releaseLocks:()=>c.forEach(h=>h.complete())}),u}async stopExternalEdits(e,t,o){let n=this._externalEditOperations.get(t);if(!n)return this._logService.warn(`stopExternalEdits called for unknown operation ${t}`),[];this._externalEditOperations.delete(t);let r=[];try{let s=new gt;if(o){let l=0;for(let[c]of n.snapshots)l<o.length&&o[l]&&s.set(c,o[l]),l++}for(let[l,c]of n.snapshots){let u=this._getEntry(l);if(!u&&c===void 0&&(u=await this._getOrCreateModifiedFileEntry(l,1,this._getTelemetryInfoForModel(e),""),u&&(u.startExternalEdit(),u.acceptStreamingEditsStart(e,n.undoStopId,void 0))),!u)continue;let p,h=s.get(l);if(h)try{p=(await this._fileService.readFile(h)).value.toString()}catch{p=""}else await u.revertToDisk(),p=this._getCurrentTextOrNotebookSnapshot(u)??"";let g=[];c===void 0?this._timeline.recordFileOperation({type:"create",uri:l,requestId:e.requestId,epoch:this._timeline.incrementEpoch(),initialContent:p,telemetryInfo:u.telemetryInfo}):(g=await u.computeEditsFromSnapshots(c,p),this._recordEditOperations(u,l,g,e)),r.push(u instanceof iE?{kind:"notebookEdit",uri:l,edits:g,done:!0,isExternalEdit:!0}:{kind:"textEdit",uri:l,edits:g,done:!0,isExternalEdit:!0}),await u.acceptStreamingEditsEnd(),gl(this.chatSessionResource)==="copilotcli"&&await u.accept(),u.stopExternalEdit()}}finally{n.releaseLocks(),vt.some(this._streamingEditLocks.keys(),l=>!n.snapshots.has(A.parse(l)))||this._state.set(2,void 0)}return r.push({kind:"markdownContent",content:new Ie("\n````\n")}),r}async undoInteraction(){await this._timeline.undoToLastCheckpoint()}async redoInteraction(){await this._timeline.redoToNextCheckpoint()}async triggerExplanationGeneration(){this.clearExplanations();let e=this._entriesObs.get(),t=[];for(let o of e)if(o instanceof _oe){let n=await o.getDiffInfo();t.push({changes:n.changes,identical:n.identical,originalModel:o.originalModel,modifiedModel:o.modifiedModel})}t.length>0&&(this._explanationHandle=this._explanationModelManager.generateExplanations(t,this.chatSessionResource,Se.None),await this._explanationHandle.completed)}clearExplanations(){this._explanationHandle&&(this._explanationHandle.dispose(),this._explanationHandle=void 0)}hasExplanations(){return this._explanationHandle!==void 0}_recordEditOperations(e,t,o,n){if(o.length>0&&No(o[0],{cells:!0})){let s=o;this._timeline.recordFileOperation({type:"notebookEdit",uri:t,requestId:n.requestId,epoch:this._timeline.incrementEpoch(),cellEdits:s})}else{let s;if(e instanceof iE){let c=Zo.parse(t);if(c){let u=e.getIndexOfCellHandle(c.handle);u!==-1&&(s=u)}}let l=o;this._timeline.recordFileOperation({type:"textEdit",uri:t,requestId:n.requestId,epoch:this._timeline.incrementEpoch(),edits:l,cellIndex:s})}}_getCurrentTextOrNotebookSnapshot(e){if(e instanceof iE)return e.getCurrentSnapshot();if(e instanceof _oe)return e.getCurrentContents();if(e instanceof OQ)return"";throw new Error(`unknown entry type for ${e.modifiedURI}`)}async _acceptStreamingEditsStart(e,t,o){let n=await this._getOrCreateModifiedFileEntry(o,0,this._getTelemetryInfoForModel(e));return this._timeline.hasFileBaseline(o,e.requestId)||this._timeline.recordFileBaseline({uri:o,requestId:e.requestId,content:this._getCurrentTextOrNotebookSnapshot(n),epoch:this._timeline.incrementEpoch(),telemetryInfo:n.telemetryInfo,notebookViewType:n instanceof iE?n.viewType:void 0}),Gi(r=>{this._state.set(1,r),n.acceptStreamingEditsStart(e,t,r)}),n}async _initEntries({entries:e}){for(let o of this._entriesObs.get())e.get(o.modifiedURI)||(await o.resetToInitialContent(),o.dispose());let t=[];for(let o of e.values()){let n;if(o.isDeleted)n=this._instantiationService.createInstance(OQ,o.resource,o.original,{collapse:r=>this._collapse(o.resource,r)},o.telemetryInfo,o.languageId),await n.restoreFromSnapshot(o,!1);else if(n=await this._getOrCreateModifiedFileEntry(o.resource,1,o.telemetryInfo),n){let r=o.state===0;await n.restoreFromSnapshot(o,r)}n&&t.push(n)}this._entriesObs.set(t,void 0),this._telemetryService.publicLog2("chatEditing/sessionRestore",{editSessionId:Zrt(this.chatSessionResource),...this._countEntryStates(t)})}async _acceptEdits(e,t,o,n){let r=await this._getOrCreateModifiedFileEntry(e,0,this._getTelemetryInfoForModel(n));t.length>0&&this._recordEditOperations(r,e,t,n),await r.acceptAgentEdits(e,t,o,n)}_getTelemetryInfoForModel(e){return new class{get agentId(){return e.agent?.id}get modelId(){return e.request?.modelId}get modeId(){return e.request?.modeInfo?.modeId}get command(){return e.slashCommand?.name}get sessionResource(){return e.session.sessionResource}get requestId(){return e.requestId}get result(){return e.result}get applyCodeBlockSuggestionId(){return e.request?.modeInfo?.applyCodeBlockSuggestionId}get feature(){if(e.session.initialLocation==="panel")return"sideBarChat";if(e.session.initialLocation==="editor")return"inlineChat"}}}_countEntryStates(e){let t=0,o=0,n=0,r=0;for(let s of e)switch(t+=1,s.state.get()){case 0:o+=1;break;case 1:n+=1;break;case 2:r+=1;break}return{entryCount:t,modifiedCount:o,acceptedCount:n,rejectedCount:r}}async _resolve(e,t,o){vt.some(this._streamingEditLocks.keys(),l=>l!==o.toString())||this._state.set(2,void 0);let r=this._getEntry(o);if(!r)return;let s=t?`Request ${e} - Stop ${t}`:`Request ${e}`;return this._timeline.createCheckpoint(e,t,s),r.acceptStreamingEditsEnd()}async _getOrCreateModifiedFileEntry(e,t,o,n){e=Zo.parse(e)?.notebook??e;let r=this._entriesObs.get().find(p=>Qe(p.modifiedURI,e));if(r)if(r instanceof OQ){let p=r.state.get()===0?r.initialContent:void 0;r.dispose();let h=this._entriesObs.get().filter(g=>g!==r);this._entriesObs.set(h,void 0),p!==void 0&&(n=p)}else return o.requestId!==r.telemetryInfo.requestId&&r.updateTelemetryInfo(o),r;let s,l=this._lookupExternalEntry(e);if(l)s=l,o.requestId!==s.telemetryInfo.requestId&&s.updateTelemetryInfo(o);else{let p=n??this._initialFileContents.get(e),h=await this._createModifiedFileEntry(e,o,t,p);if(!h)return;s=h,p===void 0&&this._initialFileContents.set(e,s.initialContent)}let c=s.onDidDelete(()=>{let p=this._entriesObs.get().filter(h=>!Qe(h.modifiedURI,s.modifiedURI));this._entriesObs.set(p,void 0),this._editorService.closeEditors(this._editorService.findEditors(s.modifiedURI)),l||s.dispose(),this._store.delete(c)});this._store.add(c);let u=[...this._entriesObs.get(),s];return this._entriesObs.set(u,void 0),s}async _createModifiedFileEntry(e,t,o,n){let r={collapse:c=>this._collapse(e,c),recordOperation:c=>{c.epoch=this._timeline.incrementEpoch(),this._timeline.recordFileOperation(c)}},s=Zo.parse(e)?.notebook||e,l=async c=>{if(this._notebookService.hasSupportedNotebooks(s))return await iE.create(s,r,t,c,n,this._instantiationService);{let u=await this._textModelService.createModelReference(e);return this._instantiationService.createInstance(_oe,u,r,t,c,n)}};try{return await l(1)}catch{return o===1?void 0:(await this._bulkEditService.apply({edits:[{newResource:e}]}),this.configurationService.getValue("accessibility.openChatEditedFiles")&&this._editorService.openEditor({resource:e,options:{inactive:!0,preserveFocus:!0,pinned:!0}}),this._timeline.recordFileOperation({type:"create",uri:e,requestId:t.requestId,epoch:this._timeline.incrementEpoch(),initialContent:n||"",telemetryInfo:t}),this._notebookService.hasSupportedNotebooks(s)?await iE.create(e,r,t,0,n,this._instantiationService):await l(0))}}_collapse(e,t){let o=this._editorPane?.findDocumentDiffItem(e);o&&this._editorPane?.viewModel?.items.get().find(n=>Qe(n.originalUri,o.originalUri)&&Qe(n.modifiedUri,o.modifiedUri))?.collapsed.set(!0,t)}};FQ=I([m(4,F),m(5,Tt),m(6,_t),m(7,Bt),m(8,La),m(9,wt),m(10,ee),m(11,bn),m(12,lr),m(13,se),m(14,B),m(15,fe),m(16,Fhe),m(17,Te)],FQ);var GWe=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super();this._instantiationService=e;this._chatService=r;this._editorService=s;this._fileService=c;this.lifecycleService=u;this.notebookService=v;this._configurationService=b;this._providers=new Map;this._sessionsObs=ph({equalsFn:(e,t)=>!1},new qs);this.editingSessionsObs=ke(e=>Array.from(this._sessionsObs.read(e)));this._register(l.registerDecorationsProvider(e.createInstance(yAi,this.editingSessionsObs))),this._register(t.registerResolver(e.createInstance(ist,this.editingSessionsObs))),this._register(o.registerTextModelContentProvider(nL.scheme,e.createInstance(nL,this))),this._register(o.registerTextModelContentProvider(Q.chatEditingSnapshotScheme,e.createInstance(mq,this))),this._register(this._chatService.onDidDisposeSession(k=>{if(k.reason==="cleared")for(let T of k.sessionResources)this.getEditingSession(T)?.stop()}));let S=Yto.bindTo(n),y=()=>{let k=f.quality!=="stable"&&g.extensions.some(T=>T.enabledApiProposals?.includes("chatReadonlyPromptReference"));S.set(k)};y(),this._register(g.onDidRegisterExtensions(y)),this._register(g.onDidChangeExtensions(y));let w;this._register(p.onWillSaveState(()=>{let k=[];for(let T of this.editingSessionsObs.get())T.isGlobalEditingSession&&k.push(T.storeState());w=Promise.resolve(w).then(()=>Promise.all(k)).finally(()=>w=void 0)})),this._register(this.lifecycleService.onWillShutdown(k=>{w&&k.join(w,{id:"join.chatEditingSession",label:d(6995,null)})}))}dispose(){Be(this._sessionsObs.get()),super.dispose()}startOrContinueGlobalEditingSession(e){return this.getEditingSession(e.sessionResource)||this.createEditingSession(e,!0)}_lookupEntry(e){for(let t of vt.concat(this.editingSessionsObs.get())){let o=t.getEntry(e);if(o instanceof tE)return o.acquire()}}getEditingSession(e){return this.editingSessionsObs.get().find(t=>Qe(t.chatSessionResource,e))}createEditingSession(e,t=!1){return this._createEditingSession(e,t,void 0)}transferEditingSession(e,t){return this._createEditingSession(e,t.isGlobalEditingSession,t)}_createEditingSession(e,t,o){wo(this.getEditingSession(e.sessionResource)===void 0,"CANNOT have more than one editing session per chat session");let n=this._providers.get(e.sessionResource.scheme),r=n?n.createEditingSession(e.sessionResource):this._instantiationService.createInstance(FQ,e.sessionResource,t,this._lookupEntry.bind(this),o),s=this._sessionsObs.get(),l=s.unshift(r),c=new N;return this._store.add(c),!n&&r instanceof FQ&&c.add(this.installAutoApplyObserver(r,e)),c.add(r.onDidDispose(u=>{l(),this._sessionsObs.set(s,void 0),this._store.delete(c)})),this._sessionsObs.set(s,void 0),r}registerEditingSessionProvider(e,t){return this._providers.set(e,t),Z(()=>{this._providers.get(e)===t&&this._providers.delete(e)})}installAutoApplyObserver(e,t){if(!t)throw new pa(`Edit session was created for a non-existing chat session: ${e.chatSessionResource}`);let o=new N;return o.add(t.onDidChange(async n=>{if(n.kind!=="addRequest")return;e.createSnapshot(n.request.id,void 0);let r=n.request.response;r&&this.observerEditsInResponse(n.request.id,r,e,o)})),o.add(t.onDidDispose(()=>o.dispose())),o}observerEditsInResponse(e,t,o,n){let r;(S=>(S[S.Stream=0]="Stream",S[S.Workspace=1]="Workspace"))(r||={});let s=[],l=!1,c=U.once(this._editorService.onDidActiveEditorChange)(()=>{l=!0}),u=new gt,p=this._configurationService.getValue("accessibility.openChatEditedFiles"),h=v=>{let b=Zo.parse(v)?.notebook??v;u.has(b)||u.set(b,(async()=>{if(this.notebookService.getNotebookTextModel(b)||b.scheme===Q.untitled||await this._fileService.exists(b).catch(()=>!1)){let S=this._editorService.activeEditorPane?.input.resource,y=l||this._editorService.activeEditorPane?.input instanceof Na&&Qe(this._editorService.activeEditorPane.input.sessionResource,o.chatSessionResource)||!!(S&&o.entries.get().find(w=>Qe(S,w.modifiedURI)));this._editorService.openEditor({resource:b,options:{inactive:y,preserveFocus:!0,pinned:!0}})}})())},g=()=>{for(let v of s)v?.kind===0&&v.stream.complete();s.length=0,u.clear(),c.dispose()},f=async()=>{if(t.isCanceled)return;let v;for(let b=0;b<t.response.value.length;b++){let S=t.response.value[b];if(S.kind==="undoStop"){v=S.id;continue}if(S.kind==="workspaceEdit"){s[b]||(s[b]={kind:1},o.applyWorkspaceEdit(S,t,v??t.requestId));continue}if(S.kind!=="textEditGroup"&&S.kind!=="notebookEditGroup"||S.isExternalEdit)continue;p&&h(S.uri);let y=s[b];if(y||(y={kind:0,seen:0,stream:o.startStreamingEdits(Zo.parse(S.uri)?.notebook??S.uri,t,v)},s[b]=y),y.kind!==0)continue;let w=y.seen===0,k=S.edits.slice(y.seen);if(y.seen=S.edits.length,k.length>0||w)for(let T=0;T<k.length;T++){let P=k[T],O=S.done?T===k.length-1:!1;if(Gln(P))y.stream.pushText(P,O);else if(UDe(P))for(let V of Object.values(MI(P,H=>H.uri.toString())))V&&y.stream.pushNotebookCellText(V[0].uri,V.map(H=>H.edit),O);else y.stream.pushNotebook(P,O)}S.done&&y.stream.complete()}};if(t.isComplete)f().then(()=>{g()});else{let v=n.add(t.onDidChange(b=>{b.reason==="undoStop"?o.createSnapshot(e,b.id):f().then(()=>{t.isComplete&&(g(),n.delete(v))})}))}}};GWe=I([m(0,F),m(1,XK),m(2,Bt),m(3,X),m(4,mi),m(5,ee),m(6,Ov),m(7,fe),m(8,ji),m(9,ce),m(10,se),m(11,lt),m(12,tt),m(13,bn),m(14,B)],GWe);function kCo(a,i,e){let t=e.add(new E);return e.add(Vs(a,(o,n)=>{let r=lP(n||[],o,i),s=[].concat(r.added).concat(r.removed);t.fire(s)})),t.event}var yAi=class extends x{constructor(e){super();this._sessions=e;this.label=d(6993,null);this._currentEntries=ke(this,e=>{let t=this._sessions.read(e);if(!t)return[];let o=[];for(let n of t)if(n.state.read(e)!==3){let r=n.entries.read(e);o.push(...r)}return o});this._currentlyEditingUris=ke(this,e=>this._currentEntries.read(e).filter(o=>o.isCurrentlyBeingModifiedBy.read(e)).map(o=>o.modifiedURI));this._modifiedUris=ke(this,e=>this._currentEntries.read(e).filter(o=>!o.isCurrentlyBeingModifiedBy.read(e)&&o.state.read(e)===0).map(o=>o.modifiedURI));this.onDidChange=U.any(kCo(this._currentlyEditingUris,cl(t=>t.toString(),Hl),this._store),kCo(this._modifiedUris,cl(t=>t.toString(),Hl),this._store))}provideDecorations(e,t){if(this._currentlyEditingUris.get().some(r=>Qe(r,e)))return{weight:1e3,letter:q.modify(R.loading,"spin"),bubble:!1};if(this._modifiedUris.get().some(r=>Qe(r,e)))return{weight:1e3,letter:R.diffModified,tooltip:d(6994,null),bubble:!0}}},ist=class{constructor(i,e){this._editingSessionsObs=i;this._instantiationService=e}canHandleUri(i){return i.scheme===$K}async resolveDiffSource(i){let e=P9e(i),t=ke(this,o=>this._editingSessionsObs.read(o).find(n=>Qe(n.chatSessionResource,e.chatSessionResource)));return this._instantiationService.createInstance(wAi,t,e.showPreviousChanges)}};ist=I([m(1,F)],ist);var wAi=class{constructor(i,e){this._currentSession=i;this._showPreviousChanges=e;this._resources=ke(this,i=>{let e=this._currentSession.read(i);return e?e.entries.read(i).map(o=>{if(this._showPreviousChanges){let r=e.getEntryDiffBetweenStops(o.modifiedURI,void 0,void 0)?.read(i);if(r)return new xk(r.originalURI,r.modifiedURI,void 0,void 0,{[DTe.key]:o.entryId})}return new xk(o.originalURI,o.modifiedURI,void 0,void 0,{[DTe.key]:o.entryId})}):[]});this.resources=new sO(this._resources);this.contextKeys={[kRt.key]:!0}}};function Gln(a){return a.some(i=>SE.isTextEdit(i))}var ost=le("browserElementsService");var CAi=le("nativeBrowserElementsService");function _Co(a){let i=a.match(/^<([^ >]+)([^>]*?)>/);if(!i)throw new Error("No outer element found");let e=i[1],t=i[2].match(/\s+id\s*=\s*["']([^"']+)["']/i),o=t?`#${t[1]}`:"",n=i[2].match(/\s+class\s*=\s*["']([^"']+)["']/i),r=n?`.${n[1].replace(/\s+/g,".")}`:"";return`${e}${o}${r}`}function qln(a){if(!(!a||a.length===0))return a.map(i=>{let e=i.classNames?.length?`.${i.classNames.join(".")}`:"",t=i.id?`#${i.id}`:"";return`${i.tagName}${t}${e}`}).join(" > ")}function ECo(a,i){let e=`${i}-top`,t=`${i}-right`,o=`${i}-bottom`,n=`${i}-left`,r=a.get(e),s=a.get(t),l=a.get(o),c=a.get(n);if(!(r===void 0||s===void 0||l===void 0||c===void 0))return a.delete(e),a.delete(t),a.delete(o),a.delete(n),`${r} ${s} ${l} ${c}`}function TCo(a){if(!a||Object.keys(a).length===0)return;let i=new Map(Object.entries(a)),e=[],t=ECo(i,"margin");t&&e.push(`- margin: ${t}`);let o=ECo(i,"padding");o&&e.push(`- padding: ${o}`);for(let[n,r]of Array.from(i.entries()).sort(([s],[l])=>s.localeCompare(l)))e.push(`- ${n}: ${r}`);return e.join(`
`)}function DCo(a,i,e){let t=[];t.push("Attached Element Context from Integrated Browser"),t.push(`Element: ${i}`);let o=qln(a.ancestors);o&&t.push(`HTML Path:
${o}`);let n=TCo(a.attributes);if(n&&t.push(`Attributes:
${n}`),e){let s=TCo(a.computedStyles);s&&t.push(`Computed Styles:
${s}`)}if(a.dimensions){let{top:s,left:l,width:c,height:u}=a.dimensions;t.push(`Dimensions:
- top: ${Math.round(s)}px
- left: ${Math.round(l)}px
- width: ${Math.round(c)}px
- height: ${Math.round(u)}px`)}let r=a.innerText?.trim();return r&&t.push(`Inner Text:
\`\`\`text
${r}
\`\`\``),t.push(`Outer HTML:
\`\`\`html
${a.outerHTML}
\`\`\``),e&&t.push(`Full Computed CSS:
\`\`\`css
${a.computedStyle}
\`\`\``),t.join(`

`)}var nst=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h){this._editor=i;this._container=e;this._hostService=t;this._chatWidgetService=o;this.fileService=n;this.environmentService=r;this.logService=s;this.configurationService=l;this._preferencesService=c;this._browserElementsService=u;this.contextMenuService=p;this.telemetryService=h;this._showStore=new N;this._timeout=void 0;this._activeLocator=void 0;this._browserType=void 0;this._showStore.add(this.configurationService.onDidChangeConfiguration(ae=>{ae.affectsConfiguration("chat.sendElementsToChat.enabled")&&(this.configurationService.getValue("chat.sendElementsToChat.enabled")?this.showElement(this._domNode):this.hideElement(this._domNode))})),this.imagesFolder=Ge(this.environmentService.workspaceStorageHome,"vscode-chat-images"),TDt(this.fileService,this.logService,this.imagesFolder),this._domNode=document.createElement("div"),this._domNode.className="element-selection-message";let g=document.createElement("div");g.className="element-selection-main-content";let f=document.createElement("span"),v=d(6510,null);f.textContent=v,g.appendChild(f);let b,S=[];S.push(ii({id:"singleSelection",label:d(6514,null),enabled:!0,run:async()=>{await J()}}),ii({id:"continuousSelection",label:d(6506,null),enabled:!0,run:async()=>{for(this._editor.focus(),b=new Ye,f.textContent=d(6509,null),this.hideElement(y.element),this.showElement(w.element),w.label=d(6511,null);!b.token.isCancellationRequested;)try{await this.addElementToChat(b)}catch(ae){this.logService.error("Failed to select this element.",ae),b.cancel();break}f.textContent=d(6508,null),$()}}));let y=this._showStore.add(new ry(g,{actions:S,addPrimaryActionToDropdown:!1,contextMenuProvider:this.contextMenuService,supportShortLabel:!0,title:d(6513,null),supportIcons:!0,...Qo}));y.primaryButton.label=d(6515,null),y.element.classList.add("element-selection-start");let w=this._showStore.add(new Wi(g,{...Qo,supportIcons:!0,title:d(6499,null)}));w.element.className="element-selection-cancel hidden";let k=d(6500,null);w.label=k;let T=this._showStore.add(new Wi(g,{supportIcons:!0,title:d(6501,null)}));T.icon=R.gear;let P=this._showStore.add(new Wi(g,{supportIcons:!0,title:d(6503,null)}));P.icon=R.chevronRight;let O=this._showStore.add(new Wi(g,{supportIcons:!0,title:d(6504,null)}));O.icon=R.close,O.element.classList.add("hidden");let V=document.createElement("div");V.className="element-expand-container hidden";let H=this._showStore.add(new Wi(V,{supportIcons:!0,title:d(6502,null)}));H.icon=R.layout,this._domNode.appendChild(g),this._domNode.appendChild(V);let G=()=>{this.hideElement(O.element),this.showElement(y.element),this.showElement(P.element)},$=()=>{this.hideElement(w.element),w.label=k,this.hideElement(P.element),this.showElement(O.element),this._timeout=setTimeout(()=>{f.textContent=v,G()},3e3)},J=async()=>{b=new Ye,this._editor.focus(),f.textContent=d(6509,null),this.hideElement(y.element),this.showElement(w.element),await this.addElementToChat(b),f.textContent=d(6508,null),$()};this._showStore.add(j(y.primaryButton.element,"click",async()=>{await J()})),this._showStore.add(j(w.element,"click",()=>{b.cancel(),f.textContent=d(6507,null),$()})),this._showStore.add(j(P.element,"click",()=>{this.hideElement(g),this.showElement(V)})),this._showStore.add(j(H.element,"click",()=>{this.showElement(g),this.hideElement(V)})),this._showStore.add(j(O.element,"click",()=>{clearTimeout(this._timeout),f.textContent=v,G()})),this._showStore.add(j(T.element,"click",()=>{this._preferencesService.openSettings({jsonEditor:!1,query:"@id:chat.sendElementsToChat.enabled,chat.sendElementsToChat.attachCSS,chat.sendElementsToChat.attachImages"})}))}setActiveLocator(i,e){this._activeLocator=i,this._browserType=e}hideElement(i){i.classList.contains("hidden")||i.classList.add("hidden")}showElement(i){i.classList.contains("hidden")&&i.classList.remove("hidden")}async addElementToChat(i){this.telemetryService.publicLog2("simpleBrowser.addElementToChat.start",{browserType:this._browserType});let e=this._container.querySelector(".editor-container"),t=e?e.getBoundingClientRect():this._container.getBoundingClientRect(),o=await this._browserElementsService.getElementData({x:t.x,y:t.y+32.4,width:t.width,height:t.height-32.4},i.token,this._activeLocator);if(!o)throw new Error("Element data not found");let n=o.bounds,r=[],s=await this._chatWidgetService.revealWidget()??this._chatWidgetService.lastFocusedWidget,l=this.configurationService.getValue("chat.sendElementsToChat.attachCSS"),c=(l?"Attached HTML and CSS Context":"Attached HTML Context")+`

`+o.outerHTML;l&&(c+=`

`+o.computedStyle);let u=_Co(o.outerHTML);if(r.push({id:"element-"+Date.now(),name:u,fullName:u,value:c,kind:"element",icon:q.fromId(R.layout.id),ancestors:o.ancestors,attributes:o.attributes,computedStyles:l?o.computedStyles:void 0,dimensions:o.dimensions,innerText:o.innerText}),this.configurationService.getValue("chat.sendElementsToChat.attachImages")){this._domNode.style.display="none",await new Promise(g=>setTimeout(g,100));let p=await this._hostService.getScreenshot(n);if(!p)throw new Error("Screenshot failed");let h=await EDt(this.fileService,this.imagesFolder,p.buffer,"image/png");r.push({id:"element-screenshot-"+Date.now(),name:"Element Screenshot",fullName:"Element Screenshot",kind:"image",value:p.buffer,references:h?[{reference:h,kind:"reference"}]:[]}),this._domNode.style.display=""}s?.attachmentModel?.addContext(...r),this.telemetryService.publicLog2("simpleBrowser.addElementToChat.added",{browserType:this._browserType,attachCss:l,attachImages:this.configurationService.getValue("chat.sendElementsToChat.attachImages")??!1})}dispose(){this._showStore.dispose()}getDomNode(){return this._domNode}};nst=I([m(2,Zt),m(3,Pt),m(4,fe),m(5,Eo),m(6,se),m(7,B),m(8,Go),m(9,ost),m(10,Xe),m(11,Te)],nst);var rst=class{constructor(i,e,t,o,n,r){this.configurationService=o;this._browserElementsService=n;this.contextKeyService=r;this._store=new N;this._domNode=document.createElement("div");this._domNode.classList.add("chat-simple-browser-overlay"),this._domNode.style.position="absolute",this._domNode.style.bottom="5px",this._domNode.style.right="5px",this._domNode.style.zIndex="100";let s=t.createInstance(nst,e,i);this._domNode.appendChild(s.getDomNode()),this._store.add(Z(()=>this._domNode.remove())),this._store.add(s);let l=document.createElement("div");l.className="connecting-webview-element";let c=new Ye,u=async(b,S)=>{s.setActiveLocator(b,S),l.textContent=d(6505,null),i.contains(l)||i.appendChild(l),c.cancel(),c=new Ye;try{await this._browserElementsService.startDebugSession(c.token,b)}catch{l.textContent=d(6512,null);return}c.token.isCancellationRequested||(i.contains(this._domNode)||i.appendChild(this._domNode),l.remove())},p=()=>{s.setActiveLocator(void 0,void 0),c.cancel(),i.contains(this._domNode)&&this._domNode.remove(),l.remove()},h=Fr(this,U.any(e.onDidActiveEditorChange,e.onDidModelChange)),g=Os({},b=>{h.read(b);let S=e.activeEditorPane,y=S?.input.editorId==="mainThreadWebview-simpleBrowser.view",w=S?.input.editorId==="mainThreadWebview-browserPreview";if(y||w){let k=S.input,T=y?"simpleBrowser":"livePreview";return{webviewId:k.webview.container.id,browserType:T}}}),f=Y8i(ie.enabled.key,this.contextKeyService),v=hr("chat.sendElementsToChat.enabled",!0,this.configurationService);this._store.add(be(b=>{let S=g.read(b),y=f.read(b),w=v.read(b);if(!y||!w||!S){p();return}u({webviewId:S.webviewId},S.browserType)}))}dispose(){this._store.dispose()}};rst=I([m(2,F),m(3,B),m(4,ost),m(5,X)],rst);var Cfe=class{constructor(i,e){this._store=new N;let t=ui(this,U.any(i.onDidAddGroup,i.onDidRemoveGroup),()=>i.groups),o=this._store.add(new Vt);this._store.add(be(n=>{let r=new Set(o.keys()),s=t.read(n);for(let l of s)if(l instanceof Wb&&(r.delete(l),!o.has(l))){let c=e.createChild(new _o([X,l.scopedContextKeyService])),u=l.element,p=c.createInstance(rst,u,l);o.set(l,wn(p,c))}for(let l of r)o.deleteAndDispose(l)}))}static{this.ID="chat.simpleBrowser.overlay"}dispose(){this._store.dispose()}};Cfe=I([m(0,wt),m(1,F)],Cfe);var $ln=13,qWe=class extends x{constructor(i){super();let e=hr("chat.fontFamily","default",i);this.fontFamily=ke(t=>{let o=e.read(t);return o==="default"?null:o}),this.fontSize=hr("chat.fontSize",$ln,i)}};qWe=I([m(0,B)],qWe);var $We=class extends x{constructor(e,t,o,n,r,s,l){super();this.fileService=e;this.textFileService=t;this.textModelService=o;this.editorService=n;this.textEditorService=r;this._onDidChangeLanguageModelGroups=this._register(new E);this.onDidChangeLanguageModelGroups=this._onDidChangeLanguageModelGroups.event;this.languageModelsProviderGroups=[];this.modelsConfigurationFile=l.extUri.joinPath(s.currentProfile.location,"chatLanguageModels.json"),this.updateLanguageModelsConfiguration(),this._register(e.watch(this.modelsConfigurationFile)),this._register(e.onDidFilesChange(c=>{c.contains(this.modelsConfigurationFile)&&this.updateLanguageModelsConfiguration()}))}get configurationFile(){return this.modelsConfigurationFile}setLanguageModelsConfiguration(e){let t=[],o=new Map(this.languageModelsProviderGroups.map(r=>[`${r.vendor}:${r.name}`,r])),n=new Map(e.map(r=>[`${r.vendor}:${r.name}`,r]));for(let[r,s]of n){let l=o.get(r);(!l||!eo(l,s))&&t.push(s)}for(let[r,s]of o)n.has(r)||t.push(s);this.languageModelsProviderGroups=e,t.length>0&&this._onDidChangeLanguageModelGroups.fire(t)}async updateLanguageModelsConfiguration(){let e=await this.withLanguageModelsProviderGroups();this.setLanguageModelsConfiguration(e)}getLanguageModelsProviderGroups(){return this.languageModelsProviderGroups}async addLanguageModelsProviderGroup(e){await this.withLanguageModelsProviderGroups(async o=>{if(o.some(({name:n,vendor:r})=>n===e.name&&r===e.vendor))throw new Error(`Language model group with name ${e.name} already exists for vendor ${e.vendor}`);return o.push(e),o}),await this.updateLanguageModelsConfiguration();let t=this.getLanguageModelsProviderGroups().find(o=>o.name===e.name&&o.vendor===e.vendor);if(!t)throw new Error(`Language model group with name ${e.name} not found for vendor ${e.vendor}`);return t}async updateLanguageModelsProviderGroup(e,t){await this.withLanguageModelsProviderGroups(async n=>{let r=[];for(let s of n)s.name===e.name&&s.vendor===e.vendor?r.push(t):r.push(s);return r}),await this.updateLanguageModelsConfiguration();let o=this.getLanguageModelsProviderGroups().find(n=>n.name===t.name&&n.vendor===t.vendor);if(!o)throw new Error(`Language model group with name ${t.name} not found for vendor ${t.vendor}`);return o}async removeLanguageModelsProviderGroup(e){await this.withLanguageModelsProviderGroups(async t=>{let o=[];for(let n of t)n.name===e.name&&n.vendor===e.vendor||o.push(n);return o}),await this.updateLanguageModelsConfiguration()}async configureLanguageModels(e){let t=await this.editorService.openEditor(this.textEditorService.createTextEditor({resource:this.modelsConfigurationFile}));if(!t||!e?.group)return;let o=ha(t.getControl());if(o&&e.group.range)if(e.snippet){let n=o.getModel();if(!n)return;let r=e.group.range.endLineNumber-1,s=n.getLineLength(r),l={lineNumber:r,column:s+1};o.setPosition(l),o.revealPositionNearTop(l),o.focus(),vs.get(o)?.insert(`,
`+e.snippet)}else{let n={lineNumber:e.group.range.startLineNumber,column:e.group.range.startColumn};o.setPosition(n),o.revealPositionNearTop(n),o.focus()}}async withLanguageModelsProviderGroups(e){await this.fileService.exists(this.modelsConfigurationFile)||await this.fileService.writeFile(this.modelsConfigurationFile,qe.fromString(JSON.stringify([],void 0,"	")));let o=await this.textModelService.createModelReference(this.modelsConfigurationFile),n=o.object.textEditorModel;try{let r=jln(n);if(!e)return r;let s=await e(r);for(let l of s)delete l.range;return n.setValue(JSON.stringify(s,void 0,"	")),await this.textFileService.save(this.modelsConfigurationFile),s}finally{o.dispose()}}};$We=I([m(0,fe),m(1,Uo),m(2,Bt),m(3,ee),m(4,Pk),m(5,ln),m(6,ht)],$We);function jln(a){let i=[],e=null,t=i,o=[];function n(s,l,c){Array.isArray(t)?t.push(s):e!==null&&(t[e]=s)}let r={onObjectBegin:(s,l)=>{let c={};if(o.length===1&&Array.isArray(t)){let u=a.getPositionAt(s),p=a.getPositionAt(s+l);c.range={startLineNumber:u.lineNumber,startColumn:u.column,endLineNumber:p.lineNumber,endColumn:p.column}}n(c,s,l),o.push(t),t=c,e=null},onObjectProperty:(s,l,c)=>{e=s},onObjectEnd:(s,l)=>{let c=t;if(c.range){let u=a.getPositionAt(s+l);c.range={startLineNumber:c.range.startLineNumber,startColumn:c.range.startColumn,endLineNumber:u.lineNumber,endColumn:u.column}}if(c._parentConfigurationRange){let u=a.getPositionAt(s+l);c._parentConfigurationRange.endLineNumber=u.lineNumber,c._parentConfigurationRange.endColumn=u.column,delete c._parentConfigurationRange}t=o.pop()},onArrayBegin:(s,l)=>{if(t===i&&o.length===0){o.push(t),e=null;return}let c=[];n(c,s,l),o.push(t),t=c,e=null},onArrayEnd:(s,l)=>{let c=t;if(c._parentConfigurationRange){let u=a.getPositionAt(s+l);c._parentConfigurationRange.endLineNumber=u.lineNumber,c._parentConfigurationRange.endColumn=u.column,delete c._parentConfigurationRange}t=o.pop()},onLiteralValue:(s,l,c)=>{n(s,l,c)}};return uk(a.getValue(),r),i}var LCo="vscode://schemas/language-models",xfe=class extends x{constructor(e,t){super();this.languageModelsService=e;let o=ne.as(ma.JSONContribution);this._register(o.registerSchemaAssociation(LCo,t.configurationFile.toString())),this.updateSchema(o),this._register(this.languageModelsService.onDidChangeLanguageModels(()=>this.updateSchema(o)))}static{this.ID="workbench.contrib.chatLanguageModelsData"}updateSchema(e){let t=this.languageModelsService.getVendors(),o=[],n=this.languageModelsService.getLanguageModelIds();for(let s of n){let l=this.languageModelsService.lookupLanguageModel(s);l?.configurationSchema&&o.push({if:{properties:{vendor:{const:l.vendor}}},then:{properties:{settings:{type:"object",properties:{[l.id]:l.configurationSchema}}}}})}let r={type:"array",items:{properties:{vendor:{type:"string",enum:t.map(s=>s.vendor)},name:{type:"string"},settings:{type:"object",description:d(7376,null)}},allOf:[...t.map(s=>({if:{properties:{vendor:{const:s.vendor}}},then:s.configuration})),...o],required:["vendor","name"]}};e.registerSchema(LCo,r)}};xfe=I([m(0,ds),m(1,s4)],xfe);var Qln=Ae("ai-management-editor-label-icon",R.copilot,d(7019,null)),Yln=Ae("models-management-editor-label-icon",R.settings,d(7021,null)),Fqt="usage",Wqt="models",jWe=class a extends ls{constructor(){super();this.resource=void 0}static{this.ID="workbench.input.chatManagement"}matches(e){return super.matches(e)||e instanceof a}get typeId(){return a.ID}getName(){return d(7018,null)}getIcon(){return Qln}async resolve(){return null}},kfe=class a extends ls{constructor(){super();this.resource=void 0}static{this.ID="workbench.input.modelsManagement"}get capabilities(){return super.capabilities|8|2048}matches(e){return super.matches(e)||e instanceof a}get typeId(){return a.ID}getName(){return d(7020,null)}getIcon(){return Yln}async resolve(){return null}};var Xln="model.entry.template",Jln="vendor.entry.template",RCo="group.entry.template",Zln=VO(aY,dw),xAi=/@capability:\s*([^\s]+)/gi,MCo=/@visible:\s*(true|false)/i,kAi=/@provider:\s*((".+?")|([^\s]+))/gi,sst={FILTER_TYPES:["@provider:","@capability:","@visible:"],CAPABILITIES:["@capability:tools","@capability:vision","@capability:agent"],VISIBILITY:["@visible:true","@visible:false"]};function CN(a){return a.type==="vendor"}function mU(a){return a.type==="group"}function YWe(a){return a.type==="status"}var QWe=class extends x{constructor(e){super();this.languageModelsService=e;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._onDidChangeGrouping=this._register(new E);this.onDidChangeGrouping=this._onDidChangeGrouping.event;this.languageModelGroupStatuses=[];this.languageModelGroups=[];this.collapsedGroups=new Set;this.searchValue="";this.modelsSorted=!1;this._groupBy="vendor";this._viewModelEntries=[];this.languageModels=[],this._register(this.languageModelsService.onDidChangeLanguageModels(t=>this.refreshVendor(t)))}get groupBy(){return this._groupBy}set groupBy(e){this._groupBy!==e&&(this._groupBy=e,this.collapsedGroups.clear(),this.languageModelGroups=this.groupModels(this.languageModels),this.doFilter(),this._onDidChangeGrouping.fire(e))}get viewModelEntries(){return this._viewModelEntries}splice(e,t,o){this._viewModelEntries.splice(e,t,...o),this.selectedEntry&&(this.selectedEntry=this._viewModelEntries.find(n=>n.id===this.selectedEntry?.id)),this._onDidChange.fire({at:e,removed:t,added:o})}shouldRefilter(){return!this.modelsSorted}filter(e){return e!==this.searchValue&&(this.searchValue=e,this.collapsedGroups.clear(),this.modelsSorted||(this.languageModelGroups=this.groupModels(this.languageModels)),this.doFilter()),this.viewModelEntries}doFilter(){let e=[],t=this.languageModelGroups.length>1;for(let o of this.languageModelGroups){if(this.collapsedGroups.has(o.group.id)){o.group.collapsed=!0,t&&e.push(o.group);continue}let n=[];o.status&&n.push(o.status),n.push(...this.filterModels(o.models,this.searchValue)),n.length>0&&(o.group.collapsed=!1,t&&e.push(o.group),e.push(...n))}this.splice(0,this._viewModelEntries.length,e)}filterModels(e,t){let o,n=MCo.exec(t);n&&n[1]&&(o=n[1].toLowerCase()==="true",t=t.replace(MCo,""));let r=[],s;for(kAi.lastIndex=0;(s=kAi.exec(t))!==null;){let b=s[2]?s[2].substring(1,s[2].length-1):s[3];r.push(b)}r.length>0&&(t=t.replace(kAi,""));let l=[],c;for(xAi.lastIndex=0;(c=xAi.exec(t))!==null;)l.push(c[1].toLowerCase());l.length>0&&(t=t.replace(xAi,""));let u=t.charAt(0)==='"',p=t.charAt(t.length-1)==='"',h=u&&p;u&&(t=t.substring(1)),p&&(t=t.substring(0,t.length-1)),t=t.trim();let g=[],f=t.split(" "),v=r.map(b=>b.toLowerCase().trim());for(let b of e){if(o!==void 0&&b.visible!==o||v.length>0&&!v.some(T=>b.provider.vendor.vendor.toLowerCase()===T||b.provider.vendor.displayName.toLowerCase()===T))continue;let S=[];if(l.length>0){if(!b.metadata.capabilities)continue;let k=!0;for(let T of l){let P=this.getMatchingCapabilities(b,T);if(P.length===0){k=!1;break}S.push(...P)}if(!k)continue;S=zo(S)}let y;if(t&&(y=new EAi(b,t,f,h),!y.modelNameMatches&&!y.modelIdMatches&&!y.providerMatches&&!y.capabilityMatches))continue;let w=this.getModelId(b);g.push({type:"model",id:w,templateId:Xln,model:b,modelNameMatches:y?.modelNameMatches||void 0,modelIdMatches:y?.modelIdMatches||void 0,providerMatches:y?.providerMatches||void 0,capabilityMatches:S.length?S:void 0})}return g}getMatchingCapabilities(e,t){let o=[];if(!e.metadata.capabilities)return o;switch(t){case"tools":case"toolcalling":e.metadata.capabilities.toolCalling===!0&&o.push("toolCalling");break;case"vision":e.metadata.capabilities.vision===!0&&o.push("vision");break;case"agent":case"agentmode":e.metadata.capabilities.agentMode===!0&&o.push("agentMode");break;default:if(e.metadata.capabilities.editTools)for(let n of e.metadata.capabilities.editTools)n.toLowerCase().includes(t)&&o.push(n);break}return o}groupModels(e){let t=[];if(this.groupBy==="visibility"){let o=[],n=[];for(let r of e)r.visible?o.push(r):n.push(r);t.push({group:{type:"group",id:"visible",label:d(7023,null),templateId:RCo,collapsed:this.collapsedGroups.has("visible")},models:o}),t.push({group:{type:"group",id:"hidden",label:d(7022,null),templateId:RCo,collapsed:this.collapsedGroups.has("hidden")},models:n})}else if(this.groupBy==="vendor"){for(let o of e){let n=this.getProviderGroupId(o.provider.group),r=t.find(s=>s.group.id===n);r||(r={group:this.createLanguageModelProviderEntry(o.provider),models:[]},t.push(r)),r.models.push(o)}for(let o of this.languageModelGroupStatuses){let n=this.getProviderGroupId(o.provider.group),r=t.find(s=>s.group.id===n);r||(r={group:this.createLanguageModelProviderEntry(o.provider),models:[]},t.push(r)),r.status={id:`status.${r.group.id}`,type:"status",...o.status}}t.sort((o,n)=>o.models[0]?.provider.vendor.isDefault?-1:n.models[0]?.provider.vendor.isDefault?1:o.group.label.localeCompare(n.group.label))}for(let o of t)o.models.sort((n,r)=>n.provider.vendor.isDefault&&r.provider.vendor.isDefault?n.metadata.name.localeCompare(r.metadata.name):n.provider.vendor.isDefault?-1:r.provider.vendor.isDefault?1:n.provider.group.name===r.provider.group.name?n.metadata.name.localeCompare(r.metadata.name):n.provider.group.name.localeCompare(r.provider.group.name));return this.modelsSorted=!0,t}createLanguageModelProviderEntry(e){let t=this.getProviderGroupId(e.group);return{type:"vendor",id:t,label:e.group.name,templateId:Jln,collapsed:this.collapsedGroups.has(t),vendorEntry:{group:e.group,vendor:e.vendor}}}getVendors(){return[...this.languageModelsService.getVendors()].sort((e,t)=>e.isDefault?-1:t.isDefault?1:e.displayName.localeCompare(t.displayName))}async refresh(){await this.languageModelsService.selectLanguageModels({}),await this.refreshAllVendors()}async refreshAllVendors(){this.languageModels=[],this.languageModelGroupStatuses=[];for(let e of this.getVendors())this.addVendorModels(e);this.languageModelGroups=this.groupModels(this.languageModels),this.doFilter()}refreshVendor(e){let t=this.getVendors().find(o=>o.vendor===e);t&&(this.languageModels=this.languageModels.filter(o=>o.provider.vendor.vendor!==e),this.languageModelGroupStatuses=this.languageModelGroupStatuses.filter(o=>o.provider.vendor.vendor!==e),this.addVendorModels(t),this.languageModelGroups=this.groupModels(this.languageModels),this.doFilter())}addVendorModels(e){let t=[],o=this.languageModelsService.getLanguageModelGroups(e.vendor);for(let n of o){let r={group:n.group??{vendor:e.vendor,name:e.displayName},vendor:e};n.status&&this.languageModelGroupStatuses.push({provider:r,status:{message:n.status.message,severity:n.status.severity}});for(let s of n.modelIdentifiers){let l=this.languageModelsService.lookupLanguageModel(s);l&&(e.isDefault&&l.id==="auto"||t.push({identifier:s,metadata:l,provider:r,visible:l.isUserSelectable??!1}))}}this.languageModels.push(...t.sort((n,r)=>n.metadata.name.localeCompare(r.metadata.name)))}toggleVisibility(e){let t=!e.model.visible;this.languageModelsService.updateModelPickerPreference(e.model.identifier,t);let o=this.languageModelsService.lookupLanguageModel(e.model.identifier),n=this.viewModelEntries.indexOf(e);o&&n!==-1&&(e.model.visible=t,e.model.metadata=o,e.id=this.getModelId(e.model),this.groupBy==="visibility"&&(this.modelsSorted=!1),this.splice(n,1,[e]))}setModelsVisibility(e,t){for(let o of e)this.languageModelsService.updateModelPickerPreference(o.model.identifier,t),o.model.visible=t;this.languageModelGroups=this.groupModels(this.languageModels),this.doFilter()}setGroupVisibility(e,t){let o=this.getModelsForGroup(e);for(let n of o)this.languageModelsService.updateModelPickerPreference(n.identifier,t),n.visible=t;this.languageModelGroups=this.groupModels(this.languageModels),this.doFilter()}getModelsForGroup(e){return CN(e)?this.languageModels.filter(t=>this.getProviderGroupId(t.provider.group)===e.id):this.languageModels.filter(t=>e.id==="visible"&&t.visible||e.id==="hidden"&&!t.visible)}getModelId(e){return`${e.provider.group.name}.${e.identifier}.${e.metadata.version}-visible:${e.visible}`}getProviderGroupId(e){return`${e.vendor}-${e.name}`}toggleCollapsed(e){let t=mU(e)||CN(e)?e.id:void 0;t&&(this.selectedEntry=e,this.collapsedGroups.delete(t)||this.collapsedGroups.add(t),this.doFilter())}collapseAll(){this.collapsedGroups.clear();for(let e of this.viewModelEntries)(CN(e)||mU(e))&&this.collapsedGroups.add(e.id);this.doFilter()}getConfiguredVendors(){let e=[],t=new Set;for(let o of this.languageModels)t.has(o.provider.group.name)||(t.add(o.provider.group.name),e.push(o.provider));return e}};QWe=I([m(0,ds)],QWe);var EAi=class{constructor(i,e,t,o){this.modelNameMatches=null;this.modelIdMatches=null;this.providerMatches=null;this.capabilityMatches=null;if(!o&&(this.modelNameMatches=i.metadata.name?this.matches(e,i.metadata.name,(n,r)=>dw(n,r,!0),t):null,this.modelIdMatches=this.matches(e,i.metadata.id,VO(dw,lY),t),this.providerMatches=this.matches(e,i.provider.group.name,(n,r)=>dw(n,r,!0),t),i.metadata.capabilities)){let n=[];i.metadata.capabilities.toolCalling&&n.push("tools","toolCalling"),i.metadata.capabilities.vision&&n.push("vision"),i.metadata.capabilities.agentMode&&n.push("agent","agentMode"),i.metadata.capabilities.editTools&&n.push(...i.metadata.capabilities.editTools);let r=n.join(" ");r&&(this.capabilityMatches=this.matches(e,r,VO(dw,lY),t))}}matches(i,e,t,o){let n=i?Zln(i,e):null;return n||(n=this.matchesWords(o,e,t)),n&&(n=this.filterAndSort(n)),n}matchesWords(i,e,t){let o=[];for(let n of i){let r=t(n,e);if(r)o=[...o||[],...r];else{o=null;break}}return o}filterAndSort(i){return zo(i,(e=>e.start+"."+e.end)).filter(e=>!i.some(t=>!(t.start===e.start&&t.end===e.end)&&t.start<=e.start&&t.end>=e.end)).sort((e,t)=>e.start-t.start)}};var xx=_,ecn=30,tcn=30,icn=26;var TAi=class extends it{constructor(){super("workbench.models.filter",d(7033,null),q.asClassName(R.filter))}async run(){}};function PCo(a,i){let{query:e,synonyms:t=[],excludes:o=[]}=i,n=[e,...t],r=n.some(l=>a.includes(l)),s=o.some(l=>a.includes(l));if(r){let l=a;for(let c of n)l=l.replace(c,"");return l.replace(/\s+/g," ").trim()}else if(s){let l=a;for(let c of o)l=l.replace(c,"");return l=l.replace(/\s+/g," ").trim(),l?`${l} ${e}`:e}else{let l=a.trim();return l?`${l} ${e}`:e}}var ast=class extends Pm{constructor(e,t,o,n,r){super(e,{getActions:()=>this.getActions()},r,{...t,classNames:e.class,anchorAlignmentProvider:()=>1,menuAsChild:!0});this.search=o;this.viewModel=n}createGroupByAction(e,t){return{id:`groupBy.${e}`,label:t,class:void 0,enabled:!0,tooltip:d(7042,null,t),checked:this.viewModel.groupBy===e,run:()=>{this.viewModel.groupBy=e}}}createProviderAction(e,t){let o=`@provider:"${t}"`,n=this.search.getValue(),r=n.includes(o)||n.includes(`@provider:${e}`);return{id:`provider-${e}`,label:t,tooltip:d(7037,null,t),class:void 0,enabled:!0,checked:r,run:()=>this.toggleFilterAndSearch({query:o,synonyms:[`@provider:${e}`]})}}createCapabilityAction(e,t){let o=`@capability:${e}`,r=this.search.getValue().includes(o);return{id:`capability-${e}`,label:t,tooltip:d(7036,null,t),class:void 0,enabled:!0,checked:r,run:()=>this.toggleFilterAndSearch({query:o})}}createVisibleAction(e,t){let o=`@visible:${e}`,r=this.search.getValue().includes(o);return{id:`visible-${e}`,label:t,tooltip:d(7038,null,t),class:void 0,enabled:!0,checked:r,run:()=>this.toggleFilterAndSearch({query:o,excludes:[`@visible:${!e}`]})}}toggleFilterAndSearch(e){let t=this.search.getValue(),o=PCo(t,e);this.search.setValue(o)}getActions(){let e=[];e.push(this.createCapabilityAction("tools",d(7026,null)),this.createCapabilityAction("vision",d(7027,null)),this.createCapabilityAction("agent",d(7025,null))),e.push(new ri),e.push(this.createVisibleAction(!0,d(7035,null))),e.push(this.createVisibleAction(!1,d(7034,null)));let t=this.viewModel.getConfiguredVendors();t.length>1&&(e.push(new ri),e.push(...t.map(n=>this.createProviderAction(n.vendor.vendor,n.group.name)))),e.push(new ri);let o=[];return o.push(this.createGroupByAction("vendor",d(7040,null))),o.push(this.createGroupByAction("visibility",d(7041,null))),e.push(new Fs("groupBy",d(7039,null),o)),e}};ast=I([m(4,Xe)],ast);var _Ai=class{constructor(){this.headerRowHeight=ecn}getHeight(i){return CN(i)||mU(i)?tcn:icn}},WQ=class{renderElement(i,e,t){t.elementDisposables.clear();let o=CN(i),n=mU(i),r=YWe(i);t.container.classList.add("models-table-column"),t.container.parentElement.classList.toggle("models-vendor-row",o||n),t.container.parentElement.classList.toggle("models-model-row",!o&&!n),t.container.parentElement.classList.toggle("models-status-row",r),t.container.parentElement.classList.toggle("model-hidden",!o&&!n&&!r&&!i.model.visible),o?this.renderVendorElement(i,e,t):n?this.renderGroupElement(i,e,t):r?this.renderStatusElement(i,e,t):this.renderModelElement(i,e,t)}renderStatusElement(i,e,t){}disposeTemplate(i){i.elementDisposables.dispose(),i.disposables.dispose()}},Vqt=class a extends WQ{constructor(e){super();this.viewModel=e;this.templateId=a.TEMPLATE_ID}static{this.TEMPLATE_ID="gutter"}renderTemplate(e){let t=new N,o=new N;e.classList.add("models-gutter-column");let n=t.add(new Zi(e));return{listRowElement:e.parentElement?.parentElement??null,container:e,actionBar:n,disposables:t,elementDisposables:o}}renderElement(e,t,o){o.actionBar.clear(),super.renderElement(e,t,o)}renderVendorElement(e,t,o){this.renderCollapsableElement(e,o)}renderGroupElement(e,t,o){this.renderCollapsableElement(e,o)}renderCollapsableElement(e,t){t.listRowElement&&t.listRowElement.setAttribute("aria-expanded",e.collapsed?"false":"true");let o=e.collapsed?d(7032,null):d(7029,null),n={id:"toggleCollapse",label:o,tooltip:o,enabled:!0,class:q.asClassName(e.collapsed?R.chevronRight:R.chevronDown),run:()=>this.viewModel.toggleCollapsed(e)};t.actionBar.push(n,{icon:!0,label:!1})}renderModelElement(e,t,o){let{model:n}=e,r=n.visible,s=ii({id:"toggleVisibility",label:r?d(7061,null):d(7066,null),class:`model-visibility-toggle ${r?`${q.asClassName(R.eye)} model-visible`:`${q.asClassName(R.eyeClosed)} model-hidden`}`,tooltip:r?d(7072,null):d(7060,null),checked:!r,run:async()=>this.viewModel.toggleVisibility(e)});o.actionBar.push(s,{icon:!0,label:!1})}},Loe=class extends WQ{constructor(e){super();this.hoverService=e;this.templateId=Loe.TEMPLATE_ID}static{this.TEMPLATE_ID="modelName"}renderTemplate(e){let t=new N,o=new N,n=M(e,xx(".model-name-container")),r=M(n,xx(".status-icon")),s=t.add(new Ya(M(n,xx(".model-name")))),l=M(n,xx(".model-status-icon")),c=t.add(new Zi(M(n,xx(".model-name-actions"))));return{container:e,statusIcon:r,nameLabel:s,modelStatusIcon:l,actionBar:c,disposables:t,elementDisposables:o}}renderElement(e,t,o){Rt(o.modelStatusIcon),o.actionBar.clear(),o.nameLabel.element.classList.remove("error-status","warning-status","info-status"),super.renderElement(e,t,o)}renderVendorElement(e,t,o){o.nameLabel.set(e.vendorEntry.group.name,void 0)}renderGroupElement(e,t,o){o.nameLabel.set(e.label,void 0)}renderModelElement(e,t,o){let{model:n,modelNameMatches:r}=e;o.statusIcon.style.display="none",o.modelStatusIcon.className="model-status-icon",n.metadata.statusIcon?(o.modelStatusIcon.classList.add(...q.asClassNameArray(n.metadata.statusIcon)),o.modelStatusIcon.style.display=""):o.modelStatusIcon.style.display="none",o.nameLabel.set(n.metadata.name,r);let s=new Ie("",{isTrusted:!0,supportThemeIcons:!0});s.appendMarkdown(`**${e.model.metadata.name}**`),e.model.metadata.id!==e.model.metadata.version?s.appendMarkdown(`&nbsp;<span style="background-color:#8080802B;">&nbsp;_${e.model.metadata.id}@${e.model.metadata.version}_&nbsp;</span>`):s.appendMarkdown(`&nbsp;<span style="background-color:#8080802B;">&nbsp;_${e.model.metadata.id}_&nbsp;</span>`),s.appendText(`
`),e.model.metadata.statusIcon&&e.model.metadata.tooltip&&(e.model.metadata.statusIcon&&s.appendMarkdown(`$(${e.model.metadata.statusIcon.id})&nbsp;`),s.appendMarkdown(`${e.model.metadata.tooltip}`),s.appendText(`
`)),e.model.visible||s.appendMarkdown(`

${d(7071,null)}`),o.elementDisposables.add(this.hoverService.setupDelayedHoverAtMouse(o.container,()=>({content:s,appearance:{compact:!0,skipFadeInAnimation:!0}})))}renderStatusElement(e,t,o){switch(o.statusIcon.style.display="",o.statusIcon.className="status-icon",e.severity){case bt.Error:o.nameLabel.element.classList.add("error-status"),o.statusIcon.classList.add(...q.asClassNameArray(R.error));break;case bt.Warning:o.nameLabel.element.classList.add("warning-status"),o.statusIcon.classList.add(...q.asClassNameArray(R.warning));break;case bt.Info:o.nameLabel.element.classList.add("info-status"),o.statusIcon.classList.add(...q.asClassNameArray(R.info));break}o.nameLabel.set(e.message,void 0,e.message)}};Loe=I([m(0,nt)],Loe);var Roe=class extends WQ{constructor(e){super();this.hoverService=e;this.templateId=Roe.TEMPLATE_ID}static{this.TEMPLATE_ID="multiplier"}renderTemplate(e){let t=new N,o=new N,n=M(e,xx(".model-multiplier"));return{container:e,multiplierElement:n,disposables:t,elementDisposables:o}}renderElement(e,t,o){o.multiplierElement.textContent="",super.renderElement(e,t,o)}renderGroupElement(e,t,o){}renderVendorElement(e,t,o){}renderModelElement(e,t,o){let n=e.model.metadata.multiplier??"-";o.multiplierElement.textContent=n,n!=="-"&&o.elementDisposables.add(this.hoverService.setupDelayedHoverAtMouse(o.container,()=>({content:d(7075,null,n),appearance:{compact:!0,skipFadeInAnimation:!0}})))}};Roe=I([m(0,nt)],Roe);var Moe=class extends WQ{constructor(e){super();this.hoverService=e;this.templateId=Moe.TEMPLATE_ID}static{this.TEMPLATE_ID="tokenLimits"}renderTemplate(e){let t=new N,o=new N,n=M(e,xx(".model-token-limits"));return{container:e,tokenLimitsElement:n,disposables:t,elementDisposables:o}}renderElement(e,t,o){Rt(o.tokenLimitsElement),super.renderElement(e,t,o)}renderVendorElement(e,t,o){}renderGroupElement(e,t,o){}renderModelElement(e,t,o){let{model:n}=e,r=new Ie("",{isTrusted:!0,supportThemeIcons:!0});if(n.metadata.maxInputTokens||n.metadata.maxOutputTokens){let s=(n.metadata.maxInputTokens??0)+(n.metadata.maxOutputTokens??0),l=M(o.tokenLimitsElement,xx(".token-limit-item")),c=M(l,xx("span"));c.textContent=DAi(s),r.appendMarkdown(`${d(7055,null)}: `),r.appendMarkdown(`${DAi(s)}`)}o.elementDisposables.add(this.hoverService.setupDelayedHoverAtMouse(o.container,()=>({content:r,appearance:{compact:!0,skipFadeInAnimation:!0}})))}};Moe=I([m(0,nt)],Moe);var Bqt=class a extends WQ{constructor(){super(...arguments);this.templateId=a.TEMPLATE_ID;this._onDidClickCapability=new E;this.onDidClickCapability=this._onDidClickCapability.event}static{this.TEMPLATE_ID="capabilities"}dispose(){this._onDidClickCapability.dispose()}renderTemplate(e){let t=new N,o=new N;e.classList.add("model-capability-column");let n=M(e,xx(".model-capabilities"));return{container:e,metadataRow:n,disposables:t,elementDisposables:o}}renderElement(e,t,o){Rt(o.metadataRow),super.renderElement(e,t,o)}renderVendorElement(e,t,o){}renderGroupElement(e,t,o){}renderModelElement(e,t,o){let{model:n,capabilityMatches:r}=e;n.metadata.capabilities?.toolCalling&&o.elementDisposables.add(this.createCapabilityButton(o.metadataRow,r?.includes("toolCalling")||!1,d(7070,null),"tools")),n.metadata.capabilities?.vision&&o.elementDisposables.add(this.createCapabilityButton(o.metadataRow,r?.includes("vision")||!1,d(7073,null),"vision"))}createCapabilityButton(e,t,o,n){let r=new N,s=M(e,xx(".model-badge-container")),l=r.add(new Wi(s,{secondary:!0}));return l.element.classList.add("model-capability"),l.element.classList.toggle("active",t),l.label=o,r.add(l.onDidClick(()=>this._onDidClickCapability.fire(n))),r}},Poe=class extends WQ{constructor(e,t,o,n,r,s){super();this.viewModel=e;this.instantiationService=t;this.languageModelsService=o;this.dialogService=n;this.commandService=r;this.contextMenuService=s;this.templateId=Poe.TEMPLATE_ID}static{this.TEMPLATE_ID="actions"}renderTemplate(e){let t=new N,o=new N;e.classList.add("models-actions-column");let n=M(e,xx(".actions-container")),r=t.add(this.instantiationService.createInstance(wp,n,this.contextMenuService,{icon:!0,label:!1,moreIcon:R.gear,anchorAlignmentProvider:()=>1}));return{container:e,actionBar:r,disposables:t,elementDisposables:o}}renderElement(e,t,o){o.actionBar.setActions([]),super.renderElement(e,t,o)}renderVendorElement(e,t,o){let{vendorEntry:n}=e,r=[],s=[];n.vendor.configuration?(s.push(ii({id:"configureAction",label:d(7052,null),run:()=>this.languageModelsService.configureLanguageModelsProviderGroup(n.vendor.vendor,n.group.name)})),s.push(ii({id:"deleteAction",label:d(7057,null),class:q.asClassName(R.trash),run:async()=>{(await this.dialogService.confirm({type:"info",message:d(7058,null,n.group.name)})).confirmed&&await this.languageModelsService.removeLanguageModelsProviderGroup(n.vendor.vendor,n.group.name)}}))):n.vendor.managementCommand&&r.push(ii({id:"manageVendor",label:d(7065,null,n.group.name),class:q.asClassName(R.gear),run:async()=>{await this.commandService.executeCommand(n.vendor.managementCommand,n.vendor.vendor),this.viewModel.refresh()}})),o.actionBar.setActions(r,s)}renderGroupElement(e,t,o){}renderModelElement(e,t,o){let n=this.languageModelsService.getModelConfigurationActions(e.model.identifier);if(n.length===0&&!e.model.metadata.configurationSchema)return;let r=[...n];r.push(ii({id:"configureModel",label:d(7054,null),run:()=>this.languageModelsService.configureModel(e.model.identifier)})),o.actionBar.setActions([],r)}};Poe=I([m(1,F),m(2,ds),m(3,at),m(4,ge),m(5,Xe)],Poe);var Hqt=class a extends WQ{constructor(){super(...arguments);this.templateId=a.TEMPLATE_ID}static{this.TEMPLATE_ID="provider"}renderTemplate(e){let t=new N,o=new N,n=M(e,xx(".model-provider"));return{container:e,providerElement:n,disposables:t,elementDisposables:o}}renderVendorElement(e,t,o){o.providerElement.textContent=""}renderGroupElement(e,t,o){o.providerElement.textContent=""}renderModelElement(e,t,o){o.providerElement.textContent=e.model.provider.vendor.displayName}};function DAi(a){return a>=1e6?`${(a/1e6).toFixed(1)}M`:a>=1e3?`${(a/1e3).toFixed(0)}K`:a.toString()}var hU=class extends x{constructor(e,t,o,n,r,s,l,c){super();this.languageModelsService=e;this.instantiationService=t;this.extensionService=o;this.contextMenuService=n;this.chatEntitlementService=r;this.editorProgressService=s;this.commandService=l;this._onDidChangeItemCount=this._register(new E);this.onDidChangeItemCount=this._onDidChangeItemCount.event;this.dropdownActions=[];this.tableDisposables=this._register(new N);this.searchFocusContextKey=XDt.bindTo(c),this.delayedFiltering=this._register(new Xo(200)),this.viewModel=this._register(this.instantiationService.createInstance(QWe)),this.element=_(".models-widget"),this.create(this.element);let u=this.extensionService.whenInstalledExtensionsRegistered().then(()=>this.viewModel.refresh());this.editorProgressService.showWhile(u,300)}static{this.NUM_INSTANCES=0}create(e){let t=M(e,xx(".models-search-and-button-container")),o=d(7077,null),n=M(t,xx(".models-search-container"));this.searchWidget=this._register(this.instantiationService.createInstance($A,"chatModelsWidget.searchbox",n,{triggerCharacters:["@",":"],provideResults:h=>{let g=this.viewModel.getVendors().map(S=>`@provider:"${S.displayName}"`),f=[...g,...sst.CAPABILITIES,...sst.VISIBILITY];if(!h.trim())return f;let v=h.split(/\s/g),b=v[v.length-1];return b.startsWith("@provider:")?g:b.startsWith("@capability:")?sst.CAPABILITIES:b.startsWith("@visible:")?sst.VISIBILITY:b.startsWith("@")?f:[]}},o,`chatModelsWidget:searchinput:${hU.NUM_INSTANCES++}`,{placeholderText:o,styleOverrides:{inputBorder:AT},focusContextKey:this.searchFocusContextKey}));let r=this._register(new TAi),s=this._register(new it("workbench.models.clearSearch",d(7028,null),q.asClassName(WMe),!1,()=>this.clearSearch())),l=this._register(new it("workbench.models.collapseAll",d(7030,null),q.asClassName(R.collapseAll),!1,()=>{this.viewModel.collapseAll()}));l.enabled=this.viewModel.viewModelEntries.some(h=>mU(h)||CN(h)),this._register(this.viewModel.onDidChange(()=>l.enabled=this.viewModel.viewModelEntries.some(h=>CN(h)||mU(h)))),this._register(this.searchWidget.onInputDidChange(()=>{s.enabled=!!this.searchWidget.getValue(),this.filterModels()})),this.searchActionsContainer=M(n,xx(".models-search-actions"));let c=[s,l,r];this._register(new wp(this.searchActionsContainer,this.contextMenuService,{actionViewItemProvider:(h,g)=>{if(h.id===r.id)return this.instantiationService.createInstance(ast,h,g,{getValue:()=>this.searchWidget.getValue(),setValue:f=>this.search(f)},this.viewModel)},getKeyBinding:()=>{}})).setActions(c),this.searchWidget.inputWidget.getContainerDomNode().style.paddingRight=`${zl(this.searchActionsContainer)+12}px`,this.addButtonContainer=M(t,xx(".section-title-actions"));let p={...Qo,supportIcons:!0};this.addButton=this._register(new Wi(this.addButtonContainer,p)),this.addButton.label=`$(${R.add.id}) ${d(7059,null)}`,this.addButton.element.classList.add("models-add-model-button"),this.updateAddModelsButton(),this._register(this.addButton.onDidClick(h=>{this.dropdownActions.length>0&&this.contextMenuService.showContextMenu({getAnchor:()=>this.addButton.element,getActions:()=>this.dropdownActions})})),this.tableContainer=M(e,xx(".models-table-container")),this.createTable(),this._register(this.viewModel.onDidChangeGrouping(()=>this.createTable())),this._register(this.chatEntitlementService.onDidChangeEntitlement(()=>this.updateAddModelsButton())),this._register(this.languageModelsService.onDidChangeLanguageModelVendors(()=>this.updateAddModelsButton()))}createTable(){this.tableDisposables.clear(),Rt(this.tableContainer);let e=this.instantiationService.createInstance(Vqt,this.viewModel),t=this.instantiationService.createInstance(Loe),o=this.instantiationService.createInstance(Roe),n=this.instantiationService.createInstance(Moe),r=this.instantiationService.createInstance(Bqt),s=this.instantiationService.createInstance(Poe,this.viewModel),l=this.instantiationService.createInstance(Hqt);this.tableDisposables.add(r),this.tableDisposables.add(r.onDidClickCapability(u=>{let p=this.searchWidget.getValue(),h=`@capability:${u}`,g=PCo(p,{query:h});this.search(g)}));let c=[{label:"",tooltip:"",weight:.05,minimumWidth:40,maximumWidth:40,templateId:Vqt.TEMPLATE_ID,project(u){return u}},{label:d(7049,null),tooltip:"",weight:.35,minimumWidth:200,templateId:Loe.TEMPLATE_ID,project(u){return u}}];this.viewModel.groupBy==="visibility"&&c.push({label:d(7076,null),tooltip:"",weight:.15,minimumWidth:100,templateId:Hqt.TEMPLATE_ID,project(u){return u}}),c.push({label:d(7079,null),tooltip:"",weight:.1,minimumWidth:140,templateId:Moe.TEMPLATE_ID,project(u){return u}},{label:d(7024,null),tooltip:"",weight:.2,minimumWidth:180,templateId:Bqt.TEMPLATE_ID,project(u){return u}},{label:d(7031,null),tooltip:"",weight:.1,minimumWidth:60,templateId:Roe.TEMPLATE_ID,project(u){return u}},{label:"",tooltip:"",weight:.05,minimumWidth:64,maximumWidth:64,templateId:Poe.TEMPLATE_ID,project(u){return u}}),this.table=this.tableDisposables.add(this.instantiationService.createInstance(MC,"ModelsWidget",this.tableContainer,new _Ai,c,[e,t,o,n,r,s,l],{identityProvider:{getId:u=>u.id},horizontalScrolling:!1,accessibilityProvider:{getAriaLabel:u=>{if(CN(u))return d(7080,null,u.vendorEntry.group.name);if(mU(u))return u.id==="visible"?d(7081,null):d(7043,null);if(YWe(u))return d(7078,null,u.message);let p=[];if(p.push(d(7047,null,u.model.metadata.name,u.model.provider.vendor.displayName)),u.model.metadata.maxInputTokens||u.model.metadata.maxOutputTokens){let g=(u.model.metadata.maxInputTokens??0)+(u.model.metadata.maxOutputTokens??0);p.push(d(7045,null,DAi(g)))}u.model.metadata.capabilities&&p.push(d(7044,null,Object.keys(u.model.metadata.capabilities).join(", ")));let h=u.model.metadata.multiplier??"-";return h!=="-"&&p.push(d(7075,null,h)),u.model.visible?p.push(d(7048,null)):p.push(d(7046,null)),p.join(". ")},getWidgetAriaLabel:()=>d(7074,null)},multipleSelectionSupport:!0,setRowLineHeight:!1,openOnSingleClick:!0,alwaysConsumeMouseWheel:!1})),this.tableDisposables.add(this.table.onContextMenu(u=>{if(!u.element)return;let p=this.table.getSelection(),h=p.every(S=>S!==u.index)?[u.element]:p.map(S=>this.viewModel.viewModelEntries[S]).filter(S=>!!S),g=h.filter(S=>!CN(S)&&!mU(S)&&!YWe(S)),f=[],v,b;if(g.length){let S=g.filter(w=>w.model.visible),y=g.filter(w=>!w.model.visible);if(f.push(ii({id:"hideSelectedModels",label:d(7063,null),enabled:S.length>0,run:()=>this.viewModel.setModelsVisibility(g,!1)})),f.push(ii({id:"showSelectedModels",label:d(7068,null),enabled:y.length>0,run:()=>this.viewModel.setModelsVisibility(g,!0)})),g.length===1){let w=this.languageModelsService.getModelConfigurationActions(g[0].model.identifier);w.length&&(f.push(new ri),f.push(...w))}v=g[0].model.provider.group.name,b=g[0].model.provider.vendor,g.some(w=>w.model.provider.vendor.isDefault||w.model.provider.group.name!==v)&&(v=void 0,b=void 0)}else if(h.length===1){let S=u.element;CN(S)&&(S.vendorEntry.vendor.isDefault||(f.push(ii({id:"hideAllModels",label:d(7062,null),run:()=>this.viewModel.setGroupVisibility(S,!1)})),f.push(ii({id:"showAllModels",label:d(7067,null),run:()=>this.viewModel.setGroupVisibility(S,!0)}))),v=S.vendorEntry.group.name,b=S.vendorEntry.vendor)}v&&b&&(b.managementCommand||b.configuration)&&(f.length&&f.push(new ri),b.managementCommand?f.push(ii({id:"configureVendor",label:d(7053,null),run:async()=>{await this.commandService.executeCommand(b.managementCommand,b.vendor),await this.viewModel.refresh()}})):f.push(ii({id:"configureVendor",label:d(7053,null),run:()=>this.languageModelsService.configureLanguageModelsProviderGroup(b.vendor,v)}))),f.length>0&&this.contextMenuService.showContextMenu({getAnchor:()=>u.anchor,getActions:()=>f})})),this.table.splice(0,this.table.length,this.viewModel.viewModelEntries),this._onDidChangeItemCount.fire(this.itemCount),this.tableDisposables.add(this.viewModel.onDidChange(({at:u,removed:p,added:h})=>{if(this.table.splice(u,p,h),this._onDidChangeItemCount.fire(this.itemCount),this.viewModel.selectedEntry){let g=this.viewModel.viewModelEntries.indexOf(this.viewModel.selectedEntry);this.table.setFocus([g]),this.table.setSelection([g])}})),this.tableDisposables.add(this.table.onDidOpen(async({element:u,browserEvent:p})=>{u&&(YWe(u)||(CN(u)||mU(u)?this.viewModel.toggleCollapsed(u):(!Ru(p)||p.detail===2)&&this.viewModel.toggleVisibility(u)))})),this.tableDisposables.add(this.table.onDidChangeSelection(u=>this.viewModel.selectedEntry=u.elements[0])),this.tableDisposables.add(this.table.onDidBlur(()=>{this.viewModel.shouldRefilter()&&this.viewModel.filter(this.searchWidget.getValue())})),this.layout(this.element.clientHeight,this.element.clientWidth)}updateAddModelsButton(){let e=this.languageModelsService.getVendors().filter(r=>r.managementCommand||r.configuration),t=this.chatEntitlementService.entitlement,o=t===8||t===9,n=this.chatEntitlementService.isInternal||t!==1&&t!==3&&!o;this.addButton.enabled=n&&e.length>0,this.addButton.setTitle(!n&&o?d(7064,null):""),this.dropdownActions=e.map(r=>ii({id:`enable-${r.vendor}`,label:r.displayName,run:async()=>{await this.addModelsForVendor(r)}}))}filterModels(){this.delayedFiltering.trigger(()=>{this.viewModel.filter(this.searchWidget.getValue())})}async addModelsForVendor(e){this.languageModelsService.configureLanguageModelsProviderGroup(e.vendor)}layout(e,t){t=t-24,this.searchWidget.layout(new si(t-this.searchActionsContainer.clientWidth-this.addButtonContainer.clientWidth-8,22));let o=e-40;this.tableContainer.style.height=`${o}px`,this.table.layout(o,t)}focusSearch(){this.searchWidget.focus()}search(e){this.focusSearch(),this.searchWidget.setValue(e),this.viewModel.filter(e)}clearSearch(){this.focusSearch(),this.searchWidget.setValue("")}render(){this.viewModel.shouldRefilter()&&this.viewModel.filter(this.searchWidget.getValue())}get itemCount(){return this.viewModel.viewModelEntries.filter(e=>!CN(e)&&!mU(e)&&!YWe(e)).length}fireItemCount(){this._onDidChangeItemCount.fire(this.itemCount)}};hU=I([m(0,ds),m(1,F),m(2,lt),m(3,Xe),m(4,rr),m(5,wd),m(6,ge),m(7,X)],hU);var QT=_,XWe=class extends x{constructor(e){super();this.chatEntitlementService=e;this._onDidChangeContentHeight=this._register(new E);this.onDidChangeContentHeight=this._onDidChangeContentHeight.event;this.dateFormatter=Jc.DateTimeFormat(wr,{year:"numeric",month:"long",day:"numeric"});this.dateTimeFormatter=Jc.DateTimeFormat(wr,{year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"numeric"});this.element=_(".chat-usage-widget"),this.create(this.element),this.render(),this._register(this.chatEntitlementService.onDidChangeQuotaRemaining(()=>this.render())),this._register(this.chatEntitlementService.onDidChangeEntitlement(()=>this.render()))}create(e){this.usageSection=M(e,QT(".copilot-usage-section"))}render(){Rt(this.usageSection);let{chat:e,completions:t,premiumChat:o,resetDate:n,resetDateHasTime:r}=this.chatEntitlementService.quotas;if(this.chatEntitlementService.anonymous&&this.chatEntitlementService.sentiment.installed&&!t&&!e&&!o)this.renderLimitedQuotaItem(this.usageSection,d(7083,null)),this.renderLimitedQuotaItem(this.usageSection,d(7082,null));else if(t||e||o){if(t&&this.renderQuotaItem(this.usageSection,d(7088,null),t),e&&this.renderQuotaItem(this.usageSection,d(7085,null),e),o){let l=o.overageEnabled?d(7087,null):d(7091,null);if(this.renderQuotaItem(this.usageSection,l,o,o.overageEnabled),o.overageEnabled&&!o.unlimited){let c=M(this.usageSection,QT(".overage-message"));c.append(d(7089,null)),M(c,QT("br")),c.append(d(7090,null))}}if(n){let l=M(this.usageSection,QT(".allowance-resets"));l.textContent=d(7084,null,r?this.dateTimeFormatter.value.format(new Date(n)):this.dateFormatter.value.format(new Date(n)))}}let s=this.element.offsetHeight||400;this._onDidChangeContentHeight.fire(s)}renderQuotaItem(e,t,o,n=!1){let r=M(e,QT(".quota-item")),s=M(r,QT(".quota-item-header")),l=M(s,QT(".quota-item-label"));l.textContent=t;let c=M(s,QT(".quota-item-value"));o.unlimited?c.textContent=d(7086,null):c.textContent=d(7086,null);let u=M(r,QT(".quota-bar")),p=M(u,QT(".quota-bit")),h=this.getQuotaPercentageUsed(o);p.style.width=h+"%",h>=90&&!n?r.classList.add("error"):h>=75&&!n&&r.classList.add("warning")}getQuotaPercentageUsed(e){return e.unlimited?0:Math.max(0,100-e.percentRemaining)}renderLimitedQuotaItem(e,t){let o=M(e,QT(".quota-item")),n=M(o,QT(".quota-item-header")),r=M(n,QT(".quota-item-label"));r.textContent=t;let s=M(n,QT(".quota-item-value"));s.textContent=d(7092,null);let l=M(o,QT(".quota-bar"));M(l,QT(".quota-bit"))}};XWe=I([m(0,rr)],XWe);var sL=_,vq=class extends Ts{constructor(e,t,o,n,r,s){super(vq.ID,e,t,o,n);this.instantiationService=r;this.editorDisposables=this._register(new N);this.inModelsEditorContextKey=GEe.bindTo(s)}static{this.ID="workbench.editor.modelsManagement"}createEditor(e){this.editorDisposables.clear(),this.bodyContainer=M(e,sL(".ai-models-management-editor")),this.modelsWidget=this.editorDisposables.add(this.instantiationService.createInstance(hU)),this.bodyContainer.appendChild(this.modelsWidget.element)}async setInput(e,t,o,n){this.inModelsEditorContextKey.set(!0),await super.setInput(e,t,o,n),this.dimension&&this.layout(this.dimension),this.modelsWidget?.render()}layout(e){this.dimension=e,this.bodyContainer&&this.modelsWidget?.layout(e.height-15,this.bodyContainer.clientWidth-24)}focus(){super.focus(),this.modelsWidget?.focusSearch()}clearInput(){this.inModelsEditorContextKey.set(!1),super.clearInput()}clearSearch(){this.modelsWidget?.clearSearch()}search(e){this.modelsWidget?.search(e)}};vq=I([m(1,Te),m(2,Le),m(3,ce),m(4,F),m(5,X)],vq);var ocn=te("chatManagement.sashBorder",vf,d(7005,null));function ncn(a){return!a.sentiment.installed||a.entitlement===3}var VQ=class extends Ts{constructor(e,t,o,n,r,s,l){super(VQ.ID,e,t,o,n);this.instantiationService=r;this.selectedSection=Fqt;this.sections=[];this.actionButtonClickListener=this._register(new me);this.commandService=s,this.chatEntitlementService=l}static{this.ID="workbench.editor.chatManagement"}createEditor(e){this.container=M(e,sL(".ai-management-editor")),this.renderHeader(this.container);let t=M(this.container,sL(".split-view-container")),o=M(t,sL(".sidebar-view")),n=M(o,sL(".sidebar-container")),r=M(t,sL(".contents-view"));this.contentsContainer=M(r,sL(".contents-container")),this.splitView=new Ou(t,{orientation:1,proportionalLayout:!0}),this.renderSidebar(n),this.renderContents(this.contentsContainer),this.splitView.addView({onDidChange:U.None,element:o,minimumSize:150,maximumSize:350,layout:(s,l,c)=>{n.style.width=`${s}px`,this.sectionsList&&c!==void 0&&this.sectionsList.layout(c,s)}},200,void 0,!0),this.splitView.addView({onDidChange:U.None,element:r,minimumSize:550,maximumSize:Number.POSITIVE_INFINITY,layout:(s,l,c)=>{r.style.width=`${s}px`,c!==void 0&&this.layoutContents(s,c)}},Gl.Distribute,void 0,!0),this.updateStyles(),this.updateHeaderData(),this._register(this.chatEntitlementService.onDidChangeQuotaRemaining(()=>this.updateHeaderData())),this._register(this.chatEntitlementService.onDidChangeEntitlement(()=>this.updateHeaderData()))}updateStyles(){let e=this.theme.getColor(ocn);this.splitView?.style({separatorBorder:e})}renderSidebar(e){this.sections=[{id:Fqt,label:d(7014,null)},{id:Wqt,label:d(7011,null)}];let t=new LAi,o=new RAi;this.sectionsList=this._register(this.instantiationService.createInstance(Vl,"ChatManagementSections",e,t,[o],{multipleSelectionSupport:!1,setRowLineHeight:!1,horizontalScrolling:!1,accessibilityProvider:{getAriaLabel(n){return n.label},getWidgetAriaLabel(){return d(7015,null)}},openOnSingleClick:!0,identityProvider:{getId(n){return n.id}}})),this.sectionsList.splice(0,this.sectionsList.length,this.sections),this.sectionsList.setSelection([0]),this._register(this.sectionsList.onDidChangeSelection(n=>{n.elements.length>0&&(this.selectedSection=n.elements[0].id,this.renderSelectedSection())}))}renderHeader(e){this.headerContainer=M(e,sL(".ai-management-header"));let t=M(this.headerContainer,sL(".header-title-container")),o=M(t,sL(".header-title-wrapper")),n=M(o,sL(".ai-management-editor-title"));n.textContent=d(7009,null),this.planBadge=M(o,sL(".plan-badge"));let r=M(t,sL(".header-upgrade-button-container"));this.actionButton=this._register(new Wi(r,{...Qo})),this.actionButton.element.classList.add("header-upgrade-button"),this.actionButton.element.style.display="none"}renderContents(e){let t=M(e,sL(".ai-management-body"));this.chatUsageWidget=this._register(this.instantiationService.createInstance(XWe)),this.modelsWidget=this._register(this.instantiationService.createInstance(hU)),t.appendChild(this.chatUsageWidget.element),t.appendChild(this.modelsWidget.element),this.renderSelectedSection()}renderSelectedSection(){this.chatUsageWidget.element.style.display="none",this.modelsWidget.element.style.display="none",this.selectedSection===Fqt?this.chatUsageWidget.element.style.display="":this.selectedSection===Wqt&&(this.modelsWidget.element.style.display=""),this.dimension&&this.layout(this.dimension)}layoutContents(e,t){this.contentsContainer&&this.selectedSection===Wqt&&this.modelsWidget.layout(t-30,e-30)}selectSection(e){let t=this.sections.findIndex(o=>o.id===e);t>=0&&(this.sectionsList?.setFocus([t]),this.sectionsList?.setSelection([t]))}updateHeaderData(){let e=ncn(this.chatEntitlementService),t=this.chatEntitlementService.anonymous,o=this.chatEntitlementService.sentiment.disabled||this.chatEntitlementService.sentiment.untrusted,n=this.chatEntitlementService.entitlement===1,r=this.chatEntitlementService.entitlement===5;if(t||r)t?this.planBadge.style.display="none":(this.planBadge.style.display="",this.planBadge.textContent=d(7010,null));else{this.planBadge.style.display="";let l=this.getCurrentPlanName();this.planBadge.textContent=l.replace("Copilot ","")}let s=this.shouldShowUpgradeButton();if(e||n||o||s){this.actionButton.element.style.display="";let l,c;s&&!r&&!t?(this.chatEntitlementService.entitlement===6?l=d(7013,null):l=d(7012,null),c="workbench.action.chat.upgradePlan"):s&&(r||t)?(l=d(7017,null),c="workbench.action.chat.upgradePlan"):e?(l=d(7006,null),c=e&&t?"workbench.action.chat.triggerSetupAnonymousWithoutDialog":"workbench.action.chat.triggerSetup"):t?(l=d(7008,null),c="workbench.action.chat.triggerSetup"):o?(l=d(7007,null),c="workbench.action.chat.triggerSetup"):(l=d(7016,null),c="workbench.action.chat.triggerSetup"),this.actionButton.label=l,this.actionButtonClickListener.value=this.actionButton.onDidClick(()=>{this.commandService.executeCommand(c)})}else this.actionButton.element.style.display="none"}getCurrentPlanName(){return QDt(this.chatEntitlementService.entitlement)}shouldShowUpgradeButton(){let e=this.chatEntitlementService.entitlement;return e===3||e===5||e===10||e===6}async setInput(e,t,o,n){await super.setInput(e,t,o,n),this.dimension&&this.layout(this.dimension)}layout(e){if(this.dimension=e,this.container&&this.splitView){let t=this.headerContainer?.offsetHeight||0,o=e.height-t;this.splitView.layout(this.container.clientWidth,o),this.splitView.el.style.height=`${o}px`}}focus(){super.focus(),this.sectionsList?.domFocus()}};VQ=I([m(1,Te),m(2,Le),m(3,ce),m(4,F),m(5,ge),m(6,rr)],VQ);var LAi=class{getHeight(i){return 22}getTemplateId(){return"sectionItem"}},RAi=class{constructor(){this.templateId="sectionItem"}renderTemplate(i){return i.classList.add("section-list-item"),{label:M(i,sL(".section-list-item-label"))}}renderElement(i,e,t){t.label.textContent=i.label}disposeTemplate(i){}};var ACo=Ae("language-models-open-settings",R.goToFile,d(7000,null)),Uqt=C.and(ie.enabled,C.or(ie.Entitlement.planFree,ie.Entitlement.planEdu,ie.Entitlement.planPro,ie.Entitlement.planProPlus,ie.Entitlement.planBusiness,ie.Entitlement.planEnterprise,ie.Entitlement.internal));ne.as(qo.EditorPane).registerEditorPane(Br.create(VQ,VQ.ID,d(6999,null)),[new Ft(jWe)]);ne.as(qo.EditorPane).registerEditorPane(Br.create(vq,vq.ID,d(7002,null)),[new Ft(kfe)]);var MAi=class{canSerialize(i){return!0}serialize(i){return""}deserialize(i){return i.createInstance(jWe)}},PAi=class{canSerialize(i){return!0}serialize(i){return""}deserialize(i){return i.createInstance(kfe)}};ne.as(qo.EditorFactory).registerEditorSerializer(jWe.ID,MAi);ne.as(qo.EditorFactory).registerEditorSerializer(kfe.ID,PAi);function NCo(a){return Fe(a)?a:void 0}function rcn(a){xi(a)||(a={});let i=a;return{query:NCo(i?.query),section:NCo(i?.section)}}var JWe=class extends x{constructor(e){super();this.languageModelsConfigurationService=e;this.registerChatManagementActions(),this.registerLanguageModelsEditorTitleActions()}static{this.ID="workbench.contrib.chatManagementActions"}registerChatManagementActions(){this._register(W(class extends K{constructor(){super({id:A6e,title:L(7003,"Manage Language Models"),category:Si,precondition:Uqt,f1:!0})}async run(e,t){let o=e.get(ee);return t=rcn(t),o.openEditor(new kfe,{pinned:!0})}})),this._register(W(class extends K{constructor(){super({id:"chat.models.action.clearSearchResults",precondition:GEe,keybinding:{primary:9,weight:100,when:XDt},title:L(7001,"Clear Models Search Results")})}run(e){let t=e.get(ee).activeEditorPane;return t instanceof vq&&t.clearSearch(),null}})),this._register(W(class extends K{constructor(){super({id:"workbench.action.openLanguageModelsJson",title:L(7004,"Open Language Models (JSON)"),category:Si,precondition:Uqt,f1:!0})}async run(e){await e.get(s4).configureLanguageModels()}}))}registerLanguageModelsEditorTitleActions(){let e=this.languageModelsConfigurationService.configurationFile,t=C.and(GEe.toNegated(),Wo.Resource.isEqualTo(e.toString()),C.not("isInDiffEditor"),Uqt);ve.appendMenuItem(D.EditorTitle,{command:{id:A6e,title:L(7003,"Manage Language Models"),icon:ACo},when:t,group:"navigation",order:1});let o=C.and(GEe,Uqt);ve.appendMenuItem(D.EditorTitle,{command:{id:"workbench.action.openLanguageModelsJson",title:L(7004,"Open Language Models (JSON)"),icon:ACo},when:o,group:"navigation",order:1})}};JWe=I([m(0,s4)],JWe);It(JWe.ID,JWe,St.AfterRestored);var Efe=class{constructor(i,e,t,o){this.workspaceContextService=i;this.commandService=e;this.promptsService=t;this.harnessService=o;this.managementSections=[Zn.Agents,Zn.Skills,Zn.Instructions,Zn.Prompts,Zn.Hooks,Zn.McpServers,Zn.Plugins];this.isSessionsWindow=!1;this.hasOverrideProjectRoot=So(!1);let n=Vf({owner:this},this.workspaceContextService.onDidChangeWorkspaceFolders,()=>this.workspaceContextService.getWorkspace().folders);this.activeProjectRoot=ke(r=>n.read(r)[0]?.uri)}getActiveProjectRoot(){return this.workspaceContextService.getWorkspace().folders[0]?.uri}getStorageSourceFilter(i){return this.harnessService.getStorageSourceFilter(i)}setOverrideProjectRoot(i){}clearOverrideProjectRoot(){}async commitFiles(i,e){}async deleteFiles(i,e){}async generateCustomization(i){let t={agent:g3,skill:h3,instructions:CXe,prompt:m3,hook:HSi}[i];t&&await this.commandService.executeCommand(t)}async getFilteredPromptSlashCommands(i){return this.promptsService.getPromptSlashCommands(i)}static{this._emptyIntegrations=new Map}getSkillUIIntegrations(){return Efe._emptyIntegrations}};Efe=I([m(0,Pe),m(1,ge),m(2,Or),m(3,UR)],Efe);Ee(zF,Efe,1);var lst=class extends LLt{constructor(i){let e=i.userHome({preferLocal:!0}),t=["extension",pI],o=[],n=[ato(t),cto(nto(e),o),dto(rto(e),o)];super(n,"vscode")}};lst=I([m(0,An)],lst);Ee(UR,lst,1);var gU=class a extends ls{constructor(){super();this.resource=void 0;this._isDirty=!1}static{this.ID=QNt}get capabilities(){return super.capabilities|8|2048}static getOrCreate(){return(!a._instance||a._instance.isDisposed())&&(a._instance=new a),a._instance}matches(e){return super.matches(e)||e instanceof a}get typeId(){return a.ID}getName(){return d(6356,null)}getIcon(){return R.settingsGear}async resolve(){return null}isDirty(){return this._isDirty}async save(e,t){if(!(t?.reason!==void 0&&t.reason!==1)&&this._saveHandler)return await this._saveHandler()?this:void 0}async revert(){this.setDirty(!1)}setDirty(e){this._isDirty!==e&&(this._isDirty=e,this._onDidChangeDirty.fire())}setSaveHandler(e){this._saveHandler=e}};var Mjh=Ae("ai-customization-view-icon",R.sparkle,d(6222,null)),ZWe=Ae("ai-customization-agent",R.agent,d(6211,null)),cst=Ae("ai-customization-skill",R.lightbulb,d(6220,null)),BQ=Ae("ai-customization-instructions",R.book,d(6215,null)),eVe=Ae("ai-customization-prompt",R.bookmark,d(6218,null)),dst=Ae("ai-customization-hook",R.zap,d(6214,null)),Pjh=Ae("ai-customization-add",R.add,d(6210,null)),Ajh=Ae("ai-customization-run",R.play,d(6219,null)),ust=Ae("ai-customization-workspace",R.folder,d(6223,null)),pst=Ae("ai-customization-user",R.account,d(6221,null)),mst=Ae("ai-customization-extension",R.extensions,d(6213,null)),NW=Ae("ai-customization-plugin",R.plug,d(6217,null)),zqt=Ae("ai-customization-builtin",R.starFull,d(6212,null)),FCo=Ae("ai-customization-mcp-server",R.server,d(6216,null));function scn(a){switch(a){case Zn.Agents:return"agent";case Zn.Skills:return"skill";case Zn.Instructions:return"instructions";case Zn.Hooks:return"hook";case Zn.Prompts:default:return"prompt"}}async function WCo(a,i,e,t,o){let n=scn(a),r=e.getStorageSourceFilter(n),s=[];if(s.push(`== Customization Debug: ${a} (${n}) ==`),s.push(`Window: ${e.isSessionsWindow?"Sessions":"Core VS Code"}`),s.push(`Active root: ${e.getActiveProjectRoot()?.fsPath??"(none)"}`),s.push(`Sections: [${e.managementSections.join(", ")}]`),s.push(`Filter sources: [${r.sources.join(", ")}]`),r.includedUserFileRoots){s.push("Filter includedUserFileRoots:");for(let l of r.includedUserFileRoots)s.push(`  ${l.fsPath}`)}else s.push("Filter includedUserFileRoots: (all)");return s.push(""),o?await acn(s,o,n):(await lcn(s,i,n),await ccn(s,i,n,r)),dcn(s,t),o||await ucn(s,i,n),s.join(`
`)}async function acn(a,i,e){a.push("--- External Provider Data ---");let t=await i.provideChatSessionCustomizations(Se.None);if(!t){a.push("  Provider returned undefined"),a.push("");return}a.push(`  Total items from provider: ${t.length}`);let o=new Map;for(let r of t){let s=o.get(r.type)??[];s.push(r),o.set(r.type,s)}for(let[r,s]of o){a.push(`  ${r}: ${s.length} items`);for(let l of s)a.push(`    ${l.name} \u2014 ${l.uri.fsPath??l.uri.toString()}`),l.description&&a.push(`      desc: ${l.description}`)}let n=t.filter(r=>r.type===e);a.push(`  Items matching current section (${e}): ${n.length}`),a.push("")}async function lcn(a,i,e){a.push("--- Stage 1: Raw PromptsService Data ---");let[t,o,n]=await Promise.all([i.listPromptFilesForStorage(e,"local",Se.None),i.listPromptFilesForStorage(e,"user",Se.None),i.listPromptFilesForStorage(e,"extension",Se.None)]);a.push(`  listPromptFilesForStorage(local):  ${t.length} files`),Kqt(a,t),a.push(`  listPromptFilesForStorage(user):   ${o.length} files`),Kqt(a,o),a.push(`  listPromptFilesForStorage(ext):    ${n.length} files`),Kqt(a,n);let r=await i.listPromptFiles(e,Se.None);if(a.push(`  listPromptFiles (merged):          ${r.length} files`),e==="instructions"){let s=await i.listAgentInstructions(Se.None,void 0);a.push(`  listAgentInstructions (extra):     ${s.length} files`),Kqt(a,s)}if(e==="skill"){let s=await i.findAgentSkills(Se.None);a.push(`  findAgentSkills:                   ${s?.length??0} skills`);for(let l of s??[])a.push(`    ${l.name??"?"} [${l.storage}] ${l.uri.fsPath}`)}if(e==="agent"){let s=await i.getCustomAgents(Se.None);a.push(`  getCustomAgents:                   ${s.length} agents`);for(let l of s)a.push(`    ${l.name} [${l.source.storage}] ${l.uri.fsPath}`)}if(e==="prompt"){let s=await i.getPromptSlashCommands(Se.None);a.push(`  getPromptSlashCommands:            ${s.length} commands`);for(let l of s)a.push(`    /${l.name} [${l.promptPath.storage}] ${l.promptPath.uri.fsPath} (type=${l.promptPath.type})`)}a.push("")}async function ccn(a,i,e,t){a.push("--- Stage 2: After applyStorageSourceFilter ---");let[o,n,r]=await Promise.all([i.listPromptFilesForStorage(e,"local",Se.None),i.listPromptFilesForStorage(e,"user",Se.None),i.listPromptFilesForStorage(e,"extension",Se.None)]),s=[...o,...n,...r],l=yLt(s,t);a.push(`  Input: ${s.length} \u2192 Filtered: ${l.length}`),a.push(`    local:     ${l.filter(u=>u.storage==="local").length}`),a.push(`    user:      ${l.filter(u=>u.storage==="user").length}`),a.push(`    extension: ${l.filter(u=>u.storage==="extension").length}`);let c=s.length-l.length;if(c>0){let u=new Set(l.map(h=>h.uri.toString())),p=s.filter(h=>!u.has(h.uri.toString()));a.push(`  Removed (${c}):`);for(let h of p)a.push(`    [${h.storage}] ${h.uri.fsPath}`)}a.push("")}function dcn(a,i){a.push("--- Stage 3: Widget State (loadItems \u2192 filterItems) ---"),a.push(`  allItems (after loadItems): ${i.allItems.length}`),a.push(`    local:     ${i.allItems.filter(o=>o.storage==="local").length}`),a.push(`    user:      ${i.allItems.filter(o=>o.storage==="user").length}`),a.push(`    extension: ${i.allItems.filter(o=>o.storage==="extension").length}`),a.push(`    plugin:    ${i.allItems.filter(o=>o.storage==="plugin").length}`),a.push(`  displayEntries (after filterItems): ${i.displayEntries.length}`);let e=i.displayEntries.filter(o=>o.type==="file-item");a.push(`    file items shown: ${e.length}`);let t=i.displayEntries.filter(o=>o.type==="group-header");for(let o of t)a.push(`    group "${o.label}": count=${o.count}, collapsed=${o.collapsed}`);a.push("")}async function ucn(a,i,e){a.push("--- Source Folders (creation targets) ---");let t=await i.getSourceFolders(e);for(let o of t)a.push(`  [${o.storage}] ${o.uri.fsPath}`);try{let o=await i.getResolvedSourceFolders(e);a.push(""),a.push("--- Resolved Source Folders (discovery order) ---");for(let n of o)a.push(`  [${n.storage}] ${n.uri.fsPath} (source=${n.source})`)}catch{}}function Kqt(a,i){for(let e of i)a.push(`    ${e.uri.fsPath}`)}function Tfe(a){let i=a.search(/[\r\n]/);return i!==-1?a.substring(0,i):a}function VCo(a,i,e){return a?e==="hook"?a:Tfe(a):i}var $g=_,pcn=44,mcn=36,hcn=40,NAi=class{getHeight(i){return i.type==="group-header"?i.isFirst?mcn:hcn:pcn}getTemplateId(i){return i.type==="group-header"?"groupHeader":"aiCustomizationItem"}},OAi=class{constructor(i){this.hoverService=i;this.templateId="groupHeader"}renderTemplate(i){let e=new N,t=new N;i.classList.add("ai-customization-group-header");let o=M(i,$g(".group-chevron")),n=M(i,$g(".group-icon")),r=M(i,$g(".group-label-group")),s=M(r,$g(".group-label")),l=M(r,$g(".group-info"));l.classList.add(...q.asClassNameArray(R.info));let c=M(i,$g(".group-count"));return{container:i,chevron:o,icon:n,label:s,count:c,infoIcon:l,disposables:e,elementDisposables:t}}renderElement(i,e,t){t.elementDisposables.clear(),t.chevron.className="group-chevron",t.chevron.classList.add(...q.asClassNameArray(i.collapsed?R.chevronRight:R.chevronDown)),t.icon.className="group-icon",t.icon.classList.add(...q.asClassNameArray(i.icon)),t.label.textContent=i.label,t.count.textContent=`${i.count}`,t.elementDisposables.add(this.hoverService.setupDelayedHover(t.infoIcon,()=>({content:i.description,appearance:{compact:!0,skipFadeInAnimation:!0}}))),t.container.classList.toggle("collapsed",i.collapsed),t.container.classList.toggle("has-previous-group",!i.isFirst)}disposeTemplate(i){i.elementDisposables.dispose(),i.disposables.dispose()}};function gcn(a){switch(a){case"agent":return ZWe;case"skill":return cst;case"instructions":return BQ;case"prompt":return eVe;case"hook":return dst;default:return eVe}}function Gqt(a){switch(a){case"local":return ust;case"user":return pst;case"extension":return mst;case"plugin":return NW;default:return BQ}}function _fe(a){return a.replace(/\.md$/i,"")}var fcn=new Set([h4.toLowerCase(),CLt.toLowerCase(),xLt.toLowerCase(),sTe.toLowerCase()]);function vcn(a){return fcn.has(He(a).toLowerCase())}var hst=class{constructor(i,e,t,o,n,r){this.hoverService=i;this.labelService=e;this.menuService=t;this.contextKeyService=o;this.instantiationService=n;this.agentPluginService=r;this.templateId="aiCustomizationItem"}renderTemplate(i){let e=new N,t=new N;i.classList.add("ai-customization-list-item");let o=M(i,$g(".item-left")),n=M(o,$g(".item-type-icon")),r=M(o,$g(".item-text")),s=M(r,$g(".item-name-row")),l=e.add(new Ya(M(s,$g(".item-name")))),c=M(s,$g(".inline-badge.item-badge")),u=e.add(new Ya(M(r,$g(".item-description")))),p=M(i,$g(".item-right")),h=e.add(new Zi(p,{actionViewItemProvider:Bs.bind(void 0,this.instantiationService)}));return{container:i,actionsContainer:p,actionBar:h,typeIcon:n,nameLabel:l,badge:c,description:u,disposables:e,elementDisposables:t}}renderElement(i,e,t){t.elementDisposables.clear();let o=i.item;t.typeIcon.className="item-type-icon",t.typeIcon.classList.add(...q.asClassNameArray(o.typeIcon??gcn(o.promptType))),t.elementDisposables.add(this.hoverService.setupDelayedHover(t.container,()=>{let g;if(o.isBuiltin)g=`${o.name}
${d(6234,null)}`;else if(o.extensionLabel)g=`${o.name}
${d(6249,null,o.extensionLabel)}`;else{let v=o.storage==="local",b=this.labelService.getUriLabel(o.uri,{relative:v});g=`${o.name}
${b}`}o.badgeTooltip&&(g+=`

${o.badgeTooltip}`);let f=o.pluginUri&&this.agentPluginService.plugins.get().find(v=>Qe(v.uri,o.pluginUri));return f&&(g+=`
${d(6250,null,f.label)}`),{content:g,appearance:{compact:!0,skipFadeInAnimation:!0}}})),t.container.classList.toggle("disabled",o.disabled);let n=o.displayName??_fe(o.name);t.nameLabel.set(n,o.nameMatches),o.badge?(t.badge.textContent=o.badge,t.badge.style.display="",o.badgeTooltip&&t.elementDisposables.add(this.hoverService.setupManagedHover(Ri("mouse"),t.badge,o.badgeTooltip))):(t.badge.textContent="",t.badge.style.display="none");let r=VCo(o.description,o.filename,o.promptType),s;if(r&&o.description&&o.descriptionMatches)if(r===o.description)s=o.descriptionMatches;else{let g=r.length,f=o.descriptionMatches.map(v=>{if(v.start>=g||v.end<=0)return;let b=Math.max(0,v.start),S=Math.min(v.end,g);return S>b?{start:b,end:S}:void 0}).filter(v=>!!v);s=f.length?f:void 0}r?(t.description.set(r,s),t.description.element.style.display="",t.description.element.classList.toggle("is-filename",!o.description)):(t.description.set("",void 0),t.description.element.style.display="none");let l={uri:o.uri.toString(),name:o.name,promptType:o.promptType,storage:o.storage,pluginUri:o.pluginUri?.toString()},c=[[p3,o.promptType],[VDe,o.uri.toString()],[EZ,o.disabled]];o.storage&&c.push([m0,o.storage]),o.pluginUri&&c.push([WSi,o.pluginUri.toString()]);let u=this.contextKeyService.createOverlay(c),p=t.elementDisposables.add(this.menuService.createMenu(Rk,u)),h=()=>{let g=p.getActions({arg:l,shouldForwardArgs:!0}),{primary:f}=zp(g,"inline");t.actionBar.clear(),t.actionBar.push(f,{icon:!0,label:!1})};h(),t.elementDisposables.add(p.onDidChange(h)),t.actionBar.context=l}disposeTemplate(i){i.elementDisposables.dispose(),i.disposables.dispose()}};hst=I([m(0,nt),m(1,rt),m(2,Kt),m(3,X),m(4,F),m(5,Gg)],hst);function AAi(a){switch(a){case Zn.Agents:return"agent";case Zn.Skills:return"skill";case Zn.Instructions:return"instructions";case Zn.Hooks:return"hook";case Zn.Prompts:default:return"prompt"}}var tVe=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T){super();this.instantiationService=e;this.promptsService=t;this.contextViewService=o;this.openerService=n;this.contextMenuService=r;this.menuService=s;this.contextKeyService=l;this.workspaceContextService=c;this.labelService=u;this.workspaceService=p;this.clipboardService=h;this.hoverService=g;this.fileService=f;this.pathService=v;this.telemetryService=b;this.harnessService=S;this.agentPluginService=y;this.commandService=w;this.productService=k;this.userDataProfileService=T;this.currentSection=Zn.Agents;this.allItems=[];this.displayEntries=[];this.searchQuery="";this.collapsedGroups=new Set;this.dropdownActionDisposables=this._register(new N);this.delayedFilter=new Xo(200);this._onDidSelectItem=this._register(new E);this.onDidSelectItem=this._onDidSelectItem.event;this._onDidChangeItemCount=this._register(new E);this.onDidChangeItemCount=this._onDidChangeItemCount.event;this._onDidRequestCreate=this._register(new E);this.onDidRequestCreate=this._onDidRequestCreate.event;this._onDidRequestCreateManual=this._register(new E);this.onDidRequestCreateManual=this._onDidRequestCreateManual.event;this.element=$g(".ai-customization-list-widget"),this.create(),this._register(this.workspaceContextService.onDidChangeWorkspaceFolders(()=>this.refresh())),this._register(be(O=>{this.workspaceService.activeProjectRoot.read(O),this.updateAddButton(),this.refresh()})),this._register(be(O=>{this.harnessService.activeHarness.read(O),this.updateAddButton(),this.refresh()})),this._register(be(O=>{this.harnessService.availableHarnesses.read(O),this.refresh()}));let P=this._register(new me);this._register(be(O=>{this.harnessService.activeHarness.read(O);let V=this.harnessService.getActiveDescriptor();V.itemProvider?P.value=V.itemProvider.onDidChange(()=>this.refresh()):P.clear()}))}create(){this.searchAndButtonContainer=M(this.element,$g(".list-search-and-button-container")),this.searchContainer=M(this.searchAndButtonContainer,$g(".list-search-container")),this.searchInput=this._register(new Vc(this.searchContainer,this.contextViewService,{placeholder:d(6279,null),inputBoxStyles:Cl})),this._register(this.searchInput.onDidChange(()=>{this.searchQuery=this.searchInput.value,this.delayedFilter.trigger(()=>{let t=this.filterItems();this.searchQuery.trim()&&this.telemetryService.publicLog2("chatCustomizationEditor.search",{section:this.currentSection,resultCount:t})})})),this.addButtonContainer=M(this.searchAndButtonContainer,$g(".list-add-button-container")),this.addButtonSimple=this._register(new Wi(this.addButtonContainer,{...Qo,supportIcons:!0})),this.addButtonSimple.element.classList.add("list-add-button"),this._register(this.addButtonSimple.onDidClick(()=>this.executePrimaryCreateAction())),this.addButton=this._register(new ry(this.addButtonContainer,{...Qo,supportIcons:!0,contextMenuProvider:this.contextMenuService,addPrimaryActionToDropdown:!1,actions:{getActions:()=>this.getDropdownActions()}})),this.addButton.element.classList.add("list-add-button"),this._register(this.addButton.onDidClick(()=>this.executePrimaryCreateAction())),this.updateAddButton(),this.listContainer=M(this.element,$g(".list-container")),this.emptyStateContainer=M(this.element,$g(".list-empty-state"));let e=M(this.emptyStateContainer,$g(".empty-state-header"));this.emptyStateIcon=M(e,$g(".empty-state-icon")),this.emptyStateText=M(e,$g(".empty-state-text")),this.emptyStateSubtext=M(this.emptyStateContainer,$g(".empty-state-subtext")),this.emptyStateContainer.style.display="none",this.list=this._register(this.instantiationService.createInstance(Vl,"AICustomizationManagementList",this.listContainer,new NAi,[new OAi(this.hoverService),this.instantiationService.createInstance(hst)],{identityProvider:{getId:t=>t.type==="group-header"?t.id:t.item.id},accessibilityProvider:{getAriaLabel:t=>{if(t.type==="group-header")return d(6251,null,t.label,t.count,t.collapsed?d(6235,null):d(6246,null));let o=t.item.description?d(6257,null,t.item.name,t.item.description):t.item.name;return t.item.disabled?d(6258,null,o):o},getWidgetAriaLabel:()=>d(6264,null)},keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:t=>t.type==="group-header"?t.label:t.item.name},multipleSelectionSupport:!1,openOnSingleClick:!0})),this._register(this.list.onDidOpen(t=>{t.element&&(t.element.type==="group-header"?this.toggleGroup(t.element):this._onDidSelectItem.fire(t.element.item))})),this._register(this.list.onContextMenu(t=>this.onContextMenu(t))),this._register(this.promptsService.onDidChangeCustomAgents(()=>this.refresh())),this._register(this.promptsService.onDidChangeSlashCommands(()=>this.refresh())),this._register(this.promptsService.onDidChangeSkills(()=>this.refresh())),this._register(this.fileService.onDidFilesChange(t=>{t.gotDeleted()&&this.refresh()})),this.sectionHeader=M(this.element,$g(".section-footer")),this.sectionDescription=M(this.sectionHeader,$g("p.section-footer-description")),this.sectionLink=M(this.sectionHeader,$g("a.section-footer-link")),this._register(j(this.sectionLink,"click",t=>{t.preventDefault();let o=this.sectionLink.href;o&&this.openerService.open(A.parse(o))})),this.updateSectionHeader()}onContextMenu(e){if(!e.element||e.element.type!=="file-item")return;let t=e.element.item,o={uri:t.uri.toString(),name:t.name,promptType:t.promptType,storage:t.storage,pluginUri:t.pluginUri?.toString()},n=[[p3,t.promptType],[VDe,t.uri.toString()],[EZ,t.disabled]];t.storage&&n.push([m0,t.storage]),t.pluginUri&&n.push([WSi,t.pluginUri.toString()]);let r=this.contextKeyService.createOverlay(n),s=this.menuService.getMenuActions(Rk,r,{arg:o,shouldForwardArgs:!0}),{secondary:l}=zp(s,"inline"),c=t.isBuiltin?[]:[new ri,new it("copyFullPath",d(6238,null),void 0,!0,async()=>{await this.clipboardService.writeText(t.uri.fsPath)}),new it("copyRelativePath",d(6239,null),void 0,!0,async()=>{let u=this.workspaceService.getActiveProjectRoot();if(u&&t.uri.fsPath.startsWith(u.fsPath)){let p=t.uri.fsPath.substring(u.fsPath.length+1);await this.clipboardService.writeText(p)}else{let p=this.labelService.getUriLabel(t.uri,{relative:!0});await this.clipboardService.writeText(p)}})];this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>[...l,...c]})}async setSection(e){this.currentSection=e,this.updateSectionHeader(),await this.loadItems(),this.updateAddButton()}updateSectionHeader(){let e,t,o;switch(this.currentSection){case Zn.Agents:e=d(6227,null),t="https://code.visualstudio.com/docs/copilot/customization/custom-agents",o=d(6259,null);break;case Zn.Skills:e=d(6281,null),t="https://code.visualstudio.com/docs/copilot/customization/agent-skills",o=d(6263,null);break;case Zn.Instructions:e=d(6256,null),t="https://code.visualstudio.com/docs/copilot/customization/custom-instructions",o=d(6261,null);break;case Zn.Hooks:e=d(6253,null),t="https://code.visualstudio.com/docs/copilot/customization/hooks",o=d(6260,null);break;case Zn.Prompts:default:e=d(6278,null),t="https://code.visualstudio.com/docs/copilot/customization/prompt-files",o=d(6262,null);break}this.sectionDescription.textContent=e,this.sectionLink.textContent=o,this.sectionLink.href=t}updateAddButton(){let e=this.buildCreateActions(),[t,...o]=e,n=o.length>0;if(this.addButton.element.style.display=n?"":"none",this.addButtonSimple.element.style.display=n?"none":"",!t){this.addButtonSimple.element.style.display="none",this.addButton.element.style.display="none";return}n?(this.addButton.label=t.label,this.addButton.enabled=t.enabled,this.addButton.primaryButton.setTitle(t.tooltip??""),this.addButton.dropdownButton.setTitle("")):(this.addButtonSimple.label=t.label,this.addButtonSimple.enabled=t.enabled,this.addButtonSimple.setTitle(t.tooltip??""))}buildCreateActions(){let e=this.getTypeLabel(),t=AAi(this.currentSection),o=this.harnessService.getActiveDescriptor(),n=o.sectionOverrides?.get(this.currentSection),r=this.hasActiveWorkspace();if(n?.commandId)return[{label:`$(${R.add.id}) ${n.label}`,enabled:!0,run:()=>{this.commandService.executeCommand(n.commandId)}}];let s=n?.typeLabel??e,l=[],c=new Set;if(n?.rootFile&&r&&(l.push({label:`$(${R.add.id}) ${n.label}`,enabled:!0,run:()=>{this._onDidRequestCreateManual.fire({type:t,target:"workspace-root"})}}),c.add("workspace-root")),t==="hook")return!this.workspaceService.isSessionsWindow&&!o.hideGenerateButton?(l.push({label:`$(${R.sparkle.id}) Generate ${e}`,enabled:!0,run:()=>{this._onDidRequestCreate.fire(t)}}),r&&l.push({label:`$(${R.add.id}) Configure Hooks`,enabled:!0,run:()=>{this._onDidRequestCreateManual.fire({type:t,target:"workspace"})}})):n?.commandId||l.push({label:`$(${R.add.id}) New ${e} (Workspace)`,enabled:r,tooltip:r?void 0:d(6240,null),run:()=>{this._onDidRequestCreateManual.fire({type:t,target:"workspace"})}}),l;if(n?.rootFile||(!this.workspaceService.isSessionsWindow&&!o.hideGenerateButton?l.push({label:`$(${R.sparkle.id}) Generate ${e}`,enabled:!0,run:()=>{this._onDidRequestCreate.fire(t)}}):r?(l.push({label:`$(${R.add.id}) New ${s} (Workspace)`,enabled:!0,run:()=>{this._onDidRequestCreateManual.fire({type:t,target:"workspace"})}}),c.add("workspace")):(l.push({label:`$(${R.add.id}) New ${s} (User)`,enabled:!0,run:()=>{this._onDidRequestCreateManual.fire({type:t,target:"user"})}}),c.add("user"))),r&&!c.has("workspace")&&l.push({label:`$(${R.folder.id}) New ${s} (Workspace)`,enabled:!0,run:()=>{this._onDidRequestCreateManual.fire({type:t,target:"workspace"})}}),c.has("user")||l.push({label:`$(${R.account.id}) New ${s} (User)`,enabled:!0,run:()=>{this._onDidRequestCreateManual.fire({type:t,target:"user"})}}),r&&n?.rootFileShortcuts&&!c.has("workspace-root"))for(let h of n.rootFileShortcuts)l.push({label:`$(${R.file.id}) New ${h}`,enabled:!0,run:()=>{this._onDidRequestCreateManual.fire({type:t,target:"workspace-root",rootFileName:h})}});let u=this.menuService.getMenuActions(eao,this.contextKeyService,{shouldForwardArgs:!0}),p=[];for(let[,h]of u)for(let g of h)if(g instanceof Lo){let f=q.isThemeIcon(g.item.icon)?g.item.icon.id:R.add.id;p.push({label:`$(${f}) ${typeof g.item.title=="string"?g.item.title:g.item.title.value}`,enabled:g.enabled,run:()=>{g.run()}})}return p.length>0?p:l}getDropdownActions(){return this.dropdownActionDisposables.clear(),this.buildCreateActions().slice(1).map((t,o)=>this.dropdownActionDisposables.add(new it(`create_${o}`,t.label,void 0,t.enabled,()=>t.run())))}hasActiveWorkspace(){return!!this.workspaceService.getActiveProjectRoot()}executePrimaryCreateAction(){let e=this.buildCreateActions();e.length>0&&e[0].enabled&&e[0].run()}getTypeLabel(){switch(this.currentSection){case Zn.Agents:return d(6224,null);case Zn.Skills:return d(6280,null);case Zn.Instructions:return d(6255,null);case Zn.Hooks:return d(6252,null);case Zn.Prompts:default:return d(6277,null)}}async refresh(){await this.loadItems(),this.updateAddButton()}async loadItems(){let e=this.currentSection,t=await this.fetchItemsForSection(e);this.currentSection===e&&(this.allItems=t,this.filterItems(),this._onDidChangeItemCount.fire(t.length))}async computeItemCountForSection(e){return(await this.fetchItemsForSection(e)).length}isChatExtensionItem(e){let t=this.productService.defaultChatAgent?.chatExtensionId;return!!t&&Ii.equals(e,t)}applyBuiltinGroupKeys(e,t){return e.map(o=>{if(o.storage!=="extension")return o;let n=t.get(o.uri.toString());return n?this.isChatExtensionItem(n.id)?{...o,isBuiltin:!0,groupKey:o.groupKey??pI}:{...o,extensionLabel:n.displayName||n.id.value}:o})}async fetchItemsForSection(e){let t=AAi(e),o=this.harnessService.getActiveDescriptor();if(o.itemProvider&&t){let b=await this.fetchItemsFromProvider(o.itemProvider,t);return t==="instructions"?this.enrichProviderInstructionItems(b):b}let n=[],r=this.promptsService.getDisabledPromptFiles(t),s=new Map;if(t==="agent"){let b=await this.promptsService.getCustomAgents(Se.None),S=await this.promptsService.listPromptFiles("agent",Se.None);for(let y of S)y.extension&&s.set(y.uri.toString(),{id:y.extension.identifier,displayName:y.extension.displayName});for(let y of b){let w=He(y.uri);n.push({id:y.uri.toString(),uri:y.uri,name:y.name,filename:w,description:y.description,storage:y.source.storage,promptType:t,pluginUri:y.source.storage==="plugin"?y.source.pluginUri:void 0,disabled:r.has(y.uri)}),y.source.storage==="extension"&&!s.has(y.uri.toString())&&s.set(y.uri.toString(),{id:y.source.extensionId})}}else if(t==="skill"){let b=await this.promptsService.findAgentSkills(Se.None),S=await this.promptsService.listPromptFiles("skill",Se.None);for(let k of S)k.extension&&s.set(k.uri.toString(),{id:k.extension.identifier,displayName:k.extension.displayName});let y=this.workspaceService.getSkillUIIntegrations(),w=new En;for(let k of b||[]){let T=He(k.uri),P=k.name||He(ci(k.uri))||T;w.add(k.uri);let O=He(ci(k.uri)),V=y.get(O);n.push({id:k.uri.toString(),uri:k.uri,name:P,filename:T,description:k.description,storage:k.storage,promptType:t,pluginUri:k.storage==="plugin"?this.findPluginUri(k.uri):void 0,disabled:!1,badge:V?d(6283,null):void 0,badgeTooltip:V})}if(r.size>0){for(let k of S)if(!w.has(k.uri)&&r.has(k.uri)){let T=He(k.uri),P=k.name||He(ci(k.uri))||T,O=He(ci(k.uri)),V=y.get(O);n.push({id:k.uri.toString(),uri:k.uri,name:P,filename:T,description:k.description,storage:k.storage,promptType:t,disabled:!0,badge:V?d(6283,null):void 0,badgeTooltip:V})}}}else if(t==="prompt"){let b=await this.promptsService.getPromptSlashCommands(Se.None);for(let S of b){if(S.promptPath.type==="skill")continue;let y=He(S.promptPath.uri);n.push({id:S.promptPath.uri.toString(),uri:S.promptPath.uri,name:S.name,filename:y,description:S.description,storage:S.promptPath.storage,promptType:t,pluginUri:S.promptPath.storage==="plugin"?S.promptPath.pluginUri:void 0,disabled:r.has(S.promptPath.uri)}),S.promptPath.extension&&s.set(S.promptPath.uri.toString(),{id:S.promptPath.extension.identifier,displayName:S.promptPath.extension.displayName})}}else if(t==="hook"){let b=await this.promptsService.listPromptFiles("hook",Se.None),S=this.workspaceService.getActiveProjectRoot(),y=await this.pathService.userHome(),w=y.scheme===Q.file?y.fsPath:y.path;for(let T of b){if(T.storage==="plugin"){let O=He(T.uri);n.push({id:T.uri.toString()+":"+T.name,uri:T.uri,name:T.name||this.getFriendlyName(O),filename:O,storage:T.storage,promptType:t,pluginUri:T.pluginUri,disabled:r.has(T.uri)});continue}let P=!1;try{let O=await this.fileService.readFile(T.uri),V=jr(O.value.toString()),{hooks:H}=Xge(T.uri,V,S,w);if(H.size>0){P=!0;for(let[G,$]of H){let J=XC[G];for(let ae=0;ae<$.hooks.length;ae++){let he=$.hooks[ae],oe=N4(he,Po),de=oe.length>60?oe.substring(0,57)+"...":oe;n.push({id:`${T.uri.toString()}#${$.originalId}[${ae}]`,uri:T.uri,name:J?.label??$.originalId,filename:He(T.uri),description:de||d(6254,null),storage:T.storage,promptType:t,disabled:r.has(T.uri)})}}}}catch{}if(!P){let O=He(T.uri);n.push({id:T.uri.toString(),uri:T.uri,name:T.name||this.getFriendlyName(O),filename:O,storage:T.storage,promptType:t,disabled:r.has(T.uri)})}}let k=this.workspaceService.isSessionsWindow?[]:await this.promptsService.getCustomAgents(Se.None);for(let T of k)if(T.hooks)for(let P of Object.values(IA)){let O=T.hooks[P];if(!O||O.length===0)continue;let V=XC[P];for(let H=0;H<O.length;H++){let G=O[H],$=N4(G,Po),J=$.length>60?$.substring(0,57)+"...":$;n.push({id:`${T.uri.toString()}#hook:${P}[${H}]`,uri:T.uri,name:V?.label??P,filename:He(T.uri),description:`${T.name}: ${J||d(6254,null)}`,storage:T.source.storage,groupKey:"agents",promptType:t,pluginUri:T.source.storage==="plugin"?T.source.pluginUri:void 0,disabled:r.has(T.uri)})}}}else{let b=await this.promptsService.listPromptFiles(t,Se.None);for(let O of b)O.extension&&s.set(O.uri.toString(),{id:O.extension.identifier,displayName:O.extension.displayName});let S=await this.promptsService.listAgentInstructions(Se.None,void 0),y=new En(S.map(O=>O.uri)),w=this.workspaceContextService.getWorkspace().folders.map(O=>O.uri),k=this.workspaceService.getActiveProjectRoot();k&&w.push(k);for(let O of S){let V="local",H=He(O.uri);n.push({id:O.uri.toString(),uri:O.uri,name:H,filename:this.labelService.getUriLabel(O.uri,{relative:!0}),displayName:H,storage:V,promptType:t,typeIcon:Gqt(V),groupKey:"agent-instructions",disabled:r.has(O.uri)})}let T=b.filter(O=>!y.has(O.uri)),P=await Promise.all(T.map(async O=>{try{let V=await this.promptsService.parseNew(O.uri,Se.None);return{item:O,parsed:V}}catch{return{item:O,parsed:void 0}}}));for(let{item:O,parsed:V}of P)n.push(this.buildInstructionListItem(O.uri,O.name||wf(O.uri),O.description,O.storage,V?.header,r.has(O.uri),O.storage==="plugin"?O.pluginUri:void 0))}let l=this.applyBuiltinGroupKeys(n,s),c=this.workspaceService.getStorageSourceFilter(t),u=l.filter(b=>b.storage!==void 0),p=l.filter(b=>b.storage===void 0),h=[...yLt(u,c),...p];n.length=0,n.push(...h);let g=this.harnessService.getActiveDescriptor(),f=g.workspaceSubpaths,v=g.instructionFileFilter;if(f){let b=this.workspaceService.getActiveProjectRoot();for(let S=n.length-1;S>=0;S--){let y=n[S];if(y.storage==="local"&&b&&ws(y.uri,b)&&!lTe(y.uri.path,f)){if(v&&t==="instructions"&&Thi(y.uri.path,v))continue;n.splice(S,1)}}}if(v&&t==="instructions")for(let b=n.length-1;b>=0;b--)Thi(n[b].uri.path,v)||n.splice(b,1);return n.sort((b,S)=>b.name.localeCompare(S.name)),n}async fetchItemsFromProvider(e,t){let o=await e.provideChatSessionCustomizations(Se.None);return o?o.filter(n=>n.type===t).map(n=>{let r=this.findPluginUri(n.uri),s=r?"plugin":this.inferStorageFromUri(n.uri);return{id:n.uri.toString(),uri:n.uri,name:n.name,filename:He(n.uri),description:n.description,promptType:t,disabled:!1,groupKey:n.groupKey,badge:n.badge,badgeTooltip:n.badgeTooltip,storage:s,pluginUri:r}}).sort((n,r)=>n.name.localeCompare(r.name)):[]}async enrichProviderInstructionItems(e){let t=[],o=e.filter(s=>!s.groupKey),n=e.filter(s=>!!s.groupKey),r=await Promise.all(o.map(async s=>{try{let l=await this.promptsService.parseNew(s.uri,Se.None);return{item:s,parsed:l}}catch{return{item:s,parsed:void 0}}}));for(let{item:s,parsed:l}of r)t.push(this.buildInstructionListItem(s.uri,s.name,s.description,s.storage??"local",l?.header,s.disabled,s.pluginUri));return t.push(...n),t.sort((s,l)=>s.name.localeCompare(l.name)),t}buildInstructionListItem(e,t,o,n,r,s,l){let c=r?.name,u=r?.description??o,p=this.getFriendlyName(c||t||wf(e)),h=He(e);if(vcn(e))return{id:e.toString(),uri:e,name:p,filename:this.labelService.getUriLabel(e,{relative:!0}),displayName:p,description:u,storage:n,promptType:"instructions",typeIcon:Gqt(n),groupKey:"agent-instructions",pluginUri:l,disabled:s};let g=t_i(r,DB(e));if(g!==void 0){let f=g==="**"?d(6230,null):g,v=g==="**"?d(6231,null):d(6271,null,g);return{id:e.toString(),uri:e,name:p,filename:this.labelService.getUriLabel(e,{relative:!0}),displayName:p,badge:f,badgeTooltip:v,description:u,storage:n,promptType:"instructions",typeIcon:Gqt(n),groupKey:"context-instructions",pluginUri:l,disabled:s}}return{id:e.toString(),uri:e,name:p,filename:h,displayName:p,description:u,storage:n,promptType:"instructions",typeIcon:Gqt(n),groupKey:"on-demand-instructions",pluginUri:l,disabled:s}}inferStorageFromUri(e){if(this.workspaceContextService.getWorkspaceFolder(e))return"local";let t=this.workspaceService.getActiveProjectRoot();if(t&&ws(e,t))return"local";let o=this.userDataProfileService.currentProfile.promptsHome;return ws(e,o)?"user":"user"}getFriendlyName(e){let t=e.replace(/\.instructions\.md$/i,"").replace(/\.prompt\.md$/i,"").replace(/\.agent\.md$/i,"").replace(/\.md$/i,"");return t=t.replace(/[-_]/g," ").replace(/\b\w/g,o=>o.toUpperCase()),t||e}filterItems(){let e;if(!this.searchQuery.trim())e=this.allItems.map(l=>({...l,nameMatches:void 0,descriptionMatches:void 0}));else{let l=this.searchQuery.toLowerCase();e=[];for(let c of this.allItems){let u=c.displayName??_fe(c.name),p=BO(l,u),h=c.description?BO(l,c.description):null,g=BO(l,c.filename),f=c.badge?BO(l,c.badge):null;(p||h||g||f)&&e.push({...c,nameMatches:p||void 0,descriptionMatches:h||void 0})}}if(this.harnessService.getActiveDescriptor().itemProvider&&e.some(c=>c.groupKey!==void 0)){let c="__ungrouped__",u=new Map;for(let g of e){let f=g.groupKey??c,v=u.get(f);v||(v={groupKey:f,label:f===c?d(6274,null):f,icon:this.getSectionIcon(),description:"",items:[]},u.set(f,v)),v.items.push(g)}let p=Array.from(u.values());for(let g of p)g.items.sort((f,v)=>f.name.localeCompare(v.name));this.displayEntries=[];let h=!0;for(let g of p){if(g.items.length===0)continue;let f=this.collapsedGroups.has(g.groupKey);if(this.displayEntries.push({type:"group-header",id:`group-${g.groupKey}`,groupKey:g.groupKey,label:g.label,icon:g.icon,count:g.items.length,isFirst:h,description:g.description,collapsed:f}),h=!1,!f)for(let v of g.items)this.displayEntries.push({type:"file-item",item:v})}return this.list.splice(0,this.list.length,this.displayEntries),this.updateEmptyState(),e.length}let o=AAi(this.currentSection),n=new Set(this.workspaceService.getStorageSourceFilter(o).sources),r=this.currentSection===Zn.Instructions?[{groupKey:"agent-instructions",label:d(6225,null),icon:BQ,description:d(6226,null),items:[]},{groupKey:"context-instructions",label:d(6236,null),icon:BQ,description:d(6237,null),items:[]},{groupKey:"on-demand-instructions",label:d(6272,null),icon:BQ,description:d(6273,null),items:[]}]:[{groupKey:"local",label:d(6286,null),icon:ust,description:d(6287,null),items:[]},{groupKey:"user",label:d(6284,null),icon:pst,description:d(6285,null),items:[]},{groupKey:"plugin",label:d(6275,null),icon:NW,description:d(6276,null),items:[]},{groupKey:"extension",label:d(6247,null),icon:mst,description:d(6248,null),items:[]},{groupKey:pI,label:d(6232,null),icon:zqt,description:d(6233,null),items:[]},{groupKey:"agents",label:d(6228,null),icon:ZWe,description:d(6229,null),items:[]}].filter(l=>n.has(l.groupKey)||l.groupKey==="agents");for(let l of e){let c=l.groupKey??l.storage??"local",u=r.find(p=>p.groupKey===c);u&&u.items.push(l)}for(let l of r)l.items.sort((c,u)=>c.name.localeCompare(u.name));this.displayEntries=[];let s=!0;for(let l of r){if(l.items.length===0)continue;let c=this.collapsedGroups.has(l.groupKey);if(this.displayEntries.push({type:"group-header",id:`group-${l.groupKey}`,groupKey:l.groupKey,label:l.label,icon:l.icon,count:l.items.length,isFirst:s,description:l.description,collapsed:c}),s=!1,!c)for(let u of l.items)this.displayEntries.push({type:"file-item",item:u})}return this.list.splice(0,this.list.length,this.displayEntries),this.updateEmptyState(),e.length}toggleGroup(e){this.collapsedGroups.has(e.groupKey)?this.collapsedGroups.delete(e.groupKey):this.collapsedGroups.add(e.groupKey),this.filterItems()}updateEmptyState(){if(this.displayEntries.length>0)this.emptyStateContainer.style.display="none",this.listContainer.style.display="";else{this.emptyStateContainer.style.display="flex",this.listContainer.style.display="none",this.emptyStateIcon.className="empty-state-icon";let t=this.getSectionIcon();if(this.emptyStateIcon.classList.add(...q.asClassNameArray(t)),this.searchQuery.trim())this.emptyStateText.textContent=d(6268,null,this.searchQuery),this.emptyStateSubtext.textContent=d(6282,null);else{let o=this.getEmptyStateInfo();this.emptyStateText.textContent=o.title,this.emptyStateSubtext.textContent=o.description}}}getSectionIcon(){switch(this.currentSection){case Zn.Agents:return ZWe;case Zn.Skills:return cst;case Zn.Instructions:return BQ;case Zn.Hooks:return dst;case Zn.Prompts:default:return eVe}}findPluginUri(e){for(let t of this.agentPluginService.plugins.get())if(ws(e,t.uri))return t.uri}getEmptyStateInfo(){switch(this.currentSection){case Zn.Agents:return{title:d(6265,null),description:d(6241,null)};case Zn.Skills:return{title:d(6270,null),description:d(6245,null)};case Zn.Instructions:return{title:d(6267,null),description:d(6243,null)};case Zn.Hooks:return{title:d(6266,null),description:d(6242,null)};case Zn.Prompts:default:return{title:d(6269,null),description:d(6244,null)}}}setSearchQuery(e){this.searchInput.value=e}clearSearch(){this.searchInput.value=""}focusSearch(){this.searchInput.focus()}focusList(){this.list.domFocus(),this.displayEntries.length>0&&this.list.setFocus([0])}revealLastItem(){this.displayEntries.length>0&&this.list.reveal(this.displayEntries.length-1)}layout(e,t){this.element.style.height=`${e}px`,this.searchInput.layout();let o=this.searchAndButtonContainer.offsetHeight;if(o===0){Re(this.element).requestAnimationFrame(()=>this.layout(e,t));return}let n=this.sectionHeader.offsetHeight,r=Math.max(0,e-o-n);this.listContainer.style.height=`${r}px`,this.list.layout(r,t)}get itemCount(){return this.allItems.length}async generateDebugReport(){let e=this.harnessService.getActiveDescriptor();return WCo(this.currentSection,this.promptsService,this.workspaceService,{allItems:this.allItems,displayEntries:this.displayEntries},e.itemProvider)}};tVe=I([m(0,F),m(1,Or),m(2,Wn),m(3,Je),m(4,Xe),m(5,Kt),m(6,X),m(7,Pe),m(8,rt),m(9,zF),m(10,Fi),m(11,nt),m(12,fe),m(13,An),m(14,Te),m(15,UR),m(16,Gg),m(17,ge),m(18,tt),m(19,ln)],tVe);var Jp=class a extends it{constructor(){super(...arguments);this._onDidChange=this._register(new E);this._hidden=!1;this.hideOnDisabled=!0;this._mcpServer=null}get onDidChange(){return this._onDidChange.event}static{this.EXTENSION_ACTION_CLASS="extension-action"}static{this.TEXT_ACTION_CLASS=`${a.EXTENSION_ACTION_CLASS} text`}static{this.LABEL_ACTION_CLASS=`${a.EXTENSION_ACTION_CLASS} label`}static{this.PROMINENT_LABEL_ACTION_CLASS=`${a.LABEL_ACTION_CLASS} prominent`}static{this.ICON_ACTION_CLASS=`${a.EXTENSION_ACTION_CLASS} icon`}get hidden(){return this._hidden}set hidden(e){this._hidden!==e&&(this._hidden=e,this._onDidChange.fire({hidden:e}))}_setEnabled(e){super._setEnabled(e),this.hideOnDisabled&&(this.hidden=!e)}get mcpServer(){return this._mcpServer}set mcpServer(e){this._mcpServer=e,this.update()}},Dfe=class extends Jp{constructor(e,t,o){t=`${t} action-dropdown`;super(e,void 0,t);this.actionsGroups=o;this.menuActionClassNames=[];this._menuActions=[];this.menuActionClassNames=t.split(" "),this.hideOnDisabled=!1,this.actions=o.flat(),this.update(),this._register(U.any(...this.actions.map(n=>n.onDidChange))(()=>this.update(!0))),this.actions.forEach(n=>this._register(n))}get menuActions(){return[...this._menuActions]}get mcpServer(){return super.mcpServer}set mcpServer(e){this.actions.forEach(t=>t.mcpServer=e),super.mcpServer=e}update(e){e||this.actions.forEach(n=>n.update());let t=this.actionsGroups.map(n=>n.filter(r=>!r.hidden)),o=[];for(let n of t)n.length&&(o=[...o,...n,new ri]);o=o.length?o.slice(0,o.length-1):o,this.primaryAction=o[0],this._menuActions=o.length>1?o:[],this._onDidChange.fire({menuActions:this._menuActions}),this.primaryAction?(this.hidden=!1,this.enabled=this.primaryAction.enabled,this.label=this.getLabel(this.primaryAction),this.tooltip=this.primaryAction.tooltip):(this.hidden=!0,this.enabled=!1)}async run(){this.enabled&&await this.primaryAction?.run()}getLabel(e){return e.label}},qqt=class extends IY{constructor(i,e,t){super(null,i,e,t),this._register(i.onDidChange(o=>{(o.hidden!==void 0||o.menuActions!==void 0)&&this.updateClass()}))}render(i){super.render(i),this.updateClass()}updateClass(){if(super.updateClass(),this.element&&this.dropdownMenuActionViewItem?.element){this.element.classList.toggle("hide",this._action.hidden);let i=this._action.menuActions.length===0;this.element.classList.toggle("empty",i),this.dropdownMenuActionViewItem.element.classList.toggle("hide",i)}}},HQ=class extends Jp{constructor(e,t,o,n,r){super(e,t,o,n);this.instantiationService=r;this._actionViewItem=null}createActionViewItem(e){return this._actionViewItem=this.instantiationService.createInstance(gst,this,e),this._actionViewItem}run(e){return this._actionViewItem?.showMenu(e),Promise.resolve()}};HQ=I([m(4,F)],HQ);var gst=class extends hs{constructor(e,t,o){super(null,e,{...t,icon:!0,label:!0});this.contextMenuService=o}showMenu(e){if(this.element){let t=this.getActions(e),o=ir(this.element),n={x:o.left,y:o.top+o.height+10};this.contextMenuService.showContextMenu({getAnchor:()=>n,getActions:()=>t,actionRunner:this.actionRunner,onHide:()=>a1(t)})}}getActions(e){let t=[];for(let o of e)t=[...t,...o,new ri];return t.length?t.slice(0,t.length-1):t}};gst=I([m(2,Xe)],gst);var YT=class extends Jp{constructor(e,t,o,n){super("extensions.install",d(11933,null),YT.CLASS,!1);this.open=e;this.mcpWorkbenchService=t;this.telemetryService=o;this.mcpService=n;this.update()}static{this.CLASS=`${this.LABEL_ACTION_CLASS} prominent install`}static{this.HIDE=`${this.CLASS} hide`}update(){this.enabled=!1,this.class=YT.HIDE,!(!this.mcpServer?.gallery&&!this.mcpServer?.installable)&&this.mcpServer.installState===3&&(this.class=YT.CLASS,this.enabled=this.mcpWorkbenchService.canInstall(this.mcpServer)===!0)}async run(){if(!this.mcpServer)return;this.open&&(this.mcpWorkbenchService.open(this.mcpServer),en(d(11948,null,this.mcpServer.label))),this.telemetryService.publicLog2("mcp:action:install",{name:this.mcpServer.gallery?.name});let e=await this.mcpWorkbenchService.install(this.mcpServer);await Qzt(this.mcpService,t=>t.definition.label===e.name)}};YT=I([m(1,Ng),m(2,Te),m(3,_s)],YT);var bq=class extends Jp{constructor(e,t,o,n,r,s){super("extensions.installWorkspace",d(11938,null),YT.CLASS,!1);this.open=e;this.mcpWorkbenchService=t;this.workspaceService=o;this.quickInputService=n;this.telemetryService=r;this.mcpService=s;this.update()}static{this.CLASS=`${this.LABEL_ACTION_CLASS} prominent install`}static{this.HIDE=`${this.CLASS} hide`}update(){this.enabled=!1,this.class=bq.HIDE,this.workspaceService.getWorkbenchState()!==1&&(!this.mcpServer?.gallery&&!this.mcpServer?.installable||this.mcpServer.installState!==3&&this.mcpServer.local?.scope==="workspace"||(this.class=YT.CLASS,this.enabled=this.mcpWorkbenchService.canInstall(this.mcpServer)===!0))}async run(){if(!this.mcpServer)return;this.open&&(this.mcpWorkbenchService.open(this.mcpServer,{preserveFocus:!0}),en(d(11948,null,this.mcpServer.label)));let e=await this.getConfigurationTarget();if(!e)return;this.telemetryService.publicLog2("mcp:action:install:workspace",{name:this.mcpServer.gallery?.name});let t=await this.mcpWorkbenchService.install(this.mcpServer,{target:e});await Qzt(this.mcpService,o=>o.definition.label===t.name)}async getConfigurationTarget(){let e=[];for(let o of this.workspaceService.getWorkspace().folders)e.push({target:o,label:o.name,description:d(11934,null)});return this.workspaceService.getWorkbenchState()===3&&(e.length>0&&e.push({type:"separator"}),e.push({target:5,label:d(11947,null)})),e.length===1?e[0].target:(await this.quickInputService.pick(e,{title:d(11946,null)}))?.target}};bq=I([m(1,Ng),m(2,Pe),m(3,Ue),m(4,Te),m(5,_s)],bq);var Sq=class extends Jp{constructor(e,t,o,n,r,s){super("extensions.installRemote",d(11936,null),YT.CLASS,!1);this.open=e;this.mcpWorkbenchService=t;this.environmentService=o;this.telemetryService=n;this.labelService=r;this.mcpService=s;let l=this.labelService.getHostLabel(Q.vscodeRemote,this.environmentService.remoteAuthority);this.label=d(11937,null,l),this.update()}static{this.CLASS=`${this.LABEL_ACTION_CLASS} prominent install`}static{this.HIDE=`${this.CLASS} hide`}update(){this.enabled=!1,this.class=Sq.HIDE,this.environmentService.remoteAuthority&&(!this.mcpServer?.gallery&&!this.mcpServer?.installable||this.mcpServer.installState!==3&&(this.mcpServer.local?.scope==="remoteUser"||this.mcpWorkbenchService.local.find(e=>e.name===this.mcpServer?.name&&e.local?.scope==="remoteUser"))||(this.class=YT.CLASS,this.enabled=this.mcpWorkbenchService.canInstall(this.mcpServer)===!0))}async run(){if(!this.mcpServer)return;this.open&&(this.mcpWorkbenchService.open(this.mcpServer),en(d(11948,null,this.mcpServer.label))),this.telemetryService.publicLog2("mcp:action:install:remote",{name:this.mcpServer.gallery?.name});let e=await this.mcpWorkbenchService.install(this.mcpServer,{target:4});await Qzt(this.mcpService,t=>t.definition.label===e.name)}};Sq=I([m(1,Ng),m(2,At),m(3,Te),m(4,rt),m(5,_s)],Sq);var nVe=class a extends Jp{static{this.LABEL=d(11935,null)}static{this.CLASS=`${Jp.LABEL_ACTION_CLASS} install installing`}constructor(){super("extension.installing",a.LABEL,a.CLASS,!1)}update(){this.class=`${a.CLASS}${this.mcpServer&&this.mcpServer.installState===0?"":" hide"}`}},OW=class extends Jp{constructor(e){super("extensions.uninstall",d(11953,null),OW.CLASS,!1);this.mcpWorkbenchService=e;this.update()}static{this.CLASS=`${this.LABEL_ACTION_CLASS} prominent uninstall`}static{this.HIDE=`${this.CLASS} hide`}update(){if(this.enabled=!1,this.class=OW.HIDE,!!this.mcpServer&&this.mcpServer.local){if(this.mcpServer.installState!==1){this.enabled=!1;return}this.class=OW.CLASS,this.enabled=!0,this.label=d(11953,null)}}async run(){this.mcpServer&&await this.mcpWorkbenchService.uninstall(this.mcpServer)}};OW=I([m(0,Ng)],OW);var Aoe=class extends Jp{constructor(e){super(Aoe.ID,d(11931,null),Jp.LABEL_ACTION_CLASS);this.mcpService=e;this.tooltip=d(11932,null),this.update()}static{this.ID="mcpServer.enableGlobally"}update(){if(this.enabled=!1,!this.mcpServer?.local)return;let e=this.mcpService.servers.get().find(o=>o.definition.id===this.mcpServer?.id);if(!e)return;let t=e.enablement.get();this.enabled=gN(t)}async run(){this.mcpServer&&this.mcpService.enablementModel.setEnabled(this.mcpServer.id,2)}};Aoe=I([m(0,_s)],Aoe);var Noe=class extends Jp{constructor(e,t){super(Noe.ID,d(11929,null),Jp.LABEL_ACTION_CLASS);this.mcpService=e;this.workspaceService=t;this.tooltip=d(11930,null),this.update()}static{this.ID="mcpServer.enableForWorkspace"}update(){if(this.enabled=!1,!this.mcpServer?.local||this.workspaceService.getWorkbenchState()===1)return;let e=this.mcpService.servers.get().find(o=>o.definition.id===this.mcpServer?.id);if(!e)return;let t=e.enablement.get();this.enabled=gN(t)}async run(){this.mcpServer&&this.mcpService.enablementModel.setEnabled(this.mcpServer.id,3)}};Noe=I([m(0,_s),m(1,Pe)],Noe);var Ooe=class extends Jp{constructor(e){super(Ooe.ID,d(11927,null),Jp.LABEL_ACTION_CLASS);this.mcpService=e;this.tooltip=d(11928,null),this.update()}static{this.ID="mcpServer.disableGlobally"}update(){if(this.enabled=!1,!this.mcpServer?.local)return;let e=this.mcpService.servers.get().find(o=>o.definition.id===this.mcpServer?.id);if(!e)return;let t=e.enablement.get();this.enabled=Ub(t)}async run(){this.mcpServer&&this.mcpService.enablementModel.setEnabled(this.mcpServer.id,0)}};Ooe=I([m(0,_s)],Ooe);var Foe=class extends Jp{constructor(e,t){super(Foe.ID,d(11925,null),Jp.LABEL_ACTION_CLASS);this.mcpService=e;this.workspaceService=t;this.tooltip=d(11926,null),this.update()}static{this.ID="mcpServer.disableForWorkspace"}update(){if(this.enabled=!1,!this.mcpServer?.local||this.workspaceService.getWorkbenchState()===1)return;let e=this.mcpService.servers.get().find(o=>o.definition.id===this.mcpServer?.id);if(!e)return;let t=e.enablement.get();this.enabled=Ub(t)}async run(){this.mcpServer&&this.mcpService.enablementModel.setEnabled(this.mcpServer.id,1)}};Foe=I([m(0,_s),m(1,Pe)],Foe);var iVe=class extends Dfe{constructor(i){super("mcpServer.enable",Jp.LABEL_ACTION_CLASS,[[i.createInstance(Aoe),i.createInstance(Noe)]])}};iVe=I([m(0,F)],iVe);var oVe=class extends Dfe{constructor(i){super("mcpServer.disable",Jp.LABEL_ACTION_CLASS,[[i.createInstance(Ooe),i.createInstance(Foe)]])}};oVe=I([m(0,F)],oVe);function fst(a,i,e){return e.invokeFunction(t=>{let o=t.get(Pe),n=t.get(At),r=[];if(a.installState===1){if(r.push([e.createInstance(UQ)]),r.push([e.createInstance(zQ),e.createInstance(Iq)]),r.push([e.createInstance(Aoe),e.createInstance(Noe),e.createInstance(Ooe),e.createInstance(Foe)]),r.push([e.createInstance(fU)]),r.push([e.createInstance(KQ),e.createInstance(yq),e.createInstance(Woe)]),r.push([e.createInstance(GQ),e.createInstance(qQ)]),r.push([e.createInstance($Q)]),!i){let l=[e.createInstance(OW)];o.getWorkbenchState()!==1&&l.push(e.createInstance(bq,!1)),n.remoteAuthority&&a.local?.scope!=="remoteUser"&&l.push(e.createInstance(Sq,!1)),r.push(l)}}else{let l=[];o.getWorkbenchState()!==1&&l.push(e.createInstance(bq,!i)),n.remoteAuthority&&l.push(e.createInstance(Sq,!i)),r.push(l)}return r.forEach(l=>l.forEach(c=>c.mcpServer=a)),r})}var HM=class extends HQ{constructor(e,t){super(HM.ID,"","",!0,t);this.isEditorAction=e;this.tooltip=d(11939,null),this.update()}static{this.ID="mcpServer.manage"}static{this.Class=`${Jp.ICON_ACTION_CLASS} manage `+q.asClassName(ihe)}static{this.HideManageExtensionClass=`${this.Class} hide`}async run(){return super.run(this.mcpServer?fst(this.mcpServer,this.isEditorAction,this.instantiationService):[])}update(){this.class=HM.HideManageExtensionClass,this.enabled=!1,this.mcpServer&&(this.isEditorAction?(this.enabled=!0,this.class=HM.Class):(this.enabled=!!this.mcpServer.local,this.class=this.enabled?HM.Class:HM.HideManageExtensionClass))}};HM=I([m(1,F)],HM);var UQ=class extends Jp{constructor(e){super("extensions.start",d(11951,null),UQ.CLASS,!1);this.mcpService=e;this.update()}static{this.CLASS=`${this.LABEL_ACTION_CLASS} prominent start`}static{this.HIDE=`${this.CLASS} hide`}update(){this.enabled=!1,this.class=UQ.HIDE;let e=this.getServer();if(!e)return;let t=e.connectionState.get();dr.canBeStarted(t.state)&&(this.class=UQ.CLASS,this.enabled=!0,this.label=d(11951,null))}async run(){let e=this.getServer();e&&(await e.start({promptType:"all-untrusted"}),e.showOutput())}getServer(){if(this.mcpServer&&this.mcpServer.local)return this.mcpService.servers.get().find(e=>e.definition.id===this.mcpServer?.id)}};UQ=I([m(0,_s)],UQ);var zQ=class extends Jp{constructor(e){super("extensions.stop",d(11952,null),zQ.CLASS,!1);this.mcpService=e;this.update()}static{this.CLASS=`${this.LABEL_ACTION_CLASS} prominent stop`}static{this.HIDE=`${this.CLASS} hide`}update(){this.enabled=!1,this.class=zQ.HIDE;let e=this.getServer();if(!e)return;let t=e.connectionState.get();dr.canBeStarted(t.state)||(this.class=zQ.CLASS,this.enabled=!0,this.label=d(11952,null))}async run(){let e=this.getServer();e&&await e.stop()}getServer(){if(this.mcpServer&&this.mcpServer.local)return this.mcpService.servers.get().find(e=>e.definition.id===this.mcpServer?.id)}};zQ=I([m(0,_s)],zQ);var Iq=class extends Jp{constructor(e){super("extensions.restart",d(11950,null),Iq.CLASS,!1);this.mcpService=e;this.update()}static{this.CLASS=`${this.LABEL_ACTION_CLASS} prominent restart`}static{this.HIDE=`${this.CLASS} hide`}update(){this.enabled=!1,this.class=Iq.HIDE;let e=this.getServer();if(!e)return;let t=e.connectionState.get();dr.canBeStarted(t.state)||(this.class=Iq.CLASS,this.enabled=!0,this.label=d(11950,null))}async run(){let e=this.getServer();e&&(await e.stop(),await e.start({promptType:"all-untrusted"}),e.showOutput())}getServer(){if(this.mcpServer&&this.mcpServer.local)return this.mcpService.servers.get().find(e=>e.definition.id===this.mcpServer?.id)}};Iq=I([m(0,_s)],Iq);var fU=class extends Jp{constructor(e,t,o){super("extensions.restart",d(11950,null),Iq.CLASS,!1);this.mcpService=e;this._authenticationQueryService=t;this._authenticationService=o;this.update()}static{this.CLASS=`${this.LABEL_ACTION_CLASS} prominent account`}static{this.HIDE=`${this.CLASS} hide`}static{this.SIGN_OUT=d(11945,null)}static{this.DISCONNECT=d(11941,null)}update(){if(this.enabled=!1,this.class=fU.HIDE,!this.getServer())return;let t=this.getAccountQuery();if(!t)return;this._accountQuery=t,this.class=fU.CLASS,this.enabled=!0;let o=t.entities().getEntityCount().total>1?fU.DISCONNECT:fU.SIGN_OUT;o+=` (${t.accountName})`,this.label=o}async run(){let e=this.getServer();if(!e)return;let t=this.getAccountQuery();if(!t)return;await e.stop();let{providerId:o,accountName:n}=t;if(t.mcpServer(e.definition.id).setAccessAllowed(!1,e.definition.label),this.label===fU.SIGN_OUT){let s=(await this._authenticationService.getAccounts(o)).find(l=>l.label===n);if(s){let l=await this._authenticationService.getSessions(o,void 0,{account:s});for(let c of l)await this._authenticationService.removeSession(o,c.id)}}}getServer(){if(this.mcpServer&&this.mcpServer.local)return this.mcpService.servers.get().find(e=>e.definition.id===this.mcpServer?.id)}getAccountQuery(){let e=this.getServer();if(!e)return;if(this._accountQuery)return this._accountQuery;let t=e.definition.id,o=this._authenticationQueryService.mcpServer(t).getAllAccountPreferences();if(o.size)for(let[n,r]of o){let s=this._authenticationQueryService.provider(n).account(r);if(s.mcpServer(t).isAccessAllowed())return s}}};fU=I([m(0,_s),m(1,fM),m(2,xs)],fU);var KQ=class extends Jp{constructor(e){super("extensions.output",d(11949,null),KQ.CLASS,!1);this.mcpService=e;this.update()}static{this.CLASS=`${this.LABEL_ACTION_CLASS} prominent output`}static{this.HIDE=`${this.CLASS} hide`}update(){this.enabled=!1,this.class=KQ.HIDE,this.getServer()&&(this.class=KQ.CLASS,this.enabled=!0,this.label=d(11949,null))}async run(){let e=this.getServer();e&&e.showOutput()}getServer(){if(this.mcpServer&&this.mcpServer.local)return this.mcpService.servers.get().find(e=>e.definition.id===this.mcpServer?.id)}};KQ=I([m(0,_s)],KQ);var yq=class extends Jp{constructor(e){super("extensions.config",d(11923,null),yq.CLASS,!1);this.mcpWorkbenchService=e;this.update()}static{this.CLASS=`${this.LABEL_ACTION_CLASS} prominent config`}static{this.HIDE=`${this.CLASS} hide`}update(){this.enabled=!1,this.class=yq.HIDE,this.mcpServer?.local&&(this.class=yq.CLASS,this.enabled=!0)}async run(){this.mcpServer?.local&&this.mcpWorkbenchService.open(this.mcpServer,{tab:"configuration"})}};yq=I([m(0,Ng)],yq);var Woe=class extends Jp{constructor(e,t,o){super("extensions.jsonConfig",d(11924,null),Woe.CLASS,!1);this.mcpService=e;this.mcpRegistry=t;this.editorService=o;this.update()}static{this.CLASS=`${this.LABEL_ACTION_CLASS} prominent config`}static{this.HIDE=`${this.CLASS} hide`}update(){this.enabled=!1,this.class=Woe.HIDE,this.getConfigurationTarget()&&(this.class=yq.CLASS,this.enabled=!0)}async run(){let e=this.getConfigurationTarget();e&&this.editorService.openEditor({resource:A.isUri(e)?e:e.uri,options:{selection:A.isUri(e)?void 0:e.range}})}getConfigurationTarget(){if(!this.mcpServer||!this.mcpServer.local)return;let e=this.mcpService.servers.get().find(n=>n.definition.label===this.mcpServer?.name);if(!e)return;let t=this.mcpRegistry.collections.get().find(n=>n.id===e.collection.id);return t?.serverDefinitions.get().find(n=>n.id===e.definition.id)?.presentation?.origin||t?.presentation?.origin}};Woe=I([m(0,_s),m(1,Lc),m(2,ee)],Woe);var GQ=class extends Jp{constructor(e,t){super("extensions.config",d(11940,null),GQ.CLASS,!1);this.mcpService=e;this.commandService=t;this.update()}static{this.CLASS=`${this.LABEL_ACTION_CLASS} prominent config`}static{this.HIDE=`${this.CLASS} hide`}update(){this.enabled=!1,this.class=GQ.HIDE,this.getServer()&&(this.class=GQ.CLASS,this.enabled=!0,this.label=d(11940,null))}async run(){let e=this.getServer();e&&this.commandService.executeCommand("workbench.mcp.configureSamplingModels",e)}getServer(){if(this.mcpServer&&this.mcpServer.local)return this.mcpService.servers.get().find(e=>e.definition.id===this.mcpServer?.id)}};GQ=I([m(0,_s),m(1,ge)],GQ);var qQ=class extends Jp{constructor(e,t,o){super("extensions.config",d(11943,null),qQ.CLASS,!1);this.mcpService=e;this.samplingService=t;this.editorService=o;this.update()}static{this.CLASS=`${this.LABEL_ACTION_CLASS} prominent config`}static{this.HIDE=`${this.CLASS} hide`}update(){this.enabled=!1,this.class=qQ.HIDE;let e=this.getServer();e&&this.samplingService.hasLogs(e)&&(this.class=qQ.CLASS,this.enabled=!0)}async run(){let e=this.getServer();e&&this.samplingService.hasLogs(e)&&this.editorService.openEditor({resource:void 0,contents:this.samplingService.getLogText(e),label:d(11944,null,e.definition.label)})}getServer(){if(this.mcpServer&&this.mcpServer.local)return this.mcpService.servers.get().find(e=>e.definition.id===this.mcpServer?.id)}};qQ=I([m(0,_s),m(1,F4),m(2,ee)],qQ);var $Q=class extends Jp{constructor(e,t){super("extensions.config",d(11942,null),$Q.CLASS,!1);this.mcpService=e;this.commandService=t;this.update()}static{this.CLASS=`${this.LABEL_ACTION_CLASS} prominent config`}static{this.HIDE=`${this.CLASS} hide`}update(){this.enabled=!1,this.class=$Q.HIDE;let e=this.getServer();if(!e)return;let t=e.capabilities.get();t!==void 0&&!(t&16)||(this.class=$Q.CLASS,this.enabled=!0)}async run(){let e=this.getServer();if(!e)return;let t=e.capabilities.get();if(!(t!==void 0&&!(t&16)))return this.commandService.executeCommand("workbench.mcp.browseResources",e)}getServer(){if(this.mcpServer&&this.mcpServer.local)return this.mcpService.servers.get().find(e=>e.definition.id===this.mcpServer?.id)}};$Q=I([m(0,_s),m(1,ge)],$Q);var aL=class extends Jp{constructor(e,t){super("extensions.status","",`${aL.CLASS} hide`,!1);this.mcpWorkbenchService=e;this.commandService=t;this._status=[];this._onDidChangeStatus=this._register(new E);this.onDidChangeStatus=this._onDidChangeStatus.event;this.update()}static{this.CLASS=`${Jp.ICON_ACTION_CLASS} extension-status`}get status(){return this._status}update(){this.computeAndUpdateStatus()}computeAndUpdateStatus(){if(this.updateStatus(void 0,!0),this.enabled=!1,!this.mcpServer)return;if((this.mcpServer.gallery||this.mcpServer.installable)&&this.mcpServer.installState===3){let t=this.mcpWorkbenchService.canInstall(this.mcpServer);if(t!==!0){this.updateStatus({icon:Gu,message:t},!0);return}}let e=this.mcpServer.runtimeStatus;e?.message&&this.updateStatus({icon:e.message.severity===bt.Warning?Gu:e.message.severity===bt.Error?OS:Ug,message:e.message.text},!0)}updateStatus(e,t){if(e){if(this._status.some(o=>o.message.value===e.message.value&&o.icon?.id===e.icon?.id))return}else{if(this._status.length===0)return;this._status=[]}e&&(this._status.push(e),this._status.sort((o,n)=>n.icon===IM?-1:o.icon===IM?1:n.icon===OS?-1:o.icon===OS?1:n.icon===Gu?-1:o.icon===Gu?1:n.icon===Ug?-1:o.icon===Ug?1:0)),t&&(e?.icon===OS?this.class=`${aL.CLASS} extension-status-error ${q.asClassName(OS)}`:e?.icon===Gu?this.class=`${aL.CLASS} extension-status-warning ${q.asClassName(Gu)}`:e?.icon===Ug?this.class=`${aL.CLASS} extension-status-info ${q.asClassName(Ug)}`:e?.icon===IM?this.class=`${aL.CLASS} ${q.asClassName(IM)}`:this.class=`${aL.CLASS} hide`),this._onDidChangeStatus.fire()}async run(){if(this._status[0]?.icon===IM)return this.commandService.executeCommand("workbench.trust.manage")}};aL=I([m(0,Ng),m(1,ge)],aL);var rVe=_,jqt=36,Qqt=40,sVe=class{constructor(i,e){this.templateId=i;this.hoverService=e}renderTemplate(i){let e=new N,t=new N;i.classList.add("ai-customization-group-header");let o=M(i,rVe(".group-chevron")),n=M(i,rVe(".group-icon")),r=M(i,rVe(".group-label-group")),s=M(r,rVe(".group-label")),l=M(r,rVe(".group-info"));l.classList.add(...q.asClassNameArray(R.info));let c=M(i,rVe(".group-count"));return{container:i,chevron:o,icon:n,label:s,count:c,infoIcon:l,disposables:e,elementDisposables:t}}renderElement(i,e,t){t.elementDisposables.clear(),t.chevron.className="group-chevron",t.chevron.classList.add(...q.asClassNameArray(i.collapsed?R.chevronRight:R.chevronDown)),t.icon.className="group-icon",t.icon.classList.add(...q.asClassNameArray(i.icon)),t.label.textContent=i.label,t.count.textContent=`${i.count}`,t.elementDisposables.add(this.hoverService.setupDelayedHover(t.infoIcon,()=>({content:i.description,appearance:{compact:!0,skipFadeInAnimation:!0}}))),t.container.classList.toggle("collapsed",i.collapsed),t.container.classList.toggle("has-previous-group",!i.isFirst)}disposeTemplate(i){i.elementDisposables.dispose(),i.disposables.dispose()}};var Zp=_,bcn=36,WAi="plugin.",Scn=["github.copilot","github.copilot-chat"];function Icn(a){return Scn.some(i=>Ii.equals(a,i))}function BCo(a){return a?.startsWith(WAi)?a.slice(WAi.length):void 0}var VAi=class{getHeight(i){return i.type==="group-header"?i.isFirst?jqt:Qqt:i.type==="server-item"&&i.server.gallery&&!i.server.local?62:bcn}getTemplateId(i){if(i.type==="group-header")return"mcpGroupHeader";if(i.type==="builtin-item")return"mcpServerItem";let e=i.server;return e.gallery&&!e.local?"mcpGalleryItem":"mcpServerItem"}},vst=class{constructor(i,e,t,o,n){this.mcpService=i;this.workspaceService=e;this.agentPluginService=t;this.harnessService=o;this.hoverService=n;this.templateId="mcpServerItem"}renderTemplate(i){i.classList.add("mcp-server-item");let e=M(i,Zp(".mcp-server-icon"));e.classList.add(...q.asClassNameArray(FCo));let t=M(i,Zp(".mcp-server-details")),o=M(t,Zp(".mcp-server-name-row")),n=M(o,Zp(".mcp-server-name")),r=M(o,Zp(".inline-badge.mcp-bridged-badge"));r.textContent=d(6366,null);let s=M(t,Zp(".mcp-server-description")),l=M(i,Zp(".mcp-server-status"));return{container:i,typeIcon:e,name:n,description:s,status:l,bridgedBadge:r,disposables:new N}}renderElement(i,e,t){if(t.disposables.clear(),t.disposables.add(be(n=>{let r=this.harnessService.activeHarness.read(n);t.bridgedBadge.style.display=r!=="vscode"?"":"none"})),t.disposables.add(this.hoverService.setupManagedHover(Ri("mouse"),t.bridgedBadge,d(6367,null))),i.type==="builtin-item"){t.container.classList.add("builtin"),t.name.textContent=_fe(i.label),i.description?(t.description.textContent=Tfe(i.description),t.description.style.display=""):t.description.style.display="none",t.status.style.display="none";let n=BCo(i.collectionId);n&&t.disposables.add(this.hoverService.setupDelayedHover(t.container,()=>{let r=this.agentPluginService.plugins.get().find(s=>s.uri.toString()===n);return r?{content:`${i.label}
${d(6380,null,r.label)}`,appearance:{compact:!0,skipFadeInAnimation:!0}}:{content:i.label,appearance:{compact:!0,skipFadeInAnimation:!0}}}));return}t.container.classList.remove("builtin"),t.name.textContent=_fe(i.server.label),i.server.description?(t.description.textContent=Tfe(i.server.description),t.description.style.display=""):t.description.style.display="none";let o=this.mcpService.servers.get().find(n=>n.definition.id===i.server.id);t.disposables.add(be(n=>{let r=o?gN(o.enablement.read(n)):!1,s=o?.connectionState.read(n);t.container.classList.toggle("disabled",r),this.updateStatus(t.status,r?"disabled":s?.state)}))}updateStatus(i,e){if(i.className="mcp-server-status",this.workspaceService.isSessionsWindow){i.style.display="none";return}if(i.style.display="",e==="disabled"){i.textContent=d(6374,null),i.classList.add("disabled");return}switch(e){case dr.Kind.Running:i.textContent=d(6395,null),i.classList.add("running");break;case dr.Kind.Starting:i.textContent=d(6399,null),i.classList.add("starting");break;case dr.Kind.Error:i.textContent=d(6376,null),i.classList.add("error");break;case dr.Kind.Stopped:default:i.textContent=d(6400,null),i.classList.add("stopped");break}}disposeTemplate(i){i.disposables.dispose()}};vst=I([m(0,_s),m(1,zF),m(2,Gg),m(3,UR),m(4,nt)],vst);var BAi=class{constructor(i){this.mcpWorkbenchService=i;this.templateId="mcpGalleryItem"}renderTemplate(i){i.classList.add("mcp-server-item","mcp-gallery-item","extension-list-item");let e=M(i,Zp(".details")),t=M(e,Zp(".header-container")),o=M(t,Zp(".header")),n=M(o,Zp("span.name")),r=M(e,Zp(".description.ellipsis")),s=M(e,Zp(".footer")),l=M(s,Zp(".publisher-container")),c=M(l,Zp("span.publisher-name")),u=M(s,Zp(".mcp-gallery-action")),p=new Wi(u,{...Qo,supportIcons:!0});p.element.classList.add("mcp-gallery-install-button");let h=new N;return h.add(p),{container:i,name:n,publisher:c,description:r,installButton:p,elementDisposables:new N,templateDisposables:h}}renderElement(i,e,t){t.elementDisposables.clear(),t.name.textContent=i.server.label,t.publisher.textContent=i.server.publisherDisplayName?`by ${i.server.publisherDisplayName}`:"",t.description.textContent=i.server.description||"",this.updateInstallButton(t.installButton,i.server),t.elementDisposables.add(t.installButton.onDidClick(async()=>{this.mcpWorkbenchService.canInstall(i.server)===!0&&(t.installButton.label=d(6384,null),t.installButton.enabled=!1,await this.mcpWorkbenchService.install(i.server))})),t.elementDisposables.add(this.mcpWorkbenchService.onChange(o=>{(!o||o.id===i.server.id)&&this.updateInstallButton(t.installButton,i.server)}))}updateInstallButton(i,e){switch(e.installState){case 1:i.label=d(6383,null),i.enabled=!1;break;case 0:i.label=d(6384,null),i.enabled=!1;break;default:i.label=d(6382,null),i.enabled=!0;break}}disposeTemplate(i){i.elementDisposables.dispose(),i.templateDisposables.dispose()}},aVe=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this.instantiationService=e;this.mcpWorkbenchService=t;this.mcpService=o;this.mcpRegistry=n;this.commandService=r;this.openerService=s;this.contextViewService=l;this.contextMenuService=c;this.hoverService=u;this.agentPluginService=p;this.dialogService=h;this._onDidSelectServer=this._register(new E);this.onDidSelectServer=this._onDidSelectServer.event;this._onDidChangeItemCount=this._register(new E);this.onDidChangeItemCount=this._onDidChangeItemCount.event;this._onDidRequestShowPlugin=this._register(new E);this.onDidRequestShowPlugin=this._onDidRequestShowPlugin.event;this.filteredServers=[];this.filteredBuiltinCount=0;this.displayEntries=[];this.galleryServers=[];this.searchQuery="";this.browseMode=!1;this.lastHeight=0;this.lastWidth=0;this.collapsedGroups=new Set;this.delayedFilter=new Xo(200);this.delayedGallerySearch=new Xo(400);this.element=Zp(".mcp-list-widget"),this.create(),this._register({dispose:()=>{this.galleryCts?.dispose()}})}create(){this.searchAndButtonContainer=M(this.element,Zp(".list-search-and-button-container"));let e=M(this.searchAndButtonContainer,Zp(".list-search-container"));this.searchInput=this._register(new Vc(e,this.contextViewService,{placeholder:d(6397,null),inputBoxStyles:Cl})),this._register(this.searchInput.onDidChange(()=>{this.searchQuery=this.searchInput.value,this.browseMode?this.delayedGallerySearch.trigger(()=>this.queryGallery()):this.delayedFilter.trigger(()=>this.filterServers())}));let t=M(this.searchAndButtonContainer,Zp(".list-button-group")),o=M(t,Zp(".list-add-button-container"));this.browseButton=this._register(new Wi(o,{...Qo,secondary:!0,supportIcons:!0})),this.browseButton.label=`$(${R.library.id}) ${d(6368,null)}`,this.browseButton.element.classList.add("list-add-button"),this._register(this.browseButton.onDidClick(()=>{this.toggleBrowseMode(!this.browseMode)})),this.addButton=this._register(new Wi(t,{...Qo,secondary:!0,supportIcons:!0,title:d(6362,null),ariaLabel:d(6362,null)})),this.addButton.label=`$(${R.add.id})`,this.addButton.element.classList.add("list-icon-button"),this._register(this.hoverService.setupManagedHover(Ri("element"),this.addButton.element,d(6363,null))),this._register(this.addButton.onDidClick(()=>{this.commandService.executeCommand("workbench.mcp.addConfiguration")})),this.backLink=M(this.element,Zp(".mcp-back-link")),this.backLink.setAttribute("role","button"),this.backLink.tabIndex=0,this.backLink.setAttribute("aria-label",d(6365,null)),M(this.backLink,Zp("span")).classList.add(...q.asClassNameArray(R.arrowLeft));let r=M(this.backLink,Zp("span"));r.textContent=d(6364,null),this._register(j(this.backLink,"click",()=>{this.toggleBrowseMode(!1)})),this._register(j(this.backLink,"keydown",g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),this.toggleBrowseMode(!1))})),this.backLink.style.display="none",this.emptyContainer=M(this.element,Zp(".mcp-empty-state"));let s=M(this.emptyContainer,Zp(".empty-state-header"));M(s,Zp(".empty-icon")).classList.add(...q.asClassNameArray(R.server)),this.emptyText=M(s,Zp(".empty-text")),this.emptySubtext=M(this.emptyContainer,Zp(".empty-subtext")),this.listContainer=M(this.element,Zp(".mcp-list-container")),this.sectionHeader=M(this.element,Zp(".section-footer")),this.sectionDescription=M(this.sectionHeader,Zp("p.section-footer-description")),this.sectionDescription.textContent=d(6388,null),this.sectionLink=M(this.sectionHeader,Zp("a.section-footer-link")),this.sectionLink.textContent=d(6385,null),this.sectionLink.href="https://code.visualstudio.com/docs/copilot/chat/mcp-servers",this._register(j(this.sectionLink,"click",g=>{g.preventDefault();let f=this.sectionLink.href;f&&this.openerService.open(A.parse(f))}));let c=new VAi,u=new sVe("mcpGroupHeader",this.hoverService),p=this.instantiationService.createInstance(vst),h=new BAi(this.mcpWorkbenchService);this.list=this._register(this.instantiationService.createInstance(Vl,"McpManagementList",this.listContainer,c,[u,p,h],{multipleSelectionSupport:!1,setRowLineHeight:!1,horizontalScrolling:!1,accessibilityProvider:{getAriaLabel(g){return g.type==="group-header"?d(6387,null,g.label,g.count,g.collapsed?d(6371,null):d(6377,null)):g.type==="builtin-item"?g.label:g.server.label},getWidgetAriaLabel(){return d(6389,null)}},openOnSingleClick:!0,identityProvider:{getId(g){return g.type==="group-header"||g.type==="builtin-item"?g.id:g.server.id}}})),this._register(this.list.onDidOpen(g=>{g.element&&(g.element.type==="group-header"?this.toggleGroup(g.element):g.element.type==="server-item"&&this._onDidSelectServer.fire(g.element.server))})),this._register(this.list.onContextMenu(g=>this.onContextMenu(g))),this._register(this.mcpWorkbenchService.onChange(()=>{this.browseMode||this.refresh()})),this._register(be(g=>{this.mcpService.servers.read(g),this.browseMode||this.refresh()})),this.refresh()}async refresh(){this.browseMode?await this.queryGallery():this.filterServers()}toggleBrowseMode(e){this.browseMode=e,this.searchInput.value="",this.searchQuery="",this.backLink.style.display=e?"":"none",this.addButton.element.style.display=e?"none":"",this.browseButton.element.parentElement.style.display=e?"none":"",this.searchInput.setPlaceHolder(e?d(6396,null):d(6397,null)),e?this.queryGallery():(this.galleryCts?.dispose(!0),this.galleryServers=[],this.filterServers()),this.lastHeight>0&&this.layout(this.lastHeight,this.lastWidth)}async queryGallery(){this.galleryCts?.dispose(!0);let e=this.galleryCts=new Ye;this.emptyContainer.style.display="flex",this.listContainer.style.display="none",this.emptyText.textContent=d(6386,null),this.emptySubtext.textContent="";try{let t=await this.mcpWorkbenchService.queryGallery({text:this.searchQuery.trim()||void 0},e.token);if(e.token.isCancellationRequested)return;this.galleryServers=t.firstPage.items,this.updateGalleryList()}catch{e.token.isCancellationRequested||(this.galleryServers=[],this.emptyContainer.style.display="flex",this.listContainer.style.display="none",this.emptyText.textContent=d(6381,null),this.emptySubtext.textContent=d(6401,null))}}updateGalleryList(){this.galleryServers.length===0?(this.emptyContainer.style.display="flex",this.listContainer.style.display="none",this.searchQuery.trim()?(this.emptyText.textContent=d(6390,null,this.searchQuery),this.emptySubtext.textContent=d(6402,null)):(this.emptyText.textContent=d(6375,null),this.emptySubtext.textContent="")):(this.emptyContainer.style.display="none",this.listContainer.style.display="");let e=this.galleryServers.map(t=>({type:"server-item",server:t}));this.list.splice(0,this.list.length,e)}filterServers(){let e=this.searchQuery.toLowerCase().trim();e?this.filteredServers=this.mcpWorkbenchService.local.filter(h=>h.label.toLowerCase().includes(e)||h.description?.toLowerCase().includes(e)):this.filteredServers=[...this.mcpWorkbenchService.local];let t=new Set(this.filteredServers.map(h=>h.id)),o=this.mcpService.servers.get().filter(h=>!t.has(h.definition.id)).filter(h=>!e||h.definition.label.toLowerCase().includes(e));this.filteredServers.length===0&&o.length===0?(this.emptyContainer.style.display="flex",this.listContainer.style.display="none",this.searchQuery.trim()?(this.emptyText.textContent=d(6391,null,this.searchQuery),this.emptySubtext.textContent=d(6402,null)):(this.emptyText.textContent=d(6392,null),this.emptySubtext.textContent=d(6361,null))):(this.emptyContainer.style.display="none",this.listContainer.style.display="");let n=[{scope:"workspace",label:d(6407,null),icon:ust,description:d(6408,null),servers:[]},{scope:"user",label:d(6405,null),icon:pst,description:d(6406,null),servers:[]}];for(let h of this.filteredServers)h.local?.scope==="workspace"?n[0].servers.push(h):n[1].servers.push(h);let r=[],s=!0;for(let h of n){if(h.servers.length===0)continue;let g=this.collapsedGroups.has(h.scope);if(r.push({type:"group-header",id:`mcp-group-${h.scope}`,scope:h.scope,label:h.label,icon:h.icon,count:h.servers.length,isFirst:s,description:h.description,collapsed:g}),!g)for(let f of h.servers)r.push({type:"server-item",server:f});s=!1}let l=new Map(this.mcpRegistry.collections.get().map(h=>[h.id,h.source])),c=[],u=[],p=[];for(let h of o){let g=l.get(h.collection.id);h.collection.id.startsWith(WAi)?c.push(h):g instanceof Ii&&!Icn(g)?u.push(h):p.push(h)}if(c.length>0){let h=this.collapsedGroups.has("plugin");if(r.push({type:"group-header",id:"mcp-group-plugin",scope:"plugin",label:d(6393,null),icon:NW,count:c.length,isFirst:s,description:d(6394,null),collapsed:h}),!h)for(let g of c)r.push({type:"builtin-item",id:`builtin-${g.definition.id}`,label:g.definition.label,description:"",collectionId:g.collection.id});s=!1}if(u.length>0){let h=this.collapsedGroups.has("extension");if(r.push({type:"group-header",id:"mcp-group-extension",scope:"extension",label:d(6378,null),icon:mst,count:u.length,isFirst:s,description:d(6379,null),collapsed:h}),!h)for(let g of u)r.push({type:"builtin-item",id:`builtin-${g.definition.id}`,label:g.definition.label,description:"",collectionId:g.collection.id});s=!1}if(p.length>0){let h=this.collapsedGroups.has("builtin");if(r.push({type:"group-header",id:"mcp-group-builtin",scope:"builtin",label:d(6369,null),icon:zqt,count:p.length,isFirst:s,description:d(6370,null),collapsed:h}),!h)for(let g of p)r.push({type:"builtin-item",id:`builtin-${g.definition.id}`,label:g.definition.label,description:"",collectionId:g.collection.id});s=!1}this.displayEntries=r,this.list.splice(0,this.list.length,this.displayEntries),this.filteredBuiltinCount=o.length,this._onDidChangeItemCount.fire(this.itemCount)}get itemCount(){return this.filteredServers.length+this.filteredBuiltinCount}fireItemCount(){this._onDidChangeItemCount.fire(this.itemCount)}toggleGroup(e){this.collapsedGroups.has(e.scope)?this.collapsedGroups.delete(e.scope):this.collapsedGroups.add(e.scope),this.filterServers()}layout(e,t){this.lastHeight=e,this.lastWidth=t,this.element.style.height=`${e}px`;let o=this.searchAndButtonContainer.offsetHeight;if(o===0){Re(this.element).requestAnimationFrame(()=>this.layout(this.lastHeight,this.lastWidth));return}let n=this.sectionHeader.offsetHeight,r=this.browseMode?this.backLink.offsetHeight:0,s=Math.max(0,e-o-n-r);this.listContainer.style.height=`${s}px`,this.list.layout(s,t)}focusSearch(){this.searchInput.focus()}revealLastItem(){this.list.length>0&&this.list.reveal(this.list.length-1)}focus(){this.list.domFocus(),this.list.length>0&&this.list.setFocus([0])}onContextMenu(e){if(!e.element)return;if(e.element.type==="builtin-item"){let l=e.element.collectionId,c=BCo(l);if(!c)return;let u=this.agentPluginService.plugins.get().find(f=>f.uri.toString()===c);if(!u)return;let p=new N,h=p.add(new it("mcpServer.showPlugin",d(6398,null),void 0,!0,async()=>{let f={kind:"installed",name:u.label,description:u.fromMarketplace?.description??"",marketplace:u.fromMarketplace?.marketplace,plugin:u};this._onDidRequestShowPlugin.fire(f)})),g=p.add(new it("mcpServer.uninstallPlugin",d(6403,null),void 0,!0,async()=>{(await this.dialogService.confirm({message:d(6372,null,u.label),detail:d(6373,null),primaryButton:d(6404,null),type:"question"})).confirmed&&u.remove()}));this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>[h,g],onHide:()=>p.dispose()});return}if(e.element.type!=="server-item")return;let t=e.element,o=new N,n=this.mcpWorkbenchService.local.find(l=>l.id===t.server.id)||t.server,r=fst(n,!1,this.instantiationService),s=[];for(let l of r){for(let c of l)s.push(c),jc(c)&&o.add(c);s.push(new ri)}s.length>0&&s[s.length-1]instanceof ri&&s.pop(),this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>s,onHide:()=>o.dispose()})}};aVe=I([m(0,F),m(1,Ng),m(2,_s),m(3,Lc),m(4,ge),m(5,Je),m(6,Wn),m(7,Xe),m(8,nt),m(9,Gg),m(10,at)],aVe);var Hm=_,ycn=36,HAi=class{getHeight(i){return i.type==="group-header"?i.isFirst?jqt:Qqt:i.type==="marketplace-item"?62:ycn}getTemplateId(i){return i.type==="group-header"?"pluginGroupHeader":i.type==="marketplace-item"?"pluginMarketplaceItem":"pluginInstalledItem"}},UAi=class{constructor(){this.templateId="pluginInstalledItem"}renderTemplate(i){i.classList.add("mcp-server-item");let e=M(i,Hm(".mcp-server-icon"));e.classList.add(...q.asClassNameArray(NW));let t=M(i,Hm(".mcp-server-details")),o=M(t,Hm(".mcp-server-name")),n=M(t,Hm(".mcp-server-description")),r=M(i,Hm(".mcp-server-status"));return{container:i,typeIcon:e,name:o,description:n,status:r,disposables:new N}}renderElement(i,e,t){t.disposables.clear(),t.name.textContent=_fe(i.item.name),i.item.description?(t.description.textContent=Tfe(i.item.description),t.description.style.display=""):t.description.style.display="none",t.disposables.add(be(o=>{let n=Ub(i.item.plugin.enablement.read(o));t.container.classList.toggle("disabled",!n),t.status.className="mcp-server-status",n?(t.status.textContent=d(6421,null),t.status.classList.add("running")):(t.status.textContent=d(6417,null),t.status.classList.add("disabled"))}))}disposeTemplate(i){i.disposables.dispose()}},zAi=class{constructor(i){this.pluginInstallService=i;this.templateId="pluginMarketplaceItem"}renderTemplate(i){i.classList.add("mcp-server-item","mcp-gallery-item","extension-list-item");let e=M(i,Hm(".details")),t=M(e,Hm(".header-container")),o=M(t,Hm(".header")),n=M(o,Hm("span.name")),r=M(e,Hm(".description.ellipsis")),s=M(e,Hm(".footer")),l=M(s,Hm(".publisher-container")),c=M(l,Hm("span.publisher-name")),u=M(s,Hm(".mcp-gallery-action")),p=new Wi(u,{...Qo,supportIcons:!0});p.element.classList.add("mcp-gallery-install-button");let h=new N;return h.add(p),{container:i,name:n,publisher:c,description:r,installButton:p,elementDisposables:new N,templateDisposables:h}}renderElement(i,e,t){t.elementDisposables.clear(),t.name.textContent=i.item.name,t.publisher.textContent=i.item.marketplace?d(6413,null,i.item.marketplace):"",t.description.textContent=i.item.description||"",t.installButton.label=d(6425,null),t.installButton.enabled=!0,t.elementDisposables.add(t.installButton.onDidClick(async()=>{t.installButton.label=d(6429,null),t.installButton.enabled=!1;try{await this.pluginInstallService.installPlugin({name:i.item.name,description:i.item.description,version:"",sourceDescriptor:i.item.sourceDescriptor,source:i.item.source,marketplace:i.item.marketplace,marketplaceReference:i.item.marketplaceReference,marketplaceType:i.item.marketplaceType,readmeUri:i.item.readmeUri}),t.installButton.label=d(6426,null)}catch{t.installButton.label=d(6425,null),t.installButton.enabled=!0}}))}disposeTemplate(i){i.elementDisposables.dispose(),i.templateDisposables.dispose()}};function wcn(a,i){let e=a.label??He(a.uri),t=a.fromMarketplace?.description??i.getUriLabel(ci(a.uri),{relative:!0}),o=a.fromMarketplace?.marketplace;return{kind:"installed",name:e,description:t,marketplace:o,plugin:a}}function Ccn(a){return{kind:"marketplace",name:a.name,description:a.description,source:a.source,sourceDescriptor:a.sourceDescriptor,marketplace:a.marketplace,marketplaceReference:a.marketplaceReference,marketplaceType:a.marketplaceType,readmeUri:a.readmeUri}}var lVe=class extends x{constructor(e,t,o,n,r,s,l,c,u,p){super();this.instantiationService=e;this.agentPluginService=t;this.pluginMarketplaceService=o;this.pluginInstallService=n;this.openerService=r;this.contextViewService=s;this.contextMenuService=l;this.hoverService=c;this.labelService=u;this.commandService=p;this._onDidSelectPlugin=this._register(new E);this.onDidSelectPlugin=this._onDidSelectPlugin.event;this._onDidChangeItemCount=this._register(new E);this.onDidChangeItemCount=this._onDidChangeItemCount.event;this.installedItems=[];this.displayEntries=[];this.marketplaceItems=[];this.searchQuery="";this.browseMode=!1;this.lastHeight=0;this.lastWidth=0;this.collapsedGroups=new Set;this.delayedFilter=new Xo(200);this.delayedMarketplaceSearch=new Xo(400);this.element=Hm(".mcp-list-widget"),this.create(),this._register({dispose:()=>{this.marketplaceCts?.dispose()}})}create(){this.searchAndButtonContainer=M(this.element,Hm(".list-search-and-button-container"));let e=M(this.searchAndButtonContainer,Hm(".list-search-container"));this.searchInput=this._register(new Vc(e,this.contextViewService,{placeholder:d(6440,null),inputBoxStyles:Cl})),this._register(this.searchInput.onDidChange(()=>{this.searchQuery=this.searchInput.value,this.browseMode?this.delayedMarketplaceSearch.trigger(()=>this.queryMarketplace()):this.delayedFilter.trigger(()=>this.filterPlugins())}));let t=M(this.searchAndButtonContainer,Hm(".list-button-group")),o=M(t,Hm(".list-add-button-container"));this.browseButton=this._register(new Wi(o,{...Qo,secondary:!0,supportIcons:!0})),this.browseButton.label=`$(${R.library.id}) ${d(6411,null)}`,this.browseButton.element.classList.add("list-add-button"),this._register(this.browseButton.onDidClick(()=>{this.toggleBrowseMode(!this.browseMode)}));let n=this._register(new Wi(t,{...Qo,secondary:!0,supportIcons:!0}));n.label=`$(${R.add.id})`,n.setTitle(d(6427,null)),n.element.classList.add("list-icon-button"),this._register(this.hoverService.setupManagedHover(Ri("element"),n.element,d(6428,null))),this._register(n.onDidClick(()=>{this.commandService.executeCommand("workbench.action.chat.installPluginFromSource")}));let r=this._register(new Wi(t,{...Qo,secondary:!0,supportIcons:!0}));r.label=`$(${R.save.id})`,r.setTitle(d(6415,null)),r.element.classList.add("list-icon-button"),this._register(this.hoverService.setupManagedHover(Ri("element"),r.element,d(6416,null))),this._register(r.onDidClick(()=>{this.commandService.executeCommand("workbench.action.chat.createPlugin")})),this.backLink=M(this.element,Hm(".mcp-back-link")),this.backLink.setAttribute("role","button"),this.backLink.tabIndex=0,this.backLink.setAttribute("aria-label",d(6410,null)),M(this.backLink,Hm("span")).classList.add(...q.asClassNameArray(R.arrowLeft));let l=M(this.backLink,Hm("span"));l.textContent=d(6409,null),this._register(j(this.backLink,"click",()=>{this.toggleBrowseMode(!1)})),this._register(j(this.backLink,"keydown",v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),this.toggleBrowseMode(!1))})),this.backLink.style.display="none",this.emptyContainer=M(this.element,Hm(".mcp-empty-state"));let c=M(this.emptyContainer,Hm(".empty-state-header"));M(c,Hm(".empty-icon")).classList.add(...q.asClassNameArray(NW)),this.emptyText=M(c,Hm(".empty-text")),this.emptySubtext=M(this.emptyContainer,Hm(".empty-subtext")),this.listContainer=M(this.element,Hm(".mcp-list-container")),this.sectionHeader=M(this.element,Hm(".section-footer")),this.sectionDescription=M(this.sectionHeader,Hm("p.section-footer-description")),this.sectionDescription.textContent=d(6437,null),this.sectionLink=M(this.sectionHeader,Hm("a.section-footer-link")),this.sectionLink.textContent=d(6430,null),this.sectionLink.href="https://code.visualstudio.com/docs/copilot/customization/agent-plugins",this._register(j(this.sectionLink,"click",v=>{v.preventDefault();let b=this.sectionLink.href;b&&this.openerService.open(A.parse(b))}));let p=new HAi,h=new sVe("pluginGroupHeader",this.hoverService),g=new UAi,f=new zAi(this.pluginInstallService);this.list=this._register(this.instantiationService.createInstance(Vl,"PluginManagementList",this.listContainer,p,[h,g,f],{multipleSelectionSupport:!1,setRowLineHeight:!1,horizontalScrolling:!1,accessibilityProvider:{getAriaLabel(v){return v.type==="group-header"?d(6436,null,v.label,v.count,v.collapsed?d(6414,null):d(6424,null)):(v.type==="marketplace-item",v.item.name)},getWidgetAriaLabel(){return d(6438,null)}},openOnSingleClick:!0,identityProvider:{getId(v){return v.type==="group-header"?v.id:v.type==="marketplace-item"?`marketplace-${v.item.marketplaceReference.canonicalId}/${v.item.source}`:v.item.plugin.uri.toString()}}})),this._register(this.list.onDidOpen(v=>{v.element&&(v.element.type==="group-header"?this.toggleGroup(v.element):v.element.type==="plugin-item"?this._onDidSelectPlugin.fire(v.element.item):v.element.type==="marketplace-item"&&this._onDidSelectPlugin.fire(v.element.item))})),this._register(this.list.onContextMenu(v=>this.onContextMenu(v))),this._register(be(v=>{let b=this.agentPluginService.plugins.read(v);for(let S of b)S.enablement.read(v);this.browseMode||this.refresh()})),this._register(this.pluginMarketplaceService.onDidChangeMarketplaces(()=>{this.browseMode||this.refresh()})),this.refresh()}async refresh(){this.browseMode?await this.queryMarketplace():this.filterPlugins()}toggleBrowseMode(e){this.browseMode=e,this.searchInput.value="",this.searchQuery="",this.backLink.style.display=e?"":"none",this.browseButton.element.parentElement.style.display=e?"none":"",this.searchInput.setPlaceHolder(e?d(6439,null):d(6440,null)),e?this.queryMarketplace():(this.marketplaceCts?.dispose(!0),this.marketplaceItems=[],this.filterPlugins()),this.lastHeight>0&&this.layout(this.lastHeight,this.lastWidth)}async queryMarketplace(){this.marketplaceCts?.dispose(!0);let e=this.marketplaceCts=new Ye;this.emptyContainer.style.display="flex",this.listContainer.style.display="none",this.emptyText.textContent=d(6431,null),this.emptySubtext.textContent="";try{let t=await this.pluginMarketplaceService.fetchMarketplacePlugins(e.token);if(e.token.isCancellationRequested)return;let o=this.searchQuery.toLowerCase().trim(),n=o?t.filter(s=>s.name.toLowerCase().includes(o)||s.description.toLowerCase().includes(o)):t,r=new Set(this.agentPluginService.plugins.get().map(s=>s.uri.toString()));this.marketplaceItems=n.filter(s=>{let l=this.pluginInstallService.getPluginInstallUri(s);return!r.has(l.toString())}).map(Ccn),this.updateMarketplaceList()}catch{e.token.isCancellationRequested||(this.marketplaceItems=[],this.emptyContainer.style.display="flex",this.listContainer.style.display="none",this.emptyText.textContent=d(6432,null),this.emptySubtext.textContent=d(6441,null))}}updateMarketplaceList(){this.marketplaceItems.length===0?(this.emptyContainer.style.display="flex",this.listContainer.style.display="none",this.searchQuery.trim()?(this.emptyText.textContent=d(6433,null,this.searchQuery),this.emptySubtext.textContent=d(6442,null)):(this.emptyText.textContent=d(6420,null),this.emptySubtext.textContent="")):(this.emptyContainer.style.display="none",this.listContainer.style.display="");let e=this.marketplaceItems.map(t=>({type:"marketplace-item",item:t}));this.list.splice(0,this.list.length,e)}filterPlugins(){let e=this.searchQuery.toLowerCase().trim(),t=this.agentPluginService.plugins.get();this.installedItems=t.map(l=>wcn(l,this.labelService)).filter(l=>!e||l.name.toLowerCase().includes(e)||l.description.toLowerCase().includes(e)),this.installedItems.length===0?(this.emptyContainer.style.display="flex",this.listContainer.style.display="none",this.searchQuery.trim()?(this.emptyText.textContent=d(6434,null,this.searchQuery),this.emptySubtext.textContent=d(6442,null)):(this.emptyText.textContent=d(6435,null),this.emptySubtext.textContent=d(6412,null))):(this.emptyContainer.style.display="none",this.listContainer.style.display="");let o=this.installedItems.filter(l=>Ub(l.plugin.enablement.get())),n=this.installedItems.filter(l=>!Ub(l.plugin.enablement.get())),r=[],s=!0;if(o.length>0){let l=this.collapsedGroups.has("enabled");if(r.push({type:"group-header",id:"plugin-group-enabled",group:"enabled",label:d(6422,null),icon:NW,count:o.length,isFirst:s,description:d(6423,null),collapsed:l}),!l)for(let c of o)r.push({type:"plugin-item",item:c});s=!1}if(n.length>0){let l=this.collapsedGroups.has("disabled");if(r.push({type:"group-header",id:"plugin-group-disabled",group:"disabled",label:d(6418,null),icon:NW,count:n.length,isFirst:s,description:d(6419,null),collapsed:l}),!l)for(let c of n)r.push({type:"plugin-item",item:c})}this.displayEntries=r,this.list.splice(0,this.list.length,this.displayEntries),this._onDidChangeItemCount.fire(this.itemCount)}get itemCount(){return this.installedItems.length}fireItemCount(){this._onDidChangeItemCount.fire(this.itemCount)}toggleGroup(e){this.collapsedGroups.has(e.group)?this.collapsedGroups.delete(e.group):this.collapsedGroups.add(e.group),this.filterPlugins()}layout(e,t){this.lastHeight=e,this.lastWidth=t,this.element.style.height=`${e}px`;let o=this.searchAndButtonContainer.offsetHeight;if(o===0){Re(this.element).requestAnimationFrame(()=>this.layout(this.lastHeight,this.lastWidth));return}let n=this.sectionHeader.offsetHeight,r=this.browseMode?this.backLink.offsetHeight:0,s=Math.max(0,e-o-n-r);this.listContainer.style.height=`${s}px`,this.list.layout(s,t)}focusSearch(){this.searchInput.focus()}revealLastItem(){this.list.length>0&&this.list.reveal(this.list.length-1)}focus(){this.list.domFocus(),this.list.length>0&&this.list.setFocus([0])}onContextMenu(e){if(!e.element||e.element.type!=="plugin-item")return;let t=e.element,o=new N,n=Hrt(t.item.plugin,this.instantiationService),r=[];for(let s of n){for(let l of s)r.push(l),jc(l)&&o.add(l);r.push(new ri)}r.length>0&&r[r.length-1]instanceof ri&&r.pop(),this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>r,onHide:()=>o.dispose()})}};lVe=I([m(0,F),m(1,Gg),m(2,Zk),m(3,Oy),m(4,Je),m(5,Wn),m(6,Xe),m(7,nt),m(8,rt),m(9,ge)],lVe);var Yqt=class{constructor(i,e,t,o,n,r,s){this.commandService=i;this.chatService=e;this.chatWidgetService=t;this.workspaceService=o;this.promptsService=n;this.quickInputService=r;this.harnessService=s}async createWithAI(i){let e=Ecn(i),t=await this.quickInputService.input({prompt:d(6357,null,e),placeHolder:d(6358,null,e),validateInput:async u=>{if(!u||!u.trim())return d(6359,null)}});if(!t)return;let o=t.trim(),n=await this.resolveTargetDirectoryWithPicker(i);if(n===null)return;let r=xcn(i,n,o),s=kcn(i,n,o);await this.commandService.executeCommand("workbench.action.chat.newChat");let c=this.chatWidgetService.lastFocusedWidget?.viewModel?.sessionResource;c&&await this.chatService.sendRequest(c,s,{modeInfo:{kind:"agent",isBuiltin:!1,modeId:"custom",applyCodeBlockSuggestionId:void 0,modeInstructions:{name:"customization-creator",content:r,toolReferences:[]}}})}resolveTargetDirectory(i){return KAi(this.workspaceService,i)}async resolveTargetDirectoryWithPicker(i){let e=await this.promptsService.getSourceFolders(i),t=this.workspaceService.getActiveProjectRoot(),n=this.harnessService.getActiveDescriptor().workspaceSubpaths,r=new Set,s=t?e.filter(u=>{if(!ws(u.uri,t))return!1;let p=u.uri.toString();return r.has(p)?!1:(r.add(p),n?lTe(u.uri.path,n):!0)}):[];if(s.length===0)return this.resolveTargetDirectory(i);if(s.length===1)return s[0].uri;let l=s.map(u=>({label:this.promptsService.getPromptLocationLabel(u),description:u.uri.fsPath,uri:u.uri}));return(await this.quickInputService.pick(l,{placeHolder:d(6360,null)}))?.uri??null}async resolveUserDirectory(i){return GAi(this.promptsService,i)}};Yqt=I([m(0,ge),m(1,mi),m(2,Pt),m(3,zF),m(4,Or),m(5,Ue),m(6,UR)],Yqt);function KAi(a,i){let e=a.getActiveProjectRoot();if(!e)return;let o=aTe(i).find(n=>n.storage==="local");return o?A.joinPath(e,o.path):e}async function GAi(a,i){return(await a.getSourceFolders(i)).find(o=>o.storage==="user")?.uri}function xcn(a,i,e){let o=`

CRITICAL WORKFLOW:
- In your VERY FIRST response, you MUST immediately create the file on disk from a starter template with placeholder content. Do not ask questions first -- write the file first so it appears in the diff view, then ask the user how they want to customize it.
- Every subsequent message from the user should result in you updating that same file on disk with the requested changes.
- Always write the complete file content, not partial diffs.${i?`
IMPORTANT: Save the file to this directory: ${i.fsPath}. The name is "${e}".`:`
The name is "${e}".`}`;switch(a){case"agent":return`You are a helpful assistant that guides users through creating a new custom AI agent.${o}

Create a file named "${e}.agent.md" with YAML frontmatter (name, description, tools) and system instructions. Ask the user what it should do.`;case"skill":return`You are a helpful assistant that guides users through creating a new skill.${o}

Create a directory named "${e}" with a SKILL.md file inside it. The file should have YAML frontmatter (name, description) and instructions. Ask the user what it does.`;case"instructions":return`You are a helpful assistant that guides users through creating a new instructions file.${o}

Create a file named "${e}.instructions.md" with YAML frontmatter (description, optional applyTo) and actionable content. Ask the user what it should cover.`;case"prompt":return`You are a helpful assistant that guides users through creating a new reusable prompt.${o}

Create a file named "${e}.prompt.md" with YAML frontmatter (name, description) and prompt content. Ask the user what it should do.`;case"hook":return`You are a helpful assistant that guides users through creating a new hook.${o}

Ask the user when the hook should trigger and what it should do, then write the configuration file.`;default:return`You are a helpful assistant that guides users through creating a new AI customization file.${o}

Ask the user what they want to create, then guide them step by step.`}}function kcn(a,i,e){let t=i?` Write it to \`${i.fsPath}\`.`:"";switch(a){case"agent":return`Help me create a new custom agent called "${e}".${t}`;case"skill":return`Help me create a new skill called "${e}".${t}`;case"instructions":return`Help me create new instructions called "${e}".${t}`;case"prompt":return`Help me create a new prompt called "${e}".${t}`;case"hook":return`Help me create a new hook called "${e}".${t}`;default:return`Help me create a new customization called "${e}".${t}`}}function Ecn(a){switch(a){case"agent":return"agent";case"skill":return"skill";case"instructions":return"instructions";case"prompt":return"prompt";case"hook":return"hook";default:return"customization"}}var Tcn=Ae("mcp-server-editor-icon",R.mcp,d(11989,null)),Voe=class a extends ls{constructor(e){super();this._mcpServer=e}static{this.ID="workbench.mcpServer.input2"}get typeId(){return a.ID}get capabilities(){return 10}get resource(){return A.from({scheme:Q.extension,path:Yc(this.mcpServer.id,"mcpServer")})}get mcpServer(){return this._mcpServer}getName(){return d(11988,null,this._mcpServer.label)}getIcon(){return Tcn}matches(e){return super.matches(e)?!0:e instanceof a&&this._mcpServer.id===e._mcpServer.id}};var cVe=Ae("mcp-server",R.mcp,d(11991,null)),qAi=Ae("mcp-server-remote",R.remote,d(11992,null)),$Ai=Ae("mcp-server-workspace",R.rootFolder,d(11993,null)),Xqt=Ae("mcp-server-starred",R.starFull,d(11994,null)),HCo=Ae("mcp-server-license",R.law,d(11990,null));var vU=class extends x{constructor(){super(...arguments);this._mcpServer=null}get mcpServer(){return this._mcpServer}set mcpServer(e){this._mcpServer=e,this.update()}update(){this.render()}};function bst(a,i){let e=new N;return e.add(j(a,re.CLICK,AIe(i))),e.add(j(a,re.KEY_UP,t=>{let o=new gi(t);(o.equals(10)||o.equals(3))&&(t.preventDefault(),t.stopPropagation(),i())})),e}var Boe=class extends vU{constructor(e,t){super();this.themeService=t;this.iconLoadingDisposable=this._register(new me);this.element=M(e,_(".extension-icon")),this.iconElement=M(this.element,_("img.icon",{alt:""})),this.iconElement.style.display="none",this.codiconIconElement=M(this.element,_(q.asCSSSelector(cVe))),this.codiconIconElement.style.display="none",this.render(),this._register(Z(()=>this.clear())),this._register(this.themeService.onDidColorThemeChange(()=>this.render()))}clear(){this.iconUrl=void 0,this.iconElement.src="",this.iconElement.style.display="none",this.codiconIconElement.style.display="none",this.codiconIconElement.className=q.asClassName(cVe),this.iconLoadingDisposable.clear()}render(){if(!this.mcpServer){this.clear();return}if(this.mcpServer.icon){let e=this.themeService.getColorTheme().type,t=Bp(e)?this.mcpServer.icon.dark:this.mcpServer.icon.light;this.iconUrl!==t&&(this.iconElement.style.display="inherit",this.codiconIconElement.style.display="none",this.iconUrl=t,this.iconLoadingDisposable.value=j(this.iconElement,"error",()=>{this.iconElement.style.display="none",this.codiconIconElement.style.display="inherit"},{once:!0}),this.iconElement.src=this.iconUrl,this.iconElement.complete?this.iconElement.style.visibility="inherit":(this.iconElement.style.visibility="hidden",this.iconElement.onload=()=>this.iconElement.style.visibility="inherit"))}else this.iconUrl=void 0,this.iconElement.style.display="none",this.iconElement.src="",this.codiconIconElement.className=this.mcpServer.codicon?`codicon ${this.mcpServer.codicon}`:q.asClassName(cVe),this.codiconIconElement.style.display="inherit",this.iconLoadingDisposable.clear()}};Boe=I([m(1,Le)],Boe);var Hoe=class extends vU{constructor(e,t,o,n){super();this.container=e;this.small=t;this.hoverService=o;this.openerService=n;this.disposables=this._register(new N);this.render(),this._register(Z(()=>this.clear()))}clear(){this.element?.remove(),this.disposables.clear()}render(){if(this.clear(),!this.mcpServer?.publisherDisplayName)return;this.element=M(this.container,_(".publisher"));let e=_(".publisher-name.ellipsis");e.textContent=this.mcpServer.publisherDisplayName;let t=_(".verified-publisher");if(M(t,_("span.extension-verified-publisher.clickable"),Sn(gW)),this.small)this.mcpServer.gallery?.publisherDomain?.verified&&M(this.element,t),M(this.element,e);else{if(this.element.classList.toggle("clickable",!!this.mcpServer.gallery?.publisherUrl),this.element.setAttribute("role","button"),this.element.tabIndex=0,this.containerHover=this.disposables.add(this.hoverService.setupManagedHover(Ri("mouse"),this.element,d(12008,null,this.mcpServer.publisherDisplayName))),M(this.element,e),this.mcpServer.gallery?.publisherDomain?.verified){M(this.element,t);let o=A.parse(this.mcpServer.gallery?.publisherDomain.link);t.tabIndex=0,t.setAttribute("role","button"),this.containerHover.update(d(12010,null,this.mcpServer.gallery?.publisherDomain.link)),t.setAttribute("role","link"),M(t,_("span.extension-verified-publisher-domain",void 0,o.authority.startsWith("www.")?o.authority.substring(4):o.authority)),this.disposables.add(bst(t,()=>this.openerService.open(o)))}this.mcpServer.gallery?.publisherUrl&&this.disposables.add(bst(this.element,()=>this.openerService.open(this.mcpServer?.gallery?.publisherUrl)))}}};Hoe=I([m(2,nt),m(3,Je)],Hoe);var Lfe=class a extends vU{constructor(e,t){super();this.container=e;this.small=t;this.disposables=this._register(new N);this.container.classList.add("extension-ratings"),this.small&&e.classList.add("small"),this.render(),this._register(Z(()=>this.clear()))}clear(){this.container.innerText="",this.disposables.clear()}render(){if(this.clear(),!this.mcpServer?.starsCount||this.small&&this.mcpServer.installState!==3)return;let e=this.small?this.container:M(this.container,_("span.rating",{tabIndex:0}));M(e,_("span"+q.asCSSSelector(Xqt)));let t=M(e,_("span.count",void 0,a.getCountLabel(this.mcpServer.starsCount)));this.small||(t.style.paddingLeft="3px")}static getCountLabel(e){return e>1e6?`${Math.floor(e/1e5)/10}M`:e>1e3?`${Math.floor(e/1e3)}K`:String(e)}},Jqt=class extends vU{constructor(e){super();this.container=e;this.disposables=this._register(new N);this.container.classList.add("license"),this.render(),this._register(Z(()=>this.clear()))}clear(){this.container.innerText="",this.disposables.clear()}render(){if(this.clear(),!this.mcpServer?.license)return;let e=M(this.container,_("span.license",{tabIndex:0}));M(e,_("span"+q.asCSSSelector(HCo)));let t=M(e,_("span",void 0,this.mcpServer.license));t.style.paddingLeft="3px"}},dVe=class extends vU{constructor(e,t,o,n){super();this.options=e;this.mcpServerStatusAction=t;this.hoverService=o;this.configurationService=n;this.hover=this._register(new me)}render(){this.hover.value=void 0,this.mcpServer&&(this.hover.value=this.hoverService.setupManagedHover({delay:this.configurationService.getValue("workbench.hover.delay"),showHover:(e,t)=>this.hoverService.showInstantHover({...e,additionalClasses:["extension-hover"],position:{hoverPosition:this.options.position(),forcePosition:!0},persistence:{hideOnKeyDown:!0}},t),placement:"element"},this.options.target,{markdown:()=>Promise.resolve(this.getHoverMarkdown()),markdownNotSupportedFallback:void 0},{appearance:{showHoverHint:!0}}))}getHoverMarkdown(){if(!this.mcpServer)return;let e=new Ie("",{isTrusted:!0,supportThemeIcons:!0});e.appendMarkdown(`**${this.mcpServer.label}**`),e.appendText(`
`);let t=!1;if(this.mcpServer.local?.scope==="workspace"&&(e.appendMarkdown(`$(${$Ai.id})&nbsp;`),e.appendMarkdown(d(12011,null)),t=!0),this.mcpServer.local?.scope==="remoteUser"&&(e.appendMarkdown(`$(${qAi.id})&nbsp;`),e.appendMarkdown(d(12009,null)),t=!0),this.mcpServer.installState===1&&this.mcpServer.starsCount){t&&e.appendText("  |  ");let n=Lfe.getCountLabel(this.mcpServer.starsCount);e.appendMarkdown(`$(${Xqt.id}) ${n}`),t=!0}t&&e.appendText(`
`),this.mcpServer.description&&e.appendMarkdown(`${this.mcpServer.description}`);let o=this.mcpServerStatusAction.status;if(o.length){e.appendMarkdown("---"),e.appendText(`
`);for(let n of o)n.icon&&e.appendMarkdown(`$(${n.icon.id})&nbsp;`),e.appendMarkdown(n.message.value),e.appendText(`
`)}return e}};dVe=I([m(2,nt),m(3,B)],dVe);var Uoe=class extends vU{constructor(e,t){super();this.container=e;this.instantiationService=t;this.badge=this._register(new me);this.element=M(this.container,_("")),this.render(),this._register(Z(()=>this.clear()))}clear(){this.badge.value?.element.remove(),this.badge.clear()}render(){this.clear();let e=this.mcpServer?.local?.scope;if(!e||e==="user")return;let t;switch(e){case"workspace":{t=$Ai;break}case"remoteUser":{t=qAi;break}}this.badge.value=this.instantiationService.createInstance(lge,t,void 0),M(this.element,this.badge.value.element)}};Uoe=I([m(1,F)],Uoe);var uVe=class extends vU{constructor(e,t,o){super();this.container=e;this.extensionStatusAction=t;this.markdownRendererService=o;this.renderDisposables=this._register(new me);this._onDidRender=this._register(new E);this.onDidRender=this._onDidRender.event;this.render(),this._register(t.onDidChangeStatus(()=>this.render()))}render(){vi(this.container),this.renderDisposables.value=void 0;let e=new N;this.renderDisposables.value=e;let t=this.extensionStatusAction.status;if(t.length){let o=new Ie("",{isTrusted:!0,supportThemeIcons:!0});for(let r=0;r<t.length;r++){let s=t[r];s.icon&&o.appendMarkdown(`$(${s.icon.id})&nbsp;`),o.appendMarkdown(s.message.value),r<t.length-1&&o.appendText(`
`)}let n=e.add(this.markdownRendererService.render(o));M(this.container,n.element)}this._onDidRender.fire()}};uVe=I([m(2,On)],uVe);var _cn=te("mcpIcon.starForeground",{light:"#DF6100",dark:"#FF8E00",hcDark:"#FF8E00",hcLight:nS},d(12007,null),!1);is((a,i)=>{let e=a.getColor(_cn);e&&(i.addRule(`.extension-ratings .codicon-mcp-server-starred { color: ${e}; }`),i.addRule(`.monaco-hover.extension-hover .markdown-hover .hover-contents ${q.asCSSSelector(Xqt)} { color: ${e}; }`))});var jAi=class extends x{constructor(e){super();this._onChange=this._register(new E);this._currentId=null;let t=M(e,_(".navbar"));this.actions=[],this.actionbar=this._register(new Zi(t))}get onChange(){return this._onChange.event}get currentId(){return this._currentId}push(e,t,o,n){let r=new it(e,t,void 0,!0,()=>this.update(e,!0));r.tooltip=o,typeof n=="number"?this.actions.splice(n,0,r):this.actions.push(r),this.actionbar.push(r,{index:n}),this.actions.length===1&&this.update(e)}remove(e){let t=this.actions.findIndex(o=>o.id===e);t!==-1&&(this.actions.splice(t,1),this.actionbar.pull(t),this._currentId===e&&this.switch(this.actions[0]?.id))}clear(){this.actions=Be(this.actions),this.actionbar.clear()}switch(e){let t=this.actions.find(o=>o.id===e);return t?(t.run(),!0):!1}has(e){return this.actions.some(t=>t.id===e)}update(e,t){this._currentId=e,this._onChange.fire({id:e,focus:!!t}),this.actions.forEach(o=>o.checked=o.id===e)}};var bU=class extends Ts{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super(bU.ID,e,t,n,l);this.instantiationService=o;this.notificationService=r;this.openerService=s;this.extensionService=c;this.webviewService=u;this.languageService=p;this.contextKeyService=h;this.mcpWorkbenchService=g;this.hoverService=f;this.contextMenuService=v;this._scopedContextKeyService=this._register(new me);this.initialScrollProgress=new Map;this.currentIdentifier="";this.layoutParticipants=[];this.contentDisposables=this._register(new N);this.transientDisposables=this._register(new N);this.activeElement=null;this.mcpServerReadme=null,this.mcpServerManifest=null}static{this.ID="workbench.editor.mcpServer"}get scopedContextKeyService(){return this._scopedContextKeyService.value}createEditor(e){let t=M(e,_(".extension-editor.mcp-server-editor"));this._scopedContextKeyService.value=this.contextKeyService.createScoped(t),this._scopedContextKeyService.value.createKey("inExtensionEditor",!0),t.tabIndex=0,t.style.outline="none",t.setAttribute("role","document");let o=M(t,_(".header")),n=M(o,_(".icon-container")),r=this.instantiationService.createInstance(Boe,n),s=this.instantiationService.createInstance(Uoe,n),l=M(o,_(".details")),c=M(l,_(".title")),u=M(c,_("span.name.clickable",{role:"heading",tabIndex:0}));this._register(this.hoverService.setupManagedHover(Ri("mouse"),u,d(11968,null)));let p=M(l,_(".subtitle")),h=[],g=M(p,_(".subtitle-entry"));h.push(g);let f=this.instantiationService.createInstance(Hoe,g,!1),v=M(p,_(".subtitle-entry"));h.push(v);let b=this.instantiationService.createInstance(Lfe,v,!1),S=M(p,_(".subtitle-entry"));h.push(S);let y=this.instantiationService.createInstance(Jqt,S),w=[r,f,b,s,y],k=M(l,_(".description")),T=[this.instantiationService.createInstance(YT,!1),this.instantiationService.createInstance(nVe),this.instantiationService.createInstance(Dfe,"extensions.uninstall",OW.CLASS,[[this.instantiationService.createInstance(OW),this.instantiationService.createInstance(bq,!1),this.instantiationService.createInstance(Sq,!1)]]),this.instantiationService.createInstance(iVe),this.instantiationService.createInstance(oVe),this.instantiationService.createInstance(HM,!0)],P=M(l,_(".actions-status-container.mcp-server-actions")),O=this._register(new Zi(P,{actionViewItemProvider:(de,Ce)=>{if(de instanceof HQ)return de.createActionViewItem(Ce);if(de instanceof Dfe)return new qqt(de,{...Ce,icon:!0,label:!0,menuActionsOrProvider:{getActions:()=>de.menuActions},menuActionClassNames:de.menuActionClassNames},this.contextMenuService)},focusOnlyEnabledItems:!0}));O.push(T,{icon:!0,label:!0}),O.setFocusable(!0),this._register(U.any(...T.map(de=>U.filter(de.onDidChange,Ce=>Ce.enabled!==void 0)))(()=>{O.setFocusable(!1),O.setFocusable(!0)}));let V=[],H=this.instantiationService.createInstance(aL),G=this._register(this.instantiationService.createInstance(uVe,M(P,_(".status")),H));this._register(U.any(G.onDidRender)(()=>{this.dimension&&this.layout(this.dimension)})),V.push(H,new class extends vU{render(){P.classList.toggle("list-layout",this.mcpServer?.installState===1)}});let $=this.instantiationService.createInstance(OJ,[...T,...w,...V]);for(let de of[...T,...w,...V,$])this._register(de);let J=U.chain(O.onDidRun,de=>de.map(({error:Ce})=>Ce).filter(Ce=>!!Ce));this._register(J(this.onError,this));let ae=M(t,_(".body")),he=new jAi(ae),oe=M(ae,_(".content"));oe.id=xt(),this.template={content:oe,description:k,header:o,name:u,navbar:he,actionsAndStatusContainer:P,actionBar:O,set mcpServer(de){$.mcpServer=de;let Ce;for(let xe of h)xe.classList.remove("last-non-empty"),xe.children.length>0&&(Ce=xe);Ce&&Ce.classList.add("last-non-empty")}}}async setInput(e,t,o,n){await super.setInput(e,t,o,n),this.template&&await this.render(e.mcpServer,this.template,!!t?.preserveFocus)}async render(e,t,o){this.activeElement=null,this.transientDisposables.clear();let n=this.transientDisposables.add(new Ye).token;this.mcpServerReadme=new dV(()=>e.getReadme(n)),this.mcpServerManifest=new dV(()=>e.getManifest(n)),t.mcpServer=e,t.name.textContent=e.label,t.name.classList.toggle("clickable",!!e.gallery?.webUrl),t.description.textContent=e.description,e.gallery?.webUrl&&this.transientDisposables.add(bst(t.name,()=>this.openerService.open(A.parse(e.gallery?.webUrl)))),this.renderNavbar(e,t,o)}setOptions(e){super.setOptions(e),e?.tab&&this.template?.navbar.switch(e.tab)}renderNavbar(e,t,o){t.content.innerText="",t.navbar.clear(),this.currentIdentifier!==e.id&&(this.initialScrollProgress.clear(),this.currentIdentifier=e.id),(e.readmeUrl||e.gallery?.readme)&&t.navbar.push("readme",d(11958,null),d(11959,null)),(e.gallery||e.local?.manifest)&&t.navbar.push("manifest",d(11965,null),d(11966,null)),e.config&&t.navbar.push("configuration",d(11956,null),d(11957,null)),this.transientDisposables.add(this.mcpWorkbenchService.onChange(n=>{n===e&&(n.config&&!t.navbar.has("configuration")&&t.navbar.push("configuration",d(11956,null),d(11957,null),e.readmeUrl?1:0),!n.config&&t.navbar.has("configuration")&&t.navbar.remove("configuration"))})),this.options?.tab&&t.navbar.switch(this.options.tab),t.navbar.currentId&&this.onNavbarChange(e,{id:t.navbar.currentId,focus:!o},t),t.navbar.onChange(n=>this.onNavbarChange(e,n,t),this,this.transientDisposables)}clearInput(){this.contentDisposables.clear(),this.transientDisposables.clear(),super.clearInput()}focus(){super.focus(),this.activeElement?.focus()}showFind(){this.activeWebview?.showFind()}runFindAction(e){this.activeWebview?.runFindAction(e)}get activeWebview(){if(!(!this.activeElement||!this.activeElement.runFindAction))return this.activeElement}onNavbarChange(e,{id:t,focus:o},n){if(this.contentDisposables.clear(),n.content.innerText="",this.activeElement=null,t){let r=new Ye;this.contentDisposables.add(Z(()=>r.dispose(!0))),this.open(t,e,n,r.token).then(s=>{r.token.isCancellationRequested||(this.activeElement=s,o&&this.focus())})}}open(e,t,o,n){switch(e){case"configuration":return this.openConfiguration(t,o,n);case"readme":return this.openDetails(t,o,n);case"manifest":return t.readmeUrl?this.openManifest(t,o.content,n):this.openManifestWithAdditionalDetails(t,o,n)}return Promise.resolve(null)}async openMarkdown(e,t,o,n,r,s,l){try{let c=await this.renderMarkdown(e,t,n,l);if(l.isCancellationRequested)return Promise.resolve(null);let u=this.contentDisposables.add(this.webviewService.createWebviewOverlay({title:s,options:{enableFindWidget:!0,tryRestoreScrollPosition:!0,disableServiceWorker:!0},contentOptions:{},extension:void 0}));u.initialScrollProgress=this.initialScrollProgress.get(r)||0,u.claim(this,this.window,this.scopedContextKeyService),dO(u.container,n),u.layoutWebviewOverElement(n),u.setHtml(c),u.claim(this,this.window,void 0),this.contentDisposables.add(u.onDidFocus(()=>this._onDidFocus?.fire())),this.contentDisposables.add(u.onDidScroll(()=>this.initialScrollProgress.set(r,u.initialScrollProgress)));let p=ah(this.layoutParticipants,{layout:()=>{u.layoutWebviewOverElement(n)}});this.contentDisposables.add(Z(p));let h=!1;return this.contentDisposables.add(Z(()=>{h=!0})),this.contentDisposables.add(this.themeService.onDidColorThemeChange(async()=>{let g=await this.renderMarkdown(e,t,n);h||u.setHtml(g)})),this.contentDisposables.add(u.onDidClickLink(g=>{g&&(ec(g,Q.http)||ec(g,Q.https)||ec(g,Q.mailto))&&this.openerService.open(g)})),u}catch{let u=M(n,_("p.nocontent"));return u.textContent=o,u}}async renderMarkdown(e,t,o,n){let r=await this.loadContents(()=>t,o);if(n?.isCancellationRequested)return"";let s=await sq(r,this.extensionService,this.languageService,{},n);return n?.isCancellationRequested?"":this.renderBody(s)}renderBody(e){let t=xt(),o=ic.getColorMap(),n=o?A_(o):"";return`<!DOCTYPE html>
		<html>
			<head>
				<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
				<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src https: data:; media-src https:; script-src 'none'; style-src 'nonce-${t}';">
				<style nonce="${t}">
					${dU}

					/* prevent scroll-to-top button from blocking the body text */
					body {
						padding-bottom: 75px;
					}

					#scroll-to-top {
						position: fixed;
						width: 32px;
						height: 32px;
						right: 25px;
						bottom: 25px;
						background-color: var(--vscode-button-secondaryBackground);
						border-color: var(--vscode-button-border);
						border-radius: 50%;
						cursor: pointer;
						box-shadow: 1px 1px 1px rgba(0,0,0,.25);
						outline: none;
						display: flex;
						justify-content: center;
						align-items: center;
					}

					#scroll-to-top:hover {
						background-color: var(--vscode-button-secondaryHoverBackground);
						box-shadow: 2px 2px 2px rgba(0,0,0,.25);
					}

					body.vscode-high-contrast #scroll-to-top {
						border-width: 2px;
						border-style: solid;
						box-shadow: none;
					}

					#scroll-to-top span.icon::before {
						content: "";
						display: block;
						background: var(--vscode-button-secondaryForeground);
						/* Chevron up icon */
						webkit-mask-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjIuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAxNiAxNiIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTYgMTY7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4KCS5zdDB7ZmlsbDojRkZGRkZGO30KCS5zdDF7ZmlsbDpub25lO30KPC9zdHlsZT4KPHRpdGxlPnVwY2hldnJvbjwvdGl0bGU+CjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik04LDUuMWwtNy4zLDcuM0wwLDExLjZsOC04bDgsOGwtMC43LDAuN0w4LDUuMXoiLz4KPHJlY3QgY2xhc3M9InN0MSIgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2Ii8+Cjwvc3ZnPgo=');
						-webkit-mask-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjIuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAxNiAxNiIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTYgMTY7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4KCS5zdDB7ZmlsbDojRkZGRkZGO30KCS5zdDF7ZmlsbDpub25lO30KPC9zdHlsZT4KPHRpdGxlPnVwY2hldnJvbjwvdGl0bGU+CjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik04LDUuMWwtNy4zLDcuM0wwLDExLjZsOC04bDgsOGwtMC43LDAuN0w4LDUuMXoiLz4KPHJlY3QgY2xhc3M9InN0MSIgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2Ii8+Cjwvc3ZnPgo=');
						width: 16px;
						height: 16px;
					}
					${n}
				</style>
			</head>
			<body>
				<a id="scroll-to-top" role="button" aria-label="scroll to top" href="#"><span class="icon"></span></a>
				${e}
			</body>
		</html>`}async openDetails(e,t,o){let n=M(t.content,_(".details")),r=M(n,_(".content-container")),s=M(n,_(".additional-details-container")),l=()=>n.classList.toggle("narrow",this.dimension&&this.dimension.width<500);l(),this.contentDisposables.add(Z(ah(this.layoutParticipants,{layout:l})));let c=await this.openMarkdown(e,this.mcpServerReadme.get(),d(11971,null),r,0,d(11976,null),o);return this.renderAdditionalDetails(s,e),c}async openConfiguration(e,t,o){let n=M(t.content,_(".configuration")),r=_("div",{class:"configuration-content"});this.renderConfigurationDetails(r,e);let s=new ms(r,{}),l=()=>s.scanDomNode();return this.contentDisposables.add(Z(ah(this.layoutParticipants,{layout:l}))),M(n,s.getDomNode()),{focus:()=>r.focus()}}async openManifestWithAdditionalDetails(e,t,o){let n=M(t.content,_(".details")),r=M(n,_(".content-container")),s=M(n,_(".additional-details-container")),l=()=>n.classList.toggle("narrow",this.dimension&&this.dimension.width<500);l(),this.contentDisposables.add(Z(ah(this.layoutParticipants,{layout:l})));let c=await this.openManifest(e,r,o);return this.renderAdditionalDetails(s,e),c}async openManifest(e,t,o){let n=M(t,_(".manifest")),r=_("div",{class:"manifest-content"});try{let c=await this.loadContents(()=>this.mcpServerManifest.get(),r);if(o.isCancellationRequested)return null;this.renderManifestDetails(r,c)}catch{for(;r.firstChild;)r.removeChild(r.firstChild);let u=M(r,_(".no-manifest"));u.textContent=d(11970,null)}let s=new ms(r,{}),l=()=>s.scanDomNode();return this.contentDisposables.add(Z(ah(this.layoutParticipants,{layout:l}))),M(n,s.getDomNode()),{focus:()=>r.focus()}}renderConfigurationDetails(e,t){Rt(e);let o=t.config;if(!o){let p=M(e,_(".no-config"));p.textContent=d(11969,null);return}let n=M(e,_(".config-section")),r=M(n,_(".config-label"));r.textContent=d(11981,null);let s=M(n,_(".config-value"));s.textContent=t.name;let l=M(e,_(".config-section")),c=M(l,_(".config-label"));c.textContent=d(11982,null);let u=M(l,_(".config-value"));if(u.textContent=o.type,o.type==="stdio"){let p=M(e,_(".config-section")),h=M(p,_(".config-label"));h.textContent=d(11955,null);let g=M(p,_("code.config-value"));if(g.textContent=o.command,o.args&&o.args.length>0){let f=M(e,_(".config-section")),v=M(f,_(".config-label"));v.textContent=d(11954,null);let b=M(f,_("code.config-value"));b.textContent=o.args.join(" ")}}else if(o.type==="http"){let p=M(e,_(".config-section")),h=M(p,_(".config-label"));h.textContent=d(11986,null);let g=M(p,_("code.config-value"));g.textContent=o.url}}renderManifestDetails(e,t){if(Rt(e),t.packages&&t.packages.length>0){let o=new Map;for(let n of t.packages){let r=n.registryType,s=o.get(r);s||o.set(r,s=[]),s.push(n)}M(e,_(".manifest-section",void 0,_(".manifest-section-title",void 0,d(11974,null))));for(let[n,r]of o){let s=M(e,_(".package-section",void 0,_(".package-section-title",void 0,n.toUpperCase()))),l=M(s,_(".package-details"));for(let c=0;c<r.length;c++){let u=r[c];if(M(l,_(".package-detail",void 0,_(".detail-label",void 0,d(11973,null)),_(".detail-value",void 0,u.identifier))),u.packageArguments&&u.packageArguments.length>0){let p=[];for(let h of u.packageArguments)if(h.type==="named"&&(p.push(h.name),h.value&&p.push(h.value)),h.type==="positional"){let g=h.value??h.valueHint;g&&p.push(g)}M(l,_(".package-detail",void 0,_(".detail-label",void 0,d(11972,null)),_("code.detail-value",void 0,p.join(" "))))}if(u.runtimeArguments&&u.runtimeArguments.length>0){let p=[];for(let h of u.runtimeArguments)if(h.type==="named"&&(p.push(h.name),h.value&&p.push(h.value)),h.type==="positional"){let g=h.value??h.valueHint;g&&p.push(g)}M(l,_(".package-detail",void 0,_(".detail-label",void 0,d(11980,null)),_("code.detail-value",void 0,p.join(" "))))}if(u.environmentVariables&&u.environmentVariables.length>0){let p=u.environmentVariables.map(h=>`${h.name}=${h.value??""}`);M(l,_(".package-detail",void 0,_(".detail-label",void 0,d(11960,null)),_("code.detail-value",void 0,p.join(" "))))}c<r.length-1&&M(l,_(".package-separator"))}}}if(t.remotes&&t.remotes.length>0){let o=M(e,_(".package-section",void 0,_(".package-section-title",void 0,d(11977,null).toLocaleUpperCase())));for(let n of t.remotes){let r=M(o,_(".package-details"));if(M(r,_(".package-detail",void 0,_(".detail-label",void 0,d(11986,null)),_(".detail-value",void 0,n.url))),n.type&&M(r,_(".package-detail",void 0,_(".detail-label",void 0,d(11985,null)),_(".detail-value",void 0,n.type))),n.headers&&n.headers.length>0){let s=n.headers.map(l=>`${l.name}: ${l.value??""}`);M(r,_(".package-detail",void 0,_(".detail-label",void 0,d(11961,null)),_(".detail-value",void 0,s.join(", "))))}}}}renderAdditionalDetails(e,t){let o=_("div",{class:"additional-details-content",tabindex:"0"}),n=new ms(o,{}),r=()=>n.scanDomNode(),s=ah(this.layoutParticipants,{layout:r});this.contentDisposables.add(Z(s)),this.contentDisposables.add(n),this.contentDisposables.add(this.instantiationService.createInstance(Sst,o,t)),M(e,n.getDomNode()),n.scanDomNode()}loadContents(e,t){t.classList.add("loading");let o=this.contentDisposables.add(e()),n=()=>t.classList.remove("loading");return o.promise.then(n,n),o.promise}layout(e){this.dimension=e,this.layoutParticipants.forEach(t=>t.layout())}onError(e){ao(e)||this.notificationService.error(e)}};bU=I([m(1,Te),m(2,F),m(3,Le),m(4,Ne),m(5,Je),m(6,ce),m(7,lt),m(8,cp),m(9,_t),m(10,X),m(11,Ng),m(12,nt),m(13,Xe)],bU);var Sst=class extends x{constructor(e,t,o,n,r){super();this.container=e;this.mcpGalleryManifestService=o;this.hoverService=n;this.openerService=r;this.disposables=this._register(new N);this.render(t),this._register(this.mcpGalleryManifestService.onDidChangeMcpGalleryManifest(()=>this.render(t)))}render(e){this.container.innerText="",this.disposables.clear(),e.local&&this.renderInstallInfo(this.container,e.local),e.gallery&&this.renderMarketplaceInfo(this.container,e),this.renderTags(this.container,e),this.renderExtensionResources(this.container,e)}renderTags(e,t){if(t.gallery?.topics?.length){let o=M(e,_(".categories-container.additional-details-element"));M(o,_(".additional-details-title",void 0,d(11984,null)));let n=M(o,_(".categories"));for(let r of t.gallery.topics)M(n,_("span.category",{tabindex:"0"},r))}}async renderExtensionResources(e,t){let o=[],n=await this.mcpGalleryManifestService.getMcpGalleryManifest();if(t.repository)try{o.push([d(11978,null),q.fromId(R.repo.id),A.parse(t.repository)])}catch{}if(n){let r=O4(n,"ContactSupportUri");if(r)try{o.push([d(11983,null),q.fromId(R.commentDiscussion.id),A.parse(r)])}catch{}}if(o.length){let r=M(e,_(".resources-container.additional-details-element"));M(r,_(".additional-details-title",void 0,d(11979,null)));let s=M(r,_(".resources"));for(let[l,c,u]of o){let p=M(s,_(".resource"));M(p,_(q.asCSSSelector(c))),M(p,_("a",{tabindex:"0"},l)),this.disposables.add(bst(p,()=>this.openerService.open(u))),this.disposables.add(this.hoverService.setupManagedHover(Ri("mouse"),p,u.toString()))}}}renderInstallInfo(e,t){let o=M(e,_(".more-info-container.additional-details-element"));M(o,_(".additional-details-title",void 0,d(11963,null)));let n=M(o,_(".more-info"));M(n,_(".more-info-entry",void 0,_("div.more-info-entry-name",void 0,d(11962,null)),_("code",void 0,t.name))),t.version&&M(n,_(".more-info-entry",void 0,_("div.more-info-entry-name",void 0,d(11987,null)),_("code",void 0,t.version)))}renderMarketplaceInfo(e,t){let o=t.gallery,n=M(e,_(".more-info-container.additional-details-element"));M(n,_(".additional-details-title",void 0,d(11967,null)));let r=M(n,_(".more-info"));o&&(t.local||(M(r,_(".more-info-entry",void 0,_("div.more-info-entry-name",void 0,d(11962,null)),_("code",void 0,t.name))),o.version&&M(r,_(".more-info-entry",void 0,_("div.more-info-entry-name",void 0,d(11987,null)),_("code",void 0,o.version)))),o.lastUpdated&&M(r,_(".more-info-entry",void 0,_("div.more-info-entry-name",void 0,d(11964,null)),_("div",{title:new Date(o.lastUpdated).toString()},ea(o.lastUpdated,!0,!0,!0)))),o.publishDate&&M(r,_(".more-info-entry",void 0,_("div.more-info-entry-name",void 0,d(11975,null)),_("div",{title:new Date(o.publishDate).toString()},ea(o.publishDate,!0,!0,!0)))))}};Sst=I([m(2,WB),m(3,nt),m(4,Je)],Sst);var pVe=class extends x{constructor(e,t,o,n){super();this._container=e;this._labels=o;this._markdownRendererService=n;this._renderDisposables=this._register(new me);this._register(be(r=>{this._render(t.read(r))}))}_render(e){vi(this._container),this._renderDisposables.value=void 0;let t;if(e===0?t=this._labels.disabledProfile:e===1&&(t=this._labels.disabledWorkspace),!t)return;let o=new Ie("",{isTrusted:!0,supportThemeIcons:!0});o.appendMarkdown(`$(${R.info.id})&nbsp;`),o.appendText(t);let n=this._markdownRendererService.render(o);this._renderDisposables.value=n,this._container.appendChild(n.element)}};pVe=I([m(3,On)],pVe);var UCo={disabledProfile:d(7374,null),disabledWorkspace:d(7375,null)},B6h={disabledProfile:d(7372,null),disabledWorkspace:d(7373,null)};var SU=class extends Ts{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super(SU.ID,e,t,n,s);this.instantiationService=o;this.openerService=r;this.extensionService=l;this.webviewService=c;this.languageService=u;this.fileService=p;this.requestService=h;this.agentPluginService=g;this.pluginInstallService=f;this.pluginMarketplaceService=v;this.labelService=b;this.contextMenuService=S;this.pluginReadme=null;this.initialScrollProgress=new Map;this.currentIdentifier="";this.layoutParticipants=[];this.contentDisposables=this._register(new N);this.transientDisposables=this._register(new N);this.activeElement=null}static{this.ID="workbench.editor.agentPlugin"}createEditor(e){let t=M(e,_(".extension-editor.agent-plugin-editor"));t.tabIndex=0,t.style.outline="none",t.setAttribute("role","document");let o=M(t,_(".header")),n=M(o,_(".icon-container")),r=M(n,_("span.codicon.codicon-extensions"));r.style.fontSize="64px";let s=M(o,_(".details")),l=M(s,_(".title")),c=M(l,_("span.name",{role:"heading",tabIndex:0})),u=M(s,_(".description")),p=M(s,_(".subtitle")),h=M(p,_("span.subtitle-entry")),g=M(s,_(".actions-status-container")),f=this._register(new Zi(g,{actionViewItemProvider:(y,w)=>{if(y instanceof bWe)return new nqt(y,{...w,icon:!0,label:!0,menuActionsOrProvider:{getActions:()=>y.menuActions},menuActionClassNames:y.menuActionClassNames},this.contextMenuService)},focusOnlyEnabledItems:!0}));f.setFocusable(!0);let v=M(g,_(".status")),b=M(t,_(".body")),S=M(b,_(".content"));S.id=xt(),this.template={content:S,description:u,header:o,name:c,marketplace:h,actionBar:f,statusContainer:v}}async setInput(e,t,o,n){await super.setInput(e,t,o,n),this.template&&await this.render(e.item,this.template)}async render(e,t){this.activeElement=null,this.transientDisposables.clear(),this.contentDisposables.clear(),t.content.innerText="";let o=new Ye;this.transientDisposables.add(Z(()=>o.dispose(!0)));let n=o.token,r=e.kind==="installed"?e.plugin.uri.toString():`${e.marketplaceReference.canonicalId}/${e.source}`;this.currentIdentifier!==r&&(this.initialScrollProgress.clear(),this.currentIdentifier=r),this.pluginReadme=new dV(()=>this.fetchReadme(e,n)),t.name.textContent=e.name,t.description.textContent=e.description;let s=e.marketplace??"",l=e.kind==="marketplace"?e.marketplaceReference.githubRepo:e.plugin.fromMarketplace?.marketplaceReference.githubRepo;if(s&&l){let h=`https://github.com/${l}`,g=_("a.marketplace-link",{href:h},s);this.transientDisposables.add(j(g,re.CLICK,f=>{f.preventDefault(),f.stopPropagation(),this.openerService.open(A.parse(h))})),vi(t.marketplace,g)}else vi(t.marketplace,s);let c=ke(h=>{let g=this.agentPluginService.plugins.read(h),f=e;if(e.kind==="marketplace"){let v=this.pluginInstallService.getPluginInstallUri({name:e.name,description:e.description,version:"",source:e.source,sourceDescriptor:e.sourceDescriptor,marketplace:e.marketplace,marketplaceReference:e.marketplaceReference,marketplaceType:e.marketplaceType}),b=g.find(S=>S.uri.toString()===v.toString());b&&(f=this.installedPluginToItem(b))}else{let v=g.find(b=>b.uri.toString()===e.plugin.uri.toString());if(v)v.enablement.read(h),f=this.installedPluginToItem(v);else if(e.plugin.fromMarketplace){let b=e.plugin.fromMarketplace;f={kind:"marketplace",name:e.name,description:b.description,source:b.source,sourceDescriptor:b.sourceDescriptor,marketplace:b.marketplace,marketplaceReference:b.marketplaceReference,marketplaceType:b.marketplaceType,readmeUri:b.readmeUri}}else return}return f}),u=c.map((h,g)=>{if(!(!h||h.kind==="marketplace"))return this.pluginMarketplaceService.installedPlugins.read(g).find(f=>f.pluginUri.toString()===h.plugin.uri.toString())?.plugin??h.plugin.fromMarketplace}),p=this.transientDisposables.add(new N);this.transientDisposables.add(be(h=>{p.clear(),t.actionBar.clear();let g=c.read(h);if(!g)return;this.pluginMarketplaceService.lastFetchedPlugins.read(h);let f=this.getItemActions(g,u.read(h));f.length>0&&t.actionBar.push(f,{icon:!0,label:!0});for(let v of f)p.add(v);g.kind==="installed"&&p.add(this.instantiationService.createInstance(pVe,t.statusContainer,g.plugin.enablement,UCo))})),this.activeElement=await this.openDetails(e,t,n)}getItemActions(e,t){if(e.kind==="marketplace")return[this.instantiationService.createInstance(RQ,e)];let o=this.instantiationService.invokeFunction(r=>r.get(Pe)),n=[];if(t){let r=this.pluginMarketplaceService.lastFetchedPlugins.get(),s=`${t.marketplaceReference.canonicalId}::${t.name}`,l=r.find(c=>`${c.marketplaceReference.canonicalId}::${c.name}`===s);l&&gWe(t.sourceDescriptor,l.sourceDescriptor)&&n.push(this.instantiationService.createInstance(Rfe,e.plugin,l))}return n.push(Wyo(e.plugin,this.agentPluginService.enablementModel,o)),n.push(Vyo(e.plugin,this.agentPluginService.enablementModel,o)),n.push(new Brt(e.plugin)),n}installedPluginToItem(e){let t=e.label,o=e.fromMarketplace?.description??this.labelService.getUriLabel(ci(e.uri),{relative:!0}),n=e.fromMarketplace?.marketplace;return{kind:"installed",name:t,description:o,marketplace:n,plugin:e}}async fetchReadme(e,t){let o;if(e.kind==="installed"?o=Ge(e.plugin.uri,"README.md"):o=e.readmeUri,!o)return"";if(o.scheme===Q.file||o.scheme===Q.vscodeRemote)try{return(await this.fileService.readFile(o)).value.toString()}catch{return""}if(o.scheme===Q.https){let n=o.toString(),r=n.match(/^https:\/\/github\.com\/(?<owner>[^/]+)\/(?<repo>[^/]+)\/blob\/(?<rest>.+)$/);r?.groups&&(n=`https://raw.githubusercontent.com/${r.groups.owner}/${r.groups.repo}/${r.groups.rest}`);try{let s=await this.requestService.request({type:"GET",url:n,callSite:"agentPluginEditor.fetchReadme"},t);return await tD(s)??""}catch{return""}}return""}async openDetails(e,t,o){let n=M(t.content,_(".details")),r=M(n,_(".content-container")),s=()=>n.classList.toggle("narrow",this.dimension!==void 0&&this.dimension.width<500);return s(),this.contentDisposables.add(Z(ah(this.layoutParticipants,{layout:s}))),this.openMarkdown(this.pluginReadme.get(),d(6000,null),r,0,d(6001,null),o)}async openMarkdown(e,t,o,n,r,s){try{let l=await this.renderMarkdown(e,o,s);if(s.isCancellationRequested)return null;let c=this.contentDisposables.add(this.webviewService.createWebviewOverlay({title:r,options:{enableFindWidget:!0,tryRestoreScrollPosition:!0,disableServiceWorker:!0},contentOptions:{},extension:void 0}));c.initialScrollProgress=this.initialScrollProgress.get(n)||0,c.claim(this,this.window,void 0),dO(c.container,o),c.layoutWebviewOverElement(o),c.setHtml(l),c.claim(this,this.window,void 0),this.contentDisposables.add(c.onDidFocus(()=>this._onDidFocus?.fire())),this.contentDisposables.add(c.onDidScroll(()=>this.initialScrollProgress.set(n,c.initialScrollProgress)));let u=ah(this.layoutParticipants,{layout:()=>{c.layoutWebviewOverElement(o)}});this.contentDisposables.add(Z(u));let p=!1;return this.contentDisposables.add(Z(()=>{p=!0})),this.contentDisposables.add(this.themeService.onDidColorThemeChange(async()=>{let h=await this.renderMarkdown(e,o);p||c.setHtml(h)})),this.contentDisposables.add(c.onDidClickLink(h=>{h&&(ec(h,Q.http)||ec(h,Q.https)||ec(h,Q.mailto))&&this.openerService.open(h)})),c}catch{let c=M(o,_("p.nocontent"));return c.textContent=t,c}}async renderMarkdown(e,t,o){let n=await this.loadContents(()=>e,t);if(o?.isCancellationRequested)return"";let r=await sq(n,this.extensionService,this.languageService,{},o);return o?.isCancellationRequested?"":this.renderBody(r)}renderBody(e){let t=xt(),o=ic.getColorMap(),n=o?A_(o):"";return`<!DOCTYPE html>
		<html>
			<head>
				<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
				<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src https: data:; media-src https:; script-src 'none'; style-src 'nonce-${t}';">
				<style nonce="${t}">
					${dU}

					body {
						padding-bottom: 75px;
					}

					#scroll-to-top {
						position: fixed;
						width: 32px;
						height: 32px;
						right: 25px;
						bottom: 25px;
						background-color: var(--vscode-button-secondaryBackground);
						border-color: var(--vscode-button-border);
						border-radius: 50%;
						cursor: pointer;
						box-shadow: 1px 1px 1px rgba(0,0,0,.25);
						outline: none;
						display: flex;
						justify-content: center;
						align-items: center;
					}

					#scroll-to-top:hover {
						background-color: var(--vscode-button-secondaryHoverBackground);
						box-shadow: 2px 2px 2px rgba(0,0,0,.25);
					}

					body.vscode-high-contrast #scroll-to-top {
						border-width: 2px;
						border-style: solid;
						box-shadow: none;
					}

					#scroll-to-top span.icon::before {
						content: "";
						display: block;
						background: var(--vscode-button-secondaryForeground);
						-webkit-mask-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjIuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAxNiAxNiIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTYgMTY7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4KCS5zdDB7ZmlsbDojRkZGRkZGO30KCS5zdDF7ZmlsbDpub25lO30KPC9zdHlsZT4KPHRpdGxlPnVwY2hldnJvbjwvdGl0bGU+CjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik04LDUuMWwtNy4zLDcuM0wwLDExLjZsOC04bDgsOGwtMC43LDAuN0w4LDUuMXoiLz4KPHJlY3QgY2xhc3M9InN0MSIgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2Ii8+Cjwvc3ZnPgo=');
						width: 16px;
						height: 16px;
					}
					${n}
				</style>
			</head>
			<body>
				<a id="scroll-to-top" role="button" aria-label="scroll to top" href="#"><span class="icon"></span></a>
				${e}
			</body>
		</html>`}loadContents(e,t){t.classList.add("loading");let o=this.contentDisposables.add(e()),n=()=>t.classList.remove("loading");return o.promise.then(n,n),o.promise}clearInput(){this.contentDisposables.clear(),this.transientDisposables.clear(),super.clearInput()}focus(){super.focus(),this.activeElement?.focus()}get activeWebview(){if(!(!this.activeElement||!this.activeElement.runFindAction))return this.activeElement}layout(e){this.dimension=e,this.layoutParticipants.forEach(t=>t.layout())}};SU=I([m(1,Te),m(2,F),m(3,Le),m(4,Je),m(5,ce),m(6,lt),m(7,cp),m(8,_t),m(9,fe),m(10,Ea),m(11,Gg),m(12,Oy),m(13,Zk),m(14,rt),m(15,Xe)],SU);var Rfe=class extends it{constructor(e,t,o,n){super(Rfe.ID,d(6002,null),"extension-action label prominent install");this.plugin=e;this.liveMarketplacePlugin=t;this.pluginInstallService=o;this.pluginMarketplaceService=n}static{this.ID="agentPlugin.editor.update"}async run(){await this.pluginInstallService.updatePlugin(this.liveMarketplacePlugin)&&this.pluginMarketplaceService.addInstalledPlugin(this.plugin.uri,this.liveMarketplacePlugin)}};Rfe=I([m(2,Oy),m(3,Zk)],Rfe);var Bl=_,Dcn=te("aiCustomizationManagement.sashBorder",vf,d(6325,null)),QAi=class{getHeight(){return 26}getTemplateId(){return"sectionItem"}},YAi=class{constructor(){this.templateId="sectionItem"}renderTemplate(i){i.classList.add("section-list-item");let e=M(i,Bl(".section-icon")),t=M(i,Bl(".section-label")),o=M(i,Bl(".section-count"));return{container:i,icon:e,label:t,count:o}}renderElement(i,e,t){t.icon.className="section-icon",t.icon.classList.add(...q.asClassNameArray(i.icon)),t.label.textContent=i.label,i.count>0?(t.count.textContent=String(i.count),t.count.style.display=""):(t.count.textContent="",t.count.style.display="none")}disposeTemplate(){}},wq=class extends Ts{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,P){super(wq.ID,e,t,o,n);this.storageService=n;this.instantiationService=r;this.openerService=l;this.commandService=c;this.workspaceService=u;this.promptsService=p;this.textModelService=h;this.configurationService=g;this.workingCopyService=f;this.fileDialogService=v;this.hoverService=b;this.modelService=S;this.quickInputService=y;this.contextMenuService=w;this.fileService=k;this.notificationService=T;this.harnessService=P;this.editorActionButtonInProgress=!1;this.editorModelChangeDisposables=this._register(new N);this.builtinEditingSessions=new Map;this.viewMode="list";this.mcpDetailDisposables=this._register(new N);this.pluginDetailDisposables=this._register(new N);this.sections=[];this.allSections=[];this.selectedSection=Zn.Agents;this.editorDisposables=this._register(new N);this.promptsSectionCountScheduler=this._register(new Dt(()=>this._doRefreshAllPromptsSectionCounts(),100));this._editorContentChanged=!1;this.inEditorContextKey=Xso.bindTo(s),this.sectionContextKey=Jso.bindTo(s),this.harnessContextKey=Zso.bindTo(s),this._register(be(H=>{this.workspaceService.activeProjectRoot.read(H),this.viewMode==="editor"&&(this.currentEditingProjectRoot=this.workspaceService.getActiveProjectRoot())})),this._register(Z(()=>{this.currentModelRef?.dispose(),this.currentModelRef=void 0})),this._register(Z(()=>this.disposeBuiltinEditingSessions()));let O={[Zn.Agents]:{label:d(6324,null),icon:ZWe},[Zn.Skills]:{label:d(6353,null),icon:cst},[Zn.Instructions]:{label:d(6334,null),icon:BQ},[Zn.Prompts]:{label:d(6341,null),icon:eVe},[Zn.Hooks]:{label:d(6333,null),icon:dst},[Zn.McpServers]:{label:d(6336,null),icon:R.server},[Zn.Plugins]:{label:d(6340,null),icon:NW},[Zn.Models]:{label:d(6337,null),icon:R.vm}};for(let H of this.workspaceService.managementSections){let G=O[H];G&&this.allSections.push({id:H,...G,count:0})}this.rebuildVisibleSections();let V=this.storageService.get(XNt,0);V&&this.sections.some(H=>H.id===V)?this.selectedSection=V:this.sections.length>0&&(this.selectedSection=this.sections[0].id)}static{this.ID=jNt}createEditor(e){this.editorDisposables.clear(),this.container=M(e,Bl(".ai-customization-management-editor")),this.createSplitView(),this.updateStyles()}createSplitView(){this.splitViewContainer=M(this.container,Bl(".management-split-view")),this.sidebarContainer=Bl(".management-sidebar"),this.contentContainer=Bl(".management-content"),this.createSidebar(),this.createContent(),this.splitView=this.editorDisposables.add(new Ou(this.splitViewContainer,{orientation:1,proportionalLayout:!0}));let e=this.storageService.getNumber(VSi,0,JNt);this.splitView.addView({onDidChange:U.None,element:this.sidebarContainer,minimumSize:tao,maximumSize:iao,layout:(t,o,n)=>{if(this.sidebarContainer.style.width=`${t}px`,n!==void 0){let r=this.folderPickerContainer?.offsetHeight??0,s=n-8-r;this.sectionsList.layout(s,t)}}},e,void 0,!0),this.splitView.addView({onDidChange:U.None,element:this.contentContainer,minimumSize:oao,maximumSize:Number.POSITIVE_INFINITY,layout:(t,o,n)=>{if(this.contentContainer.style.width=`${t}px`,n!==void 0){this.listWidget.layout(n-16,t-24),this.mcpListWidget?.layout(n-16,t-24),this.pluginListWidget?.layout(n-16,t-24);let r=this.modelsFooterElement?.offsetHeight||80;this.modelsWidget?.layout(n-16-r,t),this.viewMode==="editor"&&this.embeddedEditor&&this.embeddedEditor.layout({width:Math.max(0,t-24),height:Math.max(0,n-50-24)}),this.viewMode==="mcpDetail"&&this.embeddedMcpEditor&&this.embeddedMcpEditor.layout(new si(t,Math.max(0,n-40))),this.viewMode==="pluginDetail"&&this.embeddedPluginEditor&&this.embeddedPluginEditor.layout(new si(t,Math.max(0,n-40)))}}},Gl.Distribute,void 0,!0),this.editorDisposables.add(this.splitView.onDidSashChange(()=>{let t=this.splitView.getViewSize(0);this.storageService.store(VSi,t,0,0)})),this.editorDisposables.add(this.splitView.onDidSashReset(()=>{let t=this.splitView.getViewSize(0)+this.splitView.getViewSize(1);this.splitView.resizeView(0,JNt),this.splitView.resizeView(1,t-JNt)}))}get isHarnessSelectorEnabled(){return this.configurationService.getValue("chat.customizations.harnessSelector.enabled")!==!1}rebuildVisibleSections(){let e;if(this.isHarnessSelectorEnabled){let t=this.harnessService.activeHarness.get(),o=this.harnessService.availableHarnesses.get().find(n=>n.id===t);e=new Set(o?.hiddenSections??[])}else e=new Set;this.sections.length=0;for(let t of this.allSections)e.has(t.id)||this.sections.push(t);this.sectionsList&&this.sectionsList.splice(0,this.sectionsList.length,this.sections),!this.sections.some(t=>t.id===this.selectedSection)&&this.sections.length>0?this.selectSection(this.sections[0].id):this.ensureSectionsListReflectsActiveSection()}createSidebar(){let e=this.sidebarContent=M(this.sidebarContainer,Bl(".sidebar-content"));this.createHarnessDropdown(e);let t=M(e,Bl(".sidebar-sections-list"));this.sectionsList=this.editorDisposables.add(this.instantiationService.createInstance(Vl,"AICustomizationManagementSections",t,new QAi,[new YAi],{multipleSelectionSupport:!1,setRowLineHeight:!1,horizontalScrolling:!1,accessibilityProvider:{getAriaLabel:o=>o.label,getWidgetAriaLabel:()=>d(6349,null)},openOnSingleClick:!0,identityProvider:{getId:o=>o.id}})),this.sectionsList.splice(0,this.sectionsList.length,this.sections),this.ensureSectionsListReflectsActiveSection(),this.editorDisposables.add(this.sectionsList.onDidChangeSelection(o=>{if(o.elements.length===0){this.ensureSectionsListReflectsActiveSection();return}this.selectSection(o.elements[0].id)})),this.editorDisposables.add(be(o=>{let n=this.harnessService.availableHarnesses.read(o),r=this.harnessService.activeHarness.read(o);if(!n.some(s=>s.id===r)&&n.length>0){this.harnessService.setActiveHarness(n[0].id);return}this.harnessContextKey.set(r),this.rebuildVisibleSections(),this.ensureHarnessDropdown(),this.updateHarnessDropdown(),this.refreshAllPromptsSectionCounts()})),this.isHarnessSelectorEnabled||this.harnessService.setActiveHarness("vscode"),this.editorDisposables.add(this.configurationService.onDidChangeConfiguration(o=>{o.affectsConfiguration("chat.customizations.harnessSelector.enabled")&&(this.isHarnessSelectorEnabled||this.harnessService.setActiveHarness("vscode"))})),this.workspaceService.isSessionsWindow&&this.createFolderPicker(e)}createHarnessDropdown(e){if(!this.isHarnessSelectorEnabled)return;let t=this.harnessDropdownContainer=M(e,Bl(".sidebar-harness-dropdown"));this.harnessDropdownButton=M(t,Bl("button.harness-dropdown-button")),this.harnessDropdownButton.setAttribute("aria-label",d(6351,null)),this.harnessDropdownButton.setAttribute("aria-haspopup","listbox"),this.harnessDropdownIcon=M(this.harnessDropdownButton,Bl("span.harness-dropdown-icon")),this.harnessDropdownLabel=M(this.harnessDropdownButton,Bl("span.harness-dropdown-label")),M(this.harnessDropdownButton,Bl("span.harness-dropdown-chevron.codicon.codicon-chevron-down")),this.updateHarnessDropdown(),this.editorDisposables.add(j(this.harnessDropdownButton,"click",()=>{this.showHarnessMenu()}))}ensureHarnessDropdown(){let e=this.harnessService.availableHarnesses.get(),t=this.isHarnessSelectorEnabled&&e.length>1;t&&!this.harnessDropdownContainer&&this.sidebarContent?this.createHarnessDropdown(this.sidebarContent):!t&&this.harnessDropdownContainer&&(this.harnessDropdownContainer.remove(),this.harnessDropdownContainer=void 0,this.harnessDropdownButton=void 0,this.harnessDropdownIcon=void 0,this.harnessDropdownLabel=void 0)}updateHarnessDropdown(){if(!this.harnessDropdownContainer||!this.harnessDropdownIcon||!this.harnessDropdownLabel)return;let e=this.harnessService.availableHarnesses.get();this.harnessDropdownContainer.style.display=e.length<=1?"none":"";let t=this.harnessService.activeHarness.get(),o=e.find(n=>n.id===t);o&&(this.harnessDropdownIcon.className="harness-dropdown-icon",this.harnessDropdownIcon.classList.add(...q.asClassNameArray(o.icon)),this.harnessDropdownLabel.textContent=o.label)}showHarnessMenu(){if(!this.harnessDropdownButton)return;let e=this.harnessService.availableHarnesses.get(),t=this.harnessService.activeHarness.get(),o=e.map(n=>{let r=new it(n.id,n.label,q.asClassName(n.icon),!0,()=>{this.harnessService.setActiveHarness(n.id)});return r.checked=n.id===t,r});this.contextMenuService.showContextMenu({getAnchor:()=>this.harnessDropdownButton,getActions:()=>o,getCheckedActionsRepresentation:()=>"radio"})}createFolderPicker(e){let t=this.folderPickerContainer=M(e,Bl(".sidebar-folder-picker")),o=M(t,Bl("button.folder-picker-button"));o.setAttribute("aria-label",d(6329,null)),M(o,Bl(`.codicon.codicon-${R.folder.id}`)).classList.add("folder-picker-icon"),this.folderPickerLabel=M(o,Bl("span.folder-picker-label")),this.folderPickerClearButton=M(t,Bl("button.folder-picker-clear")),this.folderPickerClearButton.setAttribute("aria-label",d(6331,null)),M(this.folderPickerClearButton,Bl(`.codicon.codicon-${R.close.id}`)),this.editorDisposables.add(j(o,"click",()=>{this.browseForFolder()})),this.editorDisposables.add(j(this.folderPickerClearButton,"click",()=>{this.workspaceService.clearOverrideProjectRoot()})),this.editorDisposables.add(this.hoverService.setupManagedHover(Ri("element"),o,()=>this.workspaceService.getActiveProjectRoot()?.fsPath??"")),this.editorDisposables.add(be(r=>{let s=this.workspaceService.activeProjectRoot.read(r),l=this.workspaceService.hasOverrideProjectRoot.read(r);this.updateFolderPickerLabel(s,l)}))}updateFolderPickerLabel(e,t){this.folderPickerLabel&&(this.folderPickerLabel.textContent=e?He(e):d(6339,null)),this.folderPickerClearButton&&(this.folderPickerClearButton.style.display=t?"":"none")}async browseForFolder(){let e=await this.fileDialogService.showOpenDialog({canSelectFolders:!0,canSelectFiles:!1,canSelectMany:!1,title:d(6350,null),defaultUri:this.workspaceService.getActiveProjectRoot()});e?.[0]&&this.workspaceService.setOverrideProjectRoot(e[0])}createContent(){let e=M(this.contentContainer,Bl(".content-inner"));this.promptsContentContainer=M(e,Bl(".prompts-content-container")),this.listWidget=this.editorDisposables.add(this.instantiationService.createInstance(tVe)),this.promptsContentContainer.appendChild(this.listWidget.element),this.editorDisposables.add(this.listWidget.onDidSelectItem(o=>{this.telemetryService.publicLog2("chatCustomizationEditor.itemSelected",{section:this.selectedSection,promptType:o.promptType,storage:o.storage??"external"});let n=o.storage,r=n==="local",s=!n||n==="extension"||n==="plugin"||n===pI;this.showEmbeddedEditor(o.uri,o.name,o.promptType,n??pI,r,s)})),this.editorDisposables.add(this.listWidget.onDidRequestCreate(o=>{this.createNewItemWithAI(o)})),this.editorDisposables.add(this.listWidget.onDidRequestCreateManual(({type:o,target:n,rootFileName:r})=>{this.createNewItemManual(o,n,r)}));let t=new Set(this.workspaceService.managementSections);if(t.has(Zn.Models)){this.modelsContentContainer=M(e,Bl(".models-content-container")),this.modelsWidget=this.editorDisposables.add(this.instantiationService.createInstance(hU)),this.modelsContentContainer.appendChild(this.modelsWidget.element),this.modelsFooterElement=M(this.modelsContentContainer,Bl(".section-footer"));let o=M(this.modelsFooterElement,Bl("p.section-footer-description"));o.textContent=d(6338,null);let n=M(this.modelsFooterElement,Bl("a.section-footer-link"));n.textContent=d(6335,null),n.href="https://code.visualstudio.com/docs/copilot/customization/language-models",this.editorDisposables.add(j(n,"click",r=>{r.preventDefault(),this.openerService.open(A.parse(n.href))}))}t.has(Zn.McpServers)&&(this.mcpContentContainer=M(e,Bl(".mcp-content-container")),this.mcpListWidget=this.editorDisposables.add(this.instantiationService.createInstance(aVe)),this.mcpContentContainer.appendChild(this.mcpListWidget.element),this.mcpDetailContainer=M(e,Bl(".mcp-detail-container")),this.createEmbeddedMcpDetail(),this.editorDisposables.add(this.mcpListWidget.onDidSelectServer(o=>{this.showEmbeddedMcpDetail(o)})),this.editorDisposables.add(this.mcpListWidget.onDidRequestShowPlugin(o=>{this.showPluginDetail(o)}))),t.has(Zn.Plugins)&&(this.pluginContentContainer=M(e,Bl(".plugin-content-container")),this.pluginListWidget=this.editorDisposables.add(this.instantiationService.createInstance(lVe)),this.pluginContentContainer.appendChild(this.pluginListWidget.element),this.pluginDetailContainer=M(e,Bl(".plugin-detail-container")),this.createEmbeddedPluginDetail(),this.editorDisposables.add(this.pluginListWidget.onDidSelectPlugin(o=>{this.pluginDetailReturnSection=void 0,this.showEmbeddedPluginDetail(o)}))),this.editorContentContainer=M(e,Bl(".editor-content-container")),this.createEmbeddedEditor(),this.updateContentVisibility(),this.editorDisposables.add(this.listWidget.onDidChangeItemCount(o=>{this.isPromptsSection(this.selectedSection)&&this.updateSectionCount(this.selectedSection,o)})),this.mcpListWidget&&(this.editorDisposables.add(this.mcpListWidget.onDidChangeItemCount(o=>{this.updateSectionCount(Zn.McpServers,o)})),this.mcpListWidget.fireItemCount()),this.pluginListWidget&&(this.editorDisposables.add(this.pluginListWidget.onDidChangeItemCount(o=>{this.updateSectionCount(Zn.Plugins,o)})),this.pluginListWidget.fireItemCount()),this.modelsWidget&&(this.editorDisposables.add(this.modelsWidget.onDidChangeItemCount(o=>{this.updateSectionCount(Zn.Models,o)})),this.modelsWidget.fireItemCount()),this.editorDisposables.add(this.promptsService.onDidChangeCustomAgents(()=>this.refreshAllPromptsSectionCounts())),this.editorDisposables.add(this.promptsService.onDidChangeSkills(()=>this.refreshAllPromptsSectionCounts())),this.editorDisposables.add(this.promptsService.onDidChangeInstructions(()=>this.refreshAllPromptsSectionCounts())),this.editorDisposables.add(this.promptsService.onDidChangeSlashCommands(()=>this.refreshAllPromptsSectionCounts())),this.refreshAllPromptsSectionCounts(),this.isPromptsSection(this.selectedSection)&&this.listWidget.setSection(this.selectedSection)}isPromptsSection(e){return e===Zn.Agents||e===Zn.Skills||e===Zn.Instructions||e===Zn.Prompts||e===Zn.Hooks}updateSectionCount(e,t){let o=this.sections.find(n=>n.id===e);!o||o.count===t||(o.count=t,this.sectionsList.splice(0,this.sectionsList.length,this.sections),this.ensureSectionsListReflectsActiveSection())}refreshAllPromptsSectionCounts(){this.promptsSectionCountScheduler.schedule()}_doRefreshAllPromptsSectionCounts(){for(let e of this.sections)this.isPromptsSection(e.id)&&this.listWidget.computeItemCountForSection(e.id).then(t=>{this.updateSectionCount(e.id,t)},mt)}selectSection(e){if(this.selectedSection===e){this.ensureSectionsListReflectsActiveSection(e);return}this.telemetryService.publicLog2("chatCustomizationEditor.sectionChanged",{section:e}),this.viewMode==="editor"&&this.goBackToList(),this.viewMode==="mcpDetail"&&this.goBackFromMcpDetail(),this.viewMode==="pluginDetail"&&this.goBackFromPluginDetail(),this.selectedSection=e,this.sectionContextKey.set(e),this.storageService.store(XNt,e,0,0),this.updateContentVisibility(),this.isPromptsSection(e)&&this.listWidget.setSection(e),this.ensureSectionsListReflectsActiveSection(e)}ensureSectionsListReflectsActiveSection(e=this.selectedSection){if(!this.sectionsList)return;let t=this.sections.findIndex(r=>r.id===e);if(t<0)return;let o=this.sectionsList.getSelection();(o.length!==1||o[0]!==t)&&this.sectionsList.setSelection([t]);let n=this.sectionsList.getFocus();(n.length!==1||n[0]!==t)&&this.sectionsList.setFocus([t])}updateContentVisibility(){let e=this.viewMode==="editor",t=this.viewMode==="mcpDetail",o=this.viewMode==="pluginDetail",n=t||o,r=this.isPromptsSection(this.selectedSection),s=this.selectedSection===Zn.Models,l=this.selectedSection===Zn.McpServers,c=this.selectedSection===Zn.Plugins;this.promptsContentContainer&&(this.promptsContentContainer.style.display=!e&&!n&&r?"":"none"),this.modelsContentContainer&&(this.modelsContentContainer.style.display=!e&&!n&&s?"":"none"),this.mcpContentContainer&&(this.mcpContentContainer.style.display=!e&&!n&&l?"":"none"),this.mcpDetailContainer&&(this.mcpDetailContainer.style.display=t?"":"none"),this.pluginContentContainer&&(this.pluginContentContainer.style.display=!e&&!n&&c?"":"none"),this.pluginDetailContainer&&(this.pluginDetailContainer.style.display=o?"":"none"),this.editorContentContainer&&(this.editorContentContainer.style.display=e?"":"none"),s&&this.modelsWidget&&(this.modelsWidget.render(),this.dimension&&this.layout(this.dimension))}async createNewItemWithAI(e){this.telemetryService.publicLog2("chatCustomizationEditor.createItem",{section:this.selectedSection,promptType:e,creationMode:"ai",target:"workspace"}),this.input&&this.group.closeEditor(this.input),await this.workspaceService.generateCustomization(e)}async createNewItemManual(e,t,o){if(this.telemetryService.publicLog2("chatCustomizationEditor.createItem",{section:this.selectedSection,promptType:e,creationMode:"manual",target:t==="workspace-root"?"workspace":t}),t==="workspace-root"){let c=this.workspaceService.getActiveProjectRoot();if(!c)return;let u=this.harnessService.getActiveDescriptor().sectionOverrides?.get(this.selectedSection),p=o??u?.rootFile??h4,h=A.joinPath(c,p);await this.fileService.exists(h)?await this.showEmbeddedEditor(h,p,"instructions","local",!0):(await this.fileService.createFile(h),await this.showEmbeddedEditor(h,p,"instructions","local",!0)),this.listWidget.refresh();return}if(e==="hook"){this.workspaceService.isSessionsWindow?await this.instantiationService.invokeFunction(B0e,{openEditor:async c=>{await this.showEmbeddedEditor(c,He(c),"hook","local",!0)},target:"github-copilot"}):await this.instantiationService.invokeFunction(B0e,{openEditor:async c=>{await this.showEmbeddedEditor(c,He(c),"hook","local",!0)}});return}let n=await this.resolveTargetDirectoryWithPicker(e,t);if(n===null)return;let r=this.harnessService.getActiveDescriptor().sectionOverrides?.get(this.selectedSection),s={targetFolder:n,targetStorage:t==="user"?"user":"local",fileExtension:r?.fileExtension,openFile:async c=>{let u=t==="workspace";return await this.showEmbeddedEditor(c,He(c),e,t==="user"?"user":"local",u),this.embeddedEditor}},l;switch(e){case"prompt":l=hrt;break;case"instructions":l=grt;break;case"agent":l=frt;break;case"skill":l=vrt;break;default:return}await this.commandService.executeCommand(l,s),this.listWidget.refresh()}async resolveTargetDirectoryWithPicker(e,t){let o=await this.promptsService.getSourceFolders(e),n=this.workspaceService.getActiveProjectRoot(),s=this.harnessService.getActiveDescriptor().workspaceSubpaths,l;if(t==="workspace")l=n?o.filter(h=>ws(h.uri,n)?s?lTe(h.uri.path,s):!0:!1):[];else{l=n?o.filter(g=>!ws(g.uri,n)):o;let h=this.harnessService.getStorageSourceFilter(e);if(h.includedUserFileRoots){let g=h.includedUserFileRoots;l=l.filter(f=>g.some(v=>ws(f.uri,v)))}}let c=new Set;if(l=l.filter(h=>{let g=h.uri.toString();return c.has(g)?!1:(c.add(g),!0)}),l.length===0)return;if(l.length===1)return l[0].uri;let u=l.map(h=>({label:this.promptsService.getPromptLocationLabel(h),description:h.uri.fsPath,uri:h.uri}));return(await this.quickInputService.pick(u,{placeHolder:d(6352,null)}))?.uri??null}updateStyles(){let e=this.theme.getColor(Dcn);e&&this.splitView?.style({separatorBorder:e})}async setInput(e,t,o,n){this.workspaceService.clearOverrideProjectRoot(),this.inEditorContextKey.set(!0),this.sectionContextKey.set(this.selectedSection),e.setSaveHandler(()=>this.handleBuiltinSave()),this.telemetryService.publicLog2("chatCustomizationEditor.opened",{section:this.selectedSection}),await super.setInput(e,t,o,n),this.dimension&&this.layout(this.dimension)}clearInput(){let e=this.input;e instanceof gU&&(e.setSaveHandler(void 0),e.setDirty(!1)),this.inEditorContextKey.set(!1),this.viewMode==="editor"&&this.goBackToList(),this.viewMode==="mcpDetail"&&this.goBackFromMcpDetail(),this.viewMode==="pluginDetail"&&this.goBackFromPluginDetail(),this.workspaceService.clearOverrideProjectRoot(),this.disposeBuiltinEditingSessions(),super.clearInput()}layout(e){this.dimension=e,this.container&&this.splitView&&(this.splitViewContainer.style.height=`${e.height}px`,this.splitView.layout(e.width,e.height))}focus(){if(super.focus(),this.viewMode==="editor"){this.embeddedEditor?.focus();return}this.selectedSection===Zn.McpServers?this.mcpListWidget?.focusSearch():this.selectedSection===Zn.Plugins?this.pluginListWidget?.focusSearch():this.selectedSection===Zn.Models?this.modelsWidget?.focusSearch():this.listWidget?.focusSearch()}selectSectionById(e){this.sections.findIndex(o=>o.id===e)>=0&&(this.viewMode==="editor"&&this.goBackToList(),this.viewMode==="mcpDetail"&&this.goBackFromMcpDetail(),this.viewMode==="pluginDetail"&&this.goBackFromPluginDetail(),this.selectedSection=e,this.sectionContextKey.set(e),this.storageService.store(XNt,e,0,0),this.updateContentVisibility(),this.isPromptsSection(e)&&this.listWidget.setSection(e),this.dimension&&this.layout(this.dimension),this.ensureSectionsListReflectsActiveSection(e))}refreshList(){this.listWidget.refresh()}revealLastItem(){this.selectedSection===Zn.McpServers?this.mcpListWidget?.revealLastItem():this.selectedSection===Zn.Plugins?this.pluginListWidget?.revealLastItem():this.listWidget.revealLastItem()}async generateDebugReport(){return this.listWidget.generateDebugReport()}createEmbeddedEditor(){if(!this.editorContentContainer)return;let e=M(this.editorContentContainer,Bl(".editor-header"));this.editorActionButton=M(e,Bl("button.editor-back-button")),this.editorActionButton.setAttribute("aria-label",d(6326,null)),this.editorActionButtonIcon=M(this.editorActionButton,Bl(`.codicon.codicon-${R.arrowLeft.id}.editor-action-button-icon`)),this.editorActionButtonIcon.setAttribute("aria-hidden","true"),this.editorDisposables.add(j(this.editorActionButton,"click",()=>{this.handleEditorActionButton().catch(r=>{console.error("Failed to handle editor back action:",r),this.notificationService.error(d(6332,null))})}));let t=M(e,Bl(".editor-item-info"));this.editorItemNameElement=M(t,Bl(".editor-item-name")),this.editorItemPathElement=M(t,Bl(".editor-item-path")),this.editorSaveIndicator=M(e,Bl(".editor-save-indicator"));let o=M(this.editorContentContainer,Bl(".embedded-editor-container")),n=M(this.editorContentContainer,Bl(".embedded-editor-overflow-widgets.monaco-editor"));this.editorDisposables.add(Z(()=>n.remove())),this.embeddedEditor=this.editorDisposables.add(this.instantiationService.createInstance(Xr,o,{...Vb(this.configurationService),readOnly:!1,minimap:{enabled:!1},lineNumbers:"on",wordWrap:"on",scrollBeyondLastLine:!1,automaticLayout:!1,folding:!0,renderLineHighlight:"all",scrollbar:{vertical:"auto",horizontal:"auto"},overflowWidgetsDomNode:n},{isSimpleWidget:!1}))}async showEmbeddedEditor(e,t,o,n,r=!1,s=!1){this.currentModelRef?.dispose(),this.currentModelRef=void 0,this.editorModelChangeDisposables.clear(),this.currentEditingUri=e,this.currentEditingProjectRoot=r?this.workspaceService.getActiveProjectRoot():void 0,this.currentEditingStorage=n,this.currentEditingPromptType=o,this.viewMode="editor",this.editorItemNameElement.textContent=t,this.editorItemPathElement.textContent=He(e),this._editorContentChanged=!1,this.resetEditorSaveIndicator(),this.updateEditorActionButton(),this.updateContentVisibility();try{if(n===pI&&(o==="prompt"||o==="skill")){let c=await this.getOrCreateBuiltinEditingSession(e);if(!Qe(this.currentEditingUri,e))return;this.embeddedEditor.setModel(c.model),this.embeddedEditor.updateOptions({readOnly:!1}),this._editorContentChanged=c.model.getValue()!==c.originalContent,this.updateEditorActionButton(),this.dimension&&this.layout(this.dimension),this.embeddedEditor.focus(),this.editorModelChangeDisposables.add(c.model.onDidChangeContent(()=>{this._editorContentChanged=c.model.getValue()!==c.originalContent,this.updateEditorActionButton()}));return}let l=await this.textModelService.createModelReference(e);if(!Qe(this.currentEditingUri,e)){l.dispose();return}this.currentModelRef=l,this.embeddedEditor.setModel(l.object.textEditorModel),this.embeddedEditor.updateOptions({readOnly:s}),this.dimension&&this.layout(this.dimension),this.embeddedEditor.focus(),this._editorContentChanged=this.workingCopyService.isDirty(e),this.editorModelChangeDisposables.add(l.object.textEditorModel.onDidChangeContent(()=>{this._editorContentChanged=!0,this.resetEditorSaveIndicator()})),this.editorModelChangeDisposables.add(this.workingCopyService.onDidSave(c=>{Qe(c.workingCopy.resource,e)&&(this._editorContentChanged=this.workingCopyService.isDirty(e),this.editorSaveIndicator.className="editor-save-indicator visible saved",this.editorSaveIndicator.classList.add(...q.asClassNameArray(R.check)),this.editorSaveIndicator.title=d(6348,null))}))}catch(l){console.error("Failed to load model for embedded editor:",l),Qe(this.currentEditingUri,e)&&this.goBackToList()}}goBackToList(){let e=this.currentEditingUri,t=this.createExistingCustomizationSaveRequest();if(t&&this.telemetryService.publicLog2("chatCustomizationEditor.saveItem",{promptType:this.currentEditingPromptType??"",storage:String(this.currentEditingStorage??""),saveTarget:"existing"}),e&&this.currentEditingStorage===pI&&this.disposeBuiltinEditingSession(e),this.currentModelRef?.dispose(),this.currentModelRef=void 0,this.currentEditingUri=void 0,this.currentEditingProjectRoot=void 0,this.currentEditingStorage=void 0,this.currentEditingPromptType=void 0,this._editorContentChanged=!1,this.editorModelChangeDisposables.clear(),this.resetEditorSaveIndicator(),this.updateEditorActionButton(),this.embeddedEditor?.setModel(null),this.viewMode="list",this.updateContentVisibility(),this.listWidget?.refresh(),this.dimension&&this.layout(this.dimension),this.listWidget?.focusSearch(),t){let o=t;this.saveExistingCustomization(o).catch(n=>{console.error("Failed to save customization changes on exit:",n),this.notificationService.warn(d(6347,null,He(o.fileUri)))})}}async getOrCreateBuiltinEditingSession(e){let t=e.toString(),o=this.builtinEditingSessions.get(t);if(o&&!o.model.isDisposed())return o;let n=await this.textModelService.createModelReference(e);try{let r={model:this.modelService.createModel(Yx(n.object.textEditorModel.createSnapshot()),{languageId:n.object.textEditorModel.getLanguageId(),onDidChange:U.None},A.from({scheme:"ai-customization-builtin",path:e.path,query:xt()}),!1),originalContent:n.object.textEditorModel.getValue()};return this.builtinEditingSessions.set(t,r),r}finally{n.dispose()}}createBuiltinPromptSaveRequest(e){let t=this.currentEditingUri,o=this.currentEditingPromptType;if(!t||this.currentEditingStorage!==pI||o!=="prompt"&&o!=="skill"||!e.folder||e.target==="cancel")return;let n=this.builtinEditingSessions.get(t.toString());if(!(!n||!this._editorContentChanged))return{target:e.target,folder:e.folder,sourceUri:t,content:n.model.getValue(),promptType:o,projectRoot:e.target==="workspace"?this.workspaceService.getActiveProjectRoot():void 0}}createExistingCustomizationSaveRequest(){if(!this._editorContentChanged||this.currentEditingStorage===pI||!this.currentEditingUri)return;let e=this.currentModelRef?.object.textEditorModel;if(e)return{fileUri:this.currentEditingUri,content:e.getValue(),projectRoot:this.currentEditingProjectRoot}}async saveBuiltinPromptCopy(e){let t;if(e.promptType==="skill"){let o=He(ci(e.sourceUri));t=A.joinPath(e.folder,o,He(e.sourceUri))}else t=A.joinPath(e.folder,He(e.sourceUri));await this.fileService.createFolder(ci(t)),await this.fileService.writeFile(t,qe.fromString(e.content)),e.target==="workspace"&&e.projectRoot&&await this.workspaceService.commitFiles(e.projectRoot,[t])}async saveExistingCustomization(e){await this.fileService.writeFile(e.fileUri,qe.fromString(e.content)),e.projectRoot&&await this.workspaceService.commitFiles(e.projectRoot,[e.fileUri])}async pickBuiltinPromptSaveTarget(){let e=[],t=this.currentEditingPromptType??"prompt",o=KAi(this.workspaceService,t);o&&e.push({label:d(6355,null),description:o.fsPath,target:"workspace",folder:o});let n=await GAi(this.promptsService,t);return n&&e.push({label:d(6354,null),description:n.fsPath,target:"user",folder:n}),e.push({label:d(6330,null),target:"cancel"}),this.quickInputService.pick(e,{canPickMany:!1,placeHolder:d(6346,null),matchOnDescription:!0})}async handleEditorActionButton(){if(this.editorActionButtonInProgress)return;this.editorActionButtonInProgress=!0,this.updateEditorActionButton();let e;try{if(this.shouldShowBuiltinSaveAction()){let t=await this.pickBuiltinPromptSaveTarget();if(!t||t.target==="cancel")return;e=this.createBuiltinPromptSaveRequest(t),e&&this.telemetryService.publicLog2("chatCustomizationEditor.saveItem",{promptType:this.currentEditingPromptType??"",storage:String(this.currentEditingStorage??""),saveTarget:t.target})}if(this.goBackToList(),e){let t=e;this.saveBuiltinPromptCopy(t).then(()=>{this.listWidget?.refresh()},o=>{console.error("Failed to save built-in override:",o),this.notificationService.warn(t.target==="workspace"?d(6345,null):d(6344,null))})}}finally{this.editorActionButtonInProgress=!1,this.updateEditorActionButton()}}updateEditorActionButton(){if(this.updateInputDirtyState(),!this.editorActionButton||!this.editorActionButtonIcon)return;let e=this.shouldShowBuiltinSaveAction();this.editorActionButtonIcon.className=`codicon codicon-${e?R.save.id:R.arrowLeft.id} editor-action-button-icon`,this.editorActionButton.disabled=this.editorActionButtonInProgress,this.editorActionButton.setAttribute("aria-label",e?d(6342,null):d(6326,null)),this.editorActionButton.title=e?d(6343,null):d(6326,null)}shouldShowBuiltinSaveAction(){return this._editorContentChanged&&this.currentEditingStorage===pI&&(this.currentEditingPromptType==="prompt"||this.currentEditingPromptType==="skill")}updateInputDirtyState(){let e=this.input;e instanceof gU&&e.setDirty(this.shouldShowBuiltinSaveAction())}async handleBuiltinSave(){if(!this.shouldShowBuiltinSaveAction())return!1;let e=await this.pickBuiltinPromptSaveTarget();if(!e||e.target==="cancel")return!1;let t=this.createBuiltinPromptSaveRequest(e);if(!t)return!1;try{return await this.saveBuiltinPromptCopy(t),this.telemetryService.publicLog2("chatCustomizationEditor.saveItem",{promptType:this.currentEditingPromptType??"",storage:String(this.currentEditingStorage??""),saveTarget:e.target}),this._editorContentChanged=!1,this.updateEditorActionButton(),!0}catch(o){return console.error("Failed to save built-in override:",o),this.notificationService.warn(e.target==="workspace"?d(6345,null):d(6344,null)),!1}}resetEditorSaveIndicator(){this.editorSaveIndicator.className="editor-save-indicator",this.editorSaveIndicator.title=""}disposeBuiltinEditingSessions(){for(let e of this.builtinEditingSessions.values())e.model.dispose();this.builtinEditingSessions.clear()}disposeBuiltinEditingSession(e){let t=e.toString(),o=this.builtinEditingSessions.get(t);o&&(o.model.dispose(),this.builtinEditingSessions.delete(t))}createEmbeddedMcpDetail(){if(!this.mcpDetailContainer)return;let e=M(this.mcpDetailContainer,Bl(".editor-header")),t=M(e,Bl("button.editor-back-button"));t.setAttribute("aria-label",d(6327,null)),M(t,Bl(`.codicon.codicon-${R.arrowLeft.id}`)).setAttribute("aria-hidden","true"),this.editorDisposables.add(j(t,"click",()=>{this.goBackFromMcpDetail()}));let n=M(this.mcpDetailContainer,Bl(".mcp-detail-editor-container"));this.embeddedMcpEditor=this.editorDisposables.add(this.instantiationService.createInstance(bU,this.group)),this.embeddedMcpEditor.create(n)}async showEmbeddedMcpDetail(e){if(!this.embeddedMcpEditor)return;this.viewMode="mcpDetail",this.updateContentVisibility();let t=this.instantiationService.createInstance(Voe,e);this.mcpDetailDisposables.clear(),this.mcpDetailDisposables.add(t);try{await this.embeddedMcpEditor.setInput(t,void 0,{},Se.None)}catch{this.goBackFromMcpDetail();return}this.dimension&&this.layout(this.dimension)}goBackFromMcpDetail(){this.mcpDetailDisposables.clear(),this.embeddedMcpEditor?.clearInput(),this.viewMode="list",this.updateContentVisibility(),this.dimension&&this.layout(this.dimension),this.mcpListWidget?.focusSearch()}createEmbeddedPluginDetail(){if(!this.pluginDetailContainer)return;let e=M(this.pluginDetailContainer,Bl(".editor-header")),t=M(e,Bl("button.editor-back-button"));t.setAttribute("aria-label",d(6328,null)),M(t,Bl(`.codicon.codicon-${R.arrowLeft.id}`)).setAttribute("aria-hidden","true"),this.editorDisposables.add(j(t,"click",()=>{this.goBackFromPluginDetail()}));let n=M(this.pluginDetailContainer,Bl(".plugin-detail-editor-container"));this.embeddedPluginEditor=this.editorDisposables.add(this.instantiationService.createInstance(SU,this.group)),this.embeddedPluginEditor.create(n)}async showEmbeddedPluginDetail(e){if(!this.embeddedPluginEditor)return;this.viewMode="pluginDetail",this.updateContentVisibility();let t=new lq(e);this.pluginDetailDisposables.clear(),this.pluginDetailDisposables.add(t);try{await this.embeddedPluginEditor.setInput(t,void 0,{},Se.None)}catch{this.goBackFromPluginDetail();return}this.dimension&&this.layout(this.dimension)}async showPluginDetail(e){this.selectedSection!==Zn.Plugins&&(this.pluginDetailReturnSection=this.selectedSection),await this.showEmbeddedPluginDetail(e)}goBackFromPluginDetail(){this.pluginDetailDisposables.clear(),this.embeddedPluginEditor?.clearInput();let e=this.pluginDetailReturnSection;this.pluginDetailReturnSection=void 0,e?(this.viewMode="list",this.updateContentVisibility(),this.selectSection(e)):(this.viewMode="list",this.updateContentVisibility(),this.pluginListWidget?.focusSearch()),this.dimension&&this.layout(this.dimension)}};wq=I([m(1,Te),m(2,Le),m(3,ce),m(4,F),m(5,X),m(6,Je),m(7,ge),m(8,zF),m(9,Or),m(10,Bt),m(11,B),m(12,Xa),m(13,rn),m(14,nt),m(15,Tt),m(16,Ue),m(17,Xe),m(18,fe),m(19,Ne),m(20,UR)],wq);ne.as(qo.EditorPane).registerEditorPane(Br.create(wq,jNt,d(6291,null)),[new Ft(gU)]);var XAi=class{canSerialize(i){return i instanceof gU}serialize(i){return""}deserialize(i){return gU.getOrCreate()}};ne.as(qo.EditorFactory).registerEditorSerializer(QNt,XAi);function zoe(a){return A.isUri(a)?a:typeof a=="string"?A.parse(a):A.isUri(a.uri)?a.uri:A.parse(a.uri)}function zCo(a){if(!(A.isUri(a)||typeof a=="string"))return a.storage}function JAi(a){if(!(A.isUri(a)||typeof a=="string"))return a.promptType}function Lcn(a){if(A.isUri(a)||typeof a=="string")return;let i=a.pluginUri;if(i)return A.isUri(i)?i:typeof i=="string"?A.parse(i):void 0}var KCo="aiCustomizationManagement.openFile";W(class extends K{constructor(){super({id:KCo,title:L(6310,"Open"),icon:R.goToFile})}async run(a,i){let e=a.get(ee),t=zCo(i),o=await e.openEditor({resource:zoe(i)}),n=ha(o?.getControl());n&&(t==="extension"||t==="plugin")&&n.updateOptions({readOnly:!0,readOnlyMessage:new Ie(d(6314,null))})}});var GCo="aiCustomizationManagement.runPrompt";W(class extends K{constructor(){super({id:GCo,title:L(6317,"Run Prompt"),icon:R.play})}async run(a,i){await a.get(ge).executeCommand("workbench.action.chat.run.prompt.current",zoe(i))}});var qCo=ei?L(6316,"Reveal in File Explorer"):Ze?L(6315,"Reveal in Finder"):L(6313,"Open Containing Folder"),$Co="aiCustomizationManagement.revealInOS";W(class extends K{constructor(){super({id:$Co,title:qCo,icon:R.folderOpened})}async run(a,i){let e=a.get(ge),t=zoe(i);await e.executeCommand("revealFileInOS",t)}});var ZAi="aiCustomizationManagement.delete";W(class extends K{constructor(){super({id:ZAi,title:L(6304,"Delete"),icon:R.trash})}async run(a,i){let e=a.get(fe),t=a.get(at),o=zoe(i),n=zCo(i),r=JAi(i),s=r==="skill",l=s?He(ci(o)):He(o);if(n==="plugin"){let h=a.get(Gg).plugins.get().find(g=>ws(o,g.uri));h&&(await t.confirm({message:d(6295,null,h.label),detail:d(6296,null),primaryButton:d(6321,null),type:"question"})).confirmed&&h.remove();return}if(n==="extension"||n===pI){await t.info(d(6293,null),d(6294,null));return}let c=s?d(6299,null,l):d(6297,null,l);if((await t.confirm({message:c,detail:d(6298,null),primaryButton:d(6305,null),type:"warning"})).confirmed){try{a.get(Te).publicLog2("chatCustomizationEditor.deleteItem",{promptType:r??"",storage:n??""})}catch{}let p=s?ci(o):o,h=e.hasCapability(p,4096);if(await e.del(p,{useTrash:h,recursive:s}),n==="local"){let g=a.get(zF),f=g.getActiveProjectRoot();f&&await g.deleteFiles(f,[p])}}}});var jCo="aiCustomizationManagement.copyPath";W(class extends K{constructor(){super({id:jCo,title:L(6302,"Copy Path"),icon:R.clippy})}async run(a,i){let e=a.get(Fi),t=zoe(i),o=t.scheme==="file"?t.fsPath:t.toString(!0);await e.writeText(o)}});var QCo=C.and(C.notEquals(m0,"extension"),C.notEquals(m0,"plugin"),C.notEquals(m0,pI)),eNi=C.equals(m0,"plugin");ve.appendMenuItem(Rk,{command:{id:jCo,title:d(6303,null),icon:R.clippy},group:"inline",order:1});ve.appendMenuItem(Rk,{command:{id:ZAi,title:d(6305,null),icon:R.trash},group:"inline",order:10,when:QCo});ve.appendMenuItem(Rk,{command:{id:KCo,title:d(6311,null)},group:"1_open",order:1});ve.appendMenuItem(Rk,{command:{id:GCo,title:d(6318,null),icon:R.play},group:"2_run",order:1,when:C.equals(p3,"prompt")});ve.appendMenuItem(Rk,{command:{id:$Co,title:qCo.value},group:"3_file",order:1,when:C.or(C.regex(VDe,new RegExp(`^${Q.file}:`)),C.regex(VDe,new RegExp(`^${Q.vscodeUserData}:`)))});ve.appendMenuItem(Rk,{command:{id:ZAi,title:d(6305,null)},group:"4_modify",order:1,when:QCo});var tNi="aiCustomizationManagement.uninstallPlugin";W(class extends K{constructor(){super({id:tNi,title:L(6322,"Uninstall Plugin"),icon:R.trash})}async run(a,i){let e=a.get(Gg),t=a.get(at),o=zoe(i),n=e.plugins.get().find(s=>ws(o,s.uri));if(!n)return;(await t.confirm({message:d(6300,null,n.label),detail:d(6301,null),primaryButton:d(6323,null),type:"question"})).confirmed&&n.remove()}});ve.appendMenuItem(Rk,{command:{id:tNi,title:d(6321,null),icon:R.trash},group:"inline",order:10,when:eNi});ve.appendMenuItem(Rk,{command:{id:tNi,title:d(6321,null)},group:"4_modify",order:1,when:eNi});var YCo="aiCustomizationManagement.showPlugin";W(class extends K{constructor(){super({id:YCo,title:L(6319,"Show Plugin")})}async run(a,i){let e=a.get(Gg),t=a.get(ee),o=Lcn(i);if(!o)return;let n=e.plugins.get().find(c=>c.uri.toString()===o.toString());if(!n)return;let r={kind:"installed",name:n.label,description:n.fromMarketplace?.description??"",marketplace:n.fromMarketplace?.marketplace,plugin:n},s=gU.getOrCreate(),l=await t.openEditor(s,{pinned:!0});l instanceof wq&&await l.showPluginDetail(r)}});ve.appendMenuItem(Rk,{command:{id:YCo,title:d(6320,null)},group:"1_open",order:2,when:eNi});var iNi="aiCustomizationManagement.disableItem";W(class extends K{constructor(){super({id:iNi,title:L(6306,"Disable"),icon:R.eyeClosed})}async run(a,i){let e=a.get(Or),t=zoe(i),o=JAi(i);if(!o)return;let n=e.getDisabledPromptFiles(o);n.add(t),e.setDisabledPromptFiles(o,n)}});var oNi="aiCustomizationManagement.enableItem";W(class extends K{constructor(){super({id:oNi,title:L(6308,"Enable"),icon:R.eye})}async run(a,i){let e=a.get(Or),t=zoe(i),o=JAi(i);if(!o)return;let n=e.getDisabledPromptFiles(o);n.delete(t),e.setDisabledPromptFiles(o,n)}});ve.appendMenuItem(Rk,{command:{id:iNi,title:d(6307,null)},group:"5_toggle",order:1,when:C.and(C.equals(EZ,!1),C.equals(m0,pI),C.equals(p3,"skill"))});ve.appendMenuItem(Rk,{command:{id:oNi,title:d(6309,null)},group:"5_toggle",order:1,when:C.and(C.equals(EZ,!0),C.equals(m0,pI),C.equals(p3,"skill"))});ve.appendMenuItem(Rk,{command:{id:iNi,title:d(6307,null),icon:R.eyeClosed},group:"inline",order:5,when:C.and(C.equals(EZ,!1),C.equals(m0,pI),C.equals(p3,"skill"))});ve.appendMenuItem(Rk,{command:{id:oNi,title:d(6309,null),icon:R.eye},group:"inline",order:5,when:C.and(C.equals(EZ,!0),C.equals(m0,pI),C.equals(p3,"skill"))});var Zqt=class extends x{static{this.ID="workbench.contrib.aiCustomizationManagementActions"}constructor(){super(),this.registerActions()}registerActions(){this._register(W(class extends K{constructor(){super({id:YNt.OpenEditor,title:L(6312,"Open Customizations (Preview)"),shortTitle:L(6292,"Customizations (Preview)"),category:Si,precondition:C.and(ie.enabled,C.has("config.chat.customizationsMenu.enabled")),f1:!0})}async run(i,e){let t=i.get(ee),o=gU.getOrCreate(),n=await t.openEditor(o,{pinned:!0});e&&n instanceof wq&&n.selectSectionById(e)}}))}};It(Zqt.ID,Zqt,St.AfterRestored);var IU=class extends x{constructor(e,t,o){super();this.container=e;this.delegate=t;this.instantiationService=o;this._onDidChangeHeight=this._register(new E);this.onDidChangeHeight=this._onDidChangeHeight.event;this.title=void 0;this.titleLabel=this._register(new me);this.modelDisposables=this._register(new me);this.lastKnownHeight=0;this.render(this.container),this.registerActions()}static{this.DEFAULT_TITLE=d(8107,null)}static{this.PICK_AGENT_SESSION_ACTION_ID="workbench.action.chat.pickAgentSession"}registerActions(){let e=this;this._register(W(class extends K{constructor(){super({id:IU.PICK_AGENT_SESSION_ACTION_ID,title:d(8108,null),f1:!1,menu:[{id:D.ChatViewSessionTitleNavigationToolbar,group:"navigation",order:2}]})}async run(t){await t.get(F).createInstance(coe,e.titleLabel.value?.element,void 0).pickAgentSession()}}))}render(e){let t=ct("div.chat-view-title-container",[ct("div.chat-view-title-inner",[ct("div.chat-view-title-navigation-toolbar@navigationToolbar"),ct("div.chat-view-title-actions-toolbar@actionsToolbar")])]);this.navigationToolbar=this._register(this.instantiationService.createInstance(or,t.navigationToolbar,D.ChatViewSessionTitleNavigationToolbar,{actionViewItemProvider:o=>{if(o.id===IU.PICK_AGENT_SESSION_ACTION_ID)return this.titleLabel.value=new nNi(o),this.titleLabel.value.updateTitle(this.title??IU.DEFAULT_TITLE),this.titleLabel.value},hiddenItemStrategy:-1,menuOptions:{shouldForwardArgs:!0}})),this.actionsToolbar=this._register(this.instantiationService.createInstance(or,t.actionsToolbar,D.ChatViewSessionTitleToolbar,{menuOptions:{shouldForwardArgs:!0},hiddenItemStrategy:-1})),this.titleContainer=t.root,this._register(Ms.addTarget(this.titleContainer));for(let o of[Kn.Tap,re.CLICK])this._register(j(this.titleContainer,o,()=>{this.delegate.focusChat()}));e.appendChild(this.titleContainer)}update(e){this.model=e,this.modelDisposables.value=e?.onDidChange(t=>{(t.kind==="setCustomTitle"||t.kind==="addRequest")&&this.doUpdate()}),this.doUpdate()}doUpdate(){let e=new Ie(this.model?.title??"");this.title=Da(e),this.updateTitle(this.title??IU.DEFAULT_TITLE);let t=this.model&&{$mid:19,sessionResource:this.model.sessionResource};this.navigationToolbar&&(this.navigationToolbar.context=t),this.actionsToolbar&&(this.actionsToolbar.context=t)}updateTitle(e){if(!this.titleContainer)return;this.titleContainer.classList.toggle("visible",this.shouldRender()),this.titleLabel.value?.updateTitle(e);let t=this.getHeight();t!==this.lastKnownHeight&&(this.lastKnownHeight=t,this._onDidChangeHeight.fire())}shouldRender(){return!!this.model?.title}getHeight(){return!this.titleContainer||this.titleContainer.style.display==="none"?0:this.titleContainer.offsetHeight}};IU=I([m(2,F)],IU);var nNi=class extends hs{constructor(e,t){super(null,e,{...t,icon:!1,label:!0});this.titleLabel=void 0}render(e){super.render(e),e.classList.add("chat-view-title-action-item"),this.label?.classList.add("chat-view-title-label-container"),this.titleLabel=this.label?.appendChild(ct("span.chat-view-title-label").root),this.updateLabel()}updateTitle(e){this.title=e,this.updateLabel()}updateLabel(){this.titleLabel&&(this.title?this.titleLabel.textContent=this.title:this.titleLabel.textContent="")}};var mVe=class extends x{constructor(e,t){super();this._chatService=e;this._languageService=t;this._approvals=new Map;this._modelTrackers=this._register(new Xb);this._register(aae(o=>this._chatService.chatModels.read(o),({addedValues:o,removedValues:n})=>{for(let r of o)this._modelTrackers.set(r.sessionResource,this._trackModel(r));for(let r of n)this._modelTrackers.deleteAndDispose(r.sessionResource),this._approvals.get(r.sessionResource.toString())?.set(void 0,void 0)}))}getApproval(e){return this._getOrCreateApproval(e.toString())}_getOrCreateApproval(e){let t=this._approvals.get(e);return t||(t=Me(`sessionApproval.${e}`,void 0),this._approvals.set(e,t)),t}_trackModel(e){let t=this._getOrCreateApproval(e.sessionResource.toString()),o=n=>{let r=t.get();r!==n&&(r!==void 0&&n!==void 0&&r.label===n.label&&r.languageId===n.languageId||t.set(n,void 0))};return be(n=>{let r=e.requestNeedsInput.read(n);if(!r){o(void 0);return}let s=e.lastRequest?.response;if(!s?.response?.value){o(void 0);return}for(let l of s.response.value){if(l.kind!=="toolInvocation")continue;let c=l.state.read(n);if(c.type===Pi.StateKind.WaitingForConfirmation||c.type===Pi.StateKind.WaitingForPostApproval){let u,p;if(l.toolSpecificData?.kind==="terminal"){let g=iM(l.toolSpecificData);u=g.presentationOverrides?.commandLine??g.commandLine.forDisplay??g.commandLine.userEdited??g.commandLine.toolEdited??g.commandLine.original,p=this._languageService.getLanguageIdByLanguageName(g.presentationOverrides?.language??g.language)??void 0}else if(r.detail)u=r.detail;else{let g=l.invocationMessage;u=typeof g=="string"?g:Da(g)}let h=c;o({label:u,languageId:p,since:new Date,confirm:()=>h.confirm({type:4})});return}}o(void 0)})}};mVe=I([m(0,mi),m(1,_t)],mVe);var UM=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.container=e;this.options=t;this.contextMenuService=o;this.contextKeyService=n;this.instantiationService=r;this.chatSessionsService=s;this.commandService=l;this.menuService=c;this.agentSessionsService=u;this.telemetryService=p;this.editorService=h;this.storageService=g;this.accessibilityService=f;this.sessionsListFindIsOpen=!1;this._isProgrammaticCollapseChange=!1;this._recentRepositoryLabels=new Set;this.updateSessionsListThrottler=this._register(new gu);this._onDidUpdate=this._register(new E);this.onDidUpdate=this._onDidUpdate.event;this.visible=!0;this.focusedAgentSessionArchivedContextKey=ie.isArchivedAgentSession.bindTo(this.contextKeyService),this.focusedAgentSessionPinnedContextKey=ie.isPinnedAgentSession.bindTo(this.contextKeyService),this.focusedAgentSessionReadContextKey=ie.isReadAgentSession.bindTo(this.contextKeyService),this.focusedAgentSessionTypeContextKey=ie.agentSessionType.bindTo(this.contextKeyService),this.hasMultipleAgentSessionsSelectedContextKey=ie.hasMultipleAgentSessionsSelected.bindTo(this.contextKeyService),this.create(this.container),this.registerListeners()}get element(){return this.sessionsContainer}static{this.RECENT_SESSIONS_FOR_EXPAND=5}registerListeners(){this._register(this.editorService.onDidActiveEditorChange(()=>this.revealAndFocusActiveEditorSession()))}revealAndFocusActiveEditorSession(){if(!this.options.trackActiveEditorSession()||!this.visible)return;let e=this.editorService.activeEditor,t=e instanceof Na?e.sessionResource:e?.resource;if(!t)return;let o=this.agentSessionsService.model.getSession(t);o&&this.sessionsList?.hasNode(o)&&(this.sessionsList.getRelativeTop(o)===null&&this.sessionsList.reveal(o,.5),this.sessionsList.setFocus([o]),this.sessionsList.setSelection([o]))}create(e){this.sessionsContainer=M(e,_(".agent-sessions-viewer")),this.createEmptyFilterMessage(this.sessionsContainer),this.createList(this.sessionsContainer)}createEmptyFilterMessage(e){this.emptyFilterMessage=M(e,_(".agent-sessions-empty-filter-message")),vo(this.emptyFilterMessage);let t=M(this.emptyFilterMessage,_("span"));t.textContent=`${d(6097,null)} - `;let o=M(this.emptyFilterMessage,_("span.reset-filter-link"));o.textContent=d(6098,null),o.tabIndex=0,o.setAttribute("role","button"),this._register(j(o,re.CLICK,()=>this.options.filter.reset())),this._register(j(o,re.KEY_DOWN,n=>{let r=new gi(n);(r.keyCode===3||r.keyCode===10)&&(Xt.stop(n,!0),this.options.filter.reset())}))}static{this.SECTION_COLLAPSE_STATE_KEY="agentSessions.sectionCollapseState"}getSavedCollapseState(e){let t=this.storageService.get(UM.SECTION_COLLAPSE_STATE_KEY,0);if(t)try{let o=JSON.parse(t);if(typeof o[e]=="boolean")return o[e]}catch{}}saveSectionCollapseState(e,t){let o={},n=this.storageService.get(UM.SECTION_COLLAPSE_STATE_KEY,0);if(n)try{let r=JSON.parse(n);typeof r=="object"&&r!==null&&!Array.isArray(r)&&(o=r)}catch{}o[e]=t,this.storageService.store(UM.SECTION_COLLAPSE_STATE_KEY,JSON.stringify(o),0,0)}resetSectionCollapseState(){this.storageService.remove(UM.SECTION_COLLAPSE_STATE_KEY,0)}createList(e){let t=h=>{if(LS(h)){let g=this.getSavedCollapseState(h.section);if(g!==void 0)return g;if(h.section==="more"&&!this.options.filter.getExcludes().read||h.section==="archived"&&this.options.filter.getExcludes().archived||this.options.collapseOlderSections?.()&&(["week","older","archived"].includes(h.section)||h.section==="yesterday"&&this.hasTodaySessions()||h.section==="repository"&&!this._recentRepositoryLabels.has(h.label)))return!0}return!1},o=new yQ(()=>this.options.filter.sortResults?.()??"created"),n=this.options.enableApprovalRow?this._register(this.instantiationService.createInstance(mVe)):void 0,r=Me(this,void 0),s=this._register(this.instantiationService.createInstance(NM,{...this.options,isGroupedByRepository:()=>this.options.filter.groupResults?.()==="repository",isSortedByUpdated:()=>this.options.filter.sortResults?.()==="updated"},n,r)),l=this.options.compactShowMore,c=this.sessionsDataSource=this._register(new W2t(this.options.filter,o,this.options.repositoryGroupLimit)),u=this.sessionsList=this._register(this.instantiationService.createInstance(sy,"AgentSessionsView",e,new ife(n,this.options.compactShowMore),new H2t,[s,this.instantiationService.createInstance(IQ,{hideSectionCount:this.options.hideSectionCount}),new OM({compactLabel:this.options.compactShowMore}),new drt],c,{accessibilityProvider:new F2t,dnd:this.instantiationService.createInstance(T0e),identityProvider:new B2t,horizontalScrolling:!1,multipleSelectionSupport:!0,findWidgetEnabled:!0,defaultFindMode:1,keyboardNavigationLabelProvider:new U2t,overrideStyles:this.options.overrideStyles,twistieAdditionalCssClass:()=>"force-no-twistie",collapseByDefault:h=>t(h),renderIndentGuides:"none"}));if(ie.agentSessionsViewerFocused.bindTo(u.contextKeyService),this._register(s.onDidChangeItemHeight(h=>{u.hasNode(h)&&u.updateElementHeight(h,void 0)})),l){let h,g,f=OM.COLLAPSED_HEIGHT,v=new Map,b=()=>{v.clear();try{let V=u.getNode();for(let H of V.children)if(LS(H.element)){let G=H.element.label;for(let $ of H.children)(u0($.element)||p0($.element))&&v.set(G,$.element)}}catch{}},S,y,w=Re(e);this._register({dispose:()=>{S&&w.cancelAnimationFrame(S),y&&w.cancelAnimationFrame(y)}});let k=(V,H,G,$)=>{if(this.accessibilityService.isMotionReduced()){if(u.hasNode(V)){O=!0;try{u.updateElementHeight(V,G)}finally{O=!1}f=G}$?.();return}let J=150,ae=Date.now(),he=()=>{let oe=Date.now()-ae,de=Math.min(oe/J,1),Ce=1-Math.pow(1-de,2),xe=Math.round(H+(G-H)*Ce);if(u.hasNode(V)){O=!0;try{u.updateElementHeight(V,xe)}finally{O=!1}f=xe}if(de<1)return w.requestAnimationFrame(he);$?.()};return w.requestAnimationFrame(he)},T=()=>{y&&(w.cancelAnimationFrame(y),y=void 0),S&&(w.cancelAnimationFrame(S),S=void 0),h&&g&&u.hasNode(h)&&(y=k(h,f,OM.COLLAPSED_HEIGHT,()=>{y=void 0})),h=void 0,g=void 0},P=V=>{if(g===V)return;T();let H=v.get(V);!H||!u.hasNode(H)||(h=H,g=V,f=OM.COLLAPSED_HEIGHT,S=k(H,OM.COLLAPSED_HEIGHT,OM.HEIGHT,()=>{S=void 0}))},O=!1;this._register(u.onDidChangeModel(()=>{O||(h=void 0,g=void 0,f=OM.COLLAPSED_HEIGHT,b())})),this._register(j(e,"mouseover",V=>{let G=V.target.closest(".monaco-list-row");if(!G)return;let $,J=G.querySelector(".agent-session-section-label");if(J&&($=J.textContent??void 0),!$){let ae=G.querySelector(".agent-session-show-more");ae&&($=ae.getAttribute("data-section-label")??void 0)}if(!$){let ae=G.querySelector(".agent-session-item[data-section-label]");ae&&($=ae.getAttribute("data-section-label")??void 0)}if(!$){if(G.querySelector(".agent-session-item"))return;T();return}if(!v.has($)){T();return}P($)})),this._register(j(e,"mouseleave",()=>{T()})),b()}this._register(c.onDidGetChildren(h=>{this.updateEmpty(h===0)})),this._register(c.onDidExpandRepositoryGroup(()=>{this.update()}));let p=this.agentSessionsService.model;this._register(this.options.filter.onDidChange(async()=>{this.visible&&(this.updateSectionCollapseStates(),this.update())})),this._register(p.onDidChangeSessions(()=>{this.visible&&this.update()})),this.computeRecentRepositoryLabels(),u.setInput(p),this._register(u.onDidOpen(h=>this.openAgentSession(h))),this._register(u.onContextMenu(h=>this.showContextMenu(h))),this._register(u.onMouseDblClick(({element:h})=>{h===null&&this.commandService.executeCommand(Zm)})),this._register(U.any(u.onDidChangeFocus,u.onDidChangeSelection,p.onDidChangeSessions)(()=>{let h=u.getFocus().at(0);h&&d0(h)?(this.focusedAgentSessionArchivedContextKey.set(h.isArchived()),this.focusedAgentSessionPinnedContextKey.set(h.isPinned()),this.focusedAgentSessionReadContextKey.set(h.isRead()),this.focusedAgentSessionTypeContextKey.set(h.providerType),r.set(h.resource,void 0)):(this.focusedAgentSessionArchivedContextKey.reset(),this.focusedAgentSessionPinnedContextKey.reset(),this.focusedAgentSessionReadContextKey.reset(),this.focusedAgentSessionTypeContextKey.reset(),r.set(void 0,void 0));let g=u.getSelection().filter(d0);this.hasMultipleAgentSessionsSelectedContextKey.set(g.length>1)})),this._register(u.onDidChangeFindOpenState(h=>{this.sessionsListFindIsOpen=h,this.updateSectionCollapseStates()})),this._register(u.onDidChangeCollapseState(h=>{if(this._isProgrammaticCollapseChange)return;let g=h.node.element?.element;g&&LS(g)&&this.saveSectionCollapseState(g.section,h.node.collapsed)}))}updateEmpty(e){if(!this.emptyFilterMessage||!this.sessionsList)return;let o=this.agentSessionsService.model.sessions.length>0,n=!this.options.filter.isDefault(),r=o&&e&&n;hh(r,this.emptyFilterMessage),hh(!r,this.sessionsList.getHTMLElement())}hasTodaySessions(){let e=new Date().setHours(0,0,0,0);return this.agentSessionsService.model.sessions.some(t=>!t.isArchived()&&t.timing.created>=e)}computeRecentRepositoryLabels(){this._recentRepositoryLabels.clear();let e=this.agentSessionsService.model.sessions.filter(t=>!t.isArchived()&&!t.isPinned()).sort((t,o)=>o.timing.created-t.timing.created).slice(0,UM.RECENT_SESSIONS_FOR_EXPAND);for(let t of e){let o=_0e(t);this._recentRepositoryLabels.add(o??lU.repository)}}async openAgentSession(e){let t=e.element;if(!t||LS(t))return;if(u0(t)){this.sessionsDataSource?.expandRepositoryGroup(t.sectionLabel);return}if(p0(t)){this.sessionsDataSource?.collapseRepositoryGroup(t.sectionLabel);return}this.telemetryService.publicLog2("agentSessionOpened",{providerType:t.providerType,source:this.options.source});let o=this.options.overrideSessionOpenOptions?.(e)??e;if(this.options.overrideSessionOpen)await this.options.overrideSessionOpen(t.resource,o);else{let n=await this.instantiationService.invokeFunction(x0e,t,o);n&&this.options.notifySessionOpened?.(t.resource,n)}}async showContextMenu({element:e,anchor:t,browserEvent:o}){!e||u0(e)||p0(e)||(Xt.stop(o,!0),LS(e)?this.showAgentSessionSectionContextMenu(e,t):this.showAgentSessionContextMenu(e,t))}async showAgentSessionSectionContextMenu(e,t){let o=[];o.push([ie.agentSessionSection.key,e.section]);let n=this.menuService.createMenu(D.AgentSessionSectionContext,this.contextKeyService.createOverlay(o));this.contextMenuService.showContextMenu({getActions:()=>ri.join(...n.getActions({arg:e,shouldForwardArgs:!0}).map(([,r])=>r)),getAnchor:()=>t,getActionsContext:()=>this}),n.dispose()}async showAgentSessionContextMenu(e,t){this.chatSessionsService.activateChatSessionItemProvider(e.providerType);let o=[];o.push([ie.isArchivedAgentSession.key,e.isArchived()]),o.push([ie.isPinnedAgentSession.key,e.isPinned()]),o.push([ie.isReadAgentSession.key,e.isRead()]),o.push([ie.agentSessionType.key,e.providerType]);let n=this.menuService.createMenu(D.AgentSessionsContext,this.contextKeyService.createOverlay(o)),r=this.sessionsList?.getSelection().filter(d0)??[],s={session:e,sessions:r.length>1&&r.includes(e)?r:[e],$mid:25};this.contextMenuService.showContextMenu({getActions:()=>ri.join(...n.getActions({arg:s,shouldForwardArgs:!0}).map(([,l])=>l)),getAnchor:()=>t,getActionsContext:()=>s}),n.dispose()}openFind(){this.sessionsList?.openFind()}updateSectionCollapseStates(){if(this.sessionsList){this._isProgrammaticCollapseChange=!0;try{this._updateSectionCollapseStatesCore()}finally{this._isProgrammaticCollapseChange=!1}}}_updateSectionCollapseStatesCore(){if(!this.sessionsList)return;let e=this.agentSessionsService.model;for(let t of this.sessionsList.getNode(e).children)if(LS(t.element))switch(t.element.section){case"archived":{let o=!this.sessionsListFindIsOpen&&this.options.filter.getExcludes().archived;o&&!t.collapsed?this.sessionsList.collapse(t.element):!o&&t.collapsed&&this.sessionsList.expand(t.element);break}case"more":{t.collapsed&&this.sessionsListFindIsOpen&&this.sessionsList.expand(t.element);break}}}refresh(){return this.agentSessionsService.model.resolve(void 0)}collapseAllSections(){if(!this.sessionsList)return;let e=this.agentSessionsService.model;for(let t of this.sessionsList.getNode(e).children)LS(t.element)&&!t.collapsed&&this.sessionsList.collapse(t.element)}async update(){return this.updateSessionsListThrottler.queue(async()=>{this.computeRecentRepositoryLabels(),await this.sessionsList?.updateChildren(),this._onDidUpdate.fire()})}setVisible(e){this.visible!==e&&(this.visible=e,this.visible&&this.update())}layout(e,t){this.sessionsList?.layout(e,t)}focus(){this.sessionsList?.domFocus()}clearFocus(){this.sessionsList?.setFocus([]),this.sessionsList?.setSelection([])}hasFocusOrSelection(){return(this.sessionsList?.getFocus().length??0)>0||(this.sessionsList?.getSelection().length??0)>0}scrollToTop(){this.sessionsList&&(this.sessionsList.scrollTop=0)}getFocus(){return(this.sessionsList?.getFocus()??[]).filter(t=>d0(t))}reveal(e){if(!this.sessionsList)return!1;let t=this.agentSessionsService.model.getSession(e);return!t||!this.sessionsList.hasNode(t)?!1:(this.sessionsList.getRelativeTop(t)===null&&this.sessionsList.reveal(t,.5),this.sessionsList.setFocus([t]),this.sessionsList.setSelection([t]),!0)}};UM=I([m(2,Xe),m(3,X),m(4,F),m(5,Us),m(6,ge),m(7,Kt),m(8,md),m(9,Te),m(10,ee),m(11,ce),m(12,Oi)],UM);var XT=class extends Gs{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,P,O,V,H,G,$){super(e,t,o,n,r,s,l,c,u,p);this.storageService=h;this.chatService=g;this.chatAgentService=f;this.logService=v;this.notificationService=b;this.layoutService=S;this.chatSessionsService=y;this.telemetryService=w;this.progressService=T;this.agentSessionsService=P;this.chatEntitlementService=O;this.commandService=V;this.activityService=H;this.workbenchEnvironmentService=G;this.hostService=$;this.lastDimensionsPerOrientation=new Map;this.loadSessionCts=this._register(new me);this.modelRef=this._register(new me);this._previousModelRef=this._register(new me);this.activityBadge=this._register(new me);this.sessionsViewerOrientation=1;this.sessionsViewerOrientationConfiguration="sideBySide";this.sessionsViewerSashDisposables=this._register(new me);this.layoutingBody=!1;this.memento=new Al(`interactive-session-view-${jEe}`,this.storageService),this.viewState=this.memento.getMemento(1,1),k.startupKind!==3&&this.configurationService.getValue("chat.restoreLastPanelSession")===!1&&(this.viewState.sessionId=void 0,this.viewState.sessionResource=void 0),this.sessionsViewerVisible=!1,this.sessionsViewerSidebarWidth=Math.max(XT.SESSIONS_SIDEBAR_MIN_WIDTH,this.viewState.sessionsSidebarWidth??XT.SESSIONS_SIDEBAR_DEFAULT_WIDTH),this.chatViewLocationContext=ie.panelLocation.bindTo(r),this.sessionsViewerOrientationContext=ie.agentSessionsViewerOrientation.bindTo(r),this.sessionsViewerPositionContext=ie.agentSessionsViewerPosition.bindTo(r),this.sessionsViewerVisibilityContext=ie.agentSessionsViewerVisible.bindTo(r),this.updateContextKeys(),this.registerListeners()}updateContextKeys(){let{position:e,location:t}=this.getViewPositionAndLocation();this.chatViewLocationContext.set(t??2),this.sessionsViewerOrientationContext.set(this.sessionsViewerOrientation),this.sessionsViewerPositionContext.set(e===1?2:1)}getViewPositionAndLocation(){let e=this.viewDescriptorService.getViewLocationById(this.id),t=this.layoutService.getSideBarPosition(),o=this.layoutService.getPanelPosition(),n;switch(e){case 0:n=t===1;break;case 1:n=o!==0;break;default:n=t===0;break}return{position:n?1:0,location:e??2}}getSessionHoverPosition(){let e=this.viewDescriptorService.getViewLocationById(this.id),t=this.layoutService.getSideBarPosition();return this.sessionsViewerOrientation===2?e===0&&t===1?0:1:{0:1,1:0,3:2,2:3}[e===1?this.layoutService.getPanelPosition():t]}updateViewPaneClasses(e){let t=this.configurationService.getValue("workbench.activityBar.location")==="default";this.viewPaneContainer?.classList.toggle("activity-bar-location-default",t),this.viewPaneContainer?.classList.toggle("activity-bar-location-other",!t);let{position:o,location:n}=this.getViewPositionAndLocation();this.viewPaneContainer?.classList.toggle("chat-view-location-auxiliarybar",n===2),this.viewPaneContainer?.classList.toggle("chat-view-location-sidebar",n===0),this.viewPaneContainer?.classList.toggle("chat-view-location-panel",n===1),this.viewPaneContainer?.classList.toggle("chat-view-position-left",o===0),this.viewPaneContainer?.classList.toggle("chat-view-position-right",o===1),e&&this.relayout()}registerListeners(){this._register(this.chatAgentService.onDidChangeAgents(()=>this.onDidChangeAgents())),this._register(U.any(U.filter(this.configurationService.onDidChangeConfiguration,e=>e.affectsConfiguration("workbench.sideBar.location")),this.layoutService.onDidChangePanelPosition,U.filter(this.viewDescriptorService.onDidChangeContainerLocation,e=>e.viewContainer===this.viewDescriptorService.getViewContainerByViewId(this.id)))(()=>{this.updateContextKeys(),this.updateViewPaneClasses(!0)})),this._register(U.filter(this.configurationService.onDidChangeConfiguration,e=>e.affectsConfiguration("workbench.activityBar.location"))(()=>this.updateViewPaneClasses(!0)))}onDidChangeAgents(){if(this.chatAgentService.getDefaultAgent("panel")&&!this._widget?.viewModel&&!this.restoringSession){let e=this.getTransferredOrPersistedSessionInfo();this.restoringSession=(e?this.chatService.acquireOrLoadSession(e,"panel",Se.None):Promise.resolve(void 0)).then(async t=>{if(!this._widget)return;let o=this._widget.visible;try{this._widget.setVisible(!1),await this.showModel(Se.None,t)}finally{this._widget.setVisible(o)}}),this.restoringSession.finally(()=>this.restoringSession=void 0)}this._onDidChangeViewWelcomeState.fire()}getTransferredOrPersistedSessionInfo(){return this.chatService.transferredSessionResource?this.chatService.transferredSessionResource:this.viewState.sessionResource?this.viewState.sessionResource:this.viewState.sessionId?Jr.forSession(this.viewState.sessionId):void 0}renderBody(e){super.renderBody(e),this.telemetryService.publicLog2("chatViewPaneOpened"),this.viewPaneContainer=e,this.viewPaneContainer.classList.add("chat-viewpane"),this.updateViewPaneClasses(!1),this.createControls(e),this.setupContextMenu(e),this.applyModel()}createControls(e){let t=this.createSessionsControl(e),o=this.welcomeController=this._register(this.instantiationService.createInstance(XOe,e,this,"panel")),n=this.createChatControl(e);this.registerControlsListeners(t,n,o),this.updateSessionsControlVisibility()}static{this.SESSIONS_SIDEBAR_MIN_WIDTH=200}static{this.SESSIONS_SIDEBAR_SNAP_THRESHOLD=this.SESSIONS_SIDEBAR_MIN_WIDTH/2}static{this.SESSIONS_SIDEBAR_DEFAULT_WIDTH=300}static{this.CHAT_WIDGET_DEFAULT_WIDTH=300}static{this.SESSIONS_SIDEBAR_VIEW_MIN_WIDTH=this.CHAT_WIDGET_DEFAULT_WIDTH+this.SESSIONS_SIDEBAR_DEFAULT_WIDTH}createSessionsControl(e){let t=this.sessionsContainer=e.appendChild(_(".agent-sessions-container")),o=this.sessionsTitleContainer=M(t,_(".agent-sessions-title-container")),n=this.sessionsTitle=M(o,_("span.agent-sessions-title"));n.textContent=d(8106,null),this._register(j(n,re.CLICK,()=>{this.sessionsControl?.scrollToTop(),this.sessionsControl?.focus()}));let r=M(o,_(".agent-sessions-toolbar")),s=this._register(this.instantiationService.createInstance(or,r,D.AgentSessionsToolbar,{menuOptions:{shouldForwardArgs:!0}})),l=this._register(this.instantiationService.createInstance(TW,{filterMenuId:D.AgentSessionsViewerFilterSubMenu,groupResults:()=>this.sessionsViewerOrientation===1?"capped":"date"}));this._register(U.runAndSubscribe(l.onDidChange,()=>{r.classList.toggle("filtered",!l.isDefault())}));let c=this.sessionsNewButtonContainer=M(t,_(".agent-sessions-new-button-container")),u=this._register(new Wi(c,{...Qo,secondary:!0}));u.label=d(8104,null),this._register(u.onDidClick(()=>this.commandService.executeCommand(Zm))),this.sessionsControlContainer=M(t,_(".agent-sessions-control-container"));let p=this.sessionsControl=this._register(this.instantiationService.createInstance(UM,this.sessionsControlContainer,{source:"chatViewPane",filter:l,overrideStyles:this.getLocationBasedColors().listOverrideStyles,getHoverPosition:()=>this.getSessionHoverPosition(),trackActiveEditorSession:()=>!this._widget||this._widget.isEmpty(),overrideSessionOpenOptions:h=>this.sessionsViewerOrientation===1&&!h.sideBySide?{...h,editorOptions:{...h.editorOptions,preserveFocus:!1}}:h}));return this._register(this.onDidChangeBodyVisibility(h=>p.setVisible(h))),s.context=p,this._register(this.hostService.onDidChangeFocus(h=>{h&&p.refresh()})),this._register(U.runAndSubscribe(U.filter(this.configurationService.onDidChangeConfiguration,h=>h.affectsConfiguration("chat.viewSessions.orientation")),h=>{let g=this.configurationService.getValue("chat.viewSessions.orientation");this.doUpdateConfiguredSessionsViewerOrientation(g,{updateConfiguration:!1,layout:!!h})})),p}getSessionsViewerOrientation(){return this.sessionsViewerOrientation}updateConfiguredSessionsViewerOrientation(e){return this.doUpdateConfiguredSessionsViewerOrientation(e,{updateConfiguration:!0,layout:!0})}doUpdateConfiguredSessionsViewerOrientation(e,t){let o=this.sessionsViewerOrientationConfiguration,n;e==="stacked"||e==="sideBySide"?n=e:n="sideBySide",this.sessionsViewerOrientationConfiguration=n,o!==this.sessionsViewerOrientationConfiguration&&(t.updateConfiguration&&this.configurationService.updateValue("chat.viewSessions.orientation",n),t.layout&&this.relayout())}updateSessionsControlVisibility(){if(!this.sessionsContainer||!this.viewPaneContainer)return{changed:!1,visible:!1};let e;this.configurationService.getValue("chat.viewSessions.enabled")?this.sessionsViewerOrientation===1?e=!!this.chatEntitlementService.sentiment.installed&&(!this._widget||this._widget.isEmpty()&&!!this._widget.viewModel&&!this._widget.viewModel.model.title)&&!this.welcomeController?.isShowingWelcome.get():e=!this.welcomeController?.isShowingWelcome.get()&&!!this.lastDimensions&&this.lastDimensions.width>=XT.SESSIONS_SIDEBAR_VIEW_MIN_WIDTH:e=!1,this.viewPaneContainer.classList.toggle("has-sessions-control",e);let t=this.sessionsContainer.style.display!=="none";return hh(e,this.sessionsContainer),this.sessionsViewerVisible=e,this.sessionsViewerVisibilityContext.set(e),{changed:t!==e,visible:e}}getFocusedSessions(){return this.sessionsControl?.getFocus()??[]}static{this.MIN_CHAT_WIDGET_HEIGHT=116}get widget(){return this._widget}createChatControl(e){let t=M(e,_(".chat-controls-container")),o=this.getLocationBasedColors(),n=this.layoutService.getContainer(Re(t)).appendChild(_(".chat-editor-overflow.monaco-editor"));this._register(Z(()=>n.remove())),this.viewDescriptorService.getViewLocationById(this.id)!==3&&this.createChatTitleControl(t);let r=this._register(this.instantiationService.createChild(new _o([X,this.scopedContextKeyService])));this._widget=this._register(r.createInstance(kI,"panel",{viewId:this.id},{autoScroll:l=>l!=="ask",renderFollowups:!0,supportsFileReferences:!0,clear:()=>this.clear(),rendererOptions:{renderTextEditsAsSummary:l=>!0,referencesExpandedWhenEmptyResponse:!1,progressMessageAtBottomOfResponse:l=>l!=="ask"},editorOverflowWidgetsDomNode:n,enableImplicitContext:!0,enableWorkingSet:this.workbenchEnvironmentService.isSessionsWindow?"implicit":"explicit",supportsChangingModes:!0,dndContainer:e,inputEditorMinLines:this.workbenchEnvironmentService.isSessionsWindow?2:void 0,isSessionsWindow:this.workbenchEnvironmentService.isSessionsWindow},{listForeground:CK,listBackground:o.background,overlayBackground:o.overlayBackground,inputEditorBackground:o.background,resultEditorBackground:Ho})),this._widget.render(t);let s=l=>this._widget.setVisible(this.isBodyVisible()&&!this.welcomeController?.isShowingWelcome.read(l));return this._register(this.onDidChangeBodyVisibility(()=>s())),this._register(be(l=>s(l))),this._widget}createChatTitleControl(e){this.titleControl=this._register(this.instantiationService.createInstance(IU,e,{focusChat:()=>this._widget.focusInput()})),this._register(this.titleControl.onDidChangeHeight(()=>{this.relayout()}))}registerControlsListeners(e,t,o){this._register(U.any(t.onDidChangeEmptyState,U.fromObservable(o.isShowingWelcome),U.filter(this.configurationService.onDidChangeConfiguration,s=>s.affectsConfiguration("chat.viewSessions.enabled")))(()=>{this.sessionsViewerOrientation===1&&e.clearFocus();let{changed:s}=this.updateSessionsControlVisibility();s&&this.relayout()})),this._register(t.onDidChangeViewModel(()=>{if(this.sessionsViewerOrientation===1)return;let s=t.viewModel?.sessionResource;s&&(e.reveal(s)||e.clearFocus())})),this._register(this.agentSessionsService.model.onDidChangeSessions(()=>{if(this.sessionsViewerOrientation===1||e.hasFocusOrSelection())return;let s=t.viewModel?.sessionResource;s&&e.reveal(s)})),this._register(this.agentSessionsService.model.onDidChangeSessionArchivedState(s=>{if(s.isArchived()){let l=t.viewModel?.sessionResource;l&&Qe(l,s.resource)&&this.clear()}})),this._register(be(s=>{t.inputPart.height.read(s),this.sessionsViewerVisible&&this.sessionsViewerOrientation===1&&this.relayout()}));let n=this._register(new me),r=()=>{if(n.value=new N,!this.configurationService.getValue("chat.viewProgressBadge.enabled")){this.activityBadge.clear();return}let s=t.viewModel?.model;s?n.value.add(be(l=>{s.requestInProgress.read(l)?this.activityBadge.value=this.activityService.showViewActivity(this.id,{badge:new sx(()=>d(8105,null))}):this.activityBadge.clear()})):this.activityBadge.clear()};this._register(t.onDidChangeViewModel(()=>r())),this._register(U.filter(this.configurationService.onDidChangeConfiguration,s=>s.affectsConfiguration("chat.viewProgressBadge.enabled"))(()=>r())),r()}setupContextMenu(e){this._register(j(e,re.CONTEXT_MENU,t=>{Xt.stop(t,!0),this.contextMenuService.showContextMenu({menuId:D.ChatWelcomeContext,contextKeyService:this.contextKeyService,getAnchor:()=>new Cn(Re(e),t)})}))}applyModel(){this.restoringSession=this._applyModel(),this.restoringSession.finally(()=>this.restoringSession=void 0)}async _applyModel(){let e=this.getTransferredOrPersistedSessionInfo(),t=e?await this.chatService.acquireOrLoadSession(e,"panel",Se.None):void 0;await this.showModel(Se.None,t)}async showModel(e,t,o=!0){let n=this.modelRef.value?.object.sessionResource;this._previousModelRef.value=this.modelRef.value,this.modelRef.value=void 0;let r;if(o&&(r=t??(this.chatService.transferredSessionResource?await this.chatService.acquireOrLoadSession(this.chatService.transferredSessionResource,"panel",e):this.chatService.startNewLocalSession("panel")),!r))throw new Error("Could not start chat session");if(e.isCancellationRequested){r?.dispose();return}this.modelRef.value=r;let s=r?.object;if(s&&this._previousModelRef.value?.object.sessionResource.toString()===s.sessionResource.toString()&&(this._previousModelRef.value=void 0),s){if(await this.updateWidgetLockState(gl(s.sessionResource)),e.isCancellationRequested){this.modelRef.value=void 0;return}this.viewState.sessionResource=s.sessionResource}if(this._widget.setModel(s),this.titleControl?.update(s),this.updateActions(),n){let l=this.agentSessionsService.model.getSession(n);l&&!l.isMarkedUnread()&&l.setRead(!0)}return s}async updateWidgetLockState(e){if(e===sc){this._widget.unlockFromCodingAgent();return}let t=!1;try{t=await this.chatSessionsService.canResolveChatSession(e)}catch(n){this.logService.warn(`Failed to resolve chat session type '${e}' for locking`,n)}if(!t){this._widget.unlockFromCodingAgent();return}let o=this.chatSessionsService.getChatSessionContribution(e);o?this._widget.lockToCodingAgent(o.name,o.displayName,e):this._widget.unlockFromCodingAgent()}async clear(){this.loadSessionCts.value?.cancel(),this.updateViewState(),await this.showModel(Se.None),this.updateActions()}async loadSession(e){this.loadSessionCts.value?.cancel();let t=this.loadSessionCts.value=new Ye,o=t.token;if(this.restoringSession&&await this.restoringSession,!o.isCancellationRequested)return this.progressService.withProgress({location:Dr,delay:200},async()=>{let n=Promise.resolve(),r=tn(()=>{o.isCancellationRequested||this.loadSessionCts.value!==t||(n=this.showModel(o,void 0,!1).then(()=>{}))},100),s=o.onCancellationRequested(()=>r.dispose());try{let l=await this.chatService.acquireOrLoadSession(e,"panel",o);if(r.dispose(),await n,o.isCancellationRequested){l?.dispose();return}return this.showModel(o,l)}catch(l){return r.dispose(),await n,o.isCancellationRequested?void 0:(this.logService.error(`Failed to load chat session '${e.toString()}'`,l),this.notificationService.error(d(8103,null,xn(l))),this.showModel(o,void 0))}finally{s.dispose()}})}focus(){super.focus(),this.focusInput()}focusInput(){this._widget.focusInput()}focusSessions(){return this.sessionsContainer?.style.display==="none"?!1:(this.sessionsControl?.focus(),!0)}relayout(){this.lastDimensions&&this.layoutBody(this.lastDimensions.height,this.lastDimensions.width)}layoutBody(e,t){if(!this.layoutingBody){this.layoutingBody=!0;try{this.doLayoutBody(e,t)}finally{this.layoutingBody=!1}}}doLayoutBody(e,t){super.layoutBody(e,t),this.lastDimensions={height:e,width:t};let o=e,n=t,r=this.titleControl?.getHeight()??0;o-=r;let{heightReduction:s,widthReduction:l}=this.layoutSessionsControl(o,n);this._widget.setInputPartMaxHeightOverride(this.sessionsViewerOrientation===1?o:void 0),this._widget.layout(o-s,n-l),this.lastDimensionsPerOrientation.set(this.sessionsViewerOrientation,{height:e,width:t})}layoutSessionsControl(e,t){let o=0,n=0;if(!this.sessionsContainer||!this.sessionsControlContainer||!this.sessionsControl||!this.viewPaneContainer||!this.sessionsTitleContainer||!this.sessionsTitle)return{heightReduction:o,widthReduction:n};let r=this.sessionsViewerOrientation,s;if(this.sessionsViewerOrientationConfiguration==="stacked"?s=1:s=t>=XT.SESSIONS_SIDEBAR_VIEW_MIN_WIDTH?2:1,this.sessionsViewerOrientation=s,s===2?(this.viewPaneContainer.classList.toggle("sessions-control-orientation-sidebyside",!0),this.viewPaneContainer.classList.toggle("sessions-control-orientation-stacked",!1),this.sessionsViewerOrientationContext.set(2)):(this.viewPaneContainer.classList.toggle("sessions-control-orientation-sidebyside",!1),this.viewPaneContainer.classList.toggle("sessions-control-orientation-stacked",!0),this.sessionsViewerOrientationContext.set(1)),r!==this.sessionsViewerOrientation){let u=this.sessionsControl.update();this.sessionsViewerOrientation===2&&u.then(()=>{let p=this._widget?.viewModel?.sessionResource;p&&this.sessionsControl?.reveal(p)})}let{visible:l}=this.updateSessionsControlVisibility();if(!l||this.sessionsViewerOrientation===1?(this.sessionsViewerSashDisposables.clear(),this.sessionsViewerSash=void 0):this.sessionsViewerOrientation===2&&!this.sessionsViewerSashDisposables.value&&this.viewPaneContainer&&this.createSessionsViewerSash(this.viewPaneContainer,e,t),!l)return{heightReduction:0,widthReduction:0};let c=e-this.sessionsTitleContainer.offsetHeight;if(this.sessionsViewerOrientation===1?c-=Math.max(XT.MIN_CHAT_WIDGET_HEIGHT,this._widget?.input?.height.get()??0):c-=this.sessionsNewButtonContainer?.offsetHeight??0,this.sessionsViewerOrientation===2){let u=this.computeEffectiveSideBySideSessionsSidebarWidth(t);this.sessionsControlContainer.style.height=`${c}px`,this.sessionsControlContainer.style.width=`${u}px`,this.sessionsControl.layout(c,u),this.sessionsViewerSash?.layout(),o=0,n=this.sessionsContainer.offsetWidth}else this.sessionsControlContainer.style.height=`${c}px`,this.sessionsControlContainer.style.width="",this.sessionsControl.layout(c,t),o=this.sessionsContainer.offsetHeight,n=0;return{heightReduction:o,widthReduction:n}}computeEffectiveSideBySideSessionsSidebarWidth(e,t=this.sessionsViewerSidebarWidth){return Math.max(XT.SESSIONS_SIDEBAR_MIN_WIDTH,Math.min(t,e-XT.CHAT_WIDGET_DEFAULT_WIDTH))}getLastDimensions(e){return this.lastDimensionsPerOrientation.get(e)}createSessionsViewerSash(e,t,o){let n=this.sessionsViewerSashDisposables.value=new N,r=this.sessionsViewerSash=n.add(new Jh(e,{getVerticalSashLeft:()=>{let l=this.computeEffectiveSideBySideSessionsSidebarWidth(this.lastDimensions?.width??o),{position:c}=this.getViewPositionAndLocation();return c===1?(this.lastDimensions?.width??o)-l:l}},{orientation:0})),s;n.add(r.onDidStart(()=>s=this.sessionsViewerSidebarWidth)),n.add(r.onDidEnd(()=>s=void 0)),n.add(r.onDidChange(l=>{if(s===void 0||!this.lastDimensions)return;let{position:c}=this.getViewPositionAndLocation(),u=l.currentX-l.startX,p=c===1?s-u:s+u;if(p<XT.SESSIONS_SIDEBAR_SNAP_THRESHOLD){this.updateConfiguredSessionsViewerOrientation("stacked");return}this.sessionsViewerSidebarWidth=this.computeEffectiveSideBySideSessionsSidebarWidth(this.lastDimensions.width,p),this.viewState.sessionsSidebarWidth=this.sessionsViewerSidebarWidth,this.layoutBody(this.lastDimensions.height,this.lastDimensions.width)})),n.add(r.onDidReset(()=>{this.sessionsViewerSidebarWidth=XT.SESSIONS_SIDEBAR_DEFAULT_WIDTH,this.viewState.sessionsSidebarWidth=this.sessionsViewerSidebarWidth,this.relayout()}))}saveState(){this._widget?.viewModel&&(this._widget.saveState(),this.updateViewState(),this.memento.saveMemento()),super.saveState()}updateViewState(e){let t=e??this._widget.getViewState();if(t)for(let[o,n]of Object.entries(t))this.viewState[o]=n}shouldShowWelcome(){let e=!this.chatService.hasSessions(),t=this.chatAgentService.getAgents().some(r=>r.isCore&&r.locations.includes("panel")),o=this.chatAgentService.getDefaultAgent("panel")!==void 0,n=!t&&(!o||!this._widget?.viewModel&&e);return this.logService.trace(`ChatViewPane#shouldShowWelcome() = ${n}: hasCoreAgent=${t} hasDefaultAgent=${o} || noViewModel=${!this._widget?.viewModel} && noPersistedSessions=${e}`),!!n}getMatchingWelcomeView(){return this.welcomeController?.getMatchingWelcomeView()}getActionsContext(){return this._widget?.viewModel?{sessionResource:this._widget.viewModel.sessionResource,$mid:19}:void 0}};XT=I([m(1,_e),m(2,Xe),m(3,B),m(4,X),m(5,Bi),m(6,F),m(7,Je),m(8,Le),m(9,nt),m(10,ce),m(11,mi),m(12,cr),m(13,se),m(14,Ne),m(15,yi),m(16,Us),m(17,Te),m(18,ji),m(19,Fo),m(20,md),m(21,rr),m(22,ge),m(23,Sl),m(24,At),m(25,Zt)],XT);var Rcn=Ae("chat-view-icon",R.chatSparkle,d(7119,null)),Ist=ne.as(Mn.ViewContainersRegistry).registerViewContainer({id:l4,title:L(7096,"Chat"),icon:Rcn,ctorDescriptor:new Ft(Dc,[l4,{mergeViewWithContainerWhenSingleView:!0}]),storageId:l4,hideIfEmpty:!0,order:1},2,{isDefault:!0,doNotRegisterOpenCommand:!0}),Mcn={id:Dr,containerIcon:Ist.icon,containerTitle:Ist.title.value,singleViewPaneContainerTitle:Ist.title.value,name:L(7096,"Chat"),canToggleVisibility:!1,canMoveView:!0,openCommandActionDescriptor:{id:l4,title:Ist.title,mnemonicTitle:d(7120,null),keybindings:{primary:2599,mac:{primary:2343}},order:1},ctorDescriptor:new Ft(XT),when:C.or(C.or(ie.Setup.hidden,ie.Setup.disabled)?.negate(),ie.panelParticipantRegistered,ie.extensionInvalid)};ne.as(Mn.ViewsRegistry).registerViews([Mcn],Ist);var Pcn=Rn.registerExtensionPoint({extensionPoint:"chatParticipants",jsonSchema:{description:d(7126,null),type:"array",items:{additionalProperties:!1,type:"object",defaultSnippets:[{body:{name:"",description:""}}],required:["name","id"],properties:{id:{description:d(7114,null),type:"string"},name:{description:d(7115,null),type:"string",pattern:"^[\\w-]+$"},fullName:{markdownDescription:d(7113,null,"`name`"),type:"string"},description:{description:d(7108,null),type:"string"},isSticky:{description:d(7105,null),type:"boolean"},sampleRequest:{description:d(7118,null),type:"string"},when:{description:d(7117,null),type:"string"},disambiguation:{description:d(7109,null),type:"array",items:{additionalProperties:!1,type:"object",defaultSnippets:[{body:{category:"",description:"",examples:[]}}],required:["category","description","examples"],properties:{category:{markdownDescription:d(7110,null),type:"string"},description:{description:d(7111,null),type:"string"},examples:{description:d(7112,null),type:"array"}}}},commands:{markdownDescription:d(7104,null),type:"array",items:{additionalProperties:!1,type:"object",defaultSnippets:[{body:{name:"",description:""}}],required:["name"],properties:{name:{description:d(7097,null),type:"string"},description:{description:d(7098,null),type:"string"},when:{description:d(7106,null),type:"string"},sampleRequest:{description:d(7103,null),type:"string"},isSticky:{description:d(7105,null),type:"boolean"},disambiguation:{description:d(7099,null),type:"array",items:{additionalProperties:!1,type:"object",defaultSnippets:[{body:{category:"",description:"",examples:[]}}],required:["category","description","examples"],properties:{category:{markdownDescription:d(7100,null),type:"string"},description:{description:d(7101,null),type:"string"},examples:{description:d(7102,null),type:"array"}}}}}}}}}},activationEventsGenerator:function*(a){for(let i of a)yield`onChatParticipant:${i.id}`}}),Pfe=class{constructor(i){this._chatAgentService=i;this._participantRegistrationDisposables=new Vt;this.handleAndRegisterChatExtensions()}static{this.ID="workbench.contrib.chatExtensionPointHandler"}handleAndRegisterChatExtensions(){Pcn.setHandler((i,e)=>{for(let t of e.added)for(let o of t.value){if(!o.name?.match(/^[\w-]+$/)){t.collector.error(`Extension '${t.description.identifier.value}' CANNOT register participant with invalid name: ${o.name}. Name must match /^[\\w-]+$/.`);continue}if(o.fullName&&O9.getInstance(new Set).containsAmbiguousCharacter(o.fullName)){t.collector.error(`Extension '${t.description.identifier.value}' CANNOT register participant with fullName that contains ambiguous characters: ${o.fullName}.`);continue}if(o.fullName&&uV.containsInvisibleCharacter(o.fullName.replace(/ /g,""))){t.collector.error(`Extension '${t.description.identifier.value}' CANNOT register participant with fullName that contains invisible characters: ${o.fullName}.`);continue}if((o.isDefault||o.modes)&&!Ua(t.description,"defaultChatParticipant")){t.collector.error(`Extension '${t.description.identifier.value}' CANNOT use API proposal: defaultChatParticipant.`);continue}if(o.locations&&!Ua(t.description,"chatParticipantAdditions")){t.collector.error(`Extension '${t.description.identifier.value}' CANNOT use API proposal: chatParticipantAdditions.`);continue}if(!o.id||!o.name){t.collector.error(`Extension '${t.description.identifier.value}' CANNOT register participant without both id and name.`);continue}let n=[];o.disambiguation?.length&&n.push(...o.disambiguation.map(r=>({...r,category:r.category??r.categoryName})));try{let r=new N;r.add(this._chatAgentService.registerAgent(o.id,{extensionId:t.description.identifier,extensionVersion:t.description.version,publisherDisplayName:t.description.publisherDisplayName??t.description.publisher,extensionPublisherId:t.description.publisher,extensionDisplayName:t.description.displayName??t.description.name,id:o.id,description:o.description,when:o.when,metadata:{isSticky:o.isSticky,sampleRequest:o.sampleRequest},name:o.name,fullName:o.fullName,isDefault:o.isDefault,locations:yr(o.locations)?o.locations.map(ks.fromRaw):["panel"],modes:o.isDefault?o.modes??["ask"]:["agent","ask","edit"],slashCommands:o.commands??[],disambiguation:di(n.flat())})),this._participantRegistrationDisposables.set(XCo(t.description.identifier,o.id),r)}catch(r){t.collector.error(`Failed to register participant ${o.id}: ${xn(r,!0)}`)}}for(let t of e.removed)for(let o of t.value)this._participantRegistrationDisposables.deleteAndDispose(XCo(t.description.identifier,o.id))})}};Pfe=I([m(0,cr)],Pfe);function XCo(a,i){return`${a.value}_${i}`}var Afe=class extends x{constructor(e,t,o){super();this.productService=o;this.registeredWelcomeView=!1;let n=ie.extensionInvalid.bindTo(t);this._register(U.runAndSubscribe(e.onDidChangeExtensionsNotification,()=>{let s=e.getExtensionsNotification()?.extensions.find(l=>Ii.equals(l.identifier.id,this.productService.defaultChatAgent?.chatExtensionId));s?(n.set(!0),this.registerWelcomeView(s)):n.set(!1)}))}static{this.ID="workbench.contrib.chatCompatNotifier"}registerWelcomeView(e){if(this.registeredWelcomeView)return;this.registeredWelcomeView=!0;let t=d(7125,null),o=d(7107,null,this.productService.nameLong),n=`[${t}](${fc(LPe,[this.productService.defaultChatAgent?.chatExtensionId])})`,r=`Copilot Chat version: ${e.version}`,s=ne.as(Mn.ViewsRegistry);this._register(s.registerViewWelcomeContent(Dr,{content:[o,n,r].join(`

`),when:ie.extensionInvalid}))}};Afe=I([m(0,Hi),m(1,X),m(2,tt)],Afe);var rNi=class extends x{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.chatParticipants}render(e){let t=e.contributes?.chatParticipants?.filter(r=>!r.isDefault)??[];if(!t.length)return{data:{headers:[],rows:[]},dispose:()=>{}};let o=[d(7124,null),d(7123,null),d(7122,null),d(7121,null)],n=t.map(r=>["@"+r.name,r.fullName,r.description??"-",r.commands?.length?new Ie(r.commands.map(s=>"- /"+s.name).join(`
`)):"-"]);return{data:{headers:o,rows:n},dispose:()=>{}}}};ne.as(As.ExtensionFeaturesRegistry).registerExtensionFeature({id:"chatParticipants",label:d(7116,null),access:{canToggle:!1},renderer:new Ft(rNi)});var hVe=class extends x{constructor(e,t,o){super();this.quickInputService=e;this.chatService=t;this.instantiationService=o;this._onDidClose=this._register(new E)}get onDidClose(){return this._onDidClose.event}get enabled(){return!!this.chatService.isEnabled("panel")}get focused(){let e=this._input?.widget;return e?Gr(e):!1}get sessionResource(){return this._input&&this._currentChat?.sessionResource}toggle(e){if(this.focused&&!e?.query)this.close();else if(this.open(e),e?.isPartialQuery){let t=this._store.add(U.once(this.onDidClose)(()=>{this._currentChat?.clearValue(),this._store.delete(t)}))}}open(e){if(this._input){if(this._currentChat&&e?.query){this._currentChat.focus(),this._currentChat.setValue(e.query,e.selection),e.isPartialQuery||this._currentChat.acceptInput();return}return this.focus()}let t=new N;this._input=this.quickInputService.createQuickWidget(),this._input.contextKey="chatInputVisible",this._input.ignoreFocusOut=!0,t.add(this._input),this._container??=_(".interactive-session"),this._input.widget=this._container,this._input.show(),this._currentChat?this._currentChat.show():(this._currentChat=this.instantiationService.createInstance(Koe),this._currentChat.render(this._container)),t.add(this._input.onDidHide(()=>{t.dispose(),this._currentChat.hide(),this._input=void 0,this._onDidClose.fire()})),this._currentChat.focus(),e?.query&&(this._currentChat.setValue(e.query,e.selection),e.isPartialQuery||this._currentChat.acceptInput())}focus(){this._currentChat?.focus()}close(){this._input?.dispose(),this._input=void 0}async openInChatView(){await this._currentChat?.openChatView(),this.close()}};hVe=I([m(0,Ue),m(1,mi),m(2,F)],hVe);var Koe=class extends x{constructor(e,t,o,n,r,s,l){super();this.instantiationService=e;this.contextKeyService=t;this.chatService=o;this.layoutService=n;this.chatWidgetService=r;this.chatEntitlementService=s;this.markdownRendererService=l;this.maintainScrollTimer=this._register(new me);this._deferUpdatingDynamicLayout=!1}static{this.DEFAULT_MIN_HEIGHT=200}static{this.DEFAULT_HEIGHT_OFFSET=100}get sessionResource(){return this.modelRef?.object.sessionResource}clear(){return this.modelRef?.dispose(),this.modelRef=void 0,this.updateModel(),this.widget.inputEditor.setValue(""),Promise.resolve()}focus(e){if(this.widget){this.widget.focusInput();let t=this.widget.inputEditor.getValue();t&&this.widget.inputEditor.setSelection(e??{startLineNumber:1,startColumn:1,endLineNumber:1,endColumn:t.length+1})}}hide(){this.widget.setVisible(!1),this.maintainScrollTimer.value=tn(()=>{this.maintainScrollTimer.clear()},30*1e3)}show(){this.widget.setVisible(!0),this._deferUpdatingDynamicLayout&&(this._deferUpdatingDynamicLayout=!1,this.widget.updateDynamicChatTreeItemLayout(2,this.maxHeight)),this.maintainScrollTimer.value||this.widget.layoutDynamicChatTreeItemMode()}render(e){if(this.widget)throw new Error("Cannot render quick chat twice");let t=this._register(this.instantiationService.createChild(new _o([X,this._register(this.contextKeyService.createScoped(e))])));this.widget=this._register(t.createInstance(kI,"panel",{isQuickChat:!0},{autoScroll:!0,renderInputOnTop:!0,renderStyle:"compact",menus:{inputSideToolbar:D.ChatInputSide,telemetrySource:"chatQuick"},enableImplicitContext:!0,defaultMode:Tl.Ask,clear:()=>this.clear()},{listForeground:Qvt,listBackground:Gye,overlayBackground:oT,inputEditorBackground:yv,resultEditorBackground:Ho})),this.widget.render(e),this.widget.setVisible(!0),this.widget.setDynamicChatTreeItemLayout(2,this.maxHeight),this.updateModel(),this.sash=this._register(new Jh(e,{getHorizontalSashTop:()=>e.offsetHeight},{orientation:1})),this.setupDisclaimer(e),this.registerListeners(e)}setupDisclaimer(e){let t=M(e,_(".disclaimer.hidden")),o=this._store.add(new N);this._register(be(n=>{o.clear(),vi(t);let r=this.chatEntitlementService.sentimentObs.read(n),s=this.chatEntitlementService.anonymousObs.read(n),l=this.chatService.requestInProgressObs.read(n),c=!r.installed&&s&&!l;if(t.classList.toggle("hidden",!c),c){let u=o.add(this.markdownRendererService.render(new Ie(d(8083,null,ro.defaultChatAgent?.provider?.default?.name??"",ro.defaultChatAgent?.provider?.default?.name??"",ro.defaultChatAgent?.termsStatementUrl??"",ro.defaultChatAgent?.privacyStatementUrl??""),{isTrusted:!0})));t.appendChild(u.element)}}))}get maxHeight(){return this.layoutService.mainContainerDimension.height-Koe.DEFAULT_HEIGHT_OFFSET}registerListeners(e){this._register(this.layoutService.onDidLayoutMainContainer(()=>{this.widget.visible?this.widget.updateDynamicChatTreeItemLayout(2,this.maxHeight):this._deferUpdatingDynamicLayout=!0})),this._register(this.widget.onDidChangeHeight(o=>this.sash.layout()));let t=e.offsetWidth;this._register(this.sash.onDidStart(()=>{this.widget.isDynamicChatTreeItemLayoutEnabled=!1})),this._register(this.sash.onDidChange(o=>{o.currentY<Koe.DEFAULT_MIN_HEIGHT||o.currentY>this.maxHeight||(this.widget.layout(o.currentY,t),this.sash.layout())})),this._register(this.sash.onDidReset(()=>{this.widget.isDynamicChatTreeItemLayoutEnabled=!0,this.widget.layoutDynamicChatTreeItemMode()}))}async acceptInput(){return this.widget.acceptInput()}async openChatView(){let e=await this.chatWidgetService.revealWidget(),t=this.modelRef?.object;if(!e?.viewModel||!t)return;for(let n of t.getRequests())if(n.response?.response.value||n.response?.result){let r=[];for(let s of n.response.response.value)if(s.kind==="textEditGroup")for(let l of s.edits)r.push({kind:"textEdit",edits:l,uri:s.uri});else if(s.kind==="notebookEditGroup")for(let l of s.edits)UDe(l)?r.push({kind:"textEdit",edits:l.map(c=>c.edit),uri:l[0].uri}):r.push({kind:"notebookEdit",edits:l,uri:s.uri});else r.push(s);this.chatService.addCompleteRequest(e.viewModel.sessionResource,n.message,n.variableData,n.attempt,{message:r,result:n.response.result,followups:n.response.followups})}else n.message;let o=this.widget.getViewState();o&&e.viewModel.model.inputModel.setState(o),e.focusInput()}setValue(e,t){this.widget.inputEditor.setValue(e),this.focus(t)}clearValue(){this.widget.inputEditor.setValue("")}updateModel(){this.modelRef??=this.chatService.startNewLocalSession("panel",{disableBackgroundKeepAlive:!0});let e=this.modelRef?.object;if(!e)throw new Error("Could not start chat session");this.modelRef.object.inputModel.setState({inputText:"",selections:[]}),this.widget.setModel(e)}dispose(){this.modelRef?.dispose(),this.modelRef=void 0,super.dispose()}};Koe=I([m(0,F),m(1,X),m(2,mi),m(3,yi),m(4,Pt),m(5,rr),m(6,On)],Koe);var e$t=class{constructor(){this.priority=115;this.name="chatTerminalOutput";this.type="view";this.when=ie.inChatTerminalToolOutput}getProvider(i){let t=i.get(Wv).getFocusedProgressPart();if(!t)return;let o=t.getCommandAndOutputAsText();if(o)return new xp("chatTerminalOutput",{type:"view",id:"chatTerminalOutput",language:"text"},()=>o,()=>t.focusOutput(),"accessibility.verbosity.terminalChatOutput")}};var gVe={completionsRefreshTokenCommand:ro.defaultChatAgent?.completionsRefreshTokenCommand??"",chatRefreshTokenCommand:ro.defaultChatAgent?.chatRefreshTokenCommand??"",providerExtensionId:ro.defaultChatAgent?.providerExtensionId??""};function yst(a){a.executeCommand(gVe.completionsRefreshTokenCommand),a.executeCommand(gVe.chatRefreshTokenCommand)}async function t$t(a,i){if(!gVe.providerExtensionId)return!1;let e=a.local.find(t=>Ii.equals(t.identifier.id,gVe.providerExtensionId));if(!e)return!1;if(e.enablementState===10||e.enablementState===11){i.info(`[chat setup] auth provider extension '${gVe.providerExtensionId}' is disabled, re-enabling it`);try{return await a.setEnablement([e],12),await a.updateRunningExtensions(d(7179,null)),!0}catch(t){return i.error(`[chat setup] failed to re-enable auth provider extension '${gVe.providerExtensionId}'`,t),!1}}return!1}var lL={chatExtensionId:ro.defaultChatAgent?.chatExtensionId??"",provider:ro.defaultChatAgent?.provider??{default:{id:"",name:""},enterprise:{id:"",name:""},apple:{id:"",name:""},google:{id:"",name:""}},providerUriSetting:ro.defaultChatAgent?.providerUriSetting??"",completionsAdvancedSetting:ro.defaultChatAgent?.completionsAdvancedSetting??""},fVe=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super();this.context=e;this.requests=t;this.telemetryService=o;this.extensionsWorkbenchService=n;this.productService=r;this.logService=s;this.progressService=l;this.activityService=c;this.commandService=u;this.dialogService=p;this.configurationService=h;this.lifecycleService=g;this.quickInputService=f;this.defaultAccountService=v;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._step=1;this.registerListeners()}get step(){return this._step}registerListeners(){this._register(this.context.onDidChange(()=>this._onDidChange.fire()))}setStep(e){this._step!==e&&(this._step=e,this._onDidChange.fire())}async setup(e={}){let t=new Dn(!1),o=d(7199,null),n=this.activityService.showViewContainerActivity(l4,{badge:new sx(()=>o)});try{return await this.progressService.withProgress({location:10,command:lx,title:o},()=>this.doSetup(e,t))}finally{n.dispose()}}async doSetup(e,t){this.context.suspend();let o=!1;try{let n,r;if(e.forceSignIn?r=!0:this.context.state.entitlement===1?e.forceAnonymous?r=!1:r=!0:r=!1,r){this.setStep(2);let s=await this.signIn(e);if(!s.defaultAccount){this.doInstall();let l=e.useSocialProvider??(e.useEnterpriseProvider?lL.provider.enterprise.id:lL.provider.default.id);this.telemetryService.publicLog2("commandCenter.chatInstall",{installResult:"failedNotSignedIn",installDuration:t.elapsed(),signUpErrorCode:void 0,provider:l});return}n=s.entitlement}this.setStep(3),o=await this.install(n??this.context.state.entitlement,t,e)}finally{this.setStep(1),this.context.resume()}return o}async signIn(e){await t$t(this.extensionsWorkbenchService,this.logService)&&yst(this.commandService);let o,n;try{({defaultAccount:n,entitlements:o}=await this.requests.signIn(e))}catch(r){this.logService.error(`[chat setup] signIn: error ${r}`)}if(!n&&!this.lifecycleService.willShutdown){let{confirmed:r}=await this.dialogService.confirm({type:bt.Error,message:d(7201,null,this.defaultAccountService.getDefaultAccountAuthenticationProvider().name),detail:d(7202,null),primaryButton:d(7198,null)});if(r)return this.signIn(e)}return{defaultAccount:n,entitlement:o?.entitlement}}async install(e,t,o){let n=this.context.state.installed&&!this.context.state.disabled,r,s;o.forceAnonymous&&e===1?s="anonymous":s=o.useSocialProvider??(o.useEnterpriseProvider?lL.provider.enterprise.id:lL.provider.default.id);try{if(!o.forceAnonymous&&e!==5&&!AF(e)&&e!==4){if(r=await this.requests.signUpFree(),gn(r))return this.telemetryService.publicLog2("commandCenter.chatInstall",{installResult:"failedNoSession",installDuration:t.elapsed(),signUpErrorCode:void 0,provider:s}),!1;typeof r!="boolean"&&this.telemetryService.publicLog2("commandCenter.chatInstall",{installResult:"failedSignUp",installDuration:t.elapsed(),signUpErrorCode:r.errorCode,provider:s})}await this.doInstallWithRetry()}catch(l){return this.logService.error(`[chat setup] install: error ${l}`),this.telemetryService.publicLog2("commandCenter.chatInstall",{installResult:ao(l)?"cancelled":"failedInstall",installDuration:t.elapsed(),signUpErrorCode:void 0,provider:s}),!1}return(typeof r=="boolean"||typeof r>"u")&&this.telemetryService.publicLog2("commandCenter.chatInstall",{installResult:n&&!r?"alreadyInstalled":"installed",installDuration:t.elapsed(),signUpErrorCode:void 0,provider:s}),n&&yst(this.commandService),!0}async doInstallWithRetry(){let e;try{await this.doInstall()}catch(t){this.logService.error(`[chat setup] install: error ${e}`),e=t}if(e){if(!this.lifecycleService.willShutdown){let{confirmed:t}=await this.dialogService.confirm({type:bt.Error,message:d(7200,null),detail:e&&!ao(e)?xn(e):void 0,primaryButton:d(7198,null)});if(t)return this.doInstallWithRetry()}throw e}}async doInstall(){await this.extensionsWorkbenchService.install(lL.chatExtensionId,{enable:!0,isApplicationScoped:!0,isMachineScoped:!1,installEverywhere:!0,installPreReleaseVersion:this.productService.quality!=="stable"},Dr)}async setupWithProvider(e){if(ne.as(Jt.Configuration).registerConfiguration({id:"copilot.setup",type:"object",properties:{[lL.completionsAdvancedSetting]:{type:"object",properties:{authProvider:{type:"string"}}},[lL.providerUriSetting]:{type:"string"}}}),e.useEnterpriseProvider){let n=await this.handleEnterpriseInstance();if(!n)return this.telemetryService.publicLog2("commandCenter.chatInstall",{installResult:"failedEnterpriseSetup",installDuration:0,signUpErrorCode:void 0,provider:void 0}),n}let o=this.configurationService.inspect(lL.completionsAdvancedSetting).user?.value;return xi(o)||(o={}),e.useEnterpriseProvider?await this.configurationService.updateValue(`${lL.completionsAdvancedSetting}`,{...o,authProvider:lL.provider.enterprise.id},2):await this.configurationService.updateValue(`${lL.completionsAdvancedSetting}`,Object.keys(o).length>0?{...o,authProvider:void 0}:void 0,2),this.setup({...e,forceSignIn:!0})}async handleEnterpriseInstance(){let e=/^[a-zA-Z\-_]+$/,t=/^(https:\/\/)?([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.ghe\.com\/?$/,o=this.configurationService.getValue(lL.providerUriSetting);if(typeof o=="string"&&t.test(o))return!0;let n=!1,r=await this.quickInputService.input({prompt:d(7195,null,lL.provider.enterprise.name),placeHolder:d(7196,null),ignoreFocusLost:!0,value:o,validateInput:async l=>{if(n=!1,!!l){if(e.test(l))return n=!0,{content:d(7203,null,`https://${l}.ghe.com`),severity:bt.Info};if(!t.test(l))return{content:d(7197,null,lL.provider.enterprise.name),severity:bt.Error}}}});if(!r)return;let s=r;return n?s=`https://${s}.ghe.com`:r.toLowerCase().startsWith("https://")||(s=`https://${r}`),await this.configurationService.updateValue(lL.providerUriSetting,s,2),!0}};fVe=I([m(2,Te),m(3,Hi),m(4,tt),m(5,se),m(6,Fo),m(7,Sl),m(8,ge),m(9,at),m(10,B),m(11,ji),m(12,Ue),m(13,ng)],fVe);var FW=class extends x{constructor(e,t,o,n){super();this.storageService=e;this.chatWidgetService=t;this.lifecycleService=o;this.logService=n;this._onDidChangeChatSessionItems=this._register(new E);this.onDidChangeChatSessionItems=this._onDidChangeChatSessionItems.event;this._onDidDismiss=this._register(new E);this.onDidDismiss=this._onDidDismiss.event;this._created=Date.now();this._dismissed=this.storageService.getBoolean(FW.STORAGE_KEY,-1,!1),this.lifecycleService.when(3).then(()=>{this._store.isDisposed||this._dismissed||this._register(this.chatWidgetService.onDidAddWidget(()=>{this.dismiss()}))})}static{this.STORAGE_KEY="chat.growthSession.dismissed"}static{this.SESSION_URI=A.from({scheme:"copilot-growth",path:"/growth-welcome"})}get isDismissed(){return this._dismissed}get items(){return this._dismissed?[]:[{resource:FW.SESSION_URI,label:d(7206,null),description:d(7205,null),status:3,iconPath:R.lightbulb,timing:{created:this._created,lastRequestStarted:void 0,lastRequestEnded:void 0}}]}async refresh(){}dismiss(){this._dismissed||(this.logService.trace("[GrowthSession] Dismissing growth session"),this._dismissed=!0,this.storageService.store(FW.STORAGE_KEY,!0,-1,0),this._onDidChangeChatSessionItems.fire({removed:[FW.SESSION_URI]}),this._onDidDismiss.fire())}};FW=I([m(0,ce),m(1,Pt),m(2,ji),m(3,se)],FW);var sNi=class{async handleOpenSession(i,e,t){if(e.providerType!=="copilot-growth")return!1;let o=i.get(ge),n={query:"",isPartialQuery:!0,previousRequests:[{request:d(7207,null),response:d(7208,null)}]};return await o.executeCommand(lx,n),!0}};function JCo(a,i){let e=new N;return e.add(a.registerChatSessionItemController("copilot-growth",i)),e.add(qRi.registerParticipant(new sNi)),e}W(class extends K{constructor(){super({id:"workbench.action.chat.resetGrowthSession",title:L(7209,"Reset Growth Session Notification"),category:L(7204,"Developer"),f1:!0})}run(i){i.get(ce).remove(FW.STORAGE_KEY,-1)}});var xN={publicCodeMatchesUrl:ro.defaultChatAgent?.publicCodeMatchesUrl??"",provider:ro.defaultChatAgent?.provider??{default:{id:"",name:""},enterprise:{id:"",name:""},apple:{id:"",name:""},google:{id:"",name:""}},manageSettingsUrl:ro.defaultChatAgent?.manageSettingsUrl??"",completionsRefreshTokenCommand:ro.defaultChatAgent?.completionsRefreshTokenCommand??"",chatRefreshTokenCommand:ro.defaultChatAgent?.chatRefreshTokenCommand??"",termsStatementUrl:ro.defaultChatAgent?.termsStatementUrl??"",privacyStatementUrl:ro.defaultChatAgent?.privacyStatementUrl??""},kN=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h){this.context=i;this.controller=e;this.telemetryService=t;this.layoutService=o;this.keybindingService=n;this.chatEntitlementService=r;this.logService=s;this.widgetService=l;this.workspaceTrustRequestService=c;this.markdownRendererService=u;this.defaultAccountService=p;this.hostService=h;this.pendingRun=void 0;this.skipDialogOnce=!1}static{this.instance=void 0}static getInstance(i,e,t){let o=kN.instance;return o||(o=kN.instance=i.invokeFunction(n=>new kN(e,t,n.get(Te),n.get(yi),n.get(_e),n.get(rr),n.get(se),n.get(Pt),n.get(Vu),n.get(On),n.get(ng),n.get(Zt)))),o}skipDialog(){this.skipDialogOnce=!0}async run(i){if(this.pendingRun)return this.pendingRun;this.pendingRun=this.doRun(i);try{return await this.pendingRun}finally{this.pendingRun=void 0}}async doRun(i){this.context.update({later:!1});let e=this.skipDialogOnce;if(this.skipDialogOnce=!1,!await this.workspaceTrustRequestService.requestWorkspaceTrust({message:d(7232,null)}))return this.context.update({later:!0}),this.telemetryService.publicLog2("commandCenter.chatInstall",{installResult:"failedNotTrusted",installDuration:0,signUpErrorCode:void 0,provider:void 0}),{dialogSkipped:e,success:void 0};let o;!i?.forceSignInDialog&&(e||AF(this.chatEntitlementService.entitlement)||this.chatEntitlementService.entitlement===5)?o=1:i?.forceAnonymous===2?o=1:o=await this.showDialog(i),o===1&&this.defaultAccountService.getDefaultAccountAuthenticationProvider().enterprise&&(o=3),o!==0&&!i?.disableChatViewReveal&&this.widgetService.revealWidget();let n;try{switch(o){case 3:n=await this.controller.value.setupWithProvider({useEnterpriseProvider:!0,useSocialProvider:void 0,additionalScopes:i?.additionalScopes,forceAnonymous:i?.forceAnonymous});break;case 2:n=await this.controller.value.setupWithProvider({useEnterpriseProvider:!1,useSocialProvider:void 0,additionalScopes:i?.additionalScopes,forceAnonymous:i?.forceAnonymous});break;case 5:n=await this.controller.value.setupWithProvider({useEnterpriseProvider:!1,useSocialProvider:"apple",additionalScopes:i?.additionalScopes,forceAnonymous:i?.forceAnonymous});break;case 4:n=await this.controller.value.setupWithProvider({useEnterpriseProvider:!1,useSocialProvider:"google",additionalScopes:i?.additionalScopes,forceAnonymous:i?.forceAnonymous});break;case 1:n=await this.controller.value.setup({...i,forceAnonymous:i?.forceAnonymous});break;case 0:this.context.update({later:!0}),this.telemetryService.publicLog2("commandCenter.chatInstall",{installResult:"failedMaybeLater",installDuration:0,signUpErrorCode:void 0,provider:void 0});break}}catch(r){this.logService.error(`[chat setup] Error during setup: ${xn(r)}`),n=!1}return{success:n,dialogSkipped:e}}async showDialog(i){let e=new N,t=this.getButtons(i),o=e.add(new hee(this.layoutService.activeContainer,this.getDialogTitle(i),t.map(r=>r[0]),DRe({type:"none",extraClasses:["chat-setup-dialog"],detail:" ",icon:i?.dialogIcon??R.copilotLarge,alignment:1,cancelId:t.length,disableCloseButton:!1,renderFooter:r=>r.appendChild(this.createDialogFooter(e,i)),buttonOptions:t.map(r=>r[2])},this.keybindingService,this.layoutService,this.hostService))),{button:n}=await o.show();return e.dispose(),t[n]?.[1]??0}getButtons(i){let e=(...o)=>({styleButton:n=>n.element.classList.add(...o)}),t;if(!i?.forceAnonymous&&(this.context.state.entitlement===1||i?.forceSignInDialog)){let o=[d(7233,null,xN.provider.default.name),2,e("continue-button","default")],n=[o[0],o[1],e("link-button")],r=[d(7233,null,xN.provider.enterprise.name),3,e("continue-button","default")],s=[r[0],r[1],e("link-button")],l=[d(7233,null,xN.provider.google.name),4,e("continue-button","google")],c=[d(7233,null,xN.provider.apple.name),5,e("continue-button","apple")];this.defaultAccountService.getDefaultAccountAuthenticationProvider().enterprise?t=di([r,l,c,n]):t=di([o,l,c,s])}else t=[[d(7237,null),1,void 0]];return t}getDialogTitle(i){return i?.dialogTitle?i.dialogTitle:this.chatEntitlementService.anonymous?i?.forceAnonymous?d(7239,null):d(7234,null):this.context.state.entitlement===1||i?.forceSignInDialog?d(7238,null):d(7239,null)}createDialogFooter(i,e){let t=_(".chat-setup-dialog-footer"),o;return e?.forceAnonymous||this.telemetryService.telemetryLevel===0?o=d(7236,null,xN.provider.default.name,xN.termsStatementUrl,xN.privacyStatementUrl):o=d(7235,null,xN.provider.default.name,xN.termsStatementUrl,xN.privacyStatementUrl,xN.provider.default.name,xN.publicCodeMatchesUrl,xN.manageSettingsUrl),t.appendChild(_("p",void 0,i.add(this.markdownRendererService.render(new Ie(o,{isTrusted:!0}))).element)),t}};kN=I([m(2,Te),m(3,Kl),m(4,_e),m(5,rr),m(6,se),m(7,Pt),m(8,Vu),m(9,On),m(10,ng),m(11,Zt)],kN);var zM={extensionId:ro.defaultChatAgent?.extensionId??"",chatExtensionId:ro.defaultChatAgent?.chatExtensionId??"",provider:ro.defaultChatAgent?.provider??{default:{id:"",name:""},enterprise:{id:"",name:""},apple:{id:"",name:""},google:{id:"",name:""}},outputChannelId:ro.defaultChatAgent?.chatExtensionOutputId??"",outputExtensionStateCommand:ro.defaultChatAgent?.chatExtensionOutputExtensionStateCommand??""},Ncn=C.and(C.equals("config.chat.agent.enabled",!0),C.not("previewFeaturesDisabled")),zb=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super();this.context=e;this.controller=t;this.location=o;this.instantiationService=n;this.logService=r;this.telemetryService=s;this.environmentService=l;this.workspaceTrustManagementService=c;this.chatEntitlementService=u;this.viewsService=p;this.contextKeyService=h;this.outputService=g;this.extensionsWorkbenchService=f;this.commandService=v;this._onUnresolvableError=this._register(new E);this.onUnresolvableError=this._onUnresolvableError.event;this.pendingForwardedRequests=new gt;this.registerCommands()}static registerDefaultAgents(e,t,o,n,r){return e.invokeFunction(s=>{let l=s.get(cr),c;o==="ask"?c=Tl.Ask.description.get():o==="edit"?c=Tl.Edit.description.get():c=Tl.Agent.description.get();let u;switch(t){case"panel":o==="ask"?u="setup.chat":o==="edit"?u="setup.edits":u="setup.agent";break;case"terminal":u="setup.terminal";break;case"editor":u="setup.editor";break;case"notebook":u="setup.notebook";break}return zb.doRegisterAgent(e,l,u,`${zM.provider.default.name} Copilot`,!0,c,t,o,n,r)})}static registerBuiltInAgents(e,t,o){return e.invokeFunction(n=>{let r=n.get(cr),s=new N,{disposable:l}=zb.doRegisterAgent(e,r,"setup.vscode","vscode",!1,L(7228,"Ask questions about VS Code").value,"panel","agent",t,o);s.add(l);let{disposable:c}=zb.doRegisterAgent(e,r,"setup.workspace","workspace",!1,L(7231,"Ask about your workspace").value,"panel","agent",t,o);s.add(c);let{disposable:u}=zb.doRegisterAgent(e,r,"setup.terminal.agent","terminal",!1,L(7226,"Ask how to do something in the terminal").value,"panel","agent",t,o);return s.add(u),s.add(aNi.registerTool(e,{id:"setup_tools_createNewWorkspace",source:kn.Internal,icon:R.newFolder,displayName:d(7223,null),modelDescription:"Scaffold a new workspace in VS Code",userDescription:d(7224,null),canBeReferencedInPrompt:!0,toolReferenceName:"new",when:C.true()})),s})}static doRegisterAgent(e,t,o,n,r,s,l,c,u,p){let h=new N;h.add(t.registerAgent(o,{id:o,name:n,isDefault:r,isCore:!0,modes:[c],when:c==="agent"?Ncn?.serialize():void 0,slashCommands:[],disambiguation:[],locations:[l],metadata:{helpTextPrefix:zb.SETUP_NEEDED_MESSAGE},description:s,extensionId:WTt.identifier,extensionVersion:void 0,extensionDisplayName:WTt.name,extensionPublisherId:WTt.publisher}));let g=h.add(e.createInstance(zb,u,p,l));return h.add(t.registerAgentImplementation(o,g)),c==="agent"&&t.updateAgent(o,{themeIcon:R.tools}),{agent:g,disposable:h}}static{this.SETUP_NEEDED_MESSAGE=new Ie(d(7221,null))}static{this.TRUST_NEEDED_MESSAGE=new Ie(d(7227,null))}static{this.CHAT_RETRY_COMMAND_ID="workbench.action.chat.retrySetup"}static{this.CHAT_SHOW_OUTPUT_COMMAND_ID="workbench.action.chat.showOutput"}registerCommands(){this._register($e.registerCommand(zb.CHAT_RETRY_COMMAND_ID,async(e,t)=>{let o=e.get(Zt);await e.get(Pt).getWidgetBySessionResource(t)?.clear(),o.reload()})),this._register($e.registerCommand(zb.CHAT_SHOW_OUTPUT_COMMAND_ID,async e=>{let t=e.get(ge);zM.outputExtensionStateCommand&&vp(t.executeCommand(zM.outputExtensionStateCommand),5e3,()=>this.logService.info("[chat setup] Timed out executing extension state command")).then(void 0,o=>{this.logService.info("[chat setup] Failed to execute extension state command",o)}),zM.outputChannelId&&await t.executeCommand(`workbench.action.output.show.${zM.outputChannelId}`)}))}async invoke(e,t){return this.instantiationService.invokeFunction(async o=>{let n=o.get(mi),r=o.get(ds),s=o.get(Pt),l=o.get(cr),c=o.get(Vn),u=o.get(ng);return this.doInvoke(e,p=>t([p]),n,r,s,l,c,u)})}async doInvoke(e,t,o,n,r,s,l,c){return!this.context.state.installed||this.context.state.disabled||this.context.state.untrusted||this.context.state.entitlement===3||this.context.state.entitlement===1&&!this.chatEntitlementService.anonymous?this.doInvokeWithSetup(e,t,o,n,r,s,l,c):this.doInvokeWithoutSetup(e,t,o,n,r,s,l)}async doInvokeWithoutSetup(e,t,o,n,r,s,l){let c=r.getWidgetBySessionResource(e.sessionResource)?.viewModel?.model.getRequests().at(-1);return c?(t({kind:"progressMessage",content:new Ie(d(7229,null)),shimmer:!0}),await this.forwardRequestToChat(c,t,o,n,s,r,l),{}):(this.logService.error("[chat setup] Request model not found, cannot redispatch request."),{})}async forwardRequestToChat(e,t,o,n,r,s,l){try{await this.doForwardRequestToChat(e,t,o,n,r,s,l)}catch(c){this.logService.error("[chat setup] Failed to forward request to chat",c),t({kind:"warning",content:new Ie(d(7214,null))})}}async doForwardRequestToChat(e,t,o,n,r,s,l){if(this.pendingForwardedRequests.has(e.session.sessionResource))throw new Error("Request already in progress");let c=this.doForwardRequestToChatWhenReady(e,t,o,n,r,s,l);this.pendingForwardedRequests.set(e.session.sessionResource,c);try{await c}finally{this.pendingForwardedRequests.delete(e.session.sessionResource)}}async doForwardRequestToChatWhenReady(e,t,o,n,r,s,l){await t$t(this.extensionsWorkbenchService,this.logService)&&yst(this.commandService);let u=s.getWidgetBySessionResource(e.session.sessionResource),p=u?.input.currentModeInfo,h=!1,g=!1,f=!1,v=!1;Shi(bhi.WillWaitForActivation);let b=this.whenAgentActivated(o).then(()=>h=!0),S=this.whenAgentReady(r,p?.kind)?.then(()=>g=!0);S||(g=!0);let y=this.whenLanguageModelReady(n,e.modelId)?.then(()=>f=!0);y||(f=!0);let w=this.whenToolsModelReady(l,e)?.then(()=>v=!0);if(w||(v=!0),y instanceof Promise||S instanceof Promise||w instanceof Promise){let k=setTimeout(()=>{t({kind:"progressMessage",content:new Ie(d(7230,null)),shimmer:!0})},1e4),T=new N;T.add(Z(()=>clearTimeout(k)));try{let P=await Promise.race([Li(this.environmentService.remoteAuthority?6e4:2e4).then(()=>"timedout"),this.whenPanelAgentHasGuidance(T).then(()=>"panelGuidance"),Promise.allSettled([b,S,y,w])]);if(P==="panelGuidance"){let O=d(7213,null);t({kind:"markdownContent",content:new Ie(O)}),this._onUnresolvableError.fire();return}if(P==="timedout"){let O;this.chatEntitlementService.anonymous?O=d(7212,null,zM.chatExtensionId):O=d(7211,null,zM.provider.default.name,zM.chatExtensionId);let V=n.getLanguageModelIds(),H=0;for(let ze of V)n.lookupLanguageModel(ze)?.isDefaultForLocation.panel&&H++;let G=r.getDefaultAgent(this.location,p?.kind),$=!!G,J=G?.isCore??!1,ae=r.getContributedDefaultAgent(this.location),he=!!ae,oe=ae?.isCore??!1,de=r.getActivatedAgents().length;this.logService.warn(O,{agentActivated:h,agentReady:g,agentHasDefault:$,agentDefaultIsCore:J,agentHasContributedDefault:he,agentContributedDefaultIsCore:oe,agentActivatedCount:de,agentLocation:this.location,agentModeKind:p?.kind,languageModelReady:f,languageModelCount:V.length,languageModelDefaultCount:H,languageModelHasRequestedModel:!!e.modelId,toolsModelReady:v});let Ce=this.viewsService.getActiveViewWithId(Dr),xe=Ce?.getMatchingWelcomeView();this.telemetryService.publicLog2("chatSetup.timeout",{agentActivated:h,agentReady:g,agentHasDefault:$,agentDefaultIsCore:J,agentHasContributedDefault:he,agentContributedDefaultIsCore:oe,agentActivatedCount:de,agentLocation:this.location,agentModeKind:p?.kind??"",languageModelReady:f,languageModelCount:V.length,languageModelDefaultCount:H,languageModelHasRequestedModel:!!e.modelId,toolsModelReady:v,isRemote:!!this.environmentService.remoteAuthority,isAnonymous:this.chatEntitlementService.anonymous,matchingWelcomeViewWhen:xe?.when.serialize()??(Ce?"noWelcomeView":"noChatViewPane")}),t({kind:"warning",content:new Ie(O)}),zM.outputChannelId&&this.outputService.getChannelDescriptor(zM.outputChannelId)?t({kind:"command",command:{id:zb.CHAT_SHOW_OUTPUT_COMMAND_ID,title:d(7225,null)}}):(this.logService.warn(zM.outputChannelId?`[chat setup] No output channel found for id '${zM.outputChannelId}' to show details about chat setup timeout. Please ensure the ${zM.chatExtensionId} extension is activated.`:"[chat setup] No output channel provided via product.json to show details about chat setup timeout."),t({kind:"command",command:{id:zb.CHAT_RETRY_COMMAND_ID,title:d(7220,null),arguments:[e.session.sessionResource]}})),this._onUnresolvableError.fire();return}}finally{T.dispose()}}Shi(bhi.DidWaitForActivation),await o.resendRequest(e,{...u?.getModeRequestOptions(),modeInfo:p,userSelectedModelId:u?.input.currentLanguageModel})}async whenPanelAgentHasGuidance(e){let t=()=>tU.get().some(o=>this.contextKeyService.contextMatchesRules(o.when));if(!t())return new Promise(o=>{let n=new Set,r=()=>{let c=tU.get();n=new Set(c.flatMap(u=>u.when.keys()))};r();let s=U.map(tU.onDidChange,()=>"registry"),l=U.map(U.filter(this.contextKeyService.onDidChangeContext,c=>c.affectsSome(n)),()=>"context");e.add(U.any(s,l)(c=>{c==="registry"&&r(),t()&&o()}))})}whenLanguageModelReady(e,t){let o=()=>{if(t)return!!e.lookupLanguageModel(t);for(let n of e.getLanguageModelIds())if(e.lookupLanguageModel(n)?.isDefaultForLocation.panel)return!0;return!1};if(!o())return U.toPromise(U.filter(e.onDidChangeLanguageModels,()=>o()))}whenToolsModelReady(e,t){if(t.message.parts.some(n=>n instanceof dI)){for(let n of e.getAllToolsIncludingDisabled())if(n.id.startsWith("copilot_"))return;return U.toPromise(U.filter(e.onDidChangeTools,()=>{for(let n of e.getAllToolsIncludingDisabled())if(n.id.startsWith("copilot_"))return!0;return!1}))}}whenAgentReady(e,t){let o=e.getDefaultAgent(this.location,t);if(!(o&&!o.isCore))return U.toPromise(U.filter(e.onDidChangeAgents,()=>{let n=e.getDefaultAgent(this.location,t);return!!(n&&!n.isCore)}))}async whenAgentActivated(e){try{await e.activateDefaultAgent(this.location)}catch(t){this.logService.error(t)}}async doInvokeWithSetup(e,t,o,n,r,s,l,c){this.telemetryService.publicLog2("workbenchActionExecuted",{id:Ab,from:"chat"});let u=r.getWidgetBySessionResource(e.sessionResource),p=u?.viewModel?.model.getRequests().at(-1),h=U.runAndSubscribe(this.controller.value.onDidChange,(()=>{switch(this.controller.value.step){case 2:t({kind:"progressMessage",content:new Ie(d(7222,null,c.getDefaultAccountAuthenticationProvider().name)),shimmer:!0});break;case 3:t({kind:"progressMessage",content:new Ie(d(7218,null)),shimmer:!0});break}})),g;try{g=await kN.getInstance(this.instantiationService,this.context,this.controller).run({disableChatViewReveal:!0,forceAnonymous:this.chatEntitlementService.anonymous?2:void 0})}catch(f){this.logService.error(`[chat setup] Error during setup: ${xn(f)}`)}finally{h.dispose()}if(typeof g?.success=="boolean")if(g.success){if(g.dialogSkipped)await u?.clear();else if(p){let f=this.replaceAgentInRequestModel(p,s);f=this.replaceToolInRequestModel(f),await this.forwardRequestToChat(f,t,o,n,s,r,l)}}else t({kind:"warning",content:new Ie(d(7210,null))});else t({kind:"markdownContent",content:this.workspaceTrustManagementService.isWorkspaceTrusted()?zb.SETUP_NEEDED_MESSAGE:zb.TRUST_NEEDED_MESSAGE});return{}}replaceAgentInRequestModel(e,t){let o=e.message.parts.find(l=>l instanceof lp);if(!o)return e;let n=o.agent.id.replace(/setup\./,`${zM.extensionId}.`.toLowerCase()),r=t.getAgent(n);if(!r)return e;let s=new lp(o.range,o.editorRange,r);return new oH({session:e.session,message:{parts:e.message.parts.map(l=>l instanceof lp?s:l),text:e.message.text},variableData:e.variableData,timestamp:Date.now(),attempt:e.attempt,modeInfo:e.modeInfo,confirmation:e.confirmation,locationData:e.locationData,attachedContext:e.attachedContext,isCompleteAddedRequest:e.isCompleteAddedRequest})}replaceToolInRequestModel(e){let t=e.message.parts.find(l=>l instanceof dI);if(!t)return e;let o=t.toolId.replace(/setup.tools\./,"copilot_".toLowerCase()),n=new dI(t.range,t.editorRange,t.toolName,o,t.displayName,t.icon),r={id:o,name:"new",range:t.range,kind:"tool",value:void 0},s={variables:[r]};return new oH({session:e.session,message:{parts:e.message.parts.map(l=>l instanceof dI?n:l),text:e.message.text},variableData:s,timestamp:Date.now(),attempt:e.attempt,modeInfo:e.modeInfo,confirmation:e.confirmation,locationData:e.locationData,attachedContext:[r],isCompleteAddedRequest:e.isCompleteAddedRequest})}};zb=I([m(3,F),m(4,se),m(5,Te),m(6,At),m(7,Nr),m(8,rr),m(9,$t),m(10,X),m(11,kl),m(12,Hi),m(13,ge)],zb);var aNi=class a{static registerTool(i,e){return i.invokeFunction(t=>{let o=t.get(Vn),n=i.createInstance(a);return o.registerTool(e,n)})}async invoke(i,e,t,o){return{content:[{kind:"text",value:""}]}}async prepareToolInvocation(i,e){}},Goe=class{constructor(i,e,t,o){this.context=i;this.controller=e;this.instantiationService=t;this.chatEntitlementService=o}static registerProvider(i,e,t){return i.invokeFunction(o=>{let n=o.get(Qt),r=i.createInstance(Goe,e,t);return n.newSymbolNamesProvider.register("*",r)})}async provideNewSymbolNames(i,e,t,o){return await this.instantiationService.invokeFunction(n=>kN.getInstance(this.instantiationService,this.context,this.controller).run({forceAnonymous:this.chatEntitlementService.anonymous?1:void 0})),[]}};Goe=I([m(2,F),m(3,rr)],Goe);var qoe=class{constructor(i){this.markerService=i}static registerProvider(i){return i.invokeFunction(e=>{let t=e.get(Qt),o=i.createInstance(qoe);return t.codeActionProvider.register("*",o)})}async provideCodeActions(i,e){let t=[],o,n;if(e.isEmpty()){let s=i.getLineContent(e.startLineNumber);/^\s*$/.test(s)&&(o=d(7217,null),n=yU.generate(e))}else{let s=i.getValueInRange(e);/^\s*$/.test(s)||(o=d(7219,null),n=yU.modify(e))}o&&n&&t.push({kind:xr.RefactorRewrite.append("copilot").value,isAI:!0,title:o,command:n});let r=yU.warningOrErrorMarkersAtRange(this.markerService,i.uri,e);return r.length>0&&(t.push({kind:xr.QuickFix.append("copilot").value,isAI:!0,diagnostics:r,title:d(7216,null),command:yU.fixMarkers(r,e)}),t.push({kind:xr.QuickFix.append("explain").append("copilot").value,isAI:!0,diagnostics:r,title:d(7215,null),command:yU.explainMarkers(r)})),{actions:t,dispose(){}}}};qoe=I([m(0,oa)],qoe);var yU=class{static warningOrErrorMarkersAtRange(i,e,t){return i.read({resource:e,severities:12}).filter(o=>t.startLineNumber<=o.endLineNumber&&t.endLineNumber>=o.startLineNumber)}static modify(i){return{id:N8,title:d(7219,null),arguments:[{initialSelection:this.rangeToSelection(i),initialRange:i,position:i.getStartPosition()}]}}static generate(i){return{id:N8,title:d(7217,null),arguments:[{initialSelection:this.rangeToSelection(i),initialRange:i,position:i.getStartPosition()}]}}static rangeToSelection(i){return new ti(i.startLineNumber,i.startColumn,i.endLineNumber,i.endColumn)}static explainMarkers(i){return{id:lx,title:d(7215,null),arguments:[{query:`@workspace /explain ${i.map(e=>e.message).join(", ")}`,isPartialQuery:!0}]}}static fixMarkers(i,e){return{id:N8,title:d(7216,null),arguments:[{message:`/fix ${i.map(t=>t.message).join(", ")}`,initialSelection:this.rangeToSelection(e),initialRange:e,position:e.getStartPosition()}]}}};var wU={chatExtensionId:ro.defaultChatAgent?.chatExtensionId??"",manageOveragesUrl:ro.defaultChatAgent?.manageOverageUrl??"",upgradePlanUrl:ro.defaultChatAgent?.upgradePlanUrl??"",completionsRefreshTokenCommand:ro.defaultChatAgent?.completionsRefreshTokenCommand??"",chatRefreshTokenCommand:ro.defaultChatAgent?.chatRefreshTokenCommand??""},exo="workbench.action.chat.signInIndicator",Nfe=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this.instantiationService=t;this.logService=n;this.contextKeyService=r;this.extensionEnablementService=s;this.extensionsWorkbenchService=l;this.extensionService=c;this.environmentService=u;this.chatSessionsService=p;this.configurationService=h;let g=o.context?.value,f=o.requests?.value;if(!g||!f)return;let v=new co(()=>this._register(this.instantiationService.createInstance(fVe,g,f)));this.registerSetupAgents(g,v),this.registerGrowthSession(o),this.registerActions(g,f,v),this.registerSignInTitleBarEntry(e),this.registerUrlLinkHandler(),this.checkExtensionInstallation(g)}static{this.ID="workbench.contrib.chatSetup"}registerSetupAgents(e,t){let o=im(new me),n=im(new me),r=im(new me),s=im(new me),l=()=>{{if(!e.state.hidden&&!e.state.disabled){if(!o.value){let c=o.value=new N,u=c.add(new N);for(let p of["ask","edit","agent"]){let{agent:h,disposable:g}=zb.registerDefaultAgents(this.instantiationService,"panel",p,e,t);u.add(g),u.add(h.onUnresolvableError(()=>{tU.get().some(v=>this.contextKeyService.contextMatchesRules(v.when))&&(this.logService.error("[chat setup] Unresolvable error from Chat agent registration, clearing registration."),u.dispose())}))}c.add(zb.registerDefaultAgents(this.instantiationService,"terminal","ask",e,t).disposable),c.add(zb.registerDefaultAgents(this.instantiationService,"notebook","ask",e,t).disposable),c.add(zb.registerDefaultAgents(this.instantiationService,"editor","ask",e,t).disposable)}(!e.state.installed||e.state.entitlement===1||e.state.entitlement===2)&&!n.value&&(n.value=new N).add(zb.registerBuiltInAgents(this.instantiationService,e,t))}else o.clear(),n.clear();e.state.installed&&!e.state.disabled&&n.clear()}!e.state.installed&&!e.state.hidden&&!e.state.disabled?r.value||(r.value=Goe.registerProvider(this.instantiationService,e,t)):r.clear(),!e.state.installed&&!e.state.hidden&&!e.state.disabled?s.value||(s.value=qoe.registerProvider(this.instantiationService)):s.clear()};this._register(U.runAndSubscribe(e.onDidChange,()=>l()))}registerGrowthSession(e){let t=im(new me),o=()=>{let r=this.configurationService.getValue("chat.growthNotification.enabled")===!0&&!e.sentiment.installed;if(r&&!t.value){let s=new N,l=s.add(this.instantiationService.createInstance(FW));l.isDismissed?s.dispose():(s.add(JCo(this.chatSessionsService,l)),s.add(l.onDidDismiss(()=>{t.clear()})),t.value=s)}else r||t.clear()};this._register(e.onDidChangeSentiment(()=>o())),o()}registerActions(e,t,o){class n extends K{static{this.CHAT_SETUP_ACTION_LABEL=L(7193,"Use AI Features with Copilot for free...")}constructor(){super({id:Ab,title:n.CHAT_SETUP_ACTION_LABEL,category:Si,f1:!0,precondition:C.or(ie.Setup.hidden,ie.Setup.disabled,ie.Setup.untrusted,ie.Setup.installed.negate(),ie.Entitlement.canSignUp)})}async run(S,y,w){let k=S.get(Pt),T=S.get(F),P=S.get(at),O=S.get(ge),V=S.get(ji),H=S.get(B);if(await e.update({hidden:!1}),H.updateValue("chat.disableAIFeatures",!1),y&&(await k.revealWidget())?.input.setChatMode(y),w?.inputValue){let J=await k.revealWidget();J?.input.showScrollbarUntilAccept(),J?.setInput(w.inputValue)}let G=kN.getInstance(T,e,o),{success:$}=await G.run(w);if($===!1&&!V.willShutdown){let{confirmed:J}=await P.confirm({type:bt.Error,message:d(7191,null),primaryButton:d(7189,null)});if(J)return!!await O.executeCommand(Ab,y,w)}return!!$}}class r extends K{constructor(){super({id:xpe,title:n.CHAT_SETUP_ACTION_LABEL})}async run(S,y){let w=S.get(ge),k=S.get(Te),T=S.get(rr);return k.publicLog2("workbenchActionExecuted",{id:Ab,from:"api"}),w.executeCommand(Ab,void 0,{forceAnonymous:T.anonymous?1:void 0,...y})}}class s extends K{constructor(){super({id:"workbench.action.chat.triggerSetupForceSignIn",title:L(7183,"Sign in to use AI features")})}async run(S){let y=S.get(ge);return S.get(Te).publicLog2("workbenchActionExecuted",{id:Ab,from:"api"}),y.executeCommand(Ab,void 0,{forceSignInDialog:!0})}}class l extends K{constructor(){super({id:"workbench.action.chat.triggerSetupAnonymousWithoutDialog",title:n.CHAT_SETUP_ACTION_LABEL})}async run(S){let y=S.get(ge);return S.get(Te).publicLog2("workbenchActionExecuted",{id:Ab,from:"api"}),y.executeCommand(Ab,void 0,{forceAnonymous:2})}}class c extends K{constructor(){super({id:"workbench.action.chat.triggerSetupFromAccounts",title:L(7194,"Sign in to use AI features..."),menu:{id:D.AccountsContext,group:"2_copilot",when:C.and(ie.Setup.hidden.negate(),ie.Setup.installed.negate(),ie.Entitlement.signedOut)}})}async run(S){let y=S.get(ge);return S.get(Te).publicLog2("workbenchActionExecuted",{id:Ab,from:"accounts"}),y.executeCommand(Ab)}}class u extends K{static{this.ID=exo}constructor(){super({id:u.ID,title:d(7192,null),f1:!1,menu:[{id:D.TitleBarAdjacentCenter,order:0,when:C.and(Fu.negate(),C.has("config.chat.signInTitleBar.enabled"),ie.Entitlement.signedOut,ie.Setup.hidden.negate(),C.has("updateTitleBar").negate())}]})}async run(S){let y=S.get(ge);return S.get(Te).publicLog2("workbenchActionExecuted",{id:Ab,from:"titlebar"}),y.executeCommand(Ab)}}let p=this._register(new me);class h extends K{constructor(){super({id:"workbench.action.chat.upgradePlan",title:L(7186,"Upgrade to GitHub Copilot Pro"),category:L(7180,"Chat"),f1:!0,precondition:C.and(ie.Setup.hidden.negate(),C.or(ie.Entitlement.canSignUp,ie.Entitlement.planFree)),menu:{id:D.ChatTitleBarMenu,group:"a_first",order:1,when:C.and(ie.Entitlement.planFree,C.or(ie.chatQuotaExceeded,ie.completionsQuotaExceeded))}})}async run(S){let y=S.get(Je),w=S.get(Zt),k=S.get(ge);y.open(A.parse(wU.upgradePlanUrl));let T=e.state.entitlement;AF(T)||(p.value=w.onDidChangeFocus(P=>this.onWindowFocus(P,k)))}async onWindowFocus(S,y){if(S){p.clear();let w=await t.forceResolveEntitlement();w?.entitlement&&AF(w?.entitlement)&&Ocn(y)}}}class g extends K{constructor(){super({id:"workbench.action.chat.manageOverages",title:L(7185,"Manage GitHub Copilot Overages"),category:L(7180,"Chat"),f1:!0,precondition:C.and(ie.Setup.hidden.negate(),C.or(ie.Entitlement.planPro,ie.Entitlement.planProPlus,ie.Entitlement.planEdu)),menu:{id:D.ChatTitleBarMenu,group:"a_first",order:1,when:C.and(C.or(ie.Entitlement.planPro,ie.Entitlement.planProPlus,ie.Entitlement.planEdu),C.or(ie.chatQuotaExceeded,ie.completionsQuotaExceeded))}})}async run(S){S.get(Je).open(A.parse(wU.manageOveragesUrl))}}W(n),W(s),W(c),W(u),W(l),W(r),W(h),W(g);function f(b,S){$e.registerCommand(b,async(y,...w)=>{let k=y.get(ge),T=y.get(qt),P=y.get(oa);switch(b){case"chat.internal.explain":case"chat.internal.fix":{let O=T.getActiveCodeEditor(),V=O?.getModel()?.uri,H=O?.getSelection();if(!V||!H)return;let G=yU.warningOrErrorMarkersAtRange(P,V,H),$=b==="chat.internal.explain"?yU.explainMarkers(G):yU.fixMarkers(G,H);await k.executeCommand($.id,...$.arguments??[]);break}case"chat.internal.review":{await k.executeCommand(xpe)&&await k.executeCommand(S);break}case"chat.internal.codeReview.run":return k.executeCommand(S,...w)}})}f("chat.internal.explain","github.copilot.chat.explain"),f("chat.internal.fix","github.copilot.chat.fix"),f("chat.internal.review","github.copilot.chat.review"),f("chat.internal.codeReview.run","github.copilot.chat.codeReview.run");let v=C.and(ie.Setup.hidden.negate(),ie.Setup.disabled.negate(),ie.Setup.installed.negate());ve.appendMenuItem(D.EditorContext,{command:{id:"chat.internal.explain",title:d(7181,null)},group:"1_chat",order:4,when:v}),ve.appendMenuItem(D.EditorContext,{command:{id:"chat.internal.fix",title:d(7182,null)},group:"1_chat",order:5,when:C.and(v,pe.readOnly.negate())}),ve.appendMenuItem(D.EditorContext,{command:{id:"chat.internal.review",title:d(7190,null)},group:"1_chat",order:6,when:v})}registerSignInTitleBarEntry(e){this._register(e.register(D.TitleBarAdjacentCenter,exo,(t,o)=>new lNi(t,o)))}registerUrlLinkHandler(){this._register(aYe.registerHandler(this.instantiationService.createInstance(wst)))}async checkExtensionInstallation(e){if(this.environmentService.isExtensionDevelopment&&(await this.extensionService.whenInstalledExtensionsRegistered(),this.extensionService.extensions.find(t=>Ii.equals(t.identifier,wU.chatExtensionId)))){e.update({installed:!0,disabled:!1,untrusted:!1});return}await this.extensionsWorkbenchService.queryLocal(),this._register(U.runAndSubscribe(this.extensionsWorkbenchService.onChange,t=>{if(t&&!Ii.equals(t.identifier.id,wU.chatExtensionId))return;let o=this.extensionsWorkbenchService.local.find(l=>Ii.equals(l.identifier.id,wU.chatExtensionId)),n=!!o?.local,r,s=!1;n?(r=!this.extensionEnablementService.isEnabled(o.local),r&&this.extensionEnablementService.getEnablementState(o.local)===0&&(r=!1,s=!0)):r=!1,e.update({installed:n,disabled:r,untrusted:s})}))}};Nfe=I([m(0,Zx),m(1,F),m(2,rr),m(3,se),m(4,X),m(5,Js),m(6,Hi),m(7,lt),m(8,Eo),m(9,Us),m(10,B)],Nfe);var wst=class{constructor(i,e,t,o){this.productService=i;this.commandService=e;this.telemetryService=t;this.chatModeService=o}canHandleURL(i){return i.scheme===this.productService.urlProtocol&&vr(i.authority,wU.chatExtensionId)}async handleURL(i){let e=new URLSearchParams(i.query);this.telemetryService.publicLog2("workbenchActionExecuted",{id:Ab,from:"url",detail:e.get("referrer")??void 0});let t=e.get("agent")??e.get("mode"),o=e.get("prompt");if(!t&&!o)return!1;let n=t?this.resolveAgentId(t):void 0;return await this.commandService.executeCommand(Ab,n,o?{inputValue:o}:void 0),!0}resolveAgentId(i){let e=this.chatModeService.getModes(),t=[...e.builtin,...e.custom],o=t.find(s=>s.id===i);if(o)return o.id;let n=i.toLowerCase();return t.find(s=>s.name.get().toLowerCase()===n)?.id}};wst=I([m(0,tt),m(1,ge),m(2,Te),m(3,Fg)],wst);var Ofe=class extends x{constructor(e,t,o,n,r,s){super();this.configurationService=t;this.extensionsWorkbenchService=o;this.extensionEnablementService=n;this.viewDescriptorService=r;this.layoutService=s;e.context?.value&&(this.registerListeners(),this.registerActions(),this.handleChatDisabled(!1))}static{this.ID="workbench.contrib.chatTeardown"}handleChatDisabled(e){let t=this.configurationService.inspect("chat.disableAIFeatures");t.value===!0?(this.maybeEnableOrDisableExtension(typeof t.workspaceValue=="boolean"?11:10),e&&this.maybeHideAuxiliaryBar()):t.value===!1&&e&&this.maybeEnableOrDisableExtension(typeof t.workspaceValue=="boolean"?13:12)}async registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration("chat.disableAIFeatures")&&this.handleChatDisabled(!0)})),await this.extensionsWorkbenchService.queryLocal(),this._register(this.extensionsWorkbenchService.onChange(e=>{if(e&&!Ii.equals(e.identifier.id,wU.chatExtensionId))return;let t=this.extensionsWorkbenchService.local.find(o=>Ii.equals(o.identifier.id,wU.chatExtensionId));t?.local&&this.extensionEnablementService.isEnabled(t.local)&&this.configurationService.updateValue("chat.disableAIFeatures",!1)}))}async maybeEnableOrDisableExtension(e){let t=this.extensionsWorkbenchService.local.find(o=>Ii.equals(o.identifier.id,wU.chatExtensionId));t&&(await this.extensionsWorkbenchService.setEnablement([t],e),await this.extensionsWorkbenchService.updateRunningExtensions(e===12||e===13?d(7188,null):d(7187,null)))}maybeHideAuxiliaryBar(){let e=this.viewDescriptorService.getViewContainersByLocation(2).filter(t=>this.viewDescriptorService.getViewContainerModel(t).activeViewDescriptors.length>0);(e.length===0||e.length===1&&e.at(0)?.id===l4)&&this.layoutService.setPartHidden(!0,"workbench.parts.auxiliarybar")}registerActions(){class e extends K{static{this.ID="workbench.action.chat.hideSetup"}static{this.TITLE=L(7184,"Learn How to Hide AI Features")}constructor(){super({id:e.ID,title:e.TITLE,f1:!0,category:Si,precondition:ie.Setup.hidden.negate(),menu:{id:D.ChatTitleBarMenu,group:"z_hide",order:1,when:ie.Setup.installed.negate()}})}async run(o){o.get(Go).openSettings({jsonEditor:!1,query:"@id:chat.disableAIFeatures"})}}W(e)}};Ofe=I([m(0,rr),m(1,B),m(2,Hi),m(3,Js),m(4,Bi),m(5,yi)],Ofe);function Ocn(a){a.executeCommand(wU.completionsRefreshTokenCommand),a.executeCommand(wU.chatRefreshTokenCommand)}var lNi=class extends wl{constructor(i,e){super(void 0,i,e)}render(i){super.render(i),i.setAttribute("role","button"),i.setAttribute("aria-label",this.action.label);let e=M(i,_(".update-indicator.prominent"));this.label=M(e,_(".indicator-label")),this.label.textContent=this.action.label}updateLabel(){this.label&&(this.label.textContent=this.action.label),this.element&&this.element.setAttribute("aria-label",this.action.label)}updateEnabled(){this.element&&this.element.classList.toggle("disabled",!this.action.enabled)}};var o$t=class extends x{static createAppend(i,e,...t){if(!DE()){let n=new this(...t);i.appendChild(n.element),e.add(n);return}let o=this.createObservable(e,...t);e.add(be(n=>{let r=o.read(n);i.appendChild(r.element),n.store.add(Z(()=>r.element.remove())),n.store.add(r)}))}static createInContents(i,...e){let t=document.createElement("div");return t.style.display="contents",this.createAppend(t,i,...e),t}static createObservable(i,...e){if(!DE())return So(new this(...e));let t=this[cNi],o=t?i$t.get(t):void 0;return o?ke(n=>{let r=o.read(n);return new r(...e)}):So(new this(...e))}static instantiateAppend(i,e,t,...o){if(!DE()){let s=i.createInstance(this,...o);e.appendChild(s.element),t.add(s);return}let n=this.instantiateObservable(i,t,...o),r;t.add(be(s=>{let l=n.read(s);r?r.element.replaceWith(l.element):e.appendChild(l.element),r=l,s.delayedStore.add(l)}))}static instantiateInContents(i,e,...t){let o=document.createElement("div");return o.style.display="contents",this.instantiateAppend(i,o,e,...t),o}static instantiateObservable(i,e,...t){if(!DE())return So(i.createInstance(this,...t));let o=this[cNi],n=o?i$t.get(o):void 0;return n?ke(r=>{let s=n.read(r);return i.createInstance(s,...t)}):So(i.createInstance(this,...t))}static registerWidgetHotReplacement(i){if(!DE())return;let e=i$t.get(i);e?e.set(this,void 0):(e=Me(i,this),i$t.set(i,e)),this[cNi]=i}},cNi=Symbol("DomWidgetHotReloadId"),i$t=new Map;function n$t(a){return!a.sentiment.installed||a.entitlement===3}var EN=ro.defaultChatAgent,txo=te("gauge.foreground",{dark:qje,light:qje,hcDark:bi,hcLight:bi},d(7289,null));te("gauge.background",{dark:ai(txo,.3),light:ai(txo,.3),hcDark:We.white,hcLight:We.white},d(7285,null));te("gauge.border",{dark:null,light:null,hcDark:bi,hcLight:bi},d(7286,null));var ixo=te("gauge.warningForeground",{dark:$je,light:$je,hcDark:bi,hcLight:bi},d(7291,null));te("gauge.warningBackground",{dark:ai(ixo,.3),light:ai(ixo,.3),hcDark:We.white,hcLight:We.white},d(7290,null));var oxo=te("gauge.errorForeground",{dark:dle,light:dle,hcDark:bi,hcLight:bi},d(7288,null));te("gauge.errorBackground",{dark:ai(oxo,.3),light:ai(oxo,.3),hcDark:We.white,hcLight:We.white},d(7287,null));var vVe=class extends o$t{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super();this.chatEntitlementService=e;this.chatStatusItemService=t;this.commandService=o;this.configurationService=n;this.editorService=r;this.hoverService=s;this.languageService=l;this.openerService=c;this.telemetryService=u;this.textResourceConfigurationService=p;this.inlineCompletionsService=h;this.chatSessionsService=g;this.markdownRendererService=f;this.languageFeaturesService=v;this.quickInputService=b;this.viewService=S;this.element=_("div.chat-status-bar-entry-tooltip");this.dateFormatter=Jc.DateTimeFormat(wr,{year:"numeric",month:"long",day:"numeric"});this.dateTimeFormatter=Jc.DateTimeFormat(wr,{year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"numeric"});this.quotaPercentageFormatter=Jc.NumberFormat(void 0,{maximumFractionDigits:1,minimumFractionDigits:0});this.quotaOverageFormatter=Jc.NumberFormat(void 0,{maximumFractionDigits:2,minimumFractionDigits:0});this.render()}render(){let e=N9(this._store),t=!1,o=(u,p)=>{t&&this.element.appendChild(_("hr")),(u||p)&&this.renderHeader(this.element,this._store,u??"",p),t=!0},{chat:n,completions:r,premiumChat:s,resetDate:l,resetDateHasTime:c}=this.chatEntitlementService.quotas;if(n||r||s){let u=this.getUsageTitle();o(u,ii({id:"workbench.action.manageCopilot",label:d(7301,null),tooltip:d(7303,null),class:q.asClassName(R.settings),run:()=>this.runCommandAndClose(()=>this.openerService.open(A.parse(EN.manageSettingsUrl)))}));let p=r&&(r.total>0||r.unlimited)?this.createQuotaIndicator(this.element,this._store,r,d(7276,null),!1):void 0,h=n&&(n.total>0||n.unlimited)?this.createQuotaIndicator(this.element,this._store,n,d(7269,null),!1):void 0,g=s?.overageEnabled&&!s?.unlimited?d(7292,null):d(7298,null),f=s&&(s.total>0||s.unlimited)?this.createQuotaIndicator(this.element,this._store,s,g,!0):void 0;if(l&&this.element.appendChild(_("div.description",void 0,d(7296,null,c?this.dateTimeFormatter.value.format(new Date(l)):this.dateFormatter.value.format(new Date(l))))),this.chatEntitlementService.entitlement===5&&(Number(n?.percentRemaining)<=25||Number(r?.percentRemaining)<=25)){let v=this._store.add(new Wi(this.element,{...Qo,hoverDelegate:nI,secondary:this.canUseChat()}));v.label=d(7317,null),this._store.add(v.onDidClick(()=>this.runCommandAndClose("workbench.action.chat.upgradePlan")))}(async()=>{if(await this.chatEntitlementService.update(e),e.isCancellationRequested)return;let{chat:v,completions:b,premiumChat:S}=this.chatEntitlementService.quotas;b&&p?.(b),v&&h?.(v),S&&f?.(S)})()}else this.chatEntitlementService.anonymous&&this.chatEntitlementService.sentiment.installed&&(o(d(7263,null)),this.createQuotaIndicator(this.element,this._store,d(7302,null),d(7276,null),!1),this.createQuotaIndicator(this.element,this._store,d(7302,null),d(7269,null),!1));{let u=this.chatSessionsService.getInProgress();if(u.some(p=>p.count>0)){o(d(7268,null),ii({id:"workbench.view.chat.status.sessions",label:d(7319,null),tooltip:d(7320,null),class:q.asClassName(R.eye),run:()=>{this.viewService.openView(Dr,!0),this.hoverService.hideHover(!0)}}));for(let{chatSessionType:p,count:h}of u)if(h>0){let g=this.getDisplayNameForChatSessionType(p);if(g){let f="$(loading~spin) "+d(7294,null,g),v=this.element.appendChild(_("div.description")),b=Un(f);v.append(...b)}}}}for(let u of this.chatStatusItemService.getEntries()){o();let p=this._store.add(new me),h=this.renderContributedChatStatusItem(u);p.value=h.disposables,this.element.appendChild(h.element),this._store.add(this.chatStatusItemService.onDidChange(g=>{if(g.entry.id===u.id){let f=h.element;h=this.renderContributedChatStatusItem(g.entry),p.value=h.disposables,f.replaceWith(h.element)}}))}{let u=this.chatEntitlementService.sentiment;o(d(7293,null),u.installed&&!u.disabled&&!u.untrusted?ii({id:"workbench.action.openChatSettings",label:d(7313,null),tooltip:d(7314,null),class:q.asClassName(R.settingsGear),run:()=>this.runCommandAndClose(()=>this.commandService.executeCommand("workbench.action.openSettings",{query:`@id:${EN.completionsEnablementSetting} @id:${EN.nextEditSuggestionsSetting}`}))}):void 0),this.createSettings(this.element,this._store)}{let p=this.languageFeaturesService.inlineCompletionsProvider.allNoModel().find(h=>h.modelInfo&&h.modelInfo.models.length>0);if(p){let h=p.modelInfo,g=h.models.find(f=>f.id===h.currentModelId);if(g){let f=this.element.appendChild(_("div.model-selection"));f.appendChild(_("span.model-text",void 0,d(7297,null)));let v=f.appendChild(_("div.model-action-bar"));this._store.add(new Zi(v,{hoverDelegate:nI})).push([ii({id:"workbench.action.selectInlineCompletionsModel",label:g.name,tooltip:d(7305,null),class:q.asClassName(R.gear),run:async()=>{await this.showModelPicker(p)}})],{icon:!1,label:!0})}}}{let u=this.languageFeaturesService.inlineCompletionsProvider.allNoModel();for(let p of u)if(p.providerOptions&&p.providerOptions.length>0)for(let h of p.providerOptions){let g=h.values.find(f=>f.id===h.currentValueId);if(g){let f=this.element.appendChild(_("div.suggest-option-selection"));f.appendChild(_("span.suggest-option-text",void 0,h.label));let v=f.appendChild(_("div.suggest-option-action-bar"));this._store.add(new Zi(v,{hoverDelegate:nI})).push([ii({id:`workbench.action.selectProviderOption.${h.id}`,label:g.label,tooltip:d(7307,null,h.label),run:async()=>{await this.showProviderOptionPicker(p,h)}})],{icon:!1,label:!0})}}}if(this.canUseChat()){let u=M(this.element,_("div.snooze-completions"));this.createCompletionsSnooze(u,d(7312,null),this._store)}{let u=n$t(this.chatEntitlementService),p=this.chatEntitlementService.anonymous,h=this.chatEntitlementService.sentiment.disabled||this.chatEntitlementService.sentiment.untrusted,g=this.chatEntitlementService.entitlement===1;if(u||g||h){o();let f,v=".description";u&&p?(f=new Ie(d(7259,null,EN.provider.default.name,EN.provider.default.name,EN.termsStatementUrl,EN.privacyStatementUrl),{isTrusted:!0}),v=`${v}.terms`):u?f=d(7258,null):p?f=d(7284,null):h?f=d(7282,null):f=d(7315,null);let b;u?b=d(7280,null):p?b=d(7283,null):h?b=d(7281,null):b=d(7316,null);let S;u&&p?S="workbench.action.chat.triggerSetupAnonymousWithoutDialog":S="workbench.action.chat.triggerSetup",typeof f=="string"?this.element.appendChild(_(`div${v}`,void 0,f)):this.element.appendChild(_(`div${v}`,void 0,this._store.add(this.markdownRendererService.render(f)).element));let y=this._store.add(new Wi(this.element,{...Qo,hoverDelegate:nI}));y.label=b,this._store.add(y.onDidClick(()=>this.runCommandAndClose(S)))}}}getDisplayNameForChatSessionType(e){return e==="local"?d(7267,null):e==="copilotcli"?d(7265,null):e==="copilot-cloud-agent"?d(7266,null):this.chatSessionsService.getChatSessionContribution(e)?.displayName}canUseChat(){return!this.chatEntitlementService.sentiment.installed||this.chatEntitlementService.sentiment.disabled||this.chatEntitlementService.sentiment.untrusted?!1:this.chatEntitlementService.entitlement===1||this.chatEntitlementService.entitlement===3?this.chatEntitlementService.anonymous:!(this.chatEntitlementService.entitlement===5&&this.chatEntitlementService.quotas.chat?.percentRemaining===0&&this.chatEntitlementService.quotas.completions?.percentRemaining===0)}getUsageTitle(){let e=QDt(this.chatEntitlementService.entitlement);return d(7318,null,e)}renderHeader(e,t,o,n){let r=e.appendChild(_("div.header",void 0,o??""));n&&t.add(new Zi(r,{hoverDelegate:nI})).push([n],{icon:!0,label:!1})}renderContributedChatStatusItem(e){let t=new N,o=_("div.contribution"),n=typeof e.label=="string"?e.label:e.label.label,r=typeof e.label=="string"?void 0:e.label.link;this.renderHeader(o,t,n,r?ii({id:"workbench.action.openChatStatusItemLink",label:d(7295,null),tooltip:d(7295,null),class:q.asClassName(R.linkExternal),run:()=>this.runCommandAndClose(()=>this.openerService.open(A.parse(r)))}):void 0);let s=o.appendChild(_("div.body")),l=s.appendChild(_("span.description"));if(this.renderTextPlus(l,e.description,t),e.detail){let c=s.appendChild(_("div.detail-item"));this.renderTextPlus(c,e.detail,t)}return{element:o,disposables:t}}renderTextPlus(e,t,o){for(let n of ES(t).nodes)if(typeof n=="string"){let r=Un(n);e.append(...r)}else o.add(new rg(e,n,void 0,this.hoverService,this.openerService))}runCommandAndClose(e,...t){typeof e=="function"?e(...t):(this.telemetryService.publicLog2("workbenchActionExecuted",{id:e,from:"chat-status"}),this.commandService.executeCommand(e,...t)),this.hoverService.hideHover(!0)}createQuotaIndicator(e,t,o,n,r){let s=_("span.quota-value"),l=_("div.quota-bit"),c=_("span.overage-label"),u=e.appendChild(_("div.quota-indicator",void 0,_("div.quota-label",void 0,_("span",void 0,n),s),_("div.quota-bar",void 0,l),_("div.description",void 0,c)));if(r&&(this.chatEntitlementService.entitlement===10||this.chatEntitlementService.entitlement===6||this.chatEntitlementService.entitlement===7)){let h=t.add(new Wi(u,{...Qo,secondary:!0,hoverDelegate:nI}));h.label=d(7279,null),t.add(h.onDidClick(()=>this.runCommandAndClose(()=>this.openerService.open(A.parse(EN.manageOverageUrl)))))}let p=h=>{u.classList.remove("error"),u.classList.remove("warning");let g;typeof h=="string"||h.unlimited?g=0:g=Math.max(0,100-h.percentRemaining),typeof h=="string"?s.textContent=h:h.unlimited?s.textContent=d(7304,null):h.overageCount?s.textContent=d(7300,null,this.quotaOverageFormatter.value.format(h.overageCount)):s.textContent=d(7299,null,this.quotaPercentageFormatter.value.format(g)),l.style.width=`${g}%`;let f=r&&typeof h!="string"&&h?.overageEnabled;g>=90&&!f?u.classList.add("error"):g>=75&&!f&&u.classList.add("warning"),r?typeof h!="string"&&h.unlimited?c.textContent="":typeof h!="string"&&h?.overageEnabled?c.replaceChildren(d(7260,null),_("br"),d(7261,null)):c.textContent=d(7262,null):c.textContent=""};return p(o),p}createSettings(e,t){let o=this.editorService.activeTextEditorLanguageId,n=e.appendChild(_("div.settings"));{let r=M(n,_("div.setting"));if(this.createInlineSuggestionsSetting(r,d(7309,null),"*",t),o){let s=M(n,_("div.setting"));this.createInlineSuggestionsSetting(s,d(7310,null,this.languageService.getLanguageName(o)??o),o,t)}}{let r=M(n,_("div.setting"));this.createNextEditSuggestionsSetting(r,d(7311,null),this.getCompletionsSettingAccessor(o),t)}return n}createSetting(e,t,o,n,r){let s=r.add(new Ev(o,!!n.readSetting(),{...qf}));e.appendChild(s.domNode);let l=M(e,_("span.setting-label",void 0,o));return r.add(Ms.addTarget(l)),[re.CLICK,Kn.Tap].forEach(c=>{r.add(j(l,c,u=>{s?.enabled&&(Xt.stop(u,!0),s.checked=!s.checked,n.writeSetting(s.checked),s.focus())}))}),r.add(s.onChange(()=>{n.writeSetting(s.checked)})),r.add(this.configurationService.onDidChangeConfiguration(c=>{t.some(u=>c.affectsConfiguration(u))&&(s.checked=!!n.readSetting())})),this.canUseChat()||(e.classList.add("disabled"),s.disable(),s.checked=!1),s}createInlineSuggestionsSetting(e,t,o,n){this.createSetting(e,[EN.completionsEnablementSetting],t,this.getCompletionsSettingAccessor(o),n)}getCompletionsSettingAccessor(e="*"){let t=EN.completionsEnablementSetting;return{readSetting:()=>Tye(this.configurationService,e),writeSetting:o=>{this.telemetryService.publicLog2("chatStatus.settingChanged",{settingIdentifier:t,settingMode:e,settingEnablement:o?"enabled":"disabled"});let n=this.configurationService.getValue(t);return xi(n)||(n=Object.create(null)),this.configurationService.updateValue(t,{...n,[e]:o})}}}createNextEditSuggestionsSetting(e,t,o,n){let r=EN.nextEditSuggestionsSetting,s=EN.completionsEnablementSetting,l=po.getOriginalUri(this.editorService.activeEditor,{supportSideBySide:1}),c=this.createSetting(e,[r,s],t,{readSetting:()=>o.readSetting()&&this.textResourceConfigurationService.getValue(l,r),writeSetting:u=>(this.telemetryService.publicLog2("chatStatus.settingChanged",{settingIdentifier:r,settingEnablement:u?"enabled":"disabled"}),this.textResourceConfigurationService.updateValue(l,r,u))},n);o.readSetting()||(e.classList.add("disabled"),c.disable()),n.add(this.configurationService.onDidChangeConfiguration(u=>{u.affectsConfiguration(s)&&(o.readSetting()&&this.canUseChat()?(c.enable(),e.classList.remove("disabled")):(c.disable(),e.classList.add("disabled")))}))}createCompletionsSnooze(e,t,o){let n=()=>{let f=Tye(this.configurationService),v=Tye(this.configurationService,this.editorService.activeTextEditorLanguageId);return f||v},r=o.add(new Wi(e,{disabled:!n(),...Qo,hoverDelegate:nI,secondary:!0})),s=e.appendChild(_("span.snooze-label")),l=e.appendChild(_("div.snooze-action-bar")),c=o.add(new Zi(l,{hoverDelegate:nI})),u=ii({id:"workbench.action.cancelSnoozeStatusBarLink",label:d(7264,null),run:()=>this.inlineCompletionsService.cancelSnooze(),class:q.asClassName(R.stopCircle)}),p=f=>{e.classList.toggle("disabled",!f),c.clear();let v=this.inlineCompletionsService.snoozeTimeLeft;if(!f||v<=0)return s.textContent=d(7273,null),s.title="",r.label=t,r.setTitle(d(7272,null)),!0;let b=Math.ceil(v/1e3),S=Math.floor(b/60),y=b%60;return s.textContent=`${S}:${y<10?"0":""}${y} ${d(7271,null)}`,s.title=d(7275,null),r.label=d(7270,null),r.setTitle(d(7274,null)),c.push([u],{icon:!0,label:!1}),!1},h=o.add(new N);function g(){h.clear();let f=n();p(f)||h.add(zI(Re(e),()=>p(f),1e3))}g(),o.add(r.onDidClick(()=>{this.inlineCompletionsService.snooze(),p(n())})),o.add(this.configurationService.onDidChangeConfiguration(f=>{f.affectsConfiguration(EN.completionsEnablementSetting)&&(r.enabled=n()),g()})),o.add(this.inlineCompletionsService.onDidChangeIsSnoozing(f=>{g()}))}async showModelPicker(e){if(!e.modelInfo||!e.setModelId)return;let t=e.modelInfo,o=t.models.map(r=>({id:r.id,label:r.name,description:r.id===t.currentModelId?d(7277,null):void 0,picked:r.id===t.currentModelId})),n=await this.quickInputService.pick(o,{placeHolder:d(7306,null,e.displayName||"inline completions"),canPickMany:!1});n&&n.id&&n.id!==t.currentModelId&&await e.setModelId(n.id),this.hoverService.hideHover(!0)}async showProviderOptionPicker(e,t){if(!e.setProviderOption)return;let o=t.values.map(r=>({id:r.id,label:r.label,description:r.id===t.currentValueId?d(7278,null):void 0,picked:r.id===t.currentValueId})),n=await this.quickInputService.pick(o,{placeHolder:d(7308,null,t.label),canPickMany:!1});n&&n.id&&n.id!==t.currentValueId&&await e.setProviderOption(t.id,n.id),this.hoverService.hideHover(!0)}};vVe=I([m(0,rr),m(1,pXe),m(2,ge),m(3,B),m(4,ee),m(5,nt),m(6,_t),m(7,Je),m(8,Te),m(9,Fn),m(10,w5),m(11,Us),m(12,On),m(13,Qt),m(14,Ue),m(15,$t)],vVe);var Ffe=class extends x{constructor(e,t,o,n,r,s,l){super();this.chatEntitlementService=e;this.instantiationService=t;this.statusbarService=o;this.editorService=n;this.configurationService=r;this.completionsService=s;this.chatSessionsService=l;this.entry=void 0;this.activeCodeEditorListener=this._register(new me);this.runningSessionsCount=this.chatSessionsService.getInProgress().reduce((c,u)=>c+u.count,0),this.update(),this.registerListeners()}static{this.ID="workbench.contrib.chatStatusBarEntry"}update(){if(this.chatEntitlementService.sentiment.hidden)this.entry?.dispose(),this.entry=void 0;else{let t=this.getEntryProps();this.entry?this.entry.update(t):this.entry=this.statusbarService.addEntry(t,"chat.statusBarEntry",1,{location:{id:"status.editor.mode",priority:100.1},alignment:1})}}registerListeners(){this._register(this.chatEntitlementService.onDidChangeQuotaExceeded(()=>this.update())),this._register(this.chatEntitlementService.onDidChangeSentiment(()=>this.update())),this._register(this.chatEntitlementService.onDidChangeEntitlement(()=>this.update())),this._register(this.completionsService.onDidChangeIsSnoozing(()=>this.update())),this._register(this.chatSessionsService.onDidChangeInProgress(()=>{let e=this.runningSessionsCount;this.runningSessionsCount=this.chatSessionsService.getInProgress().reduce((t,o)=>t+o.count,0),this.runningSessionsCount!==e&&this.update()})),this._register(this.editorService.onDidActiveEditorChange(()=>this.onDidActiveEditorChange())),this._register(this.configurationService.onDidChangeConfiguration(e=>{(e.affectsConfiguration(ro.defaultChatAgent?.completionsEnablementSetting)||e.affectsConfiguration("chat.signInTitleBar.enabled"))&&this.update()}))}onDidActiveEditorChange(){this.update(),this.activeCodeEditorListener.clear();let e=ha(this.editorService.activeTextEditorControl);e&&(this.activeCodeEditorListener.value=e.onDidChangeModelLanguage(()=>{this.update()}))}getEntryProps(){let e="$(copilot)",t=d(7326,null),o;if(n$t(this.chatEntitlementService)){let r=this.chatEntitlementService.entitlement;if(this.chatEntitlementService.sentiment.later||r===3||AF(r)||r===5){let s=d(7331,null);e=`$(copilot) ${s}`,t=s,o="prominent"}}else{let r=this.chatEntitlementService.quotas.chat?.percentRemaining===0,s=this.chatEntitlementService.quotas.completions?.percentRemaining===0;if(this.chatEntitlementService.sentiment.disabled||this.chatEntitlementService.sentiment.untrusted)e="$(copilot-unavailable)",t=d(7330,null);else if(this.runningSessionsCount>0)e="$(copilot-in-progress)",this.runningSessionsCount>1?t=d(7324,null,this.runningSessionsCount):t=d(7323,null);else if(this.chatEntitlementService.entitlement===1)if(this.configurationService.getValue("chat.signInTitleBar.enabled")){let c=d(7333,null);e=`$(copilot) ${c}`,t=c}else{let c=d(7332,null);e=`${this.chatEntitlementService.anonymous?"$(copilot)":"$(copilot-not-connected)"} ${c}`,t=c,o="prominent"}else if(this.chatEntitlementService.entitlement===5&&(r||s)){let l;r&&!s?l=d(7322,null):s&&!r?l=d(7328,null):l=d(7321,null),e=`$(copilot-warning) ${l}`,t=l,o="prominent"}else this.editorService.activeTextEditorLanguageId&&!Tye(this.configurationService,this.editorService.activeTextEditorLanguageId)?(e="$(copilot-unavailable)",t=d(7327,null)):this.completionsService.isSnoozing()&&(e="$(copilot-snooze)",t=d(7329,null))}return{name:d(7325,null),text:e,ariaLabel:t,command:LR,showInAllWindows:!0,kind:o,tooltip:{element:r=>{let s=new N;s.add(r.onCancellationRequested(()=>{s.dispose()}));let l=vVe.instantiateInContents(this.instantiationService,s);return s.add(zI(ut,()=>{l.isConnected||s.dispose()},2e3)),l}}}}dispose(){super.dispose(),this.entry?.dispose(),this.entry=void 0}};Ffe=I([m(0,rr),m(1,F),m(2,kr),m(3,ee),m(4,B),m(5,w5),m(6,Us)],Ffe);var r$t=class{constructor(){this._providers=new Map}get providers(){return[...this._providers.values()]}registerProvider(i,e){return this._providers.set(e,i),Z(()=>this._providers.delete(e))}};var Fcn=5e3,Wcn=1e3,Vcn=200,bVe=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.prompt=e;this._quickInputService=t;this._terminalService=o;this._searchService=n;this._workspaceContextService=r;this._labelService=s;this._fileService=l;this._modelService=c;this._languageService=u;this._terminalGroupService=p;this._instantiationService=h;this._codeEditorService=g;this._editorService=f;this.quickPick=this._register(t.createQuickPick({useSeparators:!0}))}async createArgs(e){let{quickPick:t,prompt:o}=this;t.totalSteps=o.arguments.length,t.step=0,t.ignoreFocusOut=!0,t.sortByLabel=!1;let n={},r=[];for(let s=0;s<o.arguments.length;s++){let l=o.arguments[s],c=r.at(s);t.step=s+1,t.placeholder=l.required?l.description:`${l.description||""} (${d(11914,null)})`,t.title=d(11912,null,l.title||l.name),t.value=c?.value??(n.hasOwnProperty(l.name)&&n[l.name]||""),t.items=c?.items??[],t.activeItems=c?.activeItems??[],t.buttons=s>0?[this._quickInputService.backButton]:[];let u=await this._getArg(l,!!c,n,e);if(u.type==="back")s-=2;else{if(u.type==="cancel")return;u.type==="arg"?(r[s]={value:t.value,items:t.items.slice(),activeItems:t.activeItems.slice()},n[l.name]=u.value):os(u)}}return t.value="",t.placeholder=d(11900,null),t.busy=!0,n}async _getArg(e,t,o,n){let{quickPick:r}=this,s=new N,l=Me(this,r.value),c=[{name:d(11911,null),observer:this._promptCompletions(e,l,o)},{name:d(11902,null),observer:this._activeFileCompletions()},{name:d(11906,null),observer:this._fileCompletions(l)}];s.add(be(u=>{if(t){l.read(u);return}let p=[];p.push({id:"insert-text",label:d(11905,null),iconClass:q.asClassName(R.textSize),action:"text",alwaysShow:!0}),p.push({id:"run-command",label:d(11903,null),description:d(11904,null),iconClass:q.asClassName(R.terminal),action:"command",alwaysShow:!0});let h=!1;for(let b of c){let S=b.observer.read(u);h||=S.busy,S.picks&&(p.push({label:b.name,type:"separator"}),p=p.concat(S.picks))}let g=r.activeItems;r.busy=h,r.items=p;let f=p.find(b=>g.some(S=>S.id===b.id)),v=c[0].observer;f?r.activeItems=[f]:v.read(u).picks?.length?r.activeItems=[p[3]]:h?r.activeItems=[]:r.activeItems=[p[0]]}));try{let u=await new Promise(h=>{n&&s.add(n.onCancellationRequested(()=>{h(void 0)})),s.add(r.onDidChangeValue(g=>{r.validationMessage=void 0,l.set(g,void 0)})),s.add(r.onDidAccept(()=>{let g=r.selectedItems[0];!r.value&&e.required&&(!g||g.action==="text"||g.action==="command")?r.validationMessage=d(11907,null):h(g||{id:"insert-text",label:"",action:"text"})})),s.add(r.onDidTriggerButton(()=>{h("back")})),s.add(r.onDidHide(()=>{h(void 0)})),r.show()});if(u==="back")return{type:"back"};if(u===void 0)return{type:"cancel"};s.clear();let p=new Ye;switch(s.add(Z(()=>p.dispose(!0))),s.add(r.onDidHide(()=>s.dispose())),u.action){case"text":return{type:"arg",value:r.value||void 0};case"command":return r.value?(r.busy=!0,{type:"arg",value:await this._getTerminalOutput(r.value,p.token)}):{type:"arg",value:void 0};case"suggest":return{type:"arg",value:u.label};case"file":return r.busy=!0,{type:"arg",value:await this._fileService.readFile(u.uri).then(h=>h.value.toString())};case"selectedText":return{type:"arg",value:u.selectedText};default:os(u)}}finally{s.dispose()}}_promptCompletions(e,t,o){let n={};for(let[r,s]of Object.entries(o))s&&(n[r]=s);return this._asyncCompletions(t,async(r,s)=>(await this.prompt.complete(e.name,r,n,s)).map(c=>({id:`suggest:${c}`,label:c,action:"suggest"})))}_fileCompletions(e){let t=this._instantiationService.createInstance(kS);return this._asyncCompletions(e,async(o,n)=>{if(!o)return[];let r=t.file(this._workspaceContextService.getWorkspace().folders,{filePattern:o,maxResults:10}),{results:s}=await this._searchService.fileSearch(r,n);return s.map(l=>({id:l.resource.toString(),label:He(l.resource),description:this._labelService.getUriLabel(l.resource),iconClasses:aa(this._modelService,this._languageService,l.resource),uri:l.resource,action:"file"}))})}_activeFileCompletions(){let e=Fr(this,this._editorService.onDidActiveEditorChange),t=ke(r=>(e.read(r),this._codeEditorService.getActiveCodeEditor())),o=t.map(r=>r?Fr(this,r.onDidChangeModel).map(()=>r.getModel()?.uri):void 0).map((r,s)=>r?.read(s)),n=t.map(r=>r?Fr(this,r.onDidChangeCursorSelection).map(()=>({range:r.getSelection(),model:r.getModel()})):void 0).map((r,s)=>r?.read(s));return ke(r=>{let s=o.read(r);if(!s)return{busy:!1,picks:[]};let l=[];l.push({id:"active-file",label:d(11901,null),description:this._labelService.getUriLabel(s),iconClasses:aa(this._modelService,this._languageService,s),uri:s,action:"file"});let c=n.read(r);if(c&&c.model&&c.range&&!c.range.isEmpty()){let u=c.model.getValueInRange(c.range),p=c.range.endLineNumber-c.range.startLineNumber+1,h=p===1?d(11910,null,c.range.startLineNumber):d(11909,null,p);l.push({id:"selected-text",label:d(11908,null),description:h,selectedText:u,iconClass:q.asClassName(R.selection),uri:s,action:"selectedText"})}return{picks:l,busy:!1}})}_asyncCompletions(e,t){return ke(n=>{let r=e.read(n),s=new Ye;return n.store.add(Z(()=>s.dispose(!0))),new bd(Li(Vcn,s.token).then(()=>t(r,s.token)).catch(()=>[]))}).map((n,r)=>{let s=n.promiseResult.read(r);return{picks:s?.data||[],busy:s===void 0}})}async _getTerminalOutput(e,t){let o=this._terminal??=this._register(await this._terminalService.createTerminal({config:{name:d(11913,null),isTransient:!0,forceShellIntegration:!0,isFeatureTerminal:!0},location:1}));this._terminalService.setActiveInstance(o),this._terminalGroupService.showPanel(!1);let n=o.capabilities.get(2);if(n)return this._getTerminalOutputInner(o,e,n,t);let r=new N;return await new Promise(s=>{r.add(o.capabilities.onDidAddCapability(l=>{l.id===2&&(r.dispose(),s(this._getTerminalOutputInner(o,e,l.capability,t)))})),r.add(t.onCancellationRequested(()=>{r.dispose(),s(void 0)})),r.add(tn(()=>{r.dispose(),s(this._getTerminalOutputInner(o,e,void 0,t))},Fcn))})}async _getTerminalOutputInner(e,t,o,n){let r=new N;return new Promise(s=>{let l="";if(r.add(e.onLineData(c=>l+=c+`
`)),o)r.add(o.onCommandFinished(c=>s(c.getOutput()||l)));else{let c=r.add(new Dt(()=>s(l),Wcn));r.add(e.onData(()=>c.schedule()))}r.add(n.onCancellationRequested(()=>s(void 0))),r.add(e.onDisposed(()=>s(void 0))),e.runCommand(t,!0)}).finally(()=>{r.dispose()})}};bVe=I([m(1,Ue),m(2,nn),m(3,gg),m(4,Pe),m(5,rt),m(6,fe),m(7,Tt),m(8,_t),m(9,lc),m(10,F),m(11,qt),m(12,ee)],bVe);var SVe=class extends ja{constructor(e,t,o,n,r,s){super();this.contextViewProvider=t;this.contextKeyService=n;this.configurationService=r;this.keybindingService=s;this._onSubmit=this._register(new E);this.onSubmit=this._onSubmit.event;this._onCancel=this._register(new E);this.onCancel=this._onCancel.event;o={ariaLabel:d(13831,null),...o},this.width=o.width??100,this.render(o),e.appendChild(this.domNode)}static{this.OPTION_CHANGE="optionChange"}dispose(){super.dispose(),this.inputFocusTracker?.dispose()}setWidth(e){this.width=e,this.contextViewProvider.layout(),this.setInputWidth()}getValue(){return this.inputBox.value}setValue(e){this.inputBox.value!==e&&(this.inputBox.value=e)}select(){this.inputBox.select()}focus(){this.inputBox.focus()}inputHasFocus(){return this.inputBox.hasFocus()}setInputWidth(){this.inputBox.width=this.width-this.getSubcontrolsWidth()-2}getSubcontrolsWidth(){return 0}getHistory(){return this.inputBox.getHistory()}clearHistory(){this.inputBox.clearHistory()}prependHistory(e){this.inputBox.prependHistory(e)}clear(){this.setValue("")}onSearchSubmit(){this.inputBox.addToHistory()}showNextTerm(){this.inputBox.showNextValue()}showPreviousTerm(){this.inputBox.showPreviousValue()}render(e){this.domNode=document.createElement("div"),this.domNode.classList.add("monaco-findInput");let t=e.history||[];this.inputBox=this._register(new Bz(this.domNode,this.contextViewProvider,{placeholder:e.placeholder,showPlaceholderOnFocus:e.showPlaceholderOnFocus,tooltip:e.tooltip,ariaLabel:e.ariaLabel,validationOptions:{validation:void 0},history:new Set(t),showHistoryHint:()=>bR(this.keybindingService),inputBoxStyles:e.inputBoxStyles},this.contextKeyService)),this._register(this.inputBox.onDidChange(()=>this._onSubmit.fire(!0))),this.inputFocusTracker=qn(this.inputBox.inputElement),this.onkeyup(this.inputBox.inputElement,n=>this.onInputKeyUp(n));let o=document.createElement("div");o.className="controls",this.renderSubcontrols(o),this.domNode.appendChild(o),this.setInputWidth()}renderSubcontrols(e){}onInputKeyUp(e){switch(e.keyCode){case 3:this.onSearchSubmit(),this._onSubmit.fire(!1);return;case 9:this._onCancel.fire();return}}};SVe=I([m(3,X),m(4,B),m(5,_e)],SVe);var $oe=class extends SVe{constructor(e,t,o,n,r,s){super(e,t,o,n,r,s);this._onChangeSearchInEditorsBoxEmitter=this._register(new E);this.onChangeSearchInEditorsBox=this._onChangeSearchInEditorsBoxEmitter.event}dispose(){super.dispose(),this.useSearchInEditorsBox.dispose()}onlySearchInOpenEditors(){return this.useSearchInEditorsBox.checked}setOnlySearchInOpenEditors(e){this.useSearchInEditorsBox.checked=e,this._onChangeSearchInEditorsBoxEmitter.fire()}getSubcontrolsWidth(){return super.getSubcontrolsWidth()+this.useSearchInEditorsBox.width()}renderSubcontrols(e){this.useSearchInEditorsBox=this._register(new cm({icon:R.book,title:d(13832,null),isChecked:!1,...gh})),this._register(this.useSearchInEditorsBox.onChange(t=>{this._onChangeSearchInEditorsBoxEmitter.fire(),t||this.inputBox.focus()})),e.appendChild(this.useSearchInEditorsBox.domNode),super.renderSubcontrols(e)}};$oe=I([m(3,X),m(4,B),m(5,_e)],$oe);var joe=class extends SVe{constructor(e,t,o,n,r,s){super(e,t,o,n,r,s);this._onChangeIgnoreBoxEmitter=this._register(new E);this.onChangeIgnoreBox=this._onChangeIgnoreBoxEmitter.event}dispose(){super.dispose(),this.useExcludesAndIgnoreFilesBox.dispose()}useExcludesAndIgnoreFiles(){return this.useExcludesAndIgnoreFilesBox.checked}setUseExcludesAndIgnoreFiles(e){this.useExcludesAndIgnoreFilesBox.checked=e,this._onChangeIgnoreBoxEmitter.fire()}getSubcontrolsWidth(){return super.getSubcontrolsWidth()+this.useExcludesAndIgnoreFilesBox.width()}renderSubcontrols(e){this.useExcludesAndIgnoreFilesBox=this._register(new cm({icon:R.exclude,actionClassName:"useExcludesAndIgnoreFiles",title:d(13833,null),isChecked:!0,...gh})),this._register(this.useExcludesAndIgnoreFilesBox.onChange(t=>{this._onChangeIgnoreBoxEmitter.fire(),t||this.inputBox.focus()})),e.appendChild(this.useExcludesAndIgnoreFilesBox.domNode),super.renderSubcontrols(e)}};joe=I([m(3,X),m(4,B),m(5,_e)],joe);var Wfe=Ae("search-details",R.ellipsis,d(14033,null)),nxo=Ae("search-see-more",R.goToSearch,d(14042,null)),rxo=Ae("search-show-context",R.listSelection,d(14045,null)),s$t=Ae("search-hide-replace",R.chevronRight,d(14035,null)),dNi=Ae("search-show-replace",R.chevronDown,d(14046,null)),sxo=Ae("search-replace-all",R.replaceAll,d(14040,null)),a$t=Ae("search-replace",R.replace,d(14041,null)),axo=Ae("search-remove",R.close,d(14039,null)),l$t=Ae("search-refresh",R.refresh,d(14038,null)),lxo=Ae("search-collapse-results",R.collapseAll,d(14032,null)),cxo=Ae("search-expand-results",R.expandAll,d(14034,null)),dxo=Ae("search-tree",R.listTree,d(14044,null)),uxo=Ae("search-list",R.listFlat,d(14043,null)),pxo=Ae("search-clear-results",R.clearAll,d(14031,null)),mxo=Ae("search-stop",R.searchStop,d(14049,null)),uNi=Ae("search-view-icon",R.searchLarge,d(14050,null)),hxo=Ae("search-new-editor",R.newFile,d(14036,null)),gxo=Ae("search-open-in-file",R.goToFile,d(14037,null)),Vag=Ae("search-sparkle-filled",R.sparkleFilled,d(14048,null)),Bag=Ae("search-sparkle-empty",R.sparkle,d(14047,null));var c$t=(a,i,e,t,o,n,r)=>{let s=_("div.providerMessage"),l=ES(a.text);M(s,_("."+sk.className(a.type===1?bt.Info:bt.Warning).split(" ").join(".")));for(let c of l.nodes)if(typeof c=="string")M(s,document.createTextNode(c));else{let u=i.createInstance(rg,s,c,{opener:async p=>{if(!a.trusted)return;let h=A.parse(p,!0);h.scheme===Q.command&&a.trusted?(await o.executeCommand(h.path))?.triggerSearch&&r():h.scheme===Q.https?t.open(h):h.scheme===Q.command&&!a.trusted?e.error(d(14052,null,p)):e.error(d(14051,null,p))}});n.add(u)}return s};function Cst(a){return a&&a.getFullRange&&a.getFullRange()instanceof z}var xst=class a{static{this.ITEM_HEIGHT=22}getHeight(i){return a.ITEM_HEIGHT}getTemplateId(i){if(Fd(i))return QQ.TEMPLATE_ID;if(_l(i))return YQ.TEMPLATE_ID;if(el(i))return XQ.TEMPLATE_ID;if(lv(i))return jQ.TEMPLATE_ID;throw console.error("Invalid search tree element",i),new Error("Invalid search tree element")}},jQ=class extends x{constructor(e,t,o,n){super();this.labels=e;this.contextService=t;this.instantiationService=o;this.contextKeyService=n;this.templateId=jQ.TEMPLATE_ID}static{this.TEMPLATE_ID="textResultMatch"}renderTemplate(e){let t=new N,o=M(e,_(".textsearchresult")),n=this.labels.create(o,{supportDescriptionHighlights:!0,supportHighlights:!0,supportIcons:!0});t.add(n);let r=M(o,_(".actionBarContainer")),s=t.add(this.contextKeyService.createScoped(e)),l=t.add(this.instantiationService.createChild(new _o([X,s]))),c=t.add(l.createInstance(or,r,D.SearchActionMenu,{menuOptions:{shouldForwardArgs:!0},highlightToggledItems:!0,hiddenItemStrategy:0,toolbarOptions:{primaryGroup:u=>/^inline/.test(u)}}));return{label:n,disposables:t,actions:c,contextKeyService:s}}async renderElement(e,t,o){if(GIo(e.element))o.label.setLabel(d(14064,null)),_i.AIResultsTitle.bindTo(o.contextKeyService).set(!1),_i.MatchFocusKey.bindTo(o.contextKeyService).set(!1),_i.FileFocusKey.bindTo(o.contextKeyService).set(!1),_i.FolderFocusKey.bindTo(o.contextKeyService).set(!1);else{try{await e.element.parent().searchModel.getAITextResultProviderName()}catch{}let n=d(14062,null);o.label.setLabel(`$(${R.searchSparkle.id}) ${n}`),_i.AIResultsTitle.bindTo(o.contextKeyService).set(!0),_i.MatchFocusKey.bindTo(o.contextKeyService).set(!1),_i.FileFocusKey.bindTo(o.contextKeyService).set(!1),_i.FolderFocusKey.bindTo(o.contextKeyService).set(!1)}}disposeTemplate(e){e.disposables.dispose()}renderCompressedElements(e,t,o){}};jQ=I([m(1,Pe),m(2,F),m(3,X)],jQ);var QQ=class extends x{constructor(e,t,o,n,r,s){super();this.searchView=e;this.labels=t;this.contextService=o;this.labelService=n;this.instantiationService=r;this.contextKeyService=s;this.templateId=QQ.TEMPLATE_ID}static{this.TEMPLATE_ID="folderMatch"}renderCompressedElements(e,t,o){let n=e.element,r=n.elements[n.elements.length-1],s=n.elements.map(l=>l.name());if(r.resource){let l=iq(r)?2:1;o.label.setResource({resource:r.resource,name:s},{fileKind:l,separator:this.labelService.getSeparator(r.resource.scheme)})}else o.label.setLabel(d(14063,null));this.renderFolderDetails(r,o)}renderTemplate(e){let t=new N,o=M(e,_(".foldermatch")),n=this.labels.create(o,{supportDescriptionHighlights:!0,supportHighlights:!0});t.add(n);let r=new _v(M(o,_(".badge")),{},iI);t.add(r);let s=M(o,_(".actionBarContainer")),l=new N;t.add(l);let c=t.add(this.contextKeyService.createScoped(e));_i.AIResultsTitle.bindTo(c).set(!1),_i.MatchFocusKey.bindTo(c).set(!1),_i.FileFocusKey.bindTo(c).set(!1),_i.FolderFocusKey.bindTo(c).set(!0);let u=t.add(this.instantiationService.createChild(new _o([X,c]))),p=t.add(u.createInstance(or,s,D.SearchActionMenu,{menuOptions:{shouldForwardArgs:!0},hiddenItemStrategy:0,toolbarOptions:{primaryGroup:h=>/^inline/.test(h)}}));return{label:n,badge:r,actions:p,disposables:t,elementDisposables:l,contextKeyService:c}}renderElement(e,t,o){let n=e.element;if(n.resource){let r=this.contextService.getWorkspaceFolder(n.resource);r&&Qe(r.uri,n.resource)?o.label.setFile(n.resource,{fileKind:2,hidePath:!0}):o.label.setFile(n.resource,{fileKind:1,hidePath:this.searchView.isTreeLayoutViewVisible})}else o.label.setLabel(d(14063,null));_i.IsEditableItemKey.bindTo(o.contextKeyService).set(!n.hasOnlyReadOnlyMatches()),o.elementDisposables.add(n.onChange(()=>{_i.IsEditableItemKey.bindTo(o.contextKeyService).set(!n.hasOnlyReadOnlyMatches())})),this.renderFolderDetails(n,o)}disposeElement(e,t,o){o.elementDisposables.clear()}disposeCompressedElements(e,t,o){o.elementDisposables.clear()}disposeTemplate(e){e.disposables.dispose()}renderFolderDetails(e,t){let o=e.recursiveMatchCount();t.badge.setCount(o),t.badge.setTitleFormat(o>1?d(14061,null,o):d(14060,null,o)),t.actions.context={viewer:this.searchView.getControl(),element:e}}};QQ=I([m(2,Pe),m(3,rt),m(4,F),m(5,X)],QQ);var YQ=class extends x{constructor(e,t,o,n,r,s){super();this.searchView=e;this.labels=t;this.contextService=o;this.configurationService=n;this.instantiationService=r;this.contextKeyService=s;this.templateId=YQ.TEMPLATE_ID}static{this.TEMPLATE_ID="fileMatch"}renderCompressedElements(e,t,o){throw new Error("Should never happen since node is incompressible.")}renderTemplate(e){let t=new N,o=new N;t.add(o);let n=M(e,_(".filematch")),r=this.labels.create(n);t.add(r);let s=new _v(M(n,_(".badge")),{},iI);t.add(s);let l=M(n,_(".actionBarContainer")),c=t.add(this.contextKeyService.createScoped(e));_i.AIResultsTitle.bindTo(c).set(!1),_i.MatchFocusKey.bindTo(c).set(!1),_i.FileFocusKey.bindTo(c).set(!0),_i.FolderFocusKey.bindTo(c).set(!1);let u=t.add(this.instantiationService.createChild(new _o([X,c]))),p=t.add(u.createInstance(or,l,D.SearchActionMenu,{menuOptions:{shouldForwardArgs:!0},hiddenItemStrategy:0,toolbarOptions:{primaryGroup:h=>/^inline/.test(h)}}));return{el:n,label:r,badge:s,actions:p,disposables:t,elementDisposables:o,contextKeyService:c}}renderElement(e,t,o){let n=e.element;o.el.setAttribute("data-resource",n.resource.toString());let r=this.configurationService.getValue("search").decorations;o.label.setFile(n.resource,{range:Cst(n)?n.getFullRange():void 0,hidePath:this.searchView.isTreeLayoutViewVisible&&!_W(n.parent()),hideIcon:!1,fileDecorations:{colors:r.colors,badges:r.badges}});let s=n.count();o.badge.setCount(s),o.badge.setTitleFormat(s>1?d(14066,null,s):d(14065,null,s)),o.actions.context={viewer:this.searchView.getControl(),element:n},_i.IsEditableItemKey.bindTo(o.contextKeyService).set(!n.hasOnlyReadOnlyMatches()),o.elementDisposables.add(n.onChange(()=>{_i.IsEditableItemKey.bindTo(o.contextKeyService).set(!n.hasOnlyReadOnlyMatches())})),o.el.parentElement?.parentElement?.querySelector(".monaco-tl-twistie")?.classList.add("force-twistie")}disposeElement(e,t,o){o.elementDisposables.clear()}disposeTemplate(e){e.disposables.dispose()}};YQ=I([m(2,Pe),m(3,B),m(4,F),m(5,X)],YQ);var XQ=class extends x{constructor(e,t,o,n,r,s){super();this.searchView=e;this.contextService=t;this.configurationService=o;this.instantiationService=n;this.contextKeyService=r;this.hoverService=s;this.templateId=XQ.TEMPLATE_ID}static{this.TEMPLATE_ID="match"}renderCompressedElements(e,t,o){throw new Error("Should never happen since node is incompressible.")}renderTemplate(e){e.classList.add("linematch");let t=M(e,_("span.matchLineNum")),o=M(e,_("a.plain.match")),n=M(o,_("span")),r=M(o,_("span.findInFileMatch")),s=M(o,_("span.replaceMatch")),l=M(o,_("span")),c=M(e,_("span.actionBarContainer")),u=new N,p=u.add(this.contextKeyService.createScoped(e));_i.AIResultsTitle.bindTo(p).set(!1),_i.MatchFocusKey.bindTo(p).set(!0),_i.FileFocusKey.bindTo(p).set(!1),_i.FolderFocusKey.bindTo(p).set(!1);let h=u.add(this.instantiationService.createChild(new _o([X,p]))),g=u.add(h.createInstance(or,c,D.SearchActionMenu,{menuOptions:{shouldForwardArgs:!0},hiddenItemStrategy:0,toolbarOptions:{primaryGroup:f=>/^inline/.test(f)}}));return{parent:o,before:n,match:r,replace:s,after:l,lineNumber:t,actions:g,disposables:u,contextKeyService:p}}renderElement(e,t,o){let n=e.element,r=n.preview(),s=this.searchView.model.isReplaceActive()&&!!this.searchView.model.replaceString&&!n.isReadonly;o.before.textContent=r.before,o.match.textContent=r.inside,o.match.classList.toggle("replace",s),o.replace.textContent=s?n.replaceString:"",o.after.textContent=r.after;let l=(r.fullBefore+(s?n.replaceString:r.inside)+r.after).trim().substr(0,999);o.disposables.add(this.hoverService.setupManagedHover(Ri("mouse"),o.parent,l)),_i.IsEditableItemKey.bindTo(o.contextKeyService).set(!n.isReadonly);let c=n.range().endLineNumber-n.range().startLineNumber,u=c>0?`+${c}`:"",p=this.configurationService.getValue("search").showLineNumbers,h=p?`${n.range().startLineNumber}:`:"";o.lineNumber.classList.toggle("show",c>0||p),o.lineNumber.textContent=h+u,o.disposables.add(this.hoverService.setupManagedHover(Ri("mouse"),o.lineNumber,this.getMatchTitle(n,p))),o.actions.context={viewer:this.searchView.getControl(),element:n}}disposeTemplate(e){e.disposables.dispose()}getMatchTitle(e,t){let o=e.range().startLineNumber,n=e.range().endLineNumber-e.range().startLineNumber,r=t?d(14055,null,o,n)+" ":"",s=n>0?"+ "+d(14056,null,n):"";return r+s}};XQ=I([m(1,Pe),m(2,B),m(3,F),m(4,X),m(5,nt)],XQ);var IVe=class{constructor(i,e){this.searchView=i;this.labelService=e}getWidgetAriaLabel(){return d(14059,null)}getAriaLabel(i){if(Fd(i)){let e=i.allDownstreamFileMatches().reduce((t,o)=>t+o.count(),0);return i.resource?d(14054,null,e,i.name()):d(14057,null,e)}if(_l(i)){let e=this.labelService.getUriLabel(i.resource,{relative:!0})||i.resource.fsPath;return d(14053,null,i.count(),i.name(),ad(e))}if(el(i)){let e=i,t=this.searchView.model,o=t.isReplaceActive()&&!!t.replaceString,n=e.getMatchString(),r=e.range(),s=e.text().substr(0,r.endColumn+150);return o?d(14058,null,s,r.startColumn,n,e.replaceString):d(14067,null,s,r.startColumn,n)}return null}};IVe=I([m(1,rt)],IVe);function Qoe(a){return a&&typeof a.bindNotebookEditorWidget=="function"&&typeof a.updateMatchesForEditorWidget=="function"&&typeof a.unbindNotebookEditorWidget=="function"&&typeof a.updateNotebookHighlights=="function"&&_l(a)}function CU(a){return typeof a=="object"&&a!==null&&typeof a.parent=="function"&&typeof a.cellParent=="object"&&typeof a.isWebviewMatch=="function"&&typeof a.cellIndex=="number"&&(typeof a.webviewIndex=="number"||a.webviewIndex===void 0)&&(typeof a.cell=="object"||a.cell===void 0)}var pNi=-1,mNi=-1;function TN(a,i,e="default"){if(_l(a)&&Fd(i))return 1;if(_l(i)&&Fd(a))return-1;if(Fd(a)&&Fd(i)){if(pNi=a.index(),mNi=i.index(),pNi!==-1&&mNi!==-1)return pNi-mNi;if(Cst(a)&&Cst(i))return a.rank-i.rank;switch(e){case"countDescending":return i.count()-a.count();case"countAscending":return a.count()-i.count();case"type":return xyi(a.name(),i.name());case"fileNames":return DT(a.name(),i.name());default:return!a.resource||!i.resource?0:KZ(a.resource.fsPath,i.resource.fsPath)||DT(a.name(),i.name())}}if(_l(a)&&_l(i))switch(e){case"countDescending":return i.count()-a.count();case"countAscending":return a.count()-i.count();case"type":return xyi(a.name(),i.name());case"fileNames":return DT(a.name(),i.name());case"modified":{let t=a.fileStat,o=i.fileStat;if(t&&o)return o.mtime-t.mtime}default:return KZ(a.resource.fsPath,i.resource.fsPath)||DT(a.name(),i.name())}return CU(a)&&CU(i)?Bcn(a,i):el(a)&&el(i)?z.compareRangesUsingStarts(a.range(),i.range()):0}function Bcn(a,i){return a.cellIndex===i.cellIndex?a.webviewIndex!==void 0&&i.webviewIndex!==void 0?a.webviewIndex-i.webviewIndex:a.webviewIndex===void 0&&i.webviewIndex===void 0?z.compareRangesUsingStarts(a.range(),i.range()):a.webviewIndex!==void 0?1:-1:a.cellIndex<i.cellIndex?-1:1}function d$t(a,i,e="default"){let t=wMi(a),o=wMi(i),n=t.length-1,r=o.length-1;for(;n>=0&&r>=0;){if(t[n].id()!==o[r].id())return TN(t[n],o[r],e);n--,r--}let s=n===0,l=r===0;return s&&!l?1:!s&&l?-1:0}var Dl=L(13975,"Search");function fxo(a){let i=qc(a);return!!(i&&Gr(i.getContainer()))}function qc(a){return a.getActiveViewWithId(Iy)}function kst(a,i,e){let t=a.getSelection().filter(o=>o!==null).sort((o,n)=>d$t(o,n,e.sortOrder));return i&&!(t.length>1&&t.includes(i))&&(t=[i]),t}function vxo(a,i){return i?!i||a.includes(i)||Hcn(a,i):!1}function Hcn(a,i){for(let e of a)if(_l(e)&&el(i)&&e.matches().includes(i)||Fd(e)&&(_l(i)&&e.getDownstreamFileMatch(i.resource)||el(i)&&e.getDownstreamFileMatch(i.parent().resource)))return!0;return!1}function JQ(a,i){return a.openView(Iy,i).then(e=>e??void 0)}var Kb=new Y("inSearchEditor",!1),yVe="search-editor",u$t="search/editor",gNi="searchEditorFindMatch",Est="workbench.editor.searchEditor",bxo="search.action.openNewEditor",Vfe="search.action.openEditor",p$t="toggleSearchEditorContextLines",Tst="workbench.editorinputs.searchEditorInput";var m$t=class extends Hz{constructor(e,t,o,n,r,s,l,c){super(e,t,o,n);this.contextMenuService=r;this.instantiationService=s;this.filters=l;this._filterChecked=!1;this._onDidChangeAIToggle=this._register(new E);this.onDidChangeAIToggle=this._onDidChangeAIToggle.event;this._findFilter=this._register(new vnt(l,r,s,o,d(14030,null))),this._updatePadding(),this.controls.appendChild(this._findFilter.container),this._findFilter.container.classList.add("monaco-custom-toggle"),this.filterVisible=c}_updatePadding(){this.inputBox.paddingRight=(this.caseSensitive?.visible?this.caseSensitive.width():0)+(this.wholeWords?.visible?this.wholeWords.width():0)+(this.regex?.visible?this.regex.width():0)+(this._findFilter.visible?this._findFilter.width():0)}set filterVisible(e){this._findFilter.visible=e,this.updateFilterStyles(),this._updatePadding()}setEnabled(e){super.setEnabled(e),e&&(!this._filterChecked||!this._findFilter.visible)?this.regex?.enable():this.regex?.disable()}updateFilterStyles(){this._filterChecked=!this.filters.markupInput||!this.filters.markupPreview||!this.filters.codeInput||!this.filters.codeOutput,this._findFilter.applyStyles(this._filterChecked)}};var wxo=26,wVe=class a extends it{constructor(e){super(a.ID,"",q.asClassName(sxo),!1);this._searchWidget=e}static{this.ID="search.action.replaceAll"}set searchWidget(e){this._searchWidget=e}run(){return this._searchWidget?this._searchWidget.triggerReplaceAll():Promise.resolve()}},vNi={groupId:"search-widget"},Sxo=Ze?256:2048;function Ixo(a,i,e){let t=!!i.match(/\n/);if(e&&(t||e.clientHeight>wxo)&&e.selectionStart>0){a.stopPropagation();return}}function yxo(a,i,e){let t=!!i.match(/\n/);if(e&&(t||e.clientHeight>wxo)&&e.selectionEnd<e.value.length){a.stopPropagation();return}}var KM=class extends ja{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this.contextViewService=o;this.contextKeyService=n;this.keybindingService=r;this.clipboardServce=s;this.configurationService=l;this.accessibilityService=c;this.contextMenuService=u;this.instantiationService=p;this.editorService=h;this.ignoreGlobalFindBufferOnNextFocus=!1;this.previousGlobalFindBufferValue=null;this._accessibilityHelpHintAnnounced=!1;this._onSearchSubmit=this._register(new E);this.onSearchSubmit=this._onSearchSubmit.event;this._onSearchCancel=this._register(new E);this.onSearchCancel=this._onSearchCancel.event;this._onReplaceToggled=this._register(new E);this.onReplaceToggled=this._onReplaceToggled.event;this._onReplaceStateChange=this._register(new E);this.onReplaceStateChange=this._onReplaceStateChange.event;this._onPreserveCaseChange=this._register(new E);this.onPreserveCaseChange=this._onPreserveCaseChange.event;this._onReplaceValueChanged=this._register(new E);this.onReplaceValueChanged=this._onReplaceValueChanged.event;this._onReplaceAll=this._register(new E);this.onReplaceAll=this._onReplaceAll.event;this._onBlur=this._register(new E);this.onBlur=this._onBlur.event;this._onDidHeightChange=this._register(new E);this.onDidHeightChange=this._onDidHeightChange.event;this._onDidToggleContext=this._register(new E);this.onDidToggleContext=this._onDidToggleContext.event;this.replaceActive=_i.ReplaceActiveKey.bindTo(this.contextKeyService),this.searchInputBoxFocused=_i.SearchInputBoxFocusedKey.bindTo(this.contextKeyService),this.replaceInputBoxFocused=_i.ReplaceInputBoxFocusedKey.bindTo(this.contextKeyService);let g=t.notebookOptions??{isInNotebookMarkdownInput:!0,isInNotebookMarkdownPreview:!0,isInNotebookCellInput:!0,isInNotebookCellOutput:!0};this._notebookFilters=this._register(new pFe(g.isInNotebookMarkdownInput,g.isInNotebookMarkdownPreview,g.isInNotebookCellInput,g.isInNotebookCellOutput,{findScopeType:"none"})),this._register(this._notebookFilters.onDidChange(()=>{this.searchInput&&this.searchInput.updateFilterStyles()})),this._register(this.editorService.onDidEditorsChange(f=>{this.searchInput&&f.event.editor instanceof Ra&&(f.event.kind===5||f.event.kind===6)&&(this.searchInput.filterVisible=this._hasNotebookOpen())})),this._replaceHistoryDelayer=new Xo(500),this._toggleReplaceButtonListener=this._register(new me),this.render(e,t),this._register(this.configurationService.onDidChangeConfiguration(f=>{f.affectsConfiguration("editor.accessibilitySupport")&&this.updateAccessibilitySupport()})),this._register(this.accessibilityService.onDidChangeScreenReaderOptimized(()=>this.updateAccessibilitySupport())),this.updateAccessibilitySupport()}static{this.INPUT_MAX_HEIGHT=134}static{this.REPLACE_ALL_DISABLED_LABEL=d(14128,null)}static{this.REPLACE_ALL_ENABLED_LABEL=e=>e.appendKeybinding(d(14129,null),wVe.ID)}_hasNotebookOpen(){return this.editorService.editors.some(t=>t instanceof Ra)}getNotebookFilters(){return this._notebookFilters}focus(e=!0,t=!1,o=!1){this.ignoreGlobalFindBufferOnNextFocus=o,t&&this.isReplaceShown()?this.replaceInput&&(this._updateSearchInputAriaLabel(!1),this.replaceInput.focus(),e&&this.replaceInput.select()):this.searchInput&&(this._updateSearchInputAriaLabel(!0),this.searchInput.focus(),e&&this.searchInput.select())}_updateSearchInputAriaLabel(e){if(!this.searchInput)return;let t=d(14127,null);if(e&&!this._accessibilityHelpHintAnnounced&&this.configurationService.getValue("accessibility.verbosity.find")&&this.accessibilityService.isScreenReaderOptimized()){let o=this.keybindingService.lookupKeybinding("editor.action.accessibilityHelp")?.getAriaLabel();o&&(t+=", "+d(14125,null,o),this._accessibilityHelpHintAnnounced=!0,this._labelResetTimeout?.dispose(),this._labelResetTimeout=tn(()=>{this.searchInput&&this.searchInput.inputBox.setAriaLabel(d(14127,null))},1e3))}this.searchInput.inputBox.setAriaLabel(t)}setWidth(e){this.searchInput?.inputBox.layout(),this.replaceInput&&(this.replaceInput.width=e-28,this.replaceInput.inputBox.layout())}clear(){this.searchInput?.clear(),this.replaceInput?.setValue(""),this.setReplaceAllActionState(!1)}isReplaceShown(){return this.replaceContainer?!this.replaceContainer.classList.contains("disabled"):!1}isReplaceActive(){return!!this.replaceActive.get()}getReplaceValue(){return this.replaceInput?.getValue()??""}toggleReplace(e){(e===void 0||e!==this.isReplaceShown())&&this.onToggleReplaceButton()}getSearchHistory(){return this.searchInput?.inputBox.getHistory()??[]}getReplaceHistory(){return this.replaceInput?.inputBox.getHistory()??[]}prependSearchHistory(e){this.searchInput?.inputBox.prependHistory(e)}prependReplaceHistory(e){this.replaceInput?.inputBox.prependHistory(e)}clearHistory(){this.searchInput?.inputBox.clearHistory(),this.replaceInput?.inputBox.clearHistory()}showNextSearchTerm(){this.searchInput?.inputBox.showNextValue()}showPreviousSearchTerm(){this.searchInput?.inputBox.showPreviousValue()}showNextReplaceTerm(){this.replaceInput?.inputBox.showNextValue()}showPreviousReplaceTerm(){this.replaceInput?.inputBox.showPreviousValue()}searchInputHasFocus(){return!!this.searchInputBoxFocused.get()}replaceInputHasFocus(){return!!this.replaceInput?.inputBox.hasFocus()}focusReplaceAllAction(){this.replaceActionBar?.focus(!0)}focusRegexAction(){this.searchInput?.focusOnRegex()}set replaceButtonVisibility(e){this.toggleReplaceButton&&(this.toggleReplaceButton.element.style.display=e?"":"none")}render(e,t){this.domNode=M(e,_(".search-widget")),this.domNode.style.position="relative",t._hideReplaceToggle||this.renderToggleReplaceButton(this.domNode),this.renderSearchInput(this.domNode,t),this.renderReplaceInput(this.domNode,t)}updateAccessibilitySupport(){this.searchInput?.setFocusInputOnOptionClick(!this.accessibilityService.isScreenReaderOptimized())}renderToggleReplaceButton(e){let t={buttonBackground:void 0,buttonBorder:void 0,buttonForeground:void 0,buttonHoverBackground:void 0,buttonSecondaryBackground:void 0,buttonSecondaryForeground:void 0,buttonSecondaryHoverBackground:void 0,buttonSeparator:void 0,title:d(14132,null),hoverDelegate:Ri("element")};this.toggleReplaceButton=this._register(new Wi(e,t)),this.toggleReplaceButton.element.setAttribute("aria-expanded","false"),this.toggleReplaceButton.element.classList.add("toggle-replace-button"),this.toggleReplaceButton.icon=s$t,this._toggleReplaceButtonListener.value=this.toggleReplaceButton.onDidClick(()=>this.onToggleReplaceButton())}renderSearchInput(e,t){let o=t.searchHistory||[],n={label:d(14127,null),validation:s=>this.validateSearchInput(s),placeholder:d(14130,null),appendCaseSensitiveLabel:this.keybindingService.appendKeybinding("","toggleSearchCaseSensitive"),appendWholeWordsLabel:this.keybindingService.appendKeybinding("","toggleSearchWholeWord"),appendRegexLabel:this.keybindingService.appendKeybinding("","toggleSearchRegex"),history:new Set(o),showHistoryHint:()=>bR(this.keybindingService),flexibleHeight:!0,flexibleMaxHeight:KM.INPUT_MAX_HEIGHT,showCommonFindToggles:!0,inputBoxStyles:t.inputBoxStyles,toggleStyles:t.toggleStyles,hoverLifecycleOptions:vNi},r=M(e,_(".search-container.input-box"));this.searchInput=this._register(new m$t(r,this.contextViewService,n,this.contextKeyService,this.contextMenuService,this.instantiationService,this._notebookFilters,this._hasNotebookOpen())),this._register(this.searchInput.onKeyDown(s=>this.onSearchInputKeyDown(s))),this.searchInput.setValue(t.value||""),this.searchInput.setRegex(!!t.isRegex),this.searchInput.setCaseSensitive(!!t.isCaseSensitive),this.searchInput.setWholeWords(!!t.isWholeWords),this._register(this.searchInput.onCaseSensitiveKeyDown(s=>this.onCaseSensitiveKeyDown(s))),this._register(this.searchInput.onRegexKeyDown(s=>this.onRegexKeyDown(s))),this._register(this.searchInput.inputBox.onDidChange(()=>this.onSearchInputChanged())),this._register(this.searchInput.inputBox.onDidHeightChange(()=>this._onDidHeightChange.fire())),this._register(this.onReplaceValueChanged(()=>{this._replaceHistoryDelayer.trigger(()=>this.replaceInput?.inputBox.addToHistory())})),this.searchInputFocusTracker=this._register(qn(this.searchInput.inputBox.inputElement)),this._register(this.searchInputFocusTracker.onDidFocus(async()=>{this.searchInputBoxFocused.set(!0);let s=this.searchConfiguration.globalFindClipboard;if(!this.ignoreGlobalFindBufferOnNextFocus&&s){let l=await this.clipboardServce.readFindText();l&&this.previousGlobalFindBufferValue!==l&&(this.searchInput?.inputBox.addToHistory(),this.searchInput?.setValue(l),this.searchInput?.select()),this.previousGlobalFindBufferValue=l}this.ignoreGlobalFindBufferOnNextFocus=!1})),this._register(this.searchInputFocusTracker.onDidBlur(()=>this.searchInputBoxFocused.set(!1))),this.showContextToggle=new cm({isChecked:!1,title:this.keybindingService.appendKeybinding(d(14133,null),p$t),icon:rxo,hoverLifecycleOptions:vNi,...gh}),this._register(this.showContextToggle.onChange(()=>this.onContextLinesChanged())),t.showContextToggle&&(this.contextLinesInput=new Vc(r,this.contextViewService,{type:"number",inputBoxStyles:Cl}),this.contextLinesInput.element.classList.add("context-lines-input"),this.contextLinesInput.value=""+(this.configurationService.getValue("search").searchEditor.defaultNumberOfContextLines??1),this._register(this.contextLinesInput.onDidChange(s=>{s!=="0"&&(this.showContextToggle.checked=!0),this.onContextLinesChanged()})),M(r,this.showContextToggle.domNode))}onContextLinesChanged(){this._onDidToggleContext.fire(),this.contextLinesInput.value.includes("-")&&(this.contextLinesInput.value="0"),this._onDidToggleContext.fire()}setContextLines(e){this.contextLinesInput&&(e===0?this.showContextToggle.checked=!1:(this.showContextToggle.checked=!0,this.contextLinesInput.value=""+e))}renderReplaceInput(e,t){this.replaceContainer=M(e,_(".replace-container.disabled"));let o=M(this.replaceContainer,_(".replace-input"));this.replaceInput=this._register(new Uz(o,this.contextViewService,{label:d(14126,null),placeholder:d(14131,null),appendPreserveCaseLabel:this.keybindingService.appendKeybinding("","toggleSearchPreserveCase"),history:new Set(t.replaceHistory),showHistoryHint:()=>bR(this.keybindingService),flexibleHeight:!0,flexibleMaxHeight:KM.INPUT_MAX_HEIGHT,inputBoxStyles:t.inputBoxStyles,toggleStyles:t.toggleStyles,hoverLifecycleOptions:vNi},this.contextKeyService,!0)),this._register(this.replaceInput.onDidOptionChange(n=>{n||this.replaceInput&&this._onPreserveCaseChange.fire(this.replaceInput.getPreserveCase())})),this._register(this.replaceInput.onKeyDown(n=>this.onReplaceInputKeyDown(n))),this.replaceInput.setValue(t.replaceValue||""),this._register(this.replaceInput.inputBox.onDidChange(()=>this._onReplaceValueChanged.fire())),this._register(this.replaceInput.inputBox.onDidHeightChange(()=>this._onDidHeightChange.fire())),this.replaceAllAction=new wVe(this),this.replaceAllAction.label=KM.REPLACE_ALL_DISABLED_LABEL,this.replaceActionBar=this._register(new Zi(this.replaceContainer)),this.replaceActionBar.push([this.replaceAllAction],{icon:!0,label:!1}),this.onkeydown(this.replaceActionBar.domNode,n=>this.onReplaceActionbarKeyDown(n)),this.replaceInputFocusTracker=this._register(qn(this.replaceInput.inputBox.inputElement)),this._register(this.replaceInputFocusTracker.onDidFocus(()=>this.replaceInputBoxFocused.set(!0))),this._register(this.replaceInputFocusTracker.onDidBlur(()=>this.replaceInputBoxFocused.set(!1))),this._register(this.replaceInput.onPreserveCaseKeyDown(n=>this.onPreserveCaseKeyDown(n)))}triggerReplaceAll(){return this._onReplaceAll.fire(),Promise.resolve()}onToggleReplaceButton(){this.replaceContainer?.classList.toggle("disabled"),this.isReplaceShown()?(this.toggleReplaceButton?.element.classList.remove(...q.asClassNameArray(s$t)),this.toggleReplaceButton?.element.classList.add(...q.asClassNameArray(dNi))):(this.toggleReplaceButton?.element.classList.remove(...q.asClassNameArray(dNi)),this.toggleReplaceButton?.element.classList.add(...q.asClassNameArray(s$t))),this.toggleReplaceButton?.element.setAttribute("aria-expanded",this.isReplaceShown()?"true":"false"),this.updateReplaceActiveState(),this._onReplaceToggled.fire()}setValue(e){this.searchInput?.setValue(e)}setReplaceAllActionState(e){this.replaceAllAction&&this.replaceAllAction.enabled!==e&&(this.replaceAllAction.enabled=e,this.replaceAllAction.label=e?KM.REPLACE_ALL_ENABLED_LABEL(this.keybindingService):KM.REPLACE_ALL_DISABLED_LABEL,this.updateReplaceActiveState())}updateReplaceActiveState(){let e=this.isReplaceActive(),t=this.isReplaceShown()&&!!this.replaceAllAction?.enabled;e!==t&&(this.replaceActive.set(t),this._onReplaceStateChange.fire(t),this.replaceInput?.inputBox.layout())}validateSearchInput(e){if(e.length===0||!this.searchInput?.getRegex())return null;try{new RegExp(e,"u")}catch(t){return{content:t.message}}return null}onSearchInputChanged(){if(this.searchInput?.clearMessage(),this.setReplaceAllActionState(!1),this.searchConfiguration.searchOnType)if(this.searchInput?.getRegex())try{let e=new RegExp(this.searchInput.getValue(),"ug"),t=`
								~!@#$%^&*()_+
								\`1234567890-=
								qwertyuiop[]\\
								QWERTYUIOP{}|
								asdfghjkl;'
								ASDFGHJKL:"
								zxcvbnm,./
								ZXCVBNM<>? `.match(e)?.length??0,o=t<50?1:t<100?5:10;this.submitSearch(!0,this.searchConfiguration.searchOnTypeDebouncePeriod*o)}catch{}else this.submitSearch(!0,this.searchConfiguration.searchOnTypeDebouncePeriod)}onSearchInputKeyDown(e){if(e.equals(Sxo|3)&&(this.searchInput?.inputBox.insertAtCursor(`
`),e.preventDefault()),e.equals(3))this.searchInput?.onSearchSubmit(),this.submitSearch(),e.preventDefault();else if(e.equals(9))this._onSearchCancel.fire({focus:!0}),e.preventDefault();else if(e.equals(2))this.isReplaceShown()?this.replaceInput?.focus():this.searchInput?.focusOnCaseSensitive(),e.preventDefault();else if(e.equals(16))Ixo(e,this.searchInput?.getValue()??"",this.searchInput?.domNode.querySelector("textarea")??null);else if(e.equals(18))yxo(e,this.searchInput?.getValue()??"",this.searchInput?.domNode.querySelector("textarea")??null);else if(e.equals(11)){let t=this.searchInput?.inputBox.inputElement;t&&(t.setSelectionRange(0,0),t.focus(),e.preventDefault())}else if(e.equals(12)){let t=this.searchInput?.inputBox.inputElement;if(t){let o=t.value.length;t.setSelectionRange(o,o),t.focus(),e.preventDefault()}}}onCaseSensitiveKeyDown(e){e.equals(1026)&&this.isReplaceShown()&&(this.replaceInput?.focus(),e.preventDefault())}onRegexKeyDown(e){e.equals(2)&&this.isReplaceShown()&&(this.replaceInput?.focusOnPreserve(),e.preventDefault())}onPreserveCaseKeyDown(e){e.equals(2)?(this.isReplaceActive()?this.focusReplaceAllAction():this._onBlur.fire(),e.preventDefault()):e.equals(1026)&&(this.focusRegexAction(),e.preventDefault())}onReplaceInputKeyDown(e){e.equals(Sxo|3)&&(this.replaceInput?.inputBox.insertAtCursor(`
`),e.preventDefault()),e.equals(3)?(this.submitSearch(),e.preventDefault()):e.equals(2)?(this.searchInput?.focusOnCaseSensitive(),e.preventDefault()):e.equals(1026)?(this.searchInput?.focus(),e.preventDefault()):e.equals(16)?Ixo(e,this.replaceInput?.getValue()??"",this.replaceInput?.domNode.querySelector("textarea")??null):e.equals(18)&&yxo(e,this.replaceInput?.getValue()??"",this.replaceInput?.domNode.querySelector("textarea")??null)}onReplaceActionbarKeyDown(e){e.equals(1026)&&(this.focusRegexAction(),e.preventDefault())}async submitSearch(e=!1,t=0){if(this.searchInput?.validate(),!this.searchInput?.inputBox.isInputValid())return;let o=this.searchInput.getValue(),n=this.searchConfiguration.globalFindClipboard;o&&n&&await this.clipboardServce.writeFindText(o),this._onSearchSubmit.fire({triggeredOnType:e,delay:t})}getContextLines(){return this.showContextToggle.checked?+this.contextLinesInput.value:0}modifyContextLines(e){let o=+this.contextLinesInput.value+(e?1:-1);this.showContextToggle.checked=o!==0,this.contextLinesInput.value=""+o}toggleContextLines(){this.showContextToggle.checked=!this.showContextToggle.checked,this.onContextLinesChanged()}dispose(){this.setReplaceAllActionState(!1),super.dispose()}get searchConfiguration(){return this.configurationService.getValue("search")}};KM=I([m(2,Wn),m(3,X),m(4,_e),m(5,Fi),m(6,B),m(7,Oi),m(8,Xe),m(9,F),m(10,ee)],KM);function Cxo(){Ct.registerCommandAndKeybindingRule({id:wVe.ID,weight:200,when:C.and(_i.SearchViewVisibleKey,_i.ReplaceActiveKey,Y9i),primary:2563,handler:a=>{let i=a.get($t);if(fxo(i)){let e=qc(i);e&&new wVe(e.searchAndReplaceWidget).run()}}})}var EI=le("replaceService");var CVe=le("searchHistoryService"),_N=class{constructor(i){this.storageService=i;this._onDidClearHistory=new E;this.onDidClearHistory=this._onDidClearHistory.event}static{this.SEARCH_HISTORY_KEY="workbench.search.history"}clearHistory(){this.storageService.remove(_N.SEARCH_HISTORY_KEY,1),this._onDidClearHistory.fire()}load(){let i,e=this.storageService.get(_N.SEARCH_HISTORY_KEY,1);if(e)try{i=JSON.parse(e)}catch{}return i||{}}save(i){Of(i)?this.storageService.remove(_N.SEARCH_HISTORY_KEY,1):this.storageService.store(_N.SEARCH_HISTORY_KEY,JSON.stringify(i),1,0)}};_N=I([m(0,ce)],_N);var xxo=`
`,bNi=a=>i=>new z(i.startLineNumber+a,i.startColumn,i.endLineNumber+a,i.endColumn),Ucn=(a,i)=>{let e=n=>`${a.range().startLineNumber+n}`,t=a.fullPreviewLines(),o=[];return t.forEach((n,r)=>{let s=e(r),c=`  ${" ".repeat(i-s.length)}${s}: `,u=c.length,p=c+(n.split(/\r?\n?$/,1)[0]||""),h=({start:b,end:S})=>new z(1,(b??1)+u,1,(S??n.length+1)+u),g=a.rangeInPreview(),f=g.startLineNumber===g.endLineNumber,v;f?v=h({start:g.startColumn,end:g.endColumn}):r===0?v=h({start:g.startColumn}):r===t.length-1?v=h({end:g.endColumn}):v=h({}),o.push({lineNumber:s,line:p,ranges:[v]})}),o};function zcn(a,i){let e=a.textMatches().length>0?kxo(a.resource,a.textMatches().sort(TN),a.context,i):void 0,t=Qoe(a)?a.cellMatches().sort((o,n)=>o.cellIndex-n.cellIndex).sort().filter(o=>o.contentMatches.length>0).map((o,n)=>Kcn(o,i,n===0)):[];return[e,...t].filter(o=>!!o)}function kxo(a,i,e,t,o=!0){let n=i[i.length-1].range().endLineNumber.toString().length,r=o?[`${t(a)}:`]:[],s=[],l={},c=[];e.forEach((h,g)=>c.push({line:h,lineNumber:g})),c.sort((h,g)=>h.lineNumber-g.lineNumber);let u,p=new Set;for(i.forEach(h=>{Ucn(h,n).forEach(g=>{if(!p.has(g.lineNumber)){for(;c.length&&c[0].lineNumber<+g.lineNumber;){let{line:f,lineNumber:v}=c.shift();u!==void 0&&v!==u+1&&r.push(""),r.push(`  ${" ".repeat(n-`${v}`.length)}${v}  ${f}`),u=v}l[g.lineNumber]=r.length,p.add(g.lineNumber),r.push(g.line),u=+g.lineNumber}s.push(...g.ranges.map(bNi(l[g.lineNumber])))})});c.length;){let{line:h,lineNumber:g}=c.shift();r.push(`  ${g}  ${h}`)}return{text:r,matchRanges:s}}function Kcn(a,i,e){return kxo(a.cell?.uri??a.parent.resource,a.contentMatches.sort(TN),a.context,i,e)}var Gcn=(a,i,e,t)=>({query:a.contentPattern.pattern,isRegexp:!!a.contentPattern.isRegExp,isCaseSensitive:!!a.contentPattern.isCaseSensitive,matchWholeWord:!!a.contentPattern.isWordMatch,filesToExclude:e,filesToInclude:i,showIncludesExcludes:!!(i||e||a?.userDisabledExcludesAndIgnoreFiles),useExcludeSettingsAndIgnoreFiles:a?.userDisabledExcludesAndIgnoreFiles===void 0?!0:!a.userDisabledExcludesAndIgnoreFiles,contextLines:t,onlyOpenEditors:!!a.onlyOpenEditors,notebookSearchConfig:{includeMarkupInput:!!a.contentPattern.notebookInfo?.isInNotebookMarkdownInput,includeMarkupPreview:!!a.contentPattern.notebookInfo?.isInNotebookMarkdownPreview,includeCodeInput:!!a.contentPattern.notebookInfo?.isInNotebookCellInput,includeOutput:!!a.contentPattern.notebookInfo?.isInNotebookCellOutput}}),Exo=a=>(t=>t.filter(o=>o!==!1&&o!==null&&o!==void 0))([`# Query: ${(t=>t.replace(/\\/g,"\\\\").replace(/\n/g,"\\n"))(a.query??"")}`,(a.isCaseSensitive||a.matchWholeWord||a.isRegexp||a.useExcludeSettingsAndIgnoreFiles===!1)&&`# Flags: ${di([a.isCaseSensitive&&"CaseSensitive",a.matchWholeWord&&"WordMatch",a.isRegexp&&"RegExp",a.onlyOpenEditors&&"OpenEditors",a.useExcludeSettingsAndIgnoreFiles===!1&&"IgnoreExcludeSettings"]).join(" ")}`,a.filesToInclude?`# Including: ${a.filesToInclude}`:void 0,a.filesToExclude?`# Excluding: ${a.filesToExclude}`:void 0,a.contextLines?`# ContextLines: ${a.contextLines}`:void 0,""]).join(xxo);var SNi=()=>({query:"",filesToInclude:"",filesToExclude:"",isRegexp:!1,isCaseSensitive:!1,useExcludeSettingsAndIgnoreFiles:!0,matchWholeWord:!1,contextLines:0,showIncludesExcludes:!1,onlyOpenEditors:!1,notebookSearchConfig:{includeMarkupInput:!0,includeMarkupPreview:!1,includeCodeInput:!0,includeOutput:!0}}),qcn=a=>{let i=SNi(),e=o=>{let n="";for(let r=0;r<o.length;r++)if(o[r]==="\\"){r++;let s=o[r];if(s==="n")n+=`
`;else if(s==="\\")n+="\\";else throw Error(d(14169,null))}else n+=o[r];return n},t=/^# ([^:]*): (.*)$/;for(let o of a){let n=t.exec(o);if(!n)continue;let[,r,s]=n;switch(r){case"Query":i.query=e(s);break;case"Including":i.filesToInclude=s;break;case"Excluding":i.filesToExclude=s;break;case"ContextLines":i.contextLines=+s;break;case"Flags":i.isRegexp=s.indexOf("RegExp")!==-1,i.isCaseSensitive=s.indexOf("CaseSensitive")!==-1,i.useExcludeSettingsAndIgnoreFiles=s.indexOf("IgnoreExcludeSettings")===-1,i.matchWholeWord=s.indexOf("WordMatch")!==-1,i.onlyOpenEditors=s.indexOf("OpenEditors")!==-1}}return i.showIncludesExcludes=!!(i.filesToInclude||i.filesToExclude||!i.useExcludeSettingsAndIgnoreFiles),i},h$t=(a,i,e,t,o,n,r)=>{if(!a.query)throw Error("Internal Error: Expected query, got null");let s=Gcn(a.query,i,e,t),l=a.fileCount()>1?d(14171,null,a.fileCount()):d(14173,null),c=a.count()>1?d(14172,null,a.count()):d(14174,null),u=[a.count()?`${c} - ${l}`:d(14170,null)];r&&u.push(d(14175,null)),u.push("");let p=(g,f)=>TN(g,f,n),h=$cn(a.folderMatches().sort(p).map(g=>g.allDownstreamFileMatches().sort(p).flatMap(f=>zcn(f,o))).flat());return{matchRanges:h.matchRanges.map(bNi(u.length)),text:u.concat(h.text).join(xxo),config:s}},$cn=a=>{let i=[],e=[];return a.forEach(t=>{t.matchRanges.map(bNi(i.length)).forEach(o=>e.push(o)),t.text.forEach(o=>i.push(o)),i.push("")}),{text:i,matchRanges:e}},g$t=async(a,i)=>{let t=(await a.get(Uo).read(i)).value;return INi(t)},INi=a=>{let i=[],e=[],t=!0;for(let o of a.split(/\r?\n/g))t?(i.push(o),o===""&&(t=!1)):e.push(o);return{config:qcn(i),text:e.join(`
`)}};var xVe=class{constructor(i){this.config=i;this._onConfigDidUpdate=new E;this.onConfigDidUpdate=this._onConfigDidUpdate.event}updateConfig(i){this.config=i,this._onConfigDidUpdate.fire(i)}},f$t=class{constructor(i){this.resource=i}async resolve(){return Ci(kVe.models.get(this.resource)).resolve()}},yNi=class{constructor(){this.models=new gt}initializeModelFromExistingModel(i,e,t){if(this.models.has(e))throw Error("Unable to contruct model for resource that already exists");let o=i.get(_t),n=i.get(Tt),r=i.get(F),s=i.get(hm),l;this.models.set(e,{resolve:()=>(l||(l=(async()=>{let c=await this.tryFetchModelFromBackupService(e,o,n,s,r);return c||Promise.resolve({resultsModel:n.getModel(e)??n.createModel("",o.createById(a2),e),configurationModel:new xVe(t)})})()),l)})}initializeModelFromRawData(i,e,t,o){if(this.models.has(e))throw Error("Unable to contruct model for resource that already exists");let n=i.get(_t),r=i.get(Tt),s=i.get(F),l=i.get(hm),c;this.models.set(e,{resolve:()=>(c||(c=(async()=>{let u=await this.tryFetchModelFromBackupService(e,n,r,l,s);return u||Promise.resolve({resultsModel:r.createModel(o??"",n.createById(a2),e),configurationModel:new xVe(t)})})()),c)})}initializeModelFromExistingFile(i,e,t){if(this.models.has(e))throw Error("Unable to contruct model for resource that already exists");let o=i.get(_t),n=i.get(Tt),r=i.get(F),s=i.get(hm),l;this.models.set(e,{resolve:async()=>(l||(l=(async()=>{let c=await this.tryFetchModelFromBackupService(e,o,n,s,r);if(c)return c;let{text:u,config:p}=await r.invokeFunction(g$t,t);return{resultsModel:n.createModel(u??"",o.createById(a2),e),configurationModel:new xVe(p)}})()),l)})}async tryFetchModelFromBackupService(i,e,t,o,n){let r=await o.resolve({resource:i,typeId:u$t}),s=t.getModel(i);if(!s&&r){let l=await iY(r.value);s=t.createModel(l,e.createById(a2),i)}if(s){let l=s.getValue(),{text:c,config:u}=INi(l);return t.destroyModel(i),{resultsModel:t.createModel(c??"",e.createById(a2),i),configurationModel:new xVe(u)}}else return}},kVe=new yNi;var EVe=".code-search",jcn=Ae("search-editor-label-icon",R.search,d(14166,null)),Pp=class extends ls{constructor(e,t,o,n,r,s,l,c,u,p){super();this.modelUri=e;this.backingUri=t;this.modelService=o;this.textFileService=n;this.fileDialogService=r;this.instantiationService=s;this.workingCopyService=l;this.telemetryService=c;this.pathService=u;this.dirty=!1;this._onDidChangeContent=this._register(new E);this.onDidChangeContent=this._onDidChangeContent.event;this._onDidSave=this._register(new E);this.onDidSave=this._onDidSave.event;this.oldDecorationsIDs=[];if(this.model=s.createInstance(f$t,e),this.modelUri.scheme!==yVe)throw Error("SearchEditorInput must be invoked with a SearchEditorScheme uri");this.memento=new Al(Pp.ID,p),this._register(p.onWillSaveState(()=>this.memento.saveMemento()));let h=this,g=new class{constructor(){this.typeId=u$t;this.resource=h.modelUri;this.capabilities=h.hasCapability(4)?2:0;this.onDidChangeDirty=h.onDidChangeDirty;this.onDidChangeContent=h.onDidChangeContent;this.onDidSave=h.onDidSave}get name(){return h.getName()}isDirty(){return h.isDirty()}isModified(){return h.isDirty()}backup(f){return h.backup(f)}save(f){return h.save(0,f).then(v=>!!v)}revert(f){return h.revert(0,f)}};this._register(this.workingCopyService.registerWorkingCopy(g))}static{this.ID=Tst}get typeId(){return Pp.ID}get editorId(){return this.typeId}getIcon(){return jcn}get capabilities(){let e=0;return this.backingUri||(e|=4),e}get resource(){return this.backingUri||this.modelUri}async save(e,t){if(!(await this.resolveModels()).resultsModel.isDisposed())return this.backingUri?(await this.textFileService.write(this.backingUri,await this.serializeForDisk(),t),this.setDirty(!1),this._onDidSave.fire({reason:t?.reason,source:t?.source}),this):this.saveAs(e,t)}tryReadConfigSync(){return this._cachedConfigurationModel?.config}async serializeForDisk(){let{configurationModel:e,resultsModel:t}=await this.resolveModels();return Exo(e.config)+`
`+t.getValue()}registerConfigChangeListeners(e){this.configChangeListenerDisposable?.dispose(),this.isDisposed()||(this.configChangeListenerDisposable=e.onConfigDidUpdate(()=>{this.lastLabel!==this.getName()&&(this._onDidChangeLabel.fire(),this.lastLabel=this.getName()),this.memento.getMemento(1,1).searchConfig=e.config}),this._register(this.configChangeListenerDisposable))}async resolveModels(){return this.model.resolve().then(e=>(this._cachedResultsModel=e.resultsModel,this._cachedConfigurationModel=e.configurationModel,this.lastLabel!==this.getName()&&(this._onDidChangeLabel.fire(),this.lastLabel=this.getName()),this.registerConfigChangeListeners(e.configurationModel),e))}async saveAs(e,t){let o=await this.fileDialogService.pickFileToSave(await this.suggestFileName(),t?.availableFileSystems);if(o){this.telemetryService.publicLog2("searchEditor/saveSearchResults");let n=await this.serializeForDisk();if(await this.textFileService.create([{resource:o,value:n,options:{overwrite:!0}}])){if(this.setDirty(!1),!Qe(o,this.modelUri)){let r=this.instantiationService.invokeFunction(DN,{fileUri:o,from:"existingFile"});return r.setMatchRanges(this.getMatchRanges()),r}return this}}}getName(e=12){let t=n=>n.length<e?n:`${n.slice(0,e-3)}...`;if(this.backingUri){let n=po.getOriginalUri(this);return d(14168,null,jo((n??this.backingUri).path,EVe))}let o=this._cachedConfigurationModel?.config?.query?.trim();return o?d(14168,null,t(o)):d(14167,null)}setDirty(e){let t=this.dirty;this.dirty=e,t!==e&&this._onDidChangeDirty.fire()}isDirty(){return this.dirty}async rename(e,t){if(es(t)===EVe)return{editor:this.instantiationService.invokeFunction(DN,{from:"existingFile",fileUri:t})}}dispose(){this.modelService.destroyModel(this.modelUri),super.dispose()}matches(e){return super.matches(e)?!0:e instanceof Pp?!!(e.modelUri.fragment&&e.modelUri.fragment===this.modelUri.fragment)||!!(e.backingUri&&Qe(e.backingUri,this.backingUri)):!1}getMatchRanges(){return(this._cachedResultsModel?.getAllDecorations()??[]).filter(e=>e.options.className===gNi).filter(({range:e})=>!(e.startColumn===1&&e.endColumn===1)).map(({range:e})=>e)}async setMatchRanges(e){this.oldDecorationsIDs=(await this.resolveModels()).resultsModel.deltaDecorations(this.oldDecorationsIDs,e.map(t=>({range:t,options:{description:"search-editor-find-match",className:gNi,stickiness:1}})))}async revert(e,t){if(t?.soft){this.setDirty(!1);return}if(this.backingUri){let{config:o,text:n}=await this.instantiationService.invokeFunction(g$t,this.backingUri),{resultsModel:r,configurationModel:s}=await this.resolveModels();r.setValue(n),s.updateConfig(o)}else(await this.resolveModels()).resultsModel.setValue("");super.revert(e,t),this.setDirty(!1)}async backup(e){let t=await this.serializeForDisk();return e.isCancellationRequested?{}:{content:SIe(qe.fromString(t))}}async suggestFileName(){let t=((await this.resolveModels()).configurationModel.config.query.replace(/[^\w \-_]+/g,"_")||"Search")+EVe;return Ge(await this.fileDialogService.defaultFilePath(this.pathService.defaultUriScheme),t)}toUntyped(){if(!this.hasCapability(4))return{resource:this.resource,options:{override:Pp.ID}}}copy(){let e=A.from({scheme:yVe,fragment:`${Math.random()}`}),t=this._cachedConfigurationModel?.config??{},o=this._cachedResultsModel?.getValue()??"";return this.instantiationService.invokeFunction(DN,{from:"rawData",config:t,resultsContents:o,modelUri:e})}};Pp=I([m(2,Tt),m(3,Uo),m(4,rn),m(5,F),m(6,Xa),m(7,Te),m(8,An),m(9,ce)],Pp);var DN=(a,i)=>{let e=a.get(ce),t=a.get(B),o=a.get(F),n;if(i.from==="model"||i.from==="rawData"&&i.modelUri?n=i.modelUri:n=A.from({scheme:yVe,fragment:`${Math.random()}`}),!kVe.models.has(n))if(i.from==="existingFile")o.invokeFunction(r=>kVe.initializeModelFromExistingFile(r,n,i.fileUri));else{let r=t.getValue("search").searchEditor,s=r.reusePriorSearchConfiguration,l=r.defaultNumberOfContextLines,c=s?new Al(Pp.ID,e).getMemento(1,1).searchConfig??{}:{},p={...SNi(),...c,...i.config};l!=null&&(p.contextLines=i?.config?.contextLines??l),i.from==="rawData"?(i.resultsContents&&(p.contextLines=0),o.invokeFunction(h=>kVe.initializeModelFromRawData(h,n,p,i.resultsContents))):o.invokeFunction(h=>kVe.initializeModelFromExistingModel(h,n,p))}return o.createInstance(Pp,n,i.from==="existingFile"?i.fileUri:i.from==="model"?i.backupOf:void 0)};var Txo=a=>{let i=a.get(ee);i.activeEditor instanceof Pp&&i.activeEditorPane.toggleCaseSensitive()},_xo=a=>{let i=a.get(ee);i.activeEditor instanceof Pp&&i.activeEditorPane.toggleWholeWords()},Dxo=a=>{let i=a.get(ee);i.activeEditor instanceof Pp&&i.activeEditorPane.toggleRegex()},Lxo=a=>{let i=a.get(ee);i.activeEditor instanceof Pp&&i.activeEditorPane.toggleContextLines()},wNi=(a,i)=>{let e=a.get(ee);e.activeEditor instanceof Pp&&e.activeEditorPane.modifyContextLines(i)},Rxo=a=>{let i=a.get(ee);i.activeEditor instanceof Pp&&i.activeEditorPane.focusAllResults()};async function Mxo(a){let i=a.get($t),e=a.get(F),t=qc(i);t?await e.invokeFunction(TVe,{filesToInclude:t.searchIncludePattern.getValue(),onlyOpenEditors:t.searchIncludePattern.onlySearchInOpenEditors(),filesToExclude:t.searchExcludePattern.getValue(),isRegexp:t.searchAndReplaceWidget.searchInput?.getRegex(),isCaseSensitive:t.searchAndReplaceWidget.searchInput?.getCaseSensitive(),matchWholeWord:t.searchAndReplaceWidget.searchInput?.getWholeWords(),useExcludeSettingsAndIgnoreFiles:t.searchExcludePattern.useExcludesAndIgnoreFiles(),showIncludesExcludes:!!(t.searchIncludePattern.getValue()||t.searchExcludePattern.getValue()||!t.searchExcludePattern.useExcludesAndIgnoreFiles())}):await e.invokeFunction(TVe)}var TVe=async(a,i={},e=!1)=>{let t=a.get(ee),o=a.get(wt),n=a.get(Te),r=a.get(F),s=a.get(B),l=a.get(Tp),c=a.get(Pe),p=a.get(na).getLastActiveWorkspaceRoot(Q.file),h=p?c.getWorkspaceFolder(p)??void 0:void 0,g=t.activeTextEditorControl,f,v="";if(g){mc(g)?g.getOriginalEditor().hasTextFocus()?f=g.getOriginalEditor():f=g.getModifiedEditor():f=g;let T=f?.getSelection();if(v=(T&&f?.getModel()?.getValueInRange(T))??"",T?.isEmpty()&&s.getValue("search").seedWithNearestWord){let P=f.getModel()?.getWordAtPosition(T.getStartPosition());P&&(v=P.word)}}else t.activeEditor instanceof Pp&&(v=t.activeEditorPane.getSelected());n.publicLog2("searchEditor/openNewSearchEditor");let S={query:i.location==="new"||s.getValue("editor").find.seedSearchStringFromSelection?v:void 0};for(let T of Object.entries(i)){let P=T[0],O=T[1];O!==void 0&&(S[P]=typeof O=="string"?await l.resolveAsync(h,O):O)}let y=t.getEditors(0).find(T=>T.editor.typeId===Pp.ID),w;if(y&&S.location==="reuse"){let T=o.getGroup(y.groupId);if(!T)throw new Error("Invalid group id for search editor");let P=y.editor;w=await T.openEditor(P),v?w.setQuery(v):w.selectQuery(),w.setSearchConfig(S)}else{let T=r.invokeFunction(DN,{config:S,resultsContents:"",from:"rawData"});w=await t.openEditor(T,{pinned:!0},e?In:jn)}let k=s.getValue("search").searchOnType;(S.triggerSearch===!0||S.triggerSearch!==!1&&k&&S.query)&&w.triggerSearch({focusResults:S.focusResults}),S.focusResults||w.focusSearchInput()},v$t=async(a,i,e,t,o)=>{if(!i.query){console.error("Expected searchResult.query to be defined. Got",i);return}let n=a.get(ee),r=a.get(Te),s=a.get(F),l=a.get(rt),c=a.get(B),u=c.getValue("search").sortOrder;r.publicLog2("searchEditor/createEditorFromSearchResult");let p=b=>l.getUriLabel(b,{relative:!0}),{text:h,matchRanges:g,config:f}=h$t(i,e,t,0,p,u);f.onlyOpenEditors=o;let v=c.getValue("search").searchEditor.defaultNumberOfContextLines;if(i.isDirty||v===0||v===null){let b=s.invokeFunction(DN,{resultsContents:h,config:f,from:"rawData"});await n.openEditor(b,{pinned:!0}),b.setMatchRanges(g)}else{let b=s.invokeFunction(DN,{from:"rawData",resultsContents:"",config:{...f,contextLines:v}});(await n.openEditor(b,{pinned:!0})).triggerSearch()}};var Yoe=le("searchViewModelWorkbenchService");function Qcn(a,i,e){let t=a[0].range.startLineNumber,o=a[a.length-1].range.endLineNumber,n=[];for(let r=t;r<=o;r++)n.push(i.getLineContent(r));return new JJ(n.join(`
`)+`
`,a.map(r=>new z(r.range.startLineNumber-1,r.range.startColumn-1,r.range.endLineNumber-1,r.range.endColumn-1)),e)}function b$t(a,i,e){let t=-1,o=[],n=[];return a.forEach(r=>{r.range.startLineNumber!==t&&(n=[],o.push(n)),n.push(r),t=r.range.endLineNumber}),o.map(r=>Qcn(r,i,e))}function _Ve(a,i,e){let t=[],o=-1;for(let n=0;n<a.length;n++){let{start:r,end:s}=Pxo(a[n]);if(typeof e.surroundingContext=="number"&&e.surroundingContext>0){let u=Math.max(o+1,r-e.surroundingContext);for(let p=u;p<r;p++)t.push({text:i.getLineContent(p+1),lineNumber:p+1})}t.push(a[n]);let l=a[n+1],c=l?Pxo(l).start:Number.MAX_VALUE;if(typeof e.surroundingContext=="number"&&e.surroundingContext>0){let u=Math.min(c-1,s+e.surroundingContext,i.getLineCount()-1);for(let p=s+1;p<=u;p++)t.push({text:i.getLineContent(p+1),lineNumber:p+1})}o=s}return t}function Pxo(a){let i=a.rangeLocations.map(o=>o.source),e=i[0].startLineNumber,t=i[i.length-1].endLineNumber;return{start:e,end:t}}function e6(a,i,e){let t=a.previewText.split(`
`);return a.rangeLocations.map(o=>{let n=o.preview;return new _st(i,t,n,o.source,e)})}var S$t=class S$t{constructor(i,e,t,o,n=!1){this._parent=i;this._fullPreviewLines=e;this._isReadonly=n;this._oneLinePreviewText=e[t.startLineNumber];let r=t.startLineNumber===t.endLineNumber?t.endColumn:this._oneLinePreviewText.length;this._rangeInPreviewText=new X7e(1,t.startColumn+1,r+1),this._range=new z(o.startLineNumber+1,o.startColumn+1,o.endLineNumber+1,o.endColumn+1),this._fullPreviewRange=t,this._id=Trt+this._parent.resource.toString()+">"+this._range+this.getMatchString()}static{this.MAX_PREVIEW_CHARS=250}id(){return this._id}parent(){return this._parent}text(){return this._oneLinePreviewText}range(){return this._range}preview(){let i=this._oneLinePreviewText.substring(0,this._rangeInPreviewText.startColumn-1),e=TGi(i,26,"\u2026"),t=this.getMatchString(),o=this._oneLinePreviewText.substring(this._rangeInPreviewText.endColumn-1),n=S$t.MAX_PREVIEW_CHARS-e.length;return t=t.substr(0,n),n-=t.length,o=o.substr(0,n),{before:e,fullBefore:i,inside:t,after:o}}get replaceString(){let i=this.parent().parent().searchModel;if(!i.replacePattern)throw new Error("searchModel.replacePattern must be set before accessing replaceString");let e=this.fullMatchText(),t=i.replacePattern.getReplaceString(e,i.preserveCase);if(t!==null)return t;let o=e.replace(/\r\n/g,`
`);if(o!==e&&(t=i.replacePattern.getReplaceString(o,i.preserveCase),t!==null))return t;let n=this.fullMatchText(!0);if(t=i.replacePattern.getReplaceString(n,i.preserveCase),t!==null)return t;let r=n.replace(/\r\n/g,`
`);return r!==n&&(t=i.replacePattern.getReplaceString(r,i.preserveCase),t!==null)?t:i.replacePattern.pattern}fullMatchText(i=!1){let e;return i?e=this._fullPreviewLines:(e=this._fullPreviewLines.slice(this._fullPreviewRange.startLineNumber,this._fullPreviewRange.endLineNumber+1),e[e.length-1]=e[e.length-1].slice(0,this._fullPreviewRange.endColumn),e[0]=e[0].slice(this._fullPreviewRange.startColumn)),e.join(`
`)}rangeInPreview(){return{...this._fullPreviewRange,startColumn:this._fullPreviewRange.startColumn+1,endColumn:this._fullPreviewRange.endColumn+1}}fullPreviewLines(){return this._fullPreviewLines.slice(this._fullPreviewRange.startLineNumber,this._fullPreviewRange.endLineNumber+1)}getMatchString(){return this._oneLinePreviewText.substring(this._rangeInPreviewText.startColumn-1,this._rangeInPreviewText.endColumn-1)}get isReadonly(){return this._isReadonly}};I([hi],S$t.prototype,"preview",1);var _st=S$t;var WW=class extends x{constructor(e,t,o,n,r,s,l,c,u){super();this._query=e;this._previewOptions=t;this._maxResults=o;this._parent=n;this.rawMatch=r;this._closestRoot=s;this.modelService=l;this.replaceService=c;this._onChange=this._register(new E);this.onChange=this._onChange.event;this._onDispose=this._register(new E);this.onDispose=this._onDispose.event;this._model=null;this._modelListener=null;this._selectedMatch=null;this._modelDecorations=[];this._context=new Map;this.replaceQ=Promise.resolve();this._resource=this.rawMatch.resource,this._textMatches=new Map,this._removedTextMatches=new Set,this._updateScheduler=this._register(new Dt(this.updateMatchesForModel.bind(this),250)),this._name=new co(()=>u.getUriBasenameLabel(this.resource))}static{this._CURRENT_FIND_MATCH=mo.register({description:"search-current-find-match",stickiness:1,zIndex:13,className:"currentFindMatch",inlineClassName:"currentFindMatchInline",overviewRuler:{color:Yu(EO),position:2},minimap:{color:Yu(D7),position:1}})}static{this._FIND_MATCH=mo.register({description:"search-find-match",stickiness:1,className:"findMatch",inlineClassName:"findMatchInline",overviewRuler:{color:Yu(EO),position:2},minimap:{color:Yu(D7),position:1}})}static getDecorationOption(e){return e?WW._CURRENT_FIND_MATCH:WW._FIND_MATCH}get context(){return new Map(this._context)}get closestRoot(){return this._closestRoot}hasReadonlyMatches(){return this.matches().some(e=>e.isReadonly)}createMatches(){let e=this.modelService.getModel(this._resource);e?(this.bindModel(e),this.updateMatchesForModel()):this.rawMatch.results&&this.rawMatch.results.filter(e0).forEach(t=>{e6(t,this,!1).forEach(o=>this.add(o))})}bindModel(e){this._model=e,this._modelListener=new N,this._modelListener.add(this._model.onDidChangeContent(()=>{this._updateScheduler.schedule()})),this._modelListener.add(this._model.onWillDispose(()=>this.onModelWillDispose())),this.updateHighlights()}onModelWillDispose(){this.updateMatchesForModel(),this.unbindModel()}unbindModel(){this._model&&(this._updateScheduler.cancel(),this._model.changeDecorations(e=>{this._modelDecorations=e.deltaDecorations(this._modelDecorations,[])}),this._model=null,this._modelListener.dispose())}updateMatchesForModel(){if(!this._model)return;this._textMatches=new Map;let e=this._query.isWordMatch&&this._query.wordSeparators?this._query.wordSeparators:null,t=this._model.findMatches(this._query.pattern,this._model.getFullModelRange(),!!this._query.isRegExp,!!this._query.isCaseSensitive,e,!1,this._maxResults??K4);this.updateMatches(t,!0,this._model,!1)}async updatesMatchesForLineAfterReplace(e,t){if(!this._model)return;let o={startLineNumber:e,startColumn:this._model.getLineMinColumn(e),endLineNumber:e,endColumn:this._model.getLineMaxColumn(e)};Array.from(this._textMatches.values()).filter(l=>l.range().startLineNumber===e).forEach(l=>this._textMatches.delete(l.id()));let r=this._query.isWordMatch&&this._query.wordSeparators?this._query.wordSeparators:null,s=this._model.findMatches(this._query.pattern,o,!!this._query.isRegExp,!!this._query.isCaseSensitive,r,!1,this._maxResults??K4);this.updateMatches(s,t,this._model,!1)}updateMatches(e,t,o,n){let r=b$t(e,o,this._previewOptions);r.forEach(s=>{e6(s,this,n).forEach(l=>{this._removedTextMatches.has(l.id())||(this.add(l),this.isMatchSelected(l)&&(this._selectedMatch=l))})}),this.addContext(_Ve(r,o,this.parent().parent().query)),this._onChange.fire({forceUpdateModel:t}),this.updateHighlights()}updateHighlights(){this._model&&this._model.changeDecorations(e=>{let t=this.parent().showHighlights?this.matches().map(o=>({range:o.range(),options:WW.getDecorationOption(this.isMatchSelected(o))})):[];this._modelDecorations=e.deltaDecorations(this._modelDecorations,t)})}id(){return Ert+this.resource.toString()}parent(){return this._parent}get hasChildren(){return this._textMatches.size>0}matches(){return[...this._textMatches.values()]}textMatches(){return Array.from(this._textMatches.values())}remove(e){Array.isArray(e)||(e=[e]);for(let t of e)this.removeMatch(t),this._removedTextMatches.add(t.id());this._onChange.fire({didRemove:!0})}async replace(e){return this.replaceQ=this.replaceQ.finally(async()=>{await this.replaceService.replace(e),await this.updatesMatchesForLineAfterReplace(e.range().startLineNumber,!1)})}setSelectedMatch(e){e&&(!this._textMatches.has(e.id())||this.isMatchSelected(e))||(this._selectedMatch=e,this.updateHighlights())}getSelectedMatch(){return this._selectedMatch}isMatchSelected(e){return!!this._selectedMatch&&this._selectedMatch.id()===e.id()}count(){return this.matches().length}get resource(){return this._resource}name(){return this._name.value}addContext(e){return e?e.filter((o=>!e0(o))).forEach(o=>this._context.set(o.lineNumber,o.text)):void 0}add(e,t){this._textMatches.set(e.id(),e),t&&this._onChange.fire({forceUpdateModel:!0})}removeMatch(e){this._textMatches.delete(e.id()),this.isMatchSelected(e)?(this.setSelectedMatch(null),this._findMatchDecorationModel?.clearCurrentFindMatchDecoration()):this.updateHighlights()}async resolveFileStat(e){this._fileStat=await e.stat(this.resource).catch(()=>{})}get fileStat(){return this._fileStat}set fileStat(e){this._fileStat=e}dispose(){this.setSelectedMatch(null),this.unbindModel(),this._onDispose.fire(),super.dispose()}hasOnlyReadOnlyMatches(){return this.matches().every(e=>e.isReadonly)}};WW=I([m(6,Tt),m(7,EI),m(8,rt)],WW);var Xoe=class{constructor(i){this._modelService=i;this._decorationId=null;this._model=null;this._modelDisposables=new N}removeHighlightRange(){if(this._model&&this._decorationId){let i=this._decorationId;this._model.changeDecorations(e=>{e.removeDecoration(i)})}this._decorationId=null}highlightRange(i,e,t=0){let o;A.isUri(i)?o=this._modelService.getModel(i):o=i,o&&this.doHighlightRange(o,e)}doHighlightRange(i,e){this.removeHighlightRange(),i.changeDecorations(t=>{this._decorationId=t.addDecoration(e,Xoe._RANGE_HIGHLIGHT_DECORATION)}),this.setModel(i)}setModel(i){this._model!==i&&(this.clearModelListeners(),this._model=i,this._modelDisposables.add(this._model.onDidChangeDecorations(e=>{this.clearModelListeners(),this.removeHighlightRange(),this._model=null})),this._modelDisposables.add(this._model.onWillDispose(()=>{this.clearModelListeners(),this.removeHighlightRange(),this._model=null})))}clearModelListeners(){this._modelDisposables.clear()}dispose(){this._model&&(this.removeHighlightRange(),this._model=null),this._modelDisposables.dispose()}static{this._RANGE_HIGHLIGHT_DECORATION=mo.register({description:"search-range-highlight",stickiness:1,className:"rangeHighlight",isWholeLine:!0})}};Xoe=I([m(0,Tt)],Xoe);function I$t(a){return"cellResults"in a}var Dst="rawCell#";function Axo(a,i){let e=-1,t=[],o=[];return a.forEach(r=>{r.range.startLineNumber!==e&&o.length>0&&(t.push([...o]),o=[]),o.push(r),e=r.range.endLineNumber}),o.length>0&&t.push([...o]),t.map(r=>{let s=[],l=r[0].range.startLineNumber,c=r[r.length-1].range.endLineNumber;for(let u=l;u<=c;u++)s.push(i.getLineContent(u));return new JJ(s.join(`
`)+`
`,r.map(u=>new z(u.range.startLineNumber-1,u.range.startColumn-1,u.range.endLineNumber-1,u.range.endColumn-1)))})}var y$t=class extends x{constructor(e,t,o){super();this._source=e;this._inputTextBuffer=t;this._outputs=o;this._outputTextBuffers=void 0}_getFullModelRange(e){let t=e.getLineCount();return new z(1,1,t,this._getLineMaxColumn(e,t))}_getLineMaxColumn(e,t){if(t<1||t>e.getLineCount())throw new Error("Illegal value for lineNumber");return e.getLineLength(t)+1}get inputTextBuffer(){if(!this._inputTextBuffer){let e=new Aj;e.acceptChunk(this._source);let t=e.finish(!0),{textBuffer:o,disposable:n}=t.create(1);this._inputTextBuffer=o,this._register(n)}return this._inputTextBuffer}get outputTextBuffers(){return this._outputTextBuffers||(this._outputTextBuffers=this._outputs.map(e=>{let t=new Aj;t.acceptChunk(e);let o=t.finish(!0),{textBuffer:n,disposable:r}=o.create(1);return this._register(r),n})),this._outputTextBuffers}findInInputs(e){let o=new tw(e,!1,!1,null).parseSearchRequest();if(!o)return[];let n=this._getFullModelRange(this.inputTextBuffer);return this.inputTextBuffer.findMatchesLineByLine(n,o,!0,5e3)}findInOutputs(e){let o=new tw(e,!1,!1,null).parseSearchRequest();return o?this.outputTextBuffers.map(n=>{let r=n.findMatchesLineByLine(this._getFullModelRange(n),o,!0,5e3);if(r.length!==0)return{textBuffer:n,matches:r}}).filter(n=>!!n):[]}};function Nxo(a){return C$t(a)?a.cell.id:`${Dst}${a.index}`}function w$t(a){return"cellResults"in a&&a.cellResults instanceof Array&&a.cellResults.every(C$t)}function C$t(a){return"cell"in a}function x$t(a,i){return Axo(a,i.textBuffer)}function k$t(a){return a.map(i=>i.searchPreviewInfo?new JJ(i.searchPreviewInfo.line,new z(0,i.searchPreviewInfo.range.start,0,i.searchPreviewInfo.range.end),void 0,i.index):void 0).filter(i=>!!i)}var Joe=class extends _st{constructor(e,t,o,n,r){super(e.parent,t,o,n,!1);this._cellParent=e;this._id=Trt+this._parent.resource.toString()+">"+this._cellParent.cellIndex+(r?"_"+r:"")+"_"+this.notebookMatchTypeString()+this._range+this.getMatchString(),this._webviewIndex=r}parent(){return this._cellParent.parent}get cellParent(){return this._cellParent}notebookMatchTypeString(){return this.isWebviewMatch()?"webview":"content"}isWebviewMatch(){return this._webviewIndex!==void 0}get isReadonly(){return super.isReadonly||!this._cellParent.hasCellViewModel()||this.isWebviewMatch()}get cellIndex(){return this._cellParent.cellIndex}get webviewIndex(){return this._webviewIndex}get cell(){return this._cellParent.cell}},E$t=class{constructor(i,e,t){this._parent=i;this._cell=e;this._cellIndex=t;this._contentMatches=new Map,this._webviewMatches=new Map,this._context=new Map}hasCellViewModel(){return!(this._cell instanceof y$t)}get context(){return new Map(this._context)}matches(){return[...this._contentMatches.values(),...this._webviewMatches.values()]}get contentMatches(){return Array.from(this._contentMatches.values())}get webviewMatches(){return Array.from(this._webviewMatches.values())}remove(i){Array.isArray(i)||(i=[i]);for(let e of i)this._contentMatches.delete(e.id()),this._webviewMatches.delete(e.id())}clearAllMatches(){this._contentMatches.clear(),this._webviewMatches.clear()}addContentMatches(i){Oxo(i,this).forEach(t=>{this._contentMatches.set(t.id(),t)}),this.addContext(i)}addContext(i){this.cell&&this.cell.resolveTextModel().then(e=>{_Ve(i,e,this.parent.parent().query).filter((n=>!e0(n))).map(n=>({...n,lineNumber:n.lineNumber+1})).forEach(n=>{this._context.set(n.lineNumber,n.text)})})}addWebviewMatches(i){Oxo(i,this).forEach(t=>{this._webviewMatches.set(t.id(),t)})}setCellModel(i){this._cell=i}get parent(){return this._parent}get id(){return this._cell?.id??`${Dst}${this.cellIndex}`}get cellIndex(){return this._cellIndex}get cell(){return this._cell}},Bfe=class extends WW{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,t,o,n,r,s,c,u,p);this.searchInstanceID=l;this.notebookEditorService=h;this._notebookEditorWidget=null;this._editorWidgetListener=null;this._cellMatches=new Map,this._notebookUpdateScheduler=this._register(new Dt(this.updateMatchesForEditorWidget.bind(this),250))}get cellContext(){let e=new Map;return this._cellMatches.forEach(t=>{e.set(t.id,t.context)}),e}getCellMatch(e){return this._cellMatches.get(e)}addCellMatch(e){let t=new E$t(this,C$t(e)?e.cell:void 0,e.index);this._cellMatches.set(t.id,t),this.addWebviewMatchesToCell(t.id,e.webviewResults),this.addContentMatchesToCell(t.id,e.contentResults)}addWebviewMatchesToCell(e,t){let o=this.getCellMatch(e);o!==void 0&&o.addWebviewMatches(t)}addContentMatchesToCell(e,t){let o=this.getCellMatch(e);o!==void 0&&o.addContentMatches(t)}revealCellRange(e,t){!this._notebookEditorWidget||!e.cell||(e.webviewIndex!==void 0?this._notebookEditorWidget.getCellIndex(e.cell)!==void 0&&this._notebookEditorWidget.revealCellOffsetInCenter(e.cell,t??0):(e.cell.updateEditState(e.cell.getEditState(),"focusNotebookCell"),this._notebookEditorWidget.setCellEditorSelection(e.cell,e.range()),this._notebookEditorWidget.revealRangeInCenterIfOutsideViewportAsync(e.cell,e.range())))}bindNotebookEditorWidget(e){this._notebookEditorWidget!==e&&(this._notebookEditorWidget=e,this._editorWidgetListener=this._notebookEditorWidget.textModel?.onDidChangeContent(t=>{t.rawEvents.some(o=>o.kind===10||o.kind===1)&&this._notebookUpdateScheduler.schedule()})??null,this._addNotebookHighlights())}unbindNotebookEditorWidget(e){e&&this._notebookEditorWidget!==e||(this._notebookEditorWidget&&(this._notebookUpdateScheduler.cancel(),this._editorWidgetListener?.dispose()),this._removeNotebookHighlights(),this._notebookEditorWidget=null)}updateNotebookHighlights(){this.parent().showHighlights?(this._addNotebookHighlights(),this.setNotebookFindMatchDecorationsUsingCellMatches(Array.from(this._cellMatches.values()))):this._removeNotebookHighlights()}_addNotebookHighlights(){this._notebookEditorWidget&&(this._findMatchDecorationModel?.stopWebviewFind(),this._findMatchDecorationModel?.dispose(),this._findMatchDecorationModel=new XPe(this._notebookEditorWidget,this.searchInstanceID),this._selectedMatch instanceof Joe&&this.highlightCurrentFindMatchDecoration(this._selectedMatch))}_removeNotebookHighlights(){this._findMatchDecorationModel&&(this._findMatchDecorationModel?.stopWebviewFind(),this._findMatchDecorationModel?.dispose(),this._findMatchDecorationModel=void 0)}updateNotebookMatches(e,t){if(!this._notebookEditorWidget)return;let o=new Map(this._cellMatches);this._notebookEditorWidget.getId()!==this._lastEditorWidgetIdForUpdate&&(this._cellMatches.clear(),this._lastEditorWidgetIdForUpdate=this._notebookEditorWidget.getId()),e.forEach(n=>{let r=this._cellMatches.get(n.cell.id);if(this._notebookEditorWidget&&!r){let l=this._notebookEditorWidget.getCellIndex(n.cell),c=o.get(`${Dst}${l}`);c&&(c.setCellModel(n.cell),c.clearAllMatches(),r=c)}r?.clearAllMatches();let s=r??new E$t(this,n.cell,n.index);s.addContentMatches(x$t(n.contentMatches,n.cell)),s.addWebviewMatches(k$t(n.webviewMatches)),this._cellMatches.set(s.id,s)}),this._findMatchDecorationModel?.setAllFindMatchesDecorations(e),this._selectedMatch instanceof Joe&&this.highlightCurrentFindMatchDecoration(this._selectedMatch),this._onChange.fire({forceUpdateModel:t})}setNotebookFindMatchDecorationsUsingCellMatches(e){if(!this._findMatchDecorationModel)return;let t=di(e.map(o=>{let n=di(o.webviewMatches.map(s=>{if(s.webviewIndex)return{index:s.webviewIndex}}));if(!o.cell)return;let r=o.contentMatches.map(s=>new T1(s.range(),[s.text()]));return new C8(o.cell,o.cellIndex,r,n)}));try{this._findMatchDecorationModel.setAllFindMatchesDecorations(t)}catch{}}async updateMatchesForEditorWidget(){if(!this._notebookEditorWidget)return;this._textMatches=new Map;let e=this._query.isWordMatch&&this._query.wordSeparators?this._query.wordSeparators:null,t=await this._notebookEditorWidget.find(this._query.pattern,{regex:this._query.isRegExp,wholeWord:this._query.isWordMatch,caseSensitive:this._query.isCaseSensitive,wordSeparators:e??void 0,includeMarkupInput:this._query.notebookInfo?.isInNotebookMarkdownInput,includeMarkupPreview:this._query.notebookInfo?.isInNotebookMarkdownPreview,includeCodeInput:this._query.notebookInfo?.isInNotebookCellInput,includeOutput:this._query.notebookInfo?.isInNotebookCellOutput},Se.None,!1,!0,this.searchInstanceID);this.updateNotebookMatches(t,!0)}async showMatch(e){let t=await this.highlightCurrentFindMatchDecoration(e);this.setSelectedMatch(e),this.revealCellRange(e,t)}async highlightCurrentFindMatchDecoration(e){return!this._findMatchDecorationModel||!e.cell?null:e.webviewIndex===void 0?this._findMatchDecorationModel.highlightCurrentFindMatchDecorationInCell(e.cell,e.range()):this._findMatchDecorationModel.highlightCurrentFindMatchDecorationInWebview(e.cell,e.webviewIndex)}matches(){let e=Array.from(this._cellMatches.values()).flatMap(t=>t.matches());return[...super.matches(),...e]}removeMatch(e){e instanceof Joe?(e.cellParent.remove(e),e.cellParent.matches().length===0&&this._cellMatches.delete(e.cellParent.id),this.isMatchSelected(e)?(this.setSelectedMatch(null),this._findMatchDecorationModel?.clearCurrentFindMatchDecoration()):this.updateHighlights(),this.setNotebookFindMatchDecorationsUsingCellMatches(this.cellMatches())):super.removeMatch(e)}cellMatches(){return Array.from(this._cellMatches.values())}createMatches(){let e=this.modelService.getModel(this._resource);if(e)this.bindModel(e),this.updateMatchesForModel();else{let t=this.notebookEditorService.retrieveExistingWidgetFromURI(this.resource);t?.value&&this.bindNotebookEditorWidget(t.value),this.rawMatch.results&&this.rawMatch.results.filter(e0).forEach(o=>{e6(o,this,!1).forEach(n=>this.add(n))}),(w$t(this.rawMatch)||I$t(this.rawMatch))&&(this.rawMatch.cellResults?.forEach(o=>this.addCellMatch(o)),this.setNotebookFindMatchDecorationsUsingCellMatches(this.cellMatches()),this._onChange.fire({forceUpdateModel:!0})),this.addContext(this.rawMatch.results)}}get hasChildren(){return super.hasChildren||this._cellMatches.size>0}setSelectedMatch(e){if(e){if(!this.isMatchSelected(e)&&CU(e)){this._selectedMatch=e;return}if(!this._textMatches.has(e.id())||this.isMatchSelected(e))return}this._selectedMatch=e,this.updateHighlights()}dispose(){this.unbindNotebookEditorWidget(),super.dispose()}};Bfe=I([m(7,Tt),m(8,EI),m(9,rt),m(10,Gc)],Bfe);function Oxo(a,i){let e=[];return a.forEach(t=>{let o=t.previewText.split(`
`);t.rangeLocations.map(n=>{let r=n.preview,s=new Joe(i,o,r,n.source,t.webviewIndex);e.push(s)})}),e}var Zoe=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this._resource=e;this._index=o;this._query=n;this._parent=r;this._searchResult=s;this._closestRoot=l;this.replaceService=c;this.instantiationService=u;this.uriIdentityService=h;this._onChange=this._register(new E);this.onChange=this._onChange.event;this._onDispose=this._register(new E);this.onDispose=this._onDispose.event;this._replacingAll=!1;this._fileMatches=new gt,this._folderMatches=new gt,this._folderMatchesMap=Sp.forUris(g=>this.uriIdentityService.extUri.ignorePathCasing(g)),this._unDisposedFileMatches=new gt,this._unDisposedFolderMatches=new gt,this._name=new co(()=>this.resource?p.getUriBasenameLabel(this.resource):""),this._id=krt+t}get searchModel(){return this._searchResult.searchModel}get showHighlights(){return this._parent.showHighlights}get closestRoot(){return this._closestRoot}set replacingAll(e){this._replacingAll=e}id(){return this._id}get resource(){return this._resource}index(){return this._index}name(){return this._name.value}parent(){return this._parent}isAIContributed(){return!1}get hasChildren(){return this._fileMatches.size>0||this._folderMatches.size>0}bindModel(e){let t=this._fileMatches.get(e.uri);t?t.bindModel(e):this.getFolderMatch(e.uri)?.getDownstreamFileMatch(e.uri)?.bindModel(e)}createIntermediateFolderMatch(e,t,o,n,r){let s=this._register(this.instantiationService.createInstance(DVe,e,t,o,n,this,this._searchResult,r));return this.configureIntermediateMatch(s),this.doAddFolder(s),s}configureIntermediateMatch(e){let t=e.onChange(o=>this.onFolderChange(e,o));this._register(e.onDispose(()=>t.dispose()))}clear(e=!1){let t=this.allDownstreamFileMatches();this.disposeMatches(),this._onChange.fire({elements:t,removed:!0,added:!1,clearingAll:e})}remove(e){Array.isArray(e)||(e=[e]);let t=_rt(e);this.doRemoveFile(t)}async replace(e){return this.replaceService.replace([e]).then(()=>{this.doRemoveFile([e],!0,!0,!0)})}replaceAll(){let e=this.matches();return this.batchReplace(e)}matches(){return[...this.fileMatchesIterator(),...this.folderMatchesIterator()]}fileMatchesIterator(){return this._fileMatches.values()}folderMatchesIterator(){return this._folderMatches.values()}isEmpty(){return this.fileCount()+this.folderCount()===0}getDownstreamFileMatch(e){let t=this._fileMatches.get(e);if(t)return t;let n=this.getFolderMatch(e)?.getDownstreamFileMatch(e);return n||null}allDownstreamFileMatches(){let e=[],t=this.folderMatchesIterator();for(let o of t)e=e.concat(o.allDownstreamFileMatches());return[...this.fileMatchesIterator(),...e]}fileCount(){return this._fileMatches.size}folderCount(){return this._folderMatches.size}count(){return this.fileCount()+this.folderCount()}recursiveFileCount(){return this.allDownstreamFileMatches().length}recursiveMatchCount(){return this.allDownstreamFileMatches().reduce((e,t)=>e+t.count(),0)}get query(){return this._query}doAddFile(e){this._fileMatches.set(e.resource,e),this._unDisposedFileMatches.delete(e.resource)}hasOnlyReadOnlyMatches(){return Array.from(this._fileMatches.values()).every(e=>e.hasOnlyReadOnlyMatches())}uriHasParent(e,t){return this.uriIdentityService.extUri.isEqualOrParent(t,e)&&!this.uriIdentityService.extUri.isEqual(t,e)}isInParentChain(e){let t=this;for(;t instanceof Zoe;){if(t.id()===e.id())return!0;t=t.parent()}return!1}getFolderMatch(e){return this._folderMatchesMap.findSubstr(e)}doAddFolder(e){if(this.resource&&!this.uriHasParent(this.resource,e.resource))throw Error(`${e.resource} does not belong as a child of ${this.resource}`);if(this.isInParentChain(e))throw Error(`${e.resource} is a parent of ${this.resource}`);this._folderMatches.set(e.resource,e),this._folderMatchesMap.set(e.resource,e),this._unDisposedFolderMatches.delete(e.resource)}async batchReplace(e){let t=_rt(e);await this.replaceService.replace(t),this.doRemoveFile(t,!0,!0,!0)}onFileChange(e,t=!1){let o=!1;this._fileMatches.has(e.resource)||(this.doAddFile(e),o=!0),e.count()===0&&(this.doRemoveFile([e],!1,!1),o=!1,t=!0),this._replacingAll||this._onChange.fire({elements:[e],added:o,removed:t})}onFolderChange(e,t){this._folderMatches.has(e.resource)||this.doAddFolder(e),e.isEmpty()&&(this._folderMatches.delete(e.resource),e.dispose()),this._onChange.fire(t)}doRemoveFile(e,t=!0,o=!0,n=!1){let r=[];for(let s of e)if(this._fileMatches.get(s.resource)){if(n&&s.hasReadonlyMatches())continue;this._fileMatches.delete(s.resource),t?s.dispose():this._unDisposedFileMatches.set(s.resource,s),r.push(s)}else{let l=this.getFolderMatch(s.resource);if(l)l.doRemoveFile([s],t,o);else throw Error(`FileMatch ${s.resource} is not located within FolderMatch ${this.resource}`)}o&&this._onChange.fire({elements:r,removed:!0})}async bindNotebookEditorWidget(e,t){let o=this._fileMatches.get(t);if(Qoe(o))if(o)o.bindNotebookEditorWidget(e),await o.updateMatchesForEditorWidget();else{let n=this.folderMatchesIterator();for(let r of n)await r.bindNotebookEditorWidget(e,t)}}addFileMatch(e,t,o){let n=[],r=[];e.forEach(l=>{let c=this.getDownstreamFileMatch(l.resource);if(c)l.results&&l.results.filter(e0).forEach(u=>{e6(u,c,!1).forEach(p=>c.add(p))}),(w$t(l)||I$t(l))&&l.cellResults?.forEach(u=>{if(Qoe(c)){let p=c.getCellMatch(Nxo(u));p?(p.addContentMatches(u.contentResults),p.addWebviewMatches(u.webviewResults)):c.addCellMatch(u)}}),r.push(c),l.results&&l.results.length>0&&c.addContext(l.results);else if(iq(this)||_W(this)){let u=this.createAndConfigureFileMatch(l,o);n.push(u)}});let s=[...n,...r];!t&&s.length&&this._onChange.fire({elements:s,added:!!n.length})}unbindNotebookEditorWidget(e,t){let o=this._fileMatches.get(t);if(Qoe(o))if(o)o.unbindNotebookEditorWidget(e);else{let n=this.folderMatchesIterator();for(let r of n)r.unbindNotebookEditorWidget(e,t)}}disposeMatches(){[...this._fileMatches.values()].forEach(e=>e.dispose()),[...this._folderMatches.values()].forEach(e=>e.disposeMatches()),[...this._unDisposedFileMatches.values()].forEach(e=>e.dispose()),[...this._unDisposedFolderMatches.values()].forEach(e=>e.disposeMatches()),this._fileMatches.clear(),this._folderMatches.clear(),this._unDisposedFileMatches.clear(),this._unDisposedFolderMatches.clear()}dispose(){this.disposeMatches(),this._onDispose.fire(),super.dispose()}};Zoe=I([m(7,EI),m(8,F),m(9,rt),m(10,ht)],Zoe);var DVe=class extends Zoe{constructor(i,e,t,o,n,r,s,l,c,u,p){super(i,e,t,o,n,r,s,l,c,u,p),this._normalizedResource=new co(()=>this.uriIdentityService.extUri.removeTrailingPathSeparator(this.uriIdentityService.extUri.normalizePath(this.resource)))}get resource(){return this._resource}get normalizedResource(){return this._normalizedResource.value}};DVe=I([m(7,EI),m(8,F),m(9,rt),m(10,ht)],DVe);var LVe=class extends DVe{constructor(i,e,t,o,n,r,s,l,c){super(i,e,t,o,n,n.parent(),null,r,s,l,c)}normalizedUriParent(i){return this.uriIdentityService.extUri.normalizePath(this.uriIdentityService.extUri.dirname(i))}uriEquals(i,e){return this.uriIdentityService.extUri.isEqual(i,e)}createFileMatch(i,e,t,o,n,r,s){let l=this.instantiationService.createInstance(Bfe,i,e,t,o,n,r,s);l.createMatches(),o.doAddFile(l);let c=l.onChange(({didRemove:u})=>o.onFileChange(l,u));return this._register(l.onDispose(()=>c.dispose())),l}createAndConfigureFileMatch(i,e){if(!this.uriHasParent(this.resource,i.resource))throw Error(`${i.resource} is not a descendant of ${this.resource}`);let t=[],o=this.normalizedUriParent(i.resource);for(;!this.uriEquals(this.normalizedResource,o);){t.unshift(o);let l=o;if(o=this.uriIdentityService.extUri.removeTrailingPathSeparator(this.normalizedUriParent(o)),this.uriEquals(l,o))throw Error(`${i.resource} is not correctly configured as a child of ${this.normalizedResource}`)}let n=this.closestRoot??this,r=this;for(let l=0;l<t.length;l++){let c=r.getFolderMatch(t[l]);c||(c=r.createIntermediateFolderMatch(t[l],t[l].toString(),-1,this._query,n)),r=c}let s=typeof this._query.contentPattern=="string"?{pattern:this._query.contentPattern}:this._query.contentPattern;return this.createFileMatch(s,this._query.previewOptions,this._query.maxResults,r,i,n,e)}};LVe=I([m(5,EI),m(6,F),m(7,rt),m(8,ht)],LVe);var RVe=class extends Zoe{constructor(i,e,t,o,n,r,s,l){super(null,i,e,t,o,o.parent(),null,n,r,s,l)}createAndConfigureFileMatch(i,e){let t=typeof this._query.contentPattern=="string"?{pattern:this._query.contentPattern}:this._query.contentPattern,o=this._register(this.instantiationService.createInstance(Bfe,t,this._query.previewOptions,this._query.maxResults,this,i,null,e));o.createMatches(),this.doAddFile(o);let n=o.onChange(({didRemove:r})=>this.onFileChange(o,r));return this._register(o.onDispose(()=>n.dispose())),o}};RVe=I([m(4,EI),m(5,F),m(6,rt),m(7,ht)],RVe);var Hfe=class extends x{constructor(e,t,o,n){super();this._allowOtherResults=e;this._parent=t;this.instantiationService=o;this.uriIdentityService=n;this._onChange=this._register(new E);this.onChange=this._onChange.event;this._isDirty=!1;this._showHighlights=!1;this._query=null;this.disposePastResults=()=>Promise.resolve();this._folderMatches=[];this._otherFilesMatch=null;this._folderMatchesMap=Sp.forUris(e=>this.uriIdentityService.extUri.ignorePathCasing(e));this.resource=null;this.hidden=!1;this._rangeHighlightDecorations=this.instantiationService.createInstance(Xoe),this._register(this.onChange(r=>{r.removed&&(this._isDirty=!this.isEmpty())}))}hide(){this.hidden=!0,this.clear()}parent(){return this._parent}get hasChildren(){return this._folderMatches.length>0}get isDirty(){return this._isDirty}getFolderMatch(e){let t=this._folderMatchesMap.findSubstr(e);return!t&&this._allowOtherResults&&this._otherFilesMatch?this._otherFilesMatch:t}add(e,t,o=!1){let{byFolder:n,other:r}=this.groupFilesByFolder(e);n.forEach(s=>{if(!s.length)return;this.getFolderMatch(s[0].resource)?.addFileMatch(s,o,t)}),this.isAIContributed||this._otherFilesMatch?.addFileMatch(r,o,t),this.disposePastResults()}remove(e,t=!1){Array.isArray(e)||(e=[e]),e.forEach(s=>{Fd(s)&&s.clear()});let o=e.filter(s=>_l(s)),{byFolder:n,other:r}=this.groupFilesByFolder(o);n.forEach(s=>{s.length&&this.getFolderMatch(s[0].resource)?.remove(s)}),r.length&&this.getFolderMatch(r[0].resource)?.remove(r)}groupFilesByFolder(e){let t=new gt,o=[];return this._folderMatches.forEach(n=>t.set(n.resource,[])),e.forEach(n=>{let r=this.getFolderMatch(n.resource);if(!r)return;let s=r.resource;s?t.get(s).push(n):o.push(n)}),{byFolder:t,other:o}}isEmpty(){return this.folderMatches().every(e=>e.isEmpty())}findFolderSubstr(e){return this._folderMatchesMap.findSubstr(e)}clearQuery(){let e=this.folderMatches();this.disposePastResults=async()=>{e.forEach(t=>t.clear()),e.forEach(t=>t.dispose()),this._isDirty=!1},this.cachedSearchComplete=void 0,this._rangeHighlightDecorations.removeHighlightRange(),this._folderMatchesMap=Sp.forUris(t=>this.uriIdentityService.extUri.ignorePathCasing(t))}folderMatches(){return this._otherFilesMatch&&this._allowOtherResults?[...this._folderMatches,this._otherFilesMatch]:this._folderMatches}disposeMatches(){this.folderMatches().forEach(e=>e.dispose()),this._folderMatches=[],this._folderMatchesMap=Sp.forUris(e=>this.uriIdentityService.extUri.ignorePathCasing(e)),this._rangeHighlightDecorations.removeHighlightRange()}matches(){let e=[];return this.folderMatches().forEach(t=>{e.push(t.allDownstreamFileMatches())}),[].concat(...e)}get showHighlights(){return this._showHighlights}toggleHighlights(e){if(this._showHighlights===e)return;this._showHighlights=e;let t=null;this.matches().forEach(o=>{o.updateHighlights(),Qoe(o)&&o.updateNotebookHighlights(),t||(t=o.getSelectedMatch())}),this._showHighlights&&t?this._rangeHighlightDecorations.highlightRange(t.parent().resource,t.range()):this._rangeHighlightDecorations.removeHighlightRange()}get rangeHighlightDecorations(){return this._rangeHighlightDecorations}fileCount(){return this.folderMatches().reduce((e,t)=>e+t.recursiveFileCount(),0)}count(){return this.matches().reduce((e,t)=>e+t.count(),0)}clear(e=!0){this.cachedSearchComplete=void 0,this.folderMatches().forEach(t=>t.clear(e)),this.disposeMatches(),this._folderMatches=[],this._otherFilesMatch=null}async dispose(){this._rangeHighlightDecorations.dispose(),this.disposeMatches(),super.dispose(),await this.disposePastResults()}};Hfe=I([m(2,F),m(3,ht)],Hfe);var MVe=class extends Hfe{constructor(e,t,o,n){super(!0,e,t,o);this.replaceService=n}id(){return F0e+UIo}get isAIContributed(){return!1}replace(e){return this.getFolderMatch(e.resource)?.replace(e)??Promise.resolve()}name(){return"Text"}replaceAll(e){return this.replacingAll=!0,this.replaceService.replace(this.matches(),e).then(()=>{this.replacingAll=!1,this.clear()},()=>{this.replacingAll=!1})}set replacingAll(e){this.folderMatches().forEach(t=>{t.replacingAll=e})}get query(){return this._query}set query(e){this.clearQuery(),e&&(this._folderMatches=(e&&e.folderQueries||[]).map(t=>t.folder).map((t,o)=>this._createBaseFolderMatch(t,t.toString(),o,e)),this._folderMatches.forEach(t=>this._folderMatchesMap.set(t.resource,t)),this._otherFilesMatch=this._createBaseFolderMatch(null,"otherFiles",this._folderMatches.length+1,e),this._query=e)}_createBaseFolderMatch(e,t,o,n){let r;e?r=this._register(this.createWorkspaceRootWithResourceImpl(e,t,o,n)):r=this._register(this.createNoRootWorkspaceImpl(t,o,n));let s=r.onChange(l=>this._onChange.fire(l));return this._register(r.onDispose(()=>s.dispose())),r}createWorkspaceRootWithResourceImpl(e,t,o,n){return this.instantiationService.createInstance(LVe,e,t,o,n,this)}createNoRootWorkspaceImpl(e,t,o){return this._register(this.instantiationService.createInstance(RVe,e,t,o,this))}};MVe=I([m(1,F),m(2,ht),m(3,EI)],MVe);var t6=class extends Hfe{constructor(i,e,t){super(!1,i,e,t),this.hidden=!0}name(){return"AI"}id(){return F0e+zIo}get isAIContributed(){return!0}get query(){return this._query}set query(i){this.clearQuery(),i&&(this._folderMatches=(i&&i.folderQueries||[]).map(e=>e.folder).map((e,t)=>this._createBaseFolderMatch(e,e.toString(),t,i)),this._folderMatches.forEach(e=>this._folderMatchesMap.set(e.resource,e)),this._query=i)}fileCount(){let i=new En;for(let e of this.folderMatches())if(!e.isEmpty())for(let t of e.allDownstreamFileMatches())i.add(t.resource);return i.size}_createBaseFolderMatch(i,e,t,o){let n=this._register(this.createWorkspaceRootWithResourceImpl(i,e,t,o)),r=n.onChange(s=>this._onChange.fire(s));return this._register(n.onDispose(()=>r.dispose())),n}createWorkspaceRootWithResourceImpl(i,e,t,o){return this.instantiationService.createInstance(Ufe,i,e,t,o,this)}};t6=I([m(1,F),m(2,ht)],t6);var Ufe=class extends x{constructor(e,t,o,n,r,s,l){super();this._resource=e;this._index=o;this._query=n;this._parent=r;this.instantiationService=s;this._onChange=this._register(new E);this.onChange=this._onChange.event;this._onDispose=this._register(new E);this.onDispose=this._onDispose.event;this.latestRank=0;this.replacingAll=!1;this._fileMatches=new Map,this._id=krt+t,this._name=new co(()=>this.resource?l.getUriBasenameLabel(this.resource):""),this._unDisposedFileMatches=new Map}get resource(){return this._resource}id(){return this._id}index(){return this._index}name(){return this._name.value}count(){return this._fileMatches.size}doAddFile(e){this._fileMatches.set(e.id(),e)}createAndConfigureFileMatch(e,t){let o=this.instantiationService.createInstance(Lst,this._query.contentPattern,this._query.previewOptions,this._query.maxResults,this,e,this,e.resource.toString()+"_"+Date.now().toString(),this.latestRank++);o.createMatches(),this.doAddFile(o);let n=o.onChange(({didRemove:r})=>this.onFileChange(o,r));return this._register(o.onDispose(()=>n.dispose())),o}isAIContributed(){return!0}onFileChange(e,t=!1){let o=!1;this._fileMatches.has(e.id())||(this.doAddFile(e),o=!0),e.count()===0&&(this.doRemoveFile([e],!1,!1),o=!1,t=!0),this._onChange.fire({elements:[e],added:o,removed:t})}get hasChildren(){return this._fileMatches.size>0}parent(){return this._parent}matches(){return[...this._fileMatches.values()]}allDownstreamFileMatches(){return[...this._fileMatches.values()]}remove(e){Array.isArray(e)||(e=[e]);let t=_rt(e);this.doRemoveFile(t)}addFileMatch(e,t,o){let n=[],r=[];e.forEach(l=>{let c=this.createAndConfigureFileMatch(l,o);n.push(c)});let s=[...n,...r];!t&&s.length&&this._onChange.fire({elements:s,added:!!n.length})}isEmpty(){return this.recursiveFileCount()===0}clear(e){let t=this.allDownstreamFileMatches();t.length>0&&(this.disposeMatches(),this._onChange.fire({elements:t,removed:!0,added:!1,clearingAll:e}))}get showHighlights(){return this._parent.showHighlights}get searchModel(){return this._searchResult.searchModel}get _searchResult(){return this._parent.parent()}get query(){return this._query}getDownstreamFileMatch(e){for(let t of this._fileMatches.values())if(t.resource.toString()===e.toString())return t;return null}replaceAll(){throw new Error("Cannot replace in AI search")}recursiveFileCount(){return this._fileMatches.size}doRemoveFile(e,t=!0,o=!0,n=!1){let r=[];for(let s of e)if(this._fileMatches.get(s.id())){if(n&&s.hasReadonlyMatches())continue;this._fileMatches.delete(s.id()),t?s.dispose():this._unDisposedFileMatches.set(s.id(),s),r.push(s)}o&&this._onChange.fire({elements:r,removed:!0})}replace(e){throw new Error("Cannot replace in AI search")}bindModel(e){}unbindNotebookEditorWidget(e,t){}bindNotebookEditorWidget(e,t){return Promise.resolve()}hasOnlyReadOnlyMatches(){return Array.from(this._fileMatches.values()).every(e=>e.hasOnlyReadOnlyMatches())}fileMatchesIterator(){return this._fileMatches.values()}folderMatchesIterator(){return[].values()}recursiveMatchCount(){return this._fileMatches.size}disposeMatches(){[...this._fileMatches.values()].forEach(e=>e.dispose()),[...this._unDisposedFileMatches.values()].forEach(e=>e.dispose()),this._fileMatches.clear()}dispose(){this.disposeMatches(),this._onDispose.fire(),super.dispose()}};Ufe=I([m(5,F),m(6,rt)],Ufe);var Lst=class extends WW{constructor(e,t,o,n,r,s,l,c,u,p,h){super({pattern:e},t,o,n,r,s,u,p,h);this._id=l;this.rank=c}id(){return Ert+this._id}getFullRange(){let e,t;for(let o of this.matches()){let n=o.range().getStartPosition(),r=o.range().getEndPosition();(e===void 0||n.isBefore(e))&&(e=n),t===void 0?t=r:r.isBefore(t)||(t=r)}if(!(e===void 0||t===void 0))return new z(e.lineNumber,e.column,t.lineNumber,t.column)}rangeAsString(){let e=this.getFullRange();if(e)return e.startLineNumber+":"+e.startColumn+"-"+e.endLineNumber+":"+e.endColumn}name(){let e=this.rangeAsString();return super.name()+e?" "+e:""}createMatches(){this.rawMatch.results&&this.rawMatch.results.filter(e0).forEach(e=>{e6(e,this,!0).forEach(t=>this.add(t))})}};Lst=I([m(8,Tt),m(9,EI),m(10,rt)],Lst);W(class extends K{constructor(){super({id:"search.action.clearHistory",title:L(14017,"Clear Search History"),category:Dl,f1:!0})}async run(i){Xcn(i)}});W(class extends K{constructor(){super({id:"search.action.cancel",title:L(14016,"Cancel Search"),icon:mxo,category:Dl,f1:!0,precondition:n_e.isEqualTo(0).negate(),keybinding:{weight:200,when:C.and(_i.SearchViewVisibleKey,vc),primary:9},menu:[{id:D.ViewTitle,group:"navigation",order:0,when:C.and(C.equals("view",Iy),n_e.isEqualTo(2))}]})}run(i){return edn(i)}});W(class extends K{constructor(){super({id:"search.action.refreshSearchResults",title:L(14021,"Refresh"),icon:l$t,precondition:_i.ViewHasSearchPatternKey,category:Dl,f1:!0,menu:[{id:D.ViewTitle,group:"navigation",order:0,when:C.and(C.equals("view",Iy),n_e.isEqualTo(2).negate())}]})}run(i,...e){return tdn(i)}});W(class extends K{constructor(){super({id:"search.action.collapseSearchResults",title:L(14019,"Collapse All"),category:Dl,icon:lxo,f1:!0,precondition:C.and(_i.HasSearchResults,_i.ViewHasSomeCollapsibleKey),menu:[{id:D.ViewTitle,group:"navigation",order:4,when:C.and(C.equals("view",Iy),C.or(_i.HasSearchResults.negate(),_i.ViewHasSomeCollapsibleKey))}]})}run(i,...e){return idn(i)}});W(class extends K{constructor(){super({id:"search.action.expandSearchResults",title:L(14020,"Expand All"),category:Dl,icon:cxo,f1:!0,precondition:C.and(_i.HasSearchResults,_i.ViewHasSomeCollapsibleKey.toNegated()),menu:[{id:D.ViewTitle,group:"navigation",order:4,when:C.and(C.equals("view",Iy),_i.HasSearchResults,_i.ViewHasSomeCollapsibleKey.toNegated())}]})}async run(i,...e){return Jcn(i)}});W(class extends K{constructor(){super({id:"search.action.clearSearchResults",title:L(14018,"Clear Search Results"),category:Dl,icon:pxo,f1:!0,precondition:C.or(_i.HasSearchResults,_i.ViewHasSearchPatternKey,_i.ViewHasReplacePatternKey,_i.ViewHasFilePatternKey),menu:[{id:D.ViewTitle,group:"navigation",order:1,when:C.equals("view",Iy)}]})}run(i,...e){return Zcn(i)}});W(class extends K{constructor(){super({id:"search.action.viewAsTree",title:L(14024,"View as Tree"),category:Dl,icon:uxo,f1:!0,precondition:C.and(_i.HasSearchResults,_i.InTreeViewKey.toNegated()),menu:[{id:D.ViewTitle,group:"navigation",order:2,when:C.and(C.equals("view",Iy),_i.InTreeViewKey.toNegated())}]})}async run(i,...e){let t=qc(i.get($t));t&&await t.setTreeView(!0)}});W(class extends K{constructor(){super({id:"search.action.viewAsList",title:L(14023,"View as List"),category:Dl,icon:dxo,f1:!0,precondition:C.and(_i.HasSearchResults,_i.InTreeViewKey),menu:[{id:D.ViewTitle,group:"navigation",order:2,when:C.and(C.equals("view",Iy),_i.InTreeViewKey)}]})}async run(i,...e){let t=qc(i.get($t));t&&await t.setTreeView(!1)}});W(class extends K{constructor(){super({id:"search.action.searchWithAI",title:L(14022,"Search with AI"),category:Dl,f1:!0,precondition:_i.hasAIResultProvider,keybinding:{weight:200,when:C.and(_i.hasAIResultProvider,_i.SearchViewFocusedKey),primary:2087}})}async run(i,...e){let t=qc(i.get($t));t&&t.requestAIResults()}});var Xcn=a=>{a.get(CVe).clearHistory()};async function Jcn(a){let i=a.get($t),e=qc(i);if(e){let t=e.getControl();await PVe(t,void 0)}}async function PVe(a,i){if(i){if(!a.hasNode(i))return;await a.expand(i,!0)}let e=a.getNode(i)?.children;if(e)for(let t of e){if(vN(t.element))throw Error("SearchResult should not be a child of a RenderableMatch");PVe(a,t.element)}}function Zcn(a){let i=a.get($t);qc(i)?.clearSearchResults()}function edn(a){let i=a.get($t);qc(i)?.cancelSearch()}function tdn(a){let i=a.get($t),e=qc(i);e?.triggerQueryChange({preserveFocus:!1,shouldUpdateAISearch:!e.model.searchResult.aiTextSearchResult.hidden})}function idn(a){let i=a.get($t),e=qc(i);if(e){let t=e.getControl(),o=t.navigate(),n=o.first(),r=!1,s=!1;do n=o.next();while(lv(n));if(iq(n)||e.isTreeLayoutViewVisible){for(;n=o.next();)if(!lv(n)){if(el(n)){r=!0;break}if(e.isTreeLayoutViewVisible&&!s){let c=n;if(Fd(n)){let p=t.getCompressedTreeNode(n)?.elements[0].element;c=p&&!el(p)&&!lv(p)&&!vN(p)?p:n}let u=c.parent();lv(u)||iq(u)||_W(u)||vN(u)||(s=!0)}}}if(r){n=o.first();do _l(n)&&t.collapse(n);while(n=o.next())}else if(s){if(n=o.first(),n)do{let c=n;if(Fd(n)){let p=t.getCompressedTreeNode(n)?.elements[0].element;c=p&&!el(p)&&!vN(p)?p:n}let u=c.parent();(iq(u)||_W(u))&&(t.hasNode(n)?t.collapse(n,!0):t.collapseAll())}while(n=o.next())}else if(lv(o.first())){n=o.first();do{if(!n)break;lv(t.getParentElement(n))&&t.collapse(n)}while(n=o.next())}else t.collapseAll();let l=t.getFocus()[0]?.parent();l&&(Fd(l)||_l(l))&&t.hasNode(l)&&t.isCollapsed(l)&&(t.domFocus(),t.focusFirst(),t.setSelection(t.getFocus()))}}var cL=_;var Fxo=d(14115,null),Wxo=75,Cq=class extends Gs{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,P,O,V,H,G,$,J,ae,he,oe){super(e,V,P,g,b,h,p,G,k,$);this.fileService=t;this.editorService=o;this.codeEditorService=n;this.progressService=r;this.notificationService=s;this.dialogService=l;this.commandService=c;this.contextViewService=u;this.contextService=f;this.searchViewModelWorkbenchService=v;this.replaceService=S;this.textFileService=y;this.preferencesService=w;this.searchHistoryService=T;this.accessibilityService=O;this.storageService=H;this.notebookService=J;this.logService=ae;this.accessibilitySignalService=he;this.telemetryService=oe;this.isDisposed=!1;this.lastFocusState="input";this.messageDisposables=new N;this.currentEditorCursorListener=this._register(new me);this.currentSearchQ=Promise.resolve();this.pauseSearching=!1;this._visibleMatches=0;this._cachedKeywords=[];this.container=_(".search-view"),this.viewletVisible=_i.SearchViewVisibleKey.bindTo(this.contextKeyService),this.firstMatchFocused=_i.FirstMatchFocusKey.bindTo(this.contextKeyService),this.fileMatchOrMatchFocused=_i.FileMatchOrMatchFocusKey.bindTo(this.contextKeyService),this.fileMatchOrFolderMatchFocus=_i.FileMatchOrFolderMatchFocusKey.bindTo(this.contextKeyService),this.fileMatchOrFolderMatchWithResourceFocus=_i.FileMatchOrFolderMatchWithResourceFocusKey.bindTo(this.contextKeyService),this.fileMatchFocused=_i.FileFocusKey.bindTo(this.contextKeyService),this.folderMatchFocused=_i.FolderFocusKey.bindTo(this.contextKeyService),this.folderMatchWithResourceFocused=_i.ResourceFolderFocusKey.bindTo(this.contextKeyService),this.searchResultHeaderFocused=_i.SearchResultHeaderFocused.bindTo(this.contextKeyService),this.hasSearchResultsKey=_i.HasSearchResults.bindTo(this.contextKeyService),this.matchFocused=_i.MatchFocusKey.bindTo(this.contextKeyService),this.searchStateKey=n_e.bindTo(this.contextKeyService),this.hasSearchPatternKey=_i.ViewHasSearchPatternKey.bindTo(this.contextKeyService),this.hasReplacePatternKey=_i.ViewHasReplacePatternKey.bindTo(this.contextKeyService),this.hasFilePatternKey=_i.ViewHasFilePatternKey.bindTo(this.contextKeyService),this.hasSomeCollapsibleResultKey=_i.ViewHasSomeCollapsibleKey.bindTo(this.contextKeyService),this.treeViewKey=_i.InTreeViewKey.bindTo(this.contextKeyService),this.refreshTreeController=this._register(this.instantiationService.createInstance(Mst,this,()=>this.searchConfig)),this._register(this.contextKeyService.onDidChangeContext(de=>{let Ce=_i.hasAIResultProvider.keys();de.affectsSome(new Set(Ce))&&this.refreshHasAISetting()})),this.contextKeyService=this._register(this.contextKeyService.createScoped(this.container)),_i.SearchViewFocusedKey.bindTo(this.contextKeyService).set(!0),this.inputBoxFocused=_i.InputBoxFocusedKey.bindTo(this.contextKeyService),this.inputPatternIncludesFocused=_i.PatternIncludesFocusedKey.bindTo(this.contextKeyService),this.inputPatternExclusionsFocused=_i.PatternExcludesFocusedKey.bindTo(this.contextKeyService),this.isEditableItem=_i.IsEditableItemKey.bindTo(this.contextKeyService),this.instantiationService=this._register(this.instantiationService.createChild(new _o([X,this.contextKeyService]))),this._register(this.configurationService.onDidChangeConfiguration(async de=>{de.affectsConfiguration("search.sortOrder")&&(this.searchConfig.sortOrder==="modified"&&this.removeFileStats(),await this.refreshTreeController.queue())})),this.viewModel=this.searchViewModelWorkbenchService.searchModel,this.queryBuilder=this.instantiationService.createInstance(kS),this.memento=new Al(this.id,H),this.viewletState=this.memento.getMemento(1,1),this._register(this.fileService.onDidFilesChange(de=>this.onFilesChanged(de))),this._register(this.textFileService.untitled.onWillDispose(de=>this.onUntitledDidDispose(de.resource))),this._register(this.contextService.onDidChangeWorkbenchState(()=>this.onDidChangeWorkbenchState())),this._register(this.searchHistoryService.onDidClearHistory(()=>this.clearHistory())),this._register(this.configurationService.onDidChangeConfiguration(de=>this.onConfigurationUpdated(de))),this.delayedRefresh=this._register(new Xo(250)),this.addToSearchHistoryDelayer=this._register(new Xo(2e3)),this.toggleCollapseStateDelayer=this._register(new Xo(100)),this.triggerQueryDelayer=this._register(new Xo(0)),this.treeAccessibilityProvider=this.instantiationService.createInstance(IVe,this),this.isTreeLayoutViewVisible=this.viewletState.view?.treeLayout??this.searchConfig.defaultViewMode==="tree",this._refreshResultsScheduler=this._register(new Dt(this._updateResults.bind(this),80)),this._register(this.storageService.onWillSaveState(()=>{this._saveSearchHistoryService()})),this._register(this.storageService.onDidChangeValue(1,_N.SEARCH_HISTORY_KEY,this._store)(()=>{let de=this.searchHistoryService.load();de.include&&this.inputPatternIncludes.prependHistory(de.include),de.exclude&&this.inputPatternExcludes.prependHistory(de.exclude),de.search&&this.searchWidget.prependSearchHistory(de.search),de.replace&&this.searchWidget.prependReplaceHistory(de.replace)})),this.changedWhileHidden=this.hasSearchResults()}static{this.ACTIONS_RIGHT_CLASS_NAME="actions-right"}get cachedResults(){return this._cachedResults}async queueRefreshTree(){return this.refreshTreeController.queue()}get isTreeLayoutViewVisible(){return this.treeViewKey.get()??!1}set isTreeLayoutViewVisible(e){this.treeViewKey.set(e)}async setTreeView(e){if(e!==this.isTreeLayoutViewVisible)return this.isTreeLayoutViewVisible=e,this.updateIndentStyles(this.themeService.getFileIconTheme()),this.refreshTreeController.queue()}get state(){return this.searchStateKey.get()??0}set state(e){this.searchStateKey.set(e)}getContainer(){return this.container}get searchResult(){return this.viewModel&&this.viewModel.searchResult}get model(){return this.viewModel}async refreshHasAISetting(){let e=this.shouldShowAIResults();if(!(!this.tree||!this.tree.hasNode(this.searchResult))){if(e&&!this.tree.hasNode(this.searchResult.aiTextSearchResult)){if(this.model.searchResult.getCachedSearchComplete(!1))return this.refreshAndUpdateCount()}else if(!e&&this.tree.hasNode(this.searchResult.aiTextSearchResult))return this.refreshAndUpdateCount()}}onDidChangeWorkbenchState(){this.contextService.getWorkbenchState()!==1&&this.searchWithoutFolderMessageElement&&vo(this.searchWithoutFolderMessageElement)}refreshInputs(){this.pauseSearching=!0,this.searchWidget.setValue(this.viewModel.searchResult.query?.contentPattern.pattern??""),this.searchWidget.setReplaceAllActionState(!1),this.searchWidget.toggleReplace(!0),this.inputPatternIncludes.setOnlySearchInOpenEditors(this.viewModel.searchResult.query?.onlyOpenEditors||!1),this.inputPatternExcludes.setUseExcludesAndIgnoreFiles(!this.viewModel.searchResult.query?.userDisabledExcludesAndIgnoreFiles||!0),this.searchIncludePattern.setValue(""),this.searchExcludePattern.setValue(""),this.pauseSearching=!1}async replaceSearchModel(e,t){let o;this.progressService.withProgress({location:this.getProgressLocation(),delay:0},r=>new Promise(s=>o=s));let n=setTimeout(()=>{this.state=2},2e3);this._refreshResultsScheduler.schedule(),e.location=0,e.replaceActive=this.viewModel.isReplaceActive(),e.replaceString=this.searchWidget.getReplaceValue(),this._onSearchResultChangedDisposable?.dispose(),this._onSearchResultChangedDisposable=this._register(e.onSearchResultChanged(async r=>this.onSearchResultsChanged(r))),this.searchViewModelWorkbenchService.searchModel=e,this.viewModel=e,this.tree.setInput(this.viewModel.searchResult),await this.onSearchResultsChanged(),this.refreshInputs(),t.then(r=>(clearTimeout(n),this.onSearchComplete(o,void 0,void 0,r)),r=>(clearTimeout(n),this.onSearchError(r,o,void 0,void 0))),await this.expandIfSingularResult()}renderBody(e){super.renderBody(e),this.container=M(e,_(".search-view")),this.searchWidgetsContainerElement=M(this.container,cL(".search-widgets-container")),this.createSearchWidget(this.searchWidgetsContainerElement);let t=this.searchHistoryService.load(),o=this.viewletState.query?.filePatterns||"",n=this.viewletState.query?.folderExclusions||"",r=t.exclude||[],s=this.viewletState.query?.folderIncludes||"",l=t.include||[],c=this.viewletState.query?.onlyOpenEditors||!1,u=this.viewletState.query?.queryDetailsExpanded||"",p=typeof this.viewletState.query?.useExcludesAndIgnoreFiles=="boolean"?this.viewletState.query.useExcludesAndIgnoreFiles:!0;this.queryDetails=M(this.searchWidgetsContainerElement,cL(".query-details"));let h=d(14074,null);this.toggleQueryDetailsButton=M(this.queryDetails,cL(".more"+q.asCSSSelector(Wfe),{tabindex:0,role:"button","aria-label":h})),this._register(this.hoverService.setupManagedHover(Ri("element"),this.toggleQueryDetailsButton,h)),this._register(j(this.toggleQueryDetailsButton,re.CLICK,w=>{Xt.stop(w),this.toggleQueryDetails(!this.accessibilityService.isScreenReaderOptimized())})),this._register(j(this.toggleQueryDetailsButton,re.KEY_UP,w=>{let k=new gi(w);(k.equals(3)||k.equals(10))&&(Xt.stop(w),this.toggleQueryDetails(!1))})),this._register(j(this.toggleQueryDetailsButton,re.KEY_DOWN,w=>{new gi(w).equals(1026)&&(this.searchWidget.isReplaceActive()?this.searchWidget.focusReplaceAllAction():this.searchWidget.isReplaceShown()?this.searchWidget.replaceInput?.focusOnPreserve():this.searchWidget.focusRegexAction(),Xt.stop(w))}));let g=M(this.queryDetails,cL(".file-types.includes")),f=d(14119,null);M(g,cL("h4",void 0,f)),this.inputPatternIncludes=this._register(this.instantiationService.createInstance($oe,g,this.contextViewService,{ariaLabel:f,placeholder:d(14090,null),showPlaceholderOnFocus:!0,history:l,inputBoxStyles:Cl})),this.inputPatternIncludes.setValue(s),this.inputPatternIncludes.setOnlySearchInOpenEditors(c),this._register(this.inputPatternIncludes.onCancel(()=>this.cancelSearch(!1))),this._register(this.inputPatternIncludes.onChangeSearchInEditorsBox(()=>this.triggerQueryChange())),this.trackInputBox(this.inputPatternIncludes.inputFocusTracker,this.inputPatternIncludesFocused);let v=M(this.queryDetails,cL(".file-types.excludes")),b=d(14118,null);M(v,cL("h4",void 0,b)),this.inputPatternExcludes=this._register(this.instantiationService.createInstance(joe,v,this.contextViewService,{ariaLabel:b,placeholder:d(14089,null),showPlaceholderOnFocus:!0,history:r,inputBoxStyles:Cl})),this.inputPatternExcludes.setValue(n),this.inputPatternExcludes.setUseExcludesAndIgnoreFiles(p),this._register(this.inputPatternExcludes.onCancel(()=>this.cancelSearch(!1))),this._register(this.inputPatternExcludes.onChangeIgnoreBox(()=>this.triggerQueryChange())),this.trackInputBox(this.inputPatternExcludes.inputFocusTracker,this.inputPatternExclusionsFocused);let S=()=>this.hasFilePatternKey.set(this.inputPatternIncludes.getValue().length>0||this.inputPatternExcludes.getValue().length>0);S();let y=w=>{this.triggerQueryChange({triggeredOnType:w,delay:this.searchConfig.searchOnTypeDebouncePeriod}),w&&S()};this._register(this.inputPatternIncludes.onSubmit(y)),this._register(this.inputPatternExcludes.onSubmit(y)),this.messagesElement=M(this.container,cL(".messages.text-search-provider-messages")),this.contextService.getWorkbenchState()===1&&this.showSearchWithoutFolderMessage(),this.createSearchResultsView(this.container),(o!==""||n!==""||s!==""||u!==""||!p)&&this.toggleQueryDetails(!0,!0,!0),this._onSearchResultChangedDisposable=this._register(this.viewModel.onSearchResultChanged(async w=>await this.onSearchResultsChanged(w))),this._onAIResultChangedDisposable?.dispose(),this._onAIResultChangedDisposable=this._register(this.viewModel.searchResult.aiTextSearchResult.onChange(w=>{this.tree&&this.tree.hasNode(this.searchResult.aiTextSearchResult)&&!w.removed&&this.tree.updateChildren(this.searchResult.aiTextSearchResult)})),this._register(this.onDidChangeBodyVisibility(w=>this.onVisibilityChanged(w))),this.updateIndentStyles(this.themeService.getFileIconTheme()),this._register(this.themeService.onDidFileIconThemeChange(this.updateIndentStyles,this))}updateIndentStyles(e){this.resultsElement.classList.toggle("hide-arrows",this.isTreeLayoutViewVisible&&e.hidesExplorerArrows)}async onVisibilityChanged(e){this.viewletVisible.set(e),e?this.changedWhileHidden&&(await this.refreshAndUpdateCount(),this.changedWhileHidden=!1):this.lastFocusState="input",this.viewModel?.searchResult.toggleHighlights(e)}get searchAndReplaceWidget(){return this.searchWidget}get searchIncludePattern(){return this.inputPatternIncludes}get searchExcludePattern(){return this.inputPatternExcludes}createSearchWidget(e){let t=this.viewletState.query?.contentPattern||"",o=this.viewletState.query?.replaceText||"",n=this.viewletState.query?.regex===!0,r=this.viewletState.query?.wholeWords===!0,s=this.viewletState.query?.caseSensitive===!0,l=this.searchHistoryService.load(),c=l.search||this.viewletState.query?.searchHistory||[],u=l.replace||this.viewletState.query?.replaceHistory||[],p=typeof this.viewletState.view?.showReplace=="boolean"?this.viewletState.view.showReplace:!0,h=this.viewletState.query?.preserveCase===!0,g=this.viewletState.query?.isInNotebookMarkdownInput??!0,f=this.viewletState.query?.isInNotebookMarkdownPreview??!0,v=this.viewletState.query?.isInNotebookCellInput??!0,b=this.viewletState.query?.isInNotebookCellOutput??!0;if(this.searchWidget=this._register(this.instantiationService.createInstance(KM,e,{value:t,replaceValue:o,isRegex:n,isCaseSensitive:s,isWholeWords:r,searchHistory:c,replaceHistory:u,preserveCase:h,inputBoxStyles:Cl,toggleStyles:gh,notebookOptions:{isInNotebookMarkdownInput:g,isInNotebookMarkdownPreview:f,isInNotebookCellInput:v,isInNotebookCellOutput:b}})),!this.searchWidget.searchInput||!this.searchWidget.replaceInput){this.logService.warn(`Cannot fully create search widget. Search or replace input undefined. SearchInput: ${this.searchWidget.searchInput}, ReplaceInput: ${this.searchWidget.replaceInput}`);return}p&&this.searchWidget.toggleReplace(!0),this._register(this.searchWidget.onSearchSubmit(w=>{let k=this.configurationService.getValue("search").searchView.semanticSearchBehavior;k==="auto"&&this.logService.info("SearchView: Automatically rendering AI results"),this.triggerQueryChange({...w,shouldKeepAIResults:!1,shouldUpdateAISearch:k==="auto"})})),this._register(this.searchWidget.onSearchCancel(({focus:w})=>this.cancelSearch(w))),this._register(this.searchWidget.searchInput.onDidOptionChange(()=>{this.triggerQueryChange({shouldKeepAIResults:!0})})),this._register(this.searchWidget.getNotebookFilters().onDidChange(()=>this.triggerQueryChange({shouldKeepAIResults:!0})));let S=()=>this.hasSearchPatternKey.set(this.searchWidget.searchInput?this.searchWidget.searchInput.getValue().length>0:!1);S(),this._register(this.searchWidget.searchInput.onDidChange(()=>S()));let y=()=>this.hasReplacePatternKey.set(this.searchWidget.getReplaceValue().length>0);y(),this._register(this.searchWidget.replaceInput.inputBox.onDidChange(()=>y())),this._register(this.searchWidget.onDidHeightChange(()=>this.reLayout())),this._register(this.searchWidget.onReplaceToggled(()=>this.reLayout())),this._register(this.searchWidget.onReplaceStateChange(async w=>{this.viewModel.replaceActive=w,await this.refreshTreeController.queue()})),this._register(this.searchWidget.onPreserveCaseChange(async w=>{this.viewModel.preserveCase=w,await this.refreshTreeController.queue()})),this._register(this.searchWidget.onReplaceValueChanged(()=>{this.viewModel.replaceString=this.searchWidget.getReplaceValue(),this.delayedRefresh.trigger(async()=>this.refreshTreeController.queue())})),this._register(this.searchWidget.onBlur(()=>{this.toggleQueryDetailsButton.focus()})),this._register(this.searchWidget.onReplaceAll(()=>this.replaceAll())),this.trackInputBox(this.searchWidget.searchInputFocusTracker),this.trackInputBox(this.searchWidget.replaceInputFocusTracker)}shouldShowAIResults(){return!!_i.hasAIResultProvider.getValue(this.contextKeyService)}async onConfigurationUpdated(e){if(e&&(e.affectsConfiguration("search.decorations.colors")||e.affectsConfiguration("search.decorations.badges")))return this.refreshTreeController.queue()}trackInputBox(e,t){e&&(this._register(e.onDidFocus(()=>{this.lastFocusState="input",this.inputBoxFocused.set(!0),t?.set(!0)})),this._register(e.onDidBlur(()=>{this.inputBoxFocused.set(this.searchWidget.searchInputHasFocus()||this.searchWidget.replaceInputHasFocus()||this.inputPatternIncludes.inputHasFocus()||this.inputPatternExcludes.inputHasFocus()),t?.set(!1)})))}async onSearchResultsChanged(e){if(this.isVisible())return this.refreshAndUpdateCount(e);this.changedWhileHidden=!0}async refreshAndUpdateCount(e){return this.searchWidget.setReplaceAllActionState(!this.viewModel.searchResult.isEmpty()),this.updateSearchResultCount(this.viewModel.searchResult.query.userDisabledExcludesAndIgnoreFiles,this.viewModel.searchResult.query?.onlyOpenEditors,e?.clearingAll),this.refreshTreeController.queue(e)}originalShouldCollapse(e){let t=this.searchConfig.collapseResults;return t==="alwaysCollapse"||!el(e)&&e.count()>10&&t!=="alwaysExpand"?3:2}shouldCollapseAccordingToConfig(e){return this.originalShouldCollapse(e)===3}replaceAll(){if(this.viewModel.searchResult.count()===0)return;let e=this.viewModel.searchResult.count(),t=this.viewModel.searchResult.fileCount(),o=this.searchWidget.getReplaceValue()||"",n=this.buildAfterReplaceAllMessage(e,t,o),r,s;this.progressService.withProgress({location:this.getProgressLocation(),delay:100,total:e},c=>(s=c,new Promise(u=>r=u)));let l={title:d(14100,null),message:this.buildReplaceAllConfirmationMessage(e,t,o),primaryButton:d(14099,null)};this.dialogService.confirm(l).then(c=>{c.confirmed?(this.searchWidget.setReplaceAllActionState(!1),this.viewModel.searchResult.replaceAll(s).then(()=>{r();let u=this.clearMessage();M(u,n),this.reLayout()},u=>{r(),ao(u),this.notificationService.error(u)})):r()})}buildAfterReplaceAllMessage(e,t,o){return e===1?t===1?o?d(14102,null,e,t,o):d(14092,null,e,t):o?d(14104,null,e,t,o):d(14094,null,e,t):t===1?o?d(14106,null,e,t,o):d(14096,null,e,t):o?d(14108,null,e,t,o):d(14098,null,e,t)}buildReplaceAllConfirmationMessage(e,t,o){let r=(s=>{if(!s)return s;let l=s.split(`
`);return l.length>10?l.slice(0,10).join(`
`)+`
...`:s})(o);return e===1?t===1?r?d(14091,null,e,t,r):d(14101,null,e,t):r?d(14093,null,e,t,r):d(14103,null,e,t):t===1?r?d(14095,null,e,t,r):d(14105,null,e,t):r?d(14097,null,e,t,r):d(14107,null,e,t)}clearMessage(){this.searchWithoutFolderMessageElement=void 0;let e=this.messagesElement.style.display==="none";Rt(this.messagesElement),un(this.messagesElement),this.messageDisposables.clear();let t=M(this.messagesElement,cL(".message"));return e&&this.reLayout(),t}createSearchResultsView(e){this.resultsElement=M(e,cL(".results.show-file-icons.file-icon-themable-tree"));let t=this.instantiationService.createInstance(xst),o={getId(r){return r.id()}};this.searchDataSource=this.instantiationService.createInstance(Rst,this),this.treeLabels=this._register(this.instantiationService.createInstance(Nl,{onDidChangeVisibility:this.onDidChangeBodyVisibility})),this.tree=this._register(this.instantiationService.createInstance(sy,"SearchView",this.resultsElement,t,{isIncompressible:r=>!(Fd(r)&&!lv(r.parent())&&!iq(r.parent())&&!_W(r.parent()))},[this._register(this.instantiationService.createInstance(QQ,this,this.treeLabels)),this._register(this.instantiationService.createInstance(YQ,this,this.treeLabels)),this._register(this.instantiationService.createInstance(jQ,this.treeLabels)),this._register(this.instantiationService.createInstance(XQ,this))],this.searchDataSource,{identityProvider:o,accessibilityProvider:this.treeAccessibilityProvider,dnd:this.instantiationService.createInstance(Y4,r=>_l(r)?r.resource:el(r)?ZL(r.parent().resource,r.range()):null),multipleSelectionSupport:!0,selectionNavigation:!0,overrideStyles:this.getLocationBasedColors().listOverrideStyles,paddingBottom:xst.ITEM_HEIGHT,collapseByDefault:r=>lv(r)?r.isAIContributed:Fd(r)&&r.matches().length===1&&Fd(r.matches()[0])?!1:this.shouldCollapseAccordingToConfig(r)})),_i.SearchResultListFocusedKey.bindTo(this.tree.contextKeyService),this.tree.setInput(this.viewModel.searchResult),this._register(this.tree.onContextMenu(r=>this.onContextMenu(r)));let n=()=>this.toggleCollapseStateDelayer.trigger(()=>this.hasSomeCollapsibleResultKey.set(this.hasSomeCollapsible()));n(),this._register(this.tree.onDidChangeCollapseState(()=>n())),this._register(this.tree.onDidChangeModel(()=>n())),this._register(U.debounce(this.tree.onDidOpen,(r,s)=>s,Wxo,!0)(r=>{if(el(r.element)){let s=r.element;this.currentSelectedFileMatch?.setSelectedMatch(null),this.currentSelectedFileMatch=s.parent(),this.currentSelectedFileMatch.setSelectedMatch(s),this.onFocus(s,r.editorOptions.preserveFocus,r.sideBySide,r.editorOptions.pinned)}})),this._register(U.debounce(this.tree.onDidChangeFocus,(r,s)=>s,Wxo,!0)(()=>{let r=this.tree.getSelection(),s=this.tree.getFocus()[0];r.length>1&&el(s)&&this.onFocus(s,!0)})),this._register(U.any(this.tree.onDidFocus,this.tree.onDidChangeFocus)(()=>{let r=this.tree.getFocus()[0];if(this.tree.isDOMFocused()){let l=this.tree.getFirstElementChild(this.tree.getInput());this.firstMatchFocused.set(l===r),this.fileMatchOrMatchFocused.set(!!r),this.fileMatchFocused.set(_l(r)),this.folderMatchFocused.set(Fd(r)),this.matchFocused.set(el(r)),this.fileMatchOrFolderMatchFocus.set(_l(r)||Fd(r)),this.fileMatchOrFolderMatchWithResourceFocus.set(_l(r)||kQ(r)),this.folderMatchWithResourceFocused.set(kQ(r)),this.searchResultHeaderFocused.set(qIo(r)),this.lastFocusState="tree"}let s=!1;el(r)?s=!r.isReadonly:(_l(r)||Fd(r))&&(s=!r.hasOnlyReadOnlyMatches()),this.isEditableItem.set(s)})),this._register(this.tree.onDidBlur(()=>{this.firstMatchFocused.reset(),this.fileMatchOrMatchFocused.reset(),this.fileMatchFocused.reset(),this.folderMatchFocused.reset(),this.matchFocused.reset(),this.fileMatchOrFolderMatchFocus.reset(),this.fileMatchOrFolderMatchWithResourceFocus.reset(),this.folderMatchWithResourceFocused.reset(),this.searchResultHeaderFocused.reset(),this.isEditableItem.reset()})),this._register(this.editorService.onDidActiveEditorChange(()=>{let r=ha(this.editorService.activeTextEditorControl);this.currentEditorCursorListener.value=r?.onDidChangeCursorPosition(()=>{this.currentSelectedFileMatch?.setSelectedMatch(null),this.currentSelectedFileMatch=void 0})}))}onContextMenu(e){e.browserEvent.preventDefault(),e.browserEvent.stopPropagation();let t=this.tree.getSelection(),o,n;t&&t.length>0?(o=e.element,n=t):n=e.element,this.contextMenuService.showContextMenu({menuId:D.SearchContext,menuActionOptions:{shouldForwardArgs:!0,arg:o},contextKeyService:this.contextKeyService,getAnchor:()=>e.anchor,getActionsContext:()=>n})}hasSomeCollapsible(){let e=this.getControl(),t=e.navigate(),o=t.first(),n=this.shouldShowAIResults();do if(o&&!e.isCollapsed(o)&&(!n||!lv(o)))return!0;while(o=t.next());return!1}async selectNextMatch(){if(!this.hasSearchResults())return;let[e]=this.tree.getSelection();e&&!el(e)&&this.tree.isCollapsed(e)&&await this.tree.expand(e);let t=this.tree.navigate(e),o=t.next();for(o||(o=t.first());o&&!el(o);)this.tree.isCollapsed(o)&&await this.tree.expand(o),o=t.next();if(o){o===e&&this.tree.setFocus([]);let n=$E(void 0,!1,!1);this.tree.setFocus([o],n),this.tree.setSelection([o],n),this.tree.reveal(o);let r=this.treeAccessibilityProvider.getAriaLabel(o);r&&qr(r)}}async selectPreviousMatch(){if(!this.hasSearchResults())return;let[e]=this.tree.getSelection(),t=this.tree.navigate(e),o=t.previous();for(;!o||!el(o)&&!this.tree.isCollapsed(o);){let n=o?t.previous():t.last();if(!o&&!n)return;o=n}for(;o&&!el(o);){let n=t.next();if(!n)break;await this.tree.expand(o),t=this.tree.navigate(n),o=n?t.previous():t.last()}if(o){o===e&&this.tree.setFocus([]);let n=$E(void 0,!1,!1);this.tree.setFocus([o],n),this.tree.setSelection([o],n),this.tree.reveal(o);let r=this.treeAccessibilityProvider.getAriaLabel(o);r&&qr(r)}}moveFocusToResults(){this.tree.domFocus()}focus(){if(super.focus(),this.lastFocusState==="input"||!this.hasSearchResults()){let e=this.searchConfig.seedOnFocus?this.updateTextFromSelection({allowSearchOnType:!1}):!1;this.searchWidget.focus(void 0,void 0,e)}else this.tree.domFocus()}updateTextFromFindWidgetOrSelection({allowUnselectedWord:e=!0,allowSearchOnType:t=!0}){let o=this.editorService.activeTextEditorControl;if(pn(o)&&!o?.hasTextFocus()){let n=$f.get(o);if(n&&n.isFindInputFocused())return this.updateTextFromFindWidget(n,{allowSearchOnType:t});o=this.codeEditorService.listCodeEditors().find(s=>s instanceof id&&s.getParentEditor()===o&&s.hasTextFocus())??o}return this.updateTextFromSelection({allowUnselectedWord:e,allowSearchOnType:t},o)}updateTextFromFindWidget(e,{allowSearchOnType:t=!0}){if(!this.searchConfig.seedWithNearestWord&&(Ki().getSelection()?.toString()??"")==="")return!1;let o=e.getState().searchString;return o===""?!1:(this.searchWidget.searchInput?.setCaseSensitive(e.getState().matchCase),this.searchWidget.searchInput?.setWholeWords(e.getState().wholeWord),this.searchWidget.searchInput?.setRegex(e.getState().isRegex),this.updateText(o,t),!0)}updateTextFromSelection({allowUnselectedWord:e=!0,allowSearchOnType:t=!0},o){let n=this.configurationService.getValue("editor").find.seedSearchStringFromSelection;if(!n||n==="never")return!1;let r=this.getSearchTextFromEditor(e,o);return r===null?!1:(this.searchWidget.searchInput?.getRegex()&&(r=ns(r)),this.updateText(r,t),!0)}updateText(e,t=!0){t&&!this.viewModel.searchResult.isDirty?this.searchWidget.setValue(e):(this.pauseSearching=!0,this.searchWidget.setValue(e),this.pauseSearching=!1)}focusNextInputBox(){if(this.searchWidget.searchInputHasFocus()){this.searchWidget.isReplaceShown()?this.searchWidget.focus(!0,!0):this.moveFocusFromSearchOrReplace();return}if(this.searchWidget.replaceInputHasFocus()){this.moveFocusFromSearchOrReplace();return}if(this.inputPatternIncludes.inputHasFocus()){this.inputPatternExcludes.focus(),this.inputPatternExcludes.select();return}if(this.inputPatternExcludes.inputHasFocus()){this.selectTreeIfNotSelected();return}}moveFocusFromSearchOrReplace(){this.showsFileTypes()?this.toggleQueryDetails(!0,this.showsFileTypes()):this.selectTreeIfNotSelected()}focusPreviousInputBox(){if(!this.searchWidget.searchInputHasFocus()){if(this.searchWidget.replaceInputHasFocus()){this.searchWidget.focus(!0);return}if(this.inputPatternIncludes.inputHasFocus()){this.searchWidget.focus(!0,!0);return}if(this.inputPatternExcludes.inputHasFocus()){this.inputPatternIncludes.focus(),this.inputPatternIncludes.select();return}if(this.tree.isDOMFocused()){this.moveFocusFromResults();return}}}moveFocusFromResults(){this.showsFileTypes()?this.toggleQueryDetails(!0,!0,!1,!0):this.searchWidget.focus(!0,!0)}reLayout(){if(this.isDisposed||!this.size)return;let e=this.searchConfig.actionsPosition;this.getContainer().classList.toggle(Cq.ACTIONS_RIGHT_CLASS_NAME,e==="right"),this.searchWidget.setWidth(this.size.width-28),this.inputPatternExcludes.setWidth(this.size.width-28),this.inputPatternIncludes.setWidth(this.size.width-28);let t=mh(this.searchWidgetsContainerElement),o=mh(this.messagesElement);this.tree.layout(this.size.height-t-o,this.size.width-28)}layoutBody(e,t){super.layoutBody(e,t),this.size=new si(t,e),this.reLayout()}getControl(){return this.tree}allSearchFieldsClear(){return this.searchWidget.getReplaceValue()===""&&(!this.searchWidget.searchInput||this.searchWidget.searchInput.getValue()==="")}allFilePatternFieldsClear(){return this.searchExcludePattern.getValue()===""&&this.searchIncludePattern.getValue()===""}hasSearchResults(){return!this.viewModel.searchResult.isEmpty()}clearSearchResults(e=!0){this.viewModel.searchResult.clear(),this.showEmptyStage(!0),this.contextService.getWorkbenchState()===1&&this.showSearchWithoutFolderMessage(),e&&(this.allSearchFieldsClear()&&this.clearFilePatternFields(),this.searchWidget.clear()),this.viewModel.cancelSearch(),this.viewModel.cancelAISearch(),this.tree.ariaLabel=d(14070,null),this.accessibilitySignalService.playSignal($o.clear),this.reLayout()}clearFilePatternFields(){this.searchExcludePattern.clear(),this.searchIncludePattern.clear()}cancelSearch(e=!0){return this.viewModel.cancelSearch()&&this.viewModel.cancelAISearch()?(e&&this.searchWidget.focus(),!0):!1}selectTreeIfNotSelected(){if(this.tree.getNode(void 0)&&(this.tree.domFocus(),this.tree.getSelection().length===0)){let t=$E();this.tree.focusNext(void 0,void 0,t),this.tree.setSelection(this.tree.getFocus(),t)}}getSearchTextFromEditor(e,t){if(Gr(this.getContainer())||(t=t??this.editorService.activeTextEditorControl,!t))return null;let o=this.searchConfig.seedWithNearestWord&&e;return xNi(o,t)}showsFileTypes(){return this.queryDetails.classList.contains("more")}toggleCaseSensitive(){this.searchWidget.searchInput?.setCaseSensitive(!this.searchWidget.searchInput.getCaseSensitive()),this.triggerQueryChange({shouldKeepAIResults:!0})}toggleWholeWords(){this.searchWidget.searchInput?.setWholeWords(!this.searchWidget.searchInput.getWholeWords()),this.triggerQueryChange({shouldKeepAIResults:!0})}toggleRegex(){this.searchWidget.searchInput?.setRegex(!this.searchWidget.searchInput.getRegex()),this.triggerQueryChange({shouldKeepAIResults:!0})}togglePreserveCase(){this.searchWidget.replaceInput?.setPreserveCase(!this.searchWidget.replaceInput.getPreserveCase()),this.triggerQueryChange({shouldKeepAIResults:!0})}setSearchParameters(e={}){typeof e.isCaseSensitive=="boolean"&&this.searchWidget.searchInput?.setCaseSensitive(e.isCaseSensitive),typeof e.matchWholeWord=="boolean"&&this.searchWidget.searchInput?.setWholeWords(e.matchWholeWord),typeof e.isRegex=="boolean"&&this.searchWidget.searchInput?.setRegex(e.isRegex),typeof e.filesToInclude=="string"&&this.searchIncludePattern.setValue(String(e.filesToInclude)),typeof e.filesToExclude=="string"&&this.searchExcludePattern.setValue(String(e.filesToExclude)),typeof e.query=="string"&&this.searchWidget.searchInput?.setValue(e.query),typeof e.replace=="string"?this.searchWidget.replaceInput?.setValue(e.replace):this.searchWidget.replaceInput&&this.searchWidget.replaceInput.getValue()!==""&&this.searchWidget.replaceInput.setValue(""),typeof e.triggerSearch=="boolean"&&e.triggerSearch&&this.triggerQueryChange(),typeof e.preserveCase=="boolean"&&this.searchWidget.replaceInput?.setPreserveCase(e.preserveCase),typeof e.useExcludeSettingsAndIgnoreFiles=="boolean"&&this.inputPatternExcludes.setUseExcludesAndIgnoreFiles(e.useExcludeSettingsAndIgnoreFiles),typeof e.onlyOpenEditors=="boolean"&&this.searchIncludePattern.setOnlySearchInOpenEditors(e.onlyOpenEditors)}toggleQueryDetails(e=!0,t,o,n){t=typeof t>"u"?!this.queryDetails.classList.contains("more"):!!t,this.viewletState.query||(this.viewletState.query={}),this.viewletState.query.queryDetailsExpanded=t,o=!!o,t?(this.toggleQueryDetailsButton.setAttribute("aria-expanded","true"),this.queryDetails.classList.add("more"),e&&(n?(this.inputPatternExcludes.focus(),this.inputPatternExcludes.select()):(this.inputPatternIncludes.focus(),this.inputPatternIncludes.select()))):(this.toggleQueryDetailsButton.setAttribute("aria-expanded","false"),this.queryDetails.classList.remove("more"),e&&this.searchWidget.focus()),!o&&this.size&&this.reLayout()}searchInFolders(e=[]){this._searchWithIncludeOrExclude(!0,e)}searchOutsideOfFolders(e=[]){this._searchWithIncludeOrExclude(!1,e)}_searchWithIncludeOrExclude(e,t){if(!t.length||t.some(o=>o===".")){this.inputPatternIncludes.setValue(""),this.searchWidget.focus();return}this.showsFileTypes()||this.toggleQueryDetails(!0,!0),(e?this.inputPatternIncludes:this.inputPatternExcludes).setValue(t.join(", ")),this.searchWidget.focus(!1)}triggerQueryChange(e){let t={preserveFocus:!0,triggeredOnType:!1,delay:0,...e};if(!(t.triggeredOnType&&!this.searchConfig.searchOnType)&&!this.pauseSearching){let o=t.triggeredOnType?t.delay:0;this.triggerQueryDelayer.trigger(()=>{this._onQueryChanged(t.preserveFocus,t.triggeredOnType,t.shouldKeepAIResults,t.shouldUpdateAISearch)},o)}}_getExcludePattern(){return this.inputPatternExcludes.getValue().trim()}_getIncludePattern(){return this.inputPatternIncludes.getValue().trim()}_onQueryChanged(e,t=!1,o=!1,n=!1){if(!this.searchWidget.searchInput?.inputBox.isInputValid())return;let r=this.searchWidget.searchInput.getRegex(),s=this.searchWidget.getNotebookFilters().markupInput,l=this.searchWidget.getNotebookFilters().markupPreview,c=this.searchWidget.getNotebookFilters().codeInput,u=this.searchWidget.getNotebookFilters().codeOutput,p=this.searchWidget.searchInput.getWholeWords(),h=this.searchWidget.searchInput.getCaseSensitive(),g=this.searchWidget.searchInput.getValue(),f=this._getExcludePattern(),v=this._getIncludePattern(),b=this.inputPatternExcludes.useExcludesAndIgnoreFiles(),S=this.inputPatternIncludes.onlySearchInOpenEditors();if(g.length===0){this.clearSearchResults(!1),this.clearMessage(),this.clearAIResults();return}let y={pattern:g,isRegExp:r,isCaseSensitive:h,isWordMatch:p,notebookInfo:{isInNotebookMarkdownInput:s,isInNotebookMarkdownPreview:l,isInNotebookCellInput:c,isInNotebookCellOutput:u}},w=[{pattern:this.inputPatternExcludes.getValue()}],k=this.inputPatternIncludes.getValue(),T=y.isRegExp?1e4:1e3,P={_reason:"searchView",extraFileResources:this.instantiationService.invokeFunction(UJ),maxResults:this.searchConfig.maxResults??void 0,disregardIgnoreFiles:!b||void 0,disregardExcludeSettings:!b||void 0,ignoreGlobCase:!fn||void 0,onlyOpenEditors:S,excludePattern:w,includePattern:k,previewOptions:{matchLines:1,charsPerLine:T},isSmartCase:this.searchConfig.smartCase,expandPatterns:!0},O=this.contextService.getWorkspace().folders,V=G=>{this.searchWidget.searchInput?.showMessage({content:G.message,type:3}),this.viewModel.searchResult.clear()},H;try{H=this.queryBuilder.text(y,O.map(G=>G.uri),P)}catch(G){V(G);return}this.validateQuery(H).then(()=>{!o&&n&&this.tree.hasNode(this.searchResult.aiTextSearchResult)&&this.tree.collapse(this.searchResult.aiTextSearchResult),this.onQueryTriggered(H,P,f,v,t,o,n),e||this.searchWidget.focus(!1,void 0,!0)},V)}validateQuery(e){let t=e.folderQueries.map(o=>this.fileService.exists(o.folder).catch(()=>!1));return Promise.all(t).then(o=>{let n=e.folderQueries.filter((r,s)=>o[s]);if(!e.folderQueries.length||n.length)e.folderQueries=n;else{let r=e.folderQueries[0].folder.fsPath,s=d(14117,null,r);return Promise.reject(new Error(s))}})}onQueryTriggered(e,t,o,n,r,s,l){this.addToSearchHistoryDelayer.trigger(()=>{this.searchWidget.searchInput?.onSearchSubmit(),this.inputPatternExcludes.onSearchSubmit(),this.inputPatternIncludes.onSearchSubmit()}),this.viewModel.cancelSearch(!0),s||this.clearAIResults(),this.currentSearchQ=this.currentSearchQ.then(()=>this.doSearch(e,o,n,r,s,l)).then(()=>{},()=>{})}async _updateResults(){if(this.state!==0)try{let e=this.viewModel.searchResult.fileCount();this._visibleMatches!==e&&(this._visibleMatches=e,await this.refreshAndUpdateCount())}finally{this._refreshResultsScheduler.schedule()}}async expandIfSingularResult(){if(this.searchConfig.collapseResults!=="alwaysCollapse"&&this.viewModel.searchResult.matches().length===1){let t=this.viewModel.searchResult.matches()[0];await this.tree.expandTo(t),t.count()<50&&await this.tree.expand(t)}}appendSearchWithAIButton(e){let t=this.keybindingService.appendKeybinding(d(14122,null),"search.action.searchWithAI"),o=d(14120,null),n=this.messageDisposables.add(new VW(o,()=>{this.commandService.executeCommand("search.action.searchWithAI")},this.hoverService,t));M(e,n.element)}async onSearchComplete(e,t,o,n,r=!0,s){this.state=0,e(),r&&await this.refreshAndUpdateCount();let l=!this.viewModel.searchResult.isEmpty(),c=this.searchResult.getCachedSearchComplete(!0);if(n?.exit!==1){if(_i.AIResultsRequested.bindTo(this.contextKeyService).set(this.shouldShowAIResults()&&!!c),n&&this.tree.hasNode(this.searchResult.aiTextSearchResult)&&this.tree.isCollapsed(this.searchResult.aiTextSearchResult)){this.tree.expand(this.searchResult.aiTextSearchResult);return}if(l)this.viewModel.searchResult.toggleHighlights(this.isVisible()),qr(d(14068,null,this.viewModel.searchResult.count(),this.viewModel.searchResult.fileCount()));else{let u=!!t,p=!!o,h;n?this.inputPatternIncludes.onlySearchInOpenEditors()?p&&u?h=d(14078,null,o,t):p?h=d(14077,null,o):u?h=d(14075,null,t):h=d(14076,null):p&&u?h=d(14082,null,o,t):p?h=d(14081,null,o):u?h=d(14079,null,t):h=d(14080,null):h=Fxo,qr(h);let g=this.clearMessage();if(M(g,h),this.shouldShowAIResults()&&(this.appendSearchWithAIButton(g),M(g,cL("span",void 0," - "))),n)if(p||u){let f=this.messageDisposables.add(new VW(d(14110,null),this.onSearchAgain.bind(this),this.hoverService));M(g,f.element)}else{let f=this.messageDisposables.add(new VW(d(14088,null),this.onOpenSettings.bind(this),this.hoverService));M(g,f.element)}else{let f=this.messageDisposables.add(new VW(d(14109,null),()=>this.triggerQueryChange({preserveFocus:!1}),this.hoverService));M(g,f.element)}this.contextService.getWorkbenchState()===1&&this.showSearchWithoutFolderMessage(),this.reLayout()}if(n&&n.limitHit&&n.messages.push({type:2,text:d(14116,null)}),n&&n.messages)for(let u of n.messages)this.addMessage(u);this.reLayout()}}async onSearchError(e,t,o,n,r,s=!0){return this.state=0,ao(e)?this.onSearchComplete(t,o,n,r,s):(t(),this.searchWidget.searchInput?.showMessage({content:e.message,type:3}),this.viewModel.searchResult.clear(),Promise.resolve())}clearAIResults(){this.model.searchResult.aiTextSearchResult.hidden=!0,this.refreshTreeController.clearAllPending(),this._pendingSemanticSearchPromise=void 0,this._cachedResults=void 0,this._cachedKeywords=[],this.model.cancelAISearch(!0),this.model.clearAiSearchResults()}async requestAIResults(){this.logService.info(`SearchView: Requesting semantic results from keybinding. Cached: ${!!this.cachedResults}`),(!this.cachedResults||this.cachedResults.results.length===0)&&!this._pendingSemanticSearchPromise&&this.clearAIResults(),this.model.searchResult.aiTextSearchResult.hidden=!1,await this.queueRefreshTree(),await PVe(this.getControl(),this.model.searchResult.aiTextSearchResult)}async addAIResults(){let e=this._getExcludePattern(),t=this._getIncludePattern();this.searchWidget.searchInput?.clearMessage(),this.showEmptyStage(),this._visibleMatches=0,this.tree.setSelection([]),this.tree.setFocus([]),this.viewModel.replaceString=this.searchWidget.getReplaceValue();let o=this._pendingSemanticSearchPromise;o||(this.viewModel.searchResult.setAIQueryUsingTextQuery(),o=this._pendingSemanticSearchPromise=this.viewModel.aiSearch(()=>{this._pendingSemanticSearchPromise===o&&(this._pendingSemanticSearchPromise=void 0)})),o.then(n=>(this.updateSearchResultCount(this.viewModel.searchResult.query?.userDisabledExcludesAndIgnoreFiles,this.viewModel.searchResult.query?.onlyOpenEditors,!1),this.onSearchComplete(()=>{},e,t,n,!1,n.aiKeywords)),n=>this.onSearchError(n,()=>{},e,t,void 0,!1))}doSearch(e,t,o,n,r,s){let l;this.progressService.withProgress({location:this.getProgressLocation(),delay:n?300:0},p=>new Promise(h=>l=h)),this.searchWidget.searchInput?.clearMessage(),this.state=1,this.showEmptyStage(),this.model.searchResult.aiTextSearchResult.hidden&&s&&(this.logService.info(`SearchView: Semantic search visible. Keep semantic results: ${r}. Update semantic search: ${s}`),this.model.searchResult.aiTextSearchResult.hidden=!1);let c=setTimeout(()=>{this.state=2},2e3);this._visibleMatches=0,this._refreshResultsScheduler.schedule(),this.searchWidget.setReplaceAllActionState(!1),this.tree.setSelection([]),this.tree.setFocus([]),this.viewModel.replaceString=this.searchWidget.getReplaceValue();let u=this.viewModel.search(e);return(!r||s)&&this.viewModel.searchResult.setAIQueryUsingTextQuery(e),this.configurationService.getValue("search").searchView.keywordSuggestions&&this.getKeywordSuggestions(),u.asyncResults.then(p=>{clearTimeout(c);let h=this.configurationService.getValue("search").searchView.semanticSearchBehavior;return p.results.length===0&&h==="runOnEmpty"&&(this.logService.info("SearchView: Requesting semantic results on empty search."),this.model.searchResult.aiTextSearchResult.hidden=!1),this.onSearchComplete(l,t,o,p)},p=>(clearTimeout(c),this.onSearchError(p,l,t,o)))}onOpenSettings(e){Xt.stop(e,!1),this.openSettings("@id:files.exclude,search.exclude,search.useParentIgnoreFiles,search.useGlobalIgnoreFiles,search.useIgnoreFiles")}openSettings(e){let t={query:e};return this.contextService.getWorkbenchState()!==1?this.preferencesService.openWorkspaceSettings(t):this.preferencesService.openUserSettings(t)}onSearchAgain(){this.inputPatternExcludes.setValue(""),this.inputPatternIncludes.setValue(""),this.inputPatternIncludes.setOnlySearchInOpenEditors(!1),this.triggerQueryChange({preserveFocus:!1})}onEnableExcludes(){this.toggleQueryDetails(!1,!0),this.searchExcludePattern.setUseExcludesAndIgnoreFiles(!0)}onDisableSearchInOpenEditors(){this.toggleQueryDetails(!1,!0),this.inputPatternIncludes.setOnlySearchInOpenEditors(!1)}updateSearchResultCount(e,t,o=!1){if(this._cachedKeywords.length>0)return;let n=this.viewModel.searchResult.fileCount(this.viewModel.searchResult.aiTextSearchResult.hidden),r=this.viewModel.searchResult.count(this.viewModel.searchResult.aiTextSearchResult.hidden);this.hasSearchResultsKey.set(n>0);let s=this.messagesElement.style.display==="none",l=this.clearMessage(),c=o?"":this.buildResultCountMessage(r,n);if(this.tree.ariaLabel=c+d(14072,null,this.searchResult.query?.contentPattern.pattern??""),M(l,c),n>0){if(e){let h=" - "+d(14124,null)+" ",g=this.messageDisposables.add(new VW(d(14071,null),this.onEnableExcludes.bind(this),this.hoverService,d(14123,null)));M(l,cL("span",void 0,h,"(",g.element,")"))}if(t){let h=" - "+d(14083,null)+" ",g=this.messageDisposables.add(new VW(d(14084,null),this.onDisableSearchInOpenEditors.bind(this),this.hoverService,d(14069,null)));M(l,cL("span",void 0,h,"(",g.element,")"))}M(l," - ");let u=this.keybindingService.appendKeybinding(d(14087,null),"search.action.openInEditor"),p=this.messageDisposables.add(new VW(d(14086,null),()=>this.instantiationService.invokeFunction(v$t,this.searchResult,this.searchIncludePattern.getValue(),this.searchExcludePattern.getValue(),this.searchIncludePattern.onlySearchInOpenEditors()),this.hoverService,u));M(l,p.element),this.shouldShowAIResults()&&(M(l," - "),this.appendSearchWithAIButton(l)),this.reLayout()}else s||vo(this.messagesElement)}handleKeywordClick(e,t){this.searchWidget.searchInput?.setValue(e),this.triggerQueryChange({preserveFocus:!1,triggeredOnType:!1,shouldKeepAIResults:!1}),this.telemetryService.publicLog2("searchKeywordClick",{index:t,maxKeywords:this._cachedKeywords.length})}updateKeywordSuggestionUI(e){let t=this.messagesElement.firstChild;if(this._cachedKeywords.length>0){if(this._cachedKeywords.length>=3)return;M(t,", ");let o=this._cachedKeywords.length,n=this.messageDisposables.add(new VW(e.keyword,()=>this.handleKeywordClick(e.keyword,o),this.hoverService));M(t,n.element)}else{let o=this.clearMessage();o.classList.add("ai-keywords");let n=d(14073,null);M(o,n);let r=this.messageDisposables.add(new VW(e.keyword,()=>this.handleKeywordClick(e.keyword,0),this.hoverService));M(o,r.element)}this._cachedKeywords.push(e.keyword)}async getKeywordSuggestions(){let e=this._pendingSemanticSearchPromise;e||(this.viewModel.searchResult.setAIQueryUsingTextQuery(),e=this._pendingSemanticSearchPromise=this.viewModel.aiSearch(t=>{if(t&&DPt(t)){this.updateKeywordSuggestionUI(t);return}this._pendingSemanticSearchPromise===e&&(this._pendingSemanticSearchPromise=void 0)})),this._cachedResults=await e}addMessage(e){let t=this.messagesElement.firstChild;t&&M(t,c$t(e,this.instantiationService,this.notificationService,this.openerService,this.commandService,this.messageDisposables,()=>this.triggerQueryChange()))}buildResultCountMessage(e,t){return e===1&&t===1?d(14111,null,e,t):e===1?d(14113,null,e,t):t===1?d(14112,null,e,t):d(14114,null,e,t)}showSearchWithoutFolderMessage(){this.searchWithoutFolderMessageElement=this.clearMessage();let e=M(this.searchWithoutFolderMessageElement,cL("p",void 0,d(14121,null))),t=this.messageDisposables.add(new VW(d(14085,null),()=>{this.commandService.executeCommand(b0.ID).catch(o=>mt(o))},this.hoverService));M(e,t.element)}showEmptyStage(e=!1){((this.messagesElement.firstChild?.textContent?.indexOf(Fxo)??-1)>-1||e||!this.configurationService.getValue().search.searchOnType)&&vo(this.messagesElement),un(this.resultsElement),this.currentSelectedFileMatch=void 0}shouldOpenInNotebookEditor(e,t){return CU(e)||t.scheme!==Q.untitled&&this.notebookService.getContributedNotebookTypes(t).length>0}onFocus(e,t,o,n){let r=this.configurationService.getValue().search.useReplacePreview,s=el(e)?e.parent().resource:e.resource;return r&&this.viewModel.isReplaceActive()&&this.viewModel.replaceString&&!this.shouldOpenInNotebookEditor(e,s)?this.replaceService.openReplacePreview(e,t,o,n):this.open(e,t,o,n,s)}async open(e,t,o,n,r){let s=CNi(e,this.viewModel),l=el(e)?e.parent().matches():[],c=r??(el(e)?e.parent().resource:e.resource),u,p={preserveFocus:t,pinned:n,selection:s,revealIfVisible:!0};try{u=await this.editorService.openEditor({resource:c,options:p},o?In:jn);let h=u?.getControl();el(e)&&t&&pn(h)?this.viewModel.searchResult.getRangeHighlightDecorations().highlightRange(h.getModel(),e.range()):this.viewModel.searchResult.getRangeHighlightDecorations().removeHighlightRange()}catch(h){mt(h);return}if(u instanceof jD){let h=e.parent();if(el(e))if(CU(e))e.parent().showMatch(e);else{let g=u.getControl();if(g){h.bindNotebookEditorWidget(g),await h.updateMatchesForEditorWidget();let f=l.findIndex(S=>S.id()===e.id()),v=h.matches(),b=f>=v.length?v[v.length-1]:v[f];CU(b)&&(h.showMatch(b),(!this.tree.getFocus().includes(b)||!this.tree.getSelection().includes(b))&&(this.tree.setSelection([b],$E()),this.tree.setFocus([b])))}}}}openEditorWithMultiCursor(e){let t=el(e)?e.parent().resource:e.resource;return this.editorService.openEditor({resource:t,options:{preserveFocus:!1,pinned:!0,revealIfVisible:!0}}).then(o=>{if(o){let n=null;if(_l(e)?n=e:el(e)&&(n=e.parent()),n){let r=n.matches().map(l=>new ti(l.range().startLineNumber,l.range().startColumn,l.range().endLineNumber,l.range().endColumn)),s=ha(o.getControl());s&&vX.get(s)?.selectAllUsingSelections(r)}}this.viewModel.searchResult.getRangeHighlightDecorations().removeHighlightRange()},mt)}onUntitledDidDispose(e){if(!this.viewModel)return;let t=this.viewModel.searchResult.matches();for(let o=0,n=t.length;o<n;o++)e.toString()===t[o].resource.toString()&&this.viewModel.searchResult.remove(t[o]);t=this.viewModel.searchResult.matches(!0);for(let o=0,n=t.length;o<n;o++)e.toString()===t[o].resource.toString()&&this.viewModel.searchResult.remove(t[o])}onFilesChanged(e){if(!this.viewModel||this.searchConfig.sortOrder!=="modified"&&!e.gotDeleted())return;let t=this.viewModel.searchResult.matches();if(e.gotDeleted()){let o=t.filter(n=>e.contains(n.resource,2));this.viewModel.searchResult.remove(o)}else{let o=t.filter(n=>e.contains(n.resource));o.length&&this.searchConfig.sortOrder==="modified"&&this.updateFileStats(o).then(async()=>this.refreshTreeController.queue())}}get searchConfig(){return this.configurationService.getValue("search")}clearHistory(){this.searchWidget.clearHistory(),this.inputPatternExcludes.clearHistory(),this.inputPatternIncludes.clearHistory()}saveState(){if(!this.searchWidget)return;let e=this.inputPatternExcludes?.getValue().trim()??"",t=this.inputPatternIncludes?.getValue().trim()??"",o=this.inputPatternIncludes?.onlySearchInOpenEditors()??!1,n=this.inputPatternExcludes?.useExcludesAndIgnoreFiles()??!0,r=this.viewModel.preserveCase;if(this.viewletState.query||(this.viewletState.query={}),this.searchWidget.searchInput){let l=this.searchWidget.searchInput.getRegex(),c=this.searchWidget.searchInput.getWholeWords(),u=this.searchWidget.searchInput.getCaseSensitive(),p=this.searchWidget.searchInput.getValue(),h=this.searchWidget.getNotebookFilters().codeInput,g=this.searchWidget.getNotebookFilters().codeOutput,f=this.searchWidget.getNotebookFilters().markupInput,v=this.searchWidget.getNotebookFilters().markupPreview;this.viewletState.query.contentPattern=p,this.viewletState.query.regex=l,this.viewletState.query.wholeWords=c,this.viewletState.query.caseSensitive=u,this.viewletState.query.isInNotebookMarkdownInput=f,this.viewletState.query.isInNotebookMarkdownPreview=v,this.viewletState.query.isInNotebookCellInput=h,this.viewletState.query.isInNotebookCellOutput=g}this.viewletState.query.folderExclusions=e,this.viewletState.query.folderIncludes=t,this.viewletState.query.useExcludesAndIgnoreFiles=n,this.viewletState.query.preserveCase=r,this.viewletState.query.onlyOpenEditors=o;let s=this.searchAndReplaceWidget.isReplaceShown();this.viewletState.view||(this.viewletState.view={}),this.viewletState.view.showReplace=s,this.viewletState.view.treeLayout=this.isTreeLayoutViewVisible,this.viewletState.query.replaceText=s&&this.searchWidget.getReplaceValue(),this._saveSearchHistoryService(),this.memento.saveMemento(),super.saveState()}_saveSearchHistoryService(){if(this.searchWidget===void 0)return;let e=Object.create(null),t=this.searchWidget.getSearchHistory();t&&t.length&&(e.search=t);let o=this.searchWidget.getReplaceHistory();o&&o.length&&(e.replace=o);let n=this.inputPatternExcludes.getHistory();n&&n.length&&(e.exclude=n);let r=this.inputPatternIncludes.getHistory();r&&r.length&&(e.include=r),this.searchHistoryService.save(e)}async updateFileStats(e){let t=e.map(o=>o.resolveFileStat(this.fileService));await Promise.all(t)}removeFileStats(){for(let e of this.searchResult.matches())e.fileStat=void 0;for(let e of this.searchResult.matches(!0))e.fileStat=void 0}dispose(){this.isDisposed=!0,this.saveState(),super.dispose()}};Cq=I([m(1,fe),m(2,ee),m(3,qt),m(4,Fo),m(5,Ne),m(6,at),m(7,ge),m(8,Wn),m(9,F),m(10,Bi),m(11,B),m(12,Pe),m(13,Yoe),m(14,X),m(15,EI),m(16,Uo),m(17,Go),m(18,Le),m(19,CVe),m(20,Xe),m(21,Oi),m(22,_e),m(23,ce),m(24,Je),m(25,nt),m(26,bn),m(27,se),m(28,lr),m(29,Te)],Cq);var VW=class extends x{constructor(i,e,t,o){super(),this.element=cL("a.pointer",{tabindex:0},i),this._register(t.setupManagedHover(Ri("mouse"),this.element,o)),this.addEventHandlers(e)}addEventHandlers(i){let e=t=>{Xt.stop(t,!1),i(t)};this._register(j(this.element,re.CLICK,e)),this._register(j(this.element,re.KEY_DOWN,t=>{let o=new gi(t);(o.equals(10)||o.equals(3))&&(e(t),o.preventDefault(),o.stopPropagation())}))}};function CNi(a,i){let e=null;if(el(a)&&(e=a),_l(a)&&a.count()>0&&(e=a.matches()[a.matches().length-1]),e){let t=e.range();if(i.isReplaceActive()&&i.replaceString){let o=e.replaceString;return{startLineNumber:t.startLineNumber,startColumn:t.startColumn,endLineNumber:t.startLineNumber,endColumn:t.startColumn+o.length}}return t}}function xNi(a,i){let e=i;if(mc(e)&&(e.getOriginalEditor().hasTextFocus()?e=e.getOriginalEditor():e=e.getModifiedEditor()),!pn(e)||!e.hasModel())return null;let t=e.getSelection();if(!t)return null;if(t.isEmpty())return a?e.getModel().getWordAtPosition(t.getStartPosition())?.word??null:null;let o="";for(let n=t.startLineNumber;n<=t.endLineNumber;n++){let r=e.getModel().getLineContent(n);n===t.endLineNumber&&(r=r.substring(0,t.endColumn-1)),n===t.startLineNumber&&(r=r.substring(t.startColumn-1)),n!==t.startLineNumber&&(r=`
`+r),o+=r}return o}var Rst=class{constructor(i,e){this.searchView=i;this.configurationService=e}get searchConfig(){return this.configurationService.getValue("search")}createSearchResultIterator(i){let e=[];if(this.searchView.shouldShowAIResults()&&i.searchModel.hasPlainResults&&!i.aiTextSearchResult.hidden&&e.push(i.aiTextSearchResult),!i.plainTextSearchResult.isEmpty()){if(!this.searchView.shouldShowAIResults()||i.aiTextSearchResult.hidden)return this.createTextSearchResultIterator(i.plainTextSearchResult);e.push(i.plainTextSearchResult)}return e}createTextSearchResultIterator(i){let e=i.folderMatches().filter(t=>!t.isEmpty()).sort(TN);return e.length===1?this.createFolderIterator(e[0]):e}createFolderIterator(i){let e=this.searchView.isTreeLayoutViewVisible?i.matches():i.allDownstreamFileMatches(),t=e;return i instanceof Ufe||(t=e.sort((o,n)=>TN(o,n,this.searchConfig.sortOrder))),t}createFileIterator(i){return i.matches().sort(TN)}hasChildren(i){return el(i)?!1:lv(i)&&i.isAIContributed?!0:i.hasChildren}getChildren(i){return vN(i)?this.createSearchResultIterator(i):lv(i)?i.isAIContributed&&(!this.searchView.model.hasAIResults||this.searchView._pendingSemanticSearchPromise)?this.searchView.cachedResults?this.createTextSearchResultIterator(i):(this.searchView.addAIResults(),new Promise(e=>{let t=i.onChange(()=>{t.dispose(),e(this.createTextSearchResultIterator(i))})})):this.createTextSearchResultIterator(i):Fd(i)?this.createFolderIterator(i):_l(i)?this.createFileIterator(i):[]}getParent(i){let e=i.parent();if(vN(e))throw new Error("Invalid element passed to getParent");return e}};Rst=I([m(1,B)],Rst);var Mst=class extends x{constructor(e,t,o){super();this.searchView=e;this.geSearchConfig=t;this.fileService=o;this.queuedIChangeEvents=[];this.refreshTreeThrottler=this._register(new gu)}clearAllPending(){this.searchView.getControl().cancelAllRefreshPromises(!0)}async queue(e){return e&&this.queuedIChangeEvents.push(e),this.refreshTreeThrottler.queue(this.refreshTreeUsingQueue.bind(this))}async refreshTreeUsingQueue(){let e=this.queuedIChangeEvents.length===0?void 0:{elements:this.queuedIChangeEvents.map(t=>t.elements).flat(),added:this.queuedIChangeEvents.some(t=>t.added),removed:this.queuedIChangeEvents.some(t=>t.removed),clearingAll:this.queuedIChangeEvents.some(t=>t.clearingAll)};return this.queuedIChangeEvents=[],this.refreshTree(e)}async retrieveFileStats(){let e=this.searchView.model.searchResult.matches().filter(t=>!t.fileStat).map(t=>t.resolveFileStat(this.fileService));await Promise.all(e)}async refreshTree(e){let t=this.geSearchConfig();!e||e.added||e.removed?t.sortOrder==="modified"?await this.retrieveFileStats().then(()=>this.searchView.getControl().updateChildren(void 0)):await this.searchView.getControl().updateChildren(void 0):t.sortOrder==="countAscending"||t.sortOrder==="countDescending"?await this.searchView.getControl().updateChildren(void 0):e.elements.every(n=>this.searchView.getControl().hasNode(n))?await Promise.all(e.elements.map(async n=>{await this.searchView.getControl().updateChildren(n),this.searchView.getControl().rerender(n)})):this.searchView.getControl().updateChildren(void 0)}};Mst=I([m(2,fe)],Mst);var zfe=class extends x{static{this.ID="workbench.contributions.searchChatContextContribution"}constructor(i,e){super(),this._store.add(e.registerChatContextItem(i.createInstance(Pst))),this._store.add(e.registerChatContextItem(i.createInstance(Nst))),this._store.add(e.registerChatContextItem(this._store.add(i.createInstance(Ast))))}};zfe=I([m(0,F),m(1,DS)],zfe);var Pst=class{constructor(i,e,t){this._contextKeyService=i;this._viewsService=e;this._labelService=t;this.type="valuePick";this.label=d(14027,null);this.icon=R.search;this.ordinal=500}isEnabled(i){return!!_i.HasSearchResults.getValue(this._contextKeyService)&&!!i.attachmentCapabilities.supportsSearchResultAttachments}async asAttachment(){let i=this._viewsService.getViewWithId(Iy);return i instanceof Cq?i.model.searchResult.matches().map(e=>({kind:"file",id:e.resource.toString(),value:e.resource,name:this._labelService.getUriBasenameLabel(e.resource)})):[]}};Pst=I([m(0,X),m(1,$t),m(2,rt)],Pst);var Ast=class{constructor(i){this._instantiationService=i;this.type="pickerPick";this.label=d(14029,null);this.icon=R.symbolField;this.ordinal=-200}dispose(){this._provider?.dispose()}isEnabled(i){return!!i.attachmentCapabilities.supportsSymbolAttachments}asPicker(){return{placeholder:d(14028,null),picks:Spe((i,e)=>(this._provider??=this._instantiationService.createInstance(Yk),this._provider.getSymbolPicks(i,void 0,e).then(t=>{let o=[];for(let n of t){if(!n.symbol)continue;let r={kind:"symbol",id:JSON.stringify(n.symbol.location),value:n.symbol.location,symbolKind:n.symbol.kind,icon:_m.toIcon(n.symbol.kind),fullName:n.label,name:n.symbol.name};o.push({label:n.symbol.name,iconClass:q.asClassName(_m.toIcon(n.symbol.kind)),asAttachment(){return r}})}return o})))}}};Ast=I([m(0,F)],Ast);var Nst=class{constructor(i,e,t,o,n,r,s,l,c){this._searchService=i;this._labelService=e;this._modelService=t;this._languageService=o;this._configurationService=n;this._workspaceService=r;this._fileService=s;this._historyService=l;this._instantiationService=c;this.type="pickerPick";this.label=d(14026,null);this.icon=R.folder;this.ordinal=600}asPicker(){return{placeholder:d(14025,null),picks:Spe(async(i,e)=>{let t=this._workspaceService.getWorkspace().folders.map(r=>r.uri),o=[];if((await cdn(t,this._fileService)).forEach(r=>o.push(this._createPickItem(r,1))),this._historyService.getHistory().filter(r=>r.resource&&this._instantiationService.invokeFunction(s=>KEe(s,r.resource.scheme))).slice(0,30).forEach(r=>o.push(this._createPickItem(r.resource,0))),i==="")return o;let n=[];return await Promise.all(t.map(async r=>{let{folders:s,files:l}=await kNi(r,i,!0,e,void 0,this._configurationService,this._searchService);for(let c of s)n.push(this._createPickItem(c,1));for(let c of l)n.push(this._createPickItem(c,0))})),n.sort((r,s)=>Hl(r.label,s.label)),n})}}_createPickItem(i,e){return{label:He(i),description:this._labelService.getUriLabel(ci(i),{relative:!0}),iconClasses:aa(this._modelService,this._languageService,i,e),asAttachment:()=>({kind:e===0?"file":"directory",id:i.toString(),value:i,name:He(i)})}}};Nst=I([m(0,gg),m(1,rt),m(2,Tt),m(3,_t),m(4,B),m(5,Pe),m(6,fe),m(7,na),m(8,F)],Nst);async function kNi(a,i,e,t,o,n,r){let s=e?sdn(i):adn(i),l=KB(n.getValue({resource:a}))||{},c={folderQueries:[{folder:a,disregardIgnoreFiles:n.getValue("explorer.excludeGitIgnore")}],type:1,shouldGlobMatchFilePattern:!0,cacheKey:o,excludePattern:l,sortByScore:!0,ignoreGlobCase:!0},u;try{u=await r.fileSearch({...c,filePattern:`{**/${s}/**,**/${s}}`},t)}catch(g){if(!ao(g))throw g}if(!u||t?.isCancellationRequested)return{files:[],folders:[]};let p=u.results.map(g=>g.resource);return{folders:ldn(p,a,s),files:p}}function sdn(a){return a?"*"+a.split("").join("*")+"*":"*"}function adn(a){return a?"*"+a+"*":"*"}function ldn(a,i,e){let t=new En;for(let n of a){let r=Wd(i,n);if(!r)throw new Error("Resource is not a child of the workspace");let s=i,l=r.split("/").slice(0,-1);for(let c of l)s=s.with({path:`${s.path}/${c}`}),t.add(s)}let o=[];for(let n of t){let r=n.path.split("/"),s=r[r.length-1];!s||!Ed(e,s,{ignoreCase:!0})||o.push(n)}return o}async function cdn(a,i){let e=[];for(let t of a){let o=i.getProvider(t.scheme);if(!o)continue;let n=await o.readdir(t);for(let[r,s]of n){let l=Ge(t,r);s===2&&e.push(l)}}return e}var TNi=/\/[\p{L}0-9_.:-]*/gu,ENi=/(@|\/)[\p{L}0-9_.:-]*/gu,Ost=class extends x{constructor(e,t,o,n,r,s,l){super();this.languageFeaturesService=e;this.chatWidgetService=t;this.chatSlashCommandService=o;this.promptsService=n;this._register(this.languageFeaturesService.completionProvider.register({scheme:Q.vscodeChatInput,hasAccessToAllModels:!0},{_debugDisplayName:"globalSlashCommands",triggerCharacters:[Bu],provideCompletionItems:async(c,u,p,h)=>{let g=this.chatWidgetService.getWidgetByInputUri(c.uri);if(!g||!g.viewModel)return null;let f;if(g.lockedAgentId){let w=g.viewModel.model.sessionResource;f=(w&&r.getChatSessionFromInternalUri(w)?s.getCustomAgentTargetForSessionType(gl(w)):void 0)??"undefined"}let v=PM(c,u,TNi);if(!v)return null;if(!eoe(c,v)||g.parsedInput.parts.find(w=>w instanceof lp))return;let y=this.chatSlashCommandService.getCommands(g.location,g.input.currentModeKind);return y?{suggestions:y.filter(w=>!w.silent&&!g.attachmentCapabilities.supportsPromptAttachments||w.when&&!g.scopedContextKeyService.contextMatchesRules(w.when)?!1:g.lockedAgentId?!(w.modes&&w.modes.length&&!w.modes.includes("agent")||w.targets&&f&&!w.targets.includes(f)):!0).map((w,k)=>{let T=`/${w.command}`;return{label:{label:T,description:w.detail},insertText:w.executeImmediately?"":`${T} `,documentation:w.detail,range:v,sortText:w.sortText??"a".repeat(k+1),kind:18,command:w.executeImmediately?{id:BT.ID,title:T,arguments:[{widget:g,inputValue:`${T} `}]}:void 0}})}:null}})),this._register(this.languageFeaturesService.completionProvider.register({scheme:Q.vscodeChatInput,hasAccessToAllModels:!0},{_debugDisplayName:"globalSlashCommandsAt",triggerCharacters:[zc],provideCompletionItems:async(c,u,p,h)=>{let g=this.chatWidgetService.getWidgetByInputUri(c.uri);if(!g||!g.viewModel)return null;let f=PM(c,u,/@\w*/g);if(!f)return null;if(!eoe(c,f))return;let v=this.chatSlashCommandService.getCommands(g.location,g.input.currentModeKind);return!v||g.lockedAgentId?null:{suggestions:v.filter(b=>!b.when||g.scopedContextKeyService.contextMatchesRules(b.when)).map((b,S)=>{let y=`${Bu}${b.command}`;return{label:{label:y,description:b.detail},insertText:b.executeImmediately?"":`${y} `,documentation:b.detail,range:f,filterText:`${zc}${b.command}`,sortText:b.sortText??"z".repeat(S+1),kind:18,command:b.executeImmediately?{id:BT.ID,title:y,arguments:[{widget:g,inputValue:`${y} `}]}:void 0}})}}})),this._register(this.languageFeaturesService.completionProvider.register({scheme:Q.vscodeChatInput,hasAccessToAllModels:!0},{_debugDisplayName:"promptSlashCommands",triggerCharacters:[Bu],provideCompletionItems:async(c,u,p,h)=>{let g=this.chatWidgetService.getWidgetByInputUri(c.uri);if(!g||!g.viewModel)return null;let f=PM(c,u,TNi);if(!f)return null;if(!eoe(c,f)||g.parsedInput.parts.find(w=>w instanceof lp))return;let S=await this.promptsService.getPromptSlashCommands(h);if(S.length===0||g.lockedAgentId&&!g.attachmentCapabilities.supportsPromptAttachments)return null;let y=S.filter(w=>{if(g.lockedAgentId)try{let k=e9e(w.promptPath.uri);if(k&&k==="hook")return!1}catch{}return!0}).filter(w=>w.parsedPromptFile?.header?.userInvocable!==!1).filter(w=>!w.when||g.scopedContextKeyService.contextMatchesRules(w.when));return y.length===0?null:{suggestions:y.map((w,k)=>{let T=`/${w.name}`,P=w.description;return{label:{label:T,description:P},insertText:`${T} `,documentation:w.description,range:f,sortText:"a".repeat(k+1),kind:18}})}}})),this._register(this.languageFeaturesService.completionProvider.register({scheme:Q.vscodeChatInput,hasAccessToAllModels:!0},{_debugDisplayName:"mcpPromptSlashCommands",triggerCharacters:[Bu],provideCompletionItems:async(c,u,p,h)=>{let g=this.chatWidgetService.getWidgetByInputUri(c.uri);if(!g||!g.viewModel)return null;let f=PM(c,u,/\/[\p{L}0-9_.-]*/gu);if(!f)return null;if(eoe(c,f))return g.lockedAgentId?null:{suggestions:l.servers.get().flatMap(v=>v.prompts.get().map(b=>{let S=`/mcp.${b.id}`;return{label:{label:S,description:b.description},command:{id:T$t.ID,title:b.name,arguments:[c,v,b,`${S} `]},insertText:`${S} `,range:f,kind:18}}))}}}))}};Ost=I([m(0,Qt),m(1,Pt),m(2,BF),m(3,Or),m(4,mi),m(5,Us),m(6,_s)],Ost);ne.as(Qi.Workbench).registerWorkbenchContribution(Ost,4);var Fst=class extends x{constructor(e,t,o,n,r){super();this.languageFeaturesService=e;this.chatWidgetService=t;this.chatAgentService=o;this.chatAgentNameService=n;this.chatSessionsService=r;let s={_debugDisplayName:"chatAgentSubcommand",triggerCharacters:[Bu],provideCompletionItems:async(l,c,u,p)=>{let h=this.chatWidgetService.getWidgetByInputUri(l.uri);if(!h||!h.viewModel)return;let g=PM(l,c,TNi);if(!g)return;let f=this.getCurrentAgentForWidget(h);if(!(!f||f.command))return{suggestions:f.agent.slashCommands.map((v,b)=>{let S=`/${v.name}`;return{label:S,insertText:`${S} `,documentation:v.description,range:g,kind:18}})}}};this._register(this.languageFeaturesService.completionProvider.register({scheme:Q.vscodeChatInput,hasAccessToAllModels:!0},s)),this._register(this.languageFeaturesService.completionProvider.register({scheme:Q.vscodeChatInput,hasAccessToAllModels:!0},{_debugDisplayName:"chatAgentAndSubcommand",triggerCharacters:[zc],provideCompletionItems:async(l,c,u,p)=>{let h=this.chatWidgetService.getWidgetByInputUri(l.uri),g=h?.viewModel;if(!h||!g)return;if(h.lockedAgentId)return null;let f=PM(l,c,ENi);if(!f)return null;if(!eoe(l,f))return;let v=this.chatAgentService.getAgents().filter(T=>T.locations.includes(h.location)),b=this.chatSessionsService.getAllChatSessionContributions(),S=new Set(b.map(T=>T.type)),y=v.filter(T=>!S.has(T.id)),w=(T,P)=>{let O=T.id==="github.copilot.terminalPanel"?"0000":"";return`${zc}${O}${T.name}.${P}`};return{suggestions:v.filter(T=>!T.isDefault).filter(T=>!S.has(T.id)).map(T=>{let{label:P,isDupe:O}=this.getAgentCompletionDetails(T),V=T.description;return{label:O?{label:P,description:T.description,detail:` (${T.publisherDisplayName})`}:P,documentation:V,filterText:`${zc}${T.name}`,insertText:`${P} `,range:f,kind:18,sortText:`${zc}${T.name}`,command:{id:i6.ID,title:i6.ID,arguments:[{agent:T,widget:h}]}}}).concat(di(y.flatMap(T=>T.slashCommands.map((P,O)=>{if(T.isDefault&&this.chatAgentService.getDefaultAgent(h.location,h.input.currentModeKind)?.id!==T.id)return;let{label:V,isDupe:H}=this.getAgentCompletionDetails(T),G=`${V} ${Bu}${P.name}`,$={label:H?{label:G,description:P.description,detail:H?` (${T.publisherDisplayName})`:void 0}:G,documentation:P.description,filterText:w(T,P.name),commitCharacters:[" "],insertText:G+" ",range:f,kind:18,sortText:`x${zc}${T.name}${P.name}`,command:{id:i6.ID,title:i6.ID,arguments:[{agent:T,widget:h}]}};if(T.isDefault){let J=`${Bu}${P.name}`;$.label=J,$.insertText=`${J} `,$.documentation=P.description}return $}))))}}})),this._register(this.languageFeaturesService.completionProvider.register({scheme:Q.vscodeChatInput,hasAccessToAllModels:!0},{_debugDisplayName:"chatAgentAndSubcommand",triggerCharacters:[Bu],provideCompletionItems:async(l,c,u,p)=>{let h=this.chatWidgetService.getWidgetByInputUri(l.uri),g=h?.viewModel;if(!h||!g)return;if(h.lockedAgentId)return null;let f=PM(l,c,ENi);if(!f)return null;if(!eoe(l,f))return;let v=this.chatAgentService.getAgents().filter(b=>b.locations.includes(h.location)&&b.modes.includes(h.input.currentModeKind)).filter(b=>!this.chatSessionsService.getChatSessionContribution(b.id));return{suggestions:di(v.flatMap(b=>b.slashCommands.map((S,y)=>{if(b.isDefault&&this.chatAgentService.getDefaultAgent(h.location,h.input.currentModeKind)?.id!==b.id)return;let{label:w,isDupe:k}=this.getAgentCompletionDetails(b),T=`${Bu}${S.name}`,P=b.id==="github.copilot.terminalPanel"?"z":"",O=`${Bu}${P}${b.name}${S.name}`,V={label:{label:T,description:w,detail:k?` (${b.publisherDisplayName})`:void 0},commitCharacters:[" "],insertText:`${w} ${T} `,documentation:`(${w}) ${S.description??""}`,range:f,kind:18,sortText:O,command:{id:i6.ID,title:i6.ID,arguments:[{agent:b,widget:h}]}};if(b.isDefault){let H=`${Bu}${S.name}`;V.label=H,V.insertText=`${H} `,V.documentation=S.description}return V})))}}})),this._register(this.languageFeaturesService.completionProvider.register({scheme:Q.vscodeChatInput,hasAccessToAllModels:!0},{_debugDisplayName:"installChatExtensions",triggerCharacters:[zc],provideCompletionItems:async(l,c,u,p)=>{if(!l.getLineContent(1).startsWith(zc))return;let h=this.chatWidgetService.getWidgetByInputUri(l.uri);if(h?.location!=="panel"||h.input.currentModeKind!=="ask")return;if(h.lockedAgentId)return null;let g=PM(l,c,ENi);if(!g||!eoe(l,g))return;let f=d(8029,null);return{suggestions:[{label:f,insertText:"",range:g,kind:18,command:{id:"workbench.extensions.search",title:"",arguments:["@tag:chat-participant"]},filterText:zc+f,sortText:"zzz"}]}}}))}getCurrentAgentForWidget(e){if(e.lockedAgentId){let s=this.chatAgentService.getAgent(e.lockedAgentId);return s&&{agent:s}}let t=e.parsedInput.parts,o=t.findIndex(s=>s instanceof lp);if(o<0)return;let n=t[o],r=t.find(s=>s instanceof Xf||s instanceof dT);if(r)return{agent:n.agent,command:r instanceof Xf?r.command.name:void 0};for(let s of t.slice(o+1))if(!(s instanceof Pv)||!s.text.trim().match(/^(\/[\p{L}0-9_.:-]*)?$/u))return;return{agent:n.agent}}getAgentCompletionDetails(e){let t=this.chatAgentNameService.getAgentNameRestriction(e),o=`${zc}${t?e.name:c4(e)}`,n=t&&this.chatAgentService.agentHasDupeName(e.id);return{label:o,isDupe:n}}};Fst=I([m(0,Qt),m(1,Pt),m(2,cr),m(3,_K),m(4,Us)],Fst);ne.as(Qi.Workbench).registerWorkbenchContribution(Fst,4);var i6=class a extends K{static{this.ID="workbench.action.chat.assignSelectedAgent"}constructor(){super({id:a.ID,title:""})}async run(i,...e){let t=e[0];!t||!t.widget||!t.agent||(t.agent.modes.includes(t.widget.input.currentModeKind)||t.widget.input.setChatMode(t.agent.modes[0]),t.widget.lastSelectedAgent=t.agent)}};W(i6);var T$t=class a extends K{static{this.ID="workbench.action.chat.startParameterizedPrompt"}constructor(){super({id:a.ID,title:""})}async run(i,e,t,o,n){if(!e||!o)return;let r=i.get(F),s=i.get(Ne),l=i.get(Pt),c=i.get(fe),u=await l.revealWidget(!0);if(!u)return;let p=e.getFullModelRange().collapseToEnd(),h=()=>e.findMatches(n,!0,!1,!0,null,!1)[0],g=S=>e.applyEdits([{range:h()?.range||p,text:S}]),f=new N,v=f.add(new Ye);f.add(u.input.startGenerating()),f.add(e.onDidChangeContent(()=>{h()&&v.cancel()})),e.changeDecorations(S=>{let y=S.addDecoration(p,{description:"mcp-prompt-spinner",showIfCollapsed:!0,after:{content:" ",inlineClassNameAffectsLetterSpacing:!0,inlineClassName:q.asClassName(q.modify(R.loading,"spin"))+" chat-prompt-spinner"}});f.add(Z(()=>{e.changeDecorations(w=>w.removeDecoration(y))}))});let b=f.add(r.createInstance(bVe,o));try{await t.start();let S=await b.createArgs();if(!S){g("");return}let y;try{y=await o.resolve(S,v.token)}catch(O){v.token.isCancellationRequested||s.error(d(8030,null,String(O))),g("");return}let w=[],k=async(O,V,H,G=!1)=>{let $;if(H)for(let J of[A.parse(H),Bw.fromServer(t.definition,H)])try{$||=await c.exists(J)?J:void 0}catch{}if(G)$?w.push({id:xt(),kind:"file",value:$,name:He($)}):w.push({id:xt(),kind:"generic",value:V,name:d(8032,null)});else if(O&&f3(O)){let J=await JP(V).catch(()=>qa(V).buffer);u.attachmentModel.addContext({id:xt(),name:d(8031,null),fullName:d(8031,null),value:J,kind:"image",references:$&&[{reference:$,kind:"reference"}]})}else $&&w.push({id:xt(),kind:"file",value:$,name:He($)})},T=y.some(O=>O.role!==y[0].role),P="";for(let O of y)switch(O.content.type){case"text":P&&(P+=`

`),T&&(P+=`--${O.role.toUpperCase()}
`),P+=O.content.text;break;case"resource":"text"in O.content.resource?await k(O.content.resource.mimeType,O.content.resource.text,O.content.resource.uri,!0):await k(O.content.resource.mimeType,O.content.resource.blob,O.content.resource.uri);break;case"image":case"audio":await k(O.content.mimeType,O.content.data);break}w.length&&u.attachmentModel.addContext(...w),g(P)}finally{f.dispose()}}};W(T$t);var Kfe=class{constructor(i,e){this.widget=i;this.variable=e}},GM=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super();this.historyService=e;this.workspaceContextService=t;this.searchService=o;this.labelService=n;this.languageFeaturesService=r;this.chatWidgetService=s;this.outlineService=l;this.editorService=c;this.configurationService=u;this.codeEditorService=p;this.chatAgentService=h;this.instantiationService=g;this.chatDebugService=f;this.chatSessionsService=v;let b=new RegExp(`[${mQ(Tu)}${mQ(zc)}][^\\s]*`,"g");this.registerVariableCompletions("fileAndFolder",async({widget:y,range:w},k)=>{if(!y.supportsFileReferences)return;let T={suggestions:[]};if(y.lockedAgentId){let P=this.chatAgentService.getAgent(y.lockedAgentId);if(P&&!P.capabilities?.supportsFileAttachments)return T}return await this.addFileAndFolderEntries(y,T,w,k),T},b),this.registerVariableCompletions("selection",({widget:y,range:w},k)=>{if(!y.supportsFileReferences||y.location==="editor")return;let T=this.findActiveCodeEditor();if(!pn(T))return;let P=T.getModel()?.uri,O=T.getSelection();if(!O||!P||O.isEmpty())return;let V=w.varWord?.word?.charAt(0)===zc?zc:Tu,H=this.labelService.getUriBasenameLabel(P),G=`${V}file:${H}:${O.startLineNumber}-${O.endLineNumber}`,$=`:${O.startLineNumber}:${O.startColumn}-${O.endLineNumber}:${O.endColumn}`,J=this.labelService.getUriLabel(P,{relative:!0})+$,ae={suggestions:[]};return ae.suggestions.push({label:{label:`${V}selection`,description:J},filterText:`${V}selection`,insertText:w.varWord?.endColumn===w.replace.endColumn?`${G} `:G,range:w,kind:18,sortText:"z",command:{id:GM.addReferenceCommand,title:"",arguments:[new Kfe(y,{id:"vscode.selection",isFile:!0,range:{startLineNumber:w.replace.startLineNumber,startColumn:w.replace.startColumn,endLineNumber:w.replace.endLineNumber,endColumn:w.replace.startColumn+G.length},data:{range:O,uri:P}})]}}),ae}),this.registerVariableCompletions("symbol",({widget:y,range:w,position:k,model:T},P)=>{if(!y.supportsFileReferences)return null;let O={suggestions:[]},V=PM(T,k,new RegExp(`[${mQ(Tu)}${mQ(zc)}][^\\s]*`,"g"),!0);return V&&this.addSymbolEntries(y,O,V,P),O});let S=new RegExp(`${Tu}[^\\s]*`,"g");this.registerVariableCompletions("sessionReference",async({widget:y,range:w},k)=>{if(y.location!=="panel")return;let T=w.varWord?.word??"",P=`${Tu}session`,O={suggestions:[]};if(T.toLowerCase().startsWith(`${P}:`)){let V=[],H=["local","copilotcli","claude-code"];for await(let J of this.chatSessionsService.getChatSessionItems(H,k)){if(k.isCancellationRequested)return;let ae=lT(J.chatSessionType);for(let he of J.items)V.push({title:he.label,sessionResource:he.resource,lastMessageDate:he.timing.lastRequestEnded??he.timing.created,icon:he.iconPath??ae})}let G=y.viewModel?.sessionResource,$=V.filter(J=>!G||J.sessionResource.toString()!==G.toString()).sort((J,ae)=>ae.lastMessageDate-J.lastMessageDate);for(let J of $){let ae=`${P}:${J.title}`,he=new Date(J.lastMessageDate).toLocaleString();O.suggestions.push({label:{label:J.title,description:he},filterText:`${P}:${J.title}`,insertText:w.varWord?.endColumn===w.replace.endColumn?`${ae} `:ae,range:w,kind:18,sortText:`z${String(Number.MAX_SAFE_INTEGER-J.lastMessageDate).padStart(20,"0")}`,command:{id:GM.addReferenceCommand,title:"",arguments:[new Kfe(y,{id:J.sessionResource.toString(),icon:J.icon,range:{startLineNumber:w.replace.startLineNumber,startColumn:w.replace.startColumn,endLineNumber:w.replace.endLineNumber,endColumn:w.replace.startColumn+ae.length},data:J.sessionResource})]}})}}else O.suggestions.push({label:{label:P,description:d(8033,null)},filterText:P,insertText:`${P}:`,range:w,kind:18,sortText:"z",command:{id:"editor.action.triggerSuggest",title:""}});return O},S),this.registerVariableCompletions("debugEventsSnapshot",({widget:y,range:w})=>{if(y.location!=="panel")return;let k=y.viewModel?.sessionResource;if(!k||this.chatDebugService.getEvents(k).length===0)return;let T=`${Tu}debugEventsSnapshot`,P={suggestions:[]};return P.suggestions.push({label:{label:T,description:d(8027,null)},filterText:T,insertText:"",range:w,kind:18,sortText:"z",command:{id:GM.addDebugEventsSnapshotCommand,title:"",arguments:[y]}}),P}),this._register($e.registerCommand(GM.addReferenceCommand,(y,w)=>(wo(w instanceof Kfe),this.cmdAddReference(w)))),this._register($e.registerCommand(GM.addDebugEventsSnapshotCommand,async(y,w)=>{let k=w.viewModel?.sessionResource;if(!k)return;let T=await A0e(k,this.chatDebugService);w.attachmentModel.addContext(T)}))}static{this.addReferenceCommand="_addReferenceCmd"}static{this.addDebugEventsSnapshotCommand="_addDebugEventsSnapshotCmd"}static{this.VariableNameDef=new RegExp(`[${mQ(Tu)}${mQ(zc)}][\\w:-]*`,"g")}findActiveCodeEditor(){let e=this.codeEditorService.getActiveCodeEditor();if(e){let t=e.getModel();if(t?.uri.scheme===Q.vscodeNotebookCell)return;if(t)return e}for(let t of this.editorService.getVisibleTextEditorControls(0)){let o=ha(t);if(!o)continue;if(o.getModel())return o}}registerVariableCompletions(e,t,o=GM.VariableNameDef){this._register(this.languageFeaturesService.completionProvider.register({scheme:Q.vscodeChatInput,hasAccessToAllModels:!0},{_debugDisplayName:`chatVarCompletions-${e}`,triggerCharacters:[Tu,zc],provideCompletionItems:async(n,r,s,l)=>{let c=this.chatWidgetService.getWidgetByInputUri(n.uri);if(!c)return;let u=PM(n,r,o,!0);if(u)return t({model:n,position:r,widget:c,range:u,context:s},l)}}))}async addFileAndFolderEntries(e,t,o,n){let r=o.varWord?.word?.charAt(0)===zc?zc:Tu,s=(p,h,g,f)=>{let v=this.labelService.getUriBasenameLabel(p),b=`${r}file:${v}`,S=this.labelService.getUriLabel(p,{relative:!0}),y=g?d(8028,null,S,g):S,w=f?" ":"!";return{label:{label:v,description:y},filterText:`${v} ${r}${v} ${S}`,insertText:o.varWord?.endColumn===o.replace.endColumn?`${b} `:b,range:o,kind:h===0?20:23,sortText:w,command:{id:GM.addReferenceCommand,title:"",arguments:[new Kfe(e,{id:p.toString(),isFile:h===0,isDirectory:h===1,range:{startLineNumber:o.replace.startLineNumber,startColumn:o.replace.startColumn,endLineNumber:o.replace.endLineNumber,endColumn:o.replace.startColumn+b.length},data:p})]}}},l;o.varWord?.word&&(o.varWord.word.startsWith(Tu)||o.varWord.word.startsWith(zc))&&(l=o.varWord.word.toLowerCase().slice(1));let c=new En,u=t.suggestions.length;for(let[p,h]of this.historyService.getHistory().entries()){let g=X5(h)?h.modified.resource:h.resource;if(!g||c.has(g)||!this.instantiationService.invokeFunction(v=>KEe(v,g.scheme)))continue;if(l){let v=this.labelService.getUriLabel(g,{relative:!0}).toLowerCase(),S=`${this.labelService.getUriBasenameLabel(g).toLowerCase()} ${v}`;if(!SCe(l,0,l.length,S,0,S.length))continue}if(c.add(g),t.suggestions.push(s(g,0,p===0?d(8026,null):void 0,p===0))-u>=5)break}if(l){let p=this.updateCacheKey(),h=this.workspaceContextService.getWorkspace().folders.map(g=>g.uri);for(let g of h){let{folders:f,files:v}=await kNi(g,l,!0,n,p.key,this.configurationService,this.searchService);for(let b of v)c.has(b)||(t.suggestions.push(s(b,0)),c.add(b));for(let b of f)c.has(b)||(t.suggestions.push(s(b,1)),c.add(b))}}t.incomplete=!0}addSymbolEntries(e,t,o,n){let s=new Dn,l=o.varWord?.word?.charAt(0)===zc?zc:Tu,c=(g,f)=>{let v=`${l}sym:${g.name}`,b=g.location.uri,S=this.labelService.getUriLabel(b,{relative:!0}),y=f?"{":"|";return{label:{label:g.name,description:S},filterText:`${l}${g.name}`,insertText:o.varWord?.endColumn===o.replace.endColumn?`${v} `:v,range:o,kind:_m.toCompletionKind(g.kind),sortText:y,command:{id:GM.addReferenceCommand,title:"",arguments:[new Kfe(e,{id:`vscode.symbol/${JSON.stringify(g.location)}`,fullName:g.name,range:{startLineNumber:o.replace.startLineNumber,startColumn:o.replace.startColumn,endLineNumber:o.replace.endLineNumber,endColumn:o.replace.startColumn+v.length},data:g.location,icon:_m.toIcon(g.kind)})]}}},u;o.varWord?.word&&(o.varWord.word.startsWith(Tu)||o.varWord.word.startsWith(zc))&&(u=o.varWord.word.toLowerCase().slice(1));let p=[];for(let g of this.outlineService.getCachedModels()){let f=g.asListOfDocumentSymbols();for(let v of f)p.push({symbol:v,uri:g.uri})}let h=!1;for(let g of p){if(s.elapsed()>100||n.isCancellationRequested){h=!0;break}t.suggestions.push(c({...g.symbol,location:{uri:g.uri,range:g.symbol.range}},u??""))}t.incomplete=!!u||h}updateCacheKey(){return this.cacheKey&&Date.now()-this.cacheKey.time>6e4&&(this.searchService.clearCache(this.cacheKey.key),this.cacheKey=void 0),this.cacheKey||(this.cacheKey={key:xt(),time:Date.now()}),this.cacheKey.time=Date.now(),this.cacheKey}cmdAddReference(e){e.widget.getContrib(yS.ID)?.addReference(e.variable)}};GM=I([m(0,na),m(1,Pe),m(2,gg),m(3,rt),m(4,Qt),m(5,Pt),m(6,AC),m(7,ee),m(8,B),m(9,qt),m(10,cr),m(11,F),m(12,Yp),m(13,Us)],GM);ne.as(Qi.Workbench).registerWorkbenchContribution(GM,4);var Gfe=class extends x{constructor(e,t,o){super();this.languageFeaturesService=e;this.chatWidgetService=t;this.chatAgentService=o;this._register(this.languageFeaturesService.completionProvider.register({scheme:Q.vscodeChatInput,hasAccessToAllModels:!0},{_debugDisplayName:"chatVariables",triggerCharacters:[Tu,zc],provideCompletionItems:async(n,r,s,l)=>{let c=this.chatWidgetService.getWidgetByInputUri(n.uri);if(!c)return null;if(c.lockedAgentId){let b=this.chatAgentService.getAgent(c.lockedAgentId);if(b&&!b.capabilities?.supportsToolAttachments)return null}let u=PM(n,r,Gfe.VariableNameDef,!0);if(!u)return null;let p=new Set;for(let b of c.parsedInput.parts)b instanceof dI?p.add(b.toolName):b instanceof VF&&p.add(b.name);let h=u.varWord?.word?.charAt(0)===zc?zc:Tu,g=u.varWord?.word?u.varWord.word.toLowerCase().slice(1):"",f=[],v=c.input.selectedToolsModel.entriesMap.get();for(let[b,S]of v){if(!S)continue;let y,w,k;if(Xm(b))y=b.description,k=b.referenceName;else{let P=b.source;y=d(8034,null,P.label,b.displayName),k=b.toolReferenceName??b.displayName,w=b.userDescription??b.modelDescription}if(p.has(k))continue;if(g){let P=k.toLowerCase();if(!SCe(g,0,g.length,P,0,P.length))continue}let T=`${h}${k}`;f.push({label:T,range:u,detail:y,documentation:w,filterText:`${h}${k}`,insertText:T+" ",kind:27})}return{suggestions:f}}}))}static{this.VariableNameDef=new RegExp(`(?<=^|\\s)[${mQ(Tu)}${mQ(zc)}]\\w*`,"g")}};Gfe=I([m(0,Qt),m(1,Pt),m(2,cr)],Gfe);ne.as(Qi.Workbench).registerWorkbenchContribution(Gfe,4);var BW="chat",_$t="chat-session-detail",Bxo="chat-session-text",_Ni="chat-session-clickable-text",Hxo="chat-variable-text";function DNi(a,i){return i?`${a.id}__${i}`:a.id}function ddn(a){return a instanceof Pv&&!a.text.trim().length||a instanceof dT}function D$t(a,i){let e=a.indexOf(i);if(a.length>e+2)return!1;let t=a[e+1];return t&&t instanceof Pv&&t.text===" "}function L$t(a){return{startLineNumber:a.editorRange.startLineNumber,endLineNumber:a.editorRange.endLineNumber,startColumn:a.editorRange.endColumn+1,endColumn:1e3}}var qfe=class extends x{constructor(e,t,o,n,r,s,l){super();this.widget=e;this.codeEditorService=t;this.themeService=o;this.chatAgentService=n;this.labelService=r;this.promptsService=s;this.editorService=l;this.id="inputEditorDecorations";this.previouslyUsedAgents=new Set;this.viewModelDisposables=this._register(new me);this.updateThrottle=this._register(new ya(qfe.UPDATE_DELAY));this.registeredDecorationTypes(),this.triggerInputEditorDecorationsUpdate(),this._register(this.widget.inputEditor.onDidChangeModelContent(()=>this.triggerInputEditorDecorationsUpdate())),this._register(this.widget.onDidChangeParsedInput(()=>this.triggerInputEditorDecorationsUpdate())),this._register(this.widget.onDidChangeViewModel(()=>{this.registerViewModelListeners(),this.previouslyUsedAgents.clear(),this.triggerInputEditorDecorationsUpdate()})),this._register(this.widget.onDidSubmitAgent(c=>{this.previouslyUsedAgents.add(DNi(c.agent,c.slashCommand?.name))})),this._register(this.widget.inputEditor.onMouseDown(c=>{if(this.mouseDownPromptSlashCommand=void 0,!c.event.leftButton||c.target.type!==6||!c.target.position)return;let u=this.clickablePromptSlashCommand;!u||!u.range.containsPosition(c.target.position)||(this.mouseDownPromptSlashCommand={position:ye.lift(c.target.position),uri:u.uri,range:u.range})})),this._register(this.widget.inputEditor.onMouseUp(c=>{let u=this.mouseDownPromptSlashCommand;this.mouseDownPromptSlashCommand=void 0,!(!u||c.target.type!==6||!c.target.position)&&(!u.range.containsPosition(c.target.position)||!ye.equals(u.position,c.target.position)||this.editorService.openEditor({resource:u.uri}))})),this._register(this.chatAgentService.onDidChangeAgents(()=>this.triggerInputEditorDecorationsUpdate())),this._register(this.promptsService.onDidChangeSlashCommands(()=>this.triggerInputEditorDecorationsUpdate())),this._register(be(c=>{let u=this.widget.input.currentModeObs.read(c);u&&u.description.read(c),this.triggerInputEditorDecorationsUpdate()})),this.registerViewModelListeners()}static{this.UPDATE_DELAY=200}registerViewModelListeners(){this.viewModelDisposables.value=this.widget.viewModel?.onDidChange(e=>{(e?.kind==="changePlaceholder"||e?.kind==="initialize")&&this.triggerInputEditorDecorationsUpdate()})}registeredDecorationTypes(){this._register(this.codeEditorService.registerDecorationType(BW,_$t,{})),this._register(this.codeEditorService.registerDecorationType(BW,Bxo,{color:Yu(bie),backgroundColor:Yu(vie),borderRadius:"3px"})),this._register(this.codeEditorService.registerDecorationType(BW,_Ni,{color:Yu(bie),backgroundColor:Yu(vie),borderRadius:"3px",cursor:"pointer"})),this._register(this.codeEditorService.registerDecorationType(BW,Hxo,{color:Yu(bie),backgroundColor:Yu(vie),borderRadius:"3px"})),this._register(this.codeEditorService.registerDecorationType(BW,ghi,{color:Yu(bie),backgroundColor:Yu(vie),borderRadius:"3px",rangeBehavior:1}))}getPlaceholderColor(){return this.themeService.getColorTheme().getColor(Hye)?.toString()}triggerInputEditorDecorationsUpdate(){this.updateInputPlaceholderDecoration(),this.updateThrottle.trigger(e=>this.updateAsyncInputEditorDecorations(e))}updateInputPlaceholderDecoration(){let e=this.widget.inputEditor.getValue(),t=this.widget.viewModel;if(!t){this.updateAriaPlaceholder(void 0);return}if(!e){let p=this.widget.input.currentModeObs.get(),h=p.argumentHint?.get()??p.description.get()??"",g=t.inputPlaceholder||h,f=[{range:{startLineNumber:1,endLineNumber:1,startColumn:1,endColumn:1e3},renderOptions:{after:{contentText:g,color:this.getPlaceholderColor()}}}];this.updateAriaPlaceholder(g||void 0),this.widget.inputEditor.setDecorationsByType(BW,_$t,f);return}this.updateAriaPlaceholder(void 0);let o=this.widget.parsedInput.parts,n,r=o.find(p=>p instanceof lp),s=o.find(p=>p instanceof Xf);if(r&&o.every(p=>p instanceof Pv&&!p.text.trim().length||p instanceof lp)){let h=this.previouslyUsedAgents.has(DNi(r.agent,void 0))&&r.agent.metadata.followupPlaceholder;r.agent.description&&D$t(o,r)&&(n=[{range:L$t(r),renderOptions:{after:{contentText:h?r.agent.metadata.followupPlaceholder:r.agent.description,color:this.getPlaceholderColor()}}}])}if(r&&s&&o.every(p=>p instanceof Pv&&!p.text.trim().length||p instanceof lp||p instanceof Xf)){let h=this.previouslyUsedAgents.has(DNi(r.agent,s.command.name))&&s.command.followupPlaceholder;s?.command.description&&D$t(o,s)&&(n=[{range:L$t(s),renderOptions:{after:{contentText:h?s.command.followupPlaceholder:s.command.description,color:this.getPlaceholderColor()}}}])}s&&o.every(p=>p instanceof Pv&&!p.text.trim().length||p instanceof Xf)&&s?.command.description&&D$t(o,s)&&(n=[{range:L$t(s),renderOptions:{after:{contentText:s.command.description,color:this.getPlaceholderColor()}}}]),this.widget.inputEditor.setDecorationsByType(BW,_$t,n??[])}async updateAsyncInputEditorDecorations(e){this.clickablePromptSlashCommand=void 0,this.widget.inputEditor.setDecorationsByType(BW,_Ni,[]);let t=this.widget.parsedInput.parts,o=t.find(f=>f instanceof lp),n=t.find(f=>f instanceof Xf),r=t.find(f=>f instanceof UC),s=t.find(f=>f instanceof dT),l=s?await this.promptsService.resolvePromptSlashCommand(s.name,e):void 0;if(e.isCancellationRequested)return;if(s&&l&&s&&t.every(ddn)&&D$t(t,s)&&l){let v=l.argumentHint??l.description;v&&this.widget.inputEditor.setDecorationsByType(BW,_$t,[{range:L$t(s),renderOptions:{after:{contentText:v,color:this.getPlaceholderColor()}}}])}let c=[];if(o&&c.push({range:o.editorRange}),n&&c.push({range:n.editorRange,hoverMessage:new Ie(n.command.description)}),r&&c.push({range:r.editorRange}),s&&l){this.clickablePromptSlashCommand={range:z.lift(s.editorRange),uri:l.promptPath.uri};let f=new Ie;f.appendText(d(8035,null,this.labelService.getUriLabel(l.promptPath.uri,{relative:!0})));let v={range:s.editorRange,hoverMessage:f};this.widget.inputEditor.setDecorationsByType(BW,_Ni,[v])}this.widget.inputEditor.setDecorationsByType(BW,Bxo,c);let u=[],p=t.filter(f=>f instanceof dI||f instanceof VF);for(let f of p)u.push({range:f.editorRange});let h=t.filter(f=>f instanceof HR);if(!!this.widget.viewModel?.editing)for(let f of h)u.push({range:f.editorRange,hoverMessage:A.isUri(f.data)?new Ie(this.labelService.getUriLabel(f.data,{relative:!0})):void 0});this.widget.inputEditor.setDecorationsByType(BW,Hxo,u)}updateAriaPlaceholder(e){let t=Rle.get(this.widget.inputEditor.getId());if(t){let o=t.domNode.domNode;e&&e.trim().length?o.setAttribute("aria-placeholder",e):o.removeAttribute("aria-placeholder")}else{let o=QSt.get(this.widget.inputEditor.getId());if(o){let n=o.textArea.domNode;e&&e.trim().length?n.setAttribute("aria-placeholder",e):n.removeAttribute("aria-placeholder")}}}};qfe=I([m(1,qt),m(2,Le),m(3,cr),m(4,rt),m(5,Or),m(6,ee)],qfe);var LNi=class extends x{constructor(e){super();this.widget=e;this.id="InputEditorSlashCommandMode";this._register(this.widget.onDidChangeAgent(t=>{(t.slashCommand&&t.slashCommand.isSticky||!t.slashCommand&&t.agent.metadata.isSticky)&&this.repopulateAgentCommand(t.agent,t.slashCommand)})),this._register(this.widget.onDidSubmitAgent(t=>{this.repopulateAgentCommand(t.agent,t.slashCommand)}))}async repopulateAgentCommand(e,t){if(this.widget.inputEditor.getValue().trim())return;let o;t&&t.isSticky?o=`${zc}${e.name} ${Bu}${t.name} `:e.metadata.isSticky&&(o=`${zc}${e.name} `),o&&(this.widget.inputEditor.setValue(o),this.widget.inputEditor.setPosition({lineNumber:1,column:o.length+1}))}};kI.CONTRIBS.push(qfe,LNi);var Wst=class extends x{constructor(e,t){super();this.widget=e;this.instantiationService=t;this.id="chatTokenDeleter";let o=this.instantiationService.createInstance(uT),n=this.widget.inputEditor.getValue(),r,s;this._register(this.widget.inputEditor.onDidChangeModelContent(l=>{r||(r=n,s=this.widget.lastSelectedAgent);let c=l.changes[0];if(!c.text&&this.widget.viewModel){let u=s?.capabilities??this.widget.attachmentCapabilities;o.parseChatRequestWithReferences(HF(this.widget),MK(this.widget),r,this.widget.location,{selectedAgent:s,mode:this.widget.input.currentModeKind,attachmentCapabilities:u}).parts.filter(g=>g instanceof lp||g instanceof Xf||g instanceof UC||g instanceof dT||g instanceof dI).forEach(g=>{let f=z.intersectRanges(g.editorRange,c.range);if(f&&z.compareRangesUsingStarts(g.editorRange,c.range)<0){if(r&&z.isEmpty(f)&&r.substring(c.rangeOffset,c.rangeOffset+c.rangeLength)!==" ")return;let v=f.endColumn-f.startColumn,b=new z(g.editorRange.startLineNumber,g.editorRange.startColumn,g.editorRange.endLineNumber,g.editorRange.endColumn-v);this.widget.inputEditor.executeEdits(this.id,[{range:b,text:""}]),this.widget.refreshParsedInput()}})}r=this.widget.inputEditor.getValue(),s=this.widget.lastSelectedAgent}))}};Wst=I([m(1,F)],Wst);kI.CONTRIBS.push(Wst);var Uxo=_,zxo=ct,AVe=class{constructor(i,e,t){this.keybindingService=t;let o=zxo(".chat-editor-hover-wrapper@root",[zxo(".chat-editor-hover-wrapper-content@content")]);if(this.domNode=o.root,o.content.appendChild(i),e&&e.length>0){let n=Uxo(".hover-row.status-bar"),r=Uxo(".actions");e.forEach(s=>{let l=this.keybindingService.lookupKeybinding(s.commandId),c=l?l.getLabel():null;SY.render(r,{label:s.label,commandId:s.commandId,run:u=>{s.run(u)},iconClass:s.iconClass},c)}),n.appendChild(r),this.domNode.appendChild(n)}}};AVe=I([m(2,_e)],AVe);var Vst=class{constructor(i,e,t,o){this.editor=i;this.instantiationService=e;this.chatWidgetService=t;this.commandService=o;this.hoverOrdinal=1}computeSync(i,e){if(!this.editor.hasModel())return[];let t=this.chatWidgetService.getWidgetByInputUri(this.editor.getModel().uri);if(!t)return[];let{agentPart:o}=$eo(t.parsedInput);return o?z.containsPosition(o.editorRange,i.range.getStartPosition())?[new RNi(this,z.lift(o.editorRange),o.agent)]:[]:[]}renderHoverParts(i,e){if(!e.length)return new ok([]);let t=new N,o=t.add(this.instantiationService.createInstance(AG));t.add(o.onDidChangeContents(()=>i.onContentsChanged()));let n=e[0],r=n.agent;o.setAgent(r.id);let s=GNe(()=>r,this.commandService).actions,c=this.instantiationService.createInstance(AVe,o.domNode,s).domNode;i.fragment.appendChild(c);let u={hoverPart:n,hoverElement:c,dispose(){t.dispose()}};return new ok([u])}getAccessibleContent(i){return d(8036,null)}};Vst=I([m(1,F),m(2,Pt),m(3,ge)],Vst);var RNi=class{constructor(i,e,t){this.owner=i;this.range=e;this.agent=t}isValidForHoverAnchor(i){return i.type===1&&this.range.startColumn<=i.range.startColumn&&this.range.endColumn>=i.range.endColumn}};z_.register(Vst);var R$t=d(7600,null),M$t=d(7598,null),$fe=class extends x{constructor(e,t){super();this._storageKey=e;this._instantiationService=t;this._memoryStore=new Map;this._workspaceStore=new co(()=>this._register(this._instantiationService.createInstance(NVe,1,this._storageKey))),this._profileStore=new co(()=>this._register(this._instantiationService.createInstance(NVe,0,this._storageKey)))}setAutoConfirmation(e,t,o){this._workspaceStore.value.setAutoConfirm(e,void 0),this._profileStore.value.setAutoConfirm(e,void 0),this._memoryStore.delete(e);let n={confirmed:!0,label:o};t==="workspace"?this._workspaceStore.value.setAutoConfirm(e,n):t==="profile"?this._profileStore.value.setAutoConfirm(e,n):t==="session"&&this._memoryStore.set(e,n)}getAutoConfirmation(e){return this._workspaceStore.value.getAutoConfirm(e)?"workspace":this._profileStore.value.getAutoConfirm(e)?"profile":this._memoryStore.has(e)?"session":"never"}getAutoConfirmationIn(e,t){return t==="workspace"?!!this._workspaceStore.value.getAutoConfirm(e):t==="profile"?!!this._profileStore.value.getAutoConfirm(e):this._memoryStore.has(e)}getLabel(e){return this._workspaceStore.value.getAutoConfirm(e)?.label??this._profileStore.value.getAutoConfirm(e)?.label??this._memoryStore.get(e)?.label}reset(){this._workspaceStore.value.reset(),this._profileStore.value.reset(),this._memoryStore.clear()}checkAutoConfirmation(e){if(this._workspaceStore.value.getAutoConfirm(e))return{type:3,scope:"workspace"};if(this._profileStore.value.getAutoConfirm(e))return{type:3,scope:"profile"};if(this._memoryStore.has(e))return{type:3,scope:"session"}}getAllConfirmed(){let e=new Set;for(let t of this._workspaceStore.value.getAll())e.add(t);for(let t of this._profileStore.value.getAll())e.add(t);for(let t of this._memoryStore.keys())e.add(t);return e}},NVe=class extends x{constructor(e,t,o){super();this._scope=e;this._storageKey=t;this.storageService=o;this._autoConfirmTools=new dl(100);this._didChange=!1;let n=o.get(this._storageKey,this._scope);if(n)try{let r=JSON.parse(n);if(Array.isArray(r))for(let s of r)this._autoConfirmTools.set(s,{confirmed:!0});else if(typeof r=="object"&&r!==null)for(let[s,l]of Object.entries(r))this._autoConfirmTools.set(s,{confirmed:!0,label:typeof l=="string"?l:void 0})}catch{}this._register(o.onWillSaveState(()=>{if(this._didChange){let r={};for(let[s,l]of this._autoConfirmTools)r[s]=l.label??!0;this.storageService.store(this._storageKey,JSON.stringify(r),this._scope,1),this._didChange=!1}}))}reset(){this._autoConfirmTools.clear(),this._didChange=!0}getAutoConfirm(e){let t=this._autoConfirmTools.get(e);if(t)return this._didChange=!0,t}setAutoConfirm(e,t){t?this._autoConfirmTools.set(e,t):this._autoConfirmTools.delete(e),this._didChange=!0}getAll(){return[...this._autoConfirmTools.keys()]}};NVe=I([m(2,ce)],NVe);var OVe=class extends x{constructor(e,t){super();this._instantiationService=e;this._quickInputService=t;this._contributions=new Map;this._preExecutionToolConfirmStore=this._register(new $fe("chat/autoconfirm",this._instantiationService)),this._postExecutionToolConfirmStore=this._register(new $fe("chat/autoconfirm-post",this._instantiationService)),this._preExecutionServerConfirmStore=this._register(new $fe("chat/servers/autoconfirm",this._instantiationService)),this._postExecutionServerConfirmStore=this._register(new $fe("chat/servers/autoconfirm-post",this._instantiationService)),this._combinationConfirmStore=this._register(new $fe("chat/autoconfirm-combination",this._instantiationService))}getPreConfirmAction(e){let t=this._contributions.get(e.toolId);if(t?.getPreConfirmAction){let n=t.getPreConfirmAction(e);if(n)return n}if(t&&t.canUseDefaultApprovals===!1)return;if(e.combination){let n=this._combinationConfirmStore.checkAutoConfirmation(e.combination.key);if(n)return n}let o=this._preExecutionToolConfirmStore.checkAutoConfirmation(e.toolId);if(o)return o;if(e.source.type==="mcp"){let n=this._preExecutionServerConfirmStore.checkAutoConfirmation(e.source.definitionId);if(n)return n}}getPostConfirmAction(e){let t=this._contributions.get(e.toolId);if(t?.getPostConfirmAction){let n=t.getPostConfirmAction(e);if(n)return n}if(t&&t.canUseDefaultApprovals===!1)return;let o=this._postExecutionToolConfirmStore.checkAutoConfirmation(e.toolId);if(o)return o;if(e.source.type==="mcp"){let n=this._postExecutionServerConfirmStore.checkAutoConfirmation(e.source.definitionId);if(n)return n}}getPreConfirmActions(e){let t=[],o=this._contributions.get(e.toolId);if(o?.getPreConfirmActions&&t.push(...o.getPreConfirmActions(e)),o&&o.canUseDefaultApprovals===!1)return t;if(e.combination){let{label:n,key:r}=e.combination;t.push({label:d(7566,null,n),detail:d(7567,null),divider:!!t.length,scope:"session",select:async()=>(this._combinationConfirmStore.setAutoConfirmation(r,"session",n),!0)},{label:d(7568,null,n),detail:d(7569,null),scope:"workspace",select:async()=>(this._combinationConfirmStore.setAutoConfirmation(r,"workspace",n),!0)},{label:d(7564,null,n),detail:d(7565,null),scope:"profile",select:async()=>(this._combinationConfirmStore.setAutoConfirmation(r,"profile",n),!0)})}if(t.push({label:d(7586,null),detail:d(7589,null),divider:!!t.length,scope:"session",select:async()=>(this._preExecutionToolConfirmStore.setAutoConfirmation(e.toolId,"session"),!0)},{label:d(7590,null),detail:d(7593,null),scope:"workspace",select:async()=>(this._preExecutionToolConfirmStore.setAutoConfirmation(e.toolId,"workspace"),!0)},{label:d(7570,null),detail:d(7573,null),scope:"profile",select:async()=>(this._preExecutionToolConfirmStore.setAutoConfirmation(e.toolId,"profile"),!0)}),e.source.type==="mcp"){let{serverLabel:n,definitionId:r}=e.source;t.push({label:d(7578,null,n),detail:d(7581,null),divider:!0,scope:"session",select:async()=>(this._preExecutionServerConfirmStore.setAutoConfirmation(r,"session"),!0)},{label:d(7582,null,n),detail:d(7585,null),scope:"workspace",select:async()=>(this._preExecutionServerConfirmStore.setAutoConfirmation(r,"workspace"),!0)},{label:d(7574,null,n),detail:d(7577,null),scope:"profile",select:async()=>(this._preExecutionServerConfirmStore.setAutoConfirmation(r,"profile"),!0)})}return t}getPostConfirmActions(e){let t=[],o=this._contributions.get(e.toolId);if(o?.getPostConfirmActions&&t.push(...o.getPostConfirmActions(e)),o&&o.canUseDefaultApprovals===!1)return t;if(t.push({label:d(7587,null),detail:d(7588,null),divider:!!t.length,scope:"session",select:async()=>(this._postExecutionToolConfirmStore.setAutoConfirmation(e.toolId,"session"),!0)},{label:d(7591,null),detail:d(7592,null),scope:"workspace",select:async()=>(this._postExecutionToolConfirmStore.setAutoConfirmation(e.toolId,"workspace"),!0)},{label:d(7571,null),detail:d(7572,null),scope:"profile",select:async()=>(this._postExecutionToolConfirmStore.setAutoConfirmation(e.toolId,"profile"),!0)}),e.source.type==="mcp"){let{serverLabel:n,definitionId:r}=e.source;t.push({label:d(7579,null,n),detail:d(7580,null),divider:!0,scope:"session",select:async()=>(this._postExecutionServerConfirmStore.setAutoConfirmation(r,"session"),!0)},{label:d(7583,null,n),detail:d(7584,null),scope:"workspace",select:async()=>(this._postExecutionServerConfirmStore.setAutoConfirmation(r,"workspace"),!0)},{label:d(7575,null,n),detail:d(7576,null),scope:"profile",select:async()=>(this._postExecutionServerConfirmStore.setAutoConfirmation(r,"profile"),!0)})}return t}registerConfirmationContribution(e,t){return this._contributions.set(e,t),{dispose:()=>{this._contributions.delete(e)}}}toolCanManageConfirmation(e){return!!e.canRequestPreApproval||!!e.canRequestPostApproval||this._contributions.has(e.id)||!!this._preExecutionToolConfirmStore.checkAutoConfirmation(e.id)||!!this._postExecutionToolConfirmStore.checkAutoConfirmation(e.id)||this._hasCombinationApprovalsForTool(e.id)}_hasCombinationApprovalsForTool(e){let t=e+":combination:";for(let o of this._combinationConfirmStore.getAllConfirmed())if(o.startsWith(t))return!0;return!1}_getCombinationApprovalsForTool(e,t){let o=e+":combination:",n=[];for(let r of this._combinationConfirmStore.getAllConfirmed())if(r.startsWith(o)&&this._combinationConfirmStore.getAutoConfirmationIn(r,t)){let s=this._combinationConfirmStore.getLabel(r)??r;n.push({key:r,label:s})}return n}manageConfirmationPreferences(e,t){let o=(g,f,v,b)=>{b.has(g)||b.set(g,{label:f,tools:new Set}),b.get(g).tools.add(v)},n=(g,f,v)=>{g.type==="mcp"?o(g.definitionId,g.serverLabel||g.label,f,v):g.type==="extension"&&o(g.extensionId.value,g.label,f,v)},r=new Set,s=new Map;for(let g of e)(g.canRequestPreApproval||g.canRequestPostApproval||this._contributions.has(g.id))&&(r.add(g.id),n(g.source,g.id,s));for(let g of this._preExecutionToolConfirmStore.getAllConfirmed())if(!r.has(g)){let f=e.find(v=>v.id===g);f&&(r.add(g),n(f.source,g,s))}for(let g of this._postExecutionToolConfirmStore.getAllConfirmed())if(!r.has(g)){let f=e.find(v=>v.id===g);f&&(r.add(g),n(f.source,g,s))}for(let g of e)!r.has(g.id)&&this._hasCombinationApprovalsForTool(g.id)&&(r.add(g.id),n(g.source,g.id,s));if(r.size===0)return;let l=t?.defaultScope??"workspace",c=()=>{let g=[];for(let[v,b]of s){let S=[],y=Array.from(b.tools).some(G=>e.find(J=>J.id===G)?.canRequestPreApproval),w=Array.from(b.tools).some(G=>e.find(J=>J.id===G)?.canRequestPostApproval),k=this._preExecutionServerConfirmStore.getAutoConfirmationIn(v,l),T=this._postExecutionServerConfirmStore.getAutoConfirmationIn(v,l);for(let G of b.tools){let $=e.find(De=>De.id===G);if(!$)continue;let J=[],ae=!k&&($.canRequestPreApproval||this._preExecutionToolConfirmStore.getAutoConfirmationIn($.id,l)),he=!T&&($.canRequestPostApproval||this._postExecutionToolConfirmStore.getAutoConfirmationIn($.id,l));ae&&he&&(J.push({type:"tool-pre",toolId:$.id,label:R$t,checked:this._preExecutionToolConfirmStore.getAutoConfirmationIn($.id,l)}),J.push({type:"tool-post",toolId:$.id,label:M$t,checked:this._postExecutionToolConfirmStore.getAutoConfirmationIn($.id,l)}));let oe=this._getCombinationApprovalsForTool($.id,l);for(let{key:De,label:Oe}of oe)J.push({type:"combination",toolId:$.id,combinationKey:De,label:Oe,checked:!0});let de=this._preExecutionToolConfirmStore.getAutoConfirmationIn($.id,l),Ce=this._postExecutionToolConfirmStore.getAutoConfirmationIn($.id,l),xe,ze;if(ae&&he)xe=de&&Ce?!0:!de&&!Ce?!1:"mixed";else if(ae)xe=de,ze=R$t;else if(he)xe=Ce,ze=M$t;else if(J.length>0)xe=!1;else continue;S.push({type:"tool",toolId:$.id,label:$.displayName||$.id,description:ze,checked:xe,collapsed:!0,children:J.length>0?J:void 0})}S.sort((G,$)=>G.label.localeCompare($.label)),w&&S.unshift({type:"server-post",serverId:v,iconClass:q.asClassName(R.play),label:d(7597,null),checked:T}),y&&S.unshift({type:"server-pre",serverId:v,iconClass:q.asClassName(R.play),label:d(7599,null),checked:k});let P=this._preExecutionServerConfirmStore.getAutoConfirmationIn(v,l),O=this._postExecutionServerConfirmStore.getAutoConfirmationIn(v,l),V;y&&w?V=P&&O?!0:!P&&!O?!1:"mixed":y?V=P:w?V=O:V=!1;let H=p.itemTree.find(G=>G.serverId===v);g.push({type:"server",serverId:v,label:b.label,checked:V,children:S,collapsed:H?p.isCollapsed(H):!0,pickable:!1})}let f=e.slice().sort((v,b)=>v.displayName.localeCompare(b.displayName));for(let v of f){if(!r.has(v.id)||v.source.type==="mcp"||v.source.type==="extension")continue;let b=this._contributions.get(v.id),S=[],y=b?.getManageActions?.();y&&S.push(...y.map(P=>({type:"manage",...P})));let w=!1,k,T=!1;if(b?.canUseDefaultApprovals!==!1){T=!0;let P=v.canRequestPreApproval||this._preExecutionToolConfirmStore.getAutoConfirmationIn(v.id,l),O=v.canRequestPostApproval||this._postExecutionToolConfirmStore.getAutoConfirmationIn(v.id,l);P&&O&&(S.push({type:"tool-pre",toolId:v.id,label:R$t,checked:this._preExecutionToolConfirmStore.getAutoConfirmationIn(v.id,l)}),S.push({type:"tool-post",toolId:v.id,label:M$t,checked:this._postExecutionToolConfirmStore.getAutoConfirmationIn(v.id,l)}));let V=this._getCombinationApprovalsForTool(v.id,l);for(let{key:$,label:J}of V)S.push({type:"combination",toolId:v.id,combinationKey:$,label:J,checked:!0});let H=this._preExecutionToolConfirmStore.getAutoConfirmationIn(v.id,l),G=this._postExecutionToolConfirmStore.getAutoConfirmationIn(v.id,l);P&&O?w=H&&G?!0:!H&&!G?!1:"mixed":P?(w=H,k=R$t):O?(w=G,k=M$t):w=!1}g.push({type:"tool",toolId:v.id,label:v.displayName||v.id,description:k,checked:w,pickable:T,collapsed:e.length>1,children:S.length>0?S:void 0})}return g},u=new N,p=u.add(this._quickInputService.createQuickTree());if(p.ignoreFocusOut=!0,p.sortByLabel=!1,l!=="session"){let g={iconClass:q.asClassName(R.folder),tooltip:d(7601,null),toggle:{checked:l==="workspace"},location:3};p.buttons=[g],u.add(p.onDidTriggerButton(f=>{f===g&&(l=l==="workspace"?"profile":"workspace",h(),p.setItemTree(c()))}))}let h=()=>{l==="session"?p.placeholder=d(7595,null):p.placeholder=l==="workspace"?d(7596,null):d(7594,null)};if(h(),p.setItemTree(c()),u.add(p.onDidChangeCheckboxState(g=>{let f=g.checked?l:"never";if(g.type==="server"&&g.serverId)s.get(g.serverId)&&(this._preExecutionServerConfirmStore.setAutoConfirmation(g.serverId,f),this._postExecutionServerConfirmStore.setAutoConfirmation(g.serverId,f));else if(g.type==="tool"&&g.toolId){let v=e.find(b=>b.id===g.toolId);if((v?.canRequestPostApproval||f==="never")&&this._postExecutionToolConfirmStore.setAutoConfirmation(g.toolId,f),(v?.canRequestPreApproval||f==="never")&&this._preExecutionToolConfirmStore.setAutoConfirmation(g.toolId,f),f==="never")for(let b of this._combinationConfirmStore.getAllConfirmed())b.startsWith(g.toolId+":combination:")&&this._combinationConfirmStore.setAutoConfirmation(b,"never");p.setItemTree(c())}else g.type==="tool-pre"&&g.toolId?this._preExecutionToolConfirmStore.setAutoConfirmation(g.toolId,f):g.type==="tool-post"&&g.toolId?this._postExecutionToolConfirmStore.setAutoConfirmation(g.toolId,f):g.type==="server-pre"&&g.serverId?(this._preExecutionServerConfirmStore.setAutoConfirmation(g.serverId,f),p.setItemTree(c())):g.type==="server-post"&&g.serverId?(this._postExecutionServerConfirmStore.setAutoConfirmation(g.serverId,f),p.setItemTree(c())):g.type==="manage"?g.onDidChangeChecked?.(!!g.checked):g.type==="combination"&&g.combinationKey&&(this._combinationConfirmStore.setAutoConfirmation(g.combinationKey,f),p.setItemTree(c()))})),u.add(p.onDidTriggerItemButton(g=>{g.item.type==="manage"&&g.item.onDidTriggerItemButton?.(g.button)})),u.add(p.onDidAccept(async()=>{let g=p.activeItems.find(f=>f.type==="manage");g?(p.hide(),await g.onDidOpen?.(),this.manageConfirmationPreferences(e,t)):p.hide()})),u.add(p.onDidHide(()=>{u.dispose()})),p.show(),t?.focusToolId){let g=t.focusToolId;for(let f of p.itemTree){let v=f;if(v.children){let b=v.children.find(S=>S.type==="tool"&&S.toolId===g);if(b){p.expand(f),p.reveal(b);break}}}}}resetToolAutoConfirmation(){this._preExecutionToolConfirmStore.reset(),this._postExecutionToolConfirmStore.reset(),this._preExecutionServerConfirmStore.reset(),this._postExecutionServerConfirmStore.reset(),this._combinationConfirmStore.reset();for(let e of this._contributions.values())e.reset?.()}};OVe=I([m(0,F),m(1,Ue)],OVe);var Kxo=ne.as(ma.JSONContribution);var udn="vscode.chat.tools.global.autoApprove.testMode",Bst=new Set(["vscode_get_confirmation_with_options","vscode_get_modified_files_confirmation"]),MNi=L(7605,`Global auto approve also known as "YOLO mode" disables manual approval completely for _all tools in all workspaces_, allowing the agent to act fully autonomously. This is extremely dangerous and is *never* recommended, even containerized environments like [Codespaces](https://github.com/features/codespaces) and [Dev Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) have user keys forwarded into the container that could be compromised.

**This feature disables [critical security protections](https://code.visualstudio.com/docs/copilot/security) and makes it much easier for an attacker to compromise the machine.**

Note: This setting only controls tool approval and does not prevent the agent from asking questions. To automatically answer agent questions, use the [\`chat.autoReply\`](command:workbench.action.openSettings?%5B%22chat.autoReply%22%5D) setting.`),LN=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super();this._instantiationService=e;this._extensionService=t;this._contextKeyService=o;this._chatService=n;this._dialogService=r;this._telemetryService=s;this._logService=l;this._configurationService=c;this._accessibilityService=u;this._accessibilitySignalService=p;this._storageService=h;this._confirmationService=g;this._commandService=f;this._chatWidgetService=v;this._onDidChangeTools=this._register(new E);this.onDidChangeTools=this._onDidChangeTools.event;this._onDidPrepareToolCallBecomeUnresponsive=this._register(new E);this.onDidPrepareToolCallBecomeUnresponsive=this._onDidPrepareToolCallBecomeUnresponsive.event;this._onDidInvokeTool=this._register(new E);this.onDidInvokeTool=this._onDidInvokeTool.event;this._onDidChangeToolsScheduler=this._register(new Dt(()=>this._onDidChangeTools.fire(),750));this._tools=new Map;this._toolContextKeys=new Set;this._callsByRequestId=new Map;this._pendingToolCalls=new Map;this._toolSets=new $9;this.toolSets=ke(this,e=>Array.from(this._toolSets.observable.read(e)).filter(o=>this.isPermitted(o,e)));this.allToolsIncludingDisableObs=Vf({equalsFn:iO()},this.onDidChangeTools,()=>Array.from(this.getAllToolsIncludingDisabled()));this.toolsWithFullReferenceName=ke(e=>{let t=[],o=new Set;for(let n of this.toolSets.read(e))if(n.source.type!=="user"){t.push([n,Gxo(n)]);for(let r of n.getTools())t.push([r,ene(r,n)]),o.add(r)}for(let n of this.allToolsIncludingDisableObs.read(e))n.when&&!this._contextKeyService.contextMatchesRules(n.when)||n.canBeReferencedInPrompt&&!o.has(n)&&this.isPermitted(n,e)&&t.push([n,ene(n)]);return t});this._isAgentModeEnabled=hr("chat.agent.enabled",!0,this._configurationService),this._register(this._contextKeyService.onDidChangeContext(b=>{b.affectsSome(this._toolContextKeys)&&this._onDidChangeToolsScheduler.schedule()})),this._register(this._configurationService.onDidChangeConfiguration(b=>{(b.affectsConfiguration("chat.extensionTools.enabled")||b.affectsConfiguration("chat.agent.enabled"))&&this._onDidChangeToolsScheduler.schedule()})),this._register(U.runAndSubscribe(this._configurationService.onDidChangeConfiguration,b=>{(!b||b.affectsConfiguration("chat.tools.global.autoApprove"))&&this._configurationService.getValue("chat.tools.global.autoApprove")!==!0&&this._storageService.remove("chat.tools.global.autoApprove.optIn",-1)})),this._ctxToolsCount=ie.Tools.toolsCount.bindTo(o),this.vscodeToolSet=this._register(this.createToolSet(kn.Internal,"vscode",u4.vscode,{icon:q.fromId(R.vscode.id),description:d(7609,null)})),this.executeToolSet=this._register(this.createToolSet(kn.Internal,"execute",pm.execute,{icon:q.fromId(R.terminal.id),description:d(7607,null)})),this.readToolSet=this._register(this.createToolSet(kn.Internal,"read",pm.read,{icon:q.fromId(R.book.id),description:d(7608,null)})),this.agentToolSet=this._register(this.createToolSet(kn.Internal,"agent",pm.agent,{icon:q.fromId(R.agent.id),description:d(7606,null)}))}isPermitted(e,t){if(this._isAgentModeEnabled.read(t)!==!1||!Xm(e)&&e.canBeReferencedInPrompt===!1&&e.source.type==="internal")return!0;let n=[pm.read,pm.search,pm.web];if(Xm(e)){let r=e.source.type==="internal"&&n.includes(e.referenceName);return this._logService.trace(`LanguageModelToolsService#isPermitted: ToolSet ${e.id} (${e.referenceName}) permitted=${r}`),r}for(let r of this._toolSets)if(r.source.type==="internal"&&n.includes(r.referenceName)){for(let s of r.getTools())if(s.id===e.id)return this._logService.trace(`LanguageModelToolsService#isPermitted: Tool ${e.id} (${e.toolReferenceName}) permitted=true (member of ${r.referenceName})`),!0}return e.id==="vscode_fetchWebPage_internal"&&n.includes(pm.web)?(this._logService.trace(`LanguageModelToolsService#isPermitted: Tool ${e.id} (${e.toolReferenceName}) permitted=true (special case)`),!0):(this._logService.trace(`LanguageModelToolsService#isPermitted: Tool ${e.id} (${e.toolReferenceName}) permitted=false`),!1)}dispose(){super.dispose(),this._callsByRequestId.forEach(e=>e.forEach(t=>t.store.dispose())),this._pendingToolCalls.clear(),this._ctxToolsCount.reset()}registerToolData(e){if(this._tools.has(e.id))throw new Error(`Tool "${e.id}" is already registered.`);this._tools.set(e.id,{data:e}),this._ctxToolsCount.set(this._tools.size),this._onDidChangeToolsScheduler.isScheduled()||this._onDidChangeToolsScheduler.schedule(),e.when?.keys().forEach(o=>this._toolContextKeys.add(o));let t;if(e.inputSchema){t=new N;let o=K6e(e.id).toString();Kxo.registerSchema(o,e.inputSchema,t),t.add(Kxo.registerSchemaAssociation(o,`/lm/tool/${e.id}/tool_input.json`))}return Z(()=>{t?.dispose(),this._tools.delete(e.id),this._ctxToolsCount.set(this._tools.size),this._refreshAllToolContextKeys(),this._onDidChangeToolsScheduler.isScheduled()||this._onDidChangeToolsScheduler.schedule()})}flushToolUpdates(){this._onDidChangeToolsScheduler.flush()}_refreshAllToolContextKeys(){this._toolContextKeys.clear();for(let e of this._tools.values())e.data.when?.keys().forEach(t=>this._toolContextKeys.add(t))}registerToolImplementation(e,t){let o=this._tools.get(e);if(!o)throw new Error(`Tool "${e}" was not contributed.`);if(o.impl)throw new Error(`Tool "${e}" already has an implementation.`);return o.impl=t,Z(()=>{o.impl=void 0})}registerTool(e,t){return wn(this.registerToolData(e),this.registerToolImplementation(e.id,t))}getTools(e){let t=vt.map(this._tools.values(),n=>n.data),o=this._configurationService.getValue("chat.extensionTools.enabled");return vt.filter(t,n=>{let r=!n.when||this._contextKeyService.contextMatchesRules(n.when),s=n.source.type!=="extension"||!!o,l=this.isPermitted(n),c=bLt(n,e);return r&&s&&l&&c})}observeTools(e){let t=ke(o=>{let n=wc("observeToolsContext"),r=()=>Gi(s=>n.trigger(s));return o.store.add(this.onDidChangeTools(r)),n});return Os({equalsFn:iO()},o=>(t.read(o).read(o),Array.from(this.getTools(e))))}getAllToolsIncludingDisabled(){let e=vt.map(this._tools.values(),o=>o.data),t=this._configurationService.getValue("chat.extensionTools.enabled");return vt.filter(e,o=>{let n=o.source.type!=="extension"||!!t,r=this.isPermitted(o);return n&&r})}getTool(e){return this._tools.get(e)?.data}getToolByName(e){for(let t of this.getAllToolsIncludingDisabled())if(t.toolReferenceName===e)return t}_handlePreToolUseDenial(e,t,o,n,r){let s=t.permissionDecisionReason??d(7615,null),l=d(7613,null,"PreToolUse",s);if(this._logService.debug(`[LanguageModelToolsService#invokeTool] Tool ${e.toolId} denied by preToolUse hook: ${s}`),o){if(n)n.presentation="hidden",n.cancelFromStreaming(0,l);else if(r){let c=MA.createCancelled({toolCallId:e.callId,toolId:e.toolId,toolData:o,subagentInvocationId:e.subAgentInvocationId,chatRequestId:e.chatRequestId},e.parameters,0,l);c.presentation="hidden",this._chatService.appendProgress(r,c)}}return{content:[{kind:"text",value:`Tool execution denied: ${s}`}],toolResultError:s}}async _validateUpdatedInput(e,t,o){if(t?.inputSchema)try{let n=K6e(e),r=JSON.stringify(o),s=await this._commandService.executeCommand("json.validate",n,r)||[];if(s.length>0)return s.map(l=>l.message).join("; ")}catch(n){this._logService.debug(`[LanguageModelToolsService#_validateUpdatedInput] json.validate command failed, skipping validation: ${xn(n)}`)}}async invokeTool(e,t,o){this._logService.trace(`[LanguageModelToolsService#invokeTool] Invoking tool ${e.toolId} with parameters ${JSON.stringify(e.parameters)}`);let n=this._tools.get(e.toolId)?.data,r,s;if(e.context?.sessionResource&&(r=this._chatService.getSession(e.context.sessionResource),s=r?.getRequests().at(-1),s?.response?.isCanceled||s?.response?.isComplete))throw this._logService.debug(`[LanguageModelToolsService#invokeTool] Ignoring tool ${e.toolId} for cancelled/complete request ${s.id}`),new go;let l,c;this._pendingToolCalls.has(e.callId)?(l=e.callId,c=this._pendingToolCalls.get(e.callId)):e.chatStreamToolCallId&&this._pendingToolCalls.has(e.chatStreamToolCallId)&&(l=e.chatStreamToolCallId,c=this._pendingToolCalls.get(e.chatStreamToolCallId));let u,p;if(e.context&&s){u=s.id,p=new N,this._callsByRequestId.has(u)||this._callsByRequestId.set(u,[]);let w={store:p};this._callsByRequestId.get(u).push(w);let k=new Ye;p.add(Z(()=>{k.dispose(!0)})),p.add(o.onCancellationRequested((()=>{Pi.confirmWith(c,{type:0}),k.cancel()}))),p.add(k.token.onCancellationRequested(()=>{Pi.confirmWith(c,{type:0})})),o=k.token}let h=e.preToolUseResult;if(h?.permissionDecision==="deny"){let w=this._handlePreToolUseDenial(e,h,n,c,s);return l&&this._pendingToolCalls.delete(l),w}if(h?.updatedInput){let w=await this._validateUpdatedInput(e.toolId,n,h.updatedInput);w?this._logService.warn(`[LanguageModelToolsService#invokeTool] Tool ${e.toolId} updatedInput from preToolUse hook failed schema validation: ${w}`):(this._logService.debug(`[LanguageModelToolsService#invokeTool] Tool ${e.toolId} input modified by preToolUse hook`),e.parameters=h.updatedInput)}this._onDidInvokeTool.fire({toolId:e.toolId,sessionResource:e.context?.sessionResource,requestId:e.chatRequestId,subagentInvocationId:e.subAgentInvocationId});let g=this._tools.get(e.toolId);if(!g)throw new Error(`Tool ${e.toolId} was not contributed`);if(!g.impl&&(await this._extensionService.activateByEvent(`onLanguageModelTool:${e.toolId}`),g=this._tools.get(e.toolId),!g?.impl))throw new Error(`Tool ${e.toolId} does not have an implementation registered.`);let f=!!c;f&&l&&this._pendingToolCalls.delete(l);let v,b,S,y;try{if(e.context){if(!r)throw new Error("Tool called for unknown chat session");if(!s)throw new Error("Tool called for unknown chat request");e.modelId=s.modelId,e.userSelectedTools=s.userSelectedTools&&{...s.userSelectedTools},b=Dn.create(!0),y=await this.prepareToolInvocationWithHookResult(g,e,h,o),b.stop();let{autoConfirmed:k,preparedInvocation:T}=await this.resolveAutoConfirmFromHook(h,g,e,y,e.context?.sessionResource);if(y=T,f&&c?c.transitionFromStreaming(y,e.parameters,k):(c=new MA(y,g.data,e.chatStreamToolCallId??e.callId,e.subAgentInvocationId,e.parameters),k&&Pi.confirmWith(c,k),this._chatService.appendProgress(s,c)),e.toolSpecificData=c?.toolSpecificData,y?.confirmationMessages?.title){!Pi.executionConfirmedOrDenied(c)&&!k&&this.playAccessibilitySignal([c],e.context?.sessionResource);let P=await Pi.awaitConfirmation(c,o);if(P.type===0)throw new go;if(P.type===5)return v={content:[{kind:"text",value:"The user chose to skip the tool call, they want to proceed without running it"}]},v;P.type===4&&P.selectedButton&&(e.selectedCustomButton=P.selectedButton),e.toolSpecificData?.kind==="input"&&(e.parameters=e.toolSpecificData.rawInput,e.toolSpecificData=void 0)}}else{b=Dn.create(!0),y=await this.prepareToolInvocationWithHookResult(g,e,h,o),b.stop();let{autoConfirmed:k,preparedInvocation:T}=await this.resolveAutoConfirmFromHook(h,g,e,y,void 0);if(y=T,y?.confirmationMessages?.title&&!k&&!(await this._dialogService.confirm({message:Da(y.confirmationMessages.title),detail:Da(y.confirmationMessages.message)})).confirmed)throw new go;e.toolSpecificData=y?.toolSpecificData}if(o.isCancellationRequested)throw new go;S=Dn.create(!0),v=await g.impl.invoke(e,t,{report:k=>{c?.acceptProgress(k)}},o),S.stop(),this.ensureToolDetails(e,v,g.data,c);let w=await c?.didExecuteTool(v,void 0,()=>this.shouldAutoConfirmPostExecution(g.data.id,g.data.runsInWorkspace,g.data.source,e.parameters,e.context?.sessionResource,e.chatRequestId));if(c&&w?.type===Pi.StateKind.WaitingForPostApproval){let k=await Pi.awaitPostConfirmation(c,o);if(k.type===0)throw new go;k.type===5&&(v={content:[{kind:"text",value:"The tool executed but the user chose not to share the results"}]})}return this._telemetryService.publicLog2("languageModelToolInvoked",{result:"success",chatSessionId:e.context?.sessionResource?ap(e.context.sessionResource):void 0,toolId:g.data.id,toolExtensionId:g.data.source.type==="extension"?g.data.source.extensionId.value:void 0,toolSourceKind:g.data.source.type,prepareTimeMs:b?.elapsed(),invocationTimeMs:S?.elapsed()}),v}catch(w){let k=ao(w)?"userCancelled":"error";throw this._telemetryService.publicLog2("languageModelToolInvoked",{result:k,chatSessionId:e.context?.sessionResource?ap(e.context.sessionResource):void 0,toolId:g.data.id,toolExtensionId:g.data.source.type==="extension"?g.data.source.extensionId.value:void 0,toolSourceKind:g.data.source.type,prepareTimeMs:b?.elapsed(),invocationTimeMs:S?.elapsed()}),ao(w)||this._logService.error(`[LanguageModelToolsService#invokeTool] Error from tool ${e.toolId} with parameters ${JSON.stringify(e.parameters)}:
${xn(w,!0)}`),v??={content:[]},v.toolResultError=w instanceof Error?w.message:String(w),g.data.alwaysDisplayInputOutput&&(v.toolResultDetails={input:this.formatToolInput(e),output:[{type:"embed",isText:!0,value:String(w)}],isError:!0}),w}finally{c?.didExecuteTool(v,!0),p&&this.cleanupCallDisposables(u,p)}}async prepareToolInvocationWithHookResult(e,t,o,n){let r;if(o?.permissionDecision==="ask"){let s=d(7622,null,"PreToolUse");r=o.permissionDecisionReason?`${s}: ${o.permissionDecisionReason}`:s}return this.prepareToolInvocation(e,t,r,n)}async resolveAutoConfirmFromHook(e,t,o,n,r){if(e?.permissionDecision==="allow")return this._logService.debug(`[LanguageModelToolsService#invokeTool] Tool ${o.toolId} auto-approved by preToolUse hook`),{autoConfirmed:{type:1,reason:d(7614,null)},preparedInvocation:n};if(e?.permissionDecision==="ask"){if(this._logService.debug(`[LanguageModelToolsService#invokeTool] Tool ${o.toolId} requires confirmation (preToolUse hook returned 'ask')`),n?.confirmationMessages?.title){let u=e.permissionDecisionReason,p=u?d(7618,null,"PreToolUse",u):d(7619,null,"PreToolUse"),h=n.confirmationMessages;if(n.toolSpecificData?.kind==="terminal"){let g=h.disclaimer?typeof h.disclaimer=="string"?h.disclaimer:h.disclaimer.value:void 0,f=g?`${p}

${g}`:p;n.confirmationMessages={...h,disclaimer:f,allowAutoConfirm:!1}}else{let g=typeof h.message=="string"?h.message:h.message?.value??"";n.confirmationMessages={...h,message:new Ie(`_${p}_

${g}`),allowAutoConfirm:!1}}}else{n||(n={});let u=ene(t.data),p=e.permissionDecisionReason,h=p?d(7617,null,"PreToolUse",p):d(7616,null,"PreToolUse");n.confirmationMessages={...n.confirmationMessages,title:d(7620,null,u),message:new Ie(`_${h}_`),allowAutoConfirm:!1},n.toolSpecificData={kind:"input",rawInput:o.parameters}}return{autoConfirmed:void 0,preparedInvocation:n}}let s=n?.confirmationMessages?.approveCombination,l;return s&&(l={label:typeof s.label=="string"?s.label:s.label.value,key:s.key}),{autoConfirmed:await this.shouldAutoConfirm(t.data.id,t.data.runsInWorkspace,t.data.source,o.parameters,r,o.chatRequestId,l),preparedInvocation:n}}async prepareToolInvocation(e,t,o,n){let r;if(e.impl.prepareToolInvocation){let l=e.impl.prepareToolInvocation({parameters:t.parameters,toolCallId:t.callId,chatRequestId:t.chatRequestId,chatSessionResource:t.context?.sessionResource,chatInteractionId:t.chatInteractionId,modelId:t.modelId,forceConfirmationReason:o},n);await Promise.race([Li(3e3,n).then(()=>"timeout"),l])==="timeout"&&t.context&&this._onDidPrepareToolCallBecomeUnresponsive.fire({sessionResource:t.context.sessionResource,toolData:e.data}),r=await l}let s=this.isToolEligibleForAutoApproval(e.data);if(!s&&!r?.confirmationMessages?.title){r||(r={});let l=ene(e.data);r.confirmationMessages={...r.confirmationMessages,title:d(7612,null),message:d(7611,null,l),disclaimer:Bst.has(e.data.id)?void 0:new Ie(d(7610,null,ene(e.data),pw({text:"`chat.tools.eligibleForAutoApproval`",id:"workbench.action.openSettings",arguments:["chat.tools.eligibleForAutoApproval"],tooltip:d(7621,null)},!1)),{isTrusted:!0}),allowAutoConfirm:!1}}return!s&&r?.confirmationMessages?.title&&(r.confirmationMessages.disclaimer=Bst.has(e.data.id)?void 0:new Ie(d(7610,null,ene(e.data),pw({text:"`chat.tools.eligibleForAutoApproval`",id:"workbench.action.openSettings",arguments:["chat.tools.eligibleForAutoApproval"],tooltip:d(7621,null)},!1)),{isTrusted:!0})),r?.confirmationMessages?.title&&(r.toolSpecificData?.kind!=="terminal"&&r.confirmationMessages.allowAutoConfirm!==!1&&(r.confirmationMessages.allowAutoConfirm=s),!r.toolSpecificData&&e.data.alwaysDisplayInputOutput&&(r.toolSpecificData={kind:"input",rawInput:t.parameters})),r}beginToolCall(e){let t=this._tools.get(e.toolId);if(!t||!t.impl?.handleToolStream)return;let o=MA.createStreaming({toolCallId:e.toolCallId,toolId:e.toolId,toolData:t.data,subagentInvocationId:e.subagentInvocationId,chatRequestId:e.chatRequestId});if(this._pendingToolCalls.set(e.toolCallId,o),e.sessionResource){let n=this._chatService.getSession(e.sessionResource);if(n){let r=(e.chatRequestId?n.getRequests().find(s=>s.id===e.chatRequestId):void 0)??n.getRequests().at(-1);r&&this._chatService.appendProgress(r,o)}}return this._callHandleToolStream(t,o,e.toolCallId,void 0,Se.None),o}async _callHandleToolStream(e,t,o,n,r){if(e.impl?.handleToolStream)try{let s=await e.impl.handleToolStream({toolCallId:o,rawInput:n,chatRequestId:t.chatRequestId},r);s?.invocationMessage&&t.updateStreamingMessage(s.invocationMessage)}catch(s){this._logService.error(`[LanguageModelToolsService#_callHandleToolStream] Error calling handleToolStream for tool ${e.data.id}:`,s)}}async updateToolStream(e,t,o){let n=this._pendingToolCalls.get(e);if(!n)return;n.updatePartialInput(t);let r=this._tools.get(n.toolId);r&&await this._callHandleToolStream(r,n,e,t,o)}playAccessibilitySignal(e,t){if(this._configurationService.getValue("chat.tools.global.autoApprove"))return;if(t){let u=this._chatService.getSession(t)?.getRequests().at(-1);if(YX(u?.modeInfo?.permissionLevel)||this._isSessionLiveAutoApproveLevel(t))return}let n=e.filter(c=>!Pi.executionConfirmedOrDenied(c));if(n.length===0)return;let r=this._configurationService.getValue($o.chatUserActionRequired.settingsKey);if(!r)return;let s=r.sound==="on"||r.sound==="auto"&&this._accessibilityService.isScreenReaderOptimized(),l=this._accessibilityService.isScreenReaderOptimized()&&r.announcement==="auto";(s||l)&&this._accessibilitySignalService.playSignal($o.chatUserActionRequired,{customAlertMessage:this._instantiationService.invokeFunction(CDi,n),userGesture:!0,modality:s?void 0:"announcement"})}ensureToolDetails(e,t,o,n){!t.toolResultDetails&&(o.alwaysDisplayInputOutput||this.toolResultHasImages(t)&&!this.toolResultMessageHasImageFileWidgets(t,n))&&(t.toolResultDetails={input:this.formatToolInput(e),output:this.toolResultToIO(t)})}toolResultHasImages(e){return e.content.some(t=>t.kind==="data"&&t.value.mimeType?.startsWith("image/"))}toolResultMessageHasImageFileWidgets(e,t){let o=e.toolResultMessage??t?.pastTenseMessage;if(!o)return!1;let n=typeof o=="string"?o:o.value,r=/\[\s*\]\((?<uri>[^)]+)\)/g,s;for(;(s=r.exec(n))!==null;)try{let l=A.parse(s.groups.uri);if(GI(l.path)?.startsWith("image/"))return!0}catch{}return!1}formatToolInput(e){return JSON.stringify(e.parameters,void 0,2)}toolResultToIO(e){return e.content.map(t=>{if(t.kind==="text")return{type:"embed",isText:!0,value:t.value};if(t.kind==="promptTsx")return{type:"embed",isText:!0,value:z6e(t)};if(t.kind==="data")return{type:"embed",value:Yd(t.value.data),mimeType:t.value.mimeType};os(t)})}_isAutoApprovePolicyRestricted(){return this._configurationService.inspect("chat.tools.global.autoApprove").policyValue===!1}_isSessionLiveAutoApproveLevel(e){let t=this._chatWidgetService.getWidgetBySessionResource(e)??this._chatWidgetService.lastFocusedWidget;return!!t&&YX(t.input.currentModeInfo.permissionLevel)}getEligibleForAutoApprovalSpecialCase(e){if(e.id==="vscode_fetchWebPage_internal")return"fetch"}isToolEligibleForAutoApproval(e){let t=this.getEligibleForAutoApprovalSpecialCase(e)??ene(e);if(e.id==="copilot_fetchWebPage")return!0;if(Bst.has(e.id))return!1;let o=this._configurationService.getValue("chat.tools.eligibleForAutoApproval");if(o&&typeof o=="object"&&t){if(Object.prototype.hasOwnProperty.call(o,t))return o[t];if(e.legacyToolReferenceFullNames)for(let n of e.legacyToolReferenceFullNames){if(Object.prototype.hasOwnProperty.call(o,n))return o[n];if(n.includes("/")){let r=n.split("/").pop();if(r&&Object.prototype.hasOwnProperty.call(o,r))return o[r]}}}return!0}async shouldAutoConfirm(e,t,o,n,r,s,l){let c=this._tools.get(e);if(!c)return;if(r&&!this._isAutoApprovePolicyRestricted()){let v=this._chatService.getSession(r)?.getRequests().at(-1);if((YX(v?.modeInfo?.permissionLevel)||this._isSessionLiveAutoApproveLevel(r))&&!(Bst.has(c.data.id)&&gl(r)!==sc))return{type:1,reason:"auto-approve-all"}}if(!this.isToolEligibleForAutoApproval(c.data))return;let u=this._confirmationService.getPreConfirmAction({toolId:e,source:o,parameters:n,chatSessionResource:r,combination:l});if(u)return u;let p=this._configurationService.inspect("chat.tools.global.autoApprove"),h=p.value??p.defaultValue;if(typeof t=="boolean"&&(h=p.userLocalValue??p.applicationValue,t&&(h=p.workspaceValue??p.workspaceFolderValue??p.userRemoteValue??h)),(h===!0||typeof h=="object"&&h.hasOwnProperty(e)&&h[e]===!0)&&await this._checkGlobalAutoApprove())return{type:2,id:"chat.tools.global.autoApprove"}}async shouldAutoConfirmPostExecution(e,t,o,n,r,s){if(r&&!this._isAutoApprovePolicyRestricted()){let c=this._chatService.getSession(r)?.getRequests().at(-1);if((YX(c?.modeInfo?.permissionLevel)||this._isSessionLiveAutoApproveLevel(r))&&!(Bst.has(e)&&gl(r)!==sc))return{type:1,reason:"auto-approve-all"}}return this._configurationService.getValue("chat.tools.global.autoApprove")&&await this._checkGlobalAutoApprove()?{type:2,id:"chat.tools.global.autoApprove"}:this._confirmationService.getPostConfirmAction({toolId:e,source:o,parameters:n,chatSessionResource:r})}async _checkGlobalAutoApprove(){if(this._storageService.getBoolean("chat.tools.global.autoApprove.optIn",-1,!1)||this._contextKeyService.getContextKeyValue(udn)===!0)return!0;if(this._pendingGlobalAutoApproveCheck)return this._pendingGlobalAutoApproveCheck;this._pendingGlobalAutoApproveCheck=this._doCheckGlobalAutoApprove();try{return await this._pendingGlobalAutoApproveCheck}finally{this._pendingGlobalAutoApproveCheck=void 0}}async _doCheckGlobalAutoApprove(){let e=new N;try{let t=new Ye;e.add(t),e.add(this._storageService.onDidChangeValue(-1,"chat.tools.global.autoApprove.optIn",e)(()=>{this._storageService.getBoolean("chat.tools.global.autoApprove.optIn",-1,!1)&&t.cancel()}));let o=await this._dialogService.prompt({type:bt.Warning,message:d(7604,null),buttons:[{label:d(7603,null),run:()=>!0},{label:d(7602,null),run:()=>!1}],custom:{icon:R.warning,markdownDetails:[{markdown:new Ie(MNi.value,{isTrusted:{enabledCommands:["workbench.action.openSettings"]}})}]},token:t.token});return t.token.isCancellationRequested?!0:o.result!==!0?(await this._configurationService.updateValue("chat.tools.global.autoApprove",!1),!1):(this._storageService.store("chat.tools.global.autoApprove.optIn",!0,-1,0),!0)}finally{e.dispose()}}cleanupCallDisposables(e,t){if(e){let o=this._callsByRequestId.get(e);if(o){let n=o.findIndex(r=>r.store===t);n>-1&&o.splice(n,1),o.length===0&&this._callsByRequestId.delete(e)}}t.dispose()}cancelToolCallsForRequest(e){let t=this._callsByRequestId.get(e);t&&(t.forEach(o=>o.store.dispose()),this._callsByRequestId.delete(e));for(let[o,n]of this._pendingToolCalls)n.chatRequestId===e&&this._pendingToolCalls.delete(o)}static{this.githubMCPServerAliases=["github/github-mcp-server","io.github.github/github-mcp-server","github-mcp-server"]}static{this.playwrightMCPServerAliases=["microsoft/playwright-mcp","com.microsoft/playwright-mcp"]}*getToolSetAliases(e,t){switch(t!==e.referenceName&&(yield e.referenceName),e.legacyFullNames&&(yield*e.legacyFullNames),e.referenceName){case"github":for(let o of LN.githubMCPServerAliases)yield o+"/*";break;case"playwright":for(let o of LN.playwrightMCPServerAliases)yield o+"/*";break;case pm.execute:yield"shell";break;case pm.agent:yield u4.runSubagent,yield"custom-agent";break}}*getToolAliases(e,t){let o=e.toolReferenceName??e.displayName;if(t!==o&&o!==u4.runSubagent&&(yield o),e.legacyToolReferenceFullNames)for(let r of e.legacyToolReferenceFullNames){yield r;let s=r.lastIndexOf("/");s!==-1&&(yield r.substring(s+1))}let n=t.lastIndexOf("/");if(n!==-1)switch(t.substring(0,n)){case"github":for(let r of LN.githubMCPServerAliases)yield r+t.substring(n);break;case"playwright":for(let r of LN.playwrightMCPServerAliases)yield r+t.substring(n);break}}toToolAndToolSetEnablementMap(e,t){let o=new Set(e),n=new Map;for(let[r,s]of this.toolsWithFullReferenceName.get())if(Xm(r)){let l=o.has(s)||vt.some(this.getToolSetAliases(r,s),u=>o.has(u)),c=t?new U6e(r,t):r;if(n.set(c,l),l)for(let u of c.getTools())n.set(u,!0)}else{if(t&&!bLt(r,t))continue;if(!n.has(r)){let l=o.has(s)||vt.some(this.getToolAliases(r,s),c=>o.has(c))||!!r.legacyToolReferenceFullNames?.some(c=>{let u=c.lastIndexOf("/");return u!==-1&&o.has(c.substring(0,u))});n.set(r,l)}}for(let r of this._toolSets)if(r.source.type==="user"){let s=vt.every(r.getTools(),l=>n.get(l)===!0);n.set(r,s)}return n}toFullReferenceNames(e){let t=[],o=new Set;for(let[n,r]of this.toolsWithFullReferenceName.get())if(Xm(n)){if(e.get(n)){t.push(r);for(let s of n.getTools())o.add(s)}}else e.get(n)&&!o.has(n)&&t.push(r);return t}toToolReferences(e){let t=new Map;for(let[n,r]of this.toolsWithFullReferenceName.get())t.set(r,n);let o=[];for(let n of e){let r=t.get(n.name);r&&(Xm(r)?o.push(hLt(r,n.range)):o.push(eue(r,n.range)))}return o}getToolSetsForModel(e,t){return e?vt.map(this.toolSets.read(t),o=>new U6e(o,e)):this.toolSets.read(t)}getToolSet(e){for(let t of this._toolSets)if(t.id===e)return t}getToolSetByName(e){for(let t of this._toolSets)if(t.referenceName===e)return t}getSpecedToolSetName(e){return LN.githubMCPServerAliases.includes(e)?"github":LN.playwrightMCPServerAliases.includes(e)?"playwright":e}createToolSet(e,t,o,n){let r=this;o=this.getSpecedToolSetName(o);let s=new class extends oTe{dispose(){r._toolSets.has(s)&&(this._tools.clear(),r._toolSets.delete(s))}}(t,o,n?.icon??R.tools,e,n?.description,n?.legacyFullNames,this._contextKeyService);return this._toolSets.add(s),s}*getFullReferenceNames(){for(let[,e]of this.toolsWithFullReferenceName.get())yield e}getDeprecatedFullReferenceNames(){let e=new Map,t=new Set,o=(n,r)=>{n!==r&&(e.has(n)||e.set(n,new Set),e.get(n).add(r))};for(let[n,r]of this.toolsWithFullReferenceName.get())if(Xm(n)&&(t.add(n.referenceName),n.legacyFullNames))for(let s of n.legacyFullNames)t.add(s);for(let[n,r]of this.toolsWithFullReferenceName.get())if(Xm(n))for(let s of this.getToolSetAliases(n,r))o(s,r);else{for(let s of this.getToolAliases(n,r))o(s,r);if(n.legacyToolReferenceFullNames){let s=r.lastIndexOf("/"),l=s!==-1?r.substring(0,s+1):void 0;for(let c of n.legacyToolReferenceFullNames)if(l&&!c.includes("/")&&o(l+c,r),c.includes("/")){let u=c.substring(0,c.lastIndexOf("/"));t.has(u)||o(u,r)}}}return e}getToolByFullReferenceName(e){for(let[t,o]of this.toolsWithFullReferenceName.get()){if(e===o)return t;let n=Xm(t)?this.getToolSetAliases(t,o):this.getToolAliases(t,o);if(vt.some(n,r=>e===r))return t}}getFullReferenceName(e,t){for(let[o,n]of this.toolsWithFullReferenceName.get())if(o===e)return n;return Xm(e)?Gxo(e):ene(e,t)}};LN=I([m(0,F),m(1,lt),m(2,X),m(3,mi),m(4,at),m(5,Te),m(6,se),m(7,B),m(8,Oi),m(9,lr),m(10,ce),m(11,_D),m(12,ge),m(13,Pt)],LN);function ene(a,i){let e=a.toolReferenceName??a.displayName;return i?`${i.referenceName}/${e}`:a.source.type==="extension"?`${a.source.extensionId.value.toLowerCase()}/${e}`:e}function Gxo(a){return a.source.type==="mcp"?`${a.referenceName}/*`:a.referenceName}var P$t=".md",pdn=[".instructions.md",".mdc",".md"];function $xo(a,i){return[...i.entries()].map(([e,{hooks:t,originalId:o}])=>({type:e,uri:a,hooks:t,originalId:o}))}function jxo(a,i){let e=i.getWorkspace().folders[0];return(i.getWorkspaceFolder(a)??e)?.uri}var Hst=class{constructor(i){this._workspaceContextService=i;this.format=0;this.manifestPath="plugin.json";this.hookConfigPath="hooks.json";this.pluginRootToken=void 0;this.pluginRootEnvVar=void 0}parseHooks(i,e,t,o){let n=jxo(t,this._workspaceContextService);return $xo(i,k2t(e,n,o))}};Hst=I([m(0,Pe)],Hst);var mdn=/[\s&|<>()^;!`"']/;function hdn(a,i,e){if(!a.includes(e))return a;if(!mdn.test(i))return a.replaceAll(e,i);let t=ns(e),o=new RegExp(`(["']?)`+t+"([\\w./\\\\~:-]*)","g");return a.replace(o,(n,r,s)=>{let l=i+s;return r?r+l:'"'+l.replace(/"/g,'\\"')+'"'})}function gdn(a){if(!a||typeof a!="object"||Array.isArray(a))return;let i=a;return Object.hasOwn(i,"mcpServers")?i.mcpServers:i}function fdn(a,i,e,t){let o=s=>s.replaceAll(e,i),n=a.configuration,r;if(n.type==="stdio"){let s={...n};s.command=o(s.command),s.args&&(s.args=s.args.map(o)),s.cwd&&(s.cwd=o(s.cwd)),s.env={...s.env};for(let[l,c]of Object.entries(s.env))typeof c=="string"&&(s.env[l]=o(c));s.env[t]=i,s.envFile&&(s.envFile=o(s.envFile)),r=s}else{let s={...n};s.url=o(s.url),s.headers&&(s.headers=Object.fromEntries(Object.entries(s.headers).map(([l,c])=>[l,o(c)]))),r=s}return{name:a.name,configuration:r,uri:a.uri}}var vdn=/\$\{(?![A-Za-z]+:)([A-Z_][A-Z0-9_]*)\}/g;function bdn(a){return Fx(a,i=>{if(A.isUri(i))return i;if(typeof i=="string"){let e=i.replace(vdn,"${env:$1}");return e!==i?e:void 0}})}function Qxo(a,i,e,t,o,n,r){let s=e.fsPath,l=i,c=f=>{for(let v of["command","windows","linux","osx"])typeof f[v]=="string"&&(f[v]=hdn(f[v],s,n));f.env??={},f.env[r]=s};for(let f of Object.values(l.hooks??{}))if(Array.isArray(f))for(let v of f){if(!v||typeof v!="object")continue;let b=v;if(Array.isArray(b.hooks))for(let S of b.hooks)c(S);else c(b)}let u=f=>typeof f=="string"?f.replaceAll(n,e.fsPath):void 0,p=jxo(e,o),{hooks:h,disabledAllHooks:g}=rrt(Fx(i,u),p,t);return g?[]:$xo(a,h)}var Ust=class{constructor(i){this._workspaceContextService=i;this.format=1;this.manifestPath=".claude-plugin/plugin.json";this.hookConfigPath="hooks/hooks.json";this.pluginRootToken="${CLAUDE_PLUGIN_ROOT}";this.pluginRootEnvVar="CLAUDE_PLUGIN_ROOT"}parseHooks(i,e,t,o){return Qxo(i,e,t,o,this._workspaceContextService,"${CLAUDE_PLUGIN_ROOT}","CLAUDE_PLUGIN_ROOT")}};Ust=I([m(0,Pe)],Ust);var zst=class{constructor(i){this._workspaceContextService=i;this.format=2;this.manifestPath=".plugin/plugin.json";this.hookConfigPath="hooks/hooks.json";this.pluginRootToken="${PLUGIN_ROOT}";this.pluginRootEnvVar="PLUGIN_ROOT"}parseHooks(i,e,t,o){return Qxo(i,e,t,o,this._workspaceContextService,"${PLUGIN_ROOT}","PLUGIN_ROOT")}};zst=I([m(0,Pe)],zst);var PNi={paths:[],exclusive:!1};function Sdn(a){if(a==null)return PNi;if(typeof a=="string"){let i=a.trim();return i?{paths:[i],exclusive:!1}:PNi}if(Array.isArray(a))return{paths:a.filter(e=>typeof e=="string").map(e=>e.trim()).filter(e=>e.length>0),exclusive:!1};if(typeof a=="object"){let i=a;if(Array.isArray(i.paths)){let e=i.paths.filter(o=>typeof o=="string").map(o=>o.trim()).filter(o=>o.length>0),t=i.exclusive===!0;return{paths:e,exclusive:t}}}return PNi}function Idn(a,i,e){let t=[];e.exclusive||t.push(Ge(a,i));for(let o of e.paths){let n=F$(Ge(a,o));ws(n,a)&&t.push(n)}return t}var FVe=class extends x{constructor(i,e,t){super(),this.enablementModel=this._register(new loe("agentPlugins.enablement",t));let o=hr("chat.plugins.enabled",!0,e),n=[];for(let r of ZAe.getAll()){let s=i.createInstance(r);this._register(s),n.push(s),s.start(this.enablementModel)}this.plugins=ke(r=>o.read(r)?this._dedupeAndSort(n.flatMap(s=>s.plugins.read(r))):[])}_dedupeAndSort(i){let e=[],t=new En;for(let o of i)t.has(o.uri)||(t.add(o.uri),e.push(o));return e.sort((o,n)=>o.uri.toString().localeCompare(n.uri.toString())),e}};FVe=I([m(0,F),m(1,B),m(2,ce)],FVe);var Kst=class extends x{constructor(e,t,o,n){super();this._fileService=e;this._pathService=t;this._logService=o;this._instantiationService=n;this._pluginEntries=new Map;this._plugins=Me("discoveredAgentPlugins",[]);this.plugins=this._plugins;this._discoverVersion=0}async _refreshPlugins(){let e=++this._discoverVersion,t=await this._discoverAndBuildPlugins();e!==this._discoverVersion||this._store.isDisposed||this._plugins.set(t,void 0)}async _discoverAndBuildPlugins(){let e=await this._discoverPluginSources(),t=[],o=new Set;for(let n of e){let r=n.uri.toString();if(!o.has(r)){o.add(r);let s=await this._detectPluginFormatAdapter(n.uri);t.push(this._toPlugin(n.uri,s,n.fromMarketplace,()=>n.remove()))}}return this._disposePluginEntriesExcept(o),t.sort((n,r)=>n.uri.toString().localeCompare(r.uri.toString())),t}async _detectPluginFormatAdapter(e){return await this._pathExists(Ge(e,".plugin","plugin.json"))?this._instantiationService.createInstance(zst):e.path.split("/").includes(".claude")||await this._pathExists(Ge(e,".claude-plugin","plugin.json"))?this._instantiationService.createInstance(Ust):this._instantiationService.createInstance(Hst)}async _pathExists(e){try{return await this._fileService.resolve(e),!0}catch{return!1}}_toPlugin(e,t,o,n){let r=e.toString(),s=this._pluginEntries.get(r);if(s)if(s.adapter.format!==t.format)s.store.dispose(),this._pluginEntries.delete(r);else return s.plugin;let l=new N,c=ke(P=>this._enablementModel.readEnabled(r,P)),u=Me("agentPluginManifest",void 0),p=(P,O,V,H=P)=>{let G=Os({equalsFn:eo},oe=>u.read(oe)?.[P]),$=ke(oe=>{let de=G.read(oe);if(V&&de&&typeof de=="object"&&!Array.isArray(de)&&!No(de,{paths:!0}))return{kind:"const",data:new bd(V(de))};let Ce=Sdn(de),xe=Idn(e,H,Ce);for(let ze of xe){let De=this._fileService.createWatcher(ze,{recursive:!1,excludes:[]});oe.store.add(De),oe.store.add(De.onDidChange(()=>J.trigger(void 0)))}return{kind:"dirs",dirs:xe}}),J=wc("fileChange");return ke(oe=>{let de=$.read(oe);return de.kind==="const"?de.data.promiseResult:(J.read(oe),new bd(O(de.dirs)).promiseResult)}).map((oe,de)=>oe.read(de)?.data??vt.empty()).recomputeInitiallyAndOnChange(l)},h=Ge(e,t.manifestPath),g=p("commands",P=>this._readMarkdownComponents(P)),f=p("skills",P=>this._readSkills(e,P)),v=p("agents",P=>this._readMarkdownComponents(P)),b=p("rules",P=>this._readRules(P)),S=p("hooks",P=>this._readHooksFromPaths(e,P,t),async P=>{let O=(await this._pathService.userHome()).fsPath;return t.parseHooks(h,P,e,O)},t.hookConfigPath),y=p("mcpServers",P=>this._readMcpDefinitionsFromPaths(P,e.fsPath,t),async P=>this._parseMcpServerDefinitionMap(h,{mcpServers:P},e.fsPath,t),".mcp.json"),w=async()=>{u.set(await this._readManifest(e,t),void 0)},k=this._fileService.createWatcher(h,{recursive:!1,excludes:[]});l.add(k),l.add(k.onDidChange(()=>w())),w();let T={uri:e,label:o?.name??He(e),enablement:c,remove:n,hooks:S,commands:g,skills:f,agents:v,instructions:b,mcpServerDefinitions:y,fromMarketplace:o};return this._pluginEntries.set(r,{store:l,plugin:T,adapter:t}),T}async _readManifest(e,t){let o=await this._readJsonFile(Ge(e,t.manifestPath));if(o&&typeof o=="object")return o}async _readHooksFromPaths(e,t,o){let n=(await this._pathService.userHome()).fsPath;for(let r of t){let s=await this._readJsonFile(r);if(s)try{return o.parseHooks(r,s,e,n)}catch(l){this._logService.info(`[AgentPluginDiscovery] Failed to parse hooks from ${r.toString()}:`,l)}}return[]}async _readMcpDefinitionsFromPaths(e,t,o){let n=new Map;for(let r of e){let s=await this._readJsonFile(r);for(let l of this._parseMcpServerDefinitionMap(r,s,t,o))n.has(l.name)||n.set(l.name,l)}return[...n.values()].sort((r,s)=>r.name.localeCompare(s.name))}_parseMcpServerDefinitionMap(e,t,o,n){let r=gdn(t);if(!r)return[];let s=[];for(let[l,c]of Object.entries(r)){let u=this._normalizeMcpServerConfiguration(c);if(!u)continue;let p={name:l,configuration:u,uri:e};n.pluginRootToken&&n.pluginRootEnvVar&&(p=fdn(p,o,n.pluginRootToken,n.pluginRootEnvVar)),p=bdn(p),s.push(p)}return s}_normalizeMcpServerConfiguration(e){if(!e||typeof e!="object")return;let t=e,o=typeof t.type=="string"?t.type:void 0,n=typeof t.command=="string"?t.command:void 0,r=typeof t.url=="string"?t.url:void 0,s=Array.isArray(t.args)?t.args.filter(g=>typeof g=="string"):void 0,l=t.env&&typeof t.env=="object"?Object.fromEntries(Object.entries(t.env).filter(([,g])=>typeof g=="string"||typeof g=="number"||g===null).map(([g,f])=>[g,f])):void 0,c=typeof t.envFile=="string"?t.envFile:void 0,u=typeof t.cwd=="string"?t.cwd:void 0,p=t.headers&&typeof t.headers=="object"?Object.fromEntries(Object.entries(t.headers).filter(([,g])=>typeof g=="string").map(([g,f])=>[g,f])):void 0,h=t.dev&&typeof t.dev=="object"?t.dev:void 0;if(o!=="ws"){if(o==="stdio"||!o&&n)return n?{type:"stdio",command:n,args:s,env:l,envFile:c,cwd:u,dev:h}:void 0;if(o==="http"||o==="sse"||!o&&r)return r?{type:"http",url:r,headers:p,dev:h}:void 0}}async _readJsonFile(e){try{let t=await this._fileService.readFile(e);return jr(t.value.toString())}catch{return}}async _readSkills(e,t){let o=new Set,n=[],r=(s,l)=>{o.has(s)||(o.add(s),n.push({uri:l,name:s}))};for(let s of t){let l=A.joinPath(s,"SKILL.md");if(await this._pathExists(l)){r(He(s),l);continue}let c;try{c=await this._fileService.resolve(s)}catch{continue}if(!(!c.isDirectory||!c.children))for(let u of c.children){let p=A.joinPath(u.resource,"SKILL.md");await this._pathExists(p)&&r(He(u.resource),p)}}if(n.length===0){let s=A.joinPath(e,"SKILL.md");await this._pathExists(s)&&r(He(e),s)}return n.sort((s,l)=>s.name.localeCompare(l.name)),n}async _readRules(e){let t=new Set,o=[],n=s=>{let l=s.toLowerCase();return pdn.find(c=>l.endsWith(c))},r=(s,l)=>{t.has(s)||(t.add(s),o.push({uri:l,name:s}))};for(let s of e){let l;try{l=await this._fileService.resolve(s)}catch{continue}if(l.isFile){let c=n(He(s));c&&r(He(s).slice(0,-c.length),s);continue}if(!(!l.isDirectory||!l.children))for(let c of l.children){if(!c.isFile)continue;let u=n(c.name);u&&r(c.name.slice(0,-u.length),c.resource)}}return o.sort((s,l)=>s.name.localeCompare(l.name)),o}async _readMarkdownComponents(e){let t=new Set,o=[],n=(r,s)=>{t.has(r)||(t.add(r),o.push({uri:s,name:r}))};for(let r of e){let s;try{s=await this._fileService.resolve(r)}catch{continue}if(s.isFile&&es(r).toLowerCase()===P$t){n(He(r).slice(0,-P$t.length),r);continue}if(!(!s.isDirectory||!s.children))for(let l of s.children)!l.isFile||es(l.resource).toLowerCase()!==P$t||n(He(l.resource).slice(0,-P$t.length),l.resource)}return o.sort((r,s)=>r.name.localeCompare(s.name)),o}_disposePluginEntriesExcept(e){for(let[t,o]of this._pluginEntries)e.has(t)||(o.store.dispose(),this._pluginEntries.delete(t))}dispose(){this._disposePluginEntriesExcept(new Set),super.dispose()}},WVe=class extends Kst{constructor(e,t,o,n,r,s,l){super(t,r,s,l);this._configurationService=e;this._pluginMarketplaceService=o;this._workspaceContextService=n;this._pluginLocationsConfig=hr("chat.pluginLocations",{},e)}start(e){this._enablementModel=e;let t=this._register(new Dt(()=>this._refreshPlugins(),0));this._register(be(o=>{this._pluginLocationsConfig.read(o),t.schedule()})),t.schedule()}async _discoverPluginSources(){let e=[],t=this._pluginLocationsConfig.get(),o=await this._getUserHome();for(let[n,r]of Object.entries(t)){if(!n.trim()||r===!1)continue;let s=this._resolvePluginPath(n.trim(),o);for(let l of s){let c;try{c=await this._fileService.resolve(l)}catch{this._logService.debug(`[ConfiguredAgentPluginDiscovery] Could not resolve plugin path: ${l.toString()}`);continue}if(!c.isDirectory){this._logService.debug(`[ConfiguredAgentPluginDiscovery] Plugin path is not a directory: ${l.toString()}`);continue}let u=this._pluginMarketplaceService.getMarketplacePluginMetadata(c.resource),p=n;e.push({uri:c.resource,fromMarketplace:u,remove:()=>this._removePluginPath(p)})}}return e}async _getUserHome(){let e=await this._pathService.userHome();return e.scheme==="file"?e.fsPath:e.path}_resolvePluginPath(e,t){return e.startsWith("~")&&(e=F7(e,t)),$s.isAbsolute(e)||Oo.isAbsolute(e)?[A.file(e)]:this._workspaceContextService.getWorkspace().folders.map(o=>Ge(o.uri,e))}_removePluginPath(e){let t=this._configurationService.inspect("chat.pluginLocations"),o=[6,5,3,4,2,1];for(let n of o){let r=rje(t,n);if(r&&Object.prototype.hasOwnProperty.call(r,e)){let s={...r};delete s[e],this._configurationService.updateValue("chat.pluginLocations",s,n);return}}}};WVe=I([m(0,B),m(1,fe),m(2,Zk),m(3,Pe),m(4,An),m(5,se),m(6,F)],WVe);var VVe=class extends Kst{constructor(e,t,o,n,r,s){super(o,n,r,s);this._pluginMarketplaceService=e;this._pluginRepositoryService=t}start(e){this._enablementModel=e;let t=this._register(new Dt(()=>this._refreshPlugins(),0));this._register(be(o=>{this._pluginMarketplaceService.installedPlugins.read(o),t.schedule()})),t.schedule()}async _discoverPluginSources(){let e=this._pluginMarketplaceService.installedPlugins.get(),t=[];for(let o of e){let n;try{n=await this._fileService.resolve(o.pluginUri)}catch{this._logService.debug(`[MarketplaceAgentPluginDiscovery] Could not resolve installed plugin: ${o.pluginUri.toString()}`);continue}if(!n.isDirectory){this._logService.debug(`[MarketplaceAgentPluginDiscovery] Installed plugin path is not a directory: ${o.pluginUri.toString()}`);continue}t.push({uri:n.resource,fromMarketplace:o.plugin,remove:()=>{this._enablementModel.remove(n.resource.toString()),this._pluginMarketplaceService.removeInstalledPlugin(o.pluginUri);let r=this._pluginMarketplaceService.installedPlugins.get();this._pluginRepositoryService.cleanupPluginSource(o.plugin,r.map(s=>s.plugin.sourceDescriptor)).catch(s=>{this._logService.error("[MarketplaceAgentPluginDiscovery] Failed to clean up plugin source",s)})}})}return t}};VVe=I([m(0,Zk),m(1,aq),m(2,fe),m(3,An),m(4,se),m(5,F)],VVe);var ydn=Rn.registerExtensionPoint({extensionPoint:"chatPlugins",jsonSchema:{description:d(8255,null),type:"array",items:{additionalProperties:!1,type:"object",defaultSnippets:[{body:{path:"./relative/path/to/plugin/"}}],required:["path"],properties:{path:{description:d(8253,null),type:"string"},when:{description:d(8254,null),type:"string"}}}}}),BVe=class extends Kst{constructor(e,t,o,n,r,s,l){super(n,r,s,l);this._commandService=e;this._contextKeyService=t;this._dialogService=o;this._extensionPlugins=new Map;this._whenKeys=new Set}start(e){this._enablementModel=e;let t=this._register(new Dt(()=>this._refreshPlugins(),0));this._register(this._contextKeyService.onDidChangeContext(o=>{o.affectsSome(this._whenKeys)&&t.schedule()})),ydn.setHandler((o,n)=>{for(let r of n.added)for(let s of r.value){if(!s.path){r.collector.error(d(8260,null,r.description.identifier.value));continue}let l=Ge(r.description.extensionLocation,s.path);if(!ws(l,r.description.extensionLocation)){r.collector.error(d(8258,null,r.description.identifier.value,s.path));continue}let c;if(s.when&&(c=C.deserialize(s.when),!c)){r.collector.error(d(8259,null,r.description.identifier.value,s.path,s.when));continue}this._extensionPlugins.set(qxo(r.description.identifier,s.path),{uri:l,when:c,extensionId:r.description.identifier.value})}for(let r of n.removed)for(let s of r.value)this._extensionPlugins.delete(qxo(r.description.identifier,s.path));this._rebuildWhenKeys(),t.schedule()})}_rebuildWhenKeys(){this._whenKeys.clear();for(let{when:e}of this._extensionPlugins.values())if(e)for(let t of e.keys())this._whenKeys.add(t)}async _discoverPluginSources(){let e=[];for(let[,t]of this._extensionPlugins){if(t.when&&!this._contextKeyService.contextMatchesRules(t.when))continue;let o;try{o=await this._fileService.resolve(t.uri)}catch{this._logService.debug(`[ExtensionAgentPluginDiscovery] Could not resolve extension plugin path: ${t.uri.toString()}`);continue}if(!o.isDirectory){this._logService.debug(`[ExtensionAgentPluginDiscovery] Extension plugin path is not a directory: ${t.uri.toString()}`);continue}e.push({uri:o.resource,fromMarketplace:void 0,remove:()=>this._promptUninstallExtension(t.extensionId)})}return e}async _promptUninstallExtension(e){let{confirmed:t}=await this._dialogService.confirm({message:d(8261,null,e)});t&&await this._commandService.executeCommand("workbench.extensions.uninstallExtension",e)}};BVe=I([m(0,ge),m(1,X),m(2,at),m(3,fe),m(4,An),m(5,se),m(6,F)],BVe);function qxo(a,i){return`${a.value}/${i}`}var ANi=class extends x{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.chatPlugins?.length}render(e){let t=e.contributes?.chatPlugins??[];if(!t.length)return{data:{headers:[],rows:[]},dispose:()=>{}};let o=[d(8256,null),d(8257,null)],n=t.map(r=>[r.path,r.when??"-"]);return{data:{headers:o,rows:n},dispose:()=>{}}}};ne.as(As.ExtensionFeaturesRegistry).registerExtensionFeature({id:"chatPlugins",label:d(8252,null),access:{canToggle:!1},renderer:new Ft(ANi)});var jfe=class extends x{constructor(e,t,o,n){super();this._chatService=e;this._pluginMarketplaceService=t;this._notificationService=o;this._extensionsWorkbenchService=n;this._hasNotified=!1;this._register(this._chatService.onDidSubmitRequest(()=>{this._hasNotified||(this._hasNotified=!0,this._checkForRecommendedPlugins())}))}static{this.ID="workbench.contrib.agentPluginRecommendations"}_checkForRecommendedPlugins(){let e=this._pluginMarketplaceService.recommendedPlugins.get();if(e.size===0)return;let t=new Set;for(let n of this._pluginMarketplaceService.installedPlugins.get()){let r=`${n.plugin.name}@${n.plugin.marketplace}`;t.add(r)}let o=0;for(let n of e)t.has(n)||o++;o!==0&&this._notificationService.prompt(ft.Info,o===1?d(7359,null):d(7358,null,o),[{label:d(7360,null),run:()=>{this._extensionsWorkbenchService.openSearch("@agentPlugins @recommended")}}],{neverShowAgain:{id:"agentPluginRecommendations.dismissed",scope:0,isSecondary:!0}})}};jfe=I([m(0,mi),m(1,Zk),m(2,Ne),m(3,Hi)],jfe);function zVe(a){return a.replace(/[\\/:*?"<>|]/g,"_")}function ONi(a,i){return i?[`sha_${zVe(i)}`]:a?[`ref_${zVe(a)}`]:[]}function NNi(a){return new it("showGitOutput",d(7408,null),void 0,!0,()=>{a.executeCommand("git.showOutput")})}function wdn(a){return ei?`"${a.replace(/[`$"]/g,"`$&")}"`:`'${a.replace(/'/g,"'\\''")}'`}function Cdn(a){let[i,...e]=a;return[i,...e.map(t=>wdn(t))].join(" ")}var HVe=class{constructor(i,e,t,o,n){this._commandService=i;this._fileService=e;this._logService=t;this._notificationService=o;this._progressService=n}getCleanupTarget(i,e){return this._getRepoDir(i,e)}_getRepoDir(i,e){return this.getInstallUri(i,e)}async ensure(i,e,t){let o=e.sourceDescriptor,n=this._getRepoDir(i,o),r=await this._fileService.exists(n),s=this._displayLabel(o);if(r)return await this._checkoutRevision(n,o,t?.failureLabel??s),this.getInstallUri(i,o);let l=t?.progressTitle??d(7398,null,s),c=t?.failureLabel??s,u=o.ref;return await this._cloneRepository(n,this._cloneUrl(o),l,c,u),await this._checkoutRevision(n,o,c),this.getInstallUri(i,o)}async update(i,e,t){let o=e.sourceDescriptor,n=this._getRepoDir(i,o);if(!await this._fileService.exists(n))return this._logService.warn(`[${this.kind}] Cannot update plugin '${t?.pluginName??e.name}': source repository not cloned`),!1;let s=t?.pluginName??e.name,l=t?.failureLabel??s;try{let c=async()=>{await this._commandService.executeCommand("git.openRepository",n.fsPath);let u=o,p;if(u.sha){let h=await this._commandService.executeCommand("_git.revParse",n.fsPath,"HEAD").catch(()=>{});await this._commandService.executeCommand("git.fetch",n.fsPath),await this._checkoutRevision(n,o,l);let g=await this._commandService.executeCommand("_git.revParse",n.fsPath,"HEAD").catch(()=>{});p=h!==g}else p=!!await this._commandService.executeCommand("_git.pull",n.fsPath),await this._checkoutRevision(n,o,l);return p};return t?.silent?await c():await this._progressService.withProgress({location:15,title:d(7411,null,s),cancellable:!1},c)}catch(c){throw this._logService.error(`[${this.kind}] Failed to update plugin source '${s}':`,c),t?.silent||this._notificationService.notify({severity:ft.Error,message:d(7407,null,l,c?.message??String(c)),actions:{primary:[NNi(this._commandService)]}}),c}}async _cloneRepository(i,e,t,o,n){try{await this._progressService.withProgress({location:15,title:t,cancellable:!1},async()=>{await this._fileService.createFolder(ci(i)),await this._commandService.executeCommand("_git.cloneRepository",e,i.fsPath,n)})}catch(r){throw this._logService.error(`[${this.kind}] Failed to clone ${e}:`,r),this._notificationService.notify({severity:ft.Error,message:d(7397,null,o,r?.message??String(r)),actions:{primary:[NNi(this._commandService)]}}),r}}async _checkoutRevision(i,e,t){let o=e;if(!(!o.sha&&!o.ref))try{if(o.sha){await this._commandService.executeCommand("_git.checkout",i.fsPath,o.sha,!0);return}await this._commandService.executeCommand("_git.checkout",i.fsPath,o.ref)}catch(n){throw this._logService.error(`[${this.kind}] Failed to checkout revision for '${t}':`,n),this._notificationService.notify({severity:ft.Error,message:d(7396,null,t,n?.message??String(n)),actions:{primary:[NNi(this._commandService)]}}),n}}};HVe=I([m(0,ge),m(1,fe),m(2,se),m(3,Ne),m(4,Fo)],HVe);var A$t=class{constructor(){this.kind="relativePath"}getInstallUri(i,e){throw new Error("Use getPluginInstallUri() for relative-path sources")}async ensure(i,e,t){throw new Error("Use ensureRepository() for relative-path sources")}async update(i,e,t){throw new Error("Use pullRepository() for relative-path sources")}getCleanupTarget(i,e){}getLabel(i){return i.path||"."}},N$t=class extends HVe{constructor(){super(...arguments);this.kind="github"}getInstallUri(e,t){let o=this._getRepoDir(e,t),n=t;if(n.path){let r=n.path.trim().replace(/^\.?\/+|\/+$/g,"");if(r){let s=Ge(o,r);if(ws(s,o))return s}}return o}_getRepoDir(e,t){let o=t,[n,r]=o.repo.split("/");return Ge(e,"github.com",n,r,...ONi(o.ref,o.sha))}getLabel(e){let t=e;return t.path?`${t.repo}/${t.path}`:t.repo}_cloneUrl(e){return`https://github.com/${e.repo}.git`}_displayLabel(e){return e.repo}},O$t=class extends HVe{constructor(){super(...arguments);this.kind="url"}getInstallUri(e,t){let o=t,n=this._gitUrlCacheSegments(o.url,o.ref,o.sha);return Ge(e,...n)}getLabel(e){return e.url}_cloneUrl(e){return e.url}_displayLabel(e){return e.url}_gitUrlCacheSegments(e,t,o){try{let n=A.parse(e),r=(n.authority||"unknown").replace(/[\\/:*?"<>|]/g,"_").toLowerCase(),l=n.path.replace(/^\/+/,"").replace(/\.git$/i,"").replace(/\/+$/g,"").split("/").map(c=>c.replace(/[\\/:*?"<>|]/g,"_"));return[r,...l,...ONi(t,o)]}catch{return["git",e.replace(/[\\/:*?"<>|]/g,"_"),...ONi(t,o)]}}},UVe=class{constructor(i,e,t,o,n,r){this._dialogService=i;this._fileService=e;this._logService=t;this._notificationService=o;this._progressService=n;this._terminalService=r}getCleanupTarget(i,e){return this._getCacheDir(i,e)}async ensure(i,e,t){let o=this._getCacheDir(i,e.sourceDescriptor);return await this._fileService.createFolder(o),o}async update(i,e,t){let o=this._getCacheDir(i,e.sourceDescriptor),n=this.getInstallUri(i,e.sourceDescriptor);return await this.runInstall(o,n,e,{silent:t?.silent}),!0}async runInstall(i,e,t,o){let n=this._buildInstallArgs(i,t),r=Cdn(n);if(!await this._confirmTerminalCommand(t.name,r,o?.silent))return;let l=d(7404,null,this._managerName,t.name),{success:c,terminal:u}=await this._runTerminalCommand(r,l);if(!c)return;if(!await this._fileService.exists(e)){this._notificationService.notify({severity:ft.Error,message:d(7405,null,this._managerName,this.getLabel(t.sourceDescriptor))});return}return u?.dispose(),{pluginDir:e}}async _confirmTerminalCommand(i,e,t){if(t)return new Promise(n=>{let r=this._notificationService.notify({severity:ft.Info,message:d(7402,null,i,e),actions:{primary:[new it("installPlugin",d(7403,null),void 0,!0,async()=>n(!0))]}});U.once(r.onDidClose)(()=>n(!1))});let{confirmed:o}=await this._dialogService.confirm({type:"question",message:d(7400,null,i),detail:d(7401,null,e),primaryButton:d(7399,null)});return o}async _runTerminalCommand(i,e){let t;try{return await this._progressService.withProgress({location:15,title:e,cancellable:!1},async()=>{t=await this._terminalService.createTerminal({config:{name:d(7406,null),forceShellIntegration:!0,isTransient:!0,isFeatureTerminal:!0}}),await t.processReady,this._terminalService.setActiveInstance(t);let o=this._waitForTerminalCommandCompletion(t);await t.runCommand(i,!0);let n=await o;if(n!==0)throw new Error(d(7409,null,n))}),{success:!0,terminal:t}}catch(o){return this._logService.error(`[${this.kind}] Terminal command failed:`,o),this._notificationService.notify({severity:ft.Error,message:d(7410,null,o?.message??String(o))}),{success:!1,terminal:t}}}_waitForTerminalCommandCompletion(i){return new Promise(e=>{let t=new N,o=!1,n=l=>{o||(o=!0,t.dispose(),e(l))},r=()=>{let l=i.capabilities.get(2);l&&t.add(l.onCommandFinished(c=>{n(c.exitCode??0)}))};r(),t.add(i.capabilities.onDidAddCommandDetectionCapability(()=>r()));let s=Li(12e4);t.add(Z(()=>s.cancel())),s.then(()=>{o||(this._logService.warn(`[${this.kind}] Terminal command completion timed out`),n(void 0))})})}};UVe=I([m(0,at),m(1,fe),m(2,se),m(3,Ne),m(4,Fo),m(5,nn)],UVe);var F$t=class extends UVe{constructor(){super(...arguments);this.kind="npm";this._managerName="npm"}getInstallUri(e,t){let o=t;return Ge(e,"npm",zVe(o.package),"node_modules",o.package)}getLabel(e){let t=e;return t.version?`${t.package}@${t.version}`:t.package}_getCacheDir(e,t){return Ge(e,"npm",zVe(t.package))}_buildInstallArgs(e,t){let o=t.sourceDescriptor,n=o.version?`${o.package}@${o.version}`:o.package,r=["npm","install","--prefix",e.fsPath,n];return o.registry&&r.push("--registry",o.registry),r}},W$t=class extends UVe{constructor(){super(...arguments);this.kind="pip";this._managerName="pip"}getInstallUri(e,t){return Ge(e,"pip",zVe(t.package))}getLabel(e){let t=e;return t.version?`${t.package}==${t.version}`:t.package}_getCacheDir(e,t){return Ge(e,"pip",zVe(t.package))}_buildInstallArgs(e,t){let o=t.sourceDescriptor,n=o.version?`${o.package}==${o.version}`:o.package,r=["pip","install","--target",e.fsPath,n];return o.registry&&r.push("--index-url",o.registry),r}};var V$t="chat.plugins.marketplaces.index.v1",KVe=class{constructor(i,e,t,o,n,r,s,l){this._commandService=i;this._fileService=t;this._logService=n;this._notificationService=r;this._progressService=s;this._storageService=l;this._marketplaceIndex=new co(()=>this._loadMarketplaceIndex());this._cloneSequencer=new Nx;this.agentPluginsHome=e.agentPluginsHome;let c=Ge(e.cacheHome,"agentPlugins"),u=e.cacheHome.scheme==="file"?c:this.agentPluginsHome;this._cacheRoot=this.agentPluginsHome,Qe(u,this.agentPluginsHome)?this._migrationDone=Promise.resolve():this._migrationDone=this._migrateDirectory(u),this._pluginSources=new Map([["relativePath",new A$t],["github",o.createInstance(N$t)],["url",o.createInstance(O$t)],["npm",o.createInstance(F$t)],["pip",o.createInstance(W$t)]])}getPluginSource(i){let e=this._pluginSources.get(i);if(!e)throw new Error(`No source repository registered for kind '${i}'`);return e}getRepositoryUri(i,e){if(i.kind==="localFileUri"&&i.localRepositoryUri)return i.localRepositoryUri;let t=this._marketplaceIndex.value.get(i.canonicalId);return t?.repositoryUri?t.repositoryUri:this._getRepoCacheDirForReference(i)}getPluginInstallUri(i){let e=this.getRepositoryUri(i.marketplaceReference,i.marketplaceType);return this._getPluginDir(e,i.source)}async ensureRepository(i,e){await this._migrationDone;let t=this.getRepositoryUri(i,e?.marketplaceType);return this._cloneSequencer.queue(t.fsPath,async()=>{if(await this._fileService.exists(t))return this._updateMarketplaceIndex(i,t,e?.marketplaceType),t;if(i.kind==="localFileUri")throw new Error(`Local marketplace repository does not exist: ${t.fsPath}`);let n=e?.progressTitle??d(6006,null,i.displayLabel),r=e?.failureLabel??i.displayLabel;return await this._cloneRepository(t,i.cloneUrl,n,r),this._updateMarketplaceIndex(i,t,e?.marketplaceType),t})}async pullRepository(i,e){let t=this.getRepositoryUri(i,e?.marketplaceType);if(!await this._fileService.exists(t))return this._logService.warn(`[AgentPluginRepositoryService] Cannot update plugin '${e?.pluginName??i.displayLabel}': repository not cloned`),!1;let n=e?.pluginName??i.displayLabel;try{let r=async()=>!!await this._commandService.executeCommand("_git.pull",t.fsPath);return e?.silent?await r():await this._progressService.withProgress({location:15,title:d(6009,null,n),cancellable:!1},r)}catch(r){throw this._logService.error(`[AgentPluginRepositoryService] Failed to update ${i.displayLabel}:`,r),e?.silent||this._notificationService.notify({severity:ft.Error,message:d(6007,null,e?.failureLabel??n,r?.message??String(r)),actions:{primary:[new it("showGitOutput",d(6008,null),void 0,!0,()=>{this._commandService.executeCommand("git.showOutput")})]}}),r}}_getRepoCacheDirForReference(i){return Ge(this._cacheRoot,...i.cacheSegments)}_loadMarketplaceIndex(){let i=new Map,e=this._storageService.getObject(V$t,-1);if(!e)return i;let t=$n(e);for(let[o,n]of Object.entries(t))!n||!n.repositoryUri||i.set(o,{repositoryUri:n.repositoryUri,marketplaceType:n.marketplaceType});return i}_updateMarketplaceIndex(i,e,t){if(i.kind==="localFileUri")return;let o=this._marketplaceIndex.value.get(i.canonicalId);o&&o.repositoryUri.toString()===e.toString()&&o.marketplaceType===t||(this._marketplaceIndex.value.set(i.canonicalId,{repositoryUri:e,marketplaceType:t}),this._saveMarketplaceIndex())}_saveMarketplaceIndex(){let i={};for(let[e,t]of this._marketplaceIndex.value)i[e]=JSON.parse(JSON.stringify({repositoryUri:t.repositoryUri,marketplaceType:t.marketplaceType}));if(Object.keys(i).length===0){this._storageService.remove(V$t,-1);return}this._storageService.store(V$t,JSON.stringify(i),-1,1)}async _cloneRepository(i,e,t,o,n){try{await this._progressService.withProgress({location:15,title:t,cancellable:!1},async()=>{await this._fileService.createFolder(ci(i)),await this._commandService.executeCommand("_git.cloneRepository",e,i.fsPath,n)})}catch(r){throw this._logService.error(`[AgentPluginRepositoryService] Failed to clone ${e}:`,r),this._notificationService.notify({severity:ft.Error,message:d(6005,null,o,r?.message??String(r)),actions:{primary:[new it("showGitOutput",d(6008,null),void 0,!0,()=>{this._commandService.executeCommand("git.showOutput")})]}}),r}}_getPluginDir(i,e){let t=e.trim().replace(/^\.?\/+|\/+$/g,""),o=t?Ge(i,t):i;if(!ws(o,i))throw new Error(`Invalid plugin source path '${e}'`);return o}getPluginSourceInstallUri(i){return this.getPluginSource(i.kind).getInstallUri(this._cacheRoot,i)}async ensurePluginSource(i,e){await this._migrationDone;let t=this.getPluginSource(i.sourceDescriptor.kind);return i.sourceDescriptor.kind==="relativePath"?this.ensureRepository(i.marketplaceReference,e):t.ensure(this._cacheRoot,i,e)}async updatePluginSource(i,e){let t=this.getPluginSource(i.sourceDescriptor.kind);return i.sourceDescriptor.kind==="relativePath"?this.pullRepository(i.marketplaceReference,e):t.update(this._cacheRoot,i,e)}async fetchRepository(i){let e=this.getRepositoryUri(i);if(!await this._fileService.exists(e))return!1;try{return await this._commandService.executeCommand("_git.fetchRepository",e.fsPath),(await this._commandService.executeCommand("_git.revListCount",e.fsPath,"HEAD","@{u}")??0)>0}catch(o){return this._logService.debug(`[AgentPluginRepositoryService] Silent fetch failed for ${i.displayLabel}:`,o),!1}}async cleanupPluginSource(i,e){let o=this.getPluginSource(i.sourceDescriptor.kind).getCleanupTarget(this._cacheRoot,i.sourceDescriptor);if(o){if(e&&e.some(r=>{let l=this.getPluginSource(r.kind).getCleanupTarget(this._cacheRoot,r);return l&&Qe(l,o)})){this._logService.info(`[${i.sourceDescriptor.kind}] Skipping cleanup of shared cache: ${o.toString()}`);return}try{await this._fileService.exists(o)&&(await this._fileService.del(o,{recursive:!0}),this._logService.info(`[${i.sourceDescriptor.kind}] Removed plugin cache: ${o.toString()}`))}catch(n){this._logService.warn(`[${i.sourceDescriptor.kind}] Failed to remove plugin cache '${o.toString()}':`,n)}try{await this._pruneEmptyParents(o)}catch(n){this._logService.warn(`[${i.sourceDescriptor.kind}] Failed to cleanup plugin source:`,n)}}}async _pruneEmptyParents(i){if(!ws(i,this._cacheRoot))return;let e=ci(i);for(;ws(e,this._cacheRoot)&&!Qe(e,this._cacheRoot);){try{let t=await this._fileService.resolve(e);if(t.children&&t.children.length>0)break;await this._fileService.del(e)}catch{break}e=ci(e)}}async _migrateDirectory(i){try{if(!await this._fileService.exists(i))return;if(await this._fileService.exists(this.agentPluginsHome)){this._logService.info("[AgentPluginRepositoryService] Both old and new agent-plugins directories exist; skipping directory migration");return}this._logService.info(`[AgentPluginRepositoryService] Migrating agent plugins from ${i.toString()} to ${this.agentPluginsHome.toString()}`),await this._fileService.move(i,this.agentPluginsHome,!1),this._storageService.remove(V$t,-1),this._marketplaceIndex.value.clear()}catch(e){this._logService.error("[AgentPluginRepositoryService] Directory migration failed",e)}}};KVe=I([m(0,ge),m(1,At),m(2,fe),m(3,F),m(4,se),m(5,Ne),m(6,Fo),m(7,ce)],KVe);var GVe=class{constructor(i,e,t,o,n,r,s,l,c,u){this._pluginRepositoryService=i;this._pluginMarketplaceService=e;this._fileService=t;this._notificationService=o;this._dialogService=n;this._logService=r;this._progressService=s;this._commandService=l;this._quickInputService=c;this._configurationService=u}async installPlugin(i){if(!await this._ensureMarketplaceTrusted(i))return;let e=i.sourceDescriptor.kind;if(e==="relativePath")return this._installRelativePathPlugin(i);if(e==="npm"||e==="pip"){await this._installPackagePlugin(i);return}return this._installGitPlugin(i)}async installPluginFromSource(i,e){let t=Fy(i);if(!t){this._notificationService.notify({severity:ft.Error,message:d(7381,null,i)});return}if(t.kind==="localFileUri"){this._notificationService.notify({severity:ft.Error,message:d(7382,null)});return}let o=await this._doInstallFromSource(t,e);!o.success&&o.message&&this._notificationService.notify({severity:ft.Error,message:o.message})}validatePluginSource(i){let e=Fy(i);if(!e)return d(7381,null,i);if(e.kind==="localFileUri")return d(7382,null)}async installPluginFromValidatedSource(i,e){let t=Fy(i);return t?t.kind==="localFileUri"?{success:!1,message:d(7382,null)}:this._doInstallFromSource(t,e):{success:!1,message:d(7381,null,i)}}async _doInstallFromSource(i,e){let t=i.kind==="githubShorthand"?{kind:"github",repo:i.githubRepo}:{kind:"url",url:i.cloneUrl},o={name:i.displayLabel,description:"",version:"",source:"",sourceDescriptor:t,marketplace:i.displayLabel,marketplaceReference:i,marketplaceType:"openPlugin"};if(!await this._ensureMarketplaceTrusted(o))return{success:!1};let n;try{n=await this._pluginRepositoryService.ensurePluginSource(o,{progressTitle:d(7379,null,i.displayLabel),failureLabel:i.displayLabel,marketplaceType:"openPlugin"})}catch(u){let p=u instanceof Error?u.message:String(u);return{success:!1,message:d(7378,null,i.displayLabel,p)}}if(!await this._fileService.exists(n))return{success:!1,message:d(7377,null,i.displayLabel)};let s=await this._pluginMarketplaceService.readPluginsFromDirectory(n,i);if(s.length===0)return this._pluginRepositoryService.cleanupPluginSource(o),{success:!1,message:d(7383,null,i.displayLabel)};if(e?.plugin){let u=s.find(p=>p.name===e.plugin);return u?(await this._addMarketplaceToConfig(i),await this.installPlugin(u),{success:!0,matchedPlugin:u}):{success:!1,message:d(7386,null,e.plugin,i.displayLabel)}}if(s.length===1)return await this._addMarketplaceToConfig(i),await this.installPlugin(s[0]),{success:!0};let l=s.map(u=>({label:u.name,description:u.description,plugin:u})),c=await this._quickInputService.pick(l,{placeHolder:d(7388,null,i.displayLabel),canPickMany:!1});return c?(await this._addMarketplaceToConfig(i),await this.installPlugin(c.plugin),{success:!0}):{success:!1}}_addMarketplaceToConfig(i){let e=this._configurationService.getValue("chat.plugins.marketplaces")??[];if(!LQ(e).some(o=>o.canonicalId===i.canonicalId))return this._configurationService.updateValue("chat.plugins.marketplaces",[...e,i.rawValue])}async updatePlugin(i,e){let t=i.sourceDescriptor.kind;return t==="npm"||t==="pip"?this._installPackagePlugin(i,e):this._pluginRepositoryService.updatePluginSource(i,{pluginName:i.name,failureLabel:i.name,marketplaceType:i.marketplaceType})}async updateAllPlugins(i,e){let t=this._pluginMarketplaceService.installedPlugins.get();if(t.length===0)return{updatedNames:[],failedNames:[]};let o=[],n=[],r=async()=>{let s=[],l=[],c=new Set;for(let g of t){let f=g.plugin.marketplaceReference;c.has(f.canonicalId)||(c.add(f.canonicalId),s.push((async()=>{if(!e.isCancellationRequested)try{await this._pluginRepositoryService.pullRepository(f,{pluginName:f.displayLabel,failureLabel:f.displayLabel,marketplaceType:g.plugin.marketplaceType,silent:i.silent})&&o.push(f.displayLabel)}catch(v){this._logService.error(`[PluginInstallService] Failed to pull marketplace '${f.displayLabel}':`,v),n.push(f.displayLabel)}})()))}await Promise.all(s);let u=await this._pluginMarketplaceService.fetchMarketplacePlugins(e),p=new Map;for(let g of u)p.set(`${g.marketplaceReference.canonicalId}::${g.name}`,g);let h=[];for(let g of t){if(g.plugin.sourceDescriptor.kind==="relativePath")continue;let f=p.get(`${g.plugin.marketplaceReference.canonicalId}::${g.plugin.name}`);if(!f||!gWe(g.plugin.sourceDescriptor,f.sourceDescriptor))continue;let v=f.sourceDescriptor;if(v.kind==="npm"||v.kind==="pip"){if(!i.force&&!v.version)continue;l.push({installed:g.plugin,marketplace:f});continue}h.push((async()=>{if(!e.isCancellationRequested)try{await this._pluginRepositoryService.updatePluginSource(f,{pluginName:f.name,failureLabel:f.name,marketplaceType:f.marketplaceType,silent:i.silent})&&(o.push(f.name),this._pluginMarketplaceService.addInstalledPlugin(g.pluginUri,f))}catch(b){this._logService.error(`[PluginInstallService] Failed to update plugin '${f.name}':`,b),n.push(f.name)}})())}await Promise.all(h);for(let{installed:g,marketplace:f}of l){if(e.isCancellationRequested)return;try{if(await this.updatePlugin(f,i?.silent)){o.push(f.name);let b=this._pluginRepositoryService.getPluginSourceInstallUri(f.sourceDescriptor);this._pluginMarketplaceService.addInstalledPlugin(b,f)}}catch(v){this._logService.error(`[PluginInstallService] Failed to update plugin '${f.name}':`,v),n.push(f.name)}}};return i.silent?await r():await this._progressService.withProgress({location:15,title:d(7395,null)},r),n.length>0?this._notificationService.notify({severity:ft.Error,message:d(7393,null,n.join(", ")),actions:{primary:[new it("showGitOutput",d(7389,null),void 0,!0,()=>{this._commandService.executeCommand("git.showOutput")})]}}):o.length>0?(this._pluginMarketplaceService.clearUpdatesAvailable(),this._notificationService.notify({severity:ft.Info,message:d(7394,null,o.join(", "))})):e.isCancellationRequested||this._pluginMarketplaceService.clearUpdatesAvailable(),{updatedNames:o,failedNames:n}}getPluginInstallUri(i){return i.sourceDescriptor.kind==="relativePath"?this._pluginRepositoryService.getPluginInstallUri(i):this._pluginRepositoryService.getPluginSourceInstallUri(i.sourceDescriptor)}async _ensureMarketplaceTrusted(i){if(this._pluginMarketplaceService.isMarketplaceTrusted(i.marketplaceReference))return!0;let{confirmed:e}=await this._dialogService.confirm({type:"question",message:d(7391,null,i.marketplaceReference.displayLabel),detail:d(7392,null,i.marketplaceReference.rawValue),primaryButton:d(7390,null),custom:{icon:R.shield}});return e?(this._pluginMarketplaceService.trustMarketplace(i.marketplaceReference),!0):!1}async _installRelativePathPlugin(i){try{await this._pluginRepositoryService.ensureRepository(i.marketplaceReference,{progressTitle:d(7380,null,i.name),failureLabel:i.name,marketplaceType:i.marketplaceType})}catch{return}let e;try{e=this._pluginRepositoryService.getPluginInstallUri(i)}catch{this._notificationService.notify({severity:ft.Error,message:d(7384,null,i.source,i.marketplace)});return}if(!await this._fileService.exists(e)){this._notificationService.notify({severity:ft.Error,message:d(7385,null,i.source,i.marketplace)});return}this._pluginMarketplaceService.addInstalledPlugin(e,i)}async _installGitPlugin(i){let e=this._pluginRepositoryService.getPluginSource(i.sourceDescriptor.kind),t;try{t=await this._pluginRepositoryService.ensurePluginSource(i,{progressTitle:d(7380,null,i.name),failureLabel:i.name,marketplaceType:i.marketplaceType})}catch{return}if(!await this._fileService.exists(t)){this._notificationService.notify({severity:ft.Error,message:d(7387,null,e.getLabel(i.sourceDescriptor))});return}this._pluginMarketplaceService.addInstalledPlugin(t,i)}async _installPackagePlugin(i,e){let t=this._pluginRepositoryService.getPluginSource(i.sourceDescriptor.kind);if(!t.runInstall)return this._logService.error(`[PluginInstallService] Expected package repository for kind '${i.sourceDescriptor.kind}'`),!1;let o=await this._pluginRepositoryService.ensurePluginSource(i),n=this._pluginRepositoryService.getPluginSourceInstallUri(i.sourceDescriptor),r=await t.runInstall(o,n,i,{silent:e});return r?(this._pluginMarketplaceService.addInstalledPlugin(r.pluginDir,i),!0):!1}};GVe=I([m(0,aq),m(1,Zk),m(2,fe),m(3,Ne),m(4,at),m(5,se),m(6,Fo),m(7,ge),m(8,Ue),m(9,B)],GVe);var qst=le("remoteCodingAgentsService"),Gst=class extends x{constructor(e){super();this.contextKeyService=e;this.agents=[];this.contextKeys=new Set;this._ctxHasRemoteCodingAgent=ie.hasRemoteCodingAgent.bindTo(this.contextKeyService),this._register(U.filter(e.onDidChangeContext,t=>t.affectsSome(this.contextKeys))(()=>{this.updateContextKeys()}))}getRegisteredAgents(){return[...this.agents]}getAvailableAgents(){return this.agents.filter(e=>this.isAgentAvailable(e))}registerAgent(e){let t=this.agents.findIndex(o=>o.id===e.id);if(t>=0?this.agents[t]=e:this.agents.push(e),e.when){let o=C.deserialize(e.when);if(o)for(let n of o.keys())this.contextKeys.add(n)}this.updateContextKeys()}isAgentAvailable(e){if(!e.when)return!0;let t=C.deserialize(e.when);return!t||this.contextKeyService.contextMatchesRules(t)}updateContextKeys(){let e=this.getAvailableAgents().length>0;this._ctxHasRemoteCodingAgent.set(e)}};Gst=I([m(0,X)],Gst);Ee(qst,Gst,1);var tne=class extends x{constructor(e,t,o,n,r){super();this._editor=e;this._commandService=t;this._contextKeyService=o;this._remoteCodingAgentService=n;this._promptsService=r;this._isVisible=!1;this._domNode=_(".prompt-coding-agent-action-overlay"),this._button=this._register(new Wi(this._domNode,{supportIcons:!0,title:d(7536,null)})),this._button.element.style.background="var(--vscode-button-background)",this._button.element.style.color="var(--vscode-button-foreground)",this._button.label=d(7537,null,"$(cloud-upload)"),this._register(this._button.onDidClick(async()=>{await this._execute()})),this._register(this._contextKeyService.onDidChangeContext(()=>{this._updateVisibility()})),this._register(this._editor.onDidChangeModel(()=>{this._updateVisibility()})),this._register(this._editor.onDidLayoutChange(()=>{this._isVisible&&this._editor.layoutOverlayWidget(this)})),this._updateVisibility()}static{this.ID="promptCodingAgentActionOverlay"}getId(){return tne.ID}getDomNode(){return this._domNode}getPosition(){return this._isVisible?{preference:1}:null}_updateVisibility(){let e=ie.enableRemoteCodingAgentPromptFileOverlay.getValue(this._contextKeyService),t=ie.hasRemoteCodingAgent.getValue(this._contextKeyService),r=!!(this._editor.getModel()?.getLanguageId()===cT&&e&&t);r!==this._isVisible&&(this._isVisible=r,this._isVisible?this._editor.addOverlayWidget(this):this._editor.removeOverlayWidget(this))}async _execute(){let e=this._editor.getModel();if(e){this._button.enabled=!1;try{let t=e.getValue(),o=await this._promptsService.getPromptSlashCommandName(e.uri,Se.None),r=this._remoteCodingAgentService.getAvailableAgents()[0];if(!r)return;await this._commandService.executeCommand(r.command,{userPrompt:o,summary:t,source:"prompt"})}finally{this._button.enabled=!0}}}dispose(){this._isVisible&&this._editor.removeOverlayWidget(this),super.dispose()}};tne=I([m(1,ge),m(2,X),m(3,qst),m(4,Or)],tne);var qVe=class extends x{constructor(e,t){super();this._editor=e;this._instantiationService=t;this._overlayWidgets=this._register(new Vt);this._register(this._editor.onDidChangeModel(()=>{this._updateOverlayWidget()})),this._updateOverlayWidget()}static{this.ID="promptCodingAgentActionContribution"}_updateOverlayWidget(){let e=this._editor.getModel();if(this._overlayWidgets.deleteAndDispose(this._editor),e&&e.getLanguageId()===cT){let t=this._instantiationService.createInstance(tne,this._editor);this._overlayWidgets.set(this._editor,t)}}};qVe=I([m(1,F)],qVe);xo(qVe.ID,qVe,1);var $st=class extends x{constructor(e,t,o,n){super();this.promptsService=e;this.languageService=t;this.languageModelToolsService=o;this.instantiationService=n;this.cmdId=`_configure/${xt()}`;this._register(this.languageService.codeLensProvider.register(DK,this)),this._register($e.registerCommand(this.cmdId,(r,...s)=>{let[l,c,u,p,h]=s,g=l;d7(g)&&z.isIRange(c)&&Wa(u)&&Array.isArray(p)&&zNt(h)&&this.updateTools(g,z.lift(c),u,p,h)}))}async provideCodeLenses(e,t){let o=Mw(e.getLanguageId());if(!o||o==="instructions")return;let r=this.promptsService.getParsedPromptFile(e).header;if(!r)return;let s=TD(o,r);if(!CZ(s))return;let l=r.getAttribute(io.tools);if(!l)return;let c=l.value;if(c.type==="scalar"&&(c=tH(c)),c.type!=="sequence")return;let p=c.items.filter(g=>g.type==="scalar").map(g=>g.value);return{lenses:[{range:l.range.collapseToStart(),command:{title:d(7538,null),id:this.cmdId,arguments:[e,l.value.range,l.value.type==="scalar",p,s]}}]}}async updateTools(e,t,o,n,r){let s=()=>this.languageModelToolsService.toToolAndToolSetEnablementMap(n,void 0),l=await this.instantiationService.invokeFunction(Jzt,d(7539,null),"codeLens",void 0,s);l&&this.instantiationService.createInstance(MG).rewriteTools(e,l,t,o)}};$st=I([m(0,Or),m(1,Qt),m(2,Vn),m(3,F)],$st);ik($st);var Qfe=class extends x{constructor(e,t,o,n,r,s,l,c,u){super();this.environmentService=u;this._store.add(e.registerSlashCommand({command:"clear",detail:d(7243,null),sortText:"z2_clear",executeImmediately:!0,locations:["panel"]},async(g,f,v,b,S)=>{r.getSession(S)?.setArchived(!0),t.executeCommand(Zm)})),this._store.add(e.registerSlashCommand({command:"hooks",detail:d(7249,null),sortText:"z3_hooks",executeImmediately:!0,silent:!0,locations:["panel"],targets:["vscode"]},async()=>{await n.invokeFunction(B0e)})),this._store.add(e.registerSlashCommand({command:"models",detail:d(7251,null),sortText:"z3_models",executeImmediately:!0,silent:!0,locations:["panel"]},async()=>{await t.executeCommand(Khe.ID)})),this._store.add(e.registerSlashCommand({command:"tools",detail:d(7256,null),sortText:"z3_tools",executeImmediately:!0,silent:!0,locations:["panel"],targets:["vscode"]},async()=>{await t.executeCommand(nge.ID)})),this._store.add(e.registerSlashCommand({command:"plugins",detail:d(7252,null),sortText:"z3_plugins",executeImmediately:!0,silent:!0,locations:["panel"],targets:["vscode"]},async()=>{await t.executeCommand(Krt.ID)})),this.environmentService.isSessionsWindow||this._store.add(e.registerSlashCommand({command:"debug",detail:d(7244,null),sortText:"z3_debug",executeImmediately:!0,silent:!0,locations:["panel"]},async()=>{await t.executeCommand("github.copilot.debug.showChatLogView")})),this._store.add(e.registerSlashCommand({command:"agents",detail:d(7240,null),sortText:"z3_agents",executeImmediately:!0,silent:!0,locations:["panel"],targets:["vscode"]},async()=>{await t.executeCommand(Ute.ID)})),this._store.add(e.registerSlashCommand({command:"skills",detail:d(7255,null),sortText:"z3_skills",executeImmediately:!0,silent:!0,locations:["panel"],targets:["vscode"]},async()=>{await t.executeCommand(NMi)})),this._store.add(e.registerSlashCommand({command:"instructions",detail:d(7250,null),sortText:"z3_instructions",executeImmediately:!0,silent:!0,locations:["panel"],targets:["vscode"]},async()=>{await t.executeCommand(EGt)})),this._store.add(e.registerSlashCommand({command:"prompts",detail:d(7253,null),sortText:"z3_prompts",executeImmediately:!0,silent:!0,locations:["panel"],targets:["vscode"]},async()=>{await t.executeCommand(PMi)})),this._store.add(e.registerSlashCommand({command:"fork",detail:d(7248,null),sortText:"z2_fork",executeImmediately:!0,silent:!0,locations:["panel"],when:C.or(ie.lockedToCodingAgent.negate(),ie.chatSessionSupportsFork)},async(g,f,v,b,S)=>{await t.executeCommand("workbench.action.chat.forkConversation",S)})),this._store.add(e.registerSlashCommand({command:"rename",detail:d(7254,null),sortText:"z2_rename",executeImmediately:!1,silent:!0,locations:["panel"],targets:["vscode"]},async(g,f,v,b,S)=>{let y=g.trim();y&&s.setChatSessionTitle(S,y)}));let p=(g,f)=>{let v=c.getWidgetBySessionResource(g)??c.lastFocusedWidget;v&&v.input.setPermissionLevel(f)};l.inspect("chat.tools.global.autoApprove").policyValue!==!1&&(this._store.add(e.registerSlashCommand({command:"autoApprove",detail:d(7241,null),sortText:"z1_autoApprove",executeImmediately:!0,silent:!0,locations:["panel"],targets:["vscode","github-copilot"]},async(g,f,v,b,S)=>{p(S,"autoApprove")})),this._store.add(e.registerSlashCommand({command:"disableAutoApprove",detail:d(7245,null),sortText:"z1_disableAutoApprove",executeImmediately:!0,silent:!0,locations:["panel"],targets:["vscode","github-copilot"]},async(g,f,v,b,S)=>{p(S,"default")})),this._store.add(e.registerSlashCommand({command:"yolo",detail:d(7257,null),sortText:"z1_yolo",executeImmediately:!0,silent:!0,locations:["panel"],targets:["vscode","github-copilot"]},async(g,f,v,b,S)=>{p(S,"autoApprove")})),this._store.add(e.registerSlashCommand({command:"disableYolo",detail:d(7246,null),sortText:"z1_disableYolo",executeImmediately:!0,silent:!0,locations:["panel"],targets:["vscode","github-copilot"]},async(g,f,v,b,S)=>{p(S,"default")})),l.getValue("chat.autopilot.enabled")!==!1&&(this._store.add(e.registerSlashCommand({command:"autopilot",detail:d(7242,null),sortText:"z1_autopilot",executeImmediately:!0,silent:!0,locations:["panel"],targets:["vscode","github-copilot"]},async(g,f,v,b,S)=>{p(S,"autopilot")})),this._store.add(e.registerSlashCommand({command:"exitAutopilot",detail:d(7247,null),sortText:"z1_exitAutopilot",executeImmediately:!0,silent:!0,locations:["panel"],targets:["vscode","github-copilot"]},async(g,f,v,b,S)=>{p(S,"default")})))),this._store.add(e.registerSlashCommand({command:"help",detail:"",sortText:"z1_help",executeImmediately:!0,locations:["panel"],modes:["ask"],targets:["vscode"]},async(g,f,v,b,S)=>{let y=o.getDefaultAgent("panel"),w=o.getAgents();y?.metadata.helpTextPrefix&&(Ar(y.metadata.helpTextPrefix)?f.report({content:y.metadata.helpTextPrefix,kind:"markdownContent"}):f.report({content:new Ie(y.metadata.helpTextPrefix),kind:"markdownContent"}),f.report({content:new Ie(`

`),kind:"markdownContent"}));let k=(await Promise.all(w.filter(T=>!T.isDefault&&!T.isCore).filter(T=>T.locations.includes("panel")).map(async T=>{let P=T.description?`- ${T.description}`:"",V=`- ${n.invokeFunction(G=>_Di(T,S,!0,G))} ${P}`,H=T.slashCommands.map(G=>{let $=G.description?`- ${G.description}`:"";return`	* ${Uvo(T,G,S)} ${$}`}).join(`
`);return(V+`
`+H).trim()}))).join(`
`);f.report({content:new Ie(k,{isTrusted:{enabledCommands:[BT.ID]}}),kind:"markdownContent"}),y?.metadata.helpTextPostfix&&(f.report({content:new Ie(`

`),kind:"markdownContent"}),Ar(y.metadata.helpTextPostfix)?f.report({content:y.metadata.helpTextPostfix,kind:"markdownContent"}):f.report({content:new Ie(y.metadata.helpTextPostfix),kind:"markdownContent"})),await Li(200)}))}static{this.ID="workbench.contrib.chatSlashCommands"}};Qfe=I([m(0,BF),m(1,ge),m(2,cr),m(3,F),m(4,md),m(5,mi),m(6,B),m(7,Pt),m(8,At)],Qfe);var Yfe=class extends x{constructor(e,t,o,n,r,s,l,c,u){super();this._pluginInstallService=t;this._dialogService=o;this._configurationService=n;this._extensionsWorkbenchService=r;this._hostService=s;this._logService=l;this._editorService=c;this._instantiationService=u;this._register(e.registerHandler(this))}static{this.ID="workbench.contrib.pluginUrlHandler"}async handleURL(e){if(e.authority!=="chat-plugin")return!1;switch(e.path){case"/install":return this._handleInstall(e);case"/add-marketplace":return this._handleAddMarketplace(e);default:return!1}}async _handleInstall(e){let t=this._decodeQueryParam(e,"source");if(!t)return this._logService.warn('[PluginUrlHandler] Missing or invalid "source" query parameter'),!0;let o=Fy(t);if(!o)return this._logService.warn(`[PluginUrlHandler] Invalid plugin source: ${t}`),!0;if(o.kind==="localFileUri")return this._logService.warn("[PluginUrlHandler] Local file URIs are not supported for install"),!0;await this._hostService.focus(ut);let n=this._decodeStringParam(e,"plugin");if(n)return this._handleInstallTargetedPlugin(t,o.displayLabel,n);let{confirmed:r}=await this._dialogService.confirm({type:"question",message:d(7415,null,o.displayLabel),detail:d(7416,null,o.rawValue),primaryButton:d(7417,null),custom:{icon:R.shield}});return r&&(await this._pluginInstallService.installPluginFromSource(t),this._extensionsWorkbenchService.openSearch(`@agentPlugins ${o.displayLabel}`)),!0}async _handleInstallTargetedPlugin(e,t,o){let n=await this._pluginInstallService.installPluginFromValidatedSource(e,{plugin:o});if(!n.success)return n.message&&this._logService.warn(`[PluginUrlHandler] ${n.message}`),this._extensionsWorkbenchService.openSearch(`@agentPlugins ${t}`),!0;if(!n.matchedPlugin)return this._extensionsWorkbenchService.openSearch(`@agentPlugins ${t}`),!0;let r=n.matchedPlugin,s={kind:"marketplace",name:r.name,description:r.description,source:r.source,sourceDescriptor:r.sourceDescriptor,marketplace:r.marketplace,marketplaceReference:r.marketplaceReference,marketplaceType:r.marketplaceType,readmeUri:r.readmeUri},l=this._instantiationService.createInstance(lq,s);return await this._editorService.openEditor(l),!0}async _handleAddMarketplace(e){let t=this._decodeQueryParam(e,"ref");if(!t)return this._logService.warn('[PluginUrlHandler] Missing or invalid "ref" query parameter'),!0;let o=Fy(t);if(!o)return this._logService.warn(`[PluginUrlHandler] Invalid marketplace reference: ${t}`),!0;await this._hostService.focus(ut);let{confirmed:n}=await this._dialogService.confirm({type:"question",message:d(7413,null,o.displayLabel),detail:d(7414,null,o.rawValue),primaryButton:d(7412,null),custom:{icon:R.shield}});if(!n)return!0;let r=this._configurationService.getValue("chat.plugins.marketplaces")??[];return LQ(r).some(l=>l.canonicalId===o.canonicalId)||await this._configurationService.updateValue("chat.plugins.marketplaces",[...r,t],2),this._extensionsWorkbenchService.openSearch(`@agentPlugins ${o.displayLabel}`),!0}_decodeQueryParam(e,t){let n=new URLSearchParams(e.query).get(t);if(!n)return;let r=this._tryBase64Decode(n);return r&&Fy(r)?r:Fy(n)?n:void 0}_decodeStringParam(e,t){return new URLSearchParams(e.query).get(t)??void 0}_tryBase64Decode(e){try{return qa(e).toString()||void 0}catch{return}}};Yfe=I([m(0,_b),m(1,Oy),m(2,at),m(3,B),m(4,Hi),m(5,Zt),m(6,se),m(7,ee),m(8,F)],Yfe);var Xfe=class extends x{constructor(e,t,o,n,r,s,l,c,u){super();this.notificationService=t;this.requestService=o;this.instantiationService=n;this.fileService=r;this.openerService=s;this.logService=l;this.dialogService=c;this.hostService=u;this._register(e.registerHandler(this))}static{this.ID="workbench.contrib.promptUrlHandler"}async handleURL(e){let t;switch(e.path){case"chat-prompt/install":t="prompt";break;case"chat-instructions/install":t="instructions";break;case"chat-mode/install":case"chat-agent/install":t="agent";break;default:return!1}try{let o=decodeURIComponent(e.query);if(!o||!o.startsWith("url="))return!0;let n=o.substring(4),r=A.parse(n);if(r.scheme!==Q.https&&r.scheme!==Q.http)return this.logService.error(`[PromptUrlHandler] Invalid URL: ${n}`),!0;if(await this.hostService.focus(ut),await this.shouldBlockInstall(t,r))return!0;let s=await this.requestService.request({type:"GET",url:n,callSite:"promptUrlHandler.resolveUrl"},Se.None);if(s.res.statusCode!==200)return this.logService.error(`[PromptUrlHandler] Failed to fetch URL: ${n}`),this.notificationService.error(d(7545,null,n)),!0;let l=(await tb(s.stream)).toString(),c=await this.instantiationService.invokeFunction(wQ,t);if(!c)return!0;let u=await this.instantiationService.invokeFunction(poe,t,c.uri,wf(r));if(!u)return!0;let p=A.joinPath(c.uri,u);return await this.fileService.createFolder(c.uri),await this.fileService.createFile(p,qe.fromString(l)),await this.openerService.open(p),!0}catch(o){return this.logService.error(`Error handling prompt URL ${e.toString()}`,o),!0}}async shouldBlockInstall(e,t){let o=t.toString();o.length>50&&(o=`${o.substring(0,35)}...${o.substring(o.length-15)}`);let n=new Ie("",{supportHtml:!0});n.appendMarkdown(d(7543,null,`[${o}](${t.toString()})`)),n.appendMarkdown(d(7544,null));let r;switch(e){case"prompt":r=d(7542,null);break;case"instructions":r=d(7541,null);break;default:r=d(7540,null);break}let{confirmed:s}=await this.dialogService.confirm({type:"warning",primaryButton:d(7547,null),cancelButton:d(7546,null),message:r,custom:{markdownDetails:[{markdown:n}]}});return!s}};Xfe=I([m(0,_b),m(1,Ne),m(2,Ea),m(3,F),m(4,fe),m(5,Je),m(6,se),m(7,at),m(8,Zt)],Xfe);var xdn={type:"object",additionalProperties:!1,required:["icon","title","contents","when"],properties:{icon:{type:"string",description:d(7650,null)},title:{type:"string",description:d(7651,null)},content:{type:"string",description:d(7649,null)},when:{type:"string",description:d(7652,null)}}},kdn=Rn.registerExtensionPoint({extensionPoint:"chatViewsWelcome",jsonSchema:{description:d(7653,null),type:"array",items:xdn}}),Jfe=class{constructor(i){this.logService=i;kdn.setHandler((e,t)=>{for(let o of t.added)for(let n of o.value){EQe(o.description,"chatParticipantPrivate");let r=C.deserialize(n.when);if(!r){this.logService.error(`Could not deserialize 'when' clause for chatViewsWelcome contribution: ${n.when}`);continue}let s={...n,when:r,icon:q.fromString(n.icon),content:new Ie(n.content,{isTrusted:!0})};ne.as("workbench.registry.chat.viewsWelcome").register(s)}})}static{this.ID="workbench.contrib.chatViewsWelcomeHandler"}};Jfe=I([m(0,se)],Jfe);var $Ve=class extends x{constructor(e,t,o,n,r,s){super();this.editorGroupsService=e;this.viewsService=t;this.quickChatService=o;this.layoutService=n;this.editorService=r;this.chatService=s;this._widgets=[];this._lastFocusedWidget=void 0;this._onDidAddWidget=this._register(new E);this.onDidAddWidget=this._onDidAddWidget.event;this._onDidBackgroundSession=this._register(new E);this.onDidBackgroundSession=this._onDidBackgroundSession.event;this._onDidChangeFocusedWidget=this._register(new E);this.onDidChangeFocusedWidget=this._onDidChangeFocusedWidget.event;this._onDidChangeFocusedSession=this._register(new E);this.onDidChangeFocusedSession=this._onDidChangeFocusedSession.event}get lastFocusedWidget(){return this._lastFocusedWidget}getAllWidgets(){return this._widgets}getWidgetsByLocations(e){return this._widgets.filter(t=>t.location===e)}getWidgetByInputUri(e){return this._widgets.find(t=>Qe(t.input.inputUri,e))}getWidgetBySessionResource(e){return this._widgets.find(t=>Qe(t.viewModel?.sessionResource,e))}async revealWidget(e){let t=this.lastFocusedWidget;return t&&await this.reveal(t,e)?t:(await this.viewsService.openView(Dr,!e))?.widget}async reveal(e,t){if(e.viewModel?.sessionResource&&await this.revealSessionIfAlreadyOpen(e.viewModel.sessionResource,{preserveFocus:t}))return!0;if(py(e.viewContext)){let o=await this.viewsService.openView(e.viewContext.viewId,!t);return t||o?.focus(),!!o}return!1}async openSession(e,t,o){if(typeof t>"u"||o?.revealIfOpened){let r=await this.revealSessionIfAlreadyOpen(e,o);if(r)return r}else await this.prepareSessionForMove(e,t);if(t===rD||typeof t>"u"){let r=await this.viewsService.openView(Dr,!o?.preserveFocus);return r&&(await r.loadSession(e),o?.preserveFocus||r.focusInput()),r?.widget}let n=await this.editorService.openEditor({resource:e,options:{...o,revealIfOpened:o?.revealIfOpened??!0}},t);return n instanceof IN?n.widget:void 0}async revealSessionIfAlreadyOpen(e,t){let o=this.viewsService.getViewWithId(Dr);if(o?.widget.viewModel?.sessionResource&&Qe(o.widget.viewModel.sessionResource,e)){let r=await this.viewsService.openView(Dr,!t?.preserveFocus);return t?.preserveFocus||r?.focus(),o.widget}let n=this.findExistingChatEditorByUri(e);if(n){let r=n.group.windowId,s=()=>Re(this.layoutService.activeContainer).vscodeWindowId===r,l;!s()&&!t?.preserveFocus&&(l=U.toPromise(U.once(U.filter(this.layoutService.onDidChangeActiveContainer,s))));let c=await n.group.openEditor(n.editor,t);return await l,c instanceof IN?c.widget:void 0}if(Qe(e,this.quickChatService.sessionResource)){this.quickChatService.focus();return}}async prepareSessionForMove(e,t){let o=this.getWidgetBySessionResource(e);if(o){let n=py(o.viewContext)?void 0:this.findExistingChatEditorByUri(e);if(py(o.viewContext)&&t===rD||!py(o.viewContext)&&t!==rD&&n&&this.isSameEditorTarget(n.group.id,t))return;n?await this.editorService.closeEditor({editor:n.editor,groupId:n.group.id},{preserveFocus:!0}):await o.clear()}}findExistingChatEditorByUri(e){for(let t of this.editorGroupsService.groups)for(let o of t.editors)if(o instanceof Na&&Qe(o.sessionResource,e))return{editor:o,group:t}}isSameEditorTarget(e,t){return typeof t=="number"&&t===e||t===jn&&this.editorGroupsService.activeGroup?.id===e||zde(t)&&t.id===e}setLastFocusedWidget(e){e!==this._lastFocusedWidget&&(this._lastFocusedWidget=e,this._onDidChangeFocusedWidget.fire(e),this._onDidChangeFocusedSession.fire())}register(e){if(this._widgets.some(t=>t===e))throw new Error("Cannot register the same widget multiple times");return this._widgets.push(e),this._onDidAddWidget.fire(e),this._lastFocusedWidget||this.setLastFocusedWidget(e),wn(e.onDidFocus(()=>this.setLastFocusedWidget(e)),e.onDidChangeViewModel(({previousSessionResource:t,currentSessionResource:o})=>{this._lastFocusedWidget===e&&!Qe(t,o)&&this._onDidChangeFocusedSession.fire(),!(!t||o&&Qe(t,o))&&Li(200).then(()=>{!this.getWidgetBySessionResource(t)&&this.chatService.getSession(t)&&this._onDidBackgroundSession.fire(t)})}),Z(()=>{this._widgets.splice(this._widgets.indexOf(e),1),this._lastFocusedWidget===e&&this.setLastFocusedWidget(void 0)}))}};$Ve=I([m(0,wt),m(1,$t),m(2,sD),m(3,Kl),m(4,ee),m(5,mi)],$Ve);var Zfe=class extends x{constructor(e,t,o,n){super();this._chatService=e;this._chatWidgetService=t;this._hostService=o;this._configurationService=n;this._activeNotifications=this._register(new Xb);let r=this._register(new Xb);this._register(aae(s=>this._chatService.chatModels.read(s),({addedValues:s,removedValues:l})=>{for(let c of s)r.set(c.sessionResource,this._trackModel(c));for(let c of l)r.deleteAndDispose(c.sessionResource)}))}static{this.ID="workbench.contrib.chatWindowNotifier"}_trackModel(e){return sae(e.requestNeedsInput,({lastValue:t,newValue:o})=>{let n=!!o,r=!!t;!r&&n&&o?this._notifyIfNeeded(e.sessionResource,o):r&&!n&&this._clearNotification(e.sessionResource)})}async _notifyIfNeeded(e,t){let o=this._configurationService.getValue("chat.notifyWindowOnConfirmation");if(o==="off")return;let n=this._chatWidgetService.getWidgetBySessionResource(e),r=n?Re(n.domNode):ut,s=r.document.hasFocus();if(o!=="always"&&s)return;this._clearNotification(e),s||await this._hostService.focus(r,{mode:1});let l=t.title?d(7354,null,t.title):d(7353,null),c=new Ye;this._activeNotifications.set(e,Z(()=>c.dispose(!0)));let u=this._isQuestionCarouselPending(e);try{let p=u?d(7356,null):d(7352,null),h=await this._hostService.showToast({title:this._sanitizeOSToastText(l),body:this._getNotificationBody(e,t,u),actions:[p]},c.token);if(h.actionIndex===0&&!u&&this._confirmAllow(e))return;(h.clicked||typeof h.actionIndex=="number")&&(await this._hostService.focus(r,{mode:2}),(await this._chatWidgetService.openSession(e))?.focusInput())}finally{this._clearNotification(e)}}_confirmAllow(e){let o=this._chatService.getSession(e)?.lastRequest?.response;if(!o)return!1;for(let n of o.response.value){let r=n.kind==="toolInvocation"?n.state.get():void 0;if(r?.type===Pi.StateKind.WaitingForConfirmation||r?.type===Pi.StateKind.WaitingForPostApproval)return r.confirm({type:4}),!0}return!1}_getNotificationBody(e,t,o){if(o)return d(7357,null);let n=this._getPendingTerminalCommand(e);return n?this._sanitizeOSToastText(n):t.detail?this._sanitizeOSToastText(t.detail):d(7355,null)}_getPendingTerminalCommand(e){let o=this._chatService.getSession(e)?.lastRequest?.response;if(o?.response?.value){for(let n of o.response.value)if(n.kind==="toolInvocation"&&n.toolSpecificData?.kind==="terminal"){let r=iM(n.toolSpecificData);return r.commandLine.forDisplay??r.commandLine.userEdited??r.commandLine.toolEdited??r.commandLine.original}}}_isQuestionCarouselPending(e){let o=this._chatService.getSession(e)?.lastRequest?.response;return o?o.response.value.some(n=>n.kind==="questionCarousel"&&!n.isUsed):!1}_sanitizeOSToastText(e){return e.replace(/`/g,"'")}_clearNotification(e){this._activeNotifications.deleteAndDispose(e)}};Zfe=I([m(0,mi),m(1,Pt),m(2,Zt),m(3,B)],Zfe);var Edn=100,Tdn=900*1024,Xxo=1*1024*1024,_dn=/^\s*url\s*=\s*(.+\S)\s*$/mg;function Ddn(a){let i=[],e;for(;e=_dn.exec(a);)i.push(e[1]);return i}function Ldn(a){try{return new URL(a).hostname.toLowerCase()}catch{let i=a.lastIndexOf("@"),e=i!==-1?a.slice(i+1):a,t=e.indexOf(":");if(t!==-1){let n=e.slice(0,t);return n?n.toLowerCase():void 0}let o=e.indexOf("/");if(o!==-1){let n=e.slice(0,o);return n?n.toLowerCase():void 0}return}}function Rdn(a,i){let e=a.contextValue?.toLowerCase()??"",t=i.toLowerCase();return e.includes("untracked")||e.includes("add")?"added":e.includes("delete")?"deleted":e.includes("rename")?"renamed":t.includes("untracked")?"added":a.decorations.strikeThrough?"deleted":a.multiDiffEditorOriginalUri?"modified":"added"}async function Mdn(a,i,e,t,o){try{let n="",r="";if(e&&o!=="added")try{let f=await a.readFile(e,{limits:{size:Xxo}});if(OTe({buffer:f.value,bytesRead:f.value.byteLength}).seemsBinary)return;n=f.value.toString()}catch(f){if(f instanceof ta&&f.fileOperationResult===7||o==="modified")return}if(o!=="deleted")try{let f=await a.readFile(t,{limits:{size:Xxo}});if(OTe({buffer:f.value,bytesRead:f.value.byteLength}).seemsBinary)return;r=f.value.toString()}catch(f){return f instanceof ta&&f.fileOperationResult===7,void 0}let s=n.split(`
`),l=r.split(`
`),c=n.length>0&&n.endsWith(`
`),u=r.length>0&&r.endsWith(`
`);c&&s.length>0&&s[s.length-1]===""&&s.pop(),u&&l.length>0&&l[l.length-1]===""&&l.pop();let p=[],h=o==="added"?"/dev/null":`a/${i}`,g=o==="deleted"?"/dev/null":`b/${i}`;if(p.push(`--- ${h}`),p.push(`+++ ${g}`),o==="added"){if(l.length>0){p.push(`@@ -0,0 +1,${l.length} @@`);for(let f of l)p.push(`+${f}`);u||p.push("\\ No newline at end of file")}}else if(o==="deleted"){if(s.length>0){p.push(`@@ -1,${s.length} +0,0 @@`);for(let f of s)p.push(`-${f}`);c||p.push("\\ No newline at end of file")}}else{let f=Pdn(s,l,c,u);for(let v of f)p.push(v)}return p.join(`
`)}catch{return}}function Pdn(a,i,e,t){let n=[],s=W1.getDefault().computeDiff(a,i,{ignoreTrimWhitespace:!1,maxComputationTimeMs:1e3,computeMoves:!1});if(s.changes.length===0)return n;let l=[],c=[];for(let u of s.changes)if(c.length===0)c.push(u);else{let h=c[c.length-1].original.endLineNumberExclusive-1+3;u.original.startLineNumber-3<=h+1?c.push(u):(l.push(c),c=[u])}c.length>0&&l.push(c);for(let u of l){let p=u[0],h=u[u.length-1],g=Math.max(1,p.original.startLineNumber-3),f=Math.min(a.length,h.original.endLineNumberExclusive-1+3),v=Math.max(1,p.modified.startLineNumber-3),b=[],S=-1,y=-1,w=g,k=0,T=0;for(let P of u){let O=P.original.startLineNumber,V=P.original.endLineNumberExclusive,H=P.modified.startLineNumber,G=P.modified.endLineNumberExclusive;for(;w<O;){let $=b.length;b.push(` ${a[w-1]}`),w===a.length&&(S=$),v+T===i.length&&(y=$),w++,k++,T++}for(let $=O;$<V;$++){let J=b.length;b.push(`-${a[$-1]}`),$===a.length&&(S=J),w++,k++}for(let $=H;$<G;$++){let J=b.length;b.push(`+${i[$-1]}`),$===i.length&&(y=J),T++}}for(;w<=f;){let P=b.length;b.push(` ${a[w-1]}`),w===a.length&&(S=P),v+T===i.length&&(y=P),w++,k++,T++}n.push(`@@ -${g},${k} +${v},${T} @@`);for(let P=0;P<b.length;P++){n.push(b[P]);let O=P===S,V=P===y;O&&V?(!e||!t)&&n.push("\\ No newline at end of file"):(O&&!e||V&&!t)&&n.push("\\ No newline at end of file")}}return n}function Adn(a){let i=[...a.repositories];if(i.length===0)return;let e=i[0];if(!e.provider.rootUri)return;let o,n,r,s,l,c=e.provider.historyProvider?.get();if(c){let h=c.historyItemRef.get();o=h?.name,n=h?.revision;let g=c.historyItemRemoteRef.get();g&&(r=g.name,s=g.revision);let f=c.historyItemBaseRef.get();f&&(l=f.name)}let u,p;return r||s||l?(u="remote-git",r?n&&s&&n===s?p="synced":p="unpushed":p="unpublished"):(u="local-git",p="local-only"),{workspaceType:u,syncStatus:p,localBranch:o,remoteTrackingBranch:r,remoteBaseBranch:l,localHeadCommit:n,remoteHeadCommit:s,diffsStatus:"notCaptured"}}async function FNi(a,i){let e=[...a.repositories];if(e.length===0)return;let t=e[0],o=t.provider.rootUri;if(!o)return;let n=!1;try{let O=o.with({path:`${o.path}/.git`});n=await i.exists(O)}catch{}if(!n)return{workspaceType:"plain-folder",syncStatus:"no-git",diffs:void 0};let r;try{let O=o.with({path:`${o.path}/.git/config`});if(await i.exists(O)){let H=await i.readFile(O);r=Ddn(H.value.toString())[0]}}catch{}let s,l,c,u,p,h=t.provider.historyProvider?.get();if(h){let O=h.historyItemRef.get();s=O?.name,l=O?.revision;let V=h.historyItemRemoteRef.get();V&&(c=V.name,u=V.revision);let H=h.historyItemBaseRef.get();H&&(p=H.name)}let g,f;r?(g="remote-git",c?l===u?f="synced":f="unpushed":f="unpublished"):(g="local-git",f="local-only");let v;if(r){let O=Ldn(r);O==="github.com"?v="github":O==="dev.azure.com"||O&&O.endsWith(".visualstudio.com")?v="ado":v="other"}let b=0;for(let O of t.provider.groups)b+=O.resources.length;let S={workspaceType:g,syncStatus:f,remoteUrl:r,remoteVendor:v,localBranch:s,remoteTrackingBranch:c,remoteBaseBranch:p,localHeadCommit:l,remoteHeadCommit:u};if(b===0)return{...S,diffs:void 0,diffsStatus:"noChanges",changedFileCount:0};if(b>Edn)return{...S,diffs:void 0,diffsStatus:"tooManyChanges",changedFileCount:b};let y=[],w=[];for(let O of t.provider.groups)for(let V of O.resources){let H=Wd(o,V.sourceUri)??V.sourceUri.path,G=Rdn(V,O.id),$=(async()=>{let J=await Mdn(i,H,V.multiDiffEditorOriginalUri,V.sourceUri,G);return{relativePath:H,changeType:G,status:O.label||O.id,unifiedDiff:J}})();w.push($)}let k=await Promise.all(w);for(let O of k)O&&y.push(O);let T=JSON.stringify(y);return new TextEncoder().encode(T).length>Tdn?{...S,diffs:void 0,diffsStatus:"tooLarge",changedFileCount:b}:{...S,diffs:y,diffsStatus:"included",changedFileCount:b}}var eve=class extends x{constructor(e,t,o,n,r){super();this.chatService=e;this.chatEntitlementService=t;this.scmService=o;this.logService=n;this.configurationService=r;this._configurationRegistered=!1;this.registerConfigurationIfInternal(),this._register(this.chatEntitlementService.onDidChangeEntitlement(()=>{this.registerConfigurationIfInternal()})),this._register(this.chatService.onDidSubmitRequest(({chatSessionResource:s})=>{let l=this.chatService.getSession(s);l&&this.captureAndSetRepoMetadata(l)}))}static{this.ID="workbench.contrib.chatRepoInfo"}registerConfigurationIfInternal(){if(this._configurationRegistered||!this.chatEntitlementService.isInternal)return;ne.as(Jt.Configuration).registerConfiguration({id:"chatRepoInfo",title:d(7128,null),type:"object",properties:{"chat.repoInfo.enabled":{type:"boolean",description:d(7127,null),default:!1}}}),this._configurationRegistered=!0,this.logService.debug("[ChatRepoInfo] Configuration registered for internal user")}captureAndSetRepoMetadata(e){if(this.chatEntitlementService.isInternal&&this.configurationService.getValue("chat.repoInfo.enabled")&&!e.repoData)try{let t=Adn(this.scmService);t?(e.setRepoData(t),t.localHeadCommit||this.logService.warn("[ChatRepoInfo] Captured repo metadata without commit hash - git history may not be ready")):this.logService.debug("[ChatRepoInfo] No SCM repository available for chat session")}catch(t){this.logService.warn("[ChatRepoInfo] Failed to capture repo metadata:",t)}}};eve=I([m(0,mi),m(1,rr),m(2,rd),m(3,se),m(4,B)],eve);var jst=class extends wl{constructor(e,t,o,n,r,s,l,c){super(void 0,e);this.commandService=o;this.configurationService=n;this._altKeyPressed=!1;let u=this._isSteerDefault();this._primaryActionAction=this._register(new it("chat.queuePickerPrimary",u?d(8012,null):d(8007,null),q.asClassName(u?R.arrowUp:R.add),!!l.getContextKeyValue(ie.inputHasText.key),()=>this._runDefaultAction())),this._primaryAction=this._register(new hs(void 0,this._primaryActionAction,{icon:!0,label:!1})),this._register(l.onDidChangeContext(h=>{this._primaryActionAction.enabled=!!l.getContextKeyValue(ie.inputHasText.key)}));let p=this._register(new it("chat.queuePickerDropdown",d(8009,null)));this._dropdown=this._register(new WNi(p,{actionProvider:{getActions:()=>this._getDropdownActions()},showItemKeybindings:!0},r,s,l,c)),this._register(this.configurationService.onDidChangeConfiguration(h=>{h.affectsConfiguration("chat.requestQueuing.defaultAction")&&this._updatePrimaryAction()})),this._register(nb.getInstance().event(h=>{this._altKeyPressed!==h.altKey&&(this._altKeyPressed=h.altKey,this._updatePrimaryAction())}))}_isSteerDefault(){return this.configurationService.getValue("chat.requestQueuing.defaultAction")==="steer"}_isEffectiveSteer(){let e=this._isSteerDefault();return this._altKeyPressed?!e:e}_updatePrimaryAction(){let e=this._isEffectiveSteer();this._primaryActionAction.label=e?d(8012,null):d(8007,null),this._primaryActionAction.class=q.asClassName(e?R.arrowUp:R.add)}_runDefaultAction(){let e=this._isEffectiveSteer()?Ioe.ID:Soe.ID;this.commandService.executeCommand(e)}render(e){super.render(e),e.classList.add("monaco-dropdown-with-default");let t=_(".action-container");this._primaryAction.render(M(e,t)),this._register(j(t,re.KEY_DOWN,n=>{let r=new gi(n);r.equals(17)&&(this._primaryAction.blur(),this._dropdown.focus(),r.stopPropagation())}));let o=_(".dropdown-action-container");this._dropdown.render(M(e,o)),this._register(j(o,re.KEY_DOWN,n=>{let r=new gi(n);r.equals(15)&&(this._dropdown.setFocusable(!1),this._primaryAction.focus(),r.stopPropagation())}))}focus(e){e?this._dropdown.focus():this._primaryAction.focus()}blur(){this._primaryAction.blur(),this._dropdown.blur()}setFocusable(e){this._primaryAction.setFocusable(e),this._dropdown.setFocusable(e)}_getDropdownActions(){let e=this._isSteerDefault(),t={id:Soe.ID,label:d(8007,null),tooltip:"",enabled:!0,checked:!e,icon:R.add,class:void 0,hover:{content:d(8008,null)},run:()=>{this.commandService.executeCommand(Soe.ID)}},o={id:Ioe.ID,label:d(8012,null),tooltip:"",enabled:!0,checked:e,icon:R.arrowUp,class:void 0,hover:{content:d(8013,null)},run:()=>{this.commandService.executeCommand(Ioe.ID)}};return[{id:"_"+BT.ID,label:d(8010,null),tooltip:"",enabled:!0,icon:R.arrowRight,class:void 0,hover:{content:d(8011,null)},run:()=>{this.commandService.executeCommand(BT.ID)}},t,o]}};jst=I([m(2,ge),m(3,B),m(4,td),m(5,_e),m(6,X),m(7,Te)],jst);var WNi=class extends aW{renderLabel(i){return i.classList.add("codicon","codicon-chevron-down"),null}},tve=class extends x{static{this.ID="chat.queuePickerRendering"}constructor(i){super(),this._register(i.register(D.ChatExecute,D.ChatExecuteQueue,(e,t,o)=>{if(e instanceof Nc)return o.createInstance(jst,e,t)}))}};tve=I([m(0,Zx)],tve);var VNi={label:d(8717,null),order:Number.MAX_SAFE_INTEGER};var Ndn=ne.as(Jt.Configuration);function jVe(){return{modelIds:[""],modelLabels:[d(7366,null)],modelDescriptions:[d(7367,null)]}}var xq=class extends x{constructor(e,t,o,n){super();this._arrays=e;this._options=t;this._languageModelsService=o;this._logService=n;this._register(o.onDidChangeLanguageModels(()=>this._updateModelValues())),this._updateModelValues()}_updateModelValues(){let{modelIds:e,modelLabels:t,modelDescriptions:o}=this._arrays,{configKey:n,configSectionId:r,logPrefix:s,filter:l}=this._options;try{e.length=0,t.length=0,o.length=0,e.push(""),t.push(d(7366,null)),o.push(d(7367,null));let c=[],u=this._languageModelsService.getLanguageModelIds();for(let h of u)try{let g=this._languageModelsService.lookupLanguageModel(h);g?c.push({identifier:h,metadata:g}):this._logService.warn(`${s} No metadata found for model ID: ${h}`)}catch(g){this._logService.error(`${s} Error looking up model ${h}:`,g)}let p=c.filter(h=>!(!h.metadata?.isUserSelectable||l&&!l(h.metadata)));p.sort((h,g)=>{let f=h.metadata.modelPickerCategory??VNi,v=g.metadata.modelPickerCategory??VNi;return f.order!==v.order?f.order-v.order:h.metadata.name.localeCompare(g.metadata.name)});for(let h of p)try{let g=nD.asQualifiedName(h.metadata);e.push(g),t.push(h.metadata.name),o.push(h.metadata.tooltip??h.metadata.detail??"")}catch(g){this._logService.error(`${s} Error adding model ${h.metadata.name}:`,g)}r&&Ndn.notifyConfigurationSchemaUpdated({id:r,properties:{[n]:{}}})}catch(c){this._logService.error(`${s} Error updating model values:`,c)}}};xq=I([m(2,ds),m(3,se)],xq);var B$t=jVe(),kq=class extends xq{static{this.ID="workbench.contrib.exploreAgentDefaultModel"}static{this.modelIds=B$t.modelIds}static{this.modelLabels=B$t.modelLabels}static{this.modelDescriptions=B$t.modelDescriptions}constructor(i,e){super(B$t,{configKey:"chat.exploreAgent.defaultModel",configSectionId:"chatSidebar",logPrefix:"[ExploreAgentDefaultModel]",filter:t=>!!t.capabilities?.toolCalling},i,e)}};kq=I([m(0,ds),m(1,se)],kq);It(kq.ID,kq,St.BlockRestore);var H$t=jVe(),Eq=class extends xq{static{this.ID="workbench.contrib.planAgentDefaultModel"}static{this.modelIds=H$t.modelIds}static{this.modelLabels=H$t.modelLabels}static{this.modelDescriptions=H$t.modelDescriptions}constructor(i,e){super(H$t,{configKey:"chat.planAgent.defaultModel",configSectionId:"chatSidebar",logPrefix:"[PlanAgentDefaultModel]",filter:t=>!!t.capabilities?.toolCalling},i,e)}};Eq=I([m(0,ds),m(1,se)],Eq);It(Eq.ID,Eq,St.BlockRestore);var BNi=[],HNi=[],eko=ne.as(ma.JSONContribution);eko.registerSchema(rfi,xoo);var UNi=ne.as(Jt.Configuration);UNi.registerConfiguration({id:"chatSidebar",title:d(6699,null),type:"object",properties:{"chat.experimentalSessionsWindowOverride":{type:"boolean",description:d(6578,null),default:!1,tags:["experimental"]},"chat.fontSize":{type:"number",description:d(6583,null),default:13,minimum:6,maximum:100},"chat.fontFamily":{type:"string",description:d(6582,null),default:"default"},"chat.editor.fontSize":{type:"number",description:d(6695,null),default:Ze?12:14},"chat.editor.fontFamily":{type:"string",description:d(6694,null),default:"default"},"chat.editor.fontWeight":{type:"string",description:d(6696,null),default:"default"},"chat.editor.wordWrap":{type:"string",description:d(6698,null),default:"off",enum:["on","off"]},"chat.editor.lineHeight":{type:"number",description:d(6697,null),default:0},"chat.agentsControl.enabled":{type:"string",enum:["hidden","badge","compact"],enumDescriptions:[d(6542,null),d(6539,null),d(6540,null)],markdownDescription:d(6541,null,"`#window.commandCenter#`","`#chat.viewSessions.enabled#`"),default:"compact",tags:["experimental"]},"chat.unifiedAgentsBar.enabled":{type:"boolean",markdownDescription:d(6663,null),default:!1,tags:["experimental"]},"chat.agentSessionProjection.enabled":{type:"boolean",markdownDescription:d(6543,null),default:!1,tags:["experimental"]},"chat.implicitContext.enabled":{type:"object",description:d(6588,null),additionalProperties:{type:"string",enum:["never","first","always"],description:d(6590,null),enumDescriptions:[d(6593,null),d(6592,null),d(6591,null)]},default:{panel:"always"},tags:["experimental"],experiment:{mode:"startup"}},"chat.implicitContext.suggestedContext":{type:"boolean",markdownDescription:d(6589,null),default:!0},"chat.editing.autoAcceptDelay":{type:"number",markdownDescription:d(6567,null),default:0,minimum:0,maximum:100},"chat.editing.confirmEditRequestRemoval":{type:"boolean",scope:1,markdownDescription:d(6568,null),default:!0},"chat.editing.confirmEditRequestRetry":{type:"boolean",scope:1,markdownDescription:d(6569,null),default:!0},"chat.editing.explainChanges.enabled":{type:"boolean",markdownDescription:d(6570,null),default:!1,tags:["experimental"],experiment:{mode:"auto"}},"chat.editing.revealNextChangeOnResolve":{type:"boolean",markdownDescription:d(6571,null),default:!0},"chat.tips.enabled":{type:"boolean",scope:1,description:d(6652,null),default:!0},"chat.upvoteAnimation":{type:"string",enum:["off","confetti","floatingThumbs","pulseWave","radiantLines"],enumDescriptions:[d(6667,null),d(6665,null),d(6666,null),d(6668,null),d(6669,null)],description:d(6664,null),default:"floatingThumbs"},"chat.experimental.detectParticipant.enabled":{type:"boolean",deprecationMessage:d(6577,null),description:d(6576,null),default:null},"chat.detectParticipant.enabled":{type:"boolean",description:d(6565,null),default:!0},"chat.inlineReferences.style":{type:"string",enum:["box","link"],enumDescriptions:[d(6599,null),d(6600,null)],description:d(6598,null),default:"box"},"chat.editorAssociations":{type:"object",markdownDescription:d(6573,null),additionalProperties:{type:"string"},default:{}},"chat.notifyWindowOnConfirmation":{type:"string",enum:["off","windowNotFocused","always"],enumDescriptions:[d(6625,null),d(6626,null),d(6624,null)],description:d(6623,null),default:"windowNotFocused"},"chat.autoReply":{default:!1,markdownDescription:d(6558,null),type:"boolean",scope:3,tags:["experimental","advanced"]},"chat.autopilot.enabled":{type:"boolean",markdownDescription:d(6557,null),default:!0,tags:["experimental"]},"chat.tools.global.autoApprove":{default:!1,markdownDescription:MNi.value,type:"boolean",scope:3,tags:["experimental"],policy:{name:"ChatToolsAutoApprove",category:"InteractiveSession",minimumVersion:"1.99",value:a=>a.chat_preview_features_enabled===!1?!1:void 0,localization:{description:{key:"autoApprove3.description",value:d(6517,null)}}}},"chat.tools.edits.autoApprove":{default:{"**/*":!0,"**/.vscode/*.json":!1,"**/.git/**":!1,"**/{package.json,server.xml,build.rs,web.config,.gitattributes,.env}":!1,"**/*.{code-workspace,csproj,fsproj,vbproj,vcxproj,proj,targets,props}":!1,"**/*.lock":!1,"**/*-lock.{yaml,json}":!1},markdownDescription:d(6654,null),type:"object",additionalProperties:{type:"boolean"}},"chat.tools.urls.autoApprove":{default:{"https://code.visualstudio.com":!0,"https://github.com/microsoft/vscode/wiki/*":!0},markdownDescription:d(6657,null),type:"object",additionalProperties:{oneOf:[{type:"boolean"},{type:"object",properties:{approveRequest:{type:"boolean"},approveResponse:{type:"boolean"}}}]}},"chat.tools.eligibleForAutoApproval":{default:{},markdownDescription:d(6656,null),type:"object",propertyNames:{enum:BNi,enumDescriptions:HNi},additionalProperties:{type:"boolean"},examples:[{fetch:!1,runTask:!1}],policy:{name:"ChatToolsEligibleForAutoApproval",category:"InteractiveSession",minimumVersion:"1.107",localization:{description:{key:"chat.tools.eligibleForAutoApproval",value:d(6656,null)}}}},"chat.sendElementsToChat.enabled":{default:!0,description:d(6646,null),type:"boolean",tags:["preview"]},"chat.sendElementsToChat.attachCSS":{default:!0,markdownDescription:d(6644,null,"`#chat.sendElementsToChat.enabled#`"),type:"boolean",tags:["preview"]},"chat.sendElementsToChat.attachImages":{default:!0,markdownDescription:d(6645,null,"`#chat.sendElementsToChat.enabled#`"),type:"boolean",tags:["experimental"]},"chat.artifacts.enabled":{default:!1,description:d(6549,null),type:"boolean",tags:["experimental"]},"chat.artifacts.mode":{default:"rules",description:d(6550,null),type:"string",enum:["rules","tool"],tags:["experimental"]},"chat.artifacts.rules.byMimeType":{default:{"image/*":{groupName:"Screenshots",onlyShowGroup:!0}},description:d(6554,null),type:"object",additionalProperties:{type:"object",properties:{groupName:{type:"string",description:d(6555,null)},onlyShowGroup:{type:"boolean",description:d(6556,null)}},required:["groupName"]},tags:["experimental"]},"chat.artifacts.rules.byFilePath":{default:{"**/*plan*.md":{groupName:"Plans"}},description:d(6551,null),type:"object",additionalProperties:{type:"object",properties:{groupName:{type:"string",description:d(6552,null)},onlyShowGroup:{type:"boolean",description:d(6553,null)}},required:["groupName"]},tags:["experimental"]},"chat.undoRequests.restoreInput":{default:!0,markdownDescription:d(6662,null),type:"boolean"},"chat.editRequests":{markdownDescription:d(6574,null),type:"string",enum:["inline","hover","input","none"],default:"inline"},"chat.viewSessions.enabled":{type:"boolean",default:!0,description:d(6689,null)},"chat.viewSessions.orientation":{type:"string",enum:["stacked","sideBySide"],enumDescriptions:[d(6692,null),d(6691,null)],default:"sideBySide",description:d(6690,null)},"chat.viewProgressBadge.enabled":{type:"boolean",default:!1,description:d(6688,null)},"chat.contextUsage.enabled":{type:"boolean",default:!0,description:d(6562,null)},"chat.notifyWindowOnResponseReceived":{type:"string",enum:["off","windowNotFocused","always"],enumDescriptions:[d(6629,null),d(6630,null),d(6628,null)],default:"windowNotFocused",description:d(6627,null)},"chat.checkpoints.enabled":{type:"boolean",default:!0,description:d(6559,null)},"chat.checkpoints.showFileChanges":{type:"boolean",description:d(6560,null),default:!1},[Wk]:{type:"string",description:d(6605,null),enum:["none","registry","all"],enumDescriptions:[d(6607,null),d(6608,null),d(6606,null)],default:"all",policy:{name:"ChatMCP",category:"InteractiveSession",minimumVersion:"1.99",value:a=>{if(a.mcp===!1)return"none";if(a.mcpAccess==="registry_only")return"registry"},localization:{description:{key:"chat.mcp.access",value:d(6605,null)},enumDescriptions:[{key:"chat.mcp.access.none",value:d(6607,null)},{key:"chat.mcp.access.registry",value:d(6608,null)},{key:"chat.mcp.access.any",value:d(6606,null)}]}}},[Nee]:{type:"string",description:d(6610,null),default:"newAndOutdated",enum:["never","onlyNew","newAndOutdated"],enumDescriptions:[d(6611,null),d(6613,null),d(6612,null)],tags:["experimental"]},[tHt]:{type:"boolean",description:d(6619,null),default:!0,tags:["experimental"]},[jet]:{type:"object",description:d(6615,null,"MCP: "+d(6702,null)),scope:5,additionalProperties:{type:"object",properties:{allowedDuringChat:{type:"boolean",description:d(6616,null),default:!0},allowedOutsideChat:{type:"boolean",description:d(6617,null),default:!1},allowedModels:{type:"array",items:{type:"string",description:d(6618,null)}}}}},[ert[4].enabledConfigKey]:{type:"boolean",description:d(6609,null),default:!1,tags:["experimental"],experiment:{mode:"startup"}},"chat.extensionTools.enabled":{type:"boolean",description:d(6580,null),default:!0,policy:{name:"ChatAgentExtensionTools",category:"InteractiveSession",minimumVersion:"1.99",localization:{description:{key:"chat.extensionToolsEnabled",value:d(6580,null)}}}},"chat.plugins.enabled":{type:"boolean",description:d(6633,null),default:!0,tags:["preview"]},"chat.pluginLocations":{type:"object",additionalProperties:{type:"boolean"},restricted:!0,markdownDescription:d(6632,null),scope:2,tags:["experimental"]},"chat.plugins.marketplaces":{type:"array",items:{type:"string"},markdownDescription:d(6634,null),default:["github/copilot-plugins","github/awesome-copilot"],scope:1,tags:["experimental"]},"chat.agent.enabled":{type:"boolean",description:d(6519,null),default:!0,order:1,policy:{name:"ChatAgentMode",category:"InteractiveSession",minimumVersion:"1.99",value:a=>a.chat_agent_enabled===!1?!1:void 0,localization:{description:{key:"chat.agent.enabled.description",value:d(6519,null)}}}},[YFe]:{type:"boolean",description:d(6534,null),default:!1,tags:["experimental","advanced"],included:ro.quality!=="stable"},[m2t]:{type:"boolean",description:d(6535,null),default:!1,tags:["experimental","advanced"],included:ro.quality!=="stable"},"chat.planAgent.defaultModel":{type:"string",description:d(6631,null),default:"",enum:Eq.modelIds,enumItemLabels:Eq.modelLabels,markdownEnumDescriptions:Eq.modelDescriptions},"chat.exploreAgent.defaultModel":{type:"string",description:d(6579,null),default:"",enum:kq.modelIds,enumItemLabels:kq.modelLabels,markdownEnumDescriptions:kq.modelDescriptions},"chat.requestQueuing.defaultAction":{type:"string",enum:["queue","steer"],enumDescriptions:[d(6639,null),d(6640,null)],description:d(6638,null),default:"steer"},"chat.editMode.hidden":{type:"boolean",description:d(6572,null),default:!0,tags:["experimental"],experiment:{mode:"auto"},policy:{name:"DeprecatedEditModeHidden",category:"InteractiveSession",minimumVersion:"1.112",localization:{description:{key:"chat.editMode.hidden",value:d(6572,null)}}}},"chat.math.enabled":{type:"boolean",description:d(6604,null),default:!0},"chat.agent.codeBlockProgress":{type:"boolean",description:d(6561,null),default:!0,tags:["experimental"]},"chat.statusWidget.anonymous":{type:"boolean",description:d(6648,null),default:!1,tags:["experimental","advanced"],experiment:{mode:"auto"}},[Kee]:{type:"object",properties:Object.fromEntries($Me.map(a=>[a,{type:"boolean",description:bpo[a]}])),additionalProperties:!1,default:Object.fromEntries($Me.map(a=>[a,!1])),markdownDescription:d(6700,null)},[aG]:{type:"boolean",default:!1,tags:["preview"],description:d(6614,null),included:ro.quality==="stable"},[t8]:{type:"string",description:d(6701,null),default:"",scope:1,tags:["usesOnlineServices","advanced"],included:!1,policy:{name:"McpGalleryServiceUrl",category:"InteractiveSession",minimumVersion:"1.101",value:a=>a.mcpRegistryUrl,localization:{description:{key:"mcp.gallery.serviceUrl",value:d(6701,null)}}}},[Ss.INSTRUCTIONS_LOCATION_KEY]:{type:"object",title:d(6602,null),markdownDescription:d(6601,null,Q6e,oLt),default:{...TLt.map(a=>({[a.path]:!0})).reduce((a,i)=>({...a,...i}),{})},additionalProperties:{type:"boolean"},propertyNames:{pattern:Qge,patternErrorMessage:d(6603,null)},restricted:!0,tags:["prompts","reusable prompts","prompt snippets","instructions"],examples:[{[TLt[0].path]:!0},{[khi]:!0,"/Users/vscode/repos/instructions":!0}]},[Ss.PROMPT_LOCATIONS_KEY]:{type:"object",title:d(6643,null),markdownDescription:d(6642,null,j6e,JX),default:{[X6e]:!0},additionalProperties:{type:"boolean"},unevaluatedProperties:{type:"boolean"},propertyNames:{pattern:Qge,patternErrorMessage:d(6635,null)},restricted:!0,tags:["prompts","reusable prompts","prompt snippets","instructions"],examples:[{[X6e]:!0},{[X6e]:!0,"/Users/vscode/repos/prompts":!0}]},[Ss.MODE_LOCATION_KEY]:{type:"object",title:d(6622,null),markdownDescription:d(6621,null,AK,W6e),default:{[kLt]:!0},deprecationMessage:d(6620,null),additionalProperties:{type:"boolean"},unevaluatedProperties:{type:"boolean"},restricted:!0,tags:["experimental","prompts","reusable prompts","prompt snippets","instructions"],examples:[{[kLt]:!0},{[kLt]:!0,"/Users/vscode/repos/chatmodes":!0}]},[Ss.AGENTS_LOCATION_KEY]:{type:"object",title:d(6538,null),markdownDescription:d(6537,null,tJ,W6e),default:{[NK]:!0,[PK]:!0,[ELt]:!0},additionalProperties:{type:"boolean"},propertyNames:{pattern:Qge,patternErrorMessage:d(6536,null)},restricted:!0,tags:["prompts","reusable prompts","prompt snippets","instructions"],examples:[{[NK]:!0},{[NK]:!0,"my-agents":!0,"../shared-agents":!0,"~/.copilot/agents":!0}]},[Ss.USE_AGENT_MD]:{type:"boolean",title:d(6671,null),markdownDescription:d(6670,null),default:!0,restricted:!0,disallowConfigurationDefault:!0,tags:["prompts","reusable prompts","prompt snippets","instructions"]},[Ss.USE_NESTED_AGENT_MD]:{type:"boolean",title:d(6685,null),markdownDescription:d(6684,null),default:!1,restricted:!0,disallowConfigurationDefault:!0,tags:["experimental","prompts","reusable prompts","prompt snippets","instructions"]},[Ss.USE_CLAUDE_MD]:{type:"boolean",title:d(6677,null),markdownDescription:d(6676,null),default:!0,restricted:!0,disallowConfigurationDefault:!0,tags:["prompts","reusable prompts","prompt snippets","instructions"]},[Ss.USE_AGENT_SKILLS]:{type:"boolean",title:d(6673,null),markdownDescription:d(6672,null),default:!0,restricted:!0,disallowConfigurationDefault:!0,tags:["prompts","reusable prompts","prompt snippets","instructions"]},[Ss.USE_SKILL_ADHERENCE_PROMPT]:{type:"boolean",title:d(6687,null),markdownDescription:d(6686,null),default:!1,restricted:!0,disallowConfigurationDefault:!0,tags:["experimental","prompts","reusable prompts","prompt snippets","instructions"],experiment:{mode:"auto"}},[Ss.INCLUDE_APPLYING_INSTRUCTIONS]:{type:"boolean",title:d(6595,null),markdownDescription:d(6594,null),default:!0,restricted:!0,disallowConfigurationDefault:!0,tags:["prompts","reusable prompts","prompt snippets","instructions"]},[Ss.INCLUDE_REFERENCED_INSTRUCTIONS]:{type:"boolean",title:d(6597,null),markdownDescription:d(6596,null),default:!1,restricted:!0,disallowConfigurationDefault:!0,tags:["prompts","reusable prompts","prompt snippets","instructions"]},[Ss.USE_CUSTOMIZATIONS_IN_PARENT_REPOS]:{type:"boolean",title:d(6681,null),markdownDescription:d(6680,null),default:!1,restricted:!0,disallowConfigurationDefault:!0,tags:["prompts","reusable prompts","prompt snippets","instructions"]},[Ss.SKILLS_LOCATION_KEY]:{type:"object",title:d(6546,null),markdownDescription:d(6544,null,m4,nLt),default:{...J6e.map(a=>({[a.path]:!0})).reduce((a,i)=>({...a,...i}),{})},additionalProperties:{type:"boolean"},propertyNames:{pattern:Qge,patternErrorMessage:d(6545,null)},restricted:!0,tags:["prompts","reusable prompts","prompt snippets","instructions"],examples:[{[J6e[0].path]:!0},{[J6e[0].path]:!0,"my-skills":!0,"../shared-skills":!0,"~/.custom/skills":!0}]},[Ss.HOOKS_LOCATION_KEY]:{type:"object",title:d(6587,null),markdownDescription:d(6585,null,rLt),default:{...Z6e.map(a=>({[a.path]:!0})).reduce((a,i)=>({...a,...i}),{})},additionalProperties:{type:"boolean"},propertyNames:{pattern:Qge,patternErrorMessage:d(6586,null)},restricted:!0,tags:["preview","prompts","hooks","agent"],examples:[{[Z6e[0].path]:!0},{[Z6e[0].path]:!0,"custom-hooks/hooks.json":!0}]},[Ss.USE_CHAT_HOOKS]:{type:"boolean",title:d(6683,null),markdownDescription:d(6682,null),default:!0,restricted:!0,disallowConfigurationDefault:!0,tags:["preview","prompts","hooks","agent"],policy:{name:"ChatHooks",category:"InteractiveSession",minimumVersion:"1.109",value:a=>a.chat_preview_features_enabled===!1?!1:void 0,localization:{description:{key:"chat.useHooks.description",value:d(6682,null)}}}},[Ss.USE_CLAUDE_HOOKS]:{type:"boolean",title:d(6675,null),markdownDescription:d(6674,null),default:!1,restricted:!0,disallowConfigurationDefault:!0,tags:["preview","prompts","hooks","agent"]},[Ss.USE_CUSTOM_AGENT_HOOKS]:{type:"boolean",title:d(6679,null),markdownDescription:d(6678,null),default:!1,restricted:!0,disallowConfigurationDefault:!0,tags:["preview","prompts","hooks","agent"]},[Ss.PROMPT_FILES_SUGGEST_KEY]:{type:"object",scope:5,title:d(6637,null),markdownDescription:d(6636,null),default:{},additionalProperties:{oneOf:[{type:"boolean"},{type:"string"}]},tags:["prompts","reusable prompts","prompt snippets","instructions"],examples:[{plan:!0,"a11y-audit":"resourceExtname == .html",document:"resourceLangId == markdown"}]},"chat.tools.todos.showWidget":{type:"boolean",default:!0,description:d(6660,null)},"chat.agent.thinkingStyle":{type:"string",default:"fixedScrolling",enum:["collapsed","collapsedPreview","fixedScrolling"],enumDescriptions:[d(6530,null),d(6531,null),d(6532,null)],description:d(6533,null),tags:["experimental"]},"chat.agent.thinking.generateTitles":{type:"boolean",default:!0,description:d(6525,null),tags:["experimental"]},"chat.agent.thinking.collapsedTools":{type:"string",default:"always",enum:["off","withThinking","always"],enumDescriptions:[d(6523,null),d(6524,null),d(6522,null)],markdownDescription:d(6521,null),tags:["experimental"]},"chat.agent.thinking.terminalTools":{type:"boolean",default:!0,markdownDescription:d(6529,null),tags:["experimental"]},"chat.tools.terminal.simpleCollapsible":{type:"boolean",default:!0,markdownDescription:d(6659,null),tags:["experimental"]},"chat.tools.usagesTool.enabled":{type:"boolean",default:!0,markdownDescription:d(6661,null),tags:["preview"],experiment:{mode:"auto"}},"chat.tools.renameTool.enabled":{type:"boolean",default:!0,markdownDescription:d(6658,null),tags:["preview"],experiment:{mode:"auto"}},"chat.agent.thinking.phrases":{type:"object",default:{mode:"append",phrases:[]},properties:{mode:{type:"string",enum:["replace","append"],default:"append",description:d(6527,null)},phrases:{type:"array",items:{type:"string"},default:[],description:d(6528,null)}},additionalProperties:!1,markdownDescription:d(6526,null),tags:["experimental"]},"chat.tools.autoExpandFailures":{type:"boolean",default:!0,markdownDescription:d(6655,null)},"chat.disableAIFeatures":{type:"boolean",description:d(6566,null),default:!1,scope:4},"chat.allowAnonymousAccess":{type:"boolean",description:d(6548,null),default:!1,tags:["experimental"],experiment:{mode:"auto"}},"chat.growthNotification.enabled":{type:"boolean",description:d(6584,null),default:!1,tags:["experimental"],experiment:{mode:"auto"}},"chat.signInTitleBar.enabled":{type:"boolean",description:d(6647,null),default:!1,tags:["experimental"],experiment:{mode:"auto"}},"chat.restoreLastPanelSession":{type:"boolean",description:d(6641,null),default:!1},"chat.exitAfterDelegation":{type:"boolean",description:d(6575,null),default:!1,tags:["preview"]},"chat.extensionUnification.enabled":{type:"boolean",description:d(6581,null),default:!0,tags:["experimental"],experiment:{mode:"auto"}},"chat.customAgentInSubagent.enabled":{type:"boolean",description:d(6651,null),default:!0,experiment:{mode:"auto"}},"chat.subagents.allowInvocationsFromSubagents":{type:"boolean",description:d(6649,null),markdownDescription:d(6650,null),default:!1,experiment:{mode:"auto"}},"chat.customizationsMenu.enabled":{type:"boolean",tags:["preview"],description:d(6547,null),default:!0},"chat.customizations.harnessSelector.enabled":{type:"boolean",tags:["preview"],description:d(6563,null),default:!0},"chat.customizations.providerApi.enabled":{type:"boolean",description:d(6564,null),default:!1,tags:["experimental"]}}});ne.as(qo.EditorPane).registerEditorPane(Br.create(IN,Na.EditorID,d(6518,null)),[new Ft(Na)]);ne.as(qo.EditorPane).registerEditorPane(Br.create(xoe,eE.ID,d(6693,null)),[new Ft(eE)]);ne.as(qo.EditorPane).registerEditorPane(Br.create(SU,SU.ID,d(6516,null)),[new Ft(lq)]);ne.as(Ep.ConfigurationMigration).registerConfigurationMigrations([{key:"chat.experimental.detectParticipant.enabled",migrateFn:(a,i)=>[["chat.experimental.detectParticipant.enabled",{value:void 0}],["chat.detectParticipant.enabled",{value:a!==!1}]]},{key:"chat.useClaudeSkills",migrateFn:(a,i)=>[["chat.useClaudeSkills",{value:void 0}],["chat.useAgentSkills",{value:a}]]},{key:Kee,migrateFn:a=>typeof a=="boolean"?{value:Object.fromEntries($Me.map(i=>[i,a]))}:{value:a}},{key:"chat.notifyWindowOnConfirmation",migrateFn:a=>a===!0?{value:"windowNotFocused"}:a===!1?{value:"off"}:[]},{key:"chat.notifyWindowOnResponseReceived",migrateFn:a=>a===!0?{value:"windowNotFocused"}:a===!1?{value:"off"}:[]},{key:"chat.plugins.paths",migrateFn:(a,i)=>[["chat.plugins.paths",{value:void 0}],["chat.pluginLocations",{value:a}]]}]);var QVe=class extends x{constructor(e,t,o){super();this.editorResolverService=t;this.instantiationService=o;this._editorRegistrations=this._register(new Vt);this._registerEditor(Q.vscodeChatEditor),this._registerEditor(Q.vscodeLocalChatSession),this._register(e.onDidChangeContentProviderSchemes(n=>{for(let r of n.added)this._registerEditor(r);for(let r of n.removed)this._editorRegistrations.deleteAndDispose(r)}));for(let n of e.getContentProviderSchemes())this._registerEditor(n)}static{this.ID="workbench.contrib.chatResolver"}_registerEditor(e){this._editorRegistrations.set(e,this.editorResolverService.registerEditor(`${e}:**/**`,{id:Na.EditorID,label:d(6518,null),priority:"builtin"},{singlePerResource:!0,canSupportResource:t=>t.scheme===e},{createEditorInput:({resource:t,options:o})=>({editor:this.instantiationService.createInstance(Na,t,o),options:o})}))}};QVe=I([m(0,Us),m(1,Ka),m(2,F)],QVe);var YVe=class{static{this.ID="workbench.contrib.chatDebugResolver"}constructor(i){i.registerEditor(`${eE.RESOURCE.scheme}:**/**`,{id:eE.ID,label:d(6693,null),priority:"exclusive"},{singlePerResource:!0,canSupportResource:e=>e.scheme===eE.RESOURCE.scheme},{createEditorInput:()=>({editor:eE.instance,options:{pinned:!0}})})}};YVe=I([m(0,Ka)],YVe);var XVe=class extends x{constructor(e,t,o){super();this.experimentService=e;this.entitlementService=t;this.contextKeyService=o;this.newChatButtonExperimentIcon=ie.newChatButtonExperimentIcon.bindTo(this.contextKeyService),this.registerMaxRequestsSetting(),this.registerNewChatButtonIcon()}static{this.ID="workbench.contrib.chatAgentSetting"}registerMaxRequestsSetting(){let e,t=()=>{let o=this.entitlementService.entitlement===5?"chatAgentMaxRequestsFree":"chatAgentMaxRequestsPro";this.experimentService.getTreatment(o).then(n=>{let r={id:"chatSidebar",title:d(6699,null),type:"object",properties:{"chat.agent.maxRequests":{type:"number",markdownDescription:d(6520,null),default:n??50,order:2}}};UNi.updateConfigurations({remove:e?[e]:[],add:[r]}),e=r})};this._register(U.runAndSubscribe(U.debounce(this.entitlementService.onDidChangeEntitlement,()=>{},1e3),()=>t()))}registerNewChatButtonIcon(){this.experimentService.getTreatment("chatNewButtonIcon").then(e=>{typeof e=="string"&&["copilot","new-session","comment"].includes(e)?this.newChatButtonExperimentIcon.set(e):this.newChatButtonExperimentIcon.reset()})}};XVe=I([m(0,yD),m(1,rr),m(2,X)],XVe);var JVe=class extends x{constructor(e,t,o,n){super();this.contextKeyService=e;this.chatWidgetService=t;this.viewsService=o;this.editorService=n;this.foregroundSessionCountContextKey=ie.foregroundSessionCount.bindTo(this.contextKeyService),this._register(this.chatWidgetService.onDidAddWidget(()=>{this.updateForegroundSessionCount()})),this._register(this.editorService.onDidVisibleEditorsChange(()=>{this.updateForegroundSessionCount()})),this._register(U.filter(this.viewsService.onDidChangeViewVisibility,r=>r.id===Dr)(()=>{this.updateForegroundSessionCount()})),this.updateForegroundSessionCount()}static{this.ID="workbench.contrib.chatForegroundSessionCount"}updateForegroundSessionCount(){let e=this.viewsService.isViewVisible(Dr)?1:0;for(let t of this.chatWidgetService.getWidgetsByLocations("panel"))t.domNode.offsetParent!==null&&(py(t.viewContext)||Zde(t.viewContext)&&t.viewContext.isQuickChat||e++);this.foregroundSessionCountContextKey.set(e)}};JVe=I([m(0,X),m(1,Pt),m(2,$t),m(3,ee)],JVe);function Jxo(a,i){let e=new Set,t=new Set(a.map(n=>n.name.get())),o=new Map;for(let n of i){let r=n.name.get();if(t.has(r))continue;let s=o.get(r);s&&e.delete(s),o.set(r,n.id),e.add(n.id)}return e}var ZVe=class extends x{constructor(e){super();this.chatModeService=e;this._modeActionDisposables=new Vt;this._store.add(this._modeActionDisposables);let{builtin:t,custom:o}=this.chatModeService.getModes(),n=Jxo(t,o);for(let r of o)n.has(r.id)&&this._registerModeAction(r);this._register(this.chatModeService.onDidChangeChatModes(()=>{let{builtin:r,custom:s}=this.chatModeService.getModes(),l=Jxo(r,s);for(let c of this._modeActionDisposables.keys())l.has(c)||this._modeActionDisposables.deleteAndDispose(c);for(let c of s)l.has(c.id)&&!this._modeActionDisposables.has(c.id)&&this._registerModeAction(c)}))}static{this.ID="workbench.contrib.chatAgentActions"}_registerModeAction(e){let t=class extends Cpe{constructor(){super(e)}};this._modeActionDisposables.set(e.id,W(t))}};ZVe=I([m(0,Fg)],ZVe);var eBe=class extends x{constructor(e,t){super();this._configurationService=e;this._pathService=t;this._registrations=this._register(new N);this._updateAssociations(),this._register(this._configurationService.onDidChangeConfiguration(o=>{o.affectsConfiguration(Ss.HOOKS_LOCATION_KEY)&&this._updateAssociations()}))}static{this.ID="workbench.contrib.hookSchemaAssociation"}async _updateAssociations(){this._registrations.clear();let e=Ss.promptSourceFolders(this._configurationService,"hook"),t=await this._pathService.userHome(),o=t.fsPath??t.path;for(let n of e){if(n.source==="claude-workspace"||n.source==="claude-workspace-local"||n.source==="claude-personal")continue;let r=Bit(n.path)?o+n.path.substring(1):n.path,s=r.toLowerCase().endsWith(".json")?r:`${r}/*.json`;this._registrations.add(eko.registerSchemaAssociation(rfi,s))}}};eBe=I([m(0,B),m(1,An)],eBe);var tBe=class extends x{constructor(e){super();this._languageModelToolsService=e;this._updateToolReferenceNames(),this._register(this._languageModelToolsService.onDidChangeTools(()=>this._updateToolReferenceNames()))}static{this.ID="workbench.contrib.toolReferenceNames"}_updateToolReferenceNames(){let e=Array.from(this._languageModelToolsService.getAllToolsIncludingDisabled()).filter(t=>typeof t.toolReferenceName=="string").sort((t,o)=>t.toolReferenceName.localeCompare(o.toolReferenceName));BNi.length=0,HNi.length=0;for(let t of e)BNi.push(t.toolReferenceName),HNi.push(d(6653,null,t.toolReferenceName,t.userDescription||t.displayName));UNi.notifyConfigurationSchemaUpdated({id:"chatSidebar",properties:{"chat.tools.eligibleForAutoApproval":{}}})}};tBe=I([m(0,Vn)],tBe);ga.register(new e$t);ga.register(new A2t);ga.register(new bGt);ga.register(new SGt);ga.register(new IGt);ga.register(new yGt);ik(OWe);ne.as(qo.EditorFactory).registerEditorSerializer(Na.TypeID,NRt);ne.as(qo.EditorFactory).registerEditorSerializer(eE.ID,cqt);It(QVe.ID,QVe,St.BlockStartup);It(YVe.ID,YVe,St.BlockStartup);It(AQ.ID,AQ,St.BlockRestore);It(xfe.ID,xfe,St.BlockRestore);It(Qfe.ID,Qfe,St.Eventually);It(Pfe.ID,Pfe,St.BlockStartup);It(oue.ID,oue,St.BlockRestore);It($ge.ID,$ge,St.BlockRestore);It(Afe.ID,Afe,St.Eventually);It(ofe.ID,ofe,St.BlockRestore);It(Jhe.ID,Jhe,St.Eventually);It(Jfe.ID,Jfe,St.BlockStartup);It(cq.ID,cq,St.Eventually);It(Nfe.ID,Nfe,St.BlockRestore);It(Ofe.ID,Ofe,St.AfterRestored);It(Ffe.ID,Ffe,St.BlockRestore);It(Zge.ID,Zge,St.Eventually);It(tfe.ID,tfe,St.BlockRestore);It(efe.ID,efe,St.BlockRestore);It(XVe.ID,XVe,St.AfterRestored);It(JVe.ID,JVe,St.AfterRestored);It(ZVe.ID,ZVe,St.Eventually);It(eBe.ID,eBe,St.AfterRestored);It(tBe.ID,tBe,St.AfterRestored);It(hfe.ID,hfe,St.Eventually);It(yfe.ID,yfe,St.AfterRestored);It(tve.ID,tve,St.BlockRestore);It(Vhe.ID,Vhe,St.AfterRestored);It(Cfe.ID,Cfe,St.AfterRestored);It(Ohe.ID,Ohe,St.AfterRestored);It(gfe.ID,gfe,St.BlockRestore);It(nfe.ID,nfe,St.AfterRestored);It(Xfe.ID,Xfe,St.BlockRestore);It(Yfe.ID,Yfe,St.BlockRestore);It(wfe.ID,wfe,St.BlockStartup);It(vge.ID,vge,St.AfterRestored);It(oge.ID,oge,St.Eventually);It(jge.ID,jge,St.Eventually);It(Zfe.ID,Zfe,St.AfterRestored);It(eve.ID,eve,St.Eventually);It(ufe.ID,ufe,St.AfterRestored);It(jfe.ID,jfe,St.Eventually);uao();IIo();Gyo();hwo();DIo();RIo();Qyo();awo();Fvo();efo();mwo();HIo();ewo();Xyo();nwo();rwo();Kyo();$yo();Ago();Qvo();Rvo();two();iwo();W(HNe);ik(HAe);ZAe.register(new Ft(WVe));ZAe.register(new Ft(VVe));ZAe.register(new Ft(BVe));Ee(Rot,LOe,1);Ee(a0e,s0e,1);Ee(mi,l0e,1);Ee(Pt,$Ve,1);Ee(sD,hVe,1);Ee(NF,AWe,1);Ee(wXe,FDe,1);Ee(s4,$We,1);Ee(ds,a4,1);Ee(nao,BDe,1);Ee(BF,iTe,1);Ee(cr,XEe,1);Ee(_K,ZEe,1);Ee(vLt,nTe,1);Ee(Gg,FVe,1);Ee(Zk,hWe,1);Ee(iqt,mWe,1);Ee(aq,KVe,1);Ee(Oy,GVe,1);Ee(Vn,LN,1);Ee(_D,OVe,1);Ee(M2t,jv,1);Ee(XX,r$t,1);Ee(iJ,MLt,1);Ee(ud,GWe,1);Ee(Gv,Uzt,1);Ee(FEe,_Dt,1);Ee(Or,S0e,1);Ee(DS,PNt,1);Ee(Fg,c3,1);Ee(rW,UAe,1);Ee(sNe,X1t,1);Ee(h0,KDe,1);Ee(LZ,zDe,1);Ee(A_e,P_e,1);Ee(z1t,qWe,1);Ee(wW,JOe,1);Ee(Yp,dqt,1);Ee(Qte,SNe,1);kI.CONTRIBS.push(yS);var U$t=jVe(),o6=class extends xq{static{this.ID="workbench.contrib.inlineChatDefaultModel"}static{this.modelIds=U$t.modelIds}static{this.modelLabels=U$t.modelLabels}static{this.modelDescriptions=U$t.modelDescriptions}constructor(i,e){super(U$t,{configKey:"inlineChat.defaultModel",configSectionId:"inlineChat",logPrefix:"[InlineChatDefaultModel]",filter:t=>!!t.capabilities?.toolCalling},i,e)}};o6=I([m(0,ds),m(1,se)],o6);It(o6.ID,o6,St.BlockRestore);ne.as(Jt.Configuration).registerConfiguration({id:"inlineChat",title:d(11249,null),order:30,type:"object",properties:{"inlineChat.defaultModel":{description:d(11250,null),type:"string",default:"",order:1,enum:o6.modelIds,enumItemLabels:o6.modelLabels,markdownEnumDescriptions:o6.modelDescriptions}}});var dL=class extends op{constructor(i,e,t,o,n,r,s,l,c){super(i,o.getRawOptions(),t,n,r,s,l,c),this._parentEditor=o,this._overwriteOptions=e,super.updateOptions(this._overwriteOptions),this._register(o.onDidChangeConfiguration(u=>this._onParentConfigurationChanged(u)))}getParentEditor(){return this._parentEditor}_onParentConfigurationChanged(i){super.updateOptions(this._parentEditor.getRawOptions()),super.updateOptions(this._overwriteOptions)}updateOptions(i){Xu(this._overwriteOptions,i,!0),super.updateOptions(this._overwriteOptions)}};dL=I([m(4,X),m(5,F),m(6,qt),m(7,lr),m(8,wd)],dL);$e.registerCommandAlias("interactiveEditor.start","inlineChat.start");$e.registerCommandAlias("interactive.acceptChanges",mgo);var Odn=Ae("start-inline-chat",R.sparkle,d(11239,null)),Qst=C.and(C.or(hit,Phe),w1t,pe.writable,pe.editorSimpleInput.negate()),z$t=class extends K{constructor(){super({id:N8,title:L(11237,"Open Inline Chat"),shortTitle:L(11238,"Inline Chat"),category:Wy.category,f1:!0,precondition:C.and(Qst,C.or(Py.negate(),EM.negate())),keybinding:{when:C.and(pe.focus,Qst,C.or(Py.negate(),EM.negate())),weight:200,primary:2087},icon:Odn,menu:[{id:D.EditorContext,group:"1_chat",order:3,when:C.and(Qst,C.or(Py.negate(),EM.negate()))},{id:D.ChatTitleBarMenu,group:"a_open",order:3}]})}run(i,...e){let o=i.get(qt).getActiveCodeEditor();if(!(!o||o.isSimpleWidget))return o.invokeWithinContext(n=>{let r=n.get(X),s=n.get(se);if(!r.contextMatchesRules(this.desc.precondition??void 0)){s.debug("[EditorAction2] NOT running command because its precondition is FALSE",this.desc.id,this.desc.precondition?.serialize());return}return this._runEditorCommand(n,o,...e)})}async _runEditorCommand(i,e,...t){let o=i.get(B),n=Nd.get(e);if(!n)return;let r,s=t[0];if(s&&zot.isInlineChatRunOptions(s)&&(r=s),!r?.message&&o.getValue("inlineChat.renderMode")==="hover"){let l=e.getSelection(),c=l&&!l.isEmpty()?d(11234,null):d(11233,null);await n.inputOverlayWidget.showMenuAtSelection(c);return}await n?.run({...r})}};ve.appendMenuItem(D.InlineChatEditorAffordance,{group:"0_chat",order:1,when:C.and(pe.writable,pe.hasNonEmptySelection,C.or(Py.negate(),EM.negate()),cs.Setup.hidden.negate()),command:{id:N8,title:d(11226,null),shortTitle:d(11227,null),icon:R.sparkle}});var K$t=class extends pl{constructor(){super({id:"inlineChat.focus",title:L(11229,"Focus Input"),f1:!0,category:Wy.category,precondition:C.and(pe.editorTextFocus,nW,_G.negate(),$a.negate()),keybinding:[{weight:10,when:C.and(mit.isEqualTo("above"),pe.isEmbeddedDiffEditor.negate()),primary:2066},{weight:10,when:C.and(mit.isEqualTo("below"),pe.isEmbeddedDiffEditor.negate()),primary:2064}]})}runEditorCommand(i,e,...t){Nd.get(e)?.focus()}},Wy=class a extends pl{static{this.category=L(11222,"Inline Chat")}constructor(i){let e=t=>{if(Array.isArray(t))for(let o of t)o.when=C.and(Phe,o.when);else t&&(t.when=C.and(Phe,t.when))};Array.isArray(i.menu),e(i.menu),super({...i,category:a.category,precondition:C.and(Phe,i.precondition)})}runEditorCommand(i,e,...t){let o=i.get(ee),n=i.get(se),r=Nd.get(e);if(!r){let{activeTextEditorControl:s}=o;pn(s)?e=s:mc(s)&&(e=s.getModifiedEditor()),r=Nd.get(e)}if(!r){n.warn("[IE] NO controller found for action",this.desc.id,e.getModel()?.uri);return}if(e instanceof id&&(e=e.getParentEditor()),!r){for(let s of i.get(qt).listDiffEditors())(s.getOriginalEditor()===e||s.getModifiedEditor()===e)&&s instanceof dL&&this.runEditorCommand(i,s.getParentEditor(),...t);return}this.runInlineChatCommand(i,r,e,...t)}},G$t=class extends Wy{constructor(){super({id:"inlineChat.fixDiagnostics",title:L(11228,"Fix"),icon:R.editSparkle,precondition:C.and(git,pe.selectionHasDiagnostics,Py.negate()),menu:[{id:D.InlineChatEditorAffordance,group:"1_quickfix",order:100,when:C.and(git,pe.selectionHasDiagnostics,Py.negate())},{id:D.ChatEditorInlineMenu,group:"2_chat",order:1,when:C.and(git,pe.selectionHasDiagnostics,Py.negate())},{id:D.MarkerHoverStatusBar,group:"1_fix",order:1,when:C.and(git,Py.negate()),precondition:null}]})}runInlineChatCommand(i,e,t,...o){e.inputWidget.hide(),e.run({autoSend:!0,attachDiagnostics:!0})}},iBe=class extends Wy{constructor(e,t){super(t);this._keep=e}async runInlineChatCommand(e,t,o,...n){this._keep?await t.acceptSession():await t.rejectSession(),o.hasModel()&&o.setSelection(o.getSelection().collapseToStart())}},q$t=class extends iBe{constructor(){super(!0,{id:"inlineChat2.keep",title:L(11231,"Keep"),f1:!0,icon:R.check,precondition:C.and(nW,Gk.negate(),Kg),keybinding:[{when:C.and(ie.inputHasFocus,ie.inputHasText.negate()),weight:200,primary:3},{weight:210,primary:2051}],menu:[{id:D.ChatEditorInlineExecute,group:"navigation",order:4,when:C.and(Gk.negate(),Kg,ie.inputHasText.toNegated())}]})}},$$t=class extends iBe{constructor(){super(!1,{id:"inlineChat2.undo",title:L(11241,"Undo"),f1:!0,icon:R.discard,precondition:C.and(nW,YD),keybinding:[{when:C.or(C.and(pe.focus,Kg.negate()),ie.inputHasFocus),weight:201,primary:9}],menu:[{id:D.ChatEditorInlineExecute,group:"navigation",order:100,when:C.and(YD,Gk.negate(),Kg)}]})}},j$t=class extends iBe{constructor(){super(!1,{id:"inlineChat2.close",title:L(11223,"Close"),f1:!0,icon:R.close,precondition:C.and(nW),keybinding:[{when:C.or(C.and(pe.focus,Kg.negate()),ie.inputHasFocus),weight:201,primary:9}],menu:[{id:D.ChatEditorInlineExecute,group:"navigation",order:100,when:C.or(YD.negate(),C.and(YD,Kg.negate(),Gk.negate()),C.and(YD,x1t))}]})}},Q$t=class extends iBe{constructor(){super(!1,{id:"inlineChat2.cancel",title:L(11221,"Cancel"),precondition:C.and(nW,Gk),keybinding:[{when:C.or(pe.focus,ie.inputHasFocus),weight:201,primary:9}],menu:[{id:D.ChatEditorInlineExecute,group:"navigation",order:100,when:C.and(YD,Gk)}]})}},Y$t=class extends Wy{constructor(){super({id:"inlineChat2.continueInChat",title:L(11224,"Ask in Chat"),icon:R.chatSparkle,precondition:C.and(nW,YD,Mhe),menu:[{id:D.ChatEditorInlineExecute,group:"navigation",order:2,when:C.and(YD,Mhe)}]})}async runInlineChatCommand(i,e,t){await e.continueSessionInChat()}},X$t=class extends Wy{constructor(){super({id:"inlineChat2.rephrase",title:L(11236,"Rephrase"),precondition:C.and(nW,YD,Mhe),menu:[{id:D.ChatEditorInlineExecute,group:"navigation",order:1,when:C.and(YD,Mhe)}]})}async runInlineChatCommand(i,e,t){await e.rephraseSession()}},J$t=class extends Wy{constructor(){super({id:"inlineChat.submitInput",title:L(11240,"Send"),icon:R.send,precondition:C.and(A8,pit,C.or(Py.negate(),EM.negate())),keybinding:{when:C.and(A8,C.or(Py.negate(),EM.negate())),weight:10,primary:3},menu:[{id:D.InlineChatInput,group:"0_main",order:1,when:C.or(Py.negate(),EM.negate())}]})}runInlineChatCommand(i,e,t,...o){let n=e.inputWidget.value;n&&(e.inputWidget.addToHistory(n),e.inputWidget.hide(),e.run({message:n,autoSend:!0}))}},Z$t=class extends Wy{constructor(){super({id:"inlineChat.hideInput",title:L(11230,"Hide Input"),precondition:A8,keybinding:{when:A8,weight:10,primary:9}})}runInlineChatCommand(i,e,t,...o){e.inputWidget.hide()}},ejt=class extends pl{constructor(){super({id:E1t,title:L(11220,"Ask in Chat"),category:Wy.category,f1:!0,precondition:C.and(Qst,Py,EM),keybinding:{when:pe.focus,weight:200,primary:2087},icon:R.chatSparkle,menu:[{id:D.EditorContext,group:"1_chat",order:3,when:C.and(Qst,Py,EM)},{id:D.InlineChatEditorAffordance,group:"0_chat",order:1,when:C.and(pe.hasNonEmptySelection,Py,EM)}]})}async runEditorCommand(i,e){let t=i.get(ud),o=Nd.get(e);if(!o||!e.hasModel())return;t.editingSessionsObs.get().find(r=>r.getEntry(e.getModel().uri))&&o.inputOverlayWidget.showMenuAtSelection(d(11232,null))}},tjt=class extends pl{constructor(){super({id:"inlineChat.dismissEditorAffordance",title:L(11225,"Dismiss Editor Affordance"),precondition:C.and(k1t,C.equals("config.inlineChat.affordance","editor")),keybinding:{when:pe.editorTextFocus,weight:100,primary:9}})}runEditorCommand(i,e){Nd.get(e)?.inputOverlayWidget.dismiss()}},ijt=class extends Wy{constructor(){super({id:"inlineChat.queueInChat",title:L(11235,"Queue in Chat"),icon:R.arrowUp,precondition:C.and(A8,pit,Py,EM),keybinding:{when:C.and(A8,Py,EM),weight:10,primary:3},menu:[{id:D.InlineChatInput,group:"0_main",order:1,when:C.and(Py,EM)}]})}async runInlineChatCommand(i,e,t){let o=i.get(ud),n=i.get(Pt);if(!t.hasModel())return;let r=e.inputWidget.value;if(r&&e.inputWidget.addToHistory(r),e.inputWidget.hide(),!r)return;let s=o.editingSessionsObs.get().find(u=>u.getEntry(t.getModel().uri));if(!s)return;let l=await n.openSession(s.chatSessionResource);if(!l)return;let c=t.getSelection();c&&!c.isEmpty()&&await l.attachmentModel.addFile(t.getModel().uri,c),await l.acceptInput(r,{queue:"queued"})}};var oBe=class{constructor(i,e,t){this._store=new N;this._store.add(i.onWillStartSession(o=>{let n=Zo.parse(o.getModel().uri);if(n){for(let r of t.listNotebookEditors())if(Qe(r.textModel?.uri,n.notebook)){let s=!1,l=[];for(let[,c]of r.codeEditors)l.push(c),s=c===o||s;if(s){for(let c of l)c!==o&&Nd.get(c)?.acceptSession();break}}}}))}dispose(){this._store.dispose()}};oBe=I([m(0,yI),m(1,ee),m(2,Gc)],oBe);var tko=class a extends Error{static{this.code="InlineChatError"}constructor(i){super(i),this.name=a.code}},nBe=class{constructor(i,e){this._chatService=i;this._store=new N;this._sessions=new gt;this._onWillStartSession=this._store.add(new E);this.onWillStartSession=this._onWillStartSession.event;this._onDidChangeSessions=this._store.add(new E);this.onDidChangeSessions=this._onDidChangeSessions.event;let t=ui(this,e.onDidChangeAgents,()=>e.getDefaultAgent("editor"));this._store.add(be(o=>{t.read(o)||(Be(this._sessions.values()),this._sessions.clear())}))}dispose(){this._store.dispose()}createSession(i){let e=i.getModel().uri;if(this._sessions.has(e))throw new Error("Session already exists");this._onWillStartSession.fire(i);let t=this._chatService.startNewLocalSession("editor",{canUseTools:!1}),o=t.object;o.startEditingSession(!1);let n=Me(this,void 0),r=new N;r.add(Z(()=>{this._chatService.cancelCurrentRequestForSession(o.sessionResource,"inlineChatSession"),o.editingSession?.reject(),this._sessions.delete(e),this._onDidChangeSessions.fire(this)})),r.add(t),r.add(be(l=>{let c=o.editingSession?.entries.read(l);if(!c?.length)return;let u=c.find(h=>Qe(h.modifiedURI,e))?.state.read(l);if(u===1||u===2){let h=o.getRequests().at(-1)?.response;h&&this._chatService.notifyUserAction({sessionResource:h.session.sessionResource,requestId:h.requestId,agentId:h.agent?.id,command:h.slashCommand?.name,result:h.result,action:{kind:"inlineChat",action:u===1?"accepted":"discarded"}})}c.every(h=>{let g=h.state.read(l);return(g===1||g===2)&&!h.isCurrentlyBeingModifiedBy.read(l)})&&!o.requestInProgress.read(void 0)&&r.dispose()}));let s={uri:e,initialPosition:i.getSelection().getStartPosition().delta(-1),initialSelection:i.getSelection(),chatModel:o,editingSession:o.editingSession,terminationState:n,setTerminationState:l=>{n.set(l,void 0),this._onDidChangeSessions.fire(this)},dispose:r.dispose.bind(r)};return this._sessions.set(e,s),this._onDidChangeSessions.fire(this),s}getSessionByTextModel(i){let e=this._sessions.get(i);if(!e){for(let[t,o]of this._sessions)if(o.editingSession.getEntry(i)){e=o;break}}return e}getSessionBySessionUri(i){for(let e of this._sessions.values())if(Qe(e.chatModel.sessionResource,i))return e}};nBe=I([m(0,mi),m(1,cr)],nBe);var ive=class{constructor(i,e,t,o){this._store=new N;this._ctxHasProvider2=yTi.bindTo(i),this._ctxHasNotebookProvider=wTi.bindTo(i),this._ctxPossible=w1t.bindTo(i);let n=ui(this,e.onDidChangeAgents,()=>e.getDefaultAgent("editor")),r=ui(this,e.onDidChangeAgents,()=>e.getDefaultAgent("notebook")),s=hr("inlineChat.notebookAgent",!1,o);this._store.add(be(c=>{n.read(c)?this._ctxHasProvider2.set(!0):this._ctxHasProvider2.reset()})),this._store.add(be(c=>{this._ctxHasNotebookProvider.set(s.read(c)&&!!r.read(c))}));let l=()=>{let c=t.activeEditorPane?.getControl(),u=pn(c)||mc(c)||SO(c);this._ctxPossible.set(u)};this._store.add(t.onDidActiveEditorChange(l)),l()}static{this.Id="inlineChat.enabler"}dispose(){this._ctxPossible.reset(),this._ctxHasProvider2.reset(),this._store.dispose()}};ive=I([m(0,X),m(1,cr),m(2,ee),m(3,B)],ive);var HW=class extends x{static{this.Id="inlineChat.escapeTool"}static{this.DONT_ASK_AGAIN_KEY="inlineChat.dontAskMoveToPanelChat"}static{this._data={id:"inline_chat_exit",source:kn.Internal,canBeReferencedInPrompt:!1,alwaysDisplayInputOutput:!1,displayName:d(11263,null),modelDescription:"Show a short textual response when not being able to make code changes and when not having been asked for code changes. Can also be used to move the request to the richer panel chat which supports edits across files, creating and deleting files, multi-turn conversations between the user and the assistant, and access to more IDE tools, like retrieve problems, interact with source control, run terminal commands etc.",inputSchema:{type:"object",additionalProperties:!1,properties:{response:{type:"string",description:d(11265,null),maxLength:200}}}}}constructor(i,e,t,o,n,r,s,l,c){super(),this._store.add(i.registerTool(HW._data,{invoke:async(u,p,h,g)=>{let f=u.context?.sessionResource;if(!f)return s.warn("InlineChatEscapeToolContribution: no sessionId in tool invocation context"),{content:[{kind:"text",value:"Cancel"}]};let v=e.getSessionBySessionUri(f);if(!v)return s.warn(`InlineChatEscapeToolContribution: no session found for id ${f}`),{content:[{kind:"text",value:"Cancel"}]};if(!v.chatModel.getRequests().at(-1))return s.warn(`InlineChatEscapeToolContribution: no request found for id ${f}`),{content:[{kind:"text",value:"Cancel"}],toolResultMessage:d(11267,null)};if(n.getValue("inlineChat.renderMode")==="hover"){let k=typeof u.parameters?.response=="string"&&u.parameters.response.trim().length>0?u.parameters.response.trim():d(11266,null);return v.setTerminationState(k),{content:[{kind:"text",value:"Success"}]}}let S=l.getBoolean(HW.DONT_ASK_AGAIN_KEY,0),y;return S!==void 0?y={confirmed:S,checkboxChecked:!1}:y=await t.confirm({type:"question",title:d(11261,null),message:d(11258,null),detail:d(11260,null),primaryButton:d(11262,null),cancelButton:d(11259,null),checkbox:{label:d(11257,null),checked:!1}}),!o.getFocusedCodeEditor()||y.confirmed?(s.trace("InlineChatEscapeToolContribution: moving session to panel chat"),await c.invokeFunction(OUt,v)):(s.trace("InlineChatEscapeToolContribution: rephrase prompt"),c.invokeFunction(Eho,v)),y.checkboxChecked&&(l.store(HW.DONT_ASK_AGAIN_KEY,y.confirmed,0,0),s.trace("InlineChatEscapeToolContribution: stored don't ask again preference")),{content:[{kind:"text",value:"Success"}]}}}))}};HW=I([m(0,Vn),m(1,yI),m(2,at),m(3,qt),m(4,B),m(5,mi),m(6,se),m(7,ce),m(8,F)],HW);W(class extends K{constructor(){super({id:"inlineChat.resetMoveToPanelChatChoice",precondition:ie.Setup.hidden.negate(),title:L(11264,"Reset Choice for 'Move Inline Chat to Panel Chat'"),f1:!0})}run(i){i.get(ce).remove(HW.DONT_ASK_AGAIN_KEY,0)}});var ojt=class{constructor(){this.priority=106;this.name="inlineChat";this.type="help";this.when=C.or(C1t,ie.inputHasFocus)}getProvider(i){let e=i.get(qt).getActiveCodeEditor()||i.get(qt).getFocusedCodeEditor();if(e)return D0e(i,e,"inlineChat")}};xo(Nd.ID,Nd,0);W(q$t);W($$t);W(j$t);W(Q$t);W(Y$t);W(X$t);Ee(yI,nBe,1);Ee(U1t,QAe,1);var Wdn={group:"0_main",order:0,command:{id:BT.ID,title:d(11218,null)},when:C.and(ie.inputHasText,OAe.toNegated(),CTi,hit)},Vdn={group:"0_main",order:0,command:{id:BT.ID,title:d(11219,null)},when:C.and(ie.inputHasText,OAe.toNegated(),CTi.toNegated(),hit)};ve.appendMenuItem(Ate,Wdn);ve.appendMenuItem(Ate,Vdn);var Bdn={group:"0_main",order:0,command:{id:$it.ID,title:d(11216,null),shortTitle:d(11217,null)},when:C.and(OAe)};ve.appendMenuItem(Ate,Bdn);W(z$t);W(ejt);W(K$t);W(J$t);W(ijt);W(Z$t);W(G$t);W(tjt);var Hdn=ne.as(Qi.Workbench);Hdn.registerWorkbenchContribution(oBe,3);It(ive.Id,ive,St.AfterRestored);It(HW.Id,HW,St.AfterRestored);ga.register(new ojt);var iko="mcp.extCachedServers",Udn=Rn.registerExtensionPoint(wpo);var ine=class extends x{constructor(e,t,o,n){super();this._mcpRegistry=e;this._extensionService=o;this._contextKeyService=n;this.fromGallery=!1;this._extensionCollectionIdsToPersist=new Map;this._conditionalCollections=this._register(new Vt);this.cachedServers=t.getObject(iko,1,{}),this._register(t.onWillSaveState(()=>{let r=!1;for(let[s,l]of this._extensionCollectionIdsToPersist.entries()){let c=this._mcpRegistry.collections.get().find(p=>p.id===s),u=c?.serverDefinitions.get();if(!c||c.lazy)if(l===1)u=[];else continue;u&&(r=!0,this.cachedServers[s]={servers:u.map(VB.toSerialized)})}r&&t.store(iko,this.cachedServers,1,1)}))}start(){let e=this._register(new Vt);this._register(Udn.setHandler((t,o)=>{let{added:n,removed:r}=o;for(let s of r)for(let l of s.value){let c=I7e(s.description.identifier,l.id);e.deleteAndDispose(c),this._conditionalCollections.deleteAndDispose(c)}for(let s of n)if(ine._validate(s))for(let l of s.value){let c=I7e(s.description.identifier,l.id);this._extensionCollectionIdsToPersist.set(c,0),l.when?this._registerConditionalCollection(c,l,s,e):this._registerCollection(c,l,s,e)}}))}_registerCollection(e,t,o,n){let r=this.cachedServers.hasOwnProperty(e)?this.cachedServers[e].servers:void 0,s=this._mcpRegistry.registerCollection({id:e,label:t.label,remoteAuthority:null,trustBehavior:Ek.Kind.Trusted,scope:1,configTarget:2,serverDefinitions:Me(this,r?.map(VB.fromSerialized)||[]),lazy:{isCached:!!r,load:()=>this._activateExtensionServers(t.id).then(()=>{this._extensionCollectionIdsToPersist.set(e,1)}),removed:()=>{n.deleteAndDispose(e),this._conditionalCollections.deleteAndDispose(e)}},source:o.description.identifier});n.set(e,s)}_registerConditionalCollection(e,t,o,n){let r=C.deserialize(t.when);if(!r)return;let s=()=>{let c=this._contextKeyService.contextMatchesRules(r),u=n.has(e);c&&!u?this._registerCollection(e,t,o,n):!c&&u&&n.deleteAndDispose(e)},l=this._contextKeyService.onDidChangeContext(s);s(),this._conditionalCollections.set(e,l)}async _activateExtensionServers(e){await this._extensionService.activateByEvent($et(e)),await Promise.all(this._mcpRegistry.delegates.get().map(t=>t.waitForInitialProviderPromises()))}static _validate(e){if(!Array.isArray(e.value))return e.collector.error(d(12020,null)),!1;for(let t of e.value){if(typeof t.id!="string"||uc(t.id))return e.collector.error(d(12021,null)),!1;if(typeof t.label!="string"||uc(t.label))return e.collector.error(d(12022,null)),!1;if(t.when!==void 0&&(typeof t.when!="string"||uc(t.when)))return e.collector.error(d(12023,null)),!1}return!0}};ine=I([m(0,Lc),m(1,ce),m(2,lt),m(3,X)],ine);var oko=a=>{let i=_R(a.model.getValue()),e=OC(i,a.pathToServers);if(!e||e.type!=="object")return new Map;let t=new Map;for(let o of e.children||[]){if(o.type!=="property"||o.children?.[0]?.type!=="string")continue;let n=a.model.getPositionAt(o.offset),r=a.model.getPositionAt(o.offset+o.length);t.set(o.children[0].value,{uri:a.model.uri,range:{startLineNumber:n.lineNumber,startColumn:n.column,endLineNumber:r.lineNumber,endColumn:r.column}})}return t};var rBe=class extends x{constructor(e,t,o,n){super();this.mcpWorkbenchService=e;this.mcpRegistry=t;this.textModelService=o;this.logService=n;this.fromGallery=!0;this.collections=this._register(new Vt)}start(){let e=this._register(new gu);this._register(this.mcpWorkbenchService.onChange(()=>e.queue(()=>this.sync()))),this.sync()}async getServerIdMapping(e,t){let o=new N;try{let n=await this.textModelService.createModelReference(e);return o.add(n),oko({model:n.object.textEditorModel,pathToServers:t})}catch{return new Map}finally{o.dispose()}}async sync(){try{let e=new Map,t=new gt;for(let o of this.mcpWorkbenchService.getEnabledLocalMcpServers()){let n=t.get(o.mcpResource);n||(n=(async p=>{let h=this.mcpWorkbenchService.getMcpConfigPath(p),g=h?.uri?await this.getServerIdMapping(h?.uri,h.section?[...h.section,"servers"]:["servers"]):new Map;return h?{...h,locations:g}:void 0})(o),t.set(o.mcpResource,n));let r=o.config,s=await n,l=`mcp.config.${s?s.id:"unknown"}`,c=e.get(l);c||(c=[s,[]],e.set(l,c));let u=r.type==="http"?{type:2,uri:A.parse(r.url),headers:Object.entries(r.headers||{})}:{type:1,command:r.command,args:r.args||[],env:r.env||{},envFile:r.envFile,cwd:r.cwd,sandbox:o.rootSandbox};c[1].push({id:`${l}.${o.name}`,label:o.name,launch:u,sandboxEnabled:r.type==="http"?void 0:r.sandboxEnabled,cacheNonce:await yA.hash(u),roots:s?.workspaceFolder?[s.workspaceFolder.uri]:void 0,variableReplacement:{folder:s?.workspaceFolder,section:j0,target:s?.target??2},devMode:r.dev,presentation:{order:s?.order,origin:s?.locations.get(o.name)}})}for(let[o]of this.collections)e.has(o)||this.collections.deleteAndDispose(o);for(let[o,[n,r]]of e){let s=Me(this,r),l={id:o,label:n?.label??"",presentation:{order:r[0]?.presentation?.order,origin:n?.uri},remoteAuthority:n?.remoteAuthority??null,serverDefinitions:s,trustBehavior:Ek.Kind.Trusted,configTarget:n?.target??2,scope:n?.scope??0},c=this.collections.get(o);if(!(c?!afi.equals(c.definition,l):!0)){(!c||!$i(c.definition.serverDefinitions.get(),l.serverDefinitions.get(),VB.equals))&&c?.serverDefinitions.set(r,void 0);continue}this.collections.deleteAndDispose(o);let p=this.mcpRegistry.registerCollection(l);this.collections.set(o,{definition:l,serverDefinitions:s,dispose:()=>p.dispose()})}}catch(e){this.logService.error(e)}}};rBe=I([m(0,Ng),m(1,Lc),m(2,Bt),m(3,se)],rBe);var zNi=class{constructor(){this._discovery=[]}register(i){this._discovery.push(i)}getAll(){return this._discovery}},Tq=new zNi;var _Ng=le("INativeMcpDiscoveryHelperService"),njt="NativeMcpDiscoveryHelper";async function KNi(a,i,e){let t;try{t=JSON.parse(i.toString())}catch{return}return Promise.all(Object.entries(t.mcpServers).map(async([o,n])=>{let r=n.url?{type:2,uri:A.parse(n.url),headers:[]}:{type:1,args:n.args||[],command:n.command,env:n.env||{},envFile:void 0,cwd:e?.fsPath,sandbox:void 0};return{id:`${a}.${o}`,label:o,launch:r,cacheNonce:await yA.hash(r)}}))}var sBe=class{constructor(i){this.remoteAuthority=i;this.order=400;this.discoverySource="claude-desktop";this.id=`claude-desktop.${this.remoteAuthority}`}getFilePath({platform:i,winAppData:e,xdgHome:t,homedir:o}){if(i===3){let n=e||A.joinPath(o,"AppData","Roaming");return A.joinPath(n,"Claude","claude_desktop_config.json")}else{if(i===1)return A.joinPath(o,"Library","Application Support","Claude","claude_desktop_config.json");{let n=t||A.joinPath(o,".config");return A.joinPath(n,"Claude","claude_desktop_config.json")}}}adaptFile(i,{homedir:e}){return KNi(this.id,i,e)}},rjt=class extends sBe{constructor(e){super(e);this.discoverySource="windsurf";this.id=`windsurf.${this.remoteAuthority}`}getFilePath({homedir:e}){return A.joinPath(e,".codeium","windsurf","mcp_config.json")}},sjt=class extends sBe{constructor(e){super(e);this.discoverySource="cursor-global";this.id=`cursor.${this.remoteAuthority}`}getFilePath({homedir:e}){return A.joinPath(e,".cursor","mcp.json")}};var ove=class extends x{constructor(e,t,o){super();this._fileService=t;this._mcpRegistry=o;this.fromGallery=!1;this._fsDiscoveryEnabled=hr(Kee,void 0,e)}_isDiscoveryEnabled(e,t){let o=this._fsDiscoveryEnabled.read(e);return typeof o=="boolean"?o:!!(t&&o?.[t]===!0)}watchFile(e,t,o,n){let r=new N,s=r.add(new me),l=async()=>{let c=[];try{let u=await this._fileService.readFile(e);c=await n(u.value)||[]}catch{}c.length?(t.serverDefinitions.set(c,void 0),s.value||(s.value=this._mcpRegistry.registerCollection(t))):s.clear()};return r.add(be(c=>{if(!this._isDiscoveryEnabled(c,o)){s.clear();return}let u=c.store.add(new Dt(l,500)),p=c.store.add(this._fileService.createWatcher(e,{recursive:!1,excludes:[]}));c.store.add(p.onDidChange(()=>u.schedule())),l()})),r}};ove=I([m(0,B),m(1,fe),m(2,Lc)],ove);var one=class extends ove{constructor(e,t,o,n,r,s){super(s,o,r);this.suffix="";e&&(this.suffix=" "+d(12024,null,t.getHostLabel(Q.vscodeRemote,e))),this.adapters=[n.createInstance(sBe,e),n.createInstance(sjt,e),n.createInstance(rjt,e)]}setDetails(e){if(!e)return;let t={...e,homedir:A.revive(e.homedir),xdgHome:e.xdgHome?A.revive(e.xdgHome):void 0,winAppData:e.winAppData?A.revive(e.winAppData):void 0};for(let o of this.adapters){let n=o.getFilePath(t);if(!n)continue;let r={id:o.id,label:vpo[o.discoverySource]+this.suffix,remoteAuthority:o.remoteAuthority,configTarget:2,scope:0,trustBehavior:Ek.Kind.TrustedOnNonce,serverDefinitions:Me(this,[]),presentation:{origin:n,order:o.order+(o.remoteAuthority?-50:0)}};this._register(this.watchFile(n,r,o.discoverySource,s=>o.adaptFile(s,t)))}}};one=I([m(1,rt),m(2,fe),m(3,F),m(4,Lc),m(5,B)],one);var aBe=class extends one{constructor(e,t,o,n,r,s,l){super(e.getConnection()?.remoteAuthority||null,o,n,r,s,l);this.remoteAgent=e;this.logService=t}async start(){let e=this.remoteAgent.getConnection();if(!e)return this.setDetails(void 0);await e.withChannel(njt,async t=>{Tc.toService(t).load().then(n=>this.setDetails(n),n=>{this.logService.warn("Error getting remote process MCP environment",n),this.setDetails(void 0)})})}};aBe=I([m(0,bo),m(1,se),m(2,rt),m(3,fe),m(4,F),m(5,Lc),m(6,B)],aBe);var lBe=class extends x{constructor(e,t){super();this._agentPluginService=e;this._mcpRegistry=t;this.fromGallery=!1;this._collections=this._register(new Xb)}start(){this._register(be(e=>{let t=this._agentPluginService.plugins.read(e),o=new En;for(let n of t){if(!Ub(n.enablement.read(e)))continue;let r=n.mcpServerDefinitions.read(e);if(r.length===0)continue;o.add(n.uri);let s=this._collections.get(n.uri);s||(s=this.createCollectionState(n,r[0].uri),this._collections.set(n.uri,s))}for(let[n]of this._collections)o.has(n)||this._collections.deleteAndDispose(n)}))}createCollectionState(e,t){let o=`plugin.${e.uri}`;return this._mcpRegistry.registerCollection({id:o,label:`${e.label} (Agent Plugin)`,remoteAuthority:e.uri.scheme===Q.vscodeRemote?e.uri.authority:null,configTarget:2,scope:0,trustBehavior:Ek.Kind.Trusted,serverDefinitions:e.mcpServerDefinitions.map(n=>n.map(r=>this._toServerDefinition(o,r)).filter(lo)),presentation:{origin:t,order:350}})}_toServerDefinition(e,{name:t,configuration:o}){let n=this._toLaunch(o);if(n)return{id:`${e}.${t}`,label:t,launch:n,variableReplacement:{target:2},cacheNonce:String(_r(n))}}_toLaunch(e){if(e.type==="stdio")return{type:1,command:e.command,args:e.args?[...e.args]:[],env:e.env?{...e.env}:{},envFile:e.envFile,cwd:e.cwd,sandbox:void 0};try{return{type:2,uri:A.parse(e.url),headers:Object.entries(e.headers??{})}}catch{return}}};lBe=I([m(0,Gg),m(1,Lc)],lBe);var cBe=class extends ove{constructor(e,t,o,n,r){super(n,e,o);this._workspaceContextService=t;this._remoteAgentService=r;this._collections=this._register(new Vt)}start(){this._register(this._workspaceContextService.onDidChangeWorkspaceFolders(e=>{for(let t of e.removed)this._collections.deleteAndDispose(t.uri.toString());for(let t of e.added)this.watchFolder(t)}));for(let e of this._workspaceContextService.getWorkspace().folders)this.watchFolder(e)}watchFolder(e){let t=Ge(e.uri,".cursor","mcp.json"),o={id:`cursor-workspace.${e.index}`,label:`${e.name}/.cursor/mcp.json`,remoteAuthority:this._remoteAgentService.getConnection()?.remoteAuthority||null,scope:1,trustBehavior:Ek.Kind.TrustedOnNonce,serverDefinitions:Me(this,[]),configTarget:6,presentation:{origin:t,order:1}};this._collections.set(e.uri.toString(),this.watchFile(A.joinPath(e.uri,".cursor","mcp.json"),o,"cursor-workspace",async n=>{let r=await KNi(o.id,n,e.uri);return r?.forEach(s=>s.roots=[e.uri]),r}))}};cBe=I([m(0,fe),m(1,Pe),m(2,Lc),m(3,B),m(4,bo)],cBe);var xU;(o=>(o.serverCount=new Y("mcp.serverCount",void 0,{type:"number",description:d(12067,null)}),o.hasUnknownTools=new Y("mcp.hasUnknownTools",void 0,{type:"boolean",description:d(12066,null)}),o.hasServersWithErrors=new Y("mcp.hasServersWithErrors",void 0,{type:"boolean",description:d(12065,null)}),o.toolsCount=new Y("mcp.toolsCount",void 0,{type:"number",description:d(12068,null)})))(xU||={});var dBe=class extends x{static{this.ID="workbench.contrib.mcp.contextKey"}constructor(i,e){super();let t=xU.serverCount.bindTo(e),o=xU.toolsCount.bindTo(e),n=xU.hasUnknownTools.bindTo(e);this._store.add(Vd(xU.hasServersWithErrors,e,r=>i.servers.read(r).some(s=>s.connectionState.read(r).state===dr.Kind.Error))),this._store.add(be(r=>{let s=i.servers.read(r),l=s.map(c=>c.tools.read(r));t.set(s.length),o.set(l.reduce((c,u)=>c+u.length,0)),n.set(i.lazyCollectionState.read(r).state!==2||s.some(c=>{let u=c.cacheState.read(r);return u===0||u===2||u===3}))}))}};dBe=I([m(0,_s),m(1,X)],dBe);var uBe=le("imageResizeMainService");var nve=class extends x{constructor(e,t,o,n,r){super();this._toolsService=e;this._instantiationService=o;this._mcpRegistry=n;this.lifecycleService=r;let s=this._register(new Vt);this._register(be(l=>{let c=t.servers.read(l),u=new Set(s.keys());for(let p of c){if(!Ub(p.enablement.read(l)))continue;let h=s.get(p);if(h){if(u.delete(p),!h.source||eo(h.source,BNe(p,l)))continue;h.dispose()}let g=new N,f={dispose:()=>g.dispose()},v=new co(()=>{let b=f.source=BNe(p),S=p.definition.label.toLowerCase().replace(/\s+/g,"-");return{toolSet:g.add(this._toolsService.createToolSet(b,p.definition.id,S,{icon:R.mcp,description:d(12072,null,p.definition.label)})),source:b}});this._syncTools(p,v,g),s.set(p,f)}for(let p of u)s.deleteAndDispose(p)}))}static{this.ID="workbench.contrib.mcp.languageModelTools"}_syncTools(e,t,o){let n=new Map,r=this._mcpRegistry.collections.map(s=>s.find(l=>l.id===e.collection.id));o.add(be(s=>{let l=new Set(n.keys()),c=[],u=(h,g,f)=>{f.add(this._toolsService.registerTool(g,this._instantiationService.createInstance(Yst,h,e))),f.add(t.value.toolSet.addTool(g))};if(this.lifecycleService.willShutdown)return;let p=r.read(s);if(!p){n.forEach(h=>h.store.dispose()),n.clear();return}for(let h of e.tools.read(s)){if(!(h.visibility&1))continue;let g=n.get(h.id),f=h.icons.getUrl(22),v={id:h.id,source:t.value.source,icon:f||R.tools,displayName:h.definition.annotations?.title||h.definition.title||h.definition.name,toolReferenceName:h.referenceName,modelDescription:h.definition.description??"",userDescription:h.definition.description??"",inputSchema:h.definition.inputSchema,canBeReferencedInPrompt:!0,alwaysDisplayInputOutput:!0,canRequestPreApproval:!h.definition.annotations?.readOnlyHint,canRequestPostApproval:!!h.definition.annotations?.openWorldHint,runsInWorkspace:p?.scope===1||!!p?.remoteAuthority,tags:["mcp"]};if(g)eo(g.toolData,v)||(g.toolData=v,g.store.clear(),u(h,v,g.store)),l.delete(h.id);else{let b=new N;c.push(()=>u(h,v,b)),n.set(h.id,{toolData:v,store:b})}}for(let h of l){let g=n.get(h);g&&(g.store.dispose(),n.delete(h))}for(let h of c)h();this._toolsService.flushToolUpdates()})),o.add(Z(()=>{for(let s of n.values())s.store.dispose()}))}};nve=I([m(0,Vn),m(1,_s),m(2,F),m(3,Lc),m(4,ji)],nve);var Yst=class{constructor(i,e,t,o,n,r){this._tool=i;this._server=e;this._configurationService=t;this._productService=o;this._fileService=n;this._imageResizeService=r}async prepareToolInvocation(i){let e=this._tool,t=this._server,n=await $v.callOn(t,async(u,p)=>p.definition.sandboxEnabled)===!0,r=d(12071,null,this._productService.nameShort),s=e.definition.annotations?.title||e.definition.title||"`"+e.definition.name+"`",l;n||(l={},e.definition.annotations?.readOnlyHint||(l.title=new Ie(d(12076,null,s)),l.message=new Ie(e.definition.description,{supportThemeIcons:!0}),l.disclaimer=r,l.allowAutoConfirm=!0),e.definition.annotations?.openWorldHint&&(l.confirmResults=!0));let c=this._configurationService.getValue(tHt);return{confirmationMessages:l,invocationMessage:new Ie(d(12074,null,s)),pastTenseMessage:new Ie(d(12073,null,s)),originMessage:d(12075,null,t.definition.label),toolSpecificData:{kind:"input",rawInput:i.parameters,mcpAppData:c&&e.uiResourceUri?{resourceUri:e.uiResourceUri,serverDefinitionId:t.definition.id,collectionId:t.collection.id}:void 0}}}async invoke(i,e,t,o){let n={content:[]},r=await this._tool.callWithProgress(i.parameters,t,{chatRequestId:i.chatRequestId,chatSessionResource:i.context?.sessionResource},o),s={input:JSON.stringify(i.parameters,void 0,2),output:[],isError:r.isError===!0};for(let l of r.content){let c=l.annotations?.audience?.map(g=>g==="assistant"?0:g==="user"?1:void 0).filter(lo);c?.includes(1)&&l.type==="text"&&t.report({message:l.text});let u=async(g,f,v)=>{if(s.output.push({type:"embed",mimeType:g,value:f,uri:v,audience:c}),h){let b;try{let S=await this._imageResizeService.resizeImage(qa(f).buffer,g);b=qe.wrap(S)}catch{b=qa(f)}n.content.push({kind:"data",value:{mimeType:g,data:b},audience:c})}},p=(g,f)=>{let v={uri:g,underlyingMimeType:f};n.content.push({kind:"data",audience:c,value:{mimeType:Loo,data:qe.fromString(JSON.stringify(v))}})},h=!c||c.includes(0);if(l.type==="text")s.output.push({type:"embed",isText:!0,value:l.text}),h&&!r.structuredContent&&n.content.push({kind:"text",audience:c,value:l.text});else if(l.type==="image"||l.type==="audio")await u(l.mimeType||"image/png",l.data);else if(l.type==="resource_link"){let g=Bw.fromServer(this._server.definition,l.uri);s.output.push({type:"ref",uri:g,audience:c,mimeType:l.mimeType}),h&&(l.mimeType&&f3(l.mimeType)?n.content.push({kind:"data",audience:c,value:{mimeType:l.mimeType,data:await this._fileService.readFile(g).then(f=>f.value).catch(()=>qe.alloc(0))}}):p(g,l.mimeType))}else if(l.type==="resource"){let g=Bw.fromServer(this._server.definition,l.resource.uri);if(l.resource.mimeType&&f3(l.resource.mimeType)&&"blob"in l.resource)await u(l.resource.mimeType,l.resource.blob,g);else if(s.output.push({type:"embed",uri:g,isText:"text"in l.resource,mimeType:l.resource.mimeType,value:"blob"in l.resource?l.resource.blob:l.resource.text,audience:c,asResource:!0}),h){let f=i.context&&CT.createUri(i.context.sessionResource,i.callId,n.content.length,He(g));p(f||g,l.resource.mimeType)}}}return r.structuredContent&&(s.output.push({type:"embed",isText:!0,value:JSON.stringify(r.structuredContent,null,2),audience:[0]}),n.content.push({kind:"text",value:JSON.stringify(r.structuredContent),audience:[0]})),this._tool.uiResourceUri&&(s.mcpOutput=r),n.toolResultDetails=s,n}};Yst=I([m(2,B),m(3,tt),m(4,fe),m(5,uBe)],Yst);var rko="mcpEncryptionKey",ajt="AES-GCM",Kdn=256,Gdn=12,GNi=1,sko="mcpInputs",n6=class extends x{constructor(e,t,o,n,r){super();this._scope=e;this._storageService=o;this._secretStorageService=n;this._logService=r;this._secretsSealerSequencer=new rm;this._getEncryptionKey=new co(()=>n6.secretSequencer.queue(async()=>{let e=await this._secretStorageService.get(rko);if(e)try{let n=JSON.parse(e);return await crypto.subtle.importKey("jwk",n,ajt,!1,["encrypt","decrypt"])}catch{}let t=await crypto.subtle.generateKey({name:ajt,length:Kdn},!0,["encrypt","decrypt"]),o=await crypto.subtle.exportKey("jwk",t);return await this._secretStorageService.set(rko,JSON.stringify(o)),t}));this._didChange=!1;this._record=new co(()=>{let e=this._storageService.getObject(sko,this._scope);return e?.version===GNi?{...e}:{version:GNi,values:{}}});this._register(o.onWillSaveState(()=>{this._didChange&&(this._storageService.store(sko,{version:GNi,values:this._record.value.values,secrets:this._record.value.secrets},this._scope,t),this._didChange=!1)}))}static{this.secretSequencer=new rm}clearAll(){this._record.value.values={},this._record.value.secrets=void 0,this._record.value.unsealedSecrets=void 0,this._didChange=!0}async clear(e){let t=await this._unsealSecrets();delete this._record.value.values[e],this._didChange=!0,t.hasOwnProperty(e)&&(delete t[e],await this._sealSecrets())}async getMap(){let e=await this._unsealSecrets();return{...this._record.value.values,...e}}async setPlainText(e){Object.assign(this._record.value.values,e),this._didChange=!0}async setSecrets(e){let t=await this._unsealSecrets();Object.assign(t,e),await this._sealSecrets()}async _sealSecrets(){let e=await this._getEncryptionKey.value;return this._secretsSealerSequencer.queue(async()=>{if(!this._record.value.unsealedSecrets||Of(this._record.value.unsealedSecrets)){this._record.value.secrets=void 0;return}let t=JSON.stringify(this._record.value.unsealedSecrets),o=crypto.getRandomValues(new Uint8Array(Gdn)),n=await crypto.subtle.encrypt({name:ajt,iv:o.buffer},e,new TextEncoder().encode(t).buffer),r=Yd(qe.wrap(new Uint8Array(n)));this._record.value.secrets={iv:Yd(qe.wrap(o)),value:r},this._didChange=!0})}async _unsealSecrets(){if(!this._record.value.secrets)return this._record.value.unsealedSecrets??={};if(this._record.value.unsealedSecrets)return this._record.value.unsealedSecrets;try{let e=await this._getEncryptionKey.value,t=qa(this._record.value.secrets.iv),o=qa(this._record.value.secrets.value),n=await crypto.subtle.decrypt({name:ajt,iv:t.buffer},e,o.buffer),r=JSON.parse(new TextDecoder().decode(n));return this._record.value.unsealedSecrets=r,r}catch(e){this._logService.warn("Error unsealing MCP secrets",e),this._record.value.secrets=void 0}return{}}};n6=I([m(2,ce),m(3,Dw),m(4,se)],n6);var nne=class extends Error{constructor(e,t,o){super(t);this.code=e;this.data=o}},ljt=class a extends x{constructor(e,t){super();this._send=e;this._handlers=t;this._nextRequestId=1;this._pendingRequests=new Map}static{this.ParseError=-32700}static{this.MethodNotFound=-32601}static{this.InternalError=-32603}sendNotification(e){this._send({jsonrpc:"2.0",...e})}sendRequest(e,t=Se.None,o){if(this._store.isDisposed)return Promise.reject(new go);let n=this._nextRequestId++,r=new Ko,s=new Ye;this._pendingRequests.set(n,{promise:r,cts:s});let l=t.onCancellationRequested(()=>{r.isSettled||(this._pendingRequests.delete(n),s.cancel(),o?.(n),r.cancel()),l.dispose()});return this._send({jsonrpc:"2.0",id:n,...e}),r.p.finally(()=>{l.dispose(),this._pendingRequests.delete(n),s.dispose(!0)})}async handleMessage(e){if(Array.isArray(e)){let o=[];for(let n of e){let r=await this._handleMessage(n);r&&o.push(r)}return o}let t=await this._handleMessage(e);return t?[t]:[]}cancelPendingRequest(e){let t=this._pendingRequests.get(e);t&&(this._pendingRequests.delete(e),t.cts.cancel(),t.promise.cancel(),t.cts.dispose(!0))}cancelAllRequests(){for(let[e,t]of this._pendingRequests)this._pendingRequests.delete(e),t.cts.cancel(),t.promise.cancel(),t.cts.dispose(!0)}async _handleMessage(e){if($dn(e)){No(e,{result:!0})?this._handleResult(e):this._handleError(e);return}if(qdn(e))return this._handleRequest(e);jdn(e)&&this._handlers.handleNotification?.(e)}_handleResult(e){let t=this._pendingRequests.get(e.id);t&&(this._pendingRequests.delete(e.id),t.promise.complete(e.result),t.cts.dispose(!0))}_handleError(e){if(e.id===void 0)return;let t=this._pendingRequests.get(e.id);t&&(this._pendingRequests.delete(e.id),t.promise.error(new nne(e.error.code,e.error.message,e.error.data)),t.cts.dispose(!0))}async _handleRequest(e){if(!this._handlers.handleRequest){let o={jsonrpc:"2.0",id:e.id,error:{code:a.MethodNotFound,message:`Method not found: ${e.method}`}};return this._send(o),o}let t=new Ye;this._register(Z(()=>t.dispose(!0)));try{let o=this._handlers.handleRequest(e,t.token),n=Qdn(o)?await o:o,r={jsonrpc:"2.0",id:e.id,result:n};return this._send(r),r}catch(o){let n;return o instanceof nne?n={jsonrpc:"2.0",id:e.id,error:{code:o.code,message:o.message,data:o.data}}:n={jsonrpc:"2.0",id:e.id,error:{code:a.InternalError,message:o instanceof Error?o.message:"Internal error"}},this._send(n),n}finally{t.dispose(!0)}}dispose(){this.cancelAllRequests(),super.dispose()}static createParseError(e,t){return{jsonrpc:"2.0",error:{code:a.ParseError,message:e,data:t}}}};function qdn(a){return"method"in a&&"id"in a&&(typeof a.id=="string"||typeof a.id=="number")}function $dn(a){return No(a,{id:!0,result:!0})||No(a,{id:!0,error:!0})}function jdn(a){return No(a,{method:!0})&&!No(a,{id:!0})}function Qdn(a){return typeof a=="object"&&a!==null&&"then"in a&&typeof a.then=="function"}var cjt=class a extends x{constructor({launch:e,logger:t,createMessageRequestHandler:o,elicitationRequestHandler:n,requestLogLevel:r=2,taskManager:s}){super();this._hasAnnouncedRoots=!1;this._roots=[];this._onDidReceiveCancelledNotification=this._register(new E);this.onDidReceiveCancelledNotification=this._onDidReceiveCancelledNotification.event;this._onDidReceiveProgressNotification=this._register(new E);this.onDidReceiveProgressNotification=this._onDidReceiveProgressNotification.event;this._onDidReceiveElicitationCompleteNotification=this._register(new E);this.onDidReceiveElicitationCompleteNotification=this._onDidReceiveElicitationCompleteNotification.event;this._onDidChangeResourceList=this._register(new E);this.onDidChangeResourceList=this._onDidChangeResourceList.event;this._onDidUpdateResource=this._register(new E);this.onDidUpdateResource=this._onDidUpdateResource.event;this._onDidChangeToolList=this._register(new E);this.onDidChangeToolList=this._onDidChangeToolList.event;this._onDidChangePromptList=this._register(new E);this.onDidChangePromptList=this._onDidChangePromptList.event;this._launch=e,this.logger=t,this._requestLogLevel=r,this._createMessageRequestHandler=o,this._elicitationRequestHandler=n,this._taskManager=s,this._rpc=this._register(new ljt(l=>this.send(l),{handleRequest:(l,c)=>this.handleServerRequest(l,c),handleNotification:l=>this.handleServerNotification(l)})),this._taskManager.setHandler(this),this._register(this._taskManager.onDidUpdateTask(l=>{this.send({jsonrpc:Bv.JSONRPC_VERSION,method:"notifications/tasks/status",params:l})})),this._register(Z(()=>this._taskManager.setHandler(void 0))),this._register(e.onDidReceiveMessage(l=>{VIe(this.logger.getLevel(),this._requestLogLevel)&&Sae(this.logger,this._requestLogLevel,`[server -> editor] ${JSON.stringify(l)}`),this._rpc.handleMessage(l)})),this._register(be(l=>{let c=e.state.read(l).state;(c===dr.Kind.Error||c===dr.Kind.Stopped)&&this.cancelAllRequests()})),this._register(t.onDidChangeLogLevel(l=>{this._sendLogLevelToServer(l)}))}set roots(e){$i(this._roots,e)||(this._roots=e,this._hasAnnouncedRoots&&(this.sendNotification({method:"notifications/roots/list_changed"}),this._hasAnnouncedRoots=!1))}get capabilities(){return this._serverInit.capabilities}get serverInfo(){return this._serverInit.serverInfo}get serverInstructions(){return this._serverInit.instructions}static async create(e,t,o){let n=new a(t),r=new N;try{return r.add(new FI).cancelAndSet(()=>{t.logger.info("Waiting for server to respond to `initialize` request...")},5e3),await e.invokeFunction(async l=>{let c=l.get(tt),u=await n.sendRequest({method:"initialize",params:{protocolVersion:Bv.LATEST_PROTOCOL_VERSION,capabilities:{roots:{listChanged:!0},sampling:t.createMessageRequestHandler?{}:void 0,elicitation:t.elicitationRequestHandler?{form:{},url:{}}:void 0,tasks:{list:{},cancel:{},requests:{sampling:t.createMessageRequestHandler?{createMessage:{}}:void 0,elicitation:t.elicitationRequestHandler?{create:{}}:void 0}},extensions:{"io.modelcontextprotocol/ui":{mimeTypes:["text/html;profile=mcp-app"]}}},clientInfo:{name:c.nameLong,version:c.version}}},o);n._serverInit=u,n._sendLogLevelToServer(t.logger.getLevel()),n.sendNotification({method:"notifications/initialized"})}),n}catch(s){throw n.dispose(),s}finally{r.dispose()}}async sendRequest(e,t=Se.None){return this._store.isDisposed?Promise.reject(new go):this._rpc.sendRequest(e,t,o=>this.sendNotification({method:"notifications/cancelled",params:{requestId:o}})).catch(o=>{throw o instanceof nne?new WJ(o.message,o.code,o.data):o})}send(e){VIe(this.logger.getLevel(),this._requestLogLevel)&&Sae(this.logger,this._requestLogLevel,`[editor -> server] ${JSON.stringify(e)}`),this._launch.send(e)}async*sendRequestPaginated(e,t,o,n=Se.None){let r;do{let s={...o,cursor:r},l=await this.sendRequest({method:e,params:s},n);yield t(l),r=l.nextCursor}while(r!==void 0&&!n.isCancellationRequested)}sendNotification(e){this.send({...e,jsonrpc:Bv.JSONRPC_VERSION})}handleServerRequest(e,t){let o=n=>{if(n instanceof Tb)return new nne(n.code,n.message,n.data);this.logger.error(`Error handling request ${e.method}:`,n);let r=Tb.unknown(n instanceof Error?n:new Error(String(n)));return new nne(r.code,r.message,r.data)};try{let n;if(e.method==="ping")n=this.handlePing(e);else if(e.method==="roots/list")n=this.handleRootsList(e);else if(e.method==="sampling/createMessage"&&this._createMessageRequestHandler)if(e.params.task){let r=this._taskManager.createTask(e.params.task.ttl??null,s=>this._createMessageRequestHandler(e.params,s));r._meta??={},r._meta["io.modelcontextprotocol/related-task"]={taskId:r.task.taskId},n=r}else n=this._createMessageRequestHandler(e.params,t);else if(e.method==="elicitation/create"&&this._elicitationRequestHandler)if(e.params.task){let r=this._taskManager.createTask(e.params.task.ttl??null,s=>this._elicitationRequestHandler(e.params,s));r._meta??={},r._meta["io.modelcontextprotocol/related-task"]={taskId:r.task.taskId},n=r}else n=this._elicitationRequestHandler(e.params,t);else if(e.method==="tasks/get")n=this._taskManager.getTask(e.params.taskId);else if(e.method==="tasks/result")n=this._taskManager.getTaskResult(e.params.taskId);else if(e.method==="tasks/cancel")n=this._taskManager.cancelTask(e.params.taskId);else if(e.method==="tasks/list")n=this._taskManager.listTasks();else throw Tb.methodNotFound(e.method);return f_(n)?n.then(void 0,r=>{throw o(r)}):n}catch(n){throw o(n)}}handleServerNotification(e){try{switch(e.method){case"notifications/message":return this.handleLoggingNotification(e);case"notifications/cancelled":return this._onDidReceiveCancelledNotification.fire(e),this.handleCancelledNotification(e);case"notifications/progress":this._onDidReceiveProgressNotification.fire(e);return;case"notifications/resources/list_changed":this._onDidChangeResourceList.fire();return;case"notifications/resources/updated":this._onDidUpdateResource.fire(e);return;case"notifications/tools/list_changed":this._onDidChangeToolList.fire();return;case"notifications/prompts/list_changed":this._onDidChangePromptList.fire();return;case"notifications/elicitation/complete":this._onDidReceiveElicitationCompleteNotification.fire(e);return;case"notifications/tasks/status":this._taskManager.getClientTask(e.params.taskId)?.onDidUpdateState(e.params);return;default:}}catch(t){this.logger.error(`Error handling notification ${e.method}:`,t)}}handleCancelledNotification(e){e.params.requestId&&this._rpc.cancelPendingRequest(e.params.requestId)}handleLoggingNotification(e){Yzt(this.logger,e.params)}handlePing(e){return{}}handleRootsList(e){return this._hasAnnouncedRoots=!0,{roots:this._roots}}cancelAllRequests(){this._rpc.cancelAllRequests()}dispose(){this.cancelAllRequests(),super.dispose()}async _sendLogLevelToServer(e){try{if(!this.capabilities.logging)return;await this.setLevel({level:Ydn(e)})}catch(t){this.logger.error(`Failed to set MCP server log level: ${t}`)}}initialize(e,t){return this.sendRequest({method:"initialize",params:e},t)}listResources(e,t){return vt.asyncToArrayFlat(this.listResourcesIterable(e,t))}listResourcesIterable(e,t){return this.sendRequestPaginated("resources/list",o=>o.resources,e,t)}readResource(e,t){return this.sendRequest({method:"resources/read",params:e},t)}listResourceTemplates(e,t){return vt.asyncToArrayFlat(this.sendRequestPaginated("resources/templates/list",o=>o.resourceTemplates,e,t))}subscribe(e,t){return this.sendRequest({method:"resources/subscribe",params:e},t)}unsubscribe(e,t){return this.sendRequest({method:"resources/unsubscribe",params:e},t)}listPrompts(e,t){return vt.asyncToArrayFlat(this.sendRequestPaginated("prompts/list",o=>o.prompts,e,t))}getPrompt(e,t){return this.sendRequest({method:"prompts/get",params:e},t)}listTools(e,t){return vt.asyncToArrayFlat(this.sendRequestPaginated("tools/list",o=>o.tools,e,t))}async callTool(e,t,o){let n=await this.sendRequest({method:"tools/call",params:e},t);if(xvo(n)){let r=new $Ni(n.task,t,o);return this._taskManager.adoptClientTask(r),r.setHandler(this),r.result.finally(()=>{this._taskManager.abandonClientTask(r.id)})}return n}setLevel(e,t){return this.sendRequest({method:"logging/setLevel",params:e},t)}complete(e,t){return this.sendRequest({method:"completion/complete",params:e},t)}getTask(e,t){return this.sendRequest({method:"tasks/get",params:e},t)}getTaskResult(e,t){return this.sendRequest({method:"tasks/result",params:e},t)}cancelTask(e,t){return this.sendRequest({method:"tasks/cancel",params:e},t)}listTasks(e,t){return vt.asyncToArrayFlat(this.sendRequestPaginated("tasks/list",o=>o.tasks,e,t))}};function qNi(a){return a.status==="completed"||a.status==="failed"||a.status==="cancelled"}var $Ni=class extends x{constructor(e,t=Se.None,o){super();this._task=e;this._onStatusMessage=o;this.promise=new Ko;this._handler=Me("mcpTaskHandler",void 0);let n=e.ttl?Date.now()+e.ttl:void 0;this._lastTaskState=Me("lastTaskState",this._task);let r=this._register(new N);if(t.isCancellationRequested?this._lastTaskState.set({...this._task,status:"cancelled"},void 0):r.add(t.onCancellationRequested(()=>{let c=this._lastTaskState.get();qNi(c)||this._lastTaskState.set({...c,status:"cancelled"},void 0)})),n){let c=n-Date.now();c<=0?this._lastTaskState.set({...this._task,status:"cancelled",statusMessage:"Task timed out."},void 0):r.add(tn(()=>{let u=this._lastTaskState.get();qNi(u)||this._lastTaskState.set({...u,status:"cancelled",statusMessage:"Task timed out."},void 0)},c))}let s=Me("activeResultLookup",void 0);r.add(be(c=>{let u=this._lastTaskState.read(c);if(qNi(u))return;let p=s.read(c);if(p){let v=p.promiseResult.read(c);return Gi(b=>{v&&(v.data?(s.set(void 0,b),this._lastTaskState.set(v.data,b)):(s.set(void 0,b),v.error instanceof Tb&&v.error.code===Bv.INVALID_PARAMS?this._lastTaskState.set({...u,status:"cancelled"},void 0):this._lastTaskState.set({...u,status:"working"},void 0)))})}let h=this._handler.read(c);if(!h)return;let g=e.pollInterval??2e3,f=new Ye(t);c.store.add(Z(()=>f.dispose(!0))),c.store.add(tn(()=>{h.getTask({taskId:u.taskId},f.token).catch(v=>v instanceof Tb&&v.code===Bv.INVALID_PARAMS?{...u,status:"cancelled"}:{...u}).then(v=>{v&&!f.token.isCancellationRequested&&this._lastTaskState.set(v,void 0)})},g))}));let l=this._lastTaskState.map(c=>c.status);r.add(be(c=>{let u=l.read(c);if(u==="failed"){let p=this._lastTaskState.read(void 0);this.promise.error(new Error(`Task ${p.taskId} failed: ${p.statusMessage??"unknown error"}`)),r.dispose()}else if(u==="cancelled")this.promise.cancel(),r.dispose();else if(u==="input_required"){let p=this._handler.read(c);if(p){let h=this._lastTaskState.read(void 0),g=new Ye(t);c.store.add(Z(()=>g.dispose(!0))),s.set(new bd(p.getTask({taskId:h.taskId},g.token)),void 0)}}else if(u==="completed"){let p=this._handler.read(c);p&&(this.promise.settleWith(p.getTaskResult({taskId:e.taskId},t)),r.dispose())}else u==="working"||void 0}))}get result(){return this.promise.p}get id(){return this._task.taskId}onDidUpdateState(e){this._lastTaskState.set(e,void 0),e.statusMessage&&this._onStatusMessage&&this._onStatusMessage(e.statusMessage)}setHandler(e){this._handler.set(e,void 0)}};function Ydn(a){switch(a){case 1:return"debug";case 2:return"debug";case 3:return"info";case 4:return"warning";case 5:return"error";case 0:return"emergency";default:return os(a)}}var pBe=class extends x{constructor(e,t,o,n,r,s,l,c){super();this._collection=e;this.definition=t;this._delegate=o;this.launchDefinition=n;this._logger=r;this._errorOnUserInteraction=s;this._taskManager=l;this._instantiationService=c;this._launch=this._register(new me);this._state=Me("mcpServerState",{state:dr.Kind.Stopped});this._requestHandler=Me("mcpServerRequestHandler",void 0);this._onPotentialSandboxBlock=this._register(new E);this.state=this._state;this.handler=this._requestHandler;this.onPotentialSandboxBlock=this._onPotentialSandboxBlock.event}async start(e){let t=this._state.get();if(!dr.canBeStarted(t.state))return this._waitForState(dr.Kind.Running,dr.Kind.Error);this._launch.value=void 0,this._state.set({state:dr.Kind.Starting},void 0),this._logger.info(d(12118,null,this.definition.label));try{let o=this._delegate.start(this._collection,this.definition,this.launchDefinition,{errorOnUserInteraction:this._errorOnUserInteraction});return this._launch.value=this.adoptLaunch(o,e),this._waitForState(dr.Kind.Running,dr.Kind.Error)}catch(o){let n={state:dr.Kind.Error,message:o instanceof Error?o.message:String(o)};return this._state.set(n,void 0),n}}adoptLaunch(e,t){let o=new N,n=new Ye;o.add(Z(()=>n.dispose(!0))),o.add(e),o.add(e.onDidLog(({level:s,message:l})=>{Sae(this._logger,s,l);let c=this._toPotentialSandboxBlock(l);c&&this._onPotentialSandboxBlock.fire(c)}));let r=!1;return o.add(be(s=>{let l=e.state.read(s);this._state.set(l,void 0),this._logger.info(d(12119,null,dr.toString(l))),l.state===dr.Kind.Running&&!r&&(r=!0,cjt.create(this._instantiationService,{...t,launch:e,logger:this._logger,requestLogLevel:this.definition.devMode?3:2,taskManager:this._taskManager},n.token).then(c=>{o.isDisposed?c.dispose():this._requestHandler.set(c,void 0)},c=>{if(!o.isDisposed&&dr.isRunning(this._state.read(void 0))){let u=c.message;c instanceof go?(u="Server exited before responding to `initialize` request.",this._logger.error(u)):this._logger.error(c),this._state.set({state:dr.Kind.Error,message:u},void 0)}o.dispose()}))})),{dispose:()=>o.dispose(),object:e}}async stop(){this._logger.info(d(12120,null,this.definition.label)),this._launch.value?.object.stop(),await this._waitForState(dr.Kind.Stopped,dr.Kind.Error)}dispose(){this._requestHandler.get()?.dispose(),super.dispose(),this._state.set({state:dr.Kind.Stopped},void 0)}_waitForState(...e){let t=this._state.get();return e.includes(t.state)?Promise.resolve(t):new Promise(o=>{let n=be(r=>{let s=this._state.read(r);e.includes(s.state)&&(n.dispose(),o(s))})})}_toPotentialSandboxBlock(e){if(this.definition.sandboxEnabled){if(/No matching config rule, denying:/i.test(e))return{kind:"network",message:e,host:this._extractSandboxHost(e)};if(/(?:\b(?:EACCES|EPERM|ENOENT|EROFS|fail(?:ed|ure)?)\b|not accessible|read[- ]only)/i.test(e))return{kind:"filesystem",message:e,path:this._extractSandboxPath(e)}}}_extractSandboxPath(e){let t=e.match(/\[(\/[^\]\r\n]+)\]/);if(t?.[1])return t[1].trim();let o=e.match(/["'`](\/[^"'`]+)["'`]/);return o?.[1]?o[1]:e.match(/(\/[\w.\-~/ ]+)$/)?.[1]?.trim()}_extractSandboxHost(e){return e.match(/No matching config rule, denying:\s+(?<host>[^:\s]+):\d+\.?$/i)?.groups?.host}};pBe=I([m(7,F)],pBe);var jNi="__vscode_not_trusted",mBe=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this._instantiationService=e;this._configurationResolverService=t;this._dialogService=o;this._notificationService=n;this._editorService=r;this._quickInputService=l;this._labelService=c;this._logService=u;this._mcpSandboxService=p;this._workspaceTrustManagementService=h;this._workspaceTrustRequestService=g;this._collections=Me("collections",[]);this._delegates=Me("delegates",[]);this.collections=ke(e=>this._mcpAccessValue.read(e)==="none"?[]:this._collections.read(e));this._workspaceStorage=new co(()=>this._register(this._instantiationService.createInstance(n6,1,0)));this._profileStorage=new co(()=>this._register(this._instantiationService.createInstance(n6,0,0)));this._ongoingLazyActivations=Me(this,0);this.lazyCollectionState=ke(e=>{if(this._mcpAccessValue.read(e)==="none")return{state:2,collections:[]};if(this._ongoingLazyActivations.read(e)>0)return{state:1,collections:[]};let t=this._collections.read(e);return t.some(n=>n.lazy&&n.lazy.isCached===!1)?{state:0,collections:t.filter(n=>n.lazy&&n.lazy.isCached===!1)}:{state:2,collections:[]}});this._onDidChangeInputs=this._register(new E);this.onDidChangeInputs=this._onDidChangeInputs.event;this._mcpAccessValue=hr(Wk,"all",s)}get delegates(){return this._delegates}registerDelegate(e){let t=this._delegates.get().slice();return t.push(e),t.sort((o,n)=>n.priority-o.priority),this._delegates.set(t,void 0),{dispose:()=>{let o=this._delegates.get().filter(n=>n!==e);this._delegates.set(o,void 0)}}}registerCollection(e){let t=this._collections.get(),o=t.find(n=>n.id===e.id);return o&&!o.lazy?x.None:(o?this._collections.set(t.map(n=>n===o?e:n),void 0):this._collections.set([...t,e].sort((n,r)=>(n.presentation?.order||0)-(r.presentation?.order||0)),void 0),{dispose:()=>{let n=this._collections.get();this._collections.set(n.filter(r=>r!==e),void 0)}})}getServerDefinition(e,t){return this._collections.map(n=>n.find(r=>r.id===e.id)).map((n,r)=>{let s=n?.serverDefinitions.read(r).find(l=>l.id===t.id);return{collection:n,server:s}})}async discoverCollections(){let e=this._collections.get().filter(n=>n.lazy&&!n.lazy.isCached);this._ongoingLazyActivations.set(this._ongoingLazyActivations.get()+1,void 0),await Promise.all(e.map(n=>n.lazy?.load())).finally(()=>{this._ongoingLazyActivations.set(this._ongoingLazyActivations.get()-1,void 0)});let t=[],o=this._collections.get();for(let n of e){let r=o.find(s=>s.id===n.id);r&&(r.lazy?r.lazy.removed?.():t.push(r))}return t}_getInputStorage(e){return e===1?this._workspaceStorage.value:this._profileStorage.value}_getInputStorageInConfigTarget(e){return this._getInputStorage(e===5||e===6?1:0)}async clearSavedInputs(e,t){let o=this._getInputStorage(e);t?await o.clear(t):o.clearAll(),this._onDidChangeInputs.fire()}async editSavedInput(e,t,o,n){let r=this._getInputStorageInConfigTarget(n),s=TS.parse(e),c=(await r.getMap())[e].value;await this._configurationResolverService.resolveWithInteraction(t,s,o,c?{[e.slice(2,-1)]:c}:{},n),await this._updateStorageWithExpressionInputs(r,s)}async setSavedInput(e,t,o){let n=this._getInputStorageInConfigTarget(t),r=TS.parse(e);for(let s of r.unresolved()){r.resolve(s,o);break}await this._updateStorageWithExpressionInputs(n,r)}getSavedInputs(e){return this._getInputStorage(e).getMap()}async _checkTrust(e,t,{trustNonceBearer:o,interaction:n,promptType:r="only-new",autoTrustChanges:s=!1,errorOnUserInteraction:l=!1}){if(e.scope===1&&!this._workspaceTrustManagementService.isWorkspaceTrusted()){if(l)throw new Vw("workspaceTrust");if(!await this._workspaceTrustRequestService.requestWorkspaceTrust({message:d(12084,null)}))return!1}if(e.trustBehavior===Ek.Kind.Trusted)return this._logService.trace(`MCP server ${t.id} is trusted, no trust prompt needed`),!0;if(e.trustBehavior===Ek.Kind.TrustedOnNonce){if(t.cacheNonce===o.trustedAtNonce)return this._logService.trace(`MCP server ${t.id} is unchanged, no trust prompt needed`),!0;if(s)return this._logService.trace(`MCP server ${t.id} is was changed but user explicitly executed`),o.trustedAtNonce=t.cacheNonce,!0;if(o.trustedAtNonce===jNi)if(r==="all-untrusted"){if(l)throw new Vw("serverTrust");return this._promptForTrust(t,e,n,o)}else return this._logService.trace(`MCP server ${t.id} is untrusted, denying trust prompt`),!1;if(r==="never")return this._logService.trace(`MCP server ${t.id} trust state is unknown, skipping prompt`),!1;if(l)throw new Vw("serverTrust");let c=await this._promptForTrust(t,e,n,o);return c?!0:c===void 0?void 0:(o.trustedAtNonce=jNi,!1)}else os(e.trustBehavior)}async _promptForTrust(e,t,o,n){o??=new FJ,o.participants.set(e.id,{s:"waiting",definition:e,collection:t});let r=await new Promise(s=>{Ox(l=>{let c=o.participants.observable.read(l);vt.some(c.values(),u=>u.s==="unknown")||(l.dispose(),o.choice??=this._promptForTrustOpenDialog([...c.values()].map(u=>u.s==="waiting"?u:void 0).filter(lo)),s(o.choice))})});return this._logService.trace("MCP trusted servers:",r),r&&(n.trustedAtNonce=r.includes(e.id)?e.cacheNonce:jNi),!!r?.includes(e.id)}async _promptForTrustOpenDialog(e){function t(c){let u=c.definition.presentation?.origin?.uri||c.collection.presentation?.origin,p=u?`[\`${c.definition.label}\`](${u})`:"`"+c.definition.label+"`";return c.collection.source instanceof Ii&&(p+=` (${d(12085,null,c.collection.source.value)})`),p}if(e.length===1){let c=e[0],u=c.definition.presentation?.origin?.uri,{result:p}=await this._dialogService.prompt({message:d(12086,null,c.definition.label),custom:{icon:R.shield,markdownDetails:[{markdown:new Ie(d(12079,null,t(c))),actionHandler:()=>this._editorService.openEditor({resource:u},Mg).then(Boolean)}]},buttons:[{label:d(12083,null),run:()=>!0},{label:d(12081,null),run:()=>!1}]});return p===void 0?void 0:p?[c.definition.id]:[]}let o=e.map(c=>`- ${t(c)}`).join(`
`),{result:n}=await this._dialogService.prompt({message:d(12087,null,e.length),custom:{icon:R.shield,markdownDetails:[{markdown:new Ie(d(12080,null,o)),actionHandler:c=>this._editorService.openEditor({resource:A.parse(c)},Mg).then(Boolean)}]},buttons:[{label:d(12083,null),run:()=>"all"},{label:d(12082,null),run:()=>"pick"},{label:d(12081,null),run:()=>"none"}]});if(n===void 0)return;if(n==="all")return e.map(c=>c.definition.id);if(n==="none")return[];function r(c){return typeof c.action=="function"}let s=new N,l=s.add(this._quickInputService.createQuickPick({useSeparators:!1}));return l.canSelectMany=!0,l.items=e.map(({definition:c,collection:u})=>{let p=[];if(c.presentation?.origin){let h=c.presentation.origin;p.push({iconClass:"codicon-go-to-file",tooltip:"Go to Definition",action:()=>this._editorService.openEditor({resource:h.uri,options:{selection:h.range}})})}return{type:"item",label:c.label,definitonId:c.id,description:u.source instanceof Ii?u.source.value:c.presentation?.origin?this._labelService.getUriLabel(c.presentation.origin.uri):void 0,picked:!1,buttons:p}}),l.placeholder="Select MCP servers to trust",l.ignoreFocusOut=!0,s.add(l.onDidTriggerItemButton(c=>{r(c.button)&&c.button.action()})),new Promise(c=>{s.add(l.onDidAccept(()=>{c(l.selectedItems.map(u=>u.definitonId)),l.hide()})),s.add(l.onDidHide(()=>{c(void 0)})),l.show()}).finally(()=>s.dispose())}async _updateStorageWithExpressionInputs(e,t){let o={},n={};for(let[r,s]of t.resolved())s.input?.type==="promptString"&&s.input.password?o[r.id]=s:n[r.id]=s;e.setPlainText(n),await e.setSecrets(o),this._onDidChangeInputs.fire()}async _replaceVariablesInLaunch(e,t,o,n){if(!t.variableReplacement)return o;let{section:r,target:s,folder:l}=t.variableReplacement,c=this._getInputStorageInConfigTarget(s),[u,p]=await Promise.all([c.getMap(),e.substituteVariables(t,o)]),h=TS.parse(p);for(let g of h.unresolved())u.hasOwnProperty(g.id)&&h.resolve(g,u[g.id]);if(n&&Array.from(h.unresolved()).length>0)throw new Vw("variables");return await this._configurationResolverService.resolveWithInteraction(l,h,r,void 0,s),await this._updateStorageWithExpressionInputs(c,h),await this._configurationResolverService.resolveAsync(l,h)}async resolveConnection(e){let{collectionRef:t,definitionRef:o,interaction:n,logger:r,debug:s}=e,l=this._collections.get().find(g=>g.id===t.id);l?.lazy&&(await l.lazy.load(),l=this._collections.get().find(g=>g.id===t.id));let c=l?.serverDefinitions.get().find(g=>g.id===o.id);if(!l||!c)throw new Error(`Collection or definition not found for ${t.id} and ${o.id}`);let u=this._delegates.get().find(g=>g.canStart(l,c));if(!u)throw new Error("No delegate found that can handle the connection");let p=await this._checkTrust(l,c,e);if(n?.participants.set(c.id,{s:"resolved"}),!p)return;let h=c.launch;if(!(l.resolveServerLanch&&(h=await l.resolveServerLanch(c),!h))){try{h=await this._replaceVariablesInLaunch(u,c,h,e.errorOnUserInteraction),c.devMode&&s&&(h=await this._instantiationService.invokeFunction(g=>g.get(MOe).transform(c,h))),h=await this._mcpSandboxService.launchInSandboxIfEnabled(c,h,l.remoteAuthority??void 0,l.configTarget)}catch(g){if(g instanceof Vw)throw g;this._notificationService.notify({severity:ft.Error,message:d(12077,null,c.label,String(g)),actions:{primary:l.presentation?.origin&&[{id:"mcp.launchError.openConfig",class:void 0,enabled:!0,tooltip:"",label:d(12078,null),run:()=>this._editorService.openEditor({resource:l.presentation.origin,options:{selection:c.presentation?.origin?.range}})}]}});return}return this._instantiationService.createInstance(pBe,l,c,u,h,r,e.errorOnUserInteraction,e.taskManager)}}};mBe=I([m(0,F),m(1,Tp),m(2,at),m(3,Ne),m(4,ee),m(5,B),m(6,Ue),m(7,rt),m(8,se),m(9,AOe),m(10,Nr),m(11,Vu)],mBe);var Xdn=3e3,hBe=class extends x{constructor(e,t,o){super();this._instantiationService=e;this._fileService=t;this._webContentExtractorService=o;this._mcpServiceLazy=new co(()=>this._instantiationService.invokeFunction(e=>e.get(_s)));this._momentaryCache=new gt;this.onDidChangeCapabilities=U.None;this._onDidChangeFile=this._register(new E);this.onDidChangeFile=this._onDidChangeFile.event;this.capabilities=19474;this._register(this._fileService.registerProvider(Bw.scheme,this))}get _mcpService(){return this._mcpServiceLazy.value}async readFile(e){return this._readFile(e)}readFileStream(e,t,o){let n=VI(r=>qe.concat(r.map(s=>qe.wrap(s))).buffer);return this._readFile(e,o).then(r=>{t.position&&(r=r.slice(t.position)),t.length&&(r=r.slice(0,t.length)),n.end(r)},r=>n.error(r)),n}watch(e,t){let{resourceURI:o,server:n}=this._decodeURI(e),r=n.capabilities.get();if(r!==void 0&&!(r&32))return x.None;n.start();let s=new N,l,c=s.add(new me),u=s.add(new me);return s.add(be(p=>{let h=n.connection.read(p);if(!h)return;let g=h.handler.read(p);if(!g||l===g)return;u.value?.dispose(!0),u.value=new Ye,l=g;let f=u.value.token;g.subscribe({uri:o.toString()},f).then(()=>{f.isCancellationRequested||(c.value=g.onDidUpdateResource(v=>{ako(v.params.uri,o)&&this._onDidChangeFile.fire([{resource:e,type:0}])}))},v=>{g.logger.warn(`Failed to subscribe to resource changes for ${o}: ${v}`),l=void 0})})),s}async stat(e){let{forSameURI:t,contents:o}=await this._readURI(e);if(!o.length)throw Ps("File not found","EntryNotFound");return{ctime:0,mtime:0,size:Gy(o,n=>QNi(n).byteLength),type:t.length?1:2}}async readdir(e){let{forSameURI:t,contents:o,resourceURI:n}=await this._readURI(e);if(t.length>0)throw Ps("File is not a directory","EntryNotADirectory");let r=n.pathname.split("/"),s=new Map;for(let l of o){let u=A.parse(l.uri).path.split("/");if(!(u.length<=r.length||!r.every((p,h)=>vr(p,u[h]))))if(u.length>r.length+1)s.set(u[r.length],2);else{let p=u[u.length-1];s.set(p,QNi(l).byteLength>0?1:2)}}return[...s]}mkdir(e){throw Ps("write is not supported","NoPermissions")}writeFile(e,t,o){throw Ps("write is not supported","NoPermissions")}delete(e,t){throw Ps("delete is not supported","NoPermissions")}rename(e,t,o){throw Ps("rename is not supported","NoPermissions")}async _readFile(e,t){let{forSameURI:o,contents:n}=await this._readURI(e);if(!o.length)throw n.length?Ps("File is a directory","EntryIsADirectory"):Ps("File not found","EntryNotFound");return QNi(o[0])}_decodeURI(e){let t,o;try{({definitionId:t,resourceURL:o}=Bw.toServer(e))}catch(s){throw Ps(String(s),"EntryNotFound")}o.pathname.endsWith("/")&&(o.pathname=o.pathname.slice(0,-1));let n=this._mcpService.servers.get().find(s=>s.definition.id===t);if(!n)throw Ps(`MCP server ${t} not found`,"EntryNotFound");let r=n.capabilities.get();if(r!==void 0&&!(r&16))throw Ps(`MCP server ${t} does not support resources`,"EntryNotFound");return{definitionId:t,resourceURI:o,server:n}}async _readURI(e,t){let o=this._momentaryCache.get(e);if(o)return o.pool.add(t||Se.None),o.promise;let n=this._store.add(new Nht);n.add(t||Se.None);let r=this._readURIInner(e,n.token);this._momentaryCache.set(e,{pool:n,promise:r});let s=this._store.add(tn(()=>{this._momentaryCache.delete(e),this._store.delete(s),this._store.delete(n)},Xdn));return r}async _readURIInner(e,t){let{resourceURI:o,server:n}=this._decodeURI(e),r=this._mcpService.servers.get().find(l=>l.definition.id===n.definition.id);if(Cvo(o,r)){let l=A.parse(o.toString()),c=(await this._webContentExtractorService.extract([l],{followRedirects:!1})).at(0);if(c?.status==="ok")return{contents:[{uri:o.toString(),text:c.result}],resourceURI:o,forSameURI:[{uri:o.toString(),text:c.result}]}}let s=await $v.callOn(n,l=>l.readResource({uri:o.toString()},t),t);return{contents:s.contents,resourceURI:o,forSameURI:s.contents.filter(l=>ako(l.uri,o))}}};hBe=I([m(0,F),m(1,fe),m(2,VAe)],hBe);function ako(a,i){return vr(new URL(a).pathname,i.pathname)}function QNi(a){if("text"in a)return qe.fromString(a.text).buffer;if("blob"in a)return qa(a.blob).buffer;throw Ps("Unknown content type","Unknown")}var Jdn=rN({defaultValue:new Map,key:"mcp.sampling.logs",toStorage:a=>JSON.stringify(Array.from(a.entries())),fromStorage:a=>new Map(JSON.parse(a))}),gBe=class extends x{constructor(e){super();this._storageService=e;this._logs={}}has(e){return this._getLogStorageForServer(e).get().has(e.definition.id)}get(e){return this._getLogStorageForServer(e).get().get(e.definition.id)}getAsText(e){let o=this._getLogStorageForServer(e).get().get(e.definition.id);if(!o)return"";let n=[],r=o.bins.reduce((s,l)=>s+l,0);return n.push(d(12088,null,r)),n.push(this._formatRecentRequests(o)),n.join(`
`)}_formatRecentRequests(e){if(!e.lastReqs.length)return`
No recent requests.`;let t=[];for(let o=0;o<e.lastReqs.length;o++){let{request:n,response:r,at:s,model:l}=e.lastReqs[o];t.push(`
[${o+1}] ${new Date(s).toISOString()} ${l}`),t.push("  Request:");for(let c of n){let u=c.role.padEnd(9),p="";"text"in c.content&&c.content.type==="text"?p=c.content.text:"data"in c.content&&(p=`[${c.content.type} data: ${c.content.mimeType}]`),t.push(`    ${u}: ${p}`)}t.push("  Response:"),t.push(`    ${r}`)}return t.join(`
`)}async add(e,t,o,n){let r=Date.now(),s=Math.floor(r/864e5),l=this._getLogStorageForServer(e),c=new Map(l.get()),u=c.get(e.definition.id);if(!u)u={head:s,bins:Array.from({length:7},()=>0),lastReqs:[]};else{for(let p=0;p<s-u.head&&p<7;p++)u.bins.pop(),u.bins.unshift(0);u.head=s}for(u.bins[0]++,u.lastReqs.unshift({request:t,response:o,at:r,model:n});u.lastReqs.length>30;)u.lastReqs.pop();c.set(e.definition.id,u),l.set(c,void 0)}_getLogStorageForServer(e){let t=e.readDefinitions().get().collection?.scope??1;return this._logs[t]??=this._register(Jdn(t,1,this._storageService))}};gBe=I([m(0,ce)],gBe);var fBe=class extends x{constructor(e,t,o,n,r,s){super();this._languageModelsService=e;this._configurationService=t;this._dialogService=o;this._notificationService=n;this._commandService=r;this._sessionSets={allowedDuringChat:new Map,allowedOutsideChat:new Map};this._modelSequencer=new rm;this._logs=this._register(s.createInstance(gBe))}async sample(e,t=Se.None){let o=e.params.messages.map(c=>{let u=cc(c.content).map(p=>p.type==="text"?{type:"text",value:p.text}:p.type==="image"||p.type==="audio"?{type:"image_url",value:{mimeType:p.mimeType,data:qa(p.data)}}:void 0).filter(lo);if(u.length)return{role:c.role==="assistant"?2:1,content:u}}).filter(lo);e.params.systemPrompt&&o.unshift({role:0,content:[{type:"text",value:e.params.systemPrompt}]});let n=await this._modelSequencer.queue(()=>this._getMatchingModel(e)),r=await this._languageModelsService.sendChatRequest(n,void 0,o,{},t),s="",l=(async()=>{for await(let c of r.stream)if(Array.isArray(c))for(let u of c)u.type==="text"&&(s+=u.value);else c.type==="text"&&(s+=c.value)})();try{return await Promise.all([r.result,l]),this._logs.add(e.server,e.params.messages,s,n),{sample:{model:n,content:{type:"text",text:s},role:"assistant"}}}catch(c){throw Tb.unknown(c)}}hasLogs(e){return this._logs.has(e)}getLogText(e){return this._logs.getAsText(e)}async _getMatchingModel(e){let t=await this._getMatchingModelInner(e.server,e.isDuringToolCall,e.params.modelPreferences),o=this._configurationService.getValue("chat.tools.global.autoApprove");if(t===0){if(o)return this._sessionSets.allowedDuringChat.set(e.server.definition.id,!0),this._getMatchingModel(e);if(await this._showContextual(e.isDuringToolCall,d(12096,null,e.server.definition.label),d(12095,null,e.server.definition.label),this.allowButtons(e.server,"allowedDuringChat")))return this._getMatchingModel(e);throw Tb.notAllowed()}else if(t===1){if(o)return this._sessionSets.allowedOutsideChat.set(e.server.definition.id,!0),this._getMatchingModel(e);if(await this._showContextual(e.isDuringToolCall,d(12098,null,e.server.definition.label),d(12097,null,e.server.definition.label),this.allowButtons(e.server,"allowedOutsideChat")))return this._getMatchingModel(e);throw Tb.notAllowed()}else{if(t===2)throw Tb.notAllowed();if(t===3){if(e.isDuringToolCall?await this._commandService.executeCommand("workbench.mcp.configureSamplingModels",e.server):await this._notify(d(12099,null,e.server.definition.label),{[d(12090,null)]:()=>this._commandService.executeCommand("workbench.mcp.configureSamplingModels",e.server),[d(12089,null)]:()=>Promise.resolve(void 0)}))return this._getMatchingModel(e);throw Tb.notAllowed()}}return t}allowButtons(e,t){return{[d(12092,null)]:async()=>(this._sessionSets[t].set(e.definition.id,!0),!0),[d(12091,null)]:async()=>(await this.updateConfig(e,o=>o[t]=!0),!0),[d(12094,null)]:async()=>(this._sessionSets[t].set(e.definition.id,!1),!1),[d(12093,null)]:async()=>(await this.updateConfig(e,o=>o[t]=!1),!1)}}async _showContextual(e,t,o,n){return e?await(await this._dialogService.prompt({type:"question",title:t,message:o,buttons:Object.entries(n).map(([s,l])=>({label:s,run:l}))})).result:await this._notify(o,n)}async _notify(e,t){return await new Promise(o=>{let n=this._notificationService.prompt(ft.Info,e,Object.entries(t).map(([r,s])=>({label:r,run:()=>o(s())})));U.once(n.onDidClose)(()=>o(void 0))})}async _getMatchingModelInner(e,t,o){let n=this.getConfig(e);if(t&&!n.allowedDuringChat&&!this._sessionSets.allowedDuringChat.has(e.definition.id))return n.allowedDuringChat===void 0?0:2;if(!t&&!n.allowedOutsideChat&&!this._sessionSets.allowedOutsideChat.has(e.definition.id))return n.allowedOutsideChat===void 0?1:2;let r=n.allowedModels?.filter(s=>!!this._languageModelsService.lookupLanguageModel(s))||this._getDefaultModels();if(!r.length)return 3;if(o?.hints){let s=d_(o.hints,l=>r.find(c=>c.toLowerCase().includes(l.name.toLowerCase())));if(s)return s}return r[0]}_getDefaultModels(){let e=this._languageModelsService.getLanguageModelIds().map(o=>{let n=this._languageModelsService.lookupLanguageModel(o);return n&&!n.multiplierNumeric&&!n.targetChatSessionType?{model:n,id:o}:void 0}).filter(lo),t=e.findIndex(o=>Object.values(o.model.isDefaultForLocation).some(Boolean));return t!==-1&&([e[0],e[t]]=[e[t],e[0]]),e.map(o=>o.id)}_configKey(e){return`${e.collection.label}: ${e.definition.label}`}getConfig(e){return this._getConfig(e).value||{}}_getConfig(e){let t=e.readDefinitions().get(),o=8,n=t.collection?.configTarget||2,r=this._configKey(e),s=t.collection?.presentation?.origin,l=this._configurationService.inspect(jet,{resource:s});for(let c=o;c>=n;c--){let u=rje(l,c),p=u?.[r];if(p)return{value:p,key:r,mapping:u,target:c,resource:s}}return{value:void 0,mapping:rje(l,n),key:r,target:n,resource:s}}async updateConfig(e,t){let{value:o,mapping:n,key:r,target:s,resource:l}=this._getConfig(e),c={...o};return t(c),await this._configurationService.updateValue(jet,{...n,[r]:c},{resource:l},s),c}};fBe=I([m(0,ds),m(1,B),m(2,at),m(3,Ne),m(4,ge),m(5,F)],fBe);var vBe=class extends x{constructor(e,t,o,n,r){super();this._instantiationService=e;this._mcpRegistry=t;this._logService=o;this.configurationService=n;this._currentAutoStarts=new Set;this._servers=Me(this,[]);this.servers=this._servers.map(e=>e.map(t=>t.object));this.enablementModel=this._register(new loe("mcp.enablement",r)),this.userCache=this._register(e.createInstance(bge,0)),this.workspaceCache=this._register(e.createInstance(bge,1));let s=this._store.add(new Dt(()=>this.updateCollectedServers(),500));this._register(be(l=>{for(let c of this._mcpRegistry.collections.read(l))c.serverDefinitions.read(l);s.schedule(500)}))}get lazyCollectionState(){return this._mcpRegistry.lazyCollectionState}cancelAutostart(){for(let e of this._currentAutoStarts)e.cancel()}autostart(e){let t=this.configurationService.getValue(Nee);if(t==="never")return Me(this,JTe.Empty);let o=Me(this,{working:!0,starting:[],serversRequiringInteraction:[]}),n=new N,r=n.add(new Ye(e));return this._currentAutoStarts.add(r),n.add(Z(()=>{this._currentAutoStarts.delete(r)})),n.add(r.token.onCancellationRequested(()=>{o.set(JTe.Empty,void 0)})),this._autostart(t,o,r.token).catch(s=>{this._logService.error("Error during MCP autostart:",s),o.set(JTe.Empty,void 0)}).finally(()=>n.dispose()),o}async _autostart(e,t,o){if(await this._activateCollections(),o.isCancellationRequested)return;let n=this.servers.get().filter(u=>u.connectionState.get().state!==dr.Kind.Error&&Ub(u.enablement.get())),r=new Set;if(e==="onlyNew"?r=new Set(n.filter(u=>u.cacheState.get()===0)):e==="newAndOutdated"&&(r=new Set(n.filter(u=>{let p=u.cacheState.get();return p===0||p===2}))),!r.size){t.set(JTe.Empty,void 0);return}let s=new FJ,l=[],c=()=>t.set({working:r.size>0,starting:[...r].map(u=>u.definition),serversRequiringInteraction:l},void 0);c(),await Promise.all([...r].map(async(u,p)=>{try{await hW(u,{interaction:s,errorOnUserInteraction:!0},o)}catch(h){h instanceof Vw&&l.push({id:u.definition.id,label:u.definition.label,errorMessage:h.message})}finally{r.delete(u),o.isCancellationRequested||c()}}))}resetCaches(){this.userCache.reset(),this.workspaceCache.reset()}resetTrust(){this.resetCaches()}async activateCollections(){await this._activateCollections()}async _activateCollections(){let e=await this._mcpRegistry.discoverCollections();return this.updateCollectedServers(),new Set(e.map(t=>t.id))}updateCollectedServers(){let e=new YNi,t=this._mcpRegistry.collections.get().flatMap(l=>l.serverDefinitions.get().map(c=>{let u=e.generate(c.label);return{serverDefinition:c,collectionDefinition:l,toolPrefix:u}})),o=new Set(t),n=this._servers.get(),r=[],s=(l,c)=>{o.delete(l),r.push(c);let u=c.object.connection.get();u&&!VB.equals(u.definition,l.serverDefinition)&&(c.object.stop(),this._logService.debug(`MCP server ${c.object.definition.id} stopped because the definition changed`))};for(let l of n){let c=t.find(u=>Zdn(l.object,u)&&l.toolPrefix===u.toolPrefix);c?s(c,l):l.object.dispose()}for(let l of o){let c=this._instantiationService.createInstance($v,l.collectionDefinition,l.serverDefinition,l.serverDefinition.roots,!!l.collectionDefinition.lazy,l.collectionDefinition.scope===1?this.workspaceCache:this.userCache,l.toolPrefix,this.enablementModel);r.push({object:c,toolPrefix:l.toolPrefix})}Gi(l=>{this._servers.set(r,l)})}dispose(){this._servers.get().forEach(e=>e.object.dispose()),super.dispose()}};vBe=I([m(0,F),m(1,Lc),m(2,se),m(3,B),m(4,ce)],vBe);function Zdn(a,i){return a.collection.id===i.collectionDefinition.id&&a.definition.id===i.serverDefinition.id}var YNi=class{constructor(){this.seenPrefixes=new Set}generate(i){let e="mcp_"+i.toLowerCase().replace(/[^a-z0-9_.-]+/g,"_").slice(0,18-"mcp_".length-1),t=e+"_";for(let o=2;this.seenPrefixes.has(t);o++)t=e+o+"_";return this.seenPrefixes.add(t),t}};var BBg=le("IMcpGatewayService"),Xst="mcpGateway",djt="mcpGatewayToolBroker";var bBe=class{constructor(i,e){this._remoteAgentService=i;this._logService=e}async createGateway(i){if(this._logService.debug(`[McpGateway][BrowserWorkbench] createGateway requested (inRemote=${i})`),!i){this._logService.info("[McpGateway][BrowserWorkbench] Cannot create local gateway in browser environment");return}let e=this._remoteAgentService.getConnection();if(!e){this._logService.info("[McpGateway][BrowserWorkbench] No remote connection available (serverless web)");return}return this._logService.info("[McpGateway][BrowserWorkbench] Creating remote gateway via remote server"),e.withChannel(Xst,async t=>{let o=Tc.toService(t),n=await o.createGateway(void 0),r=lko(n.servers);this._logService.info(`[McpGateway][BrowserWorkbench] Remote gateway created with ${r.length} server(s)`);let s=U.map(U.filter(t.listen("onDidChangeGatewayServers"),l=>l.gatewayId===n.gatewayId),l=>lko(l.servers));return{servers:r,onDidChangeServers:s,dispose:()=>{this._logService.info(`[McpGateway][BrowserWorkbench] Disposing remote gateway: ${n.gatewayId}`),o.disposeGateway(n.gatewayId)}}})}};bBe=I([m(0,bo),m(1,se)],bBe);function lko(a){return a.map(i=>({label:i.label,address:A.revive(i.address)}))}var SBe=class extends x{constructor(e,t,o=5e3){super();this._mcpService=e;this._logService=t;this._startupGracePeriodMs=o;this._onDidChangeTools=this._register(new E);this._onDidChangeResources=this._register(new E);this._onDidChangeServers=this._register(new E);this._startupGrace=new Map;this._logService.debug("[McpGateway][ToolBroker] Initialized");let n=!1;this._register(be(l=>{for(let c of this._mcpService.servers.read(l))c.tools.read(l);n?(this._logService.debug("[McpGateway][ToolBroker] Tools changed, firing onDidChangeTools"),this._onDidChangeTools.fire()):n=!0}));let r=!1;this._register(be(l=>{for(let c of this._mcpService.servers.read(l))c.capabilities.read(l);r?(this._logService.debug("[McpGateway][ToolBroker] Resources changed, firing onDidChangeResources"),this._onDidChangeResources.fire()):r=!0}));let s=!1;this._register(be(l=>{let c=this._mcpService.servers.read(l);s?(this._logService.debug("[McpGateway][ToolBroker] Servers changed, firing onDidChangeServers"),this._onDidChangeServers.fire(c.map(u=>({id:u.definition.id,label:u.definition.label})))):s=!0}))}_getServerById(e){for(let t of this._mcpService.servers.get())if(t.definition.id===e)return t}_waitForStartup(e){let t=e.definition.id;if(this._startupGrace.get(t)?.resolved){let n=e.cacheState.get();(n===0||n===2)&&this._startupGrace.delete(t)}if(!this._startupGrace.has(t)){let n={promise:Promise.race([this._ensureServerReady(e),new Promise(r=>setTimeout(()=>r(!1),this._startupGracePeriodMs))]),resolved:!1};n.promise.then(()=>{n.resolved=!0}),this._startupGrace.set(t,n)}return this._startupGrace.get(t).promise}async _shouldUseCachedData(e){let t=e.cacheState.get();if(t===0||t===2){await this._waitForStartup(e);let o=e.cacheState.get();return o===5||o===1||o===4}return t===5||t===1||t===4}listen(e,t){switch(t){case"onDidChangeTools":return this._onDidChangeTools.event;case"onDidChangeResources":return this._onDidChangeResources.event;case"onDidChangeServers":return this._onDidChangeServers.event}throw new Error(`Invalid listen: ${t}`)}async call(e,t,o,n){switch(this._logService.debug(`[McpGateway][ToolBroker] IPC call: ${t}`),t){case"listServers":return this._listServers();case"listToolsForServer":{let{serverId:r}=o;return await this._listToolsForServer(r)}case"callToolForServer":{let{serverId:r,name:s,args:l}=o;return await this._callToolForServer(r,s,l||{},n)}case"listResourcesForServer":{let{serverId:r}=o;return await this._listResourcesForServer(r)}case"readResourceForServer":{let{serverId:r,uri:s}=o;return await this._readResourceForServer(r,s,n)}case"listResourceTemplatesForServer":{let{serverId:r}=o;return await this._listResourceTemplatesForServer(r)}}throw new Error(`Invalid call: ${t}`)}_listServers(){let e=this._mcpService.servers.get(),t=[];for(let o of e)t.push({id:o.definition.id,label:o.definition.label});return this._logService.debug(`[McpGateway][ToolBroker] listServers result: ${t.length} server(s): [${t.map(o=>o.label).join(", ")}]`),t}async _listToolsForServer(e){let t=this._getServerById(e);if(!t)return this._logService.warn(`[McpGateway][ToolBroker] listToolsForServer: unknown server '${e}'`),[];if(!await this._shouldUseCachedData(t))return this._logService.debug(`[McpGateway][ToolBroker] Server '${e}' not ready, skipping tool listing`),[];let o=t.tools.get().filter(n=>n.visibility&1).map(n=>n.definition);return this._logService.debug(`[McpGateway][ToolBroker] listToolsForServer '${e}': ${o.length} tool(s)`),o}async _callToolForServer(e,t,o,n=Se.None){this._logService.debug(`[McpGateway][ToolBroker] callToolForServer '${e}' tool '${t}' with args: ${JSON.stringify(o)}`);let r=this._getServerById(e);if(!r)throw new Error(`Unknown server: ${e}`);let s=r.tools.get().find(c=>c.definition.name===t&&c.visibility&1);if(!s)throw new Error(`Unknown tool '${t}' on server '${e}'`);let l=await s.call(o,void 0,n);return this._logService.debug(`[McpGateway][ToolBroker] Tool '${t}' on '${e}' completed (isError=${l.isError??!1}, content blocks=${l.content.length})`),l}async _listResourcesForServer(e){let t=this._getServerById(e);if(!t)return this._logService.warn(`[McpGateway][ToolBroker] listResourcesForServer: unknown server '${e}'`),[];if(!await this._shouldUseCachedData(t))return[];let o=t.capabilities.get();if(!o||!(o&16))return this._logService.debug(`[McpGateway][ToolBroker] Server '${e}' has no resource capability`),[];try{let n=await $v.callOn(t,r=>r.listResources());return this._logService.debug(`[McpGateway][ToolBroker] Server '${e}' listed ${n.length} resource(s)`),n}catch(n){return this._logService.warn(`[McpGateway][ToolBroker] Server '${e}' failed to list resources`,n),[]}}async _readResourceForServer(e,t,o=Se.None){let n=this._getServerById(e);if(!n)throw new Error(`Unknown server: ${e}`);this._logService.debug(`[McpGateway][ToolBroker] readResourceForServer '${t}' from server '${e}'`);let r=await $v.callOn(n,s=>s.readResource({uri:t},o),o);return this._logService.debug(`[McpGateway][ToolBroker] readResourceForServer returned ${r.contents.length} content(s)`),r}async _listResourceTemplatesForServer(e){let t=this._getServerById(e);if(!t)return this._logService.warn(`[McpGateway][ToolBroker] listResourceTemplatesForServer: unknown server '${e}'`),[];if(!await this._shouldUseCachedData(t))return[];let o=t.capabilities.get();if(!o||!(o&16))return[];try{let n=await $v.callOn(t,r=>r.listResourceTemplates());return this._logService.debug(`[McpGateway][ToolBroker] Server '${e}' listed ${n.length} resource template(s)`),n}catch(n){return this._logService.warn(`[McpGateway][ToolBroker] Server '${e}' failed to list resource templates`,n),[]}}async _ensureServerReady(e){let t=e.cacheState.get();if(t!==0&&t!==2)return!0;this._logService.debug(`[McpGateway][ToolBroker] Server '${e.definition.id}' not ready (cacheState=${t}), starting...`);try{let o=await hW(e,{promptType:"all-untrusted",errorOnUserInteraction:!0});return this._logService.debug(`[McpGateway][ToolBroker] Server '${e.definition.id}' ready=${o}`),o}catch(o){return this._logService.warn(`[McpGateway][ToolBroker] Server '${e.definition.id}' failed to start`,o),!1}}};var IBe=class{constructor(i,e,t){i.getConnection()?.registerChannel(djt,new SBe(e,t))}};IBe=I([m(0,bo),m(1,_s),m(2,se)],IBe);async function ujt(a,i){await a.openView(Dr,!0);let e=i.getWidgetsByLocations("panel");if(e.length)return e[0];let t=U.toPromise(U.filter(i.onDidAddWidget,o=>o.location==="panel"));return await vp(t,1e4,()=>t.cancel())}var kU=class extends x{constructor(e,t,o,n,r){super();this._mcpService=e;this._fileService=t;this._quickInputService=o;this._notificationService=n;this._chatAttachmentResolveService=r;this._resources=Me(this,{picks:new Map,isBusy:!0});this._pickItemsStack=new qs;this._inDirectory=Me(this,void 0);this.hasServersWithResources=ke(e=>{let t=!1;for(let o of this._mcpService.servers.read(e)){let n=o.capabilities.read(void 0);if(n===void 0)t=!0;else if(n&16){t=!0;break}}return t});this.checkIfNestedResources=()=>!this._pickItemsStack.isEmpty()}static sep(e){return{id:e.definition.id,type:"separator",label:e.definition.label}}addCurrentMCPQuickPickItemLevel(e,t){let o=!1;if(o=this._pickItemsStack.isEmpty(),!o){let n=this._pickItemsStack.peek();n?.server===e&&n.resources===t?o=!1:o=!0}o&&this._pickItemsStack.push({server:e,resources:t})}navigateBack(){let e=this._pickItemsStack.pop();return e?(this._inDirectory.set({server:e.server,resources:e.resources},void 0),!0):!1}static item(e){let t=e.icons.getUrl(22);return ZTe(e)?{id:e.template.template,label:e.title||e.name,description:e.description,detail:d(11918,null,e.template.template),iconPath:t}:{id:e.uri.toString(),label:e.title||e.name,description:e.description,detail:e.mcpUri+(e.sizeInBytes!==void 0?" ("+vl.formatSize(e.sizeInBytes)+")":""),iconPath:t}}async navigate(e,t){if(ZTe(e))return!1;let o=e.uri,n;try{n=await this._fileService.resolve(o,{resolveMetadata:!1})}catch{return!1}if(n&&this._isDirectoryResource(e)&&(n.children?.length??0)>0){let r=this._resources.get().picks.get(t);r&&this.addCurrentMCPQuickPickItemLevel(t,r);let s=n.children.map(l=>({uri:Bw.fromServer(t.definition,l.resource.toString()),mcpUri:l.resource.path,name:l.name,title:l.name,description:e.description,mimeType:void 0,sizeInBytes:l.size,icons:BG.fromParsed(void 0)}));return this._inDirectory.set({server:t,resources:s},void 0),!0}return!1}toAttachment(e,t){let o="noop";return this._isDirectoryResource(e)?(this.checkIfDirectoryAndPopulate(e,t),o):ZTe(e)?this._resourceTemplateToAttachment(e).then(n=>n||o):this._resourceToAttachment(e).then(n=>n||o)}async checkIfDirectoryAndPopulate(e,t){try{return!await this.navigate(e,t)}catch{return!1}}async toURI(e){if(ZTe(e)){let t=await this._resourceTemplateToURI(e);return t&&await this._verifyUriIfNeeded(t)}else return e.uri}async _resourceToAttachment(e){let t=await this._chatAttachmentResolveService.resolveImageEditorAttachContext(e.uri,void 0,e.mimeType);return t||{id:e.uri.toString(),kind:"file",name:e.name,value:e.uri}}async _resourceTemplateToAttachment(e){let t=await this._resourceTemplateToURI(e),o=t&&await this._verifyUriIfNeeded(t);return o&&this._resourceToAttachment({uri:o,name:e.name,mimeType:e.mimeType})}async _verifyUriIfNeeded({uri:e,needsVerification:t}){if(!t||await this._fileService.exists(e))return e;this._notificationService.warn(d(11920,null,Bw.toServer(e).resourceURL.toString()))}async _resourceTemplateToURI(e){let t=e.template.components.flatMap(l=>typeof l=="object"?l.variables:[]),o=this._quickInputService.createQuickPick(),n=new Ye,r={};o.totalSteps=t.length,o.ignoreFocusOut=!0;let s=!1;try{for(let l=0;l<t.length;l++){let c=t[l],u=await this._promptForTemplateValue(o,c,r,e);if(u===void 0)return;s||=!u.completed,r[t[l].name]=c.repeatable?u.value.split("/"):u.value}return{uri:e.resolveURI(r),needsVerification:s}}finally{n.dispose(!0),o.dispose()}}_promptForTemplateValue(e,t,o,n){let r=new N,s=new Map([]),l={...o};for(let v of n.template.components.flatMap(b=>typeof b=="object"?b.variables:[]))l.hasOwnProperty(v.name)||(l[v.name]=`$${v.name.toUpperCase()}`);let c=d(11922,null,t.name.toUpperCase(),n.template.resolve(l).replaceAll("%24","$"));t.optional&&(c+=" ("+d(11921,null)+")"),e.placeholder=c,e.value="",e.items=[],e.show();let u=xt(),p=(v,b=[])=>{let S=b.filter(y=>y!==v).map(y=>({id:y,label:y}));v?S.unshift({id:u,label:v}):t.optional&&S.unshift({id:u,label:d(11919,null)}),e.items=S},h=new Ye;r.add(Z(()=>h.dispose(!0)));let g=()=>{let v=e.value,b=s.get(v);b||(b=n.complete(t.name,v,o,h.token),s.set(v,b)),b.then(S=>{h.token.isCancellationRequested||p(v,S)}).catch(()=>{s.delete(v)}).finally(()=>{h.token.isCancellationRequested||(e.busy=!1)})},f=r.add(new Dt(g,300));return new Promise(v=>{r.add(e.onDidHide(()=>v(void 0))),r.add(e.onDidAccept(()=>{let b=e.selectedItems[0];b.id===u?v({value:e.value,completed:!1}):t.explodable&&b.label.endsWith("/")&&b.label!==e.value?e.value=b.label:v({value:b.label,completed:!0})})),r.add(e.onDidChangeValue(b=>{e.busy=!0,h.dispose(!0),h=new Ye,f.cancel(),p(b),s.has(e.value)?g():f.schedule()})),g()}).finally(()=>r.dispose())}_isDirectoryResource(e){return e.mimeType&&e.mimeType==="inode/directory"?!0:ZTe(e)?e.template.template.endsWith("/"):e.uri.path.endsWith("/")}getPicks(e){let t=new Ye(e),o=!0;this._register(Z(()=>t.dispose(!0)));let n=!0;this._register(tn(()=>{n=!1,r()},5e3));let r=()=>{let l=new Map;for(let[c,u]of s){let p=[];if(l.set(c,p),u.templates.isResolved)p.push(...u.templates.value);else if(n)break;if(p.push(...u.resourcesSoFar),!u.resources.isSettled&&n)break}this._resources.set({picks:l,isBusy:o},void 0)},s=new Map;return Promise.all((this.explicitServers||this._mcpService.servers.get()).map(async l=>{let c=l.capabilities.get(),u={templates:new Ko,resourcesSoFar:[],resources:new Ko};s.set(l,u),c===void 0&&(c=await new Promise(p=>{l.start().then(h=>{(h.state===dr.Kind.Error||h.state===dr.Kind.Stopped)&&p(void 0)}),this._register(t.token.onCancellationRequested(()=>p(void 0))),this._register(be(h=>{let g=l.capabilities.read(h);g!==void 0&&p(g)}))})),c&&c&16?await Promise.all([u.templates.settleWith(l.resourceTemplates(t.token).catch(()=>[])).finally(r),u.resources.settleWith((async()=>{for await(let p of l.resources(t.token))u.resourcesSoFar=u.resourcesSoFar.concat(p),r()})())]):(u.templates.complete([]),u.resources.complete([]))})).finally(()=>{o=!1,r()}),ke(this,l=>{let c=this._inDirectory.read(l);return c?{picks:new Map([[c.server,c.resources]]),isBusy:!1}:this._resources.read(l)})}};kU=I([m(0,_s),m(1,fe),m(2,Ue),m(3,Ne),m(4,rW)],kU);var yBe=class{constructor(i,e,t,o,n){this._scopeTo=i;this._instantiationService=e;this._editorService=t;this._chatWidgetService=o;this._viewsService=n}applyToPick(i,e,t){i.canAcceptInBackground=!0,i.busy=!0,i.keepScrollPosition=!0;let o=new N,n="_goback_",r=d(11916,null),s=o.add(this._instantiationService.createInstance(kU));this._scopeTo&&(s.explicitServers=[this._scopeTo]);let l=s.getPicks(e);return o.add(be(c=>{let u=l.read(c),p=u.isBusy,h=[];for(let[g,f]of u.picks){h.push(kU.sep(g));for(let v of f){let b=kU.item(v);b.buttons=[{iconClass:q.asClassName(R.attach),tooltip:r}],h.push({...b,resource:v,server:g})}}if(s.checkIfNestedResources()){let g={id:n,label:d(11915,null),alwaysShow:!0};h.push(g)}i.items=h,i.busy=p})),o.add(i.onDidTriggerItemButton(c=>{if(c.button.tooltip===r){i.busy=!0;let u=c.item,p=s.toAttachment(u.resource,u.server);p instanceof Promise&&p.then(async h=>{h!=="noop"&&(await ujt(this._viewsService,this._chatWidgetService))?.attachmentModel.addContext(...cc(h)),i.hide()})}})),o.add(i.onDidHide(()=>{s.dispose()})),o.add(i.onDidAccept(async c=>{try{i.busy=!0;let[u]=i.selectedItems;if(u.id===n){s.navigateBack(),i.busy=!1;return}let p=u,h=p.resource;if(!await s.navigate(h,p.server)){let f=await s.toURI(h);f&&(i.hide(),this._editorService.openEditor({resource:f,options:{preserveFocus:c.inBackground}}))}}finally{i.busy=!1}})),o}};yBe=I([m(1,F),m(2,ee),m(3,Pt),m(4,$t)],yBe);var wBe=class extends yBe{constructor(e,t,o,n,r,s){super(e,t,o,n,r);this._quickInputService=s}async pick(e=Se.None){let t=new N,o=t.add(this._quickInputService.createQuickPick({useSeparators:!0}));o.placeholder=d(11917,null),t.add(this.applyToPick(o,e)),t.add(o.onDidHide(()=>t.dispose())),o.show(),await U.toPromise(o.onDidHide)}};wBe=I([m(1,F),m(2,ee),m(3,Pt),m(4,$t),m(5,Ue)],wBe);var r6=class extends yBe{constructor(e,t,o,n){super(void 0,e,t,o,n);this.defaultFilterValue=1}static{this.PREFIX="mcpr "}provide(e,t,o){return this.applyToPick(e,t,o)}};r6=I([m(0,F),m(1,ee),m(2,Pt),m(3,$t)],r6);var CBe=class extends x{constructor(e,t,o){super();this._chatContextPickService=e;this._instantiationService=t;this._addContextMenu=this._register(new me);let n=ke(r=>{let s=!1;for(let l of o.servers.read(r)){let c=l.capabilities.read(void 0);if(c===void 0)s=!0;else if(c&16){s=!0;break}}return s});this._register(be(r=>{n.read(r)&&!this._addContextMenu.value?this._registerAddContextMenu():this._addContextMenu.clear()}))}_registerAddContextMenu(){this._addContextMenu.value=this._chatContextPickService.registerChatContextItem({type:"pickerPick",label:d(11728,null),icon:R.mcp,isEnabled(e){return!!e.attachmentCapabilities.supportsMCPAttachments},asPicker:()=>{let e=this._instantiationService.createInstance(kU);return{placeholder:d(11729,null),picks:(t,o)=>this._getResourcePicks(o,e),goBack:()=>e.navigateBack(),dispose:()=>{e.dispose()}}}})}_getResourcePicks(e,t){let o=t.getPicks(e);return ke(this,n=>{let r=o.read(n),s=[];for(let[l,c]of r.picks)if(c.length!==0){s.push(kU.sep(l));for(let u of c)s.push({...kU.item(u),asAttachment:()=>t.toAttachment(u,l)})}return{picks:s,busy:r.isBusy}})}};CBe=I([m(0,DS),m(1,F),m(2,_s)],CBe);var cv={original:"MCP",value:"MCP"},pjt=class extends K{constructor(){super({id:"workbench.mcp.listServer",title:L(11763,"List Servers"),icon:R.server,category:cv,f1:!0,precondition:ie.Setup.hidden.negate(),menu:[{when:C.and(C.or(C.and(C.equals(`config.${Nee}`,"never"),xU.hasUnknownTools),xU.hasServersWithErrors),ie.chatModeKind.isEqualTo("agent"),ie.lockedToCodingAgent.negate(),ie.Setup.hidden.negate()),id:D.ChatInput,group:"navigation",order:101}]})}async run(i){let e=i.get(_s),t=i.get(ge),o=i.get(Ue),n=i.get(Ng),r=new N,s=o.createQuickPick({useSeparators:!0});s.placeholder=d(11776,null),e.activateCollections(),r.add(s),r.add(be(c=>{let u=MI(e.servers.read(c).slice().sort((h,g)=>(h.collection.presentation?.order||0)-(g.collection.presentation?.order||0)),h=>h.collection.id),p=s.items.length===0;s.items=[{id:"$add",label:d(11735,null),description:d(11736,null),alwaysShow:!0,iconClass:q.asClassName(R.add)},...Object.values(u).filter(h=>h.length).flatMap(h=>[{type:"separator",label:h[0].collection.label,id:h[0].collection.id},...h.map(g=>{let f=gN(g.enablement.read(c));return{id:g.definition.id,label:g.definition.label,description:f?d(11756,null):dr.toString(g.connectionState.read(c))}})])],p&&s.items.length>3&&(s.activeItems=s.items.slice(2,3))}));let l=await new Promise(c=>{r.add(s.onDidAccept(()=>{c(s.activeItems[0])})),r.add(s.onDidHide(()=>{c(void 0)})),s.show()});if(r.dispose(),l)if(l.id==="$add")t.executeCommand("workbench.mcp.addConfiguration");else{let c=e.servers.get().find(u=>u.definition.id===l.id);if(c&&gN(c.enablement.get())){let u=n.local.find(p=>p.id===l.id);u&&n.open(u)}else t.executeCommand("workbench.mcp.serverOptions",l.id)}}},mjt=class extends K{constructor(){super({id:"workbench.mcp.serverOptionsInConfirmation",title:L(11767,"Server Options"),category:cv,icon:R.settingsGear,f1:!1,menu:[{id:D.ChatConfirmationMenu,when:C.and(C.equals("chatConfirmationPartSource","mcp"),C.or(C.equals("chatConfirmationPartType","chatToolConfirmation"),C.equals("chatConfirmationPartType","elicitation"))),group:"navigation"}]})}async run(i,e){let t=i.get(Vn);if(e.kind==="toolInvocation"){let o=t.getTool(e.toolId);o?.source.type==="mcp"&&i.get(ge).executeCommand("workbench.mcp.serverOptions",o.source.definitionId)}else e.kind==="elicitation2"?e.source?.type==="mcp"&&i.get(ge).executeCommand("workbench.mcp.serverOptions",e.source.definitionId):os(e)}},hjt=class extends K{constructor(){super({id:"workbench.mcp.serverOptions",title:L(11767,"Server Options"),category:cv,f1:!1})}async run(i,e){let t=i.get(_s),o=i.get(Ue),n=i.get(Lc),r=i.get(ee),s=i.get(ge),l=i.get(F4),c=i.get(fM),u=i.get(xs),p=t.servers.get().find(w=>w.definition.id===e);if(!p)return;let h=n.collections.get().find(w=>w.id===p.collection.id),g=h?.serverDefinitions.get().find(w=>w.id===p.definition.id),f=[],v=p.connectionState.get();f.push({type:"separator",label:d(11732,null)}),dr.canBeStarted(v.state)?f.push({label:d(11783,null),action:"start"}):(f.push({label:d(11785,null),action:"stop"}),f.push({label:d(11771,null),action:"restart"})),f.push(...this._getAuthActions(c,p.definition.id));let b=g?.presentation?.origin||h?.presentation?.origin;b&&f.push({label:d(11752,null),action:"config"}),f.push({label:d(11779,null),action:"showOutput"}),f.push({type:"separator",label:d(11731,null)},{label:d(11753,null),description:d(11780,null),action:"configSampling"}),l.hasLogs(p)&&f.push({label:d(11772,null),description:d(11773,null),action:"samplingLog"});let S=p.capabilities.get();(S===void 0||S&16)&&(f.push({type:"separator",label:d(11730,null)}),f.push({label:d(11770,null),action:"resources"}));let y=await o.pick(f,{placeHolder:d(11775,null,p.definition.label)});if(y)switch(y.action){case"start":await p.start({promptType:"all-untrusted"}),p.showOutput();break;case"stop":await p.stop();break;case"restart":await p.stop(),await p.start({promptType:"all-untrusted"});break;case"disconnect":await p.stop(),await this._handleAuth(u,y.accountQuery,p.definition,!1);break;case"signout":await p.stop(),await this._handleAuth(u,y.accountQuery,p.definition,!0);break;case"showOutput":p.showOutput();break;case"config":r.openEditor({resource:A.isUri(b)?b:b.uri,options:{selection:A.isUri(b)?void 0:b.range}});break;case"configSampling":return s.executeCommand("workbench.mcp.configureSamplingModels",p);case"resources":return s.executeCommand("workbench.mcp.browseResources",p);case"samplingLog":r.openEditor({resource:void 0,contents:l.getLogText(p),label:d(11774,null,p.definition.label)});break;default:os(y)}}_getAuthActions(i,e){let t=[];for(let[o,n]of i.mcpServer(e).getAllAccountPreferences()){let r=i.provider(o).account(n);r.mcpServer(e).isAccessAllowed()&&(r.entities().getEntityCount().total>1?t.push({action:"disconnect",label:d(11757,null),description:`(${n})`,accountQuery:r}):t.push({action:"signout",label:d(11781,null),description:`(${n})`,accountQuery:r}))}return t}async _handleAuth(i,e,t,o){let{providerId:n,accountName:r}=e;if(e.mcpServer(t.id).setAccessAllowed(!1,t.label),o){let l=(await i.getAccounts(n)).find(c=>c.label===r);if(l){let c=await i.getSessions(n,void 0,{account:l});for(let u of c)await i.removeSession(n,u.id)}}}},xBe=class extends x{constructor(i,e,t,o,n){super();let r=Me(this,!1),s=hr(Nee,"newAndOutdated",n),l;(S=>(S[S.None=0]="None",S[S.NewTools=1]="NewTools",S[S.Error=2]="Error",S[S.Refreshing=3]="Refreshing"))(l||={});function c(g){return typeof g.start=="function"}let u=ke(g=>{let f=e.servers.read(g),v=[];for(let y of f){let w=0;switch(y.cacheState.read(g)){case 0:case 2:w=y.connectionState.read(g).state===dr.Kind.Error?2:1;break;case 3:w=3;break;default:w=y.connectionState.read(g).state===dr.Kind.Error?2:0;break}v[w]??=[],v[w].push(y)}let b=e.lazyCollectionState.read(g);b.state===1?(v[3]??=[],v[3].push(...b.collections)):b.state===0&&(v[1]??=[],v[1].push(...b.collections));let S=v.length-1;return S===1&&s.read(g)!=="never"&&(S=0),{state:S,servers:v[S]||[]}}),p=Bf(this,(g,f)=>f&&r.read(g)?f:u.read(g)),h=p.map(g=>g.state);this._store.add(i.register(D.ChatInput,"workbench.mcp.listServer",(g,f)=>{if(g instanceof Lo)return t.createInstance(class extends xl{render(v){super.render(v),v.classList.add("chat-mcp"),v.style.position="relative";let b=v.appendChild(_(".chat-mcp-state-indicator"));b.style.display="none",this._register(be(S=>{let y=p.read(S),{state:w}=y;this.updateTooltip(),b.ariaLabel=this.getLabelForState(y),b.className="chat-mcp-state-indicator",w===1?(b.style.display="block",b.classList.add("chat-mcp-state-new",...q.asClassNameArray(R.refresh))):w===2?(b.style.display="block",b.classList.add("chat-mcp-state-error",...q.asClassNameArray(R.warning))):w===3?(b.style.display="block",b.classList.add("chat-mcp-state-refreshing",...q.asClassNameArray(AE))):b.style.display="none"}))}async onClick(v){v.preventDefault(),v.stopPropagation();let{state:b,servers:S}=u.get();if(b===1){let y=new FJ;S.filter(c).forEach(w=>w.stop().then(()=>w.start({interaction:y}))),e.activateCollections()}else if(b===3)fd(S,c)?.showOutput();else if(b===2){let y=fd(S,c);y&&(await y.showOutput(!0),o.executeCommand("workbench.mcp.serverOptions",y.definition.id))}else o.executeCommand("workbench.mcp.listServer")}getTooltip(){return this.getLabelForState()||super.getTooltip()}getHoverContents({state:v,servers:b}=u.get()){let S=T=>pw({text:T.definition.label,id:"workbench.mcp.serverOptions",arguments:[T.definition.id],tooltip:d(11777,null,T.definition.label)}),y=b.length===1,w=b.map(T=>c(T)?S(T):"`"+T.label+"`").map(T=>y?T:`- ${T}`).join(`
`),k;if(v===1)k=new Ie(y?d(11766,null,w):d(11765,null,w));else if(v===2)k=new Ie(y?d(11760,null,w):d(11759,null,w));else return this.getLabelForState()||void 0;return{element:T=>{r.set(!0,void 0);let P=new N;P.add(Z(()=>r.set(!1,void 0))),P.add(T.onCancellationRequested(()=>{P.dispose()})),P.add(zI(ut,()=>{O.isConnected||P.dispose()},2e3));let O=_("div.mcp-hover-contents");k.isTrusted=!0;let V=P.add(Gf(k));O.appendChild(V.element);let H=_("hr.mcp-hover-divider");O.appendChild(H);let G=_("div.mcp-hover-setting"),$=d(11737,null),J=P.add(new Ev($,s.get()!=="never",{...qf}));G.appendChild(J.domNode);let ae=_("span.mcp-hover-setting-label",void 0,$);G.appendChild(ae);let he=()=>{let oe=J.checked?"newAndOutdated":"never";n.updateValue(Nee,oe)};return P.add(J.onChange(he)),P.add(j(ae,re.CLICK,()=>{J.checked=!J.checked,he()})),O.appendChild(G),O}}}getLabelForState({state:v,servers:b}=u.get()){return v===1?d(11764,null,b.length||1):v===2?d(11786,null,b.length||1):v===3?d(11787,null):null}},g,{...f,keybindingNotRenderedWithLabel:!0})},U.fromObservableLight(h)))}};xBe=I([m(0,Zx),m(1,_s),m(2,F),m(3,ge),m(4,B)],xBe);var gjt=class extends K{constructor(){super({id:"workbench.mcp.resetTrust",title:L(11769,"Reset Trust"),category:cv,f1:!0,precondition:C.and(xU.toolsCount.greater(0),ie.Setup.hidden.negate())})}run(i){i.get(_s).resetTrust()}},fjt=class extends K{constructor(){super({id:"workbench.mcp.resetCachedTools",title:L(11768,"Reset Cached Tools"),category:cv,f1:!0,precondition:C.and(xU.toolsCount.greater(0),ie.Setup.hidden.negate())})}run(i){i.get(_s).resetCaches()}},vjt=class extends K{constructor(){super({id:"workbench.mcp.addConfiguration",title:L(11733,"Add Server..."),metadata:{description:L(11734,"Installs a new Model Context protocol to the mcp.json settings")},category:cv,f1:!0,precondition:ie.Setup.hidden.negate(),menu:{id:D.EditorContent,when:C.and(C.regex(Wo.Path.key,/\.vscode[/\\]mcp\.json$/),fr.isEqualTo(w0),ie.Setup.hidden.negate())}})}async run(i,e){let t=i.get(F),o=i.get(Pe),n=e?o.getWorkspaceFolder(A.parse(e)):void 0;return t.createInstance(e0e,n??void 0).run()}},bjt=class extends K{constructor(){super({id:"workbench.mcp.installFromManifest",title:L(11761,"Install Server from Manifest..."),metadata:{description:L(11762,"Install an MCP server from a JSON manifest file")},category:cv,f1:!0,precondition:ie.Setup.hidden.negate()})}async run(i){return i.get(F).createInstance(t0e).run()}},Sjt=class extends K{constructor(){super({id:"workbench.mcp.removeStoredInput",title:L(11768,"Reset Cached Tools"),category:cv,f1:!1})}run(i,e,t){i.get(Lc).clearSavedInputs(e,t)}},Ijt=class extends K{constructor(){super({id:"workbench.mcp.editStoredInput",title:L(11758,"Edit Stored Input"),category:cv,f1:!1})}run(i,e,t,o,n){let r=t&&i.get(Pe).getWorkspaceFolder(t);i.get(Lc).editSavedInput(e,r||void 0,o,n)}},yjt=class extends K{constructor(){super({id:"workbench.mcp.showConfiguration",title:L(11748,"Show Configuration"),category:cv,f1:!1})}run(i,e,t){let o=i.get(Lc).collections.get().find(s=>s.id===e);if(!o)return;let n=o?.serverDefinitions.get().find(s=>s.id===t),r=i.get(ee);n?.presentation?.origin?r.openEditor({resource:n.presentation.origin.uri,options:{selection:n.presentation.origin.range}}):o.presentation?.origin&&r.openEditor({resource:o.presentation.origin})}},wjt=class extends K{constructor(){super({id:"workbench.mcp.showOutput",title:L(11749,"Show Output"),category:cv,f1:!1})}run(i,e){i.get(_s).servers.get().find(t=>t.definition.id===e)?.showOutput()}},Cjt=class extends K{constructor(){super({id:"workbench.mcp.restartServer",title:L(11746,"Restart Server"),category:cv,f1:!1})}async run(i,e,t){let o=i.get(_s).servers.get().find(n=>n.definition.id===e);o?.showOutput(),await o?.stop(),await o?.start({promptType:"all-untrusted",...t})}},xjt=class extends K{constructor(){super({id:"workbench.mcp.startServer",title:L(11750,"Start Server"),category:cv,f1:!1})}async run(i,e,t){let o=i.get(_s).servers.get();e!=="*"&&(o=o.filter(r=>r.definition.id===e));let n={promptType:"all-untrusted",...t};t?.waitForLiveTools?await Promise.all(o.map(r=>hW(r,n))):await Promise.all(o.map(r=>r.start(n)))}},kjt=class extends K{constructor(){super({id:"workbench.mcp.stopServer",title:L(11751,"Stop Server"),category:cv,f1:!1})}async run(i,e){await i.get(_s).servers.get().find(o=>o.definition.id===e)?.stop()}},Ejt=class extends K{constructor(){super({id:"workbench.mcp.browseServers",title:L(11739,"MCP Servers"),tooltip:L(11741,"Browse MCP Servers"),category:cv,icon:R.search,precondition:ie.Setup.hidden.negate(),menu:[{id:mg,group:"1_predefined",order:1,when:ie.Setup.hidden.negate()},{id:D.ViewTitle,when:C.and(C.equals("view",e_e),ie.Setup.hidden.negate()),group:"navigation"}]})}async run(i){i.get(Hi).openSearch("@mcp ")}};ve.appendMenuItem(D.CommandPalette,{command:{id:"workbench.mcp.browseServers",title:L(11740,"Browse MCP Servers"),category:cv,precondition:ie.Setup.hidden.negate()}});var Tjt=class extends K{constructor(){super({id:"workbench.mcp.showInstalledServers",title:L(11747,"Show Installed Servers"),category:cv,precondition:C.and(VJ,ie.Setup.hidden.negate()),f1:!0})}async run(i){let e=i.get($t);await e.openView(e_e,!0)||(await e.openViewContainer(pWe.id),await e.openView(e_e,!0))}};ve.appendMenuItem(ky,{command:{id:"workbench.mcp.showInstalledServers",title:L(11778,"MCP Servers")},when:C.and(ie.enabled,C.equals("view",Dr)),order:10,group:"2_level"});var _jt=class extends K{async run(i){let e=i.get(fe),t=i.get(ee),o=await this.getURI(i);await e.exists(o)||await e.createFile(o,qe.fromString(JSON.stringify({servers:{}},null,"	"))),await t.openEditor({resource:o})}},Djt=class extends _jt{constructor(){super({id:"workbench.mcp.openUserMcpJson",title:L(11743,"Open User Configuration"),category:cv,f1:!0,precondition:ie.Setup.hidden.negate()})}getURI(i){let e=i.get(ln);return Promise.resolve(e.currentProfile.mcpResource)}},Ljt=class extends _jt{constructor(){super({id:"workbench.mcp.openRemoteUserMcpJson",title:L(11742,"Open Remote User Configuration"),category:cv,f1:!0,precondition:C.and(ie.Setup.hidden.negate(),yb.notEqualsTo(""))})}async getURI(i){let e=i.get(ln);return(await i.get(GA).getRemoteProfile(e.currentProfile)).mcpResource}},Rjt=class extends K{constructor(){super({id:"workbench.mcp.openWorkspaceFolderMcpJson",title:L(11744,"Open Workspace Folder MCP Configuration"),category:cv,f1:!0,precondition:C.and(ie.Setup.hidden.negate(),sT.notEqualsTo(0))})}async run(i){let e=i.get(Pe),t=i.get(ge),o=i.get(ee),n=e.getWorkspace().folders,r=n.length===1?n[0]:await t.executeCommand(rM);r&&await o.openEditor({resource:r.toResource(RD[zv])})}},Mjt=class extends K{constructor(){super({id:"workbench.mcp.openWorkspaceMcpJson",title:L(11745,"Open Workspace MCP Configuration"),category:cv,f1:!0,precondition:C.and(ie.Setup.hidden.negate(),za.isEqualTo("workspace"))})}async run(i){let e=i.get(Pe),t=i.get(ee),o=e.getWorkspace().configuration;o&&await t.openEditor({resource:o})}},Pjt=class extends K{constructor(){super({id:"workbench.mcp.browseResources",title:L(11738,"Browse Resources..."),category:cv,precondition:C.and(xU.serverCount.greater(0),ie.Setup.hidden.negate()),f1:!0})}run(i,e){e?i.get(F).createInstance(wBe,e).pick():i.get(Ue).quickAccess.show(r6.PREFIX)}},Ajt=class extends K{constructor(){super({id:"workbench.mcp.configureSamplingModels",title:L(11754,"Configure SamplingModel"),category:cv})}async run(i,e){let t=i.get(Ue),o=i.get(ds),n=i.get(F4),r=new Set(n.getConfig(e).allowedModels),s=o.getLanguageModelIds().map(c=>{let u=o.lookupLanguageModel(c);if(u.isUserSelectable)return{label:u.name,description:u.tooltip,id:c,picked:r.size?r.has(c):u.isDefaultForLocation.panel}}).filter(lo);s.sort((c,u)=>(u.picked?1:0)-(c.picked?1:0)||c.label.localeCompare(u.label));let l=await t.pick(s,{placeHolder:d(11755,null,e.definition.label),canPickMany:!0});return l&&await n.updateConfig(e,c=>c.allowedModels=l.map(u=>u.id)),l?.length||0}},Njt=class extends K{constructor(){super({id:"workbench.mcp.startPromptForServer",title:L(11784,"Start Prompting Server"),category:cv,f1:!1})}async run(i,e){let t=await ujt(i.get($t),i.get(Pt));if(!t)return;let o=t.inputEditor,n=o.getModel();if(!n)return;let r=(o.getSelection()||n.getFullModelRange()).collapseToEnd(),s=Doo(e.definition)+".";n.applyEdits([{range:r,text:s}]),o.setSelection(z.fromPositions(r.getEndPosition().delta(0,s.length))),t.focusInput(),nc.get(o)?.triggerSuggest()}},Ojt=class extends K{constructor(){super({id:"workbench.mcp.skipAutostart",title:L(11782,"Skip Current Autostart"),category:cv,f1:!1})}async run(i){i.get(_s).cancelAutostart()}};var kBe=class extends x{static{this.ID="workbench.contrib.mcp.discovery"}constructor(i,e){super();let t=hr(Wk,"all",e),o=this._register(new N);this._register(be(n=>{o.clear();let r=t.read(n);if(r!=="none")for(let s of Tq.getAll()){let l=i.createInstance(s);if(r==="registry"&&!l.fromGallery){l.dispose();continue}o.add(l),l.start()}}))}};kBe=I([m(0,F),m(1,B)],kBe);var rne=class{constructor(i,e,t,o,n,r,s,l,c,u){this.title=i;this.message=e;this.subtitle=t;this.acceptButtonLabel=o;this.rejectButtonLabel=n;this._accept=r;this.source=l;this.moreActions=c;this.onHide=u;this.kind="elicitation2";this.state=Me("state","pending");this._isHiddenValue=Me("isHidden",!1);this.isHidden=this._isHiddenValue;s&&(this.reject=async()=>{let p=await s();this.state.set(p,void 0)})}accept(i){return this._accept(i).then(e=>{this.state.set(e,void 0)})}hide(){this._isHiddenValue.get()||(this._isHiddenValue.set(!0,void 0,void 0),this.onHide?.(),this.state.get()==="pending"&&this.state.set("rejected",void 0))}toJSON(){let i=this.state.get();return{kind:"elicitationSerialized",title:this.title,message:this.message,state:i==="pending"?"rejected":i,acceptedResult:this.acceptedResult,subtitle:this.subtitle,source:this.source,isHidden:this._isHiddenValue.get()}}};var XNi={id:void 0,label:d(11852,null),description:d(11853,null),alwaysShow:!0};function eun(a){return a.mode==="form"||a.mode===void 0&&!!a.requestedSchema}function tun(a){return a.mode==="url"}function cko(a){let i=a;return i.type==="string"&&Array.isArray(i.enum)&&Array.isArray(i.enumNames)}function dko(a){let i=a;return i.type==="string"&&Array.isArray(i.enum)}function uko(a){let i=a;return i.type==="string"&&Array.isArray(i.oneOf)}function pko(a){let i=a;return i.type==="array"&&!!i.items?.enum}function mko(a){let i=a;return i.type==="array"&&!!i.items?.anyOf}var EBe=class{constructor(i,e,t,o){this._notificationService=i;this._quickInputService=e;this._chatService=t;this._openerService=o}elicit(i,e,t,o){return eun(t)?this._elicitForm(i,e,t,o):tun(t)?this._elicitUrl(i,e,t,o):Promise.reject(new WJ("Unsupported elicitation type",Bv.INVALID_PARAMS,void 0))}async _elicitForm(i,e,t,o){let n=new N,r=await new Promise(s=>{let l=e?.chatSessionResource&&this._chatService.getSession(e.chatSessionResource);if(l instanceof Ef){let u=l.getRequests().at(-1);if(u){let{questions:p,idToPropertyMap:h}=this._convertSchemaToQuestions(t),g=new uW(p,!0,void 0,void 0,void 0,new Ie(t.message),BNe(i));l.acceptResponseProgress(u,g),n.add(o.onCancellationRequested(()=>{g.completion.complete({answers:void 0})})),g.completion.p.then(f=>{if(!f.answers)s({action:"cancel"});else{let v=this._convertCarouselAnswersToElicitResult(f.answers,h,t.requestedSchema.properties);s({action:"accept",content:v})}});return}}let c=this._notificationService.notify({message:t.message,source:d(11857,null,i.definition.label),severity:ft.Info,actions:{primary:[n.add(new it("mcp.elicit.give",d(11855,null),void 0,!0,()=>s(this._doElicitForm(t,o))))],secondary:[n.add(new it("mcp.elicit.cancel",d(11851,null),void 0,!0,()=>s({action:"decline"})))]}});n.add(c.onDidClose(()=>s({action:"cancel"}))),n.add(o.onCancellationRequested(()=>s({action:"cancel"})))}).finally(()=>n.dispose());return{kind:0,value:r,dispose:()=>{}}}async _elicitUrl(i,e,t,o){let n=new N,r=new Promise((c,u)=>{n.add(o.onCancellationRequested(()=>u(new go))),n.add(be(p=>{let g=i.connection.read(p)?.handler.read(p);g?p.store.add(g.onDidReceiveElicitationCompleteNotification(f=>{f.params.elicitationId===t.elicitationId&&c()})):dr.isRunning(i.connectionState.read(p))||u(new go)}))}).finally(()=>n.dispose()),s=new N,l=await new Promise(c=>{let u=e?.chatSessionResource&&this._chatService.getSession(e.chatSessionResource);if(u instanceof Ef){let p=u.getRequests().at(-1);if(p){let h=new rne(d(11863,null),new Ie().appendText(t.message).appendMarkdown(`

`+d(11859,null)).appendCodeblock("",t.url),d(11875,null,i.definition.label),d(11861,null,A.parse(t.url).authority),d(11856,null),async()=>{let g=await this._doElicitUrl(t,o);return c(g),r.then(()=>h.hide()),g.action==="accept"?"accepted":"rejected"},()=>(c({action:"decline"}),Promise.resolve("rejected")),BNe(i));u.acceptResponseProgress(p,h)}}else{let p=this._notificationService.notify({message:t.message+" "+d(11860,null,t.url),source:d(11857,null,i.definition.label),severity:ft.Info,actions:{primary:[s.add(new it("mcp.elicit.url.open2",d(11862,null),void 0,!0,()=>c(this._doElicitUrl(t,o))))],secondary:[s.add(new it("mcp.elicit.cancel",d(11851,null),void 0,!0,()=>c({action:"decline"})))]}});s.add(p.onDidClose(()=>c({action:"cancel"}))),s.add(o.onCancellationRequested(()=>c({action:"cancel"})))}}).finally(()=>s.dispose());return{kind:1,value:l,wait:r,dispose:()=>n.dispose()}}async _doElicitUrl(i,e){if(e.isCancellationRequested)return{action:"cancel"};try{if(await this._openerService.open(i.url,{allowCommands:!1}))return{action:"accept"}}catch{}return{action:"decline"}}async _doElicitForm(i,e){let t=this._quickInputService.createQuickPick(),o=new N;try{let n=Object.entries(i.requestedSchema.properties),r=new Set(i.requestedSchema.required||[]),s={},l=[];t.title=i.message,t.totalSteps=n.length,t.ignoreFocusOut=!0;for(let c=0;c<n.length;c++){let[u,p]=n[c],h=r.has(u),g=l.at(c);o.clear(),t.step=c+1,t.title=p.title||u,t.placeholder=this._getFieldPlaceholder(p,h),t.value=g?.value??"",t.validationMessage="",t.buttons=c>0?[this._quickInputService.backButton]:[];let f;if(p.type==="boolean"?(f=await this._handleEnumField(t,{enum:[{const:"true"},{const:"false"}],default:p.default?String(p.default):void 0},h,o,e),f.type==="value"&&(f.value=f.value==="true")):cko(p)?f=await this._handleEnumField(t,{enum:p.enum.map((v,b)=>({const:v,title:p.enumNames[b]})),default:p.default},h,o,e):dko(p)?f=await this._handleEnumField(t,{enum:p.enum.map(v=>({const:v})),default:p.default},h,o,e):uko(p)?f=await this._handleEnumField(t,{enum:p.oneOf,default:p.default},h,o,e):mko(p)?f=await this._handleMultiEnumField(t,{enum:p.items.anyOf,default:p.default},h,o,e):pko(p)?f=await this._handleMultiEnumField(t,{enum:p.items.enum.map(v=>({const:v})),default:p.default},h,o,e):(f=await this._handleInputField(t,p,h,o,e),f.type==="value"&&(p.type==="number"||p.type==="integer")&&(f.value=Number(f.value))),f.type==="back"){c-=2;continue}if(f.type==="cancel")return{action:"cancel"};l[c]={value:t.value},f.value===void 0?delete s[u]:s[u]=f.value}return{action:"accept",content:s}}finally{o.dispose(),t.dispose()}}_getFieldPlaceholder(i,e){let t=i.description||"";return e||(t=t?`${t} (${d(11876,null)})`:d(11876,null)),t}async _handleEnumField(i,e,t,o,n){let r=e.enum.map(({const:s,title:l})=>({id:s,label:s,description:l}));return t||r.push(XNi),i.canSelectMany=!1,i.items=r,e.default!==void 0&&(i.activeItems=r.filter(s=>s.id===e.default)),new Promise(s=>{o.add(n.onCancellationRequested(()=>s({type:"cancel"}))),o.add(i.onDidAccept(()=>{let l=i.selectedItems[0];l&&s({type:"value",value:l.id})})),o.add(i.onDidTriggerButton(()=>s({type:"back"}))),o.add(i.onDidHide(()=>s({type:"cancel"}))),i.show()})}async _handleMultiEnumField(i,e,t,o,n){let r=e.enum.map(({const:s,title:l})=>({id:s,label:s,description:l,picked:!!e.default?.includes(s),pickable:!0}));return t||r.push(XNi),i.canSelectMany=!0,i.items=r,new Promise(s=>{o.add(n.onCancellationRequested(()=>s({type:"cancel"}))),o.add(i.onDidAccept(()=>{i.selectedItems[0].id===void 0?s({type:"value",value:void 0}):s({type:"value",value:i.selectedItems.map(c=>c.id).filter(lo)})})),o.add(i.onDidTriggerButton(()=>s({type:"back"}))),o.add(i.onDidHide(()=>s({type:"cancel"}))),i.show()})}async _handleInputField(i,e,t,o,n){i.canSelectMany=!1;let r=()=>{let s=[];if(i.value){let l=this._validateInput(i.value,e);i.validationMessage=l.message,l.isValid&&s.push({id:"$current",label:`\u27A4 ${i.value}`})}else i.validationMessage="",e.default&&s.push({id:"$default",label:`${e.default}`,description:d(11864,null)});i.validationMessage?i.severity=ft.Warning:(i.severity=ft.Ignore,t||s.push(XNi)),i.items=s};return r(),new Promise(s=>{if(n.isCancellationRequested){s({type:"cancel"});return}o.add(n.onCancellationRequested(()=>s({type:"cancel"}))),o.add(i.onDidChangeValue(r)),o.add(i.onDidAccept(()=>{let l=i.selectedItems[0].id;l?l==="$default"?s({type:"value",value:String(e.default)}):i.validationMessage||s({type:"value",value:i.value}):s({type:"value",value:void 0})})),o.add(i.onDidTriggerButton(()=>s({type:"back"}))),o.add(i.onDidHide(()=>s({type:"cancel"}))),i.show()})}_validateInput(i,e){switch(e.type){case"string":return this._validateString(i,e);case"number":case"integer":return this._validateNumber(i,e);default:os(e)}}_validateString(i,e){if(e.minLength&&i.length<e.minLength)return{isValid:!1,message:d(11872,null,e.minLength)};if(e.maxLength&&i.length>e.maxLength)return{isValid:!1,message:d(11870,null,e.maxLength)};if(e.format){let t=this._validateStringFormat(i,e.format);if(!t.isValid)return t}return{isValid:!0,parsedValue:i}}_validateStringFormat(i,e){switch(e){case"email":return i.includes("@")?{isValid:!0}:{isValid:!1,message:d(11867,null)};case"uri":return URL.canParse(i)?{isValid:!0}:{isValid:!1,message:d(11874,null)};case"date":{if(!/^\d{4}-\d{2}-\d{2}$/.test(i))return{isValid:!1,message:d(11865,null)};let o=new Date(i);return isNaN(o.getTime())?{isValid:!1,message:d(11865,null)}:{isValid:!0}}case"date-time":{let t=new Date(i);return isNaN(t.getTime())?{isValid:!1,message:d(11866,null)}:{isValid:!0}}default:return{isValid:!0}}}_validateNumber(i,e){let t=Number(i);return isNaN(t)?{isValid:!1,message:d(11873,null)}:e.type==="integer"&&!Number.isInteger(t)?{isValid:!1,message:d(11868,null)}:e.minimum!==void 0&&t<e.minimum?{isValid:!1,message:d(11871,null,e.minimum)}:e.maximum!==void 0&&t>e.maximum?{isValid:!1,message:d(11869,null,e.maximum)}:{isValid:!0,parsedValue:t}}_convertSchemaToQuestions(i){let e=Object.entries(i.requestedSchema.properties),t=new Set(i.requestedSchema.required||[]),o=[],n=new Map;for(let[r,s]of e){let l=xt();n.set(l,r);let c=s.title||r,u=s.description,p=t.has(r);if(s.type==="boolean")o.push({id:l,type:"singleSelect",title:c,description:u,required:p,allowFreeformInput:!1,options:[{id:"true",label:d(11858,null),value:"true"},{id:"false",label:d(11854,null),value:"false"}],defaultValue:s.default!==void 0?String(s.default):void 0});else if(cko(s))o.push({id:l,type:"singleSelect",title:c,description:u,required:p,allowFreeformInput:!1,options:s.enum.map((h,g)=>({id:h,label:s.enumNames[g]?`${h} - ${s.enumNames[g]}`:h,value:h})),defaultValue:s.default});else if(uko(s))o.push({id:l,type:"singleSelect",title:c,description:u,required:p,allowFreeformInput:!1,options:s.oneOf.map(({const:h,title:g})=>({id:h,label:g?`${h} - ${g}`:h,value:h})),defaultValue:s.default});else if(dko(s))o.push({id:l,type:"singleSelect",title:c,description:u,required:p,allowFreeformInput:!1,options:s.enum.map(h=>({id:h,label:h,value:h})),defaultValue:s.default});else if(mko(s))o.push({id:l,type:"multiSelect",title:c,description:u,required:p,allowFreeformInput:!1,options:s.items.anyOf.map(({const:h,title:g})=>({id:h,label:g?`${h} - ${g}`:h,value:h})),defaultValue:s.default});else if(pko(s))o.push({id:l,type:"multiSelect",title:c,description:u,required:p,allowFreeformInput:!1,options:s.items.enum.map(h=>({id:h,label:h,value:h})),defaultValue:s.default});else{let h={};s.type==="string"?(s.minLength!==void 0&&(h.minLength=s.minLength),s.maxLength!==void 0&&(h.maxLength=s.maxLength),s.format&&(h.format=s.format)):(s.type==="number"||s.type==="integer")&&(s.minimum!==void 0&&(h.minimum=s.minimum),s.maximum!==void 0&&(h.maximum=s.maximum),s.type==="integer"&&(h.isInteger=!0)),o.push({id:l,type:"text",title:c,description:u,required:p,defaultValue:s.default!==void 0?String(s.default):void 0,validation:Object.keys(h).length>0?h:void 0})}}return{questions:o,idToPropertyMap:n}}_convertCarouselAnswersToElicitResult(i,e,t){let o={};for(let[n,r]of Object.entries(i)){let s=e.get(n);if(!s)continue;let l=t[s];if(!l)continue;let c=r;if(typeof r=="object"&&r!==null){let u=r;"selectedValue"in u?c=u.selectedValue:"selectedValues"in u?c=u.selectedValues:"freeformValue"in u&&u.freeformValue&&(c=u.freeformValue)}if(c!=null)if(l.type==="boolean")o[s]=c==="true"||c===!0;else if(l.type==="number"||l.type==="integer"){let u=Number(c);isNaN(u)||(o[s]=u)}else l.type==="array"?Array.isArray(c)&&(o[s]=c.map(u=>String(u))):o[s]=String(c)}return o}};EBe=I([m(0,Ne),m(1,Ue),m(2,mi),m(3,Je)],EBe);var JNi="vscode.mcp",TBe=class extends x{constructor(e,t,o,n,r,s){super();this._mcpRegistry=t;this._mcpWorkbenchService=o;this._mcpService=n;this._markerService=r;this._configurationResolverService=s;this._cachedMcpSection=this._register(new me);let l=[{pattern:"**/mcp.json"},{pattern:"**/workspace.json"}],c=this._register(new E),u={onDidChange:c.event,provideCodeLenses:(p,h)=>this._provideCodeLenses(p,()=>c.fire(u))};this._register(e.codeLensProvider.register(l,u)),this._register(e.inlayHintsProvider.register(l,{onDidChangeInlayHints:t.onDidChangeInputs,provideInlayHints:(p,h)=>this._provideInlayHints(p,h)}))}async _parseModel(e){if(this._cachedMcpSection.value?.model===e)return this._cachedMcpSection.value;let t=e.uri,o=await this._mcpWorkbenchService.getMcpConfigPath(e.uri);if(!o)return;let n=e.getValue(),r=_R(n),s=[e.onDidChangeContent(()=>this._cachedMcpSection.clear()),e.onWillDispose(()=>this._cachedMcpSection.clear())];return this._addDiagnostics(e,n,r,o),this._cachedMcpSection.value={model:e,tree:r,inConfig:o,dispose:()=>{this._markerService.remove(JNi,[t]),Be(s)}}}_addDiagnostics(e,t,o,n){let r=OC(o,n.section?[...n.section,"servers"]:["servers"]);if(!r)return;let s=c=>{let u="",p=1/0;for(let h of this._configurationResolverService.resolvableVariables){let g=yji(c,h);g<p&&(p=g,u=h)}return u},l=[];Fjt(r,c=>{let u=TS.parse(c.value);for(let{id:p,name:h,arg:g}of u.unresolved())if(!this._configurationResolverService.resolvableVariables.has(h)){let f=t.indexOf(p,c.offset);if(f===-1)continue;let v=e.getPositionAt(f),b=e.getPositionAt(f+p.length);l.push({severity:4,message:d(11889,null,h,s(h)+(g?`:${g}`:"")),startLineNumber:v.lineNumber,startColumn:v.column,endLineNumber:b.lineNumber,endColumn:b.column,modelVersionId:e.getVersionId()})}}),l.length?this._markerService.changeOne(JNi,e.uri,l):this._markerService.remove(JNi,[e.uri])}async _provideCodeLenses(e,t){let o=await this._parseModel(e);if(!o)return;let{tree:n,inConfig:r}=o,s=OC(n,r.section?[...r.section,"servers"]:["servers"]);if(!s)return;let l=new N,c=[],u={lenses:c,dispose:()=>l.dispose()},p=f=>(l.add(U.fromObservableLight(f)(t)),f.get()),h=p(this._mcpRegistry.collections).find(f=>Qe(f.presentation?.origin,e.uri));if(!h)return u;let g=p(this._mcpService.servers).filter(f=>f.collection.id===h.id);for(let f of s.children||[]){if(f.type!=="property"||f.children?.[0]?.type!=="string")continue;let v=f.children[0].value,b=g.find(k=>k.definition.label===v);if(!b)continue;let S=z.fromPositions(e.getPositionAt(f.children[0].offset)),y=!!b.readDefinitions().get().server?.devMode?.debug,w=p(b.connectionState).state;switch(w){case dr.Kind.Error:c.push({range:S,command:{id:"workbench.mcp.showOutput",title:"$(error) "+d(11890,null),arguments:[b.definition.id]}},{range:S,command:{id:"workbench.mcp.restartServer",title:d(11885,null),arguments:[b.definition.id,{autoTrustChanges:!0}]}}),y&&c.push({range:S,command:{id:"workbench.mcp.restartServer",title:d(11884,null),arguments:[b.definition.id,{debug:!0,autoTrustChanges:!0}]}});break;case dr.Kind.Starting:c.push({range:S,command:{id:"workbench.mcp.showOutput",title:"$(loading~spin) "+d(11893,null),arguments:[b.definition.id]}},{range:S,command:{id:"workbench.mcp.stopServer",title:d(11877,null),arguments:[b.definition.id]}});break;case dr.Kind.Running:c.push({range:S,command:{id:"workbench.mcp.showOutput",title:"$(check) "+d(11892,null),arguments:[b.definition.id]}},{range:S,command:{id:"workbench.mcp.stopServer",title:d(11888,null),arguments:[b.definition.id]}},{range:S,command:{id:"workbench.mcp.restartServer",title:d(11885,null),arguments:[b.definition.id,{autoTrustChanges:!0}]}}),y&&c.push({range:S,command:{id:"workbench.mcp.restartServer",title:d(11884,null),arguments:[b.definition.id,{autoTrustChanges:!0,debug:!0}]}});break;case dr.Kind.Stopped:c.push({range:S,command:{id:"workbench.mcp.startServer",title:"$(debug-start) "+d(11887,null),arguments:[b.definition.id,{autoTrustChanges:!0}]}}),y&&c.push({range:S,command:{id:"workbench.mcp.startServer",title:d(11884,null),arguments:[b.definition.id,{autoTrustChanges:!0,debug:!0}]}})}if(w!==dr.Kind.Error){let k=p(b.tools).length;k&&c.push({range:S,command:{id:"",title:d(11894,null,k)}});let T=p(b.prompts).length;T&&c.push({range:S,command:{id:"workbench.mcp.startPromptForServer",title:d(11891,null,T),arguments:[b]}}),c.push({range:S,command:{id:"workbench.mcp.serverOptions",title:d(11886,null),arguments:[b.definition.id]}})}}return u}async _provideInlayHints(e,t){let o=await this._parseModel(e);if(!o)return;let{tree:n,inConfig:r}=o,s=r.section?OC(n,[...r.section]):n;if(!s)return;let l=OC(s,["inputs"]);if(!l)return;let c=await this._mcpRegistry.getSavedInputs(r.scope),u=[],p=OC(s,["servers"]);return p&&h(p),g(l),{hints:u,dispose:()=>{}};function h(v){Fjt(v,b=>{let S=TS.parse(b.value);for(let{id:y}of S.unresolved()){let w=c[y];w&&f(y,b.offset+b.value.indexOf(y)+y.length,w)}})}function g(v){if(!(v.type!=="array"||!v.children))for(let b of v.children){if(b.type!=="object"||!b.children)continue;let S=b.children.find(T=>T.type==="property"&&T.children?.[0].value==="id");if(!S)continue;let y=S.children[1];if(!y||y.type!=="string"||!y.value)continue;let w="${input:"+y.value+"}",k=c[w];k&&f(w,y.offset+1+y.length,k)}}function f(v,b,S){let y=new Ie([pw({id:"workbench.mcp.editStoredInput",text:d(11882,null),arguments:[v,e.uri,j0,r.target],tooltip:d(11883,null)}),pw({id:"workbench.mcp.removeStoredInput",text:d(11878,null),arguments:[r.scope,v],tooltip:d(11879,null)}),pw({id:"workbench.mcp.removeStoredInput",text:d(11880,null),arguments:[r.scope],tooltip:d(11881,null)})].join(" | "),{isTrusted:!0}),w={label:"= "+(S.input?.type==="promptString"&&S.input.password?"*".repeat(10):S.value||""),position:e.getPositionAt(b),tooltip:y,paddingLeft:!0};return u.push(w),w}}};TBe=I([m(0,Qt),m(1,Lc),m(2,Ng),m(3,_s),m(4,oa),m(5,Tp)],TBe);function Fjt(a,i){a.type==="string"&&typeof a.value=="string"&&a.value.includes(TS.VARIABLE_LHS)?i(a):a.type==="property"?a.children?.slice(1).forEach(e=>Fjt(e,i)):a.children?.forEach(e=>Fjt(e,i))}var rve=class extends x{constructor(e,t,o,n,r,s,l,c){super();this.mcpManagementService=e;this.userDataProfileService=t;this.fileService=o;this.remoteAgentService=n;this.jsonEditingService=r;this.logService=s;this.notificationService=l;this.commandService=c;this.migrateMcpConfig()}static{this.ID="workbench.mcp.config.migration"}async migrateMcpConfig(){try{let t=await this.parseMcpConfig(this.userDataProfileService.currentProfile.settingsResource);t&&t.servers&&Object.keys(t.servers).length>0&&(await Promise.all(Object.entries(t.servers).map(([o,n],r)=>this.mcpManagementService.install({name:o,config:n,inputs:r===0?t.inputs:void 0}))),await this.removeMcpConfig(this.userDataProfileService.currentProfile.settingsResource))}catch(t){this.logService.error("MCP migration: Failed to migrate user MCP config",t)}this.watchForMcpConfiguration(this.userDataProfileService.currentProfile.settingsResource,!1);let e=await this.remoteAgentService.getEnvironment();if(e){try{let t=await this.parseMcpConfig(e.settingsPath);t&&t.servers&&Object.keys(t.servers).length>0&&(await Promise.all(Object.entries(t.servers).map(([o,n],r)=>this.mcpManagementService.install({name:o,config:n,inputs:r===0?t.inputs:void 0},{target:4}))),await this.removeMcpConfig(e.settingsPath))}catch(t){this.logService.error("MCP migration: Failed to migrate remote MCP config",t)}this.watchForMcpConfiguration(e.settingsPath,!0)}}watchForMcpConfiguration(e,t){this._register(this.fileService.watch(e)),this._register(this.fileService.onDidFilesChange(o=>{o.contains(e)&&this.checkForMcpConfigInFile(e,t)}))}async checkForMcpConfigInFile(e,t){try{let o=await this.parseMcpConfig(e);o&&o.servers&&Object.keys(o.servers).length>0&&this.showMcpConfigErrorNotification(t)}catch{}}showMcpConfigErrorNotification(e){let t=e?d(11897,null):d(11899,null),o=e?d(11895,null):d(11896,null),n=e?"workbench.mcp.openRemoteUserMcpJson":"workbench.mcp.openUserMcpJson";this.notificationService.prompt(ft.Error,t,[{label:d(11898,null),run:async()=>{await this.migrateMcpConfig(),await this.commandService.executeCommand(n)}},{label:o,keepOpen:!0,run:()=>this.commandService.executeCommand(n)}])}async parseMcpConfig(e){try{let t=await this.fileService.readFile(e),o=zT(t.value.toString());if(!xi(o))return;let n=o[j0];if(n&&n.servers)for(let[,r]of Object.entries(n.servers))r.type===void 0&&(r.type=r.command?"stdio":"http");return n}catch(t){Au(t)!==1&&this.logService.warn(`MCP migration: Failed to parse MCP config from ${e}:`,t);return}}async removeMcpConfig(e){try{await this.jsonEditingService.write(e,[{path:[j0],value:void 0}],!0)}catch(t){this.logService.warn(`MCP migration: Failed to remove MCP config from ${e}:`,t)}}};rve=I([m(0,bQ),m(1,ln),m(2,fe),m(3,bo),m(4,bg),m(5,se),m(6,Ne),m(7,ge)],rve);var sne=class extends _Q{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super(t,o,n,c,u,p,r,h,s,l);this.mpcViewOptions=e;this.dialogService=g;this.mcpWorkbenchService=f;this.mcpGalleryManifestService=v;this.layoutService=b;this.markdownRendererService=S;this.logService=y;this.list=null;this.listContainer=null;this.welcomeContainer=null;this.contextMenuActionRunner=this._register(new rs);this.modalNavigationDisposable=this._register(new me)}renderBody(e){super.renderBody(e),this.welcomeContainer=M(e,_(".mcp-welcome-container.hide")),this.createWelcomeContent(this.welcomeContainer);let t=M(e,_(".message-container")),o=M(t,_("")),n=M(t,_(".message")),r=_(".mcp-servers-list");this.bodyTemplate={mcpServersList:r,messageBox:n,messageContainer:t,messageSeverityIcon:o},this.listContainer=M(e,r),this.list=this._register(this.instantiationService.createInstance(Qz,`${this.id}-MCP-Servers`,this.listContainer,{getHeight(){return 72},getTemplateId:()=>ane.templateId},[this.instantiationService.createInstance(ane,{hoverOptions:{position:()=>{let s=this.viewDescriptorService.getViewLocationById(this.id);return s===0?this.layoutService.getSideBarPosition()===0?1:0:s===2?this.layoutService.getSideBarPosition()===0?0:1:1}}})],{multipleSelectionSupport:!1,setRowLineHeight:!1,horizontalScrolling:!1,accessibilityProvider:{getAriaLabel(s){return s?.label??""},getWidgetAriaLabel(){return d(11996,null)}},overrideStyles:h2(this.viewDescriptorService.getViewLocationById(this.id)).listOverrideStyles,openOnSingleClick:!0})),this._register(U.debounce(U.filter(this.list.onDidOpen,s=>s.element!==null),(s,l)=>l,75,!0)(s=>{this.mcpWorkbenchService.open(s.element,{...s.editorOptions,modal:s.sideBySide?void 0:NDi(s.element,()=>this.list?.model,(l,c)=>l.id===c.id,(l,c)=>this.mcpWorkbenchService.open(l,{pinned:!1,modal:c}),this.modalNavigationDisposable,this.logService)})})),this._register(this.list.onContextMenu(s=>this.onContextMenu(s),this)),this.input&&this.renderInput()}async onContextMenu(e){if(e.element){let t=new N,o=e.element&&this.mcpWorkbenchService.local.find(s=>s.id===e.element.id)||e.element,n=fst(o,!1,this.instantiationService),r=[];for(let s of n){for(let l of s)r.push(l),jc(l)&&t.add(l);r.push(new ri)}r.pop(),this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>r,actionRunner:this.contextMenuActionRunner,onHide:()=>t.dispose()})}}layoutBody(e,t){super.layoutBody(e,t),this.list?.layout(e,t)}async show(e){return this.input&&(this.input.disposables.dispose(),this.input=void 0),this.mpcViewOptions.showWelcome?this.input={model:new Wm([]),disposables:new N,showWelcomeContent:!0}:this.input=await this.query(e.trim()),this.renderInput(),this.input.onDidChangeModel&&this.input.disposables.add(this.input.onDidChangeModel(t=>{this.input&&(this.input.model=t,this.renderInput())})),this.input.model}renderInput(){this.input&&(this.list&&(this.list.model=new eQ(this.input.model)),this.showWelcomeContent(!!this.input.showWelcomeContent),this.input.showWelcomeContent||this.updateBody())}showWelcomeContent(e){this.welcomeContainer?.classList.toggle("hide",!e),this.listContainer?.classList.toggle("hide",e)}createWelcomeContent(e){let t=M(e,_(".mcp-welcome-content")),o=M(t,_(".mcp-welcome-icon")),n=M(o,_("span"));n.className=q.asClassName(cVe);let r=M(t,_(".mcp-welcome-title"));r.textContent=d(12005,null);let s=pw({id:"workbench.action.openSettings",arguments:[`@id:${aG}`],text:aG,tooltip:d(12004,null)}).toString(),l=M(t,_(".mcp-welcome-description")),c=this._register(this.markdownRendererService.render(new Ie(d(12002,null),{isTrusted:{enabledCommands:["workbench.action.openSettings"]}}).appendMarkdown(`

`).appendMarkdown(d(12000,null,s))));l.appendChild(c.element);let u=M(t,_(".mcp-welcome-button-container")),p=this._register(new Wi(u,{title:d(12003,null),...Qo}));p.label=d(12003,null),this._register(p.onDidClick(async()=>{let{result:h}=await this.dialogService.prompt({type:"info",message:d(12001,null),custom:{markdownDetails:[{markdown:new Ie(d(12000,null,s),{isTrusted:!0})}]},buttons:[{label:d(11999,null),run:()=>!0},{label:d(11998,null),run:()=>!1}]});h&&await this.configurationService.updateValue(aG,!0)}))}updateBody(e){if(this.bodyTemplate){let t=this.input?.model.length??0;this.bodyTemplate.mcpServersList.classList.toggle("hidden",t===0),this.bodyTemplate.messageContainer.classList.toggle("hidden",!e&&t>0),this.isBodyVisible()&&(e?(this.bodyTemplate.messageSeverityIcon.className=sk.className(e.severity),this.bodyTemplate.messageBox.textContent=e.text):t===0&&(this.bodyTemplate.messageSeverityIcon.className="",this.bodyTemplate.messageBox.textContent=d(12006,null)),this.bodyTemplate.messageBox.textContent&&en(this.bodyTemplate.messageBox.textContent))}}async query(e){let t=new N;if(e){let r=await this.mcpWorkbenchService.queryGallery({text:e.replace("@mcp","")});return{model:t.add(new lKt(r)),disposables:t}}let o=t.add(new E),n=await this.mcpWorkbenchService.queryLocal();return t.add(U.debounce(this.mcpWorkbenchService.onChange,()=>{})(()=>{let r=this.mergeChangedMcpServers(n,[...this.mcpWorkbenchService.local]);r&&(n=r,o.fire(new Wm(n)))})),t.add(this.mcpWorkbenchService.onReset(()=>o.fire(new Wm([...this.mcpWorkbenchService.local])))),{model:new Wm(n),onDidChangeModel:o.event,disposables:t}}mergeChangedMcpServers(e,t){let o=[...e],n=s=>{let l=-1,c=t[s];return c&&(l=o.findIndex(u=>u.id===c.id),l===-1)?n(s-1):l},r=!1;for(let s=0;s<t.length;s++){let l=t[s];e.every(c=>c.id!==l.id)&&(r=!0,e.splice(n(s-1)+1,0,l))}for(let s=e.length-1;s>=0;s--){let l=e[s];t.every(c=>c.id!==l.id)&&t.some(c=>c.name===l.name)&&(r=!0,e.splice(s,1))}if(!r&&e.length===t.length){for(let s=0;s<t.length;s++)if(e[s]?.id!==t[s]?.id){r=!0,e=t;break}}return r?e:void 0}};sne=I([m(2,_e),m(3,Xe),m(4,F),m(5,Le),m(6,nt),m(7,B),m(8,X),m(9,Bi),m(10,Je),m(11,at),m(12,Ng),m(13,WB),m(14,yi),m(15,On),m(16,se)],sne);var ane=class{constructor(i,e,t,o){this.options=i;this.instantiationService=e;this.mcpWorkbenchService=t;this.notificationService=o;this.templateId=ane.templateId}static{this.templateId="mcpServer"}renderTemplate(i){let e=M(i,_(".mcp-server-item.extension-list-item")),t=M(e,_(".icon-container")),o=this.instantiationService.createInstance(Boe,t),n=M(e,_(".details")),r=M(n,_(".header-container")),s=M(r,_(".header")),l=M(s,_("span.name")),c=M(s,_("span.ratings")),u=M(n,_(".description.ellipsis")),p=M(n,_(".footer")),h=this.instantiationService.createInstance(Hoe,M(p,_(".publisher-container")),!0),g=new Zi(p,{actionViewItemProvider:(k,T)=>{if(k instanceof HQ)return k.createActionViewItem(T)},focusOnlyEnabledItems:!0});g.setFocusable(!1);let f=g.onDidRun(({error:k})=>k&&this.notificationService.error(k)),v=this.instantiationService.createInstance(aL),b=[this.instantiationService.createInstance(YT,!0),this.instantiationService.createInstance(nVe),this.instantiationService.createInstance(HM,!1),v],S=[o,h,this.instantiationService.createInstance(Lfe,c,!0),this.instantiationService.createInstance(Uoe,t),this.instantiationService.createInstance(dVe,{target:i,position:this.options.hoverOptions.position},v)],y=this.instantiationService.createInstance(OJ,[...b,...S]);g.push(b,{icon:!0,label:!0});let w=wn(...b,...S,g,f,y);return{root:i,element:e,name:l,description:u,starred:c,disposables:[w],actionbar:g,mcpServerDisposables:[],set mcpServer(k){y.mcpServer=k}}}renderPlaceholder(i,e){e.element.classList.add("loading"),e.mcpServerDisposables=Be(e.mcpServerDisposables),e.name.textContent="",e.description.textContent="",e.starred.style.display="none",e.mcpServer=null}renderElement(i,e,t){t.element.classList.remove("loading"),t.mcpServerDisposables=Be(t.mcpServerDisposables),t.root.setAttribute("data-mcp-server-id",i.id),t.name.textContent=i.label,t.description.textContent=i.description,t.starred.style.display="",t.mcpServer=i;let o=()=>t.root.classList.toggle("disabled",!!i.runtimeStatus?.state&&i.runtimeStatus.state!==4);o(),t.mcpServerDisposables.push(this.mcpWorkbenchService.onChange(n=>{(!n||n.id===i.id)&&o()}))}disposeElement(i,e,t){t.mcpServerDisposables=Be(t.mcpServerDisposables)}disposeTemplate(i){i.mcpServerDisposables=Be(i.mcpServerDisposables),i.disposables=Be(i.disposables)}};ane=I([m(1,F),m(2,Ng),m(3,Ne)],ane);var Wjt=class extends sne{renderBody(i){super.renderBody(i),this._register(this.mcpGalleryManifestService.onDidChangeMcpGalleryManifest(()=>this.show()))}async show(){return super.show("@mcp")}},Jst=class extends x{static{this.ID="workbench.mcp.servers.views.contribution"}constructor(){super(),ne.as(Mn.ViewsRegistry).registerViews([{id:e_e,name:L(11997,"MCP Servers - Installed"),ctorDescriptor:new Ft(sne,[{}]),when:C.and(QC,VJ,ie.Setup.hidden.negate()),weight:40,order:4,canToggleVisibility:!0},{id:"workbench.views.mcp.default.marketplace",name:L(11995,"MCP Servers"),ctorDescriptor:new Ft(Wjt,[{}]),when:C.and(QC,VJ.toNegated(),ie.Setup.hidden.negate(),_ue.isEqualTo("available"),C.or(hE.create(`config.${t8}`),eB.notEqualsTo("stable"),hE.create(`config.${aG}`))),weight:40,order:4,canToggleVisibility:!0},{id:"workbench.views.mcp.marketplace",name:L(11995,"MCP Servers"),ctorDescriptor:new Ft(sne,[{}]),when:C.and(u7e,ie.Setup.hidden.negate(),_ue.isEqualTo("available"),C.or(hE.create(`config.${t8}`),eB.notEqualsTo("stable"),hE.create(`config.${aG}`)))},{id:"workbench.views.mcp.default.welcomeView",name:L(11995,"MCP Servers"),ctorDescriptor:new Ft(Wjt,[{showWelcome:!0}]),when:C.and(QC,VJ.toNegated(),ie.Setup.hidden.negate(),_ue.isEqualTo("available"),hE.create(`config.${t8}`).negate(),eB.isEqualTo("stable"),hE.create(`config.${aG}`).negate()),weight:40,order:4,canToggleVisibility:!0},{id:"workbench.views.mcp.welcomeView",name:L(11995,"MCP Servers"),ctorDescriptor:new Ft(sne,[{showWelcome:!0}]),when:C.and(u7e,ie.Setup.hidden.negate(),_ue.isEqualTo("available"),hE.create(`config.${t8}`).negate(),eB.isEqualTo("stable"),hE.create(`config.${aG}`).negate())}],pWe)}};var RN=class{constructor(i,e,t,o,n,r,s){this.installStateProvider=i;this.runtimeStateProvider=e;this.local=t;this.gallery=o;this.installable=n;this.mcpGalleryService=r;this.fileService=s;this.local=t}get id(){return this.local?.id??this.gallery?.name??this.installable?.name??this.name}get name(){return this.gallery?.name??this.local?.name??this.installable?.name??""}get label(){return this.gallery?.displayName??this.local?.displayName??this.local?.name??this.installable?.name??""}get icon(){return this.gallery?.icon??this.local?.icon}get installState(){return this.installStateProvider(this)}get codicon(){return this.gallery?.codicon??this.local?.codicon}get publisherDisplayName(){return this.gallery?.publisherDisplayName??this.local?.publisherDisplayName??this.gallery?.publisher??this.local?.publisher}get publisherUrl(){return this.gallery?.publisherDomain?.link}get description(){return this.gallery?.description??this.local?.description??""}get starsCount(){return this.gallery?.starsCount??0}get license(){return this.gallery?.license}get repository(){return this.gallery?.repositoryUrl}get config(){return this.local?.config??this.installable?.config}get runtimeStatus(){return this.runtimeStateProvider(this)}get readmeUrl(){return this.local?.readmeUrl??(this.gallery?.readmeUrl?A.parse(this.gallery.readmeUrl):void 0)}async getReadme(i){return this.local?.readmeUrl?(await this.fileService.readFile(this.local.readmeUrl)).value.toString():this.gallery?.readme?this.gallery.readme:this.gallery?.readmeUrl?this.mcpGalleryService.getReadme(this.gallery,i):Promise.reject(new Error("not available"))}async getManifest(i){if(this.local?.manifest)return this.local.manifest;if(this.gallery)return this.gallery.configuration;throw new Error("No manifest available")}};RN=I([m(5,sG),m(6,fe)],RN);var _Be=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k){super();this.mcpGalleryService=t;this.mcpManagementService=o;this.editorService=n;this.userDataProfilesService=r;this.uriIdentityService=s;this.workspaceService=l;this.environmentService=c;this.labelService=u;this.productService=p;this.remoteAgentService=h;this.configurationService=g;this.instantiationService=f;this.telemetryService=v;this.logService=b;this.extensionsWorkbenchService=S;this.allowedMcpServersService=y;this.mcpService=w;this.installing=[];this.uninstalling=[];this._local=[];this._onChange=this._register(new E);this.onChange=this._onChange.event;this._onReset=this._register(new E);this.onReset=this._onReset.event;this._register(this.mcpManagementService.onDidInstallMcpServersInCurrentProfile(T=>this.onDidInstallMcpServers(T))),this._register(this.mcpManagementService.onDidUpdateMcpServersInCurrentProfile(T=>this.onDidUpdateMcpServers(T))),this._register(this.mcpManagementService.onDidUninstallMcpServerInCurrentProfile(T=>this.onDidUninstallMcpServer(T))),this._register(this.mcpManagementService.onDidChangeProfile(T=>this.onDidChangeProfile())),this.queryLocal().then(()=>{if(this._store.isDisposed)return;let T=this._register(new uh);this._register(e.onDidChangeMcpGalleryManifest(P=>T.queue(()=>this.syncInstalledMcpServers()))),T.queue(()=>this.syncInstalledMcpServers())}),k.registerHandler(this),this._register(this.configurationService.onDidChangeConfiguration(T=>{T.affectsConfiguration(Wk)&&this._onChange.fire(void 0)})),this._register(this.allowedMcpServersService.onDidChangeAllowedMcpServers(()=>{this._local=this.sort(this._local),this._onChange.fire(void 0)})),this._register(Vs(w.servers,()=>{this._local=this.sort(this._local),this._onChange.fire(void 0)})),this._register(be(T=>{for(let P of w.servers.read(T))P.enablement.read(T);this._onChange.fire(void 0)}))}get local(){return[...this._local]}async onDidChangeProfile(){await this.queryLocal(),this._onChange.fire(void 0),this._onReset.fire()}areSameMcpServers(e,t){return e===t?!0:!e||!t?!1:e.name===t.name&&e.scope===t.scope}onDidUninstallMcpServer(e){if(e.error)return;let t=this._local.find(o=>this.areSameMcpServers(o.local,e));t&&(this._local=this._local.filter(o=>o!==t),this._onChange.fire(t))}onDidInstallMcpServers(e){let t=[];for(let{local:o,source:n,name:r}of e){let s=this.installing.find(l=>l.local&&o?this.areSameMcpServers(l.local,o):l.name===r);this.installing=s?this.installing.filter(l=>l!==s):this.installing,o&&(s?s.local=o:s=this.instantiationService.createInstance(RN,l=>this.getInstallState(l),l=>this.getRuntimeStatus(l),o,n,void 0),o.galleryUrl||(s.gallery=void 0),this._local=this._local.filter(l=>!this.areSameMcpServers(l.local,o)),this.addServer(s)),this._onChange.fire(s)}t.some(o=>o.local?.galleryUrl&&!o.gallery)&&this.syncInstalledMcpServers()}onDidUpdateMcpServers(e){for(let t of e){if(!t.local)continue;let o=this._local.findIndex(r=>this.areSameMcpServers(r.local,t.local)),n;o!==-1?(this._local[o].local=t.local,n=this._local[o]):(n=this.instantiationService.createInstance(RN,r=>this.getInstallState(r),r=>this.getRuntimeStatus(r),t.local,t.source,void 0),this.addServer(n)),this._onChange.fire(n)}}fromGallery(e){for(let t of this._local)if(t.name===e.name)return t.gallery=e,t}async syncInstalledMcpServers(){let e=[];for(let t of this.local)t.local?.source==="gallery"&&t.local.galleryUrl&&e.push({name:t.local.name,id:t.local.galleryId});if(e.length){let t=await this.mcpGalleryService.getMcpServersFromGallery(e);await this.syncInstalledMcpServersWithGallery(t)}}async syncInstalledMcpServersWithGallery(e){let t=new Map(e.map(o=>[o.name,o]));for(let o of this.local){if(!o.local)continue;let n=o.local.name,r=n?t.get(n):void 0;if(!r||r.galleryUrl!==o.local.galleryUrl){o.gallery&&(o.gallery=void 0,this._onChange.fire(o));continue}o.gallery=r,o.local.manifest||(o.local=await this.mcpManagementService.updateMetadata(o.local,r)),this._onChange.fire(o)}}async queryGallery(e,t){if(!this.mcpGalleryService.isEnabled())return{firstPage:{items:[],hasMore:!1},getNextPage:async()=>({items:[],hasMore:!1})};let o=await this.mcpGalleryService.query(e,t),n=r=>({items:r.items.map(s=>this.fromGallery(s)??this.instantiationService.createInstance(RN,l=>this.getInstallState(l),l=>this.getRuntimeStatus(l),void 0,s,void 0)),hasMore:r.hasMore});return{firstPage:n(o.firstPage),getNextPage:async r=>{let s=await o.getNextPage(r);return n(s)}}}async queryLocal(){let e=await this.mcpManagementService.getInstalled();return this._local=this.sort(e.map(t=>{let n=this._local.find(r=>r.id===t.id)??this.instantiationService.createInstance(RN,r=>this.getInstallState(r),r=>this.getRuntimeStatus(r),void 0,void 0,void 0);return n.local=t,n})),this._onChange.fire(void 0),[...this.local]}addServer(e){this._local.push(e),this._local=this.sort(this._local)}sort(e){return e.sort((t,o)=>t.name===o.name?!t.runtimeStatus||t.runtimeStatus.state===4?-1:!o.runtimeStatus||o.runtimeStatus.state===4?1:0:t.name.localeCompare(o.name))}getEnabledLocalMcpServers(){let e=new Map,t=[],o=[];for(let n of this.local){let r=this.getEnablementStatus(n);r&&r.state!==4||(n.local?.scope==="user"?e.set(n.name,n.local):n.local?.scope==="remoteUser"?t.push(n.local):n.local?.scope==="workspace"&&o.push(n.local))}for(let n of t){let r=e.get(n.name);r&&this.logService.warn(d(12019,null,n.name,n.mcpResource.path,r.mcpResource.path)),e.set(n.name,n)}for(let n of o){let r=e.get(n.name);r&&this.logService.warn(d(12019,null,n.name,n.mcpResource.path,r.mcpResource.path)),e.set(n.name,n)}return[...e.values()]}canInstall(e){if(!(e instanceof RN))return new Ie().appendText(d(12018,null));if(e.gallery){let t=this.mcpManagementService.canInstall(e.gallery);return t===!0?!0:t}if(e.installable){let t=this.mcpManagementService.canInstall(e.installable);return t===!0?!0:t}return new Ie().appendText(d(12012,null,e.label))}async install(e,t){if(!(e instanceof RN))throw new Error("Invalid server instance");if(e.installable){let o=e.installable;return this.doInstall(e,()=>this.mcpManagementService.install(o,t))}if(e.gallery){let o=e.gallery;return this.doInstall(e,()=>this.mcpManagementService.installFromGallery(o,t))}throw new Error("No installable server found")}async uninstall(e){if(!e.local)throw new Error("Local server is missing");await this.mcpManagementService.uninstall(e.local)}async doInstall(e,t){let o=e.gallery?"gallery":"local",n=e.name,r=!!(e.installable?.inputs&&e.installable.inputs.length>0);this.installing.push(e),this._onChange.fire(e);try{await t();let s=await this.waitAndGetInstalledMcpServer(e);return this.telemetryService.publicLog2("mcp/serverInstall",{serverName:n,source:o,scope:s.local?.scope??"unknown",success:!0,hasInputs:r}),s}catch(s){throw this.telemetryService.publicLog2("mcp/serverInstall",{serverName:n,source:o,scope:"unknown",success:!1,error:s instanceof Error?s.message:String(s),hasInputs:r}),s}finally{this.installing.includes(e)&&(this.installing.splice(this.installing.indexOf(e),1),this._onChange.fire(e))}}async waitAndGetInstalledMcpServer(e){let t=this.local.find(o=>o.name===e.name);if(t||await U.toPromise(U.filter(this.onChange,o=>!!o&&this.local.some(n=>n.name===e.name))),t=this.local.find(o=>o.name===e.name),!t)throw new Error("Extension should have been installed");return t}getMcpConfigPath(e){if(e instanceof A){let t=e;for(let o of this.userDataProfilesService.profiles)if(this.uriIdentityService.extUri.isEqual(o.mcpResource,t))return this.getUserMcpConfigPath(t);return this.remoteAgentService.getEnvironment().then(o=>o&&this.uriIdentityService.extUri.isEqual(o.mcpResource,t)?this.getRemoteMcpConfigPath(t):this.getWorkspaceMcpConfigPath(t))}if(e.scope==="user")return this.getUserMcpConfigPath(e.mcpResource);if(e.scope==="workspace")return this.getWorkspaceMcpConfigPath(e.mcpResource);if(e.scope==="remoteUser")return this.getRemoteMcpConfigPath(e.mcpResource)}getUserMcpConfigPath(e){return{id:SRi,key:"userLocalValue",target:3,label:d(12017,null,this.productService.nameShort),scope:0,order:200,uri:e,section:[]}}getRemoteMcpConfigPath(e){return{id:IRi,key:"userRemoteValue",target:4,label:this.environmentService.remoteAuthority?this.labelService.getHostLabel(Q.vscodeRemote,this.environmentService.remoteAuthority):"Remote",scope:0,order:150,remoteAuthority:this.environmentService.remoteAuthority,uri:e,section:[]}}getWorkspaceMcpConfigPath(e){let t=this.workspaceService.getWorkspace();if(t.configuration&&this.uriIdentityService.extUri.isEqual(t.configuration,e))return{id:yRi,key:"workspaceValue",target:5,label:He(e),scope:1,order:100,remoteAuthority:this.environmentService.remoteAuthority,uri:e,section:["settings",j0]};let o=t.folders;for(let n=0;n<o.length;n++){let r=o[n];if(this.uriIdentityService.extUri.isEqual(this.uriIdentityService.extUri.joinPath(r.uri,RD[zv]),e))return{id:`${wRi}${n}`,key:"workspaceFolderValue",target:6,label:`${r.name}/.vscode/mcp.json`,scope:1,remoteAuthority:this.environmentService.remoteAuthority,order:0,uri:e,workspaceFolder:r}}}async handleURL(e){if(e.path==="mcp/install")return this.handleMcpInstallUri(e);if(e.path.startsWith("mcp/by-name/")){let t=e.path.substring(12);if(t)return this.handleMcpServerByName(t)}if(e.path.startsWith("mcp/")){let t=e.path.substring(4);if(t)return this.handleMcpServerUrl(`${Q.https}://${t}`)}return!1}async handleMcpInstallUri(e){let t;try{t=JSON.parse(decodeURIComponent(e.query))}catch{return!1}try{let{name:o,inputs:n,gallery:r,...s}=t;s.type===void 0&&(s.type=t.command?"stdio":"http"),this.open(this.instantiationService.createInstance(RN,l=>this.getInstallState(l),l=>this.getRuntimeStatus(l),void 0,void 0,{name:o,config:s,inputs:n}))}catch{}return!0}async handleMcpServerUrl(e){try{let t=await this.mcpGalleryService.getMcpServer(e);if(!t)return this.logService.info(`MCP server '${e}' not found`),!0;let o=this.local.find(n=>n.name===t.name)??this.instantiationService.createInstance(RN,n=>this.getInstallState(n),n=>this.getRuntimeStatus(n),void 0,t,void 0);this.open(o)}catch(t){this.logService.error(t)}return!0}async handleMcpServerByName(e){try{let[t]=await this.mcpGalleryService.getMcpServersFromGallery([{name:e}]);if(!t)return this.logService.info(`MCP server '${e}' not found`),!0;let o=this.local.find(n=>n.name===t.name)??this.instantiationService.createInstance(RN,n=>this.getInstallState(n),n=>this.getRuntimeStatus(n),void 0,t,void 0);this.open(o)}catch(t){this.logService.error(t)}return!0}async openSearch(e,t){await this.extensionsWorkbenchService.openSearch(`@mcp ${e}`,t)}async open(e,t){let o=this.configurationService.getValue("extensions.allowOpenInModalEditor");await this.editorService.openEditor(this.instantiationService.createInstance(Voe,e),t,o?OR:jn)}getInstallState(e){return this.installing.some(o=>o.name===e.name)?0:this.uninstalling.some(o=>o.name===e.name)?2:this.local.find(o=>o===e)?1:3}getRuntimeStatus(e){let t=this.getEnablementStatus(e);if(t)return t;let o=this.mcpService.servers.get().find(r=>r.definition.id===e.id);if(!o)return{state:0};let n=o.enablement.get();if(n===0)return{state:2,message:{severity:bt.Info,text:new Ie(d(12015,null))}};if(n===1)return{state:3,message:{severity:bt.Info,text:new Ie(d(12016,null))}}}getEnablementStatus(e){if(!e.local)return;let t=fc("workbench.action.openSettings",{query:`@id:${Wk}`}).toString(),o=this.configurationService.getValue(Wk);if(o==="none")return{state:1,message:{severity:bt.Warning,text:new Ie(d(12013,null,t))}};if(o==="registry"){if(!e.gallery)return{state:1,message:{severity:bt.Warning,text:new Ie(d(12014,null,t))}};let n=e.local.config.type==="http"&&e.local.config.url;if(n&&!e.gallery.configuration.remotes?.some(r=>r.url===n))return{state:1,message:{severity:bt.Warning,text:new Ie(d(12014,null,t))}}}}};_Be=I([m(0,WB),m(1,sG),m(2,bQ),m(3,ee),m(4,an),m(5,ht),m(6,Pe),m(7,At),m(8,rt),m(9,tt),m(10,bo),m(11,B),m(12,F),m(13,Te),m(14,se),m(15,Hi),m(16,vM),m(17,_s),m(18,_b)],_Be);var sve=class extends x{static{this.ID="workbench.mcp.contexts.initialisation"}constructor(i,e,t){super();let o=_ue.bindTo(t);o.set(e.mcpGalleryManifestStatus),this._register(e.onDidChangeMcpGalleryManifestStatus(r=>o.set(r)));let n=VJ.bindTo(t);i.queryLocal().finally(()=>{n.set(i.local.length>0),this._register(i.onChange(()=>n.set(i.local.length>0)))})}};sve=I([m(0,Ng),m(1,WB),m(2,X)],sve);Ee(Lc,mBe,1);Ee(AOe,POe,1);Ee(_s,vBe,1);Ee(Ng,_Be,0);Ee(MOe,Lie,1);Ee(F4,fBe,1);Ee(y7e,EBe,1);Ee(_De,bBe,1);Tq.register(new Ft(aBe));Tq.register(new Ft(rBe));Tq.register(new Ft(ine));Tq.register(new Ft(cBe));Tq.register(new Ft(lBe));It("mcpDiscovery",kBe,St.AfterRestored);It("mcpContextKeys",dBe,St.BlockRestore);It("mcpLanguageFeatures",TBe,St.Eventually);It("mcpResourceFilesystem",hBe,St.BlockRestore);It(nve.ID,nve,St.AfterRestored);It("mcpGatewayToolBrokerRemote",IBe,St.AfterRestored);W(pjt);W(hjt);W(mjt);W(gjt);W(fjt);W(vjt);W(bjt);W(Sjt);W(Ijt);W(xjt);W(kjt);W(wjt);W(Cjt);W(yjt);W(Ejt);W(Djt);W(Ljt);W(Mjt);W(Rjt);W(Tjt);W(Pjt);W(Ajt);W(Njt);W(Ojt);It("mcpActionRendering",xBe,St.BlockRestore);It("mcpAddContext",CBe,St.Eventually);It(sve.ID,sve,St.AfterRestored);It(rve.ID,rve,St.Eventually);It(Jst.ID,Jst,St.AfterRestored);var oun=ne.as(ma.JSONContribution);oun.registerSchema(ILe,ypo);ne.as(qo.EditorPane).registerEditorPane(Br.create(bU,bU.ID,d(11727,null)),[new Ft(Voe)]);ne.as(Ku.Quickaccess).registerQuickAccessProvider({ctor:r6,prefix:r6.PREFIX,when:ie.enabled,placeholder:d(11726,null),helpEntries:[{description:d(11725,null),commandId:"workbench.mcp.addConfiguration"}]});ne.as(Ep.ConfigurationMigration).registerConfigurationMigrations([{key:"chat.mcp.enabled",migrateFn:(a,i)=>{let e=[["chat.mcp.enabled",{value:void 0}]];return a===!0&&e.push([Wk,{value:"all"}]),a===!1&&e.push([Wk,{value:"none"}]),e}}]);var nun=Rn.registerExtensionPoint({extensionPoint:"chatContext",jsonSchema:{description:d(7361,null),type:"array",items:{type:"object",properties:{id:{description:d(7363,null),type:"string"},icon:{description:d(7362,null),type:"string"},displayName:{description:d(7365,null),type:"string"}},required:["id","icon","displayName"]}},activationEventsGenerator:function*(a){for(let i of a)yield`onChatContextProvider:${i.id}`}}),DBe=class extends x{constructor(e){super();this._chatContextService=e;nun.setHandler(t=>{for(let o of t)if(Ua(o.description,"chatContextProvider")&&Array.isArray(o.value))for(let n of o.value){let r=n.icon?q.fromString(n.icon):void 0;if(!r&&n.icon){o.collector.error(d(7364,null,n.id,"$(iconId)","$(iconId~spin)","$(copilot)"));continue}r&&this._chatContextService.setChatContextProvider(`${o.description.id}-${n.id}`,{title:n.displayName,icon:r})}})}static{this.ID="workbench.contrib.chatContextContribution"}};DBe=I([m(0,ED)],DBe);It(DBe.ID,DBe,St.AfterRestored);var s6=class a extends ls{constructor(e,t=0){super();this.collection=e;this.startIndex=t;this._resource=A.from({scheme:Q.vscodeImageCarousel,path:`/${encodeURIComponent(e.id)}`}),this._name=e.title}static{this.ID="workbench.input.imageCarousel"}get capabilities(){return super.capabilities|8|2048}get typeId(){return a.ID}get resource(){return this._resource}getName(){return this._name}setName(e){this._name!==e&&(this._name=e,this._onDidChangeLabel.fire())}matches(e){return e instanceof a?e.collection.id===this.collection.id:!1}};function Zst(a){return a.startsWith("video/")}var run=.075,hko=20,gko=.1,sun=3,LBe=[.1,.2,.3,.4,.5,.6,.7,.8,.9,1,1.5,2,3,5,7,10,15,20],a6=class extends Ts{constructor(e,t,o,n,r,s){super(a6.ID,e,t,o,n);this._fileService=r;this._webviewService=s;this._currentIndex=0;this._zoomScale="fit";this._sections=[];this._flatImages=[];this._contentDisposables=this._register(new N);this._imageDisposables=this._register(new N);this._blobUrlCache=new Map;this._thumbnailElements=[]}static{this.ID="workbench.editor.imageCarousel"}createEditor(e){this._container=ct("div.image-carousel-editor").root,e.appendChild(this._container)}async setInput(e,t,o,n){await super.setInput(e,t,o,n),this._sections=e.collection.sections,this._flatImages=[];for(let r=0;r<this._sections.length;r++)for(let s=0;s<this._sections[r].images.length;s++)this._flatImages.push({sectionIndex:r,imageIndexInSection:s,image:this._sections[r].images[s]});this._currentIndex=Math.min(e.startIndex,Math.max(0,this._flatImages.length-1)),this.buildSlideshow()}clearInput(){this._videoWebview?.dispose(),this._videoWebview=void 0,this._contentDisposables.clear(),this._imageDisposables.clear(),this._revokeCachedBlobUrls(),this._zoomScale="fit",this._container&&Rt(this._container),this._elements=void 0,this._thumbnailElements=[],super.clearInput()}_isCurrentVideo(){let e=this._flatImages[this._currentIndex];return!!e&&Zst(e.image.mimeType)}buildSlideshow(){if(!this._container)return;if(this._contentDisposables.clear(),this._imageDisposables.clear(),this._revokeCachedBlobUrls(),Rt(this._container),this._flatImages.length===0){let s=ct("div.empty-message");s.root.textContent=d(11205,null),this._container.appendChild(s.root);return}let e=ct("div.slideshow-container",[ct("div.image-area@imageArea",[ct("div.main-image-container@mainImageContainer",[ct("img.main-image@mainImage"),ct("div.video-container@videoContainer")]),ct("button.nav-arrow.prev-arrow@prevBtn",{ariaLabel:d(11206,null)},[ct("span.codicon.codicon-chevron-left",{ariaHidden:"true"})]),ct("button.nav-arrow.next-arrow@nextBtn",{ariaLabel:d(11204,null)},[ct("span.codicon.codicon-chevron-right",{ariaHidden:"true"})])]),ct("div.bottom-bar@bottomBar",[ct("div.image-info-bar",[ct("span.caption-text@captionText"),ct("span.caption-separator@captionSeparator"),ct("span.image-counter@counter")]),ct("div.sections-container@sectionsContainer"),ct("span.sr-only@ariaStatus")])]);e.root.setAttribute("role","group"),e.root.setAttribute("aria-label",d(11200,null)),e.captionSeparator.setAttribute("aria-hidden","true"),e.ariaStatus.setAttribute("aria-live","polite"),e.ariaStatus.setAttribute("aria-atomic","true"),e.sectionsContainer.setAttribute("role","group"),e.sectionsContainer.setAttribute("aria-label",d(11211,null)),this._elements={root:e.root,imageArea:e.imageArea,mainImageContainer:e.mainImageContainer,mainImage:e.mainImage,videoContainer:e.videoContainer,captionText:e.captionText,captionSeparator:e.captionSeparator,counter:e.counter,ariaStatus:e.ariaStatus,prevBtn:e.prevBtn,nextBtn:e.nextBtn,sectionsContainer:e.sectionsContainer},this._elements.mainImage.classList.add("scale-to-fit"),this._elements.mainImage.alt="",this._elements.videoContainer.style.display="none",this._contentDisposables.add(j(this._elements.prevBtn,"click",()=>{this._currentIndex>0&&(this._currentIndex--,this.updateCurrentImage())})),this._contentDisposables.add(j(this._elements.nextBtn,"click",()=>{this._currentIndex<this._flatImages.length-1&&(this._currentIndex++,this.updateCurrentImage())})),this._contentDisposables.add(j(e.root,re.KEY_DOWN,s=>{let l=new gi(s);l.keyCode===15?(this.previous(),l.stopPropagation(),l.preventDefault()):l.keyCode===17&&(this.next(),l.stopPropagation(),l.preventDefault())})),e.root.tabIndex=0,this._contentDisposables.add(j(this._elements.imageArea,re.MOUSE_WHEEL,s=>{if(this._isCurrentVideo()||!(Ze?s.altKey:s.ctrlKey)&&!s.ctrlKey||(s.preventDefault(),s.deltaY===0))return;this._zoomScale==="fit"&&this._initZoomFromFit();let c=s.deltaY>0?1:-1;this._applyZoom(this._zoomScale*(1-c*run))},{passive:!1}));let t=!1,o=!1;this._contentDisposables.add(j(this._elements.mainImageContainer,re.MOUSE_DOWN,s=>{s.button===0&&(t=s.ctrlKey,o=s.altKey)})),this._contentDisposables.add(j(this._elements.mainImageContainer,re.CLICK,s=>{if(s.button!==0||this._isCurrentVideo())return;(Ze?o:t)?this._zoomOut():this._zoomIn()}));let n=s=>{let l=Ze?s.altKey:s.ctrlKey;this._elements.mainImageContainer.classList.toggle("zoom-out",l)};this._contentDisposables.add(j(e.root,re.KEY_DOWN,n)),this._contentDisposables.add(j(e.root,re.KEY_UP,n)),this._thumbnailElements=[];let r=0;for(let s=0;s<this._sections.length;s++){let l=this._sections[s];if(s>0&&this._sections.length>1){let c=ct("div.thumbnail-separator").root;c.setAttribute("aria-hidden","true"),this._elements.sectionsContainer.appendChild(c)}for(let c=0;c<l.images.length;c++){let u=l.images[c],p=r,h=Zst(u.mimeType),g=document.createElement("button");if(g.className=h?"thumbnail video-thumbnail":"thumbnail",g.ariaLabel=h?d(11210,null,p+1,this._flatImages.length):d(11209,null,p+1,this._flatImages.length),h){let f=ct("span.codicon.codicon-play.thumbnail-play-icon");f.root.setAttribute("aria-hidden","true"),g.appendChild(f.root)}else{let f=document.createElement("img");f.className="thumbnail-image",f.alt=u.name;let v=this._contentDisposables.add(new N),b=()=>{if(!v.isDisposed&&!g.classList.contains("broken")){g.classList.add("broken"),f.removeAttribute("src"),f.alt="",f.remove();let S=ct("span.codicon.codicon-warning.thumbnail-broken-icon");S.root.setAttribute("aria-hidden","true"),g.appendChild(S.root)}};this._loadBlobUrl(u).then(S=>{if(!v.isDisposed)if(S){let y=new Image;v.add(j(y,"load",()=>{g.classList.contains("broken")||(f.src=S,f.parentElement||g.appendChild(f))})),v.add(j(y,"error",()=>{b()})),y.src=S}else b()},()=>{b()}),v.add(j(f,"error",()=>{b()}))}this._contentDisposables.add(j(g,"click",()=>{this._currentIndex=p,this.updateCurrentImage()})),this._elements.sectionsContainer.appendChild(g),this._thumbnailElements.push(g),r++}}this._container.appendChild(e.root),this.updateCurrentImage()}async updateCurrentImage(){if(!this._elements)return;let e=this._currentIndex,t=this._flatImages[e],o=t.image,n=Zst(o.mimeType);if(n){this._elements.mainImage.style.display="none",this._elements.videoContainer.style.display="",this._elements.mainImageContainer.classList.remove("zoomed"),this._elements.mainImageContainer.style.cursor="default";let l=await this._loadRawData(o);if(this._currentIndex!==e)return;let c=xt(),u=`<!DOCTYPE html>
<html><head>
<meta charset="utf-8">
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; media-src blob: data:; script-src 'nonce-${c}'; style-src 'nonce-${c}';">
<style nonce="${c}">html,body{margin:0;padding:0;width:100%;height:100%;overflow:hidden;background:transparent}
video{width:100%;height:100%;object-fit:contain;outline:none}</style>
</head><body>
<video id="v" controls></video>
<script nonce="${c}">
window.addEventListener("message",function(e){var m=e.data;if(m.type==="loadVideo"){var b=new Blob([m.data],{type:m.mimeType});document.getElementById("v").src=URL.createObjectURL(b);}});
</script>
</body></html>`,p;this._videoWebview?p=this._videoWebview:(p=this._contentDisposables.add(this._webviewService.createWebviewElement({title:o.name,options:{disableServiceWorker:!0},contentOptions:{allowScripts:!0},extension:void 0})),p.mountTo(this._elements.videoContainer,this.window),this._videoWebview=p),p.setHtml(u);let h=l.buffer;p.postMessage({type:"loadVideo",data:h,mimeType:o.mimeType},[h])}else{this._elements.videoContainer.style.display="none",this._elements.mainImage.style.display="",this._elements.mainImageContainer.style.cursor="";let l=await this._loadBlobUrl(o);if(this._currentIndex!==e)return;let c=new Image;c.src=l,c.decode().then(()=>{this._currentIndex===e&&this._elements&&(this._elements.mainImage.src=l,this._elements.mainImage.alt=o.name)},()=>{this._currentIndex===e&&this._elements&&(this._elements.mainImage.src=l,this._elements.mainImage.alt=o.name)})}this._applyZoom("fit"),o.caption?(this._elements.captionText.textContent=o.caption,this._elements.captionText.style.display="",this._elements.captionSeparator.style.display=""):(this._elements.captionText.textContent="",this._elements.captionText.style.display="none",this._elements.captionSeparator.style.display="none"),this._elements.counter.textContent=d(11201,null,e+1,this._flatImages.length);let r=n?d(11203,null):d(11202,null);this._elements.ariaStatus.textContent=o.caption?d(11207,null,r,e+1,this._flatImages.length,o.caption):d(11208,null,r,e+1,this._flatImages.length,o.name),this._elements.prevBtn.disabled=e===0,this._elements.nextBtn.disabled=e===this._flatImages.length-1;for(let l=0;l<this._thumbnailElements.length;l++){let c=l===e,u=this._thumbnailElements[l];u.classList.toggle("active",c),c?u.setAttribute("aria-current","page"):u.removeAttribute("aria-current")}let s=this._thumbnailElements[e];if(s&&s.scrollIntoView({block:"nearest",inline:"nearest"}),this.input instanceof s6){let l=this._sections[t.sectionIndex];this.input.setName(l.title||this.input.collection.title)}this._preloadAdjacentImages()}async _loadBlobUrl(e){let t=this._blobUrlCache.get(e.id);if(t)return t;let o;if(e.data)o=e.data instanceof Uint8Array?e.data:e.data.buffer;else if(e.uri)o=(await this._fileService.readFile(e.uri)).value.buffer;else return"";let n=new Blob([o],{type:e.mimeType}),r=URL.createObjectURL(n);return this._blobUrlCache.set(e.id,r),r}_revokeCachedBlobUrls(){for(let e of this._blobUrlCache.values())URL.revokeObjectURL(e);this._blobUrlCache.clear()}async _loadRawData(e){return e.data?e.data instanceof Uint8Array?e.data:e.data.buffer:e.uri?(await this._fileService.readFile(e.uri)).value.buffer:new Uint8Array(0)}_preloadAdjacentImages(){for(let e of[this._currentIndex-1,this._currentIndex+1])if(e>=0&&e<this._flatImages.length){let t=this._flatImages[e].image;Zst(t.mimeType)?this._loadRawData(t).catch(()=>{}):this._loadBlobUrl(t).then(o=>{let n=new Image;n.src=o,n.decode().catch(()=>{})})}}previous(){this._currentIndex>0&&(this._currentIndex--,this.updateCurrentImage())}next(){this._currentIndex<this._flatImages.length-1&&(this._currentIndex++,this.updateCurrentImage())}_initZoomFromFit(){if(!this._elements)return;let e=this._elements.mainImage;e.naturalWidth>0?this._zoomScale=e.clientWidth/e.naturalWidth:this._zoomScale=1}_zoomIn(){this._zoomScale==="fit"&&this._initZoomFromFit();let e=this._zoomScale,t=0;for(;t<LBe.length&&!(LBe[t]>e);++t);this._applyZoom(LBe[t]??hko)}_zoomOut(){this._zoomScale==="fit"&&this._initZoomFromFit();let e=this._zoomScale,t=LBe.length-1;for(;t>=0&&!(LBe[t]<e);--t);this._applyZoom(LBe[t]??gko)}_applyZoom(e){if(!this._elements)return;let t=this._elements.mainImageContainer,o=this._elements.mainImage;if(e==="fit"){this._zoomScale="fit",o.classList.add("scale-to-fit"),o.classList.remove("pixelated"),o.style.zoom="";let n=t.classList.contains("zoomed");t.classList.remove("zoomed"),t.classList.remove("zoom-out"),n&&t.scrollTo(0,0)}else{let n=Bn(e,gko,hko);this._zoomScale=n;let r=t.scrollWidth>0?(t.scrollLeft+t.clientWidth/2)/t.scrollWidth:.5,s=t.scrollHeight>0?(t.scrollTop+t.clientHeight/2)/t.scrollHeight:.5;o.classList.remove("scale-to-fit"),o.classList.toggle("pixelated",n>=sun),o.style.zoom=String(n),t.classList.add("zoomed");let l=t.scrollWidth*r-t.clientWidth/2,c=t.scrollHeight*s-t.clientHeight/2;t.scrollTo(l,c)}}focus(){super.focus(),this._elements?.root.focus()}layout(e){this._container&&(this._container.style.width=`${e.width}px`,this._container.style.height=`${e.height}px`)}};a6=I([m(1,Te),m(2,Le),m(3,ce),m(4,fe),m(5,cp)],a6);ne.as(Jt.Configuration).registerConfiguration({id:"imageCarousel",title:d(11195,null),type:"object",properties:{"imageCarousel.explorerContextMenu.enabled":{type:"boolean",default:!0,markdownDescription:d(11192,null),tags:["experimental"]},"imageCarousel.chat.enabled":{type:"boolean",default:!0,description:d(11191,null),tags:["experimental"]}}});ne.as(qo.EditorPane).registerEditorPane(Br.create(a6,a6.ID,d(11196,null)),[new Ft(s6)]);var eOi=class{canSerialize(){return!1}serialize(){}deserialize(){}};ne.as(qo.EditorFactory).registerEditorSerializer(s6.ID,eOi);function aun(a){return typeof a=="object"&&a!==null&&typeof a.collection=="object"&&typeof a.startIndex=="number"}function lun(a){return typeof a=="object"&&a!==null&&typeof a.name=="string"&&typeof a.mimeType=="string"&&a.data instanceof Uint8Array}var tOi=class extends K{constructor(){super({id:"workbench.action.chat.openImageInCarousel",title:L(11198,"Open in Images Preview"),f1:!1})}async run(i,e){let t=i.get(ee),o,n;if(aun(e))o=e.collection,n=e.startIndex;else if(lun(e))o={id:xt(),title:e.title??d(11194,null),sections:[{title:"",images:[{id:xt(),name:e.name,mimeType:e.mimeType,data:qe.wrap(e.data)}]}]},n=0;else return;let r=new s6(o,n);await t.openEditor(r,{pinned:!0})}};W(tOi);var fko=/^\.(png|jpg|jpeg|jpe|gif|webp|svg|bmp|ico|mp4|webm|mov)$/i;function iOi(a){return fko.test(es(a))}async function ZNi(a,i){let e=await a.resolve(i),t=[];if(e.children)for(let o of e.children)o.isFile&&iOi(o.resource)&&t.push(o.resource);return t.sort((o,n)=>He(o).localeCompare(He(n))),t}function cun(a){return a.map(i=>({id:xt(),name:He(i),mimeType:GI(i.path)??"image/png",uri:i}))}var oOi=class extends K{constructor(){super({id:"workbench.action.openImagesInCarousel",title:L(11199,"Open in Images Preview"),f1:!1,menu:[{id:D.ExplorerContext,group:"navigation",order:25,when:C.and(C.has("config.imageCarousel.explorerContextMenu.enabled"),C.or(Gd,C.regex(Wo.Extension.key,fko)))}]})}async run(i,e){let t=i.get(Oa),o=i.get(fe),n=i.get(ee),r=i.get(Ne),s=i.get(Pe),l=t.getContext(!0),c=[],u;try{if(l.length===0){let v;if(A.isUri(e))v=e;else{let b=s.getWorkspace().folders;b.length>0&&(v=b[0].uri)}v&&(c=await ZNi(o,v))}else if(l.length===1&&!l[0].isDirectory&&iOi(l[0].resource)){u=l[0].resource;let b=ci(l[0].resource);c=await ZNi(o,b)}else{let b=new En;for(let S of l)if(S.isDirectory){let y=await ZNi(o,S.resource);for(let w of y)b.has(w)||(b.add(w),c.push(w))}else iOi(S.resource)&&(b.has(S.resource)||(b.add(S.resource),c.push(S.resource),u||(u=S.resource)))}}catch{r.error(d(11190,null));return}if(c.length===0){r.info(d(11197,null));return}let p=cun(c),h=0;if(u){let v=p.findIndex(b=>b.uri?.toString()===u.toString());v>=0&&(h=v)}let g={id:xt(),title:d(11193,null),sections:[{title:"",images:p}]},f=new s6(g,h);await n.openEditor(f,{pinned:!0})}};W(oOi);var EU=new Y("interactiveInputCursorAtBoundary","none"),qM={interactiveWindowAlwaysScrollOnNewCell:"interactiveWindow.alwaysScrollOnNewCell",executeWithShiftEnter:"interactiveWindow.executeWithShiftEnter",showExecutionHint:"interactiveWindow.showExecutionHint"};var _q=class extends x{constructor(e,t,o){super();this.editor=e;this.configurationService=t;this.keybindingService=o;this.ariaLabel="";this._register(this.editor.onDidChangeConfiguration(r=>{this.domNode&&r.hasChanged(59)&&this.editor.applyFontInfo(this.domNode)}));let n=U.debounce(this.editor.onDidFocusEditorText,()=>{},500);this._register(n(()=>{this.editor.hasTextFocus()&&this.ariaLabel&&t.getValue("accessibility.verbosity.replEditor")&&qr(this.ariaLabel)})),this._register(t.onDidChangeConfiguration(r=>{r.affectsConfiguration(qM.executeWithShiftEnter)&&this.setHint()})),this.editor.addContentWidget(this)}static{this.ID="replInput.widget.emptyHint"}getId(){return _q.ID}getPosition(){return{position:{lineNumber:1,column:1},preference:[0]}}getDomNode(){if(!this.domNode){this.domNode=_(".empty-editor-hint"),this.domNode.style.width="max-content",this.domNode.style.paddingLeft="4px",this.setHint(),this._register(j(this.domNode,"click",()=>{this.editor.focus()})),this.editor.applyFontInfo(this.domNode);let e=this.editor.getLineHeightForPosition(new ye(1,1));this.domNode.style.lineHeight=e+"px"}return this.domNode}setHint(){if(!this.domNode)return;for(;this.domNode.firstChild;)this.domNode.removeChild(this.domNode.firstChild);let e=_("div.empty-hint-text");e.style.cursor="text",e.style.whiteSpace="nowrap";let t=this.getKeybinding(),o=t?.getLabel();if(t&&o){let n=d(11346,null,o),[r,s]=n.split(o).map(u=>{let p=_("span",void 0,u);return p.style.fontStyle="italic",p});e.appendChild(r),this.label&&this.label.dispose(),this.label=this._register(new Am(e,Po)),this.label.set(t),this.label.element.style.width="min-content",this.label.element.style.display="inline",e.appendChild(s),this.domNode.append(e);let l=this.keybindingService.lookupKeybinding("editor.action.accessibilityHelp")?.getLabel(),c=l?d(11347,null,l):d(11348,null);this.ariaLabel=n.concat(c,d(11345,null,"accessibility.verbosity.replEditor"))}}getKeybinding(){let e=this.keybindingService.lookupKeybindings("interactive.execute"),t=this.configurationService.getValue(qM.executeWithShiftEnter),o=(n,r="")=>{let s=n.getDispatchChords(),l=r+"Enter",c=r+"[Enter]";return s.length===1&&(s[0]===l||s[0]===c)};if(t){let n=e.find(r=>o(r,"shift+"));if(n)return n}else{let n=e.find(r=>o(r));if(n||(n=this.keybindingService.lookupKeybindings("python.execInREPLEnter").find(r=>o(r)),n))return n}return e?.[0]}dispose(){super.dispose(),this.editor.removeContentWidget(this),this.label?.dispose()}};_q=I([m(1,B),m(2,_e)],_q);var dun="interactiveInputDecoration",uun="InteractiveEditorViewState",eat=8,nOi=10,tat=8,RBe=class extends Ts{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w){super(_X,e,t,o,n);this._notebookWidget={value:void 0};this._widgetDisposableStore=this._register(new N);this._groupListener=this._register(new me);this._onDidFocusWidget=this._register(new E);this._onDidChangeSelection=this._register(new E);this.onDidChangeSelection=this._onDidChangeSelection.event;this._onDidChangeScroll=this._register(new E);this.onDidChangeScroll=this._onDidChangeScroll.event;this._notebookWidgetService=s,this._configurationService=g,this._notebookKernelService=u,this._languageService=p,this._keybindingService=h,this._menuService=f,this._contextMenuService=v,this._editorGroupService=b,this._notebookExecutionStateService=y,this._extensionService=w,this._rootElement=_(".interactive-editor"),this._contextKeyService=this._register(l.createScoped(this._rootElement)),this._contextKeyService.createKey("isCompositeNotebook",!0),this._instantiationService=this._register(r.createChild(new _o([X,this._contextKeyService]))),this._editorOptions=this._computeEditorOptions(),this._register(this._configurationService.onDidChangeConfiguration(k=>{(k.affectsConfiguration("editor")||k.affectsConfiguration("notebook"))&&(this._editorOptions=this._computeEditorOptions())})),this._notebookOptions=r.createInstance(VT,this.window,!0,{cellToolbarInteraction:"hover",globalToolbar:!0,stickyScrollEnabled:!1,dragAndDropEnabled:!1,disableRulers:!0}),this._editorMemento=this.getEditorMemento(b,S,uun),this._register(c.registerDecorationType("interactive-decoration",dun,{})),this._register(this._keybindingService.onDidUpdateKeybindings(this._updateInputHint,this)),this._register(this._notebookExecutionStateService.onDidChangeExecution(k=>{if(k.type===0&&Qe(k.notebook,this._notebookWidget.value?.viewModel?.notebookDocument.uri)){let T=this._notebookWidget.value?.getCellByHandle(k.cellHandle);T&&k.changed?.state&&this._scrollIfNecessary(T)}}))}get onDidFocus(){return this._onDidFocusWidget.event}get inputCellContainerHeight(){return 21+eat*2+tat*2}get inputCellEditorHeight(){return 19+tat*2}createEditor(e){M(e,this._rootElement),this._rootElement.style.position="relative",this._notebookEditorContainer=M(this._rootElement,_(".notebook-editor-container")),this._inputCellContainer=M(this._rootElement,_(".input-cell-container")),this._inputCellContainer.style.position="absolute",this._inputCellContainer.style.height=`${this.inputCellContainerHeight}px`,this._inputFocusIndicator=M(this._inputCellContainer,_(".input-focus-indicator")),this._inputRunButtonContainer=M(this._inputCellContainer,_(".run-button-container")),this._setupRunButtonToolbar(this._inputRunButtonContainer),this._inputEditorContainer=M(this._inputCellContainer,_(".input-editor-container")),this._createLayoutStyles()}_setupRunButtonToolbar(e){let t=this._register(this._menuService.createMenu(D.InteractiveInputExecute,this._contextKeyService));this._runbuttonToolbar=this._register(new wp(e,this._contextMenuService,{getKeyBinding:r=>this._keybindingService.lookupKeybinding(r.id),actionViewItemProvider:(r,s)=>Bs(this._instantiationService,r,s),renderDropdownAsChildElement:!0}));let{primary:o,secondary:n}=ml(t.getActions({shouldForwardArgs:!0}));this._runbuttonToolbar.setActions([...o,...n])}_createLayoutStyles(){this._styleElement=Cr(this._rootElement);let e=[],{codeCellLeftMargin:t,cellRunGutter:o}=this._notebookOptions.getLayoutConfiguration(),{focusIndicator:n}=this._notebookOptions.getDisplayOptions(),r=this._notebookOptions.getCellEditorContainerLeftMargin();e.push(`
			.interactive-editor .input-cell-container {
				padding: ${eat}px ${nOi}px ${eat}px ${r}px;
			}
		`),n==="gutter"?e.push(`
				.interactive-editor .input-cell-container:focus-within .input-focus-indicator::before {
					border-color: var(--vscode-notebook-focusedCellBorder) !important;
				}
				.interactive-editor .input-focus-indicator::before {
					border-color: var(--vscode-notebook-inactiveFocusedCellBorder) !important;
				}
				.interactive-editor .input-cell-container .input-focus-indicator {
					display: block;
					top: ${eat}px;
				}
				.interactive-editor .input-cell-container {
					border-top: 1px solid var(--vscode-notebook-inactiveFocusedCellBorder);
				}
			`):e.push(`
				.interactive-editor .input-cell-container {
					border-top: 1px solid var(--vscode-notebook-inactiveFocusedCellBorder);
				}
				.interactive-editor .input-cell-container .input-focus-indicator {
					display: none;
				}
			`),e.push(`
			.interactive-editor .input-cell-container .run-button-container {
				width: ${o}px;
				left: ${t}px;
				margin-top: ${tat-2}px;
			}
		`),this._styleElement.textContent=e.join(`
`)}_computeEditorOptions(){let e;this._codeEditorWidget&&(e=this._codeEditorWidget.getModel()?.getLanguageId());let t=Ji(this._configurationService.getValue("editor",{overrideIdentifier:e})),o=Vb(this._configurationService);return Object.freeze({...t,...o,glyphMargin:!0,padding:{top:tat,bottom:tat},hover:{enabled:"on"},rulers:[]})}saveState(){this._saveEditorViewState(this.input),super.saveState()}getViewState(){let e=this.input;if(e instanceof Cf)return this._saveEditorViewState(e),this._loadNotebookEditorViewState(e)}_saveEditorViewState(e){if(this._notebookWidget.value&&e instanceof Cf){if(this._notebookWidget.value.isDisposed)return;let t=this._notebookWidget.value.getEditorViewState(),o=this._codeEditorWidget.saveViewState();this._editorMemento.saveEditorState(this.group,e.notebookEditorInput.resource,{notebook:t,input:o})}}_loadNotebookEditorViewState(e){let t=this._editorMemento.loadEditorState(this.group,e.notebookEditorInput.resource);if(t)return t;for(let o of this._editorGroupService.getGroups(1))if(o.activeEditorPane!==this&&o.activeEditorPane===this&&o.activeEditor?.matches(e)){let n=this._notebookWidget.value?.getEditorViewState(),r=this._codeEditorWidget.saveViewState();return{notebook:n,input:r}}}async setInput(e,t,o,n){let r=e.notebookEditorInput;if(this._notebookWidget.value?.onWillHide(),this._codeEditorWidget?.dispose(),this._widgetDisposableStore.clear(),this._notebookWidget=this._instantiationService.invokeFunction(this._notebookWidgetService.retrieveWidget,this.group.id,r,{isReplHistory:!0,isReadOnly:!0,contributions:b8.getSomeEditorContributions([XG.id,JG.id,tC.id]),menuIds:{notebookToolbar:D.InteractiveToolbar,cellTitleToolbar:D.InteractiveCellTitle,cellDeleteToolbar:D.InteractiveCellDelete,cellInsertToolbar:D.NotebookCellBetween,cellTopInsertToolbar:D.NotebookCellListTop,cellExecuteToolbar:D.InteractiveCellExecute,cellExecutePrimary:void 0},cellEditorContributions:Ba.getSomeEditorContributions([xy,og.ID,Pl.ID,ff.ID,xw.ID]),options:this._notebookOptions,codeWindow:this.window},void 0,this.window),this._codeEditorWidget=this._instantiationService.createInstance(Xr,this._inputEditorContainer,this._editorOptions,{isSimpleWidget:!1,contributions:Ba.getSomeEditorContributions([yy.ID,xy,og.ID,nc.ID,hF.ID,vs.ID,Cy.ID,Pl.ID,ff.ID,xw.ID,y1t])}),this._lastLayoutDimensions){this._notebookEditorContainer.style.height=`${this._lastLayoutDimensions.dimension.height-this.inputCellContainerHeight}px`,this._notebookWidget.value.layout(new si(this._lastLayoutDimensions.dimension.width,this._lastLayoutDimensions.dimension.height-this.inputCellContainerHeight),this._notebookEditorContainer);let h=this._notebookOptions.getCellEditorContainerLeftMargin(),g=Math.min(this._lastLayoutDimensions.dimension.height/2,this.inputCellEditorHeight);this._codeEditorWidget.layout(this._validateDimension(this._lastLayoutDimensions.dimension.width-h-nOi,g)),this._inputFocusIndicator.style.height=`${this.inputCellEditorHeight}px`,this._inputCellContainer.style.top=`${this._lastLayoutDimensions.dimension.height-this.inputCellContainerHeight}px`,this._inputCellContainer.style.width=`${this._lastLayoutDimensions.dimension.width}px`}await super.setInput(e,t,o,n);let s=await e.resolve();if(this._runbuttonToolbar&&(this._runbuttonToolbar.context=e.resource),s===null)throw new Error("The Interactive Window model could not be resolved");this._notebookWidget.value?.setParentContextKeyService(this._contextKeyService);let l=t?.viewState??this._loadNotebookEditorViewState(e);await this._extensionService.whenInstalledExtensionsRegistered(),await this._notebookWidget.value.setModel(s.notebook,l?.notebook),s.notebook.setCellCollapseDefault(this._notebookOptions.getCellCollapseDefault()),this._notebookWidget.value.setOptions({isReadOnly:!0}),this._widgetDisposableStore.add(this._notebookWidget.value.onDidResizeOutput(h=>{this._scrollIfNecessary(h)})),this._widgetDisposableStore.add(this._notebookWidget.value.onDidFocusWidget(()=>this._onDidFocusWidget.fire())),this._widgetDisposableStore.add(this._notebookOptions.onDidChangeOptions(h=>{(h.compactView||h.focusIndicator)&&(this._styleElement?.remove(),this._createLayoutStyles()),this._lastLayoutDimensions&&this.isVisible()&&this.layout(this._lastLayoutDimensions.dimension,this._lastLayoutDimensions.position),h.interactiveWindowCollapseCodeCells&&s.notebook.setCellCollapseDefault(this._notebookOptions.getCellCollapseDefault())}));let c=this._notebookWidget.value?.activeKernel?.supportedLanguages[0]??e.language??$r,u=await e.resolveInput(c);u.setLanguage(c),this._codeEditorWidget.setModel(u),l?.input&&this._codeEditorWidget.restoreViewState(l.input),this._editorOptions=this._computeEditorOptions(),this._codeEditorWidget.updateOptions(this._editorOptions),this._widgetDisposableStore.add(this._codeEditorWidget.onDidFocusEditorWidget(()=>this._onDidFocusWidget.fire())),this._widgetDisposableStore.add(this._codeEditorWidget.onDidContentSizeChange(h=>{h.contentHeightChanged&&this._lastLayoutDimensions&&this._layoutWidgets(this._lastLayoutDimensions.dimension,this._lastLayoutDimensions.position)})),this._widgetDisposableStore.add(this._codeEditorWidget.onDidChangeCursorPosition(h=>this._onDidChangeSelection.fire({reason:this._toEditorPaneSelectionChangeReason(h)}))),this._widgetDisposableStore.add(this._codeEditorWidget.onDidChangeModelContent(()=>this._onDidChangeSelection.fire({reason:3}))),this._widgetDisposableStore.add(this._notebookKernelService.onDidChangeNotebookAffinity(this._syncWithKernel,this)),this._widgetDisposableStore.add(this._notebookKernelService.onDidChangeSelectedNotebooks(this._syncWithKernel,this)),this._widgetDisposableStore.add(this.themeService.onDidColorThemeChange(()=>{this.isVisible()&&this._updateInputHint()})),this._widgetDisposableStore.add(this._codeEditorWidget.onDidChangeModelContent(()=>{this.isVisible()&&this._updateInputHint()})),this._widgetDisposableStore.add(this._codeEditorWidget.onDidChangeModelDecorations(()=>{this.isVisible()&&this._updateInputHint()})),this._widgetDisposableStore.add(this._codeEditorWidget.onDidChangeModel(()=>{this._updateInputHint()})),this._widgetDisposableStore.add(this._configurationService.onDidChangeConfiguration(h=>{h.affectsConfiguration(qM.showExecutionHint)&&this._updateInputHint()}));let p=EU.bindTo(this._contextKeyService);e.resource&&e.historyService.has(e.resource)?p.set("top"):p.set("none"),this._widgetDisposableStore.add(this._codeEditorWidget.onDidChangeCursorPosition(({position:h})=>{let g=this._codeEditorWidget._getViewModel(),f=g.getLineCount(),v=g.getLineLength(f)+1,b=g.coordinatesConverter.convertModelPositionToViewPosition(h),S=b.lineNumber===1&&b.column===1,y=b.lineNumber===f&&b.column===v;S?y?p.set("both"):p.set("top"):y?p.set("bottom"):p.set("none")})),this._widgetDisposableStore.add(u.onDidChangeContent(()=>{let h=u.getValue();if(this.input?.resource){let g=this.input.historyService;g.matchesCurrent(this.input.resource,h)||g.replaceLast(this.input.resource,h)}})),this._widgetDisposableStore.add(this._notebookWidget.value.onDidScroll(()=>this._onDidChangeScroll.fire())),this._syncWithKernel(),this._updateInputHint()}setOptions(e){this._notebookWidget.value?.setOptions(e),super.setOptions(e)}_toEditorPaneSelectionChangeReason(e){switch(e.source){case"api":return 1;case"code.navigation":return 4;case"code.jump":return 5;default:return 2}}_cellAtBottom(e){let t=this._notebookWidget.value?.visibleRanges||[];return this._notebookWidget.value?.getCellIndex(e)===Math.max(...t.map(n=>n.end-1))}_scrollIfNecessary(e){this._notebookWidget.value.getCellIndex(e)===this._notebookWidget.value.getLength()-1&&(this._configurationService.getValue(qM.interactiveWindowAlwaysScrollOnNewCell)||this._cellAtBottom(e))&&this._notebookWidget.value.scrollToBottom()}_syncWithKernel(){let e=this._notebookWidget.value?.textModel,t=this._codeEditorWidget.getModel();if(e&&t){let o=this._notebookKernelService.getMatchingKernel(e),n=o.selected??(o.suggestions.length===1?o.suggestions[0]:void 0)??(o.all.length===1?o.all[0]:void 0);if(n){let r=n.supportedLanguages[0];if(r&&r!=="plaintext"){let s=this._languageService.createById(r).languageId;t.setLanguage(s)}fPe.bindTo(this._contextKeyService).set(n.id)}}}layout(e,t){this._rootElement.classList.toggle("mid-width",e.width<1e3&&e.width>=600),this._rootElement.classList.toggle("narrow-width",e.width<600);let o=e.height!==this._lastLayoutDimensions?.dimension.height;this._lastLayoutDimensions={dimension:e,position:t},this._notebookWidget.value&&(o&&this._codeEditorWidget&&nc.get(this._codeEditorWidget)?.cancelSuggestWidget(),this._notebookEditorContainer.style.height=`${this._lastLayoutDimensions.dimension.height-this.inputCellContainerHeight}px`,this._layoutWidgets(e,t))}_layoutWidgets(e,t){let o=this._codeEditorWidget.hasModel()?this._codeEditorWidget.getContentHeight():this.inputCellEditorHeight,n=Math.min(e.height/2,o),r=this._notebookOptions.getCellEditorContainerLeftMargin(),s=n+eat*2;this._notebookEditorContainer.style.height=`${e.height-s}px`,this._notebookWidget.value.layout(e.with(e.width,e.height-s),this._notebookEditorContainer,t),this._codeEditorWidget.layout(this._validateDimension(e.width-r-nOi,n)),this._inputFocusIndicator.style.height=`${o}px`,this._inputCellContainer.style.top=`${e.height-s}px`,this._inputCellContainer.style.width=`${e.width}px`}_validateDimension(e,t){return new si(Math.max(0,e),Math.max(0,t))}_hasConflictingDecoration(){return!!this._codeEditorWidget.getLineDecorations(1)?.find(e=>e.options.beforeContentClassName||e.options.afterContentClassName||e.options.before?.content||e.options.after?.content)}_updateInputHint(){if(!this._codeEditorWidget)return;let e=!this._codeEditorWidget.hasModel()||this._configurationService.getValue(qM.showExecutionHint)===!1||this._codeEditorWidget.getModel().getValueLength()!==0||this._hasConflictingDecoration();!this._hintElement&&!e?this._hintElement=this._instantiationService.createInstance(_q,this._codeEditorWidget):this._hintElement&&e&&(this._hintElement.dispose(),this._hintElement=void 0)}getScrollPosition(){return{scrollTop:this._notebookWidget.value?.scrollTop??0,scrollLeft:0}}setScrollPosition(e){this._notebookWidget.value?.setScrollTop(e.scrollTop)}focus(){super.focus(),this._notebookWidget.value?.onShow(),this._codeEditorWidget.focus()}focusHistory(){this._notebookWidget.value.focus()}setEditorVisible(e){super.setEditorVisible(e),this._groupListener.value=this.group.onWillCloseEditor(t=>this._saveEditorViewState(t.editor)),e||(this._saveEditorViewState(this.input),this.input&&this._notebookWidget.value&&this._notebookWidget.value.onWillHide()),this._updateInputHint()}clearInput(){this._notebookWidget.value&&(this._saveEditorViewState(this.input),this._notebookWidget.value.onWillHide()),this._codeEditorWidget?.dispose(),this._notebookWidget={value:void 0},this._widgetDisposableStore.clear(),super.clearInput()}getControl(){return{notebookEditor:this._notebookWidget.value,activeCodeEditor:this._codeEditorWidget,onDidChangeActiveEditor:U.None}}};RBe=I([m(1,Te),m(2,Le),m(3,ce),m(4,F),m(5,Gc),m(6,X),m(7,qt),m(8,Ol),m(9,_t),m(10,_e),m(11,B),m(12,Kt),m(13,Xe),m(14,wt),m(15,Fn),m(16,bs),m(17,lt)],RBe);var pun=Ae("repl-editor-label-icon",R.debugLineByLine,d(13595,null)),Vy=class extends Ra{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super(e,void 0,"jupyter-notebook",{},o,n,r,s,l,c,u,p,h,g,S,y);this.historyService=f;this._textModelService=v;this.isDisposing=!1;this.isScratchpad=e.scheme==="untitled"&&b.getValue(yt.InteractiveWindowPromptToSave)!==!0,this.label=t??this.createEditorLabel(e)}static{this.ID="workbench.editorinputs.replEditorInput"}getIcon(){return pun}createEditorLabel(e){if(!e)return"REPL";if(e.scheme==="untitled"){let o=new RegExp("Untitled-(\\d+).").exec(e.path);if(o?.length===2)return`REPL - ${o[1]}`}let t=e.path.split("/").pop();return t?`REPL - ${t}`:"REPL"}get typeId(){return Vy.ID}get editorId(){return"repl"}getName(){return this.label}get editorInputs(){return[this]}get capabilities(){let e=super.capabilities,t=this.isScratchpad?512:0;return e|2|t}async resolve(){let e=await super.resolve();return e&&this.ensureInputBoxCell(e.notebook),e}ensureInputBoxCell(e){let t=e.cells[e.cells.length-1];(!t||t.cellKind===1||t.outputs.length>0||t.internalMetadata.executionOrder!==void 0)&&e.applyEdits([{editType:1,index:e.cells.length,count:0,cells:[{cellKind:2,language:"python",mime:void 0,outputs:[],source:""}]}],!0,void 0,()=>{},void 0,!1)}async resolveInput(e){if(this.inputModelRef)return this.inputModelRef.object.textEditorModel;let t=e.cells[e.cells.length-1];if(!t)throw new Error("The REPL editor requires at least one cell for the input box.");return this.inputModelRef=await this._textModelService.createModelReference(t.uri),this.inputModelRef.object.textEditorModel}dispose(){this.isDisposing||(this.isDisposing=!0,this.editorModelReference?.object.revert({soft:!0}),this.inputModelRef?.dispose(),super.dispose())}};Vy=I([m(2,bn),m(3,yh),m(4,rn),m(5,rt),m(6,fe),m(7,gr),m(8,lt),m(9,ee),m(10,Fn),m(11,Rv),m(12,QF),m(13,Bt),m(14,B),m(15,At),m(16,An)],Vy);var mun="InteractiveEditorViewState",iat=8,rOi=10,oat=8,MBe=class extends Ts{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w){super(iEe,e,t,o,n);this._accessibilityService=w;this._notebookWidget={value:void 0};this._widgetDisposableStore=this._register(new N);this._groupListener=this._register(new me);this._onDidFocusWidget=this._register(new E);this._onDidChangeSelection=this._register(new E);this.onDidChangeSelection=this._onDidChangeSelection.event;this._onDidChangeScroll=this._register(new E);this.onDidChangeScroll=this._onDidChangeScroll.event;this._notebookWidgetService=s,this._configurationService=h,this._notebookKernelService=c,this._languageService=u,this._keybindingService=p,this._menuService=g,this._contextMenuService=f,this._editorGroupService=v,this._extensionService=y,this._rootElement=_(".interactive-editor"),this._contextKeyService=this._register(l.createScoped(this._rootElement)),this._contextKeyService.createKey("isCompositeNotebook",!0),this._instantiationService=this._register(r.createChild(new _o([X,this._contextKeyService]))),this._editorOptions=this._computeEditorOptions(),this._register(this._configurationService.onDidChangeConfiguration(k=>{(k.affectsConfiguration("editor")||k.affectsConfiguration("notebook"))&&(this._editorOptions=this._computeEditorOptions())})),this._notebookOptions=r.createInstance(VT,this.window,!0,{cellToolbarInteraction:"hover",globalToolbar:!0,stickyScrollEnabled:!1,dragAndDropEnabled:!1,disableRulers:!0}),this._editorMemento=this.getEditorMemento(v,b,mun),this._register(this._keybindingService.onDidUpdateKeybindings(this._updateInputHint,this)),this._register(S.onDidChangeExecution(k=>{if(k.type===0&&Qe(k.notebook,this._notebookWidget.value?.viewModel?.notebookDocument.uri)){let T=this._notebookWidget.value?.getCellByHandle(k.cellHandle);T&&k.changed?.state&&this._scrollIfNecessary(T)}}))}get onDidFocus(){return this._onDidFocusWidget.event}get inputCellContainerHeight(){return 21+iat*2+oat*2}get inputCellEditorHeight(){return 19+oat*2}createEditor(e){M(e,this._rootElement),this._rootElement.style.position="relative",this._notebookEditorContainer=M(this._rootElement,_(".notebook-editor-container")),this._inputCellContainer=M(this._rootElement,_(".input-cell-container")),this._inputCellContainer.style.position="absolute",this._inputCellContainer.style.height=`${this.inputCellContainerHeight}px`,this._inputFocusIndicator=M(this._inputCellContainer,_(".input-focus-indicator")),this._inputRunButtonContainer=M(this._inputCellContainer,_(".run-button-container")),this._setupRunButtonToolbar(this._inputRunButtonContainer),this._inputEditorContainer=M(this._inputCellContainer,_(".input-editor-container")),this._createLayoutStyles()}_setupRunButtonToolbar(e){let t=this._register(this._menuService.createMenu(D.ReplInputExecute,this._contextKeyService));this._runbuttonToolbar=this._register(new wp(e,this._contextMenuService,{getKeyBinding:r=>this._keybindingService.lookupKeybinding(r.id),actionViewItemProvider:(r,s)=>Bs(this._instantiationService,r,s),renderDropdownAsChildElement:!0}));let{primary:o,secondary:n}=ml(t.getActions({shouldForwardArgs:!0}));this._runbuttonToolbar.setActions([...o,...n])}_createLayoutStyles(){this._styleElement=Cr(this._rootElement);let e=[],{codeCellLeftMargin:t,cellRunGutter:o}=this._notebookOptions.getLayoutConfiguration(),{focusIndicator:n}=this._notebookOptions.getDisplayOptions(),r=this._notebookOptions.getCellEditorContainerLeftMargin();e.push(`
			.interactive-editor .input-cell-container {
				padding: ${iat}px ${rOi}px ${iat}px ${r}px;
			}
		`),n==="gutter"?e.push(`
				.interactive-editor .input-cell-container:focus-within .input-focus-indicator::before {
					border-color: var(--vscode-notebook-focusedCellBorder) !important;
				}
				.interactive-editor .input-focus-indicator::before {
					border-color: var(--vscode-notebook-inactiveFocusedCellBorder) !important;
				}
				.interactive-editor .input-cell-container .input-focus-indicator {
					display: block;
					top: ${iat}px;
				}
				.interactive-editor .input-cell-container {
					border-top: 1px solid var(--vscode-notebook-inactiveFocusedCellBorder);
				}
			`):e.push(`
				.interactive-editor .input-cell-container {
					border-top: 1px solid var(--vscode-notebook-inactiveFocusedCellBorder);
				}
				.interactive-editor .input-cell-container .input-focus-indicator {
					display: none;
				}
			`),e.push(`
			.interactive-editor .input-cell-container .run-button-container {
				width: ${o}px;
				left: ${t}px;
				margin-top: ${oat-2}px;
			}
		`),this._styleElement.textContent=e.join(`
`)}_computeEditorOptions(){let e;this._codeEditorWidget&&(e=this._codeEditorWidget.getModel()?.getLanguageId());let t=Ji(this._configurationService.getValue("editor",{overrideIdentifier:e})),o=Vb(this._configurationService);return Object.freeze({...t,...o,ariaLabel:d(13581,null),glyphMargin:!0,padding:{top:oat,bottom:oat},hover:{enabled:"on"},rulers:[]})}saveState(){this._saveEditorViewState(this.input),super.saveState()}getViewState(){let e=this.input;if(e instanceof Vy)return this._saveEditorViewState(e),this._loadNotebookEditorViewState(e)}_saveEditorViewState(e){if(this._notebookWidget.value&&e instanceof Vy){if(this._notebookWidget.value.isDisposed)return;let t=this._notebookWidget.value.getEditorViewState(),o=this._codeEditorWidget.saveViewState();this._editorMemento.saveEditorState(this.group,e.resource,{notebook:t,input:o})}}_loadNotebookEditorViewState(e){let t=this._editorMemento.loadEditorState(this.group,e.resource);if(t)return t;for(let o of this._editorGroupService.getGroups(1))if(o.activeEditorPane!==this&&o.activeEditorPane===this&&o.activeEditor?.matches(e)){let n=this._notebookWidget.value?.getEditorViewState(),r=this._codeEditorWidget.saveViewState();return{notebook:n,input:r}}}async setInput(e,t,o,n){this._notebookWidget.value?.onWillHide(),this._codeEditorWidget?.dispose(),this._widgetDisposableStore.clear(),this._notebookWidget=this._instantiationService.invokeFunction(this._notebookWidgetService.retrieveWidget,this.group.id,e,{isReplHistory:!0,isReadOnly:!0,contributions:b8.getSomeEditorContributions([XG.id,JG.id,tC.id]),menuIds:{notebookToolbar:D.InteractiveToolbar,cellTitleToolbar:D.InteractiveCellTitle,cellDeleteToolbar:D.InteractiveCellDelete,cellInsertToolbar:D.NotebookCellBetween,cellTopInsertToolbar:D.NotebookCellListTop,cellExecuteToolbar:D.InteractiveCellExecute,cellExecutePrimary:void 0},cellEditorContributions:Ba.getSomeEditorContributions([xy,og.ID,Pl.ID,ff.ID,xw.ID]),options:this._notebookOptions,codeWindow:this.window},void 0,this.window);let r=["workbench.notebook.cellToolbar","editor.contrib.inlineCompletionsController"],s=kte().cellEditorContributions?.filter(h=>r.indexOf(h.id)===-1);if(this._codeEditorWidget=this._instantiationService.createInstance(Xr,this._inputEditorContainer,this._editorOptions,{isSimpleWidget:!1,contributions:s}),this._lastLayoutDimensions){this._notebookEditorContainer.style.height=`${this._lastLayoutDimensions.dimension.height-this.inputCellContainerHeight}px`,this._notebookWidget.value.layout(new si(this._lastLayoutDimensions.dimension.width,this._lastLayoutDimensions.dimension.height-this.inputCellContainerHeight),this._notebookEditorContainer);let h=this._notebookOptions.getCellEditorContainerLeftMargin(),g=Math.min(this._lastLayoutDimensions.dimension.height/2,this.inputCellEditorHeight);this._codeEditorWidget.layout(this._validateDimension(this._lastLayoutDimensions.dimension.width-h-rOi,g)),this._inputFocusIndicator.style.height=`${this.inputCellEditorHeight}px`,this._inputCellContainer.style.top=`${this._lastLayoutDimensions.dimension.height-this.inputCellContainerHeight}px`,this._inputCellContainer.style.width=`${this._lastLayoutDimensions.dimension.width}px`}await super.setInput(e,t,o,n);let l=await e.resolve();if(this._runbuttonToolbar&&(this._runbuttonToolbar.context=e.resource),l===null)throw new Error("The REPL model could not be resolved");this._notebookWidget.value?.setParentContextKeyService(this._contextKeyService);let c=t?.viewState??this._loadNotebookEditorViewState(e);await this._extensionService.whenInstalledExtensionsRegistered(),await this._notebookWidget.value.setModel(l.notebook,c?.notebook,void 0,"repl"),l.notebook.setCellCollapseDefault(this._notebookOptions.getCellCollapseDefault()),this._notebookWidget.value.setOptions({isReadOnly:!0}),this._widgetDisposableStore.add(this._notebookWidget.value.onDidResizeOutput(h=>{this._scrollIfNecessary(h)})),this._widgetDisposableStore.add(this._notebookWidget.value.onDidFocusWidget(()=>this._onDidFocusWidget.fire())),this._widgetDisposableStore.add(this._notebookOptions.onDidChangeOptions(h=>{(h.compactView||h.focusIndicator)&&(this._styleElement?.remove(),this._createLayoutStyles()),this._lastLayoutDimensions&&this.isVisible()&&this.layout(this._lastLayoutDimensions.dimension,this._lastLayoutDimensions.position),h.interactiveWindowCollapseCodeCells&&l.notebook.setCellCollapseDefault(this._notebookOptions.getCellCollapseDefault())}));let u=await e.resolveInput(l.notebook);this._codeEditorWidget.setModel(u),c?.input&&this._codeEditorWidget.restoreViewState(c.input),this._editorOptions=this._computeEditorOptions(),this._codeEditorWidget.updateOptions(this._editorOptions),this._widgetDisposableStore.add(this._codeEditorWidget.onDidFocusEditorWidget(()=>this._onDidFocusWidget.fire())),this._widgetDisposableStore.add(this._codeEditorWidget.onDidContentSizeChange(h=>{h.contentHeightChanged&&this._lastLayoutDimensions&&this._layoutWidgets(this._lastLayoutDimensions.dimension,this._lastLayoutDimensions.position)})),this._widgetDisposableStore.add(this._codeEditorWidget.onDidChangeCursorPosition(h=>this._onDidChangeSelection.fire({reason:this._toEditorPaneSelectionChangeReason(h)}))),this._widgetDisposableStore.add(this._codeEditorWidget.onDidChangeModelContent(()=>this._onDidChangeSelection.fire({reason:3}))),this._widgetDisposableStore.add(this._notebookKernelService.onDidChangeNotebookAffinity(this._syncWithKernel,this)),this._widgetDisposableStore.add(this._notebookKernelService.onDidChangeSelectedNotebooks(this._syncWithKernel,this)),this._widgetDisposableStore.add(this.themeService.onDidColorThemeChange(()=>{this.isVisible()&&this._updateInputHint()})),this._widgetDisposableStore.add(this._codeEditorWidget.onDidChangeModelContent(()=>{this.isVisible()&&this._updateInputHint()})),this._widgetDisposableStore.add(this._codeEditorWidget.onDidChangeModelDecorations(()=>{this.isVisible()&&this._updateInputHint()}));let p=EU.bindTo(this._contextKeyService);e.resource&&e.historyService.has(e.resource)?p.set("top"):p.set("none"),this._widgetDisposableStore.add(this._codeEditorWidget.onDidChangeCursorPosition(({position:h})=>{let g=this._codeEditorWidget._getViewModel(),f=g.getLineCount(),v=g.getLineLength(f)+1,b=g.coordinatesConverter.convertModelPositionToViewPosition(h),S=b.lineNumber===1&&b.column===1,y=b.lineNumber===f&&b.column===v;S?y?p.set("both"):p.set("top"):y?p.set("bottom"):p.set("none")})),this._widgetDisposableStore.add(u.onDidChangeContent(()=>{let h=u.getValue();if(this.input?.resource&&h!==""){let g=this.input.historyService;g.matchesCurrent(this.input.resource,h)||g.replaceLast(this.input.resource,h)}})),this._widgetDisposableStore.add(this._notebookWidget.value.onDidScroll(()=>this._onDidChangeScroll.fire())),this._widgetDisposableStore.add(this._notebookWidget.value.onDidChangeViewCells(this.handleViewCellChange,this)),this._updateInputHint(),this._syncWithKernel()}handleViewCellChange(e){let t=this._notebookWidget.value;if(t)for(let o of e.splices){let[n,r,s]=o;if(s.length){let l=t.viewModel;if(l){this.handleAppend(t,l);break}}}}handleAppend(e,t){this._notebookWidgetService.updateReplContextKey(t.notebookDocument.uri.toString());let o=this._configurationService.getValue("accessibility.replEditor.autoFocusReplExecution");this._accessibilityService.isScreenReaderOptimized()&&(o==="lastExecution"?setTimeout(()=>{let n=t.length-1;if(n>=0){let r=t.viewCells[n];e.focusNotebookCell(r,"container")}},0):o==="input"&&this._codeEditorWidget.focus())}setOptions(e){this._notebookWidget.value?.setOptions(e),super.setOptions(e)}_toEditorPaneSelectionChangeReason(e){switch(e.source){case"api":return 1;case"code.navigation":return 4;case"code.jump":return 5;default:return 2}}_cellAtBottom(e){let t=this._notebookWidget.value?.visibleRanges||[];return this._notebookWidget.value?.getCellIndex(e)===Math.max(...t.map(n=>n.end-1))}_scrollIfNecessary(e){this._notebookWidget.value.getCellIndex(e)===this._notebookWidget.value.getLength()-1&&(this._configurationService.getValue(qM.interactiveWindowAlwaysScrollOnNewCell)||this._cellAtBottom(e))&&this._notebookWidget.value.scrollToBottom()}_syncWithKernel(){let e=this._notebookWidget.value?.textModel,t=this._codeEditorWidget.getModel();if(e&&t){let o=this._notebookKernelService.getMatchingKernel(e),n=o.selected??(o.suggestions.length===1?o.suggestions[0]:void 0)??(o.all.length===1?o.all[0]:void 0);if(n){let r=n.supportedLanguages[0];if(r&&r!=="plaintext"){let s=this._languageService.createById(r).languageId;t.setLanguage(s)}fPe.bindTo(this._contextKeyService).set(n.id)}}}layout(e,t){this._rootElement.classList.toggle("mid-width",e.width<1e3&&e.width>=600),this._rootElement.classList.toggle("narrow-width",e.width<600);let o=e.height!==this._lastLayoutDimensions?.dimension.height;this._lastLayoutDimensions={dimension:e,position:t},this._notebookWidget.value&&(o&&this._codeEditorWidget&&nc.get(this._codeEditorWidget)?.cancelSuggestWidget(),this._notebookEditorContainer.style.height=`${this._lastLayoutDimensions.dimension.height-this.inputCellContainerHeight}px`,this._layoutWidgets(e,t))}_layoutWidgets(e,t){let o=this._codeEditorWidget.hasModel()?this._codeEditorWidget.getContentHeight():this.inputCellEditorHeight,n=Math.min(e.height/2,o),r=this._notebookOptions.getCellEditorContainerLeftMargin(),s=n+iat*2;this._notebookEditorContainer.style.height=`${e.height-s}px`,this._notebookWidget.value.layout(e.with(e.width,e.height-s),this._notebookEditorContainer,t),this._codeEditorWidget.layout(this._validateDimension(e.width-r-rOi,n)),this._inputFocusIndicator.style.height=`${o}px`,this._inputCellContainer.style.top=`${e.height-s}px`,this._inputCellContainer.style.width=`${e.width}px`}_validateDimension(e,t){return new si(Math.max(0,e),Math.max(0,t))}_hasConflictingDecoration(){return!!this._codeEditorWidget.getLineDecorations(1)?.find(e=>e.options.beforeContentClassName||e.options.afterContentClassName||e.options.before?.content||e.options.after?.content)}_updateInputHint(){if(!this._codeEditorWidget)return;let e=!this._codeEditorWidget.hasModel()||this._configurationService.getValue(qM.showExecutionHint)===!1||this._codeEditorWidget.getModel().getValueLength()!==0||this._hasConflictingDecoration();!this._hintElement&&!e?this._hintElement=this._instantiationService.createInstance(_q,this._codeEditorWidget):this._hintElement&&e&&(this._hintElement.dispose(),this._hintElement=void 0)}getScrollPosition(){return{scrollTop:this._notebookWidget.value?.scrollTop??0,scrollLeft:0}}setScrollPosition(e){this._notebookWidget.value?.setScrollTop(e.scrollTop)}focus(){super.focus(),this._notebookWidget.value?.onShow(),this._codeEditorWidget.focus()}focusHistory(){this._notebookWidget.value.focus()}setEditorVisible(e){super.setEditorVisible(e),this._groupListener.value=this.group.onWillCloseEditor(t=>this._saveEditorViewState(t.editor)),e||(this._saveEditorViewState(this.input),this.input&&this._notebookWidget.value&&this._notebookWidget.value.onWillHide()),this._updateInputHint()}clearInput(){this._notebookWidget.value&&(this._saveEditorViewState(this.input),this._notebookWidget.value.onWillHide()),this._codeEditorWidget?.dispose(),this._notebookWidget={value:void 0},this._widgetDisposableStore.clear(),super.clearInput()}getControl(){return{notebookEditor:this._notebookWidget.value,activeCodeEditor:this.getActiveCodeEditor(),onDidChangeActiveEditor:U.None}}getActiveCodeEditor(){if(this._codeEditorWidget)return this._codeEditorWidget.hasWidgetFocus()||!this._notebookWidget.value?.activeCodeEditor?this._codeEditorWidget:this._notebookWidget.value.activeCodeEditor}};MBe=I([m(1,Te),m(2,Le),m(3,ce),m(4,F),m(5,Gc),m(6,X),m(7,Ol),m(8,_t),m(9,_e),m(10,B),m(11,Kt),m(12,Xe),m(13,wt),m(14,Fn),m(15,bs),m(16,lt),m(17,Oi)],MBe);function oE(a){let i=a;return i?.activeCodeEditor instanceof Xr&&i?.notebookEditor instanceof xG}var l6=L(11340,"Interactive Window");ne.as(qo.EditorPane).registerEditorPane(Br.create(RBe,_X,"Interactive Window"),[new Ft(Cf)]);var PBe=class extends x{constructor(e,t,o,n){super();this.instantiationService=n;e.getContributedNotebookType("interactive")||this._register(e.registerContributedNotebookType("interactive",{providerDisplayName:"Interactive Notebook",displayName:"Interactive",filenamePattern:["*.interactive"],priority:"builtin"})),t.registerEditor(`${Q.vscodeInteractiveInput}:/**`,{id:"vscode-interactive-input",label:"Interactive Editor",priority:"exclusive"},{canSupportResource:s=>s.scheme===Q.vscodeInteractiveInput,singlePerResource:!0},{createEditorInput:({resource:s})=>o.findEditors({resource:s,editorId:"interactive",typeId:Cf.ID},{order:1}).at(0)}),t.registerEditor("*.interactive",{id:"interactive",label:"Interactive Editor",priority:"exclusive"},{canSupportResource:s=>s.scheme===Q.untitled&&es(s)===".interactive"||s.scheme===Q.vscodeNotebookCell&&es(s)===".interactive",singlePerResource:!0},{createEditorInput:({resource:s,options:l})=>{let c=Zo.parse(s),u,p=s;c&&(u={resource:s,options:l},p=c.notebook);let h={...l,cellOptions:u,cellRevealType:void 0,cellSelections:void 0,isReadOnly:void 0,viewState:void 0,indexedCellOptions:void 0};return{editor:sOi(p,this.instantiationService),options:h}},createUntitledEditorInput:({resource:s,options:l})=>{if(!s)throw new Error("Interactive window editors must have a resource name");let c=Zo.parse(s),u;c&&(u={resource:s,options:l});let p={...l,cellOptions:u,cellRevealType:void 0,cellSelections:void 0,isReadOnly:void 0,viewState:void 0,indexedCellOptions:void 0};return{editor:sOi(s,this.instantiationService),options:p}}})}static{this.ID="workbench.contrib.interactiveDocument"}};PBe=I([m(0,bn),m(1,Ka),m(2,ee),m(3,F)],PBe);var ABe=class{constructor(i,e){this._modelService=e;this._registration=i.registerTextModelContentProvider(Q.vscodeInteractiveInput,this)}static{this.ID="workbench.contrib.interactiveInputContentProvider"}dispose(){this._registration.dispose()}async provideTextContent(i){let e=this._modelService.getModel(i);return e||this._modelService.createModel("",null,i,!1)}};ABe=I([m(0,Bt),m(1,Tt)],ABe);function sOi(a,i){let e=/\/Interactive-(\d+)/.exec(a.path),t=e&&e[1]?`/InteractiveInput-${e[1]}`:"InteractiveInput",o=A.from({scheme:Q.vscodeInteractiveInput,path:t});return Cf.create(i,a,o)}var NBe=class extends x{constructor(e,t,o){super();this._instantiationService=e;this._workingCopyEditorService=t;this._extensionService=o;this._installHandler()}static{this.ID="workbench.contrib.interactiveWindowWorkingCopyEditorHandler"}handles(e){let t=this._getViewType(e);return!!t&&t==="interactive"}isOpen(e,t){return this.handles(e)?t instanceof Cf&&Qe(e.resource,t.resource):!1}createEditor(e){return sOi(e.resource,this._instantiationService)}async _installHandler(){await this._extensionService.whenInstalledExtensionsRegistered(),this._register(this._workingCopyEditorService.registerHandler(this))}_getViewType(e){return yF.parse(e.typeId)?.viewType}};NBe=I([m(0,F),m(1,iv),m(2,lt)],NBe);It(PBe.ID,PBe,St.BlockRestore);It(ABe.ID,ABe,{editorTypeId:_X});It(NBe.ID,NBe,{editorTypeId:_X});var Vjt=class{static{this.ID=Cf.ID}canSerialize(i){return i instanceof Cf?A.isUri(i.primary.resource)&&A.isUri(i.inputResource):!1}serialize(i){if(this.canSerialize(i))return JSON.stringify({resource:i.primary.resource,inputResource:i.inputResource,name:i.getName(),language:i.language})}deserialize(i,e){let t=am(e);if(!t)return;let{resource:o,inputResource:n,name:r,language:s}=t;return!A.isUri(o)||!A.isUri(n)?void 0:Cf.create(i,o,n,r,s)}};ne.as(qo.EditorFactory).registerEditorSerializer(Vjt.ID,Vjt);Ee(QF,KRt,1);Ee(FTe,zRt,1);W(class extends K{constructor(){super({id:"_interactive.open",title:L(11336,"Open Interactive Window"),f1:!1,category:l6,metadata:{description:d(11337,null),args:[{name:"showOptions",description:"Show Options",schema:{type:"object",properties:{viewColumn:{type:"number",default:-1},preserveFocus:{type:"boolean",default:!0}}}},{name:"resource",description:"Interactive resource Uri",isOptional:!0},{name:"controllerId",description:"Notebook controller Id",isOptional:!0},{name:"title",description:"Notebook editor title",isOptional:!0}]}})}async run(a,i,e,t,o){let n=a.get(ee),r=a.get(wt),s=a.get(QF),l=a.get(Ol),c=a.get(se),u=a.get(B),p=wk(r,u,typeof i=="number"?i:i?.viewColumn),h={activation:3,preserveFocus:typeof i!="number"?i?.preserveFocus??!1:!1};if(e&&es(e)===".interactive"){c.debug("Open interactive window from resource:",e.toString());let k=A.revive(e),T=n.findEditors(k).filter(P=>P.editor instanceof Cf&&P.editor.resource?.toString()===k.toString());if(T.length){c.debug("Find existing interactive window:",e.toString());let P=T[0].editor,O=T[0].groupId,H=(await n.openEditor(P,h,O))?.getControl();return{notebookUri:P.resource,inputUri:P.inputResource,notebookEditorId:H?.notebookEditor?.getId()}}}let g=new Set;n.getEditors(1).forEach(k=>{k.editor.resource&&g.add(k.editor.resource.toString())});let f,v,b=1;do f=A.from({scheme:Q.untitled,path:`/Interactive-${b}.interactive`}),v=A.from({scheme:Q.vscodeInteractiveInput,path:`/InteractiveInput-${b}`}),b++;while(g.has(f.toString()));if(Cf.setName(f,o),c.debug("Open new interactive window:",f.toString(),v.toString()),t){let T=l.getMatchingKernel({uri:f,notebookType:"interactive"}).all.find(P=>P.id===t);T&&l.preselectKernelForNotebook(T,{uri:f,notebookType:"interactive"})}s.clearHistory(f);let S={resource:f,options:h},w=(await n.openEditor(S,p))?.getControl();return c.debug("New interactive window opened. Notebook editor id",w?.notebookEditor?.getId()),{notebookUri:f,inputUri:v,notebookEditorId:w?.notebookEditor?.getId()}}});W(class extends K{constructor(){super({id:"interactive.execute",title:L(11329,"Execute Code"),category:l6,keybinding:[{when:C.and(AS,C.equals("activeEditor","workbench.editor.interactive")),primary:2051,weight:Df},{when:C.and(AS,C.equals("activeEditor","workbench.editor.interactive"),C.equals("config.interactiveWindow.executeWithShiftEnter",!0)),primary:1027,weight:Df},{when:C.and(AS,C.equals("activeEditor","workbench.editor.interactive"),C.equals("config.interactiveWindow.executeWithShiftEnter",!1)),primary:3,weight:Df}],menu:[{id:D.InteractiveInputExecute}],icon:hG,f1:!1,metadata:{description:"Execute the Contents of the Input Box",args:[{name:"resource",description:"Interactive resource Uri",isOptional:!0}]}})}async run(a,i){let e=a.get(ee),t=a.get(La),o=a.get(QF),n=a.get(Gc),r;if(i){let s=A.revive(i),l=e.findEditors(s);for(let c of l)if(c.editor.typeId===Cf.ID){r=(await e.openEditor(c.editor,c.groupId))?.getControl();break}}else r=e.activeEditorPane?.getControl();if(r&&oE(r)&&r.notebookEditor){let s=r.notebookEditor.textModel,l=r.activeCodeEditor?.getModel(),u=r.notebookEditor.activeKernel?.supportedLanguages[0]??$r;if(s&&l&&r.activeCodeEditor){let p=s.length,h=l.getValue();if(uc(h))return;let g=Nd.get(r.activeCodeEditor);g&&g.acceptSession(),o.replaceLast(s.uri,h),o.addToHistory(s.uri,""),l.setValue("");let f=r.notebookEditor.notebookOptions.getDisplayOptions().interactiveWindowCollapseCodeCells==="fromEditor"?{inputCollapsed:!1,outputCollapsed:!1}:void 0;await t.apply([new Mv(s.uri,{editType:1,index:p,count:0,cells:[{cellKind:2,mime:void 0,language:u,source:h,outputs:[],metadata:{},collapseState:f}]})]);let v={start:p,end:p+1};r.notebookEditor.revealCellRangeInView(v),await r.notebookEditor.executeNotebookCells(r.notebookEditor.getCellsInRange({start:p,end:p+1}));let b=n.getNotebookEditor(r.notebookEditor.getId());b&&(b.setSelections([v]),b.setFocus(v))}}}});W(class extends K{constructor(){super({id:"interactive.input.clear",title:L(11334,"Clear the interactive window input editor contents"),category:l6,f1:!1})}async run(a){let e=a.get(ee).activeEditorPane?.getControl();if(e&&oE(e)&&e.notebookEditor){let t=e.notebookEditor.textModel,o=e.activeCodeEditor,n=o?.getModel()?.getFullModelRange();t&&o&&n&&o.executeEdits("",[Hn.replace(n,null)])}}});W(class extends K{constructor(){super({id:"interactive.history.previous",title:L(11332,"Previous value in history"),category:l6,f1:!1,keybinding:{when:C.and(EU.notEqualsTo("bottom"),EU.notEqualsTo("none"),Xn.Visible.toNegated()),primary:16,weight:200},precondition:C.and(AS,pr.negate())})}async run(a){let i=a.get(ee),e=a.get(QF),t=i.activeEditorPane?.getControl();if(t&&oE(t)&&t.notebookEditor){let o=t.notebookEditor.textModel,n=t.activeCodeEditor?.getModel();if(o&&n){let r=e.getPreviousValue(o.uri);r&&n.setValue(r)}}}});W(class extends K{constructor(){super({id:"interactive.history.next",title:L(11331,"Next value in history"),category:l6,f1:!1,keybinding:{when:C.and(EU.notEqualsTo("top"),EU.notEqualsTo("none"),Xn.Visible.toNegated()),primary:18,weight:200},precondition:C.and(AS,pr.negate())})}async run(a){let i=a.get(ee),e=a.get(QF),t=i.activeEditorPane?.getControl();if(t&&oE(t)&&t.notebookEditor){let o=t.notebookEditor.textModel,n=t.activeCodeEditor?.getModel();if(o&&n){let r=e.getNextValue(o.uri);r!==null&&n.setValue(r)}}}});W(class extends K{constructor(){super({id:"interactive.scrollToTop",title:d(11339,null),keybinding:{when:C.equals("activeEditor","workbench.editor.interactive"),primary:2062,mac:{primary:2064},weight:200},category:l6})}async run(a){let e=a.get(ee).activeEditorPane?.getControl();if(e&&oE(e)&&e.notebookEditor){if(e.notebookEditor.getLength()===0)return;e.notebookEditor.revealCellRangeInView({start:0,end:1})}}});W(class extends K{constructor(){super({id:"interactive.scrollToBottom",title:d(11338,null),keybinding:{when:C.equals("activeEditor","workbench.editor.interactive"),primary:2061,mac:{primary:2066},weight:200},category:l6})}async run(a){let e=a.get(ee).activeEditorPane?.getControl();if(e&&oE(e)&&e.notebookEditor){if(e.notebookEditor.getLength()===0)return;let t=e.notebookEditor.getLength();e.notebookEditor.revealCellRangeInView({start:t-1,end:t})}}});W(class extends K{constructor(){super({id:"interactive.input.focus",title:L(11335,"Focus Input Editor"),category:l6,menu:{id:D.CommandPalette,when:tUt}})}async run(a){let i=a.get(ee),e=i.activeEditorPane?.getControl();if(e&&oE(e)&&e.notebookEditor)i.activeEditorPane?.focus();else{let t=i.getEditors(0),o=vt.find(t,n=>n.editor.typeId===Cf.ID);if(o){let n=o.editor,r=o.groupId,l=(await i.openEditor(n,r))?.getControl();l&&oE(l)&&l.notebookEditor&&i.activeEditorPane?.focus()}}}});W(class extends K{constructor(){super({id:"interactive.history.focus",title:L(11330,"Focus History"),category:l6,menu:{id:D.CommandPalette,when:C.equals("activeEditor","workbench.editor.interactive")},keybinding:[{when:C.and(EU.notEqualsTo("bottom"),EU.notEqualsTo("none")),weight:205,primary:2064},{when:C.or(ww,Dce),weight:200,primary:2064}],precondition:C.and(AS,pr.negate())})}async run(a){let e=a.get(ee).activeEditorPane?.getControl();e&&oE(e)&&e.notebookEditor&&e.notebookEditor.focus()}});te("interactive.activeCodeBorder",{dark:nle(K_,K_,"#007acc"),light:nle(K_,K_,"#007acc"),hcDark:bi,hcLight:bi},d(11328,null));te("interactive.inactiveCodeBorder",{dark:nle(Kf,Kf,"#37373D"),light:nle(Kf,Kf,"#E4E6F1"),hcDark:vf,hcLight:vf},d(11333,null));ne.as(Jt.Configuration).registerConfiguration({id:"interactiveWindow",order:100,type:"object",properties:{[qM.interactiveWindowAlwaysScrollOnNewCell]:{type:"boolean",default:!0,markdownDescription:d(11341,null)},[yt.InteractiveWindowPromptToSave]:{type:"boolean",default:!1,markdownDescription:d(11343,null)},[qM.executeWithShiftEnter]:{type:"boolean",default:!1,markdownDescription:d(11342,null),tags:["replExecute"]},[qM.showExecutionHint]:{type:"boolean",default:!0,markdownDescription:d(11344,null),tags:["replExecute"]}}});var vko=_,OBe=class extends wl{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,t,o);this.context=e;this.debugService=n;this.configurationService=r;this.commandService=s;this.contextService=l;this.keybindingService=u;this.hoverService=p;this.contextKeyService=h;this.debugOptions=[];this.selected=0;this.providers=[];this.toDispose=[],this.selectBox=new ME([],-1,c,WE,{ariaLabel:d(9471,null),useCustomDrawn:!oI(this.configurationService)}),this.selectBox.setFocusable(!1),this.toDispose.push(this.selectBox),this.registerListeners()}registerListeners(){this.toDispose.push(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration("launch")&&this.updateOptions()})),this.toDispose.push(this.debugService.getConfigurationManager().onDidSelectConfiguration(()=>{this.updateOptions()}))}render(e){this.container=e,e.classList.add("start-debug-action-item"),this.start=M(e,vko(q.asCSSSelector(MUt)));let t=this.keybindingService.appendKeybinding(this.action.label,this.action.id);this.toDispose.push(this.hoverService.setupManagedHover(Ri("mouse"),this.start,t)),this.start.setAttribute("role","button"),this._setAriaLabel(t),this._register(Ms.addTarget(this.start));for(let s of[re.CLICK,Kn.Tap])this.toDispose.push(j(this.start,s,()=>{this.start.blur(),this.debugService.state!==1&&this.actionRunner.run(this.action,this.context)}));this.toDispose.push(j(this.start,re.MOUSE_DOWN,s=>{this.action.enabled&&s.button===0&&this.start.classList.add("active")})),this.toDispose.push(j(this.start,re.MOUSE_UP,()=>{this.start.classList.remove("active")})),this.toDispose.push(j(this.start,re.MOUSE_OUT,()=>{this.start.classList.remove("active")})),this.toDispose.push(j(this.start,re.KEY_DOWN,s=>{let l=new gi(s);l.equals(17)&&(this.start.tabIndex=-1,this.selectBox.focus(),l.stopPropagation())})),this.toDispose.push(this.selectBox.onDidSelect(async s=>{let l=this.debugOptions[s.index];(l.handler?await l.handler():!1)?this.selected=s.index:this.selectBox.select(this.selected)}));let o=vko(".configuration");this.selectBox.render(M(e,o)),this.toDispose.push(j(o,re.KEY_DOWN,s=>{let l=new gi(s);l.equals(15)&&(this.selectBox.setFocusable(!1),this.start.tabIndex=0,this.start.focus(),l.stopPropagation(),l.preventDefault())})),this.container.style.border=`1px solid ${kt(TO)}`,o.style.borderLeft=`1px solid ${kt(TO)}`,this.container.style.backgroundColor=kt($1);let n=this.debugService.getConfigurationManager(),r=()=>n.getDynamicProviders().then(s=>{s.length!==this.providers.length&&(this.providers=s,this.updateOptions())});this.toDispose.push(n.onDidChangeConfigurationProviders(r)),r(),this.updateOptions()}setActionContext(e){this.context=e}isEnabled(){return!0}focus(e){e?this.selectBox.focus():(this.start.tabIndex=0,this.start.focus())}blur(){this.start.tabIndex=-1,this.selectBox.blur(),this.container.blur()}setFocusable(e){e?this.start.tabIndex=0:(this.start.tabIndex=-1,this.selectBox.setFocusable(!1))}dispose(){this.toDispose=Be(this.toDispose),super.dispose()}updateOptions(){this.selected=0,this.debugOptions=[];let e=this.debugService.getConfigurationManager(),t=this.contextService.getWorkbenchState()===3,o,n=[],r=[];e.getAllConfigurations().forEach(({launch:s,name:l,presentation:c})=>{o!==c?.group&&(o=c?.group,this.debugOptions.length&&(this.debugOptions.push({label:UO.text,handler:()=>Promise.resolve(!1)}),n.push(this.debugOptions.length-1),r.push(this.debugOptions.length-1))),l===e.selectedConfiguration.name&&s===e.selectedConfiguration.launch&&(this.selected=this.debugOptions.length);let u=t?`${l} (${s.name})`:l;this.debugOptions.push({label:u,handler:async()=>(await e.selectConfiguration(s,l),!0)})}),e.getRecentDynamicConfigurations().slice(0,3).forEach(({name:s,type:l})=>{l===e.selectedConfiguration.type&&e.selectedConfiguration.name===s&&(this.selected=this.debugOptions.length),this.debugOptions.push({label:s,handler:async()=>(await e.selectConfiguration(void 0,s,void 0,{type:l}),!0)})}),this.debugOptions.length===0&&this.debugOptions.push({label:d(9473,null),handler:async()=>!1}),this.debugOptions.push({label:UO.text,handler:()=>Promise.resolve(!1)}),n.push(this.debugOptions.length-1),r.push(this.debugOptions.length-1),this.providers.forEach(s=>{this.debugOptions.push({label:`${s.label}...`,handler:async()=>{let l=await s.pick();return l?(await e.selectConfiguration(l.launch,l.config.name,l.config,{type:s.type}),!0):!1}})}),e.getLaunches().filter(s=>!s.hidden).forEach(s=>{let l=t?d(9467,null,s.name):d(9468,null);this.debugOptions.push({label:l,handler:async()=>(await this.commandService.executeCommand(Age,s.uri.toString()),!1)})}),this.selectBox.setOptions(this.debugOptions.map((s,l)=>({text:s.label,isDisabled:n.indexOf(l)!==-1,isSeparator:r.indexOf(l)!==-1})),this.selected)}_setAriaLabel(e){let t=e,o;this.configurationService.getValue("accessibility.verbosity.debug")&&(o=this.keybindingService.lookupKeybinding("editor.action.accessibilityHelp",this.contextKeyService)?.getLabel()??void 0),o?t=d(9469,null,t,o):t=d(9470,null,t),this.start.ariaLabel=t}};OBe=I([m(3,Ni),m(4,B),m(5,ge),m(6,Pe),m(7,Wn),m(8,_e),m(9,nt),m(10,X)],OBe);var Dq=class extends kz{constructor(e,t,o,n,r){super(null,e,[],-1,n,WE,{ariaLabel:d(9472,null),useCustomDrawn:!oI(r)});this.debugService=o;this.configurationService=r;this._register(this.debugService.getViewModel().onDidFocusSession(()=>{let l=this.getSelectedSession();if(l){let c=this.getSessions().indexOf(l);this.select(c)}})),this._register(this.debugService.onDidNewSession(l=>{let c=[];c.push(l.onDidChangeName(()=>this.update())),c.push(l.onDidEndAdapter(()=>Be(c))),this.update()})),this.getSessions().forEach(l=>{let c=[];c.push(l.onDidChangeName(()=>this.update())),c.push(l.onDidEndAdapter(()=>Be(c)))}),this._register(this.debugService.onDidEndSession(()=>this.update()));let s=t?this.mapFocusedSessionToSelected(t):void 0;this.update(s)}getActionContext(e,t){return this.getSessions()[t]}update(e){e||(e=this.getSelectedSession());let t=this.getSessions(),o=t.map(n=>{let r=n.getLabel();return n.parentSession?`\xA0\xA0${r}`:r});this.setOptions(o.map(n=>({text:n})),e?t.indexOf(e):void 0)}getSelectedSession(){let e=this.debugService.getViewModel().focusedSession;return e?this.mapFocusedSessionToSelected(e):void 0}getSessions(){let e=this.configurationService.getValue("debug").showSubSessionsInToolBar,t=this.debugService.getModel().getSessions();return e?t:t.filter(o=>!o.parentSession)}mapFocusedSessionToSelected(e){let t=this.configurationService.getValue("debug").showSubSessionsInToolBar;for(;e.parentSession&&!t;)e=e.parentSession;return e}};Dq=I([m(2,Ni),m(3,Wn),m(4,B)],Dq);var Bjt=class a{constructor(){this._parsedQueries=[]}static{this.matchQuery=lm}set filterQuery(i){if(this._parsedQueries=[],i=i.trim(),i&&i!==""){let e=ER(i,",").map(t=>t.trim()).filter(t=>!!t.length);for(let t of e)t.startsWith("\\")?this._parsedQueries.push({type:"include",query:t.slice(1)}):t.startsWith("!")?this._parsedQueries.push({type:"exclude",query:t.slice(1)}):this._parsedQueries.push({type:"include",query:t})}}filter(i,e){if(i instanceof Fie||i instanceof mN||i instanceof $l)return 1;let t=!1,o=!1,n=i.toString(!0);for(let{type:r,query:s}of this._parsedQueries){if(r==="exclude"&&a.matchQuery(s,n))return!1;r==="include"&&(t=!0,a.matchQuery(s,n)&&(o=!0))}return t?o:typeof e<"u"?e:1}};var MN=_,nat=class a{static{this.ID="replEvaluationInput"}get templateId(){return a.ID}renderTemplate(i){M(i,MN("span.arrow"+q.asCSSSelector(Iho)));let e=M(i,MN(".expression"));return{label:new Ya(e)}}renderElement(i,e,t){let o=i.element;t.label.set(o.value,xa(i.filterData))}disposeTemplate(i){i.label.dispose()}},c6=class{constructor(i,e){this.expressionRenderer=i;this.instaService=e}static{this.ID="replGroup"}get templateId(){return c6.ID}renderTemplate(i){i.classList.add("group");let e=M(i,MN(".output.expression.value-and-source")),t=M(e,MN("span.label")),o=this.instaService.createInstance(FBe,e);return{label:t,source:o}}renderElement(i,e,t){t.elementDisposable?.dispose();let o=i.element;Rt(t.label),t.elementDisposable=this.expressionRenderer.renderValue(t.label,o.name,{wasANSI:!0,session:i.element.session}),t.source.setSource(o.sourceData)}disposeTemplate(i){i.elementDisposable?.dispose(),i.source.dispose()}};c6=I([m(1,F)],c6);var rat=class a{constructor(i){this.expressionRenderer=i}static{this.ID="replEvaluationResult"}get templateId(){return a.ID}renderTemplate(i){let e=M(i,MN(".evaluation-result.expression"));return{value:M(e,MN("span.value")),elementStore:new N}}renderElement(i,e,t){t.elementStore.clear();let o=i.element;t.elementStore.add(this.expressionRenderer.renderValue(t.value,o,{colorize:!0,hover:!1,session:i.element.getSession()}))}disposeTemplate(i){i.elementStore.dispose()}},d6=class{constructor(i,e){this.expressionRenderer=i;this.instaService=e}static{this.ID="outputReplElement"}get templateId(){return d6.ID}renderTemplate(i){let e=Object.create(null);i.classList.add("output");let t=M(i,MN(".output.expression.value-and-source"));return e.container=i,e.countContainer=M(t,MN(".count-badge-wrapper")),e.count=new _v(e.countContainer,{},iI),e.value=M(t,MN("span.value.label")),e.source=this.instaService.createInstance(FBe,t),e.elementDisposable=new N,e}renderElement({element:i},e,t){t.elementDisposable.clear(),this.setElementCount(i,t),t.elementDisposable.add(i.onDidChangeCount(()=>this.setElementCount(i,t))),Rt(t.value),t.value.className="value";let o=i.expression?.valueLocationReference;t.elementDisposable.add(this.expressionRenderer.renderValue(t.value,i.value,{wasANSI:!0,session:i.session,locationReference:o,hover:!1})),t.value.classList.add(i.severity===bt.Warning?"warn":i.severity===bt.Error?"error":i.severity===bt.Ignore?"ignore":"info"),t.source.setSource(i.sourceData),t.getReplElementSource=()=>i.sourceData}setElementCount(i,e){i.count>=2?(e.count.setCount(i.count),e.countContainer.hidden=!1):e.countContainer.hidden=!0}disposeTemplate(i){i.source.dispose(),i.elementDisposable.dispose(),i.count.dispose()}disposeElement(i,e,t){t.elementDisposable.clear()}};d6=I([m(1,F)],d6);var u6=class extends iU{constructor(e,t,o,n){super(t,o,n);this.expressionRenderer=e}static{this.ID="replVariable"}get templateId(){return u6.ID}renderElement(e,t,o){let n=e.element;o.elementDisposable.clear(),super.renderExpressionElement(n instanceof Pge?n.expression:n,e,o)}renderExpression(e,t,o){let n=e instanceof Pge;if(n||!e.name){t.label.set("");let r=n?e.expression:e;t.elementDisposable.add(this.expressionRenderer.renderValue(t.value,r,{colorize:!0,hover:!1,session:e.getSession()})),t.expression.classList.remove("nested-variable")}else t.elementDisposable.add(this.expressionRenderer.renderVariable(t,e,{showChanged:!0,highlights:o})),t.expression.classList.toggle("nested-variable",aOi(e))}getInputBoxOptions(e){}};u6=I([m(1,Ni),m(2,Wn),m(3,nt)],u6);var sat=class a{constructor(i){this.expressionRenderer=i}static{this.ID="rawObject"}get templateId(){return a.ID}renderTemplate(i){i.classList.add("output");let e=M(i,MN(".output.expression")),t=M(e,MN("span.name")),o=new Ya(t),n=M(e,MN("span.value"));return{container:i,expression:e,name:t,label:o,value:n,elementStore:new N}}renderElement(i,e,t){t.elementStore.clear();let o=i.element;t.label.set(o.name?`${o.name}:`:"",xa(i.filterData)),o.name?t.name.textContent=`${o.name}:`:t.name.textContent="",t.elementStore.add(this.expressionRenderer.renderValue(t.value,o.value,{hover:!1,session:i.element.getSession()}))}disposeTemplate(i){i.elementStore.dispose(),i.label.dispose()}};function aOi(a){return a instanceof $l&&(a.parent instanceof mN||a.parent instanceof $l)}var Hjt=class extends yz{constructor(e,t){super();this.configurationService=e;this.replOptions=t}getHeight(e){return this.configurationService.getValue("debug").console.wordWrap?super.getHeight(e):this.estimateHeight(e,!0)}estimateHeight(e,t=!1){let o=this.replOptions.replConfiguration.lineHeight,n=s=>s.match(/\n/g)?.length??0;if((s=>typeof s.value=="string")(e)&&!aOi(e)){let s=e.value,l=n(s)+(t?0:Math.floor(s.length/70))+(e instanceof eC?0:1);return Math.max(l,1)*o}return o}getTemplateId(e){return e instanceof $l||e instanceof Pge?u6.ID:e instanceof mN?rat.ID:e instanceof Fie?nat.ID:e instanceof eC?d6.ID:e instanceof UG?c6.ID:sat.ID}hasDynamicHeight(e){return aOi(e)?!1:e.toString().length>0}};function bko(a){return typeof a.getReplElements=="function"}var Ujt=class{hasChildren(i){return bko(i)?!0:!!i.hasChildren}getChildren(i){return bko(i)?Promise.resolve(i.getReplElements()):Promise.resolve(i.getChildren())}},zjt=class{getWidgetAriaLabel(){return d(9791,null)}getAriaLabel(i){return i instanceof $l?d(9795,null,i.name,i.value):i instanceof eC||i instanceof Fie||i instanceof mN?i.value+(i instanceof eC&&i.count>1?d(9792,null,i.count):""):i instanceof LKt?d(9794,null,i.name,i.value):i instanceof UG?d(9793,null,i.name):""}},FBe=class extends x{constructor(e,t,o,n){super();this.hoverService=o;this.labelService=n;this.el=M(e,MN(".source")),this._register(j(this.el,"click",r=>{r.preventDefault(),r.stopPropagation(),this.source&&this.source.source.openInEditor(t,{startLineNumber:this.source.lineNumber,startColumn:this.source.column,endLineNumber:this.source.lineNumber,endColumn:this.source.column})}))}setSource(e){this.source=e,this.el.textContent=e?`${jo(e.source.name)}:${e.lineNumber}`:"",this.hover??=this._register(this.hoverService.setupManagedHover(Ri("mouse"),this.el,"")),this.hover.update(e?`${this.labelService.getUriLabel(e.source.uri)}:${e.lineNumber}`:"")}};FBe=I([m(1,ee),m(2,nt),m(3,rt)],FBe);var Kjt=_,lOi="debug.repl.history",cOi="debug.repl.filterHistory",dOi="debug.repl.filterValue",Sko="replinputdecoration";function WBe(a){a.scrollTop=a.scrollHeight-a.renderHeight}var VBe=new Set,Iko={getId:a=>a.getId()},TU=class extends o0{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k){let T=n.get(dOi,1,"");super({...e,filterOptions:{placeholder:d(9754,null),text:T,history:JSON.parse(n.get(cOi,1,"[]"))}},v,p,h,l,u,o,b,r,S);this.debugService=t;this.storageService=n;this.modelService=s;this.configurationService=h;this.textResourcePropertiesService=g;this.editorService=f;this.keybindingService=v;this.languageFeaturesService=w;this.logService=k;this.previousTreeScrollHeight=0;this.styleChangedWhenInvisible=!1;this.modelChangeListener=x.None;this.findIsOpen=!1;this.menu=y.createMenu(D.DebugConsoleContext,l),this._register(this.menu),this.history=this._register(new BY(new Set(JSON.parse(this.storageService.get(lOi,1,"[]"))),100)),this.filter=new Bjt,this.filter.filterQuery=T,this.multiSessionRepl=Ghi.bindTo(l),this.replOptions=this._register(this.instantiationService.createInstance(p6,this.id,()=>this.getLocationBasedColors().background)),this._register(this.replOptions.onDidChange(()=>this.onDidStyleChange())),this._register(c.registerDecorationType("repl-decoration",Sko,{})),this.multiSessionRepl.set(this.isMultiSessionView),this.registerListeners()}static{this.REFRESH_DELAY=50}static{this.URI=A.parse(`${KC}:replinput`)}registerListeners(){this.debugService.getViewModel().focusedSession&&this.onDidFocusSession(this.debugService.getViewModel().focusedSession),this._register(this.debugService.getViewModel().onDidFocusSession(e=>{this.onDidFocusSession(e)})),this._register(this.debugService.getViewModel().onDidEvaluateLazyExpression(async e=>{e instanceof $l&&this.tree?.hasNode(e)&&(await this.tree.updateChildren(e,!1,!0),await this.tree.expand(e))})),this._register(this.debugService.onWillNewSession(async e=>{let t=this.tree?.getInput();(!t||t.state===0)&&await this.selectSession(e),this.multiSessionRepl.set(this.isMultiSessionView)})),this._register(this.debugService.onDidEndSession(async()=>{await Promise.resolve(),this.multiSessionRepl.set(this.isMultiSessionView)})),this._register(this.themeService.onDidColorThemeChange(()=>{this.refreshReplElements(!1),this.isVisible()&&this.updateInputDecoration()})),this._register(this.onDidChangeBodyVisibility(e=>{if(!e)return;this.model||(this.model=this.modelService.getModel(TU.URI)||this.modelService.createModel("",null,TU.URI,!0));let t=this.debugService.getViewModel().focusedSession;this.tree&&this.tree.getInput()!==t&&this.onDidFocusSession(t),this.setMode(),this.replInput.setModel(this.model),this.updateInputDecoration(),this.refreshReplElements(!0),this.styleChangedWhenInvisible&&(this.styleChangedWhenInvisible=!1,this.tree?.updateChildren(void 0,!0,!1),this.onDidStyleChange())})),this._register(this.configurationService.onDidChangeConfiguration(e=>{if(e.affectsConfiguration("debug.console.wordWrap")&&this.tree&&(this.tree.dispose(),this.treeContainer.innerText="",Rt(this.treeContainer),this.createReplTree()),e.affectsConfiguration("debug.console.acceptSuggestionOnEnter")){let t=this.configurationService.getValue("debug");this.replInput.updateOptions({acceptSuggestionOnEnter:t.console.acceptSuggestionOnEnter==="on"?"on":"off"})}})),this._register(this.editorService.onDidActiveEditorChange(()=>{this.setMode()})),this._register(this.filterWidget.onDidChangeFilterText(()=>{this.filter.filterQuery=this.filterWidget.getFilterText(),this.tree&&(this.tree.refilter(),WBe(this.tree))}))}async onDidFocusSession(e){e&&(VBe.delete(e),this.completionItemProvider?.dispose(),e.capabilities.supportsCompletionsRequest&&(this.completionItemProvider=this.languageFeaturesService.completionProvider.register({scheme:KC,pattern:"**/replinput",hasAccessToAllModels:!0},{_debugDisplayName:"debugConsole",triggerCharacters:e.capabilities.completionTriggerCharacters||["."],provideCompletionItems:async(t,o,n,r)=>{this.setHistoryNavigationEnablement(!1);let s=this.replInput.getModel();if(s){let l=s.getValue(),c=this.debugService.getViewModel().focusedStackFrame,u=c?c.frameId:void 0,p=await e.completions(u,c?.thread.threadId||0,l,o,r),h=[],g=f=>z.fromPositions(o.delta(0,-f),o);if(p&&p.body&&p.body.targets&&p.body.targets.forEach(f=>{if(f&&f.label){let v,b=f.text||f.label;if(typeof f.selectionStart=="number"){v=4;let S=typeof f.selectionLength=="number"?f.selectionLength:0,y=S>0?"${1:"+b.substring(f.selectionStart,f.selectionStart+S)+"}$0":"$0";b=b.substring(0,f.selectionStart)+y+b.substring(f.selectionStart+S)}h.push({label:f.label,insertText:b,detail:f.detail,kind:A1.fromString(f.type||"property"),filterText:f.start&&f.length?l.substring(f.start,f.start+f.length).concat(f.label):void 0,range:g(f.length||0),sortText:f.sortText,insertTextRules:v})}}),this.configurationService.getValue("debug").console.historySuggestions){let f=this.history.getHistory(),v=String(f.length).length;f.forEach((b,S)=>h.push({label:b,insertText:b,kind:18,range:g(b.length),sortText:"ZZZ"+String(f.length-S).padStart(v,"0")}))}return{suggestions:h}}return Promise.resolve({suggestions:[]})}}))),await this.selectSession()}getFilterStats(){return{total:this.tree?.getNode().children.length??0,filtered:this.tree?.getNode().children.filter(e=>e.visible).length??0}}get isReadonly(){let e=this.tree?.getInput();return!(e&&e.state!==0)}showPreviousValue(){this.isReadonly||this.navigateHistory(!0)}showNextValue(){this.isReadonly||this.navigateHistory(!1)}focusFilter(){this.filterWidget.focus()}openFind(){this.tree?.openFind()}setMode(){if(!this.isVisible())return;let e=this.editorService.activeTextEditorControl;pn(e)&&(this.modelChangeListener.dispose(),this.modelChangeListener=e.onDidChangeModelLanguage(()=>this.setMode()),this.model&&e.hasModel()&&this.model.setLanguage(e.getModel().getLanguageId()))}onDidStyleChange(){if(!this.isVisible()){this.styleChangedWhenInvisible=!0;return}if(this.styleElement){this.replInput.updateOptions({fontSize:this.replOptions.replConfiguration.fontSize,lineHeight:this.replOptions.replConfiguration.lineHeight,fontFamily:this.replOptions.replConfiguration.fontFamily==="default"?fu.fontFamily:this.replOptions.replConfiguration.fontFamily});let e=this.replInput.getOption(75);this.styleElement.textContent=`
				.repl .repl-input-wrapper .repl-input-chevron {
					line-height: ${e}px
				}

				.repl .repl-input-wrapper .monaco-editor .lines-content {
					background-color: ${this.replOptions.replConfiguration.backgroundColor};
				}
			`;let t=this.replOptions.replConfiguration.fontFamily==="default"?"var(--monaco-monospace-font)":this.replOptions.replConfiguration.fontFamily;this.container.style.setProperty("--vscode-repl-font-family",t),this.container.style.setProperty("--vscode-repl-font-size",`${this.replOptions.replConfiguration.fontSize}px`),this.container.style.setProperty("--vscode-repl-font-size-for-twistie",`${this.replOptions.replConfiguration.fontSizeForTwistie}px`),this.container.style.setProperty("--vscode-repl-line-height",this.replOptions.replConfiguration.cssLineHeight),this.tree?.rerender(),this.bodyContentDimension&&this.layoutBodyContent(this.bodyContentDimension.height,this.bodyContentDimension.width)}}navigateHistory(e){let t=(e?this.history.previous()??this.history.first():this.history.next())??"";this.replInput.setValue(t),qr(t),this.replInput.setPosition({lineNumber:1,column:t.length+1}),this.setHistoryNavigationEnablement(!0)}async selectSession(e){let t=this.tree?.getInput();if(!e){let o=this.debugService.getViewModel().focusedSession;o?e=o:(!t||VBe.has(t))&&(e=this.debugService.getModel().getSessions(!0).find(n=>!VBe.has(n)))}if(e&&(this.replElementsChangeListener?.dispose(),this.replElementsChangeListener=e.onDidChangeReplElements(()=>{this.refreshReplElements(e.getReplElements().length===0)}),this.tree&&t!==e)){try{await this.tree.setInput(e)}catch(o){this.logService.error(o)}WBe(this.tree)}this.replInput?.updateOptions({readOnly:this.isReadonly}),this.updateInputDecoration()}async clearRepl(){let e=this.tree?.getInput();e&&(e.removeReplExpressions(),e.state===0&&(VBe.add(e),await this.selectSession(),this.multiSessionRepl.set(this.isMultiSessionView))),this.replInput.focus()}acceptReplInput(){let e=this.tree?.getInput();e&&!this.isReadonly&&(e.addReplExpression(this.debugService.getViewModel().focusedStackFrame,this.replInput.getValue()),WBe(this.tree),this.history.add(this.replInput.getValue()),this.replInput.setValue(""),this.bodyContentDimension&&this.layoutBodyContent(this.bodyContentDimension.height,this.bodyContentDimension.width))}sendReplInput(e){let t=this.tree?.getInput();t&&!this.isReadonly&&(t.addReplExpression(this.debugService.getViewModel().focusedStackFrame,e),WBe(this.tree),this.history.add(e))}getVisibleContent(){let e="";if(this.model&&this.tree){let t=this.textResourcePropertiesService.getEOL(this.model.uri),o=n=>{n.children.forEach(r=>{r.visible&&(e+=r.element.toString().trimRight()+t,!r.collapsed&&r.children.length&&o(r))})};o(this.tree.getNode())}return zS(e)}layoutBodyContent(e,t){this.bodyContentDimension=new si(t,e);let o=Math.min(this.replInput.getContentHeight(),e);if(this.tree){let n=this.tree.scrollTop+this.tree.renderHeight>=this.tree.scrollHeight,r=e-o;this.tree.getHTMLElement().style.height=`${r}px`,this.tree.layout(r,t),n&&WBe(this.tree)}this.replInputContainer.style.height=`${o}px`,this.replInput.layout({width:t-30,height:o})}collapseAll(){this.tree?.collapseAll()}getDebugSession(){return this.tree?.getInput()}getReplInput(){return this.replInput}getReplDataSource(){return this.replDataSource}getFocusedElement(){return this.tree?.getFocus()?.[0]}focusTree(){this.tree?.domFocus()}async focus(){super.focus(),await Li(0),this.replInput.focus()}createActionViewItem(e){if(e.id===yko){let t=(this.tree?this.tree.getInput():void 0)??this.debugService.getViewModel().focusedSession;return this.instantiationService.createInstance(gOi,e,t)}return super.createActionViewItem(e)}get isMultiSessionView(){return this.debugService.getModel().getSessions(!0).filter(e=>e.hasSeparateRepl()&&!VBe.has(e)).length>1}get refreshScheduler(){let e=new Set;return new Dt(async()=>{if(!this.tree||!this.tree.getInput()||!this.isVisible())return;await this.tree.updateChildren(void 0,!0,!1,{diffIdentityProvider:Iko});let t=this.tree.getInput();if(t){let r=async s=>{for(let l of s)l instanceof UG&&(l.autoExpand&&!e.has(l.getId())&&(e.add(l.getId()),await this.tree.expand(l)),this.tree.isCollapsed(l)||await r(l.getChildren()))};await r(t.getReplElements())}let{total:o,filtered:n}=this.getFilterStats();this.filterWidget.updateBadge(o===n||o===0?void 0:d(9752,null,n,o))},TU.REFRESH_DELAY)}render(){super.render(),this._register(bT({name:"repl",focusNotifiers:[this,this.filterWidget],focusNextWidget:()=>{let e=this.tree?.getHTMLElement();this.filterWidget.hasFocus()?this.tree?.domFocus():e&&wa(e)&&this.focus()},focusPreviousWidget:()=>{let e=this.tree?.getHTMLElement();this.replInput.hasTextFocus()?this.tree?.domFocus():e&&wa(e)&&this.focusFilter()}}))}renderBody(e){super.renderBody(e),this.container=M(e,Kjt(".repl")),this.treeContainer=M(this.container,Kjt(`.repl-tree.${kE}`)),this.createReplInput(this.container),this.createReplTree()}createReplTree(){this.replDelegate=new Hjt(this.configurationService,this.replOptions);let e=this.configurationService.getValue("debug").console.wordWrap;this.treeContainer.classList.toggle("word-wrap",e);let t=this.instantiationService.createInstance(RM);this.replDataSource=new Ujt;let o=this.tree=this.instantiationService.createInstance(rp,"DebugRepl",this.treeContainer,this.replDelegate,[this.instantiationService.createInstance(u6,t),this.instantiationService.createInstance(d6,t),new nat,this.instantiationService.createInstance(c6,t),new rat(t),new sat(t)],this.replDataSource,{filter:this.filter,accessibilityProvider:new zjt,identityProvider:Iko,userSelection:!0,mouseSupport:!1,findWidgetEnabled:!0,keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:r=>r.toString(!0)},horizontalScrolling:!e,setRowLineHeight:!1,supportDynamicHeights:e,overrideStyles:this.getLocationBasedColors().listOverrideStyles});this._register(o.onDidChangeContentHeight(()=>{o.scrollHeight!==this.previousTreeScrollHeight&&o.scrollTop+o.renderHeight>=this.previousTreeScrollHeight-2&&setTimeout(()=>{WBe(o)},0),this.previousTreeScrollHeight=o.scrollHeight})),this._register(o.onContextMenu(r=>this.onContextMenu(r))),this._register(o.onDidChangeFindOpenState(r=>this.findIsOpen=r));let n;this._register(o.onMouseClick(()=>{if(this.findIsOpen)return;let r=Re(this.treeContainer).getSelection();(!r||r.type!=="Range"||n===r.toString())&&this.replInput.focus(),n=r?r.toString():""})),this.selectSession(),this.styleElement=Cr(this.container,void 0,this._store),this.onDidStyleChange()}createReplInput(e){this.replInputContainer=M(e,Kjt(".repl-input-wrapper")),M(this.replInputContainer,Kjt(".repl-input-chevron"+q.asCSSSelector(yho)));let{historyNavigationBackwardsEnablement:t,historyNavigationForwardsEnablement:o}=this._register(XV(this.scopedContextKeyService,this));this.setHistoryNavigationEnablement=l=>{t.set(l),o.set(l)},GF.bindTo(this.scopedContextKeyService).set(!0),this.scopedInstantiationService=this._register(this.instantiationService.createChild(new _o([X,this.scopedContextKeyService])));let n=Vb(this.configurationService);n.readOnly=!0,n.suggest={showStatusBar:!0};let r=this.configurationService.getValue("debug");n.acceptSuggestionOnEnter=r.console.acceptSuggestionOnEnter==="on"?"on":"off",n.ariaLabel=this.getAriaLabel(),this.replInput=this.scopedInstantiationService.createInstance(Xr,this.replInputContainer,n,BMe());let s=-1;this._register(this.replInput.onDidChangeModelContent(()=>{let l=this.replInput.getModel();this.setHistoryNavigationEnablement(!!l&&l.getValue()==="");let c=this.replInput.getContentHeight();c!==s&&(s=c,this.bodyContentDimension&&this.layoutBodyContent(this.bodyContentDimension.height,this.bodyContentDimension.width))})),this._register(this.replInput.onDidFocusEditorText(()=>this.updateInputDecoration())),this._register(this.replInput.onDidBlurEditorText(()=>this.updateInputDecoration())),this._register(Jo(this.replInputContainer,re.FOCUS,()=>this.replInputContainer.classList.add("synthetic-focus"))),this._register(Jo(this.replInputContainer,re.BLUR,()=>this.replInputContainer.classList.remove("synthetic-focus")))}getAriaLabel(){let e=d(9746,null);if(!this.configurationService.getValue("accessibility.verbosity.debug"))return e;let t=this.keybindingService.lookupKeybinding("editor.action.accessibilityHelp")?.getAriaLabel();return t?e=d(9742,null,e,t):e=d(9743,null,e),e}onContextMenu(e){let t=tu(this.menu.getActions({arg:e.element,shouldForwardArgs:!1}));this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>t,getActionsContext:()=>e.element})}refreshReplElements(e){if(this.tree&&this.isVisible()){if(this.refreshScheduler.isScheduled())return;this.refreshScheduler.schedule(e?0:void 0)}}updateInputDecoration(){if(!this.replInput)return;let e=[];if(this.isReadonly&&this.replInput.hasTextFocus()&&!this.replInput.getValue()){let t=k_(Id,this.themeService.getColorTheme())?.transparent(.4);e.push({range:{startLineNumber:0,endLineNumber:0,startColumn:0,endColumn:1},renderOptions:{after:{contentText:d(9753,null),color:t?t.toString():void 0}}})}this.replInput.setDecorationsByType("repl-decoration",Sko,e)}saveState(){let e=this.history.getHistory();e.length?this.storageService.store(lOi,JSON.stringify(e),1,1):this.storageService.remove(lOi,1);let t=this.filterWidget.getHistory();t.length?this.storageService.store(cOi,JSON.stringify(t),1,1):this.storageService.remove(cOi,1);let o=this.filterWidget.getFilterText();o?this.storageService.store(dOi,o,1,1):this.storageService.remove(dOi,1),super.saveState()}dispose(){this.replInput?.dispose(),this.replElementsChangeListener?.dispose(),this.refreshScheduler.dispose(),this.modelChangeListener.dispose(),super.dispose()}};I([hi],TU.prototype,"refreshScheduler",1),TU=I([m(1,Ni),m(2,F),m(3,ce),m(4,Le),m(5,Tt),m(6,X),m(7,qt),m(8,Bi),m(9,Xe),m(10,B),m(11,KL),m(12,ee),m(13,_e),m(14,Je),m(15,nt),m(16,Kt),m(17,Qt),m(18,se)],TU);var p6=class extends x{constructor(e,t,o,n,r){super();this.backgroundColorDelegate=t;this.configurationService=o;this.themeService=n;this.viewDescriptorService=r;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._register(this.themeService.onDidColorThemeChange(s=>this.update())),this._register(this.viewDescriptorService.onDidChangeLocation(s=>{s.views.some(l=>l.id===e)&&this.update()})),this._register(this.configurationService.onDidChangeConfiguration(s=>{(s.affectsConfiguration("debug.console.lineHeight")||s.affectsConfiguration("debug.console.fontSize")||s.affectsConfiguration("debug.console.fontFamily"))&&this.update()})),this.update()}static{this.lineHeightEm=1.4}get replConfiguration(){return this._replConfig}update(){let e=this.configurationService.getValue("debug").console;this._replConfig={fontSize:e.fontSize,fontFamily:e.fontFamily,lineHeight:e.lineHeight?e.lineHeight:p6.lineHeightEm*e.fontSize,cssLineHeight:e.lineHeight?`${e.lineHeight}px`:`${p6.lineHeightEm}em`,backgroundColor:this.themeService.getColorTheme().getColor(this.backgroundColorDelegate()),fontSizeForTwistie:e.fontSize*p6.lineHeightEm/2-8},this._onDidChange.fire()}};p6=I([m(2,B),m(3,Le),m(4,Bi)],p6);var uOi=class extends Di{constructor(){super({id:"repl.action.acceptInput",label:L(9737,"Debug Console: Accept Input"),precondition:GF,kbOpts:{kbExpr:pe.textInputFocus,primary:3,weight:100}})}run(i,e){nc.get(e)?.cancelSuggestWidget(),lne(i.get($t))?.acceptReplInput()}},pOi=class extends Yn{constructor(){super({viewId:Td,id:"repl.action.filter",title:d(9749,null),precondition:GF,keybinding:[{when:pe.textInputFocus,primary:2084,weight:100}]})}runInView(i,e){e.focusFilter()}},mOi=class extends Yn{constructor(){super({viewId:Td,id:"repl.action.find",title:d(9750,null),precondition:GF,keybinding:[{when:C.or(GF,C.equals("focusedView","workbench.panel.repl.view")),primary:2596,weight:100}],icon:R.search,menu:[{id:D.ViewTitle,group:"navigation",when:C.equals("view",Td),order:15},{id:D.DebugConsoleContext,group:"z_commands",order:25}]})}runInView(i,e){e.openFind()}},hOi=class extends Di{constructor(){super({id:"repl.action.copyAll",label:d(9738,null),alias:"Debug Console Copy All",precondition:GF})}run(i,e){let t=i.get(Fi),o=lne(i.get($t));if(o)return t.writeText(o.getVisibleContent())}};ni(uOi);ni(hOi);W(pOi);W(mOi);var gOi=class extends Dq{getSessions(){return this.debugService.getModel().getSessions(!0).filter(i=>i.hasSeparateRepl()&&!VBe.has(i))}mapFocusedSessionToSelected(i){for(;i.parentSession&&!i.hasSeparateRepl();)i=i.parentSession;return i}};function lne(a){return a.getActiveViewWithId(Td)??void 0}var yko="workbench.action.debug.selectRepl";W(class extends Yn{constructor(){super({id:yko,viewId:Td,title:d(9751,null),f1:!1,menu:{id:D.ViewTitle,group:"navigation",when:C.and(C.equals("view",Td),Ghi),order:20}})}async runInView(a,i,e){let t=a.get(Ni);e&&e.state!==0&&e!==t.getViewModel().focusedSession&&(e=mRt(e,t.getModel().getSessions()),await t.focusStackFrame(void 0,void 0,e,{explicit:!0})),await i.selectSession(e)}});W(class extends Yn{constructor(){super({id:"workbench.debug.panel.action.clearReplAction",viewId:Td,title:L(9739,"Clear Console"),metadata:{description:L(9740,"Clears all program output from your debug REPL")},f1:!0,icon:pho,menu:[{id:D.ViewTitle,group:"navigation",when:C.equals("view",Td),order:30},{id:D.DebugConsoleContext,group:"z_commands",order:20}],keybinding:[{primary:0,mac:{primary:2089},weight:201,when:C.equals("focusedView","workbench.panel.repl.view")}]})}runInView(a,i){let e=a.get(lr);i.clearRepl(),e.playSignal($o.clear)}});W(class extends Yn{constructor(){super({id:"debug.collapseRepl",title:d(9741,null),viewId:Td,menu:{id:D.DebugConsoleContext,group:"z_commands",order:10}})}runInView(a,i){i.collapseAll(),i.focus()}});W(class extends Yn{constructor(){super({id:"debug.replPaste",title:d(9748,null),viewId:Td,precondition:Zs.notEqualsTo(KR(0)),menu:{id:D.DebugConsoleContext,group:"2_cutcopypaste",order:30}})}async runInView(a,i){let t=await a.get(Fi).readText();if(t){let o=i.getReplInput();o.setValue(o.getValue().concat(t)),i.focus();let n=o.getModel(),r=n?n.getLineCount():0,s=n?.getLineMaxColumn(r);typeof r=="number"&&typeof s=="number"&&o.setPosition({lineNumber:r,column:s})}}});W(class extends Yn{constructor(){super({id:"workbench.debug.action.copyAll",title:d(9745,null),viewId:Td,menu:{id:D.DebugConsoleContext,group:"2_cutcopypaste",order:20}})}async runInView(a,i){await a.get(Fi).writeText(i.getVisibleContent())}});W(class extends K{constructor(){super({id:"debug.replCopy",title:d(9744,null),menu:{id:D.DebugConsoleContext,group:"2_cutcopypaste",order:10}})}async run(a,i){let e=a.get(Fi),t=a.get(Ni),n=Ki().getSelection()?.toString();if(n&&n.length>0)return e.writeText(n);if(i){let s=await this.tryEvaluateAndCopy(t,i)||zS(i.toString());return e.writeText(s)}}async tryEvaluateAndCopy(a,i){if(!(i instanceof mN))return;let e=a.getViewModel().focusedStackFrame,t=a.getViewModel().focusedSession;if(!(!e||!t||!t.capabilities.supportsClipboardContext))try{return(await t.evaluate(i.originalExpression,e.frameId,"clipboard"))?.body.result}catch{return}}});W(class extends K{constructor(){super({id:Jbo,category:Gie,title:L(9747,"Focus on Debug Console View")})}async run(a){await(await a.get($t).openView(Td))?.focus()}});var Gjt=class{constructor(){this.priority=100;this.name="replEditorInput";this.type="view";this.when=C.and(AS,pp.negate())}getProvider(i){let e=i.get(ee);return hun(e)}};function hun(a){let i=a.activeEditorPane?.getControl();if(i&&oE(i)&&i.notebookEditor){let e=i.notebookEditor,t=e?.getViewModel();if(e&&t){let o=t.length-1;if(o>=0){let n=t.viewCells[o],r=FPe(t.notebookDocument,n);if(r)return new xp("notebook",{type:"view"},()=>r,()=>{i.activeCodeEditor?.focus()},"accessibility.verbosity.replEditor")}}}}var qjt=class{constructor(){this.priority=105;this.name="REPL Editor Input";this.when=C.and(AS,pp.negate());this.type="help"}getProvider(i){return wko(i.get(qt),gun())}};function gun(){return[d(13594,null),d(13586,null,"<keybinding:repl.execute>"),d(13585,null),d(13583,null),d(13589,null,"<keybinding:repl.focusLastItemExecuted>"),d(13593,null,"<keybinding:editor.action.accessibleView>"),d(13590,null,"<keybinding:repl.input.focus>")].join(`
`)}var $jt=class{constructor(){this.priority=105;this.name="REPL Editor History";this.when=C.and(AS,pp);this.type="help"}getProvider(i){return wko(i.get(qt),fun())}};function fun(){return[d(13592,null),d(13587,null,"<keybinding:notebook.cell.edit>"),d(13584,null,"<keybinding:notebook.cell.quitEdit>"),d(13582,null,"<keybinding:editor.action.accessibleView>"),d(13588,null,"<keybinding:notebook.cell.focusInOutput>"),d(13591,null,"<keybinding:repl.input.focus>"),d(13589,null,"<keybinding:repl.focusLastItemExecuted>")].join(`
`)}function wko(a,i){let e=a.getActiveCodeEditor()||a.getFocusedCodeEditor();if(e)return new xp("replEditor",{type:"help"},()=>i,()=>e.focus(),"accessibility.verbosity.replEditor")}var fOi=class{canSerialize(i){return i.typeId===Vy.ID}serialize(i){wo(i instanceof Vy);let e={resource:i.resource,preferredResource:i.preferredResource,viewType:i.viewType,options:i.options,label:i.getName()};return JSON.stringify(e)}deserialize(i,e){let t=am(e);if(!t)return;let{resource:o,viewType:n}=t;return!t||!A.isUri(o)||typeof n!="string"?void 0:i.createInstance(Vy,o,t.label)}};ne.as(qo.EditorPane).registerEditorPane(Br.create(MBe,iEe,"REPL Editor"),[new Ft(Vy)]);ne.as(qo.EditorFactory).registerEditorSerializer(Vy.ID,fOi);var BBe=class extends x{constructor(e,t,o,n,r){super();this.notebookEditorModelResolverService=o;this.instantiationService=n;this.configurationService=r;this.editorInputCache=new gt;t.registerEditor(" ",{id:"repl",label:"repl Editor",priority:"option"},{canSupportResource:s=>e.getNotebookTextModel(s)!==void 0,singlePerResource:!0},{createUntitledEditorInput:async({resource:s,options:l})=>{if(s){let f=this.editorInputCache.get(s);if(f&&!f.isDisposed())return{editor:f,options:l};f&&this.editorInputCache.delete(s)}let c=this.configurationService.getValue(yt.InteractiveWindowPromptToSave)!==!0,u=await this.notebookEditorModelResolverService.resolve({untitledResource:s},"jupyter-notebook",{scratchpad:c,viewType:"repl"}),p=u.object.notebook.uri;U.once(u.object.notebook.onWillDispose)(()=>{u.dispose()});let h=l?.label??void 0,g=this.instantiationService.createInstance(Vy,p,h);return this.editorInputCache.set(p,g),U.once(g.onWillDispose)(()=>this.editorInputCache.delete(p)),{editor:g,options:l}},createEditorInput:async({resource:s,options:l})=>{if(this.editorInputCache.has(s))return{editor:this.editorInputCache.get(s),options:l};let c=l?.label??void 0,u=this.instantiationService.createInstance(Vy,s,c);return this.editorInputCache.set(s,u),U.once(u.onWillDispose)(()=>this.editorInputCache.delete(s)),{editor:u,options:l}}})}static{this.ID="workbench.contrib.replDocument"}};BBe=I([m(0,bn),m(1,Ka),m(2,yh),m(3,F),m(4,B)],BBe);var HBe=class extends x{constructor(e,t,o,n){super();this.instantiationService=e;this.workingCopyEditorService=t;this.extensionService=o;this.notebookService=n;this._installHandler()}static{this.ID="workbench.contrib.replWorkingCopyEditorHandler"}async handles(e){let t=this._getNotebookType(e);return t?!!t&&t.viewType==="repl"&&await this.notebookService.canResolve(t.notebookType):!1}isOpen(e,t){return this.handles(e)?t instanceof Vy&&Qe(e.resource,t.resource):!1}createEditor(e){return this.instantiationService.createInstance(Vy,e.resource,void 0)}async _installHandler(){await this.extensionService.whenInstalledExtensionsRegistered(),this._register(this.workingCopyEditorService.registerHandler(this))}_getNotebookType(e){return yF.parse(e.typeId)}};HBe=I([m(0,F),m(1,iv),m(2,lt),m(3,bn)],HBe);It(HBe.ID,HBe,St.BlockRestore);It(BBe.ID,BBe,St.BlockRestore);ga.register(new qjt);ga.register(new $jt);W(class extends K{constructor(){super({id:"repl.focusLastItemExecuted",title:L(13579,"Focus Most Recent REPL Execution"),category:"REPL",menu:{id:D.CommandPalette,when:a8},keybinding:[{primary:Vi(525,525),weight:Df,when:C.or(AS,pp.negate())}],precondition:a8})}async run(a,i){let e=a.get(ee),t=e.activeEditorPane?.getControl(),o=a.get(X),n;if(t&&oE(t))n=t.notebookEditor;else{let s=a8.getValue(o),l=s?A.parse(s):void 0;if(!l)return;let c=e.findEditors(l)[0];if(c){let p=(await e.openEditor(c.editor,c.groupId))?.getControl();p&&oE(p)&&(n=p.notebookEditor)}}let r=n?.getViewModel();if(n&&r){let s=r.length-1;if(s>=0){let l=r.viewCells[s];n.focusNotebookCell(l,"container")}}}});W(class extends K{constructor(){super({id:"repl.input.focus",title:L(13580,"Focus Input Editor"),category:"REPL",menu:{id:D.CommandPalette,when:a8},keybinding:[{when:C.and(AS,pr),weight:Df,primary:2066},{when:C.and(a8),weight:205,primary:Vi(526,526)}]})}async run(a){let i=a.get(ee),e=i.activeEditorPane?.getControl(),t=a.get(X);if(e&&oE(e)&&e.notebookEditor)i.activeEditorPane?.focus();else{let o=a8.getValue(t),n=o?A.parse(o):void 0;if(!n)return;let r=i.findEditors(n)[0];r&&await i.openEditor({resource:n,options:{preserveFocus:!1}},r.groupId)}}});W(class extends K{constructor(){super({id:"repl.execute",title:L(13578,"Execute REPL input"),category:"REPL",keybinding:[{when:C.and(AS,C.equals("activeEditor","workbench.editor.repl"),pp.negate()),primary:2051,weight:Df},{when:C.and(AS,C.equals("activeEditor","workbench.editor.repl"),C.equals("config.interactiveWindow.executeWithShiftEnter",!0),pp.negate()),primary:1027,weight:Df},{when:C.and(AS,C.equals("activeEditor","workbench.editor.repl"),C.equals("config.interactiveWindow.executeWithShiftEnter",!1),pp.negate()),primary:3,weight:Df}],menu:[{id:D.ReplInputExecute}],icon:hG,f1:!1,metadata:{description:"Execute the Contents of the Input Box",args:[{name:"resource",description:"Interactive resource Uri",isOptional:!0}]}})}async run(a,i){let e=a.get(ee),t=a.get(La),o=a.get(QF),n=a.get(Gc),r;if(i){let s=A.revive(i),l=e.findEditors(s);for(let c of l)if(c.editor.typeId===Vy.ID){r=(await e.openEditor(c.editor,c.groupId))?.getControl();break}}else r=e.activeEditorPane?.getControl();oE(r)&&vun(t,o,n,r)}});async function vun(a,i,e,t){if(t&&t.notebookEditor&&t.activeCodeEditor){let o=t.notebookEditor.textModel,n=t.activeCodeEditor.getModel(),s=t.notebookEditor.activeKernel?.supportedLanguages[0]??$r;if(o&&n){let l=o.length-1,c=n.getValue();if(uc(c))return;let u=Nd.get(t.activeCodeEditor);u&&u.acceptSession(),i.replaceLast(o.uri,c),i.addToHistory(o.uri,""),n.setValue(""),o.cells[l].resetTextBuffer(n.getTextBuffer());let p=t.notebookEditor.notebookOptions.getDisplayOptions().interactiveWindowCollapseCodeCells==="fromEditor"?{inputCollapsed:!1,outputCollapsed:!1}:void 0;await a.apply([new Mv(o.uri,{editType:1,index:l,count:0,cells:[{cellKind:2,mime:void 0,language:s,source:c,outputs:[],metadata:{},collapseState:p}]})]);let h={start:l,end:l+1};t.notebookEditor.revealCellRangeInView(h),await t.notebookEditor.executeNotebookCells(t.notebookEditor.getCellsInRange({start:l,end:l+1}));let g=e.getNotebookEditor(t.notebookEditor.getId());g&&(g.setSelections([h]),g.setFocus(h))}}}ga.register(new Gjt);Ct.registerCommandAndKeybindingRule({id:"list.find.replInputFocus",weight:201,when:C.equals("view",Td),primary:2596,secondary:[61],handler:a=>{lne(a.get($t))?.openFind()}});var Cko={id:"testing",order:21,title:d(16012,null),type:"object",properties:{"testing.automaticallyOpenPeekView":{description:d(16014,null),enum:["failureAnywhere","failureInVisibleDocument","never"],default:"never",enumDescriptions:[d(16015,null),d(16016,null),d(16017,null)]},"testing.showAllMessages":{description:d(16046,null),type:"boolean",default:!1},"testing.automaticallyOpenPeekViewDuringAutoRun":{description:d(16018,null),type:"boolean",default:!1},"testing.countBadge":{description:d(16019,null),enum:["failed","off","passed","skipped"],enumDescriptions:[d(16020,null),d(16021,null),d(16022,null),d(16023,null)],default:"failed"},"testing.followRunningTest":{description:d(16035,null),type:"boolean",default:!1},"testing.defaultGutterClickAction":{description:d(16026,null),enum:["run","debug","runWithCoverage","contextMenu"],enumDescriptions:[d(16030,null),d(16029,null),d(16028,null),d(16027,null)],default:"run"},"testing.gutterEnabled":{description:d(16036,null),type:"boolean",default:!0},"testing.saveBeforeTest":{description:d(16045,null),type:"boolean",default:!0},"testing.automaticallyOpenTestResults":{enum:["neverOpen","openOnTestStart","openOnTestFailure","openExplorerOnTestStart"],enumDescriptions:[d(16038,null),d(16041,null),d(16040,null),d(16039,null)],default:"openOnTestStart",description:d(16037,null)},"testing.alwaysRevealTestOnStateChange":{markdownDescription:d(16013,null,"`#testing.followRunningTest#`"),type:"boolean",default:!1},"testing.showCoverageInExplorer":{description:d(16047,null),type:"boolean",default:!0},"testing.displayedCoveragePercent":{markdownDescription:d(16031,null),default:"totalCoverage",enum:["totalCoverage","statement","minimum"],enumDescriptions:[d(16034,null),d(16033,null),d(16032,null)]},"testing.coverageBarThresholds":{markdownDescription:d(16024,null),default:{red:0,yellow:60,green:90},properties:{red:{type:"number",minimum:0,maximum:100,default:0},yellow:{type:"number",minimum:0,maximum:100,default:60},green:{type:"number",minimum:0,maximum:100,default:90}}},"testing.coverageToolbarEnabled":{description:d(16025,null),type:"boolean",default:!1},"testing.resultsView.layout":{description:d(16042,null),enum:["treeRight","treeLeft"],enumDescriptions:[d(16044,null),d(16043,null)],default:"treeRight"}}};ne.as(Ep.ConfigurationMigration).registerConfigurationMigrations([{key:"testing.openTesting",migrateFn:a=>[["testing.automaticallyOpenTestResults",{value:a}]]},{key:"testing.automaticallyOpenResults",migrateFn:a=>[["testing.automaticallyOpenTestResults",{value:a}]]}]);var em=(a,i)=>a.getValue(i),xko=(a,i)=>ui(a.onDidChangeConfiguration,()=>em(a,i));var oC=le("testCoverageService"),UBe=class extends x{constructor(e,t,o,n){super();this.viewsService=n;this.lastOpenCts=this._register(new me);this.selected=Me("testCoverage",void 0);this.filterToTest=Me("filterToTest",void 0);this.showInline=Me("inlineCoverage",!1);let r=hr("testing.coverageToolbarEnabled",!0,o);this._register(Vd(oo.coverageToolbarEnabled,e,s=>r.read(s))),this._register(Vd(oo.inlineCoverageEnabled,e,s=>this.showInline.read(s))),this._register(Vd(oo.isTestCoverageOpen,e,s=>!!this.selected.read(s))),this._register(Vd(oo.hasPerTestCoverage,e,s=>!vt.isEmpty(this.selected.read(s)?.allPerTestIDs()))),this._register(Vd(oo.isCoverageFilteredToTest,e,s=>!!this.filterToTest.read(s))),this._register(t.onResultsChanged(s=>{if("completed"in s){let l=s.completed.tasks.find(c=>c.coverage.get());l?this.openCoverage(l,!1):this.closeCoverage()}else if("removed"in s&&this.selected.get()){let l=this.selected.get()?.fromTaskId;s.removed.some(c=>c.tasks.some(u=>u.id===l))&&this.closeCoverage()}}))}async openCoverage(e,t=!0){this.lastOpenCts.value?.cancel();let o=this.lastOpenCts.value=new Ye,n=e.coverage.get();n&&(Gi(r=>{this.filterToTest.set(void 0,r),this.selected.set(n,r)}),t&&!o.token.isCancellationRequested&&this.viewsService.openView("workbench.view.testCoverage",!0))}closeCoverage(){this.selected.set(void 0,void 0)}};UBe=I([m(0,X),m(1,pd),m(2,B),m(3,$t)],UBe);var kko=a=>({onDidChange:U.None,value:a}),$M=class a extends x{constructor(e){super();this._value=e;this.changeEmitter=this._register(new E);this.onDidChange=this.changeEmitter.event}get value(){return this._value}set value(e){e!==this._value&&(this._value=e,this.changeEmitter.fire(e))}static stored(e,t){let o=new a(e.get(t));return o._register(e),o._register(o.onDidChange(n=>e.store(n))),o}};var UW=le("testingFilterState"),bun=/!?@([^ ,:]+)/g,Sun=a=>a.replace(/\s\s+/g," ").trim(),zBe=class extends x{constructor(e){super();this.focusEmitter=this._register(new E);this.termFilterState={};this.globList=[];this.includeTags=new Set;this.excludeTags=new Set;this.text=this._register(new $M(""));this.reveal=Me("TestExplorerFilterState.reveal",void 0);this.onDidRequestInputFocus=this.focusEmitter.event;this.selectTestInExplorerEmitter=this._register(new E);this.onDidSelectTestInExplorer=this.selectTestInExplorerEmitter.event;this.fuzzy=this._register($M.stored(new _S({key:"testHistoryFuzzy",scope:0,target:0},e),!1))}didSelectTestInExplorer(e){this.selectTestInExplorerEmitter.fire(e)}focusInput(){this.focusEmitter.fire()}setText(e){if(e===this.text.value)return;this.termFilterState={},this.globList=[],this.includeTags.clear(),this.excludeTags.clear();let t="",o=0;for(let n of e.matchAll(bun)){let r=n.index+n[0].length,s=n[0];if(Iun.includes(s)&&(this.termFilterState[s]=!0),e[r]===":"){r++;let l=e[r];l!=='"'&&l!=="'"?l=" ":r++;let c="";for(;r<e.length&&e[r]!==l;)e[r]==="\\"?(c+=e[r+1],r+=2):(c+=e[r],r++);n[0].startsWith("!")?this.excludeTags.add(t_e(n[1],c)):this.includeTags.add(t_e(n[1],c)),r++}t+=e.slice(o,n.index),o=r}if(t+=e.slice(o).trim(),t.length)for(let n of ER(t,",").map(r=>r.trim()).filter(r=>!!r.length))n.startsWith("!")?this.globList.push({include:!1,text:n.slice(1).toLowerCase()}):this.globList.push({include:!0,text:n.toLowerCase()});this.text.value=e}isFilteringFor(e){return!!this.termFilterState[e]}toggleFilteringFor(e,t){let o=this.text.value.trim();t!==!1&&!this.termFilterState[e]?this.setText(o?`${o} ${e}`:e):t!==!0&&this.termFilterState[e]&&this.setText(Sun(o.replace(e,"")))}};zBe=I([m(0,ce)],zBe);var Iun=["@failed","@executed","@doc","@openedFiles","@hidden"];var jjt=class extends TMt{constructor(e,t){super(e);this.expandActual=t;this.testsByUrl=new gt;this.busyProvidersChangeEmitter=new E;this.expandPromises=new WeakMap;this.onBusyProvidersChange=this.busyProvidersChangeEmitter.event;this.changeCollector={add:e=>{if(!e.item.uri)return;let t=this.testsByUrl.get(e.item.uri);t?t.add(e):this.testsByUrl.set(e.item.uri,new Set([e]))},remove:e=>{if(!e.item.uri)return;let t=this.testsByUrl.get(e.item.uri);t&&(t.delete(e),t.size===0&&this.testsByUrl.delete(e.item.uri))}}}get busyProviders(){return this.busyControllerCount}get rootItems(){return this.roots}get all(){return this.getIterator()}get rootIds(){return vt.map(this.roots.values(),e=>e.item.extId)}expand(e,t){let o=this.items.get(e);if(!o)return Promise.resolve();let n=this.expandPromises.get(o);if(n&&n.pendingLvl>=t)return n.prom;let r=this.expandActual(o.item.extId,t),s={doneLvl:n?n.doneLvl:-1,pendingLvl:t,prom:r};return this.expandPromises.set(o,s),r.then(()=>{s.doneLvl=t})}getNodeById(e){return this.items.get(e)}getNodeByUrl(e){return this.testsByUrl.get(e)||vt.empty()}getReviverDiff(){let e=[{op:4,amount:this.pendingRootCount}],t=[this.rootIds];for(;t.length;)for(let o of t.pop()){let n=this.items.get(o);e.push({op:0,item:{controllerId:n.controllerId,expand:n.expand,item:n.item}}),t.push(n.children)}return e}apply(e){let t=this.busyControllerCount;super.apply(e),t!==this.busyControllerCount&&this.busyProvidersChangeEmitter.fire(this.busyControllerCount)}clear(){let e=[];for(let t of this.roots)e.push({op:3,itemId:t.item.extId});return this.roots.clear(),this.items.clear(),e}createItem(e){return{...e,children:new Set}}createChangeCollector(){return this.changeCollector}*getIterator(){let e=new qs;for(e.push(this.rootIds);e.size>0;)for(let t of e.pop()){let o=this.getNodeById(t);yield o,e.push(o.children)}}};var KBe=class extends x{constructor(e){super();this.storageService=e;this.excluded=this._register($M.stored(new _S({key:"excludedTestItems",scope:1,target:1,serialization:{deserialize:t=>new Set(JSON.parse(t)),serialize:t=>JSON.stringify([...t])}},this.storageService),new Set)),this.onTestExclusionsChanged=this.excluded.onDidChange}get hasAny(){return this.excluded.value.size>0}get all(){return this.excluded.value}toggle(e,t){t!==!0&&this.excluded.value.has(e.item.extId)?this.excluded.value=new Set(vt.filter(this.excluded.value,o=>o!==e.item.extId)):t!==!1&&!this.excluded.value.has(e.item.extId)&&(this.excluded.value=new Set([...this.excluded.value,e.item.extId]))}contains(e){return this.excluded.value.has(e.item.extId)}clear(){this.excluded.value=new Set}};KBe=I([m(0,ce)],KBe);var GBe=class extends x{constructor(e,t,o,n,r,s,l,c,u,p){super();this.editorService=r;this.testProfiles=s;this.notificationService=l;this.configurationService=c;this.testResults=u;this.workspaceTrustRequestService=p;this.testControllers=Me("testControllers",new Map);this.testExtHosts=new Set;this.cancelExtensionTestRunEmitter=this._register(new E);this.willProcessDiffEmitter=this._register(new E);this.didProcessDiffEmitter=this._register(new E);this.testRefreshCancellations=new Set;this.uiRunningTests=new Map;this.onWillProcessDiff=this.willProcessDiffEmitter.event;this.onDidProcessDiff=this.didProcessDiffEmitter.event;this.onDidCancelTestRun=this.cancelExtensionTestRunEmitter.event;this.collection=new jjt(o,this.expandTest.bind(this)),this.showInlineOutput=this._register($M.stored(new _S({key:"inlineTestOutputVisible",scope:1,target:0},n),!0)),this.excluded=t.createInstance(KBe),this.isRefreshingTests=oo.isRefreshingTests.bindTo(e),this.activeEditorHasTests=oo.activeEditorHasTests.bindTo(e),this._register(Vd(oo.providerCount,e,g=>this.testControllers.read(g).size));let h=(g,f)=>this._register(Vd(g,e,v=>vt.some(this.testControllers.read(v).values(),b=>!!(b.capabilities.read(v)&f))));h(oo.canRefreshTests,2),h(oo.canGoToRelatedCode,4),h(oo.canGoToRelatedTest,8),this._register(r.onDidActiveEditorChange(()=>this.updateEditorContextKeys()))}async expandTest(e,t){await this.testControllers.get().get(Ur.fromString(e).controllerId)?.expandTest(e,t)}cancelTestRun(e,t){if(this.cancelExtensionTestRunEmitter.fire({runId:e,taskId:t}),e===void 0)for(let o of this.uiRunningTests.values())o.cancel();else t||this.uiRunningTests.get(e)?.cancel()}async runTests(e,t=Se.None){let o=[];for(let r of e.tests){let s=o.find(c=>tM(c.profile,r));if(s){s.tests.push(r);continue}let l=this.testProfiles.getDefaultProfileForTest(e.group,r);l&&o.push({profile:l,tests:[r]})}let n={targets:o.map(({profile:r,tests:s})=>({profileId:r.profileId,controllerId:s[0].controllerId,testIds:s.map(l=>l.item.extId)})),group:e.group,exclude:e.exclude?.map(r=>r.item.extId),continuous:e.continuous,preserveFocus:e.preserveFocus};if(n.targets.length===0)for(let r of Jg(e.tests,(s,l)=>s.controllerId===l.controllerId?0:1)){let s=this.testProfiles.getControllerProfiles(r[0].controllerId),l=r.map(c=>({profile:s.find(u=>u.group===e.group&&tM(u,c)),test:c}));for(let c of Jg(l,(u,p)=>u.profile===p.profile?0:1)){let u=c[0].profile;u&&n.targets.push({testIds:c.map(p=>p.test.item.extId),profileId:u.profileId,controllerId:u.controllerId})}}return this.runResolvedTests(n,t)}async startContinuousRun(e,t){if(e.exclude||(e.exclude=[...this.excluded.all]),!await this.workspaceTrustRequestService.requestWorkspaceTrust({message:d(16110,null)}))return;let r=Jg(e.targets,(s,l)=>s.controllerId.localeCompare(l.controllerId)).map(s=>this.getTestController(s[0].controllerId)?.startContinuousRun(s.map(l=>({excludeExtIds:e.exclude.filter(c=>!l.testIds.includes(c)),profileId:l.profileId,controllerId:l.controllerId,testIds:l.testIds})),t).then(l=>{let c=l.map(u=>u.error).filter(lo);c.length&&this.notificationService.error(d(16109,null,c.join(" ")))}));await Promise.all(r)}async runResolvedTests(e,t=Se.None){e.exclude||(e.exclude=[...this.excluded.all]);let o=this.testResults.createLiveResult(e);if(!await this.workspaceTrustRequestService.requestWorkspaceTrust({message:d(16110,null)}))return o.markComplete(),o;try{let r=new Ye(t);this.uiRunningTests.set(o.id,r);let l=Jg(e.targets,(c,u)=>c.controllerId.localeCompare(u.controllerId)).map(c=>this.getTestController(c[0].controllerId)?.runTests(c.map(u=>({runId:o.id,excludeExtIds:e.exclude.filter(p=>!u.testIds.includes(p)),profileId:u.profileId,controllerId:u.controllerId,testIds:u.testIds})),r.token).then(u=>{let p=u.map(h=>h.error).filter(lo);p.length&&this.notificationService.error(d(16109,null,p.join(" ")))}));return await this.saveAllBeforeTest(e),await Promise.all(l),o}finally{this.uiRunningTests.delete(o.id),o.markComplete()}}async provideTestFollowups(e,t){let o=await Promise.all([...this.testExtHosts].map(async r=>({ctrl:r,followups:await r.provideTestFollowups(e,t)}))),n={followups:o.flatMap(({ctrl:r,followups:s})=>s.map(l=>({message:l.title,execute:()=>r.executeTestFollowup(l.id)}))),dispose:()=>{for(let{ctrl:r,followups:s}of o)r.disposeTestFollowups(s.map(l=>l.id))}};return t.isCancellationRequested&&n.dispose(),n}publishDiff(e,t){this.willProcessDiffEmitter.fire(t),this.collection.apply(t),this.updateEditorContextKeys(),this.didProcessDiffEmitter.fire(t)}getTestController(e){return this.testControllers.get().get(e)}async syncTests(){let e=new Ye;try{await Promise.all([...this.testControllers.get().values()].map(t=>t.syncTests(e.token)))}finally{e.dispose(!0)}}async refreshTests(e){let t=new Ye;this.testRefreshCancellations.add(t),this.isRefreshingTests.set(!0);try{e?await this.getTestController(e)?.refreshTests(t.token):await Promise.all([...this.testControllers.get().values()].map(o=>o.refreshTests(t.token)))}finally{this.testRefreshCancellations.delete(t),this.isRefreshingTests.set(this.testRefreshCancellations.size>0),t.dispose(!0)}}cancelRefreshTests(){for(let e of this.testRefreshCancellations)e.cancel();this.testRefreshCancellations.clear(),this.isRefreshingTests.set(!1)}registerExtHost(e){return this.testExtHosts.add(e),Z(()=>this.testExtHosts.delete(e))}async getTestsRelatedToCode(e,t,o=Se.None){return(await Promise.all([...this.testExtHosts.values()].map(r=>r.getTestsRelatedToCode(e,t,o)))).flatMap(r=>r.map(s=>this.collection.getNodeById(s))).filter(lo)}registerTestController(e,t){return this.testControllers.set(new Map(this.testControllers.get()).set(e,t),void 0),Z(()=>{let o=[];for(let r of this.collection.rootItems)r.controllerId===e&&o.push({op:3,itemId:r.item.extId});this.publishDiff(e,o);let n=new Map(this.testControllers.get());n.delete(e),this.testControllers.set(n,void 0)})}async getCodeRelatedToTest(e,t=Se.None){return await this.testControllers.get().get(e.controllerId)?.getRelatedCode(e.item.extId,t)||[]}updateEditorContextKeys(){let e=this.editorService.activeEditor?.resource;e?this.activeEditorHasTests.set(!vt.isEmpty(this.collection.getNodeByUrl(e))):this.activeEditorHasTests.set(!1)}async saveAllBeforeTest(e,t=this.configurationService,o=this.editorService){if(e.preserveFocus===!0)return;em(this.configurationService,"testing.saveBeforeTest")&&await o.saveAll()}};GBe=I([m(0,X),m(1,F),m(2,ht),m(3,ce),m(4,ee),m(5,uu),m(6,Ne),m(7,B),m(8,pd),m(9,Vu)],GBe);var qBe=(a,i)=>{let e=0,t=0,o=0,n=0,r=0;for(let s of i){let l=s.counts;t+=l[6]+l[4],e+=l[3],o+=l[5],n+=l[2],r+=l[1]}return{isRunning:a,passed:e,failed:t,runSoFar:e+t,totalWillBeRun:e+t+r+n,skipped:o}},aat=({isRunning:a,passed:i,runSoFar:e,totalWillBeRun:t,skipped:o,failed:n})=>{let r=i/e*100;return n>0?r=Math.min(r,99.9):e===0&&(r=0),a?e===0?d(16104,null):o===0?d(16103,null,i,t,r.toPrecision(3)):d(16106,null,i,t,r.toPrecision(3),o):o===0?d(16102,null,i,e,r.toPrecision(3)):d(16105,null,i,e,r.toPrecision(3),o)};var ave=class extends x{static{this.ID="workbench.contrib.testing.chatAgentTool"}constructor(i,e,t){super();let o=i.createInstance(lve);this._register(e.registerTool(lve.DEFINITION,o)),this._register(e.executeToolSet.addTool(lve.DEFINITION)),t.createKey("chat.coreTestFailureToolEnabled",!0).set(!0)}};ave=I([m(0,F),m(1,Vn),m(2,X)],ave);var lve=class{constructor(i,e,t,o,n){this._testService=i;this._uriIdentityService=e;this._workspaceContextService=t;this._testResultService=o;this._testProfileService=n}static{this.ID="runTests"}static{this.DEFINITION={id:this.ID,toolReferenceName:"runTests",legacyToolReferenceFullNames:["runTests"],when:oo.hasRunnableTests,displayName:"Run tests",modelDescription:'Runs unit tests in files. Use this tool if the user asks to run tests or when you want to validate changes using unit tests, and prefer using this tool instead of the terminal tool. When possible, always try to provide `files` paths containing the relevant unit tests in order to avoid unnecessarily long test runs. This tool outputs detailed information about the results of the test run. Set mode="coverage" to also collect coverage and optionally provide coverageFiles for focused reporting.',icon:R.beaker,inputSchema:{type:"object",properties:{files:{type:"array",items:{type:"string"},description:"Absolute paths to the test files to run. If not provided, all test files will be run."},testNames:{type:"array",items:{type:"string"},description:"An array of test names to run. Depending on the context, test names defined in code may be strings or the names of functions or classes containing the test cases. If not provided, all tests in the files will be run."},mode:{type:"string",enum:["run","coverage"],description:'Execution mode: "run" (default) runs tests normally, "coverage" collects coverage.'},coverageFiles:{type:"array",items:{type:"string"},description:'When mode="coverage": absolute file paths to include detailed coverage info for. If not provided, a file-level summary of all files with incomplete coverage is shown.'}}},userDescription:d(16069,null),source:kn.Internal,tags:["vscode_editing_with_tests","enable_other_tool_copilot_readFile","enable_other_tool_copilot_listDirectory","enable_other_tool_copilot_findFiles","enable_other_tool_copilot_runTests","enable_other_tool_copilot_runTestsWithCoverage","enable_other_tool_copilot_testFailure"]}}async invoke(i,e,t,o){let n=i.parameters,r=n.mode==="coverage"?"coverage":"run",s=r==="coverage"?8:2,l=r==="coverage"&&n.coverageFiles&&n.coverageFiles.length?n.coverageFiles:void 0,c=await this._getFileTestsToRun(n,t),u=await this._getTestCasesToRun(n,c,t);if(!u.length)return{content:[{kind:"text",value:"No tests found in the files. Ensure the correct absolute paths are passed to the tool."}],toolResultError:d(16068,null)};t.report({message:d(16066,null)}),s===8&&(u.some(f=>this._testProfileService.capabilitiesForTest(f.item)&8)||(s=2));let p=await this._captureTestResult(u,s,o);return p?(await this._monitorRunProgress(p,t,o),o.isCancellationRequested?(this._testService.cancelTestRun(p.id),{content:[{kind:"text",value:d(16063,null)}],toolResultMessage:d(16063,null)}):{content:[{kind:"text",value:await wun(p,r,l)}],toolResultMessage:aat(qBe(!1,[p]))}):{content:[{kind:"text",value:"No test run was started. Instruct the user to ensure their test runner is correctly configured"}],toolResultError:d(16067,null)}}async _monitorRunProgress(i,e,t){let o=new N,n=()=>{let s=qBe(!i.completedAt,[i]),l=aat(s);e.report({message:l,progress:s.runSoFar/s.totalWillBeRun})},r=o.add(new Dt(n,500));return new Promise(s=>{o.add(i.onChange(()=>{r.isScheduled||r.schedule()})),o.add(t.onCancellationRequested(()=>{this._testService.cancelTestRun(i.id),s()})),o.add(i.onComplete(()=>{n(),s()}))}).finally(()=>o.dispose())}async _captureTestResult(i,e,t){let o=new N,n=o.add(new E);return new Promise(r=>{o.add(n.event(()=>{r(void 0)})),o.add(this._testResultService.onResultsChanged(s=>{"started"in s&&o.add(s.started.onNewTask(()=>{o.dispose(),r(s.started)}))})),this._testService.runTests({group:e,tests:i,preserveFocus:!0},t).then(()=>{o.isDisposed||o.add(tn(()=>n.fire(),5e3))})}).finally(()=>o.dispose())}async _getTestCasesToRun(i,e,t){if(!i.testNames?.length)return e;t.report({message:d(16065,null)});let o=i.testNames.map(s=>s.toLowerCase().trim()),n=[],r=async s=>{let l=s.item.label.toLowerCase().trim();if(o.some(c=>l.includes(c))){n.push(s);return}s.expand===1&&await this._testService.collection.expand(s.item.extId,1),await oXe(this._testService,s),await Promise.all([...s.children].map(async c=>{let u=this._testService.collection.getNodeById(c);u&&await r(u)}))};return await Promise.all(e.map(r)),n}async _getFileTestsToRun(i,e){if(!i.files?.length)return[...this._testService.collection.rootItems];e.report({message:d(16064,null)});let t=this._workspaceContextService.getWorkspace().folders.at(0)?.uri,o=i.files.map(r=>Zl(r)?A.file(r):t?A.joinPath(t,r):void 0).filter(lo),n=[];for(let r of o)for await(let s of gpe(this._testService,this._uriIdentityService,r,void 0,!1))for(let l of s)n.push(l);return n}prepareToolInvocation(i,e){let t=i.parameters,o=d(16062,null),n=t.files?.map(r=>"`"+jo(r)+"`");return Promise.resolve({invocationMessage:d(16060,null),confirmationMessages:{title:o,message:n?.length?new Ie().appendMarkdown(d(16061,null,n.join(", "))):d(16059,null),allowAutoConfirm:!0}})}};lve=I([m(0,Ws),m(1,ht),m(2,Pe),m(3,pd),m(4,uu)],lve);async function wun(a,i,e){let t=a.counts[6]+a.counts[4],o=`<summary passed=${a.counts[3]} failed=${t} />
`;return t!==0&&(o+=await Tun(a)),i==="coverage"&&(o+=await Cun(a,e)),o}async function Cun(a,i){let e="";for(let t of a.tasks){let o=t.coverage.get();if(!o)continue;if(!i||!i.length){e+=xun(o);continue}let n=i.map(s=>A.file(s).fsPath),r=new Map;for(let s of o.getAllFiles().values())r.set(s.uri.fsPath,s);for(let s of n){let l=r.get(s);l&&(e+=await kun(l,s))}}return e}function xun(a){let i=[...a.getAllFiles().values()].map(t=>({path:t.uri.fsPath,pct:IZ(t.statement,t.branch,t.declaration)*100})).filter(t=>t.pct<100).sort((t,o)=>t.pct-o.pct);if(!i.length)return`<coverageSummary>All files have 100% coverage.</coverageSummary>
`;let e=`<coverageSummary>
`;for(let t of i)e+=`<file path="${t.path}" percent=${t.pct.toFixed(1)} />
`;return e+=`</coverageSummary>
`,e}async function kun(a,i){let e=IZ(a.statement,a.branch,a.declaration)*100,t=`<coverage path="${i}" percent=${e.toFixed(1)} statements=${a.statement.covered}/${a.statement.total}`;a.branch&&(t+=` branches=${a.branch.covered}/${a.branch.total}`),a.declaration&&(t+=` declarations=${a.declaration.covered}/${a.declaration.total}`),t+=`>
`;try{let o=await a.details(),n=[],r=[],s=[];for(let l of o)if(l.type===0){if(!l.count){let c=ye.isIPosition(l.location)?l.location.lineNumber:l.location.startLineNumber;n.push({name:l.name,line:c})}}else{if(!l.count){let c=ye.isIPosition(l.location)?l.location.lineNumber:l.location.startLineNumber,u=ye.isIPosition(l.location)?l.location.lineNumber:l.location.endLineNumber;s.push([c,u])}if(l.branches){for(let c of l.branches)if(!c.count){let u;c.location?u=ye.isIPosition(c.location)?c.location.lineNumber:c.location.startLineNumber:u=ye.isIPosition(l.location)?l.location.lineNumber:l.location.startLineNumber,r.push({line:u,label:c.label})}}}n.length&&(t+="uncovered functions: "+n.map(l=>`${l.name}(L${l.line})`).join(", ")+`
`),r.length&&(t+="uncovered branches: "+r.map(l=>l.label?`L${l.line}(${l.label})`:`L${l.line}`).join(", ")+`
`),s.length&&(t+="uncovered lines: "+Eun(s)+`
`)}catch{}return t+=`</coverage>
`,t}function Eun(a){if(!a.length)return"";a.sort((e,t)=>e[0]-t[0]);let i=[a[0]];for(let e=1;e<a.length;e++){let t=i[i.length-1],[o,n]=a[e];o<=t[1]+1?t[1]=Math.max(t[1],n):i.push([o,n])}return i.map(([e,t])=>e===t?`${e}`:`${e}-${t}`).join(", ")}async function Tun(a){let i="",e=!1;for(let t of a.tests){if(!Dk(t.ownComputedState))continue;let[,...o]=Ur.split(t.item.extId),n=o.pop();i+=`<testFailure name=${JSON.stringify(n)} path=${JSON.stringify(o.join(" > "))}>
`;for(let r of t.tasks)for(let s of r.messages.filter(l=>l.type===0)){if(e=!0,s.expected!==void 0&&s.actual!==void 0)i+=`<expectedOutput>
${s.expected}
</expectedOutput>
`,i+=`<actualOutput>
${s.actual}
</actualOutput>
`;else{let l=typeof s.message=="string"?s.message:s.message.value;i+=`<message>
${l}
</message>
`}if(s.stackTrace&&s.stackTrace.length>0)for(let l of s.stackTrace.slice(0,10))l.uri&&l.position?i+=`<stackFrame path="${l.uri.fsPath}" line="${l.position.lineNumber}" col="${l.position.column}" />
`:l.uri?i+=`<stackFrame path="${l.uri.fsPath}">${l.label}</stackFrame>
`:i+=`<stackFrame>${l.label}</stackFrame>
`;s.location&&(i+=`<location path="${s.location.uri.fsPath}" line="${s.location.range.startLineNumber}" col="${s.location.range.startColumn}" />
`)}i+=`</testFailure>
`}if(!e){let t=a.tasks.map(o=>o.output.getRange(0,o.output.length).toString().trim()).join(`
`);t&&(i+=`<output>
${t}
</output>
`)}return i}var vOi="vscode-test-data";var cve=a=>{let i=a.authority,[e,...t]=a.path.slice(1).split("/");if(t[0]==="message"){let o=Number(t[1]),n=a.query,r=Number(t[2]),s=t[3];if(i==="results")switch(s){case"TestFailureMessage":return{resultId:e,taskIndex:o,testExtId:n,messageIndex:r,type:2};case"ActualOutput":return{resultId:e,taskIndex:o,testExtId:n,messageIndex:r,type:3};case"ExpectedOutput":return{resultId:e,taskIndex:o,testExtId:n,messageIndex:r,type:4};case"message":}}if(t[0]==="output"){let o=a.query,n=Number(t[1]);return o?{resultId:e,taskIndex:n,testExtId:o,type:1}:{resultId:e,taskIndex:n,type:0}}},uL=a=>{let i={scheme:vOi,authority:"results"};if(a.type===0)return A.from({...i,path:["",a.resultId,"output",a.taskIndex].join("/")});let e=(t,...o)=>A.from({...i,query:a.testExtId,path:["",t,"message",...o].join("/")});switch(a.type){case 3:return e(a.resultId,a.taskIndex,a.messageIndex,"ActualOutput");case 4:return e(a.resultId,a.taskIndex,a.messageIndex,"ExpectedOutput");case 2:return e(a.resultId,a.taskIndex,a.messageIndex,"TestFailureMessage");case 1:return A.from({...i,query:a.testExtId,path:["",a.resultId,"output",a.taskIndex].join("/")});default:os(a,"Invalid test uri")}};var dve=class{constructor(i,e,t,o){this.languageService=e;this.modelService=t;this.resultService=o;i.registerTextModelContentProvider(vOi,this)}static{this.ID="workbench.contrib.testing.contentProvider"}async provideTextContent(i){let e=this.modelService.getModel(i);if(e&&!e.isDisposed())return e;let t=cve(i);if(!t)return null;let o=this.resultService.getResult(t.resultId);if(!o)return null;if(t.type===0){let l=o.tasks[t.taskIndex],c=this.modelService.createModel("",null,i,!1),u=f=>c.applyEdits([{range:{startColumn:1,endColumn:1,startLineNumber:1/0,endLineNumber:1/0},text:f}]),p=qe.concat(l.output.buffers,l.output.length).toString();u(zS(p));let h=p.length>0,g=new N;return g.add(l.output.onDidWriteData(f=>{h||=f.byteLength>0,u(zS(f.toString()))})),l.output.endPromise.then(()=>{g.isDisposed||h||(u(d(16070,null)),g.dispose())}),g.add(c.onWillDispose(()=>g.dispose())),c}let n=o?.getStateById(t.testExtId);if(!n)return null;let r,s=null;switch(t.type){case 3:{let l=n.tasks[t.taskIndex].messages[t.messageIndex];l?.type===0&&(r=l.actual);break}case 1:{r="";let l=o.tasks[t.taskIndex].output;for(let c of n.tasks[t.taskIndex].messages)c.type===1&&(r+=zS(l.getRange(c.offset,c.length).toString()));break}case 4:{let l=n.tasks[t.taskIndex].messages[t.messageIndex];l?.type===0&&(r=l.expected);break}case 2:{let l=n.tasks[t.taskIndex].messages[t.messageIndex];if(!l)break;if(l.type===1){let c=o.tasks[t.taskIndex].output.getRange(l.offset,l.length);r=zS(c.toString())}else typeof l.message=="string"?r=zS(l.message):(r=l.message.value,s=this.languageService.createById("markdown"))}}return r===void 0?null:this.modelService.createModel(r,s,i,!1)}};dve=I([m(0,Bt),m(1,_t),m(2,Tt),m(3,pd)],dve);var jM=le("testingContinuousRunService"),$Be=class extends x{constructor(e,t,o,n){super();this.testService=e;this.testProfileService=n;this.changeEmitter=this._register(new E);this.running=new SA;this.onDidChange=this.changeEmitter.event;let r=oo.isContinuousModeOn.bindTo(o);this._register(this.onDidChange(()=>{r.set(!!this.running.root.value)})),this.lastRun=this._register(new _S({key:"lastContinuousRunProfileIds",scope:1,target:1,serialization:{deserialize:s=>new Set(JSON.parse(s)),serialize:s=>JSON.stringify([...s])}},t)),this._register(Z(()=>{for(let s of this.running.values())s.handle.dispose()}))}get lastRunProfileIds(){return this.lastRun.get(new Set)}isSpecificallyEnabledFor(e){return this.running.size>0&&this.running.hasKey(Ur.fromString(e).path)}isEnabledForAParentOf(e){return!!this.running.root.value||this.running.size>0&&this.running.hasKeyOrParent(Ur.fromString(e).path)}isEnabledForProfile({profileId:e,controllerId:t}){for(let o of this.running.values())if(o.profiles.get().some(n=>n.profileId===e&&n.controllerId===t))return!0;return!1}isEnabledForAChildOf(e){return!!this.running.root.value||this.running.size>0&&this.running.hasKeyOrChildren(Ur.fromString(e).path)}isEnabled(){return!!this.running.root.value||this.running.size>0}start(e,t){let o=new N,n;if(e instanceof Array)n=Me("crProfiles",e);else{let u=()=>this.testProfileService.getGroupDefaultProfiles(e).filter(p=>p.supportsContinuousRun&&(!t||Ur.root(t)===p.controllerId));n=Me("crProfiles",u()),o.add(this.testProfileService.onDidChange(()=>{if(s.autoSetDefault){let p=u();$i(p,n.get())||n.set(u(),void 0)}}))}let r=t?Ur.fromString(t).path:[],s={profiles:n,handle:o,path:r,autoSetDefault:typeof e=="number"},l=this.running.find(r);if(l){o.dispose(),s.autoSetDefault=l.autoSetDefault=!1,l.profiles.set([...new Set([...n.get(),...l.profiles.get()])],void 0),this.changeEmitter.fire(t);return}this.running.insert(r,s);let c=new Vt;o.add(Z(()=>{for(let u of c.values())u.cancel();c.dispose()})),o.add(aae(u=>n.read(u),({addedValues:u,removedValues:p})=>{for(let h of u){let g=new Ye;this.testService.startContinuousRun({continuous:!0,group:h.group,targets:[{testIds:[t??h.controllerId],controllerId:h.controllerId,profileId:h.profileId}]},g.token),c.set(h,g)}for(let h of p)c.get(h)?.cancel(),c.deleteAndDispose(h);this.lastRun.store(new Set([...c.keys()].map(h=>h.profileId)))})),this.changeEmitter.fire(t)}stopProfile({profileId:e,controllerId:t}){let o=[];for(let n of this.running.values()){let r=n.profiles.get(),s=r.filter(l=>l.profileId!==e||l.controllerId!==t);s.length!==r.length&&(s.length===0?o.push(n):n.profiles.set(s,void 0))}for(let n=o.length-1;n>=0;n--)o[n].handle.dispose(),this.running.delete(o[n].path);this.changeEmitter.fire(void 0)}stop(e){let t=[...this.running.deleteRecursive(e?Ur.fromString(e).path:[])];for(let o=t.length-1;o>=0;o--)t[o].handle.dispose();this.changeEmitter.fire(e)}};$Be=I([m(0,Ws),m(1,ce),m(2,X),m(3,uu)],$Be);var Yjt=class{constructor(){this.value=[]}push(i){let e=Px(this.value,i,(t,o)=>t.line-o.line);this.value.splice(e<0?~e:e,0,i)}*lines(){if(!this.value.length)return;let i=0,e=this.value[0].line;for(let t=1;t<this.value.length;t++){let o=this.value[t];o.line!==e&&(yield[e,this.value.slice(i,t)],e=o.line,i=t)}yield[e,this.value.slice(i)]}},lat=le("testingDecorationService");var pL=le("testingPeekOpener");var DU=a=>Bn(a.total===0?1:a.covered/a.total,0,1),Eko=[{color:`var(${yO(Uje)})`,key:"red"},{color:`var(${yO($5i)})`,key:"yellow"},{color:`var(${yO(cle)})`,key:"green"}],Tko=(a,i)=>{let e=Eko[0].color,t=a;for(let{key:o,color:n}of Eko){let r=i[o]/100;r&&a>=r&&a-r<t&&(e=n,t=a-r)}return e},_un=1e-7,jBe=(a,i=2)=>{let e=(a*100).toFixed(i);return a<1-_un&&e==="100"?`${100-10**-i}%`:`${e}%`},_ko=(a,i)=>{switch(i){case"statement":return DU(a.statement);case"minimum":{let e=DU(a.statement);return a.branch&&(e=Math.min(e,DU(a.branch))),a.declaration&&(e=Math.min(e,DU(a.declaration))),e}case"totalCoverage":return IZ(a.statement,a.branch,a.declaration);default:os(i)}};function Xjt(a,i,e){let t=[];for(let o of i.idsFromRoot()){let n=a.getTestById(o.toString());if(!n)break;t.push(n.label)}return t.slice(e).join(" \u203A ")}var cne;(n=>(n.showingFilterFor=r=>d(15766,null,r),n.clickToChangeFiltering=d(15764,null),n.percentCoverage=(r,s)=>d(15767,null,jBe(r,s)),n.allTests=d(15765,null),n.pickShowCoverage=d(15768,null)))(cne||={});var Dko=te("testing.iconFailed",Gx,d(15988,null)),Lko=te("testing.iconErrored",Gx,d(15986,null)),IOi=te("testing.iconPassed",{dark:"#73c991",light:"#73c991",hcDark:"#73c991",hcLight:"#007100"},d(15990,null)),Rko=te("testing.runAction",IOi,d(16007,null)),Mko=te("testing.iconQueued",q1,d(15992,null)),Pko=te("testing.iconUnset","#848484",d(15996,null)),Ako=te("testing.iconSkipped","#848484",d(15994,null)),Nko=te("testing.peekBorder",{dark:Iv,light:Iv,hcDark:bi,hcLight:bi},d(16006,null)),Oko=te("testing.messagePeekBorder",{dark:Dm,light:Dm,hcDark:bi,hcLight:bi},d(16004,null)),Fko=te("testing.peekHeaderBackground",{dark:ai(Iv,.1),light:ai(Iv,.1),hcDark:null,hcLight:null},d(16006,null)),Wko=te("testing.messagePeekHeaderBackground",{dark:ai(Dm,.1),light:ai(Dm,.1),hcDark:null,hcLight:null},d(16005,null)),SOi=te("testing.coveredBackground",{dark:df,light:df,hcDark:null,hcLight:null},d(15983,null)),Dun=te("testing.coveredBorder",{dark:ai(SOi,.75),light:ai(SOi,.75),hcDark:bi,hcLight:bi},d(15984,null)),hZg=te("testing.coveredGutterBackground",{dark:ai(df,.6),light:ai(df,.6),hcDark:cle,hcLight:cle},d(15985,null)),gZg=te("testing.uncoveredBranchBackground",{dark:lj(ai(zf,2),Ho),light:lj(ai(zf,2),Ho),hcDark:null,hcLight:null},d(16010,null)),Jjt=te("testing.uncoveredBackground",{dark:zf,light:zf,hcDark:null,hcLight:null},d(16008,null)),Lun=te("testing.uncoveredBorder",{dark:ai(Jjt,.75),light:ai(Jjt,.75),hcDark:bi,hcLight:bi},d(16009,null)),fZg=te("testing.uncoveredGutterBackground",{dark:ai(zf,1.5),light:ai(zf,1.5),hcDark:Uje,hcLight:Uje},d(16011,null)),vZg=te("testing.coverCountBadgeBackground",bv,d(15981,null)),bZg=te("testing.coverCountBadgeForeground",CC,d(15982,null)),Vko=te("testing.message.error.badgeBackground",wti,d(15998,null));te("testing.message.error.badgeBorder",Vko,d(15999,null));te("testing.message.error.badgeForeground",yti,d(16000,null));te("testing.message.error.lineBackground",null,d(16001,null));te("testing.message.info.decorationForeground",ai(Id,.5),d(16002,null));te("testing.message.info.lineBackground",null,d(16003,null));var Bko={6:Lko,4:Dko,3:IOi,1:Mko,0:Pko,5:Ako},Run=te("testing.iconErrored.retired",ai(Lko,.7),d(15987,null)),Mun=te("testing.iconFailed.retired",ai(Dko,.7),d(15989,null)),Pun=te("testing.iconPassed.retired",ai(IOi,.7),d(15991,null)),Aun=te("testing.iconQueued.retired",ai(Mko,.7),d(15993,null)),Nun=te("testing.iconUnset.retired",ai(Pko,.7),d(15997,null)),Oun=te("testing.iconSkipped.retired",ai(Ako,.7),d(15995,null)),Hko={6:Run,4:Mun,3:Pun,1:Aun,0:Nun,5:Oun};is((a,i)=>{let e=a.getColor(Ho);if(i.addRule(`
	.coverage-deco-inline.coverage-deco-hit.coverage-deco-hovered {
		background: ${a.getColor(SOi)?.transparent(1.3)};
		outline-color: ${a.getColor(Dun)?.transparent(2)};
	}
	.coverage-deco-inline.coverage-deco-miss.coverage-deco-hovered {
		background: ${a.getColor(Jjt)?.transparent(1.3)};
		outline-color: ${a.getColor(Lun)?.transparent(2)};
	}
		`),e){let t=a.getColor(Jjt)?.transparent(2).makeOpaque(e),o=a.getColor(Vko)?.makeOpaque(e);i.addRule(`
			.coverage-deco-branch-miss-indicator::before {
				border-color: ${t?.transparent(1.3)};
				background-color: ${t};
			}
			.monaco-workbench .test-error-content-widget .inner{
				background: ${o};
			}
			.monaco-workbench .test-error-content-widget .inner .arrow svg {
				fill: ${o};
			}
		`)}});var QBe=Ae("test-view-icon",R.beaker,d(15797,null)),yOi=Ae("test-results-icon",R.checklist,d(15784,null)),LU=Ae("testing-run-icon",R.run,d(15787,null)),dne=Ae("testing-rerun-icon",R.debugRerun,d(15783,null)),h6=Ae("testing-run-all-icon",R.runAll,d(15785,null)),uve=Ae("testing-debug-all-icon",R.debugAltSmall,d(15775,null)),kx=Ae("testing-debug-icon",R.debugAltSmall,d(15776,null)),wOi=Ae("testing-coverage-icon",R.runCoverage,d(15774,null)),Uko=Ae("testing-coverage-all-icon",R.runAllCoverage,d(15786,null)),Zjt=Ae("testing-cancel-icon",R.debugStop,d(15771,null)),cat=Ae("testing-filter",R.filter,d(15769,null)),zko=Ae("testing-hidden",R.eyeClosed,d(15770,null)),TZg=Ae("testing-show-as-list-icon",R.listTree,d(15788,null)),_Zg=Ae("testing-show-as-list-icon",R.listFlat,d(15789,null)),dat=Ae("testing-update-profiles",R.gear,d(15795,null)),Kko=Ae("testing-refresh-tests",R.refresh,d(15782,null)),uat=Ae("testing-turn-continuous-run-on",R.eye,d(15793,null)),e5t=Ae("testing-turn-continuous-run-off",R.eyeClosed,d(15792,null)),pat=Ae("testing-continuous-is-on",R.eye,d(15791,null)),Gko=Ae("testing-cancel-refresh-tests",R.stop,d(15772,null)),mat=Ae("testing-coverage",R.coverage,d(15773,null)),qko=Ae("testing-was-covered",R.check,d(15796,null)),$ko=Ae("testing-missing-branch",R.question,d(15779,null)),PN=new Map([[6,Ae("testing-error-icon",R.issues,d(15777,null))],[4,Ae("testing-failed-icon",R.error,d(15778,null))],[3,Ae("testing-passed-icon",R.pass,d(15780,null))],[1,Ae("testing-queued-icon",R.history,d(15781,null))],[2,AE],[5,Ae("testing-skipped-icon",R.debugStepOver,d(15790,null))],[0,Ae("testing-unset-icon",R.circleOutline,d(15794,null))]]);is((a,i)=>{for(let[e,t]of PN.entries()){let o=Bko[e],n=Hko[e];o&&(i.addRule(`.monaco-workbench ${q.asCSSSelector(t)} {
			color: ${a.getColor(o)} !important;
		}`),n&&i.addRule(`
			.test-explorer .computed-state.retired${q.asCSSSelector(t)},
			.testing-run-glyph.retired${q.asCSSSelector(t)}{
				color: ${a.getColor(n)} !important;
			}
		`))}i.addRule(`
		.monaco-editor .glyph-margin-widgets ${q.asCSSSelector(LU)},
		.monaco-editor .glyph-margin-widgets ${q.asCSSSelector(h6)},
		.monaco-editor .glyph-margin-widgets ${q.asCSSSelector(kx)},
		.monaco-editor .glyph-margin-widgets ${q.asCSSSelector(uve)} {
			color: ${a.getColor(Rko)};
		}
	`)});var Lq=class extends x{constructor(e,t,o){super();this.options=e;this.configurationService=t;this.hoverService=o;this.el=new co(()=>{if(this.options.compact){let e=ct(".test-coverage-bars.compact",[ct(".tpc@overall"),ct(".bar@tpcBar")]);return this.attachHover(e.tpcBar,Wun),e}else{let e=ct(".test-coverage-bars",[ct(".tpc@overall"),ct(".bar@statement"),ct(".bar@function"),ct(".bar@branch")]);return this.attachHover(e.statement,jko),this.attachHover(e.function,Qko),this.attachHover(e.branch,Yko),e}});this.visibleStore=this._register(new N);this.customHovers=[]}get visible(){return!!this._coverage}attachHover(e,t){this._register(this.hoverService.setupManagedHover(Ri("element"),e,()=>this._coverage&&t(this._coverage)))}setCoverageInfo(e){let t=this.visibleStore;if(!e){this._coverage&&(this._coverage=void 0,this.customHovers.forEach(o=>o.hide()),t.clear());return}if(!this._coverage){let o=this.el.value.root;t.add(Z(()=>o.remove())),this.options.container.appendChild(o),t.add(this.configurationService.onDidChangeConfiguration(n=>{this._coverage&&(n.affectsConfiguration("testing.displayedCoveragePercent")||n.affectsConfiguration("testing.coverageBarThresholds"))&&this.doRender(this._coverage)}))}this._coverage=e,this.doRender(e)}doRender(e){let t=this.el.value,o=this.options.compact?0:2,n=em(this.configurationService,"testing.coverageBarThresholds"),r=_ko(e,em(this.configurationService,"testing.displayedCoveragePercent"));this.options.overall!==!1?t.overall.textContent=jBe(r,o):t.overall.style.display="none","tpcBar"in t?i5t(t.tpcBar,r,!1,n):(i5t(t.statement,DU(e.statement),e.statement.total===0,n),i5t(t.function,e.declaration&&DU(e.declaration),e.declaration?.total===0,n),i5t(t.branch,e.branch&&DU(e.branch),e.branch?.total===0,n))}};Lq=I([m(1,B),m(2,nt)],Lq);var Fun=16,i5t=(a,i,e,t)=>{if(i===void 0){a.style.display="none";return}if(a.style.display="block",a.style.width=`${Fun}px`,a.style.setProperty("--test-bar-width",`${Math.floor(i*16)}px`),e){a.style.color="currentColor",a.style.opacity="0.5";return}a.style.color=Tko(i,t),a.style.opacity="1"},YBe=Jc.NumberFormat(),jko=a=>d(15800,null,YBe.value.format(a.statement.covered),YBe.value.format(a.statement.total),jBe(DU(a.statement))),Qko=a=>a.declaration&&d(15799,null,YBe.value.format(a.declaration.covered),YBe.value.format(a.declaration.total),jBe(DU(a.declaration))),Yko=a=>a.branch&&d(15798,null,YBe.value.format(a.branch.covered),YBe.value.format(a.branch.total),jBe(DU(a.branch))),Wun=a=>{let i=[jko(a),Qko(a),Yko(a)].filter(lo).join(`

`);return{markdown:new Ie().appendText(i),markdownNotSupportedFallback:i}},une=class extends Lq{constructor(e,t,o,n){super(e,t,o);this.resource=Me(this,void 0);let r=xko(t,"testing.showCoverageInExplorer");this._register(be(async s=>{let l,c=n.selected.read(s);if(c&&r.read(s)){let u=this.resource.read(s);u&&(l=c.getComputedForUri(u))}this.setCoverageInfo(l)}))}static{this.hasRegistered=!1}static register(){this.hasRegistered||(this.hasRegistered=!0,ne.as("workbench.registry.explorer.fileContributions").register({create(e,t){return e.createInstance(une,{compact:!0,container:t})}}))}setResource(e,t){this.resource.set(e,t)}setCoverageInfo(e){super.setCoverageInfo(e),this.options.container?.classList.toggle("explorer-item-with-test-coverage",this.visible)}};une=I([m(1,B),m(2,nt),m(3,oC)],une);var Xko="coverage-deco-hit",COi="coverage-deco-miss",Vun=d(15761,null),tEo="testing.toggleInlineCoverage",Bun=4,iEo=L(15751,"Go to Next Uncovered Line"),oEo=L(15753,"Go to Previous Uncovered Line"),pne=class extends x{constructor(e,t,o,n,r,s){super();this.editor=e;this.coverage=o;this.log=r;this.displayedStore=this._register(new N);this.hoveredStore=this._register(new N);this.decorationIds=new Map;this.hasInlineCoverageDetails=Me("hasInlineCoverageDetails",!1);this.summaryWidget=new co(()=>this._register(t.createInstance(hat,this.editor)));let l=ui(this,e.onDidChangeModel,()=>e.getModel()),c=ui(this,e.onDidChangeConfiguration,h=>h),u=ke(h=>{let g=o.selected.read(h);if(!g)return;let f=l.read(h);if(!f)return;let v=g.getUri(f.uri);if(v)return g.didAddCoverage.read(h),{file:v,testId:o.filterToTest.read(h)}});this._register(Vd(oo.hasPerTestCoverage,s,h=>!!u.read(h)?.file.perTestData?.size)),this._register(Vd(oo.hasCoverageInFile,s,h=>!!u.read(h)?.file)),this._register(Vd(oo.hasInlineCoverageDetails,s,h=>this.hasInlineCoverageDetails.read(h))),this._register(be(h=>{let g=u.read(h);g?this.apply(e.getModel(),g.file,g.testId,o.showInline.read(h)):this.clear()}));let p=hr("testing.coverageToolbarEnabled",!0,n);this._register(be(h=>{let g=u.read(h);g&&p.read(h)?this.summaryWidget.value.setCoverage(g.file,g.testId):this.summaryWidget.rawValue?.clearCoverage()})),this._register(be(h=>{u.read(h)&&c.read(h)?.hasChanged(75)!==!1&&this.updateEditorStyles()})),this._register(e.onMouseMove(h=>{let g=e.getModel();h.target.type===3&&g?this.hoverLineNumber(e.getModel()):o.showInline.get()&&h.target.type===6&&g?this.hoverInlineDecoration(g,h.target.position):this.hoveredStore.clear()})),this._register(e.onWillChangeModel(()=>{let h=e.getModel();if(!(!this.details||!h))for(let g of h.getAllDecorations()){let f=this.decorationIds.get(g.id);f&&(f.detail.range=g.range)}}))}static{this.ID="editor.contrib.coverageDecorations"}updateEditorStyles(){let e=this.editor.getOption(75),{style:t}=this.editor.getContainerDomNode();t.setProperty("--vscode-testing-coverage-lineHeight",`${e}px`)}hoverInlineDecoration(e,t){let o=e.getDecorationsInRange(z.fromPositions(t)),n=d_(o,({id:r})=>this.decorationIds.has(r)?{id:r,deco:this.decorationIds.get(r)}:void 0);n!==this.hoveredSubject&&(this.hoveredStore.clear(),this.hoveredSubject=n,n&&(e.changeDecorations(r=>{r.changeDecorationOptions(n.id,{...n.deco.options,className:`${n.deco.options.className} coverage-deco-hovered`})}),this.hoveredStore.add(Z(()=>{this.hoveredSubject=void 0,e.changeDecorations(r=>{r.changeDecorationOptions(n.id,n.deco.options)})}))))}hoverLineNumber(e){this.hoveredSubject==="lineNo"||!this.details||this.coverage.showInline.get()||(this.hoveredStore.clear(),this.hoveredSubject="lineNo",e.changeDecorations(t=>{for(let[o,n]of this.decorationIds){let{applyHoverOptions:r,options:s}=n,l={...s};r(l),t.changeDecorationOptions(o,l)}}),this.hoveredStore.add(this.editor.onMouseLeave(()=>{this.hoveredStore.clear()})),this.hoveredStore.add(Z(()=>{this.hoveredSubject=void 0,e.changeDecorations(t=>{for(let[o,n]of this.decorationIds)t.changeDecorationOptions(o,n.options)})})))}goToNextMissedLine(){return this.navigateToMissedLine(!0)}goToPreviousMissedLine(){return this.navigateToMissedLine(!1)}navigateToMissedLine(e){let t=this.editor.getModel(),o=this.editor.getPosition();if(!t||!o||!this.details)return!1;let n=o.lineNumber,r,s,l,c;for(let[,{detail:p,options:h}]of this.decorationIds)if(h.lineNumberClassName?.includes(COi)){let g=p.range;if(g.isEmpty())continue;let f=g.startLineNumber,v={lineNumber:f,range:g};(!l||f<l.lineNumber)&&(l=v),(!c||f>c.lineNumber)&&(c=v),f<n?(!r||f>r.lineNumber)&&(r=v):f>n&&(!s||f<s.lineNumber)&&(s=v)}let u=e?s||l:r||c;return u?(this.editor.setPosition(new ye(u.lineNumber,1)),this.editor.revealLineInCenter(u.lineNumber),!0):!1}async apply(e,t,o,n){let r=this.details=await this.loadDetails(t,o,e);if(!r)return this.hasInlineCoverageDetails.set(!1,void 0),this.clear();this.hasInlineCoverageDetails.set(r.ranges.length>0,void 0),this.displayedStore.clear(),e.changeDecorations(s=>{for(let l of r.ranges){let{metadata:{detail:c,description:u},range:p,primary:h}=l;if(c.type===2){let g=c.detail.branches[c.branch].count,f=g?Xko:COi,v=!g&&p.isEmpty()&&c.detail.branches.some(y=>y.count),b={showIfCollapsed:v,description:"coverage-gutter",lineNumberClassName:`coverage-deco-gutter ${f}`},S=y=>{y.hoverMessage=u,v?y.after={content:"\xA0".repeat(Bun),inlineClassName:`coverage-deco-branch-miss-indicator ${q.asClassName($ko)}`,inlineClassNameAffectsLetterSpacing:!0,cursorStops:3}:(y.className=`coverage-deco-inline ${f}`,h&&typeof g=="number"&&(y.before=Jko(g)))};n&&S(b),this.decorationIds.set(s.addDecoration(p,b),{options:b,applyHoverOptions:S,detail:l})}else if(c.type===1){let g=c.count?Xko:COi,f={showIfCollapsed:!1,description:"coverage-inline",lineNumberClassName:`coverage-deco-gutter ${g}`},v=b=>{b.className=`coverage-deco-inline ${g}`,b.hoverMessage=u,h&&typeof c.count=="number"&&(b.before=Jko(c.count))};n&&v(f),this.decorationIds.set(s.addDecoration(p,f),{options:f,applyHoverOptions:v,detail:l})}}}),this.displayedStore.add(Z(()=>{e.changeDecorations(s=>{for(let l of this.decorationIds.keys())s.removeDecoration(l);this.decorationIds.clear()})}))}clear(){this.loadingCancellation?.cancel(),this.loadingCancellation=void 0,this.displayedStore.clear(),this.hoveredStore.clear(),this.hasInlineCoverageDetails.set(!1,void 0)}async loadDetails(e,t,o){let n=this.loadingCancellation=new Ye;this.displayedStore.add(this.loadingCancellation);try{let r=t?await e.detailsForTest(t,this.loadingCancellation.token):await e.details(this.loadingCancellation.token);return n.token.isCancellationRequested?void 0:new xOi(r,o)}catch(r){this.log.error("Error loading coverage details",r)}}};pne=I([m(1,F),m(2,oC),m(3,B),m(4,se),m(5,X)],pne);var Jko=a=>{if(a!==0)return{content:`${a>99?"99+":a}x`,cursorStops:3,inlineClassName:"coverage-deco-inline-count",inlineClassNameAffectsLetterSpacing:!0}},xOi=class{constructor(i,e){this.details=i;this.ranges=[];let t=i.map(s=>({range:o5t(s.location),primary:!0,metadata:{detail:s,description:this.describe(s,e)}}));for(let{range:s,metadata:{detail:l}}of t)if(l.type===1&&l.branches)for(let c=0;c<l.branches.length;c++){let u={type:2,branch:c,detail:l};t.push({range:o5t(l.branches[c].location||z.fromPositions(s.getEndPosition())),primary:!0,metadata:{detail:u,description:this.describe(u,e)}})}t.sort((s,l)=>z.compareRangesUsingStarts(s.range,l.range)||s.metadata.detail.type-l.metadata.detail.type);let o=[],n=this.ranges=[],r=()=>{let s=o.pop(),l=o[o.length-1];l&&(l.range=l.range.setStartPosition(s.range.endLineNumber,s.range.endColumn)),n.push(s)};for(let s of t){let l=s.range.getStartPosition();for(;o[o.length-1]?.range.containsPosition(l)===!1;)r();if(s.range.isEmpty()){n.push(s);continue}let c=o[o.length-1];if(c){let u=c.primary,p=c.range.setEndPosition(l.lineNumber,l.column);c.range=c.range.setStartPosition(s.range.endLineNumber,s.range.endColumn),c.primary=!1,c.range.isEmpty()&&o.pop(),n.push({range:p,primary:u,metadata:c.metadata})}o.push(s)}for(;o.length;)r()}describe(i,e){if(i.type===0)return Zko(i.name,i);if(i.type===1){let t=eEo(e.getValueInRange(o5t(i.location)).trim()||"<empty statement>");if(i.branches?.length){let o=i.branches.filter(n=>!!n.count).length;return new Ie().appendMarkdown(d(15742,null,o,i.branches.length,t))}else return Zko(t,i)}else if(i.type===2){let t=eEo(e.getValueInRange(o5t(i.detail.location)).trim()||"<empty statement>"),{count:o,label:n}=i.detail.branches[i.branch],r=n?nEo(n):`#${i.branch+1}`;return o?o===!0?new Ie().appendMarkdown(d(15741,null,r,t)):new Ie().appendMarkdown(d(15740,null,r,t,o)):new Ie().appendMarkdown(d(15743,null,r,t))}os(i)}};function Zko(a,i){return new Ie().appendMarkdown(i.count?typeof i.count=="number"?d(15744,null,a,i.count):d(15746,null,a):d(15745,null,a))}function o5t(a){return a instanceof ye?z.fromPositions(a,new ye(a.lineNumber,2147483647)):a}function nEo(a){return"`"+a.replace(/[\n\r`]/g,"")+"`"}function eEo(a){return a.length>50&&(a=a.slice(0,40)+"..."),nEo(a)}var hat=class extends x{constructor(e,t,o,n,r,s,l,c){super();this.editor=e;this.configurationService=t;this.contextMenuService=o;this.testService=n;this.keybindingService=r;this.commandService=s;this.coverage=l;this.registered=!1;this.isRunning=!1;this.showStore=this._register(new N);this._domNode=ct("div.coverage-summary-widget",[ct("div",[ct("span.bars@bars"),ct("span.toolbar@toolbar")])]);this.bars=this._register(c.createInstance(Lq,{compact:!1,overall:!1,container:this._domNode.bars})),this.actionBar=this._register(c.createInstance(Zi,this._domNode.toolbar,{orientation:0,actionViewItemProvider:(u,p)=>{if(u instanceof g6){if(u.iconOnly)return u.class=q.asClassName(u.icon),new hs(void 0,u,{...p,label:!1,icon:!0});let h=new kOi(void 0,u,p);return h.themeIcon=u.icon,h}}})),this._register(be(u=>{l.showInline.read(u),this.setActions()})),this._register(Jo(this._domNode.root,re.CONTEXT_MENU,u=>{this.contextMenuService.showContextMenu({menuId:D.StickyScrollContext,getAnchor:()=>u})}))}getId(){return"coverage-summary-widget"}getDomNode(){return this._domNode.root}getPosition(){return{preference:2,stackOrdinal:9}}clearCoverage(){this.current=void 0,this.bars.setCoverageInfo(void 0),this.hide()}setCoverage(e,t){this.current={coverage:e,testId:t},this.bars.setCoverageInfo(e),e?(this.setActions(),this.show()):this.hide()}setActions(){this.actionBar.clear();let e=this.current;if(!e)return;let t=new g6("toggleInline",this.coverage.showInline.get()?d(15756,null):d(15758,null),mat,void 0,()=>this.coverage.showInline.set(!this.coverage.showInline.get(),void 0));t.tooltip=this.keybindingService.appendKeybinding(Vun,tEo);let o=e.coverage.statement.covered<e.coverage.statement.total;if(this.actionBar.push(new g6("goToPreviousMissed",oEo.value,R.arrowUp,o,()=>this.commandService.executeCommand("testing.coverage.goToPreviousMissedLine"),!0)),this.actionBar.push(new g6("goToNextMissed",iEo.value,R.arrowDown,o,()=>this.commandService.executeCommand("testing.coverage.goToNextMissedLine"),!0)),this.actionBar.push(t),e.testId){let n=e.coverage.fromResult.getTestById(e.testId.toString());qy(!!n,"got coverage for an unreported test"),this.actionBar.push(new g6("perTestFilter",cne.showingFilterFor(n.label),cat,void 0,()=>this.commandService.executeCommand("testing.coverageFilterToTestInEditor",this.current,this.editor)))}else e.coverage.perTestData?.size&&this.actionBar.push(new g6("perTestFilter",d(15749,null,e.coverage.perTestData.size),cat,void 0,()=>this.commandService.executeCommand("testing.coverageFilterToTestInEditor",this.current,this.editor)));this.actionBar.push(new g6("rerun",d(15757,null),dne,!this.isRunning,()=>this.rerunTest()))}show(){if(this.registered)return;this.registered=!0;let e,t=this.showStore;this.editor.addOverlayWidget(this),this.editor.changeViewZones(o=>{e=o.addZone({afterLineNumber:0,afterColumn:0,domNode:document.createElement("div"),heightInPx:30,ordinal:-1})}),t.add(Z(()=>{this.registered=!1,this.editor.removeOverlayWidget(this),this.editor.changeViewZones(o=>{o.removeZone(e)})})),t.add(this.configurationService.onDidChangeConfiguration(o=>{this.current&&(o.affectsConfiguration("testing.coverageBarThresholds")||o.affectsConfiguration("testing.displayedCoveragePercent"))&&this.setCoverage(this.current.coverage,this.current.testId)}))}rerunTest(){let e=this.current;e&&(this.isRunning=!0,this.setActions(),this.testService.runResolvedTests(e.coverage.fromResult.request).finally(()=>{this.isRunning=!1,this.setActions()}))}hide(){this.showStore.clear()}};hat=I([m(1,B),m(2,Xe),m(3,Ws),m(4,_e),m(5,ge),m(6,oC),m(7,F)],hat);W(class extends K{constructor(){super({id:tEo,title:L(15748,"Toggle Inline Coverage"),category:Ve.Test,keybinding:{weight:200,primary:Vi(2133,3111)},toggled:{condition:oo.inlineCoverageEnabled,title:d(15747,null)},icon:mat,menu:[{id:D.CommandPalette,when:oo.isTestCoverageOpen},{id:D.EditorTitle,when:C.and(oo.hasInlineCoverageDetails,oo.coverageToolbarEnabled.notEqualsTo(!0)),group:"navigation"}]})}run(i){let e=i.get(oC);e.showInline.set(!e.showInline.get(),void 0)}});W(class extends K{constructor(){super({id:"testing.coverageToggleToolbar",title:L(15763,"Show Test Coverage Toolbar"),metadata:{description:L(15762,"Toggle the sticky coverage bar in the editor.")},category:Ve.Test,toggled:{condition:oo.coverageToolbarEnabled},menu:[{id:D.CommandPalette,when:oo.isTestCoverageOpen},{id:D.StickyScrollContext,when:oo.isTestCoverageOpen},{id:D.EditorTitle,when:oo.hasCoverageInFile,group:"coverage",order:1}]})}run(i){let e=i.get(B),t=em(e,"testing.coverageToolbarEnabled");e.updateValue("testing.coverageToolbarEnabled",!t)}});W(class extends K{constructor(){super({id:"testing.coverageFilterToTestInEditor",title:L(15750,"Filter Coverage to Test"),category:Ve.Test,icon:R.filter,toggled:{icon:R.filterFilled,condition:oo.isCoverageFilteredToTest},menu:[{id:D.EditorTitle,when:C.and(oo.hasCoverageInFile,oo.coverageToolbarEnabled.notEqualsTo(!0),oo.hasPerTestCoverage,fr.isEqualTo(w0)),group:"navigation"}]})}run(i,e,t){let o=i.get(oC),n=i.get(Ue),r=i.get(ge),s=pn(t)?t:i.get(qt).getActiveCodeEditor(),l;if(e instanceof s3)l=e;else if(km(e))l=o.selected.get()?.getUri(A.from(e));else{let S=s?.getModel()?.uri;l=S&&o.selected.get()?.getUri(S)}if(!l||!l.perTestData?.size)return;let c=[...l.perTestData].map(Ur.fromString),u=Ur.getLengthOfCommonPrefix(c.length,S=>c[S]),p=l.fromResult,h=o.filterToTest.get(),g=[{iconClass:"codicon-go-to-file",tooltip:"Go to Test"}],f=[{label:cne.allTests,testId:void 0},{type:"separator"},...c.map(S=>({label:Xjt(p,S,u),testId:S,buttons:g}))],v=s?.getScrollTop()||0,b=new me;n.pick(f,{activeItem:f.find(S=>"testId"in S&&S.testId?.toString()===h?.toString()),placeHolder:cne.pickShowCoverage,onDidTriggerItemButton:S=>{r.executeCommand("vscode.revealTest",S.item.testId?.toString())},onDidFocus:S=>{if(!S.testId)b.clear(),s?.setScrollTop(v),o.filterToTest.set(void 0,void 0);else{let y=b.value=new Ye;l.detailsForTest(S.testId,y.token).then(w=>{let k=w.find(T=>T.type===1);!y.token.isCancellationRequested&&k&&s?.revealLineNearTop(k.location instanceof ye?k.location.lineNumber:k.location.startLineNumber)},()=>{}),o.filterToTest.set(S.testId,void 0)}}}).then(S=>{S||s?.setScrollTop(v),b.dispose(),o.filterToTest.set(S?S.testId:h,void 0)})}});W(class extends K{constructor(){super({id:"testing.toggleCoverageInExplorer",title:L(15760,"Toggle Coverage in Explorer"),metadata:{description:L(15759,"Toggle the display of test coverage in the File Explorer view.")},category:Ve.Test,toggled:{condition:C.equals("config.testing.showCoverageInExplorer",!0),title:d(15755,null)},menu:[{id:D.CommandPalette,when:oo.isTestCoverageOpen}]})}run(i){let e=i.get(B),t=em(e,"testing.showCoverageInExplorer");e.updateValue("testing.showCoverageInExplorer",!t)}});W(class extends K{constructor(){super({id:"testing.coverage.goToNextMissedLine",title:iEo,metadata:{description:L(15752,"Navigate to the next line that is not covered by tests.")},category:Ve.Test,icon:R.arrowDown,precondition:oo.hasCoverageInFile,keybinding:{when:fr,weight:100,primary:579},menu:[{id:D.CommandPalette,when:oo.isTestCoverageOpen},{id:D.EditorTitle,when:oo.hasCoverageInFile,group:"coverage",order:2}]})}run(i){let t=i.get(qt).getActiveCodeEditor();if(!t)return;t.getContribution(pne.ID)?.goToNextMissedLine()}});W(class extends K{constructor(){super({id:"testing.coverage.goToPreviousMissedLine",title:oEo,metadata:{description:L(15754,"Navigate to the previous line that is not covered by tests.")},category:Ve.Test,icon:R.arrowUp,precondition:oo.hasCoverageInFile,keybinding:{when:fr,weight:100,primary:1603},menu:[{id:D.CommandPalette,when:oo.isTestCoverageOpen},{id:D.EditorTitle,when:oo.hasCoverageInFile,group:"coverage",order:3}]})}run(i){let t=i.get(qt).getActiveCodeEditor();if(!t)return;t.getContribution(pne.ID)?.goToPreviousMissedLine()}});var g6=class extends it{constructor(e,t,o,n,r,s=!1){super(e,t,void 0,n,r);this.icon=o;this.iconOnly=s}},kOi=class extends hs{updateLabel(){this.options.label&&this.label&&this.themeIcon&&vi(this.label,Sn(this.themeIcon),this.action.label)}};function rEo(a,i){let e={beginUpdate(){},endUpdate(){},handlePossibleChange(t){t.reportChanges()},handleChange(t,o){i(o)}};return a.addObserver(e),{dispose(){a.removeObserver(e)}}}var XBe=class extends Gs{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super(e,t,o,n,r,s,l,c,u,p);this.coverageService=h;this.storageService=g;this.tree=this._register(new me);this.sortOrder=Me("sortOrder",1);let f=this.storageService.getNumber("testing.coverageSortOrder",1);f!==void 0&&f>=0&&f<=2&&this.sortOrder.set(f,void 0)}renderBody(e){super.renderBody(e),this._register(be(o=>{let n=this.sortOrder.read(o);this.storageService.store("testing.coverageSortOrder",n,1,1)}));let t=this._register(this.instantiationService.createInstance(Nl,{onDidChangeVisibility:this.onDidChangeBodyVisibility}));this._register(be(o=>{let n=this.coverageService.selected.read(o);n?(this.tree.value??=this.instantiationService.createInstance(gat,e,t,this.sortOrder)).setInput(n,this.coverageService.filterToTest.read(o)):this.tree.clear()}))}layoutBody(e,t){super.layoutBody(e,t),this.tree.value?.layout(e,t)}collapseAll(){this.tree.value?.collapseAll()}};XBe=I([m(1,_e),m(2,Xe),m(3,B),m(4,X),m(5,Bi),m(6,F),m(7,Je),m(8,Le),m(9,nt),m(10,oC),m(11,ce)],XBe);var a5t=0,fat=class{constructor(i,e,t){this.uri=i;this.data=e;this.id=String(a5t++);this.containedDetails=new Set;this.children=[];if(e.location instanceof z)for(let o of t)this.contains(o.location)&&this.containedDetails.add(o)}get hits(){return this.data.count}get label(){return this.data.name}get location(){return this.data.location}get tpc(){let i=this.attributableCoverage();return i&&IZ(i.statement,i.branch,void 0)}contains(i){let e=this.data.location;return e instanceof z&&(i instanceof z?e.containsRange(i):e.containsPosition(i))}attributableCoverage(){let{location:i,count:e}=this.data;if(!(i instanceof z)||!e)return;let t={covered:0,total:0},o={covered:0,total:0};for(let n of this.containedDetails)if(n.type===1&&(t.covered+=n.count?1:0,t.total++,n.branches))for(let{count:r}of n.branches)o.covered+=r?1:0,o.total++;return{statement:t,branch:o}}};I([hi],fat.prototype,"attributableCoverage",1);var EOi=class{constructor(i){this.n=i;this.id=String(a5t++)}get label(){return d(15802,null,this.n)}},vat=class{constructor(i){this.testItem=i;this.id=String(a5t++)}get label(){return d(15801,null,this.testItem.label)}},n5t=class{constructor(){this.id=String(a5t++);this.label=d(15803,null)}},fne=a=>typeof a=="object"&&"value"in a,r5t=a=>a instanceof fat,Hun=a=>fne(a)&&a.value instanceof s3&&!!a.value.declaration?.total,gat=class extends x{constructor(e,t,o,n,r,s){super();this.inputDisposables=this._register(new N);e.classList.add("testing-stdtree"),this.tree=n.createInstance(nF,"TestCoverageView",e,new TOi,[n.createInstance(hne,t),n.createInstance(gne),n.createInstance(s5t),n.createInstance(mne)],{expandOnlyOnTwistieClick:!0,sorter:new _Oi(o),keyboardNavigationLabelProvider:{getCompressedNodeKeyboardNavigationLabel(l){return l.map(c=>this.getKeyboardNavigationLabel(c)).join("/")},getKeyboardNavigationLabel(l){return fne(l)?Ga(l.value.uri):l.label}},accessibilityProvider:{getAriaLabel(l){if(fne(l)){let c=Ga(l.value.uri);return d(15804,null,c,(l.value.tpc*100).toFixed(2))}else return l.label},getWidgetAriaLabel(){return d(15805,null)}},identityProvider:new DOi}),this._register(be(l=>{o.read(l),this.tree.resort(null,!0)})),this._register(this.tree),this._register(this.tree.onDidChangeCollapseState(l=>{let c=l.node.element;!l.node.collapsed&&!l.node.children.length&&c&&Hun(c)&&(c.value.hasSynchronousDetails&&this.tree.setChildren(c,[{element:new n5t,incompressible:!0}]),c.value.details().then(u=>this.updateWithDetails(c,u)))})),this._register(this.tree.onDidOpen(l=>{let c,u;if(l.element){if(fne(l.element)&&!l.element.children?.size)c=l.element.value.uri;else if(r5t(l.element))c=l.element.uri,u=l.element.location;else if(l.element instanceof vat){s.executeCommand("testing.coverageFilterToTest");return}}c&&r.openEditor({resource:c,options:{selection:u instanceof ye?z.fromPositions(u,u):u,revealIfOpened:!0,selectionRevealType:3,preserveFocus:l.editorOptions.preserveFocus,pinned:l.editorOptions.pinned,source:1}},l.sideBySide?In:jn)}))}setInput(e,t){this.inputDisposables.clear();let o=e.tree;t&&(o=e.filterTreeForTest(t));let n=[];for(let c of o.nodes){for(;!(c.value instanceof s3)&&c.children?.size===1;)c=vt.first(c.children.values());n.push(c)}let r=c=>{let u=!c.children?.size;return{element:c,incompressible:u,collapsed:u,collapsible:!u||!!c.value?.declaration?.total,children:c.children&&vt.map(c.children?.values(),r)}};this.inputDisposables.add(rEo(e.didAddCoverage,c=>{let u=fd(c,p=>this.tree.hasElement(p));u&&this.tree.setChildren(u,vt.map(u.children?.values()||[],r),{diffIdentityProvider:{getId:p=>p.value.id}})}));let s=vt.map(n,r),l=t&&e.result.getTestById(t.toString());l&&(s=vt.concat(vt.single({element:new vat(l),incompressible:!0}),s)),this.tree.setChildren(null,s)}layout(e,t){this.tree.layout(e,t)}collapseAll(){this.tree.collapseAll()}updateWithDetails(e,t){if(!this.tree.hasElement(e))return;let o=[];for(let r of t){if(r.type!==0)continue;let s=o;for(;;){let l=s.find(c=>c.containedDetails.has(r));if(l)s=l.children;else break}s.push(new fat(e.value.uri,r,t))}let n=r=>({element:r,incompressible:!0,collapsed:!0,collapsible:r.children.length>0,children:r.children.map(n)});this.tree.setChildren(e,o.map(n))}};gat=I([m(3,F),m(4,ee),m(5,ge)],gat);var TOi=class{getHeight(i){return 22}getTemplateId(i){if(fne(i))return hne.ID;if(r5t(i))return gne.ID;if(i instanceof n5t||i instanceof EOi)return s5t.ID;if(i instanceof vat)return mne.ID;os(i)}},_Oi=class{constructor(i){this.order=i}compare(i,e){let t=this.order.get();if(fne(i)&&fne(e))switch(t){case 1:case 2:return i.value.uri.toString().localeCompare(e.value.uri.toString());case 0:return e.value.tpc-i.value.tpc}else if(r5t(i)&&r5t(e))switch(t){case 1:return ye.compare(i.location instanceof z?i.location.getStartPosition():i.location,e.location instanceof z?e.location.getStartPosition():e.location);case 2:return i.label.localeCompare(e.label);case 0:{let o=i.tpc,n=e.tpc;return o!==void 0&&n!==void 0&&n-o||+e.hits-+i.hits||i.label.localeCompare(e.label)}}else return 0}},mne=class{constructor(i,e){this.menuService=i;this.contextKeyService=e;this.templateId=mne.ID}static{this.ID="C"}renderCompressedElements(i,e,t){this.renderInner(i.element.elements[i.element.elements.length-1],t)}renderTemplate(i){i.classList.add("testing-stdtree-container");let e=M(i,_(".label")),t=this.menuService.getMenuActions(D.TestCoverageFilterItem,this.contextKeyService,{shouldForwardArgs:!0}),o=new Zi(i);return o.push(ml(t,"inline").primary,{icon:!0,label:!1}),o.domNode.style.display="block",{label:e,actions:o}}renderElement(i,e,t){this.renderInner(i.element,t)}disposeTemplate(i){i.actions.dispose()}renderInner(i,e){e.label.innerText=i.label}};mne=I([m(0,Kt),m(1,X)],mne);var hne=class{constructor(i,e,t){this.labels=i;this.labelService=e;this.instantiationService=t;this.templateId=hne.ID}static{this.ID="F"}renderTemplate(i){let e=new N;return i.classList.add("testing-stdtree-container","test-coverage-list-item"),{container:i,bars:e.add(this.instantiationService.createInstance(Lq,{compact:!1,container:i})),label:e.add(this.labels.create(i,{supportHighlights:!0})),elementsDisposables:e.add(new N),templateDisposables:e}}renderElement(i,e,t){this.doRender(i.element,t,i.filterData)}renderCompressedElements(i,e,t){this.doRender(i.element.elements,t,i.filterData)}disposeTemplate(i){i.templateDisposables.dispose()}doRender(i,e,t){e.elementsDisposables.clear();let o=i instanceof Array?i[i.length-1]:i,n=o.value,r=i instanceof Array?i.map(s=>Ga(s.value.uri)):Ga(n.uri);n instanceof JYe?e.bars.setCoverageInfo(void 0):(e.elementsDisposables.add(be(s=>{o.value?.didChange.read(s),e.bars.setCoverageInfo(n)})),e.bars.setCoverageInfo(n)),e.label.setResource({resource:n.uri,name:r},{fileKind:o.children?.size?1:0,matches:xa(t),separator:this.labelService.getSeparator(n.uri.scheme,n.uri.authority),extraClasses:["label"]})}};hne=I([m(1,rt),m(2,F)],hne);var gne=class{constructor(i){this.instantiationService=i;this.templateId=gne.ID}static{this.ID="N"}renderTemplate(i){let e=new N;i.classList.add("test-coverage-list-item","testing-stdtree-container");let t=M(i,_(".state")),o=M(i,_(".label"));return{container:i,bars:e.add(this.instantiationService.createInstance(Lq,{compact:!1,container:i})),templateDisposables:e,icon:t,label:o}}renderElement(i,e,t){this.doRender(i.element,t,i.filterData)}renderCompressedElements(i,e,t){this.doRender(i.element.elements[i.element.elements.length-1],t,i.filterData)}disposeTemplate(i){i.templateDisposables.dispose()}doRender(i,e,t){let o=!!i.hits,n=o?qko:PN.get(0);e.container.classList.toggle("not-covered",!o),e.icon.className=`computed-state ${q.asClassName(n)}`,e.label.innerText=i.label,e.bars.setCoverageInfo(i.attributableCoverage())}};gne=I([m(0,F)],gne);var s5t=class a{constructor(){this.templateId=a.ID}static{this.ID="B"}renderCompressedElements(i,e,t){this.renderInner(i.element.elements[i.element.elements.length-1],t)}renderTemplate(i){return i}renderElement(i,e,t){this.renderInner(i.element,t)}disposeTemplate(){}renderInner(i,e){e.innerText=i.label}},DOi=class{getId(i){return fne(i)?i.value.uri.toString():i.id}};W(class extends K{constructor(){super({id:"testing.coverageFilterToTest",category:Ve.Test,title:L(15806,"Filter Coverage by Test"),icon:R.filter,toggled:{icon:R.filterFilled,condition:oo.isCoverageFilteredToTest},menu:[{id:D.CommandPalette,when:oo.hasPerTestCoverage},{id:D.TestCoverageFilterItem,group:"inline"},{id:D.ViewTitle,when:C.and(oo.hasPerTestCoverage,C.equals("view","workbench.view.testCoverage")),group:"navigation"}]})}run(i){let e=i.get(oC),t=i.get(Ue),o=e.selected.get();if(!o)return;let n=[...o.allPerTestIDs()].map(Ur.fromString),r=Ur.getLengthOfCommonPrefix(n.length,p=>n[p]),s=o.result,l=e.filterToTest.get(),c=l?.toString(),u=[{label:cne.allTests,id:void 0},{type:"separator"},...n.map(p=>({label:Xjt(s,p,r),testId:p}))];t.pick(u,{activeItem:u.find(p=>"testId"in p&&p.testId?.toString()===c),placeHolder:cne.pickShowCoverage,onDidFocus:p=>{e.filterToTest.set(p.testId,void 0)}}).then(p=>{e.filterToTest.set(p?p.testId:l,void 0)})}});W(class extends Yn{constructor(){super({id:"testing.coverageViewChangeSorting",viewId:"workbench.view.testCoverage",title:L(15807,"Change Sort Order"),icon:R.sortPrecedence,menu:{id:D.ViewTitle,when:C.equals("view","workbench.view.testCoverage"),group:"navigation",order:1}})}runInView(i,e){let t=new N,o=t.add(i.get(Ue).createQuickPick()),n=[{label:d(15811,null),value:1,description:d(15812,null)},{label:d(15809,null),value:0,description:d(15810,null)},{label:d(15813,null),value:2,description:d(15814,null)}];o.placeholder=d(15815,null),o.items=n,o.show(),t.add(o.onDidHide(()=>t.dispose())),t.add(o.onDidAccept(()=>{let r=o.selectedItems[0]?.value;r!==void 0&&(e.sortOrder.set(r,void 0),o.dispose())}))}});W(class extends Yn{constructor(){super({id:"testing.coverageViewCollapseAll",viewId:"workbench.view.testCoverage",title:L(15808,"Collapse All Coverage"),icon:R.collapseAll,menu:{id:D.ViewTitle,when:C.equals("view","workbench.view.testCoverage"),group:"navigation",order:2}})}runInView(i,e){e.collapseAll()}});function JBe(a,i){i instanceof Ur||(i=Ur.fromString(i));let e=a;for(let t of i.path){if(!e.children?.hasOwnProperty(t))return;e=e.children[t]}return e.collapsed}var Uun=0,sEo=()=>String(Uun++),Ah=class{constructor(i,e=null){this.test=i;this.parent=e;this.changeEmitter=new E;this.onChange=this.changeEmitter.event;this.children=new Set;this.treeId=sEo();this.retired=!1;this.state=0;this.depth=e?e.depth+1:0}toJSON(){if(this.depth===0)return{controllerId:this.test.controllerId};let i={$mid:16,tests:[JR.serialize(this.test)]};for(let e=this.parent;e&&e.depth>0;e=e.parent)i.tests.unshift(JR.serialize(e.test));return i}},Ex=class{constructor(i,e){this.message=i;this.parent=e;this.treeId=sEo();this.children=new Set}get description(){return typeof this.message=="string"?this.message:this.message.value}},l5t={getId(a){let i=a instanceof Ex?"error":a.test.expand===0?!!a.children.size:a.test.expand;return a.treeId+"\0"+i}},ZBe=(a,i,e)=>{let t;if(e===null){let o=[...i];if(o.length===1)return ZBe(a,o,o[0]);t=o}else t=e.children;return vt.map(t,o=>o instanceof Ex?{element:o}:{element:o,collapsible:o.test.expand!==0,collapsed:o.test.item.error?2:JBe(a,o.test.item.extId)??o.depth>0?3:2,children:ZBe(a,i,o)})};var qu=Ve.Test;var h5t=t7.create(oo.providerCount.key,0),aEo=L(15839,"Run Tests"),lEo=L(15820,"Debug Tests"),cEo=L(15817,"Run Tests with Coverage"),LOi=class extends K{constructor(){super({id:"testing.hideTest",title:L(15824,"Hide Test"),menu:{id:D.TestItem,group:"builtin@2",when:oo.testItemIsHidden.isEqualTo(!1)}})}run(i,...e){let t=i.get(Ws);for(let o of e)t.excluded.toggle(o.test,!0);return Promise.resolve()}},ROi=class extends K{constructor(){super({id:"testing.unhideTest",title:L(15887,"Unhide Test"),menu:{id:D.TestItem,order:21,when:oo.testItemIsHidden.isEqualTo(!0)}})}run(i,...e){let t=i.get(Ws);for(let o of e)o instanceof Ah&&t.excluded.toggle(o.test,!1);return Promise.resolve()}},MOi=class extends K{constructor(){super({id:"testing.unhideAllTests",title:L(15886,"Unhide All Tests")})}run(i){return i.get(Ws).excluded.clear(),Promise.resolve()}},g5t=(a,i)=>[{id:D.TestItem,group:"inline",order:a,when:i},{id:D.TestItem,group:"builtin@1",order:a,when:i}],bat=class extends Yn{constructor(e,t){super({...t,viewId:"workbench.view.testing"});this.bitset=e}runInView(e,t,...o){let{include:n,exclude:r}=t.getTreeIncludeExclude(this.bitset,o.map(s=>s.test));return e.get(Ws).runTests({tests:n,exclude:r,group:this.bitset})}},POi=class extends bat{constructor(){super(4,{id:"testing.debug",title:L(15818,"Debug Test"),icon:kx,menu:g5t(12,oo.hasDebuggableTests.isEqualTo(!0))})}},AOi=class extends bat{constructor(){super(8,{id:"testing.coverage",title:L(15836,"Run Test with Coverage"),icon:wOi,menu:g5t(13,oo.hasCoverableTests.isEqualTo(!0))})}},NOi=class extends K{constructor(){super({id:"testing.runUsing",title:L(15869,"Execute Using Profile..."),icon:kx,menu:{id:D.TestItem,order:15,group:"builtin@2",when:oo.hasNonDefaultProfile.isEqualTo(!0)}})}async run(i,...e){let t=i.get(ge),o=i.get(Ws),n=await t.executeCommand("vscode.pickTestProfile",{onlyForTest:e[0].test});n&&o.runResolvedTests({group:n.group,targets:[{profileId:n.profileId,controllerId:n.controllerId,testIds:e.filter(r=>tM(n,r.test)).map(r=>r.test.item.extId)}]})}},OOi=class extends bat{constructor(){super(2,{id:"testing.run",title:L(15835,"Run Test"),icon:LU,menu:g5t(11,oo.hasRunnableTests.isEqualTo(!0))})}},FOi=class extends K{constructor(){super({id:"testing.selectDefaultTestProfiles",title:L(15872,"Select Default Profile"),icon:dat,category:qu})}async run(i,e){let t=i.get(ge),o=i.get(uu),n=await t.executeCommand("vscode.pickMultipleTestProfiles",{showConfigureButtons:!1,selected:o.getGroupDefaultProfiles(e),onlyGroup:e});n?.length&&o.setGroupDefaultProfiles(e,n)}},WOi=class extends K{constructor(){super({id:"testing.toggleContinuousRunForTest",title:L(15881,"Turn on Continuous Run"),icon:uat,precondition:C.or(oo.isContinuousModeOn.isEqualTo(!0),oo.isParentRunningContinuously.isEqualTo(!1)),toggled:{condition:oo.isContinuousModeOn.isEqualTo(!0),icon:pat,title:d(15880,null)},menu:g5t(2147483647,oo.supportsContinuousRun.isEqualTo(!0))})}async run(i,...e){let t=i.get(jM);for(let o of e){let n=o.test.item.extId;if(t.isSpecificallyEnabledFor(n)){t.stop(n);continue}t.start(2,n)}}},VOi=class extends K{constructor(){super({id:"testing.continuousRunUsingForTest",title:L(15878,"Start Continous Run Using..."),icon:kx,menu:[{id:D.TestItem,order:14,group:"builtin@2",when:C.and(oo.supportsContinuousRun.isEqualTo(!0),oo.isContinuousModeOn.isEqualTo(!1))}]})}async run(i,...e){let t=i.get(jM),o=i.get(uu),n=i.get(Ne),r=i.get(Ue);for(let s of e){let l=await uEo(t,n,r,[{profiles:o.getControllerProfiles(s.test.controllerId)}]);l.length&&t.start(l,s.test.item.extId)}}},BOi=class extends K{constructor(){super({id:"testing.configureProfile",title:L(15845,"Configure Test Profiles"),icon:dat,f1:!0,category:qu,menu:{id:D.CommandPalette,when:oo.hasConfigurableProfile.isEqualTo(!0)}})}async run(i,e){let t=i.get(ge),o=i.get(uu),n=await t.executeCommand("vscode.pickTestProfile",{placeholder:d(15816,null),showConfigureButtons:!1,onlyConfigurable:!0,onlyGroup:e});n&&o.configure(n.controllerId,n.profileId)}},dEo=a=>[{id:D.ViewTitle,group:"navigation",order:15,when:C.and(C.equals("view","workbench.view.testing"),oo.supportsContinuousRun.isEqualTo(!0),oo.isContinuousModeOn.isEqualTo(a))},{id:D.CommandPalette,when:oo.supportsContinuousRun.isEqualTo(!0)}],HOi=class extends K{constructor(){super({id:"testing.stopContinuousRun",title:L(15879,"Stop Continuous Run"),category:qu,icon:e5t,menu:dEo(!0)})}run(i){i.get(jM).stop()}};function uEo(a,i,e,t){let o=[];for(let{controller:u,profiles:p}of t)for(let h of p)h.supportsContinuousRun&&o.push({label:h.label||u?.label.get()||"",description:u?.label.get(),profile:h});if(o.length===0)return i.info(d(15858,null)),Promise.resolve([]);if(o.length===1)return Promise.resolve([o[0].profile]);let n=[],r=[],s=a.lastRunProfileIds;o.sort((u,p)=>u.profile.group-p.profile.group||u.profile.controllerId.localeCompare(p.profile.controllerId)||u.label.localeCompare(p.label));for(let u=0;u<o.length;u++){let p=o[u];(u===0||o[u-1].profile.group!==p.profile.group)&&n.push({type:"separator",label:INt[p.profile.group]}),n.push(p),s.has(p.profile.profileId)&&r.push(p)}let l=new N,c=l.add(e.createQuickPick({useSeparators:!0}));return c.title=d(15871,null),c.canSelectMany=!0,c.items=n,c.selectedItems=r,c.show(),new Promise(u=>{l.add(c.onDidAccept(()=>{u(c.selectedItems.map(p=>p.profile)),l.dispose()})),l.add(c.onDidHide(()=>{u([]),l.dispose()}))})}var UOi=class extends K{constructor(){super({id:"testing.startContinuousRun",title:L(15877,"Start Continuous Run"),category:qu,icon:uat,menu:dEo(!1)})}async run(i){let e=i.get(jM),o=[...i.get(uu).all()].flatMap(r=>r.profiles.filter(s=>e.lastRunProfileIds.has(s.profileId)));if(o.length)return e.start(o);let n=await uEo(e,i.get(Ne),i.get(Ue),i.get(uu).all());n.length&&e.start(n)}},Sat=class extends Yn{constructor(e,t){super({...e,menu:[{id:D.ViewTitle,order:t===2?11:t===4?12:13,group:"navigation",when:C.and(C.equals("view","workbench.view.testing"),oo.isRunning.isEqualTo(!1),oo.capabilityToContextKey[t].isEqualTo(!0))}],category:qu,viewId:"workbench.view.testing"});this.group=t}runInView(e,t){let{include:o,exclude:n}=t.getTreeIncludeExclude(this.group);return e.get(Ws).runTests({tests:o,exclude:n,group:this.group})}},zOi=class extends K{constructor(){super({id:"testing.getSelectedProfiles",title:L(15823,"Get Selected Profiles")})}run(i){let e=i.get(uu);return[...e.getGroupDefaultProfiles(2),...e.getGroupDefaultProfiles(4),...e.getGroupDefaultProfiles(8)].map(t=>({controllerId:t.controllerId,label:t.label,kind:t.group&8?3:t.group&4?2:1}))}},KOi=class extends Yn{constructor(){super({id:"_testing.getExplorerSelection",title:L(15822,"Get Explorer Selection"),viewId:"workbench.view.testing"})}runInView(i,e){let{include:t,exclude:o}=e.getTreeIncludeExclude(2,void 0,"selected"),n=r=>r.item.extId;return{include:t.map(n),exclude:o.map(n)}}},GOi=class extends Sat{constructor(){super({id:"testing.runSelected",title:aEo,icon:h6},2)}},qOi=class extends Sat{constructor(){super({id:"testing.debugSelected",title:lEo,icon:uve},4)}},$Oi=class extends Sat{constructor(){super({id:"testing.coverageSelected",title:cEo,icon:Uko},8)}},pEo=(a,i)=>a.withProgress({location:10,title:d(15821,null)},()=>i),Iat=class extends K{constructor(e,t,o){super({...e,category:qu,menu:[{id:D.CommandPalette,when:oo.capabilityToContextKey[t].isEqualTo(!0)}]});this.group=t;this.noTestsFoundError=o}async run(e){let t=e.get(Ws),o=e.get(Ne),n=[...t.collection.rootItems].filter(r=>r.children.size||r.expand===1||r.expand===2);if(!n.length){o.info(this.noTestsFoundError);return}await t.runTests({tests:n,group:this.group})}},jOi=class extends Iat{constructor(){super({id:"testing.runAll",title:L(15837,"Run All Tests"),icon:h6,keybinding:{weight:200,primary:Vi(2133,31)}},2,d(15829,null))}},QOi=class extends Iat{constructor(){super({id:"testing.debugAll",title:L(15819,"Debug All Tests"),icon:kx,keybinding:{weight:200,primary:Vi(2133,2079)}},4,d(15826,null))}},YOi=class extends Iat{constructor(){super({id:"testing.coverageAll",title:L(15838,"Run All Tests with Coverage"),icon:wOi,keybinding:{weight:200,primary:Vi(2133,3103)}},8,d(15825,null))}},XOi=class extends K{constructor(){super({id:"testing.cancelRun",title:L(15840,"Cancel Test Run"),icon:Zjt,category:qu,keybinding:{weight:200,primary:Vi(2133,2102)},menu:[{id:D.ViewTitle,order:11,group:"navigation",when:C.and(C.equals("view","workbench.view.testing"),C.equals(oo.isRunning.serialize(),!0))},{id:D.CommandPalette,when:oo.isRunning}]})}async run(i,e,t){let o=i.get(pd),n=i.get(Ws);if(e)n.cancelTestRun(e,t);else for(let r of o.results)r.completedAt||n.cancelTestRun(r.id)}},JOi=class extends Yn{constructor(){super({id:"testing.viewAsList",viewId:"workbench.view.testing",title:L(15884,"View as List"),toggled:oo.viewMode.isEqualTo("list"),menu:{id:D.ViewTitle,order:18,group:"viewAs",when:C.equals("view","workbench.view.testing")}})}runInView(i,e){e.viewModel.viewMode="list"}},ZOi=class extends Yn{constructor(){super({id:"testing.viewAsTree",viewId:"workbench.view.testing",title:L(15885,"View as Tree"),toggled:oo.viewMode.isEqualTo("true"),menu:{id:D.ViewTitle,order:18,group:"viewAs",when:C.equals("view","workbench.view.testing")}})}runInView(i,e){e.viewModel.viewMode="true"}},eFi=class extends Yn{constructor(){super({id:"testing.sortByStatus",viewId:"workbench.view.testing",title:L(15876,"Sort by Status"),toggled:oo.viewSorting.isEqualTo("status"),menu:{id:D.ViewTitle,order:19,group:"sortBy",when:C.equals("view","workbench.view.testing")}})}runInView(i,e){e.viewModel.viewSorting="status"}},tFi=class extends Yn{constructor(){super({id:"testing.sortByLocation",viewId:"workbench.view.testing",title:L(15875,"Sort by Location"),toggled:oo.viewSorting.isEqualTo("location"),menu:{id:D.ViewTitle,order:19,group:"sortBy",when:C.equals("view","workbench.view.testing")}})}runInView(i,e){e.viewModel.viewSorting="location"}},iFi=class extends Yn{constructor(){super({id:"testing.sortByDuration",viewId:"workbench.view.testing",title:L(15874,"Sort by Duration"),toggled:oo.viewSorting.isEqualTo("duration"),menu:{id:D.ViewTitle,order:19,group:"sortBy",when:C.equals("view","workbench.view.testing")}})}runInView(i,e){e.viewModel.viewSorting="duration"}},oFi=class extends K{constructor(){super({id:"testing.showMostRecentOutput",title:L(15873,"Show Output"),category:qu,icon:R.terminal,keybinding:{weight:200,primary:Vi(2133,2093)},precondition:oo.hasAnyResults.isEqualTo(!0),menu:[{id:D.ViewTitle,order:16,group:"navigation",when:C.equals("view","workbench.view.testing")},{id:D.CommandPalette,when:oo.hasAnyResults.isEqualTo(!0)}]})}async run(i){(await i.get($t).openView("workbench.panel.testResults.view",!0))?.showLatestRun()}},nFi=class extends Yn{constructor(){super({id:"testing.collapseAll",viewId:"workbench.view.testing",title:L(15844,"Collapse All Tests"),icon:R.collapseAll,menu:{id:D.ViewTitle,order:16,group:"displayAction",when:C.equals("view","workbench.view.testing")}})}runInView(i,e){e.viewModel.collapseAll()}},rFi=class extends K{constructor(){super({id:"testing.clearTestResults",title:L(15843,"Clear All Results"),category:qu,icon:R.clearAll,menu:[{id:D.TestPeekTitle},{id:D.CommandPalette,when:oo.hasAnyResults.isEqualTo(!0)},{id:D.ViewTitle,order:17,group:"displayAction",when:C.equals("view","workbench.view.testing")},{id:D.ViewTitle,order:17,group:"navigation",when:C.equals("view","workbench.panel.testResults.view")}]})}run(i){i.get(pd).clear()}},sFi=class extends K{constructor(){super({id:"testing.editFocusedTest",title:L(15854,"Go to Test"),icon:R.goToFile,menu:{id:D.TestItem,group:"builtin@1",order:20,when:oo.testItemHasUri.isEqualTo(!0)},keybinding:{weight:90,when:ql.isEqualTo("workbench.view.testing"),primary:515}})}async run(i,e,t){e||(e=i.get($t).getActiveViewWithId("workbench.view.testing")?.focusedTreeElements[0]),e&&e instanceof Ah&&i.get(ge).executeCommand("vscode.revealTest",e.test.item.extId,t)}};async function mEo(a,i,e,t,o){let n=[],r,s=[],l;for await(let c of gpe(a,i,e))for(let u of c){if(!u.item.range||o?.(u)===!1)continue;let p=z.lift(u.item.range);p.containsPosition(t)?r&&z.equalsRange(u.item.range,r)?n.some(h=>Ur.isChild(h.item.extId,u.item.extId))||n.push(u):(r=p,n=[u]):ye.isBefore(p.getStartPosition(),t)&&(!l||l.getStartPosition().isBefore(p.getStartPosition())?(l=p,s=[u]):p.equalsRange(l)&&!s.some(h=>Ur.isChild(h.item.extId,u.item.extId))&&s.push(u))}return n.length?n:s}var yat=class extends K{constructor(e,t){super({...e,menu:[{id:D.CommandPalette,when:h5t},{id:D.EditorContext,group:"testing",order:t===2?0:1,when:C.and(oo.activeEditorHasTests,oo.capabilityToContextKey[t])}]});this.group=t}async run(e){let t=e.get(qt),o=e.get(ee),n=o.activeEditorPane,r=t.getActiveCodeEditor();if(!n||!r)return;r instanceof id&&(r=r.getParentEditor());let s=r?.getPosition(),l=r?.getModel();if(!s||!l||!("uri"in l))return;let c=e.get(Ws),u=e.get(uu),p=e.get(ht),h=e.get(Fo),g=e.get(B);em(g,"testing.saveBeforeTest")&&(await o.save({editor:n.input,groupId:n.group.id}),await c.syncTests());let v=await pEo(h,mEo(c,p,l.uri,s,S=>!!(u.capabilitiesForTest(S.item)&this.group)));if(v.length){await c.runTests({group:this.group,tests:v});return}let b=await c.getTestsRelatedToCode(l.uri,s);if(b.length){await c.runTests({group:this.group,tests:b});return}r&&xu.get(r)?.showMessage(d(15831,null),s)}},aFi=class extends yat{constructor(){super({id:"testing.runAtCursor",title:L(15867,"Run Test at Cursor"),category:qu,keybinding:{weight:200,when:pe.editorTextFocus,primary:Vi(2133,33)}},2)}},lFi=class extends yat{constructor(){super({id:"testing.debugAtCursor",title:L(15849,"Debug Test at Cursor"),category:qu,keybinding:{weight:200,when:pe.editorTextFocus,primary:Vi(2133,2081)}},4)}},cFi=class extends yat{constructor(){super({id:"testing.coverageAtCursor",title:L(15846,"Run Test at Cursor with Coverage"),category:qu,keybinding:{weight:200,when:pe.editorTextFocus,primary:Vi(2133,3105)}},8)}},wat=class extends K{constructor(e,t){super({...e,menu:[{id:D.ExplorerContext,when:oo.capabilityToContextKey[t].isEqualTo(!0),group:"6.5_testing",order:(t===2?11:12)+.1}]});this.group=t}async run(e,t){let o=e.get(Ws),n=e.get(Ne),r=await vt.asyncToArray(Aso(o,e.get(ht),t));if(!r.length){n.notify({message:d(15830,null),severity:ft.Info});return}return o.runTests({tests:r,group:this.group})}},dFi=class extends wat{constructor(){super({id:"testing.run.uri",title:aEo,category:qu},2)}},uFi=class extends wat{constructor(){super({id:"testing.debug.uri",title:lEo,category:qu},4)}},pFi=class extends wat{constructor(){super({id:"testing.coverage.uri",title:cEo,category:qu},8)}},Cat=class extends K{constructor(e,t){super({...e,menu:[{id:D.CommandPalette,when:oo.capabilityToContextKey[t].isEqualTo(!0)},{id:D.EditorContext,group:"testing",order:t===2?2:3,when:C.and(oo.activeEditorHasTests,oo.capabilityToContextKey[t])}]});this.group=t}async _runByUris(e,t){let o=e.get(ht),n=e.get(Ws),r=[];for(let s of t)for await(let l of gpe(n,o,s,void 0,!0))for(let c of l)r.push(c);return r.length?{completedAt:(await n.runTests({tests:r,group:this.group})).completedAt}:{completedAt:void 0}}run(e,t){if(t?.length)return this._runByUris(e,t);let o=e.get(ht),n=e.get(qt).getActiveCodeEditor();if(!n)return;n instanceof id&&(n=n.getParentEditor());let r=n?.getPosition(),s=n?.getModel();if(!r||!s||!("uri"in s))return;let l=e.get(Ws),c=[l.collection.rootIds],u=[];for(;c.length;)for(let p of c.pop()){let h=l.collection.getNodeById(p);o.extUri.isEqual(h.item.uri,s.uri)?u.push(h):c.push(h.children)}if(u.length)return l.runTests({tests:u,group:this.group});n&&xu.get(n)?.showMessage(d(15832,null),r)}},mFi=class extends Cat{constructor(){super({id:"testing.runCurrentFile",title:L(15868,"Run Tests in Current File"),category:qu,keybinding:{weight:200,when:pe.editorTextFocus,primary:Vi(2133,36)}},2)}},hFi=class extends Cat{constructor(){super({id:"testing.debugCurrentFile",title:L(15850,"Debug Tests in Current File"),category:qu,keybinding:{weight:200,when:pe.editorTextFocus,primary:Vi(2133,2084)}},4)}},gFi=class extends Cat{constructor(){super({id:"testing.coverageCurrentFile",title:L(15847,"Run Tests with Coverage in Current File"),category:qu,keybinding:{weight:200,when:pe.editorTextFocus,primary:Vi(2133,3108)}},8)}},Tat=async(a,i,e,t)=>{let o=Promise.all(e.map(r=>Pso(a,r))),n=(await pEo(i,o)).filter(lo);return n.length?await t(n):void 0},fFi=class extends K{async run(i,...e){let t=i.get(Ws);await Tat(i.get(Ws).collection,i.get(Fo),[...this.getTestExtIdsToRun(i,...e)],o=>this.runTest(t,o))}},c5t=class extends fFi{constructor(i){super({...i,menu:{id:D.CommandPalette,when:h5t}})}getTestExtIdsToRun(i){let{results:e}=i.get(pd),t=new Set;for(let o=e.length-1;o>=0;o--){let n=e[o];for(let r of n.tests)Dk(r.ownComputedState)?t.add(r.item.extId):t.delete(r.item.extId)}return t}},xat=class extends K{constructor(i){super({...i,menu:{id:D.CommandPalette,when:C.and(h5t,oo.hasAnyResults.isEqualTo(!0))}})}getLastTestRunRequest(i,e){let t=i.get(pd);return(e?t.results.find(n=>n.id===e):t.results[0])?.request}async run(i,e){let t=i.get(pd),o=e?t.results.find(c=>c.id===e):t.results[0];if(!o)return;let n=o.request,r=i.get(Ws),s=i.get(uu),l=c=>s.getControllerProfiles(c.controllerId).some(u=>u.profileId===c.profileId);await Tat(r.collection,i.get(Fo),n.targets.flatMap(c=>c.testIds),c=>this.getGroup()&n.group&&n.targets.every(l)?r.runResolvedTests({targets:n.targets,group:n.group,exclude:n.exclude}):r.runTests({tests:c,group:this.getGroup()}))}},vFi=class extends c5t{constructor(){super({id:"testing.reRunFailTests",title:L(15865,"Rerun Failed Tests"),category:qu,keybinding:{weight:200,primary:Vi(2133,35)}})}runTest(i,e){return i.runTests({group:2,tests:e})}},bFi=class extends c5t{constructor(){super({id:"testing.debugFailTests",title:L(15852,"Debug Failed Tests"),category:qu,keybinding:{weight:200,primary:Vi(2133,2083)}})}runTest(i,e){return i.runTests({group:4,tests:e})}},kat=class extends xat{constructor(){super({id:"testing.reRunLastRun",title:L(15866,"Rerun Last Run"),category:qu,keybinding:{weight:200,primary:Vi(2133,42)}})}getGroup(){return 2}},Eat=class extends xat{constructor(){super({id:"testing.debugLastRun",title:L(15853,"Debug Last Run"),category:qu,keybinding:{weight:200,primary:Vi(2133,2090)}})}getGroup(){return 4}},SFi=class extends xat{constructor(){super({id:"testing.coverageLastRun",title:L(15848,"Rerun Last Run with Coverage"),category:qu,keybinding:{weight:200,primary:Vi(2133,3114)}})}getGroup(){return 8}},d5t=class extends K{constructor(i){super({...i,menu:{id:D.CommandPalette,when:C.and(h5t,oo.hasAnyResults.isEqualTo(!0))}})}async run(i,e){let t=i.get(pd),o=i.get(Ws),n=i.get(Fo),r=e?t.results.find(l=>l.id===e):t.results[0];if(!r)return;let s=new Set;for(let l of r.tests)Dk(l.ownComputedState)&&s.add(l.item.extId);s.size!==0&&await Tat(o.collection,n,Array.from(s),l=>o.runTests({tests:l,group:this.getGroup()}))}},IFi=class extends d5t{constructor(){super({id:"testing.reRunFailedFromLastRun",title:L(15864,"Rerun Failed Tests from Last Run"),category:qu})}getGroup(){return 2}},yFi=class extends d5t{constructor(){super({id:"testing.debugFailedFromLastRun",title:L(15851,"Debug Failed Tests from Last Run"),category:qu})}getGroup(){return 4}},wFi=class extends K{constructor(){super({id:"testing.searchForTestExtension",title:L(15870,"Search for Test Extension")})}async run(i){i.get(Hi).openSearch('@category:"testing"')}},CFi=class extends K{constructor(){super({id:"testing.openOutputPeek",title:L(15860,"Peek Output"),category:qu,keybinding:{weight:200,primary:Vi(2133,2091)},menu:{id:D.CommandPalette,when:oo.hasAnyResults.isEqualTo(!0)}})}async run(i){i.get(pL).open()}},xFi=class extends K{constructor(){super({id:"testing.toggleInlineTestOutput",title:L(15882,"Toggle Inline Test Output"),category:qu,keybinding:{weight:200,primary:Vi(2133,2087)},menu:{id:D.CommandPalette,when:oo.hasAnyResults.isEqualTo(!0)}})}async run(i){let e=i.get(Ws);e.showInlineOutput.value=!e.showInlineOutput.value}},hEo=a=>[{id:D.TestItem,group:"inline",order:10,when:C.and(oo.canRefreshTests.isEqualTo(!0),oo.isRefreshingTests.isEqualTo(a))},{id:D.ViewTitle,group:"navigation",order:10,when:C.and(C.equals("view","workbench.view.testing"),oo.canRefreshTests.isEqualTo(!0),oo.isRefreshingTests.isEqualTo(a))},{id:D.CommandPalette,when:oo.canRefreshTests.isEqualTo(!0)}],kFi=class extends K{constructor(){super({id:"testing.refreshTests",title:L(15863,"Refresh Tests"),category:qu,icon:Kko,keybinding:{weight:200,primary:Vi(2133,2096),when:oo.canRefreshTests.isEqualTo(!0)},menu:hEo(!1)})}async run(i,...e){let t=i.get(Ws),o=i.get(Fo),n=zo(e.filter(lo).map(r=>r.test.controllerId));return o.withProgress({location:"workbench.view.extension.test"},async()=>{n.length?await Promise.all(n.map(r=>t.refreshTests(r))):await t.refreshTests()})}},EFi=class extends K{constructor(){super({id:"testing.cancelTestRefresh",title:L(15841,"Cancel Test Refresh"),category:qu,icon:Gko,menu:hEo(!0)})}async run(i){i.get(Ws).cancelRefreshTests()}},TFi=class extends K{constructor(){super({id:"testing.coverage.close",title:L(15842,"Clear Coverage"),icon:PE,category:qu,menu:[{id:D.ViewTitle,group:"navigation",order:10,when:C.equals("view","workbench.view.testCoverage")},{id:D.CommandPalette,when:oo.isTestCoverageOpen.isEqualTo(!0)}]})}run(i){i.get(oC).closeCoverage()}},_Fi=class extends K{constructor(){super({id:"testing.openCoverage",title:L(15859,"Open Coverage"),category:qu,menu:[{id:D.CommandPalette,when:oo.hasAnyResults.isEqualTo(!0)}]})}run(i){let e=i.get(pd).results,t=e.length&&e[0].tasks.find(o=>o.coverage);if(!t){i.get(Ne).info(d(15857,null));return}i.get(oC).openCoverage(t,!0)}},u5t=class extends aF{runEditorCommand(i,e,...t){return this.testService=i.get(Ws),this.uriIdentityService=i.get(ht),super.runEditorCommand(i,e,...t)}_getAlternativeCommand(i){return i.getOption(67).alternativeTestsCommand}_getGoToPreference(i){return i.getOption(67).multipleTests||"peek"}},p5t=class extends u5t{async _getLocationModel(i,e,t,o){let n=await this.testService.getTestsRelatedToCode(e.uri,t,o);return new Cw(n.map(r=>r.item.uri&&{uri:r.item.uri,range:r.item.range||new z(1,1,1,1)}).filter(lo),d(15834,null))}_getNoResultFoundMessage(){return d(15828,null)}},DFi=class extends p5t{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:"testing.goToRelatedTest",title:L(15856,"Go to Related Test"),category:qu,precondition:C.and(C.not(oo.activeEditorHasTests.key),oo.canGoToRelatedTest),menu:[{id:D.EditorContext,group:"testing",order:4}]})}},LFi=class extends p5t{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"testing.peekRelatedTest",title:L(15862,"Peek Related Test"),category:qu,precondition:C.and(oo.canGoToRelatedTest,C.not(oo.activeEditorHasTests.key),tg.notInPeekEditor,pe.isInEmbeddedEditor.toNegated()),menu:[{id:D.EditorContext,group:"testing",order:5}]})}},m5t=class extends u5t{async _getLocationModel(i,e,t,o){let n=await mEo(this.testService,this.uriIdentityService,e.uri,t),r=await Promise.all(n.map(s=>this.testService.getCodeRelatedToTest(s)));return new Cw(r.flat(),d(15833,null))}_getNoResultFoundMessage(){return d(15827,null)}},RFi=class extends m5t{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:"testing.goToRelatedCode",title:L(15855,"Go to Related Code"),category:qu,precondition:C.and(oo.activeEditorHasTests,oo.canGoToRelatedCode),menu:[{id:D.EditorContext,group:"testing",order:4}]})}},MFi=class extends m5t{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"testing.peekRelatedCode",title:L(15861,"Peek Related Code"),category:qu,precondition:C.and(oo.activeEditorHasTests,oo.canGoToRelatedCode,tg.notInPeekEditor,pe.isInEmbeddedEditor.toNegated()),menu:[{id:D.EditorContext,group:"testing",order:5}]})}},PFi=class extends K{constructor(){super({id:"testing.toggleResultsViewLayout",title:L(15883,"Toggle Tree Position"),category:qu,icon:R.arrowSwap,menu:{id:D.ViewTitle,order:18,group:"navigation",when:C.equals("view","workbench.panel.testResults.view")}})}async run(i){let e=i.get(B),o=em(e,"testing.resultsView.layout")==="treeLeft"?"treeRight":"treeLeft";await e.updateValue("testing.resultsView.layout",o)}},gEo=[EFi,XOi,TFi,rFi,nFi,BOi,WOi,VOi,AOi,YOi,cFi,gFi,SFi,$Oi,pFi,POi,QOi,lFi,hFi,bFi,Eat,qOi,uFi,KOi,zOi,RFi,DFi,sFi,LOi,_Fi,CFi,MFi,LFi,kFi,vFi,kat,OOi,jOi,aFi,mFi,GOi,dFi,NOi,wFi,FOi,oFi,UOi,HOi,iFi,tFi,eFi,JOi,ZOi,xFi,PFi,MOi,ROi,IFi,yFi];function fEo(a,{onlyGroup:i,showConfigureButtons:e=!0,onlyForTest:t,onlyConfigurable:o,placeholder:n=d(15895,null)}){let r=a.get(uu),s=[],l=(u,p)=>{for(let h of Jg(u,(g,f)=>g.group-f.group)){let g=!1;if(i){if(h[0].group!==i)continue;g=!0}for(let f of h)o&&!f.hasConfigurationHandler||(g||(s.push({type:"separator",label:INt[h[0].group]}),g=!0),s.push({type:"item",profile:f,label:f.label,description:p,alwaysShow:!0,buttons:f.hasConfigurationHandler&&e?[{iconClass:q.asClassName(dat),tooltip:d(15896,null)}]:[]}))}};if(t!==void 0)l(r.getControllerProfiles(t.controllerId).filter(u=>tM(u,t)));else for(let{profiles:u,controller:p}of r.all())l(u,p.label.get());let c=a.get(Ue).createQuickPick({useSeparators:!0});return c.items=s,c.placeholder=n,c}var vEo=(a,i)=>e=>{let t=e.item.profile;t&&(a.configure(t.controllerId,t.profileId),i(void 0))};$e.registerCommand({id:"vscode.pickMultipleTestProfiles",handler:async(a,i)=>{let e=a.get(uu),t=fEo(a,i);if(!t)return;let o=new N;o.add(t),t.canSelectMany=!0,i.selected&&(t.selectedItems=t.items.filter(r=>r.type==="item").filter(r=>i.selected.some(s=>s.controllerId===r.profile.controllerId&&s.profileId===r.profile.profileId)));let n=await new Promise(r=>{o.add(t.onDidAccept(()=>{let s=t.selectedItems;r(s.map(l=>l.profile).filter(lo))})),o.add(t.onDidHide(()=>r(void 0))),o.add(t.onDidTriggerItemButton(vEo(e,r))),t.show()});return o.dispose(),n}});$e.registerCommand({id:"vscode.pickTestProfile",handler:async(a,i)=>{let e=a.get(uu),t=fEo(a,i);if(!t)return;let o=new N;o.add(t);let n=await new Promise(r=>{o.add(t.onDidAccept(()=>r(t.selectedItems[0]?.profile))),o.add(t.onDidHide(()=>r(void 0))),o.add(t.onDidTriggerItemButton(vEo(e,r))),t.show()});return o.dispose(),n}});var eHe=(a,i)=>{if(!a)return[];let e=Ur.fromString(a.item.extId);return[[oo.testItemExtId.key,e.localId],[oo.controllerId.key,a.controllerId],[oo.testItemHasUri.key,!!a.item.uri],...yNt(i)]};var Kun=/^\x1b\[([0-9]+)m$/;var mve=a=>typeof a=="string"?zS(a):Da(a),bEo=(a,i)=>{let e=[];return i.changeDecorations(t=>{let o=new ye(1,1),n=[];for(let r of DGi(a))if(r.isCode){let s=Kun.exec(r.str)?.[1];if(!s)continue;let l=Number(s);l===0?n.length=0:l===22?n=n.filter(c=>c!=="tstm-ansidec-1"&&c!=="tstm-ansidec-3"):l===23?n=n.filter(c=>c!=="tstm-ansidec-3"):l===24?n=n.filter(c=>c!=="tstm-ansidec-4"):l>=30&&l<=39||l>=90&&l<=99?(n=n.filter(c=>!c.startsWith("tstm-ansidec-fg")),n.push("tstm-ansidec-fg"+s)):l>=40&&l<=49||l>=100&&l<=109?(n=n.filter(c=>!c.startsWith("tstm-ansidec-bg")),n.push("tstm-ansidec-bg"+s)):n.push("tstm-ansidec-"+s)}else{let s=o.lineNumber,l=o.column,c=new A$(r.str);for(let p=0;!c.eol();p+=c.nextGraphemeLength())r.str[p]===`
`?(s++,l=1):l++;let u=new ye(s,l);n.length&&e.push(t.addDecoration(z.fromPositions(o,u),{inlineClassName:n.join(" "),description:"test-message-colorized"})),o=u}}),Z(()=>i.removeDecorations(e))};var AFi=(a,i)=>({$mid:18,test:JR.serialize(a),message:JF.serialize(i)}),SEo=a=>a instanceof Um&&!!a.stack?.length,Um=class{constructor(i,e,t,o){this.result=i;this.taskIndex=t;this.messageIndex=o;this.test=e.item;let n=e.tasks[t].messages;this.messageIndex=o;let r={messageIndex:o,resultId:i.id,taskIndex:t,testExtId:e.item.extId};this.expectedUri=uL({...r,type:4}),this.actualUri=uL({...r,type:3}),this.messageUri=uL({...r,type:2});let s=this.message=n[this.messageIndex];this.context=AFi(e,s),this.revealLocation=s.location??(e.item.uri&&e.item.range?{uri:e.item.uri,range:z.lift(e.item.range)}:void 0)}get controllerId(){return Ur.root(this.test.extId)}get isDiffable(){return this.message.type===0&&JF.isDiffable(this.message)}get contextValue(){return this.message.type===0?this.message.contextValue:void 0}get stack(){return this.message.type===0&&this.message.stackTrace?.length?this.message.stackTrace:void 0}},FS=class{constructor(i,e){this.result=i;this.taskIndex=e;this.outputUri=uL({resultId:i.id,taskIndex:e,type:0})}get controllerId(){return this.result.tasks[this.taskIndex].ctrlId}},WS=class{constructor(i,e,t){this.result=i;this.taskIndex=e;this.test=t;this.outputUri=uL({resultId:this.result.id,taskIndex:this.taskIndex,testExtId:this.test.item.extId,type:1}),this.task=i.tasks[this.taskIndex]}get controllerId(){return Ur.root(this.test.item.extId)}},IEo=(a,i)=>a instanceof Um&&i instanceof Um&&a.message===i.message||a instanceof FS&&i instanceof FS&&a.result===i.result&&a.taskIndex===i.taskIndex||a instanceof WS&&i instanceof WS&&a.test===i.test&&a.taskIndex===i.taskIndex,tHe=(a,i)=>{for(let e=0;e<a.tasks.length;e++){let t=a.tasks[e];for(let o=0;o<t.messages.length;o++){let n=i(t,t.messages[o],o,e);if(n!==void 0)return n}}},yEo=a=>{if(a instanceof Um)return a.test;if(!(a instanceof FS))return a.test.item};var Ine=class{constructor(i,e,t=1,o=1){this.name=i;this.source=e;this.line=t;this.column=o}},rHe=class{constructor(i,e){this.label=i;this.load=e}},Dat=class{constructor(){this.showHeader=Me("CustomStackFrame.showHeader",!0)}},f5t=class extends Ine{constructor(e){super(e.name,e.source,e.line,e.column);this.editorHeight=Me("WrappedCallStackFrame.height",this.source?100:0);this.collapsed=Me("WrappedCallStackFrame.collapsed",!1);this.height=ke(e=>this.collapsed.read(e)?sHe:sHe+this.editorHeight.read(e))}},hve=class{constructor(i){this.original=i;this.collapsed=Me("WrappedCallStackFrame.collapsed",!1);this.height=ke(i=>{let e=this.original.showHeader.read(i)?sHe:0;return this.collapsed.read(i)?e:e+this.original.height.read(i)})}},Gun=a=>a instanceof f5t||a instanceof hve,wEo="multiCallStackWidget",iHe=class extends x{constructor(e,t,o){super();this.layoutEmitter=this._register(new E);this.currentFramesDs=this._register(new N);e.classList.add(wEo),this._register(Z(()=>e.classList.remove(wEo))),this.list=this._register(o.createInstance(Vl,"TestResultStackWidget",e,new NFi,[o.createInstance(vne,t,this.layoutEmitter.event),o.createInstance(bne),o.createInstance(v5t),o.createInstance(Sne,n=>this.loadFrame(n))],{multipleSelectionSupport:!1,mouseSupport:!1,keyboardSupport:!1,setRowLineHeight:!1,alwaysConsumeMouseWheel:!1,accessibilityProvider:o.createInstance(_at)}))}get onDidChangeContentHeight(){return this.list.onDidChangeContentHeight}get onDidScroll(){return this.list.onDidScroll}get contentHeight(){return this.list.contentHeight}setFrames(e){this.currentFramesDs.clear();let t=new Ye;this.currentFramesDs.add(Z(()=>t.dispose(!0))),this.cts=t,this.list.splice(0,this.list.length,this.mapFrames(e))}layout(e,t){this.list.layout(e,t),this.layoutEmitter.fire()}collapseAll(){Gi(e=>{for(let t=0;t<this.list.length;t++){let o=this.list.element(t);Gun(o)&&o.collapsed.set(!0,e)}})}async loadFrame(e){if(!this.cts)return;let t=await e.load(this.cts.token);if(this.cts.token.isCancellationRequested)return;let o=this.list.indexOf(e);this.list.splice(o,1,this.mapFrames(t))}mapFrames(e){let t=[];for(let o of e){if(o instanceof rHe){t.push(o);continue}let n=o instanceof Dat?new hve(o):new f5t(o);t.push(n),this.currentFramesDs.add(be(r=>{let s=n.height.read(r),l=this.list.indexOf(n);l!==-1&&this.list.updateElementHeight(l,s)}))}return t}};iHe=I([m(2,F)],iHe);var _at=class{constructor(i){this.labelService=i}getAriaLabel(i){if(i instanceof rHe)return i.label;if(i instanceof hve)return i.original.label;if(i instanceof Ine)return i.source&&i.line?d(9359,null,i.name,i.line,this.labelService.getUriLabel(i.source,{relative:!0})):i.name;os(i)}getWidgetAriaLabel(){return d(9358,null)}};_at=I([m(0,rt)],_at);var NFi=class{getHeight(i){if(i instanceof Ine||i instanceof hve)return i.height.get();if(i instanceof rHe)return sHe;os(i)}getTemplateId(i){if(i instanceof Ine)return i.source?vne.templateId:bne.templateId;if(i instanceof rHe)return Sne.templateId;if(i instanceof hve)return v5t.templateId;os(i)}},CEo={scrollBeyondLastLine:!1,scrollbar:{vertical:"hidden",horizontal:"hidden",handleMouseWheel:!1,useShadows:!1},overviewRulerLanes:0,fixedOverflowWidgets:!0,overviewRulerBorder:!1,stickyScroll:{enabled:!1},minimap:{enabled:!1},readOnly:!0,automaticLayout:!1},kEo=()=>ct("div.multiCallStackFrame",[ct("div.header@header",[ct("div.collapse-button@collapseButton"),ct("div.title.show-file-icons@title"),ct("div.actions@actions")]),ct("div.editorParent",[ct("div.editorContainer@editor")])]),sHe=24,oHe=class{constructor(i){this.instantiationService=i}renderTemplate(i){let e=kEo();i.appendChild(e.root);let t=new N;i.classList.add("multiCallStackFrameContainer"),t.add(Z(()=>{i.classList.remove("multiCallStackFrameContainer"),e.root.remove()}));let o=t.add(this.instantiationService.createInstance(Tk,e.title,{})),n=t.add(new Wi(e.collapseButton,{})),r=xt();return e.editor.id=r,e.editor.role="region",e.collapseButton.setAttribute("aria-controls",r),this.finishRenderTemplate({container:i,decorations:[],elements:e,label:o,collapse:n,elementStore:t.add(new N),templateStore:t})}renderElement(i,e,t){let{elementStore:o}=t;o.clear();let n=i;this.setupCollapseButton(n,t)}setupCollapseButton(i,{elementStore:e,elements:t,collapse:o}){e.add(be(r=>{o.element.className="";let s=i.collapsed.read(r);o.icon=s?R.chevronRight:R.chevronDown,o.element.ariaExpanded=String(!s),t.root.classList.toggle("collapsed",s)}));let n=()=>i.collapsed.set(!i.collapsed.get(),void 0);e.add(o.onDidClick(n)),e.add(j(t.title,"click",n))}disposeElement(i,e,t){t.elementStore.clear()}disposeTemplate(i){i.templateStore.dispose()}};oHe=I([m(0,F)],oHe);var xEo=2,vne=class extends oHe{constructor(e,t,o,n){super(n);this.containingEditor=e;this.onLayout=t;this.modelService=o;this.templateId=vne.templateId}static{this.templateId="f"}finishRenderTemplate(e){let t=[{id:nHe.ID,instantiation:2,ctor:nHe}],o=this.containingEditor?this.instantiationService.createInstance(id,e.elements.editor,CEo,{isSimpleWidget:!0,contributions:t},this.containingEditor):this.instantiationService.createInstance(Xr,e.elements.editor,CEo,{isSimpleWidget:!0,contributions:t});e.templateStore.add(o);let n=e.templateStore.add(this.instantiationService.createInstance(or,e.elements.actions,D.DebugCallStackToolbar,{menuOptions:{shouldForwardArgs:!0},actionViewItemProvider:(r,s)=>Bs(this.instantiationService,r,s)}));return{...e,editor:o,toolbar:n}}renderElement(e,t,o){super.renderElement(e,t,o);let{elementStore:n,editor:r}=o,s=e,l=s.source;o.label.element.setFile(l);let c=new Ye;n.add(Z(()=>c.dispose(!0))),this.modelService.createModelReference(l).then(u=>{if(c.token.isCancellationRequested)return u.dispose();n.add(u),r.setModel(u.object.textEditorModel),this.setupEditorAfterModel(s,o),this.setupEditorLayout(s,o)})}setupEditorLayout(e,{elementStore:t,container:o,editor:n}){let r=()=>{let s=n.getContentHeight();n.layout({width:o.clientWidth,height:s});let l=n.getContentHeight();l!==s&&n.layout({width:o.clientWidth,height:l}),e.editorHeight.set(l,void 0)};t.add(n.onDidChangeModelDecorations(r)),t.add(n.onDidChangeModelContent(r)),t.add(n.onDidChangeModelOptions(r)),t.add(this.onLayout(r)),r()}setupEditorAfterModel(e,t){let o=z.fromPositions({column:e.column??1,lineNumber:e.line??1});t.toolbar.context={uri:e.source,range:o},t.editor.setHiddenAreas([z.fromPositions({column:1,lineNumber:1},{column:1,lineNumber:Math.max(1,e.line-xEo-1)}),z.fromPositions({column:1,lineNumber:e.line+xEo+1},{column:1,lineNumber:1073741824})]),t.editor.changeDecorations(n=>{for(let c of t.decorations)n.removeDecoration(c);t.decorations.length=0;let r=o.setStartPosition(o.startLineNumber,1),s=!!t.editor.getModel()?.getValueInRange(r).trim(),l=o.setEndPosition(o.startLineNumber,1073741824);t.decorations.push(n.addDecoration(l,dRi(!s))),t.decorations.push(n.addDecoration(l,cRi))}),e.editorHeight.set(t.editor.getContentHeight(),void 0)}};vne=I([m(2,Bt),m(3,F)],vne);var bne=class{constructor(i){this.instantiationService=i;this.templateId=bne.templateId}static{this.templateId="m"}renderTemplate(i){let e=kEo();e.root.classList.add("missing"),i.appendChild(e.root);let t=this.instantiationService.createInstance(Tk,e.title,{});return{elements:e,label:t}}renderElement(i,e,t){let o=i;t.label.element.setResource({name:o.name,description:d(9357,null,o.line,o.column),range:{startLineNumber:o.line,startColumn:o.column,endColumn:o.column,endLineNumber:o.line}},{icon:R.fileBinary})}disposeTemplate(i){i.label.dispose(),i.elements.root.remove()}};bne=I([m(0,F)],bne);var v5t=class a extends oHe{constructor(){super(...arguments);this.templateId=a.templateId}static{this.templateId="c"}finishRenderTemplate(e){return e}renderElement(e,t,o){super.renderElement(e,t,o);let n=e,{elementStore:r,container:s,label:l}=o;l.element.setResource({name:n.original.label},{icon:n.original.icon}),r.add(be(u=>{o.elements.header.style.display=n.original.showHeader.read(u)?"":"none"})),r.add(il((u,p)=>{n.collapsed.read(u)||p.add(n.original.render(s))}));let c=n.original.renderActions?.(o.elements.actions);c&&r.add(c)}},Sne=class{constructor(i,e){this.loadFrames=i;this.notificationService=e;this.templateId=Sne.templateId}static{this.templateId="s"}renderTemplate(i){let e=new N,t=new Wi(i,{title:"",...Qo}),o={button:t,store:e};return e.add(t),e.add(t.onDidClick(()=>{!o.current||!t.enabled||(t.enabled=!1,this.loadFrames(o.current).catch(n=>{this.notificationService.error(d(9355,null,n.message))}))})),o}renderElement(i,e,t){let o=i;t.button.enabled=!0,t.button.label=o.label,t.current=o}disposeTemplate(i){i.store.dispose()}};Sne=I([m(1,Ne)],Sne);var nHe=class extends x{constructor(e,t){super();this.editor=e;this.linkDecorations=e.createDecorationsCollection(),this._register(Z(()=>this.linkDecorations.clear()));let o=this._register(new JO(e));this._register(o.onMouseMoveOrRelevantKeyDown(([n,r])=>{this.onMove(n)})),this._register(o.onExecute(n=>{let r=this.editor.getModel();!this.current||!r||t.openEditor({resource:r.uri,options:{selection:z.fromPositions(new ye(this.current.line,this.current.word.startColumn)),selectionRevealType:1}},n.hasSideBySideModifier?In:void 0)}))}static{this.ID="clickToLocation"}onMove(e){if(!e.hasTriggerModifier)return this.clear();let t=e.target.position,o=t&&this.editor.getModel()?.getWordAtPosition(t);if(!o)return this.clear();let n=this.current?.word;n&&n.startColumn===o.startColumn&&n.endColumn===o.endColumn&&n.word===o.word||(this.current={word:o,line:t.lineNumber},this.linkDecorations.set([{range:new z(t.lineNumber,o.startColumn,t.lineNumber,o.endColumn),options:{description:"call-stack-go-to-file-link",inlineClassName:"call-stack-go-to-file-link"}}]))}clear(){this.linkDecorations.clear(),this.current=void 0}};nHe=I([m(1,ee)],nHe);W(class extends K{constructor(){super({id:"callStackWidget.goToFile",title:L(9356,"Open File"),icon:R.goToFile,menu:{id:D.DebugCallStackToolbar,order:22,group:"navigation"}})}async run(a,{uri:i,range:e}){await a.get(ee).openEditor({resource:i,options:{selection:e,selectionRevealType:1}})}});function nE(a,i={}){let e="";return i.excludeLeadingNewLine||(e+=`\r
`),e+="\x1B[0m\x1B[7m * ",i.loudFormatting?e+="\x1B[0;104m":e+="\x1B[0m",e+=` ${a} \x1B[0m
\r`,e}var Lat=class a{constructor(i,e){this._xterm=i;this._properties=e}get command(){return this._properties.command}get commandLineConfidence(){return this._properties.commandLineConfidence}get isTrusted(){return this._properties.isTrusted}get timestamp(){return this._properties.timestamp}get duration(){return this._properties.duration}get promptStartMarker(){return this._properties.promptStartMarker}get marker(){return this._properties.marker}get endMarker(){return this._properties.endMarker}set endMarker(i){this._properties.endMarker=i}get executedMarker(){return this._properties.executedMarker}get aliases(){return this._properties.aliases}get wasReplayed(){return this._properties.wasReplayed}get cwd(){return this._properties.cwd}get exitCode(){return this._properties.exitCode}get commandStartLineContent(){return this._properties.commandStartLineContent}get markProperties(){return this._properties.markProperties}get executedX(){return this._properties.executedX}get startX(){return this._properties.startX}get id(){return this._properties.id}static deserialize(i,e,t){let o=i.buffer.normal,n=e.startLine!==void 0?i.registerMarker(e.startLine-(o.baseY+o.cursorY)):void 0;if(!n)return;let r=e.promptStartLine!==void 0?i.registerMarker(e.promptStartLine-(o.baseY+o.cursorY)):void 0,s=e.endLine!==void 0?i.registerMarker(e.endLine-(o.baseY+o.cursorY)):void 0,l=e.executedLine!==void 0?i.registerMarker(e.executedLine-(o.baseY+o.cursorY)):void 0;return new a(i,{command:t?"":e.command,commandLineConfidence:e.commandLineConfidence??"low",isTrusted:e.isTrusted,id:e.id,promptStartMarker:r,marker:n,startX:e.startX,endMarker:s,executedMarker:l,executedX:e.executedX,timestamp:e.timestamp,duration:e.duration,cwd:e.cwd,commandStartLineContent:e.commandStartLineContent,exitCode:e.exitCode,markProperties:e.markProperties,aliases:void 0,wasReplayed:!0})}serialize(i){return{promptStartLine:this.promptStartMarker?.line,startLine:this.marker?.line,startX:void 0,endLine:this.endMarker?.line,executedLine:this.executedMarker?.line,executedX:this.executedX,command:i?"":this.command,commandLineConfidence:i?"low":this.commandLineConfidence,isTrusted:this.isTrusted,cwd:this.cwd,exitCode:this.exitCode,commandStartLineContent:this.commandStartLineContent,timestamp:this.timestamp,duration:this.duration,markProperties:this.markProperties,id:this.id}}extractCommandLine(){return TEo(this._xterm.buffer.active,this._xterm.cols,this.marker,this.startX,this.executedMarker,this.executedX)}getOutput(){if(!this.executedMarker||!this.endMarker)return;let i=this.executedMarker.line,e=this.endMarker.line;if(i===e)return;let t="",o="",n,r=this._xterm.buffer.active;for(let s=i;s<e;s++){if(n=r.getLine(s),!n)continue;let l=s+1<e?!!r.getLine(s+1)?.isWrapped:!1;o+=n.translateToString(!l),l||(t+=o+`
`,o="")}return o.length>0&&(t+=o),t===""?void 0:t}getOutputMatch(i){if(!this.executedMarker||!this.endMarker)return;let e=this.endMarker.line;if(e===-1)return;let t=this._xterm.buffer.active,o=Math.max(this.executedMarker.line,0),n=i.lineMatcher,r=Fe(n)?1:i.length||qun(n),s=[],l;if(i.anchor==="bottom")for(let c=e-(i.offset||0);c>=o;c--){let u=c,p=c;for(;u>=o&&t.getLine(u)?.isWrapped;)u--;if(c=u,s.unshift(EEo(t,u,p,this._xterm.cols)),l||(l=s[0].match(n)),s.length>=r)break}else for(let c=o+(i.offset||0);c<e;c++){let u=c,p=c;for(;p+1<e&&t.getLine(p+1)?.isWrapped;)p++;if(c=p,s.push(EEo(t,u,p,this._xterm.cols)),l||(l=s[s.length-1].match(n)),s.length>=r)break}return l?{regexMatch:l,outputLines:s}:void 0}hasOutput(){return!this.executedMarker?.isDisposed&&!this.endMarker?.isDisposed&&!!(this.executedMarker&&this.endMarker&&this.executedMarker.line<this.endMarker.line)}getPromptRowCount(){return _Eo(this,this._xterm.buffer.active)}getCommandRowCount(){return DEo(this)}},Rat=class{constructor(i,e){this._xterm=i;this.id=e??xt()}serialize(i){if(this.commandStartMarker)return{promptStartLine:this.promptStartMarker?.line,startLine:this.commandStartMarker.line,startX:this.commandStartX,endLine:void 0,executedLine:void 0,executedX:void 0,command:"",commandLineConfidence:"low",isTrusted:!0,cwd:i,exitCode:void 0,commandStartLineContent:void 0,timestamp:0,duration:0,markProperties:void 0,id:this.id}}promoteToFullCommand(i,e,t,o){if(e===void 0&&this.command===void 0&&(this.command=""),this.command!==void 0&&!this.command.startsWith("\\")||t)return new Lat(this._xterm,{command:t?"":this.command||"",commandLineConfidence:t?"low":this.commandLineConfidence||"low",isTrusted:!!this.isTrusted,id:this.id,promptStartMarker:this.promptStartMarker,marker:this.commandStartMarker,startX:this.commandStartX,endMarker:this.commandFinishedMarker,executedMarker:this.commandExecutedMarker,executedX:this.commandExecutedX,timestamp:Date.now(),duration:this.commandDuration||0,cwd:i,exitCode:e,commandStartLineContent:this.commandStartLineContent,markProperties:o})}markExecutedTime(){this.commandExecutedTimestamp===void 0&&(this.commandExecutedTimestamp=Date.now())}markFinishedTime(){this.commandDuration===void 0&&this.commandExecutedTimestamp!==void 0&&(this.commandDuration=Date.now()-this.commandExecutedTimestamp)}extractCommandLine(){return TEo(this._xterm.buffer.active,this._xterm.cols,this.commandStartMarker,this.commandStartX,this.commandExecutedMarker,this.commandExecutedX)}getPromptRowCount(){return _Eo(this,this._xterm.buffer.active)}getCommandRowCount(){return DEo(this)}};function TEo(a,i,e,t,o,n){if(!e||!o||t===void 0||n===void 0)return"";let r="";for(let s=e.line;s<=o.line;s++){let l=a.getLine(s);l&&(r+=l.translateToString(!0,s===e.line?t:0,s===o.line?n:i))}return r}function EEo(a,i,e,t){let o=Math.max(2048/t*2);e=Math.min(e,i+o);let n="";for(let r=i;r<=e;r++){let s=a.getLine(r);s&&(n+=s.translateToString(!0,0,t))}return n}function qun(a){if(!a.multiline)return 1;let i=a.source,e=1,t=i.indexOf("\\n");for(;t!==-1;)e++,t=i.indexOf("\\n",t+1);return e}function _Eo(a,i){let e=nC(a)?a.marker:a.commandStartMarker;if(!e||!a.promptStartMarker)return 1;let t=1,o=a.promptStartMarker.line;for(;o<e.line&&(i.getLine(o)?.translateToString(!0)??"").length===0;)o++;return t=e.line-o+1,t}function DEo(a){let i=nC(a)?a.marker:a.commandStartMarker,e=nC(a)?a.executedMarker:a.commandExecutedMarker;if(!i||!e)return 1;let o=Math.max(e.line,i.line)-i.line+1;return(nC(a)?a.executedX:a.commandExecutedX)===0&&o--,o}function nC(a){return!!a.hasOutput}var aHe=class extends x{constructor(e,t,o){super();this._capabilities=e;this._configurationService=t;this._themeService=o;this._currentMarker=1;this._selectionStart=null;this._isDisposable=!1;this._commandGuideDecorations=this._register(new me)}activate(e){this._terminal=e,this._register(this._terminal.onData(()=>{this._currentMarker=1}))}_getMarkers(e){let t=this._capabilities.get(2),o=this._capabilities.get(3),n=this._capabilities.get(4),r=[];if(t?(r=di(t.commands.filter(s=>e?s.exitCode!==void 0:!0).map(s=>s.promptStartMarker??s.marker)),t.currentCommand?.promptStartMarker&&t.currentCommand.commandExecutedMarker&&r.push(t.currentCommand?.promptStartMarker)):o&&r.push(...o.commands),n&&!e){let s=n.markers().next()?.value,l=[];for(;s;)l.push(s),s=n.markers().next()?.value;r=l}return r}_findCommand(e){let t=this._capabilities.get(2);if(t){let o=t.commands.find(n=>n.marker?.line===e.line||n.promptStartMarker?.line===e.line);if(o)return o;if(t.currentCommand)return t.currentCommand}}clear(){this._currentMarker=1,this._resetNavigationDecorations(),this._selectionStart=null}_resetNavigationDecorations(){this._navigationDecorations&&Be(this._navigationDecorations),this._navigationDecorations=[]}_isEmptyCommand(e){return e===1?!0:e===0?!this._getMarkers(!0).map(t=>t.line).includes(0):!this._getMarkers(!0).includes(e)}scrollToPreviousMark(e=1,t=!1,o=!0){if(!this._terminal)return;t||(this._selectionStart=null);let n,r=typeof this._currentMarker=="object"?this.getTargetScrollLine(this._currentMarker.line,e):Math.min(Mat(this._terminal,this._currentMarker),this._terminal.buffer.active.baseY),s=this._terminal.buffer.active.viewportY;if(typeof this._currentMarker=="object"?!this._isMarkerInViewport(this._terminal,this._currentMarker):r!==s){let l=this._getMarkers(o).filter(c=>c.line>=s).length;n=this._getMarkers(o).length-l-1}else this._currentMarker===1?n=this._getMarkers(o).length-1:this._currentMarker===0?n=-1:this._isDisposable?(n=this._findPreviousMarker(o),this._currentMarker.dispose(),this._isDisposable=!1):o&&this._isEmptyCommand(this._currentMarker)?n=this._findPreviousMarker(!0):n=this._getMarkers(o).indexOf(this._currentMarker)-1;if(n<0){this._currentMarker=0,this._terminal.scrollToTop(),this._resetNavigationDecorations();return}this._currentMarker=this._getMarkers(o)[n],this._scrollToCommand(this._currentMarker,e)}scrollToNextMark(e=1,t=!1,o=!0){if(!this._terminal)return;t||(this._selectionStart=null);let n,r=typeof this._currentMarker=="object"?this.getTargetScrollLine(this._currentMarker.line,e):Math.min(Mat(this._terminal,this._currentMarker),this._terminal.buffer.active.baseY),s=this._terminal.buffer.active.viewportY;if((typeof this._currentMarker=="object"?!this._isMarkerInViewport(this._terminal,this._currentMarker):r!==s)?n=this._getMarkers(o).filter(c=>c.line<=s).length:this._currentMarker===1?n=this._getMarkers(o).length:this._currentMarker===0?n=0:this._isDisposable?(n=this._findNextMarker(o),this._currentMarker.dispose(),this._isDisposable=!1):o&&this._isEmptyCommand(this._currentMarker)?n=this._findNextMarker(!0):n=this._getMarkers(o).indexOf(this._currentMarker)+1,n>=this._getMarkers(o).length){this._currentMarker=1,this._terminal.scrollToBottom(),this._resetNavigationDecorations();return}this._currentMarker=this._getMarkers(o)[n],this._scrollToCommand(this._currentMarker,e)}_scrollToCommand(e,t){let o=this._findCommand(e);o?this.revealCommand(o,t):this._scrollToMarker(e,t)}_scrollToMarker(e,t,o,n){if(this._terminal){if(!this._isMarkerInViewport(this._terminal,e)||n?.forceScroll){let r=this.getTargetScrollLine(yne(e),t);this._terminal.scrollToLine(r)}n?.hideDecoration||(n?.bufferRange?this._highlightBufferRange(n.bufferRange):this.registerTemporaryDecoration(e,o,!0))}}_createMarkerForOffset(e,t){if(t===0&&LEo(e))return e;{let o=this._terminal?.registerMarker(-this._terminal.buffer.active.cursorY+yne(e)-this._terminal.buffer.active.baseY+t);if(o)return o;throw new Error(`Could not register marker with offset ${yne(e)}, ${t}`)}}revealCommand(e,t=1){let o=nC(e)?e.marker:e.commandStartMarker;if(!this._terminal||!o)return;let n=yne(o),r=e.getPromptRowCount(),s=e.getCommandRowCount();this._scrollToMarker(n-(r-1),t,n+(s-1))}revealRange(e){this._scrollToMarker(e.start.y-1,1,e.end.y-1,{bufferRange:e,forceScroll:!!this._configurationService.getValue(jl.StickyScrollEnabled)})}showCommandGuide(e){if(this._terminal){if(!e){this._commandGuideDecorations.clear(),this._activeCommandGuide=void 0;return}if(this._activeCommandGuide!==e&&e.marker){this._activeCommandGuide=e;let t=this._commandGuideDecorations.value=new N;if(!e.executedMarker||!e.endMarker)return;let o=e.marker.line-(e.getPromptRowCount()-1),n=yne(e.endMarker)-o;if(n>200)return;for(let r=0;r<n;r++){let s=this._terminal.registerDecoration({marker:this._createMarkerForOffset(o,r)});if(s){t.add(s);let l;t.add(s.onRender(c=>{l||(l=c,c.classList.add("terminal-command-guide"),r===0&&c.classList.add("top"),r===n-1&&c.classList.add("bottom"))}))}}}}}saveScrollState(){this._scrollState={viewportY:this._terminal?.buffer.active.viewportY??0}}restoreScrollState(){this._scrollState&&this._terminal&&(this._terminal.scrollToLine(this._scrollState.viewportY),this._scrollState=void 0)}_highlightBufferRange(e){if(!this._terminal)return;this._resetNavigationDecorations();let t=e.start.y,o=e.end.y-e.start.y+1;for(let n=0;n<o;n++){let r=this._terminal.registerDecoration({marker:this._createMarkerForOffset(t-1,n),x:e.start.x-1,width:e.end.x-1-(e.start.x-1)+1,overviewRulerOptions:void 0});if(r){this._navigationDecorations?.push(r);let s;r.onRender(l=>{s||(s=l,l.classList.add("terminal-range-highlight"))}),r.onDispose(()=>{this._navigationDecorations=this._navigationDecorations?.filter(l=>l!==r)})}}}registerTemporaryDecoration(e,t,o){if(!this._terminal)return;this._resetNavigationDecorations();let n=this._themeService.getColorTheme().getColor(uMt),r=yne(e),s=t?yne(t)-r+1:1;for(let l=0;l<s;l++){let c=this._terminal.registerDecoration({marker:this._createMarkerForOffset(e,l),width:this._terminal.cols,overviewRulerOptions:l===0?{color:n?.toString()||"#a0a0a0cc"}:void 0});if(c){this._navigationDecorations?.push(c);let u;c.onRender(p=>{u?p.classList.add("terminal-scroll-highlight"):(u=p,p.classList.add("terminal-scroll-highlight"),o&&p.classList.add("terminal-scroll-highlight-outline"),l===0&&p.classList.add("top"),l===s-1&&p.classList.add("bottom")),this._terminal?.element&&(p.style.marginLeft=`-${Re(this._terminal.element).getComputedStyle(this._terminal.element).paddingLeft}`)}),c.onDispose(()=>{this._navigationDecorations=this._navigationDecorations?.filter(p=>p!==c)}),o&&Li(350).then(()=>{u&&u.classList.remove("terminal-scroll-highlight-outline")})}}}scrollToLine(e,t){this._terminal?.scrollToLine(this.getTargetScrollLine(e,t))}getTargetScrollLine(e,t){return this._terminal&&t===1?Math.max(e-Math.floor(this._terminal.rows/4),0):e}_isMarkerInViewport(e,t){let o=e.buffer.active.viewportY,n=yne(t);return n>=o&&n<o+e.rows}scrollToClosestMarker(e,t,o){let n=this._capabilities.get(4);if(!n)return;let r=n.getMark(e);if(!r)return;let s=t?n.getMark(t):r;this._scrollToMarker(r,0,s,{hideDecoration:!o})}selectToPreviousMark(){this._terminal&&(this._selectionStart===null&&(this._selectionStart=this._currentMarker),this._capabilities.has(2)?this.scrollToPreviousMark(1,!0,!0):this.scrollToPreviousMark(1,!0,!1),b5t(this._terminal,this._currentMarker,this._selectionStart))}selectToNextMark(){this._terminal&&(this._selectionStart===null&&(this._selectionStart=this._currentMarker),this._capabilities.has(2)?this.scrollToNextMark(1,!0,!0):this.scrollToNextMark(1,!0,!1),b5t(this._terminal,this._currentMarker,this._selectionStart))}selectToPreviousLine(){this._terminal&&(this._selectionStart===null&&(this._selectionStart=this._currentMarker),this.scrollToPreviousLine(this._terminal,1,!0),b5t(this._terminal,this._currentMarker,this._selectionStart))}selectToNextLine(){this._terminal&&(this._selectionStart===null&&(this._selectionStart=this._currentMarker),this.scrollToNextLine(this._terminal,1,!0),b5t(this._terminal,this._currentMarker,this._selectionStart))}scrollToPreviousLine(e,t=1,o=!1){if(o||(this._selectionStart=null),this._currentMarker===0){e.scrollToTop();return}if(this._currentMarker===1)this._currentMarker=this._registerMarkerOrThrow(e,this._getOffset(e)-1);else{let n=this._getOffset(e);this._isDisposable&&this._currentMarker.dispose(),this._currentMarker=this._registerMarkerOrThrow(e,n-1)}this._isDisposable=!0,this._scrollToMarker(this._currentMarker,t)}scrollToNextLine(e,t=1,o=!1){if(o||(this._selectionStart=null),this._currentMarker===1){e.scrollToBottom();return}if(this._currentMarker===0)this._currentMarker=this._registerMarkerOrThrow(e,this._getOffset(e)+1);else{let n=this._getOffset(e);this._isDisposable&&this._currentMarker.dispose(),this._currentMarker=this._registerMarkerOrThrow(e,n+1)}this._isDisposable=!0,this._scrollToMarker(this._currentMarker,t)}_registerMarkerOrThrow(e,t){let o=e.registerMarker(t);if(!o)throw new Error(`Could not create marker for ${t}`);return o}_getOffset(e){if(this._currentMarker===1)return 0;if(this._currentMarker===0)return 0-(e.buffer.active.baseY+e.buffer.active.cursorY);{let t=Mat(e,this._currentMarker);return t-=e.buffer.active.baseY+e.buffer.active.cursorY,t}}_findPreviousMarker(e=!1){if(this._currentMarker===0)return 0;if(this._currentMarker===1)return this._getMarkers(e).length-1;let t;for(t=this._getMarkers(e).length-1;t>=0;t--)if(this._getMarkers(e)[t].line<this._currentMarker.line)return t;return-1}_findNextMarker(e=!1){if(this._currentMarker===0)return 0;if(this._currentMarker===1)return this._getMarkers(e).length-1;let t;for(t=0;t<this._getMarkers(e).length;t++)if(this._getMarkers(e)[t].line>this._currentMarker.line)return t;return this._getMarkers(e).length}};aHe=I([m(1,B),m(2,Le)],aHe);function Mat(a,i){return i===1?a.buffer.active.baseY+a.rows-1:i===0?0:i.line}function b5t(a,i,e){e===null&&(e=1);let t=Mat(a,i),o=Mat(a,e);if(t>o){let n=t;t=o,o=n}o-=1,a.selectLines(t,o)}function LEo(a){return typeof a!="number"}function yne(a){return LEo(a)?a.line:a}var gve=class extends x{constructor(e,t,o,n,r,s){super();this._xterm=e;this._logService=s;this._state=0;this._commandStartX=0;this._lastUserInput="";this._value="";this._cursorIndex=0;this._ghostTextIndex=-1;this._onDidStartInput=this._register(new E);this.onDidStartInput=this._onDidStartInput.event;this._onDidChangeInput=this._register(new E);this.onDidChangeInput=this._onDidChangeInput.event;this._onDidFinishInput=this._register(new E);this.onDidFinishInput=this._onDidFinishInput.event;this._onDidInterrupt=this._register(new E);this.onDidInterrupt=this._onDidInterrupt.event;this._register(U.any(this._xterm.onCursorMove,this._xterm.onData,this._xterm.onWriteParsed)(()=>this._sync())),this._register(this._xterm.onData(l=>this._handleUserInput(l))),this._register(t(l=>this._handleCommandStart(l))),this._register(o(()=>this._handleCommandStartChanged())),this._register(n(()=>this._handleCommandExecuted())),this._register(r(()=>this._handleCommandFinished())),this._register(this.onDidStartInput(()=>this._logCombinedStringIfTrace("PromptInputModel#onDidStartInput"))),this._register(this.onDidChangeInput(()=>this._logCombinedStringIfTrace("PromptInputModel#onDidChangeInput"))),this._register(this.onDidFinishInput(()=>this._logCombinedStringIfTrace("PromptInputModel#onDidFinishInput"))),this._register(this.onDidInterrupt(()=>this._logCombinedStringIfTrace("PromptInputModel#onDidInterrupt")))}get state(){return this._state}get value(){return this._value}get prefix(){return this._value.substring(0,this._cursorIndex)}get suffix(){return this._value.substring(this._cursorIndex,this._ghostTextIndex===-1?void 0:this._ghostTextIndex)}get cursorIndex(){return this._cursorIndex}get ghostTextIndex(){return this._ghostTextIndex}_logCombinedStringIfTrace(e){this._logService.getLevel()===1&&this._logService.trace(e,this.getCombinedString())}setShellType(e){this._shellType=e}setContinuationPrompt(e){this._continuationPrompt=e,this._sync()}setLastPromptLine(e){this._lastPromptLine=e,this._sync()}setConfidentCommandLine(e){this._value!==e&&(this._value=e,this._cursorIndex=-1,this._ghostTextIndex=-1,this._onDidChangeInput.fire(this._createStateObject()))}getCombinedString(e){let t=this._value.replaceAll(`
`,"\u23CE");if(this._cursorIndex===-1)return t;let o=`${t.substring(0,this.cursorIndex)}|`;return this.ghostTextIndex!==-1?(o+=`${t.substring(this.cursorIndex,this.ghostTextIndex)}[`,o+=`${t.substring(this.ghostTextIndex)}]`):o+=t.substring(this.cursorIndex),o==="|"&&e?"":o}serialize(){return{modelState:this._createStateObject(),commandStartX:this._commandStartX,lastPromptLine:this._lastPromptLine,continuationPrompt:this._continuationPrompt,lastUserInput:this._lastUserInput}}deserialize(e){this._value=e.modelState.value,this._cursorIndex=e.modelState.cursorIndex,this._ghostTextIndex=e.modelState.ghostTextIndex,this._commandStartX=e.commandStartX,this._lastPromptLine=e.lastPromptLine,this._continuationPrompt=e.continuationPrompt,this._lastUserInput=e.lastUserInput}_handleCommandStart(e){this._state!==1&&(this._state=1,this._commandStartMarker=e.marker,this._commandStartX=this._xterm.buffer.active.cursorX,this._value="",this._cursorIndex=0,this._onDidStartInput.fire(this._createStateObject()),this._onDidChangeInput.fire(this._createStateObject()),this._lastPromptLine&&this._commandStartX!==this._lastPromptLine.length&&this._xterm.buffer.active.getLine(this._commandStartMarker.line)?.translateToString(!0).startsWith(this._lastPromptLine)&&(this._commandStartX=this._lastPromptLine.length,this._sync()))}_handleCommandStartChanged(){this._state===1&&(this._commandStartX=this._xterm.buffer.active.cursorX,this._onDidChangeInput.fire(this._createStateObject()),this._sync())}_handleCommandExecuted(){if(this._state===2)return;this._cursorIndex=-1,this._ghostTextIndex!==-1&&(this._value=this._value.substring(0,this._ghostTextIndex),this._ghostTextIndex=-1);let e=this._createStateObject();this._lastUserInput===""&&(this._lastUserInput="",this._onDidInterrupt.fire(e)),this._state=2,this._onDidFinishInput.fire(e),this._onDidChangeInput.fire(e)}_handleCommandFinished(){this._value="",this._onDidChangeInput.fire(this._createStateObject())}_sync(){try{this._doSync()}catch(e){this._logService.error("Error while syncing prompt input model",e)}}_doSync(){if(this._state!==1)return;let e=this._commandStartMarker?.line;if(e===void 0)return;let t=this._xterm.buffer.active,o=t.getLine(e),n=t.baseY+t.cursorY,r,s=o?.translateToString(!0,this._commandStartX);if(this._shellType==="fish"&&(!o||!s)&&(e+=1,o=t.getLine(e),o&&(s=o.translateToString(!0),r=n===e?t.cursorX:s?.trimEnd().length)),o===void 0||s===void 0){this._logService.trace("PromptInputModel#_sync: no line");return}let l=s,c=-1;r===void 0&&(n===e?r=Math.min(this._getRelativeCursorIndex(this._commandStartX,t,o),s.length):r=s.trimEnd().length);for(let u=e+1;u<=n;u++){let p=t.getLine(u),h=p?.translateToString(!0);if(h&&p){if(p.isWrapped||n===u&&this._continuationPrompt&&!this._lineContainsContinuationPrompt(h)){l+=`${h}`;let g=this._getRelativeCursorIndex(0,t,p);n===u?r+=g:r+=h.length}else if(this._shellType==="fish")l.endsWith("\\")?(l=l.substring(0,l.length-1),l+=`${h.trim()}`,r+=h.trim().length-1):/^ {6,}/.test(h)?(l+=`
${h.trim()}`,r+=h.trim().length+1):(l+=h,r+=h.length);else if(this._continuationPrompt===void 0||this._lineContainsContinuationPrompt(h)){let g=this._trimContinuationPrompt(h);if(l+=`
${g}`,n===u){let f=this._getContinuationPromptCellWidth(p,h),v=this._getRelativeCursorIndex(f,t,p);r+=v+1}else r+=g.length+1}}}for(let u=n+1;u<t.baseY+this._xterm.rows;u++){let p=t.getLine(u),h=p?.translateToString(!0);if(h&&p)this._shellType==="fish"?l+=`${h}`:this._continuationPrompt===void 0||this._lineContainsContinuationPrompt(h)?l+=`
${this._trimContinuationPrompt(h)}`:l+=h;else break}this._logService.getLevel()===1&&this._logService.trace(`PromptInputModel#_sync: ${this.getCombinedString()}`);{let u=this._value.length-this._value.trimEnd().length;this._lastUserInput==="\x7F"&&(this._lastUserInput="",r===this._cursorIndex-1&&(this._value.trimEnd().length>l.trimEnd().length&&l.trimEnd().length<=r?u=Math.max(this._value.length-1-l.trimEnd().length,0):u=Math.max(u-1,0))),this._lastUserInput==="\x1B[3~"&&(this._lastUserInput="",r===this._cursorIndex&&(u=Math.max(u-1,0)));let p=l.split(`
`),h=p.length>1,g=l.trimEnd();if(!h){g.length<l.length&&(this._lastUserInput===" "&&(this._lastUserInput="",r>g.length&&r>this._cursorIndex&&u++),u=Math.max(r-g.length,u,0));let f=r===0?"":l[r-1];u>0&&r===this._cursorIndex+1&&this._lastUserInput!==""&&f!==" "&&(u=this._value.length-this._cursorIndex)}if(h){p[p.length-1]=p.at(-1)?.trimEnd()??"";let f=(p.length-1)*(this._continuationPrompt?.length??0);u=Math.max(0,r-l.length-f)}l=p.map(f=>f.trimEnd()).join(`
`)+" ".repeat(u)}c=this._scanForGhostText(t,o,r),(this._value!==l||this._cursorIndex!==r||this._ghostTextIndex!==c)&&(this._value=l,this._cursorIndex=r,this._ghostTextIndex=c,this._onDidChangeInput.fire(this._createStateObject()))}_handleUserInput(e){this._lastUserInput=e}_scanForGhostText(e,t,o){if(!this.value.trim().length)return-1;let n=-1,r=!1,s=e.cursorX;for(;s>0;){let l=t.getCell(--s);if(!l)break;if(l.getChars().trim().length>0){r=!this._isCellStyledLikeGhostText(l);break}}if(r){let l=0,c=e.cursorX;for(;c<t.length;){let u=t.getCell(c++);if(!u||u.getCode()===0)break;if(this._isCellStyledLikeGhostText(u)){n=o+l;break}l+=u.getChars().length}}return n===-1&&(n=this._scanForGhostTextAdvanced(e,t,o)),n>-1&&this.value.substring(n).endsWith(" ")&&(this._value=this.value.trim(),this.value.substring(n)||(n=-1)),n}_scanForGhostTextAdvanced(e,t,o){let n=-1,r=e.cursorX,s=new Map,l=t.getCell(r),c=l;for(;c&&r<t.length;){let p=this._getCellStyleAsString(c);s.set(p,[...s.get(p)??[],r]),c=t.getCell(++r),c?.getChars().trim().length&&(l=c)}if(!l?.getChars().trim().length||this._cellStylesMatch(t.getCell(this._commandStartX),l))return-1;let u=s.get(this._getCellStyleAsString(l));if(u){if(u[0]>e.cursorX+1&&this._isPositionRightPrompt(t,u[0]))return-1;for(let p=1;p<u.length;p++)if(u[p]!==u[p-1]+1)return-1;e.baseY+e.cursorY===this._commandStartMarker?.line?n=u[0]-this._commandStartX:n=u[0]}if(n!==-1)for(let p=e.cursorX;p>=this._commandStartX;p--){let h=t.getCell(p);if(h?.getChars.length&&h&&h.getCode()!==0&&this._cellStylesMatch(l,h))return-1}return n>=o?n:-1}_isPositionRightPrompt(e,t){let o=0;for(let n=t-1;n>=this._commandStartX;n--){let r=e.getCell(n);if(!r||r.getChars().trim().length===0){if(o++,o>=5)return!0}else o=0}return!1}_getCellStyleAsString(e){return`${e.getFgColor()}${e.getBgColor()}${e.isBold()}${e.isItalic()}${e.isDim()}${e.isUnderline()}${e.isBlink()}${e.isInverse()}${e.isInvisible()}${e.isStrikethrough()}${e.isOverline()}${e.getFgColorMode()}${e.getBgColorMode()}`}_cellStylesMatch(e,t){return!e||!t?!1:e.getFgColor()===t.getFgColor()&&e.getBgColor()===t.getBgColor()&&e.isBold()===t.isBold()&&e.isItalic()===t.isItalic()&&e.isDim()===t.isDim()&&e.isUnderline()===t.isUnderline()&&e.isBlink()===t.isBlink()&&e.isInverse()===t.isInverse()&&e.isInvisible()===t.isInvisible()&&e.isStrikethrough()===t.isStrikethrough()&&e.isOverline()===t.isOverline()&&e?.getBgColorMode()===t?.getBgColorMode()&&e?.getFgColorMode()===t?.getFgColorMode()}_trimContinuationPrompt(e){return this._lineContainsContinuationPrompt(e)&&(e=e.substring(this._continuationPrompt.length)),e}_lineContainsContinuationPrompt(e){return!!(this._continuationPrompt&&e.startsWith(this._continuationPrompt.trimEnd()))}_getContinuationPromptCellWidth(e,t){if(!this._continuationPrompt||!t.startsWith(this._continuationPrompt.trimEnd()))return 0;let o="",n=0,r;for(;o!==this._continuationPrompt&&(r=e.getCell(n++),!!r);)o+=r.getChars();return n}_getRelativeCursorIndex(e,t,o){return o?.translateToString(!1,e,t.cursorX).length??0}_isCellStyledLikeGhostText(e){return!!(e.isItalic()||e.isDim())}_createStateObject(){return Object.freeze({value:this._value,prefix:this.prefix,suffix:this.suffix,cursorIndex:this._cursorIndex,ghostTextIndex:this._ghostTextIndex})}};I([_P(0)],gve.prototype,"_sync",1),gve=I([m(5,se)],gve);var fve=class extends x{constructor(e,t){super();this._terminal=e;this._logService=t;this.type=2;this._commands=[];this._commandMarkers=[];this.__isCommandStorageDisabled=!1;this._hasRichCommandDetection=!1;this._onCommandStarted=this._register(new E);this.onCommandStarted=this._onCommandStarted.event;this._onCommandStartChanged=this._register(new E);this.onCommandStartChanged=this._onCommandStartChanged.event;this._onBeforeCommandFinished=this._register(new E);this.onBeforeCommandFinished=this._onBeforeCommandFinished.event;this._onCommandFinished=this._register(new E);this.onCommandFinished=this._onCommandFinished.event;this._onCommandExecuted=this._register(new E);this.onCommandExecuted=this._onCommandExecuted.event;this._onCommandInvalidated=this._register(new E);this.onCommandInvalidated=this._onCommandInvalidated.event;this._onCurrentCommandInvalidated=this._register(new E);this.onCurrentCommandInvalidated=this._onCurrentCommandInvalidated.event;this._onSetRichCommandDetection=this._register(new E);this.onSetRichCommandDetection=this._onSetRichCommandDetection.event;this._currentCommand=new Rat(this._terminal),this._promptInputModel=this._register(new gve(this._terminal,this.onCommandStarted,this.onCommandStartChanged,this.onCommandExecuted,this.onCommandFinished,this._logService)),this._register(this.onCommandExecuted(n=>{if(n.commandLineConfidence!=="high"){let r=n;n.command=r.extractCommandLine(),n.commandLineConfidence="low",nC(r)?r.promptStartMarker&&r.marker&&r.executedMarker&&n.command.indexOf(`
`)===-1&&r.startX!==void 0&&r.startX>0&&(n.commandLineConfidence="medium"):r.promptStartMarker&&r.commandStartMarker&&r.commandExecutedMarker&&n.command.indexOf(`
`)===-1&&r.commandStartX!==void 0&&r.commandStartX>0&&(n.commandLineConfidence="medium")}})),this._register(this._terminal.parser.registerCsiHandler({final:"J"},n=>(n.length>=1&&n[0]===2&&(this._terminal.options.scrollOnEraseInDisplay||this._clearCommandsInViewport(),this._currentCommand.wasCleared=!0),!1)));let o=this;this._ptyHeuristicsHooks=new class{get onCurrentCommandInvalidatedEmitter(){return o._onCurrentCommandInvalidated}get onCommandStartedEmitter(){return o._onCommandStarted}get onCommandExecutedEmitter(){return o._onCommandExecuted}get dimensions(){return o._dimensions}get isCommandStorageDisabled(){return o.__isCommandStorageDisabled}get commandMarkers(){return o._commandMarkers}set commandMarkers(n){o._commandMarkers=n}get clearCommandsInViewport(){return o._clearCommandsInViewport.bind(o)}},this._ptyHeuristics=this._register(new bht(new Pat(this._terminal,this,this._ptyHeuristicsHooks,this._logService))),this._dimensions={cols:this._terminal.cols,rows:this._terminal.rows},this._register(this._terminal.onResize(n=>this._handleResize(n))),this._register(this._terminal.onCursorMove(()=>this._handleCursorMove()))}get promptInputModel(){return this._promptInputModel}get hasRichCommandDetection(){return this._hasRichCommandDetection}get commands(){return this._commands}get executingCommand(){return this._currentCommand.command}get executingCommandObject(){if(this._currentCommand.commandStartMarker)return this._currentCommand.promoteToFullCommand(this._cwd,void 0,this._handleCommandStartOptions?.ignoreCommandLine??!1,void 0)}get executingCommandConfidence(){let e=this._currentCommand;return nC(e)?e.commandLineConfidence:void 0}get currentCommand(){return this._currentCommand}get cwd(){return this._cwd}get promptTerminator(){return this._promptTerminator}_handleResize(e){this._ptyHeuristics.value.preHandleResize?.(e),this._dimensions.cols=e.cols,this._dimensions.rows=e.rows}_handleCursorMove(){this._store.isDisposed||this._terminal.buffer.active===this._terminal.buffer.normal&&this._currentCommand.commandStartMarker&&this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY<this._currentCommand.commandStartMarker.line&&(this._clearCommandsInViewport(),this._currentCommand.isInvalid=!0,this._onCurrentCommandInvalidated.fire({reason:"windows"}))}_clearCommandsInViewport(){let e=0;for(let t=this._commands.length-1;t>=0;t--){let o=this._commands[t].marker?.line;if(o&&o<this._terminal.buffer.active.baseY)break;e++}e>0&&this._onCommandInvalidated.fire(this._commands.splice(this._commands.length-e,e))}setContinuationPrompt(e){this._promptInputModel.setContinuationPrompt(e)}setPromptTerminator(e,t){this._logService.debug("CommandDetectionCapability#setPromptTerminator",e),this._promptTerminator=e,this._promptInputModel.setLastPromptLine(t)}setCwd(e){this._cwd=e}setIsWindowsPty(e){if(e&&!(this._ptyHeuristics.value instanceof vve)){let t=this;this._ptyHeuristics.value=new vve(this._terminal,this,new class{get onCurrentCommandInvalidatedEmitter(){return t._onCurrentCommandInvalidated}get onCommandStartedEmitter(){return t._onCommandStarted}get onCommandExecutedEmitter(){return t._onCommandExecuted}get dimensions(){return t._dimensions}get isCommandStorageDisabled(){return t.__isCommandStorageDisabled}get commandMarkers(){return t._commandMarkers}set commandMarkers(o){t._commandMarkers=o}get clearCommandsInViewport(){return t._clearCommandsInViewport.bind(t)}},this._logService)}else!e&&!(this._ptyHeuristics.value instanceof Pat)&&(this._ptyHeuristics.value=new Pat(this._terminal,this,this._ptyHeuristicsHooks,this._logService))}setHasRichCommandDetection(e){this._hasRichCommandDetection=e,this._onSetRichCommandDetection.fire(e)}setIsCommandStorageDisabled(){this.__isCommandStorageDisabled=!0}getCommandForLine(e){if(this._currentCommand.promptStartMarker&&e>=this._currentCommand.promptStartMarker?.line)return this._currentCommand;if(this._commands.length!==0&&!((this._commands[0].promptStartMarker??this._commands[0].marker).line>e)){for(let t=this.commands.length-1;t>=0;t--)if((this.commands[t].promptStartMarker??this.commands[t].marker).line<=e)return this.commands[t]}}getCwdForLine(e){if(this._currentCommand.promptStartMarker&&e>=this._currentCommand.promptStartMarker?.line)return this._cwd;let t=this.getCommandForLine(e);if(t&&nC(t))return t.cwd}handlePromptStart(e){let t=this.commands.at(-1);t?.endMarker&&t?.executedMarker&&t.endMarker.line===t.executedMarker.line&&t.executedMarker.line<this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY&&(this._logService.debug("CommandDetectionCapability#handlePromptStart adjusted commandFinished",`${t.endMarker.line} -> ${t.executedMarker.line+1}`),t.endMarker=Aat(this._terminal,t.executedMarker,1)),this._currentCommand.promptStartMarker=e?.marker||(!this._currentCommand.wasCleared&&t?.endMarker?Aat(this._terminal,t.endMarker):this._terminal.registerMarker(0)),this._currentCommand.wasCleared=!1}handleContinuationStart(){this._currentCommand.currentContinuationMarker=this._terminal.registerMarker(0),this._logService.debug("CommandDetectionCapability#handleContinuationStart",this._currentCommand.currentContinuationMarker)}handleContinuationEnd(){if(!this._currentCommand.currentContinuationMarker){this._logService.warn("CommandDetectionCapability#handleContinuationEnd Received continuation end without start");return}this._currentCommand.continuations||(this._currentCommand.continuations=[]),this._currentCommand.continuations.push({marker:this._currentCommand.currentContinuationMarker,end:this._terminal.buffer.active.cursorX}),this._currentCommand.currentContinuationMarker=void 0,this._logService.debug("CommandDetectionCapability#handleContinuationEnd",this._currentCommand.continuations[this._currentCommand.continuations.length-1])}handleRightPromptStart(){this._currentCommand.commandRightPromptStartX=this._terminal.buffer.active.cursorX,this._logService.debug("CommandDetectionCapability#handleRightPromptStart",this._currentCommand.commandRightPromptStartX)}handleRightPromptEnd(){this._currentCommand.commandRightPromptEndX=this._terminal.buffer.active.cursorX,this._logService.debug("CommandDetectionCapability#handleRightPromptEnd",this._currentCommand.commandRightPromptEndX)}handleCommandStart(e){if(this._handleCommandStartOptions=e,this._currentCommand.cwd=this._cwd,this._currentCommand.commandStartMarker=e?.marker||this._currentCommand.commandStartMarker,this._currentCommand.commandStartMarker?.line===this._terminal.buffer.active.cursorY){this._currentCommand.commandStartX=this._terminal.buffer.active.cursorX,this._onCommandStartChanged.fire(),this._logService.debug("CommandDetectionCapability#handleCommandStart",this._currentCommand.commandStartX,this._currentCommand.commandStartMarker?.line);return}this._ptyHeuristics.value.handleCommandStart(e)}setNextCommandId(e,t){this._nextCommandId={command:e,commandId:t}}handleCommandExecuted(e){this._ensureCurrentCommandId(this._currentCommand.command??this._currentCommand.extractCommandLine()),this._ptyHeuristics.value.handleCommandExecuted(e),this._currentCommand.markExecutedTime()}handleCommandFinished(e,t){if(this._currentCommand.commandExecutedMarker||this.handleCommandExecuted(),this._currentCommand.markFinishedTime(),this._ptyHeuristics.value.preHandleCommandFinished?.(),this._logService.debug("CommandDetectionCapability#handleCommandFinished",this._terminal.buffer.active.cursorX,t?.marker?.line,this._currentCommand.command,this._currentCommand),e===void 0){let n=this.commands.length>0?this.commands[this.commands.length-1]:void 0;this._currentCommand.command&&this._currentCommand.command.length>0&&n?.command===this._currentCommand.command&&(e=n.exitCode)}if(this._currentCommand.commandStartMarker===void 0||!this._terminal.buffer.active)return;this._currentCommand.commandFinishedMarker=t?.marker||this._terminal.registerMarker(0),this._ptyHeuristics.value.postHandleCommandFinished?.();let o=this._currentCommand.promoteToFullCommand(this._cwd,e,this._handleCommandStartOptions?.ignoreCommandLine??!1,t?.markProperties);o&&(this._commands.push(o),this._onBeforeCommandFinished.fire(o),this._logService.debug("CommandDetectionCapability#onCommandFinished",o),this._onCommandFinished.fire(o)),this._currentCommand=new Rat(this._terminal),this._handleCommandStartOptions=void 0}_ensureCurrentCommandId(e){this._nextCommandId?.commandId&&(this._currentCommand.id!==this._nextCommandId.commandId&&(this._currentCommand.id=this._nextCommandId.commandId),this._nextCommandId=void 0)}setCommandLine(e,t){this._logService.debug("CommandDetectionCapability#setCommandLine",e,t),this._currentCommand.command=e,this._currentCommand.commandLineConfidence="high",this._currentCommand.isTrusted=t,t&&this._promptInputModel.setConfidentCommandLine(e)}serialize(){let e=this.commands.map(o=>o.serialize(this.__isCommandStorageDisabled)),t=this._currentCommand.serialize(this._cwd);return t&&e.push(t),{isWindowsPty:this._ptyHeuristics.value instanceof vve,hasRichCommandDetection:this._hasRichCommandDetection,commands:e,promptInputModel:this._promptInputModel.serialize()}}deserialize(e){e.isWindowsPty&&this.setIsWindowsPty(e.isWindowsPty),e.hasRichCommandDetection&&this.setHasRichCommandDetection(e.hasRichCommandDetection);let t=this._terminal.buffer.normal;for(let o of e.commands){if(!o.endLine){let r=o.startLine!==void 0?this._terminal.registerMarker(o.startLine-(t.baseY+t.cursorY)):void 0;if(!r)continue;this._currentCommand.commandStartMarker=o.startLine!==void 0?this._terminal.registerMarker(o.startLine-(t.baseY+t.cursorY)):void 0,this._currentCommand.commandStartX=o.startX,this._currentCommand.promptStartMarker=o.promptStartLine!==void 0?this._terminal.registerMarker(o.promptStartLine-(t.baseY+t.cursorY)):void 0,this._cwd=o.cwd,this._onCommandStarted.fire({marker:r});continue}let n=Lat.deserialize(this._terminal,o,this.__isCommandStorageDisabled);n&&(this._commands.push(n),this._logService.debug("CommandDetectionCapability#onCommandFinished",n),this._onCommandFinished.fire(n))}e.promptInputModel&&this._promptInputModel.deserialize(e.promptInputModel)}};I([Zd(500)],fve.prototype,"_handleCursorMove",1),fve=I([m(1,se)],fve);var Pat=class extends x{constructor(e,t,o,n){super();this._terminal=e;this._capability=t;this._hooks=o;this._logService=n}handleCommandStart(e){let t=this._capability.currentCommand;t.commandStartX=this._terminal.buffer.active.cursorX,t.commandStartMarker=e?.marker||this._terminal.registerMarker(0),t.commandExecutedMarker?.dispose(),t.commandExecutedMarker=void 0,t.commandExecutedX=void 0;for(let o of this._hooks.commandMarkers)o.dispose();this._hooks.commandMarkers.length=0,this._hooks.onCommandStartedEmitter.fire({marker:e?.marker||t.commandStartMarker,markProperties:e?.markProperties}),this._logService.debug("CommandDetectionCapability#handleCommandStart",t.commandStartX,t.commandStartMarker?.line)}handleCommandExecuted(e){let t=this._capability.currentCommand;t.commandExecutedMarker=e?.marker||this._terminal.registerMarker(0),t.commandExecutedX=this._terminal.buffer.active.cursorX,this._logService.debug("CommandDetectionCapability#handleCommandExecuted",t.commandExecutedX,t.commandExecutedMarker?.line),!(!t.commandStartMarker||!t.commandExecutedMarker||t.commandStartX===void 0)&&(t.command=this._capability.promptInputModel.ghostTextIndex>-1?this._capability.promptInputModel.value.substring(0,this._capability.promptInputModel.ghostTextIndex):this._capability.promptInputModel.value,this._hooks.onCommandExecutedEmitter.fire(t))}};var vve=class extends x{constructor(e,t,o,n){super();this._terminal=e;this._capability=t;this._hooks=o;this._logService=n;this._onCursorMoveListener=this._register(new me);this._tryAdjustCommandStartMarkerScannedLineCount=0;this._tryAdjustCommandStartMarkerPollCount=0;this._register(this._capability.onBeforeCommandFinished(r=>{(r.command.trim().toLowerCase()==="clear"||r.command.trim().toLowerCase()==="cls")&&(this._tryAdjustCommandStartMarkerScheduler?.cancel(),this._tryAdjustCommandStartMarkerScheduler=void 0,this._hooks.clearCommandsInViewport(),this._capability.currentCommand.isInvalid=!0,this._hooks.onCurrentCommandInvalidatedEmitter.fire({reason:"windows"}))}))}preHandleResize(e){let t=this._terminal.buffer.active.baseY,o=e.rows-this._hooks.dimensions.rows;o>0&&this._waitForCursorMove().then(()=>{let n=Math.min(o,t);for(let r=this._capability.commands.length-1;r>=0;r--){let s=this._capability.commands[r];if(!s.marker||s.marker.line<t||s.commandStartLineContent===void 0)break;let l=this._terminal.buffer.active.getLine(s.marker.line);if(!l||l.translateToString(!0)===s.commandStartLineContent)continue;let c=s.marker.line-n;this._terminal.buffer.active.getLine(c)?.translateToString(!0)===s.commandStartLineContent&&this._terminal._core._bufferService.buffer.lines.onDeleteEmitter.fire({index:this._terminal.buffer.active.baseY,amount:n})}})}handleCommandStart(){this._capability.currentCommand.commandStartX=this._terminal.buffer.active.cursorX,this._hooks.commandMarkers.length=0;let e=this._capability.currentCommand.commandStartMarker=this._capability.currentCommand.promptStartMarker?Aat(this._terminal,this._capability.currentCommand.promptStartMarker):this._terminal.registerMarker(0);this._capability.currentCommand.commandStartX=0,this._tryAdjustCommandStartMarkerScannedLineCount=0,this._tryAdjustCommandStartMarkerPollCount=0,this._tryAdjustCommandStartMarkerScheduler=new Dt(()=>this._tryAdjustCommandStartMarker(e),20),this._tryAdjustCommandStartMarkerScheduler.schedule()}_tryAdjustCommandStartMarker(e){if(this._store.isDisposed)return;let t=this._terminal.buffer.active,o=this._tryAdjustCommandStartMarkerScannedLineCount;for(;o<10&&e.line+o<t.baseY+this._terminal.rows;){if(this._cursorOnNextLine()){let n=this._getWindowsPrompt(e.line+o);if(n){let r=Fe(n)?n:n.prompt;if(this._capability.currentCommand.commandStartMarker=this._terminal.registerMarker(0),!Fe(n)&&n.likelySingleLine){this._logService.debug("CommandDetectionCapability#_tryAdjustCommandStartMarker adjusted promptStart",`${this._capability.currentCommand.promptStartMarker?.line} -> ${this._capability.currentCommand.commandStartMarker.line}`),this._capability.currentCommand.promptStartMarker?.dispose(),this._capability.currentCommand.promptStartMarker=Aat(this._terminal,this._capability.currentCommand.commandStartMarker);let s=this._capability.commands.at(-1);s&&this._capability.currentCommand.commandStartMarker.line!==s.endMarker?.line&&(s.endMarker?.dispose(),s.endMarker=Aat(this._terminal,this._capability.currentCommand.commandStartMarker))}this._capability.currentCommand.commandStartX=r.length,this._logService.debug("CommandDetectionCapability#_tryAdjustCommandStartMarker adjusted commandStart",`${e.line} -> ${this._capability.currentCommand.commandStartMarker.line}:${this._capability.currentCommand.commandStartX}`),this._flushPendingHandleCommandStartTask();return}}o++}o<10?(this._tryAdjustCommandStartMarkerScannedLineCount=o,++this._tryAdjustCommandStartMarkerPollCount<10?this._tryAdjustCommandStartMarkerScheduler?.schedule():this._flushPendingHandleCommandStartTask()):this._flushPendingHandleCommandStartTask()}_flushPendingHandleCommandStartTask(){if(this._tryAdjustCommandStartMarkerScheduler&&(this._tryAdjustCommandStartMarkerPollCount=10,this._tryAdjustCommandStartMarkerScheduler.flush(),this._tryAdjustCommandStartMarkerScheduler=void 0),this._capability.currentCommand.commandExecutedMarker||(this._onCursorMoveListener.value=this._terminal.onCursorMove(()=>{if(this._hooks.commandMarkers.length===0||this._hooks.commandMarkers[this._hooks.commandMarkers.length-1].line!==this._terminal.buffer.active.cursorY){let e=this._terminal.registerMarker(0);e&&this._hooks.commandMarkers.push(e)}})),this._capability.currentCommand.commandStartMarker){let e=this._terminal.buffer.active.getLine(this._capability.currentCommand.commandStartMarker.line);e&&(this._capability.currentCommand.commandStartLineContent=e.translateToString(!0))}this._hooks.onCommandStartedEmitter.fire({marker:this._capability.currentCommand.commandStartMarker}),this._logService.debug("CommandDetectionCapability#_handleCommandStartWindows",this._capability.currentCommand.commandStartX,this._capability.currentCommand.commandStartMarker?.line)}handleCommandExecuted(e){this._tryAdjustCommandStartMarkerScheduler&&this._flushPendingHandleCommandStartTask(),this._onCursorMoveListener.clear(),this._evaluateCommandMarkers(),this._capability.currentCommand.commandExecutedX=this._terminal.buffer.active.cursorX,this._hooks.onCommandExecutedEmitter.fire(this._capability.currentCommand),this._logService.debug("CommandDetectionCapability#handleCommandExecuted",this._capability.currentCommand.commandExecutedX,this._capability.currentCommand.commandExecutedMarker?.line)}preHandleCommandFinished(){this._capability.currentCommand.commandExecutedMarker||(this._hooks.commandMarkers.length===0&&(this._capability.currentCommand.commandStartMarker||(this._capability.currentCommand.commandStartMarker=this._terminal.registerMarker(0)),this._capability.currentCommand.commandStartMarker&&this._hooks.commandMarkers.push(this._capability.currentCommand.commandStartMarker)),this._evaluateCommandMarkers())}postHandleCommandFinished(){let e=this._capability.currentCommand,t=e.command,o=e.commandStartMarker?.line,n=e.commandExecutedMarker?.line;if(!t||t.length===0||o===void 0||o===-1||n===void 0||n===-1)return;let r=0,s=!1;for(let l=o;l<=n;l++){let c=this._terminal.buffer.active.getLine(l);if(!c)break;let u=c.translateToString(!0);for(let p=0;p<u.length;p++){for(;t.length<r&&t[r]===" ";)r++;if(u[p]===t[r]&&r++,r===t.length){let h=p>=this._terminal.cols-1;e.commandExecutedMarker=this._terminal.registerMarker(l-(this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY)+(h?1:0)),e.commandExecutedX=h?0:p+1,s=!0;break}}if(s)break}}_evaluateCommandMarkers(){if(this._hooks.commandMarkers.length!==0){if(this._hooks.commandMarkers=this._hooks.commandMarkers.sort((e,t)=>e.line-t.line),this._capability.currentCommand.commandStartMarker=this._hooks.commandMarkers[0],this._capability.currentCommand.commandStartMarker){let e=this._terminal.buffer.active.getLine(this._capability.currentCommand.commandStartMarker.line);e&&(this._capability.currentCommand.commandStartLineContent=e.translateToString(!0))}this._capability.currentCommand.commandExecutedMarker=this._hooks.commandMarkers[this._hooks.commandMarkers.length-1],this._hooks.onCommandExecutedEmitter.fire(this._capability.currentCommand)}}_cursorOnNextLine(){let e=this._capability.commands.at(-1);if(!e)return!0;let t=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,o=(e.endMarker?e.endMarker.line:e.marker?.line)??-1;return t>o}_waitForCursorMove(){let e=this._terminal.buffer.active.cursorX,t=this._terminal.buffer.active.cursorY,o=0;return new Promise((n,r)=>{let s=setInterval(()=>{if(e!==this._terminal.buffer.active.cursorX||t!==this._terminal.buffer.active.cursorY){n(),clearInterval(s);return}o+=10,o>1e3&&(clearInterval(s),n())},10)})}_getWindowsPrompt(e=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY){let t=this._terminal.buffer.active.getLine(e);if(!t)return;let o=t.translateToString(!0);if(!o)return;let n=o.match(/(?<prompt>(\(.+\)\s)?(?:PS.+>\s?))/)?.groups?.prompt;if(n){let u=this._adjustPrompt(n,o,">");if(u)return{prompt:u,likelySingleLine:!0}}let r=o.match(/.*\u276f(?=[^\u276f]*$)/g)?.[0];if(r){let u=this._adjustPrompt(r,o,"\u276F");if(u)return u}let s=o.match(/^(?<prompt>\$)/)?.groups?.prompt;if(s){let u=this._adjustPrompt(s,o,"$");if(u)return u}let l=o.match(/^(?<prompt>>>> )/g)?.groups?.prompt;if(l)return{prompt:l,likelySingleLine:!0};if(this._capability.promptTerminator&&(o===this._capability.promptTerminator||o.trim().endsWith(this._capability.promptTerminator))){let u=this._adjustPrompt(o,o,this._capability.promptTerminator);if(u)return u}let c=o.match(/^(?<prompt>(\(.+\)\s)?(?:[A-Z]:\\.*>))/);return c?.groups?.prompt?{prompt:c.groups.prompt,likelySingleLine:!0}:void 0}_adjustPrompt(e,t,o){if(e)return t===e&&e.endsWith(o)&&(e+=" "),e}};vve=I([m(3,se)],vve);function OFi(a,i,e,t){if(!t)return;let o=i.executedMarker,n=i.endMarker;if(!o||!n)return;let r=o.line,s=n.line,l=t.length,c=[];if(t.anchor==="bottom")for(let u=s-(t.offset||0);u>=r;u--){let p=u,h=u;for(;p>=r&&a.getLine(p)?.isWrapped;)p--;u=p,c.unshift(REo(a,p,h,e)),c.length>l&&c.pop()}else for(let u=r+(t.offset||0);u<s;u++){let p=u,h=u;for(;h+1<s&&a.getLine(h+1)?.isWrapped;)h++;u=h,c.push(REo(a,p,h,e)),c.length===l&&c.shift()}return c}function REo(a,i,e,t){let o=Math.max(2048/t*2);e=Math.min(e,i+o);let n="";for(let r=i;r<=e;r++){let s=a.getLine(r);s&&(n+=s.translateToString(!0,0,t))}return n}function Aat(a,i,e=0){return a.registerMarker(i.line-(a.buffer.active.baseY+a.buffer.active.cursorY)+e)}var I5t=class extends x{constructor(){super(...arguments);this.type=0;this._cwd="";this._cwds=new Map;this._onDidChangeCwd=this._register(new E);this.onDidChangeCwd=this._onDidChangeCwd.event}get cwds(){return Array.from(this._cwds.keys())}getCwd(){return this._cwd}updateCwd(e){let t=this._cwd!==e;this._cwd=e;let o=this._cwds.get(this._cwd)||0;this._cwds.delete(this._cwd),this._cwds.set(this._cwd,o+1),t&&this._onDidChangeCwd.fire(e)}};var y5t=class extends N{constructor(e,t){super();this._terminal=e;this._onDidExecuteText=t;this.type=3;this._commands=[];this._onCommandFinished=this.add(new E);this.onCommandFinished=this._onCommandFinished.event;this.add(this._terminal.onData(o=>this._onData(o))),this.add(this._terminal.parser.registerCsiHandler({final:"J"},o=>(o.length>=1&&(o[0]===2||o[0]===3)&&this._clearCommandsInViewport(),!1))),this._onDidExecuteText&&this.add(this._onDidExecuteText(()=>this._onEnter()))}get commands(){return this._commands}_onData(e){e==="\r"&&this._onEnter()}_onEnter(){if(this._terminal&&this._terminal.buffer.active.cursorX>=2){let e=this._terminal.registerMarker(0);e&&(this._commands.push(e),this._onCommandFinished.fire(e))}}_clearCommandsInViewport(){let e=0;for(let t=this._commands.length-1;t>=0&&!(this._commands[t].line<this._terminal.buffer.active.baseY);t--)e++;this._commands.splice(this._commands.length-e,e)}};var w5t=class extends x{constructor(e){super();this._terminal=e;this.type=4;this._idToMarkerMap=new Map;this._anonymousMarkers=new Map;this._onMarkAdded=this._register(new E);this.onMarkAdded=this._onMarkAdded.event}*markers(){for(let e of this._idToMarkerMap.values())yield e;for(let e of this._anonymousMarkers.values())yield e}addMark(e){let t=e?.marker||this._terminal.registerMarker(),o=e?.id;t&&(o?(this._idToMarkerMap.set(o,t),t.onDispose(()=>this._idToMarkerMap.delete(o))):(this._anonymousMarkers.set(t.id,t),t.onDispose(()=>this._anonymousMarkers.delete(t.id))),this._onMarkAdded.fire({marker:t,id:o,hidden:e?.hidden,hoverMessage:e?.hoverMessage}))}getMark(e){return this._idToMarkerMap.get(e)}};function FFi(a,i){let e=a;e.includes("\\")&&(e=e.replace(/\\/g,"\\\\"));let t;switch(i){case"bash":case"sh":case"zsh":case"gitbash":t={bothQuotes:n=>`$'${n.replace(/'/g,"\\'")}'`,singleQuotes:n=>`'${n.replace(/'/g,"\\'")}'`,noSingleQuotes:n=>`'${n}'`};break;case"fish":t={bothQuotes:n=>`"${n.replace(/"/g,'\\"')}"`,singleQuotes:n=>`'${n.replace(/'/g,"\\'")}'`,noSingleQuotes:n=>`'${n}'`};break;case"pwsh":t={bothQuotes:n=>`"${n.replace(/"/g,'`"')}"`,singleQuotes:n=>`'${n.replace(/'/g,"''")}'`,noSingleQuotes:n=>`'${n}'`};break;default:t={bothQuotes:n=>`$'${n.replace(/'/g,"\\'")}'`,singleQuotes:n=>`'${n.replace(/'/g,"\\'")}'`,noSingleQuotes:n=>`'${n}'`};break}let o=/[\`\$\|\&\>\~\#\!\^\*\;\<]/g;return e=e.replace(o,""),e.includes("'")&&e.includes('"')?t.bothQuotes(e):e.includes("'")?t.singleQuotes(e):t.noSingleQuotes(e)}function MEo(a,i,e){if(!a)return"";if(!i)return a;i.match(/[\/\\]$/)&&(i=i.slice(0,i.length-1));let t=a.replace(/\\/g,"/").toLowerCase(),o=i.replace(/\\/g,"/").toLowerCase();return t.includes(o)?`~${e}${a.slice(i.length+1)}`:a}function Nat(a){return a.match(/^['"].*['"]$/)&&(a=a.substring(1,a.length-1)),Po===1&&a&&a[1]===":"?a[0].toUpperCase()+a.substring(1):a}function C5t(a){return!a.strictEnv}var x5t=class extends x{constructor(){super(...arguments);this.type=5;this._env={value:new Map,isTrusted:!0};this._onDidChangeEnv=this._register(new E);this.onDidChangeEnv=this._onDidChangeEnv.event}get env(){return this._createStateObject()}setEnvironment(e,t){if(!eo(this.env.value,e)){this._env.value.clear();for(let[o,n]of Object.entries(e))n!==void 0&&this._env.value.set(o,n);this._env.isTrusted=t,this._fireEnvChange()}}startEnvironmentSingleVar(e,t){e?this._pendingEnv={value:new Map,isTrusted:t}:this._pendingEnv={value:new Map(this._env.value),isTrusted:this._env.isTrusted&&t}}setEnvironmentSingleVar(e,t,o){this._pendingEnv&&e!==void 0&&t!==void 0&&(this._pendingEnv.value.set(e,t),this._pendingEnv.isTrusted&&=o)}endEnvironmentSingleVar(e){if(!this._pendingEnv)return;this._pendingEnv.isTrusted&&=e,!Wse(this._env.value,this._pendingEnv.value)&&(this._env=this._pendingEnv,this._fireEnvChange()),this._pendingEnv=void 0}deleteEnvironmentSingleVar(e,t,o){this._pendingEnv&&e!==void 0&&t!==void 0&&(this._pendingEnv.value.delete(e),this._pendingEnv.isTrusted&&=o)}_fireEnvChange(){this._onDidChangeEnv.fire(this._createStateObject())}_createStateObject(){return{value:Object.fromEntries(this._env.value),isTrusted:this._env.isTrusted}}};var k5t=class extends x{constructor(){super(...arguments);this.type=6;this._onPromptTypeChanged=this._register(new E);this.onPromptTypeChanged=this._onPromptTypeChanged.event}get promptType(){return this._promptType}setPromptType(e){this._promptType=e,this._onPromptTypeChanged.fire(e)}};var E5t=class extends x{constructor(e,t,o,n,r){super();this._nonce=e;this._disableTelemetry=t;this._onDidExecuteText=o;this._telemetryService=n;this._logService=r;this.capabilities=this._register(new Sx);this._hasUpdatedTelemetry=!1;this._commonProtocolDisposables=[];this._seenSequences=new Set;this._status=0;this._onDidChangeStatus=this._register(new E);this.onDidChangeStatus=this._onDidChangeStatus.event;this._onDidChangeSeenSequences=this._register(new E);this.onDidChangeSeenSequences=this._onDidChangeSeenSequences.event;this._register(Z(()=>{this._clearActivationTimeout(),this._disposeCommonProtocol()}))}get seenSequences(){return this._seenSequences}get status(){return this._status}_disposeCommonProtocol(){Be(this._commonProtocolDisposables),this._commonProtocolDisposables.length=0}activate(e){this._terminal=e,this.capabilities.add(3,this._register(new y5t(this._terminal,this._onDidExecuteText))),this._register(e.parser.registerOscHandler(633,t=>this._handleVSCodeSequence(t))),this._register(e.parser.registerOscHandler(1337,t=>this._doHandleITermSequence(t))),this._commonProtocolDisposables.push(e.parser.registerOscHandler(133,t=>this._handleFinalTermSequence(t))),this._register(e.parser.registerOscHandler(7,t=>this._doHandleSetCwd(t))),this._register(e.parser.registerOscHandler(9,t=>this._doHandleSetWindowsFriendlyCwd(t))),this._ensureCapabilitiesOrAddFailureTelemetry()}getMarkerId(e,t){this._createOrGetBufferMarkDetection(e).getMark(t)}setNextCommandId(e,t){this._terminal&&this._createOrGetCommandDetection(this._terminal).setNextCommandId(e,t)}_markSequenceSeen(e){this._seenSequences.has(e)||(this._seenSequences.add(e),this._onDidChangeSeenSequences.fire(this._seenSequences))}_handleFinalTermSequence(e){let t=this._doHandleFinalTermSequence(e);return this._status===0&&(this._status=1,this._onDidChangeStatus.fire(this._status)),t}_doHandleFinalTermSequence(e){if(!this._terminal)return!1;let[t,...o]=e.split(";");switch(this._markSequenceSeen(t),t){case"A":return this._createOrGetCommandDetection(this._terminal).handlePromptStart(),!0;case"B":return this._createOrGetCommandDetection(this._terminal).handleCommandStart({ignoreCommandLine:!0}),!0;case"C":return this._createOrGetCommandDetection(this._terminal).handleCommandExecuted(),!0;case"D":{let n=o.length===1?parseInt(o[0]):void 0;return this._createOrGetCommandDetection(this._terminal).handleCommandFinished(n),!0}}return!1}_handleVSCodeSequence(e){let t=this._doHandleVSCodeSequence(e);return!this._hasUpdatedTelemetry&&t&&(this._telemetryService?.publicLog2("terminal/shellIntegrationActivationSucceeded"),this._hasUpdatedTelemetry=!0,this._clearActivationTimeout()),this._status!==2&&(this._status=2,this._onDidChangeStatus.fire(this._status)),t}async _ensureCapabilitiesOrAddFailureTelemetry(){!this._telemetryService||this._disableTelemetry||(this._activationTimeout=setTimeout(()=>{!this.capabilities.get(2)&&!this.capabilities.get(0)&&(this._telemetryService?.publicLog2("terminal/shellIntegrationActivationTimeout"),this._logService.warn("Shell integration failed to add capabilities within 10 seconds")),this._hasUpdatedTelemetry=!0},1e4))}_clearActivationTimeout(){this._activationTimeout!==void 0&&(clearTimeout(this._activationTimeout),this._activationTimeout=void 0)}_doHandleVSCodeSequence(e){if(!this._terminal)return!1;let t=e.indexOf(";"),o=t===-1?e:e.substring(0,t);this._markSequenceSeen(o);let n=t===-1?[]:e.substring(t+1).split(";");switch(o){case"A":return this._createOrGetCommandDetection(this._terminal).handlePromptStart(),!0;case"B":return this._createOrGetCommandDetection(this._terminal).handleCommandStart(),!0;case"C":return this._createOrGetCommandDetection(this._terminal).handleCommandExecuted(),!0;case"D":{let r=n[0],s=r!==void 0?parseInt(r):void 0;return this._createOrGetCommandDetection(this._terminal).handleCommandFinished(s),!0}case"E":{let r=n[0],s=n[1],l;return r!==void 0?l=Oat(r):l="",this._createOrGetCommandDetection(this._terminal).setCommandLine(l,s===this._nonce),!0}case"F":return this._createOrGetCommandDetection(this._terminal).handleContinuationStart(),!0;case"G":return this._createOrGetCommandDetection(this._terminal).handleContinuationEnd(),!0;case"EnvJson":{let r=n[0],s=n[1];if(r!==void 0)try{let l=JSON.parse(Oat(r));this._createOrGetShellEnvDetection().setEnvironment(l,s===this._nonce)}catch{this._logService.warn("Failed to parse environment from shell integration sequence",r)}return!0}case"EnvSingleStart":return this._createOrGetShellEnvDetection().startEnvironmentSingleVar(n[0]==="1",n[1]===this._nonce),!0;case"EnvSingleDelete":{let r=n[0],s=n[1],l=n[2];if(r!==void 0&&s!==void 0){let c=Oat(s);this._createOrGetShellEnvDetection().deleteEnvironmentSingleVar(r,c,l===this._nonce)}return!0}case"EnvSingleEntry":{let r=n[0],s=n[1],l=n[2];if(r!==void 0&&s!==void 0){let c=Oat(s);this._createOrGetShellEnvDetection().setEnvironmentSingleVar(r,c,l===this._nonce)}return!0}case"EnvSingleEnd":return this._createOrGetShellEnvDetection().endEnvironmentSingleVar(n[0]===this._nonce),!0;case"H":return this._createOrGetCommandDetection(this._terminal).handleRightPromptStart(),!0;case"I":return this._createOrGetCommandDetection(this._terminal).handleRightPromptEnd(),!0;case"P":{let r=n[0],s=r!==void 0?Oat(r):"",{key:l,value:c}=PEo(s);if(c===void 0)return!0;switch(l){case"ContinuationPrompt":return this._updateContinuationPrompt(LGi(c)),!0;case"Cwd":return this._updateCwd(c),!0;case"IsWindows":return this._createOrGetCommandDetection(this._terminal).setIsWindowsPty(c==="True"),!0;case"HasRichCommandDetection":return this._createOrGetCommandDetection(this._terminal).setHasRichCommandDetection(c==="True"),!0;case"Prompt":{let u=c.replace(/\x1b\[[0-9;]*m/g,"");return this._updatePromptTerminator(u),!0}case"PromptType":return this._createOrGetPromptTypeDetection().setPromptType(c),!0;case"Task":return this._createOrGetBufferMarkDetection(this._terminal),this.capabilities.get(2)?.setIsCommandStorageDisabled(),!0}}case"SetMark":return this._createOrGetBufferMarkDetection(this._terminal).addMark(jun(n)),!0}return!1}_updateContinuationPrompt(e){this._terminal&&this._createOrGetCommandDetection(this._terminal).setContinuationPrompt(e)}_updatePromptTerminator(e){if(!this._terminal)return;let t=e.substring(e.lastIndexOf(`
`)+1),n=t.trim().length===1?t:t.substring(t.lastIndexOf(" "));n&&this._createOrGetCommandDetection(this._terminal).setPromptTerminator(n,t)}_updateCwd(e){e=Nat(e),this._createOrGetCwdDetection().updateCwd(e),this.capabilities.get(2)?.setCwd(e)}_doHandleITermSequence(e){if(!this._terminal)return!1;let[t]=e.split(";");switch(this._markSequenceSeen(`1337;${t}`),t){case"SetMark":this._createOrGetBufferMarkDetection(this._terminal).addMark();default:{let{key:o,value:n}=PEo(t);if(n===void 0)return!0;if(o==="CurrentDir")return this._updateCwd(n),!0}}return!1}_doHandleSetWindowsFriendlyCwd(e){if(!this._terminal)return!1;let[t,...o]=e.split(";");return this._markSequenceSeen(`9;${t}`),t==="9"?(o.length&&this._updateCwd(o[0]),!0):!1}_doHandleSetCwd(e){if(!this._terminal)return!1;let[t]=e.split(";");if(this._markSequenceSeen(`7;${t}`),t.match(/^file:\/\/.*\//)){let o=A.parse(t);if(o.path&&o.path.length>0)return this._updateCwd(o.path),!0}return!1}serialize(){return!this._terminal||!this.capabilities.has(2)?{isWindowsPty:!1,hasRichCommandDetection:!1,commands:[],promptInputModel:void 0}:this._createOrGetCommandDetection(this._terminal).serialize()}deserialize(e){if(!this._terminal)throw new Error("Cannot restore commands before addon is activated");let t=this._createOrGetCommandDetection(this._terminal);t.deserialize(e),t.cwd&&this._updateCwd(t.cwd)}_createOrGetCwdDetection(){let e=this.capabilities.get(0);return e||(e=this._register(new I5t),this.capabilities.add(0,e)),e}_createOrGetCommandDetection(e){let t=this.capabilities.get(2);return t||(t=this._register(new fve(e,this._logService)),this.capabilities.add(2,t)),t}_createOrGetBufferMarkDetection(e){let t=this.capabilities.get(4);return t||(t=this._register(new w5t(e)),this.capabilities.add(4,t)),t}_createOrGetShellEnvDetection(){let e=this.capabilities.get(5);return e||(e=this._register(new x5t),this.capabilities.add(5,e)),e}_createOrGetPromptTypeDetection(){let e=this.capabilities.get(6);return e||(e=this._register(new k5t),this.capabilities.add(6,e)),e}};function Oat(a){return a.replaceAll(/\\(\\|x([0-9a-f]{2}))/gi,(i,e,t)=>t?String.fromCharCode(parseInt(t,16)):e)}function NEo(a){return a.replace(/[\\;\x00-\x20]/g,i=>i==="\\"?"\\\\":`\\x${i.charCodeAt(0).toString(16).padStart(2,"0")}`)}function PEo(a){let i=a.indexOf("=");return i===-1?{key:a,value:void 0}:{key:a.substring(0,i),value:a.substring(1+i)}}function jun(a){let i,e=!1;for(let t of a)t!==void 0&&(t==="Hidden"&&(e=!0),t.startsWith("Id=")&&(i=t.substring(3)));return{id:i,hidden:e}}function Rq(a){let[,i,e]=a.path.split("/");if(!i||!Number.parseInt(e))throw new Error(`Could not parse terminal uri for resource ${a}`);return{workspaceId:i,instanceId:Number.parseInt(e)}}function lHe(a,i,e,t){let o=new URLSearchParams;return t&&o.set("command",t),A.from({scheme:Q.vscodeTerminal,path:`/${a}/${i}`,fragment:e||void 0,query:t?o.toString():void 0})}function cHe(a){let i=a.dataTransfer?.getData("Terminals");if(i){let e=JSON.parse(i),t=[];for(let o of e)t.push(A.parse(o));return t.length===0?void 0:t}}function dHe(a,i){if(i){for(let e of a)if(e.resource.path===i.path)return e}}var uHe=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super();this._resource=e;this._capabilities=t;this._clipboardService=o;this._contextMenuService=n;this._configurationService=r;this._themeService=s;this._openerService=l;this._quickInputService=c;this._commandService=p;this._accessibilitySignalService=h;this._notificationService=g;this._hoverService=f;this._contextPickService=v;this._chatWidgetService=b;this._instantiationService=S;this._capabilityDisposables=this._register(new Vt);this._decorations=new Map;this._registeredMenuItems=new Map;this._onDidRequestRunCommand=this._register(new E);this.onDidRequestRunCommand=this._onDidRequestRunCommand.event;this._onDidRequestCopyAsHtml=this._register(new E);this.onDidRequestCopyAsHtml=this._onDidRequestCopyAsHtml.event;this._register(Z(()=>this._dispose())),this._register(this._configurationService.onDidChangeConfiguration(y=>{y.affectsConfiguration("terminal.integrated.fontSize")||y.affectsConfiguration("terminal.integrated.lineHeight")?this.refreshLayouts():y.affectsConfiguration("workbench.colorCustomizations")?this._refreshStyles(!0):y.affectsConfiguration("terminal.integrated.shellIntegration.decorationsEnabled")&&(this._removeCapabilityDisposables(2),this._updateDecorationVisibility())})),this._register(this._themeService.onDidColorThemeChange(()=>this._refreshStyles(!0))),this._updateDecorationVisibility(),this._register(this._capabilities.onDidAddCapability(y=>this._createCapabilityDisposables(y.id))),this._register(this._capabilities.onDidRemoveCapability(y=>this._removeCapabilityDisposables(y.id))),this._register(u.onWillShutdown(()=>this._disposeAllDecorations()))}_createCapabilityDisposables(e){let t=this._capabilities.get(e);if(!t||this._capabilityDisposables.has(e))return;let o=new N;switch(t.type){case 4:o.add(t.onMarkAdded(n=>this.registerMarkDecoration(n)));break;case 2:{let n=this._getCommandDetectionListeners(t);for(let r of n)o.add(r);break}}this._capabilityDisposables.set(e,o)}_removeCapabilityDisposables(e){this._capabilityDisposables.deleteAndDispose(e)}registerMarkDecoration(e){if(!(!this._terminal||!this._showGutterDecorations&&!this._showOverviewRulerDecorations)&&!e.hidden)return this.registerCommandDecoration(void 0,void 0,e)}_updateDecorationVisibility(){let e=this._configurationService.getValue("terminal.integrated.shellIntegration.decorationsEnabled");this._showGutterDecorations=e==="both"||e==="gutter",this._showOverviewRulerDecorations=e==="both"||e==="overviewRuler",this._disposeAllDecorations(),(this._showGutterDecorations||this._showOverviewRulerDecorations)&&(this._attachToCommandCapability(),this._updateGutterDecorationVisibility());let t=this._capabilities.get(2)?.executingCommandObject;t&&this.registerCommandDecoration(t,!0)}_disposeAllDecorations(){this._placeholderDecoration?.dispose();for(let e of this._decorations.values())e.decoration.dispose(),Be(e.disposables)}_updateGutterDecorationVisibility(){let e=this._terminal?.element?.querySelectorAll("terminal-command-decoration");if(e)for(let t of e)this._updateCommandDecorationVisibility(t)}_updateCommandDecorationVisibility(e){this._showGutterDecorations?e.classList.remove("hide"):e.classList.add("hide")}refreshLayouts(){VOe(this._configurationService,this._placeholderDecoration?.element);for(let e of this._decorations)VOe(this._configurationService,e[1].decoration.element)}_refreshStyles(e){if(e)for(let t of this._decorations.values()){let o=this._getDecorationCssColor(t.command)?.toString()??"";t.decoration.options?.overviewRulerOptions?t.decoration.options.overviewRulerOptions.color=o:t.decoration.options&&(t.decoration.options.overviewRulerOptions={color:o})}this._updateClasses(this._placeholderDecoration?.element);for(let t of this._decorations.values())this._updateClasses(t.decoration.element,t.command,t.markProperties)}_dispose(){for(let e of this._capabilityDisposables.values())Be(e);this.clearDecorations()}_clearPlaceholder(){this._placeholderDecoration?.dispose(),this._placeholderDecoration=void 0}clearDecorations(){this._placeholderDecoration?.marker.dispose(),this._clearPlaceholder(),this._disposeAllDecorations(),this._decorations.clear()}_attachToCommandCapability(){if(this._capabilities.has(2)){let e=this._capabilities.get(2),t=this._getCommandDetectionListeners(e),o=new N;for(let n of t)o.add(n);this._capabilityDisposables.set(2,o)}}_getCommandDetectionListeners(e){this._removeCapabilityDisposables(2);let t=[];e.executingCommandObject?.marker&&this.registerCommandDecoration(e.executingCommandObject,!0),t.push(e.onCommandStarted(o=>this.registerCommandDecoration(o,!0)));for(let o of e.commands)this.registerCommandDecoration(o);return t.push(e.onCommandFinished(o=>{let n=this._terminal?.buffer?.active,r=o.promptStartMarker;(o.exitCode===void 0||n&&r&&n.baseY+n.cursorY>=r.line)&&this.registerCommandDecoration(o),o.exitCode?this._accessibilitySignalService.playSignal($o.terminalCommandFailed):this._accessibilitySignalService.playSignal($o.terminalCommandSucceeded)})),t.push(e.onCommandInvalidated(o=>{for(let n of o){let r=n.marker?.id;if(r){let s=this._decorations.get(r);s&&(s.decoration.dispose(),Be(s.disposables))}}})),t.push(e.onCurrentCommandInvalidated(o=>{o.reason==="noProblemsReported"?Array.from(this._decorations.entries())[this._decorations.size-1]?.[1].decoration.dispose():o.reason==="windows"&&this._clearPlaceholder()})),t}activate(e){this._terminal=e,this._attachToCommandCapability()}registerCommandDecoration(e,t,o){if(!this._terminal||t&&!e||!this._showGutterDecorations&&!this._showOverviewRulerDecorations)return;let n=e?.marker||o?.marker;if(!n)throw new Error(`cannot add a decoration for a command ${JSON.stringify(e)} with no marker`);this._clearPlaceholder();let r=this._getDecorationCssColor(e)?.toString()??"",s=this._terminal.registerDecoration({marker:n,overviewRulerOptions:this._showOverviewRulerDecorations?t?{color:r,position:"left"}:{color:r,position:e?.exitCode?"right":"left"}:void 0});if(s)return t&&(this._placeholderDecoration=s),s.onRender(l=>{l.classList.contains(".xterm-decoration-overview-ruler")||(this._decorations.get(s.marker.id)||(s.onDispose(()=>this._decorations.delete(s.marker.id)),this._decorations.set(s.marker.id,{decoration:s,disposables:this._createDisposables(l,e,o),command:e,markProperties:e?.markProperties||o})),(!l.classList.contains("codicon")||e?.marker?.line===0)&&(VOe(this._configurationService,l),this._updateClasses(l,e,e?.markProperties||o)))}),s}registerMenuItems(e,t){let o=this._registeredMenuItems.get(e);return o?o.push(...t):this._registeredMenuItems.set(e,[...t]),Z(()=>{let n=this._registeredMenuItems.get(e);if(n)for(let r of t.values()){let s=n.indexOf(r);s!==-1&&n.splice(s,1)}})}_createDisposables(e,t,o){return t?.exitCode===void 0&&!t?.markProperties?[]:t?.markProperties||o?[this._createHover(e,t||o,o?.hoverMessage)]:[...this._createContextMenu(e,t),this._createHover(e,t)]}_createHover(e,t,o){return this._hoverService.setupDelayedHover(e,()=>({content:new Ie(JDi(t,o,!0))}))}_updateClasses(e,t,o){if(e){for(let n of e.classList)e.classList.remove(n);if(e.classList.add("terminal-command-decoration","codicon","xterm-decoration"),o)e.classList.add("default-color",...q.asClassNameArray(Sbo)),o.hoverMessage||e.classList.add("default");else{let n=yKt(t);this._updateCommandDecorationVisibility(e);for(let r of n.classNames)e.classList.add(r);e.classList.add(...q.asClassNameArray(n.icon))}e.removeAttribute("title"),e.removeAttribute("aria-label")}}_createContextMenu(e,t){return[j(e,re.MOUSE_DOWN,async o=>{o.stopImmediatePropagation()}),j(e,re.CLICK,async o=>{o.stopImmediatePropagation();let n=await this._getCommandActions(t);this._contextMenuService.showContextMenu({getAnchor:()=>e,getActions:()=>n})}),j(e,re.CONTEXT_MENU,async o=>{o.stopImmediatePropagation();let n=await this._getCommandActions(t),r=this._getContextMenuActions();this._contextMenuService.showContextMenu({getAnchor:()=>e,getActions:()=>[...r,...n]})})]}_getContextMenuActions(){let e=d(14926,null);return[{class:void 0,tooltip:e,id:"terminal.toggleVisibility",label:e,enabled:!0,run:async()=>{this._showToggleVisibilityQuickPick()}}]}async _getCommandActions(e){let t=[],o=this._registeredMenuItems.get(e);o?.length&&t.push(...o,new ri);let n=this._createAttachToChatAction(e);if(n&&t.push(n,new ri),e.command!==""){let c=d(14922,null);t.push({class:void 0,tooltip:c,id:"terminal.rerunCommand",label:c,enabled:!0,run:async()=>{e.command!==""&&(!e.isTrusted&&!await new Promise(h=>{this._notificationService.prompt(ft.Info,d(14915,null,e.command),[{label:d(14927,null),run:()=>h(!0)},{label:d(14913,null),run:()=>h(!1)}])})||this._onDidRequestRunCommand.fire({command:e}))}}),t.push(new ri);let u=d(14917,null);t.push({class:void 0,tooltip:u,id:"terminal.copyCommand",label:u,enabled:!0,run:()=>this._clipboardService.writeText(e.command)})}if(e.hasOutput()){let c=d(14918,null);t.push({class:void 0,tooltip:c,id:"terminal.copyCommandAndOutput",label:c,enabled:!0,run:()=>{let h=e.getOutput();Fe(h)&&this._clipboardService.writeText(`${e.command!==""?e.command+`
`:""}${h}`)}});let u=d(14919,null);t.push({class:void 0,tooltip:u,id:"terminal.copyOutput",label:u,enabled:!0,run:()=>{let h=e.getOutput();Fe(h)&&this._clipboardService.writeText(h)}});let p=d(14920,null);t.push({class:void 0,tooltip:p,id:"terminal.copyOutputAsHtml",label:p,enabled:!0,run:()=>this._onDidRequestCopyAsHtml.fire({command:e})})}t.length>0&&t.push(new ri);let r=d(14925,null);t.push({class:void 0,tooltip:r,id:"workbench.action.terminal.runRecentCommand",label:r,enabled:!0,run:()=>this._commandService.executeCommand("workbench.action.terminal.runRecentCommand")});let s=d(14924,null);t.push({class:void 0,tooltip:r,id:"workbench.action.terminal.goToRecentDirectory",label:s,enabled:!0,run:()=>this._commandService.executeCommand("workbench.action.terminal.goToRecentDirectory")}),t.push(new ri);let l=d(14921,null);return t.push({class:void 0,tooltip:l,id:"terminal.learnShellIntegration",label:l,enabled:!0,run:()=>this._openerService.open("https://code.visualstudio.com/docs/terminal/shell-integration")}),t}_createAttachToChatAction(e){if(!this._chatWidgetService.getWidgetsByLocations("panel").some(n=>n.attachmentCapabilities.supportsTerminalAttachments))return;let o=d(14916,null);return{class:void 0,tooltip:o,id:"terminal.attachToChat",label:o,enabled:!0,run:async()=>{let n=this._chatWidgetService.lastFocusedWidget??this._chatWidgetService.getWidgetsByLocations("panel")?.find(s=>s.attachmentCapabilities.supportsTerminalAttachments);if(n||(n=await this._chatWidgetService.revealWidget()),!n)return;let r;if(this._resource){let s=Rq(this._resource);r=this._instantiationService.createInstance(N0e,lHe(s.workspaceId,s.instanceId,void 0,e.id))}if(r&&n.attachmentCapabilities.supportsTerminalAttachments){try{let s=await r.asAttachment(n);if(s){n.attachmentModel.addContext(s),n.focusInput();return}}catch{}this._store.add(this._contextPickService.registerChatContextItem(r))}}}}_showToggleVisibilityQuickPick(){let e=this._register(this._quickInputService.createQuickPick());e.hideInput=!0,e.hideCheckAll=!0,e.canSelectMany=!0,e.title=d(14923,null);let t=this._configurationService.getValue("terminal.integrated.shellIntegration.decorationsEnabled"),o={label:d(14912,null),picked:t!=="never"&&t!=="overviewRuler"},n={label:d(14914,null),picked:t!=="never"&&t!=="gutter"};e.items=[o,n];let r=[];t!=="never"&&(t!=="gutter"&&r.push(o),t!=="overviewRuler"&&r.push(n)),e.selectedItems=r,this._register(e.onDidChangeSelection(async s=>{let l="never";s.includes(o)?s.includes(n)?l="both":l="gutter":s.includes(n)&&(l="overviewRuler"),await this._configurationService.updateValue("terminal.integrated.shellIntegration.decorationsEnabled",l)})),e.ok=!1,e.show()}_getDecorationCssColor(e){let t;return e?.exitCode===void 0?t=ioo:t=e.exitCode?noo:ooo,this._themeService.getColorTheme().getColor(t)?.toString()}};uHe=I([m(2,Fi),m(3,Xe),m(4,B),m(5,Le),m(6,Je),m(7,Ue),m(8,ji),m(9,ge),m(10,lr),m(11,Ne),m(12,nt),m(13,DS),m(14,Pt),m(15,F)],uHe);var OEo=new Map,pHe=class{async importAddon(i){let e=OEo.get(i);if(!e){switch(i){case"clipboard":e=(await Pg("@xterm/addon-clipboard","lib/addon-clipboard.js")).ClipboardAddon;break;case"image":e=(await Pg("@xterm/addon-image","lib/addon-image.js")).ImageAddon;break;case"ligatures":e=(await Pg("@xterm/addon-ligatures","lib/addon-ligatures.js")).LigaturesAddon;break;case"progress":e=(await Pg("@xterm/addon-progress","lib/addon-progress.js")).ProgressAddon;break;case"search":e=(await Pg("@xterm/addon-search","lib/addon-search.js")).SearchAddon;break;case"serialize":e=(await Pg("@xterm/addon-serialize","lib/addon-serialize.js")).SerializeAddon;break;case"unicode11":e=(await Pg("@xterm/addon-unicode11","lib/addon-unicode11.js")).Unicode11Addon;break;case"webgl":e=(await Pg("@xterm/addon-webgl","lib/addon-webgl.js")).WebglAddon;break}if(!e)throw new Error(`Could not load addon ${i}`);OEo.set(i,e)}return e}};function Yun(a,i){let e=i.getLine(a);if(!e)return{lineData:void 0,lineIndex:a};let t=e.translateToString(!0);for(;a>0&&e.isWrapped&&(e=i.getLine(--a),!!e);)t=e.translateToString(!1)+t;return{lineData:t,lineIndex:a}}var QM=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super();this._onDidExecuteText=n;this._configurationService=r;this._instantiationService=s;this._logService=l;this._notificationService=c;this._themeService=u;this._telemetryService=p;this._terminalConfigurationService=h;this._clipboardService=g;this._accessibilitySignalService=v;this._isPhysicalMouseWheel=X1.INSTANCE.isPhysicalMouseWheel();this._progressState={state:0,value:0};this._webglAddonCustomGlyphs=!1;this._ligaturesAddon=this._register(new me);this._attachedDisposables=this._register(new N);this._onDidRequestRunCommand=this._register(new E);this.onDidRequestRunCommand=this._onDidRequestRunCommand.event;this._onDidRequestCopyAsHtml=this._register(new E);this.onDidRequestCopyAsHtml=this._onDidRequestCopyAsHtml.event;this._onDidRequestRefreshDimensions=this._register(new E);this.onDidRequestRefreshDimensions=this._onDidRequestRefreshDimensions.event;this._onDidChangeFindResults=this._register(new E);this.onDidChangeFindResults=this._onDidChangeFindResults.event;this._onBeforeSearch=this._register(new E);this.onBeforeSearch=this._onBeforeSearch.event;this._onAfterSearch=this._register(new E);this.onAfterSearch=this._onAfterSearch.event;this._onDidChangeSelection=this._register(new E);this.onDidChangeSelection=this._onDidChangeSelection.event;this._onDidChangeFocus=this._register(new E);this.onDidChangeFocus=this._onDidChangeFocus.event;this._onDidDispose=this._register(new E);this.onDidDispose=this._onDidDispose.event;this._onDidChangeProgress=this._register(new E);this.onDidChangeProgress=this._onDidChangeProgress.event;this._xtermAddonLoader=o.xtermAddonImporter??new pHe,this._xtermColorProvider=o.xtermColorProvider,this._capabilities=o.capabilities;let S=this._terminalConfigurationService.getFont(Ki(),void 0,!0),y=this._terminalConfigurationService.config,w=this._configurationService.getValue("editor");this.raw=this._register(new t({allowProposedApi:!0,cols:o.cols,rows:o.rows,documentOverride:b.mainContainer.ownerDocument,altClickMovesCursor:y.altClickMovesCursor&&w.multiCursorModifier==="alt",scrollback:y.scrollback,theme:this.getXtermTheme(),drawBoldTextInBrightColors:y.drawBoldTextInBrightColors,fontFamily:S.fontFamily,fontWeight:y.fontWeight,fontWeightBold:y.fontWeightBold,fontSize:S.fontSize,letterSpacing:S.letterSpacing,lineHeight:S.lineHeight,logLevel:FEo(this._logService.getLevel()),logger:this._logService,minimumContrastRatio:y.minimumContrastRatio,tabStopWidth:y.tabStopWidth,cursorBlink:y.cursorBlinking,blinkIntervalDuration:y.textBlinking?600:0,cursorStyle:T5t(y.cursorStyle),cursorInactiveStyle:T5t(y.cursorStyleInactive),cursorWidth:y.cursorWidth,macOptionIsMeta:y.macOptionIsMeta,macOptionClickForcesSelection:y.macOptionClickForcesSelection,rightClickSelectsWord:y.rightClickBehavior==="selectWord",fastScrollSensitivity:y.fastScrollSensitivity,scrollSensitivity:y.mouseWheelScrollSensitivity,scrollOnEraseInDisplay:!0,wordSeparator:y.wordSeparators,scrollbar:o.disableOverviewRuler?void 0:{width:14,overviewRuler:{showTopBorder:!0}},ignoreBracketedPasteMode:y.ignoreBracketedPasteMode,rescaleOverlappingGlyphs:y.rescaleOverlappingGlyphs,vtExtensions:{kittyKeyboard:y.enableKittyKeyboardProtocol,win32InputMode:y.enableWin32InputMode},allowTransparency:y.enableImages,windowOptions:{getWinSizePixels:!0,getCellSizePixels:!0,getWinSizeChars:!0}})),this._updateSmoothScrolling(),this._core=this.raw._core,this._register(this._configurationService.onDidChangeConfiguration(async k=>{k.affectsConfiguration("terminal.integrated.gpuAcceleration")&&(QM._suggestedRendererType=void 0),(k.affectsConfiguration("terminal.integrated")||k.affectsConfiguration("editor.fastScrollSensitivity")||k.affectsConfiguration("editor.mouseWheelScrollSensitivity")||k.affectsConfiguration("editor.multiCursorModifier"))&&this.updateConfig(),k.affectsConfiguration("terminal.integrated.unicodeVersion")&&this._updateUnicodeVersion(),k.affectsConfiguration("terminal.integrated.shellIntegration.decorationsEnabled")&&this._updateTheme()})),this._register(this._themeService.onDidColorThemeChange(k=>this._updateTheme(k))),this._register(this._logService.onDidChangeLogLevel(k=>this.raw.options.logLevel=FEo(k))),this._register(this.raw.onSelectionChange(()=>{this._onDidChangeSelection.fire(),this.isFocused&&this._anyFocusedTerminalHasSelection.set(this.raw.hasSelection())})),this._register(this.raw.onData(k=>this._lastInputEvent=k)),this._updateUnicodeVersion(),this._markNavigationAddon=this._instantiationService.createInstance(aHe,o.capabilities),this.raw.loadAddon(this._markNavigationAddon),this._decorationAddon=this._instantiationService.createInstance(uHe,e,this._capabilities),this._register(this._decorationAddon.onDidRequestRunCommand(k=>this._onDidRequestRunCommand.fire(k))),this._register(this._decorationAddon.onDidRequestCopyAsHtml(k=>this._onDidRequestCopyAsHtml.fire(k))),this.raw.loadAddon(this._decorationAddon),this._shellIntegrationAddon=new E5t(o.shellIntegrationNonce??"",o.disableShellIntegrationReporting,this._onDidExecuteText,this._telemetryService,this._logService),this.raw.loadAddon(this._shellIntegrationAddon),this._xtermAddonLoader.importAddon("clipboard").then(k=>{this._store.isDisposed||(this._clipboardAddon=this._instantiationService.createInstance(k,void 0,{async readText(T){return g.readText(T==="p"?"selection":"clipboard")},async writeText(T,P){return g.writeText(P,T==="p"?"selection":"clipboard")}}),this.raw.loadAddon(this._clipboardAddon))}),this._xtermAddonLoader.importAddon("progress").then(k=>{if(this._store.isDisposed)return;let T=this._instantiationService.createInstance(k);this.raw.loadAddon(T);let P=()=>{eo(this._progressState,T.progress)||(this._progressState=T.progress,this._onDidChangeProgress.fire(this._progressState))};this._register(T.onChange(()=>P())),P();let O=this._capabilities.get(2);if(O)this._register(O.onCommandFinished(()=>T.progress={state:0,value:0}));else{let V=this._capabilities.onDidAddCapability(H=>{H.id===2&&(this._register(H.capability.onCommandFinished(()=>T.progress={state:0,value:0})),this._store.delete(V))});this._store.add(V)}}),this._anyTerminalFocusContextKey=dt.focusInAny.bindTo(f),this._anyFocusedTerminalHasSelection=dt.textSelectedInFocused.bindTo(f)}static{this._suggestedRendererType=void 0}get lastInputEvent(){return this._lastInputEvent}get progressState(){return this._progressState}get buffer(){return this.raw.buffer}get cols(){return this.raw.cols}get findResult(){return this._lastFindResult}get isStdinDisabled(){return!!this.raw.options.disableStdin}get isGpuAccelerated(){return!!this._webglAddon}get isImageAddonLoaded(){return!!this._imageAddon}get markTracker(){return this._markNavigationAddon}get shellIntegration(){return this._shellIntegrationAddon}get decorationAddon(){return this._decorationAddon}get textureAtlas(){let e=this._webglAddon?.textureAtlas;if(e)return createImageBitmap(e)}get isFocused(){return this.raw.element?Gr(this.raw.element):!1}*getBufferReverseIterator(){for(let e=this.raw.buffer.active.length-1;e>=0;e--){let{lineData:t,lineIndex:o}=Yun(e,this.raw.buffer.active);t&&(e=o,yield t)}}getContentsAsText(e,t){let o=[],n=this.raw.buffer.active;if(e?.line===-1)throw new Error("Cannot get contents of a disposed startMarker");if(t?.line===-1)throw new Error("Cannot get contents of a disposed endMarker");let r=e?.line??0,s=t?.line??n.length-1;for(let l=r;l<=s;l++)o.push(n.getLine(l)?.translateToString(!0)??"");return o.join(`
`)}async getContentsAsHtml(){if(!this._serializeAddon){let e=await this._xtermAddonLoader.importAddon("serialize");this._serializeAddon=new e,this.raw.loadAddon(this._serializeAddon)}return this._serializeAddon.serializeAsHTML()}async getCommandOutputAsHtml(e,t){if(!this._serializeAddon){let h=await this._xtermAddonLoader.importAddon("serialize");this._serializeAddon=new h,this.raw.loadAddon(this._serializeAddon)}let o,n;e.executedMarker&&e.executedMarker.line>=0?(o=e.executedMarker.line,n=Math.max(e.executedX??0,0)):(o=e.marker?.line!==void 0?e.marker.line+1:1,n=Math.max(e.startX??0,0));let r=e.endMarker?.line!==void 0?e.endMarker.line-1:this.raw.buffer.active.length-1;if(r<o)return{text:"",truncated:!1};let s=0;for(let h=r;h>=o;h--){let g=this.raw.buffer.active.getLine(h);if(g&&g.translateToString(!0).trim()==="")s++;else break}r=r-s;let l=0;for(let h=o;h<=r;h++){let g=this.raw.buffer.active.getLine(h);if(g&&g.translateToString(!0,h===o?n:void 0).trim()==="")h===o&&(n=0),l++;else break}o=o+l,t&&r-o>t&&(o=r-t,n=0);let c=this.raw.buffer.active.getLine(o);c&&(n=Math.min(n,c.length));let u={startLine:o,endLine:r,startCol:n};return{text:this._serializeAddon.serializeAsHTML({range:u}),truncated:r-o>=t}}async getSelectionAsHtml(e){if(!this._serializeAddon){let o=await this._xtermAddonLoader.importAddon("serialize");this._serializeAddon=new o,this.raw.loadAddon(this._serializeAddon)}if(e){let o=e.getOutput()?.length,n=e.marker?.line;if(!o||!n)throw new Error(`No row ${n} or output length ${o} for command ${e}`);this.raw.select(0,n+1,o-Math.floor(o/this.raw.cols))}let t=this._serializeAddon.serializeAsHTML({onlySelection:!0});return e&&this.raw.clearSelection(),t}attachToElement(e,t){let o={enableGpu:!0,...t};if(this._attached||this.raw.open(e),o.enableGpu&&this._shouldLoadWebgl()&&this._enableWebglRenderer(),!this.raw.element||!this.raw.textarea)throw new Error("xterm elements not set after open");let n=this._attachedDisposables;return n.clear(),n.add(j(this.raw.textarea,"focus",()=>this._setFocused(!0))),n.add(j(this.raw.textarea,"blur",()=>this._setFocused(!1))),n.add(j(this.raw.textarea,"focusout",()=>this._setFocused(!1))),n.add(j(this.raw.element,re.MOUSE_WHEEL,r=>{let s=X1.INSTANCE;s.acceptStandardWheelEvent(new p_(r));let l=s.isPhysicalMouseWheel();l!==this._isPhysicalMouseWheel&&(this._isPhysicalMouseWheel=l,this._updateSmoothScrolling())},{passive:!0})),this._refreshLigaturesAddon(),this._attached={container:e,options:o},this._attached?.container.querySelector(".xterm-screen")}_setFocused(e){this._onDidChangeFocus.fire(e),this._anyTerminalFocusContextKey.set(e),this._anyFocusedTerminalHasSelection.set(e&&this.raw.hasSelection())}write(e,t){this.raw.write(e,t)}resize(e,t){this._logService.debug("resizing",e,t),this.raw.resize(e,t)}updateConfig(){let e=this._terminalConfigurationService.config;this.raw.options.altClickMovesCursor=e.altClickMovesCursor,this._setCursorBlink(e.cursorBlinking),this._setTextBlinking(e.textBlinking),this._setCursorStyle(e.cursorStyle),this._setCursorStyleInactive(e.cursorStyleInactive),this._setCursorWidth(e.cursorWidth),this.raw.options.scrollback=e.scrollback,this.raw.options.drawBoldTextInBrightColors=e.drawBoldTextInBrightColors,this.raw.options.minimumContrastRatio=e.minimumContrastRatio,this.raw.options.tabStopWidth=e.tabStopWidth,this.raw.options.fastScrollSensitivity=e.fastScrollSensitivity,this.raw.options.scrollSensitivity=e.mouseWheelScrollSensitivity,this.raw.options.macOptionIsMeta=e.macOptionIsMeta;let t=this._configurationService.getValue("editor");this.raw.options.altClickMovesCursor=e.altClickMovesCursor&&t.multiCursorModifier==="alt",this.raw.options.macOptionClickForcesSelection=e.macOptionClickForcesSelection,this.raw.options.rightClickSelectsWord=e.rightClickBehavior==="selectWord",this.raw.options.wordSeparator=e.wordSeparators,this.raw.options.ignoreBracketedPasteMode=e.ignoreBracketedPasteMode,this.raw.options.rescaleOverlappingGlyphs=e.rescaleOverlappingGlyphs,this.raw.options.allowTransparency=e.enableImages,this.raw.options.vtExtensions={kittyKeyboard:e.enableKittyKeyboardProtocol,win32InputMode:e.enableWin32InputMode},this._updateSmoothScrolling(),this._attached&&(this._attached.options.enableGpu&&(this._shouldLoadWebgl()?this._enableWebglRenderer():this._disposeOfWebglRenderer()),this._refreshLigaturesAddon())}_updateSmoothScrolling(){this.raw.options.smoothScrollDuration=this._terminalConfigurationService.config.smoothScrolling&&this._isPhysicalMouseWheel?125:0}_shouldLoadWebgl(){return this._terminalConfigurationService.config.gpuAcceleration==="auto"&&QM._suggestedRendererType===void 0||this._terminalConfigurationService.config.gpuAcceleration==="on"}forceRedraw(){this.raw.clearTextureAtlas()}clearDecorations(){this._decorationAddon?.clearDecorations()}forceRefresh(){this._core.viewport?._innerRefresh()}async findNext(e,t){return this._updateFindColors(t),(await this._getSearchAddon()).findNext(e,t)}async findPrevious(e,t){return this._updateFindColors(t),(await this._getSearchAddon()).findPrevious(e,t)}_updateFindColors(e){let t=this._themeService.getColorTheme(),o=t.getColor(RJ)||t.getColor(lI),n=t.getColor(soo),r=t.getColor(aoo),s=t.getColor(uMt),l=t.getColor(loo),c=t.getColor(coo),u=t.getColor(doo);e.decorations={activeMatchBackground:n?.toString(),activeMatchBorder:r?.toString()||"transparent",activeMatchColorOverviewRuler:s?.toString()||"transparent",matchBackground:o?l?.blend(o).toString():void 0,matchBorder:c?.toString()||"transparent",matchOverviewRuler:u?.toString()||"transparent"}}_getSearchAddon(){return this._searchAddonPromise||(this._searchAddonPromise=this._xtermAddonLoader.importAddon("search").then(e=>this._store.isDisposed?Promise.reject("Could not create search addon, terminal is disposed"):(this._searchAddon=new e({highlightLimit:2e4}),this.raw.loadAddon(this._searchAddon),this._store.add(this._searchAddon.onDidChangeResults(t=>{this._lastFindResult=t,this._onDidChangeFindResults.fire(t)})),this._store.add(this._searchAddon.onBeforeSearch(()=>{this._onBeforeSearch.fire()})),this._store.add(this._searchAddon.onAfterSearch(()=>{this._onAfterSearch.fire()})),this._searchAddon))),this._searchAddonPromise}clearSearchDecorations(){this._searchAddon?.clearDecorations()}clearActiveSearchDecoration(){this._searchAddon?.clearActiveDecoration()}getFont(){return this._terminalConfigurationService.getFont(Re(this.raw.element),this._core)}getLongestViewportWrappedLineLength(){let e=0;for(let t=this.raw.buffer.active.length-1;t>=this.raw.buffer.active.viewportY;t--){let o=this._getWrappedLineCount(t,this.raw.buffer.active);e=Math.max(e,o.lineCount*this.raw.cols-o.endSpaces||0),t=o.currentIndex}return e}_getWrappedLineCount(e,t){let o=t.getLine(e);if(!o)throw new Error("Could not get line");let n=e,r=0;for(let s=Math.min(o.length,this.raw.cols)-1;s>=0&&!o?.getCell(s)?.getChars();s--)r++;for(;o?.isWrapped&&n>0;)n--,o=t.getLine(n);return{lineCount:e-n+1,currentIndex:n,endSpaces:r}}scrollDownLine(){this.raw.scrollLines(1)}scrollDownPage(){this.raw.scrollPages(1)}scrollToBottom(){this.raw.scrollToBottom()}scrollUpLine(){this.raw.scrollLines(-1)}scrollUpPage(){this.raw.scrollPages(-1)}scrollToTop(){this.raw.scrollToTop()}scrollToLine(e,t=0){this.markTracker.scrollToLine(e,t)}clearBuffer(){this.raw.clear(),this._capabilities.get(2)?.handlePromptStart(),this._capabilities.get(2)?.handleCommandStart(),this._accessibilitySignalService.playSignal($o.clear)}reset(){this.raw.reset()}hasSelection(){return this.raw.hasSelection()}clearSelection(){this.raw.clearSelection()}selectMarkedRange(e,t,o=!1){let n=this.shellIntegration.capabilities.get(4);if(!n)return;let r=n.getMark(e),s=n.getMark(t);r===void 0||s===void 0||(this.raw.selectLines(r.line,s.line),o&&this.raw.scrollToLine(r.line))}selectAll(){this.raw.focus(),this.raw.selectAll()}focus(){this.raw.focus()}async copySelection(e,t){if(this.hasSelection()||e&&t)if(e){let n=function(s){s.clipboardData&&(s.clipboardData.types.includes("text/plain")||s.clipboardData.setData("text/plain",t?.getOutput()??""),s.clipboardData.setData("text/html",o)),s.preventDefault()},o=await this.getSelectionAsHtml(t),r=uae(this.raw.element);r.addEventListener("copy",n),r.execCommand("copy"),r.removeEventListener("copy",n)}else await this._clipboardService.writeText(this.raw.getSelection());else this._notificationService.warn(d(14938,null))}_setCursorBlink(e){this.raw.options.cursorBlink!==e&&(this.raw.options.cursorBlink=e,this.raw.refresh(0,this.raw.rows-1))}_setTextBlinking(e){let t=e?600:0,o=this.raw.options;o.blinkIntervalDuration!==t&&(o.blinkIntervalDuration=t)}_setCursorStyle(e){let t=T5t(e);this.raw.options.cursorStyle!==t&&(this.raw.options.cursorStyle=t)}_setCursorStyleInactive(e){let t=T5t(e);this.raw.options.cursorInactiveStyle!==t&&(this.raw.options.cursorInactiveStyle=t)}_setCursorWidth(e){this.raw.options.cursorWidth!==e&&(this.raw.options.cursorWidth=e)}async _enableWebglRenderer(){if(!this.raw.element||this._webglAddon&&this._webglAddonCustomGlyphs===this._terminalConfigurationService.config.customGlyphs)return;this._disposeOfWebglRenderer(),this._webglAddonCustomGlyphs=this._terminalConfigurationService.config.customGlyphs;let e=await this._xtermAddonLoader.importAddon("webgl");this._webglAddon=new e({customGlyphs:this._terminalConfigurationService.config.customGlyphs});try{this.raw.loadAddon(this._webglAddon),this._logService.trace("Webgl was loaded"),this._store.add(this._webglAddon.onContextLoss(()=>{this._logService.info("Webgl lost context, disposing of webgl renderer"),this._disposeOfWebglRenderer()})),this._refreshImageAddon(),this._onDidRequestRefreshDimensions.fire()}catch(t){this._logService.warn("Webgl could not be loaded. Falling back to the DOM renderer",t),QM._suggestedRendererType="dom",this._disposeOfWebglRenderer()}}async _refreshLigaturesAddon(){if(!this.raw.element)return;let e=this._terminalConfigurationService.config.fontLigatures,t=!1;if(e?.enabled){if(this._ligaturesAddon.value&&!eo(e,this._ligaturesAddonConfig)&&this._ligaturesAddon.clear(),!this._ligaturesAddon.value){let o=await this._xtermAddonLoader.importAddon("ligatures");if(this._store.isDisposed)return;this._ligaturesAddon.value=this._instantiationService.createInstance(o,{fontFeatureSettings:e.featureSettings,fallbackLigatures:e.fallbackLigatures}),this.raw.loadAddon(this._ligaturesAddon.value),t=!0}}else{if(!this._ligaturesAddon.value)return;this._ligaturesAddon.clear(),t=!0}t&&this._webglAddon&&(this._disposeOfWebglRenderer(),await this._enableWebglRenderer())}async _refreshImageAddon(){if(this._terminalConfigurationService.config.enableImages&&this._webglAddon){if(!this._imageAddon){let e=await this._xtermAddonLoader.importAddon("image");this._imageAddon=new e,this.raw.loadAddon(this._imageAddon),this._telemetryService.publicLog2("terminal/imageAddonActivated"),this._register(this._imageAddon.onImageAdded(()=>{this._telemetryService.publicLog2("terminal/imageAdded")}))}}else{try{this._imageAddon?.dispose()}catch{}this._imageAddon=void 0}}_disposeOfWebglRenderer(){if(this._webglAddon){try{this._webglAddon?.dispose()}catch{}this._webglAddon=void 0,this._webglAddonCustomGlyphs=void 0,this._refreshImageAddon(),this._onDidRequestRefreshDimensions.fire()}}async getRangeAsVT(e,t,o){if(!this._serializeAddon){let c=await this._xtermAddonLoader.importAddon("serialize");this._serializeAddon=new c,this.raw.loadAddon(this._serializeAddon)}let n=this.raw.buffer.active.length-1;if(n<0)return"";let r=Yo(t?.line),s=Bn(Yo(e?.line)&&e.line>-1?e.line:0,0,n),l=r?t.line:this.raw.buffer.active.length-1;return o&&r&&(l=l-1),l=Bn(Math.max(l,s),s,n),this._serializeAddon.serialize({range:{start:s,end:l}})}getXtermTheme(e){e||(e=this._themeService.getColorTheme());let t=this._terminalConfigurationService.config,o=["never","gutter"].includes(t.shellIntegration?.decorationsEnabled??""),n=e.getColor(Xio),r=this._xtermColorProvider.getBackgroundColor(e),s=e.getColor(Jio)||n,l=e.getColor(Zio)||r,c=e.getColor($Te),u=e.getColor(eoo),p=e.getColor(too)||void 0;return{background:r?.toString(),foreground:n?.toString(),cursor:s?.toString(),cursorAccent:l?.toString(),selectionBackground:c?.toString(),selectionInactiveBackground:u?.toString(),selectionForeground:p?.toString(),overviewRulerBorder:o?"#0000":e.getColor(roo)?.toString(),scrollbarSliderActiveBackground:e.getColor(K1)?.toString(),scrollbarSliderBackground:e.getColor(k7)?.toString(),scrollbarSliderHoverBackground:e.getColor(z1)?.toString(),black:e.getColor(CS[0])?.toString(),red:e.getColor(CS[1])?.toString(),green:e.getColor(CS[2])?.toString(),yellow:e.getColor(CS[3])?.toString(),blue:e.getColor(CS[4])?.toString(),magenta:e.getColor(CS[5])?.toString(),cyan:e.getColor(CS[6])?.toString(),white:e.getColor(CS[7])?.toString(),brightBlack:e.getColor(CS[8])?.toString(),brightRed:e.getColor(CS[9])?.toString(),brightGreen:e.getColor(CS[10])?.toString(),brightYellow:e.getColor(CS[11])?.toString(),brightBlue:e.getColor(CS[12])?.toString(),brightMagenta:e.getColor(CS[13])?.toString(),brightCyan:e.getColor(CS[14])?.toString(),brightWhite:e.getColor(CS[15])?.toString()}}_updateTheme(e){this.raw.options.theme=this.getXtermTheme(e)}refresh(){this._updateTheme(),this._decorationAddon.refreshLayouts()}async _updateUnicodeVersion(){if(!this._unicode11Addon&&this._terminalConfigurationService.config.unicodeVersion==="11"){let e=await this._xtermAddonLoader.importAddon("unicode11");this._unicode11Addon=new e,this.raw.loadAddon(this._unicode11Addon)}this.raw.unicode.activeVersion!==this._terminalConfigurationService.config.unicodeVersion&&(this.raw.unicode.activeVersion=this._terminalConfigurationService.config.unicodeVersion)}_writeText(e){this.raw.write(e)}dispose(){this._anyTerminalFocusContextKey.reset(),this._anyFocusedTerminalHasSelection.reset(),this._disposeOfWebglRenderer(),this._onDidDispose.fire(),super.dispose()}};I([Zd(100)],QM.prototype,"_refreshLigaturesAddon",1),I([Zd(100)],QM.prototype,"_refreshImageAddon",1),QM=I([m(4,B),m(5,F),m(6,ca),m(7,Ne),m(8,Le),m(9,Te),m(10,Uu),m(11,Fi),m(12,X),m(13,lr),m(14,Kl)],QM);function _5t(a,i,e,t){if(!i.charWidth||!i.charHeight)return null;let o=e*a.devicePixelRatio,n=i.charWidth*a.devicePixelRatio+i.letterSpacing,r=Math.max(Math.floor(o/n),1),s=t*a.devicePixelRatio,l=Math.ceil(i.charHeight*a.devicePixelRatio),c=Math.floor(l*i.lineHeight);return{rows:Math.max(Math.floor(s/c),1),cols:r}}function FEo(a){switch(a){case 1:return"trace";case 2:return"debug";case 3:return"info";case 4:return"warn";case 5:return"error";default:return"off"}}function T5t(a){return a==="line"?"bar":a}var VFi=class extends wh{constructor(e,t){super();this._original=e;this._modified=t;this.original=this._original.object.textEditorModel,this.modified=this._modified.object.textEditorModel}dispose(){super.dispose(),this._original.dispose(),this._modified.dispose()}},Wat={scrollBeyondLastLine:!1,links:!0,lineNumbers:"off",glyphMargin:!1,scrollbar:{vertical:"hidden",horizontal:"auto",useShadows:!1,verticalHasArrows:!1,horizontalHasArrows:!1,handleMouseWheel:!1},overviewRulerLanes:0,fixedOverflowWidgets:!0,readOnly:!0,stickyScroll:{enabled:!1},minimap:{enabled:!1},automaticLayout:!1},WFi={...Wat,enableSplitViewResizing:!0,isInEmbeddedEditor:!0,renderOverviewRuler:!1,ignoreTrimWhitespace:!1,renderSideBySide:!0,useInlineViewWhenSpaceIsLimited:!1,originalAriaLabel:d(15957,null),modifiedAriaLabel:d(15956,null),diffAlgorithm:"advanced"};function VEo(a,i,e){let t=new Set(Object.keys(a));function o(){let n=i.getValue("editor"),r=!1,s={};for(let[l,c]of Object.entries(n))!t.has(l)&&a[l]!==c&&(s[l]=c,r=!0);return r?s:void 0}return Object.assign(a,o()),i.onDidChangeConfiguration(n=>{if(n.affectsConfiguration("editor")){let r=o();r&&(e(r),Object.assign(a,r))}})}var mHe=class extends x{constructor(e,t,o,n,r){super();this.editor=e;this.container=t;this.instantiationService=o;this.modelService=n;this.configurationService=r;this.widget=this._register(new me);this.model=this._register(new me)}get onDidContentSizeChange(){return this.widget.value?.onDidContentSizeChange||U.None}async update(e){if(!(e instanceof Um))return this.clear(),!1;let t=e.message;if(!JF.isDiffable(t))return this.clear(),!1;let[o,n]=await Promise.all([this.modelService.createModelReference(e.expectedUri),this.modelService.createModelReference(e.actualUri)]),r=this.model.value=new VFi(o,n);if(!this.widget.value){let s={...WFi},l=VEo(s,this.configurationService,u=>c.updateOptions(u)),c=this.widget.value=this.editor?this.instantiationService.createInstance(dL,this.container,s,{},this.editor):this.instantiationService.createInstance(op,this.container,s,{});U.once(c.onDidDispose)(()=>{l.dispose()}),this.dimension&&c.layout(this.dimension)}return this.widget.value.setModel(r),this.widget.value.updateOptions(this.getOptions(WEo(t.expected)||WEo(t.actual))),!0}clear(){this.model.clear(),this.widget.clear()}layout(e,t){this.dimension=e;let o=this.widget.value;if(!o)return;o.layout(e);let n=Math.max(o.getOriginalEditor().getContentHeight(),o.getModifiedEditor().getContentHeight());return o.updateOptions({scrollbar:{...Wat.scrollbar,handleMouseWheel:!t}}),this.helper=new D5t(t,n,e.height),n}onScrolled(e){this.helper?.onScrolled(e,this.widget.value?.getDomNode(),this.widget.value?.getOriginalEditor())}getOptions(e){return e?{...WFi,lineNumbers:"on"}:{...WFi,lineNumbers:"off"}}};mHe=I([m(2,F),m(3,Bt),m(4,B)],mHe);var hHe=class extends x{constructor(e,t){super();this.container=e;this.markdownRendererService=t;this.rendered=this._register(new N);this._register(Z(()=>this.clear()))}async update(e){if(this.clear(),!(e instanceof Um))return!1;let t=e.message;if(JF.isDiffable(t)||typeof t.message=="string")return!1;let o=this.rendered.add(this.markdownRendererService.render(t.message,{}));return o.element.style.userSelect="text",o.element.classList.add("preview-text"),this.container.appendChild(o.element),this.element=o.element,this.rendered.add(Z(()=>o.element.remove())),!0}layout(e){if(this.element)return this.element.style.width=`${e.width-32}px`,this.element.clientHeight}clear(){this.rendered.clear(),this.element=void 0}};hHe=I([m(1,On)],hHe);var D5t=class{constructor(i,e,t){this.hasMultipleFrames=i;this.contentHeight=e;this.viewHeight=t}onScrolled(i,e,t){if(!t||!e)return;let o=Math.max(0,i.scrollTop-(this.hasMultipleFrames?sHe:0));o=Math.min(Math.max(0,this.contentHeight-this.viewHeight),o),t.setScrollTop(o),e.style.transform=`translateY(${o}px)`}},gHe=class extends x{constructor(e,t,o,n,r){super();this.editor=e;this.container=t;this.instantiationService=o;this.modelService=n;this.configurationService=r;this.widgetDecorations=this._register(new me);this.widget=this._register(new me);this.model=this._register(new me)}get onDidContentSizeChange(){return this.widget.value?.onDidContentSizeChange||U.None}async update(e){if(!(e instanceof Um))return this.clear(),!1;let t=e.message;if(JF.isDiffable(t)||t.type===1||typeof t.message!="string")return this.clear(),!1;let o=this.model.value=await this.modelService.createModelReference(e.messageUri);if(!this.widget.value){let n={...Wat},r=VEo(n,this.configurationService,l=>s.updateOptions(l)),s=this.widget.value=this.editor?this.instantiationService.createInstance(id,this.container,n,{},this.editor):this.instantiationService.createInstance(Xr,this.container,n,{isSimpleWidget:!0});U.once(s.onDidDispose)(()=>{r.dispose()}),this.dimension&&s.layout(this.dimension)}return this.widget.value.setModel(o.object.textEditorModel),this.widget.value.updateOptions(Wat),this.widgetDecorations.value=bEo(t.message,this.widget.value),!0}clear(){this.widgetDecorations.clear(),this.widget.clear(),this.model.clear()}onScrolled(e){this.helper?.onScrolled(e,this.widget.value?.getDomNode(),this.widget.value)}layout(e,t){this.dimension=e;let o=this.widget.value;if(!o)return;o.layout(e);let n=o.getContentHeight();return this.helper=new D5t(t,n,e.height),o.updateOptions({scrollbar:{...Wat.scrollbar,handleMouseWheel:!t}}),n}};gHe=I([m(2,F),m(3,Bt),m(4,B)],gHe);var fHe=class extends x{constructor(e,t,o,n,r){super();this.container=e;this.isInPeekView=t;this.terminalService=o;this.viewDescriptorService=n;this.workspaceContext=r;this.terminalCwd=this._register(new $M(""));this.xtermLayoutDelayer=this._register(new Xo(50));this.terminal=this._register(new me);this.outputDataListener=this._register(new me)}async makeTerminal(){let e=this.terminal.value;if(e)return e.xterm.clearBuffer(),e.xterm.clearSearchDecorations(),e.xterm.write("\x1Bc"),e;let t=new Sx,o=this.terminalCwd;return t.add(0,{type:0,get cwds(){return[o.value]},onDidChangeCwd:o.onDidChange,getCwd:()=>o.value,updateCwd:()=>{}}),this.terminal.value=await this.terminalService.createDetachedTerminal({rows:10,cols:80,readonly:!0,capabilities:t,processInfo:new Cge({initialCwd:o.value}),colorProvider:{getBackgroundColor:n=>{let r=n.getColor(RJ);return r||(this.isInPeekView?n.getColor(zY):this.viewDescriptorService.getViewLocationById("workbench.panel.testResults.view")===1?n.getColor(lI):n.getColor(bf))}}})}async update(e){if(this.outputDataListener.clear(),e instanceof FS)await this.updateForTaskSubject(e);else if(e instanceof WS||e instanceof Um&&e.message.type===1)await this.updateForTestSubject(e);else return this.clear(),!1;return!0}async updateForTestSubject(e){let t=this,o=e instanceof WS?e.test.item:e.test,n=await this.updateGenerically({subject:e,noOutputMessage:d(15953,null),getTarget:r=>r?.tasks[e.taskIndex].output,*doInitialWrite(r,s){t.updateCwd(o.uri);let l=e instanceof WS?e.test:s.getStateById(o.extId);if(l)for(let c of l.tasks[e.taskIndex].messages)c.type===1&&(yield*r.getRangeIter(c.offset,c.length))},doListenForMoreData:(r,s,l)=>s.onChange(c=>{if(c.reason===2&&c.item.item.extId===o.extId&&c.message.type===1)for(let u of r.getRangeIter(c.message.offset,c.message.length))l(u.buffer)})});e instanceof Um&&e.message.type===1&&e.message.marker!==void 0&&n?.xterm.selectMarkedRange(x7e(e.message.marker,!0),x7e(e.message.marker,!1),!0)}updateForTaskSubject(e){return this.updateGenerically({subject:e,noOutputMessage:d(15954,null),getTarget:t=>t?.tasks[e.taskIndex],doInitialWrite:(t,o)=>(this.updateCwd(vt.find(o.tests,n=>!!n.item.uri)?.item.uri),t.output.buffers),doListenForMoreData:(t,o,n)=>t.output.onDidWriteData(r=>n(r.buffer))})}async updateGenerically(e){let t=e.subject.result,o=e.getTarget(t);if(!o)return this.clear();let n=await this.makeTerminal(),r=!1,s=new $M(0);if(t instanceof Dh)for(let l of e.doInitialWrite(o,t))r||=l.byteLength>0,s.value++,n.xterm.write(l.buffer,()=>s.value--);else r=!0,this.writeNotice(n,d(15955,null));if(this.attachTerminalToDom(n),this.outputDataListener.clear(),t instanceof Dh&&!t.completedAt){let l=t.onComplete(()=>{r||this.writeNotice(n,e.noOutputMessage)}),c=e.doListenForMoreData(o,t,u=>{n.xterm.write(u),r||=u.byteLength>0});this.outputDataListener.value=wn(l,c)}return!this.outputDataListener.value&&!r&&this.writeNotice(n,e.noOutputMessage),s.value>0&&await new Promise(l=>{let c=s.onDidChange(()=>{s.value===0&&(c.dispose(),l())})}),n}updateCwd(e){let t=e&&this.workspaceContext.getWorkspaceFolder(e)||this.workspaceContext.getWorkspace().folders[0];t&&(this.terminalCwd.value=t.uri.fsPath)}writeNotice(e,t){e.xterm.write(nE(t))}attachTerminalToDom(e){e.xterm.write("\x1B[?25l"),Wr(Re(this.container),()=>this.layoutTerminal(e)),e.attachToElement(this.container,{enableGpu:!1})}clear(){this.outputDataListener.clear(),this.xtermLayoutDelayer.cancel(),this.terminal.clear()}layout(e){if(this.dimensions=e,this.terminal.value)return this.layoutTerminal(this.terminal.value,e.width,e.height),e.height}layoutTerminal({xterm:e},t=this.dimensions?.width??this.container.clientWidth,o=this.dimensions?.height??this.container.clientHeight){t-=30,this.xtermLayoutDelayer.trigger(()=>{let n=_5t(Re(this.container),e.getFont(),t,o);n&&e.resize(n.cols,n.rows)})}};fHe=I([m(2,nn),m(3,Bi),m(4,Pe)],fHe);var WEo=a=>!!a&&a.includes(`
`);function BFi(a,i){return{testRunName:i.name,controllerId:i.ctrlId,resultId:a,taskId:i.id}}var Bat=class{constructor(i){this.value=i;this.changeEmitter=new E;this.onDidChange=this.changeEmitter.event;this.type="result";this.id=i.id,this.context=i.id,this.label=i.name}get icon(){return PN.get(this.value.completedAt===void 0?2:Lso(this.value.counts))}},Xun=d(15964,null),Jun=d(15958,null),L5t=class{constructor(i,e,t){this.task=e;this.coverageService=t;this.type="coverage";this.id=`coverage-${i.id}/${e.id}`,this.onDidChange=U.fromObservableLight(t.selected)}get label(){return this.isOpen?Jun:Xun}get icon(){return this.isOpen?PE:mat}get isOpen(){return this.coverageService.selected.get()?.fromTaskId===this.task.id}},R5t=class{constructor(i){this.n=i;this.type="older";this.onDidChange=U.None;this.label=i===1?d(15963,null):d(15962,null,i),this.id=`older-${this.n}`}},f6=class{constructor(i,e,t){this.results=i;this.test=e;this.taskIndex=t;this.type="test";this.id=`${i.id}/${e.item.extId}`;let o=Ur.fromString(e.item.extId).parentId;if(o){this.description="";for(let n of o.idsToRoot()){if(n.isRoot)break;let r=i.getStateById(n.toString());if(!r)break;this.description.length&&(this.description+=" \u2039 "),this.description+=r.item.label}}this.context=new Hat([{$mid:16,tests:[JR.serialize(e)]},BFi(i.id,i.tasks[this.taskIndex])])}get onDidChange(){return this.results instanceof Dh?U.filter(this.results.onChange,i=>i.item.item.extId===this.test.item.extId&&i.reason!==2):U.None}get state(){return this.test.tasks[this.taskIndex].state}get label(){return this.test.item.label}get labelWithIcons(){return Un(this.label)}get icon(){return PN.get(this.state)}get outputSubject(){return new WS(this.results,this.taskIndex,this.test)}},bve=class{constructor(i,e,t){this.results=i;this.task=e;this.index=t;this.changeEmitter=new E;this.onDidChange=this.changeEmitter.event;this.type="task";this.itemsCache=new M5t;this.id=`${i.id}/${t}`,this.task=i.tasks[t],this.context=BFi(i.id,this.task),this.label=this.task.name}get icon(){return this.results.tasks[this.index].running?PN.get(2):void 0}},Cne=class{constructor(i,e,t,o){this.result=i;this.test=e;this.taskIndex=t;this.messageIndex=o;this.type="message";let n=this.message=e.tasks[t].messages[o];this.location=n.location,this.contextValue=n.type===0?n.contextValue:void 0,this.uri=uL({type:2,messageIndex:o,resultId:i.id,taskIndex:t,testExtId:e.item.extId}),this.id=this.uri.toString();let r=mve(n.message),s=DL(r.trimEnd(),`
`);this.label=Zun(r),s>0&&(this.description=s>1?d(15961,null,s):d(15960,null))}get onDidChange(){return this.result instanceof Dh?U.filter(this.result.onChange,i=>i.item.item.extId===this.test.item.extId&&i.reason!==2):U.None}get context(){return new Hat([AFi(this.test,this.message),BFi(this.result.id,this.result.tasks[this.taskIndex])])}get outputSubject(){return new WS(this.result,this.taskIndex,this.test)}},vHe=class extends x{constructor(e,t,o,n,r,s,l,c,u,p){super();this.onDidReveal=t;this.contextMenuService=n;this.disposed=!1;this.requestReveal=this._register(new E);this.contextMenuActionRunner=this._register(new P5t);this.onDidRequestReview=this.requestReveal.event;this.treeActions=s.createInstance(Vat,o.showRevealLocationOnMessages,this.requestReveal);let h={getId(O){return O.id}};this.tree=this._register(s.createInstance(nF,"Test Output Peek",e,{getHeight:()=>22,getTemplateId:()=>wne.ID},[s.createInstance(wne,this.treeActions)],{compressionEnabled:!0,hideTwistiesOfChildlessElements:!0,identityProvider:h,alwaysConsumeMouseWheel:!1,sorter:{compare(O,V){return O instanceof f6&&V instanceof f6?ZYe(O.state,V.state):0}},accessibilityProvider:{getAriaLabel(O){return O.ariaLabel||O.label},getWidgetAriaLabel(){return d(15977,null)}}}));let g=new M5t,f=O=>{let{results:V,index:H,itemsCache:G,task:$}=O,J=vt.filter(V.tests,he=>he.tasks[H].state>=2||he.tasks[H].messages.length>0),ae=vt.map(J,he=>({element:G.getOrCreate(he,()=>new f6(V,he,H)),incompressible:!0,children:v(V,he,H)}));return $.coverage.get()&&(ae=vt.concat(vt.single({element:new L5t(V,$,c),collapsible:!0,incompressible:!0}),ae)),ae},v=(O,V,H)=>V.tasks[H].messages.map((G,$)=>G.type===0?{element:g.getOrCreate(G,()=>new Cne(O,V,H,$)),incompressible:!1}:void 0).filter(lo),b=O=>O.tasks.map((V,H)=>{let G=g.getOrCreate(V,()=>new bve(O,V,H));return{element:G,incompressible:!1,collapsible:!0,children:f(G)}}),S=()=>{let O=[],V=[];for(let H of r.results)if(!O.length&&H.tasks.length)O=b(H);else if(O){let G=g.getOrCreate(H,()=>new Bat(H));V.push({element:G,incompressible:!0,collapsible:!0,collapsed:this.tree.hasElement(G)?this.tree.isCollapsed(G):!0,children:b(H)})}return O.length?(V.length&&O.push({element:new R5t(V.length),incompressible:!0,collapsible:!0,collapsed:!0,children:V}),O):V},y=new Set,w=this._register(new Dt(()=>{for(let O of y)this.tree.hasElement(O)&&this.tree.setChildren(O,f(O),{diffIdentityProvider:h});y.clear()},300)),k=O=>{y.add(O),w.isScheduled()||w.schedule()},T=O=>{let V=new N;V.add(O.onNewTask(H=>{this.tree.setChildren(null,S(),{diffIdentityProvider:h}),O.tasks.length===1&&this.requestReveal.fire(new FS(O,0));let G=O.tasks[H];V.add(be($=>{G.coverage.read($),k(g.get(G))}))})),V.add(O.onEndTask(H=>{g.get(O.tasks[H])?.changeEmitter.fire()})),V.add(O.onChange(H=>{for(let[G,$]of O.tasks.entries()){let J=g.get($);if(!this.tree.hasElement(J))continue;let ae=J.itemsCache.get(H.item);if(ae&&this.tree.hasElement(ae)){H.reason===2&&H.message.type===0&&this.tree.setChildren(ae,v(O,H.item,G),{diffIdentityProvider:h});return}k(J)}})),V.add(O.onComplete(()=>{g.get(O)?.changeEmitter.fire(),V.dispose()}))};this._register(r.onResultsChanged(O=>{this.disposed||("completed"in O?g.get(O.completed)?.changeEmitter.fire():"started"in O?T(O.started):this.tree.setChildren(null,S(),{diffIdentityProvider:h}))}));let P=(O,V)=>{this.tree.setFocus([O]),this.tree.setSelection([O]),V||this.tree.domFocus()};this._register(t(async({subject:O,preserveFocus:V=!1})=>{if(O instanceof FS){let $=this.tree.getNode(null).children.find(J=>J.element instanceof bve?J.element.results.id===O.result.id&&J.element.index===O.taskIndex:J.element instanceof Bat?J.element.id===O.result.id:!1);$&&P($.element,V);return}let H=O instanceof WS?g.get(O.task)?.itemsCache.get(O.test):g.get(O.message);if(!H||!this.tree.hasElement(H))return;let G=[];for(let $=this.tree.getParentElement(H);$;$=this.tree.getParentElement($))G.unshift($);for(let $ of G)this.tree.expand($);this.tree.getRelativeTop(H)===null&&this.tree.reveal(H,.5),P(H,V)})),this._register(this.tree.onDidOpen(async O=>{if(O.element instanceof Cne)this.requestReveal.fire(new Um(O.element.result,O.element.test,O.element.taskIndex,O.element.messageIndex));else if(O.element instanceof f6){let V=O.element,H=tHe(O.element.test,(G,$,J,ae)=>new Um(V.results,V.test,ae,J));this.requestReveal.fire(H||new WS(V.results,0,V.test))}else if(O.element instanceof L5t){let V=O.element.task;if(O.element.isOpen)return c.closeCoverage();u.withProgress({location:o.locationForProgress},()=>c.openCoverage(V,!0))}})),this._register(this.tree.onDidChangeSelection(O=>{for(let V of O.elements)if(V&&"test"in V){l.reveal.set(V.test.item.extId,void 0);break}})),this._register(l.onDidSelectTestInExplorer(O=>{if(!this.tree.getSelection().some(V=>V&&"test"in V&&V.test.item.extId===O)){for(let V of this.tree.getNode(null).children)if(V.element instanceof bve){for(let H of V.children)if(H.element instanceof f6&&H.element.test.item.extId===O){this.tree.setSelection([H.element]),this.tree.getRelativeTop(H.element)===null&&this.tree.reveal(H.element,.5);break}}}})),this._register(this.tree.onContextMenu(O=>this.onContextMenu(O))),this._register(this.tree.onDidChangeCollapseState(O=>{O.node.element instanceof R5t&&!O.node.collapsed&&p.publicLog2("testing.expandOlderResults")})),this.tree.setChildren(null,S());for(let O of r.results)!O.completedAt&&O instanceof Dh&&T(O)}layout(e,t){this.tree.layout(e,t)}onContextMenu(e){if(!e.element)return;let t=this.treeActions.provideActionBar(e.element);this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>t.secondary.length?[...t.primary,new ri,...t.secondary]:t.primary,getActionsContext:()=>e.element?.context,actionRunner:this.contextMenuActionRunner})}dispose(){super.dispose(),this.disposed=!0}};vHe=I([m(3,Xe),m(4,pd),m(5,F),m(6,UW),m(7,oC),m(8,Fo),m(9,Te)],vHe);var wne=class{constructor(i,e){this.treeActions=i;this.instantiationService=e;this.templateId=wne.ID}static{this.ID="testRunElementRenderer"}renderCompressedElements(i,e,t){let o=i.element.elements,n=o[o.length-1];(n instanceof bve||n instanceof Cne)&&o.length>=2?this.doRender(o[o.length-2],t,n):this.doRender(n,t)}renderTemplate(i){let e=new N;i.classList.add("testing-stdtree-container");let t=M(i,_(".state")),o=M(i,_(".label")),n=new Zi(i,{actionRunner:e.add(new P5t),actionViewItemProvider:(s,l)=>s instanceof Lo?this.instantiationService.createInstance(xl,s,{hoverDelegate:l.hoverDelegate}):void 0}),r=new N;return e.add(r),e.add(n),{icon:t,label:o,actionBar:n,elementDisposable:r,templateDisposable:e}}renderElement(i,e,t){this.doRender(i.element,t)}disposeTemplate(i){i.templateDisposable.dispose()}doRender(i,e,t){e.elementDisposable.clear(),e.elementDisposable.add(i.onDidChange(()=>this.doRender(i,e,t))),this.doRenderInner(i,e,t)}doRenderInner(i,e,t){let{label:o,labelWithIcons:n,description:r}=i;t instanceof Cne&&(r=t.label,i.description&&(r=`${r} @ ${i.description}`));let s=r?_("span.test-label-description",{},r):"";n?vi(e.label,...n,s):vi(e.label,o,s);let l=i.icon;e.icon.className=`computed-state ${l?q.asClassName(l):""}`;let c=this.treeActions.provideActionBar(i);e.actionBar.clear(),e.actionBar.context=i.context,e.actionBar.push(c.primary,{icon:!0,label:!1})}};wne=I([m(1,F)],wne);var Vat=class{constructor(i,e,t,o,n,r,s){this.showRevealLocationOnMessages=i;this.requestReveal=e;this.contextKeyService=t;this.menuService=o;this.commandService=n;this.testProfileService=r;this.editorService=s}provideActionBar(i){let e=i instanceof f6?i.test:void 0,t=e?this.testProfileService.capabilitiesForTest(e.item):0,o=[["peek","editor.contrib.testingOutputPeek"],[oo.peekItemType.key,i.type]],n=D.TestPeekElement,r=[],s=[];if(i instanceof bve)if(r.push(new it("testing.outputPeek.showResultOutput",d(15976,null),q.asClassName(R.terminal),void 0,()=>this.requestReveal.fire(new FS(i.results,i.index)))),i.task.running)r.push(new it("testing.outputPeek.cancel",d(15966,null),q.asClassName(Zjt),void 0,()=>this.commandService.executeCommand("testing.cancelRun",i.results.id,i.task.id)));else{r.push(new it("testing.outputPeek.rerun",d(15973,null),q.asClassName(dne),void 0,()=>this.commandService.executeCommand("testing.reRunLastRun",i.results.id)));let p=vt.some(i.results.tests,h=>Dk(h.ownComputedState));p&&r.push(new it("testing.outputPeek.rerunFailed",d(15972,null),q.asClassName(dne),void 0,()=>this.commandService.executeCommand("testing.reRunFailedFromLastRun",i.results.id))),r.push(new it("testing.outputPeek.debug",d(15968,null),q.asClassName(kx),void 0,()=>this.commandService.executeCommand("testing.debugLastRun",i.results.id))),p&&r.push(new it("testing.outputPeek.debugFailed",d(15967,null),q.asClassName(kx),void 0,()=>this.commandService.executeCommand("testing.debugFailedFromLastRun",i.results.id)))}if(i instanceof Bat){i.value.tasks.length===1&&r.push(new it("testing.outputPeek.showResultOutput",d(15976,null),q.asClassName(R.terminal),void 0,()=>this.requestReveal.fire(new FS(i.value,0)))),r.push(new it("testing.outputPeek.reRunLastRun",d(15974,null),q.asClassName(LU),void 0,()=>this.commandService.executeCommand("testing.reRunLastRun",i.value.id)));let p=vt.some(i.value.tests,h=>Dk(h.ownComputedState));p&&r.push(new it("testing.outputPeek.rerunFailedResult",d(15972,null),q.asClassName(dne),void 0,()=>this.commandService.executeCommand("testing.reRunFailedFromLastRun",i.value.id))),t&4&&(r.push(new it("testing.outputPeek.debugLastRun",d(15969,null),q.asClassName(kx),void 0,()=>this.commandService.executeCommand("testing.debugLastRun",i.value.id))),p&&r.push(new it("testing.outputPeek.debugFailedResult",d(15967,null),q.asClassName(kx),void 0,()=>this.commandService.executeCommand("testing.debugFailedFromLastRun",i.value.id))))}if(i instanceof f6||i instanceof Cne){o.push([oo.testResultOutdated.key,i.test.retired],[oo.testResultState.key,_Mt[i.test.ownComputedState]],...eHe(i.test,t));let{extId:p,uri:h}=i.test.item;h&&r.push(new it("testing.outputPeek.goToTest",d(15971,null),q.asClassName(R.goToFile),void 0,()=>this.commandService.executeCommand("vscode.revealTest",p))),i.test.tasks[i.taskIndex].messages.some(g=>g.type===1)&&r.push(new it("testing.outputPeek.showResultOutput",d(15976,null),q.asClassName(R.terminal),void 0,()=>this.requestReveal.fire(i.outputSubject))),s.push(new it("testing.outputPeek.revealInExplorer",d(15975,null),q.asClassName(R.listTree),void 0,()=>this.commandService.executeCommand("_revealTestInExplorer",p))),t&2&&r.push(new it("testing.outputPeek.runTest",d(15965,null),q.asClassName(LU),void 0,()=>this.commandService.executeCommand("vscode.runTestsById",2,p))),t&4&&r.push(new it("testing.outputPeek.debugTest",d(15959,null),q.asClassName(kx),void 0,()=>this.commandService.executeCommand("vscode.runTestsById",4,p)))}i instanceof Cne&&(n=D.TestMessageContext,o.push([oo.testMessageContext.key,i.contextValue]),this.showRevealLocationOnMessages&&i.location&&r.push(new it("testing.outputPeek.goToError",d(15970,null),q.asClassName(R.debugStackframe),void 0,()=>this.editorService.openEditor({resource:i.location.uri,options:{selection:i.location.range,preserveFocus:!0}}))));let l=this.contextKeyService.createOverlay(o),c={primary:r,secondary:s},u=this.menuService.getMenuActions(n,l,{shouldForwardArgs:!0});return _z(u,c,"inline"),c}};Vat=I([m(2,X),m(3,Kt),m(4,ge),m(5,uu),m(6,ee)],Vat);var M5t=class{constructor(){this.v=new WeakMap}get(i){return this.v.get(i)}getOrCreate(i,e){let t=this.v.get(i);if(t)return t;let o=e();return this.v.set(i,o),o}},Zun=a=>{let i=a.indexOf(`
`);return i===-1?a:a.slice(0,i)},Hat=class{constructor(i){this.value=i}},P5t=class extends rs{async runAction(i,e){e instanceof Hat?await i.run(...e.value):await i.run(e)}};var Uat=class extends Dat{constructor(e,t,o,n,r,s){super();this.message=e;this.followup=t;this.subject=o;this.instantiationService=n;this.contextKeyService=r;this.profileService=s;this.height=Me("MessageStackFrame.height",100);this.icon=QBe;this.label=o instanceof Um?o.test.label:o instanceof WS?o.test.item.label:o.result.name}render(e){return this.message.style.visibility="visible",e.appendChild(this.message),Z(()=>this.message.remove())}renderActions(e){let t=new N;e.appendChild(this.followup.domNode),t.add(Z(()=>this.followup.domNode.remove()));let o=yEo(this.subject),n=o&&this.profileService.capabilitiesForTest(o),r;if(n)r=this.contextKeyService.createOverlay(yNt(n));else{let c=this.profileService.getControllerProfiles(this.subject.controllerId);r=this.contextKeyService.createOverlay([[oo.hasRunnableTests.key,c.some(u=>u.group&2)],[oo.hasDebuggableTests.key,c.some(u=>u.group&4)]])}let s=t.add(this.instantiationService.createChild(new _o([X,r]))),l=t.add(s.createInstance(or,e,D.TestCallStack,{menuOptions:{shouldForwardArgs:!0},actionViewItemProvider:(c,u)=>Bs(this.instantiationService,c,u)}));return l.context=this.subject,t.add(l),t}};Uat=I([m(3,F),m(4,X),m(5,uu)],Uat);function BEo(a,i,e){if(e instanceof FS)return a.get(ge).executeCommand(i===4?"testing.debugLastRun":"testing.reRunLastRun",e.result.id);let t=a.get(Ws),o=e instanceof Um?e.test:e.test.item,n=t.collection.getNodeById(o.extId);if(n)return t.runTests({group:i,tests:[n]})}W(class extends K{constructor(){super({id:"testing.callStack.run",title:d(15980,null),icon:LU,menu:{id:D.TestCallStack,when:oo.hasRunnableTests,group:"navigation"}})}run(a,i){BEo(a,2,i)}});W(class extends K{constructor(){super({id:"testing.callStack.debug",title:d(15979,null),icon:kx,menu:{id:D.TestCallStack,when:oo.hasDebuggableTests,group:"navigation"}})}run(a,i){BEo(a,4,i)}});var Mq=class extends x{constructor(e,t,o,n,r,s,l){super();this.editor=e;this.options=t;this.instantiationService=o;this.modelService=n;this.contextKeyService=r;this.uriIdentityService=s;this.configurationService=l;this.didReveal=this._register(new E);this.currentSubjectStore=this._register(new N);this.onCloseEmitter=this._register(new Bh);this.contentProvidersUpdateLimiter=this._register(new g_(1));this.isTreeLeft=!1;this.onClose=this.onCloseEmitter.event}get uiState(){return{splitViewWidths:Array.from({length:this.splitView.length},(e,t)=>this.splitView.getViewSize(t))}}get onDidChangeContentHeight(){return this.callStackWidget.onDidChangeContentHeight}get contentHeight(){return this.callStackWidget?.contentHeight||0}get diffViewIndex(){return this.isTreeLeft?1:0}get historyViewIndex(){return this.isTreeLeft?0:1}swapViews(){let e=this.splitView.getViewSize(0),t=this.splitView.getViewSize(1),o=this.splitView.removeView(1),n=this.splitView.removeView(0);this.splitView.addView(o,t),this.splitView.addView(n,e)}fillBody(e){let t=Mq.lastSplitWidth;this.splitView=new Ou(e,{orientation:1});let{historyVisible:o,showRevealLocationOnMessages:n}=this.options,r=this.editor!==void 0,s=em(this.configurationService,"testing.resultsView.layout");this.isTreeLeft=s==="treeLeft",this._register(this.configurationService.onDidChangeConfiguration(g=>{if(g.affectsConfiguration("testing.resultsView.layout")){let v=em(this.configurationService,"testing.resultsView.layout")==="treeLeft";v!==this.isTreeLeft&&(this.isTreeLeft=v,this.swapViews())}}));let l=this.messageContainer=_(".test-output-peek-message-container");this.stackContainer=M(e,_(".test-output-call-stack-container")),this.callStackWidget=this._register(this.instantiationService.createInstance(iHe,this.stackContainer,this.editor)),this.followupWidget=this._register(this.instantiationService.createInstance(zat,this.editor)),this.onCloseEmitter.input=this.followupWidget.onClose,this.contentProviders=[this._register(this.instantiationService.createInstance(mHe,this.editor,l)),this._register(this.instantiationService.createInstance(hHe,l)),this._register(this.instantiationService.createInstance(fHe,l,r)),this._register(this.instantiationService.createInstance(gHe,this.editor,l))],this.messageContextKeyService=this._register(this.contextKeyService.createScoped(e)),this.contextKeyTestMessage=oo.testMessageContext.bindTo(this.messageContextKeyService),this.contextKeyResultOutdated=oo.testResultOutdated.bindTo(this.messageContextKeyService);let c=M(e,_(".test-output-peek-tree.testing-stdtree")),u=this._register(this.instantiationService.createInstance(vHe,c,this.didReveal.event,{showRevealLocationOnMessages:n,locationForProgress:this.options.locationForProgress}));this.onDidRequestReveal=u.onDidRequestReview;let p={onDidChange:U.None,element:this.stackContainer,minimumSize:200,maximumSize:Number.MAX_VALUE,layout:g=>{Mq.lastSplitWidth=g,this.dimension&&(this.callStackWidget?.layout(this.dimension.height,g),this.layoutContentWidgets(this.dimension,g))}},h={onDidChange:U.None,element:c,minimumSize:100,maximumSize:Number.MAX_VALUE,layout:g=>{this.dimension&&u.layout(this.dimension.height,g)}};this.splitView.addView(p,Gl.Distribute),this.splitView.addView(h,Gl.Distribute),this.isTreeLeft&&this.swapViews(),this.splitView.setViewVisible(this.historyViewIndex,o.value),this._register(o.onDidChange(g=>{this.splitView.setViewVisible(this.historyViewIndex,g)})),t&&queueMicrotask(()=>this.splitView.resizeView(this.diffViewIndex,t))}reveal(e){return this.didReveal.fire(e),this.current&&IEo(this.current,e.subject)?Promise.resolve():(this.current=e.subject,this.contentProvidersUpdateLimiter.queue(async()=>{this.currentSubjectStore.clear();let t=this.getCallFrames(e.subject)||[],o=await this.prepareTopFrame(e.subject,t);this.setCallStackFrames(o,t),this.followupWidget.show(e.subject),this.populateFloatingClick(e.subject)}))}setCallStackFrames(e,t){this.callStackWidget.setFrames([e,...t.map(o=>new Ine(o.label,o.uri,o.position?.lineNumber,o.position?.column))])}collapseStack(){this.callStackWidget.collapseAll()}getCallFrames(e){if(!(e instanceof Um))return;let t=e.stack;if(!t?.length||!this.editor)return t;let o=t[0],n=e.revealLocation;return n&&o.position&&o.uri&&o.position.lineNumber===n.range.startLineNumber&&o.position.column===n.range.startColumn&&this.uriIdentityService.extUri.isEqual(o.uri,n.uri)?t.slice(1):t}async prepareTopFrame(e,t){this.messageContainer.style.visibility="hidden",this.stackContainer.appendChild(this.messageContainer);let o=this.currentTopFrame=this.instantiationService.createInstance(Uat,this.messageContainer,this.followupWidget,e),n=t.length>0;o.showHeader.set(n,void 0);let r=await A2i(this.contentProviders,s=>s.update(e));if(r){let s=this.splitView.getViewSize(this.diffViewIndex);s!==-1&&this.dimension&&o.height.set(r.layout({width:s,height:this.dimension?.height},n),void 0),r.onScrolled&&this.currentSubjectStore.add(this.callStackWidget.onDidScroll(l=>{r.onScrolled(l)})),r.onDidContentSizeChange&&this.currentSubjectStore.add(r.onDidContentSizeChange(()=>{let l=this.splitView.getViewSize(this.diffViewIndex);this.dimension&&!this.isDoingLayoutUpdate&&l!==-1&&(this.isDoingLayoutUpdate=!0,o.height.set(r.layout({width:l,height:this.dimension.height},n),void 0),this.isDoingLayoutUpdate=!1)}))}return o}layoutContentWidgets(e,t=this.splitView.getViewSize(this.diffViewIndex)){this.isDoingLayoutUpdate=!0;for(let o of this.contentProviders){let n=o.layout({height:e.height,width:t},!!this.currentTopFrame?.showHeader.get());n&&this.currentTopFrame?.height.set(n,void 0)}this.isDoingLayoutUpdate=!1}populateFloatingClick(e){if(!(e instanceof Um))return;this.currentSubjectStore.add(Z(()=>{this.contextKeyResultOutdated.reset(),this.contextKeyTestMessage.reset()})),this.contextKeyTestMessage.set(e.contextValue||""),e.result instanceof Dh?(this.contextKeyResultOutdated.set(e.result.getStateById(e.test.extId)?.retired??!1),this.currentSubjectStore.add(e.result.onChange(o=>{o.item.item.extId===e.test.extId&&this.contextKeyResultOutdated.set(o.item.retired??!1)}))):this.contextKeyResultOutdated.set(!0);let t=this.currentSubjectStore.add(this.instantiationService.createChild(new _o([X,this.messageContextKeyService])));this.currentSubjectStore.add(t.createInstance(GMe,{container:this.messageContainer,menuId:D.TestMessageContent,getActionArg:()=>e.context}))}onLayoutBody(e,t){this.dimension=new si(t,e),this.splitView.layout(t)}onWidth(e){this.splitView.layout(e)}};Mq=I([m(2,F),m(3,Bt),m(4,X),m(5,ht),m(6,B)],Mq);var epn=500,zat=class extends x{constructor(e,t,o){super();this.editor=e;this.testService=t;this.quickInput=o;this.el=ct("div.testing-followup-action",[]);this.visibleStore=this._register(new N);this.onCloseEmitter=this._register(new E);this.onClose=this.onCloseEmitter.event}get domNode(){return this.el.root}show(e){this.visibleStore.clear(),e instanceof Um&&this.showMessage(e)}async showMessage(e){let t=this.visibleStore.add(new Ye),o=Date.now();e.result instanceof Dh&&!e.result.completedAt&&await new Promise(r=>U.once(e.result.onComplete)(r));let n=await this.testService.provideTestFollowups({extId:e.test.extId,messageIndex:e.messageIndex,resultId:e.result.id,taskIndex:e.taskIndex},t.token);if(!n.followups.length||t.token.isCancellationRequested){n.dispose();return}this.visibleStore.add(n),Rt(this.el.root),this.el.root.classList.toggle("animated",Date.now()-o>epn),this.el.root.appendChild(this.makeFollowupLink(n.followups[0])),n.followups.length>1&&this.el.root.appendChild(this.makeMoreLink(n.followups)),this.visibleStore.add(Z(()=>{this.el.root.remove()}))}makeFollowupLink(e){let t=this.makeLink(()=>this.actionFollowup(t,e));return vi(t,...Un(e.message)),t}makeMoreLink(e){let t=this.makeLink(()=>this.quickInput.pick(e.map((o,n)=>({label:o.message,index:n}))).then(o=>{o?.length&&e[o[0].index].execute()}));return t.innerText=d(15978,null,e.length-1),t}makeLink(e){let t=document.createElement("a");return t.tabIndex=0,this.visibleStore.add(j(t,"click",e)),this.visibleStore.add(j(t,"keydown",o=>{let n=new gi(o);(n.equals(10)||n.equals(3))&&e()})),t}actionFollowup(e,t){e.ariaDisabled!=="true"&&(e.ariaDisabled="true",t.execute(),this.editor&&this.onCloseEmitter.fire())}};zat=I([m(1,Ws),m(2,Ue)],zat);function*HEo([a]){if(a)for(let i of a.tests)for(let e=0;e<i.tasks.length;e++){let t=i.tasks[e].messages;for(let o=0;o<t.length;o++)t[o].type===0&&(yield{result:a,test:i,taskIndex:e,messageIndex:o})}}function HFi({result:a,test:i,taskIndex:e,messageIndex:t}){return uL({type:2,resultId:a.id,testExtId:i.item.extId,taskIndex:e,messageIndex:t})}var xne=class extends x{constructor(e,t,o,n,r,s,l,c,u){super();this.configuration=e;this.editorService=t;this.codeEditorService=o;this.testResults=n;this.testService=r;this.viewsService=l;this.commandService=c;this.notificationService=u;this._register(n.onTestChanged(this.openPeekOnFailure,this)),this.historyVisible=this._register($M.stored(new _S({key:"testHistoryVisibleInPeek",scope:0,target:0},s),!1))}static{this.ID="workbench.contrib.testing.peekOpener"}async open(){let e,t=this.editorService.activeTextEditorControl;if(pn(t)&&t.getModel()?.uri){let o=t.getModel()?.uri;o&&(e=await this.getFileCandidateMessage(o,t.getPosition()))}return e||(e=this.lastUri),e||(e=this.getAnyCandidateMessage()),e?this.showPeekFromUri(e):!1}tryPeekFirstError(e,t,o){let n=this.getFailedCandidateMessage(t);return n?(this.showPeekFromUri({type:2,documentUri:n.location.uri,taskIndex:n.taskId,messageIndex:n.index,resultId:e.id,testExtId:t.item.extId},void 0,{selection:n.location.range,selectionRevealType:3,...o}),!0):!1}peekUri(e,t={}){let o=cve(e),n=o&&this.testResults.getResult(o.resultId);if(!o||!n||!("testExtId"in o)||!("messageIndex"in o))return!1;let r=n.getStateById(o.testExtId)?.tasks[o.taskIndex].messages[o.messageIndex];return r?.location?(this.showPeekFromUri({type:2,documentUri:r.location.uri,taskIndex:o.taskIndex,messageIndex:o.messageIndex,resultId:n.id,testExtId:o.testExtId},t.inEditor,{selection:r.location.range,...t.options}),!0):!1}closeAllPeeks(){for(let e of this.codeEditorService.listCodeEditors())Gb.get(e)?.removePeek()}openCurrentInEditor(){let e=this.getActiveControl();if(!e)return;let t={pinned:!1,revealIfOpened:!0};if(e instanceof FS||e instanceof WS){this.editorService.openEditor({resource:e.outputUri,options:t});return}if(e instanceof WS){this.editorService.openEditor({resource:e.outputUri,options:t});return}let o=e.message;e.isDiffable?this.editorService.openEditor({original:{resource:e.expectedUri},modified:{resource:e.actualUri},options:t}):typeof o.message=="string"?this.editorService.openEditor({resource:e.messageUri,options:t}):this.commandService.executeCommand("markdown.showPreview",e.messageUri).catch(n=>{this.notificationService.error(d(15947,null,n.message))})}getActiveControl(){let e=Gat(this.codeEditorService);return(e&&Gb.get(e))?.subject.get()??this.viewsService.getActiveViewWithId("workbench.panel.testResults.view")?.subject}async showPeekFromUri(e,t,o){if(pn(t))return this.lastUri=e,Gb.get(t)?.show(uL(this.lastUri)),!0;let r=(await this.editorService.openEditor({resource:e.documentUri,options:{revealIfOpened:!0,...o}}))?.getControl();return pn(r)?(this.lastUri=e,Gb.get(r)?.show(uL(this.lastUri)),!0):!1}openPeekOnFailure(e){if(e.reason!==1||!this.getFailedCandidateMessage(e.item)||e.result.request.continuous&&!em(this.configuration,"testing.automaticallyOpenPeekViewDuringAutoRun"))return;let o=this.codeEditorService.listCodeEditors();switch(em(this.configuration,"testing.automaticallyOpenPeekView")){case"failureInVisibleDocument":{let s=this.editorService.visibleTextEditorControls,l=new Set(s.filter(pn).map(c=>c.getModel()?.uri.toString()));if(!vt.some(Dso(e.result,e.item),c=>c.item.uri&&l.has(c.item.uri.toString())))return;break}case"failureAnywhere":break;default:return}o.map(Gb.get).some(s=>s?.subject.get())||this.tryPeekFirstError(e.result,e.item)}async getFileCandidateMessage(e,t){let o,n=1/0,r=e.toString();for(let s of this.testService.collection.all){let l=this.testResults.getStateById(s.item.extId);l&&tHe(l[1],(c,u,p,h)=>{if(u.type!==0||!u.location||u.location.uri.toString()!==r)return;let g=t?Math.abs(t.lineNumber-u.location.range.startLineNumber):0;(!o||g<=n)&&(n=g,o={type:2,testExtId:l[1].item.extId,resultId:l[0].id,taskIndex:h,messageIndex:p,documentUri:e})})}return o}getAnyCandidateMessage(){let e=new Set;for(let t of this.testResults.results)for(let o of t.tests){if(e.has(o.item.extId))continue;e.add(o.item.extId);let n=tHe(o,(r,s,l,c)=>s.location&&{type:2,testExtId:o.item.extId,resultId:t.id,taskIndex:c,messageIndex:l,documentUri:s.location.uri});if(n)return n}}getFailedCandidateMessage(e){let t=e.item.uri&&e.item.range?{uri:e.item.uri,range:e.item.range}:void 0,o;return tHe(e,(n,r,s,l)=>{let c=r.location||t;!Dk(n.state)||!c||o&&r.type!==0||(o={taskId:l,index:s,message:r,location:c})}),o}};xne=I([m(0,B),m(1,ee),m(2,qt),m(3,pd),m(4,Ws),m(5,ce),m(6,$t),m(7,ge),m(8,Ne)],xne);var Gb=class extends x{constructor(e,t,o,n,r){super();this.editor=e;this.codeEditorService=t;this.instantiationService=o;this.testResults=n;this.peek=this._register(SV("TestingOutputPeek",void 0));this.subject=ke(e=>this.peek.read(e)?.current.read(e));this.visible=oo.isPeekVisible.bindTo(r),this._register(e.onDidChangeModel(()=>this.peek.set(void 0,void 0))),this._register(n.onResultsChanged(this.closePeekOnCertainResultEvents,this)),this._register(n.onTestChanged(this.closePeekOnTestChange,this))}static get(e){return e.getContribution("editor.contrib.testingOutputPeek")}async show(e){let t=this.retrieveTest(e);t&&this.showSubject(t)}async showSubject(e){if(!this.peek.get()){let t=this.instantiationService.createInstance(Kat,this.editor);this.peek.set(t,void 0),U.once(t.onDidClose)(()=>{this.visible.set(!1),this.peek.set(void 0,void 0)}),this.visible.set(!0),t.create()}e instanceof Um&&en(mve(e.message.message)),this.peek.get().setModel(e)}async openAndShow(e){let t=this.retrieveTest(e);if(!t)return;if(!t.revealLocation||t.revealLocation.uri.toString()===this.editor.getModel()?.uri.toString())return this.show(e);let o=await this.codeEditorService.openCodeEditor({resource:t.revealLocation.uri,options:{pinned:!1,revealIfOpened:!0}},this.editor);if(o)return Gb.get(o)?.removePeek(),Gb.get(o)?.show(e)}removePeek(){this.peek.set(void 0,void 0)}collapseStack(){this.peek.get()?.collapseStack()}next(){let e=this.peek.get()?.current.get();if(!e)return;let t,o=!1;for(let n of HEo(this.testResults.results)){if(t??=n,e instanceof FS&&n.result.id===e.result.id&&(o=!0),o){this.openAndShow(HFi(n));return}e instanceof WS&&e.test.item.extId===n.test.item.extId&&e.taskIndex===n.taskIndex&&e.result.id===n.result.id&&(o=!0),e instanceof Um&&e.test.extId===n.test.item.extId&&e.messageIndex===n.messageIndex&&e.taskIndex===n.taskIndex&&e.result.id===n.result.id&&(o=!0)}t&&this.openAndShow(HFi(t))}previous(){let e=this.subject.get();if(!e)return;let t,o=!1,n;for(let s of HEo(this.testResults.results))if(n=s,!o){if(e instanceof FS){s.result.id===e.result.id&&(o=!0);continue}if(e instanceof WS){s.test.item.extId===e.test.item.extId&&s.result.id===e.result.id&&s.taskIndex===e.taskIndex&&(o=!0);continue}if(e.test.extId===s.test.item.extId&&e.messageIndex===s.messageIndex&&e.taskIndex===s.taskIndex&&e.result.id===s.result.id){o=!0;continue}t=s}let r=t||n;r&&this.openAndShow(HFi(r))}removeIfPeekingForTest(e){let t=this.subject.get();t&&t instanceof Um&&t.test.extId===e&&this.peek.set(void 0,void 0)}closePeekOnTestChange(e){e.reason!==1||e.previousState===e.item.ownComputedState||this.removeIfPeekingForTest(e.item.item.extId)}closePeekOnCertainResultEvents(e){"started"in e&&this.peek.set(void 0,void 0),"removed"in e&&this.testResults.results.length===0&&this.peek.set(void 0,void 0)}retrieveTest(e){let t=cve(e);if(!t)return;let o=this.testResults.results.find(c=>c.id===t.resultId);if(!o)return;if(t.type===0)return new FS(o,t.taskIndex);if(t.type===1){let c=o.getStateById(t.testExtId);return c?new WS(o,t.taskIndex,c):void 0}let{testExtId:n,taskIndex:r,messageIndex:s}=t,l=o?.getStateById(n);if(!(!l||!l.tasks[t.taskIndex]))return new Um(o,l,r,s)}};Gb=I([m(1,qt),m(2,F),m(3,pd),m(4,X)],Gb);var Kat=class extends GE{constructor(e,t,o,n,r,s,l,c,u,p){super(e,{showFrame:!0,frameWidth:1,showArrow:!0,isResizeable:!0,isAccessible:!0,className:"test-output-peek"},l);this.themeService=t;this.testingPeek=n;this.contextKeyService=r;this.menuService=s;this.modelService=c;this.codeEditorService=u;this.uriIdentityService=p;this.current=Me("testPeekCurrent",void 0);this.resizeOnNextContentHeightUpdate=!1;this._disposables.add(t.onDidColorThemeChange(this.applyTheme,this)),o.addExclusiveWidget(e,this)}_getMaximumHeightInLines(){let e=super._getMaximumHeightInLines(),t=this.content?.contentHeight;if(!t||this.testingPeek.historyVisible.value)return e;let o=this.editor.getOption(75);return Math.min(e||1/0,(t+41)/o+1)}applyTheme(){let e=this.themeService.getColorTheme(),t=this.current.get(),o=t instanceof Um&&t.message.type===0,n=(o?e.getColor(Nko):e.getColor(Oko))||We.transparent,r=(o?e.getColor(Fko):e.getColor(Wko))||We.transparent,s=e.getColor(Ho);this.style({arrowColor:n,frameColor:n,headerBackgroundColor:s&&r?r.makeOpaque(s):r,primaryHeadingColor:e.getColor(eF),secondaryHeadingColor:e.getColor(tF)})}_fillContainer(e){if(!this.scopedContextKeyService){this.scopedContextKeyService=this._disposables.add(this.contextKeyService.createScoped(e)),oo.isInPeek.bindTo(this.scopedContextKeyService).set(!0);let t=this._disposables.add(this.instantiationService.createChild(new _o([X,this.scopedContextKeyService])));this.content=this._disposables.add(t.createInstance(Mq,this.editor,{historyVisible:this.testingPeek.historyVisible,showRevealLocationOnMessages:!1,locationForProgress:"workbench.panel.testResults.view"})),this._disposables.add(this.content.onClose(()=>{Gb.get(this.editor)?.removePeek()}))}super._fillContainer(e)}_fillHead(e){super._fillHead(e);let t=this._disposables.add(this.contextKeyService.createScoped(e));this._disposables.add(Vd(oo.peekHasStack,t,s=>SEo(this.current.read(s))));let o=this.menuService.createMenu(D.TestPeekTitle,t),n=this._actionbarWidget;this._disposables.add(o.onDidChange(()=>{for(r.length=0,_z(o.getActions(),r);n.getAction(1);)n.pull(0);n.push(r,{label:!1,icon:!0,index:0})}));let r=[];_z(o.getActions(),r),n.push(r,{label:!1,icon:!0,index:0})}_fillBody(e){this.content.fillBody(e);let t=this._disposables.add(new Dt(()=>{this.resizeOnNextContentHeightUpdate=!1},500));this._disposables.add(this.content.onDidChangeContentHeight(o=>{if(!this.resizeOnNextContentHeightUpdate||!o)return;let n=this._getMaximumHeightInLines();n&&(this._relayout(Math.min(n,this.getVisibleEditorLines()/2),!0),t.isScheduled()||t.schedule())})),this._disposables.add(this.content.onDidRequestReveal(o=>{Gb.get(this.editor)?.show(o instanceof Um?o.messageUri:o.outputUri)}))}setModel(e){if(e instanceof FS||e instanceof WS)return this.current.set(e,void 0),this.showInPlace(e);let t=this.current,o=e.revealLocation?.range.getStartPosition();return!o&&!t?Promise.resolve():(this.current.set(e,void 0),o?(this.resizeOnNextContentHeightUpdate=!0,this.show(o,10),this.editor.revealRangeNearTopIfOutsideViewport(z.fromPositions(o),0),this.showInPlace(e)):this.showInPlace(e))}collapseStack(){this.content.collapseStack()}getVisibleEditorLines(){return Math.round(this.editor.getDomNode().clientHeight/this.editor.getOption(75))}async showInPlace(e){if(e instanceof Um){let t=e.message;this.setTitle(tpn(mve(t.message)),Nu(e.test.label))}else this.setTitle(d(15951,null));this.applyTheme(),await this.content.reveal({subject:e,preserveFocus:!1})}_doLayoutBody(e,t){super._doLayoutBody(e,t),this.content.onLayoutBody(e,t)}_onWidth(e){super._onWidth(e),this.dimension&&(this.dimension=new si(e,this.dimension.height)),this.content.onWidth(e)}};Kat=I([m(1,Le),m(2,u5),m(3,pL),m(4,X),m(5,Kt),m(6,F),m(7,Bt),m(8,qt),m(9,ht)],Kat);var bHe=class extends Gs{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,t,o,n,r,s,l,c,u,p);this.resultService=h;this.content=new co(()=>this._register(this.instantiationService.createInstance(Mq,void 0,{historyVisible:kko(!0),showRevealLocationOnMessages:!0,locationForProgress:"workbench.view.testing"})))}get subject(){return this.content.rawValue?.current}showLatestRun(e=!1){let t=this.resultService.results.find(o=>o.tasks.length);t&&this.content.rawValue?.reveal({preserveFocus:e,subject:new FS(t,0)})}renderBody(e){super.renderBody(e),this.isBodyVisible()?this.renderContent(e):this._register(U.once(U.filter(this.onDidChangeBodyVisibility,Boolean))(()=>this.renderContent(e)))}layoutBody(e,t){super.layoutBody(e,t),this.content.rawValue?.onLayoutBody(e,t)}renderContent(e){let t=this.content.value;t.fillBody(e),this._register(t.onDidRequestReveal(n=>t.reveal({preserveFocus:!0,subject:n})));let[o]=this.resultService.results;o&&o.tasks.length&&t.reveal({preserveFocus:!0,subject:new FS(o,0)})}};bHe=I([m(1,_e),m(2,Xe),m(3,B),m(4,X),m(5,Bi),m(6,F),m(7,Je),m(8,Le),m(9,nt),m(10,pd)],bHe);var tpn=a=>{let i=a.indexOf(`
`);return i===-1?a:a.slice(0,i)};function ipn(a){let i=a.listDiffEditors();for(let e of i)if(e.hasTextFocus()&&e instanceof dL)return e.getParentEditor();return null}var A5t=class extends pl{constructor(){super({id:"editor.closeTestPeek",title:L(15941,"Close"),icon:R.close,precondition:C.or(oo.isInPeek,oo.isPeekVisible),keybinding:{weight:-1,primary:9,when:C.not("config.editor.stablePeek")}})}runEditorCommand(i,e){let t=Gat(i.get(qt));Gb.get(t??e)?.removePeek()}},N5t=C.and(pe.focus,oo.isPeekVisible),Gat=a=>{let i=a.getFocusedCodeEditor()||a.getActiveCodeEditor();return i&&opn(a,i)},opn=(a,i)=>{if(Gb.get(i)?.subject.get())return i;if(i instanceof id)return i.getParentEditor();let e=ipn(a);return e||i},O5t=class a extends K{static{this.ID="testing.goToNextMessage"}constructor(){super({id:a.ID,f1:!0,title:L(15943,"Go to Next Test Failure"),metadata:{description:L(15944,"Shows the next failure message in your file")},icon:R.arrowDown,category:Ve.Test,keybinding:{primary:578,weight:101,when:N5t},menu:[{id:D.TestPeekTitle,group:"navigation",order:2},{id:D.CommandPalette,when:N5t}]})}run(i){let e=Gat(i.get(qt));e&&Gb.get(e)?.next()}},F5t=class a extends K{static{this.ID="testing.goToPreviousMessage"}constructor(){super({id:a.ID,f1:!0,title:L(15945,"Go to Previous Test Failure"),metadata:{description:L(15946,"Shows the previous failure message in your file")},icon:R.arrowUp,category:Ve.Test,keybinding:{primary:1602,weight:101,when:N5t},menu:[{id:D.TestPeekTitle,group:"navigation",order:1},{id:D.CommandPalette,when:N5t}]})}run(i){let e=Gat(i.get(qt));e&&Gb.get(e)?.previous()}},W5t=class a extends K{static{this.ID="testing.collapsePeekStack"}constructor(){super({id:a.ID,title:L(15942,"Collapse Stack Frames"),icon:R.collapseAll,category:Ve.Test,menu:[{id:D.TestPeekTitle,when:oo.peekHasStack,group:"navigation",order:4}]})}run(i){let e=Gat(i.get(qt));e&&Gb.get(e)?.collapseStack()}},V5t=class a extends K{static{this.ID="testing.openMessageInEditor"}constructor(){super({id:a.ID,f1:!1,title:L(15948,"Open in Editor"),icon:R.goToFile,category:Ve.Test,menu:[{id:D.TestPeekTitle}]})}run(i){i.get(pL).openCurrentInEditor()}},B5t=class a extends K{static{this.ID="testing.toggleTestingPeekHistory"}constructor(){super({id:a.ID,f1:!0,title:L(15949,"Toggle Test History in Peek"),metadata:{description:L(15950,"Shows or hides the history of test runs in the peek view")},icon:R.history,category:Ve.Test,menu:[{id:D.TestPeekTitle,group:"navigation",order:3}],keybinding:{weight:200,primary:550,when:oo.isPeekVisible.isEqualTo(!0)}})}run(i){let e=i.get(pL);e.historyVisible.value=!e.historyVisible.value}};var UEo=128,zEo=30,qEo=2;function npn(a,i){let e=a.listDiffEditors();for(let t of e)if(t.getOriginalEditor()===i)return!0;return!1}var Qat=class{constructor(){this.runByIdKey=new Map}get size(){return this.runByIdKey.size}getForExactTests(i){let e=i.sort().join("\0\0");return this.runByIdKey.get(e)}addTest(i){let e=i.testIds.sort().join("\0\0");this.runByIdKey.set(e,i)}getById(i){for(let e of this.runByIdKey.values())if(e.id===i)return e}*[Symbol.iterator](){for(let i of this.runByIdKey.values())yield i}},SHe=class extends x{constructor(e,t,o,n,r,s){super();this.configurationService=t;this.testService=o;this.results=n;this.instantiationService=r;this.modelService=s;this.generation=0;this.changeEmitter=this._register(new E);this.decorationCache=new gt;this.invalidatedMessages=new WeakSet;this.onDidChange=this.changeEmitter.event;this._register(e.registerDecorationType("test-message-decoration",v6.decorationId,{},void 0)),this._register(s.onModelRemoved(c=>this.decorationCache.delete(c.uri)));let l=this._register(new Dt(()=>this.invalidate(),100));this._register(this.testService.onWillProcessDiff(c=>{for(let u of c){if(u.op!==2)continue;let p=this.decorationCache.get(u.uri);p&&(p.rangeUpdateVersionId=u.docv)}l.isScheduled()||l.schedule()})),this._register(U.any(this.results.onResultsChanged,this.results.onTestChanged,this.testService.excluded.onTestExclusionsChanged,U.filter(t.onDidChangeConfiguration,c=>c.affectsConfiguration("testing.gutterEnabled")))(()=>{l.isScheduled()||l.schedule()})),this._register(Bnt.registerGutterActionsGenerator((c,u)=>{let p=c.editor.getModel(),h=AN.get(c.editor);if(!p||!h?.currentUri)return;let g=this.syncDecorations(h.currentUri);if(!g.size)return;let f=p.getLinesDecorations(c.lineNumber,c.lineNumber);for(let{id:v}of f){let b=g.getById(v);if(b){let{object:S}=b.getContextMenuActions();for(let y of S)u.push(y,"1_testing")}}}))}invalidateResultMessage(e){this.invalidatedMessages.add(e),this.invalidate()}syncDecorations(e){let t=this.modelService.getModel(e);if(!t)return new Qat;let o=this.decorationCache.get(e);return o&&o.generation===this.generation&&(o.rangeUpdateVersionId===void 0||o.rangeUpdateVersionId!==t.getVersionId())?o.value:this.applyDecorations(t)}getDecoratedTestPosition(e,t){let o=this.modelService.getModel(e);if(!o)return;let n=vt.find(this.syncDecorations(e),r=>r instanceof kne&&r.isForTest(t));if(n)return o.getDecorationRange(n.id)?.getStartPosition()}invalidate(){this.generation++,this.changeEmitter.fire()}updateDecorationsAlternateAction(e,t){let o=this.modelService.getModel(e),n=this.decorationCache.get(e);!o||!n||n.isAlt===t||(n.isAlt=t,o.changeDecorations(r=>{for(let s of n.value)s instanceof kne&&s.editorDecoration.alternate&&r.changeDecorationOptions(s.id,t?s.editorDecoration.alternate:s.editorDecoration.options)}))}applyDecorations(e){let t=em(this.configurationService,"testing.gutterEnabled"),o=this.decorationCache.get(e.uri),n=o?.rangeUpdateVersionId===e.getVersionId(),r=o?.value??new Qat;return e.changeDecorations(l=>{let c=new Qat,u=new Yjt;for(let h of this.testService.collection.getNodeByUrl(e.uri)){if(!h.item.range)continue;let g=this.results.getStateById(h.item.extId),f=h.item.range.startLineNumber;u.push({line:f,id:"",test:h,resultItem:g?.[1]})}for(let[h,g]of u.lines()){let f=g.length>1,v=r.getForExactTests(g.map(b=>b.test.item.extId));v&&n&&e.getDecorationRange(v.id)?.startLineNumber!==h&&(v=void 0),v?(v.replaceOptions(g,t)&&l.changeDecorationOptions(v.id,v.editorDecoration.options),c.addTest(v)):c.addTest(f?this.instantiationService.createInstance(qat,g,t,e):this.instantiationService.createInstance($at,g[0].test,g[0].resultItem,e,t))}let p=new Set;for(let h of c)h.id===""?h.id=l.addDecoration(h.editorDecoration.range,h.editorDecoration.options):p.add(h.id);for(let h of r)p.has(h.id)||l.removeDecoration(h.id);return this.decorationCache.set(e.uri,{generation:this.generation,rangeUpdateVersionId:o?.rangeUpdateVersionId,value:c}),c})||r}};SHe=I([m(0,qt),m(1,B),m(2,Ws),m(3,pd),m(4,F),m(5,Tt)],SHe);var AN=class extends x{constructor(e,t,o,n,r,s,l,c){super();this.editor=e;this.codeEditorService=t;this.testService=o;this.decorations=n;this.uriIdentityService=r;this.results=s;this.configurationService=l;this.instantiationService=c;this.expectedWidget=this._register(new me);this.actualWidget=this._register(new me);this.errorContentWidgets=this._register(new Vt);this.loggedMessageDecorations=new Map;this._register(t.registerDecorationType("test-message-decoration",v6.decorationId,{},void 0,e)),this.attachModel(e.getModel()?.uri),this._register(n.onDidChange(()=>{this._currentUri&&n.syncDecorations(this._currentUri)}));let u=this._register(new gu);this._register(this.results.onTestChanged(g=>{g.reason===2&&u.queue(()=>(this.applyResults(),Li(100)))})),this._register(U.any(this.results.onResultsChanged,e.onDidChangeModel,this.testService.showInlineOutput.onDidChange)(()=>this.applyResults()));let p=Re(e.getDomNode());this._register(j(p,"keydown",g=>{new gi(g).keyCode===6&&this._currentUri&&n.updateDecorationsAlternateAction(this._currentUri,!0)})),this._register(j(p,"keyup",g=>{new gi(g).keyCode===6&&this._currentUri&&n.updateDecorationsAlternateAction(this._currentUri,!1)})),this._register(j(p,"blur",()=>{this._currentUri&&n.updateDecorationsAlternateAction(this._currentUri,!1)})),this._register(this.editor.onKeyUp(g=>{g.keyCode===6&&this._currentUri&&n.updateDecorationsAlternateAction(this._currentUri,!1)})),this._register(this.editor.onDidChangeModel(g=>this.attachModel(g.newModelUrl||void 0))),this._register(this.editor.onMouseDown(g=>{if(g.target.position&&this.currentUri){let f=e.getModel()?.getLineDecorations(g.target.position.lineNumber)??[];if(!f.length)return;let v=n.syncDecorations(this.currentUri);for(let{id:b}of f)if(v.getById(b)?.click(g)){g.event.stopPropagation();return}}})),this._register(U.accumulate(this.editor.onDidChangeModelContent,0,void 0,this._store)(g=>{let f=e.getModel();if(!this._currentUri||!f)return;let v=!1;for(let[b,S]of this.loggedMessageDecorations)g.some(w=>w.changes.some(k=>k.range.startLineNumber<=S.line&&k.range.endLineNumber>=S.line||S.resultItem?.item.range&&S.resultItem.item.range.startLineNumber<=k.range.startLineNumber&&S.resultItem.item.range.endLineNumber>=k.range.endLineNumber))&&(v=!0,AN.invalidatedTests.add(S.resultItem||b));v&&this.applyResults()}));let h=()=>{this.editor.getContainerDomNode().style.setProperty("--testMessageDecorationFontFamily",e.getOption(58)),this.editor.getContainerDomNode().style.setProperty("--testMessageDecorationFontSize",`${e.getOption(61)}px`)};this._register(this.editor.onDidChangeConfiguration(g=>{g.hasChanged(58)&&h()})),h()}static{this.invalidatedTests=new WeakSet}static get(e){return e.getContribution("editor.contrib.testingDecorations")}get currentUri(){return this._currentUri}attachModel(e){switch(e&&cve(e)?.type){case 4:this.expectedWidget.value=new UFi(this.editor),this.actualWidget.clear();break;case 3:this.expectedWidget.clear(),this.actualWidget.value=new zFi(this.editor);break;default:this.expectedWidget.clear(),this.actualWidget.clear()}npn(this.codeEditorService,this.editor)&&(e=void 0),this._currentUri=e,e&&(this.decorations.syncDecorations(e),(async()=>{for await(let t of gpe(this.testService,this.uriIdentityService,e,!1))if(this._currentUri!==e)break})())}applyResults(){let e=this.editor.getModel();if(!e)return this.clearResults();let t=e.uri.toString(),o=new Set;this.applyResultsContentWidgets(t,o),this.applyResultsLoggedMessages(t,o)}clearResults(){this.errorContentWidgets.clearAndDisposeAll()}isMessageInvalidated(e){return AN.invalidatedTests.has(e)}applyResultsContentWidgets(e,t){let o=new Set;em(this.configurationService,"testing.showAllMessages")?this.results.results.forEach(n=>this.applyContentWidgetsFromResult(n,e,o,t)):this.results.results.length&&this.applyContentWidgetsFromResult(this.results.results[0],e,o,t);for(let n of this.errorContentWidgets.keys())o.has(n)||this.errorContentWidgets.deleteAndDispose(n)}applyContentWidgetsFromResult(e,t,o,n){for(let r of e.tests)if(!AN.invalidatedTests.has(r))for(let s=0;s<r.tasks.length;s++){let l=r.tasks[s];for(let c=0;c<l.messages.length;c++){let u=l.messages[c];if(u.type!==0||this.isMessageInvalidated(u))continue;let p=u.location?.uri.toString()===t?u.location.range.startLineNumber:u.stackTrace&&d_(u.stackTrace,g=>g.position&&g.uri?.toString()===t?g.position.lineNumber:void 0);if(p===void 0||n.has(p))continue;n.add(p);let h=this.errorContentWidgets.get(u);if(!h){let g=this.editor.getModel()?.getLineLength(p)??100;h=this.instantiationService.createInstance(jat,this.editor,new ye(p,g+1),u,r,uL({type:3,messageIndex:c,taskIndex:s,resultId:e.id,testExtId:r.item.extId})),this.errorContentWidgets.set(u,h)}o.add(u)}}}applyResultsLoggedMessages(e,t){this.editor.changeDecorations(o=>{let n=new Set;em(this.configurationService,"testing.showAllMessages")?this.results.results.forEach(r=>this.applyLoggedMessageFromResult(r,e,n,t,o)):this.results.results.length&&this.applyLoggedMessageFromResult(this.results.results[0],e,n,t,o);for(let[r,{id:s}]of this.loggedMessageDecorations)n.has(r)||o.removeDecoration(s)})}applyLoggedMessageFromResult(e,t,o,n,r){if(!this.testService.showInlineOutput.value||!(e instanceof Dh))return;let s=(l,c,u)=>{if(this.isMessageInvalidated(c)||c.location?.uri.toString()!==t)return;o.add(c);let p=c.location.range.startLineNumber;if(n.has(p)||this.loggedMessageDecorations.has(c))return;let h=this.instantiationService.createInstance(v6,c,u,this.editor.getModel());n.add(p);let g=r.addDecoration(h.editorDecoration.range,h.editorDecoration.options);this.loggedMessageDecorations.set(c,{id:g,line:p,resultItem:l})};for(let l of e.tests)if(!AN.invalidatedTests.has(l))for(let c=0;c<l.tasks.length;c++){let u=l.tasks[c];for(let p=u.messages.length-1;p>=0;p--){let h=u.messages[p];h.type===1&&s(l,h,uL({type:3,messageIndex:p,taskIndex:c,resultId:e.id,testExtId:l.item.extId}))}}for(let l of e.tasks)for(let c of l.otherMessages)s(void 0,c)}};AN=I([m(1,qt),m(2,Ws),m(3,lat),m(4,ht),m(5,pd),m(6,B),m(7,F)],AN);var KEo=a=>({startLineNumber:a.startLineNumber,endLineNumber:a.startLineNumber,startColumn:a.startColumn,endColumn:a.startColumn}),GEo=(a,i,e,t)=>{let o=a[0]?.item.range;if(!o)throw new Error("Test decorations can only be created for tests with a range");if(!e)return{range:KEo(o),options:{isWholeLine:!0,description:"run-test-decoration"}};let n=0,r=[],s,l=!1;for(let b=0;b<a.length;b++){let S=a[b],y=i[b],w=y?.computedState??0;r.length<10&&r.push(SNt(S.item.label,w)),n=CDe(n,w),l=l||!!y?.retired,!s&&y?.tasks.some(k=>k.messages.length)&&(s=S.item.extId)}let c=a.length>1||a[0].children.size>0,u=n===0?c?h6:LU:PN.get(n),p=t==="debug"?c?h6:LU:c?uve:kx,h,g="testing-run-glyph";l&&(g+=" retired");let f={description:"run-test-decoration",showIfCollapsed:!0,get hoverMessage(){if(!h){let b=h=new Ie("",!0).appendText(r.join(", ")+".");if(s){let S=encodeURIComponent(JSON.stringify([s]));b.appendMarkdown(` [${d(15903,null)}](command:vscode.peekTestError?${S})`)}}return h},glyphMargin:{position:qEo},glyphMarginClassName:`${q.asClassName(u)} ${g}`,stickiness:1,zIndex:1e4},v={...f,glyphMarginClassName:`${q.asClassName(p)} ${g}`};return{range:KEo(o),options:f,alternate:v}};var H5t=class{constructor(i){this.editor=i;this.allowEditorOverflow=!1;this.suppressMouseDown=!0;this._domNode=_("span");queueMicrotask(()=>{this.applyStyling(),this.editor.addContentWidget(this)})}applyStyling(){let i=this.editor.getOption(25),e;!i||i<5?(i=this.editor.getOption(61)*.9|0,e=this.editor.getOption(75)):e=i*Math.max(1.3,this.editor.getOption(75)/this.editor.getOption(61))|0;let t=this.editor.getOption(59),o=this._domNode;o.classList.add("testing-diff-lens-widget"),o.textContent=this.getText(),o.style.lineHeight=`${e}px`,o.style.fontSize=`${i}px`,o.style.fontFamily="var(--testingDiffLensFontFamily)",o.style.fontFeatureSettings="var(--testingDiffLensFontFeatures)";let n=this.editor.getContainerDomNode().style;n.setProperty("testingDiffLensFontFamily",this.editor.getOption(24)??"inherit"),n.setProperty("testingDiffLensFontFeatures",t.fontFeatureSettings),this.editor.changeViewZones(r=>{this.viewZoneId&&r.removeZone(this.viewZoneId),this.viewZoneId=r.addZone({afterLineNumber:0,afterColumn:1073741824,domNode:document.createElement("div"),heightInPx:20})})}getDomNode(){return this._domNode}dispose(){this.editor.changeViewZones(i=>{this.viewZoneId&&i.removeZone(this.viewZoneId)}),this.editor.removeContentWidget(this)}getPosition(){return{position:{column:0,lineNumber:0},preference:[1]}}},UFi=class extends H5t{getId(){return"expectedTestingLens"}getText(){return d(15901,null)}},zFi=class extends H5t{getId(){return"actualTestingLens"}getText(){return d(15897,null)}},kne=class{constructor(i,e,t,o,n,r,s,l,c,u,p){this.tests=i;this.visible=e;this.model=t;this.codeEditorService=o;this.testService=n;this.contextMenuService=r;this.commandService=s;this.configurationService=l;this.testProfileService=c;this.contextKeyService=u;this.menuService=p;this.id="";this.displayedStates=i.map(h=>h.resultItem?.computedState),this.editorDecoration=GEo(i.map(h=>h.test),i.map(h=>h.resultItem),e,em(this.configurationService,"testing.defaultGutterClickAction")),this.editorDecoration.options.glyphMarginHoverMessage=new Ie().appendText(this.getGutterLabel())}get line(){return this.editorDecoration.range.startLineNumber}get testIds(){return this.tests.map(i=>i.test.item.extId)}click(i){if(i.target.type!==2||i.target.detail.glyphMarginLane!==qEo||i.event.rightButton||Ze&&i.event.leftButton&&i.event.ctrlKey)return!1;let e=i.event.altKey;switch(em(this.configurationService,"testing.defaultGutterClickAction")){case"contextMenu":this.showContextMenu(i);break;case"debug":this.runWith(e?2:4);break;case"runWithCoverage":this.runWith(e?4:8);break;case"run":default:this.runWith(e?4:2);break}return!0}replaceOptions(i,e){let t=i.map(r=>r.resultItem?.computedState);if(e===this.visible&&$i(this.displayedStates,t))return!1;this.tests=i,this.displayedStates=t,this.visible=e;let{options:o,alternate:n}=GEo(i.map(r=>r.test),i.map(r=>r.resultItem),e,em(this.configurationService,"testing.defaultGutterClickAction"));return this.editorDecoration.options=o,this.editorDecoration.alternate=n,this.editorDecoration.options.glyphMarginHoverMessage=new Ie().appendText(this.getGutterLabel()),!0}isForTest(i){return this.tests.some(e=>e.test.item.extId===i)}runWith(i){return this.testService.runTests({tests:Nso(this.testService.collection,this.tests.map(({test:e})=>e)),group:i})}showContextMenu(i){this.codeEditorService.listCodeEditors().find(t=>t.getModel()===this.model)?.getContribution(ioe.ID)?.show(i)}getGutterLabel(){switch(em(this.configurationService,"testing.defaultGutterClickAction")){case"contextMenu":return d(15910,null);case"debug":return d(15912,null);case"runWithCoverage":return d(15911,null);case"run":default:return d(15913,null)}}getTestContextMenuActions(i,e){let t=[],o=this.testProfileService.capabilitiesForTest(i.item);[{bitset:2,label:d(15907,null)},{bitset:4,label:d(15900,null)},{bitset:8,label:d(15898,null)}].forEach(({bitset:r,label:s})=>{o&r&&t.push(new it(`testing.gutter.${r}`,s,void 0,void 0,()=>this.testService.runTests({group:r,tests:[i]})))}),o&16&&t.push(new it("testing.runUsing",d(15914,null),void 0,void 0,async()=>{let r=await this.commandService.executeCommand("vscode.pickTestProfile",{onlyForTest:i});r&&this.testService.runResolvedTests({group:r.group,targets:[{profileId:r.profileId,controllerId:r.controllerId,testIds:[i.item.extId]}]})})),e&&Dk(e.computedState)&&t.push(new it("testing.gutter.peekFailure",d(15902,null),void 0,void 0,()=>this.commandService.executeCommand("vscode.peekTestError",i.item.extId))),e?.computedState===2&&t.push(new it("testing.gutter.cancel",d(15909,null),void 0,void 0,()=>this.commandService.executeCommand("testing.cancelRun"))),t.push(new it("testing.gutter.reveal",d(15904,null),void 0,void 0,()=>this.commandService.executeCommand("_revealTestInExplorer",i.item.extId)));let n=this.getContributedTestActions(i,o);return{object:ri.join(t,n),dispose(){t.forEach(r=>r.dispose())}}}getContributedTestActions(i,e){let t=this.contextKeyService.createOverlay(eHe(i,e)),o=Mso(this.testService.collection,i.item.extId),n=this.menuService.getMenuActions(D.TestItemGutter,t,{shouldForwardArgs:!0,arg:o});return tu(n)}};kne=I([m(3,qt),m(4,Ws),m(5,Xe),m(6,ge),m(7,B),m(8,uu),m(9,X),m(10,Kt)],kne);var qat=class extends kne{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super(e,t,o,n,r,s,l,c,u,p,h);this.quickInputService=g}getContextMenuActions(){let e=new N,t=[];[{bitset:2,label:d(15905,null)},{bitset:8,label:d(15906,null)},{bitset:4,label:d(15899,null)}].forEach(({bitset:u,label:p},h)=>{this.tests.some(({test:f})=>this.testProfileService.capabilitiesForTest(f.item)&u)&&t.push(new it(`testing.gutter.run${h}`,p,void 0,void 0,()=>this.runWith(u)))}),e.add(Z(()=>t.forEach(u=>u.dispose())));let o=this.tests.map(u=>({currentLabel:u.test.item.label,testItem:u,parent:Ur.fromString(u.test.item.extId).parentId})),n=u=>{let p=new Map;for(let h of u)p.set(h.currentLabel,(p.get(h.currentLabel)||0)+1);return u.filter(h=>p.get(h.currentLabel)>1)},r,s=!0;for(;(r=n(o)).length&&s;)for(let u of r)if(u.parent){let p=this.testService.collection.getNodeById(u.parent.toString());u.currentLabel=p?.item.label+" > "+u.currentLabel,u.parent=u.parent.parentId}else s=!1;o.sort((u,p)=>{let h=u.testItem.test.item,g=p.testItem.test.item;return(h.sortText||h.label).localeCompare(g.sortText||g.label)});let l=o.map(({currentLabel:u,testItem:p})=>{let h=this.getTestContextMenuActions(p.test,p.resultItem);e.add(h);let g=Nu(u),f=g.indexOf(`
`);return f!==-1&&(g=g.slice(0,f)),new Fs(p.test.item.extId,g,h.object)}),c=l.length-zEo;return c>0&&(l=l.slice(0,zEo),l.push(new it("testing.gutter.overflow",d(15915,null,c),void 0,void 0,()=>this.pickAndRun(o)))),{object:ri.join(t,l),dispose:()=>e.dispose()}}async pickAndRun(e){let t=(r,s)=>new Promise(l=>{let c=new N,u=c.add(this.quickInputService.createQuickPick());u.placeholder=s,u.items=r,c.add(u.onDidHide(()=>{l(void 0),c.dispose()})),c.add(u.onDidAccept(()=>{l(u.selectedItems[0]),c.dispose()})),u.show()}),o=await t(e.map(({currentLabel:r,testItem:s})=>({label:r,test:s.test,result:s.resultItem})),d(15908,null));if(!o)return;let n=this.getTestContextMenuActions(o.test,o.result);try{(await t(n.object,o.label))?.run()}finally{n.dispose()}}};qat=I([m(3,qt),m(4,Ws),m(5,Xe),m(6,ge),m(7,B),m(8,uu),m(9,X),m(10,Kt),m(11,Ue)],qat);var $at=class extends kne{constructor(i,e,t,o,n,r,s,l,c,u,p,h){super([{test:i,resultItem:e}],o,t,n,r,l,s,c,u,p,h)}getContextMenuActions(){return this.getTestContextMenuActions(this.tests[0].test,this.tests[0].resultItem)}};$at=I([m(4,qt),m(5,Ws),m(6,ge),m(7,Xe),m(8,B),m(9,uu),m(10,X),m(11,Kt)],$at);var rpn=/\r?\n\s*/g,v6=class{constructor(i,e,t,o,n){this.testMessage=i;this.messageUri=e;this.peekOpener=o;this.id="";this.contentIdClass=`test-message-inline-content-id${xt()}`;let r=i.location;this.line=Bn(r.range.startLineNumber,0,t.getLineCount());let s=i.type,l=i.message,c=n.resolveDecorationOptions(v6.decorationId,!0);c.hoverMessage=typeof l=="string"?new Ie().appendText(l):l,c.zIndex=10,c.className=`testing-inline-message-severity-${s}`,c.isWholeLine=!0,c.stickiness=1,c.collapseOnReplaceEdit=!0;let u=mve(l).replace(rpn," ");u.length>UEo&&(u=u.slice(0,UEo-1)+"\u2026"),c.after={content:u,inlineClassName:`test-message-inline-content test-message-inline-content-s${s} ${this.contentIdClass} ${e?"test-message-inline-content-clickable":""}`},c.showIfCollapsed=!0;let p=s===0?ywe:wwe;p&&(c.overviewRuler={color:Xs(p),position:4});let h=t.getLineLength(this.line),g=h?h+1:r.range.endColumn;this.editorDecoration={options:c,range:{startLineNumber:this.line,startColumn:g,endColumn:g,endLineNumber:this.line}}}static{this.inlineClassName="test-message-inline-content"}static{this.decorationId=`testmessage-${xt()}`}click(i){return i.event.rightButton||!this.messageUri||i.target.element?.className.includes(this.contentIdClass)&&this.peekOpener.peekUri(this.messageUri),!1}getContextMenuActions(){return{object:[],dispose:()=>{}}}};v6=I([m(3,pL),m(4,qt)],v6);var spn=20,jat=class extends x{constructor(e,t,o,n,r,s){super();this.editor=e;this.position=t;this.message=o;this.resultItem=n;this.peekOpener=s;this.id=xt();this.allowEditorOverflow=!1;this.node=ct("div.test-error-content-widget",[ct("div.inner@inner",[ct("div.arrow@arrow"),ct(`span${q.asCSSSelector(PN.get(4))}`),ct("span.content@name")])]);let l=()=>{let g=e.getLineHeightForPosition(t);this.node.root.style.marginTop=(g-spn)/2+"px"};l(),this._register(e.onDidChangeLineHeight(g=>{g.affects(t)&&l()})),this._register(e.onDidChangeConfiguration(g=>{g.hasChanged(75)&&l()}));let c;if(o.expected!==void 0&&o.actual!==void 0)c=`${UXt(o.actual.replace(/\s+/g," "),30)} != ${UXt(o.expected.replace(/\s+/g," "),30)}`;else{let g=Da(o.message),f=g.indexOf(`
`);c=f===-1?g:g.slice(0,f)}this._register(j(this.node.root,re.CLICK,g=>{this.peekOpener.peekUri(r),g.preventDefault()}));let u=Gb.get(e);u&&this._register(be(g=>{let f=u.subject.read(g),v=f instanceof Um&&f.message===o;this.node.root.classList.toggle("is-current",v)})),this.node.name.innerText=c||"Test Failed";let p=document.createElementNS("http://www.w3.org/2000/svg","svg");p.setAttribute("width","15"),p.setAttribute("height","10"),p.setAttribute("preserveAspectRatio","none"),p.setAttribute("viewBox","0 0 15 10");let h=document.createElementNS("http://www.w3.org/2000/svg","path");h.setAttribute("d","M15 0 L10 0 L0 5 L10 10 L15 10 Z"),p.append(h),this.node.arrow.appendChild(p),this._register(e.onDidChangeModelContent(g=>{for(let f of g.changes){if(f.range.startLineNumber>this.line)continue;(f.range.startLineNumber<=this.line&&f.range.endLineNumber>=this.line||n.item.range&&n.item.range.startLineNumber<=f.range.startLineNumber&&n.item.range.endLineNumber>=f.range.endLineNumber)&&(AN.invalidatedTests.add(this.resultItem),this.dispose());let v=DL(f.text,`
`)-(f.range.endLineNumber-f.range.startLineNumber);v!==0&&(this.position=this.position.delta(v),this.editor.layoutContentWidget(this))}})),e.addContentWidget(this),this._register(Z(()=>e.removeContentWidget(this)))}get line(){return this.position.lineNumber}getId(){return this.id}getDomNode(){return this.node.root}getPosition(){return{position:this.position,preference:[0]}}afterRender(e,t){if(t){let{verticalScrollbarWidth:o}=this.editor.getLayoutInfo(),n=this.editor.getScrollWidth();this.node.inner.style.maxWidth=`${n-o-t.left-20}px`}}};jat=I([m(5,pL)],jat);var U5t=class extends Ah{constructor(e,t,o){super({...e,item:{...e.item}},t);this.chain=o;this.descriptionParts=[];this.updateErrorVisibility()}get description(){return this.chain.map(e=>e.item.label).join(" \u203A ")}update(e){i_e(this.test,e),this.updateErrorVisibility(e),this.fireChange()}fireChange(){this.changeEmitter.fire()}updateErrorVisibility(e){this.errorChild&&(!this.test.item.error||e?.item?.error)&&(this.children.delete(this.errorChild),this.errorChild=void 0),this.test.item.error&&!this.errorChild&&(this.errorChild=new Ex(this.test.item.error,this),this.children.add(this.errorChild))}},IHe=class extends x{constructor(e,t,o){super();this.lastState=e;this.testService=t;this.results=o;this.updateEmitter=this._register(new E);this.items=new Map;this.onUpdate=this.updateEmitter.event;this._register(t.onDidProcessDiff(n=>this.applyDiff(n))),this._register(o.onResultsChanged(n=>{if("removed"in n)for(let r of this.items.values()){let s=this.results.getStateById(r.test.item.extId)?.[1];r.duration=s?.ownDuration,r.state=s?.ownComputedState||0,r.fireChange()}})),this._register(o.onTestChanged(n=>{if(n.reason===2)return;let r=n.item;if(r.ownComputedState===0||n.result!==o.results[0]){let l=o.getStateById(r.item.extId);l&&(r=l[1])}let s=this.items.get(r.item.extId);s&&(s.retired=!!r.retired,s.state=r.computedState,s.duration=r.ownDuration,s.fireChange())}));for(let n of t.collection.all)this.storeItem(n)}get rootsWithChildren(){let e=vt.map(this.testService.collection.rootItems,t=>this.items.get(t.item.extId));return vt.filter(e,t=>!!t?.children.size)}getElementByTestId(e){return this.items.get(e)}applyDiff(e){for(let t of e)switch(t.op){case 0:{this.storeItem(t.item);break}case 1:{this.items.get(t.item.extId)?.update(t.item);break}case 3:{for(let[o,n]of this.items)(o===t.itemId||Ur.isChild(t.itemId,o))&&this.unstoreItem(n);break}}e.length!==0&&this.updateEmitter.fire()}applyTo(e){e.setChildren(null,ZBe(this.lastState,this.rootsWithChildren,null),{diffIdentityProvider:l5t,diffDepth:1/0})}expandElement(e,t){e instanceof U5t&&e.test.expand!==0&&this.testService.collection.expand(e.test.item.extId,t)}unstoreItem(e){this.items.delete(e.test.item.extId),e.parent?.children.delete(e);let t=Ur.fromString(e.test.item.extId).parentId;if(t)for(let o of t.idsToRoot()){let n=this.testService.collection.getNodeById(o.toString());if(n){n.children.size===0&&!this.items.has(o.toString())&&this._storeItem(t,n);break}}}_storeItem(e,t){let o=e.isRoot?null:this.items.get(t.controllerId),n=[...e.idsFromRoot()].slice(1,-1).map(l=>this.testService.collection.getNodeById(l.toString())),r=new U5t(t,o,n);o?.children.add(r),this.items.set(r.test.item.extId,r),(r.depth===0||JBe(this.lastState,r.test.item.extId)===!1)&&this.expandElement(r,1/0);let s=this.results.getStateById(r.test.item.extId)?.[1];s&&(r.retired=!!s.retired,r.state=s.computedState,r.duration=s.ownDuration)}storeItem(e){let t=Ur.fromString(e.item.extId);for(let o of t.idsToRoot())if(!o.isRoot){let n=this.items.get(o.toString());if(n){this.unstoreItem(n);break}}this._storeItem(t,e)}};IHe=I([m(1,Ws),m(2,pd)],IHe);var z5t=class extends Rg{getOptimizedViewState(i){let e=i||{},t=(o,n)=>{if(!(o.element instanceof Ah))return!1;let r=Ur.localId(o.element.test.item.extId),s=n.children?.[r]||{};s.collapsed=o.depth===0||!o.collapsed?o.collapsed:void 0;let l=s.collapsed!==void 0;if(o.children.length)for(let c of o.children)l=t(c,s)||l;return l?(n.children??={},n.children[r]=s):n.children?.hasOwnProperty(r)&&delete n.children[r],l};e.children??={};for(let o of this.getNode().children)if(o.element instanceof Ah)if(o.element.test.controllerId===o.element.test.item.extId)t(o,e);else{let n=e.children[o.element.test.controllerId]??={children:{}};t(o,n)}return e}};var K5t={getOwnState:a=>a instanceof Ah?a.ownState:0,getCurrentComputedState:a=>a.state,setComputedState:(a,i)=>a.state=i,getCurrentComputedDuration:a=>a.duration,getOwnDuration:a=>a instanceof Ah?a.ownDuration:void 0,setComputedDuration:(a,i)=>a.duration=i,getChildren:a=>vt.filter(a.children.values(),i=>i instanceof Sve),*getParents(a){for(let i=a.parent;i;i=i.parent)yield i}},Sve=class extends Ah{constructor(e,t,o){super({...e,item:{...e.item}},t);this.addedOrRemoved=o;this.ownState=0;this.updateErrorVisibility()}get description(){return this.test.item.description}update(e){i_e(this.test,e),this.updateErrorVisibility(e),this.fireChange()}fireChange(){this.changeEmitter.fire()}updateErrorVisibility(e){this.errorChild&&(!this.test.item.error||e?.item?.error)&&(this.addedOrRemoved(this),this.children.delete(this.errorChild),this.errorChild=void 0),this.test.item.error&&!this.errorChild&&(this.errorChild=new Ex(this.test.item.error,this),this.children.add(this.errorChild),this.addedOrRemoved(this))}},yHe=class extends x{constructor(e,t,o){super();this.lastState=e;this.testService=t;this.results=o;this.updateEmitter=this._register(new E);this.changedParents=new Set;this.resortedParents=new Set;this.items=new Map;this.onUpdate=this.updateEmitter.event;this._register(t.onDidProcessDiff(n=>this.applyDiff(n))),this._register(o.onResultsChanged(n=>{if("removed"in n)for(let r of[...this.items.values()].sort((s,l)=>l.depth-s.depth)){let s=this.results.getStateById(r.test.item.extId)?.[1];r.ownDuration=s?.ownDuration,hpe(K5t,r,s?.ownComputedState??0).forEach(l=>l.fireChange())}})),this._register(o.onTestChanged(n=>{if(n.reason===2)return;let r=n.item;if(r.ownComputedState===0||n.result!==o.results[0]){let u=o.getStateById(r.item.extId);u&&(r=u[1])}let s=this.items.get(r.item.extId);if(!s)return;let l=n.reason===1&&n.previousOwnDuration!==r.ownDuration,c=s.children.size?void 0:r.computedState;s.retired=!!r.retired,s.ownState=r.ownComputedState,s.ownDuration=r.ownDuration,s.fireChange(),hpe(K5t,s,c,l).forEach(u=>u.fireChange())}));for(let n of t.collection.all)this.storeItem(this.createItem(n))}get rootsWithChildren(){let e=vt.map(this.testService.collection.rootItems,t=>this.items.get(t.item.extId));return vt.filter(e,t=>!!t?.children.size)}getElementByTestId(e){return this.items.get(e)}applyDiff(e){for(let t of e)switch(t.op){case 0:{let o=this.createItem(t.item);this.storeItem(o);break}case 1:{let o=t.item,n=this.items.get(o.extId);if(!n)break;let r=n.test.expand===0&&o.expand;n.update(o),r?this.changedParents.add(n.parent):this.resortedParents.add(n.parent);break}case 3:{let o=this.items.get(t.itemId);if(!o)break;let n=o.parent,r=o.depth===1&&(n?.children.size===1||!vt.some(this.rootsWithChildren,(l,c)=>c===1));this.changedParents.add(r?null:n);let s=[[o]];for(;s.length;)for(let l of s.pop())l instanceof Sve&&s.push(this.unstoreItem(l));n instanceof Sve&&hpe(K5t,n,void 0,!!n.duration).forEach(l=>l.fireChange())}}e.length!==0&&this.updateEmitter.fire()}applyTo(e){for(let t of this.changedParents)(!t||e.hasElement(t))&&e.setChildren(t,ZBe(this.lastState,this.rootsWithChildren,t),{diffIdentityProvider:l5t});for(let t of this.resortedParents)(!t||e.hasElement(t))&&e.resort(t,!1);this.changedParents.clear(),this.resortedParents.clear()}expandElement(e,t){e instanceof Sve&&e.test.expand!==0&&this.testService.collection.expand(e.test.item.extId,t)}createItem(e){let t=Ur.parentId(e.item.extId),o=t?this.items.get(t):null;return new Sve(e,o,n=>this.changedParents.add(n))}unstoreItem(e){return e.parent?.children.delete(e),this.items.delete(e.test.item.extId),e.children}storeItem(e){e.parent?.children.add(e),this.items.set(e.test.item.extId,e);let o=e.parent?.children.size===1?e.parent.parent:e.parent;this.changedParents.add(o),o?.depth===0&&this.changedParents.add(null),(e.depth===0||JBe(this.lastState,e.test.item.extId)===!1)&&this.expandElement(e,0);let n=this.results.getStateById(e.test.item.extId)?.[1];n&&(e.retired=!!n.retired,e.ownState=n.computedState,e.ownDuration=n.ownDuration,hpe(K5t,e,void 0,!!e.ownDuration).forEach(r=>r.fireChange()))}};yHe=I([m(1,Ws),m(2,pd)],yHe);var $Eo={"@failed":d(15925,null),"@executed":d(15924,null),"@doc":d(15918,null),"@openedFiles":d(15921,null),"@hidden":d(15923,null)},wHe=class extends wl{constructor(e,t,o,n,r){super(null,e,t);this.state=o;this.instantiationService=n;this.testService=r;this.focusEmitter=this._register(new E);this.onDidFocus=this.focusEmitter.event;this.filtersAction=new it("markersFiltersAction",d(15920,null),"testing-filter-button "+q.asClassName(cat));this.history=this._register(n.createInstance(_S,{key:"testing.filterHistory2",scope:1,target:1})),this.updateFilterActiveState(),this._register(r.excluded.onTestExclusionsChanged(this.updateFilterActiveState,this))}render(e){e.classList.add("testing-filter-action-item");let t=this._register(new Xo(400)),o=this.wrapper=_(".testing-filter-wrapper");e.appendChild(o);let n=this.history.get({lastValue:"",values:[]});n instanceof Array&&(n={lastValue:"",values:n}),n.lastValue&&this.state.setText(n.lastValue);let r=this.input=this._register(this.instantiationService.createInstance(UMe,{id:"testing.explorer.filter",ariaLabel:d(15917,null),parent:o,suggestionProvider:{triggerCharacters:["@"],provideResults:()=>[...Object.entries($Eo).map(([l,c])=>({label:l,detail:c})),...vt.map(this.testService.collection.tags.values(),l=>{let{ctrlId:c,tagId:u}=DMt(l.id),p=`@${c}:${u}`;return{label:`@${c}:${u}`,detail:this.testService.collection.getNodeById(c)?.item.label,insertText:u.includes(" ")?`@${c}:"${u.replace(/(["\\])/g,"\\$1")}"`:p}})].filter(l=>!this.state.text.value.includes(l.label))},resourceHandle:"testing:filter",suggestOptions:{value:this.state.text.value,placeholderText:d(15916,null)},history:n.values}));this._register(this.state.text.onDidChange(l=>{r.getValue()!==l&&r.setValue(l)})),this._register(this.state.onDidRequestInputFocus(()=>{r.focus()})),this._register(r.onDidFocus(()=>{this.focusEmitter.fire()})),this._register(r.onInputDidChange(()=>t.trigger(()=>{r.addToHistory(),this.state.setText(r.getValue())}))),this._register(new Zi(e,{actionViewItemProvider:(l,c)=>{if(l.id===this.filtersAction.id)return this.instantiationService.createInstance(Yat,l,c,this.state,this.actionRunner)}})).push(this.filtersAction,{icon:!0,label:!1}),this.layout(this.wrapper.clientWidth)}layout(e){this.input.layout(new si(e-24-8-22,20))}focus(){this.input.focus()}saveState(){this.history.store({lastValue:this.input.getValue(),values:this.input.getHistory()})}dispose(){this.saveState(),super.dispose()}updateFilterActiveState(){this.filtersAction.checked=this.testService.excluded.hasAny}};wHe=I([m(2,UW),m(3,F),m(4,Ws)],wHe);var Yat=class extends Pm{constructor(e,t,o,n,r,s){super(e,{getActions:()=>this.getActions()},r,{actionRunner:n,classNames:e.class,anchorAlignmentProvider:()=>1,menuAsChild:!0});this.filters=o;this.testService=s}render(e){super.render(e),this.updateChecked()}getActions(){return[...["@failed","@executed","@doc","@openedFiles"].map(e=>({checked:this.filters.isFilteringFor(e),class:void 0,enabled:!0,id:e,label:$Eo[e],run:()=>this.filters.toggleFilteringFor(e),tooltip:"",dispose:()=>null})),new ri,{checked:this.filters.fuzzy.value,class:void 0,enabled:!0,id:"fuzzy",label:d(15919,null),run:()=>this.filters.fuzzy.value=!this.filters.fuzzy.value,tooltip:""},new ri,{checked:this.filters.isFilteringFor("@hidden"),class:void 0,enabled:this.testService.excluded.hasAny,id:"showExcluded",label:d(15923,null),run:()=>this.filters.toggleFilteringFor("@hidden"),tooltip:""},{class:void 0,enabled:this.testService.excluded.hasAny,id:"removeExcluded",label:d(15922,null),run:async()=>this.testService.excluded.clear(),tooltip:""}]}updateChecked(){this.element.classList.toggle("checked",this._action.checked)}};Yat=I([m(4,Xe),m(5,Ws)],Yat);var CHe=class extends Gs{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super(e,o,t,n,l,s,r,c,u,h);this.testService=p;this.testProfileService=g;this.commandService=f;this.menuService=v;this.crService=b;this.filterActionBar=this._register(new me);this.discoveryProgress=this._register(new me);this.filter=this._register(new me);this.filterFocusListener=this._register(new me);this.dimensions={width:0,height:0};this.lastFocusState=0;let S=this._register(new Dt(()=>this.layoutBody(),1));this._register(this.onDidChangeViewWelcomeState(()=>{this.shouldShowWelcome()||S.schedule()})),this._register(U.any(b.onDidChange,g.onDidChange)(()=>{this.updateActions()})),this._register(p.collection.onBusyProvidersChange(y=>{this.updateDiscoveryProgress(y)})),this._register(g.onDidChange(()=>this.updateActions()))}get focusedTreeElements(){return this.viewModel.tree.getFocus().filter(lo)}shouldShowWelcome(){return this.viewModel?.welcomeExperience===1}focus(){super.focus(),this.lastFocusState===1?this.viewModel.tree.domFocus():this.filter.value?.focus()}getTreeIncludeExclude(e,t,o="visible"){let n=this.viewModel.projection.value;if(!n)return{include:[],exclude:[]};let r=new Set,s=[],l=new Map,c=p=>{let h=l.get(p);return h===void 0&&(h=typeof e=="number"?!!this.testProfileService.getDefaultProfileForTest(e,p):tM(e,p),l.set(p,h)),h},u=(p,h)=>{if(!(p instanceof Ah)||!this.viewModel.tree.hasElement(p))return;let g=this.viewModel.tree.getNode(p);if(!g.visible){h&&s.push(p.test);return}let f=g.children.filter(v=>v.visible&&v.element instanceof Ah&&c(v.element.test)).length;!h&&c(p.test)&&(f===0||f*2>=g.children.length)&&f!==1&&(r.add(p.test),h=!0);for(let v of p.children)u(v,h)};if(o==="selected"){let p=this.viewModel.tree.getSelection().filter(lo);if(p.length){e:for(let h of p)if(h instanceof Ah){for(let g=h;g;g=g.parent)if(r.has(g.test))continue e;r.add(h.test),h.children.forEach(g=>u(g,!0))}return{include:[...r],exclude:s}}}for(let p of t||this.testService.collection.rootItems){let h=n.getElementByTestId(p.item.extId);h&&(typeof e=="object"&&!tM(e,p)||(r.add(h.test),h.children.forEach(g=>u(g,!0))))}return{include:[...r],exclude:s}}render(){super.render(),this._register(bT({name:"testingExplorerView",focusNotifiers:[this],focusNextWidget:()=>{this.viewModel.tree.isDOMFocused()||this.viewModel.tree.domFocus()},focusPreviousWidget:()=>{this.viewModel.tree.isDOMFocused()&&this.filter.value?.focus()}}))}renderBody(e){super.renderBody(e),this.container=M(e,_(".test-explorer")),this.treeHeader=M(this.container,_(".test-explorer-header")),this.filterActionBar.value=this.createFilterActionBar();let t=M(this.treeHeader,_(".result-summary-container"));this._register(this.instantiationService.createInstance(Xat,t));let o=M(this.container,_(".test-explorer-tree"));this.viewModel=this.instantiationService.createInstance(Jat,o,this.onDidChangeBodyVisibility),this._register(this.viewModel.tree.onDidFocus(()=>this.lastFocusState=1)),this._register(this.viewModel.onChangeWelcomeVisibility(()=>this._onDidChangeViewWelcomeState.fire())),this._register(this.viewModel),this._onDidChangeViewWelcomeState.fire()}createActionViewItem(e,t){switch(e.id){case"workbench.actions.treeView.testExplorer.filter":return this.filter.value=this.instantiationService.createInstance(wHe,e,t),this.filterFocusListener.value=this.filter.value.onDidFocus(()=>this.lastFocusState=0),this.filter.value;case"testing.runSelected":return this.getRunGroupDropdown(2,e,t);case"testing.debugSelected":return this.getRunGroupDropdown(4,e,t);case"testing.startContinuousRun":case"testing.stopContinuousRun":return this.getContinuousRunDropdown(e,t);default:return super.createActionViewItem(e,t)}}getTestConfigGroupActions(e){let t=[],o=0,n=0,r=!1,s=this.testProfileService.getGroupDefaultProfiles(e);for(let{profiles:g,controller:f}of this.testProfileService.all()){let v=!1;for(let b of g)b.group===e&&(v||(v=!0,o++,t.push(ii({id:`${f.id}.$root`,label:f.label.get(),enabled:!1,checked:!1,run:()=>{}}))),r=r||b.hasConfigurationHandler,n++,t.push(ii({id:`${f.id}.${b.profileId}`,label:s.includes(b)?d(15927,null,b.label):b.label,run:()=>{let{include:S,exclude:y}=this.getTreeIncludeExclude(b);this.testService.runResolvedTests({exclude:y.map(w=>w.item.extId),group:b.group,targets:[{profileId:b.profileId,controllerId:b.controllerId,testIds:S.map(w=>w.item.extId)}]})}})))}let l=[];e===2&&l.push(["testing.profile.context.group","run"]),e===4&&l.push(["testing.profile.context.group","debug"]),e===8&&l.push(["testing.profile.context.group","coverage"]);let c=this.contextKeyService.createOverlay(l),u=this.menuService.getMenuActions(D.TestProfilesContext,c),p=tu(u),h=[];return n>1&&h.push(ii({id:"selectDefaultTestConfigurations",label:d(15929,null),run:()=>this.commandService.executeCommand("testing.selectDefaultTestProfiles",e)})),r&&h.push(ii({id:"configureTestProfiles",label:d(15926,null),run:()=>this.commandService.executeCommand("testing.configureProfile",e)})),{numberOfProfiles:n,actions:p.length>0?ri.join(t,p,h):ri.join(t,h)}}saveState(){this.filter.value?.saveState(),super.saveState()}getRunGroupDropdown(e,t,o){let n=this.getTestConfigGroupActions(e);if(n.numberOfProfiles<2)return super.createActionViewItem(t,o);let r=this.instantiationService.createInstance(Lo,{id:t.id,title:t.label,icon:e===2?h6:uve},void 0,void 0,void 0,void 0);return this.instantiationService.createInstance(Jw,r,this.getDropdownAction(),n.actions,"",o)}getDropdownAction(){return new it("selectRunConfig",d(15940,null),"codicon-chevron-down",!0)}getContinuousRunDropdown(e,t){let o=[...vt.flatMap(this.testProfileService.all(),c=>this.testService.collection.getNodeById(c.controller.id)?.children.size?vt.filter(c.profiles,u=>u.supportsContinuousRun):vt.empty())];if(o.length<=1)return super.createActionViewItem(e,t);let n=this.instantiationService.createInstance(Lo,{id:e.id,title:e.label,icon:e.id==="testing.startContinuousRun"?uat:e5t},void 0,void 0,void 0,void 0),r=[],s=MI(o,c=>c.group),l=this.crService;for(let c of[2,4,8]){let u=s[c];if(u){Object.keys(s).length>1&&r.push({id:`${c}.label`,label:gfi[c],enabled:!1,class:void 0,tooltip:gfi[c],run:()=>{}});for(let p of u)r.push({id:`${c}.${p.profileId}`,label:p.label,enabled:!0,class:void 0,tooltip:p.label,checked:l.isEnabledForProfile(p),run:()=>l.isEnabledForProfile(p)?l.stopProfile(p):l.start([p])})}}return this.instantiationService.createInstance(Jw,n,this.getDropdownAction(),r,"",t)}createFilterActionBar(){let e=new Zi(this.treeHeader,{actionViewItemProvider:(t,o)=>this.createActionViewItem(t,o),triggerKeys:{keyDown:!1,keys:[]}});return e.push(new it("workbench.actions.treeView.testExplorer.filter")),e.getContainer().classList.add("testing-filter-action-bar"),e}updateDiscoveryProgress(e){!e&&this.discoveryProgress?this.discoveryProgress.clear():e&&!this.discoveryProgress.value&&(this.discoveryProgress.value=this.instantiationService.createInstance(hCe,{location:this.getProgressLocation()}))}layoutBody(e=this.dimensions.height,t=this.dimensions.width){super.layoutBody(e,t),this.dimensions.height=e,this.dimensions.width=t,this.container.style.height=`${e}px`,this.viewModel?.layout(e-this.treeHeader.clientHeight,t),this.filter.value?.layout(t)}};CHe=I([m(1,Xe),m(2,_e),m(3,B),m(4,F),m(5,Bi),m(6,X),m(7,Je),m(8,Le),m(9,Ws),m(10,nt),m(11,uu),m(12,ge),m(13,Kt),m(14,jM)],CHe);var cpn=200,Xat=class extends x{constructor(e,t,o,n,r,s,l){super();this.container=e;this.resultService=t;this.activityService=o;this.crService=n;this.elementsWereAttached=!1;this.badgeDisposable=this._register(new me);this.renderLoop=this._register(new Dt(()=>this.render(),cpn));this.elements=ct("div.result-summary",[ct("div@status"),ct("div@count"),ct("div@count"),ct("span"),ct("duration@duration"),ct("a@rerun")]);this.badgeType=r.getValue("testing.countBadge"),this._register(t.onResultsChanged(this.render,this)),this._register(r.onDidChangeConfiguration(u=>{u.affectsConfiguration("testing.countBadge")&&(this.badgeType=r.getValue("testing.countBadge"),this.render())})),this.countHover=this._register(l.setupManagedHover(Ri("mouse"),this.elements.count,"")),this._register(new Zi(this.elements.rerun,{actionViewItemProvider:(u,p)=>Bs(s,u,p)})).push(s.createInstance(Lo,{...new kat().desc,icon:dne},{...new Eat().desc,icon:kx},{},void 0,void 0),{icon:!0,label:!1}),this.render()}render(){let{results:e}=this.resultService,{count:t,root:o,status:n,duration:r,rerun:s}=this.elements;if(!e.length){this.elementsWereAttached&&(o.remove(),this.elementsWereAttached=!1),this.container.innerText=d(15928,null),this.badgeDisposable.clear();return}let l=e.filter(u=>!u.completedAt),c;if(l.length){n.className=q.asClassName(AE),c=qBe(!0,l),this.renderLoop.schedule();let u=l[l.length-1];r.textContent=tlt(Date.now()-u.startedAt),s.style.display="none"}else{let u=e[0],p=d_(eXe,h=>u.counts[h]>0?h:void 0);n.className=q.asClassName(PN.get(p??0)),c=qBe(!1,[u]),r.textContent=u instanceof Dh?tlt(u.completedAt-u.startedAt):"",s.style.display="block"}t.textContent=`${c.passed}/${c.totalWillBeRun}`,this.countHover.update(aat(c)),this.renderActivityBadge(c,l.length>0),this.elementsWereAttached||(Rt(this.container),this.container.appendChild(o),this.elementsWereAttached=!0)}renderActivityBadge(e,t){if(t){if(this.badgeDisposable.value&&this.lastBadge instanceof y2&&this.lastBadge.icon===AE)return;this.lastBadge=new y2(AE,()=>d(15939,null))}else if(e&&this.badgeType!=="off"&&e[this.badgeType]!==0){if(this.badgeDisposable.value&&this.lastBadge instanceof Rd&&this.lastBadge.number===e[this.badgeType])return;this.lastBadge=new Rd(e[this.badgeType],o=>this.getLocalizedBadgeString(this.badgeType,o))}else if(this.crService.isEnabled()){if(this.badgeDisposable.value&&this.lastBadge instanceof y2&&this.lastBadge.icon===pat)return;this.lastBadge=new y2(pat,()=>d(15933,null))}else{if(!this.lastBadge)return;this.lastBadge=void 0}this.badgeDisposable.value=this.lastBadge&&this.activityService.showViewActivity("workbench.view.testing",{badge:this.lastBadge})}getLocalizedBadgeString(e,t){switch(e){case"passed":return d(15935,null,t);case"skipped":return d(15936,null,t);default:return d(15934,null,t)}}};Xat=I([m(1,pd),m(2,Sl),m(3,jM),m(4,B),m(5,F),m(6,nt)],Xat);var Jat=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super();this.menuService=s;this.contextMenuService=l;this.testService=c;this.filterState=u;this.instantiationService=p;this.storageService=h;this.contextKeyService=g;this.testResults=f;this.peekOpener=v;this.testProfileService=b;this.crService=S;this.projection=this._register(new me);this.revealTimeout=this._register(new me);this.welcomeVisibilityEmitter=this._register(new E);this.actionRunner=this._register(new GFi(()=>this.tree.getSelection().filter(lo)));this.hasPendingReveal=!1;this.onChangeWelcomeVisibility=this.welcomeVisibilityEmitter.event;this.welcomeExperience=0;this.hasPendingReveal=!!u.reveal.get(),this.noTestForDocumentWidget=this._register(p.createInstance(elt,e)),this.lastViewState=this._register(new _S({key:"testing.treeState",scope:1,target:1},this.storageService)),this._viewMode=oo.viewMode.bindTo(g),this._viewSorting=oo.viewSorting.bindTo(g),this._viewMode.set(this.storageService.get("testing.viewMode",1,"true")),this._viewSorting.set(this.storageService.get("testing.viewSorting",1,"location")),this.reevaluateWelcomeState(),this.filter=this.instantiationService.createInstance(Zat,c.collection),this.tree=p.createInstance(z5t,"Test Explorer List",e,new jFi,[p.createInstance(Tne,this.actionRunner),p.createInstance(Ene)],{identityProvider:p.createInstance(QFi),hideTwistiesOfChildlessElements:!1,sorter:p.createInstance(KFi,this),keyboardNavigationLabelProvider:p.createInstance($Fi),accessibilityProvider:p.createInstance(qFi),filter:this.filter,findWidgetEnabled:!1});let w=this._register(new Dt(()=>{let H=this.tree.getOptimizedViewState(this.lastViewState.get({})),G=this.projection.value;G&&(G.lastState=H)},3e3));this._register(this.tree.onDidChangeCollapseState(H=>{H.node.element instanceof Ah&&(H.node.collapsed||this.projection.value?.expandElement(H.node.element,H.deep?1/0:0),w.schedule())})),this._register(this.crService.onDidChange(H=>{if(H){let G=this.projection.value?.getElementByTestId(H);this.tree.resort(G?.parent&&this.tree.hasElement(G.parent)?G.parent:null,!1)}})),this._register(t(H=>{H&&this.ensureProjection()})),this._register(this.tree.onContextMenu(H=>this.onContextMenu(H))),this._register(U.any(u.text.onDidChange,u.fuzzy.onDidChange,c.excluded.onTestExclusionsChanged)(()=>{if(!u.text.value)return this.tree.refilter();let H=this.filter.lastIncludedTests=new Set;this.tree.refilter(),this.filter.lastIncludedTests=void 0;for(let G of H)this.tree.expandTo(G)})),this._register(this.tree.onDidOpen(H=>{H.element instanceof Ah&&(u.didSelectTestInExplorer(H.element.test.item.extId),!H.element.children.size&&H.element.test.item.uri&&(this.tryPeekError(H.element)||y.executeCommand("vscode.revealTest",H.element.test.item.extId,{openToSide:H.sideBySide,preserveFocus:!0})))})),this._register(this.tree),this._register(this.onChangeWelcomeVisibility(H=>{this.noTestForDocumentWidget.setVisible(H===2)})),this._register(Jo(this.tree.getHTMLElement(),"keydown",H=>{H.equals(3)?this.handleExecuteKeypress(H):$ni.mightProducePrintableCharacter(H)&&(u.text.value=H.browserEvent.key,u.focusInput())})),this._register(be(H=>{this.revealById(u.reveal.read(H),void 0,!1)})),this._register(t(H=>{H&&u.focusInput()}));let k=em(o,"testing.followRunningTest");this._register(o.onDidChangeConfiguration(H=>{H.affectsConfiguration("testing.followRunningTest")&&(k=em(o,"testing.followRunningTest"))}));let T=em(o,"testing.alwaysRevealTestOnStateChange");this._register(o.onDidChangeConfiguration(H=>{H.affectsConfiguration("testing.alwaysRevealTestOnStateChange")&&(T=em(o,"testing.alwaysRevealTestOnStateChange"))})),this._register(f.onTestChanged(H=>{k&&H.reason===1&&(this.tree.selectionSize>1||H.item.ownComputedState!==2&&!(H.previousState===1&&kso(H.item.ownComputedState))||this.revealById(H.item.item.extId,T,!1))})),this._register(f.onResultsChanged(()=>{this.tree.resort(null)})),this._register(this.testProfileService.onDidChange(()=>{this.tree.rerender()}));let P=ui(this,n.onDidEditorsChange,()=>new Set(r.groups.flatMap(H=>H.editors).map(H=>H.resource).filter(lo))),O=ui(this,n.onDidActiveEditorChange,()=>n.activeEditor instanceof Pa?n.activeEditor.primary.resource:n.activeEditor?.resource),V=ui(this.filterState.text.onDidChange,()=>this.filterState.text);this._register(be(H=>{V.read(H),this.filterState.isFilteringFor("@openedFiles")?this.filter.filterToDocumentUri([...P.read(H)]):this.filter.filterToDocumentUri([O.read(H)].filter(lo)),(this.filterState.isFilteringFor("@doc")||this.filterState.isFilteringFor("@openedFiles"))&&this.tree.refilter()})),this._register(this.storageService.onWillSaveState(({reason:H})=>{H===1&&this.lastViewState.store(this.tree.getOptimizedViewState())}))}get viewMode(){return this._viewMode.get()??"true"}set viewMode(e){e!==this._viewMode.get()&&(this._viewMode.set(e),this.updatePreferredProjection(),this.storageService.store("testing.viewMode",e,1,1))}get viewSorting(){return this._viewSorting.get()??"status"}set viewSorting(e){e!==this._viewSorting.get()&&(this._viewSorting.set(e),this.tree.resort(null),this.storageService.store("testing.viewSorting",e,1,1))}layout(e,t){this.tree.layout(e,t)}revealById(e,t=!0,o=!0){if(!e){this.hasPendingReveal=!1;return}let n=this.ensureProjection(),r=0,s=[...Ur.fromString(e).idsFromRoot()];for(let l=s.length-1;l>=r;l--){let c=n.getElementByTestId(s[l].toString());if(!c||!this.tree.hasElement(c))continue;if(l<s.length-1&&t){this.tree.expand(c),r=l+1,l=s.length-1;continue}let u=c;for(let p=c;p instanceof Ah;p=p.parent){if(p.test&&this.testService.excluded.contains(p.test)){this.filterState.toggleFilteringFor("@hidden",!0);break}!t&&this.tree.hasElement(p)&&this.tree.isCollapsed(p)&&(u=p)}this.filterState.reveal.set(void 0,void 0),this.hasPendingReveal=!1,o&&this.tree.domFocus(),this.tree.getRelativeTop(u)===null&&this.tree.reveal(u,.5),this.revealTimeout.value=tn(()=>{this.tree.setFocus([u]),this.tree.setSelection([u])},1);return}this.hasPendingReveal=!0}async collapseAll(){this.tree.collapseAll()}tryPeekError(e){let t=e.test&&this.testResults.getStateById(e.test.item.extId);return t&&t[1].tasks.some(o=>Dk(o.state))?this.peekOpener.tryPeekFirstError(t[0],t[1],{preserveFocus:!0}):!1}onContextMenu(e){let t=e.element;if(!(t instanceof Ah))return;let{actions:o}=QEo(this.contextKeyService,this.menuService,this.testService,this.crService,this.testProfileService,t);this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>o.secondary,getActionsContext:()=>t,actionRunner:this.actionRunner})}handleExecuteKeypress(e){let t=this.tree.getFocus(),o=this.tree.getSelection(),n;t.length===1&&o.includes(t[0])?(e.browserEvent?.preventDefault(),n=o):n=t;let r=n.filter(s=>s instanceof Ah);r.length&&this.testService.runTests({group:2,tests:r.map(s=>s.test)})}reevaluateWelcomeState(){let t=this.testService.collection.busyProviders===0&&Rso(this.testService.collection)?this.filterState.isFilteringFor("@doc")?2:1:0;t!==this.welcomeExperience&&(this.welcomeExperience=t,this.welcomeVisibilityEmitter.fire(t))}ensureProjection(){return this.projection.value??this.updatePreferredProjection()}updatePreferredProjection(){this.projection.clear();let e=this.lastViewState.get({});this._viewMode.get()==="list"?this.projection.value=this.instantiationService.createInstance(IHe,e):this.projection.value=this.instantiationService.createInstance(yHe,e);let t=this._register(new Dt(()=>this.applyProjectionChanges(),200));return this.projection.value.onUpdate(()=>{t.isScheduled()||t.schedule()}),this.applyProjectionChanges(),this.projection.value}applyProjectionChanges(){this.reevaluateWelcomeState(),this.projection.value?.applyTo(this.tree),this.tree.refilter(),this.hasPendingReveal&&this.revealById(this.filterState.reveal.get())}getSelectedTests(){return this.tree.getSelection()}};Jat=I([m(2,B),m(3,ee),m(4,wt),m(5,Kt),m(6,Xe),m(7,Ws),m(8,UW),m(9,F),m(10,ce),m(11,X),m(12,pd),m(13,pL),m(14,uu),m(15,jM),m(16,ge)],Jat);var dpn=(a,i,e,t)=>{let o=[t?[t]:a.rootIds];for(;o.length;)for(let n of o.pop()){let r=a.getNodeById(n);if(r&&!(!r.item.uri||!i.extUri.isEqualOrParent(e,r.item.uri))){if(r.item.range||r.expand===1)return!0;o.push(r.children)}}return!1},Zat=class{constructor(i,e,t,o){this.collection=i;this.state=e;this.testService=t;this.uriIdentityService=o;this.documentUris=[]}filter(i){if(i instanceof Ex)return 1;if(i.test&&!this.state.isFilteringFor("@hidden")&&this.testService.excluded.contains(i.test))return 0;switch(Math.min(this.testFilterText(i),this.testLocation(i),this.testState(i),this.testTags(i))){case 0:return 0;case 2:return this.lastIncludedTests?.add(i),1;default:return 2}}filterToDocumentUri(i){this.documentUris=[...i]}testTags(i){return!this.state.includeTags.size&&!this.state.excludeTags.size||(!this.state.includeTags.size||i.test.item.tags.some(e=>this.state.includeTags.has(e)))&&i.test.item.tags.every(e=>!this.state.excludeTags.has(e))?2:1}testState(i){return this.state.isFilteringFor("@failed")?Dk(i.state)?2:1:this.state.isFilteringFor("@executed")?i.state!==0?2:1:2}testLocation(i){return this.documentUris.length===0||!this.state.isFilteringFor("@doc")&&!this.state.isFilteringFor("@openedFiles")||!(i instanceof Ah)||this.documentUris.some(e=>dpn(this.collection,this.uriIdentityService,e,i.test.item.extId))?2:1}testFilterText(i){if(this.state.globList.length===0)return 2;let e=this.state.fuzzy.value;for(let t=i;t;t=t.parent){let o=this.state.globList[0].include===!1?2:1,n=t.test.item.label.toLowerCase();for(let{include:r,text:s}of this.state.globList)(e?S$e(n,s):n.includes(s))&&(o=r?2:0);if(o!==1)return o}return 1}};Zat=I([m(1,UW),m(2,Ws),m(3,ht)],Zat);var KFi=class{constructor(i){this.viewModel=i}compare(i,e){if(i instanceof Ex||e instanceof Ex)return(i instanceof Ex?-1:0)+(e instanceof Ex?1:0);let t=(e.duration||0)-(i.duration||0);if(this.viewModel.viewSorting==="duration"&&t!==0)return t;let o=ZYe(i.state,e.state);if(this.viewModel.viewSorting==="status"&&o!==0)return o;let n=!1;if(i instanceof Ah&&e instanceof Ah&&i.test.item.uri&&e.test.item.uri&&i.test.item.uri.toString()===e.test.item.uri.toString()&&i.test.item.range&&e.test.item.range){n=!0;let l=i.test.item.range.startLineNumber-e.test.item.range.startLineNumber;if(l!==0)return l}let r=i.test.item.sortText,s=e.test.item.sortText;return n&&!r&&!s?0:DT(r||i.test.item.label,s||e.test.item.label)}},elt=class extends x{constructor(i,e){super();let t=this.el=M(i,_(".testing-no-test-placeholder")),o=M(t,_("p"));o.innerText=d(15938,null);let n=d(15937,null),r=this._register(new Wi(t,{title:n,...Qo}));r.label=n,this._register(r.onDidClick(()=>e.toggleFilteringFor("@doc",!1)))}setVisible(i){this.el.classList.toggle("visible",i)}};elt=I([m(1,UW)],elt);var GFi=class extends rs{constructor(e){super();this.getSelectedTests=e}async runAction(e,t){if(!(e instanceof Lo))return super.runAction(e,t);let o=this.getSelectedTests(),s=(o.some(l=>l===t)?o:[t]).filter(l=>l instanceof Ah);await e.run(...s)}},jEo=a=>{let i=SNt(a.description||a.test.item.label,a.state);return a instanceof Ah&&(a.duration!==void 0&&(i=d(15931,null,i,tlt(a.duration))),a.retired&&(i=d(15932,null,i))),i},qFi=class{getWidgetAriaLabel(){return d(15930,null)}getAriaLabel(i){return i instanceof Ex?i.description:jEo(i)}},$Fi=class{getKeyboardNavigationLabel(i){return i instanceof Ex?i.message:i.test.item.label}},jFi=class{getHeight(i){return i instanceof Ex?27:22}getTemplateId(i){return i instanceof Ex?Ene.ID:Tne.ID}},QFi=class{getId(i){return i.treeId}},Ene=class{constructor(i,e){this.hoverService=i;this.markdownRendererService=e}static{this.ID="error"}get templateId(){return Ene.ID}renderTemplate(i){return{label:M(i,_(".error")),disposable:new N}}renderElement({element:i},e,t){if(Rt(t.label),typeof i.message=="string")t.label.innerText=i.message;else{let o=this.markdownRendererService.render(i.message,void 0,document.createElement("span"));t.label.appendChild(o.element)}t.disposable.add(this.hoverService.setupManagedHover(Ri("mouse"),t.label,i.description))}disposeTemplate(i){i.disposable.dispose()}};Ene=I([m(0,nt),m(1,On)],Ene);var Tne=class extends x{constructor(e,t,o,n,r,s,l,c){super();this.actionRunner=e;this.menuService=t;this.testService=o;this.profiles=n;this.contextKeyService=r;this.instantiationService=s;this.crService=l;this.hoverService=c;this.templateId=Tne.ID}static{this.ID="testItem"}renderTemplate(e){e.classList.add("testing-stdtree-container");let t=M(e,_(".computed-state")),o=M(e,_(".label")),n=new N;M(e,_(q.asCSSSelector(zko)));let r=n.add(new Zi(e,{actionRunner:this.actionRunner,actionViewItemProvider:(l,c)=>l instanceof Lo?this.instantiationService.createInstance(xl,l,{hoverDelegate:c.hoverDelegate}):void 0}));n.add(this.profiles.onDidChange(()=>{s.current&&this.fillActionBar(s.current,s)})),n.add(this.crService.onDidChange(l=>{let c=s.current?.test.item.extId;c&&(!l||l===c||Ur.isChild(c,l))&&this.fillActionBar(s.current,s)}));let s={wrapper:e,label:o,actionBar:r,icon:t,elementDisposable:new N,templateDisposable:n};return s}disposeTemplate(e){e.templateDisposable.clear()}disposeElement(e,t,o){o.elementDisposable.clear()}fillActionBar(e,t){let{actions:o,contextOverlay:n}=QEo(this.contextKeyService,this.menuService,this.testService,this.crService,this.profiles,e),r=!!n.getContextKeyValue(oo.isContinuousModeOn.key),s=!r&&this.crService.isEnabledForAChildOf(e.test.item.extId);t.actionBar.domNode.classList.toggle("testing-is-continuous-run",r||s),t.actionBar.clear(),t.actionBar.context=e,t.actionBar.push(o.primary,{icon:!0,label:!1})}renderElement(e,t,o){o.elementDisposable.clear(),o.current=e.element,o.elementDisposable.add(e.element.onChange(()=>this._renderElement(e,o))),this._renderElement(e,o)}_renderElement(e,t){this.fillActionBar(e.element,t);let o=this.testService.excluded.contains(e.element.test);t.wrapper.classList.toggle("test-is-hidden",o);let n=PN.get(e.element.test.expand===2||e.element.test.item.busy?2:e.element.state);t.icon.className="computed-state "+(n?q.asClassName(n):""),e.element.retired&&(t.icon.className+=" retired"),t.elementDisposable.add(this.hoverService.setupManagedHover(Ri("mouse"),t.label,jEo(e.element))),e.element.test.item.label.trim()?vi(t.label,...Un(e.element.test.item.label)):t.label.textContent="\xA0";let r=e.element.description;e.element.duration!==void 0&&(r=r?`${r}: ${tlt(e.element.duration)}`:tlt(e.element.duration)),r&&M(t.label,_("span.test-label-description",{},r))}};Tne=I([m(1,Kt),m(2,Ws),m(3,uu),m(4,X),m(5,F),m(6,jM),m(7,nt)],Tne);var tlt=a=>a<10?`${a.toFixed(1)}ms`:a<1e3?`${a.toFixed(0)}ms`:`${(a/1e3).toFixed(1)}s`,QEo=(a,i,e,t,o,n)=>{let r=n instanceof Ah?n.test:void 0,s=eHe(r,r?o.capabilitiesForTest(r.item):0);if(s.push(["view","workbench.view.testing"]),r){let p=e.getTestController(r.controllerId),h=!!p&&o.getControllerProfiles(p.id).some(g=>g.supportsContinuousRun&&tM(g,r));s.push([oo.canRefreshTests.key,p&&!!(p.capabilities.get()&2)&&Ur.isRoot(r.item.extId)],[oo.testItemIsHidden.key,e.excluded.contains(r)],[oo.isContinuousModeOn.key,h&&t.isSpecificallyEnabledFor(r.item.extId)],[oo.isParentRunningContinuously.key,h&&t.isEnabledForAParentOf(r.item.extId)],[oo.supportsContinuousRun.key,h],[oo.testResultOutdated.key,n.retired],[oo.testResultState.key,_Mt[n.state]])}let l=a.createOverlay(s),c=i.getMenuActions(D.TestItem,l,{shouldForwardArgs:!0});return{actions:ml(c,"inline"),contextOverlay:l}};is((a,i)=>{if(a.type==="dark"){let e=a.getColor(To);if(e){let t=new We(new zt(e.rgba.r,e.rgba.g,e.rgba.b,.65));i.addRule(`.test-explorer .test-explorer-messages { color: ${t}; }`)}}});var Ive=class extends x{constructor(e,t,o,n){super();this.configurationService=o;this.viewsService=n;this._register(e.onResultsChanged(s=>{"started"in s&&this.attachAutoOpenForNewResults(s.started)}));let r=be(s=>{t.selected.read(s)&&(r.dispose(),une.register())});this._register(r)}static{this.ID="workbench.contrib.testing.progressTrigger"}attachAutoOpenForNewResults(e){if(e.request.preserveFocus===!0)return;let t=em(this.configurationService,"testing.automaticallyOpenTestResults");if(t==="neverOpen")return;if(t==="openExplorerOnTestStart")return this.openExplorerView();if(t==="openOnTestStart")return this.openResultsView();let o=new N;o.add(e.onComplete(()=>o.dispose())),o.add(e.onChange(n=>{n.reason===1&&Dk(n.item.ownComputedState)&&(this.openResultsView(),o.dispose())}))}openExplorerView(){this.viewsService.openView("workbench.view.testing",!1)}openResultsView(){this.viewsService.openView("workbench.panel.testResults.view",!1)}};Ive=I([m(0,pd),m(1,oC),m(2,B),m(3,$t)],Ive);var xHe=class extends Dc{constructor(i,e,t,o,n,r,s,l,c,u,p){super("workbench.view.extension.test",{mergeViewWithContainerWhenSingleView:!0},t,s,i,o,e,l,n,r,c,u,p)}create(i){super.create(i),i.classList.add("testing-view-pane")}getOptimalWidth(){return 400}getTitle(){return d(15952,null)}};xHe=I([m(0,yi),m(1,Te),m(2,F),m(3,Xe),m(4,Le),m(5,ce),m(6,B),m(7,lt),m(8,Pe),m(9,Bi),m(10,se)],xHe);Ee(Ws,GBe,1);Ee(xNt,xDe,1);Ee(uu,wDe,1);Ee(oC,UBe,1);Ee(jM,$Be,1);Ee(pd,kDe,1);Ee(UW,zBe,1);Ee(pL,xne,1);Ee(lat,SHe,1);var upn=ne.as(Mn.ViewContainersRegistry).registerViewContainer({id:"workbench.view.extension.test",title:L(15891,"Testing"),ctorDescriptor:new Ft(xHe),icon:QBe,alwaysUseContainerInfo:!0,order:6,openCommandActionDescriptor:{id:"workbench.view.extension.test",mnemonicTitle:d(15888,null),order:4},hideIfEmpty:!0},0),ppn=ne.as(Mn.ViewContainersRegistry).registerViewContainer({id:"workbench.panel.testResults",title:L(15894,"Test Results"),icon:yOi,ctorDescriptor:new Ft(Dc,["workbench.panel.testResults",{mergeViewWithContainerWhenSingleView:!0}]),hideIfEmpty:!0,order:3},1,{doNotRegisterOpenCommand:!0}),G5t=ne.as(Mn.ViewsRegistry);G5t.registerViews([{id:"workbench.panel.testResults.view",name:L(15894,"Test Results"),containerIcon:yOi,canToggleVisibility:!1,canMoveView:!0,when:oo.hasAnyResults.isEqualTo(!0),ctorDescriptor:new Ft(bHe)}],ppn);G5t.registerViewWelcomeContent("workbench.view.testing",{content:d(15889,null)});G5t.registerViewWelcomeContent("workbench.view.testing",{content:"["+d(15890,null)+"](command:testing.searchForTestExtension)",order:10});G5t.registerViews([{id:"workbench.view.testing",name:L(15893,"Test Explorer"),ctorDescriptor:new Ft(CHe),canToggleVisibility:!0,canMoveView:!0,weight:80,order:-999,containerIcon:QBe,when:C.greater(oo.providerCount.key,0)},{id:"workbench.view.testCoverage",name:L(15892,"Test Coverage"),ctorDescriptor:new Ft(XBe),canToggleVisibility:!0,canMoveView:!0,weight:80,order:-998,containerIcon:QBe,when:oo.isTestCoverageOpen}],upn);gEo.forEach(W);W(V5t);W(F5t);W(O5t);W(A5t);W(B5t);W(W5t);It(dve.ID,dve,St.AfterRestored);It(xne.ID,xne,St.Eventually);It(Ive.ID,Ive,St.Eventually);It(ave.ID,ave,St.Eventually);xo("editor.contrib.testingOutputPeek",Gb,1);xo("editor.contrib.testingDecorations",AN,1);xo("editor.contrib.coverageDecorations",pne,3);$e.registerCommand({id:"_revealTestInExplorer",handler:async(a,i,e)=>{a.get(UW).reveal.set(typeof i=="string"?i:i.extId,void 0),a.get($t).openView("workbench.view.testing",e)}});$e.registerCommand({id:"testing.startContinuousRunFromExtension",handler:async(a,i,e)=>{let t=a.get(uu),o=a.get(Ws).collection,n=t.getControllerProfiles(i.controllerId).find(s=>s.profileId===i.profileId);if(!n?.supportsContinuousRun)return;let r=a.get(jM);for(let s of e){let l=o.getNodeById(s.extId);l&&tM(n,l)&&r.start([n],l.item.extId)}}});$e.registerCommand({id:"testing.stopContinuousRunFromExtension",handler:async(a,i)=>{let e=a.get(jM);for(let t of i)e.stop(t.extId)}});$e.registerCommand({id:"vscode.peekTestError",handler:async(a,i)=>{let e=a.get(pd).getStateById(i);if(!e)return!1;let[t,o]=e,n=a.get(pL);if(n.tryPeekFirstError(t,o))return!0;for(let r of t.tests)if(Ur.compare(o.item.extId,r.item.extId)===2&&n.tryPeekFirstError(t,r))return!0;return!1}});$e.registerCommand({id:"vscode.revealTest",handler:async(a,i,e)=>{let t=a.get(Ws).collection.getNodeById(i);if(!t)return;let o=a.get(ge),n=a.get(fe),r=a.get(Je),{range:s,uri:l}=t.item;if(!l)return;let c=a.get(lat).getDecoratedTestPosition(l,i)||s?.getStartPosition();a.get(UW).reveal.set(i,void 0),a.get(pL).closeAllPeeks();let u=!0;try{(await n.stat(l)).isFile||(u=!1)}catch{}if(!u){await o.executeCommand(lW,l);return}await r.open(c?l.with({fragment:`L${c.lineNumber}:${c.column}`}):l,{openToSide:e?.openToSide,editorOptions:{preserveFocus:e?.preserveFocus}})}});$e.registerCommand({id:"vscode.runTestsById",handler:async(a,i,...e)=>{let t=a.get(Ws);await Tat(a.get(Ws).collection,a.get(Fo),e,o=>t.runTests({group:i,tests:o}))}});$e.registerCommand({id:"vscode.testing.getControllersWithTests",handler:async a=>[...a.get(Ws).collection.rootItems].filter(e=>e.children.size>0).map(e=>e.controllerId)});$e.registerCommand({id:"vscode.testing.getTestsInFile",handler:async(a,i)=>[...a.get(Ws).collection.getNodeByUrl(i)].map(t=>Ur.split(t.item.extId))});ne.as(Jt.Configuration).registerConfiguration(Cko);var Pq=class extends it{constructor(e,t,o,n,r,s){super(e,t);this.quickInputService=o;this.loggerService=n;this.outputService=r;this.defaultLogLevelsService=s}static{this.ID="workbench.action.setLogLevel"}static{this.TITLE=L(11561,"Set Log Level...")}async run(){let e=await this.selectLogLevelOrChannel();e!==null&&(o7(e)?this.loggerService.setLogLevel(e):await this.setLogLevelForChannel(e))}async selectLogLevelOrChannel(){let e=this.defaultLogLevelsService.defaultLogLevels,t=[],o=[],n=this.loggerService.getLogLevel();for(let s of this.outputService.getChannelDescriptors()){if(!this.outputService.canSetLogLevel(s))continue;let l=CA(s)?[s.source]:UB(s)?s.source:[];if(!l.length)continue;let c=l.reduce((p,h)=>Math.min(p,this.loggerService.getLogLevel(h.resource)??n),n),u={id:s.id,label:s.label,description:c!==n?this.getLabel(c):void 0,channel:s};s.extensionId?t.push(u):o.push(u)}let r=[];return r.push({type:"separator",label:d(11549,null)}),r.push(...this.getLogLevelEntries(e.default,this.loggerService.getLogLevel(),!0)),t.length&&(r.push({type:"separator",label:d(11552,null)}),r.push(...t.sort((s,l)=>s.label.localeCompare(l.label)))),r.push({type:"separator",label:d(11554,null)}),r.push(...o.sort((s,l)=>s.label.localeCompare(l.label))),new Promise((s,l)=>{let c=new N,u=c.add(this.quickInputService.createQuickPick({useSeparators:!0}));u.placeholder=d(11557,null),u.items=r;let p;c.add(u.onDidTriggerItemButton(h=>{u.hide(),this.defaultLogLevelsService.setDefaultLogLevel(h.item.level)})),c.add(u.onDidAccept(h=>{p=u.selectedItems[0],u.hide()})),c.add(u.onDidHide(()=>{let h=p?p.level??p:null;c.dispose(),s(h)})),u.show()})}async setLogLevelForChannel(e){let t=this.defaultLogLevelsService.defaultLogLevels,o=t.extensions.find(r=>r[0]===e.channel.extensionId?.toLowerCase())?.[1]??t.default,n=this.getLogLevelEntries(o,this.outputService.getLogLevel(e.channel)??o,!!e.channel.extensionId);return new Promise((r,s)=>{let l=new N,c=l.add(this.quickInputService.createQuickPick());c.placeholder=e?d(11559,null,e?.label):d(11558,null),c.items=n,c.activeItems=n.filter(p=>p.level===this.loggerService.getLogLevel());let u;l.add(c.onDidTriggerItemButton(p=>{c.hide(),this.defaultLogLevelsService.setDefaultLogLevel(p.item.level,e.channel.extensionId)})),l.add(c.onDidAccept(p=>{u=c.selectedItems[0],c.hide()})),l.add(c.onDidHide(()=>{u&&this.outputService.setLogLevel(e.channel,u.level),l.dispose(),r()})),c.show()})}getLogLevelEntries(e,t,o){let n=o?{iconClass:q.asClassName(R.checkAll),tooltip:d(11556,null)}:void 0;return[{label:this.getLabel(1,t),level:1,description:this.getDescription(1,e),buttons:n&&e!==1?[n]:void 0},{label:this.getLabel(2,t),level:2,description:this.getDescription(2,e),buttons:n&&e!==2?[n]:void 0},{label:this.getLabel(3,t),level:3,description:this.getDescription(3,e),buttons:n&&e!==3?[n]:void 0},{label:this.getLabel(4,t),level:4,description:this.getDescription(4,e),buttons:n&&e!==4?[n]:void 0},{label:this.getLabel(5,t),level:5,description:this.getDescription(5,e),buttons:n&&e!==5?[n]:void 0},{label:this.getLabel(0,t),level:0,description:this.getDescription(0,e),buttons:n&&e!==0?[n]:void 0}]}getLabel(e,t){let o=Q$e(e).value;return e===t?`$(check) ${o}`:o}getDescription(e,t){return t===e?d(11551,null):void 0}};Pq=I([m(2,Ue),m(3,Il),m(4,kl),m(5,zD)],Pq);var q5t=class extends it{constructor(e,t,o,n,r,s){super(e,t);this.environmentService=o;this.fileService=n;this.quickInputService=r;this.editorService=s}static{this.ID="workbench.action.openSessionLogFile"}static{this.TITLE=L(11555,"Open Window Log File (Session)...")}async run(){let e=await this.quickInputService.pick(this.getSessions().then(t=>t.map((o,n)=>({id:o.toString(),label:He(o),description:n===0?d(11550,null):void 0}))),{canPickMany:!1,placeHolder:d(11560,null)});if(e){let t=await this.quickInputService.pick(this.getLogFiles(A.parse(e.id)).then(o=>o.map(n=>({id:n.toString(),label:He(n)}))),{canPickMany:!1,placeHolder:d(11553,null)});if(t)return this.editorService.openEditor({resource:A.parse(t.id),options:{pinned:!0}}).then(()=>{})}}async getSessions(){let e=this.environmentService.logsHome.with({scheme:this.environmentService.logFile.scheme}),t=[e],o=await this.fileService.resolve(ci(e));return o.children&&t.push(...o.children.filter(n=>!Qe(n.resource,e)&&n.isDirectory&&/^\d{8}T\d{6}$/.test(n.name)).sort().reverse().map(n=>n.resource)),t}async getLogFiles(e){let t=await this.fileService.resolve(e);return t.children?t.children.filter(o=>!o.isDirectory).map(o=>o.resource):[]}};q5t=I([m(2,At),m(3,fe),m(4,Ue),m(5,ee)],q5t);W(class extends K{constructor(){super({id:Pq.ID,title:Pq.TITLE,category:Ve.Developer,f1:!0})}run(a){let i=a.get(F).createInstance(Pq,Pq.ID,Pq.TITLE.value);return i.run().finally(()=>i.dispose())}});W(class extends K{constructor(){super({id:"workbench.action.setDefaultLogLevel",title:L(11547,"Set Default Log Level"),category:Ve.Developer})}run(a,i,e){return a.get(zD).setDefaultLogLevel(i,e)}});var ilt=class extends x{constructor(e,t,o){super();this.loggerService=e;this.contextKeyService=t;this.uriIdentityService=o;this.contextKeys=new WSe;this.outputChannelRegistry=ne.as(Hv.OutputChannels);let n=k$i.bindTo(t);n.set(IC(e.getLogLevel())),this._register(e.onDidChangeLogLevel(r=>{o7(r)&&n.set(IC(e.getLogLevel()))})),this.onDidAddLoggers(e.getRegisteredLoggers()),this._register(e.onDidChangeLoggers(({added:r,removed:s})=>{this.onDidAddLoggers(r),this.onDidRemoveLoggers(s)})),this._register(e.onDidChangeVisibility(([r,s])=>{let l=e.getRegisteredLogger(r);l&&(s?this.registerLogChannel(l):this.deregisterLogChannel(l))})),this.registerShowWindowLogAction(),this._register(U.filter(t.onDidChangeContext,r=>r.affectsSome(this.contextKeys))(()=>this.onDidChangeContext()))}onDidAddLoggers(e){for(let t of e){if(t.when){let o=C.deserialize(t.when);if(o){for(let n of o.keys())this.contextKeys.add(n);if(!this.contextKeyService.contextMatchesRules(o))continue}}t.hidden||this.registerLogChannel(t)}}onDidChangeContext(){for(let e of this.loggerService.getRegisteredLoggers())e.when&&(this.contextKeyService.contextMatchesRules(C.deserialize(e.when))?this.registerLogChannel(e):this.deregisterLogChannel(e))}onDidRemoveLoggers(e){for(let t of e){if(t.when){let o=C.deserialize(t.when);if(o)for(let n of o.keys())this.contextKeys.delete(n)}this.deregisterLogChannel(t)}}registerLogChannel(e){if(e.group){this.registerCompoundLogChannel(e.group.id,e.group.name,e);return}let t=this.outputChannelRegistry.getChannel(e.id);if(t&&CA(t)&&this.uriIdentityService.extUri.isEqual(t.source.resource,e.resource))return;let o=this.outputChannelRegistry.getChannel(e.id),n=o&&CA(o)&&o.source.resource.scheme===Q.vscodeRemote?this.loggerService.getRegisteredLogger(o.source.resource):void 0;n&&this.deregisterLogChannel(n);let r=o&&e.resource.scheme===Q.vscodeRemote,s=r?`${e.id}.remote`:e.id,l=r?d(11546,null,e.name??e.id):e.name??e.id;this.outputChannelRegistry.registerChannel({id:s,label:l,source:{resource:e.resource},log:!0,extensionId:e.extensionId})}registerCompoundLogChannel(e,t,o){let n=this.outputChannelRegistry.getChannel(e),r={resource:o.resource,name:o.name??o.id};n?UB(n)&&!n.source.some(({resource:s})=>this.uriIdentityService.extUri.isEqual(s,o.resource))&&this.outputChannelRegistry.updateChannelSources(e,[...n.source,r]):this.outputChannelRegistry.registerChannel({id:e,label:t,log:!0,source:[r]})}deregisterLogChannel(e){if(e.group){let t=this.outputChannelRegistry.getChannel(e.group.id);t&&UB(t)&&this.outputChannelRegistry.updateChannelSources(e.group.id,t.source.filter(({resource:o})=>!this.uriIdentityService.extUri.isEqual(o,e.resource)))}else this.outputChannelRegistry.removeChannel(e.id)}registerShowWindowLogAction(){this._register(W(class extends K{constructor(){super({id:T2,title:L(11548,"Show Window Log"),category:Ve.Developer,f1:!0})}async run(t){t.get(kl).showChannel(_pe)}}))}};ilt=I([m(0,Il),m(1,X),m(2,ht)],ilt);ne.as(Qi.Workbench).registerWorkbenchContribution(ilt,3);var zW=class{constructor(i,e,t){this.quickInputService=i;this.keybindingService=e;this.contextKeyService=t;this.registry=ne.as(Ku.Quickaccess)}static{this.PREFIX="?"}provide(i){let e=new N;return e.add(i.onDidAccept(()=>{let[t]=i.selectedItems;t&&this.quickInputService.quickAccess.show(t.prefix,{preserveValue:!0})})),e.add(i.onDidChangeValue(t=>{let o=this.registry.getQuickAccessProvider(t.substr(zW.PREFIX.length),this.contextKeyService);o?.prefix&&o.prefix!==zW.PREFIX&&this.quickInputService.quickAccess.show(o.prefix,{preserveValue:!0})})),i.items=this.getQuickAccessProviders().filter(t=>t.prefix!==zW.PREFIX),e}getQuickAccessProviders(){return this.registry.getQuickAccessProviders(this.contextKeyService).sort((e,t)=>e.prefix.localeCompare(t.prefix)).flatMap(e=>this.createPicks(e))}createPicks(i){return i.helpEntries.map(e=>{let t=e.prefix||i.prefix,o=t||"\u2026";return{prefix:t,label:o,keybinding:e.commandId?this.keybindingService.lookupKeybinding(e.commandId):void 0,ariaLabel:d(2294,null,o,e.description),description:e.description}})}};zW=I([m(0,Ue),m(1,_e),m(2,X)],zW);var RU=class extends Lh{constructor(e,t,o,n,r,s,l,c){super(RU.PREFIX,{noResultsPick:{label:d(13332,null),containerLabel:""}});this.viewDescriptorService=e;this.viewsService=t;this.outputService=o;this.terminalService=n;this.terminalGroupService=r;this.debugService=s;this.paneCompositeService=l;this.contextKeyService=c}static{this.PREFIX="view "}_getPicks(e){let t=this.doGetViewPickItems().filter(s=>e?(s.highlights={label:lm(e,s.label,!0)??void 0},s.highlights.label||S$e(s.containerLabel,e)):!0),o=new Map;for(let s of t)o.has(s.label)||o.set(s.label,s.containerLabel);let n=[],r;for(let s of t){if(r!==s.containerLabel){r=s.containerLabel;let l;o.has(r)?l=`${o.get(r)} / ${r}`:l=r,n.push({type:"separator",label:l})}n.push(s)}return n}doGetViewPickItems(){let e=[],t=(s,l)=>{let c=this.viewDescriptorService.getViewContainerModel(l),u=[];for(let p of c.allViewDescriptors)this.contextKeyService.contextMatchesRules(p.when)&&u.push({label:p.name.value,containerLabel:c.title,accept:()=>this.viewsService.openView(p.id,!0)});return u},o=(s,l)=>{let c=this.paneCompositeService.getPaneComposites(s),u=this.paneCompositeService.getVisiblePaneCompositeIds(s);c.sort((p,h)=>{let g=u.findIndex(v=>p.id===v),f=u.findIndex(v=>h.id===v);return g<0&&(g=c.indexOf(p)+u.length),f<0&&(f=c.indexOf(h)+u.length),g-f});for(let p of c)if(this.includeViewContainer(p)){let h=this.viewDescriptorService.getViewContainerById(p.id);h&&e.push({label:this.viewDescriptorService.getViewContainerModel(h).title,containerLabel:l,accept:()=>this.paneCompositeService.openPaneComposite(p.id,s,!0)})}};o(0,d(13339,null)),o(1,d(13334,null)),o(2,d(13336,null));let n=s=>{let l=this.paneCompositeService.getPaneComposites(s);for(let c of l){let u=this.viewDescriptorService.getViewContainerById(c.id);u&&e.push(...t(c,u))}};n(0),n(1),n(2),this.terminalGroupService.groups.forEach((s,l)=>{s.terminalInstances.forEach((c,u)=>{let p=d(13338,null,`${l+1}.${u+1}`,c.title);e.push({label:p,containerLabel:d(13337,null),accept:async()=>{await this.terminalGroupService.showPanel(!0),this.terminalService.setActiveInstance(c)}})})}),this.debugService.getModel().getSessions(!0).filter(s=>s.hasSeparateRepl()).forEach((s,l)=>{let c=s.name;e.push({label:c,containerLabel:d(13331,null),accept:async()=>{await this.debugService.focusStackFrame(void 0,void 0,s,{explicit:!0}),this.viewsService.isViewVisible(Td)||await this.viewsService.openView(Td,!0)}})});let r=this.outputService.getChannelDescriptors();for(let s of r)e.push({label:s.label,containerLabel:d(13330,null),accept:()=>this.outputService.showChannel(s.id)});return e}includeViewContainer(e){let t=this.viewDescriptorService.getViewContainerById(e.id);return t?.hideIfEmpty?this.viewDescriptorService.getViewContainerModel(t).activeViewDescriptors.length>0:!0}};RU=I([m(0,Bi),m(1,$t),m(2,kl),m(3,nn),m(4,lc),m(5,Ni),m(6,us),m(7,X)],RU);var kHe=class a extends K{static{this.ID="workbench.action.openView"}constructor(){super({id:a.ID,title:L(13333,"Open View"),category:Ve.View,f1:!0})}async run(i){i.get(Ue).quickAccess.show(RU.PREFIX)}},olt=class a extends K{static{this.ID="workbench.action.quickOpenView"}static{this.KEYBINDING={primary:2095,mac:{primary:303},linux:{primary:0}}}constructor(){super({id:a.ID,title:L(13335,"Quick Open View"),category:Ve.View,f1:!1,keybinding:{weight:200,when:void 0,...a.KEYBINDING}})}async run(i){let e=i.get(_e),t=i.get(Ue),o=e.lookupKeybindings(a.ID);t.quickAccess.show(RU.PREFIX,{quickNavigateConfiguration:{keybindings:o},itemActivation:1})}};var KW=class extends Lh{constructor(e,t,o,n,r,s){super(KW.PREFIX,e);this.keybindingService=o;this.commandService=n;this.telemetryService=r;this.dialogService=s;this.commandsHistory=this._register(t.createInstance(qd)),this.options=e}static{this.PREFIX=">"}static{this.TFIDF_THRESHOLD=.5}static{this.TFIDF_MAX_RESULTS=5}static{this.WORD_FILTER=VO(aY,dw)}async _getPicks(e,t,o,n){let r=await this.getCommandPicks(o);if(o.isCancellationRequested)return[];let s=$c(()=>{let f=new rPe;f.updateDocuments(r.map(b=>({key:b.commandId,textChunks:[this.getTfIdfChunk(b)]})));let v=f.calculateScores(e,o);return amo(v).filter(b=>b.score>KW.TFIDF_THRESHOLD).slice(0,KW.TFIDF_MAX_RESULTS)}),l=[];for(let f of r){let v=KW.WORD_FILTER(e,f.label)??void 0,b;if(f.commandAlias&&(b=KW.WORD_FILTER(e,f.commandAlias)??void 0),v||b)f.highlights={label:v,detail:this.options.showAlias?b:void 0},l.push(f);else if(e===f.commandId)l.push(f);else if(e.length>=3){let S=s();if(o.isCancellationRequested)return[];let y=S.find(w=>w.key===f.commandId);y&&(f.tfIdfScore=y.score,l.push(f))}}let c=new Map;for(let f of l){let v=c.get(f.label);v?(f.description=f.commandId,v.description=v.commandId):c.set(f.label,f)}l.sort((f,v)=>{if(f.tfIdfScore&&v.tfIdfScore)return f.tfIdfScore===v.tfIdfScore?f.label.localeCompare(v.label):v.tfIdfScore-f.tfIdfScore;if(f.tfIdfScore)return 1;if(v.tfIdfScore)return-1;let b=this.commandsHistory.peek(f.commandId),S=this.commandsHistory.peek(v.commandId);if(b&&S)return b>S?-1:1;if(b)return-1;if(S)return 1;if(this.options.suggestedCommandIds){let k=this.options.suggestedCommandIds.has(f.commandId),T=this.options.suggestedCommandIds.has(v.commandId);if(k&&T)return 0;if(k)return-1;if(T)return 1}let y=f.commandCategory===Ve.Developer.value,w=v.commandCategory===Ve.Developer.value;return y&&!w?1:!y&&w?-1:f.label.localeCompare(v.label)});let u=[],p=!1,h=!0,g=!!this.options.suggestedCommandIds;for(let f=0;f<l.length;f++){let v=l[f],b=!!this.commandsHistory.peek(v.commandId);f===0&&b&&(u.push({type:"separator",label:d(2291,null)}),p=!0),h&&v.tfIdfScore!==void 0&&(u.push({type:"separator",label:d(2293,null)}),h=!1),g&&v.tfIdfScore===void 0&&!b&&this.options.suggestedCommandIds?.has(v.commandId)&&(u.push({type:"separator",label:d(2289,null)}),p=!0,g=!1),p&&v.tfIdfScore===void 0&&!b&&!this.options.suggestedCommandIds?.has(v.commandId)&&(u.push({type:"separator",label:d(2290,null)}),p=!1),u.push(this.toCommandPick(v,n,b))}return this.hasAdditionalCommandPicks(e,o)?{picks:u,additionalPicks:(async()=>{let f=await this.getAdditionalCommandPicks(r,l,e,o);if(o.isCancellationRequested)return[];let v=f.map(b=>this.toCommandPick(b,n));return h&&v[0]?.type!=="separator"&&v.unshift({type:"separator",label:d(2293,null)}),v})()}:u}toCommandPick(e,t,o=!1){if(e.type==="separator")return e;let n=e.tooltip??e.commandDescription?.value,r=this.keybindingService.lookupKeybinding(e.commandId),s=r?d(2288,null,e.label,r.getAriaLabel()):e.label,l=e.buttons||[],c=o?[...l,{iconClass:q.asClassName(R.close),tooltip:d(2292,null)}]:e.buttons;return{...e,tooltip:n,ariaLabel:s,detail:this.options.showAlias&&e.commandAlias!==e.label?e.commandAlias:void 0,keybinding:r,buttons:c,accept:async()=>{this.commandsHistory.push(e.commandId),this.telemetryService.publicLog2("workbenchActionExecuted",{id:e.commandId,from:t?.from??"quick open"});try{e.args?.length?await this.commandService.executeCommand(e.commandId,...e.args):await this.commandService.executeCommand(e.commandId)}catch(u){ao(u)||this.dialogService.error(d(2287,null,e.label),xn(u))}},trigger:o?(u,p)=>{let h=l.length;return u===h?(this.commandsHistory.remove(e.commandId),3):e.trigger?e.trigger(u,p):0}:e.trigger}}getTfIdfChunk({label:e,commandAlias:t,commandDescription:o}){let n=e;return t&&t!==e&&(n+=` - ${t}`),o&&o.value!==e&&(n+=` - ${o.value===o.original?o.value:`${o.value} (${o.original})`}`),n}};KW=I([m(1,F),m(2,_e),m(3,ge),m(4,Te),m(5,at)],KW);var qd=class extends x{constructor(e,t,o){super();this.storageService=e;this.configurationService=t;this.logService=o;this.configuredCommandsHistoryLength=0;this.updateConfiguration(),this.load(),this.registerListeners()}static{this.DEFAULT_COMMANDS_HISTORY_LENGTH=50}static{this.PREF_KEY_CACHE="commandPalette.mru.cache"}static{this.PREF_KEY_COUNTER="commandPalette.mru.counter"}static{this.counter=1}static{this.hasChanges=!1}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>this.updateConfiguration(e))),this._register(this.storageService.onWillSaveState(e=>{e.reason===1&&this.saveState()}))}updateConfiguration(e){e&&!e.affectsConfiguration("workbench.commandPalette.history")||(this.configuredCommandsHistoryLength=qd.getConfiguredCommandHistoryLength(this.configurationService),qd.cache&&qd.cache.limit!==this.configuredCommandsHistoryLength&&(qd.cache.limit=this.configuredCommandsHistoryLength,qd.hasChanges=!0))}load(){let e=this.storageService.get(qd.PREF_KEY_CACHE,0),t;if(e)try{t=JSON.parse(e)}catch(n){this.logService.error(`[CommandsHistory] invalid data: ${n}`)}let o=qd.cache=new dl(this.configuredCommandsHistoryLength,1);if(t){let n;t.usesLRU?n=t.entries:n=t.entries.sort((r,s)=>r.value-s.value),n.forEach(r=>o.set(r.key,r.value))}qd.counter=this.storageService.getNumber(qd.PREF_KEY_COUNTER,0,qd.counter)}push(e){qd.cache&&(qd.cache.set(e,qd.counter++),qd.hasChanges=!0)}peek(e){return qd.cache?.peek(e)}remove(e){qd.cache&&(qd.cache.delete(e),qd.hasChanges=!0)}saveState(){if(!qd.cache||!qd.hasChanges)return;let e={usesLRU:!0,entries:[]};qd.cache.forEach((t,o)=>e.entries.push({key:o,value:t})),this.storageService.store(qd.PREF_KEY_CACHE,JSON.stringify(e),0,0),this.storageService.store(qd.PREF_KEY_COUNTER,qd.counter,0,0),qd.hasChanges=!1}static getConfiguredCommandHistoryLength(e){let o=e.getValue().workbench?.commandPalette?.history;return typeof o=="number"?o:qd.DEFAULT_COMMANDS_HISTORY_LENGTH}static clearHistory(e,t){let o=qd.getConfiguredCommandHistoryLength(e);qd.cache=new dl(o),qd.counter=1,qd.hasChanges=!0}};qd=I([m(0,ce),m(1,B),m(2,se)],qd);var $5t=class extends KW{constructor(i,e,t,o,n,r){super(i,e,t,o,n,r)}getCodeEditorCommandPicks(){let i=this.activeTextEditorControl;if(!i)return[];let e=[];for(let t of i.getSupportedActions()){let o;t.metadata?.description&&(Qj(t.metadata.description)?o=t.metadata.description:o={original:t.metadata.description,value:t.metadata.description}),e.push({commandId:t.id,commandAlias:t.alias,commandDescription:o,label:Nu(t.label)||t.id})}return e}};var MU=class extends $5t{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super({showAlias:!US.isDefaultVariant(),noResultsPick:()=>({label:d(13316,null),commandId:""})},n,r,s,l,c);this.editorService=e;this.menuService=t;this.configurationService=u;this.editorGroupService=p;this.preferencesService=h;this.productService=g;this.aiRelatedInformationService=f;this.chatAgentService=v;this.useAiRelatedInfo=!1;this.extensionRegistrationRace=vp(o.whenInstalledExtensionsRegistered(),800),this._register(u.onDidChangeConfiguration(b=>this.updateOptions(b))),this.updateOptions()}static{this.AI_RELATED_INFORMATION_MAX_PICKS=5}static{this.AI_RELATED_INFORMATION_DEBOUNCE=200}get activeTextEditorControl(){return this.editorService.activeTextEditorControl}get defaultFilterValue(){if(this.configuration.preserveInput)return 1}get configuration(){let e=this.configurationService.getValue().workbench.commandPalette;return{preserveInput:e.preserveInput,showAskInChat:e.showAskInChat,experimental:e.experimental}}updateOptions(e){if(e&&!e.affectsConfiguration("workbench.commandPalette.experimental"))return;let t=this.configuration,o=t.experimental.suggestCommands&&this.productService.commandPaletteSuggestedCommandIds?.length?new Set(this.productService.commandPaletteSuggestedCommandIds):void 0;this.options.suggestedCommandIds=o,this.useAiRelatedInfo=t.experimental.enableNaturalLanguageSearch}async getCommandPicks(e){return await this.extensionRegistrationRace,e.isCancellationRequested?[]:[...this.getCodeEditorCommandPicks(),...this.getGlobalCommandPicks()].map(t=>({...t,buttons:[{iconClass:q.asClassName(R.gear),tooltip:d(13313,null)}],trigger:()=>(this.preferencesService.openGlobalKeybindingSettings(!1,{query:mdo(t.commandId,t.commandWhen)}),1)}))}hasAdditionalCommandPicks(e,t){return!(!this.useAiRelatedInfo||t.isCancellationRequested||e===""||!this.aiRelatedInformationService.isEnabled())}async getAdditionalCommandPicks(e,t,o,n){if(!this.hasAdditionalCommandPicks(o,n))return[];let r=[];try{await Li(MU.AI_RELATED_INFORMATION_DEBOUNCE,n),r=await this.getRelatedInformationPicks(e,t,o,n)}catch{}return this.configuration.showAskInChat&&this.chatAgentService.getDefaultAgent("panel")&&((t.length||r.length)&&r.push({type:"separator"}),r.push({label:d(13310,null,o),commandId:this.configuration.experimental.askChatLocation==="quickChat"?xrt:lx,args:[o],buttons:[{iconClass:q.asClassName(R.gear),tooltip:d(13311,null)}],trigger:()=>(this.preferencesService.openSettings({jsonEditor:!1,query:"workbench.commandPalette.showAskInChat"}),1)})),r}async getRelatedInformationPicks(e,t,o,n){let r=await this.aiRelatedInformationService.getRelatedInformation(o,[2],n);r.sort((c,u)=>u.weight-c.weight);let s=new Set(t.map(c=>c.commandId)),l=new Array;for(let c of r){if(l.length===MU.AI_RELATED_INFORMATION_MAX_PICKS)break;let u=e.find(p=>p.commandId===c.command&&!s.has(p.commandId));u&&l.push(u)}return l}getGlobalCommandPicks(){let e=[],t=this.editorService.activeEditorPane?.scopedContextKeyService||this.editorGroupService.activeGroup.scopedContextKeyService,n=this.menuService.getMenuActions(D.CommandPalette,t).reduce((r,[,s])=>[...r,...s],[]).filter(r=>r instanceof Lo&&r.enabled);for(let r of n){let s=(typeof r.item.title=="string"?r.item.title:r.item.title.value)||r.item.id,l=typeof r.item.category=="string"?r.item.category:r.item.category?.value;l&&(s=d(13312,null,l,s));let c=typeof r.item.title!="string"?r.item.title.original:void 0,u=l&&r.item.category&&typeof r.item.category!="string"?r.item.category.original:void 0,p=c&&l?u?`${u}: ${c}`:`${l}: ${c}`:c,h=r.item.metadata?.description,g=h===void 0||Qj(h)?h:{value:h,original:h};e.push({commandId:r.item.id,commandWhen:r.item.precondition?.serialize(),commandAlias:p,label:Nu(s),commandDescription:g,commandCategory:l})}return e}};MU=I([m(0,ee),m(1,Kt),m(2,lt),m(3,F),m(4,_e),m(5,ge),m(6,Te),m(7,at),m(8,B),m(9,wt),m(10,Go),m(11,tt),m(12,TDe),m(13,cr)],MU);var b6=class a extends K{static{this.ID="workbench.action.showCommands"}constructor(){super({id:a.ID,title:L(13317,"Show All Commands"),keybinding:{weight:200,when:void 0,primary:Ac?void 0:3118,secondary:[59]},f1:!0})}async run(i){i.get(Ue).quickAccess.show(MU.PREFIX)}},j5t=class extends K{constructor(){super({id:"workbench.action.clearCommandHistory",title:L(13309,"Clear Command History"),f1:!0})}async run(i){let e=i.get(B),t=i.get(ce),o=i.get(at);if(qd.getConfiguredCommandHistoryLength(e)>0){let{confirmed:r}=await o.confirm({type:"warning",message:d(13315,null),detail:d(13314,null),primaryButton:d(13308,null)});if(!r)return;qd.clearHistory(e,t)}}};var YFi=ne.as(Ku.Quickaccess);YFi.registerQuickAccessProvider({ctor:zW,prefix:zW.PREFIX,placeholder:d(13322,null,zW.PREFIX),helpEntries:[{description:d(13321,null),commandCenterOrder:70,commandCenterLabel:d(13327,null)}]});YFi.registerQuickAccessProvider({ctor:RU,prefix:RU.PREFIX,contextKey:"inViewsPicker",placeholder:d(13329,null),helpEntries:[{description:d(13328,null),commandId:kHe.ID}]});YFi.registerQuickAccessProvider({ctor:MU,prefix:MU.PREFIX,contextKey:"inCommandsPicker",placeholder:d(13320,null),helpEntries:[{description:d(13319,null),commandId:b6.ID,commandCenterOrder:20}]});ve.appendMenuItem(D.MenubarViewMenu,{group:"1_open",command:{id:b6.ID,title:d(13323,null)},order:1});ve.appendMenuItem(D.MenubarHelpMenu,{group:"1_welcome",command:{id:b6.ID,title:d(13326,null)},order:2});ve.appendMenuItem(D.MenubarViewMenu,{group:"1_open",command:{id:kHe.ID,title:d(13325,null)},order:2});ve.appendMenuItem(D.MenubarGoMenu,{group:"5_infile_nav",command:{id:"workbench.action.gotoLine",title:d(13324,null)},order:1});ve.appendMenuItem(D.GlobalActivity,{group:"1_command",command:{id:b6.ID,title:d(13318,null)},order:1});ve.appendMenuItem(D.EditorContext,{group:"z_commands",when:pe.editorSimpleInput.toNegated(),command:{id:b6.ID,title:d(13318,null)},order:1});W(j5t);W(b6);W(kHe);W(olt);var mpn="inViewsPicker",JEo=C.and(TT,C.has(mpn)),EHe=olt.KEYBINDING,YEo="workbench.action.quickOpenNavigateNextInViewPicker";Ct.registerCommandAndKeybindingRule({id:YEo,weight:250,handler:LD(YEo,!0),when:JEo,primary:EHe.primary,linux:EHe.linux,mac:EHe.mac});var XEo="workbench.action.quickOpenNavigatePreviousInViewPicker";Ct.registerCommandAndKeybindingRule({id:XEo,weight:250,handler:LD(XEo,!1),when:JEo,primary:EHe.primary|1024,linux:EHe.linux,mac:{primary:EHe.mac.primary|1024}});var mL=class extends Gs{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super(e,r,s,c,p,o,n,h,t,g);this.contextService=l;this.labelService=u;this._disposed=!1;this._register(this.contextService.onDidChangeWorkbenchState(()=>this.refreshTitle())),this._register(this.labelService.onDidChangeFormatters(()=>this.refreshTitle()))}static{this.ID="workbench.explorer.emptyView"}static{this.NAME=L(11101,"No Folder Opened")}shouldShowWelcome(){return!0}renderBody(e){super.renderBody(e),this._register(new Uh(e,{onDrop:t=>{e.style.backgroundColor="",this.instantiationService.createInstance(a0,{allowWorkspaceOpen:!Wt||gw(this.contextService.getWorkspace())}).handleDrop(t,Re(e))},onDragEnter:()=>{let t=this.themeService.getColorTheme().getColor(zvt);e.style.backgroundColor=t?t.toString():""},onDragEnd:()=>{e.style.backgroundColor=""},onDragLeave:()=>{e.style.backgroundColor=""},onDragOver:t=>{t.dataTransfer&&(t.dataTransfer.dropEffect="copy")}})),this.refreshTitle()}refreshTitle(){this._disposed||(this.contextService.getWorkbenchState()===3?this.updateTitle(mL.NAME.value):this.updateTitle(this.title))}dispose(){this._disposed=!0,super.dispose()}};mL=I([m(1,Le),m(2,Bi),m(3,F),m(4,_e),m(5,Xe),m(6,Pe),m(7,B),m(8,rt),m(9,X),m(10,Je),m(11,nt)],mL);var XFi=Ae("explorer-view-icon",R.files,d(10803,null)),gpn=Ae("open-editors-view-icon",R.book,d(10810,null)),yve=class extends x{constructor(e,t){super();this.workspaceContextService=e;t.withProgress({location:1},()=>e.getCompleteWorkspace()).finally(()=>{this.registerViews(),this._register(e.onDidChangeWorkbenchState(()=>this.registerViews())),this._register(e.onDidChangeWorkspaceFolders(()=>this.registerViews()))})}static{this.ID="workbench.contrib.explorerViewletViews"}registerViews(){Mo("code/willRegisterExplorerViews");let e=_ne.getViews(wve),t=[],o=[],n=this.createOpenEditorsViewDescriptor();e.some(u=>u.id===n.id)||t.push(n);let r=this.createExplorerViewDescriptor(),s=e.find(u=>u.id===r.id),l=this.createEmptyViewDescriptor(),c=e.find(u=>u.id===l.id);this.workspaceContextService.getWorkbenchState()===1||this.workspaceContextService.getWorkspace().folders.length===0?(s&&o.push(s),c||t.push(l)):(c&&o.push(c),s||t.push(r)),o.length&&_ne.deregisterViews(o,wve),t.length&&_ne.registerViews(t,wve),Mo("code/didRegisterExplorerViews")}createOpenEditorsViewDescriptor(){return{id:Zw.ID,name:Zw.NAME,ctorDescriptor:new Ft(Zw),containerIcon:gpn,order:0,canToggleVisibility:!0,canMoveView:!0,collapsed:!1,hideByDefault:!0,focusCommand:{id:"workbench.files.action.focusOpenEditorsView",keybindings:{primary:Vi(2089,35)}}}}createEmptyViewDescriptor(){return{id:mL.ID,name:mL.NAME,containerIcon:XFi,ctorDescriptor:new Ft(mL),order:1,canToggleVisibility:!0,focusCommand:{id:"workbench.explorer.fileView.focus"}}}createExplorerViewDescriptor(){return{id:Fb,name:L(10804,"Folders"),containerIcon:XFi,ctorDescriptor:new Ft(pW),order:1,canMoveView:!0,canToggleVisibility:!1,focusCommand:{id:"workbench.explorer.fileView.focus"}}}};yve=I([m(0,Pe),m(1,Fo)],yve);var nlt=class extends Dc{constructor(i,e,t,o,n,r,s,l,c,u,p,h){super(nv,{mergeViewWithContainerWhenSingleView:!0},r,n,i,c,e,u,l,o,t,p,h),this.viewletVisibleContextKey=rco.bindTo(s),this._register(this.contextService.onDidChangeWorkspaceName(g=>this.updateTitleArea()))}create(i){super.create(i),i.classList.add("explorer-viewlet")}createView(i,e){return i.id===Fb?this.instantiationService.createInstance(pW,{...e,delegate:{willOpenElement:t=>{if(!Ru(t))return;let o=this.getOpenEditorsView();if(o){let n=0;this.configurationService.getValue().workbench?.editor?.enablePreview&&(n=250),o.setStructuralRefreshDelay(n)}},didOpenElement:t=>{if(!Ru(t))return;this.getOpenEditorsView()?.setStructuralRefreshDelay(0)}}}):super.createView(i,e)}getExplorerView(){return this.getView(Fb)}getOpenEditorsView(){return this.getView(Zw.ID)}setVisible(i){this.viewletVisibleContextKey.set(i),super.setVisible(i)}focus(){let i=this.getView(Fb);i&&this.panes.every(e=>!e.isExpanded())&&i.setExpanded(!0),i?.isExpanded()?i.focus():super.focus()}};nlt=I([m(0,yi),m(1,Te),m(2,Pe),m(3,ce),m(4,B),m(5,F),m(6,X),m(7,Le),m(8,Xe),m(9,lt),m(10,Bi),m(11,se)],nlt);var fpn=ne.as(Mn.ViewContainersRegistry),wve=fpn.registerViewContainer({id:nv,title:L(10802,"Explorer"),ctorDescriptor:new Ft(nlt),storageId:"workbench.explorer.views.state",icon:XFi,alwaysUseContainerInfo:!0,hideIfEmpty:!0,order:0,openCommandActionDescriptor:{id:nv,title:L(10802,"Explorer"),mnemonicTitle:d(10805,null),keybindings:{primary:3107},order:0}},0,{isDefault:!0}),JFi=d(10811,null),vpn=d(10801,null),bpn=d(10812,null),Spn=`[${JFi}](command:${fLe.ID})`,Ipn=`[${vpn}](command:${fLe.ID})`,ZFi=`[${JFi}](command:${b0.ID})`,ypn=`[${JFi}](command:${BZ.ID})`,wpn=`[${bpn}](command:${v0.ID})`,_ne=ne.as(Mn.ViewsRegistry);_ne.registerViewWelcomeContent(mL.ID,{content:d(10809,null,Spn),when:C.and(za.isEqualTo("workspace"),RF),group:"2_open",order:1});_ne.registerViewWelcomeContent(mL.ID,{content:d(10808,null,ypn,wpn),when:C.and(za.isEqualTo("workspace"),RF.toNegated()),group:"2_open",order:1});_ne.registerViewWelcomeContent(mL.ID,{content:d(10813,null,ZFi),when:C.and(za.notEqualsTo("workspace"),yb.notEqualsTo(""),Fu.toNegated()),group:"2_open",order:1});_ne.registerViewWelcomeContent(mL.ID,{content:d(10806,null,ZFi,Ipn),when:C.and(C.has("editorIsOpen"),C.or(C.and(za.notEqualsTo("workspace"),yb.isEqualTo("")),C.and(za.notEqualsTo("workspace"),Fu))),group:"2_open",order:1});_ne.registerViewWelcomeContent(mL.ID,{content:d(10807,null,ZFi),when:C.and(C.has("editorIsOpen")?.negate(),C.or(C.and(za.notEqualsTo("workspace"),yb.isEqualTo("")),C.and(za.notEqualsTo("workspace"),Fu))),group:"2_open",order:1});var Cve=class extends x{constructor(e,t,o,n,r,s,l){super();this.editorService=e;this.textFileService=t;this.lifecycleService=o;this.hostService=n;this.codeEditorService=r;this.filesConfigurationService=s;this.workingCopyEditorService=l;this.ensureDirtyFilesAreOpenedWorker=this._register(new pP(e=>this.ensureDirtyTextFilesAreOpened(e),this.getDirtyTextFileTrackerDelay()));this.registerListeners()}static{this.ID="workbench.contrib.textFileEditorTracker"}registerListeners(){this._register(this.textFileService.files.onDidChangeDirty(e=>this.ensureDirtyFilesAreOpenedWorker.work(e.resource))),this._register(this.textFileService.files.onDidSaveError(e=>this.ensureDirtyFilesAreOpenedWorker.work(e.resource))),this._register(this.textFileService.untitled.onDidChangeDirty(e=>this.ensureDirtyFilesAreOpenedWorker.work(e.resource))),this._register(this.hostService.onDidChangeFocus(e=>e?this.reloadVisibleTextFileEditors():void 0)),this._register(this.lifecycleService.onDidShutdown(()=>this.dispose()))}getDirtyTextFileTrackerDelay(){return 800}ensureDirtyTextFilesAreOpened(e){this.doEnsureDirtyTextFilesAreOpened(zo(e.filter(t=>{if(!this.textFileService.isDirty(t))return!1;let o=this.textFileService.files.get(t);if(o?.hasState(2)||t.scheme!==Q.untitled&&!o?.hasState(5)&&this.filesConfigurationService.hasShortAutoSaveDelay(t)||this.editorService.isOpened({resource:t,typeId:t.scheme===Q.untitled?eh.ID:Vpe,editorId:la.id}))return!1;let n=o??this.textFileService.untitled.get(t);return!(n&&this.workingCopyEditorService.findEditor(n))}),t=>t.toString()))}doEnsureDirtyTextFilesAreOpened(e){e.length&&this.editorService.openEditors(e.map(t=>({resource:t,options:{inactive:!0,pinned:!0,preserveFocus:!0}})))}reloadVisibleTextFileEditors(){zo(di(this.codeEditorService.listCodeEditors().map(e=>{let t=e.getModel()?.uri;if(!t)return;let o=this.textFileService.files.get(t);if(!(!o||o.isDirty()||!o.isResolved()))return o})),e=>e.resource.toString()).forEach(e=>this.textFileService.files.resolve(e.resource,{reload:{async:!0}}))}};Cve=I([m(0,ee),m(1,Uo),m(2,ji),m(3,Zt),m(4,qt),m(5,gr),m(6,iv)],Cve);var S6=class extends aM{constructor(e,t,o,n,r){super(S6.ID,e,{openInternal:(s,l)=>this.openInternal(s,l)},t,o,r);this.editorResolverService=n}static{this.ID=FFt}async openInternal(e,t){if(e instanceof wI&&this.group.activeEditor){let o=this.group.activeEditor,n=o?.toUntyped();if(!n)return;let r=await this.editorResolverService.resolveEditor({...n,options:{...t,override:0}},this.group);if(r===2)r=void 0;else if(r===1)return;if(EF(r))for(let s of r.editor instanceof Pa?[r.editor.original,r.editor.modified]:[r.editor])s instanceof wI&&(s.setForceOpenAsText(),s.setPreferredLanguageId(BLe));await this.group.replaceEditors([{editor:o,replacement:r?.editor??e,options:{...r?.options??t}}])}}getTitle(){return this.input?this.input.getName():d(10772,null)}};S6=I([m(1,Te),m(2,Le),m(3,Ka),m(4,ce)],S6);var THe=new iz,Dne=class{constructor(i,e,t,o,n,r,s,l,c,u){this.fileService=i;this.configurationService=e;this.contextService=t;this.clipboardService=o;this.editorService=n;this.uriIdentityService=r;this.bulkEditService=s;this.progressService=l;this.filesConfigurationService=u;this.disposables=new N;this.fileChangeEvents=[];this.config=this.configurationService.getValue("explorer"),this.model=new pzt(this.contextService,this.uriIdentityService,this.fileService,this.configurationService,this.filesConfigurationService),this.disposables.add(this.model),this.disposables.add(this.fileService.onDidRunOperation(p=>this.onDidRunOperation(p))),this.onFileChangesScheduler=this.disposables.add(new Dt(async()=>{let p=this.fileChangeEvents;this.fileChangeEvents=[];let h=[2];this.config.sortOrder==="modified"&&h.push(0);let g=!1;this.roots.forEach(f=>{this.view&&!g&&(g=ZEo(f,this.view,p,h))}),p.forEach(f=>{if(!g)for(let v of f.rawAdded){let b=this.model.findClosest(ci(v));if(b&&!b.getChild(He(v))){g=!0;break}}}),g&&await this.refresh(!1)},Dne.EXPLORER_FILE_CHANGES_REACT_DELAY)),this.disposables.add(this.fileService.onDidFilesChange(p=>{this.fileChangeEvents.push(p),!this.editable&&(this.onFileChangesScheduler.isScheduled()||this.onFileChangesScheduler.schedule())})),this.disposables.add(this.configurationService.onDidChangeConfiguration(p=>this.onConfigurationUpdated(p))),this.disposables.add(U.any(this.fileService.onDidChangeFileSystemProviderRegistrations,this.fileService.onDidChangeFileSystemProviderCapabilities)(async p=>{let h=!1;this.model.roots.forEach(g=>{g.resource.scheme===p.scheme&&(h=!0,g.forgetChildren())}),h&&this.view&&await this.view.setTreeInput()})),this.disposables.add(this.model.onDidChangeRoots(()=>{this.view?.setTreeInput()})),this.disposables.add(c.onDidChangeFocus(p=>{p&&this.refresh(!1)})),this.revealExcludeMatcher=new cI(p=>xpn(e.getValue({resource:p})),p=>p.affectsConfiguration("explorer.autoRevealExclude"),t,e),this.disposables.add(this.revealExcludeMatcher)}static{this.EXPLORER_FILE_CHANGES_REACT_DELAY=500}get roots(){return this.model.roots}get sortOrderConfiguration(){return{sortOrder:this.config.sortOrder,lexicographicOptions:this.config.sortOrderLexicographicOptions,reverse:this.config.sortOrderReverse}}registerView(i){this.view=i}getContext(i,e=!1){if(!this.view)return[];let t=new Set(this.view.getContext(i));return t.forEach(o=>{try{if(i&&!e&&this.view?.isItemCollapsed(o)&&o.nestedChildren)for(let n of o.nestedChildren)t.add(n)}catch{return}}),[...t]}async applyBulkEdit(i,e){let t=new Ye,o=e.progressLocation??10,n;o===10?n={location:o,title:e.progressLabel,cancellable:i.length>1}:n={location:o,title:e.progressLabel,cancellable:i.length>1,delay:500};let r=this.progressService.withProgress(n,async s=>{await this.bulkEditService.apply(i,{undoRedoSource:THe,label:e.undoLabel,code:"undoredo.explorerOperation",progress:s,token:t.token,confirmBeforeUndo:e.confirmBeforeUndo})},()=>t.cancel());await this.progressService.withProgress({location:1,delay:500},()=>r),t.dispose()}hasViewFocus(){return!!this.view&&this.view.hasFocus()}findClosest(i){return this.model.findClosest(i)}findClosestRoot(i){let e=this.model.roots.filter(t=>this.uriIdentityService.extUri.isEqualOrParent(i,t.resource)).sort((t,o)=>o.resource.path.length-t.resource.path.length);return e.length?e[0]:null}async setEditable(i,e){if(!this.view)return;e?this.editable={stat:i,data:e}:this.editable=void 0;let t=this.isEditable(i);try{await this.view.setEditable(i,t)}catch{return}!this.editable&&this.fileChangeEvents.length&&!this.onFileChangesScheduler.isScheduled()&&this.onFileChangesScheduler.schedule()}async setToCopy(i,e){let t=this.cutItems;this.cutItems=e?i:void 0,await this.clipboardService.writeResources(i.map(o=>o.resource)),this.view?.itemsCopied(i,e,t)}isCut(i){return!!this.cutItems&&this.cutItems.some(e=>this.uriIdentityService.extUri.isEqual(e.resource,i.resource))}getEditable(){return this.editable}getEditableData(i){return this.editable&&this.editable.stat===i?this.editable.data:void 0}isEditable(i){return!!this.editable&&(this.editable.stat===i||!i)}async select(i,e){if(!this.view)return;let t=e==="force",o=this.findClosest(i);if(o)return this.shouldAutoRevealItem(o,t)?(await this.view.selectResource(o.resource,e),Promise.resolve(void 0)):void 0;let n={resolveTo:[i],resolveMetadata:this.config.sortOrder==="modified"},r=this.findClosestRoot(i);if(r)try{let s=await this.fileService.resolve(r.resource,n),l=qg.create(this.fileService,this.configurationService,this.filesConfigurationService,s,void 0,n.resolveTo);qg.mergeLocalWithDisk(l,r);let c=r.find(i);if(await this.view.refresh(!0,r),c&&!this.shouldAutoRevealItem(c,t))return;await this.view.selectResource(c?c.resource:void 0,e)}catch(s){r.error=s,await this.view.refresh(!1,r)}}async refresh(i=!0){if(!this.view?.hasPhantomElements()&&(this.model.roots.forEach(e=>e.forgetChildren()),this.view)){await this.view.refresh(!0);let e=this.editorService.activeEditor?.resource,t=this.configurationService.getValue().explorer.autoReveal;i&&e&&t&&this.select(e,t)}}async onDidRunOperation(i){let e=this.config.fileNesting.enabled;if(i.isOperation(0)||i.isOperation(3)){let t=i.target,o=ci(t.resource),n=this.model.findAll(o);n.length&&await Promise.all(n.map(async r=>{let s=this.config.sortOrder==="modified";if(!r.isDirectoryResolved){let c=await this.fileService.resolve(r.resource,{resolveMetadata:s});if(c){let u=qg.create(this.fileService,this.configurationService,this.filesConfigurationService,c,r.parent);qg.mergeLocalWithDisk(u,r)}}let l=qg.create(this.fileService,this.configurationService,this.filesConfigurationService,t,r.parent);r.removeChild(l),r.addChild(l),await this.view?.refresh(e,r)}))}else if(i.isOperation(2)){let t=i.resource,o=i.target,n=ci(t),r=ci(o.resource),s=this.model.findAll(t);if(s.every(c=>!c.nestedParent)&&this.uriIdentityService.extUri.isEqual(n,r))await Promise.all(s.map(async c=>{c.rename(o),await this.view?.refresh(e,c.parent)}));else{let c=this.model.findAll(r);c.length&&s.length&&await Promise.all(s.map(async(u,p)=>{let h=u.parent,g=u.nestedParent;u.move(c[p]),g&&await this.view?.refresh(!1,g),await this.view?.refresh(!1,h),await this.view?.refresh(e,c[p])}))}}else if(i.isOperation(1)){let t=this.model.findAll(i.resource);await Promise.all(t.map(async o=>{if(o.parent){let n=o.parent;n.removeChild(o),this.view?.focusNext();let r=o.nestedParent;r&&(r.removeChild(o),await this.view?.refresh(!1,r)),await this.view?.refresh(e,n),this.view?.getFocus().length===0&&this.view?.focusLast()}}))}}shouldAutoRevealItem(i,e){if(i===void 0||e)return!0;if(this.revealExcludeMatcher.matches(i.resource,n=>!!i.parent?.getChild(n)))return!1;let t=i.root,o=i.parent;for(;o!==t;){if(o===void 0)return!0;if(this.revealExcludeMatcher.matches(o.resource))return!1;o=o.parent}return!0}async onConfigurationUpdated(i){if(!i.affectsConfiguration("explorer"))return;let e=!1;i.affectsConfiguration("explorer.fileNesting")&&(e=!0);let t=this.configurationService.getValue(),o=t?.explorer?.sortOrder||"default";this.config.sortOrder!==o&&(e=this.config.sortOrder!==void 0);let n=t?.explorer?.sortOrderLexicographicOptions||"default";this.config.sortOrderLexicographicOptions!==n&&(e=e||this.config.sortOrderLexicographicOptions!==void 0);let r=t?.explorer?.sortOrderReverse||!1;this.config.sortOrderReverse!==r&&(e=e||this.config.sortOrderReverse!==void 0),this.config=t.explorer,e&&await this.refresh()}dispose(){this.disposables.dispose()}};Dne=I([m(0,fe),m(1,B),m(2,Pe),m(3,Fi),m(4,ee),m(5,ht),m(6,La),m(7,Fo),m(8,Zt),m(9,gr)],Dne);function ZEo(a,i,e,t){for(let[o,n]of a.children)if(i.isItemVisible(n)&&(e.some(r=>r.contains(n.resource,...t))||n.isDirectory&&n.isDirectoryResolved&&ZEo(n,i,e,t)))return!0;return!1}function xpn(a){let i=a?.explorer?.autoRevealExclude;return i||{}}var xve=class extends x{constructor(e,t,o,n,r,s,l,c){super();this.fileService=e;this.configurationService=t;this.contextService=o;this.notificationService=n;this.openerService=r;this.uriIdentityService=s;this.hostService=l;this.telemetryService=c;this.watchedWorkspaces=new gt(e=>this.uriIdentityService.extUri.getComparisonKey(e));this.registerListeners(),this.refresh()}static{this.ID="workbench.contrib.workspaceWatcher"}registerListeners(){this._register(this.contextService.onDidChangeWorkspaceFolders(e=>this.onDidChangeWorkspaceFolders(e))),this._register(this.contextService.onDidChangeWorkbenchState(()=>this.onDidChangeWorkbenchState())),this._register(this.configurationService.onDidChangeConfiguration(e=>this.onDidChangeConfiguration(e))),this._register(this.fileService.onDidWatchError(e=>this.onDidWatchError(e)))}onDidChangeWorkspaceFolders(e){for(let t of e.removed)this.unwatchWorkspace(t);for(let t of e.added)this.watchWorkspace(t)}onDidChangeWorkbenchState(){this.refresh()}onDidChangeConfiguration(e){(e.affectsConfiguration("files.watcherExclude")||e.affectsConfiguration("files.watcherInclude"))&&this.refresh()}onDidWatchError(e){let t=e.toString(),o;t.indexOf("ENOSPC")>=0?(o="ENOSPC",this.notificationService.prompt(ft.Warning,d(11136,null),[{label:d(11138,null),run:()=>this.openerService.open(A.parse("https://go.microsoft.com/fwlink/?linkid=867693"))}],{sticky:!0,neverShowAgain:{id:"ignoreEnospcError",isSecondary:!0,scope:0}})):t.indexOf("EUNKNOWN")>=0?(o="EUNKNOWN",this.notificationService.prompt(ft.Warning,d(11137,null),[{label:d(11139,null),run:()=>this.hostService.reload()}],{sticky:!0,priority:2})):t.indexOf("ETERM")>=0&&(o="ETERM"),o&&this.telemetryService.publicLog2("fileWatcherError",{reason:o})}watchWorkspace(e){let t=[],o=this.configurationService.getValue({resource:e.uri});if(o.files?.watcherExclude)for(let s in o.files.watcherExclude)s&&o.files.watcherExclude[s]===!0&&t.push(s);let n=new gt(s=>this.uriIdentityService.extUri.getComparisonKey(s));if(n.set(e.uri,e.uri),o.files?.watcherInclude){for(let s of o.files.watcherInclude)if(s)if(Zl(s)){let l=A.file(s).with({scheme:e.uri.scheme});this.uriIdentityService.extUri.isEqualOrParent(l,e.uri)&&n.set(l,l)}else{let l=e.toResource(s);n.set(l,l)}}let r=new N;for(let[,s]of n)r.add(this.fileService.watch(s,{recursive:!0,excludes:t}));this.watchedWorkspaces.set(e.uri,r)}unwatchWorkspace(e){this.watchedWorkspaces.has(e.uri)&&(Be(this.watchedWorkspaces.get(e.uri)),this.watchedWorkspaces.delete(e.uri))}refresh(){this.unwatchWorkspaces();for(let e of this.contextService.getWorkspace().folders)this.watchWorkspace(e)}unwatchWorkspaces(){for(let[,e]of this.watchedWorkspaces)e.dispose();this.watchedWorkspaces.clear()}dispose(){super.dispose(),this.unwatchWorkspaces()}};xve=I([m(0,fe),m(1,B),m(2,Pe),m(3,Ne),m(4,Je),m(5,ht),m(6,Zt),m(7,Te)],xve);var kve=class extends x{constructor(e,t,o){super();this.activityService=e;this.workingCopyService=t;this.filesConfigurationService=o;this.badgeHandle=this._register(new me);this.lastKnownDirtyCount=0;this.updateActivityBadge(),this.registerListeners()}static{this.ID="workbench.contrib.dirtyFilesIndicator"}registerListeners(){this._register(this.workingCopyService.onDidChangeDirty(e=>this.onWorkingCopyDidChangeDirty(e)))}onWorkingCopyDidChangeDirty(e){let t=e.isDirty();t&&!(e.capabilities&2)&&this.filesConfigurationService.hasShortAutoSaveDelay(e.resource)||(t||this.lastKnownDirtyCount>0)&&this.updateActivityBadge()}updateActivityBadge(){let e=this.lastKnownDirtyCount=this.workingCopyService.dirtyCount;e>0?this.badgeHandle.value=this.activityService.showViewContainerActivity(nv,{badge:new Rd(e,t=>t===1?d(11140,null):d(11141,null,e))}):this.badgeHandle.clear()}};kve=I([m(0,Sl),m(1,Xa),m(2,gr)],kve);var Q5t=class{canSerialize(i){return!0}serialize(i){let e=i,t=e.resource,o=e.preferredResource,n={resourceJSON:t.toJSON(),preferredResourceJSON:Qe(t,o)?void 0:o,name:e.getPreferredName(),description:e.getPreferredDescription(),encoding:e.getEncoding(),modeId:e.getPreferredLanguageId()};return JSON.stringify(n)}deserialize(i,e){return i.invokeFunction(t=>{let o=JSON.parse(e),n=A.revive(o.resourceJSON),r=A.revive(o.preferredResourceJSON),s=o.name,l=o.description,c=o.encoding,u=o.modeId,p=t.get(Pk).createTextEditor({resource:n,label:s,description:l,encoding:c,languageId:u,forceFile:!0});return r&&p.setPreferredResource(r),p})}},Eve=class extends x{constructor(e,t,o){super();this.textEditorService=t;this.fileService=o;this._register(e.registerHandler(this))}static{this.ID="workbench.contrib.fileEditorWorkingCopyEditorHandler"}handles(e){return e.typeId===gA&&this.fileService.canHandleResource(e.resource)}handlesSync(e){return e.typeId===gA&&this.fileService.hasProvider(e.resource)}isOpen(e,t){return this.handlesSync(e)?Qe(e.resource,t.resource):!1}createEditor(e){return this.textEditorService.createTextEditor({resource:e.resource,forceFile:!0})}};Eve=I([m(0,iv),m(1,Pk),m(2,fe)],Eve);var I6=class extends JZ{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k){super(I6.ID,e,t,r,l,c,p,u,h,o);this.paneCompositeService=n;this.contextService=s;this.textFileService=g;this.explorerService=f;this.uriIdentityService=v;this.pathService=b;this.configurationService=S;this.preferencesService=y;this.hostService=w;this.filesConfigurationService=k;this._register(this.fileService.onDidFilesChange(T=>this.onDidFilesChange(T))),this._register(this.fileService.onDidRunOperation(T=>this.onDidRunOperation(T)))}static{this.ID=w0}onDidFilesChange(e){for(let t of e.rawDeleted)this.clearEditorViewState(t)}onDidRunOperation(e){e.operation===2&&e.target&&this.moveEditorViewState(e.resource,e.target.resource,this.uriIdentityService.extUri)}getTitle(){return this.input?this.input.getName():d(10779,null)}get input(){return this._input}async setInput(e,t,o,n){Mo("code/willSetInputToTextFileEditor"),await super.setInput(e,t,o,n);try{let r=await e.resolve(t);if(n.isCancellationRequested)return;if(r instanceof B2)return this.openAsBinary(e,t);let s=r,l=Ci(this.editorControl);if(l.setModel(s.textEditorModel),!Z5(t?.viewState)){let c=this.loadEditorViewState(e,o);c&&(t?.selection&&(c.cursorState=[]),l.restoreViewState(c))}t&&LT(t,l,1),l.updateOptions(this.getReadonlyConfiguration(s.isReadonly())),l.handleInitialized&&l.handleInitialized()}catch(r){await this.handleSetInputError(r,e,t)}Mo("code/didSetInputToTextFileEditor")}async handleSetInputError(e,t,o){if(e.textFileOperationResult===0)return this.openAsBinary(t,o);if(e.fileOperationResult===0){let n=[];throw n.push(ii({id:"workbench.files.action.openFolder",label:d(10777,null),run:async()=>this.hostService.openWindow([{folderUri:t.resource}],{forceNewWindow:!0})})),this.contextService.isInsideWorkspace(t.preferredResource)&&n.push(ii({id:"workbench.files.action.reveal",label:d(10778,null),run:async()=>(await this.paneCompositeService.openPaneComposite(nv,0,!0),this.explorerService.select(t.preferredResource,!0))})),t4(d(10774,null),n,{forceMessage:!0})}if(e.fileOperationResult===7){let n;throw e instanceof MO?n=d(10776,null,vl.formatSize(e.size)):n=d(10775,null),LEe(this.group,t,o,n,this.preferencesService)}throw e.fileOperationResult===1&&!this.filesConfigurationService.isReadonly(t.preferredResource)&&await this.pathService.hasValidBasename(t.preferredResource)?t4(new ta(d(10780,null),1),[ii({id:"workbench.files.action.createMissingFile",label:d(10773,null),run:async()=>(await this.textFileService.create([{resource:t.preferredResource}]),this.editorService.openEditor({resource:t.preferredResource,options:{pinned:!0}}))})],{allowDialog:!0}):e}openAsBinary(e,t){let o=this.configurationService.getValue("workbench.editor.defaultBinaryEditor"),n={...t,activation:3};o&&o!==""&&o!==la.id?this.doOpenAsBinaryInDifferentEditor(this.group,o,e,n):this.doOpenAsBinaryInSameEditor(this.group,o,e,n)}doOpenAsBinaryInDifferentEditor(e,t,o,n){this.editorService.replaceEditors([{editor:o,replacement:{resource:o.resource,options:{...n,override:t}}}],e)}doOpenAsBinaryInSameEditor(e,t,o,n){t===la.id?(o.setForceOpenAsText(),o.setPreferredLanguageId(BLe),n={...n,forceReload:!0}):o.setForceOpenAsBinary(),e.openEditor(o,n)}clearInput(){super.clearInput(),this.editorControl?.setModel(null)}createEditorControl(e,t){Mo("code/willCreateTextFileEditorControl"),super.createEditorControl(e,t),Mo("code/didCreateTextFileEditorControl")}tracksEditorViewState(e){return e instanceof wI}tracksDisposedEditorViewState(){return!0}};I6=I([m(1,Te),m(2,fe),m(3,us),m(4,F),m(5,Pe),m(6,ce),m(7,Fn),m(8,ee),m(9,Le),m(10,wt),m(11,Uo),m(12,Oa),m(13,ht),m(14,An),m(15,B),m(16,Go),m(17,Zt),m(18,gr)],I6);var _He=class{static{this.ID="workbench.contrib.fileUriLabel"}constructor(i){i.registerFormatter({scheme:Q.file,formatting:{label:"${authority}${path}",separator:Qd,tildify:!ei,normalizeDriveLetter:ei,authorityPrefix:Qd+Qd,workspaceSuffix:""}})}};_He=I([m(0,rt)],_He);Ee(Oa,Dne,1);ne.as(qo.EditorPane).registerEditorPane(Br.create(I6,I6.ID,d(11093,null)),[new Ft(wI)]);ne.as(qo.EditorPane).registerEditorPane(Br.create(S6,S6.ID,d(11003,null)),[new Ft(wI)]);ne.as(qo.EditorFactory).registerFileEditorFactory({typeId:Vpe,createFileEditor:(a,i,e,t,o,n,r,s)=>s.createInstance(wI,a,i,e,t,o,n,r),isFileEditor:a=>a instanceof wI});ne.as(qo.EditorFactory).registerEditorSerializer(Vpe,Q5t);It(Eve.ID,Eve,St.BlockRestore);It(yve.ID,yve,St.BlockStartup);It(Cve.ID,Cve,St.BlockStartup);It(Xhe.ID,Xhe,St.BlockStartup);It(_He.ID,_He,St.BlockStartup);It(xve.ID,xve,St.AfterRestored);It(kve.ID,kve,St.BlockStartup);var e0i=ne.as(Jt.Configuration),kpn=Vr?{type:"string",scope:1,enum:[XS.OFF,XS.ON_EXIT,XS.ON_EXIT_AND_WINDOW_CLOSE],default:XS.ON_EXIT,markdownEnumDescriptions:[d(11064,null),d(11065,null),d(11066,null)],markdownDescription:d(11063,null,XS.ON_EXIT,XS.ON_EXIT_AND_WINDOW_CLOSE)}:{type:"string",scope:1,enum:[XS.OFF,XS.ON_EXIT_AND_WINDOW_CLOSE],default:XS.ON_EXIT_AND_WINDOW_CLOSE,markdownEnumDescriptions:[d(11064,null),d(11067,null)],markdownDescription:d(11063,null,XS.ON_EXIT,XS.ON_EXIT_AND_WINDOW_CLOSE)};e0i.registerConfiguration({id:"files",order:9,title:d(11057,null),type:"object",properties:{[_bt]:{type:"object",markdownDescription:d(11032,null),default:{"**/.git":!0,"**/.svn":!0,"**/.hg":!0,"**/.DS_Store":!0,"**/Thumbs.db":!0,...Wt?{"**/*.crswap":!0}:void 0},scope:5,additionalProperties:{anyOf:[{type:"boolean",enum:[!0,!1],enumDescriptions:[d(11097,null),d(11041,null)],description:d(11051,null)},{type:"object",properties:{when:{type:"string",pattern:"\\w*\\$\\(basename\\)\\w*",default:"$(basename).ext",markdownDescription:d(11052,null)}}}]}},[yj]:{type:"object",markdownDescription:d(10991,null),additionalProperties:{type:"string"}},"files.encoding":{type:"string",enum:Object.keys(Nw),default:"utf8",description:d(11026,null),scope:6,enumDescriptions:Object.keys(Nw).map(a=>Nw[a].labelLong),enumItemLabels:Object.keys(Nw).map(a=>Nw[a].labelLong)},"files.autoGuessEncoding":{type:"boolean",default:!1,markdownDescription:d(10992,null,"`#files.encoding#`"),scope:6},"files.candidateGuessEncodings":{type:"array",items:{type:"string",enum:Object.keys(j9e),enumDescriptions:Object.keys(j9e).map(a=>j9e[a].labelLong)},default:[],markdownDescription:d(11004,null,"`#files.encoding#`"),scope:6},"files.eol":{type:"string",enum:[`
`,`\r
`,"auto"],enumDescriptions:[d(11030,null),d(11029,null),d(11028,null)],default:"auto",description:d(11027,null),scope:6},"files.enableTrash":{type:"boolean",default:!0,description:d(11098,null)},"files.trimTrailingWhitespace":{type:"boolean",default:!1,description:d(11095,null),scope:6},"files.trimTrailingWhitespaceInRegexAndStrings":{type:"boolean",default:!0,description:d(11096,null),scope:6},"files.insertFinalNewline":{type:"boolean",default:!1,description:d(11068,null),scope:6},"files.trimFinalNewlines":{type:"boolean",default:!1,description:d(11094,null),scope:6},"files.autoSave":{type:"string",enum:[Cv.OFF,Cv.AFTER_DELAY,Cv.ON_FOCUS_CHANGE,Cv.ON_WINDOW_CHANGE],markdownEnumDescriptions:[d(11048,null),d(11047,null),d(11049,null),d(11050,null)],default:Wt?Cv.AFTER_DELAY:Cv.OFF,markdownDescription:d(10999,null,Cv.OFF,Cv.AFTER_DELAY,Cv.ON_FOCUS_CHANGE,Cv.ON_WINDOW_CHANGE,Cv.AFTER_DELAY),scope:6},"files.autoSaveDelay":{type:"number",default:1e3,minimum:0,markdownDescription:d(11000,null,Cv.AFTER_DELAY),scope:6},"files.autoSaveWorkspaceFilesOnly":{type:"boolean",default:!1,markdownDescription:d(11002,null,"`#files.autoSave#`"),scope:6},"files.autoSaveWhenNoErrors":{type:"boolean",default:!1,markdownDescription:d(11001,null,"`#files.autoSave#`"),scope:6},"files.watcherExclude":{type:"object",patternProperties:{".*":{type:"boolean"}},default:{"**/.git/objects/**":!0,"**/.git/subtree-cache/**":!0,"**/.hg/store/**":!0},markdownDescription:d(11099,null),scope:5},"files.watcherInclude":{type:"array",items:{type:"string"},default:[],description:d(11100,null),scope:5},"files.hotExit":kpn,"files.defaultLanguage":{type:"string",markdownDescription:d(11018,null)},[Dbt]:{type:"object",patternProperties:{".*":{type:"boolean"}},default:{},markdownDescription:d(11060,null),scope:5},[Lbt]:{type:"object",patternProperties:{".*":{type:"boolean"}},default:{},markdownDescription:d(11058,null),scope:5},[Z4i]:{type:"boolean",markdownDescription:d(11059,null),default:!1},"files.restoreUndoStack":{type:"boolean",description:d(11054,null),default:!0},"files.saveConflictResolution":{type:"string",enum:["askUser","overwriteFileOnDisk"],enumDescriptions:[d(10990,null),d(11074,null)],description:d(11055,null),default:"askUser",scope:6},"files.dialog.defaultPath":{type:"string",pattern:"^((\\/|\\\\\\\\|[a-zA-Z]:\\\\).*)?$",patternErrorMessage:d(11019,null),description:d(11042,null),scope:2},"files.simpleDialog.enable":{type:"boolean",description:d(11056,null),default:!1},"files.participants.timeout":{type:"number",default:6e4,markdownDescription:d(11053,null)}}});e0i.registerConfiguration({...RC,properties:{"editor.formatOnSave":{type:"boolean",markdownDescription:d(11061,null,"`#files.autoSave#`"),scope:6},"editor.formatOnSaveMode":{type:"string",default:"file",enum:["file","modifications","modificationsIfAvailable"],enumDescriptions:[d(11031,null),d(11069,null),d(11070,null)],markdownDescription:d(11062,null),scope:6}}});e0i.registerConfiguration({id:"explorer",order:10,title:d(11040,null),type:"object",properties:{"explorer.openEditors.visible":{type:"number",description:d(11072,null),default:9,minimum:1},"explorer.openEditors.minVisible":{type:"number",description:d(11073,null),default:0,minimum:0},"explorer.openEditors.sortOrder":{type:"string",enum:["editorOrder","alphabetical","fullPath"],description:d(11071,null),enumDescriptions:[d(11080,null),d(11078,null),d(11083,null)],default:"editorOrder"},"explorer.autoReveal":{type:["boolean","string"],enum:[!0,!1,"focusNoScroll"],default:!0,enumDescriptions:[d(10997,null),d(10996,null),d(10995,null)],description:d(10994,null)},"explorer.autoRevealExclude":{type:"object",markdownDescription:d(10998,null),default:{"**/node_modules":!0,"**/bower_components":!0},additionalProperties:{anyOf:[{type:"boolean",description:d(11035,null)},{type:"object",properties:{when:{type:"string",pattern:"\\w*\\$\\(basename\\)\\w*",default:"$(basename).ext",description:d(11036,null,"$(basename)")}}}]}},"explorer.enableDragAndDrop":{type:"boolean",description:d(11021,null),default:!0},"explorer.confirmDragAndDrop":{type:"boolean",description:d(11007,null),default:!0},"explorer.confirmPasteNative":{type:"boolean",description:d(11008,null),default:!0},"explorer.confirmDelete":{type:"boolean",description:d(11006,null),default:!0},"explorer.enableUndo":{type:"boolean",description:d(11022,null),default:!0},"explorer.confirmUndo":{type:"string",enum:["verbose","default","light"],description:d(11009,null),default:"default",enumDescriptions:[d(11025,null),d(11023,null),d(11024,null)]},"explorer.expandSingleFolderWorkspaces":{type:"boolean",description:d(11034,null),default:!0},"explorer.sortOrder":{type:"string",enum:["default","mixed","filesFirst","type","modified","foldersNestsFiles"],default:"default",enumDescriptions:[d(11079,null),d(11084,null),d(11081,null),d(11086,null),d(11085,null),d(11082,null)],markdownDescription:d(11077,null)},"explorer.sortOrderLexicographicOptions":{type:"string",enum:["default","upper","lower","unicode"],default:"default",enumDescriptions:[d(11088,null),d(11091,null),d(11089,null),d(11090,null)],description:d(11087,null)},"explorer.sortOrderReverse":{type:"boolean",description:d(11092,null),default:!1},"explorer.decorations.colors":{type:"boolean",description:d(11038,null),default:!0},"explorer.decorations.badges":{type:"boolean",description:d(11037,null),default:!0},"explorer.incrementalNaming":{type:"string",enum:["simple","smart","disabled"],enumDescriptions:[d(11075,null),d(11076,null),d(11020,null)],description:d(11039,null),default:"simple"},"explorer.autoOpenDroppedFile":{type:"boolean",description:d(10993,null),default:!0},"explorer.compactFolders":{type:"boolean",description:d(11005,null),default:!0},"explorer.copyRelativePathSeparator":{type:"string",enum:["/","\\","auto"],enumDescriptions:[d(11017,null),d(11016,null),d(11015,null)],description:d(11014,null),default:"auto"},"explorer.copyPathSeparator":{type:"string",enum:["/","\\","auto"],enumDescriptions:[d(11013,null),d(11012,null),d(11011,null)],description:d(11010,null),default:"auto"},"explorer.excludeGitIgnore":{type:"boolean",markdownDescription:d(11033,null,"`#files.exclude#`"),default:!1,scope:5},"explorer.fileNesting.enabled":{type:"boolean",scope:5,markdownDescription:d(11044,null),default:!1},"explorer.fileNesting.expand":{type:"boolean",markdownDescription:d(11045,null,"`#explorer.fileNesting.enabled#`"),default:!0},"explorer.fileNesting.patterns":{type:"object",scope:5,markdownDescription:d(11046,null,"`#explorer.fileNesting.enabled#`"),patternProperties:{"^[^*]*\\*?[^*]*$":{markdownDescription:d(11043,null),type:"string",pattern:"^([^,*]*\\*?[^,*]*)(, ?[^,*]*\\*?[^,*]*)*$"}},additionalProperties:!1,default:{"*.ts":"${capture}.js","*.js":"${capture}.js.map, ${capture}.min.js, ${capture}.d.ts","*.jsx":"${capture}.js","*.tsx":"${capture}.ts","tsconfig.json":"tsconfig.*.json","package.json":"package-lock.json, yarn.lock, pnpm-lock.yaml, bun.lockb, bun.lock"}}}});S_.addImplementation(110,"explorer",a=>{let i=a.get(Ml),e=a.get(Oa),o=a.get(B).getValue().explorer.enableUndo;return e.hasViewFocus()&&i.canUndo(THe)&&o?(i.undo(THe),!0):!1});I_.addImplementation(110,"explorer",a=>{let i=a.get(Ml),e=a.get(Oa),o=a.get(B).getValue().explorer.enableUndo;return e.hasViewFocus()&&i.canRedo(THe)&&o?(i.redo(THe),!0):!1});wP.registerLanguage({id:BLe,aliases:["Binary"],mimetypes:["text/x-code-binary"]});var Dve=class{constructor(){this.uris=[]}async perform(){return this}toString(){return"(noop)"}},Y5t=class{constructor(i,e,t){this.newUri=i;this.oldUri=e;this.options=t;this.type="rename"}},Tve=class{constructor(i,e,t,o){this._edits=i;this._undoRedoInfo=e;this._workingCopyFileService=t;this._fileService=o}get uris(){return this._edits.flatMap(i=>[i.newUri,i.oldUri])}async perform(i){let e=[],t=[];for(let o of this._edits)o.options.overwrite===void 0&&o.options.ignoreIfExists&&await this._fileService.exists(o.newUri)||(e.push({file:{source:o.oldUri,target:o.newUri},overwrite:o.options.overwrite}),t.push(new Y5t(o.oldUri,o.newUri,o.options)));return e.length===0?new Dve:(await this._workingCopyFileService.move(e,i,this._undoRedoInfo),new Tve(t,{isUndoing:!0},this._workingCopyFileService,this._fileService))}toString(){return`(rename ${this._edits.map(i=>`${i.oldUri} to ${i.newUri}`).join(", ")})`}};Tve=I([m(2,qp),m(3,fe)],Tve);var t0i=class{constructor(i,e,t){this.newUri=i;this.oldUri=e;this.options=t;this.type="copy"}},rlt=class{constructor(i,e,t,o,n){this._edits=i;this._undoRedoInfo=e;this._workingCopyFileService=t;this._fileService=o;this._instaService=n}get uris(){return this._edits.flatMap(i=>[i.newUri,i.oldUri])}async perform(i){let e=[];for(let n of this._edits)n.options.overwrite===void 0&&n.options.ignoreIfExists&&await this._fileService.exists(n.newUri)||e.push({file:{source:n.oldUri,target:n.newUri},overwrite:n.options.overwrite});if(e.length===0)return new Dve;let t=await this._workingCopyFileService.copy(e,i,this._undoRedoInfo),o=[];for(let n=0;n<t.length;n++){let r=t[n],s=this._edits[n];o.push(new slt(r.resource,{recursive:!0,folder:this._edits[n].options.folder||r.isDirectory,...s.options},!1))}return this._instaService.createInstance(_ve,o,{isUndoing:!0})}toString(){return`(copy ${this._edits.map(i=>`${i.oldUri} to ${i.newUri}`).join(", ")})`}};rlt=I([m(2,qp),m(3,fe),m(4,F)],rlt);var X5t=class{constructor(i,e,t){this.newUri=i;this.options=e;this.contents=t;this.type="create"}},DHe=class{constructor(i,e,t,o,n,r){this._edits=i;this._undoRedoInfo=e;this._fileService=t;this._workingCopyFileService=o;this._instaService=n;this._textFileService=r}get uris(){return this._edits.map(i=>i.newUri)}async perform(i){let e=[],t=[],o=[];for(let n of this._edits)if(n.newUri.scheme!==Q.untitled&&!(n.options.overwrite===void 0&&n.options.ignoreIfExists&&await this._fileService.exists(n.newUri))){if(n.options.folder)e.push({resource:n.newUri});else{let r=typeof n.contents<"u"?n.contents:await this._textFileService.getEncodedReadable(n.newUri);t.push({resource:n.newUri,contents:r,overwrite:n.options.overwrite})}o.push(new slt(n.newUri,n.options,!n.options.folder&&!n.contents))}return e.length===0&&t.length===0?new Dve:(await this._workingCopyFileService.createFolder(e,i,this._undoRedoInfo),await this._workingCopyFileService.create(t,i,this._undoRedoInfo),this._instaService.createInstance(_ve,o,{isUndoing:!0}))}toString(){return`(create ${this._edits.map(i=>i.options.folder?`folder ${i.newUri}`:`file ${i.newUri} with ${i.contents?.byteLength||0} bytes`).join(", ")})`}};DHe=I([m(2,fe),m(3,qp),m(4,F),m(5,Uo)],DHe);var slt=class{constructor(i,e,t){this.oldUri=i;this.options=e;this.undoesCreate=t;this.type="delete"}},_ve=class{constructor(i,e,t,o,n,r,s){this._edits=i;this._undoRedoInfo=e;this._workingCopyFileService=t;this._fileService=o;this._configurationService=n;this._instaService=r;this._logService=s}get uris(){return this._edits.map(i=>i.oldUri)}async perform(i){let e=[],t=[];for(let o of this._edits){let n;try{n=await this._fileService.resolve(o.oldUri,{resolveMetadata:!0})}catch{if(!o.options.ignoreIfNotExists)throw new Error(`${o.oldUri} does not exist and can not be deleted`);continue}e.push({resource:o.oldUri,recursive:o.options.recursive,useTrash:!o.options.skipTrashBin&&this._fileService.hasCapability(o.oldUri,4096)&&this._configurationService.getValue("files.enableTrash")});let r,s=!1;if(!o.undoesCreate&&!o.options.folder&&(s=typeof o.options.maxSize=="number"&&n.size>o.options.maxSize,!s))try{r=await this._fileService.readFile(o.oldUri)}catch(l){this._logService.error(l)}s||t.push(new X5t(o.oldUri,o.options,r?.value))}return e.length===0?new Dve:(await this._workingCopyFileService.delete(e,i,this._undoRedoInfo),t.length===0?new Dve:this._instaService.createInstance(DHe,t,{isUndoing:!0}))}toString(){return`(delete ${this._edits.map(i=>i.oldUri).join(", ")})`}};_ve=I([m(2,qp),m(3,fe),m(4,B),m(5,F),m(6,se)],_ve);var i0i=class{constructor(i,e,t,o){this.label=i;this.code=e;this.operations=t;this.confirmBeforeUndo=o;this.type=1;this.resources=t.flatMap(n=>n.uris)}async undo(){await this._reverse()}async redo(){await this._reverse()}async _reverse(){for(let i=0;i<this.operations.length;i++){let t=await this.operations[i].perform(Se.None);this.operations[i]=t}}toString(){return this.operations.map(i=>String(i)).join(", ")}},LHe=class{constructor(i,e,t,o,n,r,s,l,c,u){this._label=i;this._code=e;this._undoRedoGroup=t;this._undoRedoSource=o;this._confirmBeforeUndo=n;this._progress=r;this._token=s;this._edits=l;this._instaService=c;this._undoRedoService=u}async apply(){let i=[],e={undoRedoGroupId:this._undoRedoGroup.id},t=[];for(let r of this._edits)r.newResource&&r.oldResource&&!r.options?.copy?t.push(new Y5t(r.newResource,r.oldResource,r.options??{})):r.newResource&&r.oldResource&&r.options?.copy?t.push(new t0i(r.newResource,r.oldResource,r.options??{})):!r.newResource&&r.oldResource?t.push(new slt(r.oldResource,r.options??{},!1)):r.newResource&&!r.oldResource&&t.push(new X5t(r.newResource,r.options??{},await r.options.contents));if(t.length===0)return[];let o=[];o[0]=[t[0]];for(let r=1;r<t.length;r++){let s=t[r],l=o.at(-1);l?.[0].type===s.type?l.push(s):o.push([s])}for(let r of o){if(this._token.isCancellationRequested)break;let s;switch(r[0].type){case"rename":s=this._instaService.createInstance(Tve,r,e);break;case"copy":s=this._instaService.createInstance(rlt,r,e);break;case"delete":s=this._instaService.createInstance(_ve,r,e);break;case"create":s=this._instaService.createInstance(DHe,r,e);break}if(s){let l=await s.perform(this._token);i.push(l)}this._progress.report(void 0)}let n=new i0i(this._label,this._code,i,this._confirmBeforeUndo);return this._undoRedoService.pushElement(n,this._undoRedoGroup,this._undoRedoSource),n.resources}};LHe=I([m(8,F),m(9,Ml)],LHe);var J5t=class{constructor(i){this._modelReference=i;this.model=this._modelReference.object.textEditorModel,this._edits=[]}dispose(){this._modelReference.dispose()}isNoOp(){return!(this._edits.length>0||this._newEol!==void 0&&this._newEol!==this.model.getEndOfLineSequence())}addEdit(i){this._expectedModelVersionId=i.versionId;let{textEdit:e}=i;if(typeof e.eol=="number"&&(this._newEol=e.eol),!e.range&&!e.text||z.isEmpty(e.range)&&!e.text)return;let t;e.range?t=z.lift(e.range):t=this.model.getFullModelRange(),this._edits.push({...Hn.replaceMove(t,e.text),insertAsSnippet:e.insertAsSnippet,keepWhitespace:e.keepWhitespace})}validate(){return typeof this._expectedModelVersionId>"u"||this.model.getVersionId()===this._expectedModelVersionId?{canApply:!0}:{canApply:!1,reason:this.model.uri}}getBeforeCursorState(){return null}apply(i){this._edits.length>0&&(this._edits=this._edits.map(this._transformSnippetStringToInsertText,this).sort((e,t)=>z.compareRangesUsingStarts(e.range,t.range)),this.model.pushEditOperations(null,this._edits,()=>null,void 0,i)),this._newEol!==void 0&&this.model.pushEOL(this._newEol)}_transformSnippetStringToInsertText(i){if(!i.insertAsSnippet||!i.text)return i;let e=eg.asInsertText(i.text);return{...i,insertAsSnippet:!1,text:e}}},o0i=class extends J5t{constructor(i,e){super(i),this._editor=e}getBeforeCursorState(){return this._canUseEditor()?this._editor.getSelections():null}apply(i){if(!this._canUseEditor()){super.apply();return}if(this._edits.length>0){let e=vs.get(this._editor);if(e&&this._edits.some(t=>t.insertAsSnippet)){let t=[];for(let o of this._edits)o.range&&o.text!==null&&t.push({range:z.lift(o.range),template:o.insertAsSnippet?o.text:eg.escape(o.text),keepWhitespace:o.keepWhitespace});e.apply(t,{undoStopBefore:!1,undoStopAfter:!1})}else this._edits=this._edits.map(this._transformSnippetStringToInsertText,this).sort((t,o)=>z.compareRangesUsingStarts(t.range,o.range)),this._editor.executeEdits(i,this._edits)}this._newEol!==void 0&&this._editor.hasModel()&&this._editor.getModel().pushEOL(this._newEol)}_canUseEditor(){return this._editor?.getModel()?.uri.toString()===this.model.uri.toString()}},RHe=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h){this._label=i;this._code=e;this._editor=t;this._undoRedoGroup=o;this._undoRedoSource=n;this._progress=r;this._token=s;this._editorWorker=c;this._modelService=u;this._textModelResolverService=p;this._undoRedoService=h;this._edits=new gt;for(let g of l){let f=this._edits.get(g.resource);f||(f=[],this._edits.set(g.resource,f)),f.push(g)}}_validateBeforePrepare(){for(let i of this._edits.values())for(let e of i)if(typeof e.versionId=="number"){let t=this._modelService.getModel(e.resource);if(t&&t.getVersionId()!==e.versionId)throw new Error(`${t.uri.toString()} has changed in the meantime`)}}async _createEditsTasks(){let i=[],e=[];for(let[t,o]of this._edits){let n=this._textModelResolverService.createModelReference(t).then(async r=>{let s,l=!1;if(this._editor?.getModel()?.uri.toString()===r.object.textEditorModel.uri.toString()?(s=new o0i(r,this._editor),l=!0):s=new J5t(r),i.push(s),!l){o.forEach(s.addEdit,s);return}let c=async(h,g)=>{let f=o.slice(h,g),v=await this._editorWorker.computeMoreMinimalEdits(r.object.textEditorModel.uri,f.map(b=>b.textEdit),!1);v?v.forEach(b=>s.addEdit(new nl(r.object.textEditorModel.uri,b,void 0,void 0))):f.forEach(s.addEdit,s)},u=0,p=0;for(;p<o.length;p++)(o[p].textEdit.insertAsSnippet||o[p].metadata)&&(await c(u,p),s.addEdit(o[p]),u=p+1);await c(u,p)});e.push(n)}return await Promise.all(e),i}_validateTasks(i){for(let e of i){let t=e.validate();if(!t.canApply)return t}return{canApply:!0}}async apply(i){this._validateBeforePrepare();let e=await this._createEditsTasks();try{if(this._token.isCancellationRequested)return[];let t=[],o=this._validateTasks(e);if(!o.canApply)throw new Error(`${o.reason.toString()} has changed in the meantime`);if(e.length===1){let n=e[0];if(!n.isNoOp()){let r=new oR(this._label,this._code,n.model,n.getBeforeCursorState());this._undoRedoService.pushElement(r,this._undoRedoGroup,this._undoRedoSource),n.apply(i),r.close(),t.push(n.model.uri)}this._progress.report(void 0)}else{let n=new BV(this._label,this._code,e.map(r=>new oR(this._label,this._code,r.model,r.getBeforeCursorState())));this._undoRedoService.pushElement(n,this._undoRedoGroup,this._undoRedoSource);for(let r of e)r.apply(),this._progress.report(void 0),t.push(r.model.uri);n.close()}return t}finally{Be(e)}}};RHe=I([m(8,Qs),m(9,Tt),m(10,Bt),m(11,Ml)],RHe);var PHe=class a extends TY{constructor(e,t,o,n){super(n);this.resource=e;this.undo=t;this.redo=o}static is(e){return e instanceof a?!0:xi(e)&&!!(e.undo&&e.redo)}static lift(e){return e instanceof a?e:new a(e.resource,e.undo,e.redo,e.metadata)}},MHe=class{constructor(i,e,t,o,n,r){this._undoRedoGroup=i;this._undoRedoSource=e;this._progress=t;this._token=o;this._edits=n;this._undoRedoService=r}async apply(){let i=[];for(let e of this._edits){if(this._token.isCancellationRequested)break;await e.redo(),this._undoRedoService.pushElement({type:0,resource:e.resource,label:e.metadata?.label||"Custom Edit",code:"paste",undo:e.undo,redo:e.redo},this._undoRedoGroup,this._undoRedoSource),this._progress.report(void 0),i.push(e.resource)}return i}};MHe=I([m(5,Ml)],MHe);function Epn(a){return a.map(i=>{if(nl.is(i))return nl.lift(i);if(Cu.is(i))return Cu.lift(i);if(Mv.is(i))return Mv.lift(i);if(PHe.is(i))return PHe.lift(i);throw new Error("Unsupported edit")})}var alt=class{constructor(i,e,t,o,n,r,s,l,c,u,p){this._label=i;this._code=e;this._editor=t;this._progress=o;this._token=n;this._edits=r;this._undoRedoGroup=s;this._undoRedoSource=l;this._confirmBeforeUndo=c;this._instaService=u;this._logService=p}ariaMessage(){let i=new gt,e=new gt,t=0;for(let o of this._edits)o instanceof nl?(t+=1,e.set(o.resource,!0)):o instanceof Cu&&i.set(o.oldResource??o.newResource,!0);return this._edits.length===0?d(5546,null):i.size===0?t>1&&e.size>1?d(5548,null,t,e.size):d(5547,null,t):d(5549,null,t,e.size,i.size)}async perform(i){if(this._edits.length===0)return[];let e=[1];for(let s=1;s<this._edits.length;s++)Object.getPrototypeOf(this._edits[s-1])===Object.getPrototypeOf(this._edits[s])?e[e.length-1]++:e.push(1);let t=this._edits.length>1?0:void 0;this._progress.report({increment:t,total:100});let o={report:s=>this._progress.report({increment:100/this._edits.length})},n=[],r=0;for(let s of e){if(this._token.isCancellationRequested)break;let l=this._edits.slice(r,r+s);l[0]instanceof Cu?n.push(await this._performFileEdits(l,this._undoRedoGroup,this._undoRedoSource,this._confirmBeforeUndo,o)):l[0]instanceof nl?n.push(await this._performTextEdits(l,this._undoRedoGroup,this._undoRedoSource,o,i)):l[0]instanceof Mv?n.push(await this._performCellEdits(l,this._undoRedoGroup,this._undoRedoSource,o)):l[0]instanceof PHe?n.push(await this._performOpaqueEdits(l,this._undoRedoGroup,this._undoRedoSource,o)):console.log("UNKNOWN EDIT"),r=r+s}return n.flat()}async _performFileEdits(i,e,t,o,n){return this._logService.debug("_performFileEdits",JSON.stringify(i)),await this._instaService.createInstance(LHe,this._label||d(5550,null),this._code||"undoredo.workspaceEdit",e,t,o,n,this._token,i).apply()}async _performTextEdits(i,e,t,o,n){return this._logService.debug("_performTextEdits",JSON.stringify(i)),await this._instaService.createInstance(RHe,this._label||d(5550,null),this._code||"undoredo.workspaceEdit",this._editor,e,t,o,this._token,i).apply(n)}async _performCellEdits(i,e,t,o){return this._logService.debug("_performCellEdits",JSON.stringify(i)),await this._instaService.createInstance(NEe,e,t,o,this._token,i).apply()}async _performOpaqueEdits(i,e,t,o){return this._logService.debug("_performOpaqueEdits",JSON.stringify(i)),await this._instaService.createInstance(MHe,e,t,o,this._token,i).apply()}};alt=I([m(9,F),m(10,se)],alt);var llt=class{constructor(i,e,t,o,n,r,s){this._instaService=i;this._logService=e;this._editorService=t;this._lifecycleService=o;this._dialogService=n;this._workingCopyService=r;this._configService=s;this._activeUndoRedoGroups=new qs}setPreviewHandler(i){return this._previewHandler=i,Z(()=>{this._previewHandler===i&&(this._previewHandler=void 0)})}hasPreviewHandler(){return!!this._previewHandler}async apply(i,e){let t=Epn(Array.isArray(i)?i:i.edits);if(t.length===0)return{ariaSummary:d(5541,null),isApplied:!1};this._previewHandler&&(e?.showPreview||t.some(u=>u.metadata?.needsConfirmation))&&(t=await this._previewHandler(t,e));let o=e?.editor;if(!o){let u=this._editorService.activeTextEditorControl;pn(u)?o=u:mc(u)&&(o=u.getModifiedEditor())}o&&o.getOption(104)&&(o=void 0);let n,r=()=>{};if(typeof e?.undoRedoGroupId=="number"){for(let u of this._activeUndoRedoGroups)if(u.id===e.undoRedoGroupId){n=u;break}}n||(n=new Q7,r=this._activeUndoRedoGroups.push(n));let s=e?.quotableLabel||e?.label,l=this._instaService.createInstance(alt,s,e?.code,o,e?.progress??Mm.None,e?.token??Se.None,t,n,e?.undoRedoSource,!!e?.confirmBeforeUndo),c;try{c=this._lifecycleService.onBeforeShutdown(p=>p.veto(this._shouldVeto(s,p.reason),"veto.blukEditService"));let u=await l.perform(e?.reason);return e?.respectAutoSaveConfig&&this._configService.getValue(eTo)===!0&&u.length>1&&await this._saveAll(u),{ariaSummary:l.ariaMessage(),isApplied:t.length>0}}catch(u){throw this._logService.error(u),u}finally{c?.dispose(),r()}}async _saveAll(i){let e=new En(i),t=this._workingCopyService.dirtyWorkingCopies.map(async n=>{e.has(n.resource)&&await n.save()}),o=await Promise.allSettled(t);for(let n of o)n.status==="rejected"&&this._logService.warn(n.reason)}async _shouldVeto(i,e){let t;switch(e){case 1:t=d(5539,null);break;case 4:t=d(5538,null);break;case 3:t=d(5545,null);break;default:t=Ze?d(5543,null):d(5542,null);break}return!(await this._dialogService.confirm({message:t,detail:d(5537,null,i||d(5540,null))})).confirmed}};llt=I([m(0,F),m(1,se),m(2,ee),m(3,ji),m(4,at),m(5,Xa),m(6,B)],llt);Ee(La,llt,1);var eTo="files.refactoring.autoSave";ne.as(Jt.Configuration).registerConfiguration({id:"files",properties:{[eTo]:{description:d(5544,null),default:!0,type:"boolean"}}});var AHe=class{constructor(i,e,t,o){this._conflicts=new gt;this._disposables=new N;this._onDidConflict=new E;this.onDidConflict=this._onDidConflict.event;let n=new gt;for(let s of i)if(s instanceof nl){if(n.set(s.resource,!0),typeof s.versionId=="number"){let l=t.getModel(s.resource);l&&l.getVersionId()!==s.versionId&&(this._conflicts.set(s.resource,!0),this._onDidConflict.fire(this))}}else s instanceof Cu?s.newResource?n.set(s.newResource,!0):s.oldResource&&n.set(s.oldResource,!0):s instanceof Mv?n.set(s.resource,!0):o.warn("UNKNOWN edit type",s);this._disposables.add(e.onDidFilesChange(s=>{for(let l of n.keys())if(!t.getModel(l)&&s.contains(l)){this._conflicts.set(l,!0),this._onDidConflict.fire(this);break}}));let r=s=>{n.has(s.uri)&&(this._conflicts.set(s.uri,!0),this._onDidConflict.fire(this))};for(let s of t.getModels())this._disposables.add(s.onDidChangeContent(()=>r(s)))}dispose(){this._disposables.dispose(),this._onDidConflict.dispose()}list(){return[...this._conflicts.keys()]}hasConflicts(){return this._conflicts.size>0}};AHe=I([m(1,fe),m(2,Tt),m(3,se)],AHe);var n0i=class{constructor(){this._states=new WeakMap;this._checkedCount=0;this._onDidChange=new E;this.onDidChange=this._onDidChange.event}dispose(){this._onDidChange.dispose()}get checkedCount(){return this._checkedCount}isChecked(i){return this._states.get(i)??!1}updateChecked(i,e){let t=this._states.get(i);t!==e&&(t===void 0?e&&(this._checkedCount+=1):e?this._checkedCount+=1:this._checkedCount-=1,this._states.set(i,e),this._onDidChange.fire(i))}},r0i=class{constructor(i,e){this.parent=i;this.textEdit=e}};var s0i=class{constructor(i,e){this.uri=i;this.parent=e;this.type=0;this.textEdits=[];this.originalEdits=new Map}addEdit(i,e,t){this.type|=e,this.originalEdits.set(i,t),t instanceof nl?this.textEdits.push(new r0i(this,t)):e===8&&(this.newUri=t.newResource)}needsConfirmation(){for(let[,i]of this.originalEdits)if(!this.parent.checked.isChecked(i))return!0;return!1}},Z5t=class a{constructor(i=a._defaultMetadata){this.metadata=i;this.operationByResource=new Map}static{this._defaultMetadata=Object.freeze({label:d(5567,null),icon:R.symbolFile,needsConfirmation:!1})}static keyOf(i){return i?.label||"<default>"}get fileOperations(){return this.operationByResource.values()}},Aq=class{constructor(i,e,t){this._bulkEdit=i;this._fileService=e;this.checked=new n0i;this.fileOperations=[];this.categories=[];this.conflicts=t.createInstance(AHe,i)}static async create(i,e){return await i.get(F).createInstance(Aq,e)._init()}dispose(){this.checked.dispose(),this.conflicts.dispose()}async _init(){let i=new Map,e=new Map,t=new gt;for(let o=0;o<this._bulkEdit.length;o++){let n=this._bulkEdit[o],r,s;if(this.checked.updateChecked(n,!n.metadata?.needsConfirmation),n instanceof nl)s=1,r=n.resource;else if(n instanceof Cu)if(n.newResource&&n.oldResource){if(s=8,r=n.oldResource,n.options?.overwrite===void 0&&n.options?.ignoreIfExists&&await this._fileService.exists(r))continue;t.set(n.newResource,r)}else if(n.oldResource){if(s=4,r=n.oldResource,n.options?.ignoreIfNotExists&&!await this._fileService.exists(r))continue}else if(n.newResource){if(s=2,r=n.newResource,n.options?.overwrite===void 0&&n.options?.ignoreIfExists&&await this._fileService.exists(r))continue}else continue;else continue;let l=(p,h)=>{let g=ar.getComparisonKey(p,!0),f=h.get(g);!f&&t.has(p)&&(p=t.get(p),g=ar.getComparisonKey(p,!0),f=h.get(g)),f||(f=new s0i(p,this),h.set(g,f)),f.addEdit(o,s,n)};l(r,i);let c=Z5t.keyOf(n.metadata),u=e.get(c);u||(u=new Z5t(n.metadata),e.set(c,u)),l(r,u.operationByResource)}i.forEach(o=>this.fileOperations.push(o)),e.forEach(o=>this.categories.push(o));for(let o of this.fileOperations)if(o.type!==1){let n=!0;for(let r of o.originalEdits.values())r instanceof Cu&&(n=n&&this.checked.isChecked(r));if(!n)for(let r of o.originalEdits.values())this.checked.updateChecked(r,n)}return this.categories.sort((o,n)=>o.metadata.needsConfirmation===n.metadata.needsConfirmation?o.metadata.label.localeCompare(n.metadata.label):o.metadata.needsConfirmation?-1:1),this}getWorkspaceEdit(){let i=[],e=!0;for(let t=0;t<this._bulkEdit.length;t++){let o=this._bulkEdit[t];if(this.checked.isChecked(o)){i[t]=o;continue}e=!1}return e?this._bulkEdit:(C$(i),i)}async getFileEditOperation(i){let e=await i.options.contents;if(e)return Hn.replaceMove(z.lift({startLineNumber:0,startColumn:0,endLineNumber:Number.MAX_VALUE,endColumn:0}),e.toString())}async getFileEdits(i){for(let e of this.fileOperations)if(e.uri.toString()===i.toString()){let t=[],o=!1;for(let n of e.originalEdits.values())n instanceof Cu?t.push(this.getFileEditOperation(n)):n instanceof nl?this.checked.isChecked(n)&&t.push(Promise.resolve(Hn.replaceMove(z.lift(n.textEdit.range),n.textEdit.insertAsSnippet?eg.asInsertText(n.textEdit.text):n.textEdit.text))):this.checked.isChecked(n)||(o=!0);return o?[]:(await Promise.all(t)).filter(n=>n!==void 0).sort((n,r)=>z.compareRangesUsingStarts(n.range,r.range))}return[]}getUriOfEdit(i){for(let e of this.fileOperations)for(let t of e.originalEdits.values())if(t===i)return e.uri;throw new Error("invalid edit")}};Aq=I([m(1,fe),m(2,F)],Aq);var PU=class{constructor(i,e,t,o){this._operations=i;this._languageService=e;this._modelService=t;this._textModelResolverService=o;this._disposables=new N;this._modelPreviewEdits=new Map;this._instanceId=xt();this._disposables.add(this._textModelResolverService.registerTextModelContentProvider(PU.Schema,this)),this._ready=this._init()}static{this.Schema="vscode-bulkeditpreview-editor"}static{this.emptyPreview=A.from({scheme:this.Schema,fragment:"empty"})}static fromPreviewUri(i){return A.parse(i.query)}dispose(){this._disposables.dispose()}asPreviewUri(i){let e=i.scheme===Q.untitled?`/${i.path}`:i.path;return A.from({scheme:PU.Schema,authority:this._instanceId,path:e,query:i.toString()})}async _init(){for(let i of this._operations.fileOperations)await this._applyTextEditsToPreviewModel(i.uri);this._disposables.add(U.debounce(this._operations.checked.onDidChange,(i,e)=>e,ML)(i=>{let e=this._operations.getUriOfEdit(i);this._applyTextEditsToPreviewModel(e)}))}async _applyTextEditsToPreviewModel(i){let e=await this._getOrCreatePreviewModel(i),t=this._modelPreviewEdits.get(e.id);t&&e.applyEdits(t);let o=await this._operations.getFileEdits(i),n=e.applyEdits(o,!0);this._modelPreviewEdits.set(e.id,n)}async _getOrCreatePreviewModel(i){let e=this.asPreviewUri(i),t=this._modelService.getModel(e);if(!t){try{let o=await this._textModelResolverService.createModelReference(i),n=o.object.textEditorModel;t=this._modelService.createModel(Yx(n.createSnapshot()),this._languageService.createById(n.getLanguageId()),e),o.dispose()}catch{t=this._modelService.createModel("",this._languageService.createByFilepathOrFirstLine(e),e)}queueMicrotask(async()=>{this._disposables.add(await this._textModelResolverService.createModelReference(t.uri))})}return t}async provideTextContent(i){return i.toString()===PU.emptyPreview.toString()?this._modelService.createModel("",null,i):(await this._ready,this._modelService.getModel(i))}};PU=I([m(1,_t),m(2,Tt),m(3,Bt)],PU);var JT=class{constructor(i,e){this.parent=i;this.category=e}isChecked(){let i=this.parent,e=!0;for(let t of this.category.fileOperations)for(let o of t.originalEdits.values())e=e&&i.checked.isChecked(o);return e}setChecked(i){let e=this.parent;for(let t of this.category.fileOperations)for(let o of t.originalEdits.values())e.checked.updateChecked(o,i)}},ZT=class{constructor(i,e){this.parent=i;this.edit=e}isChecked(){let i=this.parent instanceof JT?this.parent.parent:this.parent,e=!0;this.edit.type===1&&(e=!this.edit.textEdits.every(t=>!i.checked.isChecked(t.textEdit)));for(let t of this.edit.originalEdits.values())t instanceof Cu&&(e=e&&i.checked.isChecked(t));if(this.parent instanceof JT&&this.edit.type===1){for(let t of i.categories)for(let o of t.fileOperations)if(o.uri.toString()===this.edit.uri.toString())for(let n of o.originalEdits.values())n instanceof Cu&&(e=e&&i.checked.isChecked(n))}return e}setChecked(i){let e=this.parent instanceof JT?this.parent.parent:this.parent;for(let t of this.edit.originalEdits.values())e.checked.updateChecked(t,i);if(this.parent instanceof JT&&this.edit.type!==1){for(let t of e.categories)for(let o of t.fileOperations)if(o.uri.toString()===this.edit.uri.toString())for(let n of o.originalEdits.values())e.checked.updateChecked(n,i)}}isDisabled(){if(this.parent instanceof JT&&this.edit.type===1){let i=this.parent.parent,e=!0;for(let t of i.categories)for(let o of t.fileOperations)if(o.uri.toString()===this.edit.uri.toString())for(let n of o.originalEdits.values())n instanceof Cu&&(e=e&&i.checked.isChecked(n));return!e}return!1}},GW=class{constructor(i,e,t,o,n,r,s){this.parent=i;this.idx=e;this.edit=t;this.prefix=o;this.selecting=n;this.inserting=r;this.suffix=s}isChecked(){let i=this.parent.parent;return i instanceof JT&&(i=i.parent),i.checked.isChecked(this.edit.textEdit)}setChecked(i){let e=this.parent.parent;if(e instanceof JT&&(e=e.parent),e.checked.updateChecked(this.edit.textEdit,i),i)for(let t of this.parent.edit.originalEdits.values())t instanceof Cu&&e.checked.updateChecked(t,i)}isDisabled(){return this.parent.isDisabled()}},NHe=class{constructor(i,e){this._textModelService=i;this._instantiationService=e;this.groupByFile=!0}hasChildren(i){return i instanceof ZT?i.edit.textEdits.length>0:!(i instanceof GW)}async getChildren(i){if(i instanceof Aq)return this.groupByFile?i.fileOperations.map(e=>new ZT(i,e)):i.categories.map(e=>new JT(i,e));if(i instanceof JT)return Array.from(i.category.fileOperations,e=>new ZT(i,e));if(i instanceof ZT&&i.edit.textEdits.length>0){let e,t;try{let n=await this._textModelService.createModelReference(i.edit.uri);e=n.object.textEditorModel,t=n}catch{e=this._instantiationService.createInstance(ip,"",$r,ip.DEFAULT_CREATION_OPTIONS,null),t=e}let o=i.edit.textEdits.map((n,r)=>{let s=e.validateRange(n.textEdit.textEdit.range),l=e.tokenization.getLineTokens(s.startLineNumber),c=23;for(let h=l.findTokenIndexAtOffset(s.startColumn-1)-1;c<50&&h>=0;h--)c=s.startColumn-l.getStartOffset(h);let u=e.tokenization.getLineTokens(s.endLineNumber),p=0;for(let h=u.findTokenIndexAtOffset(s.endColumn-1);p<50&&h<u.getCount();h++)p+=u.getEndOffset(h)-u.getStartOffset(h);return new GW(i,r,n,e.getValueInRange(new z(s.startLineNumber,s.startColumn-c,s.startLineNumber,s.startColumn)),e.getValueInRange(s),n.textEdit.textEdit.insertAsSnippet?eg.asInsertText(n.textEdit.textEdit.text):n.textEdit.textEdit.text,e.getValueInRange(new z(s.endLineNumber,s.endColumn,s.endLineNumber,s.endColumn+p)))});return t.dispose(),o}return[]}};NHe=I([m(0,Bt),m(1,F)],NHe);var e4t=class{compare(i,e){return i instanceof ZT&&e instanceof ZT?l0i(i.edit,e.edit):i instanceof GW&&e instanceof GW?z.compareRangesUsingStarts(i.edit.textEdit.textEdit.range,e.edit.textEdit.textEdit.range):0}};function l0i(a,i){return Hl(a.uri.toString(),i.uri.toString())}var OHe=class{constructor(i){this._labelService=i}getWidgetAriaLabel(){return d(5578,null)}getRole(i){return"checkbox"}getAriaLabel(i){if(i instanceof ZT){if(i.edit.textEdits.length>0)return i.edit.type&8&&i.edit.newUri?d(5576,null,this._labelService.getUriLabel(i.edit.uri,{relative:!0}),this._labelService.getUriLabel(i.edit.newUri,{relative:!0})):i.edit.type&2?d(5569,null,this._labelService.getUriLabel(i.edit.uri,{relative:!0})):i.edit.type&4?d(5572,null,this._labelService.getUriLabel(i.edit.uri,{relative:!0})):d(5573,null,this._labelService.getUriLabel(i.edit.uri,{relative:!0}));if(i.edit.type&8&&i.edit.newUri)return d(5575,null,this._labelService.getUriLabel(i.edit.uri,{relative:!0}),this._labelService.getUriLabel(i.edit.newUri,{relative:!0}));if(i.edit.type&2)return d(5568,null,this._labelService.getUriLabel(i.edit.uri,{relative:!0}));if(i.edit.type&4)return d(5571,null,this._labelService.getUriLabel(i.edit.uri,{relative:!0}))}if(i instanceof GW){if(i.selecting.length>0&&i.inserting.length>0)return d(5577,null,i.edit.textEdit.textEdit.range.startLineNumber,i.selecting,i.inserting);if(i.selecting.length>0&&i.inserting.length===0)return d(5570,null,i.edit.textEdit.textEdit.range.startLineNumber,i.selecting);if(i.selecting.length===0&&i.inserting.length>0)return d(5574,null,i.edit.textEdit.textEdit.range.startLineNumber,i.selecting)}return null}};OHe=I([m(0,rt)],OHe);var t4t=class{getId(i){return i instanceof ZT?i.edit.uri+(i.parent instanceof JT?JSON.stringify(i.parent.category.metadata):""):i instanceof GW?i.parent.edit.uri.toString()+i.idx:JSON.stringify(i.category.metadata)}},a0i=class{constructor(i){i.classList.add("category"),this.icon=document.createElement("div"),i.appendChild(this.icon),this.label=new Bc(i)}},y6=class{constructor(i){this._themeService=i;this.templateId=y6.id}static{this.id="CategoryElementRenderer"}renderTemplate(i){return new a0i(i)}renderElement(i,e,t){t.icon.style.setProperty("--background-dark",null),t.icon.style.setProperty("--background-light",null),t.icon.style.color="";let{metadata:o}=i.element.category;if(q.isThemeIcon(o.iconPath)){let n=q.asClassName(o.iconPath);t.icon.className=n?`theme-icon ${n}`:"",t.icon.style.color=o.iconPath.color?this._themeService.getColorTheme().getColor(o.iconPath.color.id)?.toString()??"":""}else A.isUri(o.iconPath)?(t.icon.className="uri-icon",t.icon.style.setProperty("--background-dark",Qa(o.iconPath)),t.icon.style.setProperty("--background-light",Qa(o.iconPath))):o.iconPath&&(t.icon.className="uri-icon",t.icon.style.setProperty("--background-dark",Qa(o.iconPath.dark)),t.icon.style.setProperty("--background-light",Qa(o.iconPath.light)));t.label.setLabel(o.label,o.description,{descriptionMatches:xa(i.filterData)})}disposeTemplate(i){i.label.dispose()}};y6=I([m(0,Le)],y6);var clt=class{constructor(i,e,t){this._labelService=t;this._disposables=new N;this._localDisposables=new N;this._checkbox=document.createElement("input"),this._checkbox.className="edit-checkbox",this._checkbox.type="checkbox",this._checkbox.setAttribute("role","checkbox"),i.appendChild(this._checkbox),this._label=e.create(i,{supportHighlights:!0}),this._details=document.createElement("span"),this._details.className="details",i.appendChild(this._details)}dispose(){this._localDisposables.dispose(),this._disposables.dispose(),this._label.dispose()}set(i,e){if(this._localDisposables.clear(),this._checkbox.checked=i.isChecked(),this._checkbox.disabled=i.isDisabled(),this._localDisposables.add(j(this._checkbox,"change",()=>{i.setChecked(this._checkbox.checked)})),i.edit.type&8&&i.edit.newUri)this._label.setResource({resource:i.edit.uri,name:d(5582,null,this._labelService.getUriLabel(i.edit.uri,{relative:!0}),this._labelService.getUriLabel(i.edit.newUri,{relative:!0}))},{fileDecorations:{colors:!0,badges:!1}}),this._details.innerText=d(5581,null);else{let t={matches:xa(e),fileKind:0,fileDecorations:{colors:!0,badges:!1},extraClasses:[]};i.edit.type&2?this._details.innerText=d(5579,null):i.edit.type&4?(this._details.innerText=d(5580,null),t.extraClasses.push("delete")):this._details.innerText="",this._label.setFile(i.edit.uri,t)}}};clt=I([m(2,rt)],clt);var w6=class{constructor(i,e){this._resourceLabels=i;this._labelService=e;this.templateId=w6.id}static{this.id="FileElementRenderer"}renderTemplate(i){return new clt(i,this._resourceLabels,this._labelService)}renderElement(i,e,t){t.set(i.element,i.filterData)}disposeTemplate(i){i.dispose()}};w6=I([m(1,rt)],w6);var dlt=class{constructor(i,e){this._themeService=e;this._disposables=new N;this._localDisposables=new N;i.classList.add("textedit"),this._checkbox=document.createElement("input"),this._checkbox.className="edit-checkbox",this._checkbox.type="checkbox",this._checkbox.setAttribute("role","checkbox"),i.appendChild(this._checkbox),this._icon=document.createElement("div"),i.appendChild(this._icon),this._label=this._disposables.add(new Ya(i))}dispose(){this._localDisposables.dispose(),this._disposables.dispose()}set(i){this._localDisposables.clear(),this._localDisposables.add(j(this._checkbox,"change",l=>{i.setChecked(this._checkbox.checked),l.preventDefault()})),i.parent.isChecked()?(this._checkbox.checked=i.isChecked(),this._checkbox.disabled=i.isDisabled()):(this._checkbox.checked=i.isChecked(),this._checkbox.disabled=i.isDisabled());let e="";e+=i.prefix,e+=i.selecting,e+=i.inserting,e+=i.suffix;let t={start:i.prefix.length,end:i.prefix.length+i.selecting.length,extraClasses:["remove"]},o={start:t.end,end:t.end+i.inserting.length,extraClasses:["insert"]},n,{metadata:r}=i.edit.textEdit;r&&r.description?n=d(5583,null,r.label,r.description):r&&(n=r.label);let s=r?.iconPath;if(!s)this._icon.style.display="none";else if(this._icon.style.display="block",this._icon.style.setProperty("--background-dark",null),this._icon.style.setProperty("--background-light",null),q.isThemeIcon(s)){let l=q.asClassName(s);this._icon.className=l?`theme-icon ${l}`:"",this._icon.style.color=s.color?this._themeService.getColorTheme().getColor(s.color.id)?.toString()??"":""}else A.isUri(s)?(this._icon.className="uri-icon",this._icon.style.setProperty("--background-dark",Qa(s)),this._icon.style.setProperty("--background-light",Qa(s))):(this._icon.className="uri-icon",this._icon.style.setProperty("--background-dark",Qa(s.dark)),this._icon.style.setProperty("--background-light",Qa(s.light)));this._label.set(e,[t,o],n,!0),this._icon.title=n||""}};dlt=I([m(1,Le)],dlt);var C6=class{constructor(i){this._themeService=i;this.templateId=C6.id}static{this.id="TextEditElementRenderer"}renderTemplate(i){return new dlt(i,this._themeService)}renderElement({element:i},e,t){t.set(i)}disposeTemplate(i){i.dispose()}};C6=I([m(0,Le)],C6);var i4t=class{getHeight(){return 23}getTemplateId(i){return i instanceof ZT?w6.id:i instanceof GW?C6.id:y6.id}},o4t=class{getKeyboardNavigationLabel(i){if(i instanceof ZT)return He(i.edit.uri);if(i instanceof JT)return i.category.metadata.label}};var Im=class extends Gs{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super({...e,titleMenuId:D.BulkEditTitle},h,g,f,u,p,t,v,b,S);this._instaService=t;this._editorService=o;this._labelService=n;this._textModelService=r;this._dialogService=s;this._contextMenuService=l;this._storageService=c;this._treeViewStates=new Map;this._disposables=new N;this._sessionDisposables=new N;this._computeResourceDiffEditorInputs=new lIe(async e=>{let t=new NI(async s=>{let l=s.uri,c=this._currentProvider.asPreviewUri(l);if(s.type&4)return{original:{resource:A.revive(c)},modified:{resource:void 0},goToFileResource:s.uri};{let u;try{(await this._textModelService.createModelReference(l)).dispose(),u=l}catch{u=PU.emptyPreview}return{original:{resource:A.revive(u)},modified:{resource:A.revive(c)},goToFileResource:u}}}),o=e.slice().sort(l0i),n=[];for(let s of o)n.push(await t.get(s));return{resources:n,getResourceDiffEditorInputIdOfOperation:async s=>{let l=await t.get(s);return{original:l.original.resource,modified:l.modified.resource}}}});this.element.classList.add("bulk-edit-panel","show-file-icons"),this._ctxHasCategories=Im.ctxHasCategories.bindTo(u),this._ctxGroupByFile=Im.ctxGroupByFile.bindTo(u),this._ctxHasCheckedChanges=Im.ctxHasCheckedChanges.bindTo(u)}static{this.ID="refactorPreview"}static{this.Schema="vscode-bulkeditpreview-multieditor"}static{this.ctxHasCategories=new Y("refactorPreview.hasCategories",!1)}static{this.ctxGroupByFile=new Y("refactorPreview.groupByFile",!0)}static{this.ctxHasCheckedChanges=new Y("refactorPreview.hasCheckedChanges",!0)}static{this._memGroupByFile=`${this.ID}.groupByFile`}dispose(){this._tree.dispose(),this._disposables.dispose(),this._sessionDisposables.dispose(),super.dispose()}renderBody(e){super.renderBody(e);let t=this._instaService.createInstance(Nl,{onDidChangeVisibility:this.onDidChangeBodyVisibility});this._disposables.add(t);let o=document.createElement("div");o.className="content",e.appendChild(o);let n=document.createElement("div");o.appendChild(n),this._treeDataSource=this._instaService.createInstance(NHe),this._treeDataSource.groupByFile=this._storageService.getBoolean(Im._memGroupByFile,0,!0),this._ctxGroupByFile.set(this._treeDataSource.groupByFile),this._tree=this._instaService.createInstance(rp,this.id,n,new i4t,[this._instaService.createInstance(C6),this._instaService.createInstance(w6,t),this._instaService.createInstance(y6)],this._treeDataSource,{accessibilityProvider:this._instaService.createInstance(OHe),identityProvider:new t4t,expandOnlyOnTwistieClick:!0,multipleSelectionSupport:!1,keyboardNavigationLabelProvider:new o4t,sorter:new e4t,selectionNavigation:!0}),this._disposables.add(this._tree.onContextMenu(this._onContextMenu,this)),this._disposables.add(this._tree.onDidOpen(u=>this._openElementInMultiDiffEditor(u)));let r=document.createElement("div");r.className="buttons",o.appendChild(r);let s=new Sw(r);this._disposables.add(s);let l=s.addButton({supportIcons:!0,...Qo});l.label=d(5566,null),l.onDidClick(()=>this.accept(),this,this._disposables);let c=s.addButton({...Qo,secondary:!0});c.label=d(5562,null),c.onDidClick(()=>this.discard(),this,this._disposables),this._message=document.createElement("span"),this._message.className="message",this._message.innerText=d(5565,null),e.appendChild(this._message),this._setState("message")}layoutBody(e,t){super.layoutBody(e,t);let o=e-50;this._tree.getHTMLElement().parentElement.style.height=`${o}px`,this._tree.layout(o,t)}_setState(e){this.element.dataset.state=e}async setInput(e,t){this._setState("data"),this._sessionDisposables.clear(),this._treeViewStates.clear(),this._currentResolve&&(this._currentResolve(void 0),this._currentResolve=void 0);let o=await this._instaService.invokeFunction(Aq.create,e);this._currentProvider=this._instaService.createInstance(PU,o),this._sessionDisposables.add(this._currentProvider),this._sessionDisposables.add(o);let n=o.categories.length>1;return this._ctxHasCategories.set(n),this._treeDataSource.groupByFile=!n||this._treeDataSource.groupByFile,this._ctxHasCheckedChanges.set(o.checked.checkedCount>0),this._currentInput=o,new Promise(r=>{t.onCancellationRequested(()=>r(void 0)),this._currentResolve=r,this._setTreeInput(o),this._sessionDisposables.add(o.checked.onDidChange(()=>{this._tree.updateChildren(),this._ctxHasCheckedChanges.set(o.checked.checkedCount>0)}))})}hasInput(){return!!this._currentInput}async _setTreeInput(e){let t=this._treeViewStates.get(this._treeDataSource.groupByFile);if(await this._tree.setInput(e,t),this._tree.domFocus(),t)return;let o=[...this._tree.getNode(e).children].slice(0,10);for(;o.length>0;){let{element:n}=o.shift();n instanceof ZT&&await this._tree.expand(n,!0),n instanceof JT&&(await this._tree.expand(n,!0),o.push(...this._tree.getNode(n).children))}}accept(){let e=this._currentInput?.conflicts.list();if(!e||e.length===0){this._done(!0);return}let t;e.length===1?t=d(5563,null,this._labelService.getUriLabel(e[0],{relative:!0})):t=d(5564,null,e.length),this._dialogService.warn(t).finally(()=>this._done(!1))}discard(){this._done(!1)}_done(e){this._currentResolve?.(e?this._currentInput?.getWorkspaceEdit():void 0),this._currentInput=void 0,this._setState("message"),this._sessionDisposables.clear()}toggleChecked(){let[e]=this._tree.getFocus();((e instanceof ZT||e instanceof GW)&&!e.isDisabled()||e instanceof JT)&&e.setChecked(!e.isChecked())}groupByFile(){this._treeDataSource.groupByFile||this.toggleGrouping()}groupByType(){this._treeDataSource.groupByFile&&this.toggleGrouping()}toggleGrouping(){let e=this._tree.getInput();if(e){let t=this._tree.getViewState();this._treeViewStates.set(this._treeDataSource.groupByFile,t),this._treeDataSource.groupByFile=!this._treeDataSource.groupByFile,this._setTreeInput(e),this._storageService.store(Im._memGroupByFile,this._treeDataSource.groupByFile,0,0),this._ctxGroupByFile.set(this._treeDataSource.groupByFile)}}async _openElementInMultiDiffEditor(e){let t=this._currentInput?.fileOperations;if(!t)return;let o,n;if(e.element instanceof GW)n=e.element.parent,o=e.element.edit.textEdit.textEdit.range;else if(e.element instanceof ZT)n=e.element,o=e.element.edit.textEdits[0]?.textEdit.textEdit.range;else return;let r=await this._computeResourceDiffEditorInputs.get(t),s=await r.getResourceDiffEditorInputIdOfOperation(n.edit),l={...e.editorOptions,viewState:{revealData:{resource:s,range:o}}},c=A.from({scheme:Im.Schema}),u="Refactor Preview";this._editorService.openEditor({multiDiffSource:c,label:u,options:l,isTransient:!0,description:u,resources:r.resources},e.sideBySide?In:jn)}_onContextMenu(e){this._contextMenuService.showContextMenu({menuId:D.BulkEditContext,contextKeyService:this.contextKeyService,getAnchor:()=>e.anchor})}};Im=I([m(1,F),m(2,ee),m(3,rt),m(4,Bt),m(5,at),m(6,Xe),m(7,ce),m(8,X),m(9,Bi),m(10,_e),m(11,Xe),m(12,B),m(13,Je),m(14,Le),m(15,nt)],Im);async function Lve(a){let i=await a.openView(Im.ID,!0);if(i instanceof Im)return i}var ult=class{constructor(i,e){this._paneCompositeService=i;this._editorGroupsService=e;this._activePanel=i.getActivePaneComposite(1)?.getId()}async restore(i,e){if(i&&(typeof this._activePanel=="string"?await this._paneCompositeService.openPaneComposite(this._activePanel,1):this._paneCompositeService.hideActivePaneComposite(1)),e)for(let t of this._editorGroupsService.groups){let o=[];for(let n of t.editors)po.getCanonicalUri(n,{supportSideBySide:1})?.scheme===Im.Schema&&o.push(n);o.length&&t.closeEditors(o,{preserveFocus:!0})}}};ult=I([m(0,us),m(1,wt)],ult);var n4t=class{constructor(i,e=new Ye){this.uxState=i;this.cts=e}},e_=class{constructor(i,e,t,o,n,r){this._paneCompositeService=i;this._viewsService=e;this._editorGroupsService=t;this._dialogService=o;n.setPreviewHandler(s=>this._previewEdit(s)),this._ctxEnabled=e_.ctxEnabled.bindTo(r)}static{this.ID="workbench.contrib.bulkEditPreview"}static{this.ctxEnabled=new Y("refactorPreview.enabled",!1)}async _previewEdit(i){this._ctxEnabled.set(!0);let e=this._activeSession?.uxState??new ult(this._paneCompositeService,this._editorGroupsService),t=await Lve(this._viewsService);if(!t)return this._ctxEnabled.set(!1),i;if(t.hasInput()){let{confirmed:n}=await this._dialogService.confirm({type:bt.Info,message:d(5558,null),detail:d(5554,null),primaryButton:d(5553,null)});if(!n)return[]}let o;this._activeSession?(await this._activeSession.uxState.restore(!1,!0),this._activeSession.cts.dispose(!0),o=new n4t(e)):o=new n4t(e),this._activeSession=o;try{return await t.setInput(i,o.cts.token)??[]}finally{this._activeSession===o&&(await this._activeSession.uxState.restore(!0,!0),this._activeSession.cts.dispose(),this._ctxEnabled.set(!1),this._activeSession=void 0)}}};e_=I([m(0,us),m(1,$t),m(2,wt),m(3,at),m(4,La),m(5,X)],e_);W(class extends K{constructor(){super({id:"refactorPreview.apply",title:L(5551,"Apply Refactoring"),category:L(5552,"Refactor Preview"),icon:R.check,precondition:C.and(e_.ctxEnabled,Im.ctxHasCheckedChanges),menu:[{id:D.BulkEditContext,order:1}],keybinding:{weight:90,when:C.and(e_.ctxEnabled,ql.isEqualTo(Im.ID)),primary:2051}})}async run(i){let e=i.get($t);(await Lve(e))?.accept()}});W(class extends K{constructor(){super({id:"refactorPreview.discard",title:L(5555,"Discard Refactoring"),category:L(5552,"Refactor Preview"),icon:R.clearAll,precondition:e_.ctxEnabled,menu:[{id:D.BulkEditContext,order:2}]})}async run(i){let e=i.get($t);(await Lve(e))?.discard()}});W(class extends K{constructor(){super({id:"refactorPreview.toggleCheckedState",title:L(5561,"Toggle Change"),category:L(5552,"Refactor Preview"),precondition:e_.ctxEnabled,keybinding:{weight:200,when:vc,primary:10},menu:{id:D.BulkEditContext,group:"navigation"}})}async run(i){let e=i.get($t);(await Lve(e))?.toggleChecked()}});W(class extends K{constructor(){super({id:"refactorPreview.groupByFile",title:L(5556,"Group Changes By File"),category:L(5552,"Refactor Preview"),icon:R.ungroupByRefType,precondition:C.and(Im.ctxHasCategories,Im.ctxGroupByFile.negate(),e_.ctxEnabled),menu:[{id:D.BulkEditTitle,when:C.and(Im.ctxHasCategories,Im.ctxGroupByFile.negate()),group:"navigation",order:3}]})}async run(i){let e=i.get($t);(await Lve(e))?.groupByFile()}});W(class extends K{constructor(){super({id:"refactorPreview.groupByType",title:L(5557,"Group Changes By Type"),category:L(5552,"Refactor Preview"),icon:R.groupByRefType,precondition:C.and(Im.ctxHasCategories,Im.ctxGroupByFile,e_.ctxEnabled),menu:[{id:D.BulkEditTitle,when:C.and(Im.ctxHasCategories,Im.ctxGroupByFile),group:"navigation",order:3}]})}async run(i){let e=i.get($t);(await Lve(e))?.groupByType()}});W(class extends K{constructor(){super({id:"refactorPreview.toggleGrouping",title:L(5557,"Group Changes By Type"),category:L(5552,"Refactor Preview"),icon:R.listTree,toggled:Im.ctxGroupByFile.negate(),precondition:C.and(Im.ctxHasCategories,e_.ctxEnabled),menu:[{id:D.BulkEditContext,order:3}]})}async run(i){let e=i.get($t);(await Lve(e))?.toggleGrouping()}});It(e_.ID,e_,St.BlockRestore);var tTo=Ae("refactor-preview-view-icon",R.lightbulb,d(5560,null)),_pn=ne.as(Mn.ViewContainersRegistry).registerViewContainer({id:Im.ID,title:L(5559,"Refactor Preview"),hideIfEmpty:!0,ctorDescriptor:new Ft(Dc,[Im.ID,{mergeViewWithContainerWhenSingleView:!0}]),icon:tTo,storageId:Im.ID},1);ne.as(Mn.ViewsRegistry).registerViews([{id:Im.ID,name:L(5559,"Refactor Preview"),when:e_.ctxEnabled,ctorDescriptor:new Ft(Im),containerIcon:tTo}],_pn);function Dpn(a){if(a.isUndoing||a.isRedoing||a.isFlush)return!1;for(let i of a.detailedReasons)if(!Rpn(i))return!1;return a.detailedReasons.length>0}var Lpn=new Set(["type","paste","cut","executeCommands","executeCommand","compositionType","compositionEnd"]);function Rpn(a){let i=a.metadata;if(i.source!=="cursor")return!1;let e=i.kind;return Lpn.has(e)}var c0i=class extends x{constructor(e){super();this._model=e;this._trackedWord=Me(this,void 0);this.trackedWord=this._trackedWord;this._capturedWord=void 0;this._lastWordBeforeEdit=void 0;this._pendingContentChange=!1;this._lastCursorPosition=void 0;this._register(this._model.onDidChangeContent(t=>{if(!Dpn(t)){let o=this._lastCursorPosition;this.reset(),o!==void 0&&this.updateCursorPosition(o);return}this._pendingContentChange=!0}))}updateCursorPosition(e){this._lastCursorPosition=e;let t=this._model.getWordAtPosition(e);if(!t){this._lastWordBeforeEdit=void 0,this._pendingContentChange=!1;return}if(this._isPositionInComment(e)){this._lastWordBeforeEdit=void 0,this._pendingContentChange=!1;return}let o={word:t.word,range:new z(e.lineNumber,t.startColumn,e.lineNumber,t.endColumn),position:e},n=this._pendingContentChange;if(this._pendingContentChange=!1,!n){this._lastWordBeforeEdit=o;return}if(!this._capturedWord){let l=this._lastWordBeforeEdit??o;this._capturedWord={...l},this._trackedWord.set({model:this._model,originalWord:l.word,originalPosition:l.position,originalRange:l.range,currentWord:o.word,currentRange:o.range},void 0),this._lastWordBeforeEdit=o;return}let r=this._capturedWord;if(this._rangesOverlap(r.range,o.range)||this._isAdjacent(r.range,o.range))this._trackedWord.set({model:this._model,originalWord:r.word,originalPosition:r.position,originalRange:r.range,currentWord:o.word,currentRange:o.range},void 0);else{let l=this._lastWordBeforeEdit??o;this._capturedWord={...l},this._trackedWord.set({model:this._model,originalWord:l.word,originalPosition:l.position,originalRange:l.range,currentWord:o.word,currentRange:o.range},void 0)}this._lastWordBeforeEdit=o}reset(){this._trackedWord.set(void 0,void 0),this._capturedWord=void 0,this._lastWordBeforeEdit=void 0,this._pendingContentChange=!1,this._lastCursorPosition=void 0}_isPositionInComment(e){this._model.tokenization.tokenizeIfCheap(e.lineNumber);let t=this._model.tokenization.getLineTokens(e.lineNumber),o=t.findTokenIndexAtOffset(e.column-1);return t.getStandardTokenType(o)===1}_rangesOverlap(e,t){return e.startLineNumber!==t.startLineNumber?!1:!(e.endColumn<t.startColumn||t.endColumn<e.startColumn)}_isAdjacent(e,t){return e.startLineNumber!==t.startLineNumber?!1:e.endColumn===t.startColumn||t.endColumn===e.startColumn}},plt=class extends x{constructor(e,t){super();this._codeEditorService=e;this._modelService=t;this._modelTrackers=new Map;this._editorFocusTrackingDisposables=new Map;this._focusedModelTracker=Me(this,void 0);this.trackedWord=ke(this,e=>this._focusedModelTracker.read(e)?.trackedWord.read(e));for(let o of this._codeEditorService.listCodeEditors())this._setupEditorTracking(o);this._register(this._codeEditorService.onCodeEditorAdd(o=>{this._setupEditorTracking(o)})),this._register(this._codeEditorService.onCodeEditorRemove(o=>{let n=this._editorFocusTrackingDisposables.get(o);n&&(n.dispose(),this._editorFocusTrackingDisposables.delete(o))})),this._register(this._modelService.onModelRemoved(o=>{let n=this._modelTrackers.get(o);n&&(n.dispose(),this._modelTrackers.delete(o))}))}_setupEditorTracking(e){if(!e.isSimpleWidget&&!this._editorFocusTrackingDisposables.has(e)){let t=gs(e),o=be(n=>{let r=t.isFocused.read(n),s=t.model.read(n),l=t.cursorPosition.read(n);if(!r||!s)return;let c=this._modelTrackers.get(s);c||(c=new c0i(s),this._modelTrackers.set(s,c)),this._focusedModelTracker.read(void 0)!==c&&this._focusedModelTracker.set(c,void 0),l&&c.updateCursorPosition(l)});this._editorFocusTrackingDisposables.set(e,o)}}dispose(){for(let e of this._modelTrackers.values())e.dispose();this._modelTrackers.clear();for(let e of this._editorFocusTrackingDisposables.values())e.dispose();this._editorFocusTrackingDisposables.clear(),super.dispose()}};plt=I([m(0,qt),m(1,Tt)],plt);Ee(Tkt,plt,1);var Rve=class a extends O0e{static{this.GO_TO_LINE_PREFIX=":"}static{this.GO_TO_OFFSET_PREFIX="::"}static{this.ZERO_BASED_OFFSET_STORAGE_KEY="gotoLine.useZeroBasedOffset"}constructor(){super({canAcceptInBackground:!0})}get useZeroBasedOffset(){return this.storageService.getBoolean(a.ZERO_BASED_OFFSET_STORAGE_KEY,-1,!1)}set useZeroBasedOffset(i){this.storageService.store(a.ZERO_BASED_OFFSET_STORAGE_KEY,i,-1,0)}provideWithoutTextEditor(i){let e=d(1505,null);return i.items=[{label:e}],i.ariaLabel=e,x.None}provideWithTextEditor(i,e,t){let o=i.editor,n=new N;e.ariaLabel=d(1499,null),n.add(e.onDidAccept(c=>{let[u]=e.selectedItems;if(u){if(!u.lineNumber)return;this.gotoLocation(i,{range:this.toRange(u.lineNumber,u.column),keyMods:e.keyMods,preserveFocus:c.inBackground}),c.inBackground||e.hide()}}));let r={iconClass:q.asClassName(R.indexZero),tooltip:d(1508,null),location:3,toggle:{checked:this.useZeroBasedOffset}},s=()=>{let c=e.value.trim().substring(a.GO_TO_LINE_PREFIX.length),{inOffsetMode:u,lineNumber:p,column:h,label:g}=this.parsePosition(o,c);if(e.buttons=u?[r]:[],e.items=[{lineNumber:p,column:h,label:g,ariaLabel:p?d(1502,null,p,h||1):g}],!p){this.clearDecorations(o);return}let f=this.toRange(p,h);o.revealRangeInCenter(f,0),this.addDecorations(o,f)};n.add(e.onDidTriggerButton(c=>{c===r&&(this.useZeroBasedOffset=c.toggle?.checked??!this.useZeroBasedOffset,s())})),s(),n.add(e.onDidChangeValue(()=>s()));let l=ha(o);return l&&l.getOptions().get(76).renderType===2&&(l.updateOptions({lineNumbers:"on"}),n.add(Z(()=>l.updateOptions({lineNumbers:"relative"})))),n}toRange(i=1,e=1){return{startLineNumber:i,startColumn:e,endLineNumber:i,endColumn:e}}parsePosition(i,e){let t=this.getModel(i);if(!t)return{label:d(1505,null)};if(e.startsWith(":")){let o=parseInt(e.substring(1),10),n=t.getValueLength();if(isNaN(o))return{inOffsetMode:!0,label:this.useZeroBasedOffset?d(1507,null,n-1):d(1506,null,n)};{let r=o<0;this.useZeroBasedOffset||(o-=Math.sign(o)),r&&(o+=n);let s=t.getPositionAt(o),l=fl.visibleColumnFromColumn(t.getLineContent(s.lineNumber),s.column,t.getOptions().tabSize)+1;return{...s,inOffsetMode:!0,label:d(1501,null,s.lineNumber,l)}}}else{let o=e.split(/,|:|#/),n=t.getLineCount(),r=parseInt(o[0]?.trim(),10);if(o.length<1||isNaN(r))return{label:d(1504,null,n)};r=r>=0?r:n+1+r,r=Math.min(Math.max(1,r),n);let s=t.getOptions().tabSize,l=t.getLineContent(r),c=fl.visibleColumnFromColumn(l,t.getLineMaxColumn(r),s)+1,u=parseInt(o[1]?.trim(),10);if(o.length<2||isNaN(u))return{lineNumber:r,column:1,label:o.length<2?d(1503,null,r):d(1500,null,r,c)};u=u>=0?u:c+u,u=Math.min(Math.max(1,u),c);let p=fl.columnFromVisibleColumn(l,u-1,s);return{lineNumber:r,column:p,label:d(1501,null,r,u)}}}};var oTo="replacePreview",iTo=a=>a.with({scheme:Q.internal,fragment:oTo,query:JSON.stringify({scheme:a.scheme})}),Mpn=a=>a.with({scheme:JSON.parse(a.query).scheme,fragment:"",query:""}),Mve=class{constructor(i,e){this.instantiationService=i;this.textModelResolverService=e;this.textModelResolverService.registerTextModelContentProvider(Q.internal,this)}static{this.ID="workbench.contrib.replacePreviewContentProvider"}provideTextContent(i){return i.fragment===oTo?this.instantiationService.createInstance(mlt).resolve(i):null}};Mve=I([m(0,F),m(1,Bt)],Mve);var mlt=class extends x{constructor(e,t,o,n,r){super();this.modelService=e;this.languageService=t;this.textModelResolverService=o;this.replaceService=n;this.searchWorkbenchService=r}async resolve(e){let t=Mpn(e),o=this.searchWorkbenchService.searchModel.searchResult.matches(!1).filter(c=>c.resource.toString()===t.toString())[0],r=this._register(await this.textModelResolverService.createModelReference(t)).object.textEditorModel,s=r.getLanguageId(),l=this.modelService.createModel(Yx(r.createSnapshot()),this.languageService.createById(s),e);return this._register(o.onChange(({forceUpdateModel:c})=>this.update(r,l,o,c))),this._register(this.searchWorkbenchService.searchModel.onReplaceTermChanged(()=>this.update(r,l,o))),this._register(o.onDispose(()=>l.dispose())),this._register(l.onWillDispose(()=>this.dispose())),this._register(r.onWillDispose(()=>this.dispose())),l}update(e,t,o,n=!1){!e.isDisposed()&&!t.isDisposed()&&this.replaceService.updateReplacePreview(o,n)}};mlt=I([m(0,Tt),m(1,_t),m(2,Bt),m(3,EI),m(4,Yoe)],mlt);var x6=class{constructor(i,e,t,o,n,r){this.textFileService=i;this.editorService=e;this.textModelResolverService=t;this.bulkEditorService=o;this.labelService=n;this.notebookEditorModelResolverService=r}static{this.REPLACE_SAVE_SOURCE=Ih.registerSource("searchReplace.source",d(13842,null))}async replace(i,e=void 0,t=null){let o=this.createEdits(i,t);await this.bulkEditorService.apply(o,{progress:e});let n=o.map(async r=>{if(r.resource.scheme===Q.vscodeNotebookCell){let s=Zo.parse(r.resource)?.notebook;if(s){let l;try{l=await this.notebookEditorModelResolverService.resolve(s),await l.object.save({source:x6.REPLACE_SAVE_SOURCE})}finally{l?.dispose()}}return}else return this.textFileService.files.get(r.resource)?.save({source:x6.REPLACE_SAVE_SOURCE})});return dn.settled(n)}async openReplacePreview(i,e,t,o){let n=el(i)?i.parent():i,r=await this.editorService.openEditor({original:{resource:n.resource},modified:{resource:iTo(n.resource)},label:d(13841,null,n.name(),n.name()),description:this.labelService.getUriLabel(ci(n.resource),{relative:!0}),options:{preserveFocus:e,pinned:o,revealIfVisible:!0}}),s=r?.input,l=n.onDispose(()=>{s?.dispose(),l.dispose()});if(await this.updateReplacePreview(n),r){let c=r.getControl();el(i)&&c&&c.revealLineInCenter(i.range().startLineNumber,1)}}async updateReplacePreview(i,e=!1){let t=iTo(i.resource),[o,n]=await Promise.all([this.textModelResolverService.createModelReference(i.resource),this.textModelResolverService.createModelReference(t)]),r=o.object.textEditorModel,s=n.object.textEditorModel;try{r&&s&&(e?s.setValue(r.getValue()):s.undo(),this.applyEditsToPreview(i,s))}finally{o.dispose(),n.dispose()}}applyEditsToPreview(i,e){let t=this.createEdits(i,e.uri),o=[];for(let n of t)o.push(Hn.replaceMove(z.lift(n.textEdit.range),n.textEdit.text));e.pushEditOperations([],o.sort((n,r)=>z.compareRangesUsingStarts(n.range,r.range)),()=>[])}createEdits(i,e=null){let t=[];if(el(i)&&!i.isReadonly)if(CU(i)){let o=i;t.push(this.createEdit(o,o.replaceString,o.cell?.uri))}else{let o=i;t.push(this.createEdit(o,o.replaceString,e))}return _l(i)&&(i=[i]),i instanceof Array&&i.forEach(o=>{let n=o;n.count()>0&&t.push(...n.matches().flatMap(r=>this.createEdits(r,e)))}),t}createEdit(i,e,t=null){let o=i.parent();return new nl(t??o.resource,{range:i.range(),text:e},void 0,void 0)}};x6=I([m(0,Uo),m(1,ee),m(2,Bt),m(3,La),m(4,rt),m(5,yh)],x6);function nTo(){Ee(EI,x6,1),It(Mve.ID,Mve,St.BlockStartup)}var r4t=le("notebookSearchService");var FHe=class{constructor(i,e,t,o,n,r,s,l){this.uriIdentityService=i;this.notebookEditorService=e;this.logService=t;this.notebookService=o;this.configurationService=n;this.editorResolverService=r;this.searchService=s;this.queryBuilder=l.createInstance(kS)}notebookSearch(i,e,t,o){if(i.type!==2)return{openFilesToScan:new En,completeData:Promise.resolve({messages:[],limitHit:!1,results:[]}),allScannedFiles:Promise.resolve(new En)};let n=this.getLocalNotebookWidgets(),r=n.map(c=>c.viewModel.uri),l=(()=>{let c=Date.now(),u=this.getLocalNotebookResults(i,e??Se.None,n,t),p=Date.now(),h=this.configurationService.getValue("search").experimental?.closedNotebookRichContentResults??!1,g=Promise.resolve(void 0);h&&(g=this.getClosedNotebookResults(i,new En(r,v=>this.uriIdentityService.extUri.getComparisonKey(v)),e??Se.None));let f=Promise.all([u,g]);return{completeData:f.then(v=>{let b=v[0],S=v[1],y=v.filter(T=>!!T),w=[...b.results.values(),...S?.results.values()??[]],k=di(w);return o&&k.forEach(o),this.logService.trace(`local notebook search time | ${p-c}ms`),{messages:[],limitHit:y.reduce((T,P)=>T||P.limitHit,!1),results:k}}),allScannedFiles:f.then(v=>{let b=v[0],S=v[1],y=di([...b.results.keys(),...S?.results.keys()??[]]);return new En(y,w=>this.uriIdentityService.extUri.getComparisonKey(w))})}})();return{openFilesToScan:new En(r),completeData:l.completeData,allScannedFiles:l.allScannedFiles}}async doesFileExist(i,e,t){let o=i.map(async n=>{let r=this.queryBuilder.file(e.map(s=>s.folder),{includePattern:n.startsWith("/")?n:"**/"+n,exists:!0,onlyFileScheme:!0});return this.searchService.fileSearch(r,t).then(s=>!!s.limitHit)});return Promise.any(o)}async getClosedNotebookResults(i,e,t){let o=this.editorResolverService.getAllUserAssociations(),n=new Map,r=this.notebookService.getContributedNotebookTypes();o.forEach(v=>{if(!v.filenamePattern)return;let b={isFromSettings:!0,filenamePatterns:[v.filenamePattern]},S=n.get(v.viewType);S?n.set(v.viewType,S.concat(b)):n.set(v.viewType,[b])});let s=[];r.forEach(v=>{v.selectors.length>0&&s.push((async()=>{let b=v.selectors.map(y=>(y.include||y).toString());if(await this.doesFileExist(b,i.folderQueries,t))return await this.notebookService.canResolve(v.id)?await(await this.notebookService.withNotebookDataProvider(v.id)).serializer.searchInNotebooks(i,t,n):void 0})())});let l=Date.now(),c=di(await Promise.all(s)),u=c.flatMap(v=>v.results),p=c.some(v=>v.limitHit),h=new gt(v=>this.uriIdentityService.extUri.getComparisonKey(v)),g=0;for(let v of u){if(i.maxResults&&g>=i.maxResults){p=!0;break}!e.has(v.resource)&&!h.has(v.resource)&&(h.set(v.resource,v.cellResults.length>0?v:null),g++)}let f=Date.now();return this.logService.trace(`query: ${i.contentPattern.pattern}`),this.logService.trace(`closed notebook search time | ${f-l}ms`),{results:h,limitHit:p}}async getLocalNotebookResults(i,e,t,o){let n=new gt(s=>this.uriIdentityService.extUri.getComparisonKey(s)),r=!1;for(let s of t){if(!s.hasModel())continue;let l=(Yo(i.maxResults)?i.maxResults:K4)+1,c=s.viewModel.uri;if(!zue(i,c.fsPath))continue;let u=await s.find(i.contentPattern.pattern,{regex:i.contentPattern.isRegExp,wholeWord:i.contentPattern.isWordMatch,caseSensitive:i.contentPattern.isCaseSensitive,includeMarkupInput:i.contentPattern.notebookInfo?.isInNotebookMarkdownInput??!0,includeMarkupPreview:i.contentPattern.notebookInfo?.isInNotebookMarkdownPreview??!0,includeCodeInput:i.contentPattern.notebookInfo?.isInNotebookCellInput??!0,includeOutput:i.contentPattern.notebookInfo?.isInNotebookCellOutput??!0},e,!1,!0,o);if(u.length){l&&u.length>=l&&(r=!0,u=u.slice(0,l-1));let p=u.map(g=>{let f=x$t(g.contentMatches,g.cell),v=k$t(g.webviewMatches);return{cell:g.cell,index:g.index,contentResults:f,webviewResults:v}}),h={resource:c,cellResults:p};n.set(c,h)}else n.set(c,null)}return{results:n,limitHit:r}}getLocalNotebookWidgets(){return this.notebookEditorService.retrieveAllExistingWidgets().map(e=>e.value).filter(e=>!!e&&e.hasModel())}};FHe=I([m(0,ht),m(1,Gc),m(2,se),m(3,bn),m(4,B),m(5,Ka),m(6,gg),m(7,F)],FHe);function rTo(){Ee(r4t,FHe,1)}var hlt=class{constructor(i,e,t){this._hasParameters=!1;this._replacePattern=i;let o,n;typeof e=="boolean"?(n=e,this._regExp=t):(o=e,n=!!o.isRegExp,this._regExp=N$(o.pattern,!!o.isRegExp,{matchCase:o.isCaseSensitive,wholeWord:o.isWordMatch,multiline:o.isMultiline,global:!1,unicode:!0})),n&&this.parseReplaceString(i),this._regExp.global&&(this._regExp=N$(this._regExp.source,!0,{matchCase:!this._regExp.ignoreCase,wholeWord:!1,multiline:this._regExp.multiline,global:!1})),this._caseOpsRegExp=new RegExp(/([\s\S]*?)((?:\\[uUlL])+?|)(\$[0-9]+)([\s\S]*?)/g)}get hasParameters(){return this._hasParameters}get pattern(){return this._replacePattern}get regExp(){return this._regExp}getReplaceString(i,e){this._regExp.lastIndex=0;let t=this._regExp.exec(i);if(t){if(this.hasParameters){let o=this.replaceWithCaseOperations(i,this._regExp,this.buildReplaceString(t,e));return t[0]===i?o:o.substr(t.index,t[0].length-(i.length-o.length))}return this.buildReplaceString(t,e)}return null}replaceWithCaseOperations(i,e,t){if(!/\\[uUlL]/.test(t))return i.replace(e,t);let o=e.exec(i);if(o===null)return i.replace(e,t);let n,r="",s=0,l="";for(;(n=this._caseOpsRegExp.exec(t))!==null;){s=n.index;let c=n[0];l=c;let u=n[2],p=n[3];if(!u){r+=c;continue}let h=o[parseInt(p.slice(1))];if(!h){r+=c;continue}let g=h.length;r+=n[1],u=u.replace(/\\/g,"");let f=0;for(;f<u.length;f++)switch(u[f]){case"U":r+=h.slice(f).toUpperCase(),f=g;break;case"u":r+=h[f].toUpperCase();break;case"L":r+=h.slice(f).toLowerCase(),f=g;break;case"l":r+=h[f].toLowerCase();break}f<g&&(r+=h.slice(f)),r+=n[4]}return r+=t.slice(s+l.length),i.replace(e,r)}buildReplaceString(i,e){return e?p3e(i,this._replacePattern):this._replacePattern}parseReplaceString(i){if(!i||i.length===0)return;let e=0,t="";for(let o=0,n=i.length;o<n;o++){let r=i.charCodeAt(o);if(r===92){if(o++,o>=n)break;let s=i.charCodeAt(o),l=null;switch(s){case 92:l="\\";break;case 110:l=`
`;break;case 116:l="	";break}l&&(t+=i.substring(e,o-1)+l,e=o+1)}if(r===36){if(o++,o>=n)break;let s=i.charCodeAt(o),l=null;switch(s){case 48:l="$&",this._hasParameters=!0;break;case 96:case 39:this._hasParameters=!0;break;default:{if(!this.between(s,49,57))break;if(o===i.length-1){this._hasParameters=!0;break}let c=i.charCodeAt(++o);if(!this.between(c,48,57)){this._hasParameters=!0,--o;break}if(o===i.length-1){this._hasParameters=!0;break}if(c=i.charCodeAt(++o),!this.between(c,48,57)){this._hasParameters=!0,--o;break}break}}l&&(t+=i.substring(e,o-1)+l,e=o+1)}}e!==0&&(this._replacePattern=t+i.substring(e))}between(i,e,t){return e<=i&&i<=t}};var WHe=class extends x{constructor(e,t,o,n){super();this.searchModel=e;this.instantiationService=t;this.modelService=o;this.notebookEditorService=n;this._onChange=this._register(new Gm({merge:DGt}));this.onChange=this._onChange.event;this._plainTextSearchResult=this._register(this.instantiationService.createInstance(MVe,this)),this._aiTextSearchResult=this._register(this.instantiationService.createInstance(t6,this)),this._register(this._plainTextSearchResult.onChange(r=>this._onChange.fire(r))),this._register(this._aiTextSearchResult.onChange(r=>this._onChange.fire(r))),this.modelService.getModels().forEach(r=>this.onModelAdded(r)),this._register(this.modelService.onModelAdded(r=>this.onModelAdded(r))),this._register(this.notebookEditorService.onDidAddNotebookEditor(r=>{r instanceof xG&&this.onDidAddNotebookEditorWidget(r)})),this._id=CMi+Date.now().toString()}id(){return this._id}get plainTextSearchResult(){return this._plainTextSearchResult}get aiTextSearchResult(){return this._aiTextSearchResult}get children(){return this.textSearchResults}get hasChildren(){return!0}get textSearchResults(){return[this._plainTextSearchResult,this._aiTextSearchResult]}async batchReplace(e){try{this._onChange.pause(),await Promise.all(e.map(async t=>{let o=t.parent();(Fd(o)||_l(o))&&xQ(o,e)||(_l(t)?await t.parent().replace(t):el(t)?await t.parent().replace(t):Fd(t)&&await t.replaceAll())}))}finally{this._onChange.resume()}}batchRemove(e){let t=[];try{this._onChange.pause(),e.forEach(o=>{if(!xQ(o,t)){if(lv(o))o.hide();else if(!Fd(o)||kQ(o)||_W(o)){if(_l(o))o.parent().remove(o);else if(el(o))o.parent().remove(o);else if(kQ(o))o.parent().remove(o);else if(_W(o)){let n=o.parent();lv(n)&&n.remove(o)}t.push(o)}}})}finally{this._onChange.resume()}}get isDirty(){return this._aiTextSearchResult.isDirty||this._plainTextSearchResult.isDirty}get query(){return this._plainTextSearchResult.query}set query(e){this._plainTextSearchResult.query=e}setAIQueryUsingTextQuery(e){e||(e=this.query),this.aiTextSearchResult.query=Ppn(e)}onDidAddNotebookEditorWidget(e){this._onWillChangeModelListener?.dispose(),this._onWillChangeModelListener=e.onWillChangeModel(t=>{t&&this.onNotebookEditorWidgetRemoved(e,t?.uri)}),this._onDidChangeModelListener?.dispose(),this._onDidChangeModelListener=e.onDidAttachViewModel(()=>{e.hasModel()&&this.onNotebookEditorWidgetAdded(e,e.textModel.uri)})}folderMatches(e=!1){return e?this._aiTextSearchResult.folderMatches():this._plainTextSearchResult.folderMatches()}onModelAdded(e){this._plainTextSearchResult.findFolderSubstr(e.uri)?.bindModel(e)}async onNotebookEditorWidgetAdded(e,t){await this._plainTextSearchResult.findFolderSubstr(t)?.bindNotebookEditorWidget(e,t)}onNotebookEditorWidgetRemoved(e,t){this._plainTextSearchResult.findFolderSubstr(t)?.unbindNotebookEditorWidget(e,t)}add(e,t,o,n=!1){this._plainTextSearchResult.hidden=!1,o?this._aiTextSearchResult.add(e,t,n):this._plainTextSearchResult.add(e,t,n)}clear(){this._plainTextSearchResult.clear(),this._aiTextSearchResult.clear()}remove(e,t=!1){t&&this._aiTextSearchResult.remove(e,t),this._plainTextSearchResult.remove(e,t)}replace(e){return this._plainTextSearchResult.replace(e)}matches(e){return e===void 0?this._plainTextSearchResult.matches().concat(this._aiTextSearchResult.matches()):e===!0?this._aiTextSearchResult.matches():this._plainTextSearchResult.matches()}isEmpty(){return this._plainTextSearchResult.isEmpty()&&this._aiTextSearchResult.isEmpty()}fileCount(e=!1){return e?this._plainTextSearchResult.fileCount():this._plainTextSearchResult.fileCount()+this._aiTextSearchResult.fileCount()}count(e=!1){return e?this._plainTextSearchResult.count():this._plainTextSearchResult.count()+this._aiTextSearchResult.count()}setCachedSearchComplete(e,t){t?this._aiTextSearchResult.cachedSearchComplete=e:this._plainTextSearchResult.cachedSearchComplete=e}getCachedSearchComplete(e){return e?this._aiTextSearchResult.cachedSearchComplete:this._plainTextSearchResult.cachedSearchComplete}toggleHighlights(e,t=!1){t?this._aiTextSearchResult.toggleHighlights(e):this._plainTextSearchResult.toggleHighlights(e)}getRangeHighlightDecorations(e=!1){return e?this._aiTextSearchResult.rangeHighlightDecorations:this._plainTextSearchResult.rangeHighlightDecorations}replaceAll(e){return this._plainTextSearchResult.replaceAll(e)}async dispose(){this._aiTextSearchResult?.dispose(),this._plainTextSearchResult?.dispose(),this._onWillChangeModelListener?.dispose(),this._onDidChangeModelListener?.dispose(),super.dispose()}};WHe=I([m(1,F),m(2,Tt),m(3,Gc)],WHe);function Ppn(a){return a===null?null:{...a,contentPattern:a.contentPattern.pattern,type:3}}var Nq=class extends x{constructor(e,t,o,n,r,s){super();this.searchService=e;this.telemetryService=t;this.configurationService=o;this.instantiationService=n;this.logService=r;this.notebookSearchService=s;this._searchQuery=null;this._replaceActive=!1;this._replaceString=null;this._replacePattern=null;this._preserveCase=!1;this._startStreamDelay=Promise.resolve();this._resultQueue=[];this._aiResultQueue=[];this._onReplaceTermChanged=this._register(new E);this.onReplaceTermChanged=this._onReplaceTermChanged.event;this._onSearchResultChanged=this._register(new Gm({merge:DGt}));this.onSearchResultChanged=this._onSearchResultChanged.event;this.currentCancelTokenSource=null;this.currentAICancelTokenSource=null;this.searchCancelledForNewSearch=!1;this.aiSearchCancelledForNewSearch=!1;this.location=0;this._searchResult=this.instantiationService.createInstance(WHe,this),this._register(this._searchResult.onChange(l=>this._onSearchResultChanged.fire(l))),this._aiTextResultProviderName=new co(async()=>this.searchService.getAIName()),this._id=KIo+Date.now().toString()}id(){return this._id}async getAITextResultProviderName(){let e=await this._aiTextResultProviderName.value;if(!e)throw Error("Fetching AI name when no provider present.");return e}isReplaceActive(){return this._replaceActive}set replaceActive(e){this._replaceActive=e}get replacePattern(){return this._replacePattern}get replaceString(){return this._replaceString||""}set preserveCase(e){this._preserveCase=e}get preserveCase(){return this._preserveCase}set replaceString(e){this._replaceString=e,this._searchQuery&&(this._replacePattern=new hlt(e,this._searchQuery.contentPattern)),this._onReplaceTermChanged.fire()}get searchResult(){return this._searchResult}aiSearch(e){if(this.hasAIResults)throw Error("AI results already exist");if(!this._searchQuery)throw Error("No search query");let t=Date.now().toString(),o=new Ye;this.currentAICancelTokenSource=o;let n=Date.now();return this.searchService.aiTextSearch({...this._searchQuery,contentPattern:this._searchQuery.contentPattern.pattern,type:3},o.token,async s=>{e(s),this.onSearchProgress(s,t,!1,!0)}).finally(()=>{o.dispose(!0)}).then(s=>(s.results.length===0&&e(void 0),this.onSearchCompleted(s,Date.now()-n,t,!0),s),s=>{throw this.onSearchError(s,Date.now()-n,!0),s})}doSearch(e,t,o,n,r,s){let l=async v=>{t.fire(),this.onSearchProgress(v,n,!1,!1),r?.(v)},c=v=>{t.fire(),this.onSearchProgress(v,n,!0),r?.(v)},u=this.currentCancelTokenSource=new Ye(s),p=this.notebookSearchService.notebookSearch(e,u.token,n,l),h=this.searchService.textSearchSplitSyncAsync(o,u.token,l,p.openFilesToScan,p.allScannedFiles),g=h.syncResults.results;return g.forEach(v=>{v&&c(v)}),{asyncResults:(async()=>{let v=Date.now(),b=await h.asyncResults,S=await p.completeData,y=Date.now()-v,w={results:[...b.results,...S.results],messages:[...b.messages,...S.messages],limitHit:b.limitHit||S.limitHit,exit:b.exit,stats:b.stats};return this.logService.trace(`whole search time | ${y}ms`),w})().finally(()=>u.dispose(!0)),syncResults:g}}get hasAIResults(){return!!this.searchResult.getCachedSearchComplete(!0)||!!this.currentAICancelTokenSource&&!this.currentAICancelTokenSource.token.isCancellationRequested}get hasPlainResults(){return!!this.searchResult.getCachedSearchComplete(!1)||!!this.currentCancelTokenSource&&!this.currentCancelTokenSource.token.isCancellationRequested}search(e,t,o){this.cancelSearch(!0),this._searchQuery=e,this.searchConfig.searchOnType||this.searchResult.clear();let n=Date.now().toString();this._searchResult.query=this._searchQuery;let r=this._register(new E);this._replacePattern=new hlt(this.replaceString,this._searchQuery.contentPattern),this._startStreamDelay=new Promise(g=>setTimeout(g,this.searchConfig.searchOnType?150:0));let s=this.doSearch(e,r,this._searchQuery,n,t,o),l=s.asyncResults,c=s.syncResults;t&&c.forEach(g=>{g&&t(g)});let u=Date.now(),p,h=new Promise(g=>(p=U.once(r.event)(g),p));Promise.race([l,h]).finally(()=>{p?.dispose(),this.telemetryService.publicLog("searchResultsFirstRender",{duration:Date.now()-u})});try{return{asyncResults:l.then(g=>(this.onSearchCompleted(g,Date.now()-u,n,!1),g),g=>{throw this.onSearchError(g,Date.now()-u,!1),g}),syncResults:c}}finally{this.telemetryService.publicLog("searchResultsFinished",{duration:Date.now()-u})}}onSearchCompleted(e,t,o,n){if(!this._searchQuery)throw new Error("onSearchCompleted must be called after a search is started");n?(this._searchResult.add(this._aiResultQueue,o,!0),this._aiResultQueue.length=0):(this._searchResult.add(this._resultQueue,o,!1),this._resultQueue.length=0),this.searchResult.setCachedSearchComplete(e,n);let r=Object.assign({},this._searchQuery.contentPattern);delete r.pattern;let s=e&&e.stats,l=this._searchQuery.folderQueries.every(p=>p.folder.scheme===Q.file),c=this._searchQuery.folderQueries.every(p=>p.folder.scheme!==Q.file),u=l?Q.file:c?"other":"mixed";return this.telemetryService.publicLog("searchResultsShown",{count:this._searchResult.count(),fileCount:this._searchResult.fileCount(),options:r,duration:t,type:s&&s.type,scheme:u,searchOnTypeEnabled:this.searchConfig.searchOnType}),e}onSearchError(e,t,o){ao(e)&&(this.onSearchCompleted((o?this.aiSearchCancelledForNewSearch:this.searchCancelledForNewSearch)?{exit:1,results:[],messages:[]}:void 0,t,"",o),o?this.aiSearchCancelledForNewSearch=!1:this.searchCancelledForNewSearch=!1)}onSearchProgress(e,t,o=!0,n=!1){let r=n?this._aiResultQueue:this._resultQueue;e.resource&&(r.push(e),o?r.length&&(this._searchResult.add(r,t,!1,!0),r.length=0):this._startStreamDelay.then(()=>{r.length&&(this._searchResult.add(r,t,n,!n),r.length=0)}))}get searchConfig(){return this.configurationService.getValue("search")}cancelSearch(e=!1){return this.currentCancelTokenSource?(this.searchCancelledForNewSearch=e,this.currentCancelTokenSource.cancel(),!0):!1}cancelAISearch(e=!1){return this.currentAICancelTokenSource?(this.aiSearchCancelledForNewSearch=e,this.currentAICancelTokenSource.cancel(),!0):!1}clearAiSearchResults(){this._aiResultQueue.length=0,this._searchResult.aiTextSearchResult.clear(!1)}dispose(){this.cancelSearch(),this.cancelAISearch(),this.searchResult.dispose(),super.dispose()}};Nq=I([m(0,gg),m(1,Te),m(2,B),m(3,F),m(4,se),m(5,r4t)],Nq);var VHe=class{constructor(i){this.instantiationService=i;this._searchModel=null}get searchModel(){return this._searchModel||(this._searchModel=this.instantiationService.createInstance(Nq)),this._searchModel}set searchModel(i){this._searchModel?.dispose(),this._searchModel=i}};VHe=I([m(0,F)],VHe);W(class extends K{constructor(){super({id:"search.action.copyMatch",title:L(13977,"Copy"),category:Dl,keybinding:{weight:200,when:_i.FileMatchOrMatchFocusKey,primary:2081},menu:[{id:D.SearchContext,when:_i.FileMatchOrMatchFocusKey,group:"search_2",order:1}]})}async run(i,e){await Npn(i,e)}});W(class extends K{constructor(){super({id:"search.action.copyPath",title:L(13978,"Copy Path"),category:Dl,keybinding:{weight:200,when:_i.FileMatchOrFolderMatchWithResourceFocusKey,primary:2593,win:{primary:1569}},menu:[{id:D.SearchContext,when:_i.FileMatchOrFolderMatchWithResourceFocusKey,group:"search_2",order:2}]})}async run(i,e){await Apn(i,e)}});W(class extends K{constructor(){super({id:"search.action.copyAll",title:L(13976,"Copy All"),category:Dl,menu:[{id:D.SearchContext,when:_i.HasSearchResults,group:"search_2",order:3}]})}async run(i,e){await Opn(i,e)}});W(class extends K{constructor(){super({id:"search.action.getSearchResults",title:L(13979,"Get Search Results"),category:Dl,f1:!1})}async run(i){let e=i.get($t),t=i.get(rt),o=qc(e);if(o){let n=o.searchResult,r=d0i(n.folderMatches(),t),s=d0i(n.folderMatches(!0),t);return`${r}${Lne}${Lne}${s}`}}});var Lne=ei?`\r
`:`
`;async function Apn(a,i){if(!i){let n=p0i(a);if(!_l(n)||kQ(n))return;i=n}let e=a.get(Fi),o=a.get(rt).getUriLabel(i.resource,{noPrefix:!0});await e.writeText(o)}async function Npn(a,i){if(!i){let n=p0i(a);if(!n)return;i=n}let e=a.get(Fi),t=a.get(rt),o;el(i)?o=sTo(i):_l(i)?o=aTo(i,t).text:Fd(i)&&(o=u0i(i,t).text),o&&await e.writeText(o)}async function Opn(a,i){let e=a.get($t),t=a.get(Fi),o=a.get(rt),n=qc(e);if(n){let r=n.searchResult,s=Wpn(i);i||(i=p0i(a));let l=d0i(r.folderMatches(s),o);await t.writeText(l)}}function sTo(a,i=0){let e=()=>`${a.range().startLineNumber},${a.range().startColumn}`,t=s=>a.range().startLineNumber+s+"",o=a.fullPreviewLines(),n=o.reduce((s,l,c)=>{let u=c===0?e().length:t(c).length;return Math.max(u,s)},0);return o.map((s,l)=>{let c=l===0?e():t(l),u=" ".repeat(n-c.length);return`${" ".repeat(i)}${c}: ${u}${s}`}).join(`
`)}function Fpn(a,i){return _l(a)?aTo(a,i):u0i(a,i)}function aTo(a,i){let e=a.matches().sort(TN).map(o=>sTo(o,2));return{text:`${i.getUriLabel(a.resource,{noPrefix:!0})}${Lne}${e.join(Lne)}`,count:e.length}}function u0i(a,i){let e=[],t=0;return a.matches().sort(TN).forEach(n=>{let r=Fpn(n,i);t+=r.count,e.push(r.text)}),{text:e.join(Lne+Lne),count:t}}function d0i(a,i){let e=[];a=a.sort(TN);for(let t=0;t<a.length;t++){let o=u0i(a[t],i);o.count&&e.push(o.text)}return e.join(Lne+Lne)}function p0i(a){let i=a.get($t);return qc(i)?.getControl().getSelection()[0]}function Wpn(a){return a?el(a)?a.parent().parent().isAIContributed():_l(a)?a.parent().isAIContributed():Fd(a)?a.isAIContributed():lv(a)?a.isAIContributed:!1:!1}W(class extends K{constructor(){super({id:"search.action.restrictSearchToFolder",title:L(13989,"Restrict Search to Folder"),category:Dl,keybinding:{weight:200,when:C.and(_i.SearchViewVisibleKey,_i.ResourceFolderFocusKey),primary:1572},menu:[{id:D.SearchContext,group:"search",order:3,when:C.and(_i.ResourceFolderFocusKey)}]})}async run(i,e){await m0i(i,!1,!0,void 0,e)}});W(class extends K{constructor(){super({id:"search.action.expandRecursively",title:d(13991,null),category:Dl,menu:[{id:D.SearchContext,when:C.and(_i.FolderFocusKey,_i.HasSearchResults),group:"search",order:4}]})}async run(i){return Vpn(i)}});W(class extends K{constructor(){super({id:"search.action.excludeFromSearch",title:L(13981,"Exclude Folder from Search"),category:Dl,menu:[{id:D.SearchContext,group:"search",order:4,when:_i.ResourceFolderFocusKey}]})}async run(i,e){await m0i(i,!1,!1,void 0,e)}});W(class extends K{constructor(){super({id:"search.action.excludeFileTypeFromSearch",title:L(13980,"Exclude File Type from Search"),category:Dl,menu:[{id:D.SearchContext,group:"search",order:5,when:_i.FileFocusKey}]})}async run(i,e){await lTo(i,e,!0)}});W(class extends K{constructor(){super({id:"search.action.includeFileTypeInSearch",title:L(13987,"Include File Type from Search"),category:Dl,menu:[{id:D.SearchContext,group:"search",order:6,when:_i.FileFocusKey}]})}async run(i,e){await lTo(i,e,!1)}});W(class extends K{constructor(){super({id:"search.action.revealInSideBar",title:L(13990,"Reveal in Explorer View"),category:Dl,menu:[{id:D.SearchContext,when:C.and(_i.FileFocusKey,_i.HasSearchResults),group:"search_3",order:1}]})}async run(i,e){let t=i.get(us),o=i.get(Oa),n=i.get(Pe),r=qc(i.get($t));if(!r)return;let s;if(_l(e))s=e;else{e=r.getControl().getFocus()[0];return}t.openPaneComposite(nv,0,!1).then(l=>{if(!l)return;let c=l.getViewPaneContainer(),u=s.resource;if(u&&n.isInsideWorkspace(u)){let p=c.getExplorerView();p.setExpanded(!0),o.select(u,!0).then(()=>p.focus(),mt)}})}});W(class extends K{constructor(){super({id:"workbench.action.findInFiles",title:{...L(13982,"Find in Files"),mnemonicTitle:d(13988,null)},metadata:{description:d(13984,null),args:[{name:d(13983,null),schema:{type:"object",properties:{query:{type:"string"},replace:{type:"string"},preserveCase:{type:"boolean"},triggerSearch:{type:"boolean"},filesToInclude:{type:"string"},filesToExclude:{type:"string"},isRegex:{type:"boolean"},isCaseSensitive:{type:"boolean"},matchWholeWord:{type:"boolean"},useExcludeSettingsAndIgnoreFiles:{type:"boolean"},onlyOpenEditors:{type:"boolean"},showIncludesExcludes:{type:"boolean"}}}}]},category:Dl,keybinding:{weight:200,primary:3108},menu:[{id:D.MenubarEditMenu,group:"4_find_global",order:1}],f1:!0})}async run(i,e={}){h0i(i,e)}});W(class extends K{constructor(){super({id:"filesExplorer.findInFolder",title:L(13985,"Find in Folder..."),category:Dl,keybinding:{weight:200,when:C.and(px,Gd),primary:1572},menu:[{id:D.ExplorerContext,group:"4_search",order:10,when:Gd}]})}async run(i,e){await m0i(i,!0,!0,e)}});W(class extends K{constructor(){super({id:"filesExplorer.findInWorkspace",title:L(13986,"Find in Workspace..."),category:Dl,menu:[{id:D.ExplorerContext,group:"4_search",order:10,when:C.and(ux,Gd.toNegated())}]})}async run(i){let t=i.get(B).getValue().search.mode;t==="view"?(await JQ(i.get($t),!0))?.searchInFolders():await i.get(ge).executeCommand(Vfe,{location:t==="newEditor"?"new":"reuse",filesToInclude:""})}});async function Vpn(a){let i=a.get($t),e=qc(i);if(e){let t=e.getControl(),o=t.getFocus()[0];await PVe(t,o)}}function Bpn(a){let i=a.split(".");return i.length<=1?a:`*.${i.slice(1).join(".")}`}function Hpn(a,i){return a.trim()?a.split(",").map(t=>t.trim()).filter(t=>t.length>0).includes(i)?a:`${a}, ${i}`:i}async function m0i(a,i,e,t,o){let n=a.get(fe),r=a.get($t),s=a.get(Pe),l=a.get(ge),c=a.get(B).getValue().search,u=c.mode,p;if(i)p=dW(t,a.get(Io),a.get(ee),a.get(wt),a.get(Oa));else{let g=qc(r);if(!g)return;p=Upn(g.getControl(),o,c)}let h=n.resolveAll(p.map(g=>({resource:g}))).then(g=>{let f=[];return g.forEach(v=>{v.success&&v.stat&&f.push(v.stat.isDirectory?v.stat.resource:ci(v.stat.resource))}),pro(f,s)});if(u==="view"){let g=await JQ(r,!0);p&&p.length&&g&&(e?g.searchInFolders(await h):g.searchOutsideOfFolders(await h));return}else return e?l.executeCommand(Vfe,{filesToInclude:(await h).join(", "),showIncludesExcludes:!0,location:u==="newEditor"?"new":"reuse"}):l.executeCommand(Vfe,{filesToExclude:(await h).join(", "),showIncludesExcludes:!0,location:u==="newEditor"?"new":"reuse"})}function Upn(a,i,e){return kst(a,i,e).map(t=>el(t)?null:t.resource).filter(t=>t!==null)}async function h0i(a,i={}){let e=a.get(B).getValue().search,t=a.get($t),o=a.get(ge),n={};if(Object.keys(i).length!==0){let s=a.get(Tp),l=a.get(na),c=a.get(Pe),u=l.getLastActiveWorkspaceRoot(),p=u?.scheme===Q.file||u?.scheme===Q.vscodeRemote?u:void 0,h=p?c.getWorkspaceFolder(p)??void 0:void 0;for(let g of Object.entries(i)){let f=g[0],v=g[1];v!==void 0&&(n[f]=typeof v=="string"?await s.resolveAsync(h,v):v)}}let r=e.mode;if(r==="view")JQ(t,!1).then(s=>{if(s){s.searchAndReplaceWidget.toggleReplace(typeof n.replace=="string");let c=!1;typeof n.query!="string"&&(c=s.updateTextFromFindWidgetOrSelection({allowUnselectedWord:typeof n.replace!="string"})),s.setSearchParameters(n),typeof n.showIncludesExcludes=="boolean"&&s.toggleQueryDetails(!1,n.showIncludesExcludes),s.searchAndReplaceWidget.focus(void 0,c,c)}});else{let s=l=>({location:r==="newEditor"?"new":"reuse",query:l.query,filesToInclude:l.filesToInclude,filesToExclude:l.filesToExclude,matchWholeWord:l.matchWholeWord,isCaseSensitive:l.isCaseSensitive,isRegexp:l.isRegex,useExcludeSettingsAndIgnoreFiles:l.useExcludeSettingsAndIgnoreFiles,onlyOpenEditors:l.onlyOpenEditors,showIncludesExcludes:!!(l.filesToExclude||l.filesToExclude||!l.useExcludeSettingsAndIgnoreFiles)});o.executeCommand(Vfe,s(n))}}async function lTo(a,i,e){let t=a.get($t),o=qc(t);if(!o||!i)return;let r=i.resource.path.split("/").pop()||"",s=Bpn(r),l=e?o.searchExcludePattern:o.searchIncludePattern,c=l.getValue(),u=Hpn(c,s);u!==c&&(l.setValue(u),o.toggleQueryDetails(!1,!0),o.triggerQueryChange({preserveFocus:!1}))}W(class extends K{constructor(){super({id:"workbench.action.search.toggleQueryDetails",title:L(14005,"Toggle Query Details"),category:Dl,keybinding:{weight:200,when:C.or(_i.SearchViewFocusedKey,Kb),primary:3112}})}run(i,...e){let t=e[0],o=i.get(X).getContext(Nn());if(o.getValue(Kb.serialize()))i.get(ee).activeEditorPane.toggleQueryDetails(t?.show);else if(o.getValue(_i.SearchViewFocusedKey.serialize())){let n=qc(i.get($t));Ci(n).toggleQueryDetails(void 0,t?.show)}}});W(class extends K{constructor(){super({id:"closeReplaceInFilesWidget",title:L(13993,"Close Replace Widget"),category:Dl,keybinding:{weight:200,when:C.and(_i.SearchViewVisibleKey,_i.ReplaceInputBoxFocusedKey),primary:9}})}run(i){let e=qc(i.get($t));return e&&(e.searchAndReplaceWidget.toggleReplace(!1),e.searchAndReplaceWidget.focus()),Promise.resolve(null)}});W(class extends K{constructor(){super({id:"toggleSearchCaseSensitive",title:L(14003,"Toggle Case Sensitive"),category:Dl,keybinding:Object.assign({weight:200,when:Ze?C.and(_i.SearchViewFocusedKey,_i.FileMatchOrFolderMatchFocusKey.toNegated()):_i.SearchViewFocusedKey},l5)})}async run(i){zpn(i)}});W(class extends K{constructor(){super({id:"toggleSearchWholeWord",title:L(14008,"Toggle Whole Word"),keybinding:Object.assign({weight:200,when:_i.SearchViewFocusedKey},c5),category:Dl})}async run(i){return Kpn(i)}});W(class extends K{constructor(){super({id:"toggleSearchRegex",title:L(14006,"Toggle Regex"),keybinding:Object.assign({weight:200,when:_i.SearchViewFocusedKey},d5),category:Dl})}async run(i){return Gpn(i)}});W(class extends K{constructor(){super({id:"toggleSearchPreserveCase",title:L(14004,"Toggle Preserve Case"),keybinding:Object.assign({weight:200,when:_i.SearchViewFocusedKey},Cce),category:Dl})}async run(i){return qpn(i)}});W(class extends K{constructor(){super({id:"search.action.openResult",title:L(14000,"Open Match"),category:Dl,keybinding:{weight:200,when:C.and(_i.SearchViewVisibleKey,_i.FileMatchOrMatchFocusKey),primary:3,mac:{primary:3,secondary:[2066]}}})}run(i){let e=qc(i.get($t));if(e){let t=e.getControl(),o=e.getControl(),n=t.getFocus()[0];Fd(n)?o.toggleCollapsed(n):e.open(t.getFocus()[0],!1,!1,!0)}}});W(class extends K{constructor(){super({id:"search.action.openResultToSide",title:L(14001,"Open Match To Side"),category:Dl,keybinding:{weight:200,when:C.and(_i.SearchViewVisibleKey,_i.FileMatchOrMatchFocusKey),primary:2051,mac:{primary:259}}})}run(i){let e=qc(i.get($t));if(e){let t=e.getControl();e.open(t.getFocus()[0],!1,!0,!0)}}});W(class extends K{constructor(){super({id:"addCursorsAtSearchResults",title:L(13992,"Add Cursors at Search Results"),keybinding:{weight:200,when:C.and(_i.SearchViewVisibleKey,_i.FileMatchOrMatchFocusKey),primary:3114},category:Dl})}async run(i){let e=qc(i.get($t));if(e){let t=e.getControl();e.openEditorWithMultiCursor(t.getFocus()[0])}}});W(class extends K{constructor(){super({id:"search.focus.nextInputBox",title:L(13994,"Focus Next Input"),category:Dl,keybinding:{weight:200,when:C.or(C.and(Kb,_i.InputBoxFocusedKey),C.and(_i.SearchViewVisibleKey,_i.InputBoxFocusedKey)),primary:2066}})}async run(i){let e=i.get(ee);e.activeEditor instanceof Pp&&e.activeEditorPane.focusNextInput(),qc(i.get($t))?.focusNextInputBox()}});W(class extends K{constructor(){super({id:"search.focus.previousInputBox",title:L(13996,"Focus Previous Input"),category:Dl,keybinding:{weight:200,when:C.or(C.and(Kb,_i.InputBoxFocusedKey),C.and(_i.SearchViewVisibleKey,_i.InputBoxFocusedKey,_i.SearchInputBoxFocusedKey.toNegated())),primary:2064}})}async run(i){let e=i.get(ee);e.activeEditor instanceof Pp&&e.activeEditorPane.focusPrevInput(),qc(i.get($t))?.focusPreviousInputBox()}});W(class extends K{constructor(){super({id:"search.action.focusSearchFromResults",title:L(13998,"Focus Search From Results"),category:Dl,keybinding:{weight:200,when:C.and(_i.SearchViewVisibleKey,C.or(_i.FirstMatchFocusKey,$a)),primary:2064}})}run(i){qc(i.get($t))?.focusPreviousInputBox()}});W(class g0i extends K{static{this.searchOnTypeKey="search.searchOnType"}constructor(){super({id:"workbench.action.toggleSearchOnType",title:L(14007,"Toggle Search on Type"),category:Dl})}async run(i){let e=i.get(B),t=e.getValue(g0i.searchOnTypeKey);return e.updateValue(g0i.searchOnTypeKey,!t)}});W(class extends K{constructor(){super({id:"search.action.focusSearchList",title:L(13999,"Focus List"),category:Dl,f1:!0})}async run(i){$pn(i)}});W(class extends K{constructor(){super({id:"search.action.focusNextSearchResult",title:L(13995,"Focus Next Search Result"),keybinding:[{primary:62,weight:200}],category:Dl,f1:!0,precondition:C.or(_i.HasSearchResults,Kb)})}async run(i){return await jpn(i)}});W(class extends K{constructor(){super({id:"search.action.focusPreviousSearchResult",title:L(13997,"Focus Previous Search Result"),keybinding:[{primary:1086,weight:200}],category:Dl,f1:!0,precondition:C.or(_i.HasSearchResults,Kb)})}async run(i){return await Qpn(i)}});W(class extends K{constructor(){super({id:"workbench.action.replaceInFiles",title:L(14002,"Replace in Files"),keybinding:[{primary:3110,weight:200}],category:Dl,f1:!0,menu:[{id:D.MenubarEditMenu,group:"4_find_global",order:2}]})}async run(i){return await Ypn(i,!0)}});function zpn(a){qc(a.get($t))?.toggleCaseSensitive()}function Kpn(a){qc(a.get($t))?.toggleWholeWords()}function Gpn(a){qc(a.get($t))?.toggleRegex()}function qpn(a){qc(a.get($t))?.togglePreserveCase()}var $pn=a=>{let i=a.get($t);JQ(i).then(e=>{e?.moveFocusToResults()})};async function jpn(a){let i=a.get(ee);return i.activeEditor instanceof Pp?i.activeEditorPane.focusNextResult():JQ(a.get($t)).then(t=>t?.selectNextMatch())}async function Qpn(a){let i=a.get(ee);return i.activeEditor instanceof Pp?i.activeEditorPane.focusPreviousResult():JQ(a.get($t)).then(t=>t?.selectPreviousMatch())}async function Ypn(a,i){return JQ(a.get($t),!1).then(e=>{if(e){e.searchAndReplaceWidget.toggleReplace(i);let o=e.updateTextFromFindWidgetOrSelection({allowUnselectedWord:!i});e.searchAndReplaceWidget.focus(void 0,o,o)}})}W(class extends K{constructor(){super({id:"search.action.remove",title:L(14011,"Dismiss"),category:Dl,icon:axo,keybinding:{weight:200,when:C.and(_i.SearchViewVisibleKey,_i.FileMatchOrMatchFocusKey),primary:20,mac:{primary:2049}},menu:[{id:D.SearchContext,group:"search",order:2},{id:D.SearchActionMenu,group:"inline",when:C.or(_i.FileFocusKey,_i.MatchFocusKey,_i.FolderFocusKey),order:2}]})}async run(i,e){let t=i.get($t),o=i.get(B),n=qc(t);if(!n)return;let r=e?.element,s=e?.viewer;s||(s=n.getControl()),r||(r=s.getFocus()[0]??void 0);let l=kst(s,r,o.getValue("search")),c=s.getFocus()[0]??void 0;if(l.length===0)return;(!c||vN(c))&&(c=r);let u,p=vxo(l,c);c&&p&&(u=await cTo(s,c,l));let h=n.searchResult;h&&h.batchRemove(l),await n.queueRefreshTree(),c&&p?(u||(u=await dTo(s,c).catch(()=>{})),u&&!xQ(u,l)&&(s.reveal(u),s.setFocus([u],$E()),s.setSelection([u],$E()))):$i(s.getFocus(),s.getSelection())||s.setSelection(s.getFocus()),s.domFocus()}});W(class extends K{constructor(){super({id:"search.action.replace",title:L(14010,"Replace"),category:Dl,keybinding:{weight:200,when:C.and(_i.SearchViewVisibleKey,_i.ReplaceActiveKey,_i.MatchFocusKey,_i.IsEditableItemKey),primary:3094},icon:a$t,menu:[{id:D.SearchContext,when:C.and(_i.ReplaceActiveKey,_i.MatchFocusKey,_i.IsEditableItemKey),group:"search",order:1},{id:D.SearchActionMenu,when:C.and(_i.ReplaceActiveKey,_i.MatchFocusKey,_i.IsEditableItemKey),group:"inline",order:1}]})}async run(i,e){return f0i(i,e)}});W(class extends K{constructor(){super({id:"search.action.replaceAllInFile",title:L(14009,"Replace All"),category:Dl,keybinding:{weight:200,when:C.and(_i.SearchViewVisibleKey,_i.ReplaceActiveKey,_i.FileFocusKey,_i.IsEditableItemKey),primary:3094,secondary:[3075]},icon:a$t,menu:[{id:D.SearchContext,when:C.and(_i.ReplaceActiveKey,_i.FileFocusKey,_i.IsEditableItemKey),group:"search",order:1},{id:D.SearchActionMenu,when:C.and(_i.ReplaceActiveKey,_i.FileFocusKey,_i.IsEditableItemKey),group:"inline",order:1}]})}async run(i,e){return f0i(i,e)}});W(class extends K{constructor(){super({id:"search.action.replaceAllInFolder",title:L(14009,"Replace All"),category:Dl,keybinding:{weight:200,when:C.and(_i.SearchViewVisibleKey,_i.ReplaceActiveKey,_i.FolderFocusKey,_i.IsEditableItemKey),primary:3094,secondary:[3075]},icon:a$t,menu:[{id:D.SearchContext,when:C.and(_i.ReplaceActiveKey,_i.FolderFocusKey,_i.IsEditableItemKey),group:"search",order:1},{id:D.SearchActionMenu,when:C.and(_i.ReplaceActiveKey,_i.FolderFocusKey,_i.IsEditableItemKey),group:"inline",order:1}]})}async run(i,e){return f0i(i,e)}});async function f0i(a,i){let e=a.get(B),t=a.get($t),o=qc(t),n=i?.viewer??o?.getControl();if(!n)return;let r=i?.element??n.getFocus()[0],s=kst(n,r??void 0,e.getValue("search")),l=n.getFocus()[0];if((!l||l&&!xQ(l,s)||vN(l))&&(l=r),s.length===0)return;let c;l&&(c=await cTo(n,l,s));let u=o?.searchResult;u&&await u.batchReplace(s),await o?.queueRefreshTree(),l&&(c||(c=await dTo(n,l)),c&&(n.reveal(c),n.setFocus([c],$E()),n.setSelection([c],$E()),el(c)?!e.getValue().search.useReplacePreview||Xpn(a,c)||c instanceof Joe?o?.open(c,!0):a.get(EI).openReplacePreview(c,!0):_l(c)&&o?.open(c,!0))),n.domFocus()}function Xpn(a,i){if(!el(i))return!1;let t=a.get(ee).activeEditor?.resource;return t?a.get(ht).extUri.isEqual(t,i.parent().resource):!1}function Jpn(a,i){return el(a)?el(i)?0:-1:_l(a)?el(i)?1:_l(i)?0:-1:Fd(a)?lv(i)?-1:Fd(i)?0:1:lv(i)?0:1}async function cTo(a,i,e){let t=a.navigate(i);if(Fd(i))for(;t.next()&&(!Fd(t.current())||xQ(t.current(),e)););else if(_l(i))for(;t.next()&&(!_l(t.current())||xQ(t.current(),e));){if(t.current()instanceof t6)return t.current();await a.expand(t.current())}else for(;t.next()&&(!el(t.current())||xQ(t.current(),e));){if(t.current()instanceof t6)return t.current();await a.expand(t.current())}return t.current()}async function dTo(a,i){let e=a.lastVisibleElement??null;for(;e;){let t=Jpn(i,e);if(t===-1){if(!await a.expand(e))return e;e=a.lastVisibleElement}else if(t===1){let o=a.getParentElement(e);if(vN(o))break;e=o}else return e}}W(class uTo extends K{static{this.ID="workbench.action.showAllSymbols"}static{this.LABEL=d(14013,null)}static{this.ALL_SYMBOLS_PREFIX="#"}constructor(){super({id:"workbench.action.showAllSymbols",title:{...L(14014,"Go to Symbol in Workspace..."),mnemonicTitle:d(14012,null)},f1:!0,keybinding:{weight:200,primary:2098},menu:{id:D.MenubarGoMenu,group:"3_global_nav",order:2}})}async run(i){i.get(Ue).quickAccess.show(uTo.ALL_SYMBOLS_PREFIX)}});var Pve="%",Zpn={_reason:"quickAccessSearch",disregardIgnoreFiles:!1,disregardExcludeSettings:!1,onlyOpenEditors:!1,expandPatterns:!0},v0i=30,emn=10,tmn=75,BHe=class extends Lh{constructor(e,t,o,n,r,s){super(Pve,{canAcceptInBackground:!0,shouldSkipTrimPickFilter:!0});this._instantiationService=e;this._contextService=t;this._editorService=o;this._labelService=n;this._viewsService=r;this._configurationService=s;this.currentAsyncSearch=Promise.resolve({results:[],messages:[]});this.queryBuilder=this._instantiationService.createInstance(kS),this.searchModel=this._register(this._instantiationService.createInstance(Nq)),this.editorViewState=this._register(this._instantiationService.createInstance(L2)),this.searchModel.location=1,this.editorSequencer=new rm}_getTextQueryBuilderOptions(e){return{...Zpn,extraFileResources:this._instantiationService.invokeFunction(UJ),maxResults:this.configuration.maxResults??void 0,isSmartCase:this.configuration.smartCase,previewOptions:{matchLines:1,charsPerLine:e}}}dispose(){this.searchModel.dispose(),super.dispose()}provide(e,t,o){let n=new N;Pve.length<e.value.length&&(e.valueSelection=[Pve.length,e.value.length]),e.buttons=[{location:2,iconClass:q.asClassName(R.goToSearch),tooltip:d(13835,null)}],this.editorViewState.reset(),n.add(e.onDidTriggerButton(async()=>{await this.moveToSearchViewlet(void 0),e.hide()}));let r=()=>{let[s]=e.activeItems;if(s?.match){this.editorViewState.set();let l=s.match;this.editorSequencer.queue(async()=>{await this.editorViewState.openTransientEditor({resource:l.parent().resource,options:{preserveFocus:!0,revealIfOpened:!0,ignoreError:!0,selection:l.range()}})})}};return n.add(U.debounce(e.onDidChangeActive,(s,l)=>l,tmn,!0)(r)),n.add(U.once(e.onWillHide)(({reason:s})=>{s===2&&this.editorViewState.restore()})),n.add(U.once(e.onDidHide)(({reason:s})=>{this.searchModel.searchResult.toggleHighlights(!1)})),n.add(super.provide(e,t,o)),n.add(e.onDidAccept(()=>this.searchModel.searchResult.toggleHighlights(!1))),n}get configuration(){let e=this._configurationService.getValue().workbench?.editor,t=this._configurationService.getValue().search;return{openEditorPinned:!e?.enablePreviewFromQuickOpen||!e?.enablePreview,preserveInput:t.quickAccess.preserveInput,maxResults:t.maxResults,smartCase:t.smartCase,sortOrder:t.sortOrder}}get defaultFilterValue(){if(this.configuration.preserveInput)return 1}doSearch(e,t){if(e==="")return;let o=this._contextService.getWorkspace().folders,n={pattern:e};this.searchModel.searchResult.toggleHighlights(!1);let r=n.isRegExp?1e4:1e3,s=this.queryBuilder.text(n,o.map(u=>u.uri),this._getTextQueryBuilderOptions(r)),l=this.searchModel.search(s,void 0,t),c=async()=>{this.currentAsyncSearch=l.asyncResults,await l.asyncResults;let u=new En(l.syncResults.map(p=>p.resource));return this.searchModel.searchResult.matches(!1).filter(p=>!u.has(p.resource))};return{syncResults:this.searchModel.searchResult.matches(!1),asyncResults:c()}}async moveToSearchViewlet(e){this._viewsService.openView(Iy,!1);let t=this._viewsService.getActiveViewWithId(Iy);await t.replaceSearchModel(this.searchModel,this.currentAsyncSearch),this.searchModel=this._instantiationService.createInstance(Nq),this.searchModel.location=1;let o=t?.getControl();e?(o.setFocus([e],$E()),o.setSelection([e],$E()),o.reveal(e)):t.searchAndReplaceWidget.focus()}_getPicksFromMatches(e,t,o){e=e.sort((s,l)=>{if(o){if(o===s.resource)return-1;if(o===l.resource)return 1}return d$t(s,l,this.configuration.sortOrder)});let n=e.length>t?e.slice(0,t):e,r=[];for(let s=0;s<e.length;s++){if(s===t){r.push({type:"separator"}),r.push({label:d(13839,null),iconClass:q.asClassName(Wfe),accept:async()=>{await this.moveToSearchViewlet(e[t])}});break}let l=n[s],c=Ga(l.resource),u=this._labelService.getUriLabel(ci(l.resource),{relative:!0});r.push({label:c,type:"separator",description:u,buttons:[{iconClass:q.asClassName(gxo),tooltip:d(13838,null)}],trigger:async()=>(await this.handleAccept(l,{}),1)});let p=l.matches()??[];for(let h=0;h<p.length;h++){let g=p[h];if(h===emn){r.push({label:d(13837,null),iconClass:q.asClassName(Wfe),accept:async()=>{await this.moveToSearchViewlet(g)}});break}let f=g.preview(),v=(f.before+f.inside+f.after).trim().substring(0,999),b=[{start:f.before.length,end:f.before.length+f.inside.length}];r.push({label:`${v}`,highlights:{label:b},buttons:[{iconClass:q.asClassName(nxo),tooltip:d(13840,null)}],ariaLabel:`Match at location ${g.range().startLineNumber}:${g.range().startColumn} - ${v}`,accept:async(S,y)=>{await this.handleAccept(l,{keyMods:S,selection:CNi(g,this.searchModel),preserveFocus:y.inBackground,forcePinned:y.inBackground})},trigger:async()=>(await this.moveToSearchViewlet(g),1),match:g})}}return r}async handleAccept(e,t){let o={preserveFocus:t.preserveFocus,pinned:t.keyMods?.ctrlCmd||t.forcePinned||this.configuration.openEditorPinned,selection:t.selection},n=t.keyMods?.alt||this.configuration.openEditorPinned&&t.keyMods?.ctrlCmd||t.forceOpenSideBySide?In:jn;await this._editorService.openEditor({resource:e.resource,options:o},n)}_getPicks(e,t,o){let n=this.searchModel;if(e==="")return this.searchModel.searchResult.clear(),[{label:d(13834,null)}];let r=t.add(new Ye);t.add(o.onCancellationRequested(()=>{n.location===1&&r.cancel()}));let s=this.doSearch(e,r.token);if(!s)return null;let l=s.syncResults,c=this._getPicksFromMatches(l,v0i,this._editorService.activeEditor?.resource);return c.length>0&&this.searchModel.searchResult.toggleHighlights(!0),l.length>=v0i?c:{picks:c,additionalPicks:s.asyncResults.then(u=>u.length+c.length===0?[{label:d(13836,null)}]:this._getPicksFromMatches(u,v0i-l.length)).then(u=>(u.length>0&&this.searchModel.searchResult.toggleHighlights(!0),u))}}};BHe=I([m(0,F),m(1,Pe),m(2,ee),m(3,rt),m(4,$t),m(5,B)],BHe);W(class extends K{constructor(){super({id:"workbench.action.quickTextSearch",title:L(14015,"Quick Search"),category:Dl,f1:!0})}async run(i,e){let t=i.get(Ue),o=imn(i)??"";t.quickAccess.show(Pve+o,{preserveValue:!!o})}});function imn(a){let i=a.get(ee),e=a.get(B),t=i.activeTextEditorControl;return!t||!t.hasTextFocus()||!e.getValue("editor.find.seedSearchStringFromSelection")?null:xNi(!1,t)}var s4t=class{constructor(){this.priority=105;this.name="search";this.type="help";this.when=_i.SearchInputBoxFocusedKey}getProvider(i){let e=i.get(Yoe),t=i.get($t),o=e.searchModel;if(o)return new b0i(o,t)}},b0i=class extends x{constructor(e,t){super();this._searchModel=e;this._viewsService=t;this.id="searchHelp";this.verbositySettingKey="accessibility.verbosity.find";this.options={type:"help"}}onClose(){qc(this._viewsService)?.focus()}provideContent(){let e=[],t=this._searchModel.searchResult.count(),o=this._searchModel.replaceActive;return e.push(d(13927,null)),e.push(d(13922,null)),e.push(""),e.push(d(13973,null)),e.push(d(13974,null)),t!==void 0?t===0?e.push(d(13948,null)):e.push(d(13958,null,t)):e.push(d(13949,null)),e.push(""),e.push(d(13935,null)),e.push(d(13934,null)),e.push(""),e.push(d(13933,null)),e.push(d(13932,null)),e.push(d(13928,null)),e.push(d(13929,null)),e.push(d(13930,null)),e.push(d(13931,null)),e.push(""),e.push(d(13926,null)),e.push(d(13923,null)),e.push(d(13924,null)),e.push(d(13925,null,"<keybinding:search.action.focusNextSearchResult>")),e.push(""),e.push(d(13937,null)),e.push(""),e.push(d(13942,null)),e.push(d(13938,null)),e.push(d(13945,null)),e.push(""),e.push(d(13941,null)),e.push(d(13936,null)),e.push(d(13943,null)),e.push(""),e.push(d(13940,null)),e.push(d(13939,null,"<keybinding:search.action.focusNextSearchResult>")),e.push(d(13944,null,"<keybinding:search.action.focusPreviousSearchResult>")),e.push(""),e.push(d(13952,null)),e.push(d(13950,null)),e.push(d(13953,null)),e.push(d(13951,null)),e.push(""),o&&(e.push(d(13956,null)),e.push(d(13954,null)),e.push(d(13955,null)),e.push(d(13957,null)),e.push("")),e.push(d(13967,null,"<keybinding:workbench.action.openSettings>")),e.push(d(13968,null)),e.push(d(13971,null)),e.push(d(13969,null)),e.push(d(13966,null)),e.push(d(13962,null)),e.push(d(13964,null)),e.push(d(13960,null)),e.push(d(13963,null)),e.push(d(13970,null)),e.push(d(13961,null)),e.push(d(13972,null)),e.push(d(13959,null)),o&&e.push(d(13965,null)),Ze&&(e.push(""),e.push(d(13947,null)),e.push(d(13946,null))),e.push(""),e.push(d(13921,null)),e.push(d(13920,null)),e.join(`
`)}};Ee(Yoe,VHe,1);Ee(CVe,_N,1);nTo();rTo();Cxo();It(zfe.ID,zfe,St.AfterRestored);ga.register(new s4t);var omn="search.mode",pTo=ne.as(Mn.ViewContainersRegistry).registerViewContainer({id:Svi,title:L(13855,"Search"),ctorDescriptor:new Ft(Dc,[Svi,{mergeViewWithContainerWhenSingleView:!0}]),hideIfEmpty:!0,icon:uNi,order:1},0,{doNotRegisterOpenCommand:!0}),nmn={id:Iy,containerIcon:uNi,name:L(13855,"Search"),ctorDescriptor:new Ft(Cq),canToggleVisibility:!1,canMoveView:!0,openCommandActionDescriptor:{id:pTo.id,mnemonicTitle:d(13852,null),keybindings:{primary:3108,when:C.regex("neverMatch",/doesNotMatch/)},order:1}};ne.as(Mn.ViewsRegistry).registerViews([nmn],pTo);var S0i=ne.as(Ku.Quickaccess);S0i.registerQuickAccessProvider({ctor:iC,prefix:iC.PREFIX,placeholder:d(13844,null,Rve.GO_TO_LINE_PREFIX,Xk.PREFIX),contextKey:iyi,helpEntries:[{description:d(13843,null),commandId:"workbench.action.quickOpen",commandCenterOrder:10}]});S0i.registerQuickAccessProvider({ctor:Yk,prefix:Yk.PREFIX,placeholder:d(13911,null),contextKey:"inWorkspaceSymbolsPicker",helpEntries:[{description:d(13910,null),commandId:"workbench.action.showAllSymbols"}]});S0i.registerQuickAccessProvider({ctor:BHe,prefix:Pve,contextKey:"inTextSearchPicker",placeholder:d(13913,null),helpEntries:[{description:d(13912,null),commandId:"workbench.action.quickTextSearch",commandCenterOrder:25}]});var rmn=ne.as(Jt.Configuration);rmn.registerConfiguration({id:"search",order:13,title:d(13903,null),type:"object",properties:{[_Pt]:{type:"object",markdownDescription:d(13845,null),default:{"**/node_modules":!0,"**/bower_components":!0,"**/*.code-search":!0},additionalProperties:{anyOf:[{type:"boolean",description:d(13846,null)},{type:"object",properties:{when:{type:"string",pattern:"\\w*\\$\\(basename\\)\\w*",default:"$(basename).ext",markdownDescription:d(13847,null)}}}]},scope:5},[omn]:{type:"string",enum:["view","reuseEditor","newEditor"],default:"view",markdownDescription:d(13871,null),enumDescriptions:[d(13874,null),d(13873,null),d(13872,null)]},"search.useRipgrep":{type:"boolean",description:d(13918,null),deprecationMessage:d(13919,null),default:!0},"search.maintainFileSearchCache":{type:"boolean",deprecationMessage:d(13851,null),description:d(13869,null),default:!1},"search.useIgnoreFiles":{type:"boolean",markdownDescription:d(13915,null),default:!0,scope:5},"search.useGlobalIgnoreFiles":{type:"boolean",markdownDescription:d(13914,null,"`#search.useIgnoreFiles#`"),default:!1,scope:5},"search.useParentIgnoreFiles":{type:"boolean",markdownDescription:d(13916,null,"`#search.useIgnoreFiles#`"),default:!1,scope:5},"search.quickOpen.includeSymbols":{type:"boolean",description:d(13877,null),default:!1},"search.ripgrep.maxThreads":{type:"number",description:d(13878,null),default:0},"search.quickOpen.includeHistory":{type:"boolean",description:d(13876,null),default:!0},"search.quickOpen.history.filterSortOrder":{type:"string",enum:["default","recency"],default:"default",enumDescriptions:[d(13849,null),d(13850,null)],description:d(13848,null)},"search.followSymlinks":{type:"boolean",description:d(13865,null),default:!0},"search.smartCase":{type:"boolean",description:d(13899,null),default:!1},"search.globalFindClipboard":{type:"boolean",default:!1,description:d(13866,null),included:Ze},"search.location":{type:"string",enum:["sidebar","panel"],default:"sidebar",description:d(13867,null),deprecationMessage:d(13868,null)},"search.maxResults":{type:["number","null"],default:K4,markdownDescription:d(13870,null)},"search.collapseResults":{type:"string",enum:["auto","alwaysCollapse","alwaysExpand"],enumDescriptions:[d(13860,null),"",""],default:"alwaysExpand",description:d(13859,null)},"search.useReplacePreview":{type:"boolean",default:!0,description:d(13902,null)},"search.showLineNumbers":{type:"boolean",default:!1,description:d(13898,null)},"search.usePCRE2":{type:"boolean",default:!1,description:d(13901,null),deprecationMessage:d(13917,null)},"search.actionsPosition":{type:"string",enum:["auto","right"],enumDescriptions:[d(13857,null),d(13858,null)],default:"right",description:d(13856,null)},"search.searchOnType":{type:"boolean",default:!0,description:d(13889,null)},"search.seedWithNearestWord":{type:"boolean",default:!1,description:d(13897,null)},"search.seedOnFocus":{type:"boolean",default:!1,markdownDescription:d(13896,null)},"search.searchOnTypeDebouncePeriod":{type:"number",default:300,markdownDescription:d(13890,null,"`#search.searchOnType#`")},"search.searchEditor.doubleClickBehaviour":{type:"string",enum:["selectWord","goToLocation","openLocationToSide"],default:"goToLocation",enumDescriptions:[d(13883,null),d(13881,null),d(13882,null)],markdownDescription:d(13880,null)},"search.searchEditor.singleClickBehaviour":{type:"string",enum:["default","peekDefinition"],default:"default",enumDescriptions:[d(13887,null),d(13888,null)],markdownDescription:d(13886,null)},"search.searchEditor.reusePriorSearchConfiguration":{type:"boolean",default:!1,markdownDescription:d(13885,null)},"search.searchEditor.defaultNumberOfContextLines":{type:["number","null"],default:1,markdownDescription:d(13879,null)},"search.searchEditor.focusResultsOnSearch":{type:"boolean",default:!1,markdownDescription:d(13884,null)},"search.sortOrder":{type:"string",enum:["default","fileNames","type","modified","countDescending","countAscending"],default:"default",enumDescriptions:[d(13906,null),d(13907,null),d(13909,null),d(13908,null),d(13905,null),d(13904,null)],description:d(13900,null)},"search.decorations.colors":{type:"boolean",description:d(13862,null),default:!0},"search.decorations.badges":{type:"boolean",description:d(13861,null),default:!0},"search.defaultViewMode":{type:"string",enum:["tree","list"],default:"list",enumDescriptions:[d(13854,null),d(13853,null)],description:d(13863,null)},"search.quickAccess.preserveInput":{type:"boolean",description:d(13875,null),default:!1},"search.experimental.closedNotebookRichContentResults":{type:"boolean",description:d(13864,null),default:!1},"search.searchView.semanticSearchBehavior":{type:"string",description:d(13892,null),enum:["manual","runOnEmpty","auto"],default:"manual",enumDescriptions:[d(13894,null),d(13895,null),d(13893,null)],tags:["preview"]},"search.searchView.keywordSuggestions":{type:"boolean",description:d(13891,null),default:!1,tags:["preview"]}}});$e.registerCommand("_executeWorkspaceSymbolProvider",async function(a,...i){let[e]=i;return wo(typeof e=="string"),(await VMt(e)).map(o=>o.symbol)});ne.as(Ep.ConfigurationMigration).registerConfigurationMigrations([{key:"search.experimental.quickAccess.preserveInput",migrateFn:(a,i)=>[["search.quickAccess.preserveInput",{value:a}],["search.experimental.quickAccess.preserveInput",{value:void 0}]]}]);var mTo=/^(\s+)(\d+)(: |  )(\s*)(.*)$/,hTo=/^(\S.*):$/,Oq=class extends JZ{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T){super(Oq.ID,e,t,c,n,v,o,S,b,w);this.modelService=r;this.contextService=s;this.labelService=l;this.contextViewService=u;this.commandService=p;this.openerService=h;this.notificationService=g;this.configurationService=y;this.logService=k;this.hoverService=T;this.runSearchDelayer=this._register(new Xo(0));this.pauseSearching=!1;this.showingIncludesExcludes=!1;this.ongoingOperations=0;this.updatingModelForSearch=!1;this.container=_(".search-editor"),this.searchOperation=this._register(new gCe(f)),this._register(this.messageDisposables=new N),this.searchHistoryDelayer=this._register(new Xo(2e3)),this.searchModel=this._register(this.instantiationService.createInstance(Nq))}static{this.ID=Est}static{this.SEARCH_EDITOR_VIEW_STATE_PREFERENCE_KEY="searchEditorViewState"}get searchResultEditor(){return this.editorControl}createEditor(e){M(e,this.container),this.queryEditorContainer=M(this.container,_(".query-container"));let t=M(this.container,_(".search-results"));super.createEditor(t),this.registerEditorListeners();let o=Ci(this.scopedContextKeyService);Kb.bindTo(o).set(!0),this.createQueryEditor(this.queryEditorContainer,this._register(this.instantiationService.createChild(new _o([X,o]))),_i.InputBoxFocusedKey.bindTo(o))}createQueryEditor(e,t,o){let n=H_({inputBorder:smn});this.queryEditorWidget=this._register(t.createInstance(KM,e,{_hideReplaceToggle:!0,showContextToggle:!0,inputBoxStyles:n,toggleStyles:gh})),this._register(this.queryEditorWidget.onReplaceToggled(()=>this.reLayout())),this._register(this.queryEditorWidget.onDidHeightChange(()=>this.reLayout())),this._register(this.queryEditorWidget.onSearchSubmit(({delay:p})=>this.triggerSearch({delay:p}))),this.queryEditorWidget.searchInput?this._register(this.queryEditorWidget.searchInput.onDidOptionChange(()=>this.triggerSearch({resetCursor:!1}))):this.logService.warn("SearchEditor: SearchWidget.searchInput is undefined, cannot register onDidOptionChange listener"),this._register(this.queryEditorWidget.onDidToggleContext(()=>this.triggerSearch({resetCursor:!1}))),this.includesExcludesContainer=M(e,_(".includes-excludes"));let r=d(14139,null);this.toggleQueryDetailsButton=M(this.includesExcludesContainer,_(".expand"+q.asCSSSelector(Wfe),{tabindex:0,role:"button","aria-label":r})),this._register(this.hoverService.setupManagedHover(Ri("element"),this.toggleQueryDetailsButton,r)),this._register(j(this.toggleQueryDetailsButton,re.CLICK,p=>{Xt.stop(p),this.toggleIncludesExcludes()})),this._register(j(this.toggleQueryDetailsButton,re.KEY_UP,p=>{let h=new gi(p);(h.equals(3)||h.equals(10))&&(Xt.stop(p),this.toggleIncludesExcludes())})),this._register(j(this.toggleQueryDetailsButton,re.KEY_DOWN,p=>{new gi(p).equals(1026)&&(this.queryEditorWidget.isReplaceActive()?this.queryEditorWidget.focusReplaceAllAction():this.queryEditorWidget.isReplaceShown()?this.queryEditorWidget.replaceInput?.focusOnPreserve():this.queryEditorWidget.focusRegexAction(),Xt.stop(p))}));let s=M(this.includesExcludesContainer,_(".file-types.includes")),l=d(14144,null);M(s,_("h4",void 0,l)),this.inputPatternIncludes=this._register(t.createInstance($oe,s,this.contextViewService,{ariaLabel:d(14138,null),inputBoxStyles:n})),this._register(this.inputPatternIncludes.onSubmit(p=>this.triggerSearch({resetCursor:!1,delay:p?this.searchConfig.searchOnTypeDebouncePeriod:0}))),this._register(this.inputPatternIncludes.onChangeSearchInEditorsBox(()=>this.triggerSearch()));let c=M(this.includesExcludesContainer,_(".file-types.excludes")),u=d(14143,null);M(c,_("h4",void 0,u)),this.inputPatternExcludes=this._register(t.createInstance(joe,c,this.contextViewService,{ariaLabel:d(14137,null),inputBoxStyles:n})),this._register(this.inputPatternExcludes.onSubmit(p=>this.triggerSearch({resetCursor:!1,delay:p?this.searchConfig.searchOnTypeDebouncePeriod:0}))),this._register(this.inputPatternExcludes.onChangeIgnoreBox(()=>this.triggerSearch())),this.messageBox=M(e,_(".messages.text-search-provider-messages")),[this.queryEditorWidget.searchInputFocusTracker,this.queryEditorWidget.replaceInputFocusTracker,this.inputPatternExcludes.inputFocusTracker,this.inputPatternIncludes.inputFocusTracker].forEach(p=>{p&&(this._register(p.onDidFocus(()=>setTimeout(()=>o.set(!0),0))),this._register(p.onDidBlur(()=>o.set(!1))))})}toggleRunAgainMessage(e){if(Rt(this.messageBox),this.messageDisposables.clear(),e){let t=M(this.messageBox,_("a.pointer.prominent.message",{},d(14140,null)));this.messageDisposables.add(j(t,re.CLICK,async()=>{await this.triggerSearch(),this.searchResultEditor.focus()}))}}_getContributions(){let e=[yX.ID];return Ba.getEditorContributions().filter(t=>e.indexOf(t.id)===-1)}getCodeEditorWidgetOptions(){return{contributions:this._getContributions()}}registerEditorListeners(){this._register(this.searchResultEditor.onMouseUp(e=>{if(e.event.detail===1){let t=this.searchConfig.searchEditor.singleClickBehaviour,o=e.target.position;if(o&&t==="peekDefinition"){let n=this.searchResultEditor.getModel()?.getLineContent(o.lineNumber)??"";(n.match(hTo)||n.match(mTo))&&(this.searchResultEditor.setSelection(z.fromPositions(o)),this.commandService.executeCommand("editor.action.peekDefinition"))}}else if(e.event.detail===2){let t=this.searchConfig.searchEditor.doubleClickBehaviour,o=e.target.position;if(o&&t!=="selectWord"){let n=this.searchResultEditor.getModel()?.getLineContent(o.lineNumber)??"";n.match(mTo)?(this.searchResultEditor.setSelection(z.fromPositions(o)),this.commandService.executeCommand(t==="goToLocation"?"editor.action.goToDeclaration":"editor.action.openDeclarationToTheSide")):n.match(hTo)&&(this.searchResultEditor.setSelection(z.fromPositions(o)),this.commandService.executeCommand("editor.action.peekDefinition"))}}})),this._register(this.searchResultEditor.onDidChangeModelContent(()=>{this.updatingModelForSearch||this.getInput()?.setDirty(!0)}))}getControl(){return this.searchResultEditor}focus(){super.focus();let e=this.loadEditorViewState(this.getInput());e&&e.focused==="editor"?this.searchResultEditor.focus():this.queryEditorWidget.focus()}focusSearchInput(){this.queryEditorWidget.searchInput?.focus()}focusFilesToIncludeInput(){this.showingIncludesExcludes||this.toggleIncludesExcludes(!0),this.inputPatternIncludes.focus()}focusFilesToExcludeInput(){this.showingIncludesExcludes||this.toggleIncludesExcludes(!0),this.inputPatternExcludes.focus()}focusNextInput(){this.queryEditorWidget.searchInputHasFocus()?this.showingIncludesExcludes?this.inputPatternIncludes.focus():this.searchResultEditor.focus():this.inputPatternIncludes.inputHasFocus()?this.inputPatternExcludes.focus():this.inputPatternExcludes.inputHasFocus()?this.searchResultEditor.focus():this.searchResultEditor.hasWidgetFocus()}focusPrevInput(){this.queryEditorWidget.searchInputHasFocus()?this.searchResultEditor.focus():this.inputPatternIncludes.inputHasFocus()?this.queryEditorWidget.searchInput?.focus():this.inputPatternExcludes.inputHasFocus()?this.inputPatternIncludes.focus():this.searchResultEditor.hasWidgetFocus()}setQuery(e){this.queryEditorWidget.searchInput?.setValue(e)}selectQuery(){this.queryEditorWidget.searchInput?.select()}toggleWholeWords(){this.queryEditorWidget.searchInput?.setWholeWords(!this.queryEditorWidget.searchInput.getWholeWords()),this.triggerSearch({resetCursor:!1})}toggleRegex(){this.queryEditorWidget.searchInput?.setRegex(!this.queryEditorWidget.searchInput.getRegex()),this.triggerSearch({resetCursor:!1})}toggleCaseSensitive(){this.queryEditorWidget.searchInput?.setCaseSensitive(!this.queryEditorWidget.searchInput.getCaseSensitive()),this.triggerSearch({resetCursor:!1})}toggleContextLines(){this.queryEditorWidget.toggleContextLines()}modifyContextLines(e){this.queryEditorWidget.modifyContextLines(e)}toggleQueryDetails(e){this.toggleIncludesExcludes(e)}deleteResultBlock(){let e=new Set,t=this.searchResultEditor.getSelections(),o=this.searchResultEditor.getModel();if(!(t&&o))return;let n=o.getLineCount(),r=1,s=p=>{for(let h=p;h>=r;h--){let g=o.getLineContent(h);if(e.add(h),g[0]!==void 0&&g[0]!==" ")break}},l=p=>{e.add(p);for(let h=p+1;h<=n;h++){let g=o.getLineContent(h);if(g[0]!==void 0&&g[0]!==" ")return h;e.add(h)}},c=[];for(let p of t){let h=p.startLineNumber;c.push(l(h)),s(h);for(let g=p.startLineNumber;g<=p.endLineNumber;g++)e.add(g)}c.length===0&&c.push(1);let u=p=>p!==void 0;o.pushEditOperations(this.searchResultEditor.getSelections(),[...e].map(p=>({range:new z(p,1,p+1,1),text:""})),()=>c.filter(u).map(p=>new ti(p,1,p,1)))}cleanState(){this.getInput()?.setDirty(!1)}get searchConfig(){return this.configurationService.getValue("search")}iterateThroughMatches(e){let t=this.searchResultEditor.getModel();if(!t)return;let o=t.getLineCount()??1,n=t.getLineLength(o),r=e?new ye(o,n):new ye(1,1),s=this.searchResultEditor.getSelection()?.getStartPosition()??r,l=this.getInput()?.getMatchRanges();if(!l)return;let c=(e?lmn:amn)(l,s);if(!c)return;this.searchResultEditor.setSelection(c),this.searchResultEditor.revealLineInCenterIfOutsideViewport(c.startLineNumber),this.searchResultEditor.focus();let u=t.getLineContent(c.startLineNumber),p=t.getValueInRange(c),h="";for(let g=c.startLineNumber;g>=1;g--)if(t.getValueInRange(new z(g,1,g,2))!==" "){h=t.getLineContent(g);break}en(d(14142,null,p,u,h.slice(0,h.length-1)))}focusNextResult(){this.iterateThroughMatches(!1)}focusPreviousResult(){this.iterateThroughMatches(!0)}focusAllResults(){this.searchResultEditor.setSelections((this.getInput()?.getMatchRanges()??[]).map(e=>new ti(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn))),this.searchResultEditor.focus()}async triggerSearch(e){let t=this.searchConfig.searchEditor.focusResultsOnSearch;e===void 0?e={focusResults:t}:e.focusResults===void 0&&(e.focusResults=t);let o={resetCursor:!0,delay:0,...e};this.queryEditorWidget.searchInput?.inputBox.isInputValid()&&(this.pauseSearching||await this.runSearchDelayer.trigger(async()=>{this.toggleRunAgainMessage(!1),await this.doRunSearch(),o.resetCursor&&(this.searchResultEditor.setPosition(new ye(1,1)),this.searchResultEditor.setScrollPosition({scrollTop:0,scrollLeft:0})),o.focusResults&&this.searchResultEditor.focus()},o.delay))}readConfigFromWidget(){return{isCaseSensitive:this.queryEditorWidget.searchInput?.getCaseSensitive()??!1,contextLines:this.queryEditorWidget.getContextLines(),filesToExclude:this.inputPatternExcludes.getValue(),filesToInclude:this.inputPatternIncludes.getValue(),query:this.queryEditorWidget.searchInput?.getValue()??"",isRegexp:this.queryEditorWidget.searchInput?.getRegex()??!1,matchWholeWord:this.queryEditorWidget.searchInput?.getWholeWords()??!1,useExcludeSettingsAndIgnoreFiles:this.inputPatternExcludes.useExcludesAndIgnoreFiles(),onlyOpenEditors:this.inputPatternIncludes.onlySearchInOpenEditors(),showIncludesExcludes:this.showingIncludesExcludes,notebookSearchConfig:{includeMarkupInput:this.queryEditorWidget.getNotebookFilters().markupInput,includeMarkupPreview:this.queryEditorWidget.getNotebookFilters().markupPreview,includeCodeInput:this.queryEditorWidget.getNotebookFilters().codeInput,includeOutput:this.queryEditorWidget.getNotebookFilters().codeOutput}}}async doRunSearch(){this.searchModel.cancelSearch(!0);let e=this.getInput();if(!e)return;this.searchHistoryDelayer.trigger(()=>{this.queryEditorWidget.searchInput?.onSearchSubmit(),this.inputPatternExcludes.onSearchSubmit(),this.inputPatternIncludes.onSearchSubmit()});let t=this.readConfigFromWidget();if(!t.query)return;let o={pattern:t.query,isRegExp:t.isRegexp,isCaseSensitive:t.isCaseSensitive,isWordMatch:t.matchWholeWord},n={_reason:"searchEditor",extraFileResources:this.instantiationService.invokeFunction(UJ),maxResults:this.searchConfig.maxResults??void 0,disregardIgnoreFiles:!t.useExcludeSettingsAndIgnoreFiles||void 0,disregardExcludeSettings:!t.useExcludeSettingsAndIgnoreFiles||void 0,excludePattern:[{pattern:t.filesToExclude}],includePattern:t.filesToInclude,onlyOpenEditors:t.onlyOpenEditors,previewOptions:{matchLines:1,charsPerLine:1e3},surroundingContext:t.contextLines,isSmartCase:this.searchConfig.smartCase,expandPatterns:!0,notebookSearchConfig:{includeMarkupInput:t.notebookSearchConfig.includeMarkupInput,includeMarkupPreview:t.notebookSearchConfig.includeMarkupPreview,includeCodeInput:t.notebookSearchConfig.includeCodeInput,includeOutput:t.notebookSearchConfig.includeOutput}},r=this.contextService.getWorkspace().folders,s;try{s=this.instantiationService.createInstance(kS).text(o,r.map(h=>h.uri),n)}catch{return}this.searchOperation.start(500),this.ongoingOperations++;let{configurationModel:l}=await e.resolveModels();l.updateConfig(t);let c=this.searchModel.search(s);e.ongoingSearchOperation=c.asyncResults.finally(()=>{this.ongoingOperations--,this.ongoingOperations===0&&this.searchOperation.stop()});let u=await e.ongoingSearchOperation;await this.onSearchComplete(u,t,e)}async onSearchComplete(e,t,o){let n=this.getInput();if(!n||n!==o||JSON.stringify(t)!==JSON.stringify(this.readConfigFromWidget()))return;n.ongoingSearchOperation=void 0;let r=this.searchConfig.sortOrder;r==="modified"&&await this.retrieveFileStats(this.searchModel.searchResult),jE.get(this.searchResultEditor)?.closeWidget(!1);let l=p=>this.labelService.getUriLabel(p,{relative:!0}),c=h$t(this.searchModel.searchResult,t.filesToInclude,t.filesToExclude,t.contextLines,l,r,e?.limitHit),{resultsModel:u}=await n.resolveModels();if(this.updatingModelForSearch=!0,this.modelService.updateModel(u,c.text),this.updatingModelForSearch=!1,e&&e.messages)for(let p of e.messages)this.addMessage(p);this.reLayout(),n.setDirty(!n.hasCapability(4)),n.setMatchRanges(c.matchRanges)}addMessage(e){let t;this.messageBox.firstChild?t=this.messageBox.firstChild:t=M(this.messageBox,_(".message")),M(t,c$t(e,this.instantiationService,this.notificationService,this.openerService,this.commandService,this.messageDisposables,()=>this.triggerSearch()))}async retrieveFileStats(e){let t=e.matches().filter(o=>!o.fileStat).map(o=>o.resolveFileStat(this.fileService));await Promise.all(t)}layout(e){this.dimension=e,this.reLayout()}getSelected(){let e=this.searchResultEditor.getSelection();return e?this.searchResultEditor.getModel()?.getValueInRange(e)??"":""}reLayout(){this.dimension&&(this.queryEditorWidget.setWidth(this.dimension.width-28),this.searchResultEditor.layout({height:this.dimension.height-mh(this.queryEditorContainer),width:this.dimension.width}),this.inputPatternExcludes.setWidth(this.dimension.width-28),this.inputPatternIncludes.setWidth(this.dimension.width-28))}getInput(){return this.input}setSearchConfig(e){this.priorConfig=e,e.query!==void 0&&this.queryEditorWidget.setValue(e.query),e.isCaseSensitive!==void 0&&this.queryEditorWidget.searchInput?.setCaseSensitive(e.isCaseSensitive),e.isRegexp!==void 0&&this.queryEditorWidget.searchInput?.setRegex(e.isRegexp),e.matchWholeWord!==void 0&&this.queryEditorWidget.searchInput?.setWholeWords(e.matchWholeWord),e.contextLines!==void 0&&this.queryEditorWidget.setContextLines(e.contextLines),e.filesToExclude!==void 0&&this.inputPatternExcludes.setValue(e.filesToExclude),e.filesToInclude!==void 0&&this.inputPatternIncludes.setValue(e.filesToInclude),e.onlyOpenEditors!==void 0&&this.inputPatternIncludes.setOnlySearchInOpenEditors(e.onlyOpenEditors),e.useExcludeSettingsAndIgnoreFiles!==void 0&&this.inputPatternExcludes.setUseExcludesAndIgnoreFiles(e.useExcludeSettingsAndIgnoreFiles),e.showIncludesExcludes!==void 0&&this.toggleIncludesExcludes(e.showIncludesExcludes)}async setInput(e,t,o,n){if(await super.setInput(e,t,o,n),n.isCancellationRequested)return;let{configurationModel:r,resultsModel:s}=await e.resolveModels();if(!n.isCancellationRequested&&(this.searchResultEditor.setModel(s),this.pauseSearching=!0,this.toggleRunAgainMessage(!e.ongoingSearchOperation&&s.getLineCount()===1&&s.getValueLength()===0&&r.config.query!==""),this.setSearchConfig(r.config),this._register(r.onConfigDidUpdate(l=>{l!==this.priorConfig&&(this.pauseSearching=!0,this.setSearchConfig(l),this.pauseSearching=!1)})),this.restoreViewState(o),t?.preserveFocus||this.focus(),this.pauseSearching=!1,e.ongoingSearchOperation)){let l=this.readConfigFromWidget();e.ongoingSearchOperation.then(c=>{this.onSearchComplete(c,l,e)})}}toggleIncludesExcludes(e){let t="expanded";e??!this.includesExcludesContainer.classList.contains(t)?(this.toggleQueryDetailsButton.setAttribute("aria-expanded","true"),this.includesExcludesContainer.classList.add(t)):(this.toggleQueryDetailsButton.setAttribute("aria-expanded","false"),this.includesExcludesContainer.classList.remove(t)),this.showingIncludesExcludes=this.includesExcludesContainer.classList.contains(t),this.reLayout()}toEditorViewStateResource(e){if(e.typeId===Tst)return e.modelUri}computeEditorViewState(e){let o=this.getControl().saveViewState();if(o&&e.toString()===this.getInput()?.modelUri.toString())return{...o,focused:this.searchResultEditor.hasWidgetFocus()?"editor":"input"}}tracksEditorViewState(e){return e.typeId===Tst}restoreViewState(e){let t=this.loadEditorViewState(this.getInput(),e);t&&this.searchResultEditor.restoreViewState(t)}getAriaLabel(){return this.getInput()?.getName()??d(14141,null)}};Oq=I([m(1,Te),m(2,Le),m(3,ce),m(4,Tt),m(5,Pe),m(6,rt),m(7,F),m(8,Wn),m(9,ge),m(10,Je),m(11,Ne),m(12,wd),m(13,Fn),m(14,wt),m(15,ee),m(16,B),m(17,fe),m(18,se),m(19,nt)],Oq);var smn=te("searchEditor.textInputBorder",nw,d(14145,null));function amn(a,i){for(let e of a)if(ye.isBefore(i,e.getStartPosition()))return e;return a[0]}function lmn(a,i){for(let e=a.length-1;e>=0;e--){let t=a[e];if(ye.isBefore(t.getStartPosition(),i))return t}return a[a.length-1]}var cmn="search.action.openInEditor",dmn="search.action.openNewEditorToSide",umn="search.action.focusQueryEditorWidget",pmn="search.action.focusFilesToInclude",mmn="search.action.focusFilesToExclude",hmn="toggleSearchEditorCaseSensitive",gmn="toggleSearchEditorWholeWord",fmn="toggleSearchEditorRegex",vmn="increaseSearchEditorContextLines",bmn="decreaseSearchEditorContextLines",Smn="rerunSearchEditorSearch",Imn="cleanSearchEditorState",ymn="selectAllSearchEditorMatches";ne.as(qo.EditorPane).registerEditorPane(Br.create(Oq,Oq.ID,d(14157,null)),[new Ft(Pp)]);var HHe=class{static{this.ID="workbench.contrib.searchEditor"}constructor(i,e){i.registerEditor("*"+EVe,{id:Pp.ID,label:d(14146,null),detail:la.providerDisplayName,priority:"default"},{singlePerResource:!0,canSupportResource:t=>es(t)===EVe},{createEditorInput:({resource:t})=>({editor:e.invokeFunction(DN,{from:"existingFile",fileUri:t})})})}};HHe=I([m(0,Ka),m(1,F)],HHe);It(HHe.ID,HHe,St.BlockStartup);var I0i=class{canSerialize(i){return!!i.tryReadConfigSync()}serialize(i){if(!this.canSerialize(i))return;if(i.isDisposed())return JSON.stringify({modelUri:void 0,dirty:!1,config:i.tryReadConfigSync(),name:i.getName(),matchRanges:[],backingUri:i.backingUri?.toString()});let e;(i.modelUri.path||i.modelUri.fragment&&i.isDirty())&&(e=i.modelUri.toString());let t=i.tryReadConfigSync(),o=i.isDirty(),n=o?i.getMatchRanges():[],r=i.backingUri;return JSON.stringify({modelUri:e,dirty:o,config:t,name:i.getName(),matchRanges:n,backingUri:r?.toString()})}deserialize(i,e){let{modelUri:t,dirty:o,config:n,matchRanges:r,backingUri:s}=JSON.parse(e);if(n&&n.query!==void 0)if(t){let l=i.invokeFunction(DN,{from:"model",modelUri:A.parse(t),config:n,backupOf:s?A.parse(s):void 0});return l.setDirty(o),l.setMatchRanges(r),l}else return s?i.invokeFunction(DN,{from:"existingFile",fileUri:A.parse(s)}):i.invokeFunction(DN,{from:"rawData",resultsContents:"",config:n})}};ne.as(qo.EditorFactory).registerEditorSerializer(Pp.ID,I0i);$e.registerCommand(Imn,a=>{let i=a.get(ee).activeEditorPane;i instanceof Oq&&i.cleanState()});var rE=L(14147,"Search Editor"),y0i=(a={})=>{let i={},e={includes:"filesToInclude",excludes:"filesToExclude",wholeWord:"matchWholeWord",caseSensitive:"isCaseSensitive",regexp:"isRegexp",useIgnores:"useExcludeSettingsAndIgnoreFiles"};return Object.entries(a).forEach(([t,o])=>{i[e[t]??t]=o}),i},w0i={description:"Open a new search editor. Arguments passed can include variables like ${relativeFileDirname}.",args:[{name:"Open new Search Editor args",schema:{properties:{query:{type:"string"},filesToInclude:{type:"string"},filesToExclude:{type:"string"},contextLines:{type:"number"},matchWholeWord:{type:"boolean"},isCaseSensitive:{type:"boolean"},isRegexp:{type:"boolean"},useExcludeSettingsAndIgnoreFiles:{type:"boolean"},showIncludesExcludes:{type:"boolean"},triggerSearch:{type:"boolean"},focusResults:{type:"boolean"},onlyOpenEditors:{type:"boolean"}}}}]};W(class extends K{constructor(){super({id:"search.searchEditor.action.deleteFileResults",title:L(14165,"Delete File Results"),keybinding:{weight:100,primary:3073},precondition:Kb,category:rE,f1:!0})}async run(a){a.get(X).getContext(Nn()).getValue(Kb.serialize())&&a.get(ee).activeEditorPane.deleteResultBlock()}});W(class extends K{constructor(){super({id:bxo,title:L(14153,"New Search Editor"),category:rE,f1:!0,metadata:w0i})}async run(a,i){await a.get(F).invokeFunction(TVe,y0i({location:"new",...i}))}});W(class extends K{constructor(){super({id:Vfe,title:L(14155,"Open Search Editor"),category:rE,f1:!0,metadata:w0i})}async run(a,i){await a.get(F).invokeFunction(TVe,y0i({location:"reuse",...i}))}});W(class extends K{constructor(){super({id:dmn,title:L(14152,"Open New Search Editor to the Side"),category:rE,f1:!0,metadata:w0i})}async run(a,i){await a.get(F).invokeFunction(TVe,y0i(i),!0)}});W(class extends K{constructor(){super({id:cmn,title:L(14154,"Open Results in Editor"),category:rE,f1:!0,keybinding:{primary:515,when:C.and(_i.HasSearchResults,_i.SearchViewFocusedKey),weight:200,mac:{primary:2051}}})}async run(a){let i=a.get($t),e=a.get(F),t=qc(i);t&&await e.invokeFunction(v$t,t.searchResult,t.searchIncludePattern.getValue(),t.searchExcludePattern.getValue(),t.searchIncludePattern.onlySearchInOpenEditors())}});W(class extends K{constructor(){super({id:Smn,title:L(14156,"Search Again"),category:rE,keybinding:{primary:3120,when:Kb,weight:100},icon:l$t,menu:[...[D.EditorTitle,D.CompactWindowEditorTitle].map(a=>({id:a,group:"navigation",when:fr.isEqualTo(Est)})),{id:D.CommandPalette,when:fr.isEqualTo(Est)}]})}async run(a){let i=a.get(ee);i.activeEditor instanceof Pp&&i.activeEditorPane.triggerSearch({resetCursor:!1})}});W(class extends K{constructor(){super({id:umn,title:L(14150,"Focus Search Editor Input"),category:rE,f1:!0,precondition:Kb,keybinding:{primary:9,weight:100}})}async run(a){let i=a.get(ee);i.activeEditor instanceof Pp&&i.activeEditorPane.focusSearchInput()}});W(class extends K{constructor(){super({id:pmn,title:L(14149,"Focus Search Editor Files to Include"),category:rE,f1:!0,precondition:Kb})}async run(a){let i=a.get(ee);i.activeEditor instanceof Pp&&i.activeEditorPane.focusFilesToIncludeInput()}});W(class extends K{constructor(){super({id:mmn,title:L(14148,"Focus Search Editor Files to Exclude"),category:rE,f1:!0,precondition:Kb})}async run(a){let i=a.get(ee);i.activeEditor instanceof Pp&&i.activeEditorPane.focusFilesToExcludeInput()}});W(class extends K{constructor(){super({id:hmn,title:L(14161,"Toggle Match Case"),category:rE,f1:!0,precondition:Kb,keybinding:Object.assign({weight:200,when:_i.SearchInputBoxFocusedKey},l5)})}run(a){Txo(a)}});W(class extends K{constructor(){super({id:gmn,title:L(14164,"Toggle Match Whole Word"),category:rE,f1:!0,precondition:Kb,keybinding:Object.assign({weight:200,when:_i.SearchInputBoxFocusedKey},c5)})}run(a){_xo(a)}});W(class extends K{constructor(){super({id:fmn,title:L(14163,"Toggle Use Regular Expression"),category:rE,f1:!0,precondition:Kb,keybinding:Object.assign({weight:200,when:_i.SearchInputBoxFocusedKey},d5)})}run(a){Dxo(a)}});W(class extends K{constructor(){super({id:p$t,title:L(14162,"Toggle Context Lines"),category:rE,f1:!0,precondition:Kb,keybinding:{weight:200,primary:554,mac:{primary:2602}}})}run(a){Lxo(a)}});W(class extends K{constructor(){super({id:vmn,title:L(14159,"Increase Context Lines"),category:rE,f1:!0,precondition:Kb,keybinding:{weight:200,primary:598}})}run(a){wNi(a,!0)}});W(class extends K{constructor(){super({id:bmn,title:L(14158,"Decrease Context Lines"),category:rE,f1:!0,precondition:Kb,keybinding:{weight:200,primary:600}})}run(a){wNi(a,!1)}});W(class extends K{constructor(){super({id:ymn,title:L(14160,"Select All Matches"),category:rE,f1:!0,precondition:Kb,keybinding:{weight:200,primary:3114}})}run(a){Rxo(a)}});W(class extends K{constructor(){super({id:"search.action.openNewEditorFromView",title:d(14151,null),category:rE,icon:hxo,menu:[{id:D.ViewTitle,group:"navigation",order:2,when:C.equals("view",Iy)}]})}run(i,...e){return Mxo(i)}});var UHe=class extends x{constructor(e,t){super();this.instantiationService=e;this._register(t.registerHandler(this))}static{this.ID="workbench.contrib.searchEditorWorkingCopyEditorHandler"}handles(e){return e.resource.scheme===yVe}isOpen(e,t){return this.handles(e)?t instanceof Pp&&Qe(e.resource,t.modelUri):!1}createEditor(e){let t=this.instantiationService.invokeFunction(DN,{from:"model",modelUri:e.resource});return t.setDirty(!0),t}};UHe=I([m(0,F),m(1,iv)],UHe);It(UHe.ID,UHe,St.BlockRestore);var Ave=class extends x{constructor(e){super();this.configurationService=e;this.styleSheet=Cr();U.filter(e.onDidChangeConfiguration,n=>n.affectsConfiguration("workbench.sash.size"))(this.onDidChangeSize,this,this._store),this.onDidChangeSize(),U.filter(e.onDidChangeConfiguration,n=>n.affectsConfiguration("workbench.sash.hoverDelay"))(this.onDidChangeHoverDelay,this,this._store),this.onDidChangeHoverDelay()}static{this.ID="workbench.contrib.sash"}onDidChangeSize(){let e=this.configurationService.getValue("workbench.sash.size"),t=Bn(e,4,20),o=Bn(e,1,8);this.styleSheet.textContent=`
			.monaco-workbench {
				--vscode-sash-size: ${t}px;
				--vscode-sash-hover-size: ${o}px;
			}
		`,D6i(t)}onDidChangeHoverDelay(){M6i(this.configurationService.getValue("workbench.sash.hoverDelay"))}};Ave=I([m(0,B)],Ave);It(Ave.ID,Ave,St.AfterRestored);ne.as(Jt.Configuration).registerConfiguration({...Ud,properties:{"workbench.sash.size":{type:"number",default:dc?20:4,minimum:1,maximum:20,description:d(13597,null)},"workbench.sash.hoverDelay":{type:"number",default:300,minimum:0,maximum:2e3,description:d(13596,null)}}});Ee(jDe,$De,1);var a4t=new Y("quickDiffDecorationCount",0),t_=class extends x{constructor(e,t,o,n){super();this.codeEditor=e;this.quickDiffModelRef=t;this.configurationService=o;this.quickDiffService=n;let r=o.getValue("scm.diffDecorations"),s=r==="all"||r==="gutter",l=r==="all"||r==="overview",c=r==="all"||r==="minimap",u=d(13604,null),p={gutter:s,overview:{active:l,color:fJ},minimap:{active:c,color:TTe},isWholeLine:!0};this.addedOptions=t_.createDecoration("dirty-diff-added primary",u,p),this.addedPatternOptions=t_.createDecoration("dirty-diff-added primary pattern",u,p),this.addedSecondaryOptions=t_.createDecoration("dirty-diff-added secondary",u,p),this.addedSecondaryPatternOptions=t_.createDecoration("dirty-diff-added secondary pattern",u,p);let h=d(13606,null),g={gutter:s,overview:{active:l,color:gJ},minimap:{active:c,color:ETe},isWholeLine:!0};this.modifiedOptions=t_.createDecoration("dirty-diff-modified primary",h,g),this.modifiedPatternOptions=t_.createDecoration("dirty-diff-modified primary pattern",h,g),this.modifiedSecondaryOptions=t_.createDecoration("dirty-diff-modified secondary",h,g),this.modifiedSecondaryPatternOptions=t_.createDecoration("dirty-diff-modified secondary pattern",h,g);let f=d(13605,null),v={gutter:s,overview:{active:l,color:vJ},minimap:{active:c,color:_Te},isWholeLine:!1};this.deletedOptions=t_.createDecoration("dirty-diff-deleted primary",f,v),this.deletedSecondaryOptions=t_.createDecoration("dirty-diff-deleted secondary",f,v),this._register(o.onDidChangeConfiguration(b=>{b.affectsConfiguration("scm.diffDecorationsGutterPattern")&&this.onDidChange()})),this._register(U.runAndSubscribe(this.quickDiffModelRef.object.onDidChange,()=>this.onDidChange()))}static createDecoration(e,t,o){let n={description:"dirty-diff-decoration",isWholeLine:o.isWholeLine};return o.gutter&&(n.linesDecorationsClassName=`dirty-diff-glyph ${e}`,n.linesDecorationsTooltip=t),o.overview.active&&(n.overviewRuler={color:Xs(o.overview.color),position:1}),o.minimap.active&&(n.minimap={color:Xs(o.minimap.color),position:2}),mo.createDynamic(n)}onDidChange(){if(!this.codeEditor.hasModel())return;let e=this.configurationService.getValue("scm.diffDecorationsGutterPattern"),t=this.quickDiffModelRef.object.quickDiffs.find(r=>r.kind==="primary"),o=this.quickDiffModelRef.object.changes.filter(r=>r.providerId===t?.id),n=[];for(let r of this.quickDiffModelRef.object.changes){let s=this.quickDiffModelRef.object.quickDiffs.find(p=>p.id===r.providerId);if(!s||!this.quickDiffService.isQuickDiffProviderVisible(s.id)||s.kind!=="primary"&&o.some(p=>p.change2.modified.intersectsOrTouches(r.change2.modified)))continue;let l=D9e(r.change),c=r.change.modifiedStartLineNumber,u=r.change.modifiedEndLineNumber||c;switch(l){case 1:n.push({range:{startLineNumber:c,startColumn:1,endLineNumber:u,endColumn:1},options:s.kind==="primary"||s.kind==="contributed"?e.added?this.addedPatternOptions:this.addedOptions:e.added?this.addedSecondaryPatternOptions:this.addedSecondaryOptions});break;case 2:n.push({range:{startLineNumber:c,startColumn:Number.MAX_VALUE,endLineNumber:c,endColumn:Number.MAX_VALUE},options:s.kind==="primary"||s.kind==="contributed"?this.deletedOptions:this.deletedSecondaryOptions});break;case 0:n.push({range:{startLineNumber:c,startColumn:1,endLineNumber:u,endColumn:1},options:s.kind==="primary"||s.kind==="contributed"?e.modified?this.modifiedPatternOptions:this.modifiedOptions:e.modified?this.modifiedSecondaryPatternOptions:this.modifiedSecondaryOptions});break}}this.decorationsCollection?this.decorationsCollection.set(n):this.decorationsCollection=this.codeEditor.createDecorationsCollection(n)}dispose(){this.decorationsCollection&&this.decorationsCollection.clear(),this.decorationsCollection=void 0,this.quickDiffModelRef.dispose(),super.dispose()}};t_=I([m(2,B),m(3,mT)],t_);var zHe=class extends x{constructor(e,t,o,n,r,s){super();this.editorService=e;this.configurationService=t;this.quickDiffModelService=o;this.quickDiffService=n;this.uriIdentityService=r;this.enabled=!1;this.decorators=new gt;this.viewState={width:3,visibility:"always"};this.transientDisposables=this._register(new N);this.stylesheet=Cr(void 0,void 0,this._store),this.quickDiffDecorationCount=a4t.bindTo(s),this.activeEditor=ui(this,this.editorService.onDidActiveEditorChange,()=>this.editorService.activeEditor),this.quickDiffProviders=ui(this,this.quickDiffService.onDidChangeQuickDiffProviders,()=>this.quickDiffService.providers);let l=U.filter(t.onDidChangeConfiguration,p=>p.affectsConfiguration("scm.diffDecorations"));this._register(l(this.onDidChangeConfiguration,this)),this.onDidChangeConfiguration();let c=U.filter(t.onDidChangeConfiguration,p=>p.affectsConfiguration("scm.diffDecorationsGutterWidth"));this._register(c(this.onDidChangeDiffWidthConfiguration,this)),this.onDidChangeDiffWidthConfiguration();let u=U.filter(t.onDidChangeConfiguration,p=>p.affectsConfiguration("scm.diffDecorationsGutterVisibility"));this._register(u(this.onDidChangeDiffVisibilityConfiguration,this)),this.onDidChangeDiffVisibilityConfiguration()}onDidChangeConfiguration(){this.configurationService.getValue("scm.diffDecorations")!=="none"?this.enable():this.disable()}onDidChangeDiffWidthConfiguration(){let e=this.configurationService.getValue("scm.diffDecorationsGutterWidth");(isNaN(e)||e<=0||e>5)&&(e=3),this.setViewState({...this.viewState,width:e})}onDidChangeDiffVisibilityConfiguration(){let e=this.configurationService.getValue("scm.diffDecorationsGutterVisibility");this.setViewState({...this.viewState,visibility:e})}setViewState(e){this.viewState=e,this.stylesheet.textContent=`
			.monaco-editor .dirty-diff-added,
			.monaco-editor .dirty-diff-modified {
				border-left-width:${e.width}px;
			}
			.monaco-editor .dirty-diff-added.pattern,
			.monaco-editor .dirty-diff-added.pattern:before,
			.monaco-editor .dirty-diff-modified.pattern,
			.monaco-editor .dirty-diff-modified.pattern:before {
				background-size: ${e.width}px ${e.width}px;
			}
			.monaco-editor .dirty-diff-added,
			.monaco-editor .dirty-diff-modified,
			.monaco-editor .dirty-diff-deleted {
				opacity: ${e.visibility==="always"?1:0};
			}
		`}enable(){this.enabled&&this.disable(),this.transientDisposables.add(U.any(this.editorService.onDidCloseEditor,this.editorService.onDidVisibleEditorsChange)(()=>this.onEditorsChanged())),this.onEditorsChanged(),this.onDidActiveEditorChange(),this.onDidChangeQuickDiffProviders(),this.enabled=!0}disable(){if(this.enabled){this.transientDisposables.clear(),this.quickDiffDecorationCount.set(0);for(let[e,t]of this.decorators.entries())t.dispose(),this.decorators.delete(e);this.enabled=!1}}onDidActiveEditorChange(){this.transientDisposables.add(be(e=>{let t=this.activeEditor.read(e),o=this.editorService.activeTextEditorControl;if(!pn(o)||!t?.resource){this.quickDiffDecorationCount.set(0);return}let n=this.quickDiffModelService.createQuickDiffModelReference(t.resource);if(!n){this.quickDiffDecorationCount.set(0);return}e.store.add(n);let r=ui(this,n.object.onDidChange,()=>{let s=n.object.quickDiffs.filter(l=>this.quickDiffService.isQuickDiffProviderVisible(l.id));return n.object.changes.filter(l=>s.some(c=>c.id===l.providerId)).length});e.store.add(be(s=>{let l=r.read(s);this.quickDiffDecorationCount.set(l)}))}))}onDidChangeQuickDiffProviders(){this.transientDisposables.add(be(e=>{let t=this.quickDiffProviders.read(e),o=[];for(let n=0;n<t.length;n++){let r=t[n];if(o.includes(r.label))continue;let s=this.quickDiffService.isQuickDiffProviderVisible(r.id),l=r.kind!=="contributed"?"0_scm":"1_contributed",c=n+1;e.store.add(W(class extends K{constructor(){super({id:`workbench.scm.action.toggleQuickDiffVisibility.${r.id}`,title:r.label,toggled:s?KI.INSTANCE:Xy.INSTANCE,menu:{id:D.SCMQuickDiffDecorations,group:l,order:c},f1:!1})}run(u){u.get(mT).toggleQuickDiffProviderVisibility(r.id)}})),o.push(r.label)}}))}onEditorsChanged(){for(let e of this.editorService.visibleTextEditorControls){if(!pn(e))continue;let t=e.getModel();if(!t)continue;let o=e.getId();if(this.decorators.get(t.uri)?.has(o))continue;let n=this.quickDiffModelService.createQuickDiffModelReference(t.uri);n&&(this.decorators.has(t.uri)||this.decorators.set(t.uri,new Vt),this.decorators.get(t.uri).set(o,new t_(e,n,this.configurationService,this.quickDiffService)))}for(let[e,t]of this.decorators.entries()){for(let o of t.keys())this.editorService.visibleTextEditorControls.find(r=>pn(r)&&r.getId()===o&&this.uriIdentityService.extUri.isEqual(r.getModel()?.uri,e))||t.deleteAndDispose(o);t.size===0&&(t.dispose(),this.decorators.delete(e))}}dispose(){this.disable(),super.dispose()}};zHe=I([m(0,ee),m(1,B),m(2,qF),m(3,mT),m(4,ht),m(5,X)],zHe);var l4t={ActiveRepositoryName:new Y("scmActiveRepositoryName",""),ActiveRepositoryBranchName:new Y("scmActiveRepositoryBranchName","")},KHe=class extends x{constructor(e,t,o,n,r,s,l){super();this.activityService=e;this.configurationService=t;this.contextKeyService=o;this.scmService=n;this.scmViewService=r;this.statusbarService=s;this.titleService=l;this._activeRepositoryNameContextKey=l4t.ActiveRepositoryName.bindTo(this.contextKeyService),this._activeRepositoryBranchNameContextKey=l4t.ActiveRepositoryBranchName.bindTo(this.contextKeyService),this.titleService.registerVariables([{name:"activeRepositoryName",contextKey:l4t.ActiveRepositoryName.key},{name:"activeRepositoryBranchName",contextKey:l4t.ActiveRepositoryBranchName.key}]),this._countBadgeConfig=hr("scm.countBadge","all",this.configurationService),this._visibleRepositories=ui(this,U.any(this.scmViewService.onDidChangeVisibleRepositories,this.scmService.onDidAddRepository,this.scmService.onDidRemoveRepository),()=>this.scmViewService.visibleRepositories),this._activeRepositoryHistoryItemRefName=ke(c=>this.scmViewService.activeRepository.read(c)?.repository.provider.historyProvider.read(c)?.historyItemRef.read(c)?.name),this._countBadgeRepositories=ke(this,c=>{switch(this._countBadgeConfig.read(c)){case"all":return this._visibleRepositories.read(c).map(p=>({provider:p.provider,resourceCount:this._getRepositoryResourceCount(p)}));case"focused":{let u=this.scmViewService.activeRepository.read(c);return u?[{provider:u.repository.provider,resourceCount:this._getRepositoryResourceCount(u.repository)}]:[]}case"off":return[];default:throw new Error("Invalid countBadge setting")}}),this._countBadge=ke(this,c=>{let u=0;for(let p of this._countBadgeRepositories.read(c)){let h=p.provider.count?.read(c),g=p.resourceCount.read(c);u=u+(h??g)}return u}),this._register(be(c=>{let u=this._countBadge.read(c);this._updateActivityCountBadge(u,c.store)})),this._register(be(c=>{let u=this.scmViewService.activeRepository.read(c),p=u?.repository.provider.statusBarCommands.read(c);this._updateStatusBar(u,p??[],c.store)})),this._register(be(c=>{let u=this.scmViewService.activeRepository.read(c),p=this._activeRepositoryHistoryItemRefName.read(c);this._updateActiveRepositoryContextKeys(u?.repository.provider.name,p)}))}_getRepositoryResourceCount(e){return ui(this,e.provider.onDidChangeResources,()=>Rzt(e.provider))}_updateActivityCountBadge(e,t){if(e===0)return;let o=new Rd(e,n=>d(13600,null,n));t.add(this.activityService.showViewActivity(Jf,{badge:o}))}_updateStatusBar(e,t,o){if(!e)return;let n=e.repository.provider.rootUri?`${He(e.repository.provider.rootUri)} (${e.repository.provider.label})`:e.repository.provider.label;for(let r=0;r<t.length;r++){let s=t[r],l=`${n}${s.tooltip?` - ${s.tooltip}`:""}`,c=iDi(s),u={name:d(13601,null)+(c?` ${c}`:""),text:s.title,ariaLabel:l,tooltip:l,command:s.id?s:void 0};o.add(r===0?this.statusbarService.addEntry(u,`status.scm.${r}`,0,1e4):this.statusbarService.addEntry(u,`status.scm.${r}`,0,{location:{id:`status.scm.${r-1}`,priority:1e4},alignment:1,compact:!0}))}if(this.scmViewService.repositories.length>1){let r=Pzt(e,e.repository),s={name:d(13602,null),text:`$(${r.id}) ${e.repository.provider.name}`,ariaLabel:n,tooltip:n,command:"scm.setActiveProvider"};o.add(this.statusbarService.addEntry(s,"status.scm.provider",0,{location:{id:"status.scm.0",priority:1e4},alignment:0,compact:!0}))}}_updateActiveRepositoryContextKeys(e,t){this._activeRepositoryNameContextKey.set(e??""),this._activeRepositoryBranchNameContextKey.set(t??"")}};KHe=I([m(0,Sl),m(1,B),m(2,X),m(3,rd),m(4,_u),m(5,kr),m(6,T0)],KHe);var GHe=class extends x{constructor(e,t,o){super();this.scmService=t;this.uriIdentityService=o;this._onDidRepositoryChange=new E;let n=new Y("scmActiveResourceHasChanges",!1,d(13598,null)),r=new Y("scmActiveResourceRepository",void 0,d(13599,null));this._repositories=ui(this,U.any(this.scmService.onDidAddRepository,this.scmService.onDidRemoveRepository),()=>this.scmService.repositories),this._register(be(c=>{for(let u of this._repositories.read(c))c.store.add(U.runAndSubscribe(u.provider.onDidChangeResources,()=>{this._onDidRepositoryChange.fire()}))}));let s={contextKey:n,getGroupContextKeyValue:c=>this._getEditorHasChanges(c.activeEditor),onDidChange:this._onDidRepositoryChange.event},l={contextKey:r,getGroupContextKeyValue:c=>this._getEditorRepositoryId(c.activeEditor),onDidChange:this._onDidRepositoryChange.event};this._store.add(e.registerContextKeyProvider(s)),this._store.add(e.registerContextKeyProvider(l))}_getEditorHasChanges(e){let t=po.getOriginalUri(e);if(!t)return!1;let o=this.scmService.getRepository(t);for(let n of o?.provider.groups??[])if(n.resources.some(r=>this.uriIdentityService.extUri.isEqual(t,r.sourceUri)))return!0;return!1}_getEditorRepositoryId(e){let t=po.getOriginalUri(e);return t?this.scmService.getRepository(t)?.id:void 0}dispose(){this._onDidRepositoryChange.dispose(),super.dispose()}};GHe=I([m(0,wt),m(1,rd),m(2,ht)],GHe);var C0i=class extends x{constructor(e,t){super();this.repository=e;this.history=t;this._value="";this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._placeholder="";this._onDidChangePlaceholder=this._register(new E);this.onDidChangePlaceholder=this._onDidChangePlaceholder.event;this._enabled=!0;this._onDidChangeEnablement=this._register(new E);this.onDidChangeEnablement=this._onDidChangeEnablement.event;this._visible=!0;this._onDidChangeVisibility=this._register(new E);this.onDidChangeVisibility=this._onDidChangeVisibility.event;this._onDidChangeFocus=this._register(new E);this.onDidChangeFocus=this._onDidChangeFocus.event;this._onDidChangeValidationMessage=this._register(new E);this.onDidChangeValidationMessage=this._onDidChangeValidationMessage.event;this._onDidClearValidation=this._register(new E);this.onDidClearValidation=this._onDidClearValidation.event;this._validateInput=()=>Promise.resolve(void 0);this._onDidChangeValidateInput=this._register(new E);this.onDidChangeValidateInput=this._onDidChangeValidateInput.event;this.didChangeHistory=!1;this.repository.provider.rootUri?(this.historyNavigator=t.getHistory(this.repository.provider.label,this.repository.provider.rootUri),this._register(this.history.onWillSaveHistory(o=>{this.historyNavigator.isAtEnd()&&this.saveValue(),this.didChangeHistory&&o.historyDidIndeedChange(),this.didChangeHistory=!1}))):this.historyNavigator=new YV([""],100),this._value=this.historyNavigator.current()}get value(){return this._value}get placeholder(){return this._placeholder}set placeholder(e){this._placeholder=e,this._onDidChangePlaceholder.fire(e)}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this._onDidChangeEnablement.fire(e)}get visible(){return this._visible}set visible(e){this._visible=e,this._onDidChangeVisibility.fire(e)}setFocus(){this._onDidChangeFocus.fire()}showValidationMessage(e,t){this._onDidChangeValidationMessage.fire({message:e,type:t})}clearValidation(){this._onDidClearValidation.fire()}get validateInput(){return this._validateInput}set validateInput(e){this._validateInput=e,this._onDidChangeValidateInput.fire()}setValue(e,t,o){e!==this._value&&(t||(this.historyNavigator.replaceLast(this._value),this.historyNavigator.add(e),this.didChangeHistory=!0),this._value=e,this._onDidChange.fire({value:e,reason:o}))}showNextHistoryValue(){if(this.historyNavigator.isAtEnd())return;this.historyNavigator.has(this.value)||(this.saveValue(),this.historyNavigator.resetCursor());let e=this.historyNavigator.next();this.setValue(e,!0,1)}showPreviousHistoryValue(){this.historyNavigator.isAtEnd()?this.saveValue():this.historyNavigator.has(this._value)||(this.saveValue(),this.historyNavigator.resetCursor());let e=this.historyNavigator.previous();this.setValue(e,!0,0)}saveValue(){let e=this.historyNavigator.replaceLast(this._value);this.didChangeHistory=this.didChangeHistory||e!==this._value}},x0i=class{constructor(i,e,t,o){this.id=i;this.provider=e;this.disposables=t;this._selected=!1;this._onDidChangeSelection=new E;this.onDidChangeSelection=this._onDidChangeSelection.event;this.input=new C0i(this,o)}get selected(){return this._selected}setSelected(i){this._selected!==i&&(this._selected=i,this._onDidChangeSelection.fire(i))}dispose(){this.disposables.dispose(),this._onDidChangeSelection.dispose(),this.input.dispose(),this.provider.dispose()}},k0i=class{constructor(){this._didChangeHistory=!1}get didChangeHistory(){return this._didChangeHistory}historyDidIndeedChange(){this._didChangeHistory=!0}},glt=class{constructor(i,e){this.storageService=i;this.workspaceContextService=e;this.disposables=new N;this.histories=new Map;this._onWillSaveHistory=this.disposables.add(new E);this.onWillSaveHistory=this._onWillSaveHistory.event;this.histories=new Map;let t=this.storageService.getObject("scm.history",1,[]);for(let[o,n,r]of t){let s=this.histories.get(o);s||(s=new gt,this.histories.set(o,s)),s.set(n,new YV(r,100))}this.migrateStorage()&&this.saveToStorage(),this.disposables.add(this.storageService.onDidChangeValue(1,"scm.history",this.disposables)(o=>{if(o.external&&o.key==="scm.history"){let n=this.storageService.getObject("scm.history",1,[]);for(let[r,s,l]of n){let c=this.getHistory(r,s);for(let u of vt.reverse(l))c.prepend(u)}}})),this.disposables.add(this.storageService.onWillSaveState(o=>{let n=new k0i;this._onWillSaveHistory.fire(n),n.didChangeHistory&&this.saveToStorage()}))}saveToStorage(){let i=[];for(let[e,t]of this.histories)for(let[o,n]of t)n.size===1&&n.current()===""||i.push([e,o,[...n]]);this.storageService.store("scm.history",i,1,0)}getHistory(i,e){let t=this.histories.get(i);t||(t=new gt,this.histories.set(i,t));let o=t.get(e);return o||(o=new YV([""],100),t.set(e,o)),o}migrateStorage(){let i=!1,e=vt.filter(this.storageService.keys(-1,1),t=>t.startsWith("scm/input:"));for(let t of e)try{let o=JSON.parse(this.storageService.get(t,-1,"")),n=/^scm\/input:([^:]+):(.+)$/.exec(t);if(!n||!Array.isArray(o?.history)||!Number.isInteger(o?.timestamp)){this.storageService.remove(t,-1);continue}let[,r,s]=n,l=A.file(s);if(this.workspaceContextService.getWorkspaceFolder(l)){let c=this.getHistory(r,l);for(let u of vt.reverse(o.history))c.prepend(u);i=!0,this.storageService.remove(t,-1)}}catch{this.storageService.remove(t,-1)}return i}dispose(){this.disposables.dispose()}};glt=I([m(0,ce),m(1,Pe)],glt);var qHe=class{constructor(i,e,t,o,n){this.logService=i;this.uriIdentityService=n;this._repositories=new Map;this._onDidAddProvider=new E;this.onDidAddRepository=this._onDidAddProvider.event;this._onDidRemoveProvider=new E;this.onDidRemoveRepository=this._onDidRemoveProvider.event;this.inputHistory=new glt(o,e),this.providerCount=t.createKey("scm.providerCount",0),this.historyProviderCount=t.createKey("scm.historyProviderCount",0)}get repositories(){return this._repositories.values()}get repositoryCount(){return this._repositories.size}registerSCMProvider(i){if(this.logService.trace("SCMService#registerSCMProvider"),this._repositories.has(i.id))throw new Error(`SCM Provider ${i.id} already exists.`);let e=new N,t=()=>Array.from(this._repositories.values()).filter(n=>!!n.provider.historyProvider.get()).length;e.add(Z(()=>{this._repositories.delete(i.id),this._onDidRemoveProvider.fire(o),this.providerCount.set(this._repositories.size),this.historyProviderCount.set(t())}));let o=new x0i(i.id,i,e,this.inputHistory);return this._repositories.set(i.id,o),e.add(Vs(i.historyProvider,()=>{this.historyProviderCount.set(t())})),this.providerCount.set(this._repositories.size),this.historyProviderCount.set(t()),this._onDidAddProvider.fire(o),o}getRepository(i){if(typeof i=="string")return this._repositories.get(i);if(i.scheme!==Q.file&&i.scheme!==Q.vscodeRemote)return;let e,t=Number.POSITIVE_INFINITY;for(let o of this.repositories){if(o.provider.isHidden===!0)continue;let n=o.provider.rootUri;if(!n)continue;let r=this.uriIdentityService.extUri.relativePath(n,i);r&&!/^\.\./.test(r)&&r.length<t&&(e=o,t=r.length)}return e}};qHe=I([m(0,se),m(1,Pe),m(2,X),m(3,ce),m(4,ht)],qHe);var $He=class extends Dc{constructor(i,e,t,o,n,r,s,l,c,u,p){super(mue,{mergeViewWithContainerWhenSingleView:!0},t,s,i,o,e,l,n,r,c,u,p)}create(i){super.create(i),i.classList.add("scm-viewlet")}getOptimalWidth(){return 400}};$He=I([m(0,yi),m(1,Te),m(2,F),m(3,Xe),m(4,Le),m(5,ce),m(6,B),m(7,lt),m(8,Pe),m(9,Bi),m(10,se)],$He);var jHe=class extends rs{constructor(e){super();this.getSelectedRepositories=e}async runAction(e,t){if(!(e instanceof Lo))return super.runAction(e,t);let o=[t],n=this.getSelectedRepositories().map(r=>r.provider);n.some(r=>r===t)&&o.push(...n.filter(r=>r!==t)),await e.run(...o)}},qW=class{constructor(i,e,t,o,n,r,s,l,c,u,p){this.toolbarMenuId=i;this.actionViewItemProvider=e;this.commandService=t;this.contextKeyService=o;this.contextMenuService=n;this.keybindingService=r;this.labelService=s;this.menuService=l;this.scmViewService=c;this.telemetryService=u;this.uriIdentityService=p;this.onDidChangeVisibleRepositoriesSignal=Fr(this,this.scmViewService.onDidChangeVisibleRepositories)}static{this.TEMPLATE_ID="repository"}get templateId(){return qW.TEMPLATE_ID}renderTemplate(i){let e=M(i,_(".scm-provider")),t=M(e,_(".icon")),o=new Bc(e,{supportIcons:!1}),n=M(e,_(".actions")),r=new ol(n,{actionViewItemProvider:this.actionViewItemProvider,resetMenu:this.toolbarMenuId,responsiveBehavior:{enabled:!0,kind:"all",minItems:2}},this.menuService,this.contextKeyService,this.contextMenuService,this.keybindingService,this.commandService,this.telemetryService),s=M(e,_(".count")),l=new _v(s,{},iI),c=r.onDidChangeDropdownVisibility(p=>e.classList.toggle("active",p)),u=wn(o,c,r);return{icon:t,label:o,countContainer:s,count:l,toolBar:r,elementDisposables:new N,templateDisposable:u}}renderElement(i,e,t){let o=Ad(i)?i:i.element;t.elementDisposables.add(be(h=>{this.onDidChangeVisibleRepositoriesSignal.read(h);let g=this.scmViewService.isVisible(o),f=q.isThemeIcon(o.provider.iconPath)?o.provider.iconPath:R.repo,v=f.id===R.repo.id&&g&&this.scmViewService.repositories.length>1;t.icon.className=v?`icon ${q.asClassName(R.repoSelected)}`:`icon ${q.asClassName(f)}`}));let n;if(o.provider.rootUri){let h=this.scmViewService.repositories.filter(f=>f.provider.rootUri!==void 0&&this.uriIdentityService.extUri.isEqual(f.provider.rootUri,o.provider.rootUri)),g=this.scmViewService.repositories.filter(f=>f.provider.rootUri!==void 0&&f.provider.name===o.provider.name);if(h.length>1)n=o.provider.label;else if(g.length>1){let f=g.findIndex(b=>b===o);n=awe(g.map(b=>this.labelService.getUriLabel(ci(b.provider.rootUri),{relative:!0})))[f]}}let r;if(this.scmViewService.explorerEnabledConfig.get()===!1)r=o.provider.name;else{let h=this.scmViewService.repositories.find(g=>g.provider.id===o.provider.parentId);r=h?`${h.provider.name} / ${o.provider.name}`:o.provider.name}let s=o.provider.rootUri?`${o.provider.label}: ${this.labelService.getUriLabel(o.provider.rootUri)}`:o.provider.label;t.label.setLabel(r,n,{title:s});let l=[],c=[],u=[],p=()=>{t.toolBar.setActions([...l,...c],u)};t.elementDisposables.add(be(h=>{l=(o.provider.statusBarCommands.read(h)??[]).map(f=>h.store.add(new uot(f,this.commandService))),p()})),t.elementDisposables.add(be(h=>{let g=o.provider.count.read(h)??Rzt(o.provider);t.countContainer.setAttribute("data-count",String(g)),t.count.setCount(g)})),t.elementDisposables.add(be(h=>{o.provider.contextValue.read(h);let g=this.scmViewService.menus.getRepositoryMenus(o.provider),f=this.toolbarMenuId===D.SCMTitle?g.titleMenu.menu:g.getRepositoryMenu(o);h.store.add($te(f,(v,b)=>{c=v,u=b,p()},this.toolbarMenuId===D.SCMTitle?"navigation":"inline"))})),t.toolBar.context=o.provider}renderCompressedElements(){throw new Error("Should never happen since node is incompressible")}disposeElement(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.elementDisposables.dispose(),i.templateDisposable.dispose(),i.count.dispose()}};qW=I([m(2,ge),m(3,X),m(4,Xe),m(5,_e),m(6,rt),m(7,Kt),m(8,_u),m(9,Te),m(10,ht)],qW);function gTo(a,i){return a.id===i.id}var QHe=class{constructor(i,e){this._actions=[];this._secondaryActions=[];this.disposables=new N;this._onDidChangeTitle=this.disposables.add(new E);this.onDidChangeTitle=this._onDidChangeTitle.event;this.menu=i.createMenu(D.SCMTitle,e),this.disposables.add(this.menu),this.menu.onDidChange(this.updateTitleActions,this,this.disposables),this.updateTitleActions()}get actions(){return this._actions}get secondaryActions(){return this._secondaryActions}updateTitleActions(){let{primary:i,secondary:e}=ml(this.menu.getActions({shouldForwardArgs:!0}));$i(i,this._actions,gTo)&&$i(e,this._secondaryActions,gTo)||(this._actions=i,this._secondaryActions=e,this._onDidChangeTitle.fire())}dispose(){this.disposables.dispose()}};QHe=I([m(0,Kt),m(1,X)],QHe);var E0i=class{constructor(i,e){this.contextKeyService=i;this.menuService=e}get resourceFolderMenu(){return this._resourceFolderMenu||(this._resourceFolderMenu=this.menuService.createMenu(D.SCMResourceFolderContext,this.contextKeyService)),this._resourceFolderMenu}getResourceGroupMenu(i){if(typeof i.contextValue>"u")return this.genericResourceGroupMenu||(this.genericResourceGroupMenu=this.menuService.createMenu(D.SCMResourceGroupContext,this.contextKeyService)),this.genericResourceGroupMenu;this.contextualResourceGroupMenus||(this.contextualResourceGroupMenus=new Map);let e=this.contextualResourceGroupMenus.get(i.contextValue);if(!e){let t=this.contextKeyService.createOverlay([["scmResourceGroupState",i.contextValue]]),o=this.menuService.createMenu(D.SCMResourceGroupContext,t);e={menu:o,dispose(){o.dispose()}},this.contextualResourceGroupMenus.set(i.contextValue,e)}return e.menu}getResourceMenu(i){if(typeof i.contextValue>"u")return this.genericResourceMenu||(this.genericResourceMenu=this.menuService.createMenu(D.SCMResourceContext,this.contextKeyService)),this.genericResourceMenu;this.contextualResourceMenus||(this.contextualResourceMenus=new Map);let e=this.contextualResourceMenus.get(i.contextValue);if(!e){let t=this.contextKeyService.createOverlay([["scmResourceState",i.contextValue]]),o=this.menuService.createMenu(D.SCMResourceContext,t);e={menu:o,dispose(){o.dispose()}},this.contextualResourceMenus.set(i.contextValue,e)}return e.menu}dispose(){this.genericResourceGroupMenu?.dispose(),this.genericResourceMenu?.dispose(),this._resourceFolderMenu?.dispose(),this.contextualResourceGroupMenus&&(Be(this.contextualResourceGroupMenus.values()),this.contextualResourceGroupMenus.clear(),this.contextualResourceGroupMenus=void 0),this.contextualResourceMenus&&(Be(this.contextualResourceMenus.values()),this.contextualResourceMenus.clear(),this.contextualResourceMenus=void 0)}},flt=class{constructor(i,e,t,o){this.provider=i;this.menuService=o;this.artifactGroupMenus=new Map;this.artifactMenus=new Map;this.resourceGroupMenusItems=new Map;this.disposables=new N;this.contextKeyService=e.createOverlay([["scmProvider",i.providerId],["scmProviderRootUri",i.rootUri?.toString()],["scmProviderHasRootUri",!!i.rootUri]]);let n=new _o([X,this.contextKeyService]);t=t.createChild(n,this.disposables),this.titleMenu=t.createInstance(QHe),this.disposables.add(this.titleMenu),i.onDidChangeResourceGroups(this.onDidChangeResourceGroups,this,this.disposables),this.onDidChangeResourceGroups()}getArtifactGroupMenu(i){let e=this.artifactGroupMenus.get(i.id);if(!e){let t=this.contextKeyService.createOverlay([["scmArtifactGroup",i.id]]),o=this.menuService.createMenu(D.SCMArtifactGroupContext,t);e={menu:o,dispose(){o.dispose()}},this.artifactGroupMenus.set(i.id,e)}return e.menu}getArtifactMenu(i,e){let o=this.provider.historyProvider.get()?.historyItemRef.get(),n=e.id===o?.id,r=n?`${i.id}|historyItemRef`:i.id,s=this.artifactMenus.get(r);if(!s){let l=this.contextKeyService.createOverlay([["scmArtifactGroupId",i.id],["scmArtifactIsHistoryItemRef",n]]),c=this.menuService.createMenu(D.SCMArtifactContext,l);s={menu:c,dispose(){c.dispose()}},this.artifactMenus.set(r,s)}return s.menu}getRepositoryMenu(i){let e=i.provider.contextValue.get();if(typeof e>"u")return this.genericRepositoryMenu||(this.genericRepositoryMenu=this.menuService.createMenu(D.SCMSourceControlInline,this.contextKeyService)),this.genericRepositoryMenu;this.contextualRepositoryMenus||(this.contextualRepositoryMenus=new Map);let t=this.contextualRepositoryMenus.get(e);if(!t){let o=this.contextKeyService.createOverlay([["scmProviderContext",e]]),n=this.menuService.createMenu(D.SCMSourceControlInline,o);t={menu:n,dispose(){n.dispose()}},this.contextualRepositoryMenus.set(e,t)}return t.menu}getRepositoryContextMenu(i){let e=i.provider.contextValue.get();if(typeof e>"u")return this.genericRepositoryContextMenu||(this.genericRepositoryContextMenu=this.menuService.createMenu(D.SCMSourceControl,this.contextKeyService)),this.genericRepositoryContextMenu;this.contextualRepositoryContextMenus||(this.contextualRepositoryContextMenus=new Map);let t=this.contextualRepositoryContextMenus.get(e);if(!t){let o=this.contextKeyService.createOverlay([["scmProviderContext",e]]),n=this.menuService.createMenu(D.SCMSourceControl,o);t={menu:n,dispose(){n.dispose()}},this.contextualRepositoryContextMenus.set(e,t)}return t.menu}getResourceGroupMenu(i){return this.getOrCreateResourceGroupMenusItem(i).getResourceGroupMenu(i)}getResourceMenu(i){return this.getOrCreateResourceGroupMenusItem(i.resourceGroup).getResourceMenu(i)}getResourceFolderMenu(i){return this.getOrCreateResourceGroupMenusItem(i).resourceFolderMenu}getOrCreateResourceGroupMenusItem(i){let e=this.resourceGroupMenusItems.get(i);if(!e){let t=this.contextKeyService.createOverlay([["scmResourceGroup",i.id],["multiDiffEditorEnableViewChanges",i.multiDiffEditorEnableViewChanges]]);e=new E0i(t,this.menuService),this.resourceGroupMenusItems.set(i,e)}return e}onDidChangeResourceGroups(){for(let i of this.resourceGroupMenusItems.keys())this.provider.groups.includes(i)||(this.resourceGroupMenusItems.get(i)?.dispose(),this.resourceGroupMenusItems.delete(i))}dispose(){this.genericRepositoryMenu?.dispose(),this.contextualRepositoryMenus&&(Be(this.contextualRepositoryMenus.values()),this.contextualRepositoryMenus.clear(),this.contextualRepositoryMenus=void 0),this.resourceGroupMenusItems.forEach(i=>i.dispose()),this.disposables.dispose()}};flt=I([m(1,X),m(2,F),m(3,Kt)],flt);var YHe=class{constructor(i,e){this.instantiationService=e;this.disposables=new N;this.menus=new Map;this.titleMenu=e.createInstance(QHe),i.onDidRemoveRepository(this.onDidRemoveRepository,this,this.disposables)}onDidRemoveRepository(i){this.menus.get(i.provider)?.dispose(),this.menus.delete(i.provider)}getRepositoryMenus(i){let e=this.menus.get(i);if(!e){let t=this.instantiationService.createInstance(flt,i);e={menus:t,dispose:()=>{t.dispose(),this.menus.delete(i)}},this.menus.set(i,e)}return e.menus}dispose(){this.disposables.dispose()}};YHe=I([m(0,rd),m(1,F)],YHe);ve.appendMenuItem(D.SCMResourceContext,{title:d(13603,null),submenu:D.SCMResourceContextShare,group:"45_share",order:3});function T0i(a){return`${a.providerId}:${a.label}${a.rootUri?`:${a.rootUri.toString()}`:""}`}function fTo(a,i){if(!i.provider.rootUri)return i.provider.label;let e=a.getWorkspaceFolder(i.provider.rootUri);return e?.uri.toString()===i.provider.rootUri.toString()?e.name:He(i.provider.rootUri)}var vlt={RepositorySortKey:new Y("scmRepositorySortKey","discoveryTime"),RepositorySelectionMode:new Y("scmRepositorySelectionMode","single")},XHe=class{constructor(i,e,t,o){this._placeHolder=i;this._autoQuickItemDescription=e;this._quickInputService=t;this._scmViewService=o;this._autoQuickPickItem={label:d(13799,null),description:this._autoQuickItemDescription,repository:"auto"}}async pickRepository(){let i=[this._autoQuickPickItem,{type:"separator"}],e=this._scmViewService.activeRepository.get(),t=e?.repository,o=e?.pinned===!0;i.push(...this._scmViewService.repositories.map(r=>{let s=Pzt(e,r);return{label:r.provider.name,description:r.provider.rootUri?.fsPath,iconClass:q.asClassName(s),repository:r}}));let n=o?i.find(r=>r.type!=="separator"&&r.repository===t):this._autoQuickPickItem;return this._quickInputService.pick(i,{placeHolder:this._placeHolder,activeItem:n})}};XHe=I([m(2,Ue),m(3,_u)],XHe);var Fq=class{constructor(i,e,t,o,n,r,s,l){this.scmService=i;this.editorService=t;this.configurationService=r;this.storageService=s;this.workspaceContextService=l;this.didSelectRepository=!1;this.disposables=new N;this._repositories=[];this.didFinishLoadingRepositories=Me(this,!1);this._onDidChangeRepositories=new E;this.onDidChangeRepositories=this._onDidChangeRepositories.event;this._onDidSetVisibleRepositories=new E;this.onDidChangeVisibleRepositories=U.any(this._onDidSetVisibleRepositories.event,U.debounce(this._onDidChangeRepositories.event,(i,e)=>{if(!i)return e;let t=new Set(i.added),o=new Set(i.removed);for(let n of e.added)o.delete(n)||t.add(n);for(let n of e.removed)t.delete(n)||o.add(n);return{added:t,removed:o}},0,void 0,void 0,void 0,this.disposables));this._onDidFocusRepository=new E;this.onDidFocusRepository=this._onDidFocusRepository.event;this.menus=n.createInstance(YHe);let c=hr("scm.repositories.explorer",!1,this.configurationService);this.graphShowIncomingChangesConfig=hr("scm.graph.showIncomingChanges",!0,this.configurationService),this.graphShowOutgoingChangesConfig=hr("scm.graph.showOutgoingChanges",!0,this.configurationService),this.selectionModeConfig=hr("scm.repositories.selectionMode","multiple",this.configurationService),this.explorerEnabledConfig=ke(u=>c.read(u)===!0&&this.selectionModeConfig.read(u)==="single");try{this.previousState=JSON.parse(s.get("scm:view:visibleRepositories",1,"")),this.previousState&&this.previousState.visible.length>1&&this.selectionModeConfig.get()==="single"&&(this.previousState={...this.previousState,visible:[this.previousState.visible[0]]})}catch{}this._focusedRepositoryObs=Vf({owner:this,equalsFn:()=>!1},this.onDidFocusRepository,()=>this.focusedRepository),this._activeEditorObs=Vf({owner:this,equalsFn:()=>!1},this.editorService.onDidActiveEditorChange,()=>this.editorService.activeEditor),this._activeEditorRepositoryObs=Bf(this,(u,p)=>{let h=this._activeEditorObs.read(u),g=po.getOriginalUri(h);if(!g)return p;let f=this.scmService.getRepository(g);return f?Object.create(f):p}),this._activeRepositoryPinnedObs=Me(this,void 0),this._activeRepositoryObs=P$e(this,[this._activeEditorRepositoryObs,this._focusedRepositoryObs]),this.activeRepository=Os({owner:this,equalsFn:(u,p)=>u?.repository.id===p?.repository.id&&u?.pinned===p?.pinned},u=>{let p=this._activeRepositoryObs.read(u),h=this._activeRepositoryPinnedObs.read(u),g=h??p;return g?{repository:g,pinned:!!h}:void 0}),this.disposables.add(Vs(this.selectionModeConfig,u=>{if(u==="single"&&this.visibleRepositories.length>1){let p=this.visibleRepositories[0];this.visibleRepositories=[p]}else u==="multiple"&&this.repositories.length>1&&(this.visibleRepositories=this.repositories)})),this._repositoriesSortKey=this.previousState?.sortKey??this.getViewSortOrder(),this._sortKeyContextKey=vlt.RepositorySortKey.bindTo(e),this._sortKeyContextKey.set(this._repositoriesSortKey),this._selectionModelContextKey=vlt.RepositorySelectionMode.bindTo(e),this.disposables.add(be(u=>{let p=this.selectionModeConfig.read(u);this._selectionModelContextKey.set(p)})),i.onDidAddRepository(this.onDidAddRepository,this,this.disposables),i.onDidRemoveRepository(this.onDidRemoveRepository,this,this.disposables);for(let u of i.repositories)this.onDidAddRepository(u);s.onWillSaveState(this.onWillSaveState,this,this.disposables),o.onWillStop(()=>{this.onWillSaveState(),this.didFinishLoadingRepositories.set(!1,void 0)},this,this.disposables)}get repositories(){return this._repositories.filter(i=>i.repository.provider.isHidden!==!0).map(i=>i.repository)}get visibleRepositories(){return this._repositoriesSortKey==="discoveryTime"?this._repositories.filter(i=>i.repository.provider.isHidden!==!0&&i.selectionIndex!==-1).sort((i,e)=>i.selectionIndex-e.selectionIndex).map(i=>i.repository):this._repositories.filter(i=>i.repository.provider.isHidden!==!0&&i.selectionIndex!==-1).map(i=>i.repository)}set visibleRepositories(i){let e=new Set(i),t=new Set,o=new Set;for(let n of this._repositories)!e.has(n.repository)&&n.selectionIndex!==-1&&(n.selectionIndex=-1,o.add(n.repository)),e.has(n.repository)&&(n.selectionIndex===-1&&t.add(n.repository),n.selectionIndex=i.indexOf(n.repository));t.size===0&&o.size===0||(this._onDidSetVisibleRepositories.fire({added:t,removed:o}),this._repositories.find(n=>n.focused&&n.selectionIndex===-1)&&this.focus(this._repositories.find(n=>n.selectionIndex!==-1)?.repository))}get focusedRepository(){return this._repositories.find(i=>i.focused)?.repository}onDidAddRepository(i){this.didFinishLoadingRepositories.get()||this.eventuallyFinishLoading();let e={repository:i,discoveryTime:Date.now(),focused:!1,selectionIndex:-1},t=vt.empty();if(this.previousState&&!this.didFinishLoadingRepositories.get()){let o=this.previousState.all.indexOf(T0i(i.provider));if(o===-1){let n=[];this.insertRepositoryView(this._repositories,e),(this.selectionModeConfig.get()==="multiple"||!this._repositories.find(r=>r.selectionIndex!==-1))&&(this._repositories.forEach((r,s)=>{r.selectionIndex===-1&&n.push(r.repository),r.selectionIndex=s}),this._onDidChangeRepositories.fire({added:n,removed:vt.empty()})),this.didSelectRepository=!1;return}if(this.previousState.visible.indexOf(o)===-1){if(this.didSelectRepository){this.insertRepositoryView(this._repositories,e),this._onDidChangeRepositories.fire({added:vt.empty(),removed:vt.empty()});return}}else this.didSelectRepository||(t=[...this.visibleRepositories],this._repositories.forEach(n=>{n.focused=!1,n.selectionIndex=-1}),this.didSelectRepository=!0)}if(this.selectionModeConfig.get()==="multiple"||!this._repositories.find(o=>o.selectionIndex!==-1)){let o=this.getMaxSelectionIndex();this.insertRepositoryView(this._repositories,{...e,selectionIndex:o+1}),this._onDidChangeRepositories.fire({added:[e.repository],removed:t})}else this.insertRepositoryView(this._repositories,e),this._onDidChangeRepositories.fire({added:vt.empty(),removed:t});this._repositories.find(o=>o.focused)||this.focus(i)}onDidRemoveRepository(i){this.didFinishLoadingRepositories.get()||this.eventuallyFinishLoading();let e=this._repositories.findIndex(n=>n.repository===i);if(e===-1)return;let t=vt.empty(),o=this._repositories.splice(e,1);this._repositories.length>0&&this.visibleRepositories.length===0&&(this._repositories[0].selectionIndex=0,t=[this._repositories[0].repository]),this._onDidChangeRepositories.fire({added:t,removed:o.map(n=>n.repository)}),o.length===1&&o[0].focused&&this.visibleRepositories.length>0&&this.focus(this.visibleRepositories[0]),o.length===1&&this._repositories.length===0&&this._onDidFocusRepository.fire(void 0),o.length===1&&o[0].repository===this._activeRepositoryPinnedObs.get()&&this._activeRepositoryPinnedObs.set(void 0,void 0)}isVisible(i){return this._repositories.find(e=>e.repository===i)?.selectionIndex!==-1}toggleVisibility(i,e){if(typeof e>"u")e=!this.isVisible(i);else if(this.isVisible(i)===e)return;if(e)this.selectionModeConfig.get()==="single"?this.visibleRepositories=[i]:this.selectionModeConfig.get()==="multiple"&&(this.visibleRepositories=[...this.visibleRepositories,i]);else{let t=this.visibleRepositories.indexOf(i);t>-1&&(this.visibleRepositories=[...this.visibleRepositories.slice(0,t),...this.visibleRepositories.slice(t+1)])}}toggleSortKey(i){this._repositoriesSortKey=i,this._sortKeyContextKey.set(this._repositoriesSortKey),this._repositories.sort(this.compareRepositories.bind(this)),this._onDidChangeRepositories.fire({added:vt.empty(),removed:vt.empty()})}toggleSelectionMode(i){this.configurationService.updateValue("scm.repositories.selectionMode",i)}focus(i){i&&!this.isVisible(i)||(this._repositories.forEach(e=>e.focused=e.repository===i),this._repositories.find(e=>e.focused)&&this._onDidFocusRepository.fire(i))}pinActiveRepository(i){this._activeRepositoryPinnedObs.set(i,void 0)}compareRepositories(i,e){if(this._repositoriesSortKey==="discoveryTime")return i.discoveryTime-e.discoveryTime;if(this._repositoriesSortKey==="path"&&i.repository.provider.rootUri&&e.repository.provider.rootUri)return KZ(i.repository.provider.rootUri.fsPath,e.repository.provider.rootUri.fsPath);let t=fTo(this.workspaceContextService,i.repository),o=fTo(this.workspaceContextService,e.repository),n=DT(t,o);return n===0&&i.repository.provider.rootUri&&e.repository.provider.rootUri?KZ(i.repository.provider.rootUri.fsPath,e.repository.provider.rootUri.fsPath):n}getMaxSelectionIndex(){return this._repositories.length===0?-1:Math.max(...this._repositories.map(i=>i.selectionIndex))}getViewSortOrder(){switch(this.configurationService.getValue("scm.repositories.sortOrder")){case"discovery time":return"discoveryTime";case"name":return"name";case"path":return"path";default:return"discoveryTime"}}insertRepositoryView(i,e){let t=Px(i,e,this.compareRepositories.bind(this));i.splice(t<0?~t:t,0,e)}onWillSaveState(){if(!this.didFinishLoadingRepositories.get())return;let i=this.repositories.map(t=>T0i(t.provider)),e=this.visibleRepositories.map(t=>i.indexOf(T0i(t.provider)));this.previousState={all:i,visible:e,sortKey:this._repositoriesSortKey},this.storageService.store("scm:view:visibleRepositories",JSON.stringify(this.previousState),1,1)}eventuallyFinishLoading(){this.finishLoading()}finishLoading(){this.didFinishLoadingRepositories.get()||this.didFinishLoadingRepositories.set(!0,void 0)}dispose(){this.disposables.dispose(),this._onDidFocusRepository.dispose(),this._onDidChangeRepositories.dispose(),this._onDidSetVisibleRepositories.dispose()}};I([Zd(5e3)],Fq.prototype,"eventuallyFinishLoading",1),Fq=I([m(0,rd),m(1,X),m(2,ee),m(3,lt),m(4,F),m(5,B),m(6,ce),m(7,Pe)],Fq);var c4t={SCMInputHasValidationMessage:new Y("scmInputHasValidationMessage",!1)};var blt=class extends rs{constructor(e,t){super();this.input=e;this.storageService=t;this._runningActions=new Set}get runningActions(){return this._runningActions}async runAction(e){try{if(this.runningActions.size!==0&&(this._cts?.cancel(),e.id==="scm.input.cancelAction"))return;let t=[];for(let o of this.input.repository.provider.groups)t.push({resourceGroupId:o.id,resources:[...o.resources.map(n=>n.sourceUri)]});this._runningActions.add(e),this._cts=new Ye,await e.run(this.input.repository.provider.rootUri,t,this._cts.token)}finally{if(this._runningActions.delete(e),this._runningActions.size===0){let t=e.id==="scm.input.triggerSetup"?ro.defaultChatAgent?.generateCommitMessageCommand??e.id:e.id;this.storageService.store("scm.input.lastActionId",t,0,0)}}}};blt=I([m(1,ce)],blt);var Slt=class extends ol{constructor(e,t,o,n,r,s,l,c,u){super(e,t,o,n,r,l,s,u);this.menuService=o;this.contextKeyService=n;this.storageService=c;this._dropdownActions=[];this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._disposables=this._register(new me);this._dropdownAction=new it("scmInputMoreActions",d(13778,null),"codicon-chevron-down"),this._cancelAction=new Lo({id:"scm.input.cancelAction",title:d(13776,null),icon:R.stopCircle},void 0,void 0,void 0,void 0,n,s)}get dropdownActions(){return this._dropdownActions}get dropdownAction(){return this._dropdownAction}setInput(e){this._disposables.value=new N;let t=this.contextKeyService.createOverlay([["scmProvider",e.repository.provider.providerId],["scmProviderRootUri",e.repository.provider.rootUri?.toString()],["scmProviderHasRootUri",!!e.repository.provider.rootUri]]),o=this._disposables.value.add(this.menuService.createMenu(D.SCMInputBox,t,{emitEventsForSubmenuChanges:!0})),n=()=>e.repository.provider.groups.some(s=>s.resources.length>0),r=()=>{let s=jm(o.getActions({shouldForwardArgs:!0}));for(let c of s)c.enabled=n();this._dropdownAction.enabled=n();let l;if(this.actionRunner.runningActions.size!==0)l=this._cancelAction;else if(s.length===1)l=s[0];else if(s.length>1){let c=this.storageService.get("scm.input.lastActionId",0,"");l=s.find(u=>u.id===c)??s[0]}this._dropdownActions=s.length===1?[]:s,super.setActions(l?[l]:[],[]),this._onDidChange.fire()};this._disposables.value.add(o.onDidChange(()=>r())),this._disposables.value.add(e.repository.provider.onDidChangeResources(()=>r())),this._disposables.value.add(this.storageService.onDidChangeValue(0,"scm.input.lastActionId",this._disposables.value)(()=>r())),this.actionRunner=this._disposables.value.add(new blt(e,this.storageService)),this._disposables.value.add(this.actionRunner.onWillRun(s=>{this.actionRunner.runningActions.size===0&&(super.setActions([this._cancelAction],[]),this._onDidChange.fire())})),this._disposables.value.add(this.actionRunner.onDidRun(s=>{this.actionRunner.runningActions.size===0&&r()})),r()}};Slt=I([m(2,Kt),m(3,X),m(4,Xe),m(5,ge),m(6,_e),m(7,ce),m(8,Te)],Slt);var _0i=class{constructor(i,e){this.overflowWidgetsDomNode=i;this.configurationService=e;this._onDidChange=new E;this.onDidChange=this._onDidChange.event;this.defaultInputFontFamily=NO;this._disposables=new N;let t=U.filter(this.configurationService.onDidChangeConfiguration,o=>o.affectsConfiguration("editor.accessibilitySupport")||o.affectsConfiguration("editor.cursorBlinking")||o.affectsConfiguration("editor.cursorStyle")||o.affectsConfiguration("editor.cursorWidth")||o.affectsConfiguration("editor.emptySelectionClipboard")||o.affectsConfiguration("editor.fontFamily")||o.affectsConfiguration("editor.roundedSelection")||o.affectsConfiguration("editor.rulers")||o.affectsConfiguration("editor.wordWrap")||o.affectsConfiguration("editor.wordSegmenterLocales")||o.affectsConfiguration("scm.inputFontFamily")||o.affectsConfiguration("scm.inputFontSize"),this._disposables);this._disposables.add(t(()=>this._onDidChange.fire()))}getEditorConstructionOptions(){return{...Vb(this.configurationService),...this.getEditorOptions(),dragAndDrop:!0,dropIntoEditor:{enabled:!0},formatOnType:!0,lineDecorationsWidth:6,overflowWidgetsDomNode:this.overflowWidgetsDomNode,padding:{top:2,bottom:2},quickSuggestions:!1,renderWhitespace:"none",scrollbar:{alwaysConsumeMouseWheel:!1,vertical:"hidden"},wrappingIndent:"none",wrappingStrategy:"advanced"}}getEditorOptions(){let i=this._getEditorFontFamily(),e=this._getEditorFontSize(),t=this._getEditorLineHeight(e),o=this.configurationService.getValue("editor.wordSegmenterLocales"),n=this.configurationService.getValue("editor.accessibilitySupport"),r=this.configurationService.getValue("editor.cursorBlinking"),s=this.configurationService.getValue("editor.cursorStyle"),l=this.configurationService.getValue("editor.cursorWidth")??1,c=this.configurationService.getValue("editor.emptySelectionClipboard")===!0,u=this.configurationService.getValue("editor.roundedSelection")===!0;return{...this._getEditorLanguageConfiguration(),accessibilitySupport:n,cursorBlinking:r,cursorStyle:s,cursorWidth:l,fontFamily:i,fontSize:e,lineHeight:t,emptySelectionClipboard:c,roundedSelection:u,wordSegmenterLocales:o}}_getEditorFontFamily(){let i=this.configurationService.getValue("scm.inputFontFamily").trim();return i.toLowerCase()==="editor"?this.configurationService.getValue("editor.fontFamily").trim():i.length!==0&&i.toLowerCase()!=="default"?i:this.defaultInputFontFamily}_getEditorFontSize(){return this.configurationService.getValue("scm.inputFontSize")}_getEditorLanguageConfiguration(){let i=this.configurationService.inspect("editor.rulers",{overrideIdentifier:"scminput"}),e=i.overrideIdentifiers?.includes("scminput")?iS.rulers.validate(i.value):[],t=this.configurationService.inspect("editor.wordWrap",{overrideIdentifier:"scminput"}),o=t.overrideIdentifiers?.includes("scminput")?iS.wordWrap.validate(t.value):"on";return{rulers:e,wordWrap:o}}_getEditorLineHeight(i){return Math.round(i*1.5)}dispose(){this._disposables.dispose(),this._onDidChange.dispose()}},Rne=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h){this.modelService=n;this.keybindingService=r;this.configurationService=s;this.scmViewService=l;this.contextViewService=c;this.openerService=u;this.accessibilityService=p;this.markdownRendererService=h;this.disposables=new N;this.repositoryDisposables=new N;this.validationHasFocus=!1;this.lastLayoutWasTrash=!1;this.shouldFocusAfterLayout=!1;this.element=M(i,_(".scm-editor")),this.editorContainer=M(this.element,_(".scm-editor-container")),this.toolbarContainer=M(this.element,_(".scm-editor-toolbar")),this.contextKeyService=this.disposables.add(t.createScoped(this.element)),this.repositoryIdContextKey=this.contextKeyService.createKey("scmRepository",void 0),this.validationMessageContextKey=c4t.SCMInputHasValidationMessage.bindTo(this.contextKeyService),this.inputEditorOptions=new _0i(e,this.configurationService),this.disposables.add(this.inputEditorOptions.onDidChange(this.onDidChangeEditorOptions,this)),this.disposables.add(this.inputEditorOptions);let g={contributions:Ba.getSomeEditorContributions([Cp.ID,Iw.ID,og.ID,ku.ID,Xxe.ID,fh.ID,tx.ID,XY.ID,Pl.ID,ff.ID,Hc.ID,dk.ID,yy.ID,xu.ID,mB.ID,xy,vs.ID,nc.ID]),isSimpleWidget:!0},f=new _o([X,this.contextKeyService]),v=o.createChild(f,this.disposables),b=this.inputEditorOptions.getEditorConstructionOptions();this.inputEditor=v.createInstance(Xr,this.editorContainer,b,g),this.disposables.add(this.inputEditor),this.disposables.add(this.inputEditor.onDidFocusEditorText(()=>{this.input?.repository&&this.scmViewService.focus(this.input.repository),this.element.classList.add("synthetic-focus"),this.renderValidation()})),this.disposables.add(this.inputEditor.onDidBlurEditorText(()=>{this.element.classList.remove("synthetic-focus"),setTimeout(()=>{(!this.validation||!this.validationHasFocus)&&this.clearValidation()},0)})),this.disposables.add(this.inputEditor.onDidBlurEditorWidget(()=>{ku.get(this.inputEditor)?.clearWidgets(),fh.get(this.inputEditor)?.clearWidgets()}));let S=this.contextKeyService.createKey("scmInputIsInFirstPosition",!1),y=this.contextKeyService.createKey("scmInputIsInLastPosition",!1);this.disposables.add(this.inputEditor.onDidChangeCursorPosition(({position:w})=>{let k=this.inputEditor._getViewModel(),T=k.getLineCount(),P=k.getLineLength(T)+1,O=k.coordinatesConverter.convertModelPositionToViewPosition(w);S.set(O.lineNumber===1&&O.column===1),y.set(O.lineNumber===T&&O.column===P)})),this.disposables.add(this.inputEditor.onDidScrollChange(w=>{this.toolbarContainer.classList.toggle("scroll-decoration",w.scrollTop>0)})),U.filter(this.configurationService.onDidChangeConfiguration,w=>w.affectsConfiguration("scm.showInputActionButton"))(()=>this.layout(),this,this.disposables),this.onDidChangeContentHeight=U.signal(U.filter(this.inputEditor.onDidContentSizeChange,w=>w.contentHeightChanged,this.disposables)),this.toolbar=v.createInstance(Slt,this.toolbarContainer,{actionViewItemProvider:(w,k)=>w instanceof Lo&&this.toolbar.dropdownActions.length>1?o.createInstance(Jw,w,this.toolbar.dropdownAction,this.toolbar.dropdownActions,"",{actionRunner:this.toolbar.actionRunner,hoverDelegate:k.hoverDelegate}):Bs(o,w,k),hiddenItemStrategy:-1,menuOptions:{shouldForwardArgs:!0}}),this.disposables.add(this.toolbar.onDidChange(()=>this.layout())),this.disposables.add(this.toolbar)}static{this.ValidationTimeouts={2:5e3,1:8e3,0:1e4}}get input(){return this.model?.input}set input(i){if(i===this.input)return;if(this.clearValidation(),this.element.classList.remove("synthetic-focus"),this.repositoryDisposables.clear(),this.repositoryIdContextKey.set(i?.repository.id),!i){this.inputEditor.setModel(void 0),this.model=void 0;return}let e=i.repository.provider.inputBoxTextModel;this.inputEditor.setModel(e),this.configurationService.getValue("editor.wordBasedSuggestions",{resource:e.uri})!=="off"&&this.configurationService.updateValue("editor.wordBasedSuggestions","off",{resource:e.uri},8);let t=new ya(200),o=async()=>{let f=this.inputEditor.getSelection()?.getStartPosition(),v=f&&e.getOffsetAt(f),b=e.getValue();this.setValidation(await i.validateInput(b,v||0))},n=()=>t.trigger(o);this.repositoryDisposables.add(t),this.repositoryDisposables.add(this.inputEditor.onDidChangeCursorPosition(n));let r=this.modelService.getCreationOptions(e.getLanguageId(),e.uri,e.isForSimpleWidget),s=U.filter(this.inputEditor.onKeyDown,f=>f.keyCode===3,this.repositoryDisposables);this.repositoryDisposables.add(s(()=>e.detectIndentation(r.insertSpaces,r.tabSize))),e.setValue(i.value),this.repositoryDisposables.add(i.onDidChange(({value:f,reason:v})=>{let b=e.getValue();if(f===b)return;e.pushStackElement(),e.pushEditOperations(null,[Hn.replaceMove(e.getFullModelRange(),f)],()=>[]);let S=v===0?e.getFullModelRange().getStartPosition():e.getFullModelRange().getEndPosition();this.inputEditor.setPosition(S),this.inputEditor.revealPositionInCenterIfOutsideViewport(S)})),this.repositoryDisposables.add(i.onDidChangeFocus(()=>this.focus())),this.repositoryDisposables.add(i.onDidChangeValidationMessage(f=>this.setValidation(f,{focus:!0,timeout:!0}))),this.repositoryDisposables.add(i.onDidChangeValidateInput(f=>n())),this.repositoryDisposables.add(i.onDidClearValidation(()=>this.clearValidation())),this.repositoryDisposables.add(e.onDidChangeContent(()=>{i.setValue(e.getValue(),!0),n()}));let l=hr("accessibility.verbosity.sourceControl",!0,this.configurationService),c=(f,v)=>{if(v=v??l.get(),!v||!this.accessibilityService.isScreenReaderOptimized())return f;let b=this.keybindingService.lookupKeybinding("editor.action.accessibilityHelp")?.getLabel();return b?d(13774,null,f,b):d(13775,null,f)},u=()=>{let f=this.keybindingService.lookupKeybinding("scm.acceptInput"),v=f?f.getLabel():Ze?"Cmd+Enter":"Ctrl+Enter";return vd(i.placeholder,v)},p=()=>{let f=u(),v=c(f);this.inputEditor.updateOptions({ariaLabel:v,placeholder:f})};this.repositoryDisposables.add(i.onDidChangePlaceholder(p)),this.repositoryDisposables.add(this.keybindingService.onDidUpdateKeybindings(p)),this.repositoryDisposables.add(Vs(l,f=>{let v=u(),b=c(v,f);this.inputEditor.updateOptions({ariaLabel:b})})),p();let h="";this.repositoryDisposables.add(be(f=>{if(!i.visible)return;let v=h;h=i.repository.provider.commitTemplate.read(f);let b=e.getValue();b&&b!==v||e.setValue(h)}));let g=f=>{this.inputEditor.updateOptions({readOnly:!f})};this.repositoryDisposables.add(i.onDidChangeEnablement(f=>g(f))),g(i.enabled),this.toolbar.setInput(i),this.model={input:i,textModel:e}}get selections(){return this.inputEditor.getSelections()}set selections(i){i&&this.inputEditor.setSelections(i)}setValidation(i,e){this._validationTimer&&(clearTimeout(this._validationTimer),this._validationTimer=void 0),this.validation=i,this.renderValidation(),e?.focus&&!this.hasFocus()&&this.focus(),i&&e?.timeout&&(this._validationTimer=setTimeout(()=>this.setValidation(void 0),Rne.ValidationTimeouts[i.type]))}getContentHeight(){let i=this.inputEditor.getOption(75),{top:e,bottom:t}=this.inputEditor.getOption(96),o=this.configurationService.getValue("scm.inputMinLineCount"),r=(typeof o=="number"?Bn(o,1,50):1)*i+e+t,s=this.configurationService.getValue("scm.inputMaxLineCount"),c=(typeof s=="number"?Bn(s,1,50):10)*i+e+t;return Bn(this.inputEditor.getContentHeight(),r,c)}layout(){let i=this.getContentHeight(),e=this.getToolbarWidth(),t=new si(this.element.clientWidth-e,i);if(t.width<0){this.lastLayoutWasTrash=!0;return}this.lastLayoutWasTrash=!1,this.inputEditor.layout(t),this.renderValidation();let o=this.configurationService.getValue("scm.showInputActionButton")===!0;this.toolbarContainer.classList.toggle("hidden",!o||this.toolbar?.isEmpty()===!0),this.shouldFocusAfterLayout&&(this.shouldFocusAfterLayout=!1,this.focus())}focus(){if(this.lastLayoutWasTrash){this.lastLayoutWasTrash=!1,this.shouldFocusAfterLayout=!0;return}this.inputEditor.focus(),this.element.classList.add("synthetic-focus")}hasFocus(){return this.inputEditor.hasTextFocus()}onDidChangeEditorOptions(){this.inputEditor.updateOptions(this.inputEditorOptions.getEditorOptions())}renderValidation(){if(this.clearValidation(),this.element.classList.toggle("validation-info",this.validation?.type===2),this.element.classList.toggle("validation-warning",this.validation?.type===1),this.element.classList.toggle("validation-error",this.validation?.type===0),!this.validation||!this.inputEditor.hasTextFocus())return;this.validationMessageContextKey.set(!0);let i=new N;this.validationContextView=this.contextViewService.showContextView({getAnchor:()=>this.element,render:e=>{this.element.style.borderBottomLeftRadius="0",this.element.style.borderBottomRightRadius="0";let t=M(e,_(".scm-editor-validation-container"));t.classList.toggle("validation-info",this.validation.type===2),t.classList.toggle("validation-warning",this.validation.type===1),t.classList.toggle("validation-error",this.validation.type===0),t.style.width=`${this.element.clientWidth+2}px`;let o=M(t,_(".scm-editor-validation")),n=this.validation.message;if(typeof n=="string")o.textContent=n;else{let c=qn(o);i.add(c),i.add(c.onDidFocus(()=>this.validationHasFocus=!0)),i.add(c.onDidBlur(()=>{this.validationHasFocus=!1,this.element.style.borderBottomLeftRadius="2px",this.element.style.borderBottomRightRadius="2px",this.contextViewService.hideContextView()}));let u=this.markdownRendererService.render(n,{actionHandler:(p,h)=>{U_(this.openerService,p,h.isTrusted),this.element.style.borderBottomLeftRadius="2px",this.element.style.borderBottomRightRadius="2px",this.contextViewService.hideContextView()}});i.add(u),o.appendChild(u.element)}let r=M(t,_(".scm-editor-validation-actions")),s=new Zi(r),l=new it("scmInputWidget.validationMessage.close",d(13773,null),q.asClassName(R.close),!0,()=>{this.contextViewService.hideContextView(),this.element.style.borderBottomLeftRadius="2px",this.element.style.borderBottomRightRadius="2px"});return i.add(s),s.push(l,{icon:!0,label:!1}),x.None},onHide:()=>{this.validationHasFocus=!1,this.element.style.borderBottomLeftRadius="2px",this.element.style.borderBottomRightRadius="2px",i.dispose()},anchorAlignment:0})}getToolbarWidth(){let i=this.configurationService.getValue("scm.showInputActionButton");return!this.toolbar||!i||this.toolbar?.isEmpty()===!0?0:this.toolbar.dropdownActions.length===0?26:39}clearValidation(){this.validationContextView?.close(),this.validationContextView=void 0,this.validationHasFocus=!1,this.validationMessageContextKey.set(!1)}dispose(){this.input=void 0,this.repositoryDisposables.dispose(),this.clearValidation(),this.disposables.dispose()}};Rne=I([m(2,X),m(3,F),m(4,Tt),m(5,_e),m(6,B),m(7,_u),m(8,Wn),m(9,Je),m(10,Oi),m(11,On)],Rne);W(class extends K{constructor(){super({id:"scm.input.triggerSetup",title:d(13777,null),icon:R.sparkle,f1:!1,menu:{id:D.SCMInputBox,when:C.and(ie.Setup.hidden.negate(),ie.Setup.disabled.negate(),ie.Setup.installed.negate(),C.equals("scmProvider","git"))}})}async run(a,...i){let e=a.get(ge);if(!await e.executeCommand(xpe))return;let o=ro.defaultChatAgent?.generateCommitMessageCommand;o&&await e.executeCommand(o,...i)}});HMe(".scm-view .scm-editor-container");function Tmn(a,i){if(!i)return[void 0,void 0];if(!i.label)return[xa(i),void 0];let e=He(a),t=i.label,o=t.length-e.length,n=xa(i.score);if(t===e)return[n,void 0];let r=[],s=[];for(let l of n)l.start>o?r.push({start:l.start-o,end:l.end-o}):l.end<o?s.push(l):(r.push({start:0,end:l.end-o}),s.push({start:l.start,end:o}));return[r,s]}var k6=class{constructor(i,e,t){this.commandService=i;this.contextMenuService=e;this.notificationService=t;this.actionButtons=new Map}static{this.DEFAULT_HEIGHT=28}static{this.TEMPLATE_ID="actionButton"}get templateId(){return k6.TEMPLATE_ID}renderTemplate(i){i.parentElement.parentElement.classList.add("cursor-default","force-no-hover");let e=M(i,_(".button-container")),t=new Q0i(e,this.contextMenuService,this.commandService,this.notificationService);return{actionButton:t,disposable:x.None,templateDisposable:t}}renderElement(i,e,t){t.disposable.dispose();let o=new N,n=i.element;t.actionButton.setButton(i.element.button),this.actionButtons.set(n,t.actionButton),o.add({dispose:()=>this.actionButtons.delete(n)}),t.disposable=o}renderCompressedElements(){throw new Error("Should never happen since node is incompressible")}focusActionButton(i){this.actionButtons.get(i)?.focus()}disposeElement(i,e,t){t.disposable.dispose()}disposeTemplate(i){i.disposable.dispose(),i.templateDisposable.dispose()}};k6=I([m(0,ge),m(1,Xe),m(2,Ne)],k6);var D0i=class a{constructor(i){this.instantiationService=i}getDragURI(i){return cN(i)?i.sourceUri.toString():null}onDragStart(i,e){let t=a.getResourcesFromDragAndDropData(i);if(e.dataTransfer&&t?.length){this.instantiationService.invokeFunction(n=>tv(n,t,e));let o=t.filter(n=>n.scheme===Q.file).map(n=>n.fsPath);o.length&&e.dataTransfer.setData(hc.FILES,JSON.stringify(o))}}getDragLabel(i,e){if(i.length===1){let t=i[0];if(cN(t))return He(t.sourceUri)}return String(i.length)}onDragOver(i,e,t,o,n){return!0}drop(i,e,t,o,n){}static getResourcesFromDragAndDropData(i){let e=[];for(let t of[...i.context??[],...i.elements])cN(t)&&e.push(t.sourceUri);return e}dispose(){}},AU=class{constructor(i,e,t,o){this.outerLayout=i;this.overflowWidgetsDomNode=e;this.updateHeight=t;this.instantiationService=o;this.inputWidgets=new Map;this.contentHeights=new WeakMap;this.editorSelections=new WeakMap}static{this.DEFAULT_HEIGHT=26}static{this.TEMPLATE_ID="input"}get templateId(){return AU.TEMPLATE_ID}renderTemplate(i){i.parentElement.parentElement.classList.add("force-no-hover");let e=new N,t=M(i,_(".scm-input")),o=this.instantiationService.createInstance(Rne,t,this.overflowWidgetsDomNode);return e.add(o),{inputWidget:o,inputWidgetHeight:AU.DEFAULT_HEIGHT,elementDisposables:new N,templateDisposable:e}}renderElement(i,e,t){let o=i.element;t.inputWidget.input=o,this.inputWidgets.set(o,t.inputWidget),t.elementDisposables.add({dispose:()=>this.inputWidgets.delete(o)});let n=this.editorSelections.get(o);n&&(t.inputWidget.selections=n),t.elementDisposables.add(Z(()=>{let c=t.inputWidget.selections;c&&this.editorSelections.set(o,c)})),t.inputWidgetHeight=AU.DEFAULT_HEIGHT;let r=()=>{let c=t.inputWidget.getContentHeight();this.contentHeights.set(o,c),t.inputWidgetHeight!==c&&(this.updateHeight(o,c+10),t.inputWidgetHeight=c,t.inputWidget.layout())};tn(()=>{t.elementDisposables.add(t.inputWidget.onDidChangeContentHeight(r)),r()},0,t.elementDisposables);let l=()=>t.inputWidget.layout();t.elementDisposables.add(this.outerLayout.onDidChange(l)),l()}renderCompressedElements(){throw new Error("Should never happen since node is incompressible")}disposeElement(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.elementDisposables.dispose(),i.templateDisposable.dispose()}getHeight(i){return(this.contentHeights.get(i)??AU.DEFAULT_HEIGHT)+10}getRenderedInputWidget(i){return this.inputWidgets.get(i)}getFocusedInput(){for(let[i,e]of this.inputWidgets)if(e.hasFocus())return i}clearValidation(){for(let[,i]of this.inputWidgets)i.clearValidation()}};AU=I([m(3,F)],AU);var Mne=class{constructor(i,e,t,o,n,r,s,l,c){this.actionViewItemProvider=i;this.actionRunner=e;this.commandService=t;this.contextKeyService=o;this.contextMenuService=n;this.keybindingService=r;this.menuService=s;this.scmViewService=l;this.telemetryService=c}static{this.TEMPLATE_ID="resource group"}get templateId(){return Mne.TEMPLATE_ID}renderTemplate(i){let e=M(i,_(".resource-group")),t=M(e,_(".name")),o=M(e,_(".actions")),n=new ol(o,{actionViewItemProvider:this.actionViewItemProvider,actionRunner:this.actionRunner},this.menuService,this.contextKeyService,this.contextMenuService,this.keybindingService,this.commandService,this.telemetryService),r=M(e,_(".count")),s=new _v(r,{},iI),l=wn(n,s);return{name:t,count:s,actionBar:n,elementDisposables:new N,disposables:l}}renderElement(i,e,t){let o=i.element;t.name.textContent=o.label,t.count.setCount(o.resources.length);let n=this.scmViewService.menus.getRepositoryMenus(o.provider);t.elementDisposables.add($te(n.getResourceGroupMenu(o),r=>{t.actionBar.setActions(r)},"inline")),t.actionBar.context=o}renderCompressedElements(i){throw new Error("Should never happen since node is incompressible")}disposeElement(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.elementDisposables.dispose(),i.disposables.dispose()}};Mne=I([m(2,ge),m(3,X),m(4,Xe),m(5,_e),m(6,Kt),m(7,_u),m(8,Te)],Mne);var d4t=class extends rs{constructor(e){super();this.getSelectedResources=e}async runAction(e,t){if(!(e instanceof Lo))return super.runAction(e,t);let o=Ny(t),n=this.getSelectedResources().filter(c=>Ny(c)===o),l=(n.some(c=>c===t)?n:[t]).map(c=>fm.isResourceNode(c)?fm.collect(c):[c]).flat();await e.run(...l)}},Pne=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g){this.viewMode=i;this.labels=e;this.actionViewItemProvider=t;this.actionRunner=o;this.commandService=n;this.contextKeyService=r;this.contextMenuService=s;this.keybindingService=l;this.labelService=c;this.menuService=u;this.scmViewService=p;this.telemetryService=h;this.themeService=g;this.disposables=new N;this.renderedResources=new Map;g.onDidColorThemeChange(this.onDidColorThemeChange,this,this.disposables)}static{this.TEMPLATE_ID="resource"}get templateId(){return Pne.TEMPLATE_ID}renderTemplate(i){let e=M(i,_(".resource")),t=M(e,_(".name")),o=this.labels.create(t,{supportDescriptionHighlights:!0,supportHighlights:!0}),n=M(o.element,_(".actions")),r=new ol(n,{actionViewItemProvider:this.actionViewItemProvider,actionRunner:this.actionRunner},this.menuService,this.contextKeyService,this.contextMenuService,this.keybindingService,this.commandService,this.telemetryService),s=M(e,_(".decoration-icon")),l=new me,c=wn(r,o,l);return{element:e,name:t,fileLabel:o,decorationIcon:s,actionBar:r,actionBarMenu:void 0,actionBarMenuListener:l,elementDisposables:new N,disposables:c}}renderElement(i,e,t){let o=i.element,n=fm.isResourceNode(o)?o.element:o,r=fm.isResourceNode(o)?o.uri:o.sourceUri,s=fm.isResourceNode(o)?1:0,l=!fm.isResourceNode(o)&&o.decorations.tooltip||"",c=this.viewMode()==="tree",u,p,h;if(fm.isResourceNode(o))if(o.element){let f=this.scmViewService.menus.getRepositoryMenus(o.element.resourceGroup.provider);this._renderActionBar(t,o,f.getResourceMenu(o.element)),t.element.classList.toggle("faded",o.element.decorations.faded),h=o.element.decorations.strikeThrough}else{let f=this.scmViewService.menus.getRepositoryMenus(o.context.provider);this._renderActionBar(t,o,f.getResourceFolderMenu(o.context)),u=xa(i.filterData),t.element.classList.remove("faded")}else{let f=this.scmViewService.menus.getRepositoryMenus(o.resourceGroup.provider);this._renderActionBar(t,o,f.getResourceMenu(o)),[u,p]=Tmn(r,i.filterData),t.element.classList.toggle("faded",o.decorations.faded),h=o.decorations.strikeThrough}let g={tooltip:l,uri:r,fileLabelOptions:{hidePath:c,fileKind:s,matches:u,descriptionMatches:p,strikethrough:h},iconResource:n};this.renderIcon(t,g),this.renderedResources.set(t,g),t.elementDisposables.add(Z(()=>this.renderedResources.delete(t))),t.element.setAttribute("data-tooltip",l)}disposeElement(i,e,t){t.elementDisposables.clear()}renderCompressedElements(i,e,t){let o=i.element,n=o.elements[o.elements.length-1],r=o.elements.map(u=>u.name),s=1,l=xa(i.filterData);t.fileLabel.setResource({resource:n.uri,name:r},{fileDecorations:{colors:!1,badges:!0},fileKind:s,matches:l,separator:this.labelService.getSeparator(n.uri.scheme)});let c=this.scmViewService.menus.getRepositoryMenus(n.context.provider);this._renderActionBar(t,n,c.getResourceFolderMenu(n.context)),t.name.classList.remove("strike-through"),t.element.classList.remove("faded"),t.decorationIcon.style.display="none",t.decorationIcon.style.backgroundImage="",t.element.setAttribute("data-tooltip","")}disposeCompressedElements(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.elementDisposables.dispose(),i.disposables.dispose()}_renderActionBar(i,e,t){(!i.actionBarMenu||i.actionBarMenu!==t)&&(i.actionBarMenu=t,i.actionBarMenuListener.value=$te(t,o=>{i.actionBar.setActions(o)},"inline")),i.actionBar.context=e}onDidColorThemeChange(){for(let[i,e]of this.renderedResources)this.renderIcon(i,e)}renderIcon(i,e){let t=this.themeService.getColorTheme(),o=Bp(t.type)?e.iconResource?.decorations.iconDark:e.iconResource?.decorations.icon;i.fileLabel.setFile(e.uri,{...e.fileLabelOptions,fileDecorations:{colors:!1,badges:!o}}),o?(q.isThemeIcon(o)?(i.decorationIcon.className=`decoration-icon ${q.asClassName(o)}`,o.color&&(i.decorationIcon.style.color=t.getColor(o.color.id)?.toString()??""),i.decorationIcon.style.display="",i.decorationIcon.style.backgroundImage=""):(i.decorationIcon.className="decoration-icon",i.decorationIcon.style.color="",i.decorationIcon.style.display="",i.decorationIcon.style.backgroundImage=Qa(o)),i.decorationIcon.title=e.tooltip):(i.decorationIcon.className="decoration-icon",i.decorationIcon.style.color="",i.decorationIcon.style.display="none",i.decorationIcon.style.backgroundImage="",i.decorationIcon.title="")}dispose(){this.disposables.dispose()}};Pne=I([m(4,ge),m(5,X),m(6,Xe),m(7,_e),m(8,rt),m(9,Kt),m(10,_u),m(11,Te),m(12,Le)],Pne);var L0i=class{constructor(i){this.inputRenderer=i}getHeight(i){return aN(i)?this.inputRenderer.getHeight(i):lN(i)?k6.DEFAULT_HEIGHT+8:22}getTemplateId(i){if(Ad(i))return qW.TEMPLATE_ID;if(aN(i))return AU.TEMPLATE_ID;if(lN(i))return k6.TEMPLATE_ID;if(Ny(i))return Mne.TEMPLATE_ID;if(cN(i)||H8(i))return Pne.TEMPLATE_ID;throw new Error("Unknown element")}},R0i=class{isIncompressible(i){return fm.isResourceNode(i)?i.childrenCount===0||!i.parent||!i.parent.parent:!0}},M0i=class{filter(i){return Ny(i)?i.resources.length>0||!i.hideWhenEmpty:!0}},P0i=class{constructor(i,e){this.viewMode=i;this.viewSortKey=e}compare(i,e){if(Ad(i)){if(!Ad(e))throw new Error("Invalid comparison");return 0}if(aN(i))return-1;if(aN(e))return 1;if(lN(i))return-1;if(lN(e))return 1;if(Ny(i))return Ny(e)?0:-1;if(this.viewMode()==="list"){if(this.viewSortKey()==="name"){let c=He(i.sourceUri),u=He(e.sourceUri);return DT(c,u)}if(this.viewSortKey()==="status"){let c=i.decorations.tooltip??"",u=e.decorations.tooltip??"";if(c!==u)return Hl(c,u)}let s=i.sourceUri.fsPath,l=e.sourceUri.fsPath;return KZ(s,l)}let t=fm.isResourceNode(i),o=fm.isResourceNode(e);if(t!==o)return t?-1:1;let n=fm.isResourceNode(i)?i.name:He(i.sourceUri),r=fm.isResourceNode(e)?e.name:He(e.sourceUri);return DT(n,r)}},Ilt=class{constructor(i,e){this.viewMode=i;this.labelService=e}getKeyboardNavigationLabel(i){if(fm.isResourceNode(i))return i.name;if(Ad(i)||aN(i)||lN(i))return;if(Ny(i))return i.label;if(this.viewMode()==="list"){let e=He(i.sourceUri),t=this.labelService.getUriLabel(i.sourceUri,{relative:!0});return[e,t]}else return He(i.sourceUri)}getCompressedNodeKeyboardNavigationLabel(i){return i.map(t=>t.name).join("/")}};Ilt=I([m(1,rt)],Ilt);function _mn(a){if(Ad(a))return`repo:${a.provider.id}`;if(aN(a))return`input:${a.repository.provider.id}`;if(lN(a))return`actionButton:${a.repository.provider.id}`;if(Ny(a))return`resourceGroup:${a.provider.id}/${a.id}`;if(cN(a)){let i=a.resourceGroup;return`resource:${i.provider.id}/${i.id}/${a.sourceUri.toString()}`}else if(H8(a)){let i=a.context;return`folder:${i.provider.id}/${i.id}/$FOLDER/${a.uri.toString()}`}else throw new Error("Invalid tree element")}var A0i=class{getId(i){return _mn(i)}},ylt=class{constructor(i,e,t,o){this.accessibilityService=i;this.configurationService=e;this.keybindingService=t;this.labelService=o}getWidgetAriaLabel(){return d(13788,null)}getAriaLabel(i){if(fm.isResourceNode(i))return this.labelService.getUriLabel(i.uri,{relative:!0,noPrefix:!0})||i.name;if(Ad(i))return`${i.provider.name} ${i.provider.label}`;if(aN(i)){if(!(this.configurationService.getValue("accessibility.verbosity.sourceControl")===!0)||!this.accessibilityService.isScreenReaderOptimized())return d(13790,null);let t=this.keybindingService.lookupKeybinding("editor.action.accessibilityHelp")?.getLabel();return t?d(13791,null,t):d(13792,null)}else{if(lN(i))return i.button?.command.title??"";if(Ny(i))return i.label;{let e=[];e.push(He(i.sourceUri)),i.decorations.tooltip&&e.push(i.decorations.tooltip);let t=this.labelService.getUriLabel(ci(i.sourceUri),{relative:!0,noPrefix:!0});return t&&e.push(t),e.join(", ")}}}};ylt=I([m(0,Oi),m(1,B),m(2,_e),m(3,rt)],ylt);var Wq={ViewSort:new D("SCMViewSort"),Repositories:new D("SCMRepositories"),ChangesSettings:new D("SCMChangesSettings")},Mc={SCMViewMode:new Y("scmViewMode","list"),SCMViewSortKey:new Y("scmViewSortKey","path"),SCMViewAreAllRepositoriesCollapsed:new Y("scmViewAreAllRepositoriesCollapsed",!1),SCMViewIsAnyRepositoryCollapsible:new Y("scmViewIsAnyRepositoryCollapsible",!1),SCMProvider:new Y("scmProvider",void 0),SCMProviderRootUri:new Y("scmProviderRootUri",void 0),SCMProviderHasRootUri:new Y("scmProviderHasRootUri",void 0),SCMHistoryItemCount:new Y("scmHistoryItemCount",0),SCMHistoryViewMode:new Y("scmHistoryViewMode","list"),SCMCurrentHistoryItemRefHasRemote:new Y("scmCurrentHistoryItemRefHasRemote",!1),SCMCurrentHistoryItemRefHasBase:new Y("scmCurrentHistoryItemRefHasBase",!1),SCMCurrentHistoryItemRefInFilter:new Y("scmCurrentHistoryItemRefInFilter",!1),RepositoryCount:new Y("scmRepositoryCount",0),RepositoryVisibilityCount:new Y("scmRepositoryVisibleCount",0),RepositoryVisibility(a){return new Y(`scmRepositoryVisible:${a.provider.id}`,!1)}};ve.appendMenuItem(D.SCMTitle,{title:d(13795,null),submenu:Wq.ViewSort,when:C.and(C.equals("view",Jf),Mc.RepositoryCount.notEqualsTo(0)),group:"0_view&sort",order:1});ve.appendMenuItem(Wq.ViewSort,{title:d(13782,null),submenu:Wq.Repositories,when:C.greater(Mc.RepositoryCount.key,1),group:"0_repositories"});var N0i=class extends K{constructor(i){super({id:`workbench.scm.action.toggleRepositoryVisibility.${i.provider.id}`,title:i.provider.name,f1:!1,precondition:C.or(Mc.RepositoryVisibilityCount.notEqualsTo(1),Mc.RepositoryVisibility(i).isEqualTo(!1)),toggled:Mc.RepositoryVisibility(i).isEqualTo(!0),menu:{id:Wq.Repositories,group:"0_repositories"}}),this.repository=i}run(i){i.get(_u).toggleVisibility(this.repository)}},wlt=class{constructor(i,e,t){this.contextKeyService=i;this.scmViewService=e;this.items=new Map;this.disposables=new N;this.repositoryCountContextKey=Mc.RepositoryCount.bindTo(i),this.repositoryVisibilityCountContextKey=Mc.RepositoryVisibilityCount.bindTo(i),e.onDidChangeVisibleRepositories(this.onDidChangeVisibleRepositories,this,this.disposables),t.onDidAddRepository(this.onDidAddRepository,this,this.disposables),t.onDidRemoveRepository(this.onDidRemoveRepository,this,this.disposables);for(let o of t.repositories)this.onDidAddRepository(o)}onDidAddRepository(i){if(i.provider.isHidden)return;let e=W(class extends N0i{constructor(){super(i)}}),t=Mc.RepositoryVisibility(i).bindTo(this.contextKeyService);t.set(this.scmViewService.isVisible(i)),this.items.set(i,{contextKey:t,dispose(){t.reset(),e.dispose()}}),this.updateRepositoryContextKeys()}onDidRemoveRepository(i){this.items.get(i)?.dispose(),this.items.delete(i),this.updateRepositoryContextKeys()}onDidChangeVisibleRepositories(){let i=0;for(let[e,t]of this.items){let o=this.scmViewService.isVisible(e);t.contextKey.set(o),o&&i++}this.repositoryCountContextKey.set(this.items.size),this.repositoryVisibilityCountContextKey.set(i)}updateRepositoryContextKeys(){this.repositoryCountContextKey.set(this.items.size),this.repositoryVisibilityCountContextKey.set(vt.reduce(this.items.keys(),(i,e)=>i+(this.scmViewService.isVisible(e)?1:0),0))}dispose(){this.disposables.dispose(),Be(this.items.values()),this.items.clear()}};wlt=I([m(0,X),m(1,_u),m(2,rd)],wlt);var u4t=class extends Yn{constructor(i="workbench.scm.action.setListViewMode",e={}){super({id:i,title:d(13793,null),viewId:Jf,f1:!1,icon:R.listTree,toggled:Mc.SCMViewMode.isEqualTo("list"),menu:{id:Wq.ViewSort,group:"1_viewmode",...e}})}async runInView(i,e){e.viewMode="list"}},O0i=class extends u4t{constructor(){super("workbench.scm.action.setListViewModeNavigation",{id:D.SCMTitle,when:C.and(C.equals("view",Jf),Mc.RepositoryCount.notEqualsTo(0),Mc.SCMViewMode.isEqualTo("tree")),group:"navigation",isHiddenByDefault:!0,order:-1e3})}},p4t=class extends Yn{constructor(i="workbench.scm.action.setTreeViewMode",e={}){super({id:i,title:d(13794,null),viewId:Jf,f1:!1,icon:R.listFlat,toggled:Mc.SCMViewMode.isEqualTo("tree"),menu:{id:Wq.ViewSort,group:"1_viewmode",...e}})}async runInView(i,e){e.viewMode="tree"}},F0i=class extends p4t{constructor(){super("workbench.scm.action.setTreeViewModeNavigation",{id:D.SCMTitle,when:C.and(C.equals("view",Jf),Mc.RepositoryCount.notEqualsTo(0),Mc.SCMViewMode.isEqualTo("list")),group:"navigation",isHiddenByDefault:!0,order:-1e3})}};W(u4t);W(p4t);W(O0i);W(F0i);var xlt=class extends K{constructor(e,t){super({id:`workbench.scm.action.repositories.setSortKey.${e}`,title:t,f1:!1,toggled:vlt.RepositorySortKey.isEqualTo(e),menu:[{id:Wq.Repositories,group:"1_sort"},{id:D.SCMSourceControlTitle,group:"1_sort"}]});this.sortKey=e}run(e){e.get(_u).toggleSortKey(this.sortKey)}},W0i=class extends xlt{constructor(){super("discoveryTime",d(13785,null))}},V0i=class extends xlt{constructor(){super("name",d(13786,null))}},B0i=class extends xlt{constructor(){super("path",d(13787,null))}};W(W0i);W(V0i);W(B0i);var m4t=class extends K{constructor(e,t,o){super({id:`workbench.scm.action.repositories.setSelectionMode.${e}`,title:t,f1:!1,toggled:vlt.RepositorySelectionMode.isEqualTo(e),menu:[{id:Wq.Repositories,when:C.and(C.has("scm.providerCount"),C.greater("scm.providerCount",1)),group:"2_selectionMode",order:o},{id:D.SCMSourceControlTitle,when:C.and(C.has("scm.providerCount"),C.greater("scm.providerCount",1)),group:"2_selectionMode",order:o}]});this.selectionMode=e}run(e){e.get(_u).toggleSelectionMode(this.selectionMode)}},H0i=class extends m4t{constructor(){super("single",d(13784,null),1)}},U0i=class extends m4t{constructor(){super("multiple",d(13783,null),2)}};W(H0i);W(U0i);var klt=class extends Yn{constructor(e,t){super({id:`workbench.scm.action.setSortKey.${e}`,title:t,viewId:Jf,f1:!1,toggled:Mc.SCMViewSortKey.isEqualTo(e),precondition:Mc.SCMViewMode.isEqualTo("list"),menu:{id:Wq.ViewSort,group:"2_sort"}});this.sortKey=e}async runInView(e,t){t.viewSortKey=this.sortKey}},z0i=class extends klt{constructor(){super("name",d(13796,null))}},K0i=class extends klt{constructor(){super("path",d(13797,null))}},G0i=class extends klt{constructor(){super("status",d(13798,null))}};W(z0i);W(K0i);W(G0i);var q0i=class extends Yn{constructor(){super({id:"workbench.scm.action.collapseAllRepositories",title:d(13780,null),viewId:Jf,f1:!1,icon:R.collapseAll,menu:{id:D.SCMTitle,group:"navigation",when:C.and(C.equals("view",Jf),Mc.SCMViewIsAnyRepositoryCollapsible.isEqualTo(!0),Mc.SCMViewAreAllRepositoriesCollapsed.isEqualTo(!1))}})}async runInView(i,e){e.collapseAllRepositories()}},$0i=class extends Yn{constructor(){super({id:"workbench.scm.action.expandAllRepositories",title:d(13781,null),viewId:Jf,f1:!1,icon:R.expandAll,menu:{id:D.SCMTitle,group:"navigation",when:C.and(C.equals("view",Jf),Mc.SCMViewIsAnyRepositoryCollapsible.isEqualTo(!0),Mc.SCMViewAreAllRepositoriesCollapsed.isEqualTo(!0))}})}async runInView(i,e){e.expandAllRepositories()}};W(q0i);W($0i);var j0i=class extends Yn{constructor(){super({id:"workbench.scm.action.collapseAll",title:d(13789,null),viewId:Jf,f1:!1,icon:R.collapseAll,menu:{id:D.SCMResourceGroupContext,group:"9_collapse",when:Mc.SCMViewMode.isEqualTo("tree")}})}async runInView(i,e,t){t&&e.collapseAllResources(t)}};W(j0i);var JHe=class extends Gs{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super({...e,titleMenuId:D.SCMTitle},u,h,v,b,f,g,S,p,y);this.commandService=t;this.editorService=o;this.menuService=n;this.scmService=r;this.scmViewService=s;this.storageService=l;this.uriIdentityService=c;this._onDidChangeViewMode=this._register(new E);this.onDidChangeViewMode=this._onDidChangeViewMode.event;this._onDidChangeViewSortKey=this._register(new E);this.onDidChangeViewSortKey=this._onDidChangeViewSortKey.event;this.items=new Vt;this.visibilityDisposables=new N;this.treeOperationSequencer=new rm;this.revealResourceThrottler=new gu;this.updateChildrenThrottler=new gu;this.disposables=new N;this._viewMode=this.getViewMode(),this._viewSortKey=this.getViewSortKey(),this.viewModeContextKey=Mc.SCMViewMode.bindTo(b),this.viewModeContextKey.set(this._viewMode),this.viewSortKeyContextKey=Mc.SCMViewSortKey.bindTo(b),this.viewSortKeyContextKey.set(this.viewSortKey),this.areAllRepositoriesCollapsedContextKey=Mc.SCMViewAreAllRepositoriesCollapsed.bindTo(b),this.isAnyRepositoryCollapsibleContextKey=Mc.SCMViewIsAnyRepositoryCollapsible.bindTo(b),this.scmProviderContextKey=Mc.SCMProvider.bindTo(b),this.scmProviderRootUriContextKey=Mc.SCMProviderRootUri.bindTo(b),this.scmProviderHasRootUriContextKey=Mc.SCMProviderHasRootUri.bindTo(b),this._onDidLayout=this._register(new E),this.layoutCache={height:void 0,width:void 0,onDidChange:this._onDidLayout.event},this.storageService.onDidChangeValue(1,void 0,this.disposables)(w=>{switch(w.key){case"scm.viewMode":this.viewMode=this.getViewMode();break;case"scm.viewSortKey":this.viewSortKey=this.getViewSortKey();break}},this,this.disposables),this.storageService.onWillSaveState(w=>{this.viewMode=this.getViewMode(),this.viewSortKey=this.getViewSortKey(),this.storeTreeViewState()},this,this.disposables),U.any(this.scmService.onDidAddRepository,this.scmService.onDidRemoveRepository)(()=>this._onDidChangeViewWelcomeState.fire(),this,this.disposables),this.disposables.add(this.revealResourceThrottler),this.disposables.add(this.updateChildrenThrottler)}get viewMode(){return this._viewMode}set viewMode(e){this._viewMode!==e&&(this._viewMode=e,this.viewSortKey=this.getViewSortKey(),this.updateChildren(),this.onDidActiveEditorChange(),this._onDidChangeViewMode.fire(e),this.viewModeContextKey.set(e),this.updateIndentStyles(this.themeService.getFileIconTheme()),this.storageService.store("scm.viewMode",e,1,0))}get viewSortKey(){return this._viewSortKey}set viewSortKey(e){this._viewSortKey!==e&&(this._viewSortKey=e,this.updateChildren(),this.viewSortKeyContextKey.set(e),this._onDidChangeViewSortKey.fire(e),this._viewMode==="list"&&this.storageService.store("scm.viewSortKey",e,1,0))}layoutBody(e=this.layoutCache.height,t=this.layoutCache.width){e!==void 0&&(t!==void 0&&super.layoutBody(e,t),this.layoutCache.height=e,this.layoutCache.width=t,this._onDidLayout.fire(),this.treeContainer.style.height=`${e}px`,this.tree.layout(e,t))}renderBody(e){super.renderBody(e),this.treeContainer=M(e,_(".scm-view.show-file-icons")),this.treeContainer.classList.add("file-icon-themable-tree"),this.treeContainer.classList.add("show-file-icons");let t=()=>this.treeContainer.classList.toggle("show-actions",this.configurationService.getValue("scm.alwaysShowActions"));U.filter(this.configurationService.onDidChangeConfiguration,r=>r.affectsConfiguration("scm.alwaysShowActions"),this.disposables)(t,this,this.disposables),t();let o=()=>{let r=this.configurationService.getValue("scm.providerCountBadge");this.treeContainer.classList.toggle("hide-provider-counts",r==="hidden"),this.treeContainer.classList.toggle("auto-provider-counts",r==="auto")};U.filter(this.configurationService.onDidChangeConfiguration,r=>r.affectsConfiguration("scm.providerCountBadge"),this.disposables)(o,this,this.disposables),o();let n=this.loadTreeViewState();this.createTree(this.treeContainer,n),this.onDidChangeBodyVisibility(async r=>{r?this.treeOperationSequencer.queue(async()=>{await this.tree.setInput(this.scmViewService,n),U.filter(this.configurationService.onDidChangeConfiguration,s=>s.affectsConfiguration("scm.alwaysShowRepositories"),this.visibilityDisposables)(()=>{this.updateActions(),this.updateChildren()},this,this.visibilityDisposables),U.filter(this.configurationService.onDidChangeConfiguration,s=>s.affectsConfiguration("scm.inputMinLineCount")||s.affectsConfiguration("scm.inputMaxLineCount")||s.affectsConfiguration("scm.showActionButton"),this.visibilityDisposables)(()=>this.updateChildren(),this,this.visibilityDisposables),this.editorService.onDidActiveEditorChange(this.onDidActiveEditorChange,this,this.visibilityDisposables),this.scmViewService.onDidChangeVisibleRepositories(this.onDidChangeVisibleRepositories,this,this.visibilityDisposables),this.onDidChangeVisibleRepositories({added:this.scmViewService.visibleRepositories,removed:vt.empty()}),typeof this.treeScrollTop=="number"&&(this.tree.scrollTop=this.treeScrollTop,this.treeScrollTop=void 0),this.updateRepositoryCollapseAllContextKeys()}):(this.visibilityDisposables.clear(),this.onDidChangeVisibleRepositories({added:vt.empty(),removed:[...this.items.keys()]}),this.treeScrollTop=this.tree.scrollTop,this.updateRepositoryCollapseAllContextKeys())},this,this.disposables),this.disposables.add(this.instantiationService.createInstance(wlt)),this.themeService.onDidFileIconThemeChange(this.updateIndentStyles,this,this.disposables),this.updateIndentStyles(this.themeService.getFileIconTheme())}createTree(e,t){let o=_(".scm-overflow-widgets-container.monaco-editor");this.inputRenderer=this.instantiationService.createInstance(AU,this.layoutCache,o,(l,c)=>{try{this.tree.updateElementHeight(l,c)}catch{}}),this.actionButtonRenderer=this.instantiationService.createInstance(k6),this.listLabels=this.instantiationService.createInstance(Nl,{onDidChangeVisibility:this.onDidChangeBodyVisibility}),this.disposables.add(this.listLabels);let n=new d4t(()=>this.getSelectedResources());n.onWillRun(()=>this.tree.domFocus(),this,this.disposables),this.disposables.add(n);let r=this.instantiationService.createInstance(Clt,()=>this.viewMode);this.disposables.add(r);let s=hr("scm.compactFolders",!0,this.configurationService);this.tree=this.instantiationService.createInstance(sy,"SCM Tree Repo",e,new L0i(this.inputRenderer),new R0i,[this.inputRenderer,this.actionButtonRenderer,this.instantiationService.createInstance(qW,D.SCMTitle,jte(this.instantiationService)),this.instantiationService.createInstance(Mne,jte(this.instantiationService),n),this.instantiationService.createInstance(Pne,()=>this.viewMode,this.listLabels,jte(this.instantiationService),n)],r,{horizontalScrolling:!1,setRowLineHeight:!1,transformOptimization:!1,filter:new M0i,dnd:new D0i(this.instantiationService),identityProvider:new A0i,sorter:new P0i(()=>this.viewMode,()=>this.viewSortKey),keyboardNavigationLabelProvider:this.instantiationService.createInstance(Ilt,()=>this.viewMode),overrideStyles:this.getLocationBasedColors().listOverrideStyles,compressionEnabled:s.get(),collapseByDefault:l=>!(Ad(l)||Ny(l)||H8(l)),accessibilityProvider:this.instantiationService.createInstance(ylt),twistieAdditionalCssClass:l=>{if(lN(l)||aN(l))return"force-no-twistie"}}),this.disposables.add(this.tree),this.tree.onDidOpen(this.open,this,this.disposables),this.tree.onContextMenu(this.onListContextMenu,this,this.disposables),this.tree.onDidScroll(this.inputRenderer.clearValidation,this.inputRenderer,this.disposables),U.filter(this.tree.onDidChangeCollapseState,l=>Ad(l.node.element?.element),this.disposables)(this.updateRepositoryCollapseAllContextKeys,this,this.disposables),this.disposables.add(be(l=>{this.tree.updateOptions({compressionEnabled:s.read(l)})})),M(e,o)}async open(e){if(e.element){if(Ad(e.element)){this.scmViewService.focus(e.element);return}else if(aN(e.element)){this.scmViewService.focus(e.element.repository);let t=this.inputRenderer.getRenderedInputWidget(e.element);if(t){t.focus(),this.tree.setFocus([],e.browserEvent);let o=this.tree.getSelection();o.length===1&&o[0]===e.element&&setTimeout(()=>this.tree.setSelection([]))}return}else if(lN(e.element)){this.scmViewService.focus(e.element.repository),this.actionButtonRenderer.focusActionButton(e.element),this.tree.setFocus([],e.browserEvent);return}else if(Ny(e.element)){let t=e.element.provider,o=vt.find(this.scmService.repositories,n=>n.provider===t);o&&this.scmViewService.focus(o);return}else if(cN(e.element)){if(e.element.command?.id===vg||e.element.command?.id===cx)if(kgt(e.browserEvent)&&e.browserEvent.button===1){let n=e.element.resourceGroup,r=`${n.provider.label}: ${n.label}`;await MDe.openMultiFileDiffEditor(this.editorService,r,n.provider.rootUri,n.id,{...e.editorOptions,viewState:{revealData:{resource:{original:e.element.multiDiffEditorOriginalUri,modified:e.element.multiDiffEditorModifiedUri}}},preserveFocus:!0})}else await this.commandService.executeCommand(e.element.command.id,...e.element.command.arguments||[],e);else if(await e.element.open(!!e.editorOptions.preserveFocus),e.editorOptions.pinned){let n=this.editorService.activeEditorPane;n?.group.pinEditor(n.input)}let t=e.element.resourceGroup.provider,o=vt.find(this.scmService.repositories,n=>n.provider===t);o&&this.scmViewService.focus(o)}else if(H8(e.element)){let t=e.element.context.provider,o=vt.find(this.scmService.repositories,n=>n.provider===t);o&&this.scmViewService.focus(o);return}}else return}onDidActiveEditorChange(){if(!this.configurationService.getValue("scm.autoReveal"))return;let e=po.getOriginalUri(this.editorService.activeEditor,{supportSideBySide:1});e&&(this.tree.getFocus().some(t=>cN(t)&&this.uriIdentityService.extUri.isEqual(t.sourceUri,e))&&this.tree.getSelection().some(t=>cN(t)&&this.uriIdentityService.extUri.isEqual(t.sourceUri,e))||this.revealResourceThrottler.queue(()=>this.treeOperationSequencer.queue(async()=>{for(let t of this.scmViewService.visibleRepositories)if(this.items.get(t))for(let n=t.provider.groups.length-1;n>=0;n--){let r=t.provider.groups[n],s=this.viewMode==="tree"?r.resourceTree.getNode(e)?.element:r.resources.find(l=>this.uriIdentityService.extUri.isEqual(l.sourceUri,e));if(s){await this.tree.expandTo(s),this.tree.reveal(s),this.tree.setSelection([s]),this.tree.setFocus([s]);return}}})))}onDidChangeVisibleRepositories({added:e,removed:t}){for(let o of e){let n=new N;n.add(be(l=>{o.provider.actionButton.read(l),this.updateChildren(o)})),n.add(o.input.onDidChangeVisibility(()=>this.updateChildren(o))),n.add(o.provider.onDidChangeResourceGroups(()=>this.updateChildren(o)));let r=n.add(new Vt),s=()=>{for(let[l]of r)o.provider.groups.includes(l)||r.deleteAndDispose(l);for(let l of o.provider.groups)if(!r.has(l)){let c=new N;c.add(l.onDidChange(()=>this.updateChildren(o))),c.add(l.onDidChangeResources(()=>this.updateChildren(o))),r.set(l,c)}};n.add(o.provider.onDidChangeResourceGroups(s)),s(),this.items.set(o,n)}for(let o of t)this.items.deleteAndDispose(o);this.updateChildren(),this.onDidActiveEditorChange()}onListContextMenu(e){if(!e.element){let l=this.menuService.getMenuActions(Wq.ViewSort,this.contextKeyService),c=tu(l);return this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>c,onHide:()=>{}})}let t=e.element,o=t,n=[],r=new N,s=new d4t(()=>this.getSelectedResources());if(r.add(s),Ad(t)){let c=this.scmViewService.menus.getRepositoryMenus(t.provider).getRepositoryContextMenu(t);o=t.provider,s=new jHe(()=>this.getSelectedRepositories()),r.add(s),n=K8(c)}else if(!(aN(t)||lN(t))){if(Ny(t)){let c=this.scmViewService.menus.getRepositoryMenus(t.provider).getResourceGroupMenu(t);n=K8(c)}else if(cN(t)){let c=this.scmViewService.menus.getRepositoryMenus(t.resourceGroup.provider).getResourceMenu(t);n=K8(c)}else if(H8(t))if(t.element){let c=this.scmViewService.menus.getRepositoryMenus(t.element.resourceGroup.provider).getResourceMenu(t.element);n=K8(c)}else{let c=this.scmViewService.menus.getRepositoryMenus(t.context.provider).getResourceFolderMenu(t.context);n=K8(c)}}r.add(s.onWillRun(()=>this.tree.domFocus())),this.contextMenuService.showContextMenu({actionRunner:s,getAnchor:()=>e.anchor,getActions:()=>n,getActionsContext:()=>o,onHide:()=>r.dispose()})}getSelectedRepositories(){let e=this.tree.getFocus().filter(o=>!!o&&Ad(o)),t=this.tree.getSelection().filter(o=>!!o&&Ad(o));return Array.from(new Set([...e,...t]))}getSelectedResources(){return this.tree.getSelection().filter(e=>Ny(e)||cN(e)||H8(e))}getViewMode(){let e=this.configurationService.getValue("scm.defaultViewMode")==="list"?"list":"tree",t=this.storageService.get("scm.viewMode",1);return typeof t=="string"&&(e=t),e}getViewSortKey(){if(this._viewMode==="tree")return"path";let e;switch(this.configurationService.getValue("scm.defaultViewSortKey")){case"name":e="name";break;case"status":e="status";break;default:e="path";break}let o=this.storageService.get("scm.viewSortKey",1);return typeof o=="string"&&(e=o),e}loadTreeViewState(){let e=this.storageService.get("scm.viewState2",1);if(e)try{return JSON.parse(e)}catch{return}}storeTreeViewState(){this.tree&&this.storageService.store("scm.viewState2",JSON.stringify(this.tree.getViewState()),1,1)}updateChildren(e){this.updateChildrenThrottler.queue(()=>this.treeOperationSequencer.queue(async()=>{let t=this.inputRenderer.getFocusedInput();e&&this.tree.hasNode(e)?await this.tree.updateChildren(e):await this.tree.updateChildren(void 0),t&&this.inputRenderer.getRenderedInputWidget(t)?.focus(),this.updateScmProviderContextKeys(),this.updateRepositoryCollapseAllContextKeys()}))}updateIndentStyles(e){this.treeContainer.classList.toggle("list-view-mode",this.viewMode==="list"),this.treeContainer.classList.toggle("tree-view-mode",this.viewMode==="tree"),this.treeContainer.classList.toggle("align-icons-and-twisties",this.viewMode==="list"&&e.hasFileIcons||e.hasFileIcons&&!e.hasFolderIcons),this.treeContainer.classList.toggle("hide-arrows",this.viewMode==="tree"&&e.hidesExplorerArrows===!0)}updateScmProviderContextKeys(){if(!this.configurationService.getValue("scm.alwaysShowRepositories")&&this.items.size===1){let t=vt.first(this.items.keys()).provider;this.scmProviderContextKey.set(t.providerId),this.scmProviderRootUriContextKey.set(t.rootUri?.toString()),this.scmProviderHasRootUriContextKey.set(!!t.rootUri)}else this.scmProviderContextKey.set(void 0),this.scmProviderRootUriContextKey.set(void 0),this.scmProviderHasRootUriContextKey.set(!1)}updateRepositoryCollapseAllContextKeys(){if(!this.isBodyVisible()||this.items.size===1){this.isAnyRepositoryCollapsibleContextKey.set(!1),this.areAllRepositoriesCollapsedContextKey.set(!1);return}this.isAnyRepositoryCollapsibleContextKey.set(this.scmViewService.visibleRepositories.some(e=>this.tree.hasNode(e)&&this.tree.isCollapsible(e))),this.areAllRepositoriesCollapsedContextKey.set(this.scmViewService.visibleRepositories.every(e=>this.tree.hasNode(e)&&(!this.tree.isCollapsible(e)||this.tree.isCollapsed(e))))}collapseAllRepositories(){for(let e of this.scmViewService.visibleRepositories)this.tree.isCollapsible(e)&&this.tree.collapse(e)}expandAllRepositories(){for(let e of this.scmViewService.visibleRepositories)this.tree.isCollapsible(e)&&this.tree.expand(e)}collapseAllResources(e){for(let{element:t}of this.tree.getNode(e).children)pot(t)||this.tree.collapse(t,!0)}focusPreviousInput(){this.treeOperationSequencer.queue(()=>this.focusInput(-1))}focusNextInput(){this.treeOperationSequencer.queue(()=>this.focusInput(1))}async focusInput(e){if(!this.scmViewService.focusedRepository||this.scmViewService.visibleRepositories.length===0)return;let t=this.scmViewService.focusedRepository.input,o=this.scmViewService.visibleRepositories;if(!(o.length===1&&this.inputRenderer.getRenderedInputWidget(t)?.hasFocus()===!0)){if(o.length>1&&this.inputRenderer.getRenderedInputWidget(t)?.hasFocus()===!0){let n=o.indexOf(this.scmViewService.focusedRepository),r=bV(n+e,o.length);t=o[r].input}await this.tree.expandTo(t),this.tree.reveal(t),this.inputRenderer.getRenderedInputWidget(t)?.focus()}}focusPreviousResourceGroup(){this.treeOperationSequencer.queue(()=>this.focusResourceGroup(-1))}focusNextResourceGroup(){this.treeOperationSequencer.queue(()=>this.focusResourceGroup(1))}async focusResourceGroup(e){if(!this.scmViewService.focusedRepository||this.scmViewService.visibleRepositories.length===0)return;let t=wa(this.tree.getHTMLElement()),o=this.scmViewService.focusedRepository.provider.groups,n=this.tree.getFocus().find(l=>Ny(l)),r=t&&n?o.indexOf(n):-1,s;if(r===-1){for(let l of o)if(this.tree.hasNode(l)){s=l;break}}else{let l=bV(r+e,o.length);for(;l!==r;){if(this.tree.hasNode(o[l])){s=o[l];break}l=bV(l+e,o.length)}}s&&(await this.tree.expandTo(s),this.tree.reveal(s),this.tree.setSelection([s]),this.tree.setFocus([s]),this.tree.domFocus())}shouldShowWelcome(){return this.scmService.repositoryCount===0}getActionsContext(){return this.scmViewService.visibleRepositories.length===1?this.scmViewService.visibleRepositories[0].provider:void 0}focus(){super.focus(),this.treeOperationSequencer.queue(()=>new Promise(e=>{if(this.isExpanded()){if(this.tree.getFocus().length===0)for(let t of this.scmViewService.visibleRepositories){let o=this.inputRenderer.getRenderedInputWidget(t.input);if(o){o.focus(),e();return}}this.tree.domFocus(),e()}}))}dispose(){this._onDidChangeViewMode.dispose(),this._onDidChangeViewSortKey.dispose(),this.visibilityDisposables.dispose(),this.disposables.dispose(),this.items.dispose(),super.dispose()}};JHe=I([m(1,ge),m(2,ee),m(3,Kt),m(4,rd),m(5,_u),m(6,ce),m(7,ht),m(8,_e),m(9,Le),m(10,Xe),m(11,F),m(12,Bi),m(13,B),m(14,X),m(15,Je),m(16,nt)],JHe);var Clt=class extends x{constructor(e,t,o){super();this.viewMode=e;this.configurationService=t;this.scmViewService=o}async getChildren(e){let t=this.scmViewService.visibleRepositories.length,o=this.configurationService.getValue("scm.showActionButton")===!0,n=this.configurationService.getValue("scm.alwaysShowRepositories")===!0;if(pot(e)&&(t>1||n))return this.scmViewService.visibleRepositories;if(pot(e)&&t===1&&!n||Ad(e)){let r=[];e=Ad(e)?e:this.scmViewService.visibleRepositories[0];let s=e.provider.actionButton.get(),l=e.provider.groups;return e.input.visible&&r.push(e.input),o&&s&&r.push({type:"actionButton",repository:e,button:s}),(l.some(u=>u.resources.length>0)||t===1&&(!o||!s))&&r.push(...l),r}else if(Ny(e)){if(this.viewMode()==="list")return e.resources;if(this.viewMode()==="tree"){let r=[];for(let s of e.resourceTree.root.children)r.push(s.element&&s.childrenCount===0?s.element:s);return r}}else if(H8(e)){let r=[];for(let s of e.children)r.push(s.element&&s.childrenCount===0?s.element:s);return r}return[]}getParent(e){if(H8(e)){if(e.parent===e.context.resourceTree.root)return e.context;if(e.parent)return e.parent;throw new Error("Invalid element passed to getParent")}else if(cN(e)){if(this.viewMode()==="list")return e.resourceGroup;let o=e.resourceGroup.resourceTree.getNode(e.sourceUri)?.parent;if(!o)throw new Error("Invalid element passed to getParent");return o===e.resourceGroup.resourceTree.root?e.resourceGroup:o}else{if(aN(e))return e.repository;if(lN(e))return e.repository;if(Ny(e)){let t=this.scmViewService.visibleRepositories.find(o=>o.provider===e.provider);if(!t)throw new Error("Invalid element passed to getParent");return t}else{if(Ad(e))return this.scmViewService;throw new Error("Unexpected call to getParent")}}}hasChildren(e){if(pot(e))return this.scmViewService.visibleRepositories.length!==0;if(Ad(e))return!0;if(aN(e))return!1;if(lN(e))return!1;if(Ny(e))return!0;if(cN(e))return!1;if(fm.isResourceNode(e))return e.childrenCount>0;throw new Error("hasChildren not implemented.")}};Clt=I([m(1,B),m(2,_u)],Clt);var Q0i=class{constructor(i,e,t,o){this.container=i;this.contextMenuService=e;this.commandService=t;this.notificationService=o;this.disposables=new me}dispose(){this.disposables?.dispose()}setButton(i){if(this.clear(),!!i){if(i.secondaryCommands?.length){let e=[];for(let t=0;t<i.secondaryCommands.length;t++){let o=i.secondaryCommands[t];for(let n of o)e.push(ii({id:n.id,label:n.title,enabled:!0,run:async()=>{await this.executeCommand(n.id,...n.arguments||[])}}));o.length&&e.push(new ri)}e.pop(),this.button=new ry(this.container,{actions:e,addPrimaryActionToDropdown:!1,contextMenuProvider:this.contextMenuService,title:i.command.tooltip,supportIcons:!0,...Qo})}else this.button=new Wi(this.container,{supportIcons:!0,supportShortLabel:!!i.command.shortTitle,title:i.command.tooltip,...Qo});this.button.enabled=i.enabled,this.button.label=i.command.title,this.button instanceof Wi&&i.command.shortTitle&&(this.button.labelShort=i.command.shortTitle),this.button.onDidClick(async()=>await this.executeCommand(i.command.id,...i.command.arguments||[]),null,this.disposables.value),this.disposables.value.add(this.button)}}focus(){this.button?.focus()}clear(){this.disposables.value=new N,this.button=void 0,Rt(this.container)}async executeCommand(i,...e){try{await this.commandService.executeCommand(i,...e)}catch(t){this.notificationService.error(t)}}};var Y0i=class{getHeight(){return 22}getTemplateId(i){if(Ad(i))return qW.TEMPLATE_ID;if(QH(i))return Ane.TEMPLATE_ID;if(_M(i)||z8(i))return Nne.TEMPLATE_ID;throw new Error("Invalid tree element")}},Ane=class{constructor(i,e,t,o,n,r,s,l){this.actionViewItemProvider=i;this._contextMenuService=e;this._contextKeyService=t;this._keybindingService=o;this._menuService=n;this._commandService=r;this._scmViewService=s;this._telemetryService=l}static{this.TEMPLATE_ID="artifactGroup"}get templateId(){return Ane.TEMPLATE_ID}renderTemplate(i){let e=M(i,_(".scm-artifact-group")),t=M(e,_(".icon")),o=new Bc(e,{supportIcons:!1}),n=M(e,_(".actions")),r=new ol(n,{actionViewItemProvider:this.actionViewItemProvider},this._menuService,this._contextKeyService,this._contextMenuService,this._keybindingService,this._commandService,this._telemetryService);return{icon:t,label:o,actionBar:r,elementDisposables:new N,templateDisposable:wn(o,r)}}renderElement(i,e,t){let o=i.element.repository.provider,n=i.element.artifactGroup;t.icon.className=q.isThemeIcon(n.icon)?`icon ${q.asClassName(n.icon)}`:"",t.label.setLabel(n.name);let r=this._scmViewService.menus.getRepositoryMenus(o);t.elementDisposables.add($te(r.getArtifactGroupMenu(n),s=>{t.actionBar.setActions(s)},"inline",o)),t.actionBar.context=n}renderCompressedElements(i,e,t,o){throw new Error("Should never happen since node is incompressible")}disposeElement(i,e,t,o){t.elementDisposables.clear()}disposeTemplate(i){i.elementDisposables.dispose(),i.templateDisposable.dispose()}};Ane=I([m(1,Xe),m(2,X),m(3,_e),m(4,Kt),m(5,ge),m(6,_u),m(7,Te)],Ane);var Nne=class{constructor(i,e,t,o,n,r,s,l){this.actionViewItemProvider=i;this._contextMenuService=e;this._contextKeyService=t;this._keybindingService=o;this._menuService=n;this._commandService=r;this._scmViewService=s;this._telemetryService=l}static{this.TEMPLATE_ID="artifact"}get templateId(){return Nne.TEMPLATE_ID}renderTemplate(i){let e=M(i,_(".scm-artifact")),t=M(e,_(".icon")),o=new Bc(e,{supportIcons:!1}),n=M(e,_(".timestamp-container")),r=M(n,_(".timestamp")),s=M(e,_(".actions")),l=new ol(s,{actionViewItemProvider:this.actionViewItemProvider},this._menuService,this._contextKeyService,this._contextMenuService,this._keybindingService,this._commandService,this._telemetryService);return{icon:t,label:o,timestampContainer:n,timestamp:r,actionBar:l,elementDisposables:new N,templateDisposable:wn(o,l)}}renderElement(i,e,t){let o=i.element;if(_M(o)){let n=o.group,r=o.artifact,s=r.icon??o.group.icon;t.icon.className=q.isThemeIcon(s)?`icon ${q.asClassName(s)}`:"";let l=n.supportsFolders?r.name.split("/").pop()??r.name:r.name;t.label.setLabel(l,r.description),t.timestamp.textContent=r.timestamp?ea(r.timestamp):"",t.timestampContainer.classList.toggle("duplicate",o.hideTimestamp),t.timestampContainer.style.display=""}else z8(o)&&(t.icon.className=`icon ${q.asClassName(R.folder)}`,t.label.setLabel(He(o.uri)),t.timestamp.textContent="",t.timestampContainer.classList.remove("duplicate"),t.timestampContainer.style.display="none");this._renderActionBar(o,t)}renderCompressedElements(i,e,t,o){let n=i.element,r=n.elements[n.elements.length-1];if(_M(r)){let s=r.artifact,l=s.icon??r.group.icon;t.icon.className=q.isThemeIcon(l)?`icon ${q.asClassName(l)}`:"",t.label.setLabel(s.name,s.description),t.timestamp.textContent=s.timestamp?ea(s.timestamp):"",t.timestampContainer.classList.toggle("duplicate",r.hideTimestamp),t.timestampContainer.style.display=""}else z8(r)&&(t.icon.className=`icon ${q.asClassName(R.folder)}`,t.label.setLabel(r.uri.fsPath.substring(1)),t.timestamp.textContent="",t.timestampContainer.classList.remove("duplicate"),t.timestampContainer.style.display="none");this._renderActionBar(r,t)}_renderActionBar(i,e){if(_M(i)){let t=i.artifact,o=i.repository.provider,n=this._scmViewService.menus.getRepositoryMenus(o);e.elementDisposables.add($te(n.getArtifactMenu(i.group,t),r=>{e.actionBar.setActions(r)},"inline",o)),e.actionBar.context=t}else fm.isResourceNode(i)&&(e.actionBar.setActions([]),e.actionBar.context=void 0)}disposeElement(i,e,t,o){t.elementDisposables.clear()}disposeTemplate(i){i.elementDisposables.dispose(),i.templateDisposable.dispose()}};Nne=I([m(1,Xe),m(2,X),m(3,_e),m(4,Kt),m(5,ge),m(6,_u),m(7,Te)],Nne);var Elt=class extends x{constructor(e){super();this.scmViewService=e}async getChildren(e){if(this.scmViewService.explorerEnabledConfig.get()===!1){let t=Ad(e)?e.provider.id:void 0;return this.scmViewService.repositories.filter(n=>n.provider.parentId===t)}if(e instanceof Fq){let t=this.scmViewService.repositories.filter(o=>o.provider.parentId===void 0);if(t.length!==this.scmViewService.repositories.length)for(let o of t){let n=this.scmViewService.repositories.filter(s=>s.provider.parentId===o.provider.id);if(n.length===0)continue;let r=t.indexOf(o);t.splice(r+1,0,...n)}return t}else{if(Ad(e))return(await e.provider.artifactProvider.get()?.provideArtifactGroups()??[]).map(o=>({repository:e,artifactGroup:o,type:"artifactGroup"}));if(QH(e)){let t=e.repository,o=await t.provider.artifactProvider.get()?.provideArtifacts(e.artifactGroup.id)??[];if(e.artifactGroup.supportsFolders){let n=new fm(e);for(let r=0;r<o.length;r++){let s=o[r],l=A.from({scheme:"scm-artifact",path:s.name}),c=s.id.lastIndexOf("/")>0?s.id.substring(0,s.id.lastIndexOf("/")):s.id,u=r>0?o[r-1]:void 0,p=u&&u.id.lastIndexOf("/")>0?u.id.substring(0,u.id.lastIndexOf("/")):u?.id,h=r>0&&s.timestamp!==void 0&&u?.timestamp!==void 0&&c===p&&ea(u.timestamp)===ea(s.timestamp);n.add(l,{repository:t,group:e.artifactGroup,artifact:s,hideTimestamp:h,type:"artifact"})}return vt.map(n.root.children,r=>r.element??r)}return o.map((n,r,s)=>({repository:t,group:e.artifactGroup,artifact:n,hideTimestamp:r>0&&n.timestamp!==void 0&&s[r-1].timestamp!==void 0&&ea(s[r-1].timestamp)===ea(n.timestamp),type:"artifact"}))}else if(z8(e))return vt.map(e.children,t=>t.element&&t.childrenCount===0?t.element:t)}return[]}hasChildren(e){if(this.scmViewService.explorerEnabledConfig.get()===!1){let t=Ad(e)?e.provider.id:void 0;return this.scmViewService.repositories.filter(n=>n.provider.parentId===t).length>0}return e instanceof Fq?this.scmViewService.repositories.length>0:Ad(e)||QH(e)?!0:_M(e)?!1:z8(e)?e.childrenCount>0:!1}};Elt=I([m(0,_u)],Elt);var X0i=class{getId(i){if(Ad(i))return`repo:${i.provider.id}`;if(QH(i))return`artifactGroup:${i.repository.provider.id}/${i.artifactGroup.id}`;if(_M(i))return`artifact:${i.repository.provider.id}/${i.group.id}/${i.artifact.id}`;if(z8(i))return`artifactFolder:${i.context.repository.provider.id}/${i.context.artifactGroup.id}/${i.uri.fsPath}`;throw new Error("Invalid tree element")}},J0i=class{isIncompressible(i){return fm.isResourceNode(i)?i.childrenCount>1:!0}},ZHe=class extends Gs{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super({...e,titleMenuId:D.SCMSourceControlTitle},n,r,p,u,c,l,h,g,f);this.scmService=t;this.scmViewService=o;this.commandService=s;this.storageService=v;this.treeOperationSequencer=new rm;this.updateChildrenThrottler=new gu;this.visibilityDisposables=new N;this.repositoryDisposables=new Vt;this.visibleCountObs=hr("scm.repositories.visible",10,this.configurationService),this.providerCountBadgeObs=hr("scm.providerCountBadge","hidden",this.configurationService),this.storageService.onWillSaveState(()=>{this.storeTreeViewState()},this,this._store),this._register(this.updateChildrenThrottler)}renderBody(e){super.renderBody(e);let t=M(e,_(".scm-view.scm-repositories-view"));this._register(be(n=>{let r=this.providerCountBadgeObs.read(n);t.classList.toggle("hide-provider-counts",r==="hidden"),t.classList.toggle("auto-provider-counts",r==="auto")}));let o=this.loadTreeViewState();this.createTree(t,o),this.onDidChangeBodyVisibility(async n=>{if(!n){this.visibilityDisposables.clear();return}this.treeOperationSequencer.queue(async()=>{await this.tree.setInput(this.scmViewService,o),this.visibilityDisposables.add(be(s=>{let l=this.visibleCountObs.read(s);this.updateBodySize(this.tree.contentHeight,l)})),this.visibilityDisposables.add(Vs(this.scmViewService.explorerEnabledConfig,async()=>{await this.updateChildren(),this.updateBodySize(this.tree.contentHeight),this.scmViewService.repositories.length===1&&await this.treeOperationSequencer.queue(()=>this.tree.expand(this.scmViewService.repositories[0]))}));let r=Fr(this,this.scmViewService.onDidChangeVisibleRepositories);this.visibilityDisposables.add(be(async s=>{r.read(s),await this.treeOperationSequencer.queue(()=>this.updateTreeSelection())})),this.scmService.onDidAddRepository(this.onDidAddRepository,this,this.visibilityDisposables),this.scmService.onDidRemoveRepository(this.onDidRemoveRepository,this,this.visibilityDisposables);for(let s of this.scmService.repositories)this.onDidAddRepository(s);this.visibilityDisposables.add(be(async s=>{let l=this.scmViewService.explorerEnabledConfig.read(s),c=this.scmViewService.didFinishLoadingRepositories.read(s);o===void 0&&l&&c&&this.scmViewService.repositories.length===1&&await this.treeOperationSequencer.queue(()=>this.tree.expand(this.scmViewService.repositories[0]))}))})},this,this._store)}layoutBody(e,t){super.layoutBody(e,t),this.tree.layout(e,t)}focus(){super.focus(),this.tree.domFocus()}createTree(e,t){this.treeIdentityProvider=new X0i,this.treeDataSource=this.instantiationService.createInstance(Elt),this._register(this.treeDataSource),this.tree=this.instantiationService.createInstance(sy,"SCM Repositories",e,new Y0i,new J0i,[this.instantiationService.createInstance(qW,D.SCMSourceControlInline,jte(this.instantiationService)),this.instantiationService.createInstance(Ane,jte(this.instantiationService)),this.instantiationService.createInstance(Nne,jte(this.instantiationService))],this.treeDataSource,{identityProvider:this.treeIdentityProvider,horizontalScrolling:!1,collapseByDefault:o=>this.scmViewService.explorerEnabledConfig.get()===!1?!(Ad(o)&&o.provider.parentId===void 0):t?.expanded&&(Ad(o)||QH(o)||_M(o))?t.expanded.indexOf(this.treeIdentityProvider.getId(o))===-1:z8(o)?!(o.childrenCount===1&&vt.first(o.children)?.element===void 0):!0,compressionEnabled:!0,overrideStyles:this.getLocationBasedColors().listOverrideStyles,multipleSelectionSupport:this.scmViewService.selectionModeConfig.get()==="multiple",expandOnDoubleClick:!0,expandOnlyOnTwistieClick:!0,accessibilityProvider:{getAriaLabel(o){return Ad(o)?o.provider.label:QH(o)?o.artifactGroup.name:_M(o)?o.artifact.name:""},getWidgetAriaLabel(){return d(13779,null)}}}),this._register(this.tree),this._register(be(o=>{let n=this.scmViewService.selectionModeConfig.read(o);this.tree.updateOptions({multipleSelectionSupport:n==="multiple"})})),this._register(this.tree.onDidOpen(this.onTreeDidOpen,this)),this._register(this.tree.onDidChangeSelection(this.onTreeSelectionChange,this)),this._register(this.tree.onDidChangeFocus(this.onTreeDidChangeFocus,this)),this._register(this.tree.onDidFocus(this.onDidTreeFocus,this)),this._register(this.tree.onContextMenu(this.onTreeContextMenu,this)),this._register(this.tree.onDidChangeContentHeight(this.onTreeContentHeightChange,this))}async onDidAddRepository(e){let t=new N;t.add(be(async o=>{let n=this.scmViewService.explorerEnabledConfig.read(o),r=e.provider.artifactProvider.read(o);!n||!r||o.store.add(r.onDidChangeArtifacts(async s=>{await this.updateRepository(e)}))})),t.add(be(async o=>{let n=e.provider.historyProvider.read(o);n&&o.store.add(Vs(n.historyItemRef,async()=>{await this.updateRepository(e)}))})),await this.updateRepository(e),this.repositoryDisposables.set(e,t)}async onDidRemoveRepository(e){await this.updateRepository(e),this.repositoryDisposables.deleteAndDispose(e)}onTreeDidOpen(e){!e.element||!_M(e.element)||!e.element.artifact.command||this.commandService.executeCommand(e.element.artifact.command.id,e.element.repository.provider,e.element.artifact)}onTreeContextMenu(e){if(e.element){if(Ad(e.element)){let t=e.element.provider,n=this.scmViewService.menus.getRepositoryMenus(t).getRepositoryContextMenu(e.element),r=K8(n),s=new N,l=new jHe(()=>this.getTreeSelection());s.add(l),s.add(l.onWillRun(()=>this.tree.domFocus())),this.contextMenuService.showContextMenu({actionRunner:l,getAnchor:()=>e.anchor,getActions:()=>r,getActionsContext:()=>t,onHide:()=>s.dispose()})}else if(_M(e.element)){let t=e.element.repository.provider,o=e.element.artifact,r=this.scmViewService.menus.getRepositoryMenus(t).getArtifactMenu(e.element.group,o),s=K8(r,t);this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>s,getActionsContext:()=>o})}}}onTreeSelectionChange(e){if(e.browserEvent&&e.elements.length>0){let t=this.tree.scrollTop;e.elements.every(o=>Ad(o))?this.scmViewService.visibleRepositories=e.elements:e.elements.every(o=>QH(o)||_M(o))&&(this.scmViewService.visibleRepositories=e.elements.map(o=>o.repository)),this.tree.scrollTop=t}}onTreeDidChangeFocus(e){e.browserEvent&&e.elements.length>0&&Ad(e.elements[0])&&this.scmViewService.focus(e.elements[0])}onDidTreeFocus(){let e=this.tree.getFocus();e.length>0&&(Ad(e[0])?this.scmViewService.focus(e[0]):(QH(e[0])||_M(e[0]))&&this.scmViewService.focus(e[0].repository))}onTreeContentHeightChange(e){this.updateBodySize(e),this.treeOperationSequencer.queue(()=>this.updateTreeSelection())}async updateChildren(e){return this.updateChildrenThrottler.queue(()=>this.treeOperationSequencer.queue(async()=>{e&&this.tree.hasNode(e)?await this.tree.updateChildren(e,!0):await this.tree.updateChildren(void 0,!0)}))}async expand(e){await this.treeOperationSequencer.queue(()=>this.tree.expand(e,!0))}async updateRepository(e){if(this.scmViewService.explorerEnabledConfig.get()===!1){if(e.provider.parentId===void 0){await this.updateChildren();return}await this.updateParentRepository(e)}await this.updateChildren()}async updateParentRepository(e){let t=this.scmViewService.repositories.find(o=>o.provider.id===e.provider.parentId);t&&(await this.updateChildren(t),await this.expand(t))}updateBodySize(e,t){if(this.orientation!==1)if(this.scmViewService.explorerEnabledConfig.get()===!1){t=t??this.visibleCountObs.get();let o=this.scmViewService.repositories.length===0,n=Math.min(e/22,t)*22;this.minimumBodySize=t===0?22:n,this.maximumBodySize=t===0||o?Number.POSITIVE_INFINITY:n}else this.minimumBodySize=120,this.maximumBodySize=Number.POSITIVE_INFINITY}async updateTreeSelection(){let e=this.getTreeSelection(),t=new Set(e),o=new Set(this.scmViewService.visibleRepositories),n=new Set(vt.filter(o,c=>!t.has(c))),r=new Set(vt.filter(t,c=>!o.has(c)));if(n.size===0&&r.size===0)return;let s=e.filter(c=>!r.has(c));for(let c of this.scmViewService.repositories)n.has(c)&&s.push(c);let l=s.filter(c=>this.tree.hasNode(c));this.tree.setSelection(l),l.length>0&&!this.tree.getFocus().includes(l[0])&&(this.tree.setAnchor(l[0]),this.tree.setFocus([l[0]]))}getTreeSelection(){return this.tree.getSelection().map(e=>{if(Ad(e))return e;if(QH(e)||_M(e))return e.repository;if(z8(e))return e.context.repository;throw new Error("Invalid tree element")})}loadTreeViewState(){let e=this.storageService.get("scm.repositoriesViewState",1);if(e)try{return JSON.parse(e)}catch{return}}storeTreeViewState(){this.tree&&this.storageService.store("scm.repositoriesViewState",JSON.stringify(this.tree.getViewState()),1,1)}dispose(){this.visibilityDisposables.dispose(),this.repositoryDisposables.dispose(),super.dispose()}};ZHe=I([m(1,rd),m(2,_u),m(3,_e),m(4,Xe),m(5,ge),m(6,F),m(7,Bi),m(8,X),m(9,B),m(10,Je),m(11,Le),m(12,nt),m(13,ce)],ZHe);var Vq={IsEnabled:new Y("isWorkspaceTrustEnabled",!1,d(17065,null)),IsTrusted:new Y("isWorkspaceTrusted",!1,d(17064,null))},Bq="workbench.trust.manage";function Dmn(a){return(i,e)=>{if(i.rootUri&&!e.rootUri)return-1;if(!i.rootUri&&e.rootUri)return 1;if(!i.rootUri&&!e.rootUri)return 0;let t=ws(a,i.rootUri),o=ws(a,e.rootUri);return t&&o?vTo(i,e):t?-1:o?1:0}}function vTo(a,i){return a.kind==="primary"?-1:i.kind==="primary"?1:a.kind==="secondary"?-1:i.kind==="secondary"?1:0}var Hq=class extends x{constructor(e,t){super();this.storageService=e;this.uriIdentityService=t;this.quickDiffProviders=new Set;this._onDidChangeQuickDiffProviders=this._register(new E);this.onDidChangeQuickDiffProviders=this._onDidChangeQuickDiffProviders.event;this.hiddenQuickDiffProviders=new Set;this.loadState()}static{this.STORAGE_KEY="workbench.scm.quickDiffProviders.hidden"}get providers(){return Array.from(this.quickDiffProviders).sort(vTo)}addQuickDiffProvider(e){return this.quickDiffProviders.add(e),this._onDidChangeQuickDiffProviders.fire(),{dispose:()=>{this.quickDiffProviders.delete(e),this._onDidChangeQuickDiffProviders.fire()}}}async getQuickDiffs(e,t="",o=!1){let n=Array.from(this.quickDiffProviders).filter(l=>!l.rootUri||this.uriIdentityService.extUri.isEqualOrParent(e,l.rootUri)).sort(Dmn(e)),r=await Promise.allSettled(n.map(async l=>{let u=(l.selector?fB(l.selector,e,t,o,void 0,void 0):10)>0?await l.getOriginalResource(e)??void 0:void 0;return{provider:l,originalResource:u}})),s=[];for(let l of r){if(l.status==="rejected")continue;let{provider:c,originalResource:u}=l.value;u&&s.push({id:c.id,label:c.label,kind:c.kind,originalResource:u})}return s}toggleQuickDiffProviderVisibility(e){this.isQuickDiffProviderVisible(e)?this.hiddenQuickDiffProviders.add(e):this.hiddenQuickDiffProviders.delete(e),this.saveState(),this._onDidChangeQuickDiffProviders.fire()}isQuickDiffProviderVisible(e){return!this.hiddenQuickDiffProviders.has(e)}loadState(){let e=this.storageService.get(Hq.STORAGE_KEY,0);if(e)try{this.hiddenQuickDiffProviders=new Set(JSON.parse(e))}catch{}}saveState(){this.hiddenQuickDiffProviders.size===0?this.storageService.remove(Hq.STORAGE_KEY,0):this.storageService.store(Hq.STORAGE_KEY,JSON.stringify(Array.from(this.hiddenQuickDiffProviders)),0,0)}};Hq=I([m(0,ce),m(1,ht)],Hq);async function bTo(a,i,e,t){let n=(await a.getQuickDiffs(i,e,t)).find(r=>r.kind==="primary");return n?n.originalResource:null}var Nve=class extends x{constructor(e,t,o,n,r){super();this.configurationService=e;this.editorGroupsService=t;this.scmService=o;this.storageService=n;this.layoutService=r;this._repositoryDisposables=new Vt;this._enabledConfig=hr("scm.workingSets.enabled",!1,this.configurationService),this._store.add(be(s=>{if(!this._enabledConfig.read(s)){this.storageService.remove("scm.workingSets",1),this._repositoryDisposables.clearAndDisposeAll();return}this._workingSets=this._loadWorkingSets(),this.scmService.onDidAddRepository(this._onDidAddRepository,this,s.store),this.scmService.onDidRemoveRepository(this._onDidRemoveRepository,this,s.store);for(let l of this.scmService.repositories)this._onDidAddRepository(l)}))}static{this.ID="workbench.contrib.scmWorkingSets"}_onDidAddRepository(e){let t=new N,o=ke(n=>e.provider.historyProvider.read(n)?.historyItemRef.read(n)?.id);t.add(be(async n=>{let r=o.read(n);if(!r)return;let s=G8(e.provider),l=this._workingSets.get(s);if(!l){this._workingSets.set(s,{currentHistoryItemGroupId:r,editorWorkingSets:new Map});return}l.currentHistoryItemGroupId!==r&&(this._saveWorkingSet(s,r,l),await this._restoreWorkingSet(s,r))})),this._repositoryDisposables.set(e,t)}_onDidRemoveRepository(e){this._repositoryDisposables.deleteAndDispose(e)}_loadWorkingSets(){let e=new Map,t=this.storageService.get("scm.workingSets",1);if(!t)return e;for(let o of JSON.parse(t))e.set(o.providerKey,{currentHistoryItemGroupId:o.currentHistoryItemGroupId,editorWorkingSets:new Map(o.editorWorkingSets)});return e}_saveWorkingSet(e,t,o){let n=o.currentHistoryItemGroupId,r=o.editorWorkingSets,s=this.editorGroupsService.saveWorkingSet(n);this._workingSets.set(e,{currentHistoryItemGroupId:t,editorWorkingSets:r.set(n,s)});let l=[];for(let[c,{currentHistoryItemGroupId:u,editorWorkingSets:p}]of this._workingSets)l.push({providerKey:c,currentHistoryItemGroupId:u,editorWorkingSets:[...p]});this.storageService.store("scm.workingSets",JSON.stringify(l),1,1)}async _restoreWorkingSet(e,t){let o=this._workingSets.get(e);if(!o)return;let n=o.editorWorkingSets.get(t);if(!n&&this.configurationService.getValue("scm.workingSets.default")==="empty"&&(n="empty"),n){let r=this.layoutService.hasFocus("workbench.parts.panel");await this.editorGroupsService.applyWorkingSet(n,{preserveFocus:r})}}dispose(){this._repositoryDisposables.dispose(),super.dispose()}};Nve=I([m(0,B),m(1,wt),m(2,rd),m(3,ce),m(4,yi)],Nve);var STo="workbench.scm.action.graph.pickRepository",ITo="workbench.scm.action.graph.pickHistoryItemRefs",Z0i=class extends hs{constructor(e,t,o){super(null,t,{...o,icon:!1,label:!0});this._repository=e}updateLabel(){if(this.options.label&&this.label){this.label.classList.add("scm-graph-repository-picker");let e=_(".icon"),t=q.isThemeIcon(this._repository.provider.iconPath)?q.asClassNameArray(this._repository.provider.iconPath):q.asClassNameArray(R.repo);e.classList.add(...t);let o=_(".name");o.textContent=this._repository.provider.name,vi(this.label,e,o)}}getTooltip(){return this._repository.provider.name}},eWi=class extends hs{constructor(e,t,o,n){super(null,o,{...n,icon:!1,label:!0});this._repository=e;this._historyItemsFilter=t}updateLabel(){if(this.options.label&&this.label){this.label.classList.add("scm-graph-history-item-picker");let e=_(".icon");e.classList.add(...q.asClassNameArray(R.gitBranch));let t=_(".name");this._historyItemsFilter==="all"?t.textContent=d(13753,null):this._historyItemsFilter==="auto"?t.textContent=d(13755,null):this._historyItemsFilter.length===1?t.textContent=this._historyItemsFilter[0].name:t.textContent=d(13759,null,this._historyItemsFilter.length),vi(this.label,e,t)}}getTooltip(){if(this._historyItemsFilter==="all")return d(13754,null);if(this._historyItemsFilter==="auto"){let e=this._repository.provider.historyProvider.get();return[e?.historyItemRef.get()?.name,e?.historyItemRemoteRef.get()?.name,e?.historyItemBaseRef.get()?.name].filter(t=>!!t).join(", ")}else return this._historyItemsFilter.length===1?this._historyItemsFilter[0].name:this._historyItemsFilter.map(e=>e.name).join(", ")}};W(class extends Yn{constructor(){super({id:STo,title:d(13766,null),viewId:uA,f1:!1,menu:{id:D.SCMHistoryTitle,when:C.and(C.has("scm.providerCount"),C.greater("scm.providerCount",1),C.equals("config.scm.repositories.selectionMode","multiple")),group:"navigation",order:0}})}async runInView(a,i){i.pickRepository()}});W(class extends Yn{constructor(){super({id:ITo,title:d(13764,null),icon:R.gitBranch,viewId:uA,precondition:Mc.SCMHistoryItemCount.notEqualsTo(0),f1:!1,menu:{id:D.SCMHistoryTitle,group:"navigation",order:1}})}async runInView(a,i){i.pickHistoryItemRef()}});W(class extends Yn{constructor(){super({id:"workbench.scm.action.graph.revealCurrentHistoryItem",title:d(13757,null),icon:R.target,viewId:uA,precondition:C.and(Mc.SCMHistoryItemCount.notEqualsTo(0),Mc.SCMCurrentHistoryItemRefInFilter.isEqualTo(!0)),f1:!1,menu:{id:D.SCMHistoryTitle,group:"navigation",order:2}})}async runInView(a,i){i.revealCurrentHistoryItem()}});W(class extends Yn{constructor(){super({id:"workbench.scm.action.graph.refresh",title:d(13765,null),viewId:uA,f1:!1,icon:R.refresh,menu:{id:D.SCMHistoryTitle,group:"navigation",order:1e3}})}async runInView(a,i){i.refresh()}});W(class extends Yn{constructor(){super({id:"workbench.scm.action.graph.setListViewMode",title:d(13771,null),viewId:uA,toggled:Mc.SCMHistoryViewMode.isEqualTo("list"),menu:{id:D.SCMHistoryTitle,group:"9_viewmode",order:1},f1:!1})}async runInView(a,i){i.setViewMode("list")}});W(class extends Yn{constructor(){super({id:"workbench.scm.action.graph.setTreeViewMode",title:d(13772,null),viewId:uA,toggled:Mc.SCMHistoryViewMode.isEqualTo("tree"),menu:{id:D.SCMHistoryTitle,group:"9_viewmode",order:2},f1:!1})}async runInView(a,i){i.setViewMode("tree")}});W(class extends K{constructor(){super({id:"workbench.scm.action.graph.viewChanges",title:d(13761,null),icon:R.diffMultiple,f1:!1,menu:[{id:D.SCMHistoryItemContext,group:"inline",order:1},{id:D.SCMHistoryItemContext,group:"0_view",order:1}]})}async run(a,i,...e){let t=a.get(ge),o=i.historyProvider.get(),n=o?.historyItemRef.get(),r=o?.historyItemRemoteRef.get();if(!i||!o||!n||e.length===0)return;let s=e[0],l,c,u;if(r&&(s.id===ZF||s.id===YJ)){let h=await o.resolveHistoryItemRefsCommonAncestor([n.name,r.name]);h&&s.id===ZF?(l=`${s.subject} - ${n.name} \u2194 ${r.name}`,c=r.id,u=h):h&&s.id===YJ&&(l=`${s.subject} - ${r.name} \u2194 ${n.name}`,c=n.id,u=h)}else l=Mzt(s),c=s.id,s.parentIds.length>0&&(s.parentIds[0]===ZF&&r?u=await o.resolveHistoryItemRefsCommonAncestor([n.name,r.name]):u=s.parentIds[0]);if(!l||!c||!u)return;let p=ax.getMultiDiffSourceUri(i,c,u,"");t.executeCommand("_workbench.openMultiDiffEditor",{title:l,multiDiffSourceUri:p})}});W(class extends K{constructor(){super({id:"workbench.scm.action.graph.openFile",title:d(13762,null),icon:R.goToFile,f1:!1,menu:[{id:D.SCMHistoryItemChangeContext,group:"inline",order:1},{id:D.SCMHistoryItemChangeContext,group:"0_view",order:1}]})}async run(a,i,e){let t=a.get(ee);if(!i||!e.modifiedUri)return;let o;i.id===ZF?o=d(13758,null):i.id===YJ?o=d(13763,null):o=i.displayId??i.id;let n=jo(e.modifiedUri.fsPath);await t.openEditor({resource:e.modifiedUri,label:`${n} (${o})`})}});var tWi=class{getHeight(){return 22}getTemplateId(i){if(dN(i))return One.TEMPLATE_ID;if(U8(i)||bNe(i))return Fne.TEMPLATE_ID;if(vNe(i))return Wne.TEMPLATE_ID;throw new Error("Unknown element")}},One=class{constructor(i,e,t,o,n,r,s,l,c,u){this._viewContainerLocation=i;this._commandService=e;this._configurationService=t;this._contextKeyService=o;this._contextMenuService=n;this._hoverService=r;this._keybindingService=s;this._markdownRendererService=l;this._menuService=c;this._telemetryService=u;this._badgesConfig=hr("scm.graph.badges","filter",this._configurationService)}static{this.TEMPLATE_ID="history-item"}get templateId(){return One.TEMPLATE_ID}renderTemplate(i){let e=M(i,_(".history-item")),t=M(e,_(".graph-container")),o=new Bc(e,{supportIcons:!0,supportHighlights:!0,supportDescriptionHighlights:!0}),n=M(e,_(".label-container")),r=M(e,_(".actions")),s=new ol(r,void 0,this._menuService,this._contextKeyService,this._contextMenuService,this._keybindingService,this._commandService,this._telemetryService);return{element:e,graphContainer:t,label:o,labelContainer:n,actionBar:s,elementDisposables:new N,disposables:wn(o,s)}}renderElement(i,e,t){let o=i.element.repository.provider,n=i.element.historyItemViewModel,r=n.historyItem,{content:s,disposables:l}=Q7e(this._markdownRendererService,r,!0),{hoverOptions:c,hoverLifecycleOptions:u}=this._getHoverOptions(),p=this._hoverService.setupDelayedHover(t.element,{...c,content:s},u);t.elementDisposables.add(p),t.elementDisposables.add(l),t.graphContainer.textContent="",t.graphContainer.classList.toggle("current",n.kind==="HEAD"),t.graphContainer.classList.toggle("incoming-changes",n.kind==="incoming-changes"),t.graphContainer.classList.toggle("outgoing-changes",n.kind==="outgoing-changes"),t.graphContainer.appendChild(Vno(n));let g=o.historyProvider.get()?.historyItemRef?.get()?.revision===r.id?["history-item-current"]:[],[f,v]=this._processMatches(n,i.filterData);t.label.setLabel(r.subject,r.author,{matches:f,descriptionMatches:v,extraClasses:g}),this._renderBadges(r,t);let b=this._menuService.getMenuActions(D.SCMHistoryItemContext,this._contextKeyService,{arg:o,shouldForwardArgs:!0});t.actionBar.context=r,t.actionBar.setActions(ml(b,"inline").primary)}renderCompressedElements(i,e,t){throw new Error("Should never happen since node is incompressible")}_renderBadges(i,e){e.elementDisposables.add(be(t=>{let o=this._badgesConfig.read(t);e.labelContainer.replaceChildren();let n=i.references?i.references.slice(0):[];n.length>0&&n[0].color&&(this._renderBadge([n[0]],!0,e),n.splice(0,1));let r=MI(n,s=>s.color?s.color:"");for(let[s,l]of Object.entries(r)){if(s===""&&o!=="all"||!l)continue;let c=MI(l,u=>q.isThemeIcon(u.icon)?u.icon.id:"");for(let[u,p]of Object.entries(c))u===""||!p||this._renderBadge(p,!1,e)}}))}_renderBadge(i,e,t){if(i.length===0||!q.isThemeIcon(i[0].icon))return;let o=ct("div.label",{style:{color:i[0].color?kt(uvi):kt(To),backgroundColor:i[0].color?kt(i[0].color):kt(dvi)}},[ct("div.count@count",{style:{display:i.length>1?"":"none"}}),ct("div.icon@icon"),ct("div.description@description",{style:{display:e?"":"none"}})]);o.count.textContent=i.length>1?i.length.toString():"",o.icon.classList.add(...q.asClassNameArray(i[0].icon)),o.description.textContent=e?i[0].name:"",M(t.labelContainer,o.root)}_getHoverOptions(){return this._viewContainerLocation===1?{hoverOptions:{additionalClasses:["history-item-hover"],appearance:{compact:!0},position:{hoverPosition:1},style:2},hoverLifecycleOptions:void 0}:{hoverOptions:{additionalClasses:["history-item-hover"],appearance:{compact:!0,showPointer:!0},position:{hoverPosition:1},style:1},hoverLifecycleOptions:{groupId:"scm-history-item"}}}_processMatches(i,e){return e?[i.historyItem.message===e.label?xa(e.score):void 0,i.historyItem.author===e.label?xa(e.score):void 0]:[void 0,void 0]}disposeElement(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.elementDisposables.dispose(),i.disposables.dispose()}};One=I([m(1,ge),m(2,B),m(3,X),m(4,Xe),m(5,nt),m(6,_e),m(7,On),m(8,Kt),m(9,Te)],One);var Fne=class{constructor(i,e,t,o,n,r,s,l,c){this.viewMode=i;this.resourceLabels=e;this._commandService=t;this._contextKeyService=o;this._contextMenuService=n;this._keybindingService=r;this._labelService=s;this._menuService=l;this._telemetryService=c}static{this.TEMPLATE_ID="history-item-change"}get templateId(){return Fne.TEMPLATE_ID}renderTemplate(i){let e=i.parentElement,t=M(i,_(".history-item-change")),o=M(t,_(".graph-placeholder")),n=M(t,_(".label-container")),r=this.resourceLabels.create(n,{supportDescriptionHighlights:!0,supportHighlights:!0}),s=new N,l=M(r.element,_(".actions")),c=new ol(l,void 0,this._menuService,this._contextKeyService,this._contextMenuService,this._keybindingService,this._commandService,this._telemetryService);return s.add(c),{rowElement:e,element:t,graphPlaceholder:o,resourceLabel:r,actionBar:c,disposables:s}}renderElement(i,e,t,o){let n=U8(i.element)?i.element.historyItemViewModel:i.element.context.historyItemViewModel,r=U8(i.element)?i.element.historyItemChange:i.element,s=U8(i.element)?i.element.graphColumns:i.element.context.historyItemViewModel.outputSwimlanes;this._renderGraphPlaceholder(t,n,s);let l=this.viewMode()==="tree",c=U8(i.element)?0:1;if(t.resourceLabel.setFile(r.uri,{fileDecorations:{colors:!1,badges:!0},fileKind:c,hidePath:l}),c===0){let u=this._menuService.getMenuActions(D.SCMHistoryItemChangeContext,this._contextKeyService,{arg:n.historyItem,shouldForwardArgs:!0});t.actionBar.context=r,t.actionBar.setActions(ml(u,"inline").primary)}else t.actionBar.context=void 0,t.actionBar.setActions([])}renderCompressedElements(i,e,t,o){let n=i.element,r=n.elements[0].context.historyItemViewModel,s=n.elements[0].context.historyItemViewModel.outputSwimlanes;this._renderGraphPlaceholder(t,r,s);let l=n.elements.map(u=>u.name),c=n.elements[n.elements.length-1];t.resourceLabel.setResource({resource:c.uri,name:l},{fileDecorations:{colors:!1,badges:!0},fileKind:1,separator:this._labelService.getSeparator(c.uri.scheme)}),t.actionBar.context=void 0,t.actionBar.setActions([])}_renderGraphPlaceholder(i,e,t){let o=Eh*(t.length+1),n=o-16;i.rowElement.style.marginLeft=`${n}px`,i.graphPlaceholder.textContent="",i.graphPlaceholder.style.left=`${-1*n}px`,i.graphPlaceholder.style.width=`${o}px`,i.graphPlaceholder.appendChild(pvi(t,Hno(e)))}disposeTemplate(i){i.disposables.dispose()}};Fne=I([m(2,ge),m(3,X),m(4,Xe),m(5,_e),m(6,rt),m(7,Kt),m(8,Te)],Fne);var Wne=class{constructor(i,e,t){this._isLoadingMore=i;this._loadMoreCallback=e;this._configurationService=t}static{this.TEMPLATE_ID="historyItemLoadMore"}get templateId(){return Wne.TEMPLATE_ID}renderTemplate(i){let e=M(i,_(".history-item-load-more")),t=M(e,_(".graph-placeholder")),o=M(e,_(".history-item-placeholder")),n=new Bc(o,{supportIcons:!0});return{element:e,graphPlaceholder:t,historyItemPlaceholderContainer:o,historyItemPlaceholderLabel:n,elementDisposables:new N,disposables:n}}renderElement(i,e,t){t.graphPlaceholder.textContent="",t.graphPlaceholder.style.width=`${Eh*(i.element.graphColumns.length+1)}px`,t.graphPlaceholder.appendChild(pvi(i.element.graphColumns));let o=this._configurationService.getValue("scm.graph.pageOnScroll")===!0;t.historyItemPlaceholderContainer.classList.toggle("shimmer",o),o?(t.historyItemPlaceholderLabel.setLabel(""),this._loadMoreCallback()):t.elementDisposables.add(be(n=>{let s=`$(${this._isLoadingMore.read(n)?"loading~spin":"fold-down"})`;t.historyItemPlaceholderLabel.setLabel(d(13760,null,s))}))}renderCompressedElements(i,e,t){throw new Error("Should never happen since node is incompressible")}disposeElement(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.elementDisposables.dispose(),i.disposables.dispose()}};Wne=I([m(2,B)],Wne);var Tlt=class extends rs{constructor(e){super();this._progressService=e}runAction(e,t){return this._progressService.withProgress({location:uA},async()=>await super.runAction(e,t))}};Tlt=I([m(0,Fo)],Tlt);var iWi=class{getWidgetAriaLabel(){return d(13767,null)}getAriaLabel(i){if(Ad(i))return`${i.provider.name} ${i.provider.label}`;if(dN(i)){let e=i.historyItemViewModel.historyItem;return`${Nu(e.message).trim()}${e.author?`, ${e.author}`:""}`}else return""}},oWi=class{getId(i){if(Ad(i))return`repo:${i.provider.id}`;if(dN(i)){let e=i.repository.provider,t=i.historyItemViewModel.historyItem;return`historyItem:${e.id}/${t.id}/${t.parentIds.join(",")}`}else if(U8(i)){let e=i.repository.provider,t=i.historyItemViewModel.historyItem;return`historyItemChange:${e.id}/${t.id}/${t.parentIds.join(",")}/${i.historyItemChange.uri.fsPath}`}else if(bNe(i)){let e=i.context.repository.provider,t=i.context.historyItemViewModel.historyItem;return`historyItemChangeFolder:${e.id}/${t.id}/${t.parentIds.join(",")}/${i.uri.fsPath}`}else{if(vNe(i))return`historyItemLoadMore:${i.repository.provider.id}`;throw new Error("Invalid tree element")}}},nWi=class{getKeyboardNavigationLabel(i){if(!Ad(i)){if(dN(i))return[i.historyItemViewModel.historyItem.message,i.historyItemViewModel.historyItem.author];if(vNe(i))return"";throw new Error("Invalid tree element")}}getCompressedNodeKeyboardNavigationLabel(i){return i.map(t=>t.name).join("/")}},rWi=class{isIncompressible(i){return fm.isResourceNode(i)?i.childrenCount===0||!i.parent||!i.parent.parent:!0}},sWi=class extends x{constructor(e){super();this.viewMode=e}async getChildren(e){let t=[];if(e instanceof Ove){let o=await e.getHistoryItems();t.push(...o);let n=e.repository.get(),r=o.at(-1);n&&r&&r.historyItemViewModel.outputSwimlanes.length>0&&t.push({repository:n,graphColumns:r.historyItemViewModel.outputSwimlanes,type:"historyItemLoadMore"})}else if(dN(e)){let o=e.repository.provider.historyProvider.get(),n=e.historyItemViewModel,r=n.historyItem,s,l;if(n.kind==="incoming-changes"||n.kind==="outgoing-changes"){let u=o?.historyItemRef.get(),p=o?.historyItemRemoteRef.get();if(!o||!u||!p)return[];s=n.kind==="incoming-changes"?p.id:u.id,l=await o.resolveHistoryItemRefsCommonAncestor([u.name,p.name])}else if(s=r.id,r.parentIds.length>0)if(r.parentIds[0]===ZF){let u=o?.historyItemRef.get(),p=o?.historyItemRemoteRef.get();if(!o||!u||!p)return[];l=await o.resolveHistoryItemRefsCommonAncestor([u.name,p.name])}else l=r.parentIds[0];let c=await o?.provideHistoryItemChanges(s,l)??[];if(this.viewMode()==="list")t.push(...c.map(u=>({repository:e.repository,historyItemViewModel:e.historyItemViewModel,historyItemChange:u,graphColumns:e.historyItemViewModel.outputSwimlanes,type:"historyItemChangeViewModel"})));else if(this.viewMode()==="tree"){let u=e.repository.provider.rootUri??A.file("/"),p=new fm(e,u);for(let h of c)p.add(h.uri,{repository:e.repository,historyItemViewModel:e.historyItemViewModel,historyItemChange:h,graphColumns:e.historyItemViewModel.outputSwimlanes,type:"historyItemChangeViewModel"});for(let h of p.root.children)t.push(h.element??h)}}else if(fm.isResourceNode(e)&&bNe(e))for(let o of e.children)t.push(o.element&&o.childrenCount===0?o.element:o);return t}hasChildren(e){return e instanceof Ove||dN(e)||bNe(e)&&e.childrenCount>0}},aWi=class{getDragURI(i){let e=this._getTreeElementUri(i);return e?e.toString():null}onDragStart(i,e){if(!e.dataTransfer)return;let t=this._getDragAndDropData(i);t.length!==0&&e.dataTransfer.setData(hc.SCM_HISTORY_ITEM,JSON.stringify(t))}getDragLabel(i,e){if(i.length===1){let t=i[0];return this._getTreeElementLabel(t)}return String(i.length)}onDragOver(i,e,t,o,n){return!1}drop(i,e,t,o,n){}_getDragAndDropData(i){let e=[];for(let t of[...i.context??[],...i.elements]){if(!dN(t))continue;let o=t.repository.provider,n=t.historyItemViewModel.historyItem,r=`$(${R.repo.id})\xA0${o.name}\xA0$(${R.gitCommit.id})\xA0${n.displayId??n.id}`,s=n.parentIds.length>0?n.parentIds[0]:void 0;e.push({name:r,resource:ax.getMultiDiffSourceUri(o,n.id,s,n.displayId),historyItem:n})}return e}_getTreeElementLabel(i){if(dN(i)){let e=i.historyItemViewModel.historyItem;return e.displayId??e.id}}_getTreeElementUri(i){if(dN(i)){let e=i.repository.provider,t=i.historyItemViewModel.historyItem,o=t.parentIds.length>0?t.parentIds[0]:void 0;return ax.getMultiDiffSourceUri(e,t.id,o,t.displayId)}}dispose(){}},Ove=class extends x{constructor(e,t,o,n,r,s){super();this._configurationService=e;this._contextKeyService=t;this._extensionService=o;this._scmService=n;this._scmViewService=r;this._storageService=s;this._selectedRepository=Me(this,"auto");this.onDidChangeHistoryItemsFilter=wc(this);this.isViewModelEmpty=Me(this,!1);this._repositoryState=new Map;this._repositoryFilterState=new Map;this._repositoryFilterState=this._loadHistoryItemsFilterState(),this.viewMode=Me(this,this._getViewMode()),this._extensionService.onWillStop(this._saveHistoryItemsFilterState,this,this._store),this._storageService.onWillSaveState(this._saveHistoryItemsFilterState,this,this._store),this._scmHistoryItemCountCtx=Mc.SCMHistoryItemCount.bindTo(this._contextKeyService),this._scmHistoryViewModeCtx=Mc.SCMHistoryViewMode.bindTo(this._contextKeyService),this._scmHistoryViewModeCtx.set(this.viewMode.get());let l=this._scmService.repositoryCount>0?So(vt.first(this._scmService.repositories)):ui(this,U.once(this._scmService.onDidAddRepository),p=>p),c=ke(p=>{let h=this._selectedRepository.read(p);return h!=="auto"?h:this._scmViewService.activeRepository.read(p)?.repository});this.repository=P$e(this,[l,c]);let u=ui(this,this._scmService.onDidRemoveRepository,p=>p);this._register(be(p=>{let h=u.read(p);h&&(this.repository.read(void 0)===h&&this._selectedRepository.set(vt.first(this._scmService.repositories)??"auto",void 0),this._repositoryState.delete(h))}))}clearRepositoryState(){let e=this.repository.get();e&&this._repositoryState.delete(e)}getHistoryItemsFilter(){let e=this.repository.get();if(!e)return;let t=this._repositoryFilterState.get(G8(e.provider))??"auto";return t==="all"||t==="auto"?t:this._repositoryState.get(e)?.historyItemsFilter}getCurrentHistoryItemTreeElement(){let e=this.repository.get();if(!e)return;let t=this._repositoryState.get(e);if(!t)return;let n=e?.provider.historyProvider.get()?.historyItemRef.get();return t.viewModels.find(r=>r.historyItemViewModel.historyItem.id===n?.revision)}loadMore(e){let t=this.repository.get();if(!t)return;let o=this._repositoryState.get(t);o&&this._repositoryState.set(t,{...o,loadMore:e??!0})}async getHistoryItems(){let e=this.repository.get(),t=e?.provider.historyProvider.get(),o=t?.historyItemRef.get(),n=t?.historyItemRemoteRef.get();if(!e||!t)return this._scmHistoryItemCountCtx.set(0),this.isViewModelEmpty.set(!0,void 0),[];let r=this._repositoryState.get(e);if(!r||r.loadMore!==!1){let s=r?.viewModels.filter(b=>b.historyItemViewModel.kind!=="incoming-changes"&&b.historyItemViewModel.kind!=="outgoing-changes").map(b=>b.historyItemViewModel.historyItem)??[],l=r?.historyItemsFilter??await this._resolveHistoryItemFilter(e,t),c=Bn(this._configurationService.getValue("scm.graph.pageSize"),1,1e3),u=l.map(b=>b.revision??b.id);do s.push(...await t.provideHistoryItems({historyItemRefs:u,limit:c,skip:s.length})??[]);while(typeof r?.loadMore=="string"&&!s.find(b=>b.id===r?.loadMore));let p=o&&n&&r?.mergeBase===void 0?await t.resolveHistoryItemRefsCommonAncestor([o.name,n.name]):r?.mergeBase,h=this._getGraphColorMap(l),g=this._scmViewService.graphShowIncomingChangesConfig.get()&&l.some(b=>b.id===n?.id),f=this._scmViewService.graphShowOutgoingChangesConfig.get()&&l.some(b=>b.id===o?.id),v=Bno(s,h,t.historyItemRef.get(),t.historyItemRemoteRef.get(),t.historyItemBaseRef.get(),g,f,p).map(b=>({repository:e,historyItemViewModel:b,type:"historyItemViewModel"}));r={historyItemsFilter:l,viewModels:v,mergeBase:p,loadMore:!1},this._repositoryState.set(e,r),this._scmHistoryItemCountCtx.set(v.length),this.isViewModelEmpty.set(v.length===0,void 0)}return r.viewModels}setRepository(e){this._selectedRepository.set(e,void 0)}setHistoryItemsFilter(e){let t=this.repository.get();t&&(e!=="auto"?this._repositoryFilterState.set(G8(t.provider),e):this._repositoryFilterState.delete(G8(t.provider)),this._saveHistoryItemsFilterState(),this.onDidChangeHistoryItemsFilter.trigger(void 0))}setViewMode(e){e!==this.viewMode.get()&&(this.viewMode.set(e,void 0),this._scmHistoryViewModeCtx.set(e),this._storageService.store("scm.graphView.viewMode",e,1,0))}_getViewMode(){let e=this._configurationService.getValue("scm.defaultViewMode")==="list"?"list":"tree",t=this._storageService.get("scm.graphView.viewMode",1);return typeof t=="string"&&(e=t),e}_getGraphColorMap(e){let o=this.repository.get()?.provider.historyProvider.get(),n=o?.historyItemRef.get(),r=o?.historyItemRemoteRef.get(),s=o?.historyItemBaseRef.get(),l=new Map;n&&(l.set(n.id,n.color),r&&l.set(r.id,r.color),s&&l.set(s.id,s.color));for(let c of e)l.has(c.id)||l.set(c.id,void 0);return l}async _resolveHistoryItemFilter(e,t){let o=[],n=this._repositoryFilterState.get(G8(e.provider))??"auto";switch(n){case"all":o.push(...await t.provideHistoryItemRefs()??[]);break;case"auto":o.push(...[t.historyItemRef.get(),t.historyItemRemoteRef.get(),t.historyItemBaseRef.get()].filter(r=>!!r));break;default:{let r=(await t.provideHistoryItemRefs(n)??[]).filter(s=>n.some(l=>l===s.id));r.length===0?(o.push(...[t.historyItemRef.get(),t.historyItemRemoteRef.get(),t.historyItemBaseRef.get()].filter(s=>!!s)),this._repositoryFilterState.delete(G8(e.provider))):(o.push(...r),this._repositoryFilterState.set(G8(e.provider),r.map(s=>s.id))),this._saveHistoryItemsFilterState();break}}return o}_loadHistoryItemsFilterState(){try{let e=this._storageService.get("scm.graphView.referencesFilter",1);if(e)return new Map(JSON.parse(e))}catch{}return new Map}_saveHistoryItemsFilterState(){let e=Array.from(this._repositoryFilterState.entries());this._storageService.store("scm.graphView.referencesFilter",JSON.stringify(e),1,0)}dispose(){this._repositoryState.clear(),super.dispose()}};Ove=I([m(0,B),m(1,X),m(2,lt),m(3,rd),m(4,_u),m(5,ce)],Ove);var _lt=class{constructor(i,e){this._quickInputService=i;this._scmViewService=e;this._autoQuickPickItem={label:d(13755,null),description:d(13752,null),repository:"auto"}}async pickRepository(){let i=[this._autoQuickPickItem,{type:"separator"}];return i.push(...this._scmViewService.repositories.map(e=>({label:e.provider.name,description:e.provider.rootUri?.fsPath,iconClass:q.isThemeIcon(e.provider.iconPath)?q.asClassName(e.provider.iconPath):q.asClassName(R.repo),repository:e}))),this._quickInputService.pick(i,{placeHolder:d(13769,null)})}};_lt=I([m(0,Ue),m(1,_u)],_lt);var Dlt=class extends x{constructor(e,t,o){super();this._historyProvider=e;this._historyItemsFilter=t;this._quickInputService=o;this._allQuickPickItem={id:"all",label:d(13753,null),description:d(13754,null),historyItemRef:"all"};this._autoQuickPickItem={id:"auto",label:d(13755,null),description:d(13756,null),historyItemRef:"auto"}}async pickHistoryItemRef(){let e=this._quickInputService.createQuickPick({useSeparators:!0});this._store.add(e),e.placeholder=d(13768,null),e.canSelectMany=!0,e.hideCheckAll=!0,e.busy=!0,e.show();let t=await this._createQuickPickItems(),o=[];if(this._historyItemsFilter==="all")o.push(this._allQuickPickItem);else if(this._historyItemsFilter==="auto")o.push(this._autoQuickPickItem);else{let n=0;for(;n<t.length;){if(t[n].type==="separator"){n++;continue}if(this._historyItemsFilter.some(r=>r.id===t[n].id)){let r=t.splice(n,1);o.push(...r)}else n++}t.splice(2,0,{type:"separator"},...o)}return e.items=t,e.selectedItems=o,e.busy=!1,new Promise(n=>{this._store.add(e.onDidChangeSelection(r=>{let{added:s}=lP(o,r,(l,c)=>Hl(l.id??"",c.id??""));s.length>0&&(s[0].historyItemRef==="all"||s[0].historyItemRef==="auto"?e.selectedItems=[s[0]]:e.selectedItems=[...e.selectedItems.filter(l=>l.historyItemRef!=="all"&&l.historyItemRef!=="auto")]),o=[...e.selectedItems]})),this._store.add(e.onDidAccept(()=>{o.length===0?n(void 0):o.length===1&&o[0].historyItemRef==="all"?n("all"):o.length===1&&o[0].historyItemRef==="auto"?n("auto"):n(o.map(r=>r.historyItemRef.id)),e.hide()})),this._store.add(e.onDidHide(()=>{n(void 0),this.dispose()}))})}async _createQuickPickItems(){let e=[this._allQuickPickItem,this._autoQuickPickItem],t=await this._historyProvider.provideHistoryItemRefs()??[],o=Jg(t,(n,r)=>Hl(n.category??"",r.category??""));for(let n of o)n.length!==0&&(e.push({type:"separator",label:n[0].category}),e.push(...n.map(r=>({id:r.id,label:r.name,description:r.description,iconClass:q.isThemeIcon(r.icon)?q.asClassName(r.icon):void 0,historyItemRef:r}))));return e}};Dlt=I([m(2,Ue)],Dlt);var eUe=class extends Gs{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super({...e,titleMenuId:D.SCMHistoryTitle,showActions:1},u,c,l,g,h,p,f,v,b);this._editorService=t;this._instantiationService=o;this._menuService=n;this._progressService=r;this._scmViewService=s;this._repositoryIsLoadingMore=Me(this,!1);this._repositoryOutdated=Me(this,!1);this._visibilityDisposables=new N;this._treeOperationSequencer=new rm;this._treeLoadMoreSequencer=new rm;this._refreshThrottler=new gu;this._updateChildrenThrottler=new gu;this._contextMenuDisposables=new me;this._scmProviderCtx=Mc.SCMProvider.bindTo(this.scopedContextKeyService),this._scmCurrentHistoryItemRefHasRemote=Mc.SCMCurrentHistoryItemRefHasRemote.bindTo(this.scopedContextKeyService),this._scmCurrentHistoryItemRefHasBase=Mc.SCMCurrentHistoryItemRefHasBase.bindTo(this.scopedContextKeyService),this._scmCurrentHistoryItemRefInFilter=Mc.SCMCurrentHistoryItemRefInFilter.bindTo(this.scopedContextKeyService),this._actionRunner=this.instantiationService.createInstance(Tlt),this._register(this._actionRunner),this._register(this._refreshThrottler),this._register(this._updateChildrenThrottler)}renderHeaderTitle(e){super.renderHeaderTitle(e,this.title);let t=ct("div.scm-graph-view-badge-container",[ct("div.scm-graph-view-badge.monaco-count-badge.long@badge")]);t.badge.textContent="Outdated",e.appendChild(t.root),this._register(be(o=>{let n=this._repositoryOutdated.read(o);t.root.style.display=n?"":"none",n&&o.store.add(this.hoverService.setupDelayedHover(t.root,{appearance:{compact:!0,showPointer:!0},content:new Ie(d(13770,null,"$(refresh)"),{supportThemeIcons:!0}),position:{hoverPosition:2}}))}))}renderBody(e){super.renderBody(e),this._treeContainer=M(e,_(".scm-view.scm-history-view.show-file-icons")),this._treeContainer.classList.add("file-icon-themable-tree"),this._createTree(this._treeContainer),this.onDidChangeBodyVisibility(async t=>{if(!t){this._visibilityDisposables.clear();return}this._treeViewModel=this.instantiationService.createInstance(Ove),this._visibilityDisposables.add(this._treeViewModel);let o=ke(this,s=>this._treeViewModel.repository.read(s)?.provider.historyProvider.read(s)?.historyItemRef.read(s)!==void 0?!0:void 0);await Wf(o),await this._progressService.withProgress({location:this.id},async()=>{await this._treeOperationSequencer.queue(async()=>{await this._tree.setInput(this._treeViewModel),this._tree.scrollTop=0})}),this._visibilityDisposables.add(be(s=>{this._treeViewModel.isViewModelEmpty.read(s),this._onDidChangeViewWelcomeState.fire()})),this._visibilityDisposables.add(Vs(this._scmViewService.graphShowIncomingChangesConfig,async()=>{await this.refresh()})),this._visibilityDisposables.add(Vs(this._scmViewService.graphShowOutgoingChangesConfig,async()=>{await this.refresh()}));let n=!0;this._visibilityDisposables.add(be(s=>{let l=this._treeViewModel.repository.read(s),c=l?.provider.historyProvider.read(s);if(!l||!c)return;let u=ke(p=>c.historyItemRef.read(p)?.id);s.store.add(Vs(u,async p=>{await this.refresh(),this._scmCurrentHistoryItemRefInFilter.set(this._isCurrentHistoryItemInFilter(p))})),s.store.add(Vs(c.historyItemRefChanges,p=>{if(p.silent){if(this._tree.scrollTop===0){this.refresh();return}this._repositoryOutdated.set(!0,void 0);return}this.refresh()})),s.store.add(Vs(this._treeViewModel.onDidChangeHistoryItemsFilter,async()=>{await this.refresh(),this._scmCurrentHistoryItemRefInFilter.set(this._isCurrentHistoryItemInFilter(u.read(void 0)))})),s.store.add(be(p=>{this._scmCurrentHistoryItemRefHasRemote.set(!!c.historyItemRemoteRef.read(p))})),s.store.add(be(p=>{this._scmCurrentHistoryItemRefHasBase.set(!!c.historyItemBaseRef.read(p))})),s.store.add(Vs(this._treeViewModel.viewMode,async()=>{await this._updateChildren()})),this._scmProviderCtx.set(l.provider.providerId),this._scmCurrentHistoryItemRefInFilter.set(this._isCurrentHistoryItemInFilter(u.read(void 0))),n||this.refresh(),n=!1}));let r=ui(this.themeService.onDidFileIconThemeChange,()=>this.themeService.getFileIconTheme());this._visibilityDisposables.add(be(s=>{let l=r.read(s),c=this._treeViewModel.viewMode.read(s);this._updateIndentStyles(l,c)}))},this,this._store)}layoutBody(e,t){super.layoutBody(e,t),this._tree.layout(e,t)}getActionRunner(){return this._actionRunner}getActionsContext(){return this._treeViewModel?.repository.get()?.provider}createActionViewItem(e,t){if(e.id===STo){let o=this._treeViewModel?.repository.get();if(o)return new Z0i(o,e,t)}else if(e.id===ITo){let o=this._treeViewModel?.repository.get(),n=this._treeViewModel?.getHistoryItemsFilter();if(o&&n)return new eWi(o,n,e,t)}return super.createActionViewItem(e,t)}focus(){super.focus();let e=new KeyboardEvent("keydown");this._tree.focusFirst(e),this._tree.domFocus()}shouldShowWelcome(){return this._treeViewModel?.isViewModelEmpty.get()===!0}async refresh(){return this._refreshThrottler.queue(e=>this._refresh(e))}async _refresh(e){e.isCancellationRequested||(this._treeViewModel.clearRepositoryState(),await this._updateChildren(),!e.isCancellationRequested&&(this.updateActions(),this._repositoryOutdated.set(!1,void 0),this._tree.scrollTop=0))}async pickRepository(){let t=await this._instantiationService.createInstance(_lt).pickRepository();t&&this._treeViewModel.setRepository(t.repository)}async pickHistoryItemRef(){let t=this._treeViewModel.repository.get()?.provider.historyProvider.get(),o=this._treeViewModel.getHistoryItemsFilter();if(!t||!o)return;let r=await this._instantiationService.createInstance(Dlt,t,o).pickHistoryItemRef();r&&this._treeViewModel.setHistoryItemsFilter(r)}async revealCurrentHistoryItem(){let e=this._treeViewModel.repository.get(),o=e?.provider.historyProvider.get()?.historyItemRef.get();if(!e||!o?.id||!o?.revision||!this._isCurrentHistoryItemInFilter(o.id))return;let n=()=>{let r=this._treeViewModel.getCurrentHistoryItemTreeElement();return r&&this._tree.hasNode(r)?(this._tree.reveal(r,.5),this._tree.setSelection([r]),this._tree.setFocus([r]),!0):!1};n()||(await this._loadMore(o.revision),n())}setViewMode(e){this._treeViewModel.setViewMode(e)}_createTree(e){this._treeIdentityProvider=new oWi;let t=this.instantiationService.createInstance(Nl,{onDidChangeVisibility:this.onDidChangeBodyVisibility});this._register(t),this._treeDataSource=this.instantiationService.createInstance(sWi,()=>this._treeViewModel.viewMode.get()),this._register(this._treeDataSource);let o=hr("scm.compactFolders",!0,this.configurationService);this._tree=this.instantiationService.createInstance(sy,"SCM History Tree",e,new tWi,new rWi,[this.instantiationService.createInstance(One,this.viewDescriptorService.getViewLocationById(this.id)),this.instantiationService.createInstance(Fne,()=>this._treeViewModel.viewMode.get(),t),this.instantiationService.createInstance(Wne,this._repositoryIsLoadingMore,()=>this._loadMore())],this._treeDataSource,{accessibilityProvider:new iWi,identityProvider:this._treeIdentityProvider,collapseByDefault:n=>!bNe(n),compressionEnabled:o.get(),dnd:new aWi,keyboardNavigationLabelProvider:new nWi,horizontalScrolling:!1,multipleSelectionSupport:!1,twistieAdditionalCssClass:n=>dN(n)||vNe(n)?"force-no-twistie":void 0}),this._register(this._tree),this._tree.onDidOpen(this._onDidOpen,this,this._store),this._tree.onContextMenu(this._onContextMenu,this,this._store)}_isCurrentHistoryItemInFilter(e){if(!e)return!1;let t=this._treeViewModel.getHistoryItemsFilter();return t==="all"||t==="auto"?!0:Array.isArray(t)&&!!t.find(o=>o.id===e)}async _onDidOpen(e){if(e.element)if(U8(e.element)){let t=e.element.historyItemChange,o=e.element.historyItemViewModel.historyItem,n=o.id===ZF?d(13758,null):o.id===YJ?d(13763,null):o.displayId??o.id,r=o.parentIds.length>0?o.parentIds[0]:void 0,s=r&&o.displayId?r.substring(0,o.displayId.length):r;if(t.originalUri&&t.modifiedUri){let l=`${jo(t.originalUri.fsPath)} (${s})`,c=`${jo(t.modifiedUri.fsPath)} (${n})`,u=`${l} \u2194 ${c}`;await this._editorService.openEditor({label:u,original:{resource:t.originalUri},modified:{resource:t.modifiedUri},options:e.editorOptions})}else t.modifiedUri?await this._editorService.openEditor({label:`${jo(t.modifiedUri.fsPath)} (${n})`,resource:t.modifiedUri,options:e.editorOptions}):t.originalUri&&await this._editorService.openEditor({label:`${jo(t.originalUri.fsPath)} (${s})`,resource:t.originalUri,options:e.editorOptions})}else vNe(e.element)&&(this.configurationService.getValue("scm.graph.pageOnScroll")===!0||(this._loadMore(),this._tree.setSelection([])));else return}_onContextMenu(e){let t=e.element;if(dN(t)){if(t.historyItemViewModel.kind==="incoming-changes"||t.historyItemViewModel.kind==="outgoing-changes")return;this._contextMenuDisposables.value=new N;let n=t.repository.provider.historyProvider.get()?.historyItemRef.get(),r=t.historyItemViewModel.historyItem,s=ve.getMenuItems(D.SCMHistoryItemRefContext).filter(u=>gE(u));if(s.length>0&&t.historyItemViewModel.historyItem.references?.length){let u=new Map;for(let p of t.historyItemViewModel.historyItem.references){let h=this.scopedContextKeyService.createOverlay([["scmHistoryItemRef",p.id]]),g=this._menuService.getMenuActions(D.SCMHistoryItemRefContext,h);for(let f of g.flatMap(v=>v[1]))u.has(f.id)||u.set(f.id,[]),u.get(f.id).push(p)}for(let p of s){let h=p.command.id;if(u.has(h)){this._contextMenuDisposables.value.add(ve.appendMenuItem(D.SCMHistoryItemContext,{title:p.command.title,submenu:D.for(h),group:p?.group,order:p?.order}));for(let g of u.get(h)??[])this._contextMenuDisposables.value.add(W(class extends K{constructor(){super({id:`${h}.${g.id}`,title:g.name,menu:{id:D.for(h),group:g.category}})}run(f,...v){f.get(ge).executeCommand(h,...v,g.id)}}))}}}let l=this.scopedContextKeyService.createOverlay([["scmHistoryItemHasCurrentHistoryItemRef",r.references?.find(u=>u.id===n?.id)!==void 0]]),c=this._menuService.getMenuActions(D.SCMHistoryItemContext,l,{arg:t.repository.provider,shouldForwardArgs:!0}).filter(u=>u[0]!=="inline");this.contextMenuService.showContextMenu({contextKeyService:this.scopedContextKeyService,getAnchor:()=>e.anchor,getActions:()=>tu(c),getActionsContext:()=>t.historyItemViewModel.historyItem})}else if(U8(t)){let o=this._menuService.getMenuActions(D.SCMHistoryItemChangeContext,this.scopedContextKeyService,{arg:t.historyItemViewModel.historyItem,shouldForwardArgs:!0}).filter(n=>n[0]!=="inline");this.contextMenuService.showContextMenu({contextKeyService:this.scopedContextKeyService,getAnchor:()=>e.anchor,getActions:()=>tu(o),getActionsContext:()=>t.historyItemChange})}}async _loadMore(e){return this._treeLoadMoreSequencer.queue(async()=>{this._repositoryIsLoadingMore.get()||(this._repositoryIsLoadingMore.set(!0,void 0),this._treeViewModel.loadMore(e),await this._updateChildren(),this._repositoryIsLoadingMore.set(!1,void 0))})}_updateChildren(){return this._updateChildrenThrottler.queue(()=>this._treeOperationSequencer.queue(async()=>{await this._progressService.withProgress({location:this.id,delay:100},async()=>{await this._tree.updateChildren(void 0,void 0,void 0,{})})}))}_updateIndentStyles(e,t){this._treeContainer.classList.toggle("list-view-mode",t==="list"),this._treeContainer.classList.toggle("tree-view-mode",t==="tree"),this._treeContainer.classList.toggle("align-icons-and-twisties",t==="list"&&e.hasFileIcons||e.hasFileIcons&&!e.hasFolderIcons),this._treeContainer.classList.toggle("hide-arrows",t==="tree"&&e.hidesExplorerArrows===!0)}dispose(){this._contextMenuDisposables.dispose(),this._visibilityDisposables.dispose(),super.dispose()}};eUe=I([m(1,ee),m(2,F),m(3,Kt),m(4,Fo),m(5,_u),m(6,B),m(7,Xe),m(8,_e),m(9,F),m(10,Bi),m(11,X),m(12,Je),m(13,Le),m(14,nt)],eUe);var pWi=new Y("dirtyDiffVisible",!1),Llt=class extends kz{constructor(e,t,o,n){let r={...WE},s=o.getColorTheme(),l=s.getColor(Ho),u=s.getColor(JV)?.makeOpaque(l)??l;r.selectBackground=u.lighten(.6).toString();super(null,e,[],0,t,r,{ariaLabel:d(13617,null),useCustomDrawn:!oI(n)});this.optionsItems=[]}setSelection(e,t){this.optionsItems=e.map(n=>({providerId:n.id,text:n.label}));let o=this.optionsItems.findIndex(n=>n.providerId===t);this.setOptions(this.optionsItems,o)}getActionContext(e,t){return this.optionsItems[t]}render(e){super.render(e),this.setFocusable(!0)}};Llt=I([m(1,Wn),m(2,Le),m(3,B)],Llt);var lWi=class a extends it{constructor(e){super(a.ID,a.LABEL,void 0,void 0);this.callback=e}static{this.ID="quickDiff.base.switch"}static{this.LABEL=d(13616,null)}async run(e){return this.callback(e)}},cWi=class extends rs{runAction(i,e){return i instanceof Lo?i.run(...e):super.runAction(i,e)}},Fve=class extends it{constructor(i,e,t,o,n){let r=o.appendKeybinding(e.label,e.id);super(e.id,r,t),this.instantiationService=n,this.action=e,this.editor=i}run(){return Promise.resolve(this.instantiationService.invokeFunction(i=>this.action.run(i,this.editor,null)))}};Fve=I([m(3,_e),m(4,F)],Fve);var Rlt=class extends GE{constructor(e,t,o,n,r,s,l){super(e,{isResizeable:!0,frameWidth:1,keepEditorSelection:!0,className:"dirty-diff"},n);this.model=t;this.themeService=o;this.menuService=r;this.contextKeyService=s;this.quickDiffService=l;this._index=0;this._providerId="";this.height=void 0;this._disposables.add(o.onDidColorThemeChange(this._applyTheme,this)),this._applyTheme(o.getColorTheme()),vt.isEmpty(this.model.originalTextModels)||(s=s.createOverlay([["originalResourceScheme",vt.first(this.model.originalTextModels)?.uri.scheme],["originalResourceSchemes",vt.map(this.model.originalTextModels,c=>c.uri.scheme)]])),this.create(),e.hasModel()?this.title=He(e.getModel().uri):this.title="",this.setTitle(this.title)}get providerId(){return this._providerId}get index(){return this._index}get visibleRange(){let e=this.diffEditor.getModifiedEditor().getVisibleRanges();return e.length>=0?e[0]:void 0}showChange(e,t=!0){let o=this.model.changes[e],n=o.change;if(this._index=e,this.contextKeyService.createKey("originalResource",this.model.changes[e].original.toString()),this.contextKeyService.createKey("originalResourceScheme",this.model.changes[e].original.scheme),this.updateActions(),this.change=n,this._providerId=o.providerId,vt.isEmpty(this.model.originalTextModels))return;U.once(this.diffEditor.onDidUpdateDiff)(()=>setTimeout(()=>this.revealChange(n),0));let s=this.model.getDiffEditorModel(o.original);if(!s)return;this.diffEditor.setModel(s);let l=new ye(L9e(n),1),c=this.editor.getOption(75),u=this.editor.getLayoutInfo().height,p=Math.floor(u/c),h=Math.min(jto(n)+2+6,Math.floor(p/3));this.renderTitle(),this.updateDropdown();let g=D9e(n),f=$to(this.themeService.getColorTheme(),g);this.style({frameColor:f,arrowColor:f});let v=[],b=e;for(let S of this.model.changes)S.providerId===this.model.changes[this._index].providerId&&(v.push(S.change),o===S&&(b=v.length-1));this._actionbarWidget.context=[s.modified.uri,v,b],t&&(this.show(l,h+1/c),this.editor.setPosition(l),this.editor.focus())}renderTitle(){let e=this.model.quickDiffChanges.get(this._providerId),t=e.indexOf(this._index),o;if(this.shouldUseDropdown())o=this.model.changes.length>1?d(13615,null,t+1,e.length):d(13614,null,t+1,e.length),this.dropdownContainer.style.display="inherit";else{let n=this.model.quickDiffs.find(r=>r.id===this._providerId)?.label??"";o=this.model.changes.length>1?d(13608,null,n,t+1,e.length):d(13607,null,n,t+1,e.length),this.dropdownContainer.style.display="none"}this.setTitle(this.title,o)}switchQuickDiff(e){let t=e?.providerId;if(t===this.model.changes[this._index].providerId)return;let o=this._index<this.model.changes.length-1?this._index+1:0;for(let s=o;s!==this._index;s<this.model.changes.length-1?s++:s=0)if(this.model.changes[s].providerId===t){o=s;break}let n=this._index>0?this._index-1:this.model.changes.length-1;for(let s=n;s!==this._index;s>0?s--:s=this.model.changes.length-1)if(this.model.changes[s].providerId===t){n=s;break}let r=Math.abs(this.model.changes[o].change.modifiedEndLineNumber-this.model.changes[this._index].change.modifiedEndLineNumber)<Math.abs(this.model.changes[n].change.modifiedEndLineNumber-this.model.changes[this._index].change.modifiedEndLineNumber)?o:n;this.showChange(r,!1)}shouldUseDropdown(){return this.getQuickDiffsContainingChange().length>1}updateActions(){if(!this._actionbarWidget)return;let e=this.instantiationService.createInstance(Fve,this.editor,new h4t(this.editor),q.asClassName(f6i)),t=this.instantiationService.createInstance(Fve,this.editor,new g4t(this.editor),q.asClassName(v6i));this._disposables.add(e),this._disposables.add(t),this.menu&&this.menu.dispose(),this.menu=this.menuService.createMenu(D.SCMChangeContext,this.contextKeyService);let o=jm(this.menu.getActions({shouldForwardArgs:!0}));this._actionbarWidget.clear(),this._actionbarWidget.push(o.reverse(),{label:!1,icon:!0}),this._actionbarWidget.push([t,e],{label:!1,icon:!0}),this._actionbarWidget.push(this._disposables.add(new it("peekview.close",d(13609,null),q.asClassName(R.close),!0,()=>this.dispose())),{label:!1,icon:!0})}updateDropdown(){let e=this.getQuickDiffsContainingChange();this.dropdown?.setSelection(e,this._providerId)}getQuickDiffsContainingChange(){let e=this.model.changes[this._index],t=this.model.changes.filter(o=>e.change2.modified.intersectsOrTouches(o.change2.modified)).map(o=>o.providerId);return this.model.quickDiffs.filter(o=>t.includes(o.id)&&this.quickDiffService.isQuickDiffProviderVisible(o.id))}_fillHead(e){super._fillHead(e,!0);let t=new lWi(o=>this.switchQuickDiff(o));this._disposables.add(t),this.dropdownContainer=KS(this._titleElement,_(".dropdown")),this.dropdown=this.instantiationService.createInstance(Llt,t),this.dropdown.render(this.dropdownContainer)}_getActionBarOptions(){let e=new cWi;return this._disposables.add(e),this._disposables.add(e.onDidRun(t=>{!(t.action instanceof Fve)&&!t.error&&this.dispose()})),{...super._getActionBarOptions(),actionRunner:e}}_fillBody(e){let t={diffAlgorithm:"advanced",fixedOverflowWidgets:!0,ignoreTrimWhitespace:!1,minimap:{enabled:!1},readOnly:!1,renderGutterMenu:!1,renderIndicators:!1,renderOverviewRuler:!1,renderSideBySide:!1,scrollbar:{verticalScrollbarSize:14,horizontal:"auto",useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1},scrollBeyondLastLine:!1,stickyScroll:{enabled:!1}};this.diffEditor=this.instantiationService.createInstance(dL,e,t,{},this.editor),this._disposables.add(this.diffEditor)}_onWidth(e){typeof this.height>"u"||this.diffEditor.layout({height:this.height,width:e})}_doLayoutBody(e,t){super._doLayoutBody(e,t),this.diffEditor.layout({height:e,width:t}),typeof this.height>"u"&&this.change&&this.revealChange(this.change),this.height=e}revealChange(e){let t,o;e.modifiedEndLineNumber===0?(t=e.modifiedStartLineNumber,o=e.modifiedStartLineNumber+1):e.originalEndLineNumber>0?(t=e.modifiedStartLineNumber-1,o=e.modifiedEndLineNumber+1):(t=e.modifiedStartLineNumber,o=e.modifiedEndLineNumber),this.diffEditor.revealLinesInCenter(t,o,1)}_applyTheme(e){let t=e.getColor(K_)||We.transparent;this.style({arrowColor:t,frameColor:t,headerBackgroundColor:e.getColor(JV)||We.transparent,primaryHeadingColor:e.getColor(eF),secondaryHeadingColor:e.getColor(tF)})}revealRange(e){this.editor.revealLineInCenterIfOutsideViewport(e.endLineNumber,0)}hasFocus(){return this.diffEditor.hasTextFocus()}toggleFocus(){this.diffEditor.hasTextFocus()?this.editor.focus():this.diffEditor.focus()}dispose(){this.dropdown?.dispose(),this.menu?.dispose(),super.dispose()}};Rlt=I([m(2,Le),m(3,F),m(4,Kt),m(5,X),m(6,mT)],Rlt);var NN=class extends x{constructor(e,t,o,n,r){super();this.editor=e;this.configurationService=o;this.quickDiffModelService=n;this.instantiationService=r;this.model=null;this.widget=null;this.session=x.None;this.mouseDownInfo=null;this.enabled=!1;this.gutterActionDisposables=new N;if(this.enabled=!t.getContextKeyValue("isInDiffEditor"),this.stylesheet=Cr(void 0,void 0,this._store),this.enabled){this.isQuickDiffVisible=pWi.bindTo(t),this._register(e.onDidChangeModel(()=>this.close()));let s=U.filter(o.onDidChangeConfiguration,l=>l.affectsConfiguration("scm.diffDecorationsGutterAction"));this._register(s(this.onDidChangeGutterAction,this)),this.onDidChangeGutterAction()}}static{this.ID="editor.contrib.quickdiff"}static get(e){return e.getContribution(NN.ID)}onDidChangeGutterAction(){let e=this.configurationService.getValue("scm.diffDecorationsGutterAction");this.gutterActionDisposables.clear(),e==="diff"?(this.gutterActionDisposables.add(this.editor.onMouseDown(t=>this.onEditorMouseDown(t))),this.gutterActionDisposables.add(this.editor.onMouseUp(t=>this.onEditorMouseUp(t))),this.stylesheet.textContent=`
				.monaco-editor .dirty-diff-glyph {
					cursor: pointer;
				}

				.monaco-editor .margin-view-overlays .dirty-diff-glyph:hover::before {
					height: 100%;
					width: 6px;
					left: -6px;
				}

				.monaco-editor .margin-view-overlays .dirty-diff-deleted:hover::after {
					bottom: 0;
					border-top-width: 0;
					border-bottom-width: 0;
				}
			`):this.stylesheet.textContent=""}canNavigate(){return!this.widget||this.widget?.index===-1||!!this.model&&this.model.changes.length>1}refresh(){this.widget?.showChange(this.widget.index,!1)}toggleFocus(){this.widget&&this.widget.toggleFocus()}next(e){if(!this.assertWidget()||!this.widget||!this.model)return;let t;if(this.editor.hasModel()&&(typeof e=="number"||!this.widget.providerId))t=this.model.findNextClosestChange(typeof e=="number"?e:this.editor.getPosition().lineNumber,!0,this.widget.providerId);else{let o=this.model.quickDiffChanges.get(this.widget.providerId)??this.model.quickDiffChanges.values().next().value,n=o.findIndex(r=>r===this.widget.index);t=o[bV(n+1,o.length)]}this.widget.showChange(t)}previous(e){if(!this.assertWidget()||!this.widget||!this.model)return;let t;if(this.editor.hasModel()&&(typeof e=="number"||!this.widget.providerId))t=this.model.findPreviousClosestChange(typeof e=="number"?e:this.editor.getPosition().lineNumber,!0,this.widget.providerId);else{let o=this.model.quickDiffChanges.get(this.widget.providerId)??this.model.quickDiffChanges.values().next().value,n=o.findIndex(r=>r===this.widget.index);t=o[bV(n-1,o.length)]}this.widget.showChange(t)}close(){this.session.dispose(),this.session=x.None}assertWidget(){if(!this.enabled)return!1;if(this.widget)return!this.model||this.model.changes.length===0?(this.close(),!1):!0;let e=this.editor.getModel();if(!e)return!1;let t=this.quickDiffModelService.createQuickDiffModelReference(e.uri);if(!t)return!1;if(t.object.changes.length===0)return t.dispose(),!1;this.model=t.object,this.widget=this.instantiationService.createInstance(Rlt,this.editor,this.model),this.isQuickDiffVisible.set(!0);let o=new N;return o.add(U.once(this.widget.onDidClose)(this.close,this)),U.chain(this.model.onDidChange,r=>r.filter(s=>s.diff.length>0).map(s=>s.diff))(this.onDidModelChange,this,o),o.add(t),o.add(this.widget),o.add(Z(()=>{this.model=null,this.widget=null,this.isQuickDiffVisible.set(!1),this.editor.focus()})),this.session=o,!0}onDidModelChange(e){if(!(!this.model||!this.widget||this.widget.hasFocus())){for(let t of e)if(t.start<=this.widget.index){this.next();return}this.refresh()}}onEditorMouseDown(e){this.mouseDownInfo=null;let t=e.target.range;if(!t||!e.event.leftButton||e.target.type!==4||!e.target.element||e.target.element.className.indexOf("dirty-diff-glyph")<0)return;let o=e.target.detail,n=e.target.element.offsetLeft,r=o.offsetX-n;r<-3||r>3||(this.mouseDownInfo={lineNumber:t.startLineNumber})}onEditorMouseUp(e){if(!this.mouseDownInfo)return;let{lineNumber:t}=this.mouseDownInfo;this.mouseDownInfo=null;let o=e.target.range;if(!o||o.startLineNumber!==t||e.target.type!==4)return;let n=this.editor.getModel();if(!n)return;let r=this.quickDiffModelService.createQuickDiffModelReference(n.uri);if(r)try{let s=r.object.changes.findIndex(l=>Qto(t,l.change));if(s<0)return;s===this.widget?.index?this.close():this.next(t)}finally{r.dispose()}}dispose(){this.gutterActionDisposables.dispose(),super.dispose()}};NN=I([m(1,X),m(2,B),m(3,qF),m(4,F)],NN);var h4t=class extends Di{constructor(e){super({id:"editor.action.dirtydiff.previous",label:L(13619,"Show Previous Change"),precondition:bS.toNegated(),kbOpts:{kbExpr:pe.editorTextFocus,primary:1597,weight:100}});this.outerEditor=e}run(e){let t=this.outerEditor??tUe(e);if(!t)return;let o=NN.get(t);o&&o.canNavigate()&&o.previous()}};ni(h4t);var g4t=class extends Di{constructor(e){super({id:"editor.action.dirtydiff.next",label:L(13618,"Show Next Change"),precondition:bS.toNegated(),kbOpts:{kbExpr:pe.editorTextFocus,primary:573,weight:100}});this.outerEditor=e}run(e){let t=this.outerEditor??tUe(e);if(!t)return;let o=NN.get(t);o&&o.canNavigate()&&o.next()}};ni(g4t);var dWi=class extends Di{constructor(){super({id:"workbench.action.editor.previousChange",label:L(13613,"Go to Previous Change"),precondition:C.and(bS.toNegated(),a4t.notEqualsTo(0)),kbOpts:{kbExpr:pe.editorTextFocus,primary:1599,weight:100}})}async run(i){let e=tUe(i),t=i.get(lr),o=i.get(Oi),n=i.get(qt),r=i.get(qF);if(!e||!e.hasModel())return;let s=r.createQuickDiffModelReference(e.getModel().uri);try{if(!s||s.object.changes.length===0)return;let l=e.getPosition().lineNumber,c=s.object.findPreviousClosestChange(l,!1),u=s.object.changes[c];await wTo(u.change,t),yTo(u.change,e,o,n)}finally{s?.dispose()}}};ni(dWi);var uWi=class extends Di{constructor(){super({id:"workbench.action.editor.nextChange",label:L(13612,"Go to Next Change"),precondition:C.and(bS.toNegated(),a4t.notEqualsTo(0)),kbOpts:{kbExpr:pe.editorTextFocus,primary:575,weight:100}})}async run(i){let e=i.get(lr),t=tUe(i),o=i.get(Oi),n=i.get(qt),r=i.get(qF);if(!t||!t.hasModel())return;let s=r.createQuickDiffModelReference(t.getModel().uri);try{if(!s||s.object.changes.length===0)return;let l=t.getPosition().lineNumber,c=s.object.findNextClosestChange(l,!1),u=s.object.changes[c].change;await wTo(u,e),yTo(u,t,o,n)}finally{s?.dispose()}}};ni(uWi);ve.appendMenuItem(D.MenubarGoMenu,{group:"7_change_nav",command:{id:"editor.action.dirtydiff.next",title:d(13610,null)},order:1});ve.appendMenuItem(D.MenubarGoMenu,{group:"7_change_nav",command:{id:"editor.action.dirtydiff.previous",title:d(13611,null)},order:2});Ct.registerCommandAndKeybindingRule({id:"closeQuickDiff",weight:150,primary:9,secondary:[1033],when:C.and(pWi),handler:a=>{let i=tUe(a);if(!i)return;let e=NN.get(i);e&&e.close()}});Ct.registerCommandAndKeybindingRule({id:"toggleQuickDiffWidgetFocus",weight:100,primary:Vi(2089,60),when:pWi,handler:a=>{let i=tUe(a);if(!i)return;let e=NN.get(i);e&&e.toggleFocus()}});function yTo(a,i,e,t){let o=new ye(a.modifiedStartLineNumber,1);i.setPosition(o),i.revealPositionInCenter(o),e.isScreenReaderOptimized()&&(i.setSelection({startLineNumber:a.modifiedStartLineNumber,startColumn:0,endLineNumber:a.modifiedStartLineNumber,endColumn:Number.MAX_VALUE}),t.getActiveCodeEditor()?.writeScreenReaderContent("diff-navigation"))}async function wTo(a,i){switch(D9e(a)){case 1:i.playSignal($o.diffLineInserted,{allowManyInParallel:!0,source:"quickDiffDecoration"});break;case 2:i.playSignal($o.diffLineDeleted,{allowManyInParallel:!0,source:"quickDiffDecoration"});break;case 0:i.playSignal($o.diffLineModified,{allowManyInParallel:!0,source:"quickDiffDecoration"});break}}function tUe(a){let i=a.get(qt).listDiffEditors();for(let e of i)if(e.hasTextFocus()&&e instanceof dL)return e.getParentEditor();return Rxe(a)}var f4t=class{constructor(){this.name="scm";this.type="help";this.priority=100;this.when=C.or(C.and(C.equals("activeViewlet","workbench.view.scm"),kB),C.equals(ql.key,xRt),C.equals(ql.key,Jf),C.equals(ql.key,uA))}getProvider(i){let e=i.get(ge),t=i.get(_u),o=i.get($t);return new Mlt(e,t,o)}},Mlt=class extends x{constructor(e,t,o){super();this._commandService=e;this._scmViewService=t;this._viewsService=o;this.id="scm";this.verbositySettingKey="accessibility.verbosity.sourceControl";this.options={type:"help"};this._focusedView=this._viewsService.getFocusedViewName()}onClose(){switch(this._focusedView){case"Source Control":this._commandService.executeCommand("workbench.scm");break;case"Source Control Repositories":this._commandService.executeCommand("workbench.scm.repositories");break;case"Source Control Graph":this._commandService.executeCommand("workbench.scm.history");break;default:this._commandService.executeCommand("workbench.view.scm")}}provideContent(){let e=[];if(this._scmViewService.visibleRepositories.length>1){let o=this._scmViewService.visibleRepositories.map(n=>n.provider.name).join(", ");e.push(d(13726,null,o))}let t=this._scmViewService.focusedRepository;if(t){e.push(d(13727,null,t.provider.name));let o=t.provider.historyProvider.get()?.historyItemRef.get();o&&e.push(d(13728,null,o.name)),t.input.visible&&t.input.enabled&&t.input.value!==""&&e.push(d(13729,null,t.input.value));let n=t.provider.actionButton.get();if(n){let s=n.command.tooltip??n.command.title,l=n.enabled?d(13709,null):d(13708,null);e.push(d(13730,null,s,l))}let r=[];for(let s of t.provider.groups)r.push(`${s.label} (${s.resources.length} resource(s))`);t.provider.groups.map(s=>s.label).join(", "),e.push(d(13731,null,r.join(", ")))}return e.push(d(13720,null)),e.push(d(13721,null)),e.push(d(13722,null)),e.push(d(13723,null)),e.push(d(13724,null)),e.push(d(13725,null)),e.push(d(13715,null)),e.push(d(13716,null)),e.push(d(13717,null)),e.push(d(13718,null)),e.push(d(13719,null)),e.push(d(13710,null)),e.push(d(13711,null)),e.push(d(13712,null)),e.push(d(13713,null)),e.push(d(13714,null)),e.join(`
`)}};Mlt=I([m(0,ge),m(1,_u),m(2,$t)],Mlt);wP.registerLanguage({id:"scminput",extensions:[],aliases:[],mimetypes:["text/x-scm-input"]});ne.as(Qi.Workbench).registerWorkbenchContribution(zHe,3);xo(NN.ID,NN,1);var S4t=Ae("source-control-view-icon",R.sourceControl,d(13707,null)),v4t=ne.as(Mn.ViewContainersRegistry).registerViewContainer({id:mue,title:L(13703,"Source Control"),ctorDescriptor:new Ft($He),storageId:"workbench.scm.views.state",icon:S4t,alwaysUseContainerInfo:!0,order:2,hideIfEmpty:!0},0,{doNotRegisterOpenCommand:!0}),Wve=ne.as(Mn.ViewsRegistry),b4t=d(13706,null);Wve.registerViewWelcomeContent(Jf,{content:d(13636,null),when:"default"});Wve.registerViewWelcomeContent(Jf,{content:d(13637,null),when:C.and(C.equals("scm.providerCount",0),Vq.IsEnabled,Vq.IsTrusted.toNegated())});Wve.registerViewWelcomeContent(Jf,{content:`[${d(13633,null)}](command:${Bq})`,when:C.and(C.equals("scm.providerCount",0),Vq.IsEnabled,Vq.IsTrusted.toNegated())});Wve.registerViewWelcomeContent(uA,{content:d(13635,null),when:Mc.SCMHistoryItemCount.isEqualTo(0)});Wve.registerViews([{id:xRt,containerTitle:b4t,name:L(13700,"Repositories"),singleViewPaneContainerTitle:d(13705,null),ctorDescriptor:new Ft(ZHe),canToggleVisibility:!0,hideByDefault:!0,canMoveView:!0,weight:20,order:0,when:C.and(C.has("scm.providerCount"),C.notEquals("scm.providerCount",0)),containerIcon:S4t}],v4t);Wve.registerViews([{id:Jf,containerTitle:b4t,name:L(13696,"Changes"),singleViewPaneContainerTitle:b4t,ctorDescriptor:new Ft(JHe),canToggleVisibility:!0,canMoveView:!0,weight:40,order:1,containerIcon:S4t,openCommandActionDescriptor:{id:v4t.id,mnemonicTitle:d(13634,null),keybindings:{primary:0,win:{primary:3109},linux:{primary:3109},mac:{primary:1317}},order:2}}],v4t);Wve.registerViews([{id:uA,containerTitle:b4t,name:L(13699,"Graph"),singleViewPaneContainerTitle:d(13704,null),ctorDescriptor:new Ft(eUe),canToggleVisibility:!0,canMoveView:!0,weight:40,order:2,when:C.and(C.has("scm.historyProviderCount"),C.notEquals("scm.historyProviderCount",0)),containerIcon:S4t}],v4t);ne.as(Qi.Workbench).registerWorkbenchContribution(KHe,3);ne.as(Qi.Workbench).registerWorkbenchContribution(GHe,3);It(Nve.ID,Nve,St.AfterRestored);It(wpe.ID,wpe,St.AfterRestored);ne.as(Jt.Configuration).registerConfiguration({id:"scm",order:5,title:d(13697,null),type:"object",scope:5,properties:{"scm.diffDecorations":{type:"string",enum:["all","gutter","overview","minimap","none"],enumDescriptions:[d(13658,null),d(13659,null),d(13662,null),d(13660,null),d(13661,null)],default:"all",description:d(13623,null)},"scm.diffDecorationsGutterWidth":{type:"number",enum:[1,2,3,4,5],default:3,description:d(13628,null)},"scm.diffDecorationsGutterVisibility":{type:"string",enum:["always","hover"],enumDescriptions:[d(13667,null),d(13668,null)],description:d(13666,null),default:"always"},"scm.diffDecorationsGutterAction":{type:"string",enum:["diff","none"],enumDescriptions:[d(13664,null),d(13665,null)],description:d(13663,null),default:"diff"},"scm.diffDecorationsGutterPattern":{type:"object",description:d(13625,null),additionalProperties:!1,properties:{added:{type:"boolean",description:d(13626,null)},modified:{type:"boolean",description:d(13627,null)}},default:{added:!1,modified:!0}},"scm.diffDecorationsIgnoreTrimWhitespace":{type:"string",enum:["true","false","inherit"],enumDescriptions:[d(13671,null),d(13669,null),d(13670,null)],description:d(13624,null),default:"false"},"scm.alwaysShowActions":{type:"boolean",description:d(13620,null),default:!1},"scm.countBadge":{type:"string",enum:["all","focused","off"],enumDescriptions:[d(13648,null),d(13649,null),d(13650,null)],description:d(13647,null),default:"all"},"scm.providerCountBadge":{type:"string",enum:["hidden","auto","visible"],enumDescriptions:[d(13681,null),d(13680,null),d(13682,null)],markdownDescription:d(13679,null,"`#scm.alwaysShowRepositories#`"),default:"hidden"},"scm.defaultViewMode":{type:"string",enum:["tree","list"],enumDescriptions:[d(13653,null),d(13652,null)],description:d(13651,null),default:"list"},"scm.defaultViewSortKey":{type:"string",enum:["name","path","status"],enumDescriptions:[d(13655,null),d(13656,null),d(13657,null)],description:d(13654,null),default:"path"},"scm.autoReveal":{type:"boolean",description:d(13622,null),default:!0},"scm.inputFontFamily":{type:"string",markdownDescription:d(13629,null),default:"default"},"scm.inputFontSize":{type:"number",markdownDescription:d(13630,null),default:13},"scm.inputMaxLineCount":{type:"number",markdownDescription:d(13631,null),minimum:1,maximum:50,default:10},"scm.inputMinLineCount":{type:"number",markdownDescription:d(13632,null),minimum:1,maximum:50,default:1},"scm.alwaysShowRepositories":{type:"boolean",markdownDescription:d(13621,null),default:!1},"scm.repositories.sortOrder":{type:"string",enum:["discovery time","name","path"],enumDescriptions:[d(13687,null),d(13688,null),d(13689,null)],description:d(13642,null),default:"discovery time"},"scm.repositories.visible":{type:"number",description:d(13640,null),default:10},"scm.repositories.selectionMode":{type:"string",enum:["multiple","single"],enumDescriptions:[d(13685,null),d(13686,null)],description:d(13684,null),default:"multiple"},"scm.repositories.explorer":{type:"boolean",markdownDescription:d(13683,null,"`#scm.repositories.selectionMode#`","single"),default:!1,tags:["experimental"]},"scm.showActionButton":{type:"boolean",markdownDescription:d(13701,null),default:!0},"scm.showInputActionButton":{type:"boolean",markdownDescription:d(13702,null),default:!0},"scm.workingSets.enabled":{type:"boolean",description:d(13693,null),default:!1},"scm.workingSets.default":{type:"string",enum:["empty","current"],enumDescriptions:[d(13692,null),d(13691,null)],description:d(13690,null),default:"current"},"scm.compactFolders":{type:"boolean",description:d(13646,null),default:!0},"scm.graph.pageOnScroll":{type:"boolean",description:d(13675,null),default:!0},"scm.graph.pageSize":{type:"number",description:d(13676,null),minimum:1,maximum:1e3,default:50},"scm.graph.badges":{type:"string",enum:["all","filter"],enumDescriptions:[d(13673,null),d(13674,null)],description:d(13672,null),default:"filter"},"scm.graph.showIncomingChanges":{type:"boolean",description:d(13677,null),default:!0},"scm.graph.showOutgoingChanges":{type:"boolean",description:d(13678,null),default:!0}}});Ct.registerCommandAndKeybindingRule({id:"scm.acceptInput",metadata:{description:d(13643,null),args:[]},weight:200,when:C.has("scmRepository"),primary:2051,handler:a=>{let t=a.get(X).getContext(Nn()).getValue("scmRepository");if(!t)return Promise.resolve(null);let n=a.get(rd).getRepository(t);if(!n?.provider.acceptInputCommand)return Promise.resolve(null);let r=n.provider.acceptInputCommand.id,s=n.provider.acceptInputCommand.arguments;return a.get(ge).executeCommand(r,...s||[])}});Ct.registerCommandAndKeybindingRule({id:"scm.clearValidation",weight:200,when:C.and(C.has("scmRepository"),c4t.SCMInputHasValidationMessage),primary:9,handler:async a=>{a.get(_u).activeRepository.get()?.repository.input.clearValidation()}});Ct.registerCommandAndKeybindingRule({id:"scm.clearInput",weight:200,when:C.and(C.has("scmRepository"),Xn.Visible.toNegated(),Ha.inlineSuggestionVisible.toNegated(),c4t.SCMInputHasValidationMessage.toNegated(),pe.hasNonEmptySelection.toNegated()),primary:9,handler:async a=>{let i=a.get(rd),o=a.get(X).getContext(Nn()).getValue("scmRepository");(o?i.getRepository(o):void 0)?.input.setValue("",!0)}});var CTo={description:{description:d(13644,null),args:[]},weight:200,handler:a=>{let i=a.get(X),e=a.get(rd),o=i.getContext(Nn()).getValue("scmRepository");(o?e.getRepository(o):void 0)?.input.showNextHistoryValue()}},xTo={description:{description:d(13645,null),args:[]},weight:200,handler:a=>{let i=a.get(X),e=a.get(rd),o=i.getContext(Nn()).getValue("scmRepository");(o?e.getRepository(o):void 0)?.input.showPreviousHistoryValue()}};Ct.registerCommandAndKeybindingRule({...CTo,id:"scm.viewNextCommit",when:C.and(C.has("scmRepository"),C.has("scmInputIsInLastPosition"),Xn.Visible.toNegated()),primary:18});Ct.registerCommandAndKeybindingRule({...xTo,id:"scm.viewPreviousCommit",when:C.and(C.has("scmRepository"),C.has("scmInputIsInFirstPosition"),Xn.Visible.toNegated()),primary:16});Ct.registerCommandAndKeybindingRule({...CTo,id:"scm.forceViewNextCommit",when:C.has("scmRepository"),primary:530});Ct.registerCommandAndKeybindingRule({...xTo,id:"scm.forceViewPreviousCommit",when:C.has("scmRepository"),primary:528});$e.registerCommand("scm.openInIntegratedTerminal",async(a,...i)=>{if(!i||i.length===0)return;let e=a.get(ge),t=a.get(Io),o=i.length===1?i[0]:void 0;if(!o){let n=t.lastFocusedList,r=n?.getHTMLElement();if(n instanceof Vl&&r&&wa(r)){let[s]=n.getFocus(),l=n.element(s);Ad(l)&&(o=l.provider)}}o?.rootUri&&await e.executeCommand("openInIntegratedTerminal",o.rootUri)});$e.registerCommand("scm.openInTerminal",async(a,i)=>{if(!i||!i.rootUri)return;await a.get(ge).executeCommand("openInTerminal",i.rootUri)});$e.registerCommand("scm.setActiveProvider",async a=>{let i=a.get(F),e=a.get(_u),t=d(13695,null),o=d(13694,null),r=await i.createInstance(XHe,t,o).pickRepository();if(r?.repository){let s=r.repository!=="auto"?r.repository:void 0;e.pinActiveRepository(s)}});ve.appendMenuItem(D.SCMSourceControl,{group:"99_terminal",command:{id:"scm.openInTerminal",title:d(13638,null)},when:C.and(yb.isEqualTo(""),C.equals("scmProviderHasRootUri",!0),C.or(C.equals("config.terminal.sourceControlRepositoriesKind","external"),C.equals("config.terminal.sourceControlRepositoriesKind","both")))});ve.appendMenuItem(D.SCMSourceControl,{group:"99_terminal",command:{id:"scm.openInIntegratedTerminal",title:d(13639,null)},when:C.and(C.equals("scmProviderHasRootUri",!0),C.or(C.equals("config.terminal.sourceControlRepositoriesKind","integrated"),C.equals("config.terminal.sourceControlRepositoriesKind","both")))});Ct.registerCommandAndKeybindingRule({id:"workbench.scm.action.focusPreviousInput",weight:200,when:Mc.RepositoryVisibilityCount.notEqualsTo(0),handler:async a=>{let e=await a.get($t).openView(Jf);e&&e.focusPreviousInput()}});Ct.registerCommandAndKeybindingRule({id:"workbench.scm.action.focusNextInput",weight:200,when:Mc.RepositoryVisibilityCount.notEqualsTo(0),handler:async a=>{let e=await a.get($t).openView(Jf);e&&e.focusNextInput()}});Ct.registerCommandAndKeybindingRule({id:"workbench.scm.action.focusPreviousResourceGroup",weight:200,handler:async a=>{let e=await a.get($t).openView(Jf);e&&e.focusPreviousResourceGroup()}});Ct.registerCommandAndKeybindingRule({id:"workbench.scm.action.focusNextResourceGroup",weight:200,handler:async a=>{let e=await a.get($t).openView(Jf);e&&e.focusNextResourceGroup()}});ve.appendMenuItem(D.EditorLineNumberContext,{title:d(13641,null),submenu:D.SCMQuickDiffDecorations,when:C.or(C.equals("config.scm.diffDecorations","all"),C.equals("config.scm.diffDecorations","gutter")),group:"9_quickDiffDecorations"});W(class extends K{constructor(){super({id:"scm.editor.triggerSetup",title:d(13698,null),icon:R.chatSparkle,f1:!1,menu:{id:D.EditorContent,when:C.and(ie.Setup.hidden.negate(),ie.Setup.disabled.negate(),ie.Setup.installed.negate(),C.in(Wo.Resource.key,"git.mergeChanges"),C.equals("git.activeResourceHasMergeConflicts",!0))}})}async run(a,...i){let e=a.get(ge);if(!await e.executeCommand(xpe))return;let o=ro.defaultChatAgent?.resolveMergeConflictsCommand;o&&await e.executeCommand(o,...i)}});Ee(rd,qHe,1);Ee(_u,Fq,1);Ee(mT,Hq,1);Ee(qF,LTe,1);ga.register(new f4t);var mWi="workbench.debug.viewlet.action.copyWorkspaceVariableValue",hWi=d(12394,null);W(class extends K{constructor(){super({id:mWi,title:hWi,f1:!1})}run(a,i){let e=a.get(Fi);i.value&&e.writeText(i.value)}});W(class extends K{constructor(){super({id:"_executeNotebookVariableProvider",title:d(12395,null),f1:!1})}async run(a,i){if(!i)return[];let e=A.revive(i),t=a.get(Ol),n=a.get(bn).getNotebookTextModel(e);if(!n)return[];let r=t.getMatchingKernel(n).selected;if(r&&r.hasVariableProvider){let s=r.provideVariables(n.uri,void 0,"named",0,Se.None),l=[];for await(let c of s)l.push(c);return l}return[]}});var Vve=class extends x{constructor(e,t,o,n){super();this._debugService=e;this._logService=t;this._accessibilityService=o;this._configurationService=n;this._listener=this._register(new me);this._setListener(),this._register(n.onDidChangeConfiguration(r=>{r.affectsConfiguration("accessibility.debugWatchVariableAnnouncements")&&this._setListener()}))}static{this.ID="workbench.contrib.debugWatchAccessibilityAnnouncer"}_setListener(){this._configurationService.getValue("accessibility.debugWatchVariableAnnouncements")&&!this._listener.value?this._listener.value=this._debugService.getModel().onDidChangeWatchExpressionValue(t=>{!t||t.value===dd.DEFAULT_VALUE||(this._accessibilityService.alert(`${t.name} = ${t.value}`),this._logService.trace(`debugAccessibilityAnnouncerValueChanged ${t.name} ${t.value}`))}):this._listener.clear()}};Vve=I([m(0,Ni),m(1,se),m(2,Oi),m(3,B)],Vve);var NU=class extends x{constructor(e,t,o,n,r){super();this.debugService=t;this.modelService=o;this.languageService=n;this.editorWorkerService=r;this.pendingUpdates=new Map;this._store.add(e.registerTextModelContentProvider(KC,this)),NU.INSTANCE=this}dispose(){this.pendingUpdates.forEach(e=>e.dispose()),super.dispose()}provideTextContent(e){return this.createOrUpdateContentModel(e,!0)}static refreshDebugContent(e){NU.INSTANCE?.createOrUpdateContentModel(e,!1)}createOrUpdateContentModel(e,t){let o=this.modelService.getModel(e);if(!o&&!t)return null;let n;if(e.query){let s=GK.getEncodedDebugData(e);n=this.debugService.getModel().getSession(s.sessionId)}if(n||(n=this.debugService.getViewModel().focusedSession),!n)return Promise.reject(new pa(d(9908,null)));let r=s=>{this.debugService.sourceIsNotAvailable(e);let l=this.languageService.createById($r),c=s?d(9907,null,e.path,s):d(9906,null,e.path);return this.modelService.createModel(c,l,e)};return n.loadSource(e).then(s=>{if(s&&s.body)if(o){let l=s.body.content;this.pendingUpdates.get(o.id)?.cancel();let u=new Ye;return this.pendingUpdates.set(o.id,u),this.editorWorkerService.computeMoreMinimalEdits(o.uri,[{text:l,range:o.getFullModelRange()}]).then(p=>(this.pendingUpdates.delete(o.id),!u.token.isCancellationRequested&&p&&p.length>0&&o.applyEdits(p.map(h=>Hn.replace(z.lift(h.range),h.text))),o))}else{let l=s.body.mimeType||K_e(e)[0],c=this.languageService.createByMimeType(l);return this.modelService.createModel(s.body.content,c,e)}return r()},s=>r(s.message))}};NU=I([m(0,Bt),m(1,Ni),m(2,Tt),m(3,_t),m(4,Qs)],NU);var iUe=class{constructor(i,e,t,o){this.debugService=e;this.configurationService=t;this.dialogService=o;this.disposable=i.onBeforeShutdown(async n=>n.veto(this.shouldVetoShutdown(n.reason),"veto.debug"))}shouldVetoShutdown(i){let e=this.debugService.getModel().getSessions().filter(o=>o.parentSession===void 0);return e.length===0||this.configurationService.getValue("debug").confirmOnExit==="never"?!1:this.showWindowCloseConfirmation(e.length)}dispose(){return this.disposable.dispose()}async showWindowCloseConfirmation(i){let e;return i===1?e=d(9921,null):e=d(9920,null),!(await this.dialogService.confirm({message:e,type:"warning",primaryButton:d(9922,null)})).confirmed}};iUe=I([m(0,ji),m(1,Ni),m(2,B),m(3,at)],iUe);var Bve=class extends x{static{this.ID="debug.replAccessibilityAnnouncer"}constructor(i,e,t){super();let o=i.getViewModel(),n=this._register(new me);this._register(o.onDidFocusSession(r=>{n.clear(),r&&(n.value=r.onDidChangeReplElements(s=>{if(!s||!("originalExpression"in s))return;let l=s.toString();e.status(l),t.trace("ReplAccessibilityAnnouncer#onDidChangeReplElements",s.originalExpression+": "+l)}))}))}};Bve=I([m(0,Ni),m(1,Oi),m(2,se)],Bve);var kTo="debug.actionswidgetposition",ETo="debug.actionswidgety",oUe=class extends yu{constructor(e,t,o,n,r,s,l,c,u,p){super(l);this.notificationService=e;this.telemetryService=t;this.debugService=o;this.layoutService=n;this.storageService=r;this.configurationService=s;this.instantiationService=c;this.isVisible=!1;this.isBuilt=!1;this.stopActionViewItemDisposables=this._register(new N);this.auxWindowCoordinates=new WeakMap;this.trackPixelRatioListener=this._register(new me);this.$el=_("div.debug-toolbar");let h=xY(this.configurationService)==="custom",g=h&&om===1,f=h&&(om===3||om===2);this.$el.style.transform=`translate(
			min(
				max(${g?"60px":"0px"}, calc(-50% + (100vw * var(--x-position)))),
				calc(100vw - 100% - ${f?"100px":"0px"})
			),
			var(--y-position)
		)`,this.dragArea=M(this.$el,_("div.drag-area"+q.asCSSSelector(lho)));let v=M(this.$el,_("div.action-bar-container"));this.debugToolBarMenu=u.createMenu(D.DebugToolBar,p),this._register(this.debugToolBarMenu),this.activeActions=[],this.actionBar=this._register(new Zi(v,{orientation:0,actionViewItemProvider:(b,S)=>{if(b.id===nFe)return this.instantiationService.createInstance(Dq,b,void 0);if(b.id===qT||b.id===LM){this.stopActionViewItemDisposables.clear();let y=this.instantiationService.invokeFunction(w=>Plt(b,this.stopActionViewItemDisposables,w,{hoverDelegate:S.hoverDelegate}));if(y)return y}return Bs(this.instantiationService,b,S)}})),this.updateScheduler=this._register(new Dt(()=>{let b=this.debugService.state,S=this.configurationService.getValue("debug").toolBarLocation;if(b===0||S!=="floating"||this.debugService.getModel().getSessions().every(w=>w.suppressDebugToolbar)||b===1&&this.debugService.initializingOptions?.suppressDebugToolbar)return this.hide();let y=jm(this.debugToolBarMenu.getActions({shouldForwardArgs:!0}));$i(y,this.activeActions,(w,k)=>w.id===k.id&&w.enabled===k.enabled)||(this.actionBar.clear(),this.actionBar.push(y,{icon:!0,label:!1}),this.activeActions=y),this.show()},20)),this.updateStyles(),this.registerListeners(),this.hide()}registerListeners(){this._register(this.debugService.onDidChangeState(()=>this.updateScheduler.schedule())),this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration("debug.toolBarLocation")&&this.updateScheduler.schedule(),(e.affectsConfiguration("workbench.editor.showTabs")||e.affectsConfiguration("window.commandCenter"))&&(this._yRange=void 0,this.setCoordinates())})),this._register(this.debugToolBarMenu.onDidChange(()=>this.updateScheduler.schedule())),this._register(this.actionBar.actionRunner.onDidRun(e=>{e.error&&!ao(e.error)&&this.notificationService.warn(e.error),this.telemetryService.publicLog2("workbenchActionExecuted",{id:e.action.id,from:"debugActionsWidget"})})),this._register(pae(this.dragArea,e=>{new Cn(Re(this.dragArea),e).detail===2&&(this.setCoordinates(.5,this.yDefault),this.storePosition())})),this._register(q$(this.dragArea,e=>{this.dragArea.classList.add("dragged");let t=Re(this.layoutService.activeContainer),o=new Cn(t,e),n=this.computeCurrentXPercent(),r=this.getCurrentYPosition(),s=LIe(t,c=>{let u=new Cn(t,c);u.preventDefault(),this.setCoordinates(n+(u.posx-o.posx)/t.innerWidth,r+u.posy-o.posy)}),l=pae(t,c=>{this.storePosition(),this.dragArea.classList.remove("dragged"),s.dispose(),l.dispose()})})),this._register(this.layoutService.onDidChangePartVisibility(()=>this.setCoordinates())),this._register(this.layoutService.onDidChangeActiveContainer(async()=>{this._yRange=void 0,await this.layoutService.whenContainerStylesLoaded(Re(this.layoutService.activeContainer)),this.isBuilt&&(this.doShowInActiveContainer(),this.setCoordinates())}))}computeCurrentXPercent(){let{left:e,width:t}=this.$el.getBoundingClientRect();return(e+t/2)/Re(this.$el).innerWidth}getCurrentXPercent(){return Number(this.$el.style.getPropertyValue("--x-position"))}getCurrentYPosition(){return parseInt(this.$el.style.getPropertyValue("--y-position"))}storePosition(){let e=Re(this.layoutService.activeContainer),t=this.layoutService.activeContainer===this.layoutService.mainContainer,o=this.getCurrentXPercent(),n=this.getCurrentYPosition();t?(this.storageService.store(kTo,o,0,1),this.storageService.store(ETo,n,0,1)):this.auxWindowCoordinates.set(e,{x:o,y:n})}updateStyles(){if(super.updateStyles(),this.$el){this.$el.style.backgroundColor=this.getColor(who)||"";let e=this.getColor(E_),t=this.getColor(Cho);e?this.$el.style.border=`1px solid ${e}`:(this.$el.style.border=t?`solid ${t}`:"none",this.$el.style.border="1px 0")}}getStoredXPosition(){let e=Re(this.layoutService.activeContainer),o=e===ut?Number(this.storageService.get(kTo,0)):this.auxWindowCoordinates.get(e)?.x;return o!==void 0&&!isNaN(o)?o:.5}getStoredYPosition(){let e=Re(this.layoutService.activeContainer);return(e===ut?this.storageService.getNumber(ETo,0):this.auxWindowCoordinates.get(e)?.y)??this.yDefault}setCoordinates(e,t){if(!this.isVisible)return;e??=this.getStoredXPosition(),t??=this.getStoredYPosition();let[o,n]=this.yRange;t=Math.max(o,Math.min(t,n)),this.$el.style.setProperty("--x-position",`${e}`),this.$el.style.setProperty("--y-position",`${t}px`)}get yDefault(){return this.layoutService.mainContainerOffset.top}get yRange(){if(!this._yRange){let e=this.layoutService.isVisible("workbench.parts.titlebar",Re(this.layoutService.activeContainer)),t=e?0:this.layoutService.mainContainerOffset.top,o=0;e&&(this.configurationService.getValue("window.commandCenter")===!0?o+=35:o+=28),this.configurationService.getValue("workbench.editor.showTabs")!=="none"&&(o+=35),this._yRange=[t,o]}return this._yRange}show(){if(this.isVisible){this.setCoordinates();return}this.isBuilt||(this.isBuilt=!0,this.doShowInActiveContainer()),this.isVisible=!0,un(this.$el),this.setCoordinates()}doShowInActiveContainer(){this.layoutService.activeContainer.appendChild(this.$el),this.trackPixelRatioListener.value=bu.getInstance(Re(this.$el)).onDidChange(()=>this.setCoordinates())}hide(){this.isVisible=!1,vo(this.$el)}dispose(){super.dispose(),this.$el?.remove()}};oUe=I([m(0,Ne),m(1,Te),m(2,Ni),m(3,yi),m(4,ce),m(5,B),m(6,Le),m(7,F),m(8,Kt),m(9,X)],oUe);function Plt(a,i,e,t){let o=e.get(Kt),n=e.get(X),r=e.get(F),s=o.getMenuActions(D.DebugToolBarStop,n,{shouldForwardArgs:!0}),l=jm(s);if(!l.length)return;let c=i.add(new it("notebook.moreRunActions",d(9699,null),"codicon-chevron-down",!0));return r.createInstance(Jw,a,c,l,"debug-stop-actions",t)}var gWi=new N,OU=(a,i,e,t,o,n,r)=>{ve.appendMenuItem(D.DebugToolBar,{group:"navigation",when:o,order:e,command:{id:a,title:i,icon:t,precondition:n},alt:r}),gWi.add(ve.appendMenuItem(D.ViewContainerTitle,{group:"navigation",when:C.and(o,C.equals("viewContainer",cg),Zs.notEqualsTo("inactive"),C.equals("config.debug.toolBarLocation","docked")),order:e,command:{id:a,title:i,icon:t,precondition:n}}))};im(ve.onDidChangeMenu(a=>{if(a.has(D.DebugToolBar)){gWi.clear();let i=ve.getMenuItems(D.DebugToolBar);for(let e of i)gWi.add(ve.appendMenuItem(D.ViewContainerTitle,{...e,when:C.and(e.when,C.equals("viewContainer",cg),Zs.notEqualsTo("inactive"),C.equals("config.debug.toolBarLocation","docked"))}))}}));var TTo=C.equals("config.debug.toolBarLocation","commandCenter");ve.appendMenuItem(D.CommandCenterCenter,{submenu:D.DebugToolBar,title:"Debug",icon:R.debug,order:1,when:C.and(sl,TTo)});OU(jG,Xie,10,mhe,Zs.isEqualTo("stopped"));OU(lQ,Yie,10,phe,Zs.notEqualsTo("stopped"),C.and(Zs.isEqualTo("running"),HK.toNegated()));OU(qT,YG,70,v8,zC.toNegated(),void 0,{id:LM,title:uQ,icon:tW,precondition:C.and(zC.toNegated(),sA)});OU(LM,uQ,70,tW,zC,void 0,{id:qT,title:YG,icon:v8,precondition:C.and(zC,sA)});OU(GG,$ie,20,uhe,void 0,Zs.isEqualTo("stopped"));OU(qG,jie,30,Ste,void 0,Zs.isEqualTo("stopped"));OU($G,Qie,40,Ite,void 0,Zs.isEqualTo("stopped"));OU(KG,qie,60,dhe);OU(vLi,d(9701,null),50,Mtt,h9e,Zs.isEqualTo("stopped"));OU(fLi,d(9700,null),55,Ptt,h9e,Zs.isEqualTo("stopped"));OU(nFe,tSo,100,R.listTree,C.and(sRt,TTo.negate()));ve.appendMenuItem(D.DebugToolBarStop,{group:"navigation",when:C.and(zC.toNegated(),sA),order:0,command:{id:LM,title:uQ,icon:tW}});ve.appendMenuItem(D.DebugToolBarStop,{group:"navigation",when:C.and(zC,sA),order:0,command:{id:qT,title:YG,icon:v8}});ve.appendMenuItem(D.DebugToolBarStop,{group:"navigation",when:C.or(C.and(zC.toNegated(),dJ,sA),C.and(zC,dJ)),order:0,command:{id:oFe,title:nnt,icon:tW}});var Tx=_;function DTo(a){return{sessionId:a.getId()}}function LTo(a){return{...DTo(a.session),threadId:a.getId()}}function Lmn(a){return{...LTo(a.thread),frameId:a.getId(),frameName:a.name,frameLocation:{range:a.range,source:a.source.raw}}}function wWi(a){return a instanceof pT?Lmn(a):a instanceof cA?LTo(a):FU(a)?DTo(a):void 0}function CWi(a){return a instanceof pT?a.source.inMemory?a.source.raw.path||a.source.reference||a.source.name:a.source.uri.toString():a instanceof cA?a.threadId:FU(a)?a.getId():""}function RTo(a){let i=a.thread.getStaleCallStack();i=i.length>0?i:a.thread.getCallStack();let e=i.map(n=>n.source).filter(n=>n!==a.source),t=0;if(e.forEach(n=>{n.name===a.source.name&&(t=Math.max(t,vC(a.source.uri.path,n.uri.path)))}),t===0)return a.source.name;let o=Math.max(0,a.source.uri.path.lastIndexOf(Oo.sep,a.source.uri.path.length-t-1));return(o>0?"...":"")+a.source.uri.path.substring(o)}async function fWi(a,i){a.parentSession&&await fWi(a.parentSession,i),await i.expand(a)}var nUe=class extends Gs{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super(e,n,t,l,c,s,r,u,p,h);this.options=e;this.debugService=o;this.menuService=g;this.needsRefresh=!1;this.ignoreSelectionChangedEvent=!1;this.ignoreFocusStackFrameEvent=!1;this.autoExpandedSessions=new Set;this.selectionNeedsUpdate=!1;this.onCallStackChangeScheduler=this._register(new Dt(async()=>{let f=this.debugService.getModel().getSessions();f.length===0&&this.autoExpandedSessions.clear();let v=f.length===1&&f[0].getAllThreads().length===1?f[0].getAllThreads()[0]:void 0,b=f.length===1?f[0].getStoppedDetails():void 0;b&&(v||typeof b.threadId!="number")?(this.stateMessageLabel.textContent=y4t(b),this.stateMessageLabelHover.update(bWi(b)),this.stateMessageLabel.classList.toggle("exception",b.reason==="exception"),this.stateMessage.hidden=!1):f.length===1&&f[0].state===3?(this.stateMessageLabel.textContent=d(9347,null),this.stateMessageLabelHover.update(f[0].getLabel()),this.stateMessageLabel.classList.remove("exception"),this.stateMessage.hidden=!1):this.stateMessage.hidden=!0,this.updateActions(),this.needsRefresh=!1,await this.tree.updateChildren();try{let S=new Set;f.forEach(y=>{y.parentSession&&!this.autoExpandedSessions.has(y.parentSession)&&S.add(y.parentSession)});for(let y of S)await fWi(y,this.tree),this.autoExpandedSessions.add(y)}catch{}this.selectionNeedsUpdate&&(this.selectionNeedsUpdate=!1,await this.updateTreeSelection())},50))}renderHeaderTitle(e){super.renderHeaderTitle(e,this.options.title),this.stateMessage=M(e,Tx("span.call-stack-state-message")),this.stateMessage.hidden=!0,this.stateMessageLabel=M(this.stateMessage,Tx("span.label")),this.stateMessageLabelHover=this._register(this.hoverService.setupManagedHover(Ri("mouse"),this.stateMessage,""))}renderBody(e){super.renderBody(e),this.element.classList.add("debug-pane"),e.classList.add("debug-call-stack");let t=Oie(e);this.dataSource=new SWi(this.debugService),this.tree=this.instantiationService.createInstance(sy,"CallStackView",t,new vWi,new yWi(this.debugService),[this.instantiationService.createInstance(Vne),this.instantiationService.createInstance(Bne),this.instantiationService.createInstance(Hne),this.instantiationService.createInstance(Une),new rUe,new I4t],this.dataSource,{accessibilityProvider:new IWi,compressionEnabled:!0,autoExpandSingleChildren:!0,identityProvider:{getId:n=>typeof n=="string"?n:n instanceof Array?`showMore ${n[0].getId()}`:n.getId()},keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:n=>FU(n)?n.getLabel():n instanceof cA?`${n.name} ${n.stateLabel}`:n instanceof pT||typeof n=="string"?n:n instanceof mJ?rUe.LABEL:d(9352,null),getCompressedNodeKeyboardNavigationLabel:n=>{let r=n[0];return FU(r)?r.getLabel():""}},expandOnlyOnTwistieClick:!0,overrideStyles:this.getLocationBasedColors().listOverrideStyles}),Eto.bindTo(this.tree.contextKeyService),this.tree.setInput(this.debugService.getModel()),this._register(this.tree),this._register(this.tree.onDidOpen(async n=>{if(this.ignoreSelectionChangedEvent)return;let r=(l,c,u,p={})=>{this.ignoreFocusStackFrameEvent=!0;try{this.debugService.focusStackFrame(l,c,u,{...p,explicit:!0})}finally{this.ignoreFocusStackFrameEvent=!1}},s=n.element;if(s instanceof pT){let l={preserveFocus:n.editorOptions.preserveFocus,sideBySide:n.sideBySide,pinned:n.editorOptions.pinned};r(s,s.thread,s.thread.session,l)}if(s instanceof cA&&r(void 0,s,s.session),FU(s)&&r(void 0,void 0,s),s instanceof mJ){let l=this.debugService.getModel().getSession(s.sessionId),c=l&&l.getThread(s.threadId);if(c){let u=c.stoppedDetails?.totalFrames,p=typeof u=="number"?u-c.getCallStack().length:void 0;await c.fetchCallStack(p),await this.tree.updateChildren()}}s instanceof Array&&(s.forEach(l=>this.dataSource.deemphasizedStackFramesToShow.add(l)),this.tree.updateChildren())})),this._register(this.debugService.getModel().onDidChangeCallStack(()=>{if(!this.isBodyVisible()){this.needsRefresh=!0;return}this.onCallStackChangeScheduler.isScheduled()||this.onCallStackChangeScheduler.schedule()}));let o=U.any(this.debugService.getViewModel().onDidFocusStackFrame,this.debugService.getViewModel().onDidFocusSession);this._register(o(async()=>{if(!this.ignoreFocusStackFrameEvent){if(!this.isBodyVisible()){this.needsRefresh=!0,this.selectionNeedsUpdate=!0;return}if(this.onCallStackChangeScheduler.isScheduled()){this.selectionNeedsUpdate=!0;return}await this.updateTreeSelection()}})),this._register(this.tree.onContextMenu(n=>this.onContextMenu(n))),this.debugService.state===2&&this.onCallStackChangeScheduler.schedule(0),this._register(this.onDidChangeBodyVisibility(n=>{n&&this.needsRefresh&&this.onCallStackChangeScheduler.schedule()})),this._register(this.debugService.onDidNewSession(n=>{let r=[];r.push(n.onDidChangeName(()=>{this.tree.hasNode(n)&&this.tree.rerender(n)})),r.push(n.onDidEndAdapter(()=>Be(r))),n.parentSession&&this.autoExpandedSessions.delete(n.parentSession)}))}layoutBody(e,t){super.layoutBody(e,t),this.tree.layout(e,t)}focus(){super.focus(),this.tree.domFocus()}collapseAll(){this.tree.collapseAll()}async updateTreeSelection(){if(!this.tree||!this.tree.getInput())return;let e=r=>{this.ignoreSelectionChangedEvent=!0;try{this.tree.setSelection([r]),this.tree.getRelativeTop(r)===null?this.tree.reveal(r,.5):this.tree.reveal(r)}catch{}finally{this.ignoreSelectionChangedEvent=!1}},t=this.debugService.getViewModel().focusedThread,o=this.debugService.getViewModel().focusedSession,n=this.debugService.getViewModel().focusedStackFrame;if(!t)o?e(o):this.tree.setSelection([]);else{try{await fWi(t.session,this.tree)}catch{}try{await this.tree.expand(t)}catch{}let r=n||o;r&&e(r)}}onContextMenu(e){let t=e.element,o=[];FU(t)?o=MTo(t):t instanceof cA?o=PTo(t):t instanceof pT&&(o=Rmn(t));let n=this.contextKeyService.createOverlay(o),r=this.menuService.getMenuActions(D.DebugCallStackContext,n,{arg:CWi(t),shouldForwardArgs:!0}),s=zp(r,"inline");this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>s.secondary,getActionsContext:()=>wWi(t)})}};nUe=I([m(1,Xe),m(2,Ni),m(3,_e),m(4,F),m(5,Bi),m(6,B),m(7,X),m(8,Je),m(9,Le),m(10,nt),m(11,Kt)],nUe);function MTo(a){return[[Av.key,"session"],[ZLt.key,cue(a)],[rJ.key,a.state===2],[Uhi.key,a.getAllThreads().length===1]]}var Vne=class{constructor(i,e,t,o){this.instantiationService=i;this.contextKeyService=e;this.hoverService=t;this.menuService=o}static{this.ID="session"}get templateId(){return Vne.ID}renderTemplate(i){let e=M(i,Tx(".session"));M(e,Tx(q.asCSSSelector(uho)));let t=M(e,Tx(".name")),o=M(e,Tx("span.state.label.monaco-count-badge.long")),n=new N,r=n.add(new Ya(t)),s=n.add(new N),l=n.add(new Zi(e,{actionViewItemProvider:(u,p)=>{if((u.id===qT||u.id===LM)&&u instanceof Lo){s.clear();let h=this.instantiationService.invokeFunction(g=>Plt(u,s,g,{...p,menuAsChild:!1}));if(h)return h}if(u instanceof Lo)return this.instantiationService.createInstance(xl,u,{hoverDelegate:p.hoverDelegate});if(u instanceof Nc)return this.instantiationService.createInstance(VE,u,{hoverDelegate:p.hoverDelegate})}})),c=n.add(new N);return{session:e,name:t,stateLabel:o,label:r,actionBar:l,elementDisposable:c,templateDisposable:n}}renderElement(i,e,t){this.doRenderElement(i.element,xa(i.filterData),t)}renderCompressedElements(i,e,t){let o=i.element.elements[i.element.elements.length-1],n=xa(i.filterData);this.doRenderElement(o,n,t)}doRenderElement(i,e,t){let o=t.elementDisposable.add(this.hoverService.setupManagedHover(Ri("mouse"),t.session,d(9348,null)));t.label.set(i.getLabel(),e);let n=i.getStoppedDetails(),r=i.getAllThreads().find(u=>u.stopped),s=this.contextKeyService.createOverlay(MTo(i)),l=t.elementDisposable.add(this.menuService.createMenu(D.DebugCallStackContext,s)),c=()=>{t.actionBar.clear();let{primary:u}=ml(l.getActions({arg:CWi(i),shouldForwardArgs:!0}),"inline");t.actionBar.push(u,{icon:!0,label:!1}),t.actionBar.context=wWi(i)};t.elementDisposable.add(l.onDidChange(()=>c())),c(),t.stateLabel.style.display="",n?(t.stateLabel.textContent=y4t(n),o.update(`${i.getLabel()}: ${bWi(n)}`),t.stateLabel.classList.toggle("exception",n.reason==="exception")):r&&r.stoppedDetails?(t.stateLabel.textContent=y4t(r.stoppedDetails),o.update(`${i.getLabel()}: ${bWi(r.stoppedDetails)}`),t.stateLabel.classList.toggle("exception",r.stoppedDetails.reason==="exception")):(t.stateLabel.textContent=d(9347,null),t.stateLabel.classList.remove("exception"))}disposeTemplate(i){i.templateDisposable.dispose()}disposeElement(i,e,t){t.elementDisposable.clear()}disposeCompressedElements(i,e,t){t.elementDisposable.clear()}};Vne=I([m(0,F),m(1,X),m(2,nt),m(3,Kt)],Vne);function PTo(a){return[[Av.key,"thread"],[rJ.key,a.stopped]]}var Bne=class{constructor(i,e,t){this.contextKeyService=i;this.hoverService=e;this.menuService=t}static{this.ID="thread"}get templateId(){return Bne.ID}renderTemplate(i){let e=M(i,Tx(".thread")),t=M(e,Tx(".name")),o=M(e,Tx("span.state.label.monaco-count-badge.long")),n=new N,r=n.add(new Ya(t)),s=n.add(new Zi(e)),l=n.add(new N);return{thread:e,name:t,stateLabel:o,label:r,actionBar:s,elementDisposable:l,templateDisposable:n}}renderElement(i,e,t){let o=i.element;t.elementDisposable.add(this.hoverService.setupManagedHover(Ri("mouse"),t.thread,o.name)),t.label.set(o.name,xa(i.filterData)),t.stateLabel.textContent=o.stateLabel,t.stateLabel.classList.toggle("exception",o.stoppedDetails?.reason==="exception");let n=this.contextKeyService.createOverlay(PTo(o)),r=t.elementDisposable.add(this.menuService.createMenu(D.DebugCallStackContext,n)),s=()=>{t.actionBar.clear();let{primary:l}=ml(r.getActions({arg:CWi(o),shouldForwardArgs:!0}),"inline");t.actionBar.push(l,{icon:!0,label:!1}),t.actionBar.context=wWi(o)};t.elementDisposable.add(r.onDidChange(()=>s())),s()}renderCompressedElements(i,e,t){throw new Error("Method not implemented.")}disposeElement(i,e,t){t.elementDisposable.clear()}disposeTemplate(i){i.templateDisposable.dispose()}};Bne=I([m(0,X),m(1,nt),m(2,Kt)],Bne);function Rmn(a){return[[Av.key,"stackFrame"],[iRt.key,a.canRestart]]}var Hne=class{constructor(i,e,t){this.hoverService=i;this.labelService=e;this.notificationService=t}static{this.ID="stackFrame"}get templateId(){return Hne.ID}renderTemplate(i){let e=M(i,Tx(".stack-frame")),t=M(e,Tx("span.label.expression")),o=M(e,Tx(".file")),n=M(o,Tx("span.file-name")),r=M(o,Tx("span.line-number-wrapper")),s=M(r,Tx("span.line-number.monaco-count-badge")),l=new N,c=new N;l.add(c);let u=l.add(new Ya(t)),p=l.add(new Zi(e));return{file:o,fileName:n,label:u,lineNumber:s,stackFrame:e,actionBar:p,templateDisposable:l,elementDisposables:c}}renderElement(i,e,t){let o=i.element;t.stackFrame.classList.toggle("disabled",!o.source||!o.source.available||KK(o)),t.stackFrame.classList.toggle("label",o.presentationHint==="label");let n=!!o.thread.session.capabilities.supportsRestartFrame&&o.presentationHint!=="label"&&o.presentationHint!=="subtle"&&o.canRestart;t.stackFrame.classList.toggle("has-actions",n);let r=o.source.inMemory?o.source.uri.path:this.labelService.getUriLabel(o.source.uri);if(o.source.raw.origin&&(r+=`
${o.source.raw.origin}`),t.elementDisposables.add(this.hoverService.setupManagedHover(Ri("mouse"),t.file,r)),t.label.set(o.name,xa(i.filterData),o.name),t.fileName.textContent=RTo(o),o.range.startLineNumber!==void 0?(t.lineNumber.textContent=`${o.range.startLineNumber}`,o.range.startColumn&&(t.lineNumber.textContent+=`:${o.range.startColumn}`),t.lineNumber.classList.remove("unavailable")):t.lineNumber.classList.add("unavailable"),t.actionBar.clear(),n){let s=t.elementDisposables.add(new it("debug.callStack.restartFrame",d(9346,null),q.asClassName(Rtt),!0,async()=>{try{await o.restart()}catch(l){this.notificationService.error(l)}}));t.actionBar.push(s,{icon:!0,label:!1})}}renderCompressedElements(i,e,t){throw new Error("Method not implemented.")}disposeElement(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.templateDisposable.dispose()}};Hne=I([m(0,nt),m(1,rt),m(2,Ne)],Hne);var Une=class{constructor(i){this.hoverService=i}static{this.ID="error"}get templateId(){return Une.ID}renderTemplate(i){return{label:M(i,Tx(".error")),templateDisposable:new N}}renderElement(i,e,t){let o=i.element;t.label.textContent=o,t.templateDisposable.add(this.hoverService.setupManagedHover(Ri("mouse"),t.label,o))}renderCompressedElements(i,e,t){throw new Error("Method not implemented.")}disposeTemplate(i){}};Une=I([m(0,nt)],Une);var rUe=class a{static{this.ID="loadMore"}static{this.LABEL=d(9343,null)}constructor(){}get templateId(){return a.ID}renderTemplate(i){let e=M(i,Tx(".load-all"));return e.style.color=kt(nS),{label:e}}renderElement(i,e,t){t.label.textContent=a.LABEL}renderCompressedElements(i,e,t){throw new Error("Method not implemented.")}disposeTemplate(i){}},I4t=class a{static{this.ID="showMore"}constructor(){}get templateId(){return a.ID}renderTemplate(i){let e=M(i,Tx(".show-more"));return e.style.color=kt(nS),{label:e}}renderElement(i,e,t){let o=i.element;o.every(n=>!!(n.source&&n.source.origin&&n.source.origin===o[0].source.origin))?t.label.textContent=d(9350,null,o.length,o[0].source.origin):t.label.textContent=d(9351,null,o.length)}renderCompressedElements(i,e,t){throw new Error("Method not implemented.")}disposeTemplate(i){}},vWi=class{getHeight(i){return i instanceof pT&&i.presentationHint==="label"||i instanceof mJ||i instanceof Array?16:22}getTemplateId(i){return FU(i)?Vne.ID:i instanceof cA?Bne.ID:i instanceof pT?Hne.ID:typeof i=="string"?Une.ID:i instanceof mJ?rUe.ID:I4t.ID}};function bWi(a){return a.text??y4t(a)}function y4t(a){return a.description||(a.reason?d(9345,null,a.reason):d(9344,null))}function _To(a){return!!a&&typeof a.getSessions=="function"}function FU(a){return!!a&&typeof a.getAllThreads=="function"}var SWi=class{constructor(i){this.debugService=i;this.deemphasizedStackFramesToShow=new WeakSet}hasChildren(i){if(FU(i)){let e=i.getAllThreads();return e.length>1||e.length===1&&e[0].stopped||!!this.debugService.getModel().getSessions().find(t=>t.parentSession===i)}return _To(i)||i instanceof cA&&i.stopped}async getChildren(i){if(_To(i)){let e=i.getSessions();if(e.length===0)return Promise.resolve([]);if(e.length>1||this.debugService.getViewModel().isMultiSessionView())return Promise.resolve(e.filter(o=>!o.parentSession));let t=e[0].getAllThreads();return t.length===1?this.getThreadChildren(t[0]):Promise.resolve(t)}else if(FU(i)){let e=this.debugService.getModel().getSessions().filter(o=>o.parentSession===i),t=i.getAllThreads();return t.length===1?(await this.getThreadChildren(t[0])).concat(e):Promise.resolve(t.concat(e))}else return this.getThreadChildren(i)}getThreadChildren(i){return this.getThreadCallstack(i).then(e=>{let t=[];return e.forEach((o,n)=>{if(o instanceof pT&&o.source&&KK(o)&&!this.deemphasizedStackFramesToShow.has(o)){if(t.length){let s=t[t.length-1];if(s instanceof Array){s.push(o);return}}let r=n<e.length-1?e[n+1]:void 0;if(r instanceof pT&&r.source&&KK(r)){t.push([o]);return}}t.push(o)}),t})}async getThreadCallstack(i){let e=i.getCallStack();return(!e||!e.length)&&(await i.fetchCallStack(),e=i.getCallStack()),e.length===1&&i.session.capabilities.supportsDelayedStackTraceLoading&&i.stoppedDetails&&i.stoppedDetails.totalFrames&&i.stoppedDetails.totalFrames>1&&(e=e.concat(i.getStaleCallStack().slice(1))),i.stoppedDetails&&i.stoppedDetails.framesErrorMessage&&(e=e.concat([i.stoppedDetails.framesErrorMessage])),!i.reachedEndOfCallStack&&i.stoppedDetails&&(e=e.concat([new mJ(i.session.getId(),i.threadId)])),e}},IWi=class{getWidgetAriaLabel(){return d(9341,null)}getWidgetRole(){return"treegrid"}getRole(i){return"row"}getAriaLabel(i){if(i instanceof cA)return d(9354,null,i.name,i.stateLabel);if(i instanceof pT)return d(9353,null,i.name,i.range.startLineNumber,RTo(i));if(FU(i)){let e=i.getAllThreads().find(o=>o.stopped),t=e?e.stateLabel:d(9347,null);return d(9349,null,i.getLabel(),t)}return typeof i=="string"?i:i instanceof Array?d(9351,null,i.length):rUe.LABEL}},yWi=class{constructor(i){this.debugService=i}isIncompressible(i){return FU(i)?!(i.compact||this.debugService.getModel().getSessions().some(t=>t.parentSession===i&&t.compact)):!0}};W(class extends Yn{constructor(){super({id:"callStack.collapse",viewId:f4,title:d(9342,null),f1:!1,icon:R.collapseAll,precondition:Zs.isEqualTo(KR(2)),menu:{id:D.ViewTitle,order:10,group:"navigation",when:C.equals("view",f4)}})}runInView(i,e){e.collapseAll()}});function zne(a,i,e,t,o,n){ve.appendMenuItem(D.DebugCallStackContext,{group:"inline",order:o,when:t,command:{id:a,title:i,icon:e,precondition:n}})}var Alt=C.or(Av.isEqualTo("thread"),C.and(Av.isEqualTo("session"),Uhi));zne(lQ,Yie,phe,C.and(Alt,rJ.toNegated()),10,HK.toNegated());zne(jG,Xie,mhe,C.and(Alt,rJ),10);zne(GG,$ie,uhe,Alt,20,rJ);zne(qG,jie,Ste,Alt,30,rJ);zne($G,Qie,Ite,Alt,40,rJ);zne(KG,qie,dhe,Av.isEqualTo("session"),50);zne(qT,YG,v8,C.and(ZLt.toNegated(),Av.isEqualTo("session")),60);zne(LM,uQ,tW,C.and(ZLt,Av.isEqualTo("session")),60);var sUe=class extends Lh{constructor(e,t,o){super(cnt,{canAcceptInBackground:!0});this._debugService=e;this._viewsService=t;this._commandService=o}_getPicks(e,t,o){let n=[];this._debugService.getModel().getSessions(!0).filter(s=>s.hasSeparateRepl()).forEach((s,l)=>{let c=this._createPick(s,l,e);c&&n.push(c)}),n.length>0&&n.push({type:"separator"});let r=d(9552,null);return n.push({label:`$(plus) ${r}`,ariaLabel:r,accept:()=>this._commandService.executeCommand(cQ)}),n}_createPick(e,t,o){let n=e.name,r=lm(o,n,!0);if(r)return{label:n,highlights:{label:r},accept:(s,l)=>{this._debugService.focusStackFrame(void 0,void 0,e,{explicit:!0}),this._viewsService.isViewVisible(Td)||this._viewsService.openView(Td,!0)}}}};sUe=I([m(0,Ni),m(1,$t),m(2,ge)],sUe);var xWi={allowBreakpoint:!1,isBreakpointSet:!1,isBreakpointEnabled:!1,instructionReference:"",instructionOffset:0,instructionReferenceOffset:0,address:0n,instruction:{address:"-1",instruction:d(9712,null)}},i_=class extends Ts{constructor(e,t,o,n,r,s,l,c,u,p){super(jLt,e,t,o,n);this._configurationService=r;this._instantiationService=s;this._debugService=l;this._contextMenuService=c;this._instructionBpList=[];this._enableSourceCodeRender=!0;this._loadingLock=!1;this._referenceToMemoryAddress=new Map;this.menu=u.createMenu(D.DebugDisassemblyContext,p),this._register(this.menu),this._disassembledInstructions=void 0,this._onDidChangeStackFrame=this._register(new E({leakWarningThreshold:1e3})),this._previousDebuggingState=l.state,this._register(r.onDidChangeConfiguration(h=>{if(h.affectsConfiguration("debug")){let g=this._configurationService.getValue("debug").disassemblyView.showSourceCode;this._enableSourceCodeRender!==g?this._enableSourceCodeRender=g:this._disassembledInstructions?.rerender()}}))}static{this.NUM_INSTRUCTIONS_TO_LOAD=50}get fontInfo(){return this._fontInfo||(this._fontInfo=this.createFontInfo(),this._register(this._configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration("editor")&&(this._fontInfo=this.createFontInfo())}))),this._fontInfo}createFontInfo(){return QS(this._configurationService.getValue("editor"),bu.getInstance(this.window).value)}get currentInstructionAddresses(){return this._debugService.getModel().getSessions(!1).map(e=>e.getAllThreads()).reduce((e,t)=>e.concat(t),[]).map(e=>e.getTopStackFrame()).map(e=>e?.instructionPointerReference).map(e=>e?this.getReferenceAddress(e):void 0)}get focusedCurrentInstructionReference(){return this._debugService.getViewModel().focusedStackFrame?.thread.getTopStackFrame()?.instructionPointerReference}get focusedCurrentInstructionAddress(){let e=this.focusedCurrentInstructionReference;return e?this.getReferenceAddress(e):void 0}get focusedInstructionReference(){return this._debugService.getViewModel().focusedStackFrame?.instructionPointerReference}get focusedInstructionAddress(){let e=this.focusedInstructionReference;return e?this.getReferenceAddress(e):void 0}get isSourceCodeRender(){return this._enableSourceCodeRender}get debugSession(){return this._debugService.getViewModel().focusedSession}get onDidChangeStackFrame(){return this._onDidChangeStackFrame.event}get focusedAddressAndOffset(){let e=this._disassembledInstructions?.getFocusedElements()[0];if(e)return this.getAddressAndOffset(e)}getAddressAndOffset(e){let t=e.instructionReference,o=Number(e.address-this.getReferenceAddress(t));return{reference:t,offset:o,address:e.address}}createEditor(e){this._enableSourceCodeRender=this._configurationService.getValue("debug").disassemblyView.showSourceCode;let t=this.fontInfo.lineHeight,o=this,n=new class{constructor(){this.headerRowHeight=0}getHeight(s){return o.isSourceCodeRender&&s.showSourceLocation&&s.instruction.location?.path&&s.instruction.line?s.instruction.endLine?t*Math.max(2,s.instruction.endLine-s.instruction.line+2):t*2:t}},r=this._register(this._instantiationService.createInstance($W,this));this._disassembledInstructions=this._register(this._instantiationService.createInstance(MC,"DisassemblyView",e,n,[{label:"",tooltip:"",weight:0,minimumWidth:this.fontInfo.lineHeight,maximumWidth:this.fontInfo.lineHeight,templateId:Kne.TEMPLATE_ID,project(s){return s}},{label:d(9707,null),tooltip:"",weight:.3,templateId:$W.TEMPLATE_ID,project(s){return s}}],[this._instantiationService.createInstance(Kne,this),r],{identityProvider:{getId:s=>s.instruction.address},horizontalScrolling:!1,overrideStyles:{listBackground:Ho},multipleSelectionSupport:!1,setRowLineHeight:!1,openOnSingleClick:!1,accessibilityProvider:new kWi,mouseSupport:!1})),this._disassembledInstructions.domNode.classList.add("disassembly-view"),this.focusedInstructionReference&&this.reloadDisassembly(this.focusedInstructionReference,0),this._register(this._disassembledInstructions.onDidScroll(s=>{if(this._disassembledInstructions?.row(0)!==xWi&&!this._loadingLock)if(s.oldScrollTop>s.scrollTop&&s.scrollTop<s.height){this._loadingLock=!0;let l=Math.floor(s.scrollTop/this.fontInfo.lineHeight);this.scrollUp_LoadDisassembledInstructions(i_.NUM_INSTRUCTIONS_TO_LOAD).then(c=>{c>0&&this._disassembledInstructions.reveal(l+c,0)}).finally(()=>{this._loadingLock=!1})}else s.oldScrollTop<s.scrollTop&&s.scrollTop+s.height>s.scrollHeight-s.height&&(this._loadingLock=!0,this.scrollDown_LoadDisassembledInstructions(i_.NUM_INSTRUCTIONS_TO_LOAD).finally(()=>{this._loadingLock=!1}))})),this._register(this._disassembledInstructions.onContextMenu(s=>this.onContextMenu(s))),this._register(this._debugService.getViewModel().onDidFocusStackFrame(({stackFrame:s})=>{this._disassembledInstructions&&s?.instructionPointerReference&&this.goToInstructionAndOffset(s.instructionPointerReference,0),this._onDidChangeStackFrame.fire()})),this._register(this._debugService.getModel().onDidChangeBreakpoints(s=>{if(s&&this._disassembledInstructions){let l=!1;s.added?.forEach(c=>{if(c instanceof hI){let u=this.getIndexFromReferenceAndOffset(c.instructionReference,c.offset);u>=0&&(this._disassembledInstructions.row(u).isBreakpointSet=!0,this._disassembledInstructions.row(u).isBreakpointEnabled=c.enabled,l=!0)}}),s.removed?.forEach(c=>{if(c instanceof hI){let u=this.getIndexFromReferenceAndOffset(c.instructionReference,c.offset);u>=0&&(this._disassembledInstructions.row(u).isBreakpointSet=!1,l=!0)}}),s.changed?.forEach(c=>{if(c instanceof hI){let u=this.getIndexFromReferenceAndOffset(c.instructionReference,c.offset);u>=0&&this._disassembledInstructions.row(u).isBreakpointEnabled!==c.enabled&&(this._disassembledInstructions.row(u).isBreakpointEnabled=c.enabled,l=!0)}}),this._instructionBpList=this._debugService.getModel().getInstructionBreakpoints();for(let c of this._instructionBpList)this.primeMemoryReference(c.instructionReference);l&&this._onDidChangeStackFrame.fire()}})),this._register(this._debugService.onDidChangeState(s=>{(s===3||s===2)&&this._previousDebuggingState!==3&&this._previousDebuggingState!==2&&(this.clear(),this._enableSourceCodeRender=this._configurationService.getValue("debug").disassemblyView.showSourceCode),this._previousDebuggingState=s,this._onDidChangeStackFrame.fire()}))}layout(e){this._disassembledInstructions?.layout(e.height)}async goToInstructionAndOffset(e,t,o){let n=this._referenceToMemoryAddress.get(e);n===void 0&&(await this.loadDisassembledInstructions(e,0,-i_.NUM_INSTRUCTIONS_TO_LOAD,i_.NUM_INSTRUCTIONS_TO_LOAD*2),n=this._referenceToMemoryAddress.get(e)),n&&this.goToAddress(n+BigInt(t),o)}getReferenceAddress(e){return this._referenceToMemoryAddress.get(e)}goToAddress(e,t){if(!this._disassembledInstructions||!e)return!1;let o=this.getIndexFromAddress(e);return o>=0?(this._disassembledInstructions.reveal(o),t&&(this._disassembledInstructions.domFocus(),this._disassembledInstructions.setFocus([o])),!0):!1}async scrollUp_LoadDisassembledInstructions(e){let t=this._disassembledInstructions?.row(0);return t?this.loadDisassembledInstructions(t.instructionReference,t.instructionReferenceOffset,t.instructionOffset-e,e):0}async scrollDown_LoadDisassembledInstructions(e){let t=this._disassembledInstructions?.row(this._disassembledInstructions?.length-1);return t?this.loadDisassembledInstructions(t.instructionReference,t.instructionReferenceOffset,t.instructionOffset+1,e):0}async primeMemoryReference(e){if(this._referenceToMemoryAddress.has(e))return!0;let t=await this.debugSession?.disassemble(e,0,0,1);if(t&&t.length>0)try{return this._referenceToMemoryAddress.set(e,BigInt(t[0].address)),!0}catch{return!1}return!1}async loadDisassembledInstructions(e,t,o,n){let r=this.debugSession,s=await r?.disassemble(e,t,o,n);if(!this._referenceToMemoryAddress.has(e)&&o!==0&&await this.loadDisassembledInstructions(e,0,0,i_.NUM_INSTRUCTIONS_TO_LOAD),r&&s&&this._disassembledInstructions){let l=[],c,u;for(let O=0;O<s.length;O++){let V=s[O],H=o+O;if(V.location&&(c=V.location,u=void 0),V.line){let J={startLineNumber:V.line,startColumn:V.column??0,endLineNumber:V.endLine??V.line,endColumn:V.endColumn??0};z.equalsRange(J,u??null)||(u=J,V.location=c)}let G;try{G=BigInt(V.address)}catch{console.error(`Could not parse disassembly address ${V.address} (in ${JSON.stringify(V)})`);continue}if(G===-1n)continue;let $={allowBreakpoint:!0,isBreakpointSet:!1,isBreakpointEnabled:!1,instructionReference:e,instructionReferenceOffset:t,instructionOffset:H,instruction:V,address:G};l.push($),t===0&&H===0&&this._referenceToMemoryAddress.set(e,G)}if(l.length===0)return 0;let p=this._referenceToMemoryAddress.get(e),h=this._instructionBpList.map(O=>{let V=this._referenceToMemoryAddress.get(O.instructionReference);if(V)return{enabled:O.enabled,address:V+BigInt(O.offset||0)}});if(p!==void 0)for(let O of l){let V=h.find(H=>H?.address===O.address);V&&(O.isBreakpointSet=!0,O.isBreakpointEnabled=V.enabled)}let g=this._disassembledInstructions;g.length===1&&this._disassembledInstructions.row(0)===xWi&&g.splice(0,1);let f=l[0].address,v=l[l.length-1].address,b=aP(g.length,O=>Number(g.row(O).address-f)),S=b<0?~b:b,y=aP(g.length,O=>Number(g.row(O).address-v)),k=(y<0?~y:y+1)-S,T;for(let O=S-1;O>=0;O--){let{instruction:V}=g.row(O);if(V.location&&V.line!==void 0){T=V;break}}let P=O=>O.line!==void 0&&O.location!==void 0&&(!T||!Uto(O.location,T.location)||O.line!==T.line);for(let O of l)P(O.instruction)&&(O.showSourceLocation=!0,T=O.instruction);return g.splice(S,k,l),l.length-k}return 0}getIndexFromReferenceAndOffset(e,t){let o=this._referenceToMemoryAddress.get(e);return o===void 0?-1:this.getIndexFromAddress(o+BigInt(t))}getIndexFromAddress(e){let t=this._disassembledInstructions;return t&&t.length>0?aP(t.length,o=>{let n=t.row(o);return Number(n.address-e)}):-1}reloadDisassembly(e,t){this._disassembledInstructions&&(this._loadingLock=!0,this.clear(),this._instructionBpList=this._debugService.getModel().getInstructionBreakpoints(),this.loadDisassembledInstructions(e,t,-i_.NUM_INSTRUCTIONS_TO_LOAD*4,i_.NUM_INSTRUCTIONS_TO_LOAD*8).then(()=>{if(this._disassembledInstructions.length>0){let o,n=this._referenceToMemoryAddress.get(e);if(n!==void 0){let r=this._disassembledInstructions;o=aP(r.length,s=>Number(r.row(s).address-n)),o<0&&(o=~o)}o===void 0&&(o=Math.floor(this._disassembledInstructions.length/2)),this._disassembledInstructions.reveal(o,.5),this._disassembledInstructions.domFocus(),this._disassembledInstructions.setFocus([o])}this._loadingLock=!1}))}clear(){this._referenceToMemoryAddress.clear(),this._disassembledInstructions?.splice(0,this._disassembledInstructions.length,[xWi])}onContextMenu(e){let t=tu(this.menu.getActions({shouldForwardArgs:!0}));this._contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>t,getActionsContext:()=>e.element})}};i_=I([m(1,Te),m(2,Le),m(3,ce),m(4,B),m(5,F),m(6,Ni),m(7,Xe),m(8,Kt),m(9,X)],i_);var Kne=class{constructor(i,e){this._disassemblyView=i;this._debugService=e;this.templateId=Kne.TEMPLATE_ID;this._breakpointIcon="codicon-"+eW.regular.id;this._breakpointDisabledIcon="codicon-"+eW.disabled.id;this._breakpointHintIcon="codicon-"+Ltt.id;this._debugStackframe="codicon-"+lhe.id;this._debugStackframeFocused="codicon-"+che.id}static{this.TEMPLATE_ID="breakpoint"}renderTemplate(i){i.style.alignSelf="flex-end";let e=M(i,_(".codicon"));e.style.display="flex",e.style.alignItems="center",e.style.justifyContent="center",e.style.height=this._disassemblyView.fontInfo.lineHeight+"px";let t={element:void 0},o=[this._disassemblyView.onDidChangeStackFrame(()=>this.rerenderDebugStackframe(e,t.element)),Jo(i,"mouseover",()=>{t.element?.allowBreakpoint&&e.classList.add(this._breakpointHintIcon)}),Jo(i,"mouseout",()=>{t.element?.allowBreakpoint&&e.classList.remove(this._breakpointHintIcon)}),Jo(i,"click",()=>{if(t.element?.allowBreakpoint){e.classList.add(this._breakpointHintIcon);let n=t.element.instructionReference,r=Number(t.element.address-this._disassemblyView.getReferenceAddress(n));t.element.isBreakpointSet?this._debugService.removeInstructionBreakpoints(n,r):t.element.allowBreakpoint&&!t.element.isBreakpointSet&&this._debugService.addInstructionBreakpoint({instructionReference:n,offset:r,address:t.element.address,canPersist:!1})}})];return{currentElement:t,icon:e,disposables:o}}renderElement(i,e,t){t.currentElement.element=i,this.rerenderDebugStackframe(t.icon,i)}disposeTemplate(i){Be(i.disposables),i.disposables=[]}rerenderDebugStackframe(i,e){e?.address===this._disassemblyView.focusedCurrentInstructionAddress?i.classList.add(this._debugStackframe):e?.address===this._disassemblyView.focusedInstructionAddress?i.classList.add(this._debugStackframeFocused):(i.classList.remove(this._debugStackframe),i.classList.remove(this._debugStackframeFocused)),i.classList.remove(this._breakpointHintIcon),e?.isBreakpointSet?e.isBreakpointEnabled?(i.classList.add(this._breakpointIcon),i.classList.remove(this._breakpointDisabledIcon)):(i.classList.remove(this._breakpointIcon),i.classList.add(this._breakpointDisabledIcon)):(i.classList.remove(this._breakpointIcon),i.classList.remove(this._breakpointDisabledIcon))}};Kne=I([m(1,Ni)],Kne);var $W=class extends x{constructor(e,t,o,n,r,s){super();this._disassemblyView=e;this.editorService=o;this.textModelService=n;this.uriService=r;this.logService=s;this.templateId=$W.TEMPLATE_ID;this._topStackFrameColor=t.getColorTheme().getColor(_Fe),this._focusedStackFrameColor=t.getColorTheme().getColor(DFe),this._register(t.onDidColorThemeChange(l=>{this._topStackFrameColor=l.getColor(_Fe),this._focusedStackFrameColor=l.getColor(DFe)}))}static{this.TEMPLATE_ID="instruction"}static{this.INSTRUCTION_ADDR_MIN_LENGTH=25}static{this.INSTRUCTION_BYTES_MIN_LENGTH=30}renderTemplate(e){let t=M(e,_(".sourcecode")),o=M(e,_(".instruction"));this.applyFontInfo(t),this.applyFontInfo(o);let n={element:void 0},r=[],s=[this._disassemblyView.onDidChangeStackFrame(()=>this.rerenderBackground(o,t,n.element)),Jo(t,"dblclick",()=>this.openSourceCode(n.element?.instruction))];return{currentElement:n,instruction:o,sourcecode:t,cellDisposable:r,disposables:s}}renderElement(e,t,o){this.renderElementInner(e,t,o)}async renderElementInner(e,t,o){o.currentElement.element=e;let n=e.instruction;o.sourcecode.innerText="";let r=new $S(1e3);if(this._disassemblyView.isSourceCodeRender&&e.showSourceLocation&&n.location?.path&&n.line!==void 0){let l=this.getUriFromSource(n);if(l){let c,u=new $S(1e4),p=await this.textModelService.createModelReference(l);if(o.currentElement.element!==e)return;if(c=p.object.textEditorModel,o.cellDisposable.push(p),c&&o.currentElement.element===e){let h=n.line;for(;h&&h>=1&&h<=c.getLineCount();){let g=c.getLineContent(h);if(u.appendString(`  ${h}: `),u.appendString(g+`
`),n.endLine&&h<n.endLine){h++;continue}break}o.sourcecode.innerText=u.build()}}}let s=10;if(n.address!=="-1"){r.appendString(n.address),n.address.length<$W.INSTRUCTION_ADDR_MIN_LENGTH&&(s=$W.INSTRUCTION_ADDR_MIN_LENGTH-n.address.length);for(let l=0;l<s;l++)r.appendString(" ")}if(n.instructionBytes){r.appendString(n.instructionBytes),s=10,n.instructionBytes.length<$W.INSTRUCTION_BYTES_MIN_LENGTH&&(s=$W.INSTRUCTION_BYTES_MIN_LENGTH-n.instructionBytes.length);for(let l=0;l<s;l++)r.appendString(" ")}r.appendString(n.instruction),o.instruction.innerText=r.build(),this.rerenderBackground(o.instruction,o.sourcecode,e)}disposeElement(e,t,o){Be(o.cellDisposable),o.cellDisposable=[]}disposeTemplate(e){Be(e.disposables),e.disposables=[]}rerenderBackground(e,t,o){o&&this._disassemblyView.currentInstructionAddresses.includes(o.address)?e.style.background=this._topStackFrameColor?.toString()||"transparent":o?.address===this._disassemblyView.focusedInstructionAddress?e.style.background=this._focusedStackFrameColor?.toString()||"transparent":e.style.background="transparent"}openSourceCode(e){if(e){let t=this.getUriFromSource(e),o=e.endLine?{startLineNumber:e.line,endLineNumber:e.endLine,startColumn:e.column||1,endColumn:e.endColumn||1073741824}:{startLineNumber:e.line,endLineNumber:e.line,startColumn:e.column||1,endColumn:e.endColumn||1073741824};this.editorService.openEditor({resource:t,description:d(9709,null),options:{preserveFocus:!1,selection:o,revealIfOpened:!0,selectionRevealType:1,pinned:!1}})}}getUriFromSource(e){let t=e.location.path;return t&&pJ(t)?this.uriService.asCanonicalUri(A.parse(t)):t&&Zl(t)?this.uriService.asCanonicalUri(A.file(t)):I9e(e.location,e.location.path,this._disassemblyView.debugSession.getId(),this.uriService,this.logService)}applyFontInfo(e){Jd(e,this._disassemblyView.fontInfo),e.style.whiteSpace="pre"}};$W=I([m(1,Le),m(2,ee),m(3,Bt),m(4,ht),m(5,se)],$W);var kWi=class{getWidgetAriaLabel(){return d(9708,null)}getAriaLabel(i){let e="",t=i.instruction;return t.address!=="-1"&&(e+=`${d(9710,null)}: ${t.address}`),t.instructionBytes&&(e+=`, ${d(9711,null)}: ${t.instructionBytes}`),e+=`, ${d(9713,null)}: ${t.instruction}`,e}},aUe=class{constructor(i,e,t){t.bufferChangeEvents(()=>{this._languageSupportsDisassembleRequest=aRt.bindTo(t)});let o=()=>{this._onDidChangeModelLanguage&&(this._onDidChangeModelLanguage.dispose(),this._onDidChangeModelLanguage=void 0);let n=i.activeTextEditorControl;if(pn(n)){let r=n.getModel()?.getLanguageId();this._languageSupportsDisassembleRequest?.set(!!r&&e.getAdapterManager().someDebuggerInterestedInLanguage(r)),this._onDidChangeModelLanguage=n.onDidChangeModelLanguage(s=>{this._languageSupportsDisassembleRequest?.set(e.getAdapterManager().someDebuggerInterestedInLanguage(s.newLanguage))})}else this._languageSupportsDisassembleRequest?.set(!1)};o(),this._onDidActiveEditorChangeListener=i.onDidActiveEditorChange(o)}dispose(){this._onDidActiveEditorChangeListener.dispose(),this._onDidChangeModelLanguage?.dispose()}};aUe=I([m(0,ee),m(1,Ni),m(2,X)],aUe);$e.registerCommand({metadata:{description:HKt},id:FKt,handler:async(a,i)=>{i?.instruction?.address&&a.get(Fi).writeText(i.instruction.address)}});var EWi=class extends K{constructor(){super({id:WKt,title:{...L(9574,"Toggle Breakpoint"),mnemonicTitle:d(9567,null)},category:L(9556,"Debug"),f1:!0,precondition:Aa,keybinding:{when:C.or(pe.editorTextFocus,zK),primary:67,weight:100},menu:[{id:D.MenubarDebugMenu,when:Aa,group:"4_new_breakpoint",order:1}]})}async run(i,e){let t=i.get(ee),o=i.get(Ni),n=t.activeEditorPane;if(n instanceof i_){let l=e?n.getAddressAndOffset(e):n.focusedAddressAndOffset;if(l){let u=o.getModel().getInstructionBreakpoints().find(p=>p.address===l.address);u?o.removeInstructionBreakpoints(u.instructionReference,u.offset):o.addInstructionBreakpoint({instructionReference:l.reference,offset:l.offset,address:l.address,canPersist:!1})}return}let r=i.get(qt),s=r.getFocusedCodeEditor()||r.getActiveCodeEditor();if(s?.hasModel()){let l=s.getModel().uri,c=o.canSetBreakpointsIn(s.getModel()),u=[...new Set(s.getSelections().map(p=>p.getPosition().lineNumber))];await Promise.all(u.map(async p=>{let h=o.getModel().getBreakpoints({lineNumber:p,uri:l});h.length?await Promise.all(h.map(g=>o.removeBreakpoints(g.getId()))):c&&await o.addBreakpoints(l,[{lineNumber:p}])}))}}},TWi=class extends Di{constructor(){super({id:"editor.debug.action.conditionalBreakpoint",label:L(9555,"Debug: Add Conditional Breakpoint..."),precondition:Aa,menuOpts:{menuId:D.MenubarNewBreakpointMenu,title:d(9563,null),group:"1_breakpoints",order:1,when:Aa}})}async run(i,e){let t=i.get(Ni),o=e.getPosition();o&&e.hasModel()&&t.canSetBreakpointsIn(e.getModel())&&e.getContribution(aA)?.showBreakpointWidget(o.lineNumber,void 0,0)}},_Wi=class extends Di{constructor(){super({id:"editor.debug.action.addLogPoint",label:L(9562,"Debug: Add Logpoint..."),precondition:Aa,menuOpts:[{menuId:D.MenubarNewBreakpointMenu,title:d(9566,null),group:"1_breakpoints",order:4,when:Aa}]})}async run(i,e){let t=i.get(Ni),o=e.getPosition();o&&e.hasModel()&&t.canSetBreakpointsIn(e.getModel())&&e.getContribution(aA)?.showBreakpointWidget(o.lineNumber,o.column,2)}},DWi=class extends Di{constructor(){super({id:"editor.debug.action.triggerByBreakpoint",label:d(9577,null),precondition:Aa,alias:"Debug: Triggered Breakpoint...",menuOpts:[{menuId:D.MenubarNewBreakpointMenu,title:d(9569,null),group:"1_breakpoints",order:4,when:Aa}]})}async run(i,e){let t=i.get(Ni),o=e.getPosition();o&&e.hasModel()&&t.canSetBreakpointsIn(e.getModel())&&e.getContribution(aA)?.showBreakpointWidget(o.lineNumber,o.column,3)}},LWi=class extends Di{constructor(){super({id:"editor.debug.action.editBreakpoint",label:d(9557,null),alias:"Debug: Edit Existing Breakpoint",precondition:Aa,menuOpts:{menuId:D.MenubarNewBreakpointMenu,title:d(9565,null),group:"1_breakpoints",order:1,when:Aa}})}async run(i,e){let t=i.get(Ni),o=e.getPosition(),n=t.getModel();if(!(e.hasModel()&&o))return;let r=n.getBreakpoints({lineNumber:o.lineNumber});if(r.length===0)return;let s=r.map(u=>u.column?Math.abs(u.column-o.column):o.column),l=s.indexOf(Math.min(...s)),c=r[l];e.getContribution(aA)?.showBreakpointWidget(c.lineNumber,c.column)}},RWi=class a extends K{static{this.ID="debug.action.openDisassemblyView"}constructor(){super({id:a.ID,title:{...L(9570,"Open Disassembly View"),mnemonicTitle:d(9564,null)},precondition:lRt,menu:[{id:D.EditorContext,group:"debug",order:5,when:C.and(sl,Xde.toNegated(),Zs.isEqualTo("stopped"),pe.editorTextFocus,STe,aRt)},{id:D.DebugCallStackContext,group:"z_commands",order:50,when:C.and(sl,Zs.isEqualTo("stopped"),Av.isEqualTo("stackFrame"),STe)},{id:D.CommandPalette,when:C.and(sl,Zs.isEqualTo("stopped"),STe)}]})}run(i){i.get(ee).openEditor(GR.instance,{pinned:!0,revealIfOpened:!0})}},MWi=class a extends K{static{this.ID="debug.action.toggleDisassemblyViewSourceCode"}static{this.configID="debug.disassemblyView.showSourceCode"}constructor(){super({id:a.ID,title:{...L(9575,"Toggle Source Code in Disassembly View"),mnemonicTitle:d(9568,null)},metadata:{description:L(9576,"Shows or hides source code in disassembly")},f1:!0})}run(i,e,...t){let o=i.get(B);if(o){let n=o.getValue("debug").disassemblyView.showSourceCode;o.updateValue(a.configID,!n)}}},lUe=class a extends Di{static{this.ID="editor.debug.action.runToCursor"}static{this.LABEL=L(9571,"Run to Cursor")}constructor(){super({id:a.ID,label:a.LABEL.value,alias:"Debug: Run to Cursor",precondition:C.and(Aa,Xde.toNegated(),C.or(pe.editorTextFocus,zK),ie.inChatSession.negate()),contextMenuOpts:{group:"debug",order:2,when:sl}})}async run(i,e){let t=e.getPosition();if(!(e.hasModel()&&t))return;let o=e.getModel().uri,n=i.get(Ni),r=n.getViewModel(),s=i.get(ht),l,c=r.focusedStackFrame;c&&s.extUri.isEqual(c.source.uri,o)&&c.range.startLineNumber===t.lineNumber&&(l=t.column),await n.runTo(o,t.lineNumber,l)}},cUe=class a extends Di{static{this.ID="editor.debug.action.selectionToRepl"}static{this.LABEL=L(9559,"Evaluate in Debug Console")}constructor(){super({id:a.ID,label:a.LABEL.value,alias:"Debug: Evaluate in Console",precondition:C.and(sl,pe.editorTextFocus,ie.inChatSession.negate()),contextMenuOpts:{group:"debug",order:0}})}async run(i,e){let t=i.get(Ni),o=i.get($t),r=t.getViewModel().focusedSession;if(!e.hasModel()||!r)return;let s=e.getSelection(),l;s.isEmpty()?l=e.getModel().getLineContent(s.selectionStartLineNumber).trim():l=e.getModel().getValueInRange(s),(await o.openView(Td,!1))?.sendReplInput(l)}},dUe=class a extends Di{static{this.ID="editor.debug.action.selectionToWatch"}static{this.LABEL=L(9553,"Add to Watch")}constructor(){super({id:a.ID,label:a.LABEL.value,alias:"Debug: Add to Watch",precondition:C.and(sl,pe.editorTextFocus,ie.inChatSession.negate()),contextMenuOpts:{group:"debug",order:1}})}async run(i,e){let t=i.get(Ni),o=i.get($t),n=i.get(Qt);if(!e.hasModel())return;let r,s=e.getModel(),l=e.getSelection();if(!l.isEmpty())r=s.getValueInRange(l);else{let c=e.getPosition(),u=await pRt(n,s,c);if(!u)return;r=u.matchingExpression}r&&(await o.openView(Ik),t.addWatchExpression(r))}},PWi=class extends Di{constructor(){super({id:"editor.debug.action.showDebugHover",label:L(9572,"Debug: Show Hover"),precondition:sl,kbOpts:{kbExpr:pe.editorTextFocus,primary:Vi(2089,2087),weight:100}})}async run(i,e){let t=e.getPosition();if(!(!t||!e.hasModel()))return e.getContribution(RB)?.showHover(t,!0)}},ATo=d(9558,null),AWi=class a extends Di{static{this.ID="editor.debug.action.stepIntoTargets"}static{this.LABEL=d(9573,null)}constructor(){super({id:a.ID,label:a.LABEL,alias:"Debug: Step Into Target",precondition:C.and(aJ,sl,Zs.isEqualTo("stopped"),pe.editorTextFocus),contextMenuOpts:{group:"debug",order:1.5}})}async run(i,e){let t=i.get(Ni),o=i.get(Xe),n=i.get(ht),r=t.getViewModel().focusedSession,s=t.getViewModel().focusedStackFrame,l=e.getSelection(),c=l?.getPosition()||s&&{lineNumber:s.range.startLineNumber,column:s.range.startColumn};if(!r||!s||!e.hasModel()||!n.extUri.isEqual(e.getModel().uri,s.source.uri)){c&&xu.get(e)?.showMessage(ATo,c);return}let u=await r.stepInTargets(s.frameId);if(!u?.length){xu.get(e)?.showMessage(ATo,c);return}if(l){let v=[];for(let y of u)y.line&&v.push({start:new ye(y.line,y.column||1),end:y.endLine?new ye(y.endLine,y.endColumn||1):void 0,target:y});v.sort((y,w)=>w.start.lineNumber-y.start.lineNumber||w.start.column-y.start.column);let b=l.getPosition(),S=v.find(y=>y.end&&b.isBefore(y.end)&&y.start.isBeforeOrEqual(b))||v.find(y=>y.end===void 0&&y.start.isBeforeOrEqual(b));if(S){r.stepIn(s.thread.threadId,S.target.id);return}}e.revealLineInCenterIfOutsideViewport(s.range.startLineNumber);let p=e.getScrolledVisiblePosition(c),h=ir(e.getDomNode()),g=h.left+p.left,f=h.top+p.top+p.height;o.showContextMenu({getAnchor:()=>({x:g,y:f}),getActions:()=>u.map(v=>ii({id:`stepIntoTarget:${v.id}`,label:v.label,enabled:!0,run:()=>r.stepIn(s.thread.threadId,v.id)}))})}},w4t=class extends Di{constructor(e,t){super(t);this.isNext=e}async run(e,t){let o=e.get(Ni),n=e.get(ee),r=e.get(ht);if(t.hasModel()){let s=t.getModel().uri,l=t.getPosition().lineNumber,c=o.getModel().getBreakpoints({enabledOnly:!0}),u=this.isNext?c.filter(p=>r.extUri.isEqual(p.uri,s)&&p.lineNumber>l).shift():c.filter(p=>r.extUri.isEqual(p.uri,s)&&p.lineNumber<l).pop();if(u||(u=this.isNext?c.filter(p=>p.uri.toString()>s.toString()).shift():c.filter(p=>p.uri.toString()<s.toString()).pop()),!u&&c.length&&(u=this.isNext?c[0]:c[c.length-1]),u)return iFe(u,!1,!0,!1,o,n)}}},NWi=class extends w4t{constructor(){super(!0,{id:"editor.debug.action.goToNextBreakpoint",label:L(9560,"Debug: Go to Next Breakpoint"),precondition:Aa})}},OWi=class extends w4t{constructor(){super(!1,{id:"editor.debug.action.goToPreviousBreakpoint",label:L(9561,"Debug: Go to Previous Breakpoint"),precondition:Aa})}},FWi=class extends Di{constructor(){super({id:"editor.debug.action.closeExceptionWidget",label:L(9554,"Close Exception Widget"),precondition:rRt,kbOpts:{primary:9,weight:100}})}async run(i,e){e.getContribution(RB)?.closeExceptionWidget()}};W(RWi);W(MWi);W(EWi);ni(TWi);ni(_Wi);ni(DWi);ni(LWi);ni(lUe);ni(AWi);ni(cUe);ni(dUe);ni(PWi);ni(NWi);ni(OWi);ni(FWi);var uUe=class{constructor(i,e,t){this.toDispose=[];let o,n=r=>{o&&(o.dispose(),o=void 0),r&&(o=r.onDidProgressStart(async s=>{let l=new Promise(u=>{let p=U.any(U.filter(r.onDidProgressEnd,h=>h.body.progressId===s.body.progressId),r.onDidEndAdapter)(()=>{p.dispose(),u()})});t.isViewContainerVisible(cg)&&e.withProgress({location:cg},()=>l);let c=i.getAdapterManager().getDebuggerLabel(r.configuration.type);e.withProgress({location:15,title:s.body.title,cancellable:s.body.cancellable,source:c,delay:500},u=>{let p=0,h=f=>{let v;typeof f.percentage=="number"&&(v=f.percentage-p,p+=v),u.report({message:f.message,increment:v,total:typeof v=="number"?100:void 0})};s.body.message&&h(s.body);let g=r.onDidProgressUpdate(f=>{f.body.progressId===s.body.progressId&&h(f.body)});return l.then(()=>g.dispose())},()=>r.cancel(s.body.progressId))}))};this.toDispose.push(i.getViewModel().onDidFocusSession(n)),n(i.getViewModel().focusedSession),this.toDispose.push(i.onWillNewSession(r=>{o||n(r)}))}dispose(){Be(this.toDispose)}};uUe=I([m(0,Ni),m(1,Fo),m(2,$t)],uUe);var pUe=class extends Lh{constructor(e,t,o,n){super(lnt,{noResultsPick:{label:d(9646,null)}});this.debugService=e;this.contextService=t;this.commandService=o;this.notificationService=n}async _getPicks(e){let t=[];if(!this.debugService.getAdapterManager().hasEnabledDebuggers())return[];t.push({type:"separator",label:"launch.json"});let o=this.debugService.getConfigurationManager(),n=o.selectedConfiguration,r;for(let c of o.getAllConfigurations()){let u=lm(e,c.name,!0);if(u){let p={label:c.name,description:this.contextService.getWorkbenchState()===3?c.launch.name:"",highlights:{label:u},buttons:[{iconClass:q.asClassName(RPe),tooltip:d(9644,null)}],trigger:()=>(c.launch.openConfigFile({preserveFocus:!1}),1),accept:async()=>{await o.selectConfiguration(c.launch,c.name);try{await this.debugService.startDebugging(c.launch,void 0,{startedByUser:!0})}catch(h){this.notificationService.error(h)}}};if(n.name===c.name&&n.launch===c.launch){let h={type:"separator",label:d(9645,null)};t.unshift(h,p);continue}r!==c.presentation?.group&&(t.push({type:"separator"}),r=c.presentation?.group),t.push(p)}}let s=await o.getDynamicProviders();s.length>0&&t.push({type:"separator",label:d(9643,null)}),o.getRecentDynamicConfigurations().forEach(({name:c,type:u})=>{let p=lm(e,c,!0);p&&t.push({label:c,highlights:{label:p},buttons:[{iconClass:q.asClassName(dho),tooltip:d(9648,null)}],trigger:()=>(o.removeRecentDynamicConfigurations(c,u),1),accept:async()=>{await o.selectConfiguration(void 0,c,void 0,{type:u});try{let{launch:h,getConfig:g}=o.selectedConfiguration,f=await g();await this.debugService.startDebugging(h,f,{startedByUser:!0})}catch(h){this.notificationService.error(h)}}})}),s.forEach(c=>{t.push({label:`$(folder) ${c.label}...`,ariaLabel:d(9647,null,c.label),accept:async()=>{let u=await c.pick();u&&(await o.selectConfiguration(u.launch,u.config.name,u.config,{type:c.type}),this.debugService.startDebugging(u.launch,u.config,{startedByUser:!0}))}})});let l=o.getLaunches().filter(c=>!c.hidden);l.length>0&&t.push({type:"separator",label:d(9642,null)});for(let c of l){let u=this.contextService.getWorkbenchState()===3?d(9640,null,c.name):d(9641,null);t.push({label:u,description:this.contextService.getWorkbenchState()===3?c.name:"",highlights:{label:lm(e,u,!0)??void 0},accept:()=>this.commandService.executeCommand(Age,c.uri.toString())})}return t}};pUe=I([m(0,Ni),m(1,Pe),m(2,ge),m(3,Ne)],pUe);var C4t=class{constructor(){this.stopped=!1;this.stopEmitter=new E;this.onDidSessionStop=this.stopEmitter.event}sessionStopped(){this.stopped||(this.stopped=!0,this.stopEmitter.fire())}};var x4t="debug.breakpoint",k4t="debug.functionbreakpoint",E4t="debug.databreakpoint",T4t="debug.exceptionbreakpoint",_4t="debug.watchexpressions",NTo="debug.chosenenvironment",OTo="debug.uxstate",mUe=class extends x{constructor(e,t,o,n){super();this.storageService=e;this.textFileService=t;this.uriIdentityService=o;this.logService=n;this.breakpoints=Me(this,this.loadBreakpoints()),this.functionBreakpoints=Me(this,this.loadFunctionBreakpoints()),this.exceptionBreakpoints=Me(this,this.loadExceptionBreakpoints()),this.dataBreakpoints=Me(this,this.loadDataBreakpoints()),this.watchExpressions=Me(this,this.loadWatchExpressions()),this._register(e.onDidChangeValue(1,void 0,this._store)(r=>{if(r.external)switch(r.key){case x4t:return this.breakpoints.set(this.loadBreakpoints(),void 0);case k4t:return this.functionBreakpoints.set(this.loadFunctionBreakpoints(),void 0);case T4t:return this.exceptionBreakpoints.set(this.loadExceptionBreakpoints(),void 0);case E4t:return this.dataBreakpoints.set(this.loadDataBreakpoints(),void 0);case _4t:return this.watchExpressions.set(this.loadWatchExpressions(),void 0)}}))}loadDebugUxState(){return this.storageService.get(OTo,1,"default")}storeDebugUxState(e){this.storageService.store(OTo,e,1,1)}loadBreakpoints(){let e;try{e=JSON.parse(this.storageService.get(x4t,1,"[]")).map(t=>(t.uri=A.revive(t.uri),new Nv(t,this.textFileService,this.uriIdentityService,this.logService,t.id)))}catch{}return e||[]}loadFunctionBreakpoints(){let e;try{e=JSON.parse(this.storageService.get(k4t,1,"[]")).map(t=>new mI(t,t.id))}catch{}return e||[]}loadExceptionBreakpoints(){let e;try{e=JSON.parse(this.storageService.get(T4t,1,"[]")).map(t=>new dA(t,t.id))}catch{}return e||[]}loadDataBreakpoints(){let e;try{e=JSON.parse(this.storageService.get(E4t,1,"[]")).map(t=>new hy(t,t.id))}catch{}return e||[]}loadWatchExpressions(){let e;try{e=JSON.parse(this.storageService.get(_4t,1,"[]")).map(t=>new dd(t.name,t.id))}catch{}return e||[]}loadChosenEnvironments(){let e=JSON.parse(this.storageService.get(NTo,1,"{}"));return HIe(e,t=>typeof t=="string"?{type:t}:t)}storeChosenEnvironments(e){this.storageService.store(NTo,JSON.stringify(e),1,1)}storeWatchExpressions(e){e.length?this.storageService.store(_4t,JSON.stringify(e.map(t=>({name:t.name,id:t.getId()}))),1,1):this.storageService.remove(_4t,1)}storeBreakpoints(e){let t=e.getBreakpoints();t.length?this.storageService.store(x4t,JSON.stringify(t),1,1):this.storageService.remove(x4t,1);let o=e.getFunctionBreakpoints();o.length?this.storageService.store(k4t,JSON.stringify(o),1,1):this.storageService.remove(k4t,1);let n=e.getDataBreakpoints().filter(s=>s.canPersist);n.length?this.storageService.store(E4t,JSON.stringify(n),1,1):this.storageService.remove(E4t,1);let r=e.getExceptionBreakpoints();r.length?this.storageService.store(T4t,JSON.stringify(r),1,1):this.storageService.remove(T4t,1)}};mUe=I([m(0,ce),m(1,Uo),m(2,ht),m(3,se)],mUe);var hUe=class{constructor(i,e){this.model=i;this.telemetryService=e}logDebugSessionStart(i,e){let t=i.getMainExtensionDescriptor();this.telemetryService.publicLog("debugSessionStart",{type:i.type,breakpointCount:this.model.getBreakpoints().length,exceptionBreakpoints:this.model.getExceptionBreakpoints(),watchExpressionsCount:this.model.getWatchExpressions().length,extensionName:t.identifier.value,isBuiltin:t.isBuiltin,launchJsonExists:e})}logDebugSessionStop(i,e){let t=this.model.getBreakpoints();this.telemetryService.publicLog("debugSessionStop",{type:i&&i.configuration.type,success:e.emittedStopped||t.length===0,sessionLengthInSeconds:e.sessionLengthInSeconds,breakpointCount:t.length,watchExpressionsCount:this.model.getWatchExpressions().length})}};hUe=I([m(1,Te)],hUe);var D4t=class extends x{constructor(e){super();this.contextKeyService=e;this.firstSessionStart=!0;this._onDidFocusSession=this._register(new E);this._onDidFocusThread=this._register(new E);this._onDidFocusStackFrame=this._register(new E);this._onDidSelectExpression=this._register(new E);this._onDidEvaluateLazyExpression=this._register(new E);this._onWillUpdateViews=this._register(new E);this._onDidChangeVisualization=this._register(new E);this.visualized=new WeakMap;this.preferredVisualizers=new Map;e.bufferChangeEvents(()=>{this.expressionSelectedContextKey=nJ.bindTo(e),this.loadedScriptsSupportedContextKey=m9e.bindTo(e),this.stepBackSupportedContextKey=h9e.bindTo(e),this.focusedSessionIsAttach=zC.bindTo(e),this.focusedSessionIsNoDebug=HK.bindTo(e),this.restartFrameSupportedContextKey=tRt.bindTo(e),this.stepIntoTargetsSupported=aJ.bindTo(e),this.jumpToCursorSupported=sue.bindTo(e),this.setVariableSupported=g9e.bindTo(e),this.setDataBreakpointAtByteSupported=vTe.bindTo(e),this.setExpressionSupported=f9e.bindTo(e),this.multiSessionDebug=sRt.bindTo(e),this.terminateDebuggeeSupported=sA.bindTo(e),this.suspendDebuggeeSupported=dJ.bindTo(e),this.terminateThreadsSupported=v9e.bindTo(e),this.disassembleRequestSupported=STe.bindTo(e),this.focusedStackFrameHasInstructionPointerReference=lRt.bindTo(e)})}getId(){return"root"}get focusedSession(){return this._focusedSession}get focusedThread(){return this._focusedThread}get focusedStackFrame(){return this._focusedStackFrame}setFocus(e,t,o,n){let r=this._focusedStackFrame!==e,s=this._focusedSession!==o,l=this._focusedThread!==t;this._focusedStackFrame=e,this._focusedThread=t,this._focusedSession=o,this.contextKeyService.bufferChangeEvents(()=>{this.loadedScriptsSupportedContextKey.set(!!o?.capabilities.supportsLoadedSourcesRequest),this.stepBackSupportedContextKey.set(!!o?.capabilities.supportsStepBack),this.restartFrameSupportedContextKey.set(!!o?.capabilities.supportsRestartFrame),this.stepIntoTargetsSupported.set(!!o?.capabilities.supportsStepInTargetsRequest),this.jumpToCursorSupported.set(!!o?.capabilities.supportsGotoTargetsRequest),this.setVariableSupported.set(!!o?.capabilities.supportsSetVariable),this.setDataBreakpointAtByteSupported.set(!!o?.capabilities.supportsDataBreakpointBytes),this.setExpressionSupported.set(!!o?.capabilities.supportsSetExpression),this.terminateDebuggeeSupported.set(!!o?.capabilities.supportTerminateDebuggee),this.suspendDebuggeeSupported.set(!!o?.capabilities.supportSuspendDebuggee),this.terminateThreadsSupported.set(!!o?.capabilities.supportsTerminateThreadsRequest),this.disassembleRequestSupported.set(!!o?.capabilities.supportsDisassembleRequest),this.focusedStackFrameHasInstructionPointerReference.set(!!e?.instructionPointerReference);let c=!!o&&cue(o);this.focusedSessionIsAttach.set(c),this.focusedSessionIsNoDebug.set(!!o&&!!o.configuration.noDebug)}),s&&this._onDidFocusSession.fire(o),r?this._onDidFocusStackFrame.fire({stackFrame:e,explicit:n,session:o}):l&&this._onDidFocusThread.fire({thread:t,explicit:n,session:o})}get onDidFocusSession(){return this._onDidFocusSession.event}get onDidFocusThread(){return this._onDidFocusThread.event}get onDidFocusStackFrame(){return this._onDidFocusStackFrame.event}get onDidChangeVisualization(){return this._onDidChangeVisualization.event}getSelectedExpression(){return this.selectedExpression}setSelectedExpression(e,t){this.selectedExpression=e?{expression:e,settingWatch:t}:void 0,this.expressionSelectedContextKey.set(!!e),this._onDidSelectExpression.fire(this.selectedExpression)}get onDidSelectExpression(){return this._onDidSelectExpression.event}get onDidEvaluateLazyExpression(){return this._onDidEvaluateLazyExpression.event}updateViews(){this._onWillUpdateViews.fire()}get onWillUpdateViews(){return this._onWillUpdateViews.event}isMultiSessionView(){return!!this.multiSessionDebug.get()}setMultiSessionView(e){this.multiSessionDebug.set(e)}setVisualizedExpression(e,t){let o=this.visualized.get(e)||e,n=this.getPreferredVisualizedKey(e);t?(this.visualized.set(e,t),this.preferredVisualizers.set(n,t.treeId)):(this.visualized.delete(e),this.preferredVisualizers.delete(n)),this._onDidChangeVisualization.fire({original:o,replacement:t||e})}getVisualizedExpression(e){return this.visualized.get(e)||this.preferredVisualizers.get(this.getPreferredVisualizedKey(e))}async evaluateLazyExpression(e){await e.evaluateLazy(),this._onDidEvaluateLazyExpression.fire(e)}getPreferredVisualizedKey(e){return JSON.stringify([e.name,e.type,!!e.memoryReference].join("\0"))}};var gUe=class{constructor(i,e){this.breakpointContribution=i;this.contextKeyService=e;this.breakpointsWhen=typeof i.when=="string"?C.deserialize(i.when):void 0}get language(){return this.breakpointContribution.language}get enabled(){return!this.breakpointsWhen||this.contextKeyService.contextMatchesRules(this.breakpointsWhen)}};gUe=I([m(1,X)],gUe);function L4t(a){a.pattern=a.pattern||"^(?!.*\\$\\{(env|config|command)\\.)",a.patternErrorMessage=a.patternErrorMessage||d(17483,null)}var fUe=class{constructor(i,e,t,o,n,r,s,l,c,u){this.adapterManager=i;this.configurationService=o;this.resourcePropertiesService=n;this.configurationResolverService=r;this.environmentService=s;this.debugService=l;this.contextKeyService=c;this.productService=u;this.mergedExtensionDescriptions=[];this.debuggerContribution={type:e.type},this.merge(e,t),this.debuggerWhen=typeof this.debuggerContribution.when=="string"?C.deserialize(this.debuggerContribution.when):void 0,this.debuggerHiddenWhen=typeof this.debuggerContribution.hiddenWhen=="string"?C.deserialize(this.debuggerContribution.hiddenWhen):void 0}merge(i,e){function t(o,n,r,s=0){return xi(o)?(xi(n)&&Object.keys(n).forEach(l=>{l!=="__proto__"&&(xi(o[l])&&xi(n[l])?t(o[l],n[l],r,s+1):l in o?r&&(s===0&&l==="type"||(o[l]=n[l])):o[l]=n[l])}),o):n}this.mergedExtensionDescriptions.indexOf(e)<0&&(this.mergedExtensionDescriptions.push(e),t(this.debuggerContribution,i,e.isBuiltin),Oto(i)&&(this.mainExtensionDescription=e))}async startDebugging(i,e){let t=this.debugService.getModel().getSession(e);return await this.debugService.startDebugging(void 0,i,{parentSession:t},void 0)}async createDebugAdapter(i){await this.adapterManager.activateDebuggers("onDebugAdapterProtocolTracker",this.type);let e=this.adapterManager.createDebugAdapter(i);if(e)return Promise.resolve(e);throw new Error(d(9909,null,this.type))}async substituteVariables(i,e){let t=await this.adapterManager.substituteVariables(this.type,i,e);return await this.configurationResolverService.resolveWithInteractionReplace(i,t,"launch",this.variables,t.__configurationTarget)}runInTerminal(i,e){return this.adapterManager.runInTerminal(this.type,i,e)}get label(){return this.debuggerContribution.label||this.debuggerContribution.type}get type(){return this.debuggerContribution.type}get variables(){return this.debuggerContribution.variables}get configurationSnippets(){return this.debuggerContribution.configurationSnippets}get languages(){return this.debuggerContribution.languages}get when(){return this.debuggerWhen}get hiddenWhen(){return this.debuggerHiddenWhen}get enabled(){return!this.debuggerWhen||this.contextKeyService.contextMatchesRules(this.debuggerWhen)}get isHiddenFromDropdown(){return this.debuggerHiddenWhen?this.contextKeyService.contextMatchesRules(this.debuggerHiddenWhen):!1}get strings(){return this.debuggerContribution.strings??this.debuggerContribution.uiMessages}interestedInLanguage(i){return!!(this.languages&&this.languages.indexOf(i)>=0)}hasInitialConfiguration(){return!!this.debuggerContribution.initialConfigurations}hasDynamicConfigurationProviders(){return this.debugService.getConfigurationManager().hasDebugConfigurationProvider(this.type,2)}hasConfigurationProvider(){return this.debugService.getConfigurationManager().hasDebugConfigurationProvider(this.type)}getInitialConfigurationContent(i){let e=this.debuggerContribution.initialConfigurations||[];i&&(e=e.concat(i));let t=this.resourcePropertiesService.getEOL(A.from({scheme:Q.untitled,path:"1"}))===`\r
`?`\r
`:`
`,o=JSON.stringify(e,null,"	").split(`
`).map(u=>"	"+u).join(t).trim(),n=d(9916,null),r=d(9917,null),s=d(9918,null,"https://go.microsoft.com/fwlink/?linkid=830387"),l=["{",`	// ${n}`,`	// ${r}`,`	// ${s}`,'	"version": "0.2.0",',`	"configurations": ${o}`,"}"].join(t),c=this.configurationService.getValue();return c.editor&&c.editor.insertSpaces&&(l=l.replace(new RegExp("	","g")," ".repeat(c.editor.tabSize))),Promise.resolve(l)}getMainExtensionDescriptor(){return this.mainExtensionDescription||this.mergedExtensionDescriptions[0]}getCustomTelemetryEndpoint(){let i=this.debuggerContribution.aiKey;if(!i)return;let e=RTt(this.environmentService.remoteAuthority,this.productService)!=="other";return{id:`${this.getMainExtensionDescriptor().publisher}.${this.type}`,aiKey:i,sendErrorTelemetry:e}}getSchemaAttributes(i){return this.debuggerContribution.configurationAttributes?Object.entries(this.debuggerContribution.configurationAttributes).map(([e,t])=>{let o=`${this.type}:${e}`,n=`${this.type}:${e}:platform`,r=["name","type","request"];t.required=t.required&&t.required.length?r.concat(t.required):r,t.additionalProperties=!1,t.type="object",t.properties||(t.properties={});let s=t.properties;s.type={enum:[this.type],enumDescriptions:[this.label],description:d(9913,null),pattern:"^(?!node2)",deprecationMessage:this.debuggerContribution.deprecated||(this.enabled?void 0:cRt(this.type)),doNotSuggest:!!this.debuggerContribution.deprecated,errorMessage:d(9914,null),patternErrorMessage:d(9919,null)},s.request={enum:[e],description:d(9912,null)};for(let c in i.common.properties)s[c]={$ref:`#/definitions/common/properties/${c}`};Object.keys(s).forEach(c=>{L4t(s[c])}),i[o]={...t},i[n]={type:"object",additionalProperties:!1,properties:IP(s,c=>c!=="type"&&c!=="request"&&c!=="name")};let l={...t};return l.properties={...s,windows:{$ref:`#/definitions/${n}`,description:d(9915,null)},osx:{$ref:`#/definitions/${n}`,description:d(9911,null)},linux:{$ref:`#/definitions/${n}`,description:d(9910,null)}},l}):null}};fUe=I([m(3,B),m(4,KL),m(5,Tp),m(6,At),m(7,Ni),m(8,X),m(9,tt)],fUe);var VTo=Rn.registerExtensionPoint({extensionPoint:"debuggers",defaultExtensionKind:["workspace"],jsonSchema:{description:d(9950,null),type:"array",defaultSnippets:[{body:[{type:""}]}],items:{additionalProperties:!1,type:"object",defaultSnippets:[{body:{type:"",program:"",runtime:""}}],properties:{type:{description:d(9968,null),type:"string"},label:{description:d(9957,null),type:"string"},program:{description:d(9963,null),type:"string"},args:{description:d(9951,null),type:"array"},runtime:{description:d(9964,null),type:"string"},runtimeArgs:{description:d(9965,null),type:"array"},variables:{description:d(9969,null),type:"object"},initialConfigurations:{description:d(9956,null),type:["array","string"]},languages:{description:d(9958,null),type:"array"},configurationSnippets:{description:d(9953,null),type:"array"},configurationAttributes:{description:d(9952,null),type:"object"},when:{description:d(9970,null),type:"string",default:""},hiddenWhen:{description:d(9955,null),type:"string",default:""},deprecated:{description:d(9954,null),type:"string",default:""},windows:{description:d(9971,null),type:"object",properties:{runtime:{description:d(9972,null),type:"string"}}},osx:{description:d(9961,null),type:"object",properties:{runtime:{description:d(9962,null),type:"string"}}},linux:{description:d(9959,null),type:"object",properties:{runtime:{description:d(9960,null),type:"string"}}},strings:{description:d(9966,null),type:"object",properties:{unverifiedBreakpoints:{description:d(9967,null),type:"string"}}}}}}}),BTo=Rn.registerExtensionPoint({extensionPoint:"breakpoints",jsonSchema:{description:d(9947,null),type:"array",defaultSnippets:[{body:[{language:""}]}],items:{type:"object",additionalProperties:!1,defaultSnippets:[{body:{language:""}}],properties:{language:{description:d(9948,null),type:"string"},when:{description:d(9949,null),type:"string",default:""}}}}}),VWi={type:"object",description:d(9942,null),properties:{hidden:{type:"boolean",default:!1,description:d(9944,null)},group:{type:"string",default:"",description:d(9943,null)},order:{type:"number",default:1,description:d(9945,null)}},default:{hidden:!1,group:"",order:1}},WTo={name:"Compound",configurations:[]},Gne={id:cH,type:"object",title:d(9936,null),allowTrailingCommas:!0,allowComments:!0,required:[],default:{version:"0.2.0",configurations:[],compounds:[]},properties:{version:{type:"string",description:d(9937,null),default:"0.2.0"},configurations:{type:"array",description:d(9935,null),items:{defaultSnippets:[],type:"object",oneOf:[]}},compounds:{type:"array",description:d(9933,null),items:{type:"object",required:["name","configurations"],properties:{name:{type:"string",description:d(9931,null)},presentation:VWi,configurations:{type:"array",default:[],items:{oneOf:[{enum:[],description:d(9946,null)},{type:"object",required:["name"],properties:{name:{enum:[],description:d(9931,null)},folder:{enum:[],description:d(9930,null)}}}]},description:d(9934,null)},stopAll:{type:"boolean",default:!1,description:d(9932,null)},preLaunchTask:{type:"string",default:"",description:d(9938,null)}},default:WTo},default:[WTo]},inputs:qMe.definitions.inputs}},WWi=class extends x{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.debuggers}render(e){let t=e.contributes?.debuggers||[];if(!t.length)return{data:{headers:[],rows:[]},dispose:()=>{}};let o=[d(9939,null),d(9940,null)],n=t.map(r=>[r.label??"",r.type]);return{data:{headers:o,rows:n},dispose:()=>{}}}};ne.as(As.ExtensionFeaturesRegistry).registerExtensionFeature({id:"debuggers",label:d(9941,null),access:{canToggle:!1},renderer:new Ft(WWi)});var Pmn=ne.as(ma.JSONContribution),vUe=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.delegate=e;this.editorService=t;this.configurationService=o;this.quickInputService=n;this.instantiationService=r;this.commandService=s;this.extensionService=l;this.contextKeyService=c;this.languageService=u;this.dialogService=p;this.lifecycleService=h;this.tasksService=g;this.menuService=f;this.debugAdapterFactories=new Map;this._onDidRegisterDebugger=this._register(new E);this._onDidDebuggersExtPointRead=this._register(new E);this.breakpointContributions=[];this.debuggerWhenKeys=new Set;this.taskLabels=[];this.usedDebugTypes=new Set;this.adapterDescriptorFactories=[],this.debuggers=[],this.registerListeners(),this.contextKeyService.bufferChangeEvents(()=>{this.debuggersAvailable=Aa.bindTo(c),this.debugExtensionsAvailable=oRt.bindTo(c)}),this._register(this.contextKeyService.onDidChangeContext(b=>{b.affectsSome(this.debuggerWhenKeys)&&(this.debuggersAvailable.set(this.hasEnabledDebuggers()),this.updateDebugAdapterSchema())})),this._register(this.onDidDebuggersExtPointRead(()=>{this.debugExtensionsAvailable.set(this.debuggers.length>0)}));let v=this._register(new Dt(()=>this.updateTaskLabels(),5e3));this._register(U.any(g.onDidChangeTaskConfig,g.onDidChangeTaskProviders)(()=>{v.cancel(),v.schedule()})),this.lifecycleService.when(4).then(()=>this.debugExtensionsAvailable.set(this.debuggers.length>0)),this._register(e.onDidNewSession(b=>{this.usedDebugTypes.add(b.configuration.type)})),v.schedule()}registerListeners(){VTo.setHandler((e,t)=>{t.added.forEach(o=>{o.value.forEach(n=>{if((!n.type||typeof n.type!="string")&&o.collector.error(d(9476,null)),n.type!=="*"){let r=this.getDebugger(n.type);if(r)r.merge(n,o.description);else{let s=this.instantiationService.createInstance(fUe,this,n,o.description);s.when?.keys().forEach(l=>this.debuggerWhenKeys.add(l)),this.debuggers.push(s)}}})}),e.forEach(o=>{o.value.forEach(n=>{n.type==="*"&&this.debuggers.forEach(r=>r.merge(n,o.description))})}),t.removed.forEach(o=>{let n=o.value.map(r=>r.type);this.debuggers=this.debuggers.filter(r=>n.indexOf(r.type)===-1)}),this.updateDebugAdapterSchema(),this._onDidDebuggersExtPointRead.fire()}),BTo.setHandler(e=>{this.breakpointContributions=e.flatMap(t=>t.value.map(o=>this.instantiationService.createInstance(gUe,o)))})}updateTaskLabels(){this.tasksService.getKnownTasks().then(e=>{this.taskLabels=e.map(t=>t._label),this.updateDebugAdapterSchema()})}updateDebugAdapterSchema(){let e=Gne.properties.configurations.items,t=_k.getJsonSchema(),o={common:{properties:{name:{type:"string",description:d(9475,null),default:"Launch"},debugServer:{type:"number",description:d(9479,null),default:4711},preLaunchTask:{anyOf:[t,{type:["string"]}],default:"",defaultSnippets:[{body:{task:"",type:""}}],description:d(9478,null),examples:this.taskLabels},postDebugTask:{anyOf:[t,{type:["string"]}],default:"",defaultSnippets:[{body:{task:"",type:""}}],description:d(9477,null),examples:this.taskLabels},presentation:VWi,internalConsoleOptions:dRt,suppressMultipleSessionWarning:{type:"boolean",description:d(9486,null),default:!0}}}};Gne.definitions=o,e.oneOf=[],e.defaultSnippets=[],this.debuggers.forEach(n=>{let r=n.getSchemaAttributes(o);r&&e.oneOf&&e.oneOf.push(...r);let s=n.configurationSnippets;s&&e.defaultSnippets&&e.defaultSnippets.push(...s)}),Pmn.registerSchema(cH,Gne)}registerDebugAdapterFactory(e,t){return e.forEach(o=>this.debugAdapterFactories.set(o,t)),this.debuggersAvailable.set(this.hasEnabledDebuggers()),this._onDidRegisterDebugger.fire(),{dispose:()=>{e.forEach(o=>this.debugAdapterFactories.delete(o))}}}hasEnabledDebuggers(){for(let[e]of this.debugAdapterFactories){let t=this.getDebugger(e);if(t&&t.enabled)return!0}return!1}createDebugAdapter(e){let t=this.debugAdapterFactories.get(e.configuration.type);if(t)return t.createDebugAdapter(e)}substituteVariables(e,t,o){let n=this.debugAdapterFactories.get(e);return n?n.substituteVariables(t,o):Promise.resolve(o)}runInTerminal(e,t,o){let n=this.debugAdapterFactories.get(e);return n?n.runInTerminal(t,o):Promise.resolve(void 0)}registerDebugAdapterDescriptorFactory(e){return this.adapterDescriptorFactories.push(e),{dispose:()=>{this.unregisterDebugAdapterDescriptorFactory(e)}}}unregisterDebugAdapterDescriptorFactory(e){let t=this.adapterDescriptorFactories.indexOf(e);t>=0&&this.adapterDescriptorFactories.splice(t,1)}getDebugAdapterDescriptor(e){let t=e.configuration,o=this.adapterDescriptorFactories.filter(n=>n.type===t.type&&n.createDebugAdapterDescriptor);return o.length===1?o[0].createDebugAdapterDescriptor(e):Promise.resolve(void 0)}getDebuggerLabel(e){let t=this.getDebugger(e);if(t)return t.label}get onDidRegisterDebugger(){return this._onDidRegisterDebugger.event}get onDidDebuggersExtPointRead(){return this._onDidDebuggersExtPointRead.event}canSetBreakpointsIn(e){let t=e.getLanguageId();return!t||t==="jsonc"||t==="log"?!1:this.configurationService.getValue("debug").allowBreakpointsEverywhere?!0:this.breakpointContributions.some(o=>o.language===t&&o.enabled)}getDebugger(e){return this.debuggers.find(t=>vr(t.type,e))}getEnabledDebugger(e){let t=this.getDebugger(e);return t&&t.enabled?t:void 0}someDebuggerInterestedInLanguage(e){return!!this.debuggers.filter(t=>t.enabled).find(t=>t.interestedInLanguage(e))}async guessDebugger(e){let t=this.editorService.activeTextEditorControl,o=[],n=null,r=null;if(pn(t)){r=t.getModel();let g=r?r.getLanguageId():void 0;g&&(n=this.languageService.getLanguageName(g));let f=this.debuggers.filter(v=>v.enabled).filter(v=>g&&v.interestedInLanguage(g));if(f.length===1)return{debugger:f[0]};f.length>1&&(o=f)}if((!n||e||r&&this.canSetBreakpointsIn(r))&&o.length===0&&(await this.activateDebuggers("onDebugInitialConfigurations"),o=this.debuggers.filter(g=>g.enabled).filter(g=>g.hasInitialConfiguration()||g.hasDynamicConfigurationProviders()||g.hasConfigurationProvider())),o.length===0&&n){n.indexOf(" ")>=0&&(n=`'${n}'`);let{confirmed:g}=await this.dialogService.confirm({type:bt.Warning,message:d(9474,null,n),primaryButton:d(9480,null,n)});g&&await this.commandService.executeCommand("debug.installAdditionalDebuggers",n);return}this.initExtensionActivationsIfNeeded(),o.sort((g,f)=>g.label.localeCompare(f.label)),o=o.filter(g=>!g.isHiddenFromDropdown);let s=[],l=[];o.forEach(g=>{let f=g.getMainExtensionDescriptor();f.id&&this.earlyActivatedExtensions?.has(f.id)||this.usedDebugTypes.has(g.type)?s.push(g):l.push(g)});let c=[],u=await this.delegate.configurationManager().getDynamicProviders();if(s.length>0&&c.push({type:"separator",label:d(9485,null)},...s.map(g=>({label:g.label,pick:()=>({debugger:g})}))),l.length>0&&(c.length>0&&c.push({type:"separator",label:""}),c.push(...l.map(g=>({label:g.label,pick:()=>({debugger:g})})))),u.length){c.length&&c.push({type:"separator",label:""});for(let g of u)c.push({label:d(9483,null,g.label),pick:async()=>{let f=await g.pick();if(f)return f&&{debugger:this.getDebugger(g.type),withConfig:f}}})}c.push({type:"separator",label:""},{label:n?d(9482,null,n):d(9481,null)});let p=this.menuService.getMenuActions(D.DebugCreateConfiguration,this.contextKeyService);for(let[,g]of p)for(let f of g)c.push(f);let h=d(9484,null);return this.quickInputService.pick(c,{activeItem:c[0],placeHolder:h}).then(async g=>{if(g&&"pick"in g&&typeof g.pick=="function")return await g.pick();if(g instanceof Lo){g.run();return}g&&this.commandService.executeCommand("debug.installAdditionalDebuggers",n)})}initExtensionActivationsIfNeeded(){if(!this.earlyActivatedExtensions){this.earlyActivatedExtensions=new Set;let e=this.extensionService.getExtensionsStatus();for(let t in e)e[t].activationTimes&&this.earlyActivatedExtensions.add(t)}}async activateDebuggers(e,t){this.initExtensionActivationsIfNeeded();let o=[this.extensionService.activateByEvent(e),this.extensionService.activateByEvent("onDebug")];t&&o.push(this.extensionService.activateByEvent(`${e}:${t}`)),await Promise.all(o)}};vUe=I([m(1,ee),m(2,B),m(3,Ue),m(4,F),m(5,ge),m(6,lt),m(7,X),m(8,_t),m(9,at),m(10,ji),m(11,Og),m(12,Kt)],vUe);var zTo=ne.as(ma.JSONContribution);zTo.registerSchema(cH,Gne);var BWi="debug.selectedconfigname",HWi="debug.selectedroot",HTo="debug.selectedtype",UWi="debug.recentdynamicconfigurations",bUe="onDebugDynamicConfigurations",SUe=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h){this.adapterManager=i;this.contextService=e;this.configurationService=t;this.quickInputService=o;this.instantiationService=n;this.storageService=r;this.extensionService=s;this.historyService=l;this.uriIdentityService=c;this.remoteAgentService=u;this.logService=h;this.getSelectedConfig=()=>Promise.resolve(void 0);this.selectedDynamic=!1;this._onDidSelectConfigurationName=new E;this._onDidChangeConfigurationProviders=new E;this.onDidChangeConfigurationProviders=this._onDidChangeConfigurationProviders.event;this.targetOperatingSystem=Po;this.configProviders=[],this.toDispose=[this._onDidChangeConfigurationProviders,this._onDidSelectConfigurationName],this.initLaunches(),this.setCompoundSchemaValues(),this.registerListeners();let g=this.storageService.get(HWi,1),f=this.storageService.get(HTo,1),v=this.launches.find(y=>y.uri.toString()===g),b=this.storageService.get(BWi,1);this.debugConfigurationTypeContext=kto.bindTo(p);let S=f?{type:f}:void 0;v&&v.getConfigurationNames().length?this.selectConfiguration(v,b,void 0,S):this.launches.length>0&&this.selectConfiguration(void 0,b,void 0,S),this.resolveTargetOperatingSystem()}resolveTargetOperatingSystem(){this.remoteAgentService.getEnvironment().then(i=>{let e=i?.os??Po;this.targetOperatingSystem!==e&&(this.targetOperatingSystem=e,this._onDidSelectConfigurationName.fire())},()=>{})}getTargetOperatingSystem(){return this.targetOperatingSystem}registerDebugConfigurationProvider(i){return this.configProviders.push(i),this._onDidChangeConfigurationProviders.fire(),{dispose:()=>{this.unregisterDebugConfigurationProvider(i),this._onDidChangeConfigurationProviders.fire()}}}unregisterDebugConfigurationProvider(i){let e=this.configProviders.indexOf(i);e>=0&&this.configProviders.splice(e,1)}hasDebugConfigurationProvider(i,e){return e===void 0&&(e=1),!!this.configProviders.find(o=>o.provideDebugConfigurations&&o.type===i&&o.triggerKind===e)}async resolveConfigurationByProviders(i,e,t,o){let n=async(l,c)=>{l!=="*"&&await this.adapterManager.activateDebuggers("onDebugResolve",l);for(let u of this.configProviders)u.type===l&&u.resolveDebugConfiguration&&c&&(c=await u.resolveDebugConfiguration(i,c,o));return c},r=t.type??e,s=t;for(let l=new Set;s&&!l.has(r);)l.add(r),s=await n(r,s),s=await n("*",s),r=s?.type??e;return s}async resolveDebugConfigurationWithSubstitutedVariables(i,e,t,o){let n=this.configProviders.filter(s=>s.type===e&&s.resolveDebugConfigurationWithSubstitutedVariables).concat(this.configProviders.filter(s=>s.type==="*"&&s.resolveDebugConfigurationWithSubstitutedVariables)),r=t;return await Zht(n.map(s=>async()=>{r&&(r=await s.resolveDebugConfigurationWithSubstitutedVariables(i,r,o))})),r}async provideDebugConfigurations(i,e,t){return await this.adapterManager.activateDebuggers("onDebugInitialConfigurations"),(await Promise.all(this.configProviders.filter(n=>n.type===e&&n.triggerKind===1&&n.provideDebugConfigurations).map(n=>n.provideDebugConfigurations(i,t)))).reduce((n,r)=>n.concat(r),[])}async getDynamicProviders(){await this.extensionService.whenInstalledExtensionsRegistered();let i=this.extensionService.extensions.reduce((e,t)=>{if(!t.activationEvents)return e;let o=[],n=!1;for(let r of t.activationEvents)r===bUe?n=!0:r.startsWith(`${bUe}:`)&&o.push(r.slice(bUe.length+1));if(o.length)o.forEach(r=>e.add(r));else if(n){let r=t.contributes?.debuggers?.[0].type;r&&e.add(r)}return e},new Set);for(let e of this.configProviders)e.triggerKind===2&&i.add(e.type);return[...i].map(e=>({label:this.adapterManager.getDebuggerLabel(e),getProvider:async()=>(await this.adapterManager.activateDebuggers(bUe,e),this.configProviders.find(t=>t.type===e&&t.triggerKind===2&&t.provideDebugConfigurations)),type:e,pick:async()=>{await this.adapterManager.activateDebuggers(bUe,e);let t=new N,o=new Ye;t.add(o);let n=t.add(this.quickInputService.createQuickPick());n.busy=!0,n.placeholder=d(9549,null);let r=new Promise(c=>{t.add(n.onDidAccept(()=>c(n.activeItems[0]))),t.add(n.onDidTriggerItemButton(async u=>{c(void 0);let{launch:p,config:h}=u.item;await p.openConfigFile({preserveFocus:!1,type:h.type,suppressInitialConfigs:!0}),await p.writeConfiguration(h),await this.selectConfiguration(p,h.name),this.removeRecentDynamicConfigurations(h.name,h.type)})),t.add(n.onDidHide(()=>c(void 0)))}).finally(()=>o.cancel()),s;try{s=await this.getDynamicConfigurationsByType(e,o.token)}catch(c){this.logService.error(c),t.dispose();return}n.items=s,n.busy=!1,n.show();let l=await r;return t.dispose(),l}}))}async getDynamicConfigurationsByType(i,e=Se.None){await this.adapterManager.activateDebuggers(bUe,i);let t=[],o=this.configProviders.find(n=>n.type===i&&n.triggerKind===2&&n.provideDebugConfigurations);return this.getLaunches().forEach(n=>{o&&t.push(o.provideDebugConfigurations(n.workspace?.uri,e).then(r=>r.map(s=>({label:s.name,description:n.name,config:s,buttons:[{iconClass:q.asClassName(RPe),tooltip:d(9548,null)}],launch:n}))))}),(await Promise.all(t)).flat()}getAllConfigurations(){let i=[];for(let e of this.launches)for(let t of e.getConfigurationNames()){let o=e.getConfiguration(t)||e.getCompound(t);o&&i.push({launch:e,name:t,presentation:o.presentation})}return $hi(i)}removeRecentDynamicConfigurations(i,e){let t=this.getRecentDynamicConfigurations().filter(o=>o.name!==i||o.type!==e);this.storageService.store(UWi,JSON.stringify(t),1,1),this.selectedConfiguration.name===i&&this.selectedType===e&&this.selectedDynamic?this.selectConfiguration(void 0,void 0):this._onDidSelectConfigurationName.fire()}getRecentDynamicConfigurations(){return JSON.parse(this.storageService.get(UWi,1,"[]"))}registerListeners(){this.toDispose.push(U.any(this.contextService.onDidChangeWorkspaceFolders,this.contextService.onDidChangeWorkbenchState)(()=>{this.initLaunches(),this.selectConfiguration(void 0),this.setCompoundSchemaValues()})),this.toDispose.push(this.configurationService.onDidChangeConfiguration(async i=>{i.affectsConfiguration("launch")&&(await this.selectConfiguration(void 0),this.setCompoundSchemaValues())})),this.toDispose.push(this.adapterManager.onDidDebuggersExtPointRead(()=>{this.setCompoundSchemaValues()}))}initLaunches(){this.launches=this.contextService.getWorkspace().folders.map(i=>this.instantiationService.createInstance(Nlt,this,this.adapterManager,i)),this.contextService.getWorkbenchState()===3&&this.launches.push(this.instantiationService.createInstance(IUe,this,this.adapterManager)),this.launches.push(this.instantiationService.createInstance(yUe,this,this.adapterManager)),this.selectedLaunch&&this.launches.indexOf(this.selectedLaunch)===-1&&this.selectConfiguration(void 0)}setCompoundSchemaValues(){let i=Gne.properties.compounds.items.properties.configurations,e=this.launches.map(o=>o.getConfigurationNames(!0)).reduce((o,n)=>o.concat(n),[]);i.items.oneOf[0].enum=e,i.items.oneOf[1].properties.name.enum=e;let t=this.contextService.getWorkspace().folders.map(o=>o.name);i.items.oneOf[1].properties.folder.enum=t,zTo.registerSchema(cH,Gne)}getLaunches(){return this.launches}getLaunch(i){if(A.isUri(i))return this.launches.find(e=>e.workspace&&this.uriIdentityService.extUri.isEqual(e.workspace.uri,i))}get selectedConfiguration(){return{launch:this.selectedLaunch,name:this.selectedName,getConfig:this.getSelectedConfig,type:this.selectedType}}get onDidSelectConfiguration(){return this._onDidSelectConfigurationName.event}getWorkspaceLaunch(){if(this.contextService.getWorkbenchState()===3)return this.launches[this.launches.length-1]}async selectConfiguration(i,e,t,o){if(typeof i>"u"){let u=this.historyService.getLastActiveWorkspaceRoot();i=this.getLaunch(u),(!i||i.getConfigurationNames().length===0)&&(i=this.launches.find(p=>!!(p&&p.getConfigurationNames().length))||i||this.launches[0])}let n=this.selectedLaunch,r=this.selectedName,s=this.selectedDynamic;this.selectedLaunch=i,this.selectedLaunch?this.storageService.store(HWi,this.selectedLaunch.uri.toString(),1,1):this.storageService.remove(HWi,1);let l=i?i.getConfigurationNames():[];this.getSelectedConfig=()=>{let u=this.selectedName?i?.getConfiguration(this.selectedName):void 0;return Promise.resolve(u||t)};let c=t?.type;if(e&&l.indexOf(e)>=0)this.setSelectedLaunchName(e);else if(o&&o.type){if(c=o.type,!t){let p=(await this.getDynamicProviders()).filter(h=>h.type===c);this.getSelectedConfig=async()=>{let h=await Promise.all(p.map(f=>f.getProvider())),g=h.length>0?h[0]:void 0;if(g&&i&&i.workspace){let f=new Ye,b=(await g.provideDebugConfigurations(i.workspace.uri,f.token)).find(S=>S.name===e);if(b)return b}}}this.setSelectedLaunchName(e);let u=this.getRecentDynamicConfigurations();e&&o.type&&(u.unshift({name:e,type:o.type}),u=zo(u,p=>`${p.name} : ${p.type}`),this.storageService.store(UWi,JSON.stringify(u),1,1))}else if(!this.selectedName||l.indexOf(this.selectedName)===-1){let u=l.length?l[0]:void 0;this.setSelectedLaunchName(u)}!t&&i&&this.selectedName&&(t=i.getConfiguration(this.selectedName),c=t?.type),this.selectedType=o?.type||t?.type,this.selectedDynamic=!!o,this.storageService.store(HTo,o?this.selectedType:void 0,1,1),c?this.debugConfigurationTypeContext.set(c):this.debugConfigurationTypeContext.reset(),(this.selectedLaunch!==n||this.selectedName!==r||s!==this.selectedDynamic)&&this._onDidSelectConfigurationName.fire()}setSelectedLaunchName(i){this.selectedName=i,this.selectedName?this.storageService.store(BWi,this.selectedName,1,1):this.storageService.remove(BWi,1)}dispose(){this.toDispose=Be(this.toDispose)}};SUe=I([m(1,Pe),m(2,B),m(3,Ue),m(4,F),m(5,ce),m(6,lt),m(7,na),m(8,ht),m(9,bo),m(10,X),m(11,se)],SUe);var Olt=class{constructor(i,e){this.configurationManager=i;this.adapterManager=e}getCompound(i){let e=this.getDeduplicatedConfig();if(!(!e||!e.compounds))return e.compounds.find(t=>t.name===i)}getConfigurationNames(i=!1){let e=this.getDeduplicatedConfig();if(!e||!Array.isArray(e.configurations)&&!Array.isArray(e.compounds))return[];{let t=[];if(e.configurations&&t.push(...e.configurations.filter(n=>n&&typeof n.name=="string")),i)return t.map(n=>n.name);e.compounds&&t.push(...e.compounds.filter(n=>typeof n.name=="string"&&n.configurations&&n.configurations.length));let o=t.map(n=>Mto(n)?jhi(n,this.configurationManager.getTargetOperatingSystem()):n);return $hi(o).map(n=>n.name)}}getConfiguration(i){let e=this.getDeduplicatedConfig();if(!e||!e.configurations)return;let t=e.configurations.find(n=>n&&n.name===i);if(!t)return;let o=jhi(t,this.configurationManager.getTargetOperatingSystem());return this instanceof yUe?{...o,__configurationTarget:2}:this instanceof IUe?{...o,__configurationTarget:5}:{...o,__configurationTarget:6}}async getInitialConfigurationContent(i,e,t,o){let n="",r=e?{debugger:this.adapterManager.getEnabledDebugger(e)}:await this.adapterManager.guessDebugger(!0);if(r?.withConfig&&r.debugger)n=await r.debugger.getInitialConfigurationContent([r.withConfig.config]);else if(r?.debugger){let s=t?await this.configurationManager.provideDebugConfigurations(i,r.debugger.type,o||Se.None):[];n=await r.debugger.getInitialConfigurationContent(s)}return n}get hidden(){return!1}getDeduplicatedConfig(){let i=this.getConfig();return i&&{version:i.version,compounds:i.compounds&&UTo(i.compounds),configurations:i.configurations&&UTo(i.configurations)}}};function UTo(a){let i=new Map;return a.map(e=>{let t=i.get(e.name)||0;return i.set(e.name,t+1),t===0?e:{...e,name:`${e.name} (${t})`}})}var Nlt=class extends Olt{constructor(e,t,o,n,r,s,l){super(e,t);this.workspace=o;this.fileService=n;this.textFileService=r;this.editorService=s;this.configurationService=l}get uri(){return Ge(this.workspace.uri,"/.vscode/launch.json")}get name(){return this.workspace.name}getConfig(){return this.configurationService.inspect("launch",{resource:this.workspace.uri}).workspaceFolderValue}async openConfigFile({preserveFocus:e,type:t,suppressInitialConfigs:o},n){let r=this.uri,s=!1,l="";try{l=(await this.fileService.readFile(r)).value.toString()}catch{if(l=await this.getInitialConfigurationContent(this.workspace.uri,t,!o,n),!l)return{editor:null,created:!1};s=!0;try{await this.textFileService.write(r,l)}catch(g){throw new Error(d(9547,null,g.message))}}let c=l.indexOf(`"${this.configurationManager.selectedConfiguration.name}"`),u=1;for(let g=0;g<c;g++)l.charAt(g)===`
`&&u++;let p=u>1?{startLineNumber:u,startColumn:4}:void 0;return{editor:await this.editorService.openEditor({resource:r,options:{selection:p,preserveFocus:e,pinned:s,revealIfVisible:!0}},jn)??null,created:s}}async writeConfiguration(e){let t={...this.getConfig()??{}};t.configurations=[...t.configurations||[],e],await this.configurationService.updateValue("launch",t,{resource:this.workspace.uri},6)}};Nlt=I([m(3,fe),m(4,Uo),m(5,ee),m(6,B)],Nlt);var IUe=class extends Olt{constructor(e,t,o,n,r){super(e,t);this.editorService=o;this.configurationService=n;this.contextService=r}get workspace(){}get uri(){return this.contextService.getWorkspace().configuration}get name(){return d(9551,null)}getConfig(){return this.configurationService.inspect("launch").workspaceValue}async openConfigFile({preserveFocus:e,type:t,useInitialConfigs:o},n){if(!!!this.getConfig()){let l=await this.getInitialConfigurationContent(void 0,t,o,n);if(l)await this.configurationService.updateValue("launch",jr(l),5);else return{editor:null,created:!1}}return{editor:await this.editorService.openEditor({resource:this.contextService.getWorkspace().configuration,options:{preserveFocus:e}},jn)??null,created:!1}}};IUe=I([m(2,ee),m(3,B),m(4,Pe)],IUe);var yUe=class extends Olt{constructor(e,t,o,n){super(e,t);this.configurationService=o;this.preferencesService=n}get workspace(){}get uri(){return this.preferencesService.userSettingsResource}get name(){return d(9550,null)}get hidden(){return!0}getConfig(){return this.configurationService.inspect("launch").userValue}async openConfigFile({preserveFocus:e,type:t,useInitialContent:o}){return{editor:await this.preferencesService.openUserSettings({jsonEditor:!0,preserveFocus:e,revealSetting:{key:"launch"}})??null,created:!1}}};yUe=I([m(2,B),m(3,Go)],yUe);var Amn=/range=([0-9]+):([0-9]+)/,R4t=class extends x{constructor(e){super();this.debugService=e;this.memoryFdCounter=0;this.fdMemory=new Map;this.changeEmitter=this._register(new E);this.onDidChangeCapabilities=U.None;this.onDidChangeFile=this.changeEmitter.event;this.capabilities=1028;this._register(e.onDidEndSession(({session:t})=>{for(let[o,n]of this.fdMemory)n.session===t&&this.close(o)}))}watch(e,t){if(t.recursive)return Z(()=>{});let{session:o,memoryReference:n,offset:r}=this.parseUri(e),s=new N;return s.add(o.onDidChangeState(()=>{(o.state===3||o.state===0)&&this.changeEmitter.fire([{type:2,resource:e}])})),s.add(o.onDidInvalidateMemory(l=>{l.body.memoryReference===n&&(r&&(l.body.offset>=r.toOffset||l.body.offset+l.body.count<r.fromOffset)||this.changeEmitter.fire([{resource:e,type:0}]))})),s}stat(e){let{readOnly:t}=this.parseUri(e);return Promise.resolve({type:1,mtime:0,ctime:0,size:0,permissions:t?1:void 0})}mkdir(){throw Ps("Not allowed","NoPermissions")}readdir(){throw Ps("Not allowed","NoPermissions")}delete(){throw Ps("Not allowed","NoPermissions")}rename(){throw Ps("Not allowed","NoPermissions")}open(e,t){let{session:o,memoryReference:n,offset:r}=this.parseUri(e),s=this.memoryFdCounter++,l=o.getMemory(n);return r&&(l=new zWi(l,r)),this.fdMemory.set(s,{session:o,region:l}),Promise.resolve(s)}close(e){return this.fdMemory.get(e)?.region.dispose(),this.fdMemory.delete(e),Promise.resolve()}async writeFile(e,t){let{offset:o}=this.parseUri(e);if(!o)throw Ps("Range must be present to read a file","EntryNotFound");let n=await this.open(e,{create:!1});try{await this.write(n,o.fromOffset,t,0,t.length)}finally{this.close(n)}}async readFile(e){let{offset:t}=this.parseUri(e);if(!t)throw Ps("Range must be present to read a file","EntryNotFound");let o=new Uint8Array(t.toOffset-t.fromOffset),n=await this.open(e,{create:!1});try{return await this.read(n,t.fromOffset,o,0,o.length),o}finally{this.close(n)}}async read(e,t,o,n,r){let s=this.fdMemory.get(e);if(!s)throw Ps("No file with that descriptor open","Unavailable");let l=await s.region.read(t,r),c=0;for(let u of l)switch(u.type){case 1:return c;case 2:if(c>0)return c;throw Ps(u.error,"Unknown");case 0:{let p=Math.max(0,t-u.offset),h=u.data.slice(p,Math.min(u.data.byteLength,p+(r-c)));o.set(h.buffer,n+c),c+=h.byteLength;break}default:os(u)}return c}write(e,t,o,n,r){let s=this.fdMemory.get(e);if(!s)throw Ps("No file with that descriptor open","Unavailable");return s.region.write(t,qe.wrap(o).slice(n,n+r))}parseUri(e){if(e.scheme!==lue)throw Ps(`Cannot open file with scheme ${e.scheme}`,"EntryNotFound");let t=this.debugService.getModel().getSession(e.authority);if(!t)throw Ps("Debug session not found","EntryNotFound");let o,n=Amn.exec(e.query);n&&(o={fromOffset:Number(n[1]),toOffset:Number(n[2])});let[,r]=e.path.split("/");return{session:t,offset:o,readOnly:!t.capabilities.supportsWriteMemoryRequest,sessionId:e.authority,memoryReference:decodeURIComponent(r)}}},zWi=class extends x{constructor(e,t){super();this.parent=e;this.range=t;this.invalidateEmitter=this._register(new E);this.onDidInvalidate=this.invalidateEmitter.event;this.writable=e.writable,this.width=t.toOffset-t.fromOffset,this._register(e),this._register(e.onDidInvalidate(o=>{let n=Bn(o.fromOffset-t.fromOffset,0,this.width),r=Bn(o.toOffset-t.fromOffset,0,this.width);r>n&&this.invalidateEmitter.fire({fromOffset:n,toOffset:r})}))}read(e,t){if(e<0)throw new RangeError(`Invalid fromOffset: ${e}`);return this.parent.read(this.range.fromOffset+e,this.range.fromOffset+Math.min(t,this.width))}write(e,t){return this.parent.write(this.range.fromOffset+e,t)}};var wUe=class{constructor(i,e,t,o,n,r,s,l){this.dbgr=e;this.sessionId=t;this.name=o;this.extensionHostDebugService=n;this.openerService=r;this.notificationService=s;this.dialogSerivce=l;this.allThreadsContinued=!0;this._readyForBreakpoints=!1;this.debugAdapterStopped=!1;this.inShutdown=!1;this.terminated=!1;this.firedAdapterExitEvent=!1;this.startTime=0;this.didReceiveStoppedEvent=!1;this.toDispose=new N;this._onDidInitialize=this.toDispose.add(new E);this._onDidStop=this.toDispose.add(new E);this._onDidContinued=this.toDispose.add(new E);this._onDidTerminateDebugee=this.toDispose.add(new E);this._onDidExitDebugee=this.toDispose.add(new E);this._onDidThread=this.toDispose.add(new E);this._onDidOutput=this.toDispose.add(new E);this._onDidBreakpoint=this.toDispose.add(new E);this._onDidLoadedSource=this.toDispose.add(new E);this._onDidProgressStart=this.toDispose.add(new E);this._onDidProgressUpdate=this.toDispose.add(new E);this._onDidProgressEnd=this.toDispose.add(new E);this._onDidInvalidated=this.toDispose.add(new E);this._onDidInvalidateMemory=this.toDispose.add(new E);this._onDidCustomEvent=this.toDispose.add(new E);this._onDidEvent=this.toDispose.add(new E);this._onDidExitAdapter=this.toDispose.add(new E);this.stoppedSinceLastStep=!1;this.debugAdapter=i,this._capabilities=Object.create(null),this.toDispose.add(this.debugAdapter.onError(c=>{this.shutdown(c)})),this.toDispose.add(this.debugAdapter.onExit(c=>{c!==0?this.shutdown(new Error(`exit code: ${c}`)):this.shutdown()})),this.debugAdapter.onEvent(c=>{switch(c.event){case"initialized":this._readyForBreakpoints=!0,this._onDidInitialize.fire(c);break;case"loadedSource":this._onDidLoadedSource.fire(c);break;case"capabilities":if(c.body){let u=c.body.capabilities;this.mergeCapabilities(u)}break;case"stopped":this.didReceiveStoppedEvent=!0,this.stoppedSinceLastStep=!0,this._onDidStop.fire(c);break;case"continued":this.allThreadsContinued=c.body.allThreadsContinued!==!1,this._onDidContinued.fire(c);break;case"thread":this._onDidThread.fire(c);break;case"output":this._onDidOutput.fire(c);break;case"breakpoint":this._onDidBreakpoint.fire(c);break;case"terminated":this._onDidTerminateDebugee.fire(c);break;case"exited":this._onDidExitDebugee.fire(c);break;case"progressStart":this._onDidProgressStart.fire(c);break;case"progressUpdate":this._onDidProgressUpdate.fire(c);break;case"progressEnd":this._onDidProgressEnd.fire(c);break;case"invalidated":this._onDidInvalidated.fire(c);break;case"memory":this._onDidInvalidateMemory.fire(c);break;case"process":break;case"module":break;default:this._onDidCustomEvent.fire(c);break}this._onDidEvent.fire(c)}),this.debugAdapter.onRequest(c=>this.dispatchRequest(c))}get isInShutdown(){return this.inShutdown}get onDidExitAdapter(){return this._onDidExitAdapter.event}get capabilities(){return this._capabilities}get readyForBreakpoints(){return this._readyForBreakpoints}get onDidInitialize(){return this._onDidInitialize.event}get onDidStop(){return this._onDidStop.event}get onDidContinued(){return this._onDidContinued.event}get onDidTerminateDebugee(){return this._onDidTerminateDebugee.event}get onDidExitDebugee(){return this._onDidExitDebugee.event}get onDidThread(){return this._onDidThread.event}get onDidOutput(){return this._onDidOutput.event}get onDidBreakpoint(){return this._onDidBreakpoint.event}get onDidLoadedSource(){return this._onDidLoadedSource.event}get onDidCustomEvent(){return this._onDidCustomEvent.event}get onDidProgressStart(){return this._onDidProgressStart.event}get onDidProgressUpdate(){return this._onDidProgressUpdate.event}get onDidProgressEnd(){return this._onDidProgressEnd.event}get onDidInvalidated(){return this._onDidInvalidated.event}get onDidInvalidateMemory(){return this._onDidInvalidateMemory.event}get onDidEvent(){return this._onDidEvent.event}async start(){if(!this.debugAdapter)return Promise.reject(new Error(d(9736,null)));await this.debugAdapter.startSession(),this.startTime=new Date().getTime()}async initialize(i){let e=await this.send("initialize",i,void 0,void 0,!1);return e&&this.mergeCapabilities(e.body),e}disconnect(i){let e=this.capabilities.supportTerminateDebuggee?i.terminateDebuggee:void 0,t=this.capabilities.supportTerminateDebuggee&&this.capabilities.supportSuspendDebuggee?i.suspendDebuggee:void 0;return this.shutdown(void 0,i.restart,e,t)}async launchOrAttach(i){let e=await this.send(i.request,i,void 0,void 0,!1);return e&&this.mergeCapabilities(e.body),e}terminate(i=!1){return this.capabilities.supportsTerminateRequest?this.terminated?this.disconnect({terminateDebuggee:!0,restart:i}):(this.terminated=!0,this.send("terminate",{restart:i},void 0)):Promise.reject(new Error("terminated not supported"))}restart(i){return this.capabilities.supportsRestartRequest?this.send("restart",i):Promise.reject(new Error("restart not supported"))}async next(i){this.stoppedSinceLastStep=!1;let e=await this.send("next",i);return this.stoppedSinceLastStep||this.fireSimulatedContinuedEvent(i.threadId),e}async stepIn(i){this.stoppedSinceLastStep=!1;let e=await this.send("stepIn",i);return this.stoppedSinceLastStep||this.fireSimulatedContinuedEvent(i.threadId),e}async stepOut(i){this.stoppedSinceLastStep=!1;let e=await this.send("stepOut",i);return this.stoppedSinceLastStep||this.fireSimulatedContinuedEvent(i.threadId),e}async continue(i){this.stoppedSinceLastStep=!1;let e=await this.send("continue",i);return e&&e.body&&e.body.allThreadsContinued!==void 0&&(this.allThreadsContinued=e.body.allThreadsContinued),this.stoppedSinceLastStep||this.fireSimulatedContinuedEvent(i.threadId,this.allThreadsContinued),e}pause(i){return this.send("pause",i)}terminateThreads(i){return this.capabilities.supportsTerminateThreadsRequest?this.send("terminateThreads",i):Promise.reject(new Error("terminateThreads not supported"))}setVariable(i){return this.capabilities.supportsSetVariable?this.send("setVariable",i):Promise.reject(new Error("setVariable not supported"))}setExpression(i){return this.capabilities.supportsSetExpression?this.send("setExpression",i):Promise.reject(new Error("setExpression not supported"))}async restartFrame(i,e){if(this.capabilities.supportsRestartFrame){this.stoppedSinceLastStep=!1;let t=await this.send("restartFrame",i);return this.stoppedSinceLastStep||this.fireSimulatedContinuedEvent(e),t}return Promise.reject(new Error("restartFrame not supported"))}stepInTargets(i){return this.capabilities.supportsStepInTargetsRequest?this.send("stepInTargets",i):Promise.reject(new Error("stepInTargets not supported"))}completions(i,e){return this.capabilities.supportsCompletionsRequest?this.send("completions",i,e):Promise.reject(new Error("completions not supported"))}setBreakpoints(i){return this.send("setBreakpoints",i)}setFunctionBreakpoints(i){return this.capabilities.supportsFunctionBreakpoints?this.send("setFunctionBreakpoints",i):Promise.reject(new Error("setFunctionBreakpoints not supported"))}dataBreakpointInfo(i){return this.capabilities.supportsDataBreakpoints?this.send("dataBreakpointInfo",i):Promise.reject(new Error("dataBreakpointInfo not supported"))}setDataBreakpoints(i){return this.capabilities.supportsDataBreakpoints?this.send("setDataBreakpoints",i):Promise.reject(new Error("setDataBreakpoints not supported"))}setExceptionBreakpoints(i){return this.send("setExceptionBreakpoints",i)}breakpointLocations(i){return this.capabilities.supportsBreakpointLocationsRequest?this.send("breakpointLocations",i):Promise.reject(new Error("breakpointLocations is not supported"))}configurationDone(){return this.capabilities.supportsConfigurationDoneRequest?this.send("configurationDone",null):Promise.reject(new Error("configurationDone not supported"))}stackTrace(i,e){return this.send("stackTrace",i,e)}exceptionInfo(i){return this.capabilities.supportsExceptionInfoRequest?this.send("exceptionInfo",i):Promise.reject(new Error("exceptionInfo not supported"))}scopes(i,e){return this.send("scopes",i,e)}variables(i,e){return this.send("variables",i,e)}source(i){return this.send("source",i)}locations(i){return this.send("locations",i)}loadedSources(i){return this.capabilities.supportsLoadedSourcesRequest?this.send("loadedSources",i):Promise.reject(new Error("loadedSources not supported"))}threads(){return this.send("threads",null)}evaluate(i){return this.send("evaluate",i)}async stepBack(i){if(this.capabilities.supportsStepBack){this.stoppedSinceLastStep=!1;let e=await this.send("stepBack",i);return this.stoppedSinceLastStep||this.fireSimulatedContinuedEvent(i.threadId),e}return Promise.reject(new Error("stepBack not supported"))}async reverseContinue(i){if(this.capabilities.supportsStepBack){this.stoppedSinceLastStep=!1;let e=await this.send("reverseContinue",i);return this.stoppedSinceLastStep||this.fireSimulatedContinuedEvent(i.threadId),e}return Promise.reject(new Error("reverseContinue not supported"))}gotoTargets(i){return this.capabilities.supportsGotoTargetsRequest?this.send("gotoTargets",i):Promise.reject(new Error("gotoTargets is not supported"))}async goto(i){if(this.capabilities.supportsGotoTargetsRequest){this.stoppedSinceLastStep=!1;let e=await this.send("goto",i);return this.stoppedSinceLastStep||this.fireSimulatedContinuedEvent(i.threadId),e}return Promise.reject(new Error("goto is not supported"))}async setInstructionBreakpoints(i){return this.capabilities.supportsInstructionBreakpoints?await this.send("setInstructionBreakpoints",i):Promise.reject(new Error("setInstructionBreakpoints is not supported"))}async disassemble(i){return this.capabilities.supportsDisassembleRequest?await this.send("disassemble",i):Promise.reject(new Error("disassemble is not supported"))}async readMemory(i){return this.capabilities.supportsReadMemoryRequest?await this.send("readMemory",i):Promise.reject(new Error("readMemory is not supported"))}async writeMemory(i){return this.capabilities.supportsWriteMemoryRequest?await this.send("writeMemory",i):Promise.reject(new Error("writeMemory is not supported"))}cancel(i){return this.send("cancel",i)}custom(i,e){return this.send(i,e)}async shutdown(i,e=!1,t=void 0,o=void 0){if(!this.inShutdown)if(this.inShutdown=!0,this.debugAdapter)try{let n={restart:e};typeof t=="boolean"&&(n.terminateDebuggee=t),typeof o=="boolean"&&(n.suspendDebuggee=o),await this.send("disconnect",n,void 0,i?200:2e3)}catch{}finally{await this.stopAdapter(i)}else return this.stopAdapter(i)}async stopAdapter(i){try{if(this.debugAdapter){let e=this.debugAdapter;this.debugAdapter=null,await e.stopSession(),this.debugAdapterStopped=!0}}finally{this.fireAdapterExitEvent(i)}}fireAdapterExitEvent(i){if(!this.firedAdapterExitEvent){this.firedAdapterExitEvent=!0;let e={emittedStopped:this.didReceiveStoppedEvent,sessionLengthInSeconds:(new Date().getTime()-this.startTime)/1e3};i&&!this.debugAdapterStopped&&(e.error=i),this._onDidExitAdapter.fire(e)}}async dispatchRequest(i){let e={type:"response",seq:0,command:i.command,request_seq:i.seq,success:!0},t=o=>this.debugAdapter&&this.debugAdapter.sendResponse(o);if(i.command==="launchVSCode")try{let o=await this.launchVsCode(i.arguments);if(!o.success){let{confirmed:n}=await this.dialogSerivce.confirm({type:ft.Warning,message:d(9732,null),primaryButton:d(9733,null)});n?o=await this.launchVsCode(i.arguments):(e.success=!1,t(e),await this.shutdown())}e.body={rendererDebugAddr:o.rendererDebugAddr},t(e)}catch(o){e.success=!1,e.message=o.message,t(e)}else if(i.command==="runInTerminal")try{let o=await this.dbgr.runInTerminal(i.arguments,this.sessionId),n=e;n.body={},typeof o=="number"&&(n.body.shellProcessId=o),t(n)}catch(o){e.success=!1,e.message=o.message,t(e)}else if(i.command==="startDebugging")try{let o=i.arguments,n={...o.configuration,request:o.request,type:this.dbgr.type,name:o.configuration.name||this.name};await this.dbgr.startDebugging(n,this.sessionId)||(e.success=!1,e.message="Failed to start debugging"),t(e)}catch(o){e.success=!1,e.message=o.message,t(e)}else e.success=!1,e.message=`unknown request '${i.command}'`,t(e)}launchVsCode(i){let e=[];for(let t of i.args){let o=(t.prefix||"")+(t.path||""),n=/^--(.+)=(.+)$/.exec(o);if(n&&n.length===3){let r=n[1],s=n[2];(r==="file-uri"||r==="folder-uri")&&!pJ(t.path)&&(s=pJ(s)?s:A.file(s).toString()),e.push(`--${r}=${s}`)}else e.push(o)}return i.env&&e.push(`--extensionEnvironment=${JSON.stringify(i.env)}`),this.extensionHostDebugService.openExtensionDevelopmentHostWindow(e,!!i.debugRenderer)}send(i,e,t,o,n=!0){return new Promise((r,s)=>{if(!this.debugAdapter){this.inShutdown?r(void 0):s(new Error(d(9735,null,i)));return}let l,c=this.debugAdapter.sendRequest(i,e,u=>{l?.dispose(),u.success?r(u):s(u)},o);t&&(l=t.onCancellationRequested(()=>{l.dispose(),this.capabilities.supportsCancelRequest&&this.cancel({requestId:c})}))}).then(void 0,r=>Promise.reject(this.handleErrorResponse(r,n)))}handleErrorResponse(i,e){if(i.command==="canceled"&&i.message==="canceled")return new go;let t=i?.body?.error,o=i?.message||"",n=t?Ato(t.format,!1,t.variables):o,r=t?.url;if(t&&r){let l=t.urlLabel?t.urlLabel:d(9734,null),c=A.parse(r),u=c.scheme===Q.command?"debug.moreInfo.command":"debug.moreInfo";return w1(n,[ii({id:u,label:l,run:()=>this.openerService.open(c,{allowCommands:!0})})])}e&&t&&t.format&&t.showUser&&this.notificationService.error(n);let s=new pa(n);return s.showUser=t?.showUser,s}mergeCapabilities(i){i&&(this._capabilities=Xu(this._capabilities,i))}fireSimulatedContinuedEvent(i,e=!1){this._onDidContinued.fire({type:"event",event:"continued",body:{threadId:i,allThreadsContinued:e},seq:void 0})}dispose(){this.toDispose.dispose()}};wUe=I([m(4,ZD),m(5,Je),m(6,Ne),m(7,at)],wUe);var Nmn=1500,CUe=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,P){this.id=i;this._configuration=e;this.root=t;this.model=o;this.debugService=r;this.telemetryService=s;this.hostService=l;this.configurationService=c;this.paneCompositeService=u;this.workspaceContextService=p;this.productService=h;this.notificationService=g;this.uriIdentityService=v;this.instantiationService=b;this.customEndpointTelemetryService=S;this.workbenchEnvironmentService=y;this.logService=w;this.testService=k;this.accessibilityService=P;this.initialized=!1;this.sources=new Map;this.threads=new Map;this.threadIds=[];this.cancellationMap=new Map;this.rawListeners=new N;this.globalDisposables=new N;this.fetchThreadsScheduler=new co(()=>{let i=new Dt(()=>{this.fetchThreads()},100);return this.rawListeners.add(i),i});this.stoppedDetails=[];this.statusQueue=this.rawListeners.add(new KWi);this._onDidChangeState=new E;this._onDidEndAdapter=new E;this._onDidLoadedSource=new E;this._onDidCustomEvent=new E;this._onDidProgressStart=new E;this._onDidProgressUpdate=new E;this._onDidProgressEnd=new E;this._onDidInvalidMemory=new E;this._onDidChangeREPLElements=new E;this._onDidChangeName=new E;this._options=n||{},this.parentSession=this._options.parentSession,this.hasSeparateRepl()?this.repl=new RKt(this.configurationService):this.repl=this.parentSession.repl;let O=this.globalDisposables,V=O.add(new me);V.value=this.repl.onDidChangeElements($=>this._onDidChangeREPLElements.fire($)),f&&O.add(f.onWillShutdown(()=>{this.shutdown(),Be(O)})),this.correlatedTestRun=n?.testRun?T.getResult(n.testRun.runId):this.parentSession?.correlatedTestRun,this.correlatedTestRun&&O.add(this.correlatedTestRun.onComplete(()=>this.terminate()));let H=this._options.compoundRoot;H&&O.add(H.onDidSessionStop(()=>this.terminate())),this.passFocusScheduler=new Dt(()=>{if(this.debugService.getModel().getSessions().some($=>$.state===2)||this.getAllThreads().some($=>$.stopped))if(typeof this.lastContinuedThreadId=="number"){let $=this.debugService.getViewModel().focusedThread;if($&&$.threadId===this.lastContinuedThreadId&&!$.stopped){let J=this.getStoppedDetails()?.threadId,ae=typeof J=="number"?this.getThread(J):void 0;this.debugService.focusStackFrame(void 0,ae)}}else{let $=this.debugService.getViewModel().focusedSession;$&&$.getId()===this.getId()&&$.state!==2&&this.debugService.focusStackFrame(void 0)}},800);let G=this._options.parentSession;G&&O.add(G.onDidEndAdapter(()=>{!this.hasSeparateRepl()&&this.raw?.isInShutdown===!1&&(this.repl=this.repl.clone(),V.value=this.repl.onDidChangeElements($=>this._onDidChangeREPLElements.fire($)),this.parentSession=void 0)}))}getId(){return this.id}setSubId(i){this._subId=i}getMemory(i){return new vRt(i,this)}get subId(){return this._subId}get configuration(){return this._configuration.resolved}get unresolvedConfiguration(){return this._configuration.unresolved}get lifecycleManagedByParent(){return!!this._options.lifecycleManagedByParent}get compact(){return!!this._options.compact}get saveBeforeRestart(){return this._options.saveBeforeRestart??!this._options?.parentSession}get compoundRoot(){return this._options.compoundRoot}get suppressDebugStatusbar(){return this._options.suppressDebugStatusbar??!1}get suppressDebugToolbar(){return this._options.suppressDebugToolbar??!1}get suppressDebugView(){return this._options.suppressDebugView??!1}get autoExpandLazyVariables(){let i=this.accessibilityService.isScreenReaderOptimized(),e=this.configurationService.getValue("debug").autoExpandLazyVariables;return e==="auto"&&i||e==="on"}setConfiguration(i){this._configuration=i}getLabel(){return this.workspaceContextService.getWorkspace().folders.length>1&&this.root?`${this.name} (${Ga(this.root.uri)})`:this.name}setName(i){this._name=i,this._onDidChangeName.fire(i)}get name(){return this._name||this.configuration.name}get state(){if(!this.initialized)return 1;if(!this.raw)return 0;let i=this.debugService.getViewModel().focusedThread;return i&&i.session===this?i.stopped?2:3:this.getAllThreads().some(e=>e.stopped)?2:3}get capabilities(){return this.raw?this.raw.capabilities:Object.create(null)}get onDidChangeState(){return this._onDidChangeState.event}get onDidEndAdapter(){return this._onDidEndAdapter.event}get onDidChangeReplElements(){return this._onDidChangeREPLElements.event}get onDidChangeName(){return this._onDidChangeName.event}get onDidCustomEvent(){return this._onDidCustomEvent.event}get onDidLoadedSource(){return this._onDidLoadedSource.event}get onDidProgressStart(){return this._onDidProgressStart.event}get onDidProgressUpdate(){return this._onDidProgressUpdate.event}get onDidProgressEnd(){return this._onDidProgressEnd.event}get onDidInvalidateMemory(){return this._onDidInvalidMemory.event}async initialize(i){this.raw&&await this.shutdown();try{let e=await i.createDebugAdapter(this);this.raw=this.instantiationService.createInstance(wUe,e,i,this.id,this.configuration.name),await this.raw.start(),this.registerListeners(),await this.raw.initialize({clientID:"vscode",clientName:this.productService.nameLong,adapterID:this.configuration.type,pathFormat:"path",linesStartAt1:!0,columnsStartAt1:!0,supportsVariableType:!0,supportsVariablePaging:!0,supportsRunInTerminalRequest:!0,locale:wr,supportsProgressReporting:!0,supportsInvalidatedEvent:!0,supportsMemoryReferences:!0,supportsArgsCanBeInterpretedByShell:!0,supportsMemoryEvent:!0,supportsStartDebuggingRequest:!0,supportsANSIStyling:!0}),this.initialized=!0,this._onDidChangeState.fire(),this.rememberedCapabilities=this.raw.capabilities,this.debugService.setExceptionBreakpointsForSession(this,this.raw&&this.raw.capabilities.exceptionBreakpointFilters||[]),this.debugService.getModel().registerBreakpointModes(this.configuration.type,this.raw.capabilities.breakpointModes||[])}catch(e){throw this.initialized=!0,this._onDidChangeState.fire(),await this.shutdown(),e}}async launchOrAttach(i){if(!this.raw)throw new Error(d(9674,null,"launch or attach"));if(this.parentSession&&this.parentSession.state===0)throw PI();i.__sessionId=this.getId();try{await this.raw.launchOrAttach(i)}catch(e){throw this.shutdown(),e}}cancelCorrelatedTestRun(){this.correlatedTestRun&&!this.correlatedTestRun.completedAt&&(this.didTerminateTestRun=!0,this.testService.cancelTestRun(this.correlatedTestRun.id))}async terminate(i=!1){this.raw||this.onDidExitAdapter(),this.cancelAllRequests(),this._options.lifecycleManagedByParent&&this.parentSession?await this.parentSession.terminate(i):this.correlatedTestRun&&!this.correlatedTestRun.completedAt&&!this.didTerminateTestRun?this.cancelCorrelatedTestRun():this.raw&&(this.raw.capabilities.supportsTerminateRequest&&this._configuration.resolved.request==="launch"?await this.raw.terminate(i):await this.raw.disconnect({restart:i,terminateDebuggee:!0})),i||this._options.compoundRoot?.sessionStopped()}async disconnect(i=!1,e=!1){this.raw||this.onDidExitAdapter(),this.cancelAllRequests(),this._options.lifecycleManagedByParent&&this.parentSession?await this.parentSession.disconnect(i,e):this.raw&&await this.raw.disconnect({restart:i,terminateDebuggee:!1,suspendDebuggee:e}),i||this._options.compoundRoot?.sessionStopped()}async restart(){if(!this.raw)throw new Error(d(9674,null,"restart"));this.cancelAllRequests(),this._options.lifecycleManagedByParent&&this.parentSession?await this.parentSession.restart():await this.raw.restart({arguments:this.configuration})}async sendBreakpoints(i,e,t){if(!this.raw)throw new Error(d(9674,null,"breakpoints"));if(!this.raw.readyForBreakpoints)return Promise.resolve(void 0);let o=this.getRawSource(i);e.length&&!o.adapterData&&(o.adapterData=e[0].adapterData),o.path&&(o.path=Hp(o.path));let n=await this.raw.setBreakpoints({source:o,lines:e.map(r=>r.sessionAgnosticData.lineNumber),breakpoints:e.map(r=>r.toDAP()),sourceModified:t});if(n?.body){let r=new Map;for(let s=0;s<e.length;s++)r.set(e[s].getId(),n.body.breakpoints[s]);this.model.setBreakpointSessionData(this.getId(),this.capabilities,r)}}async sendFunctionBreakpoints(i){if(!this.raw)throw new Error(d(9674,null,"function breakpoints"));if(this.raw.readyForBreakpoints){let e=await this.raw.setFunctionBreakpoints({breakpoints:i.map(t=>t.toDAP())});if(e?.body){let t=new Map;for(let o=0;o<i.length;o++)t.set(i[o].getId(),e.body.breakpoints[o]);this.model.setBreakpointSessionData(this.getId(),this.capabilities,t)}}}async sendExceptionBreakpoints(i){if(!this.raw)throw new Error(d(9674,null,"exception breakpoints"));if(this.raw.readyForBreakpoints){let e=this.capabilities.supportsExceptionFilterOptions?{filters:[],filterOptions:i.map(o=>o.condition?{filterId:o.filter,condition:o.condition}:{filterId:o.filter})}:{filters:i.map(o=>o.filter)},t=await this.raw.setExceptionBreakpoints(e);if(t?.body&&t.body.breakpoints){let o=new Map;for(let n=0;n<i.length;n++)o.set(i[n].getId(),t.body.breakpoints[n]);this.model.setBreakpointSessionData(this.getId(),this.capabilities,o)}}}dataBytesBreakpointInfo(i,e){if(this.raw?.capabilities.supportsDataBreakpointBytes===!1)throw new Error(d(9675,null));return this._dataBreakpointInfo({name:i,bytes:e,asAddress:!0})}dataBreakpointInfo(i,e,t){return this._dataBreakpointInfo({name:i,variablesReference:e,frameId:t})}async _dataBreakpointInfo(i){if(!this.raw)throw new Error(d(9674,null,"data breakpoints info"));if(!this.raw.readyForBreakpoints)throw new Error(d(9676,null));return(await this.raw.dataBreakpointInfo(i))?.body}async sendDataBreakpoints(i){if(!this.raw)throw new Error(d(9674,null,"data breakpoints"));if(this.raw.readyForBreakpoints){let e=await Promise.all(i.map(async o=>{try{return{dap:await o.toDAP(this),bp:o}}catch(n){return{bp:o,message:n.message}}})),t=await this.raw.setDataBreakpoints({breakpoints:e.map(o=>o.dap).filter(lo)});if(t?.body){let o=new Map,n=0;for(let r of e)r.dap?n<t.body.breakpoints.length&&o.set(r.bp.getId(),t.body.breakpoints[n++]):o.set(r.bp.getId(),r.message);this.model.setBreakpointSessionData(this.getId(),this.capabilities,o)}}}async sendInstructionBreakpoints(i){if(!this.raw)throw new Error(d(9674,null,"instruction breakpoints"));if(this.raw.readyForBreakpoints){let e=await this.raw.setInstructionBreakpoints({breakpoints:i.map(t=>t.toDAP())});if(e?.body){let t=new Map;for(let o=0;o<i.length;o++)t.set(i[o].getId(),e.body.breakpoints[o]);this.model.setBreakpointSessionData(this.getId(),this.capabilities,t)}}}async breakpointsLocations(i,e){if(!this.raw)throw new Error(d(9674,null,"breakpoints locations"));let t=this.getRawSource(i),o=await this.raw.breakpointLocations({source:t,line:e});if(!o||!o.body||!o.body.breakpoints)return[];let n=o.body.breakpoints.map(r=>({lineNumber:r.line,column:r.column||1}));return zo(n,r=>`${r.lineNumber}:${r.column}`)}getDebugProtocolBreakpoint(i){return this.model.getDebugProtocolBreakpoint(i,this.getId())}customRequest(i,e){if(!this.raw)throw new Error(d(9674,null,i));return this.raw.custom(i,e)}stackTrace(i,e,t,o){if(!this.raw)throw new Error(d(9674,null,"stackTrace"));let n=this.getNewCancellationToken(i,o);return this.raw.stackTrace({threadId:i,startFrame:e,levels:t},n)}async exceptionInfo(i){if(!this.raw)throw new Error(d(9674,null,"exceptionInfo"));let e=await this.raw.exceptionInfo({threadId:i});if(e)return{id:e.body.exceptionId,description:e.body.description,breakMode:e.body.breakMode,details:e.body.details}}scopes(i,e){if(!this.raw)throw new Error(d(9674,null,"scopes"));let t=this.getNewCancellationToken(e);return this.raw.scopes({frameId:i},t)}variables(i,e,t,o,n){if(!this.raw)throw new Error(d(9674,null,"variables"));let r=e?this.getNewCancellationToken(e):void 0;return this.raw.variables({variablesReference:i,filter:t,start:o,count:n},r)}evaluate(i,e,t,o){if(!this.raw)throw new Error(d(9674,null,"evaluate"));return this.raw.evaluate({expression:i,frameId:e,context:t,line:o?.line,column:o?.column,source:o?.source})}async restartFrame(i,e){if(await this.waitForTriggeredBreakpoints(),!this.raw)throw new Error(d(9674,null,"restartFrame"));await this.raw.restartFrame({frameId:i},e)}setLastSteppingGranularity(i,e){let t=this.getThread(i);t&&(t.lastSteppingGranularity=e)}async next(i,e){if(await this.waitForTriggeredBreakpoints(),!this.raw)throw new Error(d(9674,null,"next"));this.setLastSteppingGranularity(i,e),await this.raw.next({threadId:i,granularity:e})}async stepIn(i,e,t){if(await this.waitForTriggeredBreakpoints(),!this.raw)throw new Error(d(9674,null,"stepIn"));this.setLastSteppingGranularity(i,t),await this.raw.stepIn({threadId:i,targetId:e,granularity:t})}async stepOut(i,e){if(await this.waitForTriggeredBreakpoints(),!this.raw)throw new Error(d(9674,null,"stepOut"));this.setLastSteppingGranularity(i,e),await this.raw.stepOut({threadId:i,granularity:e})}async stepBack(i,e){if(await this.waitForTriggeredBreakpoints(),!this.raw)throw new Error(d(9674,null,"stepBack"));this.setLastSteppingGranularity(i,e),await this.raw.stepBack({threadId:i,granularity:e})}async continue(i){if(await this.waitForTriggeredBreakpoints(),!this.raw)throw new Error(d(9674,null,"continue"));await this.raw.continue({threadId:i})}async reverseContinue(i){if(await this.waitForTriggeredBreakpoints(),!this.raw)throw new Error(d(9674,null,"reverse continue"));await this.raw.reverseContinue({threadId:i})}async pause(i){if(!this.raw)throw new Error(d(9674,null,"pause"));await this.raw.pause({threadId:i})}async terminateThreads(i){if(!this.raw)throw new Error(d(9674,null,"terminateThreads"));await this.raw.terminateThreads({threadIds:i})}setVariable(i,e,t){if(!this.raw)throw new Error(d(9674,null,"setVariable"));return this.raw.setVariable({variablesReference:i,name:e,value:t})}setExpression(i,e,t){if(!this.raw)throw new Error(d(9674,null,"setExpression"));return this.raw.setExpression({expression:e,value:t,frameId:i})}gotoTargets(i,e,t){if(!this.raw)throw new Error(d(9674,null,"gotoTargets"));return this.raw.gotoTargets({source:i,line:e,column:t})}goto(i,e){if(!this.raw)throw new Error(d(9674,null,"goto"));return this.raw.goto({threadId:i,targetId:e})}loadSource(i){if(!this.raw)return Promise.reject(new Error(d(9674,null,"loadSource")));let e=this.getSourceForUri(i),t;if(e)t=e.raw;else{let o=GK.getEncodedDebugData(i);t={path:o.path,sourceReference:o.sourceReference}}return this.raw.source({sourceReference:t.sourceReference||0,source:t})}async getLoadedSources(){if(!this.raw)return Promise.reject(new Error(d(9674,null,"getLoadedSources")));let i=await this.raw.loadedSources({});return i?.body&&i.body.sources?i.body.sources.map(e=>this.getSource(e)):[]}async completions(i,e,t,o,n){if(!this.raw)return Promise.reject(new Error(d(9674,null,"completions")));let r=this.getNewCancellationToken(e,n);return this.raw.completions({frameId:i,text:t,column:o.column,line:o.lineNumber},r)}async stepInTargets(i){return this.raw?(await this.raw.stepInTargets({frameId:i}))?.body.targets:Promise.reject(new Error(d(9674,null,"stepInTargets")))}async cancel(i){return this.raw?this.raw.cancel({progressId:i}):Promise.reject(new Error(d(9674,null,"cancel")))}async disassemble(i,e,t,o){return this.raw?(await this.raw.disassemble({memoryReference:i,offset:e,instructionOffset:t,instructionCount:o,resolveSymbols:!0}))?.body?.instructions:Promise.reject(new Error(d(9674,null,"disassemble")))}readMemory(i,e,t){return this.raw?this.raw.readMemory({count:t,memoryReference:i,offset:e}):Promise.reject(new Error(d(9674,null,"readMemory")))}writeMemory(i,e,t,o){return this.raw?this.raw.writeMemory({memoryReference:i,offset:e,allowPartial:o,data:t}):Promise.reject(new Error(d(9674,null,"disassemble")))}async resolveLocationReference(i){if(!this.raw)throw new Error(d(9674,null,"locations"));let e=await this.raw.locations({locationReference:i});if(!e?.body)throw new Error(d(9674,null,"locations"));let t=this.getSource(e.body.source);return{column:1,...e.body,source:t}}getThread(i){return this.threads.get(i)}getAllThreads(){let i=[];return this.threadIds.forEach(e=>{let t=this.threads.get(e);t&&i.push(t)}),i}clearThreads(i,e=void 0){if(e!=null){let t=this.threads.get(e);t&&(t.clearCallStack(),t.stoppedDetails=void 0,t.stopped=!1,i&&this.threads.delete(e))}else this.threads.forEach(t=>{t.clearCallStack(),t.stoppedDetails=void 0,t.stopped=!1}),i&&(this.threads.clear(),this.threadIds=[],lA.allValues.clear())}getStoppedDetails(){return this.stoppedDetails.length>=1?this.stoppedDetails[0]:void 0}rawUpdate(i){this.threadIds=[],i.threads.forEach(t=>{if(this.threadIds.push(t.id),!this.threads.has(t.id))this.threads.set(t.id,new cA(this,t.name,t.id));else if(t.name){let o=this.threads.get(t.id);o&&(o.name=t.name)}}),this.threads.forEach(t=>{this.threadIds.indexOf(t.threadId)===-1&&this.threads.delete(t.threadId)});let e=i.stoppedDetails;if(e)if(e.allThreadsStopped)this.threads.forEach(t=>{t.stoppedDetails=t.threadId===e.threadId?e:{reason:t.stoppedDetails?.reason},t.stopped=!0,t.clearCallStack()});else{let t=typeof e.threadId=="number"?this.threads.get(e.threadId):void 0;t&&(t.stoppedDetails=e,t.clearCallStack(),t.stopped=!0)}}waitForTriggeredBreakpoints(){if(this._waitToResume)return vp(this._waitToResume,Nmn)}async fetchThreads(i){if(this.raw){let e=await this.raw.threads();e?.body&&e.body.threads&&this.model.rawUpdate({sessionId:this.getId(),threads:e.body.threads,stoppedDetails:i})}}initializeForTest(i){this.raw=i,this.registerListeners()}registerListeners(){if(!this.raw)return;this.rawListeners.add(this.raw.onDidInitialize(async()=>{qr(this.configuration.noDebug?d(9672,null):d(9671,null));let t=async()=>{if(this.raw&&this.raw.capabilities.supportsConfigurationDoneRequest)try{await this.raw.configurationDone()}catch(o){this.notificationService.error(o),this.raw?.disconnect({})}};try{await this.debugService.sendAllBreakpoints(this)}finally{await t(),await this.fetchThreads()}}));let i=this.statusQueue;this.rawListeners.add(this.raw.onDidStop(t=>this.handleStop(t.body))),this.rawListeners.add(this.raw.onDidThread(t=>{if(i.cancel([t.body.threadId]),t.body.reason==="started")this.fetchThreadsScheduler.value.isScheduled()||this.fetchThreadsScheduler.value.schedule();else if(t.body.reason==="exited"){this.model.clearThreads(this.getId(),!0,t.body.threadId);let o=this.debugService.getViewModel(),n=o.focusedThread;this.passFocusScheduler.cancel(),n&&t.body.threadId===n.threadId&&this.debugService.focusStackFrame(void 0,void 0,o.focusedSession,{explicit:!1})}})),this.rawListeners.add(this.raw.onDidTerminateDebugee(async t=>{qr(d(9673,null)),t.body&&t.body.restart?await this.debugService.restartSession(this,t.body.restart):this.raw&&await this.raw.disconnect({terminateDebuggee:!1})})),this.rawListeners.add(this.raw.onDidContinued(async t=>{let o=t.body.allThreadsContinued!==!1,n;o?this.fetchThreadsScheduler.value.isScheduled()?(this.fetchThreadsScheduler.value.cancel(),n=this.fetchThreads().then(()=>this.threadIds)):n=this.threadIds:(n=[t.body.threadId],this.threadIds.includes(t.body.threadId)?n=[t.body.threadId]:(this.fetchThreadsScheduler.rawValue?.cancel(),n=this.fetchThreads().then(()=>[t.body.threadId]))),i.cancel(o?void 0:[t.body.threadId]),await i.run(n,r=>{this.stoppedDetails=this.stoppedDetails.filter(l=>l.threadId!==r);let s=this.cancellationMap.get(r);return this.cancellationMap.delete(r),s?.forEach(l=>l.dispose(!0)),this.model.clearThreads(this.getId(),!1,r),Promise.resolve()}),this.lastContinuedThreadId=o?void 0:t.body.threadId,this.passFocusScheduler.schedule(),this._onDidChangeState.fire()}));let e=new uh;this.rawListeners.add(this.raw.onDidOutput(async t=>{let o=t.body.category==="stderr"?bt.Error:t.body.category==="console"?bt.Warning:bt.Info;if(t.body.variablesReference){let n=t.body.source&&t.body.line?{lineNumber:t.body.line,column:t.body.column?t.body.column:1,source:this.getSource(t.body.source)}:void 0,s=new lA(this,void 0,t.body.variablesReference,xt()).getChildren();e.queue(async()=>{let l=await s;if(l.length===1){this.appendToRepl({output:t.body.output,expression:l[0],sev:o,source:n},t.body.category==="important");return}l.forEach(c=>{c.name=null,this.appendToRepl({output:"",expression:c,sev:o,source:n},t.body.category==="important")})});return}e.queue(async()=>{if(!t.body||!this.raw)return;if(t.body.category==="telemetry"){let r=this.raw.dbgr.getCustomTelemetryEndpoint();if(r&&this.telemetryService.telemetryLevel!==0){let s=t.body.data;!r.sendErrorTelemetry&&t.body.data&&(s=Nto(t.body.data)),this.customEndpointTelemetryService.publicLog(r,t.body.output,s)}return}let n=t.body.source&&t.body.line?{lineNumber:t.body.line,column:t.body.column?t.body.column:1,source:this.getSource(t.body.source)}:void 0;if(t.body.group==="start"||t.body.group==="startCollapsed"){let r=t.body.group==="start";this.repl.startGroup(this,t.body.output||"",r,n);return}t.body.group==="end"&&(this.repl.endGroup(),!t.body.output)||typeof t.body.output=="string"&&this.appendToRepl({output:t.body.output,sev:o,source:n},t.body.category==="important")})})),this.rawListeners.add(this.raw.onDidBreakpoint(t=>{let o=t.body&&t.body.breakpoint?t.body.breakpoint.id:void 0,n=this.model.getBreakpoints().find(c=>c.getIdFromAdapter(this.getId())===o),r=this.model.getFunctionBreakpoints().find(c=>c.getIdFromAdapter(this.getId())===o),s=this.model.getDataBreakpoints().find(c=>c.getIdFromAdapter(this.getId())===o),l=this.model.getExceptionBreakpoints().find(c=>c.getIdFromAdapter(this.getId())===o);if(t.body.reason==="new"&&t.body.breakpoint.source&&t.body.breakpoint.line){let c=this.getSource(t.body.breakpoint.source),u=this.model.addBreakpoints(c.uri,[{column:t.body.breakpoint.column,enabled:!0,lineNumber:t.body.breakpoint.line}],!1);if(u.length===1){let p=new Map([[u[0].getId(),t.body.breakpoint]]);this.model.setBreakpointSessionData(this.getId(),this.capabilities,p)}}if(t.body.reason==="removed"&&(n&&this.model.removeBreakpoints([n]),r&&this.model.removeFunctionBreakpoints(r.getId()),s&&this.model.removeDataBreakpoints(s.getId())),t.body.reason==="changed"){if(n){n.column||(t.body.breakpoint.column=void 0);let c=new Map([[n.getId(),t.body.breakpoint]]);this.model.setBreakpointSessionData(this.getId(),this.capabilities,c)}if(r){let c=new Map([[r.getId(),t.body.breakpoint]]);this.model.setBreakpointSessionData(this.getId(),this.capabilities,c)}if(s){let c=new Map([[s.getId(),t.body.breakpoint]]);this.model.setBreakpointSessionData(this.getId(),this.capabilities,c)}if(l){let c=new Map([[l.getId(),t.body.breakpoint]]);this.model.setBreakpointSessionData(this.getId(),this.capabilities,c)}}})),this.rawListeners.add(this.raw.onDidLoadedSource(t=>{this._onDidLoadedSource.fire({reason:t.body.reason,source:this.getSource(t.body.source)})})),this.rawListeners.add(this.raw.onDidCustomEvent(t=>{this._onDidCustomEvent.fire(t)})),this.rawListeners.add(this.raw.onDidProgressStart(t=>{this._onDidProgressStart.fire(t)})),this.rawListeners.add(this.raw.onDidProgressUpdate(t=>{this._onDidProgressUpdate.fire(t)})),this.rawListeners.add(this.raw.onDidProgressEnd(t=>{this._onDidProgressEnd.fire(t)})),this.rawListeners.add(this.raw.onDidInvalidateMemory(t=>{this._onDidInvalidMemory.fire(t)})),this.rawListeners.add(this.raw.onDidInvalidated(async t=>{let o=t.body.areas||["all"];if(o.includes("threads")||o.includes("stacks")||o.includes("all")){this.cancelAllRequests(),this.model.clearThreads(this.getId(),!0);let r=this.stoppedDetails.slice();this.stoppedDetails.length=0,r.length?await Promise.all(r.map(s=>this.handleStop(s))):this.fetchThreadsScheduler.value.isScheduled()||this.fetchThreadsScheduler.value.schedule()}let n=this.debugService.getViewModel();n.focusedSession===this&&n.updateViews()})),this.rawListeners.add(this.raw.onDidExitAdapter(t=>this.onDidExitAdapter(t)))}async handleStop(i){this.passFocusScheduler.cancel(),this.stoppedDetails.push(i),i.hitBreakpointIds&&(this._waitToResume=this.enableDependentBreakpoints(i.hitBreakpointIds)),this.statusQueue.run(this.fetchThreads(i).then(()=>i.threadId===void 0?this.threadIds:[i.threadId]),async(e,t)=>{let o=i.threadId===void 0&&this.threadIds.length>10,n=this.debugService.getViewModel().focusedThread,r=n!==void 0&&n.session===this&&!this.threads.has(n.threadId);r&&this.debugService.focusStackFrame(void 0,void 0);let s=typeof e=="number"?this.getThread(e):void 0;if(s){let l=this.model.refreshTopOfCallstack(s,!o),c=async()=>{if(r||!i.preserveFocusHint&&s.getCallStack().length){let p=this.debugService.getViewModel().focusedStackFrame;if(!p||p.thread.session===this){let h=!this.configurationService.getValue("debug").focusEditorOnBreak;await this.debugService.focusStackFrame(void 0,s,void 0,{preserveFocus:h})}s.stoppedDetails&&!t.isCancellationRequested&&(s.stoppedDetails.reason==="breakpoint"&&this.configurationService.getValue("debug").openDebug==="openOnDebugBreak"&&!this.suppressDebugView&&await this.paneCompositeService.openPaneComposite(cg,0),this.configurationService.getValue("debug").focusWindowOnBreak&&!this.workbenchEnvironmentService.extensionTestsLocationURI&&(Ki().document.hasFocus()||await this.hostService.focus(ut,{mode:2})))}};if(await l.topCallStack,i.hitBreakpointIds||(this._waitToResume=this.enableDependentBreakpoints(s)),t.isCancellationRequested||(c(),await l.wholeCallStack,t.isCancellationRequested))return;let u=this.debugService.getViewModel().focusedStackFrame;(!u||KK(u))&&c()}this._onDidChangeState.fire()})}async enableDependentBreakpoints(i){let e;if(Array.isArray(i))e=this.model.getBreakpoints().filter(n=>i.includes(n.getIdFromAdapter(this.id)));else{let n=i.getTopStackFrame();if(n===void 0||i.stoppedDetails&&i.stoppedDetails.reason!=="breakpoint")return;e=this.getBreakpointsAtPosition(n.source.uri,n.range.startLineNumber,n.range.endLineNumber,n.range.startColumn,n.range.endColumn)}let t=new Set;this.model.getBreakpoints({triggeredOnly:!0,enabledOnly:!0}).forEach(n=>{e.forEach(r=>{n.enabled&&n.triggeredBy===r.getId()&&(n.setSessionDidTrigger(this.getId()),t.add(n.uri.toString()))})});let o=[];return t.forEach(n=>o.push(this.debugService.sendBreakpoints(A.parse(n),void 0,this))),Promise.all(o)}getBreakpointsAtPosition(i,e,t,o,n){return this.model.getBreakpoints({uri:i}).filter(r=>!(r.lineNumber<e||r.lineNumber>t||r.column&&(r.column<o||r.column>n)))}onDidExitAdapter(i){this.initialized=!0,this.model.setBreakpointSessionData(this.getId(),this.capabilities,void 0),this.shutdown(),this._onDidEndAdapter.fire(i)}shutdown(){this.rawListeners.clear(),this.raw&&(this.raw.disconnect({}),this.raw.dispose(),this.raw=void 0),this.passFocusScheduler.cancel(),this.passFocusScheduler.dispose(),this.model.clearThreads(this.getId(),!0),this.sources.clear(),this.threads.clear(),this.threadIds=[],this.stoppedDetails=[],this._onDidChangeState.fire()}dispose(){this.cancelAllRequests(),this.rawListeners.dispose(),this.globalDisposables.dispose(),this._onDidChangeState.dispose(),this._onDidEndAdapter.dispose(),this._onDidLoadedSource.dispose(),this._onDidCustomEvent.dispose(),this._onDidProgressStart.dispose(),this._onDidProgressUpdate.dispose(),this._onDidProgressEnd.dispose(),this._onDidInvalidMemory.dispose(),this._onDidChangeREPLElements.dispose(),this._onDidChangeName.dispose(),this._waitToResume=void 0}getSourceForUri(i){return this.sources.get(this.uriIdentityService.asCanonicalUri(i).toString())}getSource(i){let e=new GK(i,this.getId(),this.uriIdentityService,this.logService),t=e.uri.toString(),o=this.sources.get(t);return o?(e=o,e.raw=Xu(e.raw,i),e.raw&&i&&(e.raw.presentationHint=i.presentationHint)):this.sources.set(t,e),e}getRawSource(i){let e=this.getSourceForUri(i);if(e)return e.raw;{let t=GK.getEncodedDebugData(i);return{name:t.name,path:t.path,sourceReference:t.sourceReference}}}getNewCancellationToken(i,e){let t=new Ye(e),o=this.cancellationMap.get(i)||[];return o.push(t),this.cancellationMap.set(i,o),t.token}cancelAllRequests(){this.cancellationMap.forEach(i=>i.forEach(e=>e.dispose(!0))),this.cancellationMap.clear()}getReplElements(){return this.repl.getReplElements()}hasSeparateRepl(){return!this.parentSession||this._options.repl!=="mergeWithParent"}removeReplExpressions(){this.repl.removeReplExpressions()}async addReplExpression(i,e){await this.repl.addReplExpression(this,i,e),this.debugService.getViewModel().updateViews()}appendToRepl(i,e){this.repl.appendToRepl(this,i),e&&this.notificationService.notify({message:i.output.toString(),severity:i.sev,source:this.name})}};CUe=I([m(5,Ni),m(6,Te),m(7,Zt),m(8,B),m(9,us),m(10,Pe),m(11,tt),m(12,Ne),m(13,ji),m(14,ht),m(15,F),m(16,Bgt),m(17,At),m(18,se),m(19,Ws),m(20,pd),m(21,Oi)],CUe);var KWi=class extends x{constructor(){super(...arguments);this.pendingCancellations=[];this.threadOps=this._register(new Vt)}async run(e,t){let o=new Set;this.pendingCancellations.push(o);let n=await e;for(let r=0;r<this.pendingCancellations.length;r++){let s=this.pendingCancellations[r];if(s===o){this.pendingCancellations.splice(r,1);break}else for(let l of n)s.add(l)}o.has(void 0)||await Promise.all(n.map(r=>{if(o.has(r))return;this.threadOps.get(r)?.cancel();let s=new Ye;return this.threadOps.set(r,s),t(r,s.token)}))}cancel(e){if(e)for(let t of e){this.threadOps.get(t)?.cancel(),this.threadOps.deleteAndDispose(t);for(let o of this.pendingCancellations)o.add(t)}else{for(let[t,o]of this.threadOps)o.cancel();this.threadOps.clearAndDisposeAll();for(let t of this.pendingCancellations)t.add(void 0)}}};var Rr;(b=>(b.MARKERS_CONTAINER_ID="workbench.panel.markers",b.MARKERS_VIEW_ID="workbench.panel.markers.view",b.MARKERS_VIEW_STORAGE_ID="workbench.panel.markers",b.MARKER_COPY_ACTION_ID="problems.action.copy",b.MARKER_COPY_MESSAGE_ACTION_ID="problems.action.copyMessage",b.RELATED_INFORMATION_COPY_MESSAGE_ACTION_ID="problems.action.copyRelatedInformationMessage",b.FOCUS_PROBLEMS_FROM_FILTER="problems.action.focusProblemsFromFilter",b.MARKERS_VIEW_FOCUS_FILTER="problems.action.focusFilter",b.MARKERS_VIEW_CLEAR_FILTER_TEXT="problems.action.clearFilterText",b.MARKERS_VIEW_SHOW_MULTILINE_MESSAGE="problems.action.showMultilineMessage",b.MARKERS_VIEW_SHOW_SINGLELINE_MESSAGE="problems.action.showSinglelineMessage",b.MARKER_OPEN_ACTION_ID="problems.action.open",b.MARKER_OPEN_SIDE_ACTION_ID="problems.action.openToSide",b.MARKER_SHOW_PANEL_ID="workbench.action.showErrorsWarnings",b.MARKER_SHOW_QUICK_FIX="problems.action.showQuickFixes",b.TOGGLE_MARKERS_VIEW_ACTION_ID="workbench.actions.view.toggleProblems"))(Rr||={});var Ap;(u=>(u.MarkersViewModeContextKey=new Y("problemsViewMode","tree"),u.MarkersTreeVisibilityContextKey=new Y("problemsVisibility",!1),u.MarkerFocusContextKey=new Y("problemFocus",!1),u.MarkerViewFilterFocusContextKey=new Y("problemsFilterFocus",!1),u.RelatedInformationFocusContextKey=new Y("relatedInformationFocus",!1),u.ShowErrorsFilterContextKey=new Y("problems.filter.errors",!0),u.ShowWarningsFilterContextKey=new Y("problems.filter.warnings",!0),u.ShowInfoFilterContextKey=new Y("problems.filter.info",!0),u.ShowActiveFileFilterContextKey=new Y("problems.filter.activeFile",!1),u.ShowExcludedFilesFilterContextKey=new Y("problems.filter.excludedFiles",!0)))(Ap||={});var GWi=(a,i)=>U.once(U.filter(a,i));var KTo="debug.taskerrorchoice",GTo=d(9683,null),Omn=d(9685,null),Fmn=d(9686,null),xUe=class{constructor(i,e,t,o,n,r,s,l){this.taskService=i;this.markerService=e;this.configurationService=t;this.viewsService=o;this.dialogService=n;this.storageService=r;this.commandService=s;this.progressService=l;this.globalCancellation=new Ye}cancel(){this.globalCancellation.dispose(!0),this.globalCancellation=new Ye}dispose(){this.globalCancellation.dispose(!0)}async runTaskAndCheckErrors(i,e){try{let t=await this.runTask(i,e,this.globalCancellation.token);if(t&&(t.exitCode===void 0||t.cancelled))return 0;let o=e?this.markerService.read({severities:8,take:2}).length:0,n=t&&t.exitCode===0,r=t&&t.exitCode!==0,s=this.configurationService.getValue("debug").onTaskErrors;if(n||s==="debugAnyway"||o===0&&!r)return 1;if(s==="showErrors")return await this.viewsService.openView(Rr.MARKERS_VIEW_ID,!0),Promise.resolve(0);if(s==="abort")return Promise.resolve(0);let l=typeof e=="string"?e:e?e.name:"",c=o>1?d(9691,null,l):o===1?d(9690,null,l):t&&typeof t.exitCode=="number"?d(9692,null,l,t.exitCode):d(9693,null,l),u;(y=>(y[y.DebugAnyway=1]="DebugAnyway",y[y.ShowErrors=2]="ShowErrors",y[y.Cancel=0]="Cancel"))(u||={});let{result:p,checkboxChecked:h}=await this.dialogService.prompt({type:bt.Warning,message:c,buttons:[{label:Omn,run:()=>1},{label:d(9697,null),run:()=>2}],cancelButton:{label:GTo,run:()=>0},checkbox:{label:d(9694,null)}}),g=p===1,f=p===0;return h&&this.configurationService.updateValue("debug.onTaskErrors",p===1?"debugAnyway":f?"abort":"showErrors"),f?Promise.resolve(0):g?1:(await this.viewsService.openView(Rr.MARKERS_VIEW_ID,!0),Promise.resolve(0))}catch(t){let o=this.taskService.configureAction(),n=JSON.parse(this.storageService.get(KTo,1,"{}")),r=-1,s;if((p=>(p[p.DebugAnyway=0]="DebugAnyway",p[p.ConfigureTask=1]="ConfigureTask",p[p.Cancel=2]="Cancel"))(s||={}),n[t.message]!==void 0)r=n[t.message];else{let{result:l,checkboxChecked:c}=await this.dialogService.prompt({type:bt.Error,message:t.message,buttons:[{label:d(9685,null),run:()=>0},{label:o.label,run:()=>1}],cancelButton:{run:()=>2},checkbox:{label:d(9695,null)}});r=l,c&&(n[t.message]=r,this.storageService.store(KTo,JSON.stringify(n),1,1))}return r===1&&await o.run(),r===0?1:0}}async runTask(i,e,t=this.globalCancellation.token){if(!e)return Promise.resolve(null);if(!i)return Promise.reject(new Error(d(9689,null,typeof e=="string"?e:e.type)));let o=await this.taskService.getTask(i,e);if(!o){let g=typeof e=="string"?d(9688,null,e):d(9687,null);return Promise.reject(w1(g,[ii({id:QG,label:rFe,enabled:!0,run:()=>this.commandService.executeCommand(QG)})]))}let n=!1,r=new N,s=g=>g.getKey()??g.getMapKey(),l=s(o),c=new Promise(g=>r.add(GWi(this.taskService.onDidStateChange,f=>(f.kind==="inactive"||f.kind==="processEnded"&&f.exitCode===void 0)&&s(f.__task)===l)(f=>{n=!0,g(f.kind==="processEnded"?{exitCode:f.exitCode}:null)})));r.add(GWi(this.taskService.onDidStateChange,g=>(g.kind==="active"||g.kind==="dependsOnStarted")&&s(g.__task)===l)(()=>{n=!0}));let u=r.add(new E);r.add(GWi(this.taskService.onDidStateChange,g=>g.kind==="acquiredInput"&&s(g.__task)===l)(()=>u.fire()));let p=this.taskService.getActiveTasks().then(async g=>{if(g.find(v=>s(v)===l))return u.fire(),(await this.taskService.getBusyTasks()).find(b=>s(b)===l)?(n=!0,c):Promise.resolve(null);let f=this.taskService.run(o);return o.configurationProperties.isBackground?c:f.then(v=>v??null)}),h=new Promise((g,f)=>{p.then(v=>{n=!0,g(v)},v=>f(v)),r.add(t.onCancellationRequested(()=>{g({exitCode:void 0,cancelled:!0}),this.taskService.terminate(o).catch(()=>{})})),r.add(u.event(()=>{let v=o.configurationProperties.isBackground?5e3:1e4;r.add(tn(()=>{if(!n){let S=d(9698,null,typeof e=="string"?e:JSON.stringify(e));f({severity:bt.Error,message:S})}},v)),this.configurationService.getValue("debug").hideSlowPreLaunchWarning||r.add(tn(()=>{let S=d(9696,null,o.configurationProperties.name),y=[Fmn,GTo],w=o instanceof Ld||o instanceof kf;w&&y.splice(1,0,d(9684,null)),this.progressService.withProgress({location:15,title:S,buttons:y},()=>h.catch(()=>{}),k=>{k===void 0||(k===0?g({exitCode:0}):(g({exitCode:void 0,cancelled:!0}),this.taskService.terminate(o).catch(()=>{}),w&&k===1&&this.taskService.openConfig(o)))})},1e4))}))});return h.finally(()=>r.dispose())}};xUe=I([m(0,Og),m(1,oa),m(2,B),m(3,$t),m(4,at),m(5,ce),m(6,ge),m(7,Fo)],xUe);var kUe=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T){this.editorService=i;this.paneCompositeService=e;this.viewsService=t;this.viewDescriptorService=o;this.notificationService=n;this.dialogService=r;this.layoutService=s;this.contextService=l;this.contextKeyService=c;this.lifecycleService=u;this.instantiationService=p;this.extensionService=h;this.fileService=g;this.configurationService=f;this.extensionHostDebugService=v;this.activityService=b;this.commandService=S;this.quickInputService=y;this.workspaceTrustRequestService=w;this.uriIdentityService=k;this.testService=T;this.restartingSessions=new Set;this.disposables=new N;this.initializing=!1;this.sessionCancellationTokens=new Map;this.haveDoneLazySetup=!1;this.breakpointsToSendOnResourceSaved=new Set,this._onDidChangeState=this.disposables.add(new E),this._onDidNewSession=this.disposables.add(new E),this._onWillNewSession=this.disposables.add(new E),this._onDidEndSession=this.disposables.add(new E),this.adapterManager=this.instantiationService.createInstance(vUe,{onDidNewSession:this.onDidNewSession,configurationManager:()=>this.configurationManager}),this.disposables.add(this.adapterManager),this.configurationManager=this.instantiationService.createInstance(SUe,this.adapterManager),this.disposables.add(this.configurationManager),this.debugStorage=this.disposables.add(this.instantiationService.createInstance(mUe)),this.chosenEnvironments=this.debugStorage.loadChosenEnvironments(),this.model=this.instantiationService.createInstance(yTe,this.debugStorage),this.telemetry=this.instantiationService.createInstance(hUe,this.model),this.viewModel=this.disposables.add(new D4t(c)),this.taskRunner=this.instantiationService.createInstance(xUe),this.disposables.add(this.fileService.onDidFilesChange(P=>this.onFileChanges(P))),this.disposables.add(this.lifecycleService.onWillShutdown(this.dispose,this)),this.disposables.add(this.extensionHostDebugService.onAttachSession(P=>{let O=this.model.getSession(P.sessionId,!0);O&&(O.configuration.request="attach",O.configuration.port=P.port,O.setSubId(P.subId),this.launchOrAttachToSession(O))})),this.disposables.add(this.extensionHostDebugService.onTerminateSession(P=>{let O=this.model.getSession(P.sessionId);O&&O.subId===P.subId&&O.disconnect()})),this.disposables.add(this.viewModel.onDidFocusStackFrame(()=>{this.onStateChange()})),this.disposables.add(this.viewModel.onDidFocusSession(P=>{this.onStateChange(),P&&this.setExceptionBreakpointFallbackSession(P.getId())})),this.disposables.add(U.any(this.adapterManager.onDidRegisterDebugger,this.configurationManager.onDidSelectConfiguration)(()=>{let P=this.state!==0||this.configurationManager.getAllConfigurations().length>0&&this.adapterManager.hasEnabledDebuggers()?"default":"simple";this.debugUx.set(P),this.debugStorage.storeDebugUxState(P)})),this.disposables.add(this.model.onDidChangeCallStack(()=>{let P=this.model.getSessions().filter(O=>!O.parentSession).length;if(this.activity?.dispose(),P>0){let O=this.viewDescriptorService.getViewContainerByViewId(f4);O&&(this.activity=this.activityService.showViewContainerActivity(O.id,{badge:new Rd(P,V=>V===1?d(9649,null):d(9666,null,V))}))}})),this.disposables.add(i.onDidActiveEditorChange(()=>{this.contextKeyService.bufferChangeEvents(()=>{i.activeEditor===GR.instance?this.disassemblyViewFocus.set(!0):this.disassemblyViewFocus?.reset()})})),this.disposables.add(this.lifecycleService.onBeforeShutdown(()=>{for(let P of i.editors)P.resource?.scheme===lue&&P.dispose()})),this.disposables.add(h.onWillStop(P=>{P.veto(this.model.getSessions().length>0,d(9650,null))})),this.initContextKeys(c)}initContextKeys(i){queueMicrotask(()=>{i.bufferChangeEvents(()=>{this.debugType=gTe.bindTo(i),this.debugState=Zs.bindTo(i),this.hasDebugged=YLt.bindTo(i),this.inDebugMode=sl.bindTo(i),this.debugUx=rA.bindTo(i),this.debugUx.set(this.debugStorage.loadDebugUxState()),this.breakpointsExist=v4.bindTo(i),this.disassemblyViewFocus=zK.bindTo(i)});let e=()=>this.breakpointsExist.set(!!(this.model.getBreakpoints().length||this.model.getDataBreakpoints().length||this.model.getFunctionBreakpoints().length));e(),this.disposables.add(this.model.onDidChangeBreakpoints(()=>e()))})}getModel(){return this.model}getViewModel(){return this.viewModel}getConfigurationManager(){return this.configurationManager}getAdapterManager(){return this.adapterManager}sourceIsNotAvailable(i){this.model.sourceIsNotAvailable(i)}dispose(){this.disposables.dispose()}get state(){let i=this.viewModel.focusedSession;return i?i.state:this.initializing?1:0}get initializingOptions(){return this._initializingOptions}startInitializingState(i){this.initializing||(this.initializing=!0,this._initializingOptions=i,this.onStateChange())}endInitializingState(){this.initializing&&(this.initializing=!1,this._initializingOptions=void 0,this.onStateChange())}cancelTokens(i){if(i){let e=this.sessionCancellationTokens.get(i);e&&(e.cancel(),this.sessionCancellationTokens.delete(i))}else this.sessionCancellationTokens.forEach(e=>e.cancel()),this.sessionCancellationTokens.clear()}onStateChange(){let i=this.state;this.previousState!==i&&(this.contextKeyService.bufferChangeEvents(()=>{this.debugState.set(KR(i)),this.inDebugMode.set(i!==0);let e=i!==0&&i!==1||this.adapterManager.hasEnabledDebuggers()&&this.configurationManager.selectedConfiguration.name?"default":"simple";this.debugUx.set(e),this.debugStorage.storeDebugUxState(e)}),this.previousState=i,this._onDidChangeState.fire(i))}get onDidChangeState(){return this._onDidChangeState.event}get onDidNewSession(){return this._onDidNewSession.event}get onWillNewSession(){return this._onWillNewSession.event}get onDidEndSession(){return this._onDidEndSession.event}lazySetup(){this.haveDoneLazySetup||(this.disposables.add(this.fileService.registerProvider(lue,this.disposables.add(new R4t(this)))),this.haveDoneLazySetup=!0)}async startDebugging(i,e,t,o=!t?.parentSession){let n=t&&t.noDebug?d(9670,null):d(9659,null);if(!await this.workspaceTrustRequestService.requestWorkspaceTrust({message:n}))return!1;this.lazySetup(),this.startInitializingState(t),this.hasDebugged.set(!0);try{await this.extensionService.activateByEvent("onDebug"),o&&await S9e(this.configurationService,this.editorService),await this.extensionService.whenInstalledExtensionsRegistered();let s,l;if(e||(e=this.configurationManager.selectedConfiguration.name),typeof e=="string"&&i?(s=i.getConfiguration(e),l=i.getCompound(e)):typeof e!="string"&&(s=e),l){if(!l.configurations)throw new Error(d(9653,null));if(l.preLaunchTask&&await this.taskRunner.runTaskAndCheckErrors(i?.workspace||this.contextService.getWorkspace(),l.preLaunchTask)===0)return this.endInitializingState(),!1;l.stopAll&&(t={...t,compoundRoot:new C4t});let p=(await Promise.all(l.configurations.map(h=>{let g=typeof h=="string"?h:h.name;if(g===l.name)return Promise.resolve(!1);let f;if(typeof h=="string"){let v=this.configurationManager.getLaunches().filter(b=>!!b.getConfiguration(g));if(v.length===1)f=v[0];else if(i&&v.length>1&&v.indexOf(i)>=0)f=i;else throw new Error(v.length===0?d(9667,null,g):d(9664,null,g))}else if(h.folder){let v=this.configurationManager.getLaunches().filter(b=>b.workspace&&b.workspace.name===h.folder&&!!b.getConfiguration(h.name));if(v.length===1)f=v[0];else throw new Error(d(9668,null,h.folder,h.name,l.name))}return this.createSession(f,f.getConfiguration(g),t)}))).every(h=>!!h);return this.endInitializingState(),p}if(e&&!s){let u=i?d(9654,null,typeof e=="string"?e:e.name):d(9663,null);throw new Error(u)}let c=await this.createSession(i,s,t);return this.endInitializingState(),c}catch(s){return this.notificationService.error(s),this.endInitializingState(),Promise.reject(s)}}async createSession(i,e,t){let o;e?o=e.type:e=Object.create(null),(t&&t.noDebug||t&&typeof t.noDebug>"u"&&t.parentSession&&t.parentSession.configuration.noDebug)&&(e.noDebug=!0);let n=Ji(e),r,s;if(!o){if(s=this.editorService.activeEditor,s&&s.resource){let p=this.chosenEnvironments[s.resource.toString()];if(p&&(o=p.type,p.dynamicLabel)){let g=(await this.configurationManager.getDynamicConfigurationsByType(p.type)).find(f=>f.label===p.dynamicLabel);g&&(i=g.launch,Object.assign(e,g.config))}}o||(r=await this.adapterManager.guessDebugger(!1),r&&(o=r.debugger.type,r.withConfig&&(i=r.withConfig.launch,Object.assign(e,r.withConfig.config))))}let l=new Ye,c=xt();this.sessionCancellationTokens.set(c,l);let u=await this.configurationManager.resolveConfigurationByProviders(i&&i.workspace?i.workspace.uri:void 0,o,e,l.token);if(u&&u.type)try{let p=await this.substituteVariables(i,u);if(!p||l.token.isCancellationRequested)return!1;let h=!1;if(t?.startedByUser&&p&&p.suppressMultipleSessionWarning!==!0){let y=this.model.getSessions(),w=i?.workspace,k=y.find(T=>T.configuration.name===p.name&&T.configuration.type===p.type&&T.configuration.request===p.request&&T.root===w);if(k){if(!await this.confirmConcurrentSession(k.getLabel()))return!1;h=!0}}let g=i?.workspace||this.contextService.getWorkspace();if(await this.taskRunner.runTaskAndCheckErrors(g,p.preLaunchTask)===0)return!1;let v=await this.configurationManager.resolveDebugConfigurationWithSubstitutedVariables(i&&i.workspace?i.workspace.uri:void 0,p.type,p,l.token);if(!v)return i&&o&&v===null&&!l.token.isCancellationRequested&&await i.openConfigFile({preserveFocus:!0,type:o},l.token),!1;p=v;let b=this.adapterManager.getDebugger(p.type);if(!b||u.request!=="attach"&&u.request!=="launch"){let y;u.request!=="attach"&&u.request!=="launch"?y=u.request?d(9658,null,"request",u.request):d(9657,null,"request"):y=p.type?d(9661,null,p.type):d(9660,null);let w=[];return w.push(ii({id:"installAdditionalDebuggers",label:d(9662,null,p.type),enabled:!0,run:async()=>this.commandService.executeCommand("debug.installAdditionalDebuggers",p?.type)})),await this.showError(y,w),!1}if(!b.enabled)return await this.showError(cRt(b.type),[]),!1;let S=await this.doCreateSession(c,i?.workspace,{resolved:p,unresolved:n},t,h);return S&&r&&s&&s.resource&&(this.chosenEnvironments[s.resource.toString()]={type:r.debugger.type,dynamicLabel:r.withConfig?.label},this.debugStorage.storeChosenEnvironments(this.chosenEnvironments)),S}catch(p){return p&&p.message?await this.showError(p.message):this.contextService.getWorkbenchState()===1&&await this.showError(d(9669,null)),i&&!l.token.isCancellationRequested&&await i.openConfigFile({preserveFocus:!0},l.token),!1}return i&&o&&u===null&&!l.token.isCancellationRequested&&await i.openConfigFile({preserveFocus:!0,type:o},l.token),!1}async doCreateSession(i,e,t,o,n=!1){let r=this.instantiationService.createInstance(CUe,i,t,e,this.model,o);if(!n&&o?.startedByUser&&this.model.getSessions().some(l=>l.configuration.name===t.resolved.name&&l.configuration.type===t.resolved.type&&l.configuration.request===t.resolved.request&&l.root===e)&&t.resolved.suppressMultipleSessionWarning!==!0&&!await this.confirmConcurrentSession(r.getLabel()))return!1;this.model.addSession(r),this._onWillNewSession.fire(r);let s=this.configurationService.getValue("debug").openDebug;!t.resolved.noDebug&&(s==="openOnSessionStart"||s!=="neverOpen"&&this.viewModel.firstSessionStart)&&!r.suppressDebugView&&await this.paneCompositeService.openPaneComposite(cg,0);try{await this.launchOrAttachToSession(r);let l=r.configuration.internalConsoleOptions||this.configurationService.getValue("debug").internalConsoleOptions;(l==="openOnSessionStart"||this.viewModel.firstSessionStart&&l==="openOnFirstSessionStart")&&this.viewsService.openView(Td,!1),this.viewModel.firstSessionStart=!1;let c=this.configurationService.getValue("debug").showSubSessionsInToolBar,u=this.model.getSessions();return(c?u:u.filter(h=>!h.parentSession)).length>1&&this.viewModel.setMultiSessionView(!0),this._onDidNewSession.fire(r),!0}catch(l){if(ao(l)||(r&&r.getReplElements().length>0&&this.viewsService.openView(Td,!1),r.configuration&&r.configuration.request==="attach"&&r.configuration.__autoAttach))return!1;let c=l instanceof Error?l.message:l;return l.showUser!==!1&&await this.showError(c,i7(l)?l.actions:[]),!1}}async confirmConcurrentSession(i){return(await this.dialogService.confirm({message:d(9665,null,i)})).confirmed}async launchOrAttachToSession(i,e=!1){this.registerSessionListeners(i);let t=this.adapterManager.getDebugger(i.configuration.type);try{await i.initialize(t),await i.launchOrAttach(i.configuration);let o=!!i.root&&!!this.configurationService.getValue("launch",{resource:i.root.uri});await this.telemetry.logDebugSessionStart(t,o),(e||!this.viewModel.focusedSession||i.parentSession===this.viewModel.focusedSession&&i.compact)&&await this.focusStackFrame(void 0,void 0,i)}catch(o){return this.viewModel.focusedSession===i&&await this.focusStackFrame(void 0),Promise.reject(o)}}registerSessionListeners(i){let e=new N;this.disposables.add(e);let t=e.add(new Dt(()=>{i.state===3&&this.viewModel.focusedSession===i&&this.viewModel.setFocus(void 0,this.viewModel.focusedThread,i,!1)},200));e.add(i.onDidChangeState(()=>{i.state===3&&this.viewModel.focusedSession===i&&t.schedule(),i===this.viewModel.focusedSession&&this.onStateChange()})),e.add(this.onDidEndSession(o=>{o.session===i&&this.disposables.delete(e)})),e.add(i.onDidEndAdapter(async o=>{o&&(o.error&&this.notificationService.error(d(9655,null,o.error.message||o.error.toString())),this.telemetry.logDebugSessionStop(i,o));let n=b9e(i);if(n&&n.state===3&&n.configuration.noDebug&&this.extensionHostDebugService.close(n.getId()),i.configuration.postDebugTask){let s=i.root??this.contextService.getWorkspace();try{await this.taskRunner.runTask(s,i.configuration.postDebugTask)}catch(l){this.notificationService.error(l)}}if(this.endInitializingState(),this.cancelTokens(i.getId()),this.configurationService.getValue("debug").closeReadonlyTabsOnEnd){let s=this.editorService.getEditors(1).filter(({editor:l})=>l.resource?.scheme===KC&&i.getId()===GK.getEncodedDebugData(l.resource).sessionId);this.editorService.closeEditors(s)}this._onDidEndSession.fire({session:i,restart:this.restartingSessions.has(i)});let r=this.viewModel.focusedSession;if(r&&r.getId()===i.getId()){let{session:s,thread:l,stackFrame:c}=qTo(this.model,void 0,void 0,void 0,r);this.viewModel.setFocus(c,l,s,!1)}if(this.model.getSessions().length===0&&(this.viewModel.setMultiSessionView(!1),this.layoutService.isVisible("workbench.parts.sidebar")&&this.configurationService.getValue("debug").openExplorerOnEnd&&this.paneCompositeService.openPaneComposite(nv,0),this.model.getDataBreakpoints().filter(l=>!l.canPersist).forEach(l=>this.model.removeDataBreakpoints(l.getId())),this.configurationService.getValue("debug").console.closeOnEnd)){let l=this.viewDescriptorService.getViewContainerByViewId(Td);l&&this.viewsService.isViewContainerVisible(l.id)&&this.viewsService.closeViewContainer(l.id)}this.model.removeExceptionBreakpointsForSession(i.getId())}))}async restartSession(i,e){i.saveBeforeRestart&&await S9e(this.configurationService,this.editorService);let t=!!e,o=async()=>{if(t)return Promise.resolve(1);let h=i.root||this.contextService.getWorkspace();await this.taskRunner.runTask(h,i.configuration.preRestartTask),await this.taskRunner.runTask(h,i.configuration.postDebugTask);let g=await this.taskRunner.runTaskAndCheckErrors(h,i.configuration.preLaunchTask);return g!==1?g:this.taskRunner.runTaskAndCheckErrors(h,i.configuration.postRestartTask)},n=b9e(i);if(n){await o()===1&&this.extensionHostDebugService.reload(n.getId());return}let r=!1,s,l=i.root?this.configurationManager.getLaunch(i.root.uri):void 0;l&&(s=l.getConfiguration(i.configuration.name),s&&!eo(s,i.unresolvedConfiguration)&&(s.noDebug=i.configuration.noDebug,r=!0));let c=i.configuration;if(l&&r&&s){let h=new Ye;this.sessionCancellationTokens.set(i.getId(),h);let g=await this.configurationManager.resolveConfigurationByProviders(l.workspace?l.workspace.uri:void 0,s.type,s,h.token);g?(c=await this.substituteVariables(l,g),c&&!h.token.isCancellationRequested&&(c=await this.configurationManager.resolveDebugConfigurationWithSubstitutedVariables(l&&l.workspace?l.workspace.uri:void 0,c.type,c,h.token))):c=g}c&&i.setConfiguration({resolved:c,unresolved:s}),i.configuration.__restart=e;let u=async h=>{this.restartingSessions.add(i);let g=!1;try{g=await h()!==!1}catch(f){throw g=!1,f}finally{this.restartingSessions.delete(i),g||this._onDidEndSession.fire({session:i,restart:!1})}};for(let h of this.model.getBreakpoints({triggeredOnly:!0}))h.setSessionDidTrigger(i.getId(),!1);if(i.correlatedTestRun){i.correlatedTestRun.completedAt||(i.cancelCorrelatedTestRun(),await U.toPromise(i.correlatedTestRun.onComplete)),this.testService.runResolvedTests(i.correlatedTestRun.request);return}if(i.capabilities.supportsRestartRequest){await o()===1&&await u(async()=>(await i.restart(),!0));return}let p=!!this.viewModel.focusedSession&&i.getId()===this.viewModel.focusedSession.getId();return u(async()=>(t?await i.disconnect(!0):await i.terminate(!0),new Promise((h,g)=>{setTimeout(async()=>{if(await o()!==1||!c)return h(!1);try{await this.launchOrAttachToSession(i,p),this._onDidNewSession.fire(i),h(!0)}catch(v){g(v)}},300)})))}async stopSession(i,e=!1,t=!1){if(i)return e?i.disconnect(void 0,t):i.terminate();let o=this.model.getSessions();return o.length===0&&(this.taskRunner.cancel(),await this.quickInputService.cancel(),this.endInitializingState(),this.cancelTokens(void 0)),Promise.all(o.map(n=>e?n.disconnect(void 0,t):n.terminate()))}async substituteVariables(i,e){let t=this.adapterManager.getDebugger(e.type);if(t){let o;if(i&&i.workspace)o=i.workspace;else{let n=this.contextService.getWorkspace().folders;n.length===1&&(o=n[0])}try{return await t.substituteVariables(o,e)}catch(n){n.message!==x9&&this.showError(n.message,void 0,!!i?.getConfiguration(e.name));return}}return Promise.resolve(e)}async showError(i,e=[],t=!0){let o=ii({id:QG,label:rFe,enabled:!0,run:()=>this.commandService.executeCommand(QG)}),n=e.filter(r=>r.id.endsWith(".command")).length>0?e:[...e,...t?[o]:[]];await this.dialogService.prompt({type:bt.Error,message:i,buttons:n.map(r=>({label:r.label,run:()=>r.run()})),cancelButton:!0})}async focusStackFrame(i,e,t,o){let{stackFrame:n,thread:r,session:s}=qTo(this.model,i,e,t);if(n){let l=await n.openInEditor(this.editorService,o?.preserveFocus??!0,o?.sideBySide,o?.pinned);if(l&&l.input!==GR.instance){let c=l.getControl();if(n&&pn(c)&&c.hasModel()){let u=c.getModel(),p=n.range.startLineNumber;if(p>=1&&p<=u.getLineCount()){let h=c.getModel().getLineContent(p);en(d(9656,null,h,r&&r.stoppedDetails?`, reason ${r.stoppedDetails.reason}`:"",n.source?n.source.name:"",n.range.startLineNumber))}}}}s?this.debugType.set(s.configuration.type):this.debugType.reset(),this.viewModel.setFocus(n,r,s,!!o?.explicit)}addWatchExpression(i){let e=this.model.addWatchExpression(i);i||this.viewModel.setSelectedExpression(e,!1),this.debugStorage.storeWatchExpressions(this.model.getWatchExpressions())}renameWatchExpression(i,e){this.model.renameWatchExpression(i,e),this.debugStorage.storeWatchExpressions(this.model.getWatchExpressions())}moveWatchExpression(i,e){this.model.moveWatchExpression(i,e),this.debugStorage.storeWatchExpressions(this.model.getWatchExpressions())}removeWatchExpressions(i){this.model.removeWatchExpressions(i),this.debugStorage.storeWatchExpressions(this.model.getWatchExpressions())}canSetBreakpointsIn(i){return this.adapterManager.canSetBreakpointsIn(i)}async enableOrDisableBreakpoints(i,e){e?(this.model.setEnablement(e,i),this.debugStorage.storeBreakpoints(this.model),e instanceof Nv?(await this.makeTriggeredBreakpointsMatchEnablement(i,e),await this.sendBreakpoints(e.originalUri)):e instanceof mI?await this.sendFunctionBreakpoints():e instanceof hy?await this.sendDataBreakpoints():e instanceof hI?await this.sendInstructionBreakpoints():await this.sendExceptionBreakpoints()):(this.model.enableOrDisableAllBreakpoints(i),this.debugStorage.storeBreakpoints(this.model),await this.sendAllBreakpoints()),this.debugStorage.storeBreakpoints(this.model)}async addBreakpoints(i,e,t=!0){let o=this.model.addBreakpoints(i,e);return t&&o.forEach(n=>qr(d(9651,null,n.lineNumber,i.fsPath))),this.debugStorage.storeBreakpoints(this.model),await this.sendBreakpoints(i),this.debugStorage.storeBreakpoints(this.model),o}async updateBreakpoints(i,e,t){this.model.updateBreakpoints(e),this.debugStorage.storeBreakpoints(this.model),t?this.breakpointsToSendOnResourceSaved.add(i):(await this.sendBreakpoints(i),this.debugStorage.storeBreakpoints(this.model))}async removeBreakpoints(i){let e=this.model.getBreakpoints(),t=i===void 0?e:i instanceof Array?e.filter(n=>i.includes(n.getId())):e.filter(n=>n.getId()===i);t.forEach(n=>qr(d(9652,null,n.lineNumber,n.uri.fsPath)));let o=new Set(t.map(n=>n.originalUri.toString()));this.model.removeBreakpoints(t),this.unlinkTriggeredBreakpoints(e,t).forEach(n=>o.add(n.toString())),this.debugStorage.storeBreakpoints(this.model),await Promise.all([...o].map(n=>this.sendBreakpoints(A.parse(n))))}setBreakpointsActivated(i){return this.model.setBreakpointsActivated(i),this.sendAllBreakpoints()}async addFunctionBreakpoint(i,e){this.model.addFunctionBreakpoint(i??{name:""},e),i&&(this.debugStorage.storeBreakpoints(this.model),await this.sendFunctionBreakpoints(),this.debugStorage.storeBreakpoints(this.model))}async updateFunctionBreakpoint(i,e){this.model.updateFunctionBreakpoint(i,e),this.debugStorage.storeBreakpoints(this.model),await this.sendFunctionBreakpoints()}async removeFunctionBreakpoints(i){this.model.removeFunctionBreakpoints(i),this.debugStorage.storeBreakpoints(this.model),await this.sendFunctionBreakpoints()}async addDataBreakpoint(i){this.model.addDataBreakpoint(i),this.debugStorage.storeBreakpoints(this.model),await this.sendDataBreakpoints(),this.debugStorage.storeBreakpoints(this.model)}async updateDataBreakpoint(i,e){this.model.updateDataBreakpoint(i,e),this.debugStorage.storeBreakpoints(this.model),await this.sendDataBreakpoints()}async removeDataBreakpoints(i){this.model.removeDataBreakpoints(i),this.debugStorage.storeBreakpoints(this.model),await this.sendDataBreakpoints()}async addInstructionBreakpoint(i){this.model.addInstructionBreakpoint(i),this.debugStorage.storeBreakpoints(this.model),await this.sendInstructionBreakpoints(),this.debugStorage.storeBreakpoints(this.model)}async removeInstructionBreakpoints(i,e){this.model.removeInstructionBreakpoints(i,e),this.debugStorage.storeBreakpoints(this.model),await this.sendInstructionBreakpoints()}setExceptionBreakpointFallbackSession(i){this.model.setExceptionBreakpointFallbackSession(i),this.debugStorage.storeBreakpoints(this.model)}setExceptionBreakpointsForSession(i,e){this.model.setExceptionBreakpointsForSession(i.getId(),e),this.debugStorage.storeBreakpoints(this.model)}async setExceptionBreakpointCondition(i,e){this.model.setExceptionBreakpointCondition(i,e),this.debugStorage.storeBreakpoints(this.model),await this.sendExceptionBreakpoints()}async sendAllBreakpoints(i){let e=zo(this.model.getBreakpoints(),t=>t.originalUri.toString()).map(t=>this.sendBreakpoints(t.originalUri,!1,i));i?.capabilities.supportsConfigurationDoneRequest?await Promise.all([...e,this.sendFunctionBreakpoints(i),this.sendDataBreakpoints(i),this.sendInstructionBreakpoints(i),this.sendExceptionBreakpoints(i)]):(await Promise.all(e),await this.sendFunctionBreakpoints(i),await this.sendDataBreakpoints(i),await this.sendInstructionBreakpoints(i),await this.sendExceptionBreakpoints(i))}unlinkTriggeredBreakpoints(i,e){let t=[];for(let o of e)for(let n of i)!e.includes(n)&&n.triggeredBy===o.getId()&&(this.model.updateBreakpoints(new Map([[n.getId(),{triggeredBy:void 0}]])),t.push(n.originalUri));return t}async makeTriggeredBreakpointsMatchEnablement(i,e){if(i&&e.triggeredBy){let t=this.model.getBreakpoints().find(o=>e.triggeredBy===o.getId());t&&!t.enabled&&await this.enableOrDisableBreakpoints(i,t)}await Promise.all(this.model.getBreakpoints().filter(t=>t.triggeredBy===e.getId()&&t.enabled!==i).map(t=>this.enableOrDisableBreakpoints(i,t)))}async sendBreakpoints(i,e=!1,t){let o=this.model.getBreakpoints({originalUri:i,enabledOnly:!0});await Flt(this.model,t,async n=>{if(!n.configuration.noDebug){let r=o.filter(s=>!s.triggeredBy||s.getSessionDidTrigger(n.getId()));await n.sendBreakpoints(i,r,e)}})}async sendFunctionBreakpoints(i){let e=this.model.getFunctionBreakpoints().filter(t=>t.enabled&&this.model.areBreakpointsActivated());await Flt(this.model,i,async t=>{t.capabilities.supportsFunctionBreakpoints&&!t.configuration.noDebug&&await t.sendFunctionBreakpoints(e)})}async sendDataBreakpoints(i){let e=this.model.getDataBreakpoints().filter(t=>t.enabled&&this.model.areBreakpointsActivated());await Flt(this.model,i,async t=>{t.capabilities.supportsDataBreakpoints&&!t.configuration.noDebug&&await t.sendDataBreakpoints(e)})}async sendInstructionBreakpoints(i){let e=this.model.getInstructionBreakpoints().filter(t=>t.enabled&&this.model.areBreakpointsActivated());await Flt(this.model,i,async t=>{t.capabilities.supportsInstructionBreakpoints&&!t.configuration.noDebug&&await t.sendInstructionBreakpoints(e)})}sendExceptionBreakpoints(i){return Flt(this.model,i,async e=>{let t=this.model.getExceptionBreakpointsForSession(e.getId()).filter(o=>o.enabled);e.capabilities.supportsConfigurationDoneRequest&&(!e.capabilities.exceptionBreakpointFilters||e.capabilities.exceptionBreakpointFilters.length===0)||e.configuration.noDebug||await e.sendExceptionBreakpoints(t)})}onFileChanges(i){let e=this.model.getBreakpoints().filter(o=>i.contains(o.originalUri,2));e.length&&this.model.removeBreakpoints(e);let t=[];for(let o of this.breakpointsToSendOnResourceSaved)i.contains(o,0)&&t.push(o);for(let o of t)this.breakpointsToSendOnResourceSaved.delete(o),this.sendBreakpoints(o,!0)}async runTo(i,e,t){let o,n=this.getViewModel().focusedThread,r=async()=>{if(!!!this.getModel().getBreakpoints({column:t,lineNumber:e,uri:i}).length){let c=await this.addAndValidateBreakpoints(i,e,t);c.thread&&(n=c.thread),c.breakpoint&&(o=c.breakpoint)}return{threadToContinue:n,breakpointToRemove:o}},s=l=>l===2||l===0?(o&&this.removeBreakpoints(o.getId()),!0):!1;if(await r(),this.state===0){let{launch:l,name:c,getConfig:u}=this.getConfigurationManager().selectedConfiguration,p=await u(),h=p?Object.assign(Ji(p),{}):c,g=this.onDidChangeState(f=>{s(f)&&g.dispose()});await this.startDebugging(l,h,void 0,!0)}if(this.state===2){let l=this.getViewModel().focusedSession;if(!l||!n)return;let c=n.session.onDidChangeState(()=>{s(l.state)&&c.dispose()});await n.continue()}}async addAndValidateBreakpoints(i,e,t){let o=this.getModel(),n=this.getViewModel(),s=(await this.addBreakpoints(i,[{lineNumber:e,column:t}],!1))?.[0];if(!s)return{breakpoint:void 0,thread:n.focusedThread};if(!s.verified){let p;await vp(new Promise(h=>{p=o.onDidChangeBreakpoints(()=>{s.verified&&h()})}),2e3),p.dispose()}let l;(v=>(v[v.Focused=0]="Focused",v[v.Verified=1]="Verified",v[v.VerifiedAndPausedInFile=2]="VerifiedAndPausedInFile",v[v.VerifiedAndFocused=3]="VerifiedAndFocused"))(l||={});let c=n.focusedThread,u=0;for(let p of s.sessionsThatVerified){let h=o.getSession(p);if(!h)continue;let g=h.getAllThreads().filter(f=>f.stopped);if(u<3&&n.focusedThread&&g.includes(n.focusedThread)&&(c=n.focusedThread,u=3),u<2){let f=g.find(v=>{let b=v.getTopStackFrame();return b&&this.uriIdentityService.extUri.isEqual(b.source.uri,i)});f&&(c=f,u=2)}u<1&&(c=g[0],u=2)}return{thread:c,breakpoint:s}}};kUe=I([m(0,ee),m(1,us),m(2,$t),m(3,Bi),m(4,Ne),m(5,at),m(6,yi),m(7,Pe),m(8,X),m(9,ji),m(10,F),m(11,lt),m(12,fe),m(13,B),m(14,ZD),m(15,Sl),m(16,ge),m(17,Ue),m(18,Vu),m(19,ht),m(20,Ws)],kUe);function qTo(a,i,e,t,o){if(!t)if(i||e)t=i?i.thread.session:e.session;else{let n=a.getSessions();t=n.find(s=>s.state===2)||n.find(s=>s!==o&&s!==o?.parentSession)||(n.length?n[0]:void 0)}if(!e)if(i)e=i.thread;else{let n=t?t.getAllThreads():void 0;e=n&&n.find(s=>s.stopped)||(n&&n.length?n[0]:void 0)}return!i&&e&&(i=e.getTopStackFrame()),{session:t,thread:e,stackFrame:i}}async function Flt(a,i,e){i?await e(i):await Promise.all(a.getSessions().map(t=>e(t)))}ne.as(Ep.ConfigurationMigration).registerConfigurationMigrations([{key:"debug.autoExpandLazyVariables",migrateFn:a=>a===!0?{value:"on"}:a===!1?{value:"off"}:[]}]);var EUe=class{constructor(i,e,t){this.statusBarService=i;this.debugService=e;this.toDispose=[];let o=()=>{this.entryAccessor=this.statusBarService.addEntry(this.entry,"status.debug",0,30)},n=()=>{this.showInStatusBar=t.getValue("debug").showInStatusBar,this.showInStatusBar==="always"&&!this.entryAccessor&&o()};n(),this.toDispose.push(this.debugService.onDidChangeState(r=>{r!==0&&this.showInStatusBar==="onFirstSessionStart"&&!this.entryAccessor&&o()})),this.toDispose.push(t.onDidChangeConfiguration(r=>{r.affectsConfiguration("debug.showInStatusBar")&&(n(),this.entryAccessor&&this.showInStatusBar==="never"&&(this.entryAccessor.dispose(),this.entryAccessor=void 0))})),this.toDispose.push(this.debugService.getConfigurationManager().onDidSelectConfiguration(r=>{this.entryAccessor?.update(this.entry)}))}get entry(){let i="",e=this.debugService.getConfigurationManager(),t=e.selectedConfiguration.name||"";return t&&e.selectedConfiguration.launch&&(i=e.getLaunches().length>1?`${t} (${e.selectedConfiguration.launch.name})`:t),{name:d(9682,null),text:"$(debug-alt-small) "+i,ariaLabel:d(9680,null,i),tooltip:d(9681,null),command:"workbench.action.debug.selectandstart"}}dispose(){this.entryAccessor?.dispose(),Be(this.toDispose)}};EUe=I([m(0,kr),m(1,Ni),m(2,B)],EUe);var TUe=class{constructor(i,e,t){this.toDispose=[];let o=()=>{i.state===2&&!e.hasFocus?t.updateProperties({prefix:"\u{1F534}"}):t.updateProperties({prefix:""})};this.toDispose.push(i.onDidChangeState(o)),this.toDispose.push(e.onDidChangeFocus(o))}dispose(){Be(this.toDispose)}};TUe=I([m(0,Ni),m(1,Zt),m(2,T0)],TUe);var qWi="debugStartLanguage",Wmn=new Y(qWi,void 0),$To=new Y("debuggerInterestedInActiveEditor",!1),hL=class extends Gs{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super(e,o,n,r,s,p,u,h,t,f);this.debugService=l;this.editorService=c;this.debugStartLanguageContext=Wmn.bindTo(s),this.debuggerInterestedContext=$To.bindTo(s);let v=g.get(qWi,1);this.debugStartLanguageContext.set(v);let b=()=>{let y=this.editorService.activeTextEditorControl;if(mc(y)&&(y=y.getModifiedEditor()),pn(y)){let w=y.getModel(),k=w?w.getLanguageId():void 0;if(k&&this.debugService.getAdapterManager().someDebuggerInterestedInLanguage(k)){this.debugStartLanguageContext.set(k),this.debuggerInterestedContext.set(!0),g.store(qWi,k,1,1);return}}this.debuggerInterestedContext.set(!1)},S=new N;this._register(S),this._register(c.onDidActiveEditorChange(()=>{S.clear();let y=this.editorService.activeTextEditorControl;mc(y)&&(y=y.getModifiedEditor()),pn(y)&&S.add(y.onDidChangeModelLanguage(b)),b()})),this._register(this.debugService.getAdapterManager().onDidRegisterDebugger(b)),this._register(this.onDidChangeBodyVisibility(y=>{y&&b()})),b(),jTo=this.keybindingService.appendKeybinding("",xW)}static{this.ID="workbench.debug.welcome"}static{this.LABEL=L(9838,"Run")}shouldShowWelcome(){return!0}};hL=I([m(1,Le),m(2,_e),m(3,Xe),m(4,B),m(5,X),m(6,Ni),m(7,ee),m(8,F),m(9,Bi),m(10,Je),m(11,ce),m(12,nt)],hL);var Wlt=ne.as(Mn.ViewsRegistry);Wlt.registerViewWelcomeContent(hL.ID,{content:d(9837,null,hLe.ID),when:C.and(Aa,$To.toNegated()),group:"2_open"});var jTo="";Wlt.registerViewWelcomeContent(hL.ID,{content:`[${d(9839,null)}${jTo}](command:${xW})`,when:Aa,group:"4_debug",order:1});Wlt.registerViewWelcomeContent(hL.ID,{content:d(9835,null,`${fc(QG,{addNew:!0}).toString()}`),when:C.and(Aa,za.notEqualsTo("empty")),group:"4_debug"});Wlt.registerViewWelcomeContent(hL.ID,{content:d(9836,null,fc(b0.ID).toString()),when:C.and(Aa,za.isEqualTo("empty")),group:"4_debug"});Wlt.registerViewWelcomeContent(hL.ID,{content:d(9834,null),when:oRt.toNegated(),group:"4_debug"});var _Ue=class extends Dc{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super(cg,{mergeViewWithContainerWhenSingleView:!0},r,h,e,u,t,p,c,l,s,v,b);this.progressService=o;this.debugService=n;this.contextViewService=g;this.contextKeyService=f;this.paneListeners=new Map;this.stopActionViewItemDisposables=this._register(new N);this._register(this.debugService.onDidChangeState(S=>this.onDebugServiceStateChange(S))),this._register(this.contextKeyService.onDidChangeContext(S=>{S.affectsSome(new Set([Bhi,"inDebugMode"]))&&this.updateTitleArea()})),this._register(this.contextService.onDidChangeWorkbenchState(()=>this.updateTitleArea())),this._register(this.configurationService.onDidChangeConfiguration(S=>{(S.affectsConfiguration("debug.toolBarLocation")||S.affectsConfiguration("debug.hideLauncherWhileDebugging"))&&this.updateTitleArea()}))}create(e){super.create(e),e.classList.add("debug-viewlet")}focus(){super.focus(),this.startDebugActionViewItem?this.startDebugActionViewItem.focus():this.focusView(hL.ID)}getActionViewItem(e,t){if(e.id===xW)return this.startDebugActionViewItem=this.instantiationService.createInstance(OBe,null,e,t),this.startDebugActionViewItem;if(e.id===nFe)return new Dq(e,void 0,this.debugService,this.contextViewService,this.configurationService);if(e.id===qT||e.id===LM){this.stopActionViewItemDisposables.clear();let o=this.instantiationService.invokeFunction(n=>Plt(e,this.stopActionViewItemDisposables,n,{hoverDelegate:t.hoverDelegate}));if(o)return o}return Bs(this.instantiationService,e,t)}focusView(e){let t=this.getView(e);t&&t.focus()}onDebugServiceStateChange(e){this.progressResolve&&(this.progressResolve(),this.progressResolve=void 0),e===1&&this.progressService.withProgress({location:cg},t=>new Promise(o=>this.progressResolve=o))}addPanes(e){super.addPanes(e);for(let{pane:t}of e)t.id===yk?(this.breakpointView=t,this.updateBreakpointsMaxSize()):this.paneListeners.set(t.id,t.onDidChange(()=>this.updateBreakpointsMaxSize()))}removePanes(e){super.removePanes(e);for(let t of e)Be(this.paneListeners.get(t.id)),this.paneListeners.delete(t.id)}updateBreakpointsMaxSize(){if(this.breakpointView){let e=this.panes.every(t=>!t.isExpanded()||t===this.breakpointView);this.breakpointView.maximumBodySize=e?Number.POSITIVE_INFINITY:this.breakpointView.minimumBodySize}}};_Ue=I([m(0,yi),m(1,Te),m(2,Fo),m(3,Ni),m(4,F),m(5,Pe),m(6,ce),m(7,Le),m(8,Xe),m(9,lt),m(10,B),m(11,Wn),m(12,X),m(13,Bi),m(14,se)],_Ue);ve.appendMenuItem(D.ViewContainerTitle,{when:C.and(C.equals("viewContainer",cg),rA.notEqualsTo("simple"),za.notEqualsTo("empty"),C.or(Zs.isEqualTo("inactive"),C.notEquals("config.debug.toolBarLocation","docked")),C.or(C.not("config.debug.hideLauncherWhileDebugging"),C.not("inDebugMode"))),order:10,group:"navigation",command:{precondition:Zs.notEqualsTo(KR(1)),id:xW,title:rnt}});W(class extends K{constructor(){super({id:QG,title:{value:rFe,original:"Open 'launch.json'",mnemonicTitle:d(9703,null)},metadata:{description:L(9704,"Opens the file used to configure how your program is debugged")},f1:!0,icon:RPe,precondition:rA.notEqualsTo("simple"),menu:[{id:D.ViewContainerTitle,group:"navigation",order:20,when:C.and(C.equals("viewContainer",cg),rA.notEqualsTo("simple"),za.notEqualsTo("empty"),C.or(Zs.isEqualTo("inactive"),C.notEquals("config.debug.toolBarLocation","docked")))},{id:D.ViewContainerTitle,order:20,when:C.and(C.equals("viewContainer",cg),Zs.notEqualsTo("inactive"),C.equals("config.debug.toolBarLocation","docked"))},{id:D.MenubarDebugMenu,group:"2_configuration",order:1,when:Aa}]})}async run(a,i){let e=a.get(Ni),t=a.get(Ue),o=e.getConfigurationManager(),n;if(o.selectedConfiguration.name)n=o.selectedConfiguration.launch;else{let r=o.getLaunches().filter(s=>!s.hidden);if(r.length===1)n=r[0];else{let s=r.map(c=>({label:c.name,launch:c})),l=await t.pick(s,{activeItem:s[0],placeHolder:d(9705,null)});l&&(n=l.launch)}}if(n){let{editor:r}=await n.openConfigFile({preserveFocus:!1});if(r&&i?.addNew){let s=r.getControl();s&&await s.getContribution(RB)?.addLaunchConfiguration()}}}});W(class extends K{constructor(){super({id:"debug.toggleReplIgnoreFocus",title:d(9702,null),toggled:C.has(`view.${Td}.visible`),menu:[{id:J4,group:"3_toggleRepl",order:30,when:C.and(C.equals("viewContainer",cg))}]})}async run(a){let i=a.get($t);i.isViewVisible(Td)?i.closeView(Td):await i.openView(Td)}});ve.appendMenuItem(D.ViewContainerTitle,{when:C.and(C.equals("viewContainer",cg),Zs.notEqualsTo("inactive"),C.or(C.equals("config.debug.toolBarLocation","docked"),C.has("config.debug.hideLauncherWhileDebugging"))),order:10,command:{id:cQ,title:d(9706,null)}});var QTo=!0,Vmn=/^[a-zA-Z][a-zA-Z0-9\+\-\.]+:/,E6=class a{constructor(i,e,t=!1){this._parent=i;this._label=e;this.isIncompressible=t;this._children=new Map;this._showedMoreThanOne=!1}updateLabel(i){this._label=i}isLeaf(){return this._children.size===0}getSession(){if(this._parent)return this._parent.getSession()}setSource(i,e){if(this._source=e,this._children.clear(),e.raw&&e.raw.sources){for(let t of e.raw.sources)if(t.name&&t.path){let o=new a(this,t.name);this._children.set(t.path,o);let n=i.getSource(t);o.setSource(i,n)}}}createIfNeeded(i,e){let t=this._children.get(i);return t||(t=e(this,i),this._children.set(i,t)),t}getChild(i){return this._children.get(i)}remove(i){this._children.delete(i)}removeFromParent(){this._parent&&(this._parent.remove(this._label),this._parent._children.size===0&&this._parent.removeFromParent())}getTemplateId(){return"id"}getId(){let i=this.getParent();return i?`${i.getId()}/${this.getInternalId()}`:this.getInternalId()}getInternalId(){return this._label}getParent(){if(this._parent)return this._parent.isSkipped()?this._parent.getParent():this._parent}isSkipped(){return this._parent?!!this._parent.oneChild():!0}hasChildren(){let i=this.oneChild();return i?i.hasChildren():this._children.size>0}getChildren(){let i=this.oneChild();if(i)return i.getChildren();let e=[];for(let t of this._children.values())e.push(t);return e.sort((t,o)=>this.compare(t,o))}getLabel(i=!0){let e=this.oneChild();if(e){let t=this instanceof qne&&i?" \u2022 ":Oo.sep;return`${this._label}${t}${e.getLabel()}`}return this._label}getHoverLabel(){if(this._source&&this._parent&&this._parent._source)return this._source.raw.path||this._source.raw.name;let i=this.getLabel(!1),e=this.getParent();if(e){let t=e.getHoverLabel();if(t)return`${t}/${i}`}return i}getSource(){let i=this.oneChild();return i?i.getSource():this._source}compare(i,e){return i._label&&e._label?i._label.localeCompare(e._label):0}oneChild(){if(!this._source&&!this._showedMoreThanOne&&this.skipOneChild()){if(this._children.size===1)return this._children.values().next().value;this._children.size>1&&(this._showedMoreThanOne=!0)}}skipOneChild(){return QTo?this instanceof P4t:!(this instanceof qne)&&!(this instanceof $ne)}},qne=class extends E6{constructor(e,t){super(e,t.name,!0);this.folder=t}},P4t=class extends E6{constructor(e,t,o){super(void 0,"Root");this._pathService=e;this._contextService=t;this._labelService=o}add(e){return this.createIfNeeded(e.getId(),()=>new $ne(this._labelService,this,e,this._pathService,this._contextService))}find(e){return this.getChild(e.getId())}},$ne=class a extends E6{constructor(e,t,o,n,r){super(t,o.getLabel(),!0);this._pathService=n;this.rootProvider=r;this._map=new Map;this._labelService=e,this._session=o}static{this.URL_REGEXP=/^(https?:\/\/[^/]+)(\/.*)$/}getInternalId(){return this._session.getId()}getSession(){return this._session}getHoverLabel(){}hasChildren(){return!0}compare(e,t){let o=this.category(e),n=this.category(t);return o!==n?o-n:super.compare(e,t)}category(e){if(e instanceof qne)return e.folder.index;let t=e.getLabel();return t&&/^<.+>$/.test(t)?1e3:999}async addPath(e){let t,o,n=e.raw.path;if(!n)return;this._labelService&&Vmn.test(n)&&(n=this._labelService.getUriLabel(A.parse(n)));let r=a.URL_REGEXP.exec(n);if(r&&r.length===3)o=r[1],n=decodeURI(r[2]);else if(Zl(n)){let l=A.file(n);t=this.rootProvider?this.rootProvider.getWorkspaceFolder(l):null,t?(n=ch(fC(l.path.substring(t.uri.path.length),Oo.sep)),this.rootProvider.getWorkspace().folders.length>1?n=Oo.sep+n:t=null):(n=ch(n),ei?n=Hp(n):n=i5e(n,(await this._pathService.userHome()).fsPath))}let s=this;n.split(/[\/\\]/).forEach((l,c)=>{if(c===0&&t){let u=t;s=s.createIfNeeded(t.name,p=>new qne(p,u))}else c===0&&o?s=s.createIfNeeded(o,u=>new E6(u,o)):s=s.createIfNeeded(l,u=>new E6(u,l))}),s.setSource(this._session,e),e.raw.path&&this._map.set(e.raw.path,s)}removePath(e){if(e.raw.path){let t=this._map.get(e.raw.path);if(t)return t.removeFromParent(),!0}return!1}};function YTo(a,i){let e=a.getChildren(),t=i?!i.expanded.has(a.getId()):!(a instanceof $ne);return{element:a,collapsed:t,collapsible:a.hasChildren(),children:e.map(o=>YTo(o,i))}}var DUe=class extends Gs{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super(e,o,t,s,c,r,n,f,v,b);this.editorService=l;this.contextService=u;this.debugService=p;this.labelService=h;this.pathService=g;this.treeNeedsRefreshOnVisible=!1;this.loadedScriptsItemType=Tto.bindTo(c)}renderBody(e){super.renderBody(e),this.element.classList.add("debug-pane"),e.classList.add("debug-loaded-scripts","show-file-icons"),this.treeContainer=Oie(e),this.filter=new QWi;let t=new P4t(this.pathService,this.contextService,this.labelService);this.treeLabels=this.instantiationService.createInstance(Nl,{onDidChangeVisibility:this.onDidChangeBodyVisibility}),this._register(this.treeLabels);let o=p=>{this.treeContainer.classList.toggle("align-icons-and-twisties",p.hasFileIcons&&!p.hasFolderIcons),this.treeContainer.classList.toggle("hide-arrows",p.hidesExplorerArrows===!0)};this._register(this.themeService.onDidFileIconThemeChange(o)),o(this.themeService.getFileIconTheme()),this.tree=this.instantiationService.createInstance(nF,"LoadedScriptsView",this.treeContainer,new $Wi,[new A4t(this.treeLabels)],{compressionEnabled:QTo,collapseByDefault:!0,hideTwistiesOfChildlessElements:!0,identityProvider:{getId:p=>p.getId()},keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:p=>p.getLabel(),getCompressedNodeKeyboardNavigationLabel:p=>p.map(h=>h.getLabel()).join("/")},filter:this.filter,accessibilityProvider:new jWi,overrideStyles:this.getLocationBasedColors().listOverrideStyles});let n=p=>this.tree.setChildren(null,YTo(t,p).children);n(),this.changeScheduler=new Dt(()=>{this.treeNeedsRefreshOnVisible=!1,this.tree&&n()},300),this._register(this.changeScheduler),this._register(this.tree.onDidOpen(p=>{if(p.element instanceof E6){let h=p.element.getSource();if(h&&h.available){let g={startLineNumber:0,startColumn:0,endLineNumber:0,endColumn:0};h.openInEditor(this.editorService,g,p.editorOptions.preserveFocus,p.sideBySide,p.editorOptions.pinned)}}})),this._register(this.tree.onDidChangeFocus(()=>{this.tree.getFocus()instanceof $ne?this.loadedScriptsItemType.set("session"):this.loadedScriptsItemType.reset()}));let r=()=>{this.isBodyVisible()?this.changeScheduler.schedule():this.treeNeedsRefreshOnVisible=!0},s=async p=>{if(p.capabilities.supportsLoadedSourcesRequest){let h=t.add(p),g=await p.getLoadedSources();for(let f of g)await h.addPath(f);r()}},l=this._register(new Vt),c=p=>{let h=new N;l.set(p.getId(),h),h.add(p.onDidChangeName(async()=>{let g=t.find(p);g&&(g.updateLabel(p.getLabel()),r())})),h.add(p.onDidLoadedSource(async g=>{let f;switch(g.reason){case"new":case"changed":f=t.add(p),await f.addPath(g.source),r(),g.reason==="changed"&&NU.refreshDebugContent(g.source.uri);break;case"removed":f=t.find(p),f&&f.removePath(g.source)&&r();break;default:this.filter.setFilter(g.source.name),this.tree.refilter();break}}))};this._register(this.debugService.onDidNewSession(c)),this.debugService.getModel().getSessions().forEach(c),this._register(this.debugService.onDidEndSession(({session:p})=>{l.deleteAndDispose(p.getId()),t.remove(p.getId()),this.changeScheduler.schedule()})),this.changeScheduler.schedule(0),this._register(this.onDidChangeBodyVisibility(p=>{p&&this.treeNeedsRefreshOnVisible&&this.changeScheduler.schedule()}));let u;this._register(this.tree.onDidChangeFindPattern(p=>{if(this.tree.findMode!==0)if(!u&&p){let h=new Set,g=f=>{f.element&&!f.collapsed&&h.add(f.element.getId());for(let v of f.children)g(v)};g(this.tree.getNode()),u={expanded:h},this.tree.expandAll()}else!p&&u&&(this.tree.setFocus([]),n(u),u=void 0)})),this.debugService.getModel().getSessions().forEach(p=>s(p))}layoutBody(e,t){super.layoutBody(e,t),this.tree.layout(e,t)}collapseAll(){this.tree.collapseAll()}dispose(){Be(this.tree),Be(this.treeLabels),super.dispose()}};DUe=I([m(1,Xe),m(2,_e),m(3,F),m(4,Bi),m(5,B),m(6,ee),m(7,X),m(8,Pe),m(9,Ni),m(10,rt),m(11,An),m(12,Je),m(13,Le),m(14,nt)],DUe);var $Wi=class{getHeight(i){return 22}getTemplateId(i){return A4t.ID}},A4t=class a{constructor(i){this.labels=i}static{this.ID="lsrenderer"}get templateId(){return a.ID}renderTemplate(i){return{label:this.labels.create(i,{supportHighlights:!0})}}renderElement(i,e,t){let o=i.element,n=o.getLabel();this.render(o,n,t,i.filterData)}renderCompressedElements(i,e,t){let o=i.element.elements[i.element.elements.length-1],n=i.element.elements.map(r=>r.getLabel());this.render(o,n,t,i.filterData)}render(i,e,t,o){let n={name:e},r={title:i.getHoverLabel()};if(i instanceof qne)r.fileKind=2;else if(i instanceof $ne)r.title=d(9729,null),r.hideIcon=!0;else if(i instanceof E6){let s=i.getSource();s&&s.uri?(n.resource=s.uri,r.fileKind=0):r.fileKind=1}r.matches=xa(o),t.label.setResource(n,r)}disposeTemplate(i){i.label.dispose()}},jWi=class{getWidgetAriaLabel(){return d(9726,null)}getAriaLabel(i){return i instanceof qne?d(9728,null,i.getLabel()):i instanceof $ne?d(9730,null,i.getLabel()):i.hasChildren()?d(9727,null,i.getLabel()):d(9731,null,i.getLabel())}},QWi=class{setFilter(i){this.filterText=i}filter(i,e){return this.filterText?i.isLeaf()?i.getLabel().indexOf(this.filterText)>=0?1:0:2:1}};W(class extends Yn{constructor(){super({id:"loadedScripts.collapse",viewId:rue,title:d(9725,null),f1:!1,icon:R.collapseAll,menu:{id:D.ViewTitle,order:30,group:"navigation",when:C.equals("view",rue)}})}runInView(i,e){e.collapseAll()}});var N4t=class{constructor(){this.priority=120;this.name="replHelp";this.when=C.or(C.equals("focusedView","workbench.panel.repl.view"),GF);this.type="help"}getProvider(i){let e=i.get($t),t=lne(e);if(t)return new YWi(t)}},YWi=class extends x{constructor(e){super();this._replView=e;this.id="replHelp";this.verbositySettingKey="accessibility.verbosity.find";this.options={type:"help"}}onClose(){this._replView.focusFilter()}provideContent(){let e=[];return e.push(d(9768,null)),e.push(d(9757,null)),e.push(""),e.push(d(9787,null)),e.push(d(9786,null)),e.push(""),e.push(d(9770,null)),e.push(d(9769,null)),e.push(""),e.push(d(9763,null)),e.push(d(9762,null)),e.push(""),e.push(d(9767,null)),e.push(d(9764,null)),e.push(d(9765,null)),e.push(d(9766,null)),e.push(""),e.push(d(9760,null)),e.push(d(9759,null)),e.push(d(9758,null)),e.push(d(9761,null,"<keybinding:workbench.panel.repl.view.focus>")),e.push(""),e.push(d(9789,null)),e.push(d(9790,null)),e.push(d(9788,null)),e.push(""),e.push(d(9771,null)),e.push(d(9772,null)),e.push(d(9775,null)),e.push(d(9773,null)),e.push(d(9774,null,"<keybinding:workbench.panel.repl.view.focus>")),e.push(""),e.push(d(9782,null,"<keybinding:workbench.action.openSettings>")),e.push(d(9783,null)),e.push(d(9784,null)),e.push(d(9776,null)),e.push(d(9779,null)),e.push(d(9778,null)),e.push(d(9785,null)),e.push(d(9780,null)),e.push(d(9777,null)),e.push(d(9781,null)),e.push(""),e.push(d(9756,null)),e.push(d(9755,null)),e.join(`
`)}};var O4t=class{constructor(){this.priority=70;this.name="debugConsole";this.when=C.equals("focusedView","workbench.panel.repl.view");this.type="view"}getProvider(i){let e=i.get($t),t=i.get(ou),o=lne(e);if(!o)return;let n=o.getFocusedElement();return new Vlt(o,n,t)}},Vlt=class extends x{constructor(e,t,o){super();this._replView=e;this._focusedElement=t;this._accessibleViewService=o;this.id="repl";this._onDidChangeContent=this._register(new E);this.onDidChangeContent=this._onDidChangeContent.event;this._onDidResolveChildren=this._register(new E);this.onDidResolveChildren=this._onDidResolveChildren.event;this.verbositySettingKey="accessibility.verbosity.debug";this.options={type:"view"};this._elementPositionMap=new Map;this._treeHadFocus=!1;this._treeHadFocus=!!t}provideContent(){let e=this._replView.getDebugSession();if(!e)return"No debug session available.";let t=e.getReplElements();return t.length?(this._content||this._updateContent(t),this._content??t.map(o=>o.toString(!0)).join(`
`)):"No output in the debug console."}onClose(){if(this._content=void 0,this._elementPositionMap.clear(),this._treeHadFocus)return this._replView.focusTree();this._replView.getReplInput().focus()}onOpen(){this._register(this.onDidResolveChildren(()=>{this._onDidChangeContent.fire(),queueMicrotask(()=>{if(this._focusedElement){let e=this._elementPositionMap.get(this._focusedElement.getId());e&&this._accessibleViewService.setPosition(e,!0)}})}))}async _updateContent(e){let t=this._replView.getReplDataSource();if(!t)return;let o=1,n=[];for(let r of e)if(n.push(r.toString().replace(/\n/g,"")),this._elementPositionMap.set(r.getId(),new ye(o,1)),o++,t.hasChildren(r)){let s=[],l=await t.getChildren(r);for(let c of l){let u=c.getId();this._elementPositionMap.has(u)||this._elementPositionMap.set(u,new ye(o,1)),s.push("  "+c.toString()),o++}n.push(s.join(`
`))}this._content=n.join(`
`),this._onDidResolveChildren.fire()}};Vlt=I([m(2,ou)],Vlt);var F4t=class{constructor(){this.priority=120;this.name="runAndDebugHelp";this.when=C.or(C.and(C.equals("activeViewlet","workbench.view.debug"),kB),C.equals(ql.key,VK),C.equals(ql.key,Ik),C.equals(ql.key,f4),C.equals(ql.key,rue),C.equals(ql.key,yk));this.type="help"}getProvider(i){return new Blt(i.get(ge),i.get($t))}},Blt=class extends x{constructor(e,t){super();this._commandService=e;this._viewsService=t;this.id="runAndDebug";this.verbositySettingKey="accessibility.verbosity.debug";this.options={type:"help"};this._focusedView=this._viewsService.getFocusedViewName()}onClose(){switch(this._focusedView){case"Watch":this._commandService.executeCommand("workbench.debug.action.focusWatchView");break;case"Variables":this._commandService.executeCommand("workbench.debug.action.focusVariablesView");break;case"Call Stack":this._commandService.executeCommand("workbench.debug.action.focusCallStackView");break;case"Breakpoints":this._commandService.executeCommand("workbench.debug.action.focusBreakpointsView");break;default:this._commandService.executeCommand("workbench.view.debug")}}provideContent(){return[d(9803,null,"<keybinding:workbench.view.debug>"),d(9804,null,"<keybinding:workbench.action.debug.start>"),d(9801,null,"<keybinding:workbench.panel.repl.view.focus>"),xc.setBreakpoint,xc.addToWatch,d(9811,null),d(9802,null,"<keybinding:workbench.action.debug.restart>"),d(9808,null,"<keybinding:workbench.action.debug.stop>"),d(9796,null,"<keybinding:workbench.action.debug.continue>"),d(9805,null,"<keybinding:workbench.action.debug.stepInto>"),d(9807,null,"<keybinding:workbench.action.debug.stepOver>"),d(9806,null,"<keybinding:workbench.action.debug.stepOut>"),d(9809,null),d(9797,null,"<keybinding:workbench.debug.action.focusBreakpointsView>"),d(9798,null,"<keybinding:workbench.debug.action.focusCallStackView>"),d(9799,null,"<keybinding:workbench.debug.action.focusVariablesView>"),d(9800,null,"<keybinding:workbench.debug.action.focusWatchView>"),d(9810,null,"accessibility.debugWatchVariableAnnouncements")].join(`
`)}};Blt=I([m(0,ge),m(1,$t)],Blt);var XTo=te("statusBar.debuggingBackground",{dark:"#CC6633",light:"#CC6633",hcDark:"#BA592C",hcLight:"#B5200D"},d(9813,null)),Bmn=te("statusBar.debuggingForeground",{dark:PR,light:PR,hcDark:PR,hcLight:"#FFFFFF"},d(9815,null)),Hmn=te("statusBar.debuggingBorder",Vde,d(9814,null)),Umn=te("commandCenter.debuggingBackground",ai(XTo,.258),d(9812,null),!0),LUe=class{constructor(i,e,t,o){this.debugService=i;this.contextService=e;this.statusbarService=t;this.configurationService=o;this.disposables=new N;this.styleSheet=Cr();this.debugService.onDidChangeState(this.update,this,this.disposables),this.contextService.onDidChangeWorkbenchState(this.update,this,this.disposables),this.configurationService.onDidChangeConfiguration(n=>{(n.affectsConfiguration("debug.enableStatusBarColor")||n.affectsConfiguration("debug.toolBarLocation"))&&this.update()},void 0,this.disposables),this.update()}set enabled(i){i!==!!this.disposable&&(i?this.disposable=this.statusbarService.overrideStyle({priority:10,foreground:Bmn,background:XTo,border:Hmn}):(this.disposable.dispose(),this.disposable=void 0))}update(){let i=this.configurationService.getValue("debug"),e=zmn(this.debugService.state,this.debugService.getModel().getSessions());i.enableStatusBarColor?this.enabled=e:this.enabled=!1;let t=i.toolBarLocation==="commandCenter";this.styleSheet.textContent=t&&e?`
			.monaco-workbench {
				${yO(UZi)}: ${kt(Umn)};
			}
		`:""}dispose(){this.disposable?.dispose(),this.disposables.dispose()}};LUe=I([m(0,Ni),m(1,Pe),m(2,kr),m(3,B)],LUe);function zmn(a,i){return!(a===0||a===1||i.every(e=>e.suppressDebugStatusbar||e.configuration?.noDebug))}var Kmn=1024,XWi=!1,JWi=!1,RUe=class extends Gs{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super(e,n,t,l,c,s,r,u,p,h);this.debugService=o;this.menuService=g;this.logService=f;this.needsRefresh=!1;this.watchExpressionsUpdatedScheduler=this._register(new Dt(()=>{this.needsRefresh=!1,this.tree.updateChildren()},50)),this.watchExpressionsExist=p9e.bindTo(c),this.watchExpressionsExist.set(this.debugService.getModel().getWatchExpressions().length>0),this.expressionRenderer=r.createInstance(RM)}get treeSelection(){return this.tree.getSelection()}renderBody(e){super.renderBody(e),this.element.classList.add("debug-pane"),e.classList.add("debug-watch");let t=Oie(e),o=this.instantiationService.createInstance(jne,this.expressionRenderer);this.tree=this.instantiationService.createInstance(rp,"WatchExpressions",t,new ZWi,[o,this.instantiationService.createInstance(MM,this.expressionRenderer),this.instantiationService.createInstance(Qk,this.expressionRenderer)],this.instantiationService.createInstance(eVi),{accessibilityProvider:new iVi,identityProvider:{getId:r=>r.getId()},keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:r=>{if(r!==this.debugService.getViewModel().getSelectedExpression()?.expression)return DKt.getKeyboardNavigationLabel(r)}},dnd:new oVi(this.debugService),overrideStyles:this.getLocationBasedColors().listOverrideStyles}),this._register(this.tree),this.tree.setInput(this.debugService),u9e.bindTo(this.tree.contextKeyService),this._register(Qk.rendererOnVisualizationRange(this.debugService.getViewModel(),this.tree)),this._register(this.tree.onContextMenu(r=>this.onContextMenu(r))),this._register(this.tree.onMouseDblClick(r=>this.onMouseDblClick(r))),this._register(this.debugService.getModel().onDidChangeWatchExpressions(async r=>{this.watchExpressionsExist.set(this.debugService.getModel().getWatchExpressions().length>0),this.isBodyVisible()?(r&&!r.name&&(JWi=!0),await this.tree.updateChildren(),JWi=!1,r instanceof dd&&this.tree.reveal(r)):this.needsRefresh=!0})),this._register(this.debugService.getViewModel().onDidFocusStackFrame(()=>{if(!this.isBodyVisible()){this.needsRefresh=!0;return}this.watchExpressionsUpdatedScheduler.isScheduled()||this.watchExpressionsUpdatedScheduler.schedule()})),this._register(this.debugService.getViewModel().onWillUpdateViews(()=>{XWi||this.tree.updateChildren()})),this._register(this.onDidChangeBodyVisibility(r=>{r&&this.needsRefresh&&this.watchExpressionsUpdatedScheduler.schedule()}));let n;this._register(this.debugService.getViewModel().onDidSelectExpression(r=>{let s=r?.expression;s&&this.tree.hasNode(s)?(n=this.tree.options.horizontalScrolling,n&&this.tree.updateOptions({horizontalScrolling:!1}),s.name&&this.tree.rerender(s)):!s&&n!==void 0&&(this.tree.updateOptions({horizontalScrolling:n}),n=void 0)})),this._register(this.debugService.getViewModel().onDidEvaluateLazyExpression(async r=>{r instanceof $l&&this.tree.hasNode(r)&&(await this.tree.updateChildren(r,!1,!0),await this.tree.expand(r))}))}layoutBody(e,t){super.layoutBody(e,t),this.tree.layout(e,t)}focus(){super.focus(),this.tree.domFocus()}collapseAll(){this.tree.collapseAll()}onMouseDblClick(e){if(e.browserEvent.target.className.indexOf("twistie")>=0)return;let t=e.element,o=this.debugService.getViewModel().getSelectedExpression();t instanceof dd&&t!==o?.expression||t instanceof qR&&t.treeItem.canEdit?this.debugService.getViewModel().setSelectedExpression(t,!1):t||this.debugService.addWatchExpression()}async onContextMenu(e){let t=e.element;if(!t)return;let o=this.tree.getSelection(),n=t&&await Gmn(this.contextKeyService,t,this.debugService,this.logService),r=this.menuService.getMenuActions(D.DebugWatchContext,n,{arg:t,shouldForwardArgs:!1}),{secondary:s}=zp(r,"inline");this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>s,getActionsContext:()=>t&&o.includes(t)?o:t?[t]:[]})}};RUe=I([m(1,Xe),m(2,Ni),m(3,_e),m(4,F),m(5,Bi),m(6,B),m(7,X),m(8,Je),m(9,Le),m(10,nt),m(11,Kt),m(12,se)],RUe);var ZWi=class{getHeight(i){return 22}getTemplateId(i){return i instanceof dd?jne.ID:i instanceof qR?Qk.ID:MM.ID}};function JTo(a){return typeof a.getConfigurationManager=="function"}var eVi=class extends HG{hasChildren(i){return JTo(i)||i.hasChildren}doGetChildren(i){if(JTo(i)){let e=i,t=e.getModel().getWatchExpressions(),o=e.getViewModel();return Promise.all(t.map(n=>n.name&&!JWi?n.evaluate(o.focusedSession,o.focusedStackFrame,"watch").then(()=>n):Promise.resolve(n)))}return i.getChildren()}},jne=class extends iU{constructor(e,t,o,n,r,s,l){super(n,r,s);this.expressionRenderer=e;this.menuService=t;this.contextKeyService=o;this.configurationService=l}static{this.ID="watchexpression"}get templateId(){return jne.ID}renderElement(e,t,o){o.elementDisposable.clear(),o.elementDisposable.add(this.configurationService.onDidChangeConfiguration(n=>{n.affectsConfiguration("debug.showVariableTypes")&&super.renderExpressionElement(e.element,e,o)})),super.renderExpressionElement(e.element,e,o)}renderExpression(e,t,o){let n;t.type.textContent="";let r=this.configurationService.getValue("debug").showVariableTypes;r&&e.type?(n=typeof e.value=="string"?`${e.name}: `:e.name,t.type.textContent=e.type+" ="):n=typeof e.value=="string"?`${e.name} =`:e.name;let s;e.type?r?s=`${e.name}`:s=e.type===e.value?e.type:`${e.type}`:s=e.value,t.label.set(n,o,s),t.elementDisposable.add(this.expressionRenderer.renderValue(t.value,e,{showChanged:!0,maxValueLength:Kmn,colorize:!0,session:e.getSession()}))}getInputBoxOptions(e,t){return t?{initialValue:e.value,ariaLabel:d(9828,null),onFinish:async(o,n)=>{if(n&&o){let r=this.debugService.getViewModel().focusedStackFrame;r&&(e instanceof $l||e instanceof dd)&&(await e.setExpression(o,r),this.debugService.getViewModel().updateViews())}}}:{initialValue:e.name?e.name:"",ariaLabel:d(9831,null),placeholder:d(9832,null),onFinish:(o,n)=>{n&&o?(this.debugService.renameWatchExpression(e.getId(),o),XWi=!0,this.debugService.getViewModel().updateViews(),XWi=!1):e.name||this.debugService.removeWatchExpressions(e.getId())}}}renderActionBar(e,t){let o=tVi(this.contextKeyService,t),n=t,r=this.menuService.getMenuActions(D.DebugWatchContext,o,{arg:n,shouldForwardArgs:!1}),{primary:s}=zp(r,"inline");e.clear(),e.context=n,e.push(s,{icon:!0,label:!1})}};jne=I([m(1,Kt),m(2,X),m(3,Ni),m(4,Wn),m(5,nt),m(6,B)],jne);function tVi(a,i,e=[]){let t=i.getSession();return a.createOverlay([[LB.key,"evaluateName"in i],[BK.key,i instanceof dd?"expression":i instanceof $l?"variable":void 0],[sJ.key,!!t?.capabilities.supportsReadMemoryRequest&&i.memoryReference!==void 0],[aue.key,!!i.presentationHint?.attributes?.includes("readOnly")||i.presentationHint?.lazy],[uJ.key,i.type],[gTe.key,t?.configuration.type],...e])}async function Gmn(a,i,e,t){let o=i.getSession();if(!o||!o.capabilities.supportsDataBreakpoints)return tVi(a,i);let n=[],r=e.getViewModel().focusedStackFrame,s;try{"evaluateName"in i&&i.evaluateName?s=await o.dataBreakpointInfo(i.evaluateName,void 0,r?.frameId):i instanceof $l?s=await o.dataBreakpointInfo(i.name,i.parent.reference,r?.frameId):s=await o.dataBreakpointInfo(i.name,void 0,r?.frameId)}catch(u){t.error("Failed to get data breakpoint info for watch expression:",u)}let l=s?.dataId,c=s?.accessTypes;if(UKt(s),!c)n.push([UK.key,!!l]);else for(let u of c)switch(u){case"read":n.push([cJ.key,!!l]);break;case"write":n.push([UK.key,!!l]);break;case"readWrite":n.push([lJ.key,!!l]);break}return tVi(a,i,n)}var iVi=class{getWidgetAriaLabel(){return d(9829,null)}getAriaLabel(i){return i instanceof dd?d(9830,null,i.name,i.value):d(9833,null,i.name,i.value)}},oVi=class{constructor(i){this.debugService=i}onDragStart(i,e){i instanceof uw&&e.dataTransfer.setData("text/plain",i.elements[0].name)}onDragOver(i,e,t,o,n){if(!(i instanceof uw))return!1;let r=i.elements;if(!(r.length>0&&r[0]instanceof dd))return!1;let s;if(t===void 0)s="drop-target-after",t=-1;else switch(o){case 0:case 1:s="drop-target-before";break;case 2:case 3:s="drop-target-after";break}return{accept:!0,effect:{type:1,position:s},feedback:[t]}}getDragURI(i){return!(i instanceof dd)||i===this.debugService.getViewModel().getSelectedExpression()?.expression?null:i.getId()}getDragLabel(i){if(i.length===1)return i[0].name}drop(i,e,t,o,n){if(!(i instanceof uw))return;let r=i.elements[0];if(!(r instanceof dd))throw new Error("Invalid dragged element");let s=this.debugService.getModel().getWatchExpressions(),l=s.indexOf(r),c;if(e instanceof dd){switch(c=s.indexOf(e),o){case 3:case 2:c++;break}l<c&&c--}else c=s.length-1;this.debugService.moveWatchExpression(r.getId(),c)}dispose(){}};W(class extends Yn{constructor(){super({id:"watch.collapse",viewId:Ik,title:d(9825,null),f1:!1,icon:R.collapseAll,precondition:p9e,menu:{id:D.ViewTitle,order:30,group:"navigation",when:C.equals("view",Ik)}})}runInView(i,e){e.collapseAll()}});var nVi="workbench.debug.viewlet.action.addWatchExpression",rVi=d(9824,null);W(class extends K{constructor(){super({id:nVi,title:rVi,f1:!1,icon:gho,menu:{id:D.ViewTitle,group:"navigation",when:C.equals("view",Ik)}})}run(i){i.get(Ni).addWatchExpression()}});var sVi="workbench.debug.viewlet.action.removeAllWatchExpressions",aVi=d(9827,null);W(class extends K{constructor(){super({id:sVi,title:aVi,f1:!1,icon:mho,precondition:p9e,menu:{id:D.ViewTitle,order:20,group:"navigation",when:C.equals("view",Ik)}})}run(i){i.get(Ni).removeWatchExpressions()}});W(class extends Yn{constructor(){super({id:Zbo,title:d(9826,null),f1:!1,viewId:Ik,precondition:p9e,keybinding:{primary:2593,weight:200,when:C.and(ql.isEqualTo(Ik),nJ.negate())},menu:{id:D.DebugWatchContext,order:20,group:"3_modification",when:BK.isEqualTo("expression")}})}runInView(i,e,t){let o=i.get(Fi);t||(t=e.treeSelection.at(-1)),t&&o.writeText(t.name)}});var Hlt=class{constructor(i){this.debugService=i;this.type="pickerPick";this.label=d(9489,null);this.icon=R.debug;this.ordinal=-200}isEnabled(){let e=this.debugService.getViewModel().focusedSession;return!!e&&e.state===2}asPicker(i){let e=new N,t=Me("debugPicker.mode","main"),o=Me("debugPicker.query",""),n=this.createPicksObservable(t,o,e);return{placeholder:d(9494,null),picks:(r,s)=>{e.add(be(c=>{o.set(r.read(c),void 0)}));let l=new Ye(s);return e.add(Z(()=>l.dispose(!0))),n},goBack:()=>t.get()==="expression"?(t.set("main",void 0),!0):!1,dispose:()=>e.dispose()}}createPicksObservable(i,e,t){let o=gP(e,300);return ke(n=>i.read(n)==="expression"?this.getExpressionPicks(o,t):this.getMainPicks(i)).flatten()}getMainPicks(i){return ke(t=>new bd(this.buildMainPicks(i))).map((t,o)=>{let n=t.promiseResult.read(o);return{picks:n?.data||[],busy:n===void 0}})}async buildMainPicks(i){let e=[],t=this.debugService.getViewModel(),o=t.focusedStackFrame;if(!t.focusedSession||!o)return e;e.push({label:d(9491,null),iconClass:q.asClassName(R.symbolVariable),asAttachment:()=>(i.set("expression",void 0),"noop")});let r=this.debugService.getModel().getWatchExpressions();if(r.length>0){e.push({type:"separator",label:d(9496,null)});for(let l of r)e.push({label:l.name,description:l.value,iconClass:q.asClassName(R.eye),asAttachment:()=>W4t(o,V4t(l))})}let s=[];try{s=await o.getScopes()}catch{}for(let l of s)if(!(l.expensive&&!l.childrenHaveBeenLoaded)){e.push({type:"separator",label:l.name});try{let c=await l.getChildren();c.length>1&&e.push({label:d(9488,null,l.name),iconClass:q.asClassName(R.symbolNamespace),asAttachment:()=>W4t(o,ZTo(l,c))});for(let u of c)e.push({label:u.name,description:qmn(u),iconClass:q.asClassName(R.symbolVariable),asAttachment:()=>W4t(o,V4t(u))})}catch{}}return e}getExpressionPicks(i,e){return ke(o=>{let n=i.read(o),r=new Ye;return o.store.add(Z(()=>r.dispose(!0))),new bd(this.evaluateExpression(n,r.token))}).map((o,n)=>{let r=o.promiseResult.read(n);return{picks:r?.data||[],busy:r===void 0}})}async evaluateExpression(i,e){if(!i.trim())return[{label:d(9495,null),disabled:!0,asAttachment:()=>"noop"}];let t=this.debugService.getViewModel(),o=t.focusedSession,n=t.focusedStackFrame;if(!o||!n)return[{label:d(9492,null),disabled:!0,asAttachment:()=>"noop"}];try{let r=await o.evaluate(i,n.frameId,"watch");if(e.isCancellationRequested)return[];if(r?.body){let s=r.body.result,l=r.body.type;return[{label:i,description:$mn(s,l),iconClass:q.asClassName(R.symbolVariable),asAttachment:()=>W4t(n,{kind:"debugVariable",id:`debug-expression:${i}`,name:i,fullName:i,icon:R.debug,value:s,expression:i,type:l,modelDescription:lVi(i,s,l)})}]}else return[{label:i,description:d(9493,null),disabled:!0,asAttachment:()=>"noop"}]}catch(r){return[{label:i,description:r instanceof Error?r.message:d(9490,null),disabled:!0,asAttachment:()=>"noop"}]}}};Hlt=I([m(0,Ni)],Hlt);function V4t(a){return{kind:"debugVariable",id:`debug-variable:${a.getId()}`,name:a.name,fullName:a.name,icon:R.debug,value:a.value,expression:a.name,type:a.type,modelDescription:lVi(a.name,a.value,a.type)}}function B4t(a){let i=a.source.uri,e=z.lift(a.range);return e.isEmpty()&&(e=e.setEndPosition(e.startLineNumber+1,1)),{kind:"file",value:{uri:i,range:e},id:`debug-paused-location:${i.toString()}:${e.startLineNumber}`,name:He(i),modelDescription:"The debugger is currently paused at this location"}}function W4t(a,i){return[B4t(a),i]}function ZTo(a,i){let e=i.map(t=>`${t.name}: ${t.value}`).join(`
`);return{kind:"debugVariable",id:`debug-scope:${a.name}`,name:`Scope: ${a.name}`,fullName:`Scope: ${a.name}`,icon:R.debug,value:e,expression:a.name,type:"scope",modelDescription:`Debug scope "${a.name}" with ${i.length} variables:
${e}`}}function qmn(a){let i=a.value,e=a.type;return e&&i?`${e}: ${i}`:i||e||""}function $mn(a,i){return i&&a?`${i}: ${a}`:a||i||""}function lVi(a,i,e){let t=`Debug variable "${a}"`;return e&&(t+=` of type ${e}`),t+=` with value: ${i}`,t}var Hve=class extends x{static{this.ID="workbench.contrib.chat.debugChatContextContribution"}constructor(i,e){super(),this._register(i.registerChatContextItem(e.createInstance(Hlt)))}};Hve=I([m(0,DS),m(1,F)],Hve);W(class extends K{constructor(){super({id:"workbench.debug.action.addVariableToChat",title:d(9487,null),f1:!1,menu:{id:D.DebugVariablesContext,group:"z_commands",order:110,when:ie.enabled}})}async run(a,i){let e=a.get(Pt),t=a.get(Ni),o=await e.revealWidget();if(!o)return;let n=Qmn(i);if(n){let r=t.getViewModel().focusedStackFrame;r&&o.attachmentModel.addContext(B4t(r)),o.attachmentModel.addContext(n)}}});W(class extends K{constructor(){super({id:"workbench.debug.action.addWatchExpressionToChat",title:d(9487,null),f1:!1,menu:{id:D.DebugWatchContext,group:"z_commands",order:110,when:ie.enabled}})}async run(a,i){let e=a.get(Pt),t=a.get(Ni),o=await e.revealWidget();if(!i||!o)return;let n=t.getViewModel().focusedStackFrame;n&&o.attachmentModel.addContext(B4t(n)),o.attachmentModel.addContext(V4t(i))}});W(class extends K{constructor(){super({id:"workbench.debug.action.addScopeToChat",title:d(9487,null),f1:!1,menu:{id:D.DebugScopesContext,group:"z_commands",order:1,when:ie.enabled}})}async run(a,i){let e=a.get(Pt),t=a.get(Ni),o=await e.revealWidget();if(!i||!o)return;let r=t.getViewModel().focusedStackFrame;if(r)try{let l=(await r.getScopes()).find(c=>c.name===i.scope.name);if(l){let c=await l.getChildren();o.attachmentModel.addContext(B4t(r)),o.attachmentModel.addContext(ZTo(l,c))}}catch{}}});function jmn(a){return typeof a=="object"&&a!==null&&"variable"in a&&"sessionId"in a}function Qmn(a){if(a instanceof $l)return V4t(a);if(jmn(a)){let i=a.variable;return{kind:"debugVariable",id:`debug-variable:${i.name}`,name:i.name,fullName:i.evaluateName??i.name,icon:R.debug,value:i.value,expression:i.evaluateName??i.name,type:i.type,modelDescription:lVi(i.evaluateName||i.name,i.value,i.type)}}}var Ymn=d(9405,null);xho();Ee(Ni,kUe,1);Ee(hJ,wTe,1);ne.as(Qi.Workbench).registerWorkbenchContribution(EUe,4);ne.as(Qi.Workbench).registerWorkbenchContribution(uUe,4);Wt&&ne.as(Qi.Workbench).registerWorkbenchContribution(TUe,4);ne.as(Qi.Workbench).registerWorkbenchContribution(oUe,3);ne.as(Qi.Workbench).registerWorkbenchContribution(NU,4);ne.as(Qi.Workbench).registerWorkbenchContribution(LUe,4);ne.as(Qi.Workbench).registerWorkbenchContribution(aUe,4);ne.as(Qi.Workbench).registerWorkbenchContribution(iUe,4);It(Hve.ID,Hve,St.AfterRestored);ne.as(Ku.Quickaccess).registerQuickAccessProvider({ctor:pUe,prefix:lnt,contextKey:"inLaunchConfigurationsPicker",placeholder:d(9458,null),helpEntries:[{description:d(9457,null),commandId:cQ,commandCenterOrder:50}]});ne.as(Ku.Quickaccess).registerQuickAccessProvider({ctor:sUe,prefix:cnt,contextKey:"inDebugConsolePicker",placeholder:d(9460,null),helpEntries:[{description:d(9459,null),commandId:BKt}]});xo("editor.contrib.callStack",TFe,1);xo(aA,EFe,1);xo(RB,pQ,2);var Nh=(a,i,e,t)=>{ve.appendMenuItem(D.CommandPalette,{when:C.and(Aa,e),group:Ymn,command:{id:a,title:i,category:Gie,precondition:t}})};Nh(KG,qie);Nh(VKt,L(9461,"Terminate Thread"),sl,v9e);Nh(GG,$ie,sl,Zs.isEqualTo("stopped"));Nh(qG,jie,sl,Zs.isEqualTo("stopped"));Nh(bLi,eSo,sl,C.and(aJ,sl,Zs.isEqualTo("stopped")));Nh($G,Qie,sl,Zs.isEqualTo("stopped"));Nh(lQ,Yie,sl,C.and(Zs.isEqualTo("running"),HK.toNegated()));Nh(LM,uQ,sl,C.or(zC,sA));Nh(oFe,nnt,sl,C.or(zC,C.and(dJ,sA)));Nh(qT,YG,sl,C.or(zC.toNegated(),sA));Nh(jG,Xie,sl,Zs.isEqualTo("stopped"));Nh(Jot,L(9420,"Jump to Cursor"),sue);Nh(Jot,L(9449,"Set Next Statement"),sue);Nh(lUe.ID,lUe.LABEL,Aa);Nh(cUe.ID,cUe.LABEL,sl);Nh(dUe.ID,dUe.LABEL);Nh(Xot,L(9415,"Inline Breakpoint"));Nh(xW,rnt,C.and(Aa,Zs.notEqualsTo(KR(1))));Nh(Zot,RLi,C.and(Aa,Zs.notEqualsTo(KR(1))));Nh(cQ,iSo,C.and(Aa,Zs.notEqualsTo(KR(1))));Nh(xLi,oSo);Nh(kLi,nSo);Nh(ELi,rSo,sl,m9e);Nh(BKt,dSo);Nh(ILi,uSo);Nh(TLi,sSo,sl,Zs.isEqualTo("stopped"));Nh(_Li,aSo,sl,Zs.isEqualTo("stopped"));Nh(DLi,lSo,sl,Zs.isEqualTo("stopped"));Nh(LLi,cSo,sl,Zs.isEqualTo("stopped"));var $d=(a,i,e,t,o,n,r="navigation",s)=>{ve.appendMenuItem(a,{group:r,when:o,order:t,icon:s,command:{id:i,title:e,icon:s,precondition:n}})};$d(D.DebugCallStackContext,KG,qie,10,Av.isEqualTo("session"),void 0,"3_modification");$d(D.DebugCallStackContext,LM,uQ,20,Av.isEqualTo("session"),void 0,"3_modification");$d(D.DebugCallStackContext,oFe,nnt,21,C.and(Av.isEqualTo("session"),dJ,sA),void 0,"3_modification");$d(D.DebugCallStackContext,qT,YG,30,Av.isEqualTo("session"),void 0,"3_modification");$d(D.DebugCallStackContext,lQ,Yie,10,C.and(Av.isEqualTo("thread"),C.and(Zs.isEqualTo("running"),HK.toNegated())));$d(D.DebugCallStackContext,jG,Xie,10,C.and(Av.isEqualTo("thread"),Zs.isEqualTo("stopped")));$d(D.DebugCallStackContext,GG,$ie,20,Av.isEqualTo("thread"),Zs.isEqualTo("stopped"));$d(D.DebugCallStackContext,qG,jie,30,Av.isEqualTo("thread"),Zs.isEqualTo("stopped"));$d(D.DebugCallStackContext,$G,Qie,40,Av.isEqualTo("thread"),Zs.isEqualTo("stopped"));$d(D.DebugCallStackContext,VKt,d(9462,null),10,Av.isEqualTo("thread"),v9e,"termination");$d(D.DebugCallStackContext,SLi,d(9445,null),10,C.and(Av.isEqualTo("stackFrame"),tRt),iRt);$d(D.DebugCallStackContext,gLi,d(9369,null),20,Av.isEqualTo("stackFrame"),void 0,"3_modification");$d(D.DebugVariablesContext,dnt,d(9465,null),15,sJ,sl,"inline",PUt);$d(D.DebugVariablesContext,BLi,d(9450,null),10,C.or(g9e,C.and(LB,f9e)),aue.toNegated(),"3_modification");$d(D.DebugVariablesContext,dQ,snt,10,void 0,void 0,"5_cutcopypaste");$d(D.DebugVariablesContext,Kie,sFe,20,LB,void 0,"5_cutcopypaste");$d(D.DebugVariablesContext,ent,ant,100,LB,void 0,"z_commands");$d(D.DebugVariablesContext,ont,d(9365,null),200,cJ,void 0,"z_commands");$d(D.DebugVariablesContext,tnt,d(9363,null),210,UK,void 0,"z_commands");$d(D.DebugVariablesContext,int,d(9364,null),220,lJ,void 0,"z_commands");$d(D.DebugHoverContext,dnt,d(9465,null),15,sJ,sl,"inline",PUt);$d(D.DebugHoverContext,dQ,snt,10,void 0,void 0,"5_cutcopypaste");$d(D.DebugHoverContext,Kie,sFe,20,LB,void 0,"5_cutcopypaste");$d(D.DebugHoverContext,ent,ant,100,LB,void 0,"z_commands");$d(D.DebugHoverContext,ont,d(9365,null),200,cJ,void 0,"z_commands");$d(D.DebugHoverContext,tnt,d(9363,null),210,UK,void 0,"z_commands");$d(D.DebugHoverContext,int,d(9364,null),220,lJ,void 0,"z_commands");$d(D.DebugWatchContext,nVi,rVi,10,void 0,void 0,"3_modification");$d(D.DebugWatchContext,yLi,d(9413,null),20,BK.isEqualTo("expression"),void 0,"3_modification");$d(D.DebugWatchContext,wLi,d(9450,null),30,C.or(C.and(BK.isEqualTo("expression"),f9e),C.and(BK.isEqualTo("variable"),g9e)),aue.toNegated(),"3_modification");$d(D.DebugWatchContext,dQ,d(9370,null),40,C.or(BK.isEqualTo("expression"),BK.isEqualTo("variable")),sl,"3_modification");$d(D.DebugWatchContext,Kie,sFe,50,LB,sl,"3_modification");$d(D.DebugWatchContext,dnt,d(9465,null),10,sJ,void 0,"inline",PUt);$d(D.DebugWatchContext,CLi,d(9444,null),20,BK.isEqualTo("expression"),void 0,"inline",hho);$d(D.DebugWatchContext,sVi,aVi,20,void 0,void 0,"z_commands");$d(D.DebugWatchContext,ont,d(9365,null),200,cJ,void 0,"z_commands");$d(D.DebugWatchContext,tnt,d(9363,null),210,UK,void 0,"z_commands");$d(D.DebugWatchContext,int,d(9364,null),220,lJ,void 0,"z_commands");$d(D.NotebookVariablesContext,mWi,hWi,20,bTe);Ct.registerKeybindingRule({id:dQ,weight:200,when:C.and(nJ.negate(),C.or(ql.isEqualTo(Ik),ql.isEqualTo(VK))),primary:2081});if(Ze){let a=(i,e,t,o,n)=>{ve.appendMenuItem(D.TouchBarContext,{command:{id:i,title:e,icon:{dark:n}},when:C.and(Aa,o),group:"9_debug",order:t})};a(Zot,RLi,0,sl.toNegated(),vn.asFileUri("vs/workbench/contrib/debug/browser/media/continue-tb.png")),a(xW,rnt,1,sl.toNegated(),vn.asFileUri("vs/workbench/contrib/debug/browser/media/run-with-debugging-tb.png")),a(jG,Xie,0,Zs.isEqualTo("stopped"),vn.asFileUri("vs/workbench/contrib/debug/browser/media/continue-tb.png")),a(lQ,Yie,1,C.and(sl,C.and(Zs.isEqualTo("running"),HK.toNegated())),vn.asFileUri("vs/workbench/contrib/debug/browser/media/pause-tb.png")),a(GG,$ie,2,sl,vn.asFileUri("vs/workbench/contrib/debug/browser/media/stepover-tb.png")),a(qG,jie,3,sl,vn.asFileUri("vs/workbench/contrib/debug/browser/media/stepinto-tb.png")),a($G,Qie,4,sl,vn.asFileUri("vs/workbench/contrib/debug/browser/media/stepout-tb.png")),a(KG,qie,5,sl,vn.asFileUri("vs/workbench/contrib/debug/browser/media/restart-tb.png")),a(qT,YG,6,sl,vn.asFileUri("vs/workbench/contrib/debug/browser/media/stop-tb.png"))}ve.appendMenuItem(D.EditorTitle,{submenu:D.EditorTitleRun,isSplitButton:{togglePrimaryAction:!0},title:L(9446,"Run or Debug..."),icon:cho,group:"navigation",order:-1});ve.appendMenuItem(D.MenubarMainMenu,{submenu:D.MenubarDebugMenu,title:{...L(9448,"Run"),mnemonicTitle:d(9438,null)},order:6});ve.appendMenuItem(D.MenubarDebugMenu,{group:"1_debug",command:{id:xW,title:d(9430,null)},order:1,when:Aa});ve.appendMenuItem(D.MenubarDebugMenu,{group:"1_debug",command:{id:Zot,title:d(9429,null)},order:2,when:Aa});ve.appendMenuItem(D.MenubarDebugMenu,{group:"1_debug",command:{id:qT,title:d(9434,null),precondition:sl},order:3,when:Aa});ve.appendMenuItem(D.MenubarDebugMenu,{group:"1_debug",command:{id:KG,title:d(9428,null),precondition:sl},order:4,when:Aa});ve.appendMenuItem(D.MenubarDebugMenu,{group:"2_configuration",command:{id:Age,title:d(9423,null)},order:2,when:Aa});ve.appendMenuItem(D.MenubarDebugMenu,{group:"3_step",command:{id:GG,title:d(9433,null),precondition:Zs.isEqualTo("stopped")},order:1,when:Aa});ve.appendMenuItem(D.MenubarDebugMenu,{group:"3_step",command:{id:qG,title:d(9431,null),precondition:Zs.isEqualTo("stopped")},order:2,when:Aa});ve.appendMenuItem(D.MenubarDebugMenu,{group:"3_step",command:{id:$G,title:d(9432,null),precondition:Zs.isEqualTo("stopped")},order:3,when:Aa});ve.appendMenuItem(D.MenubarDebugMenu,{group:"3_step",command:{id:jG,title:d(9424,null),precondition:Zs.isEqualTo("stopped")},order:4,when:Aa});ve.appendMenuItem(D.MenubarNewBreakpointMenu,{group:"1_breakpoints",command:{id:Xot,title:d(9425,null)},order:2,when:Aa});ve.appendMenuItem(D.MenubarDebugMenu,{group:"4_new_breakpoint",title:d(9427,null),submenu:D.MenubarNewBreakpointMenu,order:2,when:Aa});ve.appendMenuItem(D.DebugDisassemblyContext,{group:"1_edit",command:{id:FKt,title:HKt},order:2,when:Aa});ve.appendMenuItem(D.DebugDisassemblyContext,{group:"3_breakpoints",command:{id:WKt,title:d(9435,null)},order:2,when:Aa});ve.appendMenuItem(D.MenubarDebugMenu,{group:"z_install",command:{id:"debug.installAdditionalDebuggers",title:d(9426,null)},order:1});var Xmn=ne.as(Mn.ViewContainersRegistry).registerViewContainer({id:QLt,title:L(9407,"Debug Console"),icon:PEi,ctorDescriptor:new Ft(Dc,[QLt,{mergeViewWithContainerWhenSingleView:!0}]),storageId:QLt,hideIfEmpty:!0,order:2},1,{doNotRegisterOpenCommand:!0});ne.as(Mn.ViewsRegistry).registerViews([{id:Td,name:L(9407,"Debug Console"),containerIcon:PEi,canToggleVisibility:!0,canMoveView:!0,when:Aa,ctorDescriptor:new Ft(TU),openCommandActionDescriptor:{id:"workbench.debug.action.toggleRepl",mnemonicTitle:d(9436,null),keybindings:{primary:3127},order:2}}],Xmn);var MUe=ne.as(Mn.ViewContainersRegistry).registerViewContainer({id:cg,title:L(9447,"Run and Debug"),openCommandActionDescriptor:{id:cg,mnemonicTitle:d(9437,null),keybindings:{primary:3106},order:3},ctorDescriptor:new Ft(_Ue),icon:AEi,alwaysUseContainerInfo:!0,order:3},0),PUe=ne.as(Mn.ViewsRegistry);PUe.registerViews([{id:VK,name:L(9464,"Variables"),containerIcon:nho,ctorDescriptor:new Ft(aFe),order:10,weight:40,canToggleVisibility:!0,canMoveView:!0,focusCommand:{id:"workbench.debug.action.focusVariablesView"},when:rA.isEqualTo("default")}],MUe);PUe.registerViews([{id:Ik,name:L(9466,"Watch"),containerIcon:rho,ctorDescriptor:new Ft(RUe),order:20,weight:10,canToggleVisibility:!0,canMoveView:!0,focusCommand:{id:"workbench.debug.action.focusWatchView"},when:rA.isEqualTo("default")}],MUe);PUe.registerViews([{id:f4,name:L(9366,"Call Stack"),containerIcon:sho,ctorDescriptor:new Ft(nUe),order:30,weight:30,canToggleVisibility:!0,canMoveView:!0,focusCommand:{id:"workbench.debug.action.focusCallStackView"},when:rA.isEqualTo("default")}],MUe);PUe.registerViews([{id:yk,name:L(9362,"Breakpoints"),containerIcon:_Ut,ctorDescriptor:new Ft(tFe),order:40,weight:20,canToggleVisibility:!0,canMoveView:!0,focusCommand:{id:"workbench.debug.action.focusBreakpointsView"},when:C.or(v4,rA.isEqualTo("default"),YLt)}],MUe);PUe.registerViews([{id:hL.ID,name:hL.LABEL,containerIcon:AEi,ctorDescriptor:new Ft(hL),order:1,weight:40,canToggleVisibility:!0,when:rA.isEqualTo("simple")}],MUe);PUe.registerViews([{id:rue,name:L(9422,"Loaded Scripts"),containerIcon:aho,ctorDescriptor:new Ft(DUe),order:35,weight:5,canToggleVisibility:!0,canMoveView:!0,collapsed:!0,when:C.and(m9e,rA.isEqualTo("default"))}],MUe);ne.as(qo.EditorPane).registerEditorPane(Br.create(i_,jLt,d(9412,null)),[new Ft(GR)]);var Jmn=ne.as(Jt.Configuration);Jmn.registerConfiguration({id:"debug",order:20,title:d(9406,null),type:"object",properties:{"debug.showVariableTypes":{type:"boolean",description:d(9456,null),default:!1},"debug.allowBreakpointsEverywhere":{type:"boolean",description:d(9360,null),default:!1},"debug.gutterMiddleClickAction":{type:"string",enum:["logpoint","conditionalBreakpoint","triggeredBreakpoint","none"],description:d(9414,null),enumDescriptions:[d(9393,null),d(9392,null),d(9395,null),d(9394,null)],default:"logpoint"},"debug.openExplorerOnEnd":{type:"boolean",description:d(9442,null),default:!1},"debug.closeReadonlyTabsOnEnd":{type:"boolean",description:d(9368,null),default:!1},"debug.inlineValues":{type:"string",enum:["on","off","auto"],description:d(9416,null),enumDescriptions:[d(9419,null),d(9418,null),d(9417,null)],default:"auto"},"debug.toolBarLocation":{enum:["floating","docked","commandCenter","hidden"],markdownDescription:d(9463,null,"`#window.commandCenter#`"),default:"floating",markdownEnumDescriptions:[d(9410,null),d(9409,null),d(9408,null),d(9411,null)]},"debug.showInStatusBar":{enum:["never","always","onFirstSessionStart"],enumDescriptions:[d(9439,null),d(9361,null),d(9440,null)],description:d(9454,null),default:"onFirstSessionStart"},"debug.internalConsoleOptions":dRt,"debug.console.closeOnEnd":{type:"boolean",description:d(9380,null),default:!1},"debug.terminal.clearBeforeReusing":{type:"boolean",description:d(9403,null),default:!1},"debug.openDebug":{enum:["neverOpen","openOnSessionStart","openOnFirstSessionStart","openOnDebugBreak"],default:"openOnDebugBreak",description:d(9441,null)},"debug.showSubSessionsInToolBar":{type:"boolean",description:d(9455,null),default:!1},"debug.console.fontSize":{type:"number",description:d(9383,null),default:Ze?12:14},"debug.console.fontFamily":{type:"string",description:d(9382,null),default:"default"},"debug.console.lineHeight":{type:"number",description:d(9385,null),default:0},"debug.console.wordWrap":{type:"boolean",description:d(9387,null),default:!0},"debug.console.historySuggestions":{type:"boolean",description:d(9384,null),default:!0},"debug.console.collapseIdenticalLines":{type:"boolean",description:d(9381,null),default:!0},"debug.console.acceptSuggestionOnEnter":{enum:["off","on"],description:d(9379,null),default:"off"},"debug.console.maximumLines":{type:"number",description:d(9386,null),default:1e4},launch:{type:"object",description:d(9421,null),default:{configurations:[],compounds:[]},$ref:cH,disallowConfigurationDefault:!0},"debug.focusWindowOnBreak":{type:"boolean",description:d(9391,null),default:!0},"debug.focusEditorOnBreak":{type:"boolean",description:d(9390,null),default:!0},"debug.onTaskErrors":{enum:["debugAnyway","showErrors","prompt","abort"],enumDescriptions:[d(9404,null),d(9452,null),d(9443,null),d(9367,null)],description:d(9398,null),default:"prompt"},"debug.showBreakpointsInOverviewRuler":{type:"boolean",description:d(9451,null),default:!1},"debug.breakpointsView.presentation":{type:"string",description:d(9375,null),enum:["tree","list"],default:"list"},"debug.showInlineBreakpointCandidates":{type:"boolean",description:d(9453,null),default:!0},"debug.saveBeforeStart":{description:d(9399,null),enum:["allEditorsInActiveGroup","nonUntitledEditorsInActiveGroup","none"],enumDescriptions:[d(9400,null),d(9402,null),d(9401,null)],default:"allEditorsInActiveGroup",scope:6},"debug.confirmOnExit":{description:d(9376,null),type:"string",enum:["never","always"],enumDescriptions:[d(9378,null),d(9377,null)],default:"never"},"debug.disassemblyView.showSourceCode":{type:"boolean",default:!0,description:d(9388,null)},"debug.autoExpandLazyVariables":{type:"string",enum:["auto","on","off"],default:"auto",enumDescriptions:[d(9372,null),d(9374,null),d(9373,null)],description:d(9371,null)},"debug.enableStatusBarColor":{type:"boolean",description:d(9389,null),default:!0},"debug.hideLauncherWhileDebugging":{type:"boolean",markdownDescription:d(9396,null,"`#debug.toolBarLocation#`"),default:!1},"debug.hideSlowPreLaunchWarning":{type:"boolean",markdownDescription:d(9397,null),default:!1}}});ga.register(new O4t);ga.register(new N4t);ga.register(new F4t);It(Bve.ID,Bve,St.AfterRestored);It(Vve.ID,Vve,St.AfterRestored);var cVi=class{constructor(i){this._markerService=i;this.label=d(11661,null);this.onDidChange=i.onMarkerChanged}provideDecorations(i){let e=this._markerService.read({resource:i,severities:12}),t;for(let o of e)(!t||o.severity>t.severity)&&(t=o);if(t)return{weight:100*t.severity,bubble:!0,tooltip:e.length===1?d(11663,null):d(11664,null,e.length),letter:e.length<10?e.length.toString():"9+",color:t.severity===8?Gx:q1}}},Ult=class{constructor(i,e,t){this._markerService=i;this._decorationsService=e;this._configurationService=t;this._disposables=[this._configurationService.onDidChangeConfiguration(o=>{o.affectsConfiguration("problems.visibility")&&this._updateEnablement()})],this._updateEnablement()}dispose(){Be(this._provider),Be(this._disposables)}_updateEnablement(){let i=this._configurationService.getValue("problems.visibility");if(i===void 0)return;let e=this._configurationService.getValue("problems"),t=i&&e.decorations.enabled;if(t===this._enabled){(!i||!e.decorations.enabled)&&(this._provider?.dispose(),this._provider=void 0);return}if(this._enabled=t,this._enabled){let o=new cVi(this._markerService);this._provider=this._decorationsService.registerDecorationsProvider(o)}else this._provider&&this._provider.dispose()}};Ult=I([m(0,oa),m(1,Ov),m(2,B)],Ult);ne.as(Jt.Configuration).registerConfiguration({id:"problems",order:101,type:"object",properties:{"problems.decorations.enabled":{markdownDescription:d(11662,null,"`#problems.visibility#`"),type:"boolean",default:!0}}});ne.as(Qi.Workbench).registerWorkbenchContribution(Ult,3);function U4t(a,i){return ar.compare(a.resource,i.resource)}function Zmn(a,i){let[e]=a.markers,[t]=i.markers,o=0;return e&&t&&(o=bl.compare(e.marker.severity,t.marker.severity)),o===0&&(o=a.path.localeCompare(i.path)||a.name.localeCompare(i.name)),o}var YM=class a{constructor(i,e){this.id=i;this.resource=e;this._markersMap=new gt;this._total=0;this.path=this.resource.fsPath,this.name=He(this.resource)}get markers(){return this._cachedMarkers||(this._cachedMarkers=[...this._markersMap.values()].flat().sort(a._compareMarkers)),this._cachedMarkers}has(i){return this._markersMap.has(i)}set(i,e){this.delete(i),yr(e)&&(this._markersMap.set(i,e),this._total+=e.length,this._cachedMarkers=void 0)}delete(i){let e=this._markersMap.get(i);e&&(this._total-=e.length,this._cachedMarkers=void 0,this._markersMap.delete(i))}get total(){return this._total}static _compareMarkers(i,e){return bl.compare(i.marker.severity,e.marker.severity)||ar.compare(i.resource,e.resource)||z.compareRangesUsingStarts(i.marker,e.marker)}},Oh=class{constructor(i,e,t=[]){this.id=i;this.marker=e;this.relatedInformation=t}get resource(){return this.marker.resource}get range(){return this.marker}get lines(){return this._lines||(this._lines=yc(this.marker.message)),this._lines}toString(){return JSON.stringify({...this.marker,resource:this.marker.resource.path,relatedInformation:this.relatedInformation.length?this.relatedInformation.map(i=>({...i.raw,resource:i.raw.resource.path})):void 0},null,"	")}},ON=class extends Oh{constructor(e,t,o,n,r){super(e.id,e.marker,e.relatedInformation);this.sourceMatches=t;this.codeMatches=o;this.messageMatches=n;this.fileMatches=r}},jW=class{constructor(i,e,t){this.id=i;this.marker=e;this.raw=t}},H4t=class{constructor(){this.cachedSortedResources=void 0;this._onDidChange=new E;this.onDidChange=this._onDidChange.event;this._total=0;this.resourcesByUri=new Map}get resourceMarkers(){return this.cachedSortedResources||(this.cachedSortedResources=[...this.resourcesByUri.values()].sort(Zmn)),this.cachedSortedResources}reset(){let i=new Set;for(let e of this.resourcesByUri.values())i.add(e);this.resourcesByUri.clear(),this._total=0,this._onDidChange.fire({removed:i,added:new Set,updated:new Set})}get total(){return this._total}getResourceMarkers(i){return this.resourcesByUri.get(ar.getComparisonKey(i,!0))??null}setResourceMarkers(i){let e={added:new Set,removed:new Set,updated:new Set};for(let[t,o]of i){if(Pme.has(t.scheme))continue;let n=ar.getComparisonKey(t,!0),r=this.resourcesByUri.get(n);if(yr(o)){if(r)e.updated.add(r);else{let c=this.id(t.toString());r=new YM(c,t.with({fragment:null})),this.resourcesByUri.set(n,r),e.added.add(r)}let s=new Set,l=[];for(let c of o){let u=jV.makeKey(c)+c.resource.toString();if(s.has(u))continue;s.add(u);let p=this.id(r.id,u,0,c.resource.toString()),h;c.relatedInformation&&(h=c.relatedInformation.map((g,f)=>new jW(this.id(p,g.resource.toString(),g.startLineNumber,g.startColumn,g.endLineNumber,g.endColumn,f),c,g))),l.push(new Oh(p,c,h))}this._total-=r.total,r.set(t,l),this._total+=r.total}else r&&(this._total-=r.total,r.delete(t),this._total+=r.total,r.total===0?(this.resourcesByUri.delete(n),e.removed.add(r)):e.updated.add(r))}this.cachedSortedResources=void 0,(e.added.size||e.removed.size||e.updated.size)&&this._onDidChange.fire(e)}id(...i){return`${_r(i)}`}dispose(){this._onDidChange.dispose(),this.resourcesByUri.clear()}};var ehn=/(!)?@source:("[^"]*"|[^\s,]+)(\s*)/i,z4t=class{constructor(i,e,t){this.globalExpression=Ym(i),this.expressionsByRoot=Sp.forUris(o=>t.extUri.ignorePathCasing(o));for(let o of e)this.expressionsByRoot.set(o.root,{root:o.root,expression:Ym(o.expression)})}matches(i){let e=this.expressionsByRoot.findSubstr(i);if(e){let t=Wd(e.root,i);if(t&&e.expression(t))return!0}return!!this.globalExpression(i.path)}},sE=class a{constructor(i,e,t,o,n,r){this.filter=i;this.showWarnings=!1;this.showErrors=!1;this.showInfos=!1;i=i.trim(),this.showWarnings=t,this.showErrors=o,this.showInfos=n;let s=Array.isArray(e)?e:[],l=Array.isArray(e)?xpi():e;for(let{expression:f}of s)for(let v of Object.keys(f))v.endsWith("/**")||(f[`${dh(v,"/")}/**`]=f[v]);let c=[],u=[],p;for(;(p=ehn.exec(i))!==null;){let f=!!p[1],v=p[2];v.startsWith('"')&&v.endsWith('"')&&(v=v.slice(1,-1)),f?u.push(v.toLowerCase()):c.push(v.toLowerCase()),i=(i.substring(0,p.index)+i.substring(p.index+p[0].length)).trim()}this.includeSourceFilters=c,this.excludeSourceFilters=u;let h=i.startsWith("!");this.textFilter={text:(h?fC(i,"!"):i).trim(),negate:h};let g=xpi();if(i){let f=ER(i,",").map(v=>v.trim()).filter(v=>!!v.length);for(let v of f)if(v.startsWith("!")){let b=fC(v,"!");b&&this.setPattern(l,b)}else this.setPattern(g,v)}this.excludesMatcher=new z4t(l,s,r),this.includesMatcher=new z4t(g,[],r)}static{this._filter=bCe}static{this._messageFilter=lm}static EMPTY(i){return new a("",[],!1,!1,!1,i)}matchesSourceFilters(i){if(this.includeSourceFilters.length===0&&this.excludeSourceFilters.length===0)return!0;let e=i?.toLowerCase();return e&&this.excludeSourceFilters.includes(e)?!1:this.includeSourceFilters.length>0?e?this.includeSourceFilters.includes(e):!1:!0}setPattern(i,e){e[0]==="."&&(e="*"+e),i[`**/${e}/**`]=!0,i[`**/${e}`]=!0}};var Np=class{static{this.MARKERS_PANEL_TOGGLE_LABEL=d(11724,null)}static{this.MARKERS_PANEL_SHOW_LABEL=L(11723,"Focus Problems (Errors, Warnings, Infos)")}static{this.PROBLEMS_PANEL_CONFIGURATION_TITLE=d(11710,null)}static{this.PROBLEMS_PANEL_CONFIGURATION_AUTO_REVEAL=d(11705,null)}static{this.PROBLEMS_PANEL_CONFIGURATION_VIEW_MODE=d(11711,null)}static{this.PROBLEMS_PANEL_CONFIGURATION_SHOW_CURRENT_STATUS=d(11709,null)}static{this.PROBLEMS_PANEL_CONFIGURATION_COMPARE_ORDER=d(11706,null)}static{this.PROBLEMS_PANEL_CONFIGURATION_COMPARE_ORDER_SEVERITY=d(11708,null)}static{this.PROBLEMS_PANEL_CONFIGURATION_COMPARE_ORDER_POSITION=d(11707,null)}static{this.MARKERS_PANEL_TITLE_PROBLEMS=L(11704,"Problems")}static{this.MARKERS_PANEL_NO_PROBLEMS_BUILT=d(11698,null)}static{this.MARKERS_PANEL_NO_PROBLEMS_ACTIVE_FILE_BUILT=d(11697,null)}static{this.MARKERS_PANEL_NO_PROBLEMS_FILTERS=d(11699,null)}static{this.MARKERS_PANEL_ACTION_TOOLTIP_MORE_FILTERS=d(11680,null)}static{this.MARKERS_PANEL_FILTER_LABEL_SHOW_ERRORS=d(11688,null)}static{this.MARKERS_PANEL_FILTER_LABEL_SHOW_WARNINGS=d(11690,null)}static{this.MARKERS_PANEL_FILTER_LABEL_SHOW_INFOS=d(11689,null)}static{this.MARKERS_PANEL_FILTER_LABEL_EXCLUDED_FILES=d(11691,null)}static{this.MARKERS_PANEL_FILTER_LABEL_ACTIVE_FILE=d(11683,null)}static{this.MARKERS_PANEL_ACTION_TOOLTIP_FILTER=d(11679,null)}static{this.MARKERS_PANEL_ACTION_TOOLTIP_QUICKFIX=d(11681,null)}static{this.MARKERS_PANEL_FILTER_ARIA_LABEL=d(11684,null)}static{this.MARKERS_PANEL_FILTER_PLACEHOLDER=d(11687,null)}static{this.MARKERS_PANEL_FILTER_ERRORS=d(11685,null)}static{this.MARKERS_PANEL_FILTER_WARNINGS=d(11692,null)}static{this.MARKERS_PANEL_FILTER_INFOS=d(11686,null)}static{this.MARKERS_PANEL_SINGLE_ERROR_LABEL=d(11700,null)}static{this.MARKERS_PANEL_MULTIPLE_ERRORS_LABEL=i=>d(11693,null,""+i)}static{this.MARKERS_PANEL_SINGLE_WARNING_LABEL=d(11703,null)}static{this.MARKERS_PANEL_MULTIPLE_WARNINGS_LABEL=i=>d(11696,null,""+i)}static{this.MARKERS_PANEL_SINGLE_INFO_LABEL=d(11701,null)}static{this.MARKERS_PANEL_MULTIPLE_INFOS_LABEL=i=>d(11694,null,""+i)}static{this.MARKERS_PANEL_SINGLE_UNKNOWN_LABEL=d(11702,null)}static{this.MARKERS_PANEL_MULTIPLE_UNKNOWNS_LABEL=i=>d(11695,null,""+i)}static{this.MARKERS_PANEL_AT_LINE_COL_NUMBER=(i,e)=>d(11682,null,""+i,""+e)}static{this.MARKERS_TREE_ARIA_LABEL_RESOURCE=(i,e,t)=>d(11720,null,i,e,t)}static{this.MARKERS_TREE_ARIA_LABEL_MARKER=i=>{let e=i.relatedInformation.length?d(11718,null,i.relatedInformation.length):"";switch(i.marker.severity){case 8:return i.marker.source?d(11712,null,i.marker.message,i.marker.startLineNumber,i.marker.startColumn,e,i.marker.source):d(11713,null,i.marker.message,i.marker.startLineNumber,i.marker.startColumn,e);case 4:return i.marker.source?d(11721,null,i.marker.message,i.marker.startLineNumber,i.marker.startColumn,e,i.marker.source):d(11722,null,i.marker.message,i.marker.startLineNumber,i.marker.startColumn,e,e);case 2:return i.marker.source?d(11714,null,i.marker.message,i.marker.startLineNumber,i.marker.startColumn,e,i.marker.source):d(11715,null,i.marker.message,i.marker.startLineNumber,i.marker.startColumn,e);default:return i.marker.source?d(11716,null,i.marker.source,i.marker.message,i.marker.startLineNumber,i.marker.startColumn,e,i.marker.source):d(11717,null,i.marker.message,i.marker.startLineNumber,i.marker.startColumn,e)}}}static{this.MARKERS_TREE_ARIA_LABEL_RELATED_INFORMATION=i=>d(11719,null,i.message,i.startLineNumber,i.startColumn,He(i.resource))}static{this.SHOW_ERRORS_WARNINGS_ACTION_LABEL=d(11678,null)}};var K4t=class extends x{constructor(e,t){super();this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._excludedFiles=Ap.ShowExcludedFilesFilterContextKey.bindTo(t),this._excludedFiles.set(e.excludedFiles),this._activeFile=Ap.ShowActiveFileFilterContextKey.bindTo(t),this._activeFile.set(e.activeFile),this._showWarnings=Ap.ShowWarningsFilterContextKey.bindTo(t),this._showWarnings.set(e.showWarnings),this._showInfos=Ap.ShowInfoFilterContextKey.bindTo(t),this._showInfos.set(e.showInfos),this._showErrors=Ap.ShowErrorsFilterContextKey.bindTo(t),this._showErrors.set(e.showErrors),this.filterHistory=e.filterHistory}get excludedFiles(){return!!this._excludedFiles.get()}set excludedFiles(e){this._excludedFiles.get()!==e&&(this._excludedFiles.set(e),this._onDidChange.fire({excludedFiles:!0}))}get activeFile(){return!!this._activeFile.get()}set activeFile(e){this._activeFile.get()!==e&&(this._activeFile.set(e),this._onDidChange.fire({activeFile:!0}))}get showWarnings(){return!!this._showWarnings.get()}set showWarnings(e){this._showWarnings.get()!==e&&(this._showWarnings.set(e),this._onDidChange.fire({showWarnings:!0}))}get showErrors(){return!!this._showErrors.get()}set showErrors(e){this._showErrors.get()!==e&&(this._showErrors.set(e),this._onDidChange.fire({showErrors:!0}))}get showInfos(){return!!this._showInfos.get()}set showInfos(e){this._showInfos.get()!==e&&(this._showInfos.set(e),this._onDidChange.fire({showInfos:!0}))}},Uve=class a extends it{constructor(e){super(a.ID,Np.MARKERS_PANEL_ACTION_TOOLTIP_QUICKFIX,a.CLASS,!1);this.marker=e;this._onShowQuickFixes=this._register(new E);this.onShowQuickFixes=this._onShowQuickFixes.event;this._quickFixes=[]}static{this.ID="workbench.actions.problems.quickfix"}static{this.CLASS="markers-panel-action-quickfix "+q.asClassName(R.lightBulb)}static{this.AUTO_FIX_CLASS=a.CLASS+" autofixable"}get quickFixes(){return this._quickFixes}set quickFixes(e){this._quickFixes=e,this.enabled=this._quickFixes.length>0}autoFixable(e){this.class=e?a.AUTO_FIX_CLASS:a.CLASS}run(){return this._onShowQuickFixes.fire(),Promise.resolve()}},Qne=class extends hs{constructor(e,t,o){super(null,e,{...t,icon:!0,label:!1});this.contextMenuService=o}onClick(e){Xt.stop(e,!0),this.showQuickFixes()}showQuickFixes(){if(!this.element||!this.isEnabled())return;let e=ir(this.element),t=this.action.quickFixes;t.length&&this.contextMenuService.showContextMenu({getAnchor:()=>({x:e.left+10,y:e.top+e.height+4}),getActions:()=>t})}};Qne=I([m(2,Xe)],Qne);var Zne=_,Yne=class{constructor(i,e){this.markersViewModel=i;this.instantiationService=e;this.templateId=Yne.TEMPLATE_ID}static{this.TEMPLATE_ID="severity"}renderTemplate(i){let e=M(i,Zne(".severity")),t=M(e,Zne("")),o=M(i,Zne(".actions"));return{actionBar:new Zi(o,{actionViewItemProvider:(r,s)=>r.id===Uve.ID?this.instantiationService.createInstance(Qne,r,s):void 0}),icon:t,elementDisposables:new N}}renderElement(i,e,t){t.elementDisposables.clear();let o=r=>{nr(r)||Cg(t.icon,"monaco-table-td").classList.toggle("quickFix",r)};t.icon.title=bl.toString(i.marker.severity),t.icon.className=`marker-icon ${bt.toString(bl.toSeverity(i.marker.severity))} codicon ${sk.className(bl.toSeverity(i.marker.severity))}`,t.actionBar.clear();let n=this.markersViewModel.getViewModel(i);if(n){let r=n.quickFixAction;t.actionBar.push([r],{icon:!0,label:!1}),o(n.quickFixAction.enabled),t.elementDisposables.add(r.onDidChange(({enabled:s})=>o(s))),t.elementDisposables.add(r.onShowQuickFixes(()=>{let s=t.actionBar.viewItems[0];s&&s.showQuickFixes()}))}}disposeTemplate(i){i.elementDisposables.dispose(),i.actionBar.dispose()}};Yne=I([m(1,F)],Yne);var Xne=class{constructor(i,e){this.hoverService=i;this.openerService=e;this.templateId=Xne.TEMPLATE_ID}static{this.TEMPLATE_ID="code"}renderTemplate(i){let e=new N,t=M(i,Zne(".code")),o=e.add(new Ya(t));o.element.classList.add("source-label");let n=e.add(new Ya(t));n.element.classList.add("code-label");let r=e.add(new rg(t,{href:"",label:""},{},this.hoverService,this.openerService));return{codeColumn:t,sourceLabel:o,codeLabel:n,codeLink:r,templateDisposable:e}}renderElement(i,e,t){if(t.codeColumn.classList.remove("code-label"),t.codeColumn.classList.remove("code-link"),i.marker.source&&i.marker.code)if(typeof i.marker.code=="string")t.codeColumn.classList.add("code-label"),t.codeColumn.title=`${i.marker.source} (${i.marker.code})`,t.sourceLabel.set(i.marker.source,i.sourceMatches),t.codeLabel.set(i.marker.code,i.codeMatches);else{t.codeColumn.classList.add("code-link"),t.codeColumn.title=`${i.marker.source} (${i.marker.code.value})`,t.sourceLabel.set(i.marker.source,i.sourceMatches);let o=t.templateDisposable.add(new Ya(Zne(".code-link-label")));o.set(i.marker.code.value,i.codeMatches),t.codeLink.link={href:i.marker.code.target.toString(!0),title:i.marker.code.target.toString(!0),label:o.element}}else t.codeColumn.title="",t.sourceLabel.set("-")}disposeTemplate(i){i.templateDisposable.dispose()}};Xne=I([m(0,nt),m(1,Je)],Xne);var G4t=class a{constructor(){this.templateId=a.TEMPLATE_ID}static{this.TEMPLATE_ID="message"}renderTemplate(i){let e=M(i,Zne(".message")),t=new Ya(e);return{columnElement:e,highlightedLabel:t}}renderElement(i,e,t){t.columnElement.title=i.marker.message,t.highlightedLabel.set(i.marker.message,i.messageMatches)}disposeTemplate(i){i.highlightedLabel.dispose()}},Jne=class{constructor(i){this.labelService=i;this.templateId=Jne.TEMPLATE_ID}static{this.TEMPLATE_ID="file"}renderTemplate(i){let e=M(i,Zne(".file")),t=new Ya(e);t.element.classList.add("file-label");let o=new Ya(e);return o.element.classList.add("file-position"),{columnElement:e,fileLabel:t,positionLabel:o}}renderElement(i,e,t){let o=Np.MARKERS_PANEL_AT_LINE_COL_NUMBER(i.marker.startLineNumber,i.marker.startColumn);t.columnElement.title=`${this.labelService.getUriLabel(i.marker.resource,{relative:!1})} ${o}`,t.fileLabel.set(this.labelService.getUriLabel(i.marker.resource,{relative:!0}),i.fileMatches),t.positionLabel.set(o,void 0)}disposeTemplate(i){i.fileLabel.dispose(),i.positionLabel.dispose()}};Jne=I([m(0,rt)],Jne);var q4t=class a{constructor(){this.templateId=a.TEMPLATE_ID}static{this.TEMPLATE_ID="source"}renderTemplate(i){let e=M(i,Zne(".source")),t=new Ya(e);return{columnElement:e,highlightedLabel:t}}renderElement(i,e,t){t.columnElement.title=i.marker.source??"",t.highlightedLabel.set(i.marker.source??"",i.sourceMatches)}disposeTemplate(i){i.highlightedLabel.dispose()}},dVi=class a{constructor(){this.headerRowHeight=a.HEADER_ROW_HEIGHT}static{this.HEADER_ROW_HEIGHT=24}static{this.ROW_HEIGHT=24}getHeight(i){return a.ROW_HEIGHT}},AUe=class extends x{constructor(e,t,o,n,r,s,l){super();this.container=e;this.markersViewModel=t;this.resourceMarkers=o;this.filterOptions=n;this.instantiationService=s;this.labelService=l;this._itemCount=0;this.table=this.instantiationService.createInstance(MC,"Markers",this.container,new dVi,[{label:"",tooltip:"",weight:0,minimumWidth:36,maximumWidth:36,templateId:Yne.TEMPLATE_ID,project(f){return f}},{label:d(11665,null),tooltip:"",weight:1,minimumWidth:100,maximumWidth:300,templateId:Xne.TEMPLATE_ID,project(f){return f}},{label:d(11667,null),tooltip:"",weight:4,templateId:G4t.TEMPLATE_ID,project(f){return f}},{label:d(11666,null),tooltip:"",weight:2,templateId:Jne.TEMPLATE_ID,project(f){return f}},{label:d(11668,null),tooltip:"",weight:1,minimumWidth:100,maximumWidth:300,templateId:q4t.TEMPLATE_ID,project(f){return f}}],[this.instantiationService.createInstance(Yne,this.markersViewModel),this.instantiationService.createInstance(Xne),this.instantiationService.createInstance(G4t),this.instantiationService.createInstance(Jne),this.instantiationService.createInstance(q4t)],r);let c=this.table.domNode.querySelector(".monaco-list-rows"),u=U.chain(this._register(new Gn(c,"mouseover")).event,f=>f.map(v=>Cg(v.target,"monaco-list-row","monaco-list-rows")).filter(v=>!!v).map(v=>parseInt(v.getAttribute("data-index")))),p=U.map(this._register(new Gn(c,"mouseleave")).event,()=>-1),h=U.latch(U.any(u,p)),g=U.debounce(h,(f,v)=>v,500);this._register(g(f=>{f!==-1&&this.table.row(f)&&this.markersViewModel.onMarkerMouseHover(this.table.row(f))}))}get contextKeyService(){return this.table.contextKeyService}get onContextMenu(){return this.table.onContextMenu}get onDidOpen(){return this.table.onDidOpen}get onDidChangeFocus(){return this.table.onDidChangeFocus}get onDidChangeSelection(){return this.table.onDidChangeSelection}collapseMarkers(){}domFocus(){this.table.domFocus()}filterMarkers(e,t){this.filterOptions=t,this.reset(e)}getFocus(){let e=this.table.getFocus();return e.length>0?[...e.map(t=>this.table.row(t))]:[]}getHTMLElement(){return this.table.getHTMLElement()}getRelativeTop(e){return e?this.table.getRelativeTop(this.table.indexOf(e)):null}getSelection(){let e=this.table.getSelection();return e.length>0?[...e.map(t=>this.table.row(t))]:[]}getVisibleItemCount(){return this._itemCount}isVisible(){return!this.container.classList.contains("hidden")}layout(e,t){this.container.style.height=`${e}px`,this.table.layout(e,t)}reset(e){this.resourceMarkers=e;let t=[];for(let o of this.resourceMarkers)for(let n of o.markers){if(Pme.has(n.resource.scheme)||this.filterOptions.excludesMatcher.matches(n.resource))continue;if(this.filterOptions.includesMatcher.matches(n.resource)){t.push(new ON(n));continue}if((this.filterOptions.showErrors&&8===n.marker.severity||this.filterOptions.showWarnings&&4===n.marker.severity||this.filterOptions.showInfos&&2===n.marker.severity)&&this.filterOptions.matchesSourceFilters(n.marker.source)){if(this.filterOptions.textFilter.text){let s=n.marker.source?sE._filter(this.filterOptions.textFilter.text,n.marker.source)??void 0:void 0,l=n.marker.code?sE._filter(this.filterOptions.textFilter.text,typeof n.marker.code=="string"?n.marker.code:n.marker.code.value)??void 0:void 0,c=sE._messageFilter(this.filterOptions.textFilter.text,n.marker.message)??void 0,u=sE._messageFilter(this.filterOptions.textFilter.text,this.labelService.getUriLabel(n.resource,{relative:!0}))??void 0,p=s||l||c||u;(p&&!this.filterOptions.textFilter.negate||!p&&this.filterOptions.textFilter.negate)&&t.push(new ON(n,s,l,c,u));continue}t.push(new ON(n))}}this._itemCount=t.length,this.table.splice(0,Number.POSITIVE_INFINITY,t.sort((o,n)=>{let r=bl.compare(o.marker.severity,n.marker.severity);return r===0&&(r=U4t(o.marker,n.marker)),r===0&&(r=z.compareRangesUsingStarts(o.marker,n.marker)),r}))}revealMarkers(e,t,o){if(e){let n=this.resourceMarkers.indexOf(e);if(n!==-1)if(this.hasSelectedMarkerFor(e)){let r=this.table.getSelection();this.table.reveal(r[0],o),t&&this.table.setFocus(r)}else this.table.reveal(n,0),t&&(this.table.setFocus([n]),this.table.setSelection([n]))}else t&&(this.table.setSelection([]),this.table.focusFirst())}setAriaLabel(e){this.table.domNode.ariaLabel=e}setMarkerSelection(e,t){this.isVisible()&&(e&&e.length>0?(this.table.setSelection(e.map(o=>this.findMarkerIndex(o))),t&&t.length>0?this.table.setFocus(t.map(o=>this.findMarkerIndex(o))):this.table.setFocus([this.findMarkerIndex(e[0])]),this.table.reveal(this.findMarkerIndex(e[0]))):this.getSelection().length===0&&this.getVisibleItemCount()>0&&(this.table.setSelection([0]),this.table.setFocus([0]),this.table.reveal(0)))}toggleVisibility(e){this.container.classList.toggle("hidden",e)}update(e){for(let t of e){let o=this.resourceMarkers.indexOf(t);this.resourceMarkers.splice(o,1,t)}this.reset(this.resourceMarkers)}updateMarker(e){this.table.rerender()}findMarkerIndex(e){for(let t=0;t<this.table.length;t++)if(this.table.row(t).marker===e.marker)return t;return-1}hasSelectedMarkerFor(e){let t=this.getSelection();return!!(t&&t.length>0&&t[0]instanceof Oh&&e.has(t[0].marker.resource))}};AUe=I([m(5,F),m(6,rt)],AUe);var NUe=class{constructor(i){this.labelService=i}getWidgetAriaLabel(){return d(11672,null)}getAriaLabel(i){if(i instanceof YM){let e=this.labelService.getUriLabel(i.resource,{relative:!0})||i.resource.fsPath;return Np.MARKERS_TREE_ARIA_LABEL_RESOURCE(i.markers.length,i.name,ad(e))}return i instanceof Oh||i instanceof ON?Np.MARKERS_TREE_ARIA_LABEL_MARKER(i):i instanceof jW?Np.MARKERS_TREE_ARIA_LABEL_RELATED_INFORMATION(i.raw):null}};NUe=I([m(0,rt)],NUe);var Klt=class a{constructor(i){this.markersViewState=i}static{this.LINE_HEIGHT=22}getHeight(i){if(i instanceof Oh){let e=this.markersViewState.getViewModel(i);return(!e||e.multiline?i.lines.length:1)*a.LINE_HEIGHT}return a.LINE_HEIGHT}getTemplateId(i){return i instanceof YM?"rm":i instanceof Oh?"m":"ri"}};var $4t=class{constructor(i,e){this.labels=i;this.renderedNodes=new Map;this.disposables=new N;this.templateId="rm";e(this.onDidChangeRenderNodeCount,this,this.disposables)}renderTemplate(i){let e=M(i,_(".resource-label-container")),t=this.labels.create(e,{supportHighlights:!0}),o=M(i,_(".count-badge-wrapper"));return{count:new _v(o,{},iI),resourceLabel:t}}renderElement(i,e,t){let o=i.element,n=i.filterData&&i.filterData.uriMatches||[];t.resourceLabel.setFile(o.resource,{matches:n}),this.updateCount(i,t);let r=this.renderedNodes.get(o)??[];this.renderedNodes.set(o,[...r,t])}disposeElement(i,e,t){let o=this.renderedNodes.get(i.element)??[],n=o.findIndex(r=>t===r);if(n<0)throw new Error("Disposing unknown resource marker");o.length===1?this.renderedNodes.delete(i.element):o.splice(n,1)}disposeTemplate(i){i.resourceLabel.dispose(),i.count.dispose()}onDidChangeRenderNodeCount(i){let e=this.renderedNodes.get(i.element);e&&e.forEach(t=>this.updateCount(i,t))}updateCount(i,e){e.count.setCount(i.children.reduce((t,o)=>t+(o.visible?1:0),0))}dispose(){this.disposables.dispose()}};var OUe=class{constructor(i,e,t,o){this.markersViewState=i;this.hoverService=e;this.instantiationService=t;this.openerService=o;this.templateId="m"}renderTemplate(i){let e=Object.create(null);return e.markerWidget=new pVi(i,this.markersViewState,this.hoverService,this.openerService,this.instantiationService),e}renderElement(i,e,t){t.markerWidget.render(i.element,i.filterData)}disposeTemplate(i){i.markerWidget.dispose()}};OUe=I([m(1,nt),m(2,F),m(3,Je)],OUe);var i_o=Ae("markers-view-multi-line-expanded",R.chevronUp,d(11670,null)),thn=Ae("markers-view-multi-line-collapsed",R.chevronDown,d(11669,null)),e_o="problems.action.toggleMultiline",uVi=class extends hs{render(i){super.render(i),this.updateExpandedAttribute()}updateClass(){super.updateClass(),this.updateExpandedAttribute()}updateExpandedAttribute(){this.element?.setAttribute("aria-expanded",`${this._action.class===q.asClassName(i_o)}`)}},pVi=class extends x{constructor(e,t,o,n,r){super();this.parent=e;this.markersViewModel=t;this._hoverService=o;this._openerService=n;this.disposables=this._register(new N);this.actionBar=this._register(new Zi(M(e,_(".actions")),{actionViewItemProvider:(s,l)=>s.id===Uve.ID?r.createInstance(Qne,s,l):void 0})),this.iconContainer=M(e,_("")),this.icon=M(this.iconContainer,_("")),this.messageAndDetailsContainer=M(e,_(".marker-message-details-container")),this.messageAndDetailsContainerHover=this._register(this._hoverService.setupManagedHover(Ri("mouse"),this.messageAndDetailsContainer,""))}render(e,t){this.actionBar.clear(),this.disposables.clear(),Rt(this.messageAndDetailsContainer),this.iconContainer.className=`marker-icon ${bt.toString(bl.toSeverity(e.marker.severity))}`,this.icon.className=`codicon ${sk.className(bl.toSeverity(e.marker.severity))}`,this.renderQuickfixActionbar(e),this.renderMessageAndDetails(e,t),this.disposables.add(j(this.parent,re.MOUSE_OVER,()=>this.markersViewModel.onMarkerMouseHover(e))),this.disposables.add(j(this.parent,re.MOUSE_LEAVE,()=>this.markersViewModel.onMarkerMouseLeave(e)))}renderQuickfixActionbar(e){let t=this.markersViewModel.getViewModel(e);if(t){let o=t.quickFixAction;this.actionBar.push([o],{icon:!0,label:!1}),this.iconContainer.classList.toggle("quickFix",o.enabled),o.onDidChange(({enabled:n})=>{nr(n)||this.iconContainer.classList.toggle("quickFix",n)},this,this.disposables),o.onShowQuickFixes(()=>{let n=this.actionBar.viewItems[0];n&&n.showQuickFixes()},this,this.disposables)}}renderMultilineActionbar(e,t){let o=this.disposables.add(new Zi(M(t,_(".multiline-actions")),{actionViewItemProvider:(l,c)=>{if(l.id===e_o)return new uVi(void 0,l,{...c,icon:!0})}}));this.disposables.add(o);let n=this.markersViewModel.getViewModel(e),r=n&&n.multiline,s=this.disposables.add(new it(e_o));s.enabled=!!n&&e.lines.length>1,s.tooltip=r?d(11673,null):d(11671,null),s.class=q.asClassName(r?i_o:thn),s.run=()=>(n&&(n.multiline=!n.multiline),Promise.resolve()),o.push([s],{icon:!0,label:!1})}renderMessageAndDetails(e,t){let{marker:o,lines:n}=e,r=this.markersViewModel.getViewModel(e),s=!r||r.multiline,l=t&&t.lineMatches||[];this.messageAndDetailsContainerHover.update(e.marker.message);let c=[];for(let u=0;u<(s?n.length:1);u++){let p=M(this.messageAndDetailsContainer,_(".marker-message-line")),h=M(p,_(".marker-message"));this.disposables.add(new Ya(h)).set(n[u].length>1e3?`${n[u].substring(0,1e3)}...`:n[u],l[u]),n[u]===""&&(p.style.height=`${Klt.LINE_HEIGHT}px`),c.push(p)}this.renderDetails(o,t,c[0]),this.renderMultilineActionbar(e,c[0])}renderDetails(e,t,o){if(o.classList.add("details-container"),e.source||e.code){let r=this.disposables.add(new Ya(M(o,_(".marker-source")))),s=t&&t.sourceMatches||[];if(r.set(e.source,s),e.code)if(typeof e.code=="string"){let l=this.disposables.add(new Ya(M(o,_(".marker-code")))),c=t&&t.codeMatches||[];l.set(e.code,c)}else{let l=_(".marker-code"),c=this.disposables.add(new Ya(l)),u=e.code.target.toString(!0);this.disposables.add(new rg(o,{href:u,label:l,title:u},void 0,this._hoverService,this._openerService));let p=t&&t.codeMatches||[];c.set(e.code.value,p)}}let n=M(o,_("span.marker-line"));n.textContent=Np.MARKERS_PANEL_AT_LINE_COL_NUMBER(e.startLineNumber,e.startColumn)}},FUe=class{constructor(i){this.labelService=i;this.templateId="ri"}renderTemplate(i){let e=Object.create(null);M(i,_(".actions")),M(i,_(".icon")),e.resourceLabel=new Ya(M(i,_(".related-info-resource"))),e.lnCol=M(i,_("span.marker-line"));let t=M(i,_("span.related-info-resource-separator"));return t.textContent=":",t.style.paddingRight="4px",e.description=new Ya(M(i,_(".marker-description"))),e}renderElement(i,e,t){let o=i.element.raw,n=i.filterData&&i.filterData.uriMatches||[],r=i.filterData&&i.filterData.messageMatches||[],s=this.labelService.getUriLabel(o.resource,{relative:!0});t.resourceLabel.set(He(o.resource),n,s),t.lnCol.textContent=Np.MARKERS_PANEL_AT_LINE_COL_NUMBER(o.startLineNumber,o.startColumn),t.description.set(o.message,r,o.message)}disposeTemplate(i){i.resourceLabel.dispose(),i.description.dispose()}};FUe=I([m(0,rt)],FUe);var j4t=class{constructor(i){this.options=i}filter(i,e){return i instanceof YM?this.filterResourceMarkers(i):i instanceof Oh?this.filterMarker(i,e):this.filterRelatedInformation(i,e)}filterResourceMarkers(i){if(Pme.has(i.resource.scheme)||this.options.excludesMatcher.matches(i.resource))return!1;if(this.options.includesMatcher.matches(i.resource))return!0;if(this.options.textFilter.text&&!this.options.textFilter.negate){let e=sE._filter(this.options.textFilter.text,He(i.resource));if(e)return{visibility:!0,data:{type:0,uriMatches:e||[]}}}return 2}filterMarker(i,e){if(!(this.options.showErrors&&8===i.marker.severity||this.options.showWarnings&&4===i.marker.severity||this.options.showInfos&&2===i.marker.severity)||!this.options.matchesSourceFilters(i.marker.source))return!1;if(!this.options.textFilter.text)return!0;let o=[];for(let l of i.lines){let c=sE._messageFilter(this.options.textFilter.text,l);o.push(c||[])}let n=i.marker.source?sE._filter(this.options.textFilter.text,i.marker.source):void 0,r=i.marker.code?sE._filter(this.options.textFilter.text,typeof i.marker.code=="string"?i.marker.code:i.marker.code.value):void 0,s=n||r||o.some(l=>l.length>0);return s&&!this.options.textFilter.negate?{visibility:!0,data:{type:1,lineMatches:o,sourceMatches:n||[],codeMatches:r||[]}}:s&&this.options.textFilter.negate&&e===2?!1:!s&&this.options.textFilter.negate&&e===2?!0:e}filterRelatedInformation(i,e){if(!this.options.textFilter.text)return!0;let t=sE._filter(this.options.textFilter.text,He(i.raw.resource)),o=sE._messageFilter(this.options.textFilter.text,jo(i.raw.message)),n=t||o;return n&&!this.options.textFilter.negate?{visibility:!0,data:{type:2,uriMatches:t||[],messageMatches:o||[]}}:n&&this.options.textFilter.negate&&e===2?!1:!n&&this.options.textFilter.negate&&e===2?!0:e}},zlt=class extends x{constructor(e,t,o,n,r){super();this.marker=e;this.modelService=t;this.instantiationService=o;this.editorService=n;this.languageFeaturesService=r;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this.modelPromise=null;this.codeActionsPromise=null;this._multiline=!0;this._quickFixAction=null;this._register(Z(()=>{this.modelPromise&&this.modelPromise.cancel(),this.codeActionsPromise&&this.codeActionsPromise.cancel()}))}get multiline(){return this._multiline}set multiline(e){this._multiline!==e&&(this._multiline=e,this._onDidChange.fire())}get quickFixAction(){return this._quickFixAction||(this._quickFixAction=this._register(this.instantiationService.createInstance(Uve,this.marker))),this._quickFixAction}showLightBulb(){this.setQuickFixes(!0)}async setQuickFixes(e){let t=await this.getCodeActions(e);this.quickFixAction.quickFixes=t?this.toActions(t):[],this.quickFixAction.autoFixable(!!t&&t.hasAutoFix)}getCodeActions(e){return this.codeActionsPromise!==null?this.codeActionsPromise:this.getModel(e).then(t=>t?(this.codeActionsPromise||(this.codeActionsPromise=Ln(o=>hR(this.languageFeaturesService.codeActionProvider,t,new z(this.marker.range.startLineNumber,this.marker.range.startColumn,this.marker.range.endLineNumber,this.marker.range.endColumn),{type:1,triggerAction:"problems view",filter:{include:xr.QuickFix}},Mm.None,o).then(n=>this._register(n)))),this.codeActionsPromise):null)}toActions(e){return e.validActions.map(t=>ii({id:t.action.command?t.action.command.id:t.action.title,label:t.action.title,run:async()=>(await this.openFileAtMarker(this.marker),await this.instantiationService.invokeFunction(i5,t,"fromProblemsView"))}))}openFileAtMarker(e){let{resource:t,selection:o}={resource:e.resource,selection:e.range};return this.editorService.openEditor({resource:t,options:{selection:o,preserveFocus:!0,pinned:!1,revealIfVisible:!0}},jn).then(()=>{})}getModel(e){let t=this.modelService.getModel(this.marker.resource);return t?Promise.resolve(t):e?(this.modelPromise||(this.modelPromise=Ln(o=>new Promise(n=>{this._register(this.modelService.onModelAdded(r=>{Qe(r.uri,this.marker.resource)&&n(r)}))}))),this.modelPromise):Promise.resolve(null)}};zlt=I([m(1,Tt),m(2,F),m(3,ee),m(4,Qt)],zlt);var WUe=class extends x{constructor(e=!0,t="tree",o,n){super();this.contextKeyService=o;this.instantiationService=n;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._onDidChangeViewMode=this._register(new E);this.onDidChangeViewMode=this._onDidChangeViewMode.event;this.markersViewStates=new Map;this.markersPerResource=new Map;this.bulkUpdate=!1;this.hoveredMarker=null;this.hoverDelayer=this._register(new Xo(300));this._multiline=!0;this._viewMode="tree";this._multiline=e,this._viewMode=t,this.viewModeContextKey=Ap.MarkersViewModeContextKey.bindTo(this.contextKeyService),this.viewModeContextKey.set(t)}add(e){if(!this.markersViewStates.has(e.id)){let t=this.instantiationService.createInstance(zlt,e),o=[t];t.multiline=this.multiline,t.onDidChange(()=>{this.bulkUpdate||this._onDidChange.fire(e)},this,o),this.markersViewStates.set(e.id,{viewModel:t,disposables:o});let n=this.markersPerResource.get(e.resource.toString())||[];n.push(e),this.markersPerResource.set(e.resource.toString(),n)}}remove(e){let t=this.markersPerResource.get(e.toString())||[];for(let o of t){let n=this.markersViewStates.get(o.id);n&&Be(n.disposables),this.markersViewStates.delete(o.id),this.hoveredMarker===o&&(this.hoveredMarker=null)}this.markersPerResource.delete(e.toString())}getViewModel(e){let t=this.markersViewStates.get(e.id);return t?t.viewModel:null}onMarkerMouseHover(e){this.hoveredMarker=e,this.hoverDelayer.trigger(()=>{if(this.hoveredMarker){let t=this.getViewModel(this.hoveredMarker);t&&t.showLightBulb()}})}onMarkerMouseLeave(e){this.hoveredMarker===e&&(this.hoveredMarker=null)}get multiline(){return this._multiline}set multiline(e){let t=!1;this._multiline!==e&&(this._multiline=e,t=!0),this.bulkUpdate=!0,this.markersViewStates.forEach(({viewModel:o})=>{o.multiline!==e&&(o.multiline=e,t=!0)}),this.bulkUpdate=!1,t&&this._onDidChange.fire(void 0)}get viewMode(){return this._viewMode}set viewMode(e){this._viewMode!==e&&(this._viewMode=e,this._onDidChangeViewMode.fire(e),this.viewModeContextKey.set(e))}dispose(){this.markersViewStates.forEach(({disposables:e})=>Be(e)),this.markersViewStates.clear(),this.markersPerResource.clear(),super.dispose()}};WUe=I([m(2,X),m(3,F)],WUe);function o_o(a){return vt.map(a.markers,i=>{let e=vt.from(i.relatedInformation),t=vt.map(e,o=>({element:o}));return{element:i,children:t}})}var VUe=class extends o0{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){let S=new Al(Rr.MARKERS_VIEW_STORAGE_ID,g),y=S.getMemento(1,1);super({...e,filterOptions:{ariaLabel:Np.MARKERS_PANEL_FILTER_ARIA_LABEL,placeholder:Np.MARKERS_PANEL_FILTER_PLACEHOLDER,focusContextKey:Ap.MarkerViewFilterFocusContextKey.key,text:y.filter||"",history:y.filterHistory||[]}},h,u,r,l,o,t,f,v,b);this.editorService=n;this.markerService=s;this.workspaceContextService=c;this.uriIdentityService=p;this.lastSelectedRelativeTop=0;this.currentActiveResource=null;this.onVisibleDisposables=this._register(new N);this.widgetDisposables=this._register(new N);this.currentHeight=0;this.currentWidth=0;this.cachedFilterStats=void 0;this.currentResourceGotAddedToMarkersData=!1;this.onDidChangeVisibility=this.onDidChangeBodyVisibility;this.memento=S,this.panelState=y,this.markersModel=this._register(t.createInstance(H4t)),this.markersViewModel=this._register(t.createInstance(WUe,this.panelState.multiline,this.panelState.viewMode??this.getDefaultViewMode())),this._register(this.onDidChangeVisibility(w=>this.onDidChangeMarkersViewVisibility(w))),this._register(this.markersViewModel.onDidChangeViewMode(w=>this.onDidChangeViewMode())),this.widgetAccessibilityProvider=t.createInstance(NUe),this.widgetIdentityProvider={getId(w){return w.id}},this.setCurrentActiveEditor(),this.filter=new j4t(sE.EMPTY(p)),this.rangeHighlightDecorations=this._register(this.instantiationService.createInstance($0)),this.filters=this._register(new K4t({filterHistory:this.panelState.filterHistory||[],showErrors:this.panelState.showErrors!==!1,showWarnings:this.panelState.showWarnings!==!1,showInfos:this.panelState.showInfos!==!1,excludedFiles:!!this.panelState.useFilesExclude,activeFile:!!this.panelState.activeFile},this.contextKeyService)),this._register(this.configurationService.onDidChangeConfiguration(w=>{this.filters.excludedFiles&&w.affectsConfiguration("files.exclude")&&this.updateFilter()}))}render(){super.render(),this._register(bT({name:"markersView",focusNotifiers:[this,this.filterWidget],focusNextWidget:()=>{this.filterWidget.hasFocus()&&this.focus()},focusPreviousWidget:()=>{this.filterWidget.hasFocus()||this.focusFilter()}}))}renderBody(e){super.renderBody(e),e.classList.add("markers-panel"),this._register(j(e,"keydown",o=>{let n=new gi(o);if(!this.keybindingService.mightProducePrintableCharacter(n))return;let r=this.keybindingService.softDispatch(n,n.target);r.kind===1||r.kind===2||this.focusFilter()}));let t=M(e,_(".markers-panel-container"));this.createArialLabelElement(t),this.createMessageBox(t),this.widgetContainer=M(t,_(".widget-container")),this.createWidget(this.widgetContainer),this.updateFilter(),this.renderContent()}getTitle(){return Np.MARKERS_PANEL_TITLE_PROBLEMS.value}layoutBodyContent(e=this.currentHeight,t=this.currentWidth){this.messageBoxContainer&&(this.messageBoxContainer.style.height=`${e}px`),this.widget.layout(e,t),this.currentHeight=e,this.currentWidth=t}focus(){super.focus(),!wa(this.widget.getHTMLElement())&&(this.hasNoProblems()?this.messageBoxContainer.focus():(this.widget.domFocus(),this.widget.setMarkerSelection()))}focusFilter(){this.filterWidget.focus()}updateBadge(e,t){this.filterWidget.updateBadge(e===t||e===0?void 0:d(11677,null,t,e))}checkMoreFilters(){this.filterWidget.checkMoreFilters(!this.filters.showErrors||!this.filters.showWarnings||!this.filters.showInfos||this.filters.excludedFiles||this.filters.activeFile)}clearFilterText(){this.filterWidget.setFilterText("")}showQuickFixes(e){let t=this.markersViewModel.getViewModel(e);t&&t.quickFixAction.run()}openFileAtElement(e,t,o,n){let{resource:r,selection:s}=e instanceof Oh?{resource:e.resource,selection:e.range}:e instanceof jW?{resource:e.raw.resource,selection:e.raw}:"marker"in e?{resource:e.marker.resource,selection:e.marker.range}:{resource:null,selection:null};return r&&s?(this.editorService.openEditor({resource:r,options:{selection:s,preserveFocus:t,pinned:n,revealIfVisible:!0}},o?In:jn).then(l=>{l&&t?this.rangeHighlightDecorations.highlightRange({resource:r,range:s},l.getControl()):this.rangeHighlightDecorations.removeHighlightRange()}),!0):(this.rangeHighlightDecorations.removeHighlightRange(),!1)}refreshPanel(e){if(this.isVisible()){let t=this.widget.getSelection().length>0;e?e instanceof Oh?this.widget.updateMarker(e):e.added.size||e.removed.size||this.filters.activeFile?this.resetWidget():this.widget.update([...e.updated]):this.resetWidget(),t&&this.widget.setMarkerSelection(),this.cachedFilterStats=void 0;let{total:o,filtered:n}=this.getFilterStats();this.toggleVisibility(o===0||n===0),this.renderMessage(),this.updateBadge(o,n),this.checkMoreFilters()}}onDidChangeViewState(e){this.refreshPanel(e)}resetWidget(){this.widget.reset(this.getResourceMarkers())}updateFilter(){this.filter.options=new sE(this.filterWidget.getFilterText(),this.getFilesExcludeExpressions(),this.filters.showWarnings,this.filters.showErrors,this.filters.showInfos,this.uriIdentityService),this.widget.filterMarkers(this.getResourceMarkers(),this.filter.options),this.cachedFilterStats=void 0;let{total:e,filtered:t}=this.getFilterStats();this.toggleVisibility(e===0||t===0),this.renderMessage(),this.updateBadge(e,t),this.checkMoreFilters()}getDefaultViewMode(){switch(this.configurationService.getValue("problems.defaultViewMode")){case"table":return"table";case"tree":return"tree";default:return"tree"}}getFilesExcludeExpressions(){if(!this.filters.excludedFiles)return[];let e=this.workspaceContextService.getWorkspace().folders;return e.length?e.map(t=>({root:t.uri,expression:this.getFilesExclude(t.uri)})):this.getFilesExclude()}getFilesExclude(e){return Ji(this.configurationService.getValue("files.exclude",{resource:e}))||{}}getResourceMarkers(){if(!this.filters.activeFile)return this.markersModel.resourceMarkers;let e=[];if(this.currentActiveResource){let t=this.markersModel.getResourceMarkers(this.currentActiveResource);t&&(e=[t])}return e}createMessageBox(e){this.messageBoxContainer=M(e,_(".message-box-container")),this.messageBoxContainer.setAttribute("aria-labelledby","markers-panel-arialabel")}createArialLabelElement(e){this.ariaLabelElement=M(e,_("")),this.ariaLabelElement.setAttribute("id","markers-panel-arialabel")}createWidget(e){this.widget=this.markersViewModel.viewMode==="table"?this.createTable(e):this.createTree(e),this.widgetDisposables.add(this.widget);let t=Ap.MarkerFocusContextKey.bindTo(this.widget.contextKeyService),o=Ap.RelatedInformationFocusContextKey.bindTo(this.widget.contextKeyService);this.widgetDisposables.add(this.widget.onDidChangeFocus(n=>{t.set(n.elements.some(r=>r instanceof Oh)),o.set(n.elements.some(r=>r instanceof jW))})),this.widgetDisposables.add(U.debounce(this.widget.onDidOpen,(n,r)=>r,75,!0)(n=>{this.openFileAtElement(n.element,!!n.editorOptions.preserveFocus,n.sideBySide,!!n.editorOptions.pinned)})),this.widgetDisposables.add(U.any(this.widget.onDidChangeSelection,this.widget.onDidChangeFocus)(()=>{let n=[...this.widget.getSelection(),...this.widget.getFocus()];for(let r of n)r instanceof Oh&&this.markersViewModel.getViewModel(r)?.showLightBulb()})),this.widgetDisposables.add(this.widget.onContextMenu(this.onContextMenu,this)),this.widgetDisposables.add(this.widget.onDidChangeSelection(this.onSelected,this))}createTable(e){return this.instantiationService.createInstance(AUe,M(e,_(".markers-table-container")),this.markersViewModel,this.getResourceMarkers(),this.filter.options,{accessibilityProvider:this.widgetAccessibilityProvider,dnd:this.instantiationService.createInstance(Y4,o=>o instanceof ON?ZL(o.resource,o.range):null),horizontalScrolling:!1,identityProvider:this.widgetIdentityProvider,multipleSelectionSupport:!0,selectionNavigation:!0})}createTree(e){let t=new Bh,o=this.instantiationService.createInstance(Nl,this),n=new Klt(this.markersViewModel),r=[this.instantiationService.createInstance($4t,o,t.event),this.instantiationService.createInstance(OUe,this.markersViewModel),this.instantiationService.createInstance(FUe)],s=this.instantiationService.createInstance(Glt,"MarkersView",M(e,_(".tree-container.show-file-icons")),n,r,{filter:this.filter,accessibilityProvider:this.widgetAccessibilityProvider,identityProvider:this.widgetIdentityProvider,dnd:this.instantiationService.createInstance(qlt),expandOnlyOnTwistieClick:l=>l instanceof Oh&&l.relatedInformation.length>0,overrideStyles:this.getLocationBasedColors().listOverrideStyles,selectionNavigation:!0,multipleSelectionSupport:!0});return t.input=s.onDidChangeRenderNodeCount,s}collapseAll(){this.widget.collapseMarkers()}setMultiline(e){this.markersViewModel.multiline=e}setViewMode(e){this.markersViewModel.viewMode=e}onDidChangeMarkersViewVisibility(e){if(this.onVisibleDisposables.clear(),e){for(let t of this.reInitialize())this.onVisibleDisposables.add(t);this.refreshPanel()}}reInitialize(){let e=[],t=o=>this.markerService.read({resource:o,severities:14});return this.markersModel.setResourceMarkers(Jg(t(),U4t).map(o=>[o[0].resource,o])),e.push(U.debounce(this.markerService.onMarkerChanged,(o,n)=>(o=o||new gt,n.forEach(r=>o.set(r,r)),o),64)(o=>{this.markersModel.setResourceMarkers([...o.values()].map(n=>[n,t(n)]))})),e.push(U.any(this.markersModel.onDidChange,this.editorService.onDidActiveEditorChange)(o=>{o?this.onDidChangeModel(o):this.onActiveEditorChanged()})),e.push(Z(()=>this.markersModel.reset())),this.markersModel.resourceMarkers.forEach(o=>o.markers.forEach(n=>this.markersViewModel.add(n))),e.push(this.markersViewModel.onDidChange(o=>this.onDidChangeViewState(o))),e.push(Z(()=>this.markersModel.resourceMarkers.forEach(o=>this.markersViewModel.remove(o.resource)))),e.push(this.filters.onDidChange(o=>{o.activeFile?this.refreshPanel():(o.excludedFiles||o.showWarnings||o.showErrors||o.showInfos)&&this.updateFilter()})),e.push(this.filterWidget.onDidChangeFilterText(o=>this.updateFilter())),e.push(Z(()=>{this.cachedFilterStats=void 0})),e.push(Z(()=>this.rangeHighlightDecorations.removeHighlightRange())),e}onDidChangeModel(e){let t=[...e.added,...e.removed,...e.updated],o=[];for(let{resource:n}of t){this.markersViewModel.remove(n);let r=this.markersModel.getResourceMarkers(n);if(r)for(let s of r.markers)this.markersViewModel.add(s);o.push(n)}this.currentResourceGotAddedToMarkersData=this.currentResourceGotAddedToMarkersData||this.isCurrentResourceGotAddedToMarkersData(o),this.refreshPanel(e),this.updateRangeHighlights(),this.currentResourceGotAddedToMarkersData&&(this.autoReveal(),this.currentResourceGotAddedToMarkersData=!1)}onDidChangeViewMode(){this.widgetContainer&&this.widget&&(this.widgetContainer.textContent="",this.widgetDisposables.clear());let e=new Set;for(let o of this.widget.getSelection())o instanceof YM?o.markers.forEach(n=>e.add(n)):(o instanceof Oh||o instanceof ON)&&e.add(o);let t=new Set;for(let o of this.widget.getFocus())(o instanceof Oh||o instanceof ON)&&t.add(o);this.createWidget(this.widgetContainer),this.refreshPanel(),e.size>0&&(this.widget.setMarkerSelection(Array.from(e),Array.from(t)),this.widget.domFocus())}isCurrentResourceGotAddedToMarkersData(e){let t=this.currentActiveResource;return!t||this.getResourceForCurrentActiveResource()?!1:e.some(n=>n.toString()===t.toString())}onActiveEditorChanged(){this.setCurrentActiveEditor(),this.filters.activeFile&&this.refreshPanel(),this.autoReveal()}setCurrentActiveEditor(){let e=this.editorService.activeEditor;this.currentActiveResource=e?po.getOriginalUri(e,{supportSideBySide:1})??null:null}onSelected(){let e=this.widget.getSelection();e&&e.length>0&&(this.lastSelectedRelativeTop=this.widget.getRelativeTop(e[0])||0)}hasNoProblems(){let{total:e,filtered:t}=this.getFilterStats();return e===0||t===0}renderContent(){this.cachedFilterStats=void 0,this.resetWidget(),this.toggleVisibility(this.hasNoProblems()),this.renderMessage()}renderMessage(){if(!this.messageBoxContainer||!this.ariaLabelElement)return;Rt(this.messageBoxContainer);let{total:e,filtered:t}=this.getFilterStats();t===0?(this.messageBoxContainer.style.display="block",this.messageBoxContainer.setAttribute("tabIndex","0"),this.filters.activeFile?this.renderFilterMessageForActiveFile(this.messageBoxContainer):e>0?this.renderFilteredByFilterMessage(this.messageBoxContainer):this.renderNoProblemsMessage(this.messageBoxContainer)):(this.messageBoxContainer.style.display="none",t===e?this.setAriaLabel(d(11675,null,e)):this.setAriaLabel(d(11676,null,t,e)),this.messageBoxContainer.removeAttribute("tabIndex"))}renderFilterMessageForActiveFile(e){this.currentActiveResource&&this.markersModel.getResourceMarkers(this.currentActiveResource)?this.renderFilteredByFilterMessage(e):this.renderNoProblemsMessageForActiveFile(e)}renderFilteredByFilterMessage(e){let t=M(e,_("span"));t.textContent=Np.MARKERS_PANEL_NO_PROBLEMS_FILTERS;let o=M(e,_("a.messageAction"));o.textContent=d(11674,null),o.setAttribute("tabIndex","0");let n=M(e,_("span"));n.textContent=".",Jo(o,re.CLICK,()=>this.clearFilters()),Jo(o,re.KEY_DOWN,r=>{(r.equals(3)||r.equals(10))&&(this.clearFilters(),r.stopPropagation())}),this.setAriaLabel(Np.MARKERS_PANEL_NO_PROBLEMS_FILTERS)}renderNoProblemsMessageForActiveFile(e){let t=M(e,_("span"));t.textContent=Np.MARKERS_PANEL_NO_PROBLEMS_ACTIVE_FILE_BUILT,this.setAriaLabel(Np.MARKERS_PANEL_NO_PROBLEMS_ACTIVE_FILE_BUILT)}renderNoProblemsMessage(e){let t=M(e,_("span"));t.textContent=Np.MARKERS_PANEL_NO_PROBLEMS_BUILT,this.setAriaLabel(Np.MARKERS_PANEL_NO_PROBLEMS_BUILT)}setAriaLabel(e){this.widget.setAriaLabel(e),this.ariaLabelElement.setAttribute("aria-label",e)}clearFilters(){this.filterWidget.setFilterText(""),this.filters.excludedFiles=!1,this.filters.showErrors=!0,this.filters.showWarnings=!0,this.filters.showInfos=!0}autoReveal(e=!1){if(this.filters.activeFile)return;let t=this.configurationService.getValue("problems.autoReveal");if(typeof t=="boolean"&&t){let o=this.getResourceForCurrentActiveResource();this.widget.revealMarkers(o,e,this.lastSelectedRelativeTop)}}getResourceForCurrentActiveResource(){return this.currentActiveResource?this.markersModel.getResourceMarkers(this.currentActiveResource):null}updateRangeHighlights(){this.rangeHighlightDecorations.removeHighlightRange(),wa(this.widget.getHTMLElement())&&this.highlightCurrentSelectedMarkerRange()}highlightCurrentSelectedMarkerRange(){let e=this.widget.getSelection()??[];if(e.length!==1)return;let t=e[0];t instanceof Oh&&this.rangeHighlightDecorations.highlightRange(t)}onContextMenu(e){let t=e.element;t&&(e.browserEvent.preventDefault(),e.browserEvent.stopPropagation(),this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,menuId:D.ProblemsPanelContext,contextKeyService:this.widget.contextKeyService,getActions:()=>this.getMenuActions(t),getActionViewItem:o=>{let n=this.keybindingService.lookupKeybinding(o.id);if(n)return new hs(o,o,{label:!0,keybinding:n.getLabel()})},onHide:o=>{o&&this.widget.domFocus()}}))}getMenuActions(e){let t=[];if(e instanceof Oh){let o=this.markersViewModel.getViewModel(e);if(o){let n=o.quickFixAction.quickFixes;n.length&&(t.push(...n),t.push(new ri))}}return t}getFocusElement(){return this.widget.getFocus()[0]??void 0}getFocusedSelectedElements(){let e=this.getFocusElement();if(!e)return null;let t=this.widget.getSelection();if(t.includes(e)){let o=[];for(let n of t)n&&o.push(n);return o}else return[e]}getAllResourceMarkers(){return this.markersModel.resourceMarkers}getFilterStats(){return this.cachedFilterStats||(this.cachedFilterStats={total:this.markersModel.total,filtered:this.widget?.getVisibleItemCount()??0}),this.cachedFilterStats}toggleVisibility(e){this.widget.toggleVisibility(e),this.layoutBodyContent()}saveState(){this.panelState.filter=this.filterWidget.getFilterText(),this.panelState.filterHistory=this.filters.filterHistory,this.panelState.showErrors=this.filters.showErrors,this.panelState.showWarnings=this.filters.showWarnings,this.panelState.showInfos=this.filters.showInfos,this.panelState.useFilesExclude=this.filters.excludedFiles,this.panelState.activeFile=this.filters.activeFile,this.panelState.multiline=this.markersViewModel.multiline,this.panelState.viewMode=this.markersViewModel.viewMode,this.memento.saveMemento(),super.saveState()}dispose(){super.dispose()}};VUe=I([m(1,F),m(2,Bi),m(3,ee),m(4,B),m(5,oa),m(6,X),m(7,Pe),m(8,Xe),m(9,ht),m(10,_e),m(11,ce),m(12,Je),m(13,Le),m(14,nt)],VUe);var Glt=class extends Rg{constructor(e,t,o,n,r,s,l,c,u,p){super(e,t,o,n,r,s,l,c,p);this.container=t;this.visibilityContextKey=Ap.MarkersTreeVisibilityContextKey.bindTo(l)}collapseMarkers(){this.collapseAll(),this.setSelection([]),this.setFocus([]),this.getHTMLElement().focus(),this.focusFirst()}filterMarkers(){this.refilter()}getVisibleItemCount(){let e=0,t=this.getNode();for(let o of t.children)for(let n of o.children)o.visible&&n.visible&&e++;return e}isVisible(){return!this.container.classList.contains("hidden")}toggleVisibility(e){this.visibilityContextKey.set(!e),this.container.classList.toggle("hidden",e)}reset(e){this.setChildren(null,vt.map(e,t=>({element:t,children:o_o(t)})))}revealMarkers(e,t,o){e?this.hasElement(e)&&(!this.isCollapsed(e)&&this.hasSelectedMarkerFor(e)?(this.reveal(this.getSelection()[0],o),t&&this.setFocus(this.getSelection())):(this.expand(e),this.reveal(e,0),t&&(this.setFocus([e]),this.setSelection([e])))):t&&(this.setSelection([]),this.focusFirst())}setAriaLabel(e){this.ariaLabel=e}setMarkerSelection(e,t){if(this.isVisible()){if(e&&e.length>0)this.setSelection(e.map(o=>this.findMarkerNode(o))),t&&t.length>0?this.setFocus(t.map(o=>this.findMarkerNode(o))):this.setFocus([this.findMarkerNode(e[0])]),this.reveal(this.findMarkerNode(e[0]));else if(this.getSelection().length===0){let o=this.firstVisibleElement,n=o?o instanceof YM?o.markers[0]:o instanceof Oh?o:void 0:void 0;n&&(this.setSelection([n]),this.setFocus([n]),this.reveal(n))}}}update(e){for(let t of e)this.hasElement(t)&&(this.setChildren(t,o_o(t)),this.rerender(t))}updateMarker(e){this.rerender(e)}findMarkerNode(e){for(let t of this.getNode().children)for(let o of t.children)if(o.element instanceof Oh&&o.element.marker===e.marker)return o.element;return null}hasSelectedMarkerFor(e){let t=this.getSelection();return!!(t&&t.length>0&&t[0]instanceof Oh&&e.has(t[0].marker.resource))}dispose(){super.dispose()}layout(e,t){this.container.style.height=`${e}px`,super.layout(e,t)}};Glt=I([m(5,F),m(6,X),m(7,Io),m(8,Le),m(9,B)],Glt);var qlt=class extends Y4{constructor(i){super(e=>e instanceof ON?ZL(e.resource,e.range):e instanceof YM?e.resource:e instanceof Oh?ZL(e.resource,e.range):e instanceof jW?ZL(e.raw.resource,e.raw):null,i)}onWillDragElements(i,e){let t=i.map(o=>{if(o instanceof jW||o instanceof Oh)return o.marker;if(o instanceof YM)return{uri:o.resource}}).filter(lo);t.length&&o3i(t,e)}};qlt=I([m(0,F)],qlt);var $lt=class{constructor(i,e,t){this._markerService=i;this._labelService=e;this._editorService=t;this.type="pickerPick";this.label=d(11657,null);this.icon=R.error;this.ordinal=-100}isEnabled(i){return!!i.attachmentCapabilities.supportsProblemAttachments}asPicker(){return{placeholder:d(11658,null),picks:Spe(async(i,e)=>this.getPicksForQuery(i))}}getPicksForQuery(i){let e=this._markerService.read({severities:14}),t=Jg(e,(c,u)=>ar.compare(c.resource,u.resource)),o=po.getCanonicalUri(this._editorService.activeEditor),n=t.sort((c,u)=>{let p=c[0].resource,h=u[0].resource;if(o){let g=ar.isEqual(p,o),f=ar.isEqual(h,o);if(g&&!f)return-1;if(!g&&f)return 1}return ar.compare(p,h)}),r=new Set,s=[],l=0;for(let c of n){let u=c[0].resource,p=o&&ar.isEqual(u,o),h=this._labelService.getUriLabel(u,{relative:!0}),g=p?`${h} (current file)`:h;s.push({type:"separator",label:g});for(let f of c)l++,r.add(f.severity),s.push({label:f.message,description:d(11660,null,""+f.startLineNumber,""+f.startColumn),asAttachment(){return nA.toEntry(nA.fromMarker(f))}})}return s.unshift({label:d(11659,null),asAttachment(){return nA.toEntry({filterSeverity:2})}}),s}};$lt=I([m(0,oa),m(1,rt),m(2,ee)],$lt);var zve=class extends x{static{this.ID="workbench.contrib.chat.markerChatContextContribution"}constructor(i,e){super(),this._store.add(i.registerChatContextItem(e.createInstance($lt)))}};zve=I([m(0,DS),m(1,F)],zve);var Q4t=class{constructor(){this.type="help";this.priority=105;this.name="problemsFilter";this.when=Ap.MarkerViewFilterFocusContextKey}getProvider(i){return new mVi(i.get(_e))}},mVi=class extends x{constructor(e){super();this._keybindingService=e;this.id="problemsFilterHelp";this.verbositySettingKey="accessibility.verbosity.find";this.options={type:"help"}}provideContent(){let e=[];return e.push(d(11627,null)),e.push(d(11618,null)),e.push(""),e.push(d(11652,null)),e.push(d(11651,null)),e.push(""),e.push(d(11629,null)),e.push(d(11628,null)),e.push(""),e.push(d(11621,null)),e.push(d(11619,null)),e.push(d(11620,null)),e.push(""),e.push(d(11626,null)),e.push(d(11622,null)),e.push(d(11623,null)),e.push(d(11624,null)),e.push(d(11625,null)),e.push(""),e.push(d(11655,null)),e.push(d(11656,null)),e.push(d(11654,null)),e.push(d(11653,null)),e.push(""),e.push(d(11647,null)),e.push(d(11649,null)),e.push(d(11646,null)),e.push(d(11650,null)),e.push(d(11648,null)),e.push(d(11644,null)),e.push(d(11645,null)),e.push(""),e.push(d(11630,null)),e.push(d(11631,null)),e.push(d(11636,null)),e.push(d(11632,null)),e.push(d(11634,null,this._describeCommand("editor.action.marker.nextInFiles")||"F8")),e.push(d(11635,null,this._describeCommand("editor.action.marker.prevInFiles")||"Shift+F8")),e.push(d(11633,null)),e.push(""),e.push(d(11638,null,this._describeCommand("workbench.action.openSettings")||"Ctrl+,")),e.push(d(11640,null)),e.push(d(11642,null)),e.push(d(11637,null)),e.push(d(11643,null)),e.push(d(11641,null)),e.push(d(11639,null)),e.push(""),e.push(d(11617,null)),e.push(d(11616,null)),e.join(`
`)}_describeCommand(e){return this._keybindingService.lookupKeybinding(e)?.getAriaLabel()??void 0}onClose(){}};Ct.registerCommandAndKeybindingRule({id:Rr.MARKER_OPEN_ACTION_ID,weight:200,when:C.and(Ap.MarkerFocusContextKey),primary:3,mac:{primary:3,secondary:[2066]},handler:(a,i)=>{let e=a.get($t).getActiveViewWithId(Rr.MARKERS_VIEW_ID);e.openFileAtElement(e.getFocusElement(),!1,!1,!0)}});Ct.registerCommandAndKeybindingRule({id:Rr.MARKER_OPEN_SIDE_ACTION_ID,weight:200,when:C.and(Ap.MarkerFocusContextKey),primary:2051,mac:{primary:259},handler:(a,i)=>{let e=a.get($t).getActiveViewWithId(Rr.MARKERS_VIEW_ID);e.openFileAtElement(e.getFocusElement(),!1,!0,!0)}});Ct.registerCommandAndKeybindingRule({id:Rr.MARKER_SHOW_PANEL_ID,weight:200,when:void 0,primary:void 0,handler:async(a,i)=>{await a.get($t).openView(Rr.MARKERS_VIEW_ID)}});Ct.registerCommandAndKeybindingRule({id:Rr.MARKER_SHOW_QUICK_FIX,weight:200,when:Ap.MarkerFocusContextKey,primary:2137,handler:(a,i)=>{let e=a.get($t).getActiveViewWithId(Rr.MARKERS_VIEW_ID),t=e.getFocusElement();t instanceof Oh&&e.showQuickFixes(t)}});ne.as(Jt.Configuration).registerConfiguration({...WRt,properties:{"problems.autoReveal":{description:Np.PROBLEMS_PANEL_CONFIGURATION_AUTO_REVEAL,type:"boolean",default:!0},"problems.defaultViewMode":{description:Np.PROBLEMS_PANEL_CONFIGURATION_VIEW_MODE,type:"string",default:"tree",enum:["table","tree"]},"problems.showCurrentInStatus":{description:Np.PROBLEMS_PANEL_CONFIGURATION_SHOW_CURRENT_STATUS,type:"boolean",default:!1},"problems.sortOrder":{description:Np.PROBLEMS_PANEL_CONFIGURATION_COMPARE_ORDER,type:"string",default:"severity",enum:["severity","position"],enumDescriptions:[Np.PROBLEMS_PANEL_CONFIGURATION_COMPARE_ORDER_SEVERITY,Np.PROBLEMS_PANEL_CONFIGURATION_COMPARE_ORDER_POSITION]}}});var n_o=Ae("markers-view-icon",R.warning,d(11589,null)),ihn=ne.as(Mn.ViewContainersRegistry).registerViewContainer({id:Rr.MARKERS_CONTAINER_ID,title:Np.MARKERS_PANEL_TITLE_PROBLEMS,icon:n_o,hideIfEmpty:!0,order:0,ctorDescriptor:new Ft(Dc,[Rr.MARKERS_CONTAINER_ID,{mergeViewWithContainerWhenSingleView:!0}]),storageId:Rr.MARKERS_VIEW_STORAGE_ID},1,{doNotRegisterOpenCommand:!0});ne.as(Mn.ViewsRegistry).registerViews([{id:Rr.MARKERS_VIEW_ID,containerIcon:n_o,name:Np.MARKERS_PANEL_TITLE_PROBLEMS,canToggleVisibility:!0,canMoveView:!0,ctorDescriptor:new Ft(VUe),openCommandActionDescriptor:{id:"workbench.actions.view.problems",mnemonicTitle:d(11590,null),keybindings:{primary:3115},order:0}}],ihn);var r_o=ne.as(Qi.Workbench);W(class extends Yn{constructor(){super({id:`workbench.actions.table.${Rr.MARKERS_VIEW_ID}.viewAsTree`,title:d(11614,null),metadata:{description:L(11615,"Show the problems view as a tree.")},menu:{id:D.ViewTitle,when:C.and(C.equals("view",Rr.MARKERS_VIEW_ID),Ap.MarkersViewModeContextKey.isEqualTo("table")),group:"navigation",order:3},icon:R.listTree,viewId:Rr.MARKERS_VIEW_ID})}async runInView(a,i){i.setViewMode("tree")}});W(class extends Yn{constructor(){super({id:`workbench.actions.table.${Rr.MARKERS_VIEW_ID}.viewAsTable`,title:d(11612,null),metadata:{description:L(11613,"Show the problems view as a table.")},menu:{id:D.ViewTitle,when:C.and(C.equals("view",Rr.MARKERS_VIEW_ID),Ap.MarkersViewModeContextKey.isEqualTo("tree")),group:"navigation",order:3},icon:R.listFlat,viewId:Rr.MARKERS_VIEW_ID})}async runInView(a,i){i.setViewMode("table")}});W(class extends Yn{constructor(){super({id:`workbench.actions.${Rr.MARKERS_VIEW_ID}.toggleErrors`,title:d(11594,null),metadata:{description:L(11604,"Show or hide errors in the problems view.")},category:d(11592,null),toggled:Ap.ShowErrorsFilterContextKey,menu:{id:ex,group:"1_filter",when:C.equals("view",Rr.MARKERS_VIEW_ID),order:1},viewId:Rr.MARKERS_VIEW_ID})}async runInView(a,i){i.filters.showErrors=!i.filters.showErrors}});W(class extends Yn{constructor(){super({id:`workbench.actions.${Rr.MARKERS_VIEW_ID}.toggleWarnings`,title:d(11599,null),metadata:{description:L(11607,"Show or hide warnings in the problems view.")},category:d(11592,null),toggled:Ap.ShowWarningsFilterContextKey,menu:{id:ex,group:"1_filter",when:C.equals("view",Rr.MARKERS_VIEW_ID),order:2},viewId:Rr.MARKERS_VIEW_ID})}async runInView(a,i){i.filters.showWarnings=!i.filters.showWarnings}});W(class extends Yn{constructor(){super({id:`workbench.actions.${Rr.MARKERS_VIEW_ID}.toggleInfos`,title:d(11596,null),category:d(11592,null),toggled:Ap.ShowInfoFilterContextKey,metadata:{description:L(11606,"Show or hide infos in the problems view.")},menu:{id:ex,group:"1_filter",when:C.equals("view",Rr.MARKERS_VIEW_ID),order:3},viewId:Rr.MARKERS_VIEW_ID})}async runInView(a,i){i.filters.showInfos=!i.filters.showInfos}});W(class extends Yn{constructor(){super({id:`workbench.actions.${Rr.MARKERS_VIEW_ID}.toggleActiveFile`,title:d(11593,null),metadata:{description:L(11603,"Show or hide problems (errors, warnings, info) only from the active file in the problems view.")},category:d(11592,null),toggled:Ap.ShowActiveFileFilterContextKey,menu:{id:ex,group:"2_filter",when:C.equals("view",Rr.MARKERS_VIEW_ID),order:1},viewId:Rr.MARKERS_VIEW_ID})}async runInView(a,i){i.filters.activeFile=!i.filters.activeFile}});W(class extends Yn{constructor(){super({id:`workbench.actions.${Rr.MARKERS_VIEW_ID}.toggleExcludedFiles`,title:d(11595,null),metadata:{description:L(11605,"Show or hide excluded files in the problems view.")},category:d(11592,null),toggled:Ap.ShowExcludedFilesFilterContextKey.negate(),menu:{id:ex,group:"2_filter",when:C.equals("view",Rr.MARKERS_VIEW_ID),order:2},viewId:Rr.MARKERS_VIEW_ID})}async runInView(a,i){i.filters.excludedFiles=!i.filters.excludedFiles}});W(class extends K{constructor(){super({id:"workbench.action.problems.focus",title:Np.MARKERS_PANEL_SHOW_LABEL,category:Ve.View,f1:!0})}async run(a){a.get($t).openView(Rr.MARKERS_VIEW_ID,!0)}});var Y4t=class extends Yn{getSelectedMarkers(i){let e=i.getFocusedSelectedElements()||i.getAllResourceMarkers(),t=[],o=n=>{t.includes(n)||t.push(n)};for(let n of e)n instanceof YM?n.markers.forEach(o):n instanceof Oh&&o(n);return t}};W(class extends Y4t{constructor(){let a=C.and(ql.isEqualTo(Rr.MARKERS_VIEW_ID),Ap.MarkersTreeVisibilityContextKey,Ap.RelatedInformationFocusContextKey.toNegated());super({id:Rr.MARKER_COPY_ACTION_ID,title:L(11584,"Copy"),menu:{id:D.ProblemsPanelContext,when:a,group:"navigation"},keybinding:{weight:200,primary:2081,when:a},viewId:Rr.MARKERS_VIEW_ID})}async runInView(a,i){let e=a.get(Fi),t=this.getSelectedMarkers(i);t.length&&await e.writeText(`[${t}]`)}});W(class extends Y4t{constructor(){super({id:Rr.MARKER_COPY_MESSAGE_ACTION_ID,title:L(11585,"Copy Message"),menu:{id:D.ProblemsPanelContext,when:Ap.MarkerFocusContextKey,group:"navigation"},viewId:Rr.MARKERS_VIEW_ID})}async runInView(a,i){let e=a.get(Fi),t=this.getSelectedMarkers(i);t.length&&await e.writeText(t.map(o=>o.marker.message).join(`
`))}});W(class extends Yn{constructor(){super({id:Rr.RELATED_INFORMATION_COPY_MESSAGE_ACTION_ID,title:L(11585,"Copy Message"),menu:{id:D.ProblemsPanelContext,when:Ap.RelatedInformationFocusContextKey,group:"navigation"},viewId:Rr.MARKERS_VIEW_ID})}async runInView(a,i){let e=a.get(Fi),t=i.getFocusElement();t instanceof jW&&await e.writeText(t.raw.message)}});W(class extends Yn{constructor(){super({id:Rr.FOCUS_PROBLEMS_FROM_FILTER,title:d(11587,null),keybinding:{when:Ap.MarkerViewFilterFocusContextKey,weight:200,primary:2066},viewId:Rr.MARKERS_VIEW_ID})}async runInView(a,i){i.focus()}});W(class extends Yn{constructor(){super({id:Rr.MARKERS_VIEW_FOCUS_FILTER,title:d(11586,null),keybinding:{when:ql.isEqualTo(Rr.MARKERS_VIEW_ID),weight:200,primary:2084},viewId:Rr.MARKERS_VIEW_ID})}async runInView(a,i){i.focusFilter()}});W(class extends Yn{constructor(){super({id:Rr.MARKERS_VIEW_SHOW_MULTILINE_MESSAGE,title:L(11597,"Show message in multiple lines"),category:d(11592,null),menu:{id:D.CommandPalette,when:C.has(R6e(Rr.MARKERS_VIEW_ID))},viewId:Rr.MARKERS_VIEW_ID})}async runInView(a,i){i.setMultiline(!0)}});W(class extends Yn{constructor(){super({id:Rr.MARKERS_VIEW_SHOW_SINGLELINE_MESSAGE,title:L(11598,"Show message in single line"),category:d(11592,null),menu:{id:D.CommandPalette,when:C.has(R6e(Rr.MARKERS_VIEW_ID))},viewId:Rr.MARKERS_VIEW_ID})}async runInView(a,i){i.setMultiline(!1)}});W(class extends Yn{constructor(){super({id:Rr.MARKERS_VIEW_CLEAR_FILTER_TEXT,title:d(11582,null),category:d(11592,null),keybinding:{when:Ap.MarkerViewFilterFocusContextKey,weight:200,primary:9},viewId:Rr.MARKERS_VIEW_ID})}async runInView(a,i){i.clearFilterText()}});W(class extends Yn{constructor(){super({id:`workbench.actions.treeView.${Rr.MARKERS_VIEW_ID}.collapseAll`,title:d(11583,null),menu:{id:D.ViewTitle,when:C.and(C.equals("view",Rr.MARKERS_VIEW_ID),Ap.MarkersViewModeContextKey.isEqualTo("tree")),group:"navigation",order:2},icon:R.collapseAll,viewId:Rr.MARKERS_VIEW_ID})}async runInView(a,i){return i.collapseAll()}});W(class extends K{constructor(){super({id:Rr.TOGGLE_MARKERS_VIEW_ACTION_ID,title:Np.MARKERS_PANEL_TOGGLE_LABEL})}async run(a){let i=a.get($t);i.isViewVisible(Rr.MARKERS_VIEW_ID)?i.closeView(Rr.MARKERS_VIEW_ID):i.openView(Rr.MARKERS_VIEW_ID,!0)}});var jlt=class extends x{constructor(e,t,o){super();this.markerService=e;this.statusbarService=t;this.configurationService=o;this.markersStatusItem=this._register(this.statusbarService.addEntry(this.getMarkersItem(),"status.problems",0,50));let n=()=>{this.markersStatusItemOff=this.statusbarService.addEntry(this.getMarkersItemTurnedOff(),"status.problemsVisibility",0,49)},r=this.configurationService.getValue("problems.visibility");r||n(),this._register(this.markerService.onMarkerChanged(()=>{this.markersStatusItem.update(this.getMarkersItem())})),this._register(this.configurationService.onDidChangeConfiguration(s=>{s.affectsConfiguration("problems.visibility")&&(this.markersStatusItem.update(this.getMarkersItem()),r=this.configurationService.getValue("problems.visibility"),!r&&!this.markersStatusItemOff?n():r&&this.markersStatusItemOff&&(this.markersStatusItemOff.dispose(),this.markersStatusItemOff=void 0))}))}getMarkersItem(){let e=this.markerService.getStatistics(),t=this.getMarkersTooltip(e);return{name:d(11600,null),text:this.getMarkersText(e),ariaLabel:t,tooltip:t,command:"workbench.actions.view.toggleProblems"}}getMarkersItemTurnedOff(){this.statusbarService.updateEntryVisibility("status.problemsVisibility",!0);let e="workbench.action.openSettings",t="@id:problems.visibility",o=d(11602,null);return{name:d(11601,null),text:"$(whole-word)",ariaLabel:o,tooltip:o,kind:"warning",command:{title:e,arguments:[t],id:e}}}getMarkersTooltip(e){let t=s=>d(11608,null,s),o=s=>d(11611,null,s),n=s=>d(11609,null,s),r=[];return e.errors>0&&r.push(t(e.errors)),e.warnings>0&&r.push(o(e.warnings)),e.infos>0&&r.push(n(e.infos)),r.length===0?d(11591,null):r.join(", ")}getMarkersText(e){let t=[];return t.push("$(error) "+this.packNumber(e.errors)),t.push("$(warning) "+this.packNumber(e.warnings)),e.infos>0&&t.push("$(info) "+this.packNumber(e.infos)),t.join(" ")}packNumber(e){let t=d(11588,null);return e>9999?t:e>999?e.toString().charAt(0)+"K":e.toString()}};jlt=I([m(0,oa),m(1,kr),m(2,B)],jlt);r_o.registerWorkbenchContribution(jlt,3);It(zve.ID,zve,St.AfterRestored);var Qlt=class extends x{constructor(e,t){super();this.activityService=e;this.markerService=t;this.activity=this._register(new me);this._register(this.markerService.onMarkerChanged(()=>this.updateBadge())),this.updateBadge()}updateBadge(){let{errors:e,warnings:t,infos:o}=this.markerService.getStatistics(),n=e+t+o;if(n>0){let r=d(11610,null,n);this.activity.value=this.activityService.showViewActivity(Rr.MARKERS_VIEW_ID,{badge:new Rd(n,()=>r)})}else this.activity.value=void 0}};Qlt=I([m(0,Sl),m(1,oa)],Qlt);r_o.registerWorkbenchContribution(Qlt,3);ga.register(new Q4t);var ohn=Ae("process-explorer-editor-label-icon",R.serverProcess,d(13305,null)),QW=class a extends ls{constructor(){super(...arguments);this.resource=a.RESOURCE}static{this.ID="workbench.editor.processExplorer"}static{this.RESOURCE=A.from({scheme:"process-explorer",path:"default"})}static get instance(){return(!a._instance||a._instance.isDisposed())&&(a._instance=new a),a._instance}get typeId(){return a.ID}get editorId(){return a.ID}get capabilities(){return 10}getName(){return d(13306,null)}getIcon(){return ohn}matches(e){return super.matches(e)?!0:e instanceof a}};var BUe=class{static{this.ID="workbench.contrib.processExplorerEditor"}constructor(i,e){i.registerEditor(`${QW.RESOURCE.scheme}:**/**`,{id:QW.ID,label:d(13294,null),priority:"exclusive"},{singlePerResource:!0,canSupportResource:t=>t.scheme===QW.RESOURCE.scheme},{createEditorInput:()=>({editor:e.createInstance(QW),options:{pinned:!0}})})}};BUe=I([m(0,Ka),m(1,F)],BUe);It(BUe.ID,BUe,St.BlockStartup);var hVi=class{canSerialize(i){return!0}serialize(i){return""}deserialize(i){return QW.instance}};ne.as(qo.EditorFactory).registerEditorSerializer(QW.ID,hVi);var s_o=C.or(Fu.negate(),yb.notEqualsTo("")),X4t=class a extends K{static{this.ID="workbench.action.openProcessExplorer"}static{this.STATE_KEY="workbench.processExplorerWindowState"}static{this.DEFAULT_STATE={bounds:{width:800,height:500}}}constructor(){super({id:a.ID,title:L(13293,"Open Process Explorer"),category:Ve.Developer,precondition:s_o,f1:!0})}async run(i){let e=i.get(ee),t=i.get(wt),o=i.get(OD),n=i.get(ce),r=await e.openEditor({resource:QW.RESOURCE,options:{pinned:!0,revealIfOpened:!0,auxiliary:{...this.loadState(n),compact:!0,alwaysOnTop:!0}}},Mg);if(r){let s=r.input?.onWillDispose(()=>{s?.dispose(),this.saveState(r.group.id,n,t,o)})}}loadState(i){let e=i.get(a.STATE_KEY,-1);if(!e)return a.DEFAULT_STATE;try{return JSON.parse(e)}catch{return a.DEFAULT_STATE}}saveState(i,e,t,o){let n=o.getWindow(t.getPart(i).windowId);if(!n)return;let r=n.createState().bounds;r&&e.store(a.STATE_KEY,JSON.stringify({bounds:r}),-1,1)}};W(X4t);ve.appendMenuItem(D.MenubarHelpMenu,{group:"5_tools",command:{id:X4t.ID,title:d(13292,null)},when:s_o,order:2});var cpv=te("mergeEditor.change.background","#9bb95533",d(12207,null)),dpv=te("mergeEditor.change.word.background",{dark:"#9ccc2c33",light:"#9ccc2c66",hcDark:"#9ccc2c33",hcLight:"#9ccc2c66"},d(12208,null)),upv=te("mergeEditor.changeBase.background",{dark:"#4B1818FF",light:"#FFCCCCFF",hcDark:"#4B1818FF",hcLight:"#FFCCCCFF"},d(12209,null)),ppv=te("mergeEditor.changeBase.word.background",{dark:"#6F1313FF",light:"#FFA3A3FF",hcDark:"#6F1313FF",hcLight:"#FFA3A3FF"},d(12210,null)),mpv=te("mergeEditor.conflict.unhandledUnfocused.border",{dark:"#ffa6007a",light:"#ffa600FF",hcDark:"#ffa6007a",hcLight:"#ffa6007a"},d(12218,null)),hpv=te("mergeEditor.conflict.unhandledFocused.border","#ffa600",d(12217,null)),gpv=te("mergeEditor.conflict.handledUnfocused.border","#86868649",d(12213,null)),fpv=te("mergeEditor.conflict.handledFocused.border","#c1c1c1cc",d(12212,null)),T6=te("mergeEditor.conflict.handled.minimapOverViewRuler","#adaca8ee",d(12211,null)),_6=te("mergeEditor.conflict.unhandled.minimapOverViewRuler","#fcba03FF",d(12216,null)),vpv=te("mergeEditor.conflictingLines.background","#ffea0047",d(12219,null)),a_o=.4,bpv=te("mergeEditor.conflict.input1.background",ai(Wje,a_o),d(12214,null)),Spv=te("mergeEditor.conflict.input2.background",ai(Vje,a_o),d(12215,null));var ere=class extends x{constructor(e,t,o){super();this._editor=e;this._domNode=t;this.itemProvider=o;this.scrollTop=ui(this,this._editor.onDidScrollChange,s=>this._editor.getScrollTop()),this.isScrollTopZero=this.scrollTop.map(s=>s===0),this.modelAttached=ui(this,this._editor.onDidChangeModel,s=>this._editor.hasModel()),this.editorOnDidChangeViewZones=Fr("onDidChangeViewZones",this._editor.onDidChangeViewZones),this.editorOnDidContentSizeChange=Fr("onDidContentSizeChange",this._editor.onDidContentSizeChange),this.domNodeSizeChanged=wc("domNodeSizeChanged"),this.views=new Map,this._domNode.className="gutter monaco-editor";let n=this._domNode.appendChild(ct("div.scroll-decoration",{role:"presentation",ariaHidden:"true",style:{width:"100%"}}).root),r=new ResizeObserver(()=>{Gi(s=>{this.domNodeSizeChanged.trigger(s)})});r.observe(this._domNode),this._register(Z(()=>r.disconnect())),this._register(be(s=>{n.className=this.isScrollTopZero.read(s)?"":"scroll-decoration"})),this._register(be(s=>this.render(s)))}dispose(){super.dispose(),vi(this._domNode)}render(e){if(!this.modelAttached.read(e))return;this.domNodeSizeChanged.read(e),this.editorOnDidChangeViewZones.read(e),this.editorOnDidContentSizeChange.read(e);let t=this.scrollTop.read(e),o=this._editor.getVisibleRanges(),n=new Set(this.views.keys());if(o.length>0){let r=o[0],s=ug.fromLength(r.startLineNumber,r.endLineNumber-r.startLineNumber).deltaEnd(1),l=this.itemProvider.getIntersectingGutterItems(s,e);for(let c of l){if(!c.range.intersectsOrTouches(s))continue;n.delete(c.id);let u=this.views.get(c.id);if(u)u.gutterItemView.update(c);else{let f=document.createElement("div");this._domNode.appendChild(f);let v=this.itemProvider.createView(c,f);u=new gVi(v,f),this.views.set(c.id,u)}let p=c.range.startLineNumber<=this._editor.getModel().getLineCount()?this._editor.getTopForLineNumber(c.range.startLineNumber,!0)-t:this._editor.getBottomForLineNumber(c.range.startLineNumber-1,!1)-t,g=this._editor.getBottomForLineNumber(c.range.endLineNumberExclusive-1,!0)-t-p;u.domNode.style.top=`${p}px`,u.domNode.style.height=`${g}px`,u.gutterItemView.layout(p,g,0,this._domNode.clientHeight)}}for(let r of n){let s=this.views.get(r);s.gutterItemView.dispose(),s.domNode.remove(),this.views.delete(r)}}},gVi=class{constructor(i,e){this.gutterItemView=i;this.domNode=e}};var tre=class extends x{constructor(e,t,o){super();this.instantiationService=e;this.viewModel=t;this.configurationService=o;this.model=this.viewModel.map(n=>n?.model),this.htmlElements=ct("div.code-view",[ct("div.header@header",[ct("span.title@title"),ct("span.description@description"),ct("span.detail@detail"),ct("span.toolbar@toolbar")]),ct("div.container",[ct("div.gutter@gutterDiv"),ct("div@editor")])]),this._onDidViewChange=this._register(new E),this.view={element:this.htmlElements.root,minimumWidth:hT.width,maximumWidth:y4.width,minimumHeight:hT.height,maximumHeight:y4.height,onDidChange:this._onDidViewChange.event,layout:(n,r,s,l)=>{vio(this.htmlElements.root,{width:n,height:r,top:s,left:l}),this.editor.layout({width:n-this.htmlElements.gutterDiv.clientWidth,height:r-this.htmlElements.header.clientHeight})}},this.checkboxesVisible=hr("mergeEditor.showCheckboxes",!1,this.configurationService),this.showDeletionMarkers=hr("mergeEditor.showDeletionMarkers",!0,this.configurationService),this.useSimplifiedDecorations=hr("mergeEditor.useSimplifiedDecorations",!1,this.configurationService),this.editor=this.instantiationService.createInstance(Xr,this.htmlElements.editor,{},{contributions:this.getEditorContributions()}),this.isFocused=ui(this,U.any(this.editor.onDidBlurEditorWidget,this.editor.onDidFocusEditorWidget),()=>this.editor.hasWidgetFocus()),this.cursorPosition=ui(this,this.editor.onDidChangeCursorPosition,()=>this.editor.getPosition()),this.selection=ui(this,this.editor.onDidChangeCursorSelection,()=>this.editor.getSelections()),this.cursorLineNumber=this.cursorPosition.map(n=>n?.lineNumber)}updateOptions(e){this.editor.updateOptions(e)}getEditorContributions(){return Ba.getEditorContributions().filter(e=>e.id!==gf.ID&&e.id!==n5.ID)}};function HUe(a,i){let e=ke(t=>{let o=a.viewModel.read(t);if(!o)return[];let n=o.selectionInBase.read(t);return!n||n.sourceEditor===a?[]:n.rangesInBase.map(r=>i(r,o))});return be(t=>{let o=e.read(t);o.length!==0&&a.editor.setSelections(o.map(n=>new ti(n.startLineNumber,n.startColumn,n.endLineNumber,n.endColumn)))})}var Uq=class extends x{constructor(i,e,t){super();let o=t.createInstance(or,e,i,{menuOptions:{renderShortTitle:!0},toolbarOptions:{primaryGroup:n=>n==="primary"}});this._store.add(o)}};Uq=I([m(2,F)],Uq);var UUe=class extends tre{constructor(e,t,o){super(t,e,o);this.decorations=ke(this,e=>{let t=this.viewModel.read(e);if(!t)return[];let o=t.model,n=o.base,r=t.activeModifiedBaseRange.read(e),s=t.showNonConflictingChanges.read(e),l=this.showDeletionMarkers.read(e),c=[];for(let u of o.modifiedBaseRanges.read(e)){let p=u.baseRange;if(!p)continue;let h=o.isHandled(u).read(e);if(!u.isConflicting&&h&&!s)continue;let g=["merge-editor-block"],f=[0,0,0,0];h&&g.push("handled"),u===r&&(g.push("focused"),f=[0,2,0,2]),g.push("base");let v=t.baseShowDiffAgainst.read(e);if(v)for(let b of u.getInputDiffs(v)){let S=b.inputRange.toInclusiveRange();S&&c.push({range:S,options:{className:"merge-editor-diff base",description:"Merge Editor",isWholeLine:!0}});for(let y of b.rangeMappings)(l||!y.inputRange.isEmpty())&&c.push({range:y.inputRange,options:{className:y.inputRange.isEmpty()?"merge-editor-diff-empty-word base":"merge-editor-diff-word base",description:"Merge Editor",showIfCollapsed:!0}})}c.push({range:p.toInclusiveRangeOrEmpty(),options:{showIfCollapsed:!0,blockClassName:g.join(" "),blockPadding:f,blockIsAfterEnd:p.startLineNumber>n.getLineCount(),description:"Merge Editor",minimap:{position:2,color:{id:h?T6:_6}},overviewRuler:u.isConflicting?{position:2,color:{id:h?T6:_6}}:void 0}})}return c});this._register(HUe(this,(n,r)=>n)),this._register(t.createInstance(Uq,D.MergeBaseToolbar,this.htmlElements.title)),this._register(il((n,r)=>{this.checkboxesVisible.read(n)&&r.add(new ere(this.editor,this.htmlElements.gutterDiv,{getIntersectingGutterItems:(s,l)=>[],createView:(s,l)=>{throw new li}}))})),this._register(be(n=>{let r=this.viewModel.read(n);if(!r)return;this.editor.setModel(r.model.base),vi(this.htmlElements.title,...Un(d(12238,null)));let s=r.baseShowDiffAgainst.read(n),l;if(s){let c=d(12239,null,s===1?r.model.input1.title:r.model.input2.title),u=d(12240,null);l=ct("span",{title:u},[c]).root}vi(this.htmlElements.description,...l?[l]:[])})),this._register(BTe(this.editor,this.decorations))}};UUe=I([m(1,F),m(2,B)],UUe);var J4t=class extends x{constructor(e,t,o,n,r,s){super();this.viewModel=e;this.input1View=t;this.input2View=o;this.baseView=n;this.inputResultView=r;this.layout=s;this.reentrancyBarrier=new EJ;this._isSyncing=!0;let l=ke(c=>{let u=this.baseView.read(c),p=[this.input1View,this.input2View,this.inputResultView,u].filter(lo),h=(g,f,v)=>{this.reentrancyBarrier.runExclusivelyOrSkip(()=>{if(f){let b=g.editor.getScrollLeft();for(let S of p)S!==g&&S.editor.setScrollLeft(b,1)}if(v){let b=g.editor.getScrollTop();for(let S of p)if(S!==g)if(this._shouldLock(g,S))S.editor.setScrollTop(b,1);else{let y=this._getMapping(g,S);y&&this._synchronizeScrolling(g.editor,S.editor,y)}}})};for(let g of p)c.store.add(g.editor.onDidScrollChange(f=>{this._isSyncing&&h(g,f.scrollLeftChanged,f.scrollTopChanged)}));return{update:()=>{h(this.inputResultView,!0,!0)}}}).recomputeInitiallyAndOnChange(this._store);this.updateScrolling=()=>{l.get().update()}}get model(){return this.viewModel.get()?.model}get lockResultWithInputs(){return this.layout.get().kind==="columns"}get lockBaseWithInputs(){return this.layout.get().kind==="mixed"&&!this.layout.get().showBaseAtTop}stopSync(){this._isSyncing=!1}startSync(){this._isSyncing=!0}_shouldLock(e,t){let o=n=>n===this.input1View||n===this.input2View;return o(e)&&t===this.inputResultView||o(t)&&e===this.inputResultView?this.lockResultWithInputs:o(e)&&t===this.baseView.get()||o(t)&&e===this.baseView.get()?this.lockBaseWithInputs:!!(o(e)&&o(t))}_getMapping(e,t){if(e===this.input1View){if(t===this.input2View)return;if(t===this.inputResultView)return this.model?.input1ResultMapping.get();if(t===this.baseView.get()){let o=this.model?.baseInput1Diffs.get();return o?new YF(o,-1).reverse():void 0}}else if(e===this.input2View){if(t===this.input1View)return;if(t===this.inputResultView)return this.model?.input2ResultMapping.get();if(t===this.baseView.get()){let o=this.model?.baseInput2Diffs.get();return o?new YF(o,-1).reverse():void 0}}else if(e===this.inputResultView){if(t===this.input1View)return this.model?.resultInput1Mapping.get();if(t===this.input2View)return this.model?.resultInput2Mapping.get();if(t===this.baseView.get()){let o=this.model?.resultBaseMapping.get();return o||void 0}}else if(e===this.baseView.get()){if(t===this.input1View){let o=this.model?.baseInput1Diffs.get();return o?new YF(o,-1):void 0}else if(t===this.input2View){let o=this.model?.baseInput2Diffs.get();return o?new YF(o,-1):void 0}else if(t===this.inputResultView){let o=this.model?.baseResultMapping.get();return o||void 0}}throw new li}_synchronizeScrolling(e,t,o){if(!o)return;let n=e.getVisibleRanges();if(n.length===0)return;let r=n[0].startLineNumber-1,s=o.project(r),l=s.inputRange,c=s.outputRange,u=t.getTopForLineNumber(c.startLineNumber),p=t.getTopForLineNumber(c.endLineNumberExclusive),h=e.getTopForLineNumber(l.startLineNumber),g=e.getTopForLineNumber(l.endLineNumberExclusive),f=Math.min((e.getScrollTop()-h)/(g-h),1),v=u+(p-u)*f;t.setScrollTop(v,1)}};var zUe=class extends x{constructor(e,t,o,n,r,s,l,c){super();this.model=e;this.inputCodeEditorView1=t;this.inputCodeEditorView2=o;this.resultCodeEditorView=n;this.baseCodeEditorView=r;this.showNonConflictingChanges=s;this.configurationService=l;this.notificationService=c;this.manuallySetActiveModifiedBaseRange=Me(this,{range:void 0,counter:0}),this.attachedHistory=this._register(new fVi(this.model.resultTextModel)),this.shouldUseAppendInsteadOfAccept=hr("mergeEditor.shouldUseAppendInsteadOfAccept",!1,this.configurationService),this.counter=0,this.lastFocusedEditor=M$e(this,(u,p)=>{let g=[this.inputCodeEditorView1,this.inputCodeEditorView2,this.resultCodeEditorView,this.baseCodeEditorView.read(u)].find(f=>f&&f.isFocused.read(u));return g?{view:g,counter:this.counter++}:p||{view:void 0,counter:this.counter++}}),this.baseShowDiffAgainst=ke(this,u=>{let p=this.lastFocusedEditor.read(u);if(p.view===this.inputCodeEditorView1)return 1;if(p.view===this.inputCodeEditorView2)return 2}),this.focusedEditorType=ke(this,u=>{let p=this.lastFocusedEditor.read(u);if(p.view){if(p.view===this.inputCodeEditorView1)return"input1";if(p.view===this.inputCodeEditorView2)return"input2";if(p.view===this.resultCodeEditorView)return"result";if(p.view===this.baseCodeEditorView.read(u))return"base"}}),this.selectionInBase=ke(this,u=>{let p=this.lastFocusedEditor.read(u).view;return p?{rangesInBase:(p.selection.read(u)||[]).map(f=>p===this.inputCodeEditorView1?this.model.translateInputRangeToBase(1,f):p===this.inputCodeEditorView2?this.model.translateInputRangeToBase(2,f):p===this.resultCodeEditorView?this.model.translateResultRangeToBase(f):(p===this.baseCodeEditorView.read(u),f)),sourceEditor:p}:void 0}),this.activeModifiedBaseRange=ke(this,u=>{let p=this.lastFocusedEditor.read(u),h=this.manuallySetActiveModifiedBaseRange.read(u);if(h.counter>p.counter)return h.range;if(!p.view)return;let g=p.view.cursorLineNumber.read(u);return g?this.model.modifiedBaseRanges.read(u).find(v=>{let b=this.getRangeOfModifiedBaseRange(p.view,v,u);return b.isEmpty?b.startLineNumber===g:b.contains(g)}):void 0}),this._register(n.editor.onDidChangeModelContent(u=>{if(this.model.isApplyingEditInResult||u.isRedoing||u.isUndoing)return;let p=[];for(let g of u.changes){let f=this.model.translateResultRangeToBase(z.lift(g.range)),v=this.model.findModifiedBaseRangesInRange(ug.fromLength(f.startLineNumber,f.endLineNumber-f.startLineNumber));v.length===1&&(this.model.isHandled(v[0]).get()||p.push(v[0]))}if(p.length===0)return;let h={model:this.model,redo(){Gi(g=>{for(let f of p)this.model.setHandled(f,!0,g)})},undo(){Gi(g=>{for(let f of p)this.model.setHandled(f,!1,g)})}};this.attachedHistory.pushAttachedHistoryElement(h),h.redo()}))}getRangeOfModifiedBaseRange(e,t,o){if(e===this.resultCodeEditorView)return this.model.getLineRangeInResult(t.baseRange,o);if(e===this.baseCodeEditorView.get())return t.baseRange;{let n=e===this.inputCodeEditorView1?1:2;return t.getInputRange(n)}}setActiveModifiedBaseRange(e,t){this.manuallySetActiveModifiedBaseRange.set({range:e,counter:this.counter++},t)}setState(e,t,o,n){this.manuallySetActiveModifiedBaseRange.set({range:e,counter:this.counter++},o),this.model.setState(e,t,n,o),this.lastFocusedEditor.clearCache(o)}goToConflict(e){let t=this.lastFocusedEditor.get().view;t||(t=this.resultCodeEditorView);let o=t.editor.getPosition()?.lineNumber;if(o===void 0)return;let n=e(t,o);if(n){let r=this.getRangeOfModifiedBaseRange(t,n,void 0);t.editor.focus();let s=r.startLineNumber,l=r.endLineNumberExclusive;r.startLineNumber>t.editor.getModel().getLineCount()&&(Gi(c=>{this.setActiveModifiedBaseRange(n,c)}),s=l=t.editor.getModel().getLineCount()),t.editor.setPosition({lineNumber:s,column:t.editor.getModel().getLineFirstNonWhitespaceColumn(s)}),t.editor.revealLinesNearTop(s,l,0)}}goToNextModifiedBaseRange(e){this.goToConflict((t,o)=>this.model.modifiedBaseRanges.get().find(n=>e(n)&&this.getRangeOfModifiedBaseRange(t,n,void 0).startLineNumber>o)||this.model.modifiedBaseRanges.get().find(n=>e(n)))}goToPreviousModifiedBaseRange(e){this.goToConflict((t,o)=>fd(this.model.modifiedBaseRanges.get(),n=>e(n)&&this.getRangeOfModifiedBaseRange(t,n,void 0).endLineNumberExclusive<o)||fd(this.model.modifiedBaseRanges.get(),n=>e(n)))}toggleActiveConflict(e){let t=this.activeModifiedBaseRange.get();if(!t){this.notificationService.error(d(12257,null));return}Gi(o=>{this.setState(t,this.model.getState(t).get().toggle(e),o,e)})}acceptAll(e){Gi(t=>{for(let o of this.model.modifiedBaseRanges.get())this.setState(o,this.model.getState(o).get().withInputValue(e,!0),t,e)})}};zUe=I([m(6,B),m(7,Ne)],zUe);var fVi=class extends x{constructor(e){super();this.model=e;this.attachedHistory=[],this.previousAltId=this.model.getAlternativeVersionId(),this._register(e.onDidChangeContent(t=>{let o=e.getAlternativeVersionId();if(t.isRedoing)for(let n of this.attachedHistory)this.previousAltId<n.altId&&n.altId<=o&&n.element.redo();else if(t.isUndoing)for(let n=this.attachedHistory.length-1;n>=0;n--){let r=this.attachedHistory[n];o<r.altId&&r.altId<=this.previousAltId&&r.element.undo()}else for(;this.attachedHistory.length>0&&this.attachedHistory[this.attachedHistory.length-1].altId>this.previousAltId;)this.attachedHistory.pop();this.previousAltId=o}))}pushAttachedHistoryElement(e){this.attachedHistory.push({altId:this.model.getAlternativeVersionId(),element:e})}};var Z4t=class a extends x{constructor(e,t,o,n,r){super();this.editor=e;this.overlayWidgetId=`fixedZoneWidget-${a.counter++}`;this.widgetDomNode=ct("div.fixed-zone-widget").root;this.overlayWidget={getId:()=>this.overlayWidgetId,getDomNode:()=>this.widgetDomNode,getPosition:()=>null};this.viewZoneId=t.addZone({domNode:document.createElement("div"),afterLineNumber:o,heightInPx:n,ordinal:50001,onComputedHeight:s=>{this.widgetDomNode.style.height=`${s}px`},onDomNodeTop:s=>{this.widgetDomNode.style.top=`${s}px`}}),r.push(this.viewZoneId),this._register(U.runAndSubscribe(this.editor.onDidLayoutChange,()=>{this.widgetDomNode.style.left=this.editor.getLayoutInfo().contentLeft+"px"})),this.editor.addOverlayWidget(this.overlayWidget),this._register({dispose:()=>{this.editor.removeOverlayWidget(this.overlayWidget)}})}static{this.counter=0}};var KUe=class extends x{constructor(e){super();this._editor=e;this._register(this._editor.onDidChangeConfiguration(t=>{(t.hasChanged(59)||t.hasChanged(25)||t.hasChanged(24))&&this._updateLensStyle()})),this._styleClassName="_conflictActionsFactory_"+_r(this._editor.getId()).toString(16),this._styleElement=Cr($$(this._editor.getContainerDomNode())?this._editor.getContainerDomNode():void 0,void 0,this._store),this._updateLensStyle()}_updateLensStyle(){let{codeLensHeight:e,fontSize:t}=this._getLayoutInfo(),o=this._editor.getOption(24),n=this._editor.getOption(59),r=`--codelens-font-family${this._styleClassName}`,s=`--codelens-font-features${this._styleClassName}`,l=`
		.${this._styleClassName} { line-height: ${e}px; font-size: ${t}px; padding-right: ${Math.round(t*.5)}px; font-feature-settings: var(${s}) }
		.monaco-workbench .${this._styleClassName} span.codicon { line-height: ${e}px; font-size: ${t}px; }
		`;o&&(l+=`${this._styleClassName} { font-family: var(${r}), ${fu.fontFamily}}`),this._styleElement.textContent=l,this._editor.getContainerDomNode().style?.setProperty(r,o??"inherit"),this._editor.getContainerDomNode().style?.setProperty(s,n.fontFeatureSettings)}_getLayoutInfo(){let e=Math.max(1.3,this._editor.getOption(75)/this._editor.getOption(61)),t=this._editor.getOption(25);return(!t||t<5)&&(t=this._editor.getOption(61)*.9|0),{fontSize:t,codeLensHeight:t*e|0}}createWidget(e,t,o,n){let r=this._getLayoutInfo();return new vVi(this._editor,e,t,r.codeLensHeight+2,this._styleClassName,o,n)}},e3t=class{constructor(i,e){this.viewModel=i;this.modifiedBaseRange=e;this.itemsInput1=this.getItemsInput(1);this.itemsInput2=this.getItemsInput(2);this.resultItems=ke(this,i=>{let e=this.viewModel,t=this.modifiedBaseRange,o=e.model.getState(t).read(i),n=e.model,r=[];if(o.kind===4)r.push({text:d(12229,null),tooltip:d(12230,null)});else if(o.kind===0)r.push({text:d(12232,null),tooltip:d(12233,null)});else{let l=[];o.includesInput1&&l.push(n.input1.title),o.includesInput2&&l.push(n.input2.title),o.kind===3&&o.firstInput===2&&l.reverse(),r.push({text:`${l.join(" + ")}`})}let s=[];return o.includesInput1&&s.push(ire(d(12234,null,n.input1.title),async()=>{Gi(l=>{n.setState(t,o.withInputValue(1,!1),!0,l),n.telemetry.reportRemoveInvoked(1,o.includesInput(2))})},d(12235,null,n.input1.title))),o.includesInput2&&s.push(ire(d(12234,null,n.input2.title),async()=>{Gi(l=>{n.setState(t,o.withInputValue(2,!1),!0,l),n.telemetry.reportRemoveInvoked(2,o.includesInput(1))})},d(12235,null,n.input2.title))),o.kind===3&&o.firstInput===2&&s.reverse(),r.push(...s),o.kind===4&&r.push(ire(d(12236,null),async()=>{Gi(l=>{n.setState(t,wS.base,!0,l),n.telemetry.reportResetToBaseInvoked()})},d(12237,null))),r});this.isEmpty=ke(this,i=>this.itemsInput1.read(i).length+this.itemsInput2.read(i).length+this.resultItems.read(i).length===0);this.inputIsEmpty=ke(this,i=>this.itemsInput1.read(i).length+this.itemsInput2.read(i).length===0)}getItemsInput(i){return ke(e=>{let t=this.viewModel,o=this.modifiedBaseRange;if(!t.model.hasBaseRange(o))return[];let n=t.model.getState(o).read(e),r=t.model.isHandled(o).read(e),s=t.model,l=[],c=i===1?t.model.input1:t.model.input2,u=t.showNonConflictingChanges.read(e);if(!o.isConflicting&&r&&!u)return[];let p=i===1?2:1;if(n.kind!==4&&!n.isInputIncluded(i)){if(!n.isInputIncluded(p)||!this.viewModel.shouldUseAppendInsteadOfAccept.read(e)){if(l.push(ire(d(12220,null,c.title),async()=>{Gi(h=>{s.setState(o,n.withInputValue(i,!0,!1),i,h),s.telemetry.reportAcceptInvoked(i,n.includesInput(p))})},d(12224,null,c.title))),o.canBeCombined){let h=o.isOrderRelevant?d(12222,null,c.title):d(12221,null);l.push(ire(h,async()=>{Gi(g=>{s.setState(o,wS.base.withInputValue(i,!0).withInputValue(p,!0,!0),!0,g),s.telemetry.reportSmartCombinationInvoked(n.includesInput(p))})},d(12223,null)))}}else l.push(ire(d(12225,null,c.title),async()=>{Gi(h=>{s.setState(o,n.withInputValue(i,!0,!1),i,h),s.telemetry.reportAcceptInvoked(i,n.includesInput(p))})},d(12226,null,c.title))),o.canBeCombined&&l.push(ire(d(12227,null,c.title),async()=>{Gi(h=>{s.setState(o,n.withInputValue(i,!0,!0),i,h),s.telemetry.reportSmartCombinationInvoked(n.includesInput(p))})},d(12223,null)));s.isInputHandled(o,i).read(e)||l.push(ire(d(12228,null),async()=>{Gi(h=>{s.setInputHandled(o,i,!0,h)})},d(12231,null)))}return l})}};function ire(a,i,e){return{text:a,action:i,tooltip:e}}var vVi=class extends Z4t{constructor(e,t,o,n,r,s,l){super(e,t,o,n,l);this._domNode=ct("div.merge-editor-conflict-actions").root;this.widgetDomNode.appendChild(this._domNode),this._domNode.classList.add(r),this._register(be(c=>{let u=s.read(c);this.setState(u)}))}setState(e){let t=[],o=!0;for(let n of e){o?o=!1:t.push(_("span",void 0,"\xA0|\xA0"));let r=Un(n.text);n.action?t.push(_("a",{title:n.tooltip,role:"button",onclick:()=>n.action()},...r)):t.push(_("span",{title:n.tooltip},...r))}vi(this._domNode,...t)}};function c_o(a){let i=l_o(a.input1Diffs.flatMap(s=>s.rangeMappings),a.baseRange.toExclusiveRange(),a.input1Range.toExclusiveRange()),e=l_o(a.input2Diffs.flatMap(s=>s.rangeMappings),a.baseRange.toExclusiveRange(),a.input2Range.toExclusiveRange()),t=nhn(i,e),o=[];o.push([a.input1Range.startLineNumber-1,a.baseRange.startLineNumber-1,a.input2Range.startLineNumber-1]);function n(s){return s.every(l=>l!==void 0)}for(let s of t){let l=[s.output1Pos?.lineNumber,s.inputPos.lineNumber,s.output2Pos?.lineNumber],c=n(l),u=!0;if(c){let p=!o.some(h=>n(h)&&h.some((g,f)=>g!==void 0&&g===l[f]));p&&(o=o.filter(h=>!h.some((g,f)=>g!==void 0&&g===l[f]))),u=p}else u=!o.some(h=>h.some((g,f)=>g!==void 0&&g===l[f]));u?o.push(l):s.length.isGreaterThan(new pc(1,0))&&o.push([s.output1Pos?s.output1Pos.lineNumber+1:void 0,s.inputPos.lineNumber+1,s.output2Pos?s.output2Pos.lineNumber+1:void 0])}let r=[a.input1Range.endLineNumberExclusive,a.baseRange.endLineNumberExclusive,a.input2Range.endLineNumberExclusive];return o=o.filter(s=>s.every((l,c)=>l!==r[c])),o.push(r),lh(()=>$y(o.map(s=>s[0]).filter(lo),(s,l)=>s<l)&&$y(o.map(s=>s[1]).filter(lo),(s,l)=>s<=l)&&$y(o.map(s=>s[2]).filter(lo),(s,l)=>s<l)&&o.every(s=>s.filter(lo).length>=2)),o}function l_o(a,i,e){let t=[],o=i.getStartPosition(),n=e.getStartPosition();for(let s of a){let l=new AB(z.fromPositions(o,s.inputRange.getStartPosition()),z.fromPositions(n,s.outputRange.getStartPosition()));lh(()=>Q9e(l.inputRange).equals(Q9e(l.outputRange))),l.inputRange.isEmpty()||t.push(l),o=s.inputRange.getEndPosition(),n=s.outputRange.getEndPosition()}let r=new AB(z.fromPositions(o,i.getEndPosition()),z.fromPositions(n,e.getEndPosition()));return lh(()=>Q9e(r.inputRange).equals(Q9e(r.outputRange))),r.inputRange.isEmpty()||t.push(r),t}function nhn(a,i){let e=[],t=[];for(let[r,s]of[[0,a],[1,i]])for(let l of s)t.push({input:r,start:!0,inputPos:l.inputRange.getStartPosition(),outputPos:l.outputRange.getStartPosition()}),t.push({input:r,start:!1,inputPos:l.inputRange.getEndPosition(),outputPos:l.outputRange.getEndPosition()});t.sort(cl(r=>r.inputPos,ye.compare));let o=[void 0,void 0],n;for(let r of t){if(n&&o.some(s=>!!s)){let s=qRt(n,r.inputPos);s.isZero()||(e.push({inputPos:n,length:s,output1Pos:o[0],output2Pos:o[1]}),o[0]&&(o[0]=Y9e(o[0],s)),o[1]&&(o[1]=Y9e(o[1],s)))}o[r.input]=r.start?r.outputPos:void 0,n=r.inputPos}return e}var t3t=class{constructor(i,e,t){this.input1Editor=i;this.input2Editor=e;this.resultEditor=t;this.conflictActionsFactoryInput1=new KUe(this.input1Editor),this.conflictActionsFactoryInput2=new KUe(this.input2Editor),this.conflictActionsFactoryResult=new KUe(this.resultEditor)}computeViewZones(i,e,t){let o=0,n=0,r=0,s=0,l=[],c=[],u=[],p=[],h=e.model,g=h.baseResultDiffs.read(i),f=$Rt(h.modifiedBaseRanges.read(i),g,(w,k)=>w.baseRange.intersectsOrTouches(k.inputRange)?dC.neitherLessOrGreaterThan:ug.compareByStart(w.baseRange,k.inputRange)),v=t.codeLensesVisible,b=t.showNonConflictingChanges,S,y;for(let w of f){if(v&&w.left&&(w.left.isConflicting||b||!h.isHandled(w.left).read(i))){let P=new e3t(e,w.left);(t.shouldAlignResult||!P.inputIsEmpty.read(i))&&(l.push(new Ylt(this.conflictActionsFactoryInput1,w.left.input1Range.startLineNumber-1,P.itemsInput1)),c.push(new Ylt(this.conflictActionsFactoryInput2,w.left.input2Range.startLineNumber-1,P.itemsInput2)),t.shouldAlignBase&&u.push(new SVi(w.left.baseRange.startLineNumber-1,16)));let O=w.left.baseRange.startLineNumber+(y?.resultingDeltaFromOriginalToModified??0)-1;p.push(new Ylt(this.conflictActionsFactoryResult,O,P.resultItems))}let k=w.rights.at(-1);k&&(y=k);let T;w.left?(T=c_o(w.left).map(P=>({input1Line:P[0],baseLine:P[1],input2Line:P[2],resultLine:void 0})),S=w.left,T[T.length-1].resultLine=w.left.baseRange.endLineNumberExclusive+(y?y.resultingDeltaFromOriginalToModified:0)):T=[{baseLine:k.inputRange.endLineNumberExclusive,input1Line:k.inputRange.endLineNumberExclusive+(S?S.input1Range.endLineNumberExclusive-S.baseRange.endLineNumberExclusive:0),input2Line:k.inputRange.endLineNumberExclusive+(S?S.input2Range.endLineNumberExclusive-S.baseRange.endLineNumberExclusive:0),resultLine:k.outputRange.endLineNumberExclusive}];for(let{input1Line:P,baseLine:O,input2Line:V,resultLine:H}of T){if(!t.shouldAlignBase&&(P===void 0||V===void 0))continue;let G=P!==void 0?P+o:-1,$=V!==void 0?V+n:-1,J=O+r,ae=H!==void 0?H+s:-1,he=Math.max(t.shouldAlignBase?J:0,G,$,t.shouldAlignResult?ae:0);if(P!==void 0){let oe=he-G;oe>0&&(l.push(new GUe(P-1,oe)),o+=oe)}if(V!==void 0){let oe=he-$;oe>0&&(c.push(new GUe(V-1,oe)),n+=oe)}if(t.shouldAlignBase){let oe=he-J;oe>0&&(u.push(new GUe(O-1,oe)),r+=oe)}if(t.shouldAlignResult&&H!==void 0){let oe=he-ae;oe>0&&(p.push(new GUe(H-1,oe)),s+=oe)}}}return new bVi(l,c,u,p)}},bVi=class{constructor(i,e,t,o){this.input1ViewZones=i;this.input2ViewZones=e;this.baseViewZones=t;this.resultViewZones=o}},Xlt=class{},GUe=class extends Xlt{constructor(e,t){super();this.afterLineNumber=e;this.heightInLines=t}create(e,t,o){t.push(e.addZone({afterLineNumber:this.afterLineNumber,heightInLines:this.heightInLines,domNode:_("div.diagonal-fill")}))}},SVi=class extends Xlt{constructor(e,t){super();this.afterLineNumber=e;this.heightPx=t}create(e,t,o){t.push(e.addZone({afterLineNumber:this.afterLineNumber,heightInPx:this.heightPx,domNode:_("div.conflict-actions-placeholder")}))}},Ylt=class extends Xlt{constructor(e,t,o){super();this.conflictActionsFactory=e;this.lineNumber=t;this.items=o}create(e,t,o){o.add(this.conflictActionsFactory.createWidget(e,this.lineNumber,this.items,t))}};var Kve=class extends tre{constructor(e,t,o,n,r){super(o,t,r);this.inputNumber=e;this.otherInputNumber=this.inputNumber===1?2:1,this.modifiedBaseRangeGutterItemInfos=Os({debugName:`input${this.inputNumber}.modifiedBaseRangeGutterItemInfos`},s=>{let l=this.viewModel.read(s);if(!l)return[];let c=l.model,u=this.inputNumber,p=l.showNonConflictingChanges.read(s);return c.modifiedBaseRanges.read(s).filter(h=>h.getInputDiffs(this.inputNumber).length>0&&(p||h.isConflicting||!c.isHandled(h).read(s))).map((h,g)=>new IVi(g.toString(),h,u,l))}),this.decorations=Os({debugName:`input${this.inputNumber}.decorations`},s=>{let l=this.viewModel.read(s);if(!l)return[];let c=l.model,u=(this.inputNumber===1?c.input1:c.input2).textModel,p=l.activeModifiedBaseRange.read(s),h=new Array,g=l.showNonConflictingChanges.read(s),f=this.showDeletionMarkers.read(s),b=!(l.baseCodeEditorView.read(s)!==void 0&&l.baseShowDiffAgainst.read(s)===this.inputNumber)&&this.useSimplifiedDecorations.read(s);for(let S of c.modifiedBaseRanges.read(s)){let y=S.getInputRange(this.inputNumber);if(!y)continue;let w=["merge-editor-block"],k=[0,0,0,0],T=c.isInputHandled(S,this.inputNumber).read(s);T&&w.push("handled"),S===p&&(w.push("focused"),k=[0,2,0,2]),S.isConflicting&&w.push("conflicting");let P=this.inputNumber===1?"input i1":"input i2";if(w.push(P),!(!S.isConflicting&&!g&&T)&&(b&&!T&&w.push("use-simplified-decorations"),h.push({range:y.toInclusiveRangeOrEmpty(),options:{showIfCollapsed:!0,blockClassName:w.join(" "),blockPadding:k,blockIsAfterEnd:y.startLineNumber>u.getLineCount(),description:"Merge Editor",minimap:{position:2,color:{id:T?T6:_6}},overviewRuler:S.isConflicting?{position:2,color:{id:T?T6:_6}}:void 0}}),!b&&(S.isConflicting||!c.isHandled(S).read(s)))){let O=S.getInputDiffs(this.inputNumber);for(let V of O){let H=V.outputRange.toInclusiveRange();if(H&&h.push({range:H,options:{className:`merge-editor-diff ${P}`,description:"Merge Editor",isWholeLine:!0}}),V.rangeMappings)for(let G of V.rangeMappings)(f||!G.outputRange.isEmpty())&&h.push({range:G.outputRange,options:{className:G.outputRange.isEmpty()?`merge-editor-diff-empty-word ${P}`:`merge-editor-diff-word ${P}`,description:"Merge Editor",showIfCollapsed:!0}})}}}return h}),this.htmlElements.root.classList.add("input"),this._register(new ere(this.editor,this.htmlElements.gutterDiv,{getIntersectingGutterItems:(s,l)=>this.checkboxesVisible.read(l)?this.modifiedBaseRangeGutterItemInfos.read(l):[],createView:(s,l)=>new yVi(s,l,n)})),this._register(HUe(this,(s,l)=>l.model.translateBaseRangeToInput(this.inputNumber,s))),this._register(o.createInstance(Uq,e===1?D.MergeInput1Toolbar:D.MergeInput2Toolbar,this.htmlElements.toolbar)),this._register(NL({debugName:`input${this.inputNumber}: update labels & text model`},s=>{let l=this.viewModel.read(s);if(!l)return;this.editor.setModel(this.inputNumber===1?l.model.input1.textModel:l.model.input2.textModel);let c=this.inputNumber===1?l.model.input1.title||d(12245,null):l.model.input2.title||d(12246,null),u=this.inputNumber===1?l.model.input1.description:l.model.input2.description,p=this.inputNumber===1?l.model.input1.detail:l.model.input2.detail;vi(this.htmlElements.title,...Un(c)),vi(this.htmlElements.description,...u?Un(u):[]),vi(this.htmlElements.detail,...p?Un(p):[])})),this._register(BTe(this.editor,this.decorations))}};Kve=I([m(2,F),m(3,Xe),m(4,B)],Kve);var IVi=class{constructor(i,e,t,o){this.id=i;this.baseRange=e;this.inputNumber=t;this.viewModel=o;this.model=this.viewModel.model,this.range=this.baseRange.getInputRange(this.inputNumber),this.enabled=this.model.isUpToDate,this.toggleState=ke(this,n=>{let r=this.model.getState(this.baseRange).read(n).getInput(this.inputNumber);return r===2&&!this.baseRange.isOrderRelevant?1:r}),this.state=ke(this,n=>{let r=this.viewModel.activeModifiedBaseRange.read(n);return this.model.hasBaseRange(this.baseRange)?{handled:this.model.isHandled(this.baseRange).read(n),focused:this.baseRange===r}:{handled:!1,focused:!1}})}setState(i,e){this.viewModel.setState(this.baseRange,this.model.getState(this.baseRange).get().withInputValue(this.inputNumber,i),e,this.inputNumber)}toggleBothSides(){Gi(i=>{let e=this.model.getState(this.baseRange).get();this.model.setState(this.baseRange,e.toggle(this.inputNumber).toggle(this.inputNumber===1?2:1),!0,i)})}getContextMenuActions(){let i=this.model.getState(this.baseRange).get(),e=this.model.isHandled(this.baseRange).get(),t=r=>{Gi(s=>this.viewModel.setState(this.baseRange,r,s,this.inputNumber))};function o(r,s,l,c){let u=new it(r,s,void 0,!0,()=>{t(l)});return u.checked=c,u}let n=i.includesInput1&&i.includesInput2;return[this.baseRange.input1Diffs.length>0?o("mergeEditor.acceptInput1",d(12247,null,this.model.input1.title),i.toggle(1),i.includesInput1):void 0,this.baseRange.input2Diffs.length>0?o("mergeEditor.acceptInput2",d(12247,null,this.model.input2.title),i.toggle(2),i.includesInput2):void 0,this.baseRange.isConflicting?jRt(o("mergeEditor.acceptBoth",d(12248,null),i.withInputValue(1,!n).withInputValue(2,!n),n),{enabled:this.baseRange.canBeCombined}):void 0,new ri,this.baseRange.isConflicting?jRt(o("mergeEditor.swap",d(12250,null),i.swap(),!1),{enabled:!i.kind&&(!n||this.baseRange.isOrderRelevant)}):void 0,jRt(new it("mergeEditor.markAsHandled",d(12249,null),void 0,!0,()=>{Gi(r=>{this.model.setHandled(this.baseRange,!e,r)})}),{checked:e})].filter(lo)}},yVi=class extends x{constructor(e,t,o){super();this.isMultiLine=Me(this,!1);this.item=Me(this,e);let n=new cm({isChecked:!1,title:"",icon:R.check,...gh});n.domNode.classList.add("accept-conflict-group"),this._register(j(n.domNode,re.MOUSE_DOWN,r=>{let s=this.item.get();s&&(r.button===2?(r.stopPropagation(),r.preventDefault(),o.showContextMenu({getAnchor:()=>n.domNode,getActions:()=>s.getContextMenuActions()})):r.button===1&&(r.stopPropagation(),r.preventDefault(),s.toggleBothSides()))})),this._register(be(r=>{let s=this.item.read(r),l=s.toggleState.read(r),u={0:{icon:void 0,checked:!1,title:d(12242,null)},3:{icon:R.circleFilled,checked:!1,title:d(12241,null)},1:{icon:R.check,checked:!0,title:d(12243,null)},2:{icon:R.checkAll,checked:!0,title:d(12244,null)}}[l];n.setIcon(u.icon),n.checked=u.checked,n.setTitle(u.title),s.enabled.read(r)?n.enable():n.disable()})),this._register(be(r=>{let s=this.item.read(r).state.read(r),l=["merge-accept-gutter-marker",s.handled&&"handled",s.focused&&"focused",this.isMultiLine.read(r)?"multi-line":"single-line"];t.className=l.filter(c=>typeof c=="string").join(" ")})),this._register(n.onChange(()=>{Gi(r=>{this.item.get().setState(n.checked,r)})})),t.appendChild(ct("div.background",[eO]).root),t.appendChild(this.checkboxDiv=ct("div.checkbox",[ct("div.checkbox-background",[n.domNode])]).root)}layout(e,t,o,n){let r=this.checkboxDiv.clientHeight,s=t/2-r/2,l=r,c=e+s,u=[l,o+n-l-r],p=[e+l,e+t-r-l];p[0]<p[1]&&(c=Bn(c,u[0],u[1]),c=Bn(c,p[0],p[1])),this.checkboxDiv.style.top=`${c-e}px`,Gi(h=>{this.isMultiLine.set(t>30,h)})}update(e){Gi(t=>{this.item.set(e,t)})}};var qUe=class extends tre{constructor(e,t,o,n){super(t,e,n);this._labelService=o;this.decorations=ke(this,e=>{let t=this.viewModel.read(e);if(!t)return[];let o=t.model,n=o.resultTextModel,r=new Array,s=$Rt(o.modifiedBaseRanges.read(e),o.baseResultDiffs.read(e),(u,p)=>u.baseRange.intersectsOrTouches(p.inputRange)?dC.neitherLessOrGreaterThan:ug.compareByStart(u.baseRange,p.inputRange)),l=t.activeModifiedBaseRange.read(e),c=t.showNonConflictingChanges.read(e);for(let u of s){let p=u.left;if(p){let h=["merge-editor-block"],g=[0,0,0,0],f=o.isHandled(p).read(e);if(f&&h.push("handled"),p===l&&(h.push("focused"),g=[0,2,0,2]),p.isConflicting&&h.push("conflicting"),h.push("result"),!p.isConflicting&&!c&&f)continue;let v=o.getLineRangeInResult(p.baseRange,e);r.push({range:v.toInclusiveRangeOrEmpty(),options:{showIfCollapsed:!0,blockClassName:h.join(" "),blockPadding:g,blockIsAfterEnd:v.startLineNumber>n.getLineCount(),description:"Result Diff",minimap:{position:2,color:{id:f?T6:_6}},overviewRuler:p.isConflicting?{position:2,color:{id:f?T6:_6}}:void 0}})}if(!p||p.isConflicting)for(let h of u.rights){let g=h.outputRange.toInclusiveRange();if(g&&r.push({range:g,options:{className:"merge-editor-diff result",description:"Merge Editor",isWholeLine:!0}}),h.rangeMappings)for(let f of h.rangeMappings)r.push({range:f.outputRange,options:{className:"merge-editor-diff-word result",description:"Merge Editor"}})}}return r});this.editor.invokeWithinContext(s=>{let l=s.get(X),c=ZRt.bindTo(l);c.set(!0),this._register(Z(()=>c.reset()))}),this.htmlElements.gutterDiv.style.width="5px",this.htmlElements.root.classList.add("result"),this._register(il((s,l)=>{this.checkboxesVisible.read(s)&&l.add(new ere(this.editor,this.htmlElements.gutterDiv,{getIntersectingGutterItems:(c,u)=>[],createView:(c,u)=>{throw new li}}))})),this._register(be(s=>{let l=this.viewModel.read(s);l&&(this.editor.setModel(l.model.resultTextModel),vi(this.htmlElements.title,...Un(d(12255,null))),vi(this.htmlElements.description,...Un(this._labelService.getUriLabel(l.model.resultTextModel.uri,{relative:!0}))))}));let r=this._register(new Zi(this.htmlElements.detail));this._register(be(s=>{let l=this.viewModel.read(s);if(!l)return;let c=l.model;if(!c)return;let u=c.unhandledConflictsCount.read(s),p=u===1?d(12254,null,u):d(12253,null,u);r.clear(),r.push({class:void 0,enabled:u>0,id:"nextConflict",label:p,run(){l.model.telemetry.reportConflictCounterClicked(),l.goToNextModifiedBaseRange(h=>!c.isHandled(h).read(void 0))},tooltip:u>0?d(12252,null):d(12251,null)})})),this._register(BTe(this.editor,this.decorations)),this._register(HUe(this,(s,l)=>l.model.translateBaseRangeToResult(s))),this._register(t.createInstance(Uq,D.MergeInputResultToolbar,this.htmlElements.toolbar))}};qUe=I([m(1,F),m(2,rt),m(3,B)],qUe);var Yv=class extends $R{constructor(e,t,o,n,r,s,l,c,u,p,h){super(Yv.ID,e,n,t,r,l,s,c,u,p);this.contextKeyService=o;this._codeEditorService=h;this._sessionDisposables=new N,this._viewModel=Me(this,void 0),this._grid=this._register(new me),this.input1View=this._register(this.instantiationService.createInstance(Kve,1,this._viewModel)),this.baseView=Me(this,void 0),this.baseViewOptions=Me(this,void 0),this.input2View=this._register(this.instantiationService.createInstance(Kve,2,this._viewModel)),this.inputResultView=this._register(this.instantiationService.createInstance(qUe,this._viewModel)),this._layoutMode=this.instantiationService.createInstance(ore),this._layoutModeObs=Me(this,this._layoutMode.value),this._ctxIsMergeEditor=$p.bindTo(this.contextKeyService),this._ctxUsesColumnLayout=TJ.bindTo(this.contextKeyService),this._ctxShowBase=UTe.bindTo(this.contextKeyService),this._ctxShowBaseAtTop=Z9e.bindTo(this.contextKeyService),this._ctxResultUri=Iio.bindTo(this.contextKeyService),this._ctxBaseUri=tMt.bindTo(this.contextKeyService),this._ctxShowNonConflictingChanges=eMt.bindTo(this.contextKeyService),this._inputModel=Me(this,void 0),this.viewZoneComputer=new t3t(this.input1View.editor,this.input2View.editor,this.inputResultView.editor),this.scrollSynchronizer=this._register(new J4t(this._viewModel,this.input1View,this.input2View,this.baseView,this.inputResultView,this._layoutModeObs)),this._onDidChangeSizeConstraints=this._register(new E),this.onDidChangeSizeConstraints=this._onDidChangeSizeConstraints.event,this.baseViewDisposables=this._register(new N),this.showNonConflictingChangesStore=this.instantiationService.createInstance(VTe,"mergeEditor/showNonConflictingChanges"),this.showNonConflictingChanges=Me(this,this.showNonConflictingChangesStore.get()??!1)}static{this.ID="mergeEditor"}get viewModel(){return this._viewModel}get inputModel(){return this._inputModel}get model(){return this.inputModel.get()?.model}dispose(){this._sessionDisposables.dispose(),this._ctxIsMergeEditor.reset(),this._ctxUsesColumnLayout.reset(),this._ctxShowNonConflictingChanges.reset(),super.dispose()}get minimumWidth(){return this._layoutMode.value.kind==="mixed"?this.input1View.view.minimumWidth+this.input2View.view.minimumWidth:this.input1View.view.minimumWidth+this.input2View.view.minimumWidth+this.inputResultView.view.minimumWidth}getTitle(){return this.input?this.input.getName():d(12256,null)}createEditorControl(e,t){this.rootHtmlElement=e,e.classList.add("merge-editor"),this.applyLayout(this._layoutMode.value),this.applyOptions(t)}updateEditorControlOptions(e){this.applyOptions(e)}applyOptions(e){let t=QRt(e,{minimap:{enabled:!1},glyphMargin:!1,lineNumbersMinChars:2}),o=QRt(t,{readOnly:!0,readOnlyMessage:void 0});this.input1View.updateOptions(o),this.input2View.updateOptions(o),this.baseViewOptions.set({...this.input2View.editor.getRawOptions()},void 0),this.inputResultView.updateOptions(t)}getMainControl(){return this.inputResultView.editor}layout(e){this._grid.value?.layout(e.width,e.height)}async setInput(e,t,o,n){if(!(e instanceof Eb))throw new li("ONLY MergeEditorInput is supported");await super.setInput(e,t,o,n),this._sessionDisposables.clear(),Gi(g=>{this._viewModel.set(void 0,g),this._inputModel.set(void 0,g)});let r=await e.resolve(),s=r.model,l=this.instantiationService.createInstance(zUe,s,this.input1View,this.input2View,this.inputResultView,this.baseView,this.showNonConflictingChanges);s.telemetry.reportMergeEditorOpened({combinableConflictCount:s.combinableConflictCount,conflictCount:s.conflictCount,baseTop:this._layoutModeObs.get().showBaseAtTop,baseVisible:this._layoutModeObs.get().showBase,isColumnView:this._layoutModeObs.get().kind==="columns"}),Gi(g=>{this._viewModel.set(l,g),this._inputModel.set(r,g)}),this._sessionDisposables.add(l),this._sessionDisposables.add(be(g=>{let f=l.focusedEditorType.read(g);e instanceof Eb&&e.updateFocusedEditor(f||"result")})),this._ctxResultUri.set(r.resultUri.toString()),this._ctxBaseUri.set(s.base.uri.toString()),this._sessionDisposables.add(Z(()=>{this._ctxBaseUri.reset(),this._ctxResultUri.reset()}));let c=new N;this._sessionDisposables.add(c),this._sessionDisposables.add(il(g=>{let f=this.baseView.read(g),v=this.inputResultView.editor.getScrollTop();this.scrollSynchronizer.stopSync(),c.clear(),this.inputResultView.editor.changeViewZones(b=>{let S=this._layoutModeObs.read(g),y=S.kind==="columns",w=S.kind==="mixed"&&!S.showBaseAtTop;this.input1View.editor.changeViewZones(k=>{this.input2View.editor.changeViewZones(T=>{f?f.editor.changeViewZones(P=>{c.add(this.setViewZones(g,l,this.input1View.editor,k,this.input2View.editor,T,f.editor,P,w,this.inputResultView.editor,b,y))}):c.add(this.setViewZones(g,l,this.input1View.editor,k,this.input2View.editor,T,void 0,void 0,!1,this.inputResultView.editor,b,y))})})}),this.inputResultView.editor.setScrollTop(v,0),this.scrollSynchronizer.startSync(),this.scrollSynchronizer.updateScrolling()}));let u=this.loadEditorViewState(e,o);u?this._applyViewState(u):this._sessionDisposables.add(USe(s.onInitialized,()=>{let g=s.modifiedBaseRanges.get().find(f=>f.isConflicting);g&&(this.input1View.editor.revealLineInCenter(g.input1Range.startLineNumber),Gi(f=>{l.setActiveModifiedBaseRange(g,f)}))}));let p=g=>{let f=tte(g,this._codeEditorService);jA(s.input2.textModel,f,this._codeEditorService),jA(s.input1.textModel,f,this._codeEditorService),jA(s.resultTextModel,f,this._codeEditorService);let v=this.baseView.get()?.editor.getModel();v&&jA(v,f,this._codeEditorService)};this._sessionDisposables.add(this._codeEditorService.onDidChangeTransientModelProperty(g=>{p(g)})),p(this.inputResultView.editor.getModel());let h=this;this._sessionDisposables.add(new class{constructor(){this._disposable=new N;for(let g of this.baseInput1Input2())this._disposable.add(g.onDidChangeContent(()=>this._checkBaseInput1Input2AllEmpty()))}dispose(){this._disposable.dispose()}*baseInput1Input2(){yield s.base,yield s.input1.textModel,yield s.input2.textModel}_checkBaseInput1Input2AllEmpty(){for(let g of this.baseInput1Input2())if(g.getValueLength()>0)return;h.editorService.replaceEditors([{editor:e,replacement:{resource:e.result,options:{preserveFocus:!0}},forceReplaceDirty:!0}],h.group)}})}setViewZones(e,t,o,n,r,s,l,c,u,p,h,g){let f=[],v=[],b=[],S=[],y=this.viewZoneComputer.computeViewZones(e,t,{codeLensesVisible:!0,showNonConflictingChanges:this.showNonConflictingChanges.read(e),shouldAlignBase:u,shouldAlignResult:g}),w=new N;if(c)for(let k of y.baseViewZones)k.create(c,b,w);for(let k of y.resultViewZones)k.create(h,S,w);for(let k of y.input1ViewZones)k.create(n,f,w);for(let k of y.input2ViewZones)k.create(s,v,w);return w.add({dispose:()=>{o.changeViewZones(k=>{for(let T of f)k.removeZone(T)}),r.changeViewZones(k=>{for(let T of v)k.removeZone(T)}),l?.changeViewZones(k=>{for(let T of b)k.removeZone(T)}),p.changeViewZones(k=>{for(let T of S)k.removeZone(T)})}}),w}setOptions(e){super.setOptions(e),e&&LT(e,this.inputResultView.editor,0)}clearInput(){super.clearInput(),this._sessionDisposables.clear();for(let{editor:e}of[this.input1View,this.input2View,this.inputResultView])e.setModel(null)}focus(){super.focus(),(this.getControl()??this.inputResultView.editor).focus()}hasFocus(){for(let{editor:e}of[this.input1View,this.input2View,this.inputResultView])if(e.hasTextFocus())return!0;return super.hasFocus()}setEditorVisible(e){super.setEditorVisible(e);for(let{editor:t}of[this.input1View,this.input2View,this.inputResultView])e?t.onVisible():t.onHide();this._ctxIsMergeEditor.set(e)}getControl(){return this.inputResultView.editor}get scopedContextKeyService(){return this.getControl()?.invokeWithinContext(t=>t.get(X))}toggleBase(){this.setLayout({...this._layoutMode.value,showBase:!this._layoutMode.value.showBase})}toggleShowBaseTop(){let e=this._layoutMode.value.showBase&&this._layoutMode.value.showBaseAtTop;this.setLayout({...this._layoutMode.value,showBaseAtTop:!0,showBase:!e})}toggleShowBaseCenter(){let e=this._layoutMode.value.showBase&&!this._layoutMode.value.showBaseAtTop;this.setLayout({...this._layoutMode.value,showBaseAtTop:!1,showBase:!e})}setLayoutKind(e){this.setLayout({...this._layoutMode.value,kind:e})}setLayout(e){let t=this._layoutMode.value;JSON.stringify(t)!==JSON.stringify(e)&&(this.model?.telemetry.reportLayoutChange({baseTop:e.showBaseAtTop,baseVisible:e.showBase,isColumnView:e.kind==="columns"}),this.applyLayout(e))}applyLayout(e){Gi(t=>{if(e.showBase&&!this.baseView.get()){this.baseViewDisposables.clear();let o=this.baseViewDisposables.add(this.instantiationService.createInstance(UUe,this.viewModel));this.baseViewDisposables.add(be(n=>{let r=this.baseViewOptions.read(n);r&&o.updateOptions(r)})),this.baseView.set(o,t)}else!e.showBase&&this.baseView.get()&&(this.baseView.set(void 0,t),this.baseViewDisposables.clear());e.kind==="mixed"?this.setGrid([e.showBaseAtTop&&e.showBase?{size:38,data:this.baseView.get().view}:void 0,{size:38,groups:[{data:this.input1View.view},!e.showBaseAtTop&&e.showBase?{data:this.baseView.get().view}:void 0,{data:this.input2View.view}].filter(lo)},{size:62,data:this.inputResultView.view}].filter(lo)):e.kind==="columns"&&this.setGrid([e.showBase?{size:40,data:this.baseView.get().view}:void 0,{size:60,groups:[{data:this.input1View.view},{data:this.inputResultView.view},{data:this.input2View.view}]}].filter(lo)),this._layoutMode.value=e,this._ctxUsesColumnLayout.set(e.kind),this._ctxShowBase.set(e.showBase),this._ctxShowBaseAtTop.set(e.showBaseAtTop),this._onDidChangeSizeConstraints.fire(),this._layoutModeObs.set(e,t)})}setGrid(e){let t=-1,o=-1;this._grid.value&&(t=this._grid.value.width,o=this._grid.value.height),this._grid.value=S3.from({orientation:0,size:100,groups:e},{styles:{separatorBorder:this.theme.getColor(Ket)??We.transparent},proportionalLayout:!0}),vi(this.rootHtmlElement,this._grid.value.element),t!==-1&&this._grid.value.layout(t,o)}_applyViewState(e){e&&(this.inputResultView.editor.restoreViewState(e),e.input1State&&this.input1View.editor.restoreViewState(e.input1State),e.input2State&&this.input2View.editor.restoreViewState(e.input2State),e.focusIndex>=0&&[this.input1View.editor,this.input2View.editor,this.inputResultView.editor][e.focusIndex].focus())}computeEditorViewState(e){if(!Qe(this.inputModel.get()?.resultUri,e))return;let t=this.inputResultView.editor.saveViewState();if(!t)return;let o=this.input1View.editor.saveViewState()??void 0,n=this.input2View.editor.saveViewState()??void 0,r=[this.input1View.editor,this.input2View.editor,this.inputResultView.editor].findIndex(s=>s.hasWidgetFocus());return{...t,input1State:o,input2State:n,focusIndex:r}}tracksEditorViewState(e){return e instanceof Eb}toggleShowNonConflictingChanges(){this.showNonConflictingChanges.set(!this.showNonConflictingChanges.get(),void 0),this.showNonConflictingChangesStore.set(this.showNonConflictingChanges.get()),this._ctxShowNonConflictingChanges.set(this.showNonConflictingChanges.get())}};Yv=I([m(1,F),m(2,X),m(3,Te),m(4,ce),m(5,Le),m(6,Fn),m(7,ee),m(8,wt),m(9,fe),m(10,qt)],Yv);var ore=class{constructor(i){this._storageService=i;this._value={kind:"mixed",showBase:!1,showBaseAtTop:!0};let e=i.get(ore._key,0,"mixed");if(e==="mixed"||e==="columns")this._value={kind:e,showBase:!1,showBaseAtTop:!0};else if(e)try{this._value=JSON.parse(e)}catch(t){mt(t)}}static{this._key="mergeEditor/layout"}get value(){return this._value}set value(i){this._value!==i&&(this._value=i,this._storageService.store(ore._key,JSON.stringify(this._value),0,0))}};ore=I([m(0,ce)],ore);var $Ue=class extends x{constructor(e,t){super();this._editorService=e;this._store.add(t.registerCodeEditorOpenHandler(this.openCodeEditorFromMergeEditor.bind(this)))}async openCodeEditorFromMergeEditor(e,t,o){let n=this._editorService.activeEditorPane;if(!o&&e.options&&n instanceof Yv&&n.getControl()&&n.input instanceof Eb&&Qe(e.resource,n.input.result)){let r=n.getControl();return LT(e.options,r,0),r}return null}};$Ue=I([m(0,ee),m(1,qt)],$Ue);var Gve=class extends x{static{this.ID="workbench.contrib.mergeEditorResolver"}constructor(i,e){super();let t=o=>({editor:e.createInstance(Eb,o.base.resource,{uri:o.input1.resource,title:o.input1.label??He(o.input1.resource),description:o.input1.description??"",detail:o.input1.detail},{uri:o.input2.resource,title:o.input2.label??He(o.input2.resource),description:o.input2.description??"",detail:o.input2.detail},o.result.resource)});this._register(i.registerEditor("*",{id:la.id,label:la.displayName,detail:la.providerDisplayName,priority:"builtin"},{},{createMergeEditorInput:t}))}};Gve=I([m(0,Ka),m(1,F)],Gve);var FN=class extends K{constructor(i){super(i)}run(i){let{activeEditorPane:e}=i.get(ee);if(e instanceof Yv){let t=e.viewModel.get();if(!t)return;this.runWithViewModel(t,i)}}},Jlt=class extends K{constructor(i){super(i)}run(i,...e){let{activeEditorPane:t}=i.get(ee);if(t instanceof Yv){let o=t.viewModel.get();return o?this.runWithMergeEditor({viewModel:o,inputModel:t.inputModel.get(),input:t.input,editorIdentifier:{editor:t.input,groupId:t.group.id}},i,...e):void 0}}},i3t=class extends K{constructor(){super({id:"_open.mergeEditor",title:L(12152,"Open Merge Editor")})}run(i,...e){let t=d_o.validate(e[0]),o={base:{resource:t.base},input1:{resource:t.input1.uri,label:t.input1.title,description:t.input1.description,detail:t.input1.detail},input2:{resource:t.input2.uri,label:t.input2.title,description:t.input2.description,detail:t.input2.detail},result:{resource:t.output},options:{preserveFocus:!0}};i.get(ee).openEditor(o)}},d_o;(o=>{function a(n){if(!n||typeof n!="object")throw new TypeError("invalid argument");let r=n,s=e(r.base),l=e(r.output),c=i(r.input1),u=i(r.input2);return{base:s,input1:c,input2:u,output:l}}o.validate=a;function i(n){if(typeof n=="string")return new D4(A.parse(n,!0),void 0,void 0,void 0);if(!n||typeof n!="object")throw new TypeError("invalid argument");if(t(n))return new D4(A.revive(n),void 0,void 0,void 0);let r=n,s=r.title,l=e(r.uri),c=r.detail,u=r.description;return new D4(l,s,c,u)}function e(n){if(typeof n=="string")return A.parse(n,!0);if(n&&typeof n=="object")return A.revive(n);throw new TypeError("invalid argument")}function t(n){if(!n||typeof n!="object")return!1;let r=n;return typeof r.scheme=="string"&&typeof r.authority=="string"&&typeof r.path=="string"&&typeof r.query=="string"&&typeof r.fragment=="string"}})(d_o||={});var o3t=class extends K{constructor(){super({id:"merge.mixedLayout",title:L(12126,"Mixed Layout"),toggled:TJ.isEqualTo("mixed"),menu:[{id:D.EditorTitle,when:$p,group:"1_merge",order:9}],precondition:$p})}run(i){let{activeEditorPane:e}=i.get(ee);e instanceof Yv&&e.setLayoutKind("mixed")}},n3t=class extends K{constructor(){super({id:"merge.columnLayout",title:L(12125,"Column Layout"),toggled:TJ.isEqualTo("columns"),menu:[{id:D.EditorTitle,when:$p,group:"1_merge",order:10}],precondition:$p})}run(i){let{activeEditorPane:e}=i.get(ee);e instanceof Yv&&e.setLayoutKind("columns")}},r3t=class extends K{constructor(){super({id:"merge.showNonConflictingChanges",title:L(12151,"Show Non-Conflicting Changes"),toggled:eMt.isEqualTo(!0),menu:[{id:D.EditorTitle,when:$p,group:"3_merge",order:9}],precondition:$p})}run(i){let{activeEditorPane:e}=i.get(ee);e instanceof Yv&&e.toggleShowNonConflictingChanges()}},s3t=class extends K{constructor(){super({id:"merge.showBase",title:L(12127,"Show Base"),toggled:UTe.isEqualTo(!0),menu:[{id:D.EditorTitle,when:C.and($p,TJ.isEqualTo("columns")),group:"2_merge",order:9}]})}run(i){let{activeEditorPane:e}=i.get(ee);e instanceof Yv&&e.toggleBase()}},a3t=class extends K{constructor(){super({id:"merge.showBaseTop",title:L(12129,"Show Base Top"),toggled:C.and(UTe,Z9e),menu:[{id:D.EditorTitle,when:C.and($p,TJ.isEqualTo("mixed")),group:"2_merge",order:10}]})}run(i){let{activeEditorPane:e}=i.get(ee);e instanceof Yv&&e.toggleShowBaseTop()}},l3t=class extends K{constructor(){super({id:"merge.showBaseCenter",title:L(12128,"Show Base Center"),toggled:C.and(UTe,Z9e.negate()),menu:[{id:D.EditorTitle,when:C.and($p,TJ.isEqualTo("mixed")),group:"2_merge",order:11}]})}run(i){let{activeEditorPane:e}=i.get(ee);e instanceof Yv&&e.toggleShowBaseCenter()}},gL=L(12137,"Merge Editor"),c3t=class extends FN{constructor(){super({id:"merge.openResult",icon:R.goToFile,title:L(12150,"Open File"),category:gL,menu:[{id:D.EditorTitle,when:$p,group:"navigation",order:1}],precondition:$p})}runWithViewModel(i,e){e.get(ee).openEditor({resource:i.model.resultTextModel.uri})}},d3t=class extends FN{constructor(){super({id:"merge.goToNextUnhandledConflict",category:gL,title:L(12132,"Go to Next Unhandled Conflict"),icon:R.arrowDown,menu:[{id:D.EditorTitle,when:$p,group:"navigation",order:3}],f1:!0,precondition:$p})}runWithViewModel(i){i.model.telemetry.reportNavigationToNextConflict(),i.goToNextModifiedBaseRange(e=>!i.model.isHandled(e).get())}},u3t=class extends FN{constructor(){super({id:"merge.goToPreviousUnhandledConflict",category:gL,title:L(12133,"Go to Previous Unhandled Conflict"),icon:R.arrowUp,menu:[{id:D.EditorTitle,when:$p,group:"navigation",order:2}],f1:!0,precondition:$p})}runWithViewModel(i){i.model.telemetry.reportNavigationToPreviousConflict(),i.goToPreviousModifiedBaseRange(e=>!i.model.isHandled(e).get())}},p3t=class extends FN{constructor(){super({id:"merge.toggleActiveConflictInput1",category:gL,title:L(12135,"Toggle Current Conflict from Left"),f1:!0,precondition:$p})}runWithViewModel(i){i.toggleActiveConflict(1)}},m3t=class extends FN{constructor(){super({id:"merge.toggleActiveConflictInput2",category:gL,title:L(12136,"Toggle Current Conflict from Right"),f1:!0,precondition:$p})}runWithViewModel(i){i.toggleActiveConflict(2)}},h3t=class extends FN{constructor(){super({id:"mergeEditor.compareInput1WithBase",category:gL,title:L(12143,"Compare Input 1 With Base"),shortTitle:d(12145,null),f1:!0,precondition:$p,menu:{id:D.MergeInput1Toolbar,group:"primary"},icon:R.compareChanges})}runWithViewModel(i,e){let t=e.get(ee);u_o(i,t,1)}},g3t=class extends FN{constructor(){super({id:"mergeEditor.compareInput2WithBase",category:gL,title:L(12144,"Compare Input 2 With Base"),shortTitle:d(12145,null),f1:!0,precondition:$p,menu:{id:D.MergeInput2Toolbar,group:"primary"},icon:R.compareChanges})}runWithViewModel(i,e){let t=e.get(ee);u_o(i,t,2)}};async function u_o(a,i,e){i.openEditor(i.activeEditor,{pinned:!0});let o=a.model.base,n=e===1?a.inputCodeEditorView1.editor:a.inputCodeEditorView2.editor,r=n.getPosition().lineNumber;await i.openEditor({original:{resource:o.uri},modified:{resource:n.getModel().uri},options:{selection:{startLineNumber:r,startColumn:1},revealIfOpened:!0,revealIfVisible:!0}})}var f3t=class extends FN{constructor(){super({id:"merge.openBaseEditor",category:gL,title:L(12134,"Open Base File"),f1:!0,precondition:$p})}runWithViewModel(i,e){e.get(Je).open(i.model.base.uri)}},v3t=class extends FN{constructor(){super({id:"merge.acceptAllInput1",category:gL,title:L(12130,"Accept All Incoming Changes from Left"),f1:!0,precondition:$p,menu:{id:D.MergeInput1Toolbar,group:"primary"},icon:R.checkAll})}runWithViewModel(i){i.acceptAll(1)}},b3t=class extends FN{constructor(){super({id:"merge.acceptAllInput2",category:gL,title:L(12131,"Accept All Current Changes from Right"),f1:!0,precondition:$p,menu:{id:D.MergeInput2Toolbar,group:"primary"},icon:R.checkAll})}runWithViewModel(i){i.acceptAll(2)}},S3t=class extends FN{constructor(){super({id:"mergeEditor.resetResultToBaseAndAutoMerge",category:gL,title:L(12147,"Reset Result"),shortTitle:d(12148,null),f1:!0,precondition:$p,menu:{id:D.MergeInputResultToolbar,group:"primary"},icon:R.discard})}runWithViewModel(i,e){i.model.reset()}},I3t=class extends K{constructor(){super({id:"mergeEditor.resetCloseWithConflictsChoice",category:gL,title:L(12146,"Reset Choice for 'Close with Conflicts'"),f1:!0})}run(i){i.get(ce).remove(e7e,0)}},y3t=class extends Jlt{constructor(){super({id:"mergeEditor.acceptAllCombination",category:gL,title:L(12138,"Accept All Combination"),f1:!0})}runWithMergeEditor(i,e,...t){let{viewModel:o}=i,n=o.model.modifiedBaseRanges.get(),r=o.model;return Gi(s=>{for(let l of n){let c=r.getState(l).get();c.kind!==4&&!c.isInputIncluded(1)&&(!c.isInputIncluded(2)||!o.shouldUseAppendInsteadOfAccept.get())&&l.canBeCombined&&(r.setState(l,c.withInputValue(1,!0).withInputValue(2,!0,!0),!0,s),r.telemetry.reportSmartCombinationInvoked(c.includesInput(2)))}}),{success:!0}}},w3t=class extends Jlt{constructor(){super({id:"mergeEditor.acceptMerge",category:gL,title:L(12139,"Complete Merge"),f1:!0,precondition:$p,keybinding:[{primary:2051,weight:100,when:$p}]})}async runWithMergeEditor({inputModel:i,editorIdentifier:e,viewModel:t},o){let n=o.get(at),r=o.get(ee);if(t.model.unhandledConflictsCount.get()>0){let{confirmed:s}=await n.confirm({message:d(12142,null,He(i.resultUri)),detail:d(12141,null),primaryButton:d(12140,null)});if(!s)return{successful:!1}}return await i.accept(),await r.closeEditor(e),{successful:!0}}},C3t=class extends Jlt{constructor(){super({id:"mergeEditor.toggleBetweenInputs",category:gL,title:L(12149,"Toggle Between Merge Editor Inputs"),f1:!0,precondition:$p,keybinding:[{primary:3122,weight:210,when:$p}]})}runWithMergeEditor({viewModel:i},e){i.inputCodeEditorView1.editor.hasWidgetFocus()?i.inputCodeEditorView2.editor.focus():i.inputCodeEditorView1.editor.focus()}};var wVi=L(12156,"Merge Editor (Dev)"),x3t=class extends K{constructor(){super({id:"merge.dev.copyContentsJson",category:wVi,title:L(12153,"Copy Merge Editor State as JSON"),icon:R.layoutCentered,f1:!0,precondition:$p})}run(i){let{activeEditorPane:e}=i.get(ee),t=i.get(Fi),o=i.get(Ne);if(!(e instanceof Yv)){o.info({name:d(12157,null),message:d(12158,null)});return}let n=e.model;if(!n)return;let r={languageId:n.resultTextModel.getLanguageId(),base:n.base.getValue(),input1:n.input1.textModel.getValue(),input2:n.input2.textModel.getValue(),result:n.resultTextModel.getValue(),initialResult:n.getInitialResultValue()},s=JSON.stringify(r,void 0,4);t.writeText(s),o.info({name:d(12157,null),message:d(12160,null)})}},k3t=class extends K{constructor(){super({id:"merge.dev.saveContentsToFolder",category:wVi,title:L(12155,"Save Merge Editor State to Folder"),icon:R.layoutCentered,f1:!0,precondition:$p})}async run(i){let{activeEditorPane:e}=i.get(ee),t=i.get(Ne),o=i.get(rn),n=i.get(fe),r=i.get(_t);if(!(e instanceof Yv)){t.info({name:d(12157,null),message:d(12158,null)});return}let s=e.model;if(!s)return;let l=await o.showOpenDialog({canSelectFiles:!1,canSelectFolders:!0,canSelectMany:!1,title:d(12159,null)});if(!l)return;let c=l[0],u=r.getExtensions(s.resultTextModel.getLanguageId())[0]||"";async function p(h,g){await n.writeFile(A.joinPath(c,h+u),qe.fromString(g),{})}await Promise.all([p("base",s.base.getValue()),p("input1",s.input1.textModel.getValue()),p("input2",s.input2.textModel.getValue()),p("result",s.resultTextModel.getValue()),p("initialResult",s.getInitialResultValue())]),t.info({name:d(12157,null),message:d(12161,null)})}},E3t=class extends K{constructor(){super({id:"merge.dev.loadContentsFromFolder",category:wVi,title:L(12154,"Load Merge Editor State from Folder"),icon:R.layoutCentered,f1:!0})}async run(i,e){let t=i.get(rn),o=i.get(ee),n=i.get(fe),r=i.get(Ue);e||(e={});let s;if(e.folderUri)s=e.folderUri;else{let b=await t.showOpenDialog({canSelectFiles:!1,canSelectFolders:!0,canSelectMany:!1,title:d(12159,null)});if(!b)return;s=b[0]}let l=await n.resolve(s);function c(b){return l.children.find(S=>S.name.startsWith(b))?.resource}let u=await rhn(r,e.resultState),p=c("base"),h=c("input1"),g=c("input2"),f=c(u?"initialResult":"result"),v={base:{resource:p},input1:{resource:h,label:"Input 1",description:"Input 1",detail:"(from file)"},input2:{resource:g,label:"Input 2",description:"Input 2",detail:"(from file)"},result:{resource:f}};o.openEditor(v)}};async function rhn(a,i){return i?i==="initial":(await a.pick([{label:"result",result:!1},{label:"initial result",result:!0}],{canPickMany:!1}))?.result}var T3t=class{canSerialize(){return!0}serialize(i){return JSON.stringify(this.toJSON(i))}toJSON(i){return{base:i.base,input1:i.input1,input2:i.input2,result:i.result}}deserialize(i,e){try{let t=am(e);return i.createInstance(Eb,t.base,new D4(t.input1.uri,t.input1.title,t.input1.detail,t.input1.description),new D4(t.input2.uri,t.input2.title,t.input2.detail,t.input2.description),t.result)}catch(t){mt(t);return}}};var _3t=class{constructor(){this.name="mergeEditor";this.type="help";this.priority=125;this.when=wV.create("isMergeEditor",!0)}getProvider(i){let e=i.get(qt),t=e.getActiveCodeEditor()||e.getFocusedCodeEditor();if(!t)return;let o=[d(12165,null),d(12166,null,"<keybinding:merge.goToNextUnhandledConflict>","<keybinding:merge.goToPreviousUnhandledConflict>"),d(12167,null,"<keybinding:merge.acceptAllInput1>","<keybinding:merge.acceptAllInput2>"),d(12168,null,"<keybinding:mergeEditor.acceptMerge>"),d(12169,null,"<keybinding:mergeEditor.toggleBetweenInputs>")];return new xp("mergeEditor",{type:"help"},()=>o.join(`
`),()=>t.focus(),"accessibility.verbosity.mergeEditor")}};ne.as(qo.EditorPane).registerEditorPane(Br.create(Yv,Yv.ID,d(12164,null)),[new Ft(Eb)]);ne.as(qo.EditorFactory).registerEditorSerializer(Eb.ID,T3t);ne.as(Jt.Configuration).registerConfiguration({properties:{"mergeEditor.diffAlgorithm":{type:"string",enum:["legacy","advanced"],default:"advanced",markdownEnumDescriptions:[d(12163,null),d(12162,null)]},"mergeEditor.showDeletionMarkers":{type:"boolean",default:!0,description:"Controls if deletions in base or one of the inputs should be indicated by a vertical bar."}}});W(c3t);W(o3t);W(n3t);W(i3t);W(f3t);W(r3t);W(s3t);W(a3t);W(l3t);W(d3t);W(u3t);W(p3t);W(m3t);W(h3t);W(g3t);W(v3t);W(b3t);W(S3t);W(w3t);W(I3t);W(y3t);W(C3t);W(x3t);W(k3t);W(E3t);ne.as(Qi.Workbench).registerWorkbenchContribution($Ue,3);It(Gve.ID,Gve,St.BlockStartup);ga.register(new _3t);var D3t=class extends K{constructor(){super({id:"multiDiffEditor.goToFile",title:L(12284,"Open File"),icon:R.goToFile,precondition:fr.isEqualTo(zg.ID),menu:{when:fr.isEqualTo(zg.ID),id:D.MultiDiffEditorFileToolbar,order:22,group:"navigation"}})}async run(i,...e){let t=e[0],o=i.get(ee),n=o.activeEditorPane,r;if(!(n instanceof zg))return;let s=n.tryGetCodeEditor(t);s&&(r=s.editor.getSelections()??void 0);let l=t,c=n.findDocumentDiffItem(t);c&&c.goToFileUri&&(l=c.goToFileUri),await o.openEditor({label:c?.goToFileEditorTitle,resource:l,options:{selection:r?.[0],selectionRevealType:1}})}},L3t=class extends K{constructor(){super({id:"multiDiffEditor.goToNextChange",title:L(12285,"Go to Next Change"),icon:R.arrowDown,precondition:C.equals("activeEditor",zg.ID),menu:[D.EditorTitle,D.CompactWindowEditorTitle].map(i=>({id:i,when:C.equals("activeEditor",zg.ID),group:"navigation",order:2})),keybinding:{primary:575,weight:100,when:C.equals("activeEditor",zg.ID)},f1:!0})}async run(i){let t=i.get(ee).activeEditorPane;t instanceof zg&&t.goToNextChange()}},R3t=class extends K{constructor(){super({id:"multiDiffEditor.goToPreviousChange",title:L(12286,"Go to Previous Change"),icon:R.arrowUp,precondition:C.equals("activeEditor",zg.ID),menu:[D.EditorTitle,D.CompactWindowEditorTitle].map(i=>({id:i,when:C.equals("activeEditor",zg.ID),group:"navigation",order:1})),keybinding:{primary:1599,weight:100,when:C.equals("activeEditor",zg.ID)},f1:!0})}async run(i){let t=i.get(ee).activeEditorPane;t instanceof zg&&t.goToPreviousChange()}},M3t=class extends K{constructor(){super({id:"multiDiffEditor.collapseAll",title:L(12282,"Collapse All Diffs"),icon:R.collapseAll,precondition:C.and(C.equals("activeEditor",zg.ID),C.not("multiDiffEditorAllCollapsed")),menu:[D.EditorTitle,D.CompactWindowEditorTitle].map(i=>({id:i,when:C.and(C.equals("activeEditor",zg.ID),C.not("multiDiffEditorAllCollapsed")),group:"navigation",order:100})),f1:!0})}async run(i,...e){let o=Dp(e,i.get(ee),i.get(wt),i.get(Io)).groupedEditors[0];if(!o)return;let n=o.editors[0];n instanceof au&&(await n.getViewModel()).collapseAll()}},P3t=class extends K{constructor(){super({id:"multiDiffEditor.expandAll",title:L(12283,"Expand All Diffs"),icon:R.expandAll,precondition:C.and(C.equals("activeEditor",zg.ID),C.has("multiDiffEditorAllCollapsed")),menu:[D.EditorTitle,D.CompactWindowEditorTitle].map(i=>({id:i,when:C.and(C.equals("activeEditor",zg.ID),C.has("multiDiffEditorAllCollapsed")),group:"navigation",order:100})),f1:!0})}async run(i,...e){let o=Dp(e,i.get(ee),i.get(wt),i.get(Io)).groupedEditors[0];if(!o)return;let n=o.editors[0];n instanceof au&&(await n.getViewModel()).expandAll()}};W(D3t);W(L3t);W(R3t);W(M3t);W(P3t);Ee(XK,oMt,1);It(kue.ID,kue,St.BlockStartup);ne.as(qo.EditorPane).registerEditorPane(Br.create(zg,zg.ID,d(12288,null)),[new Ft(au)]);ne.as(qo.EditorFactory).registerEditorSerializer(au.ID,nMt);W(MDe);It(ype.ID,ype,St.BlockStartup);var CVi=class extends K{constructor(){super({id:"runCommands",title:L(9050,"Run Commands"),f1:!1,metadata:{description:d(9052,null),args:[{name:"args",schema:{type:"object",required:["commands"],properties:{commands:{type:"array",description:d(9051,null),items:{anyOf:[{$ref:"vscode://schemas/keybindings#/definitions/commandNames"},{type:"string"},{type:"object",required:["command"],properties:{command:{anyOf:[{$ref:"vscode://schemas/keybindings#/definitions/commandNames"},{type:"string"}]}},$ref:"vscode://schemas/keybindings#/definitions/commandsSchemas"}]}}}}}]}})}async run(i,e){let t=i.get(Ne);if(!this._isCommandArgs(e)){t.error(d(9053,null));return}if(e.commands.length===0){t.warn(d(9054,null));return}let o=i.get(ge),n=i.get(se),r=0;try{for(;r<e.commands.length;++r){let s=e.commands[r];n.debug(`runCommands: executing ${r}-th command: ${CV(s)}`),await this._runCommand(o,s),n.debug(`runCommands: executed ${r}-th command`)}}catch(s){n.debug(`runCommands: executing ${r}-th command resulted in an error: ${s instanceof Error?s.message:CV(s)}`),t.error(s)}}_isCommandArgs(i){if(!i||typeof i!="object"||!("commands"in i)||!Array.isArray(i.commands))return!1;for(let e of i.commands)if(typeof e!="string"&&!(typeof e=="object"&&typeof e.command=="string"))return!1;return!0}_runCommand(i,e){let t,o;return typeof e=="string"?t=e:(t=e.command,o=e.args),o===void 0?i.executeCommand(t):Array.isArray(o)?i.executeCommand(t,...o):i.executeCommand(t,o)}};W(CVi);var qve=class extends x{constructor(e,t,o,n){super();this._modelService=o;this._languageService=n;this._register(e.registerTextModelContentProvider(Q.commentsInput,this)),this._register(t.registerCodeEditorOpenHandler(async(r,s,l)=>!(s instanceof wD)||s.getModel()?.uri.toString()!==r.resource.toString()?null:(r.options&&LT(r.options,s,1),s)))}static{this.ID="comments.input.contentProvider"}async provideTextContent(e){return this._modelService.getModel(e)??this._modelService.createModel("",this._languageService.createById("markdown"),e)}};qve=I([m(0,Bt),m(1,qt),m(2,Tt),m(3,_t)],qve);xo(Ibi,nx,1);It(qve.ID,qve,St.BlockRestore);Ct.registerCommandAndKeybindingRule({id:"editor.action.nextCommentThreadAction",handler:async(a,i)=>{let e=nre(a);if(!e)return Promise.resolve();let t=nx.get(e);if(!t)return Promise.resolve();t.nextCommentThread(!0)},weight:100,primary:579});Ct.registerCommandAndKeybindingRule({id:"editor.action.previousCommentThreadAction",handler:async(a,i)=>{let e=nre(a);if(!e)return Promise.resolve();let t=nx.get(e);if(!t)return Promise.resolve();t.previousCommentThread(!0)},weight:100,primary:1603});W(class extends K{constructor(){super({id:"editor.action.nextCommentedRangeAction",title:{value:d(9123,null),original:"Go to Next Commented Range"},category:{value:d(9128,null),original:"Comments"},menu:[{id:D.CommandPalette,when:_c.activeEditorHasCommentingRange}],keybinding:{primary:580,weight:100,when:_c.activeEditorHasCommentingRange}})}run(a,...i){let e=nre(a);if(!e)return;let t=nx.get(e);t&&t.nextCommentThread(!1)}});W(class extends K{constructor(){super({id:"editor.action.previousCommentedRangeAction",title:{value:d(9125,null),original:"Go to Previous Commented Range"},category:{value:d(9128,null),original:"Comments"},menu:[{id:D.CommandPalette,when:_c.activeEditorHasCommentingRange}],keybinding:{primary:1604,weight:100,when:_c.activeEditorHasCommentingRange}})}run(a,...i){let e=nre(a);if(!e)return;let t=nx.get(e);t&&t.previousCommentThread(!1)}});W(class extends K{constructor(){super({id:"editor.action.nextCommentingRange",title:{value:d(9124,null),original:"Go to Next Commenting Range"},category:{value:d(9128,null),original:"Comments"},menu:[{id:D.CommandPalette,when:_c.activeEditorHasCommentingRange}],keybinding:{primary:Vi(2089,2578),weight:100,when:C.and($a,C.or(pe.focus,_c.commentFocused,C.and(ox,cu.isEqualTo("comments"))))}})}run(a,i){let e=nre(a);if(!e)return;let t=nx.get(e);t&&t.nextCommentingRange()}});W(class extends K{constructor(){super({id:"editor.action.previousCommentingRange",title:{value:d(9126,null),original:"Go to Previous Commenting Range"},category:{value:d(9128,null),original:"Comments"},menu:[{id:D.CommandPalette,when:_c.activeEditorHasCommentingRange}],keybinding:{primary:Vi(2089,2576),weight:100,when:C.and($a,C.or(pe.focus,_c.commentFocused,C.and(ox,cu.isEqualTo("comments"))))}})}async run(a,...i){let e=nre(a);if(!e)return;let t=nx.get(e);t&&t.previousCommentingRange()}});W(class extends K{constructor(){super({id:"workbench.action.toggleCommenting",title:{value:d(9127,null),original:"Toggle Editor Commenting"},category:{value:d(9128,null),original:"Comments"},menu:[{id:D.CommandPalette,when:_c.WorkspaceHasCommenting}]})}run(a,...i){let e=a.get(Om),t=e.isCommentingEnabled;e.enableCommenting(!t)}});W(class extends K{constructor(){super({id:"workbench.action.addComment",title:{value:d(9117,null),original:"Add Comment on Current Selection"},category:{value:d(9128,null),original:"Comments"},menu:[{id:D.CommandPalette,when:_c.activeCursorHasCommentingRange}],keybinding:{primary:Vi(2089,2593),weight:100,when:_c.activeCursorHasCommentingRange}})}async run(a,i){let e=nre(a);if(!e)return;let t=nx.get(e);if(!t)return;let o=i?.range?new z(i.range.startLineNumber,i.range.startLineNumber,i.range.endLineNumber,i.range.endColumn):i?.fileComment?void 0:e.getSelection();await t.addOrToggleCommentAtLine(o,void 0)}});W(class extends K{constructor(){super({id:"workbench.action.focusCommentOnCurrentLine",title:{value:d(9122,null),original:"Focus Comment on Current Line"},category:{value:d(9128,null),original:"Comments"},f1:!0,precondition:_c.activeCursorHasComment})}async run(a,...i){let e=nre(a);if(!e)return;let t=nx.get(e);if(!t)return;let o=e.getSelection(),n=a.get(Ne),r=!1;try{let s=t.getCommentsAtLine(o);s.length===0?r=!0:await t.revealCommentThread(s[0].commentThread.threadId,void 0,!1,1)}catch{r=!0}r&&n.error(d(9121,null))}});function xVi(a,i){for(let e of a.commentsModel.resourceCommentThreads)for(let t of e.commentThreads)t.thread.collapsibleState=i(t.thread)}W(class extends K{constructor(){super({id:"workbench.action.collapseAllComments",title:{value:d(9118,null),original:"Collapse All Comments"},category:{value:d(9128,null),original:"Comments"},menu:[{id:D.CommandPalette,when:_c.WorkspaceHasCommenting}]})}run(a,...i){let e=a.get(Om);xVi(e,()=>0)}});W(class extends K{constructor(){super({id:"workbench.action.expandAllComments",title:{value:d(9119,null),original:"Expand All Comments"},category:{value:d(9128,null),original:"Comments"},menu:[{id:D.CommandPalette,when:_c.WorkspaceHasCommenting}]})}run(a,...i){let e=a.get(Om);xVi(e,()=>1)}});W(class extends K{constructor(){super({id:"workbench.action.expandUnresolvedComments",title:{value:d(9120,null),original:"Expand Unresolved Comments"},category:{value:d(9128,null),original:"Comments"},menu:[{id:D.CommandPalette,when:_c.WorkspaceHasCommenting}]})}run(a,...i){let e=a.get(Om);xVi(e,t=>t.state===0?1:0)}});Ct.registerCommandAndKeybindingRule({id:"editor.action.submitComment",weight:100,primary:2051,when:j_e,handler:(a,i)=>{let e=a.get(qt).getFocusedCodeEditor();e instanceof wD&&e.getParentThread().submitComment()}});Ct.registerCommandAndKeybindingRule({id:"workbench.action.hideComment",weight:100,primary:9,secondary:[1033],when:C.or(j_e,_c.commentFocused),handler:async(a,i)=>{let e=a.get(qt).getFocusedCodeEditor(),t=a.get(_e),o=a.get(Ne),n=a.get(Om);if(await t.enableKeybindingHoldMode("workbench.action.hideComment"),e instanceof wD)e.getParentThread().collapse();else if(e){let r=nx.get(e);if(!r)return;let s=!1;try{let l=n.lastActiveCommentcontroller?.activeComment;l?r.collapseAndFocusRange(l.thread.threadId):s=!0}catch{s=!0}s&&o.error(d(9121,null))}}});Ct.registerCommandAndKeybindingRule({id:"workbench.action.hideComment",weight:100,primary:2057,win:{primary:513},when:C.and(pe.focus,_c.commentWidgetVisible),handler:async(a,i)=>{let e=a.get(qt).getFocusedCodeEditor();if(await a.get(_e).enableKeybindingHoldMode("workbench.action.hideComment"),e){let o=nx.get(e);o&&await o.collapseVisibleComments()}}});function nre(a){let i=a.get(ee).activeTextEditorControl;return mc(i)&&(i.getOriginalEditor().hasTextFocus()?i=i.getOriginalEditor():i=i.getModifiedEditor()),!pn(i)||!i.hasModel()?null:i}var A3t=class extends x{constructor(){super();this.priority=90;this.name="comment";this.when=Mbi;this.type="view"}getProvider(e){let t=e.get(X),o=e.get($t),n=e.get(Kt),r=o.getActiveViewWithId(zu),s=r?.focusedCommentNode;if(!r||!s)return;let l=this._register(new Yue(n));return l.setContextKeyService(t),new kVi(r,s,l)}},N3t=class extends x{constructor(){super();this.priority=85;this.name="commentThread";this.when=_c.commentFocused;this.type="view"}getProvider(e){let t=e.get(Om),o=e.get(ee),n=e.get(ht);if(t.commentsModel.hasCommentThreads())return new Zlt(t,o,n)}},kVi=class extends x{constructor(e,t,o){super();this._commentsView=e;this._focusedCommentNode=t;this._menus=o;this.id="comments";this.verbositySettingKey="accessibility.verbosity.comments";this.options={type:"view"};this.actions=[...this._menus.getResourceContextActions(this._focusedCommentNode)].filter(n=>n.enabled).map(n=>({...n,run:()=>{this._commentsView.focus(),n.run({thread:this._focusedCommentNode.thread,$mid:7,commentControlHandle:this._focusedCommentNode.controllerHandle,commentThreadHandle:this._focusedCommentNode.threadHandle})}}))}provideContent(){let e=this._commentsView.focusedCommentNode,t=this._commentsView.focusedCommentInfo?.toString();if(!e||!t)throw new Error("Comment tree is focused but no comment is selected");return t}onClose(){this._commentsView.focus()}provideNextContent(){return this._commentsView.focusNextNode(),this.provideContent()}providePreviousContent(){return this._commentsView.focusPreviousNode(),this.provideContent()}},Zlt=class extends x{constructor(e,t,o){super();this._commentService=e;this._editorService=t;this._uriIdentityService=o;this.id="commentThread";this.verbositySettingKey="accessibility.verbosity.comments";this.options={type:"view"}}get activeCommentInfo(){return!this._activeCommentInfo&&this._commentService.lastActiveCommentcontroller&&(this._activeCommentInfo=this._commentService.lastActiveCommentcontroller.activeComment),this._activeCommentInfo}provideContent(){if(!this.activeCommentInfo)throw new Error("No current comment thread");let e=this.activeCommentInfo.comment?.body,t=typeof e=="string"?e:e?.value??"",o=this.activeCommentInfo.thread.resource,n=this.activeCommentInfo.thread.range,r="";if(o&&n){let s=this._editorService.findEditors(A.parse(o))||[],l=this._editorService.activeEditorPane?.getControl();if(s?.length&&pn(l)){let c=l.getModel()?.getValueInRange(n);c&&(r=`
Corresponding code: 
`+c)}}return t+r}onClose(){let e=this._activeCommentInfo;this._activeCommentInfo=void 0,e&&pZ(this._commentService,this._editorService,this._uriIdentityService,e.thread,e.comment)}provideNextContent(){let e=ybi(this._activeCommentInfo,"next");if(e)return this._activeCommentInfo=e,this.provideContent()}providePreviousContent(){let e=ybi(this._activeCommentInfo,"previous");if(e)return this._activeCommentInfo=e,this.provideContent()}};Zlt=I([m(0,Om),m(1,ee),m(2,ht)],Zlt);var fL;(h=>(h.intro=d(9100,null),h.tabFocus=d(9101,null,`<keybinding:${pQe.ID}>`),h.commentCommands=d(9098,null),h.escape=d(9099,null,"<keybinding:workbench.action.hideComment>"),h.nextRange=d(9102,null,"<keybinding:editor.action.nextCommentingRange>"),h.previousRange=d(9105,null,"<keybinding:editor.action.previousCommentingRange>"),h.nextCommentThread=d(9104,null,"<keybinding:editor.action.nextCommentThreadAction>"),h.previousCommentThread=d(9107,null,"<keybinding:editor.action.previousCommentThreadAction>"),h.nextCommentedRange=d(9103,null,"<keybinding:editor.action.nextCommentedRangeAction>"),h.previousCommentedRange=d(9106,null,"<keybinding:editor.action.previousCommentedRangeAction>"),h.addComment=d(9097,null,"<keybinding:workbench.action.addComment>"),h.submitComment=d(9108,null,"<keybinding:editor.action.submitComment>")))(fL||={});var EVi=class extends x{constructor(){super(...arguments);this.id="comments";this.verbositySettingKey="accessibility.verbosity.comments";this.options={type:"help"}}provideContent(){return[fL.tabFocus,fL.commentCommands,fL.escape,fL.addComment,fL.submitComment,fL.nextRange,fL.previousRange].join(`
`)}onClose(){this._element?.focus()}},O3t=class{constructor(){this.priority=110;this.name="comments";this.type="help";this.when=C.or(j_e,_c.commentFocused)}getProvider(i){return i.get(F).createInstance(EVi)}};W(class extends Yn{constructor(){super({viewId:zu,id:"comments.collapse",title:d(9078,null),f1:!1,icon:R.collapseAll,menu:{id:D.ViewTitle,group:"navigation",when:C.and(C.and(C.equals("view",zu),_At),DAt),order:100}})}runInView(i,e){e.collapseAll()}});W(class extends Yn{constructor(){super({viewId:zu,id:"comments.expand",title:d(9092,null),f1:!1,icon:R.expandAll,menu:{id:D.ViewTitle,group:"navigation",when:C.and(C.and(C.equals("view",zu),_At),C.not(DAt.key)),order:100}})}runInView(i,e){e.expandAll()}});W(class extends K{constructor(){super({id:"comments.reply",title:d(9094,null),icon:R.reply,precondition:C.equals("canReply",!0),menu:[{id:D.CommentsViewThreadActions,order:100},{id:D.AccessibleView,when:C.and(Dd,C.equals(cu.key,"comments"))}]})}run(i,e){let t=i.get(Om),o=i.get(ee),n=i.get(ht);pZ(t,o,n,e.thread,e.thread.comments[e.thread.comments.length-1],!0)}});ne.as(Jt.Configuration).registerConfiguration({id:"comments",order:20,title:d(9088,null),type:"object",properties:{"comments.openPanel":{enum:["neverOpen","openOnSessionStart","openOnSessionStartWithComments"],default:"openOnSessionStartWithComments",description:d(9093,null),restricted:!1,markdownDeprecationMessage:d(9081,null)},"comments.openView":{enum:["never","file","firstFile","firstFileUnresolved"],enumDescriptions:[d(9086,null),d(9083,null),d(9084,null),d(9085,null)],default:"firstFile",description:d(9082,null),restricted:!1},"comments.useRelativeTime":{type:"boolean",default:!0,description:d(9096,null)},"comments.visible":{type:"boolean",default:!0,description:d(9087,null)},"comments.maxHeight":{type:"boolean",default:!0,description:d(9080,null)},"comments.collapseOnResolve":{type:"boolean",default:!0,description:d(9079,null)},"comments.thread.confirmOnCollapse":{type:"string",enum:["whenHasUnsubmittedComments","never"],enumDescriptions:[d(9091,null),d(9090,null)],default:"whenHasUnsubmittedComments",description:d(9089,null)}}});Ee(Om,W_e,1);var ect=class extends x{constructor(e,t){super();this._commentService=e;this.activityService=t;this.activity=this._register(new me);this.totalUnresolved=0;this._register(this._commentService.onDidSetAllCommentThreads(this.onAllCommentsChanged,this)),this._register(this._commentService.onDidUpdateCommentThreads(this.onCommentsUpdated,this)),this._register(this._commentService.onDidDeleteDataProvider(this.onCommentsUpdated,this))}onAllCommentsChanged(e){let t=0;for(let o of e.commentThreads)o.state===0&&t++;this.updateBadge(t)}onCommentsUpdated(){let e=0;for(let t of this._commentService.commentsModel.resourceCommentThreads)for(let o of t.commentThreads)o.threadState===0&&e++;this.updateBadge(e)}updateBadge(e){if(e===this.totalUnresolved)return;this.totalUnresolved=e;let t=d(9095,null,this.totalUnresolved);this.activity.value=this.activityService.showViewActivity(zu,{badge:new Rd(this.totalUnresolved,()=>t)})}};ect=I([m(0,Om),m(1,Sl)],ect);ne.as(Qi.Workbench).registerWorkbenchContribution(ect,4);ga.register(new A3t);ga.register(new N3t);ga.register(new O3t);var $ve=class extends x{static{this.ID="workbench.contrib.externalUriResolver"}constructor(i,e){super(),e.options?.resolveExternalUri&&this._register(i.registerExternalUriResolver({resolveExternalUri:async t=>({resolved:await e.options.resolveExternalUri(t),dispose:()=>{}})}))}};$ve=I([m(0,Je),m(1,cd)],$ve);var shn="trustedDomains",ahn={type:1,ctime:Date.now(),mtime:Date.now(),size:0},p_o=`// Links matching one or more entries in the list below can be opened without link protection.
// The following examples show what entries can look like:
// - "https://microsoft.com": Matches this specific domain using https
// - "https://microsoft.com:8080": Matches this specific domain on this port using https
// - "https://microsoft.com:*": Matches this specific domain on any port using https
// - "https://microsoft.com/foo": Matches https://microsoft.com/foo and https://microsoft.com/foo/bar,
//   but not https://microsoft.com/foobar or https://microsoft.com/bar
// - "https://*.microsoft.com": Match all domains ending in "microsoft.com" using https
// - "microsoft.com": Match this specific domain using either http or https
// - "*.microsoft.com": Match all domains ending in "microsoft.com" using either http or https
// - "http://192.168.0.1: Matches this specific IP using http
// - "http://192.168.0.*: Matches all IP's with this prefix using http
// - "*": Match all domains using either http or https
//
`,m_o=`//
// You can use the "Manage Trusted Domains" command to open this file.
// Save this file to apply the trusted domains rules.
`,lhn=`[
	// "https://microsoft.com"
]`;function chn(a,i,e){let t=p_o;return a.length>0?(t+=`// By default, VS Code trusts "localhost" as well as the following domains:
`,a.forEach(o=>{t+=`// - "${o}"
`})):t+=`// By default, VS Code trusts "localhost".
`,t+=m_o,t+=e?`
// Currently configuring trust for ${e}
`:"",i.length===0?t+=lhn:t+=JSON.stringify(i,null,2),t}var jve=class{constructor(i,e,t){this.fileService=i;this.storageService=e;this.instantiationService=t;this.capabilities=2;this.onDidChangeCapabilities=U.None;this.onDidChangeFile=U.None;this.fileService.registerProvider(shn,this)}static{this.ID="workbench.contrib.trustedDomainsFileSystemProvider"}stat(i){return Promise.resolve(ahn)}async readFile(i){let e=this.storageService.get(UPt,-1),t=i.fragment,{defaultTrustedDomains:o,trustedDomains:n}=await this.instantiationService.invokeFunction(lro);return(!e||e.indexOf(p_o)===-1||e.indexOf(m_o)===-1||e.indexOf(t??"")===-1||[...o,...n].some(s=>!Ci(e).includes(s)))&&(e=chn(o,n,t)),qe.fromString(e).buffer}writeFile(i,e,t){try{let o=qe.wrap(e).toString(),n=jr(o);this.storageService.store(UPt,o,-1,0),this.storageService.store(I_e,JSON.stringify(n)||"",-1,0)}catch{}return Promise.resolve()}watch(i,e){return{dispose(){}}}mkdir(i){return Promise.resolve(void 0)}readdir(i){return Promise.resolve(void 0)}delete(i,e){return Promise.resolve(void 0)}rename(i,e,t){return Promise.resolve(void 0)}};jve=I([m(0,fe),m(1,ce),m(2,F)],jve);var jUe=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h){this._openerService=i;this._storageService=e;this._dialogService=t;this._productService=o;this._quickInputService=n;this._editorService=r;this._clipboardService=s;this._telemetryService=l;this._instantiationService=c;this._configurationService=u;this._workspaceTrustService=p;this._trustedDomainService=h;this._openerService.registerValidator({shouldOpen:(g,f)=>this.validateLink(g,f)})}async validateLink(i,e){if(!ec(i,Q.http)&&!ec(i,Q.https)||e?.fromWorkspace&&this._workspaceTrustService.isWorkspaceTrusted()&&!this._configurationService.getValue("workbench.trustedDomains.promptInTrustedWorkspace"))return!0;let t=i,o;if(typeof i=="string"?o=A.parse(i):o=i,this._trustedDomainService.isValid(o))return!0;{let{scheme:n,authority:r,path:s,query:l,fragment:c}=o,u=`${n}://${r}${s}`,p=`${l?"?"+l:""}${c?"#"+c:""}`,h=Math.max(0,60-u.length),g=Math.min(Math.max(5,h),p.length);g===p.length?u+=p:u+=p.charAt(0)+"..."+p.substring(p.length-g+1);let{result:f}=await this._dialogService.prompt({type:bt.Info,message:d(16345,null,this._productService.nameShort),detail:typeof t=="string"?t:u,buttons:[{label:d(16344,null),run:()=>!0},{label:d(16343,null),run:()=>(this._clipboardService.writeText(typeof t=="string"?t:o.toString(!0)),!1)},{label:d(16342,null),run:async()=>{let{trustedDomains:v}=this._instantiationService.invokeFunction(y_e),b=`${n}://${r}`,S=await aro(v,b,o,this._quickInputService,this._storageService,this._editorService,this._telemetryService);return!!(S.indexOf("*")!==-1||KPt(o,S))}}],cancelButton:{run:()=>!1}});return f}}};jUe=I([m(0,Je),m(1,ce),m(2,at),m(3,tt),m(4,Ue),m(5,ee),m(6,Fi),m(7,Te),m(8,F),m(9,B),m(10,Nr),m(11,$4)],jUe);var TVi=class a extends K{static{this.STORAGE_KEY="workbench.action.url.openUrl.lastInput"}constructor(){super({id:"workbench.action.url.openUrl",title:L(16346,"Open URL"),category:Ve.Developer,f1:!0})}async run(i){let e=i.get(Ue),t=i.get(_b),o=i.get(ce),n=o.get(a.STORAGE_KEY,1,"");return e.input({prompt:d(16347,null),value:n}).then(r=>{if(r){let s=A.parse(r);t.open(s,{originalUrl:r}),o.store(a.STORAGE_KEY,r,1,1)}})}};W(TVi);$e.registerCommand(zPt);ve.appendMenuItem(D.CommandPalette,{command:{id:zPt.id,title:zPt.description.description}});ne.as(Qi.Workbench).registerWorkbenchContribution(jUe,3);It(jve.ID,jve,St.BlockRestore);It($ve.ID,$ve,St.BlockRestore);var dhn=ne.as(Jt.Configuration);dhn.registerConfiguration({...Ud,properties:{"workbench.trustedDomains.promptInTrustedWorkspace":{scope:1,type:"boolean",default:!1,description:d(16348,null)}}});Ee($4,C_e,1);var U3t=C.and(C.equals("activeEditor",QR.ID),pe.focus.toNegated()),F3t=class a extends K{static{this.ID="editor.action.webvieweditor.showFind"}static{this.LABEL=d(16625,null)}constructor(){super({id:a.ID,title:a.LABEL,keybinding:{when:C.and(U3t,OLt),primary:2084,weight:100}})}run(i){z3t(i)?.showFind()}},W3t=class a extends K{static{this.ID="editor.action.webvieweditor.hideFind"}static{this.LABEL=d(16624,null)}constructor(){super({id:a.ID,title:a.LABEL,keybinding:{when:C.and(U3t,NLt),primary:9,weight:100}})}run(i){z3t(i)?.hideFind()}},V3t=class a extends K{static{this.ID="editor.action.webvieweditor.findNext"}static{this.LABEL=d(16622,null)}constructor(){super({id:a.ID,title:a.LABEL,keybinding:{when:C.and(U3t,FK),primary:3,weight:100}})}run(i){z3t(i)?.runFindAction(!1)}},B3t=class a extends K{static{this.ID="editor.action.webvieweditor.findPrevious"}static{this.LABEL=d(16623,null)}constructor(){super({id:a.ID,title:a.LABEL,keybinding:{when:C.and(U3t,FK),primary:1027,weight:100}})}run(i){z3t(i)?.runFindAction(!0)}},H3t=class a extends K{static{this.ID="workbench.action.webview.reloadWebviewAction"}static{this.LABEL=L(16626,"Reload Webviews")}constructor(){super({id:a.ID,title:a.LABEL,category:Ve.Developer,menu:[{id:D.CommandPalette}]})}async run(i){let e=i.get(cp);for(let t of e.webviews)t.reload()}};function z3t(a){let e=a.get(ee).activeEditor;return e instanceof Hu?e.webview:void 0}var D6=class{constructor(i){this._webviewWorkbenchService=i}static{this.ID=Hu.typeId}canSerialize(i){return this._webviewWorkbenchService.shouldPersist(i)}serialize(i){if(!this.canSerialize(i))return;let e=this.toJson(i);try{return JSON.stringify(e)}catch{return}}deserialize(i,e){let t=this.fromJson(JSON.parse(e));return this._webviewWorkbenchService.openRevivedWebview({webviewInitInfo:{providedViewType:t.providedId,origin:t.origin,title:t.title,options:t.webviewOptions,contentOptions:t.contentOptions,extension:t.extension},viewType:t.viewType,title:t.title,iconPath:t.iconPath,state:t.state,group:t.group})}fromJson(i){return{...i,extension:_Vi(i.extensionId,i.extensionLocation),iconPath:DVi(i.iconPath),state:uhn(i.state),webviewOptions:i.options,contentOptions:LVi(i.options)}}toJson(i){return{origin:i.webview.origin,viewType:i.viewType,providedId:i.providerId,title:i.getName(),options:{...i.webview.options,...i.webview.contentOptions},extensionLocation:i.extension?.location,extensionId:i.extension?.id.value,state:i.webview.state,iconPath:i.iconPath?q.isThemeIcon(i.iconPath)?i.iconPath:{light:i.iconPath.light,dark:i.iconPath.dark}:void 0,group:i.group}}};D6=I([m(0,hD)],D6);function _Vi(a,i){if(!a)return;let e=K3t(i);if(e)return{id:new Ii(a),location:e}}function DVi(a){if(!a)return;if(q.isThemeIcon(a))return a;let i=K3t(a.light),e=K3t(a.dark);return i&&e?{light:i,dark:e}:void 0}function K3t(a){if(a)try{return typeof a=="string"?A.parse(a):A.from(a)}catch{return}}function uhn(a){return typeof a=="string"?a:void 0}function LVi(a){return{...a,localResourceRoots:a.localResourceRoots?.map(i=>K3t(i))}}ne.as(qo.EditorPane).registerEditorPane(Br.create(QR,QR.ID,d(16628,null)),[new Ft(Hu)]);var QUe=class extends x{constructor(e,t){super();this.editorGroupService=t;this._register(e.onWillOpenEditor(o=>{let n=t.getGroup(o.groupId);n&&this.onEditorOpening(o.editor,n)}))}static{this.ID="workbench.contrib.webviewPanel"}onEditorOpening(e,t){if(!(e instanceof Hu)||e.typeId!==Hu.typeId||t.contains(e))return;let o,n=this.editorGroupService.groups;for(let r of n)if(r.contains(e)){o=r;break}o&&o.closeEditor(e)}};QUe=I([m(0,ee),m(1,wt)],QUe);It(QUe.ID,QUe,St.BlockStartup);ne.as(qo.EditorFactory).registerEditorSerializer(D6.ID,D6);Ee(hD,NTe,1);W(F3t);W(W3t);W(V3t);W(B3t);W(H3t);Ee(R_e,ZPt,1);var Qve=class extends D6{constructor(e,t,o){super(e);this._instantiationService=t;this._webviewService=o}static{this.ID=gm.typeId}serialize(e){let t=e.isDirty(),o={...this.toJson(e),editorResource:e.resource.toJSON(),dirty:t,backupId:t?e.backupId:void 0};try{return JSON.stringify(o)}catch{return}}fromJson(e){return{...super.fromJson(e),editorResource:A.from(e.editorResource),dirty:e.dirty}}deserialize(e,t){let o=this.fromJson(JSON.parse(t)),n=h_o(this._webviewService,o),r=this._instantiationService.createInstance(gm,{resource:o.editorResource,viewType:o.viewType,webviewTitle:o.title,iconPath:o.iconPath},n,{startsDirty:o.dirty,backupId:o.backupId});return typeof o.group=="number"&&r.updateGroup(o.group),r}};Qve=I([m(0,hD),m(1,F),m(2,cp)],Qve);function h_o(a,i){let e=a.createWebviewOverlay({providedViewType:i.viewType,origin:i.origin,title:i.title,options:{purpose:"customEditor",enableFindWidget:i.webviewOptions.enableFindWidget,retainContextWhenHidden:i.webviewOptions.retainContextWhenHidden},contentOptions:i.contentOptions,extension:i.extension});return e.state=i.state,e}var Yve=class extends x{constructor(e,t,o,n,r){super();this._instantiationService=e;this._workingCopyBackupService=o;this._webviewService=n;this._register(t.registerHandler(this))}static{this.ID="workbench.contrib.complexCustomWorkingCopyEditorHandler"}handles(e){return e.resource.scheme===Q.vscodeCustomEditor}isOpen(e,t){if(!this.handles(e))return!1;if(e.resource.authority==="jupyter-notebook-ipynb"&&t instanceof Ra)try{let o=JSON.parse(e.resource.query),n=A.from(o);return Qe(n,t.resource)}catch{return!1}if(!(t instanceof gm)||e.resource.authority!==t.viewType.replace(/[^a-z0-9\-_]/gi,"-").toLowerCase())return!1;try{let o=JSON.parse(e.resource.query),n=A.from(o);return Qe(n,t.resource)}catch{return!1}}async createEditor(e){let t=await this._workingCopyBackupService.resolve(e);if(!t?.meta)throw new Error(`No backup found for custom editor: ${e.resource}`);let o=t.meta,n=_Vi(o.extension?.id,o.extension?.location),r=h_o(this._webviewService,{viewType:o.viewType,origin:o.webview.origin,webviewOptions:o.webview.options,contentOptions:LVi(o.webview.options),state:o.webview.state,extension:n,title:o.customTitle}),s=this._instantiationService.createInstance(gm,{resource:A.revive(o.editorResource),viewType:o.viewType,webviewTitle:o.customTitle,iconPath:DVi(o.iconPath)},r,{backupId:o.backupId});return s.updateGroup(0),s}};Yve=I([m(0,F),m(1,iv),m(2,hm),m(3,cp),m(4,xJ)],Yve);var G3t=class{constructor(){this._references=new Map}async getAllModels(i){let e=`${i.toString()}@@@`,t=[];for(let[o,n]of this._references)o.startsWith(e)&&n.model&&t.push(await n.model);return t}async get(i,e){let t=this.key(i,e);return this._references.get(t)?.model}tryRetain(i,e){let t=this.key(i,e),o=this._references.get(t);if(o)return o.counter++,o.model.then(n=>({object:n,dispose:$c(()=>{--o.counter<=0&&(o.model.then(r=>r.dispose()),this._references.delete(t))})}))}add(i,e,t){let o=this.key(i,e);if(this._references.get(o))throw new Error("Model already exists");return this._references.set(o,{viewType:e,model:t,counter:0}),this.tryRetain(i,e)}disposeAllModelsForView(i){for(let[e,t]of this._references)t.viewType===i&&(t.model.then(o=>o.dispose()),this._references.delete(e))}key(i,e){return`${i.toString()}@@@${e}`}};var WU=Object.freeze({viewType:"viewType",displayName:"displayName",selector:"selector",priority:"priority"}),mhn={type:"object",required:[WU.viewType,WU.displayName,WU.selector],additionalProperties:!1,properties:{[WU.viewType]:{type:"string",markdownDescription:d(9211,null)},[WU.displayName]:{type:"string",description:d(9205,null)},[WU.selector]:{type:"array",description:d(9209,null),items:{type:"object",defaultSnippets:[{body:{filenamePattern:"$1"}}],additionalProperties:!1,properties:{filenamePattern:{type:"string",description:d(9210,null)}}}},[WU.priority]:{type:"string",markdownDeprecationMessage:d(9206,null),enum:["default","option"],markdownEnumDescriptions:[d(9207,null),d(9208,null)],default:"default"}}},g_o=Rn.registerExtensionPoint({extensionPoint:"customEditors",deps:[j4],jsonSchema:{description:d(9204,null),type:"array",defaultSnippets:[{body:[{[WU.viewType]:"$1",[WU.displayName]:"$2",[WU.selector]:[{filenamePattern:"$3"}]}]}],items:mhn},activationEventsGenerator:function*(a){for(let i of a){let e=i[WU.viewType];e&&(yield`onCustomEditor:${e}`)}}}),RVi=class extends x{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.customEditors}render(e){let t=e.contributes?.customEditors||[];if(!t.length)return{data:{headers:[],rows:[]},dispose:()=>{}};let o=[d(9215,null),d(9214,null),d(9213,null)],n=t.map(r=>[r.viewType,r.priority??"",di(r.selector.map(s=>s.filenamePattern)).join(", ")]);return{data:{headers:o,rows:n},dispose:()=>{}}}};ne.as(As.ExtensionFeaturesRegistry).registerExtensionFeature({id:"customEditors",label:d(9212,null),access:{canToggle:!1},renderer:new Ft(RVi)});var q3t=class a extends x{constructor(e){super();this._editors=new Map;this._onChange=this._register(new E);this.onChange=this._onChange.event;this._memento=new Al(a.CUSTOM_EDITORS_STORAGE_ID,e);let t=this._memento.getMemento(0,1);for(let o of t[a.CUSTOM_EDITORS_ENTRY_ID]||[])this.add(new q9e(o));this._register(g_o.setHandler(o=>{this.update(o)}))}static{this.CUSTOM_EDITORS_STORAGE_ID="customEditors"}static{this.CUSTOM_EDITORS_ENTRY_ID="editors"}update(e){this._editors.clear();for(let o of e)for(let n of o.value)this.add(new q9e({id:n.viewType,displayName:n.displayName,providerDisplayName:o.description.isBuiltin?d(9201,null):o.description.displayName||o.description.identifier.value,selector:n.selector||[],priority:hhn(n,o.description)}));let t=this._memento.getMemento(0,1);t[a.CUSTOM_EDITORS_ENTRY_ID]=Array.from(this._editors.values()),this._memento.saveMemento(),this._onChange.fire()}[Symbol.iterator](){return this._editors.values()}get(e){return this._editors.get(e)}getContributedEditors(e){return Array.from(this._editors.values()).filter(t=>t.matches(e))}add(e){if(this._editors.has(e.id)){console.error(`Custom editor with id '${e.id}' already registered`);return}this._editors.set(e.id,e)}};function hhn(a,i){switch(a.priority){case"default":return"default";case"option":return"option";case"builtin":return i.isBuiltin?"builtin":"default";default:return"default"}}var YUe=class extends x{constructor(e,t,o,n,r,s,l){super();this.editorService=o;this.editorGroupService=n;this.instantiationService=r;this.uriIdentityService=s;this.editorResolverService=l;this._untitledCounter=0;this._editorResolverDisposables=this._register(new N);this._editorCapabilities=new Map;this._onDidChangeEditorTypes=this._register(new E);this.onDidChangeEditorTypes=this._onDidChangeEditorTypes.event;this._fileEditorFactory=ne.as(qo.EditorFactory).getFileEditorFactory();this._models=new G3t,this._contributedEditors=this._register(new q3t(t)),this.editorResolverService.bufferChangeEvents(this.registerContributionPoints.bind(this)),this._register(this._contributedEditors.onChange(()=>{this.editorResolverService.bufferChangeEvents(this.registerContributionPoints.bind(this)),this._onDidChangeEditorTypes.fire()}));let c={contextKey:nio,getGroupContextKeyValue:h=>this.getActiveCustomEditorId(h),onDidChange:this.onDidChangeEditorTypes},u={contextKey:rio,getGroupContextKeyValue:h=>this.getCustomEditorIsEditable(h),onDidChange:this.onDidChangeEditorTypes};this._register(this.editorGroupService.registerContextKeyProvider(c)),this._register(this.editorGroupService.registerContextKeyProvider(u)),this._register(e.onDidRunOperation(h=>{h.isOperation(2)&&this.handleMovedFileInOpenedFileEditors(h.resource,this.uriIdentityService.asCanonicalUri(h.target.resource))}));let p=105;this._register(S_.addImplementation(p,"custom-editor",()=>this.withActiveCustomEditor(h=>h.undo()))),this._register(I_.addImplementation(p,"custom-editor",()=>this.withActiveCustomEditor(h=>h.redo())))}getEditorTypes(){return[...this._contributedEditors]}withActiveCustomEditor(e){let t=this.editorService.activeEditor;if(t instanceof gm){let o=e(t);return o||!0}return!1}registerContributionPoints(){this._editorResolverDisposables.clear();for(let e of this._contributedEditors)for(let t of e.selector)t.filenamePattern&&this._editorResolverDisposables.add(this.editorResolverService.registerEditor(t.filenamePattern,{id:e.id,label:e.displayName,detail:e.providerDisplayName,priority:e.priority},{singlePerResource:()=>!(this.getCustomEditorCapabilities(e.id)?.supportsMultipleEditorsPerDocument??!1)},{createEditorInput:({resource:o},n)=>({editor:gm.create(this.instantiationService,{resource:o,viewType:e.id,webviewTitle:void 0,iconPath:void 0},n.id)}),createUntitledEditorInput:({resource:o},n)=>({editor:gm.create(this.instantiationService,{resource:o??A.from({scheme:Q.untitled,authority:`Untitled-${this._untitledCounter++}`}),viewType:e.id,webviewTitle:void 0,iconPath:void 0},n.id)}),createDiffEditorInput:(o,n)=>({editor:this.createDiffEditorInput(o,e.id,n)})}))}createDiffEditorInput(e,t,o){let n=gm.create(this.instantiationService,{resource:Ci(e.modified.resource),viewType:t,webviewTitle:void 0,iconPath:void 0},o.id,{customClasses:"modified"}),r=gm.create(this.instantiationService,{resource:Ci(e.original.resource),viewType:t,webviewTitle:void 0,iconPath:void 0},o.id,{customClasses:"original"});return this.instantiationService.createInstance(Pa,e.label,e.description,r,n,!0)}get models(){return this._models}getCustomEditor(e){return this._contributedEditors.get(e)}getContributedCustomEditors(e){return new ATe(this._contributedEditors.getContributedEditors(e))}getUserConfiguredCustomEditors(e){let t=this.editorResolverService.getAssociationsForResource(e);return new ATe(di(t.map(o=>this._contributedEditors.get(o.viewType))))}getAllCustomEditors(e){return new ATe([...this.getUserConfiguredCustomEditors(e).allEditors,...this.getContributedCustomEditors(e).allEditors])}registerCustomEditorCapabilities(e,t){if(this._editorCapabilities.has(e))throw new Error(`Capabilities for ${e} already set`);return this._editorCapabilities.set(e,t),Z(()=>{this._editorCapabilities.delete(e)})}getCustomEditorCapabilities(e){return this._editorCapabilities.get(e)}getActiveCustomEditorId(e){let t=e.activeEditorPane;return t?.input?.resource&&t?.input instanceof gm?t.input.viewType:""}getCustomEditorIsEditable(e){let t=e.activeEditorPane;return t?.input?.resource?t?.input instanceof gm:!1}async handleMovedFileInOpenedFileEditors(e,t){if(es(e).toLowerCase()===es(t).toLowerCase())return;let o=this.getAllCustomEditors(t);if(!o.allEditors.some(r=>r.priority!=="option"))return;let n=new Map;for(let r of this.editorGroupService.groups)for(let s of r.editors)if(this._fileEditorFactory.isFileEditor(s)&&!(s instanceof gm)&&Qe(s.resource,t)){let l=n.get(r.id);l||(l=[],n.set(r.id,l)),l.push(s)}if(n.size)for(let[r,s]of n)this.editorService.replaceEditors(s.map(l=>{let c;if(o.defaultEditor){let u=o.defaultEditor.id;c=gm.create(this.instantiationService,{resource:t,viewType:u,webviewTitle:void 0,iconPath:void 0},r)}else c={resource:t,options:{override:la.id}};return{editor:l,replacement:c,options:{preserveFocus:!0}}}),r)}};YUe=I([m(0,fe),m(1,ce),m(2,ee),m(3,wt),m(4,F),m(5,ht),m(6,Ka)],YUe);Ee(xJ,YUe,1);ne.as(qo.EditorPane).registerEditorPane(Br.create(QR,QR.ID,"Webview Editor"),[new Ft(gm)]);ne.as(qo.EditorFactory).registerEditorSerializer(Qve.ID,Qve);It(Yve.ID,Yve,St.BlockStartup);Ee(oZ,T_e,1);ne.as(Jt.Configuration).registerConfiguration(Ovi);var rre=class extends x{constructor(e,t,o,n){super();this.contextService=e;this.modelService=t;this.languageFeaturesService=o;this.webWorkerService=n;this.disposeWorkerScheduler=this._register(new Dt(()=>this.disposeWorker(),rre.DISPOSE_WORKER_TIME)),this.registerListeners(),this.updateLinkProviderWorker()}static{this.DISPOSE_WORKER_TIME=180*1e3}registerListeners(){this._register(this.contextService.onDidChangeWorkspaceFolders(()=>this.updateLinkProviderWorker()))}updateLinkProviderWorker(){this.contextService.getWorkspace().folders.length>0?this.linkProviderRegistration||(this.linkProviderRegistration=this.languageFeaturesService.linkProvider.register([{language:d_e,scheme:"*"},{language:u_e,scheme:"*"}],{provideLinks:async t=>{let o=await this.provideLinks(t.uri);return o&&{links:o}}})):(Be(this.linkProviderRegistration),this.linkProviderRegistration=void 0),this.disposeWorker(),this.disposeWorkerScheduler.cancel()}getOrCreateWorker(){return this.disposeWorkerScheduler.schedule(),this.worker||(this.worker=new tct(this.contextService,this.modelService,this.webWorkerService)),this.worker}async provideLinks(e){return this.getOrCreateWorker().provideLinks(e)}disposeWorker(){this.worker&&(this.worker.dispose(),this.worker=void 0)}};rre=I([m(0,Pe),m(1,Tt),m(2,Qt),m(3,Zy)],rre);var tct=class extends x{constructor(e,t,o){super();this.contextService=e;this._workerClient=this._register(o.createWorkerClient(new Ux({esmModuleLocation:vn.asBrowserUri("vs/workbench/contrib/output/common/outputLinkComputerMain.js"),label:"OutputLinkDetectionWorker"}))),this._workerTextModelSyncClient=this._register(y7.create(this._workerClient,t)),this._initializeBarrier=this._ensureWorkspaceFolders()}async _ensureWorkspaceFolders(){await this._workerClient.proxy.$setWorkspaceFolders(this.contextService.getWorkspace().folders.map(e=>e.uri.toString()))}async provideLinks(e){return await this._initializeBarrier,this._workerTextModelSyncClient.ensureSyncedResources([e]),this._workerClient.proxy.$computeLinks(e.toString())}};tct=I([m(0,Pe),m(1,Tt),m(2,Zy)],tct);var f_o=/^(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{3})\s(\[(info|trace|debug|error|warning)\])\s(\[(.*?)\])?/;function v_o(a,i){let e=a.getLineContent(i),t=f_o.exec(e);if(t){let o=new Date(t[1]).getTime(),n=new z(i,1,i,t[1].length),r=ghn(t[3]),s=new z(i,n.endColumn+1,i,n.endColumn+1+t[2].length),l=t[5],c=i,u=i,p=a.getLineCount();for(;u<p;){let g=a.getLineContent(u+1),f=u+1===p&&g==="";if(f_o.test(g)||f)break;u++}return{range:new z(c,1,u,a.getLineMaxColumn(u)),timestamp:o,timestampRange:n,logLevel:r,logLevelRange:s,category:l}}return null}function*MVi(a,i){for(let e=1;e<=a.getLineCount();e++){let t=v_o(a,e);t&&(yield i(t),e=t.range.endLineNumber)}}function b_o(a,i){return{...a,range:new z(i,a.range.startColumn,i+a.range.endLineNumber-a.range.startLineNumber,a.range.endColumn),timestampRange:new z(i,a.timestampRange.startColumn,i,a.timestampRange.endColumn),logLevelRange:new z(i,a.logLevelRange.startColumn,i,a.logLevelRange.endColumn)}}function ghn(a){switch(a.toLowerCase()){case"trace":return 1;case"debug":return 2;case"info":return 3;case"warning":return 4;case"error":return 5;default:throw new Error(`Unknown log level: ${a}`)}}var XUe=class extends x{constructor({name:e,resource:t},o,n,r){super();this.fileService=o;this.instantiationService=n;this.logService=r;this._onDidAppend=this._register(new E);this._onDidReset=this._register(new E);this.watching=!1;this.etag="";this.logEntries=[];this.startOffset=0;this.endOffset=0;this.name=e??"",this.resource=t,this.syncDelayer=new ya(500),this._register(Z(()=>this.unwatch()))}get onDidAppend(){return this._onDidAppend.event}get onDidReset(){return this._onDidReset.event}reset(e){this.endOffset=this.startOffset=e??this.startOffset,this.logEntries=[]}resetToEnd(){this.startOffset=this.endOffset,this.logEntries=[]}watch(){this.watching||(this.logService.trace("Started polling",this.resource.toString()),this.poll(),this.watching=!0)}unwatch(){this.watching&&(this.syncDelayer.cancel(),this.watching=!1,this.logService.trace("Stopped polling",this.resource.toString()))}poll(){let e=()=>this.doWatch().then(()=>this.poll());this.syncDelayer.trigger(e).catch(t=>{if(!ao(t))throw t})}async doWatch(){try{if(!this.fileService.hasProvider(this.resource))return;let e=await this.fileService.stat(this.resource);e.etag!==this.etag&&(this.etag=e.etag,Yo(e.size)&&this.endOffset>e.size?(this.reset(0),this._onDidReset.fire()):this._onDidAppend.fire())}catch(e){if(Au(e)!==1)throw e}}getLogEntries(){return this.logEntries}async getContent(e){try{if(!this.fileService.hasProvider(this.resource))return{name:this.name,content:"",consume:()=>{}};let t=await this.fileService.readFile(this.resource,{position:this.endOffset}),o=t.value.toString(),n=e?[]:this.parseLogEntries(o,this.logEntries[this.logEntries.length-1]),r=!1;return{name:this.name,content:o,consume:()=>{r||(r=!0,this.endOffset+=t.value.byteLength,this.etag=t.etag,this.logEntries.push(...n))}}}catch(t){if(Au(t)!==1)throw t;return{name:this.name,content:"",consume:()=>{}}}}parseLogEntries(e,t){let o=this.instantiationService.createInstance(ip,e,$J,ip.DEFAULT_CREATION_OPTIONS,null);try{if(!v_o(o,1))return[];let n=[],r=t?t.range.endLineNumber+1:1;for(let s of MVi(o,l=>b_o(l,r)))n.push(s),r=s.range.endLineNumber+1;return n}finally{o.dispose()}}};XUe=I([m(1,fe),m(2,F),m(3,se)],XUe);var ict=class extends x{constructor(e,t,o,n){super();this.instantiationService=t;this.fileService=o;this.logService=n;this._onDidAppend=this._register(new E);this.onDidAppend=this._onDidAppend.event;this.onDidReset=U.None;this.logEntries=[];this.fileContentProviderItems=[];this.watching=!1;for(let r of e)this.fileContentProviderItems.push(this.createFileContentProvider(r));this._register(Z(()=>{for(let[,r]of this.fileContentProviderItems)r.dispose()}))}createFileContentProvider(e){let t=new N,o=t.add(new XUe(e,this.fileService,this.instantiationService,this.logService));return t.add(o.onDidAppend(()=>this._onDidAppend.fire())),[o,t]}watch(){if(!this.watching){this.watching=!0;for(let[e]of this.fileContentProviderItems)e.watch()}}unwatch(){if(this.watching){this.watching=!1;for(let[e]of this.fileContentProviderItems)e.unwatch()}}updateFiles(e){let t=this.watching;t&&this.unwatch();let o=r$e(this.fileContentProviderItems.map(([n])=>n),e,(n,r)=>ar.compare(n.resource,r.resource));for(let{start:n,deleteCount:r,toInsert:s}of o){let l=s.map(u=>this.createFileContentProvider(u)),c=this.fileContentProviderItems.splice(n,r,...l);for(let[,u]of c)u.dispose()}t&&this.watch()}reset(){for(let[e]of this.fileContentProviderItems)e.reset();this.logEntries=[]}resetToEnd(){for(let[e]of this.fileContentProviderItems)e.resetToEnd();this.logEntries=[]}getLogEntries(){return this.logEntries}async getContent(){let e=await Promise.all(this.fileContentProviderItems.map(([r])=>r.getContent(!0))),{content:t,logEntries:o}=this.combineLogEntries(e,this.logEntries[this.logEntries.length-1]),n=!1;return{content:t,consume:()=>{n||(n=!0,e.forEach(({consume:r})=>r()),this.logEntries.push(...o))}}}combineLogEntries(e,t){if(e=e.filter(p=>!!p.content),e.length===0)return{logEntries:[],content:""};let o=[],n=[],r=(p,h,g)=>{let f=p.getValueInRange(h.range),v=g?`${f.substring(0,h.logLevelRange.endColumn)} [${g}]${f.substring(h.logLevelRange.endColumn)}`:f;return[{...h,category:g,range:new z(h.range.startLineNumber,h.logLevelRange.startColumn,h.range.endLineNumber,g?h.range.endColumn+g.length+3:h.range.endColumn)},v]},s=this.instantiationService.createInstance(ip,e[0].content,$J,ip.DEFAULT_CREATION_OPTIONS,null);try{for(let[p,h]of MVi(s,g=>r(s,g,e[0].name)))o.push(p),n.push(h)}finally{s.dispose()}for(let p=1;p<e.length;p++){let{content:h,name:g}=e[p],f=this.instantiationService.createInstance(ip,h,$J,ip.DEFAULT_CREATION_OPTIONS,null);try{let v=MVi(f,S=>r(f,S,g)),b=v.next();for(;!b.done;){let[S,y]=b.value,w=[S],k=[y],T;if(S.timestamp>=o[o.length-1].timestamp)for(T=o.length,b=v.next();!b.done;b=v.next())w.push(b.value[0]),k.push(b.value[1]);else{if(S.timestamp<=o[0].timestamp)T=0;else{let P=Px(o,S,(O,V)=>O.timestamp-V.timestamp);T=P<0?~P:P}for(b=v.next();!b.done&&b.value[0].timestamp<=o[T].timestamp;b=v.next())w.push(b.value[0]),k.push(b.value[1])}n.splice(T,0,...k),o.splice(T,0,...w)}}finally{f.dispose()}}let l="",c=[],u=t?t.range.endLineNumber+1:1;for(let p=0;p<o.length;p++){l+=n[p]+`
`;let h=b_o(o[p],u);c.push(h),u=h.range.endLineNumber+1}return{logEntries:c,content:l}}};ict=I([m(1,F),m(2,fe),m(3,se)],ict);var JUe=class extends x{constructor(e,t,o,n,r){super();this.modelUri=e;this.language=t;this.outputContentProvider=o;this.modelService=n;this.editorWorkerService=r;this._onDispose=this._register(new E);this.onDispose=this._onDispose.event;this.loadModelPromise=null;this.modelDisposable=this._register(new me);this.model=null;this.modelUpdateInProgress=!1;this.modelUpdateCancellationSource=this._register(new me);this.appendThrottler=this._register(new ya(300))}async loadModel(){return this.loadModelPromise=dn.withAsyncBody(async(e,t)=>{try{this.modelDisposable.value=new N,this.model=this.modelService.createModel("",this.language,this.modelUri);let{content:o,consume:n}=await this.outputContentProvider.getContent();n(),this.doAppendContent(this.model,o),this.modelDisposable.value.add(this.outputContentProvider.onDidReset(()=>this.onDidContentChange(!0,!0))),this.modelDisposable.value.add(this.outputContentProvider.onDidAppend(()=>this.onDidContentChange(!1,!1))),this.outputContentProvider.watch(),this.modelDisposable.value.add(Z(()=>this.outputContentProvider.unwatch())),this.modelDisposable.value.add(this.model.onWillDispose(()=>{this.outputContentProvider.reset(),this.modelDisposable.value=void 0,this.cancelModelUpdate(),this.model=null})),e(this.model)}catch(o){t(o)}}),this.loadModelPromise}getLogEntries(){return this.outputContentProvider.getLogEntries()}onDidContentChange(e,t){e&&!this.modelUpdateInProgress&&this.doUpdate(3,!0),this.doUpdate(1,t)}doUpdate(e,t){if((e===3||e===2)&&this.cancelModelUpdate(),!this.model)return;this.modelUpdateInProgress=!0,this.modelUpdateCancellationSource.value||(this.modelUpdateCancellationSource.value=new Ye);let o=this.modelUpdateCancellationSource.value.token;e===3?this.clearContent(this.model):e===2?this.replacePromise=this.replaceContent(this.model,o).finally(()=>this.replacePromise=void 0):this.appendContent(this.model,t,o)}clearContent(e){e.applyEdits([Hn.delete(e.getFullModelRange())]),this.modelUpdateInProgress=!1}appendContent(e,t,o){this.appendThrottler.trigger(async()=>{if(o.isCancellationRequested)return;if(this.replacePromise){try{await this.replacePromise}catch{}if(o.isCancellationRequested)return}let{content:n,consume:r}=await this.outputContentProvider.getContent();o.isCancellationRequested||(r(),this.doAppendContent(e,n),this.modelUpdateInProgress=!1)},t?0:void 0).catch(n=>{if(!ao(n))throw n})}doAppendContent(e,t){let o=e.getLineCount(),n=e.getLineMaxColumn(o);e.applyEdits([Hn.insert(new ye(o,n),t)])}async replaceContent(e,t){let{content:o,consume:n}=await this.outputContentProvider.getContent();if(t.isCancellationRequested)return;let r=await this.getReplaceEdits(e,o.toString());t.isCancellationRequested||(n(),r.length&&e.applyEdits(r),this.modelUpdateInProgress=!1)}async getReplaceEdits(e,t){if(!t)return[Hn.delete(e.getFullModelRange())];if(t!==e.getValue()){let o=await this.editorWorkerService.computeMoreMinimalEdits(e.uri,[{text:t.toString(),range:e.getFullModelRange()}]);if(o?.length)return o.map(n=>Hn.replace(z.lift(n.range),n.text))}return[]}cancelModelUpdate(){this.modelUpdateCancellationSource.value?.cancel(),this.modelUpdateCancellationSource.value=void 0,this.appendThrottler.cancel(),this.replacePromise=void 0,this.modelUpdateInProgress=!1}isVisible(){return!!this.model}dispose(){this._onDispose.fire(),super.dispose()}append(e){throw new Error("Not supported")}replace(e){throw new Error("Not supported")}};JUe=I([m(3,Tt),m(4,Qs)],JUe);var Xve=class extends JUe{constructor(e,t,o,n,r,s,l,c){let u=new XUe(o,n,s,l);super(e,t,u,r,c);this.source=o;this.fileOutput=this._register(u)}clear(){this.update(3,void 0,!0)}update(e,t,o){(this.loadModelPromise?this.loadModelPromise:Promise.resolve()).then(()=>{(e===3||e===2)&&(Yo(t)?this.fileOutput.reset(t):this.fileOutput.resetToEnd()),this.doUpdate(e,o)})}updateChannelSources(e){throw new Error("Not supported")}};Xve=I([m(3,fe),m(4,Tt),m(5,F),m(6,se),m(7,Qs)],Xve);var ZUe=class extends JUe{constructor(e,t,o,n,r,s,l,c){let u=new ict(o,c,n,s);super(e,t,u,r,l);this.source=o;this.multifileOutput=this._register(u)}updateChannelSources(e){this.multifileOutput.unwatch(),this.multifileOutput.updateFiles(e),this.multifileOutput.reset(),this.doUpdate(2,!0),this.isVisible()&&this.multifileOutput.watch()}clear(){(this.loadModelPromise?this.loadModelPromise:Promise.resolve()).then(()=>{this.multifileOutput.resetToEnd(),this.doUpdate(3,!0)})}update(e,t,o){throw new Error("Not supported")}};ZUe=I([m(3,fe),m(4,Tt),m(5,se),m(6,Qs),m(7,F)],ZUe);var oct=class extends Xve{constructor(i,e,t,o,n,r,s,l,c,u){super(e,t,{resource:o,name:""},n,r,l,c,u),this.logger=s.createLogger(o,{logLevel:"always",donotRotate:!0,donotUseFormatters:!0,hidden:!0}),this._offset=0}append(i){this.write(i),this.update(1,void 0,this.isVisible())}replace(i){let e=this._offset;this.write(i),this.update(2,e,!0)}write(i){this._offset+=qe.fromString(i).byteLength,this.logger.info(i),this.isVisible()&&this.logger.flush()}};oct=I([m(4,fe),m(5,Tt),m(6,Il),m(7,F),m(8,se),m(9,Qs)],oct);var e1e=class extends x{constructor(e,t,o,n,r,s,l){super();this.instantiationService=s;this.fileService=l;this._onDispose=this._register(new E);this.onDispose=this._onDispose.event;this.outputChannelModel=this.createOutputChannelModel(e,t,o,n,r);let c=Ge(n,`${e.replace(/[\\/:\*\?"<>\|]/g,"")}.log`);this.source={resource:c}}async createOutputChannelModel(e,t,o,n,r){await r;let s=Ge(n,`${e.replace(/[\\/:\*\?"<>\|]/g,"")}.log`);await this.fileService.createFile(s);let l=this._register(this.instantiationService.createInstance(oct,e,t,o,s));return this._register(l.onDispose(()=>this._onDispose.fire())),l}getLogEntries(){return[]}append(e){this.outputChannelModel.then(t=>t.append(e))}update(e,t,o){this.outputChannelModel.then(n=>n.update(e,t,o))}loadModel(){return this.outputChannelModel.then(e=>e.loadModel())}clear(){this.outputChannelModel.then(e=>e.clear())}replace(e){this.outputChannelModel.then(t=>t.replace(e))}updateChannelSources(e){this.outputChannelModel.then(t=>t.updateChannelSources(e))}};e1e=I([m(5,F),m(6,fe)],e1e);var PVi="output.activechannel",nct=class extends x{constructor(e,t,o,n,r){super();this.outputChannelDescriptor=e;this.outputLocation=t;this.outputDirPromise=o;this.languageService=n;this.instantiationService=r;this.scrollLock=!1;this.id=e.id,this.label=e.label,this.uri=A.from({scheme:Q.outputChannel,path:this.id}),this.model=this._register(this.createOutputChannelModel(this.uri,e))}createOutputChannelModel(e,t){let o=t.languageId?this.languageService.createById(t.languageId):this.languageService.createByMimeType(t.log?$J:tPt);return UB(t)?this.instantiationService.createInstance(ZUe,e,o,[...t.source]):CA(t)?this.instantiationService.createInstance(Xve,e,o,t.source):this.instantiationService.createInstance(e1e,this.id,e,o,this.outputLocation,this.outputDirPromise)}getLogEntries(){return this.model.getLogEntries()}append(e){this.model.append(e)}update(e,t){this.model.update(e,t,!0)}clear(){this.model.clear()}replace(e){this.model.replace(e)}};nct=I([m(3,_t),m(4,F)],nct);var AVi=class extends x{constructor(e,t){super();this.contextKeyService=t;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._filterText="";this._includePatterns=[];this._excludePatterns=[];this._trace=cPt.bindTo(this.contextKeyService),this._trace.set(e.trace),this._debug=dPt.bindTo(this.contextKeyService),this._debug.set(e.debug),this._info=uPt.bindTo(this.contextKeyService),this._info.set(e.info),this._warning=pPt.bindTo(this.contextKeyService),this._warning.set(e.warning),this._error=mPt.bindTo(this.contextKeyService),this._error.set(e.error),this._categories=hPt.bindTo(this.contextKeyService),this._categories.set(e.sources),this.filterHistory=e.filterHistory}get text(){return this._filterText}set text(e){if(this._filterText!==e){this._filterText=e;let{includePatterns:t,excludePatterns:o}=this.parseText(e);this._includePatterns=t,this._excludePatterns=o,this._onDidChange.fire()}}parseText(e){let t=[],o=[],n=this.splitByCommaRespectingQuotes(e);for(let r of n){let s=r.trim();if(s.length!==0)if(s.startsWith("!")){let l=s.substring(1).trim();l.length>0&&o.push(l)}else t.push(s)}return{includePatterns:t,excludePatterns:o}}get includePatterns(){return this._includePatterns}get excludePatterns(){return this._excludePatterns}splitByCommaRespectingQuotes(e){let t=[],o="",n=!1,r="";for(let s=0;s<e.length;s++){let l=e[s];!n&&l==='"'?(n=!0,r=l,o+=l):n&&l===r?(n=!1,o+=l):!n&&l===","?(o.length>0&&t.push(o),o=""):o+=l}return o.length>0&&t.push(o),t}get trace(){return!!this._trace.get()}set trace(e){this._trace.get()!==e&&(this._trace.set(e),this._onDidChange.fire())}get debug(){return!!this._debug.get()}set debug(e){this._debug.get()!==e&&(this._debug.set(e),this._onDidChange.fire())}get info(){return!!this._info.get()}set info(e){this._info.get()!==e&&(this._info.set(e),this._onDidChange.fire())}get warning(){return!!this._warning.get()}set warning(e){this._warning.get()!==e&&(this._warning.set(e),this._onDidChange.fire())}get error(){return!!this._error.get()}set error(e){this._error.get()!==e&&(this._error.set(e),this._onDidChange.fire())}get categories(){return this._categories.get()||","}set categories(e){this._categories.set(e),this._onDidChange.fire()}toggleCategory(e){let t=this.categories;this.hasCategory(e)?this.categories=t.replace(`,${e},`,","):this.categories=`${t}${e},`}hasCategory(e){return e===","?!1:this.categories.includes(`,${e},`)}},t1e=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this.storageService=e;this.instantiationService=t;this.textModelService=o;this.logService=n;this.loggerService=r;this.lifecycleService=s;this.viewsService=l;this.defaultLogLevelsService=u;this.fileDialogService=p;this.fileService=h;this.channels=this._register(new Vt);this._onActiveOutputChannel=this._register(new E);this.onActiveOutputChannel=this._onActiveOutputChannel.event;this.outputFolderCreationPromise=null;this.activeChannelIdInStorage=this.storageService.get(PVi,1,""),this.activeOutputChannelContext=lPt.bindTo(c),this.activeOutputChannelContext.set(this.activeChannelIdInStorage),this._register(this.onActiveOutputChannel(v=>this.activeOutputChannelContext.set(v))),this.activeFileOutputChannelContext=Ano.bindTo(c),this.activeLogOutputChannelContext=oPt.bindTo(c),this.activeOutputChannelLevelSettableContext=nPt.bindTo(c),this.activeOutputChannelLevelContext=rPt.bindTo(c),this.activeOutputChannelLevelIsDefaultContext=sPt.bindTo(c),this.outputLocation=Ge(g.windowLogsPath,`output_${aft(new Date).replace(/-|:|\.\d+Z$/g,"")}`),this._register(o.registerTextModelContentProvider(Q.outputChannel,this)),this._register(t.createInstance(rre));let f=ne.as(Hv.OutputChannels);for(let v of f.getChannels())this.onDidRegisterChannel(v.id);if(this._register(f.onDidRegisterChannel(v=>this.onDidRegisterChannel(v))),this._register(f.onDidUpdateChannelSources(v=>this.onDidUpdateChannelSources(v))),this._register(f.onDidRemoveChannel(v=>this.onDidRemoveChannel(v))),!this.activeChannel){let v=this.getChannelDescriptors();this.setActiveChannel(v&&v.length>0?this.getChannel(v[0].id):void 0)}this._register(U.filter(this.viewsService.onDidChangeViewVisibility,v=>v.id===Kc&&v.visible)(()=>{this.activeChannel&&this.viewsService.getActiveViewWithId(Kc)?.showChannel(this.activeChannel,!0)})),this._register(this.loggerService.onDidChangeLogLevel(()=>{this.setLevelContext(),this.setLevelIsDefaultContext()})),this._register(this.defaultLogLevelsService.onDidChangeDefaultLogLevels(()=>{this.setLevelIsDefaultContext()})),this._register(this.lifecycleService.onDidShutdown(()=>this.dispose())),this.filters=this._register(new AVi({filterHistory:[],trace:!0,debug:!0,info:!0,warning:!0,error:!0,sources:""},c))}provideTextContent(e){let t=this.getChannel(e.path);return t?t.model.loadModel():null}async showChannel(e,t){let o=this.getChannel(e);this.activeChannel?.id!==o?.id&&(this.setActiveChannel(o),this._onActiveOutputChannel.fire(e));let n=await this.viewsService.openView(Kc,!t);n&&o&&n.showChannel(o,!!t)}getChannel(e){return this.channels.get(e)}getChannelDescriptor(e){return ne.as(Hv.OutputChannels).getChannel(e)}getChannelDescriptors(){return ne.as(Hv.OutputChannels).getChannels()}getActiveChannel(){return this.activeChannel}canSetLogLevel(e){return e.log&&e.id!==wde}getLogLevel(e){if(!e.log)return;let t=CA(e)?[e.source]:UB(e)?e.source:[];if(t.length===0)return;let o=this.loggerService.getLogLevel();return t.reduce((n,r)=>Math.min(n,this.loggerService.getLogLevel(r.resource)??o),5)}setLogLevel(e,t){if(!e.log)return;let o=CA(e)?[e.source]:UB(e)?e.source:[];if(o.length!==0)for(let n of o)this.loggerService.setLogLevel(n.resource,t)}registerCompoundLogChannel(e){let t=ne.as(Hv.OutputChannels);e.sort((n,r)=>n.label.localeCompare(r.label));let o=e.map(n=>n.id.toLowerCase()).join("-");return t.getChannel(o)||t.registerChannel({id:o,label:e.map(n=>n.label).join(", "),log:e.some(n=>n.log),user:!0,source:e.map(n=>{if(CA(n))return[{resource:n.source.resource,name:n.source.name??n.label}];if(UB(n))return n.source;let r=this.getChannel(n.id);return r?r.model.source:[]}).flat()}),o}async saveOutputAs(e,...t){let o;if(t.length>1){let n=this.registerCompoundLogChannel(t);o=this.getChannel(n)}else o=this.getChannel(t[0].id);if(o)try{let n=e;if(!n){let s=t.length>1?"output":t[0].label;n=await this.fileDialogService.showSaveDialog({title:d(12934,null),availableFileSystems:[Q.file],defaultUri:Ge(await this.fileDialogService.defaultFilePath(),`${s}.log`),filters:[{name:s,extensions:["log"]}]})}if(!n)return;let r=await this.textModelService.createModelReference(o.uri);try{await this.fileService.writeFile(n,qe.fromString(r.object.textEditorModel.getValue()))}finally{r.dispose()}return}finally{t.length>1&&ne.as(Hv.OutputChannels).removeChannel(o.id)}}async onDidRegisterChannel(e){let t=this.createChannel(e);this.channels.set(e,t),(!this.activeChannel||this.activeChannelIdInStorage===e)&&(this.setActiveChannel(t),this._onActiveOutputChannel.fire(e),this.viewsService.getActiveViewWithId(Kc)?.showChannel(t,!0))}onDidUpdateChannelSources(e){let t=this.channels.get(e.id);t&&t.model.updateChannelSources(e.source)}onDidRemoveChannel(e){if(this.activeChannel?.id===e.id){let t=this.getChannelDescriptors();t[0]&&this.showChannel(t[0].id)}this.channels.deleteAndDispose(e.id)}createChannel(e){let t=this.instantiateChannel(e);return this._register(U.once(t.model.onDispose)(()=>{if(this.activeChannel===t){let o=this.getChannelDescriptors(),n=o.length?this.getChannel(o[0].id):void 0;n&&this.viewsService.isViewVisible(Kc)?this.showChannel(n.id):this.setActiveChannel(void 0)}ne.as(Hv.OutputChannels).removeChannel(e)})),t}instantiateChannel(e){let t=ne.as(Hv.OutputChannels).getChannel(e);if(!t)throw this.logService.error(`Channel '${e}' is not registered yet`),new Error(`Channel '${e}' is not registered yet`);return this.outputFolderCreationPromise||(this.outputFolderCreationPromise=this.fileService.createFolder(this.outputLocation).then(()=>{})),this.instantiationService.createInstance(nct,t,this.outputLocation,this.outputFolderCreationPromise)}setLevelContext(){let e=this.activeChannel?.outputChannelDescriptor,t=e?this.getLogLevel(e):void 0;this.activeOutputChannelLevelContext.set(t!==void 0?IC(t):"")}async setLevelIsDefaultContext(){let e=this.activeChannel?.outputChannelDescriptor,t=e?this.getLogLevel(e):void 0;if(t!==void 0){let o=this.defaultLogLevelsService.getDefaultLogLevel(e?.extensionId);this.activeOutputChannelLevelIsDefaultContext.set(o===t)}else this.activeOutputChannelLevelIsDefaultContext.set(!1)}setActiveChannel(e){this.activeChannel=e;let t=e?.outputChannelDescriptor;this.activeFileOutputChannelContext.set(!!t&&CA(t)),this.activeLogOutputChannelContext.set(!!t?.log),this.activeOutputChannelLevelSettableContext.set(t!==void 0&&this.canSetLogLevel(t)),this.setLevelIsDefaultContext(),this.setLevelContext(),this.activeChannel?this.storageService.store(PVi,this.activeChannel.id,1,1):this.storageService.remove(PVi,1)}};t1e=I([m(0,ce),m(1,F),m(2,Bt),m(3,se),m(4,Il),m(5,ji),m(6,$t),m(7,X),m(8,zD),m(9,rn),m(10,fe),m(11,At)],t1e);var i1e=class extends o0{constructor(e,t,o,n,r,s,l,c,u,p,h,g){let f=new Al(Rr.MARKERS_VIEW_STORAGE_ID,g),v=f.getMemento(1,1);super({...e,filterOptions:{placeholder:d(12938,null),focusContextKey:p_e.key,text:v.filter||"",history:[]}},t,o,n,r,s,l,c,u,p);this.outputService=h;this.editorPromise=null;this.memento=f,this.panelState=v;let b=h.filters;b.text=this.panelState.filter||"",b.trace=this.panelState.showTrace??!0,b.debug=this.panelState.showDebug??!0,b.info=this.panelState.showInfo??!0,b.warning=this.panelState.showWarning??!0,b.error=this.panelState.showError??!0,b.categories=this.panelState.categories??"",this.scrollLockContextKey=aPt.bindTo(this.contextKeyService);let S=this._register(l.createChild(new _o([X,this.scopedContextKeyService])));this.editor=this._register(S.createInstance(rct)),this._register(this.editor.onTitleAreaUpdate(()=>{this.updateTitle(this.editor.getTitle()),this.updateActions()})),this._register(this.onDidChangeBodyVisibility(()=>this.onDidChangeVisibility(this.isBodyVisible()))),this._register(this.filterWidget.onDidChangeFilterText(y=>h.filters.text=y)),this.checkMoreFilters(),this._register(h.filters.onDidChange(()=>this.checkMoreFilters()))}get scrollLock(){return!!this.scrollLockContextKey.get()}set scrollLock(e){this.scrollLockContextKey.set(e)}showChannel(e,t){this.channelId!==e.id&&this.setInput(e),t||this.focus()}focus(){super.focus(),this.editorPromise?.then(()=>this.editor.focus())}clearFilterText(){this.filterWidget.setFilterText("")}renderBody(e){super.renderBody(e),this.editor.create(e),e.classList.add("output-view");let t=this.editor.getControl();t.setAriaOptions({role:"document",activeDescendant:void 0}),this._register(t.onDidChangeModelContent(()=>{this.scrollLock||this.editor.revealLastLine()})),this._register(t.onDidChangeCursorPosition(o=>{if(o.reason!==3||!this.configurationService.getValue("output.smartScroll.enabled"))return;let n=t.getModel();if(n){let r=o.position.lineNumber,s=n.getLineCount();this.scrollLock=s!==r}}))}layoutBodyContent(e,t){this.editor.layout(new si(t,e))}onDidChangeVisibility(e){this.editor.setVisible(e),e||this.clearInput()}setInput(e){this.channelId=e.id,this.checkMoreFilters();let t=this.createInput(e);(!this.editor.input||!t.matches(this.editor.input))&&(this.editorPromise?.cancel(),this.editorPromise=Ln(o=>this.editor.setInput(t,{preserveFocus:!0},Object.create(null),o)))}checkMoreFilters(){let e=this.outputService.filters;this.filterWidget.checkMoreFilters(!e.trace||!e.debug||!e.info||!e.warning||!e.error||!!this.channelId&&e.categories.includes(`,${this.channelId}:`))}clearInput(){this.channelId=void 0,this.editor.clearInput(),this.editorPromise=null}createInput(e){return this.instantiationService.createInstance($C,e.uri,d(12937,null,e.label),d(12935,null,e.label),void 0,void 0)}saveState(){let e=this.outputService.filters;this.panelState.filter=e.text,this.panelState.showTrace=e.trace,this.panelState.showDebug=e.debug,this.panelState.showInfo=e.info,this.panelState.showWarning=e.warning,this.panelState.showError=e.error,this.panelState.categories=e.categories,this.memento.saveMemento(),super.saveState()}};i1e=I([m(1,_e),m(2,Xe),m(3,B),m(4,X),m(5,Bi),m(6,F),m(7,Je),m(8,Le),m(9,nt),m(10,kl),m(11,ce)],i1e);var rct=class extends Upe{constructor(e,t,o,n,r,s,l,c,u){super(Kc,l.activeGroup,e,t,o,r,s,l,c,u);this.configurationService=n;this.resourceContext=this._register(t.createInstance(Wo))}getId(){return Kc}getTitle(){return d(12936,null)}getConfigurationOverrides(e){let t=super.getConfigurationOverrides(e);t.wordWrap="on",t.lineNumbers="off",t.glyphMargin=!1,t.lineDecorationsWidth=20,t.rulers=[],t.folding=!1,t.scrollBeyondLastLine=!1,t.renderLineHighlight="none",t.minimap={enabled:!1},t.renderValidationDecorations="editable",t.padding=void 0,t.readOnly=!0,t.domReadOnly=!0,t.roundedSelection=!1,t.unicodeHighlight={nonBasicASCII:!1,invisibleCharacters:!1,ambiguousCharacters:!1};let o=this.configurationService.getValue("[Log]");return o&&(o["editor.minimap.enabled"]&&(t.minimap={enabled:!0}),o["editor.wordWrap"]&&(t.wordWrap=o["editor.wordWrap"])),t}getAriaLabel(){return this.input?this.input.getAriaLabel():d(12939,null)}computeAriaLabel(){return this.input?IJ(this.input,void 0,void 0,this.editorGroupService.count):this.getAriaLabel()}async setInput(e,t,o,n){let r=!(t&&t.preserveFocus);this.input&&e.matches(this.input)||(this.input&&this.input.dispose(),await super.setInput(e,t,o,n),this.resourceContext.set(e.resource),r&&this.focus(),this.revealLastLine())}clearInput(){this.input&&this.input.dispose(),super.clearInput(),this.resourceContext.reset()}createEditor(e){e.setAttribute("role","document"),super.createEditor(e);let t=this.scopedContextKeyService;t&&iPt.bindTo(t).set(!0)}_getContributions(){return[...Ba.getEditorContributions(),{id:o1e.ID,ctor:o1e,instantiation:0}]}getCodeEditorWidgetOptions(){return{contributions:this._getContributions()}}};rct=I([m(0,Te),m(1,F),m(2,ce),m(3,B),m(4,Fn),m(5,Le),m(6,wt),m(7,ee),m(8,fe)],rct);var o1e=class extends x{constructor(e,t){super();this.editor=e;this.outputService=t;this.modelDisposables=this._register(new N);this.hiddenAreas=[];this.categories=new Map;this.decorationsCollection=e.createDecorationsCollection(),this._register(e.onDidChangeModel(()=>this.onDidChangeModel())),this._register(this.outputService.filters.onDidChange(()=>e.hasModel()&&this.filter(e.getModel())))}static{this.ID="output.editor.contrib.filterController"}onDidChangeModel(){if(this.modelDisposables.clear(),this.hiddenAreas=[],this.categories.clear(),!this.editor.hasModel())return;let e=this.editor.getModel();this.filter(e);let t=()=>{let n=e.getLineCount();return n>1&&e.getLineMaxColumn(n)===1?n-1:n},o=t();this.modelDisposables.add(e.onDidChangeContent(n=>{n.changes.every(r=>r.range.startLineNumber>o)?this.filterIncremental(e,o+1):this.filter(e),o=t()}))}filter(e){this.hiddenAreas=[],this.decorationsCollection.clear(),this.filterIncremental(e,1)}filterIncremental(e,t){let{findMatches:o,hiddenAreas:n,categories:r}=this.compute(e,t);if(this.hiddenAreas.push(...n),this.editor.setHiddenAreas(this.hiddenAreas,this),o.length&&this.decorationsCollection.append(o),r.size){let s=this;for(let[l,c]of r)this.categories.has(l)||(this.categories.set(l,c),this.modelDisposables.add(W(class extends K{constructor(){super({id:`workbench.actions.${Kc}.toggle.${l}`,title:c,toggled:C.regex(hPt.key,new RegExp(`.*,${ns(l)},.*`)).negate(),menu:{id:ex,group:"1_category_filter",when:C.and(C.equals("view",Kc))}})}async run(){s.outputService.filters.toggleCategory(l)}})))}}shouldShowLine(e,t,o,n){let r=[];if(n.length>0){for(let s of n)if(e.findMatches(s,t,!1,!1,null,!1).length>0)return{show:!1,matches:[]}}if(o.length>0){let s=!1;for(let l of o){let c=e.findMatches(l,t,!1,!1,null,!1);if(c.length>0){s=!0;for(let u of c)r.push({range:u.range,options:a5._FIND_MATCH_DECORATION})}}return{show:s,matches:r}}return{show:!0,matches:r}}compute(e,t){let o=this.outputService.filters,n=this.outputService.getActiveChannel(),r=[],s=[],l=new Map,c=n?.getLogEntries();if(n&&c?.length){let p=!o.trace||!o.debug||!o.info||!o.warning||!o.error,h=c.findIndex(g=>t>=g.range.startLineNumber&&t<=g.range.endLineNumber);if(h===-1)return{findMatches:r,hiddenAreas:s,categories:l};for(let g=h;g<c.length;g++){let f=c[g];if(f.category&&l.set(`${n.id}:${f.category}`,f.category),p&&!this.shouldShowLogLevel(f,o)){s.push(f.range);continue}if(!this.shouldShowCategory(n.id,f,o)){s.push(f.range);continue}if(o.includePatterns.length>0||o.excludePatterns.length>0){let v=this.shouldShowLine(e,f.range,o.includePatterns,o.excludePatterns);v.show?r.push(...v.matches):s.push(f.range)}}return{findMatches:r,hiddenAreas:s,categories:l}}if(o.includePatterns.length===0&&o.excludePatterns.length===0)return{findMatches:r,hiddenAreas:s,categories:l};let u=e.getLineCount();for(let p=t;p<=u;p++){let h=new z(p,1,p,e.getLineMaxColumn(p)),g=this.shouldShowLine(e,h,o.includePatterns,o.excludePatterns);g.show?r.push(...g.matches):s.push(h)}return{findMatches:r,hiddenAreas:s,categories:l}}shouldShowLogLevel(e,t){switch(e.logLevel){case 1:return t.trace;case 2:return t.debug;case 3:return t.info;case 4:return t.warning;case 5:return t.error}return!0}shouldShowCategory(e,t,o){return t.category?!o.hasCategory(`${e}:${t.category}`):!0}};o1e=I([m(1,kl)],o1e);var $3t=class{constructor(){this.type="help";this.priority=105;this.name="outputFilter";this.when=p_e}getProvider(i){return new NVi(i.get(_e))}},NVi=class extends x{constructor(e){super();this._keybindingService=e;this.id="outputFindHelp";this.verbositySettingKey="accessibility.verbosity.find";this.options={type:"help"}}provideContent(){let e=[];return e.push(d(12915,null)),e.push(d(12907,null)),e.push(""),e.push(d(12927,null)),e.push(d(12926,null)),e.push(""),e.push(d(12917,null)),e.push(d(12916,null)),e.push(""),e.push(d(12910,null)),e.push(d(12908,null)),e.push(d(12909,null)),e.push(""),e.push(d(12914,null)),e.push(d(12911,null)),e.push(d(12912,null)),e.push(d(12913,null)),e.push(""),e.push(d(12931,null)),e.push(d(12933,null)),e.push(d(12930,null)),e.push(d(12928,null)),e.push(d(12932,null)),e.push(d(12929,null)),e.push(""),e.push(d(12918,null)),e.push(d(12919,null)),e.push(d(12921,null)),e.push(d(12920,null)),e.push(""),e.push(d(12922,null,this._describeCommand("workbench.action.openSettings")||"Ctrl+,")),e.push(d(12923,null)),e.push(d(12925,null)),e.push(d(12924,null)),e.push(""),e.push(d(12906,null)),e.push(d(12905,null)),e.join(`
`)}_describeCommand(e){return this._keybindingService.lookupKeybinding(e)?.getAriaLabel()??void 0}onClose(){}};var fhn="importedLog.";Ee(kl,t1e,1);ga.register(new $3t);wP.registerLanguage({id:d_e,extensions:[],mimetypes:[tPt]});wP.registerLanguage({id:u_e,extensions:[],mimetypes:[$J]});var S_o=Ae("output-view-icon",R.output,d(12892,null)),vhn=ne.as(Mn.ViewContainersRegistry).registerViewContainer({id:Kc,title:L(12887,"Output"),icon:S_o,order:1,ctorDescriptor:new Ft(Dc,[Kc,{mergeViewWithContainerWhenSingleView:!0}]),storageId:Kc,hideIfEmpty:!0},1,{doNotRegisterOpenCommand:!0});ne.as(Mn.ViewsRegistry).registerViews([{id:Kc,name:L(12887,"Output"),containerIcon:S_o,canMoveView:!0,canToggleVisibility:!0,ctorDescriptor:new Ft(i1e),openCommandActionDescriptor:{id:"workbench.action.output.toggleOutput",mnemonicTitle:d(12882,null),keybindings:{primary:3123,linux:{primary:Vi(2089,2086)}},order:1}}],vhn);var sct=class extends x{constructor(e,t){super();this.outputService=e;this.editorService=t;this.registerActions()}registerActions(){this.registerSwitchOutputAction(),this.registerAddCompoundLogAction(),this.registerRemoveLogAction(),this.registerShowOutputChannelsAction(),this.registerClearOutputAction(),this.registerToggleAutoScrollAction(),this.registerOpenActiveOutputFileAction(),this.registerOpenActiveOutputFileInAuxWindowAction(),this.registerSaveActiveOutputAsAction(),this.registerShowLogsAction(),this.registerOpenLogFileAction(),this.registerConfigureActiveOutputLogLevelAction(),this.registerLogLevelFilterActions(),this.registerClearFilterActions(),this.registerExportLogsAction(),this.registerImportLogAction()}registerSwitchOutputAction(){this._register(W(class extends K{constructor(){super({id:"workbench.output.action.switchBetweenOutputs",title:d(12900,null)})}async run(r,s){s&&r.get(kl).showChannel(s,!0)}}));let e=new D("workbench.output.menu.switchOutput");this._register(ve.appendMenuItem(D.ViewTitle,{submenu:e,title:d(12901,null),group:"navigation",when:C.equals("view",Kc),order:1,isSelection:!0}));let t=new Map;this._register(Z(()=>Be(t.values())));let o=r=>{for(let s of r){let l=s.label,c=s.user?"2_user_outputchannels":s.extensionId?"0_ext_outputchannels":"1_core_outputchannels";t.set(s.id,W(class extends K{constructor(){super({id:`workbench.action.output.show.${s.id}`,title:l,toggled:lPt.isEqualTo(s.id),menu:{id:e,group:c}})}async run(u){return u.get(kl).showChannel(s.id,!0)}}))}};o(this.outputService.getChannelDescriptors());let n=ne.as(Hv.OutputChannels);this._register(n.onDidRegisterChannel(r=>{let s=this.outputService.getChannelDescriptor(r);s&&o([s])})),this._register(n.onDidRemoveChannel(r=>{t.get(r.id)?.dispose(),t.delete(r.id)}))}registerAddCompoundLogAction(){this._register(W(class extends K{constructor(){super({id:"workbench.action.output.addCompoundLog",title:L(12871,"Add Compound Log..."),category:L(12887,"Output"),f1:!0,menu:[{id:D.ViewTitle,when:C.equals("view",Kc),group:"2_add"}]})}async run(e){let t=e.get(kl),o=e.get(Ue),n=[],r=[];for(let c of t.getChannelDescriptors())c.log&&!c.user&&(c.extensionId?n.push(c):r.push(c));let s=[];for(let c of r.sort((u,p)=>u.label.localeCompare(p.label)))s.push(c);n.length&&r.length&&s.push({type:"separator",label:d(12875,null)});for(let c of n.sort((u,p)=>u.label.localeCompare(p.label)))s.push(c);let l=await o.pick(s,{placeHolder:d(12895,null),canPickMany:!0});l?.length&&t.showChannel(t.registerCompoundLogChannel(l))}}))}registerRemoveLogAction(){this._register(W(class extends K{constructor(){super({id:"workbench.action.output.remove",title:L(12893,"Remove Output..."),category:L(12887,"Output"),f1:!0})}async run(e){let t=e.get(kl),o=e.get(Ue),n=e.get(Ne),r=t.getChannelDescriptors().filter(c=>c.user);if(r.length===0){n.info(d(12883,null));return}let s=await o.pick(r,{placeHolder:d(12895,null),canPickMany:!0});if(!s?.length)return;let l=ne.as(Hv.OutputChannels);for(let c of s)l.removeChannel(c.id)}}))}registerShowOutputChannelsAction(){this._register(W(class extends K{constructor(){super({id:"workbench.action.showOutputChannels",title:L(12899,"Show Output Channels..."),category:L(12887,"Output"),f1:!0})}async run(e){let t=e.get(kl),o=e.get(Ue),n=[],r=[];for(let c of t.getChannelDescriptors())c.extensionId?n.push(c):r.push(c);let s=[];for(let{id:c,label:u}of n)s.push({id:c,label:u});n.length&&r.length&&s.push({type:"separator"});for(let{id:c,label:u}of r)s.push({id:c,label:u});let l=await o.pick(s,{placeHolder:d(12897,null)});if(l)return t.showChannel(l.id)}}))}registerClearOutputAction(){this._register(W(class extends K{constructor(){super({id:"workbench.output.action.clearOutput",title:L(12873,"Clear Output"),category:Ve.View,menu:[{id:D.ViewTitle,when:C.equals("view",Kc),group:"navigation",order:2},{id:D.CommandPalette},{id:D.EditorContext,when:iPt}],icon:R.clearAll})}async run(e){let t=e.get(kl),o=e.get(lr),n=t.getActiveChannel();n&&(n.clear(),o.playSignal($o.clear))}}))}registerToggleAutoScrollAction(){this._register(W(class extends K{constructor(){super({id:"workbench.output.action.toggleAutoScroll",title:L(12902,"Toggle Auto Scrolling"),tooltip:d(12890,null),menu:{id:D.ViewTitle,when:C.and(C.equals("view",Kc)),group:"navigation",order:3},icon:R.lock,toggled:{condition:aPt,icon:R.unlock,tooltip:d(12891,null)}})}async run(e){let t=e.get($t).getActiveViewWithId(Kc);t.scrollLock=!t.scrollLock}}))}registerOpenActiveOutputFileAction(){let e=this;this._register(W(class extends K{constructor(){super({id:"workbench.action.openActiveLogOutputFile",title:L(12884,"Open Output in Editor"),menu:[{id:D.ViewTitle,when:C.equals("view",Kc),group:"navigation",order:4,isHiddenByDefault:!0}],icon:R.goToFile})}async run(){e.openActiveOutput()}}))}registerOpenActiveOutputFileInAuxWindowAction(){let e=this;this._register(W(class extends K{constructor(){super({id:"workbench.action.openActiveLogOutputFileInNewWindow",title:L(12885,"Open Output in New Window"),menu:[{id:D.ViewTitle,when:C.equals("view",Kc),group:"navigation",order:5,isHiddenByDefault:!0}],icon:R.emptyWindow})}async run(){e.openActiveOutput(Mg)}}))}registerSaveActiveOutputAsAction(){this._register(W(class extends K{constructor(){super({id:"workbench.action.saveActiveLogOutputAs",title:L(12894,"Save Output As..."),menu:[{id:D.ViewTitle,when:C.equals("view",Kc),group:"1_export",order:1}]})}async run(e){let t=e.get(kl),o=t.getActiveChannel();if(o){let n=t.getChannelDescriptors().find(r=>r.id===o.id);n&&await t.saveOutputAs(void 0,n)}}}))}async openActiveOutput(e){let t=this.outputService.getActiveChannel();t&&await this.editorService.openEditor({resource:t.uri,options:{pinned:!0}},e)}registerConfigureActiveOutputLogLevelAction(){let e=new D("workbench.output.menu.logLevel");this._register(ve.appendMenuItem(D.ViewTitle,{submenu:e,title:d(12880,null),group:"navigation",when:C.and(C.equals("view",Kc),nPt),icon:R.gear,order:6}));let t=0,o=n=>{this._register(W(class extends K{constructor(){super({id:`workbench.action.output.activeOutputLogLevel.${n}`,title:Q$e(n).value,toggled:rPt.isEqualTo(IC(n)),menu:{id:e,order:t++,group:"0_level"}})}async run(r){let s=r.get(kl),l=s.getActiveChannel();if(l){let c=s.getChannelDescriptor(l.id);c&&s.setLogLevel(c,n)}}}))};o(1),o(2),o(3),o(4),o(5),o(0),this._register(W(class extends K{constructor(){super({id:"workbench.action.output.activeOutputLogLevelDefault",title:d(12881,null),menu:{id:e,order:t,group:"1_default"},precondition:sPt.negate()})}async run(n){let r=n.get(kl),s=n.get(Il),l=n.get(zD),c=r.getActiveChannel();if(c){let u=r.getChannelDescriptor(c.id);if(u&&CA(u)){let p=s.getLogLevel(u.source.resource);return await l.setDefaultLogLevel(p,u.extensionId)}}}}))}registerShowLogsAction(){this._register(W(class extends K{constructor(){super({id:"workbench.action.showLogs",title:L(12898,"Show Logs..."),category:Ve.Developer,menu:{id:D.CommandPalette}})}async run(e){let t=e.get(kl),o=e.get(Ue),n=[],r=[];for(let c of t.getChannelDescriptors())c.log&&(c.extensionId?n.push(c):r.push(c));let s=[];for(let{id:c,label:u}of r)s.push({id:c,label:u});n.length&&r.length&&s.push({type:"separator",label:d(12875,null)});for(let{id:c,label:u}of n)s.push({id:c,label:u});let l=await o.pick(s,{placeHolder:d(12895,null)});if(l)return t.showChannel(l.id)}}))}registerOpenLogFileAction(){this._register(W(class extends K{constructor(){super({id:"workbench.action.openLogFile",title:L(12886,"Open Log..."),category:Ve.Developer,menu:{id:D.CommandPalette},metadata:{description:"workbench.action.openLogFile",args:[{name:"logFile",schema:{markdownDescription:d(12878,null),type:"string"}}]}})}async run(e,t){let o=e.get(kl),n=e.get(Ue),r=e.get(ee),s,l=t&&typeof t=="string"?t:void 0,c=[],u=[];for(let p of o.getChannelDescriptors())if(p.log){let h={id:p.id,label:p.label};p.extensionId?c.push(h):u.push(h),h.id===l&&(s=h)}if(!s){let p=[...c.sort((h,g)=>h.label.localeCompare(g.label))];p.length&&u.length&&(p.push({type:"separator"}),p.push(...u.sort((h,g)=>h.label.localeCompare(g.label)))),s=await n.pick(p,{placeHolder:d(12896,null)})}if(s?.id){let p=o.getChannel(s.id);p&&await r.openEditor({resource:p.uri,options:{pinned:!0}})}}}))}registerLogLevelFilterActions(){let e=0,t=(o,n)=>{this._register(W(class extends Yn{constructor(){super({id:`workbench.actions.${Kc}.toggle.${IC(o)}`,title:Q$e(o).value,metadata:{description:L(12903,"Show or hide {0} messages in the output",IC(o))},toggled:n,menu:{id:ex,group:"2_log_filter",when:C.and(C.equals("view",Kc),oPt),order:e++},viewId:Kc})}async runInView(r,s){this.toggleLogLevelFilter(r.get(kl),o)}toggleLogLevelFilter(r,s){switch(s){case 1:r.filters.trace=!r.filters.trace;break;case 2:r.filters.debug=!r.filters.debug;break;case 3:r.filters.info=!r.filters.info;break;case 4:r.filters.warning=!r.filters.warning;break;case 5:r.filters.error=!r.filters.error;break}}}))};t(1,cPt),t(2,dPt),t(3,uPt),t(4,pPt),t(5,mPt)}registerClearFilterActions(){this._register(W(class extends Yn{constructor(){super({id:`workbench.actions.${Kc}.clearFilterText`,title:d(12872,null),keybinding:{when:p_e,weight:200,primary:9},viewId:Kc})}async runInView(e,t){t.clearFilterText()}}))}registerExportLogsAction(){this._register(W(class extends K{constructor(){super({id:"workbench.action.exportLogs",title:L(12874,"Export Logs..."),f1:!0,category:Ve.Developer,menu:[{id:D.ViewTitle,when:C.equals("view",Kc),group:"1_export",order:2}]})}async run(e,t){let o=e.get(kl),n=e.get(Ue),r=[],s=[],l=[];for(let p of o.getChannelDescriptors())p.log&&(p.extensionId?r.push(p):p.user?l.push(p):s.push(p));let c=[];for(let p of s.sort((h,g)=>h.label.localeCompare(g.label)))c.push(p);r.length&&s.length&&c.push({type:"separator",label:d(12875,null)});for(let p of r.sort((h,g)=>h.label.localeCompare(g.label)))c.push(p);l.length&&(r.length||s.length)&&c.push({type:"separator",label:d(12904,null)});for(let p of l.sort((h,g)=>h.label.localeCompare(g.label)))c.push(p);let u;if(t?.outputChannelIds){let p=t.outputChannelIds.map(g=>g.trim().toLowerCase()),h=c.filter(g=>!(No(g,{type:!0})&&g.type==="separator"));p.includes("*")?u=h:u=h.filter(g=>p.includes(g.id.toLowerCase()))}else u=await n.pick(c,{placeHolder:d(12895,null),canPickMany:!0});u?.length&&await o.saveOutputAs(t?.outputPath,...u)}}))}registerImportLogAction(){this._register(W(class extends K{constructor(){super({id:"workbench.action.importLog",title:L(12876,"Import Log..."),f1:!0,category:Ve.Developer,menu:[{id:D.ViewTitle,when:C.equals("view",Kc),group:"2_add",order:2}]})}async run(e){let t=e.get(kl),n=await e.get(rn).showOpenDialog({title:d(12877,null),canSelectFiles:!0,canSelectFolders:!1,canSelectMany:!0,filters:[{name:d(12879,null),extensions:["log"]}]});if(n?.length){let r=He(n[0]),s=`${fhn}${Date.now()}`;ne.as(Hv.OutputChannels).registerChannel({id:s,label:r,log:!0,user:!0,source:n.length===1?{resource:n[0]}:n.map(l=>({resource:l,name:He(l).split(".")[0]}))}),t.showChannel(s)}}}))}};sct=I([m(0,kl),m(1,ee)],sct);ne.as(Qi.Workbench).registerWorkbenchContribution(sct,3);ne.as(Jt.Configuration).registerConfiguration({id:"output",order:30,title:d(12888,null),type:"object",properties:{"output.smartScroll.enabled":{type:"boolean",description:d(12889,null),default:!0,scope:4,tags:["output"]}}});Ct.registerKeybindingRule({id:"cursorWordAccessibilityLeft",when:C.and(pe.textInputFocus,$a,ww,C.equals(ql.key,Kc)),primary:2063,weight:200});Ct.registerKeybindingRule({id:"cursorWordAccessibilityLeftSelect",when:C.and(pe.textInputFocus,$a,ww,C.equals(ql.key,Kc)),primary:3087,weight:200});Ct.registerKeybindingRule({id:"cursorWordAccessibilityRight",when:C.and(pe.textInputFocus,$a,ww,C.equals(ql.key,Kc)),primary:2065,weight:200});Ct.registerKeybindingRule({id:"cursorWordAccessibilityRightSelect",when:C.and(pe.textInputFocus,$a,ww,C.equals(ql.key,Kc)),primary:3089,weight:200});var n1e=class extends x{constructor(e,t,o){super();this._loggerService=e;this._logger=this._loggerService.createLogger(Ge(o.logsHome,"terminal.log"),{id:"terminal",name:d(2373,null)}),this._register(U.runAndSubscribe(t.onDidChangeWorkspaceFolders,()=>{this._workspaceId=t.getWorkspace().id.substring(0,7)}))}get onDidChangeLogLevel(){return this._logger.onDidChangeLogLevel}getLevel(){return this._logger.getLevel()}setLevel(e){this._logger.setLevel(e)}flush(){this._logger.flush()}trace(e,...t){this._logger.trace(this._formatMessage(e),t)}debug(e,...t){this._logger.debug(this._formatMessage(e),t)}info(e,...t){this._logger.info(this._formatMessage(e),t)}warn(e,...t){this._logger.warn(this._formatMessage(e),t)}error(e,...t){if(e instanceof Error){this._logger.error(this._formatMessage(""),e,t);return}this._logger.error(this._formatMessage(e),t)}_formatMessage(e){return this._logger.getLevel()===1?`[${this._workspaceId}] ${e}`:e}};n1e=I([m(0,Il),m(1,Pe),m(2,Eo)],n1e);var r1e=class{constructor(i){this._viewsService=i}getEditableData(i){return this._editable&&this._editable.instance===i?this._editable.data:void 0}setEditable(i,e){e?this._editable={instance:i,data:e}:this._editable=void 0;let t=this._viewsService.getActiveViewWithId(Sc),o=this.isEditable(i);t?.terminalTabbedView?.setEditable(o)}isEditable(i){return!!this._editable&&(this._editable.instance===i||!i)}getEditingTerminal(){return this._editingTerminal}setEditingTerminal(i){this._editingTerminal=i}};r1e=I([m(0,$t)],r1e);var y_o=`
- `+["`${cwd}`: "+d(14972,null),"`${cwdFolder}`: "+d(14973,null),"`${workspaceFolder}`: "+d(15132,null),"`${workspaceFolderName}`: "+d(15133,null),"`${local}`: "+d(14980,null),"`${process}`: "+d(14983,null),"`${progress}`: "+d(14984,null),"`${separator}`: "+d(14985,null,"(` - `)"),"`${sequence}`: "+d(14986,null),"`${task}`: "+d(14990,null),"`${shellType}`: "+d(14989,null),"`${shellCommand}`: "+d(14987,null),"`${shellPromptInput}`: "+d(14988,null)].join(`
- `),w_o=d(15131,null);w_o+=y_o;var C_o=d(15129,null);C_o+=y_o;var OVi=Ze?12:14,I_o={"terminal.integrated.sendKeybindingsToShell":{markdownDescription:d(15081,null,"`#terminal.integrated.commandsToSkipShell#`"),type:"boolean",default:!1},"terminal.integrated.tabs.defaultColor":{description:d(15097,null),...Ugi,scope:5},"terminal.integrated.tabs.defaultIcon":{description:d(15098,null),...zgi,default:R.terminal.id,scope:5},"terminal.integrated.tabs.enabled":{description:d(15100,null),type:"boolean",default:!0},"terminal.integrated.tabs.enableAnimation":{description:d(15099,null),type:"boolean",default:!0},"terminal.integrated.tabs.hideCondition":{description:d(15104,null),type:"string",enum:["never","singleTerminal","singleGroup"],enumDescriptions:[d(15105,null),d(15107,null),d(15106,null)],default:"singleTerminal"},"terminal.integrated.tabs.showActiveTerminal":{description:d(15117,null),type:"string",enum:["always","singleTerminal","singleTerminalOrNarrow","never"],enumDescriptions:[d(15118,null),d(15120,null),d(15121,null),d(15119,null)],default:"singleTerminalOrNarrow"},"terminal.integrated.tabs.showActions":{description:d(15112,null),type:"string",enum:["always","singleTerminal","singleTerminalOrNarrow","never"],enumDescriptions:[d(15113,null),d(15115,null),d(15116,null),d(15114,null)],default:"singleTerminalOrNarrow"},"terminal.integrated.tabs.location":{type:"string",enum:["left","right"],enumDescriptions:[d(15109,null),d(15110,null)],default:"right",description:d(15108,null)},"terminal.integrated.defaultLocation":{type:"string",enum:["editor","view"],enumDescriptions:[d(15015,null),d(15016,null)],default:"view",description:d(15014,null)},"terminal.integrated.tabs.focusMode":{type:"string",enum:["singleClick","doubleClick"],enumDescriptions:[d(15103,null),d(15102,null)],default:"doubleClick",description:d(15101,null)},"terminal.integrated.macOptionIsMeta":{description:d(15063,null),type:"boolean",default:!1},"terminal.integrated.macOptionClickForcesSelection":{description:d(15062,null),type:"boolean",default:!1},"terminal.integrated.altClickMovesCursor":{markdownDescription:d(14995,null,"`#editor.multiCursorModifier#`","`'alt'`"),type:"boolean",default:!0},"terminal.integrated.copyOnSelection":{description:d(15007,null),type:"boolean",default:!1},"terminal.integrated.enableMultiLinePasteWarning":{markdownDescription:d(15029,null),type:"string",enum:["auto","always","never"],markdownEnumDescriptions:[d(15031,null),d(15030,null),d(15032,null)],default:"auto"},"terminal.integrated.drawBoldTextInBrightColors":{description:d(15024,null),type:"boolean",default:!0},"terminal.integrated.fontFamily":{markdownDescription:d(15045,null,"`#editor.fontFamily#`"),type:"string"},"terminal.integrated.fontLigatures.enabled":{markdownDescription:d(15046,null,"`#terminal.integrated.fontFamily#`"),type:"boolean",default:!1},"terminal.integrated.fontLigatures.featureSettings":{markdownDescription:d(15048,null)+`

- `+['`"calt" off, "ss03"`','`"liga" on`','`"calt" off, "dlig" on`'].join(`
- `),type:"string",default:'"calt" on'},"terminal.integrated.fontLigatures.fallbackLigatures":{markdownDescription:d(15047,null,"`#terminal.integrated.gpuAcceleration#`","`#terminal.integrated.fontFamily#`"),type:"array",items:[{type:"string"}],default:["<--","<---","<<-","<-","->","->>","-->","--->","<==","<===","<<=","<=","=>","=>>","==>","===>",">=",">>=","<->","<-->","<--->","<---->","<=>","<==>","<===>","<====>","::",":::","<~~","</","</>","/>","~~>","==","!=","/=","~=","<>","===","!==","!===","<:",":=","*=","*+","<*","<*>","*>","<|","<|>","|>","+*","=*","=:",":>","/*","*/","+++","<!--","<!---"]},"terminal.integrated.fontSize":{description:d(15049,null),type:"number",default:OVi,minimum:6,maximum:100},"terminal.integrated.letterSpacing":{description:d(15060,null),type:"number",default:aMt},"terminal.integrated.lineHeight":{description:d(15061,null),type:"number",default:lMt},"terminal.integrated.minimumContrastRatio":{markdownDescription:d(15067,null),type:"number",default:4.5,tags:["accessibility"]},"terminal.integrated.tabStopWidth":{markdownDescription:d(15122,null),type:"number",minimum:1,default:8},"terminal.integrated.fastScrollSensitivity":{markdownDescription:d(15040,null),type:"number",default:5},"terminal.integrated.mouseWheelScrollSensitivity":{markdownDescription:d(15068,null),type:"number",default:1},"terminal.integrated.bellDuration":{markdownDescription:d(14996,null),type:"number",default:1e3},"terminal.integrated.fontWeight":{anyOf:[{type:"number",minimum:r7e,maximum:s7e,errorMessage:d(15052,null)},{type:"string",pattern:"^(normal|bold|1000|[1-9][0-9]{0,2})$"},{enum:Xgi}],description:d(15050,null),default:"normal"},"terminal.integrated.fontWeightBold":{anyOf:[{type:"number",minimum:r7e,maximum:s7e,errorMessage:d(15052,null)},{type:"string",pattern:"^(normal|bold|1000|[1-9][0-9]{0,2})$"},{enum:Xgi}],description:d(15051,null),default:"bold"},"terminal.integrated.cursorBlinking":{description:d(15008,null),type:"boolean",default:!1},"terminal.integrated.textBlinking":{description:d(15123,null),type:"boolean",default:!1},"terminal.integrated.cursorStyle":{description:d(15009,null),enum:["block","line","underline"],default:"block"},"terminal.integrated.cursorStyleInactive":{description:d(15010,null),enum:["outline","block","line","underline","none"],default:"outline"},"terminal.integrated.cursorWidth":{markdownDescription:d(15011,null,"`#terminal.integrated.cursorStyle#`","`line`"),type:"number",default:1},"terminal.integrated.scrollback":{description:d(15080,null),type:"number",default:1e3},"terminal.integrated.detectLocale":{markdownDescription:d(15017,null),type:"string",enum:["auto","off","on"],markdownEnumDescriptions:[d(15018,null),d(15019,null),d(15020,null)],default:"auto"},"terminal.integrated.gpuAcceleration":{type:"string",enum:["auto","on","off"],markdownEnumDescriptions:[d(15054,null),d(15056,null),d(15055,null)],default:"auto",description:d(15053,null)},"terminal.integrated.tabs.separator":{type:"string",default:" - ",markdownDescription:d(15111,null,"`#terminal.integrated.tabs.title#`","`#terminal.integrated.tabs.description#`")},"terminal.integrated.tabs.title":{type:"string",default:"${process}",markdownDescription:w_o},"terminal.integrated.tabs.description":{type:"string",default:"${task}${separator}${local}${separator}${cwdFolder}",markdownDescription:C_o},"terminal.integrated.rightClickBehavior":{type:"string",enum:["default","copyPaste","paste","selectWord","nothing"],enumDescriptions:[d(15076,null),d(15075,null),d(15078,null),d(15079,null),d(15077,null)],default:Ze?"selectWord":ei?"copyPaste":"default",description:d(15074,null)},"terminal.integrated.middleClickBehavior":{type:"string",enum:["default","paste"],enumDescriptions:[d(15065,null),d(15066,null)],default:"default",description:d(15064,null)},"terminal.integrated.cwd":{restricted:!0,description:d(15013,null),type:"string",default:void 0,scope:5},"terminal.integrated.confirmOnExit":{description:d(14998,null),type:"string",enum:["never","always","hasChildProcesses"],enumDescriptions:[d(15001,null),d(14999,null),d(15000,null)],default:"never"},"terminal.integrated.confirmOnKill":{description:d(15002,null),type:"string",enum:["never","editor","panel","always"],enumDescriptions:[d(15005,null),d(15004,null),d(15006,null),d(15003,null)],default:"editor"},"terminal.integrated.enableBell":{markdownDeprecationMessage:d(15025,null),type:"boolean",default:!1},"terminal.integrated.enableVisualBell":{description:d(15034,null),type:"boolean",default:!1},"terminal.integrated.commandsToSkipShell":{markdownDescription:d(14997,null,cMt.sort().map(a=>`- ${a}`).join(`
`),`[${d(14981,null)}](command:workbench.action.openRawDefaultSettings '${d(14982,null)}')`),type:"array",items:{type:"string"},default:[]},"terminal.integrated.allowChords":{markdownDescription:d(14991,null,"`#terminal.integrated.commandsToSkipShell#`"),type:"boolean",default:!0},"terminal.integrated.allowMnemonics":{markdownDescription:d(14994,null),type:"boolean",default:!1},"terminal.integrated.env.osx":{restricted:!0,markdownDescription:d(15037,null),type:"object",additionalProperties:{type:["string","null"]},default:{}},"terminal.integrated.env.linux":{restricted:!0,markdownDescription:d(15036,null),type:"object",additionalProperties:{type:["string","null"]},default:{}},"terminal.integrated.env.windows":{restricted:!0,markdownDescription:d(15038,null),type:"object",additionalProperties:{type:["string","null"]},default:{}},"terminal.integrated.environmentChangesRelaunch":{markdownDescription:d(15039,null),type:"boolean",default:!0},"terminal.integrated.showExitAlert":{description:d(15091,null),type:"boolean",default:!0},"terminal.integrated.windowsUseConptyDll":{restricted:!0,markdownDescription:d(15127,null),type:"boolean",tags:["preview"],default:!1,experiment:{mode:"auto"}},"terminal.integrated.splitCwd":{description:d(15093,null),type:"string",enum:["workspaceRoot","initial","inherited"],enumDescriptions:[d(15096,null),d(15095,null),d(15094,null)],default:"inherited"},"terminal.integrated.wordSeparators":{markdownDescription:d(15128,null),type:"string",default:" ()[]{}',\"`\u2500\u2018\u2019\u201C\u201D|"},"terminal.integrated.enableFileLinks":{description:d(15026,null),type:"string",enum:["off","on","notRemote"],enumDescriptions:[d(14975,null),d(14976,null),d(14974,null)],default:"on"},"terminal.integrated.allowedLinkSchemes":{description:d(14992,null),type:"array",items:{type:"string"},default:["file","http","https","mailto","vscode","vscode-insiders"]},"terminal.integrated.unicodeVersion":{type:"string",enum:["6","11"],enumDescriptions:[d(15126,null),d(15125,null)],default:"11",description:d(15124,null)},"terminal.integrated.enablePersistentSessions":{description:d(15033,null),type:"boolean",default:!0},"terminal.integrated.persistentSessionReviveProcess":{markdownDescription:d(15069,null),type:"string",enum:["onExit","onExitAndWindowClose","never"],markdownEnumDescriptions:[d(15071,null),d(15072,null),d(15070,null)],default:"onExit"},"terminal.integrated.hideOnStartup":{description:d(15058,null),type:"string",enum:["never","whenEmpty","always"],markdownEnumDescriptions:[d(14978,null),d(14979,null),d(14977,null)],default:"never"},"terminal.integrated.hideOnLastClosed":{description:d(15057,null),type:"boolean",default:!0},"terminal.integrated.customGlyphs":{markdownDescription:d(15012,null,["- Box Drawing (U+2500-U+257F)","- Block Elements (U+2580-U+259F)","- Braille Patterns (U+2800-U+28FF)","- Powerline Symbols (U+E0A0-U+E0D4, Private Use Area)","- Progress Indicators (U+EE00-U+EE0B, Private Use Area)","- Git Branch Symbols (U+F5D0-U+F60D, Private Use Area)","- Symbols for Legacy Computing (U+1FB00-U+1FBFF)"].join(`
`),"`#terminal.integrated.gpuAcceleration#`"),type:"boolean",default:!0},"terminal.integrated.rescaleOverlappingGlyphs":{markdownDescription:d(15073,null),type:"boolean",default:!0},"terminal.integrated.enableKittyKeyboardProtocol":{restricted:!0,markdownDescription:d(15028,null),type:"boolean",default:!0,tags:["advanced"]},"terminal.integrated.enableWin32InputMode":{restricted:!0,markdownDescription:d(15035,null),type:"boolean",default:!1,tags:["experimental","advanced"],experiment:{mode:"auto"}},"terminal.integrated.shellIntegration.enabled":{restricted:!0,markdownDescription:d(15087,null,"`#terminal.integrated.shellIntegration.decorationsEnabled#`","`#editor.accessibilitySupport#`"),type:"boolean",default:!0},"terminal.integrated.shellIntegration.decorationsEnabled":{restricted:!0,markdownDescription:d(15082,null),type:"string",enum:["both","gutter","overviewRuler","never"],enumDescriptions:[d(15083,null),d(15084,null),d(15086,null),d(15085,null)],default:"both"},"terminal.integrated.shellIntegration.timeout":{restricted:!0,markdownDescription:d(15090,null,"`-1`"),type:"integer",minimum:-1,maximum:6e4,default:-1},"terminal.integrated.shellIntegration.quickFixEnabled":{restricted:!0,markdownDescription:d(15089,null),type:"boolean",default:!0},"terminal.integrated.shellIntegration.environmentReporting":{markdownDescription:d(15088,null,`\`#${jl.SuggestEnabled}#\``),type:"boolean",default:ro.quality!=="stable"},"terminal.integrated.smoothScrolling":{markdownDescription:d(15092,null),type:"boolean",default:!1},"terminal.integrated.ignoreBracketedPasteMode":{markdownDescription:d(15059,null,"`\\x1b[200~`","`\\x1b[201~`"),type:"boolean",default:!1},"terminal.integrated.enableImages":{restricted:!0,markdownDescription:d(15027,null,"`#terminal.integrated.gpuAcceleration#`","`#terminal.integrated.windowsUseConptyDll#`"),type:"boolean",default:!1},"terminal.integrated.focusAfterRun":{markdownDescription:d(15041,null),enum:["terminal","accessible-buffer","none"],default:"none",tags:["accessibility"],markdownEnumDescriptions:[d(15044,null),d(15042,null),d(15043,null)]},"terminal.integrated.allowInUntrustedWorkspace":{restricted:!0,markdownDescription:d(14993,null),type:"boolean",default:!1},"terminal.integrated.developer.ptyHost.latency":{description:d(15022,null),type:"number",minimum:0,default:0,tags:["advanced"]},"terminal.integrated.developer.ptyHost.startupDelay":{description:d(15023,null),type:"number",minimum:0,default:0,tags:["advanced"]},"terminal.integrated.developer.devMode":{description:d(15021,null),type:"boolean",default:!1,tags:["advanced"]},...Kio};async function x_o(a){ne.as(Jt.Configuration).registerConfiguration({id:"terminal",order:100,title:d(15130,null),type:"object",properties:I_o}),I_o["terminal.integrated.fontFamily"].defaultSnippets=await a()}ne.as(Ep.ConfigurationMigration).registerConfigurationMigrations([{key:"terminal.integrated.enableBell",migrateFn:(a,i)=>{let e=[],t=i("accessibility.signals.terminalBell")?.announcement??i("accessibility.alert.terminalBell");return t!==void 0&&!Fe(t)&&(t=t?"auto":"off"),e.push(["accessibility.signals.terminalBell",{value:{sound:a?"on":"off",announcement:t}}]),e.push(["terminal.integrated.enableBell",{value:void 0}]),e.push(["terminal.integrated.enableVisualBell",{value:a}]),e}}]);ne.as(Ep.ConfigurationMigration).registerConfigurationMigrations([{key:jl.DeprecatedTerminalSandboxEnabled,migrateFn:(a,i)=>{let e=[];return a!==void 0&&i(jl.AgentSandboxEnabled)===void 0&&e.push([jl.AgentSandboxEnabled,{value:a}]),e.push([jl.DeprecatedTerminalSandboxEnabled,{value:void 0}]),e}},{key:jl.DeprecatedTerminalSandboxNetwork,migrateFn:(a,i)=>{let e=[];return a?.allowedDomains!==void 0&&i(jl.AgentSandboxNetworkAllowedDomains)===void 0&&e.push([jl.AgentSandboxNetworkAllowedDomains,{value:a.allowedDomains}]),a?.deniedDomains!==void 0&&i(jl.AgentSandboxNetworkDeniedDomains)===void 0&&e.push([jl.AgentSandboxNetworkDeniedDomains,{value:a.deniedDomains}]),e.push([jl.DeprecatedTerminalSandboxNetwork,{value:void 0}]),e}},{key:jl.DeprecatedTerminalSandboxNetworkAllowedDomains,migrateFn:(a,i)=>{let e=[];return a!==void 0&&i(jl.AgentSandboxNetworkAllowedDomains)===void 0&&e.push([jl.AgentSandboxNetworkAllowedDomains,{value:a}]),e.push([jl.DeprecatedTerminalSandboxNetworkAllowedDomains,{value:void 0}]),e}},{key:jl.DeprecatedTerminalSandboxNetworkDeniedDomains,migrateFn:(a,i)=>{let e=[];return a!==void 0&&i(jl.AgentSandboxNetworkDeniedDomains)===void 0&&e.push([jl.AgentSandboxNetworkDeniedDomains,{value:a}]),e.push([jl.DeprecatedTerminalSandboxNetworkDeniedDomains,{value:void 0}]),e}},{key:jl.DeprecatedTerminalSandboxLinuxFileSystem,migrateFn:(a,i)=>{let e=[];return a!==void 0&&i(jl.AgentSandboxLinuxFileSystem)===void 0&&e.push([jl.AgentSandboxLinuxFileSystem,{value:a}]),e.push([jl.DeprecatedTerminalSandboxLinuxFileSystem,{value:void 0}]),e}},{key:jl.DeprecatedTerminalSandboxMacFileSystem,migrateFn:(a,i)=>{let e=[];return a!==void 0&&i(jl.AgentSandboxMacFileSystem)===void 0&&e.push([jl.AgentSandboxMacFileSystem,{value:a}]),e.push([jl.DeprecatedTerminalSandboxMacFileSystem,{value:void 0}]),e}}]);var sr={terminal:d(15163,null),new:d(15164,null),doNotShowAgain:d(15152,null),currentSessionCategory:d(15151,null),previousSessionCategory:d(15159,null),typeTask:d(15162,null),typeLocal:d(15155,null),actionCategory:L(15165,"Terminal"),focus:L(15169,"Focus Terminal"),focusInstance:L(15172,"Focus Terminal"),focusAndHideAccessibleBuffer:L(15170,"Focus Terminal and Hide Accessible Buffer"),kill:{...L(15153,"Kill Terminal"),short:d(15154,null)},moveToEditor:L(15157,"Move Terminal into Editor Area"),moveIntoNewWindow:L(15156,"Move Terminal into New Window"),newInNewWindow:L(15158,"New Terminal Window"),moveToTerminalPanel:L(15173,"Move Terminal into Panel"),changeIcon:L(15168,"Change Icon..."),changeColor:L(15167,"Change Color..."),split:{...L(15160,"Split Terminal"),short:d(15161,null)},unsplit:L(15166,"Unsplit Terminal"),rename:L(15175,"Rename..."),toggleSizeToContentWidth:L(15180,"Toggle Size to Content Width"),focusHover:L(15171,"Focus Hover"),newWithCwd:L(15174,"Create New Terminal Starting in a Custom Working Directory"),renameWithArgs:L(15176,"Rename the Currently Active Terminal"),scrollToPreviousCommand:L(15179,"Scroll to Previous Command"),scrollToNextCommand:L(15178,"Scroll to Next Command"),revealCommand:L(15177,"Reveal Command in Terminal")};var s1e=class extends x{constructor(e,t,o,n,r,s){super();this._ptyHostController=e;this._logService=t;this._workspaceContextService=s;this._isPtyHostUnresponsive=!1;this._onPtyHostConnected=this._register(new E);this.onPtyHostConnected=this._onPtyHostConnected.event;this._onPtyHostRestart=this._register(new E);this.onPtyHostRestart=this._onPtyHostRestart.event;this._onPtyHostUnresponsive=this._register(new E);this.onPtyHostUnresponsive=this._onPtyHostUnresponsive.event;this._onPtyHostResponsive=this._register(new E);this.onPtyHostResponsive=this._onPtyHostResponsive.event;let l,c,u=!1;this._register(this._ptyHostController.onPtyHostExit(()=>{this._logService.error("The terminal's pty host process exited, the connection to all terminal processes was lost")})),this._register(this.onPtyHostConnected(()=>u=!0)),this._register(this._ptyHostController.onPtyHostStart(()=>{this._logService.debug("The terminal's pty host process is starting"),u&&(this._logService.trace("IPtyHostController#onPtyHostRestart"),this._onPtyHostRestart.fire()),c?.dispose(),this._isPtyHostUnresponsive=!1})),this._register(this._ptyHostController.onPtyHostUnresponsive(()=>{c?.dispose(),l||(l={name:d(14726,null),text:`$(debug-disconnect) ${d(14728,null)}`,tooltip:d(14725,null),ariaLabel:d(14727,null),command:Ow.DeveloperRestartPtyHost,kind:"warning"}),c=r.addEntry(l,"ptyHostStatus",0),this._isPtyHostUnresponsive=!0,this._onPtyHostUnresponsive.fire()})),this._register(this._ptyHostController.onPtyHostResponsive(()=>{this._isPtyHostUnresponsive&&(this._logService.info("The pty host became responsive again"),c?.dispose(),this._isPtyHostUnresponsive=!1,this._onPtyHostResponsive.fire())})),this._register(this._ptyHostController.onPtyHostRequestResolveVariables(async p=>{if(p.workspaceId!==this._workspaceContextService.getWorkspace().id)return;let h=o.getLastActiveWorkspaceRoot(Q.file),g=h?this._workspaceContextService.getWorkspaceFolder(h)??void 0:void 0,f=p.originalText.map(b=>n.resolveAsync(g,b)),v=await Promise.all(f);this._ptyHostController.acceptPtyHostResolvedVariables(p.requestId,v)}))}get isResponsive(){return!this._isPtyHostUnresponsive}restartPtyHost(){this._ptyHostController.restartPtyHost()}_deserializeTerminalState(e){if(e===void 0)return;let t=JSON.parse(e);if(!Shn(t)){this._logService.warn("Could not revive serialized processes, wrong format",t);return}if(t.version!==1){this._logService.warn(`Could not revive serialized processes, wrong version "${t.version}"`,t);return}return t.state}_getWorkspaceId(){return this._workspaceContextService.getWorkspace().id}};function Shn(a){return xi(a)&&"version"in a&&Yo(a.version)&&"state"in a&&Array.isArray(a.state)}var a1e=class extends x{constructor(e,t){super();this.id=e;this.shouldPersist=t;this._properties={cwd:"",initialCwd:"",fixedDimensions:{cols:void 0,rows:void 0},title:"",shellType:void 0,hasChildProcesses:!0,resolvedShellLaunchConfig:{},overrideDimensions:void 0,failedShellIntegrationActivation:!1,usedShellIntegrationInjection:void 0,shellIntegrationInjectionFailureReason:void 0};this._lastDimensions={cols:-1,rows:-1};this._inReplay=!1;this._onProcessData=this._register(new E);this.onProcessData=this._onProcessData.event;this._onProcessReplayComplete=this._register(new E);this.onProcessReplayComplete=this._onProcessReplayComplete.event;this._onProcessReady=this._register(new E);this.onProcessReady=this._onProcessReady.event;this._onDidChangeProperty=this._register(new E);this.onDidChangeProperty=this._onDidChangeProperty.event;this._onProcessExit=this._register(new E);this.onProcessExit=this._onProcessExit.event;this._onRestoreCommands=this._register(new E);this.onRestoreCommands=this._onRestoreCommands.event}async getInitialCwd(){return this._properties.initialCwd}async getCwd(){return this._properties.cwd||this._properties.initialCwd}handleData(e){this._onProcessData.fire(e)}handleExit(e){this._onProcessExit.fire(e)}handleReady(e){this._onProcessReady.fire(e)}handleDidChangeProperty({type:e,value:t}){switch(e){case"cwd":this._properties.cwd=t;break;case"initialCwd":this._properties.initialCwd=t;break;case"resolvedShellLaunchConfig":{let o=t;o.cwd&&!Fe(o.cwd)&&(o.cwd=A.revive(o.cwd));break}}this._onDidChangeProperty.fire({type:e,value:t})}async handleReplay(e){Mo(`code/terminal/willHandleReplay/${this.id}`);try{this._inReplay=!0;for(let t of e.events){(t.cols!==0||t.rows!==0)&&this._onDidChangeProperty.fire({type:"overrideDimensions",value:{cols:t.cols,rows:t.rows,forceExactSize:!0}});let o={data:t.data,trackCommit:!0};this._onProcessData.fire(o),await o.writePromise}}finally{this._inReplay=!1}e.commands&&this._onRestoreCommands.fire(e.commands),this._onDidChangeProperty.fire({type:"overrideDimensions",value:void 0}),Mo(`code/terminal/didHandleReplay/${this.id}`),this._onProcessReplayComplete.fire()}};var Jve=class extends a1e{constructor(e,t,o,n,r){super(e,t);this._remoteTerminalChannel=o;this._remoteAgentService=n;this._logService=r;this._startBarrier=new gp}async start(){if(!await this._remoteAgentService.getEnvironment())throw new Error("Could not fetch remote environment");this._logService.trace("Spawning remote agent process",{terminalId:this.id});let t=await this._remoteTerminalChannel.start(this.id);return t&&No(t,{message:!0})||this._startBarrier.open(),t}async detach(e){return await this._startBarrier.wait(),this._remoteTerminalChannel.detachFromProcess(this.id,e)}shutdown(e){this._startBarrier.wait().then(t=>{this._remoteTerminalChannel.shutdown(this.id,e)})}input(e){this._inReplay||this._startBarrier.wait().then(t=>{this._remoteTerminalChannel.input(this.id,e)})}sendSignal(e){this._inReplay||this._startBarrier.wait().then(t=>{this._remoteTerminalChannel.sendSignal(this.id,e)})}processBinary(e){return this._remoteTerminalChannel.processBinary(this.id,e)}resize(e,t,o,n){this._inReplay||this._lastDimensions.cols===e&&this._lastDimensions.rows===t||this._startBarrier.wait().then(r=>{this._lastDimensions.cols=e,this._lastDimensions.rows=t,this._remoteTerminalChannel.resize(this.id,e,t,o,n)})}async clearBuffer(){await this._remoteTerminalChannel.clearBuffer(this.id)}freePortKillProcess(e){if(!this._remoteTerminalChannel.freePortKillProcess)throw new Error("freePortKillProcess does not exist on the local pty service");return this._remoteTerminalChannel.freePortKillProcess(e)}acknowledgeDataEvent(e){this._inReplay||this._startBarrier.wait().then(t=>{this._remoteTerminalChannel.acknowledgeDataEvent(this.id,e)})}async setUnicodeVersion(e){return this._remoteTerminalChannel.setUnicodeVersion(this.id,e)}async refreshProperty(e){return this._remoteTerminalChannel.refreshProperty(this.id,e)}async updateProperty(e,t){return this._remoteTerminalChannel.updateProperty(this.id,e,t)}handleOrphanQuestion(){this._remoteTerminalChannel.orphanQuestionReply(this.id)}};Jve=I([m(3,bo),m(4,ca)],Jve);var k_o="remoteterminal",l1e=class{constructor(i,e,t,o,n,r,s,l,c,u,p){this._remoteAuthority=i;this._channel=e;this._configurationService=t;this._workspaceContextService=o;this._resolverService=n;this._environmentVariableService=r;this._remoteAuthorityResolverService=s;this._logService=l;this._editorService=c;this._labelService=u;this._environmentService=p}get onPtyHostExit(){return this._channel.listen("$onPtyHostExitEvent")}get onPtyHostStart(){return this._channel.listen("$onPtyHostStartEvent")}get onPtyHostUnresponsive(){return this._channel.listen("$onPtyHostUnresponsiveEvent")}get onPtyHostResponsive(){return this._channel.listen("$onPtyHostResponsiveEvent")}get onPtyHostRequestResolveVariables(){return this._channel.listen("$onPtyHostRequestResolveVariablesEvent")}get onProcessData(){return this._channel.listen("$onProcessDataEvent")}get onProcessExit(){return this._channel.listen("$onProcessExitEvent")}get onProcessReady(){return this._channel.listen("$onProcessReadyEvent")}get onProcessReplay(){return this._channel.listen("$onProcessReplayEvent")}get onProcessOrphanQuestion(){return this._channel.listen("$onProcessOrphanQuestion")}get onExecuteCommand(){return this._channel.listen("$onExecuteCommand")}get onDidRequestDetach(){return this._channel.listen("$onDidRequestDetach")}get onDidChangeProperty(){return this._channel.listen("$onDidChangeProperty")}restartPtyHost(){return this._channel.call("$restartPtyHost",[])}async createProcess(i,e,t,o,n,r,s,l){await this._configurationService.whenRemoteConfigurationLoaded();let c=Object.create(null),u=t?this._workspaceContextService.getWorkspaceFolder(t)??void 0:void 0,p=TS.parse({shellLaunchConfig:i,configuration:e});try{await this._resolverService.resolveAsync(u,p)}catch(k){this._logService.error(k)}for(let[{inner:k},T]of p.resolved())(/^config:/.test(k)||k==="selectedText"||k==="lineNumber")&&(c[k]=T.value);let h=[];for(let[k,T]of this._environmentVariableService.collections.entries())h.push([k,Gue(T.map),eYe(T.descriptionMap)]);let g=await this._remoteAuthorityResolverService.resolveAuthority(this._remoteAuthority),f={...this._environmentService.debugExtensionHost.env??{},...g.options?.extensionHostEnv},v=this._workspaceContextService.getWorkspace(),b=v.folders,S=t?this._workspaceContextService.getWorkspaceFolder(t):null,y=po.getOriginalUri(this._editorService.activeEditor,{supportSideBySide:1,filterByScheme:[Q.file,Q.vscodeUserData,Q.vscodeRemote]}),w={configuration:e,resolvedVariables:c,envVariableCollections:h,shellLaunchConfig:i,workspaceId:v.id,workspaceName:this._labelService.getWorkspaceLabel(v),workspaceFolders:b,activeWorkspaceFolder:S,activeFileResource:y,shouldPersistTerminal:n,options:o,cols:r,rows:s,unicodeVersion:l,resolverEnv:f};return await this._channel.call("$createProcess",w)}requestDetachInstance(i,e){return this._channel.call("$requestDetachInstance",[i,e])}acceptDetachInstanceReply(i,e){return this._channel.call("$acceptDetachInstanceReply",[i,e])}attachToProcess(i){return this._channel.call("$attachToProcess",[i])}detachFromProcess(i,e){return this._channel.call("$detachFromProcess",[i,e])}listProcesses(){return this._channel.call("$listProcesses")}getLatency(){return this._channel.call("$getLatency")}getPerformanceMarks(){return this._channel.call("$getPerformanceMarks")}reduceConnectionGraceTime(){return this._channel.call("$reduceConnectionGraceTime")}processBinary(i,e){return this._channel.call("$processBinary",[i,e])}start(i){return this._channel.call("$start",[i])}input(i,e){return this._channel.call("$input",[i,e])}sendSignal(i,e){return this._channel.call("$sendSignal",[i,e])}acknowledgeDataEvent(i,e){return this._channel.call("$acknowledgeDataEvent",[i,e])}setUnicodeVersion(i,e){return this._channel.call("$setUnicodeVersion",[i,e])}setNextCommandId(i,e,t){return this._channel.call("$setNextCommandId",[i,e,t])}shutdown(i,e){return this._channel.call("$shutdown",[i,e])}resize(i,e,t,o,n){return this._channel.call("$resize",[i,e,t,o,n])}clearBuffer(i){return this._channel.call("$clearBuffer",[i])}getInitialCwd(i){return this._channel.call("$getInitialCwd",[i])}getCwd(i){return this._channel.call("$getCwd",[i])}orphanQuestionReply(i){return this._channel.call("$orphanQuestionReply",[i])}sendCommandResult(i,e,t){return this._channel.call("$sendCommandResult",[i,e,t])}freePortKillProcess(i){return this._channel.call("$freePortKillProcess",[i])}getDefaultSystemShell(i){return this._channel.call("$getDefaultSystemShell",[i])}getProfiles(i,e,t){return this._channel.call("$getProfiles",[this._workspaceContextService.getWorkspace().id,i,e,t])}acceptPtyHostResolvedVariables(i,e){return this._channel.call("$acceptPtyHostResolvedVariables",[i,e])}getEnvironment(){return this._channel.call("$getEnvironment")}getWslPath(i,e){return this._channel.call("$getWslPath",[i,e])}setTerminalLayoutInfo(i){let t={workspaceId:this._workspaceContextService.getWorkspace().id,tabs:i?i.tabs:[],background:i?i.background:null};return this._channel.call("$setTerminalLayoutInfo",t)}updateTitle(i,e,t){return this._channel.call("$updateTitle",[i,e,t])}updateIcon(i,e,t,o){return this._channel.call("$updateIcon",[i,e,t,o])}refreshProperty(i,e){return this._channel.call("$refreshProperty",[i,e])}updateProperty(i,e,t){return this._channel.call("$updateProperty",[i,e,t])}getTerminalLayoutInfo(){let e={workspaceId:this._workspaceContextService.getWorkspace().id};return this._channel.call("$getTerminalLayoutInfo",e)}reviveTerminalProcesses(i,e,t){return this._channel.call("$reviveTerminalProcesses",[i,e,t])}getRevivedPtyNewId(i){return this._channel.call("$getRevivedPtyNewId",[i])}serializeTerminalState(i){return this._channel.call("$serializeTerminalState",[i])}installAutoReply(i,e){return this._channel.call("$installAutoReply",[i,e])}uninstallAllAutoReplies(){return this._channel.call("$uninstallAllAutoReplies",[])}};l1e=I([m(2,fg),m(3,Pe),m(4,Tp),m(5,c2),m(6,Uc),m(7,ca),m(8,ee),m(9,rt),m(10,At)],l1e);function E_o(a,...i){let e=i.reduce((n,r)=>(n[r]=!0,n),{}),t=[/^ELECTRON_.+$/,/^VSCODE_(?!(PORTABLE|SHELL_LOGIN|ENV_REPLACE|ENV_APPEND|ENV_PREPEND)).+$/,/^SNAP(|_.*)$/,/^GDK_PIXBUF_.+$/];Object.keys(a).filter(n=>!e[n]).forEach(n=>{for(let r=0;r<t.length;r++)if(n.search(t[r])!==-1){delete a[n];break}})}function T_o(a){a&&(delete a.DEBUG,fn&&delete a.LD_PRELOAD)}function c1e(a,i){if(i)if(ei)for(let e in i){let t=e;for(let n in a)if(e.toLowerCase()===n.toLowerCase()){t=n;break}let o=i[e];o!==void 0&&__o(a,t,o)}else Object.keys(i).forEach(e=>{let t=i[e];t!==void 0&&__o(a,e,t)})}function __o(a,i,e){Fe(e)?a[i]=e:delete a[i]}function Ihn(a,i,e,t){a.TERM_PROGRAM="vscode",i&&(a.TERM_PROGRAM_VERSION=i),yhn(a,t)&&(a.LANG=whn(e)),a.COLORTERM="truecolor"}function D_o(a,i){if(i)for(let e of Object.keys(i)){let t=i[e];t!=null&&(a[e]=t)}}async function L_o(a,i){return await Promise.all(Object.entries(i).map(async([e,t])=>{if(Fe(t))try{i[e]=await a(t)}catch{i[e]=t}})),i}function yhn(a,i){if(i==="on")return!0;if(i==="auto"){let e=a.LANG;return!e||e.search(/\.UTF\-8$/)===-1&&e.search(/\.utf8$/)===-1&&e.search(/\.euc.+/)===-1}return!1}function whn(a){let i=a?a.split("-"):[],e=i.length;if(e===0)return"en_US.UTF-8";if(e===1){let t={af:"ZA",am:"ET",be:"BY",bg:"BG",ca:"ES",cs:"CZ",da:"DK",de:"DE",el:"GR",en:"US",es:"ES",et:"EE",eu:"ES",fi:"FI",fr:"FR",he:"IL",hr:"HR",hu:"HU",hy:"AM",is:"IS",it:"IT",ja:"JP",kk:"KZ",ko:"KR",lt:"LT",nl:"NL",no:"NO",pl:"PL",pt:"BR",ro:"RO",ru:"RU",sk:"SK",sl:"SI",sr:"YU",sv:"SE",tr:"TR",uk:"UA",zh:"CN"};Object.prototype.hasOwnProperty.call(t,i[0])&&i.push(t[i[0]])}else i[1]=i[1].toUpperCase();return i.join("_")+".UTF-8"}async function M_o(a,i,e,t,o,n){if(a.cwd){let s=typeof a.cwd=="object"?a.cwd.fsPath:a.cwd,l=await R_o(s,e);return Nat(l||s)}let r;return!a.ignoreConfigurationCwd&&o&&(e&&(o=await R_o(o,e,n)),o&&(Zl(o)?r=o:t&&(r=Yc(t.fsPath,o)))),r||(r=t?t.fsPath:i||""),Nat(r)}async function R_o(a,i,e){if(i)try{return await i(a)}catch(t){e?.error("Could not resolve terminal cwd",t);return}return a}function j3t(a,i,e){if(e)return t=>e.resolveWithEnvironment(i,a,t)}async function Q3t(a,i,e,t,o,n){let r={};if(a.strictEnv)D_o(r,a.env);else{D_o(r,n);let s={...i};e&&(s&&await L_o(e,s),a.env&&await L_o(e,a.env)),Ze&&(r.VSCODE_NODE_OPTIONS&&(r.NODE_OPTIONS=r.VSCODE_NODE_OPTIONS,delete r.VSCODE_NODE_OPTIONS),r.VSCODE_NODE_REPL_EXTERNAL_MODULE&&(r.NODE_REPL_EXTERNAL_MODULE=r.VSCODE_NODE_REPL_EXTERNAL_MODULE,delete r.VSCODE_NODE_REPL_EXTERNAL_MODULE)),E_o(r,"VSCODE_IPC_HOOK_CLI"),c1e(r,s),c1e(r,a.env),Ihn(r,t,wr,o)}return r}async function P_o(a,i,e,t,o,n,r=ei){let s;if(Fe(a)?s=a:(s=a.fsPath,r&&n!==1?s=s.replace(/\\/g,"/"):!r&&n===1&&(s=s.replace(/\//g,"\\"))),!i)return s;let l=s.includes(" "),c=s.includes("(")||s.includes(")"),u=jo(i,".exe"),p=u==="pwsh"||e==="pwsh"||u==="powershell"||e==="powershell";if(p&&(l||s.includes("'")))return`& '${s.replace(/'/g,"''")}'`;if(c&&p)return`& '${s}'`;if(n===1){if(t!==void 0)return t==="gitbash"?FFi(s.replace(/\\/g,"/"),t):t==="wsl"?o?.getWslPath(s,"win-to-unix")||s:l?`"${s}"`:s;let h=i.toLowerCase();return h.includes("wsl")||h.includes("bash.exe")&&!h.toLowerCase().includes("git")?o?.getWslPath(s,"win-to-unix")||s:l?`"${s}"`:s}return FFi(s,t)}function L6(a,i,e){let t=Fe(a)?A.parse(a):a,o=t?i.getWorkspaceFolder(t)??void 0:void 0;if(!o){let n=e.getLastActiveWorkspaceRoot();o=n?i.getWorkspaceFolder(n)??void 0:void 0}return o}async function A_o(a,i,e,t,o=ei){let n=Fe(a)?a:a.fsPath;return t===1?e==="wsl"?i.getWslPath(n.replaceAll("/","\\"),"win-to-unix"):e==="gitbash"?n.replaceAll("\\","/").replace(/^([a-zA-Z]):\//,"/$1/"):(n=Fe(a)?n:Xse(a,!0),o?n:n.replaceAll("/","\\")):o?n.replaceAll("\\","/"):n}function Y3t(a,i,e,t){let o=a.getValue("terminal.integrated.shellIntegration.timeout"),n;if(Yo(o)&&o===-2?n=0:!Yo(o)||o<0?n=i?5e3:e?3e3:2e3:o===0?n=0:n=Math.max(o,500),t!==void 0){let r=Date.now()-t;n=Math.max(0,n-r)}return n}var Zve=class{static{this.ID="remoteTerminalBackend"}constructor(i,e,t){let o=e.getConnection();if(o?.remoteAuthority){let n=i.createInstance(l1e,o.remoteAuthority,o.getChannel(k_o)),r=i.createInstance(act,o.remoteAuthority,n);ne.as(NB.Backend).registerTerminalBackend(r),t.didRegisterBackend(r)}}};Zve=I([m(0,F),m(1,bo),m(2,Nm)],Zve);var act=class extends s1e{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super(t,r,h,p,f,u);this.remoteAuthority=e;this._remoteTerminalChannel=t;this._remoteAgentService=o;this._instantiationService=n;this._commandService=s;this._storageService=l;this._remoteAuthorityResolverService=c;this._historyService=h;this._configurationService=g;this._ptys=new Map;this._whenConnected=new Ko;this._onDidRequestDetach=this._register(new E);this.onDidRequestDetach=this._onDidRequestDetach.event;this._onRestoreCommands=this._register(new E);this.onRestoreCommands=this._onRestoreCommands.event;this._register(this._remoteTerminalChannel.onProcessData(b=>this._ptys.get(b.id)?.handleData(b.event))),this._register(this._remoteTerminalChannel.onProcessReplay(b=>{this._ptys.get(b.id)?.handleReplay(b.event),b.event.commands.commands.length>0&&this._onRestoreCommands.fire({id:b.id,commands:b.event.commands.commands})})),this._register(this._remoteTerminalChannel.onProcessOrphanQuestion(b=>this._ptys.get(b.id)?.handleOrphanQuestion())),this._register(this._remoteTerminalChannel.onDidRequestDetach(b=>this._onDidRequestDetach.fire(b))),this._register(this._remoteTerminalChannel.onProcessReady(b=>this._ptys.get(b.id)?.handleReady(b.event))),this._register(this._remoteTerminalChannel.onDidChangeProperty(b=>this._ptys.get(b.id)?.handleDidChangeProperty(b.property))),this._register(this._remoteTerminalChannel.onProcessExit(b=>{let S=this._ptys.get(b.id);S&&(S.handleExit(b.event),S.dispose(),this._ptys.delete(b.id))}));let v=["_remoteCLI.openExternal","_remoteCLI.windowOpen","_remoteCLI.getSystemStatus","_remoteCLI.manageExtensions"];this._register(this._remoteTerminalChannel.onExecuteCommand(async b=>{if(!this._ptys.get(b.persistentProcessId))return;let y=b.reqId,w=b.commandId;if(!v.includes(w)){this._remoteTerminalChannel.sendCommandResult(y,!0,"Invalid remote cli command: "+w);return}let k=b.commandArgs.map(T=>$n(T));try{let T=await this._commandService.executeCommand(b.commandId,...k);this._remoteTerminalChannel.sendCommandResult(y,!1,T)}catch(T){this._remoteTerminalChannel.sendCommandResult(y,!0,T)}})),this._onPtyHostConnected.fire()}get whenReady(){return this._whenConnected.p}setReady(){this._whenConnected.complete()}async requestDetachInstance(e,t){if(!this._remoteTerminalChannel)throw new Error("Cannot request detach instance when there is no remote!");return this._remoteTerminalChannel.requestDetachInstance(e,t)}async acceptDetachInstanceReply(e,t){if(this._remoteTerminalChannel){if(!t){this._logService.warn("Cannot attach to feature terminals, custom pty terminals, or those without a persistentProcessId");return}}else throw new Error("Cannot accept detached instance when there is no remote!");return this._remoteTerminalChannel.acceptDetachInstanceReply(e,t)}async persistTerminalState(){if(!this._remoteTerminalChannel)throw new Error("Cannot persist terminal state when there is no remote!");let e=Array.from(this._ptys.keys()),t=await this._remoteTerminalChannel.serializeTerminalState(e);this._storageService.store("terminal.integrated.bufferState",t,1,1)}async createProcess(e,t,o,n,r,s,l,c){if(!this._remoteTerminalChannel)throw new Error("Cannot create remote terminal when there is no remote!");if(!await this._remoteAgentService.getEnvironment())throw new Error("Could not fetch remote environment");let p=this._configurationService.getValue(Vv),h={"terminal.integrated.env.windows":this._configurationService.getValue("terminal.integrated.env.windows"),"terminal.integrated.env.osx":this._configurationService.getValue("terminal.integrated.env.osx"),"terminal.integrated.env.linux":this._configurationService.getValue("terminal.integrated.env.linux"),"terminal.integrated.cwd":this._configurationService.getValue("terminal.integrated.cwd"),"terminal.integrated.detectLocale":p.detectLocale},g={name:e.name,executable:e.executable,args:e.args,cwd:e.cwd,env:e.env,useShellEnvironment:e.useShellEnvironment,reconnectionProperties:e.reconnectionProperties,type:e.type,isFeatureTerminal:e.isFeatureTerminal,tabActions:e.tabActions,shellIntegrationEnvironmentReporting:e.shellIntegrationEnvironmentReporting},f=L6(e.cwd,this._workspaceContextService,this._historyService)?.uri,v=await this._remoteTerminalChannel.createProcess(g,h,f,l,c,o,n,r),b=this._instantiationService.createInstance(Jve,v.persistentTerminalId,c,this._remoteTerminalChannel);return this._ptys.set(v.persistentTerminalId,b),b}async attachToProcess(e){if(!this._remoteTerminalChannel)throw new Error("Cannot create remote terminal when there is no remote!");try{await this._remoteTerminalChannel.attachToProcess(e);let t=this._instantiationService.createInstance(Jve,e,!0,this._remoteTerminalChannel);return this._ptys.set(e,t),t}catch(t){this._logService.trace(`Couldn't attach to process ${t.message}`)}}async attachToRevivedProcess(e){if(!this._remoteTerminalChannel)throw new Error("Cannot create remote terminal when there is no remote!");try{let t=await this._remoteTerminalChannel.getRevivedPtyNewId(e)??e;return await this.attachToProcess(t)}catch(t){this._logService.trace(`Couldn't attach to process ${t.message}`)}}async listProcesses(){return this._remoteTerminalChannel.listProcesses()}async getLatency(){let e=new Dn,t=await this._remoteTerminalChannel.getLatency();return e.stop(),[{label:"window<->ptyhostservice<->ptyhost",latency:e.elapsed()},...t]}async updateProperty(e,t,o){await this._remoteTerminalChannel.updateProperty(e,t,o)}async updateTitle(e,t,o){await this._remoteTerminalChannel.updateTitle(e,t,o)}async updateIcon(e,t,o,n){await this._remoteTerminalChannel.updateIcon(e,t,o,n)}async setNextCommandId(e,t,o){await this._remoteTerminalChannel.setNextCommandId(e,t,o)}async getDefaultSystemShell(e){return this._remoteTerminalChannel.getDefaultSystemShell(e)||""}async getProfiles(e,t,o){return this._remoteTerminalChannel.getProfiles(e,t,o)||[]}async getEnvironment(){return this._remoteTerminalChannel.getEnvironment()||{}}async getShellEnvironment(){let e=this._remoteAgentService.getConnection();if(!e)return;let t=await this._remoteAuthorityResolverService.resolveAuthority(e.remoteAuthority),o={};if(t.options?.extensionHostEnv)for(let[n,r]of Object.entries(t.options.extensionHostEnv))r!==null&&(o[n]=r);return o}async getWslPath(e,t){return(await this._remoteAgentService.getEnvironment())?.os!==1?e:this._remoteTerminalChannel.getWslPath(e,t)||e}async setTerminalLayoutInfo(e){if(!this._remoteTerminalChannel)throw new Error("Cannot call setActiveInstanceId when there is no remote");return this._remoteTerminalChannel.setTerminalLayoutInfo(e)}async reduceConnectionGraceTime(){if(!this._remoteTerminalChannel)throw new Error("Cannot reduce grace time when there is no remote");return this._remoteTerminalChannel.reduceConnectionGraceTime()}async getTerminalLayoutInfo(){if(!this._remoteTerminalChannel)throw new Error("Cannot call getActiveInstanceId when there is no remote");let e=this._getWorkspaceId(),t=this._storageService.get("terminal.integrated.bufferState",1),o=this._deserializeTerminalState(t);if(o&&o.length>0)try{Mo("code/terminal/willReviveTerminalProcessesRemote"),await this._remoteTerminalChannel.reviveTerminalProcesses(e,o,Intl.DateTimeFormat().resolvedOptions().locale),Mo("code/terminal/didReviveTerminalProcessesRemote"),this._storageService.remove("terminal.integrated.bufferState",1);let n=this._storageService.get("terminal.integrated.layoutInfo",1);n&&(Mo("code/terminal/willSetTerminalLayoutInfoRemote"),await this._remoteTerminalChannel.setTerminalLayoutInfo(JSON.parse(n)),Mo("code/terminal/didSetTerminalLayoutInfoRemote"),this._storageService.remove("terminal.integrated.layoutInfo",1))}catch(n){this._logService.warn("RemoteTerminalBackend#getTerminalLayoutInfo Error",n.message??n)}return this._remoteTerminalChannel.getTerminalLayoutInfo()}async getPerformanceMarks(){return this._remoteTerminalChannel.getPerformanceMarks()}installAutoReply(e,t){return this._remoteTerminalChannel.installAutoReply(e,t)}uninstallAllAutoReplies(){return this._remoteTerminalChannel.uninstallAllAutoReplies()}};act=I([m(2,bo),m(3,F),m(4,ca),m(5,ge),m(6,ce),m(7,Uc),m(8,Pe),m(9,Tp),m(10,na),m(11,B),m(12,kr)],act);var R6=class{constructor(i){this.instanceId=i.instanceId}toJSON(){return{$mid:15,instanceId:this.instanceId}}},tbe=class extends rs{async runAction(i,e){if(Array.isArray(e)&&e.every(t=>t instanceof R6)){await i.run(e?.[0],e);return}return super.runAction(i,e)}};function M6(a,i,e,t,o,n){let r=new Cn(a,i),s=tu(t.getActions({shouldForwardArgs:!0}));n&&s.push(...n);let l=e?cc(e).map(u=>new R6(u)):[],c=new tbe;o.showContextMenu({actionRunner:c,getAnchor:()=>r,getActions:()=>s,getActionsContext:()=>l,onHide:()=>c.dispose()})}function ibe(a,i){let e=parseInt(i.get("terminal.integrated.tabs.showDetailed",-1)??"0"),t="",o=a.statusList.statuses,n=[];for(let l of o)e?(l.detailedTooltip??l.tooltip)&&(t+=`

---

${l.icon?`$(${l.icon?.id}) `:""}`+(l.detailedTooltip??l.tooltip??"")):l.tooltip&&(t+=`

---

${l.icon?`$(${l.icon?.id}) `:""}`+(l.tooltip??"")),l.hoverActions&&n.push(...l.hoverActions);n.push({commandId:"toggleDetailedInfo",label:e?d(14904,null):d(14907,null),run(){i.store("terminal.integrated.tabs.showDetailed",(e+1)%2,-1,0)}});let r=Chn(a,!!e);return{content:new Ie(a.title+r+t,{supportThemeIcons:!0}),actions:n}}function Chn(a,i){let e=[];if(a.processId&&a.processId>0&&e.push(d(14906,null,"PID",a.processId)+`
`),a.shellLaunchConfig.executable){let t="";if(!i&&a.shellLaunchConfig.executable.length>32){let n=jo(a.shellLaunchConfig.executable),r=a.shellLaunchConfig.executable.length-n.length-1,s=a.shellLaunchConfig.executable.substring(r,r+1);t+=`\u2026${s}${n}`}else t+=a.shellLaunchConfig.executable;let o=cc(a.injectedArgs||a.shellLaunchConfig.args||[]).map(n=>n.match(/\s/)?`'${n}'`:n).join(" ");o&&(t+=` ${o}`),e.push(d(14905,null,t))}return e.length?`

---

${e.join(`
`)}`:""}var d1e=class extends x{constructor(e){super();this._configurationService=e;this._statuses=new Map;this._statusTimeouts=new Map;this._onDidAddStatus=this._register(new E);this._onDidRemoveStatus=this._register(new E);this._onDidChangePrimaryStatus=this._register(new E)}get onDidAddStatus(){return this._onDidAddStatus.event}get onDidRemoveStatus(){return this._onDidRemoveStatus.event}get onDidChangePrimaryStatus(){return this._onDidChangePrimaryStatus.event}get primary(){let e;for(let t of this._statuses.values())(!e||t.severity>=e.severity)&&(t.icon||!e?.icon)&&(e=t);return e}get statuses(){return Array.from(this._statuses.values())}add(e,t){e=this._applyAnimationSetting(e);let o=this._statusTimeouts.get(e.id);if(o&&(ut.clearTimeout(o),this._statusTimeouts.delete(e.id)),t&&t>0){let r=ut.setTimeout(()=>this.remove(e),t);this._statusTimeouts.set(e.id,r)}let n=this._statuses.get(e.id);if(n&&n!==e&&(this._onDidRemoveStatus.fire(n),this._statuses.delete(n.id)),!this._statuses.has(e.id)){let r=this.primary;this._statuses.set(e.id,e),this._onDidAddStatus.fire(e);let s=this.primary;r!==s&&this._onDidChangePrimaryStatus.fire(s)}}remove(e){let t=Fe(e)?this._statuses.get(e):e;if(t&&this._statuses.get(t.id)){let o=this.primary?.id===t.id;this._statuses.delete(t.id),this._onDidRemoveStatus.fire(t),o&&this._onDidChangePrimaryStatus.fire(this.primary)}}toggle(e,t){t?this.add(e):this.remove(e)}_applyAnimationSetting(e){if(!e.icon||q.getModifier(e.icon)!=="spin"||this._configurationService.getValue("terminal.integrated.tabs.enableAnimation"))return e;let t;return e.icon.id===AE.id?t=R.play:t=q.modify(e.icon,void 0),{...e,icon:t}}};d1e=I([m(0,B)],d1e);function X3t(a){switch(a){case bt.Error:return Gx;case bt.Warning:return q1;default:return""}}var O_o=_;var sre=class extends Vl{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super("TerminalTabsList",e,{getHeight:()=>22,getTemplateId:()=>"terminal.tabs"},[c.createInstance(lct,e,c.createInstance(Nl,qB),()=>this.getSelectedElements(),()=>this.hasText,()=>this.hasActionBar)],{horizontalScrolling:!1,supportDynamicHeights:!1,selectionNavigation:!0,identityProvider:{getId:b=>b?.instanceId},accessibilityProvider:c.createInstance(cct),smoothScrolling:n.getValue("workbench.list.smoothScrolling"),multipleSelectionSupport:!0,paddingBottom:22,dnd:c.createInstance(dct),openOnSingleClick:!0},t,o,n,c);this._configurationService=n;this._terminalService=r;this._terminalGroupService=s;this._terminalEditingService=l;this._themeService=p;this._storageService=h;this._hoverService=f;this._hasText=!0;this._hasActionBar=!0;let v=[this._terminalGroupService.onDidChangeInstances(()=>this.refresh()),this._terminalGroupService.onDidChangeGroups(()=>this.refresh()),this._terminalGroupService.onDidShow(()=>this.refresh()),this._terminalGroupService.onDidChangeInstanceCapability(()=>this.refresh()),this._terminalService.onAnyInstanceTitleChange(()=>this.refresh()),this._terminalService.onAnyInstanceIconChange(()=>this.refresh()),this._terminalService.onAnyInstancePrimaryStatusChange(()=>this.refresh()),this._terminalService.onDidChangeConnectionState(()=>this.refresh()),this._themeService.onDidColorThemeChange(()=>this.refresh()),this._terminalGroupService.onDidChangeActiveInstance(b=>{if(b){let S=this._terminalGroupService.instances.indexOf(b);this.setSelection([S]),this.reveal(S)}this.refresh()}),this._storageService.onDidChangeValue(-1,"terminal.integrated.tabs.showDetailed",this.disposables)(()=>this.refresh())];this.disposables.add(g.onWillShutdown(b=>{Be(v),v.length=0})),this.disposables.add(Z(()=>{Be(v),v.length=0})),this.disposables.add(this.onMouseDblClick(async b=>{if(!b.element){b.browserEvent.preventDefault(),b.browserEvent.stopPropagation();let S=await this._terminalService.createTerminal({location:1});this._terminalGroupService.setActiveInstance(S),await S.focusWhenReady();return}this._terminalEditingService.getEditingTerminal()?.instanceId!==b.element.instanceId&&this._getFocusMode()==="doubleClick"&&this.getFocus().length===1&&b.element.focus(!0)})),this.disposables.add(this.onMouseClick(async b=>{this._terminalEditingService.getEditingTerminal()?.instanceId!==b.element?.instanceId&&(b.browserEvent.altKey&&b.element?await this._terminalService.createTerminal({location:{parentTerminal:b.element}}):this._getFocusMode()==="singleClick"&&this.getSelection().length<=1&&b.element?.focus(!0))})),this.disposables.add(this.onContextMenu(b=>{if(!b.element){this.setSelection([]);return}let S=this.getSelectedElements();(!S||!S.find(y=>b.element===y))&&this.setFocus(b.index!==void 0?[b.index]:[])})),this._terminalTabsSingleSelectedContextKey=dt.tabsSingularSelection.bindTo(t),this._isSplitContextKey=dt.splitTerminalTabFocused.bindTo(t),this.disposables.add(this.onDidChangeSelection(b=>this._updateContextKey())),this.disposables.add(this.onDidChangeFocus(()=>this._updateContextKey())),this.disposables.add(this.onDidOpen(async b=>{let S=b.element;S&&(this._terminalGroupService.setActiveInstance(S),b.editorOptions.preserveFocus||await S.focusWhenReady())})),this._decorationsProvider||(this._decorationsProvider=this.disposables.add(c.createInstance(uct)),this.disposables.add(u.registerDecorationsProvider(this._decorationsProvider))),this.refresh()}get hasText(){return this._hasText}get hasActionBar(){return this._hasActionBar}_getFocusMode(){return this._configurationService.getValue("terminal.integrated.tabs.focusMode")}refresh(e=!0){e&&this._terminalEditingService.isEditable(void 0)&&this.domFocus(),this.splice(0,this.length,this._terminalGroupService.instances.slice())}focusHover(){let e=this.getSelectedElements()[0];e&&this._hoverService.showInstantHover({...ibe(e,this._storageService),target:this.getHTMLElement(),trapFocus:!0},!0)}_updateContextKey(){this._terminalTabsSingleSelectedContextKey.set(this.getSelectedElements().length===1);let e=this.getFocusedElements();this._isSplitContextKey.set(e.length>0&&this._terminalGroupService.instanceIsSplit(e[0]))}layout(e,t){super.layout(e,t);let o=t??this.getHTMLElement().clientWidth,n=o>=63,r=o>105;(this._hasText!==n||this._hasActionBar!==r)&&(this._hasText=n,this._hasActionBar=r,this.refresh())}};sre=I([m(1,X),m(2,Io),m(3,B),m(4,nn),m(5,lc),m(6,DJ),m(7,F),m(8,Ov),m(9,Le),m(10,ce),m(11,ji),m(12,nt)],sre);var lct=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){this._labels=e;this._getSelection=t;this._getHasText=o;this._getHasActionBar=n;this._instantiationService=r;this._terminalConfigurationService=s;this._terminalService=l;this._terminalGroupService=c;this._terminalEditingService=u;this._hoverService=p;this._keybindingService=h;this._listService=g;this._storageService=f;this._themeService=v;this._contextViewService=b;this._commandService=S;this.templateId="terminal.tabs"}renderTemplate(i){let e=M(i,O_o(".terminal-tabs-entry")),t={},o=new N,n=o.add(this._labels.create(e,{supportHighlights:!0,supportDescriptionHighlights:!0,supportIcons:!0,hoverDelegate:{delay:0,showHover:l=>this._hoverService.showDelayedHover({...l,actions:t.hoverActions,target:e,appearance:{showPointer:!0},position:{hoverPosition:this._terminalConfigurationService.config.tabs.location==="left"?1:0}},{groupId:"terminal-tabs-list"})}})),r=M(n.element,O_o(".actions")),s=o.add(new Zi(r,{actionRunner:o.add(new tbe),actionViewItemProvider:(l,c)=>l instanceof Lo?o.add(this._instantiationService.createInstance(xl,l,{hoverDelegate:c.hoverDelegate})):void 0}));return{element:e,label:n,actionBar:s,context:t,elementDisposables:new N,templateDisposables:o}}renderElement(i,e,t){let o=this._getHasText(),n=this._getHasActionBar(),r=this._terminalGroupService.getGroupForInstance(i);if(!r)throw new Error(`Could not find group for instance "${i.instanceId}"`);t.element.classList.toggle("has-text",o),t.element.classList.toggle("is-active",this._terminalGroupService.activeInstance===i);let s="";if(r.terminalInstances.length>1){let v=r.terminalInstances.indexOf(i);v===0?s="\u250C ":v===r.terminalInstances.length-1?s="\u2514 ":s="\u251C "}let l=ibe(i,this._storageService);t.context.hoverActions=l.actions;let c=this._instantiationService.invokeFunction(MJ,i),u="";if(o)this.fillActionBar(i,t),u=s,i.icon&&(u+=`$(${c}) ${i.title}`);else{let v=i.statusList.primary;v&&v.severity>bt.Ignore?u=`${s}$(${v.icon?.id||c})`:u=`${s}$(${c})`}n||t.actionBar.clear(),t.elementDisposables.add(j(t.element,re.AUXCLICK,v=>{v.stopImmediatePropagation(),v.button===1&&this._terminalService.safeDisposeTerminal(i)}));let p=[],h=by(i);h&&p.push(h);let g=SD(i,this._themeService.getColorTheme().type);g&&p.push(...g),t.label.setResource({resource:i.resource,name:u,description:o?i.description:void 0},{fileDecorations:{colors:!0,badges:o},title:{markdown:l.content,markdownNotSupportedFallback:void 0},extraClasses:p});let f=this._terminalEditingService.getEditableData(i);t.label.element.classList.toggle("editable-tab",!!f),f&&(t.elementDisposables.add(this._renderInputBox(t.label.element.querySelector(".monaco-icon-label-container"),i,f)),t.actionBar.clear())}_renderInputBox(i,e,t){let o=e.title||"",n=new Vc(i,this._contextViewService,{validationOptions:{validation:c=>{let u=t.validationMessage(c);return!u||u.severity!==bt.Error?null:{content:u.content,formatContent:!0,type:3}}},ariaLabel:d(14903,null),inputBoxStyles:Cl});n.element.style.height="22px",n.value=o,n.focus(),n.select({start:0,end:o.length});let r=$c((c,u)=>{n.element.style.display="none";let p=n.value;Be(l),n.element.remove(),u&&t.onFinish(p,c)}),s=()=>{if(n.isInputValid()){let c=t.validationMessage(n.value);c?n.showMessage({content:c.content,formatContent:!0,type:c.severity===bt.Info?1:c.severity===bt.Warning?2:3}):n.hideMessage()}};s();let l=[n,Jo(n.inputElement,re.KEY_DOWN,c=>{c.stopPropagation(),c.equals(3)?r(n.isInputValid(),!0):c.equals(9)&&r(!1,!0)}),Jo(n.inputElement,re.KEY_UP,c=>{s()}),j(n.inputElement,re.BLUR,()=>{r(n.isInputValid(),!0)})];return Z(()=>{r(!1,!1)})}disposeElement(i,e,t){t.elementDisposables.clear(),t.actionBar.clear()}disposeTemplate(i){i.elementDisposables.dispose(),i.templateDisposables.dispose()}fillActionBar(i,e){let t=[e.elementDisposables.add(new it("workbench.action.terminal.splitActiveTab",sr.split.short,q.asClassName(R.splitHorizontal),!0,async()=>{this._runForSelectionOrInstance(i,async o=>{this._terminalService.createTerminal({location:{parentTerminal:o}})})}))];if(i.shellLaunchConfig.tabActions)for(let o of i.shellLaunchConfig.tabActions)t.push(e.elementDisposables.add(new it(o.id,o.label,o.icon?q.asClassName(o.icon):void 0,!0,async()=>{this._runForSelectionOrInstance(i,n=>this._commandService.executeCommand(o.id,i))})));t.push(e.elementDisposables.add(new it("workbench.action.terminal.killActiveTab",sr.kill.short,q.asClassName(R.trashcan),!0,async()=>{this._runForSelectionOrInstance(i,o=>this._terminalService.safeDisposeTerminal(o))}))),e.actionBar.clear();for(let o of t)e.actionBar.push(o,{icon:!0,label:!1,keybinding:this._keybindingService.lookupKeybinding(o.id)?.getLabel()})}_runForSelectionOrInstance(i,e){let t=this._getSelection();if(t.includes(i))for(let o of t)o&&e(o);else e(i);this._terminalGroupService.focusTabs(),this._listService.lastFocusedList?.focusNext()}};lct=I([m(5,F),m(6,Uu),m(7,nn),m(8,lc),m(9,DJ),m(10,nt),m(11,_e),m(12,Io),m(13,ce),m(14,Le),m(15,Wn),m(16,ge)],lct);var cct=class{constructor(i){this._terminalGroupService=i}getWidgetAriaLabel(){return d(14901,null)}getAriaLabel(i){let e="",t=this._terminalGroupService.getGroupForInstance(i);if(t&&t.terminalInstances?.length>1){let o=t.terminalInstances.indexOf(i);e=d(14900,null,i.instanceId,i.title,o+1,t.terminalInstances.length)}else e=d(14902,null,i.instanceId,i.title);return e}};cct=I([m(0,lc)],cct);var dct=class extends x{constructor(e,t,o,n){super();this._terminalService=e;this._terminalGroupService=t;this._terminalEditingService=o;this._listService=n;this._autoFocusDisposable=x.None;this._primaryBackend=this._terminalService.getPrimaryBackend()}getDragURI(e){return this._terminalEditingService.getEditingTerminal()?.instanceId===e.instanceId?null:e.resource.toString()}getDragLabel(e,t){return e.length===1?e[0].title:void 0}onDragLeave(){this._autoFocusInstance=void 0,this._autoFocusDisposable.dispose(),this._autoFocusDisposable=x.None}onDragStart(e,t){if(!t.dataTransfer)return;let o=e.getData();if(!Array.isArray(o))return;let n=o.filter(F_o);n.length>0&&t.dataTransfer.setData("Terminals",JSON.stringify(n.map(r=>r.resource.toString())))}onDragOver(e,t,o,n,r){if(e instanceof Cz&&!Ip(r,yl.FILES,yl.RESOURCES,"Terminals",hc.FILES))return!1;let s=this._autoFocusInstance!==t;return s&&(this._autoFocusDisposable.dispose(),this._autoFocusInstance=t),!t&&!Ip(r,"Terminals")?e instanceof uw:(s&&t&&(this._autoFocusDisposable=tn(()=>{this._terminalService.setActiveInstance(t),this._autoFocusInstance=void 0},500,this._store)),{feedback:o?[o]:void 0,accept:!0,effect:{type:1,position:"drop-target"}})}async drop(e,t,o,n,r){this._autoFocusDisposable.dispose(),this._autoFocusInstance=void 0;let s,l=[],c=cHe(r);if(c)for(let p of c){let h=this._terminalService.getInstanceFromResource(p);if(h)Array.isArray(s)?s.push(h):s=[h],this._terminalService.moveToTerminalView(h);else if(this._primaryBackend){let g=Rq(p);g.instanceId&&l.push(this._primaryBackend.requestDetachInstance(g.workspaceId,g.instanceId))}}if(l.length){let p=await Promise.all(l);p=p.filter(g=>g!==void 0);let h;for(let g of p)h=await this._terminalService.createTerminal({config:{attachPersistentProcess:g}});h&&this._terminalService.setActiveInstance(h);return}if(s===void 0){if(!(e instanceof uw)){this._handleExternalDrop(t,r);return}let p=e.getData();if(!p||!Array.isArray(p))return;s=[];for(let h of p)F_o(h)&&s.push(h)}if(!t){this._terminalGroupService.moveGroupToEnd(s),this._terminalService.setActiveInstance(s[0]);let p=this._terminalGroupService.getGroupForInstance(s[0]);if(p){let h=this._terminalGroupService.groups.indexOf(p);this._listService.lastFocusedList?.setSelection([h])}return}this._terminalGroupService.moveGroup(s,t),this._terminalService.setActiveInstance(s[0]);let u=this._terminalGroupService.getGroupForInstance(s[0]);if(u){let p=this._terminalGroupService.groups.indexOf(u);this._listService.lastFocusedList?.setSelection([p])}}async _handleExternalDrop(e,t){if(!e||!t.dataTransfer)return;let o,n=t.dataTransfer.getData(yl.RESOURCES);n&&(o=A.parse(JSON.parse(n)[0]));let r=t.dataTransfer.getData(hc.FILES);!o&&r&&(o=A.file(JSON.parse(r)[0])),!o&&t.dataTransfer.files.length>0&&L_(t.dataTransfer.files[0])&&(o=A.file(L_(t.dataTransfer.files[0]))),o&&(this._terminalService.setActiveInstance(e),e.focus(),await e.sendPath(o,!1))}};dct=I([m(0,nn),m(1,lc),m(2,DJ),m(3,Io)],dct);var uct=class extends x{constructor(e){super();this._terminalService=e;this.label=d(14899,null);this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._register(this._terminalService.onAnyInstancePrimaryStatusChange(t=>this._onDidChange.fire([t.resource])))}provideDecorations(e){if(e.scheme!==Q.vscodeTerminal)return;let t=this._terminalService.getInstanceFromResource(e);if(!t)return;let o=t?.statusList?.primary;if(o?.icon)return{color:X3t(o.severity),letter:o.icon,tooltip:o.tooltip}}};uct=I([m(0,nn)],uct);function F_o(a){return xi(a)&&"instanceId"in a}var VVi=d(14741,null),khn=sr.actionCategory,da=(()=>{let a=C.or(dt.processSupported,dt.terminalHasBeenCreated);return{terminalAvailable:a,terminalAvailable_and_opened:C.and(a,dt.isOpen),terminalAvailable_and_editorActive:C.and(a,dt.terminalEditorActive),terminalAvailable_and_singularSelection:C.and(a,dt.tabsSingularSelection),focusInAny_and_normalBuffer:C.and(dt.focusInAny,dt.altBufferActive.negate())}})();async function BVi(a,i,e,t){switch(t.config.splitCwd){case"workspaceRoot":if(i!==void 0&&e!==void 0){if(i.length===1)return i[0].uri;if(i.length>1){let o={placeHolder:d(14766,null)},n=await e.executeCommand(rM,[o]);return n?Promise.resolve(n.uri):void 0}}return"";case"initial":return a.getInitialCwd();case"inherited":return a.getSpeculativeCwd()}}var p1e=class extends it{constructor(e){super("workbench.action.terminal.launchHelp",d(14742,null));this._openerService=e}async run(){this._openerService.open("https://aka.ms/vscode-troubleshoot-terminal-launch")}};p1e=I([m(0,Je)],p1e);function Er(a){a.f1=a.f1??!0,a.category=a.category??khn,a.precondition=a.precondition??dt.processSupported;let i=a.run,e=a;return delete e.run,W(class extends K{constructor(){super(e)}run(t,o,n){return i(V_o(t),t,o,n)}})}function Ehn(a){if(Array.isArray(a)){if(a.every(i=>i instanceof R6))return a}else if(a instanceof R6)return[a]}function J3t(a){let i=a.run;return Er({...a,run:async(e,t,o,n)=>{let r=Thn(t,n);if(!r){let l=(a.activeInstanceType==="view"?e.groupService:a.activeInstanceType==="editor"?e.editorService:e.service).activeInstance;if(!l)return;r=[l]}let s=[];for(let l of r)s.push(i(l,e,t,o));await Promise.all(s),a.runAfter&&a.runAfter(r,e,t,o)}})}function Jl(a){let i=a.run;return Er({...a,run:(e,t,o)=>{let n=e.service.activeInstance;if(n)return i(n,e,t,o)}})}function zm(a){let i=a.run;return Er({...a,run:(e,t,o)=>{let n=vt.find(e.service.detachedInstances,s=>s.xterm.isFocused);if(n)return i(n.xterm,t,n,o);let r=e.service.activeInstance;if(r?.xterm)return i(r.xterm,t,r,o)}})}function V_o(a){return{service:a.get(nn),configService:a.get(Uu),groupService:a.get(lc),instanceService:a.get(Nm),editorService:a.get(Fv),editingService:a.get(DJ),profileService:a.get(vy),profileResolverService:a.get(Ag)}}function B_o(){Er({id:"workbench.action.terminal.newInActiveWorkspace",title:L(14762,"Create New Terminal (In Active Workspace)"),run:async i=>{if(i.service.isProcessSupportRegistered){let e=await i.service.createTerminal({location:i.configService.defaultLocation});if(!e)return;i.service.setActiveInstance(e),await obe(e,i)}}}),HVi([]),Er({id:"workbench.action.createTerminalEditor",title:L(14746,"Create New Terminal in Editor Area"),run:async(i,e,t)=>{function o(s){return xi(s)&&"location"in s}let n=o(t)?t:{location:{viewColumn:jn}};await(await i.service.createTerminal(n)).focusWhenReady()}}),Er({id:"workbench.action.createTerminalEditorSameGroup",title:L(14746,"Create New Terminal in Editor Area"),f1:!1,run:async(i,e,t)=>{let o=e.get(wt);await(await i.service.createTerminal({location:{viewColumn:GC(o,o.activeGroup)}})).focusWhenReady()}}),Er({id:"workbench.action.createTerminalEditorSide",title:L(14747,"Create New Terminal in Editor Area to the Side"),run:async i=>{await(await i.service.createTerminal({location:{viewColumn:In}})).focusWhenReady()}}),Er({id:"workbench.action.terminal.newInNewWindow",title:sr.newInNewWindow,precondition:da.terminalAvailable,keybinding:{primary:3675,mac:{primary:1883},weight:200},run:async i=>{await(await i.service.createTerminal({location:{viewColumn:Mg,auxiliary:{compact:!0}}})).focusWhenReady()}}),J3t({id:"workbench.action.terminal.moveToEditor",title:sr.moveToEditor,precondition:da.terminalAvailable_and_opened,activeInstanceType:"view",run:(i,e)=>e.service.moveToEditor(i),runAfter:i=>i.at(-1)?.focus()}),J3t({id:"workbench.action.terminal.moveIntoNewWindow",title:sr.moveIntoNewWindow,precondition:da.terminalAvailable_and_opened,run:(i,e)=>e.service.moveIntoNewEditor(i),runAfter:i=>i.at(-1)?.focus()}),Er({id:"workbench.action.terminal.moveToTerminalPanel",title:sr.moveToTerminalPanel,precondition:da.terminalAvailable_and_editorActive,run:(i,e,t)=>{let o=U_o(t)??i.editorService.activeInstance;o&&i.service.moveToTerminalView(o)}}),Er({id:"workbench.action.terminal.focusPreviousPane",title:L(14753,"Focus Previous Terminal in Terminal Group"),keybinding:{primary:527,secondary:[528],mac:{primary:2575,secondary:[2576]},when:C.and(dt.focus,dt.splitTerminalActive),weight:201},precondition:da.terminalAvailable,run:async i=>{i.groupService.activeGroup?.focusPreviousPane(),await i.groupService.showPanel(!0)}}),Er({id:"workbench.action.terminal.focusNextPane",title:L(14751,"Focus Next Terminal in Terminal Group"),keybinding:{primary:529,secondary:[530],mac:{primary:2577,secondary:[2578]},when:C.and(dt.focus,dt.splitTerminalActive),weight:201},precondition:da.terminalAvailable,run:async i=>{i.groupService.activeGroup?.focusNextPane(),await i.groupService.showPanel(!0)}}),Er({id:"workbench.action.terminal.resizePaneLeft",title:L(14774,"Resize Terminal Left"),keybinding:{linux:{primary:3087},mac:{primary:2319},when:dt.focus,weight:200},precondition:da.terminalAvailable,run:i=>i.groupService.activeGroup?.resizePane(0)}),Er({id:"workbench.action.terminal.resizePaneRight",title:L(14775,"Resize Terminal Right"),keybinding:{linux:{primary:3089},mac:{primary:2321},when:dt.focus,weight:200},precondition:da.terminalAvailable,run:i=>i.groupService.activeGroup?.resizePane(1)}),Er({id:"workbench.action.terminal.resizePaneUp",title:L(14776,"Resize Terminal Up"),keybinding:{mac:{primary:2320},when:dt.focus,weight:200},precondition:da.terminalAvailable,run:i=>i.groupService.activeGroup?.resizePane(2)}),Er({id:"workbench.action.terminal.resizePaneDown",title:L(14773,"Resize Terminal Down"),keybinding:{mac:{primary:2322},when:dt.focus,weight:200},precondition:da.terminalAvailable,run:i=>i.groupService.activeGroup?.resizePane(3)}),Er({id:"workbench.action.terminal.focus",title:sr.focus,keybinding:{when:C.and($a,wAt,cu.isEqualTo("terminal")),primary:2066,weight:200},precondition:da.terminalAvailable,run:async i=>{let e=i.service.activeInstance||await i.service.createTerminal({location:1});e&&(i.service.setActiveInstance(e),await obe(e,i))}}),Er({id:"workbench.action.terminal.focusTabs",title:L(14749,"Focus Terminal Tabs View"),keybinding:{primary:3165,weight:200,when:C.or(dt.tabsFocus,dt.focus)},precondition:da.terminalAvailable,run:i=>i.groupService.focusTabs()}),Er({id:"workbench.action.terminal.focusNext",title:L(14750,"Focus Next Terminal Group"),precondition:da.terminalAvailable,keybinding:{primary:2060,mac:{primary:3166},when:C.and(dt.focus,dt.editorFocus.negate()),weight:200},run:async i=>{i.groupService.setActiveGroupToNext(),await i.groupService.showPanel(!0)}}),Er({id:"workbench.action.terminal.focusPrevious",title:L(14752,"Focus Previous Terminal Group"),precondition:da.terminalAvailable,keybinding:{primary:2059,mac:{primary:3164},when:C.and(dt.focus,dt.editorFocus.negate()),weight:200},run:async i=>{i.groupService.setActiveGroupToPrevious(),await i.groupService.showPanel(!0)}}),Er({id:"workbench.action.terminal.runSelectedText",title:L(14779,"Run Selected Text In Active Terminal"),run:async(i,e)=>{let o=e.get(qt).getActiveCodeEditor();if(!o||!o.hasModel())return;let n=await i.service.getActiveOrCreateInstance({acceptsInput:!0}),r=o.getSelection(),s;if(r.isEmpty())s=o.getModel().getLineContent(r.selectionStartLineNumber).trim();else{let l=ei?1:2;s=o.getModel().getValueInRange(r,l)}n.sendText(s,!0,!0),await i.service.revealActiveTerminal(!0)}}),Er({id:"workbench.action.terminal.runActiveFile",title:L(14777,"Run Active File In Active Terminal"),precondition:da.terminalAvailable,run:async(i,e)=>{let t=e.get(qt),o=e.get(Ne),n=e.get(At),r=t.getActiveCodeEditor();if(!r||!r.hasModel())return;let s=await i.service.getActiveOrCreateInstance({acceptsInput:!0}),l=s?s.hasRemoteAuthority:!!n.remoteAuthority,c=r.getModel().uri;if(!l&&c.scheme!==Q.file&&c.scheme!==Q.vscodeUserData||l&&c.scheme!==Q.vscodeRemote){o.warn(d(14778,null));return}return await s.sendPath(c,!0),i.groupService.showPanel()}}),zm({id:"workbench.action.terminal.scrollDown",title:L(14780,"Scroll Down (Line)"),keybinding:{primary:2572,linux:{primary:3090},when:da.focusInAny_and_normalBuffer,weight:200},precondition:da.terminalAvailable,run:i=>i.scrollDownLine()}),zm({id:"workbench.action.terminal.scrollDownPage",title:L(14781,"Scroll Down (Page)"),keybinding:{primary:1036,mac:{primary:12},when:da.focusInAny_and_normalBuffer,weight:200},precondition:da.terminalAvailable,run:i=>i.scrollDownPage()}),zm({id:"workbench.action.terminal.scrollToBottom",title:L(14782,"Scroll to Bottom"),keybinding:{primary:2061,linux:{primary:1037},when:da.focusInAny_and_normalBuffer,weight:200},precondition:da.terminalAvailable,run:i=>i.scrollToBottom()}),zm({id:"workbench.action.terminal.scrollUp",title:L(14784,"Scroll Up (Line)"),keybinding:{primary:2571,linux:{primary:3088},when:da.focusInAny_and_normalBuffer,weight:200},precondition:da.terminalAvailable,run:i=>i.scrollUpLine()}),zm({id:"workbench.action.terminal.scrollUpPage",title:L(14785,"Scroll Up (Page)"),f1:!0,keybinding:{primary:1035,mac:{primary:11},when:da.focusInAny_and_normalBuffer,weight:200},precondition:da.terminalAvailable,run:i=>i.scrollUpPage()}),zm({id:"workbench.action.terminal.scrollToTop",title:L(14783,"Scroll to Top"),keybinding:{primary:2062,linux:{primary:1038},when:da.focusInAny_and_normalBuffer,weight:200},precondition:da.terminalAvailable,run:i=>i.scrollToTop()}),zm({id:"workbench.action.terminal.clearSelection",title:L(14745,"Clear Selection"),keybinding:{primary:9,when:C.and(dt.focusInAny,dt.textSelected,dt.notFindVisible),weight:200},precondition:da.terminalAvailable,run:i=>{i.hasSelection()&&i.clearSelection()}}),Er({id:"workbench.action.terminal.changeIcon",title:sr.changeIcon,precondition:da.terminalAvailable,run:(i,e,t)=>pct(i,t)?.changeIcon()}),Er({id:"workbench.action.terminal.changeIconActiveTab",title:sr.changeIcon,f1:!1,precondition:da.terminalAvailable_and_singularSelection,run:async(i,e,t)=>{let o;if(i.groupService.lastAccessedMenu==="inline-tab"){pct(i,t)?.changeIcon();return}for(let n of u1e(e)??[])o=await n.changeIcon(o)}}),Er({id:"workbench.action.terminal.changeColor",title:sr.changeColor,precondition:da.terminalAvailable,run:(i,e,t)=>pct(i,t)?.changeColor()}),Er({id:"workbench.action.terminal.changeColorActiveTab",title:sr.changeColor,f1:!1,precondition:da.terminalAvailable_and_singularSelection,run:async(i,e,t)=>{let o,n=0;if(i.groupService.lastAccessedMenu==="inline-tab"){pct(i,t)?.changeColor();return}for(let r of u1e(e)??[]){let s=n!==0;o=await r.changeColor(o,s),n++}}}),Er({id:"workbench.action.terminal.rename",title:sr.rename,precondition:da.terminalAvailable,run:(i,e,t)=>W_o(i,e,t)}),Er({id:"workbench.action.terminal.renameActiveTab",title:sr.rename,f1:!1,keybinding:{primary:60,mac:{primary:3},when:C.and(dt.tabsFocus),weight:200},precondition:da.terminalAvailable_and_singularSelection,run:async(i,e)=>{let t=e.get(lc),o=e.get(Ne),n=u1e(e),r=n?.[0];if(r){if(t.lastAccessedMenu==="inline-tab")return W_o(i,e,r);i.editingService.setEditingTerminal(r),i.editingService.setEditable(r,{validationMessage:s=>_hn(s),onFinish:async(s,l)=>{if(i.editingService.setEditable(r,null),i.editingService.setEditingTerminal(void 0),l){let c=[];for(let u of n)c.push((async()=>{await u.rename(s)})());try{await Promise.all(c)}catch(u){o.error(u)}}}})}}}),Jl({id:"workbench.action.terminal.detachSession",title:L(14748,"Detach Session"),run:i=>i.detachProcessAndDispose(3)}),Er({id:"workbench.action.terminal.attachToSession",title:L(14743,"Attach to Session"),run:async(i,e)=>{let t=e.get(Ue),o=e.get(rt),n=e.get(bo),r=e.get(Ne),s=n.getConnection()?.remoteAuthority??void 0,l=await e.get(Nm).getBackend(s);if(!l)throw new Error(`No backend registered for remote authority '${s}'`);let c=await l.listProcesses();l.reduceConnectionGraceTime();let p=c.filter(g=>!i.service.isAttachedToTerminal(g)).map(g=>{let f=o.getUriLabel(A.file(g.cwd));return{label:g.title,detail:g.workspaceName?`${g.workspaceName} \u2E31 ${f}`:f,description:g.pid?String(g.pid):"",term:g}});if(p.length===0){r.info(d(14740,null));return}let h=await t.pick(p,{canPickMany:!1});if(h){let g=await i.service.createTerminal({config:{attachPersistentProcess:h.term}});i.service.setActiveInstance(g),await obe(g,i)}}}),Jl({id:"workbench.action.terminal.scrollToPreviousCommand",title:sr.scrollToPreviousCommand,keybinding:{primary:2064,when:C.and(dt.focus,$a.negate()),weight:200},precondition:da.terminalAvailable,icon:R.arrowUp,menu:[{id:D.ViewTitle,group:"navigation",order:4,when:C.equals("view",Sc),isHiddenByDefault:!0},...[D.EditorTitle,D.CompactWindowEditorTitle].map(i=>({id:i,group:"1_shellIntegration",order:4,when:Wo.Scheme.isEqualTo(Q.vscodeTerminal),isHiddenByDefault:!0}))],run:i=>i.xterm?.markTracker.scrollToPreviousMark(void 0,void 0,i.capabilities.has(2))}),Jl({id:"workbench.action.terminal.scrollToNextCommand",title:sr.scrollToNextCommand,keybinding:{primary:2066,when:C.and(dt.focus,$a.negate()),weight:200},precondition:da.terminalAvailable,icon:R.arrowDown,menu:[{id:D.ViewTitle,group:"navigation",order:5,when:C.equals("view",Sc),isHiddenByDefault:!0},...[D.EditorTitle,D.CompactWindowEditorTitle].map(i=>({id:i,group:"1_shellIntegration",order:5,when:Wo.Scheme.isEqualTo(Q.vscodeTerminal),isHiddenByDefault:!0}))],run:i=>{i.xterm?.markTracker.scrollToNextMark(),i.focus()}}),Jl({id:"workbench.action.terminal.selectToPreviousCommand",title:L(14790,"Select to Previous Command"),keybinding:{primary:3088,when:dt.focus,weight:200},precondition:da.terminalAvailable,run:i=>{i.xterm?.markTracker.selectToPreviousMark(),i.focus()}}),Jl({id:"workbench.action.terminal.selectToNextCommand",title:L(14788,"Select to Next Command"),keybinding:{primary:3090,when:dt.focus,weight:200},precondition:da.terminalAvailable,run:i=>{i.xterm?.markTracker.selectToNextMark(),i.focus()}}),zm({id:"workbench.action.terminal.selectToPreviousLine",title:L(14791,"Select to Previous Line"),precondition:da.terminalAvailable,run:async(i,e,t)=>{i.markTracker.selectToPreviousLine(),(t||i).focus()}}),zm({id:"workbench.action.terminal.selectToNextLine",title:L(14789,"Select to Next Line"),precondition:da.terminalAvailable,run:async(i,e,t)=>{i.markTracker.selectToNextLine(),(t||i).focus()}}),Er({id:"workbench.action.terminal.newWithCwd",title:sr.newWithCwd,metadata:{description:sr.newWithCwd.value,args:[{name:"args",schema:{type:"object",required:["cwd"],properties:{cwd:{description:d(14763,null),type:"string"}}}}]},run:async(i,e,t)=>{let o=t?WVi(t.cwd):void 0,n=await i.service.createTerminal({cwd:o});n&&(i.service.setActiveInstance(n),await obe(n,i))}}),Jl({id:"workbench.action.terminal.renameWithArg",title:sr.renameWithArgs,metadata:{description:sr.renameWithArgs.value,args:[{name:"args",schema:{type:"object",required:["name"],properties:{name:{description:d(14771,null),type:"string",minLength:1}}}}]},precondition:da.terminalAvailable,f1:!1,run:async(i,e,t,o)=>{let n=t.get(Ne),r=o?WVi(o.name):void 0;if(!r){n.warn(d(14772,null));return}i.rename(r)}}),Jl({id:"workbench.action.terminal.relaunch",title:L(14769,"Relaunch Active Terminal"),run:i=>i.relaunch()}),Er({id:"workbench.action.terminal.split",title:sr.split,precondition:C.or(dt.processSupported,dt.webExtensionContributedProfile),keybinding:{primary:3098,weight:200,mac:{primary:2141,secondary:[1306]},when:dt.focus},icon:R.splitHorizontal,run:async(i,e,t)=>{let o=xi(t)?t:void 0,n=e.get(ge),r=e.get(Pe),s=H_o(o),l=(await i.service.getInstanceHost(s?.location)).activeInstance;if(!l)return;let c=await BVi(l,r.getWorkspace().folders,n,i.configService);if(c===void 0)return;let u=await i.service.createTerminal({location:{parentTerminal:l},config:s?.config,cwd:c});await obe(u,i)}}),Er({id:"workbench.action.terminal.splitActiveTab",title:sr.split,f1:!1,keybinding:{primary:3098,mac:{primary:2141,secondary:[1306]},weight:200,when:dt.tabsFocus},run:async(i,e)=>{let t=u1e(e);if(t){let o=[];for(let n of t)o.push((async()=>{await i.service.createTerminal({location:{parentTerminal:n}}),await i.groupService.showPanel(!0)})());await Promise.all(o)}}}),J3t({id:"workbench.action.terminal.unsplit",title:sr.unsplit,precondition:da.terminalAvailable,run:async(i,e)=>{let t=e.groupService.getGroupForInstance(i);t&&t?.terminalInstances.length>1&&e.groupService.unsplitInstance(i)}}),Er({id:"workbench.action.terminal.joinActiveTab",title:L(14757,"Join Terminals"),precondition:C.and(da.terminalAvailable,dt.tabsSingularSelection.toNegated()),run:async(i,e)=>{let t=u1e(e);t&&t.length>1&&i.groupService.joinInstances(t)}}),Er({id:"workbench.action.terminal.join",title:L(14754,"Join Terminals..."),precondition:da.terminalAvailable,run:async(i,e)=>{let t=e.get(Le),o=e.get(Ne),n=e.get(Ue),r=[];if(i.groupService.instances.length<=1){o.warn(d(14755,null));return}let s=i.groupService.instances.filter(c=>c.instanceId!==i.groupService.activeInstance?.instanceId);for(let c of s)if(i.groupService.getGroupForInstance(c)?.terminalInstances.length===1){let h=`$(${MJ(e,c)}): ${c.title}`,g=[],f=by(c);f&&g.push(f);let v=SD(c,t.getColorTheme().type);v&&g.push(...v),r.push({terminal:c,label:h,iconClasses:g})}if(r.length===0){o.warn(d(14756,null));return}let l=await n.pick(r,{});l&&i.groupService.joinInstances([l.terminal,i.groupService.activeInstance])}}),Jl({id:"workbench.action.terminal.splitInActiveWorkspace",title:L(14793,"Split Terminal (In Active Workspace)"),run:async(i,e)=>{(await e.service.createTerminal({location:{parentTerminal:i}}))?.target!==2&&await e.groupService.showPanel(!0)}}),zm({id:"workbench.action.terminal.selectAll",title:L(14786,"Select All"),precondition:da.terminalAvailable,keybinding:[{primary:0,mac:{primary:2079},weight:200,when:dt.focusInAny}],run:i=>i.selectAll()}),Er({id:"workbench.action.terminal.new",title:L(14761,"Create New Terminal"),precondition:C.or(dt.processSupported,dt.webExtensionContributedProfile),icon:vbo,keybinding:{primary:3163,mac:{primary:1371},weight:200},run:async(i,e,t)=>{let o=xi(t)?t:void 0,n=e.get(Pe),r=e.get(ge),s=e.get(wt),l=n.getWorkspace().folders;if(o&&Ru(o)&&(o.altKey||o.ctrlKey)){await i.service.createTerminal({location:{splitActiveTerminal:!0}});return}if(i.service.isProcessSupportRegistered){o=!o||Ru(o)?{}:o,zy(Ki())&&!o.location&&(o.location={viewColumn:GC(s,s.activeGroup)});let c;if(l.length<=1)c=await i.service.createTerminal(o);else{let u=(await Lhn(e))?.cwd;if(!u)return;o.cwd=u,c=await i.service.createTerminal(o)}i.service.setActiveInstance(c),await obe(c,i)}else i.profileService.contributedProfiles.length>0?r.executeCommand("workbench.action.terminal.newWithProfile"):r.executeCommand("workbench.action.terminal.toggleTerminal")}});async function a(i,e){e&&(await i.service.safeDisposeTerminal(e),i.groupService.instances.length>0&&await i.groupService.showPanel(!0))}Er({id:"workbench.action.terminal.kill",title:L(14758,"Kill the Active Terminal Instance"),precondition:C.or(da.terminalAvailable,dt.isOpen),icon:SKt,run:async i=>a(i,i.groupService.activeInstance)}),Er({id:"workbench.action.terminal.killViewOrEditor",title:sr.kill,f1:!1,precondition:C.or(da.terminalAvailable,dt.isOpen),run:async i=>a(i,i.service.activeInstance)}),Er({id:"workbench.action.terminal.killAll",title:L(14759,"Kill All Terminals"),precondition:C.or(da.terminalAvailable,dt.isOpen),icon:R.trash,run:async i=>{let e=[];for(let t of i.service.instances)e.push(i.service.safeDisposeTerminal(t));await Promise.all(e)}}),Er({id:"workbench.action.terminal.killEditor",title:L(14760,"Kill the Active Terminal in Editor Area"),precondition:da.terminalAvailable,keybinding:{primary:2101,win:{primary:2110,secondary:[2101]},weight:200,when:C.and(dt.focus,dt.editorFocus)},run:(i,e)=>e.get(ge).executeCommand(dx)}),Er({id:"workbench.action.terminal.killActiveTab",title:sr.kill,f1:!1,precondition:C.or(da.terminalAvailable,dt.isOpen),keybinding:{primary:20,mac:{primary:2049,secondary:[20]},weight:200,when:dt.tabsFocus},run:async(i,e)=>{let t=[];for(let o of u1e(e,!0)??[])t.push(i.service.safeDisposeTerminal(o));await Promise.all(t),i.groupService.focusTabs()}}),Er({id:"workbench.action.terminal.focusHover",title:sr.focusHover,precondition:C.or(da.terminalAvailable,dt.isOpen),keybinding:{primary:Vi(2089,2087),weight:200,when:C.or(dt.tabsFocus,dt.focus)},run:i=>i.groupService.focusHover()}),Jl({id:"workbench.action.terminal.clear",title:L(14744,"Clear"),precondition:da.terminalAvailable,keybinding:[{primary:0,mac:{primary:2089},weight:201,when:C.or(C.and(dt.focus,$a.negate()),C.and($a,Dd,cu.isEqualTo("terminal")))}],run:i=>i.clearBuffer()}),Er({id:"workbench.action.terminal.selectDefaultShell",title:L(14787,"Select Default Profile"),run:i=>i.service.showProfileQuickPick("setDefault")}),Er({id:"workbench.action.terminal.openSettings",title:L(14767,"Configure Terminal Settings"),precondition:da.terminalAvailable,run:(i,e)=>e.get(Go).openSettings({jsonEditor:!1,query:"@feature:terminal"})}),Jl({id:"workbench.action.terminal.setDimensions",title:L(14792,"Set Fixed Dimensions"),precondition:da.terminalAvailable_and_opened,run:i=>i.setFixedDimensions()}),J3t({id:"workbench.action.terminal.sizeToContentWidth",title:sr.toggleSizeToContentWidth,precondition:da.terminalAvailable_and_opened,keybinding:{primary:568,weight:200,when:dt.focus},run:i=>i.toggleSizeToContentWidth()}),Er({id:"workbench.action.terminal.switchTerminal",title:L(14794,"Switch Terminal"),precondition:da.terminalAvailable,run:async(i,e,t)=>{let o=WVi(t);if(!o)return;if(o===UO.text){i.service.refreshActiveGroup();return}if(o===VVi){e.get(B).updateValue("terminal.integrated.tabs.enabled",!0);return}let r=/^([0-9]+): /.exec(o);if(r)return i.groupService.setActiveGroupByIndex(Number(r[1])-1),i.groupService.showPanel(!0);let s=i.profileService.availableProfiles,l=o.substring(4);if(s){let c=s.find(u=>u.profileName===l);if(c){let u=await i.service.createTerminal({config:c});i.service.setActiveInstance(u)}else console.warn(`No profile with name "${l}"`)}else console.warn(`Unmatched terminal item: "${o}"`)}})}function Thn(a,i){let e=a.get(nn),t=[],o=Ehn(i);if(o&&o.length>0){for(let n of o){let r=e.getInstanceFromId(n.instanceId);r&&t.push(r)}if(t.length>0)return t}}function u1e(a,i,e){let t=a.get(Io),o=a.get(lc),n=[],r=t.lastFocusedList instanceof sre?t.lastFocusedList:void 0,s=r?.getSelection();if(o.lastAccessedMenu==="inline-tab"&&!s?.length)return o.activeInstance?[o.activeInstance]:void 0;if(!r||!s)return;let l=r.getFocus(),c=o.instances;if(l.length===1&&!s.includes(l[0]))return n.push(c[l[0]]),n;for(let u of s)n.push(c[u]);return n.filter(u=>!!u)}function _hn(a){return!a||a.trim().length===0?{content:d(14736,null),severity:ft.Info}:null}function Dhn(a){return xi(a)&&"profileName"in a}function H_o(a){return Dhn(a)?{config:a,location:a.location}:a}var FVi;function HVi(a){let i=sMt(a);return FVi?.dispose(),FVi=W(class extends K{constructor(){super({id:"workbench.action.terminal.newWithProfile",title:L(14764,"Create New Terminal (With Profile)"),f1:!0,precondition:C.or(dt.processSupported,dt.webExtensionContributedProfile),metadata:{description:"workbench.action.terminal.newWithProfile",args:[{name:"args",schema:{type:"object",required:["profileName"],properties:{profileName:{description:d(14765,null),type:"string",enum:i.values,markdownEnumDescriptions:i.markdownDescriptions},location:{description:d(14737,null),type:"string",enum:["view","editor"],enumDescriptions:[d(14739,null),d(14738,null)]}}}}]}})}async run(e,t,o){let n=V_o(e),r=e.get(Pe),s=e.get(ge),l,c,u,p;if(xi(t)&&t&&No(t,{profileName:!0})){let f=function(v){return xi(v)&&"location"in v},g=n.profileService.availableProfiles.find(v=>v.profileName===t.profileName);if(!g)throw new Error(`Could not find terminal profile "${t.profileName}"`);if(c={config:g},f(t))switch(t.location){case"editor":c.location=2;break;case"view":c.location=1;break}}else Ru(t)||kgt(t)||xg(t)?(l=t,c=o?{config:o}:void 0):c=H_o(t);if(l&&(l.altKey||l.ctrlKey)){let g=n.service.activeInstance;if(g){await n.service.createTerminal({location:{parentTerminal:g},config:c?.config});return}}if(r.getWorkspace().folders.length>1){let g={placeHolder:d(14766,null)},f=await s.executeCommand(rM,[g]);if(!f)return;p=f.uri}c?(c.cwd=p,u=await n.service.createTerminal(c)):u=await n.service.showProfileQuickPick("createInstance",p),u&&(n.service.setActiveInstance(u),await obe(u,n))}}),FVi}function pct(a,i){return a.service.getInstanceFromResource(U_o(i))||a.service.activeInstance}async function Lhn(a,i){let e=a.get(Ue),t=a.get(rt),o=a.get(Pe),n=a.get(Tt),r=a.get(_t),s=a.get(B),l=a.get(Tp),c=o.getWorkspace().folders;if(!c.length)return;let u=await Promise.all(c.map(b=>Rhn(b,s,l))),p=Mhn(u);if(p.length===1)return p[0];let h=p.map(b=>{let S=b.folder.name,y=b.isOverridden?d(14768,null,t.getUriLabel(b.cwd,{relative:!b.isAbsolute})):t.getUriLabel(ci(b.cwd),{relative:!0});return{label:S,description:y!==S?y:void 0,pair:b,iconClasses:aa(n,r,b.cwd,2)}}),g={placeHolder:d(14766,null),matchOnDescription:!0,canPickMany:!1},f=i||Se.None;return(await e.pick(h,g,f))?.pair}async function Rhn(a,i,e){let t=i.getValue("terminal.integrated.cwd",{resource:a.uri});if(!Fe(t)||t.length===0)return{folder:a,cwd:a.uri,isAbsolute:!1,isOverridden:!1};let o=await e.resolveAsync(a,t);return Zl(o)||o.startsWith(TS.VARIABLE_LHS)?{folder:a,isAbsolute:!0,isOverridden:!0,cwd:A.from({...a.uri,path:o})}:{folder:a,isAbsolute:!1,isOverridden:!0,cwd:A.joinPath(a.uri,o)}}function Mhn(a){let i=new Map;for(let o of a){let n=o.cwd.toString();(!i.get(n)||n===o.folder.uri.toString())&&i.set(n,o)}let e=new Set(i.values());return a.filter(o=>e.has(o))}async function obe(a,i){let e=a??i.service.activeInstance??i.editorService.activeInstance??i.groupService.activeInstance;if(!e){i.groupService.instances.length>0&&await i.groupService.showPanel(!0);return}await i.service.focusInstance(e)}async function W_o(a,i,e){let t=e;if((!t||!t?.rename)&&(t=pct(a,e)),t){let o=await i.get(Ue).input({value:t.title,prompt:d(14770,null)});o&&t.rename(o)}}function U_o(a){return A.isUri(a)?a:void 0}function WVi(a){return Fe(a)?a:void 0}function z_o(){Phn()}function Phn(){for(let a=0;a<9;a++){let i=a,e=a+1;Ct.registerCommandAndKeybindingRule({id:`workbench.action.terminal.focusAtIndex${e}`,weight:200,when:void 0,primary:0,handler:t=>(t.get(lc).setActiveInstanceByIndex(i),t.get(lc).showPanel(!0))})}}var m1e=class extends x{constructor(e){super();this._configurationService=e;this._onConfigChanged=this._register(new E);this._fontMetrics=this._register(new UVi(this,this._configurationService)),this._register(U.runAndSubscribe(this._configurationService.onDidChangeConfiguration,t=>{(!t||t.affectsConfiguration(Vv))&&this._updateConfig()}))}get config(){return this._config}get defaultLocation(){return this.config.defaultLocation==="editor"?2:1}get onConfigChanged(){return this._onConfigChanged.event}setPanelContainer(e){return this._fontMetrics.setPanelContainer(e)}configFontIsMonospace(){return this._fontMetrics.configFontIsMonospace()}getFont(e,t,o){return this._fontMetrics.getFont(e,t,o)}_updateConfig(){let e={...this._configurationService.getValue(Vv)};e.fontWeight=this._normalizeFontWeight(e.fontWeight,$io),e.fontWeightBold=this._normalizeFontWeight(e.fontWeightBold,jio),this._config=e,this._onConfigChanged.fire()}_normalizeFontWeight(e,t){return e==="normal"||e==="bold"?e:zVi(e,r7e,s7e,t)}};m1e=I([m(0,B)],m1e);var UVi=class extends x{constructor(e,t){super();this._terminalConfigurationService=e;this._configurationService=t;this.linuxDistro=1;this._register(Z(()=>this._charMeasureElement?.remove()))}setPanelContainer(e){this._panelContainer=e}configFontIsMonospace(){let t=this._terminalConfigurationService.config.fontFamily||this._configurationService.getValue("editor").fontFamily||fu.fontFamily,o=this._getBoundingRectFor("i",t,15),n=this._getBoundingRectFor("w",t,15);return!o||!n||!o.width||!n.width?!0:o.width===n.width}getFont(e,t,o){let n=this._configurationService.getValue("editor"),r=this._terminalConfigurationService.config.fontFamily||n.fontFamily||fu.fontFamily||"monospace",s=zVi(this._terminalConfigurationService.config.fontSize,6,100,fu.fontSize);this._terminalConfigurationService.config.fontFamily||(this.linuxDistro===2&&(r="'DejaVu Sans Mono'"),this.linuxDistro===3&&(r="'Ubuntu Mono'",s=zVi(s+2,6,100,fu.fontSize))),r+=", monospace",Ze&&(r+=", AppleBraille");let l=this._terminalConfigurationService.config.letterSpacing?Math.max(Math.floor(this._terminalConfigurationService.config.letterSpacing),qio):aMt,c=this._terminalConfigurationService.config.lineHeight?Math.max(this._terminalConfigurationService.config.lineHeight,1):lMt;if(o)return{fontFamily:r,fontSize:s,letterSpacing:l,lineHeight:c};if(t?._renderService?._renderer.value){let u=t._renderService.dimensions.css.cell;if(u?.width&&u?.height)return{fontFamily:r,fontSize:s,letterSpacing:l,lineHeight:c,charHeight:u.height/c,charWidth:u.width-Math.round(l)/e.devicePixelRatio}}return this._measureFont(e,r,s,l,c)}_createCharMeasureElementIfNecessary(){if(!this._panelContainer)throw new Error("Cannot measure element when terminal is not attached");return(!this._charMeasureElement||!this._charMeasureElement.parentElement)&&(this._charMeasureElement=document.createElement("div"),this._panelContainer.appendChild(this._charMeasureElement)),this._charMeasureElement}_getBoundingRectFor(e,t,o){let n;try{n=this._createCharMeasureElementIfNecessary()}catch{return}let r=n.style;r.display="inline-block",r.fontFamily=t,r.fontSize=o+"px",r.lineHeight="normal",n.innerText=e;let s=n.getBoundingClientRect();return r.display="none",s}_measureFont(e,t,o,n,r){let s=this._getBoundingRectFor("X",t,o);if(this._lastFontMeasurement&&(!s||!s.width||!s.height))return this._lastFontMeasurement;if(this._lastFontMeasurement={fontFamily:t,fontSize:o,letterSpacing:n,lineHeight:r,charWidth:0,charHeight:0},s&&s.width&&s.height)if(this._lastFontMeasurement.charHeight=Math.ceil(s.height),this._terminalConfigurationService.config.gpuAcceleration==="off")this._lastFontMeasurement.charWidth=s.width;else{let u=(Math.floor(s.width*e.devicePixelRatio)+Math.round(n))/e.devicePixelRatio;this._lastFontMeasurement.charWidth=u-Math.round(n)/e.devicePixelRatio}return this._lastFontMeasurement}};function zVi(a,i,e,t){if(a==null)return t;let o=Fe(a)?parseInt(a,10):a;return isNaN(o)?t:Bn(o,i,e)}function q_o(){ve.appendMenuItems([{id:D.MenubarTerminalMenu,item:{group:"1_create",command:{id:"workbench.action.terminal.new",title:d(14844,null)},order:1}},{id:D.MenubarTerminalMenu,item:{group:"1_create",command:{id:"workbench.action.terminal.newInNewWindow",title:d(14843,null),precondition:C.has("terminalIsOpen")},order:2,when:dt.processSupported}},{id:D.MenubarTerminalMenu,item:{group:"1_create",command:{id:"workbench.action.terminal.split",title:d(14847,null),precondition:C.has("terminalIsOpen")},order:2,when:dt.processSupported}},{id:D.MenubarTerminalMenu,item:{group:"3_run",command:{id:"workbench.action.terminal.runActiveFile",title:d(14845,null)},order:3,when:dt.processSupported}},{id:D.MenubarTerminalMenu,item:{group:"3_run",command:{id:"workbench.action.terminal.runSelectedText",title:d(14846,null)},order:4,when:dt.processSupported}}]),ve.appendMenuItems([{id:D.TerminalInstanceContext,item:{command:{id:"workbench.action.terminal.killViewOrEditor",title:sr.kill.value},group:"7_kill"}},{id:D.TerminalInstanceContext,item:{command:{id:"workbench.action.terminal.copySelection",title:d(14855,null)},group:"3_edit",order:1}},{id:D.TerminalInstanceContext,item:{command:{id:"workbench.action.terminal.copySelectionAsHtml",title:d(14856,null)},group:"3_edit",order:2}},{id:D.TerminalInstanceContext,item:{command:{id:"workbench.action.terminal.paste",title:d(14860,null)},group:"3_edit",order:3}},{id:D.TerminalInstanceContext,item:{command:{id:"workbench.action.terminal.clear",title:d(14853,null)},group:"5_clear"}},{id:D.TerminalInstanceContext,item:{command:{id:"workbench.action.terminal.sizeToContentWidth",title:sr.toggleSizeToContentWidth},group:"9_config"}},{id:D.TerminalInstanceContext,item:{command:{id:"workbench.action.terminal.selectAll",title:d(14864,null)},group:"3_edit",order:3}}]),ve.appendMenuItem(D.EditorTabsBarContext,{command:{id:"workbench.action.createTerminalEditorSameGroup",title:sr.new},group:"1_zzz_file",order:30,when:dt.processSupported}),ve.appendMenuItem(D.EmptyEditorGroupContext,{command:{id:"workbench.action.createTerminalEditorSameGroup",title:sr.new},group:"1_zzz_file",order:30,when:dt.processSupported}),ve.appendMenuItems([{id:D.TerminalEditorInstanceContext,item:{group:"1_create",command:{id:"workbench.action.terminal.split",title:sr.split.value}}},{id:D.TerminalEditorInstanceContext,item:{command:{id:"workbench.action.terminal.new",title:sr.new},group:"1_create"}},{id:D.TerminalEditorInstanceContext,item:{command:{id:"workbench.action.terminal.killEditor",title:sr.kill.value},group:"7_kill"}},{id:D.TerminalEditorInstanceContext,item:{command:{id:"workbench.action.terminal.copySelection",title:d(14855,null)},group:"3_edit",order:1}},{id:D.TerminalEditorInstanceContext,item:{command:{id:"workbench.action.terminal.copySelectionAsHtml",title:d(14856,null)},group:"3_edit",order:2}},{id:D.TerminalEditorInstanceContext,item:{command:{id:"workbench.action.terminal.paste",title:d(14860,null)},group:"3_edit",order:3}},{id:D.TerminalEditorInstanceContext,item:{command:{id:"workbench.action.terminal.clear",title:d(14853,null)},group:"5_clear"}},{id:D.TerminalEditorInstanceContext,item:{command:{id:"workbench.action.terminal.selectAll",title:d(14864,null)},group:"3_edit",order:3}},{id:D.TerminalEditorInstanceContext,item:{command:{id:"workbench.action.terminal.sizeToContentWidth",title:sr.toggleSizeToContentWidth},group:"9_config"}}]),ve.appendMenuItems([{id:D.TerminalTabEmptyAreaContext,item:{command:{id:"workbench.action.terminal.newWithProfile",title:d(14858,null)},group:"1_create"}},{id:D.TerminalTabEmptyAreaContext,item:{command:{id:"workbench.action.terminal.new",title:sr.new},group:"1_create"}}]),ve.appendMenuItems([{id:D.TerminalNewDropdownContext,item:{command:{id:"workbench.action.terminal.selectDefaultShell",title:L(14865,"Select Default Profile")},group:"3_configure"}},{id:D.TerminalNewDropdownContext,item:{command:{id:"workbench.action.terminal.openSettings",title:d(14859,null)},group:"3_configure"}},{id:D.TerminalNewDropdownContext,item:{command:{id:"workbench.action.tasks.runTask",title:d(14850,null)},when:_h,group:"4_tasks",order:1}},{id:D.TerminalNewDropdownContext,item:{command:{id:"workbench.action.tasks.configureTaskRunner",title:d(14849,null)},when:_h,group:"4_tasks",order:2}}]),ve.appendMenuItems([{id:D.ViewTitle,item:{command:{id:"workbench.action.terminal.switchTerminal",title:L(14870,"Switch Terminal")},group:"navigation",order:0,when:C.and(C.equals("view",Sc),C.not("config.terminal.integrated.tabs.enabled"))}},{id:D.ViewTitle,item:{command:{id:"workbench.action.terminal.focus",title:sr.focus},alt:{id:"workbench.action.terminal.split",title:sr.split.value,icon:R.splitHorizontal},group:"navigation",order:0,when:C.and(C.not(Tue.ChatHasHiddenTerminals),C.equals("view",Sc),C.has("config.terminal.integrated.tabs.enabled"),C.or(C.and(C.equals("config.terminal.integrated.tabs.showActiveTerminal","singleTerminal"),C.equals("terminalGroupCount",1)),C.and(C.equals("config.terminal.integrated.tabs.showActiveTerminal","singleTerminalOrNarrow"),C.or(C.equals("terminalGroupCount",1),C.has("isTerminalTabsNarrow"))),C.and(C.equals("config.terminal.integrated.tabs.showActiveTerminal","singleGroup"),C.equals("terminalGroupCount",1)),C.equals("config.terminal.integrated.tabs.showActiveTerminal","always")))}},{id:D.ViewTitle,item:{command:{id:"workbench.action.terminal.split",title:sr.split,icon:R.splitHorizontal},group:"navigation",order:2,when:dt.shouldShowViewInlineActions}},{id:D.ViewTitle,item:{command:{id:"workbench.action.terminal.kill",title:sr.kill,icon:R.trash},group:"navigation",order:3,when:dt.shouldShowViewInlineActions}},{id:D.ViewTitle,item:{command:{id:"workbench.action.terminal.new",title:sr.new,icon:R.plus},alt:{id:"workbench.action.terminal.split",title:sr.split.value,icon:R.splitHorizontal},group:"navigation",order:0,when:C.and(C.equals("view",Sc),C.or(dt.webExtensionContributedProfile,dt.processSupported))}},{id:D.ViewTitle,item:{command:{id:"workbench.action.terminal.clear",title:d(14854,null),icon:R.clearAll},group:"navigation",order:6,when:C.equals("view",Sc),isHiddenByDefault:!0}},{id:D.ViewTitle,item:{command:{id:"workbench.action.terminal.runActiveFile",title:d(14862,null),icon:R.run},group:"navigation",order:7,when:C.equals("view",Sc),isHiddenByDefault:!0}},{id:D.ViewTitle,item:{command:{id:"workbench.action.terminal.runSelectedText",title:d(14863,null),icon:R.selection},group:"navigation",order:8,when:C.equals("view",Sc),isHiddenByDefault:!0}},{id:D.ViewTitle,item:{command:{id:"workbench.action.terminal.startVoice",title:d(14866,null)},group:"navigation",order:9,when:C.and(C.equals("view",Sc),dt.terminalDictationInProgress.toNegated()),isHiddenByDefault:!0}},{id:D.ViewTitle,item:{command:{id:"workbench.action.terminal.stopVoice",title:d(14868,null)},group:"navigation",order:9,when:C.and(C.equals("view",Sc),dt.terminalDictationInProgress),isHiddenByDefault:!0}}]),ve.appendMenuItems([{id:D.TerminalTabContext,item:{command:{id:"workbench.action.terminal.splitActiveTab",title:sr.split.value},group:"1_create",order:1}},{id:D.TerminalTabContext,item:{command:{id:"workbench.action.terminal.moveToEditor",title:sr.moveToEditor.value},group:"1_create",order:2}},{id:D.TerminalTabContext,item:{command:{id:"workbench.action.terminal.moveIntoNewWindow",title:sr.moveIntoNewWindow.value},group:"1_create",order:2}},{id:D.TerminalTabContext,item:{command:{id:"workbench.action.terminal.renameActiveTab",title:d(14861,null)},group:"3_edit"}},{id:D.TerminalTabContext,item:{command:{id:"workbench.action.terminal.changeIconActiveTab",title:d(14852,null)},group:"3_edit"}},{id:D.TerminalTabContext,item:{command:{id:"workbench.action.terminal.changeColorActiveTab",title:d(14851,null)},group:"3_edit"}},{id:D.TerminalTabContext,item:{command:{id:"workbench.action.terminal.sizeToContentWidth",title:sr.toggleSizeToContentWidth},group:"3_edit"}},{id:D.TerminalTabContext,item:{command:{id:"workbench.action.terminal.joinActiveTab",title:d(14857,null)},when:dt.tabsSingularSelection.toNegated(),group:"9_config"}},{id:D.TerminalTabContext,item:{command:{id:"workbench.action.terminal.unsplit",title:sr.unsplit.value},when:C.and(dt.tabsSingularSelection,dt.splitTerminalTabFocused),group:"9_config"}},{id:D.TerminalTabContext,item:{command:{id:"workbench.action.terminal.killActiveTab",title:sr.kill.value},group:"7_kill"}}]),ve.appendMenuItem(D.EditorTitleContext,{command:{id:"workbench.action.terminal.moveToTerminalPanel",title:sr.moveToTerminalPanel},when:Wo.Scheme.isEqualTo(Q.vscodeTerminal),group:"2_files"}),ve.appendMenuItem(D.EditorTitleContext,{command:{id:"workbench.action.terminal.rename",title:sr.rename},when:Wo.Scheme.isEqualTo(Q.vscodeTerminal),group:"2_files"}),ve.appendMenuItem(D.EditorTitleContext,{command:{id:"workbench.action.terminal.changeColor",title:sr.changeColor},when:Wo.Scheme.isEqualTo(Q.vscodeTerminal),group:"2_files"}),ve.appendMenuItem(D.EditorTitleContext,{command:{id:"workbench.action.terminal.changeIcon",title:sr.changeIcon},when:Wo.Scheme.isEqualTo(Q.vscodeTerminal),group:"2_files"}),ve.appendMenuItem(D.EditorTitleContext,{command:{id:"workbench.action.terminal.sizeToContentWidth",title:sr.toggleSizeToContentWidth},when:Wo.Scheme.isEqualTo(Q.vscodeTerminal),group:"2_files"});for(let a of[D.EditorTitle,D.CompactWindowEditorTitle])ve.appendMenuItem(a,{command:{id:"workbench.action.createTerminalEditorSameGroup",title:sr.new,icon:R.plus},alt:{id:"workbench.action.terminal.split",title:sr.split.value,icon:R.splitHorizontal},group:"navigation",order:0,when:Wo.Scheme.isEqualTo(Q.vscodeTerminal)}),ve.appendMenuItem(a,{command:{id:"workbench.action.terminal.clear",title:d(14854,null),icon:R.clearAll},group:"navigation",order:6,when:Wo.Scheme.isEqualTo(Q.vscodeTerminal),isHiddenByDefault:!0}),ve.appendMenuItem(a,{command:{id:"workbench.action.terminal.runActiveFile",title:d(14862,null),icon:R.run},group:"navigation",order:7,when:Wo.Scheme.isEqualTo(Q.vscodeTerminal),isHiddenByDefault:!0}),ve.appendMenuItem(a,{command:{id:"workbench.action.terminal.runSelectedText",title:d(14863,null),icon:R.selection},group:"navigation",order:8,when:Wo.Scheme.isEqualTo(Q.vscodeTerminal),isHiddenByDefault:!0}),ve.appendMenuItem(a,{command:{id:"workbench.action.terminal.startVoice",title:d(14867,null),icon:R.mic},group:"navigation",order:9,when:C.and(Wo.Scheme.isEqualTo(Q.vscodeTerminal),dt.terminalDictationInProgress.negate()),isHiddenByDefault:!0}),ve.appendMenuItem(a,{command:{id:"workbench.action.terminal.stopVoice",title:d(14869,null),icon:R.run},group:"navigation",order:10,when:C.and(Wo.Scheme.isEqualTo(Q.vscodeTerminal),zB,dt.terminalDictationInProgress),isHiddenByDefault:!0})}function h1e(a,i,e,t,o,n,r){i=i.filter(b=>!b.isAutoDetected);let[s,l]=Nhn(i),[c,u]=Ohn(t),p=[],h=[],g=a===2||typeof a=="object"&&No(a,{viewColumn:!0})&&a.viewColumn===jn?{viewColumn:In}:{splitActiveTerminal:!0};a===2&&(a={viewColumn:jn}),p.push(r.add(new it("workbench.action.terminal.new",sr.new,void 0,!0,()=>o.createAndFocusTerminal()))),p.push(r.add(new it("workbench.action.terminal.newInNewWindow",sr.newInNewWindow.value,void 0,!0,()=>o.createAndFocusTerminal({location:{viewColumn:Mg,auxiliary:{compact:!0}}})))),p.push(r.add(new it("workbench.action.terminal.split",sr.split.value,void 0,!0,()=>o.createAndFocusTerminal({location:g})))),p.push(new ri);for(let b of s)K_o(b,e,a,g,o,p,h,r);for(let b of c)G_o(b,e,a,g,o,p,h,r);(s.length>0||c.length>0)&&(l.length>0||u.length>0)&&p.push(new ri);for(let b of l)K_o(b,e,a,g,o,p,h,r);for(let b of u)G_o(b,e,a,g,o,p,h,r);p.length>0&&(p.push(new Fs("split.profile",d(14848,null),h)),p.push(new ri));let f=n.getActions();return p.push(...ri.join(...f.map(b=>b[1]))),{dropdownAction:r.add(new it("refresh profiles",d(14842,null),"codicon-chevron-down",!0)),dropdownMenuActions:p,className:`terminal-tab-actions-${o.resolveLocation(a)}`}}function Nhn(a){let i=[],e=[];for(let t of a)$_o(t.profileName)?i.push(t):e.push(t);return[i,e]}function Ohn(a){let i=[],e=[];for(let t of a)Fhn(t)?i.push(t):e.push(t);return[i,e]}function Fhn(a){let i=a.extensionIdentifier.toLowerCase();return i==="github.copilot-chat"||i==="anthropic.claude-code"?!0:$_o(a.title)}function $_o(a){let i=a.toLowerCase();return i.includes("copilot")||i.includes("claude")}function K_o(a,i,e,t,o,n,r,s){let l=a.profileName===i,c={config:a,location:e},u={config:a,location:t},p=a.profileName.replace(/[\n\r\t]/g,"");n.push(s.add(new it("workbench.action.terminal.newWithProfile",l?d(14841,null,p):p,void 0,!0,async()=>{await o.createAndFocusTerminal(c)}))),r.push(s.add(new it("workbench.action.terminal.split",l?d(14841,null,p):p,void 0,!0,async()=>{await o.createAndFocusTerminal(u)})))}function G_o(a,i,e,t,o,n,r,s){let c=a.title===i?d(14841,null,a.title.replace(/[\n\r\t]/g,"")):a.title.replace(/[\n\r\t]/g,"");n.push(s.add(new it("contributed",c,void 0,!0,()=>o.createAndFocusTerminal({config:{extensionIdentifier:a.extensionIdentifier,id:a.id,title:c},location:e})))),r.push(s.add(new it("contributed-split",c,void 0,!0,()=>o.createAndFocusTerminal({config:{extensionIdentifier:a.extensionIdentifier,id:a.id,title:c},location:t}))))}var g1e=class extends Ts{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super(JK,e,t,o,n);this._terminalEditorService=r;this._terminalProfileResolverService=s;this._terminalService=l;this._terminalConfigurationService=c;this._instantiationService=h;this._contextMenuService=g;this._terminalProfileService=f;this._workbenchLayoutService=v;this._editorInput=void 0;this._cancelContextMenu=!1;this._newDropdown=this._register(new me);this._sessionDisposables=this._register(new N);this._disposableStore=this._register(new N);this._dropdownMenu=this._register(p.createMenu(D.TerminalNewDropdownContext,u)),this._instanceMenu=this._register(p.createMenu(D.TerminalInstanceContext,u)),this._register(this._terminalProfileService.onDidChangeAvailableProfiles(b=>this._updateTabActionBar(b)))}async setInput(e,t,o,n){this._editorInput?.terminalInstance?.detachFromElement(),this._editorInput=e,await super.setInput(e,t,o,n),this._editorInput.terminalInstance?.attachToElement(this._overflowGuardElement),this._lastDimension&&this.layout(this._lastDimension),this._editorInput.terminalInstance?.setVisible(this.isVisible()&&this._workbenchLayoutService.isVisible("workbench.parts.editor",this.window)),this._editorInput.terminalInstance&&(this._sessionDisposables.add(this._editorInput.terminalInstance.onDidFocus(()=>this._setActiveInstance())),this._editorInput.setCopyLaunchConfig(this._editorInput.terminalInstance.shellLaunchConfig))}clearInput(){super.clearInput(),this._sessionDisposables.clear(),this._overflowGuardElement&&this._editorInput?.terminalInstance?.domElement.parentElement===this._overflowGuardElement&&this._editorInput.terminalInstance?.detachFromElement(),this._editorInput=void 0}_setActiveInstance(){this._editorInput?.terminalInstance&&this._terminalEditorService.setActiveInstance(this._editorInput.terminalInstance)}focus(){super.focus(),this._editorInput?.terminalInstance?.focus(!0)}createEditor(e){this._editorInstanceElement=e,this._overflowGuardElement=_(".terminal-overflow-guard.terminal-editor"),this._editorInstanceElement.appendChild(this._overflowGuardElement),this._registerListeners()}_registerListeners(){this._editorInstanceElement&&(this._register(j(this._editorInstanceElement,"mousedown",async e=>{let t=this._terminalEditorService.activeInstance;if(this._terminalEditorService.instances.length>0&&t){let o=await t.handleMouseEvent(e,this._instanceMenu);typeof o=="object"&&o.cancelContextMenu&&(this._cancelContextMenu=!0)}})),this._register(j(this._editorInstanceElement,"contextmenu",e=>{let t=this._terminalConfigurationService.config.rightClickBehavior;if(t==="nothing"&&!e.shiftKey){e.preventDefault(),e.stopImmediatePropagation(),this._cancelContextMenu=!1;return}else!this._cancelContextMenu&&t!=="copyPaste"&&t!=="paste"&&(this._cancelContextMenu||M6(this.window,e,this._editorInput?.terminalInstance,this._instanceMenu,this._contextMenuService),e.preventDefault(),e.stopImmediatePropagation(),this._cancelContextMenu=!1)})))}_updateTabActionBar(e){this._disposableStore.clear();let t=h1e(2,e,this._getDefaultProfileName(),this._terminalProfileService.contributedProfiles,this._terminalService,this._dropdownMenu,this._disposableStore);this._newDropdown.value?.update(t.dropdownAction,t.dropdownMenuActions)}layout(e){let t=this._editorInput?.terminalInstance;t&&(t.attachToElement(this._overflowGuardElement),t.layout(e)),this._lastDimension=e}setVisible(e){super.setVisible(e),this._editorInput?.terminalInstance?.setVisible(e&&this._workbenchLayoutService.isVisible("workbench.parts.editor",this.window))}getActionViewItem(e,t){switch(e.id){case"workbench.action.createTerminalEditorSameGroup":if(e instanceof Lo){let o={viewColumn:jn};this._disposableStore.clear();let n=h1e(o,this._terminalProfileService.availableProfiles,this._getDefaultProfileName(),this._terminalProfileService.contributedProfiles,this._terminalService,this._dropdownMenu,this._disposableStore);return this._newDropdown.value=this._instantiationService.createInstance(Jw,e,n.dropdownAction,n.dropdownMenuActions,n.className,{hoverDelegate:t.hoverDelegate}),this._newDropdown.value?.update(n.dropdownAction,n.dropdownMenuActions),this._newDropdown.value}}return super.getActionViewItem(e,t)}_getDefaultProfileName(){let e;try{e=this._terminalProfileService.getDefaultProfileName()}catch{e=this._terminalProfileResolverService.defaultProfileName}return e}};g1e=I([m(1,Te),m(2,Le),m(3,ce),m(4,Fv),m(5,Ag),m(6,nn),m(7,Uu),m(8,X),m(9,Kt),m(10,F),m(11,Xe),m(12,vy),m(13,yi)],g1e);var f1e=class{constructor(i){this._terminalEditorService=i}canSerialize(i){return Yo(i.terminalInstance?.persistentProcessId)&&i.terminalInstance.shouldPersist}serialize(i){if(this.canSerialize(i))return JSON.stringify(this._toJson(i.terminalInstance))}deserialize(i,e){let t=JSON.parse(e);if(!Whn(t))throw new Error(`Could not revive terminal editor input, ${t}`);return this._terminalEditorService.reviveInput(t)}_toJson(i){return{id:i.persistentProcessId,pid:i.processId||0,title:i.title,titleSource:i.titleSource,cwd:"",icon:i.icon,color:i.color,hasChildProcesses:i.hasChildProcesses,isFeatureTerminal:i.shellLaunchConfig.isFeatureTerminal,hideFromUser:i.shellLaunchConfig.hideFromUser,reconnectionProperties:i.shellLaunchConfig.reconnectionProperties,shellIntegrationNonce:i.shellIntegrationNonce}}};f1e=I([m(0,Fv)],f1e);function Whn(a){return xi(a)&&"id"in a&&"pid"in a}var v1e=class extends x{constructor(e,t,o,n,r,s){super();this._editorService=e;this._editorGroupsService=t;this._terminalInstanceService=o;this._instantiationService=n;this.instances=[];this._activeInstanceIndex=-1;this._isShuttingDown=!1;this._editorInputs=new Map;this._instanceDisposables=new Map;this._onDidDisposeInstance=this._register(new E);this.onDidDisposeInstance=this._onDidDisposeInstance.event;this._onDidFocusInstance=this._register(new E);this.onDidFocusInstance=this._onDidFocusInstance.event;this._onDidChangeInstanceCapability=this._register(new E);this.onDidChangeInstanceCapability=this._onDidChangeInstanceCapability.event;this._onDidChangeActiveInstance=this._register(new E);this.onDidChangeActiveInstance=this._onDidChangeActiveInstance.event;this._onDidChangeInstances=this._register(new E);this.onDidChangeInstances=this._onDidChangeInstances.event;this._terminalEditorActive=dt.terminalEditorActive.bindTo(s),this._register(Z(()=>{for(let l of this._instanceDisposables.values())Be(l)})),this._register(r.onWillShutdown(()=>this._isShuttingDown=!0)),this._register(this._editorService.onDidActiveEditorChange(()=>{let l=this._editorService.activeEditor,c=l instanceof xf?l?.terminalInstance:void 0,u=!!c&&l instanceof xf;if(this._terminalEditorActive.set(u),u)l?.setGroup(this._editorService.activeEditorPane?.group),this.setActiveInstance(c);else for(let p of this.instances)p.resetFocusContextKey()})),this._register(this._editorService.onDidVisibleEditorsChange(()=>{let l=this.instances.map(p=>p.instanceId),u=this._getActiveTerminalEditors().find(p=>{let h=p instanceof xf?p.terminalInstance?.instanceId:void 0;return h===void 0?!1:!l.includes(h)});u instanceof xf&&u.terminalInstance&&(this._editorInputs.set(u.terminalInstance.resource.path,u),this.instances.push(u.terminalInstance))})),this._register(this._editorService.onDidCloseEditor(l=>{let c=l.editor instanceof xf?l.editor.terminalInstance:void 0;if(c){let u=this.instances.findIndex(p=>p===c);if(u!==-1){let p=this.instances[u]===this.activeInstance;this._removeInstance(c),p&&this.setActiveInstance(void 0)}}}))}_getActiveTerminalEditors(){return this._editorService.visibleEditors.filter(e=>e instanceof xf&&e.terminalInstance?.instanceId)}get activeInstance(){if(!(this.instances.length===0||this._activeInstanceIndex===-1))return this.instances[this._activeInstanceIndex]}setActiveInstance(e){this._activeInstanceIndex=e?this.instances.findIndex(t=>t===e):-1,this._onDidChangeActiveInstance.fire(this.activeInstance)}async focusInstance(e){this.instances.includes(e)&&(this.setActiveInstance(e),await this._revealEditor(e),await e.focusWhenReady(!0))}async focusActiveInstance(){return this.activeInstance?.focusWhenReady(!0)}async openEditor(e,t){let o=this.resolveResource(e);o&&(await this._activeOpenEditorRequest?.promise,this._activeOpenEditorRequest={instanceId:e.instanceId,promise:this._editorService.openEditor({resource:o,description:e.description||e.shellLaunchConfig.type,options:{pinned:!0,forceReload:!0,preserveFocus:t?.preserveFocus,auxiliary:t?.auxiliary}},t?.viewColumn??jn)},await this._activeOpenEditorRequest?.promise,this._activeOpenEditorRequest=void 0)}resolveResource(e){let t=e.resource,o=t.path,n=this._editorInputs.get(o);if(n)return n.resource;e.target=2;let r=this._instantiationService.createInstance(xf,t,e);return this._registerInstance(o,r,e),r.resource}getInputFromResource(e){let t=this._editorInputs.get(e.path);if(!t)throw new Error(`Could not get input from resource: ${e.path}`);return t}_registerInstance(e,t,o){this._editorInputs.set(e,t),this._instanceDisposables.set(e,[o.onDidFocus(this._onDidFocusInstance.fire,this._onDidFocusInstance),o.onDisposed(this._onDidDisposeInstance.fire,this._onDidDisposeInstance),o.capabilities.onDidChangeCapabilities(()=>this._onDidChangeInstanceCapability.fire(o))]),this.instances.push(o),this._onDidChangeInstances.fire()}_removeInstance(e){let t=e.resource.path;this._editorInputs.delete(t);let o=this.instances.findIndex(r=>r===e);o!==-1&&this.instances.splice(o,1);let n=this._instanceDisposables.get(t);this._instanceDisposables.delete(t),n&&Be(n),this._onDidChangeInstances.fire()}getInstanceFromResource(e){return dHe(this.instances,e)}splitInstance(e,t={}){if(e.target===2){let r=this._editorInputs.get(e.resource.path)?.group;r&&this._editorGroupsService.activateGroup(r)}let o=this._terminalInstanceService.createInstance(t,2),n=this.resolveResource(o);return n&&this._editorService.openEditor({resource:A.revive(n),description:o.description,options:{pinned:!0,forceReload:!0}},In),o}reviveInput(e){let t={...e,findRevivedId:!0},o=this._terminalInstanceService.createInstance({attachPersistentProcess:t},2),n=this._instantiationService.createInstance(xf,o.resource,o);return this._registerInstance(o.resource.path,n,o),n}detachInstance(e){let t=e.resource.path,o=this._editorInputs.get(t);o?.detachInstance(),this._removeInstance(e),this._isShuttingDown||o?.dispose()}async revealActiveEditor(e){let t=this.activeInstance;t&&await this._revealEditor(t,e)}async _revealEditor(e,t){if(this._activeOpenEditorRequest?.instanceId===e.instanceId){await this._activeOpenEditorRequest.promise;return}let o=this._editorInputs.get(e.resource.path);o&&await this._editorService.openEditor(o,{pinned:!0,forceReload:!0,preserveFocus:t,activation:3})}};v1e=I([m(0,ee),m(1,wt),m(2,Nm),m(3,F),m(4,ji),m(5,X)],v1e);var KVi=class extends x{constructor(e,t){super();this._container=e;this.orientation=t;this._splitViewDisposables=this._register(new N);this._children=[];this._terminalToPane=new Map;this._onDidChange=U.None;this._width=this._container.offsetWidth,this._height=this._container.offsetHeight,this._createSplitView(),this._splitView.layout(this.orientation===1?this._width:this._height)}get onDidChange(){return this._onDidChange}_createSplitView(){this._splitViewDisposables.clear(),this._splitView=new Ou(this._container,{orientation:this.orientation}),this._splitViewDisposables.add(this._splitView),this._splitViewDisposables.add(this._splitView.onDidSashReset(()=>this._splitView.distributeViewSizes()))}split(e,t){this._addChild(e,t)}resizePane(e,t,o){if(this._children.length<=1)return;let n=[];for(let l=0;l<this._splitView.length;l++)n.push(this._splitView.getViewSize(l));let r=e!==this._children.length-1,s=r?e+1:e-1;(r&&t===0||!r&&t===1||r&&t===2||!r&&t===3)&&(o*=-1),n[e]+o<80?o=80-n[e]:n[s]-o<80&&(o=n[s]-80),n[e]+=o,n[s]-=o;for(let l=0;l<this._splitView.length-1;l++)this._splitView.resizeView(l,n[l])}resizePanes(e){if(this._children.length<=1)return;e[e.length-1]+=1-e.reduce((o,n)=>o+n,0);let t=0;for(let o=0;o<this._splitView.length;o++)t+=this._splitView.getViewSize(o);for(let o=0;o<this._splitView.length;o++)this._splitView.resizeView(o,t*e[o])}getPaneSize(e){let t=this._terminalToPane.get(e);if(!t)return 0;let o=this._children.indexOf(t);return this._splitView.getViewSize(o)}_addChild(e,t){let o=new GVi(e,this.orientation===1?this._height:this._width);o.orientation=this.orientation,Yo(t)?this._children.splice(t,0,o):this._children.push(o),this._terminalToPane.set(e,this._children[this._children.indexOf(o)]),this._withDisabledLayout(()=>this._splitView.addView(o,Gl.Distribute,t)),this.layout(this._width,this._height),this._onDidChange=U.any(...this._children.map(n=>n.onDidChange))}remove(e){let t=null;for(let o=0;o<this._children.length;o++)this._children[o].instance===e&&(t=o);t!==null&&(this._children.splice(t,1),this._terminalToPane.delete(e),this._splitView.removeView(t,Gl.Distribute),e.detachFromElement())}layout(e,t){this._width=e,this._height=t,this.orientation===1?(this._children.forEach(o=>o.orthogonalLayout(t)),this._splitView.layout(e)):(this._children.forEach(o=>o.orthogonalLayout(e)),this._splitView.layout(t))}setOrientation(e){if(this.orientation!==e){for(this.orientation=e;this._container.children.length>0;)this._container.children[0].remove();this._createSplitView(),this._withDisabledLayout(()=>{this._children.forEach(t=>{t.orientation=e,this._splitView.addView(t,1)})})}}_withDisabledLayout(e){this._children.forEach(t=>t.instance.disableLayout=!0),e(),this._children.forEach(t=>t.instance.disableLayout=!1)}},GVi=class{constructor(i,e){this.instance=i;this.orthogonalSize=e;this.minimumSize=80;this.maximumSize=Number.MAX_VALUE;this._onDidChange=U.None;this.element=document.createElement("div"),this.element.className="terminal-split-pane",this.instance.attachToElement(this.element)}get onDidChange(){return this._onDidChange}layout(i){!i||!this.orthogonalSize||(this.orientation===0?this.instance.layout({width:this.orthogonalSize,height:i}):this.instance.layout({width:i,height:this.orthogonalSize}))}orthogonalLayout(i){this.orthogonalSize=i}},b1e=class extends x{constructor(e,t,o,n,r,s,l,c){super();this._container=e;this._terminalConfigurationService=o;this._terminalInstanceService=n;this._paneCompositePartService=r;this._layoutService=s;this._viewDescriptorService=l;this._instantiationService=c;this._terminalInstances=[];this._panelPosition=2;this._terminalLocation=1;this._instanceDisposables=new Map;this._activeInstanceIndex=-1;this._hadFocusOnExit=!1;this._visible=!1;this._onDidDisposeInstance=this._register(new E);this.onDidDisposeInstance=this._onDidDisposeInstance.event;this._onDidFocusInstance=this._register(new E);this.onDidFocusInstance=this._onDidFocusInstance.event;this._onDidChangeInstanceCapability=this._register(new E);this.onDidChangeInstanceCapability=this._onDidChangeInstanceCapability.event;this._onDisposed=this._register(new E);this.onDisposed=this._onDisposed.event;this._onInstancesChanged=this._register(new E);this.onInstancesChanged=this._onInstancesChanged.event;this._onDidChangeActiveInstance=this._register(new E);this.onDidChangeActiveInstance=this._onDidChangeActiveInstance.event;this._onPanelOrientationChanged=this._register(new E);this.onPanelOrientationChanged=this._onPanelOrientationChanged.event;t&&this.addInstance(t),this._container&&this.attachToElement(this._container),this._onPanelOrientationChanged.fire(this._terminalLocation===1&&xh(this._panelPosition)?1:0),this._register(Z(()=>{this._container&&this._groupElement&&(this._groupElement.remove(),this._groupElement=void 0)}))}get terminalInstances(){return this._terminalInstances}get hadFocusOnExit(){return this._hadFocusOnExit}addInstance(e,t){let o,n=t?this._terminalInstances.findIndex(r=>r.instanceId===t):this._activeInstanceIndex;No(e,{instanceId:!0})?o=e:o=this._terminalInstanceService.createInstance(e,1),this._terminalInstances.length===0?(this._terminalInstances.push(o),this._activeInstanceIndex=0):this._terminalInstances.splice(n+1,0,o),this._initInstanceListeners(o),this._splitPaneContainer&&this._splitPaneContainer.split(o,n+1),this._onInstancesChanged.fire()}dispose(){this._terminalInstances=[],this._onInstancesChanged.fire(),this._splitPaneContainer?.dispose(),super.dispose()}get activeInstance(){if(this._terminalInstances.length!==0)return this._terminalInstances[this._activeInstanceIndex]}getLayoutInfo(e){let t=this.terminalInstances.filter(n=>Yo(n.persistentProcessId)&&n.shouldPersist),o=t.map(n=>this._splitPaneContainer?.getPaneSize(n)||0).reduce((n,r)=>n+=r,0);return{isActive:e,activePersistentProcessId:this.activeInstance?this.activeInstance.persistentProcessId:void 0,terminals:t.map(n=>({relativeSize:o>0?this._splitPaneContainer.getPaneSize(n)/o:0,terminal:n.persistentProcessId||0}))}}_initInstanceListeners(e){this._instanceDisposables.set(e.instanceId,[e.onDisposed(t=>{this._onDidDisposeInstance.fire(t),this._handleOnDidDisposeInstance(t)}),e.onDidFocus(t=>{this._setActiveInstance(t),this._onDidFocusInstance.fire(t)}),e.capabilities.onDidChangeCapabilities(()=>this._onDidChangeInstanceCapability.fire(e))])}_handleOnDidDisposeInstance(e){this._removeInstance(e)}removeInstance(e){this._removeInstance(e)}_removeInstance(e){let t=this._terminalInstances.indexOf(e);if(t===-1)return;let o=e===this.activeInstance;if(this._terminalInstances.splice(t,1),o&&this._terminalInstances.length>0){let r=t<this._terminalInstances.length?t:this._terminalInstances.length-1;this.setActiveInstanceByIndex(r),this.activeInstance?.focus(!0)}else t<this._activeInstanceIndex&&this._activeInstanceIndex--;this._splitPaneContainer?.remove(e),this._terminalInstances.length===0?(this._hadFocusOnExit=e.hadFocusOnExit,this._onDisposed.fire(this),this.dispose()):this._onInstancesChanged.fire();let n=this._instanceDisposables.get(e.instanceId);n&&(Be(n),this._instanceDisposables.delete(e.instanceId))}moveInstance(e,t,o){if(e=cc(e),e.some(s=>!this.terminalInstances.includes(s)))return;let r=o==="before"?t:t+1;this._terminalInstances.splice(r,0,...e);for(let s of e){let l=o==="after"?this._terminalInstances.indexOf(s):this._terminalInstances.lastIndexOf(s);this._terminalInstances.splice(l,1)}if(this._splitPaneContainer)for(let s=0;s<e.length;s++){let l=e[s];this._splitPaneContainer.remove(l),this._splitPaneContainer.split(l,t+(o==="before"?s:0))}this._onInstancesChanged.fire()}_setActiveInstance(e){this.setActiveInstanceByIndex(this._getIndexFromId(e.instanceId))}_getIndexFromId(e){let t=-1;if(this.terminalInstances.forEach((o,n)=>{o.instanceId===e&&(t=n)}),t===-1)throw new Error(`Terminal with ID ${e} does not exist (has it already been disposed?)`);return t}setActiveInstanceByIndex(e,t){if(e<0||e>=this._terminalInstances.length)return;let o=this.activeInstance;this._activeInstanceIndex=e,(o!==this.activeInstance||t)&&(this._onInstancesChanged.fire(),this._onDidChangeActiveInstance.fire(this.activeInstance))}attachToElement(e){if(this._container=e,this._groupElement||(this._groupElement=document.createElement("div"),this._groupElement.classList.add("terminal-group")),this._container.appendChild(this._groupElement),!this._splitPaneContainer){this._panelPosition=this._layoutService.getPanelPosition(),this._terminalLocation=this._viewDescriptorService.getViewLocationById(Sc);let t=this._terminalLocation===1&&xh(this._panelPosition)?1:0;this._splitPaneContainer=this._instantiationService.createInstance(KVi,this._groupElement,t),this.terminalInstances.forEach(o=>this._splitPaneContainer.split(o,this._activeInstanceIndex+1))}}get title(){if(this._terminalInstances.length===0)return"";let e=this.terminalInstances[0].title+this._getBellTitle(this.terminalInstances[0]);this.terminalInstances[0].description&&(e+=` (${this.terminalInstances[0].description})`);for(let t=1;t<this.terminalInstances.length;t++){let o=this.terminalInstances[t];o.title&&(e+=`, ${o.title+this._getBellTitle(o)}`,o.description&&(e+=` (${o.description})`))}return e}_getBellTitle(e){return this._terminalConfigurationService.config.enableBell&&e.statusList.statuses.some(t=>t.id==="bell")?"*":""}setVisible(e){this._visible=e,this._groupElement&&(this._groupElement.style.display=e?"":"none"),this.terminalInstances.forEach(t=>t.setVisible(e))}split(e){let t=this._terminalInstanceService.createInstance(e,1);return this.addInstance(t,e.parentTerminalId),this._setActiveInstance(t),t}addDisposable(e){this._register(e)}layout(e,t){if(this._splitPaneContainer){let o=this._layoutService.getPanelPosition(),n=this._viewDescriptorService.getViewLocationById(Sc);if(o!==this._panelPosition||n!==this._terminalLocation){let s=n===1&&xh(o)?1:0;this._splitPaneContainer.setOrientation(s),this._panelPosition=o,this._terminalLocation=n,this._onPanelOrientationChanged.fire(this._splitPaneContainer.orientation)}this._splitPaneContainer.layout(e,t),this._initialRelativeSizes&&this._visible&&(this.resizePanes(this._initialRelativeSizes),this._initialRelativeSizes=void 0)}}focusPreviousPane(){let e=this._activeInstanceIndex===0?this._terminalInstances.length-1:this._activeInstanceIndex-1;this.setActiveInstanceByIndex(e)}focusNextPane(){let e=this._activeInstanceIndex===this._terminalInstances.length-1?0:this._activeInstanceIndex+1;this.setActiveInstanceByIndex(e)}_getPosition(){switch(this._terminalLocation){case 1:return this._panelPosition;case 0:return this._layoutService.getSideBarPosition();case 2:return this._layoutService.getSideBarPosition()===0?1:0;default:return this._panelPosition}}_getOrientation(){return xh(this._getPosition())?1:0}resizePane(e){if(!this._splitPaneContainer)return;let t=e===0||e===1,o=this._getOrientation(),n=t&&o===0||!t&&o===1,r=this._terminalConfigurationService.getFont(Re(this._groupElement)),s=t?r.charWidth:r.charHeight;if(s){let l=s*4;if(n){let c=this._getPosition();(c===0&&e===0||c===1&&e===1||c===2&&e===3||c===3&&e===2)&&(l*=-1),this._layoutService.resizePart(this._paneCompositePartService.getPartId(this._terminalLocation),l,l)}else this._splitPaneContainer.resizePane(this._activeInstanceIndex,e,l)}}resizePanes(e){if(!this._splitPaneContainer){this._initialRelativeSizes=e;return}this._splitPaneContainer.resizePanes(e)}};b1e=I([m(2,Uu),m(3,Nm),m(4,us),m(5,yi),m(6,Bi),m(7,F)],b1e);var S1e=class extends x{constructor(e,t,o,n,r){super();this._contextKeyService=e;this._instantiationService=t;this._viewsService=o;this._viewDescriptorService=n;this._quickInputService=r;this.groups=[];this.activeGroupIndex=-1;this.lastAccessedMenu="inline-tab";this._isQuickInputOpened=!1;this._onDidChangeActiveGroup=this._register(new E);this.onDidChangeActiveGroup=this._onDidChangeActiveGroup.event;this._onDidDisposeGroup=this._register(new E);this.onDidDisposeGroup=this._onDidDisposeGroup.event;this._onDidChangeGroups=this._register(new E);this.onDidChangeGroups=this._onDidChangeGroups.event;this._onDidShow=this._register(new E);this.onDidShow=this._onDidShow.event;this._onDidDisposeInstance=this._register(new E);this.onDidDisposeInstance=this._onDidDisposeInstance.event;this._onDidFocusInstance=this._register(new E);this.onDidFocusInstance=this._onDidFocusInstance.event;this._onDidChangeActiveInstance=this._register(new E);this.onDidChangeActiveInstance=this._onDidChangeActiveInstance.event;this._onDidChangeInstances=this._register(new E);this.onDidChangeInstances=this._onDidChangeInstances.event;this._onDidChangeInstanceCapability=this._register(new E);this.onDidChangeInstanceCapability=this._onDidChangeInstanceCapability.event;this._onDidChangePanelOrientation=this._register(new E);this.onDidChangePanelOrientation=this._onDidChangePanelOrientation.event;this._getValidTerminalGroups=e=>new Set(e.map(t=>this.getGroupForInstance(t)).filter(t=>t!==void 0));let s=dt.groupCount.bindTo(this._contextKeyService);this._register(U.runAndSubscribe(this.onDidChangeGroups,()=>s.set(this.groups.length)));let l=dt.splitTerminalActive.bindTo(this._contextKeyService);this._register(U.runAndSubscribe(this.onDidFocusInstance,()=>{let c=this.activeInstance;l.set(c?this.instanceIsSplit(c):!1)})),this._register(this.onDidDisposeGroup(c=>this._removeGroup(c))),this._register(U.any(this.onDidChangeActiveGroup,this.onDidChangeInstances)(()=>this.updateVisibility())),this._register(this._quickInputService.onShow(()=>this._isQuickInputOpened=!0)),this._register(this._quickInputService.onHide(()=>this._isQuickInputOpened=!1))}get instances(){return this.groups.reduce((e,t)=>e.concat(t.terminalInstances),[])}hidePanel(){let e=this._viewDescriptorService.getViewContainerByViewId(Sc);e&&this._viewDescriptorService.getViewContainerModel(e).visibleViewDescriptors.length===1&&(this._viewsService.closeView(Sc),dt.tabsMouse.bindTo(this._contextKeyService).set(!1))}get activeGroup(){if(!(this.activeGroupIndex<0||this.activeGroupIndex>=this.groups.length))return this.groups[this.activeGroupIndex]}set activeGroup(e){if(e===void 0)return;let t=this.groups.findIndex(o=>o===e);this.setActiveGroupByIndex(t)}get activeInstance(){return this.activeGroup?.activeInstance}setActiveInstance(e){this.setActiveInstanceByIndex(this._getIndexFromId(e.instanceId))}_getIndexFromId(e){let t=this.instances.findIndex(o=>o.instanceId===e);if(t===-1)throw new Error(`Terminal with ID ${e} does not exist (has it already been disposed?)`);return t}setContainer(e){this._container=e,this.groups.forEach(t=>t.attachToElement(e))}async focusTabs(){if(this.instances.length===0)return;await this.showPanel(!0),this._viewsService.getActiveViewWithId(Sc)?.terminalTabbedView?.focusTabs()}async focusHover(){if(this.instances.length===0)return;this._viewsService.getActiveViewWithId(Sc)?.terminalTabbedView?.focusHover()}async focusInstance(e){this.instances.includes(e)&&this.setActiveInstance(e),await this.showPanel(!0)}async focusActiveInstance(){return this.showPanel(!0)}createGroup(e){let t=this._instantiationService.createInstance(b1e,this._container,e);return this.groups.push(t),t.addDisposable(U.forward(t.onPanelOrientationChanged,this._onDidChangePanelOrientation)),t.addDisposable(U.forward(t.onDidDisposeInstance,this._onDidDisposeInstance)),t.addDisposable(U.forward(t.onDidFocusInstance,this._onDidFocusInstance)),t.addDisposable(U.forward(t.onDidChangeInstanceCapability,this._onDidChangeInstanceCapability)),t.addDisposable(U.forward(t.onInstancesChanged,this._onDidChangeInstances)),t.addDisposable(U.forward(t.onDisposed,this._onDidDisposeGroup)),t.addDisposable(t.onDidChangeActiveInstance(o=>{t===this.activeGroup&&this._onDidChangeActiveInstance.fire(o)})),t.terminalInstances.length>0&&this._onDidChangeInstances.fire(),this.instances.length===1&&this.setActiveInstanceByIndex(0),this._onDidChangeGroups.fire(),t}async showPanel(e){let t=this._viewsService.getActiveViewWithId(Sc)??await this._viewsService.openView(Sc,e);if(t?.setExpanded(!0),e){await Li(0);let o=this.activeInstance;o&&(t&&!t.isVisible()&&await this._viewsService.openView(Sc,e),await o.focusWhenReady(!0))}this._onDidShow.fire()}getInstanceFromResource(e){return dHe(this.instances,e)}_removeGroup(e){let t=this.activeGroup,o=e===t,n=this.groups.indexOf(e);if(n!==-1&&(this.groups.splice(n,1),this._onDidChangeGroups.fire()),o){if(this.groups.length>0&&!this._isQuickInputOpened){let r=n<this.groups.length?n:this.groups.length-1;this.setActiveGroupByIndex(r,!0),e.hadFocusOnExit&&this.activeInstance?.focus(!0)}}else this.activeGroupIndex>n&&this.setActiveGroupByIndex(this.activeGroupIndex-1);this.activeGroupIndex>=this.groups.length&&this.setActiveGroupByIndex(this.groups.length-1),this._onDidChangeInstances.fire(),this._onDidChangeGroups.fire(),o&&(this._onDidChangeActiveGroup.fire(this.activeGroup),this._onDidChangeActiveInstance.fire(this.activeInstance))}setActiveGroupByIndex(e,t){if(e===-1&&this.groups.length===0){this.activeGroupIndex!==-1&&(this.activeGroupIndex=-1,this._onDidChangeActiveGroup.fire(this.activeGroup),this._onDidChangeActiveInstance.fire(this.activeInstance));return}if(e<0||e>=this.groups.length)return;let o=this.activeGroup;this.activeGroupIndex=e,(t||o!==this.activeGroup)&&(this._onDidChangeActiveGroup.fire(this.activeGroup),this._onDidChangeActiveInstance.fire(this.activeInstance))}_getInstanceLocation(e){let t=0;for(;e>=0&&t<this.groups.length;){let o=this.groups[t],n=o.terminalInstances.length;if(e<n)return{group:o,groupIndex:t,instance:o.terminalInstances[e],instanceIndex:e};e-=n,t++}}setActiveInstanceByIndex(e){let t=this.activeInstance,o=this._getInstanceLocation(e),n=o?.group.terminalInstances[o.instanceIndex];if(!o||t===n)return;let r=o.instanceIndex;this.activeGroupIndex=o.groupIndex,this._onDidChangeActiveGroup.fire(this.activeGroup),o.group.setActiveInstanceByIndex(r,!0)}setActiveGroupToNext(){if(this.groups.length<=1)return;let e=this.activeGroupIndex+1;e>=this.groups.length&&(e=0),this.setActiveGroupByIndex(e)}setActiveGroupToPrevious(){if(this.groups.length<=1)return;let e=this.activeGroupIndex-1;e<0&&(e=this.groups.length-1),this.setActiveGroupByIndex(e)}moveGroup(e,t){e=cc(e);let o=this._getValidTerminalGroups(e),n=this.getGroupForInstance(t);if(!n||o.size===0)return;if(o.size===1&&o.has(n)){let p=n.terminalInstances.indexOf(t),h=e.sort((v,b)=>n.terminalInstances.indexOf(v)-n.terminalInstances.indexOf(b)),f=n.terminalInstances.indexOf(h[0])<p?"after":"before";n.moveInstance(h,p,f),this._onDidChangeInstances.fire();return}let r=this.groups.indexOf(n),s=Array.from(o).sort((p,h)=>this.groups.indexOf(p)-this.groups.indexOf(h)),c=this.groups.indexOf(s[0])<r?"after":"before",u=c==="after"?r+1:r;this.groups.splice(u,0,...s);for(let p of s){let h=c==="after"?this.groups.indexOf(p):this.groups.lastIndexOf(p);this.groups.splice(h,1)}this._onDidChangeInstances.fire()}moveGroupToEnd(e){e=cc(e);let t=this._getValidTerminalGroups(e);if(t.size===0)return;let o=this.groups.length-1,n=Array.from(t).sort((r,s)=>this.groups.indexOf(r)-this.groups.indexOf(s));this.groups.splice(o+1,0,...n);for(let r of n){let s=this.groups.indexOf(r);this.groups.splice(s,1)}this._onDidChangeInstances.fire()}moveInstance(e,t,o){let n=this.getGroupForInstance(e),r=this.getGroupForInstance(t);if(!n||!r)return;n!==r&&(n.removeInstance(e),r.addInstance(e));let s=r.terminalInstances.indexOf(t)+(o==="after"?1:0);r.moveInstance(e,s,o)}unsplitInstance(e){let t=this.getGroupForInstance(e);!t||t.terminalInstances.length<2||(t.removeInstance(e),this.createGroup(e))}joinInstances(e){let t=this.getGroupForInstance(e[0]);if(t){let s=!0;for(let l=1;l<t.terminalInstances.length;l++)if(t.terminalInstances.includes(e[l])){s=!1;break}if(!s&&t.terminalInstances.length===e.length)return}let o,n;for(let s of e){let l=this.getGroupForInstance(s);if(l?.terminalInstances.length===1){o=s,n=l;break}}n||(n=this.createGroup());let r=this.activeGroup===n;for(let s of e){if(s===o)continue;let l=this.getGroupForInstance(s);l&&(l.removeInstance(s),n.addInstance(s))}this.setActiveInstance(e[0]),this._onDidChangeInstances.fire(),r||this._onDidChangeActiveGroup.fire(this.activeGroup)}instanceIsSplit(e){let t=this.getGroupForInstance(e);return t?t.terminalInstances.length>1:!1}getGroupForInstance(e){return this.groups.find(t=>t.terminalInstances.includes(e))}getGroupLabels(){return this.groups.filter(e=>e.terminalInstances.length>0).map((e,t)=>`${t+1}: ${e.title?e.title:""}`)}updateVisibility(){let e=this._viewsService.isViewVisible(Sc);this.groups.forEach((t,o)=>t.setVisible(e&&o===this.activeGroupIndex))}};S1e=I([m(0,X),m(1,F),m(2,$t),m(3,Bi),m(4,Ue)],S1e);var Z3t=class{constructor(i){this._process=i;this.type=1;this._cwd="";this._onDidChangeCwd=new E;this.onDidChangeCwd=this._onDidChangeCwd.event}async getCwd(){if(!this._process)return Promise.resolve("");let i=await this._process.getCwd();return i!==this._cwd&&this._onDidChangeCwd.fire(i),this._cwd=i,this._cwd}};var e8t=class{constructor(i,e){this._totalDataLength=0;this._entries=[{cols:i,rows:e,data:[]}]}handleResize(i,e){if(this._entries.length>0&&this._entries[this._entries.length-1].data.length===0&&this._entries.pop(),this._entries.length>0){let t=this._entries[this._entries.length-1];if(t.cols===i&&t.rows===e)return;if(t.cols===0&&t.rows===0){t.cols=i,t.rows=e;return}}this._entries.push({cols:i,rows:e,data:[]})}handleData(i){for(this._entries[this._entries.length-1].data.push(i),this._totalDataLength+=i.length;this._totalDataLength>10485760;){let t=this._entries[0],o=this._totalDataLength-10485760;o>=t.data[0].length?(this._totalDataLength-=t.data[0].length,t.data.shift(),t.data.length===0&&this._entries.shift()):(t.data[0]=t.data[0].substr(o),this._totalDataLength-=o)}}generateReplayEventSync(){return this._entries.forEach(i=>{i.data.length>0&&(i.data=[i.data.join("")])}),{events:this._entries.map(i=>({cols:i.cols,rows:i.rows,data:i.data[0]??""})),commands:{isWindowsPty:!1,hasRichCommandDetection:!1,commands:[],promptInputModel:void 0}}}async generateReplayEvent(){return this.generateReplayEventSync()}};var nbe=class{constructor(i,e,t,o,n){this._diff=i;this._terminalId=e;this._collection=t;this._terminalService=o;this._extensionService=n;this.requiresAction=!0}_getInfo(i){let e=new Set;t8t(e,this._diff.added.values()),t8t(e,this._diff.removed.values()),t8t(e,this._diff.changed.values());let t=d(14730,null);return t+=Q_o(this._collection,i,this._extensionService,e),t}_getActions(){return[{label:d(14731,null),run:()=>this._terminalService.getInstanceFromId(this._terminalId)?.relaunch(),commandId:"workbench.action.terminal.relaunch"}]}getStatus(i){return{id:"relaunch-needed",severity:bt.Warning,icon:R.warning,tooltip:this._getInfo(i),hoverActions:this._getActions()}}};nbe=I([m(3,nn),m(4,lt)],nbe);var are=class{constructor(i,e,t){this._collection=i;this._commandService=e;this._extensionService=t;this.requiresAction=!1}_getInfo(i){let e=new Set;t8t(e,this._collection.getVariableMap(i).values());let t=d(14729,null);return t+=Q_o(this._collection,i,this._extensionService,e),t}_getActions(i){return[{label:d(14733,null),run:()=>this._commandService.executeCommand("workbench.action.terminal.showEnvironmentContributions",i),commandId:"workbench.action.terminal.showEnvironmentContributions"}]}getStatus(i){return{id:"env-var-info-changes-active",severity:bt.Info,tooltip:void 0,detailedTooltip:this._getInfo(i),hoverActions:this._getActions(i)}}};are=I([m(1,ge),m(2,lt)],are);function Q_o(a,i,e,t){let o=[`
`],n=a.getDescriptionMap(void 0),r=a.getDescriptionMap(i);for(let s of t){let l=n.get(s);l&&(o.push(`
- \`${qVi(s,e)}\``),o.push(`: ${l}`));let c=r.get(s);if(c){let u=l?` (${d(14732,null)})`:"";o.push(`
- \`${qVi(s,e)}${u}\``),o.push(`: ${c}`)}!l&&!c&&o.push(`
- \`${qVi(s,e)}\``)}return o.join("")}function t8t(a,i){for(let e of i)for(let t of e)a.add(t.extensionIdentifier)}function qVi(a,i){return i.extensions.find(e=>e.id===a)?.displayName||a}var Bhn=new Map([[2,"APPEND"],[3,"PREPEND"],[1,"REPLACE"]]),Hhn=/^VSCODE_PYTHON_(PWSH|ZSH|BASH|FISH)_ACTIVATE/,Uhn="ms-python.vscode-python-envs",I1e=class{constructor(i){this.collections=i;this.map=new Map;this.descriptionMap=new Map;i.forEach((e,t)=>{this.populateDescriptionMap(e,t);let o=e.map.entries(),n=o.next();for(;!n.done;){let r=n.value[1],s=n.value[0];if(this.blockPythonActivationVar(s,t)){n=o.next();continue}let l=this.map.get(s);if(l||(l=[],this.map.set(s,l)),l.length>0&&l[0].type===1){n=o.next();continue}let c={extensionIdentifier:t,value:r.value,type:r.type,scope:r.scope,variable:r.variable,options:r.options};c.scope||delete c.scope,l.unshift(c),n=o.next()}})}async applyToProcessEnvironment(i,e,t){let o;ei&&(o={},Object.keys(i).forEach(n=>o[n.toLowerCase()]=n));for(let[n,r]of this.getVariableMap(e)){let s=ei&&o[n.toLowerCase()]||n;for(let l of r){let c=t?await t(l.value):l.value;if(!this.blockPythonActivationVar(l.variable,l.extensionIdentifier)){if(l.options?.applyAtProcessCreation??!0)switch(l.type){case 2:i[s]=(i[s]||"")+c;break;case 3:i[s]=c+(i[s]||"");break;case 1:i[s]=c;break}if(l.options?.applyAtShellIntegration??!1){let u=`VSCODE_ENV_${Bhn.get(l.type)}`;i[u]=(i[u]?i[u]+":":"")+n+"="+this._encodeColons(c)}}}}}_encodeColons(i){return i.replaceAll(":","\\x3a")}blockPythonActivationVar(i,e){return!!(Hhn.test(i)&&Uhn!==e)}diff(i,e){let t=new Map,o=new Map,n=new Map;if(i.getVariableMap(e).forEach((r,s)=>{let l=this.getVariableMap(e).get(s),c=X_o(r,l);c&&t.set(s,c)}),this.getVariableMap(e).forEach((r,s)=>{let l=i.getVariableMap(e).get(s),c=X_o(r,l);c&&n.set(s,c)}),this.getVariableMap(e).forEach((r,s)=>{let l=i.getVariableMap(e).get(s),c=zhn(r,l);c&&o.set(s,c)}),!(t.size===0&&o.size===0&&n.size===0))return{added:t,changed:o,removed:n}}getVariableMap(i){let e=new Map;for(let t of this.map.values()){let o=t.filter(n=>Y_o(n,i));o.length>0&&e.set(o[0].variable,o)}return e}getDescriptionMap(i){let e=new Map;for(let t of this.descriptionMap.values()){let o=t.filter(n=>Y_o(n,i,!0));for(let n of o)e.set(n.extensionIdentifier,n.description)}return e}populateDescriptionMap(i,e){if(!i.descriptionMap)return;let t=i.descriptionMap.entries(),o=t.next();for(;!o.done;){let n=o.value[1],r=o.value[0],s=this.descriptionMap.get(r);s||(s=[],this.descriptionMap.set(r,s));let l={extensionIdentifier:e,scope:n.scope,description:n.description};l.scope||delete l.scope,s.push(l),o=t.next()}}};function Y_o(a,i,e=!1){return a.scope?!!(a.scope.workspaceFolder&&i?.workspaceFolder&&a.scope.workspaceFolder.index===i.workspaceFolder.index):e?i===a.scope:!0}function X_o(a,i){if(!i)return a;let e=new Set;i.forEach(o=>e.add(o.extensionIdentifier));let t=[];return a.forEach(o=>{e.has(o.extensionIdentifier)||t.push(o)}),t.length===0?void 0:t}function zhn(a,i){if(!i)return;let e=new Map;i.forEach(o=>e.set(o.extensionIdentifier,o));let t=[];return a.forEach(o=>{let n=e.get(o.extensionIdentifier);n&&(o.type!==n.type||o.value!==n.value||o.scope?.workspaceFolder?.index!==n.scope?.workspaceFolder?.index)&&t.push(n)}),t.length===0?void 0:t}var y1e=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,P,O){super();this._instanceId=e;this._historyService=r;this._instantiationService=s;this._logService=l;this._workspaceContextService=c;this._configurationResolverService=u;this._workbenchEnvironmentService=p;this._productService=h;this._remoteAgentService=g;this._pathService=f;this._environmentVariableService=v;this._terminalConfigurationService=b;this._terminalProfileResolverService=S;this._configurationService=y;this._terminalInstanceService=w;this._telemetryService=k;this._notificationService=T;this._accessibilityService=P;this._terminalService=O;this.processState=1;this.capabilities=this._register(new Sx);this.processReadyTimestamp=0;this._isDisposed=!1;this._process=null;this._processType=0;this._preLaunchInputQueue=[];this._hasWrittenData=!1;this._hasChildProcesses=!1;this._ptyListenersAttached=!1;this._isDisconnected=!1;this._dimensions={cols:0,rows:0};this._onPtyDisconnect=this._register(new E);this.onPtyDisconnect=this._onPtyDisconnect.event;this._onPtyReconnect=this._register(new E);this.onPtyReconnect=this._onPtyReconnect.event;this._onProcessReady=this._register(new E);this.onProcessReady=this._onProcessReady.event;this._onProcessStateChange=this._register(new E);this.onProcessStateChange=this._onProcessStateChange.event;this._onBeforeProcessData=this._register(new E);this.onBeforeProcessData=this._onBeforeProcessData.event;this._onProcessData=this._register(new E);this.onProcessData=this._onProcessData.event;this._onProcessReplayComplete=this._register(new E);this.onProcessReplayComplete=this._onProcessReplayComplete.event;this._onDidChangeProperty=this._register(new E);this.onDidChangeProperty=this._onDidChangeProperty.event;this._onEnvironmentVariableInfoChange=this._register(new E);this.onEnvironmentVariableInfoChanged=this._onEnvironmentVariableInfoChange.event;this._onProcessExit=this._register(new E);this.onProcessExit=this._onProcessExit.event;this._onRestoreCommands=this._register(new E);this.onRestoreCommands=this._onRestoreCommands.event;this._cwdWorkspaceFolder=L6(t,this._workspaceContextService,this._historyService),this.ptyProcessReady=this._createPtyProcessReadyPromise(),this._ackDataBufferer=new $Vi(V=>this._process?.acknowledgeDataEvent(V)),this._dataFilter=this._register(this._instantiationService.createInstance(mct)),this._register(this._dataFilter.onProcessData(V=>{let G={data:Fe(V)?V:V.data};this._onBeforeProcessData.fire(G),G.data&&G.data.length>0&&(Fe(V)||(V.data=G.data),this._onProcessData.fire(Fe(V)?{data:G.data,trackCommit:!1}:V))})),t&&typeof t=="object"?this.remoteAuthority=b5(t):this.remoteAuthority=this._workbenchEnvironmentService.remoteAuthority,o&&(this._extEnvironmentVariableCollection=new I1e(o),this._register(this._environmentVariableService.onDidChangeCollections(V=>this._onEnvironmentVariableCollectionChange(V))),this.environmentVariableInfo=this._instantiationService.createInstance(are,this._extEnvironmentVariableCollection),this._onEnvironmentVariableInfoChange.fire(this.environmentVariableInfo)),this.shellIntegrationNonce=n??xt()}get persistentProcessId(){return this._process?.id}get shouldPersist(){return!!this.reconnectionProperties||(this._process?this._process.shouldPersist:!1)}get hasWrittenData(){return this._hasWrittenData}get hasChildProcesses(){return this._hasChildProcesses}get reconnectionProperties(){return this._shellLaunchConfig?.attachPersistentProcess?.reconnectionProperties||this._shellLaunchConfig?.reconnectionProperties||void 0}get extEnvironmentVariableCollection(){return this._extEnvironmentVariableCollection}get processTraits(){return this._processTraits}async freePortKillProcess(e){try{this._process?.freePortKillProcess&&await this._process?.freePortKillProcess(e)}catch(t){this._notificationService.notify({message:d(14871,null,e,t),severity:bt.Warning})}}dispose(e=!1){this._isDisposed=!0,this._process&&(this._setProcessState(5),this._process.shutdown(e),this._process=null),this._processListeners&&(Be(this._processListeners),this._processListeners=void 0),super.dispose()}_createPtyProcessReadyPromise(){return new Promise(e=>{let t=U.once(this.onProcessReady)(()=>{this._logService.debug(`Terminal process ready (shellProcessId: ${this.shellProcessId})`),this._store.delete(t),e(void 0)});this._store.add(t)})}async detachFromProcess(e){await this._process?.detach?.(e),this._process=null}async createProcess(e,t,o,n=!0){this._shellLaunchConfig=e,this._dimensions.cols=t,this._dimensions.rows=o;let r;if(e.customPtyImplementation)this._processType=1,r=e.customPtyImplementation(this._instanceId,t,o);else{let l=await this._terminalInstanceService.getBackend(this.remoteAuthority);if(!l)throw new Error(`No terminal backend registered for remote authority '${this.remoteAuthority}'`);this.backend=l;let c={...await this._terminalProfileResolverService.getEnvironment(this.remoteAuthority)};c1e(c,await l.getShellEnvironment());let u=j3t(this._cwdWorkspaceFolder,c,this._configurationResolverService);if(this.userHome=this._pathService.resolvedUserHome?.fsPath,this.os=Po,this.remoteAuthority){let p=await this._pathService.userHome();this.userHome=p.path;let h=await this._remoteAgentService.getEnvironment();if(!h)throw new Error(`Failed to get remote environment for remote authority "${this.remoteAuthority}"`);this.userHome=h.userHome.path,this.os=h.os;let g=await this._resolveEnvironment(l,u,e),f=(this._configurationService.getValue("task.reconnection")&&e.reconnectionProperties||!e.isFeatureTerminal)&&this._terminalConfigurationService.config.enablePersistentSessions&&!e.isTransient;if(e.attachPersistentProcess){let v=await l.attachToProcess(e.attachPersistentProcess.id);v?r=v:(this._logService.warn("Attach to process failed for terminal",e.attachPersistentProcess),e.attachPersistentProcess=void 0)}if(!r){await this._terminalProfileResolverService.resolveShellLaunchConfig(e,{remoteAuthority:this.remoteAuthority,os:this.os});let v={shellIntegration:{enabled:this._configurationService.getValue("terminal.integrated.shellIntegration.enabled"),suggestEnabled:this._configurationService.getValue(jl.SuggestEnabled),nonce:this.shellIntegrationNonce},windowsUseConptyDll:this._terminalConfigurationService.config.windowsUseConptyDll??!1,environmentVariableCollections:this._extEnvironmentVariableCollection?.collections?Cvi(this._extEnvironmentVariableCollection.collections):void 0,workspaceFolder:this._cwdWorkspaceFolder,isScreenReaderOptimized:this._accessibilityService.isScreenReaderOptimized()};try{r=await l.createProcess(e,"",t,o,this._terminalConfigurationService.config.unicodeVersion,g,v,f)}catch(b){if(b?.message==="Could not fetch remote environment"){this._logService.trace("Could not fetch remote environment, silently failing");return}throw b}}this._isDisposed||this._setupPtyHostListeners(l)}else{if(e.attachPersistentProcess){let p=e.attachPersistentProcess.findRevivedId?await l.attachToRevivedProcess(e.attachPersistentProcess.id):await l.attachToProcess(e.attachPersistentProcess.id);p?r=p:(this._logService.warn("Attach to process failed for terminal",e.attachPersistentProcess),e.attachPersistentProcess=void 0)}r||(r=await this._launchLocalProcess(l,e,t,o,this.userHome,u)),this._isDisposed||this._setupPtyHostListeners(l)}}if(this._isDisposed){r.shutdown(!1);return}this._process=r,this._setProcessState(2),(this.os===3||this.os===2)&&this.capabilities.add(1,new Z3t(this._process)),this._dataFilter.newProcess(this._process,n),this._processListeners&&Be(this._processListeners),this._processListeners=[r.onProcessReady(l=>{this._logService.debug("onProcessReady",l),this._processTraits=l,this.shellProcessId=l.pid,this._initialCwd=l.cwd,this.processReadyTimestamp=Date.now(),this._onDidChangeProperty.fire({type:"initialCwd",value:this._initialCwd}),this._onProcessReady.fire(l),this._preLaunchInputQueue.length>0&&this._process&&(this._logService.debug("sending prelaunch input queue",this._preLaunchInputQueue),r.input(this._preLaunchInputQueue.join("")),this._preLaunchInputQueue.length=0)}),r.onProcessExit(l=>this._onExit(l)),r.onDidChangeProperty(({type:l,value:c})=>{switch(l){case"hasChildProcesses":this._hasChildProcesses=c;break;case"failedShellIntegrationActivation":this._telemetryService?.publicLog2("terminal/shellIntegrationActivationFailureCustomArgs");break}this._onDidChangeProperty.fire({type:l,value:c})})],r.onProcessReplayComplete&&this._processListeners.push(r.onProcessReplayComplete(()=>this._onProcessReplayComplete.fire())),r.onRestoreCommands&&this._processListeners.push(r.onRestoreCommands(l=>this._onRestoreCommands.fire(l))),setTimeout(()=>{this.processState===2&&this._setProcessState(3)},500);let s=await r.start();if(s)return s;rf(Ki(),()=>{this.backend?.getLatency().then(l=>{this._logService.info(`Latency measurements for ${this.remoteAuthority??"local"} backend
${l.map(c=>`${c.label}: ${c.latency.toFixed(2)}ms`).join(`
`)}`)})})}async relaunch(e,t,o,n){return this.ptyProcessReady=this._createPtyProcessReadyPromise(),this._logService.trace(`Relaunching terminal instance ${this._instanceId}`),this._isDisconnected&&(this._isDisconnected=!1,this._onPtyReconnect.fire()),this._hasWrittenData=!1,this.createProcess(e,t,o,n)}async _resolveEnvironment(e,t,o){let n=L6(o.cwd,this._workspaceContextService,this._historyService),r=ei?"windows":Ze?"osx":"linux",s=this._configurationService.getValue(`terminal.integrated.env.${r}`);this._logService.debug(`Resolving environment (useShellEnvironment=${o.useShellEnvironment}, platformKey=${r}, envFromConfig=${s?Object.keys(s).join(","):"none"})`);let l;if(o.useShellEnvironment){let u=await e.getShellEnvironment();if(!u)throw new li("Cannot fetch shell environment to use");this._logService.debug(`Shell environment resolved with ${Object.keys(u).length} variables: ${Object.keys(u).sort().join(", ")}`),l=u}else l=await this._terminalProfileResolverService.getEnvironment(this.remoteAuthority),this._logService.debug(`Profile environment resolved with ${Object.keys(l).length} variables`);let c=await Q3t(o,s,t,this._productService.version,this._terminalConfigurationService.config.detectLocale,l);return this._logService.debug(`Terminal environment created with ${Object.keys(c).length} variables: ${Object.keys(c).sort().join(", ")}`),!this._isDisposed&&C5t(o)&&(this._extEnvironmentVariableCollection=this._environmentVariableService.mergedCollection,this._register(this._environmentVariableService.onDidChangeCollections(u=>this._onEnvironmentVariableCollectionChange(u))),await this._extEnvironmentVariableCollection.applyToProcessEnvironment(c,{workspaceFolder:n},t),this._extEnvironmentVariableCollection.getVariableMap({workspaceFolder:n}).size&&(this.environmentVariableInfo=this._instantiationService.createInstance(are,this._extEnvironmentVariableCollection),this._onEnvironmentVariableInfoChange.fire(this.environmentVariableInfo))),c}async _launchLocalProcess(e,t,o,n,r,s){await this._terminalProfileResolverService.resolveShellLaunchConfig(t,{remoteAuthority:void 0,os:Po});let l=this._historyService.getLastActiveWorkspaceRoot(Q.file),c=await M_o(t,r,s,l,this._terminalConfigurationService.config.cwd,this._logService),u=await this._resolveEnvironment(e,s,t),p={shellIntegration:{enabled:this._configurationService.getValue("terminal.integrated.shellIntegration.enabled"),suggestEnabled:this._configurationService.getValue(jl.SuggestEnabled),nonce:this.shellIntegrationNonce},windowsUseConptyDll:this._terminalConfigurationService.config.windowsUseConptyDll??!1,environmentVariableCollections:this._extEnvironmentVariableCollection?Cvi(this._extEnvironmentVariableCollection.collections):void 0,workspaceFolder:this._cwdWorkspaceFolder,isScreenReaderOptimized:this._accessibilityService.isScreenReaderOptimized()},h=(this._configurationService.getValue("task.reconnection")&&t.reconnectionProperties||!t.isFeatureTerminal)&&this._terminalConfigurationService.config.enablePersistentSessions&&!t.isTransient;return await e.createProcess(t,c,o,n,this._terminalConfigurationService.config.unicodeVersion,u,p,h)}_setupPtyHostListeners(e){this._ptyListenersAttached||(this._ptyListenersAttached=!0,this._register(e.onPtyHostUnresponsive(()=>{this._isDisconnected=!0,this._onPtyDisconnect.fire()})),this._ptyResponsiveListener=e.onPtyHostResponsive(()=>{this._isDisconnected=!1,this._onPtyReconnect.fire()}),this._register(Z(()=>this._ptyResponsiveListener?.dispose())),this._register(e.onPtyHostRestart(async()=>{if(this._isDisconnected||(this._isDisconnected=!0,this._onPtyDisconnect.fire()),this._ptyResponsiveListener?.dispose(),this._ptyResponsiveListener=void 0,this._shellLaunchConfig)if(this._shellLaunchConfig.isFeatureTerminal&&!this.reconnectionProperties)this._onExit(-1);else{let t=d(14872,null);this._onProcessData.fire({data:nE(t,{loudFormatting:!0}),trackCommit:!1}),await this.relaunch(this._shellLaunchConfig,this._dimensions.cols,this._dimensions.rows,!1)}})),this._register(Z(()=>{this.ptyProcessReady=void 0})))}async getBackendOS(){let e=Po;if(this.remoteAuthority){let t=await this._remoteAgentService.getEnvironment();if(!t)throw new Error(`Failed to get remote environment for remote authority "${this.remoteAuthority}"`);e=t.os}return e}setDimensions(e,t,o,n,r){if(o){this._resize(e,t,n,r);return}return this.ptyProcessReady.then(()=>this._resize(e,t,n,r))}async setUnicodeVersion(e){return this._process?.setUnicodeVersion(e)}async setNextCommandId(e,t){await this.ptyProcessReady;let o=this._process;o?.id&&await this._terminalService.setNextCommandId(o.id,e,t)}_resize(e,t,o,n){if(this._process){try{this._process.resize(e,t,o,n)}catch(r){if(r.code!=="EPIPE"&&r.code!=="ERR_IPC_CHANNEL_CLOSED")throw r}this._dimensions.cols=e,this._dimensions.rows=t}}async write(e){await this.ptyProcessReady,this._dataFilter.disableSeamlessRelaunch(),this._hasWrittenData=!0,this.shellProcessId||this._processType===1?this._process&&this._process.input(e):(this._logService.debug("queueing data in prelaunch input queue",e),this._preLaunchInputQueue.push(e))}async sendSignal(e){await this.ptyProcessReady,this._process&&this._process.sendSignal(e)}async processBinary(e){await this.ptyProcessReady,this._dataFilter.disableSeamlessRelaunch(),this._hasWrittenData=!0,this._process?.processBinary(e)}get initialCwd(){return this._initialCwd??""}async refreshProperty(e){if(!this._process)throw new Error("Cannot refresh property when process is not set");return this._process.refreshProperty(e)}async updateProperty(e,t){return this._process?.updateProperty(e,t)}acknowledgeDataEvent(e){this._ackDataBufferer.ack(e)}_onExit(e){this._process=null,this.processState===2&&this._setProcessState(4),this.processState===3&&this._setProcessState(6),this._onProcessExit.fire(e)}_setProcessState(e){this.processState=e,this._onProcessStateChange.fire()}_onEnvironmentVariableCollectionChange(e){let t=this._extEnvironmentVariableCollection.diff(e,{workspaceFolder:this._cwdWorkspaceFolder});if(t===void 0){this.environmentVariableInfo instanceof nbe&&(this.environmentVariableInfo=this._instantiationService.createInstance(are,this._extEnvironmentVariableCollection),this._onEnvironmentVariableInfoChange.fire(this.environmentVariableInfo));return}this.environmentVariableInfo=this._instantiationService.createInstance(nbe,t,this._instanceId,e),this._onEnvironmentVariableInfoChange.fire(this.environmentVariableInfo)}async clearBuffer(){this._process?.clearBuffer?.()}};y1e=I([m(4,na),m(5,F),m(6,ca),m(7,Pe),m(8,Tp),m(9,At),m(10,tt),m(11,bo),m(12,An),m(13,c2),m(14,Uu),m(15,Ag),m(16,B),m(17,Nm),m(18,Te),m(19,Ne),m(20,Oi),m(21,nn)],y1e);var $Vi=class{constructor(i){this._callback=i;this._unsentCharCount=0}ack(i){for(this._unsentCharCount+=i;this._unsentCharCount>5e3;)this._unsentCharCount-=5e3,this._callback(5e3)}};var mct=class extends x{constructor(e){super();this._logService=e;this._firstDisposable=this._register(new me);this._secondDisposable=this._register(new me);this._dataListener=this._register(new me);this._disableSeamlessRelaunch=!1;this._onProcessData=this._register(new E)}get onProcessData(){return this._onProcessData.event}newProcess(e,t){if(this._dataListener.clear(),this._activeProcess?.shutdown(!1),this._activeProcess=e,!this._firstRecorder||!t||this._disableSeamlessRelaunch){[this._firstRecorder,this._firstDisposable.value]=this._createRecorder(e),this._disableSeamlessRelaunch&&t&&this._onProcessData.fire("\x1Bc"),this._dataListener.value=e.onProcessData(n=>this._onProcessData.fire(n)),this._disableSeamlessRelaunch=!1;return}this._secondRecorder&&this.triggerSwap(),this._swapTimeout=ut.setTimeout(()=>this.triggerSwap(),3e3),this._dataListener.clear(),this._firstDisposable.clear();let o=this._createRecorder(e);[this._secondRecorder,this._secondDisposable.value]=o}disableSeamlessRelaunch(){this._disableSeamlessRelaunch=!0,this._stopRecording(),this.triggerSwap()}triggerSwap(){if(this._swapTimeout&&(ut.clearTimeout(this._swapTimeout),this._swapTimeout=void 0),!this._firstRecorder)return;if(!this._secondRecorder){this._firstRecorder=void 0,this._firstDisposable.clear();return}let e=this._getDataFromRecorder(this._firstRecorder),t=this._getDataFromRecorder(this._secondRecorder);e===t?this._logService.trace("Seamless terminal relaunch - identical content"):(this._logService.trace("Seamless terminal relaunch - resetting content"),this._onProcessData.fire({data:`\x1Bc${t}`,trackCommit:!1})),this._dataListener.value=this._activeProcess.onProcessData(o=>this._onProcessData.fire(o)),this._firstRecorder=this._secondRecorder,this._firstDisposable.value=this._secondDisposable.value,this._secondRecorder=void 0}_stopRecording(){this._swapTimeout||(this._firstRecorder=void 0,this._firstDisposable.clear(),this._secondRecorder=void 0,this._secondDisposable.clear())}_createRecorder(e){let t=new e8t(0,0),o=e.onProcessData(n=>t.handleData(Fe(n)?n:n.data));return[t,o]}_getDataFromRecorder(e){return e.generateReplayEventSync().events.filter(t=>!!t.data).map(t=>t.data).join("")}};mct=I([m(0,ca)],mct);var i8t=class extends x{constructor(e){super();this._initializationPromise=e;this._isOsSet=!1;this._onLineData=this._register(new E);this.onLineData=this._onLineData.event}async activate(e){this._xterm=e;let t=e.buffer;await this._initializationPromise,this._register(e.onLineFeed(()=>{let o=t.active.getLine(t.active.baseY+t.active.cursorY);o&&!o.isWrapped&&this._sendLineData(t.active,t.active.baseY+t.active.cursorY-1)})),this._register(Z(()=>{this._sendLineData(t.active,t.active.baseY+t.active.cursorY)}))}setOperatingSystem(e){if(!(this._isOsSet||!this._xterm)&&(this._isOsSet=!0,e===1)){let t=this._xterm;this._register(t.parser.registerCsiHandler({final:"H"},()=>{let o=t.buffer;return this._sendLineData(o.active,o.active.baseY+o.active.cursorY),!1}))}}_sendLineData(e,t){let o=e.getLine(t);if(!o)return;let n=o.translateToString(!0);for(;t>0&&o.isWrapped&&(o=e.getLine(--t),!!o);)n=o.translateToString(!1)+n;this._onLineData.fire(n)}};var o8t=class a extends x{constructor(e){super();this.options=e;this.domId=`icon_select_box_id_${++a.InstanceCount}`;this._onDidSelect=this._register(new E);this.onDidSelect=this._onDidSelect.event;this.renderedIcons=[];this.focusedItemIndex=0;this.numberOfElementsPerRow=1;this.iconContainerWidth=36;this.iconContainerHeight=36;this.domNode=_(".icon-select-box"),this._register(this.create())}static{this.InstanceCount=0}create(){let e=new N,t=M(this.domNode,_(".icon-select-box-container"));t.style.margin="10px 15px";let o=M(t,_(".icon-select-input-container"));o.style.paddingBottom="10px",this.inputBox=e.add(new Vc(o,void 0,{placeholder:d(18,null),inputBoxStyles:this.options.inputBoxStyles}));let n=this.iconsContainer=_(".icon-select-icons-container",{id:`${this.domId}_icons`});n.role="listbox",n.tabIndex=0,this.scrollableElement=e.add(new ms(n,{useShadows:!1,horizontal:2})),M(t,this.scrollableElement.getDomNode()),this.options.showIconInfo&&(this.iconIdElement=this._register(new Ya(M(M(t,_(".icon-select-id-container")),_(".icon-select-id-label")))));let r=e.add(new me);return r.value=this.renderIcons(this.options.icons,[],n),this.scrollableElement.scanDomNode(),e.add(this.inputBox.onDidChange(s=>{let l=[],c=[];for(let u of this.options.icons){let p=this.matchesContiguous(s,u.id);p&&(l.push(u),c.push(p))}l.length&&(r.value=this.renderIcons(l,c,n),this.scrollableElement?.scanDomNode())})),this.inputBox.inputElement.role="combobox",this.inputBox.inputElement.ariaHasPopup="menu",this.inputBox.inputElement.ariaAutoComplete="list",this.inputBox.inputElement.ariaExpanded="true",this.inputBox.inputElement.setAttribute("aria-controls",n.id),e}renderIcons(e,t,o){let n=new N;Rt(o);let r=this.renderedIcons[this.focusedItemIndex]?.icon,s=0,l=[];if(e.length)for(let c=0;c<e.length;c++){let u=e[c],p=M(o,_(".icon-container",{id:`${this.domId}_icons_${c}`}));p.style.width=`${this.iconContainerWidth}px`,p.style.height=`${this.iconContainerHeight}px`,p.title=u.id,p.role="button",p.setAttribute("aria-setsize",`${e.length}`),p.setAttribute("aria-posinset",`${c+1}`),M(p,_(q.asCSSSelector(u))),l.push({icon:u,element:p,highlightMatches:t[c]}),n.add(j(p,re.CLICK,h=>{h.stopPropagation(),this.setSelection(c)})),u===r&&(s=c)}else{let c=d(17,null);M(o,_(".icon-no-results",void 0,c)),en(c)}return this.renderedIcons.splice(0,this.renderedIcons.length,...l),this.focusIcon(s),n}focusIcon(e){let t=this.renderedIcons[this.focusedItemIndex];t&&t.element.classList.remove("focused"),this.focusedItemIndex=e;let o=this.renderedIcons[e];o&&o.element.classList.add("focused"),this.inputBox&&(o?this.inputBox.inputElement.setAttribute("aria-activedescendant",o.element.id):this.inputBox.inputElement.removeAttribute("aria-activedescendant")),this.iconIdElement&&(o?this.iconIdElement.set(o.icon.id,o.highlightMatches):this.iconIdElement.set("")),this.reveal(e)}reveal(e){if(!this.scrollableElement||e<0||e>=this.renderedIcons.length)return;let t=this.renderedIcons[e].element;if(!t)return;let{height:o}=this.scrollableElement.getScrollDimensions(),{scrollTop:n}=this.scrollableElement.getScrollPosition();t.offsetTop+this.iconContainerHeight>n+o?this.scrollableElement.setScrollPosition({scrollTop:t.offsetTop+this.iconContainerHeight-o}):t.offsetTop<n&&this.scrollableElement.setScrollPosition({scrollTop:t.offsetTop})}matchesContiguous(e,t){let o=t.toLowerCase().indexOf(e.toLowerCase());return o!==-1?[{start:o,end:o+e.length}]:null}layout(e){this.domNode.style.width=`${e.width}px`,this.domNode.style.height=`${e.height}px`;let t=e.width-30;if(this.numberOfElementsPerRow=Math.floor(t/this.iconContainerWidth),this.numberOfElementsPerRow===0)throw new Error("Insufficient width");let o=t%this.iconContainerWidth,n=Math.floor(o/this.numberOfElementsPerRow);for(let{element:s}of this.renderedIcons)s.style.marginRight=`${n}px`;let r=o%this.numberOfElementsPerRow;this.iconsContainer&&(this.iconsContainer.style.paddingLeft=`${Math.floor(r/2)}px`,this.iconsContainer.style.paddingRight=`${Math.ceil(r/2)}px`),this.scrollableElement&&(this.scrollableElement.getDomNode().style.height=`${this.iconIdElement?e.height-80:e.height-40}px`,this.scrollableElement.scanDomNode())}getFocus(){return[this.focusedItemIndex]}setSelection(e){if(e<0||e>=this.renderedIcons.length)throw new Error(`Invalid index ${e}`);this.focusIcon(e),this._onDidSelect.fire(this.renderedIcons[e].icon)}clearInput(){this.inputBox&&(this.inputBox.value="")}focus(){this.inputBox?.focus(),this.focusIcon(0)}focusNext(){this.focusIcon((this.focusedItemIndex+1)%this.renderedIcons.length)}focusPrevious(){this.focusIcon((this.focusedItemIndex-1+this.renderedIcons.length)%this.renderedIcons.length)}focusNextRow(){let e=this.focusedItemIndex+this.numberOfElementsPerRow;e>=this.renderedIcons.length&&(e=(e+1)%this.numberOfElementsPerRow,e=e>=this.renderedIcons.length?0:e),this.focusIcon(e)}focusPreviousRow(){let e=this.focusedItemIndex-this.numberOfElementsPerRow;if(e<0){let t=Math.floor(this.renderedIcons.length/this.numberOfElementsPerRow);e=this.focusedItemIndex+this.numberOfElementsPerRow*t-1,e=e<0?this.renderedIcons.length-1:e>=this.renderedIcons.length?e-this.numberOfElementsPerRow:e}this.focusIcon(e)}getFocusedIcon(){return this.renderedIcons[this.focusedItemIndex].icon}};var w1e=new Y("iconSelectBoxFocus",!0),jVi=new Y("iconSelectBoxInputFocus",!0),QVi=new Y("iconSelectBoxInputEmpty",!0),o_=class extends o8t{static getFocusedWidget(){return o_.focusedWidget}constructor(i,e){if(super(i),this.contextKeyService=this._register(e.createScoped(this.domNode)),w1e.bindTo(this.contextKeyService),this.inputFocusContextKey=jVi.bindTo(this.contextKeyService),this.inputEmptyContextKey=QVi.bindTo(this.contextKeyService),this.inputBox){let t=this._register(qn(this.inputBox.inputElement));this._register(t.onDidFocus(()=>this.inputFocusContextKey.set(!0))),this._register(t.onDidBlur(()=>this.inputFocusContextKey.set(!1))),this._register(this.inputBox.onDidChange(()=>this.inputEmptyContextKey.set(this.inputBox?.value.length===0)))}}focus(){super.focus(),o_.focusedWidget=this}};o_=I([m(1,X)],o_);Ct.registerCommandAndKeybindingRule({id:"iconSelectBox.focusUp",weight:200,when:w1e,primary:16,handler:()=>{let a=o_.getFocusedWidget();a&&a.focusPreviousRow()}});Ct.registerCommandAndKeybindingRule({id:"iconSelectBox.focusDown",weight:200,when:w1e,primary:18,handler:()=>{let a=o_.getFocusedWidget();a&&a.focusNextRow()}});Ct.registerCommandAndKeybindingRule({id:"iconSelectBox.focusNext",weight:200,when:C.and(w1e,C.or(QVi,jVi.toNegated())),primary:17,handler:()=>{let a=o_.getFocusedWidget();a&&a.focusNext()}});Ct.registerCommandAndKeybindingRule({id:"iconSelectBox.focusPrevious",weight:200,when:C.and(w1e,C.or(QVi,jVi.toNegated())),primary:15,handler:()=>{let a=o_.getFocusedWidget();a&&a.focusPrevious()}});Ct.registerCommandAndKeybindingRule({id:"iconSelectBox.selectFocused",weight:200,when:w1e,primary:3,handler:()=>{let a=o_.getFocusedWidget();a&&a.setSelection(a.getFocus()[0])}});var Khn=new co(()=>{let a=mw().getIcons(),i=new Set;return a.filter(t=>t.id===Z9.blank.id||q.isThemeIcon(t.defaults)||i.has(t.defaults.fontCharacter)?!1:(i.add(t.defaults.fontCharacter),!0))}),C1e=class extends x{constructor(e,t,o){super();this._hoverService=t;this._layoutService=o;this._iconSelectBox=e.createInstance(o_,{icons:Khn.value,inputBoxStyles:Cl})}async pickIcons(){let e=new si(486,260);return new Promise(t=>{this._register(this._iconSelectBox.onDidSelect(s=>{t(s),this._iconSelectBox.dispose()})),this._iconSelectBox.clearInput();let o=sm().body,n=o.getBoundingClientRect(),r=this._hoverService.showInstantHover({content:this._iconSelectBox.domNode,target:{targetElements:[o],x:n.left+(n.width-e.width)/2,y:n.top+this._layoutService.activeContainerOffset.top},position:{hoverPosition:2},persistence:{sticky:!0}},!0);r&&this._register(r),this._iconSelectBox.layout(e),this._iconSelectBox.focus()})}};C1e=I([m(0,F),m(1,nt),m(2,Kl)],C1e);var hct=class extends x{constructor(e,t,o,n,r){super();this._isVisible=e;this._getXterm=t;this._resizeBothCallback=o;this._resizeXCallback=n;this._resizeYCallback=r;this._latestX=0;this._latestY=0;this._resizeXJob=this._register(new me);this._resizeYJob=this._register(new me)}async resize(e,t,o){if(this._latestX=e,this._latestY=t,o||this._getXterm().raw.buffer.normal.length<200){this._resizeXJob.clear(),this._resizeYJob.clear(),this._resizeBothCallback(e,t);return}let n=Re(this._getXterm().raw.element);if(n&&!this._isVisible()){this._resizeXJob.value||(this._resizeXJob.value=rf(n,async()=>{this._resizeXCallback(this._latestX),this._resizeXJob.clear()})),this._resizeYJob.value||(this._resizeYJob.value=rf(n,async()=>{this._resizeYCallback(this._latestY),this._resizeYJob.clear()}));return}this._resizeYCallback(t),this._latestX=e,this._debounceResizeX(e)}flush(){(this._resizeXJob.value||this._resizeYJob.value)&&(this._resizeXJob.clear(),this._resizeYJob.clear(),this._resizeBothCallback(this._latestX,this._latestY))}_debounceResizeX(e){this._resizeXCallback(e)}};I([Zd(100)],hct.prototype,"_debounceResizeX",1);var n8t,$hn=["bash","zsh","pwsh","python"],dv=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,P,O,V,H,G,$,J,ae,he,oe){super();this._terminalShellTypeContextKey=e;this._shellLaunchConfig=t;this._contextKeyService=o;this._contextMenuService=n;this._terminalConfigurationService=s;this._terminalProfileResolverService=l;this._pathService=c;this._fileService=u;this._keybindingService=p;this._notificationService=h;this._viewsService=f;this._themeService=v;this._configurationService=b;this._logService=S;this._accessibilityService=w;this._quickInputService=T;this._workbenchEnvironmentService=P;this._workspaceContextService=O;this._editorService=V;this._workspaceTrustRequestService=H;this._historyService=G;this._telemetryService=$;this._openerService=J;this._commandService=ae;this._accessibilitySignalService=he;this._viewDescriptorService=oe;this._contributions=new Map;this._latestXtermWriteData=0;this._latestXtermParseData=0;this._title="";this._titleSource=1;this._cols=0;this._rows=0;this._cwd=void 0;this._initialCwd=void 0;this._injectedArgs=void 0;this._layoutSettingsChanged=!0;this._areLinksReady=!1;this._initialDataEventsListener=this._register(new me);this._initialDataEvents=[];this._messageTitleDisposable=this._register(new me);this._dndObserver=this._register(new me);this._processName="";this._usedShellIntegrationInjection=!1;this.capabilities=this._register(new sQ);this.disableLayout=!1;this._targetRef=new Sht(void 0);this._onExit=new E;this.onExit=this._onExit.event;this._onDisposed=this._register(new E);this.onDisposed=this._onDisposed.event;this._onProcessIdReady=this._register(new E);this.onProcessIdReady=this._onProcessIdReady.event;this._onProcessReplayComplete=this._register(new E);this.onProcessReplayComplete=this._onProcessReplayComplete.event;this._onTitleChanged=this._register(new E);this.onTitleChanged=this._onTitleChanged.event;this._onIconChanged=this._register(new E);this.onIconChanged=this._onIconChanged.event;this._onWillData=this._register(new E);this.onWillData=this._onWillData.event;this._onData=this._register(new E);this.onData=this._onData.event;this._onBinary=this._register(new E);this.onBinary=this._onBinary.event;this._onRequestExtHostProcess=this._register(new E);this.onRequestExtHostProcess=this._onRequestExtHostProcess.event;this._onDimensionsChanged=this._register(new E);this.onDimensionsChanged=this._onDimensionsChanged.event;this._onMaximumDimensionsChanged=this._register(new E);this.onMaximumDimensionsChanged=this._onMaximumDimensionsChanged.event;this._onDidFocus=this._register(new E);this.onDidFocus=this._onDidFocus.event;this._onDidRequestFocus=this._register(new E);this.onDidRequestFocus=this._onDidRequestFocus.event;this._onDidBlur=this._register(new E);this.onDidBlur=this._onDidBlur.event;this._onDidInputData=this._register(new E);this.onDidInputData=this._onDidInputData.event;this._onDidChangeSelection=this._register(new E);this.onDidChangeSelection=this._onDidChangeSelection.event;this._onRequestAddInstanceToGroup=this._register(new E);this.onRequestAddInstanceToGroup=this._onRequestAddInstanceToGroup.event;this._onDidChangeHasChildProcesses=this._register(new E);this.onDidChangeHasChildProcesses=this._onDidChangeHasChildProcesses.event;this._onDidExecuteText=this._register(new E);this.onDidExecuteText=this._onDidExecuteText.event;this._onDidChangeTarget=this._register(new E);this.onDidChangeTarget=this._onDidChangeTarget.event;this._onDidSendText=this._register(new E);this.onDidSendText=this._onDidSendText.event;this._onDidChangeShellType=this._register(new E);this.onDidChangeShellType=this._onDidChangeShellType.event;this._onDidChangeVisibility=this._register(new E);this.onDidChangeVisibility=this._onDidChangeVisibility.event;this._onLineData=this._register(new E({onDidAddFirstListener:async()=>(this.xterm??await this._xtermReadyPromise)?.raw.loadAddon(this._lineDataEventAddon)}));this.onLineData=this._onLineData.event;this.sessionId=xt();if(this._wrapperElement=document.createElement("div"),this._wrapperElement.classList.add("terminal-wrapper"),this._widgetManager=this._register(r.createInstance(BOe)),this._skipTerminalCommands=[],this._isExiting=!1,this._hadFocusOnExit=!1,this._isVisible=!1,this._instanceId=dv._instanceIdCounter++,this._fixedRows=t.attachPersistentProcess?.fixedDimensions?.rows,this._fixedCols=t.attachPersistentProcess?.fixedDimensions?.cols,this._shellLaunchConfig.shellIntegrationEnvironmentReporting=this._configurationService.getValue("terminal.integrated.shellIntegration.environmentReporting"),this._resource=lHe(this._workspaceContextService.getWorkspace().id,this.instanceId,this.title),this._shellLaunchConfig.attachPersistentProcess?.hideFromUser&&(this._shellLaunchConfig.hideFromUser=this._shellLaunchConfig.attachPersistentProcess.hideFromUser),this._shellLaunchConfig.attachPersistentProcess?.isFeatureTerminal&&(this._shellLaunchConfig.isFeatureTerminal=this._shellLaunchConfig.attachPersistentProcess.isFeatureTerminal),this._shellLaunchConfig.attachPersistentProcess?.type&&(this._shellLaunchConfig.type=this._shellLaunchConfig.attachPersistentProcess.type),this._shellLaunchConfig.attachPersistentProcess?.tabActions&&(this._shellLaunchConfig.tabActions=this._shellLaunchConfig.attachPersistentProcess.tabActions),this.shellLaunchConfig.cwd){let De=Fe(this._shellLaunchConfig.cwd)?A.from({scheme:Q.file,path:this._shellLaunchConfig.cwd}):this._shellLaunchConfig.cwd;De&&(this._workspaceFolder=this._workspaceContextService.getWorkspaceFolder(De)??void 0)}if(!this._workspaceFolder){let De=this._historyService.getLastActiveWorkspaceRoot();this._workspaceFolder=De?this._workspaceContextService.getWorkspaceFolder(De)??void 0:void 0}let de=this._register(o.createScoped(this._wrapperElement));this._scopedContextKeyService=de,this._scopedInstantiationService=this._register(r.createChild(new _o([X,de]))),this._terminalFocusContextKey=dt.focus.bindTo(de),this._terminalHasFixedWidth=dt.terminalHasFixedWidth.bindTo(de),this._terminalHasTextContextKey=dt.textSelected.bindTo(this._contextKeyService),this._terminalAltBufferActiveContextKey=dt.altBufferActive.bindTo(de),this._terminalShellIntegrationEnabledContextKey=dt.terminalShellIntegrationEnabled.bindTo(de),this._logService.trace(`terminalInstance#ctor (instanceId: ${this.instanceId})`,this._shellLaunchConfig),this._register(this.capabilities.onDidAddCapability(De=>this._logService.debug("terminalInstance added capability",De.id))),this._register(this.capabilities.onDidRemoveCapability(De=>this._logService.debug("terminalInstance removed capability",De.id)));let Ce=this._register(new Vt);this._register(this.capabilities.onDidAddCapability(De=>{Ce.get(De.id)?.dispose();let Oe=()=>{this._labelComputer?.refreshLabel(this),this._refreshShellIntegrationInfoStatus(this)};switch(De.id){case 0:{Ce.set(De.id,De.capability.onDidChangeCwd(pt=>{this._cwd=pt,this._setTitle(this.title,3)}));break}case 2:{De.capability.promptInputModel.setShellType(this.shellType);let pt=new N;pt.add(U.any(De.capability.promptInputModel.onDidStartInput,De.capability.promptInputModel.onDidChangeInput,De.capability.promptInputModel.onDidFinishInput)(Oe)),pt.add(De.capability.onCommandExecuted(async et=>{if(!et.id&&et.command){let Ti=xt();this.xterm?.shellIntegration.setNextCommandId(et.command,Ti),await this._processManager.setNextCommandId(et.command,Ti)}})),Ce.set(De.id,pt);break}case 6:{Ce.set(De.id,De.capability.onPromptTypeChanged(Oe));break}}})),this._register(this.onDidChangeShellType(()=>this._refreshShellIntegrationInfoStatus(this))),this._register(this.capabilities.onDidRemoveCapability(De=>{Ce.get(De.id)?.dispose()})),!this.shellLaunchConfig.executable&&!this._workbenchEnvironmentService.remoteAuthority&&this._terminalProfileResolverService.resolveIcon(this._shellLaunchConfig,Po),this._icon=t.attachPersistentProcess?.icon||t.icon,this.shellLaunchConfig.customPtyImplementation&&!this._shellLaunchConfig.titleTemplate&&this._setTitle(this._shellLaunchConfig.name,0),this.statusList=this._register(this._scopedInstantiationService.createInstance(d1e)),this._initDimensions(),this._processManager=this._createProcessManager(),this._containerReadyBarrier=new B$(100),this._attachBarrier=new B$(1e3),this._xtermReadyPromise=this._createXterm(),this._xtermReadyPromise.then(async()=>{await this._containerReadyBarrier.wait();let De;if(!this.shellLaunchConfig.customPtyImplementation&&this._terminalConfigurationService.config.shellIntegration?.enabled&&!this.shellLaunchConfig.executable){De=await this._processManager.getBackendOS();let Oe=await this._terminalProfileResolverService.getDefaultProfile({remoteAuthority:this.remoteAuthority,os:De});this.shellLaunchConfig.executable=Oe.path,this.shellLaunchConfig.args=Oe.args,this.shellLaunchConfig.icon??=Oe.icon,this.shellLaunchConfig.color??=Oe.color,this.shellLaunchConfig.env??=Oe.env}De&&this.shellLaunchConfig.executable&&this.setShellType(Qhn(De,this.shellLaunchConfig.executable)),await this._createProcess(),this.shellLaunchConfig.attachPersistentProcess&&(this._cwd=this.shellLaunchConfig.attachPersistentProcess.cwd,this._setTitle(this.shellLaunchConfig.attachPersistentProcess.title,this.shellLaunchConfig.attachPersistentProcess.titleSource),this.setShellType(this.shellType)),this._fixedCols&&await this._addScrollbar()}).catch(De=>{if(!this.isDisposed)throw De}),this._register(this._configurationService.onDidChangeConfiguration(async De=>{De.affectsConfiguration("accessibility.verbosity.terminal")&&this._setAriaLabel(this.xterm?.raw,this._instanceId,this.title),De.affectsConfiguration("terminal.integrated")&&(this.updateConfig(),this.setVisible(this._isVisible)),["terminal.integrated.fontSize","terminal.integrated.fontFamily","terminal.integrated.fontWeight","terminal.integrated.fontWeightBold","terminal.integrated.letterSpacing","terminal.integrated.lineHeight","editor.fontFamily"].some(pt=>De.affectsConfiguration(pt))&&(this._layoutSettingsChanged=!0,await this._resize()),De.affectsConfiguration("terminal.integrated.unicodeVersion")&&this._updateUnicodeVersion(),De.affectsConfiguration("editor.accessibilitySupport")&&this.updateAccessibilitySupport(),(De.affectsConfiguration("terminal.integrated.tabs.title")||De.affectsConfiguration("terminal.integrated.tabs.separator")||De.affectsConfiguration("terminal.integrated.tabs.description"))&&this._labelComputer?.refreshLabel(this)})),this._register(this._workspaceContextService.onDidChangeWorkspaceFolders(()=>this._labelComputer?.refreshLabel(this)));let xe=Re(this._container).setTimeout(()=>{xe=void 0,this._initialDataEvents=void 0,this._initialDataEventsListener.clear()},1e4);this._register(Z(()=>{xe&&Re(this._container).clearTimeout(xe)}));let ze=Aot.getTerminalContributions();for(let De of ze){if(this._contributions.has(De.id)){mt(new Error(`Cannot have two terminal contributions with the same id ${De.id}`));continue}let Oe;try{Oe=this._register(this._scopedInstantiationService.createInstance(De.ctor,{instance:this,processManager:this._processManager,widgetManager:this._widgetManager})),this._contributions.set(De.id,Oe)}catch(pt){mt(pt)}this._xtermReadyPromise.then(pt=>{pt&&Oe.xtermReady?.(pt)}),this._register(this.onDisposed(()=>{Oe.dispose(),this._contributions.delete(De.id)}))}}static{this._instanceIdCounter=1}get xtermReadyPromise(){return this._xtermReadyPromise}get domElement(){return this._wrapperElement}get usedShellIntegrationInjection(){return this._usedShellIntegrationInjection}get shellIntegrationInjectionFailureReason(){return this._shellIntegrationInjectionInfo}get store(){return this._store}get extEnvironmentVariableCollection(){return this._processManager.extEnvironmentVariableCollection}get waitOnExit(){return this._shellLaunchConfig.attachPersistentProcess?.waitOnExit||this._shellLaunchConfig.waitOnExit}set waitOnExit(e){this._shellLaunchConfig.waitOnExit=e}get isVisible(){return this._isVisible}get targetRef(){return this._targetRef}get target(){return this._targetRef.object}set target(e){this._targetRef.object=e,this._onDidChangeTarget.fire(e)}get instanceId(){return this._instanceId}get resource(){return this._resource}get cols(){return this._fixedCols!==void 0?this._fixedCols:this._dimensionsOverride&&this._dimensionsOverride.cols?this._dimensionsOverride.forceExactSize?this._dimensionsOverride.cols:Math.min(Math.max(this._dimensionsOverride.cols,2),this._cols):this._cols}get rows(){return this._fixedRows!==void 0?this._fixedRows:this._dimensionsOverride&&this._dimensionsOverride.rows?this._dimensionsOverride.forceExactSize?this._dimensionsOverride.rows:Math.min(Math.max(this._dimensionsOverride.rows,2),this._rows):this._rows}get isDisposed(){return this._store.isDisposed}get fixedCols(){return this._fixedCols}get fixedRows(){return this._fixedRows}get maxCols(){return this._cols}get maxRows(){return this._rows}get processId(){return this._processManager.shellProcessId}get processReady(){return this._processManager.ptyProcessReady}get hasChildProcesses(){return this.shellLaunchConfig.attachPersistentProcess?.hasChildProcesses||this._processManager.hasChildProcesses}get reconnectionProperties(){return this.shellLaunchConfig.attachPersistentProcess?.reconnectionProperties||this.shellLaunchConfig.reconnectionProperties}get areLinksReady(){return this._areLinksReady}get initialDataEvents(){return this._initialDataEvents}get exitCode(){return this._exitCode}get exitReason(){return this._exitReason}get hadFocusOnExit(){return this._hadFocusOnExit}get isTitleSetByProcess(){return!!this._messageTitleDisposable.value}get shellLaunchConfig(){return this._shellLaunchConfig}get shellType(){return this._shellType}get os(){return this._processManager.os}get hasRemoteAuthority(){return this._processManager.remoteAuthority!==void 0}get remoteAuthority(){return this._processManager.remoteAuthority}get hasFocus(){return Gr(this._wrapperElement)}get title(){return this._title}get titleSource(){return this._titleSource}get icon(){return this._getIcon()}get color(){return this._getColor()}get processName(){return this._processName}get sequence(){return this._sequence}get staticTitle(){return this._staticTitle}get progressState(){return this.xterm?.progressState}get workspaceFolder(){return this._workspaceFolder}get cwd(){return this._cwd}get initialCwd(){return this._initialCwd}get description(){if(this._description)return this._description;switch(this.shellLaunchConfig.attachPersistentProcess?.type||this.shellLaunchConfig.type){case"Task":return sr.typeTask;case"Local":return sr.typeLocal;default:return}}get userHome(){return this._userHome}get shellIntegrationNonce(){return this._processManager.shellIntegrationNonce}get injectedArgs(){return this._injectedArgs}getContribution(e){return this._contributions.get(e)}async _handleOnData(e){await this._processManager.write(e),this._onDidInputData.fire(e)}_getIcon(){return this._icon||(this._icon=this._processManager.processState>=2?mw().getIcon(this._configurationService.getValue("terminal.integrated.tabs.defaultIcon")):void 0),this._icon}_getColor(){if(this.shellLaunchConfig.color)return this.shellLaunchConfig.color;if(this.shellLaunchConfig?.attachPersistentProcess?.color)return this.shellLaunchConfig.attachPersistentProcess.color;this._processManager.processState>=2}_initDimensions(){if(!this._container){this._cols=80,this._rows=30;return}let e=Re(this._container).getComputedStyle(this._container),t=parseInt(e.width),o=parseInt(e.height);this._evaluateColsAndRows(t,o)}_evaluateColsAndRows(e,t){if(!e||!t)return this._setLastKnownColsAndRows(),null;let o=this._getDimension(e,t);if(!o)return this._setLastKnownColsAndRows(),null;let n=this.xterm?this.xterm.getFont():this._terminalConfigurationService.getFont(Re(this.domElement)),r=_5t(Re(this.domElement),n,o.width,o.height);return r?((this._cols!==r.cols||this._rows!==r.rows)&&(this._cols=r.cols,this._rows=r.rows,this._fireMaximumDimensionsChanged()),o.width):(this._setLastKnownColsAndRows(),null)}_setLastKnownColsAndRows(){dv._lastKnownGridDimensions&&(this._cols=dv._lastKnownGridDimensions.cols,this._rows=dv._lastKnownGridDimensions.rows)}_fireMaximumDimensionsChanged(){this._onMaximumDimensionsChanged.fire()}_getDimension(e,t){let o=this.xterm?this.xterm.getFont():this._terminalConfigurationService.getFont(Re(this.domElement));if(!o||!o.charWidth||!o.charHeight||!this.xterm?.raw.element)return;let n=Re(this.xterm.raw.element).getComputedStyle(this.xterm.raw.element),r=parseInt(n.paddingLeft)+parseInt(n.paddingRight)+14,s=parseInt(n.paddingTop)+parseInt(n.paddingBottom);return dv._lastKnownCanvasDimensions=new si(Math.min(4096,e-r),t-s+(this._hasScrollBar&&this._horizontalScrollbar?-5:0)),dv._lastKnownCanvasDimensions}get persistentProcessId(){return this._processManager.persistentProcessId}get shouldPersist(){return this._processManager.shouldPersist&&!this.shellLaunchConfig.isTransient&&(!this.reconnectionProperties||this._configurationService.getValue("task.reconnection")===!0)}static getXtermConstructor(e,t){let o=e.lookupKeybinding(Ow.A11yFocusAccessibleBuffer,t);return n8t||(n8t=dn.withAsyncBody(async n=>{let r=(await Pg("@xterm/xterm","lib/xterm.js")).Terminal;r.strings.promptLabel=d(14828,null),r.strings.tooMuchOutput=o?d(14829,null,o.getLabel()):d(14830,null),n(r)}),n8t)}async _createXterm(){let e=await dv.getXtermConstructor(this._keybindingService,this._contextKeyService);if(this.isDisposed)return;let t=this.shellLaunchConfig.executable===void 0||this.shellType===void 0||!$hn.includes(this.shellType),o=this._scopedInstantiationService.createInstance(QM,this._resource,e,{cols:this._cols,rows:this._rows,xtermColorProvider:this._scopedInstantiationService.createInstance(rbe,this._targetRef),capabilities:this.capabilities,shellIntegrationNonce:this._processManager.shellIntegrationNonce,disableShellIntegrationReporting:t},this.onDidExecuteText);this.xterm=o,this._resizeDebouncer=this._register(new hct(()=>this._isVisible,()=>o,async(s,l)=>{o.resize(s,l),await this._updatePtyDimensions(o.raw)},async s=>{o.resize(s,o.raw.rows),await this._updatePtyDimensions(o.raw)},async s=>{o.resize(o.raw.cols,s),await this._updatePtyDimensions(o.raw)})),this._register(Z(()=>this._resizeDebouncer=void 0)),this.updateAccessibilitySupport(),this._register(this.xterm.onDidRequestRunCommand(s=>{this.sendText(s.command.command,!s.noNewLine)})),this._register(this.xterm.onDidRequestRefreshDimensions(()=>{this._lastLayoutDimensions&&this.layout(this._lastLayoutDimensions)}));let n=this._shellLaunchConfig.initialText?new Promise(s=>this._writeInitialText(o,s)):void 0,r=this._register(new i8t(n));if(this._register(r.onLineData(s=>this._onLineData.fire(s))),this._lineDataEventAddon=r,tn(()=>{this._register(o.raw.onBell(()=>{(this._configurationService.getValue("terminal.integrated.enableBell")||this._configurationService.getValue("terminal.integrated.enableVisualBell"))&&this.statusList.add({id:"bell",severity:ft.Warning,icon:R.bell,tooltip:d(14812,null)},this._terminalConfigurationService.config.bellDuration),this._accessibilitySignalService.playSignal($o.terminalBell)}))},1e3,this._store),this._register(o.raw.onSelectionChange(()=>this._onDidChangeSelection.fire(this))),this._register(o.raw.buffer.onBufferChange(()=>this._refreshAltBufferContextKey())),this._register(this._processManager.onProcessData(s=>this._onProcessData(s))),this._register(o.raw.onData(async s=>{await this._handleOnData(s)})),this._register(o.raw.onBinary(s=>this._processManager.processBinary(s))),this._register(this._processManager.onProcessReady(async s=>{s?.windowsPty?.backend==="conpty"&&this._register(o.raw.parser.registerCsiHandler({final:"c"},l=>l.length===0||l.length===1&&l[0]===0?(this._handleOnData("\x1B[?61;4c"),!0):!1)),this._processManager.os&&r.setOperatingSystem(this._processManager.os),o.raw.options.windowsPty=s.windowsPty,o.raw.options.reflowCursorLine=s?.windowsPty?.backend==="conpty"&&!!this._terminalConfigurationService.config.windowsUseConptyDll})),this._register(this._processManager.onRestoreCommands(s=>this.xterm?.shellIntegration.deserialize(s))),this._register(this._viewDescriptorService.onDidChangeLocation(({views:s})=>{s.some(l=>l.id===Sc)&&o.refresh()})),this._register(o.onDidChangeProgress(()=>this._labelComputer?.refreshLabel(this))),this._register(U.runAndSubscribe(o.shellIntegration.onDidChangeSeenSequences,()=>{o.shellIntegration.seenSequences.size>0&&this._refreshShellIntegrationInfoStatus(this)})),!this.capabilities.has(0)){let s=o.raw.onKey(l=>{new gi(l.domEvent).equals(3)&&this._updateProcessCwd()});this._register(this.capabilities.onDidAddCwdDetectionCapability(()=>{s?.dispose(),s=void 0}))}return this.xterm?.shellIntegration&&this.capabilities.add(this.xterm.shellIntegration.capabilities),this._pathService.userHome().then(s=>{this._userHome=s.fsPath}),this._isVisible&&this._open(),o}_refreshShellIntegrationInfoStatus(e){if(!e.xterm)return;let t=e.capabilities.get(2)?.hasRichCommandDetection?d(14827,null):e.capabilities.has(2)?d(14822,null):e.usedShellIntegrationInjection?d(14823,null):d(14825,null),o=[];e.shellType&&o.push(`Shell type: \`${e.shellType}\``);let n=e.cwd;n&&o.push(`Current working directory: \`${n}\``);let r=Array.from(e.xterm.shellIntegration.seenSequences);r.length>0&&o.push(`Seen sequences: ${r.map(u=>`\`${u}\``).join(", ")}`);let s=e.capabilities.get(6)?.promptType;s&&o.push(`Prompt type: \`${s}\``);let l=e.capabilities.get(2)?.promptInputModel.getCombinedString();l!==void 0&&o.push(`Prompt input: \`\`\`${l}\`\`\``);let c=o.length>0?`

`+o.map(u=>`- ${u}`).join(`
`):"";e.statusList.add({id:"shell-integration-info",severity:ft.Info,tooltip:`${d(14821,null)}: ${t}`,detailedTooltip:`${d(14821,null)}: ${t}${c}`})}async runCommand(e,t,o,n){let r=this.capabilities.get(2),s=this._configurationService.getValue("terminal.integrated.shellIntegration.enabled")===!0,l=Y3t(this._configurationService,s,this.hasRemoteAuthority,this._processManager.processReadyTimestamp);if(!r||r.promptInputModel.state!==1){let c=new N;await Promise.race([new Promise(u=>{c.add(this.capabilities.onDidAddCommandDetectionCapability(p=>{r=p,r.promptInputModel.state===1?u():c.add(r.promptInputModel.onDidStartInput(()=>{u()}))}))}),Li(l)]),c.dispose()}o&&r&&(this.xterm?.shellIntegration.setNextCommandId(e,o),await this._processManager.setNextCommandId(e,o)),t&&(!r||r.promptInputModel.value.length>0)&&(await this.sendText("",!1),await Li(100)),await this.sendText(e,t,!t||n)}detachFromElement(){this._wrapperElement.remove(),this._container=void 0}attachToElement(e){this._container!==e&&(this._attachBarrier.isOpen()||this._attachBarrier.open(),this._container=e,this._container.appendChild(this._wrapperElement),this.xterm?.raw.element&&this.xterm.raw.open(this.xterm.raw.element),this.xterm?.refresh(),setTimeout(()=>{this._store.isDisposed||this._initDragAndDrop(e)},0))}_open(){if(!this.xterm||this.xterm.raw.element)return;if(!this._container||!this._container.isConnected)throw new Error("A container element needs to be set with `attachToElement` and be part of the DOM before calling `_open`");let e=document.createElement("div");e.classList.add("terminal-xterm-host"),this._wrapperElement.appendChild(e),this._container.appendChild(this._wrapperElement);let t=this.xterm;this._wrapperElement.xterm=t.raw;let o=t.attachToElement(e);for(let n of this._contributions.values())this.xterm?n.xtermOpen?.(this.xterm):this._xtermReadyPromise.then(r=>{r&&n.xtermOpen?.(r)});if(this._register(t.shellIntegration.onDidChangeStatus(()=>{this.hasFocus?this._setShellIntegrationContextKey():this._terminalShellIntegrationEnabledContextKey.reset()})),!t.raw.element||!t.raw.textarea)throw new Error("xterm elements not set after open");this._setAriaLabel(t.raw,this._instanceId,this._title),t.raw.attachCustomKeyEventHandler(n=>{if(this._isExiting)return!1;let r=new gi(n),s=this._keybindingService.softDispatch(r,r.target),l=s.kind===1&&this._terminalConfigurationService.config.allowChords&&n.key!=="Escape";return this._keybindingService.inChordMode||l||!this._terminalConfigurationService.config.sendKeybindingsToShell&&s.kind===2&&s.commandId&&(n.metaKey||this._skipTerminalCommands.some(c=>c===s.commandId))?(n.preventDefault(),!1):this._terminalConfigurationService.config.allowMnemonics&&!Ze&&n.altKey||x_.getTabFocusMode()&&n.key==="Tab"?!1:n.key==="Tab"&&n.shiftKey?(n.preventDefault(),!0):!(ei&&n.altKey&&n.key==="F4"&&!n.ctrlKey||!yg.clipboard.readText&&n.key==="v"&&n.ctrlKey)}),this._register(j(t.raw.element,"mousedown",()=>{let n=j(t.raw.element.ownerDocument,"mouseup",()=>{setTimeout(()=>this._refreshSelectionContextKey(),0),n.dispose()})})),this._register(j(t.raw.element,"touchstart",()=>{t.raw.focus()})),this._register(j(t.raw.element,"keyup",()=>{setTimeout(()=>this._refreshSelectionContextKey(),0)})),this._register(j(t.raw.textarea,"focus",()=>this._setFocus(!0))),this._register(j(t.raw.textarea,"blur",()=>this._setFocus(!1))),this._register(j(t.raw.textarea,"focusout",()=>this._setFocus(!1))),this._initDragAndDrop(this._container),this._widgetManager.attachToElement(o),this._lastLayoutDimensions&&this.layout(this._lastLayoutDimensions),this.updateConfig(),t.raw.options.disableStdin&&this._attachPressAnyKeyToCloseListener(t.raw)}_setFocus(e){e?(this._terminalFocusContextKey.set(!0),this._setShellIntegrationContextKey(),this._onDidFocus.fire(this)):(this.resetFocusContextKey(),this._onDidBlur.fire(this),this._refreshSelectionContextKey())}_setShellIntegrationContextKey(){this.xterm&&this._terminalShellIntegrationEnabledContextKey.set(this.xterm.shellIntegration.status===2)}resetFocusContextKey(){this._terminalFocusContextKey.reset(),this._terminalShellIntegrationEnabledContextKey.reset()}_initDragAndDrop(e){let t=new N,o=t.add(this._scopedInstantiationService.createInstance(gct,e));t.add(o.onDropTerminal(n=>this._onRequestAddInstanceToGroup.fire(n))),t.add(o.onDropFile(async n=>{this.focus(),await this.sendPath(n,!1)})),t.add(new Uh(e,o)),this._dndObserver.value=t}hasSelection(){return this.xterm?this.xterm.raw.hasSelection():!1}get selection(){return this.xterm&&this.hasSelection()?this.xterm.raw.getSelection():void 0}clearSelection(){this.xterm?.raw.clearSelection()}_refreshAltBufferContextKey(){this._terminalAltBufferActiveContextKey.set(!!(this.xterm&&this.xterm.raw.buffer.active===this.xterm.raw.buffer.alternate))}dispose(e){if(!(this.shellLaunchConfig.type==="Task"&&e===2&&this._exitCode!==0&&!this.shellLaunchConfig.waitOnExit)&&!this.isDisposed){this._logService.trace(`terminalInstance#dispose (instanceId: ${this.instanceId})`),Be(this._widgetManager),this.xterm?.raw.element&&(this._hadFocusOnExit=this.hasFocus),this._wrapperElement.xterm&&(this._wrapperElement.xterm=void 0),this._horizontalScrollbar&&(this._horizontalScrollbar.dispose(),this._horizontalScrollbar=void 0);try{this.xterm?.dispose()}catch(t){this._logService.error("Exception occurred during xterm disposal",t)}Ac&&(this.resetFocusContextKey(),this._terminalHasTextContextKey.reset(),this._onDidBlur.fire(this)),this._pressAnyKeyToCloseListener&&(this._pressAnyKeyToCloseListener.dispose(),this._pressAnyKeyToCloseListener=void 0),this._exitReason===void 0&&(this._exitReason=e??0),this._processManager.dispose(),this._onProcessExit(void 0),this._onDisposed.fire(this),super.dispose()}}async detachProcessAndDispose(e){await this._processManager.detachFromProcess(e===3),this.dispose(e)}focus(e){this._refreshAltBufferContextKey(),this.xterm&&(e||!Ki().getSelection()?.toString())&&(this.xterm.raw.focus(),this._onDidRequestFocus.fire())}async focusWhenReady(e){await this._xtermReadyPromise,await this._attachBarrier.wait(),this.focus(e)}async sendText(e,t,o){o&&this.xterm?.raw.modes.bracketedPasteMode&&(e=`\x1B[200~${e}\x1B[201~`),e=e.replace(/\r?\n/g,"\r"),t&&!e.endsWith("\r")&&(e+="\r"),this._logService.debug("sending data (vscode)",e),await this._processManager.write(e),this._onDidInputData.fire(e),this._onDidSendText.fire(e),this.xterm?.scrollToBottom(),t&&this._onDidExecuteText.fire()}async sendSignal(e){this._logService.debug("sending signal (vscode)",e),await this._processManager.sendSignal(e)}async sendPath(e,t){return this.sendText(await this.preparePathForShell(e),t)}async preparePathForShell(e){return await this.processReady,P_o(e,this.shellLaunchConfig.executable,this.title,this.shellType,this._processManager.backend,this._processManager.os)}async getUriLabelForShell(e){return await this.processReady,A_o(e,this._processManager.backend,this.shellType,this.os)}setVisible(e){let t=this._isVisible!==e;this._isVisible=e,this._wrapperElement.classList.toggle("active",e),e&&this.xterm&&(this._open(),this._resizeDebouncer?.flush(),this._resize()),t&&this._onDidChangeVisibility.fire(e)}scrollDownLine(){this.xterm?.scrollDownLine()}scrollDownPage(){this.xterm?.scrollDownPage()}scrollToBottom(){this.xterm?.scrollToBottom()}scrollUpLine(){this.xterm?.scrollUpLine()}scrollUpPage(){this.xterm?.scrollUpPage()}scrollToTop(){this.xterm?.scrollToTop()}clearBuffer(){this._processManager.clearBuffer(),this.xterm?.clearBuffer()}_refreshSelectionContextKey(){let e=!!this._viewsService.getActiveViewWithId(Sc),t=!1,o=this._editorService.activeEditor;o&&(t=o instanceof xf),this._terminalHasTextContextKey.set((e||t)&&this.hasSelection())}_createProcessManager(){let e;this.shellLaunchConfig.attachPersistentProcess?.environmentVariableCollections&&(e=jno(this.shellLaunchConfig.attachPersistentProcess.environmentVariableCollections));let t=this._scopedInstantiationService.createInstance(y1e,this._instanceId,this.shellLaunchConfig?.cwd,e,this.shellLaunchConfig.shellIntegrationNonce??this.shellLaunchConfig.attachPersistentProcess?.shellIntegrationNonce);return this.capabilities.add(t.capabilities),this._register(t.onProcessReady(async o=>{this._onProcessIdReady.fire(this),this._initialCwd=await this.getInitialCwd(),this._labelComputer||(this._labelComputer=this._register(this._scopedInstantiationService.createInstance(fct)),this._register(this._labelComputer.onDidChangeLabel(n=>{(this._title!==n.title||this._description!==n.description)&&(this._title=n.title,this._description=n.description,this._onTitleChanged.fire(this))}))),this._shellLaunchConfig.name&&!this._shellLaunchConfig.titleTemplate?this._setTitle(this._shellLaunchConfig.name,0):(setTimeout(()=>{this._xtermReadyPromise.then(n=>{n&&(this._messageTitleDisposable.value=n.raw.onTitleChange(r=>this._onTitleChange(r)))})}),this._shellLaunchConfig.titleTemplate&&this._shellLaunchConfig.name?this._setTitle(this._shellLaunchConfig.name,1):this._setTitle(this._shellLaunchConfig.executable,1))})),this._register(t.onProcessExit(o=>this._onProcessExit(o))),this._register(t.onDidChangeProperty(({type:o,value:n})=>{switch(o){case"cwd":this._cwd=n,this._labelComputer?.refreshLabel(this);break;case"initialCwd":this._initialCwd=n,this._cwd=this._initialCwd,this._setTitle(this.title,3),this._icon=this._shellLaunchConfig.attachPersistentProcess?.icon||this._shellLaunchConfig.icon,this._onIconChanged.fire({instance:this,userInitiated:!1});break;case"title":this._setTitle(n??"",1);break;case"overrideDimensions":this.setOverrideDimensions(n,!0);break;case"resolvedShellLaunchConfig":this._setResolvedShellLaunchConfig(n);break;case"shellType":this.setShellType(n);break;case"hasChildProcesses":this._onDidChangeHasChildProcesses.fire(n);break;case"usedShellIntegrationInjection":this._usedShellIntegrationInjection=!0;break;case"shellIntegrationInjectionFailureReason":this._shellIntegrationInjectionInfo=n;break}})),this._initialDataEventsListener.value=t.onProcessData(o=>this._initialDataEvents?.push(o.data)),this._register(t.onProcessReplayComplete(()=>this._onProcessReplayComplete.fire())),this._register(t.onEnvironmentVariableInfoChanged(o=>this._onEnvironmentVariableInfoChanged(o))),this._register(t.onPtyDisconnect(()=>{this.xterm&&(this.xterm.raw.options.disableStdin=!0),this.statusList.add({id:"disconnected",severity:ft.Error,icon:R.debugDisconnect,tooltip:d(14814,null)})})),this._register(t.onPtyReconnect(()=>{this.xterm&&(this.xterm.raw.options.disableStdin=!1),this.statusList.remove("disconnected")})),t}async _createProcess(){if(this.isDisposed)return;!await this._trust()&&!this.remoteAuthority&&!this._workbenchEnvironmentService.remoteAuthority?this._onProcessExit({message:d(14840,null)}):this._workspaceContextService.getWorkspace().folders.length===0&&this._cwd&&this._userHome&&Hp(this._cwd)!==Hp(this._userHome)&&this._onProcessExit({message:d(14839,null,this._cwd,this._userHome)}),this._container&&this._cols===0&&this._rows===0&&(this._initDimensions(),this.xterm?.resize(this._cols||80,this._rows||30));let t=this.shellLaunchConfig.icon;await this._processManager.createProcess(this._shellLaunchConfig,this._cols||80,this._rows||30).then(o=>{o&&(No(o,{message:!0})?this._onProcessExit(o):No(o,{injectedArgs:!0})&&(this._injectedArgs=o.injectedArgs))}),!this.isDisposed&&(t!==this.shellLaunchConfig.icon||this.shellLaunchConfig.color)&&(this._icon=this._shellLaunchConfig.attachPersistentProcess?.icon||this._shellLaunchConfig.icon,this._onIconChanged.fire({instance:this,userInitiated:!1}))}registerMarker(e){return this.xterm?.raw.registerMarker(e)}addBufferMarker(e){this.capabilities.get(4)?.addMark(e)}scrollToMark(e,t,o){this.xterm?.markTracker.scrollToClosestMarker(e,t,o)}async freePortKillProcess(e,t){await this._processManager?.freePortKillProcess(e),this.runCommand(t,!1)}_onProcessData(e){let t=[],o=e.data.matchAll(/(?<seq>\x1b\][16]33;(?:C|D(?:;\d+)?)\x07)/g),n=0;for(let s of o){if(s.groups?.seq===void 0)throw new li("seq must be defined");t.push(e.data.substring(n,s.index)),t.push(s.groups?.seq??""),n=s.index+s[0].length}let r=e.data.substring(n);for(let s=0;s<t.length;s++)this._writeProcessData(t[s]);e.trackCommit?e.writePromise=new Promise(s=>this._writeProcessData(r,s)):this._writeProcessData(r)}_writeProcessData(e,t){this._onWillData.fire(e);let o=++this._latestXtermWriteData;this.xterm?.raw.write(e,()=>{this._latestXtermParseData=o,this._processManager.acknowledgeDataEvent(e.length),t?.(),this._onData.fire(e)})}async _onProcessExit(e){if(this._isExiting)return;let t=jhn(e,this.shellLaunchConfig,this._processManager.processState,this._initialCwd);if(this._usedShellIntegrationInjection&&this._processManager.processState===4&&t?.code!==0){this._relaunchWithShellIntegrationDisabled(t?.message),this._onExit.fire(e);return}this._isExiting=!0,await this._flushXtermData(),this._exitCode=t?.code;let o=t?.message;this._logService.debug("Terminal process exit","instanceId",this.instanceId,"code",this._exitCode,"processState",this._processManager.processState);let n=this.waitOnExit;n&&this._processManager.processState!==5?this._xtermReadyPromise.then(r=>{if(r){switch(o&&r.raw.write(nE(o)),typeof n){case"string":r.raw.write(nE(n,{excludeLeadingNewLine:!0}));break;case"function":this.exitCode!==void 0&&r.raw.write(nE(n(this.exitCode),{excludeLeadingNewLine:!0}));break}r.raw.options.disableStdin=!0,r.raw.textarea&&this._attachPressAnyKeyToCloseListener(r.raw)}}):(o&&(this._processManager.processState===4||this._terminalConfigurationService.config.showExitAlert&&this.xterm?.lastInputEvent!==""?this._notificationService.notify({message:o,severity:ft.Error,actions:{primary:[this._scopedInstantiationService.createInstance(p1e)]}}):this._logService.warn(o)),this.dispose(2)),this._onExit.fire(e),this.isDisposed&&this._onExit.dispose()}_relaunchWithShellIntegrationDisabled(e){this._shellLaunchConfig.ignoreShellIntegration=!0,this.relaunch(),this.statusList.add({id:"shell-integration-attention-needed",severity:ft.Warning,icon:R.warning,tooltip:`${e} `+d(14818,null),hoverActions:[{commandId:"workbench.action.terminal.learnMore",label:d(14824,null),run:()=>{this._openerService.open("https://code.visualstudio.com/docs/editor/integrated-terminal#_shell-integration")}},{commandId:"workbench.action.openSettings",label:d(14826,null),run:()=>{this._commandService.executeCommand("workbench.action.openSettings","terminal.integrated.shellIntegration.enabled")}}]}),this._telemetryService.publicLog2("terminal/shellIntegrationFailureProcessExit")}_flushXtermData(){if(this._latestXtermWriteData===this._latestXtermParseData)return Promise.resolve();let e=0;return new Promise(t=>{let o=zI(Ki().window,()=>{(this._latestXtermWriteData===this._latestXtermParseData||++e===5)&&(o.dispose(),t())},20)})}_attachPressAnyKeyToCloseListener(e){e.textarea&&!this._pressAnyKeyToCloseListener&&(this._pressAnyKeyToCloseListener=j(e.textarea,"keypress",t=>{this._pressAnyKeyToCloseListener&&(this._pressAnyKeyToCloseListener.dispose(),this._pressAnyKeyToCloseListener=void 0,this.dispose(2),t.preventDefault())}))}_writeInitialText(e,t){if(!this._shellLaunchConfig.initialText){t?.();return}let o=Fe(this._shellLaunchConfig.initialText)?this._shellLaunchConfig.initialText:this._shellLaunchConfig.initialText?.text;Fe(this._shellLaunchConfig.initialText)||this._shellLaunchConfig.initialText.trailingNewLine?e.raw.writeln(o,t):e.raw.write(o,t)}async reuseTerminal(e,t=!1){this._pressAnyKeyToCloseListener?.dispose(),this._pressAnyKeyToCloseListener=void 0;let o=this.xterm;o&&(t||await new Promise(n=>o.raw.write(`
\x1B[G`,n)),e.initialText&&(this._shellLaunchConfig.initialText=e.initialText,await new Promise(n=>this._writeInitialText(o,n))),this._isExiting&&this._shellLaunchConfig.waitOnExit&&(o.raw.options.disableStdin=!1,this._isExiting=!1),t&&o.clearDecorations()),this.statusList.remove("relaunch-needed"),t||(e.initialText=" "),this._shellLaunchConfig=e,await this._processManager.relaunch(this._shellLaunchConfig,this._cols||80,this._rows||30,t).then(n=>{n&&(No(n,{message:!0})?this._onProcessExit(n):No(n,{injectedArgs:!0})&&(this._injectedArgs=n.injectedArgs))})}relaunch(){let e={...this._shellLaunchConfig};delete e.attachPersistentProcess,this.reuseTerminal(e,!0)}_onTitleChange(e){this.isTitleSetByProcess&&this._setTitle(e,2)}async _trust(){return this._configurationService.getValue("terminal.integrated.allowInUntrustedWorkspace")?(this._logService.info("Workspace trust check bypassed due to terminal.integrated.allowInUntrustedWorkspace"),!0):await this._workspaceTrustRequestService.requestWorkspaceTrust({message:d(14831,null)})===!0}async _updateProcessCwd(){if(!(this.isDisposed||this.shellLaunchConfig.customPtyImplementation))try{let e=await this._refreshProperty("cwd");if(!Fe(e))throw new Error(`cwd is not a string ${e}`)}catch(e){if(e instanceof Error&&e.message==="Cannot refresh property when process is not set")return;throw e}}updateConfig(){this._setCommandsToSkipShell(this._terminalConfigurationService.config.commandsToSkipShell),this._refreshEnvironmentVariableInfoWidgetState(this._processManager.environmentVariableInfo)}async _updateUnicodeVersion(){this._processManager.setUnicodeVersion(this._terminalConfigurationService.config.unicodeVersion)}updateAccessibilitySupport(){this.xterm.raw.options.screenReaderMode=this._accessibilityService.isScreenReaderOptimized()}_setCommandsToSkipShell(e){let t=e.filter(o=>o[0]==="-").map(o=>o.slice(1));this._skipTerminalCommands=cMt.filter(o=>!t.includes(o)).concat(e)}layout(e){if(this._lastLayoutDimensions=e,!(this.disableLayout||e.width<=0||e.height<=0||!this._evaluateColsAndRows(e.width,e.height))){this._resize(),this._containerReadyBarrier.isOpen()||this._containerReadyBarrier.open();for(let o of this._contributions.values())this.xterm?o.layout?.(this.xterm,e):this._xtermReadyPromise.then(n=>{n&&o.layout?.(n,e)})}}async _resize(e){if(!this.xterm)return;let t=this.cols,o=this.rows;if(this._isVisible&&this._layoutSettingsChanged){let n=this.xterm.getFont(),r=this._terminalConfigurationService.config;this.xterm.raw.options.letterSpacing=n.letterSpacing,this.xterm.raw.options.lineHeight=n.lineHeight,this.xterm.raw.options.fontSize=n.fontSize,this.xterm.raw.options.fontFamily=n.fontFamily,this.xterm.raw.options.fontWeight=r.fontWeight,this.xterm.raw.options.fontWeightBold=r.fontWeightBold,this._initDimensions(),t=this.cols,o=this.rows,this._layoutSettingsChanged=!1}isNaN(t)||isNaN(o)||((t!==this.xterm.raw.cols||o!==this.xterm.raw.rows)&&((this._fixedRows||this._fixedCols)&&await this._updateProperty("fixedDimensions",{cols:this._fixedCols,rows:this._fixedRows}),this._onDimensionsChanged.fire()),dv._lastKnownGridDimensions={cols:t,rows:o},this._resizeDebouncer.resize(t,o,e??!1))}async _updatePtyDimensions(e){let t=e.dimensions?.css.canvas.width,o=e.dimensions?.css.canvas.height,n=t?Math.round(t):void 0,r=o?Math.round(o):void 0;await this._processManager.setDimensions(e.cols,e.rows,void 0,n,r)}setShellType(e){this._shellType!==e&&(this._shellType=e,e===void 0?this._terminalShellTypeContextKey.reset():this._terminalShellTypeContextKey.set(e?.toString()),this._onDidChangeShellType.fire(e))}_setAriaLabel(e,t,o){let n=[];if(e&&e.textarea){o&&o.length>0?n.push(d(14836,null,t,o)):n.push(d(14835,null,t)),this._accessibilityService.isScreenReaderOptimized()||n.push(d(14833,null));let s=this._keybindingService.lookupKeybinding("editor.action.accessibilityHelp")?.getLabel();this._configurationService.getValue("accessibility.verbosity.terminal")&&s&&n.push(d(14832,null,s)),e.textarea.setAttribute("aria-label",n.join(`
`))}}_updateTitleProperties(e,t){if(!e)return this._processName;switch(t){case 1:if(this._processManager.os===1)e=$s.parse(e).name;else{let o=e.indexOf(" ");e.startsWith("/")?e=jo(e):o>-1&&(e=e.substring(0,o))}this._processName=e;break;case 0:this._staticTitle=e,this._messageTitleDisposable.value=void 0;break;case 2:this._sequence=e,this._processManager.os===1&&e.match(/^[a-zA-Z]:\\.+\.[a-zA-Z]{1,3}/)&&(this._sequence=$s.parse(e).name);break}return this._titleSource=t,e}setOverrideDimensions(e,t=!1){this._dimensionsOverride&&this._dimensionsOverride.forceExactSize&&!e&&this._rows===0&&this._cols===0&&(this._cols=this._dimensionsOverride.cols,this._rows=this._dimensionsOverride.rows),this._dimensionsOverride=e,t?this._resize(!0):this._resize()}async setFixedDimensions(){let e=await this._quickInputService.input({title:d(14819,null),placeHolder:"Enter a number of columns or leave empty for automatic width",validateInput:async o=>o.length>0&&!o.match(/^\d+$/)?{content:"Enter a number or leave empty size automatically",severity:ft.Error}:void 0});if(e===void 0)return;this._fixedCols=this._parseFixedDimension(e),this._labelComputer?.refreshLabel(this),this._terminalHasFixedWidth.set(!!this._fixedCols);let t=await this._quickInputService.input({title:d(14820,null),placeHolder:"Enter a number of rows or leave empty for automatic height",validateInput:async o=>o.length>0&&!o.match(/^\d+$/)?{content:"Enter a number or leave empty size automatically",severity:ft.Error}:void 0});t!==void 0&&(this._fixedRows=this._parseFixedDimension(t),this._labelComputer?.refreshLabel(this),await this._refreshScrollbar(),this._resize(),this.focus())}_parseFixedDimension(e){if(e==="")return;let t=parseInt(e);if(t<=0)throw new Error(`Could not parse dimension "${e}"`);return t}async toggleSizeToContentWidth(){if(this.xterm?.raw.buffer.active){if(this._hasScrollBar)this._terminalHasFixedWidth.set(!1),this._fixedCols=void 0,this._fixedRows=void 0,this._hasScrollBar=!1,this._initDimensions(),await this._resize();else{let e=this.xterm?this.xterm.getFont():this._terminalConfigurationService.getFont(Re(this.domElement)),t=Math.floor(4096/(e.charWidth??20)),o=Math.max(this.maxCols,Math.min(this.xterm.getLongestViewportWrappedLineLength(),t));o>this.xterm.raw.cols&&(this._fixedCols=o)}await this._refreshScrollbar(),this._labelComputer?.refreshLabel(this),this.focus()}}_refreshScrollbar(){return this._fixedCols||this._fixedRows?this._addScrollbar():this._removeScrollbar()}async _addScrollbar(){let e=(this.xterm?this.xterm.getFont():this._terminalConfigurationService.getFont(Re(this.domElement))).charWidth;if(!(!this.xterm?.raw.element||!this._container||!e||!this._fixedCols)&&(this._wrapperElement.classList.add("fixed-dims"),this._hasScrollBar=!0,this._initDimensions(),await this._resize(),this._terminalHasFixedWidth.set(!0),this._horizontalScrollbar||(this._horizontalScrollbar=this._register(new ms(this._wrapperElement,{vertical:2,horizontal:1,useShadows:!1,scrollYToX:!1,consumeMouseWheelIfScrollbarIsNeeded:!1})),this._container.appendChild(this._horizontalScrollbar.getDomNode())),this._horizontalScrollbar.setScrollDimensions({width:this.xterm.raw.element.clientWidth,scrollWidth:this._fixedCols*e+40}),this._horizontalScrollbar.getDomNode().style.paddingBottom="16px",ei))for(let t=this.xterm.raw.buffer.active.viewportY;t<this.xterm.raw.buffer.active.length;t++){let o=this.xterm.raw.buffer.active.getLine(t);o._line.isWrapped=!1}}async _removeScrollbar(){!this._container||!this._horizontalScrollbar||(this._horizontalScrollbar.getDomNode().remove(),this._horizontalScrollbar.dispose(),this._horizontalScrollbar=void 0,this._wrapperElement.remove(),this._wrapperElement.classList.remove("fixed-dims"),this._container.appendChild(this._wrapperElement))}_setResolvedShellLaunchConfig(e){this._shellLaunchConfig.args=e.args,this._shellLaunchConfig.cwd=e.cwd,this._shellLaunchConfig.executable=e.executable,this._shellLaunchConfig.env=e.env}_onEnvironmentVariableInfoChanged(e){e.requiresAction&&this.xterm?.raw.textarea?.setAttribute("aria-label",d(14834,null,this._instanceId)),this._refreshEnvironmentVariableInfoWidgetState(e)}async _refreshEnvironmentVariableInfoWidgetState(e){if(!e){this.statusList.remove("relaunch-needed"),this.statusList.remove("env-var-info-changes-active");return}if(e.requiresAction&&this._terminalConfigurationService.config.environmentChangesRelaunch&&!this._processManager.hasWrittenData&&(!this._shellLaunchConfig.isFeatureTerminal||this.reconnectionProperties&&this._configurationService.getValue("task.reconnection")===!0)&&!this._shellLaunchConfig.customPtyImplementation&&!this._shellLaunchConfig.isExtensionOwnedTerminal&&!this._shellLaunchConfig.attachPersistentProcess&&!(this._processManager.remoteAuthority&&await this._processManager.getBackendOS()===1&&this._processManager.processTraits?.windowsPty?.buildNumber&&this._processManager.processTraits.windowsPty.buildNumber>=18309)){this.relaunch();return}let t=L6(this.shellLaunchConfig.cwd,this._workspaceContextService,this._historyService);this.statusList.add(e.getStatus({workspaceFolder:t}))}async getInitialCwd(){return this._initialCwd||(this._initialCwd=this._processManager.initialCwd),this._initialCwd}async getSpeculativeCwd(){return this.capabilities.has(0)?this.capabilities.get(0).getCwd():this.capabilities.has(1)?this.capabilities.get(1).getCwd():this._processManager.initialCwd}async getCwdResource(){let e=this.capabilities.get(0)?.getCwd();if(!e)return;let t;if(this.remoteAuthority?t=await this._pathService.fileURI(e):t=A.file(e),await this._fileService.exists(t))return t}async _refreshProperty(e){return await this.processReady,this._processManager.refreshProperty(e)}async _updateProperty(e,t){return this._processManager.updateProperty(e,t)}async rename(e,t){this._setTitle(e,t??0)}_setTitle(e,t){if((this._shellLaunchConfig?.type==="Task"||this._titleSource===0)&&t===1)return;let o=!e;e=this._updateTitleProperties(e,t);let n=e!==this._title;this._title=e,this._labelComputer?.refreshLabel(this,o),this._setAriaLabel(this.xterm?.raw,this._instanceId,this._title),n&&this._onTitleChanged.fire(this)}async changeIcon(e){if(e)return this._icon=e,this._onIconChanged.fire({instance:this,userInitiated:!0}),e;let t=this._scopedInstantiationService.createInstance(C1e),o=await t.pickIcons();if(t.dispose(),!!o)return this._icon=o,this._onIconChanged.fire({instance:this,userInitiated:!0}),o}async changeColor(e,t){if(e)return this.shellLaunchConfig.color=e,this._onIconChanged.fire({instance:this,userInitiated:!0}),e;if(t){this.shellLaunchConfig.color="",this._onIconChanged.fire({instance:this,userInitiated:!0});return}if(!this._getIcon())return;let n=this._themeService.getColorTheme(),r=pMt(n),s=jTe(n),l=[];for(let g of r){let f=by(g);l.push({label:`$(${R.circleFilled.id}) ${g.replace("terminal.ansi","")}`,id:g,description:g,iconClasses:[f]})}l.push({type:"separator"});let c={label:"Reset to default"};l.push(c);let u=[],p=this._quickInputService.createQuickPick({useSeparators:!0});u.push(p),p.items=l,p.matchOnDescription=!0,p.placeholder=d(14813,null),p.show();let h=await new Promise(g=>{u.push(p.onDidHide(()=>g(void 0))),u.push(p.onDidAccept(()=>g(p.selectedItems[0])))});return Be(u),h&&(this.shellLaunchConfig.color=h.id,this._onIconChanged.fire({instance:this,userInitiated:!0})),p.hide(),s.dispose(),h?.id}forceScrollbarVisibility(){this._wrapperElement.classList.add("force-scrollbar")}resetScrollbarVisibility(){this._wrapperElement.classList.remove("force-scrollbar")}setParentContextKeyService(e){this._scopedContextKeyService.updateParent(e)}async handleMouseEvent(e,t){if(Do(e.target)&&(e.target.classList.contains("scrollbar")||e.target.classList.contains("slider")))return{cancelContextMenu:!0};for(let o of this._contributions.values())if((await o.handleMouseEvent?.(e))?.handled)return{cancelContextMenu:!0};if(e.which===2){switch(this._terminalConfigurationService.config.middleClickBehavior){default:this.focus();break}return}if(e.which===3){if(e.shiftKey){M6(Ki(),e,this,t,this._contextMenuService);return}if(this._terminalConfigurationService.config.rightClickBehavior==="nothing")return e.shiftKey?void 0:{cancelContextMenu:!0}}}};I([Zd(50)],dv.prototype,"_fireMaximumDimensionsChanged",1),I([Zd(500)],dv.prototype,"_refreshShellIntegrationInfoStatus",1),I([Zd(1e3)],dv.prototype,"relaunch",1),I([Zd(2e3)],dv.prototype,"_updateProcessCwd",1),dv=I([m(2,X),m(3,Xe),m(4,F),m(5,Uu),m(6,Ag),m(7,An),m(8,fe),m(9,_e),m(10,Ne),m(11,Go),m(12,$t),m(13,Le),m(14,B),m(15,ca),m(16,ce),m(17,Oi),m(18,tt),m(19,Ue),m(20,At),m(21,Pe),m(22,ee),m(23,Vu),m(24,na),m(25,Te),m(26,Je),m(27,ge),m(28,lr),m(29,Bi)],dv);var gct=class extends x{constructor(e,t,o){super();this._container=e;this._layoutService=t;this._viewDescriptorService=o;this._onDropFile=this._register(new E);this._onDropTerminal=this._register(new E);this._register(Z(()=>this._clearDropOverlay()))}get onDropFile(){return this._onDropFile.event}get onDropTerminal(){return this._onDropTerminal.event}_clearDropOverlay(){this._dropOverlay?.remove(),this._dropOverlay=void 0}onDragEnter(e){if(Ip(e,yl.FILES,yl.RESOURCES,"Terminals",hc.FILES)){if(this._dropOverlay||(this._dropOverlay=document.createElement("div"),this._dropOverlay.classList.add("terminal-drop-overlay")),Ip(e,"Terminals")){let t=this._getDropSide(e);this._dropOverlay.classList.toggle("drop-before",t==="before"),this._dropOverlay.classList.toggle("drop-after",t==="after")}this._dropOverlay.parentElement||this._container.appendChild(this._dropOverlay)}}onDragLeave(e){this._clearDropOverlay()}onDragEnd(e){this._clearDropOverlay()}onDragOver(e){if(!(!e.dataTransfer||!this._dropOverlay)){if(Ip(e,"Terminals")){let t=this._getDropSide(e);this._dropOverlay.classList.toggle("drop-before",t==="before"),this._dropOverlay.classList.toggle("drop-after",t==="after")}this._dropOverlay.style.opacity="1"}}async onDrop(e){if(this._clearDropOverlay(),!e.dataTransfer)return;let t=cHe(e);if(t){for(let s of t){let l=this._getDropSide(e);this._onDropTerminal.fire({uri:s,side:l})}return}let o,n=e.dataTransfer.getData(yl.RESOURCES);n&&(o=A.parse(JSON.parse(n)[0]));let r=e.dataTransfer.getData(hc.FILES);!o&&r&&(o=A.file(JSON.parse(r)[0])),!o&&e.dataTransfer.files.length>0&&L_(e.dataTransfer.files[0])&&(o=A.file(L_(e.dataTransfer.files[0]))),o&&this._onDropFile.fire(o)}_getDropSide(e){let t=this._container;if(!t)return"after";let o=t.getBoundingClientRect();return this._getViewOrientation()===1?e.clientX-o.left<o.width/2?"before":"after":e.clientY-o.top<o.height/2?"before":"after"}_getViewOrientation(){let e=this._layoutService.getPanelPosition();return this._viewDescriptorService.getViewLocationById(Sc)===1&&xh(e)?1:0}};gct=I([m(1,yi),m(2,Bi)],gct);var fct=class extends x{constructor(e,t,o){super();this._fileService=e;this._terminalConfigurationService=t;this._workspaceContextService=o;this._title="";this._description="";this._onDidChangeLabel=this._register(new E);this.onDidChangeLabel=this._onDidChangeLabel.event}get title(){return this._title}get description(){return this._description}refreshLabel(e,t){let o=e.shellLaunchConfig.titleTemplate??this._terminalConfigurationService.config.tabs.title;this._title=this.computeLabel(e,o,"title",t),this._description=this.computeLabel(e,this._terminalConfigurationService.config.tabs.description,"description"),(this._title!==e.title||this._description!==e.description||t)&&this._onDidChangeLabel.fire({title:this._title,description:this._description})}computeLabel(e,t,o,n){let r=e.shellLaunchConfig.attachPersistentProcess?.type||e.shellLaunchConfig.type,s=e.capabilities.get(2),l=s?.promptInputModel,c=r==="Task"?"":" $(loading~spin)",u={cwd:e.cwd||e.initialCwd||"",cwdFolder:"",workspaceFolderName:e.workspaceFolder?.name,workspaceFolder:e.workspaceFolder?jo(e.workspaceFolder.uri.fsPath):void 0,local:r==="Local"?sr.typeLocal:void 0,process:e.processName,sequence:e.sequence,task:r==="Task"?sr.typeTask:void 0,fixedDimensions:e.fixedCols?e.fixedRows?`\u2194${e.fixedCols} \u2195${e.fixedRows}`:`\u2194${e.fixedCols}`:e.fixedRows?`\u2195${e.fixedRows}`:"",separator:{label:this._terminalConfigurationService.config.tabs.separator},shellType:e.shellType,shellCommand:s?.executingCommand&&s.executingCommandConfidence==="high"&&l?l.value+c:void 0,shellPromptInput:s?.executingCommand&&l?l.getCombinedString(!0)+c:l?.getCombinedString(!0),progress:this._getProgressStateString(e.progressState)};if(u.workspaceFolderName=e.workspaceFolder?.name??u.workspaceFolder,t=t.trim(),!t)return o==="title"&&e.processName||"";if(!n&&e.staticTitle&&o==="title")return e.staticTitle.replace(/[\n\r\t]/g,"")||u.process?.replace(/[\n\r\t]/g,"")||"";let p=e.capabilities.has(0)||e.capabilities.has(1),g=this._workspaceContextService.getWorkspace().folders.length>1;if(u.cwd&&p&&(!e.shellLaunchConfig.isFeatureTerminal||o==="title")){let v=A.from({scheme:e.workspaceFolder?.uri.scheme||Q.file,path:e.cwd?cP(e.cwd):void 0}),b=!1;if(g)b=!0;else if(e.workspaceFolder?.uri){let S=this._fileService.hasCapability(e.workspaceFolder.uri,1024);b=v.fsPath.localeCompare(e.workspaceFolder.uri.fsPath,void 0,{sensitivity:S?"case":"base"})!==0}b&&(u.cwdFolder=jo(u.cwd))}let f=wbt(t,u).replace(/[\n\r\t]/g,"").trim();return f===""&&o==="title"?e.processName||"":f}_getProgressStateString(e){if(!e)return"";switch(e.state){case 0:return"";case 1:return`${Math.round(e.value)}%`;case 2:return"$(error)";case 3:return"$(loading~spin)";case 4:return"$(alert)"}}};fct=I([m(0,fe),m(1,Uu),m(2,Pe)],fct);function jhn(a,i,e,t){if(a===void 0||a===0)return{code:a,message:void 0};let o=Yo(a)?a:a.code,n;switch(typeof a){case"number":{let r;i.executable&&(r=i.executable,Fe(i.args)?r+=` ${i.args}`:i.args&&i.args.length&&(r+=i.args.map(s=>` '${s}'`).join())),e===4?r?n=d(14816,null,r,o):n=d(14817,null,o):r?n=d(14837,null,r,o):n=d(14838,null,o);break}case"object":{if(a.message.toString().includes("Could not find pty with id"))break;let r=a.message,s=a.message.match(/.*error code:\s*(\d+).*$/);if(s)switch(s.length>1?parseInt(s[1]):void 0){case 5:r=`Access was denied to the path containing your executable "${i.executable}". Manage and change your permissions to get this to work`;break;case 267:r=`Invalid starting directory "${t}", review your terminal.integrated.cwd setting`;break;case 1260:r="Windows cannot open this program because it has been prevented by a software restriction policy. For more information, open Event Viewer or contact your system Administrator";break}n=d(14815,null,r);break}}return{code:o,message:n}}var rbe=class{constructor(i,e){this._target=i;this._viewDescriptorService=e}getBackgroundColor(i){let e=i.getColor(RJ);return e||(this._target.object===2?i.getColor(Ho):this._viewDescriptorService.getViewLocationById(Sc)===1?i.getColor(lI):i.getColor(bf))}};rbe=I([m(1,Bi)],rbe);function Qhn(a,i){let e=jo(i),t=new Map([["julia",/^julia$/],["node",/^node$/],["nu",/^nu$/],["pwsh",/^pwsh(-preview)?|powershell$/],["python",/^py(?:thon)?$/],["xonsh",/^xonsh/]]);for(let[o,n]of t)if(e.match(n))return o;if(a===1){let o=new Map([["cmd",/^cmd$/],["gitbash",/^bash$/],["wsl",/^wsl$/]]);for(let[n,r]of o)if(e.match(r))return n}else{let o=["bash","csh","fish","ksh","sh","zsh"];for(let n of o)if(e===n)return n}}var sbe=class extends x{constructor(e,t,o){super();this._instantiationService=e;this._contextKeyService=t;this._backendRegistration=new Map;this._onDidCreateInstance=this._register(new E);this._onDidRegisterBackend=this._register(new E);this._terminalShellTypeContextKey=dt.shellType.bindTo(this._contextKeyService);for(let n of[void 0,o.remoteAuthority]){let{promise:r,resolve:s}=WI();this._backendRegistration.set(n,{promise:r,resolve:s})}}get onDidCreateInstance(){return this._onDidCreateInstance.event}get onDidRegisterBackend(){return this._onDidRegisterBackend.event}createInstance(e,t){let o=this.convertProfileToShellLaunchConfig(e),n=this._instantiationService.createInstance(dv,this._terminalShellTypeContextKey,o);return n.target=t,this._onDidCreateInstance.fire(n),n}convertProfileToShellLaunchConfig(e,t){if(e&&No(e,{profileName:!0})){let o=e;return o.path?{executable:o.path,args:o.args,env:o.env,icon:o.icon,color:o.color,name:o.overrideName?o.profileName:void 0,cwd:t}:e}return e?(t&&(e.cwd=t),e):{}}async getBackend(e){let t=ne.as(NB.Backend).getTerminalBackend(e);return t||(await this._backendRegistration.get(e)?.promise,t=ne.as(NB.Backend).getTerminalBackend(e)),t}getRegisteredBackends(){return ne.as(NB.Backend).backends.values()}didRegisterBackend(e){this._backendRegistration.get(e.remoteAuthority)?.resolve(),this._onDidRegisterBackend.fire(e)}};sbe=I([m(0,F),m(1,X),m(2,At)],sbe);Ee(Nm,sbe,1);var abe=class extends x{static{this.ID="terminalMain"}constructor(i,e,t,o,n,r,s,l,c){super(),this._init(i,e,t,o,n,r,s,l,c)}async _init(i,e,t,o,n,r,s,l,c){this._register(e.onDidCreateTerminal(async u=>{let p=await r.createTerminal({config:u,location:1,skipContributedProfileCheck:!0});r.setActiveInstance(p),await r.revealActiveTerminal()})),await n.when(3),this._register(i.registerEditor(`${Q.vscodeTerminal}:/**`,{id:JK,label:sr.terminal,priority:"exclusive"},{canSupportResource:u=>u.scheme===Q.vscodeTerminal,singlePerResource:!0},{createEditorInput:async({resource:u,options:p})=>{let h=r.getInstanceFromResource(u);if(h)l.getGroupForInstance(h)?.removeInstance(h);else{let v=Rq(u);if(!v.instanceId)throw new Error("Terminal identifier without instanceId");let b=r.getPrimaryBackend();if(!b)throw new Error("No terminal primary backend");let S=await b.requestDetachInstance(v.workspaceId,v.instanceId);if(!S)throw new Error("No terminal persistent process to attach");h=c.createInstance({attachPersistentProcess:S},2)}let g=s.resolveResource(h);return{editor:s.getInputFromResource(g),options:{...p,pinned:!0,forceReload:!0,override:JK}}}})),this._register(o.registerFormatter({scheme:Q.vscodeTerminal,formatting:{label:"${path}",separator:""}}))}};abe=I([m(0,Ka),m(1,hxi),m(2,At),m(3,rt),m(4,ji),m(5,nn),m(6,Fv),m(7,lc),m(8,Nm)],abe);var Yhn=Rn.registerExtensionPoint(Yio),x1e=le("terminalContributionsService"),r8t=class{constructor(){this._terminalProfiles=[];this._terminalCompletionProviders=[];this._onDidChangeTerminalCompletionProviders=new E;this.onDidChangeTerminalCompletionProviders=this._onDidChangeTerminalCompletionProviders.event;Yhn.setHandler(i=>{this._terminalProfiles=i.map(e=>e.value?.profiles?.filter(t=>Xhn(t)).map(t=>({...t,extensionIdentifier:e.description.identifier.value}))||[]).flat(),this._terminalCompletionProviders=i.map(e=>Ua(e.description,"terminalCompletionProvider")?e.value?.completionProviders?.map(t=>({...t,extensionIdentifier:e.description.identifier.value}))||[]:[]).flat(),this._onDidChangeTerminalCompletionProviders.fire()})}get terminalProfiles(){return this._terminalProfiles}get terminalCompletionProviders(){return this._terminalCompletionProviders}};function Xhn(a){function i(e){return xi(e)&&"light"in e&&A.isUri(e.light)&&"dark"in e&&A.isUri(e.dark)}return!a.icon||Fe(a.icon)||A.isUri(a.icon)||i(a.icon)}var lbe=class extends x{constructor(e,t,o,n,r,s,l){super();this._contextKeyService=e;this._configurationService=t;this._terminalContributionService=o;this._extensionService=n;this._remoteAgentService=r;this._environmentService=s;this._terminalInstanceService=l;this._contributedProfiles=[];this._platformConfigJustRefreshed=!1;this._refreshTerminalActionsDisposable=this._register(new me);this._profileProviders=new Map;this._onDidChangeAvailableProfiles=this._register(new E);this._register(this._extensionService.onDidChangeExtensions(()=>this.refreshAvailableProfiles())),this._webExtensionContributedProfileContextKey=dt.webExtensionContributedProfile.bindTo(this._contextKeyService),this._updateWebContextKey(),this._profilesReadyPromise=this._remoteAgentService.getEnvironment().then(()=>(this._profilesReadyBarrier=new B$(2e4),this._profilesReadyBarrier.wait().then(()=>{}))),this.refreshAvailableProfiles(),this._setupConfigListener()}get onDidChangeAvailableProfiles(){return this._onDidChangeAvailableProfiles.event}get profilesReady(){return this._profilesReadyPromise}get availableProfiles(){return this._platformConfigJustRefreshed||this.refreshAvailableProfiles(),this._availableProfiles||[]}get contributedProfiles(){let e=this._availableProfiles?.map(t=>t.profileName)||[];return this._contributedProfiles?.filter(t=>!e.includes(t.title))||[]}async _setupConfigListener(){let e=await this.getPlatformKey();this._register(this._configurationService.onDidChangeConfiguration(async t=>{(t.affectsConfiguration("terminal.integrated.automationProfile."+e)||t.affectsConfiguration("terminal.integrated.defaultProfile."+e)||t.affectsConfiguration("terminal.integrated.profiles."+e)||t.affectsConfiguration("terminal.integrated.useWslProfiles"))&&(t.source!==7?(this.refreshAvailableProfiles(),this._platformConfigJustRefreshed=!1):this._platformConfigJustRefreshed=!0)}))}getDefaultProfileName(){return this._defaultProfileName}getDefaultProfile(e){let t;if(e){if(t=this._configurationService.getValue(`terminal.integrated.defaultProfile.${this._getOsKey(e)}`),!t||!Fe(t))return}else t=this._defaultProfileName;if(t)return this.availableProfiles.find(o=>o.profileName===t&&!o.isAutoDetected)}_getOsKey(e){switch(e){case 3:return"linux";case 2:return"osx";case 1:return"windows"}}refreshAvailableProfiles(){this._refreshAvailableProfilesNow()}async _refreshAvailableProfilesNow(){let e=await this._detectProfiles(!0),t=!$i(e,this._availableProfiles,Zhn),o=await this._updateContributedProfiles(),n=await this.getPlatformKey(),r=this._configurationService.getValue(`terminal.integrated.automationProfile.${n}`),s=!eo(r,this._automationProfile);(t||o||s)&&(this._availableProfiles=e,this._automationProfile=r,this._onDidChangeAvailableProfiles.fire(this._availableProfiles),this._profilesReadyBarrier.open(),this._updateWebContextKey(),await this._refreshPlatformConfig(this._availableProfiles))}async _updateContributedProfiles(){let e=await this.getPlatformKey(),t=[],o=this._configurationService.getValue("terminal.integrated.profiles."+e);for(let[s,l]of Object.entries(o))l===null&&t.push(s);let n=Array.from(this._terminalContributionService.terminalProfiles.filter(s=>!t.includes(s.title))),r=!$i(n,this._contributedProfiles,egn);return this._contributedProfiles=n,r}getContributedProfileProvider(e,t){return this._profileProviders.get(e)?.get(t)}async _detectProfiles(e){let t=await this._terminalInstanceService.getBackend(this._environmentService.remoteAuthority);if(!t)return this._availableProfiles||[];let o=await this.getPlatformKey();return this._defaultProfileName=this._configurationService.getValue(`terminal.integrated.defaultProfile.${o}`)??void 0,t.getProfiles(this._configurationService.getValue(`terminal.integrated.profiles.${o}`),this._defaultProfileName,e)}_updateWebContextKey(){this._webExtensionContributedProfileContextKey.set(Wt&&this._contributedProfiles.length>0)}async _refreshPlatformConfig(e){let t=await this._remoteAgentService.getEnvironment();Kgi({os:t?.os||Po,profiles:e},this._contributedProfiles),this._refreshTerminalActionsDisposable.value=HVi(e)}async getPlatformKey(){let e=await this._remoteAgentService.getEnvironment();return e?e.os===1?"windows":e.os===2?"osx":"linux":ei?"windows":Ze?"osx":"linux"}registerTerminalProfileProvider(e,t,o){let n=this._profileProviders.get(e);return n||(n=new Map,this._profileProviders.set(e,n)),n.set(t,o),Z(()=>this._profileProviders.delete(t))}async registerContributedProfile(e){let t=await this.getPlatformKey(),o=await this._configurationService.getValue(`terminal.integrated.profiles.${t}`);if(typeof o=="object"){let n={extensionIdentifier:e.extensionIdentifier,icon:e.options.icon,id:e.id,title:e.title,color:e.options.color,titleTemplate:e.titleTemplate};o[e.title]=n}await this._configurationService.updateValue(`terminal.integrated.profiles.${t}`,o,2)}async getContributedDefaultProfile(e){if(e&&!e.extHostTerminalId&&!No(e,{executable:!0})){let t=await this.getPlatformKey(),o=this._configurationService.getValue(`terminal.integrated.defaultProfile.${t}`);return this.contributedProfiles.find(r=>r.title===o)}}};I([_P(2e3)],lbe.prototype,"refreshAvailableProfiles",1),lbe=I([m(0,X),m(1,B),m(2,x1e),m(3,lt),m(4,bo),m(5,At),m(6,Nm)],lbe);function Zhn(a,i){return a.profileName===i.profileName&&_io(a.args,i.args)&&a.color===i.color&&Dio(a.icon,i.icon)&&a.isAutoDetected===i.isAutoDetected&&a.isDefault===i.isDefault&&a.overrideName===i.overrideName&&a.path===i.path}function egn(a,i){return a.extensionIdentifier===i.extensionIdentifier&&a.color===i.color&&a.icon===i.icon&&a.id===i.id&&a.title===i.title&&a.titleTemplate===i.titleTemplate}var k1e=class{constructor(i,e,t,o,n,r){this._terminalProfileService=i;this._terminalProfileResolverService=e;this._configurationService=t;this._quickInputService=o;this._themeService=n;this._notificationService=r}async showAndGetResult(i){let e=await this._terminalProfileService.getPlatformKey(),t="terminal.integrated.profiles."+e,o=await this._createAndShow(i),n=`terminal.integrated.defaultProfile.${e}`;if(o){if(i==="setDefault"){if(No(o.profile,{id:!0}))return await this._configurationService.updateValue(n,o.profile.title,2),{config:{extensionIdentifier:o.profile.extensionIdentifier,id:o.profile.id,title:o.profile.title,options:{color:o.profile.color,icon:o.profile.icon}},keyMods:o.keyMods};if(No(o.profile,{profileName:!0})){let r=await this._configurationService.getValue(t);if(typeof r=="object"){let s={path:o.profile.path};o.profile.args&&(s.args=o.profile.args),r[o.profile.profileName]=this._createNewProfileConfig(o.profile),await this._configurationService.updateValue(t,r,2)}}await this._configurationService.updateValue(n,o.profileName,2)}else if(i==="createInstance")if(No(o.profile,{id:!0})){let r={extensionIdentifier:o.profile.extensionIdentifier,id:o.profile.id,title:o.profile.title,options:{icon:o.profile.icon,color:o.profile.color}};return o.profile.titleTemplate!==void 0&&(r.titleTemplate=o.profile.titleTemplate),{config:r,keyMods:o.keyMods}}else return{config:o.profile,keyMods:o.keyMods};return No(o.profile,{profileName:!0})?o.profile.profileName:o.profile.title}}async _createAndShow(i){let e=await this._terminalProfileService.getPlatformKey(),t=this._terminalProfileService.availableProfiles,o="terminal.integrated.profiles."+e,n=this._terminalProfileService.getDefaultProfileName(),r,s={placeHolder:i==="createInstance"?d(14878,null):d(14877,null),onDidTriggerItemButton:async f=>{if(!await this._isProfileSafe(f.item.profile)||No(f.item.profile,{id:!0}))return;let v=this._configurationService.getValue("terminal.integrated.profiles."+e),b=v?Object.keys(v):[],S=await this._quickInputService.input({prompt:d(14875,null),value:f.item.profile.profileName,validateInput:async w=>{if(b.includes(w))return d(14879,null)}});if(!S)return;let y={...v,[S]:this._createNewProfileConfig(f.item.profile)};await this._configurationService.updateValue(o,y,2)},onKeyMods:f=>r=f},l=[],c=t.filter(f=>!f.isAutoDetected),u=t.filter(f=>f.isAutoDetected);c.length>0&&(l.push({type:"separator",label:d(14880,null)}),l.push(...this._sortProfileQuickPickItems(c.map(f=>this._createProfileQuickPickItem(f)),n))),l.push({type:"separator",label:d(14876,null)});let p=[];for(let f of this._terminalProfileService.contributedProfiles){let v;Fe(f.icon)&&(f.icon.startsWith("$(")?v=q.fromString(f.icon):v=q.fromId(f.icon)),(!v||!mw().getIcon(v.id))&&(v=this._terminalProfileResolverService.getDefaultIcon());let b=SD(f,this._themeService.getColorTheme().type,!0),S=by(f),y=[];b&&y.push(...b),S&&y.push(S),p.push({label:`$(${v.id}) ${f.title}`,profile:{extensionIdentifier:f.extensionIdentifier,title:f.title,icon:f.icon,id:f.id,color:f.color,titleTemplate:f.titleTemplate},profileName:f.title,iconClasses:y})}p.length>0&&l.push(...this._sortProfileQuickPickItems(p,n)),u.length>0&&(l.push({type:"separator",label:d(14881,null)}),l.push(...this._sortProfileQuickPickItems(u.map(f=>this._createProfileQuickPickItem(f)),n)));let h=jTe(this._themeService.getColorTheme()),g=await this._quickInputService.pick(l,s);if(h.dispose(),!!g&&await this._isProfileSafe(g.profile))return r&&(g.keyMods=r),g}_createNewProfileConfig(i){let e={path:i.path};return i.args&&(e.args=i.args),i.env&&(e.env=i.env),e}async _isProfileSafe(i){let e=No(i,{profileName:!0})&&i.isUnsafePath,t=No(i,{profileName:!0})&&i.requiresUnsafePath;return!e&&!t?!0:await new Promise(o=>{let n=[];e&&n.push(i.path),t&&n.push(t);let r=this._notificationService.prompt(ft.Warning,d(14882,null,`"${n.join(",")}"`),[{label:d(14883,null),run:()=>o(!0)},{label:d(14873,null),run:()=>o(!1)}]);U.once(r.onDidClose)(()=>{o(!1)})})}_createProfileQuickPickItem(i){let e=[{iconClass:q.asClassName(bbo),tooltip:d(14874,null)}],o=`$(${(i.icon&&q.isThemeIcon(i.icon)?i.icon:R.terminal).id}) ${i.profileName}`,n=i.isFromPath?jo(i.path):i.path,r=by(i),s=[];if(r&&s.push(r),i.args){if(Fe(i.args))return{label:o,description:`${i.path} ${i.args}`,profile:i,profileName:i.profileName,buttons:e,iconClasses:s};let l=i.args.map(c=>c.includes(" ")?`"${c.replace(/"/g,'\\"')}"`:c).join(" ");return{label:o,description:`${n} ${l}`,profile:i,profileName:i.profileName,buttons:e,iconClasses:s}}return{label:o,description:n,profile:i,profileName:i.profileName,buttons:e,iconClasses:s}}_sortProfileQuickPickItems(i,e){return i.sort((t,o)=>o.profileName===e?1:t.profileName===e?-1:t.profileName.localeCompare(o.profileName))}};k1e=I([m(0,vy),m(1,Ag),m(2,B),m(3,Ue),m(4,Le),m(5,Ne)],k1e);function Z_o(a,i,e,t,o){let n=new N,r=n.add(new AI),s=n.add(new Vt);function l(p,h){let g=r.add(U.map(o(h),v=>({instance:p,data:v}))),f=s.get(p.instanceId);f||(f=new Vt,s.set(p.instanceId,f)),f.set(h,g)}for(let p of a){let h=p.capabilities.get(t);h&&l(p,h)}n.add(e(p=>{s.deleteAndDispose(p.instanceId)}));let c=n.add(new Use(a,i,e,p=>U.map(p.capabilities.createOnDidAddCapabilityOfTypeEvent(t),h=>({instance:p,changeEvent:h}))));n.add(c.event(p=>{l(p.instance,p.changeEvent)}));let u=n.add(new Use(a,i,e,p=>U.map(p.capabilities.createOnDidRemoveCapabilityOfTypeEvent(t),h=>({instance:p,changeEvent:h}))));return n.add(u.event(p=>{s.get(p.instance.instanceId)?.deleteAndDispose(p.changeEvent)})),{dispose:()=>n.dispose(),event:r.event}}var rC=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T){super();this._contextKeyService=e;this._lifecycleService=t;this._logService=o;this._dialogService=n;this._instantiationService=r;this._remoteAgentService=s;this._configurationService=l;this._environmentService=c;this._terminalConfigurationService=u;this._terminalEditorService=p;this._terminalGroupService=h;this._terminalInstanceService=g;this._editorGroupsService=f;this._terminalProfileService=v;this._extensionService=b;this._notificationService=S;this._workspaceContextService=y;this._commandService=w;this._keybindingService=k;this._timerService=T;this._hostActiveTerminals=new Map;this._detachedXterms=new Set;this._isShuttingDown=!1;this._backgroundedTerminalInstances=[];this._backgroundedTerminalDisposables=new Map;this._connectionState=0;this._whenConnected=new Ko;this._restoredGroupCount=0;this._reconnectedTerminals=new Map;this._onDidCreateInstance=this._register(new E);this._onDidChangeInstanceDimensions=this._register(new E);this._onDidRegisterProcessSupport=this._register(new E);this._onDidChangeConnectionState=this._register(new E);this._onDidRequestStartExtensionTerminal=this._register(new E);this._onDidDisposeInstance=this._register(new E);this._onDidFocusInstance=this._register(new E);this._onDidChangeActiveInstance=this._register(new E);this._onDidChangeInstances=this._register(new E);this._onDidChangeInstanceCapability=this._register(new E);this._onDidChangeActiveGroup=this._register(new E);this._register(this.onDidCreateInstance(()=>this._terminalProfileService.refreshAvailableProfiles())),this._forwardInstanceHostEvents(this._terminalGroupService),this._forwardInstanceHostEvents(this._terminalEditorService),this._register(this._terminalGroupService.onDidChangeActiveGroup(this._onDidChangeActiveGroup.fire,this._onDidChangeActiveGroup)),this._register(this._terminalInstanceService.onDidCreateInstance(P=>{this._initInstanceListeners(P),this._onDidCreateInstance.fire(P)})),this._register(this._terminalGroupService.onDidChangeActiveInstance(P=>{!P&&!this._isShuttingDown&&this._terminalConfigurationService.config.hideOnLastClosed&&this._terminalGroupService.hidePanel(),P?.shellType?this._terminalShellTypeContextKey.set(P.shellType.toString()):(!P||!P.shellType)&&this._terminalShellTypeContextKey.reset()})),this._handleInstanceContextKeys(),this._terminalShellTypeContextKey=dt.shellType.bindTo(this._contextKeyService),this._processSupportContextKey=dt.processSupported.bindTo(this._contextKeyService),this._processSupportContextKey.set(!Wt||this._remoteAgentService.getConnection()!==null),this._terminalHasBeenCreated=dt.terminalHasBeenCreated.bindTo(this._contextKeyService),this._terminalCountContextKey=dt.count.bindTo(this._contextKeyService),this._register(t.onBeforeShutdown(async P=>P.veto(this._onBeforeShutdown(P.reason),"veto.terminal"))),this._register(t.onWillShutdown(P=>this._onWillShutdown(P))),this._initializePrimaryBackend(),Li(0).then(()=>this._register(this._instantiationService.createInstance(vct,ut.document.head)))}get isProcessSupportRegistered(){return!!this._processSupportContextKey.get()}get connectionState(){return this._connectionState}get whenConnected(){return this._whenConnected.p}get restoredGroupCount(){return this._restoredGroupCount}get instances(){return this._terminalGroupService.instances.concat(this._terminalEditorService.instances).concat(this._backgroundedTerminalInstances.map(e=>e.instance))}get foregroundInstances(){return this._terminalGroupService.instances.concat(this._terminalEditorService.instances)}get detachedInstances(){return this._detachedXterms}getReconnectedTerminals(e){return this._reconnectedTerminals.get(e)}get activeInstance(){for(let e of this._hostActiveTerminals.values())if(e?.hasFocus)return e;return this._activeInstance}get onDidCreateInstance(){return this._onDidCreateInstance.event}get onDidChangeInstanceDimensions(){return this._onDidChangeInstanceDimensions.event}get onDidRegisterProcessSupport(){return this._onDidRegisterProcessSupport.event}get onDidChangeConnectionState(){return this._onDidChangeConnectionState.event}get onDidRequestStartExtensionTerminal(){return this._onDidRequestStartExtensionTerminal.event}get onDidDisposeInstance(){return this._onDidDisposeInstance.event}get onDidFocusInstance(){return this._onDidFocusInstance.event}get onDidChangeActiveInstance(){return this._onDidChangeActiveInstance.event}get onDidChangeInstances(){return this._onDidChangeInstances.event}get onDidChangeInstanceCapability(){return this._onDidChangeInstanceCapability.event}get onDidChangeActiveGroup(){return this._onDidChangeActiveGroup.event}get onAnyInstanceData(){return this._register(this.createOnInstanceEvent(e=>U.map(e.onData,t=>({instance:e,data:t})))).event}get onAnyInstanceDataInput(){return this._register(this.createOnInstanceEvent(e=>U.map(e.onDidInputData,()=>e,e.store))).event}get onAnyInstanceIconChange(){return this._register(this.createOnInstanceEvent(e=>e.onIconChanged)).event}get onAnyInstanceMaximumDimensionsChange(){return this._register(this.createOnInstanceEvent(e=>U.map(e.onMaximumDimensionsChanged,()=>e,e.store))).event}get onAnyInstancePrimaryStatusChange(){return this._register(this.createOnInstanceEvent(e=>U.map(e.statusList.onDidChangePrimaryStatus,()=>e,e.store))).event}get onAnyInstanceProcessIdReady(){return this._register(this.createOnInstanceEvent(e=>e.onProcessIdReady)).event}get onAnyInstanceSelectionChange(){return this._register(this.createOnInstanceEvent(e=>e.onDidChangeSelection)).event}get onAnyInstanceTitleChange(){return this._register(this.createOnInstanceEvent(e=>e.onTitleChanged)).event}get onAnyInstanceShellTypeChanged(){return this._register(this.createOnInstanceEvent(e=>U.map(e.onDidChangeShellType,()=>e))).event}get onAnyInstanceAddedCapabilityType(){return this._register(this.createOnInstanceEvent(e=>U.map(e.capabilities.onDidAddCapability,t=>t.id))).event}async showProfileQuickPick(e,t){let n=await this._instantiationService.createInstance(k1e).showAndGetResult(e);if(!n||Fe(n))return;let r=n.keyMods;if(e==="createInstance"){let s=this.getDefaultInstanceHost().activeInstance,l=this._terminalConfigurationService.defaultLocation,c;if(n.config&&No(n.config,{id:!0})){await this.createContributedTerminalProfile(n.config.extensionIdentifier,n.config.id,{icon:n.config.options?.icon,color:n.config.options?.color,location:r?.alt&&s?{splitActiveTerminal:!0}:l,titleTemplate:n.config.titleTemplate});return}else n.config&&No(n.config,{profileName:!0})&&(r?.alt&&s?c=await this.createTerminal({location:{parentTerminal:s},config:n.config,cwd:t}):c=await this.createTerminal({location:l,config:n.config,cwd:t}));if(c&&l!==2)return this._terminalGroupService.showPanel(!0),this.setActiveInstance(c),c}}async _initializePrimaryBackend(){Mo("code/terminal/willGetTerminalBackend"),this._primaryBackend=await this._terminalInstanceService.getBackend(this._environmentService.remoteAuthority),Mo("code/terminal/didGetTerminalBackend");let e=this._terminalConfigurationService.config.enablePersistentSessions;this._connectionState=0;let t=!!this._environmentService.remoteAuthority&&e;this._primaryBackend&&this._register(this._primaryBackend.onDidRequestDetach(async n=>{let r=this.getInstanceFromResource(lHe(n.workspaceId,n.instanceId));if(r){let s=r?.persistentProcessId;s&&!r.shellLaunchConfig.isFeatureTerminal&&!r.shellLaunchConfig.customPtyImplementation?(r.target===2?this._terminalEditorService.detachInstance(r):this._terminalGroupService.getGroupForInstance(r)?.removeInstance(r),await r.detachProcessAndDispose(3),await this._primaryBackend?.acceptDetachInstanceReply(n.requestId,s)):await this._primaryBackend?.acceptDetachInstanceReply(n.requestId,void 0)}})),Mo("code/terminal/willReconnect");let o;t?o=this._reconnectToRemoteTerminals():e?o=this._reconnectToLocalTerminals():o=Promise.resolve(),o.then(async()=>{this._setConnected(),Mo("code/terminal/didReconnect"),Mo("code/terminal/willReplay");let n=await this._reconnectedTerminalGroups?.then(r=>r.map(s=>s.terminalInstances).flat())??[];await Promise.all(n.map(r=>new Promise(s=>U.once(r.onProcessReplayComplete)(s)))),Mo("code/terminal/didReplay"),Mo("code/terminal/willGetPerformanceMarks"),await Promise.all(Array.from(this._terminalInstanceService.getRegisteredBackends()).map(async r=>{this._timerService.setPerformanceMarks(r.remoteAuthority===void 0?"localPtyHost":"remotePtyHost",await r.getPerformanceMarks()),r.setReady()})),Mo("code/terminal/didGetPerformanceMarks"),this._whenConnected.complete()})}getPrimaryBackend(){return this._primaryBackend}async setNextCommandId(e,t,o){!this._primaryBackend||e<=0||await this._primaryBackend.setNextCommandId(e,t,o)}_forwardInstanceHostEvents(e){this._register(e.onDidChangeInstances(this._onDidChangeInstances.fire,this._onDidChangeInstances)),this._register(e.onDidDisposeInstance(this._onDidDisposeInstance.fire,this._onDidDisposeInstance)),this._register(e.onDidChangeActiveInstance(t=>this._evaluateActiveInstance(e,t))),this._register(e.onDidFocusInstance(t=>{this._onDidFocusInstance.fire(t),this._evaluateActiveInstance(e,t)})),this._register(e.onDidChangeInstanceCapability(t=>{this._onDidChangeInstanceCapability.fire(t)})),this._hostActiveTerminals.set(e,void 0)}_evaluateActiveInstance(e,t){if(this._hostActiveTerminals.set(e,t),t===void 0)for(let o of this._hostActiveTerminals.values())o&&(t=o);this._activeInstance=t,this._onDidChangeActiveInstance.fire(t)}setActiveInstance(e){e&&(e.shellLaunchConfig.hideFromUser&&this.showBackgroundTerminal(e),e.target===2?this._terminalEditorService.setActiveInstance(e):this._terminalGroupService.setActiveInstance(e))}async focusInstance(e){if(this._activeInstance!==e&&this.setActiveInstance(e),e.target===2){await this._terminalEditorService.focusInstance(e);return}await this._terminalGroupService.focusInstance(e)}async focusActiveInstance(){if(this._activeInstance)return this.focusInstance(this._activeInstance)}async createContributedTerminalProfile(e,t,o){await this._extensionService.activateByEvent(`onTerminalProfile:${t}`);let n=this._terminalProfileService.getContributedProfileProvider(e,t);if(!n){this._notificationService.error(`No terminal profile provider registered for id "${t}"`);return}try{await n.createContributedTerminalProfile(o),this._terminalGroupService.setActiveInstanceByIndex(this._terminalGroupService.instances.length-1),await this._terminalGroupService.activeInstance?.focusWhenReady()}catch(r){this._notificationService.error(r.message)}}async safeDisposeTerminal(e){if(!(e.target!==2&&e.hasChildProcesses&&(this._terminalConfigurationService.config.confirmOnKill==="panel"||this._terminalConfigurationService.config.confirmOnKill==="always")&&await this._showTerminalCloseConfirmation(!0)))return new Promise(t=>{U.once(e.onExit)(()=>t()),e.dispose(3)})}_setConnected(){this._connectionState=1,this._onDidChangeConnectionState.fire(),this._logService.trace("Pty host ready")}async _reconnectToRemoteTerminals(){let e=this._environmentService.remoteAuthority;if(!e)return;let t=await this._terminalInstanceService.getBackend(e);if(!t)return;Mo("code/terminal/willGetTerminalLayoutInfo");let o=await t.getTerminalLayoutInfo();Mo("code/terminal/didGetTerminalLayoutInfo"),t.reduceConnectionGraceTime(),Mo("code/terminal/willRecreateTerminalGroups"),await this._recreateTerminalGroups(o),Mo("code/terminal/didRecreateTerminalGroups"),this._attachProcessLayoutListeners(),this._logService.trace("Reconnected to remote terminals")}async _reconnectToLocalTerminals(){let e=await this._terminalInstanceService.getBackend();if(!e)return;Mo("code/terminal/willGetTerminalLayoutInfo");let t=await e.getTerminalLayoutInfo();if(Mo("code/terminal/didGetTerminalLayoutInfo"),t&&(t.tabs.length>0||t?.background?.length)){Mo("code/terminal/willRecreateTerminalGroups"),this._reconnectedTerminalGroups=this._recreateTerminalGroups(t);let o=await this._reviveBackgroundTerminalInstances(t.background||[]);this._backgroundedTerminalInstances=o.map(n=>({instance:n})),Mo("code/terminal/didRecreateTerminalGroups")}this._attachProcessLayoutListeners(),this._logService.trace("Reconnected to local terminals")}_recreateTerminalGroups(e){let t=[],o;if(e){for(let n of e.tabs){let r=n.terminals.filter(s=>s.terminal&&s.terminal.isOrphan);if(r.length){this._restoredGroupCount+=r.length;let s=this._recreateTerminalGroup(n,r);t.push(s),n.isActive&&(o=s);let l=this.instances.find(c=>c.shellLaunchConfig.attachPersistentProcess?.id===n.activePersistentProcessId);l&&this.setActiveInstance(l)}}e.tabs.length&&o?.then(n=>this._terminalGroupService.activeGroup=n)}return Promise.all(t).then(n=>n.filter(r=>!!r))}async _reviveBackgroundTerminalInstances(e){let t=[];for(let o of e){let n=o;if(!n)continue;let r=await this.createTerminal({config:{attachPersistentProcess:n,hideFromUser:!0,forcePersist:!0},location:1});t.push(r)}return t}async _recreateTerminalGroup(e,t){let o;for(let r of t){let s=r.terminal;this._lifecycleService.startupKind!==3&&s.type==="Task"||(Mo(`code/terminal/willRecreateTerminal/${s.id}-${s.pid}`),o=this.createTerminal({config:{attachPersistentProcess:s},location:o?{parentTerminal:o}:1}),o.then(()=>Mo(`code/terminal/didRecreateTerminal/${s.id}-${s.pid}`)))}return o?.then(r=>{let s=this._terminalGroupService.getGroupForInstance(r);return s?.resizePanes(e.terminals.map(l=>l.relativeSize)),s})}_attachProcessLayoutListeners(){this._register(this.onDidChangeActiveGroup(()=>this._saveState())),this._register(this.onDidChangeActiveInstance(()=>this._saveState())),this._register(this.onDidChangeInstances(()=>this._saveState())),this._register(this.onAnyInstanceProcessIdReady(()=>this._saveState())),this._register(this.onAnyInstanceTitleChange(e=>this._updateTitle(e))),this._register(this.onAnyInstanceIconChange(e=>this._updateIcon(e.instance,e.userInitiated)))}_handleInstanceContextKeys(){let e=dt.isOpen.bindTo(this._contextKeyService),t=()=>{e.set(this.instances.length>0),this._terminalCountContextKey.set(this.instances.length)};this._register(this.onDidChangeInstances(()=>t()))}async getActiveOrCreateInstance(e){let t=this.activeInstance;if(!t)return this.createTerminal();if(!e?.acceptsInput||t.xterm?.isStdinDisabled!==!0)return t;let o=await this.createTerminal();return this.setActiveInstance(o),await this.revealActiveTerminal(),o}async revealTerminal(e,t){e.target===2?await this._terminalEditorService.revealActiveEditor(t):await this._terminalGroupService.showPanel()}async revealActiveTerminal(e){let t=this.activeInstance;t&&await this.revealTerminal(t,e)}requestStartExtensionTerminal(e,t,o){return new Promise(n=>{this._onDidRequestStartExtensionTerminal.fire({proxy:e,cols:t,rows:o,callback:n})})}_onBeforeShutdown(e){return Wt?(this._isShuttingDown=!0,!1):this._onBeforeShutdownAsync(e)}async _onBeforeShutdownAsync(e){if(this.instances.length===0)return!1;try{if(this._shutdownWindowCount=await this._nativeDelegate?.getWindowCount(),this._shouldReviveProcesses(e)&&await Promise.race([this._primaryBackend?.persistTerminalState(),Li(2e3)]),!(this._terminalConfigurationService.config.enablePersistentSessions&&e===3)&&(this._terminalConfigurationService.config.confirmOnExit==="always"&&this.foregroundInstances.length>0||this._terminalConfigurationService.config.confirmOnExit==="hasChildProcesses"&&this.foregroundInstances.some(r=>r.hasChildProcesses)))return this._onBeforeShutdownConfirmation(e)}catch(t){this._logService.warn("Exception occurred during terminal shutdown",t)}return this._isShuttingDown=!0,!1}setNativeDelegate(e){this._nativeDelegate=e}_shouldReviveProcesses(e){if(!this._terminalConfigurationService.config.enablePersistentSessions)return!1;switch(this._terminalConfigurationService.config.persistentSessionReviveProcess){case"onExit":return e===1&&this._shutdownWindowCount===1&&!Ze?!0:e===4||e===2;case"onExitAndWindowClose":return e!==3;default:return!1}}async _onBeforeShutdownConfirmation(e){let t=await this._showTerminalCloseConfirmation();return t||(this._isShuttingDown=!0),t}_onWillShutdown(e){let t=this._terminalConfigurationService.config.enablePersistentSessions&&e.reason===3;for(let o of[...this._terminalGroupService.instances,...this._backgroundedTerminalInstances.map(n=>n.instance)])t&&o.shouldPersist?o.detachProcessAndDispose(1):o.dispose(1);!t&&!this._shouldReviveProcesses(e.reason)&&this._primaryBackend?.setTerminalLayoutInfo(void 0)}_saveState(){if(this._isShuttingDown||!this._terminalConfigurationService.config.enablePersistentSessions)return;let t={tabs:this._terminalGroupService.groups.map(o=>o.getLayoutInfo(o===this._terminalGroupService.activeGroup)),background:this._backgroundedTerminalInstances.map(o=>o.instance).filter(o=>o.shellLaunchConfig.forcePersist).map(o=>o.persistentProcessId).filter(o=>o!==void 0)};this._primaryBackend?.setTerminalLayoutInfo(t)}_updateTitle(e){!this._terminalConfigurationService.config.enablePersistentSessions||!e||!e.persistentProcessId||!e.title||e.isDisposed||(e.staticTitle?this._primaryBackend?.updateTitle(e.persistentProcessId,e.staticTitle,0):this._primaryBackend?.updateTitle(e.persistentProcessId,e.title,e.titleSource))}_updateIcon(e,t){!this._terminalConfigurationService.config.enablePersistentSessions||!e||!e.persistentProcessId||!e.icon||e.isDisposed||this._primaryBackend?.updateIcon(e.persistentProcessId,t,e.icon,e.color)}refreshActiveGroup(){this._onDidChangeActiveGroup.fire(this._terminalGroupService.activeGroup)}getInstanceFromId(e){let t=-1;if(this._backgroundedTerminalInstances.forEach((o,n)=>{o.instance.instanceId===e&&(t=n)}),t!==-1)return this._backgroundedTerminalInstances[t].instance;try{return this.instances[this._getIndexFromId(e)]}catch{return}}getInstanceFromResource(e){return dHe(this.instances,e)}openResource(e){let t=this.getInstanceFromResource(e);if(t){this.setActiveInstance(t),this.revealTerminal(t);let o=t.capabilities.get(2)?.commands,n=new URLSearchParams(e.query),r=o?.find(s=>s.id===n.get("command"));r&&t.xterm?.markTracker.revealCommand(r)}}isAttachedToTerminal(e){return this.instances.some(t=>t.processId===e.pid)}moveToEditor(e,t){if(e.target===2)return;let o=this._terminalGroupService.getGroupForInstance(e);o&&(o.removeInstance(e),this._terminalEditorService.openEditor(e,t?{viewColumn:t}:void 0))}moveIntoNewEditor(e){this.moveToEditor(e,Mg)}async moveToTerminalView(e,t,o){if(A.isUri(e)&&(e=this.getInstanceFromResource(e)),!e)return;if(this._terminalEditorService.detachInstance(e),e.target!==2){await this._terminalGroupService.showPanel(!0);return}e.target=1;let n;if(t&&(n=this._terminalGroupService.getGroupForInstance(t)),n||(n=this._terminalGroupService.createGroup()),n.addInstance(e),this.setActiveInstance(e),await this._terminalGroupService.showPanel(!0),t&&o){let r=n.terminalInstances.indexOf(t)+(o==="after"?1:0);n.moveInstance(e,r,o)}this._onDidChangeInstances.fire(),this._onDidChangeActiveGroup.fire(this._terminalGroupService.activeGroup)}_initInstanceListeners(e){let t=new N;t.add(e.onDimensionsChanged(()=>{this._onDidChangeInstanceDimensions.fire(e),this._terminalConfigurationService.config.enablePersistentSessions&&this.isProcessSupportRegistered&&this._saveState()})),t.add(e.onDidFocus(this._onDidChangeActiveInstance.fire,this._onDidChangeActiveInstance)),t.add(e.onRequestAddInstanceToGroup(async n=>await this._addInstanceToGroup(e,n))),t.add(e.onDidChangeShellType(()=>this._extensionService.activateByEvent(`onTerminal:${e.shellType}`))),t.add(U.runAndSubscribe(e.capabilities.onDidAddCapability,(()=>{e.capabilities.has(2)&&this._extensionService.activateByEvent(`onTerminalShellIntegration:${e.shellType}`)})));let o=this._register(e.onDisposed(()=>{t.dispose(),this._store.delete(o)}))}async _addInstanceToGroup(e,t){let o=Rq(t.uri);if(o.instanceId===void 0)return;let n=this.getInstanceFromResource(t.uri);if(!n){let r=await this._primaryBackend?.requestDetachInstance(o.workspaceId,o.instanceId);if(r){n=await this.createTerminal({config:{attachPersistentProcess:r},resource:t.uri}),this._terminalGroupService.moveInstance(n,e,t.side);return}}if(n=this._terminalGroupService.getInstanceFromResource(t.uri),n){this._terminalGroupService.moveInstance(n,e,t.side);return}if(n=this._terminalEditorService.getInstanceFromResource(t.uri),n){this.moveToTerminalView(n,e,t.side);return}}registerProcessSupport(e){e&&(this._processSupportContextKey.set(e),this._onDidRegisterProcessSupport.fire())}_getIndexFromId(e){let t=-1;if(this.instances.forEach((o,n)=>{o.instanceId===e&&(t=n)}),t===-1)throw new Error(`Terminal with ID ${e} does not exist (has it already been disposed?)`);return t}async _showTerminalCloseConfirmation(e){let t,o=this.foregroundInstances;o.length===1||e?t=d(14887,null):t=d(14886,null,o.length);let{confirmed:n}=await this._dialogService.confirm({type:"warning",message:t,primaryButton:d(14888,null)});return!n}getDefaultInstanceHost(){return this._terminalConfigurationService.defaultLocation===2?this._terminalEditorService:this._terminalGroupService}async getInstanceHost(e){if(e){if(e===2)return this._terminalEditorService;if(typeof e=="object"){if(No(e,{viewColumn:!0}))return this._terminalEditorService;if(No(e,{parentTerminal:!0}))return(await e.parentTerminal).target===2?this._terminalEditorService:this._terminalGroupService}else return this._terminalGroupService}return this}async createTerminal(e){let t=this._remoteAgentService.getConnection()&&A.isUri(e?.cwd)&&e?.cwd.scheme===Q.file;this._terminalProfileService.availableProfiles.length===0&&!(e?.config&&No(e.config,{customPtyImplementation:!0}))&&!t&&(this._connectionState===0&&Mo("code/terminal/willGetProfiles"),await this._terminalProfileService.profilesReady,this._connectionState===0&&Mo("code/terminal/didGetProfiles"));let o=e?.config;if(!o&&t){let h=await(await this._terminalInstanceService.getBackend(void 0))?.getDefaultSystemShell();h&&(o={executable:h})}o||(o=this._terminalProfileService.getDefaultProfile());let n=o&&No(o,{extensionIdentifier:!0})?{}:this._terminalInstanceService.convertProfileToShellLaunchConfig(o||{}),r=e?.skipContributedProfileCheck?void 0:await this._getContributedProfile(n,e),s=typeof e?.location=="object"&&No(e.location,{splitActiveTerminal:!0})?e.location.splitActiveTerminal:typeof e?.location=="object"?No(e.location,{parentTerminal:!0}):!1;if(await this._resolveCwd(n,s,e),!n.customPtyImplementation&&r){let p=await this.resolveLocation(e?.location),h;s?h=p===2?{viewColumn:In}:{splitActiveTerminal:!0}:h=typeof e?.location=="object"&&No(e.location,{viewColumn:!0})?e.location:p,await this.createContributedTerminalProfile(r.extensionIdentifier,r.id,{icon:r.icon,color:r.color,location:h,cwd:n.cwd,titleTemplate:r.titleTemplate});let g=p===2?this._terminalEditorService:this._terminalGroupService,f=g.instances[g.instances.length-1];return await f?.focusWhenReady(),this._terminalHasBeenCreated.set(!0),f}if(!n.customPtyImplementation&&!this.isProcessSupportRegistered)throw new Error("Could not create terminal when process support is not registered");this._evaluateLocalCwd(n);let l=await this.resolveLocation(e?.location)||this._terminalConfigurationService.defaultLocation;if(n.hideFromUser){let p=this._terminalInstanceService.createInstance(n,l);return this._backgroundedTerminalInstances.push({instance:p,terminalLocationOptions:e?.location}),this._backgroundedTerminalDisposables.set(p.instanceId,[p.onDisposed(h=>{let g=this._backgroundedTerminalInstances.findIndex(f=>f.instance===h);g!==-1&&this._backgroundedTerminalInstances.splice(g,1),this._onDidDisposeInstance.fire(h)})]),this._onDidChangeInstances.fire(),p}let c=await this._getSplitParent(e?.location);this._terminalHasBeenCreated.set(!0),this._extensionService.activateByEvent("onTerminal:*");let u;return c?u=this._splitTerminal(n,l,c):u=this._createTerminal(n,l,e),u.shellType&&this._extensionService.activateByEvent(`onTerminal:${u.shellType}`),u}async createAndFocusTerminal(e){let t=await this.createTerminal(e);return this.setActiveInstance(t),await t.focusWhenReady(),t}async _getContributedProfile(e,t){return t?.config&&No(t.config,{extensionIdentifier:!0})?t.config:this._terminalProfileService.getContributedDefaultProfile(e)}async createDetachedTerminal(e){let t=await dv.getXtermConstructor(this._keybindingService,this._contextKeyService),o=e.capabilities??new Sx,n=this._instantiationService.createInstance(QM,void 0,t,{cols:e.cols,rows:e.rows,xtermColorProvider:e.colorProvider,capabilities:o,disableOverviewRuler:e.disableOverviewRuler},void 0);e.readonly&&n.raw.attachCustomKeyEventHandler(()=>!1);let r=new HOe(n,{...e,capabilities:o},this._instantiationService);this._detachedXterms.add(r);let s=n.onDidDispose(()=>{this._detachedXterms.delete(r),s.dispose()});return r}async _resolveCwd(e,t,o){if(!e.cwd){if(o?.cwd)e.cwd=o.cwd;else if(t&&o?.location){let r=this.activeInstance;if(typeof o.location=="object"&&No(o.location,{parentTerminal:!0})&&(r=await o.location.parentTerminal),!r)throw new Error("Cannot split without an active instance");e.cwd=await BVi(r,this._workspaceContextService.getWorkspace().folders,this._commandService,this._terminalConfigurationService)}}}_splitTerminal(e,t,o){let n;if(typeof e.cwd!="object"&&typeof o.shellLaunchConfig.cwd=="object"&&(e.cwd=A.from({scheme:o.shellLaunchConfig.cwd.scheme,authority:o.shellLaunchConfig.cwd.authority,path:e.cwd||o.shellLaunchConfig.cwd.path})),t===2||o.target===2)n=this._terminalEditorService.splitInstance(o,e);else{let r=this._terminalGroupService.getGroupForInstance(o);if(!r)throw new Error(`Cannot split a terminal without a group (instanceId: ${o.instanceId}, title: ${o.title})`);e.parentTerminalId=o.instanceId,n=r.split(e)}return n}_createTerminal(e,t,o){let n;if(t===2){if(n=this._terminalInstanceService.createInstance(e,2),!e.hideFromUser){let r=this._getEditorOptions(o?.location);this._terminalEditorService.openEditor(n,r)}}else n=this._terminalGroupService.createGroup(e).terminalInstances[0];return n}async resolveLocation(e){if(e&&typeof e=="object")if(No(e,{parentTerminal:!0})){let t=await e.parentTerminal;return t.target?t.target:1}else{if(No(e,{viewColumn:!0}))return 2;if(No(e,{splitActiveTerminal:!0}))return this._activeInstance?.target?this._activeInstance?.target:1}return e}async _getSplitParent(e){if(e&&typeof e=="object"&&No(e,{parentTerminal:!0}))return e.parentTerminal;if(e&&typeof e=="object"&&No(e,{splitActiveTerminal:!0}))return this.activeInstance}_getEditorOptions(e){if(e&&typeof e=="object"&&No(e,{viewColumn:!0}))return e.viewColumn===jn&&zy(Ki())?(e.viewColumn=this._editorGroupsService.activeGroup.id,e):(e.viewColumn=wk(this._editorGroupsService,this._configurationService,e.viewColumn),e)}_evaluateLocalCwd(e){this._environmentService.isSessionsWindow||!Fe(e.cwd)&&e.cwd?.scheme===Q.file&&(WR.getValue(this._contextKeyService)?(e.initialText=nE(d(14885,null,"\x1B[3m","\x1B[23m"),{excludeLeadingNewLine:!0,loudFormatting:!0}),e.type="Local"):this._remoteAgentService.getConnection()&&(e.initialText=nE(d(14884,null,"\x1B[3m","\x1B[23m"),{excludeLeadingNewLine:!0,loudFormatting:!0}),e.type="Local"))}moveToBackground(e){if(!this._backgroundedTerminalInstances.some(t=>t.instance===e)){if(e.target===2)this._terminalEditorService.detachInstance(e);else{let t=this._terminalGroupService.getGroupForInstance(e);if(!t)return;t.removeInstance(e)}e.detachFromElement(),this._backgroundedTerminalInstances.push({instance:e,terminalLocationOptions:e.target===2?{viewColumn:jn}:void 0}),this._backgroundedTerminalDisposables.set(e.instanceId,[e.onDisposed(t=>{let o=this._backgroundedTerminalInstances.findIndex(r=>r.instance===t);o!==-1&&this._backgroundedTerminalInstances.splice(o,1);let n=this._backgroundedTerminalDisposables.get(t.instanceId);n&&Be(n),this._backgroundedTerminalDisposables.delete(t.instanceId),this._onDidDisposeInstance.fire(t)})]),this._onDidChangeInstances.fire()}}async showBackgroundTerminal(e,t){let o=this._backgroundedTerminalInstances.findIndex(s=>s.instance===e);if(o===-1)return;let n=this._backgroundedTerminalInstances[o];this._backgroundedTerminalInstances.splice(o,1);let r=this._backgroundedTerminalDisposables.get(e.instanceId);if(r&&Be(r),this._backgroundedTerminalDisposables.delete(e.instanceId),e.target===1)this._terminalGroupService.createGroup(e),this.instances.length===1&&!t&&this._terminalGroupService.setActiveInstanceByIndex(0);else{let s=n.terminalLocationOptions?this._getEditorOptions(n.terminalLocationOptions):this._getEditorOptions(e.target);this._terminalEditorService.openEditor(e,s)}this._onDidChangeInstances.fire()}async setContainers(e,t){this._terminalConfigurationService.setPanelContainer(e),this._terminalGroupService.setContainer(t)}createOnInstanceEvent(e){return new Use(this.instances,this.onDidCreateInstance,this.onDidDisposeInstance,e)}createOnInstanceCapabilityEvent(e,t){return Z_o(this.instances,this.onDidCreateInstance,this.onDidDisposeInstance,e,t)}};I([hi],rC.prototype,"onAnyInstanceData",1),I([hi],rC.prototype,"onAnyInstanceDataInput",1),I([hi],rC.prototype,"onAnyInstanceIconChange",1),I([hi],rC.prototype,"onAnyInstanceMaximumDimensionsChange",1),I([hi],rC.prototype,"onAnyInstancePrimaryStatusChange",1),I([hi],rC.prototype,"onAnyInstanceProcessIdReady",1),I([hi],rC.prototype,"onAnyInstanceSelectionChange",1),I([hi],rC.prototype,"onAnyInstanceTitleChange",1),I([hi],rC.prototype,"onAnyInstanceShellTypeChanged",1),I([hi],rC.prototype,"onAnyInstanceAddedCapabilityType",1),I([Zd(500)],rC.prototype,"_saveState",1),I([Zd(500)],rC.prototype,"_updateTitle",1),I([Zd(500)],rC.prototype,"_updateIcon",1),rC=I([m(0,X),m(1,ji),m(2,ca),m(3,at),m(4,F),m(5,bo),m(6,B),m(7,At),m(8,Uu),m(9,Fv),m(10,lc),m(11,Nm),m(12,wt),m(13,vy),m(14,lt),m(15,Ne),m(16,Pe),m(17,ge),m(18,_e),m(19,YC)],rC);var vct=class extends yu{constructor(e,t,o,n,r){super(o);this._terminalService=t;this._themeService=o;this._terminalProfileService=n;this._editorService=r;this._registerListeners(),this._styleElement=Cr(e),this._register(Z(()=>this._styleElement.remove())),this.updateStyles()}_registerListeners(){this._register(this._terminalService.onAnyInstanceIconChange(()=>this.updateStyles())),this._register(this._terminalService.onDidCreateInstance(()=>this.updateStyles())),this._register(this._editorService.onDidActiveEditorChange(()=>{this._editorService.activeEditor instanceof xf&&this.updateStyles()})),this._register(this._editorService.onDidCloseEditor(()=>{this._editorService.activeEditor instanceof xf&&this.updateStyles()})),this._register(this._terminalProfileService.onDidChangeAvailableProfiles(()=>this.updateStyles()))}updateStyles(){super.updateStyles();let e=this._themeService.getColorTheme(),t="",o=this._themeService.getProductIconTheme();for(let r of this._terminalService.instances){let s=r.icon;if(!s)continue;let l;s instanceof A?l=s:s instanceof Object&&No(s,{light:!0,dark:!0})&&(l=Bp(e.type)?s.dark:s.light);let c=SD(r,e.type);if(l instanceof A&&c&&c.length>1&&(t+=ia`.monaco-workbench .terminal-tab.${bz(c[0])}::before
					{content: ''; background-image: ${Qa(l)};}`),q.isThemeIcon(s)){let p=mw().getIcon(s.id);if(p){let h=o.getIcon(p);h&&(t+=ia`.monaco-workbench .terminal-tab.codicon-${bz(s.id)}::before
							{content: ${tI(h.fontCharacter)} !important; font-family: ${tI(h.font?.id??"codicon")} !important;}`)}}}let n=e.getColor(cj);n&&(t+=ia`.monaco-workbench .show-file-icons .file-icon.terminal-tab::before { color: ${n}; }`),t+=poo(e,!0),this._styleElement.textContent=t}};vct=I([m(1,nn),m(2,Le),m(3,vy),m(4,ee)],vct);var cbe=class extends x{constructor(e,t,o,n){super();this._telemetryService=n;this._register(t.onDidCreateInstance(async r=>{let s=new N;this._store.add(s),await Promise.race([r.processReady.then(()=>Li(1e4)),U.toPromise(r.onDisposed,s),U.toPromise(e.onWillShutdown,s)]);let l=!1;try{let u=o.getInputFromResource(r.resource).group?.windowId;l=!!(u&&zy(rb(u,!0).window))}catch{}this._logCreateInstance(r,l),this._store.delete(s)}))}static{this.ID="terminalTelemetry"}_logCreateInstance(e,t){let o=e.shellLaunchConfig,n=e.capabilities.get(2);this._telemetryService.publicLog2("terminal/createInstance",{location:e.target===1?"view":e.target===2?t?"editor-auxwindow":"editor":"unknown",shellType:new sg(ngn(o)),promptType:new sg(e.capabilities.get(6)?.promptType),isCustomPtyImplementation:!!o.customPtyImplementation,isExtensionOwnedTerminal:!!o.isExtensionOwnedTerminal,isLoginShell:(Fe(o.args)?o.args.split(" "):o.args)?.some(r=>r==="-l"||r==="--login")??!1,isReconnect:!!o.attachPersistentProcess,hasRemoteAuthority:e.hasRemoteAuthority,shellIntegrationQuality:n?.hasRichCommandDetection?2:n?1:0,shellIntegrationInjected:e.usedShellIntegrationInjection,shellIntegrationInjectionFailureReason:e.shellIntegrationInjectionFailureReason,imageAddonLoaded:e.xterm?.isImageAddonLoaded??!1,terminalSessionId:e.sessionId})}};cbe=I([m(0,ji),m(1,nn),m(2,Fv),m(3,Te)],cbe);var tgn=new Set(["cmd","wsl","bash","fish","pwsh","sh","ssh","tmux","zsh","amm","ash","csh","dash","elvish","ion","ksh","mksh","msh","nu","rc","scsh","tcsh","termux","xonsh","clj","sbcl","crystal","deno","iex","erl","fsi","go","ghci","jshell","julia","lua","node","ocaml","perl","php","swipl","python","R","irb","scala","racket","gst","pharo","tclsh","ts-node"]),ign=[{regex:/^(?:pwsh|powershell)-preview$/i,type:"pwsh-preview"},{regex:/^python(?:\d+(?:\.\d+)?)?$/i,type:"python"}],ogn=[{regex:/\\Cygwin(?:64)?\\.+\\bash\.exe$/i,type:"cygwin-bash"},{regex:/\\Git\\.+\\bash\.exe$/i,type:"git-bash"},{regex:/\\msys(?:32|64)\\.+\\(?:bash|msys2)\.exe$/i,type:"msys2-bash"},{regex:/\\WindowsPowerShell\\v1.0\\powershell.exe$/i,type:"windows-powershell"},{regex:/\\Windows\\(?:System32|SysWOW64|Sysnative)\\(?:bash|wsl)\.exe$/i,type:"wsl"}];function ngn(a){if(!a.executable)return"unknown";let e=jo(a.executable).replace(/\.[^\.]+$/,"");for(let t of ogn)if(t.regex.test(a.executable))return t.type;for(let t of ign)if(t.regex.test(e))return t.type;return tgn.has(e)?e:"unknown"}var E1e=class extends x{constructor(e,t,o,n,r){super();this._tabContainer=t;this._commandService=o;this._terminalChatService=n;this._terminalService=r;this._entry=M(e,_(".terminal-tabs-chat-entry")),this._entry.tabIndex=0,this._entry.setAttribute("role","button");let s=M(this._entry,_(".terminal-tabs-entry"));M(s,_(".terminal-tabs-chat-entry-icon")).classList.add(...q.asClassNameArray(R.commentDiscussionSparkle)),this._label=M(s,_(".terminal-tabs-chat-entry-label")),this._deleteButton=M(s,_(".terminal-tabs-chat-entry-delete")),this._deleteButton.classList.add(...q.asClassNameArray(R.trashcan)),this._deleteButton.tabIndex=0,this._deleteButton.setAttribute("role","button"),this._deleteButton.setAttribute("aria-label",d(14894,null)),this._deleteButton.setAttribute("title",d(14895,null));let c=()=>{this._commandService.executeCommand("workbench.action.terminal.chat.viewHiddenChatTerminals")};this._register(j(this._entry,re.CLICK,u=>{u.target===this._deleteButton||this._deleteButton.contains(u.target)||(u.preventDefault(),c())})),this._register(j(this._entry,re.KEY_DOWN,u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),c())})),this._register(j(this._deleteButton,re.CLICK,async u=>{u.preventDefault(),u.stopPropagation(),await this._deleteAllHiddenTerminals()})),this._register(j(this._deleteButton,re.KEY_DOWN,async u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),u.stopPropagation(),await this._deleteAllHiddenTerminals())})),this.update()}dispose(){this._entry.remove(),this._label.remove(),this._deleteButton.remove(),super.dispose()}async _deleteAllHiddenTerminals(){let e=this._terminalChatService.getToolSessionTerminalInstances(!0);await Promise.all(e.map(t=>this._terminalService.safeDisposeTerminal(t)))}get element(){return this._entry}update(){let e=this._terminalChatService.getToolSessionTerminalInstances(!0).length;if(e<=0){this._entry.style.display="none",this._label.textContent="",this._entry.removeAttribute("aria-label"),this._entry.removeAttribute("title");return}this._entry.style.display="";let t=d(14898,null);this._entry.setAttribute("title",t),this._tabContainer.classList.contains("has-text")?this._label.textContent=e===1?d(14897,null,e):d(14896,null,e):this._label.textContent=`${e}`;let n=e===1?d(14893,null):d(14892,null,e);this._entry.setAttribute("aria-label",n)}};E1e=I([m(2,ge),m(3,Wv),m(4,nn)],E1e);var bct=_;var T1e=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this._terminalService=t;this._terminalChatService=o;this._terminalConfigurationService=n;this._terminalGroupService=r;this._instantiationService=s;this._contextMenuService=l;this._configurationService=c;this._storageService=p;this._hoverService=g;this._cancelContextMenu=!1;this._emptyAreaDropTargetCount=0;this._tabContainer=bct(".tabs-container");let f=bct(".tabs-list-container");this._tabListContainer=f,this._tabListElement=bct(".tabs-list"),f.appendChild(this._tabListElement),this._tabContainer.appendChild(f),this._instanceMenu=this._register(u.createMenu(D.TerminalInstanceContext,h)),this._tabsListMenu=this._register(u.createMenu(D.TerminalTabContext,h)),this._tabsListEmptyMenu=this._register(u.createMenu(D.TerminalTabEmptyAreaContext,h)),this._tabList=this._register(this._instantiationService.createInstance(sre,this._tabListElement)),this._tabListDomElement=this._tabList.getHTMLElement(),this._chatEntry=this._register(this._instantiationService.createInstance(E1e,f,this._tabContainer));let v=bct(".terminal-outer-container");this._terminalContainer=bct(".terminal-groups-container"),v.appendChild(this._terminalContainer),this._terminalService.setContainers(e,this._terminalContainer),this._terminalIsTabsNarrowContextKey=dt.tabsNarrow.bindTo(h),this._terminalTabsFocusContextKey=dt.tabsFocus.bindTo(h),this._terminalTabsMouseContextKey=dt.tabsMouse.bindTo(h),this._tabTreeIndex=this._terminalConfigurationService.config.tabs.location==="left"?0:1,this._terminalContainerIndex=this._terminalConfigurationService.config.tabs.location==="left"?1:0,this._register(c.onDidChangeConfiguration(b=>{b.affectsConfiguration("terminal.integrated.tabs.enabled")||b.affectsConfiguration("terminal.integrated.tabs.hideCondition")?this._refreshShowTabs():b.affectsConfiguration("terminal.integrated.tabs.location")&&(this._tabTreeIndex=this._terminalConfigurationService.config.tabs.location==="left"?0:1,this._terminalContainerIndex=this._terminalConfigurationService.config.tabs.location==="left"?1:0,this._shouldShowTabs()&&(this._splitView.swapViews(0,1),this._removeSashListener(),this._addSashListener(),this._splitView.resizeView(this._tabTreeIndex,this._getLastListWidth())))})),this._register(U.any(this._terminalGroupService.onDidChangeInstances,this._terminalGroupService.onDidChangeGroups)(()=>{this._refreshShowTabs(),this._updateChatTerminalsEntry()})),this._register(U.any(this._terminalChatService.onDidRegisterTerminalInstanceWithToolSession,this._terminalService.onDidChangeInstances,this._terminalService.onDidDisposeInstance)(()=>{this._refreshShowTabs(),this._updateChatTerminalsEntry()})),this._register(h.onDidChangeContext(b=>{b.affectsSome(new Set([Tue.ChatHasHiddenTerminals]))&&(this._refreshShowTabs(),this._updateChatTerminalsEntry())})),this._attachEventListeners(e,this._terminalContainer),this._register(this._terminalGroupService.onDidChangePanelOrientation(b=>{this._panelOrientation=b,this._panelOrientation===0?this._terminalContainer.classList.add("terminal-side-view"):this._terminalContainer.classList.remove("terminal-side-view")})),this._splitView=new Ou(e,{orientation:1,proportionalLayout:!1}),this._setupSplitView(v),this._updateChatTerminalsEntry()}_shouldShowTabs(){let e=this._terminalConfigurationService.config.tabs.enabled,t=this._terminalConfigurationService.config.tabs.hideCondition,o=this._terminalChatService.getToolSessionTerminalInstances(!0);if(!e)return!1;if(o.length>0)return!0;switch(t){case"never":return!0;case"singleTerminal":if(this._terminalGroupService.instances.length>1)return!0;break;case"singleGroup":if(this._terminalGroupService.groups.length>1)return!0;break}return!1}_refreshShowTabs(){this._shouldShowTabs()?this._splitView.length===1&&(this._addTabTree(),this._addSashListener(),this._splitView.resizeView(this._tabTreeIndex,this._getLastListWidth()),this.rerenderTabs()):this._splitView.length===2&&!this._terminalTabsMouseContextKey.get()&&(this._splitView.removeView(this._tabTreeIndex),this._plusButton?.remove(),this._removeSashListener())}_updateChatTerminalsEntry(){this._chatEntry?.update()}_getLastListWidth(){let e=this._panelOrientation===0?"tabs-list-width-vertical":"tabs-list-width-horizontal",t=this._storageService.get(e,0);return!t||!parseInt(t)?this._panelOrientation===0?46:120:parseInt(t)}_handleOnDidSashReset(){let e=80,t=document.createElement("canvas");t.width=1,t.height=1;let o=t.getContext("2d");if(o){let r=Re(this._tabListElement).getComputedStyle(this._tabListElement);o.font=`${r.fontStyle} ${r.fontSize} ${r.fontFamily}`;let s=this._terminalGroupService.instances.reduce((l,c)=>Math.max(l,o.measureText(c.title+(c.description||"")).width+this._getAdditionalWidth(c)),0);e=Math.ceil(Math.max(s,80))}Math.ceil(this._splitView.getViewSize(this._tabTreeIndex))===e&&(e=46),this._splitView.resizeView(this._tabTreeIndex,e),this._updateListWidth(e)}_getAdditionalWidth(e){let o=e.statusList.statuses.length>0?30:0;return 40+((this._terminalGroupService.getGroupForInstance(e)?.terminalInstances.length||0)>1?30:0)+o}_handleOnDidSashChange(){let e=this._splitView.getViewSize(this._tabTreeIndex);!this._width||e<=0||this._updateListWidth(e)}_updateListWidth(e){e<63&&e>=46?(e=46,this._splitView.resizeView(this._tabTreeIndex,e)):e>=63&&e<80&&(e=80,this._splitView.resizeView(this._tabTreeIndex,e)),this.rerenderTabs();let t=this._panelOrientation===0?"tabs-list-width-vertical":"tabs-list-width-horizontal";this._storageService.store(t,e,0,0)}_setupSplitView(e){this._register(this._splitView.onDidSashReset(()=>this._handleOnDidSashReset())),this._register(this._splitView.onDidSashChange(()=>this._handleOnDidSashChange())),this._shouldShowTabs()&&this._addTabTree(),this._splitView.addView({element:e,layout:t=>this._terminalGroupService.groups.forEach(o=>o.layout(t,this._height||0)),minimumSize:120,maximumSize:Number.POSITIVE_INFINITY,onDidChange:()=>x.None,priority:2},Gl.Distribute,this._terminalContainerIndex),this._shouldShowTabs()&&this._addSashListener()}_addTabTree(){this._splitView.addView({element:this._tabContainer,layout:e=>this._tabList.layout(this._height||0,e),minimumSize:46,maximumSize:500,onDidChange:()=>x.None,priority:1},Gl.Distribute,this._tabTreeIndex),this.rerenderTabs()}rerenderTabs(){this._updateHasText(),this._tabList.refresh()}_addSashListener(){let e;this._sashDisposables=[this._splitView.sashes[0].onDidStart(t=>{e=zI(Re(this._splitView.el),()=>{this.rerenderTabs()},100)}),this._splitView.sashes[0].onDidEnd(t=>{e.dispose()})]}_removeSashListener(){this._sashDisposables&&(Be(this._sashDisposables),this._sashDisposables=void 0)}_updateHasText(){let e=this._tabListElement.clientWidth>63;this._tabContainer.classList.toggle("has-text",e),this._terminalIsTabsNarrowContextKey.set(!e),this._updateChatTerminalsEntry()}layout(e,t){let o=this._chatEntry?.element.style.display==="none"?0:this._chatEntry?.element.clientHeight;this._height=t-(o??0),this._width=e,this._splitView.layout(e),this._shouldShowTabs()&&this._splitView.resizeView(this._tabTreeIndex,this._getLastListWidth()),this._updateHasText()}_attachEventListeners(e,t){this._register(j(this._tabContainer,"mouseleave",async o=>{this._terminalTabsMouseContextKey.set(!1),this._refreshShowTabs(),o.stopPropagation()})),this._register(j(this._tabContainer,"mouseenter",async o=>{this._terminalTabsMouseContextKey.set(!0),o.stopPropagation()})),this._register(j(this._tabContainer,"dragenter",o=>{if(!this._shouldHandleEmptyAreaDrop(o)){this._resetEmptyAreaDropState();return}this._emptyAreaDropTargetCount++,this._setEmptyAreaDropState(!0)})),this._register(j(this._tabContainer,"dragover",o=>{if(!this._shouldHandleEmptyAreaDrop(o)){this._resetEmptyAreaDropState();return}o.preventDefault(),this._setEmptyAreaDropState(!0),o.dataTransfer&&(o.dataTransfer.dropEffect="move")})),this._register(j(this._tabContainer,"dragleave",o=>{if(!this._shouldHandleEmptyAreaDrop(o)){this._tabContainer.contains(o.relatedTarget)||this._resetEmptyAreaDropState();return}this._tabContainer.contains(o.relatedTarget)||(this._emptyAreaDropTargetCount=Math.max(0,this._emptyAreaDropTargetCount-1),this._emptyAreaDropTargetCount===0&&this._resetEmptyAreaDropState())})),this._register(j(this._tabContainer,"drop",o=>{this._shouldHandleEmptyAreaDrop(o)&&this._handleContainerDrop(o)})),this._register(j(t,"mousedown",async o=>{let n=this._terminalGroupService.activeInstance;if(this._terminalGroupService.instances.length>0&&n){let r=await n.handleMouseEvent(o,this._instanceMenu);typeof r=="object"&&r.cancelContextMenu&&(this._cancelContextMenu=!0)}})),this._register(j(t,"contextmenu",o=>{this._terminalConfigurationService.config.rightClickBehavior==="nothing"&&!o.shiftKey&&(this._cancelContextMenu=!0),t.focus(),this._cancelContextMenu||M6(Re(t),o,this._terminalGroupService.activeInstance,this._instanceMenu,this._contextMenuService),o.preventDefault(),o.stopImmediatePropagation(),this._cancelContextMenu=!1})),this._register(j(this._tabContainer,"contextmenu",o=>{if(this._terminalConfigurationService.config.rightClickBehavior==="nothing"&&!o.shiftKey&&(this._cancelContextMenu=!0),!this._cancelContextMenu){let r=this._tabList.getFocus().length===0;r||(this._terminalGroupService.lastAccessedMenu="tab-list");let s=this._tabList.getSelectedElements(),l=this._tabList.getFocusedElements()?.[0];l&&(s.splice(s.findIndex(c=>c.instanceId===l.instanceId),1),s.unshift(l)),M6(Re(this._tabContainer),o,s,r?this._tabsListEmptyMenu:this._tabsListMenu,this._contextMenuService,r?this._getTabActions():void 0)}o.preventDefault(),o.stopImmediatePropagation(),this._cancelContextMenu=!1})),this._register(j(t.ownerDocument,"keydown",o=>{t.classList.toggle("alt-active",!!o.altKey)})),this._register(j(t.ownerDocument,"keyup",o=>{t.classList.toggle("alt-active",!!o.altKey)})),this._register(j(e,"keyup",o=>{o.keyCode===27&&o.stopPropagation()})),this._register(j(this._tabContainer,re.FOCUS_IN,()=>{this._terminalTabsFocusContextKey.set(!0)})),this._register(j(this._tabContainer,re.FOCUS_OUT,()=>{this._terminalTabsFocusContextKey.set(!1)}))}_shouldHandleEmptyAreaDrop(e){let t=e.target;return t&&(this._tabListDomElement.contains(t)||this._tabListElement.contains(t))?!1:!!e.dataTransfer&&Ip(e,"Terminals")}_setEmptyAreaDropState(e){this._tabListContainer.classList.toggle("drop-target",e),this._tabContainer.classList.toggle("drop-target",e),this._chatEntry?.element.classList.toggle("drop-target",e)}_resetEmptyAreaDropState(){this._emptyAreaDropTargetCount=0,this._setEmptyAreaDropState(!1)}async _handleContainerDrop(e){e.preventDefault(),e.stopPropagation(),this._resetEmptyAreaDropState();let t=this._terminalService.getPrimaryBackend(),o=cHe(e),n,r=[];if(o)for(let l of o){let c=this._terminalService.getInstanceFromResource(l);if(c)n?n.push(c):n=[c],this._terminalService.moveToTerminalView(c);else if(t){let u=Rq(l);u.instanceId&&r.push(t.requestDetachInstance(u.workspaceId,u.instanceId))}}if(r.length){let l=(await Promise.all(r)).filter(u=>!!u),c;for(let u of l)c=await this._terminalService.createTerminal({config:{attachPersistentProcess:u}});c&&this._terminalService.setActiveInstance(c);return}if((!n||!n.length)&&(n=this._tabList.getSelectedElements(),!n.length))return;this._terminalGroupService.moveGroupToEnd(n),this._terminalService.setActiveInstance(n[0]);let s=n.map(l=>this._terminalGroupService.instances.indexOf(l)).filter(l=>l>=0);s.length&&(this._tabList.setSelection(s),this._tabList.setFocus([s[0]]))}_getTabActions(){return[new ri,this._configurationService.inspect("terminal.integrated.tabs.location").userValue==="left"?new it("moveRight",d(14891,null),void 0,void 0,async()=>{this._configurationService.updateValue("terminal.integrated.tabs.location","right")}):new it("moveLeft",d(14890,null),void 0,void 0,async()=>{this._configurationService.updateValue("terminal.integrated.tabs.location","left")}),new it("hideTabs",d(14889,null),void 0,void 0,async()=>{this._configurationService.updateValue("terminal.integrated.tabs.enabled",!1)})]}setEditable(e){e||this._tabList.domFocus(),this._tabList.refresh(!1)}focusTabs(){if(!this._shouldShowTabs())return;this._terminalTabsFocusContextKey.set(!0);let e=this._tabList.getSelection();this._tabList.domFocus(),e&&this._tabList.setFocus(e)}focus(){if(this._terminalService.connectionState===1){this._focus();return}let e=this._tabListElement.ownerDocument.activeElement;if(e){let t=this._register(U.once(this._terminalService.onDidChangeConnectionState)(()=>{wa(e)&&this._focus(),this._store.delete(t)}))}}focusHover(){if(this._shouldShowTabs()){this._tabList.focusHover();return}let e=this._terminalGroupService.activeInstance;e&&this._hoverService.showInstantHover({...ibe(e,this._storageService),target:this._terminalContainer,trapFocus:!0},!0)}_focus(){this._terminalGroupService.activeInstance?.focusWhenReady()}};T1e=I([m(1,nn),m(2,Wv),m(3,Uu),m(4,lc),m(5,F),m(6,Xe),m(7,B),m(8,Kt),m(9,ce),m(10,X),m(11,nt)],T1e);var _1e=class extends Gs{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w){super(e,t,s,r,o,n,l,b,h,g);this._contextKeyService=o;this._configurationService=r;this._instantiationService=l;this._terminalService=c;this._terminalConfigurationService=u;this._terminalGroupService=p;this._notificationService=f;this._keybindingService=v;this._menuService=S;this._terminalProfileService=y;this._terminalProfileResolverService=w;this._isInitialized=!1;this._isTerminalBeingCreated=!1;this._newDropdown=this._register(new me);this._disposableStore=this._register(new N);this._actionDisposables=this._register(new Vt);this._register(this._terminalService.onDidRegisterProcessSupport(()=>{this._onDidChangeViewWelcomeState.fire()})),this._register(this._terminalService.onDidChangeInstances(()=>{this._hasWelcomeScreen()&&this._terminalGroupService.instances.length<=1&&this._onDidChangeViewWelcomeState.fire(),this._parentDomElement&&(this._terminalTabbedView||this._createTabsView(),this.layoutBody(this._parentDomElement.offsetHeight,this._parentDomElement.offsetWidth))})),this._dropdownMenu=this._register(this._menuService.createMenu(D.TerminalNewDropdownContext,this._contextKeyService)),this._singleTabMenu=this._register(this._menuService.createMenu(D.TerminalTabContext,this._contextKeyService)),this._register(this._terminalProfileService.onDidChangeAvailableProfiles(T=>this._updateTabActionBar(T))),this._viewShowing=dt.viewShowing.bindTo(this._contextKeyService),this._register(this.onDidChangeBodyVisibility(T=>{T&&this._terminalTabbedView?.rerenderTabs()})),this._register(this._configurationService.onDidChangeConfiguration(T=>{this._parentDomElement&&(T.affectsConfiguration("terminal.integrated.shellIntegration.decorationsEnabled")||T.affectsConfiguration("terminal.integrated.shellIntegration.enabled"))&&this._updateForShellIntegration(this._parentDomElement)}));let k=this._register(new me);k.value=this._terminalService.onAnyInstanceAddedCapabilityType(T=>{T===2&&this._gutterDecorationsEnabled()&&(this._parentDomElement?.classList.add("shell-integration"),k.clear())})}get terminalTabbedView(){return this._terminalTabbedView}_updateForShellIntegration(e){e.classList.toggle("shell-integration",this._gutterDecorationsEnabled())}_gutterDecorationsEnabled(){let e=this._configurationService.getValue("terminal.integrated.shellIntegration.decorationsEnabled");return(e==="both"||e==="gutter")&&this._configurationService.getValue("terminal.integrated.shellIntegration.enabled")}_initializeTerminal(e){if(this.isBodyVisible()&&this._terminalService.isProcessSupportRegistered&&this._terminalService.connectionState===1){let t=this._isInitialized;this._isInitialized=!0;let o="never";t||(o=this._configurationService.getValue("terminal.integrated.hideOnStartup"),o==="always"&&this._terminalGroupService.hidePanel());let n=this._terminalGroupService.groups.length===0;if(e&&(n&&=this._terminalService.restoredGroupCount===0),!n)return;if(!t){switch(o){case"never":this._isTerminalBeingCreated=!0,this._terminalService.createTerminal({location:1}).finally(()=>this._isTerminalBeingCreated=!1);break;case"whenEmpty":this._terminalService.restoredGroupCount===0&&this._terminalGroupService.hidePanel();break}return}this._isTerminalBeingCreated||(this._isTerminalBeingCreated=!0,this._terminalService.createTerminal({location:1}).finally(()=>this._isTerminalBeingCreated=!1))}}renderBody(e){super.renderBody(e),this._parentDomElement||this._updateForShellIntegration(e),this._parentDomElement=e,this._parentDomElement.classList.add("integrated-terminal"),Cr(this._parentDomElement),this._instantiationService.createInstance(yct,this._parentDomElement),this.shouldShowWelcome()||this._createTabsView(),this._register(this.configurationService.onDidChangeConfiguration(t=>{if((t.affectsConfiguration("terminal.integrated.fontFamily")||t.affectsConfiguration("editor.fontFamily"))&&!this._terminalConfigurationService.configFontIsMonospace()){let o=[{label:d(14909,null),run:()=>this.configurationService.updateValue("terminal.integrated.fontFamily","monospace")}];this._notificationService.prompt(ft.Warning,d(14908,null),o)}})),this._register(this.onDidChangeBodyVisibility(async t=>{if(this._viewShowing.set(t),t)this._hasWelcomeScreen()&&this._onDidChangeViewWelcomeState.fire(),this._initializeTerminal(!1),this._terminalGroupService.showPanel(!1);else for(let o of this._terminalGroupService.instances)o.resetFocusContextKey();this._terminalGroupService.updateVisibility()})),this._register(this._terminalService.onDidChangeConnectionState(()=>this._initializeTerminal(!0))),this.layoutBody(this._parentDomElement.offsetHeight,this._parentDomElement.offsetWidth)}_createTabsView(){this._parentDomElement&&(this._terminalTabbedView=this._register(this.instantiationService.createInstance(T1e,this._parentDomElement)))}layoutBody(e,t){super.layoutBody(e,t),this._terminalTabbedView?.layout(t,e)}createActionViewItem(e,t){switch(e.id){case"workbench.action.terminal.split":{let o=this,n=new N,r=n.add(new class extends it{constructor(){super(e.id,e.label,e.class,e.enabled),this.checked=e.checked,this.tooltip=e.tooltip}async run(){let l=o._terminalGroupService.activeInstance;if(l)return(await o._terminalService.createTerminal({location:{parentTerminal:l}}))?.focusWhenReady()}}),s=n.add(new hs(e,r,{...t,icon:!0,label:!1,keybinding:this._getKeybindingLabel(e)}));return this._actionDisposables.set(e.id,n),s}case"workbench.action.terminal.switchTerminal":{let o=this._instantiationService.createInstance(Sct,e);return this._actionDisposables.set(e.id,o),o}case"workbench.action.terminal.focus":{if(e instanceof Lo){let o=tu(this._singleTabMenu.getActions({shouldForwardArgs:!0})),n=this._instantiationService.createInstance(Ict,e,o);return this._actionDisposables.set(e.id,n),n}break}case"workbench.action.terminal.new":if(e instanceof Lo){this._disposableStore.clear();let o=h1e(1,this._terminalProfileService.availableProfiles,this._getDefaultProfileName(),this._terminalProfileService.contributedProfiles,this._terminalService,this._dropdownMenu,this._disposableStore);return this._newDropdown.value=this._instantiationService.createInstance(Jw,e,o.dropdownAction,o.dropdownMenuActions,o.className,{hoverDelegate:t.hoverDelegate,getKeyBinding:n=>this._keybindingService.lookupKeybinding(n.id,this._contextKeyService)}),this._newDropdown.value?.update(o.dropdownAction,o.dropdownMenuActions),this._newDropdown.value}}return super.createActionViewItem(e,t)}_getDefaultProfileName(){let e;try{e=this._terminalProfileService.getDefaultProfileName()}catch{e=this._terminalProfileResolverService.defaultProfileName}return e}_getKeybindingLabel(e){return this._keybindingService.lookupKeybinding(e.id)?.getLabel()??void 0}_updateTabActionBar(e){this._disposableStore.clear();let t=h1e(1,e,this._getDefaultProfileName(),this._terminalProfileService.contributedProfiles,this._terminalService,this._dropdownMenu,this._disposableStore);this._newDropdown.value?.update(t.dropdownAction,t.dropdownMenuActions)}focus(){if(super.focus(),this._terminalService.connectionState===1){this._terminalGroupService.instances.length===0&&!this._isTerminalBeingCreated&&(this._isTerminalBeingCreated=!0,this._terminalService.createTerminal({location:1}).finally(()=>this._isTerminalBeingCreated=!1)),this._terminalGroupService.showPanel(!0);return}let e=this.element.ownerDocument.activeElement;if(e){let t=this._register(U.once(this._terminalService.onDidChangeConnectionState)(()=>{e&&wa(e)&&this._terminalGroupService.showPanel(!0),this._store.delete(t)}))}}_hasWelcomeScreen(){return!this._terminalService.isProcessSupportRegistered}shouldShowWelcome(){return this._hasWelcomeScreen()&&this._terminalService.instances.length===0}};_1e=I([m(1,_e),m(2,X),m(3,Bi),m(4,B),m(5,Xe),m(6,F),m(7,nn),m(8,Uu),m(9,lc),m(10,Le),m(11,nt),m(12,Ne),m(13,_e),m(14,Je),m(15,Kt),m(16,vy),m(17,Ag)],_1e);var Sct=class extends kz{constructor(e,t,o,n,r,s){super(null,e,tDo(t,o),o.activeGroupIndex,n,WE,{ariaLabel:d(14911,null),optionsAsChildren:!0,useCustomDrawn:!oI(s)});this._terminalService=t;this._terminalGroupService=o;this._register(t.onDidChangeInstances(()=>this._updateItems(),this)),this._register(t.onDidChangeActiveGroup(()=>this._updateItems(),this)),this._register(t.onDidChangeActiveInstance(()=>this._updateItems(),this)),this._register(t.onAnyInstanceTitleChange(()=>this._updateItems(),this)),this._register(o.onDidChangeGroups(()=>this._updateItems(),this)),this._register(t.onDidChangeConnectionState(()=>this._updateItems(),this)),this._register(r.onDidChangeAvailableProfiles(()=>this._updateItems(),this)),this._register(t.onAnyInstancePrimaryStatusChange(()=>this._updateItems(),this))}render(e){super.render(e),e.classList.add("switch-terminal"),e.style.borderColor=kt(TO)}_updateItems(){let e=tDo(this._terminalService,this._terminalGroupService);this.setOptions(e,this._terminalGroupService.activeGroupIndex)}};Sct=I([m(1,nn),m(2,lc),m(3,Wn),m(4,vy),m(5,B)],Sct);function tDo(a,i){let e;return a.connectionState===1?e=i.getGroupLabels().map(t=>({text:t})):e=[{text:d(14910,null)}],e.push(UO),e.push({text:VVi}),e}var Ict=class extends xl{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super(e,{draggable:!0,hoverDelegate:g.createInstance(wct)},o,n,r,s,p,f);this._actions=t;this._terminalService=l;this._terminaConfigurationService=c;this._terminalGroupService=u;this._commandService=h;this._instantiationService=g;this._elementDisposables=[];this._register(U.debounce(U.any(this._terminalService.onAnyInstancePrimaryStatusChange,this._terminalGroupService.onDidChangeActiveInstance,U.map(this._terminalService.onAnyInstanceIconChange,v=>v.instance),this._terminalService.onAnyInstanceTitleChange,this._terminalService.onDidChangeInstanceCapability),(v,b)=>(v||(v=new Set),b&&v.add(b),v),ML)(v=>{for(let b of v)this.updateLabel(b)})),this._register(Z(()=>Be(this._elementDisposables)))}async onClick(e){this._terminalGroupService.lastAccessedMenu="inline-tab",e.altKey&&this._menuItemAction.alt?this._commandService.executeCommand(this._menuItemAction.alt.id,{location:1}):this._openContextMenu()}updateLabel(e){if(!(e&&e!==this._terminalGroupService.activeInstance)&&(this._elementDisposables.length===0&&this.element&&this.label&&(this._elementDisposables.push(j(this.element,re.CONTEXT_MENU,t=>{t.button===2&&(this._openContextMenu(),t.stopPropagation(),t.preventDefault())})),this._elementDisposables.push(j(this.element,re.AUXCLICK,t=>{if(t.button===1){let o=this._terminalGroupService.activeInstance;o&&this._terminalService.safeDisposeTerminal(o),t.preventDefault()}})),this._elementDisposables.push(j(this.element,re.DRAG_START,t=>{let o=this._terminalGroupService.activeInstance;t.dataTransfer&&o&&t.dataTransfer.setData("Terminals",JSON.stringify([o.resource.toString()]))}))),this.label)){let t=this.label,o=this._terminalGroupService.activeInstance;if(!o){vi(t,"");return}t.classList.add("single-terminal-tab");let n="",r=o.statusList.primary;if(r){let c=X3t(r.severity);this._themeService.getColorTheme();let u=this._themeService.getColorTheme().getColor(c);u&&(n=u.toString())}t.style.color=n,vi(t,...Un(this._instantiationService.invokeFunction(rgn,o,this._terminaConfigurationService.config.tabs.separator,q.isThemeIcon(this._commandAction.item.icon)?this._commandAction.item.icon:void 0))),this._altCommand&&(t.classList.remove(this._altCommand),this._altCommand=void 0),this._color&&(t.classList.remove(this._color),this._color=void 0),this._class&&(t.classList.remove(this._class),t.classList.remove("terminal-uri-icon"),this._class=void 0);let s=by(o);s&&(this._color=s,t.classList.add(s));let l=SD(o,this._themeService.getColorTheme().type);l&&(this._class=l?.[0],t.classList.add(...l)),this._commandAction.item.icon&&(this._altCommand="alt-command",t.classList.add(this._altCommand)),this.updateTooltip()}}_openContextMenu(){let e=new tbe;this._contextMenuService.showContextMenu({actionRunner:e,getAnchor:()=>this.element,getActions:()=>this._actions,getActionsContext:()=>{let t=this._terminalGroupService.activeInstance;return t?[new R6(t)]:[]},onHide:()=>e.dispose()})}};Ict=I([m(2,_e),m(3,Ne),m(4,X),m(5,Le),m(6,nn),m(7,Uu),m(8,lc),m(9,Xe),m(10,ge),m(11,F),m(12,Oi)],Ict);function rgn(a,i,e,t){if(!i||!i.title)return"";let o=q.isThemeIcon(i.icon)?i.icon.id:a.get(Ag).getDefaultIcon().id,n=`$(${t?.id||o}) ${sgn(i,e)}`,r=i.statusList.primary;return r?.icon?`${n} $(${r.icon.id})`:n}function sgn(a,i){return a?a.description?`${a.title} ${i} ${a.description}`:a.title:""}var yct=class extends yu{constructor(e,t,o,n){super(t);this._themeService=t;this._terminalService=o;this._terminalGroupService=n;this._registerListeners(),this._styleElement=Cr(e),this._register(Z(()=>this._styleElement.remove())),this.updateStyles()}_registerListeners(){this._register(this._terminalService.onAnyInstanceIconChange(()=>this.updateStyles())),this._register(this._terminalService.onDidChangeInstances(()=>this.updateStyles())),this._register(this._terminalGroupService.onDidChangeGroups(()=>this.updateStyles()))}updateStyles(){super.updateStyles();let e=this._themeService.getColorTheme(),t="";for(let o of this._terminalService.instances){let n=o.icon;if(!n)continue;let r;n instanceof A?r=n:n instanceof Object&&No(n,{light:!0,dark:!0})&&(r=Bp(e.type)?n.dark:n.light);let s=SD(o,e.type);r instanceof A&&s&&s.length>1&&(t+=`.monaco-workbench .${s[0]} .monaco-highlighted-label .codicon, .monaco-action-bar .terminal-uri-icon.single-terminal-tab.action-label:not(.alt-command) .codicon{background-image: ${Qa(r)};}`)}for(let o of this._terminalService.instances){let n=by(o);if(!n||!o.color)continue;let r=e.getColor(o.color);r&&(t+=`.monaco-workbench .${n} .codicon:first-child:not(.codicon-split-horizontal):not(.codicon-trashcan):not(.file-icon):not(.codicon-rerun-task){ color: ${r} !important; }`)}this._styleElement.textContent=t}};yct=I([m(1,Le),m(2,nn),m(3,lc)],yct);var wct=class{constructor(i,e,t,o){this._configurationService=i;this._hoverService=e;this._storageService=t;this._terminalGroupService=o;this._lastHoverHideTime=0;this.placement="element"}get delay(){return Date.now()-this._lastHoverHideTime<200?0:this._configurationService.getValue("workbench.hover.delay")}showHover(i,e){let t=this._terminalGroupService.activeInstance;if(!t)return;let o=ibe(t,this._storageService);return this._hoverService.showInstantHover({...i,content:o.content,actions:o.actions},e)}onDidHideHover(){this._lastHoverHideTime=Date.now()}};wct=I([m(0,B),m(1,nt),m(2,ce),m(3,lc)],wct);Ee(ca,n1e,1);Ee(Uu,m1e,1);Ee(nn,rC,1);Ee(Fv,v1e,1);Ee(DJ,r1e,1);Ee(lc,S1e,1);Ee(Nm,sbe,1);Ee(vy,lbe,1);It(abe.ID,abe,St.BlockStartup);It(Zve.ID,Zve,St.AfterRestored);It(cbe.ID,cbe,St.AfterRestored);Lio();x_o(hSt);ne.as(qo.EditorFactory).registerEditorSerializer(xf.ID,f1e);ne.as(qo.EditorPane).registerEditorPane(Br.create(g1e,JK,sr.terminal),[new Ft(xf)]);ne.as(OV.DragAndDropContribution).register({dataFormatKey:"Terminals",getEditorInputs(a){let i=[];try{let e=JSON.parse(a);for(let t of e)i.push({resource:A.parse(t)})}catch{}return i},setData(a,i){let e=a.filter(({resource:t})=>t.scheme===Q.vscodeTerminal);e.length&&i.dataTransfer?.setData("Terminals",JSON.stringify(e.map(({resource:t})=>t.toString())))}});var agn=ne.as(Mn.ViewContainersRegistry).registerViewContainer({id:Sc,title:L(14735,"Terminal"),icon:QDi,ctorDescriptor:new Ft(Dc,[Sc,{mergeViewWithContainerWhenSingleView:!0}]),storageId:Sc,hideIfEmpty:!0,order:3,windowVisibility:3},1,{doNotRegisterOpenCommand:!0,isDefault:!0});ne.as(Mn.ViewsRegistry).registerViews([{id:Sc,name:L(14735,"Terminal"),containerIcon:QDi,canToggleVisibility:!0,canMoveView:!0,ctorDescriptor:new Ft(_1e),windowVisibility:3,openCommandActionDescriptor:{id:"workbench.action.terminal.toggleTerminal",mnemonicTitle:d(14734,null),keybindings:{primary:2139,mac:{primary:347}},order:3}}],agn);B_o();z_o();q_o();uoo();var lre=class extends x{constructor(e,t){super();this._extensionService=e;this._storageService=t;this.collections=new Map;this._onDidChangeCollections=this._register(new E);this._storageService.remove("terminal.integrated.environmentVariableCollections",1);let o=this._storageService.get("terminal.integrated.environmentVariableCollectionsV2",1);o&&(JSON.parse(o).forEach(r=>this.collections.set(r.extensionIdentifier,{persistent:!0,map:tYe(r.collection),descriptionMap:iYe(r.description)})),this._invalidateExtensionCollections()),this.mergedCollection=this._resolveMergedCollection(),this._register(this._extensionService.onDidChangeExtensions(()=>this._invalidateExtensionCollections()))}get onDidChangeCollections(){return this._onDidChangeCollections.event}set(e,t){this.collections.set(e,t),this._updateCollections()}delete(e){this.collections.delete(e),this._updateCollections()}_updateCollections(){this._persistCollectionsEventually(),this.mergedCollection=this._resolveMergedCollection(),this._notifyCollectionUpdatesEventually()}_persistCollectionsEventually(){this._persistCollections()}_persistCollections(){let e=[];this.collections.forEach((o,n)=>{o.persistent&&e.push({extensionIdentifier:n,collection:Gue(this.collections.get(n).map),description:eYe(o.descriptionMap)})});let t=JSON.stringify(e);this._storageService.store("terminal.integrated.environmentVariableCollectionsV2",t,1,1)}_notifyCollectionUpdatesEventually(){this._notifyCollectionUpdates()}_notifyCollectionUpdates(){this._onDidChangeCollections.fire(this.mergedCollection)}_resolveMergedCollection(){return new I1e(this.collections)}async _invalidateExtensionCollections(){await this._extensionService.whenInstalledExtensionsRegistered();let e=this._extensionService.extensions,t=!1;this.collections.forEach((o,n)=>{e.some(s=>s.identifier.value===n)||(this.collections.delete(n),t=!0)}),t&&this._updateCollections()}};I([_P(1e3)],lre.prototype,"_persistCollectionsEventually",1),I([Zd(1e3)],lre.prototype,"_notifyCollectionUpdatesEventually",1),lre=I([m(0,lt),m(1,ce)],lre);Ee(c2,lre,1);Ee(x1e,r8t,1);var D1e=class extends x{constructor(e,t,o){super();this._xterm=e;this._configurationService=t;this._logService=o;this._priorEditorViewportLineCount=0;this._lines=[];this.bufferToEditorLineMapping=new Map}get lines(){return this._lines}reset(){this._lines=[],this._lastCachedMarker=void 0,this.update()}update(){this._lastCachedMarker?.isDisposed&&(this._lines=[],this._lastCachedMarker=void 0),this._removeViewportContent(),this._updateCachedContent(),this._updateViewportContent(),this._lastCachedMarker=this._register(this._xterm.raw.registerMarker()),this._logService.debug("Buffer content tracker: set ",this._lines.length," lines")}_updateCachedContent(){let e=this._xterm.raw.buffer.active,t=this._lastCachedMarker?.line?this._lastCachedMarker.line-this._xterm.raw.rows+1:0,o=e.baseY;if(t<0||t>o)return;let r=this._configurationService.getValue("terminal.integrated.scrollback")+this._xterm.raw.rows-1,s=o-t;if(s+this._lines.length>r){let u=s+this._lines.length-r;for(let p=0;p<u;p++)this._lines.shift();this._logService.debug("Buffer content tracker: removed ",u," lines from top of cached lines, now ",this._lines.length," lines")}let l=[],c="";for(let u=t;u<o;u++){let p=e.getLine(u);if(!p)continue;this.bufferToEditorLineMapping.set(u,this._lines.length+l.length);let h=e.getLine(u+1)?.isWrapped;c+=p.translateToString(!h),(c&&!h||u===e.baseY+this._xterm.raw.rows-1)&&p.length&&(l.push(c),c="")}this._logService.debug("Buffer content tracker:",l.length," lines cached"),this._lines.push(...l)}_removeViewportContent(){if(!this._lines.length)return;let e=this._priorEditorViewportLineCount,t=1;for(;e;)this.bufferToEditorLineMapping.forEach((o,n)=>{o===this._lines.length-t&&this.bufferToEditorLineMapping.delete(n)}),this._lines.pop(),t++,e--;this._logService.debug("Buffer content tracker: removed lines from viewport, now ",this._lines.length," lines cached")}_updateViewportContent(){let e=this._xterm.raw.buffer.active;this._priorEditorViewportLineCount=0;let t="";for(let o=e.baseY;o<e.baseY+this._xterm.raw.rows;o++){let n=e.getLine(o);if(!n)continue;this.bufferToEditorLineMapping.set(o,this._lines.length);let r=e.getLine(o+1)?.isWrapped;t+=n.translateToString(!r),(t&&!r||o===e.baseY+this._xterm.raw.rows-1)&&t.length&&(this._priorEditorViewportLineCount++,this._lines.push(t),t="")}this._logService.debug("Viewport content update complete, ",this._lines.length," lines in the viewport")}};D1e=I([m(1,B),m(2,ca)],D1e);var dbe=class extends x{constructor(e,t,o,n,r){super();this._instance=e;this._commandService=o;this._configurationService=n;this._contextKeyService=r;this.id="terminal-help";this._hasShellIntegration=!1;this.options={type:"help",readMoreUrl:"https://code.visualstudio.com/docs/editor/accessibility#_terminal-accessibility"};this.verbositySettingKey="accessibility.verbosity.terminal";this._hasShellIntegration=t.shellIntegration.status===2}onClose(){C.and(Dd,C.equals(cu.key,"terminal-help"))?.evaluate(this._contextKeyService.getContext(null))?this._commandService.executeCommand("workbench.action.terminal.focusAccessibleBuffer"):this._instance.focus(),this.dispose()}provideContent(){let e=[d(15188,null,"workbench.action.terminal.focusAccessibleBuffer"),d(15198,null),d(15197,null,"workbench.action.terminal.openDetectedLink"),d(15195,null,"workbench.action.terminal.newWithProfile"),d(15189,null,"terminal.integrated.focusAfterRun")];return this._configurationService.getValue("terminal.integrated.accessibleViewFocusOnCommandExecution")||e.push(d(15190,null)),this._configurationService.getValue("terminal.integrated.suggest.enabled")&&(e.push(d(15206,null,"workbench.action.terminal.triggerSuggest")),e.push(d(15201,null)),e.push(d(15202,null,"workbench.action.terminal.acceptSelectedSuggestion","workbench.action.terminal.configureSuggestSettings")),e.push(d(15203,null,"workbench.action.terminal.suggestToggleDetails","workbench.action.terminal.suggestToggleDetailsFocus")),e.push(d(15205,null,"workbench.action.terminal.suggestLearnMore")),e.push(d(15204,null,"workbench.action.terminal.configureSuggestSettings"))),this._instance.shellType==="cmd"&&e.push(d(15187,null)),this._hasShellIntegration?(e.push(d(15200,null)),e.push("- "+d(15191,null,"workbench.action.terminal.accessibleBufferGoToNextCommand")),e.push("- "+d(15192,null,"workbench.action.terminal.accessibleBufferGoToPreviousCommand")),e.push("- "+d(15194,null,"editor.action.accessibleViewGoToSymbol")),e.push("- "+d(15199,null,"workbench.action.terminal.runRecentCommand")),e.push("- "+d(15193,null,"workbench.action.terminal.goToRecentDirectory"))):e.push(d(15196,null)),e.join(`
`)}};dbe=I([m(2,ge),m(3,B),m(4,X)],dbe);var L1e=class extends x{constructor(e,t,o,n,r){super();this._instance=e;this._bufferTracker=t;this.id="terminal";this.options={type:"view",language:"terminal",id:"terminal"};this.verbositySettingKey="accessibility.verbosity.terminal";this._onDidRequestClearProvider=this._register(new E);this.onDidRequestClearLastProvider=this._onDidRequestClearProvider.event;this.options.customHelp=o,this.options.position=n.getValue("terminal.integrated.accessibleViewPreserveCursorPosition")?"initial-bottom":"bottom",this._register(this._instance.onDisposed(()=>this._onDidRequestClearProvider.fire("terminal"))),this._register(n.onDidChangeConfiguration(s=>{s.affectsConfiguration("terminal.integrated.accessibleViewPreserveCursorPosition")&&(this.options.position=n.getValue("terminal.integrated.accessibleViewPreserveCursorPosition")?"initial-bottom":"bottom")})),this._focusedInstance=r.activeInstance,this._register(r.onDidChangeActiveInstance(()=>{r.activeInstance&&this._focusedInstance?.instanceId!==r.activeInstance?.instanceId&&(this._onDidRequestClearProvider.fire("terminal"),this._focusedInstance=r.activeInstance)}))}onClose(){this._instance.focus()}provideContent(){return this._bufferTracker.update(),this._bufferTracker.lines.join(`
`)}getSymbols(){let e=this._getCommandsWithEditorLine()??[],t=[];for(let o of e){let n=o.command.command;n&&t.push({label:n,lineNumber:o.lineNumber})}return t}_getCommandsWithEditorLine(){let e=this._instance.capabilities.get(2),t=e?.commands,o=e?.currentCommand;if(!t?.length)return;let n=[];for(let r of t){let s=this._getEditorLineForCommand(r);s!==void 0&&n.push({command:r,lineNumber:s,exitCode:r.exitCode})}if(o){let r=this._getEditorLineForCommand(o);r!==void 0&&n.push({command:o,lineNumber:r})}return n}_getEditorLineForCommand(e){let t;if(nC(e)?t=e.marker?.line:t=e.commandStartMarker?.line,!(t===void 0||t<0)&&(t=this._bufferTracker.bufferToEditorLineMapping.get(t),t!==void 0))return t+1}};L1e=I([m(3,B),m(4,nn)],L1e);var cre=class extends x{constructor(e,t,o,n){super();this._capabilities=e;this._accessibilityService=t;this._configurationService=o;this._logService=n;this._listeners=this._register(new me);this._register(U.runAndSubscribe(U.any(this._capabilities.onDidChangeCapabilities,this._accessibilityService.onDidChangeScreenReaderOptimized),()=>{this._refreshListeners()}))}activate(e){this._terminal=e,this._refreshListeners()}_refreshListeners(){let e=this._capabilities.get(2);if(this._shouldBeActive()&&e){if(!this._listeners.value){let t=this._terminal?.textarea;t&&(this._listeners.value=U.runAndSubscribe(e.promptInputModel.onDidChangeInput,()=>this._sync(t)))}}else this._listeners.clear()}_shouldBeActive(){return this._accessibilityService.isScreenReaderOptimized()||this._configurationService.getValue("terminal.integrated.developer.devMode")}_sync(e){let t=this._capabilities.get(2);t&&(e.value=t.promptInputModel.value,e.selectionStart=t.promptInputModel.cursorIndex,e.selectionEnd=t.promptInputModel.cursorIndex,this._logService.debug(`TextAreaSyncAddon#sync: text changed to "${e.value}"`))}};I([Zd(50)],cre.prototype,"_sync",1),cre=I([m(1,Oi),m(2,B),m(3,ca)],cre);var dre=class extends N{constructor(e,t){super();this._ctx=e;this._instantiationService=t}static{this.ID="terminal.textAreaSync"}static get(e){return e.getContribution(dre.ID)}layout(e){this._addon||(this._addon=this.add(this._instantiationService.createInstance(cre,this._ctx.instance.capabilities)),e.raw.loadAddon(this._addon),this._addon.activate(e.raw))}};dre=I([m(1,F)],dre);Mp(dre.ID,dre);var VU=class extends x{constructor(e,t,o,n,r,s,l){super();this._ctx=e;this._accessibilitySignalService=t;this._accessibleViewService=o;this._configurationService=n;this._contextKeyService=r;this._instantiationService=s;this._terminalService=l;this._onDidRunCommand=this._register(new me);this._register(mZ.addImplementation(90,"terminal",()=>this._terminalService.activeInstance!==this._ctx.instance?!1:(this.show(),!0),dt.focus)),this._register(this._ctx.instance.onDidExecuteText(()=>{let c=n.getValue("terminal.integrated.focusAfterRun");c==="terminal"?this._ctx.instance.focus(!0):c==="accessible-buffer"&&this.show()})),this._register(this._configurationService.onDidChangeConfiguration(c=>{c.affectsConfiguration("terminal.integrated.accessibleViewFocusOnCommandExecution")&&this._updateCommandExecutedListener()})),this._register(this._ctx.instance.capabilities.onDidAddCapability(c=>{c.capability.type===2&&this._updateCommandExecutedListener()}))}static{this.ID="terminal.accessibleBufferProvider"}static get(e){return e.getContribution(VU.ID)}xtermReady(e){let t=this._instantiationService.createInstance(cre,this._ctx.instance.capabilities);e.raw.loadAddon(t),t.activate(e.raw),this._xterm=e,this._register(this._xterm.raw.onWriteParsed(async()=>{this._terminalService.activeInstance===this._ctx.instance&&this._isTerminalAccessibleViewOpen()&&this._xterm.raw.buffer.active.baseY===0&&this.show()}));let o=U.latch(this._xterm.raw.onScroll);this._register(o(()=>{this._terminalService.activeInstance===this._ctx.instance&&this._isTerminalAccessibleViewOpen()&&this.show()}))}_updateCommandExecutedListener(){if(!this._ctx.instance.capabilities.has(2))return;if(this._configurationService.getValue("terminal.integrated.accessibleViewFocusOnCommandExecution")){if(this._onDidRunCommand.value)return}else{this._onDidRunCommand.clear();return}let e=this._ctx.instance.capabilities.get(2);this._onDidRunCommand.value=e.onCommandExecuted(()=>{this._ctx.instance.hasFocus&&this.show()})}_isTerminalAccessibleViewOpen(){return cu.getValue(this._contextKeyService)==="terminal"}show(){if(!this._xterm)return;this._bufferTracker||(this._bufferTracker=this._register(this._instantiationService.createInstance(D1e,this._xterm))),this._bufferProvider||(this._bufferProvider=this._register(this._instantiationService.createInstance(L1e,this._ctx.instance,this._bufferTracker,()=>this._register(this._instantiationService.createInstance(dbe,this._ctx.instance,this._xterm)).provideContent())));let e=this._configurationService.getValue("terminal.integrated.accessibleViewPreserveCursorPosition")?this._accessibleViewService.getPosition("terminal"):void 0;this._accessibleViewService.show(this._bufferProvider,e)}navigateToCommand(e){let t=this._accessibleViewService.getPosition("terminal")?.lineNumber,o=this._getCommandsWithEditorLine();if(!o?.length||!t)return;let n=e==="previous"?o.filter(l=>l.lineNumber<t).sort((l,c)=>c.lineNumber-l.lineNumber):o.filter(l=>l.lineNumber>t).sort((l,c)=>l.lineNumber-c.lineNumber);if(!n.length)return;let r=n[0],s=r.command.command;!ei&&s?(this._accessibleViewService.setPosition(new ye(r.lineNumber,1),!0),en(s)):this._accessibleViewService.setPosition(new ye(r.lineNumber,1),!0,!0),r.exitCode?this._accessibilitySignalService.playSignal($o.terminalCommandFailed):this._accessibilitySignalService.playSignal($o.terminalCommandSucceeded)}_getCommandsWithEditorLine(){let e=this._ctx.instance.capabilities.get(2),t=e?.commands,o=e?.currentCommand;if(!t?.length)return;let n=[];for(let r of t){let s=this._getEditorLineForCommand(r);s&&n.push({command:r,lineNumber:s,exitCode:r.exitCode})}if(o){let r=this._getEditorLineForCommand(o);r&&n.push({command:o,lineNumber:r})}return n}_getEditorLineForCommand(e){if(!this._bufferTracker)return;let t;if(nC(e)?t=e.marker?.line:t=e.commandStartMarker?.line,!(t===void 0||t<0)&&(t=this._bufferTracker.bufferToEditorLineMapping.get(t),t!==void 0))return t+1}};VU=I([m(1,lr),m(2,ou),m(3,B),m(4,X),m(5,F),m(6,nn)],VU);Mp(VU.ID,VU);var s8t=class extends x{constructor(){super(),this._register(npe.addImplementation(105,"terminal",async i=>{let e=i.get(F),t=i.get(nn),o=i.get(ou),n=await t.getActiveOrCreateInstance();await t.revealActiveTerminal();let r=n?.xterm;r&&o.show(e.createInstance(dbe,n,r))},C.or(dt.focus,C.and(Dd,C.equals(cu.key,"terminal")))))}};Mp(s8t.ID,s8t);var YVi=class extends K{constructor(){super({id:"workbench.action.terminal.focusAccessibleBuffer",title:L(15184,"Focus Accessible Terminal View"),precondition:C.or(dt.processSupported,dt.terminalHasBeenCreated),keybinding:[{primary:572,secondary:[2064],linux:{primary:1596,secondary:[2064]},weight:200,when:C.and($a,dt.focus)}]})}async run(i,...e){let o=await i.get(nn).getActiveOrCreateInstance();o?.xterm&&VU.get(o)?.show()}};W(YVi);Er({id:"workbench.action.terminal.accessibleBufferGoToNextCommand",title:L(15182,"Accessible Buffer Go to Next Command"),precondition:C.or(dt.processSupported,dt.terminalHasBeenCreated,C.and(Dd,C.equals(cu.key,"terminal"))),keybinding:[{primary:530,when:C.and(C.and(Dd,C.equals(cu.key,"terminal"))),weight:202}],run:async a=>{let i=a.service.activeInstance;i&&VU.get(i)?.navigateToCommand("next")}});Er({id:"workbench.action.terminal.accessibleBufferGoToPreviousCommand",title:L(15183,"Accessible Buffer Go to Previous Command"),precondition:C.and(C.or(dt.processSupported,dt.terminalHasBeenCreated),C.and(Dd,C.equals(cu.key,"terminal"))),keybinding:[{primary:528,when:C.and(C.and(Dd,C.equals(cu.key,"terminal"))),weight:202}],run:async a=>{let i=a.service.activeInstance;i&&VU.get(i)?.navigateToCommand("previous")}});Er({id:"workbench.action.terminal.scrollToBottomAccessibleView",title:L(15185,"Scroll to Accessible View Bottom"),precondition:C.and(C.or(dt.processSupported,dt.terminalHasBeenCreated),C.and(Dd,C.equals(cu.key,"terminal"))),keybinding:{primary:2061,linux:{primary:1037},when:cu.isEqualTo("terminal"),weight:200},run:(a,i)=>{let e=i.get(ou),t=e.getLastPosition();t&&e.setPosition(t,!0)}});Er({id:"workbench.action.terminal.scrollToTopAccessibleView",title:L(15186,"Scroll to Accessible View Top"),precondition:C.and(C.or(dt.processSupported,dt.terminalHasBeenCreated),C.and(Dd,C.equals(cu.key,"terminal"))),keybinding:{primary:2062,linux:{primary:1038},when:cu.isEqualTo("terminal"),weight:200},run:(a,i)=>i.get(ou)?.setPosition(new ye(1,1),!0)});var R1e=class extends x{constructor(e,t){super();this._configurationService=e;for(let o of t.getRegisteredBackends())this._installListenersOnBackend(o);this._register(t.onDidRegisterBackend(async o=>this._installListenersOnBackend(o)))}static{this.ID="terminalAutoReplies"}_installListenersOnBackend(e){let t=this._configurationService.getValue(Vv);for(let o of Object.keys(t.autoReplies)){let n=t.autoReplies[o];n&&e.installAutoReply(o,n)}this._register(this._configurationService.onDidChangeConfiguration(async o=>{if(o.affectsConfiguration("terminal.integrated.autoReplies")){e.uninstallAllAutoReplies();let n=this._configurationService.getValue(Vv);for(let r of Object.keys(n.autoReplies)){let s=n.autoReplies[r];s&&e.installAutoReply(r,s)}}}))}};R1e=I([m(0,B),m(1,Nm)],R1e);It(R1e.ID,R1e,St.AfterRestored);var nDo=!1,dgn=[{commands:[new RegExp(/^python3? -m pip install(\b)/),new RegExp(/^pip3? install(\b)/)],tags:["python environment"]},{commands:[new RegExp(/^python3? -m jupyter(\b)/),new RegExp(/^python3? -m pip install\b.*jupyter\b.*/),new RegExp(/^pip3? install\b.*jupyter\b.*/),new RegExp(/^jupyter(\b)/)],tags:["python environment","jupyter environment"]}];function rDo(a,i){let e=i.getTools(void 0);if(!e||nDo)return;let t=new Set,o=[`The terminal command '${a}' was not executed.`,"Try using some of the following tools instead of running a Terminal Command (if unable to use one of these tools as an alternative then run the same terminal command again):"];for(let n of dgn){if(!n.commands.some(s=>s.test(a)))continue;let r=n.tags;Array.from(e).filter(s=>r.some(l=>s.tags?.includes(l))).forEach(s=>{t.add(s.id)})}if(t.forEach(n=>{o.push(`- ${n}`)}),t.size)return nDo=!0,o.join(`  
`)}async function P6(a,i){let e=new N,t=new Ko,o=e.add(new Dt(()=>t.complete(),i));return e.add(a(()=>o.schedule())),o.schedule(),t.p.finally(()=>e.dispose())}function ugn(a){return a.trim().length===0?{detected:!1,reason:"Content is empty or contains only whitespace"}:/PS\s+[A-Z]:\\.*>\s*$/.test(a)?{detected:!0,reason:`PowerShell prompt pattern detected: "${a}"`}:/^[A-Z]:\\.*>\s*$/.test(a)?{detected:!0,reason:`Command Prompt pattern detected: "${a}"`}:/\$\s*$/.test(a)?{detected:!0,reason:`Bash-style prompt pattern detected: "${a}"`}:/#\s*$/.test(a)?{detected:!0,reason:`Root prompt pattern detected: "${a}"`}:/^>>>\s*$/.test(a)?{detected:!0,reason:`Python REPL prompt pattern detected: "${a}"`}:/\u276f\s*$/.test(a)?{detected:!0,reason:`Starship prompt pattern detected: "${a}"`}:/[>%]\s*$/.test(a)?{detected:!0,reason:`Generic prompt pattern detected: "${a}"`}:{detected:!1,reason:`No common prompt pattern found in last line: "${a}"`}}async function sDo(a,i,e,t){await P6(a,e);let o=await i.xtermReadyPromise;if(!o)return{detected:!1,reason:`Xterm not available, using ${e}ms timeout`};let n=Date.now();for(;Date.now()-n<t;){try{let r="",s=o.raw.buffer.active,l=s.getLine(s.baseY+s.cursorY);l&&(r=l.translateToString(!0));let c=ugn(r);if(c.detected)return c}catch{}await P6(a,Math.min(e,t-(Date.now()-n)))}try{let r="",s=o.raw.buffer.active,l=s.getLine(s.baseY+s.cursorY);return l&&(r=l.translateToString(!0)+`
`),{detected:!1,reason:`Extended timeout reached without prompt detection. Last line: "${r.trim()}"`}}catch(r){return{detected:!1,reason:`Extended timeout reached. Error reading terminal content: ${r}`}}}async function Cct(a,i,e,t){let o=new Ko,n=a.onData,r=e.add(new Dt(()=>{o.complete()},i)),s=0,l=e.add(new Dt(()=>{if(s===2||s===3){l.cancel();return}s=3,r.schedule()},t??1e3)),c;return(f=>(f[f.Initial=0]="Initial",f[f.Prompt=1]="Prompt",f[f.Executing=2]="Executing",f[f.PromptAfterExecuting=3]="PromptAfterExecuting"))(c||={}),e.add(n(u=>{let p=u.matchAll(/(?:\x1b\]|\x9d)[16]33;(?<type>[ACD])(?:;.*)?(?:\x1b\\|\x07|\x9c)/g);for(let h of p)h.groups?.type==="A"?s===0?s=1:s===2&&(s=3):(h.groups?.type==="C"||h.groups?.type==="D")&&(s=2);s===3?(l.cancel(),r.schedule()):(r.cancel(),s===0||s===1?l.schedule():l.cancel())})),o.p}function M1e(a,i,e,t,o){let n=new me,r=()=>{if(t.isDisposed)return;let s=a.raw.registerMarker();if(i.value=s??void 0,e(s),!s){n.clear();return}n.value=s.onDispose(()=>{o?.("Start marker was disposed, recreating"),r()})};return r(),t.add(Z(()=>{n.dispose(),i.clear(),e(void 0)})),t.add(i),Z(()=>n.dispose())}function P1e(a,i,e){let t=new Ko,o=()=>{t.isSettled||(e?.("Detected alternate buffer entry"),t.complete())};return a.raw.buffer.active===a.raw.buffer.alternate?o():i.add(a.raw.buffer.onBufferChange(()=>{a.raw.buffer.active===a.raw.buffer.alternate&&o()})),t.p}function ure(a,i,e){e?.(`stripCommandEchoAndPrompt input: output length=${a.length}, commandLine length=${i.length}`);let t=aDo(a,i,e);return t.trim().length>0&&lDo(t,i)?aDo(t,i,e):t}function aDo(a,i,e){let t=lDo(a,i,!0),o=t?t.linesAfter:a.split(`
`),n=0,r=t?.contentBefore??"",s=/\w+@[\w.-]+:/.test(r),l=!s&&/[\w.-]+:\S/.test(r),c=s||l,u=/^PS\s/i.test(r),p=!u&&/^[A-Z]:\\/.test(r),h=/\u276f/.test(r),g=/>>>/.test(r),f=c||u||p||h||g,v=o.length,b=0,S=2;for(;v>n;){let w=o[v-1].trimEnd();if(w.length===0){v--;continue}if(b>=S)break;let k=(!f||s)&&/^\s*\w+@[\w.-]+:.*[#$]\s*$/.test(w)||(!f||l)&&/^\s*[\w.-]+:\S.*\s\w+[#$]\s*$/.test(w)||(!f||u)&&/^PS\s+[A-Z]:\\.*>\s*$/.test(w)||(!f||p)&&/^[A-Z]:\\.*>\s*$/.test(w)||(!f||h)&&/\u276f\s*$/.test(w)||(!f||g)&&/^>>>\s*$/.test(w),T=(!f||c)&&/^\s*[\w/.-]+[#$]\s*$/.test(w)||(!f||c)&&/^\[\s*[\w.-]+(@[\w.-]+)?:[~\/]/.test(w)||(!f||c)&&b>0&&/^\s*[\w][-\w.]*(@[\w.-]+)?:\S/.test(w)||(!f||c)&&/\]\s*[#$]\s*$/.test(w);if(k){v--,b++;break}else if(T)v--,b++;else break}let y=o.slice(n,v).join(`
`);return e?.(`stripCommandEchoAndPrompt result: length=${y.length} (startIndex=${n}, endIndex=${v}, totalLines=${o.length})`),y}function lDo(a,i,e){let t=i.trim();if(t.length===0)return;let{strippedOutput:o,indexMapping:n}=pgn(a),r=o.indexOf(t),s,l;if(r!==-1)l=o.substring(0,r).trim(),s=r+t.length-1;else if(e){let g=0;for(let f=t.length-1;f>=1;f--){let v=t.substring(t.length-f);if(o.startsWith(v)){let b=t[t.length-f-1];b!==void 0&&b!==" "&&b!=="	"&&(g=f);break}}if(g===0)return;l="",s=g-1}else return;let c=n[s],u=a.split(`
`),p=0,h=0;for(let g=0;g<u.length;g++){let f=h+u[g].length;if(h<=c&&c<=f){p=g+1;break}h=f+1}return{contentBefore:l,linesAfter:u.slice(p)}}function pgn(a){let i=[],e=[];for(let t=0;t<a.length;t++)a[t]!==`
`&&(e.push(a[t]),i.push(t));return{strippedOutput:e.join(""),indexMapping:i}}var A1e=class extends x{constructor(e,t,o,n,r){super();this._instance=e;this._hasReceivedUserInput=t;this._commandDetection=o;this._configurationService=n;this._logService=r;this.type="basic";this._startMarker=this._register(new me);this._onDidCreateStartMarker=this._register(new E);this.onDidCreateStartMarker=this._onDidCreateStartMarker.event}async execute(e,t,o){let n=new N;try{let r=this._configurationService.getValue("chat.tools.terminal.idlePollInterval")??1e3,s=Cct(this._instance,r,n,r),l=Promise.race([U.toPromise(this._commandDetection.onCommandFinished,n).then(w=>(this._log("onDone 1 of 2 via end event, waiting for short idle prompt"),s.then(()=>(this._log("onDone 2 of 2 via short idle prompt"),{type:"success",command:w})))),U.toPromise(t.onCancellationRequested,n).then(()=>{this._log("onDone via cancellation")}),U.toPromise(this._instance.onDisposed,n).then(()=>(this._log("onDone via terminal disposal"),{type:"disposal"})),Cct(this._instance,r*3,n,r).then(()=>{this._log("onDone long idle prompt")})]);this._log("Waiting for xterm");let c=await this._instance.xtermReadyPromise;if(!c)throw new Error("Xterm is not available");let u=P1e(c,n,this._log.bind(this));this._log("Waiting for idle"),await P6(this._instance.onData,r);let p=M1e(c,this._startMarker,w=>this._onDidCreateStartMarker.fire(w),n,this._log.bind(this));this._hasReceivedUserInput()&&(this._log("Command timed out, sending SIGINT and retrying"),await this._instance.sendText("",!1),await P6(this._instance.onData,100)),o&&this._log(`In basic execute strategy: skipping pre-bound command id ${o} because basic shell integration executes via sendText`),this._log(`Executing command line \`${e}\``),p.dispose();let h=Ze;this._instance.sendText(e,!0,h),this._log("Waiting for done event");let g=await Promise.race([l,u.then(()=>({type:"alternateBuffer"}))]);if(g&&g.type==="disposal")throw new Error("The terminal was closed");if(g&&g.type==="alternateBuffer")return this._log("Detected alternate buffer entry, skipping output capture"),{output:void 0,exitCode:void 0,error:"alternateBuffer",didEnterAltBuffer:!0};let f=g&&g.type==="success"?g.command:void 0;if(f?this._log(`Finished command id=${f.id??"none"} for requested=${o??"none"}`):o&&this._log(`No finished command surfaced for requested=${o}`),this._log("Waiting for idle"),await P6(this._instance.onData,r),t.isCancellationRequested)throw new go;let v=n.add(c.raw.registerMarker()),b,S=[];if(f){let w=f?.getOutput();w!==void 0&&(this._log("Fetched output via finished command"),b=ure(w,e,this._log.bind(this)))}if(b===void 0)try{b=c.getContentsAsText(this._startMarker.value,v),this._log("Fetched output via markers"),b!==void 0&&(b=ure(b,e,this._log.bind(this)))}catch{this._log("Failed to fetch output via markers"),S.push("Failed to retrieve command output")}b!==void 0&&b.trim().length===0&&S.push("Command produced no output");let y=f?.exitCode;return Yo(y)&&y>0&&S.push(`Command exited with code ${y}`),{output:b,additionalInformation:S.length>0?S.join(`
`):void 0,exitCode:y}}finally{n.dispose()}}_log(e){this._logService.debug(`RunInTerminalTool#Basic: ${e}`)}};A1e=I([m(3,B),m(4,ca)],A1e);var N1e=class extends x{constructor(e,t,o,n){super();this._instance=e;this._hasReceivedUserInput=t;this._configurationService=o;this._logService=n;this.type="none";this._startMarker=this._register(new me);this._onDidCreateStartMarker=this._register(new E);this.onDidCreateStartMarker=this._onDidCreateStartMarker.event}async execute(e,t,o){let n=new N;try{if(t.isCancellationRequested)throw new go;this._log("Waiting for xterm");let r=await this._instance.xtermReadyPromise;if(!r)throw new Error("Xterm is not available");let s=P1e(r,n,this._log.bind(this)),l=this._configurationService.getValue("chat.tools.terminal.idlePollInterval")??1e3;if(this._log("Waiting for idle"),await P6(this._instance.onData,l),t.isCancellationRequested)throw new go;let c=M1e(r,this._startMarker,S=>this._onDidCreateStartMarker.fire(S),n,this._log.bind(this));this._hasReceivedUserInput()&&(this._log("Command timed out, sending SIGINT and retrying"),await this._instance.sendText("",!1),await P6(this._instance.onData,100)),this._log(`Executing command line \`${e}\``),c.dispose();let u=this._startMarker.value?.line,p=Ze;if(this._instance.sendText(e,!0,p),u!==void 0){this._log("Waiting for cursor to move past start line");let S=new Promise(k=>{let T=()=>{let O=r.raw.buffer.active;O.baseY+O.cursorY>u&&k()},P=this._instance.onData(()=>T());n.add(P),T()}),y=new Promise(k=>{let T=setTimeout(()=>k("timeout"),1e3);n.add({dispose:()=>clearTimeout(T)})});await Promise.race([S,y])==="timeout"&&this._log("Cursor did not move past start line before timeout, proceeding with idle detection")}this._log("Waiting for idle with prompt heuristics");let h=await Promise.race([sDo(this._instance.onData,this._instance,l,l*10),s.then(()=>"alternateBuffer")]);if(h==="alternateBuffer")return this._log("Detected alternate buffer entry, skipping output capture"),{output:void 0,additionalInformation:void 0,exitCode:void 0,error:"alternateBuffer",didEnterAltBuffer:!0};let g=h;if(this._log(`Prompt detection result: ${g.detected?"detected":"not detected"} - ${g.reason}`),t.isCancellationRequested)throw new go;let f=n.add(r.raw.registerMarker()),v,b=[];try{v=r.getContentsAsText(this._startMarker.value,f),this._log("Fetched output via markers"),v!==void 0&&(v=ure(v,e,this._log.bind(this)))}catch{this._log("Failed to fetch output via markers"),b.push("Failed to retrieve command output")}return v!==void 0&&v.trim().length===0&&b.push("Command produced no output"),{output:v,additionalInformation:b.length>0?b.join(`
`):void 0,exitCode:void 0}}finally{n.dispose()}}_log(e){this._logService.debug(`RunInTerminalTool#None: ${e}`)}};N1e=I([m(2,B),m(3,ca)],N1e);var O1e=class extends x{constructor(e,t,o,n){super();this._instance=e;this._commandDetection=t;this._configurationService=o;this._logService=n;this.type="rich";this._startMarker=this._register(new me);this._onDidCreateStartMarker=this._register(new E);this.onDidCreateStartMarker=this._onDidCreateStartMarker.event}async execute(e,t,o){let n=new N;try{this._log("Waiting for xterm");let r=await this._instance.xtermReadyPromise;if(!r)throw new Error("Xterm is not available");let s=P1e(r,n,this._log.bind(this)),l=this._configurationService.getValue("chat.tools.terminal.idlePollInterval")??1e3,c=Promise.race([U.toPromise(this._commandDetection.onCommandFinished,n).then(y=>(this._log("onDone via end event"),{type:"success",command:y})),U.toPromise(t.onCancellationRequested,n).then(()=>{this._log("onDone via cancellation")}),U.toPromise(this._instance.onDisposed,n).then(()=>(this._log("onDone via terminal disposal"),{type:"disposal"})),Cct(this._instance,l,n,l).then(()=>{this._log("onDone via idle prompt")})]),u=M1e(r,this._startMarker,y=>this._onDidCreateStartMarker.fire(y),n,this._log.bind(this));this._log(`Executing command line \`${e}\``),u.dispose();let p=Ze;this._instance.runCommand(e,!0,o,p),this._log("Waiting for done event");let h=await Promise.race([c,s.then(()=>({type:"alternateBuffer"}))]);if(h&&h.type==="disposal")throw new Error("The terminal was closed");if(h&&h.type==="alternateBuffer")return this._log("Detected alternate buffer entry, skipping output capture"),{output:void 0,exitCode:void 0,error:"alternateBuffer",didEnterAltBuffer:!0};let g=h&&h.type==="success"?h.command:void 0;if(t.isCancellationRequested)throw new go;let f=n.add(r.raw.registerMarker()),v,b=[];if(g){let y=g?.getOutput();y!==void 0&&(this._log("Fetched output via finished command"),v=ure(y,e,this._log.bind(this)))}if(v===void 0)try{v=r.getContentsAsText(this._startMarker.value,f),this._log("Fetched output via markers"),v!==void 0&&(v=ure(v,e,this._log.bind(this)))}catch{this._log("Failed to fetch output via markers"),b.push("Failed to retrieve command output")}v!==void 0&&v.trim().length===0&&b.push("Command produced no output");let S=g?.exitCode;return Yo(S)&&S>0&&b.push(`Command exited with code ${S}`),{output:v,additionalInformation:b.length>0?b.join(`
`):void 0,exitCode:S}}finally{n.dispose()}}_log(e){let t=`RunInTerminalTool#Rich: ${e}`;ef?this._logService.info(t):this._logService.debug(t)}};O1e=I([m(2,B),m(3,ca)],O1e);function zq(a){return!!a&&"sourceText"in a}function XVi(a){return!!a&&"type"in a&&a.type==="npmScript"}function _x(a,i){return i===1?/^(?:powershell|pwsh)(?:-preview)?$/i.test($s.basename(a).replace(/\.exe$/i,"")):/^(?:powershell|pwsh)(?:-preview)?$/.test(Oo.basename(a))}function cDo(a){return a.endsWith("System32\\WindowsPowerShell\\v1.0\\powershell.exe")}function F1e(a,i){return i===1?/^zsh(?:\.exe)?$/i.test($s.basename(a)):/^zsh$/.test(Oo.basename(a))}function l8t(a,i){return i===1?/^bash(?:\.exe)?$/i.test($s.basename(a)):/^bash$/.test(Oo.basename(a))}function c8t(a,i){return i===1?/^fish(?:\.exe)?$/i.test($s.basename(a)):/^fish$/.test(Oo.basename(a))}var a8t=`

[... PREVIOUS OUTPUT TRUNCATED ...]

`;function dDo(a,i){if(a.length<=i)return a;let e=a8t.length;if(e>=i)return a8t.slice(a8t.length-i);let t=i-e,o=a.slice(-t);return a8t+o}function xct(a){return a.replace(/\\(["'\/])/g,"$1")}function uDo(a,i,e){let t=[];if(e.subCommandResults.every(n=>n.result!=="denied")&&e.commandLineResult.result!=="denied"){let n=i.filter((h,g)=>e.subCommandResults[g].result!=="approved"),r=new Set(["bash","sh","zsh","fish","ksh","csh","tcsh","dash","pwsh","powershell","powershell.exe","cmd","cmd.exe","python","python3","node","ruby","perl","php","lua","eval","exec","source","sudo","su","doas","curl","wget","invoke-restmethod","invoke-webrequest","irm","iwr"]),s=new Set(["git","npm","npx","yarn","docker","kubectl","cargo","dotnet","mvn","gradle"]),l=new Set(["npm run","yarn run"]),c=(h,g)=>{for(let f=g;f<h.length;f++)if(!h[f].startsWith("-"))return f},u=Array.from(new Set(di(n.map(h=>{let g=h.trim().split(/\s+/),f=g[0].toLowerCase();if(!r.has(f))if(s.has(f)){let v=c(g,1);if(v!==void 0){let b=`${g[0]} ${g[v]}`.toLowerCase();if(l.has(b)){let S=c(g,v+1);return S!==void 0?g.slice(0,S+1).join(" "):void 0}else return g.slice(0,v+1).join(" ")}return}else return g[0]}))));if(u.length>0){let h;u.length===1?h=`\`${u[0]} \u2026\``:h=`Commands ${u.map(g=>`\`${g} \u2026\``).join(", ")}`,t.push({label:`Allow ${h} in this Session`,data:{type:"newRule",rule:u.map(g=>({key:g,value:!0,scope:"session"}))}}),t.push({label:`Allow ${h} in this Workspace`,data:{type:"newRule",rule:u.map(g=>({key:g,value:!0,scope:"workspace"}))}}),t.push({label:`Always Allow ${h}`,data:{type:"newRule",rule:u.map(g=>({key:g,value:!0,scope:"user"}))}})}t.length>0&&t.push(new ri),(n.length>0?n[0].split(" ")[0]:"")!==a&&!s.has(a)&&!l.has(a)&&(t.push({label:d(15261,null),data:{type:"newRule",rule:{key:`/^${ns(a)}$/`,value:{approve:!0,matchCommandLine:!0},scope:"session"}}}),t.push({label:d(15262,null),data:{type:"newRule",rule:{key:`/^${ns(a)}$/`,value:{approve:!0,matchCommandLine:!0},scope:"workspace"}}}),t.push({label:d(15260,null),data:{type:"newRule",rule:{key:`/^${ns(a)}$/`,value:{approve:!0,matchCommandLine:!0},scope:"user"}}}))}return t.length>0&&t.push(new ri),t.push({label:d(15257,null),tooltip:d(15258,null),data:{type:"sessionApproval"}}),t.push(new ri),t.push({label:d(15259,null),data:{type:"configure"}}),t}function JVi(a){return a.filter((i,e,t)=>{if(!zq(i.rule))return!1;let o=i.rule.sourceText;return t.findIndex(n=>zq(n.rule)&&n.rule.sourceText===o)===e})}function d8t(a,i,e){let t=_x(i,e),o=a.match(t?/^(?:cd(?: \/d)?|Set-Location(?: -Path)?) (?<dir>[^\s]+) ?(?:&&|;)\s+(?<suffix>.+)$/i:/^cd (?<dir>[^\s]+) &&\s+(?<suffix>.+)$/),n=o?.groups?.dir,r=o?.groups?.suffix;if(n&&r){let s=n;return s.startsWith('"')&&s.endsWith('"')&&(s=s.slice(1,-1)),{directory:s,command:r}}}var pDo=16e3;function kct(a,i){if(!a.xterm||!a.xterm.raw)return"";let e=a.xterm.raw.buffer.active,t=Math.max(i?.line??0,0);for(;t>0&&e.getLine(t)?.isWrapped;)t--;let o=e.length,n=[],r="";for(let l=t;l<o;l++){let c=e.getLine(l);if(!c)continue;let u=!!e.getLine(l+1)?.isWrapped;r+=c.translateToString(!u),u||(n.push(r),r="")}r&&n.push(r);let s=n.join(`
`);return s.length>pDo&&(s=dDo(s,pDo)),s}var u8t=class{present(i){let e=i.commandLine.forDisplay,t=mgn(e,i.shell,i.os);if(t)return{commandLine:t,language:"javascript",languageDisplayName:"Node.js"}}};function mgn(a,i,e){let t=a.match(/^node(?:js)?\s+(?:-e|--eval)\s+"(?<code>.+)"$/s);if(t?.groups?.code){let n=t.groups.code.trim();return _x(i,e)?n=n.replace(/`"/g,'"'):n=n.replace(/\\"/g,'"'),n}let o=a.match(/^node(?:js)?\s+(?:-e|--eval)\s+'(?<code>.+)'$/s);if(o?.groups?.code)return o.groups.code.trim()}var p8t=class{present(i){let e=i.commandLine.forDisplay,t=hgn(e,i.shell,i.os);if(t)return{commandLine:t,language:"python",languageDisplayName:"Python"}}};function hgn(a,i,e){let t=a.match(/^python(?:3)?\s+-c\s+"(?<python>.+)"$/s);if(t?.groups?.python){let n=t.groups.python.trim();return _x(i,e)?n=n.replace(/`"/g,'"'):n=n.replace(/\\"/g,'"'),n}let o=a.match(/^python(?:3)?\s+-c\s+'(?<python>.+)'$/s);if(o?.groups?.python)return o.groups.python.trim()}var m8t=class{present(i){let e=i.commandLine.forDisplay,t=ggn(e,i.shell,i.os);if(t)return{commandLine:t,language:"ruby",languageDisplayName:"Ruby"}}};function ggn(a,i,e){let t=a.match(/^ruby\s+-e\s+"(?<code>.+)"$/s);if(t?.groups?.code){let n=t.groups.code.trim();return n?(_x(i,e)?n=n.replace(/`"/g,'"'):n=n.replace(/\\"/g,'"'),n):void 0}let o=a.match(/^ruby\s+-e\s+'(?<code>.+)'$/s);if(o?.groups?.code){let n=o.groups.code.trim();return n||void 0}}var h8t=le("sandboxHelperService");var mDo="sandboxHelper";var g8t=class{constructor(i){this.channel=i}checkSandboxDependencies(){return this.channel.call("checkSandboxDependencies")}};var WN=le("terminalSandboxService");var A6=class extends x{constructor(e,t,o,n,r,s,l,c,u,p){super();this._configurationService=e;this._fileService=t;this._environmentService=o;this._logService=n;this._remoteAgentService=r;this._workspaceContextService=s;this._productService=l;this._lifecycleService=c;this._sandboxHelperService=u;this._chatService=p;this._srtPathResolved=!1;this._needsForceUpdateConfigFile=!0;this._remoteEnvDetails=null;this._os=Po;this._defaultWritePaths=["~/.npm"];this._pathJoin=(...e)=>(this._os===1?$s:Oo).join(...e);this._appRoot=ad(vn.asFileUri("").path);let h=this._environmentService;this._execPath=h.execPath,this._sandboxSettingsId=xt(),this._remoteEnvDetailsPromise=this._remoteAgentService.getEnvironment(),this._register(U.runAndSubscribe(this._configurationService.onDidChangeConfiguration,g=>{(g?.affectsConfiguration("chat.agent.sandbox")||g?.affectsConfiguration("chat.agent.sandboxNetwork.allowedDomains")||g?.affectsConfiguration("chat.agent.sandboxNetwork.deniedDomains")||g?.affectsConfiguration("chat.agent.sandboxFileSystem.linux")||g?.affectsConfiguration("chat.agent.sandboxFileSystem.mac")||g?.affectsConfiguration("chat.tools.terminal.sandbox.enabled")||g?.affectsConfiguration("chat.tools.terminal.sandbox.network.allowedDomains")||g?.affectsConfiguration("chat.tools.terminal.sandbox.network.deniedDomains")||g?.affectsConfiguration("chat.tools.terminal.sandbox.linuxFileSystem")||g?.affectsConfiguration("chat.tools.terminal.sandbox.macFileSystem"))&&this.setNeedsForceUpdateConfigFile()})),this._register(this._workspaceContextService.onDidChangeWorkspaceFolders(()=>{this.setNeedsForceUpdateConfigFile()})),this._register(this._lifecycleService.onWillShutdown(g=>{this._tempDir&&g.join(this._cleanupSandboxTempDir(),{id:"join.deleteFilesInSandboxTempDir",label:d(15441,null),order:1})}))}static{this._sandboxTempDirName="tmp"}async isEnabled(){return await this._isSandboxConfiguredEnabled()}async getOS(){return this._remoteEnvDetails=await this._remoteEnvDetailsPromise,this._os=this._remoteEnvDetails?this._remoteEnvDetails.os:Po,this._os}wrapCommand(e,t){if(!this._sandboxConfigPath||!this._tempDir)throw new Error("Sandbox config path or temp dir not initialized");if(t)return this._tempDir?.path?`(TMPDIR="${this._tempDir.path}"; export TMPDIR; ${e})`:e;if(!this._execPath)throw new Error("Executable path not set to run sandbox commands");if(!this._srtPath)throw new Error("Sandbox runtime path not resolved");if(!this._rgPath)throw new Error("Ripgrep path not resolved");let o=`PATH="$PATH:${ad(this._rgPath)}" TMPDIR="${this._tempDir.path}" CLAUDE_TMPDIR="${this._tempDir.path}" "${this._execPath}" "${this._srtPath}" --settings "${this._sandboxConfigPath}" -c ${this._quoteShellArgument(e)}`;return this._remoteEnvDetails?`${o}`:`ELECTRON_RUN_AS_NODE=1 ${o}`}getTempDir(){return this._tempDir}setNeedsForceUpdateConfigFile(){this._needsForceUpdateConfigFile=!0}async checkForSandboxingPrereqs(e=!1){if(!await this._isSandboxConfiguredEnabled())return{enabled:!1,sandboxConfigPath:void 0,failedCheck:void 0};let t=await this.getSandboxConfigPath(e);return t?await this._checkSandboxDependencies(e)?{enabled:!0,sandboxConfigPath:t,failedCheck:void 0}:{enabled:!0,sandboxConfigPath:t,failedCheck:"dependencies",missingDependencies:await this.getMissingSandboxDependencies()}:{enabled:!0,sandboxConfigPath:t,failedCheck:"config"}}async getSandboxConfigPath(e=!1){if(await this._isSandboxConfiguredEnabled())return await this._resolveSrtPath(),(!this._sandboxConfigPath||e||this._needsForceUpdateConfigFile)&&(this._sandboxConfigPath=await this._createSandboxConfig(),this._needsForceUpdateConfigFile=!1),this._sandboxConfigPath}async _checkSandboxDependencies(e=!1){if(await this.getOS()===1)return!1;let o=await this._resolveSandboxDependencyStatus(e);return this._sandboxDependencyStatus=o,o&&!o.bubblewrapInstalled&&this._logService.warn("TerminalSandboxService: bubblewrap (bwrap) is not installed"),o&&!o.socatInstalled&&this._logService.warn("TerminalSandboxService: socat is not installed"),o?o.bubblewrapInstalled&&o.socatInstalled:!0}async getMissingSandboxDependencies(){if(await this.getOS()===1)return[];(!this._sandboxDependencyStatus||!this._sandboxDependencyStatus.bubblewrapInstalled||!this._sandboxDependencyStatus.socatInstalled)&&(this._sandboxDependencyStatus=await this._resolveSandboxDependencyStatus(!0));let t=[];return this._sandboxDependencyStatus&&!this._sandboxDependencyStatus.bubblewrapInstalled&&t.push("bubblewrap"),this._sandboxDependencyStatus&&!this._sandboxDependencyStatus.socatInstalled&&t.push("socat"),t}async installMissingSandboxDependencies(e,t,o,n){let s=`sudo apt install -y ${e.join(" ")}`,l=await n.createTerminal(),c=!1,u=new Promise(p=>{let h=new N,g=!1,f=y=>{g||(g=!0,h.dispose(),p(y))},v=()=>{let y=l.capabilities.get(2);y&&h.add(y.onCommandFinished(w=>f(w.exitCode)))};v(),h.add(l.capabilities.onDidAddCapability(y=>{y.id===2&&v()})),h.add(l.onDisposed(()=>f(void 0))),h.add(o.onCancellationRequested(()=>f(void 0)));let b=Li(300*1e3);h.add({dispose:()=>b.cancel()}),b.then(()=>f(void 0));let S=this._createMissingDependencyPasswordPrompt(t,{focusTerminal:()=>n.focusTerminal(l),onDidInputData:l.onDidInputData,onDisposed:l.onDisposed,didSendInstallCommand:()=>c},o);h.add(S)});return await l.sendText(s,!0),c=!0,{exitCode:await u}}_createMissingDependencyPasswordPrompt(e,t,o){let n=e&&this._chatService.getSession(e);if(!(n instanceof Ef))return new N;let r=n.getRequests().at(-1);if(!r)return new N;let s=new rne(d(15444,null),new Ie(d(15443,null)),"",d(15442,null),void 0,async()=>(await t.focusTerminal(),"pending"));n.acceptResponseProgress(r,s);let l=new N,c=()=>l.dispose();return l.add({dispose:()=>s.hide()}),l.add(o.onCancellationRequested(c)),l.add(t.onDisposed(c)),l.add(t.onDidInputData(u=>{t.didSendInstallCommand()&&u.length>0&&c()})),l}_quoteShellArgument(e){return`'${e.replace(/'/g,"'\\''")}'`}async _isSandboxConfiguredEnabled(){return await this.getOS()===1?!1:this._getSettingValue("chat.agent.sandbox","chat.tools.terminal.sandbox.enabled")??!1}async _resolveSrtPath(){if(this._srtPathResolved)return;this._srtPathResolved=!0;let e=this._remoteEnvDetails||await this._remoteEnvDetailsPromise;e&&(this._appRoot=e.appRoot.path,this._execPath=e.execPath),this._srtPath=this._pathJoin(this._appRoot,"node_modules","@anthropic-ai","sandbox-runtime","dist","cli.js"),this._rgPath=this._pathJoin(this._appRoot,"node_modules","@vscode","ripgrep","bin","rg")}async _createSandboxConfig(){if(await this.isEnabled()&&!this._tempDir&&await this._initTempDir(),this._tempDir){let e=this._getSettingValue("chat.agent.sandboxNetwork.allowedDomains","chat.tools.terminal.sandbox.network.allowedDomains")??[],t=this._getSettingValue("chat.agent.sandboxNetwork.deniedDomains","chat.tools.terminal.sandbox.network.deniedDomains")??[],o=this._os===3?this._getSettingValue("chat.agent.sandboxFileSystem.linux","chat.tools.terminal.sandbox.linuxFileSystem")??{}:{},n=this._os===2?this._getSettingValue("chat.agent.sandboxFileSystem.mac","chat.tools.terminal.sandbox.macFileSystem")??{}:{},r=A.joinPath(this._tempDir,`vscode-sandbox-settings-${this._sandboxSettingsId}.json`),s=this._updateAllowWritePathsWithWorkspaceFolders(o.allowWrite),l=this._updateAllowWritePathsWithWorkspaceFolders(n.allowWrite),c={network:{allowedDomains:e,deniedDomains:t},filesystem:{denyRead:this._os===2?n.denyRead:o.denyRead,allowWrite:this._os===2?l:s,denyWrite:this._os===2?n.denyWrite:o.denyWrite}};return this._sandboxConfigPath=r.path,await this._fileService.createFile(r,qe.fromString(JSON.stringify(c,null,"	")),{overwrite:!0}),this._sandboxConfigPath}}async _initTempDir(){if(await this.isEnabled()){this._needsForceUpdateConfigFile=!0;let e=this._remoteEnvDetails||await this._remoteEnvDetailsPromise;this._tempDir=this._getSandboxTempDirPath(e),this._tempDir&&(await this._fileService.createFolder(this._tempDir),this._defaultWritePaths.push(this._tempDir.path)),this._tempDir||this._logService.warn("TerminalSandboxService: Cannot create sandbox settings file because no tmpDir is available in this environment")}}async _cleanupSandboxTempDir(){if(this._tempDir)try{await this._fileService.del(this._tempDir,{recursive:!0,useTrash:!1})}catch(e){this._logService.warn("TerminalSandboxService: Failed to delete sandbox temp dir",e)}}_getSandboxTempDirPath(e){let t=this._getSandboxWindowTempDirName();if(e?.userHome){let n=A.joinPath(e.userHome,this._productService.serverDataFolderName??this._productService.dataFolderName,A6._sandboxTempDirName);return t?A.joinPath(n,t):n}let o=this._environmentService;if(o.userHome){let n=A.joinPath(o.userHome,this._productService.dataFolderName,A6._sandboxTempDirName);return t?A.joinPath(n,t):n}}_getSandboxWindowTempDirName(){let t=this._environmentService.window?.id;return typeof t=="number"?`tmp_vscode_${t}`:void 0}getResolvedNetworkDomains(){let e=this._getSettingValue("chat.agent.sandboxNetwork.allowedDomains","chat.tools.terminal.sandbox.network.allowedDomains")??[],t=this._getSettingValue("chat.agent.sandboxNetwork.deniedDomains","chat.tools.terminal.sandbox.network.deniedDomains")??[];return{allowedDomains:e,deniedDomains:t}}_updateAllowWritePathsWithWorkspaceFolders(e){let t=this._workspaceContextService.getWorkspace().folders.map(o=>o.uri.path);return[...new Set([...t,...this._defaultWritePaths,...e??[]])]}async _resolveSandboxDependencyStatus(e=!1){if(!e&&this._sandboxDependencyStatus)return this._sandboxDependencyStatus;let t=this._remoteAgentService.getConnection();return t?t.withChannel(mDo,o=>new g8t(o).checkSandboxDependencies()):this._sandboxHelperService.checkSandboxDependencies()}_getSettingValue(e,t){let o=this._configurationService.inspect(e),n=t?this._configurationService.inspect(t):void 0;return o.userValue===void 0&&n?.userValue!==void 0?(this._logService.warn(`TerminalSandboxService: Using deprecated setting ${t} because ${e} is not set. Please update your settings to use ${e} instead.`),n.value):o.value}};A6=I([m(0,B),m(1,fe),m(2,Eo),m(3,se),m(4,bo),m(5,Pe),m(6,tt),m(7,ji),m(8,h8t),m(9,mi)],A6);var W1e=class{constructor(i){this._sandboxService=i}async present(i){if(await this._sandboxService.isEnabled())return{commandLine:i.commandLine.forDisplay,processOtherPresenters:!0}}};W1e=I([m(0,WN)],W1e);var BU=class{constructor(i,e,t){this._configurationService=i;this._logService=e;this._terminalService=t}static{this._lastSuccessfulShell=0}async createTerminal(i,e,t){let o=await this._createCopilotTerminal(i,e),n={instance:o,shellIntegrationQuality:"none"},r=0,s=await Promise.any([o.processReady.then(()=>r=Date.now()),U.toPromise(o.onExit)]);if(!Yo(s)&&xi(s)&&No(s,{message:!0}))throw new Error(s.message);let l=this._configurationService.getValue("terminal.integrated.shellIntegration.enabled")===!0,c=Y3t(this._configurationService,l,o.hasRemoteAuthority,r);if(BU._lastSuccessfulShell!==2||l){this._logService.info(`ToolTerminalCreator#createTerminal: Waiting ${c}ms for shell integration`);let u=await this._waitForShellIntegration(o,c);if(t.isCancellationRequested)throw o.dispose(),new go;if(u==="rich"){let p=o.capabilities.get(2);p?.promptInputModel.state===0&&(this._logService.info("ToolTerminalCreator#createTerminal: Waiting up to 2s for PromptInputModel state to change"),await vp(U.toPromise(p.onCommandStarted),2e3)||this._logService.info("ToolTerminalCreator#createTerminal: PromptInputModel state did not change within timeout"))}if(u!=="none")return BU._lastSuccessfulShell=1,n.shellIntegrationQuality=u,n}else this._logService.info(`ToolTerminalCreator#createTerminal: Skipping wait for shell integration - last successful launch type ${BU._lastSuccessfulShell}`);return BU._lastSuccessfulShell=2,n}refreshShellIntegrationQuality(i){let e=i.instance.capabilities.get(2);e&&(i.shellIntegrationQuality==="none"||i.shellIntegrationQuality==="basic")&&(i.shellIntegrationQuality=e.hasRichCommandDetection?"rich":"basic")}_createCopilotTerminal(i,e){let t=Fe(i)?i:i.path,o={GIT_PAGER:"cat",GIT_MERGE_AUTOEDIT:"no",GIT_EDITOR:":"};this._configurationService.getValue("chat.tools.terminal.preventShellHistory")===!0&&(l8t(t,e)||F1e(t,e)||c8t(t,e)||_x(t,e))&&(o.VSCODE_PREVENT_SHELL_HISTORY="1");let r={icon:q.fromId(R.chatSparkle.id),hideFromUser:!0,forcePersist:!0,env:o};return Fe(i)?r.executable=i:(r.executable=i.path,r.args=i.args,r.icon=i.icon??r.icon,r.color=i.color,r.env={...r.env,...i.env}),this._terminalService.createTerminal({config:r})}_waitForShellIntegration(i,e){let t=new N,o=new Ko,n=t.add(new me);if(n.value=tn(()=>{this._logService.info(`ToolTerminalCreator#_waitForShellIntegration: Timed out ${e}ms, using no SI`),o.complete("none")},e),i.capabilities.get(2)?.hasRichCommandDetection)n.clear(),this._logService.info("ToolTerminalCreator#_waitForShellIntegration: Rich SI available immediately"),o.complete("rich");else{let r=t.add(this._terminalService.createOnInstanceCapabilityEvent(2,l=>l.onSetRichCommandDetection));t.add(r.event(l=>{l.instance===i&&(n.clear(),this._logService.info("ToolTerminalCreator#_waitForShellIntegration: Rich SI available eventually"),o.complete("rich"))})),i.capabilities.get(2)?(n.clear(),t.add(tn(()=>{this._logService.info("ToolTerminalCreator#_waitForShellIntegration: Timed out 200ms, using basic SI"),o.complete("basic")},200))):t.add(i.capabilities.onDidAddCommandDetectionCapability(l=>{n.clear(),t.add(tn(()=>{this._logService.info("ToolTerminalCreator#_waitForShellIntegration: Timed out 200ms, using basic SI (via listener)"),o.complete("basic")},200))}))}return o.p.finally(()=>{this._logService.info("ToolTerminalCreator#_waitForShellIntegration: Promise complete, disposing store"),t.dispose()}),o.p}};BU=I([m(0,B),m(1,ca),m(2,nn)],BU);var V1e=class{constructor(i){this._telemetryService=i}logPrepare(i){let e=i.subCommands.map(t=>{let o=t.split(" ")[0],n=o.toLowerCase();if(!vgn.has(n))if(/^(?:[A-Z][a-z0-9]+)+(?:-(?:[A-Z][a-z0-9]+))*$/.test(o))n="(unknown:pwsh)";else if(/^[a-z0-9_\-\.\\\/:;]+$/i.test(o)){let r=[];/[a-z]/.test(o)&&r.push("ascii_lower"),/[A-Z]/.test(o)&&r.push("ascii_upper"),/[0-9]/.test(o)&&r.push("numeric");let s=[];for(let l of[".","-","_","/","\\",":",";"])o.includes(l)&&s.push(l);n=`(unknown:${r.join(",")}:${s.join("")})`}else/[^\x00-\x7F]/.test(o)?n="(unknown:unicode)":n="(unknown)";return n});this._telemetryService.publicLog2("toolUse.runInTerminal.prepare",{terminalToolSessionId:i.terminalToolSessionId,subCommands:new sg(JSON.stringify(e)),autoApproveAllowed:i.autoApproveAllowed,autoApproveResult:i.autoApproveResult,autoApproveReason:i.autoApproveReason,autoApproveDefault:i.autoApproveDefault})}logInvoke(i,e){this._telemetryService.publicLog2("toolUse.runInTerminal",{terminalSessionId:i.sessionId,terminalToolSessionId:e.terminalToolSessionId,result:e.error??"success",strategy:e.shellIntegrationQuality==="rich"?2:e.shellIntegrationQuality==="basic"?1:0,userEditedCommand:e.didUserEditCommand?1:0,toolEditedCommand:e.didToolEditCommand?1:0,isBackground:e.isBackground?1:0,isNewSession:e.isNewSession?1:0,isSandbox:e.isSandboxWrapped?1:0,outputLineCount:e.outputLineCount,nonZeroExitCode:e.exitCode===void 0?-1:e.exitCode===0?0:1,timingConnectMs:e.timingConnectMs,timingExecuteMs:e.timingExecuteMs,pollDurationMs:e.pollDurationMs??0,terminalExecutionIdleBeforeTimeout:e.terminalExecutionIdleBeforeTimeout??!1,inputUserChars:e.inputUserChars,inputUserSigint:e.inputUserSigint,inputToolManualAcceptCount:e.inputToolManualAcceptCount??0,inputToolManualRejectCount:e.inputToolManualRejectCount??0,inputToolManualChars:e.inputToolManualChars??0,inputToolManualShownCount:e.inputToolManualShownCount??0,inputToolFreeFormInputShownCount:e.inputToolFreeFormInputShownCount??0,inputToolFreeFormInputCount:e.inputToolFreeFormInputCount??0})}};V1e=I([m(0,Te)],V1e);var vgn=new Set(["!","@","#","$","%","^","&","*","(",")","~","{","}","<",">",".","7z","alias","assoc","attrib","awk","basename","bg","blkid","bunzip2","bzip2","cat","cd","certutil","chkdsk","chmod","chown","cipher","clear","cls","cmp","column","comm","compact","compress","copy","cp","curl","cut","date","dd","del","df","diff","dig","dir","dirname","diskpart","dism","disown","du","echo","env","erase","eval","expand","export","fc","fdisk","fg","file","find","findstr","fmt","fold","forfiles","format","free","fsck","git","gpupdate","grep","groupadd","groups","gunzip","gzip","hash","head","hexdump","history","host","htop","icacls","id","ifconfig","iostat","ip","ipconfig","iptables","jobs","jq","kill","killall","less","ln","locate","ls","lsblk","lscpu","lsof","man","mkdir","mklink","more","mount","move","mv","nbtstat","nc/netcat","net","netstat","nice","nl","nohup","nslookup","nslookup","od","passwd","paste","pathping","pause","pgrep","ping","pkill","powercfg","pr","printenv","ps","pwd","query","rar","readlink","realpath","reg","rem","ren","rename","renice","rev","rm","rmdir","robocopy","route","rsync","sc","schtasks","scp","sed","seq","set","setx","sfc","shred","shuf","shutdown","sleep","sort","source","split","ss","ssh","stat","strings","su","subst","sudo","systeminfo","tac","tail","tar","tee","telnet","test","time","top","touch","tr","traceroute","tracert","tree","true","truncate","type","type","umask","umount","unalias","uname","uncompress","unexpand","uniq","unlink","unrar","unzip","uptime","useradd","usermod","vmstat","vol","watch","wc","wget","where","whereis","which","who","whoami","wmic","xargs","xcopy","xxd","xz","yes","zcat","zip","zless","zmore","bitbucket","bzr","cvs","gh","git","glab","hg","svn","fossil","p4","adb","ansible","apk","apt-get","apt","aws","az","brew","bundle","cargo","choco","clang","cmake","composer","conan","conda","dnf","docker-compose","docker","dotnet","emacs","esbuild","eslint","flatpak","flutter","fnm","g++","gcc","gcloud","go","gradle","helm","java","javac","jest","julia","kotlin","kubectl","lua","make","mocha","mvn","n","nano","node","npm","nvm","pacman","perl","php","phpunit","pip","pipenv","pnpm","pod","podman","poetry","python","r","rollup","ruby","rustc","rustup","snap","swift","terraform","tsc","tslint","vagrant","vcpkg","vi","vim","vite","vitest","webpack","yarn","yum","zypper","aider","amp","claude","codex","copilot","gemini","toad","q","taskkill","taskkill.exe","add-content","compare-object","convertfrom-json","convertto-json","copy-item","format-custom","format-list","format-table","format-wide","get-childitem","get-command","get-content","get-date","get-help","get-location","get-process","get-random","get-service","invoke-expression","invoke-restmethod","invoke-webrequest","join-path","measure-command","measure-object","move-item","new-item","out-file","remove-item","restart-computer","select-object","select-string","select-xml","set-acl","set-content","set-itemproperty","sort-object","split-path","start-process","start-sleep","stop-process","test-path","write-host","write-output","iex","irm","iwr","rd","ri","sp","spps"]);var f8t=class{constructor(){this.commandName="sed"}canHandle(i){return i.match(/^sed\s+/)?/(?:^|\s)(-[a-zA-Z]*[iI][a-zA-Z]*\S*|--in-place(?:=\S*)?|(-i|-I)\s*'[^']*'|(-i|-I)\s*"[^"]*")(?:\s|$)/.test(i):!1}extractFileWrites(i){let e=this._tokenizeCommand(i);return this._extractFileTargets(e)}_tokenizeCommand(i){let e=[],t="",o=!1,n=!1,r=!1;for(let s=0;s<i.length;s++){let l=i[s];if(r){t+=l,r=!1;continue}if(l==="\\"&&!o){r=!0,t+=l;continue}if(l==="'"&&!n){o=!o,t+=l;continue}if(l==='"'&&!o){n=!n,t+=l;continue}if(/\s/.test(l)&&!o&&!n){t&&(e.push(t),t="");continue}t+=l}return t&&e.push(t),e}_extractFileTargets(i){if(i.length===0||i[0]!=="sed")return[];let e=[],t=1,o=!1;for(;t<i.length;){let n=i[t];if(n.startsWith("--")){if(n==="--in-place"||n.startsWith("--in-place=")){t++;continue}if(n==="--expression"||n==="--file"){t+=2,o=!0;continue}if(n.startsWith("--expression=")||n.startsWith("--file=")){t++,o=!0;continue}t++;continue}if(n.startsWith("-")&&n.length>1&&n[1]!=="-"){let s=n.slice(1),l=s.indexOf("i"),c=s.indexOf("I"),u=l>=0?l:c;if(u>=0&&u<s.length-1){t++;continue}if((s.endsWith("i")||s.endsWith("I"))&&t+1<i.length){let p=i[t+1];if(p==="''"||p==='""'){t+=2;continue}if(p.startsWith("'")&&p.endsWith("'")||p.startsWith('"')&&p.endsWith('"')){let h=p.slice(1,-1);if(h.startsWith(".")&&h.length<=10&&!h.includes("/")){t+=2;continue}}}if(s.includes("e")||s.includes("f")){let p=s.indexOf("e"),h=s.indexOf("f");if((p>=0?p:h)<s.length-1){o=!0,t++;continue}o=!0,t+=2;continue}t++;continue}if(!o){o=!0,t++;continue}let r=n;(r.startsWith("'")&&r.endsWith("'")||r.startsWith('"')&&r.endsWith('"'))&&(r=r.slice(1,-1)),e.push(r),t++}return e}};var B1e=class extends x{constructor(e){super();this._treeSitterLibraryService=e;this._treeCache=this._register(new ZVi);this._commandFileWriteParsers=[new f8t];this._parser=new co(()=>this._treeSitterLibraryService.getParserClass().then(t=>new t))}async extractSubCommands(e,t){return(await this._queryTree(e,t,"(command) @command")).map(n=>n.node.text)}async extractPwshDoubleAmpersandChainOperators(e){return await this._queryTree("powershell",e,["(","  (pipeline","    (pipeline_chain_tail) @double.ampersand)",")"].join(`
`))}async getFileWrites(e,t){let o;switch(e){case"bash":o=["(file_redirect","  destination: [(word) (string (string_content)) (raw_string) (concatenation)] @file)"].join(`
`);break;case"powershell":o=["(redirection","  (redirected_file_name) @file)"].join(`
`);break}return(await this._queryTree(e,t,o)).map(r=>r.node.text.trim())}async getCommandFileWrites(e,t){if(e!=="bash")return[];let n=await this._queryTree(e,t,"(command) @command"),r=[];for(let s of n){let l=s.node.text;for(let c of this._commandFileWriteParsers)c.canHandle(l)&&r.push(...c.extractFileWrites(l))}return r}async _queryTree(e,t,o){let{tree:n,query:r}=await this._doQuery(e,t,o);return r.captures(n.rootNode)}async _doQuery(e,t,o){let n=await this._treeSitterLibraryService.getLanguagePromise(e);if(!n)throw new li("Failed to fetch language grammar");let r=this._treeCache.get(e,t);if(!r){let l=await this._parser.value;l.setLanguage(n);let c=l.parse(t);if(!c)throw new pa("Failed to parse tree");r=c,this._treeCache.set(e,t,r)}let s=await this._treeSitterLibraryService.createQuery(n,o);if(!s)throw new li("Failed to create tree sitter query");return{tree:r,query:s}}};B1e=I([m(0,tY)],B1e);var ZVi=class extends x{constructor(){super();this._cache=new Map;this._clearScheduler=this._register(new me);this._register(Z(()=>this._cache.clear()))}get(e,t){return this._resetClearTimer(),this._cache.get(this._getCacheKey(e,t))}set(e,t,o){this._resetClearTimer(),this._cache.set(this._getCacheKey(e,t),o)}_getCacheKey(e,t){return`${e}:${t}`}_resetClearTimer(){this._clearScheduler.value=new Dt(()=>{this._cache.clear()},1e4),this._clearScheduler.value.schedule()}};var bgn=[/^(?<command>npm)\s+(?:run(?:-script)?)\s+(?<scriptName>[^\s&|;]+)/i,/^(?<command>npm)\s+(?<scriptName>test|start|stop|restart)\b/i,/^(?<command>yarn)\s+(?:run\s+)?(?<scriptName>[^\s&|;]+)/i,/^(?<command>pnpm)\s+(?:run\s+)?(?<scriptName>[^\s&|;]+)/i],Sgn=new Set(["add","audit","autoclean","bin","cache","check","config","create","dedupe","dlx","exec","explain","generate-lock-entry","global","help","import","info","init","install","licenses","link","list","login","logout","node","outdated","owner","pack","patch","patch-commit","plugin","policies","publish","rebuild","remove","run","search","set","stage","tag","team","unlink","unplug","up","upgrade","upgrade-interactive","version","versions","why","workspace","workspaces"]),Ign=new Set(["add","audit","bin","config","dedupe","deploy","dlx","doctor","env","exec","fetch","import","init","install","install-test","licenses","link","list","ln","ls","outdated","pack","patch","patch-commit","patch-remove","prune","publish","rb","rebuild","remove","rm","root","run","server","setup","store","un","uninstall","unlink","up","update","why"]),H1e=class extends x{constructor(e,t,o,n){super();this._configurationService=e;this._fileService=t;this._uriIdentityService=o;this._workspaceContextService=n}async isCommandAutoApproved(e,t){if(!(this._configurationService.getValue("chat.tools.terminal.autoApproveWorkspaceNpmScripts")===!0))return{isAutoApproved:!1};let n=this._extractScriptName(e);if(!n)return{isAutoApproved:!1};let r=await this._getPackageJsonScripts(t);return r?r.scripts.has(n)?{isAutoApproved:!0,scriptName:n,autoApproveInfo:new Ie(d(15268,null,`\`${n}\``))}:{isAutoApproved:!1}:{isAutoApproved:!1}}_extractScriptName(e){let t=e.trim();for(let o of bgn){let n=t.match(o);if(n?.groups?.scriptName){let{command:r,scriptName:s}=n.groups;if(r.toLowerCase()==="yarn"&&Sgn.has(s.toLowerCase())||r.toLowerCase()==="pnpm"&&Ign.has(s.toLowerCase()))continue;return s}}}_isWithinWorkspace(e){return this._workspaceContextService.getWorkspace().folders.some(o=>this._uriIdentityService.extUri.isEqualOrParent(e,o.uri))}async _getPackageJsonScripts(e){if(!e||!this._isWithinWorkspace(e))return;let t=A.joinPath(e,"package.json"),o=await this._readPackageJsonScripts(t);if(o)return{uri:t,scripts:o}}async _readPackageJsonScripts(e){try{if(!await this._fileService.exists(e))return;let n=(await this._fileService.readFile(e)).value.toString();return this._parsePackageJsonScripts(n)}catch{return}}_parsePackageJsonScripts(e){let t=new Set,o=!1,n=0;return uk(e,{onError(){},onObjectBegin(){n++},onObjectEnd(){o&&n===2&&(o=!1),n--},onObjectProperty(s){n===1&&s==="scripts"?o=!0:o&&n===2&&t.add(s)}}),t.size>0?t:void 0}};H1e=I([m(0,B),m(1,fe),m(2,ht),m(3,Pe)],H1e);var eBi=/(?!.*)/,ygn=/^[A-Z_][A-Z0-9_]*=/i,U1e=class extends x{constructor(e,t,o){super();this._configurationService=e;this._terminalChatService=o;this._denyListRules=[];this._allowListRules=[];this._allowListCommandLineRules=[];this._denyListCommandLineRules=[];this._npmScriptAutoApprover=this._register(t.createInstance(H1e)),this.updateConfiguration(),this._register(this._configurationService.onDidChangeConfiguration(n=>{(n.affectsConfiguration("chat.tools.terminal.autoApprove")||n.affectsConfiguration("chat.tools.terminal.ignoreDefaultAutoApproveRules")||n.affectsConfiguration("chat.agent.terminal.autoApprove"))&&this.updateConfiguration()}))}updateConfiguration(){let e=this._configurationService.getValue("chat.tools.terminal.autoApprove"),t=this._configurationService.inspect("chat.tools.terminal.autoApprove"),o=this._configurationService.getValue("chat.agent.terminal.autoApprove");o&&typeof o=="object"&&e&&typeof e=="object"&&(e={...e,...o});let{denyListRules:n,allowListRules:r,allowListCommandLineRules:s,denyListCommandLineRules:l}=this._mapAutoApproveConfigToRules(e,t);this._allowListRules=r,this._denyListRules=n,this._allowListCommandLineRules=s,this._denyListCommandLineRules=l}async isCommandAutoApproved(e,t,o,n,r){if(ygn.test(e))return{result:"denied",reason:`Command '${e}' is denied because it contains transient environment variables`};for(let l of this._denyListRules)if(this._commandMatchesRule(l,e,t,o))return{result:"denied",rule:l,reason:`Command '${e}' is denied by deny list rule: ${l.sourceText}`};for(let l of this._getSessionRules(r).allowListRules)if(this._commandMatchesRule(l,e,t,o))return{result:"approved",rule:l,reason:`Command '${e}' is approved by session allow list rule: ${l.sourceText}`};for(let l of this._allowListRules)if(this._commandMatchesRule(l,e,t,o))return{result:"approved",rule:l,reason:`Command '${e}' is approved by allow list rule: ${l.sourceText}`};let s=await this._npmScriptAutoApprover.isCommandAutoApproved(e,n);return s.isAutoApproved?{result:"approved",rule:{type:"npmScript",npmScriptResult:s},reason:`Command '${e}' is approved as npm script '${s.scriptName}' is defined in package.json`}:{result:"noMatch",reason:`Command '${e}' has no matching auto approve entries`}}isCommandLineAutoApproved(e,t){for(let o of this._denyListCommandLineRules)if(o.regex.test(e))return{result:"denied",rule:o,reason:`Command line '${e}' is denied by deny list rule: ${o.sourceText}`};for(let o of this._getSessionRules(t).allowListCommandLineRules)if(o.regex.test(e))return{result:"approved",rule:o,reason:`Command line '${e}' is approved by session allow list rule: ${o.sourceText}`};for(let o of this._allowListCommandLineRules)if(o.regex.test(e))return{result:"approved",rule:o,reason:`Command line '${e}' is approved by allow list rule: ${o.sourceText}`};return{result:"noMatch",reason:`Command line '${e}' has no matching auto approve entries`}}_getSessionRules(e){let t=[],o=[],n=[],r=[];if(!e)return{denyListRules:t,allowListRules:o,allowListCommandLineRules:n,denyListCommandLineRules:r};let s=this._terminalChatService.getSessionAutoApproveRules(e);for(let[l,c]of Object.entries(s))if(typeof c=="boolean"){let{regex:u,regexCaseInsensitive:p}=this._convertAutoApproveEntryToRegex(l);c===!0?o.push({regex:u,regexCaseInsensitive:p,sourceText:l,sourceTarget:"session",isDefaultRule:!1}):c===!1&&t.push({regex:u,regexCaseInsensitive:p,sourceText:l,sourceTarget:"session",isDefaultRule:!1})}else if(typeof c=="object"&&c!==null){let u=c;if(typeof u.approve=="boolean"){let{regex:p,regexCaseInsensitive:h}=this._convertAutoApproveEntryToRegex(l);u.approve===!0?u.matchCommandLine===!0?n.push({regex:p,regexCaseInsensitive:h,sourceText:l,sourceTarget:"session",isDefaultRule:!1}):o.push({regex:p,regexCaseInsensitive:h,sourceText:l,sourceTarget:"session",isDefaultRule:!1}):u.approve===!1&&(u.matchCommandLine===!0?r.push({regex:p,regexCaseInsensitive:h,sourceText:l,sourceTarget:"session",isDefaultRule:!1}):t.push({regex:p,regexCaseInsensitive:h,sourceText:l,sourceTarget:"session",isDefaultRule:!1}))}}return{denyListRules:t,allowListRules:o,allowListCommandLineRules:n,denyListCommandLineRules:r}}_commandMatchesRule(e,t,o,n){let r=_x(o,n);return(r?e.regexCaseInsensitive:e.regex).test(t)?!0:!!(r&&t.startsWith("(")&&e.regexCaseInsensitive.test(t.slice(1)))}_mapAutoApproveConfigToRules(e,t){if(!e||typeof e!="object")return{denyListRules:[],allowListRules:[],allowListCommandLineRules:[],denyListCommandLineRules:[]};let o=[],n=[],r=[],s=[],l=this._configurationService.getValue("chat.tools.terminal.ignoreDefaultAutoApproveRules")===!0;for(let[c,u]of Object.entries(e)){let g=function(v){return xi(v)&&Object.prototype.hasOwnProperty.call(v,c)&&b_(v[c],u)},p=t?.default?.value,h=!!(xi(p)&&Object.prototype.hasOwnProperty.call(p,c)&&b_(p[c],u)),f=g(t.workspaceFolder)?6:g(t.workspaceValue)?5:g(t.userRemoteValue)?4:g(t.userLocalValue)?3:g(t.userValue)?2:g(t.applicationValue)?1:7;if(!(l&&h&&f===7)){if(typeof u=="boolean"){let{regex:v,regexCaseInsensitive:b}=this._convertAutoApproveEntryToRegex(c);u===!0?n.push({regex:v,regexCaseInsensitive:b,sourceText:c,sourceTarget:f,isDefaultRule:h}):u===!1&&o.push({regex:v,regexCaseInsensitive:b,sourceText:c,sourceTarget:f,isDefaultRule:h})}else if(typeof u=="object"&&u!==null){let v=u;if(typeof v.approve=="boolean"){let{regex:b,regexCaseInsensitive:S}=this._convertAutoApproveEntryToRegex(c);v.approve===!0?v.matchCommandLine===!0?r.push({regex:b,regexCaseInsensitive:S,sourceText:c,sourceTarget:f,isDefaultRule:h}):n.push({regex:b,regexCaseInsensitive:S,sourceText:c,sourceTarget:f,isDefaultRule:h}):v.approve===!1&&(v.matchCommandLine===!0?s.push({regex:b,regexCaseInsensitive:S,sourceText:c,sourceTarget:f,isDefaultRule:h}):o.push({regex:b,regexCaseInsensitive:S,sourceText:c,sourceTarget:f,isDefaultRule:h}))}}}}return{denyListRules:o,allowListRules:n,allowListCommandLineRules:r,denyListCommandLineRules:s}}_convertAutoApproveEntryToRegex(e){let t=this._doConvertAutoApproveEntryToRegex(e);return t.flags.includes("i")?{regex:t,regexCaseInsensitive:t}:{regex:t,regexCaseInsensitive:new RegExp(t.source,t.flags+"i")}}_doConvertAutoApproveEntryToRegex(e){let t=e.match(/^\/(?<pattern>.+)\/(?<flags>[dgimsuvy]*)$/),o=t?.groups?.pattern;if(o){let r=t.groups?.flags;if(r&&(r=r.replaceAll("g","")),o===".*")return new RegExp(o);try{let s=new RegExp(o,r||void 0);return cIe(s)?eBi:s}catch{return eBi}}if(e==="")return eBi;let n;if(e.includes("/")||e.includes("\\")){let r=e.replace(/[/\\]/g,"%%PATH_SEP%%");r=ns(r),r=r.replace(/%%PATH_SEP%%*/g,"[/\\\\]"),n=`^(?:\\.[/\\\\])?${r}`}else n=ns(e);return new RegExp(`^${n}\\b`)}};U1e=I([m(0,B),m(1,F),m(2,Wv)],U1e);var Cgn=["curl","wget"],xgn=["invoke-restmethod","invoke-webrequest","irm","iwr"],ube=class extends x{constructor(e,t,o,n,r,s,l){super();this._treeSitterCommandParser=e;this._telemetry=t;this._log=o;this._configurationService=n;this._storageService=s;this._terminalChatService=l;this._commandLineAutoApprover=this._register(r.createInstance(U1e))}async analyze(e){if(this._configurationService.getValue("chat.tools.terminal.enableAutoApprove")===!0&&e.chatSessionResource&&this._terminalChatService.hasChatSessionAutoApproval(e.chatSessionResource)){this._log("Session has auto approval enabled, auto approving command");let k=fc("workbench.action.terminal.chat.disableSessionAutoApproval",e.chatSessionResource),T={isTrusted:{enabledCommands:["workbench.action.terminal.chat.disableSessionAutoApproval"]}};return{isAutoApproved:!0,isAutoApproveAllowed:!0,disclaimers:[],autoApproveInfo:new Ie(`${d(15272,null)} ([${d(15273,null)}](${k.toString()}))`,T)}}let o=e.commandLine.trimStart(),n;try{n=await this._treeSitterCommandParser.extractSubCommands(e.treeSitterLanguage,o),this._log(`Parsed sub-commands via ${e.treeSitterLanguage} grammar`,n)}catch(k){console.error(k),this._log(`Failed to parse sub-commands via ${e.treeSitterLanguage} grammar`)}let r=!1,s,l;if(!n?.length)return o.length===0?(this._log("Command line is empty, auto approving"),{isAutoApproved:!0,isAutoApproveAllowed:!0,disclaimers:[]}):(this._log("No sub-commands were parsed, auto approval is not allowed"),{isAutoApproveAllowed:!1,disclaimers:[]});let c=await Promise.all(n.map(k=>this._commandLineAutoApprover.isCommandAutoApproved(k,e.shell,e.os,e.cwd,e.chatSessionResource))),u=this._commandLineAutoApprover.isCommandLineAutoApproved(o,e.chatSessionResource),p=[...c.map(k=>k.reason),u.reason],h=!1,g,f,v=c.find(k=>k.result==="denied");v?(this._log("Sub-command DENIED auto approval"),h=!0,f=zq(v.rule)?v.rule.isDefaultRule:void 0,g="subCommand"):u.result==="denied"?(this._log("Command line DENIED auto approval"),h=!0,f=zq(u.rule)?u.rule.isDefaultRule:void 0,g="commandLine"):c.every(k=>k.result==="approved")?(this._log("All sub-commands auto-approved"),r=!0,g="subCommand",f=c.every(k=>zq(k.rule)&&k.rule.isDefaultRule)):(this._log("All sub-commands NOT auto-approved"),u.result==="approved"?(this._log("Command line auto-approved"),g="commandLine",r=!0,f=zq(u.rule)?u.rule.isDefaultRule:void 0):this._log("Command line NOT auto-approved"));for(let k of p)this._log(`- ${k}`);let b=this._configurationService.getValue("chat.tools.terminal.enableAutoApprove")===!0,S=this._storageService.getBoolean("chat.tools.terminal.autoApprove.warningAccepted",-1,!1);b&&r?s=this._createAutoApproveInfo(r,h,g,c,u):r=!1,this._telemetry.logPrepare({terminalToolSessionId:e.terminalToolSessionId,subCommands:n,autoApproveAllowed:b?S?"allowed":"needsOptIn":"off",autoApproveResult:r?"approved":h?"denied":"manual",autoApproveReason:g,autoApproveDefault:f});let y=[],w=n.map(k=>k.split(" ")[0].toLowerCase());if(!r&&(w.some(k=>Cgn.includes(k))||_x(e.shell,e.os)&&w.some(k=>xgn.includes(k)))&&y.push(d(15279,null)),b&&h){let k=this._createAutoApproveInfo(r,h,g,c,u);k&&y.push(k)}return!r&&b&&(l=uDo(o,n,{subCommandResults:c,commandLineResult:u})),{isAutoApproved:r,isAutoApproveAllowed:!0,disclaimers:y,autoApproveInfo:s,customActions:l}}_createAutoApproveInfo(e,t,o,n,r){let s=p=>cc(p).filter(h=>zq(h.rule)).map(h=>{let g=h.rule.sourceText.replaceAll("$","\\$");if(h.rule.sourceTarget==="session")return d(15276,null,`\`${g}\``);let f=fc("workbench.action.terminal.chat.openTerminalSettingsLink",h.rule.sourceTarget),v=d(15277,null),b=g;switch(h.rule?.sourceTarget){case 7:b=`${b} (default)`;break;case 2:case 3:b=`${b} (user)`;break;case 4:b=`${b} (remote)`;break;case 5:case 6:b=`${b} (workspace)`;break}return`[\`${b}\`](${f.toString()} "${v}")`}).join(", "),l={isTrusted:{enabledCommands:["workbench.action.terminal.chat.openTerminalSettingsLink"]}},c=this._configurationService.inspect("chat.tools.global.autoApprove");if(c?.value??c.defaultValue){let p=fc("workbench.action.terminal.chat.openTerminalSettingsLink","global");return new Ie(`${d(15269,null,`[\`chat.tools.global.autoApprove\`](${p.toString()} "${d(15278,null)}")`)}`,l)}if(e)switch(o){case"commandLine":{if(zq(r.rule))return new Ie(d(15270,null,s(r)),l);break}case"subCommand":{let p=n.find(g=>XVi(g.rule));if(p&&XVi(p.rule)&&p.rule.npmScriptResult.autoApproveInfo)return p.rule.npmScriptResult.autoApproveInfo;let h=JVi(n);if(h.length===1)return new Ie(d(15270,null,s(h)),l);if(h.length>1)return new Ie(d(15271,null,s(h)),l);break}}else if(t)switch(o){case"commandLine":{if(r.rule)return new Ie(d(15274,null,s(r)),l);break}case"subCommand":{let p=JVi(n.filter(h=>h.result==="denied"));if(p.length===1)return new Ie(d(15274,null,s(p)),l);if(p.length>1)return new Ie(d(15275,null,s(p)),l);break}}}};ube=I([m(3,B),m(4,F),m(5,ce),m(6,Wv)],ube);var z1e=Symbol("null device"),K1e=class extends x{constructor(e,t,o,n,r){super();this._treeSitterCommandParser=e;this._log=t;this._configurationService=o;this._labelService=n;this._workspaceContextService=r}async analyze(e){let t;try{t=await this._getFileWrites(e)}catch(o){return console.error(o),this._log("Failed to get file writes via grammar",e.treeSitterLanguage),{isAutoApproveAllowed:!1}}return this._getResult(e,t)}async _getFileWrites(e){let t=[],o=(await this._treeSitterCommandParser.getFileWrites(e.treeSitterLanguage,e.commandLine)).map(this._mapNullDevice.bind(this,e)),n=(await this._treeSitterCommandParser.getCommandFileWrites(e.treeSitterLanguage,e.commandLine)).map(this._mapNullDevice.bind(this,e)),r=[...o,...n];if(r.length){let s=e.cwd;s?(this._log("Detected cwd",s.toString()),t=r.map(l=>l===z1e?l:(/^['"].*['"]$/.test(l)&&(l=this._stripSurroundingQuotes(l)),(e.os===1?$s.isAbsolute(l):Oo.isAbsolute(l))?s.with({path:l}):A.joinPath(s,l)))):(this._log("Cwd could not be detected"),t=r)}return this._log("File writes detected",t.map(s=>s.toString())),t}_stripSurroundingQuotes(e){return e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'")?e.slice(1,-1):e}_mapNullDevice(e,t){return e.treeSitterLanguage==="powershell"?t==="$null"?z1e:t:t==="/dev/null"?z1e:t}_getResult(e,t){let o=!0;if(t.length>0)switch(this._configurationService.getValue("chat.tools.terminal.blockDetectedFileWrites")){case"all":{o=!1,this._log('File writes blocked due to "all" setting');break}case"outsideWorkspace":{let s=this._workspaceContextService.getWorkspace().folders;if(s.length>0)for(let l of t){if(l===z1e){this._log("File write to null device allowed",A.isUri(l)?l.toString():l);continue}if(Fe(l)&&!(e.os===1?$s.isAbsolute(l):Oo.isAbsolute(l))){o=!1,this._log("File write blocked due to unknown terminal cwd",l);break}let c=A.isUri(l)?l:A.file(l);if(c.fsPath.match(/[$\(\){}`]/)){o=!1,this._log("File write blocked due to likely containing a variable or sub-command",c.toString());break}if(!s.some(p=>p.uri.scheme===c.scheme&&(c.path.startsWith(p.uri.path+"/")||c.path===p.uri.path))){o=!1,this._log("File write blocked outside workspace",c.toString());break}}else t.every(c=>c===z1e)||(o=!1,this._log("File writes blocked - no workspace folders"));break}default:break}let n=[];if(t.length>0){let r=t.map(s=>`\`${A.isUri(s)?this._labelService.getUriLabel(s):s===z1e?"/dev/null":s.toString()}\``).join(", ");o?n.push(d(15281,null,r)):n.push(d(15280,null,r))}return{isAutoApproveAllowed:o,disclaimers:n}}};K1e=I([m(2,B),m(3,rt),m(4,Pe)],K1e);var G1e=class extends x{constructor(e){super();this._sandboxService=e}async analyze(e){return await this._sandboxService.isEnabled()?{isAutoApproveAllowed:!0,forceAutoApproval:!e.requiresUnsandboxConfirmation}:{isAutoApproveAllowed:!0}}};G1e=I([m(0,WN)],G1e);var pbe=(s=>(s.Initial="Initial",s.Idle="Idle",s.PollingForIdle="PollingForIdle",s.Prompting="Prompting",s.Timeout="Timeout",s.Active="Active",s.Cancelled="Cancelled",s))(pbe||{});var pre=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this._execution=e;this._pollFn=t;this._languageModelsService=s;this._taskService=l;this._chatService=c;this._chatWidgetService=u;this._configurationService=p;this._logService=h;this._terminalService=g;this._state="PollingForIdle";this._userInputtedSinceIdleDetected=!1;this._userInputListener=this._register(new me);this._outputMonitorTelemetryCounters={inputToolManualAcceptCount:0,inputToolManualRejectCount:0,inputToolManualChars:0,inputToolAutoAcceptCount:0,inputToolAutoChars:0,inputToolManualShownCount:0,inputToolFreeFormInputShownCount:0,inputToolFreeFormInputCount:0};this._onDidFinishCommand=this._register(new E);this.onDidFinishCommand=this._onDidFinishCommand.event;this._sessionResource=o?.sessionResource,Li(0).then(()=>{this._startMonitoring(r,o,n)})}get state(){return this._state}_formatLastLineForLog(e){if(!e)return"<empty>";let t=e.trimEnd().split(/\r?\n/).pop()??"";return t?this._isSensitivePrompt(t)?"<redacted>":t.length>200?t.slice(0,200)+"\u2026":t:"<empty>"}_formatOptionsForLog(e){if(!e.length)return"[]";let t=12,o=e.slice(0,t).map(r=>r.replace(/\r?\n/g,"return")),n=e.length>t?`, \u2026(+${e.length-t})`:"";return`[${o.join(", ")}${n}]`}get pollingResult(){return this._pollingResult}get outputMonitorTelemetryCounters(){return this._outputMonitorTelemetryCounters}async _startMonitoring(e,t,o){let n=Date.now(),r,s,l,c=!1;try{for(;!o.isCancellationRequested;){switch(this._state){case"PollingForIdle":{this._logService.trace(`OutputMonitor: Entering PollingForIdle (extended=${c})`),this._state=await this._waitForIdle(this._execution,c,o),this._logService.trace(`OutputMonitor: PollingForIdle completed -> state=${pbe[this._state]}`);continue}case"Timeout":if(this._logService.trace(`OutputMonitor: Entering Timeout state (extended=${c})`),await this._handleTimeoutState(e,t,c,o)){c=!0,this._state="PollingForIdle";continue}else{this._promptPart?.hide(),this._promptPart=void 0;break}case"Cancelled":break;case"Idle":{this._logService.trace("OutputMonitor: Entering Idle handler");let u=await this._handleIdleState(o);if(u.shouldContinuePollling){this._logService.trace("OutputMonitor: Idle handler -> continue polling"),this._state="PollingForIdle";continue}else this._logService.trace(`OutputMonitor: Idle handler -> stop polling (hasResources=${!!u.resources}, hasModelEval=${!!u.modelOutputEvalResponse}, outputLen=${u.output?.length??0})`),s=u.resources,r=u.modelOutputEvalResponse,l=u.output;break}}if(this._state==="Idle"||this._state==="Cancelled"||this._state==="Timeout")break}o.isCancellationRequested&&(this._state="Cancelled")}finally{this._logService.trace(`OutputMonitor: Monitoring finished (state=${pbe[this._state]}, duration=${Date.now()-n}ms)`),this._pollingResult={state:this._state,output:l??this._execution.getOutput(),modelOutputEvalResponse:o.isCancellationRequested?"Cancelled":r,pollDurationMs:Date.now()-n,resources:s},this._userInputListener.clear();let u=this._promptPart;if(this._promptPart=void 0,u)try{u.hide()}catch(p){this._logService.error("OutputMonitor: Failed to hide prompt",p)}this._onDidFinishCommand.fire()}}async _handleIdleState(e){let t=this._execution.getOutput(this._lastPromptMarker);if(this._logService.trace(`OutputMonitor: Idle output summary: len=${t.length}, lastLine=${this._formatLastLineForLog(t)}`),tBi(t))return this._logService.trace("OutputMonitor: Idle -> non-interactive help pattern detected, stopping"),{shouldContinuePollling:!1,output:t};let o=this._execution.task!==void 0;if(o&&gDo(t))return this._logService.trace("OutputMonitor: Idle -> VS Code task finish message detected, stopping"),{shouldContinuePollling:!1,output:t};if(!o&&Rgn(t)){if(this._logService.trace('OutputMonitor: Idle -> generic "press any key" detected'),this._configurationService.getValue("chat.tools.terminal.autoReplyToPrompts")||this._isAutopilotMode())return this._logService.trace('OutputMonitor: Auto-reply enabled -> not showing free-form prompt for "press any key", stopping'),this._cleanupIdleInputListener(),{shouldContinuePollling:!1,output:t};this._logService.trace('OutputMonitor: Requesting free-form input for "press any key"');let u=this._execution.instance.registerMarker();u&&(this._lastPromptMarker=u),this._cleanupIdleInputListener(),this._outputMonitorTelemetryCounters.inputToolFreeFormInputShownCount++;let p=t.trimEnd().split(/\r?\n/).pop()||"";return await this._requestFreeFormTerminalInput(e,this._execution,{prompt:p,options:[],detectedRequestForFreeFormInput:!0},!0)?(this._logService.trace('OutputMonitor: Free-form input received for "press any key", continue polling'),await Li(200),{shouldContinuePollling:!0}):(this._logService.trace('OutputMonitor: Free-form input declined for "press any key", stopping'),{shouldContinuePollling:!1})}if(this._userInputtedSinceIdleDetected)return this._logService.trace("OutputMonitor: User input detected since idle; skipping prompt and continuing polling"),this._cleanupIdleInputListener(),{shouldContinuePollling:!0};this._logService.trace("OutputMonitor: Determining user input options via language model");let n=await this._determineUserInputOptions(this._execution,e);if(this._logService.trace(`OutputMonitor: Input options result: ${n?`prompt=${this._formatLastLineForLog(n.prompt)}, options=${n.options.length} ${this._formatOptionsForLog(n.options)}, freeForm=${!!n.detectedRequestForFreeFormInput}`:"none"}`),this._userInputtedSinceIdleDetected)return this._logService.trace("OutputMonitor: User input arrived during input-option analysis; continuing polling"),this._cleanupIdleInputListener(),{shouldContinuePollling:!0};if(n?.detectedRequestForFreeFormInput)return this._userInputtedSinceIdleDetected?(this._logService.trace("OutputMonitor: User input arrived before showing free-form prompt; continuing polling"),this._cleanupIdleInputListener(),{shouldContinuePollling:!0}):this._configurationService.getValue("chat.tools.terminal.autoReplyToPrompts")||this._isAutopilotMode()?(this._logService.trace("OutputMonitor: Auto-reply enabled -> not propagating free-form prompt, stopping"),this._cleanupIdleInputListener(),{shouldContinuePollling:!1,output:t}):(this._cleanupIdleInputListener(),this._outputMonitorTelemetryCounters.inputToolFreeFormInputShownCount++,this._logService.trace("OutputMonitor: Showing free-form input elicitation"),await this._requestFreeFormTerminalInput(e,this._execution,n)?(this._logService.trace("OutputMonitor: Free-form input received; continuing polling"),await Li(200),{shouldContinuePollling:!0}):(this._logService.trace("OutputMonitor: Free-form input declined; stopping"),{shouldContinuePollling:!1}));if(n?.options.length){this._logService.trace(`OutputMonitor: Showing option-based input flow (options=${n.options.length})`);let c=await this._selectAndHandleOption(n,e);return this._logService.trace(`OutputMonitor: Suggested option result: ${c?.suggestedOption?"hasSuggestion":"none"} (autoSent=${!!c?.sentToTerminal})`),c?.sentToTerminal?(this._cleanupIdleInputListener(),{shouldContinuePollling:!0}):this._userInputtedSinceIdleDetected?(this._logService.trace("OutputMonitor: User input arrived during option selection; continuing polling"),this._cleanupIdleInputListener(),{shouldContinuePollling:!0}):(this._cleanupIdleInputListener(),this._logService.trace("OutputMonitor: Showing confirmation elicitation for suggested option"),await this._confirmRunInTerminal(e,c?.suggestedOption??n.options[0],this._execution,n)?(this._logService.trace("OutputMonitor: Option confirmed/sent; continuing polling"),{shouldContinuePollling:!0}):(this._logService.trace("OutputMonitor: Option declined; stopping"),this._execution.instance.focus(!0),{shouldContinuePollling:!1}))}this._cleanupIdleInputListener();let r=await this._pollFn?.(this._execution,e,this._taskService);this._logService.trace(`OutputMonitor: Custom poller result: ${r?"provided":"none"}`);let s=r?.resources,l=this._pollFn?void 0:await this._assessOutputForErrors(this._execution.getOutput(),e);return{resources:s,modelOutputEvalResponse:l,shouldContinuePollling:!1,output:r?.output??t}}async _handleTimeoutState(e,t,o,n){return o?(this._logService.info("OutputMonitor: Extended polling timeout reached after 2 minutes"),this._state="Cancelled",!1):!0}async _waitForIdle(e,t,o){let n=t?12e4:2e4,r=1e4,s=500,l=0,c=0,u=!1,p=e.instance.onData(h=>{u=!0});try{for(;!o.isCancellationRequested&&l<n;){let h=Math.min(s,n-l);await Li(h,o),l+=h,s=Math.min(s*2,r);let g=e.getOutput();if(tBi(g))return this._logService.trace(`OutputMonitor: waitForIdle -> non-interactive help detected (waited=${l}ms)`),this._state="Idle",this._setupIdleInputListener(),this._state;if(_gn(g))return this._logService.trace(`OutputMonitor: waitForIdle -> input-required pattern detected (waited=${l}ms, lastLine=${this._formatLastLineForLog(g)})`),this._state="Idle",this._setupIdleInputListener(),this._state;u?(c=0,u=!1):c++;let v=c>=2,b=e.isActive?await e.isActive():void 0;if(this._logService.trace(`OutputMonitor: waitForIdle check: waited=${l}ms, recentlyIdle=${v}, isActive=${b}`),v&&b!==!0)return this._logService.trace(`OutputMonitor: waitForIdle -> recentlyIdle && !active (waited=${l}ms, lastLine=${this._formatLastLineForLog(g)})`),this._state="Idle",this._setupIdleInputListener(),this._state}}finally{p.dispose()}return o.isCancellationRequested?"Cancelled":"Timeout"}_setupIdleInputListener(){this._userInputtedSinceIdleDetected=!1,this._logService.trace("OutputMonitor: Setting up idle input listener"),this._userInputListener.value=this._execution.instance.onDidInputData(()=>{this._userInputtedSinceIdleDetected=!0,this._logService.trace("OutputMonitor: Detected user terminal input while idle")})}_cleanupIdleInputListener(){this._userInputtedSinceIdleDetected=!1,this._userInputListener.clear()}async _assessOutputForErrors(e,t){let o=await this._getLanguageModel();if(!o)return"No models available";let n=await this._languageModelsService.sendChatRequest(o,void 0,[{role:1,content:[{type:"text",value:`Evaluate this terminal output to determine if there were errors. If there are errors, return them. Otherwise, return undefined: ${e}.`}]}],{},t);try{return await JDt(n)}catch(r){return"Error occurred "+r}}async _determineUserInputOptions(e,t){if(t.isCancellationRequested){this._logService.trace("OutputMonitor: determineUserInputOptions cancelled before start");return}let o=await this._getLanguageModel();if(!o){this._logService.trace("OutputMonitor: determineUserInputOptions no language model available");return}let n=e.getOutput(this._lastPromptMarker).trimEnd().split(`
`).slice(-15).join(`
`);if(this._logService.trace(`OutputMonitor: determineUserInputOptions analyzing lastLines (len=${n.length})`),tBi(n))return;let r=`Analyze the following terminal output. If it contains a prompt requesting user input (such as a confirmation, selection, or yes/no question) that appears at the VERY END of the output and has NOT already been answered (i.e., there is no user response or subsequent output after the prompt), extract the prompt text. IMPORTANT: Only detect prompts that are at the end of the output with no content following them - if there is any output after the prompt, the prompt has already been answered and you should return null. The prompt may ask to choose from a set. If so, extract the possible options as a JSON object with keys 'prompt', 'options' (an array of strings or an object with option to description mappings), and 'freeFormInput': false. If no options are provided, and free form input is requested, return a JSON object with keys 'prompt', 'options', 'freeFormInput': true, and 'input'. The 'input' field should be the exact text to type only when the output explicitly states what to type (for example, Type "exit" to quit). If there is no explicit input, set 'input' to null. For Enter, set 'input' to "\\r". If the option is ambiguous, return null.
			Examples:
			1. Output: "Do you want to overwrite? (y/n)"
				Response: {"prompt": "Do you want to overwrite?", "options": ["y", "n"], "freeFormInput": false}

			2. Output: "Confirm: [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [C] Cancel"
				Response: {"prompt": "Confirm", "options": ["Y", "A", "N", "L", "C"], "freeFormInput": false}

			3. Output: "Accept license terms? (yes/no)"
				Response: {"prompt": "Accept license terms?", "options": ["yes", "no"], "freeFormInput": false}

			4. Output: "Press Enter to continue"
				Response: {"prompt": "Press Enter to continue", "options": ["Enter"], "freeFormInput": false}

			5. Output: "Type Yes to proceed"
				Response: {"prompt": "Type Yes to proceed", "options": ["Yes"], "freeFormInput": false}

			6. Output: "Continue [y/N]"
				Response: {"prompt": "Continue", "options": ["y", "N"], "freeFormInput": false}

			7. Output: "Password:"
				Response: {"prompt": "Password:", "freeFormInput": true, "options": [], "input": null}
			8. Output: "press ctrl-c to detach, ctrl-d to kill"
				Response: null
			9. Output: "Continue (y/n)? y"
				Response: null (the prompt was already answered with 'y')
			10. Output: "Do you want to proceed? (yes/no)
yes
Proceeding with operation..."
				Response: null (the prompt was already answered and there is subsequent output)

			Alternatively, the prompt may request free form input, for example:
			1. Output: "Enter your username:"
				Response: {"prompt": "Enter your username:", "freeFormInput": true, "options": [], "input": null}
			2. Output: "Password:"
				Response: {"prompt": "Password:", "freeFormInput": true, "options": [], "input": null}
			3. Output: "Press any key to continue..."
				Response: {"prompt": "Press any key to continue...", "freeFormInput": true, "options": [], "input": "\\r"}
			4. Output: "Type 'exit' to quit the game."
				Response: {"prompt": "Type 'exit' to quit the game.", "freeFormInput": true, "options": [], "input": "exit"}
			Now, analyze this output:
			${n}
			`,s=await this._languageModelsService.sendChatRequest(o,void 0,[{role:1,content:[{type:"text",value:r}]}],{},t),l=await JDt(s);try{let c=l.match(/\{[\s\S]*\}/);if(c){let u=JSON.parse(c[0]);if(xi(u)&&Object.hasOwn(u,"prompt")&&Fe(u.prompt)&&Object.hasOwn(u,"options")&&Object.hasOwn(u,"freeFormInput")&&typeof u.freeFormInput=="boolean"){let p=u;if(this._lastPrompt===p.prompt){this._logService.trace("OutputMonitor: determineUserInputOptions ignoring duplicate prompt");return}if(p.freeFormInput===!0){let h=Fe(p.input)&&p.input.trim().length?p.input.trim():void 0;return{prompt:p.prompt,options:[],detectedRequestForFreeFormInput:!0,suggestedInput:h}}if(Array.isArray(p.options)&&p.options.every(Fe))return{prompt:p.prompt,options:p.options,detectedRequestForFreeFormInput:p.freeFormInput};if(xi(p.options)&&Object.values(p.options).every(Fe)){let h=Object.keys(p.options);if(h.length===0)return;let g=h.map(f=>p.options[f]);return{prompt:p.prompt,options:h,descriptions:g,detectedRequestForFreeFormInput:p.freeFormInput}}}}}catch(c){this._logService.trace("OutputMonitor: Failed to parse confirmation prompt from language model response",c)}}_isSensitivePrompt(e){return/(password|passphrase|token|api\s*key|secret)/i.test(e)}_isAutopilotMode(){return this._sessionResource?(this._chatWidgetService.getWidgetBySessionResource(this._sessionResource)??this._chatWidgetService.lastFocusedWidget)?.input.currentModeInfo.permissionLevel==="autopilot"?!0:this._chatService.getSession(this._sessionResource)?.getRequests().at(-1)?.modeInfo?.permissionLevel==="autopilot":!1}async _selectAndHandleOption(e,t){if(!e?.options.length)return;let o=this._configurationService.getValue("chat.tools.terminal.autoReplyToPrompts")||this._isAutopilotMode(),n=this._chatWidgetService.getWidgetsByLocations("panel")[0]?.input.currentLanguageModel;n&&(n=(await this._safeSelectLanguageModels({vendor:"copilot",family:n.replaceAll("copilot/","")}))[0]),n||(n=await this._getLanguageModel());let r=e.prompt,s=e.options,l=this._execution.instance.registerMarker();if(!l)return;this._lastPromptMarker=l,this._lastPrompt=r;let c="";if(n)try{let f=`Given the following confirmation prompt and options from a terminal output, which option is the default?
Prompt: "${r}"
Options: ${JSON.stringify(s)}
Respond with only the option string.`,v=await this._languageModelsService.sendChatRequest(n,void 0,[{role:1,content:[{type:"text",value:f}]}],{},t);c=(await JDt(v)).trim()}catch(f){this._logService.trace("OutputMonitor: Failed to get suggested option from model",f)}else if(!o)return;let u,p;if(c){let f=Tgn(e.options,c);if(!f.option||f.index===-1)if(o)u=s[0],p=0,this._logService.trace(`OutputMonitor: LLM suggestion '${c}' didn't match options, falling back to first option: ${u}`);else return;else u=f.option,p=f.index}else if(o)u=s[0],p=0,this._logService.trace(`OutputMonitor: No LLM suggestion, falling back to first option: ${u}`);else return;let h=!1;o&&(await this._execution.instance.sendText(u,!0),this._outputMonitorTelemetryCounters.inputToolAutoAcceptCount++,this._outputMonitorTelemetryCounters.inputToolAutoChars+=u?.length||0,h=!0);let g=e.descriptions?.[p];return g?{suggestedOption:{description:g,option:u},sentToTerminal:h}:{suggestedOption:u,sentToTerminal:h}}async _requestFreeFormTerminalInput(e,t,o,n=!1){let r=Symbol("focusTerminalSelection"),{promise:s,part:l}=this._createElicitationPart(e,t.sessionResource,new Ie(d(15301,null)),new Ie(d(15303,null,o.prompt)),"",d(15300,null),void 0,()=>(this._showInstance(t.instance.instanceId),r)),c=x.None,u=x.None,p=new Promise(f=>{let v=!1,b=(S,y)=>{v||(v=!0,l.hide(),c.dispose(),u.dispose(),this._state=y,f(S))};c=this._register(t.instance.onDidInputData(S=>{(n&&S.length>0||!n&&(S==="\r"||S===`
`||S===`\r
`))&&(this._outputMonitorTelemetryCounters.inputToolFreeFormInputCount++,b(!0,"PollingForIdle"))})),u=this._register(t.instance.onDisposed(()=>{b(!1,"Cancelled")}))}),h=()=>{c.dispose(),u.dispose()},g=await Promise.race([s,p]);return g===r?(t.instance.focus(!0),await p):g===void 0?(h(),!1):(h(),!!g)}async _confirmRunInTerminal(e,t,o,n){let r=Fe(t)?t:t.option,s=Symbol("focusTerminalSelection"),l=x.None,c=x.None,{promise:u,part:p}=this._createElicitationPart(e,o.sessionResource,new Ie(d(15298,null)),new Ie(d(15299,null,n.prompt,r,Fe(t)?"":t.description?" ("+t.description+")":"")),"",d(15297,null),d(15302,null),async v=>{let b;return v===!0?b=r:typeof v=="object"&&Object.hasOwn(v,"label")&&(b=v.label.split(" (")[0]),this._outputMonitorTelemetryCounters.inputToolManualAcceptCount++,this._outputMonitorTelemetryCounters.inputToolManualChars+=b?.length||0,b},()=>(this._showInstance(o.instance.instanceId),this._outputMonitorTelemetryCounters.inputToolManualRejectCount++,s),Egn(t,n)),h=new Promise(v=>{let b=!1,S=(y,w)=>{b||(b=!0,p.hide(),l.dispose(),c.dispose(),this._state=w,v(y))};l=this._register(o.instance.onDidInputData(()=>{S(!0,"PollingForIdle")})),c=this._register(o.instance.onDisposed(()=>{S(!1,"Cancelled")}))}),g=()=>{l.dispose(),c.dispose()},f=await Promise.race([u,h]);return f===s?(o.instance.focus(!0),await h):f===!0?(g(),!0):typeof f=="string"&&f.length?(o.instance.focus(!0),g(),await o.instance.sendText(f,!0),f):(g(),f)}_showInstance(e){if(!e)return;let t=this._terminalService.getInstanceFromId(e);t&&(this._terminalService.setActiveInstance(t),this._terminalService.revealActiveTerminal(!0))}_createElicitationPart(e,t,o,n,r,s,l,c,u,p){let h=t&&this._chatService.getSession(t);if(!(h instanceof Ef))throw new Error("No model");let g=h.getRequests().at(-1);if(!g)throw new Error("No request");let f,v=new Promise(b=>{let S=f=new rne(o,n,r,s,l,async y=>{try{let w=await(c?c(y):void 0);if(b(w),typeof w=="symbol")return"pending"}catch{b(void 0)}return S.hide(),this._promptPart=void 0,"accepted"},async()=>{try{let y=await(u?u():void 0);if(b(y),typeof y=="symbol")return"pending"}catch{b(void 0)}return S.hide(),this._promptPart=void 0,"rejected"},void 0,p,()=>this._outputMonitorTelemetryCounters.inputToolManualShownCount++);h.acceptResponseProgress(g,S),this._promptPart=S});return this._register(e.onCancellationRequested(()=>f.hide())),{promise:v,part:f}}async _getLanguageModel(){let e=await this._safeSelectLanguageModels({vendor:"copilot",id:"copilot-fast"});if(e.length)return e[0];let o=(this._chatWidgetService.lastFocusedWidget??this._chatWidgetService.getWidgetsByLocations("panel")[0])?.input.currentLanguageModel;if(o){let r=await this._safeSelectLanguageModels({vendor:"copilot",family:o.replaceAll("copilot/","")});if(r.length)return r[0]}let n=await this._safeSelectLanguageModels({vendor:"copilot"});if(n.length)return n[0]}async _safeSelectLanguageModels(e){try{return await this._languageModelsService.selectLanguageModels(e)}catch(t){return this._logService.trace("OutputMonitor: selectLanguageModels failed",{selector:e,error:t}),[]}}};pre=I([m(5,ds),m(6,Og),m(7,mi),m(8,Pt),m(9,B),m(10,ca),m(11,nn)],pre);function Egn(a,i){let e=[],t=i.options.filter(n=>n!==(Fe(a)?a:a.option)),o=0;for(let n of t){let r=n+(i.descriptions?" ("+i.descriptions[o]+")":""),s={label:r,tooltip:r,id:`terminal.poll.send.${n}`,class:void 0,enabled:!0,run:async()=>{}};o++,e.push(s)}return e.length?e:void 0}function Tgn(a,i){let e=s=>s.replace(/['"`]/g,"").trim().replace(/[.,:;]+$/,""),t=e(i);if(!t)return{option:void 0,index:-1};let o=[t],n=t.split(/\s+/)[0];n&&n!==t&&o.push(n);let r=t.match(/[A-Za-z0-9]+/);r?.[0]&&r[0]!==t&&r[0]!==n&&o.push(r[0]);for(let s of o){let l=a.findIndex(p=>e(p)===s);if(l!==-1)return{option:a[l],index:l};let c=s.toLowerCase(),u=a.findIndex(p=>e(p).toLowerCase()===c);if(u!==-1)return{option:a[u],index:u}}return{option:void 0,index:-1}}function _gn(a){return[/\s*(?:\[[^\]]\]\s+[^\[\s][^\[]*\s*)+(?:\(default is\s+"[^"]+"\):)?\s+$/,/(?:\(|\[)\s*(?:y(?:es)?\s*\/\s*n(?:o)?|n(?:o)?\s*\/\s*y(?:es)?)\s*(?:\]|\))\s+$/i,/[?:]\s*(?:\(|\[)?\s*y(?:es)?\s*\/\s*n(?:o)?\s*(?:\]|\))?\s+$/i,/\(y\)\s*$/i,/:\s*$/,/\(END\)$/,/password[:]?$/i,/\?\s*(?:\([a-z\s]+\))?$/i,/press a(?:ny)? key/i].some(i=>i.test(a))}function tBi(a){return[/press [h?]\s*(?:\+\s*enter)?\s*to (?:show|open|display|get|see)\s*(?:available )?(?:help|commands|options)/i,/press h\s*(?:or\s*\?)?\s*(?:\+\s*enter)?\s*for (?:help|commands|options)/i,/press \?\s*(?:\+\s*enter)?\s*(?:to|for)?\s*(?:help|commands|options|list)/i,/type\s*[h?]\s*(?:\+\s*enter)?\s*(?:for|to see|to show)\s*(?:help|commands|options)/i,/hit\s*[h?]\s*(?:\+\s*enter)?\s*(?:for|to see|to show)\s*(?:help|commands|options)/i,/press o\s*(?:\+\s*enter)?\s*(?:to|for)?\s*(?:open|launch)(?:\s*(?:the )?(?:app|application|browser)|\s+in\s+(?:the\s+)?browser)?/i,/press r\s*(?:\+\s*enter)?\s*(?:to|for)?\s*(?:restart|reload|refresh)(?:\s*(?:the )?(?:server|dev server|service))?/i,/press q\s*(?:\+\s*enter)?\s*(?:to|for)?\s*(?:quit|exit|stop)(?:\s*(?:the )?(?:server|app|process))?/i,/press u\s*(?:\+\s*enter)?\s*(?:to|for)?\s*(?:show|print|display)\s*(?:the )?(?:server )?urls?/i].some(i=>i.test(a))}var Dgn=[d(15294,null),d(15304,null),d(15295,null),d(15296,null),d(15305,null)],Lgn=Dgn.map(a=>a.replace(/[\s.,:;!?"'`()[\]{}<>\-_/\\]+/g,"").toLowerCase());function gDo(a){let i=a.replace(/[\s.,:;!?"'`()[\]{}<>\-_/\\]+/g,"").toLowerCase();return Lgn.some(e=>i.includes(e))}function Rgn(a){return gDo(a)?!1:/press a(?:ny)? key/i.test(a)}var v8t=class extends x{rewrite(i){if(!i.cwd)return;let e=d8t(i.commandLine,i.shell,i.os);if(e){let t=e.directory.replace(/(?:[\\\/])$/,""),o=i.cwd.fsPath.replace(/(?:[\\\/])$/,"");if(i.os===1&&(t=t.toLowerCase(),o=o.toLowerCase()),t===o)return{rewritten:e.command,reasoning:"Removed redundant cd command"}}}};var q1e=class extends x{constructor(e){super();this._configurationService=e}rewrite(e){if(this._configurationService.getValue("chat.tools.terminal.preventShellHistory")===!0&&(l8t(e.shell,e.os)||F1e(e.shell,e.os)))return{rewritten:` ${e.commandLine}`,reasoning:"Prepended with a space to exclude from shell history"}}};q1e=I([m(0,B)],q1e);var b8t=class extends x{constructor(e){super();this._treeSitterCommandParser=e}async rewrite(e){if(_x(e.shell,e.os)){let t;try{t=await this._treeSitterCommandParser.extractPwshDoubleAmpersandChainOperators(e.commandLine)}catch{}if(t&&t.length>0){let o=e.commandLine;for(let n of t.reverse())o=`${o.substring(0,n.node.startIndex)};${o.substring(n.node.endIndex)}`;return{rewritten:o,reasoning:"&& re-written to ;"}}}}};var $1e=class extends x{constructor(e){super();this._sandboxService=e}async rewrite(e){let t=await this._sandboxService.checkForSandboxingPrereqs();return!t.enabled||t.failedCheck==="config"?void 0:{rewritten:this._sandboxService.wrapCommand(e.commandLine,e.requestUnsandboxedExecution),reasoning:"Wrapped command for sandbox execution",forDisplay:e.commandLine,isSandboxWrapped:!0}}};$1e=I([m(0,WN)],$1e);var j1e=class{constructor(i){this._logService=i}async capture(i,e,t){if(t){try{i.terminalCommandUri=this._createTerminalCommandUri(e,t)}catch(r){this._logService.warn(`RunInTerminalTool: Failed to create terminal command URI for ${t}`,r)}let o=await this._tryGetCommand(e,t);if(o){i.terminalCommandState={exitCode:o.exitCode,timestamp:o.timestamp,duration:o.duration};let r=await this._captureCommandOutput(e,o);r&&(i.terminalCommandOutput=r),this._applyTheme(i,e);return}let n=await this._capturePartialCommandOutput(e,t);n&&(i.terminalCommandOutput=n,this._logService.debug(`RunInTerminalTool: Captured partial command output for ${t}`))}this._applyTheme(i,e)}async _captureCommandOutput(i,e){try{await i.xtermReadyPromise}catch{return}let t=i.xterm;if(t)return Lbo(t,e,(o,n)=>{let r=o==="fallback"?" (fallback)":"";this._logService.debug(`RunInTerminalTool: Failed to snapshot command output${r}`,n)})}async _capturePartialCommandOutput(i,e){try{await i.xtermReadyPromise}catch{return}let t=i.xterm;if(!t)return;let n=i.capabilities.get(2)?.currentCommand;if(n&&n.id===e){let r=n.commandExecutedMarker;if(r&&!r.isDisposed)try{let l=t.raw.buffer.active,c=l.baseY+l.cursorY,u=r.line,p=Math.max(c-u,0);if(p>0){let h=await t.getRangeAsVT(r,void 0,!0);if(h)return{text:h,lineCount:p}}}catch(s){this._logService.debug("RunInTerminalTool: Failed to capture partial command output",s)}}}_applyTheme(i,e){let t=e.xterm?.getXtermTheme();t&&(i.terminalTheme={background:t.background,foreground:t.foreground})}_createTerminalCommandUri(i,e){let t=new URLSearchParams(i.resource.query);return t.set("command",e),i.resource.with({query:t.toString()})}async _tryGetCommand(i,e){return i.capabilities.get(2)?.commands.find(o=>o.id===e)}};j1e=I([m(0,ca)],j1e);var Q1e=class extends x{constructor(e){super();this._sandboxService=e}async analyze(e){if(!e.isSandboxWrapped)return;let t=e.exitCode!==void 0&&e.exitCode!==0,o=!t&&e.exitCode===void 0&&this._outputLooksSandboxBlocked(e.exitResult);if(!t&&!o)return;let r=await this._sandboxService.getOS()===3?"chat.agent.sandboxFileSystem.linux":"chat.agent.sandboxFileSystem.mac";return`${t?"Command failed while running in sandboxed mode. If the command failed due to sandboxing:":"Command ran in sandboxed mode and may have been blocked by the sandbox. If the command failed due to sandboxing:"}
- If it would be reasonable to extend the sandbox rules, work with the user to update allowWrite for file system access problems in ${r}, or to add required domains to chat.agent.sandboxNetwork.allowedDomains.
- Otherwise, immediately retry the command with requestUnsandboxedExecution=true. Do NOT ask the user \u2014 setting this flag automatically shows a confirmation prompt to the user.

Here is the output of the command:
`}_outputLooksSandboxBlocked(e){return Pgn(e)}};Q1e=I([m(0,WN)],Q1e);function Pgn(a){let i=a.replace(/\n/g," ");return/Operation not permitted|Permission denied|Read-only file system|sandbox-exec|bwrap|sandbox_violation/i.test(i)}var fDo="https://aka.ms/vscode-sandboxing",iBi="runInTerminal",SDo=["runCommands/runInTerminal"];function Agn(a,i,e){let t=cDo(a),o=[`This tool allows you to execute ${t?"Windows PowerShell 5.1":"PowerShell"} commands in a persistent terminal session, preserving environment variables, working directory, and other context across multiple commands.`,"","Command Execution:",t?"- Use semicolons ; to chain commands on one line, NEVER use && even when asked explicitly":"- Prefer ; when chaining commands on one line","- Prefer pipelines | for object-based data flow",'- Never create a sub-shell (eg. powershell -c "command") unless explicitly asked',"","Directory Management:","- Prefer relative paths when navigating directories, only use absolute when the path is far away or the current cwd is not expected","- Remember when isBackground=false is specified, that the shell and cwd are reused until it is moved to the background","- Use $PWD or Get-Location for current directory","- Use Push-Location/Pop-Location for directory stack","","Program Execution:","- Supports .NET, Python, Node.js, and other executables","- Install modules via Install-Module, Install-Package","- Use Get-Command to verify cmdlet/function availability","","Background Processes:","- For long-running tasks (e.g., servers), set isBackground=true","- Returns a terminal ID for checking status and runtime later","- Use Start-Job for background PowerShell jobs"];return i&&o.push(...IDo(e)),o.push("","Output Management:","- Output is automatically truncated if longer than 60KB to prevent context overflow","- Use Select-Object, Where-Object, Format-Table to filter output","- Use -First/-Last parameters to limit results","- For pager commands, add | Out-String or | Format-List","","Best Practices:","- Use proper cmdlet names instead of aliases in scripts",'- Quote paths with spaces: "C:\\Path With Spaces"',"- Prefer PowerShell cmdlets over external commands when available","- Prefer idiomatic PowerShell like Get-ChildItem instead of dir or ls for file listings","- Use Test-Path to check file/directory existence","- Be specific with Select-Object properties to avoid excessive output","- Avoid printing credentials unless absolutely required","- NEVER run Start-Sleep or similar wait commands. If you need to wait for a background process, use await_terminal or get_terminal_output instead"),o.join(`
`)}function IDo(a){let i=["","Sandboxing:","- ATTENTION: Terminal sandboxing is enabled, commands run in a sandbox by default","- When executing commands within the sandboxed environment, all operations requiring a temporary directory must utilize the $TMPDIR environment variable. The /tmp directory is not guaranteed to be accessible or writable and must be avoided","- Tools and scripts should respect the TMPDIR environment variable, which is automatically set to an appropriate path within the sandbox","- When a command fails due to sandbox restrictions, immediately re-run it with requestUnsandboxedExecution=true. Do NOT ask the user for permission \u2014 setting this flag automatically shows a confirmation prompt to the user","- Only set requestUnsandboxedExecution=true when there is evidence of failures caused by the sandbox, e.g. 'Operation not permitted' errors, network failures, or file access errors, etc","- When setting requestUnsandboxedExecution=true, also provide requestUnsandboxedExecutionReason explaining why the command needs unsandboxed access"];if(a){let e=new Set(a.deniedDomains),t=a.allowedDomains.filter(o=>!e.has(o));t.length===0?i.push("- All network access is blocked in the sandbox"):i.push(`- Only the following domains are accessible in the sandbox (all other network access is blocked): ${t.join(", ")}`),a.deniedDomains.length>0&&i.push(`- The following domains are explicitly blocked in the sandbox: ${a.deniedDomains.join(", ")}`)}return i}function oBi(a,i){let e=[`
Command Execution:
- Use && to chain simple commands on one line
- Prefer pipelines | over temporary files for data flow
- Never create a sub-shell (eg. bash -c "command") unless explicitly asked

Directory Management:
- Prefer relative paths when navigating directories, only use absolute when the path is far away or the current cwd is not expected
- Remember when isBackground=false is specified, that shell and cwd is reused until it is moved to the background
- Use $PWD for current directory references
- Consider using pushd/popd for directory stack management
- Supports directory shortcuts like ~ and -

Program Execution:
- Supports Python, Node.js, and other executables
- Install packages via package managers (brew, apt, etc.)
- Use which or command -v to verify command availability

Background Processes:
- For long-running tasks (e.g., servers), set isBackground=true
- Returns a terminal ID for checking status and runtime later`];return a&&e.push(IDo(i).join(`
`)),e.push(`

Output Management:
- Output is automatically truncated if longer than 60KB to prevent context overflow
- Use head, tail, grep, awk to filter and limit output size
- For pager commands, disable paging: git --no-pager or add | cat
- Use wc -l to count lines before displaying large outputs

Best Practices:
- Quote variables: "$var" instead of $var to handle spaces
- Use find with -exec or xargs for file operations
- Be specific with commands to avoid excessive output
- Avoid printing credentials unless absolutely required
- NEVER run sleep or similar wait commands in a terminal. If you need to wait for a background process, use await_terminal or get_terminal_output instead`),e.join("")}function Ngn(a,i){return["This tool allows you to execute shell commands in a persistent bash terminal session, preserving environment variables, working directory, and other context across multiple commands.",oBi(a,i),"- Use [[ ]] for conditional tests instead of [ ]","- Prefer $() over backticks for command substitution","- Use set -e at start of complex commands to exit on errors"].join(`
`)}function Ogn(a,i){return["This tool allows you to execute shell commands in a persistent zsh terminal session, preserving environment variables, working directory, and other context across multiple commands.",oBi(a,i),"- Use type to check command type (builtin, function, alias)","- Use jobs, fg, bg for job control","- Use [[ ]] for conditional tests instead of [ ]","- Prefer $() over backticks for command substitution","- Use setopt errexit for strict error handling","- Take advantage of zsh globbing features (**, extended globs)"].join(`
`)}function Fgn(a,i){return["This tool allows you to execute shell commands in a persistent fish terminal session, preserving environment variables, working directory, and other context across multiple commands.",oBi(a,i),"- Use type to check command type (builtin, function, alias)","- Use jobs, fg, bg for job control","- Use test expressions for conditionals (no [[ ]] syntax)","- Prefer command substitution with () syntax","- Variables are arrays by default, use $var[1] for first element","- Use set -e for strict error handling","- Take advantage of fish's autosuggestions and completions"].join(`
`)}async function yDo(a){let i=a.get(F),e=a.get(WN),t=i.createInstance(Y1e),[o,n,r]=await Promise.all([t.getCopilotShell(),t.osBackend,e.isEnabled()]),s=r?e.getResolvedNetworkDomains():void 0,l;return o&&n&&_x(o,n)?l=Agn(o,r,s):o&&n&&F1e(o,n)?l=Ogn(r,s):o&&n&&c8t(o,n)?l=Fgn(r,s):l=Ngn(r,s),{id:"run_in_terminal",toolReferenceName:iBi,legacyToolReferenceFullNames:SDo,displayName:d(15340,null),modelDescription:l,userDescription:d(15341,null),source:kn.Internal,icon:R.terminal,inputSchema:{type:"object",properties:{command:{type:"string",description:"The command to run in the terminal."},explanation:{type:"string",description:"A one-sentence description of what the command does. This will be shown to the user before the command is run."},goal:{type:"string",description:'A short description of the goal or purpose of the command (e.g., "Install dependencies", "Start development server").'},isBackground:{type:"boolean",description:`Whether the command starts a background process.

- If true, a new shell will be spawned where the cwd is the workspace directory and will run asynchronously in the background and you will not see the output.

- If false, a single shell is shared between all non-background terminals where the cwd starts at the workspace directory and is remembered until that terminal is moved to the background, the tool call will block on the command finishing and only then you will get the output.

Examples of background processes: building in watch mode, starting a server. You can check the output of a background process later on by using get_terminal_output. If unsure whether a command will be long-running, prefer isBackground=true.`},timeout:{type:"number",description:"An optional timeout in milliseconds. When provided, the tool will stop tracking the command after this duration and return the output collected so far with a timeout indicator. Be conservative with the timeout duration, give enough time that the command would complete on a low-end machine. Use 0 for no timeout. If it's not clear how long the command will take then use 0 to avoid prematurely terminating it, never guess too low."},...r?{requestUnsandboxedExecution:{type:"boolean",description:"Request that this command run outside the terminal sandbox. Only set this when the command clearly needs unsandboxed access. The user will be prompted before the command runs unsandboxed."},requestUnsandboxedExecutionReason:{type:"string",description:"A short explanation of why this command must run outside the terminal sandbox. Only provide this when requestUnsandboxedExecution is true."}}:{}},required:["command","explanation","goal","isBackground"]}}}var vDo=["\x1B[I","\x1B[O"],bDo=`
`+d(15339,null),Fh=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super();this._chatService=e;this._configurationService=t;this._fileService=o;this._historyService=n;this._instantiationService=r;this._labelService=s;this._languageModelToolsService=l;this._remoteAgentService=c;this._storageService=u;this._terminalChatService=p;this._logService=h;this._terminalService=g;this._terminalSandboxService=f;this._workspaceContextService=v;this._chatWidgetService=b;this._agentSessionsService=S;this._archivedSessionListener=this._register(new me);this._sessionTerminalAssociations=new gt;this._sessionTerminalInstances=new gt;this._terminalsBeingDisposedBySessionCleanup=new Set;this._osBackend=this._remoteAgentService.getEnvironment().then(y=>y?.os??Po),this._terminalToolCreator=this._instantiationService.createInstance(BU),this._treeSitterCommandParser=this._register(this._instantiationService.createInstance(B1e)),this._telemetry=this._instantiationService.createInstance(V1e),this._commandArtifactCollector=this._instantiationService.createInstance(j1e),this._profileFetcher=this._instantiationService.createInstance(Y1e),this._commandLineRewriters=[this._register(this._instantiationService.createInstance(v8t)),this._register(this._instantiationService.createInstance(b8t,this._treeSitterCommandParser))],this._enableCommandLineSandboxRewriting&&this._commandLineRewriters.push(this._register(this._instantiationService.createInstance($1e))),this._commandLineRewriters.push(this._register(this._instantiationService.createInstance(q1e))),this._commandLineAnalyzers=[this._register(this._instantiationService.createInstance(K1e,this._treeSitterCommandParser,(y,w)=>this._logService.info(`RunInTerminalTool#CommandLineFileWriteAnalyzer: ${y}`,w))),this._register(this._instantiationService.createInstance(ube,this._treeSitterCommandParser,this._telemetry,(y,w)=>this._logService.info(`RunInTerminalTool#CommandLineAutoApproveAnalyzer: ${y}`,w)))],this._enableCommandLineSandboxRewriting&&this._commandLineAnalyzers.push(this._register(this._instantiationService.createInstance(G1e))),this._commandLinePresenters=[this._instantiationService.createInstance(W1e),new u8t,new p8t,new m8t],this._outputAnalyzers=[this._register(this._instantiationService.createInstance(Q1e))],this._register(U.runAndSubscribe(this._configurationService.onDidChangeConfiguration,y=>{(!y||y.affectsConfiguration("chat.tools.terminal.enableAutoApprove"))&&this._configurationService.getValue("chat.tools.terminal.enableAutoApprove")!==!0&&this._storageService.remove("chat.tools.terminal.autoApprove.warningAccepted",-1)})),this._restoreTerminalAssociations(),this._register(this._terminalService.onDidDisposeInstance(y=>{this._removeTerminalAssociations(y)})),this._register(this._chatService.onDidDisposeSession(y=>{for(let w of y.sessionResources)this._cleanupSessionTerminals(w)}))}static{this._activeExecutions=new Map}static getBackgroundOutput(e){let t=Fh._activeExecutions.get(e);if(!t)throw new Error("Invalid terminal ID");return t.getOutput()}static getExecution(e){return Fh._activeExecutions.get(e)}static removeExecution(e){let t=Fh._activeExecutions.get(e);return t?(t.dispose(),Fh._activeExecutions.delete(e),!0):!1}get _enableCommandLineSandboxRewriting(){return!0}async handleToolStream(e,t){let o=e.rawInput;if(o&&typeof o=="object"&&o.command){let n=xct(o.command).replace(/\r\n|\r|\n/g," "),r=n.length>80?n.substring(0,77)+"...":n;return{invocationMessage:o.isBackground?new Ie(d(15333,null,r)):new Ie(d(15332,null,r))}}return{invocationMessage:d(15334,null)}}async prepareToolInvocation(e,t){let o=e.parameters,n=e.chatSessionResource,r;if(n){let cn=this._sessionTerminalAssociations.get(n);cn&&!cn.isBackground&&(r=cn.instance)}let[s,l,c,u]=await Promise.all([this._osBackend,this._profileFetcher.getCopilotShell(),(async()=>{let cn=await r?.getCwdResource();if(!cn){let er=this._historyService.getLastActiveWorkspaceRoot();cn=(er?this._workspaceContextService.getWorkspaceFolder(er)??void 0:void 0)?.uri}return cn})(),this._terminalSandboxService.checkForSandboxingPrereqs()]),p=s===1?"pwsh":"sh",g=u.enabled&&o.requestUnsandboxedExecution===!0,f=u.failedCheck==="dependencies"&&u.missingDependencies?.length?u.missingDependencies:void 0,v=xt(),b=`tool-${xt()}`,S=o.command,y,w=!1;for(let cn of this._commandLineRewriters){let er=await cn.rewrite({commandLine:S,cwd:c,shell:l,os:s,requestUnsandboxedExecution:g});er&&(S=er.rewritten,y=er.forDisplay??y,er.isSandboxWrapped&&(w=!0),this._logService.info(`RunInTerminalTool: Command rewritten by ${cn.constructor.name}: ${er.reasoning}`))}let k={kind:"terminal",terminalToolSessionId:v,terminalCommandId:b,commandLine:{original:o.command,toolEdited:S===o.command?void 0:S,forDisplay:y??xct(S??o.command),isSandboxWrapped:w},cwd:c,language:p,isBackground:o.isBackground,requestUnsandboxedExecution:g,requestUnsandboxedExecutionReason:o.requestUnsandboxedExecutionReason,missingSandboxDependencies:f},T;if(f){let cn=f.join(", ");T={title:d(15322,null),message:new Ie(d(15321,null,cn)),customButtons:[d(15320,null),d(15317,null)]}}let P=rDo(o.command,this._languageModelToolsService);if(P)return k.alternativeRecommendation=P,{confirmationMessages:void 0,presentation:"hidden",toolSpecificData:k};let O=S??o.command,V=()=>{let cn=this._configurationService.getValue("chat.tools.eligibleForAutoApproval");if(cn&&typeof cn=="object"){if(Object.prototype.hasOwnProperty.call(cn,iBi))return cn[iBi];for(let er of SDo)if(Object.prototype.hasOwnProperty.call(cn,er))return cn[er]}return!0},H=this._configurationService.getValue("chat.tools.terminal.enableAutoApprove")===!0,G=this._storageService.getBoolean("chat.tools.terminal.autoApprove.warningAccepted",-1,!1),$=V()&&H&&G,J={commandLine:O,cwd:c,os:s,shell:l,treeSitterLanguage:_x(l,s)?"powershell":"bash",terminalToolSessionId:v,chatSessionResource:n,requiresUnsandboxConfirmation:g},ae=n&&this._isSessionAutoApproveLevel(n),he=ae?this._commandLineAnalyzers.filter(cn=>!(cn instanceof ube)):this._commandLineAnalyzers,oe=await Promise.all(he.map(cn=>cn.analyze(J))),de=oe.map(cn=>cn.disclaimers).filter(cn=>!!cn).flatMap(cn=>cn),Ce;if(de.length>0){let cn=de.map(ua=>typeof ua=="string"?ua:ua.value),Ns=de.some(ua=>typeof ua!="string")?{supportThemeIcons:!0,isTrusted:{enabledCommands:["workbench.action.terminal.chat.openTerminalSettingsLink"]}}:{supportThemeIcons:!0};Ce=new Ie(`$(${R.info.id}) `+cn.join(" "),Ns)}let xe=oe.every(cn=>cn.isAutoApproveAllowed),ze=V()&&xe?oe.map(cn=>cn.customActions??[]).flat():void 0,De=jo(l,".exe");De==="powershell"&&(De="pwsh");let Oe=oe.some(cn=>cn.isAutoApproved)&&oe.every(cn=>cn.isAutoApproved!==!1)&&xe,pt=$&&Oe||oe.some(cn=>cn.forceAutoApproval);(pt||H&&oe.some(cn=>cn.autoApproveInfo))&&(k.autoApproveInfo=oe.find(cn=>cn.autoApproveInfo)?.autoApproveInfo);let et=(k.commandLine.forDisplay??k.commandLine.userEdited??k.commandLine.toolEdited??k.commandLine.original).trimStart(),Ti=d8t(et,l,s),Ht;if(Ti&&c){let er=(s===1?$s.isAbsolute(Ti.directory):Oo.isAbsolute(Ti.directory))?A.from({scheme:c.scheme,authority:c.authority,path:Ti.directory}):A.joinPath(c,Ti.directory),Ns=this._labelService.getUriLabel(er),ua=et.substring(0,et.length-Ti.command.length);k.confirmation={commandLine:Ti.command,cwdLabel:Ns,cdPrefix:ua},Ht=o.isBackground?d(15310,null,De,Ns):d(15312,null,De,Ns)}else k.confirmation={commandLine:et},Ht=o.isBackground?d(15309,null,De):d(15308,null,De);let Vo=Ti?.command??et;for(let cn of this._commandLinePresenters){let er=await cn.present({commandLine:{original:o.command,forDisplay:Vo},shell:l,os:s});if(er){if(k.presentationOverrides={commandLine:er.commandLine,language:er.language??void 0},Ti&&k.confirmation?.cwdLabel?er.languageDisplayName?Ht=o.isBackground?d(15326,null,er.languageDisplayName,De,k.confirmation.cwdLabel):d(15329,null,er.languageDisplayName,De,k.confirmation.cwdLabel):Ht=o.isBackground?d(15327,null,De,k.confirmation.cwdLabel):d(15330,null,De,k.confirmation.cwdLabel):er.languageDisplayName?Ht=o.isBackground?d(15325,null,er.languageDisplayName,De):d(15324,null,er.languageDisplayName,De):Ht=o.isBackground?d(15328,null,De):d(15331,null,De),!er.processOtherPresenters)break;Vo=er.commandLine}}g&&(Ht=o.isBackground?d(15336,null,De,fDo):d(15335,null,De,fDo));let sn=!pt&&!ae||e.forceConfirmationReason!==void 0,_n=g?new Ie(d(15337,null,o.explanation,o.goal,o.requestUnsandboxedExecutionReason||d(15338,null))):new Ie(d(15311,null,o.explanation,o.goal)),mn=sn?{title:Ht,message:_n,disclaimer:Ce,allowAutoConfirm:void 0,terminalCustomActions:ze}:void 0,hn=k.commandLine.forDisplay??k.commandLine.toolEdited??k.commandLine.original,yo=hn.length>80?hn.substring(0,77)+"...":hn;return{invocationMessage:k.commandLine.isSandboxWrapped?o.isBackground?new Ie(d(15316,null,yo)):new Ie(d(15315,null,yo)):o.isBackground?new Ie(d(15314,null,yo)):new Ie(d(15313,null,yo)),icon:k.commandLine.isSandboxWrapped?R.terminalSecure:R.terminal,confirmationMessages:T??mn,toolSpecificData:k}}_isSessionAutoApproveLevel(e){if(this._configurationService.inspect("chat.tools.global.autoApprove").policyValue===!1)return!1;let o=this._chatWidgetService.getWidgetBySessionResource(e)??this._chatWidgetService.lastFocusedWidget;if(o&&YX(o.input.currentModeInfo.permissionLevel))return!0;let r=this._chatService.getSession(e)?.getRequests().at(-1);return YX(r?.modeInfo?.permissionLevel)}async invoke(e,t,o,n){let r=e.toolSpecificData;if(!r)throw new Error("toolSpecificData must be provided for this tool");if(!e.context)throw new Error("Invocation context must be provided for this tool");let s=r.terminalCommandId;if(r.alternativeRecommendation)return{content:[{kind:"text",value:r.alternativeRecommendation}]};if(r.missingSandboxDependencies?.length){let hn=d(15320,null);if(e.selectedCustomButton===hn){let yo=e.context.sessionResource,{exitCode:Mr}=await this._terminalSandboxService.installMissingSandboxDependencies(r.missingSandboxDependencies,yo,n,{createTerminal:async()=>this._terminalService.createTerminal({}),focusTerminal:async cn=>{this._terminalService.setActiveInstance(cn),await this._terminalService.revealTerminal(cn,!0),cn.focus()}});if(Mr!==void 0&&Mr!==0)return{content:[{kind:"text",value:d(15319,null,Mr)}]};if(Mr===void 0)return{content:[{kind:"text",value:d(15323,null)}]};this._logService.info("RunInTerminalTool: Sandbox dependency installation succeeded, proceeding with command execution")}else return this._logService.info("RunInTerminalTool: User cancelled sandbox dependency installation"),{content:[{kind:"text",value:d(15318,null)}]}}let l=e.parameters;this._logService.debug(`RunInTerminalTool: Invoking with options ${JSON.stringify(l)}`);let c,u=e.context.sessionResource,p=r.commandLine.userEdited??r.commandLine.toolEdited??r.commandLine.original,h=r.commandLine.userEdited!==void 0&&r.commandLine.userEdited!==r.commandLine.original,g=!h&&r.commandLine.toolEdited!==void 0&&r.commandLine.toolEdited!==r.commandLine.original&&xct(r.commandLine.toolEdited).trim()!==xct(r.commandLine.original).trim(),f=r.commandLine.isSandboxWrapped===!0;if(n.isCancellationRequested)throw new go;let v,b=!l.isBackground&&!this._sessionTerminalAssociations.has(u),S=Date.now(),y=xt(),w=r.terminalToolSessionId,k=new N;this._logService.debug(`RunInTerminalTool: Creating ${l.isBackground?"background":"foreground"} terminal. termId=${y}, chatSessionResource=${u}`);let T=await this._initTerminal(u,y,w,l.isBackground,n);this._handleTerminalVisibility(T,u);let P=Date.now()-S,O=await T.instance.xtermReadyPromise;if(!O)throw new Error("Instance was disposed before xterm.js was ready");let V=T.instance.capabilities.get(2),H=0,G=!1;k.add(O.raw.onData(hn=>{vDo.includes(hn)||(H+=hn.length),G||=hn===""}));let $="",J=-1,ae,he,oe=!1,de=l.isBackground,Ce,xe,ze,De,Oe=k.add(new Ye(n)),pt=l.timeout!==void 0?Bn(l.timeout,0,Number.MAX_SAFE_INTEGER):void 0;!l.isBackground&&pt!==void 0&&pt>0&&this._configurationService.getValue("chat.tools.terminal.enforceTimeoutFromModel")===!0&&(Ce=Li(pt),xe=Ce.then(()=>({type:"timeout"})).catch(()=>({type:"timeout"})));let et,Ti=new Promise(hn=>{et=hn});w&&k.add(this._terminalChatService.onDidContinueInBackground(hn=>{if(hn===w){let yo=Fh._activeExecutions.get(y);yo&&yo.setBackground(),de=!0,et?.()}}));let Ht;try{let hn=this._instantiationService.createInstance(Ect,u,y,T,V,l.isBackground);T.shellIntegrationQuality==="none"&&(c="$(info) Enable [shell integration](https://code.visualstudio.com/docs/terminal/shell-integration) to improve command detection"),this._logService.info(`RunInTerminalTool: Using \`${hn.strategy.type}\` execute strategy for command \`${p}\``),k.add(hn),Fh._activeExecutions.set(y,hn);let yo=U.toPromise(hn.strategy.onDidCreateStartMarker);if(k.add(hn.strategy.onDidCreateStartMarker(Mr=>{ze||(ze=k.add(this._instantiationService.createInstance(pre,{instance:T.instance,sessionResource:u,getOutput:cn=>hn.getOutput(cn??Mr)},void 0,e.context,n,p)))})),Ht=hn.start(p,Oe.token,s),l.isBackground){if(this._logService.debug(`RunInTerminalTool: Starting background execution \`${p}\``),await yo,ze&&(await U.toPromise(ze.onDidFinishCommand),De=ze.pollingResult),await this._commandArtifactCollector.capture(r,T.instance,s),n.isCancellationRequested)throw new go;let Mr=r.terminalCommandState??{};Mr.timestamp=Mr.timestamp??S,r.terminalCommandState=Mr;let cn=f?`Command is now running in terminal with ID=${y}`:h?`Note: The user manually edited the command to \`${p}\`, and that command is now running in terminal with ID=${y}`:g?`Note: The tool simplified the command to \`${p}\`, and that command is now running in terminal with ID=${y}`:`Command is running in terminal with ID=${y}`,er=De?.modelOutputEvalResponse??De?.output,Ns=er?await this._getOutputAnalyzerMessage(void 0,er,p,f):void 0;De&&De.modelOutputEvalResponse?(cn+=`
 The command became idle with output:
`,Ns&&(cn+=`${Ns}
`),cn+=De.modelOutputEvalResponse):De&&(cn+=`
 The command is still running, with output:
`,Ns&&(cn+=`${Ns}
`),cn+=De.output);let ua=await T.instance.getCwdResource();return{toolMetadata:{exitCode:void 0,id:y,cwd:ua?.toString()},content:[{kind:"text",value:cn}]}}else{let Mr=[Ht.then(er=>({type:"completed",result:er})),Ti.then(()=>({type:"background"}))];xe&&Mr.push(xe);let cn=await Promise.race(Mr);if(cn.type==="background"){this._logService.debug("RunInTerminalTool: Continue in background triggered, returning output collected so far"),v="continueInBackground";let er=hn.getOutput();J=er?DL(er.trim(),`
`)+1:0,$=er}else if(cn.type==="timeout"){this._logService.debug("RunInTerminalTool: Timeout reached, returning output collected so far"),v="timeout",oe=!0,de=!0,T.isBackground=!0,this._sessionTerminalAssociations.delete(u),await this._associateProcessIdWithSession(T.instance,u,y,T.shellIntegrationQuality,!0);let er=hn.getOutput();J=er?DL(er.trim(),`
`)+1:0,$=er??""}else{let er=cn.result;if(T.receivedUserInput=!1,n.isCancellationRequested)throw new go;if(er.didEnterAltBuffer){let Ns=r.terminalCommandState??{};Ns.timestamp=Ns.timestamp??S,r.terminalCommandState=Ns,c=bDo,J=0,v=er.error??"alternateBuffer";let ua=await T.instance.getCwdResource();he={toolResultMessage:c,toolMetadata:{exitCode:void 0,id:y,cwd:ua?.toString()},content:[{kind:"text",value:bDo}]}}else{await this._commandArtifactCollector.capture(r,T.instance,s);{let ua=r.terminalCommandState??{};ua.timestamp=ua.timestamp??S,er.exitCode!==void 0&&(ua.exitCode=er.exitCode,ua.timestamp!==void 0&&(ua.duration=ua.duration??Math.max(0,Date.now()-ua.timestamp))),r.terminalCommandState=ua}this._logService.info(`RunInTerminalTool: Finished \`${hn.strategy.type}\` execute strategy with exitCode \`${er.exitCode}\`, result.length \`${er.output?.length}\`, error \`${er.error}\``),J=er.output===void 0?0:DL(er.output.trim(),`
`)+1,ae=er.exitCode,v=er.error;let Ns=[];er.output!==void 0&&Ns.push(er.output),er.additionalInformation&&Ns.push(er.additionalInformation),$=Ns.join(`

`)}}}}catch(hn){if(oe&&hn instanceof go){this._logService.debug("RunInTerminalTool: Timeout reached, returning output collected so far"),v="timeout",de=!0,T.isBackground=!0,this._sessionTerminalAssociations.delete(u);let yo=kct(T.instance,void 0);J=yo?DL(yo.trim(),`
`)+1:0,$=yo??""}else{if(this._logService.debug("RunInTerminalTool: Threw exception"),hn instanceof go){await this._commandArtifactCollector.capture(r,T.instance,s);let yo=r.terminalCommandState??{};yo.exitCode===void 0&&(yo.exitCode=-1,yo.timestamp=yo.timestamp??S,yo.duration=yo.duration??Math.max(0,Date.now()-yo.timestamp)),r.terminalCommandState=yo}throw Fh._activeExecutions.get(y)?.dispose(),Fh._activeExecutions.delete(y),T.instance.dispose(),v=hn instanceof go?"canceled":"unexpectedException",hn}}finally{Ce?.cancel(),de&&Ht?Ht.catch(yo=>{yo instanceof go||this._logService.error("RunInTerminalTool: Background execution error",yo)}):(Fh._activeExecutions.get(y)?.dispose(),Fh._activeExecutions.delete(y)),k.dispose();let hn=Date.now()-S;this._telemetry.logInvoke(T.instance,{terminalToolSessionId:r.terminalToolSessionId,didUserEditCommand:h,didToolEditCommand:g,isBackground:l.isBackground,isSandboxWrapped:r.commandLine.isSandboxWrapped===!0,shellIntegrationQuality:T.shellIntegrationQuality,error:v,isNewSession:b,outputLineCount:J,exitCode:ae,timingExecuteMs:hn,timingConnectMs:P,inputUserChars:H,inputUserSigint:G,terminalExecutionIdleBeforeTimeout:De?.state==="Idle",pollDurationMs:De?.pollDurationMs,inputToolManualAcceptCount:ze?.outputMonitorTelemetryCounters?.inputToolManualAcceptCount,inputToolManualRejectCount:ze?.outputMonitorTelemetryCounters?.inputToolManualRejectCount,inputToolManualChars:ze?.outputMonitorTelemetryCounters?.inputToolManualChars,inputToolAutoAcceptCount:ze?.outputMonitorTelemetryCounters?.inputToolAutoAcceptCount,inputToolAutoChars:ze?.outputMonitorTelemetryCounters?.inputToolAutoChars,inputToolManualShownCount:ze?.outputMonitorTelemetryCounters?.inputToolManualShownCount,inputToolFreeFormInputCount:ze?.outputMonitorTelemetryCounters?.inputToolFreeFormInputCount,inputToolFreeFormInputShownCount:ze?.outputMonitorTelemetryCounters?.inputToolFreeFormInputShownCount})}if(he)return he;let zi=[];f||(h?zi.push(`Note: The user manually edited the command to \`${p}\`, and this is the output of running that command instead:
`):g&&zi.push(`Note: The tool simplified the command to \`${p}\`, and this is the output of running that command instead:
`),de&&!l.isBackground&&zi.push(`Note: This terminal execution was moved to the background using the ID ${y}
`)),oe&&pt!==void 0&&pt>0&&zi.push(`Note: Command timed out after ${pt}ms and was moved to the background. The command may still be running in terminal ID ${y}. Use await_terminal to wait for it to complete or get_terminal_output to check its current output. Do NOT use sleep or manual polling to wait.

`);let Vo=await this._getOutputAnalyzerMessage(ae,$,p,f);Vo&&zi.push(`${Vo}
`),zi.push($);let sn=ae!==void 0&&ae!==0,_n=await T.instance.getCwdResource(),mn=await this._extractImagesFromOutput($,_n);return{toolResultMessage:c,toolMetadata:{exitCode:ae,id:y,cwd:_n?.toString(),timedOut:oe||void 0,timeoutMs:oe?pt:void 0},toolResultDetails:sn?{input:p,output:[{type:"embed",isText:!0,value:$}],isError:!0}:void 0,content:[{kind:"text",value:zi.join("")},...mn]}}async _getOutputAnalyzerMessage(e,t,o,n){for(let r of this._outputAnalyzers){let s=await r.analyze({exitCode:e,exitResult:t,commandLine:o,isSandboxWrapped:n});if(s)return s}}static{this._maxImageFileSize=5*1024*1024}async _extractImagesFromOutput(e,t){let o=e.replace(/\r?\n/g,""),n=/(?:[^\s]*[\/\\][^\s]*\.(?:png|jpe?g|gif|webp|bmp))/gi,r=new Set;for(let l of o.matchAll(n))r.add(l[0]);if(r.size===0)return[];let s=[];for(let l of r)try{let c=GI(l);if(!c||!c.startsWith("image/"))continue;let u;if(/^\/|^[A-Za-z]:[\\\/]/.test(l))u=A.file(l);else if(t)u=A.joinPath(t,l);else continue;let p=await this._fileService.stat(u).catch(()=>{});if(!p||p.isDirectory||p.size>Fh._maxImageFileSize)continue;let h=await this._fileService.readFile(u);s.push({kind:"data",value:{mimeType:c,data:h.value},audience:[1]})}catch{}return s}_handleTerminalVisibility(e,t){let o=!!this._chatWidgetService.getWidgetBySessionResource(t);this._configurationService.getValue("chat.tools.terminal.outputLocation")==="terminal"&&o&&(this._terminalService.setActiveInstance(e.instance),this._terminalService.revealTerminal(e.instance,!0))}async _initTerminal(e,t,o,n,r){if(!n){let u=this._sessionTerminalAssociations.get(e);if(u&&!u.isBackground)return this._logService.debug(`RunInTerminalTool: Using cached terminal with session resource \`${e}\``),this._terminalToolCreator.refreshShellIntegrationQuality(u),this._terminalChatService.registerTerminalInstanceWithToolSession(o,u.instance),u}this._logService.debug(`RunInTerminalTool: Creating ${n?"background":"foreground"} terminal with ID=${t}`);let s=await this._profileFetcher.getCopilotProfile(),l=await this._osBackend,c=await this._terminalToolCreator.createTerminal(s,l,r);if(c.isBackground=n,this._terminalChatService.registerTerminalInstanceWithToolSession(o,c.instance),this._terminalChatService.registerTerminalInstanceWithChatSession(e,c.instance),this._registerInputListener(c),this._addSessionTerminalAssociation(e,c),r.isCancellationRequested)throw c.instance.dispose(),new go;return await this._setupProcessIdAssociation(c,e,t,n),c}_registerInputListener(e){let t=e.instance.onData(o=>{vDo.includes(o)||(e.receivedUserInput=o.length>0)});this._register(e.instance.onDisposed(()=>t.dispose()))}_restoreTerminalAssociations(){let e=this._storageService.get("chat.terminalSessions",1,"{}");try{let t=JSON.parse(e);for(let o of this._terminalService.instances)if(o.processId){let n=t[o.processId];if(n){let r=Jr.forSession(n.sessionId);this._logService.debug(`RunInTerminalTool: Restored terminal association for PID ${o.processId}, session ${n.sessionId}`);let s={instance:o,shellIntegrationQuality:n.shellIntegrationQuality,isBackground:n.isBackground};this._addSessionTerminalAssociation(r,s),this._terminalChatService.registerTerminalInstanceWithChatSession(r,o),this._register(o.onDisposed(()=>{this._removeProcessIdAssociation(o.processId)}))}}}catch(t){this._logService.debug(`RunInTerminalTool: Failed to restore terminal associations: ${t}`)}}async _setupProcessIdAssociation(e,t,o,n){await this._associateProcessIdWithSession(e.instance,t,o,e.shellIntegrationQuality,n),this._register(e.instance.onDisposed(()=>{e.instance.processId&&this._removeProcessIdAssociation(e.instance.processId)}))}async _associateProcessIdWithSession(e,t,o,n,r){try{let s=await Promise.race([e.processReady.then(()=>e.processId),Li(5e3).then(()=>{throw new Error("Timeout")})]);if(Yo(s)){let l=this._storageService.get("chat.terminalSessions",1,"{}"),c=JSON.parse(l),u=ap(t),p=c[s]||{};c[s]={...p,sessionId:u,shellIntegrationQuality:n,id:o,isBackground:r},this._storageService.store("chat.terminalSessions",JSON.stringify(c),1,0),this._logService.debug(`RunInTerminalTool: Associated terminal PID ${s} with session ${u}`)}}catch(s){this._logService.debug(`RunInTerminalTool: Failed to associate terminal with session: ${s}`)}}async _removeProcessIdAssociation(e){try{let t=this._storageService.get("chat.terminalSessions",1,"{}"),o=JSON.parse(t);o[e]&&(delete o[e],this._storageService.store("chat.terminalSessions",JSON.stringify(o),1,0),this._logService.debug(`RunInTerminalTool: Removed terminal association for PID ${e}`))}catch(t){this._logService.debug(`RunInTerminalTool: Failed to remove terminal association: ${t}`)}}_cleanupSessionTerminals(e){let t=this._sessionTerminalInstances.get(e),o=this._sessionTerminalAssociations.get(e),n=t??(o?new Set([o.instance]):void 0);if(!n||n.size===0)return;this._logService.debug(`RunInTerminalTool: Cleaning up ${n.size} terminal(s) for ended chat session ${e}`),this._sessionTerminalAssociations.delete(e),this._sessionTerminalInstances.delete(e);for(let s of n)this._terminalsBeingDisposedBySessionCleanup.add(s),s.dispose();let r=[];for(let[s,l]of Fh._activeExecutions.entries())n.has(l.instance)&&(l.dispose(),r.push(s));for(let s of r)Fh._activeExecutions.delete(s)}_addSessionTerminalAssociation(e,t){this._ensureArchivedSessionListener();let o=this._sessionTerminalInstances.get(e);o||(o=new Set,this._sessionTerminalInstances.set(e,o)),o.add(t.instance),t.isBackground||this._sessionTerminalAssociations.set(e,t)}_ensureArchivedSessionListener(){this._archivedSessionListener.value||(this._archivedSessionListener.value=this._agentSessionsService.onDidChangeSessionArchivedState(e=>{e.isArchived()&&this._cleanupSessionTerminals(e.resource)}))}_removeTerminalAssociations(e){if(!this._terminalsBeingDisposedBySessionCleanup.delete(e)){for(let[t,o]of this._sessionTerminalAssociations.entries())e===o.instance&&this._sessionTerminalAssociations.delete(t);for(let[t,o]of this._sessionTerminalInstances.entries())o.delete(e)&&o.size===0&&this._sessionTerminalInstances.delete(t)}}};Fh=I([m(0,mi),m(1,B),m(2,fe),m(3,na),m(4,F),m(5,rt),m(6,Vn),m(7,bo),m(8,ce),m(9,Wv),m(10,ca),m(11,nn),m(12,WN),m(13,Pe),m(14,Pt),m(15,md)],Fh);var Ect=class extends x{constructor(e,t,o,n,r,s){super();this.sessionResource=e;this.termId=t;this._instantiationService=s;this._toolTerminal=o,this._isBackground=r,this._completionDeferred=new Ko,this.strategy=this._register(this._createStrategy(n)),this._register(this.strategy.onDidCreateStartMarker(l=>{l&&(this._startMarker=l)}))}get completionPromise(){return this._completionDeferred.p}get isBackground(){return this._isBackground}get startMarker(){return this._startMarker}get instance(){return this._toolTerminal.instance}_createStrategy(e){switch(this._toolTerminal.shellIntegrationQuality){case"none":return this._instantiationService.createInstance(N1e,this._toolTerminal.instance,()=>this._toolTerminal.receivedUserInput??!1);case"basic":return this._instantiationService.createInstance(A1e,this._toolTerminal.instance,()=>this._toolTerminal.receivedUserInput??!1,e);case"rich":return this._instantiationService.createInstance(O1e,this._toolTerminal.instance,e)}}async start(e,t,o){try{let n=await this.strategy.execute(e,t,o);return this._completionDeferred.complete(n),n}catch(n){throw this._completionDeferred.error(n),n}}setForeground(){this._isBackground=!1}setBackground(){this._isBackground=!0}getOutput(e){return kct(this.instance,e??this._startMarker)}};Ect=I([m(5,F)],Ect);var Y1e=class{constructor(i,e,t){this._configurationService=i;this._terminalProfileResolverService=e;this._remoteAgentService=t;this.osBackend=this._remoteAgentService.getEnvironment().then(o=>o?.os??Po)}async getCopilotProfile(){let i=await this.osBackend,e=this._getChatTerminalProfile(i);if(e)return e;let t=await this._terminalProfileResolverService.getDefaultProfile({os:i,remoteAuthority:this._remoteAgentService.getConnection()?.remoteAuthority});return jo(t.path)==="cmd.exe"?{...t,path:"C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",profileName:"PowerShell"}:t.path==="/bin/sh"?{...t,path:"/bin/bash",profileName:"bash"}:{...t,icon:void 0}}async getCopilotShell(){return(await this.getCopilotProfile()).path}_getChatTerminalProfile(i){let e;switch(i){case 1:e="chat.tools.terminal.terminalProfile.windows";break;case 2:e="chat.tools.terminal.terminalProfile.osx";break;case 3:default:e="chat.tools.terminal.terminalProfile.linux";break}let t=this._configurationService.getValue(e);if(this._isValidChatAgentTerminalProfile(t))return t}_isValidChatAgentTerminalProfile(i){return i==null||typeof i!="object"?!1:!!("path"in i&&Fe(i.path))}};Y1e=I([m(0,B),m(1,Ag),m(2,bo)],Y1e);var nBi={id:"await_terminal",toolReferenceName:"awaitTerminal",displayName:d(15267,null),modelDescription:"Wait for a background terminal command to complete. Returns the output, exit code, or timeout status.",icon:R.terminal,source:kn.Internal,inputSchema:{type:"object",properties:{id:{type:"string",description:"The ID of the terminal to await (returned by run_in_terminal when isBackground=true)."},timeout:{type:"number",description:"Timeout in milliseconds. If the command does not complete within this time, returns the output collected so far with a timeout indicator. Use 0 for no timeout."}},required:["id","timeout"]}},S8t=class extends x{async prepareToolInvocation(i,e){return{invocationMessage:d(15266,null),pastTenseMessage:d(15265,null)}}async invoke(i,e,t,o){let n=i.parameters,r=Fh.getExecution(n.id);if(!r)return{content:[{kind:"text",value:`Error: No active terminal execution found with ID ${n.id}. The terminal may have already completed or the ID is invalid.`}]};try{let s,l=Math.max(0,n.timeout);if(l>0){let h=Li(l).then(()=>({type:"timeout"})),g=Wp(r.completionPromise,o).then(v=>({type:"completed",result:v})),f=await Promise.race([g,h]);if(f.type==="timeout"){let v=r.getOutput();return{toolMetadata:{exitCode:void 0,timedOut:!0},content:[{kind:"text",value:`Terminal ${n.id} timed out after ${l}ms. Output collected so far:
${v}`}]}}s=f.result}else s=await Wp(r.completionPromise,o);let u=r.getOutput(),p=s.exitCode!==void 0?` (exit code: ${s.exitCode})`:"";return{toolMetadata:{exitCode:s.exitCode},content:[{kind:"text",value:`Terminal ${n.id} completed${p}:
${u}`}]}}catch(s){if(s instanceof go)throw s;return{content:[{kind:"text",value:`Error awaiting terminal ${n.id}: ${s instanceof Error?s.message:String(s)}`}]}}}};var rBi={id:"terminal_last_command",toolReferenceName:"terminalLastCommand",legacyToolReferenceFullNames:["runCommands/terminalLastCommand"],displayName:d(15284,null),modelDescription:"Get the last command run in the active terminal.",source:kn.Internal,icon:R.terminal},X1e=class extends x{constructor(e){super();this._terminalService=e}async prepareToolInvocation(e,t){return{invocationMessage:d(15283,null),pastTenseMessage:d(15282,null)}}async invoke(e,t,o,n){let r=this._terminalService.activeInstance;if(!r)return{content:[{kind:"text",value:"No active terminal instance found."}]};let s=r.capabilities.get(2);if(!s)return{content:[{kind:"text",value:"No command detection capability available in the active terminal."}]};let l=s.executingCommand;if(l){let h=[];h.push("The following command is currently executing in the terminal:"),h.push(l);let g=s.cwd;return g&&(h.push("It is running in the directory:"),h.push(g)),{content:[{kind:"text",value:h.join(`
`)}]}}let c=s.commands;if(!c||c.length===0)return{content:[{kind:"text",value:"No command has been run in the active terminal."}]};let u=c[c.length-1],p=[];if(u.command&&(p.push("The following is the last command run in the terminal:"),p.push(u.command)),u.cwd&&(p.push("It was run in the directory:"),p.push(u.cwd)),u.exitCode!==void 0&&p.push(`It exited with code: ${u.exitCode}`),u.hasOutput()&&u.getOutput){let h=u.getOutput();h&&h.trim().length>0&&(p.push("It has the following output:"),p.push(h))}return{content:[{kind:"text",value:p.join(`
`)}]}}};X1e=I([m(0,nn)],X1e);var sBi={id:"kill_terminal",toolReferenceName:"killTerminal",displayName:d(15293,null),modelDescription:"Kill a terminal by its ID. Use this to clean up terminals that are no longer needed (e.g., after stopping a server or when a long-running task completes). The terminal ID is returned by run_in_terminal when isBackground=true.",icon:R.terminal,source:kn.Internal,inputSchema:{type:"object",properties:{id:{type:"string",description:"The ID of the background terminal to kill (returned by run_in_terminal when isBackground=true)."}},required:["id"]}},I8t=class extends x{async prepareToolInvocation(i,e){return{invocationMessage:d(15292,null),pastTenseMessage:d(15291,null)}}async invoke(i,e,t,o){let n=i.parameters,r=Fh.getExecution(n.id);if(!r)return{content:[{kind:"text",value:`Error: No active terminal execution found with ID ${n.id}. The terminal may have already been killed or the ID is invalid.`}]};let s=r.getOutput();r.instance.dispose(),Fh.removeExecution(n.id);let l=s?`Final output before termination:
${s}`:"No output was captured.";return{content:[{kind:"text",value:`Successfully killed background terminal ${n.id}. ${l}`}]}}};var aBi={id:"get_terminal_output",toolReferenceName:"getTerminalOutput",legacyToolReferenceFullNames:["runCommands/getTerminalOutput"],displayName:d(15287,null),modelDescription:"Get the output of a background terminal command previously started with run_in_terminal. The ID must be the exact opaque value returned by run_in_terminal when isBackground=true; terminal names, labels, and integers are not valid IDs.",icon:R.terminal,source:kn.Internal,inputSchema:{type:"object",properties:{id:{type:"string",description:"The ID of the background terminal to check (returned by run_in_terminal when isBackground=true). This must be the exact opaque ID returned by that tool; terminal names, labels, or integers are invalid.",pattern:"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$"}},required:["id"]}},y8t=class extends x{async prepareToolInvocation(i,e){return{invocationMessage:d(15286,null),pastTenseMessage:d(15285,null)}}async invoke(i,e,t,o){let n=i.parameters,r=Fh.getExecution(n.id);return r?{content:[{kind:"text",value:`Output of terminal ${n.id}:
${r.getOutput()}`}]}:{content:[{kind:"text",value:`Error: No active terminal execution found with ID ${n.id}. The ID must be the exact value returned by run_in_terminal for a background command.`}]}}};var lBi={id:"terminal_selection",toolReferenceName:"terminalSelection",legacyToolReferenceFullNames:["runCommands/terminalSelection"],displayName:d(15290,null),modelDescription:"Get the current selection in the active terminal.",source:kn.Internal,icon:R.terminal},J1e=class extends x{constructor(e){super();this._terminalService=e}async prepareToolInvocation(e,t){return{invocationMessage:d(15289,null),pastTenseMessage:d(15288,null)}}async invoke(e,t,o,n){let r=this._terminalService.activeInstance;if(!r)return{content:[{kind:"text",value:"No active terminal instance found."}]};let s=r.selection;return s?{content:[{kind:"text",value:`The active terminal's selection:
${s}`}]}:{content:[{kind:"text",value:"No text is currently selected in the active terminal."}]}}};J1e=I([m(0,nn)],J1e);var wDo={id:"vscode_get_terminal_confirmation",displayName:d(15306,null),modelDescription:["This tool allows you to get explicit user confirmation for a terminal command without executing it.","","When to use:","- When you need to verify user approval before executing a command","- When you want to show command details, auto-approval status, and simplified versions to the user","- When you need the user to review a potentially risky command","","The tool will:","- Show the command with syntax highlighting","- Display auto-approval status if enabled","- Show simplified version of the command if applicable","- Provide custom actions for creating auto-approval rules","- Return approval/rejection status","","After confirmation, use a tool to actually execute the command."].join(`
`),userDescription:d(15307,null),source:kn.Internal,icon:R.shield,inputSchema:{type:"object",properties:{command:{type:"string",description:"The command to confirm with the user."},explanation:{type:"string",description:"A one-sentence description of what the command does. This will be shown to the user in the confirmation dialog."},isBackground:{type:"boolean",description:"Whether the command would start a background process. This provides context for the confirmation."}},required:["command","explanation","isBackground"]}},w8t=class extends Fh{get _enableCommandLineSandboxRewriting(){return!1}async prepareToolInvocation(i,e){let t=await super.prepareToolInvocation(i,e);return t&&(t.presentation="hiddenAfterComplete"),t}async invoke(i,e,t,o){return{content:[{kind:"text",value:"yes"}]}}};function Z1e(a){let i=a.indexOf(": "),e=a.substring(0,i),t=i>0?a.substring(i+2):a;return/^\d+$/.test(t)&&(t=a),{taskLabel:t,taskType:e}}function cBi(a){if(Object.hasOwn(a,"label")&&a.label)return a.label;if(Object.hasOwn(a,"script")&&a.script)return a.script;if(Object.hasOwn(a,"command")&&a.command){let i=a.command;return Fe(i)?i:i.name?.toString()||""}return""}function CDo(a){return a.getKey()??a.getMapKey()}function mbe(a,i){return!a||!i?!1:CDo(a)===CDo(i)||a.getCommonTaskId?.()===i.getCommonTaskId?.()?!0:a._id===i._id}async function hbe(a,i,e,t,o,n){let r=0,s,l=await o.getWorkspaceTasks(),c=[];for(let v of l.keys()){let b=t.getValue("tasks",{resource:A.parse(v)});b?.tasks&&(c=c.concat(b.tasks))}for(let v of c)if(!(!n&&!v.type||Object.hasOwn(v,"hide")&&v.hide)){if((!(v.type&&i.taskType)||v.type===i.taskType)&&(cBi(v)===i?.taskLabel||a===v.label)){s=v;break}else if(!v.label&&a===`${v.type}: ${r}`){s=v;break}r++}if(!s)return;let u,p=A.file(e).path;for(let[v,b]of l)if(A.parse(v).path===p){u=b;break}if(!u)return;let h=u.configurations?.byIdentifier,g=Object.values(h??{}).find(v=>v.type===s.type&&(v._label===s.label||v._label===`${s.type}: ${cBi(s)}`||v._label===cBi(s))),f;return g&&(f=await o.tryResolveTask(g)),f||(f=u.set?.tasks?.find(b=>s.label===b._label||s.label===b._label)),f}async function eze(a,i,e,t){return a.configurationProperties?.dependsOn?(await Promise.all(a.configurationProperties.dependsOn.map(async n=>{let r=Fe(n.task)?n.task:n.task?._key;if(r)return await hbe(r,{taskLabel:r},i,e,t)}))).filter(n=>n!==void 0):void 0}async function tze(a,i,e,t,o,n,r,s,l,c,u){let p=[];if(n.isCancellationRequested)return p;let h={},g={},f={};for(let y of l??[])h[y.getCommonTaskId()]=y,g[y._id]=y,f[y._label]=y;let v=a.map(y=>y.shellLaunchConfig.name??y.title??"unknown");o.report({message:new Ie(`Checking output for ${v.map(y=>`\`${y}\``).join(", ")}`)});let b=a.map(async y=>{let w=u?u.get(y.instanceId):y.registerMarker(),k=i;if(l?.length){let P=y.reconnectionProperties?.data;P?Object.hasOwn(h,P.lastTask)?k=h[P.lastTask]:Object.hasOwn(g,P.id)&&(k=g[P.id]):y.shellLaunchConfig.name&&Object.hasOwn(f,y.shellLaunchConfig.name)?k=f[y.shellLaunchConfig.name]:Object.hasOwn(f,y.title)&&(k=f[y.title])}let T={getOutput:P=>kct(y,P??w)??"",task:k,isActive:s?()=>s(k):void 0,instance:y,dependencyTasks:l,sessionResource:t.sessionResource};if(k.configurationProperties.problemMatchers&&k.configurationProperties.problemMatchers.length>0&&c){let O=Date.now();for(;!n.isCancellationRequested&&Date.now()-O<1e3&&!(await c.getBusyTasks()).some(H=>mbe(H,k));)await Li(100)}try{let P=k.configurationProperties.problemMatchers&&k.configurationProperties.problemMatchers.length>0,O=r.add(e.createInstance(pre,T,P?Wgn:void 0,t,n,i._label));await Promise.race([U.toPromise(O.onDidFinishCommand),U.toPromise(n.onCancellationRequested)]);let V=O.pollingResult;return{name:y.shellLaunchConfig.name??y.title??"unknown",output:V?.output??"",pollDurationMs:V?.pollDurationMs??0,resources:V?.resources,state:V?.state||"Idle",inputToolManualAcceptCount:O.outputMonitorTelemetryCounters.inputToolManualAcceptCount??0,inputToolManualRejectCount:O.outputMonitorTelemetryCounters.inputToolManualRejectCount??0,inputToolManualChars:O.outputMonitorTelemetryCounters.inputToolManualChars??0,inputToolAutoAcceptCount:O.outputMonitorTelemetryCounters.inputToolAutoAcceptCount??0,inputToolAutoChars:O.outputMonitorTelemetryCounters.inputToolAutoChars??0,inputToolManualShownCount:O.outputMonitorTelemetryCounters.inputToolManualShownCount??0,inputToolFreeFormInputShownCount:O.outputMonitorTelemetryCounters.inputToolFreeFormInputShownCount??0,inputToolFreeFormInputCount:O.outputMonitorTelemetryCounters.inputToolFreeFormInputCount??0}}finally{w?.dispose()}}),S=await Promise.all(b);if(p.push(...S),u){let y=new Set(a.map(w=>w.instanceId));for(let[w,k]of u)y.has(w)||(k?.dispose(),u.delete(w))}return p}async function Wgn(a,i,e){if(!i.isCancellationRequested){if(a.task){let t=e.getTaskProblems(a.instance.instanceId);if(t){let o=[],n=[];for(let[r,{resources:s,markers:l}]of t.entries())for(let c=0;c<l.length;c++){let u=s[c],p=l[c];n.push({uri:u,range:p.startLineNumber!==void 0&&p.startColumn!==void 0&&p.endLineNumber!==void 0&&p.endColumn!==void 0?new z(p.startLineNumber,p.startColumn,p.endLineNumber,p.endColumn):void 0});let h=p.message??"";o.push(`Problem: ${h} in ${u.fsPath} coming from ${r} starting on line ${p.startLineNumber}${p.startColumn?`, column ${p.startColumn} and ending on line ${p.endLineNumber}${p.endColumn?`, column ${p.endColumn}`:""}`:""}`)}if(o.length===0){let r=a.getOutput().split(`
`).filter(s=>s!=="").slice(-10).join(`
`);return{state:"Idle",output:`Task completed with output:
${r}`}}return{state:"Idle",output:o.join(`
`),resources:n}}}throw new Error("Polling failed")}}function ize(a){return Array.from(new Map(a.flatMap(i=>i.resources?.filter(e=>e.uri).map(e=>{let t=e.range,o=t!==void 0?{uri:e.uri,range:t}:e.uri;return[t!==void 0?`${e.uri.toString()}-${t.toString()}`:`${e.uri.toString()}`,o]})??[])).values())}function oze(a,i,e,t,o,n){let r="";if(a?.exitCode)r=d(15374,null,i,a.exitCode);else{r+=`\`${i}\` task `;let s=e.length;if(o)return s?new Ie(`Got output for ${r} with \`${s}\` problem${s===1?"":"s"}`):new Ie(`Got output for ${r}`);{let l=e.length;r+=t.every(c=>c.state==="Idle")?l?`finished with \`${l}\` problem${l===1?"":"s"}`:"finished":n?l?`started and will continue to run in the background with \`${l}\` problem${l===1?"":"s"}`:"started and will continue to run in the background":l?`started with \`${l}\` problem${l===1?"":"s"}`:"started"}}return new Ie(r)}var nze=class{constructor(i,e,t,o,n,r){this._tasksService=i;this._telemetryService=e;this._terminalService=t;this._fileService=o;this._configurationService=n;this._instantiationService=r}async invoke(i,e,t,o){let n=i.parameters;if(!i.context)return{content:[{kind:"text",value:"No invocation context"}],toolResultMessage:"No invocation context"};let r=A.file(n.workspaceFolder).with({path:`${n.workspaceFolder}/.vscode/tasks.json`}),s=await this._fileService.exists(r),l={label:n.task.label,type:n.task.type,command:n.task.command,args:n.task.args,isBackground:n.task.isBackground,problemMatcher:n.task.problemMatcher,group:n.task.group},c=JSON.stringify({version:"2.0.0",tasks:[l]},null,"	");if(!s)await this._fileService.createFile(r,qe.fromString(c),{overwrite:!0}),t.report({message:"Created tasks.json file"});else{let w=await this._fileService.readFile(r),k=JSON.parse(w.value.toString());k.tasks.push(l),await this._fileService.writeFile(r,qe.fromString(JSON.stringify(k,null,"	"))),t.report({message:"Updated tasks.json file"})}t.report({message:new Ie(d(15344,null))});let u,p=Date.now();for(;Date.now()-p<5e3&&!o.isCancellationRequested&&(u=(await this._tasksService.tasks())?.find(w=>w._label===n.task.label),!u);)await Li(100);if(!u)return{content:[{kind:"text",value:`Task not found: ${n.task.label}`}],toolResultMessage:new Ie(d(15347,null,n.task.label))};let h=new N,g,f=[];try{let w=await eze(u,n.workspaceFolder,this._configurationService,this._tasksService),k=new Map;for(let H of this._terminalService.instances){let G=H.registerMarker();k.set(H.instanceId,G),G&&h.add(G)}t.report({message:new Ie(d(15346,null,n.task.label))});let T=await Promise.race([this._tasksService.run(u,void 0,5),Li(3e3)]);g=T&&typeof T=="object"?T:void 0;let O=this._tasksService.getTerminalsForTasks(w??u)?.map(H=>this._terminalService.instances.find(G=>G.resource.path===H?.path&&G.resource.scheme===H.scheme)).filter(Boolean);if(!O||O.length===0)return{content:[{kind:"text",value:`Task started but no terminal was found for: ${n.task.label}`}],toolResultMessage:new Ie(d(15345,null,n.task.label))};let V=new N;try{f=await tze(O,u,this._instantiationService,i.context,t,o,V,H=>this._isTaskActive(H),w,this._tasksService,k)}finally{V.dispose()}}finally{h.dispose()}for(let w of f)this._telemetryService.publicLog2?.("copilotChat.runTaskTool.createAndRunTask",{taskId:n.task.label,bufferLength:w.output.length??0,pollDurationMs:w.pollDurationMs??0,inputToolManualAcceptCount:w.inputToolManualAcceptCount??0,inputToolManualRejectCount:w.inputToolManualRejectCount??0,inputToolManualChars:w.inputToolManualChars??0,inputToolManualShownCount:w.inputToolManualShownCount??0,inputToolFreeFormInputCount:w.inputToolFreeFormInputCount??0,inputToolFreeFormInputShownCount:w.inputToolFreeFormInputShownCount??0});let v=f.map(w=>`Terminal: ${w.name}
Output:
${w.output}`),b=Array.from(new Set(v)).join(`

`),S=ize(f),y=oze(g,n.task.label,S,f,void 0,u.configurationProperties.isBackground);return{content:[{kind:"text",value:b}],toolResultMessage:y,toolResultDetails:S}}async _isTaskActive(i){return(await this._tasksService.getBusyTasks())?.some(t=>mbe(t,i))??!1}async prepareToolInvocation(i,e){let o=i.parameters.task;return(await this._tasksService.tasks())?.find(s=>s._label===o.label)?{invocationMessage:new Ie(d(15353,null,o.label)),pastTenseMessage:new Ie(d(15354,null,o.label)),confirmationMessages:void 0}:(await this._tasksService.getActiveTasks()).find(s=>s._label===o.label)?{invocationMessage:new Ie(d(15343,null,o.label)),pastTenseMessage:new Ie(d(15343,null,o.label)),confirmationMessages:void 0}:{invocationMessage:new Ie(d(15350,null,o.label)),pastTenseMessage:new Ie(d(15351,null,o.label)),confirmationMessages:{title:d(15342,null),message:new Ie(d(15352,null,o.label,o.command,o.args?.length?` and args \`${o.args.join(" ")}\``:""))}}}};nze=I([m(0,Og),m(1,Te),m(2,nn),m(3,fe),m(4,B),m(5,F)],nze);var uBi={id:"create_and_run_task",toolReferenceName:"createAndRunTask",legacyToolReferenceFullNames:["runTasks/createAndRunTask"],displayName:d(15348,null),modelDescription:"Creates and runs a build, run, or custom task for the workspace by generating or adding to a tasks.json file based on the project structure (such as package.json or README.md). If the user asks to build, run, launch and they have no tasks.json file, use this tool. If they ask to create or add a task, use this tool.",userDescription:d(15349,null),source:kn.Internal,inputSchema:{type:"object",properties:{workspaceFolder:{type:"string",description:"The absolute path of the workspace folder where the tasks.json file will be created."},task:{type:"object",description:"The task to add to the new tasks.json file.",properties:{label:{type:"string",description:"The label of the task."},type:{type:"string",description:"The type of the task. The only supported value is 'shell'.",enum:["shell"]},command:{type:"string",description:"The shell command to run for the task. Use this to specify commands for building or running the application."},args:{type:"array",description:"The arguments to pass to the command.",items:{type:"string"}},isBackground:{type:"boolean",description:"Whether the task runs in the background without blocking the UI or other tasks. Set to true for long-running processes like watch tasks or servers that should continue executing without requiring user attention. When false, the task will block the terminal until completion."},problemMatcher:{type:"array",description:"The problem matcher to use to parse task output for errors and warnings. Can be a predefined matcher like '$tsc' (TypeScript), '$eslint - stylish', '$gcc', etc., or a custom pattern defined in tasks.json. This helps VS Code display errors in the Problems panel and enables quick navigation to error locations.",items:{type:"string"}},group:{type:"string",description:"The group to which the task belongs."}},required:["label","type","command"]}},required:["task","workspaceFolder"]}};var pBi={id:"get_task_output",toolReferenceName:"getTaskOutput",legacyToolReferenceFullNames:["runTasks/getTaskOutput"],displayName:d(15360,null),modelDescription:"Get the output of a task",source:kn.Internal,when:fDe,inputSchema:{type:"object",properties:{id:{type:"string",description:"The task ID for which to get the output."},workspaceFolder:{type:"string",description:"The workspace folder path containing the task"}},required:["id","workspaceFolder"]}},rze=class extends x{constructor(e,t,o,n,r){super();this._tasksService=e;this._terminalService=t;this._configurationService=o;this._instantiationService=n;this._telemetryService=r}async prepareToolInvocation(e,t){let o=e.parameters,n=Z1e(o.id),r=await hbe(o.id,n,o.workspaceFolder,this._configurationService,this._tasksService,!0);if(!r)return{invocationMessage:new Ie(d(15358,null,o.id))};let s=r._label;return(await this._tasksService.getActiveTasks()).includes(r)?{invocationMessage:new Ie(d(15357,null,s))}:{invocationMessage:new Ie(d(15356,null,s)),pastTenseMessage:new Ie(d(15355,null,s))}}async invoke(e,t,o,n){let r=e.parameters,s=Z1e(r.id),l=await hbe(r.id,s,r.workspaceFolder,this._configurationService,this._tasksService,!0);if(!l)return{content:[{kind:"text",value:`Task not found: ${r.id}`}],toolResultMessage:new Ie(d(15358,null,r.id))};let c=await eze(l,r.workspaceFolder,this._configurationService,this._tasksService),u=this._tasksService.getTerminalsForTasks(c??l),p=l._label,h=u?.map(v=>this._terminalService.instances.find(b=>b.resource.path===v?.path&&b.resource.scheme===v.scheme)).filter(v=>!!v);if(!h||h.length===0)return{content:[{kind:"text",value:`Terminal not found for task ${p}`}],toolResultMessage:new Ie(d(15359,null,p))};let g=l.configurationProperties.isBackground?new Map:void 0;if(g)for(let v of h)g.set(v.instanceId,void 0);let f=new N;try{let v=await tze(h,l,this._instantiationService,e.context,o,n,f,k=>this._isTaskActive(k),c,this._tasksService,g);for(let k of v)this._telemetryService.publicLog2?.("copilotChat.getTaskOutputTool.get",{taskId:r.id,bufferLength:k.output.length??0,pollDurationMs:k.pollDurationMs??0,inputToolManualAcceptCount:k.inputToolManualAcceptCount??0,inputToolManualRejectCount:k.inputToolManualRejectCount??0,inputToolManualChars:k.inputToolManualChars??0,inputToolManualShownCount:k.inputToolManualShownCount??0,inputToolFreeFormInputCount:k.inputToolFreeFormInputCount??0,inputToolFreeFormInputShownCount:k.inputToolFreeFormInputShownCount??0});let b=v.map(k=>`Terminal: ${k.name}
Output:
${k.output}`),S=Array.from(new Set(b)).join(`

`),y=ize(v),w=oze(void 0,p,y,v,!0,l.configurationProperties.isBackground);return{content:[{kind:"text",value:S}],toolResultMessage:w,toolResultDetails:y}}finally{f.dispose()}}async _isTaskActive(e){return(await this._tasksService.getBusyTasks())?.some(o=>mbe(o,e))??!1}};rze=I([m(0,Og),m(1,nn),m(2,B),m(3,F),m(4,Te)],rze);var sze=class{constructor(i,e,t,o,n){this._tasksService=i;this._telemetryService=e;this._terminalService=t;this._configurationService=o;this._instantiationService=n}async invoke(i,e,t,o){let n=i.parameters;if(!i.context)return{content:[{kind:"text",value:"No invocation context"}],toolResultMessage:"No invocation context"};let r=Z1e(n.id),s=await hbe(n.id,r,n.workspaceFolder,this._configurationService,this._tasksService,!0);if(!s)return{content:[{kind:"text",value:`Task not found: ${n.id}`}],toolResultMessage:new Ie(d(15370,null,n.id))};let l=s._label;if((await this._tasksService.getActiveTasks()).includes(s))return{content:[{kind:"text",value:`The task ${l} is already running.`}],toolResultMessage:new Ie(d(15368,null,l))};let u=await eze(s,n.workspaceFolder,this._configurationService,this._tasksService),p=new Map,h=new N;for(let g of this._terminalService.instances){let f=g.registerMarker();p.set(g.instanceId,f),f&&h.add(f)}try{let g=await Promise.race([this._tasksService.run(s,void 0,5),Li(3e3)]),f=g&&typeof g=="object"?g:void 0,v=this._tasksService.getTerminalsForTasks(u??s);if(!v||v.length===0)return{content:[{kind:"text",value:`Task started but no terminal was found for: ${l}`}],toolResultMessage:new Ie(d(15363,null,l))};let b=this._terminalService.instances.filter(O=>v.some(V=>V.path===O.resource.path&&V.scheme===O.resource.scheme));if(b.length===0)return{content:[{kind:"text",value:`Task started but no terminal was found for: ${l}`}],toolResultMessage:new Ie(d(15363,null,l))};let S=new N,y=[];try{y=await tze(b,s,this._instantiationService,i.context,t,o,S,O=>this._isTaskActive(O),u,this._tasksService,p)}finally{S.dispose()}for(let O of y)this._telemetryService.publicLog2?.("copilotChat.runTaskTool.run",{taskId:n.id,bufferLength:O.output.length??0,pollDurationMs:O.pollDurationMs??0,inputToolManualAcceptCount:O.inputToolManualAcceptCount??0,inputToolManualRejectCount:O.inputToolManualRejectCount??0,inputToolManualChars:O.inputToolManualChars??0,inputToolManualShownCount:O.inputToolManualShownCount??0,inputToolFreeFormInputShownCount:O.inputToolFreeFormInputShownCount??0,inputToolFreeFormInputCount:O.inputToolFreeFormInputCount??0});let w=y.map(O=>`Terminal: ${O.name}
Output:
${O.output}`),k=Array.from(new Set(w)).join(`

`),T=ize(y),P=oze(f,l,T,y,void 0,s.configurationProperties.isBackground);return{content:[{kind:"text",value:k}],toolResultMessage:P,toolResultDetails:T}}finally{h.dispose()}}async _isTaskActive(i){return(await this._tasksService.getBusyTasks())?.some(t=>mbe(t,i))??!1}async prepareToolInvocation(i,e){let t=i.parameters,o=Z1e(t.id),n=await hbe(t.id,o,t.workspaceFolder,this._configurationService,this._tasksService,!0);if(!n)return{invocationMessage:new Ie(d(15370,null,t.id))};let r=n._label,s=await this._tasksService.getActiveTasks();return n&&s.includes(n)?{invocationMessage:new Ie(d(15367,null))}:await this._isTaskActive(n)?{invocationMessage:new Ie(d(15369,null,r)),pastTenseMessage:new Ie(d(15371,null,r)),confirmationMessages:void 0}:{invocationMessage:new Ie(d(15365,null,r)),pastTenseMessage:new Ie(n?.configurationProperties.isBackground?d(15366,null,r):d(15364,null,r)),confirmationMessages:n?{title:d(15362,null),message:d(15361,null,r)}:void 0}}};sze=I([m(0,Og),m(1,Te),m(2,nn),m(3,B),m(4,F)],sze);var mBi={id:"run_task",toolReferenceName:"runTask",legacyToolReferenceFullNames:["runTasks/runTask"],displayName:d(15372,null),modelDescription:`Runs a VS Code task.

- If you see that an appropriate task exists for building or running code, prefer to use this tool to run the task instead of using the run_in_terminal tool.
- Make sure that any appropriate build or watch task is running before trying to run tests or execute code.
- If the user asks to run a task, use this tool to do so.`,userDescription:d(15373,null),icon:R.tools,source:kn.Internal,when:fDe,inputSchema:{type:"object",properties:{workspaceFolder:{type:"string",description:"The workspace folder path containing the task"},id:{type:"string",description:"The task ID to run."}},required:["workspaceFolder","id"]}};Ee(WN,A6,1);var aze=class extends x{static{this.ID="terminal.shellIntegrationTimeoutMigration"}constructor(i){super();let e=i.inspect("chat.tools.terminal.shellIntegrationTimeout"),t=i.inspect("terminal.integrated.shellIntegration.timeout");e.userValue!==void 0&&t.userValue===void 0&&Yo(e.userValue)&&i.updateValue("terminal.integrated.shellIntegration.timeout",e.userValue,2),e.workspaceValue!==void 0&&t.workspaceValue===void 0&&Yo(e.workspaceValue)&&i.updateValue("terminal.integrated.shellIntegration.timeout",e.workspaceValue,5)}};aze=I([m(0,B)],aze);It(aze.ID,aze,St.Eventually);var lze=class extends x{static{this.ID="terminal.outputLocationMigration"}constructor(i){super(),i.getValue("chat.tools.terminal.outputLocation")==="none"&&i.updateValue("chat.tools.terminal.outputLocation","chat")}};lze=I([m(0,B)],lze);It(lze.ID,lze,St.Eventually);var cze=class extends x{constructor(e,t,o){super();this._instantiationService=e;this._toolsService=t;this._configurationService=o;this._runInTerminalToolRegistration=this._register(new me);this._runInTerminalToolRegistrationVersion=0;let n=e.createInstance(w8t);this._register(t.registerTool(wDo,n));let r=e.createInstance(y8t);this._register(t.registerTool(aBi,r)),this._register(t.executeToolSet.addTool(aBi));let s=e.createInstance(S8t);this._register(t.registerTool(nBi,s)),this._register(t.executeToolSet.addTool(nBi));let l=e.createInstance(I8t);this._register(t.registerTool(sBi,l)),this._register(t.executeToolSet.addTool(sBi)),this._registerRunInTerminalTool();let c=e.createInstance(J1e);this._register(t.registerTool(lBi,c));let u=e.createInstance(X1e);this._register(t.registerTool(rBi,u)),this._register(t.readToolSet.addTool(lBi)),this._register(t.readToolSet.addTool(rBi));let p=e.createInstance(sze);this._register(t.registerTool(mBi,p));let h=e.createInstance(rze);this._register(t.registerTool(pBi,h));let g=e.createInstance(nze);this._register(t.registerTool(uBi,g)),this._register(t.executeToolSet.addTool(mBi)),this._register(t.executeToolSet.addTool(uBi)),this._register(t.readToolSet.addTool(pBi)),this._register(this._configurationService.onDidChangeConfiguration(f=>{(f.affectsConfiguration("chat.agent.sandbox")||f.affectsConfiguration("chat.agent.sandboxNetwork.allowedDomains")||f.affectsConfiguration("chat.agent.sandboxNetwork.deniedDomains")||f.affectsConfiguration("chat.tools.terminal.sandbox.enabled")||f.affectsConfiguration("chat.tools.terminal.sandbox.network.allowedDomains")||f.affectsConfiguration("chat.tools.terminal.sandbox.network.deniedDomains"))&&this._registerRunInTerminalTool()}))}static{this.ID="terminal.chatAgentTools"}_registerRunInTerminalTool(){let e=++this._runInTerminalToolRegistrationVersion;this._instantiationService.invokeFunction(yDo).then(t=>{if(this._store.isDisposed||e!==this._runInTerminalToolRegistrationVersion)return;this._runInTerminalTool||(this._runInTerminalTool=this._register(this._instantiationService.createInstance(Fh))),this._runInTerminalToolRegistration.value=void 0;let o=new N;o.add(this._toolsService.registerToolData(t)),o.add(this._toolsService.registerToolImplementation(t.id,this._runInTerminalTool)),o.add(this._toolsService.executeToolSet.addTool(t)),this._runInTerminalToolRegistration.value=o})}};cze=I([m(0,F),m(1,Vn),m(2,B)],cze);It(cze.ID,cze,St.AfterRestored);Jl({id:"workbench.action.terminal.chat.addTerminalSelection",title:d(15263,null),precondition:C.and(ie.enabled,da.terminalAvailable),menu:[{id:D.TerminalInstanceContext,group:"0_chat",order:1,when:C.and(ie.enabled,dt.textSelected)}],run:async(a,i,e)=>{let t=e.get(Pt),o=a.selection;if(!o)return;let n=t.lastFocusedWidget??await t.revealWidget();n&&(n.attachmentModel.addContext({id:`terminal-selection-${Date.now()}`,kind:"generic",name:d(15264,null),fullName:d(15264,null),value:o,icon:R.terminal}),n.focusInput())}});Er({id:"workbench.action.terminal.showTextureAtlas",title:L(15463,"Show Terminal Texture Atlas"),category:Ve.Developer,precondition:C.or(dt.isOpen),run:async(a,i)=>{let e=i.get(fe),t=i.get(Je),o=i.get(Pe),n=await a.service.activeInstance?.xterm?.textureAtlas;if(!n)return;let r=o.getWorkspace().folders[0].uri,s=A.joinPath(r,"textureAtlas.png"),l=document.createElement("canvas");l.width=n.width,l.height=n.height;let c=l.getContext("bitmaprenderer");if(!c)return;c.transferFromImageBitmap(n);let u=await new Promise(p=>l.toBlob(p));u&&(await e.writeFile(s,qe.wrap(new Uint8Array(await u.arrayBuffer()))),t.open(s))}});Er({id:"workbench.action.terminal.writeDataToTerminal",title:L(15464,"Write Data to Terminal"),category:Ve.Developer,run:async(a,i)=>{let e=i.get(Ue),t=await a.service.getActiveOrCreateInstance();if(await a.service.revealActiveTerminal(),await t.processReady,!t.xterm)throw new Error("Cannot write data to terminal if xterm isn't initialized");let o=await e.input({value:"",placeHolder:"Enter data (supports \\n, \\r, \\xAB)",prompt:d(15465,null)});if(!o)return;let n=o.replace(/\\n/g,`
`).replace(/\\r/g,"\r");for(;;){let s=n.match(/\\x([0-9a-fA-F]{2})/);if(s===null||s.index===void 0||s.length<2)break;n=n.slice(0,s.index)+String.fromCharCode(parseInt(s[1],16))+n.slice(s.index+4)}t.xterm._writeText(n)}});Er({id:"workbench.action.terminal.recordSession",title:L(15460,"Record Terminal Session"),category:Ve.Developer,run:async(a,i)=>{let e=i.get(Fi),t=i.get(ge),o=i.get(kr),n=new N,r=d(15461,null),s={text:r,name:r,ariaLabel:r,showProgress:!0},l=o.addEntry(s,"recordSession",0);n.add(l);let c=await a.service.createTerminal();return a.service.setActiveInstance(c),await a.service.revealActiveTerminal(),await Promise.all([c.processReady,c.focusWhenReady(!0)]),new Promise(u=>{let p=[],h=()=>{let v=JSON.stringify(p,null,2);e.writeText(v),n.dispose(),u()},g=n.add(new Xo(5e3));n.add(U.runAndSubscribe(c.onDimensionsChanged,()=>{p.push({type:"resize",cols:c.cols,rows:c.rows}),g.trigger(h)})),n.add(t.onWillExecuteCommand(v=>{p.push({type:"command",id:v.commandId}),g.trigger(h)})),n.add(c.onWillData(v=>{p.push({type:"output",data:v}),g.trigger(h)})),n.add(c.onDidSendText(v=>{p.push({type:"sendText",data:v}),g.trigger(h)})),n.add(c.xterm.raw.onData(v=>{p.push({type:"input",data:v}),g.trigger(h)}));let f=!1;n.add(U.runAndSubscribe(c.capabilities.onDidAddCapability,v=>{if(f)return;let b=c.capabilities.get(2);b&&(n.add(b.promptInputModel.onDidChangeInput(S=>{p.push({type:"promptInputChange",data:b.promptInputModel.getCombinedString()}),g.trigger(h)})),f=!0)}))})}});Er({id:"workbench.action.terminal.restartPtyHost",title:L(15462,"Restart Pty Host"),category:Ve.Developer,run:async(a,i)=>{let e=i.get(ca),t=Array.from(a.instanceService.getRegisteredBackends()),o=t.filter(r=>!r.isResponsive),n=o.length>0?o:t;for(let r of n)e.warn(`Restarting pty host for authority "${r.remoteAuthority}"`),r.restartPtyHost()}});var mre=class extends x{constructor(e,t){super();this._ctx=e;this._configurationService=t;this._activeDevModeDisposables=this._register(new me);this._currentColor=0;this._state=0;this._register(this._configurationService.onDidChangeConfiguration(o=>{o.affectsConfiguration("terminal.integrated.developer.devMode")&&this._updateDevMode()}))}static{this.ID="terminal.devMode"}static get(e){return e.getContribution(mre.ID)}xtermReady(e){this._xterm=e,this._updateDevMode()}_updateDevMode(){let e=this._isEnabled();this._xterm?.raw.element?.classList.toggle("dev-mode",e);let t=this._ctx.instance.capabilities.get(2);if(e)if(t){if(this._state===2)return;this._state=2;let o=new Vt,n=new N;this._activeDevModeDisposables.value=wn(o,n,this._ctx.instance.onDidBlur(()=>this._updateDevMode()),this._ctx.instance.onDidFocus(()=>this._updateDevMode()),t.promptInputModel.onDidChangeInput(()=>this._updateDevMode()),t.onCommandFinished(r=>{let s=`color-${this._currentColor}`,l=[];if(o.set(r,wn(...l)),r.promptStartMarker){let c=this._ctx.instance.xterm.raw?.registerDecoration({marker:r.promptStartMarker});c&&(l.push(c),n.add(c.onRender(u=>{u.textContent="A",u.classList.add("xterm-sequence-decoration","top","left",s)})))}if(r.marker){let c=this._ctx.instance.xterm.raw?.registerDecoration({marker:r.marker,x:r.startX});c&&(l.push(c),n.add(c.onRender(u=>{u.textContent="B",u.classList.add("xterm-sequence-decoration","top","right",s)})))}if(r.executedMarker){let c=this._ctx.instance.xterm.raw?.registerDecoration({marker:r.executedMarker,x:r.executedX});c&&(l.push(c),n.add(c.onRender(u=>{u.textContent="C",u.classList.add("xterm-sequence-decoration","bottom","left",s)})))}if(r.endMarker){let c=this._ctx.instance.xterm.raw?.registerDecoration({marker:r.endMarker});c&&(l.push(c),n.add(c.onRender(u=>{u.textContent="D",u.classList.add("xterm-sequence-decoration","bottom","right",s)})))}this._currentColor=(this._currentColor+1)%2}),t.onCommandInvalidated(r=>{for(let s of r){let l=o.get(s);l&&Be(l),o.deleteAndDispose(s)}}))}else{if(this._state===1)return;this._state=1,this._activeDevModeDisposables.value=this._ctx.instance.capabilities.onDidAddCommandDetectionCapability(o=>{this._updateDevMode()})}else{if(this._state===0)return;this._state=0,this._activeDevModeDisposables.clear()}}_isEnabled(){return this._configurationService.getValue("terminal.integrated.developer.devMode")||!1}};mre=I([m(1,B)],mre);Mp(mre.ID,mre);Jl({id:"workbench.action.terminal.showEnvironmentContributions",title:L(15469,"Show Environment Contributions"),run:async(a,i,e,t)=>{let o=a.extEnvironmentVariableCollection;if(o){let n=t,s=e.get(F).createInstance(hre),l=e.get(ee),c=new Date().getTime(),u=n?.workspaceFolder?` - ${n.workspaceFolder.name}`:"",p=await s.provideTextContent(A.from({scheme:hre.scheme,path:`Environment changes${u}`,fragment:Bgn(o,n),query:`environment-collection-${c}`}));p&&await l.openEditor({resource:p.uri})}}});function Bgn(a,i){let e=`# ${d(15466,null)}`,t=a.getDescriptionMap(void 0),o=a.getDescriptionMap(i);for(let[n,r]of a.collections){e+=`

## ${d(15467,null,n)}`,e+=`
`;let s=t.get(n);s&&(e+=`
${s}
`);let l=o.get(n);if(l){let c=s?` (${d(15468,null)})`:"";e+=`
${l}${c}
`}for(let c of r.map.values())Hgn(c,i)!==!1&&(e+=`
- \`${Ugn(c.type,c.value,c.variable)}\``)}return e}function Hgn(a,i){return!!(!a.scope||a.scope.workspaceFolder&&i?.workspaceFolder&&a.scope.workspaceFolder.index===i.workspaceFolder.index)}function Ugn(a,i,e){switch(a){case 3:return`${e}=${i}\${env:${e}}`;case 2:return`${e}=\${env:${e}}${i}`;default:return`${e}=${i}`}}var hre=class{constructor(i,e){this._modelService=e;i.registerTextModelContentProvider(hre.scheme,this)}static{this.scheme="ENVIRONMENT_CHANGES_COLLECTION"}async provideTextContent(i){let e=this._modelService.getModel(i);return e&&!e.isDisposed()?e:this._modelService.createModel(i.fragment,{languageId:"markdown",onDidChange:U.None},i,!1)}};hre=I([m(0,Bt),m(1,Tt)],hre);var hBi=d(8932,null),zgn=d(8935,null),Kgn=d(8934,null),Ggn=d(8933,null),qgn=d(8931,null),C8t=310,$gn=73,gre=class extends ja{constructor(e,t,o,n,r,s,l){super();this._keybindingService=r;this._configurationService=s;this._accessibilityService=l;this._isVisible=!1;this._foundMatch=!1;this._width=0;this._accessibilityHelpHintAnnounced=!1;this.state=this._register(new iK),this._matchesLimit=e.matchesLimit??Number.MAX_SAFE_INTEGER,this._findInput=this._register(new Hz(null,t,{label:hBi,placeholder:zgn,validation:h=>{if(h.length===0||!this._findInput.getRegex())return null;try{return new RegExp(h),null}catch(g){return this._foundMatch=!1,this.updateButtons(this._foundMatch),{content:g.message}}},showCommonFindToggles:e.showCommonFindToggles,appendCaseSensitiveLabel:e.appendCaseSensitiveActionId?this._getKeybinding(e.appendCaseSensitiveActionId):void 0,appendRegexLabel:e.appendRegexActionId?this._getKeybinding(e.appendRegexActionId):void 0,appendWholeWordsLabel:e.appendWholeWordsActionId?this._getKeybinding(e.appendWholeWordsActionId):void 0,showHistoryHint:()=>bR(r),inputBoxStyles:Cl,toggleStyles:gh},o)),this._updateHistoryDelayer=this._register(new Xo(500)),this._register(this._findInput.onInput(async h=>{(!e.checkImeCompletionState||!this._findInput.isImeSessionInProgress)&&(this._foundMatch=this._onInputChanged(),e.showResultCount&&await this.updateResultCount(),this.updateButtons(this._foundMatch),this.focusFindBox(),this._delayedUpdateHistory())})),this._findInput.setRegex(!!this.state.isRegex),this._findInput.setCaseSensitive(!!this.state.matchCase),this._findInput.setWholeWords(!!this.state.wholeWord),this._register(this._findInput.onDidOptionChange(()=>{this.state.change({isRegex:this._findInput.getRegex(),wholeWord:this._findInput.getWholeWords(),matchCase:this._findInput.getCaseSensitive()},!0)})),this._register(this.state.onFindReplaceStateChange(()=>{this._findInput.setRegex(this.state.isRegex),this._findInput.setWholeWords(this.state.wholeWord),this._findInput.setCaseSensitive(this.state.matchCase),this.findFirst()}));let c={groupId:"simple-find-widget"};this.prevBtn=this._register(new rI({label:Kgn+(e.previousMatchActionId?this._getKeybinding(e.previousMatchActionId):""),icon:b3e,hoverLifecycleOptions:c,onTrigger:()=>{this.find(!0)}},n)),this.nextBtn=this._register(new rI({label:Ggn+(e.nextMatchActionId?this._getKeybinding(e.nextMatchActionId):""),icon:S3e,hoverLifecycleOptions:c,onTrigger:()=>{this.find(!1)}},n));let u=this._register(new rI({label:qgn+(e.closeWidgetActionId?this._getKeybinding(e.closeWidgetActionId):""),icon:PE,hoverLifecycleOptions:c,onTrigger:()=>{this.hide()}},n));this._innerDomNode=document.createElement("div"),this._innerDomNode.classList.add("simple-find-part"),this._innerDomNode.appendChild(this._findInput.domNode),this._innerDomNode.appendChild(this.prevBtn.domNode),this._innerDomNode.appendChild(this.nextBtn.domNode),this._innerDomNode.appendChild(u.domNode),this._domNode=document.createElement("div"),this._domNode.classList.add("simple-find-part-wrapper"),this._domNode.appendChild(this._innerDomNode),this.onkeyup(this._innerDomNode,h=>{if(h.equals(9)){this.hide(),h.preventDefault();return}}),this._focusTracker=this._register(qn(this._innerDomNode)),this._register(this._focusTracker.onDidFocus(this._onFocusTrackerFocus.bind(this))),this._register(this._focusTracker.onDidBlur(this._onFocusTrackerBlur.bind(this))),this._findInputFocusTracker=this._register(qn(this._findInput.domNode)),this._register(this._findInputFocusTracker.onDidFocus(this._onFindInputFocusTrackerFocus.bind(this))),this._register(this._findInputFocusTracker.onDidBlur(this._onFindInputFocusTrackerBlur.bind(this))),this._register(j(this._innerDomNode,"click",h=>{h.stopPropagation()})),e?.showResultCount&&(this._domNode.classList.add("result-count"),this._matchesCount=document.createElement("div"),this._matchesCount.className="matchesCount",this._findInput.domNode.insertAdjacentElement("afterend",this._matchesCount),this._register(this._findInput.onDidChange(async()=>{await this.updateResultCount()})),this._register(this._findInput.onDidOptionChange(async()=>{this._foundMatch=this._onInputChanged(),await this.updateResultCount(),this.focusFindBox(),this._delayedUpdateHistory()})));let p=e?.initialWidth;if(p&&(p=p<C8t?C8t:p,this._domNode.style.width=`${p}px`),e?.enableSash){let h=p??C8t,g=h,f=this._register(new Jh(this._innerDomNode,this,{orientation:0,size:1}));this._register(f.onDidStart(()=>{g=parseFloat(y1(this._domNode).width)})),this._register(f.onDidChange(v=>{let b=g+v.startX-v.currentX;b<h||(this._domNode.style.width=`${b}px`)})),this._register(f.onDidReset(v=>{parseFloat(y1(this._domNode).width)===h?this._domNode.style.width="100%":this._domNode.style.width=`${h}px`}))}}getVerticalSashLeft(e){return 0}get inputValue(){return this._findInput.getValue()}get focusTracker(){return this._focusTracker}_getKeybinding(e){return this._keybindingService.appendKeybinding("",e)}dispose(){super.dispose(),this._domNode?.remove()}isVisible(){return this._isVisible}getDomNode(){return this._domNode}getFindInputDomNode(){return this._findInput.domNode}reveal(e,t=!0){if(e&&this._findInput.setValue(e),this._isVisible){this._findInput.select();return}this._isVisible=!0,this._updateFindInputAriaLabel(),this.updateResultCount(),this.layout(),setTimeout(()=>{this._innerDomNode.classList.toggle("suppress-transition",!t),this._innerDomNode.classList.add("visible","visible-transition"),this._innerDomNode.setAttribute("aria-hidden","false"),this._findInput.select(),t||setTimeout(()=>{this._innerDomNode.classList.remove("suppress-transition")},0)},0)}show(e){e&&!this._isVisible&&this._findInput.setValue(e),this._isVisible=!0,this.layout(),setTimeout(()=>{this._innerDomNode.classList.add("visible","visible-transition"),this._innerDomNode.setAttribute("aria-hidden","false")},0)}hide(e=!0){this._isVisible&&(this._accessibilityHelpHintAnnounced=!1,this._innerDomNode.classList.toggle("suppress-transition",!e),this._innerDomNode.classList.remove("visible-transition"),this._innerDomNode.setAttribute("aria-hidden","true"),setTimeout(()=>{this._isVisible=!1,this.updateButtons(this._foundMatch),this._innerDomNode.classList.remove("visible","suppress-transition")},e?200:0))}layout(e=this._width){if(this._width=e,!!this._isVisible&&this._matchesCount){let t=!1;C8t+$gn+28>=e&&(t=!0),this._innerDomNode.classList.toggle("reduced-find-widget",t)}}_delayedUpdateHistory(){this._updateHistoryDelayer.trigger(this._updateHistory.bind(this))}_updateHistory(){this._findInput.inputBox.addToHistory()}_getRegexValue(){return this._findInput.getRegex()}_getWholeWordValue(){return this._findInput.getWholeWords()}_getCaseSensitiveValue(){return this._findInput.getCaseSensitive()}updateButtons(e){let t=this.inputValue.length>0;this.prevBtn.setEnabled(this._isVisible&&t&&e),this.nextBtn.setEnabled(this._isVisible&&t&&e)}focusFindBox(){this.nextBtn.focus(),this._findInput.inputBox.focus()}async updateResultCount(){if(!this._matchesCount){this.updateButtons(this._foundMatch);return}let e=await this._getResultCount();this._matchesCount.textContent="";let t=this.inputValue.length>0&&e?.resultCount===0;this._matchesCount.classList.toggle("no-results",t);let o="";if(e?.resultCount){let n=String(e.resultCount);e.resultCount>=this._matchesLimit&&(n+="+");let r=String(e.resultIndex+1);r==="0"&&(r="?"),o=vd(I3e,r,n)}else o=Kz;qr(this._announceSearchResults(o,this.inputValue)),this._matchesCount.appendChild(document.createTextNode(o)),this._foundMatch=!!e&&e.resultCount>0,this.updateButtons(this._foundMatch)}changeState(e){this.state.change(e,!1)}_updateFindInputAriaLabel(){let e=hBi;if(!this._accessibilityHelpHintAnnounced&&this._configurationService.getValue("accessibility.verbosity.find")&&this._accessibilityService.isScreenReaderOptimized()){let t=this._keybindingService.lookupKeybinding("editor.action.accessibilityHelp")?.getAriaLabel();t&&(e+=", "+d(8926,null,t),this._accessibilityHelpHintAnnounced=!0,this._labelResetTimeout?.dispose(),this._labelResetTimeout=tn(()=>{this._isVisible&&this._findInput.inputBox.setAriaLabel(hBi)},1e3))}this._findInput.inputBox.setAriaLabel(e)}_announceSearchResults(e,t){return t?e===Kz?t===""?d(8929,null,e):d(8928,null,e,t):d(8930,null,e,t):d(8927,null)}},jgn=te("simpleFindWidget.sashBorder",{dark:"#454545",light:"#C8C8C8",hcDark:"#6FC3DF",hcLight:"#0F4A85"},d(8936,null));is((a,i)=>{let e=a.getColor(jgn);i.addRule(`.monaco-workbench .simple-find-part .monaco-sash { background-color: ${e}; border-color: ${e} }`)});async function xDo(a,i,e){let t=a.get(B),o=a.get(at),n=i.split(/\r?\n/);if(n.length===1)return!0;function r(g){return Fe(g)&&(g==="auto"||g==="always"||g==="never")?g:typeof g=="boolean"?g?"auto":"never":"auto"}let s=r(t.getValue("terminal.integrated.enableMultiLinePasteWarning"));if(s==="never")return!0;if(s==="auto"){if(e)return!0;let g=i.split(/\r?\n/);if(g.length===2&&g[1].trim().length===0)return!0}let l=3,c=30,u=d(15457,null);for(let g=0;g<Math.min(n.length,l);g++){let f=n[g],v=f.length>c?`${f.slice(0,c)}\u2026`:f;u+=`
${v}`}n.length>l&&(u+=`
\u2026`);let{result:p,checkboxChecked:h}=await o.prompt({message:d(15453,null,n.length),detail:u,type:"warning",buttons:[{label:d(15455,null),run:()=>({confirmed:!0,singleLine:!1})},{label:d(15456,null),run:()=>({confirmed:!0,singleLine:!0})}],cancelButton:!0,checkbox:{label:d(15454,null)}});return p?(p.confirmed&&h&&await t.updateValue("terminal.integrated.enableMultiLinePasteWarning","never"),p.singleLine?{modifiedText:i.replace(/\r?\n/g,"")}:p.confirmed):!1}var bL=class extends x{constructor(e,t,o,n,r,s){super();this._ctx=e;this._clipboardService=t;this._configurationService=o;this._instantiationService=n;this._notificationService=r;this._terminalConfigurationService=s;this._overrideCopySelection=void 0;this._onWillPaste=this._register(new E);this.onWillPaste=this._onWillPaste.event;this._onDidPaste=this._register(new E);this.onDidPaste=this._onDidPaste.event}static{this.ID="terminal.clipboard"}static get(e){return e.getContribution(bL.ID)}xtermReady(e){this._xterm=e,this._register(e.onDidRequestCopyAsHtml(t=>this.copySelection(!0,t.command))),this._register(e.raw.onSelectionChange(async()=>{if(this._configurationService.getValue("terminal.integrated.copyOnSelection")){if(this._overrideCopySelection===!1)return;this._ctx.instance.hasSelection()&&await this.copySelection()}}))}async copySelection(e,t){this._xterm?.copySelection(e,t)}async paste(){await this._paste(await this._clipboardService.readText())}async pasteSelection(){await this._paste(await this._clipboardService.readText("selection"))}async _paste(e){if(!this._xterm)return;let t=e,o=await this._instantiationService.invokeFunction(xDo,t,this._xterm?.raw.modes.bracketedPasteMode);o&&(typeof o=="object"&&(t=o.modifiedText),this._ctx.instance.focus(),this._onWillPaste.fire(t),this._xterm.raw.paste(t),this._onDidPaste.fire(t))}async handleMouseEvent(e){switch(e.button){case 1:{if(this._terminalConfigurationService.config.middleClickBehavior==="paste")return this.paste(),{handled:!0};break}case 2:{if(e.shiftKey)return;let t=this._terminalConfigurationService.config.rightClickBehavior;return t!=="copyPaste"&&t!=="paste"?void 0:(t==="copyPaste"&&this._ctx.instance.hasSelection()?(await this.copySelection(),this._ctx.instance.clearSelection()):yg.clipboard.readText?this.paste():this._notificationService.info(`This browser doesn't support the clipboard.readText API needed to trigger a paste, try ${Ze?"\u2318":"Ctrl"}+V instead.`),Ze&&setTimeout(()=>this._ctx.instance.clearSelection(),0),{handled:!0})}}}overrideCopyOnSelection(e){if(this._overrideCopySelection!==void 0)throw new Error("Cannot set a copy on selection override multiple times");return this._overrideCopySelection=e,Z(()=>this._overrideCopySelection=void 0)}};bL=I([m(1,Fi),m(2,B),m(3,F),m(4,Ne),m(5,Uu)],bL);Mp(bL.ID,bL,!1);var fre=C.or(dt.processSupported,dt.terminalHasBeenCreated);Jl({id:"workbench.action.terminal.copyLastCommand",title:L(15446,"Copy Last Command"),precondition:fre,run:async(a,i,e)=>{let t=e.get(Fi),o=a.capabilities.get(2)?.commands;if(!o||o.length===0)return;let n=o[o.length-1];n.command&&await t.writeText(n.command)}});Jl({id:"workbench.action.terminal.copyLastCommandOutput",title:L(15448,"Copy Last Command Output"),precondition:fre,run:async(a,i,e)=>{let t=e.get(Fi),o=a.capabilities.get(2)?.commands;if(!o||o.length===0)return;let n=o[o.length-1];if(!n?.hasOutput())return;let r=n.getOutput();Fe(r)&&await t.writeText(r)}});Jl({id:"workbench.action.terminal.copyLastCommandAndLastCommandOutput",title:L(15447,"Copy Last Command and Output"),precondition:fre,run:async(a,i,e)=>{let t=e.get(Fi),o=a.capabilities.get(2)?.commands;if(!o||o.length===0)return;let n=o[o.length-1];if(!n?.hasOutput())return;let r=n.getOutput();Fe(r)&&await t.writeText(`${n.command!==""?n.command+`
`:""}${r}`)}});yg.clipboard.writeText&&(zm({id:"workbench.action.terminal.copySelection",title:L(15449,"Copy Selection"),precondition:C.or(dt.textSelectedInFocused,C.and(fre,dt.textSelected)),keybinding:[{primary:3105,mac:{primary:2081},weight:200,when:C.or(C.and(dt.textSelected,dt.focus),dt.textSelectedInFocused)}],run:a=>a.copySelection()}),zm({id:"workbench.action.terminal.copyAndClearSelection",title:L(15445,"Copy and Clear Selection"),precondition:C.or(dt.textSelectedInFocused,C.and(fre,dt.textSelected)),keybinding:[{win:{primary:2081},weight:200,when:C.or(C.and(dt.textSelected,dt.focus),dt.textSelectedInFocused)}],run:async a=>{await a.copySelection(),a.clearSelection()}}),zm({id:"workbench.action.terminal.copySelectionAsHtml",title:L(15450,"Copy Selection as HTML"),f1:!0,category:sr.actionCategory,precondition:C.or(dt.textSelectedInFocused,C.and(fre,dt.textSelected)),run:a=>a.copySelection(!0)}));yg.clipboard.readText&&Jl({id:"workbench.action.terminal.paste",title:L(15451,"Paste into Active Terminal"),precondition:fre,keybinding:[{primary:2100,win:{primary:2100,secondary:[3124]},linux:{primary:3124},weight:200,when:dt.focus}],run:a=>bL.get(a)?.paste()});yg.clipboard.readText&&fn&&Jl({id:"workbench.action.terminal.pasteSelection",title:L(15452,"Paste Selection into Active Terminal"),precondition:fre,keybinding:[{linux:{primary:1043},weight:200,when:dt.focus}],run:a=>bL.get(a)?.pasteSelection()});var Qgn=419,dze=class extends gre{constructor(e,t,o,n,r,s,l,c,u,p,h){super({showCommonFindToggles:!0,checkImeCompletionState:!0,showResultCount:!0,initialWidth:Qgn,enableSash:!0,appendCaseSensitiveActionId:"workbench.action.terminal.toggleFindCaseSensitive",appendRegexActionId:"workbench.action.terminal.toggleFindRegex",appendWholeWordsActionId:"workbench.action.terminal.toggleFindWholeWord",previousMatchActionId:"workbench.action.terminal.findPrevious",nextMatchActionId:"workbench.action.terminal.findNext",closeWidgetActionId:"workbench.action.terminal.hideFind",type:"Terminal",matchesLimit:2e4},s,n,l,c,o,h);this._instance=e;this._overrideCopyOnSelectionDisposable=this._register(new me);this._selectionDisposable=this._register(new me);this._register(this.state.onFindReplaceStateChange(()=>{this.show()})),this._findInputFocused=dt.findInputFocus.bindTo(n),this._findWidgetFocused=dt.findFocus.bindTo(n),this._findWidgetVisible=dt.findVisible.bindTo(n);let g=this.getDomNode().firstChild;g&&(this._register(j(g,"mousedown",v=>{v.stopPropagation()})),this._register(j(g,"contextmenu",v=>{v.stopPropagation()})));let f=this.getFindInputDomNode();this._register(j(f,"contextmenu",v=>{let b=Re(f),S=new Cn(b,v),y=gIi(t,p);r.showContextMenu({getAnchor:()=>S,getActions:()=>y,getActionsContext:()=>v.target}),v.stopPropagation()})),this._register(u.onDidColorThemeChange(()=>{this.isVisible()&&this.find(!0,!0)})),this._register(o.onDidChangeConfiguration(v=>{v.affectsConfiguration("workbench.colorCustomizations")&&this.isVisible()&&this.find(!0,!0)})),this._setupSearchEventListeners(),this.updateResultCount()}_setupSearchEventListeners(){let e=this._instance.xterm;e&&(this._register(e.onBeforeSearch(()=>{this._overrideCopyOnSelectionDisposable.clear(),this._overrideCopyOnSelectionDisposable.value=bL.get(this._instance)?.overrideCopyOnSelection(!1)})),this._register(e.onAfterSearch(()=>{this._overrideCopyOnSelectionDisposable.clear()})))}find(e,t){let o=this._instance.xterm;o&&(e?this._findPreviousWithEvent(o,this.inputValue,{regex:this._getRegexValue(),wholeWord:this._getWholeWordValue(),caseSensitive:this._getCaseSensitiveValue(),incremental:t}):this._findNextWithEvent(o,this.inputValue,{regex:this._getRegexValue(),wholeWord:this._getWholeWordValue(),caseSensitive:this._getCaseSensitiveValue()}))}reveal(){let t=(this._instance.hasSelection()&&!this._instance.selection.includes(`
`)?this._instance.selection:void 0)??this.inputValue,o=this._instance.xterm;o&&t&&t!==""&&this._findPreviousWithEvent(o,t,{incremental:!0,regex:this._getRegexValue(),wholeWord:this._getWholeWordValue(),caseSensitive:this._getCaseSensitiveValue()}).then(n=>{this.updateButtons(n),this._register(U.once(o.onDidChangeSelection)(()=>o.clearActiveSearchDecoration()))}),this.updateButtons(!1),super.reveal(t),this._findWidgetVisible.set(!0)}show(){let e=this._instance.hasSelection()&&!this._instance.selection.includes(`
`)?this._instance.selection:void 0;super.show(e),this._findWidgetVisible.set(!0)}hide(){super.hide(),this._overrideCopyOnSelectionDisposable.clear(),this._findWidgetVisible.reset(),this._instance.focus(!0),this._instance.xterm?.clearSearchDecorations()}async _getResultCount(){return this._instance.xterm?.findResult}_onInputChanged(){let e=this._instance.xterm;return e&&this._findPreviousWithEvent(e,this.inputValue,{regex:this._getRegexValue(),wholeWord:this._getWholeWordValue(),caseSensitive:this._getCaseSensitiveValue(),incremental:!0}).then(t=>{this.updateButtons(t)}),!1}_onFocusTrackerFocus(){this._overrideCopyOnSelectionDisposable.clear(),this._overrideCopyOnSelectionDisposable.value=bL.get(this._instance)?.overrideCopyOnSelection(!1),this._findWidgetFocused.set(!0)}_onFocusTrackerBlur(){this._overrideCopyOnSelectionDisposable.clear(),this._instance.xterm?.clearActiveSearchDecoration(),this._findWidgetFocused.reset()}_onFindInputFocusTrackerFocus(){this._findInputFocused.set(!0)}_onFindInputFocusTrackerBlur(){this._findInputFocused.reset()}findFirst(){let e=this._instance;e.hasSelection()&&e.clearSelection();let t=e.xterm;t&&this._findPreviousWithEvent(t,this.inputValue,{regex:this._getRegexValue(),wholeWord:this._getWholeWordValue(),caseSensitive:this._getCaseSensitiveValue()})}_registerSelectionChangeListener(e){this._selectionDisposable.value=U.once(e.onDidChangeSelection)(()=>e.clearActiveSearchDecoration())}async _findNextWithEvent(e,t,o){let n=await e.findNext(t,o);return this._registerSelectionChangeListener(e),n}async _findPreviousWithEvent(e,t,o){let n=await e.findPrevious(t,o);return this._registerSelectionChangeListener(e),n}};dze=I([m(1,Fi),m(2,B),m(3,X),m(4,Xe),m(5,Wn),m(6,nt),m(7,_e),m(8,Le),m(9,se),m(10,Oi)],dze);var x8t=class{constructor(){this.priority=105;this.name="terminal-find";this.type="help";this.when=dt.findFocus}getProvider(i){let e=i.get(ge);return new gBi(e)}},gBi=class extends x{constructor(e){super();this._commandService=e;this.id="terminalFindHelp";this.verbositySettingKey="accessibility.verbosity.find";this.options={type:"help"}}onClose(){setTimeout(()=>{this._commandService.executeCommand("workbench.action.terminal.focusFind")},200)}provideContent(){let e=[];return e.push(d(15485,null)),e.push(d(15480,null)),e.push(""),e.push(d(15506,null)),e.push(d(15505,null)),e.push(""),e.push(d(15492,null)),e.push(d(15491,null)),e.push(""),e.push(d(15490,null)),e.push(d(15489,null)),e.push(d(15486,null)),e.push(d(15487,null)),e.push(d(15488,null)),e.push(""),e.push(d(15484,null)),e.push(d(15481,null)),e.push(d(15482,null)),e.push(d(15483,null)),e.push(""),e.push(d(15493,null)),e.push(""),e.push(d(15495,null)),e.push(d(15494,null)),e.push(d(15497,null)),e.push(""),e.push(d(15496,null)),e.push(""),e.push(d(15500,null)),e.push(d(15498,null)),e.push(d(15501,null)),e.push(d(15499,null)),e.push(""),e.push(d(15503,null,"<keybinding:workbench.action.openSettings>")),e.push(d(15502,null)),e.push(d(15504,null)),e.push(""),e.push(d(15479,null)),e.push(d(15478,null)),e.join(`
`)}};var Mf=class extends x{static{this.ID="terminal.find"}static get(i){return i.getContribution(Mf.ID)}get findWidget(){return this._findWidget.value}constructor(i,e,t){super(),this._findWidget=new co(()=>{let o=e.createInstance(dze,i.instance);if(o.focusTracker.onDidFocus(()=>{Mf.activeFindWidget=this,i.instance.forceScrollbarVisibility(),YR(i.instance)||t.setActiveInstance(i.instance)}),o.focusTracker.onDidBlur(()=>{Mf.activeFindWidget=void 0,i.instance.resetScrollbarVisibility()}),!i.instance.domElement)throw new Error("FindWidget expected terminal DOM to be initialized");return i.instance.domElement?.appendChild(o.getDomNode()),this._lastLayoutDimensions&&o.layout(this._lastLayoutDimensions.width),o})}layout(i,e){this._lastLayoutDimensions=e,this._findWidget.rawValue?.layout(e.width)}xtermReady(i){this._register(i.onDidChangeFindResults(()=>this._findWidget.rawValue?.updateResultCount()))}dispose(){Mf.activeFindWidget===this&&(Mf.activeFindWidget=void 0),super.dispose(),this._findWidget.rawValue?.dispose()}};Mf=I([m(1,F),m(2,nn)],Mf);Mp(Mf.ID,Mf,!0);zm({id:"workbench.action.terminal.focusFind",title:L(15472,"Focus Find"),keybinding:{primary:2084,when:C.or(dt.findFocus,dt.focusInAny),weight:200},precondition:C.or(dt.processSupported,dt.terminalHasBeenCreated),run:(a,i,e)=>{(Mf.activeFindWidget||Mf.get(e))?.findWidget.reveal()}});zm({id:"workbench.action.terminal.hideFind",title:L(15473,"Hide Find"),keybinding:{primary:9,secondary:[1033],when:C.and(dt.focusInAny,dt.findVisible),weight:200},precondition:C.or(dt.processSupported,dt.terminalHasBeenCreated),run:(a,i,e)=>{(Mf.activeFindWidget||Mf.get(e))?.findWidget.hide()}});zm({id:"workbench.action.terminal.toggleFindRegex",title:L(15476,"Toggle Find Using Regex"),keybinding:{primary:560,mac:{primary:2608},when:dt.findVisible,weight:200},precondition:C.or(dt.processSupported,dt.terminalHasBeenCreated),run:(a,i,e)=>{let o=(Mf.activeFindWidget||Mf.get(e))?.findWidget.state;o?.change({isRegex:!o.isRegex},!1)}});zm({id:"workbench.action.terminal.toggleFindWholeWord",title:L(15477,"Toggle Find Using Whole Word"),keybinding:{primary:565,mac:{primary:2613},when:dt.findVisible,weight:200},precondition:C.or(dt.processSupported,dt.terminalHasBeenCreated),run:(a,i,e)=>{let o=(Mf.activeFindWidget||Mf.get(e))?.findWidget.state;o?.change({wholeWord:!o.wholeWord},!1)}});zm({id:"workbench.action.terminal.toggleFindCaseSensitive",title:L(15475,"Toggle Find Using Case Sensitive"),keybinding:{primary:545,mac:{primary:2593},when:dt.findVisible,weight:200},precondition:C.or(dt.processSupported,dt.terminalHasBeenCreated),run:(a,i,e)=>{let o=(Mf.activeFindWidget||Mf.get(e))?.findWidget.state;o?.change({matchCase:!o.matchCase},!1)}});zm({id:"workbench.action.terminal.findNext",title:L(15470,"Find Next"),keybinding:[{primary:61,mac:{primary:2085,secondary:[61]},when:C.or(dt.focusInAny,dt.findFocus),weight:200},{primary:1027,when:dt.findInputFocus,weight:200}],precondition:C.or(dt.processSupported,dt.terminalHasBeenCreated),run:(a,i,e)=>{let o=(Mf.activeFindWidget||Mf.get(e))?.findWidget;o&&(o.show(),o.find(!1))}});zm({id:"workbench.action.terminal.findPrevious",title:L(15471,"Find Previous"),keybinding:[{primary:1085,mac:{primary:3109,secondary:[1085]},when:C.or(dt.focusInAny,dt.findFocus),weight:200},{primary:3,when:dt.findInputFocus,weight:200}],precondition:C.or(dt.processSupported,dt.terminalHasBeenCreated),run:(a,i,e)=>{let o=(Mf.activeFindWidget||Mf.get(e))?.findWidget;o&&(o.show(),o.find(!0))}});Jl({id:"workbench.action.terminal.searchWorkspace",title:L(15474,"Search Workspace"),keybinding:[{primary:3108,when:C.and(dt.processSupported,dt.focus,dt.textSelected),weight:250}],run:(a,i,e)=>h0i(e,{query:a.selection})});ga.register(new x8t);var EDo=te("terminalStickyScroll.background",null,d(15597,null)),TDo=te("terminalStickyScrollHover.background",{dark:"#2A2D2E",light:"#F0F0F0",hcDark:"#E48B39",hcLight:"#0f4a85"},d(15599,null));te("terminalStickyScroll.border",{dark:null,light:null,hcDark:"#6fc3df",hcLight:"#0f4a85"},d(15598,null));var O6=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this._instance=e;this._xterm=t;this._xtermColorProvider=o;this._commandDetection=n;this._contextMenuService=c;this._keybindingService=u;this._terminalConfigurationService=h;this._themeService=g;this._xtermAddonLoader=new pHe;this._webglAddon=this._register(new me);this._refreshListeners=this._register(new me);this._state=0;this._isRefreshQueued=!1;this._rawMaxLineCount=5;this._ignoredCommands=[];this._pendingShowOperation=!1;this._contextMenu=this._register(p.createMenu(D.TerminalStickyScrollContext,l)),this._register(U.runAndSubscribe(this._xterm.raw.buffer.onBufferChange,f=>{this._setState((f??this._xterm.raw.buffer.active).type==="normal"?1:0)})),this._register(U.runAndSubscribe(s.onDidChangeConfiguration,f=>{(!f||f.affectsConfiguration("terminal.integrated.stickyScroll.maxLineCount"))&&(this._rawMaxLineCount=s.getValue("terminal.integrated.stickyScroll.maxLineCount")),(!f||f.affectsConfiguration("terminal.integrated.stickyScroll.ignoredCommands"))&&(this._ignoredCommands=s.getValue("terminal.integrated.stickyScroll.ignoredCommands"))})),this._register(this._instance.onDidChangeTarget(()=>this._syncOptions())),r.then(f=>{this._store.isDisposed||(this._stickyScrollOverlay=this._register(new f({rows:1,cols:this._xterm.raw.cols,allowProposedApi:!0,...this._getOptions()})),this._refreshGpuAcceleration(),this._register(s.onDidChangeConfiguration(v=>{v.affectsConfiguration(Vv)&&this._syncOptions()})),this._register(this._themeService.onDidColorThemeChange(()=>{this._syncOptions()})),this._register(this._xterm.raw.onResize(()=>{this._syncOptions(),this._refresh()})),this._register(this._instance.onDidChangeVisibility(v=>{v&&this._refresh()})),this._xtermAddonLoader.importAddon("serialize").then(v=>{this._store.isDisposed||(this._serializeAddon=this._register(new v),this._xterm.raw.loadAddon(this._serializeAddon),this._refresh())}))})}lockHide(){this._element?.classList.add("lock-hide")}unlockHide(){this._element?.classList.remove("lock-hide")}_setState(e){if(this._state!==e)switch(e){case 0:{this._setVisible(!1),this._uninstallRefreshListeners();break}case 1:{this._refresh(),this._installRefreshListeners();break}}}_installRefreshListeners(){this._refreshListeners.value||(this._refreshListeners.value=wn(U.any(this._xterm.raw.onScroll,this._xterm.raw.onLineFeed,this._xterm.raw.onCursorMove)(()=>this._refresh()),Jo(this._xterm.raw.element.querySelector(".xterm-viewport"),"scroll",()=>this._refresh())))}_uninstallRefreshListeners(){this._refreshListeners.clear()}_setVisible(e){e?(this._pendingShowOperation=!0,this._show()):this._hide()}_show(){this._pendingShowOperation&&(this._ensureElement(),this._element?.classList.toggle("visible",!0)),this._pendingShowOperation=!1}_hide(){this._pendingShowOperation=!1,this._element?.classList.toggle("visible",!1)}_refresh(){this._isRefreshQueued||(this._isRefreshQueued=!0,queueMicrotask(()=>{this._refreshNow(),this._isRefreshQueued=!1}))}_refreshNow(){let e=this._commandDetection.getCommandForLine(this._xterm.raw.buffer.active.viewportY);if(this._currentStickyCommand=void 0,!e||this._isIgnoredCommand(e)){this._setVisible(!1);return}if(!nC(e)){let o=this._commandDetection.currentCommand;if(o?.commandStartMarker&&o.commandExecutedMarker){this._updateContent(o,o.commandStartMarker);return}this._setVisible(!1);return}let t=e.marker;if(!t||t.line===-1){this._setVisible(!1);return}this._updateContent(e,t)}_updateContent(e,t){let o=this._xterm.raw;if(!o.element?.parentElement||!this._stickyScrollOverlay||!this._serializeAddon)return;if(e.promptStartMarker?.line===-1){this._setVisible(!1);return}let n=o.buffer.active,r=e.getPromptRowCount(),s=e.getCommandRowCount(),l=t.line-(r-1),c=!nC(e),u=!c&&e.endMarker?Math.max(n.viewportY-e.endMarker.line+1,0):0,p=Math.min(this._rawMaxLineCount,Math.floor(o.rows*.4)),h=Math.min(r+s-1,p)-u,g=h<r+s-1;if(n.viewportY<=l){this._setVisible(!1);return}if(c&&n.viewportY===n.baseY&&n.cursorY===o.rows-1){let v=n.getLine(n.baseY+o.rows-1);if(n.cursorX===1&&_Do(v,":")||n.cursorX===5&&_Do(v,"(END)")){this._setVisible(!1);return}}let f=this._serializeAddon.serialize({range:{start:l+u,end:l+u+Math.max(h-1,0)}})+(g?"\x1B[0m \u2026":"");if(c&&zS(f).length===0){this._setVisible(!1);return}if((f&&this._currentContent!==f||this._stickyScrollOverlay.cols!==o.cols||this._stickyScrollOverlay.rows!==h)&&(this._stickyScrollOverlay.resize(this._stickyScrollOverlay.cols,h),this._stickyScrollOverlay.write("\x1B[0m\x1B[H\x1B[2J"),this._stickyScrollOverlay.write(f),this._currentContent=f),f){if(this._currentStickyCommand=e,this._setVisible(!0),this._element){let v=o.element.getBoundingClientRect();if(v.height>0){let b=v.height/o.rows,S=h*b,y=0;if(!c&&e.endMarker&&e.endMarker.line!==-1){let w=Math.min(e.endMarker.line,n.baseY+n.cursorY);n.viewportY+h>w&&(y=(n.viewportY+h-w)*b)}this._element.style.bottom=`${v.height-S+1+y}px`}}}else this._setVisible(!1)}_ensureElement(){if(this._element||!this._stickyScrollOverlay||!this._xterm?.raw.element?.parentElement)return;let e=this._stickyScrollOverlay,t=_(".hover-overlay");this._element=_(".terminal-sticky-scroll",void 0,t),this._xterm.raw.element.parentElement.append(this._element),this._register(Z(()=>this._element?.remove()));let o=d(15601,null),n=this._keybindingService.lookupKeybinding("workbench.action.terminal.scrollToPreviousCommand");if(n){let l=n.getLabel();l&&(o+=`
`+d(15600,null,sr.scrollToPreviousCommand.value,l))}let r=this._keybindingService.lookupKeybinding("workbench.action.terminal.scrollToNextCommand");if(r){let l=r.getLabel();l&&(o+=`
`+d(15600,null,sr.scrollToNextCommand.value,l))}t.title=o;let s=this._xterm.raw._core.viewport?.scrollBarWidth;s!==void 0&&(this._element.style.right=`${s}px`),this._stickyScrollOverlay.open(this._element),this._stickyScrollOverlay.attachCustomKeyEventHandler(l=>l.key!=="Tab"),this._xtermAddonLoader.importAddon("ligatures").then(l=>{this._store.isDisposed||!this._stickyScrollOverlay||(this._ligaturesAddon=new l,this._stickyScrollOverlay.loadAddon(this._ligaturesAddon))}),this._register(Jo(t,"click",()=>{this._xterm&&this._currentStickyCommand&&(this._xterm.markTracker.revealCommand(this._currentStickyCommand),this._instance.focus())})),this._register(Jo(t,"wheel",l=>this._xterm?.raw.element?.dispatchEvent(new WheelEvent(l.type,l)))),this._register(j(t,"mousedown",l=>{l.stopImmediatePropagation(),l.preventDefault()})),this._register(j(t,"contextmenu",l=>{l.stopImmediatePropagation(),l.preventDefault(),M6(Re(t),l,this._instance,this._contextMenu,this._contextMenuService)})),this._register(Jo(t,"mouseover",()=>e.options.theme=this._getTheme(!0))),this._register(Jo(t,"mouseleave",()=>e.options.theme=this._getTheme(!1)))}_syncOptions(){this._stickyScrollOverlay&&(this._stickyScrollOverlay.resize(this._xterm.raw.cols,this._stickyScrollOverlay.rows),this._stickyScrollOverlay.options=this._getOptions(),this._refreshGpuAcceleration())}_getOptions(){let e=this._xterm.raw.options;return{cursorInactiveStyle:"none",scrollback:0,logLevel:"off",theme:this._getTheme(!1),documentOverride:e.documentOverride,fontFamily:e.fontFamily,fontWeight:e.fontWeight,fontWeightBold:e.fontWeightBold,fontSize:e.fontSize,letterSpacing:e.letterSpacing,lineHeight:e.lineHeight,drawBoldTextInBrightColors:e.drawBoldTextInBrightColors,minimumContrastRatio:e.minimumContrastRatio,tabStopWidth:e.tabStopWidth}}async _refreshGpuAcceleration(){if(this._shouldLoadWebgl()&&(!this._webglAddon.value||this._webglAddonCustomGlyphs!==this._terminalConfigurationService.config.customGlyphs)){let e=await this._xtermAddonLoader.importAddon("webgl");if(this._store.isDisposed)return;this._webglAddon.value=new e({customGlyphs:this._terminalConfigurationService.config.customGlyphs}),this._webglAddonCustomGlyphs=this._terminalConfigurationService.config.customGlyphs,this._stickyScrollOverlay?.loadAddon(this._webglAddon.value)}else!this._shouldLoadWebgl()&&this._webglAddon.value&&this._webglAddon.clear()}_shouldLoadWebgl(){return this._terminalConfigurationService.config.gpuAcceleration==="auto"||this._terminalConfigurationService.config.gpuAcceleration==="on"}_getTheme(e){let t=this._themeService.getColorTheme();return{...this._xterm.getXtermTheme(),background:e?t.getColor(TDo)?.toString()??this._xtermColorProvider.getBackgroundColor(t)?.toString():t.getColor(EDo)?.toString()??this._xtermColorProvider.getBackgroundColor(t)?.toString(),selectionBackground:void 0,selectionInactiveBackground:void 0}}_isIgnoredCommand(e){if(!e.command)return!1;let t=e.command.trim().toLowerCase();return this._ignoredCommands.some(o=>o.toLowerCase()===t)}};I([Zd(100)],O6.prototype,"_show",1),I([_P(0)],O6.prototype,"_syncOptions",1),I([_P(0)],O6.prototype,"_refreshGpuAcceleration",1),O6=I([m(5,B),m(6,X),m(7,Xe),m(8,_e),m(9,Kt),m(10,Uu),m(11,Le)],O6);function _Do(a,i){if(!a)return!1;for(let e=0;e<i.length;e++)if(a.getCell(e)?.getChars()!==i[e])return!1;return!0}var YW=class extends x{constructor(e,t,o,n,r){super();this._ctx=e;this._configurationService=t;this._contextKeyService=o;this._instantiationService=n;this._keybindingService=r;this._overlay=this._register(new me);this._enableListeners=this._register(new me);this._disableListeners=this._register(new me);this._richCommandDetectionListeners=this._register(new me);this._register(U.runAndSubscribe(this._configurationService.onDidChangeConfiguration,s=>{(!s||s.affectsConfiguration("terminal.integrated.stickyScroll.enabled"))&&this._refreshState()}))}static{this.ID="terminal.stickyScroll"}static get(e){return e.getContribution(YW.ID)}xtermReady(e){this._xterm=e,this._refreshState()}xtermOpen(e){this._refreshState()}hideLock(){this._overlay.value?.lockHide()}hideUnlock(){this._overlay.value?.unlockHide()}_refreshState(){this._overlay.value?this._tryDisable():this._tryEnable(),this._overlay.value?(this._enableListeners.clear(),this._disableListeners.value||(this._disableListeners.value=this._ctx.instance.capabilities.onDidRemoveCapability(e=>{e.id===2&&this._refreshState()}))):(this._disableListeners.clear(),this._enableListeners.value||(this._enableListeners.value=this._ctx.instance.capabilities.onDidAddCapability(e=>{e.id===2&&this._refreshState()})))}_tryEnable(){let e=this._ctx.instance.capabilities.get(2);if(this._shouldBeEnabled()){let t=dv.getXtermConstructor(this._keybindingService,this._contextKeyService);this._overlay.value=this._instantiationService.createInstance(O6,this._ctx.instance,this._xterm,this._instantiationService.createInstance(rbe,this._ctx.instance.targetRef),e,t),this._richCommandDetectionListeners.clear()}else e&&!e.hasRichCommandDetection?this._richCommandDetectionListeners.value=e.onSetRichCommandDetection(()=>{this._refreshState()}):this._richCommandDetectionListeners.clear()}_tryDisable(){this._shouldBeEnabled()||(this._overlay.clear(),this._richCommandDetectionListeners.clear())}_shouldBeEnabled(){let e=this._ctx.instance.capabilities.get(2);return!!(this._configurationService.getValue("terminal.integrated.stickyScroll.enabled")&&e&&e.hasRichCommandDetection&&this._xterm?.raw?.element)}};YW=I([m(1,B),m(2,X),m(3,F),m(4,_e)],YW);var uze=class extends x{constructor(e,t,o,n,r,s,l,c,u){super();this._terminalElement=e;this._instance=t;this._xterm=o;this._chatService=r;this._storageService=s;this._chatAgentService=c;this._chatWidgetService=u;this._onDidHide=this._register(new E);this.onDidHide=this._onDidHide.event;this._messages=this._store.add(new E);this._viewStateStorageKey="terminal-inline-chat-view-state";this._terminalAgentName="terminal";this._model=this._register(new me);this._sessionDisposables=this._register(new me);this._requestInProgress=Me(this,!1);this.requestInProgress=this._requestInProgress;this._focusedContextKey=Ja.focused.bindTo(n),this._visibleContextKey=Ja.visible.bindTo(n),this._requestActiveContextKey=Ja.requestActive.bindTo(n),this._responseContainsCodeBlockContextKey=Ja.responseContainsCodeBlock.bindTo(n),this._responseContainsMulitpleCodeBlocksContextKey=Ja.responseContainsMultipleCodeBlocks.bindTo(n),this._container=document.createElement("div"),this._container.classList.add("terminal-inline-chat"),this._terminalElement.appendChild(this._container),this._inlineChatWidget=l.createInstance(Rge,{location:"terminal",resolveData:()=>{}},{statusMenuId:{menu:XF,options:{buttonConfigProvider:h=>({showLabel:h.id!=="workbench.action.terminal.chat.rerunRequest",showIcon:h.id==="workbench.action.terminal.chat.rerunRequest",isSecondary:h.id!=="workbench.action.terminal.chat.runCommand"&&h.id!=="workbench.action.terminal.chat.runFirstCommand"})}},secondaryMenuId:qH,chatWidgetViewOptions:{menus:{telemetrySource:"terminal-inline-chat",executeToolbar:D.ChatExecute,inputSideToolbar:Eio},defaultMode:Tl.Ask}}),this._register(this._inlineChatWidget.chatWidget.onDidChangeViewModel(()=>this._saveViewState())),this._register(U.any(this._inlineChatWidget.onDidChangeHeight,this._instance.onDimensionsChanged,this._inlineChatWidget.chatWidget.onDidChangeContentHeight,U.fromObservableLight(this._inlineChatWidget.chatWidget.input.selectedLanguageModel),U.debounce(this._xterm.raw.onCursorMove,()=>{},ML))(()=>this._relayout()));let p=new ResizeObserver(()=>this._relayout());p.observe(this._terminalElement),this._register(Z(()=>p.disconnect())),this._resetPlaceholder(),this._container.appendChild(this._inlineChatWidget.domNode),this._focusTracker=this._register(qn(this._container)),this._register(this._focusTracker.onDidFocus(()=>this._focusedContextKey.set(!0))),this._register(this._focusTracker.onDidBlur(()=>this._focusedContextKey.set(!1))),this._register(be(h=>{let g=this._inlineChatWidget.requestInProgress.read(h);this._container.classList.toggle("busy",g),this._inlineChatWidget.toggleStatus(!!this._inlineChatWidget.responseContent),g||!this._inlineChatWidget.responseContent?(this._responseContainsCodeBlockContextKey.set(!1),this._responseContainsMulitpleCodeBlocksContextKey.set(!1)):Promise.all([this._inlineChatWidget.getCodeBlockInfo(0),this._inlineChatWidget.getCodeBlockInfo(1)]).then(([f,v])=>{this._responseContainsCodeBlockContextKey.set(!!f),this._responseContainsMulitpleCodeBlocksContextKey.set(!!v),this._inlineChatWidget.updateToolbar(!0)})})),this.hide()}get inlineChatWidget(){return this._inlineChatWidget}get lastResponseContent(){return this._lastResponseContent}_relayout(){this._dimension&&this._doLayout()}_doLayout(){let e=this._xterm.raw.element;if(!e)return;let t=Ki().getComputedStyle(e),o=parseInt(t.paddingLeft),n=e.clientWidth-o-12;if(n===0)return;let s=(this._getTerminalViewportHeight()??0)*.75,l=Math.max(Math.min(480,this._inlineChatWidget.contentHeight,s),this._inlineChatWidget.minHeight);l!==0&&(this._dimension=new si(n,l),this._inlineChatWidget.layout(this._dimension),this._inlineChatWidget.domNode.style.paddingLeft=`${o}px`,this._updateXtermViewportPosition())}_resetPlaceholder(){let e=this._chatAgentService.getDefaultAgent("terminal");this.inlineChatWidget.placeholder=e?.description??d(15256,null)}async reveal(){await this._createSession(),this._doLayout(),this._container.classList.remove("hide"),this._visibleContextKey.set(!0),this._resetPlaceholder(),this._inlineChatWidget.focus(),this._instance.scrollToBottom()}_getTerminalCursorTop(){let e=this._instance.xterm?.getFont();if(!e?.charHeight)return;let t=this._getTerminalViewportHeight()??0,o=e.charHeight*e.lineHeight,n=t-this._instance.rows*o,r=(this._instance.xterm?.raw.buffer.active.cursorY??0)+1;return n+r*o}_updateXtermViewportPosition(){let e=this._getTerminalCursorTop();if(!e)return;this._container.style.top=`${e}px`;let t=this._getTerminalViewportHeight();if(!t)return;let o=t*.75,n=Math.max(Math.min(480,this._inlineChatWidget.contentHeight,o),this._inlineChatWidget.minHeight);e>t-n&&t-n>0?this._setTerminalViewportOffset(e-(t-n)):this._setTerminalViewportOffset(void 0)}_getTerminalViewportHeight(){return this._terminalElement.clientHeight}hide(){this._container.classList.add("hide"),this._inlineChatWidget.reset(),this._resetPlaceholder(),this._inlineChatWidget.updateToolbar(!1),this._visibleContextKey.set(!1),this._inlineChatWidget.value="",this._instance.focus(),this._setTerminalViewportOffset(void 0),this._onDidHide.fire()}_setTerminalViewportOffset(e){e===void 0||this._container.classList.contains("hide")?(this._terminalElement.style.position="",this._terminalElement.style.bottom="",YW.get(this._instance)?.hideUnlock()):(this._terminalElement.style.position="relative",this._terminalElement.style.bottom=`${e}px`,YW.get(this._instance)?.hideLock())}focus(){this.inlineChatWidget.focus()}hasFocus(){return this._inlineChatWidget.hasFocus()}setValue(e){this._inlineChatWidget.value=e??""}async acceptCommand(e){let t=await this.inlineChatWidget.getCodeBlockInfo(0);if(!t)return;let o=t.getValue();this._instance.runCommand(o,e),this.clear()}get focusTracker(){return this._focusTracker}async _createSession(){this._sessionCtor=Ln(async e=>{if(!this._model.value){let t=this._chatService.startNewLocalSession("terminal");this._model.value=t;let o=t.object;this._inlineChatWidget.setChatModel(o),this._resetPlaceholder()}}),this._sessionDisposables.value=Z(()=>this._sessionCtor?.cancel())}_saveViewState(){let e=this._inlineChatWidget.chatWidget.getViewState();e&&this._storageService.store(this._viewStateStorageKey,JSON.stringify(e),0,0)}clear(){this.cancel(),this._model.clear(),this._responseContainsCodeBlockContextKey.reset(),this._requestActiveContextKey.reset(),this.hide(),this.setValue(void 0)}async acceptInput(e,t){this._model.value||await this.reveal(),this._messages.fire(32);let o=this._inlineChatWidget.value;if(!o)return;this._activeRequestCts?.cancel(),this._activeRequestCts=new Ye;let n=new N;this._requestActiveContextKey.set(!0);let r=await this._inlineChatWidget.chatWidget.acceptInput(o,{isVoiceInput:t?.isVoiceInput});this._currentRequestId=r?.requestId;let s=new Ko;try{return this._requestActiveContextKey.set(!0),r&&n.add(r.onDidChange(async()=>{if(r.isCanceled){this._requestActiveContextKey.set(!1),s.complete(void 0);return}if(r.isComplete){this._requestActiveContextKey.set(!1),this._requestActiveContextKey.set(!1);let l=await this._inlineChatWidget.getCodeBlockInfo(0),c=await this._inlineChatWidget.getCodeBlockInfo(1);this._responseContainsCodeBlockContextKey.set(!!l),this._responseContainsMulitpleCodeBlocksContextKey.set(!!c),this._inlineChatWidget.updateToolbar(!0),s.complete(r)}})),await s.p,this._lastResponseContent=r?.response.getMarkdown(),r}catch{this._lastResponseContent=void 0;return}finally{n.dispose()}}cancel(){this._sessionCtor?.cancel(),this._sessionCtor=void 0,this._activeRequestCts?.cancel(),this._requestActiveContextKey.set(!1);let e=this._inlineChatWidget.getChatModel();e?.sessionResource&&this._chatService.cancelCurrentRequestForSession(e?.sessionResource,"terminalChat")}async viewInChat(){let e=await this._chatWidgetService.revealWidget(),t=this._inlineChatWidget.chatWidget.viewModel?.model.getRequests().find(n=>n.id===this._currentRequestId);if(!e||!t?.response)return;let o=[];for(let n of t.response.response.value)if(n.kind==="textEditGroup")for(let r of n.edits)o.push({kind:"textEdit",edits:r,uri:n.uri});else if(n.kind==="notebookEditGroup")for(let r of n.edits)UDe(r)?o.push({kind:"textEdit",edits:r.map(s=>s.edit),uri:r[0].uri}):o.push({kind:"notebookEdit",edits:r,uri:n.uri});else o.push(n);this._chatService.addCompleteRequest(e.viewModel.sessionResource,`@${this._terminalAgentName} ${t.message.text}`,t.variableData,t.attempt,{message:o,result:t.response.result,followups:t.response.followups}),e.focusResponseItem(),this.hide()}};uze=I([m(3,X),m(4,mi),m(5,ce),m(6,F),m(7,cr),m(8,Pt)],uze);var ym=class extends x{constructor(e,t,o,n,r,s){super();this._ctx=e;this._contextKeyService=n;this._instantiationService=r;this._terminalService=s;this._forcedPlaceholder=void 0;this._register(o.onDidChangeSentiment(()=>{o.sentiment.hidden&&this._terminalChatWidget?.value.clear()})),this._register(t.registerProvider({getCodeBlockContext:l=>{if(!(!l||!this._terminalChatWidget?.hasValue||!this.hasFocus()))return{element:l,code:l.getValue(),codeBlockIndex:0,languageId:l.getModel().getLanguageId(),chatSessionResource:this._terminalChatWidget.value.inlineChatWidget.chatWidget.viewModel?.sessionResource}}},"terminal"))}static{this.ID="terminal.chat"}static get(e){return e.getContribution(ym.ID)}get terminalChatWidget(){return this._terminalChatWidget?.value}get lastResponseContent(){return this._lastResponseContent}get scopedContextKeyService(){return this._terminalChatWidget?.value.inlineChatWidget.scopedContextKeyService??this._contextKeyService}xtermReady(e){this._terminalChatWidget=new co(()=>{let t=this._register(this._instantiationService.createInstance(uze,this._ctx.instance.domElement,this._ctx.instance,e));if(this._register(t.focusTracker.onDidFocus(()=>{ym.activeChatController=this,YR(this._ctx.instance)||this._terminalService.setActiveInstance(this._ctx.instance)})),this._register(t.focusTracker.onDidBlur(()=>{ym.activeChatController=void 0,this._ctx.instance.resetScrollbarVisibility()})),!this._ctx.instance.domElement)throw new Error("FindWidget expected terminal DOM to be initialized");return t})}_updatePlaceholder(){let e=this._terminalChatWidget?.value.inlineChatWidget;e&&(e.placeholder=this._getPlaceholderText())}_getPlaceholderText(){return this._forcedPlaceholder??""}setPlaceholder(e){this._forcedPlaceholder=e,this._updatePlaceholder()}resetPlaceholder(){this._forcedPlaceholder=void 0,this._updatePlaceholder()}updateInput(e,t=!0){let o=this._terminalChatWidget?.value.inlineChatWidget;o&&(o.value=e,t&&o.selectAll())}focus(){this._terminalChatWidget?.value.focus()}hasFocus(){return this._terminalChatWidget?.rawValue?.hasFocus()??!1}async viewInChat(){let e=this.terminalChatWidget?.inlineChatWidget.chatWidget.viewModel?.model;e&&await this._instantiationService.invokeFunction(Ygn,e),this._terminalChatWidget?.rawValue?.hide()}};ym=I([m(1,XX),m(2,rr),m(3,X),m(4,F),m(5,nn)],ym);async function Ygn(a,i){let e=a.get(mi),o=await a.get(Pt).revealWidget();if(o&&o.viewModel&&i){for(let n of i.getRequests().slice())await e.adoptRequest(o.viewModel.model.sessionResource,n);o.focusResponseItem()}}var k8t=class{constructor(){this.priority=105;this.name="terminalInlineChat";this.type="view";this.when=Ja.focused}getProvider(i){let e=i.get(nn),t=i.get(Kt),o=[],n=ym.activeChatController?.scopedContextKeyService;if(n){let l=t.getMenuActions(XF,n);for(let c of l)for(let u of c[1])u instanceof Lo&&o.push(u)}let r=e.activeInstance?.getContribution(ym.ID)??void 0;if(!r?.lastResponseContent)return;let s=r.lastResponseContent;return new xp("terminal-chat",{type:"view"},()=>s,()=>{r.focus()},"accessibility.verbosity.inlineChat",void 0,o)}};zm({id:"workbench.action.terminal.chat.start",title:L(15251,"Open Inline Chat"),category:L(15252,"Terminal"),keybinding:{primary:2087,when:C.and(dt.focusInAny),weight:401},f1:!0,precondition:C.and(ie.enabled,C.or(dt.processSupported,dt.terminalHasBeenCreated),Ja.hasChatAgent),menu:{id:D.TerminalInstanceContext,group:"0_chat",order:2,when:ie.enabled},run:(a,i,e,t)=>{if(YR(e))return;let o=ym.activeChatController||ym.get(e);if(o){if(t){let n=function(r){return typeof r=="object"&&r!==null&&"query"in r&&Fe(r.query)};t=Fe(t)?{query:t}:t,n(t)&&(o.updateInput(t.query,!1),t.isPartialQuery||o.terminalChatWidget?.acceptInput())}o.terminalChatWidget?.reveal()}}});zm({id:"workbench.action.terminal.chat.close",title:L(15240,"Close"),category:Wy.category,keybinding:{primary:9,when:C.and(C.or(dt.focus,Ja.focused),Ja.visible),weight:200},menu:[{id:XF,group:"0_main",order:2}],icon:R.close,f1:!0,precondition:C.and(ie.enabled,Ja.visible),run:(a,i,e)=>{if(YR(e))return;(ym.activeChatController||ym.get(e))?.terminalChatWidget?.clear()}});zm({id:"workbench.action.terminal.chat.runCommand",title:L(15246,"Run Chat Command"),shortTitle:L(15245,"Run"),category:Wy.category,precondition:C.and(ie.enabled,C.or(dt.processSupported,dt.terminalHasBeenCreated),Ja.requestActive.negate(),Ja.responseContainsCodeBlock,Ja.responseContainsMultipleCodeBlocks.negate()),icon:R.play,keybinding:{when:Ja.requestActive.negate(),weight:200,primary:2051},menu:{id:XF,group:"0_main",order:0,when:C.and(Ja.responseContainsCodeBlock,Ja.responseContainsMultipleCodeBlocks.negate(),Ja.requestActive.negate())},run:(a,i,e)=>{if(YR(e))return;(ym.activeChatController||ym.get(e))?.terminalChatWidget?.acceptCommand(!0)}});zm({id:"workbench.action.terminal.chat.runFirstCommand",title:L(15248,"Run First Chat Command"),shortTitle:L(15247,"Run First"),category:Wy.category,precondition:C.and(ie.enabled,C.or(dt.processSupported,dt.terminalHasBeenCreated),Ja.requestActive.negate(),Ja.responseContainsMultipleCodeBlocks),icon:R.play,keybinding:{when:Ja.requestActive.negate(),weight:200,primary:2051},menu:{id:XF,group:"0_main",order:0,when:C.and(Ja.responseContainsMultipleCodeBlocks,Ja.requestActive.negate())},run:(a,i,e)=>{if(YR(e))return;(ym.activeChatController||ym.get(e))?.terminalChatWidget?.acceptCommand(!0)}});zm({id:"workbench.action.terminal.chat.insertCommand",title:L(15242,"Insert Chat Command"),shortTitle:L(15241,"Insert"),category:Wy.category,icon:R.insert,precondition:C.and(ie.enabled,C.or(dt.processSupported,dt.terminalHasBeenCreated),Ja.requestActive.negate(),Ja.responseContainsCodeBlock,Ja.responseContainsMultipleCodeBlocks.negate()),keybinding:{when:Ja.requestActive.negate(),weight:200,primary:515,secondary:[2563]},menu:{id:XF,group:"0_main",order:1,when:C.and(Ja.responseContainsCodeBlock,Ja.responseContainsMultipleCodeBlocks.negate(),Ja.requestActive.negate())},run:(a,i,e)=>{if(YR(e))return;(ym.activeChatController||ym.get(e))?.terminalChatWidget?.acceptCommand(!1)}});zm({id:"workbench.action.terminal.chat.insertFirstCommand",title:L(15244,"Insert First Chat Command"),shortTitle:L(15243,"Insert First"),category:Wy.category,precondition:C.and(ie.enabled,C.or(dt.processSupported,dt.terminalHasBeenCreated),Ja.requestActive.negate(),Ja.responseContainsMultipleCodeBlocks),keybinding:{when:Ja.requestActive.negate(),weight:200,primary:515,secondary:[2563]},menu:{id:XF,group:"0_main",order:1,when:C.and(Ja.responseContainsMultipleCodeBlocks,Ja.requestActive.negate())},run:(a,i,e)=>{if(YR(e))return;(ym.activeChatController||ym.get(e))?.terminalChatWidget?.acceptCommand(!1)}});zm({id:"workbench.action.terminal.chat.rerunRequest",title:L(15238,"Rerun Request"),f1:!1,icon:R.refresh,category:Wy.category,precondition:C.and(ie.enabled,C.or(dt.processSupported,dt.terminalHasBeenCreated),Ja.requestActive.negate()),keybinding:{weight:200,primary:2096,when:Ja.focused},menu:{id:XF,group:"0_main",order:5,when:C.and(Ja.inputHasText.toNegated(),Ja.requestActive.negate())},run:async(a,i,e)=>{let t=i.get(mi),o=i.get(Pt),r=ym.activeChatController?.terminalChatWidget?.inlineChatWidget.chatWidget.viewModel?.model;if(!r)return;let s=r.getRequests().at(-1);if(s){let l=o.getWidgetBySessionResource(r.sessionResource);await t.resendRequest(s,{noCommandDetection:!1,attempt:s.attempt+1,location:"terminal",userSelectedModelId:l?.input.currentLanguageModel})}}});zm({id:"workbench.action.terminal.chat.viewInChat",title:L(15255,"View in Chat"),category:Wy.category,precondition:C.and(ie.enabled,C.or(dt.processSupported,dt.terminalHasBeenCreated),Ja.requestActive.negate()),icon:R.chatSparkle,menu:[{id:XF,group:"zzz",order:1,isHiddenByDefault:!0,when:C.and(Ja.responseContainsCodeBlock,Ja.requestActive.negate())}],run:(a,i,e)=>{if(YR(e))return;(ym.activeChatController||ym.get(e))?.viewInChat()}});W(class extends K{constructor(){super({id:"workbench.action.terminal.chat.viewHiddenChatTerminals",title:L(15254,"View Hidden Chat Terminals"),category:L(15253,"Terminal"),f1:!0,precondition:C.and(Ja.hasHiddenChatTerminals,ie.enabled),menu:[{id:D.ViewTitle,when:C.and(Ja.hasHiddenChatTerminals,C.equals("view",Dr)),group:"terminal",order:0,isHiddenByDefault:!0}]})}async run(i){let e=i.get(nn),t=i.get(lc),o=i.get(Fv),n=i.get(Wv),r=i.get(Ue),s=i.get(F),l=i.get(mi),c=new Set([...t.instances,...o.instances]),u=n.getToolSessionTerminalInstances();if(u.length===0)return;let p=new Map;for(let y of u)c.has(y)||p.set(y.instanceId,y);if(p.size===0)return;if(p.size===1){let y=Array.from(p.values())[0];e.setActiveInstance(y),await e.revealTerminal(y),await e.focusInstance(y);return}let h=[],g=y=>L(15239,"Last: {0}",y).value,f=80,v=[];for(let y of p.values()){let k=`$(${s.invokeFunction(MJ,y)}) ${y.title}`,T=y.capabilities.get(2)?.commands.at(-1)?.command,P=n.getChatSessionResourceForInstance(y),O;P&&(O=l.getSession(P)?.title??l.getSessionTitle(P));let V=O,H,G;if(T){let $=T.split(`
`),J=$[0],ae=J.length>f?J.substring(0,f)+"\u2026":J;H=g(ae);let he=J.length>f,oe=$.length>1;(he||oe)&&(oe?G={value:`\`\`\`
${T}
\`\`\``,supportThemeIcons:!0}:G=g(T))}v.push({label:k,description:V,detail:H,tooltip:G,id:String(y.instanceId)})}for(let y of v)h.push({label:y.label,description:y.description,detail:y.detail,tooltip:y.tooltip,id:y.id});let b=r.createQuickPick();b.placeholder=L(15249,"Select a chat terminal to show and focus").value,b.items=h,b.canSelectMany=!1,b.title=L(15250,"Chat Terminals").value,b.matchOnDescription=!0,b.matchOnDetail=!0;let S=new N;S.add(b),S.add(b.onDidAccept(async()=>{let y=b.selectedItems[0];if(y){let w=p.get(Number(y.id));w?(e.setActiveInstance(w),await e.revealTerminal(w),b.hide(),await e.focusInstance(w)):b.hide()}else b.hide()})),S.add(b.onDidHide(()=>{S.dispose(),b.dispose()})),b.show()}});Ct.registerCommandAndKeybindingRule({id:"workbench.action.terminal.chat.focusMostRecentChatTerminal",weight:200,when:ie.inChatSession,handler:async a=>{let e=a.get(Wv).getMostRecentProgressPart();e&&await e.focusTerminal()}});Ct.registerCommandAndKeybindingRule({id:"workbench.action.terminal.chat.focusMostRecentChatTerminalOutput",weight:200,when:ie.inChatSession,primary:3629,handler:async a=>{let e=a.get(Wv).getMostRecentProgressPart();e&&await e.toggleOutputFromKeyboard()}});ve.appendMenuItem(D.CommandPalette,{command:{id:"workbench.action.terminal.chat.focusMostRecentChatTerminal",title:d(15236,null)},when:ie.inChatSession});ve.appendMenuItem(D.CommandPalette,{command:{id:"workbench.action.terminal.chat.focusMostRecentChatTerminalOutput",title:d(15237,null)},when:ie.inChatSession});$e.registerCommand("workbench.action.terminal.chat.openTerminalSettingsLink",async(a,i)=>{let e=a.get(Go);if(i==="global")e.openSettings({query:"@id:chat.tools.global.autoApprove"});else{let t=parseInt(i),o=isNaN(t)?void 0:t,n={jsonEditor:!0,revealSetting:{key:"chat.tools.terminal.autoApprove"}};switch(o){case 1:e.openApplicationSettings(n);break;case 2:case 3:e.openUserSettings(n);break;case 4:e.openRemoteSettings(n);break;case 5:case 6:e.openWorkspaceSettings(n);break;default:{e.openSettings({target:2,query:"@id:chat.tools.terminal.autoApprove"});break}}}});$e.registerCommand("workbench.action.terminal.chat.disableSessionAutoApproval",async(a,i)=>{a.get(Wv).setChatSessionAutoApproval(i,!1)});var E8t=class{constructor(){this.priority=110;this.name="terminalChat";this.when=Ja.focused;this.type="help"}getProvider(i){let t=i.get(nn).activeInstance;if(!t)return;let o=Xgn(i);return new xp("terminal-chat",{type:"help"},()=>o,()=>ym.get(t)?.terminalChatWidget?.focus(),"accessibility.verbosity.terminalChat")}};function Xgn(a){let i=a.get(_e),e=[],t=i.lookupKeybinding("editor.action.accessibleView")?.getAriaLabel(),o=i.lookupKeybinding("workbench.action.terminal.chat.runCommand")?.getAriaLabel(),n=i.lookupKeybinding("workbench.action.terminal.chat.insertCommand")?.getAriaLabel(),r=i.lookupKeybinding("workbench.action.terminal.chat.makeRequest")?.getAriaLabel(),s=i.lookupKeybinding("workbench.action.terminal.chat.start")?.getAriaLabel(),l=i.lookupKeybinding("chat.action.focus")?.getAriaLabel(),c=i.lookupKeybinding("workbench.action.chat.focusInput")?.getAriaLabel();return e.push(d(15232,null)),e.push(d(15221,null,s)),e.push(r?d(15226,null,r):d(15227,null)),e.push(t?d(15230,null,t):d(15231,null)),e.push(l?d(15224,null,l):d(15225,null)),e.push(c?d(15222,null,c):d(15223,null)),e.push(o?d(15233,null,o):d(15234,null)),e.push(n?d(15228,null,n):d(15229,null)),e.push(d(15235,null)),e.push(d(15220,null)),e.join(`
`)}var gbe=class{constructor(i,e){this._store=new N;this._ctxHasProvider=Ja.hasChatAgent.bindTo(e),this._store.add(U.runAndSubscribe(i.onDidChangeAgents,()=>{let t=!!i.getDefaultAgent("terminal");this._ctxHasProvider.set(t)}))}static{this.Id="terminalChat.enabler"}dispose(){this._ctxHasProvider.reset(),this._store.dispose()}};gbe=I([m(0,cr),m(1,X)],gbe);var pze=class extends x{constructor(e,t,o,n,r){super();this._logService=e;this._terminalService=t;this._storageService=o;this._contextKeyService=n;this._chatService=r;this._terminalInstancesByToolSessionId=new Map;this._toolSessionIdByTerminalInstance=new Map;this._chatSessionResourceByTerminalInstance=new Map;this._terminalInstanceListenersByToolSessionId=this._register(new Vt);this._chatSessionListenersByTerminalInstance=this._register(new Vt);this._onDidContinueInBackground=this._register(new E);this.onDidContinueInBackground=this._onDidContinueInBackground.event;this._onDidRegisterTerminalInstanceForToolSession=this._register(new E);this.onDidRegisterTerminalInstanceWithToolSession=this._onDidRegisterTerminalInstanceForToolSession.event;this._activeProgressParts=new Set;this._pendingRestoredMappings=new Map;this._sessionAutoApprovalEnabled=new gt;this._sessionAutoApproveRules=new gt;this._hasToolTerminalContext=Ja.hasChatTerminals.bindTo(this._contextKeyService),this._hasHiddenToolTerminalContext=Ja.hasHiddenChatTerminals.bindTo(this._contextKeyService),this._restoreFromStorage(),this._register(this._chatService.onDidDisposeSession(s=>{for(let l of s.sessionResources)this._sessionAutoApproveRules.delete(l),this._sessionAutoApprovalEnabled.delete(l)}))}registerTerminalInstanceWithToolSession(e,t){if(!e){this._logService.warn("Attempted to register a terminal instance with an undefined tool session ID");return}this._terminalInstancesByToolSessionId.set(e,t),this._toolSessionIdByTerminalInstance.set(t,e),this._onDidRegisterTerminalInstanceForToolSession.fire(t),this._terminalInstanceListenersByToolSessionId.set(e,t.onDisposed(()=>{this._terminalInstancesByToolSessionId.delete(e),this._toolSessionIdByTerminalInstance.delete(t),this._terminalInstanceListenersByToolSessionId.deleteAndDispose(e),this._persistToStorage(),this._updateHasToolTerminalContextKeys()})),this._register(this._chatService.onDidDisposeSession(o=>{for(let n of o.sessionResources)Jr.parseLocalSessionId(n)===e&&(this._terminalInstancesByToolSessionId.delete(e),this._toolSessionIdByTerminalInstance.delete(t),this._terminalInstanceListenersByToolSessionId.deleteAndDispose(e),this._sessionAutoApprovalEnabled.delete(n),this._persistToStorage(),this._updateHasToolTerminalContextKeys())})),this._register(this._terminalService.onDidChangeInstances(()=>this._updateHasToolTerminalContextKeys())),(Yo(t.shellLaunchConfig?.attachPersistentProcess?.id)||Yo(t.persistentProcessId))&&this._persistToStorage(),this._updateHasToolTerminalContextKeys()}async getTerminalInstanceByToolSessionId(e){if(await this._terminalService.whenConnected,!!e){if(this._pendingRestoredMappings.has(e)){let t=this._terminalService.instances.find(o=>o.shellLaunchConfig.attachPersistentProcess?.id===this._pendingRestoredMappings.get(e));if(t)return this._tryAdoptRestoredMapping(t),t}return this._terminalInstancesByToolSessionId.get(e)}}getToolSessionTerminalInstances(e){if(e){let t=new Set(this._terminalService.foregroundInstances.map(n=>n.instanceId)),o=new Set(this._terminalInstancesByToolSessionId.values());return Array.from(o).filter(n=>!t.has(n.instanceId))}return Array.from(new Set(this._terminalInstancesByToolSessionId.values()))}getToolSessionIdForInstance(e){return this._toolSessionIdByTerminalInstance.get(e)}registerTerminalInstanceWithChatSession(e,t){let o=this._chatSessionResourceByTerminalInstance.get(t);if(o&&o.toString()===e.toString())return;this._chatSessionListenersByTerminalInstance.deleteAndDispose(t),this._chatSessionResourceByTerminalInstance.set(t,e);let n=t.onDisposed(()=>{this._chatSessionResourceByTerminalInstance.delete(t),this._chatSessionListenersByTerminalInstance.deleteAndDispose(t)});this._chatSessionListenersByTerminalInstance.set(t,n)}getChatSessionResourceForInstance(e){return this._chatSessionResourceByTerminalInstance.get(e)}isBackgroundTerminal(e){if(!e)return!1;let t=this._terminalInstancesByToolSessionId.get(e);return t?this._terminalService.instances.includes(t)&&!this._terminalService.foregroundInstances.includes(t):!1}registerProgressPart(e){return this._activeProgressParts.add(e),this._isAfter(e,this._mostRecentProgressPart)&&(this._mostRecentProgressPart=e),Z(()=>{this._activeProgressParts.delete(e),this._focusedProgressPart===e&&(this._focusedProgressPart=void 0),this._mostRecentProgressPart===e&&(this._mostRecentProgressPart=this._getLastActiveProgressPart())})}setFocusedProgressPart(e){this._focusedProgressPart=e}clearFocusedProgressPart(e){this._focusedProgressPart===e&&(this._focusedProgressPart=void 0)}getFocusedProgressPart(){return this._focusedProgressPart}getMostRecentProgressPart(){return(!this._mostRecentProgressPart||!this._activeProgressParts.has(this._mostRecentProgressPart))&&(this._mostRecentProgressPart=this._getLastActiveProgressPart()),this._mostRecentProgressPart}_getLastActiveProgressPart(){let e;for(let t of this._activeProgressParts)this._isAfter(t,e)&&(e=t);return e}_isAfter(e,t){return t?e.elementIndex===t.elementIndex?e.contentIndex>=t.contentIndex:e.elementIndex>t.elementIndex:!0}_restoreFromStorage(){try{let e=this._storageService.get("terminalChat.toolSessionMappings",1);if(!e)return;let t=JSON.parse(e);for(let[o,n]of t)Fe(o)&&Yo(n)&&this._pendingRestoredMappings.set(o,n)}catch(e){this._logService.warn("Failed to restore terminal chat tool session mappings",e)}}_tryAdoptRestoredMapping(e){if(this._pendingRestoredMappings.size!==0){for(let[t,o]of this._pendingRestoredMappings)if(o===e.shellLaunchConfig.attachPersistentProcess?.id){this._terminalInstancesByToolSessionId.set(t,e),this._toolSessionIdByTerminalInstance.set(e,t),this._onDidRegisterTerminalInstanceForToolSession.fire(e),this._terminalInstanceListenersByToolSessionId.set(t,e.onDisposed(()=>{this._terminalInstancesByToolSessionId.delete(t),this._toolSessionIdByTerminalInstance.delete(e),this._terminalInstanceListenersByToolSessionId.deleteAndDispose(t),this._persistToStorage()})),this._pendingRestoredMappings.delete(t),this._persistToStorage();break}}}_persistToStorage(){this._updateHasToolTerminalContextKeys();try{let e=[];for(let[t,o]of this._terminalInstancesByToolSessionId.entries()){let n=Yo(o.persistentProcessId)?o.persistentProcessId:o.shellLaunchConfig.attachPersistentProcess?.id,r=o.shouldPersist||o.shellLaunchConfig.forcePersist;Yo(n)&&r&&e.push([t,n])}e.length>0?this._storageService.store("terminalChat.toolSessionMappings",JSON.stringify(e),1,1):this._storageService.remove("terminalChat.toolSessionMappings",1)}catch(e){this._logService.warn("Failed to persist terminal chat tool session mappings",e)}}_updateHasToolTerminalContextKeys(){let e=this._terminalInstancesByToolSessionId.size;this._hasToolTerminalContext.set(e>0);let t=this.getToolSessionTerminalInstances(!0).length;this._hasHiddenToolTerminalContext.set(t>0)}setChatSessionAutoApproval(e,t){t?this._sessionAutoApprovalEnabled.set(e,!0):this._sessionAutoApprovalEnabled.delete(e)}hasChatSessionAutoApproval(e){return this._sessionAutoApprovalEnabled.has(e)}addSessionAutoApproveRule(e,t,o){let n=this._sessionAutoApproveRules.get(e);n||(n={},this._sessionAutoApproveRules.set(e,n)),n[t]=o}getSessionAutoApproveRules(e){return this._sessionAutoApproveRules.get(e)??{}}continueInBackground(e){this._onDidContinueInBackground.fire(e)}};pze=I([m(0,se),m(1,nn),m(2,ce),m(3,X),m(4,mi)],pze);Mp(ym.ID,ym,!1);ga.register(new k8t);ga.register(new E8t);It(gbe.Id,gbe,St.AfterRestored);Ee(Wv,pze,1);var vre=class extends x{constructor(e,t){super();this._ctx=e;this._configurationService=t;this._activeCommandGuide=this._register(new me)}static{this.ID="terminal.commandGuide"}static get(e){return e.getContribution(vre.ID)}xtermOpen(e){this._xterm=e,this._refreshActivatedState(),this._register(this._configurationService.onDidChangeConfiguration(t=>{t.affectsConfiguration("terminal.integrated.shellIntegration.showCommandGuide")&&this._refreshActivatedState()}))}_refreshActivatedState(){let e=this._xterm;if(!e)return;let t=this._configurationService.getValue(Mio).showCommandGuide;if(!!this._activeCommandGuide.value!==t)if(!t)this._activeCommandGuide.clear();else{let o=e.raw.element.querySelector(".xterm-screen"),n=e.raw.element.querySelector(".xterm-viewport");this._activeCommandGuide.value=wn(j(o,"mousemove",r=>this._tryShowHighlight(o,e,r)),j(n,"mousemove",r=>this._tryShowHighlight(o,e,r)),j(e.raw.element,"mouseleave",()=>e.markTracker.showCommandGuide(void 0)),e.raw.onData(()=>e.markTracker.showCommandGuide(void 0)),Z(()=>e.markTracker.showCommandGuide(void 0)))}}_tryShowHighlight(e,t,o){let n=e.getBoundingClientRect();if(!n)return;let r=Math.floor((o.clientY-n.top)/(n.height/t.raw.rows)),s=this._ctx.instance.capabilities.get(2)?.getCommandForLine(t.raw.buffer.active.viewportY+r);s&&nC(s)?t.markTracker.showCommandGuide(s):t.markTracker.showCommandGuide(void 0)}};vre=I([m(1,B)],vre);Mp(vre.ID,vre,!1);var Otb=te("terminalCommandGuide.foreground",{dark:ai(Kf,1),light:ai(Kf,1),hcDark:vf,hcLight:vf},d(15458,null));var fBi;function Tct(a){return fBi||(fBi=a.get(F).createInstance(mze,"dirs")),fBi}var vBi;function hze(a){return vBi||(vBi=a.get(F).createInstance(mze,"commands")),vBi}var mze=class extends x{constructor(e,t,o){super();this._storageDataKey=e;this._configurationService=t;this._storageService=o;this._timestamp=0;this._isReady=!1;this._isStale=!0;this._entries=new dl(this._getHistoryLimit()),this._register(this._configurationService.onDidChangeConfiguration(n=>{n.affectsConfiguration("terminal.integrated.shellIntegration.history")&&(this._entries.limit=this._getHistoryLimit())})),this._register(this._storageService.onDidChangeValue(-1,this._getTimestampStorageKey(),this._store)(()=>{this._isStale||(this._isStale=this._storageService.getNumber(this._getTimestampStorageKey(),-1,0)!==this._timestamp)}))}get entries(){return this._ensureUpToDate(),this._entries.entries()}add(e,t){this._ensureUpToDate(),this._entries.set(e,t),this._saveState()}remove(e){this._ensureUpToDate(),this._entries.delete(e),this._saveState()}clear(){this._ensureUpToDate(),this._entries.clear(),this._saveState()}_ensureUpToDate(){this._isReady||(this._loadState(),this._isReady=!0),this._isStale&&(this._entries.clear(),this._loadState(),this._isStale=!1)}_loadState(){this._timestamp=this._storageService.getNumber(this._getTimestampStorageKey(),-1,0);let e=this._loadPersistedState();if(e)for(let t of e.entries)this._entries.set(t.key,t.value)}_loadPersistedState(){let e=this._storageService.get(this._getEntriesStorageKey(),-1);if(e===void 0||e.length===0)return;let t;try{t=JSON.parse(e)}catch{return}return t}_saveState(){let e={entries:[]};this._entries.forEach((t,o)=>e.entries.push({key:o,value:t})),this._storageService.store(this._getEntriesStorageKey(),JSON.stringify(e),-1,1),this._timestamp=Date.now(),this._storageService.store(this._getTimestampStorageKey(),this._timestamp,-1,1)}_getHistoryLimit(){let e=this._configurationService.getValue("terminal.integrated.shellIntegration.history");return Yo(e)?e:100}_getTimestampStorageKey(){return`terminal.history.timestamp.${this._storageDataKey}`}_getEntriesStorageKey(){return`terminal.history.entries.${this._storageDataKey}`}};mze=I([m(1,B),m(2,ce)],mze);var T8t=new Map;async function DDo(a,i){let e=T8t.get(i);if(e===null)return;if(e!==void 0)return e;let t;switch(i){case"bash":t=await Jgn(a);break;case"pwsh":t=await tfn(a);break;case"zsh":t=await Zgn(a);break;case"fish":t=await ifn(a);break;case"python":t=await efn(a);break;default:return}if(t===void 0){T8t.set(i,null);return}return T8t.set(i,t),t}function LDo(){T8t.clear()}async function Jgn(a){let i=a.get(fe),e=a.get(bo),t=await e.getEnvironment();if(t?.os===1||!t&&ei)return;let o="~/.bash_history",n=t?.userHome?.fsPath??$u.HOME,r=await _ct(n,".bash_history",!1,i,e);if(r===void 0)return;let s=r.content.split(`
`),l=new Set,c,u,p;for(let h=0;h<s.length;h++){c=s[h],u===void 0?u=c:u+=`
${c}`;for(let g=0;g<c.length;g++)p?c[g]===p&&(p=void 0):c[g].match(/['"]/)&&(p=c[g]);p===void 0&&(u.length>0&&l.add(u.trim()),u=void 0)}return{sourceLabel:o,sourceResource:r.resource,commands:Array.from(l.values())}}async function Zgn(a){let i=a.get(fe),e=a.get(bo),t=await e.getEnvironment();if(t?.os===1||!t&&ei)return;let o="~/.zsh_history",n=t?.userHome?.fsPath??$u.HOME,r=await _ct(n,".zsh_history",!1,i,e);if(r===void 0)return;let s=/^:\s\d+:\d+;/.test(r.content),l=r.content.split(s?/\:\s\d+\:\d+;/:/(?<!\\)\n/),c=new Set;for(let u=0;u<l.length;u++){let p=l[u].replace(/\\\n/g,`
`).trim();p.length>0&&c.add(p)}return{sourceLabel:o,sourceResource:r.resource,commands:Array.from(c.values())}}async function efn(a){let i=a.get(fe),e=a.get(bo),t=await e.getEnvironment(),o="~/.python_history",n=t?.userHome?.fsPath??$u.HOME,r=await _ct(n,".python_history",!1,i,e);if(r===void 0)return;let s=r.content.split(`
`),l=new Set;return s.forEach(c=>{c.trim().length>0&&l.add(c.trim())}),{sourceLabel:o,sourceResource:r.resource,commands:Array.from(l.values())}}async function tfn(a){let i=a.get(fe),e=a.get(bo),t,o,n=await e.getEnvironment(),r=n?.os===1||!n&&ei,s;r?(t=$u.APPDATA,o="Microsoft\\Windows\\PowerShell\\PSReadLine\\ConsoleHost_history.txt",s="$APPDATA\\Microsoft\\Windows\\PowerShell\\PSReadLine\\ConsoleHost_history.txt"):(t=n?.userHome?.fsPath??$u.HOME,o=".local/share/powershell/PSReadline/ConsoleHost_history.txt",s=`~/${o}`);let l=await _ct(t,o,r,i,e);if(l===void 0)return;let c=l.content.split(`
`),u=new Set,p,h,g;for(let f=0;f<c.length;f++){if(p=c[f],h===void 0?h=p:h+=`
${p}`,!p.endsWith("`")){let v=h.trim();v.length>0&&u.add(v),h=void 0;continue}for(let v=0;v<p.length;v++)g?p[v]===g&&(g=void 0):p[v].match(/`/)&&(g=p[v]);if(g)h=h.replace(/`$/,""),g=void 0;else{let v=h.trim();v.length>0&&u.add(v),h=void 0}}return{sourceLabel:s,sourceResource:l.resource,commands:Array.from(u.values())}}async function ifn(a){let i=a.get(fe),e=a.get(bo),t=await e.getEnvironment();if(t?.os===1||!t&&ei)return;let o=$u.XDG_DATA_HOME,n,r,s;o?(s="$XDG_DATA_HOME/fish/fish_history",n=$u.XDG_DATA_HOME,r="fish/fish_history"):(s="~/.local/share/fish/fish_history",n=t?.userHome?.fsPath??$u.HOME,r=".local/share/fish/fish_history");let l=await _ct(n,r,!1,i,e);if(l===void 0)return;let c=new Set,u=l.content.split(`
`).filter(p=>p.startsWith("- cmd:")).map(p=>p.substring(6).trimStart());for(let p=0;p<u.length;p++){let h=ofn(u[p]).trim();h.length>0&&c.add(h)}return{sourceLabel:s,sourceResource:l.resource,commands:Array.from(c.values())}}function ofn(a){return nfn(/(^|[^\\])((?:\\\\)*)(\\n)/g,a,`$1$2
`)}function nfn(a,i,e){let t,o=i;for(;;)if(t=o,o=o.replace(a,e),o===t)return o}async function _ct(a,i,e,t,o){if(!a)return;let n=o.getConnection(),r=!!n?.remoteAuthority,s=A.from({scheme:r?Q.vscodeRemote:Q.file,authority:r?n.remoteAuthority:void 0,path:A.file(Yc(a,i)).path}),l;try{l=await t.readFile(s)}catch(c){if(c instanceof ta&&c.fileOperationResult===1)return;throw c}if(l!==void 0)return{resource:s,content:l.value.toString()}}var PDo=q.asClassName(R.pin),bBi=q.asClassName(R.pinned),ADo=[PDo,bBi];function _8t(a,i,e,t){let o=e.items,n=RDo(i,e,a,void 0,t),r=new N;return r.add(e.onDidTriggerItemButton(async s=>{s.button.iconClass&&ADo.includes(s.button.iconClass)&&(e.items=o,n=RDo(i,e,a,s.item,t),e.items=e.value?o:n)})),r.add(e.onDidChangeValue(async s=>{e.items===n&&s?e.items=o:e.items===o&&!s&&(e.items=n)})),e.items=e.value?o:n,e.show(),r}function RDo(a,i,e,t,o){let n=[],r;t?r=sfn(a,t,e):r=NDo(a,e),r.length&&n.push({type:"separator",label:d(2321,null)});let s=new Set;for(let l of r){let c=i.items.find(u=>rfn(u,l));if(c){let u=Dct(c),p={...c};(!o||!s.has(u))&&(s.add(u),MDo(p,!1),n.push(p))}}for(let l of i.items)MDo(l,!0),n.push(l);return n}function Dct(a){return a.type==="separator"?"":a.id||`${a.label}${a.description}${a.detail}`}function MDo(a,i){if(a.type==="separator")return;let e=a.buttons?.filter(t=>t.iconClass&&!ADo.includes(t.iconClass))??[];e.unshift({iconClass:i?PDo:bBi,tooltip:i?d(2319,null):d(2320,null),alwaysVisible:!1}),a.buttons=e}function rfn(a,i){return Dct(a)===Dct(i)}function sfn(a,i,e){let t=i.buttons?.find(n=>n.iconClass===bBi),o=NDo(a,e);return t?o=o.filter(n=>Dct(n)!==Dct(i)):o.push(i),e.store(a,JSON.stringify(o.map(afn)),1,1),o}function NDo(a,i){let e=i.get(a,1);return e?JSON.parse(e):[]}function afn(a){return{label:a.label,description:a.description,detail:a.detail}}async function Lct(a,i,e,t,o,n){if(!i.xterm)return;let r=a.get(ou),s=a.get(ee),l=a.get(F),c=a.get(Ue),u=a.get(ce),p=a.get(An),h=`terminal.pinnedRecentCommands.${i.shellType}`,g,f=[],v=new Set,b={iconClass:q.asClassName(wbo),tooltip:d(15513,null)},S={iconClass:q.asClassName(Cbo),tooltip:d(15519,null),alwaysVisible:!1},y=[];if(t==="command"){let ae=function(Ce){return Ce.replace(/\r?\n/g,"\u23CE").replace(/\s\s\s+/g,"\u22EF")};g=Ze?d(15515,null):d(15514,null);let G=i.capabilities.get(2),$=G?.commands,J=G?.executingCommand;if(J&&v.add(J),$&&$.length>0)for(let Ce=$.length-1;Ce>=0;Ce--){let xe=$[Ce],ze=xe.command.trim();if(ze.length===0||v.has(ze))continue;let De=MEo(xe.cwd,i.userHome,i.os===1?"\\":"/");xe.exitCode&&(xe.exitCode===-1?De+=" failed":De+=` exitCode: ${xe.exitCode}`),De=De.trim();let Oe=[S],pt=f.length>0?f[f.length-1]:void 0;if(pt?.type!=="separator"&&pt?.label===ze){pt.id=xe.timestamp.toString(),pt.description=De;continue}f.push({label:ae(ze),rawLabel:ze,description:De,id:xe.timestamp.toString(),command:xe,buttons:xe.hasOutput()?Oe:void 0}),v.add(ze)}J&&f.unshift({label:ae(J),rawLabel:J,description:G.cwd}),f.length>0&&f.unshift({type:"separator",buttons:[],label:sr.currentSessionCategory});let he=l.invokeFunction(hze),oe=[];for(let[Ce,xe]of he.entries)!v.has(Ce)&&xe.shellType===i.shellType&&(oe.unshift({label:ae(Ce),rawLabel:Ce,buttons:[b]}),v.add(Ce));oe.length>0&&f.push({type:"separator",buttons:[],label:sr.previousSessionCategory},...oe);let de=await l.invokeFunction(DDo,i.shellType);if(de!==void 0){let Ce=[];for(let xe of de.commands)v.has(xe)||Ce.unshift({label:ae(xe),rawLabel:xe});if(Ce.length>0){let xe={iconClass:q.asClassName(kbo),tooltip:d(15512,null),alwaysVisible:!1,resource:de.sourceResource};y.push(xe),f.push({type:"separator",buttons:[xe],label:d(15518,null,i.shellType),description:de.sourceLabel},...Ce)}}}else{g=Ze?d(15517,null):d(15516,null);let G=i.os===1?Ax:ar,$=new En(oe=>G.getComparisonKey(oe)),J=i.capabilities.get(0)?.cwds||[];if(J&&J.length>0){for(let oe of J){let de=A.file(oe);$.has(de)||($.add(de),f.push({label:await i.getUriLabelForShell(de),rawLabel:oe}))}f=f.reverse(),f.unshift({type:"separator",label:sr.currentSessionCategory})}let ae=l.invokeFunction(Tct),he=[];for(let[oe,de]of ae.entries)if(de===null||de.remoteAuthority===i.remoteAuthority){let Ce=de?.remoteAuthority?await p.fileURI(oe):A.file(oe);$.has(Ce)||($.add(Ce),he.unshift({label:await i.getUriLabelForShell(Ce),rawLabel:oe,buttons:[b]}))}he.length>0&&f.push({type:"separator",label:sr.previousSessionCategory},...he)}if(f.length===0)return;let w=new N,k={iconClass:q.asClassName(xbo),tooltip:d(15511,null),toggle:{checked:o==="fuzzy"},location:3},T=w.add(l.createInstance(bre)),P=w.add(c.createQuickPick({useSeparators:!0})),O=f;P.items=[...O],P.sortByLabel=!1,P.placeholder=g,P.matchOnLabelMode=o||"contiguous",P.buttons=[k],w.add(P.onDidTriggerButton(G=>{G===k&&l.invokeFunction(Lct,i,e,t,k.toggle.checked?"fuzzy":"contiguous",P.value)})),w.add(P.onDidTriggerItemButton(async G=>{if(G.button===b)t==="command"?l.invokeFunction(hze)?.remove(G.item.label):l.invokeFunction(Tct)?.remove(G.item.rawLabel);else if(G.button===S){let $=G.item.command,J=$?.getOutput();if(J&&$?.command){let ae=await T.provideTextContent(A.from({scheme:bre.scheme,path:`${$.command}... ${ea($.timestamp,!0)}`,fragment:J,query:`terminal-output-${$.timestamp}-${i.instanceId}`}));ae&&await s.openEditor({resource:ae.uri})}}await l.invokeFunction(Lct,i,e,t,o,n)})),w.add(P.onDidTriggerSeparatorButton(async G=>{let $=y.find(J=>G.button===J)?.resource;$&&await s.openEditor({resource:$})})),w.add(P.onDidChangeValue(async G=>{G||await l.invokeFunction(Lct,i,e,t,o,G)}));let V=!1;function H(){V=!1,i.xterm?.markTracker.restoreScrollState(),i.xterm?.markTracker.clear()}return w.add(P.onDidChangeActive(async()=>{let G=i.xterm;if(!G)return;let[$]=P.activeItems;if(!$)return;function J(ae){return xi(ae)&&"rawLabel"in ae}if(J($)&&$.command&&$.command.marker){V||(G.markTracker.saveScrollState(),V=!0);let ae=$.command.getPromptRowCount(),he=$.command.getCommandRowCount();G.markTracker.revealRange({start:{x:1,y:$.command.marker.line-(ae-1)+1},end:{x:i.cols,y:$.command.marker.line+(he-1)+1}})}else H()})),w.add(P.onDidAccept(async()=>{let G=P.activeItems[0],$;t==="cwd"?$=`cd ${await i.preparePathForShell(G.rawLabel)}`:$=G.rawLabel,P.hide(),V=!1,i.xterm?.markTracker.clear(),i.scrollToBottom(),i.runCommand($,!P.keyMods.alt),P.keyMods.alt&&i.focus()})),w.add(P.onDidHide(()=>H())),n&&(P.value=n),new Promise(G=>{e.set(!0),w.add(_8t(u,h,P,!0)),w.add(P.onDidHide(()=>{e.set(!1),r.showLastProvider("terminal"),G(),w.dispose()}))})}var bre=class extends x{constructor(e,t){super();this._modelService=t;this._register(e.registerTextModelContentProvider(bre.scheme,this))}static{this.scheme="TERMINAL_OUTPUT"}async provideTextContent(e){let t=this._modelService.getModel(e);return t&&!t.isDisposed()?t:this._modelService.createModel(e.fragment,null,e,!1)}};bre=I([m(0,Bt),m(1,Tt)],bre);var Kq=class extends x{constructor(e,t,o){super();this._ctx=e;this._instantiationService=o;this._terminalInRunCommandPicker=dt.inTerminalRunCommandPicker.bindTo(t);let n=this._register(new Vt);this._register(e.instance.capabilities.onDidAddCapability(r=>{switch(n.deleteAndDispose(r.id),r.id){case 0:{let s=new N;s.add(r.capability.onDidChangeCwd(l=>{this._instantiationService.invokeFunction(Tct)?.add(l,{remoteAuthority:e.instance.remoteAuthority})})),n.set(r.id,s);break}case 2:{let s=new N;s.add(r.capability.onCommandFinished(l=>{l.command.trim().length>0&&this._instantiationService.invokeFunction(hze)?.add(l.command,{shellType:e.instance.shellType})})),n.set(r.id,s);break}}})),this._register(e.instance.capabilities.onDidRemoveCapability(r=>{n.deleteAndDispose(r.id)}))}static{this.ID="terminal.history"}static get(e){return e.getContribution(Kq.ID)}async runRecent(e,t,o){return this._instantiationService.invokeFunction(Lct,this._ctx.instance,this._terminalInRunCommandPicker,e,t,o)}};Kq=I([m(1,X),m(2,F)],Kq);Mp(Kq.ID,Kq);var SBi=C.or(dt.processSupported,dt.terminalHasBeenCreated);Er({id:"workbench.action.terminal.clearPreviousSessionHistory",title:L(15508,"Clear Previous Session History"),precondition:SBi,run:async(a,i)=>{hze(i).clear(),LDo()}});Jl({id:"workbench.action.terminal.goToRecentDirectory",title:L(15509,"Go to Recent Directory..."),metadata:{description:L(15507,"Goes to a recent folder")},precondition:SBi,keybinding:{primary:2085,when:dt.focus,weight:200},menu:[{id:D.ViewTitle,group:"shellIntegration",order:0,when:C.equals("view",Sc),isHiddenByDefault:!0},...[D.EditorTitle,D.CompactWindowEditorTitle].map(a=>({id:a,group:"1_shellIntegration",order:0,when:Wo.Scheme.isEqualTo(Q.vscodeTerminal),isHiddenByDefault:!0}))],run:async(a,i)=>{let e=Kq.get(a);e&&(await e.runRecent("cwd"),a?.target===2?await i.editorService.revealActiveEditor():await i.groupService.showPanel(!1))}});Er({id:"workbench.action.terminal.runRecentCommand",title:L(15510,"Run Recent Command..."),precondition:SBi,keybinding:[{primary:2096,when:C.and($a,C.or(dt.focus,C.and(Dd,cu.isEqualTo("terminal")))),weight:200},{primary:2608,mac:{primary:816},when:C.and(dt.focus,$a.negate()),weight:200}],menu:[{id:D.ViewTitle,group:"shellIntegration",order:1,when:C.equals("view",Sc),isHiddenByDefault:!0},...[D.EditorTitle,D.CompactWindowEditorTitle].map(a=>({id:a,group:"1_shellIntegration",order:1,when:Wo.Scheme.isEqualTo(Q.vscodeTerminal),isHiddenByDefault:!0}))],run:async(a,i)=>{let e=a.service.activeInstance;if(!e){let o=e=await a.service.getActiveOrCreateInstance();await a.service.revealActiveTerminal();let n=new N,r=await new Promise(s=>{n.add(o.onDidChangeShellType(()=>s(!1))),n.add(o.onDisposed(()=>s(!0)))});if(n.dispose(),r)return}let t=Kq.get(e);t&&(await t.runRecent("command"),e?.target===2?await a.editorService.revealActiveEditor():await a.groupService.showPanel(!1))}});var Sre=_,IBi=class extends x{constructor(e,t){super();this._capabilities=e;this._onDidChangeAgents=t;this._onDidRequestCreateHint=this._register(new E);this._disposables=this._register(new me)}get onDidRequestCreateHint(){return this._onDidRequestCreateHint.event}activate(e){let t=this._register(new N);this._disposables.value=t;let o=this._capabilities.get(2);o?t.add(U.once(o.promptInputModel.onDidStartInput)(()=>this._onDidRequestCreateHint.fire())):this._register(this._capabilities.onDidAddCapability(r=>{if(r.id===2){let s=r.capability;t.add(U.once(s.promptInputModel.onDidStartInput)(()=>this._onDidRequestCreateHint.fire())),s.promptInputModel.value||this._onDidRequestCreateHint.fire()}}));let n=this._onDidChangeAgents(r=>{r?.locations.includes("terminal")&&(this._onDidRequestCreateHint.fire(),n.dispose())});this._disposables.value?.add(n)}},Ire=class extends x{constructor(e,t,o,n,r){super();this._ctx=e;this._chatAgentService=t;this._configurationService=o;this._instantiationService=n;this._terminalConfigurationService=r;this._decoration=this._register(new me);this._cursorMoveListener=this._register(new me)}static{this.ID="terminal.initialHint"}static get(e){return e.getContribution(Ire.ID)}xtermOpen(e){No(this._ctx.instance,{shellLaunchConfig:!0})&&(this._ctx.instance.shellLaunchConfig.isExtensionOwnedTerminal||this._ctx.instance.shellLaunchConfig.isFeatureTerminal||this._ctx.instance.shellLaunchConfig.hideFromUser)||this._configurationService.getValue("terminal.integrated.initialHint")&&(this._terminalConfigurationService.config.sendKeybindingsToShell||(this._xterm=e,this._addon=this._register(this._instantiationService.createInstance(IBi,this._ctx.instance.capabilities,this._chatAgentService.onDidChangeAgents)),this._xterm.raw.loadAddon(this._addon),this._register(this._addon.onDidRequestCreateHint(()=>this._createHint()))))}_disposeHint(){this._hintWidget?.remove(),this._hintWidget=void 0,this._decoration.clear()}_createHint(){let e=this._ctx.instance instanceof dv?this._ctx.instance:void 0,t=e?.capabilities.get(2);if(!e||!this._xterm||this._hintWidget||!t||t.promptInputModel.value||e.shellLaunchConfig.attachPersistentProcess||t.commands.length>0||!this._configurationService.getValue("terminal.integrated.initialHint"))return;if(!this._decoration.value){let n=this._xterm.raw.registerMarker();if(!n||this._xterm.raw.buffer.active.cursorX===0)return;this._register(n),this._decoration.value=this._xterm.raw.registerDecoration({marker:n,x:this._xterm.raw.buffer.active.cursorX+1})}this._register(this._xterm.raw.onKey(()=>this.dispose())),this._register(this._configurationService.onDidChangeConfiguration(n=>{n.affectsConfiguration("terminal.integrated.initialHint")&&!this._configurationService.getValue("terminal.integrated.initialHint")&&this.dispose()}));let o=t.promptInputModel;o&&this._register(o.onDidChangeInput(()=>{o.value&&this.dispose()})),this._cursorMoveListener.value=this._xterm.raw.onCursorMove(()=>{o?.value||(this._disposeHint(),this._createHint())}),this._decoration.value&&this._register(this._decoration.value.onRender(n=>{if(!this._hintWidget&&this._xterm?.isFocused){let r=this._register(this._instantiationService.createInstance(Rct,e));if(this._addon?.dispose(),this._hintWidget=r.getDomNode(),!this._hintWidget)return;n.appendChild(this._hintWidget),n.classList.add("terminal-initial-hint");let s=this._xterm.getFont();s&&(n.style.fontFamily=s.fontFamily,n.style.fontSize=s.fontSize+"px")}if(this._hintWidget&&this._xterm){let r=this._hintWidget.parentElement;r&&(r.style.width=(this._xterm.raw.cols-this._xterm.raw.buffer.active.cursorX)/this._xterm.raw.cols*100+"%")}}))}};Ire=I([m(1,cr),m(2,B),m(3,F),m(4,Uu)],Ire);Mp(Ire.ID,Ire,!1);var Rct=class extends x{constructor(e,t,o,n,r,s,l,c){super();this._instance=e;this._chatAgentService=t;this._chatEntitlementService=o;this._commandService=n;this._configurationService=r;this._contextMenuService=s;this._keybindingService=l;this._telemetryService=c;this._toDispose=this._register(new N);this._isVisible=!1;this._ariaLabel="";this._toDispose.add(e.onDidFocus(()=>{this._instance.hasFocus&&this._isVisible&&this._ariaLabel&&this._configurationService.getValue("accessibility.verbosity.terminalChat")&&qr(this._ariaLabel)})),this._toDispose.add(this._configurationService.onDidChangeConfiguration(u=>{u.affectsConfiguration("terminal.integrated.initialHint")&&!this._configurationService.getValue("terminal.integrated.initialHint")&&this.dispose()}))}_createWrappedHintElements(e,t,o){let[n,r]=e.split(t),s=Sre("a",void 0,n);this._toDispose.add(j(s,re.CLICK,o));let l=Sre("span.terminal-initial-hint-prose",void 0),c=Sre("a",void 0,r);return this._toDispose.add(j(c,re.CLICK,o)),l.appendChild(c),{before:s,after:l}}_getHintInlineChat(){let e=[],t=()=>{this._telemetryService.publicLog2("workbenchActionExecuted",{id:"terminalInlineChat.hintAction",from:"hint"}),this._commandService.executeCommand("workbench.action.terminal.chat.start",{from:"hint"})},o=()=>{this._configurationService.updateValue("terminal.integrated.initialHint",!1)},n={disposables:this._toDispose,callback:(b,S)=>{b==="0"&&t()}},r={disposables:this._toDispose,callback:(b,S)=>{b==="0"&&o()}},s=Sre("div.terminal-initial-hint");if(s.style.display="block",!this._chatEntitlementService.sentiment.hidden){let b=this._keybindingService.lookupKeybinding("workbench.action.terminal.chat.start"),S=b?.getLabel();if(b&&S){if(this._chatAgentService.getActivatedAgents().filter(w=>w.locations.includes("terminal"))?.length){let w=d(15523,null,S),{before:k,after:T}=this._createWrappedHintElements(w,S,t);s.appendChild(k);let P=n.disposables.add(new Am(s,Po));P.set(b),P.element.style.width="min-content",P.element.style.display="inline",P.element.style.cursor="pointer",this._toDispose.add(j(P.element,re.CLICK,t)),s.appendChild(T),s.appendChild(Sre("span.terminal-initial-hint-separator")),e.push(w)}}else{let y=d(15528,null),w=zE(y,{actionHandler:n});s.appendChild(w),e.push(d(15529,null))}}let c=this._configurationService.getValue("terminal.integrated.suggest.enabled")?this._keybindingService.lookupKeybinding("workbench.action.terminal.triggerSuggest"):void 0,u=c?.getLabel();if(c&&u){let b=d(15530,null,u),S=()=>{this._commandService.executeCommand("workbench.action.terminal.triggerSuggest")},{before:y,after:w}=this._createWrappedHintElements(b,u,S);s.appendChild(y);let k=n.disposables.add(new Am(s,Po));k.set(c),k.element.style.width="min-content",k.element.style.display="inline",k.element.style.cursor="pointer",this._toDispose.add(j(k.element,re.CLICK,S)),s.appendChild(w),s.appendChild(Sre("span.terminal-initial-hint-separator")),e.push(b)}if(e.length===0)return;let p=d(15524,null),h=zE(p,{actionHandler:r});h.classList.add("detail","terminal-initial-hint-prose");let g=Sre("span.terminal-initial-hint-prose",void 0,d(15527,null));s.appendChild(g),s.appendChild(h);let f=d(15526,null),v=zE(f,{actionHandler:r});return v.classList.add("detail","terminal-initial-hint-compact"),s.appendChild(v),e.push(d(15525,null)),{ariaLabel:e.join(" "),hintHandler:n,hintElement:s}}getDomNode(){if(!this._domNode){let e=this._getHintInlineChat();if(!e)return;let{hintElement:t,ariaLabel:o}=e;this._domNode=Sre(".terminal-initial-hint"),this._domNode.style.paddingLeft="4px",this._domNode.append(t),this._ariaLabel=o.concat(d(15521,null,"accessibility.verbosity.terminalChat")),this._toDispose.add(j(this._domNode,"click",()=>{this._domNode?.remove(),this._domNode=void 0})),this._toDispose.add(j(this._domNode,re.CONTEXT_MENU,n=>{this._contextMenuService.showContextMenu({getAnchor:()=>new Cn(Ki(),n),getActions:()=>[{id:"workench.action.disableTerminalInitialHint",label:d(15522,null),tooltip:d(15522,null),enabled:!0,class:void 0,run:()=>this._configurationService.updateValue("terminal.integrated.initialHint",!1)}]})}))}return this._domNode}dispose(){this._domNode?.remove(),super.dispose()}};Rct=I([m(1,cr),m(2,rr),m(3,ge),m(4,B),m(5,Xe),m(6,_e),m(7,Te)],Rct);function XW(a,i,e,t){let o={start:{x:e.startColumn,y:e.startLineNumber+t},end:{x:e.endColumn-1,y:e.endLineNumber+t}},n=0,r=Math.ceil(e.startColumn/i);for(let c=0;c<Math.min(r);c++){let u=Math.min(i,e.startColumn-1-c*i),p=0,h=a[c];if(!h)break;for(let g=0;g<Math.min(i,u+p);g++){let f=h.getCell(g);if(!f)break;f.getWidth()===2&&p++;let b=f.getChars();b.length>1&&(p-=b.length-1)}n+=p}let s=0,l=Math.ceil(e.endColumn/i);for(let c=Math.max(0,r-1);c<l;c++){let u=c===r-1?(e.startColumn-1+n)%i:0,p=Math.min(i,e.endColumn+n-c*i),h=0,g=a[c];if(!g)break;for(let f=u;f<Math.min(i,p+h);f++){let v=g.getCell(f);if(!v)break;let b=v.getWidth(),S=v.getChars();b===2&&h++,f===i-1&&S===""&&h++,S.length>1&&(h-=S.length-1)}s+=h}for(o.start.x+=n,o.end.x+=n+s;o.start.x>i;)o.start.x-=i,o.start.y++;for(;o.end.x>i;)o.end.x-=i,o.end.y++;return o}function D8t(a,i){return{start:{x:a.start.x-1,y:a.start.y-i-1},end:{x:a.end.x-1,y:a.end.y-i-1}}}function JW(a,i,e,t){let o=Math.max(2048,t*2);e=Math.min(e,i+o);let n="";for(let r=i;r<=e;r++){let s=a.getLine(r);s&&(n+=s.translateToString(!0,0,t))}return n}function ODo(a,i,e,t){let o,n=-1,r=-1,s=[];for(let l=i;l<=e;l++){let c=a.getLine(l);if(c)for(let u=0;u<t;u++){let p=c.getCell(u);if(!p)break;let h=p.isBold()|p.isInverse()|p.isStrikethrough()|p.isUnderline(),g=p.isDim()|p.isItalic();if(n===-1||r===-1)o={x:u,y:l};else if(n!==h||r!==g){let f={x:u,y:l};s.push({start:o,end:f}),o={x:u,y:l}}n=h,r=g}}return s}function L8t(a,i,e,t,o){let n=a.get(2)?.getCwdForLine(i);if(o.trace("terminalLinkHelpers#updateLinkWithRelativeCwd cwd",n),!n)return;let r=[],s=t.sep;if(!e.includes(s))r.push(t.resolve(n+s+e));else{let l=0,c=0,u=n.split(s).reverse(),p=e.split(s);for(;c<u.length&&(r.push(t.resolve(n+s+p.slice(l).join(s))),u[c]===p[c]);){l++;c++}}return r}function Mct(a){return a===1?$s:Oo}var R8t=class{constructor(i,e,t){this.id=i;this.xterm=e;this._provideLinks=t;this.maxLinkLength=2e3}async detect(i,e,t){let o=JW(this.xterm.buffer.active,e,t,this.xterm.cols);if(o===""||o.length>this.maxLinkLength)return[];let n=await this._provideLinks(o);return n?n.map(s=>{let l=XW(i,this.xterm.cols,{startColumn:s.startIndex+1,startLineNumber:1,endColumn:s.startIndex+s.length+1,endLineNumber:1},e);return{text:o.substring(s.startIndex,s.startIndex+s.length)||"",label:s.label,bufferRange:l,type:{id:this.id},activate:s.activate}}):[]}};var gze=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this._xterm=e;this.range=t;this.text=o;this.uri=n;this.parsedLink=r;this.actions=s;this._viewportY=l;this._activateCallback=c;this._tooltipCallback=u;this._isHighConfidenceLink=p;this.label=h;this._type=g;this._configurationService=f;this._tooltipScheduler=this._register(new me);this._hoverListeners=this._register(new me);this._onInvalidated=this._register(new E);this.decorations={pointerCursor:!1,underline:this._isHighConfidenceLink}}get onInvalidated(){return this._onInvalidated.event}get type(){return this._type}activate(e,t){this._activateCallback(e,t)}hover(e,t){let o=Re(e),n=o.document,r=this._hoverListeners.value=new N;r.add(j(n,"keydown",l=>{!l.repeat&&this._isModifierDown(l)&&this._enableDecorations()})),r.add(j(n,"keyup",l=>{!l.repeat&&!this._isModifierDown(l)&&this._disableDecorations()})),r.add(this._xterm.onRender(l=>{let c=this.range.start.y-this._viewportY;c>=l.start&&c<=l.end&&this._onInvalidated.fire()})),this._isHighConfidenceLink&&(this._tooltipScheduler.value=new Dt(()=>{this._tooltipCallback(this,D8t(this.range,this._viewportY),this._isHighConfidenceLink?()=>this._enableDecorations():void 0,this._isHighConfidenceLink?()=>this._disableDecorations():void 0),this._tooltipScheduler.clear()},this._configurationService.getValue("workbench.hover.delay")),this._tooltipScheduler.value.schedule());let s={x:e.pageX,y:e.pageY};r.add(j(n,re.MOUSE_MOVE,l=>{this._isModifierDown(l)?this._enableDecorations():this._disableDecorations(),(Math.abs(l.pageX-s.x)>o.devicePixelRatio*2||Math.abs(l.pageY-s.y)>o.devicePixelRatio*2)&&(s.x=l.pageX,s.y=l.pageY,this._tooltipScheduler.value?.schedule())}))}leave(){this._hoverListeners.clear(),this._tooltipScheduler.clear()}_enableDecorations(){this.decorations.pointerCursor||(this.decorations.pointerCursor=!0),this.decorations.underline||(this.decorations.underline=!0)}_disableDecorations(){this.decorations.pointerCursor&&(this.decorations.pointerCursor=!1),this.decorations.underline!==this._isHighConfidenceLink&&(this.decorations.underline=this._isHighConfidenceLink)}_isModifierDown(e){return this._configurationService.getValue("editor.multiCursorModifier")==="ctrlCmd"?!!e.altKey:Ze?e.metaKey:e.ctrlKey}};gze=I([m(12,B)],gze);var fze=class extends x{constructor(e,t){super();this._detector=e;this._instantiationService=t;this._activeLinksStore=this._register(new N);this._onDidActivateLink=this._register(new E);this.onDidActivateLink=this._onDidActivateLink.event;this._onDidShowHover=this._register(new E);this.onDidShowHover=this._onDidShowHover.event;this._activeProvideLinkRequests=new Map}async provideLinks(e,t){let o=this._activeProvideLinkRequests.get(e);if(o){let r=await o;t(r);return}this._activeLinksStore.clear(),o=this._provideLinks(e),this._activeProvideLinkRequests.set(e,o);let n=await o;this._activeProvideLinkRequests.delete(e),t(n)}async _provideLinks(e){let t=[],o=e-1,n=o,r=[this._detector.xterm.buffer.active.getLine(o)],s=Math.max(this._detector.maxLinkLength,this._detector.xterm.cols),l=Math.ceil(s/this._detector.xterm.cols),c=Math.max(o-l,0),u=Math.min(n+l,this._detector.xterm.buffer.active.length);for(;o>=c&&this._detector.xterm.buffer.active.getLine(o)?.isWrapped;)r.unshift(this._detector.xterm.buffer.active.getLine(o-1)),o--;for(;n<u&&this._detector.xterm.buffer.active.getLine(n+1)?.isWrapped;)r.push(this._detector.xterm.buffer.active.getLine(n+1)),n++;let p=await this._detector.detect(r,o,n);for(let h of p){let g=this._createTerminalLink(h,async f=>this._onDidActivateLink.fire({link:h,event:f}));t.push(g),this._activeLinksStore.add(g)}return t}_createTerminalLink(e,t){return!e.disableTrimColon&&e.text.length>0&&e.text.charAt(e.text.length-1)===":"&&(e.text=e.text.slice(0,-1),e.bufferRange.end.x--),this._instantiationService.createInstance(gze,this._detector.xterm,e.bufferRange,e.text,e.uri,e.parsedLink,e.actions,this._detector.xterm.buffer.active.viewportY,t,(o,n,r,s)=>this._onDidShowHover.fire({link:o,viewportRange:n,modifierDownCallback:r,modifierUpCallback:s}),e.type!=="Search",e.label||this._getLabel(e.type),e.type)}_getLabel(e){switch(e){case"Search":return d(15540,null);case"LocalFile":return d(15538,null);case"LocalFolderInWorkspace":return d(15536,null);case"LocalFolderOutsideWorkspace":return d(15539,null);case"Url":default:return d(15537,null)}}};fze=I([m(1,F)],fze);var lfn=new co(()=>WDo(!0)),FDo=new co(()=>WDo(!1));function WDo(a){let i=0,e=0,t=0,o=0;function n(){return`(?<row${i++}>\\d+)`}function r(){return`(?<col${e++}>\\d+)`}function s(){return`(?<rowEnd${t++}>\\d+)`}function l(){return`(?<colEnd${o++}>\\d+)`}let c=a?"$":"",p=[`(?::|#| |['"],|, )${n()}([:.]${r()}(?:-(?:${s()}\\.)?${l()})?)?`+c,`['"]?(?:,? |: ?| on )lines? ${n()}(?:-${s()})?(?:,? (?:col(?:umn)?|characters?) ${r()}(?:-${l()})?)?`+c,`:? ?[\\[\\(]${n()}(?:(?:, ?|:)${r()})?[\\]\\)]`+c].join("|").replace(/ /g,"[\xA0 ]");return new RegExp(`(${p})`,a?void 0:"g")}function VDo(a){let i=Pct(a)?.suffix;return i?a.substring(0,i.index):a}function BDo(a){let i=a.startsWith("\\\\?\\")?4:0,e=a.indexOf("?",i);return e===-1?a:a.substring(0,e)}function cfn(a){let i,e=[];for(FDo.value.lastIndex=0;(i=FDo.value.exec(a))!==null;){let t=HDo(i);if(t===null)break;e.push(t)}return e}function Pct(a){return HDo(lfn.value.exec(a))}function HDo(a){let i=a?.groups;return!i||a.length<1?null:{row:M8t(i.row0||i.row1||i.row2),col:M8t(i.col0||i.col1||i.col2),rowEnd:M8t(i.rowEnd0||i.rowEnd1||i.rowEnd2),colEnd:M8t(i.colEnd0||i.colEnd1||i.colEnd2),suffix:{index:a.index,text:a[0]}}}function M8t(a){return a===void 0?a:parseInt(a)}var dfn=/(?<path>(?:file:\/\/\/)?[^\s\|<>\[\({][^\s\|<>]*)$/;function P8t(a,i){let e=pfn(a),t=gfn(a,i);return ufn(e,t),e}function ufn(a,i){a.length===0&&a.push(...i);for(let e of i)yBi(a,e,0,a.length)}function yBi(a,i,e,t){if(a.length===0){a.push(i);return}if(e>t)return;let o=Math.floor((e+t)/2);if(o>=a.length||i.path.index<a[o].path.index&&(o===0||i.path.index>a[o-1].path.index)){(o>=a.length||i.path.index+i.path.text.length<a[o].path.index&&(o===0||i.path.index>a[o-1].path.index+a[o-1].path.text.length))&&a.splice(o,0,i);return}i.path.index>a[o].path.index?yBi(a,i,o+1,t):yBi(a,i,e,o-1)}function pfn(a){let i=[],e=cfn(a);for(let t of e){let n=a.substring(0,t.suffix.index).match(dfn);if(n&&n.index!==void 0&&n.groups?.path){let r=n.index,s=n.groups.path,l,c=s.match(/^(?<prefix>['"]+)/);if(c?.groups?.prefix){if(l={index:r,text:c.groups.prefix},s=s.substring(l.text.length),s.trim().length===0)continue;if(c.groups.prefix.length>1&&t.suffix.text[0].match(/['"]/)&&c.groups.prefix[c.groups.prefix.length-1]===t.suffix.text[0]){let p=c.groups.prefix.length-1;l.index+=p,l.text=c.groups.prefix[c.groups.prefix.length-1],r+=p}}i.push({path:{index:r+(l?.text.length||0),text:s},prefix:l,suffix:t});let u=s.matchAll(/(?<bracket>[\[\(])(?![\]\)])/g);for(let p of u){let h=p.groups?.bracket;h&&i.push({path:{index:r+(l?.text.length||0)+p.index+1,text:s.substring(p.index+h.length)},prefix:l,suffix:t})}}}return i}var mfn="(?:(?:(?:\\.\\.?|\\~|file://)|(?:[^\\0<>\\?\\s!`&*()\\[\\]'\":;\\\\][^\\0<>\\?\\s!`&*()'\":;\\\\]*))?(?:\\/(?:[^\\0<>\\?\\s!`&*()'\":;\\\\])+)+)",wBi="(?:\\\\\\\\\\?\\\\|file:\\/\\/\\/)?[a-zA-Z]:",hfn=`(?:(?:(?:${wBi}|\\.\\.?|\\~)|(?:[^\\0<>\\?\\|\\/\\s!\`&*()\\[\\]'":;][^\\0<>\\?\\|\\/\\s!\`&*()'":;]*))?(?:(?:\\\\|\\/)(?:[^\\0<>\\?\\|\\/\\s!\`&*()'":;])+)+)`;function gfn(a,i){let e=[],t=new RegExp(i===1?hfn:mfn,"g"),o;for(;(o=t.exec(a))!==null;){let n=o[0],r=o.index;if(!n)break;((a.startsWith("--- a/")||a.startsWith("+++ b/"))&&r===4||a.startsWith("diff --git")&&(n.startsWith("a/")||n.startsWith("b/")))&&(n=n.substring(2),r+=2),e.push({path:{index:r,text:n},prefix:void 0,suffix:void 0})}return e}var ffn=[/^ *File (?<link>"(?<path>.+)"(, line (?<line>\d+))?)/,/^ +FILE +(?<link>(?<path>.+)(?::(?<line>\d+)(?::(?<col>\d+))?)?)/,/^(?<link>(?<path>.+)\((?<line>\d+)(?:, ?(?<col>\d+))?\)) ?:/,/^(?<link>(?<path>.+):(?<line>\d+)(?::(?<col>\d+))?) ?:/,/^(?:PS\s+)?(?<link>(?<path>[^>]+))>/,/^ *(?<link>(?<path>.+))/],F6=class{constructor(i,e,t,o,n,r,s){this.xterm=i;this._capabilities=e;this._processManager=t;this._linkResolver=o;this._logService=n;this._uriIdentityService=r;this._workspaceContextService=s;this.maxLinkLength=500}static{this.id="local"}async detect(i,e,t){let o=[],n=JW(this.xterm.buffer.active,e,t,this.xterm.cols);if(n===""||n.length>2e3)return[];let r=-1,s=0,l=this._processManager.os||Po,c=P8t(n,l);this._logService.trace("terminalLocalLinkDetector#detect text",n),this._logService.trace("terminalLocalLinkDetector#detect parsedLinks",c);for(let u of c){if(u.path.text.length>1024)continue;let p=XW(i,this.xterm.cols,{startColumn:(u.prefix?.index??u.path.index)+1,startLineNumber:1,endColumn:u.path.index+u.path.text.length+(u.suffix?.suffix.text.length??0)+1,endLineNumber:1},e),h=[],g=Mct(l),f=u.path.text.startsWith("file://");if(g.isAbsolute(u.path.text)||u.path.text.startsWith("~")||f)h.push(u.path.text);else{if(this._capabilities.has(2)){let w=L8t(this._capabilities,p.start.y,u.path.text,g,this._logService);w&&h.push(...w)}h.length===0&&(h.push(u.path.text),u.path.text.match(/^(\.\.[\/\\])+/)&&h.push(u.path.text.replace(/^(\.\.[\/\\])+/,"")))}let v=/[\[\]"'\.]$/,b=new Map,S=[];for(let w of h){let k=w,T=k.replace(v,""),P=0;for(;T!==k;)u.suffix||P++,S.push(T),b.set(T,P),k=T,T=T.replace(v,"")}h.push(...S),this._logService.trace("terminalLocalLinkDetector#detect linkCandidates",h);let y=await this._validateAndGetLink(void 0,p,h,b);if(y&&(y.parsedLink=u,y.text=n.substring(u.prefix?.index??u.path.index,u.suffix?u.suffix.suffix.index+u.suffix.suffix.text.length:u.path.index+u.path.text.length),this._logService.trace("terminalLocalLinkDetector#detect verified link",y),o.push(y)),++s>=10)break}if(o.length===0)for(let u of ffn){let h=n.match(u)?.groups;if(!h)continue;let g=h?.link,f=h?.path,v=h?.line,b=h?.col;if(!g||!f||g.length>1024)continue;r=n.indexOf(g);let S=XW(i,this.xterm.cols,{startColumn:r+1,startLineNumber:1,endColumn:r+g.length+1,endLineNumber:1},e),y=v?`:${v}${b?`:${b}`:""}`:"",w=await this._validateAndGetLink(`${f}${y}`,S,[f]);w&&o.push(w)}if(o.length===0){let u=ODo(this.xterm.buffer.active,e,t,this.xterm.cols);for(let p of u){let h="";for(let f=p.start.y;f<=p.end.y;f++){let v=this.xterm.buffer.active.getLine(f);if(!v)break;let b=f===p.start.y?p.start.x:0,S=f===p.end.y?p.end.x:this.xterm.cols-1;h+=v.translateToString(!1,b,S)}p.start.x++,p.start.y++,p.end.y++;let g=await this._validateAndGetLink(h,p,[h]);if(g&&o.push(g),++s>=10)break}}return o}async _validateLinkCandidates(i){for(let e of i){let t;e.startsWith("file://")&&(t=A.parse(e));let o=await this._linkResolver.resolveLink(this._processManager,e,t);if(o)return o}}async _validateAndGetLink(i,e,t,o){let n=await this._validateLinkCandidates(t);if(n){let r=yre(n.uri,n.isDirectory,this._uriIdentityService,this._workspaceContextService),s=o?.get(n.link);return s&&(e.end.x-=s,e.end.x<0&&(e.end.y--,e.end.x+=this.xterm.cols)),{text:i??n.link,uri:n.uri,bufferRange:e,type:r}}}};F6=I([m(4,ca),m(5,ht),m(6,Pe)],F6);function yre(a,i,e,t){if(i){let o=t.getWorkspace().folders;for(let n=0;n<o.length;n++)if(e.extUri.isEqualOrParent(a,o[n].uri))return"LocalFolderInWorkspace";return"LocalFolderOutsideWorkspace"}else return"LocalFile"}var bze=class{constructor(i){this._editorService=i}async open(i){if(!i.uri)throw new Error("Tried to open file link without a resolved URI");let e=i.parsedLink?i.parsedLink.suffix:Pct(i.text),t=i.selection;t||(t=e?.row===void 0?void 0:{startLineNumber:e.row??1,startColumn:e.col??1,endLineNumber:e.rowEnd,endColumn:e.colEnd}),await this._editorService.openEditor({resource:i.uri,options:{pinned:!0,selection:t,revealIfOpened:!0}})}};bze=I([m(0,ee)],bze);var Sze=class{constructor(i){this._commandService=i}async open(i){if(!i.uri)throw new Error("Tried to open folder in workspace link without a resolved URI");await this._commandService.executeCommand("revealInExplorer",i.uri)}};Sze=I([m(0,ge)],Sze);var Ize=class{constructor(i){this._hostService=i}async open(i){if(!i.uri)throw new Error("Tried to open folder in workspace link without a resolved URI");this._hostService.openWindow([{folderUri:i.uri}],{forceNewWindow:!0})}};Ize=I([m(0,Zt)],Ize);var yze=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h){this._capabilities=i;this._initialCwd=e;this._localFileOpener=t;this._localFolderInWorkspaceOpener=o;this._getOS=n;this._fileService=r;this._quickInputService=l;this._searchService=c;this._logService=u;this._workbenchEnvironmentService=p;this._workspaceContextService=h;this._fileQueryBuilder=s.createInstance(kS)}async open(i){let e=Mct(this._getOS()),t=e.sep,o=i.text.replace(/^file:\/\/\/?/,"");if(o=e.normalize(o).replace(/^(\.+[\\/])+/,""),i.contextLine&&!/:\d{2}:\d{2}[+-]\d{2}:\d{2}\.[a-z]+/.test(i.text)){let l=P8t(i.contextLine,this._getOS()).find(c=>c.suffix&&i.text.startsWith(c.path.text));l&&l.suffix?.row!==void 0&&(o=l.path.text,o+=`:${l.suffix.row}`,l.suffix?.col!==void 0&&(o+=`:${l.suffix.col}`))}o=o.replace(/:[^\\/\d][^\d]*$/,""),o=o.replace(/\.$/,""),this._workspaceContextService.getWorkspace().folders.forEach(r=>{if(o.substring(0,r.name.length+1)===r.name+t){o=o.substring(r.name.length+1);return}});let n=o;if(this._capabilities.has(2)&&(n=L8t(this._capabilities,i.bufferRange.start.y,o,e,this._logService)?.[0]||o),!await this._tryOpenExactLink(n,i)&&!(o!==n&&await this._tryOpenExactLink(o,i)))return this._quickInputService.quickAccess.show(o)}async _getExactMatch(i){let e=this._getOS(),t=Mct(e),o=t.isAbsolute(i),n=o?i:void 0;!o&&this._initialCwd.length>0&&(n=t.join(this._initialCwd,i));let r;if(n){let s=n;e===1&&(s=n.replace(/\\/g,"/"),s.match(/[a-z]:/i)&&(s=`/${s}`));let l;this._workbenchEnvironmentService.remoteAuthority?l=A.from({scheme:Q.vscodeRemote,authority:this._workbenchEnvironmentService.remoteAuthority,path:s}):l=A.file(s);try{let c=await this._fileService.stat(l);r={uri:l,isDirectory:c.isDirectory}}catch{}}if(!r){let s=await this._searchService.fileSearch(this._fileQueryBuilder.file(this._workspaceContextService.getWorkspace().folders,{filePattern:i,maxResults:2}));if(s.results.length>0){if(s.results.length===1)r={uri:s.results[0].resource};else if(!o){let c=(await this._searchService.fileSearch(this._fileQueryBuilder.file(this._workspaceContextService.getWorkspace().folders,{filePattern:`**/${i}`}))).results.filter(u=>u.resource.toString().endsWith(i));c.length===1&&(r={uri:c[0].resource})}}}return r}async _tryOpenExactLink(i,e){let t=i.replace(/:\d+(:\d+)?$/,"");try{let o=await this._getExactMatch(t);if(o){let{uri:n,isDirectory:r}=o,s={text:o.uri.path+(i.match(/:\d+(:\d+)?$/)?.[0]||""),uri:n,bufferRange:e.bufferRange,type:e.type};if(n)return await(r?this._localFolderInWorkspaceOpener.open(s):this._localFileOpener.open(s)),!0}}catch{return!1}return!1}};yze=I([m(5,fe),m(6,F),m(7,Ue),m(8,gg),m(9,ca),m(10,At),m(11,Pe)],yze);var wze=class{constructor(i,e,t,o,n,r,s,l,c,u){this._isRemote=i;this._localFileOpener=e;this._localFolderInWorkspaceOpener=t;this._localFolderOutsideWorkspaceOpener=o;this._openerService=n;this._configurationService=r;this._fileService=s;this._uriIdentityService=l;this._workspaceContextService=c;this._logService=u}async open(i){if(!i.uri)throw new Error("Tried to open a url without a resolved URI");if(i.uri.scheme===Q.file)return this._openFileSchemeLink(i);this._openerService.open(i.text,{allowTunneling:this._isRemote&&this._configurationService.getValue("remote.forwardOnOpen"),allowContributedOpeners:!0,openExternal:!0})}async _openFileSchemeLink(i){if(i.uri){try{let t=(await this._fileService.stat(i.uri)).isDirectory;switch(yre(i.uri,t,this._uriIdentityService,this._workspaceContextService)){case"LocalFile":await this._localFileOpener.open(i);return;case"LocalFolderInWorkspace":await this._localFolderInWorkspaceOpener.open(i);return;case"LocalFolderOutsideWorkspace":await this._localFolderOutsideWorkspaceOpener.open(i);return;case"Url":await this.open(i);return}}catch{this._logService.warn("Open file via native file explorer")}this._openerService.open(i.text,{allowTunneling:this._isRemote&&this._configurationService.getValue("remote.forwardOnOpen"),allowContributedOpeners:!0,openExternal:!0})}}};wze=I([m(4,Je),m(5,B),m(6,fe),m(7,ht),m(8,Pe),m(9,ca)],wze);var wre=class{constructor(i,e,t,o,n,r){this.xterm=i;this._processManager=e;this._linkResolver=t;this._logService=o;this._uriIdentityService=n;this._workspaceContextService=r;this.maxLinkLength=2048}static{this.id="uri"}async detect(i,e,t){let o=[],n=new CBi(this.xterm,e,t),r=wje.computeLinks(n),s=0;this._logService.trace("terminalUriLinkDetector#detect computedLinks",r);for(let l of r){let c=XW(i,this.xterm.cols,l.range,e),u=l.url?Fe(l.url)?A.parse(this._excludeLineAndColSuffix(l.url)):l.url:void 0;if(!u)continue;let p=l.url?.toString()||"";if(p.length>this.maxLinkLength)continue;if(u.scheme!==Q.file){o.push({text:p,uri:u,bufferRange:c,type:"Url"});continue}if(u.authority.length!==2&&u.authority.endsWith(":"))continue;let h=[u];u.authority.length>0&&h.push(A.from({...u,authority:void 0})),this._logService.trace("terminalUriLinkDetector#detect uriCandidates",h);for(let g of h){let f=await this._linkResolver.resolveLink(this._processManager,p,g);if(f){let v=yre(g,f.isDirectory,this._uriIdentityService,this._workspaceContextService),b={text:Fe(l.url)?l.url:f.link,uri:g,bufferRange:c,type:v};this._logService.trace("terminalUriLinkDetector#detect verified link",b),o.push(b),s++;break}}if(++s>=10)break}return o}_excludeLineAndColSuffix(i){return i.replace(/:\d+(:\d+)?$/,"")}};wre=I([m(3,ca),m(4,ht),m(5,Pe)],wre);var CBi=class{constructor(i,e,t){this._xterm=i;this._lineStart=e;this._lineEnd=t}getLineCount(){return 1}getLineContent(){return JW(this._xterm.buffer.active,this._lineStart,this._lineEnd,this._xterm.cols)}};var Cre=class extends x{constructor(e,t,o){super();this.xterm=e;this._configurationService=t;this._productService=o;this.maxLinkLength=100;this._refreshSeparatorCodes(),this._register(this._configurationService.onDidChangeConfiguration(n=>{n.affectsConfiguration("terminal.integrated.wordSeparators")&&this._refreshSeparatorCodes()}))}static{this.id="word"}detect(e,t,o){let n=[],r=JW(this.xterm.buffer.active,t,o,this.xterm.cols);if(r===""||r.length>2e3)return[];let s=this._parseWords(r);for(let l of s){if(l.text==="")continue;l.text.length>0&&l.text.charAt(l.text.length-1)===":"&&(l.text=l.text.slice(0,-1),l.endIndex--);let c=XW(e,this.xterm.cols,{startColumn:l.startIndex+1,startLineNumber:1,endColumn:l.endIndex+1,endLineNumber:1},t);if(ec(l.text,this._productService.urlProtocol)){let u=A.parse(l.text);u&&n.push({text:l.text,uri:u,bufferRange:c,type:"Url"});continue}n.push({text:l.text,bufferRange:c,type:"Search",contextLine:r})}return n}_parseWords(e){let t=[],o=e.split(this._separatorRegex),n=0;for(let r=0;r<o.length;r++)t.push({text:o[r],startIndex:n,endIndex:n+o[r].length}),n+=o[r].length+1;return t}_refreshSeparatorCodes(){let e=this._configurationService.getValue(Vv).wordSeparators,t="";for(let o=57520;o<=57535;o++)t+=String.fromCharCode(o);this._separatorRegex=new RegExp(`[${ns(e)}${t}]`,"g")}};Cre=I([m(1,B),m(2,tt)],Cre);var A8t=_,Cze=class extends x{constructor(e,t,o,n,r,s){super();this._targetOptions=e;this._text=t;this._actions=o;this._linkHandler=n;this._hoverService=r;this._configurationService=s;this.id="hover"}attach(e){if(!this._configurationService.getValue("terminal.integrated.showLinkHover"))return;let o=new xBi(e,this._targetOptions),n=this._hoverService.showInstantHover({target:o,content:this._text,actions:this._actions,linkHandler:this._linkHandler,additionalClasses:["xterm-hover"]});n&&this._register(n)}};Cze=I([m(4,nt),m(5,B)],Cze);var xBi=class extends ja{constructor(e,t){super();this._options=t;this._targetElements=[];this._domNode=A8t("div.terminal-hover-targets.xterm-hover");let o=this._options.viewportRange.end.y-this._options.viewportRange.start.y+1,n=(this._options.viewportRange.end.y>this._options.viewportRange.start.y?this._options.terminalDimensions.width-this._options.viewportRange.start.x:this._options.viewportRange.end.x-this._options.viewportRange.start.x+1)*this._options.cellDimensions.width,r=A8t("div.terminal-hover-target.hoverHighlight");if(r.style.left=`${this._options.viewportRange.start.x*this._options.cellDimensions.width}px`,r.style.bottom=`${(this._options.terminalDimensions.height-this._options.viewportRange.start.y-1)*this._options.cellDimensions.height}px`,r.style.width=`${n}px`,r.style.height=`${this._options.cellDimensions.height}px`,this._targetElements.push(this._domNode.appendChild(r)),o>2){let s=A8t("div.terminal-hover-target.hoverHighlight");s.style.left="0px",s.style.bottom=`${(this._options.terminalDimensions.height-this._options.viewportRange.start.y-1-(o-2))*this._options.cellDimensions.height}px`,s.style.width=`${this._options.terminalDimensions.width*this._options.cellDimensions.width}px`,s.style.height=`${(o-2)*this._options.cellDimensions.height}px`,this._targetElements.push(this._domNode.appendChild(s))}if(o>1){let s=A8t("div.terminal-hover-target.hoverHighlight");s.style.left="0px",s.style.bottom=`${(this._options.terminalDimensions.height-this._options.viewportRange.end.y-1)*this._options.cellDimensions.height}px`,s.style.width=`${(this._options.viewportRange.end.x+1)*this._options.cellDimensions.width}px`,s.style.height=`${this._options.cellDimensions.height}px`,this._targetElements.push(this._domNode.appendChild(s))}if(this._options.modifierDownCallback&&this._options.modifierUpCallback){let s=!1;this._register(j(e.ownerDocument,"keydown",l=>{l.ctrlKey&&!s&&(s=!0,this._options.modifierDownCallback())})),this._register(j(e.ownerDocument,"keyup",l=>{l.ctrlKey||(s=!1,this._options.modifierUpCallback())}))}e.appendChild(this._domNode),this._register(Z(()=>this._domNode?.remove()))}get targetElements(){return this._targetElements}};var vfn=[/^ *(?<link>(?<line>\d+):(?<col>\d+)?)/],bfn=[/^(?<link>@@ .+ \+(?<toFileLine>\d+),(?<toFileCount>\d+) @@)/],fbe=class{constructor(i,e,t,o,n,r){this.xterm=i;this._processManager=e;this._linkResolver=t;this._logService=o;this._uriIdentityService=n;this._workspaceContextService=r;this.maxLinkLength=500}static{this.id="multiline"}async detect(i,e,t){let o=[],n=JW(this.xterm.buffer.active,e,t,this.xterm.cols);if(n===""||n.length>2e3)return[];this._logService.trace("terminalMultiLineLinkDetector#detect text",n);for(let r of vfn){let l=n.match(r)?.groups;if(!l)continue;let c=l?.link,u=l?.line,p=l?.col;if(!c||u===void 0||c.length>1024)continue;this._logService.trace("terminalMultiLineLinkDetector#detect candidate",c);let h;for(let f=e-1;f>=0;f--){if(this.xterm.buffer.active.getLine(f).isWrapped)continue;let v=JW(this.xterm.buffer.active,f,f,this.xterm.cols);if(!v.match(/^\s*\d/)){h=v;break}}if(!h)continue;let g=await this._linkResolver.resolveLink(this._processManager,h);if(g){let f=yre(g.uri,g.isDirectory,this._uriIdentityService,this._workspaceContextService),v=XW(i,this.xterm.cols,{startColumn:1,startLineNumber:1,endColumn:1+n.length,endLineNumber:1},e),b={text:c,uri:g.uri,selection:{startLineNumber:parseInt(u),startColumn:p?parseInt(p):1},disableTrimColon:!0,bufferRange:v,type:f};this._logService.trace("terminalMultiLineLinkDetector#detect verified link",b),o.push(b);break}}if(o.length===0)for(let r of bfn){let l=n.match(r)?.groups;if(!l)continue;let c=l?.link,u=l?.toFileLine,p=l?.toFileCount;if(!c||u===void 0||c.length>1024)continue;this._logService.trace("terminalMultiLineLinkDetector#detect candidate",c);let h;for(let f=e-1;f>=0;f--){if(this.xterm.buffer.active.getLine(f).isWrapped)continue;let b=JW(this.xterm.buffer.active,f,f,this.xterm.cols).match(/\+\+\+ b\/(?<path>.+)/);if(b){h=b.groups?.path;break}}if(!h)continue;let g=await this._linkResolver.resolveLink(this._processManager,h);if(g){let f=yre(g.uri,g.isDirectory,this._uriIdentityService,this._workspaceContextService),v=XW(i,this.xterm.cols,{startColumn:1,startLineNumber:1,endColumn:1+c.length,endLineNumber:1},e),b={text:c,uri:g.uri,selection:{startLineNumber:parseInt(u),startColumn:1,endLineNumber:parseInt(u)+parseInt(p)},bufferRange:v,type:f};this._logService.trace("terminalMultiLineLinkDetector#detect verified link",b),o.push(b);break}}return o}};fbe=I([m(3,ca),m(4,ht),m(5,Pe)],fbe);var xze=class extends N{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this._xterm=e;this._processInfo=t;this._linkResolver=n;this._configurationService=r;this._instantiationService=s;this._telemetryService=c;this._logService=p;this._tunnelService=h;this._standardLinkProviders=new Map;this._linkProvidersDisposables=[];this._externalLinkProviders=[];this._openers=new Map;let g=!0;switch(this._configurationService.getValue(Vv).enableFileLinks){case"off":case!1:g=!1;break;case"notRemote":g=!this._processInfo.remoteAuthority;break}g&&(this._setupLinkDetector(fbe.id,this._instantiationService.createInstance(fbe,this._xterm,this._processInfo,this._linkResolver)),this._setupLinkDetector(F6.id,this._instantiationService.createInstance(F6,this._xterm,o,this._processInfo,this._linkResolver))),this._setupLinkDetector(wre.id,this._instantiationService.createInstance(wre,this._xterm,this._processInfo,this._linkResolver)),this._setupLinkDetector(Cre.id,this.add(this._instantiationService.createInstance(Cre,this._xterm)));let v=this._instantiationService.createInstance(bze),b=this._instantiationService.createInstance(Sze),S=this._instantiationService.createInstance(Ize);this._openers.set("LocalFile",v),this._openers.set("LocalFolderInWorkspace",b),this._openers.set("LocalFolderOutsideWorkspace",S),this._openers.set("Search",this._instantiationService.createInstance(yze,o,this._processInfo.initialCwd,v,b,()=>this._processInfo.os||Po)),this._openers.set("Url",this._instantiationService.createInstance(wze,!!this._processInfo.remoteAuthority,v,b,S)),this._registerStandardLinkProviders();let y,w;this.add(Z(()=>{this._clearLinkProviders(),Be(this._externalLinkProviders),y?.dispose(),w?.dispose()})),this._xterm.options.linkHandler={allowNonHttpProtocols:!0,activate:async(k,T)=>{if(!this._isLinkActivationModifierDown(k))return;let P=T.indexOf(":");if(P===-1)throw new Error(`Could not find scheme in link "${T}"`);let O=T.substring(0,P);u.config.allowedLinkSchemes.indexOf(O)===-1&&!await new Promise(H=>{l.prompt(ft.Warning,d(15545,null,O),[{label:d(15541,null,O),run:()=>{let G=[...u.config.allowedLinkSchemes,O];this._configurationService.updateValue("terminal.integrated.allowedLinkSchemes",G),H(!0)}}],{onCancel:()=>H(!1)})})||this._openers.get("Url")?.open({type:"Url",text:T,bufferRange:null,uri:A.parse(T)})},hover:(k,T,P)=>{y?.dispose(),y=void 0,w?.dispose(),w=new Dt(()=>{let O=this._xterm._core,V={width:O._renderService.dimensions.css.cell.width,height:O._renderService.dimensions.css.cell.height},H={width:this._xterm.cols,height:this._xterm.rows};y=this._showHover({viewportRange:D8t(P,this._xterm.buffer.active.viewportY),cellDimensions:V,terminalDimensions:H},this._getLinkHoverString(T,T),void 0,G=>this._xterm.options.linkHandler?.activate(k,G,P)),w?.dispose(),w=void 0},this._configurationService.getValue("workbench.hover.delay")),w.schedule()}}}_setupLinkDetector(e,t,o=!1){let n=this.add(this._instantiationService.createInstance(fze,t));return this.add(n.onDidActivateLink(r=>{r.event?.preventDefault(),!(r.event&&!(r.event instanceof Eue)&&!this._isLinkActivationModifierDown(r.event))&&(r.link.activate?r.link.activate(r.link.text):this._openLink(r.link))})),this.add(n.onDidShowHover(r=>this._tooltipCallback(r.link,r.viewportRange,r.modifierDownCallback,r.modifierUpCallback))),o||this._standardLinkProviders.set(e,n),n}async _openLink(e){this._logService.debug("Opening link",e);let t=this._openers.get(e.type);if(!t)throw new Error(`No matching opener for link type "${e.type}"`);this._telemetryService.publicLog2("terminal/openLink",{linkType:Fe(e.type)?e.type:`extension:${e.type.id}`}),await t.open(e)}async openRecentLink(e){let t,o=this._xterm.buffer.active.length;for(;(!t||t.length===0)&&o>=this._xterm.buffer.active.viewportY;)t=await this._getLinksForType(o,e),o--;if(!t||t.length<1)return;let n=new Eue(re.CLICK);return t[0].activate(n,t[0].text),t[0]}async getLinks(){let e=[];for(let l=this._xterm.buffer.active.viewportY+this._xterm.rows-1;l>=this._xterm.buffer.active.viewportY;l--)e.push(this._getLinksForLine(l));let t=await Promise.all(e),o={wordLinks:[],webLinks:[],fileLinks:[],folderLinks:[]};for(let l of t)if(l){let{wordLinks:c,webLinks:u,fileLinks:p,folderLinks:h}=l;c?.length&&o.wordLinks.push(...c.reverse()),u?.length&&o.webLinks.push(...u.reverse()),p?.length&&o.fileLinks.push(...p.reverse()),h?.length&&o.folderLinks.push(...h.reverse())}let n=[];for(let l=this._xterm.buffer.active.viewportY-1;l>=0;l--)n.push(this._getLinksForLine(l));let r=[];for(let l=this._xterm.buffer.active.length-1;l>=this._xterm.buffer.active.viewportY+this._xterm.rows;l--)r.push(this._getLinksForLine(l));let s=Promise.all(n).then(async l=>{let c=await Promise.all(r),u={wordLinks:[...o.wordLinks],webLinks:[...o.webLinks],fileLinks:[...o.fileLinks],folderLinks:[...o.folderLinks]};for(let p of[...c,...l])if(p){let{wordLinks:h,webLinks:g,fileLinks:f,folderLinks:v}=p;h?.length&&u.wordLinks.push(...h.reverse()),g?.length&&u.webLinks.push(...g.reverse()),f?.length&&u.fileLinks.push(...f.reverse()),v?.length&&u.folderLinks.push(...v.reverse())}return u});return{viewport:o,all:s}}async _getLinksForLine(e){let t=await this._getLinksForType(e,"word"),o=await this._getLinksForType(e,"url"),n=await this._getLinksForType(e,"localFile"),r=await this._getLinksForType(e,"localFolder"),s=new Set,l;if(t){l=[];for(let c of t)!s.has(c.text)&&c.text.length>1&&(l.push(c),s.add(c.text))}return{wordLinks:l,webLinks:o,fileLinks:n,folderLinks:r}}async _getLinksForType(e,t){switch(t){case"word":return await new Promise(o=>this._standardLinkProviders.get(Cre.id)?.provideLinks(e,o));case"url":return await new Promise(o=>this._standardLinkProviders.get(wre.id)?.provideLinks(e,o));case"localFile":return(await new Promise(n=>this._standardLinkProviders.get(F6.id)?.provideLinks(e,n)))?.filter(n=>n.type==="LocalFile");case"localFolder":return(await new Promise(n=>this._standardLinkProviders.get(F6.id)?.provideLinks(e,n)))?.filter(n=>n.type==="LocalFolderInWorkspace")}}_tooltipCallback(e,t,o,n){if(!this._widgetManager)return;let r=this._xterm._core,s={width:r._renderService.dimensions.css.cell.width,height:r._renderService.dimensions.css.cell.height},l={width:this._xterm.cols,height:this._xterm.rows};this._showHover({viewportRange:t,cellDimensions:s,terminalDimensions:l,modifierDownCallback:o,modifierUpCallback:n},this._getLinkHoverString(e.text,e.label),e.actions,c=>e.activate(void 0,c),e)}_showHover(e,t,o,n,r){if(this._widgetManager){let s=this._instantiationService.createInstance(Cze,e,t,o,n),l=this._widgetManager.attachWidget(s);return l&&r?.onInvalidated(()=>l.dispose()),l}}setWidgetManager(e){this._widgetManager=e}_clearLinkProviders(){Be(this._linkProvidersDisposables),this._linkProvidersDisposables.length=0}_registerStandardLinkProviders(){let e=async n=>this.externalProvideLinksCb?.(n),t=`extension-${this._externalLinkProviders.length}`,o=this._setupLinkDetector(t,new R8t(t,this._xterm,e),!0);this._linkProvidersDisposables.push(this._xterm.registerLinkProvider(o));for(let n of this._standardLinkProviders.values())this._linkProvidersDisposables.push(this._xterm.registerLinkProvider(n))}_isLinkActivationModifierDown(e){return this._configurationService.getValue("editor").multiCursorModifier==="ctrlCmd"?!!e.altKey:Ze?e.metaKey:e.ctrlKey}_getLinkHoverString(e,t){let o=this._configurationService.getValue("editor"),n="";o.multiCursorModifier==="ctrlCmd"?Ze?n=d(15547,null):n=d(15546,null):Ze?n=d(15548,null):n=d(15549,null);let r=d(15543,null);try{this._tunnelService.canTunnel(A.parse(e))&&(r=d(15542,null))}catch{}let s=new Ie("",!0);return t&&(t=s.appendText(t).value,s.value=""),e&&(e=s.appendText(e).value,s.value=""),t=t||r,e=e||t,/(\s|&nbsp;)/.test(e)&&(e=d(15544,null)),s.appendLink(e,t).appendMarkdown(` (${n})`)}};xze=I([m(4,B),m(5,F),m(6,Ne),m(7,Te),m(8,Uu),m(9,ca),m(10,_p)],xze);var N8t=class{constructor(){this._linkProviders=new Set;this._onDidAddLinkProvider=new E;this._onDidRemoveLinkProvider=new E}get linkProviders(){return this._linkProviders}get onDidAddLinkProvider(){return this._onDidAddLinkProvider.event}get onDidRemoveLinkProvider(){return this._onDidRemoveLinkProvider.event}registerLinkProvider(i){let e=[];return this._linkProviders.add(i),this._onDidAddLinkProvider.fire(i),{dispose:()=>{for(let t of e)t.dispose();this._linkProviders.delete(i),this._onDidRemoveLinkProvider.fire(i)}}}};var kze=class extends N{constructor(e,t,o,n){super();this._accessibleViewService=e;this._labelService=o;this._quickInputService=n;this._editorSequencer=new rm;this._onDidRequestMoreLinks=this.add(new E);this.onDidRequestMoreLinks=this._onDidRequestMoreLinks.event;this._terminalScrollStateSaved=!1;this._editorViewState=this.add(t.createInstance(L2))}async show(e,t){this._instance=e;let o=await Promise.race([t.all,Li(500)]),n=typeof o=="object",r=n?o:t.viewport,s=r.wordLinks?await this._generatePicks(r.wordLinks):void 0,l=r.fileLinks?await this._generatePicks(r.fileLinks):void 0,c=r.folderLinks?await this._generatePicks(r.folderLinks):void 0,u=r.webLinks?await this._generatePicks(r.webLinks):void 0,p=[];u&&(p.push({type:"separator",label:d(15554,null)}),p.push(...u)),l&&(p.push({type:"separator",label:d(15550,null)}),p.push(...l)),c&&(p.push({type:"separator",label:d(15551,null)}),p.push(...c)),s&&(p.push({type:"separator",label:d(15553,null)}),p.push(...s));let h=this._quickInputService.createQuickPick({useSeparators:!0}),g=new N;g.add(h),h.items=p,h.placeholder=d(15552,null),h.sortByLabel=!1,h.show(),h.activeItems.length>0&&this._previewItem(h.activeItems[0]);let f=!1;return n||g.add(U.once(h.onDidChangeValue)(async()=>{let v=await t.all;if(f)return;let b=[...v.fileLinks??[],...v.folderLinks??[],...v.webLinks??[]],S=v.wordLinks?await this._generatePicks(v.wordLinks,b):void 0,y=v.fileLinks?await this._generatePicks(v.fileLinks):void 0,w=v.folderLinks?await this._generatePicks(v.folderLinks):void 0,k=v.webLinks?await this._generatePicks(v.webLinks):void 0,T=[];k&&(T.push({type:"separator",label:d(15554,null)}),T.push(...k)),y&&(T.push({type:"separator",label:d(15550,null)}),T.push(...y)),w&&(T.push({type:"separator",label:d(15551,null)}),T.push(...w)),S&&(T.push({type:"separator",label:d(15553,null)}),T.push(...S)),h.items=T})),g.add(h.onDidChangeActive(async()=>{let[v]=h.activeItems;this._previewItem(v)})),new Promise(v=>{g.add(h.onDidHide(({reason:b})=>{if(this._terminalScrollStateSaved){let S=this._instance?.xterm?.markTracker;S&&(S.restoreScrollState(),S.clear(),this._terminalScrollStateSaved=!1)}b===2&&this._editorViewState.restore(),g.dispose(),h.selectedItems.length===0&&this._accessibleViewService.showLastProvider("terminal"),v()})),g.add(U.once(h.onDidAccept)(()=>{if(this._terminalScrollStateSaved){let y=this._instance?.xterm?.markTracker;y&&(y.restoreScrollState(),y.clear(),this._terminalScrollStateSaved=!1)}f=!0;let b=new Eue(re.CLICK),S=h.activeItems?.[0];S&&No(S,{link:!0})&&S.link.activate(b,S.label),g.dispose(),v()}))})}async _generatePicks(e,t){if(!e)return;let o=new Set,n=new Set,r=[];for(let s of e){let l=s.text;if(!o.has(l)&&(!t||!t.some(c=>c.text===l))){o.add(l);let c;if(No(s,{uri:!0})&&s.uri){if((s.type==="LocalFile"||s.type==="LocalFolderInWorkspace"||s.type==="LocalFolderOutsideWorkspace")&&(l=Ga(s.uri),c=this._labelService.getUriLabel(ci(s.uri),{relative:!0})),s.type==="LocalFile"&&s.parsedLink?.suffix?.row!==void 0&&(l+=`:${s.parsedLink.suffix.row}`,s.parsedLink?.suffix?.rowEnd!==void 0&&(l+=`-${s.parsedLink.suffix.rowEnd}`),s.parsedLink?.suffix?.col!==void 0&&(l+=`:${s.parsedLink.suffix.col}`,s.parsedLink?.suffix?.colEnd!==void 0&&(l+=`-${s.parsedLink.suffix.colEnd}`))),n.has(l+"|"+(c??"")))continue;n.add(l+"|"+(c??""))}r.push({label:l,link:s,description:c})}}return r.length>0?r:void 0}_previewItem(e){if(!e||!No(e,{link:!0})||!e.link)return;let t=e.link;this._previewItemInTerminal(t),!(!No(t,{uri:!0})||!t.uri)&&t.type==="LocalFile"&&this._previewItemInEditor(t)}_previewItemInEditor(e){let t=e.parsedLink?e.parsedLink.suffix:Pct(e.text),o=t?.row===void 0?void 0:{startLineNumber:t.row??1,startColumn:t.col??1,endLineNumber:t.rowEnd,endColumn:t.colEnd};this._editorViewState.set(),this._editorSequencer.queue(async()=>{await this._editorViewState.openTransientEditor({resource:e.uri,options:{preserveFocus:!0,revealIfOpened:!0,ignoreError:!0,selection:o}})})}_previewItemInTerminal(e){let t=this._instance?.xterm;t&&(this._terminalScrollStateSaved||(t.markTracker.saveScrollState(),this._terminalScrollStateSaved=!0),t.markTracker.revealRange(e.range))}};kze=I([m(0,ou),m(1,F),m(2,rt),m(3,Ue)],kze);var Eze=class{constructor(i){this._fileService=i;this._resolvedLinkCaches=new Map}async resolveLink(i,e,t){t&&t.scheme===Q.file&&i.remoteAuthority&&(t=t.with({scheme:Q.vscodeRemote,authority:i.remoteAuthority}));let o=this._resolvedLinkCaches.get(i.remoteAuthority??"");o||(o=new kBi,this._resolvedLinkCaches.set(i.remoteAuthority??"",o));let n=o.get(t||e);if(n!==void 0)return n;if(t)try{let s=await this._fileService.stat(t),l={uri:t,link:e,isDirectory:s.isDirectory};return o.set(t,l),l}catch{return o.set(t,null),null}let r=VDo(e);if(r=BDo(r),r.length===0)return o.set(e,null),null;if(ei&&e.match(/^\/mnt\/[a-z]/i)&&i.backend)r=await i.backend.getWslPath(r,"unix-to-win");else if(!(ei&&e.match(/^(?:\/\/|\\\\)wsl(?:\$|\.localhost)(\/|\\)/))){let s=this._preprocessPath(r,i.initialCwd,i.os,i.userHome);if(!s)return o.set(e,null),null;r=s}try{let s;i.remoteAuthority?s=A.from({scheme:Q.vscodeRemote,authority:i.remoteAuthority,path:r}):s=A.file(r);try{let l=await this._fileService.stat(s),c={uri:s,link:e,isDirectory:l.isDirectory};return o.set(e,c),c}catch{return o.set(e,null),null}}catch{return o.set(e,null),null}}_preprocessPath(i,e,t,o){let n=this._getOsPath(t);if(i.charAt(0)==="~"){if(!o)return null;i=n.join(o,i.substring(1))}else if(i.charAt(0)!=="/"&&i.charAt(0)!=="~")if(t===1)if(!i.match("^"+wBi)&&!i.startsWith("\\\\?\\")){if(!e)return null;i=n.join(e,i)}else i=i.replace(/^\\\\\?\\/,"");else{if(!e)return null;i=n.join(e,i)}return i=n.normalize(i),i}_getOsPath(i){return(i??Po)===1?$s:Oo}};Eze=I([m(0,fe)],Eze);var kBi=class{constructor(){this._cache=new Map;this._cacheTilTimeout=0}set(i,e){this._cacheTilTimeout&&ut.clearTimeout(this._cacheTilTimeout),this._cacheTilTimeout=ut.setTimeout(()=>this._cache.clear(),1e4),this._cache.set(this._getKey(i),e)}get(i){return this._cache.get(this._getKey(i))}_getKey(i){return A.isUri(i)?i.toString():i}};Ee(oYe,N8t,1);var HU=class extends N{constructor(e,t,o){super();this._ctx=e;this._instantiationService=t;this._terminalLinkProviderService=o;this._linkResolver=this._instantiationService.createInstance(Eze)}static{this.ID="terminal.link"}static get(e){return e.getContribution(HU.ID)}xtermReady(e){let t=this._linkManager=this.add(this._instantiationService.createInstance(xze,e.raw,this._ctx.processManager,this._ctx.instance.capabilities,this._linkResolver));if(Qio(this._ctx.processManager)){let o=t.add(U.once(this._ctx.processManager.onProcessReady)(()=>{t.setWidgetManager(this._ctx.widgetManager),this.delete(o)}))}else t.setWidgetManager(this._ctx.widgetManager);if(!YR(this._ctx.instance)){for(let o of this._terminalLinkProviderService.linkProviders)t.externalProvideLinksCb=o.provideLinks.bind(o,this._ctx.instance);t.add(this._terminalLinkProviderService.onDidAddLinkProvider(o=>{t.externalProvideLinksCb=o.provideLinks.bind(o,this._ctx.instance)}))}t.add(this._terminalLinkProviderService.onDidRemoveLinkProvider(()=>t.externalProvideLinksCb=void 0))}async showLinkQuickpick(e){this._terminalLinkQuickpick||(this._terminalLinkQuickpick=this.add(this._instantiationService.createInstance(kze)),this.add(this._terminalLinkQuickpick.onDidRequestMoreLinks(()=>{this.showLinkQuickpick(!0)})));let t=await this._getLinks();return await this._terminalLinkQuickpick.show(this._ctx.instance,t)}async _getLinks(){if(!this._linkManager)throw new Error("terminal links are not ready, cannot generate link quick pick");return this._linkManager.getLinks()}async openRecentLink(e){if(!this._linkManager)throw new Error("terminal links are not ready, cannot open a link");this._linkManager.openRecentLink(e)}};HU=I([m(1,F),m(2,oYe)],HU);Mp(HU.ID,HU,!0);var EBi=sr.actionCategory;Jl({id:"workbench.action.terminal.openDetectedLink",title:L(15532,"Open Detected Link..."),f1:!0,category:EBi,precondition:dt.terminalHasBeenCreated,keybinding:[{primary:3117,weight:201,when:dt.focus},{primary:3109,weight:201,when:C.and(Dd,C.equals(cu.key,"terminal"))}],run:a=>HU.get(a)?.showLinkQuickpick()});Jl({id:"workbench.action.terminal.openUrlLink",title:L(15534,"Open Last URL Link"),metadata:{description:L(15535,"Opens the last detected URL/URI link in the terminal")},f1:!0,category:EBi,precondition:dt.terminalHasBeenCreated,run:a=>HU.get(a)?.openRecentLink("url")});Jl({id:"workbench.action.terminal.openFileLink",title:L(15533,"Open Last Local File Link"),f1:!0,category:EBi,precondition:dt.terminalHasBeenCreated,run:a=>HU.get(a)?.openRecentLink("localFile")});var O8t=class extends x{constructor(e){super();this._host=e;this._osc99PendingNotifications=new Map;this._osc99ActiveNotifications=new Map}handleSequence(e){let{metadata:t,payload:o}=this._splitOsc99Data(e),n=this._parseOsc99Metadata(t),r=n.get("p"),s=r&&r.length>0?r[r.length-1]:void 0,l=s&&s.length>0?s:"title",c=this._sanitizeOsc99Id(n.get("i")?.[0]);if(!this._host.isEnabled())return!0;switch(l){case"?":return this._sendOsc99QueryResponse(c),!0;case"alive":return this._sendOsc99AliveResponse(c),!0;case"close":return this._closeOsc99Notification(c),!0}let u=this._getOrCreateOsc99State(c);this._updateOsc99StateFromMetadata(u,n);let p=n.get("e")?.[0]==="1",h=this._decodeOsc99Payload(o,p),g=n.get("d")?.[0]!=="0";switch(l){case"title":u.title+=h;break;case"body":u.body+=h;break;case"buttons":u.buttonsPayload+=h;break;default:return!0}return g?this._shouldHonorOsc99Occasion(u.occasion)?(this._showOsc99Notification(u)&&this._clearOsc99PendingState(c),!0):(this._clearOsc99PendingState(c),!0):!0}_splitOsc99Data(e){let t=e.indexOf(";");return t===-1?{metadata:e,payload:""}:{metadata:e.substring(0,t),payload:e.substring(t+1)}}_parseOsc99Metadata(e){let t=new Map;if(!e)return t;for(let o of e.split(":")){if(!o)continue;let n=o.indexOf("=");if(n===-1)continue;let r=o.substring(0,n),s=o.substring(n+1);if(!r)continue;let l=t.get(r);l||(l=[],t.set(r,l)),l.push(s)}return t}_decodeOsc99Payload(e,t){if(!t)return e;try{return qa(e).toString()}catch{return this._host.logWarn("Failed to decode OSC 99 payload"),""}}_sanitizeOsc99Id(e){if(!e)return;let t=e.replace(/[^a-zA-Z0-9_\-+.]/g,"");return t.length>0?t:void 0}_sanitizeOsc99MessageText(e){return e.replace(/\[([^\]]+)\]\(([^)]+)\)/g,"$1")}_getOrCreateOsc99State(e){if(!e)return this._osc99PendingAnonymous||(this._osc99PendingAnonymous=this._createOsc99State(void 0)),this._osc99PendingAnonymous;let t=this._osc99PendingNotifications.get(e);return t||(t=this._createOsc99State(e),this._osc99PendingNotifications.set(e,t)),t}_createOsc99State(e){return{id:e,title:"",body:"",buttonsPayload:"",focusOnActivate:!0,reportOnActivate:!1,reportOnClose:!1,urgency:void 0,autoCloseMs:void 0,occasion:void 0}}_clearOsc99PendingState(e){if(!e){this._osc99PendingAnonymous=void 0;return}this._osc99PendingNotifications.delete(e)}_updateOsc99StateFromMetadata(e,t){let o=t.get("a"),n=o&&o.length>0?o[o.length-1]:void 0;if(n!==void 0){let f=this._parseOsc99Actions(n);e.focusOnActivate=f.focusOnActivate,e.reportOnActivate=f.reportOnActivate}let r=t.get("c"),s=r&&r.length>0?r[r.length-1]:void 0;s!==void 0&&(e.reportOnClose=s==="1");let l=t.get("u"),c=l&&l.length>0?l[l.length-1]:void 0;if(c!==void 0){let f=Number.parseInt(c,10);Number.isNaN(f)||(e.urgency=f)}let u=t.get("w"),p=u&&u.length>0?u[u.length-1]:void 0;if(p!==void 0){let f=Number.parseInt(p,10);Number.isNaN(f)||(e.autoCloseMs=f)}let h=t.get("o"),g=h&&h.length>0?h[h.length-1]:void 0;(g==="always"||g==="unfocused"||g==="invisible")&&(e.occasion=g)}_parseOsc99Actions(e){let t=!0,o=!1;for(let n of e.split(","))switch(n){case"focus":t=!0;break;case"-focus":t=!1;break;case"report":o=!0;break;case"-report":o=!1;break}return{focusOnActivate:t,reportOnActivate:o}}_shouldHonorOsc99Occasion(e){if(!e||e==="always")return!0;let t=this._host.isWindowFocused();switch(e){case"unfocused":return!t;case"invisible":return!t&&!this._host.isTerminalVisible();default:return!0}}_showOsc99Notification(e){let t=this._getOsc99NotificationMessage(e);if(!t)return!1;let o=e.urgency===2?ft.Warning:ft.Info,n=this._getOsc99NotificationPriority(e.urgency),r={id:"terminal",label:d(15557,null)},s=e.buttonsPayload.length>0?e.buttonsPayload.split("\u2028"):[],l=this._register(new N),c={current:void 0},u={current:void 0},p=(S,y)=>{(y||e.focusOnActivate)&&this._host.focusTerminal(),e.reportOnActivate&&this._sendOsc99ActivationReport(e.id,S)},h=[];for(let S=0;S<s.length;S++){let y=s[S];if(!y)continue;let w=l.add(new it(`terminal.osc99.button.${S}`,y,void 0,!0,()=>{u.current&&(u.current.closeReason="button"),p(S+1),c.current?.close()}));h.push(w)}let g=[];g.push(l.add(new it("terminal.osc99.dismiss",d(15556,null),void 0,!0,()=>{u.current&&(u.current.closeReason="secondary"),c.current?.close()}))),g.push(l.add(new it("terminal.osc99.disable",d(15555,null),void 0,!0,async()=>{await this._host.updateEnableNotifications(!1),u.current&&(u.current.closeReason="secondary"),c.current?.close()})));let f={primary:h,secondary:g};if(e.id){let S=this._osc99ActiveNotifications.get(e.id);if(S)return u.current=S,c.current=S.handle,S.handle.updateMessage(t),S.handle.updateSeverity(o),S.handle.updateActions(f),S.actionStore.dispose(),S.actionStore=l,S.focusOnActivate=e.focusOnActivate,S.reportOnActivate=e.reportOnActivate,S.reportOnClose=e.reportOnClose,S.autoCloseDisposable?.dispose(),S.autoCloseDisposable=this._scheduleOsc99AutoClose(S,e.autoCloseMs),!0}let v=this._host.notify({id:e.id?`terminal.osc99.${e.id}`:void 0,severity:o,message:t,source:r,actions:f,priority:n});c.current=v;let b={id:e.id,handle:v,actionStore:l,autoCloseDisposable:void 0,reportOnActivate:e.reportOnActivate,reportOnClose:e.reportOnClose,focusOnActivate:e.focusOnActivate,closeReason:void 0};return u.current=b,b.autoCloseDisposable=this._scheduleOsc99AutoClose(b,e.autoCloseMs),this._register(v.onDidClose(()=>{b.reportOnActivate&&b.closeReason===void 0&&(b.focusOnActivate&&this._host.focusTerminal(),this._sendOsc99ActivationReport(b.id)),b.reportOnClose&&this._sendOsc99CloseReport(b.id),b.actionStore.dispose(),b.autoCloseDisposable?.dispose(),b.id&&this._osc99ActiveNotifications.delete(b.id)})),b.id&&this._osc99ActiveNotifications.set(b.id,b),!0}_getOsc99NotificationMessage(e){let t=this._sanitizeOsc99MessageText(e.title),o=this._sanitizeOsc99MessageText(e.body),n=t.trim().length>0,r=o.trim().length>0;if(n&&r)return`${t}: ${o}`;if(n)return t;if(r)return o}_getOsc99NotificationPriority(e){switch(e){case 0:return 2;case 1:return 0;case 2:return 3;default:return}}_scheduleOsc99AutoClose(e,t){if(!(t===void 0||t<=0))return tn(()=>{e.closeReason="auto",e.handle.close()},t,this._store)}_closeOsc99Notification(e){if(!e)return;let t=this._osc99ActiveNotifications.get(e);t&&(t.closeReason="protocol",t.handle.close()),this._osc99PendingNotifications.delete(e)}_sendOsc99QueryResponse(e){let t=e??"0";this._sendOsc99Response([`i=${t}`,"p=?","a=report,focus","c=1","o=always,unfocused,invisible","p=title,body,buttons,close,alive,?","u=0,1,2","w=1"])}_sendOsc99AliveResponse(e){let t=e??"0",o=Array.from(this._osc99ActiveNotifications.keys()).join(",");this._sendOsc99Response([`i=${t}`,"p=alive"],o)}_sendOsc99ActivationReport(e,t){let o=e??"0";this._sendOsc99Response([`i=${o}`],t!==void 0?String(t):"")}_sendOsc99CloseReport(e){let t=e??"0";this._sendOsc99Response([`i=${t}`,"p=close"])}_sendOsc99Response(e,t=""){let o=e.join(":");this._host.writeToProcess(`\x1B]99;${o};${t}\x1B\\`)}};var Tze=class extends x{constructor(e,t,o,n){super();this._ctx=e;this._configurationService=t;this._notificationService=o;this._logService=n;this._handler=this._register(new O8t({isEnabled:()=>this._configurationService.getValue("terminal.integrated.enableNotifications")===!0,isWindowFocused:()=>Ki().document.hasFocus(),isTerminalVisible:()=>this._ctx.instance.isVisible,focusTerminal:()=>this._ctx.instance.focus(!0),notify:r=>this._notificationService.notify(r),updateEnableNotifications:r=>this._configurationService.updateValue("terminal.integrated.enableNotifications",r),logWarn:r=>this._logService.warn(r),writeToProcess:r=>{this._ctx.instance.sendText(r,!1)}}))}static{this.ID="terminal.oscNotifications"}xtermReady(e){this._register(e.raw.parser.registerOscHandler(99,t=>this._handler.handleSequence(t)))}};Tze=I([m(1,B),m(2,Ne),m(3,ca)],Tze);Mp(Tze.ID,Tze);var xre=class extends x{constructor(e,t){super();this._configurationService=t;this._listener=this._register(new me)}static{this.ID="terminal.mouseWheelZoom"}static get(e){return e.getContribution(xre.ID)}xtermOpen(e){this._register(U.runAndSubscribe(this._configurationService.onDidChangeConfiguration,t=>{(!t||t.affectsConfiguration("terminal.integrated.mouseWheelZoom"))&&(this._configurationService.getValue("terminal.integrated.mouseWheelZoom")?this._setupMouseWheelZoomListener(e.raw):this._listener.clear())}))}_getConfigFontSize(){return this._configurationService.getValue("terminal.integrated.fontSize")}_clampFontSize(e){return TBi(e)}_setupMouseWheelZoomListener(e){let t=X1.INSTANCE,o=0,n=this._getConfigFontSize(),r=!1,s=0,l=c=>{if(t.isPhysicalMouseWheel()){if(this._hasMouseWheelZoomModifiers(c)){let u=c.deltaY>0?-1:1,p=this._clampFontSize(this._getConfigFontSize()+u);this._configurationService.updateValue("terminal.integrated.fontSize",p),c.preventDefault(),c.stopPropagation()}}else if(Date.now()-o>50&&(n=this._getConfigFontSize(),r=this._hasMouseWheelZoomModifiers(c),s=0),o=Date.now(),s+=c.deltaY,r){let u=Math.ceil(Math.abs(s/5)),p=s>0?-1:1,h=u*p,g=this._clampFontSize(n+h);this._configurationService.updateValue("terminal.integrated.fontSize",g),s+=c.deltaY,c.preventDefault(),c.stopPropagation()}};this._listener.value=j(e.element,re.MOUSE_WHEEL,l,{capture:!0,passive:!1})}_hasMouseWheelZoomModifiers(e){return Ze?(e.metaKey||e.ctrlKey)&&!e.shiftKey&&!e.altKey:e.ctrlKey&&!e.metaKey&&!e.shiftKey&&!e.altKey}};xre=I([m(1,B)],xre);Mp(xre.ID,xre,!0);Er({id:"workbench.action.terminal.fontZoomIn",title:L(15735,"Increase Font Size"),run:async(a,i)=>{let e=i.get(B),t=e.getValue("terminal.integrated.fontSize");if(Yo(t)){let o=TBi(t+1);await e.updateValue("terminal.integrated.fontSize",o)}}});Er({id:"workbench.action.terminal.fontZoomOut",title:L(15736,"Decrease Font Size"),run:async(a,i)=>{let e=i.get(B),t=e.getValue("terminal.integrated.fontSize");if(Yo(t)){let o=TBi(t-1);await e.updateValue("terminal.integrated.fontSize",o)}}});Er({id:"workbench.action.terminal.fontZoomReset",title:L(15737,"Reset Font Size"),run:async(a,i)=>{await i.get(B).updateValue("terminal.integrated.fontSize",OVi)}});function TBi(a){return Math.max(6,Math.min(100,a))}Mp(YW.ID,YW);Er({id:"workbench.action.terminal.toggleStickyScroll",title:L(15596,"Toggle Sticky Scroll"),toggled:{condition:C.equals("config.terminal.integrated.stickyScroll.enabled",!0),title:d(15595,null),mnemonicTitle:d(15594,null)},run:(a,i)=>{let e=i.get(B),t=!e.getValue("terminal.integrated.stickyScroll.enabled");return e.updateValue("terminal.integrated.stickyScroll.enabled",t)},menu:[{id:D.TerminalStickyScrollContext}]});var UU=[],Gq=class extends Lh{constructor(e,t,o,n,r,s,l){super(Gq.PREFIX,{canAcceptInBackground:!0});this._commandService=e;this._editorService=t;this._instantiationService=o;this._terminalEditorService=n;this._terminalGroupService=r;this._terminalService=s;this._themeService=l}static{this.PREFIX="term "}_getPicks(e){UU=[],UU.push({type:"separator",label:"panel"});let t=this._terminalGroupService.groups;for(let s=0;s<t.length;s++){let l=t[s];for(let c=0;c<l.terminalInstances.length;c++){let u=l.terminalInstances[c],p=this._createPick(u,c,e,{groupIndex:s,groupSize:l.terminalInstances.length});p&&UU.push(p)}}UU.length>0&&UU.push({type:"separator",label:"editor"});let o=this._terminalEditorService.instances;for(let s=0;s<o.length;s++){let l=o[s];l.target=2;let c=this._createPick(l,s,e);c&&UU.push(c)}UU.length>0&&UU.push({type:"separator"});let n=d(15563,null);UU.push({label:`$(plus) ${n}`,ariaLabel:n,accept:()=>this._commandService.executeCommand("workbench.action.terminal.new")});let r=d(15564,null);return UU.push({label:`$(plus) ${r}`,ariaLabel:r,accept:()=>this._commandService.executeCommand("workbench.action.terminal.newWithProfile")}),UU}_createPick(e,t,o,n){let r=this._instantiationService.invokeFunction(MJ,e),s=n?n.groupSize>1?`${n.groupIndex+1}.${t+1}`:`${n.groupIndex+1}`:`${t+1}`,l=`$(${r}) ${s}: ${e.title}`,c=[],u=by(e);u&&c.push(u);let p=SD(e,this._themeService.getColorTheme().type);p&&c.push(...p);let h=lm(o,l,!0);if(h)return{label:l,description:e.description,highlights:{label:h},buttons:[{iconClass:q.asClassName(fbo),tooltip:d(15562,null)},{iconClass:q.asClassName(SKt),tooltip:sr.kill.value}],iconClasses:c,trigger:g=>{switch(g){case 0:return this._commandService.executeCommand("workbench.action.terminal.rename",e),0;case 1:return this._terminalService.safeDisposeTerminal(e),3}return 0},accept:(g,f)=>{if(e.target===2){let v=this._editorService.findEditors(e.resource);this._terminalEditorService.openEditor(e,{viewColumn:v?.[0].groupId}),this._terminalEditorService.setActiveInstance(e)}else this._terminalGroupService.showPanel(!f.inBackground),this._terminalGroupService.setActiveInstance(e)}}}};Gq=I([m(0,ge),m(1,ee),m(2,F),m(3,Fv),m(4,lc),m(5,nn),m(6,Le)],Gq);var Sfn=ne.as(Ku.Quickaccess),Ifn="inTerminalPicker";Sfn.registerQuickAccessProvider({ctor:Gq,prefix:Gq.PREFIX,contextKey:Ifn,placeholder:d(15561,null),helpEntries:[{description:d(15560,null),commandId:"workbench.action.quickOpenTerm"}]});var UDo="workbench.action.quickOpenNavigateNextInTerminalPicker";$e.registerCommand({id:UDo,handler:LD(UDo,!0)});var zDo="workbench.action.quickOpenNavigatePreviousInTerminalPicker";$e.registerCommand({id:zDo,handler:LD(zDo,!1)});Er({id:"workbench.action.quickOpenTerm",title:L(15559,"Switch Active Terminal"),precondition:C.or(dt.processSupported,dt.terminalHasBeenCreated),run:(a,i)=>i.get(Ue).quickAccess.show(Gq.PREFIX)});var yfn=["quick-fix","codicon","terminal-command-decoration","xterm-decoration"],_ze=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this._sessionId=e;this._aliases=t;this._capabilities=o;this._accessibilitySignalService=n;this._actionWidgetService=r;this._commandService=s;this._configurationService=l;this._extensionService=c;this._labelService=u;this._openerService=p;this._telemetryService=h;this._quickFixService=g;this._commandListeners=new Map;this._decoration=this._register(new me);this._decorationDisposables=this._register(new me);this._registeredSelectors=new Set;this._didRun=!1;this._onDidRequestRerunCommand=this._register(new E);this.onDidRequestRerunCommand=this._onDidRequestRerunCommand.event;this._onDidUpdateQuickFixes=this._register(new E);this.onDidUpdateQuickFixes=this._onDidUpdateQuickFixes.event;this._capabilities.get(2)?this._registerCommandHandlers():this._register(this._capabilities.onDidAddCommandDetectionCapability(()=>{this._registerCommandHandlers()})),this._register(this._quickFixService.onDidRegisterProvider(v=>this.registerCommandFinishedListener(Cfn(v)))),this._quickFixService.extensionQuickFixes.then(v=>{for(let b of v)this.registerCommandSelector(b)}),this._register(this._quickFixService.onDidRegisterCommandSelector(v=>this.registerCommandSelector(v))),this._register(this._quickFixService.onDidUnregisterProvider(v=>this._commandListeners.delete(v))),this._register(this._configurationService.onDidChangeConfiguration(v=>{v.affectsConfiguration("terminal.integrated.shellIntegration.quickFixEnabled")&&(this._decoration.clear(),this._decorationDisposables.clear())}))}activate(e){this._terminal=e}showMenu(){if(!this._currentRenderContext)return;let e=this._currentRenderContext.quickFixes.map(n=>new _Bi(n,n.type,n.source,n.label,n.kind)),t={allActions:e,hasAutoFix:!1,hasAIFix:!1,allAIFixes:!1,validActions:e,dispose:()=>{}},o={onSelect:async n=>{n.action?.run(),this._actionWidgetService.hide()},onHide:()=>{this._terminal?.focus()}};this._actionWidgetService.show("quickFixWidget",!1,xfn(t.validActions,!0),o,this._currentRenderContext.anchor,this._currentRenderContext.parentElement)}registerCommandSelector(e){if(this._registeredSelectors.has(e.id))return;let t=e.commandLineMatcher.toString(),o=this._commandListeners.get(t)||[];o.push({id:e.id,type:"unresolved",commandLineMatcher:e.commandLineMatcher,outputMatcher:e.outputMatcher,commandExitResult:e.commandExitResult,kind:e.kind}),this._registeredSelectors.add(e.id),this._commandListeners.set(t,o)}registerCommandFinishedListener(e){let t=e.commandLineMatcher.toString(),o=this._commandListeners.get(t)||[];o=o.filter(n=>n.id!==e.id),o.push(e),this._commandListeners.set(t,o)}_registerCommandHandlers(){let e=this._terminal,t=this._capabilities.get(2);!e||!t||this._register(t.onCommandFinished(async o=>await this._resolveQuickFixes(o,this._aliases)))}async _resolveQuickFixes(e,t){let o=this._terminal;if(!o||e.wasReplayed)return;e.command!==""&&this._lastQuickFixId&&this._disposeQuickFix(e,this._lastQuickFixId);let n=async(s,l)=>{if(l===void 0)return;let c=s.id;return await this._extensionService.activateByEvent(`onTerminalQuickFixRequest:${c}`),this._quickFixService.providers.get(c)?.provideTerminalQuickFixes(e,l,{type:"resolved",commandLineMatcher:s.commandLineMatcher,outputMatcher:s.outputMatcher,commandExitResult:s.commandExitResult,kind:s.kind,id:s.id},new Ye().token)},r=await wfn(t,o,e,this._commandListeners,this._commandService,this._openerService,this._labelService,this._onDidRequestRerunCommand,n);r&&(this._quickFixes=r,this._lastQuickFixId=this._quickFixes[0].id,this._registerQuickFixDecoration(),this._onDidUpdateQuickFixes.fire({command:e,actions:this._quickFixes}),this._quickFixes=void 0)}_disposeQuickFix(e,t){this._telemetryService?.publicLog2("terminal/quick-fix",{quickFixId:t,ranQuickFix:this._didRun,terminalSessionId:this._sessionId}),this._decoration.clear(),this._decorationDisposables.clear(),this._onDidUpdateQuickFixes.fire({command:e,actions:this._quickFixes}),this._quickFixes=void 0,this._lastQuickFixId=void 0,this._didRun=!1}_registerQuickFixDecoration(){if(!this._terminal||!this._configurationService.getValue("terminal.integrated.shellIntegration.quickFixEnabled"))return;this._decoration.clear(),this._decorationDisposables.clear();let t=this._quickFixes;if(!t||t.length===0)return;let o=this._terminal.registerMarker();if(!o)return;let n=this._decoration.value=this._terminal.registerDecoration({marker:o,width:2,layer:"top"});if(!n)return;let r=this._decorationDisposables.value=new N;r.add(n.onRender(s=>{let l=s.getBoundingClientRect(),c={x:l.x,y:l.y,width:l.width,height:l.height};if(s.classList.contains("quick-fix")){this._currentRenderContext&&(this._currentRenderContext.anchor=c);return}s.classList.add(...yfn);let u=t.every(h=>h.kind==="explain");u&&s.classList.add("explainOnly"),s.classList.add(...q.asClassNameArray(u?R.sparkle:R.lightBulb)),VOe(this._configurationService,s),this._accessibilitySignalService.playSignal($o.terminalQuickFix);let p=s.closest(".xterm")?.parentElement;p&&(this._currentRenderContext={quickFixes:t,anchor:c,parentElement:p},this._register(j(s,re.CLICK,()=>this.showMenu())))})),r.add(n.onDispose(()=>this._currentRenderContext=void 0))}};_ze=I([m(3,lr),m(4,td),m(5,ge),m(6,B),m(7,lt),m(8,rt),m(9,Je),m(10,Te),m(11,g_e)],_ze);async function wfn(a,i,e,t,o,n,r,s,l){let c=new Set,u=new Set,p=[],h=e.command;for(let g of t.values())for(let f of g){if(f.commandExitResult==="success"&&e.exitCode!==0||f.commandExitResult==="error"&&e.exitCode===0)continue;let v;if(f.type==="resolved")v=await f.getQuickFixes(e,OFi(i.buffer.active,e,i.cols,f.outputMatcher),f,new Ye().token);else if(f.type==="unresolved"){if(!l)throw new Error("No resolved fix provider");v=await l(f,f.outputMatcher?OFi(i.buffer.active,e,i.cols,f.outputMatcher):void 0)}else if(f.type==="internal"){let b=h.match(f.commandLineMatcher);if(!b)continue;let S=f.outputMatcher,y;if(S&&(y=e.getOutputMatch(S)),!y)continue;let w={commandLineMatch:b,outputMatch:y,commandLine:e.command};v=f.getQuickFixes(w)}if(v)for(let b of cc(v)){let S;if(No(b,{type:!0})){switch(b.type){case 0:{let y=b;if(c.has(y.terminalCommand))continue;c.add(y.terminalCommand);let w=d(15566,null,y.terminalCommand);S={type:0,kind:f.kind,class:void 0,source:b.source,id:b.id,label:w,enabled:!0,run:()=>{s?.fire({command:y.terminalCommand,shouldExecute:y.shouldExecute??!0})},tooltip:w,command:y.terminalCommand,shouldExecute:y.shouldExecute};break}case 1:{let y=b;if(!y.uri)return;if(u.has(y.uri.toString()))continue;u.add(y.uri.toString());let k=y.uri.scheme===Q.http||y.uri.scheme===Q.https?encodeURI(y.uri.toString(!0)):r.getUriLabel(y.uri),T=d(15567,null,k);S={source:b.source,id:b.id,label:T,type:1,kind:f.kind,class:void 0,enabled:!0,run:()=>n.open(y.uri),tooltip:T,uri:y.uri};break}case 2:{let y=b;S={source:"builtin",type:y.type,kind:f.kind,id:y.id,label:y.label,class:y.class,enabled:y.enabled,run:()=>{y.run()},tooltip:y.tooltip};break}case 3:{let y=b;S={source:b.source,type:y.type,kind:f.kind,id:y.id,label:y.title,class:void 0,enabled:!0,run:()=>o.executeCommand(y.id),tooltip:y.title};break}}S&&p.push(S)}}}return p.length>0?p:void 0}function Cfn(a){return{id:a.selector.id,type:"resolved",commandLineMatcher:a.selector.commandLineMatcher,outputMatcher:a.selector.outputMatcher,commandExitResult:a.selector.commandExitResult,kind:a.selector.kind,getQuickFixes:a.provider.provideTerminalQuickFixes}}var _Bi=class{constructor(i,e,t,o,n="fix"){this.action=i;this.type=e;this.source=t;this.title=o;this.kind=n;this.disabled=!1}};function xfn(a,i){let e=[];e.push({kind:"header",group:{kind:xr.QuickFix,title:d(15565,null)}});for(let t of i?a:a.filter(o=>!!o.action))!t.disabled&&t.action&&e.push({kind:"action",item:t,group:{kind:xr.QuickFix,icon:kfn(t),title:t.action.label},disabled:!1,label:t.title});return e}function kfn(a){if(a.kind==="explain")return R.sparkle;switch(a.type){case 1:if(a.action.uri)return a.action.uri.scheme===Q.http||a.action.uri.scheme===Q.https?R.linkExternal:R.goToFile;case 0:return R.run;case 2:return R.debugDisconnect;case 3:return R.lightbulb}}var DBi=/git/,Efn=/and can be fast-forwarded/,qDo=/git\s+push/,Tfn=/error: did you mean `--(.+)` \(with two dashes\)\?/,_fn=/(?:(most similar commands? (is|are)))/,Dfn=/(?:address already in use (?:0\.0\.0\.0|127\.0\.0\.1|localhost|::):|Unable to bind [^ ]*:|can't listen on port |listen EADDRINUSE [^ ]*:)(?<portNumber>\d{4,5})/,Lfn=/git push --set-upstream origin (?<branchName>[^\s]+)/,Rfn=/remote:\s*(?<link>https:\/\/github\.com\/.+\/.+\/pull\/new\/.+)/,KDo=/Suggestion \[General\]:/,GDo=/Suggestion \[cmd-not-found\]:/;function $Do(){return{id:"Git Similar",type:"internal",commandLineMatcher:DBi,outputMatcher:{lineMatcher:_fn,anchor:"bottom",offset:0,length:10},commandExitResult:"error",getQuickFixes:a=>{let i=a.outputMatch?.regexMatch[0];if(!i||!a.outputMatch)return;let e=[],t=a.outputMatch.outputLines.findIndex(n=>n.includes(i))+1,o=a.outputMatch.outputLines.map(n=>n.trim());for(let n=t;n<o.length;n++){let r=o[n];r&&e.push({id:"Git Similar",type:0,terminalCommand:a.commandLine.replace(/git\s+[^\s]+/,()=>`git ${r}`),shouldExecute:!0,source:"builtin"})}return e}}}function jDo(){return{id:"Git Fast Forward Pull",type:"internal",commandLineMatcher:DBi,outputMatcher:{lineMatcher:Efn,anchor:"bottom",offset:0,length:8},commandExitResult:"success",getQuickFixes:a=>({type:0,id:"Git Fast Forward Pull",terminalCommand:"git pull",shouldExecute:!0,source:"builtin"})}}function QDo(){return{id:"Git Two Dashes",type:"internal",commandLineMatcher:DBi,outputMatcher:{lineMatcher:Tfn,anchor:"bottom",offset:0,length:2},commandExitResult:"error",getQuickFixes:a=>{let i=a?.outputMatch?.regexMatch?.[1];if(i)return{type:0,id:"Git Two Dashes",terminalCommand:a.commandLine.replace(` -${i}`,()=>` --${i}`),shouldExecute:!0,source:"builtin"}}}}function YDo(a){return{id:"Free Port",type:"internal",commandLineMatcher:/.+/,outputMatcher:{lineMatcher:Dfn,anchor:"bottom",offset:0,length:30},commandExitResult:"error",getQuickFixes:i=>{let e=i?.outputMatch?.regexMatch?.groups?.portNumber;if(!e)return;let t=d(15570,null,e);return{type:2,class:void 0,tooltip:t,id:"Free Port",label:t,enabled:!0,source:"builtin",run:()=>a(e,i.commandLine)}}}}function XDo(){return{id:"Git Push Set Upstream",type:"internal",commandLineMatcher:qDo,outputMatcher:{lineMatcher:Lfn,anchor:"bottom",offset:0,length:8},commandExitResult:"error",getQuickFixes:a=>{let i=a.outputMatch,e="git push --set-upstream origin ${group:branchName}";if(!i)return;let t=i.regexMatch.groups;if(!t)return;let o=[],n=e;for(let[r,s]of Object.entries(t)){let l=`\${group:${r}}`;if(!e.includes(l))return[];n=n.replaceAll(l,()=>s)}if(n)return o.push({type:0,id:"Git Push Set Upstream",terminalCommand:n,shouldExecute:!0,source:"builtin"}),o}}}function JDo(){return{id:"Git Create Pr",type:"internal",commandLineMatcher:qDo,outputMatcher:{lineMatcher:Rfn,anchor:"bottom",offset:4,length:12},commandExitResult:"success",getQuickFixes:a=>{let i=a?.outputMatch?.regexMatch?.groups?.link?.trimEnd();return i?{id:"Git Create Pr",label:d(15569,null,i),enabled:!0,type:1,uri:A.parse(i),source:"builtin"}:void 0}}}function ZDo(){return{id:"Pwsh General Error",type:"internal",commandLineMatcher:/.+/,outputMatcher:{lineMatcher:KDo,anchor:"bottom",offset:0,length:10},commandExitResult:"error",getQuickFixes:a=>{let i=a.outputMatch?.regexMatch.input?.split(`
`);if(!i)return;let e=0,t=!1;for(;e<i.length;e++)if(i[e].match(KDo)){t=!0;break}if(!t)return;let o=i[e+1].match(/The most similar commands are: (?<values>.+)./)?.groups?.values?.split(", ");if(!o)return;let n=[];for(let r of o)n.push({id:"Pwsh General Error",type:0,terminalCommand:r,source:"builtin"});return n}}}function eLo(){return{id:"Unix Command Not Found",type:"internal",commandLineMatcher:/.+/,outputMatcher:{lineMatcher:GDo,anchor:"bottom",offset:0,length:10},commandExitResult:"error",getQuickFixes:a=>{let i=a.outputMatch?.regexMatch.input?.split(`
`);if(!i)return;let e=0,t=!1;for(;e<i.length;e++)if(i[e].match(GDo)){t=!0;break}if(!t)return;let o=[],n=!1;for(;e<i.length;e++){let r=i[e].trim();if(r.length===0)break;let s=r.match(/You also have .+ installed, you can run '(?<command>.+)' instead./)?.groups?.command;if(s){o.push({id:"Pwsh Unix Command Not Found Error",type:0,terminalCommand:s,source:"builtin"}),n=!1;continue}if(r.match(/Command '.+' not found, but can be installed with:/)){n=!0;continue}n&&o.push({id:"Pwsh Unix Command Not Found Error",type:0,terminalCommand:r.trim(),source:"builtin"})}return o}}}var F8t=class{constructor(){this._selectors=new Map;this._providers=new Map;this._pendingProviders=new Map;this._onDidRegisterProvider=new E;this.onDidRegisterProvider=this._onDidRegisterProvider.event;this._onDidRegisterCommandSelector=new E;this.onDidRegisterCommandSelector=this._onDidRegisterCommandSelector.event;this._onDidUnregisterProvider=new E;this.onDidUnregisterProvider=this._onDidUnregisterProvider.event;this.extensionQuickFixes=new Promise(i=>Mfn.setHandler(e=>{i(e.filter(t=>Ua(t.description,"terminalQuickFixProvider")).map(t=>t.value?t.value.map(o=>({...o,extensionIdentifier:t.description.identifier.value})):[]).flat())})),this.extensionQuickFixes.then(i=>{for(let e of i)this.registerCommandSelector(e)})}get providers(){return this._providers}registerCommandSelector(i){this._selectors.set(i.id,i),this._onDidRegisterCommandSelector.fire(i);let e=this._pendingProviders.get(i.id);e&&(this._pendingProviders.delete(i.id),this._providers.set(i.id,e),this._onDidRegisterProvider.fire({selector:i,provider:e}))}registerQuickFixProvider(i,e){let t=!1;return this.extensionQuickFixes.then(()=>{if(t)return;let o=this._selectors.get(i);o?(this._providers.set(i,e),this._onDidRegisterProvider.fire({selector:o,provider:e})):this._pendingProviders.set(i,e)}),Z(()=>{t=!0,this._providers.delete(i),this._pendingProviders.delete(i);let o=this._selectors.get(i);o&&(this._selectors.delete(i),this._onDidUnregisterProvider.fire(o.id))})}},Mfn=Rn.registerExtensionPoint({extensionPoint:"terminalQuickFixes",defaultExtensionKind:["workspace"],activationEventsGenerator:function*(a){for(let i of a??[])yield`onTerminalQuickFixRequest:${i.id}`},jsonSchema:{description:d(15571,null),type:"array",items:{type:"object",additionalProperties:!1,required:["id","commandLineMatcher","outputMatcher","commandExitResult"],defaultSnippets:[{body:{id:"$1",commandLineMatcher:"$2",outputMatcher:"$3",exitStatus:"$4"}}],properties:{id:{description:d(15574,null),type:"string"},commandLineMatcher:{description:d(15573,null),type:"string"},outputMatcher:{markdownDescription:d(15576,null),type:"object",required:["lineMatcher","anchor","offset","length"],properties:{lineMatcher:{description:"A regular expression or string to test the command line against",type:"string"},anchor:{description:"Where the search should begin in the buffer",enum:["top","bottom"]},offset:{description:"The number of lines vertically from the anchor in the buffer to start matching against",type:"number"},length:{description:"The number of rows to match against, this should be as small as possible for performance reasons",type:"number"}}},commandExitResult:{description:d(15572,null),enum:["success","error"],enumDescriptions:["The command exited with an exit code of zero.","The command exited with a non-zero exit code."]},kind:{description:d(15575,null,'`"fix"`'),enum:["default","explain"],enumDescriptions:["A high confidence quick fix.","An explanation of the problem."]}}}}});Ee(g_e,F8t,1);var W6=class extends N{constructor(e,t){super();this._ctx=e;this._instantiationService=t;this._quickFixMenuItems=this.add(new me)}static{this.ID="quickFix"}static get(e){return e.getContribution(W6.ID)}get addon(){return this._addon}xtermReady(e){this._addon=this._instantiationService.createInstance(_ze,this._ctx.instance.sessionId,void 0,this._ctx.instance.capabilities),e.raw.loadAddon(this._addon),this.add(this._addon.onDidRequestRerunCommand(t=>this._ctx.instance.runCommand(t.command,t.shouldExecute||!1))),this.add(this._addon.onDidUpdateQuickFixes(t=>{this._quickFixMenuItems.value=t.actions?e.decorationAddon.registerMenuItems(t.command,t.actions):void 0}));for(let t of[QDo(),jDo(),YDo((o,n)=>this._ctx.instance.freePortKillProcess(o,n)),$Do(),XDo(),JDo(),eLo(),ZDo()])this._addon.registerCommandFinishedListener(t)}};W6=I([m(1,F)],W6);Mp(W6.ID,W6);Jl({id:"workbench.action.terminal.showQuickFixes",title:L(15568,"Show Terminal Quick Fixes"),precondition:dt.focus,keybinding:{primary:2137,weight:200},run:a=>W6.get(a)?.addon?.showMenu()});var Pfn=/^\x1b\[[0-9;]*m/,Afn=/^\x1b\[?([0-9]*)(;[35])?O?([DC])/,Nfn=/[^a-z0-9]/i;var Ofn=/^(\x1b\[(\??25[hl]|\??[0-9;]+n))+/,OBi=a=>a._core,oLo=a=>{};var LBi=class a{constructor(i,e,t){this.rows=i;this.cols=e;this._buffer=t;this._x=0;this._y=1;this._baseY=1;this._x=t.cursorX,this._y=t.cursorY,this._baseY=t.baseY}get x(){return this._x}get y(){return this._y}get baseY(){return this._baseY}get coordinate(){return{x:this._x,y:this._y,baseY:this._baseY}}getLine(){return this._buffer.getLine(this._y+this._baseY)}getCell(i){return this.getLine()?.getCell(this._x,i)}moveTo(i){return this._x=i.x,this._y=i.y+i.baseY-this._baseY,this.moveInstruction()}clone(){let i=new a(this.rows,this.cols,this._buffer);return i.moveTo(this),i}move(i,e){return this._x=i,this._y=e,this.moveInstruction()}shift(i=0,e=0){return this._x+=i,this._y+=e,this.moveInstruction()}moveInstruction(){return this._y>=this.rows?(this._baseY+=this._y-(this.rows-1),this._y=this.rows-1):this._y<0&&(this._baseY-=this._y,this._y=0),`\x1B[${this._y+1};${this._x+1}H`}},Ffn=(a,i,e)=>{let t=!1;e<0&&i.shift(-1);let o;for(;i.x>=0;){if(o=i.getCell(o),!o?.getCode())return;let n=o.getChars();if(Nfn.test(n)){if(t)break}else t=!0;i.shift(e)}e<0&&i.shift(1)};var W8t=class{constructor(i){this._input=i;this.index=0}get remaining(){return this._input.length-this.index}get eof(){return this.index===this._input.length}get rest(){return this._input.slice(this.index)}eatChar(i){if(this._input[this.index]===i)return this.index++,i}eatStr(i){if(this._input.slice(this.index,i.length)===i)return this.index+=i.length,i}eatGradually(i){let e=this.index;for(let t=0;t<i.length;t++){if(t>0&&this.eof)return 2;if(!this.eatChar(i[t]))return this.index=e,1}return 0}eatRe(i){let e=i.exec(this._input.slice(this.index));if(e)return this.index+=e[0].length,e}eatCharCode(i=0,e=i+1){let t=this._input.charCodeAt(this.index);if(!(t<i||t>=e))return this.index++,t}},RBi=class{constructor(){this.clearAfterTimeout=!1}apply(){return""}rollback(){return""}rollForwards(){return""}matches(){return 1}},V8t=class{constructor(i){this.inner=i}apply(i,e){return this._appliedCursor=e.clone(),this.inner.apply(i,this._appliedCursor),""}rollback(i){return this.inner.rollback(i.clone()),""}rollForwards(i,e){return this._appliedCursor&&i.moveTo(this._appliedCursor),e}matches(i){return this.inner.matches(i)}},Wfn=a=>a instanceof V8t&&a.inner instanceof Nct,Nct=class a{constructor(i,e){this._style=i;this._char=e;this.affectsStyle=!0}apply(i,e){let t=e.getCell();return this.appliedAt=t?{pos:e.coordinate,oldAttributes:Oct(t),oldChar:t.getChars()}:{pos:e.coordinate,oldAttributes:"",oldChar:""},e.shift(1),this._style.apply+this._char+this._style.undo}rollback(i){if(!this.appliedAt)return"";let{oldAttributes:e,oldChar:t,pos:o}=this.appliedAt;return i.moveTo(o)+(t?`${e}${t}${i.moveTo(o)}`:"\x1B[X")}rollForwards(i,e){return this.appliedAt?i.clone().moveTo(this.appliedAt.pos)+e:""}matches(i,e){let t=i.index;for(;i.eatRe(Pfn););if(i.eof)return 2;if(i.eatChar(this._char))return 0;if(e instanceof a){let o=i.eatGradually(`\b${e._char}${this._char}`);if(o!==1)return o}return i.index=t,1}},B8t=class{constructor(i){this._terminal=i}apply(i,e){let t=!e.getLine()?.translateToString(void 0,e.x).trim(),o=e.coordinate,n=e.shift(-1),r=e.getCell();return this._appliedAt=r?{isLastChar:t,pos:o,oldAttributes:Oct(r),oldChar:r.getChars()}:{isLastChar:t,pos:o,oldAttributes:"",oldChar:""},n+"\x1B[X"}rollback(i){if(!this._appliedAt)return"";let{oldAttributes:e,oldChar:t,pos:o}=this._appliedAt;return t?e+t+i.moveTo(o)+Oct(OBi(this._terminal)._inputHandler._curAttrData):i.moveTo(o)+"\x1B[X"}rollForwards(){return""}matches(i){if(this._appliedAt?.isLastChar){let e=i.eatGradually("\b\x1B[K");if(e!==1)return e;let t=i.eatGradually("\b \b");if(t!==1)return t}return 1}},H8t=class{apply(i,e){return this._prevPosition=e.coordinate,e.move(0,e.y+1),`\r
`}rollback(i){return this._prevPosition?i.moveTo(this._prevPosition):""}rollForwards(){return""}matches(i){return i.eatGradually(`\r
`)}},MBi=class extends H8t{apply(i,e){return this._prevPosition=e.coordinate,e.move(0,e.y+1)," \r"}matches(i){let e=i.eatGradually(" \r");return e!==1?i.eatGradually("\x1B[K")===2?2:e:i.eatGradually(`\r
`)}},Act=class{constructor(i,e,t){this._direction=i;this._moveByWords=e;this._amount=t}apply(i,e){let t=e.x,o=e.getCell(),n=o?Oct(o):"",{_amount:r,_direction:s,_moveByWords:l}=this,c=s==="D"?-1:1,u=e.clone();if(l)for(let p=0;p<r;p++)Ffn(i,u,c);else u.shift(c*r);return this._applied={amount:Math.abs(e.x-u.x),prevPosition:t,prevAttrs:n,rollForward:e.moveTo(u)},this._applied.rollForward}rollback(i){return this._applied?i.move(this._applied.prevPosition,i.y)+this._applied.prevAttrs:""}rollForwards(){return""}matches(i){if(!this._applied)return 1;let e=this._direction,{amount:t,rollForward:o}=this._applied;if(i.eatStr(`\x1B[${e}`.repeat(t))||e==="D"&&i.eatStr("\b".repeat(t)))return 0;if(o){let n=i.eatGradually(o);if(n!==1)return n}return i.eatGradually(`\x1B[${t}${e}`)}},PBi=class extends x{constructor(e){super();this._stats=[];this._index=0;this._addedAtTime=new WeakMap;this._changeEmitter=this._register(new E);this.onChange=this._changeEmitter.event;this._register(e.onPredictionAdded(t=>this._addedAtTime.set(t,Date.now()))),this._register(e.onPredictionSucceeded(this._pushStat.bind(this,!0))),this._register(e.onPredictionFailed(this._pushStat.bind(this,!1)))}get accuracy(){let e=0;for(let[,t]of this._stats)t&&e++;return e/(this._stats.length||1)}get sampleSize(){return this._stats.length}get latency(){let e=this._stats.filter(([,t])=>t).map(([t])=>t).sort();return{count:e.length,min:e[0],median:e[Math.floor(e.length/2)],max:e[e.length-1]}}get maxLatency(){let e=-1/0;for(let[t,o]of this._stats)o&&(e=Math.max(t,e));return e}_pushStat(e,t){let o=this._addedAtTime.get(t);this._stats[this._index]=[Date.now()-o,e],this._index=(this._index+1)%24,this._changeEmitter.fire()}},ABi=class extends x{constructor(e,t){super();this.terminal=e;this._style=t;this._expected=[];this._currentGen=0;this._showPredictions=!1;this._addedEmitter=this._register(new E);this.onPredictionAdded=this._addedEmitter.event;this._failedEmitter=this._register(new E);this.onPredictionFailed=this._failedEmitter.event;this._succeededEmitter=this._register(new E);this.onPredictionSucceeded=this._succeededEmitter.event}get _currentGenerationPredictions(){return this._expected.filter(({gen:e})=>e===this._expected[0].gen).map(({p:e})=>e)}get isShowingPredictions(){return this._showPredictions}get length(){return this._expected.length}setShowPredictions(e){if(e===this._showPredictions)return;this._showPredictions=e;let t=this._getActiveBuffer();if(!t)return;let o=this._currentGenerationPredictions;e?(this.clearCursor(),this._style.expectIncomingStyle(o.reduce((n,r)=>r.affectsStyle?n+1:n,0)),this.terminal.write(o.map(n=>n.apply(t,this.physicalCursor(t))).join(""))):this.terminal.write(o.reverse().map(n=>n.rollback(this.physicalCursor(t))).join(""))}undoAllPredictions(){let e=this._getActiveBuffer();this._showPredictions&&e&&this.terminal.write(this._currentGenerationPredictions.reverse().map(t=>t.rollback(this.physicalCursor(e))).join("")),this._expected=[]}beforeServerInput(e){let t=e;if(this._inputBuffer&&(e=this._inputBuffer+e,this._inputBuffer=void 0),!this._expected.length)return this._clearPredictionState(),e;let o=this._getActiveBuffer();if(!o)return this._clearPredictionState(),e;let n="",r=new W8t(e),s=this._expected[0].gen,l=()=>{let c=r.eatRe(Ofn);c&&(n+=c[0])};e:for(;this._expected.length&&r.remaining>0;){l();let{p:c,gen:u}=this._expected[0],p=this.physicalCursor(o),h=r.index;switch(c.matches(r,this._lookBehind)){case 0:{let g=e.slice(h,r.index);u===s?n+=c.rollForwards?.(p,g):(c.apply(o,this.physicalCursor(o)),n+=g),this._succeededEmitter.fire(c),this._lookBehind=c,this._expected.shift();break}case 2:this._inputBuffer=e.slice(h),r.index=e.length;break e;case 1:{let g=this._expected.filter(f=>f.gen===s).reverse();n+=g.map(({p:f})=>f.rollback(this.physicalCursor(o))).join(""),g.some(f=>f.p.affectsStyle)&&(n+=Oct(OBi(this.terminal)._inputHandler._curAttrData)),this._clearPredictionState(),this._failedEmitter.fire(c);break e}}}if(l(),r.eof||(n+=r.rest,this._clearPredictionState()),this._expected.length&&s!==this._expected[0].gen)for(let{p:c,gen:u}of this._expected){if(u!==this._expected[0].gen)break;c.affectsStyle&&this._style.expectIncomingStyle(),n+=c.apply(o,this.physicalCursor(o))}return this._showPredictions?(n.length===0||n===e||(this._physicalCursor&&(n+=this._physicalCursor.moveInstruction()),n="\x1B[?25l"+n+"\x1B[?25h"),n):t}_clearPredictionState(){this._expected=[],this.clearCursor(),this._lookBehind=void 0}addPrediction(e,t){if(this._expected.push({gen:this._currentGen,p:t}),this._addedEmitter.fire(t),this._currentGen!==this._expected[0].gen)return t.apply(e,this.tentativeCursor(e)),!1;let o=t.apply(e,this.physicalCursor(e));return this._tenativeCursor=void 0,this._showPredictions&&o&&(t.affectsStyle&&this._style.expectIncomingStyle(),this.terminal.write(o)),!0}addBoundary(e,t){let o=!1;return e&&t&&(o=this.addPrediction(e,new V8t(t)),t.apply(e,this.tentativeCursor(e))),this._currentGen++,o}peekEnd(){return this._expected[this._expected.length-1]?.p}peekStart(){return this._expected[0]?.p}physicalCursor(e){return this._physicalCursor||(this._showPredictions&&oLo(this.terminal),this._physicalCursor=new LBi(this.terminal.rows,this.terminal.cols,e)),this._physicalCursor}tentativeCursor(e){return this._tenativeCursor||(this._tenativeCursor=this.physicalCursor(e).clone()),this._tenativeCursor}clearCursor(){this._physicalCursor=void 0,this._tenativeCursor=void 0}_getActiveBuffer(){let e=this.terminal.buffer.active;return e.type==="normal"?e:void 0}},nLo=a=>{if(a.isAttributeDefault())return[0];let i=[];return a.isBold()&&i.push(1),a.isDim()&&i.push(2),a.isItalic()&&i.push(3),a.isUnderline()&&i.push(4),a.isBlink()&&i.push(5),a.isInverse()&&i.push(7),a.isInvisible()&&i.push(8),a.isFgRGB()&&i.push(38,2,a.getFgColor()>>>24,a.getFgColor()>>>16&255,a.getFgColor()&255),a.isFgPalette()&&i.push(38,5,a.getFgColor()),a.isFgDefault()&&i.push(39),a.isBgRGB()&&i.push(48,2,a.getBgColor()>>>24,a.getBgColor()>>>16&255,a.getBgColor()&255),a.isBgPalette()&&i.push(48,5,a.getBgColor()),a.isBgDefault()&&i.push(49),i},Oct=a=>`\x1B[${nLo(a).join(";")}m`,tLo=(a,i,e)=>{if(a.length-i>e.length)return!1;for(let t=0;t<e.length;t++,i++)if(e[i]!==a[i])return!1;return!0},Vfn=(a,i)=>{let e=[0,0,-1,0,0,0],t=0,o=0;do{let n=a[i+o];if(e[o+t]=Yo(n)?n:n[0],!Yo(n)){let r=0;do e[1]===5&&(t=1),e[o+r+1+t]=n[r];while(++r<n.length&&r+o+1+t<e.length);break}if(e[1]===5&&o+t>=2||e[1]===2&&o+t>=5)break;e[1]&&(t=1)}while(++o+i<a.length&&o+t<e.length);return o},Dze=class Dze{constructor(i,e){this._terminal=e;this._expectedIncomingStyles=0;this.onUpdate(i)}static _compileArgs(i){return`\x1B[${i.join(";")}m`}expectIncomingStyle(i=1){this._expectedIncomingStyles+=i*2}startTracking(){this._expectedIncomingStyles=0,this._onDidWriteSGR(nLo(OBi(this._terminal)._inputHandler._curAttrData)),this._csiHandler=this._terminal.parser.registerCsiHandler({final:"m"},i=>(this._onDidWriteSGR(i),!1))}debounceStopTracking(){this._stopTracking()}dispose(){this._stopTracking()}_stopTracking(){this._csiHandler?.dispose(),this._csiHandler=void 0}_onDidWriteSGR(i){let e=this._undoArgs;for(let t=0;t<i.length;){let o=i[t],n=Yo(o)?o:o[0];if(this._expectedIncomingStyles){if(tLo(i,t,this._undoArgs)){this._expectedIncomingStyles--,t+=this._undoArgs.length;continue}if(tLo(i,t,this._applyArgs)){this._expectedIncomingStyles--,t+=this._applyArgs.length;continue}}let r=n===38||n===48||n===58?Vfn(i,t):1;switch(this._applyArgs[0]){case 1:n===2?this._undoArgs=[22,2]:(n===22||n===0)&&(this._undoArgs=[22]);break;case 2:n===1?this._undoArgs=[22,1]:(n===22||n===0)&&(this._undoArgs=[22]);break;case 38:n===0||n===39||n===100?this._undoArgs=[39]:(n>=30&&n<=38||n>=90&&n<=97)&&(this._undoArgs=i.slice(t,t+r));break;default:n===this._applyArgs[0]?this._undoArgs=this._applyArgs:n===0&&(this._undoArgs=this._originalUndoArgs)}t+=r}e!==this._undoArgs&&(this.undo=Dze._compileArgs(this._undoArgs))}onUpdate(i){let{applyArgs:e,undoArgs:t}=this._getArgs(i);this._applyArgs=e,this._undoArgs=this._originalUndoArgs=t,this.apply=Dze._compileArgs(this._applyArgs),this.undo=Dze._compileArgs(this._undoArgs)}_getArgs(i){switch(i){case"bold":return{applyArgs:[1],undoArgs:[22]};case"dim":return{applyArgs:[2],undoArgs:[22]};case"italic":return{applyArgs:[3],undoArgs:[23]};case"underlined":return{applyArgs:[4],undoArgs:[24]};case"inverted":return{applyArgs:[7],undoArgs:[27]};default:{let e;try{e=We.fromHex(i)}catch{e=new We(new zt(255,0,0,1))}let{r:t,g:o,b:n}=e.rgba;return{applyArgs:[38,2,t,o,n],undoArgs:[39]}}}}};I([Zd(2e3)],Dze.prototype,"debounceStopTracking",1);var NBi=Dze,iLo=(a=Qgi)=>new RegExp(`\\b(${a.map(ns).join("|")})\\b`,"i");var vbe=class extends x{constructor(e,t,o){super();this._processManager=e;this._configurationService=t;this._telemetryService=o;this._terminalTitle="";this._typeaheadThreshold=this._configurationService.getValue(Vv).localEchoLatencyThreshold,this._excludeProgramRe=iLo(this._configurationService.getValue(Vv).localEchoExcludePrograms),this._register(Z(()=>this._clearPredictionDebounce?.dispose()))}activate(e){let t=this._typeaheadStyle=this._register(new NBi(this._configurationService.getValue(Vv).localEchoStyle,e)),o=this._timeline=this._register(new ABi(e,this._typeaheadStyle)),n=this.stats=this._register(new PBi(this._timeline));o.setShowPredictions(this._typeaheadThreshold===0),this._register(e.onData(s=>this._onUserData(s))),this._register(e.onTitleChange(s=>{this._terminalTitle=s,this._reevaluatePredictorState(n,o)})),this._register(e.onResize(()=>{o.setShowPredictions(!1),o.clearCursor(),this._reevaluatePredictorState(n,o)})),this._register(this._configurationService.onDidChangeConfiguration(s=>{s.affectsConfiguration(Vv)&&(t.onUpdate(this._configurationService.getValue(Vv).localEchoStyle),this._typeaheadThreshold=this._configurationService.getValue(Vv).localEchoLatencyThreshold,this._excludeProgramRe=iLo(this._configurationService.getValue(Vv).localEchoExcludePrograms),this._reevaluatePredictorState(n,o))})),this._register(this._timeline.onPredictionSucceeded(s=>{this._lastRow?.charState===1&&Wfn(s)&&s.inner.appliedAt&&s.inner.appliedAt.pos.y+s.inner.appliedAt.pos.baseY===this._lastRow.y&&(this._lastRow.charState=2)})),this._register(this._processManager.onBeforeProcessData(s=>this._onBeforeProcessData(s)));let r;this._register(n.onChange(()=>{r||(r=setTimeout(()=>{this._sendLatencyStats(n),r=void 0},3e5)),o.length===0&&t.debounceStopTracking(),this._reevaluatePredictorState(n,o)}))}reset(){this._lastRow=void 0}_deferClearingPredictions(){if(!(!this.stats||!this._timeline)){if(this._clearPredictionDebounce?.dispose(),this._timeline.length===0||this._timeline.peekStart()?.clearAfterTimeout===!1){this._clearPredictionDebounce=void 0;return}this._clearPredictionDebounce=tn(()=>{this._timeline?.undoAllPredictions(),this._lastRow?.charState===1&&(this._lastRow.charState=0)},Math.max(500,this.stats.maxLatency*3/2),this._store)}}_reevaluatePredictorState(e,t){this._reevaluatePredictorStateNow(e,t)}_reevaluatePredictorStateNow(e,t){if(this._excludeProgramRe.test(this._terminalTitle))t.setShowPredictions(!1);else if(this._typeaheadThreshold<0)t.setShowPredictions(!1);else if(this._typeaheadThreshold===0)t.setShowPredictions(!0);else if(e.sampleSize>5&&e.accuracy>.3){let o=e.latency.median;o>=this._typeaheadThreshold?t.setShowPredictions(!0):o<this._typeaheadThreshold/.5&&t.setShowPredictions(!1)}}_sendLatencyStats(e){this._telemetryService.publicLog("terminalLatencyStats",{...e.latency,predictionAccuracy:e.accuracy})}_onUserData(e){if(this._timeline?.terminal.buffer.active.type!=="normal")return;let t=this._timeline.terminal,o=t.buffer.active;if(o.cursorX===1&&o.cursorY===t.rows-1&&o.getLine(o.cursorY+o.baseY)?.getCell(0)?.getChars()===":")return;let n=o.baseY+o.cursorY;n!==this._lastRow?.y?this._lastRow={y:n,startingX:o.cursorX,endingX:o.cursorX,charState:0}:(this._lastRow.startingX=Math.min(this._lastRow.startingX,o.cursorX),this._lastRow.endingX=Math.max(this._lastRow.endingX,this._timeline.physicalCursor(o).x));let r=c=>this._timeline.tentativeCursor(o).x<=this._lastRow.startingX?this._timeline.addBoundary(o,c):this._timeline.addPrediction(o,c),s=c=>this._timeline.tentativeCursor(o).x>=this._lastRow.endingX-1?this._timeline.addBoundary(o,c):this._timeline.addPrediction(o,c),l=new W8t(e);for(;l.remaining>0;){if(l.eatCharCode(127)){let u=this._timeline.peekEnd();u&&u instanceof Nct&&this._timeline.addBoundary(),this._timeline.isShowingPredictions&&oLo(this._timeline.terminal),this._timeline.tentativeCursor(o).x<=this._lastRow.startingX?this._timeline.addBoundary(o,new B8t(this._timeline.terminal)):(this._lastRow.endingX--,this._timeline.addPrediction(o,new B8t(this._timeline.terminal)));continue}if(l.eatCharCode(32,126)){let u=e[l.index-1],p=new Nct(this._typeaheadStyle,u);this._lastRow.charState===0?(this._timeline.addBoundary(o,p),this._lastRow.charState=1):this._timeline.addPrediction(o,p),this._timeline.tentativeCursor(o).x>=t.cols&&this._timeline.addBoundary(o,new MBi);continue}let c=l.eatRe(Afn);if(c){let u=c[3],p=new Act(u,!!c[2],Number(c[1])||1);u==="D"?r(p):s(p);continue}if(l.eatStr("\x1Bf")){s(new Act("C",!0,1));continue}if(l.eatStr("\x1Bb")){r(new Act("D",!0,1));continue}if(l.eatChar("\r")&&o.cursorY<t.rows-1){this._timeline.addPrediction(o,new H8t);continue}this._timeline.addBoundary(o,new RBi);break}this._timeline.length===1&&(this._deferClearingPredictions(),this._typeaheadStyle.startTracking())}_onBeforeProcessData(e){this._timeline&&(e.data=this._timeline.beforeServerInput(e.data),this._deferClearingPredictions())}};I([Zd(100)],vbe.prototype,"_reevaluatePredictorState",1),vbe=I([m(1,B),m(2,Te)],vbe);var kre=class extends N{constructor(e,t,o){super();this._ctx=e;this._configurationService=t;this._instantiationService=o;this.add(Z(()=>this._addon?.dispose()))}static{this.ID="terminal.typeAhead"}static get(e){return e.getContribution(kre.ID)}xtermReady(e){this._loadTypeAheadAddon(e.raw),this.add(this._configurationService.onDidChangeConfiguration(t=>{t.affectsConfiguration("terminal.integrated.localEchoEnabled")&&this._loadTypeAheadAddon(e.raw)})),this.add(this._ctx.processManager.onProcessReady(()=>{this._addon?.reset()}))}_loadTypeAheadAddon(e){let t=this._configurationService.getValue(Vv).localEchoEnabled,o=!!this._ctx.processManager.remoteAuthority;if(t==="off"||t==="auto"&&!o){this._addon?.dispose(),this._addon=void 0;return}this._addon||(t==="on"||t==="auto"&&o)&&(this._addon=this._instantiationService.createInstance(vbe,this._ctx.processManager),e.loadAddon(this._addon))}};kre=I([m(1,B),m(2,F)],kre);Mp(kre.ID,kre);var U8t=class extends x{constructor(e,t){super();this._container=e;this._resizeOverlayHideTimeout=this._register(new me);this._register(t.raw.onResize(o=>this._handleDimensionsChanged(o))),this._register(Z(()=>{this._resizeOverlay?.remove(),this._resizeOverlay=void 0}))}_handleDimensionsChanged(e){let t=this._container;if(!t||!t.isConnected)return;let o=this._ensureResizeOverlay(t);o.textContent=`${e.cols} x ${e.rows}`,o.classList.add("visible"),this._resizeOverlayHideTimeout.value=tn(()=>{this._resizeOverlay?.classList.remove("visible")},500)}_ensureResizeOverlay(e){return this._resizeOverlay?e.contains(this._resizeOverlay)||e.appendChild(this._resizeOverlay):(this._resizeOverlay=_(".terminal-resize-overlay"),this._resizeOverlay.setAttribute("role","status"),this._resizeOverlay.setAttribute("aria-live","polite"),e.appendChild(this._resizeOverlay)),this._resizeOverlay}};var z8t=class extends x{constructor(e){super();this._ctx=e;this._overlay=this._register(new me)}static{this.ID="terminal.resizeDimensionsOverlay"}xtermOpen(e){this._ctx.processManager.ptyProcessReady.then(()=>{Li(1e3).then(()=>{this._store.isDisposed||(this._overlay.value=new U8t(this._ctx.instance.domElement,e))})})}};Mp(z8t.ID,z8t);function Bfn(a){return Fe(a)?a:void 0}var sLo=async(a,i)=>{let e=a.get(Ue),t=a.get(Tp),o=a.get(Pe),n=a.get(na),s=a.get(nn).activeInstance;if(s){let c=function(g){return xi(g)&&"text"in g}(i)?Bfn(i.text):void 0;if(!c){if(c=await e.input({value:"",placeHolder:"Enter sequence to send (supports \\n, \\r, \\xAB)",prompt:d(15579,null)}),!c)return;let g=c.replace(/\\n/g,`
`).replace(/\\r/g,"\r");for(;;){let f=g.match(/\\x([0-9a-fA-F]{2})/);if(f===null||f.index===void 0||f.length<2)break;g=g.slice(0,f.index)+String.fromCharCode(parseInt(f[1],16))+g.slice(f.index+4)}c=g}let u=n.getLastActiveWorkspaceRoot(s.hasRemoteAuthority?Q.vscodeRemote:Q.file),p=u?o.getWorkspaceFolder(u)??void 0:void 0,h=await t.resolveAsync(p,c);s.sendText(h,!1)}},rLo=L(15577,"Send Sequence");Er({id:"workbench.action.terminal.sendSequence",title:rLo,f1:!0,metadata:{description:rLo.value,args:[{name:"args",schema:{type:"object",required:["text"],properties:{text:{description:d(15578,null),type:"string"}}}}]},run:(a,i,e)=>sLo(i,e)});function TI(a,i){Ct.registerCommandAndKeybindingRule({id:"workbench.action.terminal.sendSequence",weight:200,when:i.when||dt.focus,primary:i.primary,mac:i.mac,linux:i.linux,win:i.win,handler:sLo,args:{text:a}})}ei&&TI("",{when:C.and(dt.focus,C.equals("terminalShellType","pwsh"),$a.negate()),primary:2100});TI("\x1B[24~a",{when:C.and(dt.focus,C.equals("terminalShellType","pwsh"),dt.terminalShellIntegrationEnabled,C.equals("config.terminal.integrated.enableWin32InputMode",!0),$a.negate()),primary:2058,mac:{primary:266}});TI("\x1B[24~b",{when:C.and(dt.focus,C.equals("terminalShellType","pwsh"),dt.terminalShellIntegrationEnabled,C.equals("config.terminal.integrated.enableWin32InputMode",!0),$a.negate()),primary:522});TI("\x1B[24~c",{when:C.and(dt.focus,C.equals("terminalShellType","pwsh"),dt.terminalShellIntegrationEnabled,C.equals("config.terminal.integrated.enableWin32InputMode",!0),$a.negate()),primary:1027});TI("\x1B[24~d",{when:C.and(dt.focus,C.equals("terminalShellType","pwsh"),dt.terminalShellIntegrationEnabled,C.equals("config.terminal.integrated.enableWin32InputMode",!0),$a.negate()),mac:{primary:3089}});TI("\x1B[1;2H",{when:C.and(dt.focus,C.equals("terminalShellType","pwsh"),C.equals("config.terminal.integrated.enableWin32InputMode",!0)),mac:{primary:3087}});TI("\x1B[1;5A",{when:C.and(dt.focus),primary:528});TI("\x1B[1;5B",{when:C.and(dt.focus),primary:530});TI("\x1B"+(Ze?"f":"[1;5C"),{when:C.and(dt.focus),primary:529});TI("\x1B"+(Ze?"b":"[1;5D"),{when:C.and(dt.focus),primary:527});TI("",{when:C.and(dt.focus,$a),primary:2608,mac:{primary:816}});TI("\x07",{when:dt.focus,primary:2597,mac:{primary:805}});dc&&TI("",{when:C.and(dt.focus),primary:289});TI("",{primary:2049,mac:{primary:513}});ei&&TI("\b",{when:C.and(dt.focus,C.equals("terminalShellType","cmd")),primary:2049});TI("\x1Bd",{primary:2068,mac:{primary:532}});TI("",{mac:{primary:2049}});TI("",{mac:{primary:2063}});TI("",{mac:{primary:2065}});TI("\0",{primary:3095,mac:{primary:1303}});TI("",{primary:3099,mac:{primary:1307}});function Hfn(a){return Fe(a)?a:void 0}var aLo=L(15583,"Send Signal");Er({id:"workbench.action.terminal.sendSignal",title:aLo,f1:!ei,metadata:{description:aLo.value,args:[{name:"args",schema:{type:"object",required:["signal"],properties:{signal:{description:d(15584,null),type:"string"}}}}]},run:async(a,i,e)=>{let t=i.get(Ue),o=a.service.activeInstance;if(!o)return;function n(s){return xi(s)&&"signal"in s}let r=n(e)?Hfn(e.signal):void 0;if(!r){let s=[{label:"SIGINT",description:d(15587,null)},{label:"SIGTERM",description:d(15591,null)},{label:"SIGKILL",description:d(15588,null)},{label:"SIGSTOP",description:d(15590,null)},{label:"SIGCONT",description:d(15585,null)},{label:"SIGHUP",description:d(15586,null)},{label:"SIGQUIT",description:d(15589,null)},{label:"SIGUSR1",description:d(15592,null)},{label:"SIGUSR2",description:d(15593,null)},{type:"separator"},{label:d(15581,null)}],l=await t.pick(s,{placeHolder:d(15582,null)});if(!l)return;if(l.label===d(15581,null)){let c=await t.input({prompt:d(15580,null)});if(!c)return;r=c}else r=l.label}await o.sendSignal(r)}});var Fct=class{constructor(i,e){this.leadingLineContent=i;this.characterCountDelta=e}};var K8t=class{constructor(i,e,t){this._items=i;this._lineContext=e;this._rawCompareFn=t;this._refilterKind=1;this._fuzzyScoreOptions={...Bj.default,firstMatchCanBeWeak:!0};this._options={}}get items(){return this._ensureCachedState(),this._filteredItems}get stats(){return this._ensureCachedState(),this._stats}get lineContext(){return this._lineContext}set lineContext(i){(this._lineContext.leadingLineContent!==i.leadingLineContent||this._lineContext.characterCountDelta!==i.characterCountDelta)&&(this._refilterKind=this._lineContext.characterCountDelta<i.characterCountDelta&&this._filteredItems?2:1,this._lineContext=i)}forceRefilterAll(){this._refilterKind=1}_ensureCachedState(){this._refilterKind!==0&&this._createCachedState()}_createCachedState(){let i=[],{leadingLineContent:e,characterCountDelta:t}=this._lineContext,o="",n="",r=this._refilterKind===1?this._items:this._filteredItems,s=[],l=!this._options.filterGraceful||r.length>2e3?rR:Eyt;for(let c=0;c<r.length;c++){let u=r[c];if(u.isInvalid)continue;let p=u.completion.replacementRange?u.completion.replacementRange[1]-u.completion.replacementRange[0]:0,h=p+t;if(o.length!==h&&(o=h===0?"":e.slice(-h),n=o.toLowerCase()),u.word=o,h===0)u.score=kv.Default;else{let g=0;for(;g<p;){let f=o.charCodeAt(g);if(f===32||f===9)g+=1;else break}if(g>=h)u.score=kv.Default;else{let f=l(o,n,g,u.textLabel,u.labelLow,0,this._fuzzyScoreOptions);if(!f&&o!=="")continue;u.score=f||kv.Default}}u.idx=c,s.push(u),i.push(u.textLabel.length)}this._filteredItems=s.sort(this._rawCompareFn?.bind(void 0,e)),this._refilterKind=0,this._stats={pLabelLen:i.length?_9(i.length-.85,i,(c,u)=>c-u):0}}};function WBi(a){return`simple-suggest-aria-id-${a}`}var Lze=class{constructor(i,e,t,o,n){this._getFontInfo=i;this._onDidFontConfigurationChange=e;this._themeService=t;this._modelService=o;this._languageService=n;this._onDidToggleDetails=new E;this.onDidToggleDetails=this._onDidToggleDetails.event;this._disposables=new N;this.templateId="suggestion"}dispose(){this._onDidToggleDetails.dispose(),this._disposables.dispose()}renderTemplate(i){let e=new N,t=i;t.classList.add("show-file-icons");let o=M(i,_(".icon")),n=M(o,_("span.colorspan")),r=M(i,_(".contents")),s=M(r,_(".main")),l=M(s,_(".icon-label.codicon")),c=M(s,_("span.left")),u=M(s,_("span.right")),p=new Bc(c,{supportHighlights:!0,supportIcons:!0});e.add(p);let h=M(c,_("span.signature-label")),g=M(c,_("span.qualifier-label")),f=M(u,_("span.details-label")),v=()=>{let{fontFamily:S,fontSize:y,lineHeight:w,fontWeight:k,letterSpacing:T}=this._getFontInfo(),P=`${y}px`,O=`${w}px`,V=`${T}px`;t.style.fontSize=P,t.style.fontWeight=k,t.style.letterSpacing=V,s.style.fontFamily=S,s.style.fontFeatureSettings="",s.style.lineHeight=O,o.style.height=O,o.style.width=O};return v(),this._disposables.add(this._onDidFontConfigurationChange(()=>v())),{root:t,left:c,right:u,icon:o,colorspan:n,iconLabel:p,iconContainer:l,parametersLabel:h,qualifierLabel:g,detailsLabel:f,disposables:e}}renderElement(i,e,t){let{completion:o}=i;t.root.id=WBi(e),t.colorspan.style.backgroundColor="";let n={labelEscapeNewLines:!0,matches:xa(i.score)};if(o.kindLabel==="File"&&this._themeService.getFileIconTheme().hasFileIcons){t.icon.className="icon hide",t.iconContainer.className="icon hide";let r=aa(this._modelService,this._languageService,A.from({scheme:"fake",path:i.textLabel}),0),s=aa(this._modelService,this._languageService,A.from({scheme:"fake",path:o.detail}),0);n.extraClasses=r.length>s.length?r:s}else o.kindLabel==="Folder"&&this._themeService.getFileIconTheme().hasFolderIcons?(t.icon.className="icon hide",t.iconContainer.className="icon hide",n.extraClasses=[aa(this._modelService,this._languageService,A.from({scheme:"fake",path:i.textLabel}),1),aa(this._modelService,this._languageService,A.from({scheme:"fake",path:o.detail}),1)].flat()):(t.icon.className="icon hide",t.iconContainer.className="",t.iconContainer.classList.add("suggest-icon",...q.asClassNameArray(o.icon||R.symbolText)));if(t.iconLabel.setLabel(i.textLabel,void 0,n),typeof o.label=="string")t.parametersLabel.textContent="",t.detailsLabel.textContent=FBi(o.detail||""),t.root.classList.add("string-label");else{let r=FBi(o.label.detail||"");t.parametersLabel.textContent=zfn(r),t.detailsLabel.textContent=FBi(o.label.description||""),t.root.classList.remove("string-label")}un(t.detailsLabel),t.right.classList.remove("can-expand-details")}disposeTemplate(i){i.disposables.dispose()}};Lze=I([m(2,Le),m(3,Tt),m(4,_t)],Lze);function FBi(a){return a.replace(/\r\n|\r|\n/g,"")}var Ufn=/^[\s()[\]{}<>"'`~!@#$%^&*+=,.:;?/\\|-]/;function zfn(a){return a?Ufn.test(a)?a:` ${a}`:""}function VBi(a){return!!a&&!!(a.completion.documentation||a.completion.detail&&a.completion.detail!==a.completion.label)}var lLo="suggest-details";var Rze=class{constructor(i,e,t,o,n){this._getFontInfo=i;this._getAdvancedExplainModeDetails=t;this.markdownRendererService=n;this._onDidClose=new E;this.onDidClose=this._onDidClose.event;this._onDidChangeContents=new E;this.onDidChangeContents=this._onDidChangeContents.event;this._disposables=new N;this._renderDisposeable=this._disposables.add(new N);this._borderWidth=1;this._size=new si(330,0);this.domNode=_(".suggest-details"),this.domNode.classList.add("no-docs"),this._body=_(".body"),this._scrollbar=new ms(this._body,{alwaysConsumeMouseWheel:!0}),M(this.domNode,this._scrollbar.getDomNode()),this._disposables.add(this._scrollbar),this._header=M(this._body,_(".header")),this._close=M(this._header,_("span"+q.asCSSSelector(R.close))),this._close.title=d(17965,null),this._close.role="button",this._close.tabIndex=-1,this._type=M(this._header,_("p.type")),this._docs=M(this._body,_("p.docs")),this._configureFont(),this._disposables.add(e(()=>this._configureFont()))}_configureFont(){let i=this._getFontInfo(),e=i.fontFamily,t=i.fontSize,o=i.lineHeight,n=i.fontWeight,r=`${t}px`,s=`${o}px`;this.domNode.style.fontSize=r,this.domNode.style.lineHeight=`${o/t}`,this.domNode.style.fontWeight=n,this._type.style.fontFamily=e,this._close.style.height=s,this._close.style.width=s}dispose(){this._disposables.dispose(),this._onDidClose.dispose(),this._onDidChangeContents.dispose()}getLayoutInfo(){let i=this._getFontInfo().lineHeight,e=this._borderWidth,t=e*2;return{lineHeight:i,borderWidth:e,borderHeight:t,verticalPadding:22,horizontalPadding:14}}renderLoading(){this._type.textContent=d(17966,null),this._docs.textContent="",this.domNode.classList.remove("no-docs","no-type"),this.layout(this.size.width,this.getLayoutInfo().lineHeight*2),this._onDidChangeContents.fire(this)}renderItem(i,e){this._renderDisposeable.clear();let{detail:t,documentation:o}=i.completion,n="";if(e){n+=`score: ${i.score[0]}
`,n+=`prefix: ${i.word??"(no prefix)"}
`;let c=i.completion.replacementRange;if(n+=`valueSelection: ${c?`[${c[0]}, ${c[1]}]`:"undefined"}
`,n+=`index: ${i.idx}
`,this._getAdvancedExplainModeDetails){let u=this._getAdvancedExplainModeDetails();u&&(n+=`${u}
`)}t=`Provider: ${i.completion.provider}`,o=new Ie().appendCodeblock("empty",n)}let r=typeof t=="string"?t.trim().length>0:!!t,s=typeof o=="string"?o.trim().length>0:!!(o&&o.value?.trim().length>0),l=()=>{this.layout(this._size.width,this._type.clientHeight+this._docs.clientHeight),this._onDidChangeContents.fire(this)};if(!e&&(!VBi(i)||!r&&!s)){this.clearContents();return}if(this.domNode.classList.remove("no-docs","no-type"),r&&t){let c=t.length>1e5?`${t.substr(0,1e5)}\u2026`:t;this._type.textContent=c,this._type.title=c,un(this._type),this._type.classList.toggle("auto-wrap",!/\r?\n^\s+/gmi.test(c))}else Rt(this._type),this._type.title="",vo(this._type),this.domNode.classList.add("no-type");if(Rt(this._docs),s&&typeof o=="string")this._docs.classList.remove("markdown-docs"),this._docs.textContent=o;else if(s&&o&&typeof o!="string"){this._docs.classList.add("markdown-docs"),Rt(this._docs);let c=this.markdownRendererService.render(o,{asyncRenderCallback:()=>{l()}});this._docs.appendChild(c.element),this._renderDisposeable.add(c)}else this._docs.classList.remove("markdown-docs");this.domNode.classList.toggle("detail-and-doc",r&&s),this.domNode.style.userSelect="text",this.domNode.tabIndex=-1,this._close.onmousedown=c=>{c.preventDefault(),c.stopPropagation()},this._close.onclick=c=>{c.preventDefault(),c.stopPropagation(),this._onDidClose.fire()},this._body.scrollTop=0,l()}clearContents(){this.domNode.classList.add("no-docs"),this._type.textContent="",this._docs.textContent=""}get isEmpty(){return this.domNode.classList.contains("no-docs")}get size(){return this._size}layout(i,e){let t=new si(i,e);si.equals(t,this._size)||(this._size=t,VL(this.domNode,i,e)),this._scrollbar.scanDomNode()}scrollDown(i=8){this._body.scrollTop+=i}scrollUp(i=8){this._body.scrollTop-=i}scrollTop(){this._body.scrollTop=0}scrollBottom(){this._body.scrollTop=this._body.scrollHeight}pageDown(){this.scrollDown(80)}pageUp(){this.scrollUp(80)}set borderWidth(i){this._borderWidth=i}get borderWidth(){return this._borderWidth}focus(){this.domNode.focus()}};Rze=I([m(3,F),m(4,On)],Rze);var G8t=class{constructor(i,e,t){this.widget=i;this._container=e;this._disposables=new N;this._added=!1;this._resizable=this._disposables.add(new fR),this._resizable.domNode.classList.add("suggest-details-container"),this._resizable.domNode.appendChild(i.domNode),this._resizable.enableSashes(!1,!0,!0,!1),this._preventPlacements=t&&t.length?new Set(t):void 0;let o,n,r=0,s=0;this._disposables.add(this._resizable.onDidWillResize(()=>{o=this._topLeft,n=this._resizable.size})),this._disposables.add(this._resizable.onDidResize(l=>{if(o&&n){this.widget.layout(l.dimension.width,l.dimension.height);let c=!1;l.west&&(s=n.width-l.dimension.width,c=!0),l.north&&(r=n.height-l.dimension.height,c=!0),c&&this._applyTopLeft({top:o.top+r,left:o.left+s})}l.done&&(o=void 0,n=void 0,r=0,s=0,this._userSize=l.dimension)})),this._disposables.add(this.widget.onDidChangeContents(()=>{this._anchorBox&&this._placeAtAnchor(this._anchorBox,this._userSize??this.widget.size)}))}dispose(){this.widget.dispose(),this._disposables.dispose(),this.hide()}getId(){return"suggest.details"}getDomNode(){return this._resizable.domNode}show(){this._added||(this._container.appendChild(this._resizable.domNode),this._added=!0)}hide(i=!1){this._resizable.clearSashHoverState(),this._added&&(this._container.removeChild(this._resizable.domNode),this._added=!1,this._anchorBox=void 0),i&&(this._userSize=void 0,this.widget.clearContents())}placeAtAnchor(i){let e=i.getBoundingClientRect();this._anchorBox=e,this.widget.layout(this._resizable.size.width,this._resizable.size.height),this._placeAtAnchor(this._anchorBox,this._userSize??this.widget.size)}_placeAtAnchor(i,e){let t=$m(this.getDomNode().ownerDocument.body),o=this.widget.getLayoutInfo(),n=new si(220,2*o.lineHeight),r=i.top,s=(function(){let O=t.width-(i.left+i.width+o.borderWidth+o.horizontalPadding),V=-o.borderWidth+i.left+i.width,H=new si(O,t.height-i.top-o.borderHeight-o.verticalPadding),G=H.with(void 0,i.top+i.height-o.borderHeight-o.verticalPadding);return{top:r,left:V,fit:O-e.width,maxSizeTop:H,maxSizeBottom:G,minSize:n.with(Math.min(O,n.width))}})(),l=(function(){let O=i.left-o.borderWidth-o.horizontalPadding,V=Math.max(o.horizontalPadding,i.left-e.width-o.borderWidth),H=new si(O,t.height-i.top-o.borderHeight-o.verticalPadding),G=H.with(void 0,i.top+i.height-o.borderHeight-o.verticalPadding);return{top:r,left:V,fit:O-e.width,maxSizeTop:H,maxSizeBottom:G,minSize:n.with(Math.min(O,n.width))}})(),c=(function(){let O=i.left,V=-o.borderWidth+i.top+i.height,H=new si(i.width-o.borderHeight,t.height-i.top-i.height-o.verticalPadding);return{top:V,left:O,fit:H.height-e.height,maxSizeBottom:H,maxSizeTop:H,minSize:n.with(H.width)}})(),u=(function(){let O=Math.max(i.width-o.borderHeight,0),V=i.left,H=Math.max(i.top-o.verticalPadding,0),G=Math.min(e.height,H),$=i.top-o.borderWidth-G,J=new si(O,Math.max(H,0));return{top:$,left:V,fit:J.height-e.height,maxSizeTop:J,maxSizeBottom:J,minSize:n.with(J.width)}})(),p=[[0,s],[2,c],[3,u],[1,l]],h=(this._preventPlacements?p.filter(([O])=>!this._preventPlacements.has(O)):p).map(([,O])=>O),g=h.length?h:p.map(([,O])=>O),f=g.find(O=>O.fit>=0)??g.reduce((O,V)=>!O||V.fit>O.fit?V:O,void 0)??s,v=i.top+i.height-o.borderHeight,b,S=e.height,y=Math.max(f.maxSizeTop.height,f.maxSizeBottom.height);S>y&&(S=y);let w;S<=f.maxSizeTop.height?(b=!0,w=f.maxSizeTop):(b=!1,w=f.maxSizeBottom);let{top:k,left:T}=f;!b&&S>i.height&&(k=v-S);let P=this._container;if(P){let O=P.getBoundingClientRect();k-=O.top,T-=O.left}this._applyTopLeft({left:T,top:k}),this._resizable.enableSashes(!b,f===s,b,f!==s),this._resizable.minSize=f.minSize,this._resizable.maxSize=w,this._resizable.layout(S,Math.min(w.width,e.width)),this.widget.layout(this._resizable.size.width,this._resizable.size.height)}_applyTopLeft(i){this._topLeft=i,this._resizable.domNode.style.top=`${i.top}px`,this._resizable.domNode.style.left=`${i.left}px`,this._resizable.domNode.style.position="absolute"}};var Kfn=_;var VN={HasFocusedSuggestion:new Y("simpleSuggestWidgetHasFocusedSuggestion",!1,d(17960,null)),HasNavigated:new Y("simpleSuggestWidgetHasNavigated",!1,d(17961,null)),FirstSuggestionFocused:new Y("simpleSuggestWidgetFirstSuggestionFocused",!1,d(17959,null)),ExplicitlyInvoked:new Y("simpleSuggestWidgetExplicitlyInvoked",!1,d(17958,null))};var zU=class extends x{constructor(e,t,o,n,r,s,l,c,u,p){super();this._container=e;this._persistedSize=t;this._options=o;this._getFontInfo=n;this._onDidFontConfigurationChange=r;this._getAdvancedExplainModeDetails=s;this._instantiationService=l;this._configurationService=c;this._storageService=u;this._state=0;this._forceRenderingAbove=!1;this._explainMode=!1;this._pendingShowDetails=this._register(new me);this._pendingLayout=this._register(new me);this._ignoreFocusEvents=!1;this._showTimeout=this._register(new Ul);this._onDidSelect=this._register(new E);this.onDidSelect=this._onDidSelect.event;this._onDidHide=this._register(new E);this.onDidHide=this._onDidHide.event;this._onDidShow=this._register(new E);this.onDidShow=this._onDidShow.event;this._onDidFocus=new Gm;this.onDidFocus=this._onDidFocus.event;this._onDidBlurDetails=this._register(new E);this.onDidBlurDetails=this._onDidBlurDetails.event;this.element=this._register(new fR),this.element.domNode.classList.add("workbench-suggest-widget"),this._container.appendChild(this.element.domNode),this._ctxSuggestWidgetHasFocusedSuggestion=VN.HasFocusedSuggestion.bindTo(p),this._ctxSuggestWidgetHasBeenNavigated=VN.HasNavigated.bindTo(p),this._ctxFirstSuggestionFocused=VN.FirstSuggestionFocused.bindTo(p),this._ctxSuggestWidgetExplicitlyInvoked=VN.ExplicitlyInvoked.bindTo(p);class h{constructor(y,w,k=!1,T=!1){this.persistedSize=y;this.currentSize=w;this.persistHeight=k;this.persistWidth=T}}let g;this._register(this.element.onDidWillResize(()=>{g=new h(this._persistedSize.restore(),this.element.size)})),this._register(this.element.onDidResize(S=>{if(this._resize(S.dimension.width,S.dimension.height),g&&(g.persistHeight=g.persistHeight||!!S.north||!!S.south,g.persistWidth=g.persistWidth||!!S.east||!!S.west),!!S.done){if(g){let{itemHeight:y,defaultSize:w}=this._getLayoutInfo(),k=Math.round(y/2),{width:T,height:P}=this.element.size;(!g.persistHeight||Math.abs(g.currentSize.height-P)<=k)&&(P=g.persistedSize?.height??w.height),(!g.persistWidth||Math.abs(g.currentSize.width-T)<=k)&&(T=g.persistedSize?.width??w.width),this._persistedSize.store(new si(T,P))}g=void 0}}));let f=()=>this.element.domNode.classList.toggle("no-icons",!c.getValue("editor.suggest.showIcons"));f();let v=this._instantiationService.createInstance(Lze,this._getFontInfo.bind(this),this._onDidFontConfigurationChange.bind(this));this._register(v),this._listElement=M(this.element.domNode,Kfn(".tree")),this._list=this._register(new Cc("SuggestWidget",this._listElement,{getHeight:()=>this._getLayoutInfo().itemHeight,getTemplateId:()=>"suggestion"},[v],{alwaysConsumeMouseWheel:!0,useShadows:!1,mouseSupport:!1,multipleSelectionSupport:!1,accessibilityProvider:{getRole:()=>ei?"listitem":"option",getWidgetAriaLabel:()=>d(17962,null),getWidgetRole:()=>"listbox",getAriaLabel:S=>{let y=S.textLabel,w=S.completion.kindLabel??"";if(typeof S.completion.label!="string"){let{detail:O,description:V}=S.completion.label;O&&V?y=d(17957,null,y,O,V,w):O?y=d(17956,null,y,O,w):V&&(y=d(17955,null,y,V,w))}else y=d(17954,null,y,w);let{documentation:k,detail:T}=S.completion,P=vd("{0}{1}",T||"",k?typeof k=="string"?k:k.value:"");return d(17953,null,y,P)}}})),this._register(this._list.onDidChangeFocus(S=>{S.indexes.length&&S.indexes[0]!==0&&this._ctxSuggestWidgetHasBeenNavigated.set(!0)})),this._messageElement=M(this.element.domNode,_(".message"));let b=this._register(l.createInstance(Rze,this._getFontInfo.bind(this),this._onDidFontConfigurationChange.bind(this),this._getAdvancedExplainModeDetails.bind(this)));this._register(b.onDidClose(()=>this.toggleDetails())),this._details=this._register(new G8t(b,this._listElement,this._options.preventDetailsPlacements)),this._register(j(this._details.widget.domNode,"blur",S=>this._onDidBlurDetails.fire(S))),o.statusBarMenuId&&o.showStatusBarSettingId&&c.getValue(o.showStatusBarSettingId)&&(this._status=this._register(l.createInstance(E5,this.element.domNode,o.statusBarMenuId,{showIconsNoKeybindings:!0})),this.element.domNode.classList.toggle("with-status-bar",!0)),this._register(this._list.onMouseDown(S=>this._onListMouseDownOrTap(S))),this._register(this._list.onTap(S=>this._onListMouseDownOrTap(S))),this._register(this._list.onDidChangeFocus(S=>this._onListFocus(S))),this._register(this._list.onDidChangeSelection(S=>this._onListSelection(S))),this._register(this._onDidFontConfigurationChange(()=>{this._completionModel&&this._list.splice(0,this._completionModel.items.length,this._completionModel.items)})),this._register(c.onDidChangeConfiguration(S=>{if(S.affectsConfiguration("editor.suggest.showIcons")&&f(),o.statusBarMenuId&&o.showStatusBarSettingId&&S.affectsConfiguration(o.showStatusBarSettingId)){let y=c.getValue(o.showStatusBarSettingId);y&&!this._status?(this._status=this._register(l.createInstance(E5,this.element.domNode,o.statusBarMenuId,{showIconsNoKeybindings:!0})),this._status.show()):y&&this._status?this._status.show():this._status&&(this._status.element.remove(),this._status.dispose(),this._status=void 0,this._layout(void 0)),this.element.domNode.classList.toggle("with-status-bar",y)}}))}static{this.LOADING_MESSAGE=d(17963,null)}static{this.NO_SUGGESTIONS_MESSAGE=d(17964,null)}get list(){return this._list}_onListFocus(e){if(this._ignoreFocusEvents)return;if(this._state===5&&this._setState(3),!e.elements.length){this._currentSuggestionDetails&&(this._currentSuggestionDetails.cancel(),this._currentSuggestionDetails=void 0,this._focusedItem=void 0,this._ctxSuggestWidgetHasFocusedSuggestion.set(!1)),this._clearAriaActiveDescendant();return}if(!this._completionModel)return;this._ctxSuggestWidgetHasFocusedSuggestion.set(!0);let t=e.elements[0],o=e.indexes[0];if(t!==this._focusedItem){this._currentSuggestionDetails?.cancel(),this._currentSuggestionDetails=void 0,this._focusedItem=t,this._list.reveal(o);let n=WBi(o),r=Ki().document.activeElement;r&&n?(r.setAttribute("aria-haspopup","true"),r.setAttribute("aria-autocomplete","list"),r.setAttribute("aria-activedescendant",n)):this._clearAriaActiveDescendant(),this._currentSuggestionDetails=Ln(async s=>{let l=tn(()=>{this._isDetailsVisible()&&this._showDetails(!0,!1)},250),c=s.onCancellationRequested(()=>l.dispose());try{return await Promise.resolve()}finally{l.dispose(),c.dispose()}}),this._currentSuggestionDetails.then(()=>{o>=this._list.length||t!==this._list.element(o)||(this._ignoreFocusEvents=!0,this._list.splice(o,1,[t]),this._list.setFocus([o]),this._ignoreFocusEvents=!1,this._isDetailsVisible()?this._showDetails(!1,!1):this.element.domNode.classList.remove("docs-side"))}).catch()}this._ctxFirstSuggestionFocused.set(o===0),this._onDidFocus.fire({item:t,index:o,model:this._completionModel})}_clearAriaActiveDescendant(){let e=Ki().document.activeElement;e&&(e.setAttribute("aria-haspopup","false"),e.setAttribute("aria-autocomplete","both"),e.removeAttribute("aria-activedescendant"))}setCompletionModel(e){this._completionModel=e}hasCompletions(){return this._completionModel?.items.length!==0}resetWidgetSize(){this._persistedSize.reset()}relayout(e){this._state!==0&&(this._cursorPosition=e,this._layout(this.element.size),this._afterRender())}showTriggered(e,t){this._state===0&&(this._cursorPosition=t,this._ctxSuggestWidgetExplicitlyInvoked.set(!!e),this._ctxSuggestWidgetExplicitlyInvoked.get()&&(this._loadingTimeout=tn(()=>this._setState(1),250)))}showSuggestions(e,t,o,n){this._cursorPosition=n,this._loadingTimeout?.dispose();let r=this._options?.selectionModeSettingId?this._configurationService.getValue(this._options.selectionModeSettingId):void 0,s=!this._ctxSuggestWidgetExplicitlyInvoked.get()&&r==="never";if(t&&this._state!==2&&this._state!==0){this._setState(4);return}if((this._completionModel?.items.length??0)===0){this._setState(o?0:2),this._completionModel=void 0;return}this._list.splice(0,this._list.length,this._completionModel?.items??[]),this._setState(t?4:3),this._list.reveal(e,0),this._list.setFocus(s?[]:[e]),this._pendingLayout.value=zh(Re(this.element.domNode),()=>{this._pendingLayout.clear(),this._layout(this.element.size)}),this._updateListStyles(),this._afterRender()}_updateListStyles(){if(this._options.selectionModeSettingId){let e=this._configurationService.getValue(this._options.selectionModeSettingId),t=!this._ctxSuggestWidgetExplicitlyInvoked.get()&&e==="partial";this._list.style(cLo(t)),this.element.domNode.classList.toggle("partial-selection",t)}}setLineContext(e){this._completionModel&&(this._completionModel.lineContext=e)}_setState(e){if(this._state!==e)switch(this._state=e,this.element.domNode.classList.toggle("frozen",e===4),this.element.domNode.classList.remove("message"),e){case 0:this._status&&vo(this._status.element),vo(this._listElement),vo(this._messageElement),vo(this.element.domNode),this._details.hide(!0),this._status?.hide(),this._ctxSuggestWidgetHasFocusedSuggestion.reset(),this._showTimeout.cancel(),this.element.domNode.classList.remove("visible"),this._list.splice(0,this._list.length),this._focusedItem=void 0,this._cappedHeight=void 0,this._explainMode=!1;break;case 1:this.element.domNode.classList.add("message"),this._messageElement.textContent=zU.LOADING_MESSAGE,vo(this._listElement),this._status&&vo(this._status.element),un(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,qr(zU.LOADING_MESSAGE);break;case 2:this.element.domNode.classList.add("message"),this._messageElement.textContent=zU.NO_SUGGESTIONS_MESSAGE,vo(this._listElement),this._status&&vo(this._status.element),un(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,qr(zU.NO_SUGGESTIONS_MESSAGE);break;case 3:vo(this._messageElement),this._showListAndStatus(),this._show();break;case 4:vo(this._messageElement),this._showListAndStatus(),this._show();break;case 5:vo(this._messageElement),this._showListAndStatus(),this._details.show(),this._show();break}}_showListAndStatus(){this._status?un(this._listElement,this._status.element):un(this._listElement)}_show(){this._status?.show(),un(this.element.domNode),this._layout(this._persistedSize.restore()),this._onDidShow.fire(this),this._showTimeout.cancelAndSet(()=>{this.element.domNode.classList.add("visible")},100)}toggleDetailsFocus(){this._state===5?(this._list.setFocus(this._list.getFocus()),this._setState(3)):this._state===3&&(this._setState(5),this._isDetailsVisible()?this._details.widget.focus():this.toggleDetails(!0))}toggleDetails(e=!1){this._isDetailsVisible()?(this._pendingShowDetails.clear(),this._setDetailsVisible(!1),this._details.hide(),this.element.domNode.classList.remove("shows-details")):(VBi(this._list.getFocusedElements()[0])||this._explainMode)&&(this._state===3||this._state===5||this._state===4)&&(this._setDetailsVisible(!0),this._showDetails(!1,e))}_showDetails(e,t){this._pendingShowDetails.value=zh(Re(this.element.domNode),()=>{this._pendingShowDetails.clear(),this._details.show();let o=!1;e?this._details.widget.renderLoading():this._details.widget.renderItem(this._list.getFocusedElements()[0],this._explainMode),this._details.widget.isEmpty?this._details.hide():(this._positionDetails(),this.element.domNode.classList.add("shows-details"),t&&(this._details.widget.focus(),o=!0))})}toggleExplainMode(){this._list.getFocusedElements()[0]&&(this._explainMode=!this._explainMode,this._isDetailsVisible()?this._showDetails(!1,!1):this.toggleDetails())}hide(){this._pendingLayout.clear(),this._pendingShowDetails.clear(),this._loadingTimeout?.dispose(),this._ctxSuggestWidgetHasBeenNavigated.reset(),this._ctxFirstSuggestionFocused.reset(),this._ctxSuggestWidgetExplicitlyInvoked.reset(),this._setState(0),this._onDidHide.fire(this),vo(this.element.domNode),this.element.clearSashHoverState();let e=this._persistedSize.restore(),t=Math.ceil(this._getLayoutInfo().itemHeight*4.3);e&&e.height<t&&this._persistedSize.store(e.with(void 0,t))}_layout(e){if(!this._cursorPosition)return;let t=$m(this._container.ownerDocument.body),o=this._getLayoutInfo();e||(e=o.defaultSize);let n=e.height,r=e.width;this._status&&(this._status.element.style.height=`${o.itemHeight}px`);let s=t.width-o.borderHeight-2*o.horizontalPadding;r>s&&(r=s);let l=this._completionModel?this._completionModel.stats.pLabelLen*o.typicalHalfwidthCharacterWidth:r,c=Math.min(this._list.contentHeight,o.itemHeight*12),u=o.statusBarHeight+c+this._messageElement.clientHeight+o.borderHeight,p=o.itemHeight+o.statusBarHeight,h=ir(this._container),g={top:this._cursorPosition.top-h.top,left:this._cursorPosition.left,height:this._cursorPosition.height},f=h.top+g.top+g.height,v=Math.min(t.height-f-o.verticalPadding,u),b=h.top+g.top-o.verticalPadding,S=Math.min(b,u),y=Math.min(Math.max(S,v)+o.borderHeight,u);n===this._cappedHeight?.capped&&(n=this._cappedHeight.wanted),n<p&&(n=p),n>y&&(n=y),n>v&&S>v||this._forceRenderingAbove&&b>150?(this._preference=0,this.element.enableSashes(!0,!0,!1,!1),y=S):(this._preference=1,this.element.enableSashes(!1,!0,!0,!1),y=v),this.element.preferredSize=new si(l,o.defaultSize.height),this.element.maxSize=new si(s,y),this.element.minSize=new si(220,p),this._cappedHeight=n===u?{wanted:this._cappedHeight?.wanted??e.height,capped:n}:void 0;let k=this._cursorPosition.left;k+r>t.width&&(k=this._cursorPosition.left-r),this.element.domNode.style.left=`${k}px`,this._preference===0?this.element.domNode.style.top=`${this._cursorPosition.top-n-o.borderHeight}px`:this.element.domNode.style.top=`${this._cursorPosition.top+this._cursorPosition.height}px`,this._resize(r,n)}_afterRender(){this._state===2||this._state===1||(this._isDetailsVisible()&&!this._details.widget.isEmpty&&this._details.show(),this._positionDetails())}_resize(e,t){let{width:o,height:n}=this.element.maxSize;e=Math.min(o,e),n&&(t=Math.min(n,t));let{statusBarHeight:r}=this._getLayoutInfo();this._list.layout(t-r,e),this._listElement.style.height=`${t-r}px`,this._listElement.style.width=`${e}px`,this.element.layout(t,e),this._cursorPosition&&this._preference===0&&(this.element.domNode.style.top=`${this._cursorPosition.top-t}px`),this._positionDetails()}_positionDetails(){this._isDetailsVisible()&&this._details.placeAtAnchor(this.element.domNode)}_getLayoutInfo(){let e=this._getFontInfo(),t=Bn(e.lineHeight,8,1e3),o=!this._options.statusBarMenuId||!this._options.showStatusBarSettingId||!this._configurationService.getValue(this._options.showStatusBarSettingId)||this._state===2||this._state===1?0:t,n=this._details.widget.borderWidth,r=2*n;return{itemHeight:t,statusBarHeight:o,borderWidth:n,borderHeight:r,typicalHalfwidthCharacterWidth:10,verticalPadding:22,horizontalPadding:14,defaultSize:new si(430,o+12*t+r)}}_onListMouseDownOrTap(e){typeof e.element>"u"||typeof e.index>"u"||(e.browserEvent.preventDefault(),e.browserEvent.stopPropagation(),this._select(e.element,e.index))}_onListSelection(e){e.elements.length&&this._select(e.elements[0],e.indexes[0])}_select(e,t){let o=this._completionModel;o&&this._onDidSelect.fire({item:e,index:t,model:o})}selectNext(){this._clearPartialSelectionState(),this._list.focusNext(1,!0);let e=this._list.getFocus();return e.length>0&&this._list.reveal(e[0]),!0}selectNextPage(){this._clearPartialSelectionState(),this._list.focusNextPage();let e=this._list.getFocus();return e.length>0&&this._list.reveal(e[0]),!0}selectPrevious(){this._clearPartialSelectionState(),this._list.focusPrevious(1,!0);let e=this._list.getFocus();return e.length>0&&this._list.reveal(e[0]),!0}selectPreviousPage(){this._clearPartialSelectionState(),this._list.focusPreviousPage();let e=this._list.getFocus();return e.length>0&&this._list.reveal(e[0]),!0}_clearPartialSelectionState(){this._list.style(cLo(!1)),this.element.domNode.classList.remove("partial-selection")}getFocusedItem(){if(this._completionModel)return{item:this._list.getFocusedElements()[0],index:this._list.getFocus()[0],model:this._completionModel}}_isDetailsVisible(){return this._storageService.getBoolean("expandSuggestionDocs",0,!1)}_setDetailsVisible(e){this._storageService.store("expandSuggestionDocs",e,0,0)}forceRenderingAbove(){this._forceRenderingAbove||(this._forceRenderingAbove=!0,this._layout(this._persistedSize.restore()))}stopForceRenderingAbove(){this._forceRenderingAbove=!1}};zU=I([m(6,F),m(7,B),m(8,ce),m(9,X)],zU);function cLo(a){return a?uS({listInactiveFocusOutline:Sd,listInactiveFocusForeground:qdi}):uS({listInactiveFocusBackground:$di,listInactiveFocusOutline:Ys})}var $8t=class extends K8t{constructor(i,e){super(i,e,Gfn)}},Gfn=(a,i,e)=>{if(i.completion.kind===101&&i.completion.kind!==e.completion.kind)return-1;if(e.completion.kind===101&&i.completion.kind!==e.completion.kind)return 1;let t=e.score[0]-i.score[0];if(t!==0)return t;if(i.completion.kind===100&&i.completion.kind!==e.completion.kind)return-1;if(e.completion.kind===100&&i.completion.kind!==e.completion.kind)return 1;if(i.punctuationPenalty!==e.punctuationPenalty)return i.punctuationPenalty-e.punctuationPenalty;if(!a.includes(" ")&&i.completion.kind===0&&e.completion.kind===0){if(i.labelLowExcludeFileExt!==e.labelLowExcludeFileExt)return i.labelLowExcludeFileExt.localeCompare(e.labelLowExcludeFileExt,void 0,{ignorePunctuation:!0});if(t=i.labelLowExcludeFileExt.length-e.labelLowExcludeFileExt.length,t!==0||(t=dLo(e.fileExtLow)-dLo(i.fileExtLow),t!==0)||(t=i.fileExtLow.length-e.fileExtLow.length,t!==0))return t}if(i.completion.kind===4&&e.completion.kind===4&&/^\s*git\b/.test(a)){let n=Fe(i.completion.label)?i.completion.label:i.completion.label.label,r=Fe(e.completion.label)?e.completion.label:e.completion.label.label,s=n==="main"||n==="master",l=r==="main"||r==="master";if(s&&!l)return-1;if(l&&!s)return 1}if(i.completion.kind===2&&e.completion.kind===2&&(!Fe(i.completion.label)&&i.completion.label.description&&!Fe(e.completion.label)&&e.completion.label.description?t=0:!Fe(i.completion.label)&&i.completion.label.description?t=-2:!Fe(e.completion.label)&&e.completion.label.description&&(t=2),t+=(e.completion.detail?1:0)+(e.completion.documentation?2:0)-(i.completion.detail?1:0)-(i.completion.documentation?2:0),t!==0))return t;if(i.completion.kind===1&&e.completion.kind===1&&i.labelLowNormalizedPath&&e.labelLowNormalizedPath){if(t=DL(i.labelLowNormalizedPath,"/")-DL(e.labelLowNormalizedPath,"/"),t!==0)return t;if(e.labelLowNormalizedPath.startsWith(i.labelLowNormalizedPath))return-1;if(i.labelLowNormalizedPath.startsWith(e.labelLowNormalizedPath))return 1}if(i.completion.kind!==e.completion.kind){if((i.completion.kind===2||i.completion.kind===3)&&e.completion.kind!==2&&e.completion.kind!==3)return-1;if((e.completion.kind===2||e.completion.kind===3)&&i.completion.kind!==2&&i.completion.kind!==3)return 1;if(i.completion.kind===4&&e.completion.kind!==4)return-1;if(e.completion.kind===4&&i.completion.kind!==4||q8t(i.completion.kind)&&!q8t(e.completion.kind))return 1;if(q8t(e.completion.kind)&&!q8t(i.completion.kind))return-1}return i.labelLow.localeCompare(e.labelLow,void 0,{ignorePunctuation:!0})},q8t=a=>a===0||a===1||a===8||a===9,qfn=new Map(ei?[["ps1",.09],["exe",.08],["bat",.07],["cmd",.07],["msi",.06],["com",.06],["sh",-.05],["bash",-.05],["zsh",-.05],["fish",-.05],["csh",-.06],["ksh",-.06]]:[["ps1",.05],["bat",-.05],["cmd",-.05],["exe",-.05],["sh",.05],["bash",.05],["zsh",.05],["fish",.05],["csh",.04],["ksh",.04],["py",.05],["pl",.05]]);function dLo(a){return qfn.get(a)||0}var Mze=class extends x{constructor(e,t,o){super();this._promptInputModel=t;this._telemetryService=o;this._kindMap=new Map([[0,"File"],[1,"Folder"],[2,"Method"],[3,"Alias"],[4,"Argument"],[5,"Option"],[6,"Option Value"],[7,"Flag"],[100,"Inline Suggestion"],[101,"Inline Suggestion"]]);this._register(e.onCommandFinished(n=>{this._sendTelemetryInfo(!1,n.exitCode),this._acceptedCompletions=void 0})),this._register(this._promptInputModel.onDidInterrupt(()=>{this._sendTelemetryInfo(!0),this._acceptedCompletions=void 0}))}acceptCompletion(e,t,o){if(!t||!o){this._acceptedCompletions=void 0;return}this._acceptedCompletions=this._acceptedCompletions||[],this._acceptedCompletions.push({label:Fe(t.label)?t.label:t.label.label,kind:this._kindMap.get(t.kind),sessionId:e,provider:t.provider})}logCompletionLatency(e,t,o){this._telemetryService.publicLog2("terminal.suggest.completionLatency",{terminalSessionId:e,latency:t,firstWindow:o.window,firstShell:o.shell})}_sendTelemetryInfo(e,t){let o=this._promptInputModel?.value;for(let n of this._acceptedCompletions||[]){let r=n?.label,s=n?.kind,l=n?.provider;if(r===void 0||o===void 0||s===void 0||l===void 0)return;let c;e?c="Interrupted":o.trim()&&o.includes(r)?c="Accepted":$fn(o,r)?c="AcceptedWithEdit":c="Deleted",this._telemetryService.publicLog2("terminal.suggest.acceptedCompletion",{kind:s,outcome:c,exitCode:t,terminalSessionId:n.sessionId,provider:l})}}};Mze=I([m(2,Te)],Mze);function $fn(a,i){return a.includes(i.substring(0,Math.ceil(i.length/2)))}var jfn=te("terminalSymbolIcon.flagForeground",Esi,d(15660,null)),Qfn=te("terminalSymbolIcon.aliasForeground",_si,d(15654,null)),Yfn=te("terminalSymbolIcon.optionValueForeground",g9i,d(15658,null)),Xfn=te("terminalSymbolIcon.methodForeground",_si,d(15663,null)),Jfn=te("terminalSymbolIcon.argumentForeground",f9i,d(15655,null)),Zfn=te("terminalSymbolIcon.optionForeground",Esi,d(15664,null)),evn=te("terminalSymbolIcon.inlineSuggestionForeground",null,d(15662,null)),tvn=te("terminalSymbolIcon.fileForeground",QV,d(15659,null)),ivn=te("terminalSymbolIcon.folderForeground",Tsi,d(15661,null)),ovn=te("terminalSymbolIcon.commitForeground",QV,d(15657,null)),nvn=te("terminalSymbolIcon.branchForeground",QV,d(15656,null)),rvn=te("terminalSymbolIcon.tagForeground",QV,d(15672,null)),svn=te("terminalSymbolIcon.stashForeground",QV,d(15668,null)),avn=te("terminalSymbolIcon.remoteForeground",QV,d(15667,null)),lvn=te("terminalSymbolIcon.pullRequestForeground",QV,d(15666,null)),cvn=te("terminalSymbolIcon.pullRequestDoneForeground",QV,d(15665,null)),dvn=te("terminalSymbolIcon.symbolicLinkFileForeground",QV,d(15669,null)),uvn=te("terminalSymbolIcon.symbolicLinkFolderForeground",Tsi,d(15670,null)),pvn=te("terminalSymbolIcon.symbolText",QV,d(15671,null)),uLo=Ae("terminal-symbol-flag",R.flag,d(15652,null),jfn),pLo=Ae("terminal-symbol-alias",R.symbolMethod,d(15647,null),Qfn),mLo=Ae("terminal-symbol-option-value",R.symbolEnumMember,d(15676,null),Yfn),hLo=Ae("terminal-symbol-method",R.symbolMethod,d(15674,null),Xfn),gLo=Ae("terminal-symbol-argument",R.symbolVariable,d(15648,null),Jfn),fLo=Ae("terminal-symbol-option",R.symbolEnum,d(15675,null),Zfn),BBi=Ae("terminal-symbol-inline-suggestion",R.star,d(15673,null),evn),vLo=Ae("terminal-symbol-file",R.symbolFile,d(15651,null),tvn),bLo=Ae("terminal-symbol-folder",R.symbolFolder,d(15653,null),ivn),SLo=Ae("terminal-symbol-commit",R.gitCommit,d(15650,null),ovn),ILo=Ae("terminal-symbol-branch",R.gitBranch,d(15649,null),nvn),yLo=Ae("terminal-symbol-tag",R.tag,d(15684,null),rvn),wLo=Ae("terminal-symbol-stash",R.gitStash,d(15680,null),svn),CLo=Ae("terminal-symbol-remote",R.remote,d(15679,null),avn),xLo=Ae("terminal-symbol-pull-request",R.gitPullRequest,d(15678,null),lvn),kLo=Ae("terminal-symbol-pull-request-done",R.gitPullRequestDone,d(15677,null),cvn),ELo=Ae("terminal-symbol-symbolic-link-file",R.fileSymlinkFile,d(15681,null),dvn),TLo=Ae("terminal-symbol-symbolic-link-folder",R.fileSymlinkDirectory,d(15682,null),uvn),_Lo=Ae("terminal-symbol-symbol-text",R.symbolKey,d(15683,null),pvn);var DLo="terminal.suggest.increasedDiscoverability",LLo="terminal.suggest.increasedDiscoverabilityCount",mvn=10,hvn=1e4,Pze=class extends x{constructor(e,t,o){super();this._shellType=e;this._storageService=t;this._extensionService=o;this._firstShownTracker=void 0;this._done=this._storageService.getBoolean(DLo,-1,!1),this._count=this._storageService.getNumber(LLo,-1,0),this._register(this._extensionService.onWillStop(()=>this._firstShownTracker=void 0))}get done(){return this._done}resetState(){this._done=!1,this._count=0,this._start=void 0,this._firstShownTracker=void 0}resetTimer(){this._timeout&&(this._timeout.cancel(),this._timeout=void 0),this._start=void 0}update(e){this._done||(this._count++,this._storageService.store(LLo,this._count,-1,0),e&&!e.classList.contains("increased-discoverability")&&e.classList.add("increased-discoverability"),this._count>=mvn?this._setDone(e):this._start||(this.resetTimer(),this._start=Date.now(),this._timeout=this._register(new Ul(()=>{this._setDone(e)},hvn))))}_setDone(e){this._done=!0,this._storageService.store(DLo,!0,-1,0),e&&e.classList.remove("increased-discoverability"),this._timeout&&(this._timeout.cancel(),this._timeout=void 0),this._start=void 0}getFirstShown(e){if(!this._firstShownTracker)return this._firstShownTracker={window:!0,shell:new Set([e])},{window:!0,shell:!0};let t=this._firstShownTracker.window,o=!this._firstShownTracker.shell.has(e);return(t||o)&&this.updateShown(),{window:t,shell:o}}updateShown(){!this._shellType||!this._firstShownTracker||(this._firstShownTracker.window=!1,this._firstShownTracker.shell.add(this._shellType))}};Pze=I([m(1,ce),m(2,lt)],Pze);function RLo(a){return a?a==="bash"||a==="zsh"||a==="fish"||a==="pwsh"||a==="gitbash":!1}var qq=class extends x{constructor(e,t,o,n,r,s,l,c,u){super();this._sessionId=e;this._capabilities=o;this._terminalSuggestWidgetVisibleContextKey=n;this._terminalCompletionService=r;this._configurationService=s;this._instantiationService=l;this._terminalConfigurationService=c;this._logService=u;this._promptInputModelSubscriptions=this._register(new me);this._enableWidget=!0;this._isFilteringDirectories=!1;this._cursorIndexDelta=0;this._requestedCompletionsIndex=0;this._lastUserDataTimestamp=0;this._ignoreFocusEvents=!1;this._requestCompletionsOnNextSync=!1;this.isPasting=!1;this._onBell=this._register(new E);this.onBell=this._onBell.event;this._onAcceptedCompletion=this._register(new E);this.onAcceptedCompletion=this._onAcceptedCompletion.event;this._onDidReceiveCompletions=this._register(new E);this.onDidReceiveCompletions=this._onDidReceiveCompletions.event;this._onDidFontConfigurationChange=this._register(new E);this.onDidFontConfigurationChange=this._onDidFontConfigurationChange.event;this._kindToIconMap=new Map([[0,vLo],[1,bLo],[8,ELo],[9,TLo],[2,hLo],[3,pLo],[4,gLo],[5,fLo],[6,mLo],[7,uLo],[10,SLo],[11,ILo],[12,yLo],[13,wLo],[14,CLo],[15,xLo],[16,kLo],[100,BBi],[101,BBi]]);this._kindToKindLabelMap=new Map([[0,d(15632,null)],[1,d(15634,null)],[8,d(15644,null)],[9,d(15645,null)],[2,d(15637,null)],[3,d(15628,null)],[4,d(15629,null)],[5,d(15638,null)],[6,d(15639,null)],[7,d(15633,null)],[10,d(15631,null)],[11,d(15630,null)],[12,d(15646,null)],[13,d(15643,null)],[14,d(15642,null)],[15,d(15640,null)],[16,d(15641,null)],[100,d(15635,null)],[101,d(15636,null)]]);this._inlineCompletion={label:"",inputData:"\x1B[C",replacementRange:[0,0],provider:"core:inlineSuggestion",detail:"Inline suggestion",kind:100,kindLabel:"Inline suggestion",icon:this._kindToIconMap.get(100)};this._inlineCompletionItem=new f_e(this._inlineCompletion);this._shouldSyncWhenReady=!1;if(this.shellType=t,this.shellType)this._shellTypeInit=Promise.resolve();else{let p=this._register(new FI),h=this._register(new Ul);this._shellTypeInit=new Promise(g=>{p.cancelAndSet(()=>{this.shellType&&g()},50),h.cancelAndSet(g,5e3)}).then(()=>{this._store.delete(p),this._store.delete(h)})}this._register(U.runAndSubscribe(this._capabilities.onDidChangeCapabilities,()=>{let p=this._capabilities.get(2);p?this._promptInputModel!==p.promptInputModel&&(this._promptInputModel=p.promptInputModel,this._suggestTelemetry=this._register(this._instantiationService.createInstance(Mze,p,this._promptInputModel)),this._promptInputModelSubscriptions.value=wn(this._promptInputModel.onDidChangeInput(h=>this._sync(h)),this._promptInputModel.onDidFinishInput(()=>{this.hideSuggestWidget(!0)})),this._shouldSyncWhenReady&&(this._sync(this._promptInputModel),this._shouldSyncWhenReady=!1)):this._promptInputModel=void 0})),this._register(this._terminalConfigurationService.onConfigChanged(()=>this._cachedFontInfo=void 0)),this._register(U.runAndSubscribe(this._configurationService.onDidChangeConfiguration,p=>{if(!p||p.affectsConfiguration("terminal.integrated.suggest.inlineSuggestion")){let h=this._configurationService.getValue(ZK).inlineSuggestion;this._inlineCompletionItem.isInvalid=h==="off",h==="alwaysOnTopExceptExactMatch"?this._inlineCompletion.kind=100:this._inlineCompletion.kind=101,this._model?.forceRefilterAll()}}))}static{this.lastAcceptedCompletionTimestamp=0}activate(e){this._terminal=e,this._register(e.onKey(async t=>{this._lastUserData=t.key,this._lastUserDataTimestamp=Date.now()})),this._register(e.onScroll(()=>this.hideSuggestWidget(!0))),this._register(e.onResize(()=>this._relayoutOnResize()))}async _handleCompletionProviders(e,t,o){if(this._logService.trace("SuggestAddon#_handleCompletionProviders"),!e?.element||!this._enableWidget||!this._promptInputModel||!Gr(e.element))return;await this._shellTypeInit;let n=!1;if(this._promptInputModel.value!==""&&this._lastUserDataTimestamp<qq.lastAcceptedCompletionTimestamp&&(n=!0),this._currentPromptInputState={value:this._promptInputModel.value,prefix:this._promptInputModel.prefix,suffix:this._promptInputModel.suffix,cursorIndex:this._promptInputModel.cursorIndex,ghostTextIndex:this._promptInputModel.ghostTextIndex},this._requestedCompletionsIndex=this._currentPromptInputState.cursorIndex,o&&this._container){let S=this._ensureSuggestWidget(e),y=this._getCursorPosition(e);y&&S.showTriggered(!0,y)}let r=$gi(this._configurationService.getValue(ZK).quickSuggestions),s=o||r.unknown==="on";this._logService.trace("SuggestAddon#_handleCompletionProviders provideCompletions");let l=this._mostRecentPromptInputState?.ghostTextIndex===void 0?-1:this._mostRecentPromptInputState?.ghostTextIndex,c=l>-1?this._currentPromptInputState.value.substring(0,l):this._currentPromptInputState.value,u=await this._terminalCompletionService.provideCompletions(c,this._currentPromptInputState.cursorIndex,s,this.shellType,this._capabilities,t,!1,n,o);if(this._logService.trace("SuggestAddon#_handleCompletionProviders provideCompletions done"),t.isCancellationRequested)return;this._onDidReceiveCompletions.fire(),this._cursorIndexDelta=this._promptInputModel.cursorIndex-this._requestedCompletionsIndex,this._leadingLineContent=this._promptInputModel.prefix.substring(0,this._requestedCompletionsIndex+this._cursorIndexDelta);let p=u?.flat()||[];if(!o&&!p.length){this.hideSuggestWidget(!0);return}let h=this._leadingLineContent.length===0?"":this._leadingLineContent[0];(this._leadingLineContent.includes(" ")||h==="[")&&(this._leadingLineContent=this._promptInputModel.prefix);let g=this._leadingLineContent;if(this._isFilteringDirectories=p.some(S=>S.kind===1),this._isFilteringDirectories){let S=p.find(k=>k.kind===1),w=(Fe(S?.label)?S.label:S?.label.label)?.match(/(?<sep>[\\\/])/)?.groups?.sep;w&&(this._pathSeparator=w),this._pathSeparator&&(g=MLo(g,this._pathSeparator))}this._refreshInlineCompletion(p);for(let S of p)S.icon||(S.kind!==void 0?(S.icon=this._kindToIconMap.get(S.kind),S.kindLabel=this._kindToKindLabelMap.get(S.kind)):S.icon=_Lo);let f=new Fct(g,this._cursorIndexDelta),v=p.filter(S=>!!S.label).map(S=>new f_e(S,this._pathSeparator));RLo(this.shellType)&&v.push(this._inlineCompletionItem),this._logService.trace("TerminalCompletionService#_collectCompletions create model");let b=new $8t(v,f);if(this._logService.trace("TerminalCompletionService#_collectCompletions create model done"),t.isCancellationRequested){this._completionRequestTimestamp=void 0;return}this._showCompletions(b,o)}setContainerWithOverflow(e){let t=this._container!==e,o=this._suggestWidget?.element.domNode.parentElement!==e;!t&&!o||(this._container=e,this._suggestWidget&&e.appendChild(this._suggestWidget.element.domNode))}setScreen(e){this._screen=e}toggleExplainMode(){this._suggestWidget?.toggleExplainMode()}toggleSuggestionFocus(){this._suggestWidget?.toggleDetailsFocus()}toggleSuggestionDetails(){this._suggestWidget?.toggleDetails()}resetWidgetSize(){this._suggestWidget?.resetWidgetSize()}async requestCompletions(e){if(this._logService.trace("SuggestAddon#requestCompletions"),!this._promptInputModel){this._shouldSyncWhenReady=!0;return}if(this.isPasting)return;this._cancellationTokenSource&&(this._cancellationTokenSource.cancel(),this._cancellationTokenSource.dispose()),this._cancellationTokenSource=new Ye;let t=this._cancellationTokenSource.token;this._completionRequestTimestamp=Date.now(),await this._handleCompletionProviders(this._terminal,t,e),this._terminalSuggestWidgetVisibleContextKey.get()||(this._completionRequestTimestamp=void 0)}_addPropertiesToInlineCompletionItem(e){let t=(Fe(this._inlineCompletionItem.completion.label)?this._inlineCompletionItem.completion.label:this._inlineCompletionItem.completion.label.label).trim(),o=e.findIndex(n=>Fe(n.label)?n.label===t:n.label.label===t);if(o!==-1){let n=e.splice(o,1)[0];this._inlineCompletionItem.completion.label=n.label,this._inlineCompletionItem.completion.detail=n.detail,this._inlineCompletionItem.completion.documentation=n.documentation}else this._inlineCompletionItem.completion&&(this._inlineCompletionItem.completion.detail=void 0,this._inlineCompletionItem.completion.documentation=void 0)}_requestTriggerCharQuickSuggestCompletions(){return!this._wasLastInputVerticalArrowKey()&&!this._wasLastInputTabKey()&&(!this._wasLastInputIncludedEscape()||this._terminalSuggestWidgetVisibleContextKey.get())?(this.requestCompletions(),!0):!1}_checkProviderTriggerCharacters(e){for(let t of this._terminalCompletionService.providers)if(t.triggerCharacters){for(let o of t.triggerCharacters)if(e===o)return!0}return!1}_wasLastInputRightArrowKey(){return!!this._lastUserData?.match(/^\x1b[\[O]?C$/)}_wasLastInputVerticalArrowKey(){return!!this._lastUserData?.match(/^\x1b[\[O]?[A-B]$/)}_wasLastInputIncludedEscape(){return!!this._lastUserData?.includes("\x1B")}_wasLastInputArrowKey(){return!!this._lastUserData?.match(/^\x1b[\[O]?[A-D]$/)}_wasLastInputTabKey(){return this._lastUserData==="	"}_sync(e){let t=this._configurationService.getValue(ZK),o=$gi(t.quickSuggestions);{let s=!1;if(this._requestCompletionsOnNextSync&&(this._requestCompletionsOnNextSync=!1,s=this._requestTriggerCharQuickSuggestCompletions()),!this._mostRecentPromptInputState||e.cursorIndex>this._mostRecentPromptInputState.cursorIndex){if(!this._terminalSuggestWidgetVisibleContextKey.get()){let l=e.prefix.trim().match(/\s/);(!l&&o.commands==="on"||l&&o.arguments==="on")&&e.prefix.match(/[^\s]$/)&&(s=this._requestTriggerCharQuickSuggestCompletions())}if(t.suggestOnTriggerCharacters&&!s){let l=e.prefix;if((l?.match(/\s[\-]$/)||this._isFilteringDirectories&&l?.match(/[\\\/]$/))&&(s=this._requestTriggerCharQuickSuggestCompletions()),!s){for(let c of this._terminalCompletionService.providers)if(c.triggerCharacters){for(let u of c.triggerCharacters)if(l?.endsWith(u)){s=this._requestTriggerCharQuickSuggestCompletions();break}}}}}if(this._mostRecentPromptInputState&&e.cursorIndex<this._mostRecentPromptInputState.cursorIndex&&e.cursorIndex>0&&this._terminalSuggestWidgetVisibleContextKey.get()&&t.suggestOnTriggerCharacters&&!s&&this._mostRecentPromptInputState.cursorIndex>0){let l=this._mostRecentPromptInputState.value[this._mostRecentPromptInputState.cursorIndex-1];l&&(this._isFilteringDirectories&&l.match(/[\\\/]$/)||this._checkProviderTriggerCharacters(l))&&(s=this._requestTriggerCharQuickSuggestCompletions())}}if(this._wasLastInputRightArrowKey()&&this._mostRecentPromptInputState?.ghostTextIndex!==-1&&e.ghostTextIndex===-1&&this._mostRecentPromptInputState?.value===e.value&&this.hideSuggestWidget(!1),this._mostRecentPromptInputState=e,!this._promptInputModel||!this._terminal||!this._suggestWidget||this._leadingLineContent===void 0)return;let n=this._currentPromptInputState;if(this._currentPromptInputState=e,this._currentPromptInputState.cursorIndex>1&&this._currentPromptInputState.value.at(this._currentPromptInputState.cursorIndex-1)===" "&&!this._wasLastInputArrowKey()){this.hideSuggestWidget(!1);return}if(this._currentPromptInputState&&this._currentPromptInputState.cursorIndex<this._leadingLineContent.length&&(this._currentPromptInputState.cursorIndex<=0||n?.value[this._currentPromptInputState.cursorIndex]?.match(/[\\\/\s]/))){this.hideSuggestWidget(!1);return}if(this._terminalSuggestWidgetVisibleContextKey.get()){this._cursorIndexDelta=this._currentPromptInputState.cursorIndex-this._requestedCompletionsIndex;let s=this._currentPromptInputState.value.substring(0,this._requestedCompletionsIndex+this._cursorIndexDelta);this._isFilteringDirectories&&this._pathSeparator&&(s=MLo(s,this._pathSeparator));let l=new Fct(s,this._cursorIndexDelta);this._suggestWidget.setLineContext(l)}if(this._refreshInlineCompletion(this._model?.items.map(s=>s.completion)||[]),!this._suggestWidget.hasCompletions()){this.hideSuggestWidget(!1);return}let r=this._getCursorPosition(this._terminal);r&&this._suggestWidget.showSuggestions(0,!1,!0,r)}_refreshInlineCompletion(e){if(!RLo(this.shellType))return;let t=this._inlineCompletionItem.isInvalid;if(!this._currentPromptInputState||this._currentPromptInputState.ghostTextIndex===-1)this._inlineCompletionItem.isInvalid=!0;else{this._inlineCompletionItem.isInvalid=!1;let o=this._currentPromptInputState.value.lastIndexOf(" ",this._currentPromptInputState.ghostTextIndex-1),n=o===-1?0:o+1,r=this._currentPromptInputState.value.substring(n);this._inlineCompletion.label=r;let s=this._currentPromptInputState.cursorIndex-this._cursorIndexDelta;this._inlineCompletion.replacementRange=[n,s],this._addPropertiesToInlineCompletionItem(e);let l=new f_e(this._inlineCompletion,this._pathSeparator);this._inlineCompletionItem.idx=l.idx,this._inlineCompletionItem.score=l.score,this._inlineCompletionItem.labelLow=l.labelLow,this._inlineCompletionItem.textLabel=l.textLabel,this._inlineCompletionItem.fileExtLow=l.fileExtLow,this._inlineCompletionItem.labelLowExcludeFileExt=l.labelLowExcludeFileExt,this._inlineCompletionItem.labelLowNormalizedPath=l.labelLowNormalizedPath,this._inlineCompletionItem.punctuationPenalty=l.punctuationPenalty,this._inlineCompletionItem.word=l.word,this._model?.forceRefilterAll()}this._inlineCompletionItem.isInvalid!==t&&this._model?.forceRefilterAll()}_getTerminalDimensions(){let e=this._terminal._core._renderService.dimensions.css.cell;return{width:e.width,height:e.height}}_getCursorPosition(e){let t=this._getTerminalDimensions();if(!t.width||!t.height)return;let o=this._screen.getBoundingClientRect();return{left:o.left+e.buffer.active.cursorX*t.width,top:o.top+e.buffer.active.cursorY*t.height,height:t.height}}_getFontInfo(){if(this._cachedFontInfo)return this._cachedFontInfo;let e=this._terminal._core,t=this._terminalConfigurationService.getFont(Ki(),e),o=t.lineHeight,n=t.fontSize,r=t.fontFamily,s=t.letterSpacing,l=this._configurationService.getValue("editor.fontWeight");o=o*n,o=Math.round(o);let c=aZt*n;o<c&&(o=c);let u={fontSize:n,lineHeight:o,fontWeight:l.toString(),letterSpacing:s,fontFamily:r};return this._cachedFontInfo=u,u}_getAdvancedExplainModeDetails(){return`promptInputModel: ${this._promptInputModel?.getCombinedString()}`}_showCompletions(e,t){if(this._logService.trace("SuggestAddon#_showCompletions"),!this._terminal?.element||!this._container)return;let o=this._ensureSuggestWidget(this._terminal);if(this._logService.trace("SuggestAddon#_showCompletions setCompletionModel"),o.setCompletionModel(e),this._register(o.onDidFocus(()=>this._terminal?.focus())),!this._promptInputModel||!t&&e.items.length===0)return;this._model=e;let n=this._getCursorPosition(this._terminal);if(n){if(this._completionRequestTimestamp!==void 0){let r=Date.now()-this._completionRequestTimestamp;if(this._suggestTelemetry&&this._discoverability){let s=this._discoverability.getFirstShown(this.shellType);this._discoverability.updateShown(),this._suggestTelemetry.logCompletionLatency(this._sessionId,r,s)}this._completionRequestTimestamp=void 0}this._logService.trace("SuggestAddon#_showCompletions suggestWidget.showSuggestions"),o.showSuggestions(0,!1,!t,n)}}_ensureSuggestWidget(e){return this._suggestWidget||(this._suggestWidget=this._register(this._instantiationService.createInstance(zU,this._container,this._instantiationService.createInstance(Wct),{statusBarMenuId:D.MenubarTerminalSuggestStatusMenu,showStatusBarSettingId:"terminal.integrated.suggest.showStatusBar",selectionModeSettingId:"terminal.integrated.suggest.selectionMode",preventDetailsPlacements:[1]},this._getFontInfo.bind(this),this._onDidFontConfigurationChange.event.bind(this),this._getAdvancedExplainModeDetails.bind(this))),this._register(this._suggestWidget.onDidSelect(async o=>this.acceptSelectedSuggestion(o))),this._register(this._suggestWidget.onDidHide(()=>this._terminalSuggestWidgetVisibleContextKey.reset())),this._register(this._suggestWidget.onDidShow(()=>this._terminalSuggestWidgetVisibleContextKey.set(!0))),this._register(this._configurationService.onDidChangeConfiguration(o=>{(o.affectsConfiguration("terminal.integrated.fontFamily")||o.affectsConfiguration("terminal.integrated.fontSize")||o.affectsConfiguration("terminal.integrated.lineHeight")||o.affectsConfiguration("terminal.integrated.fontFamily")||o.affectsConfiguration("editor.fontSize")||o.affectsConfiguration("editor.fontFamily"))&&this._onDidFontConfigurationChange.fire()})),this._register(this._suggestWidget.onDidFocus(async o=>{if(this._ignoreFocusEvents)return;let n=o.item,r=o.index;n!==this._focusedItem&&(this._currentSuggestionDetails?.cancel(),this._currentSuggestionDetails=void 0,this._focusedItem=n,n&&(!n.completion.documentation||!n.completion.detail)&&(this._currentSuggestionDetails=Ln(async s=>{try{await n.resolve(s)}catch(l){this._logService.warn(`Failed to resolve suggestion details for item ${n} at index ${r}`,l)}}),this._currentSuggestionDetails.then(()=>{n!==this._focusedItem||!this._suggestWidget?.list||r>=this._suggestWidget.list.length||(this._ignoreFocusEvents=!0,this._suggestWidget.list.splice(r,1,[n]),this._suggestWidget.list.setFocus([r]),this._ignoreFocusEvents=!1)})))})),this._terminal?.element?.querySelector(".xterm-helper-textarea")&&this._register(j(sm(),"click",o=>{let n=o.target;this._terminal?.element?.contains(n)&&this._suggestWidget?.hide()})),this._register(this._suggestWidget.onDidShow(()=>this._updateDiscoverabilityState())),this._register(this._suggestWidget.onDidBlurDetails(o=>{let n=o.relatedTarget;this._terminal?.element?.contains(n)||this._suggestWidget?.hide()})),this._terminalSuggestWidgetVisibleContextKey.set(!1)),this._suggestWidget}_updateDiscoverabilityState(){this._discoverability||(this._discoverability=this._register(this._instantiationService.createInstance(Pze,this.shellType))),!(!this._suggestWidget||this._discoverability?.done)&&this._discoverability?.update(this._suggestWidget.element.domNode)}resetDiscoverability(){this._discoverability?.resetState()}selectPreviousSuggestion(){this._suggestWidget?.selectPrevious()}selectPreviousPageSuggestion(){this._suggestWidget?.selectPreviousPage()}selectNextSuggestion(){this._suggestWidget?.selectNext()}selectNextPageSuggestion(){this._suggestWidget?.selectNextPage()}acceptSelectedSuggestion(e,t){e||(e=this._suggestWidget?.getFocusedItem());let o=this._mostRecentPromptInputState;if(!e?.item||!o||this._leadingLineContent===void 0||!this._model){this._suggestTelemetry?.acceptCompletion(this._sessionId,void 0,this._mostRecentPromptInputState?.value);return}qq.lastAcceptedCompletionTimestamp=Date.now(),this._suggestWidget?.hide();let n=this._currentPromptInputState??o,r=e.item.completion.replacementRange?.[0]??n.cursorIndex,s=n.value.substring(r,n.cursorIndex),l="";if((n.ghostTextIndex===-1||n.ghostTextIndex>n.cursorIndex)&&n.value.length>n.cursorIndex+1&&n.value.at(n.cursorIndex)!==" "){let h=n.value.substring(n.cursorIndex,n.ghostTextIndex===-1?void 0:n.ghostTextIndex).indexOf(" ");l=n.value.substring(n.cursorIndex,h===-1?void 0:n.cursorIndex+h)}let c=e.item.completion,u=c.inputData;if(u===void 0){let h=Fe(c.label)?c.label:c.label.label;(c.kind===1||c.isFileOverride)&&h.includes(" ")&&(h=h.replaceAll(" ","\\ "));let g=!1;if(t)switch(this._configurationService.getValue(ZK).runOnEnter){case"always":{g=!0;break}case"exactMatch":{g=s.toLowerCase()===h.toLowerCase();break}case"exactMatchIgnoreExtension":{g=s.toLowerCase()===h.toLowerCase(),c.isFileOverride&&(g||=s.toLowerCase()===h.toLowerCase().replace(/\.[^\.]+$/,""));break}}let f=tf(s,h),v=s.substring(s.length-1-f,s.length-1),b=h.substring(f);n.suffix.length>0&&n.prefix.endsWith(v)&&n.suffix.startsWith(b)?u="\x1BOC".repeat(h.length-f):u=["\x7F".repeat(s.length-f),"\x1B[3~".repeat(l.length),b,g?"\r":""].join("")}c.kind===1&&(qq.lastAcceptedCompletionTimestamp=0),this._configurationService.getValue(ZK).insertTrailingSpace&&c.kind!==1&&c.kind!==9&&(u+=" ",this._lastUserDataTimestamp=Date.now(),this._requestCompletionsOnNextSync=!0),this._onAcceptedCompletion.fire(u),this._suggestTelemetry?.acceptCompletion(this._sessionId,c,this._mostRecentPromptInputState?.value),this.hideSuggestWidget(!0)}hideSuggestWidget(e){this._discoverability?.resetTimer(),e&&(this._cancellationTokenSource?.cancel(),this._cancellationTokenSource=void 0,this._currentSuggestionDetails?.cancel(),this._currentSuggestionDetails=void 0),this._currentPromptInputState=void 0,this._leadingLineContent=void 0,this._focusedItem=void 0,this._suggestWidget?.hide()}_relayoutOnResize(){if(!this._terminalSuggestWidgetVisibleContextKey.get()||!this._terminal)return;let e=this._getCursorPosition(this._terminal);if(!e){this.hideSuggestWidget(!0);return}this._suggestWidget?.relayout(e)}};qq=I([m(4,tZ),m(5,B),m(6,F),m(7,Uu),m(8,ca)],qq);var Wct=class{constructor(i){this._storageService=i;this._key="terminal.integrated.suggestSize"}restore(){let i=this._storageService.get(this._key,0)??"";try{let e=JSON.parse(i);if(si.is(e))return si.lift(e)}catch{}}store(i){this._storageService.store(this._key,JSON.stringify(i),0,1)}reset(){this._storageService.remove(this._key,0)}};Wct=I([m(0,ce)],Wct);function MLo(a,i){return i==="/"?a.replaceAll("\\","/"):a.replaceAll("/","\\")}var j8t=class extends x{constructor(e,t,o){super();this.id="lsp";this.isBuiltin=!0;this.shellTypes=["python"];this._provider=e,this._textVirtualModel=t,this._lspTerminalModelContentProvider=o,this.triggerCharacters=e.triggerCharacters?[...e.triggerCharacters," ","("]:[" ","("]}activate(e){}async provideCompletions(e,t,o){this._lspTerminalModelContentProvider.trackPromptInputToVirtualFile(e);let n=e.substring(0,t),r=n.split(`
`),s=r[r.length-1].length+1,l=this._textVirtualModel.object.textEditorModel.getLineCount(),c=new ye(l,s),u=[];if(this._provider&&this._provider._debugDisplayName!=="wordbasedCompletions"){let p=await this._provider.provideCompletionItems(this._textVirtualModel.object.textEditorModel,c,{triggerKind:1},o);for(let h of p?.suggestions||[]){let g=h.kind?Qno(h.kind):2,f=gvn(t,n,g,"lspCompletionItem",void 0),v={label:h.label,provider:`lsp:${h.extensionId?.value}`,detail:h.detail,documentation:h.documentation,kind:g,replacementRange:f.replacementRange};this._provider.resolveCompletionItem&&(!h.detail||!h.documentation)&&(v._unresolvedItem=h,v._resolveProvider=this._provider),u.push(v)}}return u}};function gvn(a,i,e,t,o){let n=fvn(i);return{label:t,detail:o??"",replacementRange:[a-n.length,a],kind:e??2}}function fvn(a){if(a.endsWith(" ")||a.endsWith("."))return"";let i=a.lastIndexOf(" "),e=a.lastIndexOf("."),t=a.lastIndexOf("("),o=Math.max(i,e,t);return o===-1?a:a.substring(o+1)}var Aze=`vscode_lsp_terminal_prompt_tracker= {}
`,vvn=new Set([{shellType:"python",languageId:"python",extension:"py"}]);function PLo(a){for(let i of vvn)if(i.shellType===a)return i}var Ere=class extends x{constructor(e,t,o,n,r,s,l){super();this._modelService=s;this._languageService=l;this._onCommandFinishedListener=this._register(new me);this._register(r.registerTextModelContentProvider(Ere.scheme,this)),this._capabilitiesStore=e,this._commandDetection=this._capabilitiesStore.get(2),this._registerTerminalCommandFinishedListener(),this._virtualTerminalDocumentUri=o,this._shellType=n}static{this.scheme=Q.vscodeTerminal}shellTypeChanged(e){this._shellType=e}setContent(e){let t=this._modelService.getModel(this._virtualTerminalDocumentUri);if(this._shellType&&t){let o=t.getValue();if(o==="")t.setValue(Aze);else{let n=o.lastIndexOf(Aze),s=(n!==-1?o.substring(0,n):o)+`
`+e+`
`+Aze;t.setValue(s)}}}trackPromptInputToVirtualFile(e){this._commandDetection=this._capabilitiesStore.get(2);let t=this._modelService.getModel(this._virtualTerminalDocumentUri);if(this._shellType&&t){let o=t.getValue(),n=o.lastIndexOf(Aze),s=(n!==-1?o.substring(0,n):o)+Aze+e;t.setValue(s)}}_registerTerminalCommandFinishedListener(){let e=()=>{this._onCommandFinishedListener.value||this._commandDetection&&this._commandDetection.onCommandFinished&&(this._onCommandFinishedListener.value=this._register(this._commandDetection.onCommandFinished(t=>{t.exitCode===0&&this._shellType&&this.setContent(t.command)})))};e(),this._register(this._capabilitiesStore.onDidAddCommandDetectionCapability(t=>{this._commandDetection=t,e()}))}async provideTextContent(e){let t=this._modelService.getModel(e);if(t&&!t.isDisposed())return t;let o=this._languageService.guessLanguageIdByFilepathOrFirstLine(e),n=o?this._languageService.createById(o):this._languageService.createById("plaintext");return this._modelService.createModel("",n,e,!1)}};Ere=I([m(4,Bt),m(5,Tt),m(6,_t)],Ere);function ALo(a,i){return A.from({scheme:Q.vscodeTerminal,path:`/terminal${a}.${i}`})}Ee(tZ,v_e,1);var _I=class extends N{constructor(e,t,o,n,r,s,l){super();this._ctx=e;this._contextKeyService=t;this._configurationService=o;this._instantiationService=n;this._terminalCompletionService=r;this._textModelService=s;this._languageFeaturesService=l;this._addon=new me;this._lspAddons=this.add(new Vt);this._lspModelProvider=new me;this.add(Z(()=>{this._addon?.dispose(),this._lspModelProvider?.value?.dispose(),this._lspModelProvider?.dispose()})),this._terminalSuggestWidgetVisibleContextKey=dt.suggestWidgetVisible.bindTo(this._contextKeyService),this.add(this._configurationService.onDidChangeConfiguration(c=>{if(c.affectsConfiguration("terminal.integrated.suggest.enabled")){let u=this._configurationService.getValue(ZK).enabled;u||(this._addon.clear(),this._lspAddons.clearAndDisposeAll());let p=this._ctx.instance.xterm?.raw;p&&u&&this._loadAddons(p)}})),bbe.initialize(this._instantiationService),this.add(this._ctx.instance.onDidChangeTarget(c=>{this._updateContainerForTarget(c)})),this.add(this._ctx.instance.onDidFocus(()=>{let c=this._ctx.instance.xterm?.raw;c&&this._prepareAddonLayout(c)}))}static{this.ID="terminal.suggest"}static get(e){return e.getContribution(_I.ID)}get addon(){return this._addon.value}get lspAddons(){return Array.from(this._lspAddons.values())}xtermOpen(e){this._configurationService.getValue(ZK).enabled&&(this._loadAddons(e.raw),this.add(U.runAndSubscribe(this._ctx.instance.onDidChangeShellType,async()=>{this._refreshAddons(),this._lspModelProvider.value?.shellTypeChanged(this._ctx.instance.shellType)})))}async _loadLspCompletionAddon(e){let t;if(!this._ctx.instance.shellType||!(t=PLo(this._ctx.instance.shellType))){this._lspAddons.clearAndDisposeAll();return}let o=ALo(this._ctx.instance.instanceId,t.extension);this._lspModelProvider.value=this._instantiationService.createInstance(Ere,this._ctx.instance.capabilities,this._ctx.instance.instanceId,o,this._ctx.instance.shellType),this.add(this._lspModelProvider.value);let n=await this._textModelService.createModelReference(o);this.add(n);let s=this._languageFeaturesService.completionProvider.all(n.object.textEditorModel).filter(l=>l._debugDisplayName!=="wordbasedCompletions");for(let l of s){let c=this._instantiationService.createInstance(j8t,l,n,this._lspModelProvider.value);this._lspAddons.set(l._debugDisplayName,c),e.loadAddon(c),this.add(this._terminalCompletionService.registerTerminalCompletionProvider("lsp",c.id,c,...c.triggerCharacters??[]))}}_loadAddons(e){if(this._addon.value)return;let t=this._addon.value=this._instantiationService.createInstance(qq,this._ctx.instance.sessionId,this._ctx.instance.shellType,this._ctx.instance.capabilities,this._terminalSuggestWidgetVisibleContextKey);e.loadAddon(t),this._loadLspCompletionAddon(e),this._prepareAddonLayout(e),this.add(j(this._ctx.instance.domElement,re.FOCUS_OUT,n=>{n.relatedTarget?.classList.contains(lLo)||t.hideSuggestWidget(!0)})),this.add(t.onAcceptedCompletion(async n=>{this._ctx.instance.focus(),this._ctx.instance.sendText(n,!1)}));let o=bL.get(this._ctx.instance);if(this.add(o.onWillPaste(()=>t.isPasting=!0)),this.add(o.onDidPaste(()=>{setTimeout(()=>t.isPasting=!1,100)})),!ei){let n;this.add(t.onDidReceiveCompletions(()=>{n?.open(),n=void 0}))}}_refreshAddons(){let e=this._addon.value;e&&(e.shellType=this._ctx.instance.shellType,this._ctx.instance.xterm?.raw&&this._loadLspCompletionAddon(this._ctx.instance.xterm.raw))}_updateContainerForTarget(e){!this._addon.value||!this._ctx.instance.xterm?.raw||this._prepareAddonLayout(this._ctx.instance.xterm.raw)}async _prepareAddonLayout(e){let t=this._addon.value;if(!t||this.isDisposed)return;let o=e.element??await this._waitForXtermElement(e);if(!o||this.isDisposed||t!==this._addon.value)return;let n=this._resolveAddonContainer(o);t.setContainerWithOverflow(n);let r=o?.querySelector(".xterm-screen");Do(r)&&t.setScreen(r)}async _waitForXtermElement(e){if(e.element)return e.element;if(await Promise.race([U.toPromise(U.filter(this._ctx.instance.onDidChangeVisibility,t=>t)),U.toPromise(this._ctx.instance.onDisposed)]),!(this.isDisposed||this._ctx.instance.isDisposed))return e.element??void 0}_resolveAddonContainer(e){return this._ctx.instance.target===2?e:Cg(e,"panel")??e}};_I=I([m(1,X),m(2,B),m(3,F),m(4,tZ),m(5,Bt),m(6,Qt)],_I);Mp(_I.ID,_I);Er({id:"workbench.action.terminal.changeSelectionModeNever",title:L(15609,"Selection Mode: None"),tooltip:L(15610,"Do not select the top suggestion until down is pressed, at which point Tab or Enter will accept the suggestion. Activate to change."),f1:!1,precondition:C.and(C.or(dt.processSupported,dt.terminalHasBeenCreated),dt.focus,dt.isOpen,dt.suggestWidgetVisible,C.equals("config.terminal.integrated.suggest.selectionMode","never")),menu:{id:D.MenubarTerminalSuggestStatusMenu,group:"left",order:1,when:C.and(C.equals("config.terminal.integrated.suggest.selectionMode","never"),C.or(C.equals("config.terminal.integrated.suggest.quickSuggestions",!0),C.equals("config.terminal.integrated.suggest.suggestOnTriggerCharacters",!0)))},run:(a,i)=>{i.get(B).updateValue("terminal.integrated.suggest.selectionMode","partial")}});Er({id:"workbench.action.terminal.changeSelectionModePartial",title:L(15611,"Selection Mode: Partial (Tab)"),tooltip:L(15612,"Partially select the top suggestion, Tab will accept a suggestion when visible. Activate to change."),f1:!1,precondition:C.and(C.or(dt.processSupported,dt.terminalHasBeenCreated),dt.focus,dt.isOpen,dt.suggestWidgetVisible,C.equals("config.terminal.integrated.suggest.selectionMode","partial")),menu:{id:D.MenubarTerminalSuggestStatusMenu,group:"left",order:1,when:C.and(C.equals("config.terminal.integrated.suggest.selectionMode","partial"),C.or(C.equals("config.terminal.integrated.suggest.quickSuggestions",!0),C.equals("config.terminal.integrated.suggest.suggestOnTriggerCharacters",!0)))},run:(a,i)=>{i.get(B).updateValue("terminal.integrated.suggest.selectionMode","always")}});Er({id:"workbench.action.terminal.changeSelectionModeAlways",title:L(15607,"Selection Mode: Always (Tab or Enter)"),tooltip:L(15608,"Always select the top suggestion, Tab or Enter will accept a suggestion when visible. Activate to change."),f1:!1,precondition:C.and(C.or(dt.processSupported,dt.terminalHasBeenCreated),dt.focus,dt.isOpen,dt.suggestWidgetVisible),menu:{id:D.MenubarTerminalSuggestStatusMenu,group:"left",order:1,when:C.and(C.equals("config.terminal.integrated.suggest.selectionMode","always"),C.or(C.equals("config.terminal.integrated.suggest.quickSuggestions",!0),C.equals("config.terminal.integrated.suggest.suggestOnTriggerCharacters",!0)))},run:(a,i)=>{i.get(B).updateValue("terminal.integrated.suggest.selectionMode","never")}});Er({id:"workbench.action.terminal.doNotShowSuggestOnType",title:L(15614,"Don't show IntelliSense unless triggered explicitly. This disables the quick suggestions and suggest on trigger characters settings."),f1:!1,precondition:C.and(C.or(dt.processSupported,dt.terminalHasBeenCreated),dt.focus,dt.isOpen,dt.suggestWidgetVisible),icon:R.eye,menu:{id:D.MenubarTerminalSuggestStatusMenu,group:"right",order:1,when:C.and(C.or(C.equals("config.terminal.integrated.suggest.quickSuggestions.commands","on"),C.equals("config.terminal.integrated.suggest.quickSuggestions.arguments","on")),C.equals("config.terminal.integrated.suggest.suggestOnTriggerCharacters",!0))},run:(a,i)=>{i.get(B).updateValue("terminal.integrated.suggest.quickSuggestions",{commands:"off",arguments:"off",unknown:"off"}),i.get(B).updateValue("terminal.integrated.suggest.suggestOnTriggerCharacters",!1)}});Er({id:"workbench.action.terminal.showSuggestOnType",title:L(15623,"Show IntelliSense while typing. This enables the quick suggestions for commands and arguments, and suggest on trigger characters settings."),f1:!1,precondition:C.and(C.or(dt.processSupported,dt.terminalHasBeenCreated),dt.focus,dt.isOpen,dt.suggestWidgetVisible),icon:R.eyeClosed,menu:{id:D.MenubarTerminalSuggestStatusMenu,group:"right",order:1,when:C.or(C.and(C.equals("config.terminal.integrated.suggest.quickSuggestions.commands","off"),C.equals("config.terminal.integrated.suggest.quickSuggestions.arguments","off")),C.equals("config.terminal.integrated.suggest.suggestOnTriggerCharacters",!1))},run:(a,i)=>{i.get(B).updateValue("terminal.integrated.suggest.quickSuggestions",{commands:"on",arguments:"on",unknown:"off"}),i.get(B).updateValue("terminal.integrated.suggest.suggestOnTriggerCharacters",!0)}});Er({id:"workbench.action.terminal.suggestLearnMore",title:L(15617,"Learn More"),f1:!1,precondition:C.and(C.or(dt.processSupported,dt.terminalHasBeenCreated),dt.focus,dt.isOpen,dt.suggestWidgetVisible),icon:R.question,menu:{id:D.MenubarTerminalSuggestStatusMenu,group:"right",order:2},run:(a,i)=>{i.get(Je).open("https://aka.ms/vscode-terminal-intellisense")}});Er({id:"workbench.action.terminal.configureSuggestSettings",title:L(15613,"Configure"),f1:!1,precondition:C.and(C.or(dt.processSupported,dt.terminalHasBeenCreated),dt.focus,dt.isOpen,dt.suggestWidgetVisible),icon:R.gear,menu:{id:D.MenubarTerminalSuggestStatusMenu,group:"right",order:3},run:(a,i)=>i.get(Go).openSettings({query:ZK})});Jl({id:"workbench.action.terminal.triggerSuggest",title:L(15627,"Trigger Suggest"),f1:!1,keybinding:{primary:2058,mac:{primary:266},weight:201,when:C.and(dt.focus,dt.suggestWidgetVisible.negate(),C.equals("config.terminal.integrated.suggest.enabled",!0))},run:a=>_I.get(a)?.addon?.requestCompletions(!0)});Jl({id:"workbench.action.terminal.resetSuggestWidgetSize",title:L(15618,"Reset Suggest Widget Size"),run:a=>_I.get(a)?.addon?.resetWidgetSize()});Jl({id:"workbench.action.terminal.selectPrevSuggestion",title:L(15622,"Select the Previous Suggestion"),f1:!1,precondition:C.and(C.or(dt.processSupported,dt.terminalHasBeenCreated),dt.focus,dt.isOpen,dt.suggestWidgetVisible),keybinding:{primary:16,weight:201,when:C.or(VN.HasNavigated,C.equals("config.terminal.integrated.suggest.upArrowNavigatesHistory",!1))},run:a=>_I.get(a)?.addon?.selectPreviousSuggestion()});Jl({id:"workbench.action.terminal.selectPrevPageSuggestion",title:L(15621,"Select the Previous Page Suggestion"),f1:!1,precondition:C.and(C.or(dt.processSupported,dt.terminalHasBeenCreated),dt.focus,dt.isOpen,dt.suggestWidgetVisible),keybinding:{primary:11,weight:201},run:a=>_I.get(a)?.addon?.selectPreviousPageSuggestion()});Jl({id:"workbench.action.terminal.selectNextSuggestion",title:L(15620,"Select the Next Suggestion"),f1:!1,precondition:C.and(C.or(dt.processSupported,dt.terminalHasBeenCreated),dt.focus,dt.isOpen,dt.suggestWidgetVisible),keybinding:{primary:18,weight:201},run:a=>_I.get(a)?.addon?.selectNextSuggestion()});Jl({id:"terminalSuggestToggleExplainMode",title:L(15626,"Suggest Toggle Explain Modes"),f1:!1,precondition:C.and(C.or(dt.processSupported,dt.terminalHasBeenCreated),dt.focus,dt.isOpen,dt.suggestWidgetVisible),keybinding:{weight:201,primary:2138},run:a=>_I.get(a)?.addon?.toggleExplainMode()});Jl({id:"workbench.action.terminal.suggestToggleDetailsFocus",title:L(15625,"Suggest Toggle Suggestion Focus"),f1:!1,precondition:pe.textInputFocus.negate(),keybinding:{weight:200,primary:2570,mac:{primary:778}},run:a=>_I.get(a)?.addon?.toggleSuggestionFocus()});Jl({id:"workbench.action.terminal.suggestToggleDetails",title:L(15624,"Suggest Toggle Details"),f1:!1,precondition:C.and(C.or(dt.processSupported,dt.terminalHasBeenCreated),dt.isOpen,dt.focus,dt.suggestWidgetVisible,VN.HasFocusedSuggestion),keybinding:{weight:402,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}},run:a=>_I.get(a)?.addon?.toggleSuggestionDetails()});Jl({id:"workbench.action.terminal.selectNextPageSuggestion",title:L(15619,"Select the Next Page Suggestion"),f1:!1,precondition:C.and(C.or(dt.processSupported,dt.terminalHasBeenCreated),dt.focus,dt.isOpen,dt.suggestWidgetVisible),keybinding:{primary:12,weight:201},run:a=>_I.get(a)?.addon?.selectNextPageSuggestion()});Jl({id:"workbench.action.terminal.acceptSelectedSuggestion",title:L(15605,"Insert"),f1:!1,precondition:C.and(C.or(dt.processSupported,dt.terminalHasBeenCreated),dt.focus,dt.isOpen,dt.suggestWidgetVisible),keybinding:[{primary:2,weight:202,when:C.and(VN.HasFocusedSuggestion)},{primary:3,when:C.and(VN.HasFocusedSuggestion,C.or(VN.ExplicitlyInvoked,C.notEquals("config.terminal.integrated.suggest.selectionMode","partial"),VN.FirstSuggestionFocused.toNegated(),VN.HasNavigated)),weight:201}],run:a=>_I.get(a)?.addon?.acceptSelectedSuggestion()});Jl({id:"workbench.action.terminal.acceptSelectedSuggestionEnter",title:L(15606,"Accept Selected Suggestion (Enter)"),f1:!1,precondition:C.and(C.or(dt.processSupported,dt.terminalHasBeenCreated),dt.focus,dt.isOpen,dt.suggestWidgetVisible),keybinding:{primary:3,weight:201,when:C.notEquals("config.terminal.integrated.suggest.runOnEnter","never")},run:async a=>_I.get(a)?.addon?.acceptSelectedSuggestion(void 0,!0)});Jl({id:"workbench.action.terminal.hideSuggestWidget",title:L(15615,"Hide Suggest Widget"),f1:!1,precondition:C.and(C.or(dt.processSupported,dt.terminalHasBeenCreated),dt.focus,dt.isOpen,dt.suggestWidgetVisible),keybinding:{primary:9,weight:201},run:a=>_I.get(a)?.addon?.hideSuggestWidget(!0)});Jl({id:"workbench.action.terminal.hideSuggestWidgetAndNavigateHistory",title:L(15616,"Hide Suggest Widget and Navigate History"),f1:!1,precondition:C.and(C.or(dt.processSupported,dt.terminalHasBeenCreated),dt.focus,dt.isOpen,dt.suggestWidgetVisible),keybinding:{primary:16,when:C.and(VN.HasNavigated.negate(),C.equals("config.terminal.integrated.suggest.upArrowNavigatesHistory",!0)),weight:202},run:a=>{_I.get(a)?.addon?.hideSuggestWidget(!0),a.sendText("\x1B[A",!1)}});var bbe=class extends x{constructor(e,t){super();this._terminalCompletionService=e;this._terminalContributionService=t;this._register(this._terminalCompletionService.onDidChangeProviders(()=>{this._updateConfiguration()})),this._register(this._terminalContributionService.onDidChangeTerminalCompletionProviders(()=>{this._updateConfiguration()})),this._updateConfiguration()}static initialize(e){this._instance||(this._instance=e.createInstance(bbe))}_updateConfiguration(){let e=new Map;this._terminalContributionService.terminalCompletionProviders.forEach(t=>e.set(t.extensionIdentifier,{...t,id:t.extensionIdentifier}));for(let{id:t}of this._terminalCompletionService.providers)t&&!e.has(t)&&e.set(t,{id:t});jgi(e)}};bbe=I([m(0,tZ),m(1,x1e)],bbe);var Nze=class extends x{static{this.ID="terminalWslRecommendation"}constructor(i,e,t,o,n){if(super(),!ei)return;let r=o.exeBasedExtensionTips;if(!r||!r.wsl)return;let s=n.onDidCreateInstance(async l=>{async function c(p){return(await i.getInstalled()).some(g=>g.identifier.id===p)}if(!l.shellLaunchConfig.executable||jo(l.shellLaunchConfig.executable).toLowerCase()!=="wsl.exe")return;s?.dispose(),s=void 0;let u=Object.keys(r.wsl.recommendations).find(p=>r.wsl.recommendations[p].important);!u||await c(u)||t.prompt(ft.Info,d(15734,null,r.wsl.friendlyName),[{label:d(15733,null),run:()=>{e.createInstance(JA,u).run()}}],{priority:1,neverShowAgain:{id:"terminalConfigHelper/launchRecommendationsIgnore",scope:2},onCancel:()=>{}})})}};Nze=I([m(0,Cs),m(1,F),m(2,Ne),m(3,tt),m(4,nn)],Nze);It(Nze.ID,Nze,St.Eventually);var bvn={Ampersand:"&",ampersand:"&",Dollar:"$",dollar:"$",Percent:"%",percent:"%",Asterisk:"*",asterisk:"*",Plus:"+",plus:"+",Equals:"=",equals:"=",Exclamation:"!",exclamation:"!",Slash:"/",slash:"/",Backslash:"\\",backslash:"\\",Dot:".",dot:".",Period:".",period:".",Quote:"'",quote:"'","double quote":'"',"Double quote":'"'},ZW=class extends x{constructor(e,t,o,n){super();this._speechService=e;this._terminalService=t;this._configurationService=o;this._input="";this._register(this._terminalService.onDidChangeActiveInstance(()=>this.stop())),this._register(this._terminalService.onDidDisposeInstance(()=>this.stop())),this._disposables=this._register(new N),this._terminalDictationInProgress=dt.terminalDictationInProgress.bindTo(n)}static{this._instance=void 0}static getInstance(e){return ZW._instance||(ZW._instance=e.createInstance(ZW)),ZW._instance}async start(){this.stop();let e=this._configurationService.getValue("accessibility.voice.speechTimeout");(!Yo(e)||e<0)&&(e=NYe),this._acceptTranscriptionScheduler=this._disposables.add(new Dt(()=>{this._sendText(),this.stop()},e)),this._cancellationTokenSource=new Ye,this._register(Z(()=>this._cancellationTokenSource?.dispose(!0)));let t=await this._speechService.createSpeechToTextSession(this._cancellationTokenSource?.token,"terminal");this._disposables.add(t.onDidChange(o=>{if(!this._cancellationTokenSource?.token.isCancellationRequested)switch(o.status){case 1:this._terminalDictationInProgress.set(!0),this._decoration||this._createDecoration();break;case 2:{this._updateInput(o),this._renderGhostText(o),this._updateDecoration(),e>0&&this._acceptTranscriptionScheduler.cancel();break}case 3:this._updateInput(o),this._sendText(),this._ghostText?.dispose(),this._ghostText=void 0,this._ghostTextMarker?.dispose(),this._ghostTextMarker=void 0,this._updateDecoration(),this._input="";break;case 4:this.stop();break}}))}stop(e){this._setInactive(),e&&(this._acceptTranscriptionScheduler.cancel(),this._sendText()),this._ghostText=void 0,this._decoration?.dispose(),this._decoration=void 0,this._marker?.dispose(),this._marker=void 0,this._ghostTextMarker=void 0,this._cancellationTokenSource?.cancel(),this._disposables.clear(),this._input="",this._terminalDictationInProgress.reset()}_sendText(){this._terminalService.activeInstance?.sendText(this._input,!1),en(d(15724,null,this._input))}_updateInput(e){if(e.text){let t=e.text.replaceAll(/[.,?;!]/g,"");for(let o of Object.entries(bvn))t=t.replace(new RegExp("\\b"+o[0]+"\\b"),o[1]);this._input=" "+t}}_createDecoration(){let e=this._terminalService.activeInstance,t=e?.xterm?.raw;if(!t)return;let o=t.buffer.active.cursorY===0,n=this._input.length,r=t.buffer.active.cursorX+n;if(this._marker=e.registerMarker(o?0:-1),!!this._marker){if(this._decoration=t.registerDecoration({marker:this._marker,layer:"top",x:r}),!this._decoration){this._marker.dispose(),this._marker=void 0;return}this._decoration.onRender(s=>{s.classList.add(...q.asClassNameArray(R.micFilled),"terminal-voice","recording"),s.style.transform=o?"translate(10px, -2px)":"translate(-6px, -5px)"})}}_updateDecoration(){this._decoration?.dispose(),this._marker?.dispose(),this._decoration=void 0,this._marker=void 0,this._createDecoration()}_setInactive(){this._decoration?.element?.classList.remove("recording")}_renderGhostText(e){this._ghostText?.dispose();let t=e.text;if(!t)return;let o=this._terminalService.activeInstance,n=o?.xterm?.raw;if(!n||(this._ghostTextMarker=o.registerMarker(),!this._ghostTextMarker))return;this._disposables.add(this._ghostTextMarker);let r=n.buffer.active.cursorY===0;this._ghostText=n.registerDecoration({marker:this._ghostTextMarker,layer:"top",x:r?n.buffer.active.cursorX+4:n.buffer.active.cursorX+1}),this._ghostText&&this._disposables.add(this._ghostText),this._ghostText?.onRender(s=>{s.classList.add("terminal-voice-progress-text"),s.textContent=t,s.style.width=(n.cols-n.buffer.active.cursorX)/n.cols*100+"%"})}};ZW=I([m(0,ZC),m(1,nn),m(2,B),m(3,X)],ZW);var NLo=L(15730,"Voice");function OLo(){Jl({id:"workbench.action.terminal.startVoice",title:L(15731,"Start Dictation in Terminal"),category:NLo,precondition:C.and(QJ.toNegated(),da.terminalAvailable),f1:!0,icon:R.mic,run:async(a,i,e)=>{let t=e.get(X),o=e.get(ge),n=e.get(at),r=e.get(Js),s=e.get(Cs);if(zB.getValue(t)){let b=e.get(F);ZW.getInstance(b).start();return}let c=(await s.getInstalled()).find(b=>b.identifier.id==="ms-vscode.vscode-speech"),u=c&&!r.isEnabled(c),p,h,g;u?(h=d(15728,null),g=d(15725,null),p=()=>r.setEnablement([c],13)):(h=d(15729,null),p=()=>o.executeCommand("workbench.extensions.installExtension","ms-vscode.vscode-speech"),g=d(15726,null));let f=d(15727,null);(await n.confirm({message:h,primaryButton:g,type:"info",detail:f})).confirmed&&await p()}}),Jl({id:"workbench.action.terminal.stopVoice",title:L(15732,"Stop Dictation in Terminal"),category:NLo,precondition:dt.terminalDictationInProgress,f1:!0,keybinding:{primary:9,weight:300},run:(a,i,e)=>{let t=e.get(F);ZW.getInstance(t).stop(!0)}})}OLo();var FLo=le("externalTerminal");var WLo="openInTerminal",VLo="openInIntegratedTerminal";function BLo(a,i){$e.registerCommand({id:a,handler:async(e,t)=>{let o=e.get(B),n=e.get(fe),r=e.get(nn),s=e.get(bo),l=e.get(lc),c;try{c=e.get(FLo)}catch{}let u=dW(t,e.get(Io),e.get(ee),e.get(wt),e.get(Oa));return n.resolveAll(u.map(p=>({resource:p}))).then(async p=>{let h=o.getValue(),g=s.getConnection()||i==="integrated",f=zo(p.filter(v=>v.success));if(g){let v={},b=f.map(({stat:S})=>{let y=S.resource;return S.isDirectory?y:A.from({scheme:y.scheme,authority:y.authority,fragment:y.fragment,query:y.query,path:ad(y.path)})});for(let S of b){if(v[S.path])return;v[S.path]=!0;let y=await r.createTerminal({config:{cwd:S}});y&&y.target!==2&&(u.length===1||!t||S.path===t.path||S.path===ad(t.path))&&(r.setActiveInstance(y),l.showPanel(!0))}}else c&&zo(f.map(({stat:v})=>v.isDirectory?v.resource.fsPath:ad(v.resource.fsPath))).forEach(v=>{c.openTerminal(h.terminal.external,v)})})}})}BLo(WLo,"external");BLo(VLo,"integrated");var Vct=class extends x{constructor(e){super();this._configurationService=e;let t=C.and(Wo.Scheme.isEqualTo(Q.file),C.or(C.equals("config.terminal.explorerKind","integrated"),C.equals("config.terminal.explorerKind","both"))),o=C.and(Wo.Scheme.isEqualTo(Q.file),C.or(C.equals("config.terminal.explorerKind","external"),C.equals("config.terminal.explorerKind","both")));this._openInIntegratedTerminalMenuItem={group:"navigation",order:30,command:{id:VLo,title:d(10752,null)},when:C.or(t,Wo.Scheme.isEqualTo(Q.vscodeRemote))},this._openInTerminalMenuItem={group:"navigation",order:31,command:{id:WLo,title:d(10751,null)},when:o},ve.appendMenuItem(D.ExplorerContext,this._openInTerminalMenuItem),ve.appendMenuItem(D.ExplorerContext,this._openInIntegratedTerminalMenuItem),this._register(this._configurationService.onDidChangeConfiguration(n=>{(n.affectsConfiguration("terminal.explorerKind")||n.affectsConfiguration("terminal.external"))&&this._refreshOpenInTerminalMenuItemTitle()})),this._refreshOpenInTerminalMenuItemTitle()}isWindows(){let e=this._configurationService.getValue().terminal;if(ei&&e.external?.windowsExec){let t=jo(e.external.windowsExec);if(t==="wt"||t==="wt.exe")return!0}return!1}_refreshOpenInTerminalMenuItemTitle(){this.isWindows()&&(this._openInTerminalMenuItem.command.title=d(10753,null))}};Vct=I([m(0,B)],Vct);ne.as(Qi.Workbench).registerWorkbenchContribution(Vct,3);var Sbe=class extends x{constructor(e,t,o,n,r,s,l){super();this.hostService=e;this.configurationService=t;this.userDataSyncService=o;this.userDataSyncEnablementService=n;this.productService=s;this.dialogService=l;this.titleBarStyle=new n_("string");this.menuStyle=new n_("string");this.nativeTabs=new n_("boolean");this.nativeFullScreen=new n_("boolean");this.clickThroughInactive=new n_("boolean");this.controlsStyle=new n_("string");this.updateMode=new n_("string");this.workspaceTrustEnabled=new n_("boolean");this.experimentsEnabled=new n_("boolean");this.enablePPEExtensionsGallery=new n_("boolean");this.restrictUNCAccess=new n_("boolean");this.accessibilityVerbosityDebug=new n_("boolean");this.telemetryFeedbackEnabled=new n_("boolean");this.extensionUnificationEnabled=new n_("boolean");this.update(!1),this._register(this.configurationService.onDidChangeConfiguration(c=>this.onConfigurationChange(c))),this._register(r.onDidTurnOnSync(c=>this.update(!0)))}static{this.SETTINGS=["window.titleBarStyle","window.menuStyle","window.nativeTabs","window.nativeFullScreen","window.clickThroughInactive","window.controlsStyle","update.mode","editor.accessibilitySupport","security.workspace.trust.enabled","workbench.enableExperiments","_extensionsGallery.enablePPE","security.restrictUNCAccess","accessibility.verbosity.debug","telemetry.feedback.enabled","chat.extensionUnification.enabled"]}onConfigurationChange(e){e&&!Sbe.SETTINGS.some(t=>e.affectsConfiguration(t))||this.isTurningOnSyncInProgress()||this.update(e.source!==7)}isTurningOnSyncInProgress(){return!this.userDataSyncEnablementService.isEnabled()&&this.userDataSyncService.status==="syncing"}update(e){let t=!1;function o(r){t=t||r}let n=this.configurationService.getValue();Vr&&(o((n.window.titleBarStyle==="native"||n.window.titleBarStyle==="custom")&&this.titleBarStyle.handleChange(n.window?.titleBarStyle)),o(!Ze&&this.menuStyle.handleChange(n.window?.menuStyle)),o(Ze&&this.nativeTabs.handleChange(n.window?.nativeTabs)),o(Ze&&this.nativeFullScreen.handleChange(n.window?.nativeFullScreen)),o(Ze&&this.clickThroughInactive.handleChange(n.window?.clickThroughInactive)),o(!Ze&&this.controlsStyle.handleChange(n.window?.controlsStyle)),o(this.updateMode.handleChange(n.update?.mode)),fn&&typeof n.editor?.accessibilitySupport=="string"&&n.editor.accessibilitySupport!==this.accessibilitySupport&&(this.accessibilitySupport=n.editor.accessibilitySupport,this.accessibilitySupport==="on"&&(t=!0)),o(this.workspaceTrustEnabled.handleChange(n?.security?.workspace?.trust?.enabled)),o(this.restrictUNCAccess.handleChange(n?.security?.restrictUNCAccess)),o(this.accessibilityVerbosityDebug.handleChange(n?.accessibility?.verbosity?.debug))),o(this.experimentsEnabled.handleChange(n.workbench?.enableExperiments)),o(this.productService.quality!=="stable"&&this.enablePPEExtensionsGallery.handleChange(n._extensionsGallery?.enablePPE)),o(this.telemetryFeedbackEnabled.handleChange(n.telemetry?.feedback?.enabled)),o(this.extensionUnificationEnabled.handleChange(n.chat?.extensionUnification?.enabled)&&n.chat?.extensionUnification?.enabled===!0),e&&t&&this.hostService.hasFocus&&this.doConfirm(Vr?d(13342,null):d(13343,null),Vr?d(13340,null,this.productService.nameLong):d(13341,null,this.productService.nameLong),Vr?d(13344,null):d(13346,null),()=>this.hostService.restart())}async doConfirm(e,t,o,n){let{confirmed:r}=await this.dialogService.confirm({message:e,detail:t,primaryButton:o});r&&n()}};Sbe=I([m(0,Zt),m(1,B),m(2,bI),m(3,Fl),m(4,SI),m(5,tt),m(6,at)],Sbe);var n_=class a{constructor(i){this.typeName=i;this.lastValue=void 0}static create(i){return new a(i)}handleChange(i){return typeof i===this.typeName&&i!==this.lastValue?(this.lastValue=i,!0):!1}},Bct=class extends x{constructor(e,t,o,n){super();this.contextService=e;this.extensionHostRestarter=this._register(new Dt(async()=>{n.extensionTestsLocationURI||n.isSessionsWindow||(n.remoteAuthority?o.reload():Vr&&await t.stopExtensionHosts(d(13345,null))&&t.startExtensionHosts())},10)),this.contextService.getCompleteWorkspace().then(r=>{this.firstFolderResource=r.folders.length>0?r.folders[0].uri:void 0,this.handleWorkbenchState(),this._register(this.contextService.onDidChangeWorkbenchState(()=>setTimeout(()=>this.handleWorkbenchState())))}),this._register(Z(()=>{this.onDidChangeWorkspaceFoldersUnbind?.dispose()}))}handleWorkbenchState(){if(this.contextService.getWorkbenchState()===3){let e=this.contextService.getWorkspace();this.firstFolderResource=e.folders.length>0?e.folders[0].uri:void 0,this.onDidChangeWorkspaceFoldersUnbind||(this.onDidChangeWorkspaceFoldersUnbind=this.contextService.onDidChangeWorkspaceFolders(()=>this.onDidChangeWorkspaceFolders()))}else Be(this.onDidChangeWorkspaceFoldersUnbind),this.onDidChangeWorkspaceFoldersUnbind=void 0}onDidChangeWorkspaceFolders(){let e=this.contextService.getWorkspace(),t=e.folders.length>0?e.folders[0].uri:void 0;Qe(this.firstFolderResource,t)||(this.firstFolderResource=t,this.extensionHostRestarter.schedule())}};Bct=I([m(0,Pe),m(1,lt),m(2,Zt),m(3,At)],Bct);var HLo=ne.as(Qi.Workbench);HLo.registerWorkbenchContribution(Sbe,3);HLo.registerWorkbenchContribution(Bct,3);var Oze=class{constructor(){this._state=0}get state(){return this._state}set state(i){i>this._state&&(this._state=i)}isOK(){return this._state===0}isFatal(){return this._state===4}},Hct=class{constructor(i){this._problemReporter=i}reset(){this._problemReporter.status.state=0}get problemReporter(){return this._problemReporter}info(i){this._problemReporter.info(i)}warn(i){this._problemReporter.warn(i)}error(i){this._problemReporter.error(i)}fatal(i){this._problemReporter.fatal(i)}};var Fze=(n=>(n[n.Default=0]="Default",n[n.Relative=1]="Relative",n[n.Absolute=2]="Absolute",n[n.AutoDetect=3]="AutoDetect",n[n.Search=4]="Search",n))(Fze||{});(i=>{function a(e){return e=e.toLowerCase(),e==="absolute"?2:e==="relative"?1:e==="autodetect"?3:e==="search"?4:void 0}i.fromString=a})(Fze||={});var J8t=(e=>(e[e.File=0]="File",e[e.Location=1]="Location",e))(J8t||{});(i=>{function a(e){return e=e.toLowerCase(),e==="file"?0:e==="location"?1:void 0}i.fromString=a})(J8t||={});var Uct=(t=>(t[t.allDocuments=0]="allDocuments",t[t.openDocuments=1]="openDocuments",t[t.closedDocuments=2]="closedDocuments",t))(Uct||{});(i=>{function a(e){return e=e.toLowerCase(),e==="alldocuments"?0:e==="opendocuments"?1:e==="closeddocuments"?2:void 0}i.fromString=a})(Uct||={});function GBi(a){return!!(a&&Fe(a.name))}async function Wze(a,i,e){let t=i.fileLocation,o;if(t===2)o=a;else if(t===1&&i.filePrefix&&Fe(i.filePrefix))o=Yc(i.filePrefix,a);else if(t===3){let n=Ji(i);if(n.fileLocation=1,e){let r=await Wze(a,n),s;try{s=await e.stat(r)}catch{}if(s)return r}return n.fileLocation=2,Wze(a,n)}else if(t===4&&e){let n=e.getProvider(Q.file);if(n&&(o=(await Ivn(a,n,i.filePrefix))?.path),!o){let r=Ji(i);return r.fileLocation=2,Wze(a,r)}}if(o===void 0)throw new Error("FileLocationKind is not actionable. Does the matcher have a filePrefix? This should never happen.");return o=ch(o),o=o.replace(/\\/g,"/"),o[0]!=="/"&&(o="/"+o),i.uriProvider!==void 0?i.uriProvider(o):A.file(o)}async function Ivn(a,i,e){let t=new Set(cc(e.exclude||[]).map(n=>A.file(n).path));async function o(n){if(t.has(n.path))return;let r=await i.readdir(n),s=[];for(let[l,c]of r){if(c===2){s.push(A.joinPath(n,l));continue}if(c===1){let u=A.joinPath(n,l);if(u.path.endsWith(a))return u}}for(let l of s){let c=await o(l);if(c)return c}}for(let n of cc(e.include||[])){let r=await o(A.file(n));if(r)return r}}function ULo(a,i,e){let t=a.pattern;return Array.isArray(t)?new UBi(a,i,e):new HBi(a,i,e)}var yvn=Po===1?`\r
`:`
`,Q8t=class{constructor(i,e,t){this.matcher=i,this.fileService=e,this.logService=t}handle(i,e=0){return{match:null,continue:!1}}next(i){return null}regexpExec(i,e){let t=Date.now(),o=i.exec(e),n=Date.now()-t;return n>5&&this.logService?.trace(`ProblemMatcher: slow regexp took ${n}ms to execute`,i.source),o}fillProblemData(i,e,t){return i?(this.fillProperty(i,"file",e,t,!0),this.appendProperty(i,"message",e,t,!0),this.fillProperty(i,"code",e,t,!0),this.fillProperty(i,"severity",e,t,!0),this.fillProperty(i,"location",e,t,!0),this.fillProperty(i,"line",e,t),this.fillProperty(i,"character",e,t),this.fillProperty(i,"endLine",e,t),this.fillProperty(i,"endCharacter",e,t),!0):!1}appendProperty(i,e,t,o,n=!1){let r=t[e];if(gn(i[e]))this.fillProperty(i,e,t,o,n);else if(!gn(r)&&r<o.length){let s=o[r];n&&(s=LL(s)),i[e]=i[e]+yvn+s}}fillProperty(i,e,t,o,n=!1){let r=t[e];if(gn(i[e])&&!gn(r)&&r<o.length){let s=o[r];s!==void 0&&(n&&(s=LL(s)),i[e]=s)}}getMarkerMatch(i){try{let e=this.getLocation(i);if(i.file&&e&&i.message){let t={severity:this.getSeverity(i),startLineNumber:e.startLineNumber,startColumn:e.startCharacter,endLineNumber:e.endLineNumber,endColumn:e.endCharacter,message:i.message};return i.code!==void 0&&(t.code=i.code),this.matcher.source!==void 0&&(t.source=this.matcher.source),{description:this.matcher,resource:this.getResource(i.file),marker:t}}}catch{console.error(`Failed to convert problem data into match: ${JSON.stringify(i)}`)}}getResource(i){return Wze(i,this.matcher,this.fileService)}getLocation(i){if(i.kind===0)return this.createLocation(0,0,0,0);if(i.location)return this.parseLocationInfo(i.location);if(!i.line)return null;let e=parseInt(i.line),t=i.character?parseInt(i.character):void 0,o=i.endLine?parseInt(i.endLine):void 0,n=i.endCharacter?parseInt(i.endCharacter):void 0;return this.createLocation(e,t,o,n)}parseLocationInfo(i){if(!i||!i.match(/(\d+|\d+,\d+|\d+,\d+,\d+,\d+)/))return null;let e=i.split(","),t=parseInt(e[0]),o=e.length>1?parseInt(e[1]):void 0;return e.length>3?this.createLocation(t,o,parseInt(e[2]),parseInt(e[3])):this.createLocation(t,o,void 0,void 0)}createLocation(i,e,t,o){return e!==void 0&&o!==void 0?{startLineNumber:i,startCharacter:e,endLineNumber:t||i,endCharacter:o}:e!==void 0?{startLineNumber:i,startCharacter:e,endLineNumber:i,endCharacter:e}:{startLineNumber:i,startCharacter:1,endLineNumber:i,endCharacter:2**31-1}}getSeverity(i){let e=null;if(i.severity){let t=i.severity;t&&(e=bt.fromValue(t),e===bt.Ignore&&(t==="E"?e=bt.Error:t==="W"?e=bt.Warning:t==="I"?e=bt.Info:vr(t,"hint")?e=bt.Info:vr(t,"note")&&(e=bt.Info)))}return(e===null||e===bt.Ignore)&&(e=this.matcher.severity||bt.Error),bl.fromSeverity(e)}},HBi=class extends Q8t{constructor(i,e,t){super(i,e,t),this.pattern=i.pattern}get matchLength(){return 1}handle(i,e=0){M9(i.length-e===1);let t=Object.create(null);this.pattern.kind!==void 0&&(t.kind=this.pattern.kind);let o=this.regexpExec(this.pattern.regexp,i[e]);if(o){this.fillProblemData(t,this.pattern,o),t.kind===1&&!t.location&&!t.line&&t.file&&(t.kind=0);let n=this.getMarkerMatch(t);if(n)return{match:n,continue:!1}}return{match:null,continue:!1}}next(i){return null}},UBi=class extends Q8t{constructor(i,e,t){super(i,e,t),this.patterns=i.pattern}get matchLength(){return this.patterns.length}handle(i,e=0){M9(i.length-e===this.patterns.length),this.data=Object.create(null);let t=this.data;t.kind=this.patterns[0].kind;for(let r=0;r<this.patterns.length;r++){let s=this.patterns[r],l=this.regexpExec(s.regexp,i[r+e]);if(l)s.loop&&r===this.patterns.length-1&&(t=Ji(t)),this.fillProblemData(t,s,l);else return{match:null,continue:!1}}let o=!!this.patterns[this.patterns.length-1].loop;o||(this.data=void 0);let n=t?this.getMarkerMatch(t):null;return{match:n||null,continue:o}}next(i){let e=this.patterns[this.patterns.length-1];M9(e.loop===!0&&this.data!==null);let t=this.regexpExec(e.regexp,i);if(!t)return this.data=void 0,null;let o=Ji(this.data),n;return this.fillProblemData(o,e,t)&&(n=this.getMarkerMatch(o)),n||null}},Tre;(s=>{let a;(c=>{function l(u){let p=u;return p&&Fe(p.regexp)}c.is=l})(a=s.CheckedProblemPattern||={});let i;(c=>{function l(u){let p=u;return p&&Fe(p.name)}c.is=l})(i=s.NamedProblemPattern||={});let e;(c=>{function l(u){let p=u;return p&&i.is(p)&&Fe(p.regexp)}c.is=l})(e=s.NamedCheckedProblemPattern||={});let t;(c=>{function l(u){return Array.isArray(u)}c.is=l})(t=s.MultiLineProblemPattern||={});let o;(c=>{function l(u){if(!t.is(u))return!1;for(let p of u)if(!s.CheckedProblemPattern.is(p))return!1;return!0}c.is=l})(o=s.MultiLineCheckedProblemPattern||={});let n;(c=>{function l(u){let p=u;return p&&Fe(p.name)&&Array.isArray(p.patterns)&&o.is(p.patterns)}c.is=l})(n=s.NamedMultiLineCheckedProblemPattern||={});function r(l){return Fe(l.name)}s.isNamedProblemMatcher=r})(Tre||={});var Y8t=class extends Hct{constructor(i){super(i)}parse(i){if(Tre.NamedMultiLineCheckedProblemPattern.is(i))return this.createNamedMultiLineProblemPattern(i);if(Tre.MultiLineCheckedProblemPattern.is(i))return this.createMultiLineProblemPattern(i);if(Tre.NamedCheckedProblemPattern.is(i)){let e=this.createSingleProblemPattern(i);return e.name=i.name,e}else return Tre.CheckedProblemPattern.is(i)?this.createSingleProblemPattern(i):(this.error(d(14668,null)),null)}createSingleProblemPattern(i){let e=this.doCreateSingleProblemPattern(i,!0);return e===void 0?null:(e.kind===void 0&&(e.kind=1),this.validateProblemPattern([e])?e:null)}createNamedMultiLineProblemPattern(i){let e=this.createMultiLineProblemPattern(i.patterns);return e?{name:i.name,label:i.label?i.label:i.name,patterns:e}:null}createMultiLineProblemPattern(i){let e=[];for(let t=0;t<i.length;t++){let o=this.doCreateSingleProblemPattern(i[t],!1);if(o===void 0)return null;t<i.length-1&&!gn(o.loop)&&o.loop&&(o.loop=!1,this.error(d(14663,null))),e.push(o)}return!e||e.length===0?(this.error(d(14664,null)),null):(e[0].kind===void 0&&(e[0].kind=1),this.validateProblemPattern(e)?e:null)}doCreateSingleProblemPattern(i,e){let t=this.createRegularExpression(i.regexp);if(t===void 0)return;let o={regexp:t};i.kind&&(o.kind=J8t.fromString(i.kind));function n(r,s,l,c){let u=s[c];typeof u=="number"&&(r[l]=u)}return n(o,i,"file","file"),n(o,i,"location","location"),n(o,i,"line","line"),n(o,i,"character","column"),n(o,i,"endLine","endLine"),n(o,i,"endCharacter","endColumn"),n(o,i,"severity","severity"),n(o,i,"code","code"),n(o,i,"message","message"),(i.loop===!0||i.loop===!1)&&(o.loop=i.loop),e&&(o.location||o.kind===0?o=Xu(o,{file:1,message:0},!1):o=Xu(o,{file:1,line:2,character:3,message:0},!1)),o}validateProblemPattern(i){if(!i||i.length===0)return this.error(d(14664,null)),!1;let e=!1,t=!1,o=!1,n=!1,r=i[0].kind===void 0?1:i[0].kind;return i.forEach((s,l)=>{l!==0&&s.kind&&this.error(d(14665,null)),e=e||!gn(s.file),t=t||!gn(s.message),o=o||!gn(s.location),n=n||!gn(s.line)}),e&&t?r===1&&!(o||n)?(this.error(d(14666,null)),!1):!0:(this.error(d(14667,null)),!1)}createRegularExpression(i){let e;try{e=new RegExp(i)}catch{this.error(d(14662,null,i))}return e}},X8t=class{constructor(i,e=new Oze){this._collector=i;this._validationStatus=e}info(i){this._validationStatus.state=1,this._collector.info(i)}warn(i){this._validationStatus.state=2,this._collector.warn(i)}error(i){this._validationStatus.state=3,this._collector.error(i)}fatal(i){this._validationStatus.state=4,this._collector.error(i)}get status(){return this._validationStatus}},Ibe;(c=>(c.ProblemPattern={default:{regexp:"^([^\\\\s].*)\\\\((\\\\d+,\\\\d+)\\\\):\\\\s*(.*)$",file:1,location:2,message:3},type:"object",additionalProperties:!1,properties:{regexp:{type:"string",description:d(14680,null)},kind:{type:"string",description:d(14675,null)},file:{type:"integer",description:d(14674,null)},location:{type:"integer",description:d(14677,null)},line:{type:"integer",description:d(14676,null)},column:{type:"integer",description:d(14671,null)},endLine:{type:"integer",description:d(14673,null)},endColumn:{type:"integer",description:d(14672,null)},severity:{type:"integer",description:d(14681,null)},code:{type:"integer",description:d(14670,null)},message:{type:"integer",description:d(14679,null)},loop:{type:"boolean",description:d(14678,null)}}},c.NamedProblemPattern=Ji(c.ProblemPattern),c.NamedProblemPattern.properties=Ji(c.NamedProblemPattern.properties)||{},c.NamedProblemPattern.properties.name={type:"string",description:d(14632,null)},c.MultiLineProblemPattern={type:"array",items:c.ProblemPattern},c.NamedMultiLineProblemPattern={type:"object",additionalProperties:!1,properties:{name:{type:"string",description:d(14628,null)},patterns:{type:"array",description:d(14629,null),items:c.ProblemPattern}}},c.WatchingPattern={type:"object",additionalProperties:!1,properties:{regexp:{type:"string",description:d(14683,null)},file:{type:"integer",description:d(14682,null)}}},c.PatternType={anyOf:[{type:"string",description:d(14634,null)},c.ProblemPattern,c.MultiLineProblemPattern],description:d(14633,null)},c.ProblemMatcher={type:"object",additionalProperties:!1,properties:{base:{type:"string",description:d(14651,null)},owner:{type:"string",description:d(14653,null)},source:{type:"string",description:d(14655,null)},severity:{type:"string",enum:["error","warning","info"],description:d(14654,null)},applyTo:{type:"string",enum:["allDocuments","openDocuments","closedDocuments"],description:d(14646,null)},pattern:c.PatternType,fileLocation:{oneOf:[{type:"string",enum:["absolute","relative","autoDetect","search"]},{type:"array",prefixItems:[{type:"string",enum:["absolute","relative","autoDetect","search"]}],minItems:1,maxItems:1,additionalItems:!1},{type:"array",prefixItems:[{type:"string",enum:["relative","autoDetect"]},{type:"string"}],minItems:2,maxItems:2,additionalItems:!1,examples:[["relative","${workspaceFolder}"],["autoDetect","${workspaceFolder}"]]},{type:"array",prefixItems:[{type:"string",enum:["search"]},{type:"object",properties:{include:{oneOf:[{type:"string"},{type:"array",items:{type:"string"}}]},exclude:{oneOf:[{type:"string"},{type:"array",items:{type:"string"}}]}},required:["include"]}],minItems:2,maxItems:2,additionalItems:!1,examples:[["search",{include:["${workspaceFolder}"]}],["search",{include:["${workspaceFolder}"],exclude:[]}]]}],description:d(14652,null)},background:{type:"object",additionalProperties:!1,description:d(14647,null),properties:{activeOnStart:{type:"boolean",description:d(14648,null)},beginsPattern:{oneOf:[{type:"string"},c.WatchingPattern],description:d(14649,null)},endsPattern:{oneOf:[{type:"string"},c.WatchingPattern],description:d(14650,null)}}},watching:{type:"object",additionalProperties:!1,deprecationMessage:d(14659,null),description:d(14656,null),properties:{activeOnStart:{type:"boolean",description:d(14657,null)},beginsPattern:{oneOf:[{type:"string"},c.WatchingPattern],description:d(14658,null)},endsPattern:{oneOf:[{type:"string"},c.WatchingPattern],description:d(14660,null)}}}}},c.LegacyProblemMatcher=Ji(c.ProblemMatcher),c.LegacyProblemMatcher.properties=Ji(c.LegacyProblemMatcher.properties)||{},c.LegacyProblemMatcher.properties.watchedTaskBeginsRegExp={type:"string",deprecationMessage:d(14623,null),description:d(14622,null)},c.LegacyProblemMatcher.properties.watchedTaskEndsRegExp={type:"string",deprecationMessage:d(14625,null),description:d(14624,null)},c.NamedProblemMatcher=Ji(c.ProblemMatcher),c.NamedProblemMatcher.properties=Ji(c.NamedProblemMatcher.properties)||{},c.NamedProblemMatcher.properties.name={type:"string",description:d(14631,null)},c.NamedProblemMatcher.properties.label={type:"string",description:d(14630,null)}))(Ibe||={});var zLo=Rn.registerExtensionPoint({extensionPoint:"problemPatterns",jsonSchema:{description:d(14661,null),type:"array",items:{anyOf:[Ibe.NamedProblemPattern,Ibe.NamedMultiLineProblemPattern]}}}),zBi=class{constructor(){this.patterns=Object.create(null),this.fillDefaults(),this.readyPromise=new Promise((i,e)=>{zLo.setHandler((t,o)=>{try{o.removed.forEach(n=>{let r=n.value;for(let s of r)this.patterns[s.name]&&delete this.patterns[s.name]}),o.added.forEach(n=>{let r=n.value,s=new Y8t(new X8t(n.collector));for(let l of r){if(Tre.NamedMultiLineCheckedProblemPattern.is(l)){let c=s.parse(l);s.problemReporter.status.state<3?this.add(c.name,c.patterns):(n.collector.error(d(14669,null)),n.collector.error(JSON.stringify(l,void 0,4)))}else if(Tre.NamedProblemPattern.is(l)){let c=s.parse(l);s.problemReporter.status.state<3?this.add(l.name,c):(n.collector.error(d(14669,null)),n.collector.error(JSON.stringify(l,void 0,4)))}s.reset()}})}catch{}i(void 0)})})}onReady(){return this.readyPromise}add(i,e){this.patterns[i]=e}get(i){return this.patterns[i]}fillDefaults(){this.add("msCompile",{regexp:/^\s*(?:\s*\d+>)?(\S.*?)(?:\((\d+|\d+,\d+|\d+,\d+,\d+,\d+)\))?\s*:\s+(?:(\S+)\s+)?((?:fatal +)?error|warning|info)\s+(\w+\d+)?\s*:\s*(.*)$/,kind:1,file:1,location:2,severity:4,code:5,message:6}),this.add("gulp-tsc",{regexp:/^([^\s].*)\((\d+|\d+,\d+|\d+,\d+,\d+,\d+)\):\s+(\d+)\s+(.*)$/,kind:1,file:1,location:2,code:3,message:4}),this.add("cpp",{regexp:/^(\S.*)\((\d+|\d+,\d+|\d+,\d+,\d+,\d+)\):\s+(error|warning|info)\s+(C\d+)\s*:\s*(.*)$/,kind:1,file:1,location:2,severity:3,code:4,message:5}),this.add("csc",{regexp:/^(\S.*)\((\d+|\d+,\d+|\d+,\d+,\d+,\d+)\):\s+(error|warning|info)\s+(CS\d+)\s*:\s*(.*)$/,kind:1,file:1,location:2,severity:3,code:4,message:5}),this.add("vb",{regexp:/^(\S.*)\((\d+|\d+,\d+|\d+,\d+,\d+,\d+)\):\s+(error|warning|info)\s+(BC\d+)\s*:\s*(.*)$/,kind:1,file:1,location:2,severity:3,code:4,message:5}),this.add("lessCompile",{regexp:/^\s*(.*) in file (.*) line no. (\d+)$/,kind:1,message:1,file:2,line:3}),this.add("jshint",{regexp:/^(.*):\s+line\s+(\d+),\s+col\s+(\d+),\s(.+?)(?:\s+\((\w)(\d+)\))?$/,kind:1,file:1,line:2,character:3,message:4,severity:5,code:6}),this.add("jshint-stylish",[{regexp:/^(.+)$/,kind:1,file:1},{regexp:/^\s+line\s+(\d+)\s+col\s+(\d+)\s+(.+?)(?:\s+\((\w)(\d+)\))?$/,line:1,character:2,message:3,severity:4,code:5,loop:!0}]),this.add("eslint-compact",{regexp:/^(.+):\sline\s(\d+),\scol\s(\d+),\s(Error|Warning|Info)\s-\s(.+)\s\((.+)\)$/,file:1,kind:1,line:2,character:3,severity:4,message:5,code:6}),this.add("eslint-stylish",[{regexp:/^((?:[a-zA-Z]:)*[./\\]+.*?)$/,kind:1,file:1},{regexp:/^\s+(\d+):(\d+)\s+(error|warning|info)\s+(.+?)(?:\s\s+(.*))?$/,line:1,character:2,severity:3,message:4,code:5,loop:!0}]),this.add("go",{regexp:/^([^:]*: )?((.:)?[^:]*):(\d+)(:(\d+))?: (.*)$/,kind:1,file:2,line:4,character:6,message:7})}},$q=new zBi,Vze=class extends Hct{constructor(i){super(i)}parse(i){let e=this.createProblemMatcher(i);if(this.checkProblemMatcherValid(i,e))return this.addWatchingMatcher(i,e),e}checkProblemMatcherValid(i,e){return e?e.pattern?e.owner?gn(e.fileLocation)?(this.error(d(14638,null,JSON.stringify(i,null,4))),!1):!0:(this.error(d(14640,null,JSON.stringify(i,null,4))),!1):(this.error(d(14642,null,JSON.stringify(i,null,4))),!1):(this.error(d(14641,null,JSON.stringify(i,null,4))),!1)}createProblemMatcher(i){let e=null,t=Fe(i.owner)?i.owner:xt(),o=Fe(i.source)?i.source:void 0,n=Fe(i.applyTo)?Uct.fromString(i.applyTo):0;n||(n=0);let r,s,l;if(gn(i.fileLocation))r=1,s="${workspaceFolder}";else if(Fe(i.fileLocation))l=Fze.fromString(i.fileLocation),l&&(r=l,l===1||l===3?s="${workspaceFolder}":l===4&&(s={include:["${workspaceFolder}"]}));else if(HS(i.fileLocation)){let p=i.fileLocation;p.length>0&&(l=Fze.fromString(p[0]),p.length===1&&l===2?r=l:p.length===2&&(l===1||l===3)&&p[1]&&(r=l,s=p[1]))}else Array.isArray(i.fileLocation)&&Fze.fromString(i.fileLocation[0])===4&&(r=4,s=i.fileLocation[1]??{include:["${workspaceFolder}"]});let c=i.pattern?this.createProblemPattern(i.pattern):void 0,u=i.severity?bt.fromValue(i.severity):void 0;if(u===bt.Ignore&&(this.info(d(14645,null,i.severity)),u=bt.Error),Fe(i.base)){let p=i.base;if(p.length>1&&p[0]==="$"){let h=qb.get(p.substring(1));h&&(e=Ji(h),i.owner!==void 0&&t!==void 0&&(e.owner=t),i.source!==void 0&&o!==void 0&&(e.source=o),i.fileLocation!==void 0&&r!==void 0&&(e.fileLocation=r,e.filePrefix=s),i.pattern!==void 0&&c!==void 0&&c!==null&&(e.pattern=c),i.severity!==void 0&&u!==void 0&&(e.severity=u),i.applyTo!==void 0&&n!==void 0&&(e.applyTo=n))}}else r&&c&&(e={owner:t,applyTo:n,fileLocation:r,pattern:c},o&&(e.source=o),s&&(e.filePrefix=s),u&&(e.severity=u));return Tre.isNamedProblemMatcher(i)&&(e.name=i.name,e.label=Fe(i.label)?i.label:i.name),e}createProblemPattern(i){if(Fe(i)){let e=i;if(e.length>1&&e[0]==="$"){let t=$q.get(e.substring(1));return t||this.error(d(14637,null,e)),t}else e.length===0?this.error(d(14639,null)):this.error(d(14643,null,e))}else if(i){let e=new Y8t(this.problemReporter);return Array.isArray(i),e.parse(i)}return null}addWatchingMatcher(i,e){let t=this.createRegularExpression(i.watchedTaskBeginsRegExp),o=this.createRegularExpression(i.watchedTaskEndsRegExp);if(t&&o){e.watching={activeOnStart:!1,beginsPattern:{regexp:t},endsPattern:{regexp:o}};return}let n=i.background||i.watching;if(nr(n))return;let r=this.createWatchingPattern(n.beginsPattern),s=this.createWatchingPattern(n.endsPattern);if(r&&s){e.watching={activeOnStart:Wa(n.activeOnStart)?n.activeOnStart:!1,beginsPattern:r,endsPattern:s};return}(r||s)&&this.error(d(14644,null))}createWatchingPattern(i){if(nr(i))return null;let e,t;return Fe(i)?e=this.createRegularExpression(i):(e=this.createRegularExpression(i.regexp),Yo(i.file)&&(t=i.file)),e?t?{regexp:e,file:t}:{regexp:e,file:1}:null}createRegularExpression(i){let e=null;if(!i)return e;try{e=new RegExp(i)}catch{this.error(d(14636,null,i))}return e}},wvn=Rn.registerExtensionPoint({extensionPoint:"problemMatchers",deps:[zLo],jsonSchema:{description:d(14635,null),type:"array",items:Ibe.NamedProblemMatcher}}),KBi=class{constructor(){this._onMatchersChanged=new E;this.onMatcherChanged=this._onMatchersChanged.event;this.matchers=Object.create(null),this.fillDefaults(),this.readyPromise=new Promise((i,e)=>{wvn.setHandler((t,o)=>{try{o.removed.forEach(r=>{let s=r.value;for(let l of s)this.matchers[l.name]&&delete this.matchers[l.name]}),o.added.forEach(r=>{let s=r.value,l=new Vze(new X8t(r.collector));for(let c of s){let u=l.parse(c);u&&GBi(u)&&this.add(u)}}),(o.removed.length>0||o.added.length>0)&&this._onMatchersChanged.fire()}catch{}let n=this.get("tsc-watch");n&&(n.tscWatch=!0),i(void 0)})})}onReady(){return $q.onReady(),this.readyPromise}add(i){this.matchers[i.name]=i}get(i){return this.matchers[i]}keys(){return Object.keys(this.matchers)}fillDefaults(){this.add({name:"msCompile",label:d(14627,null),owner:"msCompile",source:"cpp",applyTo:0,fileLocation:2,pattern:$q.get("msCompile")}),this.add({name:"lessCompile",label:d(14626,null),deprecated:!0,owner:"lessCompile",source:"less",applyTo:0,fileLocation:2,pattern:$q.get("lessCompile"),severity:bt.Error}),this.add({name:"gulp-tsc",label:d(14619,null),owner:"typescript",source:"ts",applyTo:2,fileLocation:1,filePrefix:"${workspaceFolder}",pattern:$q.get("gulp-tsc")}),this.add({name:"jshint",label:d(14620,null),owner:"jshint",source:"jshint",applyTo:0,fileLocation:2,pattern:$q.get("jshint")}),this.add({name:"jshint-stylish",label:d(14621,null),owner:"jshint",source:"jshint",applyTo:0,fileLocation:2,pattern:$q.get("jshint-stylish")}),this.add({name:"eslint-compact",label:d(14616,null),owner:"eslint",source:"eslint",applyTo:0,fileLocation:2,filePrefix:"${workspaceFolder}",pattern:$q.get("eslint-compact")}),this.add({name:"eslint-stylish",label:d(14617,null),owner:"eslint",source:"eslint",applyTo:0,fileLocation:2,pattern:$q.get("eslint-stylish")}),this.add({name:"go",label:d(14618,null),owner:"go",source:"go",applyTo:0,fileLocation:1,filePrefix:"${workspaceFolder}",pattern:$q.get("go")})}},qb=new KBi;var KLo="task.hasPromptedForAutomaticTasks.v2",zct="task.allowAutomaticTasks",Bze=class extends x{constructor(e,t,o,n,r,s,l){super();this._taskService=e;this._configurationService=t;this._workspaceTrustManagementService=o;this._logService=n;this._storageService=r;this._notificationService=s;this._openerService=l;this._hasRunTasks=!1;this._taskService.isReconnected?this._tryRunTasks():this._register(U.once(this._taskService.onDidReconnectToTasks)(async()=>await this._tryRunTasks())),this._register(this._workspaceTrustManagementService.onDidChangeTrust(async()=>await this._tryRunTasks()))}async _tryRunTasks(){if(!this._workspaceTrustManagementService.isWorkspaceTrusted())return;let{value:e,userValue:t}=this._configurationService.inspect(zct);if(this._hasRunTasks||e==="off"&&t!==void 0)return;this._hasRunTasks=!0,this._logService.trace("RunAutomaticTasks: Trying to run tasks."),this._taskService.hasTaskSystemInfo||(this._logService.trace("RunAutomaticTasks: Awaiting task system info."),await U.toPromise(U.once(this._taskService.onDidChangeTaskSystemInfo)));let o=await this._taskService.getWorkspaceTasks(2);this._logService.trace(`RunAutomaticTasks: Found ${o.size} automatic tasks`);let n=this._findAutoTasks(this._taskService,o);if(this._logService.trace(`RunAutomaticTasks: taskNames=${JSON.stringify(n.taskNames)}`),n.taskNames.length===0){if(!await Promise.race([new Promise(s=>{U.toPromise(U.once(this._taskService.onDidChangeTaskConfig)).then(()=>s(!0))}),new Promise(s=>{let l=setTimeout(()=>{clearTimeout(l),s(!1)},1e4)})])){this._logService.trace("RunAutomaticTasks: waited some extra time, but no update of tasks configuration");return}o=await this._taskService.getWorkspaceTasks(2),n=this._findAutoTasks(this._taskService,o),this._logService.trace(`RunAutomaticTasks: updated taskNames=${JSON.stringify(n.taskNames)}`)}this._runWithPermission(this._taskService,this._configurationService,this._storageService,this._notificationService,this._openerService,n.tasks,n.taskNames,n.locations)}_runTasks(e,t){t.forEach(o=>{o instanceof Promise?o.then(n=>{n&&e.run(n)}):e.run(o)})}_getTaskSource(e){switch(El.toConfigurationTarget(e.kind)){case 6:return Ge(e.config.workspaceFolder.uri,e.config.file);case 5:return e.config.workspace?.configuration??void 0}}_findAutoTasks(e,t){let o=new Array,n=new Array,r=new Map;return t&&t.forEach(s=>{if(s.set&&s.set.tasks.forEach(l=>{if(l.runOptions.runOn===2){o.push(l),n.push(l._label);let c=this._getTaskSource(l._source);c&&r.set(c.fsPath,c)}}),s.configurations){for(let l of Object.values(s.configurations.byIdentifier))if(l.runOptions.runOn===2){o.push(new Promise(u=>{e.getTask(s.workspaceFolder,l._id,!0).then(p=>u(p))})),l._label?n.push(l._label):n.push(l.configures.task);let c=this._getTaskSource(l._source);c&&r.set(c.fsPath,c)}}}),{tasks:o,taskNames:n,locations:r}}async _runWithPermission(e,t,o,n,r,s,l,c){if(l.length===0)return;if(t.getValue(zct)==="on"){this._runTasks(e,s);return}if(o.getBoolean(KLo,1,!1))return;await this._showPrompt(n,o,r,t,l,c)&&this._runTasks(e,s)}_showPrompt(e,t,o,n,r,s){return new Promise(l=>{e.prompt(ft.Info,d(14396,null,r.join(", "),Array.from(s.keys()).join(", ")),[{label:d(14392,null),run:()=>{l(!0),n.updateValue(zct,"on",2)}},{label:d(14393,null),run:()=>{l(!1),n.updateValue(zct,"off",2)}},{label:s.size===1?d(14394,null):d(14395,null),run:async()=>{for(let c of s)await o.open(c[1]);l(!1)}}],{onCancel:()=>l(!1)}),t.store(KLo,!0,1,1)})}};Bze=I([m(0,Og),m(1,B),m(2,Nr),m(3,se),m(4,ce),m(5,Ne),m(6,Je)],Bze);var Hze=class a extends K{static{this.ID="workbench.action.tasks.manageAutomaticRunning"}static{this.LABEL=d(14399,null)}constructor(){super({id:a.ID,title:a.LABEL,category:rx})}async run(i){let e=i.get(Ue),t=i.get(B),o={label:d(14397,null)},n={label:d(14398,null)},r=await e.pick([o,n],{canPickMany:!1});r&&t.updateValue(zct,r===o?"on":"off",2)}};var xvn={definitions:{showOutputType:{type:"string",enum:["always","silent","never"]},options:{type:"object",description:d(14588,null),properties:{cwd:{type:"string",description:d(14589,null)},env:{type:"object",additionalProperties:{type:"string"},description:d(14590,null)}},additionalProperties:{type:["string","array","object"]}},problemMatcherType:{oneOf:[{type:"string",errorMessage:d(14603,null)},Ibe.LegacyProblemMatcher,{type:"array",items:{anyOf:[{type:"string",errorMessage:d(14603,null)},Ibe.LegacyProblemMatcher]}}]},shellConfiguration:{type:"object",additionalProperties:!1,description:d(14594,null),properties:{executable:{type:"string",description:d(14593,null)},args:{type:"array",description:d(14592,null),items:{type:"string"}}}},commandConfiguration:{type:"object",additionalProperties:!1,properties:{command:{type:"string",description:d(14585,null)},args:{type:"array",description:d(14598,null),items:{type:"string"}},options:{$ref:"#/definitions/options"}}},taskDescription:{type:"object",required:["taskName"],additionalProperties:!1,properties:{taskName:{type:"string",description:d(14608,null)},command:{type:"string",description:d(14585,null)},args:{type:"array",description:d(14598,null),items:{type:"string"}},options:{$ref:"#/definitions/options"},windows:{anyOf:[{$ref:"#/definitions/commandConfiguration",description:d(14612,null)},{properties:{problemMatcher:{$ref:"#/definitions/problemMatcherType",description:d(14604,null)}}}]},osx:{anyOf:[{$ref:"#/definitions/commandConfiguration",description:d(14602,null)},{properties:{problemMatcher:{$ref:"#/definitions/problemMatcherType",description:d(14604,null)}}}]},linux:{anyOf:[{$ref:"#/definitions/commandConfiguration",description:d(14601,null)},{properties:{problemMatcher:{$ref:"#/definitions/problemMatcherType",description:d(14604,null)}}}]},suppressTaskName:{type:"boolean",description:d(14607,null),default:!0},showOutput:{$ref:"#/definitions/showOutputType",description:d(14606,null)},echoCommand:{type:"boolean",description:d(14586,null),default:!0},isWatching:{type:"boolean",deprecationMessage:d(14611,null),description:d(14610,null),default:!0},isBackground:{type:"boolean",description:d(14599,null),default:!0},promptOnClose:{type:"boolean",description:d(14605,null),default:!1},isBuildCommand:{type:"boolean",description:d(14600,null),default:!0},isTestCommand:{type:"boolean",description:d(14609,null),default:!0},problemMatcher:{$ref:"#/definitions/problemMatcherType",description:d(14604,null)}}},taskRunnerConfiguration:{type:"object",required:[],properties:{command:{type:"string",description:d(14585,null)},args:{type:"array",description:d(14583,null),items:{type:"string"}},options:{$ref:"#/definitions/options"},showOutput:{$ref:"#/definitions/showOutputType",description:d(14595,null)},isWatching:{type:"boolean",deprecationMessage:d(14615,null),description:d(14614,null),default:!0},isBackground:{type:"boolean",description:d(14584,null),default:!0},promptOnClose:{type:"boolean",description:d(14591,null),default:!1},echoCommand:{type:"boolean",description:d(14586,null),default:!0},suppressTaskName:{type:"boolean",description:d(14596,null),default:!0},taskSelector:{type:"string",description:d(14613,null)},problemMatcher:{$ref:"#/definitions/problemMatcherType",description:d(14587,null)},tasks:{type:"array",description:d(14597,null),items:{type:"object",$ref:"#/definitions/taskDescription"}}}}}},Z8t=xvn;var eQt={oneOf:[{allOf:[{type:"object",required:["version"],properties:{version:{type:"string",enum:["0.1.0"],deprecationMessage:d(14498,null),description:d(14497,null)},_runner:{deprecationMessage:d(14492,null)},runner:{type:"string",enum:["process","terminal"],default:"process",description:d(14495,null)},windows:{$ref:"#/definitions/taskRunnerConfiguration",description:d(14499,null)},osx:{$ref:"#/definitions/taskRunnerConfiguration",description:d(14494,null)},linux:{$ref:"#/definitions/taskRunnerConfiguration",description:d(14493,null)}}},{$ref:"#/definitions/taskRunnerConfiguration"}]}]},$Bi={type:"boolean",default:!0,description:d(14496,null)};eQt.definitions=Ji(Z8t.definitions);var V6=eQt.definitions;V6.commandConfiguration.properties.isShellCommand=Ji($Bi);V6.taskDescription.properties.isShellCommand=Ji($Bi);V6.taskRunnerConfiguration.properties.isShellCommand=Ji($Bi);Object.getOwnPropertyNames(V6).forEach(a=>{let i=a+"1";V6[i]=V6[a],delete V6[a]});function qBi(a){Array.isArray(a)?a.forEach(i=>{typeof i=="object"&&i!==null&&qBi(i)}):typeof a=="object"&&(a.$ref&&(a.$ref=a.$ref+"1"),Object.getOwnPropertyNames(a).forEach(i=>{let e=a[i];(Array.isArray(e)||typeof e=="object")&&qBi(e)}))}qBi(eQt);qb.onReady().then(()=>{try{let a=qb.keys().map(i=>"$"+i);V6.problemMatcherType1.oneOf[0].enum=a,V6.problemMatcherType1.oneOf[2].items.anyOf[1].enum=a}catch{console.log("Installing problem matcher ids failed")}});var jBi=eQt;function tQt(a){Array.isArray(a)?a.forEach(i=>{typeof i=="object"&&i!==null&&tQt(i)}):typeof a=="object"&&(a.$ref&&(a.$ref=a.$ref+"2"),Object.getOwnPropertyNames(a).forEach(i=>{let e=a[i];(Array.isArray(e)||typeof e=="object")&&tQt(e)}))}var QBi={anyOf:[{type:"boolean",default:!0,description:d(14511,null)},{$ref:"#/definitions/shellConfiguration"}],deprecationMessage:d(14545,null)},$Lo={type:"boolean",description:d(14507,null),default:!0},jLo={type:"boolean",description:d(14508,null),default:!1},GLo={type:"object",additionalProperties:!0,properties:{type:{type:"string",description:d(14517,null)}}},QLo={anyOf:[{type:"string",description:d(14518,null)},GLo,{type:"array",description:d(14516,null),items:{anyOf:[{type:"string"},GLo]}}],description:d(14515,null)},YLo={type:"string",enum:["parallel","sequence"],enumDescriptions:[d(14520,null),d(14521,null)],default:"parallel",description:d(14519,null)},XLo={type:"string",description:d(14522,null)},JLo={type:"object",description:d(14532,null),properties:{id:{description:d(14534,null),type:["string","null"],enum:Array.from(j$(),a=>a.id),markdownEnumDescriptions:Array.from(j$(),a=>`$(${a.id})`)},color:{description:d(14533,null),type:["string","null"],enum:["terminal.ansiBlack","terminal.ansiRed","terminal.ansiGreen","terminal.ansiYellow","terminal.ansiBlue","terminal.ansiMagenta","terminal.ansiCyan","terminal.ansiWhite"]}}},iQt={type:"object",default:{echo:!0,reveal:"always",focus:!1,panel:"shared",showReuseMessage:!0,clear:!1},description:d(14549,null),additionalProperties:!1,properties:{echo:{type:"boolean",default:!0,description:d(14552,null)},focus:{type:"boolean",default:!1,description:d(14553,null)},revealProblems:{type:"string",enum:["always","onProblem","never"],enumDescriptions:[d(14562,null),d(14564,null),d(14563,null)],default:"never",description:d(14561,null)},reveal:{type:"string",enum:["always","silent","never"],enumDescriptions:[d(14558,null),d(14560,null),d(14559,null)],default:"always",description:d(14557,null)},panel:{type:"string",enum:["shared","dedicated","new"],default:"shared",description:d(14555,null)},showReuseMessage:{type:"boolean",default:!0,description:d(14565,null)},clear:{type:"boolean",default:!1,description:d(14550,null)},group:{type:"string",description:d(14554,null)},close:{type:"boolean",description:d(14551,null)},preserveTerminalName:{type:"boolean",default:!1,description:d(14556,null)}}},ZLo=Ji(iQt);ZLo.deprecationMessage=d(14579,null);var qLo={type:"string",enum:["build","test","none"],enumDescriptions:[d(14525,null),d(14531,null),d(14530,null)],description:d(14529,null)},YBi={oneOf:[qLo,{type:"object",properties:{kind:qLo,isDefault:{type:["boolean","string"],default:!1,description:d(14528,null)}}}],defaultSnippets:[{body:{kind:"build",isDefault:!0},description:d(14526,null)},{body:{kind:"test",isDefault:!0},description:d(14527,null)}],description:d(14524,null)},eRo={type:"string",enum:["shell"],default:"process",description:d(14580,null)},kvn={oneOf:[{oneOf:[{type:"string"},{type:"array",items:{type:"string"},description:d(14505,null)}]},{type:"object",required:["value","quoting"],properties:{value:{oneOf:[{type:"string"},{type:"array",items:{type:"string"},description:d(14505,null)}],description:d(14503,null)},quoting:{type:"string",enum:["escape","strong","weak"],enumDescriptions:[d(14567,null),d(14568,null),d(14569,null)],default:"strong",description:d(14504,null)}}}],description:d(14502,null)},tRo={type:"array",items:{oneOf:[{type:"string"},{type:"object",required:["value","quoting"],properties:{value:{type:"string",description:d(14500,null)},quoting:{type:"string",enum:["escape","strong","weak"],enumDescriptions:[d(14567,null),d(14568,null),d(14569,null)],default:"strong",description:d(14501,null)}}}]},description:d(14512,null)},Evn={type:"string",description:d(14547,null)},iRo={type:"string",enum:["2.0.0"],description:d(14581,null)},oRo={type:"string",description:d(14535,null),deprecationMessage:d(14536,null)},nRo={type:"object",additionalProperties:!1,properties:{reevaluateOnRerun:{type:"boolean",description:d(14570,null),default:!0},runOn:{type:"string",enum:["default","folderOpen","worktreeCreated"],description:d(14571,null),default:"default"},instanceLimit:{type:"number",description:d(14537,null),default:1},instancePolicy:{type:"string",enum:["terminateNewest","terminateOldest","prompt","warn","silent"],enumDescriptions:[d(14541,null),d(14542,null),d(14539,null),d(14543,null),d(14540,null)],description:d(14538,null),default:"prompt"}},description:d(14572,null)},XBi=Z8t.definitions,rRo=Ji(XBi.options),Tvn=rRo.properties;Tvn.shell=Ji(XBi.shellConfiguration);var sRo={type:"object",additionalProperties:!1,properties:{label:{type:"string",description:d(14575,null)},taskName:{type:"string",description:d(14576,null),deprecationMessage:d(14577,null)},identifier:Ji(oRo),group:Ji(YBi),isBackground:{type:"boolean",description:d(14513,null),default:!0},promptOnClose:{type:"boolean",description:d(14566,null),default:!1},presentation:Ji(iQt),icon:Ji(JLo),hide:Ji($Lo),inSessions:Ji(jLo),options:rRo,problemMatcher:{$ref:"#/definitions/problemMatcherType",description:d(14548,null)},runOptions:Ji(nRo),dependsOn:Ji(QLo),dependsOrder:Ji(YLo),detail:Ji(XLo)}},Uze=[];_k.onReady().then(()=>{JBi()});function JBi(){for(let a of _k.all()){if(Uze.find(t=>t.properties?.type?.enum?.find?t.properties?.type.enum.find(o=>o===a.taskType):void 0))continue;let i=Ji(sRo),e=i.properties;if(e.type={type:"string",description:d(14506,null),enum:[a.taskType]},a.required?i.required=a.required.slice():i.required=[],i.required.push("type"),a.properties)for(let t of Object.keys(a.properties)){let o=a.properties[t];e[t]=Ji(o)}tQt(i),Uze.push(i)}}var Kct=Ji(sRo);Kct.properties.customize={type:"string",deprecationMessage:d(14514,null)};Kct.required||(Kct.required=[]);Kct.required.push("customize");Uze.push(Kct);var r_=Ji(XBi),oQt=r_.taskDescription;oQt.required=["label"];var DI=oQt.properties;DI.label=Ji(Evn);DI.command=Ji(kvn);DI.args=Ji(tRo);DI.isShellCommand=Ji(QBi);DI.dependsOn=QLo;DI.hide=Ji($Lo);DI.inSessions=Ji(jLo);DI.dependsOrder=YLo;DI.identifier=Ji(oRo);DI.type=Ji(eRo);DI.presentation=Ji(iQt);DI.terminal=ZLo;DI.icon=Ji(JLo);DI.group=Ji(YBi);DI.runOptions=Ji(nRo);DI.detail=XLo;DI.taskName.deprecationMessage=d(14577,null);var nQt=Ji(oQt);oQt.default={label:"My Task",type:"shell",command:"echo Hello",problemMatcher:[]};r_.showOutputType.deprecationMessage=d(14573,null);DI.echoCommand.deprecationMessage=d(14523,null);DI.suppressTaskName.deprecationMessage=d(14574,null);DI.isBuildCommand.deprecationMessage=d(14544,null);DI.isTestCommand.deprecationMessage=d(14546,null);nQt.properties.type={type:"string",enum:["process"],default:"process",description:d(14580,null)};nQt.required.push("command");nQt.required.push("type");Uze.push(nQt);Uze.push({$ref:"#/definitions/taskDescription"});var B6=r_.taskRunnerConfiguration.properties,_vn=B6.tasks;_vn.items={oneOf:Uze};B6.inputs=qMe.definitions.inputs;r_.commandConfiguration.properties.isShellCommand=Ji(QBi);r_.commandConfiguration.properties.args=Ji(tRo);r_.options.properties.shell={$ref:"#/definitions/shellConfiguration"};B6.isShellCommand=Ji(QBi);B6.type=Ji(eRo);B6.group=Ji(YBi);B6.presentation=Ji(iQt);B6.suppressTaskName.deprecationMessage=d(14574,null);B6.taskSelector.deprecationMessage=d(14578,null);var ZBi=Ji(r_.taskRunnerConfiguration);delete ZBi.properties.tasks;ZBi.additionalProperties=!1;r_.osSpecificTaskRunnerConfiguration=ZBi;B6.version=Ji(iRo);var eHi={oneOf:[{allOf:[{type:"object",required:["version"],properties:{version:Ji(iRo),windows:{$ref:"#/definitions/osSpecificTaskRunnerConfiguration",description:d(14582,null)},osx:{$ref:"#/definitions/osSpecificTaskRunnerConfiguration",description:d(14510,null)},linux:{$ref:"#/definitions/osSpecificTaskRunnerConfiguration",description:d(14509,null)}}},{$ref:"#/definitions/taskRunnerConfiguration"}]}]};eHi.definitions=r_;function aRo(a,i){let e=a[i].properties;e?Object.keys(e).forEach(t=>{aRo(e,t)}):L4t(a[i])}Object.getOwnPropertyNames(r_).forEach(a=>{let i=a+"2";r_[i]=r_[a],delete r_[a],aRo(r_,i)});tQt(eHi);function tHi(){try{let a=qb.keys().map(i=>"$"+i);r_.problemMatcherType2.oneOf[0].enum=a,r_.problemMatcherType2.oneOf[2].items.anyOf[0].enum=a}catch{console.log("Installing problem matcher ids failed")}}qb.onReady().then(()=>{tHi()});var iHi=eHi;var zze=class{constructor(i,e,t){this.task=i,this.resolver=e,this.trigger=t}verify(){let i=!1;return this.trigger&&this.resolvedVariables&&this.workspaceFolder&&this.shellLaunchConfig!==void 0&&(i=!0),i}getVerifiedTask(){if(this.verify())return{task:this.task,resolver:this.resolver,trigger:this.trigger,resolvedVariables:this.resolvedVariables,systemInfo:this.systemInfo,workspaceFolder:this.workspaceFolder,shellLaunchConfig:this.shellLaunchConfig};throw new Error("VerifiedTask was not checked. verify must be checked before getVerifiedTask.")}},SL=class{constructor(i,e,t){this.severity=i,this.message=e,this.code=t}},ybe;(t=>(t.shortcut="shortcut",t.command="command",t.reconnect="reconnect"))(ybe||={});var Dvn={id:"dotnetCore",label:".NET Core",sort:"NET Core",autoDetect:!1,description:d(14716,null),content:["{","	// See https://go.microsoft.com/fwlink/?LinkId=733558","	// for the documentation about the tasks.json format",'	"version": "2.0.0",','	"tasks": [',"		{",'			"label": "build",','			"command": "dotnet",','			"type": "shell",','			"args": [','				"build",',"				// Ask dotnet build to generate full paths for file names.",'				"/property:GenerateFullPaths=true",',"				// Do not generate summary otherwise it leads to duplicate errors in Problems panel",'				"/consoleloggerparameters:NoSummary"',"			],",'			"group": "build",','			"presentation": {','				"reveal": "silent"',"			},",'			"problemMatcher": "$msCompile"',"		}","	]","}"].join(`
`)},Lvn={id:"msbuild",label:"MSBuild",autoDetect:!1,description:d(14719,null),content:["{","	// See https://go.microsoft.com/fwlink/?LinkId=733558","	// for the documentation about the tasks.json format",'	"version": "2.0.0",','	"tasks": [',"		{",'			"label": "build",','			"type": "shell",','			"command": "msbuild",','			"args": [',"				// Ask msbuild to generate full paths for file names.",'				"/property:GenerateFullPaths=true",','				"/t:build",',"				// Do not generate summary otherwise it leads to duplicate errors in Problems panel",'				"/consoleloggerparameters:NoSummary"',"			],",'			"group": "build",','			"presentation": {',"				// Reveal the output only if unrecognized errors occur.",'				"reveal": "silent"',"			},","			// Use the standard MS compiler pattern to detect errors, warnings and infos",'			"problemMatcher": "$msCompile"',"		}","	]","}"].join(`
`)},Rvn={id:"externalCommand",label:"Others",autoDetect:!1,description:d(14717,null),content:["{","	// See https://go.microsoft.com/fwlink/?LinkId=733558","	// for the documentation about the tasks.json format",'	"version": "2.0.0",','	"tasks": [',"		{",'			"label": "echo",','			"type": "shell",','			"command": "echo Hello"',"		}","	]","}"].join(`
`)},Mvn={id:"maven",label:"maven",sort:"MVN",autoDetect:!1,description:d(14718,null),content:["{","	// See https://go.microsoft.com/fwlink/?LinkId=733558","	// for the documentation about the tasks.json format",'	"version": "2.0.0",','	"tasks": [',"		{",'			"label": "verify",','			"type": "shell",','			"command": "mvn -B verify",','			"group": "build"',"		},","		{",'			"label": "test",','			"type": "shell",','			"command": "mvn -B test",','			"group": "test"',"		}","	]","}"].join(`
`)},rQt=null;function lRo(){return rQt||(rQt=[Dvn,Lvn,Mvn].sort((a,i)=>(a.sort||a.label).localeCompare(i.sort||i.label)),rQt.push(Rvn)),rQt}var cRo;(i=>{function a(e){return e!==void 0&&Fe(e.type)}i.is=a})(cRo||={});var Ovn;(i=>{function a(e){return Fe(e)?e:HS(e)?e.join(" "):Fe(e.value)?e.value:e.value.join(" ")}i.value=a})(Ovn||={});var aHi=[];Object.freeze(aHi);function BN(a,i,e){let t=i[e];t!==void 0&&(a[e]=t)}function jq(a,i,e){let t=i[e];a[e]===void 0&&t!==void 0&&(a[e]=t)}function U6(a,i,e=!1){if(a==null||i===void 0)return!0;for(let t of i){let o=a[t.property];if(o!=null){if(t.type!==void 0&&!t.type.isEmpty(o))return!1;if(!Array.isArray(o)||o.length>0||e)return!1}}return!0}function lHi(a,i,e){if(!i||U6(i,e))return a;if(!a||U6(a,e))return i;for(let t of e){let o=t.property,n;t.type!==void 0?n=t.type.assignProperties(a[o],i[o]):n=i[o],n!=null&&(a[o]=n)}return a}function qct(a,i,e,t=!1){if(!i||U6(i,e))return a;if(!a||U6(a,e,t))return i;for(let o of e){let n=o.property,r;o.type?r=o.type.fillProperties(a[n],i[n]):a[n]===void 0&&(r=i[n]),r!=null&&(a[n]=r)}return a}function dRo(a,i,e,t){if(a&&Object.isFrozen(a))return a;if(a==null||i===void 0||i===null)return i!=null?Ji(i):void 0;for(let o of e){let n=o.property;if(a[n]!==void 0)continue;let r;o.type?r=o.type.fillDefaults(a[n],t):r=i[n],r!=null&&(a[n]=r)}return a}function oHi(a,i){if(a!=null){if(Object.isFrozen(a))return a;for(let e of i)if(e.type){let t=a[e.property];t&&e.type.freeze(t)}return Object.freeze(a),a}}var uRo;(i=>{function a(e){if(!e)return 1;switch(e.toLowerCase()){case"folderopen":return 2;case"worktreecreated":return 3;default:return 1}}i.fromString=a})(uRo||={});var Gct;(o=>{let a=[{property:"reevaluateOnRerun"},{property:"runOn"},{property:"instanceLimit"},{property:"instancePolicy"}];function i(n){return{reevaluateOnRerun:n?n.reevaluateOnRerun:!0,runOn:n?uRo.fromString(n.runOn):1,instanceLimit:n?.instanceLimit?Math.max(n.instanceLimit,1):1,instancePolicy:n?pRo.fromString(n.instancePolicy):"prompt"}}o.fromConfiguration=i;function e(n,r){return lHi(n,r,a)}o.assignProperties=e;function t(n,r){return qct(n,r,a)}o.fillProperties=t})(Gct||={});var pRo;(i=>{function a(e){if(!e)return"prompt";switch(e.toLowerCase()){case"terminatenewest":return"terminateNewest";case"terminateoldest":return"terminateOldest";case"warn":return"warn";case"silent":return"silent";default:return"prompt"}}i.fromString=a})(pRo||={});var wbe;(l=>{let a=[{property:"executable"},{property:"args"},{property:"quoting"}];function i(c){let u=c;return u&&(Fe(u.executable)||HS(u.args))}l.is=i;function e(c,u){if(!i(c))return;let p={};return c.executable!==void 0&&(p.executable=c.executable),c.args!==void 0&&(p.args=c.args.slice()),c.quoting!==void 0&&(p.quoting=Ji(c.quoting)),p}l.from=e;function t(c){return U6(c,a,!0)}l.isEmpty=t;function o(c,u){return lHi(c,u,a)}l.assignProperties=o;function n(c,u){return qct(c,u,a,!0)}l.fillProperties=n;function r(c,u){return c}l.fillDefaults=r;function s(c){if(c)return Object.freeze(c)}l.freeze=s})(wbe||={});var H6;(l=>{let a=[{property:"cwd"},{property:"env"},{property:"shell",type:wbe}],i={cwd:"${workspaceFolder}"};function e(c,u){let p={};return c.cwd!==void 0&&(Fe(c.cwd)?p.cwd=c.cwd:u.taskLoadIssues.push(d(14686,null,c.cwd))),c.env!==void 0&&(p.env=Ji(c.env)),p.shell=wbe.from(c.shell,u),t(p)?void 0:p}l.from=e;function t(c){return U6(c,a)}l.isEmpty=t;function o(c,u){if(u===void 0||t(u))return c;if(c===void 0||t(c))return u;if(BN(c,u,"cwd"),c.env===void 0)c.env=u.env;else if(u.env!==void 0){let p=Object.create(null);c.env!==void 0&&Object.keys(c.env).forEach(h=>p[h]=c.env[h]),u.env!==void 0&&Object.keys(u.env).forEach(h=>p[h]=u.env[h]),c.env=p}return c.shell=wbe.assignProperties(c.shell,u.shell),c}l.assignProperties=o;function n(c,u){return qct(c,u,a)}l.fillProperties=n;function r(c,u){return dRo(c,i,a,u)}l.fillDefaults=r;function s(c){return oHi(c,a)}l.freeze=s})(H6||={});var eV;(h=>{let a;(k=>{let g=[{property:"echo"},{property:"reveal"},{property:"revealProblems"},{property:"focus"},{property:"panel"},{property:"showReuseMessage"},{property:"clear"},{property:"group"},{property:"close"},{property:"preserveTerminalName"}];function f(T,P){let O,V,H,G,$,J,ae,he,oe,de,Ce=!1;Wa(T.echoCommand)&&(O=T.echoCommand,Ce=!0),Fe(T.showOutput)&&(V=cpe.fromString(T.showOutput),Ce=!0);let xe=T.presentation||T.terminal;if(xe&&(Wa(xe.echo)&&(O=xe.echo),Fe(xe.reveal)&&(V=cpe.fromString(xe.reveal)),Fe(xe.revealProblems)&&(H=mDe.fromString(xe.revealProblems)),Wa(xe.focus)&&(G=xe.focus),Fe(xe.panel)&&($=hDe.fromString(xe.panel)),Wa(xe.showReuseMessage)&&(J=xe.showReuseMessage),Wa(xe.clear)&&(ae=xe.clear),Fe(xe.group)&&(he=xe.group),Wa(xe.close)&&(oe=xe.close),Wa(xe.preserveTerminalName)&&(de=xe.preserveTerminalName),Ce=!0),!!Ce)return{echo:O,reveal:V,revealProblems:H,focus:G,panel:$,showReuseMessage:J,clear:ae,group:he,close:oe,preserveTerminalName:de}}k.from=f;function v(T,P){return lHi(T,P,g)}k.assignProperties=v;function b(T,P){return qct(T,P,g)}k.fillProperties=b;function S(T,P){let O=P.engine===2;return dRo(T,{echo:O,reveal:1,revealProblems:1,focus:!1,panel:1,showReuseMessage:!0,clear:!1,preserveTerminalName:!1},g,P)}k.fillDefaults=S;function y(T){return oHi(T,g)}k.freeze=y;function w(T){return U6(T,g)}k.isEmpty=w})(a=h.PresentationOptions||={});let i;(f=>{function g(v){if(v!=null){if(Fe(v))return v;if(HS(v))return v.join(" ");{let b=pDe.from(v.quoting),S=Fe(v.value)?v.value:HS(v.value)?v.value.join(" "):void 0;return S?{value:S,quoting:b}:void 0}}}f.from=g})(i||={});let e=[{property:"runtime"},{property:"name"},{property:"options",type:H6},{property:"args"},{property:"taskSelector"},{property:"suppressTaskName"},{property:"presentation",type:a}];function t(g,f){let v=o(g,f),b;return g.windows&&f.platform===3?b=o(g.windows,f):g.osx&&f.platform===1?b=o(g.osx,f):g.linux&&f.platform===2&&(b=o(g.linux,f)),b&&(v=s(v,b,f.schemaVersion===2)),r(v)?void 0:v}h.from=t;function o(g,f){let v=i.from(g.command),b;Fe(g.type)&&(g.type==="shell"||g.type==="process")&&(b=t3.fromString(g.type)),Wa(g.isShellCommand)||wbe.is(g.isShellCommand)?b=1:g.isShellCommand!==void 0&&(b=g.isShellCommand?1:2);let S={name:v,runtime:b,presentation:a.from(g,f)};if(g.args!==void 0){S.args=[];for(let y of g.args){let w=i.from(y);w!==void 0?S.args.push(w):f.taskLoadIssues.push(d(14685,null,y?JSON.stringify(y,void 0,4):"undefined"))}}return g.options!==void 0&&(S.options=H6.from(g.options,f),S.options&&S.options.shell===void 0&&wbe.is(g.isShellCommand)&&(S.options.shell=wbe.from(g.isShellCommand,f),f.engine!==2&&f.taskLoadIssues.push(d(14690,null)))),Fe(g.taskSelector)&&(S.taskSelector=g.taskSelector),Wa(g.suppressTaskName)&&(S.suppressTaskName=g.suppressTaskName),r(S)?void 0:S}function n(g){return g&&!!g.name}h.hasCommand=n;function r(g){return U6(g,e)}h.isEmpty=r;function s(g,f,v){return r(f)?g:r(g)?f:(BN(g,f,"name"),BN(g,f,"runtime"),BN(g,f,"taskSelector"),BN(g,f,"suppressTaskName"),f.args!==void 0&&(g.args===void 0||v?g.args=f.args:g.args=g.args.concat(f.args)),g.presentation=a.assignProperties(g.presentation,f.presentation),g.options=H6.assignProperties(g.options,f.options),g)}h.assignProperties=s;function l(g,f){return qct(g,f,e)}h.fillProperties=l;function c(g,f,v){if(f===void 0||r(f))return g;if(g=g||{name:void 0,runtime:void 0,presentation:void 0},g.name===void 0){jq(g,f,"name"),jq(g,f,"taskSelector"),jq(g,f,"suppressTaskName");let b=f.args?f.args.slice():[];!g.suppressTaskName&&v&&(g.taskSelector!==void 0?b.push(g.taskSelector+v):b.push(v)),g.args&&(b=b.concat(g.args)),g.args=b}return jq(g,f,"runtime"),g.presentation=a.fillProperties(g.presentation,f.presentation),g.options=H6.fillProperties(g.options,f.options),g}h.fillGlobals=c;function u(g,f){!g||Object.isFrozen(g)||(g.name!==void 0&&g.runtime===void 0&&(g.runtime=2),g.presentation=a.fillDefaults(g.presentation,f),r(g)||(g.options=H6.fillDefaults(g.options,f)),g.args===void 0&&(g.args=aHi),g.suppressTaskName===void 0&&(g.suppressTaskName=f.schemaVersion===2))}h.fillDefaults=u;function p(g){return oHi(g,e)}h.freeze=p})(eV||={});var $ct;(n=>{function a(r,s){let l=Object.create(null);return Array.isArray(r)&&r.forEach(c=>{let u=new Vze(s.problemReporter).parse(c);GBi(u)?l[u.name]=u:s.problemReporter.error(d(14689,null,JSON.stringify(c,void 0,4)))}),l}n.namedFrom=a;function i(r,s){let l={},c=r;return c.windows?.problemMatcher&&s.platform===3?l=e(c.windows.problemMatcher,s):c.osx?.problemMatcher&&s.platform===1?l=e(c.osx.problemMatcher,s):c.linux?.problemMatcher&&s.platform===2?l=e(c.linux.problemMatcher,s):r.problemMatcher&&(l=e(r.problemMatcher,s)),l}n.fromWithOsConfig=i;function e(r,s){let l=[];if(r===void 0)return{value:l};let c=[];function u(h){h.value&&l.push(h.value),h.errors&&c.push(...h.errors)}let p=t(r);if(p===0){let h=d(14695,null,JSON.stringify(r,null,4));s.problemReporter.warn(h)}else p===1||p===2?u(o(r,s)):p===3&&r.forEach(g=>{u(o(g,s))});return{value:l,errors:c}}n.from=e;function t(r){return Fe(r)?1:Array.isArray(r)?3:gn(r)?0:2}function o(r,s){if(Fe(r)){let l=r;if(l.length>1&&l[0]==="$"){l=l.substring(1);let c=qb.get(l);if(c)return{value:Ji(c)};let u=s.namedProblemMatchers[l];if(u)return u=Ji(u),delete u.name,{value:u}}return{errors:[d(14687,null,r)]}}else{let l=r;return{value:new Vze(s.problemReporter).parse(l)}}}})($ct||={});var xbe;(e=>{function a(t){if(t!==void 0){if(Fe(t)&&Jm.is(t))return{_id:t,isDefault:!1};if(Fe(t.kind)&&Jm.is(t.kind)){let o=t.kind,n=gn(t.isDefault)?!1:t.isDefault;return{_id:o,isDefault:n}}}}e.from=a;function i(t){return Fe(t)?t:t.isDefault?{kind:t._id,isDefault:t.isDefault}:t._id}e.to=i})(xbe||={});var nHi;(e=>{function a(t,o){switch(o){case 2:return JB;case 0:return t.workspaceFolder.uri;default:return t.workspace&&t.workspace.configuration?t.workspace.configuration:t.workspaceFolder.uri}}function i(t,o,n){return Fe(t)?{uri:a(o,n),task:t}:cRo.is(t)?{uri:a(o,n),task:ZB.createTaskIdentifier(t,o.problemReporter)}:void 0}e.from=i})(nHi||={});var mRo;(i=>{function a(e){switch(e){case"sequence":return"sequence";case"parallel":default:return"parallel"}}i.from=a})(mRo||={});var cHi;(t=>{let a=[{property:"name"},{property:"identifier"},{property:"group"},{property:"isBackground"},{property:"promptOnClose"},{property:"dependsOn"},{property:"presentation",type:eV.PresentationOptions},{property:"problemMatchers"},{property:"options"},{property:"icon"},{property:"hide"},{property:"inSessions"}];function i(o,n,r,s,l){if(!o)return{};let c={};if(l)for(let p of Object.keys(l))o[p]!==void 0&&(c[p]=Ji(o[p]));if(Fe(o.taskName)&&(c.name=o.taskName),Fe(o.label)&&n.schemaVersion===2&&(c.name=o.label),Fe(o.identifier)&&(c.identifier=o.identifier),c.icon=o.icon,c.hide=o.hide,c.inSessions=o.inSessions,o.isBackground!==void 0&&(c.isBackground=!!o.isBackground),o.promptOnClose!==void 0&&(c.promptOnClose=!!o.promptOnClose),c.group=xbe.from(o.group),o.dependsOn!==void 0)if(Array.isArray(o.dependsOn))c.dependsOn=o.dependsOn.reduce((p,h)=>{let g=nHi.from(h,n,s);return g&&p.push(g),p},[]);else{let p=nHi.from(o.dependsOn,n,s);c.dependsOn=p?[p]:void 0}c.dependsOrder=mRo.from(o.dependsOrder),r&&(o.presentation!==void 0||o.terminal!==void 0)&&(c.presentation=eV.PresentationOptions.from(o,n)),r&&o.options!==void 0&&(c.options=H6.from(o.options,n));let u=$ct.fromWithOsConfig(o,n);return u.value!==void 0&&(c.problemMatchers=u.value),o.detail&&(c.detail=o.detail),e(c)?{}:{value:c,errors:u.errors}}t.from=i;function e(o){return U6(o,a)}t.isEmpty=e})(cHi||={});var Gze="Workspace",hRo;(r=>{let a="grunt.",i="jake.",e="gulp.",t="vscode.npm.",o="vscode.typescript.";function n(s,l,c,u,p){if(!s)return;let h=s.type,g=s.customize;if(!h&&!g){l.problemReporter.error(d(14692,null,JSON.stringify(s,null,4)));return}let f=h?p?.get?.(h)||_k.get(h):void 0;if(!f){let T=d(14694,null,h);l.problemReporter.error(T);return}let v;if(Fe(g)?g.indexOf(a)===0?v={type:"grunt",task:g.substring(a.length)}:g.indexOf(i)===0?v={type:"jake",task:g.substring(i.length)}:g.indexOf(e)===0?v={type:"gulp",task:g.substring(e.length)}:g.indexOf(t)===0?v={type:"npm",script:g.substring(t.length+4)}:g.indexOf(o)===0&&(v={type:"typescript",tsconfig:g.substring(o.length+6)}):Fe(s.type)&&(v=s),v===void 0){l.problemReporter.error(d(14688,null,JSON.stringify(s,void 0,0)));return}let b=ZB.createTaskIdentifier(v,l.problemReporter);if(b===void 0){l.problemReporter.error(d(14684,null,JSON.stringify(s,void 0,0)));return}let S={workspaceFolder:l.workspaceFolder,file:".vscode/tasks.json",index:c,element:s},y;switch(u){case 2:{y={kind:El.User,config:S,label:Gze};break}case 1:{y={kind:El.WorkspaceFile,config:S,label:Gze};break}default:{y={kind:El.Workspace,config:S,label:Gze};break}}let w=new kf(`${f.extensionId}.${b._key}`,y,void 0,h,b,Gct.fromConfiguration(s.runOptions),{hide:s.hide,inSessions:s.inSessions}),k=cHi.from(s,l,!0,u,f.properties);if(w.addTaskLoadMessages(k.errors),k.value){if(w.configurationProperties=Object.assign(w.configurationProperties,k.value),w.configurationProperties.name)w._label=w.configurationProperties.name;else{let T=w.configures.type;if(f.required&&f.required.length>0)for(let P of f.required){let O=w.configures[P];if(O){T=T+": "+O;break}}w._label=T}w.configurationProperties.identifier||(w.configurationProperties.identifier=b._key)}return w}r.from=n})(hRo||={});var Cbe;(o=>{function a(n,r,s,l){if(!n)return;let c=n.type;if(c==null&&(c=e3),c!==e3&&c!=="shell"&&c!=="process"){r.problemReporter.error(d(14693,null,JSON.stringify(n,null,4)));return}let u=n.taskName;if(Fe(n.label)&&r.schemaVersion===2&&(u=n.label),!u){r.problemReporter.error(d(14691,null,JSON.stringify(n,null,4)));return}let p;switch(l){case 2:{p={kind:El.User,config:{index:s,element:n,file:".vscode/tasks.json",workspaceFolder:r.workspaceFolder},label:Gze};break}case 1:{p={kind:El.WorkspaceFile,config:{index:s,element:n,file:".vscode/tasks.json",workspaceFolder:r.workspaceFolder,workspace:r.workspace},label:Gze};break}default:{p={kind:El.Workspace,config:{index:s,element:n,file:".vscode/tasks.json",workspaceFolder:r.workspaceFolder},label:Gze};break}}let h=new Ld(r.uuidMap.getUUID(u),p,u,e3,void 0,!1,Gct.fromConfiguration(n.runOptions),{name:u,identifier:u}),g=cHi.from(n,r,!1,l);if(h.addTaskLoadMessages(g.errors),g.value&&(h.configurationProperties=Object.assign(h.configurationProperties,g.value)),!0){let b=n;h.configurationProperties.isBackground===void 0&&b.isWatching!==void 0&&(h.configurationProperties.isBackground=!!b.isWatching),h.configurationProperties.group===void 0&&(b.isBuildCommand===!0?h.configurationProperties.group=Jm.Build:b.isTestCommand===!0&&(h.configurationProperties.group=Jm.Test))}let v=eV.from(n,r);return v&&(h.command=v),n.command!==void 0&&(v.suppressTaskName=!0),h}o.from=a;function i(n,r){(eV.hasCommand(n.command)||n.configurationProperties.dependsOn===void 0)&&(n.command=eV.fillGlobals(n.command,r.command,n.configurationProperties.name)),n.configurationProperties.problemMatchers===void 0&&r.problemMatcher!==void 0&&(n.configurationProperties.problemMatchers=Ji(r.problemMatcher),n.hasDefinedMatchers=!0),n.configurationProperties.promptOnClose===void 0&&n.configurationProperties.isBackground===void 0&&r.promptOnClose!==void 0&&(n.configurationProperties.promptOnClose=r.promptOnClose)}o.fillGlobals=i;function e(n,r){eV.fillDefaults(n.command,r),n.configurationProperties.promptOnClose===void 0&&(n.configurationProperties.promptOnClose=n.configurationProperties.isBackground!==void 0?!n.configurationProperties.isBackground:!0),n.configurationProperties.isBackground===void 0&&(n.configurationProperties.isBackground=!1),n.configurationProperties.problemMatchers===void 0&&(n.configurationProperties.problemMatchers=aHi)}o.fillDefaults=e;function t(n,r){let s=new Ld(r._id,Object.assign({},r._source,{customizes:n.defines}),r.configurationProperties.name||n._label,e3,n.command,!1,n.runOptions,{name:r.configurationProperties.name||n.configurationProperties.name,identifier:r.configurationProperties.identifier||n.configurationProperties.identifier,icon:r.configurationProperties.icon,hide:r.configurationProperties.hide,inSessions:r.configurationProperties.inSessions});s.addTaskLoadMessages(r.taskLoadMessages);let l=s.configurationProperties;BN(l,r.configurationProperties,"group"),BN(l,r.configurationProperties,"isBackground"),BN(l,r.configurationProperties,"dependsOn"),BN(l,r.configurationProperties,"problemMatchers"),BN(l,r.configurationProperties,"promptOnClose"),BN(l,r.configurationProperties,"detail"),s.command.presentation=eV.PresentationOptions.assignProperties(s.command.presentation,r.configurationProperties.presentation),s.command.options=H6.assignProperties(s.command.options,r.configurationProperties.options),s.runOptions=Gct.assignProperties(s.runOptions,r.runOptions);let c=n.configurationProperties;return jq(l,c,"group"),jq(l,c,"isBackground"),jq(l,c,"dependsOn"),jq(l,c,"problemMatchers"),jq(l,c,"promptOnClose"),jq(l,c,"detail"),s.command.presentation=eV.PresentationOptions.fillProperties(s.command.presentation,c.presentation),s.command.options=H6.fillProperties(s.command.options,c.options),s.runOptions=Gct.fillProperties(s.runOptions,n.runOptions),n.hasDefinedMatchers===!0&&(s.hasDefinedMatchers=!0),s}o.createCustomTask=t})(Cbe||={});var Kze;(o=>{function a(n){let r=n.type;return n.customize===void 0&&(r==null||r===e3||r==="shell"||r==="process")}let i={shell:upe,process:gDe};function e(n,r,s,l,c){let u={custom:[],configured:[]};if(!n)return u;let p={task:void 0,rank:-1},h={task:void 0,rank:-1},g=s.schemaVersion===2,f=Ji(s.taskLoadIssues);for(let S=0;S<n.length;S++){let y=n[S],w=y.type?c?.get?.(y.type)||_k.get(y.type):void 0,k=!1;if(w&&w.when&&!s.contextKeyService.contextMatchesRules(w.when))k=!0;else if(!w&&y.type){for(let T of Object.keys(i))if(y.type===T){k=!upe.evaluate(s.contextKeyService.getContext(null));break}}if(k){s.problemReporter.info(d(14698,null,y.type));continue}if(a(y)){let T=Cbe.from(y,s,S,l);if(T){if(Cbe.fillGlobals(T,r),Cbe.fillDefaults(T,s),g){if((T.command===void 0||T.command.name===void 0)&&(T.configurationProperties.dependsOn===void 0||T.configurationProperties.dependsOn.length===0)){s.problemReporter.error(d(14697,null,T.configurationProperties.name,JSON.stringify(y,void 0,4)));continue}}else if(T.command===void 0||T.command.name===void 0){s.problemReporter.warn(d(14696,null,T.configurationProperties.name,JSON.stringify(y,void 0,4)));continue}T.configurationProperties.group===Jm.Build&&p.rank<2?(p.task=T,p.rank=2):T.configurationProperties.group===Jm.Test&&h.rank<2?(h.task=T,h.rank=2):T.configurationProperties.name==="build"&&p.rank<1?(p.task=T,p.rank=1):T.configurationProperties.name==="test"&&h.rank<1&&(h.task=T,h.rank=1),T.addTaskLoadMessages(s.taskLoadIssues),u.custom.push(T)}}else{let T=hRo.from(y,s,S,l,c);T&&(T.addTaskLoadMessages(s.taskLoadIssues),u.configured.push(T))}s.taskLoadIssues=Ji(f)}let v=Fe(p.task?.configurationProperties.group)?p.task?.configurationProperties.group:p.task?.configurationProperties.group?._id,b=Fe(h.task?.configurationProperties.group)?h.task?.configurationProperties.group:h.task?.configurationProperties.group?._id;return v!==Jm.Build._id&&p.rank>-1&&p.rank<2&&p.task?p.task.configurationProperties.group=Jm.Build:b!==Jm.Test._id&&h.rank>-1&&h.rank<2&&h.task&&(h.task.configurationProperties.group=Jm.Test),u}o.from=e;function t(n,r){if(r===void 0||r.length===0)return n;if(n===void 0||n.length===0)return r;if(r){let s=Object.create(null);n.forEach(c=>{s[c.configurationProperties.name]=c}),r.forEach(c=>{s[c.configurationProperties.name]=c});let l=[];n.forEach(c=>{l.push(s[c.configurationProperties.name]),delete s[c.configurationProperties.name]}),Object.keys(s).forEach(c=>l.push(s[c])),n=l}return n}o.assignTasks=t})(Kze||={});var gRo;(r=>{function a(s,l){let c=i(s,l),u;s.windows&&l.platform===3?u=i(s.windows,l):s.osx&&l.platform===1?u=i(s.osx,l):s.linux&&l.platform===2&&(u=i(s.linux,l)),u&&(c=r.assignProperties(c,u));let p=eV.from(s,l);return p&&(c.command=p),r.fillDefaults(c,l),r.freeze(c),c}r.from=a;function i(s,l){let c={};return s.suppressTaskName!==void 0&&(c.suppressTaskName=!!s.suppressTaskName),s.promptOnClose!==void 0&&(c.promptOnClose=!!s.promptOnClose),s.problemMatcher&&(c.problemMatcher=$ct.from(s.problemMatcher,l).value),c}r.fromBase=i;function e(s){return!s||s.command===void 0&&s.promptOnClose===void 0&&s.suppressTaskName===void 0}r.isEmpty=e;function t(s,l){return e(l)?s:e(s)?l:(BN(s,l,"promptOnClose"),BN(s,l,"suppressTaskName"),s)}r.assignProperties=t;function o(s,l){s&&(eV.fillDefaults(s.command,l),s.suppressTaskName===void 0&&(s.suppressTaskName=l.schemaVersion===2),s.promptOnClose===void 0&&(s.promptOnClose=!0))}r.fillDefaults=o;function n(s){Object.freeze(s),s.command&&eV.freeze(s.command)}r.freeze=n})(gRo||={});var qze;(i=>{function a(e){let t=e.runner||e._runner,o;if(t)switch(t){case"terminal":o=2;break;case"process":o=1;break}let n=jct.from(e);if(n===1)return o||1;if(n===2)return 2;throw new Error("Shouldn't happen.")}i.from=a})(qze||={});var jct;(e=>{let a=2;function i(t){let o=t.version;if(!o)return a;switch(o){case"0.1.0":return 1;case"2.0.0":return 2;default:return a}}e.from=i})(jct||={});var rHi=class{constructor(i){if(this.current=Object.create(null),i)for(let e of Object.keys(i.current)){let t=i.current[e];Array.isArray(t)?this.current[e]=t.slice():this.current[e]=t}}start(){this.last=this.current,this.current=Object.create(null)}getUUID(i){let e=this.last?this.last[i]:void 0,t;e!==void 0&&(Array.isArray(e)?(t=e.shift(),e.length===0&&delete this.last[i]):(t=e,delete this.last[i])),t===void 0&&(t=xt());let o=this.current[i];if(o===void 0)this.current[i]=t;else if(Array.isArray(o))o.push(t);else{let n=[o];n.push(t),this.current[i]=n}return t}finish(){this.last=void 0}};var sHi=class{constructor(i,e,t,o,n){this.workspaceFolder=i,this.workspace=e,this.platform=t,this.problemReporter=o,this.uuidMap=n}run(i,e,t){let o=qze.from(i),n=jct.from(i),r={workspaceFolder:this.workspaceFolder,workspace:this.workspace,problemReporter:this.problemReporter,uuidMap:this.uuidMap,namedProblemMatchers:{},engine:o,schemaVersion:n,platform:this.platform,taskLoadIssues:[],contextKeyService:t},s=this.createTaskRunnerConfiguration(i,r,e);return{validationStatus:this.problemReporter.status,custom:s.custom,configured:s.configured,engine:o}}createTaskRunnerConfiguration(i,e,t){let o=gRo.from(i,e);if(this.problemReporter.status.isFatal())return{custom:[],configured:[]};e.namedProblemMatchers=$ct.namedFrom(i.declares,e);let n,r;if(i.windows&&e.platform===3?(n=Kze.from(i.windows.tasks,o,e,t).custom,r=i.windows.tasks):i.osx&&e.platform===1?(n=Kze.from(i.osx.tasks,o,e,t).custom,r=i.osx.tasks):i.linux&&e.platform===2&&(n=Kze.from(i.linux.tasks,o,e,t).custom,r=i.linux.tasks),e.schemaVersion===2&&n&&n.length>0&&r&&r.length>0){let l=[];for(let c of r)l.push(JSON.stringify(c,null,4));e.problemReporter.error(d(14699,null,l.join(`
`)))}let s={custom:[],configured:[]};if(i.tasks&&(s=Kze.from(i.tasks,o,e,t)),n&&(s.custom=Kze.assignTasks(s.custom,n)),(!s.custom||s.custom.length===0)&&o.command&&o.command.name){let l=$ct.from(i.problemMatcher,e).value??[],c=i.isBackground?!!i.isBackground:i.isWatching?!!i.isWatching:void 0,u=i3.value(o.command.name),p=new Ld(e.uuidMap.getUUID(u),Object.assign({},t,"workspace",{config:{index:-1,element:i,workspaceFolder:e.workspaceFolder}}),u,e3,{name:void 0,runtime:void 0,presentation:void 0,suppressTaskName:!0},!1,{reevaluateOnRerun:!0},{name:u,identifier:u,group:Jm.Build,isBackground:c,problemMatchers:l}),h=xbe.from(i.group);h!==void 0?p.configurationProperties.group=h:i.group==="none"&&(p.configurationProperties.group=void 0),Cbe.fillGlobals(p,o),Cbe.fillDefaults(p,e),s.custom=[p]}return s.custom=s.custom||[],s.configured=s.configured||[],s}},Fvn=new Map,Wvn=new Map;function dHi(a,i,e,t,o,n,r,s=!1){let l=s?Wvn:Fvn,c=l.get(n);c||(l.set(n,new Map),c=l.get(n));let u=c.get(a.uri.toString());u||(u=new rHi,c.set(a.uri.toString(),u));try{return u.start(),new sHi(a,i,e,o,u).run(t,n,r)}finally{u.finish()}}function $ze(a,i){return Cbe.createCustomTask(a,i)}var Qct;(i=>{function a(e,t){return Object.freeze({kind:e,capturedVariables:t})}i.create=a})(Qct||={});var sQt=class extends x{constructor(e,t,o,n,r){super();this.problemMatchers=e;this.markerService=t;this.modelService=o;this.logService=r;this.modelListeners=new N;this._onDidFindFirstMatch=this._register(new E);this.onDidFindFirstMatch=this._onDidFindFirstMatch.event;this._onDidFindErrors=this._register(new E);this.onDidFindErrors=this._onDidFindErrors.event;this._onDidRequestInvalidateLastMarker=this._register(new E);this.onDidRequestInvalidateLastMarker=this._onDidRequestInvalidateLastMarker.event;this.matchers=Object.create(null),this.bufferLength=1,e.map(s=>ULo(s,n,r)).forEach(s=>{let l=s.matchLength;l>this.bufferLength&&(this.bufferLength=l);let c=this.matchers[l];c||(c=[],this.matchers[l]=c),c.push(s)}),this.buffer=[],this.activeMatcher=null,this._numberOfMatches=0,this._maxMarkerSeverity=void 0,this.openModels=Object.create(null),this.applyToByOwner=new Map;for(let s of e){let l=this.applyToByOwner.get(s.owner);l===void 0?this.applyToByOwner.set(s.owner,s.applyTo):this.applyToByOwner.set(s.owner,this.mergeApplyTo(l,s.applyTo))}this.resourcesToClean=new Map,this.markers=new Map,this.deliveredMarkers=new Map,this._register(this.modelService.onModelAdded(s=>{this.openModels[s.uri.toString()]=!0},this,this.modelListeners)),this._register(this.modelService.onModelRemoved(s=>{delete this.openModels[s.uri.toString()]},this,this.modelListeners)),this.modelService.getModels().forEach(s=>this.openModels[s.uri.toString()]=!0),this._onDidStateChange=this._register(new E)}get onDidStateChange(){return this._onDidStateChange.event}processLine(e){if(this.tail){let t=this.tail;this.tail=t.then(()=>this.processLineInternal(e))}else this.tail=this.processLineInternal(e)}dispose(){super.dispose(),this.modelListeners.dispose()}get numberOfMatches(){return this._numberOfMatches}get maxMarkerSeverity(){return this._maxMarkerSeverity}tryFindMarker(e){let t=null;if(this.activeMatcher){if(t=this.activeMatcher.next(e),t)return this.captureMatch(t),t;this.clearBuffer(),this.activeMatcher=null}if(this.buffer.length<this.bufferLength)this.buffer.push(e);else{let o=this.buffer.length-1;for(let n=0;n<o;n++)this.buffer[n]=this.buffer[n+1];this.buffer[o]=e}return t=this.tryMatchers(),t&&this.clearBuffer(),t}async shouldApplyMatch(e){switch(e.description.applyTo){case 0:return!0;case 1:return!!this.openModels[(await e.resource).toString()];case 2:return!this.openModels[(await e.resource).toString()];default:return!0}}mergeApplyTo(e,t){return e===t||e===0?e:0}tryMatchers(){this.activeMatcher=null;let e=this.buffer.length;for(let t=0;t<e;t++){let o=this.matchers[e-t];if(o)for(let n of o){let r=n.handle(this.buffer,t);if(r.match)return this.captureMatch(r.match),r.continue&&(this.activeMatcher=n),r.match}}return null}captureMatch(e){this._numberOfMatches++,(this._maxMarkerSeverity===void 0||e.marker.severity>this._maxMarkerSeverity)&&(this._maxMarkerSeverity=e.marker.severity)}clearBuffer(){this.buffer.length>0&&(this.buffer=[])}recordResourcesToClean(e){let t=this.getResourceSetToClean(e);this.markerService.read({owner:e}).forEach(o=>t.set(o.resource.toString(),o.resource))}recordResourceToClean(e,t){this.getResourceSetToClean(e).set(t.toString(),t)}removeResourceToClean(e,t){this.resourcesToClean.get(e)?.delete(t)}getResourceSetToClean(e){let t=this.resourcesToClean.get(e);return t||(t=new Map,this.resourcesToClean.set(e,t)),t}cleanAllMarkers(){this.resourcesToClean.forEach((e,t)=>{this._cleanMarkers(t,e)}),this.resourcesToClean=new Map}cleanMarkers(e){let t=this.resourcesToClean.get(e);t&&(this._cleanMarkers(e,t),this.resourcesToClean.delete(e))}_cleanMarkers(e,t){let o=[],n=this.applyToByOwner.get(e);t.forEach((r,s)=>{(n===0||n===1&&this.openModels[s]||n===2&&!this.openModels[s])&&o.push(r)}),this.markerService.remove(e,o)}recordMarker(e,t,o){let n=this.markers.get(t);n||(n=new Map,this.markers.set(t,n));let r=n.get(o);r||(r=new Map,n.set(o,r));let s=jV.makeKeyOptionalMessage(e,!1),l;r.has(s)?(l=r.get(s))!==void 0&&l.message.length<e.message.length&&ei&&r.set(s,e):r.set(s,e)}reportMarkers(){this.markers.forEach((e,t)=>{let o=this.getDeliveredMarkersPerOwner(t);e.forEach((n,r)=>{this.deliverMarkersPerOwnerAndResourceResolved(t,r,n,o)})})}deliverMarkersPerOwnerAndResource(e,t){let o=this.markers.get(e);if(!o)return;let n=this.getDeliveredMarkersPerOwner(e),r=o.get(t);r&&this.deliverMarkersPerOwnerAndResourceResolved(e,t,r,n)}deliverMarkersPerOwnerAndResourceResolved(e,t,o,n){if(o.size!==n.get(t)){let r=[];o.forEach(s=>r.push(s)),this.markerService.changeOne(e,A.parse(t),r),n.set(t,o.size)}}getDeliveredMarkersPerOwner(e){let t=this.deliveredMarkers.get(e);return t||(t=new Map,this.deliveredMarkers.set(e,t)),t}cleanMarkerCaches(){this._numberOfMatches=0,this._maxMarkerSeverity=void 0,this.markers.clear(),this.deliveredMarkers.clear()}done(){this.reportMarkers(),this.cleanAllMarkers()}};var jze=class extends sQt{constructor(e,t,o,n=0,r,s){super(e,t,o,r,s);this._hasStarted=!1;let l=Object.create(null);e.forEach(c=>l[c.owner]=!0),this.owners=Object.keys(l),this.owners.forEach(c=>{this.recordResourcesToClean(c)})}async processLineInternal(e){this._hasStarted||(this._hasStarted=!0,this._onDidStateChange.fire(Qct.create("backgroundProcessingBegins")));let t=this.tryFindMarker(e);if(!t)return;let o=t.description.owner,r=(await t.resource).toString();this.removeResourceToClean(o,r),await this.shouldApplyMatch(t)&&(this.recordMarker(t.marker,o,r),(this.currentOwner!==o||this.currentResource!==r)&&(this.currentOwner&&this.currentResource&&this.deliverMarkersPerOwnerAndResource(this.currentOwner,this.currentResource),this.currentOwner=o,this.currentResource=r))}},aQt=class extends sQt{constructor(e,t,o,n,r){super(e,t,o,n,r);this.lines=[];this.beginPatterns=[];this.resetCurrentResource(),this.backgroundPatterns=[],this._activeBackgroundMatchers=new Set,this.problemMatchers.forEach(s=>{if(s.watching){let l=xt();this.backgroundPatterns.push({key:l,matcher:s,begin:s.watching.beginsPattern,end:s.watching.endsPattern}),this.beginPatterns.push(s.watching.beginsPattern.regexp)}}),this.modelListeners.add(this.modelService.onModelRemoved(s=>{let l=U.debounce(this.markerService.onMarkerChanged,(c,u)=>(c??[]).concat(u),500,!1,!0)(async c=>{if(c.length===0)return;let u=s.uri.toString();if(!c.some(h=>h.toString()===u)||this.markerService.read({resource:s.uri}).length!==0)return;let p=Array.from(this.lines);for(let h of p)await this.processLineInternal(h)});setTimeout(()=>{if(l){let c=l;l=void 0,c.dispose()}},600)}))}aboutToStart(){for(let e of this.backgroundPatterns)e.matcher.watching&&e.matcher.watching.activeOnStart&&(this._activeBackgroundMatchers.add(e.key),this._onDidStateChange.fire(Qct.create("backgroundProcessingBegins")),this.recordResourcesToClean(e.matcher.owner))}async processLineInternal(e){if(await this.tryBegin(e)||this.tryFinish(e))return;this.lines.push(e);let t=this.tryFindMarker(e);if(!t)return;let o=await t.resource,n=t.description.owner,r=o.toString();this.removeResourceToClean(n,r),await this.shouldApplyMatch(t)&&(this.recordMarker(t.marker,n,r),(this.currentOwner!==n||this.currentResource!==r)&&(this.reportMarkersForCurrentResource(),this.currentOwner=n,this.currentResource=r))}forceDelivery(){this.reportMarkersForCurrentResource()}async tryBegin(e){let t=!1;for(let o of this.backgroundPatterns){let n=Date.now(),r=o.begin.regexp.exec(e),s=Date.now()-n;if(s>5&&this.logService?.trace(`ProblemMatcher: slow begin regexp took ${s}ms to execute`,o.begin.regexp.source),r){if(this._activeBackgroundMatchers.has(o.key))continue;this._activeBackgroundMatchers.add(o.key),t=!0,this._onDidFindFirstMatch.fire(),this.lines=[],this.lines.push(e),this._onDidStateChange.fire(Qct.create("backgroundProcessingBegins")),this.cleanMarkerCaches(),this.resetCurrentResource();let l=o.matcher.owner,c=r[o.begin.file];if(c){let u=Wze(c,o.matcher);this.recordResourceToClean(l,await u)}else this.recordResourcesToClean(l)}}return t}tryFinish(e){let t=!1;for(let o of this.backgroundPatterns){let n=Date.now(),r=o.end.regexp.exec(e),s=Date.now()-n;if(s>5&&this.logService?.trace(`ProblemMatcher: slow end regexp took ${s}ms to execute`,o.end.regexp.source),r&&(this._numberOfMatches>0?this._onDidFindErrors.fire(this.markerService.read({owner:o.matcher.owner})):this._onDidRequestInvalidateLastMarker.fire(),this._activeBackgroundMatchers.delete(o.key))){this.resetCurrentResource();let l=r.groups?new Map(Object.entries(r.groups)):void 0;this._onDidStateChange.fire(Qct.create("backgroundProcessingEnds",l)),t=!0,this.lines.push(e);let c=o.matcher.owner;this.cleanMarkers(c),this.cleanMarkerCaches()}}return t}resetCurrentResource(){this.reportMarkersForCurrentResource(),this.currentOwner=void 0,this.currentResource=void 0}reportMarkersForCurrentResource(){this.currentOwner&&this.currentResource&&this.deliverMarkersPerOwnerAndResource(this.currentOwner,this.currentResource)}done(){[...this.applyToByOwner.keys()].forEach(e=>{this.recordResourcesToClean(e)}),super.done()}isWatching(){return this.backgroundPatterns.length>0}};var Qq="task_terminal_status",Bvn={id:Qq,icon:AE,severity:bt.Info,tooltip:d(14469,null)},Hvn={id:Qq,icon:R.check,severity:bt.Info,tooltip:d(14474,null)},Uvn={id:Qq,icon:R.check,severity:bt.Info,tooltip:d(14475,null)},zvn={id:Qq,icon:R.error,severity:bt.Error,tooltip:d(14470,null)},Kvn={id:Qq,icon:R.error,severity:bt.Error,tooltip:d(14471,null)},Gvn={id:Qq,icon:R.warning,severity:bt.Warning,tooltip:d(14476,null)},qvn={id:Qq,icon:R.warning,severity:bt.Warning,tooltip:d(14477,null)},$vn={id:Qq,icon:R.info,severity:bt.Info,tooltip:d(14472,null)},jvn={id:Qq,icon:R.info,severity:bt.Info,tooltip:d(14473,null)},Qze=class extends x{constructor(e,t){super();this._accessibilitySignalService=t;this.terminalMap=this._register(new Vt);this._register(e.onDidStateChange(o=>{switch(o.kind){case"processStarted":case"active":this.eventActive(o);break;case"inactive":this.eventInactive(o);break;case"processEnded":this.eventEnd(o);break}}))}addTerminal(e,t,o){let n={id:Qq,severity:bt.Info};t.statusList.add(n);let r=new N;r.add(o.onDidFindFirstMatch(()=>{this._marker=t.registerMarker(),this._marker&&r.add(this._marker)})),r.add(o.onDidFindErrors(()=>{this._marker&&t.addBufferMarker({marker:this._marker,hoverMessage:d(14468,null),disableCommandStorage:!0})})),r.add(o.onDidRequestInvalidateLastMarker(()=>{this._marker?.dispose(),this._marker=void 0})),r.add(t.onDisposed(()=>{this.terminalMap.deleteAndDispose(t.instanceId)})),this.terminalMap.set(t.instanceId,{terminal:t,task:e,status:n,problemMatcher:o,taskRunEnded:!1,dispose(){r.dispose()}})}terminalFromEvent(e){if(!(!Object.hasOwn(e,"terminalId")||!e.terminalId))return this.terminalMap.get(e.terminalId)}eventEnd(e){let t=this.terminalFromEvent(e);if(t)if(t.taskRunEnded=!0,t.terminal.statusList.remove(t.status),e.exitCode===0&&(!t.problemMatcher.maxMarkerSeverity||t.problemMatcher.maxMarkerSeverity<4))if(this._accessibilitySignalService.playSignal($o.taskCompleted),t.task.configurationProperties.isBackground)for(let o of t.terminal.statusList.statuses)t.terminal.statusList.remove(o);else t.terminal.statusList.add(Hvn);else e.exitCode||t.problemMatcher.maxMarkerSeverity!==void 0&&t.problemMatcher.maxMarkerSeverity===8?(this._accessibilitySignalService.playSignal($o.taskFailed),t.terminal.statusList.add(zvn)):t.problemMatcher.maxMarkerSeverity===4?(this._accessibilitySignalService.playSignal($o.taskFailed),t.terminal.statusList.add(Gvn)):t.problemMatcher.maxMarkerSeverity===2&&t.terminal.statusList.add($vn)}eventInactive(e){let t=this.terminalFromEvent(e);!t||!t.problemMatcher||t.taskRunEnded||(t.terminal.statusList.remove(t.status),t.problemMatcher.numberOfMatches===0?(this._accessibilitySignalService.playSignal($o.taskCompleted),t.terminal.statusList.add(Uvn)):t.problemMatcher.maxMarkerSeverity===8?(this._accessibilitySignalService.playSignal($o.taskFailed),t.terminal.statusList.add(Kvn)):t.problemMatcher.maxMarkerSeverity===4?t.terminal.statusList.add(qvn):t.problemMatcher.maxMarkerSeverity===2&&t.terminal.statusList.add(jvn))}eventActive(e){let t=this.terminalFromEvent(e);t&&(t.taskRunEnded=!1,t.terminal.statusList.remove(t.status),(t.problemMatcher instanceof jze||t.problemMatcher?.problemMatchers.length>0||e.runType==="singleRun")&&t.terminal.statusList.add(Bvn))}};Qze=I([m(0,Og),m(1,lr)],Qze);function z6(a,i){return Qvn(633,a,i)}function Qvn(a,i,e){let t=`\x1B]${a};${i}`;return e&&(t+=`;${e}`),t+="\x07",t}var lQt=class extends x{constructor(){super();this.terminalMarkerMap=new Map;this.terminalDisposables=new Vt}addTerminal(e,t){this.terminalMarkerMap.set(e.instanceId,{resources:new Map,markers:new Map});let o=new N;this.terminalDisposables.set(e.instanceId,o),o.add(e.onDisposed(()=>{this.terminalMarkerMap.delete(e.instanceId),this.terminalDisposables.deleteAndDispose(e.instanceId)})),o.add(t.onDidFindErrors(n=>{let r=this.terminalMarkerMap.get(e.instanceId);if(r){r.markers.clear(),r.resources.clear();for(let s of n)if(s.severity===8){r.resources.set(s.resource.toString(),s.resource);let c=r.markers.get(s.owner);c||(c=new Map,r.markers.set(s.owner,c)),c.set(s.resource.toString(),s),this.terminalMarkerMap.set(e.instanceId,r)}}})),o.add(t.onDidRequestInvalidateLastMarker(()=>{let n=this.terminalMarkerMap.get(e.instanceId);n?.markers.clear(),n?.resources.clear(),this.terminalMarkerMap.set(e.instanceId,{resources:new Map,markers:new Map})}))}getTaskProblems(e){let t=this.terminalMarkerMap.get(e);if(t){if(t.markers.size===0)return new Map}else return;let o=new Map;for(let[n,r]of t.markers){let s=[],l=[];for(let[c,u]of r)s.push(t.resources.get(c)),l.push(u);o.set(n,{resources:s,markers:l})}return o}};var Yct="Task",Xct=class a{constructor(i,e,t,o){this.workspaceFolder=i;this.taskSystemInfo=e;this.values=t;this._service=o}static{this._regex=/\$\{(.*?)\}/g}async resolve(i){let e=[];i.replace(a._regex,(o,...n)=>(e.push(this._replacer(o,n)),o));let t=await Promise.all(e);return i.replace(a._regex,()=>t.shift())}async _replacer(i,e){let t=this.values.get(i.substring(2,i.length-1));return t??(this._service?this._service.resolveAsync(this.workspaceFolder,i):i)}},_re=class a extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,P){super();this._terminalService=e;this._terminalGroupService=t;this._outputService=o;this._paneCompositeService=n;this._viewsService=r;this._markerService=s;this._modelService=l;this._configurationResolverService=c;this._contextService=u;this._environmentService=p;this._outputChannelId=h;this._fileService=g;this._terminalProfileResolverService=f;this._pathService=v;this._viewDescriptorService=b;this._logService=S;this._notificationService=y;this._taskLookup=P;this._isRerun=!1;this._terminalCreationQueue=Promise.resolve();this._hasReconnected=!1;this._terminalTabActions=[{id:jAt,label:d(14481,null),icon:$At}];this._taskStartTimes=new Map;this._capturedTaskVariables=new Map;this._activeTasks=Object.create(null),this._busyTasks=Object.create(null),this._taskErrors=Object.create(null),this._taskDependencies=Object.create(null),this._terminals=Object.create(null),this._idleTaskTerminals=new o1,this._sameTaskTerminals=Object.create(null),this._onDidStateChange=this._register(new E),this._taskSystemInfoResolver=T,this._register(this._terminalStatusManager=k.createInstance(Qze)),this._register(this._taskProblemMonitor=k.createInstance(lQt)),this._taskTerminalActive=UYe.bindTo(w),this._register(this._terminalService.onDidChangeActiveInstance(O=>this._taskTerminalActive.set(O?.shellLaunchConfig.type==="Task")))}static{this.TelemetryEventName="taskService"}static{this.ProcessVarName="__process__"}static{this._shellQuotes={cmd:{strong:'"'},powershell:{escape:{escapeChar:"`",charsToEscape:` "'()`},strong:"'",weak:'"'},bash:{escape:{escapeChar:"\\",charsToEscape:` "'`},strong:"'",weak:'"'},zsh:{escape:{escapeChar:"\\",charsToEscape:` "'`},strong:"'",weak:'"'}}}static{this._osShellQuotes={Linux:a._shellQuotes.bash,Mac:a._shellQuotes.bash,Windows:a._shellQuotes.powershell}}taskShellIntegrationStartSequence(e){return z6("P","HasRichCommandDetection=True")+z6("A")+z6("P","Task=True")+(e?z6("P",`Cwd=${typeof e=="string"?e:e.fsPath}`):"")+z6("B")}getTaskShellIntegrationOutputSequence(e){return(e?z6("E",`${NEo(e.commandLine)};${e.nonce}`):"")+z6("C")}get onDidStateChange(){return this._onDidStateChange.event}_log(e){this._appendOutput(e+`
`)}_showOutput(){this._outputService.showChannel(this._outputChannelId,!0)}reconnect(e,t){return this._reconnectToTerminals(),this.run(e,t,ybe.reconnect)}run(e,t,o=ybe.command){e=e.clone();let n=IT.is(e)||this._isTaskEmpty(e)?[]:this._getInstances(e),r=n.length<((e.runOptions&&e.runOptions.instanceLimit)??1),s=n[0]?.count?.count??0;if(this._currentTask=new zze(e,t,o),s>0&&(e.instance=s),!r){let l=n[n.length-1];return this._lastTask=this._currentTask,{kind:2,task:l.task,active:{same:!0,background:e.configurationProperties.isBackground},promise:l.promise}}try{let l={kind:1,task:e,started:{},promise:this._executeTask(e,t,o,new Set,new Map,void 0)};return l.promise.then(c=>{this._lastTask=this._currentTask}),l}catch(l){throw l instanceof SL?l:l instanceof Error?(this._log(l.message),new SL(bt.Error,l.message,7)):(this._log(l.toString()),new SL(bt.Error,d(14490,null),7))}}getTerminalsForTasks(e){let t=[];for(let o of cc(e))for(let n of Object.keys(this._terminals)){let r=this._terminals[n];r.lastTask===o.getMapKey()&&t.push(r.terminal.resource)}return t.length>0?t:void 0}getTaskProblems(e){return this._taskProblemMonitor.getTaskProblems(e)}rerun(){if(this._lastTask&&this._lastTask.verify()){this._lastTask.task.runOptions.reevaluateOnRerun!==void 0&&!this._lastTask.task.runOptions.reevaluateOnRerun&&(this._isRerun=!0);let e=this.run(this._lastTask.task,this._lastTask.resolver);return e.promise.then(t=>{this._isRerun=!1}),e}else return}get lastTask(){return this._lastTask}set lastTask(e){this._lastTask=e}_showTaskLoadErrors(e){e.taskLoadMessages&&e.taskLoadMessages.length>0&&(e.taskLoadMessages.forEach(o=>{this._log(o+`
`)}),this._notificationService.prompt(bt.Warning,d(14489,null,e._label),[{label:"Show Output",run:()=>this._showOutput()}]))}isTaskVisible(e){let t=this._activeTasks[e.getMapKey()];if(!t?.terminal)return!1;let o=this._terminalService.activeInstance;return!!this._viewsService.getActiveViewWithId(Sc)&&o?.instanceId===t.terminal.instanceId}revealTask(e){let t=this._activeTasks[e.getMapKey()];if(!t?.terminal)return!1;let o=this._viewDescriptorService.getViewLocationById(Sc)===1;return o&&this.isTaskVisible(e)?(this._previousPanelId?(this._previousTerminalInstance&&this._terminalService.setActiveInstance(this._previousTerminalInstance),this._paneCompositeService.openPaneComposite(this._previousPanelId,1)):this._paneCompositeService.hideActivePaneComposite(1),this._previousPanelId=void 0,this._previousTerminalInstance=void 0):(o&&(this._previousPanelId=this._paneCompositeService.getActivePaneComposite(1)?.getId(),this._previousPanelId===Sc&&(this._previousTerminalInstance=this._terminalService.activeInstance??void 0)),this._terminalService.setActiveInstance(t.terminal),(Ld.is(e)||Th.is(e))&&this._terminalGroupService.showPanel(e.command.presentation.focus)),!0}isActive(){return Promise.resolve(this.isActiveSync())}isActiveSync(){return Object.values(this._activeTasks).some(e=>!!e.terminal)}canAutoTerminate(){return Object.values(this._activeTasks).every(e=>!e.task.configurationProperties.promptOnClose)}getActiveTasks(){return Object.values(this._activeTasks).flatMap(e=>e.terminal?e.task:[])}getLastInstance(e){let t=e.getKey();return Object.values(this._activeTasks).reverse().find(o=>t&&t===o.task.getKey())?.task}getFirstInstance(e){let t=e.getKey();for(let o of this.getActiveTasks())if(t&&t===o.getKey())return o}getBusyTasks(){return Object.keys(this._busyTasks).map(e=>this._busyTasks[e])}customExecutionComplete(e,t){return this._activeTasks[e.getMapKey()]?.terminal?new Promise(n=>{n()}):Promise.reject(new Error("Expected to have a terminal for a custom execution task"))}_getInstances(e){let t=e.getKey();return Object.values(this._activeTasks).filter(o=>t&&t===o.task.getKey())}_removeFromActiveTasks(e){let t=typeof e=="string"?e:e.getMapKey();this._activeTasks[t]&&delete this._activeTasks[t]}_fireTaskEvent(e){if(e.kind!=="changed"&&e.kind!=="problemMatcherEnded"&&e.kind!=="problemMatcherStarted"){let t=this._activeTasks[e.__task.getMapKey()];t&&(t.state=e.kind)}this._onDidStateChange.fire(e)}terminate(e){let t=this._activeTasks[e.getMapKey()];if(!t)return Promise.resolve({success:!1,task:void 0});let o=t.terminal;return o?new Promise((n,r)=>{let s=o.onDisposed(c=>{this._fireTaskEvent(up.terminated(e,c.instanceId,c.exitReason)),s.dispose()}),l=o.onExit(()=>{let c=t.task;try{l.dispose(),this._fireTaskEvent(up.terminated(c,o.instanceId,o.exitReason))}catch{}n({success:!0,task:c})});o.dispose()}):Promise.resolve({success:!1,task:void 0})}terminateAll(){let e=[];for(let[t,o]of Object.entries(this._activeTasks)){let n=o?.terminal;n&&(e.push(new Promise((r,s)=>{let l=n.onExit(()=>{let c=o.task;try{l.dispose(),this._fireTaskEvent(up.terminated(c,n.instanceId,n.exitReason))}catch{}this._activeTasks[t]===o&&delete this._activeTasks[t],r({success:!0,task:o.task})})})),n.dispose())}return Promise.all(e)}_showDependencyCycleMessage(e){this._log(d(14479,null,e._label)),this._showOutput()}_executeTask(e,t,o,n,r,s){this._showTaskLoadErrors(e);let l=e.getMapKey(),c=Promise.resolve().then(async()=>{s=s??new Map;let g=[];if(e.configurationProperties.dependsOn){let f=new Set(n).add(e.getCommonTaskId());for(let v of e.configurationProperties.dependsOn){let b=await t.resolve(v.uri,v.task);if(b){this._adoptConfigurationForDependencyTask(b,e);let S=e.getMapKey(),y=b.getMapKey();this._taskDependencies[S]||(this._taskDependencies[S]=[]),this._taskDependencies[S].includes(y)||this._taskDependencies[S].push(y);let w,k=b.getCommonTaskId();if(f.has(k))this._showDependencyCycleMessage(b),w=Promise.resolve({});else if(w=r.get(k),!w){let T=this._activeTasks[b.getMapKey()]??this._getInstances(b).pop();w=T&&this._getDependencyPromise(T)}if(w||(this._fireTaskEvent(up.general("dependsOnStarted",e)),w=this._executeDependencyTask(b,t,o,f,r,s)),r.set(k,w),g.push(w),e.configurationProperties.dependsOrder==="sequence"&&(await w).exitCode!==0)break}else this._log(d(14480,null,Fe(v.task)?v.task:JSON.stringify(v.task,void 0,0),v.uri.toString())),this._showOutput()}}return Promise.all(g).then(f=>{for(let v of f)if(v.exitCode!==0)return{exitCode:v.exitCode};return(Th.is(e)||Ld.is(e))&&e.command?this._isRerun?this._reexecuteCommand(e,o,s):this._executeCommand(e,o,s):{exitCode:0}})}).finally(()=>{delete this._activeTasks[l]}),p=this._getInstances(e).pop()?.count??{count:0};p.count++;let h={task:e,promise:c,count:p};return this._activeTasks[l]=h,c}_createInactiveDependencyPromise(e){return new Promise(t=>{let o=this.onDidStateChange(n=>{n.kind==="inactive"&&n.__task===e&&(o.dispose(),t({exitCode:0}))})})}_taskHasErrors(e){let t=e.getMapKey();if(this._taskErrors[t])return!0;let o=this._taskDependencies[t];if(o){for(let n of o)if(this._taskErrors[n])return!0}return!1}_cleanupTaskTracking(e){let t=e.getMapKey();delete this._taskErrors[t],delete this._taskDependencies[t]}_adoptConfigurationForDependencyTask(e,t){e.configurationProperties.icon?(e.configurationProperties.icon.id||=t.configurationProperties.icon?.id,e.configurationProperties.icon.color||=t.configurationProperties.icon?.color):e.configurationProperties.icon=t.configurationProperties.icon}async _getDependencyPromise(e){return!e.task.configurationProperties.isBackground||!e.task.configurationProperties.problemMatchers||e.task.configurationProperties.problemMatchers.length===0?e.promise:e.state==="inactive"?{exitCode:0}:this._createInactiveDependencyPromise(e.task)}async _executeDependencyTask(e,t,o,n,r,s){if(!e.configurationProperties.isBackground)return this._executeTask(e,t,o,n,r,s);let l=this._createInactiveDependencyPromise(e);return Promise.race([l,this._executeTask(e,t,o,n,r,s)])}async _resolveAndFindExecutable(e,t,o,n,r){let s=await this._configurationResolverService.resolveAsync(t,i3.value(o.command.name));n=n?await this._configurationResolverService.resolveAsync(t,n):void 0;let l=(await this._pathService.path).delimiter,c=r?await Promise.all(r.split(l).map(p=>this._configurationResolverService.resolveAsync(t,p))):void 0,u=await e?.findExecutable(s,n,c);return u||(Zl(s)?s:Yc(n??"",s))}_findUnresolvedVariables(e,t){if(t.size===0)return e;let o=new Set;for(let n of e)t.has(n.substring(2,n.length-1))||o.add(n);return o}_mergeMaps(e,t){for(let o of t)e.has(o[0])||e.set(o[0],o[1])}async _acquireInput(e,t,o,n,r){let s=await this._resolveVariablesFromSet(e,t,o,n,r);return this._fireTaskEvent(up.general("acquiredInput",o)),s}_resolveVariablesFromSet(e,t,o,n,r){let s=o.command&&o.command.runtime===2,l=o.command&&o.command.options?o.command.options:void 0,c=l?l.cwd:void 0,u;if(l&&l.env){for(let g of Object.keys(l.env))if(g.toLowerCase()==="path"){Fe(l.env[g])&&(u=l.env[g]);break}}let p=this._findUnresolvedVariables(n,r),h;if(e&&t){let g={variables:p};return e.platform===3&&s&&(g.process={name:i3.value(o.command.name)},c&&(g.process.cwd=c),u&&(g.process.path=u)),h=e.resolveVariables(t,g,El.toConfigurationTarget(o._source.kind)).then(async f=>{if(f){if(this._mergeMaps(r,f.variables),f.variables=new Map(r),s){let v=i3.value(o.command.name);e.platform===3&&(v=await this._resolveAndFindExecutable(e,t,o,c,u)),f.variables.set(a.ProcessVarName,v)}return f}}),h}else{let g=new Array;return p.forEach(f=>g.push(f)),new Promise((f,v)=>{this._configurationResolverService.resolveWithInteraction(t,g,"tasks",void 0,El.toConfigurationTarget(o._source.kind)).then(async b=>{if(b){if(this._mergeMaps(r,b),b=new Map(r),s){let y;ei?y=await this._resolveAndFindExecutable(e,t,o,c,u):y=await this._configurationResolverService.resolveAsync(t,i3.value(o.command.name)),b.set(a.ProcessVarName,y)}f({variables:b})}else f(void 0)},b=>{v(b)})})}}_executeCommand(e,t,o){let n=e.getWorkspaceFolder(),r;if(n)r=this._currentTask.workspaceFolder=n;else{let u=this._contextService.getWorkspace().folders;r=u.length>0?u[0]:void 0}let s=this._currentTask.systemInfo=this._taskSystemInfoResolver(r),l=new Set;return this._collectTaskVariables(l,e),this._acquireInput(s,r,e,l,o).then(u=>u&&!this._isTaskEmpty(e)?(this._currentTask.resolvedVariables=u,this._executeInTerminal(e,t,new Xct(r,s,u.variables,this._configurationResolverService),r)):(this._fireTaskEvent(up.general("end",e)),Promise.resolve({exitCode:0})),u=>Promise.reject(u))}_isTaskEmpty(e){let t=e.command.runtime===3;return!(e.command!==void 0&&e.command.runtime&&(t||e.command.name!==void 0))}_reexecuteCommand(e,t,o){let n=this._lastTask;if(!n)return Promise.reject(new Error("No task previously run"));let r=this._currentTask.workspaceFolder=n.workspaceFolder,s=new Set;this._collectTaskVariables(s,e);let l=!0;return s.forEach(c=>{Object.hasOwn(n.getVerifiedTask().resolvedVariables,c.substring(2,c.length-1))&&(l=!1)}),l?(this._currentTask.resolvedVariables=n.getVerifiedTask().resolvedVariables,this._executeInTerminal(e,t,new Xct(n.getVerifiedTask().workspaceFolder,n.getVerifiedTask().systemInfo,n.getVerifiedTask().resolvedVariables.variables,this._configurationResolverService),r)):this._acquireInput(n.getVerifiedTask().systemInfo,n.getVerifiedTask().workspaceFolder,e,s,o).then(c=>c?(this._currentTask.resolvedVariables=c,this._executeInTerminal(e,t,new Xct(n.getVerifiedTask().workspaceFolder,n.getVerifiedTask().systemInfo,c.variables,this._configurationResolverService),r)):(this._fireTaskEvent(up.general("end",e)),{exitCode:0}),c=>Promise.reject(c))}async _executeInTerminal(e,t,o,n){let r,s,l;if(e.configurationProperties.isBackground){let u=await this._resolveMatchers(o,e.configurationProperties.problemMatchers),p=new aQt(u,this._markerService,this._modelService,this._fileService,this._logService);u.length>0&&!p.isWatching()&&(this._appendOutput(d(14488,null,e._label)),this._showOutput());let h=new N,g=0,f=e.getMapKey();h.add(p.onDidStateChange(y=>{if(y.kind==="backgroundProcessingBegins")g++,this._busyTasks[f]=e,this._fireTaskEvent(up.general("active",e,r?.instanceId));else if(y.kind==="backgroundProcessingEnds"&&(g--,this._busyTasks[f]&&delete this._busyTasks[f],y.capturedVariables&&this._registerCapturedVariables(y.capturedVariables),this._fireTaskEvent(up.inactive(e,r?.instanceId,this._takeTaskDuration(r?.instanceId))),g===0))if(p.numberOfMatches>0&&p.maxMarkerSeverity&&p.maxMarkerSeverity>=8){this._taskErrors[e.getMapKey()]=!0,this._fireTaskEvent(up.general("problemMatcherFoundErrors",e,r?.instanceId));let w=e.command.presentation.reveal;e.command.presentation.revealProblems===2?this._viewsService.openView(Rr.MARKERS_VIEW_ID,!0):w===2&&(this._terminalService.setActiveInstance(r),this._terminalGroupService.showPanel(!1))}else this._fireTaskEvent(up.problemMatcherEnded(e,this._taskHasErrors(e),r?.instanceId))})),p.aboutToStart();let v;if([r,s]=await this._createTerminal(e,o,n),s)return Promise.reject(new Error(s.message));if(!r)return Promise.reject(new Error(`Failed to create terminal for task ${e._label}`));this._terminalStatusManager.addTerminal(e,r,p),this._taskProblemMonitor.addTerminal(r,p);let b=!1;r.processReady.then(()=>{b||(this._fireTaskEvent(up.processStarted(e,r.instanceId,r.processId)),b=!0)},y=>{this._logService.error("Task terminal process never got ready")}),this._taskStartTimes.set(r.instanceId,Date.now()),this._fireTaskEvent(up.start(e,r.instanceId,o.values));let S;if(u.length&&(S=r.onLineData(y=>{p.processLine(y),v||(v=new Xo(3e3)),v.trigger(()=>{p.forceDelivery(),v=void 0})})),l=new Promise((y,w)=>{let k=r.onExit(T=>{let P=typeof T=="number"?T:T?.code;S?.dispose(),k.dispose();let O=e.getMapKey();if(this._busyTasks[f]&&delete this._busyTasks[f],this._removeFromActiveTasks(e),this._fireTaskEvent(up.changed()),T!==void 0)switch(e.command.presentation.panel){case 2:this._sameTaskTerminals[O]=r.instanceId.toString();break;case 1:this._idleTaskTerminals.set(O,r.instanceId.toString(),1);break}if(e.command.presentation.reveal===2&&(P!==0||p.numberOfMatches>0&&p.maxMarkerSeverity&&p.maxMarkerSeverity>=8))try{this._terminalService.setActiveInstance(r),this._terminalGroupService.showPanel(!1)}catch{}p.done(),p.dispose(),b||(this._fireTaskEvent(up.processStarted(e,r.instanceId,r.processId)),b=!0);let H=this._takeTaskDuration(r.instanceId);this._fireTaskEvent(up.processEnded(e,r.instanceId,P,H));for(let G=0;G<g;G++)this._fireTaskEvent(up.inactive(e,r.instanceId));g=0,this._fireTaskEvent(up.general("end",e)),h.dispose(),y({exitCode:P??void 0})})}),t===ybe.reconnect&&r.xterm){let y=[],w=r.xterm.getBufferReverseIterator(),k=new RegExp(p.beginPatterns.map(P=>P.source).join("|"));for(let P of w)if(y.push(P),k.test(P))break;let T;for(let P=y.length-1;P>=0;P--)p.processLine(y[P]),T||(T=new Xo(3e3)),T.trigger(()=>{p.forceDelivery(),T=void 0})}}else{if([r,s]=await this._createTerminal(e,o,n),s)return Promise.reject(new Error(s.message));if(!r)return Promise.reject(new Error(`Failed to create terminal for task ${e._label}`));this._taskStartTimes.set(r.instanceId,Date.now()),this._fireTaskEvent(up.start(e,r.instanceId,o.values));let u=e.getMapKey();this._busyTasks[u]=e,this._fireTaskEvent(up.general("active",e,r.instanceId));let p=await this._resolveMatchers(o,e.configurationProperties.problemMatchers),h=new jze(p,this._markerService,this._modelService,0,this._fileService,this._logService);this._terminalStatusManager.addTerminal(e,r,h),this._taskProblemMonitor.addTerminal(r,h);let g=h.onDidStateChange(b=>{b.kind==="backgroundProcessingBegins"?this._fireTaskEvent(up.general("problemMatcherStarted",e,r?.instanceId)):b.kind==="backgroundProcessingEnds"&&(h.numberOfMatches&&h.maxMarkerSeverity&&h.maxMarkerSeverity>=8?(this._taskErrors[e.getMapKey()]=!0,this._fireTaskEvent(up.general("problemMatcherFoundErrors",e,r?.instanceId))):this._fireTaskEvent(up.problemMatcherEnded(e,this._taskHasErrors(e),r?.instanceId)))}),f=!1;r.processReady.then(()=>{f||(this._fireTaskEvent(up.processStarted(e,r.instanceId,r.processId)),f=!0)},b=>{});let v=r.onLineData(b=>{h.processLine(b)});l=new Promise((b,S)=>{let y=r.onExit(w=>{let k=typeof w=="number"?w:w?.code;y.dispose();let T=e.getMapKey();if(this._removeFromActiveTasks(e),this._fireTaskEvent(up.changed()),w!==void 0)switch(e.command.presentation.panel){case 2:this._sameTaskTerminals[T]=r.instanceId.toString();break;case 1:this._idleTaskTerminals.set(T,r.instanceId.toString(),1);break}let P=e.command.presentation.reveal,O=e.command.presentation.revealProblems;if(r&&O===2&&h.numberOfMatches>0)this._viewsService.openView(Rr.MARKERS_VIEW_ID);else if(r&&P===2&&(k!==0||h.numberOfMatches>0&&h.maxMarkerSeverity&&h.maxMarkerSeverity>=8))try{this._terminalService.setActiveInstance(r),this._terminalGroupService.showPanel(!1)}catch{}setTimeout(()=>{v.dispose(),h.done(),h.dispose(),g.dispose()},100),!f&&r&&(this._fireTaskEvent(up.processStarted(e,r.instanceId,r.processId)),f=!0);let H=this._takeTaskDuration(r?.instanceId);this._fireTaskEvent(up.processEnded(e,r?.instanceId,k??void 0,H)),this._busyTasks[u]&&delete this._busyTasks[u],this._fireTaskEvent(up.inactive(e,r?.instanceId,H)),h.numberOfMatches&&h.maxMarkerSeverity&&h.maxMarkerSeverity>=8?(this._taskErrors[e.getMapKey()]=!0,this._fireTaskEvent(up.general("problemMatcherFoundErrors",e,r?.instanceId))):this._fireTaskEvent(up.problemMatcherEnded(e,this._taskHasErrors(e),r?.instanceId)),this._fireTaskEvent(up.general("end",e,r?.instanceId)),this._cleanupTaskTracking(e),b({exitCode:k??void 0})})})}return e.command.presentation&&e.command.presentation.revealProblems===3?this._viewsService.openView(Rr.MARKERS_VIEW_ID):e.command.presentation&&(e.command.presentation.focus||e.command.presentation.reveal===1)&&(this._terminalService.setActiveInstance(r),await this._terminalService.revealTerminal(r),e.command.presentation.focus&&r&&await this._terminalService.focusInstance(r)),this._activeTasks[e.getMapKey()]?this._activeTasks[e.getMapKey()].terminal=r:this._logService.warn("No active tasks found for the terminal."),this._fireTaskEvent(up.changed()),l}_takeTaskDuration(e){if(e===void 0)return;let t=this._taskStartTimes.get(e);if(t!==void 0)return this._taskStartTimes.delete(e),Date.now()-t}_registerCapturedVariables(e){for(let[t,o]of e)this._capturedTaskVariables.set(t,o),this._configurationResolverService.resolvableVariables.has(`taskVar:${t}`)||this._configurationResolverService.contributeVariable(`taskVar:${t}`,async()=>this._capturedTaskVariables.get(t))}_createTerminalName(e){return this._contextService.getWorkbenchState()===3?e.getQualifiedLabel():e.configurationProperties.name||""}async _createShellLaunchConfig(e,t,o,n,r,s,l,c,u){let p,h=e.command.runtime===1,g=this._contextService.getWorkbenchState()===3,f=this._createTerminalName(e),v=Yct,b=e.command.name,S;if(r.cwd&&(S=r.cwd,Zl(S)||t&&t.uri.scheme===Q.file&&(S=Yc(t.uri.fsPath,S)),S=O$(S)?S:of(A.from({scheme:Q.file,path:S}),this._environmentService.remoteAuthority,this._pathService.defaultUriScheme)),h){let y;switch(n){case 3:y=1;break;case 1:y=2;break;case 2:default:y=3;break}let w=await this._terminalProfileResolverService.getDefaultProfile({allowAutomationShell:!0,os:y,remoteAuthority:this._environmentService.remoteAuthority}),k;if(e.configurationProperties.icon?.id)k=q.fromId(e.configurationProperties.icon.id);else{let he=e.configurationProperties.group?xbe.to(e.configurationProperties.group):void 0;k=(typeof he=="string"?he:he?.kind)==="test"?q.fromId(R.beaker.id):w.icon}p={name:f,type:v,executable:w.path,args:w.args,env:{...w.env},icon:k,color:e.configurationProperties.icon?.color||void 0,waitOnExit:c};let T=!1,P=e.command.options&&e.command.options.shell;P&&(P.executable&&(P.executable!==p.executable&&(p.args=void 0),p.executable=await this._resolveVariable(o,P.executable),T=!0),P.args&&(p.args=await this._resolveVariables(o,P.args.slice()))),p.args===void 0&&(p.args=[]);let O=Array.isArray(p.args)?p.args.slice(0):[p.args],V=[],H=Oo.basename((await this._pathService.fileURI(p.executable)).path).toLowerCase(),G=this._buildShellCommandLine(n,H,P,s,b,l),$=!1;if(n===3){$=!0;let he=await this._pathService.userHome();if(H==="cmd.exe"&&(r.cwd&&O$(r.cwd)||!r.cwd&&O$(he.fsPath)))return;H==="powershell.exe"||H==="pwsh.exe"?T||V.push("-Command"):H==="bash.exe"||H==="zsh.exe"?($=!1,T||V.push("-c")):H==="wsl.exe"?T||V.push("-e"):H==="nu.exe"?T||V.push("-c"):T||V.push("/d","/c")}else T||(1,V.push("-c"));let J=this._addAllArgument(V,O);J.push(G),p.shellIntegrationNonce=xt();let ae={commandLine:G,nonce:p.shellIntegrationNonce};if(p.args=$?J.join(" "):J,e.command.presentation&&e.command.presentation.echo)if(g&&t){let he=S&&typeof S=="object"&&Object.hasOwn(S,"path")?jo(S.path):t.name;p.initialText=this.taskShellIntegrationStartSequence(S)+nE(d(14486,null,he,G),{excludeLeadingNewLine:!0})+this.getTaskShellIntegrationOutputSequence(ae)}else p.initialText=this.taskShellIntegrationStartSequence(S)+nE(d(14485,null,G),{excludeLeadingNewLine:!0})+this.getTaskShellIntegrationOutputSequence(ae);else p.initialText={text:this.taskShellIntegrationStartSequence(S)+this.getTaskShellIntegrationOutputSequence(ae),trailingNewLine:!1}}else{let y=e.command.runtime!==3?i3.value(s):void 0,w=h?y:await this._resolveVariable(o,await this._resolveVariable(o,"${"+a.ProcessVarName+"}"));if(p={name:f,type:v,icon:e.configurationProperties.icon?.id?q.fromId(e.configurationProperties.icon.id):void 0,color:e.configurationProperties.icon?.color||void 0,executable:w,args:l.map(k=>Fe(k)?k:k.value),waitOnExit:c},e.command.presentation&&e.command.presentation.echo){let k=T=>!T||T.length===0?"":Fe(T)?T:T.join(" ");g&&t?p.initialText=this.taskShellIntegrationStartSequence(S)+nE(d(14486,null,t.name,`${p.executable} ${k(p.args)}`),{excludeLeadingNewLine:!0})+this.getTaskShellIntegrationOutputSequence(void 0):p.initialText=this.taskShellIntegrationStartSequence(S)+nE(d(14484,null,`${p.executable} ${k(p.args)}`),{excludeLeadingNewLine:!0})+this.getTaskShellIntegrationOutputSequence(void 0)}else p.initialText={text:this.taskShellIntegrationStartSequence(S)+this.getTaskShellIntegrationOutputSequence(void 0),trailingNewLine:!1}}return S&&(p.cwd=S),r.env&&(p.env?p.env={...p.env,...r.env}:p.env=r.env),p.isFeatureTerminal=!0,p.useShellEnvironment=!0,p.tabActions=this._terminalTabActions,p}_addAllArgument(e,t){let o=Ji(t);return e.forEach(n=>{t.every((s,l)=>s.toLowerCase()===n&&t.length>l+1?!t.slice(l+1).every(c=>c.startsWith("-")):s.toLowerCase()!==n)&&o.push(n)}),o}async _reconnectToTerminal(e){return this._terminalService.instances.filter(o=>o.reconnectionProperties?.ownerId===Yct).find(o=>bRo(o)?.lastTask===e.getCommonTaskId())}async _doCreateTerminal(e,t,o){let n=await this._reconnectToTerminal(e),r=l=>{let c=l.onDisposed(()=>{this._fireTaskEvent(up.terminated(e,l.instanceId,l.exitReason)),c.dispose()})};if(n)return(Ld.is(e)||Th.is(e))&&e.command.presentation&&(n.waitOnExit=fRo(e.command.presentation,e.configurationProperties)),r(n),this._logService.trace("reconnected to task and terminal",e._id),n;if(t){for(let l of Object.values(this._terminals))if(l.group===t){this._logService.trace(`Found terminal to split for group ${t}`);let c=l.terminal,u=await this._terminalService.createTerminal({location:{parentTerminal:c},config:o});if(r(u),u)return u}this._logService.trace(`No terminal found to split for group ${t}`)}let s=await this._terminalService.createTerminal({config:o});return r(s),s}_reconnectToTerminals(){if(this._hasReconnected){this._logService.trace("Already reconnected to terminals, so returning");return}let e=this._terminalService.instances.filter(t=>t.reconnectionProperties?.ownerId===Yct);if(this._logService.trace(`Attempting reconnection of ${e.length} terminals`),!e.length)this._logService.trace("No terminals to reconnect to so returning");else for(let t of e){let o=bRo(t);if(o){let n={lastTask:o.lastTask,group:o.group,terminal:t,shellIntegrationNonce:o.shellIntegrationNonce};this._terminals[t.instanceId]=n;let r=t.onDisposed(()=>{this._deleteTaskAndTerminal(t,n),r.dispose()});this._logService.trace("Reconnecting to task terminal",n.lastTask,t.instanceId)}}this._hasReconnected=!0}_deleteTaskAndTerminal(e,t){delete this._terminals[e.instanceId],delete this._sameTaskTerminals[t.lastTask],this._idleTaskTerminals.delete(t.lastTask);let o=t.lastTask;this._removeFromActiveTasks(o),this._busyTasks[o]&&delete this._busyTasks[o]}async _createTerminal(e,t,o){let n=t.taskSystemInfo?t.taskSystemInfo.platform:om,r=await this._resolveOptions(t,e.command.options),s=e.command.presentation;if(!s)throw new Error("Task presentation options should not be undefined here.");let l=fRo(s,e.configurationProperties),c,u,p;if(e.command.runtime===3)this._currentTask.shellLaunchConfig=p={customPtyImplementation:(T,P,O)=>new ZJ(T,P,O,this._terminalService),waitOnExit:l,name:this._createTerminalName(e),initialText:e.command.presentation&&e.command.presentation.echo?nE(d(14483,null,e._label),{excludeLeadingNewLine:!0}):void 0,isFeatureTerminal:!0,icon:e.configurationProperties.icon?.id?q.fromId(e.configurationProperties.icon.id):void 0,color:e.configurationProperties.icon?.color||void 0};else{let T=await this._resolveCommandAndArgs(t,e.command);if(c=T.command,u=T.args,this._currentTask.shellLaunchConfig=p=await this._createShellLaunchConfig(e,o,t,n,r,c,u,l,s),p===void 0)return[void 0,new SL(bt.Error,d(14487,null),7)]}let h=s.panel===2,g=s.panel===1,f=s.group,v=e.getMapKey(),b;if(h){let T=this._sameTaskTerminals[v];T&&(b=this._terminals[T],delete this._sameTaskTerminals[v])}else if(g){let T=this._idleTaskTerminals.remove(v);if(!T)for(let P of this._idleTaskTerminals.keys()){let O=this._idleTaskTerminals.get(P);if(O&&this._terminals[O]&&this._terminals[O].group===f){T=this._idleTaskTerminals.remove(P);break}}T&&(b=this._terminals[T])}if(b){if(!p)throw new Error("Task shell launch configuration should not be undefined here.");return b.terminal.scrollToBottom(),e.configurationProperties.isBackground&&(p.reconnectionProperties={ownerId:Yct,data:{lastTask:e.getCommonTaskId(),group:f,label:e._label,id:e._id}}),b.shellIntegrationNonce&&Fe(p.initialText)&&p.shellIntegrationNonce&&(p.initialText=p.initialText.replace(p.shellIntegrationNonce,b.shellIntegrationNonce)),await b.terminal.reuseTerminal(p),e.command.presentation&&e.command.presentation.clear&&b.terminal.clearBuffer(),this._terminals[b.terminal.instanceId.toString()].lastTask=v,[b.terminal,void 0]}this._terminalCreationQueue=this._terminalCreationQueue.then(()=>this._doCreateTerminal(e,f,p));let S=await this._terminalCreationQueue;e.configurationProperties.isBackground&&(S.shellLaunchConfig.reconnectionProperties={ownerId:Yct,data:{lastTask:e.getCommonTaskId(),group:f,label:e._label,id:e._id}});let y=S.instanceId.toString(),w={terminal:S,lastTask:v,group:f,shellIntegrationNonce:S.shellLaunchConfig.shellIntegrationNonce},k=S.onDisposed(()=>{this._deleteTaskAndTerminal(S,w),k.dispose()});return this._terminals[y]=w,S.shellLaunchConfig.tabActions=this._terminalTabActions,[S,void 0]}_buildShellCommandLine(e,t,o,n,r,s){let l=P$(t).name.toLowerCase(),c=this._getQuotingOptions(l,o,e);function u(w){if(w.length>=2&&(w[0]===c.strong?c.strong:w[0]===c.weak?c.weak:void 0)===w[w.length-1])return!1;let k;for(let T=0;T<w.length;T++){let P=w[T];if(P===k)k=void 0;else{if(k!==void 0)continue;if(P===c.escape)T++;else if(P===c.strong||P===c.weak)k=P;else if(P===" ")return!0}}return!1}function p(w,k){if(k===2&&c.strong)return[c.strong+w+c.strong,!0];if(k===3&&c.weak)return[c.weak+w+c.weak,!0];if(k===1&&c.escape){if(Fe(c.escape))return[w.replace(/ /g,c.escape+" "),!0];{let T=[];for(let V of c.escape.charsToEscape)T.push(`\\${V}`);let P=new RegExp("["+T.join(",")+"]","g"),O=c.escape.escapeChar;return[w.replace(P,V=>O+V),!0]}}return[w,!1]}function h(w){return Fe(w)?u(w)?p(w,2):[w,!1]:p(w.value,w.quoting)}if((!s||s.length===0)&&Fe(n)&&(n===r||u(r)))return n;let g=[],f=!1,v=!1,b,S;[b,S]=h(n),g.push(b),f=S;for(let w of s)[b,S]=h(w),g.push(b),v=v||S;let y=g.join(" ");return e===3&&(l==="cmd"&&f&&v?y='"'+y+'"':(l==="powershell"||l==="pwsh")&&f&&(y="& "+y)),y}_getQuotingOptions(e,t,o){return t&&t.quoting?t.quoting:a._shellQuotes[e]||a._osShellQuotes[u_(o)]}_collectTaskVariables(e,t){if(t.command&&t.command.name&&this._collectCommandVariables(e,t.command,t),this._collectMatcherVariables(e,t.configurationProperties.problemMatchers),t.command.runtime===3&&(Ld.is(t)||Th.is(t))){let o;Ld.is(t)?o=t._source.config.element:(o=Ji(t.defines),delete o._key,delete o.type),this._collectDefinitionVariables(e,o)}}_collectDefinitionVariables(e,t){if(Fe(t))this._collectVariables(e,t);else if(Array.isArray(t))t.forEach(o=>this._collectDefinitionVariables(e,o));else if(xi(t))for(let o of Object.keys(t))this._collectDefinitionVariables(e,t[o])}_collectCommandVariables(e,t,o){if(t.runtime===3)return;if(t.name===void 0)throw new Error("Command name should never be undefined here.");if(this._collectVariables(e,t.name),t.args?.forEach(r=>this._collectVariables(e,r)),o._source.scope!==1&&e.add("${workspaceFolder}"),t.options){let r=t.options;r.cwd&&this._collectVariables(e,r.cwd);let s=r.env;s&&Object.keys(s).forEach(l=>{let c=s[l];Fe(c)&&this._collectVariables(e,c)}),r.shell&&(r.shell.executable&&this._collectVariables(e,r.shell.executable),r.shell.args?.forEach(l=>this._collectVariables(e,l)))}}_collectMatcherVariables(e,t){t==null||t.length===0||t.forEach(o=>{let n;if(Fe(o)?o[0]==="$"?n=qb.get(o.substring(1)):n=qb.get(o):n=o,n&&n.filePrefix)if(Fe(n.filePrefix))this._collectVariables(e,n.filePrefix);else for(let r of[...cc(n.filePrefix.include||[]),...cc(n.filePrefix.exclude||[])])this._collectVariables(e,r)})}_collectVariables(e,t){let o=Fe(t)?t:t.value,n=/\$\{(.*?)\}/g,r;do r=n.exec(o),r&&e.add(r[0]);while(r)}async _resolveCommandAndArgs(e,t){let o=t.args?t.args.slice():[];return o=await this._resolveVariables(e,o),{command:await this._resolveVariable(e,t.name),args:o}}async _resolveVariables(e,t){return Promise.all(t.map(o=>this._resolveVariable(e,o)))}async _resolveMatchers(e,t){if(t==null||t.length===0)return[];let o=[];for(let n of t){let r;if(Fe(n)?n[0]==="$"?r=qb.get(n.substring(1)):r=qb.get(n):r=n,!r){this._appendOutput(d(14491,null));continue}let s=e.taskSystemInfo,l=r.filePrefix!==void 0,c=s!==void 0&&s.uriProvider!==void 0;if(!l&&!c)o.push(r);else{let u=Ji(r);if(c&&s!==void 0&&(u.uriProvider=s.uriProvider),l){let p=u.filePrefix;Fe(p)?u.filePrefix=await this._resolveVariable(e,p):p!==void 0&&(p.include&&(p.include=Array.isArray(p.include)?await Promise.all(p.include.map(h=>this._resolveVariable(e,h))):await this._resolveVariable(e,p.include)),p.exclude&&(p.exclude=Array.isArray(p.exclude)?await Promise.all(p.exclude.map(h=>this._resolveVariable(e,h))):await this._resolveVariable(e,p.exclude)))}o.push(u)}}return o}async _resolveVariable(e,t){if(Fe(t))return e.resolve(t);if(t!==void 0)return{value:await e.resolve(t.value),quoting:t.quoting};throw new Error("Should never try to resolve undefined.")}async _resolveOptions(e,t){if(t==null){let n;try{n=await this._resolveVariable(e,"${workspaceFolder}")}catch{}return{cwd:n}}let o=Fe(t.cwd)?{cwd:await this._resolveVariable(e,t.cwd)}:{cwd:await this._resolveVariable(e,"${workspaceFolder}")};if(t.env){o.env=Object.create(null);for(let n of Object.keys(t.env)){let r=t.env[n];Fe(r)?o.env[n]=await this._resolveVariable(e,r):o.env[n]=String(r)}}return o}static{this.WellKnownCommands={ant:!0,cmake:!0,eslint:!0,gradle:!0,grunt:!0,gulp:!0,jake:!0,jenkins:!0,jshint:!0,make:!0,maven:!0,msbuild:!0,msc:!0,nmake:!0,npm:!0,rake:!0,tsc:!0,xbuild:!0}}getSanitizedCommand(e){let t=e.toLowerCase(),o=t.lastIndexOf(Qd);return o!==-1&&(t=t.substring(o+1)),a.WellKnownCommands[t]?t:"other"}async getTaskForTerminal(e){for(let o of Object.keys(this._activeTasks)){let n=this._activeTasks[o];if(n.terminal?.instanceId===e)return n.task}let t=this._terminals[e.toString()];if(t?.lastTask)return await this._taskLookup(t.lastTask)}_appendOutput(e){this._outputService.getChannel(this._outputChannelId)?.append(e)}};function fRo(a,i){return(a.close===void 0||a.close===!1)&&(a.reveal!==3||!i.isBackground||a.close===!1)?a.panel===3?vRo(d(14478,null)):a.showReuseMessage?vRo(d(14482,null)):!0:!a.close}function vRo(a){return i=>`${z6("D",i.toString())}${a}`}function bRo(a){return a.shellLaunchConfig.attachPersistentProcess?.reconnectionProperties?.data}var pHi="task.quickOpen.detail",dQt="task.quickOpen.skip";function mHi(a){return"uri"in a}var uHi=d(14463,null),cQt=Ae("tasks-list-configure",R.gear,d(14452,null)),SRo=Ae("tasks-remove",R.close,d(14457,null)),Jvn="runTaskStorageKey",Xv=class extends x{constructor(e,t,o,n,r,s,l){super();this._taskService=e;this._configurationService=t;this._quickInputService=o;this._notificationService=n;this._themeService=r;this._dialogService=s;this._storageService=l;this._sorter=this._taskService.createSorter()}_showDetail(){return!!this._configurationService.getValue(pHi)}_guessTaskLabel(e){if(e._label)return e._label;if(kf.is(e)){let t=e.configures.type,o=Ji(e.configures);return delete o._key,delete o.type,Object.keys(o).forEach(n=>t+=`: ${o[n]}`),t}return""}static getTaskLabelWithIcon(e,t){let o=t||e._label,n=e.configurationProperties.icon;return n?n.id?`$(${n.id}) ${o}`:`$(${R.tools.id}) ${o}`:`${o}`}static applyColorStyles(e,t,o){if(e.configurationProperties.icon?.color){let n=o.getColorTheme(),r=jTe(n);return t.iconClasses=[by(e.configurationProperties.icon.color)],r}}_createTaskEntry(e,t=[]){let o=[{iconClass:q.asClassName(cQt),tooltip:d(14451,null)},...t],n={label:Xv.getTaskLabelWithIcon(e,this._guessTaskLabel(e)),description:this._taskService.getTaskDescription(e),task:e,detail:this._showDetail()?e.configurationProperties.detail:void 0,buttons:o},r=Xv.applyColorStyles(e,n,this._themeService);return r&&this._register(r),n}_createEntriesForGroup(e,t,o,n=[]){e.push({type:"separator",label:o}),t.forEach(r=>{r.configurationProperties.hide||e.push(this._createTaskEntry(r,n))})}_createTypeEntries(e,t){e.push({type:"separator",label:d(14453,null)}),t.forEach(o=>{e.push({label:`$(folder) ${o}`,task:o,ariaLabel:d(14465,null,o)})}),e.push({label:uHi,task:uHi,alwaysShow:!0})}_handleFolderTaskResult(e){let t=[];return Array.from(e).forEach(([o,n])=>{if(n.set&&t.push(...n.set.tasks),n.configurations)for(let r in n.configurations.byIdentifier)t.push(n.configurations.byIdentifier[r])}),t}_dedupeConfiguredAndRecent(e,t){let o=[],n=Array(e.length).fill(!1);for(let s=0;s<t.length;s++){let l=t[s].getWorkspaceFolder()?.uri.toString(),c=t[s].getDefinition()?._key,u=t[s].type,p=t[s]._label,h=t[s].getKey(),g=e.findIndex(f=>l&&c&&f.getWorkspaceFolder()?.uri.toString()===l&&(f.getDefinition()?._key===c||f.type===u&&f._label===p)||h&&f.getKey()===h);g===-1?o.push(t[s]):(e[g]=t[s],n[g]=!0)}o=o.sort((s,l)=>this._sorter.compare(s,l));let r=[];for(let s=0;s<e.length;s++)(n[s]||kf.is(e[s]))&&r.push(e[s]);return{configuredTasks:o,recentTasks:r}}async getTopLevelEntries(e){if(this._topLevelEntries!==void 0)return{entries:this._topLevelEntries};let t=(await this._taskService.getSavedTasks("historical")).reverse(),o=this._handleFolderTaskResult(await this._taskService.getWorkspaceTasks()),n=this._taskService.taskTypes();this._topLevelEntries=[];let r=this._dedupeConfiguredAndRecent(t,o),s=r.configuredTasks;if(t=r.recentTasks,t.length>0){let l={iconClass:q.asClassName(SRo),tooltip:d(14456,null)};this._createEntriesForGroup(this._topLevelEntries,t,d(14455,null),[l])}return o.length>0&&s.length>0&&this._createEntriesForGroup(this._topLevelEntries,s,d(14450,null)),e&&o.length===0&&(this._topLevelEntries.push({type:"separator",label:d(14450,null)}),this._topLevelEntries.push(e)),n.length>0&&this._createTypeEntries(this._topLevelEntries,n),{entries:this._topLevelEntries,isSingleConfigured:o.length===1?o[0]:void 0}}async handleSettingOption(e){let{confirmed:t}=await this._dialogService.confirm({type:ft.Warning,message:d(14458,null,e),cancelButton:d(14459,null)});if(t)return await this._configurationService.updateValue(`${e}.autoDetect`,"on"),await new Promise(o=>setTimeout(()=>o(),100)),this.show(d(14464,null),void 0,e)}async show(e,t,o,n){let r=new N,s=r.add(this._quickInputService.createQuickPick({useSeparators:!0}));s.placeholder=e,s.matchOnDescription=!0,s.ignoreFocusOut=!1,r.add(s.onDidTriggerItemButton(async c=>{let u=c.item.task;if(c.button.iconClass===q.asClassName(SRo)){let p=u&&!Fe(u)?u.getKey():void 0;p&&this._taskService.removeRecentlyUsedTask(p);let h=s.items.indexOf(c.item);h>=0&&(s.items=[...s.items.slice(0,h),...s.items.slice(h+1)])}else if(c.button.iconClass===q.asClassName(cQt)){if(this._quickInputService.cancel(),Th.is(u))this._taskService.customize(u,void 0,!0);else if(Ld.is(u)||kf.is(u)){let p=!1;try{p=await this._taskService.openConfig(u)}catch{}p||this._taskService.customize(u,void 0,!0)}}})),n&&(s.value=n);let l=o;if(!l){let c=await this.getTopLevelEntries(t);if(c.isSingleConfigured&&this._configurationService.getValue(dQt))return r.dispose(),this._toTask(c.isSingleConfigured);let u=c.entries;l=await this._doPickerFirstLevel(s,u,r)}do if(Fe(l)){if(n){await this._doPickerFirstLevel(s,(await this.getTopLevelEntries(t)).entries,r),r.dispose();return}let c=await this.doPickerSecondLevel(s,r,l);if(c&&!c.settingType&&c.task===null)s.value="",l=await this._doPickerFirstLevel(s,(await this.getTopLevelEntries(t)).entries,r);else return c&&Fe(c.settingType)?(r.dispose(),this.handleSettingOption(c.settingType)):(r.dispose(),c?.task&&!Fe(c?.task)?this._toTask(c?.task):void 0)}else return l?(r.dispose(),this._toTask(l)):(r.dispose(),l);while(!0)}async _doPickerFirstLevel(e,t,o){return e.items=t,o.add(_8t(this._storageService,Jvn,e,!0)),(await new Promise(r=>{o.add(U.once(e.onDidAccept)(async()=>{r(e.selectedItems?e.selectedItems[0]:void 0)}))}))?.task}async doPickerSecondLevel(e,t,o,n){if(e.busy=!0,o===uHi){let s=(await this._taskService.tasks()).filter(l=>!l.configurationProperties.hide).sort((l,c)=>this._sorter.compare(l,c)).map(l=>this._createTaskEntry(l));s.push(...Xv.allSettingEntries(this._configurationService)),e.items=s}else e.value=n||"",e.items=await this._getEntriesForProvider(o);return await e.show(),e.busy=!1,await new Promise(s=>{t.add(U.once(e.onDidAccept)(async()=>{s(e.selectedItems?e.selectedItems[0]:void 0)}))})}static allSettingEntries(e){let t=[],o=Xv.getSettingEntry(e,"grunt");o&&t.push(o);let n=Xv.getSettingEntry(e,"gulp");n&&t.push(n);let r=Xv.getSettingEntry(e,"jake");return r&&t.push(r),t}static getSettingEntry(e,t){if(e.getValue(`${t}.autoDetect`)==="off")return{label:"$(gear) "+d(14460,null,t[0].toUpperCase()+t.slice(1),t),task:null,settingType:t,alwaysShow:!0}}async _getEntriesForProvider(e){let t=(await this._taskService.tasks({type:e})).sort((r,s)=>this._sorter.compare(r,s)),o=[];if(t.length>0){for(let r of t)r.configurationProperties.hide||o.push(this._createTaskEntry(r));o.push({type:"separator"},{label:d(14461,null),task:null,alwaysShow:!0})}else o=[{label:d(14462,null,e),task:null,alwaysShow:!0}];let n=Xv.getSettingEntry(this._configurationService,e);return n&&o.push(n),o}async _toTask(e){if(!kf.is(e))return e;let t=await this._taskService.tryResolveTask(e);return t||this._notificationService.error(d(14454,null,e.type)),t}};Xv=I([m(0,Og),m(1,B),m(2,Ue),m(3,Ne),m(4,Le),m(5,at),m(6,ce)],Xv);var uQt="task.quickOpen.history",hHi="task.problemMatchers.neverPrompt",ebn="task.quickOpen.showAll",tbn="Task",kbe;(e=>(e.ID="workbench.action.tasks.configureTaskRunner",e.TEXT=L(14286,"Configure Task")))(kbe||={});var pQt=class{constructor(i){this._outputChannel=i;this._onDidError=new E;this.onDidError=this._onDidError.event;this._validationStatus=new Oze}info(i){this._validationStatus.state=1,this._outputChannel.append(i+`
`)}warn(i){this._validationStatus.state=2,this._outputChannel.append(i+`
`)}error(i){this._validationStatus.state=3,this._outputChannel.append(i+`
`),this._onDidError.fire(i)}fatal(i){this._validationStatus.state=4,this._outputChannel.append(i+`
`),this._onDidError.fire(i)}get status(){return this._validationStatus}},K6=class a{constructor(){this._store=new Map}forEach(i){this._store.forEach(i)}static getKey(i){let e;if(Fe(i))e=i;else{let t=mHi(i)?i.uri:i.configuration;e=t?t.toString():""}return e}get(i){let e=a.getKey(i),t=this._store.get(e);return t||(t=[],this._store.set(e,t)),t}add(i,...e){let t=a.getKey(i),o=this._store.get(t);o||(o=[],this._store.set(t,o)),o.push(...e)}all(){let i=[];return this._store.forEach(e=>i.push(...e)),i}},$b=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,P,O,V,H,G,$,J,ae,he,oe,de,Ce,xe,ze,De,Oe,pt,et,Ti){super();this._configurationService=e;this._markerService=t;this._outputService=o;this._paneCompositeService=n;this._viewsService=r;this._commandService=s;this._editorService=l;this._fileService=c;this._contextService=u;this._telemetryService=p;this._textFileService=h;this._modelService=g;this._extensionService=f;this._quickInputService=v;this._configurationResolverService=b;this._terminalService=S;this._terminalGroupService=y;this._storageService=w;this._progressService=k;this._openerService=T;this._dialogService=P;this._notificationService=O;this._contextKeyService=V;this._environmentService=H;this._terminalProfileResolverService=G;this._pathService=$;this._textModelResolverService=J;this._preferencesService=ae;this._viewDescriptorService=he;this._workspaceTrustRequestService=oe;this._workspaceTrustManagementService=de;this._logService=Ce;this._themeService=xe;this._lifecycleService=ze;this._instantiationService=Oe;this._chatService=pt;this._chatAgentService=et;this._hostService=Ti;this._tasksReconnected=!1;this._taskSystemListeners=[];this._onDidRegisterSupportedExecutions=this._register(new E);this._onDidRegisterAllSupportedExecutions=this._register(new E);this._onDidChangeTaskSystemInfo=this._register(new E);this._willRestart=!1;this.onDidChangeTaskSystemInfo=this._onDidChangeTaskSystemInfo.event;this._onDidReconnectToTasks=this._register(new E);this.onDidReconnectToTasks=this._onDidReconnectToTasks.event;this._onDidChangeTaskConfig=this._register(new E);this.onDidChangeTaskConfig=this._onDidChangeTaskConfig.event;this._onDidChangeTaskProviders=this._register(new E);this.onDidChangeTaskProviders=this._onDidChangeTaskProviders.event;this._taskRunStartTimes=new Map;this._taskRunSources=new Map;this._activatedTaskProviders=new Set;this.toast=this._register(new me);this._whenTaskSystemReady=U.toPromise(this.onDidChangeTaskSystemInfo),this._workspaceTasksPromise=void 0,this._taskSystem=void 0,this._taskSystemListeners=void 0,this._outputChannel=this._outputService.getChannel($b.OutputChannelId),this._providers=new Map,this._providerTypes=new Map,this._taskSystemInfos=new Map,this._register(this._contextService.onDidChangeWorkspaceFolders(()=>{let Ht=this._computeWorkspaceFolderSetup();return this.executionEngine!==Ht[2]&&(this._disposeTaskSystemListeners(),this._taskSystem=void 0),this._updateSetup(Ht),this._updateWorkspaceTasks(2)})),this._register(this._configurationService.onDidChangeConfiguration(async Ht=>{if(!Ht.affectsConfiguration("tasks")||!this._taskSystem&&!this._workspaceTasksPromise)return;(!this._taskSystem||this._taskSystem instanceof _re)&&this._outputChannel.clear(),Ht.affectsConfiguration("task.reconnection")&&(this._configurationService.getValue("task.reconnection")||(this._persistentTasks?.clear(),this._storageService.remove($b.PersistentTasks_Key,1))),this._setTaskLRUCacheLimit();let zi=await this._updateWorkspaceTasks(3);this._onDidChangeTaskConfig.fire();for(let[Vo,sn]of zi)if(sn.set?.tasks?.length)for(let _n of sn.set.tasks){let mn=_n._id,hn=this._taskSystem?.lastTask?.task._id;if(hn&&hn===mn&&Vo!=="setting"){let yo=new zze(_n,this._taskSystem.lastTask.resolver,ybe.command);this._taskSystem.lastTask=yo}}})),this._taskRunningState=uDe.bindTo(V),this._tasksAvailableState=fDe.bindTo(V),this._onDidStateChange=this._register(new E),this._registerCommands().then(()=>YAt.bindTo(this._contextKeyService).set(!0)),XAt.bindTo(this._contextKeyService).set(Wt&&!De.getConnection()?.remoteAuthority),this._configurationResolverService.contributeVariable("defaultBuildTask",async()=>{let Ht=await this._getTasksForGroup(Jm.Build,!0);if(Ht.length>0){let _n=this._getDefaultTasks(Ht);if(_n.length===1)return _n[0]._label}Ht=await this._getTasksForGroup(Jm.Build);let zi=this._getDefaultTasks(Ht);if(zi.length===1)return zi[0]._label;zi.length&&(Ht=zi);let Vo;Ht&&Ht.length>0&&(Vo=await this._showQuickPick(Ht,d(14350,null)));let sn=Vo?Vo.task:void 0;if(sn)return sn._label}),this._register(this._lifecycleService.onBeforeShutdown(Ht=>{this._willRestart=Ht.reason!==3})),this._register(this.onDidStateChange(async Ht=>{switch(this._log(d(14306,null,Ht.kind),!0),Ht.kind){case"start":this._taskRunStartTimes.set(Ht.taskId,Date.now());break;case"processEnded":{let zi=Ht,Vo=this._taskRunStartTimes.get(Ht.taskId);if(!Vo)break;let sn=zi.durationMs??Date.now()-Vo;sn!==void 0&&this._handleLongRunningTaskCompletion(zi,sn),this._taskRunStartTimes.delete(Ht.taskId),this._taskRunSources.delete(Ht.taskId);break}case"inactive":{let zi=Ht,Vo=this._taskRunStartTimes.get(Ht.taskId);if(!Vo)break;let sn=zi.durationMs??Date.now()-Vo;sn!==void 0&&this._handleLongRunningTaskCompletion(zi,sn),this._taskRunStartTimes.delete(Ht.taskId),this._taskRunSources.delete(Ht.taskId);break}case"terminated":this._taskRunStartTimes.delete(Ht.taskId),this._taskRunSources.delete(Ht.taskId);break}if(Ht.kind!=="changed")if((this._willRestart||Ht.kind==="terminated"&&Ht.exitReason===3)&&Ht.taskId){let zi=Ht.__task.getKey();zi&&this.removePersistentTask(zi)}else Ht.kind==="start"&&Ht.__task&&Ht.__task.getWorkspaceFolder()&&this._setPersistentTask(Ht.__task)})),this._waitForAllSupportedExecutions=new Promise(Ht=>{U.once(this._onDidRegisterAllSupportedExecutions.event)(()=>Ht())}),this._terminalService.whenConnected.then(()=>{this._terminalService.instances.filter(zi=>zi.reconnectionProperties?.ownerId===tbn).length?this._attemptTaskReconnection():(this._tasksReconnected=!0,this._onDidReconnectToTasks.fire())}),this._upgrade()}static{this.RecentlyUsedTasks_Key="workbench.tasks.recentlyUsedTasks"}static{this.RecentlyUsedTasks_KeyV2="workbench.tasks.recentlyUsedTasks2"}static{this.PersistentTasks_Key="workbench.tasks.persistentTasks"}static{this.IgnoreTask010DonotShowAgain_key="workbench.tasks.ignoreTask010Shown"}static{this.OutputChannelId="tasks"}static{this.OutputChannelLabel=d(14308,null)}static{this._nextHandle=0}get isReconnected(){return this._tasksReconnected}registerSupportedExecutions(e,t,o){e!==void 0&&Qbi.bindTo(this._contextKeyService).set(e);let n=!!WR.getValue(this._contextKeyService);t!==void 0&&upe.bindTo(this._contextKeyService).set(t&&!n),o!==void 0&&gDe.bindTo(this._contextKeyService).set(o&&!n),this._workspaceTasksPromise=void 0,this._onDidRegisterSupportedExecutions.fire(),(XAt.getValue(this._contextKeyService)||e&&t&&o)&&this._onDidRegisterAllSupportedExecutions.fire()}_attemptTaskReconnection(){if(this._lifecycleService.startupKind!==3&&(this._log(d(14364,null),!0),this._tasksReconnected=!0,this._storageService.remove($b.PersistentTasks_Key,1)),!this._configurationService.getValue("task.reconnection")||this._tasksReconnected){this._log(d(14342,null,this._configurationService.getValue("task.reconnection"),this._tasksReconnected),!0),this._tasksReconnected=!0;return}this._log(d(14359,null),!0),this.getWorkspaceTasks(4).then(async()=>{this._tasksReconnected=await this._reconnectTasks(),this._log(d(14358,null),!0),this._onDidReconnectToTasks.fire()})}async _handleLongRunningTaskCompletion(e,t){let o=this._configurationService.getValue("task.notifyWindowOnTaskCompletion");if(o===-1||o>0&&t<o||this._taskRunSources.get(e.taskId)===5)return;let r=this._terminalService.instances.find(g=>g.instanceId===e.terminalId);if(!r)return;let s=r.title,l=Re(r.domElement);if(l.document.hasFocus())return;let c=this._formatTaskDuration(t),u=s?d(14302,null,s,c):d(14301,null,c);this._hostService.focus(l,{mode:1});let p=new Ye;this.toast.value=Z(()=>p.dispose(!0));let{clicked:h}=await this._hostService.showToast({title:u},p.token);this.toast.clear(),h&&this._hostService.focus(l,{mode:2})}_formatTaskDuration(e){let t=Math.max(1,Math.round(e/1e3)),o=Math.floor(t/60),n=t%60;return o>0?n>0?d(14304,null,o,n):d(14303,null,o):d(14305,null,n)}async _reconnectTasks(){let e=await this.getSavedTasks("persistent");if(!e.length)return this._log(d(14340,null),!0),!0;let t=e.map(o=>o._label).join(", ");this._log(d(14360,null,t),!0);for(let o of e)if(kf.is(o)){let n=await this.tryResolveTask(o);n&&this.run(n,void 0,4)}else this.run(o,void 0,4);return!0}get onDidStateChange(){return this._onDidStateChange.event}get supportsMultipleTaskExecutions(){return this.inTerminal()}async _registerCommands(){$e.registerCommand({id:"workbench.action.tasks.runTask",handler:async(e,t)=>{await this._trust()&&await this._runTaskCommand(t)},metadata:{description:"Run Task",args:[{name:"args",isOptional:!0,description:d(14292,null),schema:{anyOf:[{type:"string",description:d(14293,null)},{type:"object",properties:{type:{type:"string",description:d(14295,null)},task:{type:"string",description:d(14294,null)}}}]}}]}}),$e.registerCommand("workbench.action.tasks.reRunTask",async e=>{await this._trust()&&this._reRunTaskCommand()}),$e.registerCommand("workbench.action.tasks.restartTask",async(e,t)=>{await this._trust()&&this._runRestartTaskCommand(t)}),$e.registerCommand(QAt,async e=>{await this._trust()&&this._runRerunAllRunningTasksCommand()}),$e.registerCommand("workbench.action.tasks.terminate",async(e,t)=>{await this._trust()&&this._runTerminateCommand(t)}),$e.registerCommand("workbench.action.tasks.showLog",()=>{this._showOutput(void 0,!0)}),$e.registerCommand("workbench.action.tasks.build",async()=>{await this._trust()&&this._runBuildCommand()}),$e.registerCommand("workbench.action.tasks.test",async()=>{await this._trust()&&this._runTestCommand()}),$e.registerCommand("workbench.action.tasks.configureTaskRunner",async()=>{await this._trust()&&this._runConfigureTasks()}),$e.registerCommand("workbench.action.tasks.configureDefaultBuildTask",async()=>{await this._trust()&&this._runConfigureDefaultBuildTask()}),$e.registerCommand("workbench.action.tasks.configureDefaultTestTask",async()=>{await this._trust()&&this._runConfigureDefaultTestTask()}),$e.registerCommand("workbench.action.tasks.showTasks",async()=>{if(await this._trust())return this.runShowTasks()}),$e.registerCommand("workbench.action.tasks.toggleProblems",()=>this._commandService.executeCommand(Rr.TOGGLE_MARKERS_VIEW_ACTION_ID)),$e.registerCommand("workbench.action.tasks.openUserTasks",async()=>{let e=this._getResourceForKind(El.User);e&&this._openTaskFile(e,El.User)}),$e.registerCommand("workbench.action.tasks.openWorkspaceFileTasks",async()=>{let e=this._getResourceForKind(El.WorkspaceFile);e&&this._openTaskFile(e,El.WorkspaceFile)})}get workspaceFolders(){return this._workspaceFolders||this._updateSetup(),this._workspaceFolders}get ignoredWorkspaceFolders(){return this._ignoredWorkspaceFolders||this._updateSetup(),this._ignoredWorkspaceFolders}get executionEngine(){return this._executionEngine===void 0&&this._updateSetup(),this._executionEngine}get schemaVersion(){return this._schemaVersion===void 0&&this._updateSetup(),this._schemaVersion}get showIgnoreMessage(){return this._showIgnoreMessage===void 0&&(this._showIgnoreMessage=!this._storageService.getBoolean($b.IgnoreTask010DonotShowAgain_key,1,!1)),this._showIgnoreMessage}_getActivationEvents(e){let t=[];if(t.push("onCommand:workbench.action.tasks.runTask"),e)t.push(`onTaskType:${e}`);else for(let o of _k.all())t.push(`onTaskType:${o.taskType}`);return t}async _activateTaskProviders(e){await this._extensionService.whenInstalledExtensionsRegistered(),this._activatedTaskProviders.has(e??"all")||this._log("Activating task providers "+(e??"all")),await vp(Promise.all(this._getActivationEvents(e).map(n=>this._extensionService.activateByEvent(n))),5e3,()=>this._logService.warn("Timed out activating extensions for task providers"))&&this._activatedTaskProviders.add(e??"all")}_updateSetup(e){if(e||(e=this._computeWorkspaceFolderSetup()),this._workspaceFolders=e[0],this._ignoredWorkspaceFolders)if(this._ignoredWorkspaceFolders.length!==e[1].length)this._showIgnoreMessage=void 0;else{let t=new Set;this._ignoredWorkspaceFolders.forEach(o=>t.add(o.uri.toString()));for(let o of e[1])if(!t.has(o.uri.toString())){this._showIgnoreMessage=void 0;break}}this._ignoredWorkspaceFolders=e[1],this._executionEngine=e[2],this._schemaVersion=e[3],this._workspace=e[4]}_showOutput(e=1,t,o){if(!WR.getValue(this._contextKeyService)&&(e===1||e===3))if(t)this._outputService.showChannel(this._outputChannel.id,!0);else{let n=this._chatService.isEnabled("panel"),r=[];if(n&&o){let s=/^(.*?)\s*\{[\s\S]*$/,l=o.match(s);if(l&&l.length>1){let c=l[1],u=c===o?`\`${c}\``:`\`${c}\`
\`\`\`json${o}\`\`\``;this._chatAgentService.getDefaultAgent("panel")&&r.push({label:d(14390,null),run:async()=>{this._commandService.executeCommand(lx,{mode:"agent",query:`Fix this task configuration error: ${u}`})}})}}r.push({label:d(14300,null),run:()=>{this._outputService.showChannel(this._outputChannel.id,!0)}}),n&&r.length>1?this._notificationService.prompt(bt.Warning,d(14372,null),r):this._notificationService.prompt(bt.Warning,d(14371,null),r)}}_disposeTaskSystemListeners(){this._taskSystemListeners&&(Be(this._taskSystemListeners),this._taskSystemListeners=void 0)}registerTaskProvider(e,t){if(!e)return{dispose:()=>{}};let o=$b._nextHandle++;return this._providers.set(o,e),this._providerTypes.set(o,t),this._onDidChangeTaskProviders.fire(),{dispose:()=>{this._providers.delete(o),this._providerTypes.delete(o),this._onDidChangeTaskProviders.fire()}}}get hasTaskSystemInfo(){let e=Array.from(this._taskSystemInfos.values()).flat().length;return this._environmentService.remoteAuthority?e>1:e>0}registerTaskSystem(e,t){if(t.platform===0&&(e=this.workspaceFolders.length?this.workspaceFolders[0].uri.scheme:e),!this._taskSystemInfos.has(e))this._taskSystemInfos.set(e,[t]);else{let o=this._taskSystemInfos.get(e);t.platform===0?o.push(t):o.unshift(t)}this.hasTaskSystemInfo&&this._onDidChangeTaskSystemInfo.fire()}_getTaskSystemInfo(e){let t=this._taskSystemInfos.get(e);return t&&t.length?t[0]:void 0}extensionCallbackTaskComplete(e,t){return this._taskSystem?this._taskSystem.customExecutionComplete(e,t):Promise.resolve()}async _findWorkspaceTasks(e){let t=[],o=await this.getWorkspaceTasks();for(let[,n]of o){if(n.configurations)for(let r of Object.keys(n.configurations.byIdentifier)){let s=n.configurations.byIdentifier[r];e(s,n.workspaceFolder)&&t.push(s)}if(n.set)for(let r of n.set.tasks)e(r,n.workspaceFolder)&&t.push(r)}return t}async _findWorkspaceTasksInGroup(e,t){return this._findWorkspaceTasks(o=>{let n=o.configurationProperties.group;return n&&typeof n!="string"?n._id===e._id&&(!t||!!n.isDefault):!1})}async getTask(e,t,o=!1,n=void 0){if(!await this._trust())return;let r=Fe(e)?e:mHi(e)?e.name:e.configuration?He(e.configuration):void 0;if(this.ignoredWorkspaceFolders.some(h=>h.name===r))return Promise.reject(new Error(d(14309,null,r)));let s=Fe(t)?t:ZB.createTaskIdentifier(t,console);if(s===void 0)return Promise.resolve(void 0);let l=K6.getKey(e),c=await this._findWorkspaceTasks((h,g)=>{let f=K6.getKey(g);return f!==l&&f!==JB?!1:h.matches(s,o)});if(c.sort(h=>h._source.kind===El.Extension?1:-1),c.length>0){let h=c[0];return kf.is(h)?this.tryResolveTask(h):h}let u=await this._getGroupedTasks({type:n}),p=u.get(e);if(p=p.concat(u.get(JB)),!!p)return p=p.filter(h=>h.matches(s,o)).sort(h=>h._source.kind===El.Extension?1:-1),p.length>0?p[0]:void 0}async tryResolveTask(e){if(!await this._trust())return;await this._activateTaskProviders(e.type);let t,o=!1;for(let[r,s]of this._providers){let l=this._providerTypes.get(r);if(e.type===l){if(l&&!this._isTaskProviderEnabled(l)){o=!0;continue}t=s;break}}if(!t){o&&this._log(d(14357,null,e.configures.type));return}try{let r=await t.resolveTask(e);if(r&&r._id===e._id)return $ze(r,e)}catch{}let n=await this.tasks({type:e.type});for(let r of n)if(r._id===e._id)return $ze(r,e)}async tasks(e){return await this._trust()?this._versionAndEngineCompatible(e)?this._getGroupedTasks(e).then(t=>this.applyFilterToTaskMap(e,t)):Promise.resolve([]):[]}async getKnownTasks(e){return this._versionAndEngineCompatible(e)?this._getGroupedTasks(e,!0,!0).then(t=>this.applyFilterToTaskMap(e,t)):Promise.resolve([])}taskTypes(){let e=[];if(this._isProvideTasksEnabled())for(let t of _k.all())this._isTaskProviderEnabled(t.taskType)&&e.push(t.taskType);return e}createSorter(){return new KAt(this._contextService.getWorkspace()?this._contextService.getWorkspace().folders:[])}_isActive(){return this._taskSystem?this._taskSystem.isActive():Promise.resolve(!1)}async getActiveTasks(){return this._taskSystem?this._taskSystem.getActiveTasks():[]}async getBusyTasks(){return this._taskSystem?this._taskSystem.getBusyTasks():[]}getRecentlyUsedTasksV1(){if(this._recentlyUsedTasksV1)return this._recentlyUsedTasksV1;let e=this._configurationService.getValue(uQt);this._recentlyUsedTasksV1=new dl(e);let t=this._storageService.get($b.RecentlyUsedTasks_Key,1);if(t)try{let o=JSON.parse(t);if(Array.isArray(o))for(let n of o)this._recentlyUsedTasksV1.set(n,n)}catch{}return this._recentlyUsedTasksV1}applyFilterToTaskMap(e,t){if(!e||!e.type)return t.all();let o=[];return t.forEach(n=>{for(let r of n)if(Th.is(r)&&(r.defines.type===e.type||r._source.label===e.type))o.push(r);else if(Ld.is(r))if(r.type===e.type)o.push(r);else{let s=r.customizes();s&&s.type===e.type&&o.push(r)}}),o}_getTasksFromStorage(e){return e==="persistent"?this._getPersistentTasks():this._getRecentTasks()}_getRecentTasks(){if(this._recentlyUsedTasks)return this._recentlyUsedTasks;let e=this._configurationService.getValue(uQt);this._recentlyUsedTasks=new dl(e);let t=this._storageService.get($b.RecentlyUsedTasks_KeyV2,1);if(t)try{let o=JSON.parse(t);if(Array.isArray(o))for(let n of o)this._recentlyUsedTasks.set(n[0],n[1])}catch{}return this._recentlyUsedTasks}_getPersistentTasks(){if(this._persistentTasks)return this._log(d(14326,null,this._persistentTasks.size),!0),this._persistentTasks;this._persistentTasks=new dl(10);let e=this._storageService.get($b.PersistentTasks_Key,1);if(e)try{let t=JSON.parse(e);if(Array.isArray(t))for(let o of t)this._persistentTasks.set(o[0],o[1])}catch{}return this._persistentTasks}_getFolderFromTaskKey(e){let t=JSON.parse(e);return{folder:t.folder,isWorkspaceFile:t.id?.endsWith(El.WorkspaceFile)}}async getSavedTasks(e){let t=Object.create(null);this.workspaceFolders.forEach(p=>{t[p.uri.toString()]=p});let o=new Map,n=new Map,r=this._getTasksFromStorage(e),s=[];this._log(d(14321,null),!0);function l(p,h,g){h&&!p.has(h)&&p.set(h,[]),h&&(t[h]||h===JB)&&g&&p.get(h).push(g)}for(let p of r.entries())try{let h=p[0],g=JSON.parse(p[1]),f=this._getFolderFromTaskKey(h);this._log(d(14323,null,h,g,f.folder),!0),l(f.isWorkspaceFile?n:o,f.folder,g)}catch(h){this._log(d(14322,null,h),!0)}let c=new Map;async function u(p,h,g){for(let f of h.keys()){let v=[],b=Object.create(null),S=t[f]?g?1:0:2;await p._computeTasksForSingleConfig(t[f]??await p._getAFolder(),{version:"2.0.0",tasks:h.get(f)},0,v,b,S,!0),v.forEach(y=>{let w=y.getKey();w&&c.set(w,y)});for(let y of Object.keys(b)){let w=b[y].getKey();w&&c.set(w,b[y])}}}await u(this,o,!1),await u(this,n,!0);for(let p of r.keys())c.has(p)?(s.push(c.get(p)),this._log(d(14324,null,p),!0)):this._log(d(14325,null,p),!0);return s}removeRecentlyUsedTask(e){this._getTasksFromStorage("historical").delete(e)&&this._saveRecentlyUsedTasks()}removePersistentTask(e){this._log(d(14361,null,e),!0),this._getTasksFromStorage("persistent").delete(e)&&this._savePersistentTasks()}_setTaskLRUCacheLimit(){let e=this._configurationService.getValue(uQt);this._recentlyUsedTasks&&(this._recentlyUsedTasks.limit=e)}async _setRecentlyUsedTask(e){let t=e.getKey();if(!IT.is(e)&&t){let o=this._createCustomizableTask(e);if(Th.is(e)&&o){let n=[],r=Object.create(null);await this._computeTasksForSingleConfig(e._source.workspaceFolder??this.workspaceFolders[0],{version:"2.0.0",tasks:[o]},0,n,r,0,!0);for(let s of Object.keys(r))t=r[s].getKey()}this._getTasksFromStorage("historical").set(t,JSON.stringify(o)),this._saveRecentlyUsedTasks()}}_saveRecentlyUsedTasks(){if(!this._recentlyUsedTasks)return;let e=this._configurationService.getValue(uQt);if(e===0)return;let t=[...this._recentlyUsedTasks.keys()];t.length>e&&(t=t.slice(0,e));let o=[];for(let n of t)o.push([n,this._recentlyUsedTasks.get(n,0)]);this._storageService.store($b.RecentlyUsedTasks_KeyV2,JSON.stringify(o),1,1)}async _setPersistentTask(e){if(!this._configurationService.getValue("task.reconnection"))return;let t=e.getKey();if(!IT.is(e)&&t){let o=this._createCustomizableTask(e);if(Th.is(e)&&o){let n=[],r=Object.create(null);await this._computeTasksForSingleConfig(e._source.workspaceFolder??this.workspaceFolders[0],{version:"2.0.0",tasks:[o]},0,n,r,0,!0);for(let s of Object.keys(r))t=r[s].getKey()}if(!e.configurationProperties.isBackground)return;this._log(d(14363,null,t),!0),this._getTasksFromStorage("persistent").set(t,JSON.stringify(o)),this._savePersistentTasks()}}_savePersistentTasks(){this._persistentTasks=this._getTasksFromStorage("persistent");let e=[...this._persistentTasks.keys()],t=[];for(let o of e)t.push([o,this._persistentTasks.get(o,0)]);this._log(d(14298,null,e.join(", ")),!0),this._storageService.store($b.PersistentTasks_Key,JSON.stringify(t),1,1)}_openDocumentation(){this._openerService.open(A.parse("https://code.visualstudio.com/docs/editor/tasks#_defining-a-problem-matcher"))}async _findSingleWorkspaceTaskOfGroup(e){let t=await this._findWorkspaceTasksInGroup(e,!0);if(t.length===1&&typeof t[0].configurationProperties.group!="string"&&t[0].configurationProperties.group?.isDefault){let o;if(kf.is(t[0])?o=await this.tryResolveTask(t[0]):o=t[0],o)return this.run(o,void 0,1)}}async _build(){let e=await this._findSingleWorkspaceTaskOfGroup(Jm.Build);return e||this._getGroupedTasksAndExecute()}async _runTest(){let e=await this._findSingleWorkspaceTaskOfGroup(Jm.Test);return e||this._getGroupedTasksAndExecute(!0)}async _getGroupedTasksAndExecute(e){let t=await this._getGroupedTasks(),o=this._createRunnableTask(t,e?Jm.Test:Jm.Build);if(!o||!o.task)throw e?this.schemaVersion===1?new SL(bt.Info,d(14343,null),3):new SL(bt.Info,d(14344,null),3):this.schemaVersion===1?new SL(bt.Info,d(14331,null),2):new SL(bt.Info,d(14332,null),2);let n;try{n=await this._executeTask(o.task,o.resolver,1)}catch(r){return this._handleError(r),Promise.reject(r)}return n}async run(e,t,o=0){if(!await this._trust())return;if(!e)throw new SL(bt.Info,d(14310,null),5);let n=this._createResolver(),r;try{if(t&&t.attachProblemMatcher&&this._shouldAttachProblemMatcher(e)&&!IT.is(e)){let s=await this._attachProblemMatcher(e);s&&(r=await this._executeTask(s,n,o))}else r=await this._executeTask(e,n,o);return r}catch(s){return this._handleError(s),Promise.reject(s)}}_isProvideTasksEnabled(){return this._configurationService.getValue("task.autoDetect")==="on"}_isProblemMatcherPromptEnabled(e){let t=this._configurationService.getValue(hHi);return Wa(t)?!t:e===void 0?!0:!t[e]}_getTypeForTask(e){let t;return Ld.is(e)?t=e._source.config.element.type??"":t=e.getDefinition().type,t}_shouldAttachProblemMatcher(e){return this._isProblemMatcherPromptEnabled(this._getTypeForTask(e))===!1||!this._canCustomize(e)||e.configurationProperties.group!==void 0&&e.configurationProperties.group!==Jm.Build||e.configurationProperties.problemMatchers!==void 0&&e.configurationProperties.problemMatchers.length>0?!1:Th.is(e)?!e.hasDefinedMatchers&&!!e.configurationProperties.problemMatchers&&e.configurationProperties.problemMatchers.length===0:Ld.is(e)?e._source.config.element.problemMatcher===void 0&&!e.hasDefinedMatchers:!1}async _updateNeverProblemMatcherSetting(e){let t=this._configurationService.getValue(hHi);if(t===!0)return;let o;return t!==!1?o=t:o=Object.create(null),o[e]=!0,this._configurationService.updateValue(hHi,o)}async _attachProblemMatcher(e){let t=[];for(let r of qb.keys()){let s=qb.get(r);s.deprecated||(s.name===s.label?t.push({label:s.name,matcher:s}):t.push({label:s.label,description:`$${s.name}`,matcher:s}))}if(t.length===0)return;t=t.sort((r,s)=>r.label&&s.label?r.label.localeCompare(s.label):0),t.unshift({type:"separator",label:d(14311,null)});let o;Ld.is(e)?o=e._source.config.element.type??"":o=e.getDefinition().type,t.unshift({label:d(14312,null),matcher:void 0},{label:d(14314,null),matcher:void 0,never:!0},{label:d(14315,null,o),matcher:void 0,setting:o},{label:d(14313,null),matcher:void 0,learnMore:!0});let n=await this._quickInputService.pick(t,{placeHolder:d(14299,null)});if(!n)return e;if(n.learnMore){this._openDocumentation();return}if(n.never)return this.customize(e,{problemMatcher:[]},!0),e;if(n.matcher){let r=e.clone(),s=`$${n.matcher.name}`,l={problemMatcher:[s]};r.configurationProperties.problemMatchers=[s];let c=qb.get(n.matcher.name);return c&&c.watching!==void 0&&(l.isBackground=!0,r.configurationProperties.isBackground=!0),this.customize(e,l,!0),r}return n.setting&&await this._updateNeverProblemMatcherSetting(n.setting),e}async _getTasksForGroup(e,t){let o=await this._getGroupedTasks(void 0,t),n=[];return o.forEach(r=>{for(let s of r)Jm.from(s.configurationProperties.group)?._id===e._id&&n.push(s)}),n}needsFolderQualification(){return this._contextService.getWorkbenchState()===3}_canCustomize(e){return this.schemaVersion!==2?!1:Ld.is(e)?!0:Th.is(e)?!!e.getWorkspaceFolder():!1}async _formatTaskForJson(e,t){let o,n="";try{o=await this._textModelResolverService.createModelReference(e);let r=o.object.textEditorModel,{tabSize:s,insertSpaces:l}=r.getOptions(),c=r.getEOL(),u=s0(t,{eol:c,tabSize:s,insertSpaces:l}),p=new RegExp(c+(l?" ".repeat(s):"\\t"),"g");u=u.replace(p,c+(l?" ".repeat(s*3):"			"));let h=l?" ".repeat(s*2):"		";n=h+u.slice(0,u.length-1)+h+u.slice(u.length-1)}finally{o?.dispose()}return n}async _openEditorAtTask(e,t,o=-1){if(e===void 0)return Promise.resolve(!1);let r=(await this._fileService.readFile(e)).value;if(!r||!t)return!1;let s=r.toString(),l;if(o!==-1){let g=this._configurationService.getValue("tasks",{resource:e});g.tasks&&g.tasks.length>o&&(l=await this._formatTaskForJson(e,g.tasks[o]))}l||(typeof t=="string"?l=t:l=await this._formatTaskForJson(e,t));let c=s.indexOf(l),u=1;for(let g=0;g<c;g++)s.charAt(g)===`
`&&u++;let p=u;for(let g=0;g<l.length;g++)l.charAt(g)===`
`&&p++;let h=u>1?{startLineNumber:u,startColumn:u===p?4:3,endLineNumber:p,endColumn:u===p?void 0:4}:void 0;return await this._editorService.openEditor({resource:e,options:{pinned:!1,forceReload:!0,selection:h,selectionRevealType:1}}),!!h}_createCustomizableTask(e){let t,o=Ld.is(e)||kf.is(e)?e._source.config:void 0;if(o&&o.element)t={...o.element};else if(Th.is(e)){t={};let n=Object.assign(Object.create(null),e.defines);delete n._key,Object.keys(n).forEach(r=>t[r]=n[r]),e.configurationProperties.problemMatchers&&e.configurationProperties.problemMatchers.length>0&&HS(e.configurationProperties.problemMatchers)&&(t.problemMatcher=e.configurationProperties.problemMatchers),e.configurationProperties.group&&(t.group=xbe.to(e.configurationProperties.group))}if(t)return(t.problemMatcher===void 0&&e.configurationProperties.problemMatchers===void 0||e.configurationProperties.problemMatchers&&e.configurationProperties.problemMatchers.length===0)&&(t.problemMatcher=[]),e._source.label!=="Workspace"?t.label=e.configurationProperties.identifier:t.label=e._label,t.detail=e.configurationProperties.detail,t}async customize(e,t,o){if(!await this._trust())return;let n=e.getWorkspaceFolder();if(!n)return Promise.resolve(void 0);let r=this._getConfiguration(n,e._source.kind);if(r.hasParseErrors)return this._notificationService.warn(d(14287,null)),Promise.resolve(void 0);let s=r.config,l=this._createCustomizableTask(e);if(!l)return Promise.resolve(void 0);let c=Ld.is(e)?e._source.config.index:void 0;if(t)for(let u of Object.getOwnPropertyNames(t)){let p=t[u];p!=null&&(l[u]=p)}if(s)c===-1&&t?t.problemMatcher!==void 0?(s.problemMatcher=t.problemMatcher,await this._writeConfiguration(n,"tasks.problemMatchers",s.problemMatcher,e._source.kind)):t.group!==void 0&&(s.group=t.group,await this._writeConfiguration(n,"tasks.group",s.group,e._source.kind)):(Array.isArray(s.tasks)||(s.tasks=[]),c===void 0?s.tasks.push(l):s.tasks[c]=l,await this._writeConfiguration(n,"tasks.tasks",s.tasks,e._source.kind));else{let u={version:"2.0.0",tasks:[l]},p=["{",d(14373,null)].join(`
`)+JSON.stringify(u,null,"	").substr(1),h=this._configurationService.getValue();h.editor.insertSpaces&&(p=p.replace(/(\n)(\t+)/g,(g,f,v)=>f+" ".repeat(v.length*h.editor.tabSize))),await this._textFileService.create([{resource:n.toResource(".vscode/tasks.json"),value:p}])}o&&this._openEditorAtTask(this._getResourceForTask(e),l)}_writeConfiguration(e,t,o,n){let r;switch(n){case El.User:r=2;break;case El.WorkspaceFile:r=5;break;default:this._contextService.getWorkbenchState()===2?r=5:this._contextService.getWorkbenchState()===3&&(r=6)}if(r)return this._configurationService.updateValue(t,o,{resource:e.uri},r)}_getResourceForKind(e){switch(this._updateSetup(),e){case El.User:return Ge(ci(this._preferencesService.userSettingsResource),"tasks.json");case El.WorkspaceFile:if(this._workspace&&this._workspace.configuration)return this._workspace.configuration;default:return}}_getResourceForTask(e){if(Ld.is(e)){let t=this._getResourceForKind(e._source.kind);if(!t){let o=e.getWorkspaceFolder();o?t=o.toResource(e._source.config.file):t=this.workspaceFolders[0].uri}return t}else return e.getWorkspaceFolder().toResource(".vscode/tasks.json")}async openConfig(e){let t;return e?t=this._getResourceForTask(e):t=this._workspaceFolders&&this._workspaceFolders.length>0?this._workspaceFolders[0].toResource(".vscode/tasks.json"):void 0,this._openEditorAtTask(t,e?e._label:void 0,e?e._source.config.index:-1)}_createRunnableTask(e,t){let o=new Map,n=[],r=[];e.forEach((l,c)=>{let u=o.get(c);u||(u={id:new Map,label:new Map,identifier:new Map},o.set(c,u));for(let p of l)u.id.set(p._id,p),u.label.set(p._label,p),p.configurationProperties.identifier&&u.identifier.set(p.configurationProperties.identifier,p),t&&p.configurationProperties.group===t&&(p._source.kind===El.Workspace?n.push(p):r.push(p))});let s={resolve:async(l,c)=>{let u=o.get(typeof l=="string"?l:l.toString());if(u)return u.id.get(c)||u.label.get(c)||u.identifier.get(c)}};if(n.length>0)return n.length>1&&this._log(d(14290,null)),{task:n[0],resolver:s};if(r.length!==0){if(r.length===1)return{task:r[0],resolver:s};{let l=xt();return{task:new IT(l,{kind:El.InMemory,label:"inMemory"},l,"inMemory",{reevaluateOnRerun:!0},{identifier:l,dependsOn:r.map(u=>({uri:u.getWorkspaceFolder().uri,task:u._id})),name:l}),resolver:s}}}}_createResolver(e){let t;async function o(s,l,c){let u=await s._findWorkspaceTasks(h=>{let g=kf.is(h)||Ld.is(h)?h._source.config.workspaceFolder?.uri:void 0,f=typeof l=="string"?l:l.toString();if(g?.toString()!==f)return!1;if(Fe(c))return h._label===c||h.configurationProperties.identifier===c;{let v=h.getDefinition(!0),b=ZB.createTaskIdentifier(c,console);return b&&v?b._key===v._key:!1}});if(u.length===0)return;let p=u[0];return kf.is(p)?s.tryResolveTask(p):p}async function n(s){return t===void 0&&(t=new Map,(e||await s._getGroupedTasks()).forEach((l,c)=>{let u=t.get(c);u||(u={label:new Map,identifier:new Map,taskIdentifier:new Map},t.set(c,u));for(let p of l){u.label.set(p._label,p),p.configurationProperties.identifier&&u.identifier.set(p.configurationProperties.identifier,p);let h=p.getDefinition(!0);h!==void 0&&u.taskIdentifier.set(h._key,p)}})),t}async function r(s,l,c){let p=(await n(s)).get(typeof l=="string"?l:l.toString());if(p){if(Fe(c))return p.label.get(c)||p.identifier.get(c);{let h=ZB.createTaskIdentifier(c,console);return h!==void 0?p.taskIdentifier.get(h._key):void 0}}}return{resolve:async(s,l)=>{if(l)return t===void 0&&e===void 0?await o(this,s,l)??r(this,s,l):r(this,s,l)}}}async _saveBeforeRun(){let e;(s=>(s.Always="always",s.Never="never",s.Prompt="prompt"))(e||={});let t=this._configurationService.getValue("task.saveBeforeRun");if(t==="never")return!1;if(t==="prompt"&&this._editorService.editors.some(o=>o.isDirty())){let{confirmed:o}=await this._dialogService.confirm({message:d(14382,null),detail:d(14288,null),primaryButton:d(14297,null),cancelButton:d(14296,null)});if(!o)return!1}return await this._editorService.saveAll({reason:2}),!0}async _executeTask(e,t,o){let n=e;if(await this._saveBeforeRun()){await this._configurationService.reloadConfiguration(),await this._updateWorkspaceTasks();let s=e.getWorkspaceFolder(),l=e.configurationProperties.identifier,c=Ld.is(e)?e.customizes()?.type:Th.is(e)?e.type:void 0;n=(s&&l&&o===1?await this.getTask(s,l,!1,c):e)??e}await qb.onReady();let r=o===4?this._getTaskSystem().reconnect(n,t):this._getTaskSystem().run(n,t);return r?this._handleExecuteResult(r,o):{exitCode:0}}async _handleExecuteResult(e,t){if(t&&e.task._id&&this._taskRunSources.set(e.task._id,t),t===1&&await this._setRecentlyUsedTask(e.task),e.kind===2){let o=e.active;if(o&&o.same&&t===2||t===4)return this._logService.debug("Ignoring task that is already active",e.task),e.promise;if(o&&o.same)this._handleInstancePolicy(e.task,e.task.runOptions.instancePolicy);else throw new SL(bt.Warning,d(14376,null),1)}return this._setRecentlyUsedTask(e.task),e.promise}_handleInstancePolicy(e,t){switch(this._taskSystem?.isTaskVisible(e)||this._taskSystem?.revealTask(e),t){case"terminateNewest":this._restart(this._getTaskSystem().getLastInstance(e)??e);break;case"terminateOldest":this._restart(this._getTaskSystem().getFirstInstance(e)??e);break;case"silent":break;case"warn":this._notificationService.warn(d(14378,null));break;case"prompt":default:this._showQuickPick(this._taskSystem.getActiveTasks().filter(o=>e._id===o._id),d(14329,null),{label:d(14335,null),task:void 0},!1,!0,void 0).then(o=>{let n=o?o.task:void 0;n!=null&&this._restart(n)})}}async _restart(e){if(!this._taskSystem)return;if(await this.getActiveTasks().then(o=>o.some(n=>n.getMapKey()===e.getMapKey()))&&!(await this._taskSystem.terminate(e)).success){this._notificationService.warn(d(14381,null,Fe(e)?e:e.configurationProperties.name));return}try{let o=await this._findUpdatedTask(e);if(o)await this.run(o);else{let n=await this.run(e);(!n||typeof n.exitCode=="number"&&n.exitCode!==0)&&this._notificationService.warn(d(14383,null,e.configurationProperties.name))}}catch{}}async _findUpdatedTask(e){let t=await this._updateWorkspaceTasks(0);for(let[o,n]of t)if(!(!n.set?.tasks?.length&&!n.configurations?.byIdentifier)){if(n.set?.tasks){for(let r of n.set.tasks)if(r._id===e._id)return r}if(n.configurations?.byIdentifier){for(let[r,s]of Object.entries(n.configurations.byIdentifier))if(s._id===e._id)return this.tryResolveTask(s)}}if(Th.is(e)){let o=await this.tasks({type:e.type});for(let n of o)if(n._id===e._id)return n}}async terminate(e){return await this._trust()?this._taskSystem?this._taskSystem.terminate(e):{success:!0,task:void 0}:{success:!0,task:void 0}}_terminateAll(){return this._taskSystem?this._taskSystem.terminateAll():Promise.resolve([])}_createTerminalTaskSystem(){return new _re(this._terminalService,this._terminalGroupService,this._outputService,this._paneCompositeService,this._viewsService,this._markerService,this._modelService,this._configurationResolverService,this._contextService,this._environmentService,$b.OutputChannelId,this._fileService,this._terminalProfileResolverService,this._pathService,this._viewDescriptorService,this._logService,this._notificationService,this._contextKeyService,this._instantiationService,e=>{if(e)return this._getTaskSystemInfo(e.uri.scheme);if(this._taskSystemInfos.size>0){let t=Array.from(this._taskSystemInfos.entries()),o=t.filter(n=>n[0]!==Q.file);return o.length>0?o[0][1][0]:t[0][1][0]}else return},async e=>{let o=(await this._getGroupedTasks()).all();for(let n of o)if(n.getMapKey()===e)return n})}_isTaskProviderEnabled(e){let t=_k.get(e);return!t||!t.when||this._contextKeyService.contextMatchesRules(t.when)}async _getGroupedTasks(e,t,o){await this._waitForAllSupportedExecutions;let n=e?.type,r=this._needsRecentTasksMigration();t||await this._activateTaskProviders(e?.type);let s=Object.create(null);_k.all().forEach(p=>s[p.taskType]=!0),s.shell=!0,s.process=!0;let l=await new Promise(p=>{let h=[],g=0,f=b=>{b&&h.push(b),--g===0&&p(h)},v=b=>{try{ao(b)||(b&&Fe(b.message)?(this._log(`Error: ${b.message}
`),this._showOutput(void 0,void 0,b.message)):(this._log("Unknown error received while collecting tasks from providers."),this._showOutput()))}finally{--g===0&&p(h)}};if(this._isProvideTasksEnabled()&&this.schemaVersion===2&&this._providers.size>0){let b=!1;for(let[S,y]of this._providers){let w=this._providerTypes.get(S);if(n===void 0||n===w){if(w&&!this._isTaskProviderEnabled(w))continue;b=!0,g++,vp(y.provideTasks(s).then(k=>{for(let T of k.tasks)if(T.type!==this._providerTypes.get(S)){this._log(d(14391,null,this._providerTypes.get(S),T.type)),T.type!=="shell"&&T.type!=="process"&&this._showOutput();break}return f(k)},v),5e3,()=>{f(void 0)})}}b||p(h)}else p(h)}),c=new K6,u=new K6;for(let p of l)for(let h of p.tasks){let g=h.getWorkspaceFolder();g&&u.add(g,h)}try{let p=[];return(!o||this._workspaceTrustManagementService.isWorkspaceTrusted())&&(p=Array.from(await this.getWorkspaceTasks())),await Promise.all(this._getCustomTaskPromises(p,e,c,u,t)),r&&await this._migrateRecentTasks(c.all()),c}catch{let p=new K6;for(let h of l)for(let g of h.tasks){let f=g.getWorkspaceFolder();f&&p.add(f,g)}return p}}_getCustomTaskPromises(e,t,o,n,r){return e.map(async([s,l])=>{let c=n.get(s);if(!l.set){c&&o.add(s,...c);return}if(this._contextService.getWorkbenchState()===1)o.add(s,...l.set.tasks);else{let u=l.configurations,p=l.set?this._getLegacyTaskConfigurations(l.set):void 0,h=[];if(u||p){let g=new Set;u&&Object.keys(u.byIdentifier).forEach(b=>g.add(b));for(let b of c)if(Th.is(b))if(u){let S=u.byIdentifier[b.defines._key];S?(g.delete(b.defines._key),o.add(s,$ze(b,S))):o.add(s,b)}else if(p){let S=p[b.defines._key];S?(o.add(s,$ze(b,S)),h.push(S)):o.add(s,b)}else o.add(s,b);if(h.length>0){let b=h.reduce((S,y)=>(S[y._id]=!0,S),Object.create(null));for(let S of l.set.tasks)b[S._id]||o.add(s,S)}else o.add(s,...l.set.tasks);let v=Array.from(g).map(async b=>{let S=u.byIdentifier[b];if(t?.type&&t.type!==S.configures.type)return;let y=!1;for(let[w,k]of this._providers){let T=this._providerTypes.get(w);if(S.type===T){if(T&&!this._isTaskProviderEnabled(T)){y=!0;continue}try{let P=await k.resolveTask(S);if(P&&P._id===S._id){o.add(s,$ze(P,S));return}}catch{}}}y?this._log(d(14357,null,S.configures.type)):r||this._log(d(14333,null,S.configures.type,JSON.stringify(S._source.config.element,void 0,4)))});await Promise.all(v)}else o.add(s,...l.set.tasks),o.add(s,...c)}})}_getLegacyTaskConfigurations(e){let t;function o(){return t||(t=Object.create(null),t)}for(let n of e.tasks)if(Ld.is(n)){let r=n.command&&n.command.name;if(r==="gulp"||r==="grunt"||r==="jake"){let s=HYe.create({type:r,task:n.configurationProperties.name});o()[s._key]=n}}return t}async getWorkspaceTasks(e=1){return await this._trust()?(await vp(this._waitForAllSupportedExecutions,2e3,()=>{this._logService.warn("Timed out waiting for all supported executions")}),await this._whenTaskSystemReady,this._workspaceTasksPromise?this._workspaceTasksPromise:this._updateWorkspaceTasks(e)):new Map}getTaskProblems(e){return this._taskSystem?.getTaskProblems(e)}_updateWorkspaceTasks(e=1){return this._workspaceTasksPromise=this._computeWorkspaceTasks(e),this._workspaceTasksPromise}async _getAFolder(){let e=this.workspaceFolders.length>0?this.workspaceFolders[0]:void 0;if(!e){let t=await this._pathService.userHome();e=new nce({uri:t,name:He(t),index:0})}return e}getTerminalsForTasks(e){return this._taskSystem?.getTerminalsForTasks(e)}async _computeWorkspaceTasks(e=1){let t=[];for(let c of this.workspaceFolders)t.push(this._computeWorkspaceFolderTasks(c,e));let o=await Promise.all(t),n=new Map;for(let c of o)c&&n.set(c.workspaceFolder.uri.toString(),c);let r=await this._getAFolder();if(this._contextService.getWorkbenchState()!==1){let c=await this._computeWorkspaceFileTasks(r,e);c&&this._workspace&&this._workspace.configuration&&n.set(this._workspace.configuration.toString(),c)}let s=await this._computeUserTasks(r,e);s&&n.set(JB,s);let l=Array.from(n.values()).some(c=>c.set?.tasks&&c.set.tasks.length>0||c.configurations?.byIdentifier&&Object.keys(c.configurations.byIdentifier).length>0);return this._tasksAvailableState.set(l),n}get _jsonTasksSupported(){return upe.getValue(this._contextKeyService)===!0&&gDe.getValue(this._contextKeyService)===!0}async _computeWorkspaceFolderTasks(e,t=1){let o=this._executionEngine===1?await this._computeLegacyConfiguration(e):await this._computeConfiguration(e);if(!o||!o.config||o.hasErrors)return Promise.resolve({workspaceFolder:e,set:void 0,configurations:void 0,hasErrors:o?o.hasErrors:!1});await qb.onReady();let n=this._getTaskSystemInfo(e.uri.scheme),r=new pQt(this._outputChannel);this._register(r.onDidError(u=>this._showOutput(t,void 0,u)));let s=dHi(e,void 0,n?n.platform:om,o.config,r,0,this._contextKeyService),l=!1;if(!s.validationStatus.isOK()&&s.validationStatus.state!==1&&(l=!0),r.status.isFatal())return r.fatal(d(14377,null)),{workspaceFolder:e,set:void 0,configurations:void 0,hasErrors:l};let c;if(s.configured&&s.configured.length>0){c={byIdentifier:Object.create(null)};for(let u of s.configured)c.byIdentifier[u.configures._key]=u}return!this._jsonTasksSupported&&s.custom.length>0&&this._logService.warn("Custom workspace tasks are not supported."),{workspaceFolder:e,set:{tasks:this._jsonTasksSupported?s.custom:[]},configurations:c,hasErrors:l}}_testParseExternalConfig(e,t){if(!e)return{config:void 0,hasParseErrors:!1};let o=e.$parseErrors;if(o){let n=!1;for(let r of o)if(/tasks\.json$/.test(r)){n=!0;break}if(n)return this._log(d(14380,null,t)),this._showOutput(void 0,void 0,d(14380,null,t)),{config:e,hasParseErrors:!0}}return{config:e,hasParseErrors:!1}}_log(e,t){(!t||this._configurationService.getValue("task.verboseLogging"))&&this._outputChannel.append(e+`
`)}async _computeWorkspaceFileTasks(e,t=1){if(this._executionEngine===1)return this._emptyWorkspaceTaskResults(e);let o=this._getConfiguration(e,El.WorkspaceFile),n=this._testParseExternalConfig(o.config,d(14375,null)),r={byIdentifier:Object.create(null)},s=[];return await this._computeTasksForSingleConfig(e,n.config,t,s,r.byIdentifier,1),(n.config?qze.from(n.config):2)===1?(this._notificationService.warn(d(14386,null)),this._emptyWorkspaceTaskResults(e)):{workspaceFolder:e,set:{tasks:s},configurations:r,hasErrors:n.hasParseErrors}}async _computeUserTasks(e,t=1){if(this._executionEngine===1)return this._emptyWorkspaceTaskResults(e);let o=this._getConfiguration(e,El.User),n=this._testParseExternalConfig(o.config,d(14374,null)),r={byIdentifier:Object.create(null)},s=[];return await this._computeTasksForSingleConfig(e,n.config,t,s,r.byIdentifier,2),(n.config?qze.from(n.config):2)===1?(this._notificationService.warn(d(14385,null)),this._emptyWorkspaceTaskResults(e)):{workspaceFolder:e,set:{tasks:s},configurations:r,hasErrors:n.hasParseErrors}}_emptyWorkspaceTaskResults(e){return{workspaceFolder:e,set:void 0,configurations:void 0,hasErrors:!1}}async _computeTasksForSingleConfig(e,t,o,n,r,s,l=!1){if(t){if(!e)return this._logService.trace("TaskService.computeTasksForSingleConfig: no workspace folder for worskspace",this._workspace?.id),!1}else return!1;let c=this._getTaskSystemInfo(e.uri.scheme),u=new pQt(this._outputChannel),p=dHi(e,this._workspace,c?c.platform:om,t,u,s,this._contextKeyService,l),h=!1;if(!p.validationStatus.isOK()&&p.validationStatus.state!==1&&(this._showOutput(o),h=!0),u.status.isFatal())return u.fatal(d(14377,null)),h;if(p.configured&&p.configured.length>0)for(let g of p.configured)r[g.configures._key]=g;if(!this._jsonTasksSupported&&p.custom.length>0)this._logService.warn("Custom workspace tasks are not supported.");else for(let g of p.custom)n.push(g);return h}_computeConfiguration(e){let{config:t,hasParseErrors:o}=this._getConfiguration(e);return Promise.resolve({workspaceFolder:e,config:t,hasErrors:o})}_computeWorkspaceFolderSetup(){let e=[],t=[],o=2,n=2,r;if(this._contextService.getWorkbenchState()===2){let s=this._contextService.getWorkspace().folders[0];e.push(s),o=this._computeExecutionEngine(s),n=this._computeJsonSchemaVersion(s)}else if(this._contextService.getWorkbenchState()===3){r=this._contextService.getWorkspace();for(let s of this._contextService.getWorkspace().folders)n===this._computeJsonSchemaVersion(s)?e.push(s):(t.push(s),this._log(d(14328,null,s.uri.fsPath)))}return[e,t,o,n,r]}_computeExecutionEngine(e){let{config:t}=this._getConfiguration(e);return t?qze.from(t):dpe._default}_computeJsonSchemaVersion(e){let{config:t}=this._getConfiguration(e);return t?jct.from(t):2}_getConfiguration(e,t){let o;if(t!==El.User&&this._contextService.getWorkbenchState()===1)o=void 0;else{let r=this._configurationService.inspect("tasks",{resource:e.uri});switch(t){case El.User:{r.userValue!==r.workspaceFolderValue&&(o=Ji(r.userValue));break}case El.Workspace:o=Ji(r.workspaceFolderValue);break;case El.WorkspaceFile:{this._contextService.getWorkbenchState()===3&&r.workspaceFolderValue!==r.workspaceValue&&(o=Ji(r.workspaceValue));break}default:o=Ji(r.workspaceFolderValue)}}if(!o)return{config:void 0,hasParseErrors:!1};let n=o.$parseErrors;if(n){let r=!1;for(let s of n)if(/tasks\.json$/.test(s)){r=!0;break}if(r)return this._log(d(14379,null)),this._showOutput(void 0,void 0,d(14379,null)),{config:void 0,hasParseErrors:!0}}return{config:o,hasParseErrors:!1}}inTerminal(){return this._taskSystem?this._taskSystem instanceof _re:this._executionEngine===2}configureAction(){let e=this;return new class extends it{constructor(){super(kbe.ID,kbe.TEXT.value,void 0,!0,()=>(e._runConfigureTasks(),Promise.resolve(void 0)))}}}_handleError(e){let t=!0;if(e instanceof SL){let o=e,n=o.code===0||o.code===2||o.code===3,r=o.code===1;n||r?this._notificationService.prompt(o.severity,o.message,[{label:n?kbe.TEXT.value:d(14388,null),run:()=>{n?this._runConfigureTasks():this._runTerminateCommand()}}]):this._notificationService.notify({severity:o.severity,message:o.message})}else if(e instanceof Error){let o=e;this._notificationService.error(o.message),t=!1}else Fe(e)?this._notificationService.error(e):this._notificationService.error(d(14384,null));t&&this._showOutput(void 0,void 0,Fe(e)?e:void 0)}_showDetail(){return this._configurationService.getValue(pHi)}async _createTaskQuickPickEntries(e,t=!1,o=!1,n,r=!0){let s={};if(e==null||e.length===0)return[];let l=p=>{let h={label:p._label,description:this.getTaskDescription(p),task:p,detail:this._showDetail()?p.configurationProperties.detail:void 0};return s[p._id]?(s[p._id].length===1&&(s[p._id][0].label+=" (1)"),h.label=h.label+" ("+(s[p._id].length+1).toString()+")"):s[p._id]=[],s[p._id].push(h),h};function c(p,h,g){h.length&&p.push({type:"separator",label:g});for(let f of h){let v=l(f);v.buttons=[{iconClass:q.asClassName(cQt),tooltip:d(14285,null)}],n&&f===n.task?p.unshift(n):p.push(v)}}let u;if(t)if(u=[],e.length===1)u.push(l(e[0]));else{let p=await this.getSavedTasks("historical"),h=[],g=new Set,f=[],v=[],b=Object.create(null);e.forEach(y=>{let w=y.getCommonTaskId();w&&(b[w]=y)}),p.reverse().forEach(y=>{let w=y.getCommonTaskId();if(w){g.add(w);let k=b[w];k&&h.push(k)}});for(let y of e){let w=y.getCommonTaskId();(!w||!g.has(w))&&(y._source.kind===El.Workspace||y._source.kind===El.User?f.push(y):v.push(y))}let S=this.createSorter();r&&c(u,h,d(14291,null)),f=f.sort((y,w)=>S.compare(y,w)),c(u,f,d(14284,null)),v=v.sort((y,w)=>S.compare(y,w)),c(u,v,d(14289,null))}else{if(o){let p=this.createSorter();e=e.sort((h,g)=>p.compare(h,g))}u=e.map(p=>l(p))}return s={},u}async _showTwoLevelQuickPick(e,t,o,n){let r=this._instantiationService.createInstance(Xv);try{return await r.show(e,t,o,n)}finally{r.dispose()}}async _showQuickPick(e,t,o,n=!1,r=!1,s,l,c){let u=await e,p=await vp(this._createTaskQuickPickEntries(u,n,r,s),200,()=>{});if(p)return p.length===1&&this._configurationService.getValue(dQt)?p[0]:(p.length===0&&o?p.push(o):p.length>1&&l&&l.length>0&&(p.push({type:"separator",label:""}),p.push(l[0])),this._quickInputService.pick(p,{value:c,placeHolder:t,matchOnDescription:!0,onDidTriggerItemButton:h=>{let g=h.item.task;this._quickInputService.cancel(),Th.is(g)?this.customize(g,void 0,!0):Ld.is(g)&&this.openConfig(g)}}))}_needsRecentTasksMigration(){return this.getRecentlyUsedTasksV1().size>0&&this._getTasksFromStorage("historical").size===0}async _migrateRecentTasks(e){if(!this._needsRecentTasksMigration())return;let t=this.getRecentlyUsedTasksV1(),o=Object.create(null);e.forEach(r=>{let s=r.getKey();s&&(o[s]=r)});let n=[...t.keys()].reverse();for(let r in n){let s=o[r];s&&await this._setRecentlyUsedTask(s)}this._storageService.remove($b.RecentlyUsedTasks_Key,1)}_showIgnoredFoldersMessage(){return this.ignoredWorkspaceFolders.length===0||!this.showIgnoreMessage||this._notificationService.prompt(bt.Info,d(14327,null,this.ignoredWorkspaceFolders.map(e=>e.name).join(", ")),[{label:d(14337,null),isSecondary:!0,run:()=>{this._storageService.store($b.IgnoreTask010DonotShowAgain_key,!0,1,1),this._showIgnoreMessage=!1}}]),Promise.resolve(void 0)}async _trust(){let e=this._contextKeyService.getContext(Nn());return XAt.getValue(this._contextKeyService)&&!_h?.evaluate(e)?!1:(await this._workspaceTrustManagementService.workspaceTrustInitialized,this._workspaceTrustManagementService.isWorkspaceTrusted()?!0:await this._workspaceTrustRequestService.requestWorkspaceTrust({message:d(14362,null)})===!0)}async _runTaskCommand(e){if(!this._tasksReconnected)return;if(!e)return this._doRunTaskCommand();let t=typeof e=="string"?void 0:e.type,o=typeof e=="string"?e:e.task,n=await this._getGroupedTasks({type:t}),r=this._getTaskIdentifier(e),s=n.all(),l=this._createResolver(n),c=this._contextService.getWorkspace().folders.map(p=>p.uri);if(this._contextService.getWorkbenchState()===3&&c.push(this._contextService.getWorkspace().configuration),c.push(JB),r)for(let p of c){let h=await l.resolve(p,r);if(h){this.run(h);return}}if(!(o?s.find(p=>p.configurationProperties.identifier===o):void 0))return this._doRunTaskCommand(s,t,o);for(let p of c){let h=await l.resolve(p,o);if(h){await this.run(h,{attachProblemMatcher:!0},1);return}}}_tasksAndGroupedTasks(e){if(!this._versionAndEngineCompatible(e))return{tasks:Promise.resolve([]),grouped:Promise.resolve(new K6)};let t=this._getGroupedTasks(e);return{tasks:t.then(n=>{if(!e||!e.type)return n.all();let r=[];return n.forEach(s=>{for(let l of s)if(Th.is(l)&&l.defines.type===e.type)r.push(l);else if(Ld.is(l))if(l.type===e.type)r.push(l);else{let c=l.customizes();c&&c.type===e.type&&r.push(l)}}),r}),grouped:t}}_doRunTaskCommand(e,t,o){let n=s=>{s!==void 0&&(s===null?this._runConfigureTasks():this.run(s,{attachProblemMatcher:!0},1).then(void 0,l=>{}))},r=d(14353,null);this._showIgnoredFoldersMessage().then(()=>{if(this._configurationService.getValue(ebn)){let s;e||(s=this._tasksAndGroupedTasks()),this._showQuickPick(e||s.tasks,r,{label:"$(plus) "+d(14334,null),task:null},!0,void 0,void 0,void 0,o).then(l=>n(l?l.task:void 0))}else this._showTwoLevelQuickPick(r,{label:"$(plus) "+d(14334,null),task:null},t,o).then(n)})}async rerun(e){let t=await this._taskSystem?.getTaskForTerminal(e);t?this._restart(t):this._reRunTaskCommand(!0)}_reRunTaskCommand(e){qb.onReady().then(()=>this._editorService.saveAll({reason:2}).then(()=>{let t=this._getTaskSystem().rerun();return t?this._handleExecuteResult(t):(!e&&!this._taskRunningState.get()&&this._doRunTaskCommand(),Promise.resolve(void 0))}))}_getDefaultTasks(e,t=!1){let o=[];for(let n of e.filter(r=>!!r.configurationProperties.group))(t&&typeof n.configurationProperties.group.isDefault=="string"||!t&&n.configurationProperties.group.isDefault===!0)&&o.push(n);return o}_runTaskGroupCommand(e,t,o,n){if(this.schemaVersion===1){n();return}let r={location:10,title:t.fetching},s=(async()=>{async function l(v,b,S){S.run(v,b,1).then(void 0,y=>{})}let c=v=>{this._showIgnoredFoldersMessage().then(()=>{this._showQuickPick(v,t.select,{label:t.notFoundConfigure,task:null},!0).then(b=>{let S=b?b.task:void 0;if(S!==void 0){if(S===null){o.apply(this);return}l(S,{attachProblemMatcher:!0},this)}})})},u=[],{globGroupTasks:p,globTasksDetected:h}=await this._getGlobTasks(e._id);u=[...p],!h&&u.length===0&&(u=await this._findWorkspaceTasksInGroup(e,!0));let g=v=>this._getTasksForGroup(e).then(b=>{if(b.length>0){let S=this._getDefaultTasks(b,v);if(S.length===1){l(S[0],void 0,this);return}else S.length>0&&(b=S)}c(b)}),f=v=>{kf.is(v)?this.tryResolveTask(v).then(b=>{l(b,void 0,this)}):l(v,void 0,this)};return u.length===1?f(u[0]):h&&u.length>1?g(!0):(u.length||(u=await this._findWorkspaceTasksInGroup(e,!0)),u.length===1?f(u[0]):g(!1))})();this._progressService.withProgress(r,()=>s)}async _getGlobTasks(e){let t=!1,o=po.getOriginalUri(this._editorService.activeEditor);if(o){let n=this._contextService.getWorkspaceFolder(o);if(n){let r=this._getConfiguration(n)?.config?.tasks;if(r&&(t=r.filter(s=>s.group&&typeof s.group!="string"&&typeof s.group.isDefault=="string").length>0,t)){let s=n?.uri?Wd(n.uri,o)??o.path:o.path;return{globGroupTasks:await this._findWorkspaceTasks(c=>{let u=c.configurationProperties.group;return u&&typeof u!="string"&&typeof u.isDefault=="string"?u._id===e&&Ed(u.isDefault,s,{ignoreCase:!0}):(t=!1,!1)}),globTasksDetected:t}}}}return{globGroupTasks:[],globTasksDetected:t}}_runBuildCommand(){if(this._tasksReconnected)return this._runTaskGroupCommand(Jm.Build,{fetching:d(14319,null),select:d(14349,null),notFoundConfigure:d(14330,null)},this._runConfigureDefaultBuildTask,this._build)}_runTestCommand(){return this._runTaskGroupCommand(Jm.Test,{fetching:d(14320,null),select:d(14356,null),notFoundConfigure:d(14345,null)},this._runConfigureDefaultTestTask,this._runTest)}_runTerminateCommand(e){if(e==="terminateAll"){this._terminateAll();return}let t=o=>{this._showQuickPick(o||this.getActiveTasks(),d(14366,null),{label:d(14339,null),task:void 0},!1,!0,void 0,[{label:d(14368,null),id:"terminateAll",task:void 0}]).then(n=>{n&&n.id==="terminateAll"&&this._terminateAll();let r=n?n.task:void 0;r!=null&&this.terminate(r)})};if(this.inTerminal()){let o=this._getTaskIdentifier(e),n;o!==void 0?(n=this.getActiveTasks(),n.then(r=>{for(let s of r)if(s.matches(o)){this.terminate(s);return}t(n)})):t()}else this._isActive().then(o=>{o&&this._terminateAll().then(n=>{let r=n[0];r.success||(r.code&&r.code===3?this._notificationService.error(d(14389,null)):this._notificationService.error(d(14387,null)))})})}async _runRestartTaskCommand(e){let t=await this.getActiveTasks();if(t.length===1){this._restart(t[0]);return}if(this.inTerminal()){let o=this._getTaskIdentifier(e);if(o!==void 0){for(let r of t)if(r.matches(o)){this._restart(r);return}}let n=await this._showQuickPick(t,d(14365,null),{label:d(14341,null),task:null},!1,!0);n&&n.task&&this._restart(n.task)}else t.length>0&&this._restart(t[0])}async _runRerunAllRunningTasksCommand(){let e=await this.getActiveTasks();if(e.length===0){this._notificationService.info(d(14336,null));return}let t=e.map(o=>this._restart(o));await Promise.allSettled(t)}_getTaskIdentifier(e){let t;return Fe(e)?t=e:e&&Fe(e.type)&&(t=ZB.createTaskIdentifier(e,console)),t}_configHasTasks(e){return!!e&&!!e.tasks&&e.tasks.length>0}_openTaskFile(e,t){let o=!1;this._fileService.stat(e).then(n=>n,()=>{}).then(async n=>{let r=!!n,s=this._configurationService.inspect("tasks",{resource:e}),l,c;switch(t){case El.User:l=this._configHasTasks(s.userValue),c=2;break;case El.WorkspaceFile:l=this._configHasTasks(s.workspaceValue),c=5;break;default:l=this._configHasTasks(s.workspaceFolderValue),c=6}let u;if(!l){let p=await this._quickInputService.pick(lRo(),{placeHolder:d(14367,null)});if(!p)return Promise.resolve(void 0);u=p.content;let h=this._configurationService.getValue();h.editor.insertSpaces&&(u=u.replace(/(\n)(\t+)/g,(g,f,v)=>f+" ".repeat(v.length*h.editor.tabSize))),o=!0}if(!r&&u)return this._textFileService.create([{resource:e,value:u}]).then(p=>p[0].resource);if(r&&(l||u)){let p=n?.resource;return u&&p&&this._configurationService.updateValue("tasks",jr(u),{resource:p},c),p}}).then(n=>{n&&this._editorService.openEditor({resource:n,options:{pinned:o}})})}_isTaskEntry(e){let t=e;return t&&!!t.task}_isSettingEntry(e){let t=e;return t&&!!t.settingType}_configureTask(e){Th.is(e)?this.customize(e,void 0,!0):Ld.is(e)?this.openConfig(e):kf.is(e)}_handleSelection(e){if(e)if(this._isTaskEntry(e))this._configureTask(e.task);else if(this._isSettingEntry(e))this._instantiationService.createInstance(Xv).handleSettingOption(e.settingType);else if(e.folder&&this._contextService.getWorkbenchState()!==1)this._openTaskFile(e.folder.toResource(".vscode/tasks.json"),El.Workspace);else{let t=this._getResourceForKind(El.User);t&&this._openTaskFile(t,El.User)}}getTaskDescription(e){let t;if(e._source.kind===El.User)t=d(14307,null);else if(e._source.kind===El.WorkspaceFile)t=e.getWorkspaceFileName();else if(this.needsFolderQualification()){let o=e.getWorkspaceFolder();o&&(t=o.name)}return t}async _runConfigureTasks(){if(!await this._trust())return;let e;this.schemaVersion===2?e=this._getGroupedTasks():e=Promise.resolve(new K6);let t=this._contextService.getWorkspace().folders.map(p=>this._fileService.stat(p.toResource(".vscode/tasks.json")).then(h=>h,()=>{})),o=d(14316,null),n=d(14348,null),r=new Ye,s=r.token,l=Promise.all(t).then(p=>e.then(h=>{let g=[],f=0,v=h.all();if(v.length>0){v=v.sort((S,y)=>S._label.localeCompare(y._label));for(let S of v){let y={label:Xv.getTaskLabelWithIcon(S),task:S,description:this.getTaskDescription(S),detail:this._showDetail()?S.configurationProperties.detail:void 0};Xv.applyColorStyles(S,y,this._themeService),g.push(y),Th.is(S)||f++}}let b=f===0;if(b||h.get(JB).length===f){let S=p[0]!==void 0?n:o;g.length&&g.push({type:"separator"}),g.push({label:S,folder:this._contextService.getWorkspace().folders[0]})}return g.length===1&&!b&&r.cancel(),g}));if(!await Promise.race([new Promise(p=>{l.then(()=>p(!1))}),new Promise(p=>{let h=setTimeout(()=>{clearTimeout(h),p(!0)},200)})])&&(await l).length===1&&this._configurationService.getValue(dQt)){let p=(await l)[0];if(p.task){this._handleSelection(p);return}}let u=l.then(p=>(p.push(...Xv.allSettingEntries(this._configurationService)),p));this._quickInputService.pick(u,{placeHolder:d(14355,null)},s).then(async p=>{if(s.isCancellationRequested){let h=(await l)[0];h.task&&(p=h)}this._handleSelection(p)})}_runConfigureDefaultBuildTask(){this.schemaVersion===2?this.tasks().then((e=>{if(e.length===0){this._runConfigureTasks();return}let t=[],o,n;this._showIgnoredFoldersMessage().then(async()=>{let{globGroupTasks:r}=await this._getGlobTasks(Jm.Build._id),s=r;s?.length||(s=this._getDefaultTasks(e,!1));let l;if(s.length===1){let p=s[0].configurationProperties.group;p&&(typeof p=="string"&&Jm.Build._id,l=s[0])}for(let p of e)if(p===l){let h=d(14317,null,Xv.getTaskLabelWithIcon(p,p.getQualifiedLabel()));o=p,n={label:h,task:p,description:this.getTaskDescription(p),detail:this._showDetail()?p.configurationProperties.detail:void 0},Xv.applyColorStyles(p,n,this._themeService)}else{let h={label:Xv.getTaskLabelWithIcon(p),task:p,description:this.getTaskDescription(p),detail:this._showDetail()?p.configurationProperties.detail:void 0};Xv.applyColorStyles(p,h,this._themeService),t.push(h)}n&&t.unshift(n);let u=new Ye().token;this._quickInputService.pick(t,{placeHolder:d(14355,null)},u).then(async p=>{if(u.isCancellationRequested){let g=(await t)[0];g.task&&(p=g)}let h=p&&Object.hasOwn(p,"task")?p.task:void 0;h!=null&&(h===o&&Ld.is(h)&&this.openConfig(h),IT.is(h)||this.customize(h,{group:{kind:"build",isDefault:!0}},!0).then(()=>{o&&h!==o&&!IT.is(o)&&this.customize(o,{group:"build"},!1)}))}),this._quickInputService.pick(t,{placeHolder:d(14351,null)}).then(p=>{let h=p&&Object.hasOwn(p,"task")?p.task:void 0;h!=null&&(h===o&&Ld.is(h)&&this.openConfig(h),IT.is(h)||this.customize(h,{group:{kind:"build",isDefault:!0}},!0).then(()=>{o&&h!==o&&!IT.is(o)&&this.customize(o,{group:"build"},!1)}))})})})):this._runConfigureTasks()}_runConfigureDefaultTestTask(){this.schemaVersion===2?this.tasks().then((e=>{if(e.length===0){this._runConfigureTasks();return}let t,o;for(let n of e){let r=Jm.from(n.configurationProperties.group);if(r&&r.isDefault&&r._id===Jm.Test._id){t=n;break}}t&&(o={label:d(14318,null,t.getQualifiedLabel()),task:t,detail:this._showDetail()?t.configurationProperties.detail:void 0}),this._showIgnoredFoldersMessage().then(()=>{this._showQuickPick(e,d(14352,null),void 0,!0,!1,o).then(n=>{let r=n&&Object.hasOwn(n,"task")?n.task:void 0;r&&(r===t&&Ld.is(r)&&this.openConfig(r),IT.is(r)||this.customize(r,{group:{kind:"test",isDefault:!0}},!0).then(()=>{t&&r!==t&&!IT.is(t)&&this.customize(t,{group:"test"},!1)}))})})})):this._runConfigureTasks()}async runShowTasks(){let e=this.getActiveTasks(),t=await e,o;t.length===1?this._taskSystem.revealTask(t[0]):t.length&&t.every(n=>IT.is(n)?!1:(o||(o=n.command.presentation?.group),n.command.presentation?.group&&n.command.presentation.group===o))?this._taskSystem.revealTask(t[0]):this._showQuickPick(e,d(14354,null),{label:d(14338,null),task:null},!1,!0).then(n=>{let r=n?n.task:void 0;r!=null&&this._taskSystem.revealTask(r)})}async _createTasksDotOld(e){let t=e.toResource(".vscode/tasks.json");if(await this._fileService.exists(t)){let o=t.with({path:`${t.path}.old`});return await this._fileService.copy(t,o,!0),[o,t]}}_upgradeTask(e,t,o){if(!Ld.is(e))return;let n={label:e._label},r=new Set(["gulp","jake","grunt"]);Fe(e.command.name)&&r.has(e.command.name)?(n.type=e.command.name,n.task=e.command.args[0]):(e.command.runtime===1&&(n.type=t3.toString(1)),e.command.name&&!t&&!o.windows?.command&&!o.osx?.command&&!o.linux?.command?n.command=e.command.name:t&&(n.command=e._source.config.element.command),e.command.args&&(!Array.isArray(e.command.args)||e.command.args.length>0)&&(!o.windows?.args&&!o.osx?.args&&!o.linux?.args?n.args=e.command.args:n.args=e._source.config.element.args)),e.configurationProperties.presentation&&(n.presentation=e.configurationProperties.presentation),e.configurationProperties.isBackground&&(n.isBackground=e.configurationProperties.isBackground),e.configurationProperties.problemMatchers&&(n.problemMatcher=e._source.config.element.problemMatcher),e.configurationProperties.group&&(n.group=e.configurationProperties.group),e._source.config.element=n;let s=new Ld(e._id,e._source,e._label,e.type,e.command,e.hasDefinedMatchers,e.runOptions,e.configurationProperties),l=this._createCustomizableTask(s);if(l)return l}async _upgrade(){if(this.schemaVersion===2)return;if(!this._workspaceTrustManagementService.isWorkspaceTrusted()){this._register(U.once(this._workspaceTrustManagementService.onDidChangeTrust)(o=>{o&&this._upgrade()}));return}let e=await this._getGroupedTasks(),t=[];for(let o of this.workspaceFolders){let n=await this._createTasksDotOld(o);if(n&&t.push(n),!n)continue;let r=[],s=!!this._configurationService.getValue("tasks.suppressTaskName",{resource:o.uri}),l={windows:this._configurationService.getValue("tasks.windows",{resource:o.uri}),osx:this._configurationService.getValue("tasks.osx",{resource:o.uri}),linux:this._configurationService.getValue("tasks.linux",{resource:o.uri})};e.get(o).forEach(c=>{let u=this._upgradeTask(c,s,l);u&&r.push(u)}),this._taskSystem=void 0,this._workspaceTasksPromise=void 0,await this._writeConfiguration(o,"tasks.tasks",r),await this._writeConfiguration(o,"tasks.version","2.0.0"),this._configurationService.getValue("tasks.showOutput",{resource:o.uri})&&await this._configurationService.updateValue("tasks.showOutput",void 0,{resource:o.uri}),this._configurationService.getValue("tasks.isShellCommand",{resource:o.uri})&&await this._configurationService.updateValue("tasks.isShellCommand",void 0,{resource:o.uri}),this._configurationService.getValue("tasks.suppressTaskName",{resource:o.uri})&&await this._configurationService.updateValue("tasks.suppressTaskName",void 0,{resource:o.uri})}this._updateSetup(),this._notificationService.prompt(bt.Warning,t.length===1?d(14369,null):d(14370,null),[{label:t.length===1?d(14346,null):d(14347,null),run:async()=>{for(let o of t)await this._editorService.openEditor({original:{resource:o[0]},modified:{resource:o[1]}})}}])}};$b=I([m(0,B),m(1,oa),m(2,kl),m(3,us),m(4,$t),m(5,ge),m(6,ee),m(7,fe),m(8,Pe),m(9,Te),m(10,Uo),m(11,Tt),m(12,lt),m(13,Ue),m(14,Tp),m(15,nn),m(16,lc),m(17,ce),m(18,Fo),m(19,Je),m(20,at),m(21,Ne),m(22,X),m(23,At),m(24,Ag),m(25,An),m(26,Bt),m(27,Go),m(28,Bi),m(29,Vu),m(30,Nr),m(31,se),m(32,Le),m(33,ji),m(34,bo),m(35,F),m(36,mi),m(37,cr),m(38,Zt)],$b);var G6=class extends Lh{constructor(e,t,o,n,r,s,l,c){super(G6.PREFIX,{noResultsPick:{label:d(14466,null)}});this._taskService=t;this._configurationService=o;this._quickInputService=n;this._notificationService=r;this._dialogService=s;this._themeService=l;this._storageService=c}static{this.PREFIX="task "}async _getPicks(e,t,o){if(o.isCancellationRequested)return[];let n=new Xv(this._taskService,this._configurationService,this._quickInputService,this._notificationService,this._themeService,this._dialogService,this._storageService),r=await n.getTopLevelEntries(),s=[];for(let l of r.entries){let c=lm(e,l.label);if(!c)continue;l.type==="separator"&&s.push(l);let u=l.task,p=l;p.highlights={label:c},p.trigger=h=>{if(h===1&&p.buttons?.length===2){let g=u&&!Fe(u)?u.getKey():void 0;return g&&this._taskService.removeRecentlyUsedTask(g),2}else return Th.is(u)?this._taskService.customize(u,void 0,!0):Ld.is(u)&&this._taskService.openConfig(u),1},p.accept=async()=>{if(Fe(u)){let h=await n.show(d(14467,null),void 0,u);h&&this._taskService.run(h,{attachProblemMatcher:!0})}else this._taskService.run(await this._toTask(u),{attachProblemMatcher:!0})},s.push(p)}return s}async _toTask(e){return kf.is(e)?this._taskService.tryResolveTask(e):e}};G6=I([m(0,lt),m(1,Og),m(2,B),m(3,Ue),m(4,Ne),m(5,at),m(6,Le),m(7,ce)],G6);var vHi=ne.as(Qi.Workbench);vHi.registerWorkbenchContribution(Bze,4);W(Hze);ve.appendMenuItem(D.CommandPalette,{command:{id:Hze.ID,title:Hze.LABEL,category:rx},when:_h});var Jct=class extends x{constructor(e,t,o){super();this._taskService=e;this._statusbarService=t;this._progressService=o;this._activeTasksCount=0;this._registerListeners()}_registerListeners(){let e,t;this._register(this._taskService.onDidStateChange(o=>{if(o.kind==="changed"&&this._updateRunningTasksStatus(),!this._ignoreEventForUpdateRunningTasksCount(o))switch(o.kind){case"active":this._activeTasksCount++,this._activeTasksCount===1&&(e||({promise:e,resolve:t}=WI()));break;case"inactive":this._activeTasksCount>0&&(this._activeTasksCount--,this._activeTasksCount===0&&e&&t&&t());break;case"terminated":this._activeTasksCount!==0&&(this._activeTasksCount=0,e&&t&&t());break}e&&o.kind==="active"&&this._activeTasksCount===1&&this._progressService.withProgress({location:10,command:"workbench.action.tasks.showTasks"},n=>(n.report({message:d(14401,null)}),e)).then(()=>{e=void 0})}))}async _updateRunningTasksStatus(){let e=await this._taskService.getActiveTasks();if(e.length===0)this._runningTasksStatusItem&&(this._runningTasksStatusItem.dispose(),this._runningTasksStatusItem=void 0);else{let t={name:d(14419,null),text:`$(tools) ${e.length}`,ariaLabel:d(14411,null,e.length),tooltip:d(14415,null),command:"workbench.action.tasks.showTasks"};this._runningTasksStatusItem?this._runningTasksStatusItem.update(t):this._runningTasksStatusItem=this._statusbarService.addEntry(t,"status.runningTasks",0,{location:{id:"status.problems",priority:50},alignment:1})}}_ignoreEventForUpdateRunningTasksCount(e){return!this._taskService.inTerminal()||e.kind==="changed"?!1:(Fe(e.group)?e.group:e.group?._id)!==Jm.Build._id?!0:e.__task.configurationProperties.problemMatchers===void 0||e.__task.configurationProperties.problemMatchers.length===0}};Jct=I([m(0,Og),m(1,kr),m(2,Fo)],Jct);vHi.registerWorkbenchContribution(Jct,3);ve.appendMenuItem(D.MenubarTerminalMenu,{group:"3_run",command:{id:"workbench.action.tasks.runTask",title:d(14409,null)},order:1,when:_h});ve.appendMenuItem(D.MenubarTerminalMenu,{group:"3_run",command:{id:"workbench.action.tasks.build",title:d(14404,null)},order:2,when:_h});ve.appendMenuItem(D.MenubarTerminalMenu,{group:"5_manage",command:{precondition:uDe,id:"workbench.action.tasks.showTasks",title:d(14408,null)},order:1,when:_h});ve.appendMenuItem(D.MenubarTerminalMenu,{group:"5_manage",command:{precondition:uDe,id:"workbench.action.tasks.restartTask",title:d(14407,null)},order:2,when:_h});ve.appendMenuItem(D.MenubarTerminalMenu,{group:"5_manage",command:{precondition:uDe,id:"workbench.action.tasks.terminate",title:d(14410,null)},order:3,when:_h});ve.appendMenuItem(D.MenubarTerminalMenu,{group:"7_configure",command:{id:"workbench.action.tasks.configureTaskRunner",title:d(14406,null)},order:1,when:_h});ve.appendMenuItem(D.MenubarTerminalMenu,{group:"7_configure",command:{id:"workbench.action.tasks.configureDefaultBuildTask",title:d(14405,null)},order:2,when:_h});ve.appendMenuItem(D.CommandPalette,{command:{id:"workbench.action.tasks.openWorkspaceFileTasks",title:L(14448,"Open Workspace Tasks"),category:rx},when:C.and(za.isEqualTo("workspace"),_h)});ve.appendMenuItem(D.CommandPalette,{command:{id:kbe.ID,title:kbe.TEXT,category:rx},when:_h});ve.appendMenuItem(D.CommandPalette,{command:{id:"workbench.action.tasks.showLog",title:L(14417,"Show Task Log"),category:rx},when:_h});ve.appendMenuItem(D.CommandPalette,{command:{id:"workbench.action.tasks.runTask",title:L(14416,"Run Task"),category:rx}});ve.appendMenuItem(D.CommandPalette,{command:{id:"workbench.action.tasks.reRunTask",title:L(14413,"Rerun Last Task"),category:rx},when:_h});ve.appendMenuItem(D.CommandPalette,{command:{id:"workbench.action.tasks.restartTask",title:L(14414,"Restart Running Task"),category:rx},when:_h});ve.appendMenuItem(D.CommandPalette,{command:{id:QAt,title:L(14412,"Rerun All Running Tasks"),category:rx},when:_h});ve.appendMenuItem(D.CommandPalette,{command:{id:"workbench.action.tasks.showTasks",title:L(14418,"Show Running Tasks"),category:rx},when:_h});ve.appendMenuItem(D.CommandPalette,{command:{id:"workbench.action.tasks.terminate",title:L(14445,"Terminate Task"),category:rx},when:_h});ve.appendMenuItem(D.CommandPalette,{command:{id:"workbench.action.tasks.build",title:L(14400,"Run Build Task"),category:rx},when:_h});ve.appendMenuItem(D.CommandPalette,{command:{id:"workbench.action.tasks.test",title:L(14446,"Run Test Task"),category:rx},when:_h});ve.appendMenuItem(D.CommandPalette,{command:{id:"workbench.action.tasks.configureDefaultBuildTask",title:L(14402,"Configure Default Build Task"),category:rx},when:_h});ve.appendMenuItem(D.CommandPalette,{command:{id:"workbench.action.tasks.configureDefaultTestTask",title:L(14403,"Configure Default Test Task"),category:rx},when:_h});ve.appendMenuItem(D.CommandPalette,{command:{id:"workbench.action.tasks.openUserTasks",title:L(14447,"Open User Tasks"),category:rx},when:_h});var gHi=class extends x{constructor(){super(),this.registerActions()}registerActions(){let i="workbench.action.tasks.openUserTasks",e=d(14441,null);this._register(ve.appendMenuItem(D.GlobalActivity,{command:{id:i,title:e},when:_h,group:"2_configuration",order:6})),this._register(ve.appendMenuItem(D.MenubarPreferencesMenu,{command:{id:i,title:e},when:_h,group:"2_configuration",order:6}))}};vHi.registerWorkbenchContribution(gHi,3);Ct.registerKeybindingRule({id:"workbench.action.tasks.build",weight:200,when:YAt,primary:3104});var ibn=ne.as(Hv.OutputChannels);ibn.registerChannel({id:$b.OutputChannelId,label:$b.OutputChannelLabel,log:!1});var obn=ne.as(Ku.Quickaccess),nbn="inTasksPicker";obn.registerQuickAccessProvider({ctor:G6,prefix:G6.PREFIX,contextKey:nbn,placeholder:d(14444,null),helpEntries:[{description:d(14443,null),commandCenterOrder:60}]});var bHi={id:Ape,description:"Task definition file",type:"object",allowTrailingCommas:!0,allowComments:!0,default:{version:"2.0.0",tasks:[{label:"My Task",command:"echo hello",type:"shell",args:[],problemMatcher:["$tsc"],presentation:{reveal:"always"},group:"build"}]}};bHi.definitions={...jBi.definitions,...iHi.definitions};bHi.oneOf=[...iHi.oneOf||[],...jBi.oneOf||[]];var fHi=ne.as(ma.JSONContribution);fHi.registerSchema(Ape,bHi);var mQt=class extends x{static{this.ID="taskRegistryContribution"}constructor(){super(),this._register(qb.onMatcherChanged(()=>{tHi(),fHi.notifySchemaChanged(Ape)})),this._register(_k.onDefinitionsChanged(()=>{JBi(),fHi.notifySchemaChanged(Ape)}))}};It(mQt.ID,mQt,St.AfterRestored);var rbn=ne.as(Jt.Configuration);rbn.registerConfiguration({id:"task",order:100,title:d(14442,null),type:"object",properties:{"task.problemMatchers.neverPrompt":{markdownDescription:d(14425,null),oneOf:[{type:"boolean",markdownDescription:d(14427,null)},{type:"object",patternProperties:{".*":{type:"boolean"}},markdownDescription:d(14426,null),default:{shell:!0}}],default:!1},"task.autoDetect":{markdownDescription:d(14423,null),type:"string",enum:["on","off"],default:"on"},"task.slowProviderWarning":{markdownDescription:d(14437,null),oneOf:[{type:"boolean",markdownDescription:d(14439,null)},{type:"array",items:{type:"string",markdownDescription:d(14438,null)}}],default:!0},"task.quickOpen.history":{markdownDescription:d(14429,null),type:"number",default:30,minimum:0,maximum:30},"task.quickOpen.detail":{markdownDescription:d(14428,null),type:"boolean",default:!0},"task.quickOpen.skip":{type:"boolean",description:d(14431,null),default:!1},"task.quickOpen.showAll":{type:"boolean",description:d(14430,null),default:!1},"task.allowAutomaticTasks":{type:"string",enum:["on","off"],enumDescriptions:[d(14422,null),d(14421,null)],description:d(14420,null),default:"off",scope:1,restricted:!0},"task.reconnection":{type:"boolean",description:d(14432,null),default:!0},"task.saveBeforeRun":{markdownDescription:d(14433,null),type:"string",enum:["always","never","prompt"],enumDescriptions:[d(14434,null),d(14435,null),d(14436,null)],default:"always"},"task.notifyWindowOnTaskCompletion":{type:"integer",markdownDescription:d(14424,null),default:6e4,minimum:-1},"task.verboseLogging":{type:"boolean",description:d(14440,null),default:!1}}});W(class extends K{constructor(){super({id:jAt,icon:$At,title:L(14449,"Rerun Task"),precondition:UYe,menu:[{id:D.TerminalInstanceContext,when:UYe}],keybinding:{when:dt.focus,primary:3120,mac:{primary:1328},weight:200}})}async run(a,i){let e=a.get(nn),t=a.get(Og),o=i??e.activeInstance;o&&await t.rerun(o.instanceId)}});var abn=30*1e3;function IHi(a){switch(a){case 1:return"Management";case 2:return"ExtensionHost";case 3:return"Tunnel"}}function IRo(a){let i=new Ye;return setTimeout(()=>i.cancel(),a),i.token}function lbn(a,i){if(a.isCancellationRequested||i.isCancellationRequested)return Se.Cancelled;let e=new Ye;return a.onCancellationRequested(()=>e.cancel()),i.onCancellationRequested(()=>e.cancel()),e.token}var Yze=class{get didTimeout(){return this._state==="timedout"}constructor(i){this._state="pending",this._disposables=new N,{promise:this.promise,resolve:this._resolvePromise,reject:this._rejectPromise}=WI(),i.isCancellationRequested?this._timeout():this._disposables.add(i.onCancellationRequested(()=>this._timeout()))}registerDisposable(i){this._state==="pending"?this._disposables.add(i):i.dispose()}_timeout(){this._state==="pending"&&(this._disposables.dispose(),this._state="timedout",this._rejectPromise(this._createTimeoutError()))}_createTimeoutError(){let i=new Error("Time limit reached");return i.code="ETIMEDOUT",i.syscall="connect",i}resolve(i){this._state==="pending"&&(this._disposables.dispose(),this._state="resolved",this._resolvePromise(i))}reject(i){this._state==="pending"&&(this._disposables.dispose(),this._state="rejected",this._rejectPromise(i))}};function cbn(a,i){let e=new Yze(i);return e.registerDisposable(a.onControlMessage(t=>{let o=JSON.parse(t.toString()),n=_Ro(o);n?e.reject(n):e.resolve(o)})),e.promise}function dbn(a,i,e,t,o,n,r,s){let l=new Yze(s),c=Dn.create(!1);return a.info(`Creating a socket (${r})...`),Mo(`code/willCreateSocket/${n}`),i.connect(e,t,o,r).then(u=>{l.didTimeout?(Mo(`code/didCreateSocketError/${n}`),a.info(`Creating a socket (${r}) finished after ${c.elapsed()} ms, but this is too late and has timed out already.`),u?.dispose()):(Mo(`code/didCreateSocketOK/${n}`),a.info(`Creating a socket (${r}) was successful after ${c.elapsed()} ms.`),l.resolve(u))},u=>{Mo(`code/didCreateSocketError/${n}`),a.info(`Creating a socket (${r}) returned an error after ${c.elapsed()} ms.`),a.error(u),l.reject(u)}),l.promise}function SHi(a,i){let e=new Yze(i);return a.then(t=>{e.didTimeout||e.resolve(t)},t=>{e.didTimeout||e.reject(t)}),e.promise}async function ubn(a,i,e,t){let o=DRo(a,i);a.logService.trace(`${o} 1/6. invoking socketFactory.connect().`);let n;try{n=await dbn(a.logService,a.remoteSocketFactoryService,a.connectTo,RL.getServerRootPath(),`reconnectionToken=${a.reconnectionToken}&reconnection=${a.reconnectionProtocol?"true":"false"}`,IHi(i),`renderer-${IHi(i)}-${a.reconnectionToken}`,t)}catch(u){throw a.logService.error(`${o} socketFactory.connect() failed or timed out. Error:`),a.logService.error(u),u}a.logService.trace(`${o} 2/6. socketFactory.connect() was successful.`);let r,s;a.reconnectionProtocol?(a.reconnectionProtocol.beginAcceptReconnection(n,null),r=a.reconnectionProtocol,s=!1):(r=new XMt({socket:n}),s=!0),a.logService.trace(`${o} 3/6. sending AuthRequest control message.`);let l=await SHi(a.signService.createNewMessage(xt()),t),c={type:"auth",auth:a.connectionToken||"00000000000000000000",data:l.data};r.sendControl(qe.fromString(JSON.stringify(c)));try{let u=await cbn(r,lbn(t,IRo(1e4)));if(u.type!=="sign"||typeof u.data!="string"){let f=new Error("Unexpected handshake message");throw f.code="VSCODE_CONNECTION_ERROR",f}if(a.logService.trace(`${o} 4/6. received SignRequest control message.`),!await SHi(a.signService.validate(l,u.signedData),t)){let f=new Error("Refused to connect to unsupported server");throw f.code="VSCODE_CONNECTION_ERROR",f}let h=await SHi(a.signService.sign(u.data),t),g={type:"connectionType",commit:a.commit,signedData:h,desiredConnectionType:i};return e&&(g.args=e),a.logService.trace(`${o} 5/6. sending ConnectionTypeRequest control message.`),r.sendControl(qe.fromString(JSON.stringify(g))),{protocol:r,ownsProtocol:s}}catch(u){throw u&&u.code==="ETIMEDOUT"&&(a.logService.error(`${o} the handshake timed out. Error:`),a.logService.error(u)),u&&u.code==="VSCODE_CONNECTION_ERROR"&&(a.logService.error(`${o} received error control message when negotiating connection. Error:`),a.logService.error(u)),s&&THi(r),u}}async function yRo(a,i,e,t){let o=Date.now(),n=DRo(a,i),{protocol:r,ownsProtocol:s}=await ubn(a,i,e,t),l=new Yze(t);return l.registerDisposable(r.onControlMessage(c=>{let u=JSON.parse(c.toString()),p=_Ro(u);p?(a.logService.error(`${n} received error control message when negotiating connection. Error:`),a.logService.error(p),s&&THi(r),l.reject(p)):(a.reconnectionProtocol?.endAcceptReconnection(),a.logService.trace(`${n} 6/6. handshake finished, connection is up and running after ${fbn(o)}!`),l.resolve({protocol:r,firstMessage:u}))})),l.promise}async function wRo(a,i){let{protocol:e}=await yRo(a,1,void 0,i);return{protocol:e}}async function CRo(a,i,e){let{protocol:t,firstMessage:o}=await yRo(a,2,i,e),n=o&&o.debugPort;return{protocol:t,debugPort:n}}async function xRo(a,i,e){let{connectTo:t,connectionToken:o}=await a.addressProvider.getAddress();return{commit:a.commit,quality:a.quality,connectTo:t,connectionToken:o,reconnectionToken:i,reconnectionProtocol:e,remoteSocketFactoryService:a.remoteSocketFactoryService,signService:a.signService,logService:a.logService}}async function kRo(a,i,e){return TRo(a,async t=>{let{protocol:o}=await wRo(t,Se.None);return new kHi(a,i,e,t.reconnectionToken,o)})}async function ERo(a,i){return TRo(a,async e=>{let{protocol:t,debugPort:o}=await CRo(e,i,Se.None);return new EHi(a,i,e.reconnectionToken,t,o)})}async function TRo(a,i){for(let t=1;;t++)try{let o=xt(),n=await xRo(a,o,null);return await i(n)}catch(o){if(t<5)a.logService.error(`[remote-connection][attempt ${t}] An error occurred in initial connection! Will retry... Error:`),a.logService.error(o);else throw a.logService.error(`[remote-connection][attempt ${t}]  An error occurred in initial connection! It will be treated as a permanent error. Error:`),a.logService.error(o),Dre.triggerPermanentFailure(0,0,Ew.isHandled(o)),o}}function pbn(a){return Ln(i=>new Promise((e,t)=>{let o=setTimeout(e,a*1e3);i.onCancellationRequested(()=>{clearTimeout(o),e()})}))}var yHi=class{constructor(i,e){this.reconnectionToken=i;this.millisSinceLastIncomingData=e;this.type=0}},wHi=class{constructor(i,e,t,o){this.reconnectionToken=i;this.millisSinceLastIncomingData=e;this.durationSeconds=t;this.cancellableTimer=o;this.type=1}skipWait(){this.cancellableTimer.cancel()}},CHi=class{constructor(i,e,t){this.reconnectionToken=i;this.millisSinceLastIncomingData=e;this.attempt=t;this.type=2}},hQt=class{constructor(i,e,t){this.reconnectionToken=i;this.millisSinceLastIncomingData=e;this.attempt=t;this.type=4}},xHi=class{constructor(i,e,t,o){this.reconnectionToken=i;this.millisSinceLastIncomingData=e;this.attempt=t;this.handled=o;this.type=3}},Dre=class a extends x{constructor(e,t,o,n,r){super();this._connectionType=e;this._options=t;this.reconnectionToken=o;this.protocol=n;this._reconnectionFailureIsFatal=r;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 hQt(this.reconnectionToken,0,0)),this._register(n.onSocketClose(s=>{let l=Zct(this._connectionType,this.reconnectionToken,!0);s?s.type===0?(this._options.logService.info(`${l} received socket close event (hadError: ${s.hadError}).`),s.error&&this._options.logService.error(s.error)):(this._options.logService.info(`${l} received socket close event (wasClean: ${s.wasClean}, code: ${s.code}, reason: ${s.reason}).`),s.event&&this._options.logService.error(s.event)):this._options.logService.info(`${l} received socket close event.`),this._beginReconnecting()})),this._register(n.onSocketTimeout(s=>{let l=Zct(this._connectionType,this.reconnectionToken,!0);this._options.logService.info(`${l} received socket timeout event (unacknowledgedMsgCount: ${s.unacknowledgedMsgCount}, timeSinceOldestUnacknowledgedMsg: ${s.timeSinceOldestUnacknowledgedMsg}, timeSinceLastReceivedSomeData: ${s.timeSinceLastReceivedSomeData}).`),this._beginReconnecting()})),a._instances.push(this),this._register(Z(()=>{let s=a._instances.indexOf(this);s>=0&&a._instances.splice(s,1)})),this._isPermanentFailure&&this._gotoPermanentFailure(a._permanentFailureMillisSinceLastIncomingData,a._permanentFailureAttempt,a._permanentFailureHandled)}static triggerPermanentFailure(e,t,o){this._permanentFailure=!0,this._permanentFailureMillisSinceLastIncomingData=e,this._permanentFailureAttempt=t,this._permanentFailureHandled=o,this._instances.forEach(n=>n._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||a._permanentFailure}updateGraceTime(e){let t=mbn(e,108e5),o=Zct(this._connectionType,this.reconnectionToken,!1);this._options.logService.trace(`${o} Applying reconnection grace time: ${t}ms (${Math.floor(t/1e3)}s)`),this._reconnectionGraceTime=t}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=Zct(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 yHi(this.reconnectionToken,this.protocol.getMillisSinceLastIncomingData()));let t=[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 n=Date.now(),r=-1;do{r++;let s=r<t.length?t[r]:t[t.length-1];try{if(s>0){let c=pbn(s);this._onDidStateChange.fire(new wHi(this.reconnectionToken,this.protocol.getMillisSinceLastIncomingData(),s,c)),this._options.logService.info(`${e} waiting for ${s} seconds before reconnecting...`);try{await c}catch{}}if(this._isPermanentFailure){this._options.logService.error(`${e} permanent failure occurred while running the reconnecting loop.`);break}this._onDidStateChange.fire(new CHi(this.reconnectionToken,this.protocol.getMillisSinceLastIncomingData(),r+1)),this._options.logService.info(`${e} resolving connection...`);let l=await xRo(this._options,this.reconnectionToken,this.protocol);this._options.logService.info(`${e} connecting to ${l.connectTo}...`),await this._reconnect(l,IRo(abn)),this._options.logService.info(`${e} reconnected!`),this._onDidStateChange.fire(new hQt(this.reconnectionToken,this.protocol.getMillisSinceLastIncomingData(),r+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(),r+1,!1);break}if(Date.now()-n>=o){let c=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 (${c}s) has expired! Will give up now! Error:`),this._options.logService.error(l),this._onReconnectionPermanentFailure(this.protocol.getMillisSinceLastIncomingData(),r+1,!1);break}if(Ew.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(ao(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 Ew){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(),r+1,Ew.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(),r+1,!1);break}}while(!this._isPermanentFailure&&!this._isDisposed)}_onReconnectionPermanentFailure(e,t,o){this._reconnectionFailureIsFatal?a.triggerPermanentFailure(e,t,o):this._gotoPermanentFailure(e,t,o)}_gotoPermanentFailure(e,t,o){this._onDidStateChange.fire(new xHi(this.reconnectionToken,e,t,o)),THi(this.protocol)}_pauseSocketWriting(){this.protocol.pauseSocketWriting()}},kHi=class extends Dre{constructor(i,e,t,o,n){super(1,i,o,n,!0),this.client=this._register(new YMt(n,{remoteAuthority:e,clientId:t},i.ipcLogger))}async _reconnect(i,e){await wRo(i,e)}},EHi=class extends Dre{constructor(i,e,t,o,n){super(2,i,t,o,!1),this._startArguments=e,this.debugPort=n}async _reconnect(i,e){await CRo(i,this._startArguments,e)}};function THi(a){try{a.acceptDisconnect();let i=a.getSocket();a.dispose(),i.dispose()}catch(i){mt(i)}}function _Ro(a){if(a&&a.type==="error"){let i=new Error(`Connection error: ${a.reason}`);return i.code="VSCODE_CONNECTION_ERROR",i}return null}function mbn(a,i){return typeof a!="number"||!isFinite(a)||a<0?i:a>Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:Math.floor(a)}function hbn(a,i){for(;a.length<i;)a+=" ";return a}function gbn(a,i){return`[remote-connection][${hbn(IHi(a),13)}][${i.substr(0,5)}\u2026]`}function Zct(a,i,e){return`${gbn(a,i)}[${e?"reconnect":"initial"}]`}function DRo(a,i){return`${Zct(i,a.reconnectionToken,!!a.reconnectionProtocol)}[${a.connectTo}]`}function fbn(a){return`${Date.now()-a} ms`}var gQt=class{constructor(i){this.service=i}listen(i,e,t){throw new Error("Invalid listen")}call(i,e,t){if(e==="download")return this.service.download(A.revive(t[0]),A.revive(t[1]),t[2]??"downloadIpc");throw new Error("Invalid call")}};var fQt=class extends Ggt{constructor(e,t,o,n,r){super(t,o,n);this.windowId=e;this.channel=r;this._register(r.listen("onDidChangeLogLevel",e)(s=>{o7(s)?super.setLogLevel(s):super.setLogLevel(A.revive(s[0]),s[1])})),this._register(r.listen("onDidChangeVisibility",e)(([s,l])=>super.setVisibility(A.revive(s),l))),this._register(r.listen("onDidChangeLoggers",e)(({added:s,removed:l})=>{for(let c of s)super.registerLogger({...c,resource:A.revive(c.resource)});for(let c of l)super.deregisterLogger(c.resource)}))}createConsoleMainLogger(){return new $$e({log:(e,t)=>{this.channel.call("consoleLog",[e,t])}})}registerLogger(e){super.registerLogger(e),this.channel.call("registerLogger",[e,this.windowId])}deregisterLogger(e){let t=this.toResource(e);super.deregisterLogger(t),this.channel.call("deregisterLogger",[t,this.windowId])}setLogLevel(e,t){super.setLogLevel(e,t),this.channel.call("setLogLevel",[e,t])}setVisibility(e,t){super.setVisibility(e,t),this.channel.call("setVisibility",[this.toResource(e),t])}doCreateLogger(e,t,o){return new _Hi(this.channel,e,t,o,this.windowId)}static setLogLevel(e,t,o){return e.call("setLogLevel",[t,o])}},_Hi=class extends WIe{constructor(e,t,o,n,r){super(n?.logLevel==="always");this.channel=e;this.file=t;this.isLoggerCreated=!1;this.buffer=[];this.setLevel(o),this.channel.call("createLogger",[t,n,r]).then(()=>{this.doLog(this.buffer),this.isLoggerCreated=!0})}log(e,t){let o=[[e,t]];this.isLoggerCreated?this.doLog(o):this.buffer.push(...o)}doLog(e){this.channel.call("log",[this.file,e])}};var vQt=class extends x{constructor(i,e){super(),e.call("setLogLevel",[i.getLogLevel()]),this._register(i.onDidChangeLogLevel(t=>e.call("setLogLevel",[t]))),e.call("getRegisteredLoggers").then(t=>{for(let o of t)i.registerLogger({...o,resource:A.revive(o.resource)})}),this._register(e.listen("onDidChangeVisibility")(([t,o])=>i.setVisibility(A.revive(t),o))),this._register(e.listen("onDidChangeLoggers")(({added:t,removed:o})=>{for(let n of t)i.registerLogger({...n,resource:A.revive(n.resource)});for(let n of o)i.deregisterLogger(n.resource)}))}};var bQt="remote.defaultExtensionsIfInstalledLocally";var LRo="([a-z0-9A-Z][a-z0-9-A-Z]*)\\.([a-z0-9A-Z][a-z0-9-A-Z]*)$",Xze=class{constructor(i,e){this.labelService=i;this.remoteAgentService=e;this.registerFormatters()}static{this.ID="workbench.contrib.remoteLabel"}registerFormatters(){this.remoteAgentService.getEnvironment().then(i=>{let e=i?.os||Po,t={label:"${path}",separator:e===1?"\\":"/",tildify:e!==1,normalizeDriveLetter:e===1,workspaceSuffix:Wt?void 0:Q.vscodeRemote};this.labelService.registerFormatter({scheme:Q.vscodeRemote,formatting:t}),i&&this.labelService.registerFormatter({scheme:Q.vscodeUserData,formatting:t})})}};Xze=I([m(0,rt),m(1,bo)],Xze);var edt=class extends x{constructor(i,e,t){super();let o=i.getConnection();o&&(o.registerChannel("download",new gQt(e)),o.withChannel("logger",async n=>this._register(new vQt(t,n))))}};edt=I([m(0,bo),m(1,i0),m(2,Il)],edt);var Jze=class extends x{constructor(e,t,o,n,r,s){super();this.fileService=e;this.dialogService=t;this.environmentService=o;this.contextService=n;this.fileDialogService=r;this.environmentService.remoteAuthority&&s.getEnvironment().then(l=>{l&&this.validateRemoteWorkspace()})}static{this.ID="workbench.contrib.remoteInvalidWorkspaceDetector"}async validateRemoteWorkspace(){let e=this.contextService.getWorkspace(),t=e.configuration??e.folders.at(0)?.uri;if(!t||await this.fileService.exists(t))return;if((await this.dialogService.confirm({type:"warning",message:d(13491,null),detail:d(13490,null),primaryButton:d(13492,null)})).confirmed)return e.configuration?this.fileDialogService.pickWorkspaceAndOpen({}):this.fileDialogService.pickFolderAndOpen({})}};Jze=I([m(0,fe),m(1,at),m(2,At),m(3,Pe),m(4,rn),m(5,bo)],Jze);var vbn=ne.as(Qi.Workbench);It(Xze.ID,Xze,St.BlockStartup);vbn.registerWorkbenchContribution(edt,3);It(Jze.ID,Jze,St.BlockStartup);var bbn=!0;if(bbn){class a extends K{constructor(){super({id:"workbench.action.triggerReconnect",title:L(13523,"Connection: Trigger Reconnect"),category:Ve.Developer,f1:!0})}async run(t){Dre.debugTriggerReconnection()}}class i extends K{constructor(){super({id:"workbench.action.pauseSocketWriting",title:L(13493,"Connection: Pause socket writing"),category:Ve.Developer,f1:!0})}async run(t){Dre.debugPauseSocketWriting()}}W(a),W(i)}var RRo={type:"string",enum:["ui","workspace"],enumDescriptions:[d(13524,null),d(13525,null)]};ne.as(Jt.Configuration).registerConfiguration({id:"remote",title:d(13494,null),type:"object",properties:{"remote.extensionKind":{type:"object",markdownDescription:d(13503,null),patternProperties:{[LRo]:{oneOf:[{type:"array",items:RRo},RRo],default:["ui"]}},default:{"pub.name":["ui"]}},"remote.restoreForwardedPorts":{type:"boolean",markdownDescription:d(13522,null),default:!0},"remote.autoForwardPorts":{type:"boolean",markdownDescription:d(13496,null,"`#remote.autoForwardPortsSource#`"),default:!0},"remote.autoForwardPortsSource":{type:"string",markdownDescription:d(13497,null,"`#remote.autoForwardPorts#`","`#remote.autoForwardPortsSource#`"),enum:["process","output","hybrid"],enumDescriptions:[d(13500,null),d(13499,null),d(13498,null)],default:"process"},"remote.autoForwardPortsFallback":{type:"number",default:20,markdownDescription:d(13495,null)},"remote.forwardOnOpen":{type:"boolean",description:d(13504,null),default:!0},"remote.portsAttributes":{type:"object",patternProperties:{"(^\\d+(-\\d+)?$)|(.+)":{type:"object",description:d(13518,null),properties:{onAutoForward:{type:"string",enum:["notify","openBrowser","openBrowserOnce","openPreview","silent","ignore"],enumDescriptions:[d(13512,null),d(13514,null),d(13515,null),d(13516,null),d(13521,null),d(13509,null)],description:d(13513,null),default:"notify"},elevateIfNeeded:{type:"boolean",description:d(13508,null),default:!1},label:{type:"string",description:d(13510,null),default:d(13511,null)},requireLocalPort:{type:"boolean",markdownDescription:d(13520,null),default:!1},protocol:{type:"string",enum:["http","https"],description:d(13519,null)}},default:{label:d(13511,null),onAutoForward:"notify"}}},markdownDescription:d(13506,null),defaultSnippets:[{body:{"${1:3000}":{label:"${2:Application}",onAutoForward:"openPreview"}}}],errorMessage:d(13517,null),additionalProperties:!1,default:{443:{protocol:"https"},8443:{protocol:"https"}}},"remote.otherPortsAttributes":{type:"object",properties:{onAutoForward:{type:"string",enum:["notify","openBrowser","openPreview","silent","ignore"],enumDescriptions:[d(13512,null),d(13514,null),d(13516,null),d(13521,null),d(13509,null)],description:d(13513,null),default:"notify"},elevateIfNeeded:{type:"boolean",description:d(13508,null),default:!1},label:{type:"string",description:d(13510,null),default:d(13511,null)},requireLocalPort:{type:"boolean",markdownDescription:d(13520,null),default:!1},protocol:{type:"string",enum:["http","https"],description:d(13519,null)}},defaultSnippets:[{body:{onAutoForward:"ignore"}}],markdownDescription:d(13507,null,"`#remote.portsAttributes#`"),additionalProperties:!1},"remote.localPortHost":{type:"string",enum:["localhost","allInterfaces"],default:"localhost",description:d(13505,null)},[bQt]:{type:"array",markdownDescription:d(13502,null),default:ro?.remoteDefaultExtensionsIfInstalledLocally||[],items:{type:"string",pattern:LRo,patternErrorMessage:d(13501,null)}}}});var Ebe=class extends x{static{this.ID="workbench.contrib.showPortCandidate"}constructor(i,e){super();let t=e.options?.tunnelProvider?.showPortCandidate;t&&this._register(i.setCandidateFilter(async o=>{let n=await Promise.all(o.map(s=>t(s.host,s.port,s.detail??""))),r=[];if(n.length!==o.length)return o;for(let s=0;s<o.length;s++)n[s]&&r.push(o[s]);return r}))}};Ebe=I([m(0,du),m(1,cd)],Ebe);var Tbe=class extends x{constructor(e,t,o,n,r,s){super();this.openerService=o;let l=t.options?.tunnelProvider?.tunnelFactory;if(l){s.createKey(mpe.key,!0);let c=t.options?.tunnelProvider?.features?.privacyOptions??[];t.options?.tunnelProvider?.features?.public&&c.length===0&&(c=[{id:"private",label:d(13429,null),themeIcon:"lock"},{id:"public",label:d(13430,null),themeIcon:"eye"}]),this._register(e.setTunnelProvider({forwardPort:async(p,h)=>{let g;try{g=l(p,h)}catch{r.trace("tunnelFactory: tunnel provider error")}if(!g)return;let f;try{f=await g}catch(S){return r.trace("tunnelFactory: tunnel provider promise error"),S instanceof Error?S.message:void 0}let v=f.localAddress.startsWith("http")?f.localAddress:`http://${f.localAddress}`;return{tunnelRemotePort:f.remoteAddress.port,tunnelRemoteHost:f.remoteAddress.host,localAddress:await this.resolveExternalUri(v),privacy:f.privacy??(f.public?"public":"private"),protocol:f.protocol??"http",dispose:async()=>{await f.dispose()}}}}));let u=t.options?.tunnelProvider?.features?{features:{elevation:!!t.options?.tunnelProvider?.features?.elevation,public:!!t.options?.tunnelProvider?.features?.public,privacyOptions:c,protocol:t.options?.tunnelProvider?.features?.protocol===void 0?!0:!!t.options?.tunnelProvider?.features?.protocol}}:void 0;n.setTunnelInformation(u)}}static{this.ID="workbench.contrib.tunnelFactory"}async resolveExternalUri(e){try{return(await this.openerService.resolveExternalUri(A.parse(e))).resolved.toString()}catch{return e}}};Tbe=I([m(0,_p),m(1,cd),m(2,Je),m(3,du),m(4,se),m(5,X)],Tbe);var MRo=new Y("selectedRemoteInExplorer",""),Zze=class extends x{constructor(e,t,o,n,r){super();this.contextKeyService=e;this.remoteExplorerService=t;this.environmentService=o;this.storageService=n;this.workspaceContextService=r;this.completedRemotes=this._register(new Vt);this.selectedRemoteContext=MRo.bindTo(e),this.switchRemoteMenu=D.for("workbench.remote.menu.switchRemoteMenu"),this._register(ve.appendMenuItem(D.ViewContainerTitle,{submenu:this.switchRemoteMenu,title:d(13347,null),group:"navigation",when:C.equals("viewContainer",hH),order:1,isSelection:!0})),this._register(t.onDidChangeTargetType(s=>{this.select(s)}))}setSelectionForConnection(){let e=!1;if(this.completedRemotes.size>0){let t,o=this.environmentService.remoteAuthority,n;o||(n=FR(this.workspaceContextService.getWorkspace())?.scheme),e=!0;let r=o?[o.split("+")[0]]:n?[n]:this.storageService.get(jYe,1)?.split(",")??this.storageService.get(jYe,0)?.split(",");r!==void 0&&(t=this.getAuthorityForExplorerType(r)),t&&this.select(t)}return e}select(e){this.selectedRemoteContext.set(e[0]),this.remoteExplorerService.targetType=e}getAuthorityForExplorerType(e){let t;for(let o of this.completedRemotes)for(let n of o[1].authority)for(let r of e)if(n===r){t=o[1].authority;break}else if(o[1].virtualWorkspace===r){t=o[1].authority;break}return t}removeOptionItems(e){for(let t of e)if(t.group&&t.group.startsWith("targets")&&t.remoteAuthority&&(!t.when||this.contextKeyService.contextMatchesRules(t.when))){let o=HS(t.remoteAuthority)?t.remoteAuthority:[t.remoteAuthority];this.completedRemotes.deleteAndDispose(o[0])}}createOptionItems(e){let t=this.completedRemotes.size;for(let o of e)if(o.group&&o.group.startsWith("targets")&&o.remoteAuthority&&(!o.when||this.contextKeyService.contextMatchesRules(o.when))){let n=o.name,r=HS(o.remoteAuthority)?o.remoteAuthority:[o.remoteAuthority];if(this.completedRemotes.has(r[0]))continue;let s=this,l=W(class extends K{constructor(){super({id:`workbench.action.remoteExplorer.show.${r[0]}`,title:n,toggled:MRo.isEqualTo(r[0]),menu:{id:s.switchRemoteMenu}})}async run(){s.select(r)}});this.completedRemotes.set(r[0],{text:n.value,authority:r,virtualWorkspace:o.virtualWorkspace,dispose:()=>l.dispose()})}this.completedRemotes.size>t&&this.setSelectionForConnection()}};Zze=I([m(0,X),m(1,du),m(2,At),m(3,ce),m(4,Pe)],Zze);var PRo=()=>`
<checklist>
	<div class="theme-picker-row">
		<checkbox when-checked="setTheme:${rl.COLOR_THEME_DARK}" checked-on="config.workbench.colorTheme == '${rl.COLOR_THEME_DARK}'">
			<img width="200" src="./dark.png"/>
			${mr(d(16903,null))}
		</checkbox>
		<checkbox when-checked="setTheme:${rl.COLOR_THEME_LIGHT}" checked-on="config.workbench.colorTheme == '${rl.COLOR_THEME_LIGHT}'">
			<img width="200" src="./light.png"/>
			${mr(d(16906,null))}
		</checkbox>
	</div>
	<div class="theme-picker-row">
		<checkbox when-checked="setTheme:${rl.COLOR_THEME_HC_DARK}" checked-on="config.workbench.colorTheme == '${rl.COLOR_THEME_HC_DARK}'">
			<img width="200" src="./dark-hc.png"/>
			${mr(d(16904,null))}
		</checkbox>
		<checkbox when-checked="setTheme:${rl.COLOR_THEME_HC_LIGHT}" checked-on="config.workbench.colorTheme == '${rl.COLOR_THEME_HC_LIGHT}'">
			<img width="200" src="./light-hc.png"/>
			${mr(d(16905,null))}
		</checkbox>
	</div>
</checklist>
<checkbox class="theme-picker-link" when-checked="command:workbench.action.selectTheme" checked-on="false">
	${mr(d(16907,null))}
</checkbox>
`;var ARo=()=>`
<checklist>
	<div class="theme-picker-row">
		<checkbox when-checked="setTheme:${rl.COLOR_THEME_DARK}" checked-on="config.workbench.colorTheme == '${rl.COLOR_THEME_DARK}'">
			<img width="150" src="./dark.png"/>
			${mr(d(16908,null))}
		</checkbox>
		<checkbox when-checked="setTheme:${rl.COLOR_THEME_LIGHT}" checked-on="config.workbench.colorTheme == '${rl.COLOR_THEME_LIGHT}'">
			<img width="150" src="./light.png"/>
			${mr(d(16911,null))}
		</checkbox>
	</div>
	<div class="theme-picker-row">
		<checkbox when-checked="setTheme:${rl.COLOR_THEME_HC_DARK}" checked-on="config.workbench.colorTheme == '${rl.COLOR_THEME_HC_DARK}'">
			<img width="150" src="./dark-hc.png"/>
			${mr(d(16909,null))}
		</checkbox>
		<checkbox when-checked="setTheme:${rl.COLOR_THEME_HC_LIGHT}" checked-on="config.workbench.colorTheme == '${rl.COLOR_THEME_HC_LIGHT}'">
			<img width="150" src="./light-hc.png"/>
			${mr(d(16910,null))}
		</checkbox>
	</div>
</checklist>
`;var DHi=a=>fc("notebook.setProfile",{profile:a}).toString(),LHi=400,NRo=()=>`
<vertically-centered>
<checklist>
	<checkbox on-checked="${DHi("default")}" checked-on="config.notebook.cellFocusIndicator == 'border' && config.notebook.insertToolbarLocation == 'both' && config.notebook.globalToolbar == false && config.notebook.compactView == true && config.notebook.showCellStatusBar == 'visible'">
		<img width="${LHi}" src="./notebookThemes/default.png"/>
		${mr(d(16901,null))}
	</checkbox>
	<checkbox on-checked="${DHi("jupyter")}" checked-on="config.notebook.cellFocusIndicator == 'gutter' && config.notebook.insertToolbarLocation == 'notebookToolbar' && config.notebook.globalToolbar == true && config.notebook.compactView == true  && config.notebook.showCellStatusBar == 'visible'">
		<img width="${LHi}" src="./notebookThemes/jupyter.png"/>
		${mr(d(16902,null))}
	</checkbox>
	<checkbox on-checked="${DHi("colab")}" checked-on="config.notebook.cellFocusIndicator == 'border' && config.notebook.insertToolbarLocation == 'betweenCells' && config.notebook.globalToolbar == false && config.notebook.compactView == false && config.notebook.showCellStatusBar == 'hidden'">
		<img width="${LHi}" src="./notebookThemes/colab.png"/>
		${mr(d(16900,null))}
	</checkbox>
</checklist>
</vertically-centered>
`;var Lre={documentationUrl:ro.defaultChatAgent?.documentationUrl??"",manageSettingsUrl:ro.defaultChatAgent?.manageSettingsUrl??"",provider:ro.defaultChatAgent?.provider??{default:{name:""}},publicCodeMatchesUrl:ro.defaultChatAgent?.publicCodeMatchesUrl??"",termsStatementUrl:ro.defaultChatAgent?.termsStatementUrl??"",privacyStatementUrl:ro.defaultChatAgent?.privacyStatementUrl??""},EEb=d(16883,null,Lre.provider.default.name,Lre.publicCodeMatchesUrl,Lre.manageSettingsUrl),RHi=class{constructor(){this.providers=new Map}registerProvider(i,e){this.providers.set(i,e)}getProvider(i){return this.providers.get(i)}},eKe=new RHi;eKe.registerProvider("vs/workbench/contrib/welcomeGettingStarted/common/media/theme_picker",PRo);eKe.registerProvider("vs/workbench/contrib/welcomeGettingStarted/common/media/theme_picker_small",ARo);eKe.registerProvider("vs/workbench/contrib/welcomeGettingStarted/common/media/notebookProfile",NRo);eKe.registerProvider("vs/workbench/contrib/welcomeGettingStarted/common/media/empty",()=>"");var SQt=Ae("getting-started-setup",R.zap,d(16768,null)),Sbn=Ae("getting-started-beginner",R.lightbulb,d(16767,null)),MHi=[{id:"welcome.showNewFileEntries",title:d(16811,null),description:d(16810,null),icon:R.newFile,content:{type:"startEntry",command:"command:welcome.showNewFileEntries"}},{id:"topLevelOpenMac",title:d(16823,null),description:d(16822,null),icon:R.folderOpened,when:"!isWeb && isMac",content:{type:"startEntry",command:"command:workbench.action.files.openFileFolder"}},{id:"topLevelOpenFile",title:d(16819,null),description:d(16818,null),icon:R.goToFile,when:"isWeb || !isMac",content:{type:"startEntry",command:"command:workbench.action.files.openFile"}},{id:"topLevelOpenFolder",title:d(16821,null),description:d(16820,null),icon:R.folderOpened,when:"!isWeb && !isMac",content:{type:"startEntry",command:"command:workbench.action.files.openFolder"}},{id:"topLevelOpenFolderWeb",title:d(16821,null),description:d(16820,null),icon:R.folderOpened,when:"!openFolderWorkspaceSupport && workbenchState == 'workspace'",content:{type:"startEntry",command:"command:workbench.action.files.openFolderViaWorkspace"}},{id:"topLevelGitClone",title:d(16854,null),description:d(16853,null),when:"config.git.enabled && !git.missing",icon:R.sourceControl,content:{type:"startEntry",command:"command:git.clone"}},{id:"topLevelGitOpen",title:d(16856,null),description:d(16855,null),when:"workspacePlatform == 'webworker'",icon:R.sourceControl,content:{type:"startEntry",command:"command:remoteHub.openRepository"}},{id:"topLevelRemoteOpen",title:d(16860,null),description:d(16859,null),when:"!isWeb",icon:R.remote,content:{type:"startEntry",command:"command:workbench.action.remote.showMenu"}},{id:"topLevelOpenTunnel",title:d(16858,null),description:d(16857,null),when:"isWeb && showRemoteStartEntryInWeb",icon:R.remote,content:{type:"startEntry",command:"command:workbench.action.remote.showWebStartEntryActions"}},{id:"topLevelNewWorkspaceChat",title:d(16813,null),description:d(16812,null),icon:R.chatSparkle,when:"!isWeb && !chatSetupHidden",content:{type:"startEntry",command:"command:welcome.newWorkspaceChat"}}],Pc=(a,i)=>`[${a}](${i})`,Ibn=d(16788,null),ORo=d(16786,null,Lre.documentationUrl??""),ybn=d(16787,null,Lre.provider.default.name,Lre.provider.default.name,Lre.termsStatementUrl,Lre.privacyStatementUrl),wbn=Pc(d(16885,null),"command:workbench.action.chat.triggerSetupAnonymousWithoutDialog"),Cbn=Pc(d(16885,null),"command:workbench.action.chat.triggerSetup"),xbn=Pc(d(16885,null),"command:workbench.action.chat.triggerSetup"),kbn=Pc(d(16884,null),"command:workbench.action.chat.open");function IQt(a,i,e,t){let o=t?`${ORo}
${ybn}
${i}`:`${ORo}
${i}`;return{id:a,title:Ibn,description:o,when:`${e} && !chatSetupHidden`,media:{type:"svg",altText:"VS Code Copilot multi file edits",path:"multi-file-edits.svg"}}}var PHi=[{id:"Setup",title:d(16839,null),description:d(16836,null),isFeatured:!0,icon:SQt,when:"!isWeb",walkthroughPageTitle:d(16840,null),next:"Beginner",content:{type:"steps",steps:[IQt("CopilotSetupAnonymous",wbn,"chatAnonymous && !chatSetupInstalled",!0),IQt("CopilotSetupSignedOut",Cbn,"chatEntitlementSignedOut && !chatAnonymous",!1),IQt("CopilotSetupComplete",kbn,"chatSetupInstalled && !chatSetupDisabled && (chatAnonymous || chatPlanPro || chatPlanProPlus || chatPlanBusiness || chatPlanEnterprise || chatPlanFree)",!1),IQt("CopilotSetupSignedIn",xbn,"!chatEntitlementSignedOut && (!chatSetupInstalled || chatSetupDisabled || chatPlanCanSignUp)",!1),{id:"pickColorTheme",title:d(16825,null),description:d(16824,null,Pc(d(16890,null),"command:workbench.action.selectTheme")),completionEvents:["onSettingChanged:workbench.colorTheme","onCommand:workbench.action.selectTheme"],media:{type:"markdown",path:"theme_picker"}},{id:"videoTutorial",title:d(16864,null),description:d(16863,null,Pc(d(16898,null),"https://aka.ms/vscode-getting-started-video")),media:{type:"svg",altText:"VS Code Settings",path:"learn.svg"}}]}},{id:"SetupWeb",title:d(16845,null),description:d(16844,null),isFeatured:!0,icon:SQt,when:"isWeb",next:"Beginner",walkthroughPageTitle:d(16846,null),content:{type:"steps",steps:[{id:"pickColorThemeWeb",title:d(16825,null),description:d(16824,null,Pc(d(16890,null),"command:workbench.action.selectTheme")),completionEvents:["onSettingChanged:workbench.colorTheme","onCommand:workbench.action.selectTheme"],media:{type:"markdown",path:"theme_picker"}},{id:"menuBarWeb",title:d(16809,null),description:d(16808,null,Pc(d(16894,null),"command:workbench.action.toggleMenuBar")),when:"isWeb",media:{type:"svg",altText:"Comparing menu dropdown with the visible menu bar.",path:"menuBar.svg"}},{id:"extensionsWebWeb",title:d(16794,null),description:d(16795,null,Pc(d(16762,null),"command:workbench.extensions.action.showPopularExtensions")),when:"workspacePlatform == 'webworker'",media:{type:"svg",altText:"VS Code extension marketplace with featured language extensions",path:"extensions-web.svg"}},{id:"findLanguageExtensionsWeb",title:d(16797,null),description:d(16796,null,Pc(d(16760,null),"command:workbench.extensions.action.showLanguageExtensions")),when:"workspacePlatform != 'webworker'",media:{type:"svg",altText:"Language extensions",path:"languages.svg"}},{id:"settingsSyncWeb",title:d(16835,null),description:d(16834,null,Pc(d(16765,null),"command:workbench.userDataSync.actions.turnOn")),when:"syncStatus != uninitialized",completionEvents:["onEvent:sync-enabled"],media:{type:"svg",altText:'The "Turn on Sync" entry in the settings gear menu.',path:"settingsSync.svg"}},{id:"commandPaletteTaskWeb",title:d(16783,null),description:d(16782,null,Pc(d(16764,null),"command:workbench.action.showCommands")),media:{type:"svg",altText:"Command Palette overlay for searching and executing commands.",path:"commandPalette.svg"}},{id:"pickAFolderTask-WebWeb",title:d(16837,null),description:d(16838,null,Pc(d(16875,null),"command:workbench.action.addRootFolder"),Pc(d(16877,null),"command:remoteHub.openRepository")),when:"workspaceFolderCount == 0",media:{type:"svg",altText:"Explorer view showing buttons for opening folder and cloning repository.",path:"openFolder.svg"}},{id:"quickOpenWeb",title:d(16827,null),description:d(16826,null,Pc(d(16880,null),"command:toSide:workbench.action.quickOpen")),when:"workspaceFolderCount != 0",media:{type:"svg",altText:"Go to file in quick search.",path:"search.svg"}}]}},{id:"SetupAccessibility",title:d(16842,null),description:d(16841,null),isFeatured:!0,icon:SQt,when:$a.key,next:"Setup",walkthroughPageTitle:d(16843,null),content:{type:"steps",steps:[{id:"accessibilityHelp",title:d(16770,null),description:d(16769,null,Pc(d(16872,null),"command:editor.action.accessibilityHelp")),media:{type:"markdown",path:"empty"}},{id:"accessibleView",title:d(16776,null),description:d(16775,null,Pc(d(16874,null),"command:editor.action.accessibleView")),media:{type:"markdown",path:"empty"}},{id:"verbositySettings",title:d(16862,null),description:d(16861,null,Pc(d(16879,null),"command:workbench.action.openAccessibilitySettings")),media:{type:"markdown",path:"empty"}},{id:"commandPaletteTaskAccessibility",title:d(16785,null),description:d(16784,null,Pc(d(16764,null),"command:workbench.action.showCommands")),media:{type:"markdown",path:"empty"}},{id:"keybindingsAccessibility",title:d(16807,null),description:d(16806,null,Pc(d(16869,null),"command:toSide:workbench.action.openGlobalKeybindings")),media:{type:"markdown",path:"empty"}},{id:"accessibilitySignals",title:d(16774,null),description:d(16773,null,Pc(d(16871,null),"command:signals.sounds.help"),Pc(d(16870,null),"command:accessibility.announcement.help")),media:{type:"markdown",path:"empty"}},{id:"hover",title:d(16801,null),description:d(16800,null,Pc(d(16886,null),"command:editor.action.showHover")),media:{type:"markdown",path:"empty"}},{id:"goToSymbol",title:d(16799,null),description:d(16798,null,Pc(d(16876,null),"command:editor.action.goToSymbol")),media:{type:"markdown",path:"empty"}},{id:"codeFolding",title:d(16781,null),description:d(16780,null,Pc(d(16892,null),"command:editor.toggleFold"),Pc(d(16893,null),"command:editor.toggleFoldRecursively")),media:{type:"markdown",path:"empty"}},{id:"intellisense",title:d(16805,null),description:d(16804,null,Pc(d(16896,null),"command:editor.action.triggerSuggest"),Pc(d(16895,null),"command:editor.action.inlineSuggest.trigger")),media:{type:"markdown",path:"empty"}},{id:"accessibilitySettings",title:d(16772,null),description:d(16771,null,Pc(d(16873,null),"command:workbench.action.openAccessibilitySettings")),media:{type:"markdown",path:"empty"}},{id:"dictation",title:d(16792,null),description:d(16791,null,Pc(d(16891,null),"command:workbench.action.editorDictation.start"),Pc(d(16888,null),"command:workbench.action.terminal.startVoice"),Pc(d(16889,null),"command:workbench.action.terminal.stopVoice")),when:"hasSpeechProvider",media:{type:"markdown",path:"empty"}}]}},{id:"Beginner",isFeatured:!1,title:d(16778,null),icon:Sbn,description:d(16777,null),walkthroughPageTitle:d(16779,null),content:{type:"steps",steps:[{id:"settingsAndSync",title:d(16832,null),description:d(16833,null,Pc(d(16897,null),"command:toSide:workbench.action.openSettings")),when:"workspacePlatform != 'webworker' && syncStatus != uninitialized",completionEvents:["onEvent:sync-enabled"],media:{type:"svg",altText:"VS Code Settings",path:"settings.svg"}},{id:"extensions",title:d(16794,null),description:d(16793,null,Pc(d(16761,null),"command:workbench.extensions.action.showPopularExtensions")),when:"workspacePlatform != 'webworker'",media:{type:"svg",altText:"VS Code extension marketplace with featured language extensions",path:"extensions.svg"}},{id:"terminal",title:d(16852,null),description:d(16851,null,Pc(d(16887,null),"command:workbench.action.terminal.toggleTerminal")),when:"workspacePlatform != 'webworker' && remoteName != codespaces && !terminalIsOpen",media:{type:"svg",altText:"Integrated terminal running a few npm commands",path:"terminal.svg"}},{id:"debugging",title:d(16790,null),description:d(16789,null,Pc(d(16881,null),"command:workbench.action.debug.selectandstart")),when:"workspacePlatform != 'webworker' && workspaceFolderCount != 0",media:{type:"svg",altText:"Run and debug view.",path:"debug.svg"}},{id:"scmClone",title:d(16829,null),description:d(16830,null,Pc(d(16763,null),"command:git.clone")),when:"config.git.enabled && !git.missing && workspaceFolderCount == 0",media:{type:"svg",altText:"Source Control view.",path:"git.svg"}},{id:"scmSetup",title:d(16829,null),description:d(16831,null,Pc(d(16867,null),"command:git.init")),when:"config.git.enabled && !git.missing && workspaceFolderCount != 0 && gitOpenRepositoryCount == 0",media:{type:"svg",altText:"Source Control view.",path:"git.svg"}},{id:"scm",title:d(16829,null),description:d(16828,null,Pc(d(16878,null),"command:workbench.view.scm")),when:"config.git.enabled && !git.missing && workspaceFolderCount != 0 && gitOpenRepositoryCount != 0 && activeViewlet != 'workbench.view.scm'",media:{type:"svg",altText:"Source Control view.",path:"git.svg"}},{id:"installGit",title:d(16803,null),description:d(16802,null,Pc(d(16868,null),"https://aka.ms/vscode-install-git"),"[","](command:workbench.action.reloadWindow)"),when:"git.missing",media:{type:"svg",altText:"Install Git.",path:"git.svg"},completionEvents:["onContext:git.state == initialized"]},{id:"tasks",title:d(16850,null),when:"workspaceFolderCount != 0 && workspacePlatform != 'webworker'",description:d(16849,null,Pc(d(16882,null),"command:workbench.action.tasks.runTask")),media:{type:"svg",altText:"Task runner.",path:"runTask.svg"}},{id:"shortcuts",title:d(16848,null),description:d(16847,null,Pc(d(16869,null),"command:toSide:workbench.action.openGlobalKeybindings")),media:{type:"svg",altText:"Interactive shortcuts.",path:"shortcuts.svg"}},{id:"workspaceTrust",title:d(16866,null),description:d(16865,null,Pc(d(16899,null),"https://code.visualstudio.com/docs/editor/workspace-trust"),Pc(d(16766,null),"command:toSide:workbench.trust.manage")),when:"workspacePlatform != 'webworker' && !isWorkspaceTrusted && workspaceFolderCount == 0",media:{type:"svg",altText:"Workspace Trust editor in Restricted mode and a primary button for switching to Trusted mode.",path:"workspaceTrust.svg"}}]}},{id:"notebooks",title:d(16814,null),description:"",icon:SQt,isFeatured:!1,when:`config.${yt.openGettingStarted} && userHasOpenedNotebook`,walkthroughPageTitle:d(16815,null),content:{type:"steps",steps:[{completionEvents:["onCommand:notebook.setProfile"],id:"notebookProfile",title:d(16817,null),description:d(16816,null),when:"userHasOpenedNotebook",media:{type:"markdown",path:"notebookProfile"}}]}}];var tKe=d(16716,null),FRo=Rn.registerExtensionPoint({extensionPoint:"walkthroughs",jsonSchema:{description:d(16717,null),type:"array",items:{type:"object",required:["id","title","description","steps"],defaultSnippets:[{body:{id:"$1",title:"$2",description:"$3",steps:[]}}],properties:{id:{type:"string",description:d(16721,null)},title:{type:"string",description:d(16748,null)},icon:{type:"string",description:d(16720,null)},description:{type:"string",description:d(16718,null)},featuredFor:{type:"array",description:d(16719,null),items:{type:"string"}},when:{type:"string",description:d(16749,null)},steps:{type:"array",description:d(16722,null),items:{type:"object",required:["id","title","media"],defaultSnippets:[{body:{id:"$1",title:"$2",description:"$3",completionEvents:["$5"],media:{}}}],properties:{id:{type:"string",description:d(16735,null)},title:{type:"string",description:d(16746,null)},description:{type:"string",description:d(16732,null,`[${tKe}](command:myext.command)`,`[${tKe}](command:toSide:myext.command)`,`[${tKe}](https://aka.ms)`)},button:{deprecationMessage:d(16723,null,`[${tKe}](command:myext.command)`,`[${tKe}](command:toSide:myext.command)`,`[${tKe}](https://aka.ms)`)},media:{type:"object",description:d(16736,null),oneOf:[{required:["image","altText"],additionalProperties:!1,properties:{path:{deprecationMessage:d(16715,null)},image:{description:d(16742,null),oneOf:[{type:"string"},{type:"object",required:["dark","light","hc","hcLight"],properties:{dark:{description:d(16738,null),type:"string"},light:{description:d(16741,null),type:"string"},hc:{description:d(16739,null),type:"string"},hcLight:{description:d(16740,null),type:"string"}}}]},altText:{type:"string",description:d(16737,null)}}},{required:["svg","altText"],additionalProperties:!1,properties:{svg:{description:d(16743,null),type:"string"},altText:{type:"string",description:d(16737,null)}}},{required:["markdown"],additionalProperties:!1,properties:{path:{deprecationMessage:d(16715,null)},markdown:{description:d(16744,null),type:"string"}}}]},completionEvents:{description:d(16724,null),type:"array",items:{type:"string",defaultSnippets:[{label:"onCommand",description:d(16726,null),body:"onCommand:${1:commandId}"},{label:"onLink",description:d(16728,null),body:"onLink:${2:linkId}"},{label:"onView",description:d(16730,null),body:"onView:${2:viewId}"},{label:"onSettingChanged",description:d(16729,null),body:"onSettingChanged:${2:settingName}"},{label:"onContext",description:d(16727,null),body:"onContext:${2:key}"},{label:"onExtensionInstalled",description:d(16725,null),body:"onExtensionInstalled:${3:extensionId}"},{label:"onStepSelected",description:d(16731,null),body:"onStepSelected"}]}},doneOn:{description:d(16733,null),deprecationMessage:d(16734,null),type:"object",required:["command"],defaultSnippets:[{body:{command:"$1"}}],properties:{command:{description:d(16745,null),type:"string"}}},when:{type:"string",description:d(16747,null)}}}}}}},activationEventsGenerator:function*(a){for(let i of a)i.id&&(yield`onWalkthrough:${i.id}`)}});var yQt="workbench.editors.gettingStartedInput",Pf=class a extends ls{static{this.ID=yQt}static{this.RESOURCE=A.from({scheme:Q.walkThrough,authority:"vscode_getting_started_page"})}get typeId(){return a.ID}get editorId(){return this.typeId}toUntyped(){return{resource:a.RESOURCE,options:{override:a.ID,pinned:!1}}}get resource(){return a.RESOURCE}matches(i){return super.matches(i)?!0:i instanceof a}constructor(i){super(),this._selectedCategory=i.selectedCategory,this._selectedStep=i.selectedStep,this._showTelemetryNotice=!!i.showTelemetryNotice,this._showWelcome=i.showWelcome??!0,this._walkthroughPageTitle=i.walkthroughPageTitle,this._returnToCommand=i.returnToCommand}getName(){return this.walkthroughPageTitle?d(16753,null,this.walkthroughPageTitle):d(16752,null)}get selectedCategory(){return this._selectedCategory}set selectedCategory(i){this._selectedCategory=i,this._onDidChangeLabel.fire()}get selectedStep(){return this._selectedStep}set selectedStep(i){this._selectedStep=i}get showTelemetryNotice(){return this._showTelemetryNotice}set showTelemetryNotice(i){this._showTelemetryNotice=i}get showWelcome(){return this._showWelcome}set showWelcome(i){this._showWelcome=i}get walkthroughPageTitle(){return this._walkthroughPageTitle}set walkthroughPageTitle(i){this._walkthroughPageTitle=i}get returnToCommand(){return this._returnToCommand}set returnToCommand(i){this._returnToCommand=i}};var Ebn=new Y("hasMultipleNewFileEntries",!1),XM=le("walkthroughsService"),xQt="workbench.welcomePage.hiddenCategories",CQt="workbench.welcomePage.walkthroughMetadata",Tbn=d(16754,null),_bn=1440*60*1e3,AHi=7*_bn,idt=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super();this.storageService=e;this.commandService=t;this.instantiationService=o;this.workspaceContextService=n;this.contextService=r;this.userDataSyncEnablementService=s;this.configurationService=l;this.extensionManagementService=c;this.hostService=u;this.viewsService=p;this.telemetryService=h;this.tasExperimentService=g;this.layoutService=f;this.editorService=v;this._onDidAddWalkthrough=this._register(new E);this.onDidAddWalkthrough=this._onDidAddWalkthrough.event;this._onDidRemoveWalkthrough=this._register(new E);this.onDidRemoveWalkthrough=this._onDidRemoveWalkthrough.event;this._onDidChangeWalkthrough=this._register(new E);this.onDidChangeWalkthrough=this._onDidChangeWalkthrough.event;this._onDidProgressStep=this._register(new E);this.onDidProgressStep=this._onDidProgressStep.event;this.sessionEvents=new Set;this.completionListeners=new Map;this.gettingStartedContributions=new Map;this.steps=new Map;this.sessionInstalledExtensions=new Set;this.categoryVisibilityContextKeys=new Set;this.stepCompletionContextKeyExpressions=new Set;this.stepCompletionContextKeys=new Set;this.metadata=new Map(JSON.parse(this.storageService.get(CQt,0,"[]"))),this.memento=new Al("gettingStartedService",this.storageService),this.stepProgress=this.memento.getMemento(0,0),this.initCompletionEventListeners(),Ebn.bindTo(this.contextService).set(!1),this.registerWalkthroughs()}registerWalkthroughs(){PHi.forEach(async(e,t)=>{this._registerWalkthrough({...e,icon:{type:"icon",icon:e.icon},order:PHi.length-t,source:Tbn,when:C.deserialize(e.when)??C.true(),steps:e.content.steps.map((o,n)=>({...o,completionEvents:o.completionEvents??[],description:odt(o.description),category:e.id,order:n,when:C.deserialize(o.when)??C.true(),media:o.media.type==="image"?{type:"image",altText:o.media.altText,path:Dbn(o.media.path)}:o.media.type==="svg"?{type:"svg",altText:o.media.altText,path:WRo(o.media.path).with({query:JSON.stringify({moduleId:"vs/workbench/contrib/welcomeGettingStarted/common/media/"+o.media.path})})}:o.media.type==="markdown"?{type:"markdown",path:WRo(o.media.path).with({query:JSON.stringify({moduleId:"vs/workbench/contrib/welcomeGettingStarted/common/media/"+o.media.path})}),base:vn.asFileUri("vs/workbench/contrib/welcomeGettingStarted/common/media/"),root:vn.asFileUri("vs/workbench/contrib/welcomeGettingStarted/common/media/")}:{type:"video",path:wQt(vn.asFileUri("vs/workbench/contrib/welcomeGettingStarted/common/media/"),o.media.path),altText:o.media.altText,root:vn.asFileUri("vs/workbench/contrib/welcomeGettingStarted/common/media/"),poster:o.media.poster?wQt(vn.asFileUri("vs/workbench/contrib/welcomeGettingStarted/common/media/"),o.media.poster):void 0}}))})}),FRo.setHandler((e,{added:t,removed:o})=>{t.map(n=>this.registerExtensionWalkthroughContributions(n.description)),o.map(n=>this.unregisterExtensionWalkthroughContributions(n.description))})}initCompletionEventListeners(){this._register(this.commandService.onDidExecuteCommand(e=>this.progressByEvent(`onCommand:${e.commandId}`))),this.extensionManagementService.getInstalled().then(e=>{e.forEach(t=>this.progressByEvent(`extensionInstalled:${t.identifier.id.toLowerCase()}`))}),this._register(this.extensionManagementService.onDidInstallExtensions(e=>{for(let t of e)t?.context?.[O5]||t?.context?.[gTt]||this.sessionInstalledExtensions.add(t.identifier.id.toLowerCase()),this.progressByEvent(`extensionInstalled:${t.identifier.id.toLowerCase()}`)})),this._register(this.contextService.onDidChangeContext(e=>{e.affectsSome(this.stepCompletionContextKeys)&&this.stepCompletionContextKeyExpressions.forEach(t=>{e.affectsSome(new Set(t.keys()))&&this.contextService.contextMatchesRules(t)&&this.progressByEvent("onContext:"+t.serialize())})})),this._register(this.viewsService.onDidChangeViewVisibility(e=>{e.visible&&this.progressByEvent("onView:"+e.id)})),this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectedKeys.forEach(t=>{this.progressByEvent("onSettingChanged:"+t)})})),this.userDataSyncEnablementService.isEnabled()&&this.progressByEvent("onEvent:sync-enabled"),this._register(this.userDataSyncEnablementService.onDidChangeEnablement(()=>{this.userDataSyncEnablementService.isEnabled()&&this.progressByEvent("onEvent:sync-enabled")}))}markWalkthroughOpened(e){let t=this.gettingStartedContributions.get(e),o=this.metadata.get(e);o&&t&&this.metadata.set(e,{...o,manaullyOpened:!0,stepIDs:t.steps.map(n=>n.id)}),this.storageService.store(CQt,JSON.stringify([...this.metadata.entries()]),0,0)}async registerExtensionWalkthroughContributions(e){let t=c=>c.startsWith("https://")?A.parse(c,!0):vn.uriToFileUri(Ge(e.extensionLocation,c)),o=c=>{let u=p=>p.startsWith("https://")?A.parse(p,!0):vn.uriToBrowserUri(Ge(e.extensionLocation,p));if(typeof c=="string"){let p=u(c);return{hcDark:p,hcLight:p,dark:p,light:p}}else return{hcDark:u(c.hc),hcLight:u(c.hcLight??c.light),light:u(c.light),dark:u(c.dark)}};if(!e.contributes?.walkthroughs?.length)return;let n,r=Math.min();await Promise.all(e.contributes?.walkthroughs?.map(async(c,u)=>{let p=e.identifier.value+"#"+c.id,h=!this.metadata.get(p);h&&this.metadata.set(p,{firstSeen:+new Date,stepIDs:c.steps?.map(y=>y.id)??[],manaullyOpened:!1});let g=await Promise.race([this.tasExperimentService?.getTreatment(`gettingStarted.overrideCategory.${e.identifier.value+"."+c.id}.when`),new Promise(y=>setTimeout(()=>y(c.when),5e3))]);this.sessionInstalledExtensions.has(e.identifier.value.toLowerCase())&&this.contextService.contextMatchesRules(C.deserialize(g??c.when)??C.true())&&(this.sessionInstalledExtensions.delete(e.identifier.value.toLowerCase()),u<r&&h&&(n=p,r=u));let f=(c.steps??[]).map((y,w)=>{let k=odt(y.description||""),T=e.identifier.value+"#"+c.id+"#"+y.id,P;if(!y.media)throw Error("missing media in walkthrough step: "+c.id+"@"+y.id);if(y.media.image){let O=y.media.altText;O===void 0&&console.error("Walkthrough item:",T,"is missing altText for its media element."),P={type:"image",altText:O,path:o(y.media.image)}}else if(y.media.markdown)P={type:"markdown",path:t(y.media.markdown),base:t(ad(y.media.markdown)),root:vn.uriToFileUri(e.extensionLocation)};else if(y.media.svg)P={type:"svg",path:t(y.media.svg),altText:y.media.svg};else if(y.media.video){let O=vn.uriToFileUri(e.extensionLocation);P={type:"video",path:wQt(O,y.media.video),root:vn.uriToFileUri(e.extensionLocation),altText:y.media.altText,poster:y.media.poster?wQt(O,y.media.poster):void 0}}else throw new Error("Unknown walkthrough format detected for "+T);return{description:k,media:P,completionEvents:y.completionEvents?.filter(O=>typeof O=="string")??[],id:T,title:y.title,when:C.deserialize(y.when)??C.true(),category:p,order:w}}),v=!1;if(c.featuredFor){let y=this.workspaceContextService.getWorkspace().folders.map(k=>k.uri),w=new Ye;setTimeout(()=>w.cancel(),2e3),v=await this.instantiationService.invokeFunction(k=>O_e(k,y,c.featuredFor,w.token))}let b=c.icon??e.icon,S={description:c.description,title:c.title,id:p,isFeatured:v,source:e.displayName??e.name,order:0,walkthroughPageTitle:e.displayName??e.name,steps:f,icon:b?{type:"image",path:vn.uriToBrowserUri(Ge(e.extensionLocation,b)).toString(!0)}:{icon:iKt,type:"icon"},when:C.deserialize(g??c.when)??C.true()};this._registerWalkthrough(S),this._onDidAddWalkthrough.fire(this.resolveWalkthrough(S))})),this.storageService.store(CQt,JSON.stringify([...this.metadata.entries()]),0,0);let s=await this.hostService.hadLastFocus(),l=this.configurationService.getValue("workbench.startupEditor");s&&n&&this.configurationService.getValue("workbench.welcomePage.walkthroughs.openOnInstall")&&l!=="agentSessionsWelcomePage"&&(this.telemetryService.publicLog2("gettingStarted.didAutoOpenWalkthrough",{id:n}),this.editorService.activeEditor instanceof Pf&&this.commandService.executeCommand("workbench.action.keepEditor"),this.commandService.executeCommand("workbench.action.openWalkthrough",n,{inactive:this.layoutService.hasFocus("workbench.parts.editor")}))}unregisterExtensionWalkthroughContributions(e){e.contributes?.walkthroughs?.length&&e.contributes?.walkthroughs?.forEach(t=>{let o=e.identifier.value+"#"+t.id;t.steps.forEach(n=>{let r=e.identifier.value+"#"+t.id+"#"+n.id;this.steps.delete(r)}),this.gettingStartedContributions.delete(o),this._onDidRemoveWalkthrough.fire(o)})}getWalkthrough(e){let t=this.gettingStartedContributions.get(e);if(!t)throw Error("Trying to get unknown walkthrough: "+e);return this.resolveWalkthrough(t)}getWalkthroughs(){return[...this.gettingStartedContributions.values()].map(o=>({...o,content:{type:"steps",steps:o.steps}})).filter(o=>o.content.type!=="steps"||o.content.steps.length).filter(o=>o.id!=="NewWelcomeExperience").map(o=>this.resolveWalkthrough(o))}resolveWalkthrough(e){let t=e.steps.map(h=>this.getStepProgress(h)),o=this.metadata.get(e.id)?.manaullyOpened,n=this.metadata.get(e.id)?.firstSeen,r=n&&n>+new Date-AHi,s=this.metadata.get(e.id)?.stepIDs,l=this.gettingStartedContributions.get(e.id);if(!l)throw Error("Could not find walkthrough with id "+e.id);let c=l.steps.map(h=>h.id),u=s&&(c.length!==s.length||c.some((h,g)=>h!==s[g])),p=0;if(n){let g=+new Date-n;p=Math.max(0,(AHi-g)/AHi)}return{...e,recencyBonus:p,steps:t,newItems:!!u,newEntry:!!(r&&!o)}}getStepProgress(e){return{...e,done:!1,...this.stepProgress[e.id]}}progressStep(e){let t=this.stepProgress[e];if(!t||t.done!==!0){this.stepProgress[e]={done:!0},this.memento.saveMemento();let o=this.getStep(e);if(!o)throw Error("Tried to progress unknown step");this._onDidProgressStep.fire(this.getStepProgress(o))}}deprogressStep(e){delete this.stepProgress[e],this.memento.saveMemento();let t=this.getStep(e);this._onDidProgressStep.fire(this.getStepProgress(t))}progressByEvent(e){this.sessionEvents.has(e)||(this.sessionEvents.add(e),this.completionListeners.get(e)?.forEach(t=>this.progressStep(t)))}registerWalkthrough(e){this._registerWalkthrough({...e,steps:e.steps.map(t=>({...t,description:odt(t.description)}))})}_registerWalkthrough(e){if(this.gettingStartedContributions.get(e.id)){console.error(`Skipping attempt to overwrite walkthrough. (${e.id})`);return}this.gettingStartedContributions.set(e.id,e),e.steps.forEach(o=>{if(this.steps.has(o.id))throw Error("Attempting to register step with id "+o.id+" twice. Second is dropped.");this.steps.set(o.id,o),o.when.keys().forEach(n=>this.categoryVisibilityContextKeys.add(n)),this.registerDoneListeners(o)}),e.when.keys().forEach(o=>this.categoryVisibilityContextKeys.add(o))}registerDoneListeners(e){if(e.doneOn){console.error("wakthrough step",e,"uses deprecated 'doneOn' property. Adopt 'completionEvents' to silence this warning");return}e.completionEvents.length||(e.completionEvents=di(e.description.filter(t=>t.nodes.length===1).flatMap(t=>t.nodes.filter((o=>typeof o!="string")).map(({href:o})=>{if(o.startsWith("command:"))return"onCommand:"+o.slice(8,o.includes("?")?o.indexOf("?"):void 0);if(o.startsWith("https://")||o.startsWith("http://"))return"onLink:"+o})))),e.completionEvents.length||e.completionEvents.push("stepSelected");for(let t of e.completionEvents){let[o,n,r]=/^([^:]*):?(.*)$/.exec(t)??[];if(!n){console.error(`Unknown completionEvent ${t} when registering step ${e.id}`);continue}switch(n){case"onLink":case"onEvent":case"onView":case"onSettingChanged":break;case"onContext":{let s=C.deserialize(r);s?(this.stepCompletionContextKeyExpressions.add(s),s.keys().forEach(l=>this.stepCompletionContextKeys.add(l)),t=n+":"+s.serialize(),this.contextService.contextMatchesRules(s)&&this.sessionEvents.add(t)):console.error("Unable to parse context key expression:",s,"in walkthrough step",e.id);break}case"onStepSelected":case"stepSelected":t="stepSelected:"+e.id;break;case"onCommand":t=n+":"+r.replace(/^toSide:/,"");break;case"onExtensionInstalled":case"extensionInstalled":t="extensionInstalled:"+r.toLowerCase();break;default:console.error(`Unknown completionEvent ${t} when registering step ${e.id}`);continue}this.registerCompletionListener(t,e)}}registerCompletionListener(e,t){this.completionListeners.has(e)||this.completionListeners.set(e,new Set),this.completionListeners.get(e)?.add(t.id)}getStep(e){let t=this.steps.get(e);if(!t)throw Error("Attempting to access step which does not exist in registry "+e);return t}};idt=I([m(0,ce),m(1,ge),m(2,F),m(3,Pe),m(4,X),m(5,Fl),m(6,B),m(7,Cs),m(8,Zt),m(9,$t),m(10,Te),m(11,yD),m(12,yi),m(13,ee)],idt);var odt=a=>a.split(`
`).filter(i=>i).map(i=>ES(i)),WRo=a=>a.startsWith("https://")?A.parse(a,!0):vn.asFileUri(`vs/workbench/contrib/welcomeGettingStarted/common/media/${a}`),tdt=a=>a.startsWith("https://")?A.parse(a,!0):vn.asBrowserUri(`vs/workbench/contrib/welcomeGettingStarted/common/media/${a}`),Dbn=a=>{if(typeof a=="string"){let i=tdt(a);return{hcDark:i,hcLight:i,dark:i,light:i}}else return{hcDark:tdt(a.hc),hcLight:tdt(a.hcLight??a.light),light:tdt(a.light),dark:tdt(a.dark)}},wQt=(a,i)=>{let e=t=>t.startsWith("https://")?A.parse(t,!0):wte(Ge(a,t));if(typeof i=="string"){let t=e(i);return{hcDark:t,hcLight:t,dark:t,light:t}}else return{hcDark:e(i.hc),hcLight:e(i.hcLight??i.light),light:e(i.light),dark:e(i.dark)}};W(class extends K{constructor(){super({id:"resetGettingStartedProgress",category:L(16755,"Developer"),title:L(16757,"Reset Welcome Page Walkthrough Progress"),f1:!0,metadata:{description:L(16756,"Reset the progress of all Walkthrough steps on the Welcome Page to make them appear as if they are being viewed for the first time, providing a fresh start to the getting started experience.")}})}run(a){let i=a.get(XM),e=a.get(ce);e.store(xQt,JSON.stringify([]),0,0),e.store(CQt,JSON.stringify([]),0,0);let t=new Al("gettingStartedService",a.get(ce)),o=t.getMemento(0,0);for(let n in o)if(Object.prototype.hasOwnProperty.call(o,n))try{i.deprogressStep(n)}catch(r){console.error(r)}t.saveMemento()}});Ee(XM,idt,1);var NHi=class{getHeight(i){return 22}getTemplateId(i){return"HelpItemTemplate"}},OHi=class{constructor(){this.templateId="HelpItemTemplate"}renderTemplate(i){i.classList.add("remote-help-tree-node-item");let e=M(i,_(".remote-help-tree-node-item-icon"));return{parent:i,icon:e}}renderElement(i,e,t){let o=t.parent;M(o,t.icon),t.icon.classList.add(...i.element.iconClasses);let n=M(o,_(".help-item-label"));n.innerText=i.element.label}disposeTemplate(i){}},FHi=class{hasChildren(i){return i instanceof rdt}getChildren(i){return i instanceof rdt&&i.items?i.items:[]}},rdt=class extends x{constructor(e,t,o,n,r,s,l,c){super();this.viewModel=e;this.openerService=t;this.quickInputService=o;this.commandService=n;this.remoteExplorerService=r;this.environmentService=s;this.workspaceContextService=l;this.walkthroughsService=c;this.updateItems(),this._register(e.onDidChangeHelpInformation(()=>this.updateItems()))}createHelpItemValue(e,t){return new WHi(this.commandService,this.walkthroughsService,e.extensionDescription,typeof e.remoteName=="string"?[e.remoteName]:e.remoteName,e.virtualWorkspace,e[t])}updateItems(){let e=[],t=this.viewModel.helpInformation.filter(r=>r.getStarted);if(t.length){let r=t.map(l=>this.createHelpItemValue(l,"getStarted")),s=this.items?.find(l=>l.icon===owi)??new VHi(owi,d(13361,null),r,this.quickInputService,this.environmentService,this.openerService,this.remoteExplorerService,this.workspaceContextService,this.commandService);s.values=r,e.push(s)}let o=this.viewModel.helpInformation.filter(r=>r.documentation);if(o.length){let r=o.map(l=>this.createHelpItemValue(l,"documentation")),s=this.items?.find(l=>l.icon===nwi)??new kQt(nwi,d(13360,null),r,this.quickInputService,this.environmentService,this.openerService,this.remoteExplorerService,this.workspaceContextService);s.values=r,e.push(s)}let n=this.viewModel.helpInformation.filter(r=>r.issues);if(n.length){let r=n.map(l=>this.createHelpItemValue(l,"issues")),s=this.items?.find(l=>l.icon===rwi)??new kQt(rwi,d(13362,null),r,this.quickInputService,this.environmentService,this.openerService,this.remoteExplorerService,this.workspaceContextService);s.values=r,e.push(s)}if(e.length){let r=this.viewModel.helpInformation.map(l=>this.createHelpItemValue(l,"reportIssue")),s=this.items?.find(l=>l.icon===swi)??new BHi(swi,d(13363,null),r,this.quickInputService,this.environmentService,this.commandService,this.openerService,this.remoteExplorerService,this.workspaceContextService);s.values=r,e.push(s)}e.length&&(this.items=e)}},WHi=class{constructor(i,e,t,o,n,r){this.commandService=i;this.walkthroughService=e;this.extensionDescription=t;this.remoteAuthority=o;this.virtualWorkspace=n;this.urlOrCommandOrId=r}get description(){return this.getUrl().then(()=>this._description)}get url(){return this.getUrl()}async getUrl(){if(this._url===void 0){if(typeof this.urlOrCommandOrId=="string")if(A.parse(this.urlOrCommandOrId).authority)this._url=this.urlOrCommandOrId;else{let e=this.commandService.executeCommand(this.urlOrCommandOrId).then(o=>(this._url=o,this._url)),t=new Promise(o=>setTimeout(()=>o(""),500));this._url=await Promise.race([e,t])}else if(this.urlOrCommandOrId?.id)try{let i=`${this.extensionDescription.id}#${this.urlOrCommandOrId.id}`,e=await this.walkthroughService.getWalkthrough(i);this._description=e.title,this._url=i}catch{}}return this._url===void 0&&(this._url=""),this._url}},sdt=class{constructor(i,e,t,o,n,r,s){this.icon=i;this.label=e;this.values=t;this.quickInputService=o;this.environmentService=n;this.remoteExplorerService=r;this.workspaceContextService=s;this.iconClasses=[];this.iconClasses.push(...q.asClassNameArray(i)),this.iconClasses.push("remote-help-tree-node-item-icon")}async getActions(){return(await Promise.all(this.values.map(async i=>({label:i.extensionDescription.displayName||i.extensionDescription.identifier.value,description:await i.description??await i.url,url:await i.url,extensionDescription:i.extensionDescription})))).filter(i=>i.description)}async handleClick(){let i=this.environmentService.remoteAuthority;if(i){for(let e=0;e<this.remoteExplorerService.targetType.length;e++)if(i.startsWith(this.remoteExplorerService.targetType[e])){for(let t of this.values)if(t.remoteAuthority){for(let o of t.remoteAuthority)if(i.startsWith(o)){await this.takeAction(t.extensionDescription,await t.url);return}}}}else{let e=FR(this.workspaceContextService.getWorkspace())?.scheme;if(e){for(let t=0;t<this.remoteExplorerService.targetType.length;t++)for(let o of this.values)if(o.virtualWorkspace&&o.remoteAuthority){for(let n of o.remoteAuthority)if(this.remoteExplorerService.targetType[t].startsWith(n)&&e.startsWith(o.virtualWorkspace)){await this.takeAction(o.extensionDescription,await o.url);return}}}}if(this.values.length>1){let e=await this.getActions();if(e.length){let t=await this.quickInputService.pick(e,{placeHolder:d(13349,null)});t&&await this.takeAction(t.extensionDescription,t.url)}}else await this.takeAction(this.values[0].extensionDescription,await this.values[0].url)}},VHi=class extends sdt{constructor(e,t,o,n,r,s,l,c,u){super(e,t,o,n,r,l,c);this.openerService=s;this.commandService=u}async takeAction(e,t){if([Q.http,Q.https].includes(A.parse(t).scheme)){this.openerService.open(t,{allowCommands:!0});return}this.commandService.executeCommand("workbench.action.openWalkthrough",t)}},kQt=class extends sdt{constructor(e,t,o,n,r,s,l,c){super(e,t,o,n,r,l,c);this.openerService=s}async takeAction(e,t){await this.openerService.open(A.parse(t),{allowCommands:!0})}},BHi=class extends sdt{constructor(e,t,o,n,r,s,l,c,u){super(e,t,o,n,r,c,u);this.commandService=s;this.openerService=l}async getActions(){return Promise.all(this.values.map(async e=>({label:e.extensionDescription.displayName||e.extensionDescription.identifier.value,description:"",url:await e.url,extensionDescription:e.extensionDescription})))}async takeAction(e,t){t?await this.openerService.open(A.parse(t)):await this.commandService.executeCommand("workbench.action.openIssueReporter",[e.identifier.value])}},_be=class extends Gs{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super(t,o,n,s,r,c,l,u,v,b);this.viewModel=e;this.quickInputService=p;this.commandService=h;this.remoteExplorerService=g;this.environmentService=f;this.workspaceContextService=S;this.walkthroughsService=y}static{this.ID="~remote.helpPanel"}static{this.TITLE=L(13359,"Help and feedback")}renderBody(e){super.renderBody(e),e.classList.add("remote-help");let t=document.createElement("div");t.classList.add("remote-help-content"),e.appendChild(t),this.tree=this.instantiationService.createInstance(rp,"RemoteHelp",t,new NHi,[new OHi],new FHi,{accessibilityProvider:{getAriaLabel:n=>n.label,getWidgetAriaLabel:()=>d(13364,null)}});let o=this._register(new rdt(this.viewModel,this.openerService,this.quickInputService,this.commandService,this.remoteExplorerService,this.environmentService,this.workspaceContextService,this.walkthroughsService));this.tree.setInput(o),this._register(U.debounce(this.tree.onDidOpen,(n,r)=>r,75,!0)(n=>{n.element?.handleClick()}))}layoutBody(e,t){super.layoutBody(e,t),this.tree.layout(e,t)}};_be=I([m(2,_e),m(3,Xe),m(4,X),m(5,B),m(6,F),m(7,Bi),m(8,Je),m(9,Ue),m(10,ge),m(11,du),m(12,At),m(13,Le),m(14,nt),m(15,Pe),m(16,XM)],_be);var HHi=class{constructor(i){this.id=_be.ID;this.name=_be.TITLE;this.canToggleVisibility=!0;this.hideByDefault=!1;this.group="help@50";this.order=-10;this.ctorDescriptor=new Ft(_be,[i])}},ndt=class extends kee{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super(hH,p.onDidChangeTargetType,r,e,t,n,s,l,c,u,o,h,g);this.remoteExplorerService=p;this.helpPanelDescriptor=new HHi(this);this.helpInformation=[];this._onDidChangeHelpInformation=this._register(new E);this.onDidChangeHelpInformation=this._onDidChangeHelpInformation.event;this.hasRegisteredHelpView=!1;this.addConstantViewDescriptors([this.helpPanelDescriptor]),this._register(this.remoteSwitcher=this.instantiationService.createInstance(Zze)),this._register(this.remoteExplorerService.onDidChangeHelpInformation(v=>{this._setHelpInformation(v)})),this._setHelpInformation(this.remoteExplorerService.helpInformation);let f=ne.as(Mn.ViewsRegistry);this.remoteSwitcher.createOptionItems(f.getViews(this.viewContainer)),this._register(f.onViewsRegistered(v=>{let b=[];for(let S of v)S.viewContainer.id===hH&&b.push(...S.views);b.length>0&&this.remoteSwitcher.createOptionItems(b)})),this._register(f.onViewsDeregistered(v=>{v.viewContainer.id===hH&&this.remoteSwitcher.removeOptionItems(v.views)}))}_setHelpInformation(e){let t=[];for(let n of e)this._handleRemoteInfoExtensionPoint(n,t);this.helpInformation=t,this._onDidChangeHelpInformation.fire();let o=ne.as(Mn.ViewsRegistry);this.helpInformation.length&&!this.hasRegisteredHelpView?(o.getView(this.helpPanelDescriptor.id)||o.registerViews([this.helpPanelDescriptor],this.viewContainer),this.hasRegisteredHelpView=!0):this.hasRegisteredHelpView&&(o.deregisterViews([this.helpPanelDescriptor],this.viewContainer),this.hasRegisteredHelpView=!1)}_handleRemoteInfoExtensionPoint(e,t){Ua(e.description,"contribRemoteHelp")&&(!e.value.documentation&&!e.value.getStarted&&!e.value.issues||t.push({extensionDescription:e.description,getStarted:e.value.getStarted,documentation:e.value.documentation,reportIssue:e.value.reportIssue,issues:e.value.issues,remoteName:e.value.remoteName,virtualWorkspace:e.value.virtualWorkspace}))}getFilterOn(e){return HS(e.remoteAuthority)?e.remoteAuthority[0]:e.remoteAuthority}setFilter(e){this.remoteExplorerService.targetType=HS(e.remoteAuthority)?e.remoteAuthority:[e.remoteAuthority]}getTitle(){return d(13357,null)}};ndt=I([m(0,yi),m(1,Te),m(2,Pe),m(3,ce),m(4,B),m(5,F),m(6,Le),m(7,Xe),m(8,lt),m(9,du),m(10,Bi),m(11,se)],ndt);ne.as(Mn.ViewContainersRegistry).registerViewContainer({id:hH,title:L(13358,"Remote Explorer"),ctorDescriptor:new Ft(ndt),hideIfEmpty:!0,viewOrderDelegate:{getOrder:a=>{if(!a)return;let i=/^targets@(\d+)$/.exec(a);if(i)return-1e3;if(i=/^details(@(\d+))?$/.exec(a),i)return-500+Number(i[2]);if(i=/^help(@(\d+))?$/.exec(a),i)return-10}},icon:cco,order:4},0);var iKe=class{constructor(i,e){i.getEnvironment().then(t=>{t&&e.setPerformanceMarks("server",t.marks)})}};iKe=I([m(0,bo),m(1,YC)],iKe);var UHi=class{get lastReport(){return this._lastReport}constructor(i,e,t,o,n){this.location=e,this._isDisposed=!1,this._lastReport=t,this._currentProgressPromiseResolve=null,this._currentProgress=null,this._currentTimer=null;let r=new Promise(s=>this._currentProgressPromiseResolve=s);i.withProgress({location:e,buttons:o},s=>(this._isDisposed||(this._currentProgress=s),r),s=>n(s,this._lastReport)),this._lastReport&&this.report()}dispose(){this._isDisposed=!0,this._currentProgressPromiseResolve&&(this._currentProgressPromiseResolve(),this._currentProgressPromiseResolve=null),this._currentProgress=null,this._currentTimer&&(this._currentTimer.dispose(),this._currentTimer=null)}report(i){i&&(this._lastReport=i),this._lastReport&&this._currentProgress&&this._currentProgress.report({message:this._lastReport})}startTimer(i){this.stopTimer(),this._currentTimer=new zHi(this,i)}stopTimer(){this._currentTimer&&(this._currentTimer.dispose(),this._currentTimer=null)}},zHi=class{constructor(i,e){this._parent=i,this._completionTime=e,this._renderInterval=zI(ut,()=>this._render(),1e3),this._render()}dispose(){this._renderInterval.dispose()}_render(){let i=this._completionTime-Date.now();if(i<0)return;let e=Math.ceil(i/1e3);e===1?this._parent.report(d(13353,null,e)):this._parent.report(d(13352,null,e))}},VRo=40*1e3,oKe=class extends x{constructor(e,t,o,n,r,s,l,c){super();this._reloadWindowShown=!1;let u=e.getConnection();if(u){let v=function(P,O,V=null){return h&&(h.dispose(),h=null),P||(P=p?15:20),new UHi(t,P,V,O.map(H=>H.label),(H,G)=>{typeof H<"u"&&O[H]?O[H].callback():P===20?h=v(15,O,G):b()})},b=function(){h&&(h.dispose(),h=null)},p=!1;this._register(r.onShow(()=>p=!0)),this._register(r.onHide(()=>p=!1));let h=null,g=null,f=this._register(new me),S="",y=0,w=0,k={label:d(13354,null),callback:()=>{g?.skipWait()}},T={label:d(13355,null),callback:()=>{c.publicLog2("remoteReconnectionReload",{remoteName:gb(l.remoteAuthority),reconnectionToken:S,millisSinceLastIncomingData:Date.now()-y,attempt:w}),n.executeCommand(VZ.ID)}};this._register(u.onDidStateChange(P=>{switch(h?.stopTimer(),f.clear(),P.type){case 0:S=P.reconnectionToken,y=Date.now()-P.millisSinceLastIncomingData,w=0,c.publicLog2("remoteConnectionLost",{remoteName:gb(l.remoteAuthority),reconnectionToken:P.reconnectionToken}),(h||P.millisSinceLastIncomingData>VRo)&&(h||(h=v(null,[k,T])),h.report(d(13348,null)));break;case 1:h&&(g=P,h=v(null,[k,T]),h.startTimer(Date.now()+1e3*P.durationSeconds));break;case 2:S=P.reconnectionToken,y=Date.now()-P.millisSinceLastIncomingData,w=P.attempt,c.publicLog2("remoteReconnectionRunning",{remoteName:gb(l.remoteAuthority),reconnectionToken:P.reconnectionToken,millisSinceLastIncomingData:P.millisSinceLastIncomingData,attempt:P.attempt}),(h||P.millisSinceLastIncomingData>VRo)&&(h=v(null,[T]),h.report(d(13351,null)),f.value=r.onShow(()=>{h&&h.location===20&&(h=v(15,[T],h.lastReport))}));break;case 3:S=P.reconnectionToken,y=Date.now()-P.millisSinceLastIncomingData,w=P.attempt,c.publicLog2("remoteReconnectionPermanentFailure",{remoteName:gb(l.remoteAuthority),reconnectionToken:P.reconnectionToken,millisSinceLastIncomingData:P.millisSinceLastIncomingData,attempt:P.attempt,handled:P.handled}),b(),P.handled?s.info("Error handled: Not showing a notification for the error."):this._reloadWindowShown||(this._reloadWindowShown=!0,o.confirm({type:bt.Error,message:d(13350,null),primaryButton:d(13356,null)}).then(O=>{O.confirmed&&n.executeCommand(VZ.ID)}));break;case 4:S=P.reconnectionToken,y=Date.now()-P.millisSinceLastIncomingData,w=P.attempt,c.publicLog2("remoteConnectionGain",{remoteName:gb(l.remoteAuthority),reconnectionToken:P.reconnectionToken,millisSinceLastIncomingData:P.millisSinceLastIncomingData,attempt:P.attempt}),b();break}}))}}};oKe=I([m(0,bo),m(1,Fo),m(2,at),m(3,ge),m(4,Ue),m(5,se),m(6,At),m(7,Te)],oKe);var Sg=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,P,O){super();this.statusbarService=e;this.environmentService=t;this.labelService=o;this.contextKeyService=n;this.menuService=r;this.quickInputService=s;this.commandService=l;this.extensionService=c;this.remoteAgentService=u;this.remoteAuthorityResolverService=p;this.hostService=h;this.workspaceContextService=g;this.logService=f;this.extensionGalleryService=v;this.telemetryService=b;this.productService=S;this.extensionManagementService=y;this.extensionsWorkbenchService=w;this.dialogService=k;this.lifecycleService=T;this.openerService=P;this.configurationService=O;this.virtualWorkspaceLocation=void 0;this.connectionState=void 0;this.connectionToken=void 0;this.networkState=void 0;this.measureNetworkConnectionLatencyScheduler=void 0;this.loggedInvalidGroupNames=Object.create(null);this._remoteExtensionMetadata=void 0;this.remoteMetadataInitialized=!1;this._onDidChangeEntries=this._register(new E);this.onDidChangeEntries=this._onDidChangeEntries.event;this.unrestrictedRemoteIndicatorMenu=this._register(this.menuService.createMenu(D.StatusBarWindowIndicatorMenu,this.contextKeyService)),this.remoteIndicatorMenu=this._register(this.menuService.createMenu(D.StatusBarRemoteIndicatorMenu,this.contextKeyService)),this.connectionStateContextKey=new Y("remoteConnectionState","").bindTo(this.contextKeyService),this.remoteAuthority?(this.connectionState="initializing",this.connectionStateContextKey.set(this.connectionState)):this.updateVirtualWorkspaceLocation(),this.registerActions(),this.registerListeners(),this.updateWhenInstalledExtensionsRegistered(),this.updateRemoteStatusIndicator()}static{this.ID="workbench.contrib.remoteStatusIndicator"}static{this.REMOTE_ACTIONS_COMMAND_ID="workbench.action.remote.showMenu"}static{this.CLOSE_REMOTE_COMMAND_ID="workbench.action.remote.close"}static{this.SHOW_CLOSE_REMOTE_COMMAND_ID=!Wt}static{this.INSTALL_REMOTE_EXTENSIONS_ID="workbench.action.remote.extensions"}static{this.DEFAULT_REMOTE_STATUS_LABEL="$(remote)"}static{this.REMOTE_STATUS_LABEL_MAX_LENGTH=40}static{this.REMOTE_CONNECTION_LATENCY_SCHEDULER_DELAY=60*1e3}static{this.REMOTE_CONNECTION_LATENCY_SCHEDULER_FIRST_RUN_DELAY=10*1e3}get remoteExtensionMetadata(){if(!this._remoteExtensionMetadata){let e={...this.productService.remoteExtensionTips,...this.productService.virtualWorkspaceExtensionTips};this._remoteExtensionMetadata=Object.values(e).filter(t=>t.startEntry!==void 0).map(t=>({id:t.extensionId,installed:!1,friendlyName:t.friendlyName,isPlatformCompatible:!1,dependencies:[],helpLink:t.startEntry?.helpLink??"",startConnectLabel:t.startEntry?.startConnectLabel??"",startCommand:t.startEntry?.startCommand??"",priority:t.startEntry?.priority??10,supportedPlatforms:t.supportedPlatforms})),this.remoteExtensionMetadata.sort((t,o)=>t.priority-o.priority)}return this._remoteExtensionMetadata}get remoteAuthority(){return this.environmentService.remoteAuthority}registerActions(){let e=L(13415,"Remote"),t=this;this._register(W(class extends K{constructor(){super({id:Sg.REMOTE_ACTIONS_COMMAND_ID,category:e,title:L(13419,"Show Remote Menu"),f1:!0,keybinding:{weight:200,primary:2605}});this.run=()=>t.showRemoteMenu()}})),Sg.SHOW_CLOSE_REMOTE_COMMAND_ID&&(this._register(W(class extends K{constructor(){super({id:Sg.CLOSE_REMOTE_COMMAND_ID,category:e,title:L(13416,"Close Remote Connection"),f1:!0,precondition:C.or(yb,WR)});this.run=()=>t.hostService.openWindow({forceReuseWindow:!0,remoteAuthority:null})}})),this.remoteAuthority&&ve.appendMenuItem(D.MenubarFileMenu,{group:"6_close",command:{id:Sg.CLOSE_REMOTE_COMMAND_ID,title:d(13410,null)},order:3.5})),this.extensionGalleryService.isEnabled()&&this._register(W(class extends K{constructor(){super({id:Sg.INSTALL_REMOTE_EXTENSIONS_ID,category:e,title:L(13417,"Install Remote Development Extensions"),f1:!0});this.run=(n,r)=>n.get(Hi).openSearch("@recommended:remotes")}}))}registerListeners(){let e=()=>{this.remoteMenuActionsGroups=void 0,this.updateRemoteStatusIndicator()};this._register(this.unrestrictedRemoteIndicatorMenu.onDidChange(e)),this._register(this.remoteIndicatorMenu.onDidChange(e)),this._register(this.labelService.onDidChangeFormatters(()=>this.updateRemoteStatusIndicator()));let t=this.environmentService.options?.windowIndicator;if(t&&t.onDidChange&&this._register(t.onDidChange(()=>this.updateRemoteStatusIndicator())),this.remoteAuthority){let o=this.remoteAgentService.getConnection();o&&this._register(o.onDidStateChange(n=>{switch(n.type){case 0:case 2:case 1:this.setConnectionState("reconnecting");break;case 3:this.setConnectionState("disconnected");break;case 4:this.setConnectionState("connected");break}}))}else this._register(this.workspaceContextService.onDidChangeWorkbenchState(()=>{this.updateVirtualWorkspaceLocation(),this.updateRemoteStatusIndicator()}));Wt&&this._register(U.any(this._register(new Gn(ut,"online")).event,this._register(new Gn(ut,"offline")).event)(()=>this.setNetworkState(navigator.onLine?"online":"offline"))),this._register(this.extensionService.onDidChangeExtensions(async o=>{for(let n of o.added){let r=this.remoteExtensionMetadata.findIndex(s=>Ii.equals(s.id,n.identifier));r>-1&&(this.remoteExtensionMetadata[r].installed=!0)}})),this._register(this.extensionManagementService.onDidUninstallExtension(async o=>{let n=this.remoteExtensionMetadata.findIndex(r=>Ii.equals(r.id,o.identifier.id));n>-1&&(this.remoteExtensionMetadata[n].installed=!1)}))}async initializeRemoteMetadata(){if(this.remoteMetadataInitialized)return;let e=u_(om);for(let t=0;t<this.remoteExtensionMetadata.length;t++){let o=this.remoteExtensionMetadata[t].id,n=this.remoteExtensionMetadata[t].supportedPlatforms,r=!!(await this.extensionManagementService.getInstalled()).find(s=>Ii.equals(s.identifier.id,o));this.remoteExtensionMetadata[t].installed=r,r?this.remoteExtensionMetadata[t].isPlatformCompatible=!0:n&&!n.includes(e)?this.remoteExtensionMetadata[t].isPlatformCompatible=!1:this.remoteExtensionMetadata[t].isPlatformCompatible=!0}this.remoteMetadataInitialized=!0,this._onDidChangeEntries.fire(),this.updateRemoteStatusIndicator()}updateVirtualWorkspaceLocation(){this.virtualWorkspaceLocation=FR(this.workspaceContextService.getWorkspace())}async updateWhenInstalledExtensionsRegistered(){await this.extensionService.whenInstalledExtensionsRegistered();let e=this.remoteAuthority;e&&(async()=>{try{let{authority:t}=await this.remoteAuthorityResolverService.resolveAuthority(e);this.connectionToken=t.connectionToken,this.setConnectionState("connected")}catch{this.setConnectionState("disconnected")}})(),this.updateRemoteStatusIndicator(),this.initializeRemoteMetadata()}setConnectionState(e){this.connectionState!==e&&(this.connectionState=e,this.connectionState==="reconnecting"?this.connectionStateContextKey.set("disconnected"):this.connectionStateContextKey.set(this.connectionState),this.updateRemoteStatusIndicator(),e==="connected"&&this.scheduleMeasureNetworkConnectionLatency())}scheduleMeasureNetworkConnectionLatency(){!this.remoteAuthority||this.measureNetworkConnectionLatencyScheduler||(this.measureNetworkConnectionLatencyScheduler=this._register(new Dt(()=>this.measureNetworkConnectionLatency(),Sg.REMOTE_CONNECTION_LATENCY_SCHEDULER_DELAY)),this.measureNetworkConnectionLatencyScheduler.schedule(Sg.REMOTE_CONNECTION_LATENCY_SCHEDULER_FIRST_RUN_DELAY))}async measureNetworkConnectionLatency(){if(this.hostService.hasFocus&&this.networkState!=="offline"){let e=await DF.measure(this.remoteAgentService);e&&(e.high?this.setNetworkState("high-latency"):this.networkState==="high-latency"&&this.setNetworkState("online"))}this.measureNetworkConnectionLatencyScheduler?.schedule()}setNetworkState(e){if(this.networkState!==e){let t=this.networkState;this.networkState=e,e==="high-latency"&&this.logService.warn(`Remote network connection appears to have high latency (${DF.latency?.current?.toFixed(2)}ms last, ${DF.latency?.average?.toFixed(2)}ms average)`),this.connectionToken&&(e==="online"&&t==="high-latency"?this.logNetworkConnectionHealthTelemetry(this.connectionToken,"good"):e==="high-latency"&&t==="online"&&this.logNetworkConnectionHealthTelemetry(this.connectionToken,"poor")),this.updateRemoteStatusIndicator()}}logNetworkConnectionHealthTelemetry(e,t){this.telemetryService.publicLog2("remoteConnectionHealth",{remoteName:gb(this.remoteAuthority),reconnectionToken:e,connectionHealth:t})}validatedGroup(e){return e.match(/^(remote|virtualfs)_(\d\d)_(([a-z][a-z0-9+.-]*)_(.*))$/)?!0:(this.loggedInvalidGroupNames[e]||(this.loggedInvalidGroupNames[e]=!0,this.logService.warn(`Invalid group name used in "statusBar/remoteIndicator" menu contribution: ${e}. Entries ignored. Expected format: 'remote_$ORDER_$REMOTENAME_$GROUPING or 'virtualfs_$ORDER_$FILESCHEME_$GROUPING.`)),!1)}getRemoteMenuActions(e){return(!this.remoteMenuActionsGroups||e)&&(this.remoteMenuActionsGroups=this.remoteIndicatorMenu.getActions().filter(t=>this.validatedGroup(t[0])).concat(this.unrestrictedRemoteIndicatorMenu.getActions())),this.remoteMenuActionsGroups}updateRemoteStatusIndicator(){let e=this.environmentService.options?.windowIndicator;if(e){let t=e.label.trim();t.startsWith("$(")||(t=`$(remote) ${t}`),this.renderRemoteStatusIndicator(JN(t,Sg.REMOTE_STATUS_LABEL_MAX_LENGTH),e.tooltip,e.command);return}if(this.remoteAuthority){let t=this.labelService.getHostLabel(Q.vscodeRemote,this.remoteAuthority)||this.remoteAuthority;switch(this.connectionState){case"initializing":this.renderRemoteStatusIndicator(d(13407,null),d(13407,null),void 0,!0);break;case"reconnecting":this.renderRemoteStatusIndicator(`${d(13408,null,JN(t,Sg.REMOTE_STATUS_LABEL_MAX_LENGTH))}`,void 0,void 0,!0);break;case"disconnected":this.renderRemoteStatusIndicator(`$(alert) ${d(13406,null,JN(t,Sg.REMOTE_STATUS_LABEL_MAX_LENGTH))}`);break;default:{let o=new Ie("",{isTrusted:!0,supportThemeIcons:!0}),n=this.labelService.getHostTooltip(Q.vscodeRemote,this.remoteAuthority);n?o.appendMarkdown(n):o.appendText(d(13409,null,t)),this.renderRemoteStatusIndicator(`$(remote) ${JN(t,Sg.REMOTE_STATUS_LABEL_MAX_LENGTH)}`,o)}}return}if(this.virtualWorkspaceLocation){let t=this.labelService.getHostLabel(this.virtualWorkspaceLocation.scheme,this.virtualWorkspaceLocation.authority);if(t){let o=new Ie("",{isTrusted:!0,supportThemeIcons:!0}),n=this.labelService.getHostTooltip(this.virtualWorkspaceLocation.scheme,this.virtualWorkspaceLocation.authority);n?o.appendMarkdown(n):o.appendText(d(13427,null,t)),(!Wt||this.remoteAuthority)&&(o.appendMarkdown(`

`),o.appendMarkdown(d(13428,null,`command:${FB}`))),this.renderRemoteStatusIndicator(`$(remote) ${JN(t,Sg.REMOTE_STATUS_LABEL_MAX_LENGTH)}`,o);return}}this.renderRemoteStatusIndicator(Sg.DEFAULT_REMOTE_STATUS_LABEL,d(13413,null))}renderRemoteStatusIndicator(e,t,o,n){let{text:r,tooltip:s,ariaLabel:l}=this.withNetworkStatus(e,t,n),c={name:d(13424,null),kind:this.networkState==="offline"?"offline":r!==Sg.DEFAULT_REMOTE_STATUS_LABEL?"remote":void 0,ariaLabel:l,text:r,showProgress:n,tooltip:s,command:o??Sg.REMOTE_ACTIONS_COMMAND_ID};this.remoteStatusEntry?this.remoteStatusEntry.update(c):this.remoteStatusEntry=this.statusbarService.addEntry(c,"status.host",0,Number.POSITIVE_INFINITY)}withNetworkStatus(e,t,o){let n=e,r=t,s=xz(n);function l(){return!o&&e.startsWith(Sg.DEFAULT_REMOTE_STATUS_LABEL)?e.replace(Sg.DEFAULT_REMOTE_STATUS_LABEL,"$(alert)"):e}switch(this.networkState){case"offline":{let c=d(13412,null);n=l(),r=this.appendTooltipLine(r,c),s=`${s}, ${c}`;break}case"high-latency":n=l(),r=this.appendTooltipLine(r,d(13411,null,DF.latency?.current?.toFixed(2),DF.latency?.average?.toFixed(2)));break}return{text:n,tooltip:r,ariaLabel:s}}appendTooltipLine(e,t){let o;return typeof e=="string"?o=new Ie(e,{isTrusted:!0,supportThemeIcons:!0}):o=e??new Ie("",{isTrusted:!0,supportThemeIcons:!0}),o.value.length>0&&o.appendMarkdown(`

`),o.appendMarkdown(t),o}async installExtension(e,t){try{await this.extensionsWorkbenchService.install(e,{isMachineScoped:!1,donotIncludePackAndDependencies:!1,context:{[O5]:!0}})}catch(o){if(!this.lifecycleService.willShutdown){let{confirmed:n}=await this.dialogService.confirm({type:bt.Error,message:d(13426,null,t),detail:o&&!ao(o)?xn(o):void 0,primaryButton:d(13425,null)});if(n)return this.installExtension(e,t)}throw o}}async runRemoteStartCommand(e,t){await QGi(async()=>{let o=await this.extensionService.getExtension(e);if(!o)throw Error("Failed to find installed remote extension");return o},300,10),this.commandService.executeCommand(t),this.telemetryService.publicLog2("workbenchActionExecuted",{id:"remoteInstallAndRun",detail:e,from:"remote indicator"})}showRemoteMenu(){let e=s=>{if(s.item.category)return typeof s.item.category=="string"?s.item.category:s.item.category.value},t=()=>{if(this.remoteAuthority)return new RegExp(`^remote_\\d\\d_${gb(this.remoteAuthority)}_`);if(this.virtualWorkspaceLocation)return new RegExp(`^virtualfs_\\d\\d_${this.virtualWorkspaceLocation.scheme}_`)},o=()=>{let s=this.getRemoteMenuActions(!0),l=[],c=t();c&&(s=s.sort((g,f)=>{let v=c.test(g[0]),b=c.test(f[0]);return v!==b?v?-1:1:g[0]!==""&&f[0]===""?-1:g[0]===""&&f[0]!==""?1:g[0].localeCompare(f[0])}));let u;for(let g of s){let f=!1;for(let v of g[1])if(v instanceof Lo){if(!f){let S=e(v);S!==u&&(l.push({type:"separator",label:S}),u=S),f=!0}let b=typeof v.item.title=="string"?v.item.title:v.item.title.value;l.push({type:"item",id:v.item.id,label:b})}}if(this.configurationService.getValue("workbench.remoteIndicator.showExtensionRecommendations")&&this.extensionGalleryService.isEnabled()&&this.remoteMetadataInitialized){let g=[];for(let f of this.remoteExtensionMetadata)if(!f.installed&&f.isPlatformCompatible){let v=f.startConnectLabel,b=[{iconClass:q.asClassName(Ug),tooltip:d(13420,null)}];g.push({type:"item",id:f.id,label:v,buttons:b})}l.push({type:"separator",label:d(13421,null)}),l.push(...g)}l.push({type:"separator"});let h=l.length;return Sg.SHOW_CLOSE_REMOTE_COMMAND_ID&&(this.remoteAuthority?(l.push({type:"item",id:Sg.CLOSE_REMOTE_COMMAND_ID,label:d(13404,null)}),this.connectionState==="disconnected"&&l.push({type:"item",id:VZ.ID,label:d(13414,null)})):this.virtualWorkspaceLocation&&l.push({type:"item",id:Sg.CLOSE_REMOTE_COMMAND_ID,label:d(13405,null)})),l.length===h&&l.pop(),l},n=new N,r=n.add(this.quickInputService.createQuickPick({useSeparators:!0}));r.placeholder=d(13423,null),r.items=o(),r.sortByLabel=!1,r.canSelectMany=!1,n.add(U.once(r.onDidAccept)((async s=>{let l=r.selectedItems;if(l.length===1){let c=l[0].id,u=this.remoteExtensionMetadata.find(p=>Ii.equals(p.id,c));if(u){r.items=[],r.busy=!0,r.placeholder=d(13422,null);try{await this.installExtension(u.id,l[0].label)}catch{return}finally{r.hide()}await this.runRemoteStartCommand(u.id,u.startCommand)}else this.telemetryService.publicLog2("workbenchActionExecuted",{id:c,from:"remote indicator"}),this.commandService.executeCommand(c),r.hide()}}))),n.add(U.once(r.onDidTriggerItemButton)(async s=>{let l=this.remoteExtensionMetadata.find(c=>Ii.equals(c.id,s.item.id));l&&await this.openerService.open(A.parse(l.helpLink))})),n.add(this.unrestrictedRemoteIndicatorMenu.onDidChange(()=>r.items=o())),n.add(this.remoteIndicatorMenu.onDidChange(()=>r.items=o())),n.add(r.onDidHide(()=>n.dispose())),this.remoteMetadataInitialized||(r.busy=!0,n.add(this.onDidChangeEntries(()=>{r.busy=!1,r.items=o()}))),r.show()}};Sg=I([m(0,kr),m(1,cd),m(2,rt),m(3,X),m(4,Kt),m(5,Ue),m(6,ge),m(7,lt),m(8,bo),m(9,Uc),m(10,Zt),m(11,Pe),m(12,se),m(13,fa),m(14,Te),m(15,tt),m(16,Cs),m(17,Hi),m(18,at),m(19,ji),m(20,Je),m(21,B)],Sg);ne.as(Jt.Configuration).registerConfiguration({...Ud,properties:{"workbench.remoteIndicator.showExtensionRecommendations":{type:"boolean",markdownDescription:d(13418,null),default:!0}}});var BRo="remote.unsupportedConnectionChoice",HRo="workbench.banner.remote.unsupportedConnection.dismissed",nKe=class{constructor(i,e,t,o,n,r,s,l,c){this._remoteAgentService=i;this._environmentService=e;this._telemetryService=t;this.bannerService=o;this.dialogService=n;this.openerService=r;this.hostService=s;this.storageService=l;this.productService=c;this._environmentService.remoteAuthority&&this._checkInitialRemoteConnectionHealth()}async _confirmConnection(){let i;(l=>(l[l.Allow=1]="Allow",l[l.LearnMore=2]="LearnMore",l[l.Cancel=0]="Cancel"))(i||={});let{result:e,checkboxChecked:t}=await this.dialogService.prompt({type:bt.Warning,message:d(13369,null,this.productService.nameLong),buttons:[{label:d(13365,null),run:()=>1},{label:d(13366,null),run:async()=>(await this.openerService.open("https://aka.ms/vscode-remote/faq/old-linux"),2)}],cancelButton:{run:()=>0},checkbox:{label:d(13367,null)}});if(e===2)return await this._confirmConnection();let o=e===1;return o&&t&&this.storageService.store(`${BRo}.${this._environmentService.remoteAuthority}`,o,0,1),o}async _checkInitialRemoteConnectionHealth(){try{let i=await this._remoteAgentService.getRawEnvironment();if(i&&i.isUnsupportedGlibc){let e=this.storageService.getBoolean(`${BRo}.${this._environmentService.remoteAuthority}`,0);if(e===void 0&&(e=await this._confirmConnection()),e){let t=this.storageService.get(`${HRo}`,0)??"";if(t.slice(0,t.lastIndexOf("."))!==this.productService.version.slice(0,this.productService.version.lastIndexOf("."))){let n=[{label:d(13368,null),href:"https://aka.ms/vscode-remote/faq/old-linux"}];this.bannerService.show({id:"unsupportedGlibcWarning.banner",message:d(13370,null,this.productService.nameLong),actions:n,icon:R.warning,closeLabel:`Do not show again in v${this.productService.version}`,onClose:()=>{this.storageService.store(`${HRo}`,this.productService.version,0,1)}})}}else{this.hostService.openWindow({forceReuseWindow:!0,remoteAuthority:null});return}}this._telemetryService.publicLog2("remoteConnectionSuccess",{web:Wt,connectionTimeMs:await this._remoteAgentService.getConnection()?.getInitialConnectionTimeMs(),remoteName:gb(this._environmentService.remoteAuthority),tunnelName:Yxt(this._environmentService.remoteAuthority)}),await this._measureExtHostLatency()}catch(i){this._telemetryService.publicLog2("remoteConnectionFailure",{web:Wt,connectionTimeMs:await this._remoteAgentService.getConnection()?.getInitialConnectionTimeMs(),remoteName:gb(this._environmentService.remoteAuthority),message:i?i.message:""})}}async _measureExtHostLatency(){let i=await DF.measure(this._remoteAgentService);i!==void 0&&this._telemetryService.publicLog2("remoteConnectionLatency",{web:Wt,remoteName:gb(this._environmentService.remoteAuthority),latencyMs:i.current})}};nKe=I([m(0,bo),m(1,At),m(2,Te),m(3,FD),m(4,at),m(5,Je),m(6,Zt),m(7,ce),m(8,tt)],nKe);var rKe=ne.as(Qi.Workbench);It(Ebe.ID,Ebe,St.BlockRestore);It(Tbe.ID,Tbe,St.BlockRestore);rKe.registerWorkbenchContribution(oKe,4);It(Sg.ID,Sg,St.BlockStartup);rKe.registerWorkbenchContribution(ULe,3);rKe.registerWorkbenchContribution(zLe,4);rKe.registerWorkbenchContribution(KLe,4);rKe.registerWorkbenchContribution(iKe,4);rKe.registerWorkbenchContribution(nKe,3);var GHi=class a{static{this._grammars={}}constructor(i){Object.keys(a._grammars).length||this.fillModeScopeMap(i)}fillModeScopeMap(i){i.forEach(e=>{e.value.forEach(t=>{t.language&&t.scopeName&&(a._grammars[t.language]=t.scopeName)})})}getGrammar(i){return a._grammars[i]}},EQt=class a extends Di{constructor(e){super(e);this._lastGrammarContributions=null;this._lastExtensionService=null;this.emmetActionName=e.actionName}static{this.emmetSupportedModes=["html","css","xml","xsl","haml","jade","jsx","slim","scss","sass","less","stylus","styl","svg"]}_withGrammarContributions(e){return this._lastExtensionService!==e&&(this._lastExtensionService=e,this._lastGrammarContributions=e.readExtensionPointContributions(NH).then(t=>new GHi(t))),this._lastGrammarContributions||Promise.resolve(null)}run(e,t){let o=e.get(lt),n=e.get(ge);return this._withGrammarContributions(o).then(r=>{if(this.id==="editor.emmet.action.expandAbbreviation"&&r)return n.executeCommand("emmet.expandAbbreviation",a.getLanguage(t,r))})}static getLanguage(e,t){let o=e.getModel(),n=e.getSelection();if(!o||!n)return null;let r=n.getStartPosition();o.tokenization.tokenizeIfCheap(r.lineNumber);let l=o.getLanguageIdAtPosition(r.lineNumber,r.column).split(".").pop();return l?{language:l,parentMode:(()=>{let u=t.getGrammar(l);if(!u)return l;let p=u.split(".");if(p.length<2)return l;for(let h=1;h<p.length;h++){let g=p[p.length-h];if(this.emmetSupportedModes.indexOf(g)!==-1)return g}return l})()}:null}};var qHi=class extends EQt{constructor(){super({id:"editor.emmet.action.expandAbbreviation",label:L(10084,"Emmet: Expand Abbreviation"),precondition:pe.writable,actionName:"expand_abbreviation",kbOpts:{primary:2,kbExpr:C.and(pe.editorTextFocus,pe.tabDoesNotMoveFocus,C.has("config.emmet.triggerExpansionOnTab")),weight:100},menuOpts:{menuId:D.MenubarEditMenu,group:"5_insert",title:d(10085,null),order:3}})}};ni(qHi);var $Hi=class extends K{constructor(){super({id:"editor.action.toggleScreenReaderAccessibilityMode",title:L(8790,"Toggle Screen Reader Accessibility Mode"),metadata:{description:L(8791,"Toggles an optimized mode for usage with screen readers, braille devices, and other assistive technologies.")},f1:!0,keybinding:[{primary:2083,weight:210,when:ox},{primary:1595,linux:{primary:1598},weight:210}]})}async run(i){let e=i.get(Oi),t=i.get(B),o=e.isScreenReaderOptimized();t.updateValue("editor.accessibilitySupport",o?"off":"on",2),en(o?xc.screenReaderModeDisabled:xc.screenReaderModeEnabled)}};W($Hi);var jHi=class extends K{constructor(){super({id:"editor.action.announceCursorPosition",title:L(8787,"Announce Cursor Position"),f1:!0,metadata:{description:L(8788,"Announce the current cursor position (line and column) via screen reader.")},keybinding:{primary:3621,weight:210,when:C.and(pe.editorTextFocus,$a)}})}async run(i){let t=i.get(qt).getFocusedCodeEditor();if(!t)return;let o=t.getPosition(),n=t.getModel();if(!o||!n)return;let r=n.getOptions().tabSize,s=n.getLineContent(o.lineNumber),l=fl.visibleColumnFromColumn(s,o.column,r)+1;en(d(8789,null,o.lineNumber,l))}};W(jHi);var TQt=class extends x{constructor(){super(),this._register(npe.addImplementation(90,"editor",async i=>{let e=i.get(qt),t=i.get(ou),o=i.get(F),n=i.get(ge),r=e.getActiveCodeEditor()||e.getFocusedCodeEditor();r||(await n.executeCommand(cW),r=e.getActiveCodeEditor()),t.show(o.createInstance(adt,r))}))}},adt=class extends x{constructor(e,t,o,n,r){super();this._editor=e;this._keybindingService=t;this._contextKeyService=o;this.accessibilityService=n;this._configurationService=r;this.id="editor";this.options={type:"help",readMoreUrl:"https://go.microsoft.com/fwlink/?linkid=851010"};this.verbositySettingKey="accessibility.verbosity.editor"}onClose(){this._editor.focus()}provideContent(){let e=this._editor.getOptions(),t=[];e.get(70)?e.get(104)?t.push(xc.readonlyDiffEditor):t.push(xc.editableDiffEditor):e.get(104)?t.push(xc.readonlyEditor):t.push(xc.editableEditor),this.accessibilityService.isScreenReaderOptimized()&&this._configurationService.getValue("accessibility.windowTitleOptimized")?t.push(xc.defaultWindowTitleIncludesEditorState):t.push(xc.defaultWindowTitleExcludingEditorState),t.push(xc.toolbar);let o=Rbn(this._keybindingService,this._contextKeyService,this._editor);o&&t.push(o),t.push(xc.listSignalSounds),t.push(xc.listAlerts),t.push(xc.announceCursorPosition),t.push(xc.focusNotifications);let n=Lbn(this._keybindingService,this._contextKeyService);n&&t.push(n);let r=QHi(this._keybindingService,this._contextKeyService,this._editor);return r&&t.push(r),t.push(xc.suggestActions),t.push(xc.acceptSuggestAction),t.push(xc.toggleSuggestionFocus),e.get(131).enabled&&t.push(xc.stickScroll),e.get(164)?t.push(xc.tabFocusModeOnMsg):t.push(xc.tabFocusModeOffMsg),t.push(xc.codeFolding),t.push(xc.intellisense),t.push(xc.showOrFocusHover),t.push(xc.goToSymbol),t.push(xc.startDebugging),t.push(xc.setBreakpoint),t.push(xc.debugExecuteSelection),t.push(xc.addToWatch),t.join(`
`)}};adt=I([m(1,_e),m(2,X),m(3,Oi),m(4,B)],adt);function QHi(a,i,e){if(i.getContext(e.getDomNode()).getValue(_c.activeEditorHasCommentingRange.key))return[fL.intro,fL.addComment,fL.nextCommentThread,fL.previousCommentThread,fL.nextRange,fL.previousRange].join(`
`)}function Lbn(a,i){if(ie.enabled.getValue(i))return[xc.quickChat,xc.startInlineChat].join(`
`)}function Rbn(a,i,e){let t=i.getContext(e.getDomNode());if(t.getValue(Kg.key))return xc.chatEditorModification+`
`+xc.chatEditActions;if(t.getValue(Gk.key))return xc.chatEditorRequestInProgress}var _Qt=class{constructor(){this.priority=105;this.name="diff-editor";this.when=wV.create("isInDiffEditor",!0);this.type="help"}getProvider(i){let e=i.get(ee),t=i.get(qt),o=i.get(_e),n=i.get(X);if(!(e.activeTextEditorControl instanceof op))return;let r=t.getActiveCodeEditor()||t.getFocusedCodeEditor();if(!r)return;let s=d(8799,null,"<keybinding:diffEditor.switchSide>"),l=d(8801,null),c=["accessibility.signals.diffLineDeleted","accessibility.signals.diffLineInserted","accessibility.signals.diffLineModified"],u=[d(8797,null),d(8798,null,"<keybinding:"+Lz.id+">","<keybinding:"+cce.id+">"),s,l,d(8800,null,c.join(", "))],p=QHi(o,n,r);return p&&u.push(p),new xp("diffEditor",{type:"help"},()=>u.join(`
`),()=>r.focus(),"accessibility.verbosity.diffEditor")}};var sKe=class extends x{constructor(e,t,o,n){super();this._diffEditor=e;this._instantiationService=t;this._textResourceConfigurationService=o;this._notificationService=n;if(!(this._diffEditor instanceof dL)){let l=ui(this,c=>this._diffEditor.onDidUpdateDiff(c),()=>this._diffEditor.getDiffComputationResult()).map(c=>c&&!c.identical&&c.changes2.length===0);this._register(il((c,u)=>{if(l.read(c)){let p=u.add(this._instantiationService.createInstance(Hme,this._diffEditor.getModifiedEditor(),d(8803,null),null));u.add(p.onClick(()=>{this._textResourceConfigurationService.updateValue(this._diffEditor.getModel().modified.uri,"diffEditor.ignoreTrimWhitespace",!1)})),p.render()}})),this._register(this._diffEditor.onDidUpdateDiff(()=>{let c=this._diffEditor.getDiffComputationResult();c&&c.quitEarly&&this._notificationService.prompt(ft.Warning,d(8802,null,this._diffEditor.maxComputationTime),[{label:d(8804,null),run:()=>{this._textResourceConfigurationService.updateValue(this._diffEditor.getModel().modified.uri,"diffEditor.maxComputationTime",0)}}],{})}))}}static{this.ID="editor.contrib.diffEditorHelper"}};sKe=I([m(1,F),m(2,Fn),m(3,Ne)],sKe);jgt(sKe.ID,sKe);ne.as(Ep.ConfigurationMigration).registerConfigurationMigrations([{key:"diffEditor.experimental.collapseUnchangedRegions",migrateFn:(a,i)=>[["diffEditor.hideUnchangedRegions.enabled",{value:a}],["diffEditor.experimental.collapseUnchangedRegions",{value:void 0}]]}]);ga.register(new _Qt);var aKe=class extends x{constructor(e,t){super();this._instantiationService=t;this._instantiated=!1;this._register(e.onWillCreateCodeEditor(()=>this._instantiate())),this._register(e.onWillCreateDiffEditor(()=>this._instantiate())),(e.listCodeEditors().length>0||e.listDiffEditors().length>0)&&this._instantiate()}static{this.ID="workbench.contrib.editorFeaturesInstantiator"}_instantiate(){if(this._instantiated)return;this._instantiated=!0;let e=T9i();for(let t of e)try{let o=this._instantiationService.createInstance(t);typeof o.dispose=="function"&&this._register(o)}catch(o){mt(o)}}};aKe=I([m(0,qt),m(1,F)],aKe);It(aKe.ID,aKe,St.BlockRestore);var YHi=class{constructor(){this.priority=105;this.name="editor-find";this.when=yCt;this.type="help"}getProvider(i){let e=i.get(qt),t=e.getActiveCodeEditor()||e.getFocusedCodeEditor();if(!t)return;let o=$f.get(t);if(o)return new XHi(o)}},XHi=class extends x{constructor(e){super();this._findController=e;this.id="editorFindHelp";this.verbositySettingKey="accessibility.verbosity.find";this.options={type:"help"}}onClose(){this._findController.focusLastElement()}provideContent(){let e=this._findController.getState(),t=e.isReplaceRevealed,o=e.searchString,n=e.matchesCount,r=e.matchesPosition,s=[];if(t){s.push(d(8870,null)),s.push(d(8863,null)),s.push(""),s.push(d(8919,null)),o?(s.push(d(8902,null,o)),n!==void 0&&r!==void 0&&(n===0?s.push(d(8892,null)):s.push(d(8891,null,r,n)))):s.push(d(8894,null));let l=e.replaceString;l?s.push(d(8901,null,l)):s.push(d(8893,null)),s.push(""),s.push(d(8865,null)),s.push(d(8864,null)),s.push(""),s.push(d(8875,null)),s.push(d(8874,null)),s.push(d(8871,null)),s.push(d(8872,null)),s.push(d(8873,null)),s.push(""),s.push(d(8869,null)),s.push(d(8866,null)),s.push(d(8867,null)),s.push(d(8868,null)),s.push(""),s.push(d(8876,null)),s.push(""),s.push(d(8880,null)),s.push(d(8877,null)),s.push(d(8886,null)),s.push(d(8888,null)),s.push(""),s.push(d(8882,null)),s.push(d(8884,null)),s.push(d(8885,null,"<keybinding:editor.action.replaceOne>")),s.push(d(8883,null,"<keybinding:editor.action.replaceAll>")),s.push(""),s.push(d(8879,null)),s.push(d(8878,null,"<keybinding:editor.action.nextMatchFindAction>")),s.push(d(8887,null,"<keybinding:editor.action.previousMatchFindAction>")),s.push(""),s.push(d(8881,null)),s.push(""),s.push(d(8899,null)),s.push(d(8895,null)),s.push(d(8900,null)),s.push(d(8897,null)),s.push(d(8898,null)),s.push(d(8896,null)),s.push(""),s.push(d(8916,null,"<keybinding:workbench.action.openSettings>")),s.push(d(8917,null)),s.push(d(8918,null)),s.push(d(8907,null)),s.push(d(8904,null)),s.push(d(8912,null)),s.push(d(8903,null)),s.push(d(8908,null)),s.push(d(8905,null)),s.push(d(8906,null)),s.push(d(8911,null)),s.push(d(8909,null)),s.push(d(8910,null)),s.push(d(8913,null)),s.push(d(8914,null)),s.push(d(8915,null)),Ze&&(s.push(""),s.push(d(8890,null)),s.push(d(8889,null))),s.push(""),s.push(d(8862,null)),s.push(d(8861,null))}else s.push(d(8813,null)),s.push(d(8807,null)),s.push(""),s.push(d(8860,null)),o?(s.push(d(8843,null,o)),n!==void 0&&r!==void 0&&(n===0?s.push(d(8831,null)):s.push(d(8830,null,r,n)))):s.push(d(8832,null)),s.push(""),s.push(d(8809,null)),s.push(d(8808,null)),s.push(""),s.push(d(8819,null)),s.push(d(8818,null)),s.push(d(8814,null)),s.push(d(8815,null)),s.push(d(8816,null)),s.push(d(8817,null)),s.push(""),s.push(d(8841,null)),s.push(d(8839,null)),s.push(d(8840,null,"<keybinding:editor.action.nextMatchFindAction>")),s.push(d(8842,null,"<keybinding:editor.action.previousMatchFindAction>")),s.push(d(8838,null)),s.push(""),s.push(d(8812,null)),s.push(d(8810,null)),s.push(d(8811,null)),s.push(""),s.push(d(8820,null)),s.push(""),s.push(d(8824,null)),s.push(d(8821,null)),s.push(d(8826,null)),s.push(""),s.push(d(8823,null)),s.push(d(8822,null,"<keybinding:editor.action.nextMatchFindAction>")),s.push(d(8827,null,"<keybinding:editor.action.previousMatchFindAction>")),s.push(""),s.push(d(8825,null)),s.push(""),s.push(d(8836,null)),s.push(d(8833,null)),s.push(d(8837,null)),s.push(d(8834,null)),s.push(d(8835,null)),s.push(""),s.push(d(8857,null,"<keybinding:workbench.action.openSettings>")),s.push(d(8858,null)),s.push(d(8859,null)),s.push(d(8848,null)),s.push(d(8846,null)),s.push(d(8853,null)),s.push(d(8844,null)),s.push(d(8850,null)),s.push(d(8845,null)),s.push(d(8847,null)),s.push(d(8849,null)),s.push(d(8851,null)),s.push(d(8852,null)),s.push(d(8854,null)),s.push(d(8855,null)),s.push(d(8856,null)),Ze&&(s.push(""),s.push(d(8829,null)),s.push(d(8828,null))),s.push(""),s.push(d(8806,null)),s.push(d(8805,null));return s.join(`
`)}};ga.register(new YHi);ne.as(Ep.ConfigurationMigration).registerConfigurationMigrations(Zae.items.map(a=>({key:`editor.${a.key}`,migrateFn:(i,e)=>{let t=[],o=(n,r)=>t.push([`editor.${n}`,{value:r}]);return a.migrate(i,n=>e(`editor.${n}`),o),t}})));var JHi=class extends K{constructor(){super({id:"workbench.action.inspectKeyMappings",title:L(8939,"Inspect Key Mappings"),category:Ve.Developer,f1:!0})}run(i,e){let t=i.get(_e);i.get(ee).openEditor({resource:void 0,contents:t._dumpDebugInfo(),options:{pinned:!0}})}};W(JHi);var ZHi=class extends K{constructor(){super({id:"workbench.action.inspectKeyMappingsJSON",title:L(8940,"Inspect Key Mappings (JSON)"),category:Ve.Developer,f1:!0})}async run(i){let e=i.get(ee),t=i.get(_e);await e.openEditor({resource:void 0,contents:t._dumpDebugInfoJSON(),options:{pinned:!0}})}};W(ZHi);var lKe=class extends x{constructor(e,t,o){super();this._editor=e;this._notificationService=t;this._configurationService=o;this._register(this._editor.onDidChangeModel(n=>this._update())),this._update()}static{this.ID="editor.contrib.largeFileOptimizationsWarner"}_update(){let e=this._editor.getModel();if(e&&e.isTooLargeForTokenization()){let t=d(8941,null,jo(e.uri.path));this._notificationService.prompt(ft.Info,t,[{label:d(8942,null),run:()=>{this._configurationService.updateValue("editor.largeFileOptimizations",!1).then(()=>{this._notificationService.info(d(8943,null))},o=>{this._notificationService.error(o)})}}],{neverShowAgain:{id:"editor.contrib.largeFileOptimizationsWarner"}})}}};lKe=I([m(1,Ne),m(2,B)],lKe);xo(lKe.ID,lKe,1);var q6=class extends Rve{constructor(e,t,o){super();this.editorService=e;this.configurationService=t;this.storageService=o;this.onDidActiveTextEditorControlChange=this.editorService.onDidActiveEditorChange}get configuration(){let e=this.configurationService.getValue().workbench?.editor;return{openEditorPinned:!e?.enablePreviewFromQuickOpen||!e?.enablePreview}}get activeTextEditorControl(){return this.editorService.activeTextEditorControl}gotoLocation(e,t){if((t.keyMods.alt||this.configuration.openEditorPinned&&t.keyMods.ctrlCmd||t.forceSideBySide)&&this.editorService.activeEditor){e.restoreViewState?.();let o={selection:t.range,pinned:t.keyMods.ctrlCmd||this.configuration.openEditorPinned,preserveFocus:t.preserveFocus};this.editorService.openEditor(this.editorService.activeEditor,o,In)}else super.gotoLocation(e,t)}};q6=I([m(0,ee),m(1,B),m(2,ce)],q6);var DQt=class a extends K{static{this.ID="workbench.action.gotoLine"}constructor(){super({id:a.ID,title:L(8949,"Go to Line/Column..."),f1:!0,keybinding:{weight:200,when:null,primary:2085,mac:{primary:293}}})}async run(i){i.get(Ue).quickAccess.show(q6.GO_TO_LINE_PREFIX)}};W(DQt);ne.as(Ku.Quickaccess).registerQuickAccessProvider({ctor:q6,prefix:Rve.GO_TO_LINE_PREFIX,placeholder:d(8951,null),helpEntries:[{description:d(8950,null),commandId:DQt.ID}]});var LQt=class a extends K{static{this.ID="workbench.action.gotoOffset"}constructor(){super({id:a.ID,title:L(8952,"Go to Offset..."),f1:!0})}async run(i){i.get(Ue).quickAccess.show(q6.GO_TO_OFFSET_PREFIX)}};W(LQt);ne.as(Ku.Quickaccess).registerQuickAccessProvider({ctor:q6,prefix:q6.GO_TO_OFFSET_PREFIX,placeholder:d(8951,null),helpEntries:[{description:d(8953,null),commandId:LQt.ID}]});ni(class extends Di{constructor(){super({id:"editor.action.formatChanges",label:L(11189,"Format Modified Lines"),precondition:C.and(pe.writable,pe.hasDocumentSelectionFormattingProvider)})}async run(i,e){let t=i.get(F);if(!e.hasModel())return;let o=await t.invokeFunction(eUi,e.getModel());if(yr(o))return t.invokeFunction($ce,e,o,1,Mm.None,Se.None,!0)}});async function eUi(a,i){let e=a.get(mT),t=a.get(Qs),o=a.get(Bt),n=await bTo(e,i.uri,i.getLanguageId(),Hx(i));if(!n)return null;let r=[],s=await o.createModelReference(n);try{if(!t.canComputeDirtyDiff(n,i.uri))return;let l=await t.computeDirtyDiff(n,i.uri,!1);if(!yr(l))return;for(let c of l)r.push(i.validateRange(new z(c.modifiedStartLineNumber,1,c.modifiedEndLineNumber||c.modifiedStartLineNumber,Number.MAX_SAFE_INTEGER)))}finally{s.dispose()}return r}var ldt=class{constructor(i,e){this.configurationService=i;this.codeEditorService=e}async participate(i,e){if(!i.textEditorModel)return;let t=this.configurationService.getValue("files.trimTrailingWhitespace",{overrideIdentifier:i.textEditorModel.getLanguageId(),resource:i.resource}),o=this.configurationService.getValue("files.trimTrailingWhitespaceInRegexAndStrings",{overrideIdentifier:i.textEditorModel.getLanguageId(),resource:i.resource});t&&this.doTrimTrailingWhitespace(i.textEditorModel,e.reason===2,o)}doTrimTrailingWhitespace(i,e,t){let o=[],n=[],r=RQt(i,this.codeEditorService);if(r&&(o=r.getSelections(),e)){n=o.map(c=>c.getPosition());let l=vs.get(r)?.getSessionEnclosingRange();if(l)for(let c=l.startLineNumber;c<=l.endLineNumber;c++)n.push(new ye(c,i.getLineMaxColumn(c)))}let s=u8e(i,n,t);s.length&&i.pushEditOperations(o,s,l=>o)}};ldt=I([m(0,B),m(1,qt)],ldt);function RQt(a,i){let e=null;if(a.isAttachedToEditor()){for(let t of i.listCodeEditors())if(t.hasModel()&&t.getModel()===a){if(t.hasTextFocus())return t;e=t}}return e}var cdt=class{constructor(i,e){this.configurationService=i;this.codeEditorService=e}async participate(i,e){i.textEditorModel&&this.configurationService.getValue("files.insertFinalNewline",{overrideIdentifier:i.textEditorModel.getLanguageId(),resource:i.resource})&&this.doInsertFinalNewLine(i.textEditorModel)}doInsertFinalNewLine(i){let e=i.getLineCount(),t=i.getLineContent(e),o=hv(t)===-1;if(!e||o)return;let n=[Hn.insert(new ye(e,i.getLineMaxColumn(e)),i.getEOL())],r=RQt(i,this.codeEditorService);r?r.executeEdits("insertFinalNewLine",n,r.getSelections()):i.pushEditOperations([],n,()=>null)}};cdt=I([m(0,B),m(1,qt)],cdt);var ddt=class{constructor(i,e){this.configurationService=i;this.codeEditorService=e}async participate(i,e){i.textEditorModel&&this.configurationService.getValue("files.trimFinalNewlines",{overrideIdentifier:i.textEditorModel.getLanguageId(),resource:i.resource})&&this.doTrimFinalNewLines(i.textEditorModel,e.reason===2)}findLastNonEmptyLine(i){for(let e=i.getLineCount();e>=1;e--)if(i.getLineLength(e)>0)return e;return 0}doTrimFinalNewLines(i,e){let t=i.getLineCount();if(t===1)return;let o=[],n=0,r=RQt(i,this.codeEditorService);if(r&&(o=r.getSelections(),e))for(let u=0,p=o.length;u<p;u++){let h=o[u].positionLineNumber;h>n&&(n=h)}let s=this.findLastNonEmptyLine(i),l=Math.max(s+1,n+1),c=i.validateRange(new z(l,1,t,i.getLineMaxColumn(t)));c.isEmpty()||(i.pushEditOperations(o,[Hn.delete(c)],u=>o),r?.setSelections(o))}};ddt=I([m(0,B),m(1,qt)],ddt);var udt=class{constructor(i,e,t){this.configurationService=i;this.codeEditorService=e;this.instantiationService=t}async participate(i,e,t,o){if(!i.textEditorModel||e.reason===2)return;let n=i.textEditorModel,r={overrideIdentifier:n.getLanguageId(),resource:n.uri},s=new Mm(p=>{t.report({message:d(8963,null,p.displayName||p.extensionId&&p.extensionId.value||"???",fc("workbench.action.openSettings","editor.formatOnSave").toString())})});if(!this.configurationService.getValue("editor.formatOnSave",r))return;let c=RQt(n,this.codeEditorService)||n,u=this.configurationService.getValue("editor.formatOnSaveMode",r);if(u==="file")await this.instantiationService.invokeFunction(jce,c,2,s,o);else{let p=await this.instantiationService.invokeFunction(eUi,pn(c)?c.getModel():c);p===null&&u==="modificationsIfAvailable"?await this.instantiationService.invokeFunction(jce,c,2,s,o):p&&await this.instantiationService.invokeFunction($ce,c,p,2,s,o,!1)}}};udt=I([m(0,B),m(1,qt),m(2,F)],udt);var pdt=class extends x{constructor(e,t,o,n,r,s){super();this.configurationService=e;this.instantiationService=t;this.languageFeaturesService=o;this.hostService=n;this.editorService=r;this.codeEditorService=s;this._register(this.hostService.onDidChangeFocus(()=>{this.triggerCodeActionsCommand()})),this._register(this.editorService.onDidActiveEditorChange(()=>{this.triggerCodeActionsCommand()}))}async triggerCodeActionsCommand(){if(this.configurationService.getValue("editor.codeActions.triggerOnFocusChange")&&this.configurationService.getValue("files.autoSave")==="afterDelay"){let e=this.codeEditorService.getActiveCodeEditor()?.getModel();if(!e)return;let t={overrideIdentifier:e.getLanguageId(),resource:e.uri},o=this.configurationService.getValue("editor.codeActionsOnSave",t);if(!o||Array.isArray(o))return;let n=Object.keys(o).filter(l=>o[l]&&o[l]==="always"&&xr.Source.contains(new fs(l))),r=new Ye,s=[];for(let l of n)s.push(new fs(l));await this.applyOnSaveActions(e,s,[],Mm.None,r.token)}}async participate(e,t,o,n){if(!e.textEditorModel)return;let r=e.textEditorModel,s={overrideIdentifier:r.getLanguageId(),resource:r.uri},l=this.configurationService.getValue("editor.codeActionsOnSave",s);if(!l||t.reason===2||t.reason!==1&&Array.isArray(l))return;let c=Array.isArray(l)?l:Object.keys(l).filter(g=>l[g]&&l[g]!=="never"),u=this.createCodeActionsOnSave(c);if(Array.isArray(l)||u.sort((g,f)=>xr.SourceFixAll.contains(g)?xr.SourceFixAll.contains(f)?0:-1:xr.SourceFixAll.contains(f)?1:0),!u.length)return;let p=Array.isArray(l)?[]:Object.keys(l).filter(g=>l[g]==="never"||!1).map(g=>new fs(g));o.report({message:d(8960,null)});let h=Array.isArray(l)?u:u.filter(g=>l[g.value]==="always"||(l[g.value]==="explicit"||l[g.value]===!0)&&t.reason===1);await this.applyOnSaveActions(r,h,p,o,n)}createCodeActionsOnSave(e){let t=e.map(o=>new fs(o));return t.filter(o=>t.every(n=>n.equals(o)||!n.contains(o)))}async applyOnSaveActions(e,t,o,n,r){let s=new class{constructor(){this._names=new Set}_report(){n.report({message:d(8962,null,[...this._names].map(l=>`'${l}'`).join(", "),fc("workbench.action.openSettings","editor.codeActionsOnSave").toString())})}report(l){l.displayName&&!this._names.has(l.displayName)&&(this._names.add(l.displayName),this._report())}};for(let l of t){let c=await this.getActionsToRun(e,l,o,s,r);if(r.isCancellationRequested){c.dispose();return}try{for(let u of c.validActions)if(n.report({message:d(8961,null,u.action.title)}),await this.instantiationService.invokeFunction(i5,u,"onSave",{},r),r.isCancellationRequested)return}catch{}finally{c.dispose()}}}getActionsToRun(e,t,o,n,r){return hR(this.languageFeaturesService.codeActionProvider,e,e.getFullModelRange(),{type:2,triggerAction:"save participants",filter:{include:t,excludes:o,includeSourceActions:!0}},n,r)}};pdt=I([m(0,B),m(1,F),m(2,Qt),m(3,Zt),m(4,ee),m(5,qt)],pdt);var mdt=class extends x{constructor(e,t){super();this.instantiationService=e;this.textFileService=t;this.registerSaveParticipants()}registerSaveParticipants(){this._register(this.textFileService.files.addSaveParticipant(this.instantiationService.createInstance(ldt))),this._register(this.textFileService.files.addSaveParticipant(this.instantiationService.createInstance(pdt))),this._register(this.textFileService.files.addSaveParticipant(this.instantiationService.createInstance(udt))),this._register(this.textFileService.files.addSaveParticipant(this.instantiationService.createInstance(cdt))),this._register(this.textFileService.files.addSaveParticipant(this.instantiationService.createInstance(ddt)))}};mdt=I([m(0,F),m(1,Uo)],mdt);var Mbn=ne.as(Qi.Workbench);Mbn.registerWorkbenchContribution(mdt,3);var tUi=class a extends K{static{this.ID="editor.action.toggleColumnSelection"}constructor(){super({id:a.ID,title:{...L(8965,"Toggle Column Selection Mode"),mnemonicTitle:d(8964,null)},f1:!0,toggled:C.equals("config.editor.columnSelection",!0),menu:{id:D.MenubarSelectionMenu,group:"4_config",order:2}})}async run(i){let e=i.get(B),t=i.get(qt),o=e.getValue("editor.columnSelection"),n=this._getCodeEditor(t);await e.updateValue("editor.columnSelection",!o);let r=e.getValue("editor.columnSelection");if(!n||n!==this._getCodeEditor(t)||o===r||!n.hasModel()||typeof o!="boolean"||typeof r!="boolean")return;let s=n._getViewModel();if(n.getOption(28)){let l=n.getSelection(),c=new ye(l.selectionStartLineNumber,l.selectionStartColumn),u=s.coordinatesConverter.convertModelPositionToViewPosition(c),p=new ye(l.positionLineNumber,l.positionColumn),h=s.coordinatesConverter.convertModelPositionToViewPosition(p);af.MoveTo.runCoreEditorCommand(s,{position:c,viewPosition:u});let g=s.cursorConfig.visibleColumnFromColumn(s,h);af.ColumnSelect.runCoreEditorCommand(s,{position:p,viewPosition:h,doColumnSelect:!0,mouseColumn:g+1})}else{let l=s.getCursorColumnSelectData(),c=s.cursorConfig.columnFromVisibleColumn(s,l.fromViewLineNumber,l.fromViewVisualColumn),u=s.coordinatesConverter.convertViewPositionToModelPosition(new ye(l.fromViewLineNumber,c)),p=s.cursorConfig.columnFromVisibleColumn(s,l.toViewLineNumber,l.toViewVisualColumn),h=s.coordinatesConverter.convertViewPositionToModelPosition(new ye(l.toViewLineNumber,p));n.setSelection(new ti(u.lineNumber,u.column,h.lineNumber,h.column))}}_getCodeEditor(i){let e=i.getFocusedCodeEditor();return e||i.getActiveCodeEditor()}};W(tUi);var iUi=class a extends K{static{this.ID="editor.action.toggleMinimap"}constructor(){super({id:a.ID,title:{...L(8967,"Toggle Minimap"),mnemonicTitle:d(8966,null)},category:Ve.View,f1:!0,toggled:C.equals("config.editor.minimap.enabled",!0),menu:{id:D.MenubarAppearanceMenu,group:"4_editor",order:1}})}async run(i){let e=i.get(B),t=!e.getValue("editor.minimap.enabled");return e.updateValue("editor.minimap.enabled",t)}};W(iUi);var oUi=class extends K{constructor(){super({id:"editor.action.toggleOvertypeInsertMode",title:{...L(8973,"Toggle Overtype/Insert Mode"),mnemonicTitle:d(8972,null)},metadata:{description:L(8974,"Toggle between overtype and insert mode")},keybinding:{weight:200,primary:19,mac:{primary:2605}},f1:!0,category:Ve.View})}async run(i){let t=TV.getInputMode()==="insert"?"overtype":"insert";TV.setInputMode(t)}};W(oUi);var gdt=class a extends K{static{this.ID="workbench.action.toggleMultiCursorModifier"}static{this.multiCursorModifierConfigurationKey="editor.multiCursorModifier"}constructor(){super({id:a.ID,title:L(8971,"Toggle Multi-Cursor Modifier"),f1:!0})}run(i){let e=i.get(B),o=e.getValue("editor").multiCursorModifier==="ctrlCmd"?"alt":"ctrlCmd";return e.updateValue(a.multiCursorModifierConfigurationKey,o)}},nUi=new Y("multiCursorModifier","altKey"),hdt=class extends x{constructor(e,t){super();this.configurationService=e;this._multiCursorModifier=nUi.bindTo(t),this._update(),this._register(e.onDidChangeConfiguration(o=>{o.affectsConfiguration("editor.multiCursorModifier")&&this._update()}))}_update(){let t=this.configurationService.getValue("editor").multiCursorModifier==="ctrlCmd"?"ctrlCmd":"altKey";this._multiCursorModifier.set(t)}};hdt=I([m(0,B),m(1,X)],hdt);ne.as(Qi.Workbench).registerWorkbenchContribution(hdt,3);W(gdt);ve.appendMenuItem(D.MenubarSelectionMenu,{group:"4_config",command:{id:gdt.ID,title:d(8968,null)},when:nUi.isEqualTo("ctrlCmd"),order:1});ve.appendMenuItem(D.MenubarSelectionMenu,{group:"4_config",command:{id:gdt.ID,title:Ze?d(8969,null):d(8970,null)},when:nUi.isEqualTo("altKey"),order:1});var rUi=class a extends K{static{this.ID="editor.action.toggleRenderControlCharacter"}constructor(){super({id:a.ID,title:{...L(8976,"Toggle Control Characters"),mnemonicTitle:d(8975,null)},category:Ve.View,f1:!0,toggled:C.equals("config.editor.renderControlCharacters",!0),menu:{id:D.MenubarAppearanceMenu,group:"4_editor",order:5}})}run(i){let e=i.get(B),t=!e.getValue("editor.renderControlCharacters");return e.updateValue("editor.renderControlCharacters",t)}};W(rUi);var sUi=class a extends K{static{this.ID="editor.action.toggleRenderWhitespace"}constructor(){super({id:a.ID,title:{...L(8978,"Toggle Render Whitespace"),mnemonicTitle:d(8977,null)},category:Ve.View,f1:!0,toggled:C.notEquals("config.editor.renderWhitespace","none"),menu:{id:D.MenubarAppearanceMenu,group:"4_editor",order:4}})}run(i){let e=i.get(B),t=e.getValue("editor.renderWhitespace"),o;return t==="none"?o="all":o="none",e.updateValue("editor.renderWhitespace",o)}};W(sUi);var fdt=class extends jE{constructor(i,e,t,o,n,r,s){super(!1,i,e,t,o,n,r,s)}};fdt=I([m(1,X),m(2,qt),m(3,Ne),m(4,F),m(5,ce),m(6,B)],fdt);xo(jE.ID,fdt,4);var gNb=te("markdownAlert.note.foreground",Dm,d(11579,null)),fNb=te("markdownAlert.tip.foreground",cle,d(11580,null)),vNb=te("markdownAlert.important.foreground",Vvt,d(11578,null)),bNb=te("markdownAlert.warning.foreground",jh,d(11581,null)),SNb=te("markdownAlert.caution.foreground",Iv,d(11577,null));var aUi=class a extends K{constructor(){super({id:"workbench.action.toggleKeybindingsLog",title:L(11452,"Toggle Keyboard Shortcuts Troubleshooting"),category:Ve.Developer,f1:!0})}run(i){if(i.get(_e).toggleLogging()&&i.get(ge).executeCommand(T2),a.disposable){a.disposable.dispose(),a.disposable=void 0;return}let t=i.get(Kl),o=new N,n=t.activeContainer,r=M(n,_(".focus-troubleshooting-marker"));o.add(Z(()=>r.remove()));let s=Cr(void 0,void 0,o);$h(".focus-troubleshooting-marker",`
			position: fixed;
			pointer-events: none;
			z-index: 100000;
			background-color: rgba(255, 0, 0, 0.2);
			border: 2px solid rgba(255, 0, 0, 0.8);
			border-radius: 2px;
			display: none;
		`,s);let l=o.add(new E);function c(u,p){p.add(j(u,"keydown",h=>l.fire(h),!0))}for(let{window:u,disposables:p}of SC())c(u,p);o.add(nf(({window:u,disposables:p})=>c(u,p))),o.add(t.onDidChangeActiveContainer(()=>{t.activeContainer.appendChild(r)})),o.add(l.event(u=>{let p=u.target;if(p){let h=ir(p);r.style.top=`${h.top}px`,r.style.left=`${h.left}px`,r.style.width=`${h.width}px`,r.style.height=`${h.height}px`,r.style.display="block",setTimeout(()=>{r.style.display="none"},800)}})),a.disposable=o}};W(aUi);var URo={category:L(14187,"Snippets")},cKe=class extends K{constructor(i){super({...URo,...i})}},dKe=class extends pl{constructor(i){super({...URo,...i})}};var KRo;(i=>{function a(e){return!!e&&A.isUri(e.filepath)}i.is=a})(KRo||={});async function Pbn(a,i,e,t){let o=[],n=[],r=new Set,s=new Map;for(let c of await a.getSnippetFiles())if(c.source!==3)if(c.isGlobalSnippets){await c.load();let u=new Set,p;e:for(let v of c.data){p||(p=v.source);for(let b of v.scopes){let S=e.getLanguageName(b);if(S)if(u.size>=4){u.add(`${S}...`);break e}else u.add(S)}}let h={label:He(c.location),filepath:c.location,description:u.size===0?d(14193,null):d(14192,null,[...u].join(", "))};if(o.push(h),!p)continue;let g=d(14191,null,p,t.getUriLabel(c.location,{relative:!0})),f=s.get(He(c.location));f&&(h.detail=g,f.snippet.detail=f.detail),s.set(He(c.location),{snippet:h,detail:g})}else{let u=He(c.location).replace(/\.json$/,"");o.push({label:He(c.location),description:`(${e.getLanguageName(u)??u})`,filepath:c.location}),r.add(u)}let l=i.currentProfile.snippetsHome;for(let c of e.getRegisteredLanguageIds()){let u=e.getLanguageName(c);u&&!r.has(c)&&n.push({label:c,description:`(${u})`,filepath:Ge(l,`${c}.json`),hint:!0,iconClasses:lK(c)})}return o.sort((c,u)=>{let p=qm(c.filepath.path),h=qm(u.filepath.path);return p===h?c.label.localeCompare(u.label):p===".code-snippets"?-1:1}),n.sort((c,u)=>c.label.localeCompare(u.label)),{existing:o,future:n}}async function zRo(a,i,e,t,o,n){function r(c){let u=qm(c)!==".code-snippets"?`${c}.code-snippets`:c;return Ge(i,u)}await t.createFolder(i);let s=await e.input({placeHolder:d(14196,null),async validateInput(c){if(!c)return d(14188,null);if(!v1(c))return d(14189,null,c);if(await t.exists(r(c)))return d(14190,null,c)}});if(!s)return;let l=r(s);await o.write(l,["{","	// Place your "+a+" snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and ","	// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope ","	// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is ","	// used to trigger the snippet and the body will be expanded and inserted. Possible variables are: ","	// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. ","	// Placeholders with the same ids are connected.","	// Example:",'	// "Print to console": {','	// 	"scope": "javascript,typescript",','	// 	"prefix": "log",','	// 	"body": [',`	// 		"console.log('$1');",`,'	// 		"$2"',"	// 	],",'	// 	"description": "Log output to console"',"	// }","	//","	// You can also restrict snippets to specific files using include/exclude patterns:",'	// "Test snippet": {','	// 	"scope": "javascript,typescript",','	// 	"prefix": "test",',`	// 	"body": "test('$1', () => {\\n\\t$0\\n});",`,'	// 	"include": ["**/*.test.ts", "*.spec.ts"],','	// 	"exclude": ["**/temp/*.ts"],','	// 	"description": "Insert test block"',"	// }","}"].join(`
`)),await n.open(l)}async function Abn(a,i,e){if(await i.exists(a.filepath))return;let t=["{","	// Place your snippets for "+a.label+" here. Each snippet is defined under a snippet name and has a prefix, body and ","	// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:","	// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the ","	// same ids are connected.","	// Example:",'	// "Print to console": {','	// 	"prefix": "log",','	// 	"body": [',`	// 		"console.log('$1');",`,'	// 		"$2"',"	// 	],",'	// 	"description": "Log output to console"',"	// }","	//","	// You can also restrict snippets to specific files using include/exclude patterns:",'	// "Test snippet": {','	// 	"prefix": "test",',`	// 	"body": "test('$1', () => {\\n\\t$0\\n});",`,'	// 	"include": ["**/*.test.ts", "*.spec.ts"],','	// 	"exclude": ["**/temp/*.ts"],','	// 	"description": "Insert test block"',"	// }","}"].join(`
`);await e.write(a.filepath,t)}var MQt=class extends cKe{constructor(){super({id:"workbench.action.openSnippets",title:L(14202,"Configure Snippets"),shortTitle:{...L(14204,"Snippets"),mnemonicTitle:d(14195,null)},f1:!0,menu:[{id:D.MenubarPreferencesMenu,group:"2_configuration",order:5},{id:D.GlobalActivity,group:"2_configuration",order:5}]})}async run(i){let e=i.get(wy),t=i.get(Ue),o=i.get(Je),n=i.get(_t),r=i.get(ln),s=i.get(Pe),l=i.get(fe),c=i.get(Uo),u=i.get(rt),p=await Pbn(e,r,n,u),h=p.existing,g=[{scope:d(14199,null),label:d(14198,null),uri:r.currentProfile.snippetsHome}],f=[];for(let b of s.getWorkspace().folders)f.push({scope:d(14201,null,b.name),label:d(14197,null,b.name),uri:b.toResource(".vscode")});h.length>0?(h.unshift({type:"separator",label:d(14194,null)}),h.push({type:"separator",label:d(14200,null)})):h.push({type:"separator",label:d(14200,null)});let v=await t.pick([].concat(h,g,f,p.future),{placeHolder:d(14203,null),matchOnDescription:!0});if(g.indexOf(v)>=0)return zRo(v.scope,v.uri,t,l,c,o);if(f.indexOf(v)>=0)return zRo(v.scope,v.uri,t,l,c,o);if(KRo.is(v))return v.hint&&await Abn(v,l,c),o.open(v.filepath)}};var uKe=class a extends cKe{static{this.Id="workbench.action.populateFileFromSnippet"}constructor(){super({id:a.Id,title:L(14205,"Fill File with Snippet"),f1:!0})}async run(i){let e=i.get(wy),t=i.get(Ue),o=i.get(ee),n=i.get(_t),r=ha(o.activeTextEditorControl);if(!r||!r.hasModel())return;let s=r.getModel().uri,l=await e.getSnippets(void 0,s,{fileTemplateSnippets:!0,noRecencySort:!0,includeNoPrefixSnippets:!0});if(l.length===0)return;let c=await this._pick(t,n,l);c&&r.hasModel()&&(vs.get(r)?.apply([{range:r.getModel().getFullModelRange(),template:c.snippet.body}]),r.getModel().setLanguage(n.createById(c.langId),a.Id),r.focus())}async _pick(i,e,t){let o=[];for(let l of t)if($N(l.scopes))o.push({langId:"",snippet:l});else for(let c of l.scopes)o.push({langId:c,snippet:l});let n=[],r=Jg(o,(l,c)=>Hl(l.langId,c.langId));for(let l of r){let c=!0;for(let u of l)c&&(n.push({type:"separator",label:e.getLanguageName(u.langId)??u.langId}),c=!1),n.push({snippet:u,label:u.snippet.prefix||u.snippet.name,detail:u.snippet.description})}return(await i.pick(n,{placeHolder:d(14206,null),matchOnDetail:!0}))?.snippet}};async function PQt(a,i,e){let t=a.get(wy),o=a.get(Ue),n;Array.isArray(i)?n=i:n=await t.getSnippets(i,e,{includeDisabledSnippets:!0,includeNoPrefixSnippets:!0}),n.sort((u,p)=>u.snippetSource-p.snippetSource);let r=()=>{let u=[],p;for(let h of n){let g={label:h.prefix||h.name,detail:h.description||h.body,snippet:h};if(!p||p.snippetSource!==h.snippetSource||p.source!==h.source){let f="";switch(h.snippetSource){case 1:f=d(14220,null);break;case 3:f=h.source;break;case 2:f=d(14221,null);break}u.push({type:"separator",label:f})}h.snippetSource===3&&(t.isEnabled(h)?g.buttons=[{iconClass:q.asClassName(R.eyeClosed),tooltip:d(14215,null)}]:(g.description=d(14217,null),g.buttons=[{iconClass:q.asClassName(R.eye),tooltip:d(14216,null)}])),u.push(g),p=h}return u},s=new N,l=s.add(o.createQuickPick({useSeparators:!0}));l.placeholder=d(14219,null),l.matchOnDetail=!0,l.ignoreFocusOut=!1,l.keepScrollPosition=!0,s.add(l.onDidTriggerItemButton(u=>{let p=t.isEnabled(u.item.snippet);t.updateEnablement(u.item.snippet,!p),l.items=r()})),l.items=r(),l.items.length||(l.validationMessage=d(14218,null)),l.show(),await Promise.race([U.toPromise(l.onDidAccept),U.toPromise(l.onDidHide)]);let c=l.selectedItems[0]?.snippet;return s.dispose(),c}var lUi=class a{constructor(i,e,t){this.snippet=i;this.name=e;this.langId=t}static fromUser(i){if(!i||typeof i!="object")return a._empty;let{snippet:e,name:t,langId:o}=i;return typeof e!="string"&&(e=void 0),typeof t!="string"&&(t=void 0),typeof o!="string"&&(o=void 0),new a(e,t,o)}static{this._empty=new a(void 0,void 0,void 0)}},AQt=class extends dKe{constructor(){super({id:"editor.action.insertSnippet",title:L(14207,"Insert Snippet"),f1:!0,precondition:pe.writable,metadata:{description:"Insert Snippet",args:[{name:"args",schema:{type:"object",properties:{snippet:{type:"string"},langId:{type:"string"},name:{type:"string"}}}}]}})}async runEditorCommand(i,e,t){let o=i.get(_t),n=i.get(wy);if(!e.hasModel())return;let r=i.get(Fi),s=i.get(F),l=await new Promise((u,p)=>{let{lineNumber:h,column:g}=e.getPosition(),{snippet:f,name:v,langId:b}=lUi.fromUser(t);if(f)return u(new Zue(!1,[],"","","",f,"",1,`random/${Math.random()}`));let S;if(b){if(!o.isRegisteredLanguageId(b))return u(void 0);S=b}else e.getModel().tokenization.tokenizeIfCheap(h),S=e.getModel().getLanguageIdAtPosition(h,g),o.getLanguageName(S)||(S=e.getModel().getLanguageId());v?n.getSnippets(S,void 0,{includeNoPrefixSnippets:!0}).then(y=>y.find(w=>w.name===v)).then(u,p):u(s.invokeFunction(PQt,S,e.getModel().uri))});if(!l)return;let c;l.needsClipboard&&(c=await r.readText()),e.focus(),vs.get(e)?.insert(l.codeSnippet,{clipboardText:c}),n.updateUsageTimestamp(l)}};async function cUi(a,i,e,t){let{lineNumber:o,column:n}=e;i.tokenization.tokenizeIfCheap(o);let r=i.getLanguageIdAtPosition(o,n);return(await a.getSnippets(r,i.uri,{includeNoPrefixSnippets:!0,includeDisabledSnippets:t})).filter(l=>l.usesSelection)}var Dbe=class a extends dKe{static{this.options={id:"editor.action.surroundWithSnippet",title:L(14208,"Surround with Snippet...")}}constructor(){super({...a.options,precondition:C.and(pe.writable,pe.hasNonEmptySelection),f1:!0})}async runEditorCommand(i,e){if(!e.hasModel())return;let t=i.get(F),o=i.get(wy),n=i.get(Fi),r=e.getModel(),s=await cUi(o,r,e.getPosition(),!0);if(!s.length)return;let l=await t.invokeFunction(PQt,s,r.uri);if(!l)return;let c;l.needsClipboard&&(c=await n.readText()),e.focus(),vs.get(e)?.insert(l.codeSnippet,{clipboardText:c}),o.updateUsageTimestamp(l)}};var Rre=class{constructor(i){this._snippetService=i}static{this._MAX_CODE_ACTIONS=4}static{this._overflowCommandCodeAction={kind:xr.SurroundWith.value,title:d(14210,null),command:{id:Dbe.options.id,title:Dbe.options.title.value}}}async provideCodeActions(i,e){if(e.isEmpty())return;let t=ti.isISelection(e)?e.getPosition():e.getStartPosition(),o=await cUi(this._snippetService,i,t,!1);if(!o.length)return;let n=[];for(let r of o){if(n.length>=Rre._MAX_CODE_ACTIONS){n.push(Rre._overflowCommandCodeAction);break}n.push({title:d(14209,null,r.name),kind:xr.SurroundWith.value,edit:GRo(i,e,r)})}return{actions:n,dispose(){}}}};Rre=I([m(0,wy)],Rre);var Mre=class{constructor(i){this._snippetService=i;this.providedCodeActionKinds=[xr.SurroundWith.value]}static{this._MAX_CODE_ACTIONS=4}static{this._overflowCommandCodeAction={title:d(14211,null),kind:xr.SurroundWith.value,command:{id:uKe.Id,title:""}}}async provideCodeActions(i){if(i.getValueLength()!==0)return;let e=await this._snippetService.getSnippets(i.getLanguageId(),i.uri,{fileTemplateSnippets:!0,includeNoPrefixSnippets:!0}),t=[];for(let o of e){if(t.length>=Mre._MAX_CODE_ACTIONS){t.push(Mre._overflowCommandCodeAction);break}t.push({title:d(14212,null,o.name),kind:xr.SurroundWith.value,edit:GRo(i,i.getFullModelRange(),o)})}return{actions:t,dispose(){}}}};Mre=I([m(0,wy)],Mre);function GRo(a,i,e){return{edits:[{versionId:a.getVersionId(),resource:a.uri,textEdit:{range:i,text:e.body,insertAsSnippet:!0}}]}}var pKe=class{constructor(i,e,t){this._store=new N;let o="editor.snippets.codeActions.enabled",n=new N,r=()=>{n.clear(),t.getValue(o)&&(n.add(e.codeActionProvider.register("*",i.createInstance(Rre))),n.add(e.codeActionProvider.register("*",i.createInstance(Mre))))};r(),this._store.add(t.onDidChangeConfiguration(s=>s.affectsConfiguration(o)&&r())),this._store.add(n)}dispose(){this._store.dispose()}};pKe=I([m(0,F),m(1,Qt),m(2,B)],pKe);Ee(wy,$_e,1);W(AQt);$e.registerCommandAlias("editor.action.showSnippets","editor.action.insertSnippet");W(Dbe);W(uKe);W(MQt);var Nbn=ne.as(Qi.Workbench);Nbn.registerWorkbenchContribution(pKe,3);ne.as(Jt.Configuration).registerConfiguration({...RC,properties:{"editor.snippets.codeActions.enabled":{description:d(14222,null),type:"boolean",default:!0}}});var qRo="vscode://schemas/snippets",$Ro={prefix:{description:d(14230,null),type:["string","array"]},isFileTemplate:{description:d(14229,null),type:"boolean"},body:{markdownDescription:d(14224,null),type:["string","array"],items:{type:"string"}},description:{description:d(14226,null),type:["string","array"]},include:{markdownDescription:d(14228,null),type:["string","array"],items:{type:"string"}},exclude:{markdownDescription:d(14227,null),type:["string","array"],items:{type:"string"}}},Obn={id:qRo,allowComments:!0,allowTrailingCommas:!0,defaultSnippets:[{label:d(14225,null),body:{"${1:snippetName}":{prefix:"${2:prefix}",body:"${3:snippet}",description:"${4:description}"}}}],type:"object",description:d(14223,null),additionalProperties:{type:"object",required:["body"],properties:$Ro,additionalProperties:!1}},jRo="vscode://schemas/global-snippets",Fbn={id:jRo,allowComments:!0,allowTrailingCommas:!0,defaultSnippets:[{label:d(14225,null),body:{"${1:snippetName}":{scope:"${2:scope}",prefix:"${3:prefix}",body:"${4:snippet}",description:"${5:description}"}}}],type:"object",description:d(14223,null),additionalProperties:{type:"object",required:["body"],properties:{...$Ro,scope:{description:d(14231,null),type:"string"}},additionalProperties:!1}},QRo=ne.as(ma.JSONContribution);QRo.registerSchema(qRo,Obn);QRo.registerSchema(jRo,Fbn);ni(class extends Di{constructor(){super({id:"editor.action.formatDocument.none",label:L(11185,"Format Document"),precondition:C.and(pe.writable,pe.hasDocumentFormattingProvider.toNegated()),kbOpts:{kbExpr:pe.editorTextFocus,primary:1572,linux:{primary:3111},weight:100}})}async run(i,e){if(!e.hasModel())return;let t=i.get(ge),o=i.get(Hi),n=i.get(Ne),r=i.get(at),s=i.get(Qt),l=e.getModel(),c=s.documentFormattingEditProvider.all(l).length;if(c>1)return t.executeCommand("editor.action.formatDocument.multiple");if(c===1)return t.executeCommand("editor.action.formatDocument");if(l.isTooLargeForSyncing())n.warn(d(11188,null));else{let u=l.getLanguageId(),p=d(11187,null,u),{confirmed:h}=await r.confirm({message:p,primaryButton:d(11186,null)});h&&o.openSearch(`category:formatters ${u}`)}}});var jb=class extends x{constructor(e,t){super();this._extensionService=e;this._configurationService=t;this._store.add(this._extensionService.onDidChangeExtensions(this._updateConfigValues,this)),this._store.add(gf.setFoldingRangeProviderSelector(this._selectFoldingRangeProvider.bind(this))),this._updateConfigValues()}static{this.configName="editor.defaultFoldingRangeProvider"}static{this.extensionIds=[]}static{this.extensionItemLabels=[]}static{this.extensionDescriptions=[]}async _updateConfigValues(){await this._extensionService.whenInstalledExtensionsRegistered(),jb.extensionIds.length=0,jb.extensionItemLabels.length=0,jb.extensionDescriptions.length=0,jb.extensionIds.push(null),jb.extensionItemLabels.push(d(11164,null)),jb.extensionDescriptions.push(d(11165,null));let e=[],t=[];for(let n of this._extensionService.extensions)(n.main||n.browser)&&(n.categories?.find(r=>r==="Programming Languages")?e.push(n):t.push(n));let o=(n,r)=>n.name.localeCompare(r.name);for(let n of e.sort(o))jb.extensionIds.push(n.identifier.value),jb.extensionItemLabels.push(n.displayName??""),jb.extensionDescriptions.push(n.description??"");for(let n of t.sort(o))jb.extensionIds.push(n.identifier.value),jb.extensionItemLabels.push(n.displayName??""),jb.extensionDescriptions.push(n.description??"")}_selectFoldingRangeProvider(e,t){let o=this._configurationService.getValue(jb.configName,{overrideIdentifier:t.getLanguageId()});if(o)return e.filter(n=>n.id===o)}};jb=I([m(0,lt),m(1,B)],jb);ne.as(Jt.Configuration).registerConfiguration({...RC,properties:{[jb.configName]:{description:d(11163,null),type:["string","null"],default:null,enum:jb.extensionIds,enumItemLabels:jb.extensionItemLabels,markdownEnumDescriptions:jb.extensionDescriptions}}});ne.as(Qi.Workbench).registerWorkbenchContribution(jb,3);var Wbn="workbench.action.openSettings",Vbn=d(11470,null),vdt=class extends x{constructor(i,e){super();let o=[new dUi,new uUi].map(s=>new pUi(e,s));o.forEach(s=>this._register(s));let n,r=()=>{let s=i.activeTextEditorControl;if(s===n)return;n=s;let l=ha(s);o.forEach(c=>c.onActiveEditorChanged(l))};this._register(i.onDidActiveEditorChange(r)),r()}};vdt=I([m(0,ee),m(1,HB)],vdt);var dUi=class{constructor(){this.id="decoratorsLimitInfo";this.name=d(11466,null);this.label=d(11472,null);this.source=d(11467,null);this.settingsId="editor.colorDecoratorsLimit"}getLimitReporter(i){return Iw.get(i)?.limitReporter}},uUi=class{constructor(){this.id="foldingLimitInfo";this.name=d(11468,null);this.label=d(11473,null);this.source=d(11469,null);this.settingsId="editor.foldingMaximumRegions"}getLimitReporter(i){return gf.get(i)?.limitReporter}},pUi=class{constructor(i,e){this.languageStatusService=i;this.accessor=e}onActiveEditorChanged(i){this._indicatorChangeListener&&(this._indicatorChangeListener.dispose(),this._indicatorChangeListener=void 0);let e;return i&&(e=this.accessor.getLimitReporter(i)),this.updateStatusItem(e),e?(this._indicatorChangeListener=e.onDidChange(t=>{this.updateStatusItem(e)}),!0):!1}updateStatusItem(i){if(this._limitStatusItem&&(this._limitStatusItem.dispose(),this._limitStatusItem=void 0),i&&i.limited!==!1){let e={id:this.accessor.id,selector:"*",name:this.accessor.name,severity:bt.Warning,label:this.accessor.label,detail:d(11471,null,i.limited),command:{id:Wbn,arguments:[this.accessor.settingsId],title:Vbn},accessibilityInfo:void 0,source:this.accessor.source,busy:!1};this._limitStatusItem=this.languageStatusService.addStatus(e)}}dispose(){this._limitStatusItem?.dispose(),this._limitStatusItem=void 0,this._indicatorChangeListener?.dispose(),this._indicatorChangeListener=void 0}};ne.as(Qi.Workbench).registerWorkbenchContribution(vdt,3);var tV=class{constructor(i,e,t,o){this._editor=i;this._accessibilitySignalService=t;this._instaService=o;this._sessionDispoosables=new N;this._ariaElement=document.createElement("span"),this._ariaElement.style.position="fixed",this._ariaElement.className="inlayhint-accessibility-element",this._ariaElement.tabIndex=0,this._ariaElement.setAttribute("aria-description",d(11212,null)),this._ctxIsReading=tV.IsReading.bindTo(e)}static{this.IsReading=new Y("isReadingLineWithInlayHints",!1,{type:"boolean",description:d(11213,null)})}static{this.ID="editor.contrib.InlayHintsAccessibility"}static get(i){return i.getContribution(tV.ID)??void 0}dispose(){this._sessionDispoosables.dispose(),this._ctxIsReading.reset(),this._ariaElement.remove()}_reset(){Rt(this._ariaElement),this._sessionDispoosables.clear(),this._ctxIsReading.reset()}async _read(i,e){if(this._sessionDispoosables.clear(),this._ariaElement.isConnected||this._editor.getDomNode()?.appendChild(this._ariaElement),!this._editor.hasModel()||!this._ariaElement.isConnected){this._ctxIsReading.set(!1);return}let t=new Ye;this._sessionDispoosables.add(t);for(let l of e)await l.resolve(t.token);if(t.token.isCancellationRequested)return;let o=this._editor.getModel(),n=[],r=0,s=!1;for(let l of e){let c=o.getValueInRange({startLineNumber:i,startColumn:r+1,endLineNumber:i,endColumn:l.hint.position.column});if(c.length>0&&(n.push(c),r=l.hint.position.column-1),r>750){n.push("\u2026"),s=!0;break}let u=document.createElement("em"),{label:p}=l.hint;if(typeof p=="string")u.innerText=p;else for(let h of p)if(h.command){let g=this._instaService.createInstance(rg,u,{href:zCt(h.command),label:h.label,title:h.command.title},void 0);this._sessionDispoosables.add(g)}else u.innerText+=h.label;n.push(u)}s||n.push(o.getValueInRange({startLineNumber:i,startColumn:r+1,endLineNumber:i,endColumn:Number.MAX_SAFE_INTEGER})),vi(this._ariaElement,...n),this._ariaElement.focus(),this._ctxIsReading.set(!0),this._sessionDispoosables.add(j(this._ariaElement,"focusout",()=>{this._reset()}))}startInlayHintsReading(){if(!this._editor.hasModel())return;let i=this._editor.getPosition().lineNumber,e=QE.get(this._editor)?.getInlayHintsForLine(i);!e||e.length===0?this._accessibilitySignalService.playSignal($o.noInlayHints):this._read(i,e)}stopInlayHintsReading(){this._reset(),this._editor.focus()}};tV=I([m(1,X),m(2,lr),m(3,F)],tV);W(class extends pl{constructor(){super({id:"inlayHints.startReadingLineWithHint",title:L(11214,"Read Line with Inlay Hints"),precondition:pe.hasInlayHintsProvider,f1:!0})}runEditorCommand(i,e){tV.get(e)?.startInlayHintsReading()}});W(class extends pl{constructor(){super({id:"inlayHints.stopReadingLineWithHint",title:L(11215,"Stop Inlay Hints Reading"),precondition:tV.IsReading,f1:!0,keybinding:{weight:100,primary:9}})}runEditorCommand(i,e){tV.get(e)?.stopInlayHintsReading()}});xo(tV.ID,tV,4);var Bbn=Ae("theme-selection-manage-extension",R.gear,d(16131,null));var mKe=class{constructor(i,e,t,o,n,r,s,l,c){this.getMarketplaceColorThemes=i;this.marketplaceQuery=e;this.extensionGalleryService=t;this.extensionManagementService=o;this.quickInputService=n;this.logService=r;this.progressService=s;this.extensionsWorkbenchService=l;this.dialogService=c;this._marketplaceExtensions=new Set;this._marketplaceThemes=[];this._searchOngoing=!1;this._searchError=void 0;this._onDidChange=new E;this._queryDelayer=new ya(200);this._installedExtensions=o.getInstalled().then(u=>{let p=new Set;for(let h of u)p.add(h.identifier.id);return p})}get themes(){return this._marketplaceThemes}get onDidChange(){return this._onDidChange.event}trigger(i){this._tokenSource&&(this._tokenSource.cancel(),this._tokenSource=void 0),this._queryDelayer.trigger(()=>(this._tokenSource=new Ye,this.doSearch(i,this._tokenSource.token)))}async doSearch(i,e){this._searchOngoing=!0,this._onDidChange.fire();try{let t=await this._installedExtensions,o={text:`${this.marketplaceQuery} ${i}`,pageSize:20},n=await this.extensionGalleryService.query(o,e);for(let r=0;r<n.total&&r<1&&!e.isCancellationRequested;r++){let s=this._marketplaceThemes.length,l=r===0?n.firstPage:await n.getPage(r,e),c=[],u=[];for(let h=0;h<l.length&&!e.isCancellationRequested;h++){let g=l[h];!t.has(g.identifier.id)&&!this._marketplaceExtensions.has(g.identifier.id)&&(this._marketplaceExtensions.add(g.identifier.id),c.push(this.getMarketplaceColorThemes(g.publisher,g.name,g.version)),u.push(g))}let p=await Promise.all(c);for(let h=0;h<p.length;h++){let g=u[h];for(let f of p[h])this._marketplaceThemes.push({id:f.id,theme:f,label:f.label,description:`${g.displayName} \xB7 ${g.publisherDisplayName}`,galleryExtension:g,buttons:[mUi]})}s!==this._marketplaceThemes.length&&(this._marketplaceThemes.sort((h,g)=>h.label.localeCompare(g.label)),this._onDidChange.fire())}}catch(t){ao(t)||(this.logService.error("Error while searching for themes:",t),this._searchError="message"in t?t.message:String(t))}finally{this._searchOngoing=!1,this._onDidChange.fire()}}openQuickPick(i,e,t){let o,n=new N;return new Promise((r,s)=>{let l=n.add(this.quickInputService.createQuickPick());l.items=[],l.sortByLabel=!1,l.matchOnDescription=!0,l.buttons=[this.quickInputService.backButton],l.title="Marketplace Themes",l.placeholder=d(16150,null),l.canSelectMany=!1,n.add(l.onDidChangeValue(()=>this.trigger(l.value))),n.add(l.onDidAccept(async c=>{let u=l.selectedItems[0];if(u?.galleryExtension){o="selected",l.hide();let p=await this.installExtension(u.galleryExtension);t(p?u.theme:e,!0)}})),n.add(l.onDidTriggerItemButton(c=>{if(NQt(c.item)){let u=c.item.theme?.extensionData?.extensionId;u?this.extensionsWorkbenchService.openSearch(`@id:${u}`):this.extensionsWorkbenchService.openSearch(`${this.marketplaceQuery} ${l.value}`)}})),n.add(l.onDidChangeActive(c=>{o===void 0&&t(c[0]?.theme,!1)})),n.add(l.onDidHide(()=>{o===void 0&&(t(e,!0),o="cancelled"),r(o)})),n.add(l.onDidTriggerButton(c=>{c===this.quickInputService.backButton&&(o="back",l.hide())})),n.add(this.onDidChange(()=>{let c=this.themes;this._searchOngoing?c=c.concat({label:"$(loading~spin) Searching for themes...",id:void 0,alwaysShow:!0}):c.length===0&&this._searchError&&(c=[{label:`$(error) ${d(16137,null,this._searchError)}`,id:void 0,alwaysShow:!0}]);let u=l.activeItems[0]?.id,p=u?c.find(h=>NQt(h)&&h.id===u):void 0;l.items=c,p&&(l.activeItems=[p])})),this.trigger(i),l.show()}).finally(()=>{n.dispose()})}async installExtension(i){if(this.extensionsWorkbenchService.openSearch(`@id:${i.identifier.id}`),!(await this.dialogService.confirm({message:d(16126,null,i.displayName,i.publisherDisplayName),primaryButton:d(16125,null)})).confirmed)return!1;try{return await this.progressService.withProgress({location:15,title:d(16128,null,i.displayName)},async()=>{await this.extensionManagementService.installFromGallery(i,{isMachineScoped:!1})}),!0}catch(t){return this.logService.error(`Problem installing extension ${i.identifier.id}`,t),!1}}dispose(){this._tokenSource&&(this._tokenSource.cancel(),this._tokenSource=void 0),this._queryDelayer.dispose(),this._marketplaceExtensions.clear(),this._marketplaceThemes.length=0,this._onDidChange.dispose()}};mKe=I([m(2,fa),m(3,Cs),m(4,Ue),m(5,se),m(6,Fo),m(7,Hi),m(8,at)],mKe);var Lbe=class{constructor(i,e,t,o,n,r,s,l){this.options=i;this.setTheme=e;this.getMarketplaceColorThemes=t;this.quickInputService=o;this.extensionGalleryService=n;this.extensionsWorkbenchService=r;this.extensionResourceLoaderService=s;this.instantiationService=l}async openQuickPick(i,e){let t;this.extensionGalleryService.isEnabled()&&(await this.extensionResourceLoaderService.supportsExtensionGalleryResources()&&this.options.browseMessage?(t=this.instantiationService.createInstance(mKe,this.getMarketplaceColorThemes.bind(this),this.options.marketplaceTag),i=[YRo(this.options.browseMessage,"marketplace"),...i]):i=[...i,{type:"separator"},YRo(this.options.installMessage,"extensions")]);let o,n=(s,l)=>{o&&clearTimeout(o),o=ut.setTimeout(()=>{o=void 0;let c=s??e;this.setTheme(c,l?"auto":"preview").then(void 0,u=>{mt(u),this.setTheme(e,void 0)})},l?0:200)},r=s=>{let l=new N;return new Promise((c,u)=>{let p=!1,h=i.findIndex(f=>NQt(f)&&f.id===s),g=l.add(this.quickInputService.createQuickPick({useSeparators:!0}));g.items=i,g.title=this.options.title,g.description=this.options.description,g.placeholder=this.options.placeholderMessage,g.activeItems=[i[h]],g.canSelectMany=!1,g.buttons=this.options.buttons??[],l.add(g.onDidTriggerButton(f=>this.options.onButton?.(f,g))),g.matchOnDescription=!0,l.add(g.onDidAccept(async f=>{p=!0;let v=g.selectedItems[0];!v||v.configureItem?!v||v.configureItem==="extensions"?this.extensionsWorkbenchService.openSearch(`${this.options.marketplaceTag} ${g.value}`):v.configureItem==="marketplace"&&t&&await t.openQuickPick(g.value,e,n)==="back"&&await r(void 0):n(v.theme,!0),g.hide(),c()})),l.add(g.onDidChangeActive(f=>n(f[0]?.theme,!1))),l.add(g.onDidHide(()=>{p||(n(e,!0),c()),g.dispose()})),l.add(g.onDidTriggerItemButton(f=>{if(NQt(f.item)){let v=f.item.theme?.extensionData?.extensionId;v?this.extensionsWorkbenchService.openSearch(`@id:${v}`):this.extensionsWorkbenchService.openSearch(`${this.options.marketplaceTag} ${g.value}`)}})),g.show()}).finally(()=>{l.dispose()})};await r(e.id),t?.dispose()}};Lbe=I([m(3,Ue),m(4,fa),m(5,Hi),m(6,mk),m(7,F)],Lbe);var XRo="workbench.action.selectTheme";W(class extends K{constructor(){super({id:XRo,title:L(16140,"Color Theme"),category:Ve.Preferences,f1:!0,keybinding:{weight:200,primary:Vi(2089,2098)}})}getTitle(a){switch(a){case"dark":return d(16154,null);case"light":return d(16157,null);case"hcDark":return d(16153,null);case"hcLight":return d(16156,null);default:return d(16155,null)}}async run(a){let i=a.get(sp),e=a.get(Go),t=i.getPreferredColorScheme(),o={tooltip:t?d(16147,null):d(16146,null),iconClass:q.asClassName(R.colorMode),location:2},n={installMessage:d(16124,null),browseMessage:"$(plus) "+d(16115,null),placeholderMessage:this.getTitle(t),marketplaceTag:"category:themes",buttons:[o],onButton:async(b,S)=>{S.hide(),await e.openSettings({query:"window.autoDetectColorScheme"})}},r=(b,S)=>i.setColorTheme(b,S),s=(b,S,y)=>i.getMarketplaceColorThemes(b,S,y),c=a.get(F).createInstance(Lbe,n,r,s),u=await i.getColorThemes(),p=i.getColorTheme(),h=bdt(u.filter(b=>b.type==="light"),d(16145,null)),g=bdt(u.filter(b=>b.type==="dark"),d(16143,null)),f=bdt(u.filter(b=>uf(b.type)),d(16144,null)),v;switch(t){case"dark":v=[...g,...h,...f];break;case"hcDark":case"hcLight":v=[...f,...h,...g];break;case"light":default:v=[...h,...g,...f];break}await c.openQuickPick(v,p)}});var JRo="workbench.action.selectIconTheme";W(class extends K{constructor(){super({id:JRo,title:L(16138,"File Icon Theme"),category:Ve.Preferences,f1:!0})}async run(a){let i=a.get(sp),e={installMessage:d(16127,null),placeholderMessage:d(16148,null),marketplaceTag:"tag:icon-theme"},t=(l,c)=>i.setFileIconTheme(l,c),o=(l,c,u)=>i.getMarketplaceFileIconThemes(l,c,u),r=a.get(F).createInstance(Lbe,e,t,o),s=[{type:"separator",label:d(16121,null)},{id:"",theme:CH.noIconTheme,label:d(16134,null),description:d(16133,null)},...bdt(await i.getFileIconThemes())];await r.openQuickPick(s,i.getFileIconTheme())}});var ZRo="workbench.action.selectProductIconTheme";W(class extends K{constructor(){super({id:ZRo,title:L(16139,"Product Icon Theme"),category:Ve.Preferences,f1:!0})}async run(a){let i=a.get(sp),e={installMessage:d(16129,null),browseMessage:"$(plus) "+d(16116,null),placeholderMessage:d(16151,null),marketplaceTag:"tag:product-icon-theme"},t=(l,c)=>i.setProductIconTheme(l,c),o=(l,c,u)=>i.getMarketplaceProductIconThemes(l,c,u),r=a.get(F).createInstance(Lbe,e,t,o),s=[{type:"separator",label:d(16136,null)},{id:fme,theme:xH.defaultTheme,label:d(16120,null)},...bdt(await i.getProductIconThemes())];await r.openQuickPick(s,i.getProductIconTheme())}});W(class extends K{constructor(){super({id:"workbench.action.tryNewDefaultThemes",title:L(16159,"Try New Default Themes"),category:Ve.Preferences,f1:!0})}async run(a){let i=a.get(sp),e=a.get(Ue),t=a.get(B),o=i.getColorTheme(),n=await i.getColorThemes(),r=new Set([rl.COLOR_THEME_LIGHT,rl.COLOR_THEME_DARK]),s=n.filter(f=>r.has(f.settingsId)),l=s.map(f=>({id:f.id,label:f.label,description:f.description})),c=new N,u=c.add(e.createQuickPick());u.items=l,u.placeholder=d(16135,null),u.canSelectMany=!1;let p=o.type==="light"||o.type==="hcLight"?rl.COLOR_THEME_LIGHT:rl.COLOR_THEME_DARK,h=l.find(f=>s.find(v=>v.id===f.id)?.settingsId===p);h&&(u.activeItems=[h]),c.add(u.onDidChangeActive(f=>{if(f[0]){let v=s.find(b=>b.id===f[0].id);v&&i.setColorTheme(v,"preview")}})),c.add(u.onDidAccept(()=>{let f=u.activeItems[0],v=f?s.find(b=>b.id===f.id):void 0;u.hide(),v&&(async()=>{try{await i.setColorTheme(v,"auto"),await t.updateValue("workbench.preferredLightColorTheme",rl.COLOR_THEME_LIGHT),await t.updateValue("workbench.preferredDarkColorTheme",rl.COLOR_THEME_DARK)}catch(b){ao(b)||mt(b)}})()}));let g=new Promise(f=>{c.add(u.onDidHide(()=>{u.selectedItems.length||i.setColorTheme(o,void 0),f()}))}).finally(()=>c.dispose());return u.show(),g}});$e.registerCommand("workbench.action.previewColorTheme",async function(a,i,e){let t=a.get(sp),o=Hbn(await t.getColorThemes(),i);o.length===0&&(o=await t.getMarketplaceColorThemes(i.publisher,i.name,i.version));for(let n of o)if(!e||n.settingsId===e)return await t.setColorTheme(n,"preview"),n.settingsId});function Hbn(a,i){return a.filter(({extensionData:e})=>e&&e.extensionIsBuiltin&&vr(e.extensionPublisher,i.publisher)&&vr(e.extensionName,i.name))}function YRo(a,i){return{id:void 0,label:a,alwaysShow:!0,buttons:[mUi],configureItem:i}}function NQt(a){return a.type!=="separator"}var Ubn={[rl.COLOR_THEME_LIGHT]:d(16119,null),[rl.COLOR_THEME_DARK]:d(16118,null)};function zbn(a){let i=a.settingsId??void 0,e={id:a.id,theme:a,label:a.label,description:Ubn[i??""]??a.description??(a.label===i?void 0:i)};return a.extensionData&&(e.buttons=[mUi]),e}function bdt(a,i){let e=new Set([rl.COLOR_THEME_DARK,rl.COLOR_THEME_LIGHT]),t=(n,r)=>{let s=e.has(n.theme?.settingsId??""),l=e.has(r.theme?.settingsId??"");return s!==l?s?-1:1:n.label.localeCompare(r.label)},o=a.map(zbn).sort(t);return o.length>0&&i&&o.unshift({type:"separator",label:i}),o}var mUi={iconClass:q.asClassName(Bbn),tooltip:d(16130,null)};W(class extends K{constructor(){super({id:"workbench.action.generateColorTheme",title:L(16122,"Generate Color Theme From Current Settings"),category:Ve.Developer,f1:!0})}run(a){let e=a.get(sp).getColorTheme(),o=ne.as(ile.ColorContribution).getColors().filter(u=>!u.deprecationMessage).map(u=>u.id).sort(),n={},r=[];for(let u of o){let p=e.getColor(u,!1);p?n[u]=We.Format.CSS.formatHexA(p,!0):r.push(u)}let s=[];for(let u of r){let p=e.getColor(u);p?n["__"+u]=We.Format.CSS.formatHexA(p,!0):s.push(u)}for(let u of s)n["__"+u]=null;let l=JSON.stringify({$schema:RCi,type:e.type,colors:n,tokenColors:e.tokenColors.filter(u=>!!u.scope)},null,"	");return l=l.replace(/\"__/g,'//"'),a.get(ee).openEditor({resource:void 0,contents:l,languageId:"jsonc",options:{pinned:!0}})}});var Kbn="workbench.action.toggleLightDarkThemes";W(class extends K{constructor(){super({id:Kbn,title:L(16158,"Toggle between Light/Dark Themes"),category:Ve.Preferences,f1:!0})}async run(a){let i=a.get(sp),e=a.get(B),t=a.get(Ne),o=a.get(Go);if(e.getValue("window.autoDetectColorScheme")){let l=d(16117,null,"window.autoDetectColorScheme");t.prompt(ft.Info,l,[{label:d(16123,null),run:()=>o.openUserSettings({query:"window.autoDetectColorScheme"})}]);return}let n=i.getColorTheme(),r="workbench.preferredDarkColorTheme";switch(n.type){case"light":r="workbench.preferredDarkColorTheme";break;case"dark":r="workbench.preferredLightColorTheme";break;case"hcLight":r="workbench.preferredHighContrastColorTheme";break;case"hcDark":r="workbench.preferredHighContrastLightColorTheme";break}let s=e.getValue(r);if(s&&typeof s=="string"){let l=(await i.getColorThemes()).find(c=>c.settingsId===s);l&&i.setColorTheme(l.id,"auto")}}});var Gbn="workbench.action.browseColorThemesInMarketplace";W(class extends K{constructor(){super({id:Gbn,title:L(16114,"Browse Color Themes in Marketplace"),category:Ve.Preferences,f1:!0})}async run(a){let i="category:themes",e=a.get(sp),t=a.get(fa),o=a.get(mk),n=a.get(Hi),r=a.get(F);if(!t.isEnabled())return;if(!await o.supportsExtensionGalleryResources()){await n.openSearch(i);return}let s=e.getColorTheme(),l=(h,g,f)=>e.getMarketplaceColorThemes(h,g,f),c,u=(h,g)=>{c&&clearTimeout(c),c=ut.setTimeout(()=>{c=void 0;let f=h??s;e.setColorTheme(f,g?"auto":"preview").then(void 0,v=>{mt(v),e.setColorTheme(s,void 0)})},g?0:200)};await r.createInstance(mKe,l,i).openQuickPick("",e.getColorTheme(),u).then(void 0,mt)}});var Sdt=new D("ThemesSubMenu");ve.appendMenuItem(D.GlobalActivity,{title:d(16142,null),submenu:Sdt,group:"2_configuration",order:7});ve.appendMenuItem(D.MenubarPreferencesMenu,{title:d(16132,null),submenu:Sdt,group:"2_configuration",order:7});ve.appendMenuItem(Sdt,{command:{id:XRo,title:d(16141,null)},order:1});ve.appendMenuItem(Sdt,{command:{id:JRo,title:d(16149,null)},order:2});ve.appendMenuItem(Sdt,{command:{id:ZRo,title:d(16152,null)},order:3});var qbn=ne.as(Jt.Configuration);qbn.registerConfiguration({id:"update",order:15,title:d(2758,null),type:"object",properties:{"update.mode":{type:"string",enum:["none","manual","start","default"],default:"default",scope:1,description:d(2759,null),tags:["usesOnlineServices"],enumDescriptions:[d(2749,null),d(2748,null),d(2751,null),d(2742,null)],policy:{name:"UpdateMode",category:"Update",minimumVersion:"1.67",localization:{description:{key:"updateMode",value:d(2759,null)},enumDescriptions:[{key:"none",value:d(2749,null)},{key:"manual",value:d(2748,null)},{key:"start",value:d(2751,null)},{key:"default",value:d(2742,null)}]}}},"update.channel":{type:"string",default:"default",scope:1,description:d(2759,null),deprecationMessage:d(2743,null,"update.mode")},"update.enableWindowsBackgroundUpdates":{type:"boolean",default:!0,scope:1,title:d(2746,null),description:d(2745,null),included:ei&&!Wt},"update.showReleaseNotes":{type:"boolean",default:!0,scope:1,description:d(2750,null),tags:["usesOnlineServices"]},"update.statusBar":{type:"string",enum:["hidden","actionable","detailed"],default:"detailed",scope:1,description:d(2752,null),enumDescriptions:[d(2747,null),d(2741,null),d(2744,null)]},"update.titleBar":{type:"string",enum:["none","actionable","detailed","always"],default:ro.quality!=="stable"?"actionable":"none",scope:1,tags:["experimental"],experiment:{mode:"startup"},description:d(2753,null),enumDescriptions:[d(2757,null),d(2754,null),d(2756,null),d(2755,null)]}}});var hKe=class{constructor(i,e,t,o,n){this._configurationService=i;this._contextMenuService=e;this._preferencesService=t;this._telemetryService=o;this._clipboardService=n;this._updatedSettings=new Map;this._encounteredSettings=new Map;this._featuredSettings=new Map;this.codeSettingAnchorRegex=new RegExp('^<a (href)=".*code.*://settings/([^\\s"]+)"(?:\\s*codesetting="([^"]+)")?>'),this.codeSettingSimpleRegex=new RegExp("^setting\\(([^\\s:)]+)(?::([^)]+))?\\)$")}get featuredSettingStates(){let i=new Map;for(let[e,t]of this._featuredSettings)i.set(e,this._configurationService.getValue(e)===t);return i}replaceAnchor(i){let e=this.codeSettingAnchorRegex.exec(i);if(e&&e.length===4){let t=e[2],o=this.render(t,e[3]);if(o)return i.replace(this.codeSettingAnchorRegex,o)}}replaceSimple(i){let e=this.codeSettingSimpleRegex.exec(i);if(e&&e.length===3){let t=e[1],o=this.render(t,e[2]);if(o)return i.replace(this.codeSettingSimpleRegex,o)}}getHtmlRenderer(){return({raw:i})=>{let e=this.replaceAnchor(i);return e&&(i=e),i}}getCodeSpanRenderer(){return({text:i})=>{let e=this.replaceSimple(i);return e||`<code>${i}</code>`}}settingToUriString(i,e){return`${Q.codeSetting}://${i}${e?`/${e}`:""}`}getSetting(i){return this._encounteredSettings.has(i)?this._encounteredSettings.get(i):this._preferencesService.getSetting(i)}parseValue(i,e){if(e==="undefined"||e==="")return;let t=this.getSetting(i);if(!t)return e;switch(t.type){case"boolean":return e==="true";case"number":return parseInt(e,10);default:return e}}render(i,e){let t=this.getSetting(i);return t?this.renderSetting(t,e):`<code>${i}</code>`}viewInSettingsMessage(i,e){if(e)return d(11575,null);{let t=s8(i);return d(11576,null,t.category,t.label)}}restorePreviousSettingMessage(i){let e=s8(i);return d(11572,null,e.category,e.label)}isAlreadySet(i,e){let t=this._configurationService.getValue(i.key);return t===e||t===void 0&&i.value===e}booleanSettingMessage(i,e){let t=s8(i.key);return this.isAlreadySet(i,e)?e?d(11565,null,t.category,t.label):d(11564,null,t.category,t.label):e?d(11574,null,t.category,t.label):d(11570,null,t.category,t.label)}stringSettingMessage(i,e){let t=s8(i.key);return this.isAlreadySet(i,e)?d(11567,null,t.category,t.label,e):d(11573,null,t.category,t.label,e)}numberSettingMessage(i,e){let t=s8(i.key);return this.isAlreadySet(i,e)?d(11566,null,t.category,t.label,e):d(11571,null,t.category,t.label,e)}renderSetting(i,e){let t=this.settingToUriString(i.key,e),o=d(11568,null);return`<code tabindex="0"><a href="${t}" class="codesetting" title="${o}" aria-role="button"><svg width="14" height="14" viewBox="0 0 15 15" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path d="M9.1 4.4L8.6 2H7.4l-.5 2.4-.7.3-2-1.3-.9.8 1.3 2-.2.7-2.4.5v1.2l2.4.5.3.8-1.3 2 .8.8 2-1.3.8.3.4 2.3h1.2l.5-2.4.8-.3 2 1.3.8-.8-1.3-2 .3-.8 2.3-.4V7.4l-2.4-.5-.3-.8 1.3-2-.8-.8-2 1.3-.7-.2zM9.4 1l.5 2.4L12 2.1l2 2-1.4 2.1 2.4.4v2.8l-2.4.5L14 12l-2 2-2.1-1.4-.5 2.4H6.6l-.5-2.4L4 13.9l-2-2 1.4-2.1L1 9.4V6.6l2.4-.5L2.1 4l2-2 2.1 1.4.4-2.4h2.8zm.6 7c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zM8 9c.6 0 1-.4 1-1s-.4-1-1-1-1 .4-1 1 .4 1 1 1z"/></svg>
			<span class="separator"></span>
			<span class="setting-name">${i.key}</span>
		</a></code>`}getSettingMessage(i,e){if(i.type==="boolean")return this.booleanSettingMessage(i,e);if(i.type==="string")return this.stringSettingMessage(i,e);if(i.type==="number")return this.numberSettingMessage(i,e)}async restoreSetting(i){let e=this._updatedSettings.get(i);return this._updatedSettings.delete(i),this._configurationService.updateValue(i,e,2)}async setSetting(i,e,t){return this._updatedSettings.set(i,e),this._configurationService.updateValue(i,t,2)}getActions(i){if(i.scheme!==Q.codeSetting)return;let e=[],t=i.authority,o=this.parseValue(i.authority,i.path.substring(1)),n=this._configurationService.inspect(t).userValue;if(o!==void 0&&o===n&&this._updatedSettings.has(t)){let s=this.restorePreviousSettingMessage(t);e.push({class:void 0,id:"restoreSetting",enabled:!0,tooltip:s,label:s,run:()=>this.restoreSetting(t)})}else if(o!==void 0){let s=this.getSetting(t),l=s?this.getSettingMessage(s,o):void 0;s&&l&&e.push({class:void 0,id:"trySetting",enabled:!this.isAlreadySet(s,o),tooltip:l,label:l,run:()=>{this.setSetting(t,n,o)}})}let r=this.viewInSettingsMessage(t,e.length>0);return e.push({class:void 0,enabled:!0,id:"viewInSettings",tooltip:r,label:r,run:()=>this._preferencesService.openApplicationSettings({query:`@id:${t}`})}),e.push({class:void 0,enabled:!0,id:"copySettingId",tooltip:d(11569,null),label:d(11569,null),run:()=>{this._clipboardService.writeText(t)}}),e}showContextMenu(i,e,t){let o=this.getActions(i);o&&this._contextMenuService.showContextMenu({getAnchor:()=>({x:e,y:t}),getActions:()=>o,getActionViewItem:n=>new hs(n,n,{label:!0})})}async updateSetting(i,e,t){if(i.scheme===Q.codeSetting)return this._telemetryService.publicLog2("releaseNotesSettingAction",{settingId:i.authority}),this.showContextMenu(i,e,t)}};hKe=I([m(0,B),m(1,Xe),m(2,Go),m(3,Te),m(4,Fi)],hKe);var gKe=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super();this._environmentService=e;this._keybindingService=t;this._languageService=o;this._openerService=n;this._requestService=r;this._configurationService=s;this._editorService=l;this._editorGroupService=c;this._codeEditorService=u;this._webviewWorkbenchService=p;this._extensionService=h;this._productService=g;this._instantiationService=f;this._updateService=v;this._commandService=b;this._releaseNotesCache=new Map;this._currentReleaseNotes=void 0;this._register(ic.onDidChange(()=>this.updateHtml())),this._register(s.onDidChangeConfiguration(S=>this.onDidChangeConfiguration(S))),this._register(p.onDidChangeActiveWebviewEditor(S=>this.onDidChangeActiveWebviewEditor(S))),this._register(this._updateService.onStateChange(()=>this.postUpdateAction())),this._simpleSettingRenderer=this._instantiationService.createInstance(hKe)}async updateHtml(){if(!this._currentReleaseNotes||!this._lastMeta)return;let e=await this.renderBody(this._lastMeta);this._currentReleaseNotes&&this._currentReleaseNotes.webview.setHtml(e)}async getBase(e){if(e){let t=this._codeEditorService.getActiveCodeEditor()?.getModel()?.uri;if(t)return ci(t)}return A.parse("https://code.visualstudio.com/raw")}async show(e,t){let o=await this.loadReleaseNotes(e,t),n=await this.getBase(t);this._lastMeta={text:o,base:n};let r=await this.renderBody(this._lastMeta),s=d(16207,null,e),l=this._editorService.activeEditorPane;if(this._currentReleaseNotes)this._currentReleaseNotes.setWebviewTitle(s),this._currentReleaseNotes.webview.setHtml(r),this._webviewWorkbenchService.revealWebview(this._currentReleaseNotes,l?l.group:this._editorGroupService.activeGroup,!1);else{this._currentReleaseNotes=this._webviewWorkbenchService.openWebview({title:s,options:{tryRestoreScrollPosition:!0,enableFindWidget:!0,disableServiceWorker:!t},contentOptions:{localResourceRoots:t?[n]:[],allowScripts:!0},extension:void 0},"releaseNotes",s,R.vscode,{group:jn,preserveFocus:!1});let c=new N;c.add(this._currentReleaseNotes.webview.onDidClickLink(u=>this.onDidClickLink(A.parse(u)))),c.add(this._currentReleaseNotes.webview.onMessage(u=>{if(u.message.type==="showReleaseNotes")this._configurationService.updateValue("update.showReleaseNotes",u.message.value);else if(u.message.type==="updateAction")u.message.commandId&&this._commandService.executeCommand(u.message.commandId);else if(u.message.type==="clickSetting"){let p=this._currentReleaseNotes?.webview.container.offsetLeft+u.message.value.x,h=this._currentReleaseNotes?.webview.container.offsetTop+u.message.value.y;this._simpleSettingRenderer.updateSetting(A.parse(u.message.value.uri),p,h)}})),c.add(this._currentReleaseNotes.onWillDispose(()=>{c.dispose(),this._currentReleaseNotes=void 0})),this._currentReleaseNotes.webview.setHtml(r)}return!0}async loadReleaseNotes(e,t){let o=/^(\d+\.\d+)\./.exec(e);if(!o)throw new Error("not found");let s=`https://code.visualstudio.com/raw/v${o[1].replace(/\./g,"_")}.md`,l=d(16209,null),c=h=>mr(h).replace(/\\/g,"\\\\"),u=h=>{let g=(S,y)=>{let w=this._keybindingService.lookupKeybinding(y);return w&&w.getLabel()||l},f=(S,y)=>{let w=L0.parseKeybinding(y);if(!w)return l;let k=this._keybindingService.resolveKeybinding(w);return k.length===0?l:k[0].getLabel()||l},v=(S,y)=>{let w=g(S,y);return w&&`<code title="${y}">${c(w)}</code>`},b=(S,y)=>{let w=f(S,y);return w&&`<code title="${y}">${c(w)}</code>`};return h.replace(/`kb\(([a-z.\d\-]+)\)`/gi,v).replace(/`kbstyle\(([^\)]+)\)`/gi,b).replace(/kb\(([a-z.\d\-]+)\)/gi,(S,y)=>PP(g(S,y))).replace(/kbstyle\(([^\)]+)\)/gi,(S,y)=>PP(f(S,y)))},p=async()=>{let h;try{if(t){let g=this._codeEditorService.getActiveCodeEditor()?.getModel()?.getValue();h=g?g.substring(g.indexOf("#")):void 0}else h=await _w(await this._requestService.request({url:s,callSite:"releaseNotesEditor.fetchReleaseNotes"},Se.None))}catch{throw new Error("Failed to fetch release notes")}if(!h||!/^#\s/.test(h)&&!t)throw new Error("Invalid release notes");return u(h)};return t?p():(this._releaseNotesCache.has(e)||this._releaseNotesCache.set(e,(async()=>{try{return await p()}catch(h){throw this._releaseNotesCache.delete(e),h}})()),this._releaseNotesCache.get(e))}async onDidClickLink(e){e.scheme===Q.codeSetting||this.addGAParameters(e,"ReleaseNotes").then(t=>this._openerService.open(t,{allowCommands:["workbench.action.openSettings","summarize.release.notes"]})).then(void 0,mt)}async addGAParameters(e,t,o="1"){return DR(this._productService,this._environmentService)&&JE(this._configurationService)===3&&e.scheme==="https"&&e.authority==="code.visualstudio.com"?e.with({query:`${e.query?e.query+"&":""}utm_source=VsCode&utm_medium=${encodeURIComponent(t)}&utm_content=${encodeURIComponent(o)}`}):e}async renderBody(e){let t=xt(),o=await jbn(e.text,this._extensionService,this._languageService,this._simpleSettingRenderer,this._productService.quality),n=ic.getColorMap(),r=n?A_(n):"",s=!!this._configurationService.getValue("update.showReleaseNotes"),l=this.getUpdateAction();return`<!DOCTYPE html>
		<html>
			<head>
				<base href="${wte(e.base).toString(!0)}/" >
				<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
				<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src https: data:; media-src https:; style-src 'nonce-${t}' https://code.visualstudio.com; script-src 'nonce-${t}';">
				<style nonce="${t}">
					${dU}
					${r}

					/* codesetting */

					code:has(.codesetting) {
						background-color: var(--vscode-textPreformat-background);
						color: var(--vscode-textPreformat-foreground);
						padding-left: 1px;
						margin-right: 3px;
						padding-right: 0px;
					}

					code:has(.codesetting):focus {
						border: 1px solid var(--vscode-button-border, transparent);
					}

					.codesetting {
						color: var(--vscode-textPreformat-foreground);
						padding: 0px 1px 1px 0px;
						font-size: 0px;
						overflow: hidden;
						text-overflow: ellipsis;
						outline-offset: 2px !important;
						box-sizing: border-box;
						text-align: center;
						cursor: pointer;
						display: inline;
						margin-right: 3px;
					}
					.codesetting svg {
						font-size: 12px;
						text-align: center;
						cursor: pointer;
						border: 1px solid var(--vscode-button-secondaryBorder, transparent);
						outline: 1px solid transparent;
						line-height: 9px;
						margin-bottom: -5px;
						padding-left: 0px;
						padding-top: 2px;
						padding-bottom: 2px;
						padding-right: 2px;
						display: inline-block;
						text-decoration: none;
						text-rendering: auto;
						text-transform: none;
						-webkit-font-smoothing: antialiased;
						-moz-osx-font-smoothing: grayscale;
						user-select: none;
						-webkit-user-select: none;
					}
					.codesetting .setting-name {
						font-size: 13px;
						padding-left: 2px;
						padding-right: 3px;
						padding-top: 1px;
						padding-bottom: 1px;
						margin-top: -3px;
					}
					.codesetting:hover {
						color: var(--vscode-textPreformat-foreground) !important;
						text-decoration: none !important;
					}
					code:has(.codesetting):hover {
						filter: brightness(140%);
						text-decoration: none !important;
					}
					.codesetting:focus {
						outline: 0 !important;
						text-decoration: none !important;
						color: var(--vscode-button-hoverForeground) !important;
					}
					.codesetting .separator {
						width: 1px;
						height: 14px;
						margin-bottom: -3px;
						display: inline-block;
						background-color: var(--vscode-editor-background);
						font-size: 12px;
						margin-right: 4px;
					}

					header { display: flex; align-items: center; padding-top: 1em; }

					/* Release notes enhancements from vscode-docs */
					html {
						font-size: 10px;
						height: 100%;
						overscroll-behavior: none;
					}

					body {
						margin: 0 auto;
						max-width: 980px;
						height: auto;
						overflow-y: auto;
						overscroll-behavior: none;
					}

					/* Scroll to top button */
					#scroll-to-top {
						position: fixed;
						width: 40px;
						height: 40px;
						right: 25px;
						bottom: 25px;
						background-color: var(--vscode-button-background, #444);
						border-color: var(--vscode-button-border);
						border-radius: 50%;
						cursor: pointer;
						box-shadow: 1px 1px 1px rgba(0,0,0,.25);
						outline: none;
						display: flex;
						justify-content: center;
						align-items: center;
					}

					#scroll-to-top:hover {
						background-color: var(--vscode-button-hoverBackground);
						box-shadow: 2px 2px 2px rgba(0,0,0,.25);
					}

					body.vscode-high-contrast #scroll-to-top {
						border-width: 2px;
						border-style: solid;
						box-shadow: none;
					}

					#scroll-to-top span.icon::before {
						content: "";
						display: block;
						background: var(--vscode-button-foreground);
						/* Chevron up icon */
						-webkit-mask-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjIuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAxNiAxNiIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTYgMTY7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4KCS5zdDB7ZmlsbDojRkZGRkZGO30KCS5zdDF7ZmlsbDpub25lO30KPC9zdHlsZT4KPHRpdGxlPnVwY2hldnJvbjwvdGl0bGU+CjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik04LDUuMWwtNy4zLDcuM0wwLDExLjZsOC04bDgsOGwtMC43LDAuN0w4LDUuMXoiLz4KPHJlY3QgY2xhc3M9InN0MSIgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2Ii8+Cjwvc3ZnPgo=');
						mask-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjIuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAxNiAxNiIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTYgMTY7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4KCS5zdDB7ZmlsbDojRkZGRkZGO30KCS5zdDF7ZmlsbDpub25lO30KPC9zdHlsZT4KPHRpdGxlPnVwY2hldnJvbjwvdGl0bGU+CjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik04LDUuMWwtNy4zLDcuM0wwLDExLjZsOC04bDgsOGwtMC43LDAuN0w4LDUuMXoiLz4KPHJlY3QgY2xhc3M9InN0MSIgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2Ii8+Cjwvc3ZnPgo=');
						width: 16px;
						height: 16px;
					}

					/* Header styling */
					h2 {
						margin-top: 1.2em;
						scroll-margin-top: 1.2em;
					}

					h2:not(:first-of-type) {
						margin-top: 4em;
						scroll-margin-top: 1em;
					}

					h3 {
						margin-top: 4em;
						scroll-margin-top: 1em;
					}

					h2 + h3 {
						margin-top: 0;
					}

					/* Highlights table styling */
					.highlights-table {
						border-collapse: collapse;
						border: none;
					}

					.highlights-table th {
						vertical-align: top;
						border: none;
						padding-top: 2em;
						font-weight: bold;
					}

					.highlights-table td {
						vertical-align: top;
						border: none;
					}

					.highlights-table tr:nth-child(2) td {
						padding-bottom: 1em;
					}

					/* Main content layout */
					.toc-nav-layout {
						display: flex;
						align-items: flex-start;
					}

					/* TOC Navigation */
					#toc-nav {
						position: sticky;
						top: 20px;
						width: 10vw;
						min-width: 120px;
						margin-right: 32px;
						margin-top: 2em;
					}

					#toc-nav > div {
						font-weight: bold;
						font-size: 1em;
						margin-bottom: 1em;
						text-transform: uppercase;
					}

					#toc-nav ul {
						list-style: none;
						padding: 0;
						margin: 0;
					}

					#toc-nav ul li {
						margin-bottom: 0.5em;
					}

					#toc-nav a {
						color: var(--vscode-editor-foreground, #ccc);
						text-decoration: none !important;
						transition: background-color 0.2s, color 0.2s;
						padding: 4px 6px;
						margin: -4px -6px;
						border-radius: 4px;
						display: block;
						outline: none;
					}

					#toc-nav a:hover {
						background-color: var(--vscode-button-secondaryHoverBackground, #1177bb);
						color: var(--vscode-button-secondaryForeground, #ffffff);
						cursor: pointer;
						text-decoration: none !important;
					}

					/* Main content area */
					.notes-main {
						flex: 1;
						min-width: 0;
					}

					/* Responsive breakpoint - Hide TOC on smaller screens */
					@media (max-width: 576px) {
						#toc-nav {
							display: none;
						}

						.toc-nav-layout {
							flex-direction: column;
						}

						.notes-main {
							margin-left: 0;
						}
					}

					/* Update action button */
					#update-action-btn {
						position: fixed;
						right: 25px;
						top: 25px;
						background-color: var(--vscode-button-background);
						color: var(--vscode-button-foreground);
						border: 1px solid var(--vscode-button-border, transparent);
						border-radius: 50%;
						width: 40px;
						height: 40px;
						padding: 0;
						cursor: pointer;
						font-size: var(--vscode-font-size);
						font-family: var(--vscode-font-family);
						white-space: nowrap;
						box-shadow: 0 2px 8px var(--vscode-widget-shadow);
						z-index: 100;
						overflow: hidden;
						display: flex;
						align-items: center;
						justify-content: center;
					}

					#update-action-btn .icon {
						flex-shrink: 0;
						display: flex;
						align-items: center;
						justify-content: center;
						width: 16px;
						height: 16px;
					}

					#update-action-btn .icon svg {
						width: 16px;
						height: 16px;
						display: block;
					}

					#update-action-btn .label {
						overflow: hidden;
						max-width: 0;
						opacity: 0;
						margin-left: 0;
					}

					#update-action-btn:hover,
					#update-action-btn.expanded {
						background-color: var(--vscode-button-hoverBackground);
						box-shadow: 0 2px 8px var(--vscode-widget-shadow);
						width: auto;
						height: auto;
						max-height: 40px;
						border-radius: var(--vscode-cornerRadius-small);
						padding: 6px 10px;
						line-height: 16px;
					}

					#update-action-btn:hover .label,
					#update-action-btn.expanded .label {
						max-width: 200px;
						opacity: 1;
						margin-left: 6px;
					}

					#update-action-btn.expanded {
						background-color: var(--vscode-button-background);
						box-shadow: 0 2px 8px var(--vscode-widget-shadow);
					}

					body.vscode-high-contrast #update-action-btn {
						border-width: 2px;
						border-style: solid;
						box-shadow: none;
					}
				</style>
			</head>
			<body>
				${o}
				<script nonce="${t}">
					const vscode = acquireVsCodeApi();
					const container = document.createElement('p');
					container.style.display = 'flex';
					container.style.alignItems = 'center';

					const input = document.createElement('input');
					input.type = 'checkbox';
					input.id = 'showReleaseNotes';
					input.checked = ${s};
					container.appendChild(input);

					const label = document.createElement('label');
					label.htmlFor = 'showReleaseNotes';
					label.textContent = '${d(16208,null)}';
					container.appendChild(label);

					const beforeElement = document.querySelector("body > h1")?.nextElementSibling;
					if (beforeElement) {
						document.body.insertBefore(container, beforeElement);
					} else {
						document.body.appendChild(container);
					}

					window.addEventListener('message', event => {
						if (event.data.type === 'showReleaseNotes') {
							input.checked = event.data.value;
						} else if (event.data.type === 'updateAction') {
							if (event.data.label) {
								updateActionBtn.querySelector('.label').textContent = event.data.label;
								updateActionBtn.dataset.commandId = event.data.commandId;
								updateActionBtn.setAttribute('aria-label', event.data.label);
								updateActionBtn.style.display = 'flex';
							} else {
								updateActionBtn.style.display = 'none';
							}
						}
					});

					window.addEventListener('click', event => {
						const href = event.target.href ?? event.target.parentElement?.href ?? event.target.parentElement?.parentElement?.href;
						if (href && (href.startsWith('${Q.codeSetting}'))) {
							vscode.postMessage({ type: 'clickSetting', value: { uri: href, x: event.clientX, y: event.clientY }});
						}
					});

					window.addEventListener('keypress', event => {
						if (event.keyCode === 13) {
							if (event.target.children.length > 0 && event.target.children[0].href) {
								const clientRect = event.target.getBoundingClientRect();
								vscode.postMessage({ type: 'clickSetting', value: { uri: event.target.children[0].href, x: clientRect.right , y: clientRect.bottom }});
							}
						}
					});

					input.addEventListener('change', event => {
						vscode.postMessage({ type: 'showReleaseNotes', value: input.checked }, '*');
					});

					// Update action button
					const updateActionBtn = document.createElement('button');
					updateActionBtn.id = 'update-action-btn';

					// Arrow-circle-down SVG icon
					const iconSpan = document.createElement('span');
					iconSpan.className = 'icon';
					iconSpan.innerHTML = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M8 1v9.5M4.5 7.5L8 11l3.5-3.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/><path d="M3 13h10" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>';
					updateActionBtn.appendChild(iconSpan);

					const labelSpan = document.createElement('span');
					labelSpan.className = 'label';
					updateActionBtn.appendChild(labelSpan);

					const initialAction = ${JSON.stringify(l??null)};
					if (initialAction) {
						labelSpan.textContent = initialAction.label;
						updateActionBtn.dataset.commandId = initialAction.commandId;
						updateActionBtn.setAttribute('aria-label', initialAction.label);
						updateActionBtn.style.display = 'flex';
					} else {
						updateActionBtn.style.display = 'none';
					}

					document.body.appendChild(updateActionBtn);

					updateActionBtn.addEventListener('click', () => {
						if (updateActionBtn.dataset.commandId) {
							vscode.postMessage({ type: 'updateAction', commandId: updateActionBtn.dataset.commandId });
						}
					});

					// Expand button when at top of page
					function updateExpandedState() {
						if (window.scrollY <= 100) {
							updateActionBtn.classList.add('expanded');
						} else {
							updateActionBtn.classList.remove('expanded');
						}
					}
					updateExpandedState();
					window.addEventListener('scroll', updateExpandedState);
				</script>
			</body>
		</html>`}getUpdateAction(){switch(this._updateService.state.type){case"available for download":return{label:d(16204,null),commandId:"update.downloadNow"};case"downloaded":return{label:d(16205,null),commandId:"update.install"};case"ready":return{label:d(16206,null),commandId:"update.restart"};default:return}}postUpdateAction(){if(this._currentReleaseNotes){let e=this.getUpdateAction();this._currentReleaseNotes.webview.postMessage({type:"updateAction",label:e?.label??"",commandId:e?.commandId??""})}}onDidChangeConfiguration(e){e.affectsConfiguration("update.showReleaseNotes")&&this.updateCheckboxWebview()}onDidChangeActiveWebviewEditor(e){e&&e===this._currentReleaseNotes&&this.updateCheckboxWebview()}updateCheckboxWebview(){this._currentReleaseNotes&&this._currentReleaseNotes.webview.postMessage({type:"showReleaseNotes",value:this._configurationService.getValue("update.showReleaseNotes")})}};gKe=I([m(0,Eo),m(1,_e),m(2,_t),m(3,Je),m(4,Ea),m(5,B),m(6,ee),m(7,wt),m(8,qt),m(9,hD),m(10,lt),m(11,tt),m(12,F),m(13,zd),m(14,ge)],gKe);function $bn(a,i){return a.replace(/<!--\s*%IF\s+(\w+)\s*%([\s\S]*?)%ENDIF\s*%\s*-->/gi,(e,t,o)=>i.has(t.toUpperCase())?o:"")}async function jbn(a,i,e,t,o){a=a.toString().replace(/<!--\s*TOC\s*/gi,"").replace(/\s*Navigation End\s*-->/gi,"");let n=new Set(["IN_PRODUCT"]);return o==="stable"?n.add("STABLE"):o==="insider"&&n.add("INSIDERS"),a=$bn(a,n),sq(a,i,e,{sanitizerConfig:{allowRelativeMediaPaths:!0,allowedLinkProtocols:{override:[Q.http,Q.https,Q.command,Q.codeSetting]},allowedTags:{augment:["nav","svg","path"]},allowedAttributes:{augment:["aria-role","viewBox","fill","xmlns","d"]}},markedExtensions:[{renderer:{html:t.getHtmlRenderer(),codespan:t.getCodeSpanRenderer()}}]})}function $6(a,i){if(!(a===void 0||i===void 0||i<=0))return Math.max(Math.min(Math.round(a/i*100),100),0)}function eMo(a){let{downloadedBytes:i,totalBytes:e,startTime:t}=a;if(i===void 0||e===void 0||t===void 0)return;let o=Date.now()-t;if(i<=0||e<=0||o<=0)return;let n=e-i;if(n<=0)return 0;let r=i/o;if(r<=0)return;let s=n/r;return Math.ceil(s/1e3)}function tMo(a){let{downloadedBytes:i,startTime:e}=a;if(i===void 0||e===void 0)return;let t=Date.now()-e;if(!(t<=0||i<=0))return i/t*1e3}function iMo(a){return`https://code.visualstudio.com/raw/v${a.replace(/\./g,"_").replace(/_0$/,"")}_update.md`}function oMo(a){let i=a/3600;if(i>=1){let t=OQt(i);return t==="1"?d(16332,null,t):d(16333,null,t)}let e=Math.floor(a/60);return e>=1?d(16334,null,e):d(16335,null,a)}function Mbe(a){if(a<1024)return d(16328,null,a);let i=a/1024;if(i<1024)return d(16330,null,OQt(i));let e=i/1024;if(e<1024)return d(16331,null,OQt(e));let t=e/1024;return d(16329,null,OQt(t))}function nMo(a){if(a!==void 0)try{let i=Date.parse(a);return isNaN(i)?void 0:i}catch{return}}function rMo(a){return new Date(a).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function OQt(a){let i=Math.round(a*10)/10;return i%1===0?i.toString():i.toFixed(1)}function Rbe(a){if(a===void 0)return;let i=/^(\d{1,10})\.(\d{1,10})\.(\d{1,10})/.exec(a);if(i)try{return{major:parseInt(i[1]),minor:parseInt(i[2]),patch:parseInt(i[3])}}catch{return}}function sMo(a){if(a&&!/The request timed out|The network connection was lost/i.test(a))return a.replace(/See https:\/\/github\.com\/Squirrel\/Squirrel\.Mac\/issues\/182 for more information/,"This might mean the application was put on quarantine by macOS. See [this link](https://github.com/microsoft/vscode/issues/7426#issuecomment-425093469) for more information")}function aMo(a,i){let e=Rbe(a),t=Rbe(i);return!!e&&!!t&&(e.major!==t.major||e.minor!==t.minor)}var IL=new Y("updateState","uninitialized"),lMo=new Y("majorMinorUpdateAvailable",!1),hUi;function Idt(a,i,e){return hUi||(hUi=a.createInstance(gKe)),hUi.show(i,e)}async function Qbn(a){let i=a.get(Je),e=a.get(tt);if(e.releaseNotesUrl){let t=A.parse(e.releaseNotesUrl);await i.open(t)}else throw new Error(d(16241,null,e.nameLong))}async function FQt(a,i){let e=a.get(F);try{await Idt(e,i,!1)}catch(t){try{await e.invokeFunction(Qbn)}catch(o){throw new Error(`${t.message} and ${o.message}`)}}}function Ybn(a,i){ve.appendMenuItem(a,{group:i,command:{id:"update.check",title:d(16210,null)},when:IL.isEqualTo("idle")}),ve.appendMenuItem(a,{group:i,command:{id:"update.checking",title:d(16212,null),precondition:C.false()},when:IL.isEqualTo("checking for updates")}),ve.appendMenuItem(a,{group:i,command:{id:"update.downloadNow",title:d(16214,null)},when:IL.isEqualTo("available for download")}),ve.appendMenuItem(a,{group:i,command:{id:"update.downloading",title:d(16216,null),precondition:C.false()},when:IL.isEqualTo("downloading")}),ve.appendMenuItem(a,{group:i,command:{id:"update.install",title:d(16219,null)},when:IL.isEqualTo("downloaded")}),ve.appendMenuItem(a,{group:i,command:{id:"update.updating",title:d(16217,null),precondition:C.false()},when:IL.isEqualTo("updating")}),ve.appendMenuItem(a,{group:i,order:2,command:{id:"update.restart",title:d(16231,null)},when:IL.isEqualTo("ready")})}function dMo(a,i){return a.major<i.major||a.minor<i.minor}var j6=class{static{this.KEY="releaseNotes/lastVersion"}constructor(i,e,t,o,n,r,s,l){Wt||s.hadLastFocus().then(async c=>{if(!c||r.getValue("update.titleBar")!=="none")return;let u=Rbe(i.get(j6.KEY,-1,"")),p=Rbe(l.version),h=r.getValue("update.showReleaseNotes"),g=l.releaseNotesUrl;h&&!o.skipReleaseNotes&&g&&u&&p&&dMo(u,p)&&Idt(e,l.version,!1).then(void 0,()=>{t.prompt(bt.Info,d(16225,null,l.nameLong,l.version),[{label:d(16229,null),run:()=>{let f=A.parse(g);n.open(f)}}],{priority:1})}),i.store(j6.KEY,l.version,-1,1)})}};j6=I([m(0,ce),m(1,F),m(2,Ne),m(3,cd),m(4,Je),m(5,B),m(6,Zt),m(7,tt)],j6);var fKe=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this.storageService=e;this.instantiationService=t;this.notificationService=o;this.dialogService=n;this.updateService=r;this.activityService=s;this.contextKeyService=l;this.productService=c;this.openerService=u;this.configurationService=p;this.hostService=h;this.layoutService=g;this.badgeDisposable=this._register(new me);this.state=r.state,this.updateStateContextKey=IL.bindTo(this.contextKeyService),this.majorMinorUpdateAvailableContextKey=lMo.bindTo(this.contextKeyService),this.titleBarEnabled=this.isTitleBarEnabled(),this._register(r.onStateChange(this.onUpdateStateChange,this)),this.onUpdateStateChange(this.updateService.state);let f=this.productService.commit,v=this.storageService.get("update/lastKnownVersion",-1);f!==v&&(this.storageService.remove("update/lastKnownVersion",-1),this.storageService.remove("update/updateNotificationTime",-1)),this._register(this.configurationService.onDidChangeConfiguration(b=>{b.affectsConfiguration("update.titleBar")&&(this.titleBarEnabled=this.isTitleBarEnabled(),this.onUpdateStateChange(this.updateService.state))})),this._register(this.layoutService.onDidChangePartVisibility(b=>{b.partId==="workbench.parts.titlebar"&&(this.titleBarEnabled=this.isTitleBarEnabled(),this.onUpdateStateChange(this.updateService.state))})),this.registerGlobalActivityActions()}isTitleBarEnabled(){return this.configurationService.getValue("update.titleBar")!=="none"&&this.layoutService.isVisible("workbench.parts.titlebar",ut)}async onUpdateStateChange(e){switch(this.updateStateContextKey.set(e.type),e.type){case"disabled":!this.titleBarEnabled&&e.reason===6&&this.notificationService.notify({severity:ft.Info,message:d(16240,null,this.productService.nameLong),actions:{primary:[ii({id:"",label:d(16221,null),run:()=>this.openerService.open("https://aka.ms/vscode-windows-setup")})]},neverShowAgain:{id:"no-updates-running-as-admin"}});break;case"idle":e.error?this.onError(e.error):this.state.type==="checking for updates"&&this.state.explicit&&await this.hostService.hadLastFocus()&&this.onUpdateNotAvailable();break;case"available for download":this.onUpdateAvailable(e.update);break;case"downloaded":this.onUpdateDownloaded(e.update);break;case"overwriting":this.onUpdateOverwriting(e);break;case"ready":{let o=e.update.productVersion;if(o){let n=Rbe(this.productService.version),r=Rbe(o);this.majorMinorUpdateAvailableContextKey.set(!!(n&&r&&dMo(n,r)))}this.onUpdateReady(e);break}}let t;this.titleBarEnabled||(e.type==="available for download"||e.type==="downloaded"||e.type==="ready"?t=new Rd(1,()=>d(16244,null,this.productService.nameShort)):e.type==="checking for updates"?t=new sx(()=>d(16211,null,this.productService.nameShort)):e.type==="downloading"||e.type==="overwriting"?t=new sx(()=>d(16215,null,this.productService.nameShort)):e.type==="updating"&&(t=new sx(()=>d(16246,null,this.productService.nameShort)))),this.badgeDisposable.clear(),t&&(this.badgeDisposable.value=this.activityService.showGlobalActivity({badge:t})),this.state=e}onError(e){if(this.titleBarEnabled)return;let t=sMo(e);t&&this.notificationService.notify({severity:ft.Error,message:t,source:d(16239,null)})}onUpdateNotAvailable(){this.titleBarEnabled||this.dialogService.info(d(16224,null))}onUpdateAvailable(e){if(this.titleBarEnabled||!this.shouldShowNotification())return;let t=e.productVersion;t&&this.notificationService.prompt(bt.Info,d(16238,null),[{label:d(16213,null),run:()=>this.updateService.downloadUpdate(!0)},{label:d(16220,null),run:()=>{}},{label:d(16229,null),run:()=>{this.instantiationService.invokeFunction(o=>FQt(o,t))}}],{priority:1})}onUpdateDownloaded(e){if(this.titleBarEnabled||Ze||this.configurationService.getValue("update.enableWindowsBackgroundUpdates")&&this.productService.target==="user"||!this.shouldShowNotification())return;let t=e.productVersion;t&&this.notificationService.prompt(bt.Info,d(16242,null,this.productService.nameLong,t),[{label:d(16218,null),run:()=>this.updateService.applyUpdate()},{label:d(16220,null),run:()=>{}},{label:d(16229,null),run:()=>{this.instantiationService.invokeFunction(o=>FQt(o,t))}}],{priority:1})}onUpdateReady(e){if(this.titleBarEnabled){this.overwriteNotificationHandle?.progress.done(),this.overwriteNotificationHandle=void 0;return}if(e.overwrite&&this.overwriteNotificationHandle){let t=this.overwriteNotificationHandle;this.overwriteNotificationHandle=void 0,t.progress.done(),t.updateMessage(d(16223,null)),t.updateActions({primary:[ii({id:"update.restartToUpdate",label:d(16232,null),run:()=>this.updateService.quitAndInstall()})]})}else if(this.overwriteNotificationHandle&&(this.overwriteNotificationHandle.close(),this.overwriteNotificationHandle=void 0),ei&&this.productService.target!=="user"||this.shouldShowNotification()){let t=[{label:d(16245,null),run:()=>this.updateService.quitAndInstall()},{label:d(16220,null),run:()=>{}}],o=e.update.productVersion;o&&t.push({label:d(16229,null),run:()=>{this.instantiationService.invokeFunction(n=>FQt(n,o))}}),this.notificationService.prompt(bt.Info,d(16243,null,this.productService.nameLong),t,{sticky:!0,priority:1})}}onUpdateOverwriting(e){this.titleBarEnabled||e.explicit&&(this.overwriteNotificationHandle=this.notificationService.notify({severity:ft.Info,sticky:!0,message:d(16222,null),source:d(16239,null)}),this.overwriteNotificationHandle.progress.infinite())}shouldShowNotification(){let e=this.productService.commit,t=new Date().getTime(),o=this.storageService.get("update/lastKnownVersion",-1);e!==o&&(this.storageService.store("update/lastKnownVersion",e,-1,1),this.storageService.store("update/updateNotificationTime",t,-1,1));let n=this.storageService.getNumber("update/updateNotificationTime",-1,t);return(t-n)/(1e3*60*60*24)>5}registerGlobalActivityActions(){$e.registerCommand("update.check",()=>this.updateService.checkForUpdates(!0)),$e.registerCommand("update.checking",()=>{}),$e.registerCommand("update.downloadNow",()=>this.updateService.downloadUpdate(!0)),$e.registerCommand("update.downloading",()=>{}),$e.registerCommand("update.install",()=>this.updateService.applyUpdate()),$e.registerCommand("update.updating",()=>{}),$e.registerCommand("update.restart",()=>this.updateService.quitAndInstall()),$e.registerCommand("_update.state",()=>this.state),Ybn(D.GlobalActivity,"7_update"),this.productService.quality==="stable"&&($e.registerCommand("update.showUpdateReleaseNotes",()=>{if(this.updateService.state.type!=="ready")return;let e=this.updateService.state.update.productVersion;e&&this.instantiationService.invokeFunction(t=>FQt(t,e))}),ve.appendMenuItem(D.GlobalActivity,{group:"7_update",order:1,command:{id:"update.showUpdateReleaseNotes",title:d(16235,null)},when:C.and(IL.isEqualTo("ready"),lMo)}))}};fKe=I([m(0,ce),m(1,F),m(2,Ne),m(3,at),m(4,zd),m(5,Sl),m(6,X),m(7,tt),m(8,Je),m(9,B),m(10,Zt),m(11,yi)],fKe);var vKe=class extends x{constructor(e,t){super();this.productService=e;this.environmentService=t;this.registerGlobalActivityActions()}registerGlobalActivityActions(){let e=this.productService.quality,t=this.environmentService.options?.productQualityChangeHandler;if(t&&(e==="stable"||e==="insider")){let o=e==="stable"?"insider":"stable",n=`update.switchQuality.${o}`,r=o==="insider";this._register(W(class extends K{constructor(){super({id:n,title:r?d(16236,null):d(16237,null),precondition:Fu,menu:{id:D.GlobalActivity,when:Fu,group:"7_update"}})}async run(l){let c=l.get(at),u=l.get(Fl),p=l.get(pM),h=l.get(ce),g=l.get(SI),f=l.get(bI),v=l.get(Ne);try{let b="switchQuality.selectSettingsSyncServiceDialogShown",S=p.userDataSyncStore,y;if(S&&r&&u.isEnabled()&&!h.getBoolean(b,-1,!1)){if(y=await this.selectSettingsSyncService(c),!y)return;h.store(b,!0,-1,0),y==="stable"&&await p.switch(y)}if((await c.confirm({type:"info",message:d(16228,null),detail:o==="insider"?d(16226,null):d(16227,null),primaryButton:d(16230,null)})).confirmed){let k=[];f.status==="syncing"&&k.push(U.toPromise(U.filter(f.onDidChangeStatus,T=>T!=="syncing"))),r&&y&&k.push(g.synchroniseUserDataSyncStoreType()),await dn.settled(k),t(o)}else y&&h.remove(b,-1)}catch(b){v.error(b)}}async selectSettingsSyncService(l){let{result:c}=await l.prompt({type:ft.Info,message:d(16234,null),detail:d(16233,null),buttons:[{label:d(16247,null),run:()=>"insiders"},{label:d(16248,null),run:()=>"stable"}],cancelButton:!0});return c}}))}}};vKe=I([m(0,tt),m(1,cd)],vKe);var Yq=class extends x{constructor(e,t,o){super();this.updateService=e;this.defaultAccountService=t;this.storageService=o;this.$i=void 0;this.throttler=this._register(new gu);!Wt&&(this.$i=this.storageService.get(Yq.STORAGE_KEY,-1,void 0),this.throttler.queue(()=>this.updateService.setInternalOrg(this.$i)),this.refresh(),this._register(this.defaultAccountService.onDidChangeDefaultAccount(()=>this.refresh())))}static{this.STORAGE_KEY="update/internalOrg"}$i;refresh(){this.throttler.queue(()=>this.doRefresh())}async doRefresh(){try{let e=await this.defaultAccountService.getDefaultAccount(),t=HMt(e?.entitlementsData?.organization_login_list);if(t===this.$i)return;this.$i=t,await this.updateService.setInternalOrg(this.$i),this.$i?this.storageService.store(Yq.STORAGE_KEY,t,-1,1):this.storageService.remove(Yq.STORAGE_KEY,-1)}catch{}}};Yq=I([m(0,zd),m(1,ng),m(2,ce)],Yq);var Pre=class extends x{constructor(e,t,o,n,r,s,l,c,u,p){super();this.hostedByTitleBar=e;this.clipboardService=t;this.commandService=o;this.configurationService=n;this.hoverService=r;this.markdownRendererService=s;this.meteredConnectionService=l;this.openerService=c;this.productService=u;this.requestService=p;this.markdown=this._register(new me);this.domNode=_(".update-tooltip");let h=M(this.domNode,_(".header"));this.titleNode=M(h,_(".title")),this._register(new Zi(h,{hoverDelegate:nI})).push(ii({id:"update.openSettings",label:d(16320,null),class:q.asClassName(R.gear),run:()=>this.runCommandAndClose("workbench.action.openSettings","@id:update*")}),{icon:!0,label:!1}),this.productInfoNode=M(this.domNode,_(".product-info"));let f=M(this.productInfoNode,_(".product-logo"));f.setAttribute("role","img"),f.setAttribute("aria-label",this.productService.nameLong);let v=M(this.productInfoNode,_(".product-details"));this.productNameNode=M(v,_(".product-name")),this.productNameNode.textContent=this.productService.nameLong;let b=this.createVersionRow(v);this.currentVersionNode=b.label,this.currentVersionCopyValue=b.copyValue;let S=this.createVersionRow(v);this.latestVersionNode=S.label,this.latestVersionCopyValue=S.copyValue,this.releaseDateNode=M(v,_(".product-release-date")),this.releaseNotesLink=M(v,_("a.release-notes-link")),this.releaseNotesLink.textContent=d(16319,null),this.releaseNotesLink.href="#",this._register(j(this.releaseNotesLink,"click",k=>{k.preventDefault(),this.releaseNotesVersion&&this.runCommandAndClose("update.showCurrentReleaseNotes",this.releaseNotesVersion)})),this.progressContainer=M(this.domNode,_(".progress-container"));let y=M(this.progressContainer,_(".progress-bar"));this.progressFill=M(y,_(".progress-fill"));let w=M(this.progressContainer,_(".progress-text"));this.progressPercentNode=M(w,_("span")),this.progressSizeNode=M(w,_("span")),this.downloadStatsContainer=M(this.progressContainer,_(".download-stats")),this.timeRemainingNode=M(this.downloadStatsContainer,_(".time-remaining")),this.speedInfoNode=M(this.downloadStatsContainer,_(".speed-info")),this.markdownContainer=M(this.domNode,_(".update-markdown")),this.messageNode=M(this.domNode,_(".state-message")),this.updateCurrentVersion()}updateCurrentVersion(){let e=this.productService.version;if(e){let t=this.productService.commit?.substring(0,7);this.currentVersionNode.textContent=t?d(16292,null,e,t):d(16291,null,e),this.currentVersionCopyValue.value=t?`${e} (${this.productService.commit})`:e,this.currentVersionNode.parentElement.style.display=""}else this.currentVersionNode.parentElement.style.display="none"}hideAll(){this.productInfoNode.style.display="",this.progressContainer.style.display="none",this.speedInfoNode.textContent="",this.timeRemainingNode.textContent="",this.messageNode.style.display="none",this.markdownContainer.style.display="none",this.markdown.clear()}renderState(e){switch(this.hideAll(),e.type){case"uninitialized":this.renderUninitialized();break;case"disabled":this.renderDisabled(e);break;case"idle":this.renderIdle(e);break;case"checking for updates":this.renderCheckingForUpdates();break;case"available for download":this.renderAvailableForDownload(e);break;case"downloading":this.renderDownloading(e);break;case"downloaded":this.renderDownloaded(e);break;case"updating":this.renderUpdating(e);break;case"ready":this.renderReady(e);break;case"overwriting":this.renderOverwriting(e);break}}renderUninitialized(){this.renderTitleAndInfo(d(16307,null)),this.renderMessage(d(16306,null))}renderDisabled({reason:e}){switch(this.renderTitleAndInfo(d(16326,null)),e){case 0:this.renderMessage(d(16299,null),R.info);break;case 1:this.renderMessage(d(16293,null),R.warning);break;case 2:this.renderMessage(d(16297,null),R.warning);break;case 3:this.renderMessage(d(16294,null),R.info);break;case 4:this.renderMessage(d(16298,null),R.info);break;case 5:this.renderMessage(d(16296,null),R.error);break;case 6:this.renderMessage(d(16300,null,this.productService.nameShort),R.warning);break;default:this.renderMessage(d(16295,null),R.warning);break}}renderIdle({error:e,notAvailable:t}){if(e){this.renderTitleAndInfo(d(16323,null)),this.renderMessage(e,R.error);return}if(t){this.renderTitleAndInfo(d(16317,null)),this.renderMessage(d(16316,null),R.info);return}switch(this.renderTitleAndInfo(d(16327,null)),this.configurationService.getValue("update.mode")){case"none":this.renderMessage(d(16283,null),R.warning);break;case"manual":this.renderMessage(d(16282,null));break;case"start":this.renderMessage(d(16284,null));break;case"default":this.meteredConnectionService.isConnectionMetered?this.renderMessage(d(16315,null),R.radioTower):this.renderMessage(d(16281,null),R.smiley);break}}renderCheckingForUpdates(){this.renderTitleAndInfo(d(16285,null)),this.renderMessage(d(16286,null))}renderAvailableForDownload({update:e}){this.renderTitleAndInfo(d(16322,null),e),this.hostedByTitleBar&&this.renderMessage(d(16287,null))}renderDownloading(e){this.renderTitleAndInfo(d(16304,null),e.update);let{downloadedBytes:t,totalBytes:o}=e;if(t!==void 0&&o!==void 0&&o>0){let n=$6(t,o)??0;this.progressFill.style.width=`${n}%`,this.progressPercentNode.textContent=`${n}%`,this.progressSizeNode.textContent=`${Mbe(t)} / ${Mbe(o)}`,this.progressContainer.style.display="";let r=tMo(e);r!==void 0&&r>0&&(this.speedInfoNode.textContent=d(16305,null,Mbe(r)));let s=eMo(e);s!==void 0&&s>0&&(this.timeRemainingNode.textContent=`~${oMo(s)} ${d(16321,null)}`),this.downloadStatsContainer.style.display=""}else this.renderMessage(d(16303,null))}renderDownloaded({update:e}){this.renderTitleAndInfo(d(16325,null),e),this.hostedByTitleBar&&this.renderMessage(d(16288,null))}renderUpdating({update:e,currentProgress:t,maxProgress:o}){this.renderTitleAndInfo(d(16312,null),e);let n=$6(t,o);n!==void 0?(this.progressFill.style.width=`${n}%`,this.progressPercentNode.textContent=`${n}%`,this.progressSizeNode.textContent="",this.progressContainer.style.display=""):this.renderMessage(d(16311,null))}renderReady({update:e}){this.renderTitleAndInfo(d(16324,null),e),this.hostedByTitleBar&&this.renderMessage(d(16289,null))}renderOverwriting({update:e}){this.renderTitleAndInfo(d(16302,null),e),this.renderMessage(d(16301,null))}async renderPostInstall(){this.hideAll(),this.renderTitleAndInfo(d(16309,null)),this.renderMessage(d(16308,null),R.info);let e=null;try{let o=iMo(this.productService.version),n=await this.requestService.request({url:o,callSite:"updateTooltip"},Se.None);e=await _w(n)}catch{}if(!e)return;this.titleNode.textContent=d(16310,null,this.productService.version),this.productInfoNode.style.display="none",this.messageNode.style.display="none";let t=this.markdownRendererService.render(new Ie(e,{isTrusted:!0,supportHtml:!0,supportThemeIcons:!0}),{actionHandler:(o,n)=>{U_(this.openerService,o,n.isTrusted),this.hoverService.hideHover(!0)}});this.markdown.value=t,Rt(this.markdownContainer),this.markdownContainer.appendChild(t.element),this.markdownContainer.style.display=""}renderTitleAndInfo(e,t){this.titleNode.textContent=e;let o=t?.productVersion;if(o){let r=t.version?.substring(0,7);this.latestVersionNode.textContent=r?d(16314,null,o,r):d(16313,null,o),this.latestVersionCopyValue.value=r?`${o} (${t.version})`:o,this.latestVersionNode.parentElement.style.display=""}else this.latestVersionNode.parentElement.style.display="none";let n=t?.timestamp??nMo(this.productService.date);typeof n=="number"&&n>0?(this.releaseDateNode.textContent=d(16318,null,rMo(n)),this.releaseDateNode.style.display=""):this.releaseDateNode.style.display="none",this.releaseNotesVersion=o??this.productService.version,this.releaseNotesLink.style.display=this.releaseNotesVersion?"":"none"}renderMessage(e,t){Rt(this.messageNode),t&&M(this.messageNode,_(".state-message-icon")).classList.add(...q.asClassNameArray(t)),M(this.messageNode,document.createTextNode(e)),this.messageNode.style.display=""}createVersionRow(e){let t=M(e,_(".product-version")),o=M(t,_("span")),n={value:""},r=M(t,_("a.copy-version-button"));r.setAttribute("role","button"),r.setAttribute("tabindex","0");let s=d(16290,null);return r.title=s,r.setAttribute("aria-label",s),M(r,_(".copy-icon")).classList.add(...q.asClassNameArray(R.copy)),this._register(j(r,"click",c=>{c.preventDefault(),c.stopPropagation(),n.value&&this.clipboardService.writeText(n.value)})),{label:o,copyValue:n}}runCommandAndClose(e,...t){this.commandService.executeCommand(e,...t),this.hoverService.hideHover(!0)}};Pre=I([m(1,Fi),m(2,ge),m(3,B),m(4,nt),m(5,On),m(6,k2),m(7,Je),m(8,tt),m(9,Ea)],Pre);var Are=class extends x{constructor(e,t,o,n){super();this.configurationService=e;this.statusbarService=o;this.accessor=this._register(new me);!Wt&&(this.tooltip=this._register(t.createInstance(Pre,!1)),this._register(n.onStateChange(this.onStateChange.bind(this))),this._register(this.configurationService.onDidChangeConfiguration(r=>{(r.affectsConfiguration("update.statusBar")||r.affectsConfiguration("update.titleBar"))&&this.onStateChange(n.state)})),this.onStateChange(n.state))}static{this.actionableStates=["available for download","downloaded","ready"]}onStateChange(e){if(this.configurationService.getValue("update.titleBar")!=="none"){this.accessor.clear();return}let o=this.configurationService.getValue("update.statusBar");if(o==="hidden"||o==="actionable"&&!Are.actionableStates.includes(e.type)){this.accessor.clear();return}switch(this.lastStateType!==e.type&&(this.accessor.clear(),this.lastStateType=e.type),this.tooltip.renderState(e),e.type){case"checking for updates":this.updateEntry("$(loading~spin) "+d(16264,null),d(16265,null),LR);break;case"available for download":this.updateEntry("$(circle-filled) "+d(16276,null),d(16275,null),"update.downloadNow");break;case"downloading":this.updateEntry(this.getDownloadingText(e),d(16268,null),LR);break;case"downloaded":this.updateEntry("$(circle-filled) "+d(16278,null),d(16277,null),"update.install");break;case"updating":this.updateEntry(this.getUpdatingText(e),void 0,LR);break;case"ready":this.updateEntry("$(circle-filled) "+d(16274,null),d(16273,null),"update.restart");break;case"overwriting":this.updateEntry("$(loading~spin) "+d(16267,null),d(16266,null),LR);break;default:this.accessor.clear();break}}updateEntry(e,t,o){let n={text:e,ariaLabel:t??e,name:d(16263,null),tooltip:this.tooltip?.domNode,command:o};this.accessor.value?this.accessor.value.update(n):this.accessor.value=this.statusbarService.addEntry(n,"status.update",0,-Number.MAX_VALUE)}getDownloadingText({downloadedBytes:e,totalBytes:t}){if(e!==void 0&&t!==void 0&&t>0){let o=$6(e,t)??0;return"$(loading~spin) "+d(16269,null,Mbe(e),Mbe(t),o)}else return"$(loading~spin) "+d(16270,null)}getUpdatingText({currentProgress:e,maxProgress:t}){let o=$6(e,t);return o!==void 0?"$(loading~spin) "+d(16271,null,o):"$(loading~spin) "+d(16272,null)}};Are=I([m(0,B),m(1,F),m(2,kr),m(3,zd)],Are);var pMo="workbench.actions.updateIndicator",mMo=new Y("updateTitleBar",!1),hMo=["available for download","downloaded","ready"],Xbn=[...hMo,"checking for updates","downloading","updating","overwriting"],uMo="updateTitleBarEntry/lastKnownVersion";W(class extends K{constructor(){super({id:pMo,title:d(16280,null),f1:!1,menu:[{id:D.TitleBarAdjacentCenter,order:0,when:mMo}]})}async run(){}});var bKe=class extends x{constructor(e,t,o,n,r,s,l,c){super();this.hostService=n;this.productService=s;this.storageService=l;this.mode="none";this.tooltipVisible=!1;!Wt&&(this.context=mMo.bindTo(o),this.tooltip=this._register(r.createInstance(Pre,!0)),this.mode=t.getValue("update.titleBar"),this._register(t.onDidChangeConfiguration(u=>{u.affectsConfiguration("update.titleBar")&&(this.mode=t.getValue("update.titleBar"),this.onStateChange())})),this.state=c.state,this._register(c.onStateChange(u=>{this.state=u,this.onStateChange()})),this._register(e.register(D.TitleBarAdjacentCenter,pMo,(u,p)=>(this.entry=r.createInstance(ydt,u,p,this.tooltip,()=>{this.tooltipVisible=!1,this.updateContext()}),this.tooltipVisible&&this.entry.showTooltip(),this.entry))),this.onStateChange(!0))}updateContext(){switch(this.mode){case"always":this.context.set(!0);break;case"detailed":this.context.set(Xbn.includes(this.state.type));break;case"actionable":this.context.set(hMo.includes(this.state.type));break;default:this.context.set(!1);break}}async onStateChange(e=!1){if(this.updateContext(),this.mode==="none")return;if(this.tooltipVisible||!await this.hostService.hadLastFocus()){this.tooltip.renderState(this.state);return}let t=e&&this.detectVersionChange();if(t)this.tooltip.renderPostInstall();else switch(this.tooltip.renderState(this.state),this.state.type){case"disabled":if(e){let o=this.state.reason;t=o===5||o===6}break;case"idle":t=!!this.state.error||!!this.state.notAvailable;break}t&&(this.tooltipVisible=!0,this.context.set(!0),this.entry?.showTooltip())}detectVersionChange(){let e;try{e=this.storageService.getObject(uMo,-1)}catch{}let t={version:this.productService.version,commit:this.productService.commit,timestamp:Date.now()};return e?.commit===t.commit?!1:(this.storageService.store(uMo,JSON.stringify(t),-1,1),e?aMo(e.version,t.version):!1)}};bKe=I([m(0,Zx),m(1,B),m(2,X),m(3,Zt),m(4,F),m(5,tt),m(6,ce),m(7,zd)],bKe);var ydt=class extends wl{constructor(e,t,o,n,r,s,l,c){super(void 0,e,t);this.tooltip=o;this.onUserDismissedTooltip=n;this.commandService=r;this.hoverService=s;this.telemetryService=l;this.updateService=c;this.showTooltipOnRender=!1;this.action.run=()=>this.runAction(),this._register(this.updateService.onStateChange(u=>this.onStateChange(u)))}render(e){super.render(e),this.content=M(e,_(".update-indicator")),this.updateTooltip(),this.onStateChange(this.updateService.state),this.showTooltipOnRender&&(this.showTooltipOnRender=!1,Wr(Re(e),()=>this.showTooltip()))}showTooltip(e=!1){if(!this.content?.isConnected){this.showTooltipOnRender=!0;return}this.hoverService.showInstantHover({content:this.tooltip.domNode,target:{targetElements:[this.content],dispose:()=>{this.content?.isConnected&&this.onUserDismissedTooltip()}},persistence:{sticky:!0},appearance:{showPointer:!0,compact:!0}},e)}getHoverContents(){return this.tooltip.domNode}async runAction(){let e;switch(this.updateService.state.type){case"available for download":e="update.downloadNow";break;case"downloaded":e="update.install";break;case"ready":e="update.restart";break;default:this.showTooltip(!0);return}this.telemetryService.publicLog2("workbenchActionExecuted",{id:e,from:"titlebar"}),await this.commandService.executeCommand(e)}onStateChange(e){if(!this.content)return;Rt(this.content),this.content.classList.remove("prominent","progress-indefinite","progress-percent","update-disabled"),this.content.style.removeProperty("--update-progress");let t=M(this.content,_(".indicator-label"));switch(t.textContent=d(16279,null),e.type){case"disabled":this.content.classList.add("update-disabled");break;case"checking for updates":case"overwriting":this.renderProgressState(this.content);break;case"available for download":case"downloaded":case"ready":this.content.classList.add("prominent");break;case"downloading":this.renderProgressState(this.content,$6(e.downloadedBytes,e.totalBytes));break;case"updating":this.renderProgressState(this.content,$6(e.currentProgress,e.maxProgress));break}}renderProgressState(e,t){t!==void 0?(e.classList.add("progress-percent"),e.style.setProperty("--update-progress",`${t}%`)):e.classList.add("progress-indefinite")}};ydt=I([m(4,ge),m(5,nt),m(6,Te),m(7,zd)],ydt);var SKe=ne.as(Qi.Workbench);SKe.registerWorkbenchContribution(j6,3);SKe.registerWorkbenchContribution(fKe,3);SKe.registerWorkbenchContribution(vKe,3);SKe.registerWorkbenchContribution(Yq,4);SKe.registerWorkbenchContribution(Are,3);SKe.registerWorkbenchContribution(bKe,3);var WQt=class extends K{static{this.AVAILABLE=!!ro.releaseNotesUrl}constructor(){super({id:K0e,title:{...L(16259,"Show Release Notes"),mnemonicTitle:d(16254,null)},category:{value:ro.nameShort,original:ro.nameShort},f1:!0,menu:[{id:D.MenubarHelpMenu,group:"1_welcome",order:5}]})}async run(i,e){let t=i.get(F),o=i.get(tt),n=i.get(Je),r=e??o.version;try{await Idt(t,r,!1)}catch{if(o.releaseNotesUrl)await n.open(A.parse(o.releaseNotesUrl));else throw new Error(d(16261,null,o.nameLong))}}},gUi=class extends K{constructor(){super({id:uyo,title:{...L(16260,"Open Current File as Release Notes"),mnemonicTitle:d(16254,null)},category:L(16251,"Developer"),f1:!0})}async run(i){let e=i.get(F),t=i.get(tt);try{await Idt(e,t.version,!0)}catch{throw new Error(d(16257,null))}}};WQt.AVAILABLE&&W(WQt);W(gUi);var fUi=class extends K{constructor(){super({id:"update.checkForUpdate",title:L(16250,"Check for Updates..."),category:{value:ro.nameShort,original:ro.nameShort},f1:!0,precondition:IL.isEqualTo("idle")})}async run(i){return i.get(zd).checkForUpdates(!0)}},vUi=class extends K{constructor(){super({id:"update.downloadUpdate",title:L(16252,"Download Update"),category:{value:ro.nameShort,original:ro.nameShort},f1:!0,precondition:IL.isEqualTo("available for download")})}async run(i){await i.get(zd).downloadUpdate(!0)}},bUi=class extends K{constructor(){super({id:"update.installUpdate",title:L(16253,"Install Update"),category:{value:ro.nameShort,original:ro.nameShort},f1:!0,precondition:IL.isEqualTo("downloaded")})}async run(i){await i.get(zd).applyUpdate()}},SUi=class extends K{constructor(){super({id:"update.restartToUpdate",title:L(16258,"Restart to Update"),category:{value:ro.nameShort,original:ro.nameShort},f1:!0,precondition:IL.isEqualTo("ready")})}async run(i){await i.get(zd).quitAndInstall()}},VQt=class a extends K{static{this.ID="workbench.action.download"}static{this.AVAILABLE=!!ro.downloadUrl}constructor(){super({id:a.ID,title:L(16255,"Download {0}",ro.nameLong),precondition:Fu,f1:!0,menu:[{id:D.StatusBarWindowIndicatorMenu,when:Fu}]})}run(i){let e=i.get(tt),t=i.get(Je);e.downloadUrl&&t.open(A.parse(e.downloadUrl))}};VQt.AVAILABLE&&W(VQt);W(fUi);W(vUi);W(bUi);W(SUi);if(ei){class a extends K{constructor(){super({id:"_update.applyupdate",title:L(16249,"Apply Update..."),category:Ve.Developer,f1:!0,precondition:IL.isEqualTo("idle")})}async run(e){let t=e.get(zd),n=await e.get(rn).showOpenDialog({title:d(16256,null),filters:[{name:"Setup",extensions:["exe"]}],canSelectFiles:!0,openLabel:vj(d(16262,null))});!n||!n[0]||await t._applySpecificUpdate(n[0].fsPath)}}W(a)}var Jbn=.15,IUi="nps/sessionCount",gMo="nps/lastSessionDate",BQt="nps/skipVersion",HQt="nps/isCandidate",wdt=class{constructor(i,e,t,o,n,r){if(!n.npsSurveyUrl||!r.getValue("telemetry.feedback.enabled")||i.get(BQt,-1,""))return;let l=new Date().toDateString(),c=i.get(gMo,-1,new Date(0).toDateString());if(l===c)return;let u=(i.getNumber(IUi,-1,0)||0)+1;if(i.store(gMo,l,-1,0),i.store(IUi,u,-1,0),u<9)return;let p=i.getBoolean(HQt,-1,!1)||Math.random()<Jbn;if(i.store(HQt,p,-1,0),!p){i.store(BQt,n.version,-1,0);return}e.prompt(ft.Info,d(14282,null),[{label:d(14283,null),run:()=>{o.open(A.parse(`${n.npsSurveyUrl}?o=${encodeURIComponent(jN)}&v=${encodeURIComponent(n.version)}&m=${encodeURIComponent(t.machineId)}`)),i.store(HQt,!1,-1,0),i.store(BQt,n.version,-1,0)}},{label:d(14281,null),run:()=>i.store(IUi,u-3,-1,0)},{label:d(14280,null),run:()=>{i.store(HQt,!1,-1,0),i.store(BQt,n.version,-1,0)}}],{priority:3})}};wdt=I([m(0,ce),m(1,Ne),m(2,Te),m(3,Je),m(4,tt),m(5,B)],wdt);wr==="en"&&ne.as(Qi.Workbench).registerWorkbenchContribution(wdt,3);var yUi=class extends x{constructor(i,e,t,o,n,r,s,l){super();let c=`${i.surveyId}.sessionCount`,u=`${i.surveyId}.lastSessionDate`,p=`${i.surveyId}.skipVersion`,h=`${i.surveyId}.isCandidate`,g=`${i.surveyId}.editedCount`,f=`${i.surveyId}.editedDate`;if(e.get(p,-1,""))return;let b=new Date().toDateString();if(e.getNumber(g,-1,0)<i.editCount){let k=this._register(new pP(T=>{T.forEach(P=>{if(P.getLanguageId()===i.languageId&&b!==e.get(f,-1)){let O=e.getNumber(g,-1,0)+1;e.store(g,O,-1,0),e.store(f,b,-1,0)}})},250));this._register(r.files.onDidSave(T=>k.work(T.model)))}let S=e.get(u,-1,new Date(0).toDateString());if(b===S)return;let y=e.getNumber(c,-1,0)+1;if(e.store(u,b,-1,0),e.store(c,y,-1,0),y<9||e.getNumber(g,-1,0)<i.editCount)return;let w=e.getBoolean(h,-1,!1)||Math.random()<i.userProbability;if(e.store(h,w,-1,0),!w){e.store(p,l.version,-1,0);return}t.prompt(ft.Info,d(14276,null,n.getLanguageName(i.languageId)??i.languageId),[{label:d(14279,null),run:()=>{o.publicLog(`${i.surveyId}.survey/takeShortSurvey`),s.open(A.parse(`${i.surveyUrl}?o=${encodeURIComponent(jN)}&v=${encodeURIComponent(l.version)}&m=${encodeURIComponent(o.machineId)}`)),e.store(h,!1,-1,0),e.store(p,l.version,-1,0)}},{label:d(14278,null),run:()=>{o.publicLog(`${i.surveyId}.survey/remindMeLater`),e.store(c,y-3,-1,0)}},{label:d(14277,null),isSecondary:!0,run:()=>{o.publicLog(`${i.surveyId}.survey/dontShowAgain`),e.store(h,!1,-1,0),e.store(p,l.version,-1,0)}}],{priority:1})}},Cdt=class{constructor(i,e,t,o,n,r,s,l){this.storageService=i;this.notificationService=e;this.telemetryService=t;this.textFileService=o;this.openerService=n;this.productService=r;this.languageService=s;this.extensionService=l;this.handleSurveys()}async handleSurveys(){this.productService.surveys&&(await this.extensionService.whenInstalledExtensionsRegistered(),this.productService.surveys.filter(i=>i.surveyId&&i.editCount&&i.languageId&&i.surveyUrl&&i.userProbability).map(i=>new yUi(i,this.storageService,this.notificationService,this.telemetryService,this.languageService,this.textFileService,this.openerService,this.productService)))}};Cdt=I([m(0,ce),m(1,Ne),m(2,Te),m(3,Uo),m(4,Je),m(5,tt),m(6,_t),m(7,lt)],Cdt);wr==="en"&&ne.as(Qi.Workbench).registerWorkbenchContribution(Cdt,3);var v1b=te("welcomePage.background",null,d(16709,null)),b1b=te("welcomePage.tileBackground",{dark:Su,light:Su,hcDark:"#000",hcLight:Su},d(16712,null)),S1b=te("welcomePage.tileHoverBackground",{dark:cb(Su,.2),light:ep(Su,.1),hcDark:null,hcLight:null},d(16714,null)),I1b=te("welcomePage.tileBorder",{dark:"#ffffff1a",light:"#0000001a",hcDark:bi,hcLight:bi},d(16713,null)),y1b=te("welcomePage.progress.background",yv,d(16710,null)),w1b=te("welcomePage.progress.foreground",nS,d(16711,null)),C1b=te("walkthrough.stepTitle.foreground",{light:"#000000",dark:"#ffffff",hcDark:null,hcLight:null},d(16708,null));var IKe=class{constructor(i,e,t,o){this.fileService=i;this.notificationService=e;this.extensionService=t;this.languageService=o;this.mdCache=new gt;this.svgCache=new gt}async renderMarkdown(i,e){let t=await this.readAndCacheStepMarkdown(i,e),o=xt(),n=ic.getColorMap(),r=n?A_(n):"";return`<!DOCTYPE html>
		<html>
			<head>
				<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
				<meta http-equiv="Content-Security-Policy" content="default-src 'none'; ${document.location.protocol==="http:"?"img-src https: data: http:":"img-src https: data:"}; media-src https:; script-src 'nonce-${o}'; style-src 'nonce-${o}';">
				<style nonce="${o}">
					${dU}
					${r}
					body > img {
						align-self: flex-start;
					}
					body > img[centered] {
						align-self: center;
					}
					body {
						display: flex;
						flex-direction: column;
						padding: 0;
						height: inherit;
					}
					.theme-picker-row {
						display: flex;
						justify-content: center;
						gap: 32px;
					}
					checklist {
						display: flex;
						gap: 32px;
						flex-direction: column;
					}
					checkbox {
						display: flex;
						flex-direction: column;
						align-items: center;
						margin: 5px;
						cursor: pointer;
					}
					checkbox > img {
						margin-bottom: 8px !important;
					}
					checkbox.checked > img {
						box-sizing: border-box;
					}
					checkbox.checked > img {
						outline: 2px solid var(--vscode-focusBorder);
						outline-offset: 4px;
						border-radius: 4px;
					}
					.theme-picker-link {
						margin-top: 16px;
						color: var(--vscode-textLink-foreground);
					}
					blockquote > p:first-child {
						margin-top: 0;
					}
					body > * {
						margin-block-end: 0.25em;
						margin-block-start: 0.25em;
					}
					vertically-centered {
						padding-top: 5px;
						padding-bottom: 5px;
						display: flex;
						justify-content: center;
						flex-direction: column;
					}
					html {
						height: 100%;
						padding-right: 32px;
					}
					h1 {
						font-size: 19.5px;
					}
					h2 {
						font-size: 18.5px;
					}
				</style>
			</head>
			<body>
				<vertically-centered>
					${t}
				</vertically-centered>
			</body>
			<script nonce="${o}">
				const vscode = acquireVsCodeApi();

				document.querySelectorAll('[when-checked]').forEach(el => {
					el.addEventListener('click', () => {
						vscode.postMessage(el.getAttribute('when-checked'));
					});
				});

				let ongoingLayout = undefined;
				const doLayout = () => {
					document.querySelectorAll('vertically-centered').forEach(element => {
						element.style.marginTop = Math.max((document.body.clientHeight - element.scrollHeight) * 3/10, 0) + 'px';
					});
					ongoingLayout = undefined;
				};

				const layout = () => {
					if (ongoingLayout) {
						clearTimeout(ongoingLayout);
					}
					ongoingLayout = setTimeout(doLayout, 0);
				};

				layout();

				document.querySelectorAll('img').forEach(element => {
					element.onload = layout;
				})

				window.addEventListener('message', event => {
					if (event.data.layoutMeNow) {
						layout();
					}
					if (event.data.enabledContextKeys) {
						document.querySelectorAll('.checked').forEach(element => element.classList.remove('checked'))
						for (const key of event.data.enabledContextKeys) {
							document.querySelectorAll('[checked-on="' + key + '"]').forEach(element => element.classList.add('checked'))
						}
					}
				});
		</script>
		</html>`}async renderSVG(i){let e=await this.readAndCacheSVGFile(i),t=xt(),o=ic.getColorMap(),n=o?A_(o):"";return`<!DOCTYPE html>
		<html>
			<head>
				<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
				<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src data:; style-src 'nonce-${t}';">
				<style nonce="${t}">
					${dU}
					${n}
					svg {
						position: fixed;
						height: 100%;
						width: 80%;
						left: 50%;
						top: 50%;
						max-width: 530px;
						min-width: 350px;
						transform: translate(-50%,-50%);
					}
				</style>
			</head>
			<body>
				${e}
			</body>
		</html>`}async renderVideo(i,e,t){let o=xt();return`<!DOCTYPE html>
		<html>
			<head>
				<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
				<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src https:; media-src https:; script-src 'nonce-${o}'; style-src 'nonce-${o}';">
				<style nonce="${o}">
					video {
						max-width: 100%;
						max-height: 100%;
						object-fit: cover;
					}
				</style>
			</head>
			<body>
				<video controls autoplay ${e?`poster="${e.toString(!0)}"`:""} muted ${t?`aria-label="${t}"`:""}>
					<source src="${i.toString(!0)}" type="video/mp4">
				</video>
			</body>
		</html>`}async readAndCacheSVGFile(i){if(!this.svgCache.has(i)){let e=await this.readContentsOfPath(i,!1);this.svgCache.set(i,e)}return Ci(this.svgCache.get(i))}async readAndCacheStepMarkdown(i,e){if(!this.mdCache.has(i)){let t=await this.readContentsOfPath(i),o=await sq(Zbn(t,e),this.extensionService,this.languageService,{sanitizerConfig:{allowedLinkProtocols:{override:"*"},allowedTags:{augment:["select","checkbox","checklist"]},allowedAttributes:{augment:["x-dispatch","data-command","when-checked","checked-on","checked"]}}});this.mdCache.set(i,o)}return Ci(this.mdCache.get(i))}async readContentsOfPath(i,e=!0){try{let t=JSON.parse(i.query).moduleId;if(e&&t)return await new Promise((n,r)=>{let s=eKe.getProvider(t);s?n(s()):r(`Getting started: no provider registered for ${t}`)})}catch{}try{let t=i.with({path:i.path.replace(/\.md$/,`.nls.${wr}.md`)}),o=wr?.replace(/-.*$/,""),n=i.with({path:i.path.replace(/\.md$/,`.nls.${o}.md`)}),r=u=>this.fileService.stat(u).then(p=>!!p.size).catch(()=>!1),[s,l]=await Promise.all([r(t),r(n)]);return(await this.fileService.readFile(s?t:l?n:i)).value.toString()}catch(t){return this.notificationService.error("Error reading markdown document at `"+i+"`: "+t),""}}};IKe=I([m(0,fe),m(1,Ne),m(2,lt),m(3,_t)],IKe);var fMo=(a,i)=>{let e=Ge(i,a);return wte(e).toString(!0)},Zbn=(a,i)=>a.replace(/src="([^"]*)"/g,(e,t)=>t.startsWith("https://")?`src="${t}"`:`src="${fMo(t,i)}"`).replace(/!\[([^\]]*)\]\(([^)]*)\)/g,(e,t,o)=>o.startsWith("https://")?`![${t}](${o})`:`![${t}](${fMo(o,i)})`);var UQt=Ae("getting-started-step-unchecked",R.circleLargeOutline,d(16751,null)),zQt=Ae("getting-started-step-checked",R.passFilled,d(16750,null));var yKe="workbench.welcomePage.restorableWalkthroughs",bMo="workbench.startupEditor",tSn="workbench.welcome.enabled",vMo="workbench.telemetryOptOutShown",Pbe=class extends x{constructor(e,t){super();this.instantiationService=e;this._register(t.registerEditor(`${Pf.RESOURCE.scheme}:/**`,{id:Pf.ID,label:d(16759,null),priority:"builtin"},{singlePerResource:!0,canSupportResource:o=>o.scheme===Pf.RESOURCE.scheme},{createEditorInput:({options:o})=>({editor:this.instantiationService.createInstance(Pf,o),options:{...o,pinned:!1}})}))}static{this.ID="workbench.contrib.startupPageEditorResolver"}};Pbe=I([m(0,F),m(1,Ka)],Pbe);var Abe=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this.configurationService=e;this.editorService=t;this.fileService=o;this.contextService=n;this.lifecycleService=r;this.layoutService=s;this.productService=l;this.commandService=c;this.environmentService=u;this.storageService=p;this.notificationService=h;this.contextKeyService=g;this.run().then(void 0,mt),this._register(this.editorService.onDidCloseEditor(f=>{f.editor instanceof Pf&&(f.editor.selectedCategory=void 0,f.editor.selectedStep=void 0)}))}static{this.ID="workbench.contrib.startupPageRunner"}async run(){if(await this.lifecycleService.when(3),kK.getValue(this.contextKeyService)||(this.productService.enableTelemetry&&this.productService.showTelemetryOptOut&&JE(this.configurationService)!==0&&!this.environmentService.skipWelcome&&!this.storageService.get(vMo,0)&&this.storageService.store(vMo,!0,0,0),this.tryOpenWalkthroughForFolder()))return;if(iSn(this.configurationService,this.contextService,this.environmentService)&&this.lifecycleService.startupKind!==3&&(!this.editorService.activeEditor||this.layoutService.openedDefaultEditors)){let t=this.configurationService.inspect(bMo);t.value==="readme"?await this.openReadme():t.value==="welcomePage"||t.value==="welcomePageInEmptyWorkbench"?await this.openGettingStarted(!0):t.value==="terminal"&&this.commandService.executeCommand("workbench.action.createTerminalEditor")}}tryOpenWalkthroughForFolder(){let e=this.storageService.get(yKe,0);if(e){let t=JSON.parse(e),o=this.contextService.getWorkspace();if(t.folder===qCe.id||t.folder===o.folders[0].uri.toString()){let n={selectedCategory:t.category,selectedStep:t.step,pinned:!1,preserveFocus:this.shouldPreserveFocus()};return this.editorService.openEditor({resource:Pf.RESOURCE,options:n}),this.storageService.remove(yKe,0),!0}}else return!1;return!1}async openReadme(){let e=di(await Promise.all(this.contextService.getWorkspace().folders.map(async t=>{let o=t.uri,n=await this.fileService.resolve(o).catch(mt),r=n?.children?n.children.map(l=>l.name).sort():[],s=r.find(l=>l.toLowerCase()==="readme.md")||r.find(l=>l.toLowerCase().startsWith("readme"));if(s)return Ge(o,s)})));if(!this.editorService.activeEditor)if(e.length){let t=o=>o.path.toLowerCase().endsWith(".md");await Promise.all([this.commandService.executeCommand("markdown.showPreview",null,e.filter(t),{locked:!0}).catch(o=>{this.notificationService.error(d(16758,null,o.message))}),this.editorService.openEditors(e.filter(o=>!t(o)).map(o=>({resource:o,options:{preserveFocus:this.shouldPreserveFocus()}})))])}else await this.openGettingStarted()}async openGettingStarted(e){let t=yQt,o=this.editorService.activeEditor;o?.typeId===t||this.editorService.editors.some(n=>n.typeId===t)||t===yQt&&this.editorService.openEditor({resource:Pf.RESOURCE,options:{index:o?0:void 0,pinned:!1,preserveFocus:this.shouldPreserveFocus(),showTelemetryNotice:e}})}shouldPreserveFocus(){let e=Nn();return!(!e||e===ut.document.body||this.layoutService.hasFocus("workbench.parts.editor"))}};Abe=I([m(0,B),m(1,ee),m(2,fe),m(3,Pe),m(4,ji),m(5,yi),m(6,tt),m(7,ge),m(8,At),m(9,ce),m(10,Ne),m(11,X)],Abe);function iSn(a,i,e){if(e.skipWelcome)return!1;let t=a.inspect(bMo);if(!t.userValue&&!t.workspaceValue){let o=a.inspect(tSn);if(o.value!==void 0&&o.value!==null)return o.value}return t.value==="welcomePage"||t.value==="readme"||i.getWorkbenchState()===1&&t.value==="welcomePageInEmptyWorkbench"||t.value==="terminal"}var wKe=class extends x{constructor(e){super();this.options=e;this._onDidChangeEntries=this._register(new E);this.onDidChangeEntries=this._onDidChangeEntries.event;this.isDisposed=!1;this.contextKeysToWatch=new Set;this.contextService=e.contextService,this.entries=void 0,this.itemCount=0,this.list=_("ul"),this.scrollbar=this._register(new ms(this.list,{})),this._register(this.onDidChangeEntries(()=>this.scrollbar.scanDomNode())),this.domElement=_(".index-list."+e.klass,{},_("h2",{},e.title),this.scrollbar.getDomNode()),this._register(this.contextService.onDidChangeContext(t=>{t.affectsSome(this.contextKeysToWatch)&&this.rerender()}))}getDomElement(){return this.domElement}layout(e){this.scrollbar.scanDomNode()}onDidChange(e){this._register(this.onDidChangeEntries(e))}register(e){this.isDisposed?e.dispose():this._register(e)}dispose(){this.isDisposed=!0,super.dispose()}setLimit(e){this.options.limit=e,this.setEntries(this.entries)}rerender(){this.setEntries(this.entries)}setEntries(e){let t=e??[];this.itemCount=0;let o=this.options.rankElement;o&&(t=t.filter(l=>o(l)!==null),t.sort((l,c)=>o(c)-o(l)));let n=t.filter(l=>!l.when||this.contextService.contextMatchesRules(l.when)),r=n.slice(0,this.options.limit),s=r.map(l=>l.id);if(!(this.entries===e&&$i(s,this.lastRendered))){for(this.entries=e,this.contextKeysToWatch.clear(),t.forEach(l=>{l.when?.keys()?.forEach(u=>this.contextKeysToWatch.add(u))}),this.lastRendered=s,this.itemCount=r.length;this.list.firstChild;)this.list.firstChild.remove();this.itemCount=r.length;for(let l of r){let c=this.options.renderElement(l);this.list.appendChild(c)}n.length>r.length&&this.options.more?this.list.appendChild(this.options.more):e!==void 0&&this.itemCount===0&&this.options.empty?this.list.appendChild(this.options.empty):this.options.footer&&this.list.appendChild(this.options.footer),this._onDidChangeEntries.fire()}}};var oSn=250,wUi="workbench.startupEditor",SMo=new Y("allWalkthroughsHidden",!1),xdt=new Y("inWelcome",!1),nSn=MHi.map((a,i)=>({command:a.content.command,description:a.description,icon:{type:"icon",icon:a.icon},id:a.id,order:i,title:a.title,when:C.deserialize(a.when)??C.true()})),IMo="workbench.welcomePage.preferReducedMotion",JM=class extends Ts{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,P,O,V,H,G){super(JM.ID,e,l,h,g);this.commandService=t;this.productService=o;this.keybindingService=n;this.gettingStartedService=r;this.configurationService=s;this.languageService=c;this.fileService=u;this.openerService=p;this.themeService=h;this.storageService=g;this.extensionService=f;this.instantiationService=v;this.notificationService=b;this.groupsService=S;this.quickInputService=w;this.workspacesService=k;this.labelService=T;this.hostService=P;this.webviewService=O;this.workspaceContextService=V;this.accessibilityService=H;this.markdownRendererService=G;this.inProgressScroll=Promise.resolve();this.dispatchListeners=new N;this.stepDisposables=new N;this.detailsPageDisposables=new N;this.mediaDisposables=new N;this.buildSlideThrottle=this._register(new gu);this.showFeaturedWalkthrough=!0;this.currentMediaComponent=void 0;this.currentMediaType=void 0;this.container=_(".gettingStartedContainer",{role:"document",tabindex:0,"aria-label":d(16679,null)}),this.stepMediaComponent=_(".getting-started-media"),this.stepMediaComponent.id=xt(),this.categoriesSlideDisposables=this._register(new N),this.detailsRenderer=new IKe(this.fileService,this.notificationService,this.extensionService,this.languageService),this.contextService=this._register(y.createScoped(this.container)),xdt.bindTo(this.contextService).set(!0),this.gettingStartedCategories=this.gettingStartedService.getWalkthroughs(),this._register(this.dispatchListeners);let $=()=>{if(this.gettingStartedCategories=this.gettingStartedService.getWalkthroughs(),this.currentWalkthrough){let J=this.currentWalkthrough.steps.map(he=>he.id),ae=this.gettingStartedCategories.find(he=>this.currentWalkthrough?.id===he.id);if(ae){let he=ae.steps.map(oe=>oe.id);$i(he,J)||this.buildSlideThrottle.queue(()=>this.buildCategoriesSlide())}}else this.buildSlideThrottle.queue(()=>this.buildCategoriesSlide())};this._register(this.gettingStartedService.onDidAddWalkthrough($)),this._register(this.gettingStartedService.onDidRemoveWalkthrough($)),this.recentlyOpened=this.workspacesService.getRecentlyOpened(),this._register(k.onDidChangeRecentlyOpened(()=>{this.recentlyOpened=k.getRecentlyOpened(),this.refreshRecentlyOpened()})),this._register(this.gettingStartedService.onDidChangeWalkthrough(J=>{let ae=this.gettingStartedCategories.find(he=>he.id===J.id);ae&&(ae.title=J.title,ae.description=J.description,this.container.querySelectorAll(`[x-category-title-for="${J.id}"]`).forEach(he=>he.innerText=ae.title),this.container.querySelectorAll(`[x-category-description-for="${J.id}"]`).forEach(he=>he.innerText=ae.description))})),this._register(this.gettingStartedService.onDidProgressStep(J=>{let ae=this.gettingStartedCategories.find(de=>de.id===J.category);if(!ae)throw Error("Could not find category with ID: "+J.category);let he=ae.steps.find(de=>de.id===J.id);if(!he)throw Error("Could not find step with ID: "+J.id);let oe=this.getWalkthroughCompletionStats(ae);!he.done&&oe.stepsComplete===oe.stepsTotal-1&&this.hideCategory(ae.id),this._register(this.configurationService.onDidChangeConfiguration(de=>{de.affectsConfiguration(IMo)&&this.container.classList.toggle("animatable",this.shouldAnimate())})),he.done=J.done,ae.id===this.currentWalkthrough?.id&&(Ci(this.window.document.querySelectorAll(`[data-done-step-id="${J.id}"]`)).forEach(Ce=>{J.done?(Ce.setAttribute("aria-checked","true"),Ce.parentElement?.setAttribute("aria-checked","true"),Ce.classList.remove(...q.asClassNameArray(UQt)),Ce.classList.add("complete",...q.asClassNameArray(zQt)),Ce.setAttribute("aria-label",d(16672,null,J.title))):(Ce.setAttribute("aria-checked","false"),Ce.parentElement?.setAttribute("aria-checked","false"),Ce.classList.remove("complete",...q.asClassNameArray(zQt)),Ce.classList.add(...q.asClassNameArray(UQt)),Ce.setAttribute("aria-label",d(16673,null,J.title)))}),J.done&&qr(d(16671,null,J.title))),this.updateCategoryProgress()})),this._register(this.storageService.onWillSaveState(J=>{if(J.reason!==1||this.workspaceContextService.getWorkspace().folders.length!==0||!this.editorInput||!this.currentWalkthrough||!this.editorInput.selectedCategory||!this.editorInput.selectedStep||!(this.groupsService.activeGroup.activeEditorPane instanceof JM))return;let he={folder:qCe.id,category:this.editorInput.selectedCategory,step:this.editorInput.selectedStep};this.storageService.store(yKe,JSON.stringify(he),0,1)}))}static{this.ID="gettingStartedPage"}get editorInput(){return this._input}shouldAnimate(){return!(this.configurationService.getValue(IMo)||this.accessibilityService.isMotionReduced())}getWalkthroughCompletionStats(e){let t=e.steps.filter(o=>this.contextService.contextMatchesRules(o.when));return{stepsComplete:t.filter(o=>o.done).length,stepsTotal:t.length}}async setInput(e,t,o,n){await super.setInput(e,t,o,n);let r=t?.selectedCategory??e.selectedCategory,s=t?.selectedStep??e.selectedStep;await this.applyInput({...t,selectedCategory:r,selectedStep:s})}async setOptions(e){super.setOptions(e),this.editorInput&&(this.editorInput.selectedCategory!==e?.selectedCategory||this.editorInput.selectedStep!==e?.selectedStep)&&await this.applyInput(e)}async applyInput(e){this.editorInput&&(this.editorInput.showTelemetryNotice=e?.showTelemetryNotice??!0,this.editorInput.selectedCategory=e?.selectedCategory,this.editorInput.selectedStep=e?.selectedStep,this.editorInput.returnToCommand=e?.returnToCommand,this.container.classList.remove("animatable"),await this.buildCategoriesSlide(e?.preserveFocus),this.shouldAnimate()&&setTimeout(()=>this.container.classList.add("animatable"),0))}async makeCategoryVisibleWhenAvailable(e,t){this.scrollToCategory(e,t)}registerDispatchListeners(){this.dispatchListeners.clear(),this.container.querySelectorAll("[x-dispatch]").forEach(e=>{let t=e.getAttribute("x-dispatch")??"",o,n;t.startsWith("openLink:https")?[o,n]=["openLink",t.replace("openLink:","")]:[o,n]=t.split(":"),o&&(this.dispatchListeners.add(j(e,"click",r=>{r.stopPropagation(),this.runDispatchCommand(o,n)})),this.dispatchListeners.add(j(e,"keyup",r=>{let s=new gi(r);switch(r.stopPropagation(),s.keyCode){case 3:case 10:this.runDispatchCommand(o,n);return}})))})}async runDispatchCommand(e,t){switch(this.commandService.executeCommand("workbench.action.keepEditor"),this.telemetryService.publicLog2("gettingStarted.ActionExecuted",{command:e,argument:t,walkthroughId:this.currentWalkthrough?.id}),e){case"scrollPrev":{this.scrollPrev();break}case"skip":{this.runSkip();break}case"showMoreRecents":{this.commandService.executeCommand(v0.ID);break}case"seeAllWalkthroughs":{await this.openWalkthroughSelector();break}case"openFolder":{this.contextService.contextMatchesRules(C.and(za.isEqualTo("workspace")))?this.commandService.executeCommand(BZ.ID):this.commandService.executeCommand("workbench.action.files.openFolder");break}case"selectCategory":{this.telemetryService.publicLog2("gettingStarted.ActionExecuted",{command:"selectCategory",argument:t,walkthroughId:this.currentWalkthrough?.id}),this.scrollToCategory(t),this.gettingStartedService.markWalkthroughOpened(t);break}case"selectStartEntry":{let o=MHi.find(n=>n.id===t);if(o)this.telemetryService.publicLog2("gettingStarted.ActionExecuted",{command:"selectStartEntry",argument:t,walkthroughId:this.currentWalkthrough?.id}),this.runStepCommand(o.content.command);else throw Error("could not find start entry with id: "+t);break}case"hideCategory":{this.hideCategory(t);break}case"selectTask":{this.selectStep(t);break}case"toggleStepCompletion":{this.toggleStepCompletion(t);break}case"allDone":{this.markAllStepsComplete();break}case"nextSection":{let o=this.currentWalkthrough?.next;o?(this.prevWalkthrough=this.currentWalkthrough,this.scrollToCategory(o)):console.error("Error scrolling to next section of",this.currentWalkthrough);break}case"openLink":{this.openerService.open(t);break}default:{console.error("Dispatch to",e,t,"not defined");break}}}hideCategory(e){if(!this.gettingStartedCategories.find(o=>o.id===e))throw Error("Could not find category with ID "+e);this.setHiddenCategories([...this.getHiddenCategories().add(e)]),this.gettingStartedList?.rerender()}markAllStepsComplete(){if(this.currentWalkthrough)this.currentWalkthrough?.steps.forEach(e=>{e.done||this.gettingStartedService.progressStep(e.id)}),this.hideCategory(this.currentWalkthrough?.id),this.scrollPrev();else throw Error("No walkthrough opened")}toggleStepCompletion(e){Ci(this.currentWalkthrough?.steps.find(o=>o.id===e)).done?this.gettingStartedService.deprogressStep(e):this.gettingStartedService.progressStep(e)}async openWalkthroughSelector(){let e=await this.quickInputService.pick(this.gettingStartedCategories.filter(t=>this.contextService.contextMatchesRules(t.when)).map(t=>({id:t.id,label:t.title,detail:t.description,description:t.source})),{canPickMany:!1,matchOnDescription:!0,matchOnDetail:!0,title:d(16665,null)});e&&this.runDispatchCommand("selectCategory",e.id)}getHiddenCategories(){return new Set(JSON.parse(this.storageService.get(xQt,0,"[]")))}setHiddenCategories(e){this.storageService.store(xQt,JSON.stringify(e),0,0)}async buildMediaComponent(e,t=!1){if(!this.currentWalkthrough)throw Error("no walkthrough selected");let o=Ci(this.currentWalkthrough.steps.find(n=>n.id===e));if(!(!t&&this.currentMediaComponent===e)){if(this.currentMediaComponent=e,this.stepDisposables.clear(),this.stepDisposables.add({dispose:()=>{this.currentMediaComponent=void 0}}),this.currentMediaType!==o.media.type&&(this.mediaDisposables.clear(),this.currentMediaType=o.media.type,this.mediaDisposables.add(Z(()=>{this.currentMediaType=void 0})),Rt(this.stepMediaComponent),o.media.type==="svg"?(this.webview=this.mediaDisposables.add(this.webviewService.createWebviewElement({title:void 0,options:{disableServiceWorker:!0},contentOptions:{},extension:void 0})),this.webview.mountTo(this.stepMediaComponent,this.window)):o.media.type==="markdown"?(this.webview=this.mediaDisposables.add(this.webviewService.createWebviewElement({options:{},contentOptions:{localResourceRoots:[o.media.root],allowScripts:!0},title:"",extension:void 0})),this.webview.mountTo(this.stepMediaComponent,this.window)):o.media.type==="video"&&(this.webview=this.mediaDisposables.add(this.webviewService.createWebviewElement({options:{},contentOptions:{localResourceRoots:[o.media.root],allowScripts:!0},title:"",extension:void 0})),this.webview.mountTo(this.stepMediaComponent,this.window))),o.media.type==="image"){this.stepsContent.classList.add("image"),this.stepsContent.classList.remove("markdown"),this.stepsContent.classList.remove("video");let n=o.media,r=_("img");Rt(this.stepMediaComponent),this.stepMediaComponent.appendChild(r),r.setAttribute("alt",n.altText),this.updateMediaSourceForColorMode(r,n.path),this.stepDisposables.add(j(this.stepMediaComponent,"click",()=>{let s=o.description.map(l=>l.nodes.filter(c=>typeof c!="string").map(c=>c.href)).flat();if(s.length===1){let l=s[0];l.startsWith("http")&&(this.telemetryService.publicLog2("gettingStarted.ActionExecuted",{command:"runStepAction",argument:l,walkthroughId:this.currentWalkthrough?.id}),this.openerService.open(l))}})),this.stepDisposables.add(this.themeService.onDidColorThemeChange(()=>this.updateMediaSourceForColorMode(r,n.path)))}else if(o.media.type==="svg"){this.stepsContent.classList.add("image"),this.stepsContent.classList.remove("markdown"),this.stepsContent.classList.remove("video");let n=o.media;this.webview.setHtml(await this.detailsRenderer.renderSVG(n.path));let r=!1;this.stepDisposables.add(Z(()=>{r=!0})),this.stepDisposables.add(this.themeService.onDidColorThemeChange(async()=>{let s=await this.detailsRenderer.renderSVG(n.path);r||this.webview.setHtml(s)})),this.stepDisposables.add(j(this.stepMediaComponent,"click",()=>{let s=o.description.map(l=>l.nodes.filter(c=>typeof c!="string").map(c=>c.href)).flat();if(s.length===1){let l=s[0];l.startsWith("http")&&(this.telemetryService.publicLog2("gettingStarted.ActionExecuted",{command:"runStepAction",argument:l,walkthroughId:this.currentWalkthrough?.id}),this.openerService.open(l))}})),this.stepDisposables.add(this.webview.onDidClickLink(s=>{(ec(s,Q.https)||ec(s,Q.http)||ec(s,Q.command))&&this.openerService.open(s,{allowCommands:!0})}))}else if(o.media.type==="markdown"){this.stepsContent.classList.remove("image"),this.stepsContent.classList.add("markdown"),this.stepsContent.classList.remove("video");let n=o.media,r=await this.detailsRenderer.renderMarkdown(n.path,n.base);this.webview.setHtml(r);let s=r.match(/checked-on=\"([^'][^"]*)\"/g)?.map(p=>p.slice(12,-1).replace(/&#39;/g,"'").replace(/&amp;/g,"&")),l=()=>{let p=s?.filter(h=>this.contextService.contextMatchesRules(C.deserialize(h)));p&&this.webview.postMessage({enabledContextKeys:p})};if(s){let p=di(s.map(g=>C.deserialize(g))),h=new Set(p.flatMap(g=>g.keys()));this.stepDisposables.add(this.contextService.onDidChangeContext(g=>{g.affectsSome(h)&&l()}))}let c=!1;this.stepDisposables.add(Z(()=>{c=!0})),this.stepDisposables.add(this.webview.onDidClickLink(p=>{if(ec(p,Q.https)||ec(p,Q.http)||ec(p,Q.command)){let h=p.startsWith("command:toSide:");h&&(p=p.replace("command:toSide:","command:"),this.focusSideEditorGroup()),this.openerService.open(p,{allowCommands:!0,openToSide:h})}})),r.indexOf("<code>")>=0&&this.stepDisposables.add(this.themeService.onDidColorThemeChange(async()=>{let p=await this.detailsRenderer.renderMarkdown(n.path,n.base);c||(this.webview.setHtml(p),l())}));let u=new Xo(50);this.layoutMarkdown=()=>{u.trigger(()=>{this.webview.postMessage({layoutMeNow:!0})})},this.stepDisposables.add(u),this.stepDisposables.add({dispose:()=>this.layoutMarkdown=void 0}),l(),this.stepDisposables.add(this.webview.onMessage(async p=>{let h=p.message;if(h.startsWith("command:"))this.openerService.open(h,{allowCommands:!0});else if(h.startsWith("setTheme:")){let g=h.slice(9),f=(await this.themeService.getColorThemes()).find(v=>v.settingsId===g);f&&this.themeService.setColorTheme(f.id,2)}else console.error("Unexpected message",h)}))}else if(o.media.type==="video"){this.stepsContent.classList.add("video"),this.stepsContent.classList.remove("markdown"),this.stepsContent.classList.remove("image");let n=o.media,r=this.themeService.getColorTheme().type,s=n.path[r],l=n.poster?n.poster[r]:void 0,c=n.altText?n.altText:d(16675,null,o.title),u=await this.detailsRenderer.renderVideo(s,l,c);this.webview.setHtml(u);let p=!1;this.stepDisposables.add(Z(()=>{p=!0})),this.stepDisposables.add(this.themeService.onDidColorThemeChange(async()=>{let h=this.themeService.getColorTheme().type,g=n.path[h],f=n.poster?n.poster[h]:void 0,v=await this.detailsRenderer.renderVideo(g,f,c);p||this.webview.setHtml(v)}))}}}async selectStepLoose(e){if(this.editorInput)if(e.startsWith(`${this.editorInput.selectedCategory}#`))this.selectStep(e);else{let t=this.editorInput.selectedCategory+"#"+e;this.selectStep(t)}}provideScreenReaderUpdate(){if(this.configurationService.getValue("accessibility.verbosity.walkthrough")){let e=this.keybindingService.lookupKeybinding(mZ.id)?.getAriaLabel();return e?d(16646,null,e):d(16647,null)}return""}async selectStep(e,t=!0,o){if(this.editorInput){if(e){let n=this.container.querySelector(`[data-step-id="${e}"]`);if(!n){if(n=this.container.querySelector("[data-step-id]"),!n)return;e=Ci(n.getAttribute("data-step-id"))}n.parentElement?.querySelectorAll(".expanded").forEach(l=>{if(l.getAttribute("data-step-id")!==e){l.classList.remove("expanded"),l.setAttribute("aria-expanded","false");let c=l.querySelector(".codicon");c&&c.removeAttribute("tabindex")}}),o||setTimeout(()=>n.focus(),t&&this.shouldAnimate()?oSn:0),this.editorInput.selectedStep=e,n.classList.add("expanded"),n.setAttribute("aria-expanded","true"),this.buildMediaComponent(e,!0);let r=n.querySelector(".codicon");r&&r.setAttribute("tabindex","0"),this.gettingStartedService.progressByEvent("stepSelected:"+e);let s=this.currentWalkthrough?.steps?.find(l=>l.id===e);s&&n.setAttribute("aria-label",`${this.provideScreenReaderUpdate()} ${s.title}`)}else this.editorInput.selectedStep=void 0;this.detailsPageScrollbar?.scanDomNode(),this.detailsScrollbar?.scanDomNode()}}updateMediaSourceForColorMode(e,t){let o=this.themeService.getColorTheme().type,n=t[o].toString(!0).replace(/ /g,"%20");e.srcset=n.toLowerCase().endsWith(".svg")?n:n+" 1.5x"}createEditor(e){this.detailsPageScrollbar&&this.detailsPageScrollbar.dispose(),this.categoriesPageScrollbar&&this.categoriesPageScrollbar.dispose(),this.categoriesSlide=_(".gettingStartedSlideCategories.gettingStartedSlide");let t=_("button.prev-button.button-link",{"x-dispatch":"scrollPrev"},_("span.scroll-button.codicon.codicon-chevron-left"),_("span.moreText",{},d(16657,null)));this.stepsSlide=_(".gettingStartedSlideDetails.gettingStartedSlide",{},t),this.stepsContent=_(".gettingStartedDetailsContent",{}),this.detailsPageScrollbar=this._register(new ms(this.stepsContent,{className:"full-height-scrollable",vertical:2})),this.categoriesPageScrollbar=this._register(new ms(this.categoriesSlide,{className:"full-height-scrollable categoriesScrollbar",vertical:2})),this.stepsSlide.appendChild(this.detailsPageScrollbar.getDomNode());let o=_(".gettingStarted",{},this.categoriesPageScrollbar.getDomNode(),this.stepsSlide);this.container.appendChild(o),this.categoriesPageScrollbar.scanDomNode(),this.detailsPageScrollbar.scanDomNode(),e.appendChild(this.container)}async buildCategoriesSlide(e){this.categoriesSlideDisposables.clear();let t=new cm({icon:R.check,actionClassName:"getting-started-checkbox",isChecked:this.configurationService.getValue(wUi)==="welcomePage",title:d(16649,null),...gh});t.domNode.id="showOnStartup";let o=_("label.caption",{for:"showOnStartup"},d(16683,null)),n=()=>{t.checked?(this.telemetryService.publicLog2("gettingStarted.ActionExecuted",{command:"showOnStartupChecked",argument:void 0,walkthroughId:this.currentWalkthrough?.id}),this.configurationService.updateValue(wUi,"welcomePage")):(this.telemetryService.publicLog2("gettingStarted.ActionExecuted",{command:"showOnStartupUnchecked",argument:void 0,walkthroughId:this.currentWalkthrough?.id}),this.configurationService.updateValue(wUi,"none"))};this.categoriesSlideDisposables.add(t),this.categoriesSlideDisposables.add(t.onChange(()=>{n()})),this.categoriesSlideDisposables.add(j(o,"click",()=>{t.checked=!t.checked,n()}));let r=_(".header",{},_("h1.product-name.caption",{},this.productService.nameLong),_("p.subtitle.description",{},d(16654,null))),s=_(".categories-column.categories-column-left",{}),l=_(".categories-column.categories-column-right",{}),c=this.buildStartList(),u=this.buildRecentlyOpenedList(),p=this.buildGettingStartedWalkthroughsList(),h=_(".footer",{},_("p.showOnStartup",{},t.domNode,o)),g=()=>{p.itemCount?(this.container.classList.remove("noWalkthroughs"),vi(l,p.getDomElement())):(this.container.classList.add("noWalkthroughs"),vi(l)),setTimeout(()=>this.categoriesPageScrollbar?.scanDomNode(),50),f()},f=()=>{this.container.classList.contains("noWalkthroughs")?(u.setLimit(10),vi(s,c.getDomElement()),vi(l,u.getDomElement())):(u.setLimit(5),vi(s,c.getDomElement(),u.getDomElement()))};p.onDidChange(g),g(),vi(this.categoriesSlide,_(".gettingStartedCategoriesContainer",{},r,s,l,h)),this.categoriesPageScrollbar?.scanDomNode(),this.updateCategoryProgress(),this.registerDispatchListeners();let v=this.editorInput;if(v?.selectedCategory){if(this.currentWalkthrough=this.gettingStartedCategories.find(b=>b.id===v.selectedCategory),this.currentWalkthrough){this.buildCategorySlide(v.selectedCategory,v.selectedStep,e),this.setSlide("details");return}else if(this.gettingStartedCategories=this.gettingStartedService.getWalkthroughs(),this.currentWalkthrough=this.gettingStartedCategories.find(b=>b.id===v.selectedCategory),this.currentWalkthrough){this.buildCategorySlide(v.selectedCategory,v.selectedStep,e),this.setSlide("details");return}}if(this.editorInput?.showTelemetryNotice&&this.productService.openToWelcomeMainPage){let b=_("p.telemetry-notice");this.buildTelemetryFooter(b),h.appendChild(b)}else if(!this.productService.openToWelcomeMainPage&&this.showFeaturedWalkthrough&&this.storageService.isNew(-1)){let b=this.storageService.get(Hgt,-1)||new Date().toUTCString();if(((+new Date-+new Date(b))/1e3/60/60/24<1?"openToFirstCategory":"index")==="openToFirstCategory"){let w=this.gettingStartedCategories.filter(k=>!k.when||this.contextService.contextMatchesRules(k.when))[0];if(w&&this.editorInput){this.currentWalkthrough=w,this.editorInput.selectedCategory=this.currentWalkthrough?.id,this.editorInput.walkthroughPageTitle=this.currentWalkthrough.walkthroughPageTitle,this.buildCategorySlide(this.editorInput.selectedCategory,void 0,e),this.setSlide("details",!0);return}}}this.setSlide("categories")}buildRecentlyOpenedList(){let e=o=>{let n,r,s;ZR(o)?(r={folderUri:o.folderUri},n=o.label||this.labelService.getWorkspaceLabel(o.folderUri,{verbose:2}),s=o.folderUri):(n=o.label||this.labelService.getWorkspaceLabel(o.workspace,{verbose:2}),r={workspaceUri:o.workspace.configPath},s=o.workspace.configPath);let{name:l,parentPath:c}=Cbt(n),u=_("li"),p=_("button.button-link");p.innerText=l,p.title=n,p.setAttribute("aria-label",d(16680,null,l,c)),p.addEventListener("click",v=>{this.telemetryService.publicLog2("gettingStarted.ActionExecuted",{command:"openRecent",argument:void 0,walkthroughId:this.currentWalkthrough?.id}),this.hostService.openWindow([r],{forceNewWindow:v.ctrlKey||v.metaKey,remoteAuthority:o.remoteAuthority||null}),v.preventDefault(),v.stopPropagation()}),u.appendChild(p);let h=_("span");h.classList.add("path"),h.classList.add("detail"),h.innerText=c,h.title=n,u.appendChild(h);let g=_("a.codicon.codicon-close.hide-category-button.recently-opened-delete-button",{tabindex:0,role:"button",title:d(16681,null),"aria-label":d(16682,null,l)}),f=async v=>{v.preventDefault(),v.stopPropagation(),await this.workspacesService.removeRecentlyOpened([s])};return g.addEventListener("click",f),g.addEventListener("keydown",async v=>{let b=new gi(v);(b.keyCode===3||b.keyCode===10)&&await f(v)}),u.appendChild(g),u};this.recentlyOpenedList&&this.recentlyOpenedList.dispose();let t=this.recentlyOpenedList=new wKe({title:d(16667,null),klass:"recently-opened",limit:5,empty:_(".empty-recent",{},d(16662,null),_("button.button-link",{"x-dispatch":"openFolder"},d(16663,null)),d(16674,null)),more:_(".more",{},_("button.button-link",{"x-dispatch":"showMoreRecents",title:d(16668,null,this.getKeybindingLabel(v0.ID))},d(16669,null))),renderElement:e,contextService:this.contextService});return t.onDidChange(()=>this.registerDispatchListeners()),this.recentlyOpened.then(({workspaces:o})=>{let n=this.filterRecentlyOpened(o),r=()=>{t.setEntries(n)};r(),t.register(this.labelService.onDidChangeFormatters(()=>r()))}).catch(mt),t}filterRecentlyOpened(e){return e.filter(t=>!this.workspaceContextService.isCurrentWorkspace(EA(t)?t.workspace:t.folderUri)).map(t=>({...t,id:EA(t)?t.workspace.id:t.folderUri.toString()}))}refreshRecentlyOpened(){this.recentlyOpenedList&&this.recentlyOpened.then(({workspaces:e})=>{let t=this.filterRecentlyOpened(e);this.recentlyOpenedList?.setEntries(t)}).catch(mt)}buildStartList(){let e=o=>_("li",{},_("button.button-link",{"x-dispatch":"selectStartEntry:"+o.id,title:o.description+" "+this.getKeybindingLabel(o.command)},this.iconWidgetFor(o),_("span",{},o.title)));this.startList&&this.startList.dispose();let t=this.startList=new wKe({title:d(16670,null),klass:"start-container",limit:10,renderElement:e,rankElement:o=>-o.order,contextService:this.contextService});return t.setEntries(nSn),t.onDidChange(()=>this.registerDispatchListeners()),t}buildGettingStartedWalkthroughsList(){let e=n=>{let r=(n.newItems||n.newEntry)&&!n.isFeatured,s=_(".new-badge",{});n.newEntry?vi(s,_(".new-category",{},d(16659,null))):n.newItems&&vi(s,_(".new-items",{},d(16660,null)));let l=_(".featured-badge",{}),c=_(".description-content",{});n.isFeatured&&this.showFeaturedWalkthrough&&(vi(l,_(".featured",{},_("span.featured-icon.codicon.codicon-star-full"))),vi(c,...Un(n.description)));let u=_("h3.category-title.max-lines-3",{"x-category-title-for":n.id});return vi(u,...Un(n.title)),_("button.getting-started-category"+(n.isFeatured&&this.showFeaturedWalkthrough?".featured":""),{"x-dispatch":"selectCategory:"+n.id,title:n.description},l,_(".main-content",{},this.iconWidgetFor(n),u,r?s:_(".no-badge"),_("a.codicon.codicon-close.hide-category-button",{tabindex:0,"x-dispatch":"hideCategory:"+n.id,title:d(16650,null),role:"button","aria-label":d(16651,null)})),c,_(".category-progress",{"x-data-category-id":n.id},_(".progress-bar-outer",{role:"progressbar"},_(".progress-bar-inner"))))};this.gettingStartedList&&this.gettingStartedList.dispose();let t=n=>{let r=n.order;return n.isFeatured&&(r+=7),n.newEntry&&(r+=3),n.newItems&&(r+=2),n.recencyBonus&&(r+=4*n.recencyBonus),this.getHiddenCategories().has(n.id)&&(r=null),r},o=this.gettingStartedList=new wKe({title:d(16677,null),klass:"getting-started",limit:5,footer:_("span.button-link.see-all-walkthroughs",{"x-dispatch":"seeAllWalkthroughs",tabindex:0},d(16669,null)),renderElement:e,rankElement:t,contextService:this.contextService});return o.onDidChange(()=>{let r=this.getHiddenCategories().size||o.itemCount<this.gettingStartedCategories.filter(s=>this.contextService.contextMatchesRules(s.when)).length;this.container.classList.toggle("someWalkthroughsHidden",!!r),this.registerDispatchListeners(),SMo.bindTo(this.contextService).set(o.itemCount===0),this.updateCategoryProgress()}),o.setEntries(this.gettingStartedCategories),SMo.bindTo(this.contextService).set(o.itemCount===0),o}layout(e){this.detailsScrollbar?.scanDomNode(),this.categoriesPageScrollbar?.scanDomNode(),this.detailsPageScrollbar?.scanDomNode(),this.startList?.layout(e),this.gettingStartedList?.layout(e),this.recentlyOpenedList?.layout(e),this.editorInput?.selectedStep&&this.currentMediaType&&(this.mediaDisposables.clear(),this.stepDisposables.clear(),this.buildMediaComponent(this.editorInput.selectedStep)),this.layoutMarkdown?.(),this.container.classList.toggle("height-constrained",e.height<=600),this.container.classList.toggle("width-constrained",e.width<=400),this.container.classList.toggle("width-semi-constrained",e.width<=950),this.categoriesPageScrollbar?.scanDomNode(),this.detailsPageScrollbar?.scanDomNode(),this.detailsScrollbar?.scanDomNode()}updateCategoryProgress(){this.window.document.querySelectorAll(".category-progress").forEach(e=>{let t=e.getAttribute("x-data-category-id"),o=this.gettingStartedCategories.find(l=>l.id===t);if(!o)throw Error("Could not find category with ID "+t);let n=this.getWalkthroughCompletionStats(o),r=Ci(e.querySelector(".progress-bar-inner"));r.setAttribute("aria-valuemin","0"),r.setAttribute("aria-valuenow",""+n.stepsComplete),r.setAttribute("aria-valuemax",""+n.stepsTotal);let s=n.stepsComplete/n.stepsTotal*100;r.style.width=`${s}%`,e.parentElement.classList.toggle("no-progress",n.stepsComplete===0),n.stepsTotal===n.stepsComplete?r.title=d(16653,null,n.stepsComplete):r.title=d(16656,null,n.stepsComplete,n.stepsTotal)})}async scrollToCategory(e,t){this.gettingStartedCategories.some(n=>n.id===e)||(this.gettingStartedCategories=this.gettingStartedService.getWalkthroughs());let o=this.gettingStartedCategories.find(n=>n.id===e);if(!o)throw Error("Could not find category with ID: "+e);this.inProgressScroll=this.inProgressScroll.then(async()=>{this.editorInput&&(vi(this.stepsContent),this.editorInput.selectedCategory=e,this.editorInput.selectedStep=t,this.editorInput.walkthroughPageTitle=o.walkthroughPageTitle,this.currentWalkthrough=o,this.buildCategorySlide(e,t),this.setSlide("details"))})}iconWidgetFor(e){let t=e.icon.type==="icon"?_(q.asCSSSelector(e.icon.icon)):_("img.category-icon",{src:e.icon.path});return t.classList.add("icon-widget"),t}focusSideEditorGroup(){let e=this.groupsService.getPart(this.group).contentDimension;if(!e||e.width<=700||this.container.classList.contains("width-constrained")||this.container.classList.contains("width-semi-constrained"))return;if(this.groupsService.count===1){let o=uy(this.configurationService),n=this.groupsService.addGroup(this.groupsService.groups[0],o);this.groupsService.activateGroup(n)}let t=this.groupsService.getGroups(1).find(o=>!(o.activeEditor instanceof Pf));t&&(this.groupsService.activateGroup(t),t.focus())}runStepCommand(e){let t=e.startsWith("command:"),o=e.startsWith("command:toSide:"),n=e.replace(/command:(toSide:)?/,"command:");if(this.telemetryService.publicLog2("gettingStarted.ActionExecuted",{command:"runStepAction",argument:e,walkthroughId:this.currentWalkthrough?.id}),o&&this.focusSideEditorGroup(),t){let r=A.parse(n),s=[];try{s=am(decodeURIComponent(r.query))}catch{try{s=am(r.query)}catch{}}if(Array.isArray(s)||(s=[s]),(r.path===gLe.ID.toString()||r.path===b0.ID.toString())&&this.workspaceContextService.getWorkspace().folders.length===0){let l=this.currentWalkthrough?.steps.findIndex(c=>c.id===this.editorInput?.selectedStep);if(l!==void 0&&l>-1&&this.currentWalkthrough?.steps.slice(l+1).some(c=>!c.done)){let c={folder:qCe.id,category:this.editorInput?.selectedCategory,step:this.editorInput?.selectedStep};this.storageService.store(yKe,JSON.stringify(c),0,1)}}this.commandService.executeCommand(r.path,...s).then(l=>{let c=l?.openFolder;if(c){if(!A.isUri(c)){console.warn("Warn: Running walkthrough command",e,"yielded non-URI `openFolder` result",c,". It will be disregarded.");return}let u={folder:c.toString(),category:this.editorInput?.selectedCategory,step:this.editorInput?.selectedStep};this.storageService.store(yKe,JSON.stringify(u),0,1),this.hostService.openWindow([{folderUri:c}])}})}else this.openerService.open(n,{allowCommands:!0});!t&&(e.startsWith("https://")||e.startsWith("http://"))&&this.gettingStartedService.progressByEvent("onLink:"+e)}buildMarkdownDescription(e,t){for(;e.firstChild;)e.firstChild.remove();for(let o of t)if(o.nodes.length===1&&typeof o.nodes[0]!="string"){let n=o.nodes[0],r=M(e,_(".button-container")),s=new Wi(r,{title:n.title,supportIcons:!0,...Qo}),l=n.href.startsWith("command:"),c=n.href.replace(/command:(toSide:)?/,"command:");if(s.label=n.label,s.onDidClick(u=>{u.stopPropagation(),u.preventDefault(),this.runStepCommand(n.href)},null,this.detailsPageDisposables),l){let u=this.getKeyBinding(c);if(u){let p=_("span.shortcut-message",{},d(16655,null));e.appendChild(p);let h=new Am(p,Po,{...Jx});h.set(u),this.detailsPageDisposables.add(h)}}this.detailsPageDisposables.add(s)}else{let n=M(e,_("p"));for(let r of o.nodes)if(typeof r=="string"){let s=Un(r);for(let l of s)typeof l=="string"?n.appendChild(zE(l,{renderCodeSegments:!0},_("span"))):n.appendChild(l)}else{let s=ec(r.href,Q.http)||ec(r.href,Q.https)?{...r,title:r.href}:r,l=this.instantiationService.createInstance(rg,n,s,{opener:c=>this.runStepCommand(c)});this.detailsPageDisposables.add(l)}}return e}clearInput(){this.stepDisposables.clear(),super.clearInput()}buildCategorySlide(e,t,o){if(!this.editorInput)return;this.detailsScrollbar&&this.detailsScrollbar.dispose(),this.extensionService.whenInstalledExtensionsRegistered().then(()=>{this.extensionService.activateByEvent(`onWalkthrough:${e.replace(/[^#]+#/,"")}`)}),this.detailsPageDisposables.clear(),this.mediaDisposables.clear();let n=this.gettingStartedCategories.find(S=>S.id===e);if(!n)throw Error("could not find category with ID "+e);let r=_(".category-description.description.max-lines-3",{"x-category-description-for":n.id});this.buildMarkdownDescription(r,odt(n.description));let s=_(".getting-started-category",{},_(".category-description-container",{},_("h2.category-title.max-lines-3",{"x-category-title-for":n.id},...Un(n.title)),r)),l=_(".step-list-container");this.detailsPageDisposables.add(j(l,"keydown",S=>{let y=new gi(S),w=()=>n.steps.findIndex(k=>k.id===this.editorInput?.selectedStep);if(y.keyCode===16){let k=n.steps.filter((T,P)=>P<w()&&this.contextService.contextMatchesRules(T.when));k.length&&this.selectStep(k[k.length-1].id,!1)}if(y.keyCode===18){let k=n.steps.find((T,P)=>P>w()&&this.contextService.contextMatchesRules(T.when));k&&this.selectStep(k.id,!1)}}));let c,u=new Set(n.steps.flatMap(S=>S.when.keys())),p=()=>{n.steps.sort((y,w)=>y.order-w.order);let S=n.steps.filter(y=>this.contextService.contextMatchesRules(y.when));$i(c,S,(y,w)=>y.id===w.id)||(c=S,vi(l,...c.map(y=>{let w=_(".codicon"+(y.done?".complete"+q.asCSSSelector(zQt):q.asCSSSelector(UQt)),{"data-done-step-id":y.id,"x-dispatch":"toggleStepCompletion:"+y.id,role:"checkbox","aria-checked":y.done?"true":"false","aria-label":y.done?d(16672,null,y.title):d(16673,null,y.title)}),k=_(".step-description-container",{"x-step-description-for":y.id});this.buildMarkdownDescription(k,y.description);let T=_("h3.step-title.max-lines-3",{"x-step-title-for":y.id});vi(T,...Un(y.title));let P=_(".step-container",{},T,k);return y.media.type==="image"?P.appendChild(_(".image-description",{"aria-label":d(16658,null,y.media.altText)})):y.media.type==="video"&&P.appendChild(_(".video-description",{"aria-label":d(16676,null,y.media.altText)})),_("button.getting-started-step",{"x-dispatch":"selectTask:"+y.id,"data-step-id":y.id,"aria-expanded":"false","aria-checked":y.done?"true":"false",role:"button"},w,P)})))};p(),this.detailsPageDisposables.add(this.contextService.onDidChangeContext(S=>{S.affectsSome(u)&&this.currentWalkthrough&&this.editorInput&&(p(),this.registerDispatchListeners(),this.selectStep(this.editorInput.selectedStep,!1))}));let h=this.gettingStartedCategories.find(S=>S.id===n.next),g=_(".getting-started-detail-container",{role:"list"},l,_(".done-next-container",{},_("button.button-link.all-done",{"x-dispatch":"allDone"},_("span.codicon.codicon-check-all"),d(16648,null)),...h?[_("button.button-link.next",{"x-dispatch":"nextSection"},d(16661,null),_("span.codicon.codicon-arrow-right"))]:[]));this.detailsScrollbar=this._register(new ms(g,{className:"steps-container"}));let f=this.detailsScrollbar.getDomNode(),v=_(".getting-started-footer");this.editorInput.showTelemetryNotice&&JE(this.configurationService)!==0&&this.productService.enableTelemetry&&this.buildTelemetryFooter(v),vi(this.stepsContent,s,f,this.stepMediaComponent,v);let b=n.steps.find(S=>this.contextService.contextMatchesRules(S.when)&&!S.done)??n.steps[0];this.selectStep(t??b.id,!t,o),this.detailsScrollbar.scanDomNode(),this.detailsPageScrollbar?.scanDomNode(),this.registerDispatchListeners()}buildTelemetryFooter(e){let o=`[${d(16666,null)}](command:workbench.action.openPrivacyStatementUrl)`,r=`[${d(16664,null)}](command:settings.filterByTelemetry)`,s=d(16652,null,this.productService.nameShort,o,r),l=this.detailsPageDisposables.add(this.markdownRendererService.render({value:s,isTrusted:!0}));e.append(l.element)}getKeybindingLabel(e){e=e.replace(/^command:/,"");let t=this.keybindingService.lookupKeybinding(e)?.getLabel();return t?`(${t})`:""}getKeyBinding(e){return e=e.replace(/^command:/,""),this.keybindingService.lookupKeybinding(e)}async scrollPrev(){this.inProgressScroll=this.inProgressScroll.then(async()=>{this.prevWalkthrough&&this.prevWalkthrough!==this.currentWalkthrough?(this.currentWalkthrough=this.prevWalkthrough,this.prevWalkthrough=void 0,this.makeCategoryVisibleWhenAvailable(this.currentWalkthrough.id)):this.editorInput?.returnToCommand?this.commandService.executeCommand(this.editorInput.returnToCommand):(this.currentWalkthrough=void 0,this.editorInput&&(this.editorInput.selectedCategory=void 0,this.editorInput.selectedStep=void 0,this.editorInput.showTelemetryNotice=!1,this.editorInput.walkthroughPageTitle=void 0),this.gettingStartedCategories.length!==this.gettingStartedList?.itemCount&&this.buildCategoriesSlide(),this.selectStep(void 0),this.setSlide("categories"),this.container.focus())})}runSkip(){this.commandService.executeCommand("workbench.action.closeActiveEditor")}escape(){this.editorInput?.selectedCategory?this.scrollPrev():this.runSkip()}setSlide(e,t=!1){let o=Ci(this.container.querySelector(".gettingStarted"));if(e==="categories")o.classList.remove("showDetails"),o.classList.add("showCategories"),this.container.querySelector(".prev-button.button-link").style.display="none",this.container.querySelector(".gettingStartedSlideDetails").querySelectorAll("button").forEach(n=>n.disabled=!0),this.container.querySelector(".gettingStartedSlideCategories").querySelectorAll("button").forEach(n=>n.disabled=!1),this.container.querySelector(".gettingStartedSlideCategories").querySelectorAll("input").forEach(n=>n.disabled=!1);else{o.classList.add("showDetails"),o.classList.remove("showCategories");let n=this.container.querySelector(".prev-button.button-link");n.style.display=this.editorInput?.showWelcome||this.editorInput?.returnToCommand||this.prevWalkthrough?"block":"none";let r=n.querySelector(".moreText");r.textContent=t?d(16678,null):d(16657,null),this.container.querySelector(".gettingStartedSlideDetails").querySelectorAll("button").forEach(s=>s.disabled=!1),this.container.querySelector(".gettingStartedSlideCategories").querySelectorAll("button").forEach(s=>s.disabled=!0),this.container.querySelector(".gettingStartedSlideCategories").querySelectorAll("input").forEach(s=>s.disabled=!0)}}focus(){super.focus();let e=this.container.ownerDocument.activeElement,t=this.container.parentElement;for(;t&&t!==e;)t=t.parentElement;t&&this.container.focus()}};JM=I([m(1,ge),m(2,tt),m(3,_e),m(4,XM),m(5,B),m(6,Te),m(7,_t),m(8,fe),m(9,Je),m(10,sp),m(11,ce),m(12,lt),m(13,F),m(14,Ne),m(15,wt),m(16,X),m(17,Ue),m(18,jp),m(19,rt),m(20,Zt),m(21,cp),m(22,Pe),m(23,Oi),m(24,On)],JM);var KQt=class{canSerialize(i){return!0}serialize(i){return JSON.stringify({selectedCategory:i.selectedCategory,selectedStep:i.selectedStep})}deserialize(i,e){return i.invokeFunction(t=>{try{let{selectedCategory:o,selectedStep:n}=JSON.parse(e);return new Pf({selectedCategory:o,selectedStep:n})}catch{}return new Pf({})})}};var GQt=class{constructor(){this.type="view";this.priority=110;this.name="walkthroughs";this.when=xdt;this.getProvider=i=>{let t=i.get(ee).activeEditorPane;if(!(t instanceof JM))return;let o=t.input;if(!(o instanceof Pf)||!o.selectedCategory)return;let r=i.get(XM).getWalkthrough(o.selectedCategory),s=o.selectedStep;if(r)return new CUi(i.get(X),i.get(ge),i.get(Je),t,r,s)}}},CUi=class extends x{constructor(e,t,o,n,r,s){super();this.contextService=e;this.commandService=t;this.openerService=o;this._gettingStartedPage=n;this._walkthrough=r;this._focusedStep=s;this._currentStepIndex=0;this._activeWalkthroughSteps=[];this.id="walkthrough";this.verbositySettingKey="accessibility.verbosity.walkthrough";this.options={type:"view"};this._activeWalkthroughSteps=r.steps.filter(l=>!l.when||this.contextService.contextMatchesRules(l.when))}get actions(){let e=[],o=this._activeWalkthroughSteps[this._currentStepIndex].description.map(n=>n.nodes.filter(r=>typeof r!="string").map(r=>({href:r.href,label:r.label}))).flat();if(o.length===1){let n=o[0];e.push(new it("walthrough.step.action",n.label,q.asClassName(R.run),!0,()=>{let r=n.href.startsWith("command:"),s=n.href.replace(/command:(toSide:)?/,"command:");if(r){let l=A.parse(s),c=[];try{c=am(decodeURIComponent(l.query))}catch{try{c=am(l.query)}catch{}}Array.isArray(c)||(c=[c]),this.commandService.executeCommand(l.path,...c)}else this.openerService.open(s,{allowCommands:!0})}))}return e}provideContent(){if(this._focusedStep){let e=this._activeWalkthroughSteps.findIndex(t=>t.id===this._focusedStep);e!==-1&&(this._currentStepIndex=e)}return this._getContent(this._walkthrough,this._activeWalkthroughSteps[this._currentStepIndex],!0)}_getContent(e,t,o){let n=t.description.map(s=>s.nodes.filter(l=>typeof l=="string")).join(`
`),r=d(16706,null,t.title,n);return o?[d(16707,null,e.title),d(16705,null,e.description),r].join(`
`):r}provideNextContent(){if(++this._currentStepIndex>=this._activeWalkthroughSteps.length){--this._currentStepIndex;return}return this._getContent(this._walkthrough,this._activeWalkthroughSteps[this._currentStepIndex])}providePreviousContent(){if(--this._currentStepIndex<0){++this._currentStepIndex;return}return this._getContent(this._walkthrough,this._activeWalkthroughSteps[this._currentStepIndex])}onClose(){if(this._currentStepIndex>-1){let e=this._activeWalkthroughSteps[this._currentStepIndex];this._gettingStartedPage.makeCategoryVisibleWhenAvailable(this._walkthrough.id,e.id)}}};var rSn="workbench.editors.agentSessionsWelcomeInput",HN=class a extends ls{static{this.ID=rSn}static{this.RESOURCE=A.from({scheme:Q.walkThrough,authority:"vscode_agent_sessions_welcome"})}get typeId(){return a.ID}get editorId(){return this.typeId}toUntyped(){return{resource:a.RESOURCE,options:{override:a.ID,pinned:!1}}}get resource(){return a.RESOURCE}matches(i){return super.matches(i)?!0:i instanceof a}constructor(i={}){super(),this._showTelemetryNotice=!!i.showTelemetryNotice,this._initiator=i.initiator??"command",this._workspaceKind=i.workspaceKind}getName(){return d(16645,null)}get showTelemetryNotice(){return this._showTelemetryNotice}set showTelemetryNotice(i){this._showTelemetryNotice=i}get initiator(){return this._initiator}get workspaceKind(){return this._workspaceKind}getTelemetryDescriptor(){let i=super.getTelemetryDescriptor();return i.initiator=this._initiator,i.workspaceKind=this._workspaceKind,i}};var xUi="workbench.startupEditor",yMo=6,sSn=10,aSn=10,s_=class extends Ts{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,P,O,V){super(s_.ID,e,t,o,n);this.storageService=n;this.instantiationService=r;this.layoutService=l;this.commandService=c;this.editorService=u;this.agentSessionsService=p;this.configurationService=h;this.productService=g;this.walkthroughsService=f;this.chatService=v;this.chatEntitlementService=b;this.markdownRendererService=S;this.workspaceContextService=y;this.workspacesService=w;this.hostService=k;this.workspaceTrustManagementService=T;this.viewDescriptorService=P;this.chatWidgetService=O;this.logService=V;this.sessionsControlDisposables=this._register(new N);this.contentDisposables=this._register(new N);this.walkthroughs=[];this._selectedSessionProvider="local";this._recentTrustedWorkspaces=[];this._isEmptyWorkspace=!1;this._workspaceKind="empty";this._openedAt=0;this.container=_(".agentSessionsWelcome",{role:"document",tabindex:0,"aria-label":d(16629,null)}),this.contextService=this._register(s.createScoped(this.container)),ie.inAgentSessionsWelcome.bindTo(this.contextService).set(!0),this._register(this.chatEntitlementService.onDidChangeSentiment(()=>{let H=this.input||this._storedInput;this.chatEntitlementService.sentiment.hidden&&H&&(this._closedBy="chatHidden",this.group.closeEditor(H))}))}static{this.ID="agentSessionsWelcomePage"}static{this.COMMAND_ID="workbench.action.openAgentSessionsWelcome"}createEditor(e){e.appendChild(this.container),this.contentContainer=_(".agentSessionsWelcome-content"),this.scrollableElement=this._register(new ms(this.contentContainer,{className:"agentSessionsWelcome-scrollable",vertical:1})),this.container.appendChild(this.scrollableElement.getDomNode())}async setInput(e,t,o,n){this._storedInput=e,this._openedAt=Date.now(),await super.setInput(e,t,o,n),this._workspaceKind=e.workspaceKind??"empty",await this.buildContent()}clearInput(){if(this._openedAt>0){let e=Date.now()-this._openedAt;this.telemetryService.publicLog2("agentSessionsWelcome.closed",{visibleDurationMs:e,closedBy:this._closedBy??"disposed"}),this._openedAt=0,this._closedBy=void 0}super.clearInput()}async buildContent(){if(this.contentDisposables.clear(),this.sessionsControlDisposables.clear(),this.sessionsControl=void 0,Rt(this.contentContainer),this._isEmptyWorkspace=this.workspaceContextService.getWorkbenchState()===1,this._isEmptyWorkspace){let l=await this.getRecentlyOpenedWorkspaces(!0);this._recentTrustedWorkspaces=l.slice(0,sSn)}this.walkthroughs=this.walkthroughsService.getWalkthroughs();let e=M(this.contentContainer,_(".agentSessionsWelcome-header"));M(e,_("h1.product-name",{},this.productService.nameLong));let t=M(e,_(".agentSessionsWelcome-startEntries"));await this.buildStartEntries(t);let o=M(this.contentContainer,_(".agentSessionsWelcome-chatSection"));this.buildChatWidget(o);let n=M(this.contentContainer,_(".agentSessionsWelcome-sessionsSection"));this.buildSessionsOrPrompts(n);let r=M(this.contentContainer,_(".agentSessionsWelcome-footer"));this.buildFooter(r);let s=this.agentSessionsService.model.sessions.length>0;this.contentDisposables.add(this.agentSessionsService.model.onDidChangeSessions(()=>{let l=this.agentSessionsService.model.sessions.length>0;l!==s&&(s=l,Rt(n),this.buildSessionsOrPrompts(n)),this.layoutSessionsControl()})),this.scrollableElement?.scanDomNode()}async buildStartEntries(e){let n=[(await this.getRecentlyOpenedWorkspaces(!1)).length>0?{icon:R.folderOpened,label:d(16636,null),command:"workbench.action.openRecent"}:{icon:R.folderOpened,label:d(16635,null),command:"workbench.action.files.openFolder"},{icon:R.newFile,label:d(16633,null),command:"welcome.showNewFileEntries"},{icon:R.repoClone,label:d(16631,null),command:"git.clone"}];for(let r of n){let s=M(e,_("button.agentSessionsWelcome-startEntry"));s.appendChild(Sn(r.icon)),s.appendChild(document.createTextNode(r.label)),s.onclick=()=>{this.telemetryService.publicLog2("agentSessionsWelcome.ActionExecuted",{welcomeKind:"agentSessionsWelcomePage",action:"executeCommand",actionId:r.command}),this.commandService.executeCommand(r.command)}}}buildChatWidget(e){let t=M(e,_(".agentSessionsWelcome-chatWidget")),o=this.layoutService.getContainer(Re(t)).appendChild(_(".chat-editor-overflow.monaco-editor"));this.contentDisposables.add(Z(()=>o.remove()));let n=this.contentDisposables.add(this.contextService.createScoped(t)),r=this.contentDisposables.add(this.instantiationService.createChild(new _o([X,n]))),s=this.contentDisposables.add(new E),l=async g=>{if(this.chatWidget&&this.chatModelRef){this.chatWidget.setModel(void 0),this.chatModelRef.dispose();let f=$Si({type:g,position:"sidebar",displayName:""}),v=await this.chatService.acquireOrLoadSession(f,"panel",Se.None);this.chatModelRef=v??this.chatService.startNewLocalSession("panel"),this.contentDisposables.add(this.chatModelRef),this.chatModelRef.object&&this.chatWidget.setModel(this.chatModelRef.object)}},c={getActiveSessionProvider:()=>this._selectedSessionProvider,setActiveSessionProvider:g=>{this._selectedSessionProvider=g,s.fire(g);try{l(g)}catch{}},onDidChangeActiveSessionProvider:s.event},u=this.contentDisposables.add(new E),p=this.contentDisposables.add(new E),h=this._isEmptyWorkspace?{getWorkspaces:()=>this._recentTrustedWorkspaces.map(g=>({uri:this.getWorkspaceUri(g),label:this.getWorkspaceLabel(g),isFolder:ZR(g)})),getSelectedWorkspace:()=>this._selectedWorkspace,setSelectedWorkspace:g=>{this._selectedWorkspace=g,u.fire(g)},onDidChangeSelectedWorkspace:u.event,onDidChangeWorkspaces:p.event,openFolderCommand:"workbench.action.files.openFolder"}:void 0;this.chatWidget=this.contentDisposables.add(r.createInstance(kI,"panel",{},{autoScroll:g=>g!=="ask",renderFollowups:!1,supportsFileReferences:!0,renderInputOnTop:!0,rendererOptions:{renderTextEditsAsSummary:()=>!0,referencesExpandedWhenEmptyResponse:!1,progressMessageAtBottomOfResponse:g=>g!=="ask"},editorOverflowWidgetsDomNode:o,enableImplicitContext:!0,enableWorkingSet:"explicit",supportsChangingModes:!0,sessionTypePickerDelegate:c,workspacePickerDelegate:h,submitHandler:this._isEmptyWorkspace?(g,f)=>this.handleWorkspaceSubmission(g,f):void 0},{listForeground:CK,listBackground:Ho,overlayBackground:Ho,inputEditorBackground:Ho,resultEditorBackground:Ho})),this.chatWidget.render(t),this.chatWidget.setVisible(!0),this.contentDisposables.add(Wr(Re(t),()=>{this.layoutChatWidget()})),this.chatModelRef=this.chatService.startNewLocalSession("panel"),this.contentDisposables.add(this.chatModelRef),this.chatModelRef.object&&this.chatWidget.setModel(this.chatModelRef.object),this.contentDisposables.add(j(t,"mousedown",()=>{this.chatWidget?.focusInput()})),this.contentDisposables.add(this.chatService.onDidSubmitRequest(({chatSessionResource:g})=>{if(this.chatModelRef?.object?.sessionResource.toString()===g.toString()){let f=this.chatWidget?.input.currentModeObs.get().name.get()||"unknown";this.telemetryService.publicLog2("agentSessionsWelcome.chatSubmitted",{mode:f,provider:this._selectedSessionProvider,workspaceKind:this._workspaceKind,selectedRecentWorkspace:this._selectedWorkspace!==void 0}),this._closedBy="chatSubmission",this.openSessionInChat(g)}})),this.applyPrefillData()}getWorkspaceLabel(e){return ZR(e)?e.label||He(e.folderUri):EA(e)?e.label||He(e.workspace.configPath):""}getWorkspaceUri(e){if(ZR(e))return e.folderUri;if(EA(e))return e.workspace.configPath;throw new Error("Invalid workspace type")}async handleWorkspaceSubmission(e,t){if(!this._selectedWorkspace||!e.trim())return!1;let o={query:e,mode:t,timestamp:Date.now()};this.storageService.store("chat.welcomeViewPrefill",JSON.stringify(o),-1,1);let n=this._recentTrustedWorkspaces.find(r=>this.getWorkspaceUri(r).toString()===this._selectedWorkspace?.uri.toString());if(n)try{return ZR(n)?await this.hostService.openWindow([{folderUri:n.folderUri}]):EA(n)&&await this.hostService.openWindow([{workspaceUri:n.workspace.configPath}]),!0}catch{}return this.storageService.remove("chat.welcomeViewPrefill",-1),!1}applyPrefillData(){let e=this.storageService.get("chat.welcomeViewPrefill",-1);if(e){this.storageService.remove("chat.welcomeViewPrefill",-1);try{let{query:t,mode:o,timestamp:n}=JSON.parse(e);if(n&&Date.now()-n>60*1e3)return;t&&this.chatWidget&&this.chatWidget.setInput(t),o!==void 0&&this.chatWidget&&this.chatWidget.input.setChatMode(o,!1),this.chatWidget?.focusInput()}catch{}}}buildSessionsOrPrompts(e){this.sessionsControlDisposables.clear(),this.sessionsControl=void 0;let t=this.agentSessionsService.model.sessions.filter(o=>!o.isArchived());t.length>0?this.buildSessionsGrid(e,t):this.buildWalkthroughs(e)}buildSessionsGrid(e,t){this.sessionsControlContainer=M(e,_(".agentSessionsWelcome-sessionsGrid"));let o={overrideStyles:uS({listBackground:Ho}),filter:this.sessionsControlDisposables.add(this.instantiationService.createInstance(TW,{limitResults:()=>yMo,overrideExclude:r=>r.isArchived()?!0:void 0})),getHoverPosition:()=>2,trackActiveEditorSession:()=>!1,source:"welcomeView",notifySessionOpened:()=>{this.configurationService.getValue("chat.agentSessionProjection.enabled")||(this._closedBy="sessionClicked",this.revealMaximizedChat())}};this.sessionsControl=this.sessionsControlDisposables.add(this.instantiationService.createInstance(UM,this.sessionsControlContainer,o)),this.sessionsControlDisposables.add(this.agentSessionsService.model.onDidResolve(()=>{this.layoutSessionsControl()})),this.agentSessionsService.model.resolved&&this.layoutSessionsControl(),this.sessionsControlDisposables.add(Wr(Re(this.sessionsControlContainer),()=>{this.layoutSessionsControl()}));let n=M(e,_("button.agentSessionsWelcome-openSessionsButton"));n.textContent=d(16641,null),n.onclick=()=>{this._closedBy="viewAllSessions",this.revealMaximizedChat()}}buildWalkthroughs(e){let t=this.walkthroughs.filter(f=>!f.when||this.contextService.contextMatchesRules(f.when)).slice(0,aSn);if(t.length===0)return;let o=0,n=M(e,_(".agentSessionsWelcome-walkthroughCard")),r=M(n,_(".agentSessionsWelcome-walkthroughCard-icon")),s=M(n,_(".agentSessionsWelcome-walkthroughCard-content")),l=M(s,_(".agentSessionsWelcome-walkthroughCard-title")),c=M(s,_(".agentSessionsWelcome-walkthroughCard-description")),u=M(n,_(".agentSessionsWelcome-walkthroughCard-nav")),p=M(u,_("button.nav-button"));p.appendChild(Sn(R.chevronLeft)),p.title=d(16637,null);let h=M(u,_("button.nav-button"));h.appendChild(Sn(R.chevronRight)),h.title=d(16634,null);let g=()=>{let f=t[o];Rt(r),f.icon.type==="icon"&&r.appendChild(Sn(f.icon.icon)),l.textContent=f.title,c.textContent=f.description||"",p.disabled=o===0,h.disabled=o===t.length-1};g(),n.onclick=()=>{let f=t[o];this.telemetryService.publicLog2("agentSessionsWelcome.ActionExecuted",{welcomeKind:"agentSessionsWelcomePage",action:"openWalkthrough",actionId:f.id});let v={selectedCategory:f.id,returnToCommand:s_.COMMAND_ID};this.editorService.openEditor({resource:Pf.RESOURCE,options:v})},p.onclick=f=>{f.stopPropagation(),o>0&&(o--,g())},h.onclick=f=>{f.stopPropagation(),o<t.length-1&&(o++,g())}}static{this.PRIVACY_NOTICE_DISMISSED_KEY="agentSessionsWelcome.privacyNoticeDismissed"}buildPrivacyNotice(e){if(!this.chatEntitlementService.anonymous||this.storageService.getBoolean(s_.PRIVACY_NOTICE_DISMISSED_KEY,-1,!1))return;let t=this.productService.defaultChatAgent?.provider;if(!t||!t.default||!this.productService.defaultChatAgent?.termsStatementUrl||!this.productService.defaultChatAgent?.privacyStatementUrl)return;let o=M(e,_(".agentSessionsWelcome-walkthroughCard.agentSessionsWelcome-tosCard")),n=()=>{this.storageService.store(s_.PRIVACY_NOTICE_DISMISSED_KEY,!0,-1,0),o.remove()};this.contentDisposables.add(this.chatService.onDidSubmitRequest(()=>n())),M(o,_(".agentSessionsWelcome-walkthroughCard-icon")).appendChild(Sn(R.chatSparkle));let s=M(o,_(".agentSessionsWelcome-walkthroughCard-content")),l=M(s,_(".agentSessionsWelcome-walkthroughCard-title"));l.textContent=d(16640,null);let c=M(s,_(".agentSessionsWelcome-walkthroughCard-description")),u=new Ie(d(16639,null,t.default.name,this.productService.defaultChatAgent.termsStatementUrl,this.productService.defaultChatAgent.privacyStatementUrl),{isTrusted:!0}),p=this.markdownRendererService.render(u);c.appendChild(p.element);let h=M(o,_("button.agentSessionsWelcome-tosCard-dismiss"));h.appendChild(Sn(R.close)),h.title=d(16632,null),h.onclick=g=>{g.stopPropagation(),n()}}buildFooter(e){this.buildPrivacyNotice(e);let t=M(e,_(".agentSessionsWelcome-showOnStartup")),o=this.contentDisposables.add(new cm({icon:R.check,actionClassName:"agentSessionsWelcome-checkbox",isChecked:this.configurationService.getValue(xUi)==="agentSessionsWelcomePage",title:d(16630,null),...U6i({inputActiveOptionBackground:"var(--vscode-descriptionForeground)",inputActiveOptionForeground:"var(--vscode-editor-background)",inputActiveOptionBorder:"var(--vscode-descriptionForeground)"})}));o.domNode.id="showOnStartup";let n=_("label.caption",{for:"showOnStartup"},d(16638,null)),r=()=>{o.checked?this.configurationService.updateValue(xUi,"agentSessionsWelcomePage"):this.configurationService.updateValue(xUi,"none")};this.contentDisposables.add(o.onChange(()=>r())),this.contentDisposables.add(j(n,"click",()=>{o.checked=!o.checked,r()})),t.appendChild(o.domNode),t.appendChild(n)}layout(e){this.lastDimension=e,this.container.style.height=`${e.height}px`,this.container.style.width=`${e.width}px`,this.layoutChatWidget(),this.layoutSessionsControl(),this.scrollableElement?.scanDomNode()}layoutChatWidget(){if(!this.chatWidget||!this.lastDimension)return;let e=Math.min(800,this.lastDimension.width-80);this.chatWidget.layout(150,e)}layoutSessionsControl(){if(!this.sessionsControl||!this.sessionsControlContainer||!this.lastDimension)return;let e=Math.min(800,this.lastDimension.width-80),t=Math.min(this.agentSessionsService.model.sessions.filter(r=>!r.isArchived()).length,yMo),o=t*ife.ITEM_HEIGHT;this.sessionsControl.layout(o,e);let n=Math.floor(t/2)*ife.ITEM_HEIGHT;this.sessionsControl.element.style.marginBottom=`-${n}px`}focus(){super.focus(),this.chatWidget?.focusInput()}async revealMaximizedChat(){try{await this.closeEditorAndMaximizeAuxiliaryBar()}catch(e){this.logService.error("Failed to open maximized chat: {0}",xn(e))}}async openSessionInChat(e){try{await this.closeEditorAndMaximizeAuxiliaryBar(e)}catch(t){this.logService.error("Failed to open agent session: {0}",xn(t))}}async closeEditorAndMaximizeAuxiliaryBar(e){let t=this.input||this._storedInput;t&&this.group.contains(t)&&await new Promise(n=>{let r=this.group.onDidActiveEditorChange(s=>{r.dispose(),n()});this.group.closeEditor(t)}),e?await this.chatWidgetService.openSession(e):await this.commandService.executeCommand("workbench.action.chat.open"),this.viewDescriptorService.getViewLocationById(Dr)===2&&this.layoutService.setAuxiliaryBarMaximized(!0)}async getRecentlyOpenedWorkspaces(e=!1){let o=(await this.workspacesService.getRecentlyOpened()).workspaces.map(async s=>{let l=EA(s)?s.workspace.configPath:s.folderUri,c=await this.workspaceTrustManagementService.getUriTrustInfo(l);return{workspace:s,trusted:c.trusted}});return(await Promise.all(o)).filter(s=>e?s.trusted:!0).map(s=>s.workspace)}};s_=I([m(1,Te),m(2,Le),m(3,ce),m(4,F),m(5,X),m(6,yi),m(7,ge),m(8,ee),m(9,md),m(10,B),m(11,tt),m(12,XM),m(13,mi),m(14,rr),m(15,On),m(16,Pe),m(17,jp),m(18,Zt),m(19,Nr),m(20,Bi),m(21,Pt),m(22,se)],s_);var qQt=class{canSerialize(i){return!0}serialize(i){return JSON.stringify({})}deserialize(i,e){return new HN({})}};W(class extends K{constructor(){super({id:"workbench.action.openWalkthrough",title:L(16686,"Welcome"),category:Ve.Help,f1:!0,menu:{id:D.MenubarHelpMenu,group:"1_welcome",order:1},metadata:{description:L(16685,"Opens a Walkthrough to help you get started in VS Code.")}})}run(a,i,e){let t=a.get(ee),o=a.get(ge),n=a.get(B),r=a.get(rr),s=typeof e=="object"?e.toSide:e,l=typeof e=="object"?e.inactive:!1,c=t.activeEditor;if(!i&&!r.sentiment.hidden&&n.getValue("workbench.startupEditor")==="agentSessionsWelcomePage"){o.executeCommand(s_.COMMAND_ID);return}else if(i){let u=typeof i=="string"?i:i.category,p;if(typeof i=="object"&&"category"in i&&"step"in i?p=`${i.category}#${i.step}`:p=void 0,p&&c instanceof Pf&&c.selectedCategory===u){c.showWelcome=!1,o.executeCommand("walkthroughs.selectStep",p);return}let h;u?h={selectedCategory:u,selectedStep:p,showWelcome:!1,preserveFocus:s??!1,inactive:l}:h={selectedCategory:u,selectedStep:p,showWelcome:!0,preserveFocus:s??!1,inactive:l},t.openEditor({resource:Pf.RESOURCE,options:h},s?In:void 0)}else t.openEditor({resource:Pf.RESOURCE,options:{preserveFocus:s??!1,inactive:l}},s?In:void 0)}});ne.as(qo.EditorFactory).registerEditorSerializer(Pf.ID,KQt);ne.as(qo.EditorPane).registerEditorPane(Br.create(JM,JM.ID,d(16688,null)),[new Ft(Pf)]);var $Qt=L(16689,"Welcome");W(class extends K{constructor(){super({id:"welcome.goBack",title:L(16690,"Go Back"),category:$Qt,keybinding:{weight:100,primary:9,when:xdt},precondition:C.equals("activeEditor","gettingStartedPage"),f1:!0})}run(a){let e=a.get(ee).activeEditorPane;e instanceof JM&&e.escape()}});$e.registerCommand({id:"walkthroughs.selectStep",handler:(a,i)=>{let t=a.get(ee).activeEditorPane;t instanceof JM?t.selectStepLoose(i):console.error("Cannot run walkthroughs.selectStep outside of walkthrough context")}});W(class extends K{constructor(){super({id:"welcome.markStepComplete",title:d(16691,null),category:$Qt})}run(a,i){if(!i)return;a.get(XM).progressStep(i)}});W(class extends K{constructor(){super({id:"welcome.markStepIncomplete",title:d(16692,null),category:$Qt})}run(a,i){if(!i)return;a.get(XM).deprogressStep(i)}});W(class extends K{constructor(){super({id:"welcome.showAllWalkthroughs",title:L(16693,"Open Walkthrough..."),category:$Qt,f1:!0,menu:{id:D.MenubarHelpMenu,group:"1_welcome",order:3}})}async getQuickPickItems(a,i){return(await i.getWalkthroughs()).filter(t=>a.contextMatchesRules(t.when)).map(t=>({id:t.id,label:t.title,detail:t.description,description:t.source}))}async run(a){let i=a.get(ge),e=a.get(X),t=a.get(Ue),o=a.get(XM),n=a.get(lt),r=new N,s=r.add(t.createQuickPick());s.canSelectMany=!1,s.matchOnDescription=!0,s.matchOnDetail=!0,s.placeholder=d(16687,null),s.items=await this.getQuickPickItems(e,o),s.busy=!0,r.add(s.onDidAccept(()=>{let l=s.selectedItems[0];l&&i.executeCommand("workbench.action.openWalkthrough",l.id),s.hide()})),r.add(s.onDidHide(()=>r.dispose())),await n.whenInstalledExtensionsRegistered(),r.add(o.onDidAddWalkthrough(async()=>{s.items=await this.getQuickPickItems(e,o)})),s.show(),s.busy=!1}});$e.registerCommand({id:"welcome.newWorkspaceChat",handler:(a,i)=>{a.get(ge).executeCommand("workbench.action.chat.open",{mode:"agent",query:"#new ",isPartialQuery:!0})}});var kdt=new Y("workspacePlatform",void 0,d(16704,null)),CKe=class{constructor(i,e,t){this.extensionManagementServerService=i;this.remoteAgentService=e;this.contextService=t;this.remoteAgentService.getEnvironment().then(o=>{let n=o?.os,r=n===2?"mac":n===1?"windows":n===3?"linux":void 0;r?kdt.bindTo(this.contextService).set(r):this.extensionManagementServerService.localExtensionManagementServer?Ze?kdt.bindTo(this.contextService).set("mac"):fn?kdt.bindTo(this.contextService).set("linux"):ei&&kdt.bindTo(this.contextService).set("windows"):this.extensionManagementServerService.webExtensionManagementServer?kdt.bindTo(this.contextService).set("webworker"):console.error("Error: Unable to detect workspace platform")})}static{this.ID="workbench.contrib.workspacePlatform"}};CKe=I([m(0,Ec),m(1,bo),m(2,X)],CKe);var lSn=ne.as(Jt.Configuration);lSn.registerConfiguration({...Ud,properties:{"workbench.welcomePage.walkthroughs.openOnInstall":{scope:2,type:"boolean",default:!0,description:d(16703,null)},"workbench.startupEditor":{scope:5,type:"string",enum:["none","welcomePage","readme","newUntitledFile","welcomePageInEmptyWorkbench","terminal","agentSessionsWelcomePage"],enumDescriptions:[d(16697,null),d(16700,null),d(16698,null),d(16696,null),d(16701,null),d(16699,null),d(16695,null)],default:"welcomePage",description:d(16694,null),experiment:{mode:"auto"}},"workbench.welcomePage.preferReducedMotion":{scope:1,type:"boolean",default:!1,deprecationMessage:d(16684,null),description:d(16702,null)}}});It(CKe.ID,CKe,St.AfterRestored);It(Pbe.ID,Pbe,St.BlockRestore);It(Abe.ID,Abe,St.AfterRestored);ga.register(new GQt);var cSn="workbench.editors.agentSessionsWelcomeInput";ne.as(qo.EditorFactory).registerEditorSerializer(cSn,qQt);ne.as(qo.EditorPane).registerEditorPane(Br.create(s_,s_.ID,d(16642,null)),[new Ft(HN)]);var kUi=a=>{switch(a.getWorkbenchState()){case 1:return"empty";case 2:return"folder";case 3:return"workspace";default:return"empty"}},xKe=class extends x{static{this.ID="workbench.contrib.agentSessionsWelcomeEditorResolver"}constructor(i,e,t){super(),this._register(i.registerEditor(`${HN.RESOURCE.scheme}:${HN.RESOURCE.authority}/**`,{id:s_.ID,label:d(16643,null),priority:"builtin"},{singlePerResource:!0,canSupportResource:o=>o.scheme===HN.RESOURCE.scheme&&o.authority===HN.RESOURCE.authority},{createEditorInput:()=>({editor:e.createInstance(HN,{workspaceKind:kUi(t)})})}))}};xKe=I([m(0,Ka),m(1,F),m(2,Pe)],xKe);W(class extends K{constructor(){super({id:s_.COMMAND_ID,title:d(16644,null),precondition:ie.enabled})}async run(i){let e=i.get(ee),t=i.get(F),o=i.get(Pe),n=t.createInstance(HN,{initiator:"command",workspaceKind:kUi(o)});await e.openEditor(n,{pinned:!0})}});var kKe=class extends x{constructor(e,t,o,n,r,s,l,c){super();this.configurationService=e;this.editorService=t;this.editorGroupsService=o;this.instantiationService=n;this.contextKeyService=r;this.storageService=s;this.workspaceContextService=l;this.chatEntitlementService=c;this.run()}static{this.ID="workbench.contrib.agentSessionsWelcomeRunner"}async run(){if(this.chatEntitlementService.sentiment.hidden||this.configurationService.getValue("workbench.startupEditor")!=="agentSessionsWelcomePage"||(await this.editorGroupsService.whenReady,kK.getValue(this.contextKeyService)))return;let t=!!this.storageService.get("chat.welcomeViewPrefill",-1);if(this.editorService.activeEditor&&!t)return;let o=this.instantiationService.createInstance(HN,{initiator:"startup",workspaceKind:kUi(this.workspaceContextService)});await this.editorService.openEditor(o,{pinned:!1})}};kKe=I([m(0,B),m(1,ee),m(2,wt),m(3,F),m(4,X),m(5,ce),m(6,Pe),m(7,rr)],kKe);It(xKe.ID,xKe,St.BlockStartup);It(kKe.ID,kKe,St.AfterRestored);var EUi=class{constructor(){this.providers=new Map}registerProvider(i,e){this.providers.set(i,e)}getProvider(i){return this.providers.get(i)}},TUi=new EUi;async function _Ui(a,i){if(!i.query)throw new Error("Walkthrough: invalid resource");let e=JSON.parse(i.query);if(!e.moduleId)throw new Error("Walkthrough: invalid resource");let t=TUi.getProvider(e.moduleId);if(!t)throw new Error(`Walkthrough: no provider registered for ${e.moduleId}`);return a.invokeFunction(t)}var Nbe=class{constructor(i,e,t,o){this.textModelResolverService=i;this.languageService=e;this.modelService=t;this.instantiationService=o;this.loads=new Map;this.textModelResolverService.registerTextModelContentProvider(Q.walkThroughSnippet,this)}static{this.ID="workbench.contrib.walkThroughSnippetContentProvider"}async textBufferFactoryFromResource(i){let e=this.loads.get(i.toString());return e||(e=_Ui(this.instantiationService,i).then(t=>Vj(t)).finally(()=>this.loads.delete(i.toString())),this.loads.set(i.toString(),e)),e}async provideTextContent(i){let e=await this.textBufferFactoryFromResource(i.with({fragment:""})),t=this.modelService.getModel(i);if(!t){let o=parseInt(i.fragment),n=0,r=new oc.Renderer;r.code=({text:p,lang:h})=>{n++;let g=typeof h=="string"&&this.languageService.getLanguageIdByLanguageName(h)||"",f=this.languageService.createById(g),v=this.modelService.createModel(p,f,i.with({fragment:`${n}.${h}`}));return n===o&&(t=v),""};let s=e.create(1).textBuffer,l=s.getLineCount(),c=new z(1,1,l,s.getLineLength(l)+1),u=s.getValueInRange(c,0);oc(u,{renderer:r})}return Ci(t)}};Nbe=I([m(0,Bt),m(1,_t),m(2,Tt),m(3,F)],Nbe);var jQt=class extends wh{constructor(e,t){super();this.mainRef=e;this.snippetRefs=t}get main(){return this.mainRef}get snippets(){return this.snippetRefs.map(e=>e.object)}dispose(){this.snippetRefs.forEach(e=>e.dispose()),super.dispose()}},Dx=class extends ls{constructor(e,t,o){super();this.options=e;this.instantiationService=t;this.textModelResolverService=o;this.promise=null;this.maxTopScroll=0;this.maxBottomScroll=0}get capabilities(){return 8|super.capabilities}get resource(){return this.options.resource}get typeId(){return this.options.typeId}getName(){return this.options.name}getDescription(){return this.options.description||""}getTelemetryFrom(){return this.options.telemetryFrom}getTelemetryDescriptor(){let e=super.getTelemetryDescriptor();return e.target=this.getTelemetryFrom(),e}get onReady(){return this.options.onReady}get layout(){return this.options.layout}resolve(){return this.promise||(this.promise=_Ui(this.instantiationService,this.options.resource).then(e=>{if(this.resource.path.endsWith(".html"))return new jQt(e,[]);let t=[],o=0,n=new oc.Renderer;return n.code=({lang:s})=>{o++;let l=this.options.resource.with({scheme:Q.walkThroughSnippet,fragment:`${o}.${s}`});return t.push(this.textModelResolverService.createModelReference(l)),`<div id="snippet-${l.fragment}" class="walkThroughEditorContainer" ></div>`},e=new Gj({renderer:n},OGt()).parse(e,{async:!1}),Promise.all(t).then(s=>new jQt(e,s))})),this.promise}matches(e){return super.matches(e)?!0:e instanceof Dx?Qe(e.options.resource,this.options.resource):!1}dispose(){this.promise&&(this.promise.then(e=>e.dispose()),this.promise=null),super.dispose()}relativeScrollPosition(e,t){this.maxTopScroll=Math.max(this.maxTopScroll,e),this.maxBottomScroll=Math.max(this.maxBottomScroll,t)}};Dx=I([m(1,F),m(2,Bt)],Dx);var A$b=te("walkThrough.embeddedEditorBackground",{dark:new We(new zt(0,0,0,.4)),light:"#f4f4f4",hcDark:null,hcLight:null},d(16937,null));var EKe=new Y("interactivePlaygroundFocus",!1),wMo=d(16936,null),dSn="walkThroughEditorViewState",yL=class extends Ts{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super(yL.ID,e,t,o,c);this.instantiationService=r;this.openerService=s;this.keybindingService=l;this.contextKeyService=u;this.configurationService=p;this.notificationService=h;this.extensionService=g;this.disposables=new N;this.contentDisposables=[];this.editorFocus=EKe.bindTo(this.contextKeyService),this.editorMemento=this.getEditorMemento(f,n,dSn)}static{this.ID="workbench.editor.walkThroughPart"}createEditor(e){this.content=document.createElement("div"),this.content.classList.add("welcomePageFocusElement"),this.content.tabIndex=0,this.content.style.outlineStyle="none",this.scrollbar=new ms(this.content,{horizontal:1,vertical:1}),this.disposables.add(this.scrollbar),e.appendChild(this.scrollbar.getDomNode()),this.registerFocusHandlers(),this.registerClickHandler(),this.disposables.add(this.scrollbar.onScroll(t=>this.updatedScrollPosition()))}updatedScrollPosition(){let e=this.scrollbar.getScrollDimensions(),t=this.scrollbar.getScrollPosition(),o=e.scrollHeight;if(o&&this.input instanceof Dx){let n=t.scrollTop,r=e.height;this.input.relativeScrollPosition(n/o,(n+r)/o)}}onTouchChange(e){e.preventDefault(),e.stopPropagation();let t=this.scrollbar.getScrollPosition();this.scrollbar.setScrollPosition({scrollTop:t.scrollTop-e.translationY})}addEventListener(e,t,o,n){return e.addEventListener(t,o,n),Z(()=>{e.removeEventListener(t,o,n)})}registerFocusHandlers(){this.disposables.add(this.addEventListener(this.content,"mousedown",e=>{this.focus()})),this.disposables.add(this.addEventListener(this.content,"focus",e=>{this.editorFocus.set(!0)})),this.disposables.add(this.addEventListener(this.content,"blur",e=>{this.editorFocus.reset()})),this.disposables.add(this.addEventListener(this.content,"focusin",e=>{if(Do(e.target)&&e.target.classList.contains("zone-widget-container")){let t=this.scrollbar.getScrollPosition();this.content.scrollTop=t.scrollTop,this.content.scrollLeft=t.scrollLeft}Do(e.target)&&(this.lastFocus=e.target)}))}registerClickHandler(){this.disposables.add(this.addEventListener(this.content,"click",e=>{for(let t=e.target;t;t=t.parentNode)if(W$e(t)&&t.href){let o=t.ownerDocument.getElementsByTagName("base")[0]||this.window.location;if(o&&t.href.indexOf(o.href)>=0&&t.hash){let n=this.content.querySelector(t.hash),r=this.content.firstElementChild;if(n&&r){let s=n.getBoundingClientRect().top-20,l=r.getBoundingClientRect().top;this.scrollbar.setScrollPosition({scrollTop:s-l})}}else this.open(A.parse(t.href));e.preventDefault();break}else if(qqi(t)){let o=t.getAttribute("data-href");o&&this.open(A.parse(o));break}else if(t===e.currentTarget)break}))}open(e){if(e.scheme==="command"&&e.path==="git.clone"&&!$e.getCommand("git.clone")){this.notificationService.info(d(16935,null));return}this.openerService.open(this.addFrom(e),{allowCommands:!0})}addFrom(e){if(e.scheme!=="command"||!(this.input instanceof Dx))return e;let t=e.query?JSON.parse(e.query):{};return t.from=this.input.getTelemetryFrom(),e.with({query:JSON.stringify(t)})}layout(e){this.size=e,VL(this.content,e.width,e.height),this.updateSizeClasses(),this.contentDisposables.forEach(o=>{o instanceof Xr&&o.layout()});let t=this.input instanceof Dx&&this.input;t&&t.layout&&t.layout(e),this.scrollbar.scanDomNode()}updateSizeClasses(){let e=this.content.firstElementChild;this.size&&e&&e.classList.toggle("max-height-685px",this.size.height<=685)}focus(){super.focus();let e=this.content.ownerDocument.activeElement;for(;e&&e!==this.content;)e=e.parentElement;e||(this.lastFocus||this.content).focus(),this.editorFocus.set(!0)}arrowUp(){let e=this.scrollbar.getScrollPosition();this.scrollbar.setScrollPosition({scrollTop:e.scrollTop-this.getArrowScrollHeight()})}arrowDown(){let e=this.scrollbar.getScrollPosition();this.scrollbar.setScrollPosition({scrollTop:e.scrollTop+this.getArrowScrollHeight()})}getArrowScrollHeight(){let e=this.configurationService.getValue("editor.fontSize");return(typeof e!="number"||e<1)&&(e=12),3*e}pageUp(){let e=this.scrollbar.getScrollDimensions(),t=this.scrollbar.getScrollPosition();this.scrollbar.setScrollPosition({scrollTop:t.scrollTop-e.height})}pageDown(){let e=this.scrollbar.getScrollDimensions(),t=this.scrollbar.getScrollPosition();this.scrollbar.setScrollPosition({scrollTop:t.scrollTop+e.height})}setInput(e,t,o,n){let r=new N;return this.contentDisposables.push(r),this.content.innerText="",super.setInput(e,t,o,n).then(async()=>(e.resource.path.endsWith(".md")&&await this.extensionService.whenInstalledExtensionsRegistered(),e.resolve())).then(s=>{if(n.isCancellationRequested)return;let l=s.main;if(!e.resource.path.endsWith(".md")){this.safeSetInnerHtml(this.content,l),this.updateSizeClasses(),this.decorateContent(),this.contentDisposables.push(this.keybindingService.onDidUpdateKeybindings(()=>this.decorateContent())),e.onReady?.(this.content.firstElementChild,r),this.scrollbar.scanDomNode(),this.loadTextEditorViewState(e),this.updatedScrollPosition();return}let c=document.createElement("div");c.classList.add("walkThroughContent");let u=this.expandMacros(l);this.safeSetInnerHtml(c,u),this.content.appendChild(c),s.snippets.forEach((p,h)=>{let g=p.textEditorModel;if(!g)return;let f=`snippet-${g.uri.fragment}`,v=c.querySelector(`#${f.replace(/[\\.]/g,"\\$&")}`),b=this.getEditorOptions(g.getLanguageId()),S={target:this.input instanceof Dx?this.input.getTelemetryFrom():void 0,snippet:h},y=this.instantiationService.createInstance(Xr,v,b,{telemetryData:S});y.setModel(g),this.contentDisposables.push(y);let w=k=>{let T=y.getPosition(),P=T?y.getLineHeightForPosition(T):y.getOption(75),O=`${Math.max(g.getLineCount()+1,4)*P}px`;v.style.height!==O&&(v.style.height=O,y.layout(),k||this.scrollbar.scanDomNode())};w(!0),this.contentDisposables.push(y.onDidChangeModelContent(()=>w(!1))),this.contentDisposables.push(y.onDidChangeCursorPosition(k=>{let T=this.content.firstElementChild;if(T){let P=v.getBoundingClientRect().top,O=T.getBoundingClientRect().top,V=y.getLineHeightForPosition(k.position),H=P+(k.position.lineNumber-1)*V-O,G=H+V,$=this.scrollbar.getScrollDimensions(),ae=this.scrollbar.getScrollPosition().scrollTop,he=$.height;ae>H?this.scrollbar.setScrollPosition({scrollTop:H}):ae<G-he&&this.scrollbar.setScrollPosition({scrollTop:G-he})}})),this.contentDisposables.push(this.configurationService.onDidChangeConfiguration(k=>{k.affectsConfiguration("editor")&&p.textEditorModel&&y.updateOptions(this.getEditorOptions(p.textEditorModel.getLanguageId()))}))}),this.updateSizeClasses(),this.multiCursorModifier(),this.contentDisposables.push(this.configurationService.onDidChangeConfiguration(p=>{p.affectsConfiguration("editor.multiCursorModifier")&&this.multiCursorModifier()})),e.onReady?.(c,r),this.scrollbar.scanDomNode(),this.loadTextEditorViewState(e),this.updatedScrollPosition(),this.contentDisposables.push(Ms.addTarget(c)),this.contentDisposables.push(j(c,Kn.Change,p=>this.onTouchChange(p)))})}safeSetInnerHtml(e,t){NP(e,t,{allowedAttributes:{augment:["id","class","style","data-command","data-href"]}})}getEditorOptions(e){let t=Ji(this.configurationService.getValue("editor",{overrideIdentifier:e}));return{...xi(t)?t:Object.create(null),scrollBeyondLastLine:!1,scrollbar:{verticalScrollbarSize:14,horizontal:"auto",useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,alwaysConsumeMouseWheel:!1},overviewRulerLanes:3,fixedOverflowWidgets:!1,lineNumbersMinChars:1,minimap:{enabled:!1}}}expandMacros(e){return e.replace(/kb\(([a-z.\d\-]+)\)/gi,(t,o)=>{let n=this.keybindingService.lookupKeybinding(o),r=n?n.getLabel()||"":wMo;return`<span class="shortcut">${mr(r)}</span>`})}decorateContent(){let e=this.content.querySelectorAll(".shortcut[data-command]");Array.prototype.forEach.call(e,o=>{let n=o.getAttribute("data-command"),r=n&&this.keybindingService.lookupKeybinding(n),s=r?r.getLabel()||"":wMo;for(;o.firstChild;)o.firstChild.remove();o.appendChild(document.createTextNode(s))});let t=this.content.querySelectorAll(".if_shortcut[data-command]");Array.prototype.forEach.call(t,o=>{let n=o.getAttribute("data-command"),r=n&&this.keybindingService.lookupKeybinding(n);o.style.display=r?"":"none"})}multiCursorModifier(){let e=cR.modifierLabels[Po],t=this.configurationService.getValue("editor.multiCursorModifier"),o=e[t==="ctrlCmd"?Po===2?"metaKey":"ctrlKey":"altKey"],n=this.content.querySelectorAll(".multi-cursor-modifier");Array.prototype.forEach.call(n,r=>{for(;r.firstChild;)r.firstChild.remove();r.appendChild(document.createTextNode(o))})}saveTextEditorViewState(e){let t=this.scrollbar.getScrollPosition();this.editorMemento.saveEditorState(this.group,e,{viewState:{scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}})}loadTextEditorViewState(e){let t=this.editorMemento.loadEditorState(this.group,e);t&&this.scrollbar.setScrollPosition(t.viewState)}clearInput(){this.input instanceof Dx&&this.saveTextEditorViewState(this.input),this.contentDisposables=Be(this.contentDisposables),super.clearInput()}saveState(){this.input instanceof Dx&&this.saveTextEditorViewState(this.input),super.saveState()}dispose(){this.editorFocus.reset(),this.contentDisposables=Be(this.contentDisposables),this.disposables.dispose(),super.dispose()}};yL=I([m(1,Te),m(2,Le),m(3,Fn),m(4,F),m(5,Je),m(6,_e),m(7,ce),m(8,X),m(9,B),m(10,Ne),m(11,lt),m(12,wt)],yL);var CMo={id:"workbench.action.interactivePlayground.arrowUp",weight:200,when:C.and(EKe,pe.editorTextFocus.toNegated()),primary:16,handler:a=>{let e=a.get(ee).activeEditorPane;e instanceof yL&&e.arrowUp()}},xMo={id:"workbench.action.interactivePlayground.arrowDown",weight:200,when:C.and(EKe,pe.editorTextFocus.toNegated()),primary:18,handler:a=>{let e=a.get(ee).activeEditorPane;e instanceof yL&&e.arrowDown()}},kMo={id:"workbench.action.interactivePlayground.pageUp",weight:200,when:C.and(EKe,pe.editorTextFocus.toNegated()),primary:11,handler:a=>{let e=a.get(ee).activeEditorPane;e instanceof yL&&e.pageUp()}},EMo={id:"workbench.action.interactivePlayground.pageDown",weight:200,when:C.and(EKe,pe.editorTextFocus.toNegated()),primary:12,handler:a=>{let e=a.get(ee).activeEditorPane;e instanceof yL&&e.pageDown()}};function DUi(a){let i=Wt&&!a.get(At).remoteAuthority;return`
## Interactive Editor Playground
The core editor in VS Code is packed with features.  This page highlights a number of them and lets you interactively try them out through the use of a number of embedded editors.  For full details on the editor features for VS Code and more head over to our [documentation](https://code.visualstudio.com/docs).

* [Multi-cursor Editing](#multi-cursor-editing) - block selection, select all occurrences, add additional cursors and more.
* [IntelliSense](#intellisense) - get code assistance and parameter suggestions for your code and external modules.
* [Line Actions](#line-actions) - quickly move lines around to re-order your code.${i?"":`
* [Rename Refactoring](#rename-refactoring) - quickly rename symbols across your code base.`}
* [Formatting](#formatting) - keep your code looking great with inbuilt document & selection formatting.
* [Code Folding](#code-folding) - focus on the most relevant parts of your code by folding other areas.
* [Errors and Warnings](#errors-and-warnings) - see errors and warnings as you type.
* [Snippets](#snippets) - spend less time typing with snippets.
* [Emmet](#emmet) - integrated Emmet support takes HTML and CSS editing to the next level.
* [JavaScript Type Checking](#javascript-type-checking) - perform type checking on your JavaScript file using TypeScript with zero configuration.



### Multi-Cursor Editing
Using multiple cursors allows you to edit multiple parts of the document at once, greatly improving your productivity.  Try the following actions in the code block below:
1. Box Selection - press <span class="mac-only windows-only">any combination of kb(cursorColumnSelectDown), kb(cursorColumnSelectRight), kb(cursorColumnSelectUp), kb(cursorColumnSelectLeft) to select a block of text. You can also press</span> <span class="shortcut mac-only">|\u21E7\u2325|</span><span class="shortcut windows-only linux-only">|Shift+Alt|</span> while selecting text with the mouse or drag-select using the middle mouse button.
2. Add a cursor - press kb(editor.action.insertCursorAbove) to add a new cursor above, or kb(editor.action.insertCursorBelow) to add a new cursor below. You can also use your mouse with <span class="shortcut"><span class="multi-cursor-modifier"></span>+Click</span> to add a cursor anywhere.
3. Create cursors on all occurrences of a string - select one instance of a string e.g. |background-color| and press kb(editor.action.selectHighlights).  Now you can replace all instances by simply typing.

That is the tip of the iceberg for multi-cursor editing. Have a look at the selection menu and our handy [keyboard reference guide](command:workbench.action.keybindingsReference) for additional actions.

|||css
#p1 {background-color: #ff0000;}                /* red in HEX format */
#p2 {background-color: hsl(120, 100%, 50%);}    /* green in HSL format */
#p3 {background-color: rgba(0, 4, 255, 0.733);} /* blue with alpha channel in RGBA format */
|||

> **CSS Tip:** You may have noticed in the example above we also provide color swatches inline for CSS, additionally if you hover over an element such as |#p1| we will show how this is represented in HTML.  These swatches also act as color pickers that allow you to easily change a color value.  A simple example of some language-specific editor features.

### IntelliSense

Visual Studio Code comes with the powerful IntelliSense for JavaScript and TypeScript pre-installed. In the below example, position the text cursor right after the dot and press kb(editor.action.triggerSuggest) to invoke IntelliSense.  Notice how the suggestions come from the Canvas API.

|||js
const canvas = document.querySelector('canvas');
const context = canvas.getContext('2d');

context.strokeStyle = 'blue';
context.
|||

>**Tip:** While we ship JavaScript and TypeScript support out of the box other languages can be upgraded with better IntelliSense through one of the many [extensions](command:workbench.extensions.action.showPopularExtensions).


### Line Actions
Since it's very common to work with the entire text in a line we provide a set of useful shortcuts to help with this.
1. <span class="mac-only windows-only">Copy a line and insert it above or below the current position with kb(editor.action.copyLinesDownAction) or kb(editor.action.copyLinesUpAction) respectively.</span><span class="linux-only">Copy the entire current line when no text is selected with kb(editor.action.clipboardCopyAction).</span>
2. Move an entire line or selection of lines up or down with kb(editor.action.moveLinesUpAction) and kb(editor.action.moveLinesDownAction) respectively.
3. Delete the entire line with kb(editor.action.deleteLines).

|||json
{
	"name": "John",
	"age": 31,
	"city": "New York"
}
|||

>**Tip:** Another very common task is to comment out a block of code - you can toggle commenting by pressing kb(editor.action.commentLine).


${i?"":`
### Rename Refactoring
It's easy to rename a symbol such as a function name or variable name.  Hit kb(editor.action.rename) while in the symbol |Book| to rename all instances - this will occur across all files in a project. You also have |Rename Symbol| in the right-click context menu.

|||js
// Reference the function
new Book("War of the Worlds", "H G Wells");
new Book("The Martian", "Andy Weir");

/**
 * Represents a book.
 *
 * @param {string} title Title of the book
 * @param {string} author Who wrote the book
 */
function Book(title, author) {
	this.title = title;
	this.author = author;
}
|||

> **JSDoc Tip:** VS Code's IntelliSense uses JSDoc comments to provide richer suggestions. The types and documentation from JSDoc comments show up when you hover over a reference to |Book| or in IntelliSense when you create a new instance of |Book|.

`}
### Formatting
Keeping your code looking great is hard without a good formatter.  Luckily it's easy to format content, either for the entire document with kb(editor.action.formatDocument) or for the current selection with kb(editor.action.formatSelection).  Both of these options are also available through the right-click context menu.

|||js
const cars = ["\u{1F697}", "\u{1F699}", "\u{1F695}"];

for (const car of cars){
	// Drive the car
	console.log(|This is the car \${car}|);
}
|||

>**Tip:** Additional formatters are available in the [extension gallery](command:workbench.extensions.action.showPopularExtensions).  Formatting support can also be configured via [settings](command:workbench.action.openGlobalSettings) e.g. enabling |editor.formatOnSave|.


### Code Folding
In a large file it can often be useful to collapse sections of code to increase readability.  To do this, you can simply press kb(editor.fold) to fold or press kb(editor.unfold) to unfold the ranges at the current cursor position.  Folding can also be done with the down and right angle bracket icons in the left gutter.  To fold all sections use kb(editor.foldAll) or to unfold all use kb(editor.unfoldAll).

|||html
<div>
	<header>
		<ul>
			<li><a href=""></a></li>
			<li><a href=""></a></li>
		</ul>
	</header>
	<footer>
		<p></p>
	</footer>
</div>
|||

>**Tip:** Folding is based on indentation and as a result can apply to all languages.  Simply indent your code to create a foldable section you can fold a certain number of levels with shortcuts like kb(editor.foldLevel1) through to kb(editor.foldLevel5).

### Errors and Warnings
Errors and warnings are highlighted as you edit your code with squiggles.  In the sample below you can see a number of syntax errors.  By pressing kb(editor.action.marker.nextInFiles) you can navigate across them in sequence and see the detailed error message.  As you correct them the squiggles and scrollbar indicators will update.

|||js
// This code has a few syntax errors
Console.log(add(1, 1.5));


function Add(a, b)
	return a + b;
}
|||


###  Snippets
You can greatly accelerate your editing through the use of snippets.  Simply start typing |try| and select |trycatch| from the suggestion list and press kb(insertSnippet) to create a |try|->|catch| block.  Your cursor will be placed on the text |error| for easy editing.  If more than one parameter exists then press kb(jumpToNextSnippetPlaceholder) to jump to it.

|||js

|||

>**Tip:** The [extension gallery](command:workbench.extensions.action.showPopularExtensions) includes snippets for almost every framework and language imaginable.  You can also create your own [user-defined snippets](command:workbench.action.openSnippets).


### Emmet
Emmet takes the snippets idea to a whole new level: you can type CSS-like expressions that can be dynamically parsed, and produce output depending on what you type in the abbreviation. Try it by selecting |Emmet: Expand Abbreviation| from the |Edit| menu with the cursor at the end of a valid Emmet abbreviation or snippet and the expansion will occur.

|||html
ul>li.item$*5
|||

>**Tip:** The [Emmet cheat sheet](https://docs.emmet.io/cheat-sheet/) is a great source of Emmet syntax suggestions. To expand Emmet abbreviations and snippets using the |tab| key use the |emmet.triggerExpansionOnTab| [setting](command:workbench.action.openGlobalSettings). Check out the docs on [Emmet in VS Code](https://code.visualstudio.com/docs/editor/emmet) to learn more.



### JavaScript Type Checking
Sometimes type checking your JavaScript code can help you spot mistakes you might have not caught otherwise. You can run the TypeScript type checker against your existing JavaScript code by simply adding a |// @ts-check| comment to the top of your file.

|||js
// @ts-nocheck

let easy = true;
easy = 42;
|||

>**Tip:** You can also enable the checks workspace or application wide by adding |"js/ts.implicitProjectConfig.checkJs": true| to your workspace or user settings and explicitly ignoring files or lines using |// @ts-nocheck| and |// @ts-expect-error|. Check out the docs on [JavaScript in VS Code](https://code.visualstudio.com/docs/languages/javascript) to learn more.


## Thanks!
Well if you have got this far then you will have touched on some of the editing features in Visual Studio Code.  But don't stop now :)  We have lots of additional [documentation](https://code.visualstudio.com/docs), [introductory videos](https://code.visualstudio.com/docs/getstarted/introvideos) and [tips and tricks](https://go.microsoft.com/fwlink/?linkid=852118) for the product that will help you learn how to use it.  And while you are here, here are a few additional things you can try:
- Open the Integrated Terminal by pressing kb(workbench.action.terminal.toggleTerminal), then see what's possible by [reviewing the terminal documentation](https://code.visualstudio.com/docs/editor/integrated-terminal)
- Work with version control by pressing kb(workbench.view.scm). Understand how to stage, commit, change branches, and view diffs and more by reviewing the [version control documentation](https://code.visualstudio.com/docs/editor/versioncontrol)
- Browse thousands of extensions in our integrated gallery by pressing kb(workbench.view.extensions). The [documentation](https://code.visualstudio.com/docs/editor/extension-gallery) will show you how to see the most popular extensions, disable installed ones and more.

That's all for now,

Happy Coding! \u{1F389}

`.replace(/\|/g,"`")}TUi.registerProvider("vs/workbench/contrib/welcomeWalkthrough/browser/editor/vs_code_editor_walkthrough",DUi);var TMo="workbench.editors.walkThroughInput",_Mo={typeId:TMo,name:d(16931,null),resource:vn.asBrowserUri("vs/workbench/contrib/welcomeWalkthrough/browser/editor/vs_code_editor_walkthrough.md").with({scheme:Q.walkThrough,query:JSON.stringify({moduleId:"vs/workbench/contrib/welcomeWalkthrough/browser/editor/vs_code_editor_walkthrough"})}),telemetryFrom:"walkThrough"},QQt=class a extends K{static{this.ID="workbench.action.showInteractivePlayground"}static{this.LABEL=L(16930,"Interactive Editor Playground")}constructor(){super({id:a.ID,title:a.LABEL,category:Ve.Help,f1:!0,metadata:{description:L(16932,"Opens an interactive playground for learning about the editor.")}})}run(i){let e=i.get(ee),o=i.get(F).createInstance(Dx,_Mo);return e.openEditor(o,{pinned:!0}).then(()=>{})}},Edt=class{static{this.ID=TMo}canSerialize(i){return!0}serialize(i){return""}deserialize(i){return i.createInstance(Dx,_Mo)}};ne.as(qo.EditorPane).registerEditorPane(Br.create(yL,yL.ID,d(16934,null)),[new Ft(Dx)]);W(QQt);ne.as(qo.EditorFactory).registerEditorSerializer(Edt.ID,Edt);It(Nbe.ID,Nbe,{editorTypeId:yL.ID});Ct.registerCommandAndKeybindingRule(CMo);Ct.registerCommandAndKeybindingRule(xMo);Ct.registerCommandAndKeybindingRule(kMo);Ct.registerCommandAndKeybindingRule(EMo);ve.appendMenuItem(D.MenubarHelpMenu,{group:"1_welcome",command:{id:"workbench.action.showInteractivePlayground",title:d(16933,null)},order:3});var LUi={explorer:"workbench.explorer.emptyView",debug:"workbench.debug.welcome",scm:"workbench.scm",testing:"workbench.view.testing"},uSn=Object.freeze({type:"array",description:d(16923,null),items:{type:"object",description:d(16924,null),required:["view","contents"],properties:{view:{anyOf:[{type:"string",description:d(16928,null)},{type:"string",description:d(16928,null),enum:Object.keys(LUi)}]},contents:{type:"string",description:d(16925,null)},when:{type:"string",description:d(16929,null)},group:{type:"string",description:d(16927,null)},enablement:{type:"string",description:d(16926,null)}}}}),DMo={extensionPoint:"viewsWelcome",jsonSchema:uSn};var pSn=ne.as(Mn.ViewsRegistry),YQt=class extends x{constructor(e){super();this.viewWelcomeContents=new Map;e.setHandler((t,{added:o,removed:n})=>{for(let s of n)for(let l of s.value)this.viewWelcomeContents.get(l)?.dispose();let r=new Map;for(let s of o)for(let l of s.value){let{group:c,order:u}=mSn(l,s),p=C.deserialize(l.enablement),h=LUi[l.view]??l.view,g=r.get(h);g||(g=new Map,r.set(h,g)),g.set(l,{content:l.contents,when:C.deserialize(l.when),precondition:p,group:c,order:u})}for(let[s,l]of r){let c=pSn.registerViewWelcomeContent2(s,l);for(let[u,p]of c)this.viewWelcomeContents.set(u,p)}})}};function mSn(a,i){let e,t;if(a.group){if(!Ua(i.description,"contribViewsWelcome"))return i.collector.warn(d(16922,null,i.description.identifier.value)),{group:e,order:t};let o=a.group.lastIndexOf("@");o>0?(e=a.group.substr(0,o),t=Number(a.group.substr(o+1))||void 0):e=a.group}return{group:e,order:t}}var hSn=Rn.registerExtensionPoint(DMo),Tdt=class{constructor(i){i.createInstance(YQt,hSn)}};Tdt=I([m(0,F)],Tdt);ne.as(Qi.Workbench).registerWorkbenchContribution(Tdt,3);var XQt=d(16912,null),gSn=L(16914,"Create");W(class extends K{constructor(){super({id:"welcome.showNewFileEntries",title:L(16921,"New File..."),category:gSn,f1:!0,keybinding:{primary:2860,weight:200},menu:{id:D.MenubarFileMenu,group:"1_new",order:2}})}async run(a){return Ci(Xq.Instance).run()}});var Xq=class extends x{constructor(e,t,o,n,r){super();this.quickInputService=e;this.contextKeyService=t;this.commandService=o;this.keybindingService=n;Xq.Instance=this,this._register({dispose(){Xq.Instance===this&&(Xq.Instance=void 0)}}),this.menu=r.createMenu(D.NewFile,t)}allEntries(){let e=[];for(let[t,o]of this.menu.getActions({renderShortTitle:!0}))for(let n of o)n instanceof Lo&&e.push({commandID:n.item.id,from:n.item.source?.title??XQt,title:n.label,group:t});return e}async run(){let e=this.allEntries();if(e.length===0)throw Error("Unexpected empty new items list");return e.length===1?(this.commandService.executeCommand(e[0].commandID),!0):this.selectNewEntry(e)}async selectNewEntry(e){let{promise:t,resolve:o}=WI(),n=new N,r=this.quickInputService.createQuickPick({useSeparators:!0});r.title=d(16919,null),r.placeholder=d(16918,null),r.sortByLabel=!1,r.matchOnDetail=!0,r.matchOnDescription=!0;let s=(u,p)=>{let h={file:1,notebook:2};if(h[u.group]&&h[p.group]){if(h[u.group]!==h[p.group])return h[p.group]-h[u.group]}else{if(h[u.group])return 1;if(h[p.group])return-1}return u.from===XQt?1:p.from===XQt?-1:u.from.localeCompare(p.from)},l={file:d(16915,null),notebook:d(16920,null)},c=u=>{let p=[],h;u.sort((g,f)=>-s(g,f)).forEach(g=>{let f=g.commandID,v=this.keybindingService.lookupKeybinding(f||"",this.contextKeyService);h!==g.group&&(p.push({type:"separator",label:l[g.group]??g.group}),h=g.group),p.push({...g,label:g.title,type:"item",keybinding:v,buttons:f?[{iconClass:"codicon codicon-gear",tooltip:d(16913,null)}]:[],detail:"",description:g.from})}),r.items=p};return c(e),n.add(this.menu.onDidChange(()=>c(this.allEntries()))),n.add(r.onDidChangeValue(u=>{if(u===""){c(e);return}let p={commandID:"workbench.action.files.newFile",commandArgs:{languageId:void 0,viewType:void 0,fileName:u},title:d(16917,null,u),group:"file",from:XQt};c([p,...e])})),n.add(r.onDidAccept(async u=>{let p=r.selectedItems[0];o(!!p),r.hide(),p&&await this.commandService.executeCommand(p.commandID,p.commandArgs)})),n.add(r.onDidHide(()=>{r.dispose(),n.dispose(),o(!1)})),n.add(r.onDidTriggerItemButton(u=>{r.hide(),this.commandService.executeCommand("workbench.action.openGlobalKeybindings",u.item.commandID),o(!1)})),r.show(),t}};Xq=I([m(0,Ue),m(1,X),m(2,ge),m(3,_e),m(4,Kt)],Xq);ne.as(Qi.Workbench).registerWorkbenchContribution(Xq,3);ve.appendMenuItem(D.NewFile,{group:"file",command:{id:"workbench.action.files.newUntitledFile",title:d(16916,null)},order:1});var TKe=class{constructor(i,e,t,o){this.item=i;this.locations=e;this.model=t;this.parent=o}static compare(i,e){let t=Hl(i.item.uri.toString(),e.item.uri.toString());return t===0&&(t=z.compareRangesUsingStarts(i.item.range,e.item.range)),t}},JQt=class{constructor(i){this.getDirection=i}hasChildren(){return!0}async getChildren(i){if(i instanceof Mue)return i.roots.map(o=>new TKe(o,void 0,i,void 0));let{model:e,item:t}=i;return this.getDirection()==="outgoingCalls"?(await e.resolveOutgoingCalls(t,Se.None)).map(o=>new TKe(o.to,o.fromRanges.map(n=>({range:n,uri:t.uri})),e,i)):(await e.resolveIncomingCalls(t,Se.None)).map(o=>new TKe(o.from,o.fromRanges.map(n=>({range:n,uri:o.from.uri})),e,i))}},ZQt=class{compare(i,e){return TKe.compare(i,e)}},e6t=class{constructor(i){this.getDirection=i}getId(i){let e=this.getDirection()+JSON.stringify(i.item.uri)+JSON.stringify(i.item.range);return i.parent&&(e+=this.getId(i.parent)),e}},RUi=class{constructor(i,e){this.icon=i;this.label=e}},_dt=class a{constructor(){this.templateId=a.id}static{this.id="CallRenderer"}renderTemplate(i){i.classList.add("callhierarchy-element");let e=document.createElement("div");i.appendChild(e);let t=new Bc(i,{supportHighlights:!0});return new RUi(e,t)}renderElement(i,e,t){let{element:o,filterData:n}=i,r=o.item.tags?.includes(1);t.icon.className="",t.icon.classList.add("inline","codicon-colored",...q.asClassNameArray(_m.toIcon(o.item.kind))),t.label.setLabel(o.item.name,o.item.detail,{labelEscapeNewLines:!0,matches:xa(n),strikethrough:r})}disposeTemplate(i){i.label.dispose()}},t6t=class{getHeight(i){return 22}getTemplateId(i){return _dt.id}},i6t=class{constructor(i){this.getDirection=i}getWidgetAriaLabel(){return d(5603,null)}getAriaLabel(i){return this.getDirection()==="outgoingCalls"?d(5601,null,i.item.name):d(5602,null,i.item.name)}};var o6t=class{constructor(i,e){this.ratio=i;this.height=e}static store(i,e){e.store("callHierarchyPeekLayout",JSON.stringify(i),0,1)}static retrieve(i){let e=i.get("callHierarchyPeekLayout",0,"{}"),t={ratio:.7,height:17};try{return{...t,...JSON.parse(e)}}catch{return t}}},MUi=class extends rp{},KU=class extends GE{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,{showFrame:!0,showArrow:!0,isResizeable:!0,isAccessible:!0},h);this._where=t;this._direction=o;this._peekViewService=r;this._editorService=s;this._textModelService=l;this._storageService=c;this._menuService=u;this._contextKeyService=p;this._instantiationService=h;this._treeViewStates=new Map;this._previewDisposable=new N;this.create(),this._peekViewService.addExclusiveWidget(e,this),this._applyTheme(n.getColorTheme()),this._disposables.add(n.onDidColorThemeChange(this._applyTheme,this)),this._disposables.add(this._previewDisposable)}static{this.TitleMenu=new D("callhierarchy/title")}dispose(){o6t.store(this._layoutInfo,this._storageService),this._splitView.dispose(),this._tree.dispose(),this._editor.dispose(),super.dispose()}get direction(){return this._direction}_applyTheme(e){let t=e.getColor(K_)||We.transparent;this.style({arrowColor:t,frameColor:t,headerBackgroundColor:e.getColor(JV)||We.transparent,primaryHeadingColor:e.getColor(eF),secondaryHeadingColor:e.getColor(tF)})}_fillHead(e){super._fillHead(e,!0);let t=this._menuService.createMenu(KU.TitleMenu,this._contextKeyService),o=()=>{let n=jm(t.getActions());this._actionbarWidget.clear(),this._actionbarWidget.push(n,{label:!1,icon:!0})};this._disposables.add(t),this._disposables.add(t.onDidChange(o)),o()}_fillBody(e){this._layoutInfo=o6t.retrieve(this._storageService),this._dim=new si(0,0),this._parent=e,e.classList.add("call-hierarchy");let t=document.createElement("div");t.classList.add("message"),e.appendChild(t),this._message=t,this._message.tabIndex=0;let o=document.createElement("div");o.classList.add("results"),e.appendChild(o),this._splitView=new Ou(o,{orientation:1});let n=document.createElement("div");n.classList.add("editor"),o.appendChild(n);let r={scrollBeyondLastLine:!1,scrollbar:{verticalScrollbarSize:14,horizontal:"auto",useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,alwaysConsumeMouseWheel:!1},overviewRulerLanes:2,fixedOverflowWidgets:!0,minimap:{enabled:!1}};this._editor=this._instantiationService.createInstance(id,n,r,{},this.editor);let s=document.createElement("div");s.classList.add("tree"),o.appendChild(s);let l={sorter:new ZQt,accessibilityProvider:new i6t(()=>this._direction),identityProvider:new e6t(()=>this._direction),expandOnlyOnTwistieClick:!0,overrideStyles:{listBackground:zY}};this._tree=this._instantiationService.createInstance(MUi,"CallHierarchyPeek",s,new t6t,[this._instantiationService.createInstance(_dt)],this._instantiationService.createInstance(JQt,()=>this._direction),l),this._splitView.addView({onDidChange:U.None,element:n,minimumSize:200,maximumSize:Number.MAX_VALUE,layout:c=>{this._dim.height&&this._editor.layout({height:this._dim.height,width:c})}},Gl.Distribute),this._splitView.addView({onDidChange:U.None,element:s,minimumSize:100,maximumSize:Number.MAX_VALUE,layout:c=>{this._dim.height&&this._tree.layout(this._dim.height,c)}},Gl.Distribute),this._disposables.add(this._splitView.onDidSashChange(()=>{this._dim.width&&(this._layoutInfo.ratio=this._splitView.getViewSize(0)/this._dim.width)})),this._disposables.add(this._tree.onDidChangeFocus(this._updatePreview,this)),this._disposables.add(this._editor.onMouseDown(c=>{let{event:u,target:p}=c;if(u.detail!==2)return;let[h]=this._tree.getFocus();h&&(this.dispose(),this._editorService.openEditor({resource:h.item.uri,options:{selection:p.range}}))})),this._disposables.add(this._tree.onMouseDblClick(c=>{c.target!==1&&c.element&&(this.dispose(),this._editorService.openEditor({resource:c.element.item.uri,options:{selection:c.element.item.selectionRange,pinned:!0}}))})),this._disposables.add(this._tree.onDidChangeSelection(c=>{let[u]=c.elements;u&&xg(c.browserEvent)&&(this.dispose(),this._editorService.openEditor({resource:u.item.uri,options:{selection:u.item.selectionRange,pinned:!0}}))}))}async _updatePreview(){let[e]=this._tree.getFocus();if(!e)return;this._previewDisposable.clear();let t={description:"call-hierarchy-decoration",stickiness:1,className:"call-decoration",overviewRuler:{color:Xs(KCt),position:2}},o;this._direction==="outgoingCalls"?o=e.parent?e.parent.item.uri:e.model.root.uri:o=e.item.uri;let n=await this._textModelService.createModelReference(o);this._editor.setModel(n.object.textEditorModel);let r=[],s,l=e.locations;l||(l=[{uri:e.item.uri,range:e.item.selectionRange}]);for(let u of l)u.uri.toString()===o.toString()&&(r.push({range:u.range,options:t}),s=s?z.plusRange(u.range,s):u.range);if(s){this._editor.revealRangeInCenter(s,1);let u=this._editor.createDecorationsCollection(r);this._previewDisposable.add(Z(()=>u.clear()))}this._previewDisposable.add(n);let c=this._direction==="outgoingCalls"?d(5596,null,e.model.root.name):d(5597,null,e.model.root.name);this.setTitle(c)}showLoading(){this._parent.dataset.state="loading",this.setTitle(d(5600,null)),this._show()}showMessage(e){this._parent.dataset.state="message",this.setTitle(""),this.setMetaTitle(""),this._message.innerText=e,this._show(),this._message.focus()}async showModel(e){this._show();let t=this._treeViewStates.get(this._direction);await this._tree.setInput(e,t);let o=this._tree.getNode(e).children[0];await this._tree.expand(o.element),o.children.length===0?this.showMessage(this._direction==="outgoingCalls"?d(5598,null,e.root.name):d(5599,null,e.root.name)):(this._parent.dataset.state="data",(!t||this._tree.getFocus().length===0)&&this._tree.setFocus([o.children[0].element]),this._tree.domFocus(),this._updatePreview())}getModel(){return this._tree.getInput()}getFocused(){return this._tree.getFocus()[0]}async updateDirection(e){let t=this._tree.getInput();t&&e!==this._direction&&(this._treeViewStates.set(this._direction,this._tree.getViewState()),this._direction=e,await this.showModel(t))}_show(){this._isShowing||(this.editor.revealLineInCenterIfOutsideViewport(this._where.lineNumber,0),super.show(z.fromPositions(this._where),this._layoutInfo.height))}_onWidth(e){this._dim&&this._doLayoutBody(this._dim.height,e)}_doLayoutBody(e,t){(this._dim.height!==e||this._dim.width!==t)&&(super._doLayoutBody(e,t),this._dim=new si(t,e),this._layoutInfo.height=this._viewZone?this._viewZone.heightInLines:this._layoutInfo.height,this._splitView.layout(t),this._splitView.resizeView(0,t*this._layoutInfo.ratio))}};KU=I([m(3,Le),m(4,u5),m(5,ee),m(6,Bt),m(7,ce),m(8,Kt),m(9,X),m(10,F)],KU);var PUi=new Y("editorHasCallHierarchyProvider",!1,d(5587,null)),Ldt=new Y("callHierarchyVisible",!1,d(5585,null)),Ddt=new Y("callHierarchyDirection",void 0,{type:"string",description:d(5584,null)});function vSn(a){return a==="outgoingCalls"||a==="incomingCalls"?a:"incomingCalls"}var a_=class{constructor(i,e,t,o,n){this._editor=i;this._contextKeyService=e;this._storageService=t;this._editorService=o;this._instantiationService=n;this._dispoables=new N;this._sessionDisposables=new N;this._ctxIsVisible=Ldt.bindTo(this._contextKeyService),this._ctxHasProvider=PUi.bindTo(this._contextKeyService),this._ctxDirection=Ddt.bindTo(this._contextKeyService),this._dispoables.add(U.any(i.onDidChangeModel,i.onDidChangeModelLanguage,Pue.onDidChange)(()=>{this._ctxHasProvider.set(i.hasModel()&&Pue.has(i.getModel()))})),this._dispoables.add(this._sessionDisposables)}static{this.Id="callHierarchy"}static get(i){return i.getContribution(a_.Id)}static{this._StorageDirection="callHierarchy/defaultDirection"}dispose(){this._ctxHasProvider.reset(),this._ctxIsVisible.reset(),this._dispoables.dispose()}async startCallHierarchyFromEditor(){if(this._sessionDisposables.clear(),!this._editor.hasModel())return;let i=this._editor.getModel(),e=this._editor.getPosition();if(!Pue.has(i))return;let t=new Ye,o=Mue.create(i,e,t.token),n=vSn(this._storageService.get(a_._StorageDirection,0,"incomingCalls"));this._showCallHierarchyWidget(e,n,o,t)}async startCallHierarchyFromCallHierarchy(){if(!this._widget)return;let i=this._widget.getModel(),e=this._widget.getFocused();if(!e||!i)return;let t=await this._editorService.openCodeEditor({resource:e.item.uri},this._editor);if(!t)return;let o=i.fork(e.item);this._sessionDisposables.clear(),a_.get(t)?._showCallHierarchyWidget(z.lift(o.root.selectionRange).getStartPosition(),this._widget.direction,Promise.resolve(o),new Ye)}_showCallHierarchyWidget(i,e,t,o){this._ctxIsVisible.set(!0),this._ctxDirection.set(e),U.any(this._editor.onDidChangeModel,this._editor.onDidChangeModelLanguage)(this.endCallHierarchy,this,this._sessionDisposables),this._widget=this._instantiationService.createInstance(KU,this._editor,i,e),this._widget.showLoading(),this._sessionDisposables.add(this._widget.onDidClose(()=>{this.endCallHierarchy(),this._storageService.store(a_._StorageDirection,this._widget.direction,0,0)})),this._sessionDisposables.add({dispose(){o.dispose(!0)}}),this._sessionDisposables.add(this._widget),t.then(n=>{o.token.isCancellationRequested||(n?(this._sessionDisposables.add(n),this._widget.showModel(n)):this._widget.showMessage(d(5589,null)))}).catch(n=>{if(ao(n)){this.endCallHierarchy();return}this._widget.showMessage(d(5588,null))})}showOutgoingCalls(){this._widget?.updateDirection("outgoingCalls"),this._ctxDirection.set("outgoingCalls")}showIncomingCalls(){this._widget?.updateDirection("incomingCalls"),this._ctxDirection.set("incomingCalls")}endCallHierarchy(){this._sessionDisposables.clear(),this._ctxIsVisible.set(!1),this._editor.focus()}};a_=I([m(1,X),m(2,ce),m(3,qt),m(4,F)],a_);xo(a_.Id,a_,0);W(class extends pl{constructor(){super({id:"editor.showCallHierarchy",title:L(5592,"Peek Call Hierarchy"),menu:{id:D.EditorContextPeek,group:"navigation",order:1e3,when:C.and(PUi,tg.notInPeekEditor,pe.isInEmbeddedEditor.toNegated())},keybinding:{when:pe.editorTextFocus,weight:200,primary:1574},precondition:C.and(PUi,tg.notInPeekEditor),f1:!0})}async runEditorCommand(i,e){return a_.get(e)?.startCallHierarchyFromEditor()}});W(class extends pl{constructor(){super({id:"editor.showIncomingCalls",title:L(5593,"Show Incoming Calls"),icon:Ae("callhierarchy-incoming",R.callIncoming,d(5590,null)),precondition:C.and(Ldt,Ddt.isEqualTo("outgoingCalls")),keybinding:{weight:200,primary:1574},menu:{id:KU.TitleMenu,when:Ddt.isEqualTo("outgoingCalls"),order:1}})}runEditorCommand(a,i){return a_.get(i)?.showIncomingCalls()}});W(class extends pl{constructor(){super({id:"editor.showOutgoingCalls",title:L(5594,"Show Outgoing Calls"),icon:Ae("callhierarchy-outgoing",R.callOutgoing,d(5591,null)),precondition:C.and(Ldt,Ddt.isEqualTo("incomingCalls")),keybinding:{weight:200,primary:1574},menu:{id:KU.TitleMenu,when:Ddt.isEqualTo("incomingCalls"),order:1}})}runEditorCommand(a,i){return a_.get(i)?.showOutgoingCalls()}});W(class extends pl{constructor(){super({id:"editor.refocusCallHierarchy",title:L(5595,"Refocus Call Hierarchy"),precondition:Ldt,keybinding:{weight:200,primary:1027}})}async runEditorCommand(a,i){return a_.get(i)?.startCallHierarchyFromCallHierarchy()}});W(class extends pl{constructor(){super({id:"editor.closeCallHierarchy",title:d(5586,null),icon:R.close,precondition:Ldt,keybinding:{weight:210,primary:9,when:C.not("config.editor.stablePeek")},menu:{id:KU.TitleMenu,order:1e3}})}runEditorCommand(a,i){return a_.get(i)?.endCallHierarchy()}});var _Ke=class{constructor(i,e,t){this.item=i;this.model=e;this.parent=t}static compare(i,e){let t=Hl(i.item.uri.toString(),e.item.uri.toString());return t===0&&(t=z.compareRangesUsingStarts(i.item.range,e.item.range)),t}},n6t=class{constructor(i){this.getDirection=i}hasChildren(){return!0}async getChildren(i){if(i instanceof Aue)return i.roots.map(o=>new _Ke(o,i,void 0));let{model:e,item:t}=i;return this.getDirection()==="supertypes"?(await e.provideSupertypes(t,Se.None)).map(o=>new _Ke(o,e,i)):(await e.provideSubtypes(t,Se.None)).map(o=>new _Ke(o,e,i))}},r6t=class{compare(i,e){return _Ke.compare(i,e)}},s6t=class{constructor(i){this.getDirection=i}getId(i){let e=this.getDirection()+JSON.stringify(i.item.uri)+JSON.stringify(i.item.range);return i.parent&&(e+=this.getId(i.parent)),e}},AUi=class{constructor(i,e){this.icon=i;this.label=e}},Rdt=class a{constructor(){this.templateId=a.id}static{this.id="TypeRenderer"}renderTemplate(i){i.classList.add("typehierarchy-element");let e=document.createElement("div");i.appendChild(e);let t=new Bc(i,{supportHighlights:!0});return new AUi(e,t)}renderElement(i,e,t){let{element:o,filterData:n}=i,r=o.item.tags?.includes(1);t.icon.classList.add("inline","codicon-colored",...q.asClassNameArray(_m.toIcon(o.item.kind))),t.label.setLabel(o.item.name,o.item.detail,{labelEscapeNewLines:!0,matches:xa(n),strikethrough:r})}disposeTemplate(i){i.label.dispose()}},a6t=class{getHeight(i){return 22}getTemplateId(i){return Rdt.id}},l6t=class{constructor(i){this.getDirection=i}getWidgetAriaLabel(){return d(16203,null)}getAriaLabel(i){return this.getDirection()==="supertypes"?d(16202,null,i.item.name):d(16201,null,i.item.name)}};var c6t=class{constructor(i,e){this.ratio=i;this.height=e}static store(i,e){e.store("typeHierarchyPeekLayout",JSON.stringify(i),0,1)}static retrieve(i){let e=i.get("typeHierarchyPeekLayout",0,"{}"),t={ratio:.7,height:17};try{return{...t,...JSON.parse(e)}}catch{return t}}},NUi=class extends rp{},GU=class extends GE{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,{showFrame:!0,showArrow:!0,isResizeable:!0,isAccessible:!0},h);this._where=t;this._direction=o;this._peekViewService=r;this._editorService=s;this._textModelService=l;this._storageService=c;this._menuService=u;this._contextKeyService=p;this._instantiationService=h;this._treeViewStates=new Map;this._previewDisposable=new N;this.create(),this._peekViewService.addExclusiveWidget(e,this),this._applyTheme(n.getColorTheme()),this._disposables.add(n.onDidColorThemeChange(this._applyTheme,this)),this._disposables.add(this._previewDisposable)}static{this.TitleMenu=new D("typehierarchy/title")}dispose(){c6t.store(this._layoutInfo,this._storageService),this._splitView.dispose(),this._tree.dispose(),this._editor.dispose(),super.dispose()}get direction(){return this._direction}_applyTheme(e){let t=e.getColor(K_)||We.transparent;this.style({arrowColor:t,frameColor:t,headerBackgroundColor:e.getColor(JV)||We.transparent,primaryHeadingColor:e.getColor(eF),secondaryHeadingColor:e.getColor(tF)})}_fillHead(e){super._fillHead(e,!0);let t=this._menuService.createMenu(GU.TitleMenu,this._contextKeyService),o=()=>{let n=jm(t.getActions());this._actionbarWidget.clear(),this._actionbarWidget.push(n,{label:!1,icon:!0})};this._disposables.add(t),this._disposables.add(t.onDidChange(o)),o()}_fillBody(e){this._layoutInfo=c6t.retrieve(this._storageService),this._dim=new si(0,0),this._parent=e,e.classList.add("type-hierarchy");let t=document.createElement("div");t.classList.add("message"),e.appendChild(t),this._message=t,this._message.tabIndex=0;let o=document.createElement("div");o.classList.add("results"),e.appendChild(o),this._splitView=new Ou(o,{orientation:1});let n=document.createElement("div");n.classList.add("editor"),o.appendChild(n);let r={scrollBeyondLastLine:!1,scrollbar:{verticalScrollbarSize:14,horizontal:"auto",useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,alwaysConsumeMouseWheel:!1},overviewRulerLanes:2,fixedOverflowWidgets:!0,minimap:{enabled:!1}};this._editor=this._instantiationService.createInstance(id,n,r,{},this.editor);let s=document.createElement("div");s.classList.add("tree"),o.appendChild(s);let l={sorter:new r6t,accessibilityProvider:new l6t(()=>this._direction),identityProvider:new s6t(()=>this._direction),expandOnlyOnTwistieClick:!0,overrideStyles:{listBackground:zY}};this._tree=this._instantiationService.createInstance(NUi,"TypeHierarchyPeek",s,new a6t,[this._instantiationService.createInstance(Rdt)],this._instantiationService.createInstance(n6t,()=>this._direction),l),this._splitView.addView({onDidChange:U.None,element:n,minimumSize:200,maximumSize:Number.MAX_VALUE,layout:c=>{this._dim.height&&this._editor.layout({height:this._dim.height,width:c})}},Gl.Distribute),this._splitView.addView({onDidChange:U.None,element:s,minimumSize:100,maximumSize:Number.MAX_VALUE,layout:c=>{this._dim.height&&this._tree.layout(this._dim.height,c)}},Gl.Distribute),this._disposables.add(this._splitView.onDidSashChange(()=>{this._dim.width&&(this._layoutInfo.ratio=this._splitView.getViewSize(0)/this._dim.width)})),this._disposables.add(this._tree.onDidChangeFocus(this._updatePreview,this)),this._disposables.add(this._editor.onMouseDown(c=>{let{event:u,target:p}=c;if(u.detail!==2)return;let[h]=this._tree.getFocus();h&&(this.dispose(),this._editorService.openEditor({resource:h.item.uri,options:{selection:p.range}}))})),this._disposables.add(this._tree.onMouseDblClick(c=>{c.target!==1&&c.element&&(this.dispose(),this._editorService.openEditor({resource:c.element.item.uri,options:{selection:c.element.item.selectionRange,pinned:!0}}))})),this._disposables.add(this._tree.onDidChangeSelection(c=>{let[u]=c.elements;u&&xg(c.browserEvent)&&(this.dispose(),this._editorService.openEditor({resource:u.item.uri,options:{selection:u.item.selectionRange,pinned:!0}}))}))}async _updatePreview(){let[e]=this._tree.getFocus();if(!e)return;this._previewDisposable.clear();let t={description:"type-hierarchy-decoration",stickiness:1,className:"type-decoration",overviewRuler:{color:Xs(KCt),position:2}},o;this._direction==="supertypes"?o=e.parent?e.parent.item.uri:e.model.root.uri:o=e.item.uri;let n=await this._textModelService.createModelReference(o);this._editor.setModel(n.object.textEditorModel);let r=[],s,l={uri:e.item.uri,range:e.item.selectionRange};if(l.uri.toString()===o.toString()&&(r.push({range:l.range,options:t}),s=s?z.plusRange(l.range,s):l.range),s){this._editor.revealRangeInCenter(s,1);let u=this._editor.createDecorationsCollection(r);this._previewDisposable.add(Z(()=>u.clear()))}this._previewDisposable.add(n);let c=this._direction==="supertypes"?d(16199,null,e.model.root.name):d(16198,null,e.model.root.name);this.setTitle(c)}showLoading(){this._parent.dataset.state="loading",this.setTitle(d(16200,null)),this._show()}showMessage(e){this._parent.dataset.state="message",this.setTitle(""),this.setMetaTitle(""),this._message.innerText=e,this._show(),this._message.focus()}async showModel(e){this._show();let t=this._treeViewStates.get(this._direction);await this._tree.setInput(e,t);let o=this._tree.getNode(e).children[0];await this._tree.expand(o.element),o.children.length===0?this.showMessage(this._direction==="supertypes"?d(16197,null,e.root.name):d(16196,null,e.root.name)):(this._parent.dataset.state="data",(!t||this._tree.getFocus().length===0)&&this._tree.setFocus([o.children[0].element]),this._tree.domFocus(),this._updatePreview())}getModel(){return this._tree.getInput()}getFocused(){return this._tree.getFocus()[0]}async updateDirection(e){let t=this._tree.getInput();t&&e!==this._direction&&(this._treeViewStates.set(this._direction,this._tree.getViewState()),this._direction=e,await this.showModel(t))}_show(){this._isShowing||(this.editor.revealLineInCenterIfOutsideViewport(this._where.lineNumber,0),super.show(z.fromPositions(this._where),this._layoutInfo.height))}_onWidth(e){this._dim&&this._doLayoutBody(this._dim.height,e)}_doLayoutBody(e,t){(this._dim.height!==e||this._dim.width!==t)&&(super._doLayoutBody(e,t),this._dim=new si(t,e),this._layoutInfo.height=this._viewZone?this._viewZone.heightInLines:this._layoutInfo.height,this._splitView.layout(t),this._splitView.resizeView(0,t*this._layoutInfo.ratio))}};GU=I([m(3,Le),m(4,u5),m(5,ee),m(6,Bt),m(7,ce),m(8,Kt),m(9,X),m(10,F)],GU);var OUi=new Y("editorHasTypeHierarchyProvider",!1,d(16187,null)),Pdt=new Y("typeHierarchyVisible",!1,d(16195,null)),Mdt=new Y("typeHierarchyDirection",void 0,{type:"string",description:d(16194,null)});function SSn(a){return a==="subtypes"||a==="supertypes"?a:"subtypes"}var l_=class{constructor(i,e,t,o,n){this._editor=i;this._contextKeyService=e;this._storageService=t;this._editorService=o;this._instantiationService=n;this._disposables=new N;this._sessionDisposables=new N;this._ctxHasProvider=OUi.bindTo(this._contextKeyService),this._ctxIsVisible=Pdt.bindTo(this._contextKeyService),this._ctxDirection=Mdt.bindTo(this._contextKeyService),this._disposables.add(U.any(i.onDidChangeModel,i.onDidChangeModelLanguage,Nue.onDidChange)(()=>{this._ctxHasProvider.set(i.hasModel()&&Nue.has(i.getModel()))})),this._disposables.add(this._sessionDisposables)}static{this.Id="typeHierarchy"}static get(i){return i.getContribution(l_.Id)}static{this._storageDirectionKey="typeHierarchy/defaultDirection"}dispose(){this._disposables.dispose()}async startTypeHierarchyFromEditor(){if(this._sessionDisposables.clear(),!this._editor.hasModel())return;let i=this._editor.getModel(),e=this._editor.getPosition();if(!Nue.has(i))return;let t=new Ye,o=Aue.create(i,e,t.token),n=SSn(this._storageService.get(l_._storageDirectionKey,0,"subtypes"));this._showTypeHierarchyWidget(e,n,o,t)}_showTypeHierarchyWidget(i,e,t,o){this._ctxIsVisible.set(!0),this._ctxDirection.set(e),U.any(this._editor.onDidChangeModel,this._editor.onDidChangeModelLanguage)(this.endTypeHierarchy,this,this._sessionDisposables),this._widget=this._instantiationService.createInstance(GU,this._editor,i,e),this._widget.showLoading(),this._sessionDisposables.add(this._widget.onDidClose(()=>{this.endTypeHierarchy(),this._storageService.store(l_._storageDirectionKey,this._widget.direction,0,0)})),this._sessionDisposables.add({dispose(){o.dispose(!0)}}),this._sessionDisposables.add(this._widget),t.then(n=>{o.token.isCancellationRequested||(n?(this._sessionDisposables.add(n),this._widget.showModel(n)):this._widget.showMessage(d(16189,null)))}).catch(n=>{if(ao(n)){this.endTypeHierarchy();return}this._widget.showMessage(d(16188,null))})}async startTypeHierarchyFromTypeHierarchy(){if(!this._widget)return;let i=this._widget.getModel(),e=this._widget.getFocused();if(!e||!i)return;let t=await this._editorService.openCodeEditor({resource:e.item.uri},this._editor);if(!t)return;let o=i.fork(e.item);this._sessionDisposables.clear(),l_.get(t)?._showTypeHierarchyWidget(z.lift(o.root.selectionRange).getStartPosition(),this._widget.direction,Promise.resolve(o),new Ye)}showSupertypes(){this._widget?.updateDirection("supertypes"),this._ctxDirection.set("supertypes")}showSubtypes(){this._widget?.updateDirection("subtypes"),this._ctxDirection.set("subtypes")}endTypeHierarchy(){this._sessionDisposables.clear(),this._ctxIsVisible.set(!1),this._editor.focus()}};l_=I([m(1,X),m(2,ce),m(3,qt),m(4,F)],l_);xo(l_.Id,l_,0);W(class extends pl{constructor(){super({id:"editor.showTypeHierarchy",title:L(16190,"Peek Type Hierarchy"),menu:{id:D.EditorContextPeek,group:"navigation",order:1e3,when:C.and(OUi,tg.notInPeekEditor)},precondition:C.and(OUi,tg.notInPeekEditor),f1:!0})}async runEditorCommand(i,e){return l_.get(e)?.startTypeHierarchyFromEditor()}});W(class extends pl{constructor(){super({id:"editor.showSupertypes",title:L(16193,"Show Supertypes"),icon:R.typeHierarchySuper,precondition:C.and(Pdt,Mdt.isEqualTo("subtypes")),keybinding:{weight:200,primary:1574},menu:{id:GU.TitleMenu,when:Mdt.isEqualTo("subtypes"),order:1}})}runEditorCommand(a,i){return l_.get(i)?.showSupertypes()}});W(class extends pl{constructor(){super({id:"editor.showSubtypes",title:L(16192,"Show Subtypes"),icon:R.typeHierarchySub,precondition:C.and(Pdt,Mdt.isEqualTo("supertypes")),keybinding:{weight:200,primary:1574},menu:{id:GU.TitleMenu,when:Mdt.isEqualTo("supertypes"),order:1}})}runEditorCommand(a,i){return l_.get(i)?.showSubtypes()}});W(class extends pl{constructor(){super({id:"editor.refocusTypeHierarchy",title:L(16191,"Refocus Type Hierarchy"),precondition:Pdt,keybinding:{weight:200,primary:1027}})}async runEditorCommand(a,i){return l_.get(i)?.startTypeHierarchyFromTypeHierarchy()}});W(class extends pl{constructor(){super({id:"editor.closeTypeHierarchy",title:d(16186,null),icon:R.close,precondition:Pdt,keybinding:{weight:210,primary:9,when:C.not("config.editor.stablePeek")},menu:{id:GU.TitleMenu,order:1e3}})}runEditorCommand(a,i){return l_.get(i)?.endTypeHierarchy()}});var d6t=class{getKeyboardNavigationLabel(i){return i instanceof kw?i.label:i.symbol.name}},u6t=class{constructor(i){this._ariaLabel=i}getWidgetAriaLabel(){return this._ariaLabel}getAriaLabel(i){return i instanceof kw?i.label:pvt(i.symbol.name,i.symbol.kind)}},p6t=class{getId(i){return i.id}},DKe=class{constructor(i){this._instantiationService=i}getDragURI(i){let e=dF.get(i)?.uri;if(!e)return null;if(i instanceof jf){let t=ISn(e,i.symbol);return t.fsPath+(t.fragment?"#"+t.fragment:"")}else return e.fsPath}getDragLabel(i,e){if(i.length!==1)return;let t=i[0];return t instanceof jf?t.symbol.name:t.label}onDragStart(i,e){let o=i.elements[0];if(!o||!e.dataTransfer)return;let n=dF.get(o)?.uri;if(!n)return;let r=o instanceof jf?[o]:Array.from(o.children.values());mwe(r.map(s=>({name:s.symbol.name,fsPath:n.fsPath,range:s.symbol.range,kind:s.symbol.kind})),e),this._instantiationService.invokeFunction(s=>tv(s,r.map(l=>({resource:n,selection:l.symbol.range})),e))}onDragOver(){return!1}drop(){}dispose(){}};DKe=I([m(0,F)],DKe);function ISn(a,i){return ZL(a,i.range)}var Adt=class{constructor(i,e){this.labelContainer=i;this.label=e}static{this.id="DocumentSymbolGroupTemplate"}dispose(){this.label.dispose()}},Ndt=class{constructor(i,e,t,o){this.container=i;this.iconLabel=e;this.iconClass=t;this.decoration=o}static{this.id="DocumentSymbolTemplate"}},m6t=class{getHeight(i){return 22}getTemplateId(i){return i instanceof kw?Adt.id:Ndt.id}},h6t=class{constructor(){this.templateId=Adt.id}renderTemplate(i){let e=_(".outline-element-label");return i.classList.add("outline-element"),M(i,e),new Adt(e,new Ya(e))}renderElement(i,e,t){t.label.set(i.element.label,xa(i.filterData))}disposeTemplate(i){i.dispose()}},LKe=class{constructor(i,e,t,o){this._renderMarker=i;this._configurationService=t;this._themeService=o;this.templateId=Ndt.id}renderTemplate(i){i.classList.add("outline-element");let e=new Bc(i,{supportHighlights:!0}),t=_(".outline-element-icon"),o=_(".outline-element-decoration");return i.prepend(t),i.appendChild(o),new Ndt(i,e,t,o)}renderElement(i,e,t){let{element:o}=i,n=["nowrap"],r={matches:xa(i.filterData),labelEscapeNewLines:!0,extraClasses:n,title:d(8948,null,o.symbol.name,Bei[o.symbol.kind])};this._configurationService.getValue("outline.icons")&&(t.iconClass.className="",t.iconClass.classList.add("outline-element-icon","inline","codicon-colored",...q.asClassNameArray(_m.toIcon(o.symbol.kind)))),o.symbol.tags.indexOf(1)>=0&&(n.push("deprecated"),r.matches=[]),t.iconLabel.setLabel(o.symbol.name,o.symbol.detail,r),this._renderMarker&&this._renderMarkerInfo(o,t)}_renderMarkerInfo(i,e){if(!i.marker){vo(e.decoration),e.container.style.removeProperty("--outline-element-color");return}let{count:t,topSev:o}=i.marker,n=this._themeService.getColorTheme().getColor(o===8?Gx:q1),r=n?n.toString():"inherit",s=this._configurationService.getValue("problems.visibility"),l=this._configurationService.getValue("outline.problems.colors");if(!s||!l?e.container.style.removeProperty("--outline-element-color"):e.container.style.setProperty("--outline-element-color",r),s===void 0)return;!this._configurationService.getValue("outline.problems.badges")||!s?vo(e.decoration):t>0?(un(e.decoration),e.decoration.classList.remove("bubble"),e.decoration.textContent=t<10?t.toString():"+9",e.decoration.title=t===1?d(8945,null):d(8947,null,t),e.decoration.style.setProperty("--outline-element-color",r)):(un(e.decoration),e.decoration.classList.add("bubble"),e.decoration.textContent="\uEA71",e.decoration.title=d(8946,null),e.decoration.style.setProperty("--outline-element-color",r))}disposeTemplate(i){i.iconLabel.dispose()}};LKe=I([m(2,B),m(3,Le)],LKe);var Jq=class{constructor(i,e){this._prefix=i;this._textResourceConfigService=e}static{this.kindToConfigName=Object.freeze({0:"showFiles",1:"showModules",2:"showNamespaces",3:"showPackages",4:"showClasses",5:"showMethods",6:"showProperties",7:"showFields",8:"showConstructors",9:"showEnums",10:"showInterfaces",11:"showFunctions",12:"showVariables",13:"showConstants",14:"showStrings",15:"showNumbers",16:"showBooleans",17:"showArrays",18:"showObjects",19:"showKeys",20:"showNull",21:"showEnumMembers",22:"showStructs",23:"showEvents",24:"showOperators",25:"showTypeParameters"})}filter(i){let e=dF.get(i);if(!(i instanceof jf))return!0;let t=Jq.kindToConfigName[i.symbol.kind],o=`${this._prefix}.${t}`;return this._textResourceConfigService.getValue(e?.uri,o)}};Jq=I([m(1,Fn)],Jq);var g6t=class{constructor(){this._collator=Jc.Collator(void 0,{numeric:!0})}compareByPosition(i,e){return i instanceof kw&&e instanceof kw?i.order-e.order:i instanceof jf&&e instanceof jf?z.compareRangesUsingStarts(i.symbol.range,e.symbol.range)||this._collator.value.compare(i.symbol.name,e.symbol.name):0}compareByType(i,e){return i instanceof kw&&e instanceof kw?i.order-e.order:i instanceof jf&&e instanceof jf?i.symbol.kind-e.symbol.kind||this._collator.value.compare(i.symbol.name,e.symbol.name):0}compareByName(i,e){return i instanceof kw&&e instanceof kw?i.order-e.order:i instanceof jf&&e instanceof jf?this._collator.value.compare(i.symbol.name,e.symbol.name)||z.compareRangesUsingStarts(i.symbol.range,e.symbol.range):0}};var Odt=class{constructor(i,e){this._editor=i;this._textResourceConfigurationService=e;this._breadcrumbs=[]}getBreadcrumbElements(){return this._breadcrumbs}clear(){this._breadcrumbs=[]}update(i,e){let t=this._computeBreadcrumbs(i,e);this._breadcrumbs=t.map(o=>({element:o,label:o instanceof jf?o.symbol.name:""}))}_computeBreadcrumbs(i,e){let t=i.getItemEnclosingPosition(e);if(!t)return[];let o=[];for(;t;){o.push(t);let r=t.parent;if(r instanceof dF||r instanceof kw&&r.parent&&r.parent.children.size===1)break;t=r}let n=[];for(let r=o.length-1;r>=0;r--){let s=o[r];if(this._isFiltered(s))break;n.push(s)}return n.length===0?[]:n}_isFiltered(i){if(!(i instanceof jf))return!1;let e=`breadcrumbs.${Jq.kindToConfigName[i.symbol.kind]}`,t;return this._editor&&this._editor.getModel()&&(t=this._editor.getModel().uri),!this._textResourceConfigurationService.getValue(t,e)}};Odt=I([m(1,Fn)],Odt);var Fdt=class{constructor(i,e,t,o,n,r,s,l,c,u){this._editor=i;this._languageFeaturesService=o;this._codeEditorService=n;this._outlineModelService=r;this._configurationService=s;this._markerDecorationsService=l;this._disposables=new N;this._onDidChange=this._disposables.add(new E);this.onDidChange=this._onDidChange.event;this._outlineDisposables=new N;this.outlineKind="documentSymbols";this._breadcrumbsDataSource=new Odt(i,c);let p=new m6t,h=[new h6t,u.createInstance(LKe,!0,e)],g={getChildren:y=>y instanceof jf||y instanceof kw?y.children.values():y===this&&this._outlineModel?this._outlineModel.children.values():[]},f=new g6t,v=c.getValue(i.getModel()?.uri,"outline.collapseItems"),b={collapseByDefault:e===2||e===1&&v==="alwaysCollapse",expandOnlyOnTwistieClick:!0,multipleSelectionSupport:!1,identityProvider:new p6t,keyboardNavigationLabelProvider:new d6t,accessibilityProvider:new u6t(d(8944,null)),filter:e===1?u.createInstance(Jq,"outline"):e===2?u.createInstance(Jq,"breadcrumbs"):void 0,dnd:u.createInstance(DKe)};this.config={breadcrumbsDataSource:this._breadcrumbsDataSource,delegate:p,renderers:h,treeDataSource:g,comparator:f,options:b,quickPickDataSource:{getQuickPickElements:()=>{throw new Error("not implemented")}}},this._disposables.add(o.documentSymbolProvider.onDidChange(y=>this._createOutline())),this._disposables.add(this._editor.onDidChangeModel(y=>this._createOutline())),this._disposables.add(this._editor.onDidChangeModelLanguage(y=>this._createOutline()));let S=new Ul;this._disposables.add(S),this._disposables.add(this._editor.onDidChangeModelContent(y=>{let w=this._editor.getModel();if(w){let k=r.getDebounceValue(w);S.cancelAndSet(()=>this._createOutline(y),k)}})),this._disposables.add(this._editor.onDidDispose(()=>this._outlineDisposables.clear())),this._createOutline().finally(()=>t.open())}get activeElement(){let i=this._editor.getPosition();if(!(!i||!this._outlineModel))return this._outlineModel.getItemEnclosingPosition(i)}dispose(){this._disposables.dispose(),this._outlineDisposables.dispose()}get isEmpty(){return!this._outlineModel||yR.empty(this._outlineModel)}get uri(){return this._outlineModel?.uri}async reveal(i,e,t,o){let n=dF.get(i);!n||!(i instanceof jf)||await this._codeEditorService.openCodeEditor({resource:n.uri,options:{...e,selection:o?i.symbol.range:z.collapseToStart(i.symbol.selectionRange),selectionRevealType:3}},this._editor,t)}preview(i){if(!(i instanceof jf))return x.None;let{symbol:e}=i;this._editor.revealRangeInCenterIfOutsideViewport(e.range,0);let t=this._editor.createDecorationsCollection([{range:e.range,options:{description:"document-symbols-outline-range-highlight",className:"rangeHighlight",isWholeLine:!0}}]);return Z(()=>t.clear())}captureViewState(){let i=this._editor.saveViewState();return Z(()=>{i&&this._editor.restoreViewState(i)})}async _createOutline(i){if(this._outlineDisposables.clear(),i||this._setOutlineModel(void 0),!this._editor.hasModel())return;let e=this._editor.getModel();if(!this._languageFeaturesService.documentSymbolProvider.has(e))return;let t=new Ye,o=e.getVersionId(),n=new Ul;this._outlineDisposables.add(n),this._outlineDisposables.add(Z(()=>t.dispose(!0)));try{let r=await this._outlineModelService.getOrCreate(e,t.token);if(t.token.isCancellationRequested)return;if(yR.empty(r)||!this._editor.hasModel()){this._setOutlineModel(r);return}if(i&&this._outlineModel&&e.getLineCount()>=25){let s=yR.size(r),l=e.getValueLength(),c=s/l,u=yR.size(this._outlineModel),p=l-i.changes.reduce((g,f)=>g+f.rangeLength,0),h=u/p;if((c<=h*.5||c>=h*1.5)&&!await Va(Li(2e3).then(()=>!0),t.token,!1))return}this._applyMarkersToOutline(r),this._outlineDisposables.add(this._markerDecorationsService.onDidChangeMarker(s=>{Qe(r.uri,s.uri)&&(this._applyMarkersToOutline(r),this._onDidChange.fire({}))})),this._outlineDisposables.add(this._configurationService.onDidChangeConfiguration(s=>{if(s.affectsConfiguration("outline.problems.enabled")||s.affectsConfiguration("problems.visibility")){let l=this._configurationService.getValue("problems.visibility"),c=this._configurationService.getValue("outline.problems.enabled");!l||!c?r.updateMarker([]):this._applyMarkersToOutline(r),this._onDidChange.fire({})}s.affectsConfiguration("outline")&&this._onDidChange.fire({}),s.affectsConfiguration("breadcrumbs")&&this._editor.hasModel()&&(this._breadcrumbsDataSource.update(r,this._editor.getPosition()),this._onDidChange.fire({}))})),this._outlineDisposables.add(this._configurationService.onDidChangeConfiguration(s=>{s.affectsConfiguration("outline.icons")&&this._onDidChange.fire({}),s.affectsConfiguration("outline")&&this._onDidChange.fire({})})),this._outlineDisposables.add(this._editor.onDidChangeCursorPosition(s=>{n.cancelAndSet(()=>{!e.isDisposed()&&o===e.getVersionId()&&this._editor.hasModel()&&(this._breadcrumbsDataSource.update(r,this._editor.getPosition()),this._onDidChange.fire({affectOnlyActiveElement:!0}))},150)})),this._setOutlineModel(r)}catch(r){this._setOutlineModel(void 0),mt(r)}}_applyMarkersToOutline(i){let e=this._configurationService.getValue("problems.visibility"),t=this._configurationService.getValue("outline.problems.enabled");if(!i||!e||!t)return;let o=[];for(let[n,r]of this._markerDecorationsService.getLiveMarkers(i.uri))(r.severity===8||r.severity===4)&&o.push({...n,severity:r.severity});i.updateMarker(o)}_setOutlineModel(i){let e=this._editor.getPosition();!e||!i?(this._outlineModel=void 0,this._breadcrumbsDataSource.clear()):(this._outlineModel?.merge(i)||(this._outlineModel=i),this._breadcrumbsDataSource.update(i,e)),this._onDidChange.fire({})}};Fdt=I([m(3,Qt),m(4,qt),m(5,AC),m(6,B),m(7,H1),m(8,Fn),m(9,F)],Fdt);var Wdt=class{constructor(i){let e=i.registerOutlineCreator(this);this.dispose=()=>e.dispose()}matches(i){let e=i.getControl();return pn(e)||mc(e)}async createOutline(i,e,t){let o=i.getControl(),n;if(pn(o)?n=o:mc(o)&&(n=o.getModifiedEditor()),!n)return;let r=new gp,s=n.invokeWithinContext(l=>l.get(F).createInstance(Fdt,n,e,r));return await r.wait(),s}};Wdt=I([m(0,cM)],Wdt);ne.as(Qi.Workbench).registerWorkbenchContribution(Wdt,4);var f6t=class{constructor(){this._followCursor=!1;this._filterOnType=!0;this._sortBy=0;this._onDidChange=new E;this.onDidChange=this._onDidChange.event}dispose(){this._onDidChange.dispose()}set followCursor(i){i!==this._followCursor&&(this._followCursor=i,this._onDidChange.fire({followCursor:!0}))}get followCursor(){return this._followCursor}get filterOnType(){return this._filterOnType}set filterOnType(i){i!==this._filterOnType&&(this._filterOnType=i,this._onDidChange.fire({filterOnType:!0}))}set sortBy(i){i!==this._sortBy&&(this._sortBy=i,this._onDidChange.fire({sortBy:!0}))}get sortBy(){return this._sortBy}persist(i){i.store("outline/state",JSON.stringify({followCursor:this.followCursor,sortBy:this.sortBy,filterOnType:this.filterOnType}),1,1)}restore(i){let e=i.get("outline/state",1);if(!e)return;let t;try{t=JSON.parse(e)}catch{return}this.followCursor=t.followCursor,this.sortBy=t.sortBy??0,typeof t.filterOnType=="boolean"&&(this.filterOnType=t.filterOnType)}};var FUi=class{constructor(i,e){this._comparator=i;this.order=e}compare(i,e){return this.order===2?this._comparator.compareByType(i,e):this.order===1?this._comparator.compareByName(i,e):this._comparator.compareByPosition(i,e)}},RKe=class extends Gs{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super(e,c,p,l,u,n,o,h,g,f);this._outlineService=t;this._instantiationService=o;this._storageService=r;this._editorService=s;this._disposables=new N;this._editorControlDisposables=new N;this._editorPaneDisposables=new N;this._outlineViewState=new f6t;this._editorListener=new me;this._treeStates=new dl(10);this._editorControlChangePromise=Promise.resolve();this._outlineViewState.restore(this._storageService),this._disposables.add(this._outlineViewState),u.bufferChangeEvents(()=>{this._ctxFollowsCursor=D1t.bindTo(u),this._ctxFilterOnType=L1t.bindTo(u),this._ctxSortMode=FAe.bindTo(u),this._ctxAllCollapsed=vit.bindTo(u)});let v=()=>{this._ctxFollowsCursor.set(this._outlineViewState.followCursor),this._ctxFilterOnType.set(this._outlineViewState.filterOnType),this._ctxSortMode.set(this._outlineViewState.sortBy)};v(),this._disposables.add(this._outlineViewState.onDidChange(v))}static{this.Id="outline"}dispose(){this._disposables.dispose(),this._editorPaneDisposables.dispose(),this._editorControlDisposables.dispose(),this._editorListener.dispose(),super.dispose()}focus(){this._editorControlChangePromise.then(()=>{super.focus(),this._tree?.domFocus()})}renderBody(e){super.renderBody(e),this._domNode=e,e.classList.add("outline-pane");let t=_(".outline-progress");this._message=_(".outline-message"),this._progressBar=new Zf(t,vw),this._treeContainer=_(".outline-tree"),M(e,t,this._message,this._treeContainer),this._disposables.add(this.onDidChangeBodyVisibility(o=>{if(!o)this._editorListener.clear(),this._editorPaneDisposables.clear(),this._editorControlDisposables.clear();else if(!this._editorListener.value){let n=U.any(this._editorService.onDidActiveEditorChange,this._outlineService.onDidChange);this._editorListener.value=n(()=>this._handleEditorChanged(this._editorService.activeEditorPane)),this._handleEditorChanged(this._editorService.activeEditorPane)}}))}layoutBody(e,t){super.layoutBody(e,t),this._tree?.layout(e,t),this._treeDimensions=new si(t,e)}collapseAll(){this._tree?.collapseAll()}expandAll(){this._tree?.expandAll()}get outlineViewState(){return this._outlineViewState}_showMessage(e){this._domNode.classList.add("message"),this._progressBar.stop().hide(),this._message.textContent=e}_captureViewState(e){if(this._tree){let t=this._tree.getInput();if(e||(e=t?.uri),t&&e)return this._treeStates.set(`${t.outlineKind}/${e}`,this._tree.getViewState()),!0}return!1}_handleEditorChanged(e){this._editorPaneDisposables.clear(),e&&this._editorPaneDisposables.add(e.onDidChangeControl(()=>{this._editorControlChangePromise=this._handleEditorControlChanged(e)})),this._editorControlChangePromise=this._handleEditorControlChanged(e)}async _handleEditorControlChanged(e){let t=po.getOriginalUri(e?.input),o=this._captureViewState();if(this._editorControlDisposables.clear(),!e||!this._outlineService.canCreateOutline(e)||!t)return this._showMessage(d(12869,null));let n;o||(n=new Ul(()=>{this._showMessage(d(12868,null,He(t)))},100)),this._progressBar.infinite().show(500);let r=new Ye;this._editorControlDisposables.add(Z(()=>r.dispose(!0)));let s=await this._outlineService.createOutline(e,1,r.token);if(n?.dispose(),!s)return;if(r.token.isCancellationRequested){s?.dispose();return}this._editorControlDisposables.add(s),this._progressBar.stop().hide();let l=new FUi(s.config.comparator,this._outlineViewState.sortBy),c=this._instantiationService.createInstance(rF,"OutlinePane",this._treeContainer,s.config.delegate,s.config.renderers,s.config.treeDataSource,{...s.config.options,sorter:l,expandOnDoubleClick:!1,expandOnlyOnTwistieClick:!0,multipleSelectionSupport:!1,hideTwistiesOfChildlessElements:!0,defaultFindMode:this._outlineViewState.filterOnType?1:0,overrideStyles:this.getLocationBasedColors().listOverrideStyles});kgo.bindTo(c.contextKeyService);let u=()=>{if(s.isEmpty)this._showMessage(d(12870,null,He(t))),this._captureViewState(t),c.setInput(void 0);else if(c.getInput())this._domNode.classList.remove("message"),c.updateChildren();else{this._domNode.classList.remove("message");let v=this._treeStates.get(`${s.outlineKind}/${s.uri}`);c.setInput(s,v&&T3e.lift(v))}};u(),this._editorControlDisposables.add(s.onDidChange(u)),this._editorControlDisposables.add(this.viewDescriptorService.onDidChangeLocation(({views:v})=>{v.some(b=>b.id===this.id)&&c.updateOptions({overrideStyles:this.getLocationBasedColors().listOverrideStyles})})),this._editorControlDisposables.add(c.onDidChangeFindMode(v=>this._outlineViewState.filterOnType=v===1));let p=0;this._editorControlDisposables.add(c.onDidOpen(async v=>{let b=++p,S=v.browserEvent?.type==="dblclick";!S&&(await Li(150),b!==p)||await s.reveal(v.element,v.editorOptions,v.sideBySide,S)}));let h=()=>{if(!this._outlineViewState.followCursor||!s.activeElement)return;let v=s.activeElement;for(;v;){if(c.getRelativeTop(v)===null&&c.reveal(v,.5),c.getRelativeTop(v)!==null){c.setFocus([v]),c.setSelection([v]);break}v=c.getParentElement(v)}};h(),this._editorControlDisposables.add(s.onDidChange(h)),this._editorControlDisposables.add(this._outlineViewState.onDidChange(v=>{this._outlineViewState.persist(this._storageService),v.filterOnType&&(c.findMode=this._outlineViewState.filterOnType?1:0),v.followCursor&&h(),v.sortBy&&(l.order=this._outlineViewState.sortBy,c.resort())}));let g;this._editorControlDisposables.add(c.onDidChangeFindPattern(v=>{c.findMode!==0&&(!g&&v?(g=c.getViewState(),c.expandAll()):!v&&g&&(c.setInput(c.getInput(),g),g=void 0))}));let f=()=>{this._ctxAllCollapsed.set(c.getNode(null).children.every(v=>!v.collapsible||v.collapsed))};this._editorControlDisposables.add(c.onDidChangeCollapseState(f)),this._editorControlDisposables.add(c.onDidChangeModel(f)),f(),c.layout(this._treeDimensions?.height,this._treeDimensions?.width),this._tree=c,this._editorControlDisposables.add(Z(()=>{c.dispose(),this._tree=void 0}))}};RKe=I([m(1,cM),m(2,F),m(3,Bi),m(4,ce),m(5,ee),m(6,B),m(7,_e),m(8,X),m(9,Xe),m(10,Je),m(11,Le),m(12,nt)],RKe);W(class extends Yn{constructor(){super({viewId:Ay.Id,id:"outline.collapse",title:d(12861,null),f1:!1,icon:R.collapseAll,menu:{id:D.ViewTitle,group:"navigation",when:C.and(C.equals("view",Ay.Id),vit.isEqualTo(!1))}})}runInView(i,e){e.collapseAll()}});W(class extends Yn{constructor(){super({viewId:Ay.Id,id:"outline.expand",title:d(12862,null),f1:!1,icon:R.expandAll,menu:{id:D.ViewTitle,group:"navigation",when:C.and(C.equals("view",Ay.Id),vit.isEqualTo(!0))}})}runInView(i,e){e.expandAll()}});W(class extends Yn{constructor(){super({viewId:Ay.Id,id:"outline.followCursor",title:d(12864,null),f1:!1,toggled:D1t,menu:{id:D.ViewTitle,group:"config",order:1,when:C.equals("view",Ay.Id)}})}runInView(i,e){e.outlineViewState.followCursor=!e.outlineViewState.followCursor}});W(class extends Yn{constructor(){super({viewId:Ay.Id,id:"outline.filterOnType",title:d(12863,null),f1:!1,toggled:L1t,menu:{id:D.ViewTitle,group:"config",order:2,when:C.equals("view",Ay.Id)}})}runInView(i,e){e.outlineViewState.filterOnType=!e.outlineViewState.filterOnType}});W(class extends Yn{constructor(){super({viewId:Ay.Id,id:"outline.sortByPosition",title:d(12867,null),f1:!1,toggled:FAe.isEqualTo(0),menu:{id:D.ViewTitle,group:"sort",order:1,when:C.equals("view",Ay.Id)}})}runInView(i,e){e.outlineViewState.sortBy=0}});W(class extends Yn{constructor(){super({viewId:Ay.Id,id:"outline.sortByName",title:d(12866,null),f1:!1,toggled:FAe.isEqualTo(1),menu:{id:D.ViewTitle,group:"sort",order:2,when:C.equals("view",Ay.Id)}})}runInView(i,e){e.outlineViewState.sortBy=1}});W(class extends Yn{constructor(){super({viewId:Ay.Id,id:"outline.sortByKind",title:d(12865,null),f1:!1,toggled:FAe.isEqualTo(2),menu:{id:D.ViewTitle,group:"sort",order:3,when:C.equals("view",Ay.Id)}})}runInView(i,e){e.outlineViewState.sortBy=2}});var ySn=Ae("outline-view-icon",R.symbolClass,d(12860,null));ne.as(Mn.ViewsRegistry).registerViews([{id:Ay.Id,name:L(12851,"Outline"),containerIcon:ySn,ctorDescriptor:new Ft(RKe),canToggleVisibility:!0,canMoveView:!0,hideByDefault:!1,collapsed:!0,order:2,weight:30,focusCommand:{id:"outline.focus"}}],wve);ne.as(Jt.Configuration).registerConfiguration({id:"outline",order:117,title:d(12859,null),type:"object",properties:{"outline.icons":{description:d(12857,null),type:"boolean",default:!0},"outline.collapseItems":{description:d(12852,null),type:"string",scope:6,enum:["alwaysCollapse","alwaysExpand"],enumDescriptions:[d(12853,null),d(12854,null)],default:"alwaysExpand"},"outline.problems.enabled":{markdownDescription:d(12858,null,"`#problems.visibility#`"),type:"boolean",default:!0},"outline.problems.colors":{markdownDescription:d(12855,null,"`#problems.visibility#`"),type:"boolean",default:!0},"outline.problems.badges":{markdownDescription:d(12856,null,"`#problems.visibility#`"),type:"boolean",default:!0},"outline.showFiles":{type:"boolean",scope:6,default:!0,markdownDescription:d(12834,null)},"outline.showModules":{type:"boolean",scope:6,default:!0,markdownDescription:d(12839,null)},"outline.showNamespaces":{type:"boolean",default:!0,scope:6,markdownDescription:d(12840,null)},"outline.showPackages":{type:"boolean",default:!0,scope:6,markdownDescription:d(12845,null)},"outline.showClasses":{type:"boolean",default:!0,scope:6,markdownDescription:d(12827,null)},"outline.showMethods":{type:"boolean",default:!0,scope:6,markdownDescription:d(12838,null)},"outline.showProperties":{type:"boolean",default:!0,scope:6,markdownDescription:d(12846,null)},"outline.showFields":{type:"boolean",default:!0,scope:6,markdownDescription:d(12833,null)},"outline.showConstructors":{type:"boolean",default:!0,scope:6,markdownDescription:d(12829,null)},"outline.showEnums":{type:"boolean",default:!0,scope:6,markdownDescription:d(12830,null)},"outline.showInterfaces":{type:"boolean",default:!0,scope:6,markdownDescription:d(12836,null)},"outline.showFunctions":{type:"boolean",default:!0,scope:6,markdownDescription:d(12835,null)},"outline.showVariables":{type:"boolean",default:!0,scope:6,markdownDescription:d(12850,null)},"outline.showConstants":{type:"boolean",default:!0,scope:6,markdownDescription:d(12828,null)},"outline.showStrings":{type:"boolean",default:!0,scope:6,markdownDescription:d(12847,null)},"outline.showNumbers":{type:"boolean",default:!0,scope:6,markdownDescription:d(12842,null)},"outline.showBooleans":{type:"boolean",scope:6,default:!0,markdownDescription:d(12826,null)},"outline.showArrays":{type:"boolean",default:!0,scope:6,markdownDescription:d(12825,null)},"outline.showObjects":{type:"boolean",default:!0,scope:6,markdownDescription:d(12843,null)},"outline.showKeys":{type:"boolean",default:!0,scope:6,markdownDescription:d(12837,null)},"outline.showNull":{type:"boolean",default:!0,scope:6,markdownDescription:d(12841,null)},"outline.showEnumMembers":{type:"boolean",default:!0,scope:6,markdownDescription:d(12831,null)},"outline.showStructs":{type:"boolean",default:!0,scope:6,markdownDescription:d(12848,null)},"outline.showEvents":{type:"boolean",default:!0,scope:6,markdownDescription:d(12832,null)},"outline.showOperators":{type:"boolean",default:!0,scope:6,markdownDescription:d(12844,null)},"outline.showTypeParameters":{type:"boolean",default:!0,scope:6,markdownDescription:d(12849,null)}}});var WUi="editor.detectLanguage",Obe=class{constructor(i,e,t,o,n,r){this._languageDetectionService=i;this._statusBarService=e;this._configurationService=t;this._editorService=o;this._languageService=n;this._keybindingService=r;this._disposables=new N;this._delayer=new ya(1e3);this._renderDisposables=new N;o.onDidActiveEditorChange(()=>this._update(!0),this,this._disposables),this._update(!1)}static{this._id="status.languageDetectionStatus"}dispose(){this._disposables.dispose(),this._delayer.dispose(),this._combinedEntry?.dispose(),this._renderDisposables.dispose()}_update(i){i&&(this._combinedEntry?.dispose(),this._combinedEntry=void 0),this._delayer.trigger(()=>this._doUpdate())}async _doUpdate(){let i=ha(this._editorService.activeTextEditorControl);this._renderDisposables.clear(),i?.onDidChangeModelLanguage(()=>this._update(!0),this,this._renderDisposables),i?.onDidChangeModelContent(()=>this._update(!1),this,this._renderDisposables);let e=i?.getModel(),t=e?.uri,o=e?.getLanguageId(),n=this._configurationService.getValue("workbench.editor.languageDetectionHints");if(!(typeof n=="object"&&n?.untitledEditors)||t?.scheme!==Q.untitled||!o||!t)this._combinedEntry?.dispose(),this._combinedEntry=void 0;else{let l=await this._languageDetectionService.detectLanguage(t),c={jsonc:"json"},u=e.getLanguageId();if(l&&l!==u&&c[u]!==l){let p=this._languageService.getLanguageName(l)||l,h=this._keybindingService.appendKeybinding(d(11457,null,p),WUi),g={name:d(11455,null),ariaLabel:d(11454,null,l),tooltip:h,command:WUi,text:"$(lightbulb-autofix)"};this._combinedEntry?this._combinedEntry.update(g):this._combinedEntry=this._statusBarService.addEntry(g,Obe._id,1,{location:{id:"status.editor.mode",priority:100.1},alignment:1,compact:!0})}else this._combinedEntry?.dispose(),this._combinedEntry=void 0}}};Obe=I([m(0,vS),m(1,kr),m(2,B),m(3,ee),m(4,_t),m(5,_e)],Obe);ne.as(Qi.Workbench).registerWorkbenchContribution(Obe,3);W(class extends K{constructor(){super({id:WUi,title:L(11453,"Detect Language from Content"),f1:!0,precondition:C.and(Xl.toNegated(),pe.editorTextFocus),keybinding:{primary:1570,weight:200}})}async run(a){let i=a.get(ee),e=a.get(vS),t=ha(i.activeTextEditorControl),o=a.get(Ne),n=t?.getModel()?.uri;if(n){let r=await e.detectLanguage(n);r?t.getModel()?.setLanguage(r,x6e):o.warn(d(11456,null))}}});var v6t=class{constructor(i,e){this.combined=i;this.dedicated=e}isEqual(i){return $i(this.combined,i.combined)&&$i(this.dedicated,i.dedicated)}},Vdt=class{constructor(i,e){this._storageService=i;this._key=e}get value(){return this._storageService.getNumber(this._key,0,0)}increment(){let i=this.value+1;return this._storageService.store(this._key,i,0,1),i}};Vdt=I([m(0,ce)],Vdt);var Fbe=class extends x{constructor(e){super();this.editorGroupService=e;for(let t of e.parts)this.createLanguageStatus(t);this._register(e.onDidCreateAuxiliaryEditorPart(t=>this.createLanguageStatus(t)))}static{this.Id="status.languageStatus"}createLanguageStatus(e){let t=new N;U.once(e.onWillDispose)(()=>t.dispose());let o=this.editorGroupService.getScopedInstantiationService(e);t.add(o.createInstance(c_))}};Fbe=I([m(0,wt)],Fbe);var c_=class{constructor(i,e,t,o,n,r){this._languageStatusService=i;this._statusBarService=e;this._editorService=t;this._hoverService=o;this._openerService=n;this._storageService=r;this._disposables=new N;this._dedicated=new Set;this._dedicatedEntries=new Map;this._renderDisposables=new N;this._combinedEntryTooltip=document.createElement("div");r.onDidChangeValue(0,c_._keyDedicatedItems,this._disposables)(this._handleStorageChange,this,this._disposables),this._restoreState(),this._interactionCounter=new Vdt(r,"languageStatus.interactCount"),i.onDidChange(this._update,this,this._disposables),t.onDidActiveEditorChange(this._update,this,this._disposables),this._update(),e.onDidChangeEntryVisibility(s=>{!s.visible&&this._dedicated.has(s.id)&&(this._dedicated.delete(s.id),this._update(),this._storeState())},void 0,this._disposables)}static{this._id="status.languageStatus"}static{this._keyDedicatedItems="languageStatus.dedicated"}dispose(){this._disposables.dispose(),this._combinedEntry?.dispose(),Be(this._dedicatedEntries.values()),this._renderDisposables.dispose()}_handleStorageChange(){this._restoreState(),this._update()}_restoreState(){let i=this._storageService.get(c_._keyDedicatedItems,0,"[]");try{let e=JSON.parse(i);this._dedicated=new Set(e)}catch{this._dedicated.clear()}}_storeState(){if(this._dedicated.size===0)this._storageService.remove(c_._keyDedicatedItems,0);else{let i=JSON.stringify(Array.from(this._dedicated.keys()));this._storageService.store(c_._keyDedicatedItems,i,0,0)}}_createViewModel(i){if(!i?.hasModel())return new v6t([],[]);let e=this._languageStatusService.getLanguageStatus(i.getModel()),t=[],o=[];for(let n of e)this._dedicated.has(n.id)&&o.push(n),t.push(n);return new v6t(t,o)}_update(){let i=ha(this._editorService.activeTextEditorControl),e=this._createViewModel(i);if(this._model?.isEqual(e))return;if(this._renderDisposables.clear(),this._model=e,i?.onDidChangeModelLanguage(this._update,this,this._renderDisposables),e.combined.length===0)this._combinedEntry?.dispose(),this._combinedEntry=void 0;else{let[o]=e.combined,n=o.severity>=bt.Warning,r=c_._severityToComboCodicon(o.severity),s=!1,l=[];for(let f of e.combined){let v=e.dedicated.includes(f);this._renderStatus(this._combinedEntryTooltip,f,n,v,this._renderDisposables),l.push(c_._accessibilityInformation(f).label),s=s||!v&&f.busy}let c={name:d(11461,null),ariaLabel:d(11460,null,l.join(", next: ")),tooltip:this._combinedEntryTooltip,command:LR,text:s?"$(loading~spin)":r};this._combinedEntry?this._combinedEntry.update(c):this._combinedEntry=this._statusBarService.addEntry(c,c_._id,1,{location:{id:"status.editor.mode",priority:100.1},alignment:0,compact:!0});let u=this._interactionCounter.value>=3,p=Re(i?.getContainerDomNode()),h=p.document.querySelector(".monaco-workbench .statusbar DIV#status\\.languageStatus A>SPAN.codicon"),g=p.document.querySelector(".monaco-workbench .statusbar DIV#status\\.languageStatus");if(Do(h)&&g){let f="wiggle",v="flash";s?(h.classList.remove(f),g.classList.remove(v)):(h.classList.toggle(f,n||!u),this._renderDisposables.add(j(h,"animationend",b=>h.classList.remove(f))),g.classList.toggle(v,n),this._renderDisposables.add(j(g,"animationend",b=>g.classList.remove(v))))}if(!u){let f=p.document.querySelector(".monaco-workbench .context-view");if(Do(f)){let v=new MutationObserver(()=>{p.document.contains(this._combinedEntryTooltip)&&(this._interactionCounter.increment(),v.disconnect())});v.observe(f,{childList:!0,subtree:!0}),this._renderDisposables.add(Z(()=>v.disconnect()))}}}let t=new Map;for(let o of e.dedicated){let n=c_._asStatusbarEntry(o),r=this._dedicatedEntries.get(o.id);r?(r.update(n),this._dedicatedEntries.delete(o.id)):r=this._statusBarService.addEntry(n,o.id,1,{location:{id:"status.editor.mode",priority:100.1},alignment:1}),t.set(o.id,r)}Be(this._dedicatedEntries.values()),this._dedicatedEntries=t}_renderStatus(i,e,t,o,n){let r=document.createElement("div");r.classList.add("hover-language-status"),i.appendChild(r),n.add(Z(()=>r.remove()));let s=document.createElement("div");s.classList.add("severity",`sev${e.severity}`),s.classList.toggle("show",t);let l=c_._severityToSingleCodicon(e.severity);M(s,...Un(l)),r.appendChild(s);let c=document.createElement("div");c.classList.add("element"),r.appendChild(c);let u=document.createElement("div");u.classList.add("left"),c.appendChild(u);let p=typeof e.label=="string"?e.label:e.label.value;M(u,...Un(PMo(p,e.busy))),this._renderTextPlus(u,e.detail,n);let h=document.createElement("div");h.classList.add("right"),c.appendChild(h);let{command:g}=e;g&&n.add(new rg(h,{label:g.title,title:g.tooltip,href:A.from({scheme:"command",path:g.id,query:g.arguments&&JSON.stringify(g.arguments)}).toString()},{hoverDelegate:nI},this._hoverService,this._openerService));let f=new Zi(h,{hoverDelegate:nI}),v=o?d(11465,null):d(11463,null);f.setAriaLabel(v),n.add(f);let b;return o?b=new it("unpin",v,q.asClassName(R.pinned),!0,()=>{this._dedicated.delete(e.id),this._statusBarService.updateEntryVisibility(e.id,!1),this._update(),this._storeState()}):b=new it("pin",v,q.asClassName(R.pin),!0,()=>{this._dedicated.add(e.id),this._statusBarService.updateEntryVisibility(e.id,!0),this._update(),this._storeState()}),f.push(b,{icon:!0,label:!1}),n.add(b),r}static _severityToComboCodicon(i){switch(i){case bt.Error:return"$(bracket-error)";case bt.Warning:return"$(bracket-dot)";default:return"$(bracket)"}}static _severityToSingleCodicon(i){switch(i){case bt.Error:return"$(error)";case bt.Warning:return"$(info)";default:return"$(check)"}}_renderTextPlus(i,e,t){let o=!1;for(let n of ES(e).nodes)if(o||(M(i,_("span.separator")),o=!0),typeof n=="string"){let r=Un(n);M(i,...r)}else t.add(new rg(i,n,void 0,this._hoverService,this._openerService))}static _accessibilityInformation(i){if(i.accessibilityInfo)return i.accessibilityInfo;let e=typeof i.label=="string"?i.label:i.label.value;return i.detail?{label:d(11458,null,e,i.detail)}:{label:d(11459,null,e)}}static _asStatusbarEntry(i){let e;i.severity===bt.Warning?e="warning":i.severity===bt.Error&&(e="error");let t=typeof i.label=="string"?i.label:i.label.shortValue;return{name:d(11462,null,i.name),text:PMo(t,i.busy),ariaLabel:c_._accessibilityInformation(i).label,role:i.accessibilityInfo?.role,tooltip:i.command?.tooltip||new Ie(i.detail,{isTrusted:!0,supportThemeIcons:!0}),kind:e,command:i.command}}};c_=I([m(0,HB),m(1,kr),m(2,ee),m(3,nt),m(4,Je),m(5,ce)],c_);var b6t=class extends K{constructor(){super({id:"editor.inlayHints.Reset",title:L(11464,"Reset Language Status Interaction Counter"),category:Ve.View,f1:!0})}run(i){i.get(ce).remove("languageStatus.interactCount",0)}};function PMo(a,i){return xGi([a!==""&&a,i&&"$(loading~spin)"],"\xA0\xA0")}It(Fbe.Id,Fbe,St.AfterRestored);W(b6t);var S6t=class extends K{constructor(){super({id:"_signOutOfAccount",title:d(5373,null),f1:!1})}async run(i,{providerId:e,accountLabel:t}){let o=i.get(xs),n=i.get(DA),r=i.get(vk),s=i.get(at);if(!e||!t)throw new Error("Invalid arguments. Expected: { providerId: string; accountLabel: string }");let c=(await o.getSessions(e)).filter(h=>h.account.label===t),u=n.readAccountUsages(e,t),{confirmed:p}=await s.confirm({type:bt.Info,message:u.length?d(5371,null,t,u.map(h=>h.extensionName).join(`
`)):d(5372,null,t),primaryButton:d(5370,null)});if(p){let h=c.map(g=>o.removeSession(e,g.id));await Promise.all(h),n.removeAccountUsage(e,t),r.removeAllowedExtensions(e,t)}}};var I6t=class extends K{constructor(){super({id:"_manageTrustedExtensionsForAccount",title:L(5351,"Manage Trusted Extensions For Account"),category:L(5347,"Accounts"),f1:!0})}run(i,e){return i.get(F).createInstance(Bdt).run(e)}},Bdt=class{constructor(i,e,t,o,n,r,s){this._extensionService=i;this._dialogService=e;this._quickInputService=t;this._authenticationService=o;this._authenticationQueryService=n;this._commandService=r;this._extensionsWorkbenchService=s;this._viewDetailsButton={tooltip:d(5357,null),iconClass:q.asClassName(R.info)};this._managePreferencesButton={tooltip:d(5346,null),iconClass:q.asClassName(R.settingsGear)}}async run(i){let e=await this._resolveAccountQuery(i?.providerId,i?.accountLabel);if(!e)return;let t=await this._getItems(e);if(!t.length)return;let o=this._createQuickPick(e);o.items=t,o.selectedItems=t.filter(n=>n.type!=="separator"&&!!n.picked),o.show()}async _resolveAccountQuery(i,e){if(i&&e)return this._authenticationQueryService.provider(i).account(e);let t=await this._getAllAvailableAccounts(),o=await this._quickInputService.pick(t,{placeHolder:d(5354,null),matchOnDescription:!0});return o?this._authenticationQueryService.provider(o.providerId).account(o.label):void 0}async _getAllAvailableAccounts(){let i=[];for(let e of this._authenticationService.getProviderIds()){let t=this._authenticationService.getProvider(e),o=await this._authenticationService.getSessions(e),n=new Set;for(let r of o)n.has(r.account.label)||(n.add(r.account.label),i.push({providerId:e,label:r.account.label,description:t.label}))}return i}async _getItems(i){let e=i.extensions().getAllowedExtensions(),t=new Map;(await Promise.all(e.map(u=>this._extensionService.getExtension(u.id)))).forEach((u,p)=>{u&&t.set(e[p].id,u.displayName||u.name)});let n=e.filter(u=>t.has(u.id)).map(u=>{let p=i.extension(u.id).getUsage();return{...u,name:t.get(u.id),lastUsed:p.length>0?Math.max(...p.map(h=>h.lastUsed)):u.lastUsed}});if(!n.length)return this._dialogService.info(d(5352,null)),[];let r=n.filter(u=>u.trusted),s=n.filter(u=>!u.trusted),l=(u,p)=>(p.lastUsed||0)-(u.lastUsed||0),c=this._toQuickPickItem.bind(this);return[...s.sort(l).map(c),{type:"separator",label:d(5355,null)},...r.sort(l).map(c)]}_toQuickPickItem(i){let e=i.lastUsed,t=e?d(5345,null,ea(e,!0)):d(5353,null),o,n;return i.trusted&&(o=d(5356,null),n=!0),{label:i.name,extension:i,description:t,tooltip:o,disabled:n,buttons:[this._viewDetailsButton,this._managePreferencesButton],picked:i.allowed===void 0||i.allowed}}_createQuickPick(i){let e=new N,t=e.add(this._quickInputService.createQuickPick({useSeparators:!0}));return t.canSelectMany=!0,t.customButton=!0,t.customLabel=d(5350,null),t.customButtonSecondary=!0,t.title=d(5349,null),t.placeholder=d(5348,null),e.add(t.onDidAccept(()=>{let o=t.items.filter(r=>r.type!=="separator").map(r=>r.extension),n=new Set(t.selectedItems.map(r=>r.extension));for(let r of o){let s=n.has(r);i.extension(r.id).setAccessAllowed(s,r.name)}t.hide()})),e.add(t.onDidHide(()=>e.dispose())),e.add(t.onDidCustom(()=>t.hide())),e.add(t.onDidTriggerItemButton(o=>{o.button===this._managePreferencesButton?this._commandService.executeCommand("_manageAccountPreferencesForExtension",o.item.extension.id,i.providerId):o.button===this._viewDetailsButton&&this._extensionsWorkbenchService.open(o.item.extension.id)})),t}};Bdt=I([m(0,lt),m(1,at),m(2,Ue),m(3,xs),m(4,fM),m(5,ge),m(6,Hi)],Bdt);var y6t=class extends K{constructor(){super({id:"_manageAccountPreferencesForExtension",title:L(5307,"Manage Extension Account Preferences..."),category:L(5305,"Accounts"),f1:!0,menu:[{id:D.AccountsContext,order:100}]})}run(i,e,t){return i.get(F).createInstance(Hdt).run(e,t)}},Hdt=class{constructor(i,e,t,o,n,r){this._authenticationService=i;this._quickInputService=e;this._dialogService=t;this._authenticationQueryService=o;this._extensionService=n;this._logService=r}async run(i,e){if(!i){let u=this._extensionService.extensions.filter(h=>this._authenticationQueryService.extension(h.identifier.value).getAllAccountPreferences().size>0).sort((h,g)=>(h.displayName??h.name).localeCompare(g.displayName??g.name));i=(await this._quickInputService.pick(u.map(h=>({label:h.displayName??h.name,id:h.identifier.value})),{placeHolder:d(5312,null),title:d(5310,null)}))?.id}if(!i)return;let t=await this._extensionService.getExtension(i);if(!t)throw new Error(`No extension with id ${i}`);if(!e){let p=await this._authenticationQueryService.extension(i).getProvidersWithAccess();if(!p.length){await this._dialogService.info(d(5309,null));return}if(e=p[0],p.length>1){let h=await this._quickInputService.pick(p.map(g=>({label:this._authenticationService.getProvider(g).label,id:g})),{placeHolder:d(5313,null),title:d(5310,null)});if(!h)return;e=h.id}}let o=await this._authenticationService.getAccounts(e),n=this._authenticationQueryService.provider(e).extension(i).getPreferredAccount(),r=this._getItems(o,e,n),s=this._authenticationService.getProvider(e);if(s.supportsMultipleAccounts){let u=o.flatMap(p=>this._authenticationQueryService.provider(e).account(p.label).extension(i).getUsage()).sort((p,h)=>h.lastUsed-p.lastUsed)[0]?.scopes;u&&(r.push({type:"separator"}),r.push({providerId:e,scopes:u,label:d(5315,null)}))}let l=new N,c=this._createQuickPick(l,i,t.displayName??t.name,s.label);if(r.length===0){l.add(this._handleNoAccounts(c));return}c.items=r,c.show()}_createQuickPick(i,e,t,o){let n=i.add(this._quickInputService.createQuickPick({useSeparators:!0}));return i.add(n.onDidHide(()=>{i.dispose()})),n.placeholder=d(5311,null,t,o),n.title=d(5314,null,t),n.sortByLabel=!1,i.add(n.onDidAccept(async()=>{n.hide(),await this._accept(e,n.selectedItems)})),n}_getItems(i,e,t){return i.map(o=>t===o.label?{label:o.label,account:o,providerId:e,description:d(5306,null),picked:!0}:{label:o.label,account:o,providerId:e})}_handleNoAccounts(i){return i.validationMessage=d(5308,null),i.buttons=[this._quickInputService.backButton],i.show(),U.filter(i.onDidTriggerButton,e=>e===this._quickInputService.backButton)(()=>this.run())}async _accept(i,e){for(let t of e){let o;if(t.account)o=t.account;else try{o=(await this._authenticationService.createSession(t.providerId,[...t.scopes])).account}catch(l){this._logService.error(l);continue}let n=t.providerId,r=this._authenticationQueryService.provider(n).extension(i);r.getPreferredAccount()!==o.label&&r.setPreferredAccount(o)}}};Hdt=I([m(0,xs),m(1,Ue),m(2,at),m(3,fM),m(4,lt),m(5,se)],Hdt);var w6t=class extends K{constructor(){super({id:"_manageAccountPreferencesForMcpServer",title:L(5318,"Manage MCP Server Account Preferences"),category:L(5316,"Accounts"),f1:!1})}run(i,e,t){return i.get(F).createInstance(Udt).run(e,t)}},Udt=class{constructor(i,e,t,o,n,r){this._authenticationService=i;this._quickInputService=e;this._dialogService=t;this._authenticationQueryService=o;this._mcpService=n;this._logService=r}async run(i,e){if(!i)return;let t=this._mcpService.servers.get().find(u=>u.definition.id===i);if(!t)throw new Error(`No MCP server with id ${i}`);if(!e){let p=await this._authenticationQueryService.mcpServer(i).getProvidersWithAccess();if(!p.length){await this._dialogService.info(d(5320,null));return}if(e=p[0],p.length>1){let h=await this._quickInputService.pick(p.map(g=>({label:this._authenticationService.getProvider(g).label,id:g})),{placeHolder:d(5323,null),title:d(5321,null)});if(!h)return;e=h.id}}let o=await this._authenticationService.getAccounts(e),n=this._authenticationQueryService.provider(e).mcpServer(i).getPreferredAccount(),r=this._getItems(o,e,n),s=this._authenticationService.getProvider(e);if(s.supportsMultipleAccounts){let u=o.flatMap(p=>this._authenticationQueryService.provider(e).account(p.label).mcpServer(i).getUsage()).sort((p,h)=>h.lastUsed-p.lastUsed)[0]?.scopes;u&&(r.push({type:"separator"}),r.push({providerId:e,scopes:u,label:d(5325,null)}))}let l=new N,c=this._createQuickPick(l,i,t.definition.label,s.label);if(r.length===0){l.add(this._handleNoAccounts(c));return}c.items=r,c.show()}_createQuickPick(i,e,t,o){let n=i.add(this._quickInputService.createQuickPick({useSeparators:!0}));return i.add(n.onDidHide(()=>{i.dispose()})),n.placeholder=d(5322,null,t,o),n.title=d(5324,null,t),n.sortByLabel=!1,i.add(n.onDidAccept(async()=>{n.hide(),await this._accept(e,n.selectedItems)})),n}_getItems(i,e,t){return i.map(o=>t===o.label?{label:o.label,account:o,providerId:e,description:d(5317,null),picked:!0}:{label:o.label,account:o,providerId:e})}_handleNoAccounts(i){return i.validationMessage=d(5319,null),i.buttons=[this._quickInputService.backButton],i.show(),U.filter(i.onDidTriggerButton,e=>e===this._quickInputService.backButton)(()=>this.run())}async _accept(i,e){for(let t of e){let o;if(t.account)o=t.account;else try{o=(await this._authenticationService.createSession(t.providerId,[...t.scopes])).account}catch(l){this._logService.error(l);continue}let n=t.providerId,r=this._authenticationQueryService.provider(n).mcpServer(i);r.getPreferredAccount()!==o.label&&r.setPreferredAccount(o)}}};Udt=I([m(0,xs),m(1,Ue),m(2,at),m(3,fM),m(4,_s),m(5,se)],Udt);var C6t=class extends K{constructor(){super({id:"_manageTrustedMCPServersForAccount",title:L(5364,"Manage Trusted MCP Servers For Account"),category:L(5360,"Accounts"),f1:!0,precondition:ie.Setup.hidden.negate()})}run(i,e){return i.get(F).createInstance(zdt).run(e)}},zdt=class{constructor(i,e,t,o,n,r){this._mcpServerService=i;this._dialogService=e;this._quickInputService=t;this._mcpServerAuthenticationService=o;this._authenticationQueryService=n;this._commandService=r}async run(i){let e=await this._resolveAccountQuery(i?.providerId,i?.accountLabel);if(!e)return;let t=await this._getItems(e);if(!t.length)return;let o=this._createQuickPick(e);o.items=t,o.selectedItems=t.filter(n=>n.type!=="separator"&&!!n.picked),o.show()}async _resolveAccountQuery(i,e){if(i&&e)return this._authenticationQueryService.provider(i).account(e);let t=await this._getAllAvailableAccounts(),o=await this._quickInputService.pick(t,{placeHolder:d(5367,null),matchOnDescription:!0});return o?this._authenticationQueryService.provider(o.providerId).account(o.label):void 0}async _getAllAvailableAccounts(){let i=[];for(let e of this._mcpServerAuthenticationService.getProviderIds()){let t=this._mcpServerAuthenticationService.getProvider(e),o=await this._mcpServerAuthenticationService.getSessions(e),n=new Set;for(let r of o)n.has(r.account.label)||(n.add(r.account.label),i.push({providerId:e,label:r.account.label,description:t.label}))}return i}async _getItems(i){let e=i.mcpServers().getAllowedMcpServers(),t=new Map(this._mcpServerService.servers.get().map(l=>[l.definition.id,l.definition.label])),o=e.filter(l=>t.has(l.id)).map(l=>{let c=i.mcpServer(l.id).getUsage();return{...l,name:t.get(l.id),lastUsed:c.length>0?Math.max(...c.map(u=>u.lastUsed)):l.lastUsed}});if(!o.length)return this._dialogService.info(d(5365,null)),[];let n=o.filter(l=>l.trusted),r=o.filter(l=>!l.trusted),s=(l,c)=>(c.lastUsed||0)-(l.lastUsed||0);return[...r.sort(s).map(this._toQuickPickItem),{type:"separator",label:d(5368,null)},...n.sort(s).map(this._toQuickPickItem)]}_toQuickPickItem(i){let e=i.lastUsed,t=e?d(5358,null,ea(e,!0)):d(5366,null),o,n;return i.trusted&&(o=d(5369,null),n=!0),{label:i.name,mcpServer:i,description:t,tooltip:o,disabled:n,buttons:[{tooltip:d(5359,null),iconClass:q.asClassName(R.settingsGear)}],picked:i.allowed===void 0||i.allowed}}_createQuickPick(i){let e=new N,t=e.add(this._quickInputService.createQuickPick({useSeparators:!0}));return t.canSelectMany=!0,t.customButton=!0,t.customLabel=d(5363,null),t.customButtonSecondary=!0,t.title=d(5362,null),t.placeholder=d(5361,null),e.add(t.onDidAccept(()=>{t.hide();let o=t.items.filter(r=>r.type!=="separator").map(r=>r.mcpServer),n=new Set(t.selectedItems.map(r=>r.mcpServer));for(let r of o){let s=n.has(r);i.mcpServer(r.id).setAccessAllowed(s,r.name)}})),e.add(t.onDidHide(()=>e.dispose())),e.add(t.onDidCustom(()=>t.hide())),e.add(t.onDidTriggerItemButton(o=>this._commandService.executeCommand("_manageAccountPreferencesForMcpServer",o.item.mcpServer.id,i.providerId))),t}};zdt=I([m(0,_s),m(1,at),m(2,Ue),m(3,xs),m(4,fM),m(5,ge)],zdt);var x6t=class a extends K{static{this.ID="workbench.action.removeDynamicAuthenticationProviders"}constructor(){super({id:a.ID,title:L(5343,"Remove Dynamic Authentication Providers"),category:L(5335,"Authentication"),f1:!0})}async run(i){let e=i.get(Ue),t=i.get(SZ),o=i.get(xs),n=i.get(at),r=t.getInteractedProviders();if(r.length===0){await n.info(d(5340,null),d(5341,null));return}let s=r.map(h=>({label:h.label,description:d(5336,null,h.clientId),provider:h})),l=await e.pick(s,{placeHolder:d(5344,null),canPickMany:!0});if(!l||l.length===0)return;let c=l.map(h=>h.provider.label).join(", "),u=l.length===1?d(5339,null,c):d(5338,null,l.length,c);if((await n.confirm({message:u,detail:d(5337,null),primaryButton:d(5342,null),type:"warning"})).confirmed)for(let h of l){let g=h.provider.providerId;o.isAuthenticationProviderRegistered(g)&&o.unregisterAuthenticationProvider(g),await t.removeDynamicProvider(g)}}};var k6t=class extends K{constructor(){super({id:"workbench.action.manageAccounts",title:L(5328,"Manage Accounts"),category:L(5326,"Accounts"),f1:!0})}run(i){return i.get(F).createInstance(Kdt).run()}},Kdt=class{constructor(i,e,t,o,n){this.quickInputService=i;this.authenticationService=e;this.commandService=t;this.secretStorageService=o;this.productService=n}async run(){let i=d(5332,null),e=await this.listAccounts();if(!e.length){await this.quickInputService.pick([{label:d(5331,null)}],{placeHolder:i});return}let t=await this.quickInputService.pick(e,{placeHolder:i,matchOnDescription:!0});t&&await this.showAccountActions(t)}async listAccounts(){let i=new co(()=>bZ(this.secretStorageService,this.productService)),e=[];for(let t of this.authenticationService.getProviderIds()){let o=this.authenticationService.getProvider(t);for(let{label:n,id:r}of await this.authenticationService.getAccounts(t))e.push({label:n,description:o.label,providerId:t,canUseMcp:!!o.authorizationServers?.length,canSignOut:async()=>this.canSignOut(o,r,await i.value)})}return e}async canSignOut(i,e,t){return t&&!t.canSignOut&&t.providerId===i.id?!(await this.authenticationService.getSessions(i.id)).some(n=>n.id===t.id&&n.account.id===e):!0}async showAccountActions(i){let{providerId:e,label:t,canUseMcp:o,canSignOut:n}=i,r=new N,s=r.add(this.quickInputService.createQuickPick());s.title=d(5327,null,t),s.placeholder=d(5333,null),s.buttons=[this.quickInputService.backButton];let l=[{label:d(5329,null),action:()=>this.commandService.executeCommand("_manageTrustedExtensionsForAccount",{providerId:e,accountLabel:t})}];o&&l.push({label:d(5330,null),action:()=>this.commandService.executeCommand("_manageTrustedMCPServersForAccount",{providerId:e,accountLabel:t})}),await n()&&l.push({label:d(5334,null),action:()=>this.commandService.executeCommand("_signOutOfAccount",{providerId:e,accountLabel:t})}),s.items=l,r.add(s.onDidAccept(()=>{let c=s.selectedItems[0];c&&(s.hide(),c.action())})),r.add(s.onDidTriggerButton(c=>{c===this.quickInputService.backButton&&this.run()})),r.add(s.onDidHide(()=>r.dispose())),s.show()}};Kdt=I([m(0,Ue),m(1,xs),m(2,ge),m(3,Dw),m(4,tt)],Kdt);var wSn=$e.registerCommand("workbench.getCodeExchangeProxyEndpoints",function(a,i){return a.get(cd).options?.codeExchangeProxyEndpoints}),VUi=class extends x{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.authentication}render(e){let t=e.contributes?.authentication||[];if(!t.length)return{data:{headers:[],rows:[]},dispose:()=>{}};let o=[d(5376,null),d(5375,null),d(5377,null)],n=t.sort((r,s)=>r.label.localeCompare(s.label)).map(r=>[r.label,r.id,(r.authorizationServerGlobs??[]).join(`,
`)]);return{data:{headers:o,rows:n},dispose:()=>{}}}},CSn=ne.as(As.ExtensionFeaturesRegistry).registerExtensionFeature({id:"authentication",label:d(5374,null),access:{canToggle:!1},renderer:new Ft(VUi)}),E6t=class extends x{static{this.ID="workbench.contrib.authentication"}constructor(){super(),this._register(wSn),this._register(CSn),this._registerActions()}_registerActions(){this._register(W(k6t)),this._register(W(S6t)),this._register(W(I6t)),this._register(W(y6t)),this._register(W(C6t)),this._register(W(w6t)),this._register(W(x6t))}},MKe=class{constructor(i){this._authenticationUsageService=i;this._initializeExtensionUsageCache()}static{this.ID="workbench.contrib.authenticationUsage"}async _initializeExtensionUsageCache(){await this._authenticationUsageService.initializeExtensionUsageCache()}};MKe=I([m(0,DA)],MKe);It(E6t.ID,E6t,St.AfterRestored);It(MKe.ID,MKe,St.Eventually);var PKe=class extends AD{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super(e,o,n,r,s,l,c,u,p,h,g,y);this.editorService=t;this.userDataSyncService=f;this.userDataSyncWorkbenchService=v;this.userDataSyncEnablementService=b;this.userDataProfilesService=S;this._register(this.userDataSyncService.onDidChangeConflicts(()=>this.treeView.refresh())),this.registerActions()}renderTreeView(e){super.renderTreeView(M(e,_("")));let t=this;this.treeView.message=d(16544,null),this.treeView.dataProvider={getChildren(){return t.getTreeItems()}}}async getTreeItems(){let e=[],t=this.userDataSyncService.conflicts.map(n=>n.conflicts.map(r=>({...r,syncResource:n.syncResource,profile:n.profile}))).flat().sort((n,r)=>n.profile.id===r.profile.id?0:n.profile.isDefault?-1:r.profile.isDefault?1:n.profile.name.localeCompare(r.profile.name)),o=[];for(let n of t){let r=o[o.length-1]?.[0].id===n.profile.id?o[o.length-1][1]:void 0;r||o.push([n.profile,r=[]]),r.push(n)}for(let[n,r]of o){let s=[];for(let l of r){let c=JSON.stringify(l),u={handle:c,resourceUri:l.remoteResource,label:{label:He(l.remoteResource),strikethrough:l.mergeState==="accepted"&&(l.localChange===3||l.remoteChange===3)},description:Kv(l.syncResource),collapsibleState:0,command:{id:"workbench.actions.sync.openConflicts",title:"",arguments:[{$treeViewId:"",$treeItemHandle:c}]},contextValue:"sync-conflict-resource"};s.push(u)}e.push({handle:n.id,label:{label:n.name},collapsibleState:2,children:s})}return o.length===1&&o[0][0].isDefault?e[0].children??[]:e}parseHandle(e){let t=JSON.parse(e);return{syncResource:t.syncResource,profile:fw(t.profile,this.userDataProfilesService.profilesHome.scheme),localResource:A.revive(t.localResource),remoteResource:A.revive(t.remoteResource),baseResource:A.revive(t.baseResource),previewResource:A.revive(t.previewResource),acceptedResource:A.revive(t.acceptedResource),localChange:t.localChange,remoteChange:t.remoteChange,mergeState:t.mergeState}}registerActions(){let e=this;this._register(W(class extends K{constructor(){super({id:"workbench.actions.sync.openConflicts",title:d(16550,null)})}async run(o,n){let r=e.parseHandle(n.$treeItemHandle);return e.open(r)}})),this._register(W(class extends K{constructor(){super({id:"workbench.actions.sync.acceptRemote",title:d(16549,null),icon:R.cloudDownload,menu:{id:D.ViewItemContext,when:C.and(C.equals("view",Ree),C.equals("viewItem","sync-conflict-resource")),group:"inline",order:1}})}async run(o,n){let r=e.parseHandle(n.$treeItemHandle);await e.userDataSyncWorkbenchService.accept({syncResource:r.syncResource,profile:r.profile},r.remoteResource,void 0,e.userDataSyncEnablementService.isEnabled())}})),this._register(W(class extends K{constructor(){super({id:"workbench.actions.sync.acceptLocal",title:d(16548,null),icon:R.cloudUpload,menu:{id:D.ViewItemContext,when:C.and(C.equals("view",Ree),C.equals("viewItem","sync-conflict-resource")),group:"inline",order:2}})}async run(o,n){let r=e.parseHandle(n.$treeItemHandle);await e.userDataSyncWorkbenchService.accept({syncResource:r.syncResource,profile:r.profile},r.localResource,void 0,e.userDataSyncEnablementService.isEnabled())}}))}async open(e){if(!this.userDataSyncService.conflicts.some(({conflicts:n})=>n.some(({localResource:r})=>Qe(r,e.localResource))))return;let t=d(16546,null,He(e.remoteResource)),o=d(16545,null,He(e.remoteResource));await this.editorService.openEditor({input1:{resource:e.remoteResource,label:d(16547,null),description:t},input2:{resource:e.localResource,label:d(16551,null),description:o},base:{resource:e.baseResource},result:{resource:e.previewResource},options:{preserveFocus:!0,revealIfVisible:!0,pinned:!0,override:la.id}})}};PKe=I([m(1,ee),m(2,_e),m(3,Xe),m(4,B),m(5,X),m(6,Bi),m(7,F),m(8,Je),m(9,Le),m(10,Ne),m(11,nt),m(12,bI),m(13,SI),m(14,Fl),m(15,an),m(16,FLe)],PKe);var AKe=class extends x{constructor(e,t,o,n,r){super();this.instantiationService=t;this.userDataSyncEnablementService=o;this.userDataSyncMachinesService=n;this.userDataSyncService=r;this.registerViews(e)}registerViews(e){this.registerConflictsView(e),this.registerActivityView(e,!0),this.registerMachinesView(e),this.registerActivityView(e,!1),this.registerTroubleShootView(e),this.registerExternalActivityView(e)}registerConflictsView(e){let t=ne.as(Mn.ViewsRegistry),o=L(16553,"Conflicts"),n={id:Ree,name:o,ctorDescriptor:new Ft(PKe),when:C.and(wBt,Lee),canToggleVisibility:!1,canMoveView:!1,treeView:this.instantiationService.createInstance(W2,Ree,o.value),collapsed:!1,order:100};t.registerViews([n],e)}registerMachinesView(e){let t="workbench.views.sync.machines",o=L(16569,"Synced Machines"),n=this.instantiationService.createInstance(W2,t,o.value),r=this.instantiationService.createInstance($dt,n);n.showRefreshAction=!0,n.canSelectMany=!0,n.dataProvider=r,this._register(U.any(this.userDataSyncMachinesService.onDidChange,this.userDataSyncService.onDidResetRemote)(()=>n.refresh()));let s=ne.as(Mn.ViewsRegistry),l={id:t,name:o,ctorDescriptor:new Ft(AD),when:C.and(Ly.notEqualsTo("uninitialized"),LH.isEqualTo("available"),Lme),canToggleVisibility:!0,canMoveView:!1,treeView:n,collapsed:!1,order:300};s.registerViews([l],e),this._register(W(class extends K{constructor(){super({id:"workbench.actions.sync.editMachineName",title:d(16576,null),icon:R.edit,menu:{id:D.ViewItemContext,when:C.and(C.equals("view",t)),group:"inline"}})}async run(c,u){await r.rename(u.$treeItemHandle)&&await n.refresh()}})),this._register(W(class extends K{constructor(){super({id:"workbench.actions.sync.turnOffSyncOnMachine",title:d(16580,null),menu:{id:D.ViewItemContext,when:C.and(C.equals("view",t),C.equals("viewItem","sync-machine"))}})}async run(c,u,p){await r.disable((p||[u]).map(h=>h.$treeItemHandle))&&await n.refresh()}}))}registerActivityView(e,t){let o=`workbench.views.sync.${t?"remote":"local"}Activity`,n=t?L(16562,"Sync Activity (Remote)"):L(16558,"Sync Activity (Local)"),r=this.instantiationService.createInstance(W2,o,n.value);r.showCollapseAllAction=!0,r.showRefreshAction=!0,r.dataProvider=t?this.instantiationService.createInstance(Gdt):this.instantiationService.createInstance(BUi),this._register(U.any(this.userDataSyncEnablementService.onDidChangeResourceEnablement,this.userDataSyncEnablementService.onDidChangeEnablement,this.userDataSyncService.onDidResetLocal,this.userDataSyncService.onDidResetRemote)(()=>r.refresh()));let s=ne.as(Mn.ViewsRegistry),l={id:o,name:n,ctorDescriptor:new Ft(AD),when:C.and(Ly.notEqualsTo("uninitialized"),LH.isEqualTo("available"),Lme),canToggleVisibility:!0,canMoveView:!1,treeView:r,collapsed:!1,order:t?200:400,hideByDefault:!t};s.registerViews([l],e),this.registerDataViewActions(o)}registerExternalActivityView(e){let t="workbench.views.sync.externalActivity",o=L(16555,"Sync Activity (Developer)"),n=this.instantiationService.createInstance(qdt,void 0),r=this.instantiationService.createInstance(W2,t,o.value);r.showCollapseAllAction=!1,r.showRefreshAction=!1,r.dataProvider=n;let s=ne.as(Mn.ViewsRegistry),l={id:t,name:o,ctorDescriptor:new Ft(AD),when:Lme,canToggleVisibility:!0,canMoveView:!1,treeView:r,collapsed:!1,hideByDefault:!1};s.registerViews([l],e),this._register(W(class extends K{constructor(){super({id:"workbench.actions.sync.loadActivity",title:d(16577,null),icon:R.cloudUpload,menu:{id:D.ViewTitle,when:C.equals("view",t),group:"navigation"}})}async run(c){let p=await c.get(rn).showOpenDialog({title:d(16566,null),canSelectFiles:!0,canSelectFolders:!0,canSelectMany:!1});p?.[0]&&(n.activityDataResource=p[0],await r.refresh())}}))}registerDataViewActions(e){this._register(W(class extends K{constructor(){super({id:`workbench.actions.sync.${e}.resolveResource`,title:d(16579,null),menu:{id:D.ViewItemContext,when:C.and(C.equals("view",e),C.regex("viewItem",/sync-resource-.*/i))}})}async run(t,o){let{resource:n}=JSON.parse(o.$treeItemHandle);await t.get(ee).openEditor({resource:A.parse(n),options:{pinned:!0}})}})),this._register(W(class extends K{constructor(){super({id:`workbench.actions.sync.${e}.compareWithLocal`,title:d(16575,null),menu:{id:D.ViewItemContext,when:C.and(C.equals("view",e),C.regex("viewItem",/sync-associatedResource-.*/i))}})}async run(t,o){let n=t.get(ge),{resource:r,comparableResource:s}=JSON.parse(o.$treeItemHandle),l=A.parse(r),c=A.parse(s);return n.executeCommand(cx,l,c,d(16563,null,d(16557,null,He(l)),d(16565,null,He(c))),void 0)}})),this._register(W(class extends K{constructor(){super({id:`workbench.actions.sync.${e}.replaceCurrent`,title:d(16578,null),icon:R.discard,menu:{id:D.ViewItemContext,when:C.and(C.equals("view",e),C.regex("viewItem",/sync-resource-.*/i),C.notEquals("viewItem","sync-resource-profiles")),group:"inline"}})}async run(t,o){let n=t.get(at),r=t.get(bI),{syncResourceHandle:s,syncResource:l}=JSON.parse(o.$treeItemHandle);if((await n.confirm({message:d(16552,null,Kv(l)),type:"info",title:Mh.value})).confirmed)return r.replace({created:s.created,uri:A.revive(s.uri)})}}))}registerTroubleShootView(e){let t="workbench.views.sync.troubleshoot",o=L(16570,"Troubleshoot"),n=this.instantiationService.createInstance(W2,t,o.value),r=this.instantiationService.createInstance(jdt);n.showRefreshAction=!0,n.dataProvider=r;let s=ne.as(Mn.ViewsRegistry),l={id:t,name:o,ctorDescriptor:new Ft(AD),when:Lme,canToggleVisibility:!0,canMoveView:!1,treeView:n,collapsed:!1,order:500,hideByDefault:!0};s.registerViews([l],e)}};AKe=I([m(1,F),m(2,Fl),m(3,Pee),m(4,bI)],AKe);var Wbe=class{constructor(i,e,t,o,n,r){this.userDataSyncService=i;this.userDataSyncResourceProviderService=e;this.userDataAutoSyncService=t;this.userDataSyncWorkbenchService=o;this.notificationService=n;this.userDataProfilesService=r;this.syncResourceHandlesByProfile=new Map}async getChildren(i){try{if(!i)return await this.getRoots();if(i.profile||i.handle===this.userDataProfilesService.defaultProfile.id){let e=this.syncResourceHandlesByProfile.get(i.handle);return e||this.syncResourceHandlesByProfile.set(i.handle,e=this.getSyncResourceHandles(i.profile)),await e}return i.syncResourceHandle?await this.getChildrenForSyncResourceTreeItem(i):[]}catch(e){throw e instanceof Vg||(e=Vg.toUserDataSyncError(e)),e instanceof Vg&&e.code==="IncompatibleRemoteContent"?this.notificationService.notify({severity:ft.Error,message:e.message,actions:{primary:[ii({id:"reset",label:d(16564,null),run:()=>this.userDataSyncWorkbenchService.resetSyncedData()})]}}):this.notificationService.error(e),e}}async getRoots(){this.syncResourceHandlesByProfile.clear();let i=[],e=await this.getProfiles();if(e.length){let t={handle:this.userDataProfilesService.defaultProfile.id,label:{label:this.userDataProfilesService.defaultProfile.name},collapsibleState:2};i.push(t)}else{let t=await this.getSyncResourceHandles();i.push(...t)}for(let t of e){let o={handle:t.id,label:{label:t.name},collapsibleState:1,profile:t};i.push(o)}return i}async getChildrenForSyncResourceTreeItem(i){let e=i.syncResourceHandle,t=await this.userDataSyncResourceProviderService.getAssociatedResources(e),o=e.previous?await this.userDataSyncResourceProviderService.getAssociatedResources(e.previous):[];return t.map(({resource:n,comparableResource:r})=>{let s=JSON.stringify({resource:n.toString(),comparableResource:r.toString()}),l=o.find(c=>He(c.resource)===He(n))?.resource;return{handle:s,collapsibleState:0,resourceUri:n,command:l?{id:cx,title:"",arguments:[l,n,d(16567,null,`${He(n)} (${ea(e.previous.created,!0)})`,`${He(n)} (${ea(e.created,!0)})`),void 0]}:{id:vg,title:"",arguments:[n,void 0,void 0]},contextValue:`sync-associatedResource-${e.syncResource}`}})}async getSyncResourceHandles(i){let e=[],o=(await Promise.all(Sme.map(async n=>{let r=await this.getResourceHandles(n,i);return r.map((s,l)=>({...s,syncResource:n,previous:r[l+1]}))}))).flat().sort((n,r)=>r.created-n.created);for(let n of o){let r=JSON.stringify({syncResourceHandle:n,syncResource:n.syncResource});e.push({handle:r,collapsibleState:1,label:{label:Kv(n.syncResource)},description:ea(n.created,!0),tooltip:new Date(n.created).toLocaleString(),themeIcon:wj,syncResourceHandle:n,contextValue:`sync-resource-${n.syncResource}`})}return e}};Wbe=I([m(0,bI),m(1,$Re),m(2,PT),m(3,SI),m(4,Ne),m(5,an)],Wbe);var BUi=class extends Wbe{getResourceHandles(i,e){return this.userDataSyncResourceProviderService.getLocalSyncResourceHandles(i,e)}async getProfiles(){return this.userDataProfilesService.profiles.filter(i=>!i.isDefault).map(i=>({id:i.id,collection:i.id,name:i.name}))}},Gdt=class extends Wbe{constructor(e,t,o,n,r,s,l){super(e,t,o,r,s,l);this.userDataSyncMachinesService=n}async getChildren(e){return e||(this.machinesPromise=void 0),super.getChildren(e)}getMachines(){return this.machinesPromise===void 0&&(this.machinesPromise=this.userDataSyncMachinesService.getMachines()),this.machinesPromise}getResourceHandles(e,t){return this.userDataSyncResourceProviderService.getRemoteSyncResourceHandles(e,t)}getProfiles(){return this.userDataSyncResourceProviderService.getRemoteSyncedProfiles()}async getChildrenForSyncResourceTreeItem(e){let t=await super.getChildrenForSyncResourceTreeItem(e);if(t.length){let o=await this.userDataSyncResourceProviderService.getMachineId(e.syncResourceHandle);if(o){let r=(await this.getMachines()).find(({id:s})=>s===o);t[0].description=r?.isCurrent?d(16554,null):r?.name}}return t}};Gdt=I([m(0,bI),m(1,$Re),m(2,PT),m(3,Pee),m(4,SI),m(5,Ne),m(6,an)],Gdt);var qdt=class extends Wbe{constructor(e,t,o,n,r,s,l,c,u){super(t,o,n,r,s,l);this.activityDataResource=e;this.fileService=c;this.uriIdentityService=u}async getChildren(e){if(!e){if(this.machinesPromise=void 0,!this.activityDataResource)return[];if((await this.fileService.resolve(this.activityDataResource)).isDirectory)this.activityDataLocation=this.activityDataResource;else{this.activityDataLocation=this.uriIdentityService.extUri.joinPath(this.uriIdentityService.extUri.dirname(this.activityDataResource),"remoteActivity");try{await this.fileService.del(this.activityDataLocation,{recursive:!0})}catch{}await this.userDataSyncService.extractActivityData(this.activityDataResource,this.activityDataLocation)}}return super.getChildren(e)}getResourceHandles(e,t){return this.userDataSyncResourceProviderService.getLocalSyncResourceHandles(e,t,this.activityDataLocation)}async getProfiles(){return this.userDataSyncResourceProviderService.getLocalSyncedProfiles(this.activityDataLocation)}async getChildrenForSyncResourceTreeItem(e){let t=await super.getChildrenForSyncResourceTreeItem(e);if(t.length){let o=await this.userDataSyncResourceProviderService.getMachineId(e.syncResourceHandle);if(o){let r=(await this.getMachines()).find(({id:s})=>s===o);t[0].description=r?.isCurrent?d(16554,null):r?.name}}return t}getMachines(){return this.machinesPromise===void 0&&(this.machinesPromise=this.userDataSyncResourceProviderService.getLocalSyncedMachines(this.activityDataLocation)),this.machinesPromise}};qdt=I([m(1,bI),m(2,$Re),m(3,PT),m(4,SI),m(5,Ne),m(6,an),m(7,fe),m(8,ht)],qdt);var $dt=class{constructor(i,e,t,o,n,r){this.treeView=i;this.userDataSyncMachinesService=e;this.quickInputService=t;this.notificationService=o;this.dialogService=n;this.userDataSyncWorkbenchService=r}async getChildren(i){i||(this.machinesPromise=void 0);try{let e=await this.getMachines();return e=e.filter(t=>!t.disabled).sort((t,o)=>t.isCurrent?-1:1),this.treeView.message=e.length?void 0:d(16559,null),e.map(({id:t,name:o,isCurrent:n,platform:r})=>({handle:t,collapsibleState:0,label:{label:o},description:n?d(16554,null):void 0,themeIcon:r&&Euo(r)?R.globe:R.vm,contextValue:"sync-machine"}))}catch(e){return this.notificationService.error(e),[]}}getMachines(){return this.machinesPromise===void 0&&(this.machinesPromise=this.userDataSyncMachinesService.getMachines()),this.machinesPromise}async disable(i){let t=(await this.getMachines()).filter(({id:r})=>i.includes(r));if(!t.length)throw new Error(d(16560,null,i.join(",")));if(!(await this.dialogService.confirm({type:"info",message:t.length>1?d(16573,null):d(16572,null,t[0].name),primaryButton:d(16571,null)})).confirmed)return!1;t.some(r=>r.isCurrent)&&await this.userDataSyncWorkbenchService.turnoff(!1);let n=t.filter(r=>!r.isCurrent).map(r=>[r.id,!1]);return n.length&&await this.userDataSyncMachinesService.setEnablements(n),!0}async rename(i){let e=new N,t=e.add(this.quickInputService.createInputBox());t.placeholder=d(16561,null),t.busy=!0,t.show();let o=await this.getMachines(),n=o.find(({id:l})=>l===i),r=o.filter(({disabled:l})=>!l);if(!n)throw t.hide(),e.dispose(),new Error(d(16560,null,i));t.busy=!1,t.value=n.name;let s=l=>(l=l.trim(),l&&!r.some(c=>c.id!==i&&c.name===l)?l:null);return e.add(t.onDidChangeValue(()=>t.validationMessage=s(t.value)?"":d(16574,null))),new Promise((l,c)=>{e.add(t.onDidAccept(async()=>{let u=s(t.value);if(e.dispose(),u&&u!==n.name)try{await this.userDataSyncMachinesService.renameMachine(i,u),l(!0)}catch(p){c(p)}else l(!1)}))})}};$dt=I([m(1,Pee),m(2,Ue),m(3,Ne),m(4,at),m(5,SI)],$dt);var jdt=class{constructor(i,e,t,o){this.fileService=i;this.userDataSyncWorkbenchService=e;this.environmentService=t;this.uriIdentityService=o}async getChildren(i){return i?i.handle==="LAST_SYNC_STATES"?this.getLastSyncStates():i.handle==="SYNC_LOGS"?this.getSyncLogs():[]:[{handle:"SYNC_LOGS",collapsibleState:1,label:{label:d(16568,null)},themeIcon:R.folder},{handle:"LAST_SYNC_STATES",collapsibleState:1,label:{label:d(16556,null)},themeIcon:R.folder}]}async getLastSyncStates(){let i=[];for(let e of Sme){let t=NZe(void 0,e,this.environmentService,this.uriIdentityService.extUri);await this.fileService.exists(t)&&i.push({handle:t.toString(),label:{label:Kv(e)},collapsibleState:0,resourceUri:t,command:{id:vg,title:"",arguments:[t,void 0,void 0]}})}return i}async getSyncLogs(){let i=await this.userDataSyncWorkbenchService.getAllLogResources(),e=[];for(let t of i){let o=this.uriIdentityService.extUri.dirname(t);e.push({handle:t.toString(),collapsibleState:0,resourceUri:t,label:{label:this.uriIdentityService.extUri.basename(o)},description:this.uriIdentityService.extUri.isEqual(o,this.environmentService.logsHome)?d(16554,null):void 0,command:{id:vg,title:"",arguments:[t,void 0,void 0]}})}return e}};jdt=I([m(0,fe),m(1,SI),m(2,Eo),m(3,ht)],jdt);var T6t={id:"workbench.userDataSync.actions.turnOff",title:L(16512,"Turn Off")},_6t={id:set,title:L(16474,"Configure...")},AMo="workbench.userDataSync.actions.showConflicts",Qdt={id:"workbench.userDataSync.actions.syncNow",title:L(16516,"Sync Now"),description(a){if(a.status==="syncing")return d(16519,null);if(a.lastSyncTime)return d(16518,null,ea(a.lastSyncTime,!0))}},D6t={id:"workbench.userDataSync.actions.settings",title:L(16517,"Show Settings")},L6t={id:"workbench.userDataSync.actions.showSyncedData",title:L(16505,"Show Synced Data")},R6t=new Y("userDataSyncTurningOn",!1),NKe=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,P,O,V){super();this.userDataSyncEnablementService=e;this.userDataSyncService=t;this.userDataSyncWorkbenchService=o;this.activityService=r;this.notificationService=s;this.editorService=l;this.userDataProfileService=c;this.dialogService=u;this.quickInputService=p;this.instantiationService=h;this.outputService=g;this.preferencesService=b;this.telemetryService=S;this.productService=y;this.openerService=w;this.authenticationService=k;this.userDataSyncStoreManagementService=T;this.hostService=P;this.commandService=O;this.workbenchIssueService=V;this.globalActivityBadgeDisposable=this._register(new me);this.accountBadgeDisposable=this._register(new me);this.conflictsDisposables=new Map;this.invalidContentErrorDisposables=new Map;this.conflictsActionDisposable=this._register(new me);this.turningOnSyncContext=R6t.bindTo(n),o.enabled&&(auo(),this.updateAccountBadge(),this.updateGlobalActivityBadge(),this.onDidChangeConflicts(this.userDataSyncService.conflicts),this._register(U.any(U.debounce(t.onDidChangeStatus,()=>{},500),this.userDataSyncEnablementService.onDidChangeEnablement,this.userDataSyncWorkbenchService.onDidChangeAccountStatus)(()=>{this.updateAccountBadge(),this.updateGlobalActivityBadge()})),this._register(t.onDidChangeConflicts(()=>this.onDidChangeConflicts(this.userDataSyncService.conflicts))),this._register(e.onDidChangeEnablement(()=>this.onDidChangeConflicts(this.userDataSyncService.conflicts))),this._register(t.onSyncErrors(H=>this.onSynchronizerErrors(H))),this._register(f.onError(H=>this.onAutoSyncError(H))),this.registerActions(),this.registerViews(),v.registerTextModelContentProvider(gx,h.createInstance(Ydt)),this._register(U.any(t.onDidChangeStatus,e.onDidChangeEnablement)(()=>this.turningOnSync=!e.isEnabled()&&t.status!=="idle")))}get turningOnSync(){return!!this.turningOnSyncContext.get()}set turningOnSync(e){this.turningOnSyncContext.set(e),this.updateGlobalActivityBadge()}toKey({syncResource:e,profile:t}){return`${t.id}:${e}`}onDidChangeConflicts(e){if(this.updateGlobalActivityBadge(),this.registerShowConflictsAction(),!!this.userDataSyncEnablementService.isEnabled())if(e.length){for(let[t,o]of this.conflictsDisposables.entries())e.some(n=>this.toKey(n)===t)||(o.dispose(),this.conflictsDisposables.delete(t));for(let t of this.userDataSyncService.conflicts){let o=this.toKey(t);if(!this.conflictsDisposables.has(o)){let n=Kv(t.syncResource),r=this.notificationService.prompt(ft.Warning,d(16477,null,n.toLowerCase()),[{label:d(16493,null),run:()=>{this.acceptLocal(t,t.conflicts[0])}},{label:d(16492,null),run:()=>{this.acceptRemote(t,t.conflicts[0])}},{label:d(16501,null),run:()=>{this.telemetryService.publicLog2("sync/showConflicts",{source:t.syncResource}),this.userDataSyncWorkbenchService.showConflicts(t.conflicts[0])}}],{sticky:!0});this.conflictsDisposables.set(o,Z(()=>{r.close(),this.conflictsDisposables.delete(o)}))}}}else this.conflictsDisposables.forEach(t=>t.dispose()),this.conflictsDisposables.clear()}async acceptRemote(e,t){try{await this.userDataSyncService.accept(e,t.remoteResource,void 0,this.userDataSyncEnablementService.isEnabled())}catch{this.notificationService.error(d(16468,null,`command:${B0}`))}}async acceptLocal(e,t){try{await this.userDataSyncService.accept(e,t.localResource,void 0,this.userDataSyncEnablementService.isEnabled())}catch{this.notificationService.error(d(16468,null,`command:${B0}`))}}onAutoSyncError(e){switch(e.code){case"SessionExpired":this.notificationService.notify({severity:ft.Info,message:d(16500,null),actions:{primary:[ii({id:"turn on sync",label:d(16530,null),run:()=>this.turnOn()})]}});break;case"TurnedOff":this.notificationService.notify({severity:ft.Info,message:d(16531,null),actions:{primary:[ii({id:"turn on sync",label:d(16530,null),run:()=>this.turnOn()})]}});break;case"TooLarge":if(e.resource==="keybindings"||e.resource==="settings"||e.resource==="tasks"){this.disableSync(e.resource);let t=Kv(e.resource);this.handleTooLargeError(e.resource,d(16520,null,t.toLowerCase(),t.toLowerCase(),"100kb"),e)}break;case"LocalTooManyProfiles":this.disableSync("profiles"),this.notificationService.error(d(16522,null));break;case"IncompatibleLocalContent":case"Gone":case"UpgradeRequired":{let t=d(16482,null,this.productService.version,this.productService.commit),o=e.operationId?d(16491,null,e.operationId):void 0;this.notificationService.notify({severity:ft.Error,message:o?`${t} ${o}`:t});break}case"MethodNotFound":{let t=d(16488,null),o=e.operationId?d(16491,null,e.operationId):void 0;this.notificationService.notify({severity:ft.Error,message:o?`${t} ${o}`:t,actions:{primary:[ii({id:"Show Sync Logs",label:d(16504,null),run:()=>this.commandService.executeCommand(B0)}),ii({id:"Report Issue",label:d(16494,null),run:()=>this.workbenchIssueService.openReporter()})]}});break}case"IncompatibleRemoteContent":this.notificationService.notify({severity:ft.Error,message:d(16480,null),actions:{primary:[ii({id:"reset",label:d(16495,null),run:()=>this.userDataSyncWorkbenchService.resetSyncedData()}),ii({id:"show synced data",label:d(16506,null),run:()=>this.userDataSyncWorkbenchService.showSyncActivity()})]}});return;case"ServiceChanged":this.notificationService.notify({severity:ft.Info,message:this.userDataSyncStoreManagementService.userDataSyncStore?.type==="insiders"?d(16498,null):d(16499,null)});return;case"DefaultServiceChanged":this.userDataSyncEnablementService.isEnabled()?this.notificationService.notify({severity:ft.Info,message:d(16534,null)}):this.notificationService.notify({severity:ft.Info,message:d(16497,null,this.productService.nameLong),actions:{primary:[ii({id:"turn on sync",label:d(16530,null),run:()=>this.turnOn()})]}});return}}handleTooLargeError(e,t,o){let n=o.operationId?d(16491,null,o.operationId):void 0;this.notificationService.notify({severity:ft.Error,message:n?`${t} ${n}`:t,actions:{primary:[ii({id:"open sync file",label:d(16490,null,Kv(e)),run:()=>e==="settings"?this.preferencesService.openUserSettings({jsonEditor:!0}):this.preferencesService.openGlobalKeybindingSettings(!0)})]}})}onSynchronizerErrors(e){if(e.length)for(let{profile:t,syncResource:o,error:n}of e)if(n.code==="LocalInvalidContent")this.handleInvalidContentError({profile:t,syncResource:o});else{let r=`${t.id}:${o}`,s=this.invalidContentErrorDisposables.get(r);s&&(s.dispose(),this.invalidContentErrorDisposables.delete(r))}else this.invalidContentErrorDisposables.forEach(t=>t.dispose()),this.invalidContentErrorDisposables.clear()}handleInvalidContentError({profile:e,syncResource:t}){if(this.userDataProfileService.currentProfile.id!==e.id)return;let o=`${e.id}:${t}`;if(this.invalidContentErrorDisposables.has(o)||t!=="settings"&&t!=="keybindings"&&t!=="tasks"||!this.hostService.hasFocus)return;let n=t==="settings"?this.userDataProfileService.currentProfile.settingsResource:t==="keybindings"?this.userDataProfileService.currentProfile.keybindingsResource:this.userDataProfileService.currentProfile.tasksResource,r=po.getCanonicalUri(this.editorService.activeEditor,{supportSideBySide:1});if(Qe(n,r))return;let s=Kv(t),l=this.notificationService.notify({severity:ft.Error,message:d(16484,null,s.toLowerCase()),actions:{primary:[ii({id:"open sync file",label:d(16490,null,s),run:()=>t==="settings"?this.preferencesService.openUserSettings({jsonEditor:!0}):this.preferencesService.openGlobalKeybindingSettings(!0)})]}});this.invalidContentErrorDisposables.set(o,Z(()=>{l.close(),this.invalidContentErrorDisposables.delete(o)}))}getConflictsCount(){return this.userDataSyncService.conflicts.reduce((e,{conflicts:t})=>e+t.length,0)}async updateGlobalActivityBadge(){this.globalActivityBadgeDisposable.clear();let e;this.userDataSyncService.conflicts.length&&this.userDataSyncEnablementService.isEnabled()?e=new Rd(this.getConflictsCount(),()=>d(16486,null,Mh.value)):this.turningOnSync&&(e=new sx(()=>d(16533,null))),e&&(this.globalActivityBadgeDisposable.value=this.activityService.showGlobalActivity({badge:e}))}async updateAccountBadge(){this.accountBadgeDisposable.clear();let e;this.userDataSyncService.status!=="uninitialized"&&this.userDataSyncEnablementService.isEnabled()&&this.userDataSyncWorkbenchService.accountStatus==="unavailable"&&(e=new Rd(1,()=>d(16510,null))),e&&(this.accountBadgeDisposable.value=this.activityService.showAccountsActivity({badge:e}))}async turnOn(){try{if(!this.userDataSyncWorkbenchService.authenticationProviders.length)throw new Error(d(16489,null));if(!await this.askToConfigure())return;this.userDataSyncStoreManagementService.userDataSyncStore?.canSwitch&&await this.selectSettingsSyncService(this.userDataSyncStoreManagementService.userDataSyncStore),await this.userDataSyncWorkbenchService.turnOn()}catch(e){if(ao(e))return;if(e instanceof Vg){switch(e.code){case"TooLarge":if(e.resource==="keybindings"||e.resource==="settings"||e.resource==="tasks"){this.handleTooLargeError(e.resource,d(16521,null,Kv(e.resource).toLowerCase(),"100kb"),e);return}break;case"IncompatibleLocalContent":case"Gone":case"UpgradeRequired":{let t=d(16483,null,this.productService.version,this.productService.commit),o=e.operationId?d(16491,null,e.operationId):void 0;this.notificationService.notify({severity:ft.Error,message:o?`${t} ${o}`:t});return}case"IncompatibleRemoteContent":this.notificationService.notify({severity:ft.Error,message:d(16481,null),actions:{primary:[ii({id:"reset",label:d(16495,null),run:()=>this.userDataSyncWorkbenchService.resetSyncedData()}),ii({id:"show synced data",label:d(16506,null),run:()=>this.userDataSyncWorkbenchService.showSyncActivity()})]}});return;case"Unauthorized":case"Forbidden":this.notificationService.error(d(16469,null));return}this.notificationService.error(d(16529,null,`command:${B0}`))}else this.notificationService.error(d(16528,null,Pn(e)))}}async askToConfigure(){return new Promise((e,t)=>{let o=new N,n=this.quickInputService.createQuickPick();o.add(n),n.title=Mh.value,n.ok=!1,n.customButton=!0,n.customLabel=d(16508,null),n.description=d(16473,null),n.canSelectMany=!0,n.ignoreFocusOut=!0,n.hideInput=!0,n.hideCheckAll=!0;let r=this.getConfigureSyncQuickPickItems();n.items=r,n.selectedItems=r.filter(l=>this.userDataSyncEnablementService.isResourceEnabled(l.id,!0));let s=!1;o.add(U.any(n.onDidAccept,n.onDidCustom)(()=>{s=!0,n.hide()})),o.add(n.onDidHide(()=>{try{s&&this.updateConfiguration(r,n.selectedItems),e(s)}catch(l){t(l)}finally{o.dispose()}})),n.show()})}getConfigureSyncQuickPickItems(){return[{id:"settings",label:Kv("settings")},{id:"keybindings",label:Kv("keybindings")},{id:"snippets",label:Kv("snippets")},{id:"tasks",label:Kv("tasks")},{id:"mcp",label:Kv("mcp")},{id:"globalState",label:Kv("globalState")},{id:"extensions",label:Kv("extensions")},{id:"profiles",label:Kv("profiles")},{id:"prompts",label:Kv("prompts")}]}updateConfiguration(e,t){for(let o of e){let n=this.userDataSyncEnablementService.isResourceEnabled(o.id),r=!!t.filter(s=>s.id===o.id)[0];n!==r&&this.userDataSyncEnablementService.setResourceEnablement(o.id,r)}}async configureSyncOptions(){return new Promise((e,t)=>{let o=new N,n=this.quickInputService.createQuickPick();o.add(n),n.title=d(16476,null,Mh.value),n.placeholder=d(16475,null),n.canSelectMany=!0,n.ignoreFocusOut=!0,n.ok=!0;let r=this.getConfigureSyncQuickPickItems();n.items=r,n.selectedItems=r.filter(s=>this.userDataSyncEnablementService.isResourceEnabled(s.id)),o.add(n.onDidAccept(async()=>{n.selectedItems.length&&(this.updateConfiguration(r,n.selectedItems),n.hide())})),o.add(n.onDidHide(()=>{o.dispose(),e()})),n.show()})}async turnOff(){let e=await this.dialogService.confirm({message:d(16525,null),detail:d(16526,null),primaryButton:d(16523,null),checkbox:this.userDataSyncWorkbenchService.accountStatus==="available"?{label:d(16527,null)}:void 0});if(e.confirmed)return this.userDataSyncWorkbenchService.turnoff(!!e.checkboxChecked)}disableSync(e){switch(e){case"settings":return this.userDataSyncEnablementService.setResourceEnablement("settings",!1);case"keybindings":return this.userDataSyncEnablementService.setResourceEnablement("keybindings",!1);case"snippets":return this.userDataSyncEnablementService.setResourceEnablement("snippets",!1);case"tasks":return this.userDataSyncEnablementService.setResourceEnablement("tasks",!1);case"extensions":return this.userDataSyncEnablementService.setResourceEnablement("extensions",!1);case"globalState":return this.userDataSyncEnablementService.setResourceEnablement("globalState",!1);case"profiles":return this.userDataSyncEnablementService.setResourceEnablement("profiles",!1)}}showSyncActivity(){return this.outputService.showChannel(yme)}async selectSettingsSyncService(e){return new Promise((t,o)=>{let n=new N,r=n.add(this.quickInputService.createQuickPick());r.title=d(16514,null,Mh.value),r.description=d(16513,null),r.hideInput=!0,r.ignoreFocusOut=!0;let s=l=>{if(Qe(l,e.defaultUrl))return d(16478,null)};r.items=[{id:"insiders",label:d(16487,null),description:s(e.insidersUrl)},{id:"stable",label:d(16511,null),description:s(e.stableUrl)}],n.add(r.onDidAccept(async()=>{try{await this.userDataSyncStoreManagementService.switch(r.selectedItems[0].id),t()}catch(l){o(l)}finally{r.hide()}})),n.add(r.onDidHide(()=>n.dispose())),r.show()})}registerActions(){this.userDataSyncEnablementService.canToggleEnablement()&&(this.registerTurnOnSyncAction(),this.registerTurnOffSyncAction()),this.registerTurningOnSyncAction(),this.registerCancelTurnOnSyncAction(),this.registerSignInAction(),this.registerShowConflictsAction(),this.registerEnableSyncViewsAction(),this.registerManageSyncAction(),this.registerSyncNowAction(),this.registerConfigureSyncAction(),this.registerShowSettingsAction(),this.registerHelpAction(),this.registerShowLogAction(),this.registerResetSyncDataAction(),this.registerAcceptMergesAction(),Wt&&this.registerDownloadSyncActivityAction()}registerTurnOnSyncAction(){let e=this,t=C.and(Ly.notEqualsTo("uninitialized"),HD.toNegated(),R6t.negate());this._register(W(class extends K{constructor(){super({id:"workbench.userDataSync.actions.turnOn",title:L(16485,"Backup and Sync Settings..."),category:Mh,f1:!0,precondition:t,menu:[{group:"3_configuration",id:D.GlobalActivity,when:t,order:2},{group:"3_configuration",id:D.MenubarPreferencesMenu,when:t,order:2},{group:"1_settings",id:D.AccountsContext,when:t,order:2}]})}async run(){return e.turnOn()}}))}registerTurningOnSyncAction(){let e=C.and(Ly.notEqualsTo("uninitialized"),HD.toNegated(),R6t);this._register(W(class extends K{constructor(){super({id:"workbench.userData.actions.turningOn",title:d(16532,null),precondition:C.false(),menu:[{group:"3_configuration",id:D.GlobalActivity,when:e,order:2},{group:"1_settings",id:D.AccountsContext,when:e}]})}async run(){}}))}registerCancelTurnOnSyncAction(){let e=this;this._register(W(class extends K{constructor(){super({id:"workbench.userData.actions.cancelTurnOn",title:d(16470,null),icon:R.stopCircle,menu:{id:D.ViewContainerTitle,when:C.and(R6t,C.equals("viewContainer",RH)),group:"navigation",order:1}})}async run(){return e.userDataSyncWorkbenchService.turnoff(!1)}}))}registerSignInAction(){let e=this,t="workbench.userData.actions.signin",o=C.and(Ly.notEqualsTo("uninitialized"),HD,LH.isEqualTo("unavailable"));this._register(W(class extends K{constructor(){super({id:"workbench.userData.actions.signin",title:d(16509,null),menu:{group:"3_configuration",id:D.GlobalActivity,when:o,order:2}})}async run(){try{await e.userDataSyncWorkbenchService.signIn()}catch(r){e.notificationService.error(r)}}})),this._register(ve.appendMenuItem(D.AccountsContext,{group:"1_settings",command:{id:t,title:d(16507,null)},when:o}))}getShowConflictsTitle(){return L(16496,"Show Conflicts ({0})",this.getConflictsCount())}registerShowConflictsAction(){this.conflictsActionDisposable.value=void 0;let e=this;this.conflictsActionDisposable.value=W(class extends K{constructor(){super({id:AMo,get title(){return e.getShowConflictsTitle()},category:Mh,f1:!0,precondition:Lee,menu:[{group:"3_configuration",id:D.GlobalActivity,when:Lee,order:2},{group:"3_configuration",id:D.MenubarPreferencesMenu,when:Lee,order:2}]})}async run(){return e.userDataSyncWorkbenchService.showConflicts()}})}registerManageSyncAction(){let e=this,t=C.and(HD,LH.notEqualsTo("unavailable"),Ly.notEqualsTo("uninitialized"));this._register(W(class extends K{constructor(){super({id:"workbench.userDataSync.actions.manage",title:d(16515,null),toggled:KI.INSTANCE,menu:[{id:D.GlobalActivity,group:"3_configuration",when:t,order:2},{id:D.MenubarPreferencesMenu,group:"3_configuration",when:t,order:2},{id:D.AccountsContext,group:"1_settings",when:t}]})}run(n){return new Promise((r,s)=>{let l=n.get(Ue),c=n.get(ge),u=new N,p=l.createQuickPick({useSeparators:!0});u.add(p);let h=[];if(e.userDataSyncService.conflicts.length&&(h.push({id:AMo,label:`${Mh.value}: ${e.getShowConflictsTitle().original}`}),h.push({type:"separator"})),h.push({id:_6t.id,label:`${Mh.value}: ${_6t.title.original}`}),h.push({id:D6t.id,label:`${Mh.value}: ${D6t.title.original}`}),h.push({id:L6t.id,label:`${Mh.value}: ${L6t.title.original}`}),h.push({type:"separator"}),h.push({id:Qdt.id,label:`${Mh.value}: ${Qdt.title.original}`,description:Qdt.description(e.userDataSyncService)}),e.userDataSyncEnablementService.canToggleEnablement()){let g=e.userDataSyncWorkbenchService.current;h.push({id:T6t.id,label:`${Mh.value}: ${T6t.title.original}`,description:g?`${g.accountName} (${e.authenticationService.getProvider(g.authenticationProviderId).label})`:void 0})}p.items=h,u.add(p.onDidAccept(()=>{p.selectedItems[0]&&p.selectedItems[0].id&&c.executeCommand(p.selectedItems[0].id),p.hide()})),u.add(p.onDidHide(()=>{u.dispose(),r()})),p.show()})}}))}registerEnableSyncViewsAction(){let e=this,t=C.and(LH.isEqualTo("available"),Ly.notEqualsTo("uninitialized"));this._register(W(class extends K{constructor(){super({id:L6t.id,title:L6t.title,category:Mh,precondition:t,menu:{id:D.CommandPalette,when:t}})}run(n){return e.userDataSyncWorkbenchService.showSyncActivity()}}))}registerSyncNowAction(){let e=this;this._register(W(class extends K{constructor(){super({id:Qdt.id,title:Qdt.title,category:Mh,menu:{id:D.CommandPalette,when:C.and(HD,LH.isEqualTo("available"),Ly.notEqualsTo("uninitialized"))}})}run(o){return e.userDataSyncWorkbenchService.syncNow()}}))}registerTurnOffSyncAction(){let e=this;this._register(W(class extends K{constructor(){super({id:T6t.id,title:T6t.title,category:Mh,menu:{id:D.CommandPalette,when:C.and(Ly.notEqualsTo("uninitialized"),HD)}})}async run(){try{await e.turnOff()}catch(o){ao(o)||e.notificationService.error(d(16524,null,`command:${B0}`))}}}))}registerConfigureSyncAction(){let e=this,t=C.and(Ly.notEqualsTo("uninitialized"),HD);this._register(W(class extends K{constructor(){super({id:_6t.id,title:_6t.title,category:Mh,icon:R.settingsGear,tooltip:d(16472,null),menu:[{id:D.CommandPalette,when:t},{id:D.ViewContainerTitle,when:C.and(HD,C.equals("viewContainer",RH)),group:"navigation",order:2}]})}run(){return e.configureSyncOptions()}}))}registerShowLogAction(){let e=this;this._register(W(class extends K{constructor(){super({id:B0,title:d(16502,null,Mh.value),tooltip:d(16503,null),icon:R.output,menu:[{id:D.CommandPalette,when:C.and(Ly.notEqualsTo("uninitialized"))},{id:D.ViewContainerTitle,when:C.equals("viewContainer",RH),group:"navigation",order:1}]})}run(){return e.showSyncActivity()}}))}registerShowSettingsAction(){this._register(W(class extends K{constructor(){super({id:D6t.id,title:D6t.title,category:Mh,menu:{id:D.CommandPalette,when:C.and(Ly.notEqualsTo("uninitialized"))}})}run(t){t.get(Go).openUserSettings({jsonEditor:!1,query:"@tag:sync"})}}))}registerHelpAction(){let e=this;this._register(W(class extends K{constructor(){super({id:"workbench.userDataSync.actions.help",title:Mh,category:Ve.Help,menu:[{id:D.CommandPalette,when:C.and(Ly.notEqualsTo("uninitialized"))}]})}run(){return e.openerService.open(A.parse("https://aka.ms/vscode-settings-sync-help"))}})),ve.appendMenuItem(D.ViewContainerTitle,{command:{id:"workbench.userDataSync.actions.help",title:Ve.Help.value},when:C.equals("viewContainer",RH),group:"1_help"})}registerAcceptMergesAction(){let e=this;this._register(W(class extends K{constructor(){super({id:"workbench.userDataSync.actions.acceptMerges",title:d(16471,null),menu:[{id:D.EditorContent,when:C.and(ZRt,C.regex(tMt.key,new RegExp(`^${gx}:`)))}]})}async run(o,n){let r=o.get(Uo);await r.save(n);let s=await r.read(n);await e.userDataSyncService.accept(this.getSyncResource(n),n,s.value,!0)}getSyncResource(o){let n=e.userDataSyncService.conflicts.find(({conflicts:r})=>r.some(s=>Qe(s.previewResource,o)));if(n)return n;throw new Error(`Unknown resource: ${o.toString()}`)}}))}registerDownloadSyncActivityAction(){this._register(W(class extends K{constructor(){super(CBt)}async run(t){let o=t.get(SI),n=t.get(Ne);await o.downloadSyncActivity()&&n.info(d(16479,null))}}))}registerViews(){let e=this.registerViewContainer();this.registerDataViews(e)}registerViewContainer(){return ne.as(Mn.ViewContainersRegistry).registerViewContainer({id:RH,title:Mh,ctorDescriptor:new Ft(Dc,[RH,{mergeViewWithContainerWhenSingleView:!0}]),icon:buo,hideIfEmpty:!0},0)}registerResetSyncDataAction(){let e=this;this._register(W(class extends K{constructor(){super({id:"workbench.actions.syncData.reset",title:d(16535,null),menu:[{id:D.ViewContainerTitle,when:C.equals("viewContainer",RH),group:"0_configure"}]})}run(){return e.userDataSyncWorkbenchService.resetSyncedData()}}))}registerDataViews(e){this._register(this.instantiationService.createInstance(AKe,e))}};NKe=I([m(0,Fl),m(1,bI),m(2,SI),m(3,X),m(4,Sl),m(5,Ne),m(6,ee),m(7,ln),m(8,at),m(9,Ue),m(10,F),m(11,kl),m(12,PT),m(13,Bt),m(14,Go),m(15,Te),m(16,tt),m(17,Je),m(18,xs),m(19,pM),m(20,Zt),m(21,ge),m(22,OT)],NKe);var Ydt=class{constructor(i,e,t){this.userDataSyncService=i;this.modelService=e;this.languageService=t}provideTextContent(i){return i.scheme===gx?this.userDataSyncService.resolveContent(i).then(e=>this.modelService.createModel(e||"",this.languageService.createById("jsonc"),i)):null}};Ydt=I([m(0,bI),m(1,Tt),m(2,_t)],Ydt);var OKe=class extends x{constructor(e,t,o,n,r){super();this.userDataProfilesService=t;let s=U.filter(U.any(U.map(e.onDidActiveEditorChange,()=>this.getUserDataEditorInputSource(e.activeEditor)),U.map(U.filter(o.onDidChangeViewContainerVisibility,l=>l.id===pg&&l.visible),l=>l.id)),l=>l!==void 0);Wt?this._register(U.debounce(U.any(U.map(r.onDidChangeFocus,()=>"windowFocus"),U.map(s,l=>l)),(l,c)=>l?[...l,c]:[c],1e3)(l=>n.triggerSync(l,{skipIfSyncedRecently:!0}))):this._register(s(l=>n.triggerSync([l],{skipIfSyncedRecently:!0})))}getUserDataEditorInputSource(e){if(!e)return;if(e instanceof VD)return"settingsEditor";if(e instanceof WD)return"keybindingsEditor";let t=e.resource;if(Qe(t,this.userDataProfilesService.defaultProfile.settingsResource))return"settingsEditor";if(Qe(t,this.userDataProfilesService.defaultProfile.keybindingsResource))return"keybindingsEditor"}};OKe=I([m(0,ee),m(1,an),m(2,$t),m(3,PT),m(4,Zt)],OKe);var Xdt=class extends x{constructor(e,t,o,n,r){super();this.notificationService=t;this.productService=o;this.commandService=n;this.hostService=r;this._register(e.onError(s=>this.onAutoSyncError(s)))}onAutoSyncError(e){switch(e.code){case"LocalTooManyRequests":{let t=Wt?d(16536,null,this.productService.nameLong):d(16537,null,this.productService.nameLong);this.notificationService.notify({severity:ft.Error,message:t,actions:{primary:[ii({id:"Show Sync Logs",label:d(16543,null),run:()=>this.commandService.executeCommand(B0)}),ii({id:"Restart",label:Wt?d(16539,null):d(16540,null),run:()=>this.hostService.restart()})]}});return}case"RemoteTooManyRequests":{let t=e.operationId?d(16538,null,e.operationId):void 0,o=d(16541,null);this.notificationService.notify({severity:ft.Error,message:t?`${o} ${t}`:o,source:e.operationId?d(16542,null,e.operationId):void 0,actions:{primary:[ii({id:"Show Sync Logs",label:d(16543,null),run:()=>this.commandService.executeCommand(B0)})]}});return}}}};Xdt=I([m(0,PT),m(1,Ne),m(2,tt),m(3,ge),m(4,Zt)],Xdt);var HUi=ne.as(Qi.Workbench);HUi.registerWorkbenchContribution(NKe,3);HUi.registerWorkbenchContribution(OKe,4);HUi.registerWorkbenchContribution(Xdt,4);var xSn=/^([^@:]+@)?([^:]+):/,kSn=/^([^@:]+@)?([^:]+):(.+)$/,ESn=/^([^@]+@)?([^:]+)(:\d+)?$/,TSn=/([^@:.]+\.[^@:.]+)(:\d+)?$/,FMo=/^\s*url\s*=\s*(.+\S)\s*$/mg,_Sn=/[^.]/g,WMo=["github.com","bitbucket.org","visualstudio.com","gitlab.com","heroku.com","azurewebsites.net","ibm.com","amazon.com","amazonaws.com","cloudapp.net","rhcloud.com","google.com","azure.com"];function NMo(a){let i=a.match(TSn);return i?i[1]:null}function DSn(a){if(a.indexOf("://")===-1){let i=a.match(xSn);return i?NMo(i[2]):null}try{let i=A.parse(a);if(i.authority)return NMo(i.authority)}catch{}return null}function VMo(a,i){let e=new Set,t;for(;t=FMo.exec(a);){let n=DSn(t[1]);n&&e.add(n)}let o=new Set(i);return Array.from(e).map(n=>o.has(n)?n:n.replace(_Sn,"a"))}function LSn(a){let i=a.match(ESn);return i?i[2]:null}function OMo(a,i,e){return a&&i?(e&&i.endsWith(".git")&&(i=i.substr(0,i.length-4)),i.indexOf("/")===0?`${a}${i}`:`${a}/${i}`):null}function RSn(a,i){if(a.indexOf("://")===-1){let e=a.match(kSn);if(e)return OMo(e[2],e[3],i)}try{let e=A.parse(a);if(e.authority)return OMo(LSn(e.authority),e.path,i)}catch{}return null}function BMo(a,i=!1){let e=[],t;for(;t=FMo.exec(a);){let o=RSn(t[1],i);o&&e.push(o)}return e}var FKe=le("workspaceTagsService");async function HMo(a,i=!1,e){return Promise.all(BMo(a,i).map(t=>e(t)))}var M6t=class{constructor(i,e,t){this.userDataProfileService=i;this.fileService=e;this.logService=t}async initialize(i){let e=JSON.parse(i);if(!e.mcp){this.logService.info("Initializing Profile: No MCP servers to apply...");return}await this.fileService.writeFile(this.userDataProfileService.currentProfile.mcpResource,qe.fromString(e.mcp))}};M6t=I([m(0,ln),m(1,fe),m(2,se)],M6t);var Nre=class{constructor(i,e){this.fileService=i;this.logService=e}async getContent(i){let e=await this.getMcpResourceContent(i);return JSON.stringify(e)}async getMcpResourceContent(i){return{mcp:await this.getMcpContent(i)}}async apply(i,e){let t=JSON.parse(i);if(!t.mcp){this.logService.info(`Importing Profile (${e.name}): No MCP servers to apply...`);return}await this.fileService.writeFile(e.mcpResource,qe.fromString(t.mcp))}async getMcpContent(i){try{return(await this.fileService.readFile(i.mcpResource)).value.toString()}catch(e){if(e instanceof ta&&e.fileOperationResult===1)return null;throw e}}};Nre=I([m(0,fe),m(1,se)],Nre);var WKe=class{constructor(i,e,t){this.profile=i;this.uriIdentityService=e;this.instantiationService=t;this.type="mcp";this.handle="mcp";this.label={label:d(18221,null)};this.collapsibleState=2}async getChildren(){return[{handle:this.profile.mcpResource.toString(),resourceUri:this.profile.mcpResource,collapsibleState:0,parent:this,accessibilityInformation:{label:this.uriIdentityService.extUri.basename(this.profile.mcpResource)},command:{id:vg,title:"",arguments:[this.profile.mcpResource,void 0,void 0]}}]}async hasContent(){return(await this.instantiationService.createInstance(Nre).getMcpResourceContent(this.profile)).mcp!==null}async getContent(){return this.instantiationService.createInstance(Nre).getContent(this.profile)}isFromDefaultProfile(){return!this.profile.isDefault&&!!this.profile.useDefaultFlags?.mcp}};WKe=I([m(1,ht),m(2,F)],WKe);function zUi(a){return a.resourceType!==void 0}function UMo(a){return a.label!==void 0}var UN=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super();this.userDataProfileManagementService=s;this.userDataProfilesService=l;this.commandService=c;this.workspaceContextService=u;this.hostService=p;this.uriIdentityService=h;this.fileService=g;this.extensionManagementService=f;this.instantiationService=v;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this.saveScheduler=this._register(new Dt(()=>this.doSave(),500));this._name="";this._active=!1;this._disabled=!1;this._name=e,this._icon=t,this._flags=o,this._workspaces=n,this._active=r,this._register(this.onDidChange(b=>{b.message||this.validate(),this.save()})),this._register(this.extensionManagementService.onProfileAwareDidInstallExtensions(b=>{let S=this.getProfileToWatch();S&&b.some(y=>!y.error&&(y.applicationScoped||this.uriIdentityService.extUri.isEqual(y.profileLocation,S.extensionsResource)))&&this._onDidChange.fire({extensions:!0})})),this._register(this.extensionManagementService.onProfileAwareDidUninstallExtension(b=>{let S=this.getProfileToWatch();S&&!b.error&&(b.applicationScoped||this.uriIdentityService.extUri.isEqual(b.profileLocation,S.extensionsResource))&&this._onDidChange.fire({extensions:!0})})),this._register(this.extensionManagementService.onProfileAwareDidUpdateExtensionMetadata(b=>{let S=this.getProfileToWatch();(S&&b.local.isApplicationScoped||this.uriIdentityService.extUri.isEqual(b.profileLocation,S?.extensionsResource))&&this._onDidChange.fire({extensions:!0})}))}get name(){return this._name}set name(e){e=e.trim(),this._name!==e&&(this._name=e,this._onDidChange.fire({name:!0}))}get icon(){return this._icon}set icon(e){this._icon!==e&&(this._icon=e,this._onDidChange.fire({icon:!0}))}get workspaces(){return this._workspaces}set workspaces(e){$i(this._workspaces,e,(t,o)=>t.toString()===o.toString())||(this._workspaces=e,this._onDidChange.fire({workspaces:!0}))}get flags(){return this._flags}set flags(e){eo(this._flags,e)||(this._flags=e,this._onDidChange.fire({flags:!0}))}get active(){return this._active}set active(e){this._active!==e&&(this._active=e,this._onDidChange.fire({active:!0}))}get message(){return this._message}set message(e){this._message!==e&&(this._message=e,this._onDidChange.fire({message:!0}))}get disabled(){return this._disabled}set disabled(e){this._disabled!==e&&(this._disabled=e,this._onDidChange.fire({disabled:!0}))}getFlag(e){return this.flags?.[e]??!1}setFlag(e,t){let o=this.flags?{...this.flags}:{};t?o[e]=!0:delete o[e],this.flags=o}validate(){if(!this.name){this.message=d(16460,null);return}if(this.shouldValidateName()&&this.name!==this.getInitialName()&&this.userDataProfilesService.profiles.some(e=>e.name===this.name)){this.message=d(16465,null,this.name);return}if(this.flags&&this.flags.settings&&this.flags.keybindings&&this.flags.tasks&&this.flags.snippets&&this.flags.extensions){this.message=d(16459,null);return}this.message=void 0}async getChildren(e){if(e===void 0){let t=["settings","keybindings","tasks","mcp","snippets","extensions"];return Promise.all(t.map(async o=>{let n=o==="settings"||o==="keybindings"||o==="tasks"||o==="mcp"?await this.getChildrenForResourceType(o):[];return{handle:o,checkbox:void 0,resourceType:o,openAction:n.length?ii({id:"_open",label:d(16462,null),class:q.asClassName(R.goToFile),run:()=>n[0]?.openAction?.run()}):void 0}}))}return this.getChildrenForResourceType(e)}async getChildrenForResourceType(e){return[]}async getChildrenFromProfile(e,t){e=this.getFlag(t)?this.userDataProfilesService.defaultProfile:e;let o=[];switch(t){case"settings":o=await this.instantiationService.createInstance(G3,e).getChildren();break;case"keybindings":o=await this.instantiationService.createInstance(q3,e).getChildren();break;case"snippets":o=await this.instantiationService.createInstance($3,e).getChildren()??[];break;case"tasks":o=await this.instantiationService.createInstance(j3,e).getChildren();break;case"mcp":o=await this.instantiationService.createInstance(WKe,e).getChildren();break;case"extensions":o=await this.instantiationService.createInstance(Q3,e).getChildren();break}return o.map(n=>this.toUserDataProfileResourceChildElement(n))}toUserDataProfileResourceChildElement(e,t,o){return{handle:e.handle,checkbox:e.checkbox,label:e.label?Ar(e.label.label)?e.label.label.value:e.label.label:"",description:Fe(e.description)?e.description:void 0,resource:A.revive(e.resourceUri),icon:e.themeIcon,openAction:ii({id:"_openChild",label:d(16462,null),class:q.asClassName(R.goToFile),run:async()=>{e.parent.type==="extensions"?await this.commandService.executeCommand("extension.open",e.handle,void 0,!0,void 0,!0):e.resourceUri&&await this.commandService.executeCommand(vg,e.resourceUri,[In],void 0)}}),actions:{primary:t,contextMenu:o}}}getInitialName(){return""}shouldValidateName(){return!0}getCurrentWorkspace(){let e=this.workspaceContextService.getWorkspace();return e.configuration??e.folders[0]?.uri}openWorkspace(e){this.uriIdentityService.extUri.extname(e)===P4e?this.hostService.openWindow([{workspaceUri:e}],{forceNewWindow:!0}):this.hostService.openWindow([{folderUri:e}],{forceNewWindow:!0})}save(){this.saveScheduler.schedule()}hasUnsavedChanges(e){return this.name!==e.name||this.icon!==e.icon||!eo(this.flags??{},e.useDefaultFlags??{})||!$i(this.workspaces??[],e.workspaces??[],(t,o)=>t.toString()===o.toString())}async saveProfile(e){if(!this.hasUnsavedChanges(e)||(this.validate(),this.message))return;let t=this.flags?this.flags.settings&&this.flags.keybindings&&this.flags.tasks&&this.flags.globalState&&this.flags.extensions?void 0:this.flags:void 0;return await this.userDataProfileManagementService.updateProfile(e,{name:this.name,icon:this.icon,useDefaultFlags:e.useDefaultFlags&&!t?{}:t,workspaces:this.workspaces})}};UN=I([m(5,vT),m(6,an),m(7,ge),m(8,Pe),m(9,Zt),m(10,ht),m(11,fe),m(12,ru),m(13,F)],UN);var wm=class extends UN{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super(e.name,e.icon,e.useDefaultFlags,e.workspaces,n.currentProfile.id===e.id,s,l,c,u,p,h,g,f,v);this._profile=e;this.titleButtons=t;this.actions=o;this.userDataProfileService=n;this.configurationService=r;this._isNewWindowProfile=!1;this._isNewWindowProfile=this.configurationService.getValue(hA)===this.profile.name,this._register(r.onDidChangeConfiguration(b=>{b.affectsConfiguration(hA)&&(this.isNewWindowProfile=this.configurationService.getValue(hA)===this.profile.name)})),this._register(this.userDataProfileService.onDidChangeCurrentProfile(()=>this.active=this.userDataProfileService.currentProfile.id===this.profile.id)),this._register(this.userDataProfilesService.onDidChangeProfiles(({updated:b})=>{let S=b.find(y=>y.id===this.profile.id);S&&(this._profile=S,this.reset(),this._onDidChange.fire({profile:!0}))})),this._register(g.watch(this.profile.snippetsHome)),this._register(g.onDidFilesChange(b=>{b.affects(this.profile.snippetsHome)&&this._onDidChange.fire({snippets:!0})}))}get profile(){return this._profile}getProfileToWatch(){return this.profile}reset(){this.name=this._profile.name,this.icon=this._profile.icon,this.flags=this._profile.useDefaultFlags,this.workspaces=this._profile.workspaces}updateWorkspaces(e,t){let o=new En(this.workspaces??[]);for(let n of e)o.add(n);for(let n of t)o.delete(n);this.workspaces=[...o.values()]}async toggleNewWindowProfile(){this._isNewWindowProfile?await this.configurationService.updateValue(hA,null):await this.configurationService.updateValue(hA,this.profile.name)}get isNewWindowProfile(){return this._isNewWindowProfile}set isNewWindowProfile(e){this._isNewWindowProfile!==e&&(this._isNewWindowProfile=e,this._onDidChange.fire({newWindowProfile:!0}))}async toggleCurrentWindowProfile(){this.userDataProfileService.currentProfile.id===this.profile.id?await this.userDataProfileManagementService.switchProfile(this.userDataProfilesService.defaultProfile):await this.userDataProfileManagementService.switchProfile(this.profile)}async doSave(){await this.saveProfile(this.profile)}async getChildrenForResourceType(e){return e==="extensions"?(await this.instantiationService.createInstance(Q3,this.profile).getChildren()).map(o=>this.toUserDataProfileResourceChildElement(o,void 0,[{id:"applyToAllProfiles",label:d(16449,null),checked:o.applicationScoped,enabled:!0,class:"",tooltip:"",run:async()=>{let r=(await this.extensionManagementService.getInstalled(void 0,this.profile.extensionsResource)).find(s=>Ut(s.identifier,o.identifier));r&&await this.extensionManagementService.toggleApplicationScope(r,this.profile.extensionsResource)}}])):this.getChildrenFromProfile(this.profile,e)}getInitialName(){return this.profile.name}};wm=I([m(3,ln),m(4,B),m(5,vT),m(6,an),m(7,ge),m(8,Pe),m(9,Zt),m(10,ht),m(11,fe),m(12,ru),m(13,F)],wm);var UUi="userdataprofiletemplatepreview",By=class extends UN{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super("",void 0,void 0,void 0,!1,r,s,l,c,u,p,h,g,f);this.titleButtons=t;this.actions=o;this.userDataProfileImportExportService=n;this._copyFromTemplates=new gt;this.template=null;this.previewProfileWatchDisposables=this._register(new N);this.name=this.defaultName=this.getNewProfileName(),this._copyFrom=e,this._copyFlags=this.getCopyFlagsFrom(e),this.initialize(),this._register(this.fileService.registerProvider(UUi,this._register(new kme))),this._register(Z(()=>{this.previewProfile&&this.userDataProfilesService.removeProfile(this.previewProfile)}))}get copyFromTemplates(){return this._copyFromTemplates}get copyFrom(){return this._copyFrom}set copyFrom(e){this._copyFrom!==e&&(this._copyFrom=e,this._onDidChange.fire({copyFrom:!0}),this.flags=void 0,this.copyFlags=this.getCopyFlagsFrom(e),e instanceof A&&(this.templatePromise?.cancel(),this.templatePromise=void 0),this.initialize())}get copyFlags(){return this._copyFlags}set copyFlags(e){eo(this._copyFlags,e)||(this._copyFlags=e,this._onDidChange.fire({copyFlags:!0}))}get previewProfile(){return this._previewProfile}set previewProfile(e){this._previewProfile!==e&&(this._previewProfile=e,this._onDidChange.fire({preview:!0}),this.previewProfileWatchDisposables.clear(),this._previewProfile&&(this.previewProfileWatchDisposables.add(this.fileService.watch(this._previewProfile.snippetsHome)),this.previewProfileWatchDisposables.add(this.fileService.onDidFilesChange(t=>{this._previewProfile&&t.affects(this._previewProfile.snippetsHome)&&this._onDidChange.fire({snippets:!0})}))))}getProfileToWatch(){return this.previewProfile}getCopyFlagsFrom(e){return e?{settings:!0,keybindings:!0,snippets:!0,tasks:!0,extensions:!0,mcp:!0}:void 0}async initialize(){this.disabled=!0;try{if(this.copyFrom instanceof A){await this.resolveTemplate(this.copyFrom),this.template&&(this.copyFromTemplates.set(this.copyFrom,this.template.name),this.defaultName===this.name&&(this.name=this.defaultName=this.template.name??""),this.defaultIcon===this.icon&&(this.icon=this.defaultIcon=this.template.icon),this.setCopyFlag("settings",!!this.template.settings),this.setCopyFlag("keybindings",!!this.template.keybindings),this.setCopyFlag("tasks",!!this.template.tasks),this.setCopyFlag("snippets",!!this.template.snippets),this.setCopyFlag("extensions",!!this.template.extensions),this.setCopyFlag("mcp",!!this.template.mcp),this._onDidChange.fire({copyFromInfo:!0}));return}if(qO(this.copyFrom)){this.defaultName===this.name&&(this.name=this.defaultName=d(16451,null,this.copyFrom.name)),this.defaultIcon===this.icon&&(this.icon=this.defaultIcon=this.copyFrom.icon),this.setCopyFlag("settings",!0),this.setCopyFlag("keybindings",!0),this.setCopyFlag("tasks",!0),this.setCopyFlag("snippets",!0),this.setCopyFlag("extensions",!0),this.setCopyFlag("mcp",!0),this._onDidChange.fire({copyFromInfo:!0});return}this.defaultName===this.name&&(this.name=this.defaultName=this.getNewProfileName()),this.defaultIcon===this.icon&&(this.icon=this.defaultIcon=void 0),this.setCopyFlag("settings",!1),this.setCopyFlag("keybindings",!1),this.setCopyFlag("tasks",!1),this.setCopyFlag("snippets",!1),this.setCopyFlag("extensions",!1),this.setCopyFlag("mcp",!1),this._onDidChange.fire({copyFromInfo:!0})}finally{this.disabled=!1}}getNewProfileName(){let e=d(16467,null),t=new RegExp(`${e}\\s(\\d+)`),o=0;for(let n of this.userDataProfilesService.profiles){let r=t.exec(n.name),s=r?parseInt(r[1]):0;o=s>o?s:o}return`${e} ${o+1}`}async resolveTemplate(e){return this.templatePromise||(this.templatePromise=Ln(async t=>{let o=await this.userDataProfileImportExportService.resolveProfileTemplate(e);t.isCancellationRequested||(this.template=o)})),await this.templatePromise,this.template}hasResource(e){if(this.template)switch(e){case"settings":return!!this.template.settings;case"keybindings":return!!this.template.keybindings;case"snippets":return!!this.template.snippets;case"tasks":return!!this.template.tasks;case"extensions":return!!this.template.extensions}return!0}getCopyFlag(e){return this.copyFlags?.[e]??!1}setCopyFlag(e,t){let o=this.copyFlags?{...this.copyFlags}:{};o[e]=t,this.copyFlags=o}getCopyFromName(){if(qO(this.copyFrom))return this.copyFrom.name;if(this.copyFrom instanceof A)return this.copyFromTemplates.get(this.copyFrom)}async getChildrenForResourceType(e){return this.getFlag(e)?this.getChildrenFromProfile(this.userDataProfilesService.defaultProfile,e):this.getCopyFlag(e)?this.previewProfile?this.getChildrenFromProfile(this.previewProfile,e):this.copyFrom instanceof A?(await this.resolveTemplate(this.copyFrom),this.template?this.getChildrenFromProfileTemplate(this.template,e):[]):this.copyFrom?this.getChildrenFromProfile(this.copyFrom,e):[]:[]}async getChildrenFromProfileTemplate(e,t){let o=A.from({scheme:UUi,path:`/root/profiles/${e.name}`}),n=A.from({scheme:UUi,path:`/root/cache/${e.name}`}),r=sce(xt(),this.name,o,n);switch(t){case"settings":return e.settings?(await this.instantiationService.createInstance(N0).apply(e.settings,r),this.getChildrenFromProfile(r,t)):[];case"keybindings":return e.keybindings?(await this.instantiationService.createInstance(O0).apply(e.keybindings,r),this.getChildrenFromProfile(r,t)):[];case"snippets":return e.snippets?(await this.instantiationService.createInstance(zA).apply(e.snippets,r),this.getChildrenFromProfile(r,t)):[];case"tasks":return e.tasks?(await this.instantiationService.createInstance(F0).apply(e.tasks,r),this.getChildrenFromProfile(r,t)):[];case"mcp":return e.mcp?(await this.instantiationService.createInstance(Nre).apply(e.mcp,r),this.getChildrenFromProfile(r,t)):[];case"extensions":return e.extensions?(await this.instantiationService.createInstance(eMe,e.extensions).getChildren()).map(l=>this.toUserDataProfileResourceChildElement(l)):[]}return[]}shouldValidateName(){return!this.copyFrom}getInitialName(){return this.previewProfile?.name??""}async doSave(){if(this.previewProfile){let e=await this.saveProfile(this.previewProfile);e&&(this.previewProfile=e)}}};By=I([m(3,YB),m(4,vT),m(5,an),m(6,ge),m(7,Pe),m(8,Zt),m(9,ht),m(10,fe),m(11,ru),m(12,F)],By);var qU=class extends wh{constructor(e,t,o,n,r,s,l,c,u,p){super();this.userDataProfileService=e;this.userDataProfilesService=t;this.userDataProfileManagementService=o;this.userDataProfileImportExportService=n;this.dialogService=r;this.telemetryService=s;this.hostService=l;this.productService=c;this.openerService=u;this.instantiationService=p;this._profiles=[];this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;for(let h of t.profiles)h.isTransient||this._profiles.push(this.createProfileElement(h));this._register(Z(()=>this._profiles.splice(0,this._profiles.length).map(([,h])=>h.dispose()))),this._register(t.onDidChangeProfiles(h=>this.onDidChangeProfiles(h)))}static getInstance(e){return qU.INSTANCE||(qU.INSTANCE=e.createInstance(qU)),qU.INSTANCE}get profiles(){return this._profiles.map(([e])=>e).sort((e,t)=>e instanceof By?1:t instanceof By||e instanceof wm&&e.profile.isDefault?-1:t instanceof wm&&t.profile.isDefault?1:e.name.localeCompare(t.name))}onDidChangeProfiles(e){let t=!1;for(let o of e.added)!o.isTransient&&o.name!==this.newProfileElement?.name&&(t=!0,this._profiles.push(this.createProfileElement(o)));for(let o of e.removed){o.id===this.newProfileElement?.previewProfile?.id&&(this.newProfileElement.previewProfile=void 0);let n=this._profiles.findIndex(([r])=>r instanceof wm&&r.profile.id===o.id);n!==-1&&(t=!0,this._profiles.splice(n,1).map(([,r])=>r.dispose()))}t&&this._onDidChange.fire(void 0)}getTemplates(){return this.templates||(this.templates=this.userDataProfileManagementService.getBuiltinProfileTemplates()),this.templates}createProfileElement(e){let t=new N,o=t.add(new it("userDataProfile.activate",d(16448,null),q.asClassName(R.check),!0,()=>this.userDataProfileManagementService.switchProfile(p.profile))),n=t.add(new it("userDataProfile.copyFromProfile",d(16452,null),q.asClassName(R.copy),!0,()=>this.createNewProfile(p.profile))),r=t.add(new it("userDataProfile.export",d(16457,null),q.asClassName(R.export),!0,()=>this.userDataProfileImportExportService.exportProfile(e))),s=t.add(new it("userDataProfile.delete",d(16454,null),q.asClassName(R.trash),!0,()=>this.removeProfile(p.profile))),l=t.add(new it("userDataProfile.newWindow",d(16463,null),q.asClassName(R.emptyWindow),!0,()=>this.openWindow(p.profile))),c=[];c.push(o),c.push(l);let u=[];u.push(n),u.push(r),e.isDefault||(u.push(new ri),u.push(s));let p=t.add(this.instantiationService.createInstance(wm,e,[[],[]],[c,u]));return o.enabled=this.userDataProfileService.currentProfile.id!==p.profile.id,t.add(this.userDataProfileService.onDidChangeCurrentProfile(()=>o.enabled=this.userDataProfileService.currentProfile.id!==p.profile.id)),[p,t]}async createNewProfile(e){if(this.newProfileElement){if(!(await this.dialogService.confirm({type:"info",message:d(16461,null),primaryButton:d(16456,null),cancelButton:d(16450,null)})).confirmed)return;this.revert()}if(e instanceof A)try{await this.userDataProfileImportExportService.resolveProfileTemplate(e)}catch(t){this.dialogService.error(Pn(t));return}if(!this.newProfileElement){let t=new N,o=new Ye;t.add(Z(()=>o.dispose(!0)));let n=[],r=[],s=t.add(new it("userDataProfile.create",d(16453,null),void 0,!0,()=>this.saveNewProfile(!1,o.token)));n.push(s),Wt&&e instanceof A&&q_e(e)&&n.push(t.add(new it("userDataProfile.createInDesktop",d(16458,null,this.productService.nameLong),void 0,!0,()=>this.openerService.open(e,{openExternal:!0}))));let l=t.add(new it("userDataProfile.cancel",d(16450,null),q.asClassName(R.trash),!0,()=>this.discardNewProfile()));r.push(l);let c=t.add(new it("userDataProfile.preview",d(16464,null),q.asClassName(R.openPreview),!0,()=>this.previewNewProfile(o.token)));r.push(c);let u=t.add(new it("userDataProfile.export",d(16457,null),q.asClassName(R.export),qO(e),()=>this.exportNewProfile(o.token)));this.newProfileElement=t.add(this.instantiationService.createInstance(By,e,[n,r],[[l],[u]]));let p=()=>{s.enabled&&(this.newProfileElement?.copyFrom&&this.userDataProfilesService.profiles.some(h=>!h.isTransient&&h.name===this.newProfileElement?.name)?s.label=d(16466,null):s.label=d(16453,null))};p(),t.add(this.newProfileElement.onDidChange(h=>{(h.preview||h.disabled||h.message)&&(s.enabled=!this.newProfileElement?.disabled&&!this.newProfileElement?.message,c.enabled=!this.newProfileElement?.previewProfile&&!this.newProfileElement?.disabled&&!this.newProfileElement?.message),(h.name||h.copyFrom)&&(p(),u.enabled=qO(this.newProfileElement?.copyFrom))})),t.add(this.userDataProfilesService.onDidChangeProfiles(h=>{p(),this.newProfileElement?.validate()})),this._profiles.push([this.newProfileElement,t]),this._onDidChange.fire(this.newProfileElement)}return this.newProfileElement}revert(){this.removeNewProfile(),this._onDidChange.fire(void 0)}removeNewProfile(){if(this.newProfileElement){let e=this._profiles.findIndex(([t])=>t===this.newProfileElement);e!==-1&&this._profiles.splice(e,1).map(([,t])=>t.dispose()),this.newProfileElement=void 0}}async previewNewProfile(e){if(!this.newProfileElement||this.newProfileElement.previewProfile)return;let t=await this.saveNewProfile(!0,e);t&&(this.newProfileElement.previewProfile=t,Wt?await this.userDataProfileManagementService.switchProfile(t):await this.openWindow(t))}async exportNewProfile(e){if(!this.newProfileElement||!qO(this.newProfileElement.copyFrom))return;let t=sce(xt(),this.newProfileElement.name,this.newProfileElement.copyFrom.location,this.newProfileElement.copyFrom.cacheHome,{icon:this.newProfileElement.icon,useDefaultFlags:this.newProfileElement.flags},this.userDataProfilesService.defaultProfile);await this.userDataProfileImportExportService.exportProfile(t,this.newProfileElement.copyFlags)}async saveNewProfile(e,t){if(!this.newProfileElement||(this.newProfileElement.validate(),this.newProfileElement.message))return;this.newProfileElement.disabled=!0;let o;try{if(this.newProfileElement.previewProfile)e||(o=await this.userDataProfileManagementService.updateProfile(this.newProfileElement.previewProfile,{transient:!1}));else{let{flags:n,icon:r,name:s,copyFrom:l}=this.newProfileElement,c=n?n.settings&&n.keybindings&&n.tasks&&n.globalState&&n.extensions?void 0:n:void 0,u={source:l instanceof A?"template":qO(l)?"profile":l?"external":void 0};if(l instanceof A){let p=await this.newProfileElement.resolveTemplate(l);p&&(this.telemetryService.publicLog2("userDataProfile.createFromTemplate",u),o=await this.userDataProfileImportExportService.createProfileFromTemplate(p,{name:s,useDefaultFlags:c,icon:r,resourceTypeFlags:this.newProfileElement.copyFlags,transient:e},t??Se.None))}else qO(l)?o=await this.userDataProfileImportExportService.createFromProfile(l,{name:s,useDefaultFlags:c,icon:r,resourceTypeFlags:this.newProfileElement.copyFlags,transient:e},t??Se.None):o=await this.userDataProfileManagementService.createProfile(s,{useDefaultFlags:c,icon:r,transient:e})}}finally{this.newProfileElement&&(this.newProfileElement.disabled=!1)}if(t?.isCancellationRequested){if(o)try{await this.userDataProfileManagementService.removeProfile(o)}catch{}return}if(o&&!o.isTransient&&this.newProfileElement){this.removeNewProfile();let n=this._profiles.find(([r])=>r.name===o.name);n?this._onDidChange.fire(n[0]):this.onDidChangeProfiles({added:[o],removed:[],updated:[],all:this.userDataProfilesService.profiles})}return o}async discardNewProfile(){if(this.newProfileElement){if(this.newProfileElement.previewProfile){await this.userDataProfileManagementService.removeProfile(this.newProfileElement.previewProfile);return}this.removeNewProfile(),this._onDidChange.fire(void 0)}}async removeProfile(e){(await this.dialogService.confirm({type:"info",message:d(16455,null,e.name),primaryButton:d(16454,null),cancelButton:d(16450,null)})).confirmed&&await this.userDataProfileManagementService.removeProfile(e)}async openWindow(e){await this.hostService.openWindow({forceProfile:e.name})}};qU=I([m(0,ln),m(1,an),m(2,vT),m(3,YB),m(4,at),m(5,Te),m(6,Zt),m(7,tt),m(8,Je),m(9,F)],qU);var MSn=Ae("profiles-editor-edit-folder",R.edit,d(16400,null)),PSn=Ae("profiles-editor-remove-folder",R.close,d(16438,null)),ASn=te("profiles.sashBorder",vf,d(16437,null)),QUi=uS({listActiveSelectionBackground:Ho,listActiveSelectionForeground:To,listFocusAndSelectionBackground:Ho,listFocusAndSelectionForeground:To,listFocusBackground:Ho,listFocusForeground:To,listHoverForeground:To,listHoverBackground:Ho,listHoverOutline:Ho,listFocusOutline:Ho,listInactiveSelectionBackground:Ho,listInactiveSelectionForeground:To,listInactiveFocusBackground:Ho,listInactiveFocusOutline:Ho,treeIndentGuidesStroke:void 0,treeInactiveIndentGuidesStroke:void 0,tableOddRowsBackgroundColor:Ho}),Q6=class extends Ts{constructor(e,t,o,n,r,s,l,c){super(Q6.ID,e,t,o,n);this.quickInputService=r;this.fileDialogService=s;this.contextMenuService=l;this.instantiationService=c;this.templates=[]}static{this.ID="workbench.editor.userDataProfiles"}layout(e,t){if(this.container&&this.splitView){let o=e.height-20;this.splitView.layout(this.container?.clientWidth,o),this.splitView.el.style.height=`${o}px`}}createEditor(e){this.container=M(e,_(".profiles-editor"));let t=M(this.container,_(".sidebar-view")),o=M(t,_(".sidebar-container")),n=M(this.container,_(".contents-view")),r=M(n,_(".contents-container"));this.profileWidget=this._register(this.instantiationService.createInstance(Zdt,r)),this.splitView=new Ou(this.container,{orientation:1,proportionalLayout:!0}),this.renderSidebar(o),this.splitView.addView({onDidChange:U.None,element:t,minimumSize:200,maximumSize:350,layout:(s,l,c)=>{if(t.style.width=`${s}px`,c&&this.profilesList){let u=c-40-15;this.profilesList.getHTMLElement().style.height=`${u}px`,this.profilesList.layout(u,s)}}},300,void 0,!0),this.splitView.addView({onDidChange:U.None,element:n,minimumSize:550,maximumSize:Number.POSITIVE_INFINITY,layout:(s,l,c)=>{n.style.width=`${s}px`,c&&this.profileWidget?.layout(new si(s,c))}},Gl.Distribute,void 0,!0),this.registerListeners(),this.updateStyles()}updateStyles(){let e=this.theme.getColor(ASn);this.splitView?.style({separatorBorder:e})}renderSidebar(e){this.renderNewProfileButton(M(e,_(".new-profile-button")));let t=this.instantiationService.createInstance(Jdt),o=new KUi;this.profilesList=this._register(this.instantiationService.createInstance(Vl,"ProfilesList",M(e,_(".profiles-list")),o,[t],{multipleSelectionSupport:!1,setRowLineHeight:!1,horizontalScrolling:!1,accessibilityProvider:{getAriaLabel(n){return n?.name??""},getWidgetAriaLabel(){return d(16436,null)}},openOnSingleClick:!0,identityProvider:{getId(n){return n instanceof wm?n.profile.id:n.name}},alwaysConsumeMouseWheel:!1}))}renderNewProfileButton(e){let t=this._register(new ry(e,{actions:{getActions:()=>{let o=[];return this.templates.length&&(o.push(new Fs("from.template",d(16408,null),this.getCreateFromTemplateActions())),o.push(new ri)),o.push(ii({id:"importProfile",label:d(16419,null),run:()=>this.importProfile()})),o}},addPrimaryActionToDropdown:!1,contextMenuProvider:this.contextMenuService,supportIcons:!0,...Qo}));t.label=d(16426,null),this._register(t.onDidClick(o=>this.createNewProfile()))}getCreateFromTemplateActions(){return this.templates.map(e=>ii({id:`template:${e.url}`,label:e.name,run:()=>this.createNewProfile(A.parse(e.url))}))}registerListeners(){this.profilesList&&(this._register(this.profilesList.onDidChangeSelection(e=>{let[t]=e.elements;t instanceof UN&&this.profileWidget?.render(t)})),this._register(this.profilesList.onContextMenu(e=>{let t=[];e.element||t.push(...this.getTreeContextMenuActions()),e.element instanceof UN&&t.push(...e.element.actions[1]),t.length&&this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>t,getActionsContext:()=>e.element})})),this._register(this.profilesList.onMouseDblClick(e=>{e.element||this.createNewProfile()})))}getTreeContextMenuActions(){let e=[];e.push(ii({id:"newProfile",label:d(16426,null),run:()=>this.createNewProfile()}));let t=this.getCreateFromTemplateActions();return t.length&&e.push(new Fs("from.template",d(16425,null),t)),e.push(new ri),e.push(ii({id:"importProfile",label:d(16419,null),run:()=>this.importProfile()})),e}async importProfile(){let e=new N,t=e.add(this.quickInputService.createQuickPick()),o=n=>{let r=[];n&&r.push({label:t.value,description:d(16415,null)}),r.push({label:d(16414,null)}),t.items=r};t.title=d(16418,null),t.placeholder=d(16417,null),t.ignoreFocusOut=!0,e.add(t.onDidChangeValue(o)),o(),t.matchOnLabel=!1,t.matchOnDescription=!1,e.add(t.onDidAccept(async()=>{t.hide();let n=t.selectedItems[0];if(!n)return;let r=n.label===t.value?A.parse(t.value):await this.getProfileUriFromFileSystem();r&&this.createNewProfile(r)})),e.add(t.onDidHide(()=>e.dispose())),t.show()}async createNewProfile(e){await this.model?.createNewProfile(e)}selectProfile(e){let t=this.model?.profiles.findIndex(o=>o instanceof wm&&o.profile.id===e.id);t!==void 0&&t>=0&&this.profilesList?.setSelection([t])}async getProfileUriFromFileSystem(){let e=await this.fileDialogService.showOpenDialog({canSelectFolders:!1,canSelectFiles:!0,canSelectMany:!1,filters:_Ye,title:d(16416,null)});return e?e[0]:null}async setInput(e,t,o,n){await super.setInput(e,t,o,n),this.model=await e.resolve(),this.model.getTemplates().then(r=>{this.templates=r,this.profileWidget&&(this.profileWidget.templates=r)}),this.updateProfilesList(),this._register(this.model.onDidChange(r=>this.updateProfilesList(r)))}focus(){super.focus(),this.profilesList?.domFocus()}updateProfilesList(e){if(!this.model)return;let t=this.profilesList?.getSelection()?.[0],o=t!==void 0?this.profilesList?.element(t):void 0;if(this.profilesList?.splice(0,this.profilesList.length,this.model.profiles),e)this.profilesList?.setSelection([this.model.profiles.indexOf(e)]);else if(o){if(!this.model.profiles.includes(o)){let n=this.model.profiles.find(r=>r.name===o.name)??this.model.profiles[0];n&&this.profilesList?.setSelection([this.model.profiles.indexOf(n)])}}else{let n=this.model.profiles.find(r=>r.active)??this.model.profiles[0];n&&this.profilesList?.setSelection([this.model.profiles.indexOf(n)])}}};Q6=I([m(1,Te),m(2,Le),m(3,ce),m(4,Ue),m(5,rn),m(6,Xe),m(7,F)],Q6);var KUi=class{getHeight(i){return 22}getTemplateId(){return"profileListElement"}},Jdt=class{constructor(i){this.instantiationService=i;this.templateId="profileListElement"}renderTemplate(i){let e=new N,t=new N;i.classList.add("profile-list-item");let o=M(i,_(".profile-list-item-icon")),n=M(i,_(".profile-list-item-label")),r=M(i,_(`span${q.asCSSSelector(R.circleFilled)}`)),s=M(i,_(".profile-list-item-description"));M(s,_(`span${q.asCSSSelector(R.check)}`),_("span",void 0,d(16376,null)));let l=M(i,_(".profile-tree-item-actions-container")),c=e.add(this.instantiationService.createInstance(ol,l,{hoverDelegate:e.add(Qh()),highlightToggledItems:!0}));return{label:n,icon:o,dirty:r,description:s,actionBar:c,disposables:e,elementDisposables:t}}renderElement(i,e,t){t.elementDisposables.clear(),t.label.textContent=i.name,t.label.classList.toggle("new-profile",i instanceof By),t.icon.className=q.asClassName(i.icon?q.fromId(i.icon):O3),t.dirty.classList.toggle("hide",!(i instanceof By)),t.description.classList.toggle("hide",!i.active),t.elementDisposables.add(i.onDidChange(r=>{r.name&&(t.label.textContent=i.name),r.icon&&(i.icon?t.icon.className=q.asClassName(q.fromId(i.icon)):t.icon.className="hide"),r.active&&t.description.classList.toggle("hide",!i.active)}));let o=()=>t.actionBar.setActions(i.actions[0].filter(r=>r.enabled),i.actions[1].filter(r=>r.enabled));o();let n=[];for(let r of i.actions.flat())r instanceof it&&n.push(r.onDidChange);t.elementDisposables.add(U.any(...n)(r=>{r.enabled!==void 0&&o()}))}disposeElement(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.disposables.dispose(),i.elementDisposables.dispose()}};Jdt=I([m(0,F)],Jdt);var Zdt=class extends x{constructor(e,t,o){super();this.editorProgressService=t;this.instantiationService=o;this._profileElement=this._register(new me);this.layoutParticipants=[];let n=M(e,_(".profile-header")),r=M(n,_(".profile-title-container"));this.profileTitle=M(r,_(".profile-title")),this.builtInLabel=M(r,_(".profile-built-in-label",void 0,d(16380,null))),this.builtInLabel.classList.add("hide");let s=M(e,_(".profile-body")),l=new GUi,c=this._register(this.instantiationService.createInstance(rut)),u=this._register(this.instantiationService.createInstance(sut));this.layoutParticipants.push(u),this.copyFromProfileRenderer=this._register(this.instantiationService.createInstance(nut)),this.profileTreeContainer=M(s,_(".profile-tree")),this.profileTree=this._register(this.instantiationService.createInstance(rp,"ProfileEditor-Tree",this.profileTreeContainer,l,[this._register(this.instantiationService.createInstance(tut)),this._register(this.instantiationService.createInstance(iut)),this._register(this.instantiationService.createInstance(out)),this._register(this.instantiationService.createInstance(jUi)),this.copyFromProfileRenderer,c,u],this.instantiationService.createInstance(qUi),{multipleSelectionSupport:!1,horizontalScrolling:!1,accessibilityProvider:{getAriaLabel(p){return p?.element??""},getWidgetAriaLabel(){return""}},identityProvider:{getId(p){return p.element}},expandOnlyOnTwistieClick:!0,renderIndentGuides:"none",enableStickyScroll:!1,openOnSingleClick:!1,setRowLineHeight:!1,supportDynamicHeights:!0,alwaysConsumeMouseWheel:!1})),this.profileTree.style(QUi),this._register(c.onDidChangeContentHeight(p=>this.profileTree.updateElementHeight(p,void 0))),this._register(u.onDidChangeContentHeight(p=>this.profileTree.updateElementHeight(p,void 0))),this._register(c.onDidChangeSelection(p=>{p.selected&&(this.profileTree.setFocus([]),this.profileTree.setSelection([]))})),this._register(this.profileTree.onDidChangeContentHeight(p=>{this.dimension&&this.layout(this.dimension)})),this._register(this.profileTree.onDidChangeSelection(p=>{p.elements.length&&c.clearSelection()})),this.buttonContainer=M(s,_(".profile-row-container.profile-button-container"))}set templates(e){this.copyFromProfileRenderer.setTemplates(e),this.profileTree.rerender()}layout(e){this.dimension=e;let t=this.profileTree.contentHeight,o=Math.min(t,e.height-(this._profileElement.value?.element instanceof By?116:54));this.profileTreeContainer.style.height=`${o}px`,this.profileTree.layout(o,e.width);for(let n of this.layoutParticipants)n.layout()}render(e){if(this._profileElement.value?.element===e)return;this._profileElement.value?.element instanceof wm&&this._profileElement.value.element.reset(),this.profileTree.setInput(e);let t=new N;this._profileElement.value={element:e,dispose:()=>t.dispose()},this.profileTitle.textContent=e.name,this.builtInLabel.classList.toggle("hide",!(e instanceof wm&&e.profile.isDefault)),t.add(e.onDidChange(r=>{r.name&&(this.profileTitle.textContent=e.name)}));let[o,n]=e.titleButtons;if(o?.length||n?.length){if(this.buttonContainer.classList.remove("hide"),n?.length)for(let r of n){let s=t.add(new Wi(this.buttonContainer,{...Qo,secondary:!0}));s.label=r.label,s.enabled=r.enabled,t.add(s.onDidClick(()=>this.editorProgressService.showWhile(r.run()))),t.add(r.onDidChange(l=>{gn(l.enabled)||(s.enabled=r.enabled),gn(l.label)||(s.label=r.label)}))}if(o?.length)for(let r of o){let s=t.add(new Wi(this.buttonContainer,{...Qo}));s.label=r.label,s.enabled=r.enabled,t.add(s.onDidClick(()=>this.editorProgressService.showWhile(r.run()))),t.add(r.onDidChange(l=>{gn(l.enabled)||(s.enabled=r.enabled),gn(l.label)||(s.label=r.label)})),t.add(e.onDidChange(l=>{l.message&&(s.setTitle(e.message??r.label),s.element.classList.toggle("error",!!e.message))}))}}else this.buttonContainer.classList.add("hide");e instanceof By&&this.profileTree.focusFirst(),this.dimension&&this.layout(this.dimension)}};Zdt=I([m(1,wd),m(2,F)],Zdt);var GUi=class extends yz{getTemplateId({element:i}){return i}hasDynamicHeight({element:i}){return i==="contents"||i==="workspaces"}estimateHeight({element:i,root:e}){switch(i){case"name":return 72;case"icon":return 68;case"copyFrom":return 90;case"useForCurrent":case"useAsDefault":return 68;case"contents":return 258;case"workspaces":return(e.workspaces?e.workspaces.length*24+30:0)+112}}},qUi=class{hasChildren(i){return i instanceof UN}async getChildren(i){if(i instanceof UN){let e=[];return i instanceof By?(e.push({element:"name",root:i}),e.push({element:"icon",root:i}),e.push({element:"copyFrom",root:i}),e.push({element:"contents",root:i})):i instanceof wm&&(i.profile.isDefault||(e.push({element:"name",root:i}),e.push({element:"icon",root:i})),e.push({element:"useAsDefault",root:i}),e.push({element:"contents",root:i}),e.push({element:"workspaces",root:i})),e}return[]}},$Ui=class{getTemplateId(i){return i.element.resourceType?i.root instanceof By?Fre.TEMPLATE_ID:Ore.TEMPLATE_ID:Wre.TEMPLATE_ID}getHeight(i){return 24}},eut=class{constructor(i){this.editorProgressService=i}hasChildren(i){if(i instanceof UN)return!0;if(i.element.resourceType){if(i.element.resourceType!=="extensions"&&i.element.resourceType!=="snippets")return!1;if(i.root instanceof By){let e=i.element.resourceType;if(i.root.getFlag(e))return!0;if(!i.root.hasResource(e)||i.root.copyFrom===void 0||!i.root.getCopyFlag(e))return!1}return!0}return!1}async getChildren(i){if(i instanceof UN)return(await i.getChildren()).map(t=>({element:t,root:i}));if(i.element.resourceType){let e=this.editorProgressService.show(!0,500);try{return(await i.root.getChildren(i.element.resourceType)).map(o=>({element:o,root:i.root}))}finally{e.done()}}return[]}};eut=I([m(0,wd)],eut);var BKe=class extends x{getResourceTypeTitle(i){switch(i){case"settings":return d(16439,null);case"keybindings":return d(16420,null);case"snippets":return d(16440,null);case"tasks":return d(16441,null);case"mcp":return d(16422,null);case"extensions":return d(16404,null)}return""}disposeElement(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.disposables.dispose()}},Y6=class extends BKe{renderElement({element:i},e,t){t.elementDisposables.clear(),t.element=i}},tut=class extends Y6{constructor(e,t){super();this.userDataProfilesService=e;this.contextViewService=t;this.templateId="name"}renderTemplate(e){let t=new N,o=t.add(new N),n,r=M(e,_(".profile-row-container"));M(r,_(".profile-label-element",void 0,d(16423,null)));let s=t.add(new Vc(r,this.contextViewService,{inputBoxStyles:H_({inputBorder:AT}),ariaLabel:d(16435,null),placeholder:d(16435,null),validationOptions:{validation:u=>{if(!u)return{content:d(16424,null),type:2};if(n?.root.disabled||!n?.root.shouldValidateName())return null;let p=n?.root.getInitialName();return u=u.trim(),p!==u&&this.userDataProfilesService.profiles.some(h=>!h.isTransient&&h.name===u)?{content:d(16434,null,u),type:2}:null}}}));t.add(s.onDidChange(u=>{n&&u&&(n.root.name=u)}));let l=t.add(qn(s.inputElement));t.add(l.onDidBlur(()=>{n&&!s.value&&(s.value=n.root.name)}));let c=u=>{s.value=u.root.name,s.validate();let p=u.root instanceof wm&&u.root.profile.isDefault;u.root.disabled||p?s.disable():s.enable(),p?s.setTooltip(d(16398,null)):s.setTooltip(d(16435,null))};return{set element(u){n=u,c(n),o.add(n.root.onDidChange(p=>{(p.name||p.disabled)&&c(u),p.profile&&s.validate()}))},disposables:t,elementDisposables:o}}};tut=I([m(0,an),m(1,Wn)],tut);var iut=class extends Y6{constructor(e,t){super();this.instantiationService=e;this.hoverService=t;this.templateId="icon";this.hoverDelegate=Ri("element")}renderTemplate(e){let t=new N,o=t.add(new N),n,r=M(e,_(".profile-row-container"));M(r,_(".profile-label-element",void 0,d(16413,null)));let s=M(r,_(".profile-icon-container")),l=M(s,_(`${q.asCSSSelector(O3)}`,{tabindex:"0",role:"button","aria-label":d(16411,null)})),c=t.add(this.hoverService.setupManagedHover(this.hoverDelegate,l,"")),u=t.add(this.instantiationService.createInstance(o_,{icons:ndo,inputBoxStyles:Cl})),p,h=()=>{n?.root instanceof wm&&n.root.profile.isDefault||n?.root.disabled||n?.root instanceof wm&&n.root.profile.isDefault||(u.clearInput(),p=this.hoverService.showInstantHover({content:u.domNode,target:l,position:{hoverPosition:2},persistence:{sticky:!0},appearance:{showPointer:!0}},!0),p&&(u.layout(new si(486,292)),u.focus()))};t.add(j(l,re.CLICK,f=>{Xt.stop(f,!0),h()})),t.add(j(l,re.KEY_DOWN,f=>{let v=new gi(f);(v.equals(3)||v.equals(10))&&(Xt.stop(v,!0),h())})),t.add(j(u.domNode,re.KEY_DOWN,f=>{let v=new gi(f);v.equals(9)&&(Xt.stop(v,!0),p?.dispose(),l.focus())})),t.add(u.onDidSelect(f=>{p?.dispose(),l.focus(),n&&(n.root.icon=f.id)})),M(s,_(".profile-description-element",void 0,d(16412,null)));let g=f=>{f?.root instanceof wm&&f.root.profile.isDefault?(s.classList.add("disabled"),c.update(d(16397,null))):(c.update(d(16382,null)),s.classList.remove("disabled")),f.root.icon?l.className=q.asClassName(q.fromId(f.root.icon)):l.className=q.asClassName(q.fromId(O3.id))};return{set element(f){n=f,g(n),o.add(n.root.onDidChange(v=>{v.icon&&g(f)}))},disposables:t,elementDisposables:o}}};iut=I([m(0,F),m(1,nt)],iut);var out=class extends Y6{constructor(e){super();this.userDataProfileService=e;this.templateId="useForCurrent"}renderTemplate(e){let t=new N,o=t.add(new N),n,r=M(e,_(".profile-row-container"));M(r,_(".profile-label-element",void 0,d(16445,null)));let s=M(r,_(".profile-use-for-current-container")),l=d(16402,null),c=t.add(new Ev(l,!1,qf));M(s,c.domNode);let u=M(s,_(".profile-description-element",void 0,l));t.add(c.onChange(()=>{n?.root instanceof wm&&n.root.toggleCurrentWindowProfile()})),t.add(j(u,re.CLICK,()=>{n?.root instanceof wm&&n.root.toggleCurrentWindowProfile()}));let p=g=>{c.checked=g.root instanceof wm&&this.userDataProfileService.currentProfile.id===g.root.profile.id,c.checked&&this.userDataProfileService.currentProfile.isDefault?c.disable():c.enable()},h=this;return{set element(g){n=g,p(n),o.add(h.userDataProfileService.onDidChangeCurrentProfile(f=>{p(g)}))},disposables:t,elementDisposables:o}}};out=I([m(0,ln)],out);var jUi=class extends Y6{constructor(){super(...arguments);this.templateId="useAsDefault"}renderTemplate(e){let t=new N,o=t.add(new N),n,r=M(e,_(".profile-row-container"));M(r,_(".profile-label-element",void 0,d(16446,null)));let s=M(r,_(".profile-use-as-default-container")),l=d(16403,null),c=t.add(new Ev(l,!1,qf));M(s,c.domNode);let u=M(s,_(".profile-description-element",void 0,l));t.add(c.onChange(()=>{n?.root instanceof wm&&n.root.toggleNewWindowProfile()})),t.add(j(u,re.CLICK,()=>{n?.root instanceof wm&&n.root.toggleNewWindowProfile()}));let p=h=>{c.checked=h.root instanceof wm&&h.root.isNewWindowProfile};return{set element(h){n=h,p(n),o.add(n.root.onDidChange(g=>{g.newWindowProfile&&p(h)}))},disposables:t,elementDisposables:o}}},nut=class extends Y6{constructor(e,t,o,n){super();this.userDataProfilesService=e;this.instantiationService=t;this.uriIdentityService=o;this.contextViewService=n;this.templateId="copyFrom";this.templates=[]}renderTemplate(e){let t=new N,o=t.add(new N),n,r=M(e,_(".profile-row-container.profile-copy-from-container"));M(r,_(".profile-label-element",void 0,d(16391,null))),M(r,_(".profile-description-element",void 0,d(16387,null)));let s=t.add(this.instantiationService.createInstance(ME,[],0,this.contextViewService,WE,{useCustomDrawn:!0,ariaLabel:d(16390,null)}));s.render(M(r,_(".profile-select-container")));let l=(u,p)=>{s.setOptions(p);let h=u.copyFrom instanceof A?u.copyFrom.toString():u.copyFrom?.id,g=h?p.findIndex(f=>f.id===h):0;s.select(g)},c=this;return{set element(u){if(n=u,n.root instanceof By){let p=n.root,h=c.getCopyFromOptions(p);l(p,h),s.setEnabled(!p.previewProfile&&!p.disabled),o.add(n.root.onDidChange(g=>{(g.copyFrom||g.copyFromInfo)&&(h=c.getCopyFromOptions(p),l(p,h)),(g.preview||g.disabled)&&s.setEnabled(!p.previewProfile&&!p.disabled)})),o.add(s.onDidSelect(g=>{p.copyFrom=h[g.index].source}))}},disposables:t,elementDisposables:o}}setTemplates(e){this.templates=e}getCopyFromOptions(e){let t=[];t.push({text:d(16401,null)});for(let[o,n]of e.copyFromTemplates)this.templates.some(r=>this.uriIdentityService.extUri.isEqual(A.parse(r.url),o))||t.push({text:`${n} (${He(o)})`,id:o.toString(),source:o});if(this.templates.length){t.push({...UO,decoratorRight:d(16409,null)});for(let o of this.templates)t.push({text:o.name,id:o.url,source:A.parse(o.url)})}t.push({...UO,decoratorRight:d(16407,null)});for(let o of this.userDataProfilesService.profiles)o.isTransient||t.push({text:o.name,id:o.id,source:o});return t}};nut=I([m(0,an),m(1,F),m(2,ht),m(3,Wn)],nut);var rut=class extends Y6{constructor(e,t,o){super();this.userDataProfilesService=e;this.contextMenuService=t;this.instantiationService=o;this.templateId="contents";this._onDidChangeContentHeight=this._register(new E);this.onDidChangeContentHeight=this._onDidChangeContentHeight.event;this._onDidChangeSelection=this._register(new E);this.onDidChangeSelection=this._onDidChangeSelection.event}renderTemplate(e){let t=new N,o=t.add(new N),n,r=M(e,_(".profile-row-container"));M(r,_(".profile-label-element",void 0,d(16383,null)));let s=M(r,_(".profile-description-element")),l=M(r,_(".profile-content-tree-header")),c=_(".options-header",void 0,_("span",void 0,d(16432,null)));M(l,_(""),_("",void 0,d(16383,null)),c,_(""));let u=new $Ui,p=this.profilesContentTree=t.add(this.instantiationService.createInstance(rp,"ProfileEditor-ContentsTree",M(r,_(".profile-content-tree.file-icon-themable-tree.show-file-icons")),u,[this.instantiationService.createInstance(Ore),this.instantiationService.createInstance(Fre),this.instantiationService.createInstance(Wre)],this.instantiationService.createInstance(eut),{multipleSelectionSupport:!1,horizontalScrolling:!1,accessibilityProvider:{getAriaLabel(f){return(f?.element).resourceType?(f?.element).resourceType:(f?.element).label?(f?.element).label:""},getWidgetAriaLabel(){return""}},identityProvider:{getId(f){return f?.element.handle?f.element.handle:""}},expandOnlyOnTwistieClick:!0,renderIndentGuides:"none",enableStickyScroll:!1,openOnSingleClick:!1,alwaysConsumeMouseWheel:!1}));this.profilesContentTree.style(QUi),t.add(Z(()=>this.profilesContentTree=void 0)),t.add(this.profilesContentTree.onDidChangeContentHeight(f=>{this.profilesContentTree?.layout(f),n&&this._onDidChangeContentHeight.fire(n)})),t.add(this.profilesContentTree.onDidChangeSelection((f=>{n&&this._onDidChangeSelection.fire({element:n,selected:!!f.elements.length})}))),t.add(this.profilesContentTree.onDidOpen(async f=>{f.browserEvent&&f.element?.element.openAction&&await f.element.element.openAction.run()})),t.add(this.profilesContentTree.onContextMenu(async f=>{f.element?.element.actions?.contextMenu?.length&&this.contextMenuService.showContextMenu({getAnchor:()=>f.anchor,getActions:()=>f.element?.element?.actions?.contextMenu??[],getActionsContext:()=>f.element})}));let h=f=>{Rt(s);let v=new Ie;if(f.root instanceof wm&&f.root.profile.isDefault)v.appendMarkdown(d(16396,null));else if(v.appendMarkdown(d(16384,null)),f.root instanceof By){let b=f.root.getCopyFromName(),S=b===this.userDataProfilesService.defaultProfile.name?d(16386,null,b):b;S&&v.appendMarkdown(d(16389,null,S,b)),v.appendMarkdown(d(16395,null)).appendMarkdown(d(16430,null))}M(s,o.add(Gf(v)).element)},g=this;return{set element(f){n=f,h(f),f.root instanceof By?l.classList.remove("default-profile"):f.root instanceof wm&&l.classList.toggle("default-profile",f.root.profile.isDefault),p.setInput(n.root),o.add(n.root.onDidChange(v=>{(v.copyFrom||v.copyFlags||v.flags||v.extensions||v.snippets||v.preview)&&p.updateChildren(f.root),v.copyFromInfo&&(h(f),g._onDidChangeContentHeight.fire(f))}))},disposables:t,elementDisposables:o}}clearSelection(){this.profilesContentTree&&(this.profilesContentTree.setSelection([]),this.profilesContentTree.setFocus([]))}};rut=I([m(0,an),m(1,Xe),m(2,F)],rut);var sut=class extends Y6{constructor(e,t,o,n){super();this.labelService=e;this.uriIdentityService=t;this.fileDialogService=o;this.instantiationService=n;this.templateId="workspaces";this._onDidChangeContentHeight=this._register(new E);this.onDidChangeContentHeight=this._onDidChangeContentHeight.event;this._onDidChangeSelection=this._register(new E);this.onDidChangeSelection=this._onDidChangeSelection.event}renderTemplate(e){let t=new N,o=t.add(new N),n,r=M(e,_(".profile-row-container"));M(r,_(".profile-label-element",void 0,d(16405,null)));let s=M(r,_(".profile-description-element")),l=M(r,_(".profile-associations-table")),c=this.workspacesTable=t.add(this.instantiationService.createInstance(MC,"ProfileEditor-AssociationsTable",l,new class{constructor(){this.headerRowHeight=30}getHeight(){return 24}},[{label:"",tooltip:"",weight:1,minimumWidth:30,maximumWidth:30,templateId:P6t.TEMPLATE_ID,project(v){return v}},{label:d(16410,null),tooltip:"",weight:2,templateId:Vre.TEMPLATE_ID,project(v){return v}},{label:d(16433,null),tooltip:"",weight:7,templateId:Bre.TEMPLATE_ID,project(v){return v}},{label:"",tooltip:"",weight:1,minimumWidth:84,maximumWidth:84,templateId:Hre.TEMPLATE_ID,project(v){return v}}],[new P6t,this.instantiationService.createInstance(Vre),this.instantiationService.createInstance(Bre),this.instantiationService.createInstance(Hre)],{horizontalScrolling:!1,alwaysConsumeMouseWheel:!1,openOnSingleClick:!1,multipleSelectionSupport:!1,accessibilityProvider:{getAriaLabel:v=>{let b=zMo(this.labelService,v.workspace);return b===void 0||b.length===0?d(16442,null,this.labelService.getUriLabel(v.workspace)):d(16444,null,this.labelService.getUriLabel(v.workspace),b)},getWidgetAriaLabel:()=>d(16443,null)},identityProvider:{getId(v){return v.workspace.toString()}}}));this.workspacesTable.style(QUi),t.add(Z(()=>this.workspacesTable=void 0)),t.add(this.workspacesTable.onDidChangeSelection((v=>{n&&this._onDidChangeSelection.fire({element:n,selected:!!v.elements.length})})));let u=M(r,_(".profile-workspaces-button-container")),p=t.add(new Sw(u)),h=this._register(p.addButton({title:d(16377,null),...Qo}));h.label=d(16377,null),t.add(h.onDidClick(async()=>{let v=await this.fileDialogService.showOpenDialog({canSelectFiles:!1,canSelectFolders:!0,canSelectMany:!0,openLabel:d(16378,null),title:d(16379,null)});v&&n?.root instanceof wm&&n.root.updateWorkspaces(v,[])})),t.add(c.onDidOpen(v=>{v?.element&&v.element.profileElement.openWorkspace(v.element.workspace)}));let g=()=>{n?.root instanceof wm&&n.root.workspaces?.length?(s.textContent=d(16406,null),l.classList.remove("hide"),c.splice(0,c.length,n.root.workspaces.map(v=>({workspace:v,profileElement:n.root})).sort((v,b)=>this.uriIdentityService.extUri.compare(v.workspace,b.workspace))),this.layout()):(s.textContent=d(16427,null),l.classList.add("hide"))},f=this;return{set element(v){n=v,v.root instanceof wm&&g(),o.add(n.root.onDidChange(b=>{n&&b.workspaces&&(g(),f._onDidChangeContentHeight.fire(n))}))},disposables:t,elementDisposables:o}}layout(){this.workspacesTable&&this.workspacesTable.layout(this.workspacesTable.length*24+30,void 0)}clearSelection(){this.workspacesTable&&(this.workspacesTable.setSelection([]),this.workspacesTable.setFocus([]))}};sut=I([m(0,rt),m(1,ht),m(2,rn),m(3,F)],sut);var Ore=class extends BKe{constructor(e){super();this.instantiationService=e;this.templateId=Ore.TEMPLATE_ID}static{this.TEMPLATE_ID="ExistingProfileResourceTemplate"}renderTemplate(e){let t=new N,o=M(e,_(".profile-tree-item-container.existing-profile-resource-type-container")),n=M(o,_(".profile-resource-type-label")),r=t.add(new bfe({items:[]}));M(M(o,_(".profile-resource-options-container")),r.domNode);let s=M(o,_(".profile-resource-actions-container")),l=t.add(this.instantiationService.createInstance(ol,s,{hoverDelegate:t.add(Qh()),highlightToggledItems:!0}));return{label:n,radio:r,actionBar:l,disposables:t,elementDisposables:t.add(new N)}}renderElement({element:e},t,o){o.elementDisposables.clear();let{element:n,root:r}=e;if(!(r instanceof wm))throw new Error("ExistingProfileResourceTreeRenderer can only render existing profile element");if(Fe(n)||!zUi(n))throw new Error("Invalid profile resource element");let s=()=>{o.radio.setItems([{text:d(16393,null),tooltip:d(16394,null,l),isActive:r.getFlag(n.resourceType)},{text:r.name,tooltip:d(16392,null,l,r.name),isActive:!r.getFlag(n.resourceType)}])},l=this.getResourceTypeTitle(n.resourceType);o.label.textContent=l,r instanceof wm&&r.profile.isDefault?o.radio.domNode.classList.add("hide"):(o.radio.domNode.classList.remove("hide"),s(),o.elementDisposables.add(r.onDidChange(u=>{u.name&&s()})),o.elementDisposables.add(o.radio.onDidSelect(u=>r.setFlag(n.resourceType,u===0))));let c=[];n.openAction&&c.push(n.openAction),n.actions?.primary&&c.push(...n.actions.primary),o.actionBar.setActions(c)}};Ore=I([m(0,F)],Ore);var Fre=class extends BKe{constructor(e,t){super();this.userDataProfilesService=e;this.instantiationService=t;this.templateId=Fre.TEMPLATE_ID}static{this.TEMPLATE_ID="NewProfileResourceTemplate"}renderTemplate(e){let t=new N,o=M(e,_(".profile-tree-item-container.new-profile-resource-type-container")),n=M(o,_(".profile-resource-type-label-container")),r=M(n,_("span.profile-resource-type-label")),s=t.add(new bfe({items:[]}));M(M(o,_(".profile-resource-options-container")),s.domNode);let l=M(o,_(".profile-resource-actions-container")),c=t.add(this.instantiationService.createInstance(ol,l,{hoverDelegate:t.add(Qh()),highlightToggledItems:!0}));return{label:r,radio:s,actionBar:c,disposables:t,elementDisposables:t.add(new N)}}renderElement({element:e},t,o){o.elementDisposables.clear();let{element:n,root:r}=e;if(!(r instanceof By))throw new Error("NewProfileResourceTreeRenderer can only render new profile element");if(Fe(n)||!zUi(n))throw new Error("Invalid profile resource element");let s=this.getResourceTypeTitle(n.resourceType);o.label.textContent=s;let l=()=>{let u=[{text:d(16393,null),tooltip:d(16394,null,s)},{text:d(16428,null),tooltip:d(16429,null,s)}],p=r.getCopyFromName(),h=p===this.userDataProfilesService.defaultProfile.name?d(16386,null,p):p;r.copyFrom&&h?(o.radio.setItems([{text:h,tooltip:h?d(16388,null,s,h):d(16385,null)},...u]),o.radio.setActiveItem(r.getCopyFlag(n.resourceType)?0:r.getFlag(n.resourceType)?1:2)):(o.radio.setItems(u),o.radio.setActiveItem(r.getFlag(n.resourceType)?0:1))};r.copyFrom?o.elementDisposables.add(o.radio.onDidSelect(u=>{r.setFlag(n.resourceType,u===1),r.setCopyFlag(n.resourceType,u===0)})):o.elementDisposables.add(o.radio.onDidSelect(u=>{r.setFlag(n.resourceType,u===0)})),l(),o.radio.setEnabled(!r.disabled&&!r.previewProfile),o.elementDisposables.add(r.onDidChange(u=>{(u.disabled||u.preview)&&o.radio.setEnabled(!r.disabled&&!r.previewProfile),(u.copyFrom||u.copyFromInfo)&&l()}));let c=[];n.openAction&&c.push(n.openAction),n.actions?.primary&&c.push(...n.actions.primary),o.actionBar.setActions(c)}};Fre=I([m(0,an),m(1,F)],Fre);var Wre=class extends BKe{constructor(e){super();this.instantiationService=e;this.templateId=Wre.TEMPLATE_ID;this.labels=e.createInstance(Nl,qB),this.hoverDelegate=this._register(e.createInstance(mf,"mouse",void 0,{}))}static{this.TEMPLATE_ID="ProfileResourceChildTreeItemTemplate"}renderTemplate(e){let t=new N,o=M(e,_(".profile-tree-item-container.profile-resource-child-container")),n=t.add(new Ev("",!1,qf));M(o,n.domNode);let r=t.add(this.labels.create(o,{hoverDelegate:this.hoverDelegate})),s=M(o,_(".profile-resource-actions-container")),l=t.add(this.instantiationService.createInstance(ol,s,{hoverDelegate:t.add(Qh()),highlightToggledItems:!0}));return{checkbox:n,resourceLabel:r,actionBar:l,disposables:t,elementDisposables:t.add(new N)}}renderElement({element:e},t,o){o.elementDisposables.clear();let{element:n}=e;if(Fe(n)||!UMo(n))throw new Error("Invalid profile resource element");n.checkbox?(o.checkbox.domNode.setAttribute("tabindex","0"),o.checkbox.domNode.classList.remove("hide"),o.checkbox.checked=n.checkbox.isChecked,o.checkbox.domNode.ariaLabel=n.checkbox.accessibilityInformation?.label??"",n.checkbox.accessibilityInformation?.role&&(o.checkbox.domNode.role=n.checkbox.accessibilityInformation.role)):(o.checkbox.domNode.removeAttribute("tabindex"),o.checkbox.domNode.classList.add("hide")),o.resourceLabel.setResource({name:n.resource?He(n.resource):n.label,description:n.description,resource:n.resource},{forceLabel:!0,icon:n.icon,hideIcon:!n.resource&&!n.icon});let r=[];n.openAction&&r.push(n.openAction),n.actions?.primary&&r.push(...n.actions.primary),o.actionBar.setActions(r)}};Wre=I([m(0,F)],Wre);var P6t=class a{constructor(){this.templateId=a.TEMPLATE_ID}static{this.TEMPLATE_ID="empty"}renderTemplate(i){return{}}renderElement(i,e,t){}disposeTemplate(){}},Vre=class{constructor(i,e){this.uriIdentityService=i;this.labelService=e;this.templateId=Vre.TEMPLATE_ID}static{this.TEMPLATE_ID="host"}renderTemplate(i){let e=new N,t=e.add(new N),o=i.appendChild(_(".host")),n=o.appendChild(_("div.host-label")),r=o.appendChild(_("div.button-bar"));return{element:o,hostContainer:n,buttonBarContainer:r,disposables:e,renderDisposables:t}}renderElement(i,e,t){t.renderDisposables.clear(),t.renderDisposables.add({dispose:()=>{Rt(t.buttonBarContainer)}}),t.hostContainer.innerText=zMo(this.labelService,i.workspace),t.element.classList.toggle("current-workspace",this.uriIdentityService.extUri.isEqual(i.workspace,i.profileElement.getCurrentWorkspace())),t.hostContainer.style.display="",t.buttonBarContainer.style.display="none"}disposeTemplate(i){i.disposables.dispose()}};Vre=I([m(0,ht),m(1,rt)],Vre);var Bre=class{constructor(i,e){this.uriIdentityService=i;this.hoverService=e;this.templateId=Bre.TEMPLATE_ID;this.hoverDelegate=Ri("mouse")}static{this.TEMPLATE_ID="path"}renderTemplate(i){let e=new N,t=i.appendChild(_(".path")),o=t.appendChild(_("div.path-label")),n=e.add(this.hoverService.setupManagedHover(this.hoverDelegate,o,"")),r=e.add(new N);return{element:t,pathLabel:o,pathHover:n,disposables:e,renderDisposables:r}}renderElement(i,e,t){t.renderDisposables.clear();let o=this.formatPath(i.workspace);t.pathLabel.innerText=o,t.element.classList.toggle("current-workspace",this.uriIdentityService.extUri.isEqual(i.workspace,i.profileElement.getCurrentWorkspace())),t.pathHover.update(o)}disposeTemplate(i){i.disposables.dispose(),i.renderDisposables.dispose()}formatPath(i){if(i.scheme===Q.file)return Hp(i.fsPath);if(i.path.startsWith(Oo.sep)){let e=i.path.substring(1);if(V9(e,!0))return Hp($s.normalize(e),!0)}return i.path}};Bre=I([m(0,ht),m(1,nt)],Bre);var VKe=class{constructor(i,e,t,o){this.item=i;this.userDataProfilesService=e;this.id="changeProfile";this.label="Change Profile";this.class=q.asClassName(MSn);this.tooltip=d(16381,null);this.checked=!1;this.enabled=!t.extUri.isEqual(i.workspace,o.agentSessionsWorkspace)}run(){}getSwitchProfileActions(){return this.userDataProfilesService.profiles.filter(i=>!i.isTransient).sort((i,e)=>i.isDefault?-1:e.isDefault?1:i.name.localeCompare(e.name)).map(i=>({id:`switchProfileTo${i.id}`,label:i.name,class:void 0,enabled:!0,checked:i.id===this.item.profileElement.profile.id,tooltip:"",run:()=>{i.id!==this.item.profileElement.profile.id&&this.userDataProfilesService.updateProfile(i,{workspaces:[...i.workspaces??[],this.item.workspace]})}}))}};VKe=I([m(1,an),m(2,ht),m(3,Eo)],VKe);var Hre=class{constructor(i,e,t,o,n){this.userDataProfilesService=i;this.userDataProfileManagementService=e;this.contextMenuService=t;this.uriIdentityService=o;this.environmentService=n;this.templateId=Hre.TEMPLATE_ID}static{this.TEMPLATE_ID="actions"}renderTemplate(i){let e=new N,t=i.appendChild(_(".profile-workspaces-actions-container")),o=e.add(Qh());return{actionBar:e.add(new Zi(t,{hoverDelegate:o,actionViewItemProvider:r=>{if(r instanceof VKe)return new Pm(r,{getActions:()=>r.getSwitchProfileActions()},this.contextMenuService,{classNames:r.class,hoverDelegate:o})}})),disposables:e}}renderElement(i,e,t){t.actionBar.clear();let o=[];o.push(this.createOpenAction(i)),o.push(new VKe(i,this.userDataProfilesService,this.uriIdentityService,this.environmentService)),o.push(this.createDeleteAction(i)),t.actionBar.push(o,{icon:!0})}createOpenAction(i){return{label:"",class:q.asClassName(R.window),enabled:!this.uriIdentityService.extUri.isEqual(i.workspace,i.profileElement.getCurrentWorkspace()),id:"openWorkspace",tooltip:d(16431,null),run:()=>i.profileElement.openWorkspace(i.workspace)}}createDeleteAction(i){let e=this.uriIdentityService.extUri.isEqual(i.workspace,this.environmentService.agentSessionsWorkspace);return{label:"",class:q.asClassName(PSn),enabled:this.userDataProfileManagementService.getDefaultProfileToUse().id!==i.profileElement.profile.id&&!e,id:"deleteTrustedUri",tooltip:d(16399,null),run:()=>i.profileElement.updateWorkspaces([],[i.workspace])}}disposeTemplate(i){i.disposables.dispose()}};Hre=I([m(0,an),m(1,vT),m(2,Xe),m(3,ht),m(4,Eo)],Hre);function zMo(a,i){return i.authority?a.getHostLabel(i.scheme,i.authority):d(16421,null)}var zN=class extends ls{constructor(e){super();this.instantiationService=e;this.resource=void 0;this._dirty=!1;this.model=qU.getInstance(this.instantiationService),this._register(this.model.onDidChange(t=>this.dirty=this.model.profiles.some(o=>o instanceof By)))}static{this.ID="workbench.input.userDataProfiles"}get dirty(){return this._dirty}set dirty(e){this._dirty!==e&&(this._dirty=e,this._onDidChangeDirty.fire())}get capabilities(){return 2048}get typeId(){return zN.ID}getName(){return d(16447,null)}getIcon(){return zro}async resolve(){return await this.model.resolve(),this.model}isDirty(){return this.dirty}async save(){return await this.model.saveNewProfile(),this}async revert(){this.model.revert()}matches(e){return e instanceof zN}dispose(){for(let e of this.model.profiles)e instanceof wm&&e.reset();super.dispose()}};zN=I([m(0,F)],zN);var A6t=class{canSerialize(i){return!0}serialize(i){return""}deserialize(i){return i.createInstance(zN)}};var YUi=new D("OpenProfile"),N6t=new D("Profiles"),Vbe=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this.userDataProfileService=e;this.userDataProfilesService=t;this.userDataProfileManagementService=o;this.telemetryService=n;this.workspaceContextService=r;this.workspaceTagsService=s;this.editorService=c;this.instantiationService=u;this.lifecycleService=p;this.urlService=h;this.profilesDisposable=this._register(new me);this.currentProfileContext=DYe.bindTo(l),this.isCurrentProfileTransientContext=Kro.bindTo(l),this.currentProfileContext.set(this.userDataProfileService.currentProfile.id),this.isCurrentProfileTransientContext.set(!!this.userDataProfileService.currentProfile.isTransient),this._register(this.userDataProfileService.onDidChangeCurrentProfile(f=>{this.currentProfileContext.set(this.userDataProfileService.currentProfile.id),this.isCurrentProfileTransientContext.set(!!this.userDataProfileService.currentProfile.isTransient)})),this.hasProfilesContext=Q4.bindTo(l),this.hasProfilesContext.set(this.userDataProfilesService.profiles.length>1),this._register(this.userDataProfilesService.onDidChangeProfiles(f=>this.hasProfilesContext.set(this.userDataProfilesService.profiles.length>1))),this.registerEditor(),this.registerActions(),this._register(this.urlService.registerHandler(this)),Wt&&p.when(4).then(()=>t.cleanUp()),this.reportWorkspaceProfileInfo(),g.options?.profileToPreview&&p.when(3).then(()=>this.handleURL(A.revive(g.options.profileToPreview))),this.registerDropHandler()}static{this.ID="workbench.contrib.userDataProfiles"}async handleURL(e){if(q_e(e)){let t=await this.openProfilesEditor();if(t)return t.createNewProfile(e),!0}return!1}async openProfilesEditor(){return await this.editorService.openEditor(new zN(this.instantiationService))}registerEditor(){ne.as(qo.EditorPane).registerEditorPane(Br.create(Q6,Q6.ID,d(16372,null)),[new Ft(zN)]),ne.as(qo.EditorFactory).registerEditorSerializer(zN.ID,A6t)}registerDropHandler(){let e=ne.as(OV.DragAndDropContribution),t=this;this._register(e.registerDropHandler(new class{async handleDrop(n,r){let s=r.get(ht),l=r.get(YB),c=r.get(ee),u=r.get(Pk),p=r.get(Ne);if(s.extUri.extname(n)===`.${TYe}`){if(!await l.resolveProfileTemplate(n))return p.warn(d(16356,null)),c.openEditor(u.createTextEditor({resource:n})),!0;let g=await t.openProfilesEditor();if(g)try{await g.createNewProfile(n)}catch{return!1}return!0}return!1}}))}registerActions(){this.registerProfileSubMenu(),this._register(this.registerManageProfilesAction()),this._register(this.registerSwitchProfileAction()),this.registerOpenProfileSubMenu(),this.registerNewWindowWithProfileAction(),this.registerProfilesActions(),this._register(this.userDataProfilesService.onDidChangeProfiles(()=>this.registerProfilesActions())),this._register(this.registerExportCurrentProfileAction()),this.registerCreateFromCurrentProfileAction(),this.registerNewProfileAction(),this.registerDeleteProfileAction(),this.registerHelpAction()}registerProfileSubMenu(){let e=()=>d(16368,null,this.userDataProfileService.currentProfile.name);ve.appendMenuItem(D.GlobalActivity,{get title(){return e()},submenu:N6t,group:"2_configuration",order:1,when:Q4}),ve.appendMenuItem(D.MenubarPreferencesMenu,{get title(){return e()},submenu:N6t,group:"2_configuration",order:1,when:Q4})}registerOpenProfileSubMenu(){ve.appendMenuItem(D.MenubarFileMenu,{title:d(16359,null),submenu:YUi,group:"1_new",order:4})}registerProfilesActions(){this.profilesDisposable.value=new N;for(let e of this.userDataProfilesService.profiles)e.isTransient||(this.profilesDisposable.value.add(this.registerProfileEntryAction(e)),this.profilesDisposable.value.add(this.registerNewWindowAction(e)))}registerProfileEntryAction(e){let t=this;return W(class extends K{constructor(){super({id:`workbench.profiles.actions.profileEntry.${e.id}`,title:e.name,metadata:{description:L(16349,"Switch to {0} profile",e.name)},toggled:C.equals(DYe.key,e.id),menu:[{id:N6t,group:"0_profiles"}]})}async run(n){if(t.userDataProfileService.currentProfile.id!==e.id)return t.userDataProfileManagementService.switchProfile(e)}})}registerNewWindowWithProfileAction(){return W(class extends K{constructor(){super({id:"workbench.profiles.actions.newWindowWithProfile",title:L(16361,"New Window with Profile..."),category:n0,precondition:Q4,f1:!0})}async run(t){let o=t.get(Ue),n=t.get(an),r=t.get(Zt),s=await o.pick(n.profiles.map(l=>({label:l.name,profile:l})),{title:d(16360,null),placeHolder:d(16366,null),canPickMany:!1});if(s)return r.openWindow({remoteAuthority:null,forceProfile:s.profile.name})}})}registerNewWindowAction(e){let t=new N,o=`workbench.action.openProfile.${e.name.replace("/s+/","_")}`,n=Q4;return t.add(W(class extends K{constructor(){super({id:o,title:L(16365,"{0}",e.name),metadata:{description:L(16363,"Open New Window with {0} Profile",e.name)},menu:{id:YUi,group:"0_profiles",when:n}})}run(s){return s.get(Zt).openWindow({remoteAuthority:null,forceProfile:e.name})}})),t.add(ve.appendMenuItem(D.CommandPalette,{command:{id:o,category:n0,title:L(16362,"Open {0} Profile",e.name),precondition:n}})),t}registerSwitchProfileAction(){let e=this;return W(class extends K{constructor(){super({id:"workbench.profiles.actions.switchProfile",title:L(16371,"Switch Profile..."),category:n0,f1:!0})}async run(o){let n=o.get(Ue),r=[];for(let l of e.userDataProfilesService.profiles)r.push({id:l.id,label:l.id===e.userDataProfileService.currentProfile.id?`$(check) ${l.name}`:l.name,profile:l});let s=await n.pick(r.sort((l,c)=>l.profile.name.localeCompare(c.profile.name)),{placeHolder:d(16370,null)});s&&await e.userDataProfileManagementService.switchProfile(s.profile)}})}registerManageProfilesAction(){let e=new N;return e.add(W(class extends K{constructor(){super({id:"workbench.profiles.actions.manageProfiles",title:{...L(16357,"Profiles"),mnemonicTitle:d(16358,null)},menu:[{id:D.GlobalActivity,group:"2_configuration",order:1,when:Q4.negate()},{id:D.MenubarPreferencesMenu,group:"2_configuration",order:1,when:Q4.negate()},{id:N6t,group:"1_manage",order:1}]})}run(o){let n=o.get(ee),r=o.get(F);return n.openEditor(new zN(r))}})),e.add(ve.appendMenuItem(D.CommandPalette,{command:{id:"workbench.profiles.actions.manageProfiles",category:Ve.Preferences,title:L(16364,"Open Profiles (UI)")}})),e}registerExportCurrentProfileAction(){let e=this,t=new N,o="workbench.profiles.actions.exportProfile";return t.add(W(class extends K{constructor(){super({id:o,title:L(16354,"Export Profile..."),category:n0,f1:!0})}async run(){(await e.openProfilesEditor())?.selectProfile(e.userDataProfileService.currentProfile)}})),t.add(ve.appendMenuItem(D.MenubarShare,{command:{id:o,title:L(16355,"Export Profile ({0})...",e.userDataProfileService.currentProfile.name)}})),t}registerCreateFromCurrentProfileAction(){let e=this;this._register(W(class extends K{constructor(){super({id:"workbench.profiles.actions.createFromCurrentProfile",title:L(16369,"Save Current Profile As..."),category:n0,f1:!0})}async run(){(await e.openProfilesEditor())?.createNewProfile(e.userDataProfileService.currentProfile)}}))}registerNewProfileAction(){let e=this;this._register(W(class extends K{constructor(){super({id:"workbench.profiles.actions.createProfile",title:L(16350,"New Profile..."),category:n0,f1:!0,menu:[{id:YUi,group:"1_manage_profiles",order:1}]})}async run(o){return(await e.openProfilesEditor())?.createNewProfile()}}))}registerDeleteProfileAction(){this._register(W(class extends K{constructor(){super({id:"workbench.profiles.actions.deleteProfile",title:L(16352,"Delete Profile..."),category:n0,f1:!0,precondition:Q4})}async run(t){let o=t.get(Ue),n=t.get(ln),r=t.get(an),s=t.get(vT),l=t.get(Ne),c=r.profiles.filter(u=>!u.isDefault&&!u.isTransient);if(c.length){let u=await o.pick(c.map(p=>({label:p.name,description:p.id===n.currentProfile.id?d(16351,null):void 0,profile:p})),{title:d(16353,null),placeHolder:d(16367,null),canPickMany:!0});if(u)try{await Promise.all(u.map(p=>s.removeProfile(p.profile)))}catch(p){l.error(p)}}}}))}registerHelpAction(){this._register(W(class extends K{constructor(){super({id:"workbench.profiles.actions.help",title:mbi,category:Ve.Help,menu:[{id:D.CommandPalette}]})}run(t){return t.get(Je).open(A.parse("https://aka.ms/vscode-profiles-help"))}}))}async reportWorkspaceProfileInfo(){await this.lifecycleService.when(4),this.userDataProfilesService.profiles.length>1&&this.telemetryService.publicLog2("profiles:count",{count:this.userDataProfilesService.profiles.length-1});let e=await this.workspaceTagsService.getTelemetryWorkspaceId(this.workspaceContextService.getWorkspace(),this.workspaceContextService.getWorkbenchState());this.telemetryService.publicLog2("workspaceProfileInfo",{workspaceId:e,defaultProfile:this.userDataProfileService.currentProfile.isDefault})}};Vbe=I([m(0,ln),m(1,an),m(2,vT),m(3,Te),m(4,Pe),m(5,FKe),m(6,X),m(7,ee),m(8,F),m(9,ji),m(10,_b),m(11,cd)],Vbe);var XUi=class a extends K{static{this.ID="workbench.profiles.actions.createTemporaryProfile"}static{this.TITLE=L(16374,"New Window with Temporary Profile")}constructor(){super({id:a.ID,title:a.TITLE,category:n0,f1:!0})}async run(i){i.get(Zt).openWindow({forceTempProfile:!0})}};W(XUi);W(class extends K{constructor(){super({id:"workbench.profiles.actions.cleanupProfiles",title:L(16373,"Cleanup Profiles"),category:Ve.Developer,f1:!0})}async run(i){return i.get(an).cleanUp()}});W(class extends K{constructor(){super({id:"workbench.profiles.actions.resetWorkspaces",title:L(16375,"Reset Workspace Profiles Associations"),category:Ve.Developer,f1:!0})}async run(i){return i.get(an).resetWorkspaces()}});It(Vbe.ID,Vbe,St.BlockRestore);var X6=L(10064,"Cloud Changes"),$U=le("IEditSessionsStorageService"),aut=le("IEditSessionsLogService");var KMo=3,HKe="editSessionsSignedIn",GMo=new Y(HKe,!1),O6t="editSessionsPending",qMo=new Y(O6t,!1),JUi="workbench.view.editSessions",F6t="workbench.views.editSessions.data",Bbe=L(10064,"Cloud Changes"),$Mo=Ae("edit-sessions-view-icon",R.cloudDownload,d(10065,null)),W6t=new Y("editSessionsShowView",!1),UKe="vscode-edit-sessions";function V6t(a,i){switch(a){case 1:return qe.fromString(i);case 2:return qa(i);default:throw new Error("Upgrade to a newer version to decode this content.")}}function B6t(a){let i=new Yy;return i.update(a),i.digest()}var lut="editSessions";var jU=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this.fileService=e;this.storageService=t;this.quickInputService=o;this.authenticationService=n;this.extensionService=r;this.environmentService=s;this.logService=l;this.productService=c;this.contextKeyService=u;this.dialogService=p;this.secretStorageService=h;this.SIZE_LIMIT=Math.floor(1024*1024*1.9);this.initialized=!1;this._didSignIn=this._register(new E);this._didSignOut=this._register(new E);this._lastWrittenResources=new Map;this._lastReadResources=new Map;this.serverConfiguration=this.productService["editSessions.store"],this._register(this.authenticationService.onDidChangeSessions(g=>this.onDidChangeSessions(g.event))),this._register(this.storageService.onDidChangeValue(-1,jU.CACHED_SESSION_STORAGE_KEY,this._store)(()=>this.onDidChangeStorage())),this.registerSignInAction(),this.registerResetAuthenticationAction(),this.signedInContext=GMo.bindTo(this.contextKeyService),this.signedInContext.set(this.existingSessionId!==void 0)}static{this.CACHED_SESSION_STORAGE_KEY="editSessionAccountPreference"}get isSignedIn(){return this.existingSessionId!==void 0}get onDidSignIn(){return this._didSignIn.event}get onDidSignOut(){return this._didSignOut.event}get lastWrittenResources(){return this._lastWrittenResources}get lastReadResources(){return this._lastReadResources}async write(e,t){if(await this.initialize("write",!1),!this.initialized)throw new Error("Please sign in to store your edit session.");typeof t!="string"&&t.machine===void 0&&(t.machine=await this.getOrCreateCurrentMachineId()),t=typeof t=="string"?t:JSON.stringify(t);let o=await this.storeClient.writeResource(e,t,null,void 0,OZe(xt()));return this._lastWrittenResources.set(e,{ref:o,content:t}),o}async read(e,t){if(await this.initialize("read",!1),!this.initialized)throw new Error("Please sign in to apply your latest edit session.");let o,n=OZe(xt());try{if(t!==void 0)o=await this.storeClient?.resolveResourceContent(e,t,void 0,n);else{let r=await this.storeClient?.readResource(e,null,void 0,n);o=r?.content,t=r?.ref}}catch(r){this.logService.error(r)}if(o!=null&&t!==void 0)return this._lastReadResources.set(e,{ref:t,content:o}),{ref:t,content:o}}async delete(e,t){if(await this.initialize("write",!1),!this.initialized)throw new Error(`Unable to delete edit session with ref ${t}.`);try{await this.storeClient?.deleteResource(e,t)}catch(o){this.logService.error(o)}}async list(e){if(await this.initialize("read",!1),!this.initialized)throw new Error("Unable to list edit sessions.");try{return this.storeClient?.getAllResourceRefs(e)??[]}catch(t){this.logService.error(t)}return[]}async initialize(e,t=!1){return this.initialized?!0:(this.initialized=await this.doInitialize(e,t),this.signedInContext.set(this.initialized),this.initialized&&this._didSignIn.fire(),this.initialized)}async doInitialize(e,t){if(await this.extensionService.whenInstalledExtensionsRegistered(),!this.serverConfiguration?.url)throw new Error("Unable to initialize sessions sync as session sync preference is not configured in product.json.");if(this.storeClient===void 0)return!1;if(this._register(this.storeClient.onTokenFailed(()=>{this.logService.info("Clearing edit sessions authentication preference because of successive token failures."),this.clearAuthenticationPreference()})),this.machineClient===void 0&&(this.machineClient=new H0(this.environmentService,this.fileService,this.storageService,this.storeClient,this.logService,this.productService)),this.authenticationInfo!==void 0)return!0;let o=await this.getAuthenticationSession(e,t);return o!==void 0&&(this.authenticationInfo=o,this.storeClient.setAuthToken(o.token,o.providerId)),o!==void 0}async getMachineById(e){if(await this.initialize("read",!1),!this.cachedMachines){let t=await this.machineClient.getMachines();this.cachedMachines=t.reduce((o,n)=>o.set(n.id,n.name),new Map)}return this.cachedMachines.get(e)}async getOrCreateCurrentMachineId(){let e=await this.machineClient.getMachines().then(t=>t.find(o=>o.isCurrent)?.id);return e===void 0?(await this.machineClient.addCurrentMachine(),await this.machineClient.getMachines().then(t=>t.find(o=>o.isCurrent).id)):e}async getAuthenticationSession(e,t){if(this.existingSessionId){this.logService.info(`Searching for existing authentication session with ID ${this.existingSessionId}`);let n=await this.getExistingSession();if(n)return this.logService.info(`Found existing authentication session with ID ${n.session.id}`),{sessionId:n.session.id,token:n.session.idToken??n.session.accessToken,providerId:n.session.providerId};this._didSignOut.fire()}if(this.shouldAttemptEditSessionInit()){this.logService.info("Reusing user data sync enablement");let n=await bZ(this.secretStorageService,this.productService);if(n!==void 0)return this.logService.info(`Using current authentication session with ID ${n.id}`),this.existingSessionId=n.id,{sessionId:n.id,token:n.accessToken,providerId:n.providerId}}if(t)return;let o=await this.getAccountPreference(e);if(o!==void 0)return this.existingSessionId=o.id,{sessionId:o.id,token:o.idToken??o.accessToken,providerId:o.providerId}}shouldAttemptEditSessionInit(){return Wt&&this.storageService.isNew(-1)&&this.storageService.isNew(1)}async getAccountPreference(e){let t=new N,o=t.add(this.quickInputService.createQuickPick({useSeparators:!0}));return o.ok=!1,o.placeholder=e==="read"?d(10041,null):d(10040,null),o.ignoreFocusOut=!0,o.items=await this.createQuickpickItems(),new Promise((n,r)=>{t.add(o.onDidHide(s=>{r(new go),t.dispose()})),t.add(o.onDidAccept(async s=>{let l=o.selectedItems[0],c="provider"in l?{...await this.authenticationService.createSession(l.provider.id,l.provider.scopes),providerId:l.provider.id}:"session"in l?l.session:void 0;n(c),o.hide()})),o.show()})}async createQuickpickItems(){let e=[];e.push({type:"separator",label:d(10049,null)});let t=await this.getAllSessions();e.push(...t),e.push({type:"separator",label:d(10043,null)});for(let o of await this.getAuthenticationProviders())if(!t.some(r=>r.session.providerId===o.id)||this.authenticationService.getProvider(o.id).supportsMultipleAccounts){let r=this.authenticationService.getProvider(o.id).label;e.push({label:d(10047,null,r),provider:o})}return e}async getAllSessions(){let e=await this.getAuthenticationProviders(),t=new Map,o;for(let n of e){let r=await this.authenticationService.getSessions(n.id,n.scopes);for(let s of r){let l={label:s.account.label,description:this.authenticationService.getProvider(n.id).label,session:{...s,providerId:n.id}};t.set(l.session.account.id,l),this.existingSessionId===s.id&&(o=l)}}return o!==void 0&&t.set(o.session.account.id,o),[...t.values()].sort((n,r)=>n.label.localeCompare(r.label))}async getAuthenticationProviders(){if(!this.serverConfiguration)throw new Error("Unable to get configured authentication providers as session sync preference is not configured in product.json.");let e=this.serverConfiguration.authenticationProviders,t=Object.keys(e).reduce((n,r)=>(n.push({id:r,scopes:e[r].scopes}),n),[]),o=this.authenticationService.declaredProviders;return t.filter(({id:n})=>o.some(r=>r.id===n))}get existingSessionId(){return this.storageService.get(jU.CACHED_SESSION_STORAGE_KEY,-1)}set existingSessionId(e){this.logService.trace(`Saving authentication session preference for ID ${e}.`),e===void 0?this.storageService.remove(jU.CACHED_SESSION_STORAGE_KEY,-1):this.storageService.store(jU.CACHED_SESSION_STORAGE_KEY,e,-1,1)}async getExistingSession(){return(await this.getAllSessions()).find(t=>t.session.id===this.existingSessionId)}async onDidChangeStorage(){let e=this.existingSessionId,t=this.authenticationInfo?.sessionId;t!==e&&(this.logService.trace(`Resetting authentication state because authentication session ID preference changed from ${t} to ${e}.`),this.authenticationInfo=void 0,this.initialized=!1)}clearAuthenticationPreference(){this.authenticationInfo=void 0,this.initialized=!1,this.existingSessionId=void 0,this.signedInContext.set(!1)}onDidChangeSessions(e){this.authenticationInfo?.sessionId&&e.removed?.find(t=>t.id===this.authenticationInfo?.sessionId)&&this.clearAuthenticationPreference()}registerSignInAction(){if(!this.serverConfiguration?.url)return;let e=this,t="workbench.editSessions.actions.signIn",o=C.and(C.equals(O6t,!1),C.equals(HKe,!1));this._register(W(class extends K{constructor(){super({id:t,title:d(10045,null),category:X6,precondition:o,menu:[{id:D.CommandPalette},{id:D.AccountsContext,group:"2_editSessions",when:o}]})}async run(){return await e.initialize("write",!1)}})),this._register(ve.appendMenuItem(D.AccountsContext,{group:"2_editSessions",command:{id:t,title:d(10046,null)},when:C.and(C.equals(O6t,!0),C.equals(HKe,!1))}))}registerResetAuthenticationAction(){let e=this;this._register(W(class extends K{constructor(){super({id:"workbench.editSessions.actions.resetAuth",title:d(10044,null),category:X6,precondition:C.equals(HKe,!0),menu:[{id:D.CommandPalette},{id:D.AccountsContext,group:"2_editSessions",when:C.equals(HKe,!0)}]})}async run(){let o=await e.dialogService.confirm({message:d(10048,null),checkbox:{label:d(10042,null)}});o.confirmed&&(o.checkboxChecked&&e.storeClient?.deleteResource("editSessions",null),e.clearAuthenticationPreference())}}))}};jU=I([m(0,fe),m(1,ce),m(2,Ue),m(3,xs),m(4,lt),m(5,Eo),m(6,aut),m(7,tt),m(8,X),m(9,at),m(10,Dw)],jU);var zKe=class extends C1{constructor(i,e){super(),this.logger=this._register(i.createLogger(Ge(e.logsHome,`${lut}.log`),{id:lut,name:d(10066,null),group:oM}))}trace(i,...e){this.logger.trace(i,...e)}debug(i,...e){this.logger.debug(i,...e)}info(i,...e){this.logger.info(i,...e)}warn(i,...e){this.logger.warn(i,...e)}error(i,...e){this.logger.error(i,...e)}flush(){this.logger.flush()}};zKe=I([m(0,Il),m(1,Eo)],zKe);var ZUi="editSessionsCount",NSn=new Y(ZUi,0),KKe=class extends x{constructor(e,t){super();this.instantiationService=t;this.registerViews(e)}registerViews(e){let t=F6t,o=this.instantiationService.createInstance(W2,t,Bbe.value);o.showCollapseAllAction=!0,o.showRefreshAction=!0,o.dataProvider=this.instantiationService.createInstance(cut);let n=ne.as(Mn.ViewsRegistry);n.registerViews([{id:t,name:Bbe,ctorDescriptor:new Ft(AD),canToggleVisibility:!0,canMoveView:!1,treeView:o,collapsed:!1,when:C.and(W6t),order:100,hideByDefault:!0}],e),n.registerViewWelcomeContent(t,{content:d(10057,null,`[${d(10059,null)}](${fc("workbench.editSessions.actions.store")})`),when:C.equals(ZUi,0),order:1}),this._register(W(class extends K{constructor(){super({id:"workbench.editSessions.actions.resume",title:d(10062,null),icon:R.desktopDownload,menu:{id:D.ViewItemContext,when:C.and(C.equals("view",t),C.regex("viewItem",/edit-session/i)),group:"inline"}})}async run(r,s){let l=A.parse(s.$treeItemHandle).path.substring(1);await r.get(ge).executeCommand("workbench.editSessions.actions.resumeLatest",l,!0),await o.refresh()}})),this._register(W(class extends K{constructor(){super({id:"workbench.editSessions.actions.store",title:d(10063,null),icon:R.cloudUpload})}async run(r,s){await r.get(ge).executeCommand("workbench.editSessions.actions.storeCurrent"),await o.refresh()}})),this._register(W(class extends K{constructor(){super({id:"workbench.editSessions.actions.delete",title:d(10060,null),icon:R.trash,menu:{id:D.ViewItemContext,when:C.and(C.equals("view",t),C.regex("viewItem",/edit-session/i)),group:"inline"}})}async run(r,s){let l=A.parse(s.$treeItemHandle).path.substring(1),c=r.get(at),u=r.get($U);(await c.confirm({message:d(10055,null,l),detail:d(10054,null),type:"warning",title:Bbe.value})).confirmed&&(await u.delete("editSessions",l),await o.refresh())}})),this._register(W(class extends K{constructor(){super({id:"workbench.editSessions.actions.deleteAll",title:d(10061,null),icon:R.trash,menu:{id:D.ViewTitle,when:C.and(C.equals("view",t),C.greater(ZUi,0))}})}async run(r){let s=r.get(at),l=r.get($U);(await s.confirm({message:d(10052,null),detail:d(10053,null),type:"warning",title:Bbe.value})).confirmed&&(await l.delete("editSessions",null),await o.refresh())}}))}};KKe=I([m(1,F)],KKe);var cut=class{constructor(i,e,t,o){this.editSessionsStorageService=i;this.contextKeyService=e;this.workspaceContextService=t;this.fileService=o;this.editSessionsCount=NSn.bindTo(this.contextKeyService)}async getChildren(i){if(!i)return this.getAllEditSessions();let[e,t,o]=A.parse(i.handle).path.substring(1).split("/");return e&&!t?this.getEditSession(e):e&&t&&!o?this.getEditSessionFolderContents(e,t):[]}async getAllEditSessions(){let i=await this.editSessionsStorageService.list("editSessions");this.editSessionsCount.set(i.length);let e=[];for(let t of i){let o=A.from({scheme:UKe,authority:"remote-session-content",path:`/${t.ref}`}),n=await this.editSessionsStorageService.read("editSessions",t.ref);if(!n)continue;let r=JSON.parse(n.content),s=r.folders.map(p=>p.name).join(", ")??t.ref,l=r.machine,c=l?await this.editSessionsStorageService.getMachineById(l):void 0,u=c===void 0?ea(t.created,!0):`${ea(t.created,!0)}\xA0\xA0\u2022\xA0\xA0${c}`;e.push({handle:o.toString(),collapsibleState:1,label:{label:s},description:u,themeIcon:R.repo,contextValue:"edit-session"})}return e}async getEditSession(i){let e=await this.editSessionsStorageService.read("editSessions",i);if(!e)return[];let t=JSON.parse(e.content);if(t.folders.length===1){let o=t.folders[0];return this.getEditSessionFolderContents(i,o.name)}return t.folders.map(o=>({handle:A.from({scheme:UKe,authority:"remote-session-content",path:`/${e.ref}/${o.name}`}).toString(),collapsibleState:1,label:{label:o.name},themeIcon:R.folder}))}async getEditSessionFolderContents(i,e){let t=await this.editSessionsStorageService.read("editSessions",i);if(!t)return[];let o=JSON.parse(t.content),n=this.workspaceContextService.getWorkspace().folders.find(s=>s.name===e),r=o.folders.find(s=>s.name===e);return r?Promise.all(r.workingChanges.map(async s=>{let l=A.from({scheme:UKe,authority:"remote-session-content",path:`/${t.ref}/${e}/${s.relativeFilePath}`});if(n?.uri){let c=Ge(n.uri,s.relativeFilePath);if(s.type===1&&await this.fileService.exists(c))return{handle:l.toString(),resourceUri:l,collapsibleState:0,label:{label:s.relativeFilePath},themeIcon:R.file,command:{id:"vscode.diff",title:d(10051,null),arguments:[c,l,`${jo(s.relativeFilePath)} (${d(10056,null)} \u2194 ${d(10050,null)})`,void 0]}}}return{handle:l.toString(),resourceUri:l,collapsibleState:0,label:{label:s.relativeFilePath},themeIcon:R.file,command:{id:vg,title:d(10058,null),arguments:[l,void 0,void 0]}}})):[]}};cut=I([m(0,$U),m(1,X),m(2,Pe),m(3,fe)],cut);var Hbe=class{constructor(i){this.editSessionsStorageService=i;this.capabilities=2050;this.onDidChangeCapabilities=U.None;this.onDidChangeFile=U.None}static{this.SCHEMA=UKe}async readFile(i){let e=/(?<ref>[^/]+)\/(?<folderName>[^/]+)\/(?<filePath>.*)/.exec(i.path.substring(1));if(!e?.groups)throw"EntryNotFound";let{ref:t,folderName:o,filePath:n}=e.groups,r=await this.editSessionsStorageService.read("editSessions",t);if(!r)throw"EntryNotFound";let s=JSON.parse(r.content),l=s.folders.find(c=>c.name===o)?.workingChanges.find(c=>c.relativeFilePath===n);if(!l||l.type===2)throw"EntryNotFound";return V6t(s.version,l.contents).buffer}async stat(i){let e=await this.readFile(i),t=Date.now();return{type:1,permissions:1,mtime:t,ctime:t,size:e.byteLength}}watch(i,e){return x.None}async mkdir(i){}async readdir(i){return[]}async rename(i,e,t){}async delete(i,e){}async writeFile(){throw new b$}};Hbe=I([m(0,$U)],Hbe);var uut=le("IWorkspaceIdentityService"),dut=class{constructor(i,e){this.workspaceContextService=i;this.editSessionIdentityService=e}async getWorkspaceStateFolders(i){let e=[];for(let t of this.workspaceContextService.getWorkspace().folders){let o=await this.editSessionIdentityService.getEditSessionIdentifier(t,i);o&&e.push({resourceUri:t.uri.toString(),workspaceFolderIdentity:o})}return e}async matches(i,e){let t={},o={};for(let l of i)o[l.workspaceFolderIdentity]=l.resourceUri;let n=new Map;for(let l of this.workspaceContextService.getWorkspace().folders){let c=await this.editSessionIdentityService.getEditSessionIdentifier(l,e);c&&n.set(l,c)}for(let[l,c]of n.entries()){let u=o[c];if(u){t[u]=l.uri.toString();continue}let p=!1;for(let[h,g]of Object.entries(o))if(await this.editSessionIdentityService.provideEditSessionIdentityMatch(l,c,h,e)===100){t[g]=l.uri.toString(),p=!0;break}if(!p)return!1}let r=l=>{for(let c of Object.keys(t)){let u=A.parse(c);if(ws(u,l)){let p=t[c],h=Wd(u,l);if(h)return Ge(A.parse(p),h)}}return l},s=(l,c=0)=>{if(!l||c>200||l instanceof qe||l instanceof Uint8Array)return l;if(A.isUri(l))return r(l);if(Array.isArray(l))for(let u=0;u<l.length;++u)l[u]=s(l[u],c+1);else for(let u in l)Object.hasOwnProperty.call(l,u)&&(l[u]=s(l[u],c+1));return l};return s}};dut=I([m(0,Pe),m(1,s2)],dut);Ee(uut,dut,1);var e1i=class{async writeResource(){}async getAllResourceRefs(){return[]}async resolveResourceContent(){return null}},t1i=class{constructor(){this._onDidChangeEnablement=new E;this.onDidChangeEnablement=this._onDidChangeEnablement.event;this._onDidChangeResourceEnablement=new E;this.onDidChangeResourceEnablement=this._onDidChangeResourceEnablement.event}isEnabled(){return!0}canToggleEnablement(){return!0}setEnablement(i){}isResourceEnabled(i){return!0}isResourceEnablementConfigured(i){return!1}setResourceEnablement(i,e){}getResourceSyncStateVersion(i){}},GKe=class extends PH{constructor(e,t,o,n,r,s,l,c,u,p,h,g){let f=new e1i,v=new t1i;super({syncResource:"workspaceState",profile:e},t,r,s,u,o,f,v,l,n,c,p);this.workspaceIdentityService=h;this.editSessionsStorageService=g;this.version=1}async sync(){let e=new Ye,t=await this.workspaceIdentityService.getWorkspaceStateFolders(e.token);if(!t.length)return null;await this.storageService.flush();let o=this.storageService.keys(1,0);if(!o.length)return null;let n={};o.forEach(s=>{let l=this.storageService.get(s,1);l&&(n[s]=l)});let r={folders:t,storage:n,version:this.version};return await this.editSessionsStorageService.write("workspaceState",swe(r)),null}async apply(){let e=this.editSessionsStorageService.lastReadResources.get("editSessions")?.content,t=e?JSON.parse(e).workspaceStateId:void 0,o=await this.editSessionsStorageService.read("workspaceState",t);if(!o)return null;let n=am(o.content);if(!n)return this.logService.info("Skipping initializing workspace state because remote workspace state does not exist."),null;let r=new Ye,s=await this.workspaceIdentityService.matches(n.folders,r.token);if(!s)return this.logService.info("Skipping initializing workspace state because remote workspace state does not match current workspace."),null;let l={};for(let c of Object.keys(n.storage))l[c]=n.storage[c];if(Object.keys(l).length){let c=[];for(let u of Object.keys(l))try{let p=am(l[u]);s(p),c.push({key:u,value:p,scope:1,target:0})}catch{c.push({key:u,value:l[u],scope:1,target:0})}this.storageService.storeAll(c,!0)}return this.editSessionsStorageService.delete("workspaceState",o.ref),null}applyResult(e,t,o,n){throw new Error("Method not implemented.")}async generateSyncPreview(e,t,o,n,r){return[]}getMergeResult(e,t){throw new Error("Method not implemented.")}getAcceptResult(e,t,o,n){throw new Error("Method not implemented.")}async hasRemoteChanged(e){return!0}async hasLocalData(){return!1}async resolveContent(e){return null}};GKe=I([m(4,fe),m(5,Eo),m(6,Te),m(7,B),m(8,ce),m(9,ht),m(10,uut),m(11,$U)],GKe);var H6t=class extends MH{};Ee(aut,zKe,1);Ee($U,jU,1);var U6t={id:"_workbench.editSessions.actions.continueEditSession",title:L(10001,"Continue Working On..."),precondition:sT.notEqualsTo("0"),f1:!0},z6t={id:"_workbench.editSessions.actions.continueEditSession.openLocalFolder",title:L(9999,"Open In Local Folder"),category:X6,precondition:C.and(Fu.toNegated(),WR)},YMo={id:"workbench.editSessions.actions.showOutputChannel",title:L(10033,"Show Log"),category:X6},put={id:"workbench.action.continueOn.extensions",title:d(10013,null)};W(class extends K{constructor(){super({...put,f1:!1})}async run(a){return a.get(Hi).openSearch("@tag:continueOn")}});var i1i=`[${d(10031,null)}](command:${YMo.id})`,qKe={location:10,type:"syncing"},QMo="editSessionId",FSn="workbench.editSessions.continueOn",J6=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,P,O,V,H,G,$,J,ae,he){super();this.editSessionsStorageService=e;this.fileService=t;this.progressService=o;this.openerService=n;this.telemetryService=r;this.scmService=s;this.notificationService=l;this.dialogService=c;this.logService=u;this.environmentService=p;this.instantiationService=h;this.productService=g;this.configurationService=f;this.contextService=v;this.editSessionIdentityService=b;this.quickInputService=S;this.commandService=y;this.contextKeyService=w;this.fileDialogService=k;this.lifecycleService=T;this.storageService=P;this.activityService=O;this.editorService=V;this.remoteAgentService=H;this.extensionService=G;this.requestService=$;this.userDataProfilesService=J;this.uriIdentityService=ae;this.workspaceIdentityService=he;this.continueEditSessionOptions=[];this.accountsMenuBadgeDisposable=this._register(new me);this.registeredCommands=new Set;this.shouldShowViewsContext=W6t.bindTo(this.contextKeyService),this.pendingEditSessionsContext=qMo.bindTo(this.contextKeyService),this.pendingEditSessionsContext.set(!1),this.productService["editSessions.store"]?.url&&(this.editSessionsStorageClient=new H6t(A.parse(this.productService["editSessions.store"].url),this.productService,this.requestService,this.logService,this.environmentService,this.fileService,this.storageService),this.editSessionsStorageService.storeClient=this.editSessionsStorageClient,this.workspaceStateSynchronizer=new GKe(this.userDataProfilesService.defaultProfile,void 0,this.editSessionsStorageClient,this.logService,this.fileService,this.environmentService,this.telemetryService,this.configurationService,this.storageService,this.uriIdentityService,this.workspaceIdentityService,this.editSessionsStorageService),this.autoResumeEditSession(),this.registerActions(),this.registerViews(),this.registerContributedEditSessionOptions(),this._register(this.fileService.registerProvider(Hbe.SCHEMA,new Hbe(this.editSessionsStorageService))),this._register(this.lifecycleService.onWillShutdown(oe=>{oe.reason!==3&&this.editSessionsStorageService.isSignedIn&&this.configurationService.getValue("workbench.experimental.cloudChanges.autoStore")==="onShutdown"&&!Wt&&oe.join(this.autoStoreEditSession(),{id:"autoStoreWorkingChanges",label:d(9991,null)})})),this._register(this.editSessionsStorageService.onDidSignIn(()=>this.updateAccountsMenuBadge())),this._register(this.editSessionsStorageService.onDidSignOut(()=>this.updateAccountsMenuBadge())))}static{this.APPLICATION_LAUNCHED_VIA_CONTINUE_ON_STORAGE_KEY="applicationLaunchedViaContinueOn"}async autoResumeEditSession(){let e=this.configurationService.getValue("workbench.cloudChanges.autoResume")==="onReload";if(this.environmentService.editSessionId!==void 0)this.logService.info(`Resuming cloud changes, reason: found editSessionId ${this.environmentService.editSessionId} in environment service...`),await this.progressService.withProgress(qKe,async t=>await this.resumeEditSession(this.environmentService.editSessionId,void 0,void 0,void 0,t).finally(()=>this.environmentService.editSessionId=void 0));else if(e&&this.editSessionsStorageService.isSignedIn)this.logService.info("Resuming cloud changes, reason: cloud changes enabled..."),await this.progressService.withProgress(qKe,async t=>await this.resumeEditSession(void 0,!0,void 0,void 0,t));else if(e){let t=this.storageService.getBoolean(J6.APPLICATION_LAUNCHED_VIA_CONTINUE_ON_STORAGE_KEY,-1,!1);this.logService.info(`Prompting to enable cloud changes, has application previously launched from Continue On flow: ${t}`);let o=()=>{this.logService.info("Showing badge to enable cloud changes in accounts menu..."),this.updateAccountsMenuBadge(),this.pendingEditSessionsContext.set(!0);let n=this.editSessionsStorageService.onDidSignIn(async()=>{n.dispose(),this.logService.info("Showing badge to enable cloud changes in accounts menu succeeded, resuming cloud changes..."),await this.progressService.withProgress(qKe,async r=>await this.resumeEditSession(void 0,!0,void 0,void 0,r)),this.storageService.remove(J6.APPLICATION_LAUNCHED_VIA_CONTINUE_ON_STORAGE_KEY,-1),this.environmentService.continueOn=void 0})};this.environmentService.continueOn!==void 0&&!this.editSessionsStorageService.isSignedIn&&t===!1?(this.storageService.store(J6.APPLICATION_LAUNCHED_VIA_CONTINUE_ON_STORAGE_KEY,!0,-1,1),this.logService.info("Prompting to enable cloud changes..."),await this.editSessionsStorageService.initialize("read"),this.editSessionsStorageService.isSignedIn?(this.logService.info("Prompting to enable cloud changes succeeded, resuming cloud changes..."),await this.progressService.withProgress(qKe,async n=>await this.resumeEditSession(void 0,!0,void 0,void 0,n))):o()):!this.editSessionsStorageService.isSignedIn&&t===!0&&o()}else this.logService.debug("Auto resuming cloud changes disabled.")}updateAccountsMenuBadge(){if(this.editSessionsStorageService.isSignedIn)return this.accountsMenuBadgeDisposable.clear();let e=new Rd(1,()=>d(9995,null));this.accountsMenuBadgeDisposable.value=this.activityService.showAccountsActivity({badge:e})}async autoStoreEditSession(){let e=new Ye;await this.progressService.withProgress({location:10,type:"syncing",title:d(10034,null)},async()=>this.storeEditSession(!1,e.token),()=>{e.cancel(),e.dispose()})}registerViews(){let e=ne.as(Mn.ViewContainersRegistry).registerViewContainer({id:JUi,title:Bbe,ctorDescriptor:new Ft(Dc,[JUi,{mergeViewWithContainerWhenSingleView:!0}]),icon:$Mo,hideIfEmpty:!0},0,{doNotRegisterOpenCommand:!0});this._register(this.instantiationService.createInstance(KKe,e))}registerActions(){this.registerContinueEditSessionAction(),this.registerResumeLatestEditSessionAction(),this.registerStoreLatestEditSessionAction(),this.registerContinueInLocalFolderAction(),this.registerShowEditSessionViewAction(),this.registerShowEditSessionOutputChannelAction()}registerShowEditSessionOutputChannelAction(){this._register(W(class extends K{constructor(){super(YMo)}run(t,...o){t.get(kl).showChannel(lut)}}))}registerShowEditSessionViewAction(){let e=this;this._register(W(class extends K{constructor(){super({id:"workbench.editSessions.actions.showEditSessions",title:L(10032,"Show Cloud Changes"),category:X6,f1:!0})}async run(o){e.shouldShowViewsContext.set(!0),await o.get($t).openView(F6t)}}))}registerContinueEditSessionAction(){let e=this;this._register(W(class extends K{constructor(){super(U6t)}async run(o,n,r){let s=n;if(!r&&!s&&(r=await e.pickContinueEditSessionDestination(),!r)){e.telemetryService.publicLog2("continueOn.editSessions.pick.outcome",{outcome:"noSelection"});return}let l=await e.shouldContinueOnWithEditSession(),c;if(l){e.telemetryService.publicLog2("continueOn.editSessions.store");let u=new Ye;try{c=await e.progressService.withProgress({location:15,cancellable:!0,type:"syncing",title:d(10036,null)},async()=>{let p=await e.storeEditSession(!1,u.token);return p!==void 0?e.telemetryService.publicLog2("continueOn.editSessions.store.outcome",{outcome:"storeSucceeded",hashedId:B6t(p)}):e.telemetryService.publicLog2("continueOn.editSessions.store.outcome",{outcome:"storeSkipped"}),p},()=>{u.cancel(),u.dispose(),e.telemetryService.publicLog2("continueOn.editSessions.store.outcome",{outcome:"storeCancelledByUser"})})}catch(p){throw e.telemetryService.publicLog2("continueOn.editSessions.store.outcome",{outcome:"storeFailed"}),p}}if(s=r?await e.resolveDestination(r):s,s!==void 0)if(c!==void 0&&s!=="noDestinationUri"){let u=encodeURIComponent(c);s=s.with({query:s.query.length>0?s.query+`&${QMo}=${u}&continueOn=1`:`${QMo}=${u}&continueOn=1`}),e.logService.info(`Opening ${s.toString()}`),await e.openerService.open(s,{openExternal:!0})}else(!l||c===void 0)&&s!=="noDestinationUri"?(e.logService.info(`Opening ${s.toString()}`),await e.openerService.open(s,{openExternal:!0})):c===void 0&&l&&e.logService.warn(`Failed to store working changes when invoking ${U6t.id}.`)}}))}registerResumeLatestEditSessionAction(){let e=this;this._register(W(class extends K{constructor(){super({id:"workbench.editSessions.actions.resumeLatest",title:L(10030,"Resume Latest Changes from Cloud"),category:X6,f1:!0})}async run(o,n,r){await e.progressService.withProgress({...qKe,title:i1i},async()=>await e.resumeEditSession(n,void 0,r))}})),this._register(W(class extends K{constructor(){super({id:"workbench.editSessions.actions.resumeFromSerializedPayload",title:L(10026,"Resume Changes from Serialized Data"),category:"Developer",f1:!0})}async run(o,n){let r=await e.quickInputService.input({prompt:"Enter serialized data"});r&&e.editSessionsStorageService.lastReadResources.set("editSessions",{content:r,ref:""}),await e.progressService.withProgress({...qKe,title:i1i},async()=>await e.resumeEditSession(n,void 0,void 0,void 0,void 0,r))}}))}registerStoreLatestEditSessionAction(){let e=this;this._register(W(class extends K{constructor(){super({id:"workbench.editSessions.actions.storeCurrent",title:L(10035,"Store Working Changes in Cloud"),category:X6,f1:!0})}async run(o){let n=new Ye;await e.progressService.withProgress({location:15,title:d(10037,null)},async()=>{e.telemetryService.publicLog2("editSessions.store"),await e.storeEditSession(!0,n.token)},()=>{n.cancel(),n.dispose()})}}))}async resumeEditSession(e,t,o,n,r,s){if(await this.remoteAgentService.getEnvironment(),this.contextService.getWorkbenchState()===1||(this.logService.info(e!==void 0?`Resuming changes from cloud with ref ${e}...`:"Checking for pending cloud changes..."),t&&!await this.editSessionsStorageService.initialize("read",!0)))return;this.telemetryService.publicLog2("editSessions.resume"),performance.mark("code/willResumeEditSessionFromIdentifier"),r?.report({message:d(9996,null)});let l=s?{content:s,ref:""}:await this.editSessionsStorageService.read("editSessions",e);if(!l){e===void 0&&!t?this.notificationService.info(d(10020,null)):e!==void 0&&this.notificationService.warn(d(10021,null,e)),this.logService.info(e!==void 0?`Aborting resuming changes from cloud as no edit session content is available to be applied from ref ${e}.`:"Aborting resuming edit session as no edit session content is available to be applied");return}r?.report({message:i1i});let c=JSON.parse(l.content);if(e=l.ref,c.version>KMo){this.notificationService.error(d(9997,null,this.productService.nameLong)),this.telemetryService.publicLog2("editSessions.resume.outcome",{hashedId:B6t(e),outcome:"clientUpdateNeeded"});return}try{let{changes:u,conflictingChanges:p}=await this.generateChanges(c,e,o,n);if(u.length===0)return;if(p.length>0){let{confirmed:h}=await this.dialogService.confirm({type:ft.Warning,message:p.length>1?d(10028,null,p.length):d(10027,null,He(p[0].uri)),detail:p.length>1?kC(p.map(g=>g.uri)):void 0});if(!h)return}for(let{uri:h,type:g,contents:f}of u)g===1?await this.fileService.writeFile(h,V6t(c.version,f)):g===2&&await this.fileService.exists(h)&&await this.fileService.del(h);await this.workspaceStateSynchronizer?.apply(),this.logService.info(`Deleting edit session with ref ${e} after successfully applying it to current workspace...`),await this.editSessionsStorageService.delete("editSessions",e),this.logService.info(`Deleted edit session with ref ${e}.`),this.telemetryService.publicLog2("editSessions.resume.outcome",{hashedId:B6t(e),outcome:"resumeSucceeded"})}catch(u){this.logService.error("Failed to resume edit session, reason: ",u.toString()),this.notificationService.error(d(10029,null))}performance.mark("code/didResumeEditSessionFromIdentifier")}async generateChanges(e,t,o=!1,n=!1){let r=[],s=[],l=this.contextService.getWorkspace().folders,c=new Ye;for(let u of e.folders){let p;if(u.canonicalIdentity)for(let g of l){let f=await this.editSessionIdentityService.getEditSessionIdentifier(g,c.token);if(this.logService.info(`Matching identity ${f} against edit session folder identity ${u.canonicalIdentity}...`),eo(f,u.canonicalIdentity)||o){p=g;break}if(f!==void 0){let v=await this.editSessionIdentityService.provideEditSessionIdentityMatch(g,f,u.canonicalIdentity,c.token);if(v===100){p=g;break}else if(v===50&&this.configurationService.getValue("workbench.experimental.cloudChanges.partialMatches.enabled")===!0)if(!n)this.notificationService.prompt(ft.Info,d(10018,null),[{label:d(10025,null),run:()=>this.resumeEditSession(t,!1,void 0,!0)}]);else{p=g;break}}}else p=l.find(g=>g.name===u.name);if(!p)return this.logService.info(`Skipping applying ${u.workingChanges.length} changes from edit session with ref ${t} as no matching workspace folder was found.`),{changes:[],conflictingChanges:[],contributedStateHandlers:[]};let h=new Set;for(let g of this.scmService.repositories)g.provider.rootUri!==void 0&&this.contextService.getWorkspaceFolder(g.provider.rootUri)?.name===u.name&&this.getChangedResources(g).forEach(v=>h.add(v.toString()));for(let g of u.workingChanges){let f=Ge(p.uri,g.relativeFilePath);r.push({uri:f,type:g.type,contents:g.contents}),await this.willChangeLocalContents(h,f,g)&&s.push({uri:f,type:g.type,contents:g.contents})}}return{changes:r,conflictingChanges:s}}async willChangeLocalContents(e,t,o){if(!e.has(t.toString()))return!1;let{contents:n,type:r}=o;switch(r){case 1:{let[s,l]=await Promise.all([vV(n),vV(Yd((await this.fileService.readFile(t)).value))]);return s!==l}case 2:return await this.fileService.exists(t);default:throw new Error("Unhandled change type.")}}async storeEditSession(e,t){let o=[],n=0,r=!1;await this.editorService.saveAll();let s=new En;for(let c of this.scmService.repositories){let u=this.getChangedResources(c);if(u.size)for(let p of u){let h=this.contextService.getWorkspaceFolder(p);!h||s.has(p)||(s.add(p),await this.editSessionIdentityService.onWillCreateEditSessionIdentity(h,t))}}for(let c of this.scmService.repositories){let u=this.getChangedResources(c),p=[],{rootUri:h}=c.provider,g=h?this.contextService.getWorkspaceFolder(h):void 0,f=g?.name;for(let b of u){let S=this.contextService.getWorkspaceFolder(b);if(!S){this.logService.info(`Skipping working change ${b.toString()} as no associated workspace folder was found.`);continue}f=f??S.name;let y=Wd(S.uri,b)??b.path;try{if(!(await this.fileService.stat(b)).isFile)continue}catch{}if(r=!0,await this.fileService.exists(b)){let w=Yd((await this.fileService.readFile(b)).value);if(n+=w.length,n>this.editSessionsStorageService.SIZE_LIMIT){this.notificationService.error(d(10024,null));return}p.push({type:1,fileType:1,contents:w,relativeFilePath:y})}else p.push({type:2,fileType:1,contents:void 0,relativeFilePath:y})}let v;g!=null&&(v=await this.editSessionIdentityService.getEditSessionIdentifier(g,t)),o.push({workingChanges:p,name:f??"",canonicalIdentity:v??void 0,absoluteUri:g?.uri.toString()})}if(await this.workspaceStateSynchronizer?.sync(),!r){this.logService.info("Skipped storing working changes in the cloud as there are no edits to store."),e&&this.notificationService.info(d(10022,null));return}let l={folders:o,version:2,workspaceStateId:this.editSessionsStorageService.lastWrittenResources.get("workspaceState")?.ref};try{this.logService.info("Storing edit session...");let c=await this.editSessionsStorageService.write("editSessions",l);return this.logService.info(`Stored edit session with ref ${c}.`),c}catch(c){this.logService.error("Failed to store edit session, reason: ",c.toString()),c instanceof Fm&&(c.code==="TooLarge"?(this.telemetryService.publicLog2("editSessions.upload.failed",{reason:"TooLarge"}),this.notificationService.error(d(10024,null))):(this.telemetryService.publicLog2("editSessions.upload.failed",{reason:"unknown"}),this.notificationService.error(d(10023,null))))}}getChangedResources(e){return e.provider.groups.reduce((t,o)=>(o.resources.forEach(n=>t.add(n.sourceUri)),t),new Set)}hasEditSession(){for(let e of this.scmService.repositories)if(this.getChangedResources(e).size>0)return!0;return!1}async shouldContinueOnWithEditSession(){if(this.editSessionsStorageService.isSignedIn)return this.hasEditSession();if(this.configurationService.getValue(FSn)==="off")return this.telemetryService.publicLog2("continueOn.editSessions.canStore.outcome",{outcome:"disabledEditSessionsViaSetting"}),!1;if(this.hasEditSession()){let e=new N,t=e.add(this.quickInputService.createQuickPick());t.placeholder=d(10000,null),t.ok=!1,t.ignoreFocusOut=!0;let o={label:d(10038,null)},n={label:d(10039,null)};t.items=[o,n];let r=await new Promise((l,c)=>{e.add(t.onDidAccept(()=>{l(t.selectedItems[0]===o),e.dispose()})),e.add(t.onDidHide(()=>{c(new go),e.dispose()})),t.show()});if(!r)return this.telemetryService.publicLog2("continueOn.editSessions.canStore.outcome",{outcome:"didNotEnableEditSessionsWhenPrompted"}),r;let s=await this.editSessionsStorageService.initialize("write");return s||this.telemetryService.publicLog2("continueOn.editSessions.canStore.outcome",{outcome:"didNotEnableEditSessionsWhenPrompted"}),s}return!1}registerContributedEditSessionOptions(){VSn.setHandler(e=>{let t=[];for(let o of e)if(Ua(o.description,"contribEditSessions")&&Array.isArray(o.value))for(let n of o.value){let r=ve.getCommand(n.command);if(!r)return;let s=r.icon,l=typeof r.title=="string"?r.title:r.title.value,c=C.deserialize(n.when);t.push(new mut(q.isThemeIcon(s)?`$(${s.id}) ${l}`:l,r.id,r.source?.title,c,n.documentation)),n.qualifiedName&&this.generateStandaloneOptionCommand(r.id,n.qualifiedName,n.category??r.category,c,n.remoteGroup)}this.continueEditSessionOptions=t})}generateStandaloneOptionCommand(e,t,o,n,r){let s={id:`${U6t.id}.${e}`,title:{original:t,value:t},category:typeof o=="string"?{original:o,value:o}:o,precondition:n,f1:!0};this.registeredCommands.has(s.id)||(this.registeredCommands.add(s.id),this._register(W(class extends K{constructor(){super(s)}async run(c){return c.get(ge).executeCommand(U6t.id,void 0,e)}})),r!==void 0&&ve.appendMenuItem(D.StatusBarRemoteIndicatorMenu,{group:r,command:s,when:s.precondition}))}registerContinueInLocalFolderAction(){let e=this;this._register(W(class extends K{constructor(){super(z6t)}async run(o){let n=await e.fileDialogService.showOpenDialog({title:d(10002,null),canSelectFolders:!0,canSelectMany:!1,canSelectFiles:!1,availableFileSystems:[Q.file]});return n?.length!==1?void 0:A.from({scheme:e.productService.urlProtocol,authority:Q.file,path:n[0].path})}})),FR(this.contextService.getWorkspace())!==void 0&&Vr&&this.generateStandaloneOptionCommand(z6t.id,d(10017,null),void 0,z6t.precondition,void 0)}async pickContinueEditSessionDestination(){let e=new N,t=e.add(this.quickInputService.createQuickPick({useSeparators:!0})),o=this.contextService.getWorkbenchState()===2?this.contextService.getWorkspace().folders[0].name:this.contextService.getWorkspace().folders.map(r=>r.name).join(", ");t.placeholder=d(10012,null,`'${o}'`),t.items=this.createPickItems(),e.add(this.extensionService.onDidChangeExtensions(()=>{t.items=this.createPickItems()}));let n=await new Promise((r,s)=>{e.add(t.onDidHide(()=>{e.dispose(),r(void 0)})),e.add(t.onDidAccept(l=>{let c=t.activeItems[0].command;c===put.id?this.commandService.executeCommand(put.id):(r(c),t.hide())})),t.show(),e.add(t.onDidTriggerItemButton(async l=>{if(l.item.documentation!==void 0){let c=A.isUri(l.item.documentation)?A.parse(l.item.documentation):await this.commandService.executeCommand(l.item.documentation);c&&this.openerService.open(c,{openExternal:!0})}}))});return t.dispose(),n}async resolveDestination(e){try{let t=await this.commandService.executeCommand(e);if(t===void 0)return this.telemetryService.publicLog2("continueOn.openDestination.outcome",{selection:e,outcome:"noDestinationUri"}),"noDestinationUri";if(A.isUri(t))return this.telemetryService.publicLog2("continueOn.openDestination.outcome",{selection:e,outcome:"resolvedUri"}),t;this.telemetryService.publicLog2("continueOn.openDestination.outcome",{selection:e,outcome:"invalidDestination"});return}catch(t){t instanceof go?this.telemetryService.publicLog2("continueOn.openDestination.outcome",{selection:e,outcome:"cancelled"}):this.telemetryService.publicLog2("continueOn.openDestination.outcome",{selection:e,outcome:"unknownError"});return}}createPickItems(){let e=[...this.continueEditSessionOptions].filter(o=>o.when===void 0||this.contextKeyService.contextMatchesRules(o.when));return FR(this.contextService.getWorkspace())!==void 0&&Vr&&e.push(new mut("$(folder) "+d(10011,null),z6t.id,d(10010,null))),e.sort((o,n)=>o.label.localeCompare(n.label)).concat({type:"separator"},new mut(put.title,put.id))}};J6=I([m(0,$U),m(1,fe),m(2,Fo),m(3,Je),m(4,Te),m(5,rd),m(6,Ne),m(7,at),m(8,aut),m(9,Eo),m(10,F),m(11,tt),m(12,B),m(13,Pe),m(14,s2),m(15,Ue),m(16,ge),m(17,X),m(18,rn),m(19,ji),m(20,ce),m(21,Sl),m(22,ee),m(23,bo),m(24,lt),m(25,Ea),m(26,an),m(27,ht),m(28,uut)],J6);var WSn=q.asClassName(R.info),mut=class{constructor(i,e,t,o,n){this.label=i;this.command=e;this.description=t;this.when=o;this.documentation=n;n!==void 0&&(this.buttons=[{iconClass:WSn,tooltip:d(10019,null)}])}},VSn=Rn.registerExtensionPoint({extensionPoint:"continueEditSession",jsonSchema:{description:d(10003,null),type:"array",items:{type:"object",properties:{command:{description:d(10004,null),type:"string"},group:{description:d(10006,null),type:"string"},qualifiedName:{description:d(10007,null),type:"string"},description:{description:d(10005,null),type:"string"},remoteGroup:{description:d(10008,null),type:"string"},when:{description:d(10009,null),type:"string"}},required:["command"]}}}),BSn=ne.as(Qi.Workbench);BSn.registerWorkbenchContribution(J6,3);ne.as(Jt.Configuration).registerConfiguration({...Ud,properties:{"workbench.experimental.cloudChanges.autoStore":{enum:["onShutdown","off"],enumDescriptions:[d(9993,null),d(9992,null)],type:"string",tags:["experimental","usesOnlineServices"],default:"off",markdownDescription:d(9994,null)},"workbench.cloudChanges.autoResume":{enum:["onReload","off"],enumDescriptions:[d(9990,null),d(9989,null)],type:"string",tags:["usesOnlineServices"],default:"onReload",markdownDescription:d(9988,null)},"workbench.cloudChanges.continueOn":{enum:["prompt","off"],enumDescriptions:[d(10016,null),d(10015,null)],type:"string",tags:["usesOnlineServices"],default:"prompt",markdownDescription:d(10014,null)},"workbench.experimental.cloudChanges.partialMatches.enabled":{type:"boolean",tags:["experimental","usesOnlineServices"],default:!1,markdownDescription:d(9998,null)}}});var HSn=Rn.registerExtensionPoint({extensionPoint:"remoteCodingAgents",jsonSchema:{description:d(13531,null),type:"array",items:{type:"object",properties:{id:{description:d(13536,null),type:"string"},command:{description:d(13532,null),type:"string"},displayName:{description:d(13534,null),type:"string"},description:{description:d(13533,null),type:"string"},followUpRegex:{description:d(13535,null),type:"string"},when:{description:d(13537,null),type:"string"}},required:["command","displayName"]}}}),hut=class extends x{constructor(e){super();this.remoteCodingAgentsService=e;HSn.setHandler(t=>{for(let o of t)if(Ua(o.description,"remoteCodingAgents")&&Array.isArray(o.value))for(let n of o.value){if(!ve.getCommand(n.command))continue;let s={id:n.id,command:n.command,displayName:n.displayName,description:n.description,followUpRegex:n.followUpRegex,when:n.when};this.remoteCodingAgentsService.registerAgent(s)}})}};hut=I([m(0,qst)],hut);var USn=ne.as(Qi.Workbench);USn.registerWorkbenchContribution(hut,3);var zSn=a=>({type:"string",enum:["always","explicit","never",!0,!1],enumDescriptions:[d(8775,null),d(8780,null),d(8784,null),d(8781,null),d(8785,null)],default:"explicit",description:a}),KSn=a=>({type:["string","boolean"],enum:["explicit","never",!0,!1],enumDescriptions:[d(8778,null),d(8782,null),d(8779,null),d(8783,null)],default:"explicit",description:a}),o1i={oneOf:[{type:"object",additionalProperties:{type:"string"}},{type:"array",items:{type:"string"}}],markdownDescription:d(8777,null,"`#files.autoSave#`"),type:["object","array"],additionalProperties:{type:"string",enum:["always","explicit","never",!0,!1]},default:{},scope:6},r1i=Object.freeze({...RC,properties:{"editor.codeActionsOnSave":o1i}}),n1i={oneOf:[{type:"object",additionalProperties:{type:"string"}},{type:"array",items:{type:"string"}}],markdownDescription:d(8786,null,"`#files.autoSave#`"),type:"object",additionalProperties:{type:["string","boolean"],enum:["explicit","never",!0,!1]},default:{}},XMo=Object.freeze({...RC,properties:{"notebook.codeActionsOnSave":n1i}}),$Ke=class extends x{constructor(e,t){super();this.languageFeatures=t;this._onDidChangeSchemaContributions=this._register(new E);this._allProvidedCodeActionKinds=[];this._register(U.runAndSubscribe(U.debounce(t.codeActionProvider.onDidChange,()=>{},1e3),()=>{this._allProvidedCodeActionKinds=this.getAllProvidedCodeActionKinds(),this.updateConfigurationSchema(this._allProvidedCodeActionKinds),this._onDidChangeSchemaContributions.fire()})),this._register(e.registerSchemaContribution({getSchemaAdditions:()=>this.getKeybindingSchemaAdditions(),onDidChange:this._onDidChangeSchemaContributions.event}))}getAllProvidedCodeActionKinds(){let e=new Map;for(let t of this.languageFeatures.codeActionProvider.allNoModel())for(let o of t.providedCodeActionKinds??[])e.set(o,new fs(o));return Array.from(e.values())}updateConfigurationSchema(e){let t={...o1i.properties},o={...n1i.properties};for(let n of e)xr.Source.contains(n)&&!t[n.value]&&(t[n.value]=zSn(d(8776,null,n.value)),o[n.value]=KSn(d(8776,null,n.value)));o1i.properties=t,n1i.properties=o,ne.as(Jt.Configuration).notifyConfigurationSchemaUpdated(r1i)}getKeybindingSchemaAdditions(){let e=(o,n)=>({if:{required:["command"],properties:{command:{const:o}}},then:{properties:{args:{required:["kind"],properties:{kind:{anyOf:[{enum:Array.from(n)},{type:"string"}]}}}}}}),t=o=>{let n=new Set;for(let r of this._allProvidedCodeActionKinds)o.contains(r)&&n.add(r.value);return Array.from(n)};return[e(cxe,t(fs.Empty)),e(uxe,t(xr.Refactor)),e(pxe,t(xr.Source))]}};$Ke=I([m(0,_e),m(1,Qt)],$Ke);ne.as(Jt.Configuration).registerConfiguration(r1i);ne.as(Jt.Configuration).registerConfiguration(XMo);ne.as(Qi.Workbench).registerWorkbenchContribution($Ke,4);var K6t=new Y("timelineHasProvider",!1),jKe=class extends x{constructor(e,t,o,n){super();this.logService=e;this.viewsService=t;this.configurationService=o;this.contextKeyService=n;this._onDidChangeProviders=this._register(new E);this.onDidChangeProviders=this._onDidChangeProviders.event;this._onDidChangeTimeline=this._register(new E);this.onDidChangeTimeline=this._onDidChangeTimeline.event;this._onDidChangeUri=this._register(new E);this.onDidChangeUri=this._onDidChangeUri.event;this.providers=new Map;this.providerSubscriptions=this._register(new Vt);this.hasProviderContext=K6t.bindTo(this.contextKeyService),this.updateHasProviderContext()}getSources(){return[...this.providers.values()].map(e=>({id:e.id,label:e.label}))}getTimeline(e,t,o,n){this.logService.trace(`TimelineService#getTimeline(${e}): uri=${t.toString()}`);let r=this.providers.get(e);if(r!==void 0){if(typeof r.scheme=="string"){if(r.scheme!=="*"&&r.scheme!==t.scheme)return}else if(!r.scheme.includes(t.scheme))return;return{result:r.provideTimeline(t,o,n.token).then(s=>{if(s!==void 0)return s.items=s.items.map(l=>({...l,source:r.id})),s.items.sort((l,c)=>c.timestamp-l.timestamp||c.source.localeCompare(l.source,void 0,{numeric:!0,sensitivity:"base"})),s}),options:o,source:r.id,tokenSource:n,uri:t}}}registerTimelineProvider(e){this.logService.trace(`TimelineService#registerTimelineProvider: id=${e.id}`);let t=e.id,o=this.providers.get(t);if(o)try{o?.dispose()}catch{}return this.providers.set(t,e),this.updateHasProviderContext(),e.onDidChange&&this.providerSubscriptions.set(t,e.onDidChange(n=>this._onDidChangeTimeline.fire(n))),this._onDidChangeProviders.fire({added:[t]}),{dispose:()=>{this.providers.delete(t),this._onDidChangeProviders.fire({removed:[t]})}}}unregisterTimelineProvider(e){this.logService.trace(`TimelineService#unregisterTimelineProvider: id=${e}`),this.providers.has(e)&&(this.providers.delete(e),this.providerSubscriptions.deleteAndDispose(e),this.updateHasProviderContext(),this._onDidChangeProviders.fire({removed:[e]}))}setUri(e){this.viewsService.openView(hNt,!0),this._onDidChangeUri.fire(e)}updateHasProviderContext(){this.hasProviderContext.set(this.providers.size!==0)}};jKe=I([m(0,se),m(1,$t),m(2,B),m(3,X)],jKe);var ZMo=22;function G6t(a){return a instanceof but}function vut(a){return!!a&&!a.handle.startsWith("vscode-command:")}function JMo(a,i){return a.relativeTime=vut(a)?ea(a.timestamp):void 0,a.relativeTimeFullWord=vut(a)?ea(a.timestamp,!1,!0):void 0,i===void 0||a.relativeTime!==i?(i=a.relativeTime,a.hideRelativeTime=!1):a.hideRelativeTime=!0,i}var s1i=class{constructor(i){this._stale=!1;this._requiresReset=!1;this.source=i.source,this.items=i.items,this._cursor=i.paging?.cursor,this.lastRenderedIndex=-1}get cursor(){return this._cursor}get more(){return this._cursor!==void 0}get newest(){return this.items[0]}get oldest(){return this.items[this.items.length-1]}add(i,e){let t=!1;if(i.items.length!==0&&this.items.length!==0){t=!0;let o=new Set,n=new Set;for(let l of i.items)l.id===void 0?n.add(l.timestamp):o.add(l.id);let r=this.items.length,s;for(;r--;)s=this.items[r],(s.id!==void 0&&o.has(s.id)||n.has(s.timestamp))&&this.items.splice(r,1);(i.items[i.items.length-1]?.timestamp??0)>=(this.newest?.timestamp??0)?this.items.splice(0,0,...i.items):this.items.push(...i.items)}else i.items.length!==0&&(t=!0,this.items.push(...i.items));return(e.cursor!==void 0||typeof e.limit!="object")&&(this._cursor=i.paging?.cursor),t&&this.items.sort((o,n)=>n.timestamp-o.timestamp||(o.source===void 0?n.source===void 0?0:1:n.source===void 0?-1:n.source.localeCompare(o.source,void 0,{numeric:!0,sensitivity:"base"}))),t}get stale(){return this._stale}get requiresReset(){return this._requiresReset}invalidate(i){this._stale=!0,this._requiresReset=i}},but=class{constructor(i){this.handle="vscode-command:loadMore";this.timestamp=0;this.description=void 0;this.tooltip=void 0;this.contextValue=void 0;this.id=void 0;this.icon=void 0;this.iconDark=void 0;this.source=void 0;this.relativeTime=void 0;this.relativeTimeFullWord=void 0;this.hideRelativeTime=void 0;this._loading=!1;this._loading=i}get loading(){return this._loading}set loading(i){this._loading=i}get ariaLabel(){return this.label}get label(){return this.loading?d(16174,null):d(16175,null)}get themeIcon(){}},a1i=new Y("timelineFollowActiveEditor",!0,!0),GSn=new Y("timelineExcludeSources","[]",!0),qSn=new Y("timelineFocused",!0),Ure=class extends Gs{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w){super({...e,titleMenuId:D.TimelineTitle},t,o,r,n,l,c,f,v,b);this.storageService=s;this.editorService=u;this.commandService=p;this.progressService=h;this.timelineService=g;this.labelService=S;this.uriIdentityService=y;this.extensionService=w;this.pendingRequests=new Map;this.timelinesBySource=new Map;this._followActiveEditor=!0;this._isEmpty=!0;this._maxItemCount=0;this._visibleItemCount=0;this._pendingRefresh=!1;this.commands=this._register(this.instantiationService.createInstance(fut,this)),this.followActiveEditorContext=a1i.bindTo(this.contextKeyService),this.timelineExcludeSourcesContext=GSn.bindTo(this.contextKeyService);let k=s.get("timeline.excludeSources",0,"[]");this.timelineExcludeSourcesContext.set(k),this.excludedSources=new Set(JSON.parse(k)),this._register(s.onDidChangeValue(0,"timeline.excludeSources",this._store)(this.onStorageServiceChanged,this)),this._register(r.onDidChangeConfiguration(this.onConfigurationChanged,this)),this._register(g.onDidChangeProviders(this.onProvidersChanged,this)),this._register(g.onDidChangeTimeline(this.onTimelineChanged,this)),this._register(g.onDidChangeUri(T=>this.setUri(T),this))}static{this.TITLE=L(16169,"Timeline")}get followActiveEditor(){return this._followActiveEditor}set followActiveEditor(e){this._followActiveEditor!==e&&(this._followActiveEditor=e,this.followActiveEditorContext.set(e),this.updateFilename(this._filename),e&&this.onActiveEditorChanged())}get pageOnScroll(){return this._pageOnScroll===void 0&&(this._pageOnScroll=this.configurationService.getValue("timeline.pageOnScroll")??!1),this._pageOnScroll}get pageSize(){let e=this.configurationService.getValue("timeline.pageSize");return e==null&&(e=Math.max(20,Math.floor((this.tree?.renderHeight??0/ZMo)+(this.pageOnScroll?1:-1)))),e}reset(){this.loadTimeline(!0)}setUri(e){this.setUriCore(e,!0)}setUriCore(e,t){t&&(this.followActiveEditor=!1),this.uri=e,this.updateFilename(e?this.labelService.getUriBasenameLabel(e):void 0),this.treeRenderer?.setUri(e),this.loadTimeline(!0)}onStorageServiceChanged(){let e=this.storageService.get("timeline.excludeSources",0,"[]");this.timelineExcludeSourcesContext.set(e),this.excludedSources=new Set(JSON.parse(e));let t=this.timelineService.getSources().filter(({id:o})=>!this.excludedSources.has(o)&&!this.timelinesBySource.has(o));t.length!==0?this.loadTimeline(!0,t.map(({id:o})=>o)):this.refresh()}onConfigurationChanged(e){e.affectsConfiguration("timeline.pageOnScroll")&&(this._pageOnScroll=void 0)}onActiveEditorChanged(){if(!this.followActiveEditor||!this.isExpanded())return;let e=po.getOriginalUri(this.editorService.activeEditor,{supportSideBySide:1});if(this.uriIdentityService.extUri.isEqual(e,this.uri)&&e!==void 0||e?.fsPath===this.uri?.fsPath&&(e?.scheme===Q.file||e?.scheme==="git")&&(this.uri?.scheme===Q.file||this.uri?.scheme==="git")){for(let t of this.timelineService.getSources()){if(this.excludedSources.has(t.id))continue;let o=this.timelinesBySource.get(t.id);o!==void 0&&!o.stale||(o!==void 0?this.updateTimeline(o,o.requiresReset):this.loadTimelineForSource(t.id,e,!0))}return}this.setUriCore(e,!1)}onProvidersChanged(e){if(e.removed){for(let t of e.removed)this.timelinesBySource.delete(t);this.refresh()}e.added&&this.loadTimeline(!0,e.added)}onTimelineChanged(e){if(e?.uri===void 0||this.uriIdentityService.extUri.isEqual(A.revive(e.uri),this.uri)){let t=this.timelinesBySource.get(e.id);if(t===void 0)return;this.isBodyVisible()?this.updateTimeline(t,e.reset):t.invalidate(e.reset)}}updateFilename(e){this._filename=e,this.followActiveEditor||!e?this.updateTitleDescription(e):this.updateTitleDescription(`${e} (pinned)`)}get message(){return this._message}set message(e){this._message=e,this.updateMessage()}updateMessage(){this._message!==void 0?this.showMessage(this._message):this.hideMessage()}showMessage(e){this.$message&&(this.$message.classList.remove("hide"),this.resetMessageElement(),this.$message.textContent=e)}hideMessage(){this.resetMessageElement(),this.$message.classList.add("hide")}resetMessageElement(){Rt(this.$message)}get hasVisibleItems(){return this._visibleItemCount>0}clear(e){if(this._visibleItemCount=0,this._maxItemCount=this.pageSize,this.timelinesBySource.clear(),e){for(let t of this.pendingRequests.values())t.request.tokenSource.cancel(),t.dispose();this.pendingRequests.clear(),!this.isBodyVisible()&&this.tree&&(this.tree.setChildren(null,void 0),this._isEmpty=!0)}}async loadTimeline(e,t){if(t===void 0){if(e&&this.clear(!0),this.uri?.scheme===Q.vscodeSettings||this.uri?.scheme===Q.webviewPanel||this.uri?.scheme===Q.walkThrough){this.uri=void 0,this.clear(!1),this.refresh();return}this._isEmpty&&this.uri!==void 0&&this.setLoadingUriMessage()}if(this.uri===void 0){this.clear(!1),this.refresh();return}if(!this.isBodyVisible())return;let o=!1;for(let n of t??this.timelineService.getSources().map(r=>r.id))this.loadTimelineForSource(n,this.uri,e)&&(o=!0);o?this._isEmpty&&this.setLoadingUriMessage():this.refresh()}loadTimelineForSource(e,t,o,n){if(this.excludedSources.has(e))return!1;let r=this.timelinesBySource.get(e);if(!o&&n?.cursor!==void 0&&r!==void 0&&(!r?.more||r.items.length>r.lastRenderedIndex+this.pageSize))return!1;if(n===void 0){if(!o&&r!==void 0&&r.items.length>0&&!r.more)return!1;n={cursor:o?void 0:r?.cursor,limit:this.pageSize}}let s=this.pendingRequests.get(e);s!==void 0&&(n.cursor=s.request.options.cursor,typeof n.limit=="number"&&(typeof s.request.options.limit=="number"?n.limit+=s.request.options.limit:n.limit=s.request.options.limit)),s?.request?.tokenSource.cancel(),s?.dispose(),n.cacheResults=!0,n.resetCache=o;let l=new Ye,c=this.timelineService.getTimeline(e,t,n,l);if(c===void 0)return l.dispose(),!1;let u=new N;return this.pendingRequests.set(e,{request:c,dispose:()=>u.dispose()}),u.add(l),u.add(l.token.onCancellationRequested(()=>this.pendingRequests.delete(e))),this.handleRequest(c),!0}updateTimeline(e,t){if(t){this.timelinesBySource.delete(e.source);let{oldest:o}=e;this.loadTimelineForSource(e.source,this.uri,!0,o!==void 0?{limit:{timestamp:o.timestamp,id:o.id}}:void 0)}else{let{newest:o}=e;this.loadTimelineForSource(e.source,this.uri,!1,o!==void 0?{limit:{timestamp:o.timestamp,id:o.id}}:{limit:this.pageSize})}}async handleRequest(e){let t;try{t=await this.progressService.withProgress({location:this.id},()=>e.result)}catch{}if(e.tokenSource.token.isCancellationRequested||(this.pendingRequests.get(e.source)?.dispose(),this.pendingRequests.delete(e.source)),t===void 0||e.uri!==this.uri){this.pendingRequests.size===0&&this._pendingRefresh&&this.refresh();return}let o=e.source,n=!1,r=this.timelinesBySource.get(o);r===void 0?(this.timelinesBySource.set(o,new s1i(t)),n=!0):n=r.add(t,e.options),n?(this._pendingRefresh=!0,this.hasVisibleItems&&this.pendingRequests.size!==0?this.refreshDebounced():this.refresh()):this.pendingRequests.size===0&&(this._pendingRefresh?this.refresh():this.tree.rerender())}*getItems(){let e=!1;if(this.uri===void 0||this.timelinesBySource.size===0){this._visibleItemCount=0;return}let t=this._maxItemCount,o=0;if(this.timelinesBySource.size===1){let[n,r]=vt.first(this.timelinesBySource);if(r.lastRenderedIndex=-1,this.excludedSources.has(n)){this._visibleItemCount=0;return}r.items.length!==0&&(this._visibleItemCount=1),e=r.more;let s;for(let l of r.items){if(l.relativeTime=void 0,l.hideRelativeTime=void 0,o++,o>t){e=!0;break}s=JMo(l,s),yield{element:l}}r.lastRenderedIndex=o-1}else{let l=function(){return n.filter(p=>!p.nextItem.done).reduce((p,h)=>p===void 0||h.nextItem.value.timestamp>=p.nextItem.value.timestamp?h:p,void 0)},n=[],r=!1,s=0;for(let[p,h]of this.timelinesBySource){if(h.lastRenderedIndex=-1,this.excludedSources.has(p)||h.stale)continue;if(h.items.length!==0&&(r=!0),h.more){e=!0;let f=h.items[Math.min(t,h.items.length-1)];f.timestamp>s&&(s=f.timestamp)}let g=h.items[Symbol.iterator]();n.push({timeline:h,iterator:g,nextItem:g.next()})}this._visibleItemCount=r?1:0;let c,u;for(;u=l();){u.timeline.lastRenderedIndex++;let p=u.nextItem.value;if(p.relativeTime=void 0,p.hideRelativeTime=void 0,p.timestamp>=s){if(o++,o>t){e=!0;break}c=JMo(p,c),yield{element:p}}u.nextItem=u.iterator.next()}}this._visibleItemCount=o,o>0&&(e?yield{element:new but(this.pendingRequests.size!==0)}:this.pendingRequests.size!==0&&(yield{element:new but(!0)}))}refresh(){if(this.isBodyVisible()){if(this.tree.setChildren(null,this.getItems()),this._isEmpty=!this.hasVisibleItems,this.uri===void 0)this.updateFilename(void 0),this.message=d(16172,null);else if(this._isEmpty)if(this.pendingRequests.size!==0)this.setLoadingUriMessage();else{this.updateFilename(this.labelService.getUriBasenameLabel(this.uri));let e=this.contextKeyService.getContextKeyValue("scm.providerCount");this.timelineService.getSources().filter(({id:t})=>!this.excludedSources.has(t)).length===0?this.message=d(16180,null):this.configurationService.getValue("workbench.localHistory.enabled")&&!this.excludedSources.has("timeline.localHistory")?this.message=d(16176,null):this.excludedSources.size>0?this.message=d(16179,null):this.message=d(16178,null),(!e||e===0)&&(this.message+=" "+d(16177,null))}else this.updateFilename(this.labelService.getUriBasenameLabel(this.uri)),this.message=void 0;this._pendingRefresh=!1}}refreshDebounced(){this.refresh()}focus(){super.focus(),this.tree.domFocus()}setExpanded(e){let t=super.setExpanded(e);return t&&this.isBodyVisible()&&(this.followActiveEditor?this.onActiveEditorChanged():this.setUriCore(this.uri,!0)),t}setVisible(e){e?(this.extensionService.activateByEvent("onView:timeline"),this.visibilityDisposables?.dispose(),this.visibilityDisposables=new N,this.editorService.onDidActiveEditorChange(this.onActiveEditorChanged,this,this.visibilityDisposables),this.onDidFocus(()=>this.refreshDebounced(),this,this.visibilityDisposables),super.setVisible(e),this.onActiveEditorChanged()):(this.visibilityDisposables?.dispose(),super.setVisible(e))}layoutBody(e,t){super.layoutBody(e,t),this.tree.layout(e,t)}renderHeaderTitle(e){super.renderHeaderTitle(e,this.title),e.classList.add("timeline-view")}renderBody(e){super.renderBody(e),this.$container=e,e.classList.add("tree-explorer-viewlet-tree-view","timeline-tree-view"),this.$message=M(this.$container,_(".message")),this.$message.classList.add("timeline-subtle"),this.message=d(16172,null),this.$tree=document.createElement("div"),this.$tree.classList.add("customview-tree","file-icon-themable-tree","hide-arrows"),e.appendChild(this.$tree),this.treeRenderer=this._register(this.instantiationService.createInstance(gut,this.commands,this.viewDescriptorService.getViewLocationById(this.id))),this._register(this.treeRenderer.onDidScrollToEnd(t=>{this.pageOnScroll&&this.loadMore(t)})),this.tree=this.instantiationService.createInstance(Rg,"TimelinePane",this.$tree,new d1i,[this.treeRenderer],{identityProvider:new l1i,accessibilityProvider:{getAriaLabel(t){return G6t(t)?t.ariaLabel:t.accessibilityInformation?t.accessibilityInformation.label:d(16171,null,t.relativeTimeFullWord??"",t.label)},getRole(t){return G6t(t)?"treeitem":t.accessibilityInformation&&t.accessibilityInformation.role?t.accessibilityInformation.role:"treeitem"},getWidgetAriaLabel(){return d(16170,null)}},keyboardNavigationLabelProvider:new c1i,multipleSelectionSupport:!1,overrideStyles:this.getLocationBasedColors().listOverrideStyles}),qSn.bindTo(this.tree.contextKeyService),this._register(this.tree.onContextMenu(t=>this.onContextMenu(this.commands,t))),this._register(this.tree.onDidChangeSelection(t=>this.ensureValidItems())),this._register(this.tree.onDidOpen(t=>{if(!t.browserEvent||!this.ensureValidItems())return;let o=this.tree.getSelection(),n;if(o.length===1&&(n=o[0]),n!==null)if(vut(n)){if(n.command){let r=n.command.arguments??[];(n.command.id===vg||n.command.id===cx)&&(r=[...r,t]),this.commandService.executeCommand(n.command.id,...r)}}else G6t(n)&&this.loadMore(n)}))}loadMore(e){e.loading||(e.loading=!0,this.tree.rerender(e),this.pendingRequests.size===0&&(this._maxItemCount=this._visibleItemCount+this.pageSize,this.loadTimeline(!1)))}ensureValidItems(){return!this.hasVisibleItems||!this.timelineService.getSources().some(({id:e})=>!this.excludedSources.has(e)&&this.timelinesBySource.has(e))?(this.tree.setChildren(null,void 0),this._isEmpty=!0,this.setLoadingUriMessage(),!1):!0}setLoadingUriMessage(){let e=this.uri&&this.labelService.getUriBasenameLabel(this.uri);this.updateFilename(e),this.message=e?d(16173,null,e):""}onContextMenu(e,t){let o=t.element;if(o===null)return;let n=t.browserEvent;if(n.preventDefault(),n.stopPropagation(),!this.ensureValidItems())return;this.tree.setFocus([o]);let r=e.getItemContextActions(o);r.length&&this.contextMenuService.showContextMenu({getAnchor:()=>t.anchor,getActions:()=>r,getActionViewItem:s=>{let l=this.keybindingService.lookupKeybinding(s.id);if(l)return new hs(s,s,{label:!0,keybinding:l.getLabel()})},onHide:s=>{s&&this.tree.domFocus()},getActionsContext:()=>({uri:this.uri,item:o}),actionRunner:new q6t})}};I([Zd(500)],Ure.prototype,"refreshDebounced",1),Ure=I([m(1,_e),m(2,Xe),m(3,X),m(4,B),m(5,ce),m(6,Bi),m(7,F),m(8,ee),m(9,ge),m(10,Fo),m(11,I2),m(12,Je),m(13,Le),m(14,nt),m(15,rt),m(16,ht),m(17,lt)],Ure);var Sut=class{static{this.id="TimelineElementTemplate"}constructor(i,e,t){i.classList.add("custom-view-tree-node-item"),this.icon=M(i,_(".custom-view-tree-node-item-icon")),this.iconLabel=new Bc(i,{supportHighlights:!0,supportIcons:!0,hoverDelegate:t});let o=M(this.iconLabel.element,_(".timeline-timestamp-container"));this.timestamp=M(o,_("span.timeline-timestamp"));let n=M(this.iconLabel.element,_(".actions"));this.actionBar=new Zi(n,{actionViewItemProvider:e})}dispose(){this.iconLabel.dispose(),this.actionBar.dispose()}reset(){this.icon.className="",this.icon.style.backgroundImage="",this.actionBar.clear()}},l1i=class{getId(i){return i.handle}},q6t=class extends rs{async runAction(i,{uri:e,item:t}){if(!vut(t)){await i.run();return}await i.run({$mid:12,handle:t.handle,source:t.source,uri:e},e,t.source)}},c1i=class{getKeyboardNavigationLabel(i){return i.label}},d1i=class{getHeight(i){return ZMo}getTemplateId(i){return Sut.id}},gut=class extends x{constructor(e,t,o,n){super();this.commands=e;this.viewContainerLocation=t;this.instantiationService=o;this.themeService=n;this._onDidScrollToEnd=this._register(new E);this.onDidScrollToEnd=this._onDidScrollToEnd.event;this.templateId=Sut.id;this.actionViewItemProvider=Bs.bind(void 0,this.instantiationService),this._hoverDelegate=this.instantiationService.createInstance(mf,this.viewContainerLocation===1?"mouse":"element",{instantHover:this.viewContainerLocation!==1},{position:{hoverPosition:1}})}setUri(e){this.uri=e}renderTemplate(e){return new Sut(e,this.actionViewItemProvider,this._hoverDelegate)}renderElement(e,t,o){o.reset();let{element:n}=e,r=this.themeService.getColorTheme(),s=Bp(r.type)?n.iconDark:n.icon,l=s?A.revive(s):null;l?(o.icon.className="custom-view-tree-node-item-icon",o.icon.style.backgroundImage=Qa(l),o.icon.style.color=""):n.themeIcon?(o.icon.className=`custom-view-tree-node-item-icon ${q.asClassName(n.themeIcon)}`,n.themeIcon.color?o.icon.style.color=r.getColor(n.themeIcon.color.id)?.toString()??"":o.icon.style.color="",o.icon.style.backgroundImage=""):(o.icon.className="custom-view-tree-node-item-icon",o.icon.style.backgroundImage="",o.icon.style.color="");let c=n.tooltip?Fe(n.tooltip)?n.tooltip:{markdown:n.tooltip,markdownNotSupportedFallback:Da(n.tooltip)}:void 0;o.iconLabel.setLabel(n.label,n.description,{title:c,matches:xa(e.filterData)}),o.timestamp.textContent=n.relativeTime??"",o.timestamp.ariaLabel=n.relativeTimeFullWord??"",o.timestamp.parentElement.classList.toggle("timeline-timestamp--duplicate",vut(n)&&n.hideRelativeTime),o.actionBar.context={uri:this.uri,item:n},o.actionBar.actionRunner=new q6t,o.actionBar.push(this.commands.getItemActions(n),{icon:!0,label:!1}),G6t(n)&&setTimeout(()=>this._onDidScrollToEnd.fire(n),0)}disposeElement(e,t,o){o.actionBar.actionRunner.dispose()}disposeTemplate(e){e.dispose()}};gut=I([m(2,F),m(3,Le)],gut);var $Sn=Ae("timeline-refresh",R.refresh,d(16184,null)),jSn=Ae("timeline-pin",R.pin,d(16183,null)),QSn=Ae("timeline-unpin",R.pinned,d(16185,null)),fut=class extends x{constructor(e,t,o,n,r){super();this.pane=e;this.timelineService=t;this.storageService=o;this.contextKeyService=n;this.menuService=r;this._register(this.sourceDisposables=new N),this._register(W(class extends K{constructor(){super({id:"timeline.refresh",title:L(16168,"Refresh"),icon:$Sn,category:L(16169,"Timeline"),menu:{id:D.TimelineTitle,group:"navigation",order:99}})}run(s,...l){e.reset()}})),this._register($e.registerCommand("timeline.toggleFollowActiveEditor",(s,...l)=>e.followActiveEditor=!e.followActiveEditor)),this._register(ve.appendMenuItem(D.TimelineTitle,{command:{id:"timeline.toggleFollowActiveEditor",title:L(16181,"Pin the Current Timeline"),icon:jSn,category:L(16169,"Timeline")},group:"navigation",order:98,when:a1i})),this._register(ve.appendMenuItem(D.TimelineTitle,{command:{id:"timeline.toggleFollowActiveEditor",title:L(16182,"Unpin the Current Timeline"),icon:QSn,category:L(16169,"Timeline")},group:"navigation",order:98,when:a1i.toNegated()})),this._register(t.onDidChangeProviders(()=>this.updateTimelineSourceFilters())),this.updateTimelineSourceFilters()}getItemActions(e){return this.getActions(D.TimelineItemContext,{key:"timelineItem",value:e.contextValue}).primary}getItemContextActions(e){return this.getActions(D.TimelineItemContext,{key:"timelineItem",value:e.contextValue}).secondary}getActions(e,t){let o=this.contextKeyService.createOverlay([["view",this.pane.id],[t.key,t.value]]),n=this.menuService.getMenuActions(e,o,{shouldForwardArgs:!0});return zp(n,"inline")}updateTimelineSourceFilters(){this.sourceDisposables.clear();let e=new Set(JSON.parse(this.storageService.get("timeline.excludeSources",0,"[]")));for(let t of this.timelineService.getSources())this.sourceDisposables.add(W(class extends K{constructor(){super({id:`timeline.toggleExcludeSource:${t.id}`,title:t.label,menu:{id:D.TimelineFilterSubMenu,group:"navigation"},toggled:C.regex("timelineExcludeSources",new RegExp(`\\b${ns(t.id)}\\b`)).negate()})}run(o,...n){e.delete(t.id)||e.add(t.id),o.get(ce).store("timeline.excludeSources",JSON.stringify([...e.keys()]),0,0)}}))}};fut=I([m(1,I2),m(2,ce),m(3,X),m(4,Kt)],fut);var YSn=Ae("timeline-view-icon",R.history,d(16167,null)),XSn=Ae("timeline-open",R.history,d(16166,null)),u1i=class{constructor(){this.id=hNt;this.name=Ure.TITLE;this.containerIcon=YSn;this.ctorDescriptor=new Ft(Ure);this.order=2;this.weight=30;this.collapsed=!0;this.canToggleVisibility=!0;this.hideByDefault=!1;this.canMoveView=!0;this.when=K6t;this.focusCommand={id:"timeline.focus"}}},JSn=ne.as(Jt.Configuration);JSn.registerConfiguration({id:"timeline",order:1001,title:d(16164,null),type:"object",properties:{"timeline.pageSize":{type:["number","null"],default:50,markdownDescription:d(16163,null)},"timeline.pageOnScroll":{type:"boolean",default:!0,description:d(16162,null)}}});ne.as(Mn.ViewsRegistry).registerViews([new u1i],wve);var Iut;(t=>{t.ID="files.openTimeline",t.LABEL=d(16160,null);function e(){return(o,n)=>{let r=o.get(I2);if(A.isUri(n))return r.setUri(n)}}t.handler=e})(Iut||={});$e.registerCommand(Iut.ID,Iut.handler());ve.appendMenuItem(D.ExplorerContext,{group:"4_timeline",order:1,command:{id:Iut.ID,title:Iut.LABEL,icon:XSn},when:C.and(Gd.toNegated(),Wo.HasResource,K6t)});var ZSn=Ae("timeline-filter",R.filter,d(16165,null));ve.appendMenuItem(D.TimelineTitle,{submenu:D.TimelineFilterSubMenu,title:d(16161,null),group:"navigation",order:100,icon:ZSn});Ee(I2,jKe,1);var Hy=le("workingCopyHistoryService"),QKe=20;var ZM=class a{constructor(i){this.fileService=i;this.mapSchemeToProvider=new Map;this.onDidChangeCapabilities=U.None;this.onDidChangeFile=U.None}static{this.SCHEMA="vscode-local-history"}static toLocalHistoryFileSystem(i){let e={location:i.location.toString(!0),associatedResource:i.associatedResource.toString(!0)};return i.associatedResource.with({scheme:a.SCHEMA,query:JSON.stringify(e)})}static fromLocalHistoryFileSystem(i){let e=JSON.parse(i.query);return{location:A.parse(e.location),associatedResource:A.parse(e.associatedResource)}}static{this.EMPTY_RESOURCE=A.from({scheme:a.SCHEMA,path:"/empty"})}static{this.EMPTY={location:a.EMPTY_RESOURCE,associatedResource:a.EMPTY_RESOURCE}}get capabilities(){return 2050}async withProvider(i){let e=i.scheme,t=this.mapSchemeToProvider.get(e);if(!t){let o=this.fileService.getProvider(e);o?t=Promise.resolve(o):t=new Promise(n=>{let r=this.fileService.onDidChangeFileSystemProviderRegistrations(s=>{s.added&&s.provider&&s.scheme===e&&(r.dispose(),n(s.provider))})}),this.mapSchemeToProvider.set(e,t)}return t}async stat(i){let e=a.fromLocalHistoryFileSystem(i).location;return Qe(a.EMPTY_RESOURCE,e)?{type:1,ctime:0,mtime:0,size:0}:(await this.withProvider(e)).stat(e)}async readFile(i){let e=a.fromLocalHistoryFileSystem(i).location;if(Qe(a.EMPTY_RESOURCE,e))return qe.fromString("").buffer;let t=await this.withProvider(e);if(D_(t))return t.readFile(e);throw new Error("Unsupported")}async writeFile(i,e,t){}async mkdir(i){}async readdir(i){return[]}async rename(i,e,t){}async delete(i,e){}watch(i,e){return x.None}};var p1i;function $6t(){if(!p1i){let a={year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"numeric"},i=Jc.DateTimeFormat(wr,a).value;p1i={format:e=>i.format(e)}}return p1i}var m1i="localHistory:item",QU=C.equals("timelineItem",m1i),ePo=Ae("localHistory-icon",R.circleOutline,d(11481,null)),tPo=Ae("localHistory-restore",R.check,d(11482,null));var g1i=L(11493,"Local History"),j6t=C.has("config.workbench.localHistory.enabled"),f1i=L(11494,"Compare with File");W(class extends K{constructor(){super({id:"workbench.action.localHistory.compareWithFile",title:f1i,menu:{id:D.TimelineItemContext,group:"1_compare",order:1,when:QU}})}async run(a,i){let e=a.get(ge),t=a.get(Hy),{entry:o}=await YU(t,i);if(o)return e.executeCommand(cx,...XKe(o,o.workingCopy.resource))}});W(class extends K{constructor(){super({id:"workbench.action.localHistory.compareWithPrevious",title:L(11495,"Compare with Previous"),menu:{id:D.TimelineItemContext,group:"1_compare",order:2,when:QU}})}async run(a,i){let e=a.get(ge),t=a.get(Hy),o=a.get(ee),{entry:n,previous:r}=await YU(t,i);if(n)return r?e.executeCommand(cx,...XKe(r,n)):v1i(n,o)}});var h1i,iPo=new Y("localHistoryItemSelectedForCompare",!1,!0);W(class extends K{constructor(){super({id:"workbench.action.localHistory.selectForCompare",title:L(11505,"Select for Compare"),menu:{id:D.TimelineItemContext,group:"2_compare_with",order:2,when:QU}})}async run(a,i){let e=a.get(Hy),t=a.get(X),{entry:o}=await YU(e,i);o&&(h1i=i,iPo.bindTo(t).set(!0))}});W(class extends K{constructor(){super({id:"workbench.action.localHistory.compareWithSelected",title:L(11496,"Compare with Selected"),menu:{id:D.TimelineItemContext,group:"2_compare_with",order:1,when:C.and(QU,iPo)}})}async run(a,i){let e=a.get(Hy),t=a.get(ge);if(!h1i)return;let o=(await YU(e,h1i)).entry;if(!o)return;let{entry:n}=await YU(e,i);if(n)return t.executeCommand(cx,...XKe(o,n))}});W(class extends K{constructor(){super({id:"workbench.action.localHistory.open",title:L(11500,"Show Contents"),menu:{id:D.TimelineItemContext,group:"3_contents",order:1,when:QU}})}async run(a,i){let e=a.get(Hy),t=a.get(ee),{entry:o}=await YU(e,i);if(o)return v1i(o,t)}});var oPo=L(11502,"Restore Contents");W(class extends K{constructor(){super({id:"workbench.action.localHistory.restoreViaEditor",title:oPo,menu:{id:D.EditorTitle,group:"navigation",order:-10,when:Wo.Scheme.isEqualTo(ZM.SCHEMA)},icon:tPo})}async run(a,i){let{associatedResource:e,location:t}=ZM.fromLocalHistoryFileSystem(i);return nPo(a,{uri:e,handle:Ga(t)})}});W(class extends K{constructor(){super({id:"workbench.action.localHistory.restore",title:oPo,menu:{id:D.TimelineItemContext,group:"3_contents",order:2,when:QU}})}async run(a,i){return nPo(a,i)}});var eIn=Ih.registerSource("localHistoryRestore.source",d(11509,null));async function nPo(a,i){let e=a.get(fe),t=a.get(at),o=a.get(Xa),n=a.get(Hy),r=a.get(ee),{entry:s}=await YU(n,i);if(s){let{confirmed:l}=await t.confirm({type:"warning",message:d(11488,null,He(s.workingCopy.resource)),detail:d(11487,null),primaryButton:d(11512,null)});if(!l)return;let c=o.getAll(s.workingCopy.resource);if(c)for(let u of c)u.isDirty()&&await u.revert({soft:!0});try{await e.cloneFile(s.location,s.workingCopy.resource)}catch(u){await t.error(d(11515,null,He(s.workingCopy.resource)),xn(u));return}if(c)for(let u of c)await u.revert({force:!0});await r.openEditor({resource:s.workingCopy.resource}),await n.addEntry({resource:s.workingCopy.resource,source:eIn},Se.None),await rPo(s,r)}}W(class extends K{constructor(){super({id:"workbench.action.localHistory.restoreViaPicker",title:L(11503,"Find Entry to Restore"),f1:!0,category:g1i,precondition:j6t})}async run(a){let i=a.get(Hy),e=a.get(Ue),t=a.get(Tt),o=a.get(_t),n=a.get(rt),r=a.get(ee),s=a.get(fe),l=a.get(ge),c=a.get(na),u=new N,p=u.add(e.createQuickPick()),h=new Ye;u.add(p.onDidHide(()=>h.dispose(!0))),p.busy=!0,p.show();let g=new En(await i.getAll(h.token)),f=new En(di(c.getHistory().map(({resource:k})=>k))),v=[];for(let k of f)g.has(k)&&(v.push(k),g.delete(k));v.push(...[...g].sort((k,T)=>k.fsPath<T.fsPath?-1:1)),p.busy=!1,p.placeholder=d(11514,null),p.matchOnLabel=!0,p.matchOnDescription=!0,p.items=[...v].map(k=>({resource:k,label:Ga(k),description:n.getUriLabel(ci(k),{relative:!0}),iconClasses:aa(t,o,k)})),await U.toPromise(p.onDidAccept),u.dispose();let b=p.selectedItems.at(0)?.resource;if(!b)return;let S=new N,y=S.add(e.createQuickPick());h=new Ye,S.add(y.onDidHide(()=>h.dispose(!0))),y.busy=!0,y.show();let w=await i.getEntries(b,h.token);y.busy=!1,y.canAcceptInBackground=!0,y.placeholder=d(11513,null),y.matchOnLabel=!0,y.matchOnDescription=!0,y.items=Array.from(w).reverse().map(k=>({entry:k,label:`$(circle-outline) ${Ih.getSourceLabel(k.source)}`,description:YKe(k.timestamp)})),S.add(y.onDidAccept(async k=>{k.inBackground||S.dispose();let T=y.selectedItems.at(0);return T?await s.exists(T.entry.workingCopy.resource)?l.executeCommand(cx,...XKe(T.entry,T.entry.workingCopy.resource,{preserveFocus:k.inBackground})):v1i(T.entry,r,{preserveFocus:k.inBackground}):void 0}))}});ve.appendMenuItem(D.TimelineTitle,{command:{id:"workbench.action.localHistory.restoreViaPicker",title:L(11504,"Local History: Find Entry to Restore...")},group:"submenu",order:1,when:j6t});W(class extends K{constructor(){super({id:"workbench.action.localHistory.rename",title:L(11501,"Rename"),menu:{id:D.TimelineItemContext,group:"5_edit",order:1,when:QU}})}async run(a,i){let e=a.get(Hy),t=a.get(Ue),{entry:o}=await YU(e,i);if(o){let n=new N,r=n.add(t.createInputBox());r.title=d(11510,null),r.ignoreFocusOut=!0,r.placeholder=d(11511,null),r.value=Ih.getSourceLabel(o.source),r.show(),n.add(r.onDidAccept(()=>{r.value&&e.updateEntry(o,{source:r.value},Se.None),n.dispose()}))}}});W(class extends K{constructor(){super({id:"workbench.action.localHistory.delete",title:L(11498,"Delete"),menu:{id:D.TimelineItemContext,group:"5_edit",order:2,when:QU}})}async run(a,i){let e=a.get(Hy),t=a.get(ee),o=a.get(at),{entry:n}=await YU(e,i);if(n){let{confirmed:r}=await o.confirm({type:"warning",message:d(11486,null,n.workingCopy.name,YKe(n.timestamp)),detail:d(11485,null),primaryButton:d(11492,null)});if(!r)return;await e.removeEntry(n,Se.None),await rPo(n,t)}}});W(class extends K{constructor(){super({id:"workbench.action.localHistory.deleteAll",title:L(11499,"Delete All"),f1:!0,category:g1i,precondition:j6t})}async run(a){let i=a.get(at),e=a.get(Hy),{confirmed:t}=await i.confirm({type:"warning",message:d(11484,null),detail:d(11483,null),primaryButton:d(11491,null)});t&&await e.removeAll(Se.None)}});W(class extends K{constructor(){super({id:"workbench.action.localHistory.create",title:L(11497,"Create Entry"),f1:!0,category:g1i,precondition:C.and(j6t,fr)})}async run(a){let i=a.get(Hy),e=a.get(Ue),t=a.get(ee),o=a.get(rt),n=a.get(An),r=po.getOriginalUri(t.activeEditor,{supportSideBySide:1});if(r?.scheme!==n.defaultUriScheme&&r?.scheme!==Q.vscodeUserData)return;let s=new N,l=s.add(e.createInputBox());l.title=d(11489,null),l.ignoreFocusOut=!0,l.placeholder=d(11490,null,o.getUriBasenameLabel(r)),l.show(),s.add(l.onDidAccept(async()=>{let c=l.value;s.dispose(),c&&await i.addEntry({resource:r,source:l.value},Se.None)}))}});async function v1i(a,i,e){let t=ZM.toLocalHistoryFileSystem({location:a.location,associatedResource:a.workingCopy.resource});await i.openEditor({resource:t,label:d(11508,null,a.workingCopy.name,Ih.getSourceLabel(a.source),YKe(a.timestamp)),options:e})}async function rPo(a,i){let e=ZM.toLocalHistoryFileSystem({location:a.location,associatedResource:a.workingCopy.resource}),t=i.findEditors(e,{supportSideBySide:4});await i.closeEditors(t,{preserveFocus:!0})}function XKe(a,i,e){let t=ZM.toLocalHistoryFileSystem({location:a.location,associatedResource:a.workingCopy.resource}),o,n;if(A.isUri(i))n=i,o=d(11506,null,a.workingCopy.name,Ih.getSourceLabel(a.source),YKe(a.timestamp),a.workingCopy.name);else{let r=i;n=ZM.toLocalHistoryFileSystem({location:r.location,associatedResource:r.workingCopy.resource}),o=d(11507,null,a.workingCopy.name,Ih.getSourceLabel(a.source),YKe(a.timestamp),r.workingCopy.name,Ih.getSourceLabel(r.source),YKe(r.timestamp))}return[t,n,o,e?[void 0,e]:void 0]}async function YU(a,i){let e=await a.getEntries(i.uri,Se.None),t,o;for(let n=0;n<e.length;n++){let r=e[n];if(r.id===i.handle){t=r,o=e[n-1];break}}return{entry:t,previous:o}}var tIn=/\//g;function YKe(a){return`${$6t().format(a).replace(tIn,"-")}`}var Zq=class extends x{constructor(e,t,o,n,r,s,l){super();this.timelineService=e;this.workingCopyHistoryService=t;this.pathService=o;this.fileService=n;this.environmentService=r;this.configurationService=s;this.contextService=l;this.id="timeline.localHistory";this.label=d(11516,null);this.scheme="*";this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this.timelineProviderDisposable=this._register(new me);this.registerComponents(),this.registerListeners()}static{this.ID="workbench.contrib.localHistoryTimeline"}static{this.LOCAL_HISTORY_ENABLED_SETTINGS_KEY="workbench.localHistory.enabled"}registerComponents(){this.updateTimelineRegistration(),this._register(this.fileService.registerProvider(ZM.SCHEMA,new ZM(this.fileService)))}updateTimelineRegistration(){this.configurationService.getValue(Zq.LOCAL_HISTORY_ENABLED_SETTINGS_KEY)?this.timelineProviderDisposable.value=this.timelineService.registerTimelineProvider(this):this.timelineProviderDisposable.clear()}registerListeners(){this._register(this.workingCopyHistoryService.onDidAddEntry(e=>this.onDidChangeWorkingCopyHistoryEntry(e.entry))),this._register(this.workingCopyHistoryService.onDidChangeEntry(e=>this.onDidChangeWorkingCopyHistoryEntry(e.entry))),this._register(this.workingCopyHistoryService.onDidReplaceEntry(e=>this.onDidChangeWorkingCopyHistoryEntry(e.entry))),this._register(this.workingCopyHistoryService.onDidRemoveEntry(e=>this.onDidChangeWorkingCopyHistoryEntry(e.entry))),this._register(this.workingCopyHistoryService.onDidRemoveEntries(()=>this.onDidChangeWorkingCopyHistoryEntry(void 0))),this._register(this.workingCopyHistoryService.onDidMoveEntries(()=>this.onDidChangeWorkingCopyHistoryEntry(void 0))),this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration(Zq.LOCAL_HISTORY_ENABLED_SETTINGS_KEY)&&this.updateTimelineRegistration()}))}onDidChangeWorkingCopyHistoryEntry(e){this._onDidChange.fire({id:this.id,uri:e?.workingCopy.resource,reset:!0})}async provideTimeline(e,t,o){let n=[],r;if(e.scheme===ZM.SCHEMA?r=ZM.fromLocalHistoryFileSystem(e).associatedResource:e.scheme===this.pathService.defaultUriScheme||e.scheme===Q.vscodeUserData?r=e:this.fileService.hasProvider(e)&&(r=A.from({scheme:this.pathService.defaultUriScheme,authority:this.environmentService.remoteAuthority??neo(this.contextService.getWorkspace()),path:e.path})),r){let s=await this.workingCopyHistoryService.getEntries(r,o);for(let l of s)n.push(this.toTimelineItem(l))}return{source:this.id,items:n}}toTimelineItem(e){return{handle:e.id,label:Ih.getSourceLabel(e.source),tooltip:new Ie(`$(history) ${$6t().format(e.timestamp)}

${Ih.getSourceLabel(e.source)}${e.sourceDescription?` (${e.sourceDescription})`:""}`,{supportThemeIcons:!0}),source:this.id,timestamp:e.timestamp,themeIcon:ePo,contextValue:m1i,command:{id:cx,title:f1i.value,arguments:XKe(e,e.workingCopy.resource)}}}};Zq=I([m(0,I2),m(1,Hy),m(2,An),m(3,fe),m(4,At),m(5,B),m(6,Pe)],Zq);It(Zq.ID,Zq,St.BlockRestore);var S1i=Ae("workspace-trust-banner",R.shield,d(17023,null)),iIn=Ae("workspace-trust-editor-check",R.check,d(17006,null)),oIn=Ae("workspace-trust-editor-cross",R.x,d(17063,null)),nIn=Ae("workspace-trust-editor-folder-picker",R.folder,d(17011,null)),rIn=Ae("workspace-trust-editor-edit-folder",R.edit,d(17009,null)),sIn=Ae("workspace-trust-editor-remove-folder",R.close,d(17020,null)),yut=class extends x{constructor(e,t,o,n,r,s,l){super();this.container=e;this.instantiationService=t;this.workspaceService=o;this.workspaceTrustManagementService=n;this.uriService=r;this.labelService=s;this.fileDialogService=l;this._onDidAcceptEdit=this._register(new E);this.onDidAcceptEdit=this._onDidAcceptEdit.event;this._onDidRejectEdit=this._register(new E);this.onDidRejectEdit=this._onDidRejectEdit.event;this._onEdit=this._register(new E);this.onEdit=this._onEdit.event;this._onDelete=this._register(new E);this.onDelete=this._onDelete.event;this.descriptionElement=e.appendChild(_(".workspace-trusted-folders-description"));let c=e.appendChild(_(".trusted-uris-table")),u=e.appendChild(_(".trusted-uris-button-bar"));this.table=this.instantiationService.createInstance(MC,"WorkspaceTrust",c,new wut,[{label:d(17012,null),tooltip:"",weight:1,templateId:Gre.TEMPLATE_ID,project(g){return g}},{label:d(17018,null),tooltip:"",weight:8,templateId:Kre.TEMPLATE_ID,project(g){return g}},{label:"",tooltip:"",weight:1,minimumWidth:75,maximumWidth:75,templateId:zre.TEMPLATE_ID,project(g){return g}}],[this.instantiationService.createInstance(Gre),this.instantiationService.createInstance(Kre,this),this.instantiationService.createInstance(zre,this,this.currentWorkspaceUri)],{horizontalScrolling:!1,alwaysConsumeMouseWheel:!1,openOnSingleClick:!1,multipleSelectionSupport:!1,accessibilityProvider:{getAriaLabel:g=>{let f=Q6t(this.labelService,g);return f===void 0||f.length===0?d(17030,null,this.labelService.getUriLabel(g.uri)):d(17034,null,this.labelService.getUriLabel(g.uri),f)},getWidgetAriaLabel:()=>d(17031,null)},identityProvider:{getId(g){return g.uri.toString()}}}),this._register(this.table.onDidOpen(g=>{g&&g.element&&!g.browserEvent?.defaultPrevented&&this.edit(g.element,!0)}));let p=this._register(new Sw(u)),h=this._register(p.addButton({title:d(17005,null),...Qo}));h.label=d(17005,null),this._register(h.onDidClick(async()=>{let g=await this.fileDialogService.showOpenDialog({canSelectFiles:!1,canSelectFolders:!0,canSelectMany:!1,defaultUri:this.currentWorkspaceUri,openLabel:d(17049,null),title:d(17022,null)});g&&this.workspaceTrustManagementService.setUrisTrust(g,!0)})),this._register(this.workspaceTrustManagementService.onDidChangeTrustedFolders(()=>{this.updateTable()}))}getIndexOfTrustedUriEntry(e){let t=this.trustedUriEntries.indexOf(e);if(t===-1){for(let o=0;o<this.trustedUriEntries.length;o++)if(this.trustedUriEntries[o].uri===e.uri)return o}return t}selectTrustedUriEntry(e,t=!0){let o=this.getIndexOfTrustedUriEntry(e);o!==-1&&(t&&(this.table.domFocus(),this.table.setFocus([o])),this.table.setSelection([o]))}get currentWorkspaceUri(){return this.workspaceService.getWorkspace().folders[0]?.uri||A.file("/")}get trustedUriEntries(){let e=this.workspaceService.getWorkspace(),t=e.folders.map(r=>r.uri);return e.configuration&&t.push(e.configuration),this.workspaceTrustManagementService.getTrustedUris().map(r=>{let s=!1;for(let l of t)s=s||this.uriService.extUri.isEqualOrParent(l,r);return{uri:r,parentOfWorkspaceItem:s}}).sort((r,s)=>{if(r.uri.scheme!==s.uri.scheme){if(r.uri.scheme===Q.file)return-1;if(s.uri.scheme===Q.file)return 1}let l=r.uri.path.endsWith(".code-workspace"),c=s.uri.path.endsWith(".code-workspace");if(l!==c){if(l)return 1;if(c)return-1}return r.uri.fsPath.localeCompare(s.uri.fsPath)})}layout(){this.table.layout(this.trustedUriEntries.length*wut.ROW_HEIGHT+wut.HEADER_ROW_HEIGHT,void 0)}updateTable(){let e=this.trustedUriEntries;this.container.classList.toggle("empty",e.length===0),this.descriptionElement.innerText=e.length?d(17032,null):d(17017,null),this.table.splice(0,Number.POSITIVE_INFINITY,this.trustedUriEntries),this.layout()}validateUri(e,t){if(!t)return null;if(t.uri.scheme==="vscode-vfs"){let o=e.split(Oo.sep).filter(n=>n.length);if(o.length===0&&e.startsWith(Oo.sep))return{type:2,content:d(17024,null,Q6t(this.labelService,t))};if(o.length===1)return{type:2,content:d(17047,null,o[0],Q6t(this.labelService,t))};if(o.length>2)return{type:3,content:d(17013,null,e)}}return null}acceptEdit(e,t){let o=this.workspaceTrustManagementService.getTrustedUris(),n=o.findIndex(r=>this.uriService.extUri.isEqual(r,e.uri));n>=o.length||n===-1?o.push(t):o[n]=t,this.workspaceTrustManagementService.setTrustedUris(o),this._onDidAcceptEdit.fire(e)}rejectEdit(e){this._onDidRejectEdit.fire(e)}async delete(e){this.table.focusNext(),await this.workspaceTrustManagementService.setUrisTrust([e.uri],!1),this.table.getFocus().length===0&&this.table.focusLast(),this._onDelete.fire(e),this.table.domFocus()}async edit(e,t){if((e.uri.scheme===Q.file||e.uri.scheme===this.currentWorkspaceUri.scheme&&this.uriService.extUri.isEqualAuthority(this.currentWorkspaceUri.authority,e.uri.authority)&&!Kde(e.uri))&&t){let n=await this.fileDialogService.showOpenDialog({canSelectFiles:!1,canSelectFolders:!0,canSelectMany:!1,defaultUri:e.uri,openLabel:d(17049,null),title:d(17022,null)});n?this.acceptEdit(e,n[0]):this.rejectEdit(e)}else this.selectTrustedUriEntry(e),this._onEdit.fire(e)}};yut=I([m(1,F),m(2,Pe),m(3,Nr),m(4,ht),m(5,rt),m(6,rn)],yut);var wut=class a{constructor(){this.headerRowHeight=a.HEADER_ROW_HEIGHT}static{this.HEADER_ROW_HEIGHT=30}static{this.ROW_HEIGHT=24}getHeight(i){return a.ROW_HEIGHT}},zre=class{constructor(i,e,t){this.table=i;this.currentWorkspaceUri=e;this.uriService=t;this.templateId=zre.TEMPLATE_ID}static{this.TEMPLATE_ID="actions"}renderTemplate(i){let e=i.appendChild(_(".actions"));return{actionBar:new Zi(e)}}renderElement(i,e,t){t.actionBar.clear();let o=i.uri.scheme===Q.file||i.uri.scheme===this.currentWorkspaceUri.scheme&&this.uriService.extUri.isEqualAuthority(this.currentWorkspaceUri.authority,i.uri.authority)&&!Kde(i.uri),n=[];o&&n.push(this.createPickerAction(i)),n.push(this.createEditAction(i)),n.push(this.createDeleteAction(i)),t.actionBar.push(n,{icon:!0})}createEditAction(i){return{label:"",class:q.asClassName(rIn),enabled:!0,id:"editTrustedUri",tooltip:d(17010,null),run:()=>{this.table.edit(i,!1)}}}createPickerAction(i){return{label:"",class:q.asClassName(nIn),enabled:!0,id:"pickerTrustedUri",tooltip:d(17019,null),run:()=>{this.table.edit(i,!0)}}}createDeleteAction(i){return{label:"",class:q.asClassName(sIn),enabled:!0,id:"deleteTrustedUri",tooltip:d(17007,null),run:async()=>{await this.table.delete(i)}}}disposeTemplate(i){i.actionBar.dispose()}};zre=I([m(2,ht)],zre);var Kre=class{constructor(i,e){this.table=i;this.contextViewService=e;this.templateId=Kre.TEMPLATE_ID}static{this.TEMPLATE_ID="path"}renderTemplate(i){let e=i.appendChild(_(".path")),t=e.appendChild(_("div.path-label")),o=new Vc(e,this.contextViewService,{validationOptions:{validation:s=>this.table.validateUri(s,this.currentItem)},inputBoxStyles:Cl}),n=new N,r=n.add(new N);return{element:e,pathLabel:t,pathInput:o,disposables:n,renderDisposables:r}}renderElement(i,e,t){t.renderDisposables.clear(),this.currentItem=i,t.renderDisposables.add(this.table.onEdit(async l=>{i===l&&(t.element.classList.add("input-mode"),t.pathInput.focus(),t.pathInput.select(),t.element.parentElement.style.paddingLeft="0px")})),t.renderDisposables.add(j(t.pathInput.element,re.DBLCLICK,l=>{Xt.stop(l)}));let o=()=>{t.element.classList.remove("input-mode"),t.element.parentElement.style.paddingLeft="5px"},n=()=>{o();let l=t.pathInput.value,c=V9(l)?i.uri.with({path:Oo.sep+f1(l)}):i.uri.with({path:l});t.pathLabel.innerText=this.formatPath(c),c&&this.table.acceptEdit(i,c)},r=()=>{o(),t.pathInput.value=s,this.table.rejectEdit(i)};t.renderDisposables.add(Jo(t.pathInput.inputElement,re.KEY_DOWN,l=>{let c=!1;l.equals(3)?(n(),c=!0):l.equals(9)&&(r(),c=!0),c&&(l.preventDefault(),l.stopPropagation())})),t.renderDisposables.add(j(t.pathInput.inputElement,re.BLUR,()=>{r()}));let s=this.formatPath(i.uri);t.pathInput.value=s,t.pathLabel.innerText=s,t.element.classList.toggle("current-workspace-parent",i.parentOfWorkspaceItem)}disposeTemplate(i){i.disposables.dispose(),i.renderDisposables.dispose()}formatPath(i){if(i.scheme===Q.file)return Hp(i.fsPath);if(i.path.startsWith(Oo.sep)){let e=i.path.substring(1);if(V9(e,!0))return Hp($s.normalize(e),!0)}return i.path}};Kre=I([m(1,Wn)],Kre);function Q6t(a,i){return i.uri.authority?a.getHostLabel(i.uri.scheme,i.uri.authority):d(17015,null)}var Gre=class{constructor(i){this.labelService=i;this.templateId=Gre.TEMPLATE_ID}static{this.TEMPLATE_ID="host"}renderTemplate(i){let e=new N,t=e.add(new N),o=i.appendChild(_(".host")),n=o.appendChild(_("div.host-label")),r=o.appendChild(_("div.button-bar"));return{element:o,hostContainer:n,buttonBarContainer:r,disposables:e,renderDisposables:t}}renderElement(i,e,t){t.renderDisposables.clear(),t.renderDisposables.add({dispose:()=>{Rt(t.buttonBarContainer)}}),t.hostContainer.innerText=Q6t(this.labelService,i),t.element.classList.toggle("current-workspace-parent",i.parentOfWorkspaceItem),t.hostContainer.style.display="",t.buttonBarContainer.style.display="none"}disposeTemplate(i){i.disposables.dispose()}};Gre=I([m(0,rt)],Gre);var e$=class extends Ts{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super(e$.ID,e,t,o,n);this.workspaceService=r;this.extensionWorkbenchService=s;this.extensionManifestPropertiesService=l;this.instantiationService=c;this.workspaceTrustManagementService=u;this.configurationService=p;this.extensionEnablementService=h;this.productService=g;this.keybindingService=f;this.rendering=!1;this.rerenderDisposables=this._register(new N);this.layoutParticipants=[]}static{this.ID="workbench.editor.workspaceTrust"}createEditor(e){this.rootElement=M(e,_(".workspace-trust-editor",{tabindex:"0"})),this.createHeaderElement(this.rootElement);let t=_(".workspace-trust-editor-body");this.bodyScrollBar=this._register(new ms(t,{horizontal:2,vertical:1})),M(this.rootElement,this.bodyScrollBar.getDomNode()),this.createAffectedFeaturesElement(t),this.createConfigurationElement(t),this.rootElement.style.setProperty("--workspace-trust-selected-color",kt(xC)),this.rootElement.style.setProperty("--workspace-trust-unselected-color",kt(pj)),this.rootElement.style.setProperty("--workspace-trust-check-color",kt(MPe)),this.rootElement.style.setProperty("--workspace-trust-x-color",kt(Iv)),this._register(j(this.rootElement,re.KEY_DOWN,o=>{let n=new gi(o);if(n.equals(16)||n.equals(18)){let r=[this.headerContainer,this.trustedContainer,this.untrustedContainer,this.configurationContainer],l=r.findIndex(c=>Gr(c));n.equals(18)?l++:n.equals(16)&&(l=Math.max(0,l),l--),l+=r.length,l%=r.length,r[l].focus()}else n.equals(9)?this.rootElement.focus():n.equals(2051)?this.workspaceTrustManagementService.canSetWorkspaceTrust()&&this.workspaceTrustManagementService.setWorkspaceTrust(!this.workspaceTrustManagementService.isWorkspaceTrusted()):n.equals(3075)&&this.workspaceTrustManagementService.canSetParentFolderTrust()&&this.workspaceTrustManagementService.setParentFolderTrust(!0)}))}focus(){super.focus(),this.rootElement.focus()}async setInput(e,t,o,n){await super.setInput(e,t,o,n),!n.isCancellationRequested&&(await this.workspaceTrustManagementService.workspaceTrustInitialized,this.registerListeners(),await this.render())}registerListeners(){this._register(this.extensionWorkbenchService.onChange(()=>this.render())),this._register(this.configurationService.onDidChangeRestrictedSettings(()=>this.render())),this._register(this.workspaceTrustManagementService.onDidChangeTrust(()=>this.render())),this._register(this.workspaceTrustManagementService.onDidChangeTrustedFolders(()=>this.render()))}getHeaderContainerClass(e){return e?"workspace-trust-header workspace-trust-trusted":"workspace-trust-header workspace-trust-untrusted"}getHeaderTitleText(e){if(e){if(this.workspaceTrustManagementService.isWorkspaceTrustForced())return d(17041,null);switch(this.workspaceService.getWorkbenchState()){case 1:return d(17037,null);case 2:return d(17036,null);case 3:return d(17038,null)}}return d(17055,null)}getHeaderTitleIconClassNames(e){return q.asClassNameArray(S1i)}getFeaturesHeaderText(e){let t="",o="";switch(this.workspaceService.getWorkbenchState()){case 1:{t=e?d(17042,null):d(17059,null),o=e?d(17043,null):d(17058,null);break}case 2:{t=e?d(17029,null):d(17059,null),o=e?d(17033,null):d(17054,null);break}case 3:{t=e?d(17044,null):d(17059,null),o=e?d(17045,null):d(17061,null);break}}return[t,o]}async render(){if(this.rendering)return;this.rendering=!0,this.rerenderDisposables.clear();let e=this.workspaceTrustManagementService.isWorkspaceTrusted();this.rootElement.classList.toggle("trusted",e),this.rootElement.classList.toggle("untrusted",!e),this.headerTitleText.innerText=this.getHeaderTitleText(e),this.headerTitleIcon.className="workspace-trust-title-icon",this.headerTitleIcon.classList.add(...this.getHeaderTitleIconClassNames(e)),this.headerDescription.innerText="";let t=M(this.headerDescription,_("div"));t.innerText=e?d(17027,null):d(17051,null,this.productService.nameShort);let o=M(this.headerDescription,_("div")),n=d(17062,null,"command:workbench.trust.configure");for(let c of ES(n).nodes)typeof c=="string"?M(o,document.createTextNode(c)):this.rerenderDisposables.add(this.instantiationService.createInstance(rg,o,{...c,tabIndex:-1},{}));this.headerContainer.className=this.getHeaderContainerClass(e),this.rootElement.setAttribute("aria-label",`${d(17021,null)}:  ${this.headerContainer.innerText}`);let r=this.configurationService.restrictedSettings,s=ne.as(Jt.Configuration),l=r.default.filter(c=>{let u=s.getConfigurationProperties()[c];if(u.scope&&(Kw.includes(u.scope)||u.scope===2))return!1;if(u.deprecationMessage||u.markdownDeprecationMessage){if(r.workspace?.includes(c))return!0;if(r.workspaceFolder){for(let p of r.workspaceFolder.values())if(p.includes(c))return!0}return!1}return!0}).length;this.renderAffectedFeatures(l,this.getExtensionCount()),this.workspaceTrustedUrisTable.updateTable(),this.bodyScrollBar.getDomNode().style.height=`calc(100% - ${this.headerContainer.clientHeight}px)`,this.bodyScrollBar.scanDomNode(),this.rendering=!1}getExtensionCount(){let e=new Set,t=_F(this.workspaceService.getWorkspace()),o=this.extensionWorkbenchService.local.filter(n=>n.local).map(n=>n.local);for(let n of o){let r=this.extensionEnablementService.getEnablementState(n);if(r!==12&&r!==13&&r!==0&&r!==8||t&&this.extensionManifestPropertiesService.getExtensionVirtualWorkspaceSupportType(n.manifest)===!1)continue;if(this.extensionManifestPropertiesService.getExtensionUntrustedWorkspaceSupportType(n.manifest)!==!0){e.add(n.identifier.id);continue}kde(o,n).some(l=>this.extensionManifestPropertiesService.getExtensionUntrustedWorkspaceSupportType(l.manifest)===!1)&&e.add(n.identifier.id)}return e.size}createHeaderElement(e){this.headerContainer=M(e,_(".workspace-trust-header",{tabIndex:"0"})),this.headerTitleContainer=M(this.headerContainer,_(".workspace-trust-title")),this.headerTitleIcon=M(this.headerTitleContainer,_(".workspace-trust-title-icon")),this.headerTitleText=M(this.headerTitleContainer,_(".workspace-trust-title-text")),this.headerDescription=M(this.headerContainer,_(".workspace-trust-description"))}createConfigurationElement(e){this.configurationContainer=M(e,_(".workspace-trust-settings",{tabIndex:"0"}));let t=M(this.configurationContainer,_(".workspace-trusted-folders-title"));t.innerText=d(17031,null),this.workspaceTrustedUrisTable=this._register(this.instantiationService.createInstance(yut,this.configurationContainer))}createAffectedFeaturesElement(e){this.affectedFeaturesContainer=M(e,_(".workspace-trust-features")),this.trustedContainer=M(this.affectedFeaturesContainer,_(".workspace-trust-limitations.trusted",{tabIndex:"0"})),this.untrustedContainer=M(this.affectedFeaturesContainer,_(".workspace-trust-limitations.untrusted",{tabIndex:"0"}))}async renderAffectedFeatures(e,t){Rt(this.trustedContainer),Rt(this.untrustedContainer);let[o,n]=this.getFeaturesHeaderText(!0);this.renderLimitationsHeaderElement(this.trustedContainer,o,n);let r=this.workspaceService.getWorkbenchState()===1?[d(17040,null),d(17026,null),d(17028,null)]:[d(17040,null),d(17026,null),d(17039,null),d(17028,null)];this.renderLimitationsListElement(this.trustedContainer,r,q.asClassNameArray(iIn));let[s,l]=this.getFeaturesHeaderText(!1);this.renderLimitationsHeaderElement(this.untrustedContainer,s,l);let c=this.workspaceService.getWorkbenchState()===1?[d(17057,null),d(17050,null),b1i(d(17052,null,t,`command:${FB}`))]:[d(17057,null),d(17050,null),b1i(e?d(17056,null,e,"command:settings.filterUntrusted"):d(17016,null)),b1i(d(17052,null,t,`command:${FB}`))];this.renderLimitationsListElement(this.untrustedContainer,c,q.asClassNameArray(oIn)),this.workspaceTrustManagementService.isWorkspaceTrusted()?this.workspaceTrustManagementService.canSetWorkspaceTrust()?this.addDontTrustButtonToElement(this.untrustedContainer):this.addTrustedTextToElement(this.untrustedContainer):this.workspaceTrustManagementService.canSetWorkspaceTrust()&&this.addTrustButtonToElement(this.trustedContainer)}createButtonRow(e,t,o){let n=M(e,_(".workspace-trust-buttons-row")),r=M(n,_(".workspace-trust-buttons")),s=this.rerenderDisposables.add(new Sw(r));for(let{action:l,keybinding:c}of t){let u=s.addButtonWithDescription(Qo);u.label=l.label,u.enabled=o!==void 0?o:l.enabled,u.description=c.getLabel(),u.element.ariaLabel=l.label+", "+d(17014,null,c.getAriaLabel()),this.rerenderDisposables.add(u.onDidClick(p=>{p&&Xt.stop(p,!0),l.run()}))}}addTrustButtonToElement(e){let o=[{action:this.rerenderDisposables.add(new it("workspace.trust.button.action.grant",d(17025,null),void 0,!0,async()=>{await this.workspaceTrustManagementService.setWorkspaceTrust(!0)})),keybinding:this.keybindingService.resolveUserBinding(Ze?"Cmd+Enter":"Ctrl+Enter")[0]}];if(this.workspaceTrustManagementService.canSetParentFolderTrust()){let n=Dg(this.workspaceService.getWorkspace()),r=He(ci(n.uri)),s=M(e,_(".trust-message-box"));s.innerText=d(17046,null,r);let l=this.rerenderDisposables.add(new it("workspace.trust.button.action.grantParent",d(17048,null),void 0,!0,async()=>{await this.workspaceTrustManagementService.setParentFolderTrust(!0)}));o.push({action:l,keybinding:this.keybindingService.resolveUserBinding(Ze?"Cmd+Shift+Enter":"Ctrl+Shift+Enter")[0]})}this.createButtonRow(e,o)}addDontTrustButtonToElement(e){this.createButtonRow(e,[{action:this.rerenderDisposables.add(new it("workspace.trust.button.action.deny",d(17008,null),void 0,!0,async()=>{await this.workspaceTrustManagementService.setWorkspaceTrust(!1)})),keybinding:this.keybindingService.resolveUserBinding(Ze?"Cmd+Enter":"Ctrl+Enter")[0]}])}addTrustedTextToElement(e){if(this.workspaceService.getWorkbenchState()===1)return;let t=M(e,_(".workspace-trust-untrusted-description"));this.workspaceTrustManagementService.isWorkspaceTrustForced()?t.innerText=d(17035,null):t.innerText=this.workspaceService.getWorkbenchState()===3?d(17060,null):d(17053,null)}renderLimitationsHeaderElement(e,t,o){let n=M(e,_(".workspace-trust-limitations-header")),r=M(n,_(".workspace-trust-limitations-title")),s=M(r,_(".workspace-trust-limitations-title-text")),l=M(n,_(".workspace-trust-limitations-subtitle"));s.innerText=t,l.innerText=o}renderLimitationsListElement(e,t,o){let n=M(e,_(".workspace-trust-limitations-list-container")),r=M(n,_("ul"));for(let s of t){let l=M(r,_("li")),c=M(l,_(".list-item-icon")),u=M(l,_(".list-item-text"));c.classList.add(...o);let p=ES(s);for(let h of p.nodes)typeof h=="string"?M(u,document.createTextNode(h)):this.rerenderDisposables.add(this.instantiationService.createInstance(rg,u,{...h,tabIndex:-1},{}))}}layout(e){this.isVisible()&&(this.workspaceTrustedUrisTable.layout(),this.layoutParticipants.forEach(t=>{t.layout()}),this.bodyScrollBar.scanDomNode())}};I([Zd(100)],e$.prototype,"render",1),e$=I([m(1,Te),m(2,Le),m(3,ce),m(4,Pe),m(5,Hi),m(6,Gp),m(7,F),m(8,Nr),m(9,fg),m(10,Js),m(11,tt),m(12,_e)],e$);function b1i(a){let i=/(.*)\[(.+)\]\s*\((.+)\)(.*)/;return a.replace(i,"$1[$2]($3)$4")}var aIn=Ae("workspace-trust-editor-label-icon",R.shield,d(18382,null)),Ube=class a extends ls{constructor(){super(...arguments);this.resource=A.from({scheme:Q.vscodeWorkspaceTrust,path:"workspaceTrustEditor"})}static{this.ID="workbench.input.workspaceTrust"}get capabilities(){return super.capabilities|8|2048}get typeId(){return a.ID}matches(e){return super.matches(e)||e instanceof a}getName(){return d(18381,null)}getIcon(){return aIn}};var sPo="workbench.banner.restrictedMode",aPo="workspace.trust.startupPrompt.shown",lPo="workbench.banner.restrictedMode.dismissed",Cut=class extends x{constructor(i,e,t){super(),this._ctxWorkspaceTrustEnabled=Vq.IsEnabled.bindTo(i),this._ctxWorkspaceTrustEnabled.set(e.isWorkspaceTrustEnabled()),this._ctxWorkspaceTrustState=Vq.IsTrusted.bindTo(i),this._ctxWorkspaceTrustState.set(t.isWorkspaceTrusted()),this._register(t.onDidChangeTrust(o=>this._ctxWorkspaceTrustState.set(o)))}};Cut=I([m(0,X),m(1,kR),m(2,Nr)],Cut);ne.as(Qi.Workbench).registerWorkbenchContribution(Cut,3);var JKe=class extends x{constructor(e,t,o,n,r,s){super();this.dialogService=e;this.commandService=t;this.labelService=o;this.workspaceContextService=n;this.workspaceTrustManagementService=r;this.workspaceTrustRequestService=s;this.registerListeners()}static{this.ID="workbench.contrib.workspaceTrustRequestHandler"}get useWorkspaceLanguage(){return!Zh(Dg(this.workspaceContextService.getWorkspace()))}registerListeners(){this._register(this.workspaceTrustRequestService.onDidInitiateOpenFilesTrustRequest(async()=>{await this.workspaceTrustManagementService.workspaceResolved;let e=[this.workspaceContextService.getWorkbenchState()!==1?d(16961,null):d(16958,null),d(16957,null)];await this.dialogService.prompt({type:ft.Info,message:this.workspaceContextService.getWorkbenchState()!==1?d(16962,null):d(16959,null),buttons:[{label:d(16956,null),run:({checkboxChecked:t})=>this.workspaceTrustRequestService.completeOpenFilesTrustRequest(1,!!t)},{label:d(16954,null),run:({checkboxChecked:t})=>this.workspaceTrustRequestService.completeOpenFilesTrustRequest(2,!!t)}],cancelButton:{run:()=>this.workspaceTrustRequestService.completeOpenFilesTrustRequest(3)},checkbox:{label:d(16960,null),checked:!1},custom:{icon:R.shield,markdownDetails:e.map(t=>({markdown:new Ie(t)}))}})})),this._register(this.workspaceTrustRequestService.onDidInitiateResourcesTrustRequest(async e=>{await this.workspaceTrustManagementService.workspaceResolved;let t=[e?.message??d(16963,null),d(16964,null),`\`${this.labelService.getUriLabel(e.uri)}\``];await this.dialogService.prompt({type:ft.Info,message:d(16965,null),buttons:[{label:d(16984,null),run:()=>this.workspaceTrustRequestService.completeResourcesTrustRequest(e.uri,1)}],cancelButton:{run:()=>this.workspaceTrustRequestService.completeResourcesTrustRequest(e.uri,3)},custom:{icon:R.shield,markdownDetails:t.map(o=>({markdown:new Ie(o)}))}})})),this._register(this.workspaceTrustRequestService.onDidInitiateWorkspaceTrustRequest(async e=>{await this.workspaceTrustManagementService.workspaceResolved;let t=this.useWorkspaceLanguage?d(17003,null):d(16947,null),o=d(16951,null),n=e?.message??o,r=e?.buttons??[{label:this.useWorkspaceLanguage?d(16949,null):d(16948,null),type:"ContinueWithTrust"},{label:d(16953,null),type:"Manage"}];r.some(l=>l.type==="Cancel")||r.push({label:d(16940,null),type:"Cancel"});let{result:s}=await this.dialogService.prompt({type:ft.Info,message:t,custom:{icon:R.shield,markdownDetails:[{markdown:new Ie(n)},{markdown:new Ie(d(16950,null))}]},buttons:r.filter(l=>l.type!=="Cancel").map(l=>({label:l.label,run:()=>l.type})),cancelButton:(()=>{let l=r.find(c=>c.type==="Cancel");if(l)return{label:l.label,run:()=>l.type}})()});switch(s){case"ContinueWithTrust":await this.workspaceTrustRequestService.completeWorkspaceTrustRequest(!0);break;case"ContinueWithoutTrust":await this.workspaceTrustRequestService.completeWorkspaceTrustRequest(void 0);break;case"Manage":this.workspaceTrustRequestService.cancelWorkspaceTrustRequest(),await this.commandService.executeCommand(Bq);break;case"Cancel":this.workspaceTrustRequestService.cancelWorkspaceTrustRequest();break}}))}};JKe=I([m(0,at),m(1,ge),m(2,rt),m(3,Pe),m(4,Nr),m(5,Vu)],JKe);var xut=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super();this.dialogService=e;this.workspaceContextService=t;this.workspaceTrustEnablementService=o;this.workspaceTrustManagementService=n;this.configurationService=r;this.statusbarService=s;this.storageService=l;this.workspaceTrustRequestService=c;this.bannerService=u;this.labelService=p;this.hostService=h;this.productService=g;this.remoteAgentService=f;this.environmentService=v;this.fileService=b;this.entryId="status.workspaceTrust";this.statusbarEntryAccessor=this._register(new me),(async()=>{if(await this.workspaceTrustManagementService.workspaceTrustInitialized,this.workspaceTrustEnablementService.isWorkspaceTrustEnabled())if(this.registerListeners(),this.updateStatusbarEntry(this.workspaceTrustManagementService.isWorkspaceTrusted()),this.hostService.hasFocus)this.showModalOnStart();else{let S=this.hostService.onDidChangeFocus(y=>{y&&(S.dispose(),this.showModalOnStart())})}})()}registerListeners(){this._register(this.workspaceContextService.onWillChangeWorkspaceFolders(e=>{if(e.fromCache||!this.workspaceTrustEnablementService.isWorkspaceTrustEnabled())return;let t=async o=>{if(this.workspaceTrustManagementService.isWorkspaceTrusted()&&(o.changes.added.length||o.changes.changed.length)){let r=await Promise.all(o.changes.added.map(s=>this.workspaceTrustManagementService.getUriTrustInfo(s.uri)));if(!r.map(s=>s.trusted).every(s=>s)){let{confirmed:s}=await this.dialogService.confirm({type:ft.Info,message:d(16939,null),detail:d(16938,null),cancelButton:d(16955,null),custom:{icon:R.shield}});await this.workspaceTrustManagementService.setUrisTrust(r.map(l=>l.uri),s)}}};return e.join(t(e))})),this._register(this.workspaceTrustManagementService.onDidChangeTrust(e=>{this.updateWorkbenchIndicators(e)})),this._register(this.workspaceTrustRequestService.onDidInitiateWorkspaceTrustRequestOnStartup(async()=>{let e,t,o,n,r=await this.isAiGeneratedWorkspace();r&&this.productService.aiGeneratedWorkspaceTrust?(e=this.productService.aiGeneratedWorkspaceTrust.title,t=this.productService.aiGeneratedWorkspaceTrust.startupTrustRequestLearnMore,o=this.productService.aiGeneratedWorkspaceTrust.trustOption,n=this.productService.aiGeneratedWorkspaceTrust.dontTrustOption):console.warn("AI generated workspace trust dialog contents not available.");let s=e??(this.useWorkspaceLanguage?d(17003,null):d(16947,null)),l,c=Dg(this.workspaceContextService.getWorkspace()),u=Zh(c),p=Yj(c);if(!r&&this.workspaceTrustManagementService.canSetParentFolderTrust()){let h=He(ci(c.uri));l=d(16941,null,h)}this.doShowModal(s,{label:o??d(16983,null),sublabel:u?d(16982,null):d(16985,null)},{label:n??d(16944,null),sublabel:u?d(16943,null):d(16945,null)},[u?d(16946,null,this.productService.nameShort):d(17002,null,this.productService.nameShort),t??d(16974,null),p?"":`\`${this.labelService.getWorkspaceLabel(c,{verbose:2})}\``],l)}))}updateWorkbenchIndicators(e){let t=this.getBannerItem(!e);this.updateStatusbarEntry(e),t&&(e?this.bannerService.hide(sPo):this.bannerService.show(t))}async doShowModal(e,t,o,n,r){await this.dialogService.prompt({type:ft.Info,message:e,checkbox:r?{label:r}:void 0,buttons:[{label:t.label,run:async({checkboxChecked:s})=>{s?await this.workspaceTrustManagementService.setParentFolderTrust(!0):await this.workspaceTrustRequestService.completeWorkspaceTrustRequest(!0)}},{label:o.label,run:()=>{this.updateWorkbenchIndicators(!1),this.workspaceTrustRequestService.cancelWorkspaceTrustRequest()}}],custom:{buttonDetails:[t.sublabel,o.sublabel],disableCloseAction:!0,icon:R.shield,markdownDetails:n.map(s=>({markdown:new Ie(s)}))}}),this.storageService.store(aPo,!0,1,1)}async showModalOnStart(){if(this.workspaceTrustManagementService.isWorkspaceTrusted()){this.updateWorkbenchIndicators(!0);return}if(this.workspaceTrustManagementService.canSetWorkspaceTrust()){if(_F(this.workspaceContextService.getWorkspace())){this.updateWorkbenchIndicators(!1);return}if(this.workspaceContextService.getWorkbenchState()===1){this.updateWorkbenchIndicators(!1);return}if(this.startupPromptSetting==="never"){this.updateWorkbenchIndicators(!1);return}if(this.startupPromptSetting==="once"&&this.storageService.getBoolean(aPo,1,!1)){this.updateWorkbenchIndicators(!1);return}this.workspaceTrustRequestService.requestWorkspaceTrustOnStartup()}}get startupPromptSetting(){return this.configurationService.getValue(Whi)}get useWorkspaceLanguage(){return!Zh(Dg(this.workspaceContextService.getWorkspace()))}async isAiGeneratedWorkspace(){let e=A.joinPath(this.environmentService.workspaceStorageHome,"aiGeneratedWorkspaces.json");return await this.fileService.exists(e).then(async t=>{if(t)try{let o=await this.fileService.readFile(e);if(JSON.parse(o.value.toString()).indexOf(this.workspaceContextService.getWorkspace().folders[0].uri.toString())>-1)return!0}catch{}return!1})}getBannerItem(e){let t=this.storageService.getBoolean(lPo,1,!1);if(this.bannerSetting==="never"||this.bannerSetting==="untilDismissed"&&t)return;let o=[{label:d(16970,null),href:"command:"+Bq},{label:d(16969,null),href:"https://aka.ms/vscode-workspace-trust"}];return{id:sPo,icon:S1i,ariaLabel:this.getBannerItemAriaLabels(),message:this.getBannerItemMessages(),actions:o,onClose:()=>{e&&this.storageService.store(lPo,!0,1,1)}}}getBannerItemAriaLabels(){switch(this.workspaceContextService.getWorkbenchState()){case 1:return d(16967,null);case 2:return d(16966,null);case 3:return d(16968,null)}}getBannerItemMessages(){switch(this.workspaceContextService.getWorkbenchState()){case 1:return d(16972,null);case 2:return d(16971,null);case 3:return d(16973,null)}}get bannerSetting(){let e=this.configurationService.getValue(Vhi);return e!=="always"&&Wt&&!this.remoteAgentService.getConnection()?.remoteAuthority?"never":e}getRestrictedModeStatusbarEntry(){let e="",t;switch(this.workspaceContextService.getWorkbenchState()){case 1:{e=d(16976,null),t={value:d(16979,null,`command:${FB}`,`command:${Bq}`),isTrusted:!0,supportThemeIcons:!0};break}case 2:{e=d(16975,null),t={value:d(16978,null,`command:${FB}`,`command:${Bq}`),isTrusted:!0,supportThemeIcons:!0};break}case 3:{e=d(16977,null),t={value:d(16980,null,`command:${FB}`,`command:${Bq}`),isTrusted:!0,supportThemeIcons:!0};break}}return{name:d(16981,null),text:`$(shield) ${d(16986,null)}`,ariaLabel:e,tooltip:t,command:Bq,kind:"prominent"}}updateStatusbarEntry(e){if(e&&this.statusbarEntryAccessor.value){this.statusbarEntryAccessor.clear();return}if(!e&&!this.statusbarEntryAccessor.value){let t=this.getRestrictedModeStatusbarEntry();this.statusbarEntryAccessor.value=this.statusbarService.addEntry(t,this.entryId,0,{location:{id:"status.host",priority:Number.POSITIVE_INFINITY},alignment:1})}}};xut=I([m(0,at),m(1,Pe),m(2,kR),m(3,Nr),m(4,B),m(5,kr),m(6,ce),m(7,Vu),m(8,FD),m(9,rt),m(10,Zt),m(11,tt),m(12,bo),m(13,Eo),m(14,fe)],xut);It(JKe.ID,JKe,St.BlockRestore);ne.as(Qi.Workbench).registerWorkbenchContribution(xut,3);var I1i=class{canSerialize(i){return!0}serialize(i){return""}deserialize(i){return i.createInstance(Ube)}};ne.as(qo.EditorFactory).registerEditorSerializer(Ube.ID,I1i);ne.as(qo.EditorPane).registerEditorPane(Br.create(e$,e$.ID,d(17004,null)),[new Ft(Ube)]);var lIn="workbench.trust.configure",cPo=L(17001,"Workspaces");W(class extends K{constructor(){super({id:lIn,title:L(16942,"Configure Workspace Trust Settings"),precondition:C.and(Vq.IsEnabled,C.equals(`config.${a9e}`,!0)),category:cPo,f1:!0})}run(a){a.get(Go).openUserSettings({jsonEditor:!1,query:`@tag:${i8}`})}});W(class extends K{constructor(){super({id:Bq,title:L(16952,"Manage Workspace Trust"),precondition:C.and(Vq.IsEnabled,C.equals(`config.${a9e}`,!0)),category:cPo,f1:!0})}run(a){let i=a.get(ee),t=a.get(F).createInstance(Ube);i.openEditor(t,{pinned:!0})}});ne.as(Jt.Configuration).registerConfiguration({...G9e,properties:{[a9e]:{type:"boolean",default:!0,description:d(16991,null),tags:[i8],scope:1},[Whi]:{type:"string",default:"once",description:d(16994,null),tags:[i8],scope:1,enum:["always","once","never"],enumDescriptions:[d(16993,null),d(16996,null),d(16995,null)]},[Vhi]:{type:"string",default:"untilDismissed",description:d(16988,null),tags:[i8],scope:1,enum:["always","untilDismissed","never"],enumDescriptions:[d(16987,null),d(16990,null),d(16989,null)]},[s9e]:{type:"string",default:"prompt",markdownDescription:d(16997,null,HLt),tags:[i8],scope:1,enum:["prompt","open","newWindow"],enumDescriptions:[d(17000,null),d(16999,null),d(16998,null)]},[HLt]:{type:"boolean",default:!0,markdownDescription:d(16992,null,s9e),tags:[i8],scope:1}}});var kut=class extends x{constructor(e,t,o,n,r){super();this.environmentService=e;this.telemetryService=t;this.workspaceContextService=o;this.workspaceTrustEnablementService=n;this.workspaceTrustManagementService=r;this.workspaceTrustManagementService.workspaceTrustInitialized.then(()=>{this.logInitialWorkspaceTrustInfo(),this.logWorkspaceTrust(this.workspaceTrustManagementService.isWorkspaceTrusted()),this._register(this.workspaceTrustManagementService.onDidChangeTrust(s=>this.logWorkspaceTrust(s)))})}logInitialWorkspaceTrustInfo(){if(!this.workspaceTrustEnablementService.isWorkspaceTrustEnabled()){let e=this.environmentService.disableWorkspaceTrust;this.telemetryService.publicLog2("workspaceTrustDisabled",{reason:e?"cli":"setting"});return}this.telemetryService.publicLog2("workspaceTrustFolderCounts",{trustedFoldersCount:this.workspaceTrustManagementService.getTrustedUris().length})}async logWorkspaceTrust(e){if(this.workspaceTrustEnablementService.isWorkspaceTrustEnabled()&&(this.telemetryService.publicLog2("workspaceTrustStateChanged",{workspaceId:this.workspaceContextService.getWorkspace().id,isTrusted:e}),e)){let t=o=>{let n=cP(o),r=0;for(;ad(n)!==n&&r<100;)n=ad(n),r++;return r};for(let o of this.workspaceContextService.getWorkspace().folders){let{trusted:n,uri:r}=await this.workspaceTrustManagementService.getUriTrustInfo(o.uri);if(!n)continue;let s=t(o.uri.fsPath),l=t(r.fsPath),c=s-l;this.telemetryService.publicLog2("workspaceFolderDepthBelowTrustedFolder",{workspaceFolderDepth:s,trustedFolderDepth:l,delta:c})}}}};kut=I([m(0,At),m(1,Te),m(2,Pe),m(3,kR),m(4,Nr)],kut);ne.as(Qi.Workbench).registerWorkbenchContribution(kut,3);var Eut=class extends x{constructor(e,t,o,n,r,s){super();this.contextService=e;this.notificationService=t;this.fileService=o;this.quickInputService=n;this.hostService=r;this.storageService=s;this.findWorkspaces()}async findWorkspaces(){let e=this.contextService.getWorkspace().folders[0];if(!e||this.contextService.getWorkbenchState()!==2||_F(this.contextService.getWorkspace()))return;let t=(await this.fileService.resolve(e.uri)).children?.map(o=>o.name);if(Array.isArray(t)){let o=t.filter(GO);o.length>0&&this.doHandleWorkspaceFiles(e.uri,o)}}doHandleWorkspaceFiles(e,t){let o={id:"workspaces.dontPromptToOpen",scope:0,isSecondary:!0};if(t.length===1){let n=t[0];this.notificationService.prompt(ft.Info,d(17067,null,n,"https://go.microsoft.com/fwlink/?linkid=2025315"),[{label:d(17069,null),run:()=>this.hostService.openWindow([{workspaceUri:Ge(e,n)}])}],{neverShowAgain:o,priority:this.storageService.isNew(1)?1:2})}else t.length>1&&this.notificationService.prompt(ft.Info,d(17068,null,"https://go.microsoft.com/fwlink/?linkid=2025315"),[{label:d(17072,null),run:()=>{this.quickInputService.pick(t.map(n=>({label:n})),{placeHolder:d(17071,null)}).then(n=>{n&&this.hostService.openWindow([{workspaceUri:Ge(e,n.label)}])})}}],{neverShowAgain:o,priority:this.storageService.isNew(1)?1:2})}};Eut=I([m(0,Pe),m(1,Ne),m(2,fe),m(3,Ue),m(4,Zt),m(5,ce)],Eut);ne.as(Qi.Workbench).registerWorkbenchContribution(Eut,4);W(class extends K{constructor(){super({id:"workbench.action.openWorkspaceFromEditor",title:L(17070,"Open Workspace"),f1:!1,menu:{id:D.EditorContent,when:C.and(Wo.Extension.isEqualTo(P4e),fr.isEqualTo(w0),ADt.toNegated())}})}async run(a,i){let e=a.get(Zt),t=a.get(Pe),o=a.get(Ne);if(t.getWorkbenchState()===3){let n=t.getWorkspace().configuration;if(n&&Qe(n,i)){o.info(d(17066,null));return}}return e.openWindow([{workspaceUri:i}])}});var ZKe=class extends x{constructor(e,t){super();this._table=e;this._quickInputService=t}async show(){let e=[];this._table.getColumnLabels().forEach((r,s)=>{r&&e.push({label:r,index:s})});let t=await this._quickInputService.pick(e,{placeHolder:d(11480,null)});if(!t)return;let o=await this._quickInputService.input({placeHolder:d(11478,null),prompt:d(11479,null,t.label),validateInput:r=>this._validateColumnResizeValue(r)}),n=o?Number.parseInt(o):void 0;n&&this._table.resizeColumn(t.index,n)}async _validateColumnResizeValue(e){let t=Number.parseInt(e);return e&&!Number.isInteger(t)?d(11477,null):t<0||t>100?d(11476,null):null}};ZKe=I([m(1,Ue)],ZKe);var Y6t=class extends K{constructor(){super({id:"list.resizeColumn",title:{value:d(11475,null),original:"Resize Column"},category:{value:d(11474,null),original:"List"},precondition:vc,f1:!0})}async run(i){let e=i.get(Io),t=i.get(F),o=e.lastFocusedList;o instanceof iF&&await t.createInstance(ZKe,o).show()}};var e2e=class{static{this.ID="workbench.contrib.listContext"}constructor(i){i.createKey("listSupportsTypeNavigation",!0),i.createKey("listSupportsKeyboardNavigation",!0)}};e2e=I([m(0,X)],e2e);It(e2e.ID,e2e,St.BlockStartup);W(Y6t);var t2e=class extends x{constructor(e,t){super();this.accessibilitySignalService=t;let o=ui(this,t.onSoundEnabledChanged($o.onDebugBreak),()=>t.isSoundEnabled($o.onDebugBreak));this._register(il((n,r)=>{if(!o.read(n))return;let s=new Map;r.add(Z(()=>{s.forEach(l=>l.dispose()),s.clear()})),r.add(e.onDidNewSession(l=>s.set(l,this.handleSession(l)))),r.add(e.onDidEndSession(({session:l})=>{s.get(l)?.dispose(),s.delete(l)})),e.getModel().getSessions().forEach(l=>s.set(l,this.handleSession(l)))}))}handleSession(e){return e.onDidChangeState(t=>{let o=e.getStoppedDetails();o&&o.reason==="breakpoint"&&this.accessibilitySignalService.playSignal($o.onDebugBreak)})}};t2e=I([m(0,Ni),m(1,lr)],t2e);var X6t=class a extends K{static{this.ID="signals.sounds.help"}constructor(){super({id:a.ID,title:L(5301,"Help: List Signal Sounds"),f1:!0,metadata:{description:d(5297,null)}})}async run(i){let e=i.get(lr),t=i.get(Ue),o=i.get(B),n=i.get(Oi),r=i.get(Go),s=[$o.save,$o.format],l=$o.allAccessibilitySignals.map((p,h)=>({label:s.includes(p)?`${p.name} (${o.getValue(p.settingsKey+".sound")})`:p.name,signal:p,buttons:s.includes(p)?[{iconClass:q.asClassName(R.settingsGear),tooltip:d(5303,null),alwaysVisible:!0}]:[]})).sort((p,h)=>p.label.localeCompare(h.label)),c=new N,u=c.add(t.createQuickPick());u.items=l,u.selectedItems=l.filter(p=>e.isSoundEnabled(p.signal)||s.includes(p.signal)&&o.getValue(p.signal.settingsKey+".sound")!=="never"),c.add(u.onDidAccept(()=>{let p=u.selectedItems.map(g=>g.signal),h=u.items.map(g=>g.signal).filter(g=>!p.includes(g));for(let g of p){let{sound:f,announcement:v}=o.getValue(g.settingsKey);f=s.includes(g)?"userGesture":n.isScreenReaderOptimized()?"auto":"on",v?o.updateValue(g.settingsKey,{sound:f,announcement:v}):o.updateValue(g.settingsKey,{sound:f})}for(let g of h){let f=o.getValue(g.settingsKey+".announcement"),v=dPo(s.includes(g),n.isScreenReaderOptimized()),b=f?{sound:v,announcement:f}:{sound:v};o.updateValue(g.settingsKey,b)}u.hide()})),c.add(u.onDidTriggerItemButton(p=>{r.openUserSettings({jsonEditor:!0,revealSetting:{key:p.item.signal.settingsKey,edit:!0}})})),c.add(u.onDidChangeActive(()=>{e.playSound(u.activeItems[0].signal.sound.getSound(!0),!0,J8i)})),c.add(u.onDidHide(()=>c.dispose())),u.placeholder=d(5302,null),u.canSelectMany=!0,await u.show()}};function dPo(a,i){return i?a?"never":"off":a?"never":"auto"}var J6t=class a extends K{static{this.ID="accessibility.announcement.help"}constructor(){super({id:a.ID,title:L(5295,"Help: List Signal Announcements"),f1:!0,metadata:{description:d(5296,null)}})}async run(i){let e=i.get(lr),t=i.get(Ue),o=i.get(B),n=i.get(Oi),r=i.get(Go),s=[$o.save,$o.format],l=$o.allAccessibilitySignals.filter(h=>!!h.legacyAnnouncementSettingsKey).map((h,g)=>({label:s.includes(h)?`${h.name} (${o.getValue(h.settingsKey+".announcement")})`:h.name,signal:h,buttons:s.includes(h)?[{iconClass:q.asClassName(R.settingsGear),tooltip:d(5300,null),alwaysVisible:!0}]:[]})).sort((h,g)=>h.label.localeCompare(g.label)),c=new N,u=c.add(t.createQuickPick());u.items=l,u.selectedItems=l.filter(h=>e.isAnnouncementEnabled(h.signal)||s.includes(h.signal)&&o.getValue(h.signal.settingsKey+".announcement")!=="never");let p=n.isScreenReaderOptimized();c.add(u.onDidAccept(()=>{if(!p){u.hide();return}let h=u.selectedItems.map(f=>f.signal),g=$o.allAccessibilitySignals.filter(f=>!!f.legacyAnnouncementSettingsKey&&!h.includes(f));for(let f of h){let{sound:v,announcement:b}=o.getValue(f.settingsKey);b=s.includes(f)?"userGesture":f.announcementMessage&&n.isScreenReaderOptimized()?"auto":void 0,o.updateValue(f.settingsKey,{sound:v,announcement:b})}for(let f of g){let v=dPo(s.includes(f),!0),b=o.getValue(f.settingsKey+".sound"),S=v?{sound:b,announcement:v}:{sound:b};o.updateValue(f.settingsKey,S)}u.hide()})),c.add(u.onDidTriggerItemButton(h=>{r.openUserSettings({jsonEditor:!0,revealSetting:{key:h.item.signal.settingsKey,edit:!0}})})),c.add(u.onDidHide(()=>c.dispose())),u.placeholder=p?d(5298,null):d(5299,null),u.canSelectMany=!0,await u.show()}};var i2e=class extends x{constructor(e,t,o){super();this._editorService=e;this._instantiationService=t;this._accessibilitySignalService=o;this._textProperties=[this._instantiationService.createInstance(o2e,$o.errorAtPosition,$o.errorOnLine,8),this._instantiationService.createInstance(o2e,$o.warningAtPosition,$o.warningOnLine,4),this._instantiationService.createInstance(y1i),this._instantiationService.createInstance(Tut)],this._someAccessibilitySignalIsEnabled=ke(this,n=>this._textProperties.flatMap(r=>[r.lineSignal,r.positionSignal]).filter(lo).some(r=>lae(this,this._accessibilitySignalService.getEnabledState(r,!1)).read(n))),this._activeEditorObservable=ui(this,this._editorService.onDidActiveEditorChange,n=>{let r=this._editorService.activeTextEditorControl,s=mc(r)?r.getOriginalEditor():pn(r)?r:void 0;return s&&s.hasModel()?{editor:s,model:s.getModel()}:void 0}),this._register(il((n,r)=>{if(!this._someAccessibilitySignalIsEnabled.read(n))return;let s=this._activeEditorObservable.read(n);s&&this._registerAccessibilitySignalsForEditor(s.editor,s.model,r)}))}_registerAccessibilitySignalsForEditor(e,t,o){let n=-1,r=new Set,s=o.add(new N),l=this._textProperties.map(u=>({source:u.createSource(e,t),property:u})),c=EJt(e.onDidChangeModelContent,100,o);o.add(e.onDidChangeCursorPosition(u=>{if(s.clear(),u&&u.reason!==3&&u.reason!==0){r.clear();return}let p=(f,v,b)=>{let S=b==="line"?f.lineSignal:f.positionSignal;if(!(!S||!this._accessibilitySignalService.getEnabledState(S,!1).value||!v.isPresent(h,b,void 0))){for(let y of["sound","announcement"])if(this._accessibilitySignalService.getEnabledState(S,!1,y).value){let w=this._accessibilitySignalService.getDelayMs(S,y,b)+(c.get()?1e3:0);s.add(tn(()=>{v.isPresent(h,b,void 0)&&((b!=="line"||!r.has(f))&&this._accessibilitySignalService.playSignal(S,{modality:y}),r.add(f))},w))}}},h=u.position,g=h.lineNumber;if(g!==n){r.clear(),n=g;for(let f of l)p(f.property,f.source,"line")}for(let f of l)p(f.property,f.source,"positional");for(let f of l){if(![f.property.lineSignal,f.property.positionSignal].some(S=>S&&this._accessibilitySignalService.getEnabledState(S,!1).value))return;let v,b;s.add(be(S=>{let y=f.source.isPresentAtPosition(u.position,S),w=f.source.isPresentOnLine(u.position.lineNumber,S);v!==void 0&&v!==void 0&&(!v&&y&&p(f.property,f.source,"positional"),!b&&w&&p(f.property,f.source,"line")),v=y,b=w}))}}))}};i2e=I([m(0,ee),m(1,F),m(2,lr)],i2e);var n2e=class a{static{this.notPresent=new a({isPresentAtPosition:()=>!1,isPresentOnLine:()=>!1})}constructor(i){this.isPresentOnLine=i.isPresentOnLine,this.isPresentAtPosition=i.isPresentAtPosition??(()=>!1)}isPresent(i,e,t){return e==="line"?this.isPresentOnLine(i.lineNumber,t):this.isPresentAtPosition(i,t)}},o2e=class{constructor(i,e,t,o){this.positionSignal=i;this.lineSignal=e;this.severity=t;this.markerService=o;this.debounceWhileTyping=!0}createSource(i,e){let t=Fr("onMarkerChanged",this.markerService.onMarkerChanged);return new n2e({isPresentAtPosition:(o,n)=>(t.read(n),this.markerService.read({resource:e.uri}).some(s=>s.severity===this.severity&&s.startLineNumber<=o.lineNumber&&o.lineNumber<=s.endLineNumber&&s.startColumn<=o.column&&o.column<=s.endColumn)),isPresentOnLine:(o,n)=>(t.read(n),this.markerService.read({resource:e.uri}).some(s=>s.severity===this.severity&&s.startLineNumber<=o&&o<=s.endLineNumber))})}};o2e=I([m(3,oa)],o2e);var y1i=class{constructor(){this.lineSignal=$o.foldedArea}createSource(i,e){let t=gf.get(i);if(!t)return n2e.notPresent;let o=R$e(t.getFoldingModel()??Promise.resolve(void 0));return new n2e({isPresentOnLine(n,r){let l=o.read(r).value?.getRegionAtLine(n);return l?l.isCollapsed&&l.startLineNumber===n:!1}})}},Tut=class{constructor(i){this.debugService=i;this.lineSignal=$o.break}createSource(i,e){let t=Fr("onDidChangeBreakpoints",this.debugService.getModel().onDidChangeBreakpoints),o=this.debugService;return new n2e({isPresentOnLine(n,r){return t.read(r),o.getModel().getBreakpoints({uri:e.uri,lineNumber:n}).length>0}})}};Tut=I([m(0,Ni)],Tut);Ee(lr,mCe,1);It("EditorTextPropertySignalsContribution",NXi(()=>i2e),St.AfterRestored);It("AccessibilitySignalLineDebuggerContribution",t2e,St.AfterRestored);W(X6t);W(J6t);var _ut=class{constructor(i,e,t){this.configurationService=i;this.extensionsWorkbenchService=e;this.telemetryService=t;this.init().catch(mt)}async init(){let i="coenraads.bracket-pair-colorizer-2";await this.extensionsWorkbenchService.queryLocal();let e=this.extensionsWorkbenchService.installed.find(n=>n.identifier.id===i);if(!e||e.enablementState!==12&&e.enablementState!==13)return;let o=!!this.configurationService.getValue("editor.bracketPairColorization.enabled");this.telemetryService.publicLog2("bracketPairColorizerTwoUsage",{nativeColorizationEnabled:o})}};_ut=I([m(0,B),m(1,Hi),m(2,Te)],_ut);ne.as(Qi.Workbench).registerWorkbenchContribution(_ut,3);var r2e=class extends x{constructor(e){super();this._styleElementDisposables=void 0;this._register(Z(()=>this._removeStyleElement())),this._register(U.runAndSubscribe(e.onDidChangeConfiguration,t=>{if(t&&!t.affectsConfiguration("accessibility.dimUnfocused.enabled")&&!t.affectsConfiguration("accessibility.dimUnfocused.opacity"))return;let o="";if(cIn(e.getValue("accessibility.dimUnfocused.enabled"),!1)){let r=Bn(dIn(e.getValue("accessibility.dimUnfocused.opacity"),.75),.2,1);if(r!==1){let s=new Set,l=`filter: opacity(${r});`;s.add(`.monaco-workbench .pane-body.integrated-terminal:not(:focus-within) .tabs-container { ${l} }`),s.add(`.monaco-workbench .pane-body.integrated-terminal .terminal-wrapper:not(:focus-within) { ${l} }`),s.add(`.monaco-workbench .editor-instance:not(:focus-within) .monaco-editor { ${l} }`),s.add(`.monaco-workbench .editor-instance:not(:focus-within) .breadcrumbs-below-tabs { ${l} }`),s.add(`.monaco-workbench .editor-instance:not(:focus-within) .terminal-wrapper { ${l} }`),s.add(`.monaco-workbench .editor-instance:not(:focus-within) .settings-editor { ${l} }`),s.add(`.monaco-workbench .editor-instance:not(:focus-within) .keybindings-editor { ${l} }`),s.add(`.monaco-workbench .editor-instance:not(:focus-within) .monaco-editor-pane-placeholder { ${l} }`),s.add(`.monaco-workbench .editor-instance:not(:focus-within) .gettingStartedContainer { ${l} }`),o=[...s].join(`
`)}}o.length===0?this._removeStyleElement():this._getStyleElement().textContent=o}))}_getStyleElement(){return this._styleElement||(this._styleElementDisposables=new N,this._styleElement=Cr(void 0,void 0,this._styleElementDisposables),this._styleElement.className="accessibilityUnfocusedViewOpacity"),this._styleElement}_removeStyleElement(){this._styleElementDisposables?.dispose(),this._styleElementDisposables=void 0,this._styleElement=void 0}};r2e=I([m(0,B)],r2e);function cIn(a,i){return typeof a=="boolean"?a:i}function dIn(a,i){return typeof a=="number"?a:i}var zbe=class extends x{constructor(e,t,o,n,r){super();this.configurationService=e;this.notificationService=t;this.accessibilityService=o;this.statusbarService=n;this.openerService=r;this.screenReaderNotification=null;this.promptedScreenReader=!1;this.screenReaderModeElement=this._register(new me);this._register($e.registerCommand({id:"showEditorScreenReaderNotification",handler:()=>this.showScreenReaderNotification()})),this.updateScreenReaderModeElement(this.accessibilityService.isScreenReaderOptimized()),this.registerListeners()}static{this.ID="workbench.contrib.accessibilityStatus"}registerListeners(){this._register(this.accessibilityService.onDidChangeScreenReaderOptimized(()=>this.onScreenReaderModeChange())),this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration("editor.accessibilitySupport")&&this.onScreenReaderModeChange()}))}showScreenReaderNotification(){this.screenReaderNotification=this.notificationService.prompt(bt.Info,d(5252,null,"editor.accessibilitySupport"),[{label:d(5251,null),run:()=>{this.configurationService.updateValue("editor.accessibilitySupport","on",2)}},{label:d(5250,null),run:()=>{this.configurationService.updateValue("editor.accessibilitySupport","off",2)}},{label:d(5249,null),run:()=>{this.openerService.open("https://code.visualstudio.com/docs/editor/accessibility#_screen-readers")}}],{sticky:!0,priority:3}),U.once(this.screenReaderNotification.onDidClose)(()=>this.screenReaderNotification=null)}updateScreenReaderModeElement(e){if(e){if(!this.screenReaderModeElement.value){let t=d(5248,null);this.screenReaderModeElement.value=this.statusbarService.addEntry({name:d(5253,null),text:t,ariaLabel:t,command:"showEditorScreenReaderNotification",kind:"prominent",showInAllWindows:!0},"status.editor.screenReaderMode",1,100.6)}}else this.screenReaderModeElement.clear()}onScreenReaderModeChange(){this.accessibilityService.isScreenReaderOptimized()&&this.configurationService.getValue("editor.accessibilitySupport")==="auto"&&(this.promptedScreenReader||(this.promptedScreenReader=!0,setTimeout(()=>this.showScreenReaderNotification(),100))),this.screenReaderNotification&&this.screenReaderNotification.close(),this.updateScreenReaderModeElement(this.accessibilityService.isScreenReaderOptimized())}};zbe=I([m(0,B),m(1,Ne),m(2,Oi),m(3,kr),m(4,Je)],zbe);var Kbe=class extends x{constructor(e,t){super();this._accessibilitySignalService=e;this._workingCopyService=t;this._register(this._workingCopyService.onDidSave(o=>this._accessibilitySignalService.playSignal($o.save,{userGesture:o.reason===1})))}static{this.ID="workbench.contrib.saveAccessibilitySignal"}};Kbe=I([m(0,lr),m(1,Xa)],Kbe);var Gbe=class extends x{constructor(e,t,o){super();this._editorService=e;this._accessibilityService=t;this._configurationService=o;this._register(U.runAndSubscribe(t.onDidChangeScreenReaderOptimized,()=>this._updateListener())),this._register(o.onDidChangeConfiguration(n=>{n.affectsConfiguration("accessibility.verbosity.diffEditorActive")&&this._updateListener()}))}static{this.ID="workbench.contrib.diffEditorActiveAnnouncement"}_updateListener(){let e=this._configurationService.getValue("accessibility.verbosity.diffEditorActive"),t=this._accessibilityService.isScreenReaderOptimized();if(!e||!t){this._onDidActiveEditorChangeListener?.dispose(),this._onDidActiveEditorChangeListener=void 0;return}this._onDidActiveEditorChangeListener||(this._onDidActiveEditorChangeListener=this._register(this._editorService.onDidActiveEditorChange(()=>{mc(this._editorService.activeTextEditorControl)&&this._accessibilityService.alert(d(5304,null))})))}};Gbe=I([m(0,ee),m(1,Oi),m(2,B)],Gbe);var qbe=class extends x{constructor(e,t){super();this._accessibilitySignalService=e;this._speechService=t;this._register(this._speechService.onDidStartSpeechToTextSession(()=>this._accessibilitySignalService.playSignal($o.voiceRecordingStarted))),this._register(this._speechService.onDidEndSpeechToTextSession(()=>this._accessibilitySignalService.playSignal($o.voiceRecordingStopped)))}static{this.ID="workbench.contrib.speechAccessibilitySignal"}};qbe=I([m(0,lr),m(1,ZC)],qbe);function uPo(a,i){if(!i)return;let e=[],t=[],o=i.matchAll(/(\<keybinding:(?<commandId>[^\<]*)\>)/gm);for(let r of[...o]){let s=r?.groups?.commandId,l;if(r?.length&&s){let c=a.lookupKeybinding(s)?.getAriaLabel();c?(l=" ("+c+")",t.push({label:s,id:s})):(l=" (unassigned keybinding)",e.push({label:s,id:s})),i=i.replace(r[0],l)}}let n=new Ie(i);return n.isTrusted=!0,{content:n,configureKeybindingItems:e.length?e:void 0,configuredKeybindingItems:t.length?t:void 0}}var Dut=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super();this._openerService=e;this._instantiationService=t;this._configurationService=o;this._modelService=n;this._contextViewService=r;this._contextKeyService=s;this._accessibilityService=l;this._keybindingService=c;this._layoutService=u;this._menuService=p;this._commandService=h;this._codeBlockContextProviderService=g;this._storageService=f;this._quickInputService=v;this._accessibilitySignalService=b;this._isInQuickPick=!1;this._lastProviderPosition=new Map;this._accessiblityHelpIsShown=ox.bindTo(this._contextKeyService),this._accessibleViewIsShown=Dd.bindTo(this._contextKeyService),this._accessibleViewSupportsNavigation=ipe.bindTo(this._contextKeyService),this._accessibleViewVerbosityEnabled=RYe.bindTo(this._contextKeyService),this._accessibleViewGoToSymbolSupported=MYe.bindTo(this._contextKeyService),this._accessibleViewCurrentProviderId=cu.bindTo(this._contextKeyService),this._accessibleViewInCodeBlock=eDe.bindTo(this._contextKeyService),this._accessibleViewContainsCodeBlocks=ope.bindTo(this._contextKeyService),this._onLastLine=wAt.bindTo(this._contextKeyService),this._hasUnassignedKeybindings=PYe.bindTo(this._contextKeyService),this._hasAssignedKeybindings=AYe.bindTo(this._contextKeyService),this._container=document.createElement("div"),this._container.classList.add("accessible-view"),this._configurationService.getValue("accessibility.hideAccessibleView")&&this._container.classList.add("hide");let S={contributions:Ba.getEditorContributions().filter(P=>P.id!==Cp.ID&&P.id!==zee.ID&&P.id!==vB.ID)},y=document.createElement("div");y.classList.add("accessible-view-title-bar"),this._title=document.createElement("div"),this._title.classList.add("accessible-view-title"),y.appendChild(this._title);let w=document.createElement("div");w.classList.add("accessible-view-action-bar"),y.appendChild(w),this._container.appendChild(y),this._toolbar=this._register(t.createInstance(ol,w,{orientation:0})),this._toolbar.context={viewId:"accessibleView"};let k=this._toolbar.getElement();k.tabIndex=0;let T={...Vb(this._configurationService),lineDecorationsWidth:6,dragAndDrop:!1,cursorWidth:1,wordWrap:"off",wrappingStrategy:"advanced",wrappingIndent:"none",padding:{top:2,bottom:2},quickSuggestions:!1,renderWhitespace:"none",dropIntoEditor:{enabled:!1},readOnly:!0,fontFamily:"var(--monaco-monospace-font)"};this._editorWidget=this._register(this._instantiationService.createInstance(Xr,this._container,T,S)),this._register(this._accessibilityService.onDidChangeScreenReaderOptimized(()=>{this._currentProvider&&this._accessiblityHelpIsShown.get()&&this.show(this._currentProvider)})),this._register(this._configurationService.onDidChangeConfiguration(P=>{dEt(this._currentProvider)&&P.affectsConfiguration(this._currentProvider.verbositySettingKey)&&(this._accessiblityHelpIsShown.get()&&this.show(this._currentProvider),this._accessibleViewVerbosityEnabled.set(this._configurationService.getValue(this._currentProvider.verbositySettingKey)),this._updateToolbar(this._currentProvider.actions,this._currentProvider.options.type)),P.affectsConfiguration("accessibility.hideAccessibleView")&&this._container.classList.toggle("hide",this._configurationService.getValue("accessibility.hideAccessibleView"))})),this._register(this._editorWidget.onDidDispose(()=>this._resetContextKeys())),this._register(this._editorWidget.onDidChangeCursorPosition(()=>{this._onLastLine.set(this._editorWidget.getPosition()?.lineNumber===this._editorWidget.getModel()?.getLineCount());let P=this._editorWidget.getPosition()?.lineNumber;if(this._codeBlocks&&P!==void 0){let O=this._codeBlocks.find(V=>V.startLine<=P&&V.endLine>=P)!==void 0;this._accessibleViewInCodeBlock.set(O)}this._playDiffSignals()}))}get editorWidget(){return this._editorWidget}_playDiffSignals(){if(this._currentProvider?.id!=="diffEditor"&&this._currentProvider?.id!=="inlineCompletions")return;let e=this._editorWidget.getPosition(),t=this._editorWidget.getModel();if(!e||!t)return;let o=t.getLineContent(e.lineNumber);o?.startsWith("+")?this._accessibilitySignalService.playSignal($o.diffLineInserted):o?.startsWith("-")&&this._accessibilitySignalService.playSignal($o.diffLineDeleted)}_resetContextKeys(){this._accessiblityHelpIsShown.reset(),this._accessibleViewIsShown.reset(),this._accessibleViewSupportsNavigation.reset(),this._accessibleViewVerbosityEnabled.reset(),this._accessibleViewGoToSymbolSupported.reset(),this._accessibleViewCurrentProviderId.reset(),this._hasAssignedKeybindings.reset(),this._hasUnassignedKeybindings.reset()}getPosition(e){if(!(!e||!this._lastProvider||this._lastProvider.id!==e))return this._editorWidget.getPosition()||void 0}setPosition(e,t,o){if(this._editorWidget.setPosition(e),t&&this._editorWidget.revealPosition(e),o){let n=this._editorWidget.getModel()?.getLineLength(e.lineNumber)??0;n&&this._editorWidget.setSelection({startLineNumber:e.lineNumber,startColumn:1,endLineNumber:e.lineNumber,endColumn:n+1})}}getCodeBlockContext(){let e=this._editorWidget.getPosition();if(!this._codeBlocks?.length||!e)return;let t=this._codeBlocks?.findIndex(n=>n.startLine<=e?.lineNumber&&n.endLine>=e?.lineNumber),o=t!==void 0&&t>-1?this._codeBlocks[t]:void 0;if(!(!o||t===void 0))return{code:o.code,languageId:o.languageId,codeBlockIndex:t,element:void 0,chatSessionResource:o.chatSessionResource}}navigateToCodeBlock(e){let t=this._editorWidget.getPosition();if(!this._codeBlocks?.length||!t)return;let o,n=this._codeBlocks.slice();e==="previous"?o=n.reverse().find(r=>r.endLine<t.lineNumber):o=n.find(r=>r.startLine>t.lineNumber),o&&this.setPosition(new ye(o.startLine,1),!0)}showLastProvider(e){!this._lastProvider||this._lastProvider.options.id!==e||this.show(this._lastProvider)}show(e,t,o,n){if(e=e??this._currentProvider,!e)return;e.onOpen?.();let r={getAnchor:()=>({x:Ki().innerWidth/2-Math.min(this._layoutService.activeContainerDimension.width*.75,900)/2,y:this._layoutService.activeContainerOffset.quickPickTop}),render:s=>(this._viewContainer=s,this._viewContainer.classList.add("accessible-view-container"),this._render(e,s,o)),onHide:()=>{if(!o){if(this._updateLastProvider(),this._currentProvider){let s=this._editorWidget.getPosition();s&&this._lastProviderPosition.set(this._currentProvider.id,s)}this._currentProvider?.dispose(),this._currentProvider=void 0,this._resetContextKeys()}}};this._contextViewService.showContextView(r),n&&queueMicrotask(()=>{this._editorWidget.revealLine(n.lineNumber),this._editorWidget.setSelection({startLineNumber:n.lineNumber,startColumn:n.column,endLineNumber:n.lineNumber,endColumn:n.column})}),t&&this._currentProvider&&this.showSymbol(this._currentProvider,t),e instanceof xp&&e.onDidRequestClearLastProvider&&this._register(e.onDidRequestClearLastProvider(s=>{this._lastProvider?.options.id===s&&(this._lastProvider=void 0),this._lastProviderPosition.delete(s)})),e.options.id&&(this._lastProvider=e),(e.id==="panelChat"||e.id==="quickChat")&&this._register(this._codeBlockContextProviderService.registerProvider({getCodeBlockContext:()=>this.getCodeBlockContext()},"accessibleView")),e instanceof hX&&this._storageService.store(`${Z$e}${e.id}`,!0,-1,0),e.onDidChangeContent&&this._register(e.onDidChangeContent(()=>{this._viewContainer&&this._render(e,this._viewContainer,o)}))}previous(){let e=this._currentProvider?.providePreviousContent?.();!this._currentProvider||!this._viewContainer||!e||this._render(this._currentProvider,this._viewContainer,void 0,e)}next(){let e=this._currentProvider?.provideNextContent?.();!this._currentProvider||!this._viewContainer||!e||this._render(this._currentProvider,this._viewContainer,void 0,e)}_verbosityEnabled(){return this._currentProvider?dEt(this._currentProvider)?this._configurationService.getValue(this._currentProvider.verbositySettingKey)===!0:this._storageService.getBoolean(`${Z$e}${this._currentProvider.id}`,-1,!1):!1}goToSymbol(){this._currentProvider&&(this._isInQuickPick=!0,this._instantiationService.createInstance(Lut,this).show(this._currentProvider))}calculateCodeBlocks(e){if(!e||this._currentProvider?.id!=="panelChat"&&this._currentProvider?.id!=="quickChat"||this._currentProvider.options.language&&this._currentProvider.options.language!=="markdown")return;let t=e.split(`
`);this._codeBlocks=[];let o=!1,n=0,r;t.forEach((s,l)=>{if(!o&&s.startsWith("```"))o=!0,n=l+1,r=s.substring(3).trim();else if(o&&s.endsWith("```")){o=!1;let c=l,u=t.slice(n,c).join(`
`);this._codeBlocks?.push({startLine:n,endLine:c,code:u,languageId:r,chatSessionResource:void 0})}}),this._accessibleViewContainsCodeBlocks.set(this._codeBlocks.length>0)}getSymbols(){let e=this._currentProvider?this._currentProvider:void 0;if(!this._currentContent||!e)return;let t="getSymbols"in e?e.getSymbols?.()||[]:[];if(t?.length)return t;if(e.options.language&&e.options.language!=="markdown")return;let o=oc.lexer(this._currentContent);if(o)return this._convertTokensToSymbols(o,t),t.length?t:void 0}openHelpLink(){this._currentProvider?.options.readMoreUrl&&this._openerService.open(A.parse(this._currentProvider.options.readMoreUrl))}configureKeybindings(e){this._isInQuickPick=!0;let t=this._updateLastProvider(),o=e?t?.options?.configureKeybindingItems:t?.options?.configuredKeybindingItems;if(!o)return;let n=this._register(new N),r=n.add(this._quickInputService.createQuickPick());r.items=o,r.title=d(5276,null),r.placeholder=d(5279,null),r.show(),n.add(r.onDidAccept(async()=>{let s=r.selectedItems[0];s&&await this._commandService.executeCommand("workbench.action.openGlobalKeybindings",s.id),r.dispose()})),n.add(r.onDidHide(()=>{!r.selectedItems.length&&t&&this.show(t),n.dispose(),this._isInQuickPick=!1}))}_convertTokensToSymbols(e,t){let o;for(let n of e){let r;if("type"in n)switch(n.type){case"heading":case"paragraph":case"code":r=n.text;break;case"list":{let s=n.items[0];if(!s)break;o=`- ${s.text}`,r=n.items.map(l=>l.text).join(", ");break}}r&&(t.push({markdownToParse:r,label:d(5280,null,n.type,r),ariaLabel:d(5281,null,n.type,r),firstListItem:o}),o=void 0)}}showSymbol(e,t){if(!this._currentContent)return;let o=t.lineNumber,n=t.markdownToParse;if(!(o===void 0&&n===void 0)){if(o===void 0&&n){let r=this._currentContent.split(`
`).findIndex(s=>s.includes(n.split(`
`)[0])||t.firstListItem&&s.includes(t.firstListItem))??-1;r>=0&&(o=r+1)}o!==void 0&&(this._isInQuickPick=!1,this.show(e,void 0,void 0,{lineNumber:o,column:1}),this._updateContextKeys(e,!0))}}disableHint(){dEt(this._currentProvider)&&(this._configurationService.updateValue(this._currentProvider?.verbositySettingKey,!1),en(d(5270,null,this._currentProvider.verbositySettingKey)))}_updateContextKeys(e,t){e.options.type==="help"?(this._accessiblityHelpIsShown.set(t),this._accessibleViewIsShown.reset()):(this._accessibleViewIsShown.set(t),this._accessiblityHelpIsShown.reset()),this._accessibleViewSupportsNavigation.set(e.provideNextContent!==void 0||e.providePreviousContent!==void 0),this._accessibleViewVerbosityEnabled.set(this._verbosityEnabled()),this._accessibleViewGoToSymbolSupported.set(this._goToSymbolsSupported()?this.getSymbols()?.length>0:!1)}_getStableUri(e){return A.from({path:`accessible-view-${e}`,scheme:Q.accessibleView})}_updateContent(e,t){let o=t??e.provideContent();if(e.options.type==="view"){this._currentContent=o,this._hasUnassignedKeybindings.reset(),this._hasAssignedKeybindings.reset();return}let n=this._readMoreHint(e),r=this._disableVerbosityHint(e),s=this._screenReaderModeHint(e),l=this._exitDialogHint(e),c="",u="",p=uPo(this._keybindingService,s+o+n+r+l);p&&(o=p.content.value,p.configureKeybindingItems?(e.options.configureKeybindingItems=p.configureKeybindingItems,this._hasUnassignedKeybindings.set(!0),c=this._configureUnassignedKbHint()):this._hasAssignedKeybindings.reset(),p.configuredKeybindingItems?(e.options.configuredKeybindingItems=p.configuredKeybindingItems,this._hasAssignedKeybindings.set(!0),u=this._configureAssignedKbHint()):this._hasAssignedKeybindings.reset()),this._currentContent=o+c+u}_render(e,t,o,n){let s=this._currentProvider?.id===e.id?this._editorWidget.getPosition():void 0;this._currentProvider=e,this._accessibleViewCurrentProviderId.set(e.id);let l=this._verbosityEnabled();this._updateContent(e,n),this.calculateCodeBlocks(this._currentContent),this._updateContextKeys(e,!0);let c=this._editorWidget.hasTextFocus()||this._editorWidget.hasWidgetFocus(),u=this._getStableUri(e.id);this._getTextModel(u).then(g=>{if(!g)return;let f=this._currentContent??"";if(g.getValue()!==f&&g.setValue(f),this._editorWidget.getModel()!==g&&this._editorWidget.setModel(g),!this._editorWidget.getDomNode())return;g.setLanguage(e.options.language??"markdown"),t.appendChild(this._container);let b="",S=this._accessibleViewSupportsNavigation.get()||this._accessibleViewVerbosityEnabled.get()||this._accessibleViewGoToSymbolSupported.get()||e.actions?.length;l&&!o&&S&&(b=e.options.position?d(5267,null):d(5266,null));let y=e.options.type==="help"?d(5254,null):d(5256,null);if(this._title.textContent=y,b&&e.options.type==="view"?y=d(5257,null,b):b&&(y=d(5255,null,b)),ei&&c&&(y=""),this._editorWidget.updateOptions({ariaLabel:y}),this._editorWidget.focus(),this._currentProvider?.options.position){let w=this._editorWidget.getPosition(),k=w?.lineNumber===1&&w.column===1;if(this._currentProvider.options.position==="bottom"||this._currentProvider.options.position==="initial-bottom"&&k){let T=this.editorWidget.getModel()?.getLineCount(),P=T!==void 0&&T>0?new ye(T,1):void 0;P&&(this._editorWidget.setPosition(P),this._editorWidget.revealLine(P.lineNumber))}}else if(s)this._editorWidget.setPosition(s);else{let w=this._lastProviderPosition.get(e.id);if(w){let k=this._editorWidget.getModel()?.getLineCount()??0;w.lineNumber<=k&&(this._editorWidget.setPosition(w),this._editorWidget.revealPosition(w))}}}),this._updateToolbar(this._currentProvider.actions,e.options.type);let p=g=>{if(!Re(this._editorWidget.getDomNode()).document.hasFocus()){g?.preventDefault(),g?.stopPropagation();return}if(this._isInQuickPick||e.onClose(),g?.stopPropagation(),this._contextViewService.hideContextView(),this._isInQuickPick)return;this._updateContextKeys(e,!1);let v=this._editorWidget.getPosition();v&&this._lastProviderPosition.set(e.id,v),this._lastProvider=void 0,this._currentContent=void 0,this._currentProvider?.dispose(),this._currentProvider=void 0},h=new N;return h.add(this._editorWidget.onKeyDown(g=>{if(g.keyCode===3)this._commandService.executeCommand("editor.action.openLink");else if(g.keyCode===9||uIn(g.browserEvent,this._keybindingService,this._configurationService))p(g);else if(g.keyCode===38&&e.options.readMoreUrl){let f=e.options.readMoreUrl;en(xc.openingDocs),this._openerService.open(A.parse(f)),g.preventDefault(),g.stopPropagation()}e instanceof xp&&e.onKeyDown?.(g)})),h.add(j(this._toolbar.getElement(),re.KEY_DOWN,g=>{new gi(g).equals(9)&&p(g)})),h.add(this._editorWidget.onDidBlurEditorWidget(()=>{wa(this._toolbar.getElement())||p()})),h.add(this._editorWidget.onDidContentSizeChange(()=>this._layout())),h.add(this._layoutService.onDidLayoutActiveContainer(()=>this._layout())),h}_updateToolbar(e,t){this._toolbar.setAriaLabel(t==="help"?d(5258,null):d(5262,null));let o=this._register(this._menuService.createMenu(D.AccessibleView,this._contextKeyService)),n=jm(o.getActions({}));if(e){for(let r of e)r.class=r.class||q.asClassName(R.primitiveSquare),r.checked=void 0;this._toolbar.setActions([...e,...n])}else this._toolbar.setActions(n)}_layout(){let e=this._layoutService.activeContainerDimension,t=e.height&&e.height*.6,o=Math.min(t,this._editorWidget.getContentHeight()),n=Math.min(e.width*.75,900);this._editorWidget.layout({width:n,height:o})}async _getTextModel(e){let t=this._modelService.getModel(e);return t&&!t.isDisposed()?t:this._modelService.createModel("",null,e,!1)}_goToSymbolsSupported(){return this._currentProvider?this._currentProvider.options.type==="help"||this._currentProvider.options.language==="markdown"||this._currentProvider.options.language===void 0||this._currentProvider instanceof xp&&!!this._currentProvider.getSymbols?.():!1}_updateLastProvider(){let e=this._currentProvider;return e?e instanceof xp?new xp(e.id,e.options,e.provideContent.bind(e),e.onClose.bind(e),e.verbositySettingKey,e.onOpen?.bind(e),e.actions,e.provideNextContent?.bind(e),e.providePreviousContent?.bind(e),e.onDidChangeContent?.bind(e),e.onKeyDown?.bind(e),e.getSymbols?.bind(e)):new hX(e.id,e.options,e.provideContent.bind(e),e.onClose.bind(e),e.onOpen?.bind(e),e.provideNextContent?.bind(e),e.providePreviousContent?.bind(e),e.actions,e.onDidChangeContent?.bind(e)):void 0}showAccessibleViewHelp(){let e=this._updateLastProvider();if(!e)return;let t;e instanceof xp?t=new xp(e.id,{type:"help"},()=>e.options.customHelp?e?.options.customHelp():this._accessibleViewHelpDialogContent(this._goToSymbolsSupported()),()=>{this._contextViewService.hideContextView(),queueMicrotask(()=>this.show(e))},e.verbositySettingKey):t=new hX(e.id,{type:"help"},()=>e.options.customHelp?e?.options.customHelp():this._accessibleViewHelpDialogContent(this._goToSymbolsSupported()),()=>{this._contextViewService.hideContextView(),queueMicrotask(()=>this.show(e))}),this._contextViewService.hideContextView(),t&&queueMicrotask(()=>this.show(t,void 0,!0))}_accessibleViewHelpDialogContent(e){let t=this._navigationHint(),o=this._goToSymbolHint(e),n=d(5282,null),r=this._getChatHints(),s=d(5275,null);return t&&(s+=" - "+t+`
`),o&&(s+=" - "+o+`
`),n&&(s+=" - "+n+`
`),r&&(s+=r),s}_getChatHints(){if(!(this._currentProvider?.id!=="panelChat"&&this._currentProvider?.id!=="quickChat"))return[d(5273,null,"<keybinding:workbench.action.chat.insertCodeBlock>"),d(5274,null,"<keybinding:workbench.action.chat.insertIntoNewFile>"),d(5278,null,"<keybinding:workbench.action.chat.runInTerminal>")].join(`
`)}_navigationHint(){return d(5259,null,"<keybinding:editor.action.accessibleViewNext>","<keybinding:editor.action.accessibleViewPrevious>")}_disableVerbosityHint(e){return e.options.type==="help"&&this._verbosityEnabled()?d(5263,null,"<keybinding:editor.action.accessibleViewDisableHint>"):""}_goToSymbolHint(e){if(e)return d(5272,null,"<keybinding:editor.action.accessibleViewGoToSymbol>")}_configureUnassignedKbHint(){let e=this._keybindingService.lookupKeybinding("editor.action.accessibilityHelpConfigureKeybindings")?.getAriaLabel(),t=e?"("+e+")":"by assigning a keybinding to the command Accessibility Help Configure Unassigned Keybindings.";return d(5268,null,t)}_configureAssignedKbHint(){let e=this._keybindingService.lookupKeybinding("editor.action.accessibilityHelpConfigureAssignedKeybindings")?.getAriaLabel(),t=e?"("+e+")":"by assigning a keybinding to the command Accessibility Help Configure Assigned Keybindings.";return d(5269,null,t)}_screenReaderModeHint(e){let t=this._accessibilityService.isScreenReaderOptimized(),o="",n=Ze?xc.changeConfigToOnMac:xc.changeConfigToOnWinLinux;return t&&e.id==="editor"?(o=xc.auto_on,o+=`
`):t||(o=xc.auto_off+`
`+n,o+=`
`),o}_exitDialogHint(e){return this._verbosityEnabled()&&!e.options.position?d(5271,null):""}_readMoreHint(e){return e.options.readMoreUrl?d(5277,null,"<keybinding:editor.action.accessibilityHelpOpenHelpLink>"):""}};Dut=I([m(0,Je),m(1,F),m(2,B),m(3,Tt),m(4,Wn),m(5,X),m(6,Oi),m(7,_e),m(8,Kl),m(9,Kt),m(10,ge),m(11,XX),m(12,ce),m(13,Ue),m(14,lr)],Dut);var s2e=class extends x{constructor(e,t,o){super();this._instantiationService=e;this._configurationService=t;this._keybindingService=o}show(e,t){this._accessibleView||(this._accessibleView=this._register(this._instantiationService.createInstance(Dut))),this._accessibleView.show(e,void 0,void 0,t)}configureKeybindings(e){this._accessibleView?.configureKeybindings(e)}openHelpLink(){this._accessibleView?.openHelpLink()}showLastProvider(e){this._accessibleView?.showLastProvider(e)}next(){this._accessibleView?.next()}previous(){this._accessibleView?.previous()}goToSymbol(){this._accessibleView?.goToSymbol()}getOpenAriaHint(e){if(!this._configurationService.getValue(e))return null;let t=this._keybindingService.lookupKeybinding("editor.action.accessibleView")?.getAriaLabel(),o=null;return t?o=d(5264,null,t):o=d(5265,null),o}disableHint(){this._accessibleView?.disableHint()}showAccessibleViewHelp(){this._accessibleView?.showAccessibleViewHelp()}getPosition(e){return this._accessibleView?.getPosition(e)??void 0}getLastPosition(){let e=this._accessibleView?.editorWidget.getModel()?.getLineCount();return e!==void 0&&e>0?new ye(e,1):void 0}setPosition(e,t,o){this._accessibleView?.setPosition(e,t,o)}getCodeBlockContext(){return this._accessibleView?.getCodeBlockContext()}navigateToCodeBlock(e){this._accessibleView?.navigateToCodeBlock(e)}};s2e=I([m(0,F),m(1,B),m(2,_e)],s2e);var Lut=class{constructor(i,e){this._accessibleView=i;this._quickInputService=e}show(i){let e=new N,t=e.add(this._quickInputService.createQuickPick());t.placeholder=d(5260,null),t.title=d(5261,null);let o=[],n=this._accessibleView.getSymbols();if(n){for(let r of n)o.push({label:r.label,ariaLabel:r.ariaLabel,firstListItem:r.firstListItem,lineNumber:r.lineNumber,endLineNumber:r.endLineNumber,markdownToParse:r.markdownToParse});t.canSelectMany=!1,t.items=o,t.show(),e.add(t.onDidAccept(()=>{this._accessibleView.showSymbol(i,t.selectedItems[0]),t.hide()})),e.add(t.onDidHide(()=>{t.selectedItems.length===0&&this._accessibleView.show(i),e.dispose()}))}}};Lut=I([m(1,Ue)],Lut);function uIn(a,i,e){if(!e.getValue("accessibility.accessibleView.closeOnKeyPress"))return!1;let t=new gi(a),n=i.softDispatch(t,t.target).kind===1;return i.inChordMode||n?!1:pIn(a)&&!a.ctrlKey&&!a.altKey&&!a.metaKey&&!a.shiftKey}function pIn(a){return!!a.code.match(/^(Key[A-Z]|Digit[0-9]|Equal|Comma|Period|Slash|Quote|Backquote|Backslash|Minus|Semicolon|Space|Enter)$/)}var Z6t=class extends x{constructor(){super(),this._register(npe.addImplementation(115,"accessible-view-help",i=>(i.get(ou).showAccessibleViewHelp(),!0),Dd))}},e9t=class extends x{constructor(){super(),ga.getImplementations().forEach(i=>{let e=t=>{let o=i.getProvider(t);if(!o)return!1;try{return t.get(ou).show(o),!0}catch{return o.dispose(),!1}};i.type==="view"?this._register(mZ.addImplementation(i.priority,i.name,e,i.when)):this._register(npe.addImplementation(i.priority,i.name,e,i.when))})}};var $be=class extends x{constructor(e){super();this._viewHelpDialogMap=this._register(new Vt);this._register(ne.as(Mn.ViewsRegistry).onViewsRegistered(t=>{for(let o of t)for(let n of o.views)n.accessibilityHelpContent&&this._viewHelpDialogMap.set(n.id,pPo(e,n))})),this._register(ne.as(Mn.ViewsRegistry).onViewsDeregistered(t=>{for(let o of t.views)o.accessibilityHelpContent&&this._viewHelpDialogMap.get(o.id)?.dispose()}))}static{this.ID="extensionAccessibilityHelpDialogContribution"}};$be=I([m(0,_e)],$be);function pPo(a,i){let e=new N,t=i.accessibilityHelpContent?.value;if(!t)throw new Error("No content provided for the accessibility help dialog");return e.add(ga.register({priority:95,name:i.id,type:"help",when:ql.isEqualTo(i.id),getProvider:o=>{let n=o.get($t);return new hX(i.id,{type:"help"},()=>t,()=>n.openView(i.id,!0))}})),e.add(a.onDidUpdateKeybindings(()=>{e.clear(),e.add(pPo(a,i))})),e}$ro();Ee(ou,s2e,1);Ee(FLe,OLe,1);var t9t=ne.as(Qi.Workbench);t9t.registerWorkbenchContribution(TQt,4);t9t.registerWorkbenchContribution(r2e,3);t9t.registerWorkbenchContribution(Z6t,4);t9t.registerWorkbenchContribution(e9t,4);It(zbe.ID,zbe,St.BlockRestore);It($be.ID,$be,St.BlockRestore);It(Kbe.ID,Kbe,St.AfterRestored);It(qbe.ID,qbe,St.AfterRestored);It(Gbe.ID,Gbe,St.AfterRestored);It(tpe.ID,tpe,St.AfterRestored);var Z6=class extends x{constructor(e,t){super();this.meteredConnectionService=e;this.statusbarService=t;this.statusBarEntry=this._register(new me);this.updateStatusBarEntry(this.meteredConnectionService.isConnectionMetered),this._register(this.meteredConnectionService.onDidChangeIsConnectionMetered(o=>{this.updateStatusBarEntry(o)}))}static{this.ID="workbench.contrib.meteredConnectionStatus"}updateStatusBarEntry(e){e?this.statusBarEntry.value||(this.statusBarEntry.value=this.statusbarService.addEntry(this.getStatusBarEntry(),Z6.ID,1,-Number.MAX_VALUE)):this.statusBarEntry.clear()}getStatusBarEntry(){return{name:d(12278,null),text:"$(radio-tower)",ariaLabel:d(12279,null),tooltip:d(12281,null),command:{id:"workbench.action.configureMeteredConnection",title:d(12280,null)},showInAllWindows:!0}}};Z6=I([m(0,k2),m(1,kr)],Z6);var mIn=ne.as(Jt.Configuration);mIn.registerConfiguration({id:"network",order:14,title:d(2269,null),type:"object",properties:{"network.meteredConnection":{type:"string",enum:["auto","on","off"],enumDescriptions:[d(2266,null),d(2268,null),d(2267,null)],default:"auto",scope:1,description:d(2265,null),tags:["usesOnlineServices"]}}});It(Z6.ID,Z6,St.AfterRestored);W(class mPo extends K{static{this.ID="workbench.action.configureMeteredConnection"}constructor(){super({id:mPo.ID,title:L(12270,"Configure Metered Connection"),f1:!0})}async run(i){let e=i.get(Ue),t=i.get(B),o=t.getValue(qDe),n=[{value:"auto",label:d(12271,null),description:d(12272,null),picked:o==="auto"},{value:"on",label:d(12275,null),description:d(12276,null),picked:o==="on"},{value:"off",label:d(12273,null),description:d(12274,null),picked:o==="off"}],r=await e.pick(n,{placeHolder:d(12277,null),activeItem:n.find(s=>s.picked)});r&&await t.updateValue(qDe,r.value)}});var i9t=new Y("shareProviderCount",0,d(14183,null)),a2e=class{constructor(i,e,t,o,n){this.contextKeyService=i;this.labelService=e;this.quickInputService=t;this.codeEditorService=o;this.telemetryService=n;this._providers=new Set;this.providerCount=i9t.bindTo(this.contextKeyService)}registerShareProvider(i){return this._providers.add(i),this.providerCount.set(this._providers.size),{dispose:()=>{this._providers.delete(i),this.providerCount.set(this._providers.size)}}}getShareActions(){return[]}async provideShare(i,e){let t=this.codeEditorService.getActiveCodeEditor()?.getModel()?.getLanguageId()??"",o=[...this._providers.values()].filter(s=>fB(s.selector,i.resourceUri,t,!0,void 0,void 0)>0).sort((s,l)=>s.priority-l.priority);if(o.length===0)return;if(o.length===1)return this.telemetryService.publicLog2("shareService.share",{providerId:o[0].id}),o[0].provideShare(i,e);let n=o.map(s=>({label:s.label,provider:s})),r=await this.quickInputService.pick(n,{canPickMany:!1,placeHolder:d(14186,null,this.labelService.getUriLabel(i.resourceUri))},e);if(r!==void 0)return this.telemetryService.publicLog2("shareService.share",{providerId:r.provider.id}),r.provider.provideShare(i,e)}};a2e=I([m(0,X),m(1,rt),m(2,Ue),m(3,qt),m(4,Te)],a2e);W(class extends MW{constructor(){super("workbench.experimental.share.enabled",d(14184,null),d(14185,null),3,C.and(PF.toNegated(),C.has("config.window.commandCenter"),C.and(i9t.notEqualsTo(0),sT.notEqualsTo(0))))}});var hIn=[D.EditorContextShare,D.SCMResourceContextShare,D.OpenEditorsContextShare,D.EditorTitleContextShare,D.MenubarShare,D.ExplorerContextShare],e9=class extends x{constructor(e,t){super();this.shareService=e;this.configurationService=t;this.configurationService.getValue(e9.SHARE_ENABLED_SETTING)&&this.registerActions(),this._register(this.configurationService.onDidChangeConfiguration(o=>{if(o.affectsConfiguration(e9.SHARE_ENABLED_SETTING)){let n=this.configurationService.getValue(e9.SHARE_ENABLED_SETTING);n===!0&&this._disposables===void 0?this.registerActions():n===!1&&this._disposables!==void 0&&(this._disposables?.clear(),this._disposables=void 0)}}))}static{this.SHARE_ENABLED_SETTING="workbench.experimental.share.enabled"}dispose(){super.dispose(),this._disposables?.dispose()}registerActions(){this._disposables||(this._disposables=new N),this._disposables.add(W(class w1i extends K{static{this.ID="workbench.action.share"}static{this.LABEL=L(14180,"Share...")}constructor(){super({id:w1i.ID,title:w1i.LABEL,f1:!0,icon:R.linkExternal,precondition:C.and(i9t.notEqualsTo(0),sT.notEqualsTo(0)),keybinding:{weight:200,primary:2609},menu:[{id:D.CommandCenter,order:3}]})}async run(o,...n){let r=o.get(EDe),s=o.get(ee)?.activeEditor,l=(s&&po.getOriginalUri(s,{supportSideBySide:1}))??o.get(Pe).getWorkspace().folders[0].uri,c=o.get(Fi),u=o.get(at),p=o.get(Je),h=o.get(Fo),g=o.get(qt).getActiveCodeEditor()?.getSelection()??void 0,f=await h.withProgress({location:10,detail:d(14178,null)},async()=>r.provideShare({resourceUri:l,selection:g},Se.None));if(f){let v=f.toString(),b=typeof f=="string";await c.writeText(v),u.prompt({type:ft.Info,message:b?d(14182,null):d(14181,null),custom:{icon:R.check,markdownDetails:[{markdown:new Ie(`<div aria-label='${v}'>${v}</div>`,{supportHtml:!0}),classes:[b?"share-dialog-input-text":"share-dialog-input-link"]}]},cancelButton:d(14176,null),buttons:b?[]:[{label:d(14179,null),run:()=>{p.open(f,{openExternal:!0})}}]})}}}));let e=this.shareService.getShareActions();for(let t of hIn)for(let o of e)this._disposables.add(ve.appendMenuItem(t,o))}};e9=I([m(0,EDe),m(1,B)],e9);Ee(EDe,a2e,1);var gIn=ne.as(Qi.Workbench);gIn.registerWorkbenchContribution(e9,4);ne.as(Jt.Configuration).registerConfiguration({...Ud,properties:{"workbench.experimental.share.enabled":{type:"boolean",default:!1,tags:["experimental"],markdownDescription:d(14177,null,"`#window.commandCenter#`","`true`"),restricted:!1}}});var jbe=class extends x{constructor(e,t){super();this.editorService=e;this.statusbarService=t;this.paneInitialScrollTop=new Map;this.syncScrollDispoasbles=this._register(new N);this.paneDisposables=this._register(new N);this.statusBarEntry=this._register(new me);this.isActive=!1;this._reentrancyBarrier=new EJ;this.registerActions()}static{this.ID="workbench.contrib.syncScrolling"}registerActiveListeners(){this.syncScrollDispoasbles.add(this.editorService.onDidVisibleEditorsChange(()=>this.trackVisiblePanes()))}activate(){this.registerActiveListeners(),this.trackVisiblePanes()}toggle(){this.isActive?this.deactivate():this.activate(),this.isActive=!this.isActive,this.toggleStatusbarItem(this.isActive)}trackVisiblePanes(){this.paneDisposables.clear(),this.paneInitialScrollTop.clear();for(let e of this.getAllVisiblePanes())SDt(e)&&(this.paneInitialScrollTop.set(e,e.getScrollPosition()),this.paneDisposables.add(e.onDidChangeScroll(()=>this._reentrancyBarrier.runExclusivelyOrSkip(()=>{this.onDidEditorPaneScroll(e)}))))}onDidEditorPaneScroll(e){let t=this.paneInitialScrollTop.get(e);if(t===void 0)throw new Error("Scrolled pane not tracked");if(!SDt(e))throw new Error("Scrolled pane does not support scrolling");let o=e.getScrollPosition(),n={scrollTop:o.scrollTop-t.scrollTop,scrollLeft:o.scrollLeft!==void 0&&t.scrollLeft!==void 0?o.scrollLeft-t.scrollLeft:void 0};for(let r of this.getAllVisiblePanes()){if(r===e||!SDt(r))continue;let s=this.paneInitialScrollTop.get(r);if(s===void 0)throw new Error("Could not find initial offset for pane");let l=r.getScrollPosition(),c={scrollTop:s.scrollTop+n.scrollTop,scrollLeft:s.scrollLeft!==void 0&&n.scrollLeft!==void 0?s.scrollLeft+n.scrollLeft:void 0};l.scrollTop===c.scrollTop&&l.scrollLeft===c.scrollLeft||r.setScrollPosition(c)}}getAllVisiblePanes(){let e=[];for(let t of this.editorService.visibleEditorPanes){if(t instanceof _f){let o=t.getPrimaryEditorPane(),n=t.getSecondaryEditorPane();o&&e.push(o),n&&e.push(n);continue}e.push(t)}return e}deactivate(){this.paneDisposables.clear(),this.syncScrollDispoasbles.clear(),this.paneInitialScrollTop.clear()}toggleStatusbarItem(e){if(e){if(!this.statusBarEntry.value){let t=d(13818,null),o=d(13817,null);this.statusBarEntry.value=this.statusbarService.addEntry({name:t,text:t,tooltip:o,ariaLabel:t,command:{id:"workbench.action.toggleLockedScrolling",title:""},kind:"prominent",showInAllWindows:!0},"status.scrollLockingEnabled",1,102)}}else this.statusBarEntry.clear()}registerActions(){let e=this;this._register(W(class extends K{constructor(){super({id:"workbench.action.toggleLockedScrolling",title:{...L(13820,"Toggle Locked Scrolling Across Editors"),mnemonicTitle:d(13816,null)},category:Ve.View,f1:!0,metadata:{description:d(13819,null)}})}run(){e.toggle()}})),this._register(W(class extends K{constructor(){super({id:"workbench.action.holdLockedScrolling",title:{...L(13814,"Hold Locked Scrolling Across Editors"),mnemonicTitle:d(13815,null)},category:Ve.View})}run(t){let o=t.get(_e);e.toggle();let n=o.enableKeybindingHoldMode("workbench.action.holdLockedScrolling");n&&n.finally(()=>{e.toggle()})}}))}dispose(){this.deactivate(),super.dispose()}};jbe=I([m(0,ee),m(1,kr)],jbe);It(jbe.ID,jbe,St.Eventually);var Qbe=class extends x{constructor(e,t,o){super();this._languageStatusService=e;this._editorService=t;this._chatEntitlementService=o;this._activeEditor=ui(this,t.onDidActiveEditorChange,()=>this._editorService.activeTextEditorControl),this._sentiment=this._chatEntitlementService.sentimentObs,this._state=ke(this,n=>{let r=this._activeEditor.read(n);if(!r||!pn(r))return;let l=Hc.get(r)?.model.read(n);if(l)return{model:l,status:gP(l.status,300)}}),this._register(il((n,r)=>{if(this._sentiment.read(n).hidden)return;let l=this._state.read(n);if(!l)return;let c=l.status.read(n),u={loading:{shortLabel:"",label:d(11324,null),loading:!0},ghostText:{shortLabel:"$(lightbulb)",label:"$(copilot) "+d(11322,null),loading:!1},inlineEdit:{shortLabel:"$(lightbulb-sparkle)",label:"$(copilot) "+d(11323,null),loading:!1},noSuggestion:{shortLabel:"$(circle-slash)",label:"$(copilot) "+d(11327,null),loading:!1}};r.add(this._languageStatusService.addStatus({accessibilityInfo:void 0,busy:u[c].loading,command:void 0,detail:d(11326,null),id:"inlineSuggestions",label:{value:u[c].label,shortValue:u[c].shortLabel},name:d(11325,null),selector:{pattern:l.model.textModel.uri.fsPath},severity:bt.Info,source:"inlineSuggestions"}))}))}static{this.hot=vz(this)}static{this.Id="vs.contrib.inlineCompletionLanguageStatusBarContribution"}static{this.languageStatusBarDisposables=new Set}};Qbe=I([m(0,HB),m(1,ee),m(2,rr)],Qbe);It(Qbe.Id,Zxt(Qbe.hot),St.Eventually);var l2e=class extends x{constructor(e){super();this._languageFeaturesService=e;let t=ne.as(ma.JSONContribution),o=ui(this,this._languageFeaturesService.inlineCompletionsProvider.onDidChange,()=>this._languageFeaturesService.inlineCompletionsProvider.allNoModel());this._register(be(n=>{let r=o.read(n);t.registerSchema(fui,{enum:R2i(r.flatMap(s=>vui(s)))},n.store)}))}static{this.Id="vs.contrib.InlineCompletionSchemaContribution"}};l2e=I([m(0,Qt)],l2e);It(l2e.Id,l2e,St.Eventually);var Ybe=class{constructor(i){this._preferencesService=i;ku.setConfigureDefaultAction(ii({id:"workbench.action.configurePreferredPasteAction",label:d(9983,null),run:()=>this.configurePreferredPasteAction()})),fh.setConfigureDefaultAction(ii({id:"workbench.action.configurePreferredDropAction",label:d(9982,null),run:()=>this.configurePreferredDropAction()}))}static{this.ID="workbench.contrib.dropOrPasteInto"}configurePreferredPasteAction(){return this._preferencesService.openUserSettings({jsonEditor:!0,revealSetting:{key:Y4e,edit:!0}})}configurePreferredDropAction(){return this._preferencesService.openUserSettings({jsonEditor:!0,revealSetting:{key:Z3e,edit:!0}})}};Ybe=I([m(0,Go)],Ybe);var C1i=[],fIn={type:"array",scope:6,description:d(9985,null),default:[],items:{description:d(9984,null),anyOf:[{type:"string"},{enum:C1i}]}},x1i=[],vIn={type:"array",scope:6,description:d(9987,null),default:[],items:{description:d(9986,null),anyOf:[{type:"string"},{enum:x1i}]}},k1i=Object.freeze({...RC,properties:{[Y4e]:vIn,[Z3e]:fIn}}),Xbe=class extends x{constructor(e,t){super();this.languageFeatures=t;this._onDidChangeSchemaContributions=this._register(new E);this._allProvidedDropKinds=[];this._allProvidedPasteKinds=[];this._register(U.runAndSubscribe(U.debounce(U.any(t.documentPasteEditProvider.onDidChange,t.documentPasteEditProvider.onDidChange),()=>{},1e3),()=>{this.updateProvidedKinds(),this.updateConfigurationSchema(),this._onDidChangeSchemaContributions.fire()})),this._register(e.registerSchemaContribution({getSchemaAdditions:()=>this.getKeybindingSchemaAdditions(),onDidChange:this._onDidChangeSchemaContributions.event}))}static{this.ID="workbench.contrib.dropOrPasteIntoSchema"}updateProvidedKinds(){let e=new Map;for(let o of this.languageFeatures.documentDropEditProvider.allNoModel())for(let n of o.providedDropEditKinds??[])e.set(n.value,n);this._allProvidedDropKinds=Array.from(e.values());let t=new Map;for(let o of this.languageFeatures.documentPasteEditProvider.allNoModel())for(let n of o.providedPasteEditKinds??[])t.set(n.value,n);this._allProvidedPasteKinds=Array.from(t.values())}updateConfigurationSchema(){x1i.length=0;for(let e of this._allProvidedPasteKinds)x1i.push(e.value);C1i.length=0;for(let e of this._allProvidedDropKinds)C1i.push(e.value);ne.as(Jt.Configuration).notifyConfigurationSchemaUpdated(k1i)}getKeybindingSchemaAdditions(){return[{if:{required:["command"],properties:{command:{const:Kli}}},then:{properties:{args:{oneOf:[{required:["kind"],properties:{kind:{anyOf:[{enum:Array.from(this._allProvidedPasteKinds.map(e=>e.value))},{type:"string"}]}}},{required:["preferences"],properties:{preferences:{type:"array",items:{anyOf:[{enum:Array.from(this._allProvidedPasteKinds.map(e=>e.value))},{type:"string"}]}}}}]}}}}]}};Xbe=I([m(0,_e),m(1,Qt)],Xbe);It(Ybe.ID,Ybe,St.Eventually);It(Xbe.ID,Xbe,St.Eventually);ne.as(Jt.Configuration).registerConfiguration(k1i);function E1i(a,i,e){return a.reduce((t,o)=>{let n=e(o);return t[n]=(t[n]||0)+i(o),t},{})}function hPo(a,i,e){let t=Me("mapped",a.get());return e.add(Vs(a,(o,n,r)=>{Gi(s=>{for(let l of r)t.set(o,s,i(l))})})),t}function gPo(a,i){return new fp(e=>{if(!i.isDisposed)return i.add(Vs(a,(t,o,n)=>{e.emitOne({value:t,prevValue:o,change:n})})),new Promise(t=>{i.add(Z(()=>{t(void 0)}))})})}var o9t=class extends x{constructor(e){super();this._originalDoc=e;let t=this.value=Me(this,e.value.get());this._register(Vs(this._originalDoc.value,(o,n,r)=>{let s=QI.compose(r.map(l=>{let c=new T1i(l.reason);return l.mapData(()=>c)}));t.set(o,void 0,{edit:s})}))}waitForQueue(){return Promise.resolve()}},T1i=class{constructor(i){this.editSource=i;this.key=this.editSource.toKey(1),this.source=t9.create(this.editSource)}join(i){if(this.editSource===i.editSource)return this}toEditSourceData(){return new _1i(this.key,this.source,this.editSource)}},_1i=class{constructor(i,e,t){this.key=i;this.source=e;this.representative=t}join(i){if(this.key===i.key&&this.source===i.source)return this}},t9=class{static{this._cache=new NI({getCacheKey:i=>i.toString()},i=>i)}static create(i){let e=i.metadata;switch(e.source){case"reloadFromDisk":return this._cache.get(new L1i);case"inlineCompletionPartialAccept":case"inlineCompletionAccept":{let t="type"in e?e.type:void 0;return"$nes"in e&&e.$nes?this._cache.get(new n9t("nes",e.$extensionId??"",e.$providerId??"",t)):this._cache.get(new n9t("completion",e.$extensionId??"",e.$providerId??"",t))}case"snippet":return this._cache.get(new s9t("suggest"));case"unknown":return e.name?e.name==="formatEditsCommand"?this._cache.get(new s9t("format")):this._cache.get(new Mut):this._cache.get(new Mut);case"Chat.applyEdits":return this._cache.get(new r9t("sidebar"));case"inlineChat.applyEdits":return this._cache.get(new r9t("inline"));case"cursor":return this._cache.get(new D1i);default:return this._cache.get(new Mut)}}},n9t=class extends t9{constructor(e,t,o,n){super();this.kind=e;this.extensionId=t;this.providerId=o;this.type=n;this.category="ai";this.feature="inlineSuggest"}toString(){return`${this.category}/${this.feature}/${this.kind}/${this.extensionId}/${this.type}`}getColor(){return"#00ff0033"}},r9t=class extends t9{constructor(e){super();this.kind=e;this.category="ai";this.feature="chat"}toString(){return`${this.category}/${this.feature}/${this.kind}`}getColor(){return"#00ff0066"}},s9t=class extends t9{constructor(e){super();this.feature=e;this.category="ide"}toString(){return`${this.category}/${this.feature}`}getColor(){return this.feature==="format"?"#0000ff33":"#80808033"}},D1i=class extends t9{constructor(){super();this.category="user"}toString(){return this.category}getColor(){return"#d3d3d333"}},L1i=class extends t9{constructor(){super();this.category="external"}toString(){return this.category}getColor(){return"#009ab254"}},Mut=class extends t9{constructor(){super();this.category="unknown"}toString(){return this.category}getColor(){return"#ff000033"}},c2e=class extends x{constructor(e,t){super();this._originalDoc=e;this._instantiationService=t;this._runStore=this._register(new N);this._runQueue=Promise.resolve();this._diffService=this._instantiationService.createInstance(Rut),this.value=this._value=Me(this,e.value.get()),this._restart()}async _restart(){this._runStore.clear();let e=gPo(this._originalDoc.value,this._runStore)[Symbol.asyncIterator](),t=this._runQueue;this._runQueue=this._runQueue.then(()=>this._run(e)),await t}async _run(e){let t=new Jht(e);for(;;){let o=await t.peek();if(o===U9)return;if(fPo(o)){let n=o,r=n,s=QI.empty;do{t.readBufferedOrThrow(),r=o,s=s.compose(QI.compose(o.change.map(c=>c.edit)));let l=await t.peekTimeout(1e3);if(!l)break;o=l}while(o!==U9&&fPo(o));if(!s.isEmpty()){let l=s.replacements[0].data,u=(await this._diffService.computeDiff(n.prevValue.value,r.value.value)).mapData(p=>l);this._value.set(r.value,void 0,{edit:u})}}else{t.readBufferedOrThrow();let n=QI.compose(o.change.map(r=>r.edit));this._value.set(o.value,void 0,{edit:n})}}}async waitForQueue(){await this._originalDoc.waitForQueue(),await this._restart()}};c2e=I([m(1,F)],c2e);var Rut=class{constructor(i){this._editorWorkerService=i}async computeDiff(i,e){return await this._editorWorkerService.computeStringEditFromDiff(i,e,{maxComputationTimeMs:500},"advanced")}};Rut=I([m(0,Qs)],Rut);function fPo(a){return a.change.every(i=>i.edit.replacements.every(e=>e.data.source.category==="ai"&&e.data.source.feature==="chat"))}var a9t=class extends x{constructor(e){super();this._originalDoc=e;let t=this.value=Me(this,e.value.get()),o=this._originalDoc.value.get().value;this._register(Vs(this._originalDoc.value,(n,r,s)=>{let c=QI.compose(s.map(u=>u.edit)).removeCommonSuffixAndPrefix(o);o=n.value,t.set(n,void 0,{edit:c})}))}async waitForQueue(){await this._originalDoc.waitForQueue()}};function Jbe(a,i){return{value:hPo(a.value,t=>({edit:t.edit.mapData(o=>o.data.toEditSourceData())}),i),waitForQueue:()=>a.waitForQueue()}}var d2e=class extends x{constructor(e,t){super();this._workspace=e;this._instantiationService=t;let o=this._instantiationService.createInstance(Put);this._states=ob(this,this._workspace.documents,(n,r)=>{let s=ke(c=>o.isVisible(n.uri,c));return Bf(this,(c,u)=>u||s.read(c)).map(c=>c?r.add(this._instantiationService.createInstance(Aut,n,s)):void 0)}),this.documents=this._states.map((n,r)=>n.map(s=>s.read(r)).filter(lo)),this.documents.recomputeInitiallyAndOnChange(this._store)}};d2e=I([m(1,F)],d2e);var Put=class{constructor(i){this._editorGroupsService=i;let e=Fr(this,this._editorGroupsService.onDidAddGroup),t=Fr(this,this._editorGroupsService.onDidRemoveGroup),o=ke(this,n=>(e.read(n),t.read(n),this._editorGroupsService.groups));this.visibleUris=ob(this,o,n=>ui(this,n.onDidModelChange,()=>n.editors).map(s=>s.map(l=>po.getCanonicalUri(l)))).map((n,r)=>{let s=new Map;for(let l of n)for(let c of l.read(r))lo(c)&&s.set(c.toString(),c);return s})}isVisible(i,e){return this.visibleUris.read(e).has(i.toString())}};Put=I([m(0,wt)],Put);var Aut=class extends x{constructor(e,t,o){super();this.document=e;this.isVisible=t;this._instantiationService=o;let n=this._store.add(new o9t(e));n=this._store.add(this._instantiationService.createInstance(c2e,n)),n=this._store.add(new a9t(n)),this.documentWithAnnotations=n}};Aut=I([m(2,F)],Aut);var l9t=class{constructor(i,e){this._valueBeforeTrackedEdit=i;this._trackedEdit=e.removeCommonSuffixPrefix(i.getValue()),this._updatedTrackedEdit=this._trackedEdit.mapData(()=>new c9t(!0))}getOriginalCharacterCount(){return Gy(this._trackedEdit.replacements,i=>i.getNewLength())}handleEdits(i){let e=i.mapData(o=>new c9t(!1)),t=this._updatedTrackedEdit.compose(e);this._updatedTrackedEdit=t}getAcceptedRestrainedCharactersCount(){return Gy(this._updatedTrackedEdit.replacements,e=>e.data.isTrackedEdit?e.getNewLength():0)}getDebugState(){return{edits:this._updatedTrackedEdit.replacements.map(i=>({range:i.replaceRange.toString(),newText:i.newText,isTrackedEdit:i.data.isTrackedEdit}))}}getLineCountInfo(){let i=this._updatedTrackedEdit.toStringEdit(n=>n.data.isTrackedEdit),e=Lj.fromStringEdit(i,this._valueBeforeTrackedEdit),t=Gy(e.replacements,n=>n.lineRange.length),o=Gy(e.getNewLineRanges(),n=>n.length);return{deletedLineCounts:t,insertedLineCounts:o}}getValues(){return{arc:this.getAcceptedRestrainedCharactersCount(),...this.getLineCountInfo()}}},c9t=class{constructor(i){this.isTrackedEdit=i}join(i){if(this.isTrackedEdit===i.isTrackedEdit)return this}};var Zbe=class extends x{constructor(e,t,o,n,r,s,l,c){super();this._timesMs=e;this._documentValueBeforeTrackedEdit=t;this._document=o;this._gitRepo=n;this._trackedEdit=r;this._sendTelemetryEvent=s;this._dispose=l;this._telemetryService=c;this._arcTracker=new l9t(this._documentValueBeforeTrackedEdit,this._trackedEdit),this._store.add(Vs(this._document.value,(u,p,h)=>{let g=Eye.composeOrUndefined(h.map(f=>f.edit));g&&this._arcTracker.handleEdits(g)})),this._initialLineCounts=this._arcTracker.getLineCountInfo(),this._initialBranchName=this._gitRepo.get()?.headBranchNameObs.get();for(let u=0;u<this._timesMs.length;u++){let p=this._timesMs[u];p<=0?this._report(p):this._reportAfter(p,u===this._timesMs.length-1?()=>{this._dispose()}:void 0)}}_reportAfter(e,t){let o=new Ul(()=>{this._report(e),o.dispose(),t&&t()},e);this._store.add(o)}_report(e){let o=this._gitRepo.get()?.headBranchNameObs.get()!==this._initialBranchName,n=this._arcTracker.getLineCountInfo();this._sendTelemetryEvent({telemetryService:this._telemetryService,timeDelayMs:e,didBranchChange:o,arc:this._arcTracker.getAcceptedRestrainedCharactersCount(),originalCharCount:this._arcTracker.getOriginalCharacterCount(),currentLineCount:n.insertedLineCounts,currentDeletedLineCount:n.deletedLineCounts,originalLineCount:this._initialLineCounts.insertedLineCounts,originalDeletedLineCount:this._initialLineCounts.deletedLineCounts})}};Zbe=I([m(7,Te)],Zbe);var qre=le("randomService"),d9t=class{generateUuid(){return xt()}generatePrefixedUuid(i){return`${i}-${this.generateUuid()}`}};var u2e=class extends x{constructor(e,t,o){super();this._instantiationService=o;this._register(Vs(e.value,(n,r,s)=>{let l=QI.compose(s.map(h=>h.edit));if(!l.replacements.some(h=>h.data.editSource.metadata.source==="inlineCompletionAccept"))return;if(!l.replacements.every(h=>h.data.editSource.metadata.source==="inlineCompletionAccept")){mt(new Error("ArcTelemetrySender: Not all edits are inline completion accept edits!"));return}if(l.replacements[0].data.editSource.metadata.source!=="inlineCompletionAccept")return;let c=l.replacements[0].data.editSource.metadata,u=Jbe(e,this._store),p=this._store.add(this._instantiationService.createInstance(Zbe,[0,30,120,300,600,900].map(h=>h*1e3),r,u,t,l,h=>{h.telemetryService.publicLog2("editTelemetry.reportInlineEditArc",{extensionId:c.$extensionId??"",extensionVersion:c.$extensionVersion??"",opportunityId:c.$$requestUuid??"unknown",languageId:c.$$languageId,correlationId:c.$$correlationId,didBranchChange:h.didBranchChange?1:0,timeDelayMs:h.timeDelayMs,originalCharCount:h.originalCharCount,originalLineCount:h.originalLineCount,originalDeletedLineCount:h.originalDeletedLineCount,arc:h.arc,currentLineCount:h.currentLineCount,currentDeletedLineCount:h.currentDeletedLineCount,...rK(aB(c.$extensionId))})},()=>{this._store.delete(p)}))}))}};u2e=I([m(2,F)],u2e);var p2e=class extends x{constructor(e,t){super();this._aiEditTelemetryService=t;this._register(Vs(e.value,(o,n,r)=>{let s=QI.compose(r.map(g=>g.edit)),l=new Set(["Chat.applyEdits","inlineChat.applyEdits"]);if(!s.replacements.some(g=>l.has(g.data.editSource.metadata.source)))return;if(!s.replacements.every(g=>l.has(g.data.editSource.metadata.source))){mt(new Error(`ArcTelemetrySender: Not all edits are ${s.replacements[0].data.editSource.metadata.source}!`));return}let c,u=s.replacements[0].data.editSource,p;u.metadata.source==="Chat.applyEdits"?(p="sideBarChat",u.metadata.$$mode==="applyCodeBlock"&&(c=u.metadata.$$codeBlockSuggestionId)):p="inlineChat";let h=new P1(u.props.$extensionId,u.props.$extensionVersion,u.props.$providerId);this._aiEditTelemetryService.createSuggestionId({applyCodeBlockSuggestionId:c,languageId:u.props.$$languageId,presentation:"highlightedEdit",feature:p,source:h,modelId:u.props.$modelId,modeId:u.props.$$mode,editDeltaInfo:lw.fromEdit(s,n)})}))}};p2e=I([m(1,xS)],p2e);var m2e=class extends x{constructor(e,t,o,n){super();this._instantiationService=o;this._randomService=n;this._register(Vs(e.value,(r,s,l)=>{let c=QI.compose(l.map(v=>v.edit)),u=new Set(["Chat.applyEdits","inlineChat.applyEdits"]);if(!c.replacements.some(v=>u.has(v.data.editSource.metadata.source)))return;if(!c.replacements.every(v=>u.has(v.data.editSource.metadata.source))){mt(new Error(`ArcTelemetrySender: Not all edits are ${c.replacements[0].data.editSource.metadata.source}!`));return}let p=c.replacements[0].data.editSource,h=this._randomService.generateUuid(),g=Jbe(e,this._store),f=this._store.add(this._instantiationService.createInstance(Zbe,[0,60,300].map(v=>v*1e3),s,g,t,c,v=>{v.telemetryService.publicLog2("editTelemetry.reportEditArc",{sourceKeyCleaned:p.toKey(Number.MAX_SAFE_INTEGER,{$extensionId:!1,$extensionVersion:!1,$$requestUuid:!1,$$sessionId:!1,$$requestId:!1,$$languageId:!1,$modelId:!1}),extensionId:p.props.$extensionId,extensionVersion:p.props.$extensionVersion,opportunityId:p.props.$$requestUuid,editSessionId:p.props.$$sessionId,requestId:p.props.$$requestId,modelId:p.props.$modelId,languageId:p.props.$$languageId,mode:p.props.$$mode,uniqueEditId:h,didBranchChange:v.didBranchChange?1:0,timeDelayMs:v.timeDelayMs,originalCharCount:v.originalCharCount,originalLineCount:v.originalLineCount,originalDeletedLineCount:v.originalDeletedLineCount,arc:v.arc,currentLineCount:v.currentLineCount,currentDeletedLineCount:v.currentDeletedLineCount,...rK(aB(p.props.$extensionId))})},()=>{this._store.delete(f)}))}))}};m2e=I([m(2,F),m(3,qre)],m2e);var $re=class extends x{constructor(e,t){super();this._doc=e;this.data=t;this._edits=QI.empty;this._pendingExternalEdits=QI.empty;this._update=wc(this);this._representativePerKey=new Map;this._sumAddedCharactersPerKey=new Map;this._register(Vs(this._doc.value,(o,n,r)=>{let s=QI.compose(r.map(l=>l.edit));s.replacements.every(l=>l.data.source.category==="external")?this._edits.isEmpty()||(this._pendingExternalEdits=this._pendingExternalEdits.compose(s)):(this._pendingExternalEdits.isEmpty()||(this._applyEdit(this._pendingExternalEdits),this._pendingExternalEdits=QI.empty),this._applyEdit(s)),this._update.trigger(void 0)}))}_applyEdit(e){for(let t of e.replacements){let o=this._sumAddedCharactersPerKey.get(t.data.key);o===void 0&&(o=0,this._representativePerKey.set(t.data.key,t.data.representative));let n=o+t.getNewLength();this._sumAddedCharactersPerKey.set(t.data.key,n)}this._edits=this._edits.compose(e)}async waitForQueue(){await this._doc.waitForQueue()}getTotalInsertedCharactersCount(e){return this._sumAddedCharactersPerKey.get(e)??0}getAllKeys(){return Array.from(this._sumAddedCharactersPerKey.keys())}getRepresentative(e){return this._representativePerKey.get(e)}getTrackedRanges(e){return this._update.read(e),this._edits.getNewRanges().map((o,n)=>{let r=this._edits.replacements[n];return new R1i(r.replaceRange,o,r.data.key,r.data.source,r.data.representative)})}isEmpty(){return this._edits.isEmpty()}_getDebugVisualization(){let e=this.getTrackedRanges();return{$fileExtension:"text.w",value:this._doc.value.get().value,decorations:e.map(o=>({range:[o.range.start,o.range.endExclusive],color:o.source.getColor()}))}}},R1i=class{constructor(i,e,t,o,n){this.originalRange=i;this.range=e;this.sourceKey=t;this.source=o;this.sourceRepresentative=n}};var h2e=class{constructor(i){this._scmService=i;this._repos=new Wht(i=>new M1i(i));this._reposChangedSignal=Fr(this,U.any(this._scmService.onDidAddRepository,this._scmService.onDidRemoveRepository))}getRepo(i,e){this._reposChangedSignal.read(e);let t=this._scmService.getRepository(i);if(t)return this._repos.get(t)}};h2e=I([m(0,rd)],h2e);var M1i=class{constructor(i){this._repo=i;this.headBranchNameObs=ke(i=>this._repo.provider.historyProvider.read(i)?.historyItemRef.read(i)?.name);this.headCommitHashObs=ke(i=>this._repo.provider.historyProvider.read(i)?.historyItemRef.read(i)?.revision)}async isIgnored(i){return!1}};var g2e=class extends x{constructor(e,t,o){super();this._statsEnabled=e;this._annotatedDocuments=t;this._instantiationService=o;let n=this._instantiationService.createInstance(h2e);this._states=ob(this,this._annotatedDocuments.documents,(r,s)=>[r.document,s.add(this._instantiationService.createInstance(Nut,r,n,this._statsEnabled))]),this.docsState=this._states.map(r=>new Map(r)),this.docsState.recomputeInitiallyAndOnChange(this._store)}};g2e=I([m(2,F)],g2e);var Nut=class extends x{constructor(e,t,o,n,r,s,l){super();this._doc=e;this._scm=t;this._statsEnabled=o;this._instantiationService=n;this._telemetryService=r;this._randomService=s;this._userAttentionService=l;this._repo=ke(this,f=>this._scm.getRepo(e.document.uri,f));let c=Jbe(e.documentWithAnnotations,this._store),u=wc("resetSignal"),p="closed";this.longtermTracker=ke(f=>{if(!this._statsEnabled.read(f))return;u.read(f);let v=f.store.add(new $re(c,void 0)),b=this._userAttentionService.totalFocusTimeMs,S=Date.now();return f.store.add(Z(()=>{v.isEmpty()||this.sendTelemetry("longterm",p,v,this._userAttentionService.totalFocusTimeMs-b,Date.now()-S),v.dispose()})),v}).recomputeInitiallyAndOnChange(this._store),this._store.add(new FI).cancelAndSet(()=>{p="10hours",u.trigger(void 0),p="closed"},600*60*1e3),this._store.add(be(f=>{let v=this._repo.read(f);v&&(f.store.add(Vs(v.headCommitHashObs,()=>{p="hashChange",u.trigger(void 0),p="closed"})),f.store.add(Vs(v.headBranchNameObs,()=>{p="branchChange",u.trigger(void 0),p="closed"})))})),this._store.add(this._instantiationService.createInstance(u2e,e.documentWithAnnotations,this._repo)),this._store.add(this._instantiationService.createInstance(m2e,e.documentWithAnnotations,this._repo)),this._store.add(this._instantiationService.createInstance(p2e,e.documentWithAnnotations));let h=wc("resetSignal");this.windowedTracker=ke(f=>{if(!this._statsEnabled.read(f)||!this._doc.isVisible.read(f))return;h.read(f),f.store.add(this._userAttentionService.fireAfterGivenFocusTimePassed(600*1e3,()=>{h.trigger(void 0)}));let v=f.store.add(new $re(c,void 0)),b=this._userAttentionService.totalFocusTimeMs,S=Date.now();return f.store.add(Z(async()=>{this.sendTelemetry("10minFocusWindow","time",v,this._userAttentionService.totalFocusTimeMs-b,Date.now()-S),v.dispose()})),v}).recomputeInitiallyAndOnChange(this._store);let g=wc("focusResetSignal");this.windowedFocusTracker=ke(f=>{if(!this._statsEnabled.read(f)||!this._doc.isVisible.read(f))return;g.read(f),f.store.add(this._userAttentionService.fireAfterGivenFocusTimePassed(1200*1e3,()=>{g.trigger(void 0)}));let v=f.store.add(new $re(c,void 0)),b=this._userAttentionService.totalFocusTimeMs,S=Date.now();return f.store.add(Z(async()=>{this.sendTelemetry("20minFocusWindow","time",v,this._userAttentionService.totalFocusTimeMs-b,Date.now()-S),v.dispose()})),v}).recomputeInitiallyAndOnChange(this._store)}async sendTelemetry(e,t,o,n,r){let s=o.getTrackedRanges(),l=o.getAllKeys();if(l.length===0)return;let c=this.getTelemetryData(s),u=this._randomService.generateUuid(),p=E1i(s,f=>f.range.length,f=>f.sourceKey),h=Object.entries(p).filter(([f,v])=>v!==void 0);h.sort(Fse(cl(([f,v])=>v,hu))),h.length=e==="longterm"?30:10;for(let f of l)p[f]||(p[f]=0);for(let[f,v]of Object.entries(p)){if(v===void 0)continue;let b=o.getRepresentative(f),S=o.getTotalInsertedCharactersCount(f);this._telemetryService.publicLog2("editTelemetry.editSources.details",{mode:e,sourceKey:f,sourceKeyCleaned:b.toKey(1,{$extensionId:!1,$extensionVersion:!1,$modelId:!1}),extensionId:b.props.$extensionId,extensionVersion:b.props.$extensionVersion,modelId:b.props.$modelId,trigger:t,languageId:this._doc.document.languageId.get(),statsUuid:u,conversationId:b.props.$$sessionId,requestId:b.props.$$requestId,modifiedCount:v,deltaModifiedCount:S,totalModifiedCount:c.totalModifiedCharactersInFinalState})}let g=await c.isTrackedByGit;this._telemetryService.publicLog2("editTelemetry.editSources.stats",{mode:e,languageId:this._doc.document.languageId.get(),statsUuid:u,nesModifiedCount:c.nesModifiedCount,inlineCompletionsCopilotModifiedCount:c.inlineCompletionsCopilotModifiedCount,inlineCompletionsNESModifiedCount:c.inlineCompletionsNESModifiedCount,otherAIModifiedCount:c.otherAIModifiedCount,unknownModifiedCount:c.unknownModifiedCount,userModifiedCount:c.userModifiedCount,ideModifiedCount:c.ideModifiedCount,totalModifiedCharacters:c.totalModifiedCharactersInFinalState,externalModifiedCount:c.externalModifiedCount,isTrackedByGit:g?1:0,focusTime:n,actualTime:r,trigger:t})}getTelemetryData(e){let t=r=>r.category==="ai"&&r.kind==="nes"?"nes":r.category==="ai"&&r.kind==="completion"&&r.extensionId==="github.copilot"||r.category==="ai"&&r.kind==="completion"&&r.extensionId==="github.copilot-chat"&&r.providerId==="completions"?"inlineCompletionsCopilot":r.category==="ai"&&r.kind==="completion"&&r.extensionId==="github.copilot-chat"&&r.providerId==="nes"?"inlineCompletionsNES":r.category==="ai"&&r.kind==="completion"?"inlineCompletionsOther":r.category==="ai"?"otherAI":r.category==="user"?"user":r.category==="ide"?"ide":r.category==="external"?"external":(r.category==="unknown","unknown"),o=E1i(e,r=>r.range.length,r=>t(r.source)),n=Gy(e,r=>r.range.length);return{nesModifiedCount:o.nes??0,inlineCompletionsCopilotModifiedCount:o.inlineCompletionsCopilot??0,inlineCompletionsNESModifiedCount:o.inlineCompletionsNES??0,otherAIModifiedCount:o.otherAI??0,userModifiedCount:o.user??0,ideModifiedCount:o.ide??0,unknownModifiedCount:o.unknown??0,externalModifiedCount:o.external??0,totalModifiedCharactersInFinalState:n,languageId:this._doc.document.languageId.get(),isTrackedByGit:this._repo.get()?.isIgnored(this._doc.document.uri)}}};Nut=I([m(3,F),m(4,Te),m(5,qre),m(6,jBt)],Nut);var u9t="telemetry.editStats.details.enabled",p9t="telemetry.editStats.showDecorations",m9t="telemetry.editStats.showStatusBar";var f2e=class extends x{constructor(e,t,o,n,r,s,l){super();this._workspace=e;this._annotatedDocuments=t;this._configurationService=o;this._instantiationService=n;this._statusbarService=r;this._editorService=s;this._extensionService=l;this._showStateInMarkdownDoc="editTelemetry.showDebugDetails";this._toggleDecorations="editTelemetry.toggleDebugDecorations";this._editSourceTrackingShowDecorations=bIn(hr(p9t,!1,this._configurationService)),this._editSourceTrackingShowStatusBar=hr(m9t,!1,this._configurationService);let c=hr(u9t,!1,this._configurationService),u=ui(this._extensionService.onDidChangeExtensions,()=>this._extensionService.extensions),p=ke(y=>new Set(u.read(y).map(w=>w.id?.toLowerCase())));function h(y,w){let k=y.toLowerCase();return ke(T=>p.read(T).has(k))}let g=h("GitHub.copilot",this._extensionService),f=h("GitHub.copilot-chat",this._extensionService),v=ke(y=>c.read(y)||!!g.read(y)||!!f.read(y)),b=this._instantiationService.createChild(new _o([Te,this._instantiationService.createInstance(uF)])),S=this._register(b.createInstance(g2e,v,this._annotatedDocuments));this._register(be(y=>{if(!this._editSourceTrackingShowDecorations.read(y))return;let w=ui(this,this._editorService.onDidVisibleEditorsChange,()=>this._editorService.visibleTextEditorControls);ob(this,w,(k,T)=>{if(k instanceof Xr){let P=gs(k),O=new M7(k),V=new NI(H=>T.add(O.createClassNameRef({backgroundColor:H.getColor()})).className);T.add(P.setDecorations(ke(H=>{let G=P.model.read(H)?.uri;if(!G)return[];let $=this._workspace.getDocument(G);if(!$)return[];let J=S.docsState.read(H).get($);return J?(J.longtermTracker.read(H)?.getTrackedRanges(H)??[]).map(he=>({range:$.value.read(void 0).getTransformer().getRange(he.range),options:{description:"editSourceTracking",inlineClassName:V.get(he.source)}})):[]})))}}).recomputeInitiallyAndOnChange(y.store)})),this._register(be(y=>{if(!this._editSourceTrackingShowStatusBar.read(y))return;let w=y.store.add(this._statusbarService.addEntry({name:"",text:"",command:this._showStateInMarkdownDoc,tooltip:"Edit Source Tracking",ariaLabel:""},"editTelemetry",1,100)),k=ke(P=>{let O=S.docsState.read(P),V=0;for(let H of O.values()){let G=H.longtermTracker.read(P);if(!G)continue;let $=H.getTelemetryData(G.getTrackedRanges(P));V+=$.totalModifiedCharactersInFinalState}return V}),T=ke(P=>{let O=S.docsState.read(P),V=[],H=[];for(let[ae,he]of O){let oe=he.longtermTracker.read(P);if(!oe)continue;let de=oe.getTrackedRanges(P),Ce=he.getTelemetryData(de);if(Ce.totalModifiedCharactersInFinalState===0)continue;H.push(...de.map(ze=>ze.source));let xe=Object.fromEntries(Object.entries(Ce).filter(([ze,De])=>typeof De!="number"||De!==0));V.push([`### ${ae.uri.fsPath}`,"```json",JSON.stringify(xe,void 0,"	"),"```",`
`].join(`
`))}let G;V.length===0?G="No modified documents":V.length<=3?G=V.join(`

`):G=`...

`+V.slice(-3).join(`

`);let $=this._createEditSourceAgenda(H),J=new Ie(G+`

[View Details](command:`+this._showStateInMarkdownDoc+")");return J.appendMarkdown(`

`+$+`

Toggle decorations: [Click here](command:`+this._toggleDecorations+")"),J.isTrusted={enabledCommands:[this._toggleDecorations]},J.supportHtml=!0,J});y.store.add(be(P=>{w.update({name:"editTelemetry",text:`$(edit) ${k.read(P)} chars inserted`,ariaLabel:`Edit Source Tracking: ${k.read(P)} modified characters`,tooltip:T.read(P),command:this._showStateInMarkdownDoc})})),y.store.add($e.registerCommand(this._toggleDecorations,()=>{this._editSourceTrackingShowDecorations.set(!this._editSourceTrackingShowDecorations.read(void 0),void 0)}))}))}_createEditSourceAgenda(e){let t=new Set,o=[];for(let r of e)t.has(r.toString())||(t.add(r.toString()),o.push({name:r.toString(),color:r.getColor()}));return o.map(r=>`<span style="background-color:${r.color};border-radius:3px;">${r.name}</span>`).join(" ")}};f2e=I([m(2,B),m(3,F),m(4,kr),m(5,ee),m(6,lt)],f2e);function bIn(a){let i=Me("overrideObs",void 0);return K$(i,e=>i.read(e)??a.read(e),(e,t)=>{i.set(e,t)})}var h9t=class{constructor(){this._version=0;this.onDidOpenDocumentChange=kIe({owner:this,changeTracker:{createChangeSummary:()=>({didChange:!1}),handleChange:(i,e)=>(i.didChange(this.documents)||(e.didChange=!0),!0)}},(i,e)=>{let t=this.documents.read(i);for(let o of t)o.value.read(i);return e.didChange&&this._version++,this._version});this.lastActiveDocument=ke(i=>{let e=Me("lastActiveDocument",void 0);return i.store.add(be(t=>{let o=this.documents.read(t);for(let n of o)t.store.add(Vs(n.value,()=>{e.set(n,void 0)}))})),e}).flatten()}getFirstOpenDocument(){return this.documents.get()[0]}getDocument(i){return this.documents.get().find(e=>e.uri.toString()===i.toString())}},g9t=class a extends ld{constructor(e,t){super(e);this.reason=t}static replace(e,t,o=Wc.unknown({})){return new a([new ed(e,t)],o)}};var v2e=class extends h9t{constructor(e){super();this._textModelService=e;this._store=new N;let t=Fr(this,this._textModelService.onModelAdded),o=Fr(this,this._textModelService.onModelRemoved),n=ke(this,s=>(t.read(s),o.read(s),this._textModelService.getModels())),r=ob(this,n,(s,l)=>{if(!s.isTooLargeForSyncing())return l.add(new P1i(s))}).recomputeInitiallyAndOnChange(this._store).map(s=>s.filter(lo));this._documents=r}get documents(){return this._documents}dispose(){this._store.dispose()}};v2e=I([m(0,Tt)],v2e);var P1i=class extends x{constructor(e){super();this.textModel=e;this._value=Me(this,new jS(this.textModel.getValue())),this._version=Me(this,this.textModel.getVersionId()),this._languageId=Me(this,this.textModel.getLanguageId()),this._register(this.textModel.onDidChangeContent(t=>{Gi(o=>{let n=eY(t.changes);t.detailedReasons.length!==1&&mt(new Error(`Unexpected number of detailed reasons: ${t.detailedReasons.length}`));let r=new g9t(n.replacements,t.detailedReasons[0]);this._value.set(new jS(this.textModel.getValue()),o,r),this._version.set(this.textModel.getVersionId(),o)})})),this._register(this.textModel.onDidChangeLanguage(t=>{Gi(o=>{this._languageId.set(this.textModel.getLanguageId(),o)})}))}get uri(){return this.textModel.uri}get value(){return this._value}get version(){return this._version}get languageId(){return this._languageId}};var f9t="telemetry.editStats.enabled",b2e="editor.aiStats.enabled";function SIn(a){let i=new Map;for(let e of a){let t=new Date(e.startTime),o=t.toISOString().split("T")[0],n=t.toLocaleDateString(void 0,{month:"short",day:"numeric"}),r=i.get(o);r||(r={date:o,displayDate:n,aiRate:0,totalAiChars:0,totalTypedChars:0,inlineSuggestions:0,chatEdits:0,sessionCount:0},i.set(o,r)),r.totalAiChars+=e.aiCharacters,r.totalTypedChars+=e.typedCharacters,r.inlineSuggestions+=e.acceptedInlineSuggestions??0,r.chatEdits+=e.chatEditCount??0,r.sessionCount+=1}for(let e of i.values()){let t=e.totalAiChars+e.totalTypedChars;e.aiRate=t>0?e.totalAiChars/t:0}return Array.from(i.values()).sort((e,t)=>e.date.localeCompare(t.date))}function vPo(a){let{sessions:i,viewMode:e}=a,t=280,o=100,n={top:10,right:10,bottom:25,left:30},r=t-n.left-n.right,s=o-n.top-n.bottom,l=_(".ai-stats-chart-container");l.style.position="relative",l.style.marginTop="8px";let c=document.createElementNS("http://www.w3.org/2000/svg","svg");c.setAttribute("width",`${t}px`),c.setAttribute("height",`${o}px`),c.setAttribute("viewBox",`0 0 ${t} ${o}`),c.style.display="block",l.appendChild(c);let u=document.createElementNS("http://www.w3.org/2000/svg","g");if(u.setAttribute("transform",`translate(${n.left},${n.top})`),c.appendChild(u),i.length===0){let v=document.createElementNS("http://www.w3.org/2000/svg","text");return v.setAttribute("x",`${r/2}`),v.setAttribute("y",`${s/2}`),v.setAttribute("text-anchor","middle"),v.setAttribute("fill",kt(Oye)),v.setAttribute("font-size","11px"),v.textContent=d(10067,null),u.appendChild(v),l}let p=document.createElementNS("http://www.w3.org/2000/svg","line");p.setAttribute("x1","0"),p.setAttribute("y1",`${s}`),p.setAttribute("x2",`${r}`),p.setAttribute("y2",`${s}`),p.setAttribute("stroke",kt(Wvt)),p.setAttribute("stroke-width","1px"),u.appendChild(p);let h=document.createElementNS("http://www.w3.org/2000/svg","line");h.setAttribute("x1","0"),h.setAttribute("y1","0"),h.setAttribute("x2","0"),h.setAttribute("y2",`${s}`),h.setAttribute("stroke",kt(Wvt)),h.setAttribute("stroke-width","1px"),u.appendChild(h);for(let v of[0,50,100]){let b=s-v/100*s,S=document.createElementNS("http://www.w3.org/2000/svg","text");if(S.setAttribute("x","-4"),S.setAttribute("y",`${b+3}`),S.setAttribute("text-anchor","end"),S.setAttribute("fill",kt(Oye)),S.setAttribute("font-size","9px"),S.textContent=`${v}%`,u.appendChild(S),v>0){let y=document.createElementNS("http://www.w3.org/2000/svg","line");y.setAttribute("x1","0"),y.setAttribute("y1",`${b}`),y.setAttribute("x2",`${r}`),y.setAttribute("y2",`${b}`),y.setAttribute("stroke",kt(Wvt)),y.setAttribute("stroke-width","0.5px"),y.setAttribute("stroke-dasharray","2,2"),u.appendChild(y)}}e==="days"?g():f();function g(){let v=SIn(i),b=v.length,S=Math.min(20,(r-(b-1)*2)/b),y=2,w=b*S+(b-1)*y,k=(r-w)/2,T=40,O=Math.max(2,Math.floor(w/T)),V=Math.max(1,Math.ceil(b/O));v.forEach((H,G)=>{let $=k+G*(S+y),J=H.aiRate*s,ae=s-J,he=document.createElementNS("http://www.w3.org/2000/svg","rect");he.setAttribute("x",`${$}`),he.setAttribute("y",`${ae}`),he.setAttribute("width",`${S}`),he.setAttribute("height",`${Math.max(1,J)}`),he.setAttribute("fill",kt(zje)),he.setAttribute("rx","2"),u.appendChild(he);let oe=G===0,de=G===b-1,Ce=G%V===0;if(oe||de||Ce&&b>2){if(!oe&&!de){let ze=G*(S+y),De=(b-1-G)*(S+y);if(ze<T||De<T)return}let xe=document.createElementNS("http://www.w3.org/2000/svg","text");xe.setAttribute("x",`${$+S/2}`),xe.setAttribute("y",`${s+12}`),xe.setAttribute("text-anchor","middle"),xe.setAttribute("fill",kt(Oye)),xe.setAttribute("font-size","8px"),xe.textContent=H.displayDate,u.appendChild(xe)}})}function f(){let v=i.length,b=Math.min(8,(r-(v-1)*1)/v),S=1,y=v*b+(v-1)*S,w=(r-y)/2;i.forEach((H,G)=>{let $=H.aiCharacters+H.typedCharacters,J=$>0?H.aiCharacters/$:0,ae=w+G*(b+S),he=J*s,oe=s-he,de=document.createElementNS("http://www.w3.org/2000/svg","rect");de.setAttribute("x",`${ae}`),de.setAttribute("y",`${oe}`),de.setAttribute("width",`${b}`),de.setAttribute("height",`${Math.max(1,he)}`),de.setAttribute("fill",kt(zje)),de.setAttribute("rx","1"),u.appendChild(de)});let k=40;if(v===0)return;let T=i[0],P=w,O=new Date(T.startTime),V=document.createElementNS("http://www.w3.org/2000/svg","text");if(V.setAttribute("x",`${P+b/2}`),V.setAttribute("y",`${s+12}`),V.setAttribute("text-anchor","start"),V.setAttribute("fill",kt(Oye)),V.setAttribute("font-size","8px"),V.textContent=O.toLocaleDateString(void 0,{month:"short",day:"numeric"}),u.appendChild(V),v>1&&y>=k){let H=i[v-1],G=w+(v-1)*(b+S),$=new Date(H.startTime),J=document.createElementNS("http://www.w3.org/2000/svg","text");J.setAttribute("x",`${G+b/2}`),J.setAttribute("y",`${s+12}`),J.setAttribute("text-anchor","end"),J.setAttribute("fill",kt(Oye)),J.setAttribute("font-size","8px"),J.textContent=$.toLocaleDateString(void 0,{month:"short",day:"numeric"}),u.appendChild(J)}}return l}var S2e=class extends x{constructor(e,t,o,n){super();this._aiStatsFeature=e;this._statusbarService=t;this._commandService=o;this._telemetryService=n;this._register(be(r=>{let s=this._createStatusBar().keepUpdated(r.store),l=this._register(new N);r.store.add(this._statusbarService.addEntry({name:d(10072,null),ariaLabel:d(10073,null),text:"",tooltip:{element:async c=>(this._sendHoverTelemetry(),l.clear(),IIn({data:this._aiStatsFeature,onOpenSettings:()=>wIn({ids:[b2e]}).run(this._commandService)}).keepUpdated(l).element),markdownNotSupportedFallback:void 0},content:s.element},"aiStatsStatusBar",1,100))}))}static{this.hot=vz(this)}_sendHoverTelemetry(){this._telemetryService.publicLog2("aiStatsStatusBar.hover",{aiRate:this._aiStatsFeature.aiRate.get()})}_createStatusBar(){return Bo.div({style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center",marginLeft:"3px",marginRight:"3px"}},[Bo.div({class:"ai-stats-status-bar",style:{display:"flex",flexDirection:"column",width:50,height:6,borderRadius:6,borderWidth:"1px",borderStyle:"solid"}},[Bo.div({style:{flex:1,display:"flex",overflow:"hidden",borderRadius:6,border:"1px solid transparent"}},[Bo.div({style:{width:this._aiStatsFeature.aiRate.map(e=>`${e*100}%`),backgroundColor:"currentColor"}})])])])}};S2e=I([m(1,kr),m(2,ge),m(3,Te)],S2e);function IIn(a){let i=Me("chartViewMode","days"),e=a.data.aiRate.map(o=>`${Math.round(o*100)}%`),t=(o,n,r)=>ke(s=>{let c=i.read(s)===o;return Bo.div({class:["chart-toggle-button",c?"active":""],style:{padding:"2px 4px",borderRadius:"3px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center"},onclick:()=>{i.set(o,void 0)},title:n},[Bo.div({class:q.asClassName(r),style:{fontSize:"14px"}})])});return Bo.div({class:"ai-stats-status-bar"},[Bo.div({class:"header",style:{minWidth:"280px"}},[Bo.div({style:{flex:1}},[d(10069,null)]),Bo.div({style:{marginLeft:"auto"}},a.onOpenSettings?yIn([{action:{id:"aiStats.statusBar.settings",label:"",enabled:!0,run:a.onOpenSettings,class:q.asClassName(R.gear),tooltip:d(10068,null)},options:{icon:!0,label:!1,hoverDelegate:nI}}]):[])]),Bo.div({style:{display:"flex"}},[Bo.div({style:{flex:1,paddingRight:"4px"}},[d(10074,null,e.get())])]),Bo.div({style:{flex:1,paddingRight:"4px"}},[d(10075,null,a.data.acceptedInlineSuggestionsToday.get())]),Bo.div({style:{marginTop:"8px",borderTop:"1px solid var(--vscode-widget-border)",paddingTop:"8px"}},[Bo.div({class:"header",style:{display:"flex",alignItems:"center",marginBottom:"4px"}},[Bo.div({style:{flex:1}},[i.map(o=>o==="days"?d(10070,null):d(10071,null))]),Bo.div({class:"chart-view-toggle",style:{marginLeft:"auto",display:"flex",gap:"2px"}},[t("days",d(10076,null),R.calendar),t("sessions",d(10077,null),R.listFlat)])]),ke(o=>{let n=a.data.sessions.read(o),r=i.read(o);return Bo.div({ref:s=>{let l=vPo({sessions:n,viewMode:r});s.appendChild(l)}})})])])}function yIn(a,i){return ke(e=>Bo.div({class:[],style:{},ref:t=>{let o=e.store.add(new Zi(t,i));for(let{action:n,options:r}of a)o.push(n,r)}}))}var A1i=class{constructor(i,e=[]){this.commandId=i;this.args=e}run(i){i.executeCommand(this.commandId,...this.args)}};function wIn(a={}){return new A1i("workbench.action.openSettings",[{query:a.ids?a.ids.map(i=>`@id:${i}`).join(" "):void 0}])}var I2e=class extends x{constructor(e,t,o){super();this._storageService=t;this._instantiationService=o;this._dataVersion=Me(this,0);this.aiRate=this._dataVersion.map(()=>{let e=this._data.getValue();return e?CIn(e.sessions,o=>{let n=o.typedCharacters+o.aiCharacters;return n===0?0:o.aiCharacters/n}):0});this.sessionCount=ke(this,e=>{this._dataVersion.read(e);let t=this._data.getValue();return t?t.sessions.length:0});this.sessions=ke(this,e=>{this._dataVersion.read(e);let t=this._data.getValue();return t?t.sessions:[]});this.acceptedInlineSuggestionsToday=ke(this,e=>{this._dataVersion.read(e);let t=this._data.getValue();if(!t)return 0;let o=new Date;o.setHours(0,0,0,0);let n=t.sessions.filter(r=>r.startTime>o.getTime());return Gy(n,r=>r.acceptedInlineSuggestions??0)});let n=kIn(this._storageService,"aiStats",1,0);this._data=xIn(n,1/60,this._store),this.aiRate.recomputeInitiallyAndOnChange(this._store),this._register(be(l=>{l.store.add(this._instantiationService.createInstance(S2e.hot.read(l),this))}));let r=[];ob(this,e.documents,(l,c)=>{c.add(Vs(l.documentWithAnnotations.value,(u,p,h)=>{let g=QI.compose(h.map(v=>v.edit)),f=new co(()=>this._getDataAndSession());for(let v of g.replacements)v8i(v.data.editSource)?f.value.currentSession.aiCharacters+=v.newText.length:b8i(v.data.editSource)&&(f.value.currentSession.typedCharacters+=v.newText.length);if(g.replacements.length>0){let v=f.value.currentSession,b=g.replacements[0].data.editSource;b.metadata.source==="inlineCompletionAccept"&&(v.acceptedInlineSuggestions===void 0&&(v.acceptedInlineSuggestions=0),v.acceptedInlineSuggestions+=1),b.metadata.source==="Chat.applyEdits"&&b.metadata.$$requestId!==void 0&&(r.includes(b.metadata.$$requestId)||(r.push(b.metadata.$$requestId),r.length>10&&r.shift(),v.chatEditCount===void 0&&(v.chatEditCount=0),v.chatEditCount+=1))}f.hasValue&&(this._data.writeValue(f.value.data),this._dataVersion.set(this._dataVersion.get()+1,void 0))}))}).recomputeInitiallyAndOnChange(this._store)}_getDataAndSession(){let e=this._data.getValue()??{sessions:[]},t=300*1e3,o=e.sessions.at(-1),n=Date.now();if(!o||n-o.startTime>t){e.sessions.push({startTime:n,typedCharacters:0,aiCharacters:0,acceptedInlineSuggestions:0,chatEditCount:0}),o=e.sessions.at(-1);let r=1440*60*1e3;for(;e.sessions.length>r/t;)e.sessions.shift()}return{data:e,currentSession:o}}};I2e=I([m(1,ce),m(2,F)],I2e);function CIn(a,i){return a.length===0?0:Gy(a,i)/a.length}function xIn(a,i,e){let t=new vIe,o,n=0,r=0;return e.add(Z(()=>{n!==r&&(a.writeValue(o),r=n)})),{writeValue(s){n++;let l=n;o=s,t.clearPending(),t.schedule(async()=>{a.writeValue(s),r=l,await Li(5e3)})},getValue(){return n>0?o:a.getValue()}}}function kIn(a,i,e,t){let o,n=!1;return{writeValue(r){r===void 0?a.remove(i,e):a.store(i,JSON.stringify(r),e,t),o=r},getValue(){if(n)return o;let r=a.get(i,e);return o=r===void 0?void 0:JSON.parse(r),n=!0,o}}}var v9t=class extends x{constructor(e){super();this._trackers=new gt;this._documentsByUri=new gt;this._register(be(t=>{let o=e.documents.read(t),n=new gt;for(let r of o){let s=r.document.uri;n.set(s,!0),this._documentsByUri.set(s,r),this._trackers.has(s)||this._trackers.set(s,this._createTrackerEntry(r))}for(let[r,s]of this._trackers)n.has(r)||(s.trackerStore.dispose(),this._trackers.delete(r),this._documentsByUri.delete(r))})),this._register($e.registerCommand("_aiEdits.hasAiContributions",(t,o,n)=>this._hasAiContributions(o,n))),this._register($e.registerCommand("_aiEdits.clearAiContributions",(t,o)=>{this._clearAiContributions(o)})),this._register($e.registerCommand("_aiEdits.clearAllAiContributions",()=>{this._clearAiContributions()}))}dispose(){for(let[,e]of this._trackers)e.trackerStore.dispose();super.dispose()}_createTrackerEntry(e){let t=new N,o=Jbe(e.documentWithAnnotations,t),n=t.add(new $re(o,void 0));return{trackerStore:t,tracker:n}}_hasAiContributions(e,t){for(let o of e){let n=this._trackers.get(A.revive(o));if(n){for(let r of n.tracker.getTrackedRanges())if(r.source.category==="ai"&&(t==="all"||r.source.feature==="chat"))return!0}}return!1}_clearAiContributions(e){let t=e?e.map(o=>A.revive(o)):[...this._trackers.keys()];for(let o of t){let n=this._trackers.get(o);if(n){n.trackerStore.dispose();let r=this._documentsByUri.get(o);r?this._trackers.set(o,this._createTrackerEntry(r)):(this._trackers.delete(o),this._documentsByUri.delete(o))}}}};var y2e=class extends x{constructor(i,e,t,o){super();let n=ke(u=>u.store.add(i.createInstance(v2e))),r=ke(u=>u.store.add(i.createInstance(d2e,n.read(u)))),s=hr(f9t,!0,e);this._register(be(u=>{!s.read(u)||!I$i(t,3)||u.store.add(i.createInstance(f2e,n.read(u),r.read(u)))}));let l=hr(b2e,!0,e);this._register(be(u=>{let p=l.read(u),h=o.sentimentObs.read(u).hidden;!p||h||u.store.add(i.createInstance(I2e,r.read(u)))})),this._register($e.registerCommand("_aiEdits.hasAiContributions",()=>!1)),this._register($e.registerCommand("_aiEdits.clearAiContributions",()=>{})),this._register($e.registerCommand("_aiEdits.clearAllAiContributions",()=>{}));let c=hr("git.addAICoAuthor","off",e);this._register(be(u=>{c.read(u)!=="off"&&u.store.add(i.createInstance(v9t,r.read(u)))}))}};y2e=I([m(0,F),m(1,B),m(2,Te),m(3,rr)],y2e);var w2e=class{constructor(i,e){this.instantiationService=i;this._randomService=e;this._telemetryService=this.instantiationService.createInstance(uF)}createSuggestionId(i){let e=roi.newId(t=>this._randomService.generatePrefixedUuid(t));return this._telemetryService.publicLog2("editTelemetry.codeSuggested",{eventId:this._randomService.generatePrefixedUuid("evt"),suggestionId:e,presentation:i.presentation,feature:i.feature,sourceExtensionId:i.source?.extensionId,sourceExtensionVersion:i.source?.extensionVersion,sourceProviderId:i.source?.providerId,languageId:i.languageId,editCharsInserted:i.editDeltaInfo?.charsAdded,editCharsDeleted:i.editDeltaInfo?.charsRemoved,editLinesInserted:i.editDeltaInfo?.linesAdded,editLinesDeleted:i.editDeltaInfo?.linesRemoved,modeId:i.modeId,modelId:i.modelId?.replace(/[\/\\]/g,"_"),applyCodeBlockSuggestionId:i.applyCodeBlockSuggestionId,...rK(aB(i.source?.extensionId))}),e}handleCodeAccepted(i){this._telemetryService.publicLog2("editTelemetry.codeAccepted",{eventId:this._randomService.generatePrefixedUuid("evt"),suggestionId:i.suggestionId,presentation:i.presentation,feature:i.feature,sourceExtensionId:i.source?.extensionId,sourceExtensionVersion:i.source?.extensionVersion,sourceProviderId:i.source?.providerId,languageId:i.languageId,editCharsInserted:i.editDeltaInfo?.charsAdded,editCharsDeleted:i.editDeltaInfo?.charsRemoved,editLinesInserted:i.editDeltaInfo?.linesAdded,editLinesDeleted:i.editDeltaInfo?.linesRemoved,modeId:i.modeId,modelId:i.modelId?.replace(/[\/\\]/g,"_"),applyCodeBlockSuggestionId:i.applyCodeBlockSuggestionId,acceptanceMethod:i.acceptanceMethod,...rK(aB(i.source?.extensionId))})}};w2e=I([m(0,F),m(1,qre)],w2e);It("EditTelemetryContribution",y2e,St.AfterRestored);var EIn=ne.as(Jt.Configuration);EIn.registerConfiguration({id:"task",order:100,title:d(10079,null),type:"object",properties:{[f9t]:{markdownDescription:d(10081,null),type:"boolean",default:!0,tags:["experimental"]},[b2e]:{markdownDescription:d(10078,null),type:"boolean",default:!1,tags:["experimental"],experiment:{mode:"auto"}},[u9t]:{markdownDescription:d(10080,null),type:"boolean",default:!1,tags:["experimental"],experiment:{mode:"auto"}},[m9t]:{markdownDescription:d(10083,null),type:"boolean",default:!1,tags:["experimental"]},[p9t]:{markdownDescription:d(10082,null),type:"boolean",default:!1,tags:["experimental"]}}});Ee(xS,w2e,1);Ee(qre,d9t,1);var C2e=class extends x{constructor(e,t,o,n){super();this.commandService=t;this.fileService=o;this.workspaceContextService=n;this._register(e.registerOpener(this))}static{this.ID="workbench.contrib.opener"}async open(e,t){try{let o=typeof e=="string"?A.parse(e):e;if(this.workspaceContextService.isInsideWorkspace(o)&&(await this.fileService.stat(o)).isDirectory)return await this.commandService.executeCommand(lW,o),!0}catch{}return!1}};C2e=I([m(0,Je),m(1,ge),m(2,fe),m(3,Pe)],C2e);It(C2e.ID,C2e,St.Eventually);Ee(Dy,TMe,1);Ee(dm,_Me,1);Ee(rG,EMe,1);Ee(fK,Y2,1);Ee(l2,Hw,1);Ee(Wn,YBt,1);Ee(Io,sxt,1);Ee(H1,IMe,1);Ee(oa,XBt,1);Ee(X,yMe,1);Ee(Fn,CMe,1);Ee(i0,xMe,1);Ee(Je,kMe,1);Ee(Zy,IMt,1);Ee(sG,DMe,1);Ee(vM,LMe,1);is((a,i)=>{let e=CF(a);i.addRule(`.monaco-workbench { background-color: ${e}; }`);let t=a.getColor(Rvt);if(t&&i.addRule(`.monaco-workbench ::selection { background-color: ${t}; }`),Wt){let o=a.getColor(NX);if(o){let n="monaco-workbench-meta-theme-color",r=ut.document.getElementById(n);r||(r=Cgt(),r.name="theme-color",r.id=n),r.content=o.toString()}}Jb&&i.addRule(`
			body.web {
				touch-action: none;
			}
			.monaco-workbench .monaco-editor .view-lines {
				user-select: text;
				-webkit-user-select: text;
			}
		`),dc&&oIe()&&i.addRule(`body { background-color: ${e}; }`)});var b9t="notifications.showList",eSe="notifications.hideList",bPo="notifications.toggleList",N1i="notifications.hideToasts",SPo="notifications.focusToasts",TIn="notifications.focusNextToast",_In="notifications.focusPreviousToast",DIn="notifications.focusFirstToast",LIn="notifications.focusLastToast",S9t="notification.collapse",I9t="notification.expand",IPo="notification.acceptPrimaryAction",RIn="notification.toggle",y9t="notification.clear",Out="notifications.clearAll",Fut="notifications.toggleDoNotDisturbMode",Wut="notifications.toggleDoNotDisturbModeBySource";function jre(a,i){if(xOt(i))return i;let e=a.lastFocusedList;if(e instanceof Vl){let t=e.getFocusedElements()[0];if(xOt(t)||e.isDOMFocused()&&(t=e.element(0)),xOt(t))return t}}function yPo(a,i,e){Ct.registerCommandAndKeybindingRule({id:b9t,weight:200,primary:Vi(2089,3116),handler:()=>{i.hide(),a.show()}}),Ct.registerCommandAndKeybindingRule({id:eSe,weight:250,when:L6e,primary:9,handler:()=>a.hide()}),$e.registerCommand(bPo,()=>{a.isVisible?a.hide():(i.hide(),a.show())}),Ct.registerCommandAndKeybindingRule({id:y9t,weight:200,when:oD,primary:20,mac:{primary:2049},handler:(o,n)=>{let r=o.get(lr),s=jre(o.get(Io),n);s&&!s.hasProgress&&(s.close(),r.playSignal($o.clear))}}),Ct.registerCommandAndKeybindingRule({id:I9t,weight:200,when:oD,primary:17,handler:(o,n)=>{jre(o.get(Io),n)?.expand()}}),Ct.registerCommandAndKeybindingRule({id:IPo,weight:201,when:C.or(oD,EB),primary:3103,handler:o=>{let n=o.get(F).createInstance(i9),r=jre(o.get(Io))||e.notifications.at(0);if(!r)return;let s=r.actions?.primary?r.actions.primary.at(0):void 0;s&&(n.run(s,r),r.close(),n.dispose())}}),Ct.registerCommandAndKeybindingRule({id:S9t,weight:200,when:oD,primary:15,handler:(o,n)=>{jre(o.get(Io),n)?.collapse()}}),Ct.registerCommandAndKeybindingRule({id:RIn,weight:200,when:oD,primary:10,secondary:[3],handler:o=>{jre(o.get(Io))?.toggle()}}),$e.registerCommand(N1i,o=>{i.hide()}),Ct.registerKeybindingRule({id:N1i,weight:150,when:EB,primary:9}),Ct.registerKeybindingRule({id:N1i,weight:300,when:C.and(EB,oD),primary:9}),$e.registerCommand(SPo,()=>i.focus()),Ct.registerCommandAndKeybindingRule({id:TIn,weight:200,when:C.and(oD,EB),primary:18,handler:()=>{i.focusNext()}}),Ct.registerCommandAndKeybindingRule({id:_In,weight:200,when:C.and(oD,EB),primary:16,handler:()=>{i.focusPrevious()}}),Ct.registerCommandAndKeybindingRule({id:DIn,weight:200,when:C.and(oD,EB),primary:11,secondary:[14],handler:()=>{i.focusFirst()}}),Ct.registerCommandAndKeybindingRule({id:LIn,weight:200,when:C.and(oD,EB),primary:12,secondary:[13],handler:()=>{i.focusLast()}}),$e.registerCommand(Out,()=>a.clearAll()),$e.registerCommand(Fut,o=>{let n=o.get(Ne);n.setFilter(n.getFilter()===1?0:1)}),$e.registerCommand(Wut,o=>{let n=o.get(Ne),r=o.get(Ue),s=n.getFilters().sort((u,p)=>u.label.localeCompare(p.label)),l=new N,c=l.add(r.createQuickPick());c.items=s.map(u=>({id:u.id,label:u.label,tooltip:`${u.label} (${u.id})`,filter:u.filter})),c.canSelectMany=!0,c.placeholder=d(4394,null),c.selectedItems=c.items.filter(u=>u.filter===0),c.show(),l.add(c.onDidAccept(async()=>{for(let u of c.items)n.setFilter({id:u.id,label:u.label,filter:c.selectedItems.includes(u)?0:1});c.hide()})),l.add(c.onDidHide(()=>l.dispose()))});let t=L(4390,"Notifications");ve.appendMenuItem(D.CommandPalette,{command:{id:b9t,title:L(4395,"Show Notifications"),category:t}}),ve.appendMenuItem(D.CommandPalette,{command:{id:eSe,title:L(4389,"Hide Notifications"),category:t},when:L6e}),ve.appendMenuItem(D.CommandPalette,{command:{id:Out,title:L(4387,"Clear All Notifications"),category:t}}),ve.appendMenuItem(D.CommandPalette,{command:{id:IPo,title:L(4386,"Accept Notification Primary Action"),category:t}}),ve.appendMenuItem(D.CommandPalette,{command:{id:Fut,title:L(4396,"Toggle Do Not Disturb Mode"),category:t}}),ve.appendMenuItem(D.CommandPalette,{command:{id:Wut,title:L(4397,"Toggle Do Not Disturb Mode By Source..."),category:t}}),ve.appendMenuItem(D.CommandPalette,{command:{id:SPo,title:L(4388,"Focus Notification Toast"),category:t},when:EB}),ve.appendMenuItem(D.TitleBar,{command:{id:bPo,title:d(4398,null),icon:R.bell},group:"navigation",order:1e4,when:C.and(C.equals("config.workbench.notifications.position","top-right"),C.equals("config.workbench.notifications.showInTitleBar",!0))})}W(class extends K{constructor(){super({id:"workbench.action.setNotificationsPosition.bottomRight",title:L(4392,"Bottom Right"),toggled:C.equals("config.workbench.notifications.position","bottom-right"),menu:{id:D.NotificationsCenterPositionMenu,order:1}})}run(i){i.get(B).updateValue("workbench.notifications.position","bottom-right")}});W(class extends K{constructor(){super({id:"workbench.action.setNotificationsPosition.bottomLeft",title:L(4391,"Bottom Left"),toggled:C.equals("config.workbench.notifications.position","bottom-left"),menu:{id:D.NotificationsCenterPositionMenu,order:2}})}run(i){i.get(B).updateValue("workbench.notifications.position","bottom-left")}});W(class extends K{constructor(){super({id:"workbench.action.setNotificationsPosition.topRight",title:L(4393,"Top Right"),toggled:C.equals("config.workbench.notifications.position","top-right"),menu:{id:D.NotificationsCenterPositionMenu,order:3}})}run(i){i.get(B).updateValue("workbench.notifications.position","top-right")}});var i9=class extends rs{constructor(e,t){super();this.telemetryService=e;this.notificationService=t}async runAction(e,t){this.telemetryService.publicLog2("workbenchActionExecuted",{id:e.id,from:"message"});try{await super.runAction(e,t)}catch(o){this.notificationService.error(o)}}};i9=I([m(0,Te),m(1,Ne)],i9);var MIn=Ae("notifications-clear",R.close,d(4355,null)),PIn=Ae("notifications-clear-all",R.clearAll,d(4354,null)),O1i=Ae("notifications-hide",R.chevronDown,d(4370,null)),wPo=Ae("notifications-hide-up",R.chevronUp,d(4372,null)),CPo=Ae("notifications-expand",R.chevronUp,d(4368,null)),AIn=Ae("notifications-expand-down",R.chevronDown,d(4367,null)),xPo=Ae("notifications-collapse",R.chevronDown,d(4358,null)),NIn=Ae("notifications-collapse-up",R.chevronUp,d(4360,null)),OIn=Ae("notifications-configure",R.gear,d(4362,null)),kPo=Ae("notifications-do-not-disturb",R.bellSlash,d(4366,null)),FIn=Ae("notifications-position",R.arrowSwap,d(4373,null));function EPo(a){return a==="top-right"?AIn:CPo}function TPo(a){return a==="top-right"?NIn:xPo}var Qre=class extends it{constructor(e,t,o){super(e,t,q.asClassName(MIn));this.commandService=o}static{this.ID=y9t}static{this.LABEL=d(4356,null)}async run(e){this.commandService.executeCommand(y9t,e)}};Qre=I([m(2,ge)],Qre);var Yre=class extends it{constructor(e,t,o){super(e,t,q.asClassName(PIn));this.commandService=o}static{this.ID=Out}static{this.LABEL=d(4357,null)}async run(){this.commandService.executeCommand(Out)}};Yre=I([m(2,ge)],Yre);var tSe=class extends it{constructor(e,t,o){super(e,t,q.asClassName(kPo));this.commandService=o}static{this.ID=Fut}static{this.LABEL=d(4374,null)}async run(){this.commandService.executeCommand(Fut)}};tSe=I([m(2,ge)],tSe);var iSe=class extends it{constructor(e,t,o){super(e,t);this.commandService=o}static{this.ID=Wut}static{this.LABEL=d(4375,null)}async run(){this.commandService.executeCommand(Wut)}};iSe=I([m(2,ge)],iSe);var oSe=class extends it{static{this.ID="workbench.action.configureDoNotDisturbMode"}static{this.LABEL=d(4361,null)}constructor(i,e){super(i,e,q.asClassName(kPo))}},nSe=class extends it{static{this.ID="workbench.action.configureNotificationsPosition"}static{this.LABEL=d(4364,null)}constructor(i,e){super(i,e,q.asClassName(FIn))}},Xre=class extends it{constructor(e,t,o){super(e,t,q.asClassName(O1i));this.commandService=o}static{this.ID=eSe}static{this.LABEL=d(4371,null)}async run(){this.commandService.executeCommand(eSe)}};Xre=I([m(2,ge)],Xre);var Jre=class extends it{constructor(e,t,o){super(e,t,q.asClassName(CPo));this.commandService=o}static{this.ID=I9t}static{this.LABEL=d(4369,null)}async run(e){this.commandService.executeCommand(I9t,e)}};Jre=I([m(2,ge)],Jre);var Zre=class extends it{constructor(e,t,o){super(e,t,q.asClassName(xPo));this.commandService=o}static{this.ID=S9t}static{this.LABEL=d(4359,null)}async run(e){this.commandService.executeCommand(S9t,e)}};Zre=I([m(2,ge)],Zre);var rSe=class extends it{constructor(e,t,o){super(e,t,q.asClassName(OIn));this.notification=o}static{this.ID="workbench.action.configureNotification"}static{this.LABEL=d(4363,null)}},ese=class extends it{constructor(e,t,o){super(e,t);this.clipboardService=o}static{this.ID="workbench.action.copyNotificationMessage"}static{this.LABEL=d(4365,null)}run(e){return this.clipboardService.writeText(e.message.raw)}};ese=I([m(2,Fi)],ese);var w9t=class a{static{this.ROW_HEIGHT=42}static{this.LINE_HEIGHT=22}constructor(i){this.offsetHelper=this.createOffsetHelper(i)}createOffsetHelper(i){return i.appendChild(_(".notification-offset-helper"))}getHeight(i){if(!i.expanded)return a.ROW_HEIGHT;let e=a.ROW_HEIGHT,t=this.computePreferredHeight(i);if(a.LINE_HEIGHT<t){let n=t-a.LINE_HEIGHT;e+=n}return(i.source||yr(i.actions?.primary))&&(e+=a.ROW_HEIGHT),e===a.ROW_HEIGHT&&i.collapse(!0),e}computePreferredHeight(i){let e=0;i.hasProgress||e++,i.canCollapse&&e++,yr(i.actions?.secondary)&&e++,this.offsetHelper.style.width=`${450-(40+e*30-Math.max(e-1,0)*4)}px`;let t=C9t.render(i.message);this.offsetHelper.appendChild(t);let o=Math.max(this.offsetHelper.offsetHeight,this.offsetHelper.scrollHeight);return Rt(this.offsetHelper),o}getTemplateId(i){if(i instanceof JDe)return o9.TEMPLATE_ID;throw new Error("unknown element type: "+i)}},C9t=class{static render(i,e){let t=_("span");for(let o of i.linkedText.nodes)if(typeof o=="string")t.appendChild(document.createTextNode(o));else{let n=o.title;!n&&o.href.startsWith("command:")?n=d(4420,null,o.href.substr(8)):n||(n=o.href);let r=_("a",{href:o.href,title:n,tabIndex:0},o.label);if(e){let s=h=>{Egt(h)&&Xt.stop(h,!0),e.callback(o.href)},l=e.toDispose.add(new Gn(r,re.CLICK)).event,c=e.toDispose.add(new Gn(r,re.KEY_DOWN)).event,u=U.chain(c,h=>h.filter(g=>{let f=new gi(g);return f.equals(10)||f.equals(3)}));e.toDispose.add(Ms.addTarget(r));let p=e.toDispose.add(new Gn(r,Kn.Tap)).event;U.any(l,p,u)(s,null,e.toDispose)}t.appendChild(r)}return t}},o9=class{constructor(i,e,t,o){this.actionRunner=i;this.contextMenuService=e;this.instantiationService=t;this.notificationService=o}static{this.TEMPLATE_ID="notification"}get templateId(){return o9.TEMPLATE_ID}renderTemplate(i){let e=Object.create(null);e.toDispose=new N,e.container=_(".notification-list-item"),e.mainRow=_(".notification-list-item-main-row"),e.icon=_(".notification-list-item-icon.codicon"),e.message=_(".notification-list-item-message");let t=this,o=_(".notification-list-item-toolbar-container");return e.toolbar=new Zi(o,{ariaLabel:d(4421,null),actionViewItemProvider:(n,r)=>{if(n instanceof rSe)return e.toDispose.add(new Pm(n,{getActions(){let s=[],l={id:n.notification.sourceId,label:n.notification.source};if(H7(l)){let c=t.notificationService.getFilter(l)===1;s.push(ii({id:l.id,label:c?d(4424,null,l.label):d(4423,null,l.label),run:()=>t.notificationService.setFilter({...l,filter:c?0:1})})),n.notification.actions?.secondary?.length&&s.push(new ri)}return Array.isArray(n.notification.actions?.secondary)&&s.push(...n.notification.actions.secondary),s}},this.contextMenuService,{...r,actionRunner:this.actionRunner,classNames:n.class}))},actionRunner:this.actionRunner}),e.toDispose.add(e.toolbar),e.detailsRow=_(".notification-list-item-details-row"),e.source=_(".notification-list-item-source"),e.buttonsContainer=_(".notification-list-item-buttons-container"),i.appendChild(e.container),e.container.appendChild(e.detailsRow),e.detailsRow.appendChild(e.source),e.detailsRow.appendChild(e.buttonsContainer),e.container.appendChild(e.mainRow),e.mainRow.appendChild(e.icon),e.mainRow.appendChild(e.message),e.mainRow.appendChild(o),e.progress=new Zf(i,vw),e.toDispose.add(e.progress),e.renderer=this.instantiationService.createInstance(sC,e,this.actionRunner),e.toDispose.add(e.renderer),e}renderElement(i,e,t){t.renderer.setInput(i)}disposeTemplate(i){Be(i.toDispose)}};o9=I([m(1,Xe),m(2,F),m(3,Ne)],o9);var sC=class extends x{constructor(e,t,o,n,r,s,l,c){super();this.template=e;this.actionRunner=t;this.openerService=o;this.instantiationService=n;this.keybindingService=r;this.contextMenuService=s;this.hoverService=l;this.inputDisposables=this._register(new N);sC.closeNotificationAction||(sC.closeNotificationAction=n.createInstance(Qre,Qre.ID,Qre.LABEL),sC.expandNotificationAction=n.createInstance(Jre,Jre.ID,Jre.LABEL),sC.collapseNotificationAction=n.createInstance(Zre,Zre.ID,Zre.LABEL),sC.updateExpandCollapseIcons(c)),this._register(c.onDidChangeConfiguration(u=>{u.affectsConfiguration("workbench.notifications.position")&&sC.updateExpandCollapseIcons(c)}))}static updateExpandCollapseIcons(e){if(!sC.expandNotificationAction)return;let t=PA(e);sC.expandNotificationAction.class=q.asClassName(EPo(t)),sC.collapseNotificationAction.class=q.asClassName(TPo(t))}static{this.SEVERITIES=[ft.Info,ft.Warning,ft.Error]}setInput(e){this.inputDisposables.clear(),this.render(e)}render(e){this.template.container.classList.toggle("expanded",e.expanded),this.inputDisposables.add(j(this.template.container,re.MOUSE_UP,r=>{r.button===1&&Xt.stop(r,!0)})),this.inputDisposables.add(j(this.template.container,re.AUXCLICK,r=>{!e.hasProgress&&r.button===1&&(Xt.stop(r,!0),e.close())})),this.renderSeverity(e);let t=this.inputDisposables.add(this.hoverService.setupManagedHover(Ri("mouse"),this.template.message,"")),o=this.renderMessage(e,t);this.renderSecondaryActions(e,o);let n=this.inputDisposables.add(this.hoverService.setupManagedHover(Ri("mouse"),this.template.source,""));this.renderSource(e,n),this.renderButtons(e),this.renderProgress(e),this.inputDisposables.add(e.onDidChangeContent(r=>{switch(r.kind){case 0:this.renderSeverity(e);break;case 3:this.renderProgress(e);break;case 1:this.renderMessage(e,t);break}}))}renderSeverity(e){sC.SEVERITIES.forEach(t=>{e.severity!==t&&this.template.icon.classList.remove(...q.asClassNameArray(this.toSeverityIcon(t)))}),this.template.icon.classList.add(...q.asClassNameArray(this.toSeverityIcon(e.severity)))}renderMessage(e,t){Rt(this.template.message),this.template.message.appendChild(C9t.render(e.message,{callback:n=>this.openerService.open(A.parse(n),{allowCommands:!0}),toDispose:this.inputDisposables}));let o=e.canCollapse&&!e.expanded&&this.template.message.scrollWidth>this.template.message.clientWidth;return t.update(o?this.template.message.textContent+"":""),o}renderSecondaryActions(e,t){let o=[];if(yr(e.actions?.secondary)){let r=this.instantiationService.createInstance(rSe,rSe.ID,rSe.LABEL,e);o.push(r),this.inputDisposables.add(r)}let n=!1;e.canCollapse&&(e.expanded||e.source||t)&&(n=!0),n&&o.push(e.expanded?sC.collapseNotificationAction:sC.expandNotificationAction),e.hasProgress||o.push(sC.closeNotificationAction),this.template.toolbar.clear(),this.template.toolbar.context=e,o.forEach(r=>this.template.toolbar.push(r,{icon:!0,label:!1,keybinding:this.getKeybindingLabel(r)}))}renderSource(e,t){e.expanded&&e.source?(this.template.source.textContent=d(4422,null,e.source),t.update(e.source)):(this.template.source.textContent="",t.update(""))}renderButtons(e){Rt(this.template.buttonsContainer);let t=e.actions?e.actions.primary:void 0;if(e.expanded&&yr(t)){let o=this,n=this.inputDisposables.add(new class extends rs{async runAction(s){o.actionRunner.run(s,e),(!(s instanceof kpe)||!s.keepOpen)&&e.close()}}),r=this.inputDisposables.add(new Sw(this.template.buttonsContainer));for(let s=0;s<t.length;s++){let l=t[s],c={title:!0,secondary:s>0,...Qo},u=l instanceof kpe?l.menu:void 0,p=this.inputDisposables.add(u?r.addButtonWithDropdown({...c,contextMenuProvider:this.contextMenuService,actions:u,actionRunner:n}):r.addButton(c));p.label=l.label,this.inputDisposables.add(p.onDidClick(h=>{h&&Xt.stop(h,!0),n.run(l)}))}}}renderProgress(e){if(!e.hasProgress){this.template.progress.stop().hide();return}let t=e.progress.state;t.infinite?this.template.progress.infinite().show():typeof t.total=="number"||typeof t.worked=="number"?(typeof t.total=="number"&&!this.template.progress.hasTotal()&&this.template.progress.total(t.total),typeof t.worked=="number"&&this.template.progress.setWorked(t.worked).show()):this.template.progress.done().hide()}toSeverityIcon(e){switch(e){case ft.Warning:return R.warning;case ft.Error:return R.error}return R.info}getKeybindingLabel(e){let t=this.keybindingService.lookupKeybinding(e.id);return t?t.getLabel():null}};sC=I([m(2,Je),m(3,F),m(4,_e),m(5,Xe),m(6,nt),m(7,B)],sC);var tse=class extends x{constructor(e,t,o,n){super();this.container=e;this.options=t;this.instantiationService=o;this.contextMenuService=n;this.viewModel=[]}show(){this.isVisible||(this.list||this.createNotificationsList(),this.isVisible=!0)}createNotificationsList(){this.listContainer=_(".notifications-list-container");let e=this._register(this.instantiationService.createInstance(i9)),t=this.instantiationService.createInstance(o9,e),o=this.listDelegate=new w9t(this.listContainer),n=this.options,r=this.list=this._register(this.instantiationService.createInstance(Vl,"NotificationsList",this.listContainer,o,[t],{...n,setRowLineHeight:!1,horizontalScrolling:!1,overrideStyles:{listBackground:AX},accessibilityProvider:this.instantiationService.createInstance(Vut,n)})),s=this._register(this.instantiationService.createInstance(ese,ese.ID,ese.LABEL));this._register(r.onContextMenu(c=>{c.element&&this.contextMenuService.showContextMenu({getAnchor:()=>c.anchor,getActions:()=>[s],getActionsContext:()=>c.element,actionRunner:e})})),this._register(r.onMouseDblClick(c=>c.element.toggle()));let l=this._register(qn(r.getHTMLElement()));this._register(l.onDidBlur(()=>{Re(this.listContainer).document.hasFocus()&&r.setFocus([])})),oD.bindTo(r.contextKeyService),this._register(r.onDidChangeSelection(c=>{c.indexes.length>0&&r.setSelection([])})),this.container.appendChild(this.listContainer)}updateNotificationsList(e,t,o=[]){let[n,r]=jy(this.list,this.listContainer),s=Gr(r),l=n.getFocus()[0],c=this.viewModel[l],u=null;if(typeof l=="number"&&(u=n.getRelativeTop(l)),this.viewModel.splice(e,t,...o),n.splice(e,t,o),n.layout(),this.viewModel.length===0)this.hide();else if(typeof l=="number"){let p=0;if(c){let h=this.viewModel.indexOf(c);h===-1&&(h=l-1),h<this.viewModel.length&&h>=0&&(p=h)}typeof u=="number"&&n.reveal(p,u),n.setFocus([p])}this.isVisible&&s&&n.domFocus()}updateNotificationHeight(e){let t=this.viewModel.indexOf(e);if(t===-1)return;let[o,n]=jy(this.list,this.listDelegate);o.updateElementHeight(t,n.getHeight(e)),o.layout()}hide(){!this.isVisible||!this.list||(this.isVisible=!1,this.list.splice(0,this.viewModel.length),this.viewModel=[])}focusFirst(){this.list&&(this.list.focusFirst(),this.list.domFocus())}hasFocus(){return this.listContainer?Gr(this.listContainer):!1}layout(e,t){this.listContainer&&this.list&&(this.listContainer.style.width=`${e}px`,typeof t=="number"&&(this.list.getHTMLElement().style.maxHeight=`${t}px`),this.list.layout())}dispose(){this.hide(),super.dispose()}};tse=I([m(2,F),m(3,Xe)],tse);var Vut=class{constructor(i,e,t){this._options=i;this._keybindingService=e;this._configurationService=t}getAriaLabel(i){let e,t=this._keybindingService.lookupKeybinding("editor.action.accessibleView")?.getAriaLabel();return this._configurationService.getValue("accessibility.verbosity.notification")&&(e=t?d(4399,null,t):d(4400,null)),i.source?U7(e?d(4405,null,i.message.raw,i.source,e):d(4404,null,i.message.raw,i.source),i.severity):U7(e?d(4402,null,i.message.raw,e):d(4401,null,i.message.raw),i.severity)}getWidgetAriaLabel(){return this._options.widgetAriaLabel??d(4403,null)}getRole(){return"dialog"}};Vut=I([m(1,_e),m(2,B)],Vut);var XU=class extends yu{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super(o);this.container=e;this.model=t;this.instantiationService=n;this.layoutService=r;this.contextKeyService=s;this.editorGroupService=l;this.keybindingService=c;this.notificationService=u;this.accessibilitySignalService=p;this.contextMenuService=h;this.configurationService=g;this.menuService=f;this._onDidChangeVisibility=this._register(new E);this.onDidChangeVisibility=this._onDidChangeVisibility.event;this.notificationsCenterVisibleContextKey=L6e.bindTo(s),this.registerListeners()}static{this.MAX_DIMENSIONS=new si(450,400)}static{this.MAX_NOTIFICATION_SOURCES=10}registerListeners(){this._register(this.model.onDidChangeNotification(e=>this.onDidChangeNotification(e))),this._register(this.layoutService.onDidLayoutMainContainer(e=>this.layout(si.lift(e)))),this._register(this.notificationService.onDidChangeFilter(()=>this.onDidChangeFilter())),this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration("workbench.notifications.position")&&this.updatePositionClass()}))}updatePositionClass(){if(!this.notificationsCenterContainer)return;let e=PA(this.configurationService);this.notificationsCenterContainer.classList.remove("bottom-right","bottom-left","top-right"),this.notificationsCenterContainer.classList.add(e),this.updateHideActionIcon(),this.updateTopOffset()}updateHideActionIcon(){if(!this.hideAction)return;let e=PA(this.configurationService);this.hideAction.class=q.asClassName(e==="top-right"?wPo:O1i)}updateTopOffset(){if(!this.notificationsCenterContainer)return;if(PA(this.configurationService)==="top-right"){let t=7;this.layoutService.isVisible("workbench.parts.titlebar",ut)&&(t+=kY),this.notificationsCenterContainer.style.top=`${t}px`}else this.notificationsCenterContainer.style.top=""}onDidChangeFilter(){this.notificationService.getFilter()===1&&this.hide()}get isVisible(){return!!this._isVisible}show(){if(this._isVisible){let o=Ci(this.notificationsList);o.show(),o.focusFirst();return}this.notificationsCenterContainer||this.create(),this.updateTitle();let[e,t]=jy(this.notificationsList,this.notificationsCenterContainer);this._isVisible=!0,t.classList.add("visible"),e.show(),this.layout(this.workbenchDimensions),e.updateNotificationsList(0,0,this.model.notifications),e.focusFirst(),this.updateStyles(),this.model.notifications.forEach(o=>o.updateVisibility(!0)),this.notificationsCenterVisibleContextKey.set(!0),this._onDidChangeVisibility.fire()}updateTitle(){let[e,t]=jy(this.notificationsCenterTitle,this.clearAllAction);this.model.notifications.length===0?(e.textContent=d(4382,null),t.enabled=!1):(e.textContent=d(4380,null),t.enabled=this.model.notifications.some(o=>!o.hasProgress))}create(){this.notificationsCenterContainer=_(".notifications-center"),this.updatePositionClass(),this.notificationsCenterHeader=_(".notifications-center-header"),this.notificationsCenterContainer.appendChild(this.notificationsCenterHeader),this.notificationsCenterTitle=_("span.notifications-center-header-title"),this.notificationsCenterHeader.appendChild(this.notificationsCenterTitle);let e=_(".notifications-center-header-toolbar");this.notificationsCenterHeader.appendChild(e);let t=this._register(this.instantiationService.createInstance(i9)),o=this,n=this._register(new Zi(e,{ariaLabel:d(4383,null),actionRunner:t,actionViewItemProvider:(s,l)=>s.id===nSe.ID?this._register(this.instantiationService.createInstance(Pm,s,{getActions:()=>ri.join(...this.menuService.getMenuActions(D.NotificationsCenterPositionMenu,this.contextKeyService).map(([,c])=>c))},this.contextMenuService,{...l,actionRunner:t,classNames:s.class,keybindingProvider:c=>this.keybindingService.lookupKeybinding(c.id)})):s.id===oSe.ID?this._register(this.instantiationService.createInstance(Pm,s,{getActions(){let c=[ii({id:tSe.ID,label:o.notificationService.getFilter()===0?d(4385,null):d(4384,null),run:()=>o.notificationService.setFilter(o.notificationService.getFilter()===0?1:0)})],u=o.notificationService.getFilters().sort((p,h)=>p.label.localeCompare(h.label));for(let p of u.slice(0,XU.MAX_NOTIFICATION_SOURCES))c.length===1&&c.push(new ri),c.push(ii({id:`${tSe.ID}.${p.id}`,label:p.label,checked:p.filter!==1,run:()=>o.notificationService.setFilter({...p,filter:p.filter===1?0:1})}));return u.length>XU.MAX_NOTIFICATION_SOURCES&&(c.push(new ri),c.push(o._register(o.instantiationService.createInstance(iSe,iSe.ID,d(4379,null))))),c}},this.contextMenuService,{...l,actionRunner:t,classNames:s.class,keybindingProvider:c=>this.keybindingService.lookupKeybinding(c.id)})):Bs(this.instantiationService,s,l)}));this.clearAllAction=this._register(this.instantiationService.createInstance(Yre,Yre.ID,Yre.LABEL)),n.push(this.clearAllAction,{icon:!0,label:!1,keybinding:this.getKeybindingLabel(this.clearAllAction)}),this.configureDoNotDisturbAction=this._register(this.instantiationService.createInstance(oSe,oSe.ID,oSe.LABEL)),n.push(this.configureDoNotDisturbAction,{icon:!0,label:!1});let r=this._register(this.instantiationService.createInstance(nSe,nSe.ID,nSe.LABEL));n.push(r,{icon:!0,label:!1}),this.hideAction=this._register(this.instantiationService.createInstance(Xre,Xre.ID,Xre.LABEL)),this.updateHideActionIcon(),n.push(this.hideAction,{icon:!0,label:!1,keybinding:this.getKeybindingLabel(this.hideAction)}),this.notificationsList=this.instantiationService.createInstance(tse,this.notificationsCenterContainer,{widgetAriaLabel:d(4381,null)}),this.container.appendChild(this.notificationsCenterContainer)}getKeybindingLabel(e){let t=this.keybindingService.lookupKeybinding(e.id);return t?t.getLabel():null}onDidChangeNotification(e){if(!this._isVisible)return;let t=!1,[o,n]=jy(this.notificationsList,this.notificationsCenterContainer);switch(e.kind){case 0:o.updateNotificationsList(e.index,0,[e.item]),e.item.updateVisibility(!0);break;case 1:switch(e.detail){case 2:o.updateNotificationsList(e.index,1,[e.item]);break;case 1:e.item.expanded&&o.updateNotificationHeight(e.item);break}break;case 2:o.updateNotificationsList(e.index,1,[e.item]);break;case 3:t=Gr(n),o.updateNotificationsList(e.index,1),e.item.updateVisibility(!1);break}this.updateTitle(),this.model.notifications.length===0&&(this.hide(),t&&this.editorGroupService.activeGroup.focus())}hide(){if(!this._isVisible||!this.notificationsCenterContainer||!this.notificationsList)return;let e=Gr(this.notificationsCenterContainer);this._isVisible=!1,this.notificationsCenterContainer.classList.remove("visible"),this.notificationsList.hide(),this.model.notifications.forEach(t=>t.updateVisibility(!1)),this.notificationsCenterVisibleContextKey.set(!1),this._onDidChangeVisibility.fire(),e&&this.editorGroupService.activeGroup.focus()}updateStyles(){if(this.notificationsCenterContainer&&this.notificationsCenterHeader){let e=this.getColor(zZi);this.notificationsCenterContainer.style.border=e?`1px solid ${e}`:"";let t=this.getColor(GZi);this.notificationsCenterHeader.style.color=t??"";let o=this.getColor(Kmi);this.notificationsCenterHeader.style.background=o??""}}layout(e){if(this.workbenchDimensions=e,this._isVisible&&this.notificationsCenterContainer){let t=XU.MAX_DIMENSIONS.width,o=XU.MAX_DIMENSIONS.height,n=t,r=o;this.workbenchDimensions&&(n=this.workbenchDimensions.width,n-=16,r=this.workbenchDimensions.height-35,this.layoutService.isVisible("workbench.parts.statusbar",ut)&&(r-=22),this.layoutService.isVisible("workbench.parts.titlebar",ut)&&(r-=22),r-=24),this.updateTopOffset(),Ci(this.notificationsList).layout(Math.min(t,n),Math.min(o,r))}}clearAll(){this.hide();for(let e of[...this.model.notifications])e.hasProgress||e.close(),this.accessibilitySignalService.playSignal($o.clear)}};XU=I([m(2,Le),m(3,F),m(4,yi),m(5,X),m(6,wt),m(7,_e),m(8,Ne),m(9,lr),m(10,Xe),m(11,B),m(12,Kt)],XU);var x9t=class extends x{constructor(e){super();this.model=e;for(let t of e.notifications)this.triggerAriaAlert(t);this.registerListeners()}registerListeners(){this._register(this.model.onDidChangeNotification(e=>this.onDidChangeNotification(e)))}onDidChangeNotification(e){e.kind===0&&(this.triggerAriaAlert(e.item),e.item.severity===ft.Error&&(e.item.message.original instanceof Error?console.error(e.item.message.original):console.error(xn(e.item.message.linkedText.toString(),!0))))}triggerAriaAlert(e){if(e.priority===2)return;let t=e.onDidChangeContent(o=>{o.kind===1&&this.doTriggerAriaAlert(e)});U.once(e.onDidClose)(()=>t.dispose()),this.doTriggerAriaAlert(e)}doTriggerAriaAlert(e){let t;e.severity===ft.Error?t=d(4376,null,e.message.linkedText.toString()):e.severity===ft.Warning?t=d(4378,null,e.message.linkedText.toString()):t=d(4377,null,e.message.linkedText.toString()),en(t)}};var x2e=class extends x{constructor(e,t,o,n){super();this.model=e;this.statusbarService=t;this.notificationService=o;this.configurationService=n;this.newNotificationsCount=0;this.isNotificationsCenterVisible=!1;this.isNotificationsToastsVisible=!1;this.updateNotificationsCenterStatusItem(),e.statusMessage&&this.doSetStatusMessage(e.statusMessage),this.registerListeners()}registerListeners(){this._register(this.model.onDidChangeNotification(e=>this.onDidChangeNotification(e))),this._register(this.model.onDidChangeStatusMessage(e=>this.onDidChangeStatusMessage(e))),this._register(this.notificationService.onDidChangeFilter(()=>this.updateNotificationsCenterStatusItem())),this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration("workbench.notifications.position")&&this.updateNotificationsCenterStatusItem()}))}onDidChangeNotification(e){this.isNotificationsCenterVisible||(e.kind===0?this.newNotificationsCount++:e.kind===3&&this.newNotificationsCount>0&&this.newNotificationsCount--),this.updateNotificationsCenterStatusItem()}updateNotificationsCenterStatusItem(){let e=0;if(!this.isNotificationsCenterVisible&&!this.isNotificationsToastsVisible)for(let n of this.model.notifications)n.hasProgress&&e++;let t={name:d(4416,null),text:`${e>0||this.newNotificationsCount>0?"$(bell-dot)":"$(bell)"}`,ariaLabel:d(4416,null),command:this.isNotificationsCenterVisible?eSe:b9t,tooltip:this.getTooltip(e),showBeak:this.isNotificationsCenterVisible};if(this.notificationService.getFilter()===1&&(t={...t,text:`${e>0||this.newNotificationsCount>0?"$(bell-slash-dot)":"$(bell-slash)"}`,ariaLabel:d(4413,null),tooltip:d(4414,null)}),PA(this.configurationService)==="top-right")this.notificationsCenterStatusItem?.dispose(),this.notificationsCenterStatusItem=void 0,this.currentAlignment=void 0;else{let n=this.getDesiredAlignment();this.currentAlignment!==n&&(this.notificationsCenterStatusItem?.dispose(),this.notificationsCenterStatusItem=void 0,this.currentAlignment=n),this.notificationsCenterStatusItem?this.notificationsCenterStatusItem.update(t):this.notificationsCenterStatusItem=this.statusbarService.addEntry(t,"status.notifications",this.currentAlignment,this.currentAlignment===0?Number.MAX_SAFE_INTEGER:Number.NEGATIVE_INFINITY)}}getDesiredAlignment(){switch(PA(this.configurationService)){case"bottom-left":return 0;case"top-right":case"bottom-right":default:return 1}}getTooltip(e){return this.isNotificationsCenterVisible?d(4406,null):this.model.notifications.length===0?d(4417,null):e===0?this.newNotificationsCount===0?d(4407,null):this.newNotificationsCount===1?d(4411,null):d(4409,null,this.newNotificationsCount):this.newNotificationsCount===0?d(4408,null,e):this.newNotificationsCount===1?d(4412,null,e):d(4410,null,this.newNotificationsCount,e)}update(e,t){let o=!1;this.isNotificationsCenterVisible!==e&&(this.isNotificationsCenterVisible=e,this.newNotificationsCount=0,o=!0),this.isNotificationsToastsVisible!==t&&(this.isNotificationsToastsVisible=t,o=!0),o&&this.updateNotificationsCenterStatusItem()}onDidChangeStatusMessage(e){let t=e.item;switch(e.kind){case 0:this.doSetStatusMessage(t);break;case 1:this.currentStatusMessage&&this.currentStatusMessage[0]===t&&(Be(this.currentStatusMessage[1]),this.currentStatusMessage=void 0);break}}doSetStatusMessage(e){let t=e.message,o=e.options&&typeof e.options.showAfter=="number"?e.options.showAfter:0,n=e.options&&typeof e.options.hideAfter=="number"?e.options.hideAfter:-1;this.currentStatusMessage&&Be(this.currentStatusMessage[1]);let r,s=setTimeout(()=>{r=this.statusbarService.addEntry({name:d(4415,null),text:t,ariaLabel:t},"status.message",0,Number.NEGATIVE_INFINITY),s=void 0},o),l,c={dispose:()=>{s&&clearTimeout(s),l&&clearTimeout(l),r?.dispose()}};n>0&&(l=setTimeout(()=>c.dispose(),n)),this.currentStatusMessage=[e,c]}};x2e=I([m(1,kr),m(2,Ne),m(3,B)],x2e);var iV=class extends yu{constructor(e,t,o,n,r,s,l,c,u,p,h){super(r);this.container=e;this.model=t;this.instantiationService=o;this.layoutService=n;this.editorGroupService=s;this.lifecycleService=c;this.hostService=u;this.environmentService=p;this.configurationService=h;this._onDidChangeVisibility=this._register(new E);this.onDidChangeVisibility=this._onDidChangeVisibility.event;this._isVisible=!1;this.mapNotificationToToast=new Map;this.mapNotificationToDisposable=new Map;this.addedToastsIntervalCounter=new Qht(iV.SPAM_PROTECTION.interval);this.notificationsToastsVisibleContextKey=EB.bindTo(l),this.registerListeners()}static{this.MAX_WIDTH=450}static{this.MAX_NOTIFICATIONS=3}static{this.PURGE_TIMEOUT={[ft.Info]:1e4,[ft.Warning]:12e3,[ft.Error]:15e3}}static{this.SPAM_PROTECTION={interval:800,limit:this.MAX_NOTIFICATIONS}}get isVisible(){return!!this._isVisible}registerListeners(){this._register(this.layoutService.onDidLayoutMainContainer(e=>this.layout(si.lift(e)))),this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration("workbench.notifications.position")&&this.updateNotificationPosition()})),this.lifecycleService.when(3).then(()=>{this.model.notifications.forEach(e=>this.addToast(e)),this._register(this.model.onDidChangeNotification(e=>this.onDidChangeNotification(e)))}),this._register(this.model.onDidChangeFilter(({global:e,sources:t})=>{if(e===1)this.hide();else if(t)for(let[o]of this.mapNotificationToToast)typeof o.sourceId=="string"&&t.get(o.sourceId)===1&&o.severity!==ft.Error&&o.priority!==3&&this.removeToast(o)}))}updateNotificationPosition(){if(!this.notificationsToastsContainer)return;let e=PA(this.configurationService);this.notificationsToastsContainer.classList.remove("bottom-right","bottom-left","top-right"),this.notificationsToastsContainer.classList.add(e),this.updateTopOffset()}updateTopOffset(){if(!this.notificationsToastsContainer)return;if(PA(this.configurationService)==="top-right"){let t=3;this.layoutService.isVisible("workbench.parts.titlebar",ut)&&(t+=kY),this.notificationsToastsContainer.style.top=`${t}px`}else this.notificationsToastsContainer.style.top=""}onDidChangeNotification(e){switch(e.kind){case 0:return this.addToast(e.item);case 3:return this.removeToast(e.item)}}addToast(e){if(this.isNotificationsCenterVisible||this.environmentService.enableSmokeTestDriver||e.priority===2)return;if(e.priority===1){let o=Nn();if(Do(o)&&Kh(o)&&this.isElementInNotificationQuarter(o))return}if(this.addedToastsIntervalCounter.increment()>iV.SPAM_PROTECTION.limit)return;let t=new N;this.mapNotificationToDisposable.set(e,t),t.add(Wr(Re(this.container),()=>this.doAddToast(e,t)))}isElementInNotificationQuarter(e){let t=PA(this.configurationService),o=ir(e),n=$m(this.layoutService.mainContainer);switch(t){case"bottom-left":return o.left<n.width/2&&o.top>n.height/2;case"top-right":return o.left>n.width/2&&o.top<n.height/2;case"bottom-right":default:return o.left>n.width/2&&o.top>n.height/2}}doAddToast(e,t){let o=this.notificationsToastsContainer;o||(o=this.notificationsToastsContainer=_(".notifications-toasts"),this.container.appendChild(o)),this.updateNotificationPosition(),o.classList.add("visible");let n=_(".notification-toast-container"),r=o.firstChild;r?o.insertBefore(n,r):o.appendChild(n);let s=_(".notification-toast");n.appendChild(s);let l=this.instantiationService.createInstance(tse,s,{verticalScrollMode:2,widgetAriaLabel:e.source?U7(d(4419,null,e.message.raw,e.source),e.severity):U7(d(4418,null,e.message.raw),e.severity)});t.add(l);let c={item:e,list:l,container:n,toast:s};this.mapNotificationToToast.set(e,c),t.add(Z(()=>this.updateToastVisibility(c,!1))),l.show();let u=this.computeMaxDimensions();this.layoutLists(u.width),l.updateNotificationsList(0,0,[e]),this.layoutContainer(u.height),t.add(e.onDidChangeExpansion(()=>{l.updateNotificationsList(0,1,[e])})),t.add(e.onDidChangeContent(p=>{switch(p.kind){case 2:l.updateNotificationsList(0,1,[e]);break;case 1:e.expanded&&l.updateNotificationHeight(e);break}})),U.once(e.onDidClose)(()=>{this.removeToast(e)}),this.purgeNotification(e,n,l,t),this.updateStyles(),this.notificationsToastsVisibleContextKey.set(!0),s.classList.add("notification-fade-in"),t.add(j(s,"transitionend",()=>{s.classList.remove("notification-fade-in"),s.classList.add("notification-fade-in-done")})),e.updateVisibility(!0),this._isVisible||(this._isVisible=!0,this._onDidChangeVisibility.fire())}purgeNotification(e,t,o,n){let r=!1;n.add(j(t,re.MOUSE_OVER,()=>r=!0)),n.add(j(t,re.MOUSE_OUT,()=>r=!1));let s,l,c=()=>{s=setTimeout(()=>{this.hostService.hasFocus?e.sticky||o.hasFocus()||r?c():this.removeToast(e):l||(l=this.hostService.onDidChangeFocus(u=>{u&&c()}),n.add(l))},iV.PURGE_TIMEOUT[e.severity])};c(),n.add(Z(()=>clearTimeout(s)))}removeToast(e){let t=!1,o=this.mapNotificationToToast.get(e);o&&(Gr(o.container)&&(t=!(this.focusNext()||this.focusPrevious())),this.mapNotificationToToast.delete(e));let n=this.mapNotificationToDisposable.get(e);n&&(Be(n),this.mapNotificationToDisposable.delete(e)),this.mapNotificationToToast.size>0?this.layout(this.workbenchDimensions):(this.doHide(),t&&this.editorGroupService.activeGroup.focus())}removeToasts(){this.mapNotificationToToast.clear(),this.mapNotificationToDisposable.forEach(e=>Be(e)),this.mapNotificationToDisposable.clear(),this.doHide()}doHide(){this.notificationsToastsContainer?.classList.remove("visible"),this.notificationsToastsVisibleContextKey.set(!1),this._isVisible&&(this._isVisible=!1,this._onDidChangeVisibility.fire())}hide(){let e=this.notificationsToastsContainer?Gr(this.notificationsToastsContainer):!1;this.removeToasts(),e&&this.editorGroupService.activeGroup.focus()}focus(){let e=this.getToasts(2);return e.length>0?(e[0].list.focusFirst(),!0):!1}focusNext(){let e=this.getToasts(2);for(let t=0;t<e.length;t++)if(e[t].list.hasFocus()){let n=e[t+1];if(n)return n.list.focusFirst(),!0;break}return!1}focusPrevious(){let e=this.getToasts(2);for(let t=0;t<e.length;t++)if(e[t].list.hasFocus()){let n=e[t-1];if(n)return n.list.focusFirst(),!0;break}return!1}focusFirst(){let e=this.getToasts(2)[0];return e?(e.list.focusFirst(),!0):!1}focusLast(){let e=this.getToasts(2);return e.length>0?(e[e.length-1].list.focusFirst(),!0):!1}update(e){this.isNotificationsCenterVisible!==e&&(this.isNotificationsCenterVisible=e,this.isNotificationsCenterVisible&&this.removeToasts())}updateStyles(){this.mapNotificationToToast.forEach(({toast:e})=>{let t=this.getColor(AX);e.style.background=t||"";let o=this.getColor(KZi);e.style.border=o?`1px solid ${o}`:""})}getToasts(e){let t=[];return this.mapNotificationToToast.forEach(o=>{switch(e){case 0:t.push(o);break;case 1:this.isToastInDOM(o)||t.push(o);break;case 2:this.isToastInDOM(o)&&t.push(o);break}}),t.reverse()}layout(e){this.workbenchDimensions=e;let t=this.computeMaxDimensions();this.updateTopOffset(),t.height&&this.layoutContainer(t.height),this.layoutLists(t.width)}computeMaxDimensions(){let e=iV.MAX_WIDTH,t=e,o;return this.workbenchDimensions&&(t=this.workbenchDimensions.width,t-=16,o=this.workbenchDimensions.height,this.layoutService.isVisible("workbench.parts.statusbar",ut)&&(o-=22),this.layoutService.isVisible("workbench.parts.titlebar",ut)&&(o-=22),o-=24),new si(Math.min(e,t),o??0)}layoutLists(e){this.mapNotificationToToast.forEach(({list:t})=>t.layout(e))}layoutContainer(e){let t=e,o=Math.round(e*.618),n=0;for(let r of this.getToasts(0)){r.container.style.opacity="0",this.updateToastVisibility(r,!0),t-=r.container.offsetHeight,o-=r.container.offsetHeight;let s=!1;n===iV.MAX_NOTIFICATIONS?s=!1:(n===0&&t>=0||n>0&&o>=0)&&(s=!0),this.updateToastVisibility(r,s),r.container.style.opacity="",s&&n++}}updateToastVisibility(e,t){if(this.isToastInDOM(e)===t)return;let o=Ci(this.notificationsToastsContainer);t?o.appendChild(e.container):e.container.remove(),e.item.updateVisibility(t)}isToastInDOM(e){return!!e.container.parentElement}};iV=I([m(2,F),m(3,yi),m(4,Le),m(5,wt),m(6,X),m(7,ji),m(8,Zt),m(9,At),m(10,B)],iV);var k2e=class extends x{constructor(e,t,o,n,r,s,l,c,u){super();this.contextKeyService=e;this.contextService=t;this.configurationService=o;this.environmentService=n;this.productService=r;this.editorGroupService=s;this.editorService=l;this.layoutService=c;this.workingCopyService=u;oxt.bindTo(this.contextKeyService),Dce.bindTo(this.contextKeyService),ww.bindTo(this.contextKeyService),Fu.bindTo(this.contextKeyService),rk.bindTo(this.contextKeyService),nxt.bindTo(this.contextKeyService),y7i.bindTo(this.contextKeyService),yb.bindTo(this.contextKeyService).set(gb(this.environmentService.remoteAuthority)||""),this.virtualWorkspaceContext=WR.bindTo(this.contextKeyService),this.temporaryWorkspaceContext=ADt.bindTo(this.contextKeyService),this.isSessionsWindowContext=wb.bindTo(this.contextKeyService),this.isSessionsWindowContext.set(this.environmentService.isSessionsWindow),this.updateWorkspaceContextKeys(),NDt.bindTo(this.contextKeyService).set($x.supported(ut));let p=!this.environmentService.isBuilt||this.environmentService.isExtensionDevelopment;p5.bindTo(this.contextKeyService).set(p),h$i(p5.key,p),eB.bindTo(this.contextKeyService).set(this.productService.quality||""),veo.bindTo(this.contextKeyService).set(r.embedderIdentifier),this.inAutomationContext=ODt.bindTo(this.contextKeyService),this.inAutomationContext.set(!!this.environmentService.enableSmokeTestDriver),this.activeEditorGroupEmpty=jde.bindTo(this.contextKeyService),this.activeEditorGroupIndex=Seo.bindTo(this.contextKeyService),this.activeEditorGroupLast=Ieo.bindTo(this.contextKeyService),this.activeEditorGroupLocked=aT.bindTo(this.contextKeyService),this.multipleEditorGroupsContext=SS.bindTo(this.contextKeyService),this.editorsVisibleContext=KDt.bindTo(this.contextKeyService),this.dirtyWorkingCopiesContext=k6e.bindTo(this.contextKeyService),this.dirtyWorkingCopiesContext.set(this.workingCopyService.hasDirty),this.workbenchStateContext=za.bindTo(this.contextKeyService),this.updateWorkbenchStateContextKey(),this.workspaceFolderCountContext=sT.bindTo(this.contextKeyService),this.updateWorkspaceFolderCountContextKey(),this.openFolderWorkspaceSupportContext=RF.bindTo(this.contextKeyService),this.openFolderWorkspaceSupportContext.set(Vr||typeof this.environmentService.remoteAuthority=="string"),this.emptyWorkspaceSupportContext=zX.bindTo(this.contextKeyService),this.emptyWorkspaceSupportContext.set(Vr||typeof this.environmentService.remoteAuthority=="string"),this.enterMultiRootWorkspaceSupportContext=iD.bindTo(this.contextKeyService),this.enterMultiRootWorkspaceSupportContext.set(Vr||typeof this.environmentService.remoteAuthority=="string"),this.splitEditorsVerticallyContext=Yde.bindTo(this.contextKeyService),this.updateSplitEditorsVerticallyContext(),this.isMainWindowFullscreenContext=eA.bindTo(this.contextKeyService),this.isAuxiliaryWindowFocusedContext=Rw.bindTo(this.contextKeyService),this.inZenModeContext=BC.bindTo(this.contextKeyService),this.isMainEditorCenteredLayoutContext=_6e.bindTo(this.contextKeyService),this.mainEditorAreaVisibleContext=GDt.bindTo(this.contextKeyService),this.editorTabsVisibleContext=xK.bindTo(this.contextKeyService),this.sideBarVisibleContext=tA.bindTo(this.contextKeyService),this.sideBarVisibleContext.set(this.layoutService.isVisible("workbench.parts.sidebar")),this.titleAreaVisibleContext=r4.bindTo(this.contextKeyService),this.titleBarStyleContext=GX.bindTo(this.contextKeyService),this.updateTitleBarContextKeys(),this.panelPositionContext=qX.bindTo(this.contextKeyService),this.panelPositionContext.set(jC(this.layoutService.getPanelPosition())),this.panelVisibleContext=$X.bindTo(this.contextKeyService),this.panelVisibleContext.set(this.layoutService.isVisible("workbench.parts.panel")),this.panelMaximizedContext=qDt.bindTo(this.contextKeyService),this.panelMaximizedContext.set(this.layoutService.isPanelMaximized()),this.panelAlignmentContext=TB.bindTo(this.contextKeyService),this.panelAlignmentContext.set(this.layoutService.getPanelAlignment()),this.auxiliaryBarVisibleContext=iA.bindTo(this.contextKeyService),this.auxiliaryBarVisibleContext.set(this.layoutService.isVisible("workbench.parts.auxiliarybar")),this.auxiliaryBarMaximizedContext=kK.bindTo(this.contextKeyService),this.auxiliaryBarMaximizedContext.set(this.layoutService.isAuxiliaryBarMaximized()),this.registerListeners()}registerListeners(){this.editorGroupService.whenReady.then(()=>{this.updateEditorAreaContextKeys(),this.updateActiveEditorGroupContextKeys(),this.updateVisiblePanesContextKeys()}),this._register(this.editorService.onDidActiveEditorChange(()=>this.updateActiveEditorGroupContextKeys())),this._register(this.editorService.onDidVisibleEditorsChange(()=>this.updateVisiblePanesContextKeys())),this._register(this.editorGroupService.onDidAddGroup(()=>this.updateEditorGroupsContextKeys())),this._register(this.editorGroupService.onDidRemoveGroup(()=>this.updateEditorGroupsContextKeys())),this._register(this.editorGroupService.onDidChangeGroupIndex(()=>this.updateActiveEditorGroupContextKeys())),this._register(this.editorGroupService.onDidChangeGroupLocked(()=>this.updateActiveEditorGroupContextKeys())),this._register(this.editorGroupService.onDidChangeEditorPartOptions(()=>this.updateEditorAreaContextKeys())),this._register(this.contextService.onDidChangeWorkbenchState(()=>this.updateWorkbenchStateContextKey())),this._register(this.contextService.onDidChangeWorkspaceFolders(()=>{this.updateWorkspaceFolderCountContextKey(),this.updateWorkspaceContextKeys()})),this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration("workbench.editor.openSideBySideDirection")&&this.updateSplitEditorsVerticallyContext()})),this._register(this.layoutService.onDidChangeZenMode(e=>this.inZenModeContext.set(e))),this._register(this.layoutService.onDidChangeActiveContainer(()=>this.isAuxiliaryWindowFocusedContext.set(this.layoutService.activeContainer!==this.layoutService.mainContainer))),this._register(YN(e=>{e===ut.vscodeWindowId&&this.isMainWindowFullscreenContext.set(hC(ut))})),this._register(this.layoutService.onDidChangeMainEditorCenteredLayout(e=>this.isMainEditorCenteredLayoutContext.set(e))),this._register(this.layoutService.onDidChangePanelPosition(e=>this.panelPositionContext.set(e))),this._register(this.layoutService.onDidChangePanelAlignment(e=>this.panelAlignmentContext.set(e))),this._register(this.layoutService.onDidChangePartVisibility(()=>{this.mainEditorAreaVisibleContext.set(this.layoutService.isVisible("workbench.parts.editor",ut)),this.panelVisibleContext.set(this.layoutService.isVisible("workbench.parts.panel")),this.panelMaximizedContext.set(this.layoutService.isPanelMaximized()),this.auxiliaryBarVisibleContext.set(this.layoutService.isVisible("workbench.parts.auxiliarybar")),this.sideBarVisibleContext.set(this.layoutService.isVisible("workbench.parts.sidebar")),this.updateTitleBarContextKeys()})),this._register(this.layoutService.onDidChangeAuxiliaryBarMaximized(()=>{this.auxiliaryBarMaximizedContext.set(this.layoutService.isAuxiliaryBarMaximized())})),this._register(this.workingCopyService.onDidChangeDirty(e=>this.dirtyWorkingCopiesContext.set(e.isDirty()||this.workingCopyService.hasDirty)))}updateVisiblePanesContextKeys(){this.editorService.visibleEditorPanes.length>0?this.editorsVisibleContext.set(!0):this.editorsVisibleContext.reset()}updateActiveEditorGroupContextKeys(){this.editorService.activeEditor?this.activeEditorGroupEmpty.reset():this.activeEditorGroupEmpty.set(!0);let e=this.editorGroupService.activeGroup;this.activeEditorGroupIndex.set(e.index+1),this.activeEditorGroupLocked.set(e.isLocked),this.updateEditorGroupsContextKeys()}updateEditorGroupsContextKeys(){let e=this.editorGroupService.count;e>1?this.multipleEditorGroupsContext.set(!0):this.multipleEditorGroupsContext.reset();let t=this.editorGroupService.activeGroup;this.activeEditorGroupLast.set(t.index===e-1)}updateEditorAreaContextKeys(){this.editorTabsVisibleContext.set(this.editorGroupService.partOptions.showTabs==="multiple")}updateWorkbenchStateContextKey(){this.workbenchStateContext.set(this.getWorkbenchStateString())}updateWorkspaceFolderCountContextKey(){this.workspaceFolderCountContext.set(this.contextService.getWorkspace().folders.length)}updateSplitEditorsVerticallyContext(){let e=uy(this.configurationService);this.splitEditorsVerticallyContext.set(e===1)}getWorkbenchStateString(){switch(this.contextService.getWorkbenchState()){case 1:return"empty";case 2:return"folder";case 3:return"workspace"}}updateTitleBarContextKeys(){this.titleAreaVisibleContext.set(this.layoutService.isVisible("workbench.parts.titlebar",ut)),this.titleBarStyleContext.set(xY(this.configurationService))}updateWorkspaceContextKeys(){this.virtualWorkspaceContext.set(IDt(this.contextService.getWorkspace())||""),this.temporaryWorkspaceContext.set(gw(this.contextService.getWorkspace()))}};k2e=I([m(0,X),m(1,Pe),m(2,B),m(3,At),m(4,tt),m(5,wt),m(6,ee),m(7,yi),m(8,Xa)],k2e);var LPo=["chat.agentsControl.enabled","chat.unifiedAgentsBar.enabled","workbench.navigationControl.enabled","workbench.experimental.share.enabled"],WIn=["workbench.activityBar.location","window.commandCenter",...LPo,"workbench.editor.editorActionsLocation","workbench.layoutControl.enabled","window.menuBarVisibility","window.titleBarStyle","window.customTitleBarVisibility"],_Po=new si(qri.width,qri.height),W1i=new si($ri.width,$ri.height),k9t=class extends x{constructor(e,t){super();this.parent=e;this.layoutOptions=t;this._onDidChangeZenMode=this._register(new E);this.onDidChangeZenMode=this._onDidChangeZenMode.event;this._onDidChangeMainEditorCenteredLayout=this._register(new E);this.onDidChangeMainEditorCenteredLayout=this._onDidChangeMainEditorCenteredLayout.event;this._onDidChangePanelAlignment=this._register(new E);this.onDidChangePanelAlignment=this._onDidChangePanelAlignment.event;this._onDidChangeWindowMaximized=this._register(new E);this.onDidChangeWindowMaximized=this._onDidChangeWindowMaximized.event;this._onDidChangePanelPosition=this._register(new E);this.onDidChangePanelPosition=this._onDidChangePanelPosition.event;this._onDidChangePartVisibility=this._register(new E);this.onDidChangePartVisibility=this._onDidChangePartVisibility.event;this._onDidChangeNotificationsVisibility=this._register(new E);this.onDidChangeNotificationsVisibility=this._onDidChangeNotificationsVisibility.event;this._onDidChangeAuxiliaryBarMaximized=this._register(new E);this.onDidChangeAuxiliaryBarMaximized=this._onDidChangeAuxiliaryBarMaximized.event;this._onDidLayoutMainContainer=this._register(new E);this.onDidLayoutMainContainer=this._onDidLayoutMainContainer.event;this._onDidLayoutActiveContainer=this._register(new E);this.onDidLayoutActiveContainer=this._onDidLayoutActiveContainer.event;this._onDidLayoutContainer=this._register(new E);this.onDidLayoutContainer=this._onDidLayoutContainer.event;this._onDidAddContainer=this._register(new E);this.onDidAddContainer=this._onDidAddContainer.event;this._onDidChangeActiveContainer=this._register(new E);this.onDidChangeActiveContainer=this._onDidChangeActiveContainer.event;this.mainContainer=document.createElement("div");this.containerStylesLoaded=new Map;this.parts=new Map;this.initialized=!1;this.disposed=!1;this._openedDefaultEditors=!1;this.whenReadyPromise=new Ko;this.whenReady=this.whenReadyPromise.p;this.whenRestoredPromise=new Ko;this.whenRestored=this.whenRestoredPromise.p;this.restored=!1;this.inMaximizedAuxiliaryBarTransition=!1}get activeContainer(){return this.getContainerFromDocument(sm())}get containers(){let e=[];for(let{window:t}of SC())e.push(this.getContainerFromDocument(t.document));return e}getContainerFromDocument(e){return e===this.mainContainer.ownerDocument?this.mainContainer:e.body.getElementsByClassName("monaco-workbench")[0]}whenContainerStylesLoaded(e){return this.containerStylesLoaded.get(e.vscodeWindowId)}get mainContainerDimension(){return this._mainContainerDimension}get activeContainerDimension(){return this.getContainerDimension(this.activeContainer)}getContainerDimension(e){return e===this.mainContainer?this.mainContainerDimension:$m(e)}get mainContainerOffset(){return this.computeContainerOffset(ut)}get activeContainerOffset(){return this.computeContainerOffset(Re(this.activeContainer))}computeContainerOffset(e){let t=0,o=0;this.isVisible("workbench.parts.banner")&&(t=this.getPart("workbench.parts.banner").maximumHeight,o=t);let n=this.isVisible("workbench.parts.titlebar",e);return n&&(t+=this.getPart("workbench.parts.titlebar").maximumHeight,o=t),n&&this.configurationService.getValue("window.commandCenter")!==!1&&(o=6),{top:t,quickPickTop:o}}initLayout(e){this.environmentService=e.get(cd),this.configurationService=e.get(B),this.hostService=e.get(Zt),this.contextService=e.get(Pe),this.storageService=e.get(ce),this.themeService=e.get(Le),this.extensionService=e.get(lt),this.logService=e.get(se),this.telemetryService=e.get(Te),this.auxiliaryWindowService=e.get(OD),this.editorService=e.get(ee),this.editorGroupService=e.get(wt),this.mainPartEditorService=this.editorService.createScoped(this.editorGroupService.mainPart,this._store),this.paneCompositeService=e.get(us),this.viewDescriptorService=e.get(Bi),this.titleService=e.get(T0),this.notificationService=e.get(Ne),this.statusBarService=e.get(kr),e.get(FD),this.registerLayoutListeners(),this.initLayoutState(e.get(ji),e.get(fe))}registerLayoutListeners(){let e=()=>{this.isVisible("workbench.parts.editor",ut)||this.mainPartEditorService.visibleEditors.length===0||(this.isAuxiliaryBarMaximized()?this.toggleMaximizedAuxiliaryBar():this.toggleMaximizedPanel())},t=()=>this.mainPartEditorService.visibleEditors.length===0&&this.configurationService.getValue("workbench.secondarySideBar.forceMaximized")===!0?(this.setAuxiliaryBarMaximized(!0),!0):!1;this.editorGroupService.whenRestored.then(()=>{this._register(this.mainPartEditorService.onDidVisibleEditorsChange(()=>{t()||e()})),this._register(this.editorGroupService.mainPart.onDidActivateGroup(n=>{n.reason!==1&&e()})),this._register(this.mainPartEditorService.onDidActiveEditorChange(()=>this.centerMainEditorLayout(this.stateModel.getRuntimeValue(ho.MAIN_EDITOR_CENTERED))))}),this._register(this.configurationService.onDidChangeConfiguration(n=>{if([...WIn,"workbench.sideBar.location","workbench.statusBar.visible"].some(r=>n.affectsConfiguration(r))){if(LPo.some(p=>n.affectsConfiguration(p)&&this.configurationService.getValue(p)===!0)&&this.configurationService.getValue("window.commandCenter")===!1){this.configurationService.updateValue("window.commandCenter",!0);return}let s=n.affectsConfiguration("workbench.editor.editorActionsLocation")&&this.configurationService.getValue("workbench.editor.editorActionsLocation")==="titleBar",l=n.affectsConfiguration("window.commandCenter")&&this.configurationService.getValue("window.commandCenter"),c=n.affectsConfiguration("workbench.layoutControl.enabled")&&this.configurationService.getValue("workbench.layoutControl.enabled");if((n.affectsConfiguration("workbench.activityBar.location")&&["top","bottom"].includes(this.configurationService.getValue("workbench.activityBar.location"))||s||l||c)&&this.configurationService.getValue("window.customTitleBarVisibility")==="never"){this.configurationService.updateValue("window.customTitleBarVisibility","auto");return}this.doUpdateLayoutConfiguration()}if(n.affectsConfiguration("workbench.shadows")&&this.updateShadows(),n.affectsConfiguration("workbench.secondarySideBar.forceMaximized")){let r=this.configurationService.getValue("workbench.secondarySideBar.forceMaximized");r===!0&&this.mainPartEditorService.visibleEditors.length===0?this.setAuxiliaryBarMaximized(!0):r===!1&&this.isAuxiliaryBarMaximized()&&this.setAuxiliaryBarMaximized(!1)}})),this._register(YN(n=>this.onFullscreenChanged(n))),this._register(this.editorGroupService.mainPart.onDidAddGroup(()=>this.centerMainEditorLayout(this.stateModel.getRuntimeValue(ho.MAIN_EDITOR_CENTERED)))),this._register(this.editorGroupService.mainPart.onDidRemoveGroup(()=>this.centerMainEditorLayout(this.stateModel.getRuntimeValue(ho.MAIN_EDITOR_CENTERED)))),this._register(this.editorGroupService.mainPart.onDidChangeGroupMaximized(()=>this.centerMainEditorLayout(this.stateModel.getRuntimeValue(ho.MAIN_EDITOR_CENTERED)))),this._register(j(this.mainContainer,re.SCROLL,()=>this.mainContainer.scrollTop=0)),(ei||fn||Wt)&&!LC(this.configurationService)&&this._register(this.titleService.onMenubarVisibilityChange(n=>this.onMenubarToggled(n))),this._register(this.themeService.onDidColorThemeChange(()=>this.updateWindowBorder())),this._register(this.hostService.onDidChangeFocus(n=>this.onWindowFocusChanged(n))),this._register(this.hostService.onDidChangeActiveWindow(()=>this.onActiveWindowChanged())),Wt&&typeof navigator.windowControlsOverlay=="object"&&this._register(j(navigator.windowControlsOverlay,"geometrychange",()=>this.onDidChangeWCO())),this._register(this.auxiliaryWindowService.onDidOpenAuxiliaryWindow(({window:n,disposables:r})=>{let s=n.window.vscodeWindowId;this.containerStylesLoaded.set(s,n.whenStylesHaveLoaded),n.whenStylesHaveLoaded.then(()=>this.containerStylesLoaded.delete(s)),r.add(Z(()=>this.containerStylesLoaded.delete(s)));let l=r.add(new N);this._onDidAddContainer.fire({container:n.container,disposables:l}),r.add(n.onDidLayout(c=>this.handleContainerDidLayout(n.container,c)))}))}onMenubarToggled(e){if(e!==this.state.runtime.menuBar.toggled){this.state.runtime.menuBar.toggled=e;let t=uR(this.configurationService);Wt&&t==="toggle"?this.workbenchGrid.setViewVisible(this.titleBarPartView,MB(this.configurationService,ut,this.state.runtime.menuBar.toggled)):this.state.runtime.mainWindowFullscreen&&(t==="toggle"||t==="classic")&&this.workbenchGrid.setViewVisible(this.titleBarPartView,MB(this.configurationService,ut,this.state.runtime.menuBar.toggled)),this.handleContainerDidLayout(this.mainContainer,this._mainContainerDimension)}}handleContainerDidLayout(e,t){e===this.mainContainer&&this._onDidLayoutMainContainer.fire(t),wgt(e)&&this._onDidLayoutActiveContainer.fire(t),this._onDidLayoutContainer.fire({container:e,dimension:t})}onFullscreenChanged(e){e===ut.vscodeWindowId&&(this.state.runtime.mainWindowFullscreen=hC(ut),this.state.runtime.mainWindowFullscreen?this.mainContainer.classList.add("fullscreen"):(this.mainContainer.classList.remove("fullscreen"),this.stateModel.getRuntimeValue(ho.ZEN_MODE_EXIT_INFO).transitionedToFullScreen&&this.isZenModeActive()&&this.toggleZenMode()),this.workbenchGrid.edgeSnapping=this.state.runtime.mainWindowFullscreen,jO(this.configurationService)&&(this.workbenchGrid.setViewVisible(this.titleBarPartView,MB(this.configurationService,ut,this.state.runtime.menuBar.toggled)),this.updateWindowBorder(!0)))}onActiveWindowChanged(){let e=this.getActiveContainerId();this.state.runtime.activeContainerId!==e&&(this.state.runtime.activeContainerId=e,this.updateWindowBorder(),this._onDidChangeActiveContainer.fire())}onWindowFocusChanged(e){this.state.runtime.hasFocus!==e&&(this.state.runtime.hasFocus=e,this.updateWindowBorder())}getActiveContainerId(){let e=this.activeContainer;return Re(e).vscodeWindowId}doUpdateLayoutConfiguration(e){this.updateCustomTitleBarVisibility(),this.updateMenubarVisibility(!!e),this.editorGroupService.whenRestored.then(()=>this.centerMainEditorLayout(this.stateModel.getRuntimeValue(ho.MAIN_EDITOR_CENTERED),e))}isShadowsDisabled(){return this.configurationService.getValue("workbench.shadows")===!1}updateShadows(){let e=this.isShadowsDisabled();for(let t of Array.from(this.containers))t.classList.toggle("no-shadows",e)}setSideBarPosition(e){let t=this.getPart("workbench.parts.activitybar"),o=this.getPart("workbench.parts.sidebar"),n=this.getPart("workbench.parts.auxiliarybar"),r=e===0?"left":"right",s=e===1?"left":"right",l=this.getPanelAlignment(),c=this.getPanelPosition();this.stateModel.setRuntimeValue(ho.SIDEBAR_POSITON,e);let u=Ci(t.getContainer()),p=Ci(o.getContainer()),h=Ci(n.getContainer());u.classList.remove(s),p.classList.remove(s),u.classList.add(r),p.classList.add(r),h.classList.remove(r),h.classList.add(s),t.updateStyles(),o.updateStyles(),n.updateStyles(),this.adjustPartPositions(e,l,c)}updateWindowBorder(e=!1){if(Wt||ei||(ei||fn)&&YCe(this.configurationService)||LC(this.configurationService))return;let t=this.themeService.getColorTheme(),o=t.getColor(CEe),n=t.getColor(xEe),r=this.hasMainWindowBorder();for(let s of this.containers){let l=s===this.mainContainer,c=this.activeContainer===s,u=!1;if(!this.state.runtime.mainWindowFullscreen&&(o||n)){u=!0;let p=c&&this.state.runtime.hasFocus?o:n??o;s.style.setProperty("--window-border-color",p?.toString()??"transparent")}l&&(this.state.runtime.mainWindowBorder=u),s.classList.toggle("border",u)}!e&&r!==this.hasMainWindowBorder()&&this.layout()}initLayoutState(e,t){this._mainContainerDimension=$m(this.parent,this.contextService.getWorkbenchState()===1?_Po:W1i),this.stateModel=new V1i(this.storageService,this.configurationService,this.contextService,this.environmentService),this.stateModel.load({mainContainerDimension:this._mainContainerDimension,resetLayout:!!this.layoutOptions?.resetLayout}),this._register(this.stateModel.onDidChangeState(s=>{s.key===ho.ACTIVITYBAR_HIDDEN&&this.setActivityBarHidden(s.value),s.key===ho.STATUSBAR_HIDDEN&&this.setStatusBarHidden(s.value),s.key===ho.SIDEBAR_POSITON&&this.setSideBarPosition(s.value),s.key===ho.PANEL_POSITION&&this.setPanelPosition(s.value),s.key===ho.PANEL_ALIGNMENT&&this.setPanelAlignment(s.value),this.doUpdateLayoutConfiguration()}));let o=this.getInitialEditorsState();o&&this.logService.trace("Initial editor state",o);let n={layout:{editors:o?.layout},editor:{restoreEditors:this.shouldRestoreEditors(this.contextService,o),editorsToOpen:this.resolveEditorsToOpen(t,o)},views:{defaults:this.getDefaultLayoutViews(this.environmentService,this.storageService),containerToRestore:{}}},r={activeContainerId:this.getActiveContainerId(),mainWindowFullscreen:hC(ut),hasFocus:this.hostService.hasFocus,maximized:new Set,mainWindowBorder:!1,menuBar:{toggled:!1},zenMode:{transitionDisposables:new Vt}};if(this.state={initialization:n,runtime:r},this.isVisible("workbench.parts.sidebar")){let s=this.storageService.get(q2.activeViewletSettingsKey,1,this.viewDescriptorService.getDefaultViewContainer(0)?.id);!this.environmentService.isBuilt||e.startupKind===3||this.environmentService.isExtensionDevelopment&&!this.environmentService.extensionTestsLocationURI||s!==this.viewDescriptorService.getDefaultViewContainer(0)?.id&&s!==this.viewDescriptorService.getDefaultViewContainer(2)?.id&&(s=this.viewDescriptorService.getDefaultViewContainer(0)?.id),s?this.state.initialization.views.containerToRestore.sideBar=s:this.stateModel.setRuntimeValue(ho.SIDEBAR_HIDDEN,!0)}if(this.isVisible("workbench.parts.panel")){let s=this.storageService.get(G2.activePanelSettingsKey,1,this.viewDescriptorService.getDefaultViewContainer(1)?.id);s?this.state.initialization.views.containerToRestore.panel=s:this.stateModel.setRuntimeValue(ho.PANEL_HIDDEN,!0)}if(this.isVisible("workbench.parts.auxiliarybar")){let s=this.storageService.get(VA.activeViewSettingsKey,1,this.viewDescriptorService.getDefaultViewContainer(2)?.id);s?this.state.initialization.views.containerToRestore.auxiliaryBar=s:this.stateModel.setRuntimeValue(ho.AUXILIARYBAR_HIDDEN,!0)}this.updateWindowBorder(!0)}getDefaultLayoutViews(e,t){let o=e.options?.defaultLayout;if(!o||!o.force&&!t.isNew(1))return;let{views:n}=o;if(n?.length)return n.map(r=>r.id)}shouldRestoreEditors(e,t){return gw(e.getWorkspace())||this.configurationService.getValue("workbench.editor.restoreEditors")===!1?!1:!!(this.configurationService.getValue("window.restoreWindows")==="preserve")||t===void 0}willRestoreEditors(){return this.state.initialization.editor.restoreEditors}async resolveEditorsToOpen(e,t){if(t){let o=di(await MEe(t.filesToMerge,e,this.logService));if(o.length===4&&Sf(o[0])&&Sf(o[1])&&Sf(o[2])&&Sf(o[3]))return[{editor:{input1:{resource:o[0].resource},input2:{resource:o[1].resource},base:{resource:o[2].resource},result:{resource:o[3].resource},options:{pinned:!0}}}];let n=di(await MEe(t.filesToDiff,e,this.logService));if(n.length===2)return[{editor:{original:{resource:n[0].resource},modified:{resource:n[1].resource},options:{pinned:!0}}}];let r=[],s=await MEe(t.filesToOpenOrCreate,e,this.logService);for(let l=0;l<s.length;l++){let c=s[l];c&&r.push({editor:c,viewColumn:t.filesToOpenOrCreate?.[l].viewColumn})}return r}else if(this.contextService.getWorkbenchState()===1&&this.configurationService.getValue("workbench.startupEditor")==="newUntitledFile")return this.editorGroupService.hasRestorableState?[]:[{editor:{resource:void 0}}];return[]}get openedDefaultEditors(){return this._openedDefaultEditors}getInitialEditorsState(){let e=this.environmentService.options?.defaultLayout;if((e?.editors?.length||e?.layout?.editors)&&(e.force||this.storageService.isNew(1)))return this._openedDefaultEditors=!0,{layout:e.layout?.editors,filesToOpenOrCreate:e?.editors?.map(r=>({viewColumn:r.viewColumn,fileUri:A.revive(r.uri),openOnlyIfExists:r.openOnlyIfExists,options:r.options}))};let{filesToOpenOrCreate:t,filesToDiff:o,filesToMerge:n}=this.environmentService;if(t||o||n)return{filesToOpenOrCreate:t,filesToDiff:o,filesToMerge:n}}isRestored(){return this.restored}restoreParts(){let e=[],t=[];e.push((async()=>{Mo("code/willRestoreEditors"),await this.editorGroupService.whenReady,Mo("code/restoreEditors/editorGroupsReady"),this.state.initialization.layout?.editors&&this.editorGroupService.mainPart.applyLayout(this.state.initialization.layout.editors);let s=await this.state.initialization.editor.editorsToOpen;Mo("code/restoreEditors/editorsToOpenResolved");let l;if(s.length){let c=this.editorGroupService.mainPart.getGroups(2),u=new Map;for(let p of s){let h=c[(p.viewColumn??1)-1],g=u.get(h.id);g||(g=new Set,u.set(h.id,g)),g.add(p.editor)}l=Promise.all(Array.from(u).map(async([p,h])=>{try{await this.editorService.openEditors(Array.from(h),p,{validateTrust:!0})}catch(g){this.logService.error(g)}}))}t.push(Promise.all([l?.finally(()=>Mo("code/restoreEditors/editorsOpened")),this.editorGroupService.whenRestored.finally(()=>Mo("code/restoreEditors/editorGroupsRestored"))]).finally(()=>{Mo("code/didRestoreEditors")}))})());let o=(async()=>{if(this.state.initialization.views.defaults?.length){Mo("code/willOpenDefaultViews");let s=[],l=p=>{let h=this.viewDescriptorService.getViewLocationById(p.id);if(h!==null){let g=this.viewDescriptorService.getViewContainerByViewId(p.id);if(g){p.order>=(s?.[h]?.order??0)&&(s[h]={id:g.id,order:p.order});let f=this.viewDescriptorService.getViewContainerModel(g);return f.setCollapsed(p.id,!1),f.setVisible(p.id,!0),!0}}return!1},c=[...this.state.initialization.views.defaults].reverse().map((p,h)=>({id:p,order:h})),u=c.length;for(;u;)u--,l(c[u])&&c.splice(u,1);if(c.length){await this.extensionService.whenInstalledExtensionsRegistered();let p=c.length;for(;p;)p--,l(c[p])&&c.splice(p,1)}s[0]&&(this.state.initialization.views.containerToRestore.sideBar=s[0].id),s[1]&&(this.state.initialization.views.containerToRestore.panel=s[1].id),s[2]&&(this.state.initialization.views.containerToRestore.auxiliaryBar=s[2].id),Mo("code/didOpenDefaultViews")}})();e.push(o),e.push((async()=>{await o,this.state.initialization.views.containerToRestore.sideBar&&(Mo("code/willRestoreViewlet"),await this.openViewContainer(0,this.state.initialization.views.containerToRestore.sideBar),Mo("code/didRestoreViewlet"))})()),e.push((async()=>{await o,this.state.initialization.views.containerToRestore.panel&&(Mo("code/willRestorePanel"),await this.openViewContainer(1,this.state.initialization.views.containerToRestore.panel),Mo("code/didRestorePanel"))})()),e.push((async()=>{await o,this.state.initialization.views.containerToRestore.auxiliaryBar&&(Mo("code/willRestoreAuxiliaryBar"),await this.openViewContainer(2,this.state.initialization.views.containerToRestore.auxiliaryBar),Mo("code/didRestoreAuxiliaryBar"))})());let n=this.isZenModeActive(),r=DPo(this.configurationService).restore;n&&(this.setZenModeActive(!r),this.toggleZenMode(!1,!0)),this.stateModel.getRuntimeValue(ho.MAIN_EDITOR_CENTERED)&&this.centerMainEditorLayout(!0,!0),dn.settled(e).finally(()=>{Nn()===ut.document.body&&(this.isPanelMaximized()||this.isAuxiliaryBarMaximized())&&this.focus(),this.whenReadyPromise.complete(),dn.settled(t).finally(()=>{this.editorService.editors.length===0&&this.isVisible("workbench.parts.auxiliarybar")&&!this.hasFocus("workbench.parts.auxiliarybar")&&!this.environmentService.enableSmokeTestDriver&&this.focusPart("workbench.parts.auxiliarybar"),this.restored=!0,this.whenRestoredPromise.complete()})})}async openViewContainer(e,t,o){let n=await this.paneCompositeService.openPaneComposite(t,e,o);n||(n=await this.paneCompositeService.openPaneComposite(this.viewDescriptorService.getDefaultViewContainer(e)?.id,e,o),!n&&await this.paneCompositeService.openPaneComposite(this.paneCompositeService.getVisiblePaneCompositeIds(e).at(0),e,o))}registerPart(e){let t=e.getId();return this.parts.set(t,e),Z(()=>this.parts.delete(t))}getPart(e){let t=this.parts.get(e);if(!t)throw new Error(`Unknown part ${e}`);return t}registerNotifications(e){this._register(e.onDidChangeNotificationsVisibility(t=>this._onDidChangeNotificationsVisibility.fire(t)))}hasFocus(e){let t=this.getContainer(Ki(),e);if(!t)return!1;let o=Nn();return o?zqi(o,t):!1}_getFocusedPart(){for(let e of this.parts.keys())if(this.hasFocus(e))return e}focusPart(e,t=ut){let o=this.getContainer(t,e)??this.mainContainer;switch(e){case"workbench.parts.editor":this.editorGroupService.getPart(o).activeGroup.focus();break;case"workbench.parts.panel":{this.paneCompositeService.getActivePaneComposite(1)?.focus();break}case"workbench.parts.sidebar":{this.paneCompositeService.getActivePaneComposite(0)?.focus();break}case"workbench.parts.auxiliarybar":{this.paneCompositeService.getActivePaneComposite(2)?.focus();break}case"workbench.parts.activitybar":this.getPart("workbench.parts.sidebar").focusActivityBar();break;case"workbench.parts.statusbar":this.statusBarService.getPart(o).focus();break;default:o?.focus()}}getContainer(e,t){if(typeof t>"u")return this.getContainerFromDocument(e.document);if(e===ut)return this.getPart(t).getContainer();let o;if(t==="workbench.parts.editor"?o=this.editorGroupService.getPart(this.getContainerFromDocument(e.document)):t==="workbench.parts.statusbar"?o=this.statusBarService.getPart(this.getContainerFromDocument(e.document)):t==="workbench.parts.titlebar"&&(o=this.titleService.getPart(this.getContainerFromDocument(e.document))),o instanceof RT)return o.getContainer()}isVisible(e,t=ut){if(t!==ut&&e==="workbench.parts.editor")return!0;switch(e){case"workbench.parts.titlebar":return this.initialized?this.workbenchGrid.isViewVisible(this.titleBarPartView):MB(this.configurationService,ut,this.state.runtime.menuBar.toggled);case"workbench.parts.sidebar":return!this.stateModel.getRuntimeValue(ho.SIDEBAR_HIDDEN);case"workbench.parts.panel":return!this.stateModel.getRuntimeValue(ho.PANEL_HIDDEN);case"workbench.parts.auxiliarybar":return!this.stateModel.getRuntimeValue(ho.AUXILIARYBAR_HIDDEN);case"workbench.parts.statusbar":return!this.stateModel.getRuntimeValue(ho.STATUSBAR_HIDDEN);case"workbench.parts.activitybar":return!this.stateModel.getRuntimeValue(ho.ACTIVITYBAR_HIDDEN);case"workbench.parts.editor":return!this.stateModel.getRuntimeValue(ho.EDITOR_HIDDEN);case"workbench.parts.banner":return this.initialized?this.workbenchGrid.isViewVisible(this.bannerPartView):!1;default:return!1}}shouldShowBannerFirst(){return Wt&&!zse()}focus(){this.isPanelMaximized()&&this.mainContainer===this.activeContainer?this.focusPart("workbench.parts.panel"):this.isAuxiliaryBarMaximized()&&this.mainContainer===this.activeContainer?this.focusPart("workbench.parts.auxiliarybar"):this.focusPart("workbench.parts.editor",Re(this.activeContainer))}focusPanelOrEditor(){let e=this.paneCompositeService.getActivePaneComposite(1);(this.hasFocus("workbench.parts.panel")||!this.isVisible("workbench.parts.editor"))&&e?e.focus():this.focus()}getMaximumEditorDimensions(e){let t=Re(e),o=this.getContainerDimension(e);if(e===this.mainContainer){let n=xh(this.getPanelPosition()),r=(this.isVisible("workbench.parts.activitybar")?this.activityBarPartView.minimumWidth:0)+(this.isVisible("workbench.parts.sidebar")?this.sideBarPartView.minimumWidth:0)+(this.isVisible("workbench.parts.panel")&&!n?this.panelPartView.minimumWidth:0)+(this.isVisible("workbench.parts.auxiliarybar")?this.auxiliaryBarPartView.minimumWidth:0),s=(this.isVisible("workbench.parts.titlebar",t)?this.titleBarPartView.minimumHeight:0)+(this.isVisible("workbench.parts.statusbar",t)?this.statusBarPartView.minimumHeight:0)+(this.isVisible("workbench.parts.panel")&&n?this.panelPartView.minimumHeight:0),l=o.width-r,c=o.height-s;return{width:l,height:c}}else{let n=(this.isVisible("workbench.parts.titlebar",t)?this.titleBarPartView.minimumHeight:0)+(this.isVisible("workbench.parts.statusbar",t)?this.statusBarPartView.minimumHeight:0);return{width:o.width,height:o.height-n}}}isZenModeActive(){return this.stateModel.getRuntimeValue(ho.ZEN_MODE_ACTIVE)}setZenModeActive(e){this.stateModel.setRuntimeValue(ho.ZEN_MODE_ACTIVE,e)}toggleZenMode(e,t=!1){let o=this._getFocusedPart();this.setZenModeActive(!this.isZenModeActive()),this.state.runtime.zenMode.transitionDisposables.clearAndDisposeAll();let n=c=>{for(let u of this.mainPartEditorService.visibleTextEditorControls){if(!c&&pn(u)&&u.hasModel()){let p=u.getModel();c=this.configurationService.getValue("editor.lineNumbers",{resource:p.uri,overrideIdentifier:p.getLanguageId()})}c||(c=this.configurationService.getValue("editor.lineNumbers")),u.updateOptions({lineNumbers:c})}},r=!1,s=DPo(this.configurationService),l=this.stateModel.getRuntimeValue(ho.ZEN_MODE_EXIT_INFO);this.isZenModeActive()?(r=!this.state.runtime.mainWindowFullscreen&&s.fullScreen&&!dc,t||(l.transitionedToFullScreen=r,l.transitionedToCenteredEditorLayout=!this.isMainEditorLayoutCentered()&&s.centerLayout,l.handleNotificationsDoNotDisturbMode=this.notificationService.getFilter()===0,l.wasVisible.sideBar=this.isVisible("workbench.parts.sidebar"),l.wasVisible.panel=this.isVisible("workbench.parts.panel"),l.wasVisible.auxiliaryBar=this.isVisible("workbench.parts.auxiliarybar"),this.stateModel.setRuntimeValue(ho.ZEN_MODE_EXIT_INFO,l)),this.setPanelHidden(!0,!0),this.setAuxiliaryBarHidden(!0,!0),this.setSideBarHidden(!0),s.hideActivityBar&&this.setActivityBarHidden(!0),s.hideStatusBar&&this.setStatusBarHidden(!0),s.hideLineNumbers&&(n("off"),this.state.runtime.zenMode.transitionDisposables.set("zenMode.hideLineNumbers",this.mainPartEditorService.onDidVisibleEditorsChange(()=>n("off")))),s.showTabs!==this.editorGroupService.partOptions.showTabs&&this.state.runtime.zenMode.transitionDisposables.set("zenMode.showTabs",this.editorGroupService.mainPart.enforcePartOptions({showTabs:s.showTabs})),s.silentNotifications&&l.handleNotificationsDoNotDisturbMode&&this.notificationService.setFilter(1),s.centerLayout&&this.centerMainEditorLayout(!0,!0),this.state.runtime.zenMode.transitionDisposables.set("configurationChange",this.configurationService.onDidChangeConfiguration(c=>{if(c.affectsConfiguration("zenMode.hideActivityBar")||c.affectsConfiguration("workbench.activityBar.location")){let u=this.configurationService.getValue("zenMode.hideActivityBar"),p=this.configurationService.getValue("workbench.activityBar.location");this.setActivityBarHidden(u?!0:p==="top"||p==="bottom")}if(c.affectsConfiguration("zenMode.hideStatusBar")){let u=this.configurationService.getValue("zenMode.hideStatusBar");this.setStatusBarHidden(u)}if(c.affectsConfiguration("zenMode.centerLayout")){let u=this.configurationService.getValue("zenMode.centerLayout");this.centerMainEditorLayout(u,!0)}if(c.affectsConfiguration("zenMode.showTabs")){let u=this.configurationService.getValue("zenMode.showTabs")??"multiple";this.state.runtime.zenMode.transitionDisposables.set("zenMode.showTabs",this.editorGroupService.mainPart.enforcePartOptions({showTabs:u}))}if(c.affectsConfiguration("zenMode.silentNotifications")){let u=!!this.configurationService.getValue("zenMode.silentNotifications");l.handleNotificationsDoNotDisturbMode&&this.notificationService.setFilter(u?1:0)}if(c.affectsConfiguration("zenMode.hideLineNumbers")){let u=this.configurationService.getValue("zenMode.hideLineNumbers")?"off":void 0;n(u),this.state.runtime.zenMode.transitionDisposables.set("zenMode.hideLineNumbers",this.mainPartEditorService.onDidVisibleEditorsChange(()=>n(u)))}}))):(l.wasVisible.panel&&this.setPanelHidden(!1,!0),l.wasVisible.auxiliaryBar&&this.setAuxiliaryBarHidden(!1,!0),l.wasVisible.sideBar&&this.setSideBarHidden(!1),this.stateModel.getRuntimeValue(ho.ACTIVITYBAR_HIDDEN,!0)||this.setActivityBarHidden(!1),this.stateModel.getRuntimeValue(ho.STATUSBAR_HIDDEN,!0)||this.setStatusBarHidden(!1),l.transitionedToCenteredEditorLayout&&this.centerMainEditorLayout(!1,!0),l.handleNotificationsDoNotDisturbMode&&this.notificationService.setFilter(0),n(),r=l.transitionedToFullScreen&&this.state.runtime.mainWindowFullscreen),e||this.layout(),r&&this.hostService.toggleFullScreen(ut),o&&this.isVisible(o,Re(this.activeContainer))?lio(o)?this.focusPart(o,Re(this.activeContainer)):this.focusPart(o):this.focus(),this._onDidChangeZenMode.fire(this.isZenModeActive())}setStatusBarHidden(e){this.stateModel.setRuntimeValue(ho.STATUSBAR_HIDDEN,e),e?this.mainContainer.classList.add("nostatusbar"):this.mainContainer.classList.remove("nostatusbar"),this.workbenchGrid.setViewVisible(this.statusBarPartView,!e)}createWorkbenchLayout(){let e=this.getPart("workbench.parts.titlebar"),t=this.getPart("workbench.parts.banner"),o=this.getPart("workbench.parts.editor"),n=this.getPart("workbench.parts.activitybar"),r=this.getPart("workbench.parts.panel"),s=this.getPart("workbench.parts.auxiliarybar"),l=this.getPart("workbench.parts.sidebar"),c=this.getPart("workbench.parts.statusbar");this.titleBarPartView=e,this.bannerPartView=t,this.sideBarPartView=l,this.activityBarPartView=n,this.editorPartView=o,this.panelPartView=r,this.auxiliaryBarPartView=s,this.statusBarPartView=c;let u={"workbench.parts.activitybar":this.activityBarPartView,"workbench.parts.banner":this.bannerPartView,"workbench.parts.titlebar":this.titleBarPartView,"workbench.parts.editor":this.editorPartView,"workbench.parts.panel":this.panelPartView,"workbench.parts.sidebar":this.sideBarPartView,"workbench.parts.statusbar":this.statusBarPartView,"workbench.parts.auxiliarybar":this.auxiliaryBarPartView},p=({type:g})=>u[g],h=S3.deserialize(this.createGridDescriptor(),{fromJSON:p},{proportionalLayout:!1});this.mainContainer.prepend(h.element),this.mainContainer.setAttribute("role","application"),this.workbenchGrid=h,this.workbenchGrid.edgeSnapping=this.state.runtime.mainWindowFullscreen;for(let g of[e,o,n,r,l,c,s,t])this._register(g.onDidVisibilityChange(f=>{this.inMaximizedAuxiliaryBarTransition||(g===l?this.setSideBarHidden(!f):g===r&&this.stateModel.getRuntimeValue(ho.PANEL_HIDDEN)===f?this.setPanelHidden(!f,!0):g===s?this.setAuxiliaryBarHidden(!f,!0):g===o&&this.setEditorHidden(!f)),this._onDidChangePartVisibility.fire({partId:g.getId(),visible:f}),this.handleContainerDidLayout(this.mainContainer,this._mainContainerDimension)}));this._register(this.storageService.onWillSaveState(()=>{let g=this.stateModel.getRuntimeValue(ho.SIDEBAR_HIDDEN)?this.workbenchGrid.getViewCachedVisibleSize(this.sideBarPartView):this.workbenchGrid.getViewSize(this.sideBarPartView).width;this.stateModel.setInitializationValue(ho.SIDEBAR_SIZE,g);let f=this.stateModel.getRuntimeValue(ho.PANEL_HIDDEN)?this.workbenchGrid.getViewCachedVisibleSize(this.panelPartView):xh(this.stateModel.getRuntimeValue(ho.PANEL_POSITION))?this.workbenchGrid.getViewSize(this.panelPartView).height:this.workbenchGrid.getViewSize(this.panelPartView).width;this.stateModel.setInitializationValue(ho.PANEL_SIZE,f);let v=this.stateModel.getRuntimeValue(ho.AUXILIARYBAR_HIDDEN)?this.workbenchGrid.getViewCachedVisibleSize(this.auxiliaryBarPartView):this.workbenchGrid.getViewSize(this.auxiliaryBarPartView).width;this.stateModel.setInitializationValue(ho.AUXILIARYBAR_SIZE,v),this.stateModel.save(!0,!0)})),this._register(U.any(this.paneCompositeService.onDidPaneCompositeOpen,this.paneCompositeService.onDidPaneCompositeClose)(()=>{this.stateModel.setInitializationValue(ho.AUXILIARYBAR_EMPTY,this.paneCompositeService.getPaneCompositeIds(2).length===0)}))}layout(){this.disposed||(this._mainContainerDimension=$m(this.state.runtime.mainWindowFullscreen?ut.document.body:this.parent,this.contextService.getWorkbenchState()===1?_Po:W1i),this.logService.trace(`Layout#layout, height: ${this._mainContainerDimension.height}, width: ${this._mainContainerDimension.width}`),VL(this.mainContainer,this._mainContainerDimension.width,this._mainContainerDimension.height),this.workbenchGrid.layout(this._mainContainerDimension.width,this._mainContainerDimension.height),this.initialized=!0,this.handleContainerDidLayout(this.mainContainer,this._mainContainerDimension))}isMainEditorLayoutCentered(){return this.stateModel.getRuntimeValue(ho.MAIN_EDITOR_CENTERED)}centerMainEditorLayout(e,t){this.stateModel.setRuntimeValue(ho.MAIN_EDITOR_CENTERED,e);let n=di(this.editorGroupService.mainPart.groups.map(c=>c.activeEditor)).some(c=>c instanceof Pa?this.configurationService.getValue("diffEditor.renderSideBySide"):!!c?.hasCapability(256)),r=this.editorGroupService.getLayout(),s=!1;r.orientation===0?s=r.groups.length>1:s=r.groups.some(c=>c.groups&&c.groups.length>1),this.configurationService.getValue("workbench.editor.centeredLayoutAutoResize")&&(s&&!this.editorGroupService.mainPart.hasMaximizedGroup()||n)&&(e=!1),this.editorGroupService.mainPart.isLayoutCentered()!==e&&(this.editorGroupService.mainPart.centerLayout(e),t||this.layout()),this._onDidChangeMainEditorCenteredLayout.fire(this.stateModel.getRuntimeValue(ho.MAIN_EDITOR_CENTERED))}getSize(e){return this.workbenchGrid.getViewSize(this.getPart(e))}setSize(e,t){this.workbenchGrid.resizeView(this.getPart(e),t)}resizePart(e,t,o){let n=Math.sign(t)*NIe(Ki(),Math.abs(t)),r=Math.sign(o)*NIe(Ki(),Math.abs(o)),s;switch(e){case"workbench.parts.sidebar":s=this.workbenchGrid.getViewSize(this.sideBarPartView),this.workbenchGrid.resizeView(this.sideBarPartView,{width:s.width+n,height:s.height});break;case"workbench.parts.panel":s=this.workbenchGrid.getViewSize(this.panelPartView),this.workbenchGrid.resizeView(this.panelPartView,{width:s.width+(xh(this.getPanelPosition())?0:n),height:s.height+(xh(this.getPanelPosition())?r:0)});break;case"workbench.parts.auxiliarybar":s=this.workbenchGrid.getViewSize(this.auxiliaryBarPartView),this.workbenchGrid.resizeView(this.auxiliaryBarPartView,{width:s.width+n,height:s.height});break;case"workbench.parts.editor":if(s=this.workbenchGrid.getViewSize(this.editorPartView),this.editorGroupService.mainPart.count===1)this.workbenchGrid.resizeView(this.editorPartView,{width:s.width+n,height:s.height+r});else{let l=this.editorGroupService.mainPart.activeGroup,{width:c,height:u}=this.editorGroupService.mainPart.getSize(l);this.editorGroupService.mainPart.setSize(l,{width:c+n,height:u+r});let{width:p,height:h}=this.editorGroupService.mainPart.getSize(l);(r&&u===h||n&&c===p)&&this.workbenchGrid.resizeView(this.editorPartView,{width:s.width+(n&&c===p?n:0),height:s.height+(r&&u===h?r:0)})}break;default:return}}setActivityBarHidden(e){this.stateModel.setRuntimeValue(ho.ACTIVITYBAR_HIDDEN,e),this.workbenchGrid.setViewVisible(this.activityBarPartView,!e)}setBannerHidden(e){this.workbenchGrid.setViewVisible(this.bannerPartView,!e)}setEditorHidden(e){!e&&this.setAuxiliaryBarMaximized(!1)&&this.isVisible("workbench.parts.editor")||(this.stateModel.setRuntimeValue(ho.EDITOR_HIDDEN,e),e?this.mainContainer.classList.add("nomaineditorarea"):this.mainContainer.classList.remove("nomaineditorarea"),this.workbenchGrid.setViewVisible(this.editorPartView,!e),e&&!this.isVisible("workbench.parts.panel")&&!this.isAuxiliaryBarMaximized()&&this.setPanelHidden(!1,!0))}getLayoutClasses(){return di([this.isVisible("workbench.parts.sidebar")?void 0:"nosidebar",this.isVisible("workbench.parts.editor",ut)?void 0:"nomaineditorarea",this.isVisible("workbench.parts.panel")?void 0:"nopanel",this.isVisible("workbench.parts.auxiliarybar")?void 0:"noauxiliarybar",this.isVisible("workbench.parts.statusbar")?void 0:"nostatusbar",this.state.runtime.mainWindowFullscreen?"fullscreen":void 0,this.isShadowsDisabled()?"no-shadows":void 0])}setSideBarHidden(e){if(!(!e&&this.setAuxiliaryBarMaximized(!1)&&this.isVisible("workbench.parts.sidebar"))){if(this.stateModel.setRuntimeValue(ho.SIDEBAR_HIDDEN,e),e?this.mainContainer.classList.add("nosidebar"):this.mainContainer.classList.remove("nosidebar"),this.workbenchGrid.setViewVisible(this.sideBarPartView,!e),e&&this.paneCompositeService.getActivePaneComposite(0))this.paneCompositeService.hideActivePaneComposite(0),this.isAuxiliaryBarMaximized()||this.focusPanelOrEditor();else if(!e&&!this.paneCompositeService.getActivePaneComposite(0)){let t=this.paneCompositeService.getLastActivePaneCompositeId(0);t&&this.openViewContainer(0,t)}}}hasViews(e){let t=this.viewDescriptorService.getViewContainerById(e);if(!t)return!1;let o=this.viewDescriptorService.getViewContainerModel(t);return o?o.activeViewDescriptors.length>=1:!1}adjustPartPositions(e,t,o){let n=!xh(o),r=n||!(t==="center"||e===0&&t==="right"||e===1&&t==="left"),s=n||!(t==="center"||e===1&&t==="right"||e===0&&t==="left"),l=this.isVisible("workbench.parts.panel")?this.workbenchGrid.getViewSize(this.panelPartView).width:f0.Invisible(this.workbenchGrid.getViewCachedVisibleSize(this.panelPartView)??this.panelPartView.minimumWidth),c=this.isVisible("workbench.parts.panel")?this.workbenchGrid.getViewSize(this.panelPartView).height:f0.Invisible(this.workbenchGrid.getViewCachedVisibleSize(this.panelPartView)??this.panelPartView.minimumHeight),u=this.isVisible("workbench.parts.sidebar")?this.workbenchGrid.getViewSize(this.sideBarPartView).width:f0.Invisible(this.workbenchGrid.getViewCachedVisibleSize(this.sideBarPartView)??this.sideBarPartView.minimumWidth),p=this.isVisible("workbench.parts.auxiliarybar")?this.workbenchGrid.getViewSize(this.auxiliaryBarPartView).width:f0.Invisible(this.workbenchGrid.getViewCachedVisibleSize(this.auxiliaryBarPartView)??this.auxiliaryBarPartView.minimumWidth),h=["workbench.parts.panel","workbench.parts.sidebar","workbench.parts.auxiliarybar"].find(g=>this.hasFocus(g));e===0?(this.workbenchGrid.moveViewTo(this.activityBarPartView,[2,0]),this.workbenchGrid.moveView(this.sideBarPartView,u,r?this.editorPartView:this.activityBarPartView,r?2:3),s?this.workbenchGrid.moveView(this.auxiliaryBarPartView,p,this.editorPartView,3):this.workbenchGrid.moveViewTo(this.auxiliaryBarPartView,[2,-1])):(this.workbenchGrid.moveViewTo(this.activityBarPartView,[2,-1]),this.workbenchGrid.moveView(this.sideBarPartView,u,r?this.editorPartView:this.activityBarPartView,r?3:2),s?this.workbenchGrid.moveView(this.auxiliaryBarPartView,p,this.editorPartView,2):this.workbenchGrid.moveViewTo(this.auxiliaryBarPartView,[2,0])),h&&this.focusPart(h),n&&(this.workbenchGrid.moveView(this.panelPartView,l,this.editorPartView,o===0?2:3),this.workbenchGrid.resizeView(this.panelPartView,{height:c,width:l})),this.isVisible("workbench.parts.sidebar")&&this.workbenchGrid.resizeView(this.sideBarPartView,{height:this.workbenchGrid.getViewSize(this.sideBarPartView).height,width:u}),this.isVisible("workbench.parts.auxiliarybar")&&this.workbenchGrid.resizeView(this.auxiliaryBarPartView,{height:this.workbenchGrid.getViewSize(this.auxiliaryBarPartView).height,width:p})}setPanelAlignment(e){xh(this.getPanelPosition())||this.setPanelPosition(2),e!=="center"&&this.isPanelMaximized()&&this.toggleMaximizedPanel(),this.setAuxiliaryBarMaximized(!1),this.stateModel.setRuntimeValue(ho.PANEL_ALIGNMENT,e),this.adjustPartPositions(this.getSideBarPosition(),e,this.getPanelPosition()),this._onDidChangePanelAlignment.fire(e)}setPanelHidden(e,t){if(!this.workbenchGrid||!e&&this.setAuxiliaryBarMaximized(!1)&&this.isVisible("workbench.parts.panel"))return;let o=!this.isVisible("workbench.parts.panel"),n=this.isPanelMaximized();this.stateModel.setRuntimeValue(ho.PANEL_HIDDEN,e);let r=this.panelOpensMaximized();e?this.mainContainer.classList.add("nopanel"):this.mainContainer.classList.remove("nopanel"),e&&n&&this.toggleMaximizedPanel(),this.workbenchGrid.setViewVisible(this.panelPartView,!e);let s=!1;if(e&&this.paneCompositeService.getActivePaneComposite(1))this.paneCompositeService.hideActivePaneComposite(1),!dc&&!this.isAuxiliaryBarMaximized()&&(s=!0);else if(!e&&!this.paneCompositeService.getActivePaneComposite(1)){let l=this.paneCompositeService.getLastActivePaneCompositeId(1);(!l||!this.hasViews(l))&&(l=this.viewDescriptorService.getViewContainersByLocation(1).find(c=>this.hasViews(c.id))?.id),l&&this.openViewContainer(1,l,!t)}o!==e&&(e?this.stateModel.setRuntimeValue(ho.PANEL_WAS_LAST_MAXIMIZED,n):!t&&n!==r&&this.toggleMaximizedPanel(),s&&this.editorGroupService.mainPart.activeGroup.focus())}isAuxiliaryBarMaximized(){return this.stateModel.getRuntimeValue(ho.AUXILIARYBAR_WAS_LAST_MAXIMIZED)}toggleMaximizedAuxiliaryBar(){this.setAuxiliaryBarMaximized(!this.isAuxiliaryBarMaximized())}setAuxiliaryBarMaximized(e){if(this.inMaximizedAuxiliaryBarTransition||e===this.isAuxiliaryBarMaximized())return!1;if(e){let t={sideBarVisible:this.isVisible("workbench.parts.sidebar"),editorVisible:this.isVisible("workbench.parts.editor"),panelVisible:this.isVisible("workbench.parts.panel"),auxiliaryBarVisible:this.isVisible("workbench.parts.auxiliarybar")};this.stateModel.setRuntimeValue(ho.AUXILIARYBAR_WAS_LAST_MAXIMIZED,!0),this.inMaximizedAuxiliaryBarTransition=!0;try{t.auxiliaryBarVisible||this.setAuxiliaryBarHidden(!1);let o=this.workbenchGrid.getViewSize(this.auxiliaryBarPartView).width;this.stateModel.setRuntimeValue(ho.AUXILIARYBAR_LAST_NON_MAXIMIZED_SIZE,o),t.sideBarVisible&&this.setSideBarHidden(!0),t.panelVisible&&this.setPanelHidden(!0),t.editorVisible&&this.setEditorHidden(!0),this.stateModel.setRuntimeValue(ho.AUXILIARYBAR_LAST_NON_MAXIMIZED_VISIBILITY,t)}finally{this.inMaximizedAuxiliaryBarTransition=!1}}else{let t=Ci(this.stateModel.getRuntimeValue(ho.AUXILIARYBAR_LAST_NON_MAXIMIZED_VISIBILITY));this.stateModel.setRuntimeValue(ho.AUXILIARYBAR_WAS_LAST_MAXIMIZED,!1),this.inMaximizedAuxiliaryBarTransition=!0;try{this.setEditorHidden(!t?.editorVisible),this.setPanelHidden(!t?.panelVisible),this.setSideBarHidden(!t?.sideBarVisible);let o=this.workbenchGrid.getViewSize(this.auxiliaryBarPartView);this.workbenchGrid.resizeView(this.auxiliaryBarPartView,{width:this.stateModel.getRuntimeValue(ho.AUXILIARYBAR_LAST_NON_MAXIMIZED_SIZE),height:o.height})}finally{this.inMaximizedAuxiliaryBarTransition=!1}}return this.focusPart("workbench.parts.auxiliarybar"),this._onDidChangeAuxiliaryBarMaximized.fire(),!0}isPanelMaximized(){return(this.getPanelAlignment()==="center"||!xh(this.getPanelPosition()))&&!this.isVisible("workbench.parts.editor",ut)&&!this.isAuxiliaryBarMaximized()}toggleMaximizedPanel(){let e=this.workbenchGrid.getViewSize(this.panelPartView),t=this.getPanelPosition(),o=!this.isPanelMaximized();o?(this.isVisible("workbench.parts.panel")&&(xh(t)?this.stateModel.setRuntimeValue(ho.PANEL_LAST_NON_MAXIMIZED_HEIGHT,e.height):this.stateModel.setRuntimeValue(ho.PANEL_LAST_NON_MAXIMIZED_WIDTH,e.width)),this.setEditorHidden(!0)):(this.setEditorHidden(!1),this.workbenchGrid.resizeView(this.panelPartView,{width:xh(t)?e.width:this.stateModel.getRuntimeValue(ho.PANEL_LAST_NON_MAXIMIZED_WIDTH),height:xh(t)?this.stateModel.getRuntimeValue(ho.PANEL_LAST_NON_MAXIMIZED_HEIGHT):e.height})),this.stateModel.setRuntimeValue(ho.PANEL_WAS_LAST_MAXIMIZED,o)}panelOpensMaximized(){if(this.getPanelAlignment()!=="center"&&xh(this.getPanelPosition()))return!1;let e=aio(this.configurationService.getValue("workbench.panel.opensMaximized")),t=this.stateModel.getRuntimeValue(ho.PANEL_WAS_LAST_MAXIMIZED);return e===0||e===2&&t}setAuxiliaryBarHidden(e,t){if(!(e&&this.setAuxiliaryBarMaximized(!1)&&!this.isVisible("workbench.parts.auxiliarybar"))){if(this.stateModel.setRuntimeValue(ho.AUXILIARYBAR_HIDDEN,e),e?this.mainContainer.classList.add("noauxiliarybar"):this.mainContainer.classList.remove("noauxiliarybar"),this.workbenchGrid.setViewVisible(this.auxiliaryBarPartView,!e),e&&this.paneCompositeService.getActivePaneComposite(2))this.paneCompositeService.hideActivePaneComposite(2),this.focusPanelOrEditor();else if(!e&&!this.paneCompositeService.getActivePaneComposite(2)){let o=this.paneCompositeService.getLastActivePaneCompositeId(2);(!o||!this.hasViews(o))&&(o=this.viewDescriptorService.getViewContainersByLocation(2).find(n=>this.hasViews(n.id))?.id),o&&this.openViewContainer(2,o,!t)}}}setPartHidden(e,t){switch(t){case"workbench.parts.activitybar":return this.setActivityBarHidden(e);case"workbench.parts.sidebar":return this.setSideBarHidden(e);case"workbench.parts.editor":return this.setEditorHidden(e);case"workbench.parts.banner":return this.setBannerHidden(e);case"workbench.parts.auxiliarybar":return this.setAuxiliaryBarHidden(e);case"workbench.parts.panel":return this.setPanelHidden(e)}}hasMainWindowBorder(){return this.state.runtime.mainWindowBorder}getMainWindowBorderRadius(){return this.state.runtime.mainWindowBorder&&Ze?"10px":void 0}getSideBarPosition(){return this.stateModel.getRuntimeValue(ho.SIDEBAR_POSITON)}getPanelAlignment(){return this.stateModel.getRuntimeValue(ho.PANEL_ALIGNMENT)}updateMenubarVisibility(e){let t=MB(this.configurationService,ut,this.state.runtime.menuBar.toggled);!e&&this.workbenchGrid&&t!==this.isVisible("workbench.parts.titlebar",ut)&&this.workbenchGrid.setViewVisible(this.titleBarPartView,t)}updateCustomTitleBarVisibility(){let e=MB(this.configurationService,ut,this.state.runtime.menuBar.toggled),t=this.isVisible("workbench.parts.titlebar");e!==t&&this.workbenchGrid.setViewVisible(this.titleBarPartView,e)}toggleMenuBar(){let e=uR(this.configurationService);typeof e!="string"&&(e="classic");let t;e==="visible"||e==="classic"?t=$O(this.configurationService)?"toggle":"compact":t="classic",this.configurationService.updateValue("window.menuBarVisibility",t)}getPanelPosition(){return this.stateModel.getRuntimeValue(ho.PANEL_POSITION)}setPanelPosition(e){this.isVisible("workbench.parts.panel")||this.setPanelHidden(!1);let t=this.getPart("workbench.parts.panel"),o=jC(this.getPanelPosition()),n=jC(e),r=Ci(t.getContainer());r.classList.remove(o),r.classList.add(n),t.updateStyles();let s=this.workbenchGrid.getViewSize(this.panelPartView),l=this.workbenchGrid.getViewSize(this.sideBarPartView),c=this.workbenchGrid.getViewSize(this.auxiliaryBarPartView),u=!this.isVisible("workbench.parts.editor",ut);n!==o&&!u&&(xh(e)?this.stateModel.setRuntimeValue(ho.PANEL_LAST_NON_MAXIMIZED_WIDTH,s.width):xh(bue(o))&&this.stateModel.setRuntimeValue(ho.PANEL_LAST_NON_MAXIMIZED_HEIGHT,s.height)),xh(e)&&this.getPanelAlignment()!=="center"&&u&&(this.toggleMaximizedPanel(),u=!1),this.stateModel.setRuntimeValue(ho.PANEL_POSITION,e);let p=this.isVisible("workbench.parts.sidebar"),h=this.isVisible("workbench.parts.auxiliarybar"),g=this.hasFocus("workbench.parts.panel");e===2?this.workbenchGrid.moveView(this.panelPartView,u?s.height:this.stateModel.getRuntimeValue(ho.PANEL_LAST_NON_MAXIMIZED_HEIGHT),this.editorPartView,1):e===3?this.workbenchGrid.moveView(this.panelPartView,u?s.height:this.stateModel.getRuntimeValue(ho.PANEL_LAST_NON_MAXIMIZED_HEIGHT),this.editorPartView,0):e===1?this.workbenchGrid.moveView(this.panelPartView,u?s.width:this.stateModel.getRuntimeValue(ho.PANEL_LAST_NON_MAXIMIZED_WIDTH),this.editorPartView,3):this.workbenchGrid.moveView(this.panelPartView,u?s.width:this.stateModel.getRuntimeValue(ho.PANEL_LAST_NON_MAXIMIZED_WIDTH),this.editorPartView,2),g&&this.focusPart("workbench.parts.panel"),this.workbenchGrid.resizeView(this.sideBarPartView,l),p||this.setSideBarHidden(!0),this.workbenchGrid.resizeView(this.auxiliaryBarPartView,c),h||this.setAuxiliaryBarHidden(!0),xh(e)&&this.adjustPartPositions(this.getSideBarPosition(),this.getPanelAlignment(),e),this._onDidChangePanelPosition.fire(n)}isWindowMaximized(e){return this.state.runtime.maximized.has(gv(e))}updateWindowMaximizedState(e,t){this.mainContainer.classList.toggle("maximized",t);let o=gv(e);t!==this.state.runtime.maximized.has(o)&&(t?this.state.runtime.maximized.add(o):this.state.runtime.maximized.delete(o),this.updateWindowBorder(),this._onDidChangeWindowMaximized.fire({windowId:o,maximized:t}))}getVisibleNeighborPart(e,t){if(!this.workbenchGrid||!this.isVisible(e,ut))return;let o=this.workbenchGrid.getNeighborViews(this.getPart(e),t,!1);if(o)for(let n of o){let r=["workbench.parts.activitybar","workbench.parts.editor","workbench.parts.panel","workbench.parts.auxiliarybar","workbench.parts.sidebar","workbench.parts.statusbar","workbench.parts.titlebar"].find(s=>this.getPart(s)===n&&this.isVisible(s,ut));if(r!==void 0)return r}}onDidChangeWCO(){let e=this.workbenchGrid.getNeighborViews(this.titleBarPartView,0,!1).length>0,t=this.shouldShowBannerFirst();e!==t&&this.workbenchGrid.moveView(this.bannerPartView,f0.Distribute,this.titleBarPartView,t?0:1),this.workbenchGrid.setViewVisible(this.titleBarPartView,MB(this.configurationService,ut,this.state.runtime.menuBar.toggled))}arrangeEditorNodes(e,t,o){if(!e.sideBar&&!e.auxiliaryBar)return e.editor.size=t,e.editor;let n=[e.editor];return e.editor.size=o,e.sideBar&&(this.stateModel.getRuntimeValue(ho.SIDEBAR_POSITON)===0?n.splice(0,0,e.sideBar):n.push(e.sideBar),e.editor.size-=this.stateModel.getRuntimeValue(ho.SIDEBAR_HIDDEN)?0:e.sideBar.size),e.auxiliaryBar&&(this.stateModel.getRuntimeValue(ho.SIDEBAR_POSITON)===1?n.splice(0,0,e.auxiliaryBar):n.push(e.auxiliaryBar),e.editor.size-=this.stateModel.getRuntimeValue(ho.AUXILIARYBAR_HIDDEN)?0:e.auxiliaryBar.size),{type:"branch",data:n,size:t,visible:n.some(r=>r.visible)}}arrangeMiddleSectionNodes(e,t,o){let n=this.stateModel.getRuntimeValue(ho.ACTIVITYBAR_HIDDEN)?0:e.activityBar.size,r=this.stateModel.getRuntimeValue(ho.SIDEBAR_HIDDEN)?0:e.sideBar.size,s=this.stateModel.getRuntimeValue(ho.AUXILIARYBAR_HIDDEN)?0:e.auxiliaryBar.size,l=this.stateModel.getInitializationValue(ho.PANEL_SIZE)?0:e.panel.size,c=this.stateModel.getRuntimeValue(ho.PANEL_POSITION),u=this.stateModel.getRuntimeValue(ho.SIDEBAR_POSITON),p=[];if(!xh(c))p.push(e.editor),e.editor.size=t-n-r-l-s,c===1?p.push(e.panel):p.splice(0,0,e.panel),u===0?(p.push(e.auxiliaryBar),p.splice(0,0,e.sideBar),p.splice(0,0,e.activityBar)):(p.splice(0,0,e.auxiliaryBar),p.push(e.sideBar),p.push(e.activityBar));else{let h=this.stateModel.getRuntimeValue(ho.PANEL_ALIGNMENT),g=!(h==="center"||u===0&&h==="right"||u===1&&h==="left"),f=!(h==="center"||u===1&&h==="right"||u===0&&h==="left"),v=t-n-(g?0:r)-(f?0:s),b=this.arrangeEditorNodes({editor:e.editor,sideBar:g?e.sideBar:void 0,auxiliaryBar:f?e.auxiliaryBar:void 0},o-l,v),S=c===2?[b,e.panel]:[e.panel,b];p.push({type:"branch",data:S,size:v,visible:S.some(y=>y.visible)}),g||(u===0?p.splice(0,0,e.sideBar):p.push(e.sideBar)),f||(u===1?p.splice(0,0,e.auxiliaryBar):p.push(e.auxiliaryBar)),u===0?p.splice(0,0,e.activityBar):p.push(e.activityBar)}return p}createGridDescriptor(){let{width:e,height:t}=this._mainContainerDimension,o=this.stateModel.getInitializationValue(ho.SIDEBAR_SIZE),n=this.stateModel.getInitializationValue(ho.AUXILIARYBAR_SIZE),r=this.stateModel.getInitializationValue(ho.PANEL_SIZE),s=this.titleBarPartView.minimumHeight,l=this.bannerPartView.minimumHeight,c=this.statusBarPartView.minimumHeight,u=this.activityBarPartView.minimumWidth,p=t-s-c,h=[{type:"leaf",data:{type:"workbench.parts.titlebar"},size:s,visible:this.isVisible("workbench.parts.titlebar",ut)},{type:"leaf",data:{type:"workbench.parts.banner"},size:l,visible:!1}],g={type:"leaf",data:{type:"workbench.parts.activitybar"},size:u,visible:!this.stateModel.getRuntimeValue(ho.ACTIVITYBAR_HIDDEN)},f={type:"leaf",data:{type:"workbench.parts.sidebar"},size:o,visible:!this.stateModel.getRuntimeValue(ho.SIDEBAR_HIDDEN)},v={type:"leaf",data:{type:"workbench.parts.auxiliarybar"},size:n,visible:this.isVisible("workbench.parts.auxiliarybar")},b={type:"leaf",data:{type:"workbench.parts.editor"},size:0,visible:!this.stateModel.getRuntimeValue(ho.EDITOR_HIDDEN)},S={type:"leaf",data:{type:"workbench.parts.panel"},size:r,visible:!this.stateModel.getRuntimeValue(ho.PANEL_HIDDEN)},y=this.arrangeMiddleSectionNodes({activityBar:g,auxiliaryBar:v,editor:b,panel:S,sideBar:f},e,p),w={root:{type:"branch",size:e,data:[...this.shouldShowBannerFirst()?h.reverse():h,{type:"branch",data:y,size:p},{type:"leaf",data:{type:"workbench.parts.statusbar"},size:c,visible:!this.stateModel.getRuntimeValue(ho.STATUSBAR_HIDDEN)}]},orientation:0,width:e,height:t},k={activityBarVisible:!this.stateModel.getRuntimeValue(ho.ACTIVITYBAR_HIDDEN),sideBarVisible:!this.stateModel.getRuntimeValue(ho.SIDEBAR_HIDDEN),auxiliaryBarVisible:!this.stateModel.getRuntimeValue(ho.AUXILIARYBAR_HIDDEN),panelVisible:!this.stateModel.getRuntimeValue(ho.PANEL_HIDDEN),statusbarVisible:!this.stateModel.getRuntimeValue(ho.STATUSBAR_HIDDEN),sideBarPosition:jC(this.stateModel.getRuntimeValue(ho.SIDEBAR_POSITON)),panelPosition:jC(this.stateModel.getRuntimeValue(ho.PANEL_POSITION))};return this.telemetryService.publicLog2("startupLayout",k),w}dispose(){super.dispose(),this.disposed=!0}};function DPo(a){return a.getValue("zenMode")}var E9t=class{constructor(i,e,t,o){this.name=i;this.scope=e;this.target=t;this.defaultValue=o}},VS=class extends E9t{constructor(e,t,o,n,r){super(e,t,o,n);this.zenModeIgnore=r;this.runtime=!0}},E2e=class extends E9t{constructor(){super(...arguments);this.runtime=!1}},ho={MAIN_EDITOR_CENTERED:new VS("editor.centered",1,1,!1),ZEN_MODE_ACTIVE:new VS("zenMode.active",1,1,!1),ZEN_MODE_EXIT_INFO:new VS("zenMode.exitInfo",1,1,{transitionedToCenteredEditorLayout:!1,transitionedToFullScreen:!1,handleNotificationsDoNotDisturbMode:!1,wasVisible:{auxiliaryBar:!1,panel:!1,sideBar:!1}}),SIDEBAR_SIZE:new E2e("sideBar.size",0,1,300),AUXILIARYBAR_SIZE:new E2e("auxiliaryBar.size",0,1,300),PANEL_SIZE:new E2e("panel.size",0,1,300),PANEL_LAST_NON_MAXIMIZED_HEIGHT:new VS("panel.lastNonMaximizedHeight",0,1,300),PANEL_LAST_NON_MAXIMIZED_WIDTH:new VS("panel.lastNonMaximizedWidth",0,1,300),PANEL_WAS_LAST_MAXIMIZED:new VS("panel.wasLastMaximized",1,1,!1),AUXILIARYBAR_WAS_LAST_MAXIMIZED:new VS("auxiliaryBar.wasLastMaximized",1,1,!1),AUXILIARYBAR_LAST_NON_MAXIMIZED_SIZE:new VS("auxiliaryBar.lastNonMaximizedSize",0,1,300),AUXILIARYBAR_LAST_NON_MAXIMIZED_VISIBILITY:new VS("auxiliaryBar.lastNonMaximizedVisibility",1,1,{sideBarVisible:!1,editorVisible:!1,panelVisible:!1,auxiliaryBarVisible:!1}),AUXILIARYBAR_EMPTY:new E2e("auxiliaryBar.empty",0,1,!1),SIDEBAR_POSITON:new VS("sideBar.position",1,1,0),PANEL_POSITION:new VS("panel.position",1,1,2),PANEL_ALIGNMENT:new VS("panel.alignment",0,0,"center"),ACTIVITYBAR_HIDDEN:new VS("activityBar.hidden",1,1,!1,!0),SIDEBAR_HIDDEN:new VS("sideBar.hidden",1,1,!1),EDITOR_HIDDEN:new VS("editor.hidden",1,1,!1),PANEL_HIDDEN:new VS("panel.hidden",1,1,!0),AUXILIARYBAR_HIDDEN:new VS("auxiliaryBar.hidden",1,1,!0),STATUSBAR_HIDDEN:new VS("statusBar.hidden",1,1,!1,!0)};var V1i=class a extends x{constructor(e,t,o,n){super();this.storageService=e;this.configurationService=t;this.contextService=o;this.environmentService=n;this._onDidChangeState=this._register(new E);this.onDidChangeState=this._onDidChangeState.event;this.stateCache=new Map;this.isNew={1:this.storageService.isNew(1),0:this.storageService.isNew(0),[-1]:this.storageService.isNew(-1)},this._register(this.configurationService.onDidChangeConfiguration(r=>this.updateStateFromLegacySettings(r)))}static{this.STORAGE_PREFIX="workbench."}updateStateFromLegacySettings(e){e.affectsConfiguration("workbench.activityBar.location")&&this.setRuntimeValueAndFire(ho.ACTIVITYBAR_HIDDEN,this.isActivityBarHidden()),e.affectsConfiguration("workbench.statusBar.visible")&&this.setRuntimeValueAndFire(ho.STATUSBAR_HIDDEN,!this.configurationService.getValue("workbench.statusBar.visible")),e.affectsConfiguration("workbench.sideBar.location")&&this.setRuntimeValueAndFire(ho.SIDEBAR_POSITON,bue(this.configurationService.getValue("workbench.sideBar.location")??"left"))}updateLegacySettingsFromState(e,t){let o=this.getRuntimeValue(ho.ZEN_MODE_ACTIVE);e.zenModeIgnore&&o||(e===ho.ACTIVITYBAR_HIDDEN?this.configurationService.updateValue("workbench.activityBar.location",t?"hidden":void 0):e===ho.STATUSBAR_HIDDEN?this.configurationService.updateValue("workbench.statusBar.visible",!t):e===ho.SIDEBAR_POSITON&&this.configurationService.updateValue("workbench.sideBar.location",jC(t)))}load(e){let t;if(!e.resetLayout)for(t in ho){let s=ho[t],l=this.loadKeyFromStorage(s);l!==void 0&&this.stateCache.set(s.name,l)}this.stateCache.set(ho.ACTIVITYBAR_HIDDEN.name,this.isActivityBarHidden()),this.stateCache.set(ho.STATUSBAR_HIDDEN.name,!this.configurationService.getValue("workbench.statusBar.visible")),this.stateCache.set(ho.SIDEBAR_POSITON.name,bue(this.configurationService.getValue("workbench.sideBar.location")??"left"));let o=this.configurationService.getValue("workbench.secondarySideBar.forceMaximized"),n=this.contextService.getWorkbenchState(),r=e.mainContainerDimension;ho.SIDEBAR_SIZE.defaultValue=Math.min(300,r.width/4),ho.SIDEBAR_HIDDEN.defaultValue=n===1||o===!0,ho.AUXILIARYBAR_SIZE.defaultValue=o?Math.max(300,r.width/2):Math.min(300,r.width/4),ho.AUXILIARYBAR_HIDDEN.defaultValue=(()=>{if(Wt&&!this.environmentService.remoteAuthority)return!0;if(o===!0)return!1;let s=this.configurationService.inspect("workbench.secondarySideBar.defaultVisibility");if(s.defaultValue!=="hidden"&&!Rae(s)&&this.stateCache.get(ho.AUXILIARYBAR_EMPTY.name))return!0;if(this.isNew[-1]&&s.value!=="hidden")return!1;switch(s.value){case"hidden":return!0;case"visibleInWorkspace":case"maximizedInWorkspace":return n===1;default:return!1}})(),ho.PANEL_SIZE.defaultValue=this.stateCache.get(ho.PANEL_POSITION.name)??xh(ho.PANEL_POSITION.defaultValue)?r.height/3:r.width/4,ho.PANEL_POSITION.defaultValue=bue(this.configurationService.getValue("workbench.panel.defaultLocation")??"bottom");for(t in ho){let s=ho[t];this.stateCache.get(s.name)===void 0&&this.stateCache.set(s.name,s.defaultValue)}this.applyOverrides(e),this._register(this.storageService.onDidChangeValue(0,void 0,this._store)(s=>{let l;for(l in ho){let c=ho[l];if(c instanceof VS&&c.scope===0&&c.target===0&&`${a.STORAGE_PREFIX}${c.name}`===s.key){let u=this.loadKeyFromStorage(c)??c.defaultValue;this.stateCache.get(c.name)!==u&&(this.stateCache.set(c.name,u),this._onDidChangeState.fire({key:c,value:u}))}}}))}applyOverrides(e){if(this.isNew[1]){let t=this.configurationService.getValue("workbench.secondarySideBar.defaultVisibility");this.configurationService.getValue("workbench.startupEditor")==="agentSessionsWelcomePage"?this.applyAuxiliaryBarHiddenOverride(!0):(t==="maximized"||t==="maximizedInWorkspace"&&this.contextService.getWorkbenchState()!==1)&&this.applyAuxiliaryBarMaximizedOverride()}this.getRuntimeValue(ho.PANEL_HIDDEN)&&this.getRuntimeValue(ho.EDITOR_HIDDEN)&&!this.getRuntimeValue(ho.AUXILIARYBAR_WAS_LAST_MAXIMIZED)&&this.setRuntimeValue(ho.EDITOR_HIDDEN,!1),this.isNew[1]&&e.mainContainerDimension.width<=W1i.width&&(this.setInitializationValue(ho.SIDEBAR_SIZE,Math.min(300,e.mainContainerDimension.width/4)),this.setInitializationValue(ho.AUXILIARYBAR_SIZE,Math.min(300,e.mainContainerDimension.width/4)))}applyAuxiliaryBarMaximizedOverride(){this.setRuntimeValue(ho.AUXILIARYBAR_LAST_NON_MAXIMIZED_VISIBILITY,{sideBarVisible:!this.getRuntimeValue(ho.SIDEBAR_HIDDEN),panelVisible:!this.getRuntimeValue(ho.PANEL_HIDDEN),editorVisible:!this.getRuntimeValue(ho.EDITOR_HIDDEN),auxiliaryBarVisible:!this.getRuntimeValue(ho.AUXILIARYBAR_HIDDEN)}),this.setRuntimeValue(ho.SIDEBAR_HIDDEN,!0),this.setRuntimeValue(ho.PANEL_HIDDEN,!0),this.setRuntimeValue(ho.EDITOR_HIDDEN,!0),this.setRuntimeValue(ho.AUXILIARYBAR_HIDDEN,!1),this.setRuntimeValue(ho.AUXILIARYBAR_LAST_NON_MAXIMIZED_SIZE,this.getInitializationValue(ho.AUXILIARYBAR_SIZE)),this.setRuntimeValue(ho.AUXILIARYBAR_WAS_LAST_MAXIMIZED,!0)}applyAuxiliaryBarHiddenOverride(e){this.setRuntimeValue(ho.AUXILIARYBAR_HIDDEN,e)}save(e,t){let o,n=this.getRuntimeValue(ho.ZEN_MODE_ACTIVE);for(o in ho){let r=ho[o];if(e&&r.scope===1||t&&r.scope===0){if(n&&r instanceof VS&&r.zenModeIgnore)continue;this.saveKeyToStorage(r)}}}getInitializationValue(e){return this.stateCache.get(e.name)}setInitializationValue(e,t){this.stateCache.set(e.name,t)}getRuntimeValue(e,t){if(t)switch(e){case ho.ACTIVITYBAR_HIDDEN:this.stateCache.set(e.name,this.isActivityBarHidden());break;case ho.STATUSBAR_HIDDEN:this.stateCache.set(e.name,!this.configurationService.getValue("workbench.statusBar.visible"));break;case ho.SIDEBAR_POSITON:this.stateCache.set(e.name,this.configurationService.getValue("workbench.sideBar.location")??"left");break}return this.stateCache.get(e.name)}setRuntimeValue(e,t){this.stateCache.set(e.name,t);let o=this.getRuntimeValue(ho.ZEN_MODE_ACTIVE);e.scope===0&&(!o||!e.zenModeIgnore)&&(this.saveKeyToStorage(e),this.updateLegacySettingsFromState(e,t))}isActivityBarHidden(){let e=this.configurationService.getValue("workbench.activityBar.visible");return e!==void 0?!e:this.configurationService.getValue("workbench.activityBar.location")!=="default"}setRuntimeValueAndFire(e,t){this.stateCache.get(e.name)!==t&&(this.setRuntimeValue(e,t),this._onDidChangeState.fire({key:e,value:t}))}saveKeyToStorage(e){let t=this.stateCache.get(e.name);this.storageService.store(`${a.STORAGE_PREFIX}${e.name}`,typeof t=="object"?JSON.stringify(t):t,e.scope,e.target)}loadKeyFromStorage(e){let t=this.storageService.get(`${a.STORAGE_PREFIX}${e.name}`,e.scope);if(t!==void 0)switch(this.isNew[e.scope]=!1,typeof e.defaultValue){case"boolean":return t==="true";case"number":return parseInt(t);case"object":return JSON.parse(t)}return t}};var T9t=class{constructor(){this.priority=90;this.name="notifications";this.when=oD;this.type="view"}getProvider(i){let e=i.get(ou),t=i.get(Io),o=i.get(ge),n=i.get(lr);function r(){let s=jre(t);if(!s)return;o.executeCommand("notifications.showList");let l,c=t.lastFocusedList;if(c instanceof Vl&&(l=c.indexOf(s)),l===void 0)return;function u(){if(o.executeCommand("notifications.showList"),c&&l!==void 0){c.domFocus();try{c.setFocus([l])}catch{}}}function p(){let g=jre(t),f=g?.message.original.toString();if(!(!g||!f))return U7(g.source?d(4353,null,f,g.source):f,g.severity)}let h=p();if(h)return s.onDidClose(()=>e.next()),new xp("notification",{type:"view"},()=>h,()=>u(),"accessibility.verbosity.notification",void 0,VIn(s,n),()=>{if(c)return u(),c.focusNext(),p()},()=>{if(c)return u(),c.focusPrevious(),p()})}return r()}};function VIn(a,i){let e;if(a.actions&&(e=[],a.actions.primary&&e.push(...a.actions.primary),a.actions.secondary&&e.push(...a.actions.secondary)),e)for(let o of e){o.class=q.asClassName(R.bell);let n=o.run;o.run=()=>{n(),a.close()}}let t=e?.find(o=>o.label.includes("Manage Extension"));return t&&(t.class=q.asClassName(R.gear)),e&&e.push({id:"clearNotification",label:d(4352,null),tooltip:d(4352,null),run:()=>{a.close(),i.playSignal($o.clear)},enabled:!0,class:q.asClassName(R.clearAll)}),e}var n9=class{constructor(i,e){this._configurationService=i;this._languageService=e}static{this._ttpTokenizer=pf("tokenizeToString",{createHTML(i){return i}})}async renderCodeBlock(i,e,t){let o=pn(t.context)?t.context:void 0,n;i?n=this._languageService.getLanguageIdByLanguageName(i):o&&(n=o.getModel()?.getLanguageId()),n||(n=$r);let r=await fz(this._languageService,e,n),s=n9._ttpTokenizer?n9._ttpTokenizer.createHTML(r)??r:r,l=document.createElement("span");l.innerHTML=s;let c=l.querySelector(".monaco-tokenized-source");return Do(c)?(Jd(c,this.getFontInfo(o)),l):document.createElement("span")}getFontInfo(i){return i?i.getOption(59):QS({fontFamily:this._configurationService.getValue("editor").fontFamily},1)}};n9=I([m(0,B),m(1,_t)],n9);var _9t=class extends k9t{constructor(e,t,o,n){super(e,{resetLayout:!!t?.resetLayout});this.options=t;this.serviceCollection=o;this._onWillShutdown=this._register(new E);this.onWillShutdown=this._onWillShutdown.event;this._onDidShutdown=this._register(new E);this.onDidShutdown=this._onDidShutdown.event;this.previousUnexpectedError={message:void 0,time:0};Mo("code/willStartWorkbench"),this.registerErrorHandler(n)}registerErrorHandler(e){Ac||(Error.stackTraceLimit=100),ut.addEventListener("unhandledrejection",t=>{mt(t.reason),t.preventDefault()}),I2i(t=>this.handleUnexpectedError(t,e))}handleUnexpectedError(e,t){let o=xn(e,!0);if(!o)return;let n=Date.now();o===this.previousUnexpectedError.message&&n-this.previousUnexpectedError.time<=1e3||(this.previousUnexpectedError.time=n,this.previousUnexpectedError.message=o,t.error(o))}startup(){try{this._register(nGi(175));let e=this.initServices(this.serviceCollection);return e.invokeFunction(t=>{let o=t.get(ji),n=t.get(ce),r=t.get(B),s=t.get(Zt),l=t.get(nt),c=t.get(at),u=t.get(Ne);t.get(On).setDefaultCodeBlockRenderer(e.createInstance(n9)),Z8i((h,g)=>e.createInstance(mf,h,{instantHover:g},{})),l6i(l),this.initLayout(t),ne.as(Qi.Workbench).start(t),ne.as(qo.EditorFactory).start(t),this._register(e.createInstance(k2e)),this.registerListeners(o,n,r,s,c),this.renderWorkbench(e,u,n,r),this.createWorkbenchLayout(),this.layout(),this.restore(o)}),e}catch(e){throw mt(e),e}}initServices(e){e.set(yi,this);let t=Y$i();for(let[n,r]of t)e.set(n,r);let o=new dPe(e,!0);return o.invokeFunction(n=>{let r=n.get(ji),s=n.get(B);s&&"acquireInstantiationService"in s&&s.acquireInstantiationService(o),r.phase=2}),o}registerListeners(e,t,o,n,r){this._register(o.onDidChangeConfiguration(s=>this.updateFontAliasing(s,o))),Vr?this._register(t.onWillSaveState(s=>{s.reason===1&&this.storeFontInfo(t)})):this._register(e.onWillShutdown(()=>this.storeFontInfo(t))),this._register(e.onWillShutdown(s=>this._onWillShutdown.fire(s))),this._register(e.onDidShutdown(()=>{this._onDidShutdown.fire(),this.dispose()})),this._register(n.onDidChangeFocus(s=>{s||t.flush()})),this._register(r.onWillShowDialog(()=>this.mainContainer.classList.add("modal-dialog-visible"))),this._register(r.onDidShowDialog(()=>this.mainContainer.classList.remove("modal-dialog-visible")))}updateFontAliasing(e,t){if(!Ze||e&&!e.affectsConfiguration("workbench.fontAliasing"))return;let o=t.getValue("workbench.fontAliasing");if(this.fontAliasing===o)return;this.fontAliasing=o;let n=["antialiased","none","auto"];this.mainContainer.classList.remove(...n.map(r=>`monaco-font-aliasing-${r}`)),n.some(r=>r===o)&&this.mainContainer.classList.add(`monaco-font-aliasing-${o}`)}restoreFontInfo(e,t){let o=e.get("editorFontInfo",-1);if(o)try{let n=JSON.parse(o);Array.isArray(n)&&iw.restoreFontInfo(ut,n)}catch{}iw.readFontInfo(ut,QS(t.getValue("editor"),bu.getInstance(ut).value))}storeFontInfo(e){let t=iw.serializeFontInfo(ut);t&&e.store("editorFontInfo",JSON.stringify(t),-1,1)}renderWorkbench(e,t,o,n){l$i(this.mainContainer),yro((l,c)=>e.createInstance(Eoe,l,c));let s=di(["monaco-workbench",ei?"windows":fn?"linux":"mac",Wt?"web":void 0,p1?"chromium":Ac?"firefox":Jb?"safari":void 0,...this.getLayoutClasses(),...this.options?.extraClasses?this.options.extraClasses:[]]);this.mainContainer.classList.add(...s),this.updateFontAliasing(void 0,n),this.restoreFontInfo(o,n);for(let{id:l,role:c,classes:u,options:p}of[{id:"workbench.parts.titlebar",role:"none",classes:["titlebar"]},{id:"workbench.parts.banner",role:"banner",classes:["banner"]},{id:"workbench.parts.activitybar",role:"none",classes:["activitybar",this.getSideBarPosition()===0?"left":"right"]},{id:"workbench.parts.sidebar",role:"none",classes:["sidebar",this.getSideBarPosition()===0?"left":"right"]},{id:"workbench.parts.editor",role:"main",classes:["editor"],options:{restorePreviousState:this.willRestoreEditors()}},{id:"workbench.parts.panel",role:"none",classes:["panel","basepanel",jC(this.getPanelPosition())]},{id:"workbench.parts.auxiliarybar",role:"none",classes:["auxiliarybar","basepanel",this.getSideBarPosition()===0?"right":"left"]},{id:"workbench.parts.statusbar",role:"status",classes:["statusbar"]}]){let h=this.createPart(l,c,u);Mo(`code/willCreatePart/${l}`),this.getPart(l).create(h,p),Mo(`code/didCreatePart/${l}`)}this.createNotificationsHandlers(e,t),this.parent.appendChild(this.mainContainer)}createPart(e,t,o){let n=document.createElement(t==="status"?"footer":"div");return n.classList.add("part",...o),n.id=e,n.setAttribute("role",t),t==="status"&&n.setAttribute("aria-live","off"),n}createNotificationsHandlers(e,t){let o=this._register(e.createInstance(XU,this.mainContainer,t.model)),n=this._register(e.createInstance(iV,this.mainContainer,t.model));this._register(e.createInstance(x9t,t.model));let r=e.createInstance(x2e,t.model);this._register(o.onDidChangeVisibility(()=>{r.update(o.isVisible,n.isVisible),n.update(o.isVisible)})),this._register(n.onDidChangeVisibility(()=>{r.update(o.isVisible,n.isVisible)})),yPo(o,n,t.model),ga.register(new T9t),this.registerNotifications({onDidChangeNotificationsVisibility:U.map(U.any(n.onDidChangeVisibility,o.onDidChangeVisibility),()=>n.isVisible||o.isVisible)})}restore(e){try{this.restoreParts()}catch(t){mt(t)}this.whenReady.finally(()=>Promise.race([this.whenRestored,Li(2e3)]).finally(()=>{function t(){Mo("code/didStartWorkbench"),performance.measure("perf: workbench create & restore","code/didLoadWorkbenchMain","code/didStartWorkbench")}this.isRestored()?t():this.whenRestored.finally(()=>t()),e.phase=3,this._register(new Dt(()=>{this._register(rf(ut,()=>e.phase=4,2500))},2500)).schedule()}))}};var T2e=globalThis.vscode,tl=T2e.ipcRenderer,RPo=T2e.ipcMessagePort,MPo=T2e.webFrame,eP=T2e.process,ZWS=T2e.context,eVS=T2e.webUtils;var But=8,Hut=-8;function t$(a,i){a=Math.min(Math.max(a,Hut),But);let e=[];i===1?e.push(Ki()):i===2?e.push(...Array.from(SC()).map(({window:t})=>t)):e.push(i);for(let t of e)BIn(t)?.webFrame?.setZoomLevel(a),dGi(lce(a),t),cGi(a,t)}function BIn(a){if(a===ut)return{ipcRenderer:tl,webFrame:MPo};{let i=a;if(i?.vscode?.ipcRenderer&&i?.vscode?.webFrame)return i.vscode}}var _2e=le("integrityService");var zr=Eo,rh=class extends Eu{constructor(e,t){super(e,{homeDir:e.homeDir,tmpDir:e.tmpDir,userDataDir:e.userDataDir},t);this.configuration=e}get mainPid(){return this.configuration.mainPid}get machineId(){return this.configuration.machineId}get sqmId(){return this.configuration.sqmId}get devDeviceId(){return this.configuration.devDeviceId}get isPortable(){return this.configuration.isPortable}get remoteAuthority(){return this.configuration.remoteAuthority}get expectsResolverExtension(){return!!this.configuration.remoteAuthority?.includes("+")}get execPath(){return this.configuration.execPath}get backupPath(){return this.configuration.backupPath}get window(){return{id:this.configuration.windowId,handle:this.configuration.handle,colorScheme:this.configuration.colorScheme,maximized:this.configuration.maximized,accessibilitySupport:this.configuration.accessibilitySupport,perfMarks:this.configuration.perfMarks,isInitialStartup:this.configuration.isInitialStartup,isCodeCaching:typeof this.configuration.codeCachePath=="string"}}get windowLogsPath(){return Ge(this.logsHome,`window${this.configuration.windowId}`)}get logFile(){return Ge(this.windowLogsPath,"renderer.log")}get extHostLogsPath(){return Ge(this.windowLogsPath,"exthost")}get webviewExternalEndpoint(){return`${Q.vscodeWebview}://{{uuid}}`}get skipReleaseNotes(){return!!this.args["skip-release-notes"]}get skipWelcome(){return!!this.args["skip-welcome"]}get logExtensionHostCommunication(){return!!this.args.logExtensionHostCommunication}get enableSmokeTestDriver(){return!!this.args["enable-smoke-test-driver"]}get extensionEnabledProposedApi(){if(Array.isArray(this.args["enable-proposed-api"]))return this.args["enable-proposed-api"];if("enable-proposed-api"in this.args)return[]}get os(){return this.configuration.os}get filesToOpenOrCreate(){return this.configuration.filesToOpenOrCreate}get filesToDiff(){return this.configuration.filesToDiff}get filesToMerge(){return this.configuration.filesToMerge}get filesToWait(){return this.configuration.filesToWait}get isSessionsWindow(){return!!this.configuration.isSessionsWindow}get agentPluginsHome(){return A.file(this.agentPluginsPath)}};I([hi],rh.prototype,"mainPid",1),I([hi],rh.prototype,"machineId",1),I([hi],rh.prototype,"sqmId",1),I([hi],rh.prototype,"devDeviceId",1),I([hi],rh.prototype,"isPortable",1),I([hi],rh.prototype,"remoteAuthority",1),I([hi],rh.prototype,"expectsResolverExtension",1),I([hi],rh.prototype,"execPath",1),I([hi],rh.prototype,"backupPath",1),I([hi],rh.prototype,"window",1),I([hi],rh.prototype,"windowLogsPath",1),I([hi],rh.prototype,"logFile",1),I([hi],rh.prototype,"extHostLogsPath",1),I([hi],rh.prototype,"webviewExternalEndpoint",1),I([hi],rh.prototype,"skipReleaseNotes",1),I([hi],rh.prototype,"skipWelcome",1),I([hi],rh.prototype,"logExtensionHostCommunication",1),I([hi],rh.prototype,"enableSmokeTestDriver",1),I([hi],rh.prototype,"extensionEnabledProposedApi",1),I([hi],rh.prototype,"os",1),I([hi],rh.prototype,"filesToOpenOrCreate",1),I([hi],rh.prototype,"filesToDiff",1),I([hi],rh.prototype,"filesToMerge",1),I([hi],rh.prototype,"filesToWait",1),I([hi],rh.prototype,"isSessionsWindow",1),I([hi],rh.prototype,"agentPluginsHome",1);var pu=le("mainProcessService");var D9t=class{constructor(i,e,t,o){let n=t.getChannel(i);return HIn(e)?o.createInstance(new Ft(e.channelClientCtor,[n])):Tc.toService(n,e?.proxyOptions)}};function HIn(a){return!!a?.channelClientCtor}var Uut=class extends D9t{constructor(i,e,t,o){super(i,e,t,o)}};Uut=I([m(2,pu),m(3,F)],Uut);function Uy(a,i,e){Ee(a,new Ft(Uut,[i,e],!0))}var Qb=le("sharedProcessService"),zut=class extends D9t{constructor(i,e,t,o){super(i,e,t,o)}};zut=I([m(2,Qb),m(3,F)],zut);function Jv(a,i,e){Ee(a,new Ft(zut,[i,e],!0))}var B1i=class{constructor(i){this.port=i;this.onMessage=U.fromDOMEventEmitter(this.port,"message",e=>e.data?qe.wrap(e.data):qe.alloc(0)),i.start()}send(i){this.port.postMessage(i.buffer)}disconnect(){this.port.close()}},i$=class extends GJ{constructor(i,e){let t=new B1i(i);super(t,e),this.protocol=t}dispose(){this.protocol.disconnect(),super.dispose()}};async function JU(a,i,e=xt()){RPo.acquire(i,e),typeof a=="string"&&tl.send(a,e);let t=U.fromDOMEventEmitter(ut,"message",n=>({nonce:n.data,port:n.ports[0],source:n.source})),{port:o}=await U.toPromise(U.once(U.filter(t,n=>n.nonce===e&&n.source===ut)));return o}var PPo="utilityProcessWorker";var L9t=le("utilityProcessWorkerWorkbenchService"),D2e=class extends x{constructor(e,t,o){super();this.windowId=e;this.logService=t;this.mainProcessService=o;this._utilityProcessWorkerService=void 0;this.restoredBarrier=new gp}get utilityProcessWorkerService(){if(!this._utilityProcessWorkerService){let e=this.mainProcessService.getChannel(PPo);this._utilityProcessWorkerService=Tc.toService(e)}return this._utilityProcessWorkerService}async createWorker(e){this.logService.trace("Renderer->UtilityProcess#createWorker"),await Promise.race([this.restoredBarrier.wait(),Li(2e3)]);let t=xt(),o="vscode:createUtilityProcessWorkerMessageChannelResult",n=JU(void 0,o,t),r=this.utilityProcessWorkerService.createWorker({process:e,reply:{windowId:this.windowId,channel:o,nonce:t}}),s=new N;s.add(Z(()=>{this.logService.trace("Renderer->UtilityProcess#disposeWorker",e),this.utilityProcessWorkerService.disposeWorker({process:e,reply:{windowId:this.windowId}})}));let l=await n,c=s.add(new i$(l,`window:${this.windowId},module:${e.moduleId}`));return this.logService.trace("Renderer->UtilityProcess#createWorkerChannel: connection established"),r.then(({reason:u})=>{u?.code===0?this.logService.trace(`[UtilityProcessWorker]: terminated normally with code ${u.code}, signal: ${u.signal}`):this.logService.error(`[UtilityProcessWorker]: terminated unexpectedly with code ${u?.code}, signal: ${u?.signal}`)}),{client:c,onDidTerminate:r,dispose:()=>s.dispose()}}notifyRestored(){this.restoredBarrier.isOpen()||this.restoredBarrier.open()}};D2e=I([m(1,se),m(2,pu)],D2e);var o$=class extends ND{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,P,O,V,H,G,$,J,ae,he,oe,de,Ce,xe,ze,De,Oe,pt,et){super(ut,void 0,pt,b,et,P);this.editorService=e;this.editorGroupService=t;this.configurationService=o;this.titleService=n;this.themeService=r;this.notificationService=s;this.commandService=l;this.keybindingService=c;this.telemetryService=u;this.workspaceEditingService=p;this.fileService=h;this.menuService=g;this.lifecycleService=f;this.integrityService=v;this.nativeEnvironmentService=b;this.accessibilityService=S;this.contextService=y;this.openerService=w;this.nativeHostService=k;this.tunnelService=T;this.workingCopyService=O;this.filesConfigurationService=V;this.productService=H;this.remoteAuthorityResolverService=G;this.dialogService=$;this.storageService=J;this.logService=ae;this.instantiationService=he;this.sharedProcessService=oe;this.progressService=de;this.labelService=Ce;this.bannerService=xe;this.uriIdentityService=ze;this.preferencesService=De;this.utilityProcessWorkerWorkbenchService=Oe;this.customTitleContextMenuDisposable=this._register(new N);this.addRemoveFoldersScheduler=this._register(new Dt(()=>this.doAddRemoveFolders(),100));this.pendingFoldersToAdd=[];this.pendingFoldersToRemove=[];this.isDocumentedEdited=!1;this.touchBarDisposables=this._register(new N);this.mapWindowIdToZoomStatusEntry=new Map;this.configuredWindowZoomLevel=this.resolveConfiguredWindowZoomLevel(),this.registerListeners(),this.create()}registerListeners(){this._register(j(ut,re.RESIZE,()=>this.layoutService.layout())),this._register(this.editorService.onDidActiveEditorChange(()=>this.updateTouchbarMenu()));for(let t of[re.DRAG_OVER,re.DROP])this._register(j(ut.document.body,t,o=>{Xt.stop(o)}));tl.on("vscode:runAction",async(t,...o)=>{let n=o[0],r=n.args||[];if(n.from==="touchbar"){let s=this.editorService.activeEditor;if(s){let l=po.getOriginalUri(s,{supportSideBySide:1});l&&r.push(l)}}else r.push({from:n.from});try{await this.commandService.executeCommand(n.id,...r),this.telemetryService.publicLog2("workbenchActionExecuted",{id:n.id,from:n.from})}catch(s){this.notificationService.error(s)}}),tl.on("vscode:runKeybinding",(t,...o)=>{let n=o[0],r=Nn();r&&this.keybindingService.dispatchByUserSettingsLabel(n.userSettingsLabel,r)}),tl.on("vscode:reportSharedProcessCrash",(t,...o)=>{this.notificationService.prompt(ft.Error,d(17205,null),[{label:d(17202,null),run:()=>this.nativeHostService.relaunch()}],{priority:3})}),tl.on("vscode:openFiles",(t,...o)=>{this.onOpenFiles(o[0])}),tl.on("vscode:addRemoveFolders",(t,...o)=>this.onAddRemoveFoldersRequest(o[0])),tl.on("vscode:showInfoMessage",(t,...o)=>this.notificationService.info(o[0])),tl.on("vscode:showResolveShellEnvError",(t,...o)=>{let n=o[0];this.notificationService.prompt(ft.Error,n,[{label:d(17202,null),run:()=>this.nativeHostService.relaunch()},{label:d(17191,null),run:()=>this.preferencesService.openUserSettings({query:"application.shellEnvironmentResolutionTimeout"})},{label:d(17194,null),run:()=>this.openerService.open("https://go.microsoft.com/fwlink/?linkid=2149667")}])}),tl.on("vscode:showCredentialsError",(t,...o)=>{let n=o[0];this.notificationService.prompt(ft.Error,d(17193,null,n),[{label:d(17222,null),run:()=>this.openerService.open("https://go.microsoft.com/fwlink/?linkid=2190713")}])}),tl.on("vscode:showTranslatedBuildWarning",()=>{this.notificationService.prompt(ft.Warning,d(17204,null,this.productService.nameLong),[{label:d(17192,null),run:()=>{let t=this.productService.quality;this.openerService.open(t==="stable"?"https://code.visualstudio.com/docs/?dv=osx":"https://code.visualstudio.com/docs/?dv=osx&build=insiders")}}],{priority:3})}),tl.on("vscode:showArgvParseWarning",()=>{this.notificationService.prompt(ft.Warning,d(17206,null),[{label:d(17207,null),run:()=>this.editorService.openEditor({resource:this.nativeEnvironmentService.argvResource})}],{priority:3})}),tl.on("vscode:enterFullScreen",()=>L$(!0,ut)),tl.on("vscode:leaveFullScreen",()=>L$(!1,ut)),tl.on("vscode:openProxyAuthenticationDialog",async(t,...o)=>{let n=o[0],r="window.rememberProxyCredentials",s=this.storageService.getBoolean(r,-1),l=await this.dialogService.input({type:"warning",message:d(17198,null),primaryButton:d(17195,null),inputs:[{placeholder:d(17223,null),value:n.username},{placeholder:d(17197,null),type:"password",value:n.password}],detail:d(17199,null,`${n.authInfo.host}:${n.authInfo.port}`),checkbox:{label:d(17200,null),checked:s}});if(!l.confirmed||!l.values)tl.send(n.replyChannel);else{l.checkboxChecked?this.storageService.store(r,!0,-1,1):this.storageService.remove(r,-1);let[c,u]=l.values;tl.send(n.replyChannel,{username:c,password:u,remember:!!l.checkboxChecked})}}),tl.on("vscode:accessibilitySupportChanged",(t,...o)=>{let n=o[0];this.accessibilityService.setAccessibilitySupport(n?2:1)}),tl.on("vscode:configureAllowedUNCHost",async(t,...o)=>{let n=o[0];if(!ei)return;let r=new Set,s=this.configurationService.getValue("security.allowedUNCHosts")??[];if(Array.isArray(s))for(let l of s)typeof l=="string"&&r.add(l);r.has(n)||(r.add(n),await mTt(x4.ID).ready,this.configurationService.updateValue("security.allowedUNCHosts",[...r.values()],2))}),tl.on("vscode:disablePromptForProtocolHandling",(t,...o)=>{let r=o[0]==="local"?"security.promptForLocalFileProtocolHandling":"security.promptForRemoteFileProtocolHandling";this.configurationService.updateValue(r,!1)}),this._register(this.configurationService.onDidChangeConfiguration(t=>{t.affectsConfiguration("window.zoomLevel")||t.affectsConfiguration("window.zoomPerWindow")&&this.configurationService.getValue("window.zoomPerWindow")===!1?this.onDidChangeConfiguredWindowZoomLevel():t.affectsConfiguration("keyboard.touchbar.enabled")||t.affectsConfiguration("keyboard.touchbar.ignored")?this.updateTouchbarMenu():t.affectsConfiguration("window.border")&&this.updateWindowBorder()})),this._register(tIe(t=>this.handleOnDidChangeZoomLevel(t)));for(let t of this.editorGroupService.parts)this.createWindowZoomStatusEntry(t);this._register(this.editorGroupService.onDidCreateAuxiliaryEditorPart(t=>this.createWindowZoomStatusEntry(t))),this._register(U.debounce(this.editorService.onDidVisibleEditorsChange,()=>{},0,void 0,void 0,void 0,this._store)(()=>this.maybeCloseWindow()));let e=this.nativeEnvironmentService.filesToWait;if(e&&this.trackClosedWaitFiles(e.waitMarkerFileUri,di(e.paths.map(t=>t.fileUri))),Ze){for(let t of this.editorGroupService.parts)this.handleRepresentedFilename(t);this._register(this.editorGroupService.onDidCreateAuxiliaryEditorPart(t=>this.handleRepresentedFilename(t)))}this._register(this.workingCopyService.onDidChangeDirty(t=>{let o=t.isDirty();o&&!(t.capabilities&2)&&this.filesConfigurationService.hasShortAutoSaveDelay(t.resource)||this.updateDocumentEdited(o?!0:void 0)})),this.updateDocumentEdited(void 0),this._register(U.any(U.map(U.filter(this.nativeHostService.onDidMaximizeWindow,t=>!!j9(t)),t=>({maximized:!0,windowId:t})),U.map(U.filter(this.nativeHostService.onDidUnmaximizeWindow,t=>!!j9(t)),t=>({maximized:!1,windowId:t})))(t=>this.layoutService.updateWindowMaximizedState(rb(t.windowId).window,t.maximized))),this.layoutService.updateWindowMaximizedState(ut,this.nativeEnvironmentService.window.maximized??!1),this._register(this.layoutService.onDidChangePanelPosition(t=>this.onDidChangePanelPosition(bue(t)))),this.onDidChangePanelPosition(this.layoutService.getPanelPosition()),this._register(this.themeService.onDidColorThemeChange(()=>this.updateWindowBorder())),this._register(this.hostService.onDidChangeActiveWindow(()=>this.updateWindowBorder())),this._register(this.hostService.onDidChangeFocus(()=>this.updateWindowBorder())),this._register(this.lifecycleService.onBeforeShutdown(t=>this.onBeforeShutdown(t))),this._register(this.lifecycleService.onBeforeShutdownError(t=>this.onBeforeShutdownError(t))),this._register(this.lifecycleService.onWillShutdown(t=>this.onWillShutdown(t)))}handleRepresentedFilename(e){let t=new N;U.once(e.onWillDispose)(()=>t.dispose()),this.editorGroupService.getScopedInstantiationService(e).invokeFunction(o=>{let n=o.get(ee);t.add(n.onDidActiveEditorChange(()=>this.updateRepresentedFilename(n,e.windowId)))})}updateRepresentedFilename(e,t){let o=po.getOriginalUri(e.activeEditor,{supportSideBySide:1,filterByScheme:Q.file});this.nativeHostService.setRepresentedFilename(o?.fsPath??"",{targetWindowId:t}),t===ut.vscodeWindowId&&this.provideCustomTitleContextMenu(o?.fsPath)}onBeforeShutdown({veto:e,reason:t}){if(t===1){let o=this.configurationService.getValue("window.confirmBeforeClose"),n=o==="always"||o==="keyboardOnly"&&nb.getInstance().isModifierPressed;if(n)return e((async()=>{let r=t;t===1&&!Ze&&await this.nativeHostService.getWindowCount()===1&&(r=2);let s=!0;return n&&(s=await this.instantiationService.invokeFunction(l=>o$.confirmOnShutdown(l,r))),s&&this.progressOnBeforeShutdown(t),!s})(),"veto.confirmBeforeClose")}this.progressOnBeforeShutdown(t)}progressOnBeforeShutdown(e){this.progressService.withProgress({location:10,delay:800,title:this.toShutdownLabel(e,!1)},()=>U.toPromise(U.any(this.lifecycleService.onWillShutdown,this.lifecycleService.onShutdownVeto,this.dialogService.onWillShowDialog)))}onBeforeShutdownError({error:e,reason:t}){this.dialogService.error(this.toShutdownLabel(t,!0),d(17209,null,xn(e)))}onWillShutdown({reason:e,force:t,joiners:o}){let n=new Dt(()=>{let r=o();this.progressService.withProgress({location:20,buttons:[this.toForceShutdownLabel(e)],cancellable:!1,sticky:!0,title:this.toShutdownLabel(e,!1),detail:r.length>0?d(17224,null,r.map(s=>`- ${s.label}`).join(`
`)):void 0},()=>U.toPromise(this.lifecycleService.onDidShutdown),()=>{t()})},1200);n.schedule(),U.once(this.lifecycleService.onDidShutdown)(()=>n.dispose())}toShutdownLabel(e,t){if(t)switch(e){case 1:return d(17208,null);case 2:return d(17211,null);case 3:return d(17212,null);case 4:return d(17210,null)}switch(e){case 1:return d(17217,null);case 2:return d(17219,null);case 3:return d(17220,null);case 4:return d(17218,null)}}toForceShutdownLabel(e){switch(e){case 1:return d(17213,null);case 2:return d(17215,null);case 3:return d(17216,null);case 4:return d(17214,null)}}updateDocumentEdited(e){let t;typeof e=="boolean"?t=e:t=this.workingCopyService.hasDirty,(!this.isDocumentedEdited&&t||this.isDocumentedEdited&&!t)&&(this.isDocumentedEdited=t,this.nativeHostService.setDocumentEdited(t))}getWindowMinimumWidth(e=this.layoutService.getPanelPosition()){return e===0||e===1?jCe.WIDTH_WITH_VERTICAL_PANEL:jCe.WIDTH}onDidChangePanelPosition(e){let t=this.getWindowMinimumWidth(e);this.nativeHostService.setMinimumSize(t,void 0)}maybeCloseWindow(){if(this.configurationService.getValue("window.closeWhenEmpty")||this.nativeEnvironmentService.args.wait)for(let t of this.editorGroupService.parts)t.groups.some(o=>!o.isEmpty)||t===this.editorGroupService.mainPart&&(this.contextService.getWorkbenchState()!==1||this.environmentService.isExtensionDevelopment||this.editorService.visibleEditors.length>0)||(t===this.editorGroupService.mainPart?this.nativeHostService.closeWindow():t.removeGroup(t.activeGroup))}provideCustomTitleContextMenu(e){if(this.customTitleContextMenuDisposable.clear(),!e||LC(this.configurationService))return;let t=e.split(Oo.sep);for(let o=t.length;o>0;o--){let n=o===t.length,r=o;n||r++;let s=A.file(t.slice(0,r).join(Oo.sep)),l;n?l=this.labelService.getUriBasenameLabel(s):l=this.labelService.getUriBasenameLabel(ci(s));let c=`workbench.action.revealPathInFinder${o}`;this.customTitleContextMenuDisposable.add($e.registerCommand(c,()=>this.nativeHostService.showItemInFolder(s.fsPath))),this.customTitleContextMenuDisposable.add(ve.appendMenuItem(D.TitleBarTitleContext,{command:{id:c,title:l||Oo.sep},order:-o,group:"1_file"}))}}create(){this.setupOpenHandlers(),this.lifecycleService.when(2).then(()=>this.nativeHostService.notifyReady()),this.lifecycleService.when(3).then(()=>{this.sharedProcessService.notifyRestored(),this.utilityProcessWorkerWorkbenchService.notifyRestored()}),this.handleWarnings(),this.updateTouchbarMenu(),this.updateWindowBorder(),this.environmentService.enableSmokeTestDriver&&YWt(this.instantiationService)}async handleWarnings(){if(await this.lifecycleService.when(3),(async()=>{let t=await this.nativeHostService.isAdmin(),{isPure:o}=await this.integrityService.isPure();this.titleService.updateProperties({isPure:o,isAdmin:t}),t&&!ei&&this.notificationService.warn(d(17203,null,this.productService.nameShort))})(),this.environmentService.isBuilt&&!this.environmentService.extensionDevelopmentLocationURI?.length){let t;Ze?t=ci(ci(ci(A.file(this.nativeEnvironmentService.appRoot)))):t=ci(ci(A.file(this.nativeEnvironmentService.appRoot)));for(let o of this.contextService.getWorkspace().folders)if(this.uriIdentityService.extUri.isEqualOrParent(o.uri,t)){this.bannerService.show({id:"appRootWarning.banner",message:d(17190,null,this.labelService.getUriLabel(t)),icon:R.warning});break}}if(Ze){let t=this.nativeEnvironmentService.os.release.split(".")[0],o=new Map([["20","macOS Big Sur"]]);if(o.has(t)){let n=d(17196,null,this.productService.nameLong,o.get(t));this.notificationService.prompt(ft.Warning,n,[{label:d(17194,null),run:()=>this.openerService.open(A.parse("https://aka.ms/vscode-faq-old-macOS"))}],{neverShowAgain:{id:"macoseol",isSecondary:!0,scope:2},priority:3,sticky:!0})}}let e=eP.shellEnv();this.progressService.withProgress({title:d(17201,null),location:10,delay:1600,buttons:[d(17194,null)]},()=>e,()=>this.openerService.open("https://go.microsoft.com/fwlink/?linkid=2149667"))}async resolveExternalUri(e,t){let o;if(t?.allowTunneling){let n=IDe(e),r=hso(e);if(r&&(o=await this.openTunnel(r.address,r.port),o&&typeof o!="string")){if(o.tunnelRemotePort!==r.port)o.dispose(),o=void 0;else if(!n){let s=o;return{resolved:e,dispose:()=>s.dispose()}}}if(n){let s=await this.openTunnel(n.address,n.port);if(s&&typeof s!="string"){let l=A.parse(s.localAddress).with({path:e.path});return{resolved:l.scheme.startsWith(e.scheme)?l:e.with({authority:s.localAddress}),dispose(){s.dispose(),o&&typeof o!="string"&&o.dispose()}}}}}if(!t?.openExternal&&await this.fileService.canHandleResource(e))return{resolved:A.from({scheme:this.productService.urlProtocol,path:"workspace",query:e.toString()}),dispose(){}}}async openTunnel(e,t){let o=this.environmentService.remoteAuthority,n=o?{getAddress:async()=>(await this.remoteAuthorityResolverService.resolveAuthority(o)).authority}:void 0,r=await this.tunnelService.getExistingTunnel(e,t);return!r||typeof r=="string"?this.tunnelService.openTunnel(n,e,t):r}setupOpenHandlers(){this.openerService.setDefaultExternalOpener({openExternal:async e=>{if(!await this.nativeHostService.openExternal(e,this.configurationService.getValue("workbench.externalBrowser"))){let o=A.parse(e);o.scheme===Q.file&&await this.nativeHostService.showItemInFolder(o.fsPath)}return!0}}),this.openerService.registerExternalUriResolver({resolveExternalUri:async(e,t)=>this.resolveExternalUri(e,t)})}updateTouchbarMenu(){if(!Ze)return;this.touchBarDisposables.clear(),this.touchBarMenu=void 0;let e=this.touchBarDisposables.add(new Dt(()=>this.doUpdateTouchbarMenu(e),300));e.schedule()}doUpdateTouchbarMenu(e){if(!this.touchBarMenu){let c=this.editorService.activeEditorPane?.scopedContextKeyService||this.editorGroupService.activeGroup.scopedContextKeyService;this.touchBarMenu=this.menuService.createMenu(D.TouchBarContext,c),this.touchBarDisposables.add(this.touchBarMenu),this.touchBarDisposables.add(this.touchBarMenu.onDidChange(()=>e.schedule()))}let t=this.configurationService.getValue("keyboard.touchbar.enabled")===!1,o=this.configurationService.getValue("keyboard.touchbar.ignored"),n=Array.isArray(o)?o:[],r=jm(this.touchBarMenu.getActions()),s=[],l=[];if(!t){for(let c of r)if(c instanceof Lo){if(n.indexOf(c.item.id)>=0)continue;l.push(c.item)}else c instanceof ri&&(l.length&&s.push(l),l=[]);l.length&&s.push(l)}eo(this.lastInstalledTouchedBar,s)||(this.lastInstalledTouchedBar=s,this.nativeHostService.updateTouchBar(s))}updateWindowBorder(){if(!ei)return;let e=this.themeService.getColorTheme(),t=e.getColor(CEe)?.toString(),o=e.getColor(xEe)?.toString(),n=this.configurationService.getValue("window.border");n==="off"?(t="off",o=void 0):n==="default"?t=t??"default":n==="system"?(t="default",o=void 0):(t=n,o=void 0),this.nativeHostService.updateWindowAccentColor(t,o)}onAddRemoveFoldersRequest(e){this.pendingFoldersToAdd.push(...e.foldersToAdd.map(t=>A.revive(t))),this.pendingFoldersToRemove.push(...e.foldersToRemove.map(t=>A.revive(t))),this.addRemoveFoldersScheduler.isScheduled()||this.addRemoveFoldersScheduler.schedule()}async doAddRemoveFolders(){let e=this.pendingFoldersToAdd.map(o=>({uri:o})),t=this.pendingFoldersToRemove.slice(0);this.pendingFoldersToAdd=[],this.pendingFoldersToRemove=[],e.length&&await this.workspaceEditingService.addFolders(e),t.length&&await this.workspaceEditingService.removeFolders(t)}async onOpenFiles(e){let t=!!(e.filesToDiff&&e.filesToDiff.length===2),o=!!(e.filesToMerge&&e.filesToMerge.length===4),n=di(await MEe(o?e.filesToMerge:t?e.filesToDiff:e.filesToOpenOrCreate,this.fileService,this.logService));if(n.length){let r=await this.openResources(n,t,o);if(e.filesToWait)return r.length?this.trackClosedWaitFiles(A.revive(e.filesToWait.waitMarkerFileUri),di(e.filesToWait.paths.map(s=>A.revive(s.fileUri)))):this.fileService.del(A.revive(e.filesToWait.waitMarkerFileUri))}}async trackClosedWaitFiles(e,t){await this.instantiationService.invokeFunction(o=>Jto(o,t)),await this.fileService.del(e)}async openResources(e,t,o){let n=[];if(o&&Sf(e[0])&&Sf(e[1])&&Sf(e[2])&&Sf(e[3])){let r={input1:{resource:e[0].resource},input2:{resource:e[1].resource},base:{resource:e[2].resource},result:{resource:e[3].resource},options:{pinned:!0}};n.push(r)}else if(t&&Sf(e[0])&&Sf(e[1])){let r={original:{resource:e[0].resource},modified:{resource:e[1].resource},options:{pinned:!0}};n.push(r)}else n.push(...e);return this.editorService.openEditors(n,void 0,{validateTrust:!0})}resolveConfiguredWindowZoomLevel(){let e=this.configurationService.getValue("window.zoomLevel");return typeof e=="number"?e:0}handleOnDidChangeZoomLevel(e){if(this.updateWindowZoomStatusEntry(e),e===ut.vscodeWindowId){let t=mC(ut),o;this.configuredWindowZoomLevel!==t&&(o=t),tl.invoke("vscode:notifyZoomLevel",o)}}createWindowZoomStatusEntry(e){let t=new N;U.once(e.onWillDispose)(()=>t.dispose());let o=this.editorGroupService.getScopedInstantiationService(e);this.mapWindowIdToZoomStatusEntry.set(e.windowId,t.add(o.createInstance(Kut))),t.add(Z(()=>this.mapWindowIdToZoomStatusEntry.delete(e.windowId))),this.updateWindowZoomStatusEntry(e.windowId)}updateWindowZoomStatusEntry(e){let t=rb(e),o=this.mapWindowIdToZoomStatusEntry.get(e);if(o&&t){let n=mC(t.window),r;n<this.configuredWindowZoomLevel?r="$(zoom-out)":n>this.configuredWindowZoomLevel&&(r="$(zoom-in)"),o.updateZoomEntry(r??!1,e)}}onDidChangeConfiguredWindowZoomLevel(){this.configuredWindowZoomLevel=this.resolveConfiguredWindowZoomLevel();let e=!1;for(let{window:t}of SC())if(mC(t)!==this.configuredWindowZoomLevel){e=!0;break}e&&t$(this.configuredWindowZoomLevel,2);for(let[t]of this.mapWindowIdToZoomStatusEntry)this.updateWindowZoomStatusEntry(t)}dispose(){super.dispose();for(let[,e]of this.mapWindowIdToZoomStatusEntry)e.dispose()}};o$=I([m(0,ee),m(1,wt),m(2,B),m(3,T0),m(4,sp),m(5,Ne),m(6,ge),m(7,_e),m(8,Te),m(9,Db),m(10,fe),m(11,Kt),m(12,ji),m(13,_2e),m(14,zr),m(15,Oi),m(16,Pe),m(17,Je),m(18,ko),m(19,_p),m(20,yi),m(21,Xa),m(22,gr),m(23,tt),m(24,Uc),m(25,at),m(26,ce),m(27,se),m(28,F),m(29,Qb),m(30,Fo),m(31,rt),m(32,FD),m(33,ht),m(34,Go),m(35,L9t),m(36,Zt),m(37,Xe)],o$);var Kut=class extends x{constructor(e,t,o){super();this.statusbarService=e;this.commandService=t;this.keybindingService=o;this.disposable=this._register(new me);this.zoomLevelLabel=void 0}updateZoomEntry(e,t){typeof e=="string"?(this.disposable.value||this.createZoomEntry(e),this.updateZoomLevelLabel(t)):this.disposable.clear()}createZoomEntry(e){let t=new N;this.disposable.value=t;let o=_(".zoom-status"),n=_(".zoom-status-left");o.appendChild(n);let r=t.add(new it("workbench.action.zoomOut",d(17227,null),q.asClassName(R.remove),!0,()=>this.commandService.executeCommand(r.id))),s=t.add(new it("workbench.action.zoomIn",d(17225,null),q.asClassName(R.plus),!0,()=>this.commandService.executeCommand(s.id))),l=t.add(new it("workbench.action.zoomReset",d(17228,null),void 0,!0,()=>this.commandService.executeCommand(l.id)));l.tooltip=this.keybindingService.appendKeybinding(l.label,l.id);let c=t.add(new it("workbench.action.openSettings",d(17229,null),q.asClassName(R.settingsGear),!0,()=>this.commandService.executeCommand(c.id,"window.zoom"))),u=t.add(new it("zoomLabel",void 0,void 0,!1));this.zoomLevelLabel=u,t.add(Z(()=>this.zoomLevelLabel=void 0));let p=t.add(new Zi(n,{hoverDelegate:nI}));p.push(r,{icon:!0,label:!1,keybinding:this.keybindingService.lookupKeybinding(r.id)?.getLabel()}),p.push(this.zoomLevelLabel,{icon:!1,label:!0}),p.push(s,{icon:!0,label:!1,keybinding:this.keybindingService.lookupKeybinding(s.id)?.getLabel()});let h=_(".zoom-status-right");o.appendChild(h);let g=t.add(new Zi(h,{hoverDelegate:nI}));g.push(l,{icon:!1,label:!0}),g.push(c,{icon:!0,label:!1,keybinding:this.keybindingService.lookupKeybinding(c.id)?.getLabel()});let f=d(17221,null);t.add(this.statusbarService.addEntry({name:f,text:e,tooltip:o,ariaLabel:f,command:LR,kind:"prominent"},"status.windowZoom",1,102))}updateZoomLevelLabel(e){if(this.zoomLevelLabel){let t=rb(e,!0).window,o=Math.round(Zv(t)*100),n=mC(t);this.zoomLevelLabel.label=`${n}`,this.zoomLevelLabel.tooltip=d(17226,null,n,o)}}};Kut=I([m(0,kr),m(1,ge),m(2,_e)],Kut);function Gut(a){return Object.isFrozen(a)?a:T$i(a)}var jd=class a{constructor(i,e,t,o,n){this._contents=i;this._keys=e;this._overrides=t;this._raw=o;this.logService=n;this.overrideConfigurations=new Map}static createEmptyModel(i){return new a({},[],[],void 0,i)}get rawConfiguration(){if(!this._rawConfiguration)if(this._raw){let i=(Array.isArray(this._raw)?this._raw:[this._raw]).map(e=>{if(e instanceof a)return e;let t=new KN("",this.logService);return t.parseRaw(e),t.configurationModel});this._rawConfiguration=i.reduce((e,t)=>t===e?t:e.merge(t),i[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(i=>i instanceof a)))return this._raw}isEmpty(){return this._keys.length===0&&Object.keys(this._contents).length===0&&this._overrides.length===0}getValue(i){return i?sje(this.contents,i):this.contents}inspect(i,e){let t=this;return{get value(){return Gut(t.rawConfiguration.getValue(i))},get override(){return e?Gut(t.rawConfiguration.getOverrideValue(i,e)):void 0},get merged(){return Gut(e?t.rawConfiguration.override(e).getValue(i):t.rawConfiguration.getValue(i))},get overrides(){let o=[];for(let{contents:n,identifiers:r,keys:s}of t.rawConfiguration.overrides){let l=new a(n,s,[],void 0,t.logService).getValue(i);l!==void 0&&o.push({identifiers:r,value:l})}return o.length?Gut(o):void 0}}}getOverrideValue(i,e){let t=this.getContentsForOverrideIdentifer(e);return t?i?sje(t,i):t:void 0}getKeysForOverrideIdentifier(i){let e=[];for(let t of this.overrides)t.identifiers.includes(i)&&e.push(...t.keys);return zo(e)}getAllOverrideIdentifiers(){let i=[];for(let e of this.overrides)i.push(...e.identifiers);return zo(i)}override(i){let e=this.overrideConfigurations.get(i);return e||(e=this.createOverrideConfigurationModel(i),this.overrideConfigurations.set(i,e)),e}merge(...i){let e=Ji(this.contents),t=Ji(this.overrides),o=[...this.keys],n=this._raw?Array.isArray(this._raw)?[...this._raw]:[this._raw]:[this];for(let r of i)if(n.push(...r._raw?Array.isArray(r._raw)?r._raw:[r._raw]:[r]),!r.isEmpty()){this.mergeContents(e,r.contents);for(let s of r.overrides){let[l]=t.filter(c=>$i(c.identifiers,s.identifiers));l?(this.mergeContents(l.contents,s.contents),l.keys.push(...s.keys),l.keys=zo(l.keys)):t.push(Ji(s))}for(let s of r.keys)o.indexOf(s)===-1&&o.push(s)}return new a(e,o,t,!n.length||n.every(r=>r instanceof a)?void 0:n,this.logService)}createOverrideConfigurationModel(i){let e=this.getContentsForOverrideIdentifer(i);if(!e||typeof e!="object"||!Object.keys(e).length)return this;let t={};for(let o of zo([...Object.keys(this.contents),...Object.keys(e)])){let n=this.contents[o],r=e[o];r&&(typeof n=="object"&&typeof r=="object"?(n=Ji(n),this.mergeContents(n,r)):n=r),t[o]=n}return new a(t,this.keys,this.overrides,void 0,this.logService)}mergeContents(i,e){for(let t of Object.keys(e)){if(t in i&&xi(i[t])&&xi(e[t])){this.mergeContents(i[t],e[t]);continue}i[t]=Ji(e[t])}}getContentsForOverrideIdentifer(i){let e=null,t=null,o=n=>{n&&(t?this.mergeContents(t,n):t=Ji(n))};for(let n of this.overrides)n.identifiers.length===1&&n.identifiers[0]===i?e=n.contents:n.identifiers.includes(i)&&o(n.contents);return o(e),t}toJSON(){return{contents:this.contents,overrides:this.overrides,keys:this.keys}}addValue(i,e){this.updateValue(i,e,!0)}setValue(i,e){this.updateValue(i,e,!1)}removeValue(i){let e=this.keys.indexOf(i);e!==-1&&(this.keys.splice(e,1),$$i(this.contents,i),kg.test(i)&&this.overrides.splice(this.overrides.findIndex(t=>$i(t.identifiers,R1(i))),1))}updateValue(i,e,t){if(uei(this.contents,i,e,o=>this.logService.error(o)),t=t||this.keys.indexOf(i)===-1,t&&this.keys.push(i),kg.test(i)){let o=this.contents[i],n=R1(i),r={identifiers:n,keys:Object.keys(o),contents:Mae(o,l=>this.logService.error(l))},s=this.overrides.findIndex(l=>$i(l.identifiers,n));s!==-1?this.overrides[s]=r:this.overrides.push(r)}}},KN=class{constructor(i,e){this._name=i;this.logService=e;this._raw=null;this._configurationModel=null;this._restrictedConfigurations=[];this._parseErrors=[]}get configurationModel(){return this._configurationModel||jd.createEmptyModel(this.logService)}get restrictedConfigurations(){return this._restrictedConfigurations}get errors(){return this._parseErrors}parse(i,e){if(!nr(i)){let t=this.doParseContent(i);this.parseRaw(t,e)}}reparse(i){this._raw&&this.parseRaw(this._raw,i)}parseRaw(i,e){this._raw=i;let{contents:t,keys:o,overrides:n,restricted:r,hasExcludedProperties:s}=this.doParseRaw(i,e);this._configurationModel=new jd(t,o,n,s?[i]:void 0,this.logService),this._restrictedConfigurations=r||[]}doParseContent(i){let e={},t=null,o=[],n=[],r=[];function s(c){Array.isArray(o)?o.push(c):t!==null&&(o[t]=c)}let l={onObjectBegin:()=>{let c={};s(c),n.push(o),o=c,t=null},onObjectProperty:c=>{t=c},onObjectEnd:()=>{o=n.pop()},onArrayBegin:()=>{let c=[];s(c),n.push(o),o=c,t=null},onArrayEnd:()=>{o=n.pop()},onLiteralValue:s,onError:(c,u,p)=>{r.push({error:c,offset:u,length:p})}};if(i)try{uk(i,l),e=o[0]||{}}catch(c){this.logService.error(`Error while parsing settings file ${this._name}: ${c}`),this._parseErrors=[c]}return e}doParseRaw(i,e){let t=ne.as(Jt.Configuration),o=t.getConfigurationProperties(),n=t.getExcludedConfigurationProperties(),r=this.filter(i,o,n,!0,e);i=r.raw;let s=Mae(i,u=>this.logService.error(`Conflict in settings file ${this._name}: ${u}`)),l=Object.keys(i),c=this.toOverrides(i,u=>this.logService.error(`Conflict in settings file ${this._name}: ${u}`));return{contents:s,keys:l,overrides:c,restricted:r.restricted,hasExcludedProperties:r.hasExcludedProperties}}filter(i,e,t,o,n){let r=!1;if(!n?.scopes&&!n?.skipRestricted&&!n?.skipUnregistered&&!n?.exclude?.length)return{raw:i,restricted:[],hasExcludedProperties:r};let s={},l=[];for(let c in i)if(kg.test(c)&&o){let u=this.filter(i[c],e,t,!1,n);s[c]=u.raw,r=r||u.hasExcludedProperties,l.push(...u.restricted)}else{let u=e[c];u?.restricted&&l.push(c),this.shouldInclude(c,u,t,n)?s[c]=i[c]:r=!0}return{raw:s,restricted:l,hasExcludedProperties:r}}shouldInclude(i,e,t,o){if(o.exclude?.includes(i))return!1;if(o.include?.includes(i))return!0;if(o.skipRestricted&&e?.restricted||o.skipUnregistered&&!e)return!1;let n=e??t[i],r=n?typeof n.scope<"u"?n.scope:4:void 0;return r===void 0||o.scopes===void 0?!0:o.scopes.includes(r)}toOverrides(i,e){let t=[];for(let o of Object.keys(i))if(kg.test(o)){let n={},r=i[o];for(let s in r)n[s]=r[s];t.push({identifiers:R1(o),keys:Object.keys(n),contents:Mae(n,e)})}return t}},qut=class extends x{constructor(e,t,o,n,r){super();this.userSettingsResource=e;this.parseOptions=t;this.fileService=n;this.logService=r;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this.parser=new KN(this.userSettingsResource.toString(),r),this._register(this.fileService.watch(o.dirname(this.userSettingsResource))),this._register(this.fileService.watch(this.userSettingsResource)),this._register(U.any(U.filter(this.fileService.onDidFilesChange,s=>s.contains(this.userSettingsResource)),U.filter(this.fileService.onDidRunOperation,s=>(s.isOperation(0)||s.isOperation(3)||s.isOperation(1)||s.isOperation(4))&&o.isEqual(s.resource,e)))(()=>this._onDidChange.fire()))}async loadConfiguration(){try{let e=await this.fileService.readFile(this.userSettingsResource);return this.parser.parse(e.value.toString()||"{}",this.parseOptions),this.parser.configurationModel}catch{return jd.createEmptyModel(this.logService)}}reparse(e){return e&&(this.parseOptions=e),this.parser.reparse(this.parseOptions),this.parser.configurationModel}getRestrictedSettings(){return this.parser.restrictedConfigurations}},H1i=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g){this.key=i;this.overrides=e;this._value=t;this.overrideIdentifiers=o;this.defaultConfiguration=n;this.policyConfiguration=r;this.applicationConfiguration=s;this.userConfiguration=l;this.localUserConfiguration=c;this.remoteUserConfiguration=u;this.workspaceConfiguration=p;this.folderConfigurationModel=h;this.memoryConfigurationModel=g}get value(){return Gut(this._value)}toInspectValue(i){return i?.value!==void 0||i?.override!==void 0||i?.overrides!==void 0?i: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)}},$ut=class a{constructor(i,e,t,o,n,r,s,l,c,u){this._defaultConfiguration=i;this._policyConfiguration=e;this._applicationConfiguration=t;this._localUserConfiguration=o;this._remoteUserConfiguration=n;this._workspaceConfiguration=r;this._folderConfigurations=s;this._memoryConfiguration=l;this._memoryConfigurationByResource=c;this.logService=u;this._workspaceConsolidatedConfiguration=null;this._foldersConsolidatedConfigurations=new gt;this._userConfiguration=null}getValue(i,e,t){return this.getConsolidatedConfigurationModel(i,e,t).getValue(i)}updateValue(i,e,t={}){let o;t.resource?(o=this._memoryConfigurationByResource.get(t.resource),o||(o=jd.createEmptyModel(this.logService),this._memoryConfigurationByResource.set(t.resource,o))):o=this._memoryConfiguration,e===void 0?o.removeValue(i):o.setValue(i,e),t.resource||(this._workspaceConsolidatedConfiguration=null)}inspect(i,e,t){let o=this.getConsolidatedConfigurationModel(i,e,t),n=this.getFolderConfigurationModelForResource(e.resource,t),r=e.resource?this._memoryConfigurationByResource.get(e.resource)||this._memoryConfiguration:this._memoryConfiguration,s=new Set;for(let l of o.overrides)for(let c of l.identifiers)o.getOverrideValue(i,c)!==void 0&&s.add(c);return new H1i(i,e,o.getValue(i),s.size?[...s]:void 0,this._defaultConfiguration,this._policyConfiguration.isEmpty()?void 0:this._policyConfiguration,this.applicationConfiguration.isEmpty()?void 0:this.applicationConfiguration,this.userConfiguration,this.localUserConfiguration,this.remoteUserConfiguration,t?this._workspaceConfiguration:void 0,n||void 0,r)}keys(i){let e=this.getFolderConfigurationModelForResource(void 0,i);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(i){this._defaultConfiguration=i,this._workspaceConsolidatedConfiguration=null,this._foldersConsolidatedConfigurations.clear()}updatePolicyConfiguration(i){this._policyConfiguration=i}updateApplicationConfiguration(i){this._applicationConfiguration=i,this._workspaceConsolidatedConfiguration=null,this._foldersConsolidatedConfigurations.clear()}updateLocalUserConfiguration(i){this._localUserConfiguration=i,this._userConfiguration=null,this._workspaceConsolidatedConfiguration=null,this._foldersConsolidatedConfigurations.clear()}updateRemoteUserConfiguration(i){this._remoteUserConfiguration=i,this._userConfiguration=null,this._workspaceConsolidatedConfiguration=null,this._foldersConsolidatedConfigurations.clear()}updateWorkspaceConfiguration(i){this._workspaceConfiguration=i,this._workspaceConsolidatedConfiguration=null,this._foldersConsolidatedConfigurations.clear()}updateFolderConfiguration(i,e){this._folderConfigurations.set(i,e),this._foldersConsolidatedConfigurations.delete(i)}deleteFolderConfiguration(i){this.folderConfigurations.delete(i),this._foldersConsolidatedConfigurations.delete(i)}compareAndUpdateDefaultConfiguration(i,e){let t=[];if(!e){let{added:o,updated:n,removed:r}=ise(this._defaultConfiguration,i);e=[...o,...n,...r]}for(let o of e)for(let n of R1(o)){let r=this._defaultConfiguration.getKeysForOverrideIdentifier(n),s=i.getKeysForOverrideIdentifier(n),l=[...s.filter(c=>r.indexOf(c)===-1),...r.filter(c=>s.indexOf(c)===-1),...r.filter(c=>!eo(this._defaultConfiguration.override(n).getValue(c),i.override(n).getValue(c)))];t.push([n,l])}return this.updateDefaultConfiguration(i),{keys:e,overrides:t}}compareAndUpdatePolicyConfiguration(i){let{added:e,updated:t,removed:o}=ise(this._policyConfiguration,i),n=[...e,...t,...o];return n.length&&this.updatePolicyConfiguration(i),{keys:n,overrides:[]}}compareAndUpdateApplicationConfiguration(i){let{added:e,updated:t,removed:o,overrides:n}=ise(this.applicationConfiguration,i),r=[...e,...t,...o];return r.length&&this.updateApplicationConfiguration(i),{keys:r,overrides:n}}compareAndUpdateLocalUserConfiguration(i){let{added:e,updated:t,removed:o,overrides:n}=ise(this.localUserConfiguration,i),r=[...e,...t,...o];return r.length&&this.updateLocalUserConfiguration(i),{keys:r,overrides:n}}compareAndUpdateRemoteUserConfiguration(i){let{added:e,updated:t,removed:o,overrides:n}=ise(this.remoteUserConfiguration,i),r=[...e,...t,...o];return r.length&&this.updateRemoteUserConfiguration(i),{keys:r,overrides:n}}compareAndUpdateWorkspaceConfiguration(i){let{added:e,updated:t,removed:o,overrides:n}=ise(this.workspaceConfiguration,i),r=[...e,...t,...o];return r.length&&this.updateWorkspaceConfiguration(i),{keys:r,overrides:n}}compareAndUpdateFolderConfiguration(i,e){let t=this.folderConfigurations.get(i),{added:o,updated:n,removed:r,overrides:s}=ise(t,e),l=[...o,...n,...r];return(l.length||!t)&&this.updateFolderConfiguration(i,e),{keys:l,overrides:s}}compareAndDeleteFolderConfiguration(i){let e=this.folderConfigurations.get(i);if(!e)throw new Error("Unknown folder");this.deleteFolderConfiguration(i);let{added:t,updated:o,removed:n,overrides:r}=ise(e,void 0);return{keys:[...t,...o,...n],overrides:r}}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 i=this._localUserConfiguration.merge(this._remoteUserConfiguration);this._userConfiguration=new jd(i.contents,i.keys,i.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(i,e,t){let o=this.getConsolidatedConfigurationModelForResource(e,t);if(e.overrideIdentifier&&(o=o.override(e.overrideIdentifier)),!this._policyConfiguration.isEmpty()&&this._policyConfiguration.getValue(i)!==void 0){o=o.merge();for(let n of this._policyConfiguration.keys)o.setValue(n,this._policyConfiguration.getValue(n))}return o}getConsolidatedConfigurationModelForResource({resource:i},e){let t=this.getWorkspaceConsolidatedConfiguration();if(e&&i){let o=e.getFolder(i);o&&(t=this.getFolderConsolidatedConfiguration(o.uri)||t);let n=this._memoryConfigurationByResource.get(i);n&&(t=t.merge(n))}return t}getWorkspaceConsolidatedConfiguration(){return this._workspaceConsolidatedConfiguration||(this._workspaceConsolidatedConfiguration=this._defaultConfiguration.merge(this.applicationConfiguration,this.userConfiguration,this._workspaceConfiguration,this._memoryConfiguration)),this._workspaceConsolidatedConfiguration}getFolderConsolidatedConfiguration(i){let e=this._foldersConsolidatedConfigurations.get(i);if(!e){let t=this.getWorkspaceConsolidatedConfiguration(),o=this._folderConfigurations.get(i);o?(e=t.merge(o),this._foldersConsolidatedConfigurations.set(i,e)):e=t}return e}getFolderConfigurationModelForResource(i,e){if(e&&i){let t=e.getFolder(i);if(t)return this._folderConfigurations.get(t.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((i,e)=>{let{contents:t,overrides:o,keys:n}=this._folderConfigurations.get(e);return i.push([e,{contents:t,overrides:o,keys:n}]),i},[])}}allKeys(){let i=new Set;return this._defaultConfiguration.keys.forEach(e=>i.add(e)),this.userConfiguration.keys.forEach(e=>i.add(e)),this._workspaceConfiguration.keys.forEach(e=>i.add(e)),this._folderConfigurations.forEach(e=>e.keys.forEach(t=>i.add(t))),[...i.values()]}allOverrideIdentifiers(){let i=new Set;return this._defaultConfiguration.getAllOverrideIdentifiers().forEach(e=>i.add(e)),this.userConfiguration.getAllOverrideIdentifiers().forEach(e=>i.add(e)),this._workspaceConfiguration.getAllOverrideIdentifiers().forEach(e=>i.add(e)),this._folderConfigurations.forEach(e=>e.getAllOverrideIdentifiers().forEach(t=>i.add(t))),[...i.values()]}getAllKeysForOverrideIdentifier(i){let e=new Set;return this._defaultConfiguration.getKeysForOverrideIdentifier(i).forEach(t=>e.add(t)),this.userConfiguration.getKeysForOverrideIdentifier(i).forEach(t=>e.add(t)),this._workspaceConfiguration.getKeysForOverrideIdentifier(i).forEach(t=>e.add(t)),this._folderConfigurations.forEach(t=>t.getKeysForOverrideIdentifier(i).forEach(o=>e.add(o))),[...e.values()]}static parse(i,e){let t=this.parseConfigurationModel(i.defaults,e),o=this.parseConfigurationModel(i.policy,e),n=this.parseConfigurationModel(i.application,e),r=this.parseConfigurationModel(i.userLocal,e),s=this.parseConfigurationModel(i.userRemote,e),l=this.parseConfigurationModel(i.workspace,e),c=i.folders.reduce((u,p)=>(u.set(A.revive(p[0]),this.parseConfigurationModel(p[1],e)),u),new gt);return new a(t,o,n,r,s,l,c,jd.createEmptyModel(e),new gt,e)}static parseConfigurationModel(i,e){return new jd(i.contents,i.keys,i.overrides,i.raw,e)}};function U1i(...a){if(a.length===0)return{keys:[],overrides:[]};if(a.length===1)return a[0];let i=new Set,e=new Map;for(let o of a)o.keys.forEach(n=>i.add(n)),o.overrides.forEach(([n,r])=>{let s=aV(e,n,new Set);r.forEach(l=>s.add(l))});let t=[];return e.forEach((o,n)=>t.push([n,[...o.values()]])),{keys:[...i.values()],overrides:t}}var R9t=class{constructor(i,e,t,o,n){this.change=i;this.previous=e;this.currentConfiguraiton=t;this.currentWorkspace=o;this.logService=n;this._marker=`
`;this._markerCode1=this._marker.charCodeAt(0);this._markerCode2=46;this.affectedKeys=new Set;this._previousConfiguration=void 0;for(let r of i.keys)this.affectedKeys.add(r);for(let[,r]of i.overrides)for(let s of r)this.affectedKeys.add(s);this._affectsConfigStr=this._marker;for(let r of this.affectedKeys)this._affectsConfigStr+=r+this._marker}get previousConfiguration(){return!this._previousConfiguration&&this.previous&&(this._previousConfiguration=$ut.parse(this.previous.data,this.logService)),this._previousConfiguration}affectsConfiguration(i,e){let t=this._marker+i,o=this._affectsConfigStr.indexOf(t);if(o<0)return!1;let n=o+t.length;if(n>=this._affectsConfigStr.length)return!1;let r=this._affectsConfigStr.charCodeAt(n);if(r!==this._markerCode1&&r!==this._markerCode2)return!1;if(e){let s=this.previousConfiguration?this.previousConfiguration.getValue(i,e,this.previous?.workspace):void 0,l=this.currentConfiguraiton.getValue(i,e,this.currentWorkspace);return!eo(s,l)}return!0}};function ise(a,i){let{added:e,removed:t,updated:o}=APo(i?.rawConfiguration,a?.rawConfiguration),n=[],r=a?.getAllOverrideIdentifiers()||[],s=i?.getAllOverrideIdentifiers()||[];if(i){let l=s.filter(c=>!r.includes(c));for(let c of l)n.push([c,i.getKeysForOverrideIdentifier(c)])}if(a){let l=r.filter(c=>!s.includes(c));for(let c of l)n.push([c,a.getKeysForOverrideIdentifier(c)])}if(i&&a){for(let l of r)if(s.includes(l)){let c=APo({contents:a.getOverrideValue(void 0,l)||{},keys:a.getKeysForOverrideIdentifier(l)},{contents:i.getOverrideValue(void 0,l)||{},keys:i.getKeysForOverrideIdentifier(l)});n.push([l,[...c.added,...c.removed,...c.updated]])}}return{added:e,removed:t,updated:o,overrides:n}}function APo(a,i){let e=a?i?a.keys.filter(n=>i.keys.indexOf(n)===-1):[...a.keys]:[],t=i?a?i.keys.filter(n=>a.keys.indexOf(n)===-1):[...i.keys]:[],o=[];if(a&&i){for(let n of i.keys)if(a.keys.indexOf(n)!==-1){let r=sje(i.contents,n),s=sje(a.contents,n);eo(r,s)||o.push(n)}}return{added:e,removed:t,updated:o}}var M9t=class extends x{constructor(e){super();this.logService=e;this._onDidChangeConfiguration=this._register(new E);this.onDidChangeConfiguration=this._onDidChangeConfiguration.event;this._configurationModel=jd.createEmptyModel(e)}get configurationModel(){return this._configurationModel}async initialize(){return this.resetConfigurationModel(),this._register(ne.as(Jt.Configuration).onDidUpdateConfiguration(({properties:e,defaultsOverrides:t})=>this.onDidUpdateConfiguration(Array.from(e),t))),this.configurationModel}reload(){return this.resetConfigurationModel(),this.configurationModel}onDidUpdateConfiguration(e,t){this.updateConfigurationModel(e,ne.as(Jt.Configuration).getConfigurationProperties()),this._onDidChangeConfiguration.fire({defaults:this.configurationModel,properties:e})}getConfigurationDefaultOverrides(){return{}}resetConfigurationModel(){this._configurationModel=jd.createEmptyModel(this.logService);let e=ne.as(Jt.Configuration).getConfigurationProperties();this.updateConfigurationModel(Object.keys(e),e)}updateConfigurationModel(e,t){let o=this.getConfigurationDefaultOverrides();for(let n of e){let r=o[n],s=t[n];r!==void 0?this._configurationModel.setValue(n,r):s?this._configurationModel.setValue(n,Ji(s.default)):this._configurationModel.removeValue(n)}}},P9t=class{constructor(){this.onDidChangeConfiguration=U.None;this.configurationModel=jd.createEmptyModel(new qgt)}async initialize(){return this.configurationModel}},L2e=class extends x{constructor(e,t,o){super();this.defaultConfiguration=e;this.policyService=t;this.logService=o;this._onDidChangeConfiguration=this._register(new E);this.onDidChangeConfiguration=this._onDidChangeConfiguration.event;this._configurationModel=jd.createEmptyModel(this.logService),this.configurationRegistry=ne.as(Jt.Configuration)}get configurationModel(){return this._configurationModel}async initialize(){return this.logService.trace("PolicyConfiguration#initialize"),this.update(await this.updatePolicyDefinitions(this.defaultConfiguration.configurationModel.keys),!1),this.update(await this.updatePolicyDefinitions(Object.keys(this.configurationRegistry.getExcludedConfigurationProperties())),!1),this._register(this.policyService.onDidChange(e=>this.onDidChangePolicies(e))),this._register(this.defaultConfiguration.onDidChangeConfiguration(async({properties:e})=>this.update(await this.updatePolicyDefinitions(e),!0))),this._configurationModel}async updatePolicyDefinitions(e){this.logService.trace("PolicyConfiguration#updatePolicyDefinitions",e);let t={},o=[],n=this.configurationRegistry.getConfigurationProperties(),r=this.configurationRegistry.getExcludedConfigurationProperties();for(let s of e){let l=n[s]??r[s];if(!l){o.push(s);continue}if(l.policy){if(l.type!=="string"&&l.type!=="number"&&l.type!=="array"&&l.type!=="object"&&l.type!=="boolean"){this.logService.warn(`Policy ${l.policy.name} has unsupported type ${l.type}`);continue}let{value:c}=l.policy;o.push(s),t[l.policy.name]={type:l.type==="number"?"number":l.type==="boolean"?"boolean":"string",value:c}}}return Of(t)||await this.policyService.updatePolicyDefinitions(t),o}onDidChangePolicies(e){this.logService.trace("PolicyConfiguration#onDidChangePolicies",e);let t=this.configurationRegistry.getPolicyConfigurations(),o=di(e.map(n=>t.get(n)));this.update(o,!0)}update(e,t){this.logService.trace("PolicyConfiguration#update",e);let o=this.configurationRegistry.getConfigurationProperties(),n=this.configurationRegistry.getExcludedConfigurationProperties(),r=[],s=this._configurationModel.isEmpty();for(let l of e){let c=o[l]??n[l],u=c?.policy?.name;if(u){let p=this.policyService.getPolicyValue(u);if(Fe(p)&&c.type!=="string")try{p=this.parse(p)}catch(h){this.logService.error(`Error parsing policy value ${u}:`,Pn(h));continue}(s?p!==void 0:!eo(this._configurationModel.getValue(l),p))&&r.push([l,p])}else this._configurationModel.getValue(l)!==void 0&&r.push([l,void 0])}if(r.length){this.logService.trace("PolicyConfiguration#changed",r);let l=this._configurationModel;this._configurationModel=jd.createEmptyModel(this.logService);for(let c of l.keys)this._configurationModel.setValue(c,l.getValue(c));for(let[c,u]of r)u===void 0?this._configurationModel.removeValue(c):this._configurationModel.setValue(c,u);t&&this._onDidChangeConfiguration.fire(this._configurationModel)}}parse(e){let t={},o=null,n=[],r=[],s=[];function l(u){if(Array.isArray(n))n.push(u);else if(o!==null){if(n[o]!==void 0)throw new Error(`Duplicate property found: ${o}`);n[o]=u}}if(e&&(uk(e,{onObjectBegin:()=>{let u={};l(u),r.push(n),n=u,o=null},onObjectProperty:u=>{o=u},onObjectEnd:()=>{n=r.pop()},onArrayBegin:()=>{let u=[];l(u),r.push(n),n=u,o=null},onArrayEnd:()=>{n=r.pop()},onLiteralValue:l,onError:(u,p,h)=>{s.push({error:u,offset:p,length:h})}}),t=n[0]||t),s.length>0)throw new Error(s.map(u=>Pn(u.error)).join(`
`));return t}};L2e=I([m(1,iLe),m(2,se)],L2e);var sSe=class extends KN{constructor(e,t){super(e,t);this._folders=[];this._transient=!1;this._settingsModelParser=new KN(e,t),this._launchModel=jd.createEmptyModel(t),this._tasksModel=jd.createEmptyModel(t)}get folders(){return this._folders}get transient(){return this._transient}get settingsModel(){return this._settingsModelParser.configurationModel}get launchModel(){return this._launchModel}get tasksModel(){return this._tasksModel}reparseWorkspaceSettings(e){this._settingsModelParser.reparse(e)}getRestrictedWorkspaceSettings(){return this._settingsModelParser.restrictedConfigurations}doParseRaw(e,t){return this._folders=e.folders||[],this._transient=Wa(e.transient)&&e.transient,this._settingsModelParser.parseRaw(e.settings,t),this._launchModel=this.createConfigurationModelFrom(e,"launch"),this._tasksModel=this.createConfigurationModelFrom(e,"tasks"),super.doParseRaw(e,t)}createConfigurationModelFrom(e,t){let o=e[t];if(o){let n=Mae(o,l=>console.error(`Conflict in settings file ${this._name}: ${l}`)),r=Object.create(null);r[t]=n;let s=Object.keys(o).map(l=>`${t}.${l}`);return new jd(r,s,[],void 0,this.logService)}return jd.createEmptyModel(this.logService)}},jut=class extends KN{constructor(e,t,o){super(e,o);this.scope=t}doParseRaw(e,t){let o=Mae(e,s=>console.error(`Conflict in settings file ${this._name}: ${s}`)),n=Object.create(null);n[this.scope]=o;let r=Object.keys(e).map(s=>`${this.scope}.${s}`);return{contents:n,keys:r,overrides:[]}}},Qut=class extends $ut{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,t,o,n,r,s,l,c,u,h);this._workspace=p}getValue(e,t={}){return super.getValue(e,t,this._workspace)}inspect(e,t={}){return super.inspect(e,t,this._workspace)}keys(){return super.keys(this._workspace)}compareAndDeleteFolderConfiguration(e){return this._workspace&&this._workspace.folders.length>0&&this._workspace.folders[0].uri.toString()===e.toString()?{keys:[],overrides:[]}:super.compareAndDeleteFolderConfiguration(e)}compare(e){let t=(s,l,c)=>{let u=[];return u.push(...l.filter(p=>s.indexOf(p)===-1)),u.push(...s.filter(p=>l.indexOf(p)===-1)),u.push(...s.filter(p=>l.indexOf(p)===-1?!1:eo(this.getValue(p,{overrideIdentifier:c}),e.getValue(p,{overrideIdentifier:c}))?this._workspace&&this._workspace.folders.some(h=>!eo(this.getValue(p,{resource:h.uri,overrideIdentifier:c}),e.getValue(p,{resource:h.uri,overrideIdentifier:c}))):!0)),u},o=t(this.allKeys(),e.allKeys()),n=[],r=zo([...this.allOverrideIdentifiers(),...e.allOverrideIdentifiers()]);for(let s of r){let l=t(this.getAllKeysForOverrideIdentifier(s),e.getAllKeysForOverrideIdentifier(s),s);l.length&&n.push([s,l])}return{keys:o,overrides:n}}};var A9t=class extends pa{constructor(e,t){super(e);this.code=t}};var R2e=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g){this.remoteSettingsResource=i;this.configurationService=e;this.contextService=t;this.userDataProfileService=o;this.userDataProfilesService=n;this.fileService=r;this.textModelResolverService=s;this.textFileService=l;this.notificationService=c;this.preferencesService=u;this.editorService=p;this.uriIdentityService=h;this.filesConfigurationService=g;this.queue=new uh}async writeConfiguration(i,e,t={}){let o=this.getConfigurationEditOperation(i,e,t.scopes||{});return this.queue.queue(async()=>{try{await this.doWriteConfiguration(o,t)}catch(n){if(t.donotNotifyError)throw n;await this.onError(n,o,t.scopes)}})}async doWriteConfiguration(i,e){await this.validate(i.target,i,!e.handleDirtyFile,e.scopes||{});let t=i.resource,o=await this.resolveModelReference(t);try{let n=this.getFormattingOptions(o.object.textEditorModel);await this.updateConfiguration(i,o.object.textEditorModel,n,e)}finally{o.dispose()}}async updateConfiguration(i,e,t,o){if(this.hasParseErrors(e.getValue(),i))throw this.toConfigurationEditingError(11,i.target,i);if(this.textFileService.isDirty(e.uri)&&o.handleDirtyFile)switch(o.handleDirtyFile){case"save":await this.save(e,i);break;case"revert":await this.textFileService.revert(e.uri);break}let n=this.getEdits(i,e.getValue(),t)[0];if(n){let r;try{r=this.filesConfigurationService.enableAutoSaveAfterShortDelay(e.uri),this.applyEditsToBuffer(n,e)&&await this.save(e,i)}finally{r?.dispose()}}}async save(i,e){try{await this.textFileService.save(i.uri,{ignoreErrorHandler:!0})}catch(t){throw t.fileOperationResult===3?this.toConfigurationEditingError(10,e.target,e):new A9t(d(17452,null,this.stringifyTarget(e.target),t.message),13)}}applyEditsToBuffer(i,e){let t=e.getPositionAt(i.offset),o=e.getPositionAt(i.offset+i.length),n=new z(t.lineNumber,t.column,o.lineNumber,o.column),r=e.getValueInRange(n);if(i.content!==r){let s=r?Hn.replace(n,i.content):Hn.insert(t,i.content);return e.pushEditOperations([new ti(t.lineNumber,t.column,t.lineNumber,t.column)],[s],()=>[]),!0}return!1}getEdits({value:i,jsonPath:e},t,o){return e.length?Mb(t,e,i,o):[{content:JSON.stringify(i,null,o.insertSpaces&&o.tabSize?" ".repeat(o.tabSize):"	"),length:t.length,offset:0}]}getFormattingOptions(i){let{insertSpaces:e,tabSize:t}=i.getOptions(),o=i.getEOL();return{insertSpaces:e,tabSize:t,eol:o}}async onError(i,e,t){switch(i.code){case 11:this.onInvalidConfigurationError(i,e);break;case 9:this.onConfigurationFileDirtyError(i,e,t);break;case 10:return this.doWriteConfiguration(e,{scopes:t,handleDirtyFile:"revert"});default:this.notificationService.error(i.message)}}onInvalidConfigurationError(i,e){let t=e.workspaceStandAloneConfigurationKey===_T?d(17456,null):e.workspaceStandAloneConfigurationKey===R2?d(17454,null):e.workspaceStandAloneConfigurationKey===zv?d(17455,null):null;t?this.notificationService.prompt(ft.Error,i.message,[{label:t,run:()=>this.openFile(e.resource)}]):this.notificationService.prompt(ft.Error,i.message,[{label:d(17453,null),run:()=>this.openSettings(e)}])}onConfigurationFileDirtyError(i,e,t){let o=e.workspaceStandAloneConfigurationKey===_T?d(17456,null):e.workspaceStandAloneConfigurationKey===R2?d(17454,null):null;o?this.notificationService.prompt(ft.Error,i.message,[{label:d(17458,null),run:()=>{let n=e.key?`${e.workspaceStandAloneConfigurationKey}.${e.key}`:e.workspaceStandAloneConfigurationKey;this.writeConfiguration(e.target,{key:n,value:e.value},{handleDirtyFile:"save",scopes:t})}},{label:o,run:()=>this.openFile(e.resource)}]):this.notificationService.prompt(ft.Error,i.message,[{label:d(17458,null),run:()=>this.writeConfiguration(e.target,{key:e.key,value:e.value},{handleDirtyFile:"save",scopes:t})},{label:d(17453,null),run:()=>this.openSettings(e)}])}openSettings(i){let e={jsonEditor:!0};switch(i.target){case 1:this.preferencesService.openUserSettings(e);break;case 2:this.preferencesService.openRemoteSettings(e);break;case 3:this.preferencesService.openWorkspaceSettings(e);break;case 4:if(i.resource){let t=this.contextService.getWorkspaceFolder(i.resource);t&&this.preferencesService.openFolderSettings({folderUri:t.uri,jsonEditor:!0})}break}}openFile(i){this.editorService.openEditor({resource:i,options:{pinned:!0}})}toConfigurationEditingError(i,e,t){let o=this.toErrorMessage(i,e,t);return new A9t(o,i)}toErrorMessage(i,e,t){switch(i){case 12:return d(17444,null,t.key);case 0:return d(17450,null,this.stringifyTarget(e),t.key);case 1:return d(17436,null,t.key);case 2:return d(17437,null,t.key);case 3:return d(17428,null,t.key);case 4:return d(17435,null,t.key);case 5:return d(17438,null,t.key);case 6:return d(17429,null);case 7:return d(17433,null,t.key);case 8:return d(17443,null,this.stringifyTarget(e));case 11:{if(t.workspaceStandAloneConfigurationKey===_T)return d(17434,null);if(t.workspaceStandAloneConfigurationKey===R2)return d(17430,null);if(t.workspaceStandAloneConfigurationKey===zv)return d(17431,null);switch(e){case 1:return d(17425,null);case 2:return d(17432,null);case 3:return d(17427,null);case 4:{let o="<<unknown>>";if(t.resource){let n=this.contextService.getWorkspaceFolder(t.resource);n&&(o=n.name)}return d(17426,null,o)}default:return""}}case 9:{if(t.workspaceStandAloneConfigurationKey===_T)return d(17447,null);if(t.workspaceStandAloneConfigurationKey===R2)return d(17439,null);if(t.workspaceStandAloneConfigurationKey===zv)return d(17441,null);switch(e){case 1:return d(17419,null);case 2:return d(17445,null);case 3:return d(17421,null);case 4:{let o="<<unknown>>";if(t.resource){let n=this.contextService.getWorkspaceFolder(t.resource);n&&(o=n.name)}return d(17420,null,o)}default:return""}}case 10:if(t.workspaceStandAloneConfigurationKey===_T)return d(17448,null);if(t.workspaceStandAloneConfigurationKey===R2)return d(17440,null);if(t.workspaceStandAloneConfigurationKey===zv)return d(17442,null);switch(e){case 1:return d(17422,null);case 2:return d(17446,null);case 3:return d(17424,null);case 4:return d(17423,null)}case 13:return d(17449,null,this.stringifyTarget(e))}}stringifyTarget(i){switch(i){case 1:return d(17459,null);case 2:return d(17457,null);case 3:return d(17460,null);case 4:return d(17451,null);default:return""}}defaultResourceValue(i){let e=this.uriIdentityService.extUri.basename(i);return e.substr(0,e.length-this.uriIdentityService.extUri.extname(i).length)===_T?wlo:"{}"}async resolveModelReference(i){return await this.fileService.exists(i)||await this.textFileService.write(i,this.defaultResourceValue(i),{encoding:"utf8"}),this.textModelResolverService.createModelReference(i)}hasParseErrors(i,e){if(e.workspaceStandAloneConfigurationKey&&!e.key)return!1;let t=[];return jr(i,t,{allowTrailingComma:!0,allowEmptyContent:!0}),t.length>0}async validate(i,e,t,o){if(this.configurationService.inspect(e.key).policyValue!==void 0)throw this.toConfigurationEditingError(12,i,e);let r=ne.as(Jt.Configuration).getConfigurationProperties()[e.key]?.scope;if(!e.workspaceStandAloneConfigurationKey&&this.configurationService.keys().default.indexOf(e.key)<0&&!kg.test(e.key)&&e.value!==void 0)throw this.toConfigurationEditingError(0,i,e);if(e.workspaceStandAloneConfigurationKey&&e.workspaceStandAloneConfigurationKey!==_T&&e.workspaceStandAloneConfigurationKey!==zv&&(i===1||i===2))throw this.toConfigurationEditingError(4,i,e);if((i===3||i===4)&&this.contextService.getWorkbenchState()===1)throw this.toConfigurationEditingError(8,i,e);if(i===3&&!e.workspaceStandAloneConfigurationKey&&!kg.test(e.key)){if(r&&Kw.includes(r))throw this.toConfigurationEditingError(1,i,e);if(r===2)throw this.toConfigurationEditingError(2,i,e)}if(i===4){if(!e.resource)throw this.toConfigurationEditingError(6,i,e);if(!e.workspaceStandAloneConfigurationKey&&!kg.test(e.key)&&r!==void 0&&!UZ.includes(r))throw this.toConfigurationEditingError(3,i,e)}if(o.overrideIdentifiers?.length&&r!==6)throw this.toConfigurationEditingError(7,i,e);if(!e.resource)throw this.toConfigurationEditingError(6,i,e);if(t&&this.textFileService.isDirty(e.resource))throw this.toConfigurationEditingError(9,i,e)}getConfigurationEditOperation(i,e,t){if(e.key){let c=i===1?aFt:RD,u=Object.keys(c);for(let p of u){let h=this.getConfigurationFileResource(i,p,c[p],t.resource,void 0);if(e.key===p){let f=this.isWorkspaceConfigurationResource(h)?[p]:[];return{key:f[f.length-1],jsonPath:f,value:e.value,resource:h??void 0,workspaceStandAloneConfigurationKey:p,target:i}}let g=`${p}.`;if(e.key.indexOf(g)===0){let f=this.isWorkspaceConfigurationResource(h)?[p,e.key.substring(g.length)]:[e.key.substring(g.length)];return{key:f[f.length-1],jsonPath:f,value:e.value,resource:h??void 0,workspaceStandAloneConfigurationKey:p,target:i}}}}let o=e.key,r=ne.as(Jt.Configuration).getConfigurationProperties()[o]?.scope,s=t.overrideIdentifiers?.length?[yft(t.overrideIdentifiers),o]:[o];if(i===1||i===2)return{key:o,jsonPath:s,value:e.value,resource:this.getConfigurationFileResource(i,o,"",null,r)??void 0,target:i};let l=this.getConfigurationFileResource(i,o,glo,t.resource,r);return this.isWorkspaceConfigurationResource(l)&&(s=["settings",...s]),{key:o,jsonPath:s,value:e.value,resource:l??void 0,target:i}}isWorkspaceConfigurationResource(i){let e=this.contextService.getWorkspace();return!!(e.configuration&&i&&e.configuration.fsPath===i.fsPath)}getConfigurationFileResource(i,e,t,o,n){if(i===1)return e===_T?this.userDataProfileService.currentProfile.tasksResource:e===zv?this.userDataProfileService.currentProfile.mcpResource:!this.userDataProfileService.currentProfile.isDefault&&this.configurationService.isSettingAppliedForAllProfiles(e)?this.userDataProfilesService.defaultProfile.settingsResource:this.userDataProfileService.currentProfile.settingsResource;if(i===2)return this.remoteSettingsResource;let r=this.contextService.getWorkbenchState();if(r!==1){let s=this.contextService.getWorkspace();if(i===3){if(r===3)return s.configuration??null;if(r===2)return s.folders[0].toResource(t)}if(i===4&&o){let l=this.contextService.getWorkspaceFolder(o);if(l)return l.toResource(t)}}return null}};R2e=I([m(1,fg),m(2,Pe),m(3,ln),m(4,an),m(5,fe),m(6,Bt),m(7,Uo),m(8,Ne),m(9,Go),m(10,ee),m(11,ht),m(12,gr)],R2e);var N9t=class a extends M9t{constructor(e,t,o,n){super(n);this.configurationCache=t;this.configurationRegistry=ne.as(Jt.Configuration);this.cachedConfigurationDefaultsOverrides={};this.cacheKey={type:"defaults",key:`${e}-configurationDefaultsOverrides`},o.options?.configurationDefaults&&this.configurationRegistry.registerDefaultConfigurations([{overrides:o.options.configurationDefaults}])}static{this.DEFAULT_OVERRIDES_CACHE_EXISTS_KEY="DefaultOverridesCacheExists"}getConfigurationDefaultOverrides(){return this.cachedConfigurationDefaultsOverrides}async initialize(){return await this.initializeCachedConfigurationDefaultsOverrides(),super.initialize()}reload(){return this.cachedConfigurationDefaultsOverrides={},this.updateCachedConfigurationDefaultsOverrides(),super.reload()}hasCachedConfigurationDefaultsOverrides(){return!Of(this.cachedConfigurationDefaultsOverrides)}initializeCachedConfigurationDefaultsOverrides(){return this.initiaizeCachedConfigurationDefaultsOverridesPromise||(this.initiaizeCachedConfigurationDefaultsOverridesPromise=(async()=>{try{if(localStorage.getItem(a.DEFAULT_OVERRIDES_CACHE_EXISTS_KEY)){let e=await this.configurationCache.read(this.cacheKey);e&&(this.cachedConfigurationDefaultsOverrides=JSON.parse(e))}}catch{}this.cachedConfigurationDefaultsOverrides=xi(this.cachedConfigurationDefaultsOverrides)?this.cachedConfigurationDefaultsOverrides:{}})()),this.initiaizeCachedConfigurationDefaultsOverridesPromise}onDidUpdateConfiguration(e,t){super.onDidUpdateConfiguration(e,t),t&&this.updateCachedConfigurationDefaultsOverrides()}async updateCachedConfigurationDefaultsOverrides(){let e={},t=this.configurationRegistry.getRegisteredDefaultConfigurations();for(let o of t)if(!o.donotCache){for(let[n,r]of Object.entries(o.overrides))if(!kg.test(n)&&r!==void 0){let s=e[n];xi(s)&&xi(r)?e[n]={...s,...r}:e[n]=r}}try{Object.keys(e).length?(localStorage.setItem(a.DEFAULT_OVERRIDES_CACHE_EXISTS_KEY,"yes"),await this.configurationCache.write(this.cacheKey,JSON.stringify(e))):(localStorage.removeItem(a.DEFAULT_OVERRIDES_CACHE_EXISTS_KEY),await this.configurationCache.remove(this.cacheKey))}catch{}}},O9t=class extends qut{constructor(e,t,o,n){super(e.defaultProfile.settingsResource,{scopes:Kw,skipUnregistered:!0},o.extUri,t,n);this._onDidChangeConfiguration=this._register(new E);this.onDidChangeConfiguration=this._onDidChangeConfiguration.event;this._register(this.onDidChange(()=>this.reloadConfigurationScheduler.schedule())),this.reloadConfigurationScheduler=this._register(new Dt(()=>this.loadConfiguration().then(r=>this._onDidChangeConfiguration.fire(r)),50))}async initialize(){return this.loadConfiguration()}async loadConfiguration(){let e=await super.loadConfiguration(),t=e.getValue(Ty),o=Array.isArray(t)?t:[];return this.parseOptions.include||o.length?this.reparse({...this.parseOptions,include:o}):e}},F9t=class extends x{constructor(e,t,o,n,r,s,l){super();this.settingsResource=e;this.tasksResource=t;this.mcpResource=o;this.configurationParseOptions=n;this.fileService=r;this.uriIdentityService=s;this.logService=l;this._onDidChangeConfiguration=this._register(new E);this.onDidChangeConfiguration=this._onDidChangeConfiguration.event;this.userConfiguration=this._register(new me);this.userConfigurationChangeDisposable=this._register(new me);this.userConfiguration.value=new qut(e,this.configurationParseOptions,s.extUri,this.fileService,l),this.userConfigurationChangeDisposable.value=this.userConfiguration.value.onDidChange(()=>this.reloadConfigurationScheduler.schedule()),this.reloadConfigurationScheduler=this._register(new Dt(()=>this.userConfiguration.value.loadConfiguration().then(c=>this._onDidChangeConfiguration.fire(c)),50))}get hasTasksLoaded(){return this.userConfiguration.value instanceof P2e}async reset(e,t,o,n){return this.settingsResource=e,this.tasksResource=t,this.mcpResource=o,this.configurationParseOptions=n,this.doReset()}async doReset(e){let t=this.uriIdentityService.extUri.dirname(this.settingsResource),o=[];this.tasksResource&&o.push([_T,this.tasksResource]),this.mcpResource&&o.push([zv,this.mcpResource]);let n=new P2e(t.toString(),this.settingsResource,o,this.configurationParseOptions,this.fileService,this.uriIdentityService,this.logService),r=await n.loadConfiguration(e);return this.userConfiguration.value=n,this.userConfigurationChangeDisposable.value&&(this.userConfigurationChangeDisposable.value=this.userConfiguration.value.onDidChange(()=>this.reloadConfigurationScheduler.schedule())),r}async initialize(){return this.userConfiguration.value.loadConfiguration()}async reload(e){return this.hasTasksLoaded?this.userConfiguration.value.loadConfiguration():this.doReset(e)}reparse(e){return this.configurationParseOptions={...this.configurationParseOptions,...e},this.userConfiguration.value.reparse(this.configurationParseOptions)}getRestrictedSettings(){return this.userConfiguration.value.getRestrictedSettings()}},P2e=class extends x{constructor(e,t,o,n,r,s,l){super();this.settingsResource=t;this.standAloneConfigurationResources=o;this.fileService=r;this.uriIdentityService=s;this.logService=l;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this.allResources=[this.settingsResource,...this.standAloneConfigurationResources.map(([,c])=>c)],this._register(wn(...this.allResources.map(c=>wn(this.fileService.watch(s.extUri.dirname(c)),this.fileService.watch(c))))),this._folderSettingsModelParser=new KN(e,l),this._folderSettingsParseOptions=n,this._standAloneConfigurations=[],this._cache=jd.createEmptyModel(this.logService),this._register(U.debounce(U.any(U.filter(this.fileService.onDidFilesChange,c=>this.handleFileChangesEvent(c)),U.filter(this.fileService.onDidRunOperation,c=>this.handleFileOperationEvent(c))),()=>{},100)(()=>this._onDidChange.fire()))}async resolveContents(e){let t=async r=>Promise.all(r.map(async s=>{try{return(await this.fileService.readFile(s,{atomic:!0})).value.toString()}catch(l){this.logService.trace(`Error while resolving configuration file '${s.toString()}': ${Pn(l)}`),l.fileOperationResult!==1&&l.fileOperationResult!==9&&this.logService.error(l)}return"{}"})),[[o],n]=await Promise.all([e?Promise.resolve([void 0]):t([this.settingsResource]),t(this.standAloneConfigurationResources.map(([,r])=>r))]);return[o,n.map((r,s)=>[this.standAloneConfigurationResources[s][0],r])]}async loadConfiguration(e){let[t,o]=await this.resolveContents(!!e);this._standAloneConfigurations=[],this._folderSettingsModelParser.parse("",this._folderSettingsParseOptions),t!==void 0&&this._folderSettingsModelParser.parse(t,this._folderSettingsParseOptions);for(let n=0;n<o.length;n++){let r=o[n][1];if(r!==void 0){let s=new jut(this.standAloneConfigurationResources[n][1].toString(),this.standAloneConfigurationResources[n][0],this.logService);s.parse(r),this._standAloneConfigurations.push(s.configurationModel)}}return this.consolidate(e),this._cache}getRestrictedSettings(){return this._folderSettingsModelParser.restrictedConfigurations}reparse(e){let t=this._folderSettingsModelParser.configurationModel.contents;return this._folderSettingsParseOptions=e,this._folderSettingsModelParser.reparse(this._folderSettingsParseOptions),eo(t,this._folderSettingsModelParser.configurationModel.contents)||this.consolidate(),this._cache}consolidate(e){this._cache=(e??this._folderSettingsModelParser.configurationModel).merge(...this._standAloneConfigurations)}handleFileChangesEvent(e){return!!(this.allResources.some(t=>e.contains(t))||this.allResources.some(t=>e.contains(this.uriIdentityService.extUri.dirname(t),2)))}handleFileOperationEvent(e){return!!((e.isOperation(0)||e.isOperation(3)||e.isOperation(1)||e.isOperation(4))&&this.allResources.some(t=>this.uriIdentityService.extUri.isEqual(e.resource,t))||e.isOperation(1)&&this.allResources.some(t=>this.uriIdentityService.extUri.isEqual(e.resource,this.uriIdentityService.extUri.dirname(t))))}},W9t=class extends x{constructor(e,t,o,n,r,s){super();this._userConfigurationInitializationPromise=null;this._onDidChangeConfiguration=this._register(new E);this.onDidChangeConfiguration=this._onDidChangeConfiguration.event;this._onDidInitialize=this._register(new E);this.onDidInitialize=this._onDidInitialize.event;this._fileService=o,this._userConfiguration=this._cachedConfiguration=new z1i(e,t,{scopes:yLe},s),r.getEnvironment().then(async l=>{if(l){let c=this._register(new Yut(l.settingsPath,{scopes:yLe},this._fileService,n,s));this._register(c.onDidChangeConfiguration(p=>this.onDidUserConfigurationChange(p))),this._userConfigurationInitializationPromise=c.initialize();let u=await this._userConfigurationInitializationPromise;this._userConfiguration.dispose(),this._userConfiguration=c,this.onDidUserConfigurationChange(u),this._onDidInitialize.fire(u)}})}async initialize(){if(this._userConfiguration instanceof Yut)return this._userConfiguration.initialize();let e=await this._userConfiguration.initialize();return this._userConfigurationInitializationPromise&&(e=await this._userConfigurationInitializationPromise,this._userConfigurationInitializationPromise=null),e}reload(){return this._userConfiguration.reload()}reparse(){return this._userConfiguration.reparse({scopes:yLe})}getRestrictedSettings(){return this._userConfiguration.getRestrictedSettings()}onDidUserConfigurationChange(e){this.updateCache(),this._onDidChangeConfiguration.fire(e)}async updateCache(){if(this._userConfiguration instanceof Yut){let e;try{e=await this._userConfiguration.resolveContent()}catch(t){if(t.fileOperationResult!==1)return}await this._cachedConfiguration.updateConfiguration(e)}}},Yut=class extends x{constructor(e,t,o,n,r){super();this.configurationResource=e;this.fileService=o;this.uriIdentityService=n;this.logService=r;this._onDidChangeConfiguration=this._register(new E);this.onDidChangeConfiguration=this._onDidChangeConfiguration.event;this.fileWatcherDisposable=this._register(new me);this.directoryWatcherDisposable=this._register(new me);this.parser=new KN(this.configurationResource.toString(),r),this.parseOptions=t,this._register(o.onDidFilesChange(s=>this.handleFileChangesEvent(s))),this._register(o.onDidRunOperation(s=>this.handleFileOperationEvent(s))),this.reloadConfigurationScheduler=this._register(new Dt(()=>this.reload().then(s=>this._onDidChangeConfiguration.fire(s)),50)),this._register(Z(()=>{this.stopWatchingResource(),this.stopWatchingDirectory()}))}watchResource(){this.fileWatcherDisposable.value=this.fileService.watch(this.configurationResource)}stopWatchingResource(){this.fileWatcherDisposable.value=void 0}watchDirectory(){let e=this.uriIdentityService.extUri.dirname(this.configurationResource);this.directoryWatcherDisposable.value=this.fileService.watch(e)}stopWatchingDirectory(){this.directoryWatcherDisposable.value=void 0}async initialize(){let e=await this.fileService.exists(this.configurationResource);return this.onResourceExists(e),this.reload()}async resolveContent(){return(await this.fileService.readFile(this.configurationResource,{atomic:!0})).value.toString()}async reload(){try{let e=await this.resolveContent();return this.parser.parse(e,this.parseOptions),this.parser.configurationModel}catch{return jd.createEmptyModel(this.logService)}}reparse(e){return this.parseOptions=e,this.parser.reparse(this.parseOptions),this.parser.configurationModel}getRestrictedSettings(){return this.parser.restrictedConfigurations}handleFileChangesEvent(e){let t=!1;e.contains(this.configurationResource,1)?(t=!0,this.onResourceExists(!0)):e.contains(this.configurationResource,2)?(t=!0,this.onResourceExists(!1)):e.contains(this.configurationResource,0)&&(t=!0),t&&this.reloadConfigurationScheduler.schedule()}handleFileOperationEvent(e){(e.isOperation(0)||e.isOperation(3)||e.isOperation(1)||e.isOperation(4))&&this.uriIdentityService.extUri.isEqual(e.resource,this.configurationResource)&&this.reloadConfigurationScheduler.schedule()}onResourceExists(e){e?(this.stopWatchingDirectory(),this.watchResource()):(this.stopWatchingResource(),this.watchDirectory())}},z1i=class extends x{constructor(e,t,o,n){super();this.configurationCache=t;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this.key={type:"user",key:e},this.parser=new KN("CachedRemoteUserConfiguration",n),this.parseOptions=o,this.configurationModel=jd.createEmptyModel(n)}getConfigurationModel(){return this.configurationModel}initialize(){return this.reload()}reparse(e){return this.parseOptions=e,this.parser.reparse(this.parseOptions),this.configurationModel=this.parser.configurationModel,this.configurationModel}getRestrictedSettings(){return this.parser.restrictedConfigurations}async reload(){try{let e=await this.configurationCache.read(this.key),t=JSON.parse(e);t.content&&(this.parser.parse(t.content,this.parseOptions),this.configurationModel=this.parser.configurationModel)}catch{}return this.configurationModel}async updateConfiguration(e){return e?this.configurationCache.write(this.key,JSON.stringify({content:e})):this.configurationCache.remove(this.key)}},V9t=class extends x{constructor(e,t,o,n){super();this.configurationCache=e;this.fileService=t;this.uriIdentityService=o;this.logService=n;this._workspaceConfigurationDisposables=this._register(new N);this._workspaceIdentifier=null;this._isWorkspaceTrusted=!1;this._onDidUpdateConfiguration=this._register(new E);this.onDidUpdateConfiguration=this._onDidUpdateConfiguration.event;this._initialized=!1;this.fileService=t,this._workspaceConfiguration=this._cachedConfiguration=new K1i(e,n)}get initialized(){return this._initialized}async initialize(e,t){this._workspaceIdentifier=e,this._isWorkspaceTrusted=t,this._initialized||(this.configurationCache.needsCaching(this._workspaceIdentifier.configPath)?(this._workspaceConfiguration=this._cachedConfiguration,this.waitAndInitialize(this._workspaceIdentifier)):this.doInitialize(new M2e(this.fileService,this.uriIdentityService,this.logService))),await this.reload()}async reload(){this._workspaceIdentifier&&await this._workspaceConfiguration.load(this._workspaceIdentifier,{scopes:y3,skipRestricted:this.isUntrusted()})}getFolders(){return this._workspaceConfiguration.getFolders()}setFolders(e,t){return this._workspaceIdentifier?t.write(this._workspaceIdentifier.configPath,[{path:["folders"],value:e}],!0).then(()=>this.reload()):Promise.resolve()}isTransient(){return this._workspaceConfiguration.isTransient()}getConfiguration(){return this._workspaceConfiguration.getWorkspaceSettings()}updateWorkspaceTrust(e){return this._isWorkspaceTrusted=e,this.reparseWorkspaceSettings()}reparseWorkspaceSettings(){return this._workspaceConfiguration.reparseWorkspaceSettings({scopes:y3,skipRestricted:this.isUntrusted()}),this.getConfiguration()}getRestrictedSettings(){return this._workspaceConfiguration.getRestrictedSettings()}async waitAndInitialize(e){if(await Zti(e.configPath,this.fileService),!(this._workspaceConfiguration instanceof M2e)){let t=this._register(new M2e(this.fileService,this.uriIdentityService,this.logService));await t.load(e,{scopes:y3,skipRestricted:this.isUntrusted()}),this.doInitialize(t),this.onDidWorkspaceConfigurationChange(!1,!0)}}doInitialize(e){this._workspaceConfigurationDisposables.clear(),this._workspaceConfiguration=this._workspaceConfigurationDisposables.add(e),this._workspaceConfigurationDisposables.add(this._workspaceConfiguration.onDidChange(t=>this.onDidWorkspaceConfigurationChange(!0,!1))),this._initialized=!0}isUntrusted(){return!this._isWorkspaceTrusted}async onDidWorkspaceConfigurationChange(e,t){e&&await this.reload(),this.updateCache(),this._onDidUpdateConfiguration.fire(t)}async updateCache(){if(this._workspaceIdentifier&&this.configurationCache.needsCaching(this._workspaceIdentifier.configPath)&&this._workspaceConfiguration instanceof M2e){let e=await this._workspaceConfiguration.resolveContent(this._workspaceIdentifier);await this._cachedConfiguration.updateWorkspace(this._workspaceIdentifier,e)}}},M2e=class extends x{constructor(e,t,o){super();this.fileService=e;this.logService=o;this._workspaceIdentifier=null;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this.workspaceConfigurationModelParser=new sSe("",o),this.workspaceSettings=jd.createEmptyModel(o),this._register(U.any(U.filter(this.fileService.onDidFilesChange,n=>!!this._workspaceIdentifier&&n.contains(this._workspaceIdentifier.configPath)),U.filter(this.fileService.onDidRunOperation,n=>!!this._workspaceIdentifier&&(n.isOperation(0)||n.isOperation(3)||n.isOperation(1)||n.isOperation(4))&&t.extUri.isEqual(n.resource,this._workspaceIdentifier.configPath)))(()=>this.reloadConfigurationScheduler.schedule())),this.reloadConfigurationScheduler=this._register(new Dt(()=>this._onDidChange.fire(),50)),this.workspaceConfigWatcher=this._register(this.watchWorkspaceConfigurationFile())}get workspaceIdentifier(){return this._workspaceIdentifier}async resolveContent(e){return(await this.fileService.readFile(e.configPath,{atomic:!0})).value.toString()}async load(e,t){(!this._workspaceIdentifier||this._workspaceIdentifier.id!==e.id)&&(this._workspaceIdentifier=e,this.workspaceConfigurationModelParser=new sSe(this._workspaceIdentifier.id,this.logService),Be(this.workspaceConfigWatcher),this.workspaceConfigWatcher=this._register(this.watchWorkspaceConfigurationFile()));let o="";try{o=await this.resolveContent(this._workspaceIdentifier)}catch(n){await this.fileService.exists(this._workspaceIdentifier.configPath)&&this.logService.error(n)}this.workspaceConfigurationModelParser.parse(o,t),this.consolidate()}getConfigurationModel(){return this.workspaceConfigurationModelParser.configurationModel}getFolders(){return this.workspaceConfigurationModelParser.folders}isTransient(){return this.workspaceConfigurationModelParser.transient}getWorkspaceSettings(){return this.workspaceSettings}reparseWorkspaceSettings(e){return this.workspaceConfigurationModelParser.reparseWorkspaceSettings(e),this.consolidate(),this.getWorkspaceSettings()}getRestrictedSettings(){return this.workspaceConfigurationModelParser.getRestrictedWorkspaceSettings()}consolidate(){this.workspaceSettings=this.workspaceConfigurationModelParser.settingsModel.merge(this.workspaceConfigurationModelParser.launchModel,this.workspaceConfigurationModelParser.tasksModel)}watchWorkspaceConfigurationFile(){return this._workspaceIdentifier?this.fileService.watch(this._workspaceIdentifier.configPath):x.None}},K1i=class{constructor(i,e){this.configurationCache=i;this.logService=e;this.onDidChange=U.None;this.workspaceConfigurationModelParser=new sSe("",e),this.workspaceSettings=jd.createEmptyModel(e)}async load(i,e){try{let t=this.getKey(i),o=await this.configurationCache.read(t),n=JSON.parse(o);n.content&&(this.workspaceConfigurationModelParser=new sSe(t.key,this.logService),this.workspaceConfigurationModelParser.parse(n.content,e),this.consolidate())}catch{}}get workspaceIdentifier(){return null}getConfigurationModel(){return this.workspaceConfigurationModelParser.configurationModel}getFolders(){return this.workspaceConfigurationModelParser.folders}isTransient(){return this.workspaceConfigurationModelParser.transient}getWorkspaceSettings(){return this.workspaceSettings}reparseWorkspaceSettings(i){return this.workspaceConfigurationModelParser.reparseWorkspaceSettings(i),this.consolidate(),this.getWorkspaceSettings()}getRestrictedSettings(){return this.workspaceConfigurationModelParser.getRestrictedWorkspaceSettings()}consolidate(){this.workspaceSettings=this.workspaceConfigurationModelParser.settingsModel.merge(this.workspaceConfigurationModelParser.launchModel,this.workspaceConfigurationModelParser.tasksModel)}async updateWorkspace(i,e){try{let t=this.getKey(i);e?await this.configurationCache.write(t,JSON.stringify({content:e})):await this.configurationCache.remove(t)}catch{}}getKey(i){return{type:"workspaces",key:i.id}}},G1i=class{constructor(i,e,t,o,n){this.configurationCache=o;this.logService=n;this.onDidChange=U.None;this.key={type:"folder",key:_r(Ge(i,e).toString()).toString(16)},this._folderSettingsModelParser=new KN("CachedFolderConfiguration",n),this._folderSettingsParseOptions=t,this._standAloneConfigurations=[],this.configurationModel=jd.createEmptyModel(n)}async loadConfiguration(){try{let i=await this.configurationCache.read(this.key),{content:e}=JSON.parse(i.toString());if(e)for(let t of Object.keys(e))if(t===eJe)this._folderSettingsModelParser.parse(e[t],this._folderSettingsParseOptions);else{let o=new jut(t,t,this.logService);o.parse(e[t]),this._standAloneConfigurations.push(o.configurationModel)}this.consolidate()}catch{}return this.configurationModel}async updateConfiguration(i,e){let t={};i&&(t[eJe]=i),e.forEach(([o,n])=>{n&&(t[o]=n)}),Object.keys(t).length?await this.configurationCache.write(this.key,JSON.stringify({content:t})):await this.configurationCache.remove(this.key)}getRestrictedSettings(){return this._folderSettingsModelParser.restrictedConfigurations}reparse(i){return this._folderSettingsParseOptions=i,this._folderSettingsModelParser.reparse(this._folderSettingsParseOptions),this.consolidate(),this.configurationModel}consolidate(){this.configurationModel=this._folderSettingsModelParser.configurationModel.merge(...this._standAloneConfigurations)}getUnsupportedKeys(){return[]}},B9t=class extends x{constructor(e,t,o,n,r,s,l,c,u){super();this.workspaceFolder=t;this.workbenchState=n;this.workspaceTrusted=r;this.configurationCache=u;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this.scopes=3===this.workbenchState?UZ:y3,this.configurationFolder=l.extUri.joinPath(t.uri,o),this.cachedFolderConfiguration=new G1i(t.uri,o,{scopes:this.scopes,skipRestricted:this.isUntrusted()},u,c),e&&this.configurationCache.needsCaching(t.uri)?(this.folderConfiguration=this.cachedFolderConfiguration,Zti(t.uri,s).then(()=>{this.folderConfiguration=this._register(this.createFileServiceBasedConfiguration(s,l,c)),this._register(this.folderConfiguration.onDidChange(p=>this.onDidFolderConfigurationChange())),this.onDidFolderConfigurationChange()})):(this.folderConfiguration=this._register(this.createFileServiceBasedConfiguration(s,l,c)),this._register(this.folderConfiguration.onDidChange(p=>this.onDidFolderConfigurationChange())))}loadConfiguration(){return this.folderConfiguration.loadConfiguration()}updateWorkspaceTrust(e){return this.workspaceTrusted=e,this.reparse()}reparse(){let e=this.folderConfiguration.reparse({scopes:this.scopes,skipRestricted:this.isUntrusted()});return this.updateCache(),e}getRestrictedSettings(){return this.folderConfiguration.getRestrictedSettings()}isUntrusted(){return!this.workspaceTrusted}onDidFolderConfigurationChange(){this.updateCache(),this._onDidChange.fire()}createFileServiceBasedConfiguration(e,t,o){let n=t.extUri.joinPath(this.configurationFolder,`${eJe}.json`),r=[_T,R2,zv].map(s=>[s,t.extUri.joinPath(this.configurationFolder,`${s}.json`)]);return new P2e(this.configurationFolder.toString(),n,r,{scopes:this.scopes,skipRestricted:this.isUntrusted()},e,t,o)}async updateCache(){if(this.configurationCache.needsCaching(this.configurationFolder)&&this.folderConfiguration instanceof P2e){let[e,t]=await this.folderConfiguration.resolveContents();this.cachedFolderConfiguration.updateConfiguration(e,t)}}addRelated(e){this._register(e)}};function NPo(a,i){return a.isDefault||a.useDefaultFlags?.settings?i?sFt:void 0:i?byi:ylo}var Jut=class extends awt{constructor(){super(...arguments);this.initialized=!1}},H9t=class extends x{constructor({remoteAuthority:e,configurationCache:t},o,n,r,s,l,c,u,p){super();this.userDataProfileService=n;this.userDataProfilesService=r;this.fileService=s;this.remoteAgentService=l;this.uriIdentityService=c;this.logService=u;this.initialized=!1;this.applicationConfiguration=null;this.remoteUserConfiguration=null;this.cachedFolderConfigs=this._register(new Vt(new gt));this._onDidChangeConfiguration=this._register(new E);this.onDidChangeConfiguration=this._onDidChangeConfiguration.event;this._onWillChangeWorkspaceFolders=this._register(new E);this.onWillChangeWorkspaceFolders=this._onWillChangeWorkspaceFolders.event;this._onDidChangeWorkspaceFolders=this._register(new E);this.onDidChangeWorkspaceFolders=this._onDidChangeWorkspaceFolders.event;this._onDidChangeWorkspaceName=this._register(new E);this.onDidChangeWorkspaceName=this._onDidChangeWorkspaceName.event;this._onDidChangeWorkbenchState=this._register(new E);this.onDidChangeWorkbenchState=this._onDidChangeWorkbenchState.event;this.isWorkspaceTrusted=!0;this._restrictedSettings={default:[]};this._onDidChangeRestrictedSettings=this._register(new E);this.onDidChangeRestrictedSettings=this._onDidChangeRestrictedSettings.event;if(this.configurationRegistry=ne.as(Jt.Configuration),this.initRemoteUserConfigurationBarrier=new gp,this.completeWorkspaceBarrier=new gp,this.defaultConfiguration=this._register(new N9t(n.currentProfile.id,t,o,u)),this.policyConfiguration=p instanceof EOt?new P9t:this._register(new L2e(this.defaultConfiguration,p,u)),this.configurationCache=t,this._configuration=new Qut(this.defaultConfiguration.configurationModel,this.policyConfiguration.configurationModel,jd.createEmptyModel(u),jd.createEmptyModel(u),jd.createEmptyModel(u),jd.createEmptyModel(u),new gt,jd.createEmptyModel(u),new gt,this.workspace,u),this.applicationConfigurationDisposables=this._register(new N),this.createApplicationConfiguration(),this.localUserConfiguration=this._register(new F9t(n.currentProfile.settingsResource,n.currentProfile.tasksResource,n.currentProfile.mcpResource,{scopes:NPo(n.currentProfile,!!e)},s,c,u)),this._register(this.localUserConfiguration.onDidChangeConfiguration(h=>this.onLocalUserConfigurationChanged(h))),e){let h=this.remoteUserConfiguration=this._register(new W9t(e,t,s,c,l,u));this._register(h.onDidInitialize(g=>{this._register(h.onDidChangeConfiguration(f=>this.onRemoteUserConfigurationChanged(f))),this.onRemoteUserConfigurationChanged(g),this.initRemoteUserConfigurationBarrier.open()}))}else this.initRemoteUserConfigurationBarrier.open();this.workspaceConfiguration=this._register(new V9t(t,s,c,u)),this._register(this.workspaceConfiguration.onDidUpdateConfiguration(h=>{this.onWorkspaceConfigurationChanged(h).then(()=>{this.workspace.initialized=this.workspaceConfiguration.initialized,this.checkAndMarkWorkspaceComplete(h)})})),this._register(this.defaultConfiguration.onDidChangeConfiguration(({properties:h,defaults:g})=>this.onDefaultConfigurationChanged(g,h))),this._register(this.policyConfiguration.onDidChangeConfiguration(h=>this.onPolicyConfigurationChanged(h))),this._register(n.onDidChangeCurrentProfile(h=>this.onUserDataProfileChanged(h))),this.workspaceEditingQueue=new uh}get restrictedSettings(){return this._restrictedSettings}createApplicationConfiguration(){this.applicationConfigurationDisposables.clear(),this.userDataProfileService.currentProfile.isDefault||this.userDataProfileService.currentProfile.useDefaultFlags?.settings?this.applicationConfiguration=null:(this.applicationConfiguration=this.applicationConfigurationDisposables.add(this._register(new O9t(this.userDataProfilesService,this.fileService,this.uriIdentityService,this.logService))),this.applicationConfigurationDisposables.add(this.applicationConfiguration.onDidChangeConfiguration(e=>this.onApplicationConfigurationChanged(e))))}async getCompleteWorkspace(){return await this.completeWorkspaceBarrier.wait(),this.getWorkspace()}getWorkspace(){return this.workspace}getWorkbenchState(){return this.workspace.configuration?3:this.workspace.folders.length===1?2:1}hasWorkspaceData(){return this.getWorkbenchState()!==1}getWorkspaceFolder(e){return this.workspace.getFolder(e)}addFolders(e,t){return this.updateFolders(e,[],t)}removeFolders(e){return this.updateFolders([],e)}async updateFolders(e,t,o){return this.workspaceEditingQueue.queue(()=>this.doUpdateFolders(e,t,o))}isInsideWorkspace(e){return!!this.getWorkspaceFolder(e)}isCurrentWorkspace(e){switch(this.getWorkbenchState()){case 2:{let t;return A.isUri(e)?t=e:Zh(e)&&(t=e.uri),A.isUri(t)&&this.uriIdentityService.extUri.isEqual(t,this.workspace.folders[0].uri)}case 3:return ny(e)&&this.workspace.id===e.id}return!1}async doUpdateFolders(e,t,o){if(this.getWorkbenchState()!==3||e.length+t.length===0)return Promise.resolve(void 0);let n=!1,r=this.getWorkspace().folders,s=r.map(l=>l.raw).filter((l,c)=>Obi(l)?!this.contains(t,r[c].uri):!0);if(n=r.length!==s.length,e.length){let l=this.getWorkspace().configuration,c=this.uriIdentityService.extUri.dirname(l);r=RAt(s,l,this.uriIdentityService.extUri);let u=r.map(h=>h.uri),p=[];for(let h of e){let g=h.uri;if(!this.contains(u,g)){try{if(!(await this.fileService.stat(g)).isDirectory)continue}catch{}p.push(Fbi(g,!1,h.name,c,this.uriIdentityService.extUri))}}p.length>0&&(n=!0,typeof o=="number"&&o>=0&&o<s.length?(s=s.slice(0),s.splice(o,0,...p)):s=[...s,...p])}return n?this.setFolders(s):Promise.resolve(void 0)}async setFolders(e){if(!this.instantiationService)throw new Error("Cannot update workspace folders because workspace service is not yet ready to accept writes.");return await this.instantiationService.invokeFunction(t=>this.workspaceConfiguration.setFolders(e,t.get(bg))),this.onWorkspaceConfigurationChanged(!1)}contains(e,t){return e.some(o=>this.uriIdentityService.extUri.isEqual(o,t))}getConfigurationData(){return this._configuration.toData()}getValue(e,t){let o=typeof e=="string"?e:void 0,n=bft(e)?e:bft(t)?t:void 0;return this._configuration.getValue(o,n)}async updateValue(e,t,o,n,r){let s=q$i(o)?o:bft(o)?{resource:o.resource,overrideIdentifiers:o.overrideIdentifier?[o.overrideIdentifier]:void 0}:void 0,l=s?n:o,c=l?[l]:[];if(s?.overrideIdentifiers&&(s.overrideIdentifiers=zo(s.overrideIdentifiers),s.overrideIdentifiers=s.overrideIdentifiers.length?s.overrideIdentifiers:void 0),!c.length){if(s?.overrideIdentifiers&&s.overrideIdentifiers.length>1)throw new Error("Configuration Target is required while updating the value for multiple override identifiers");let u=this.inspect(e,{resource:s?.resource,overrideIdentifier:s?.overrideIdentifiers?s.overrideIdentifiers[0]:void 0});c.push(...this.deriveConfigurationTargets(e,t,u)),eo(t,u.defaultValue)&&c.length===1&&(c[0]===2||c[0]===3)&&(t=void 0)}await dn.settled(c.map(u=>this.writeConfigurationValue(e,t,u,s,r)))}async reloadConfiguration(e){if(e===void 0){this.reloadDefaultConfiguration();let t=await this.reloadApplicationConfiguration(!0),{local:o,remote:n}=await this.reloadUserConfiguration();await this.reloadWorkspaceConfiguration(),await this.loadConfiguration(t,o,n,!0);return}if(hw(e)){await this.reloadWorkspaceFolderConfiguration(e);return}switch(e){case 7:this.reloadDefaultConfiguration();return;case 2:{let{local:t,remote:o}=await this.reloadUserConfiguration();await this.loadConfiguration(this._configuration.applicationConfiguration,t,o,!0);return}case 3:await this.reloadLocalUserConfiguration();return;case 4:await this.reloadRemoteUserConfiguration();return;case 5:case 6:await this.reloadWorkspaceConfiguration();return}}hasCachedConfigurationDefaultsOverrides(){return this.defaultConfiguration.hasCachedConfigurationDefaultsOverrides()}inspect(e,t){return this._configuration.inspect(e,t)}keys(){return this._configuration.keys()}async whenRemoteConfigurationLoaded(){await this.initRemoteUserConfigurationBarrier.wait()}async initialize(e){Mo("code/willInitWorkspaceService");let t=this.initialized;this.initialized=!1;let o=await this.createWorkspace(e);await this.updateWorkspaceAndInitializeConfiguration(o,t),this.checkAndMarkWorkspaceComplete(!1),Mo("code/didInitWorkspaceService")}updateWorkspaceTrust(e){if(this.isWorkspaceTrusted!==e){this.isWorkspaceTrusted=e;let t=this._configuration.toData(),o=[];for(let r of this.workspace.folders){let s=this.cachedFolderConfigs.get(r.uri),l;s&&(l=s.updateWorkspaceTrust(this.isWorkspaceTrusted),this._configuration.updateFolderConfiguration(r.uri,l)),o.push(l)}this.getWorkbenchState()===2?o[0]&&this._configuration.updateWorkspaceConfiguration(o[0]):this._configuration.updateWorkspaceConfiguration(this.workspaceConfiguration.updateWorkspaceTrust(this.isWorkspaceTrusted)),this.updateRestrictedSettings();let n=[];this.restrictedSettings.userLocal&&n.push(...this.restrictedSettings.userLocal),this.restrictedSettings.userRemote&&n.push(...this.restrictedSettings.userRemote),this.restrictedSettings.workspace&&n.push(...this.restrictedSettings.workspace),this.restrictedSettings.workspaceFolder?.forEach(r=>n.push(...r)),n=zo(n),n.length&&this.triggerConfigurationChange({keys:n,overrides:[]},{data:t,workspace:this.workspace},5)}}acquireInstantiationService(e){this.instantiationService=e}isSettingAppliedForAllProfiles(e){let t=this.configurationRegistry.getConfigurationProperties()[e]?.scope;if(t&&Kw.includes(t))return!0;let o=this.getValue(Ty)??[];return Array.isArray(o)&&o.includes(e)}async createWorkspace(e){return ny(e)?this.createMultiFolderWorkspace(e):Zh(e)?this.createSingleFolderWorkspace(e):this.createEmptyWorkspace(e)}async createMultiFolderWorkspace(e){await this.workspaceConfiguration.initialize({id:e.id,configPath:e.configPath},this.isWorkspaceTrusted);let t=e.configPath,o=RAt(this.workspaceConfiguration.getFolders(),t,this.uriIdentityService.extUri),n=e.id,r=new Jut(n,o,this.workspaceConfiguration.isTransient(),t,s=>this.uriIdentityService.extUri.ignorePathCasing(s));return r.initialized=this.workspaceConfiguration.initialized,r}createSingleFolderWorkspace(e){let t=new Jut(e.id,[wY(e.uri)],!1,null,o=>this.uriIdentityService.extUri.ignorePathCasing(o));return t.initialized=!0,t}createEmptyWorkspace(e){let t=new Jut(e.id,[],!1,null,o=>this.uriIdentityService.extUri.ignorePathCasing(o));return t.initialized=!0,Promise.resolve(t)}checkAndMarkWorkspaceComplete(e){!this.completeWorkspaceBarrier.isOpen()&&this.workspace.initialized&&(this.completeWorkspaceBarrier.open(),this.validateWorkspaceFoldersAndReload(e))}async updateWorkspaceAndInitializeConfiguration(e,t){let o=!!this.workspace,n,r,s=[];if(o?(n=this.getWorkbenchState(),r=this.workspace.configuration?this.workspace.configuration.fsPath:void 0,s=this.workspace.folders,this.workspace.update(e)):this.workspace=e,await this.initializeConfiguration(t),o){let l=this.getWorkbenchState();n&&l!==n&&this._onDidChangeWorkbenchState.fire(l);let c=this.workspace.configuration?this.workspace.configuration.fsPath:void 0;(r&&c!==r||l!==n)&&this._onDidChangeWorkspaceName.fire();let u=this.compareFolders(s,this.workspace.folders);u&&(u.added.length||u.removed.length||u.changed.length)&&(await this.handleWillChangeWorkspaceFolders(u,!1),this._onDidChangeWorkspaceFolders.fire(u))}this.localUserConfiguration.hasTasksLoaded||this._register(rf(ut,()=>this.reloadLocalUserConfiguration(!1,this._configuration.localUserConfiguration)))}compareFolders(e,t){let o={added:[],removed:[],changed:[]};o.added=t.filter(n=>!e.some(r=>n.uri.toString()===r.uri.toString()));for(let n=0;n<e.length;n++){let r=e[n],s=0;for(s=0;s<t.length&&r.uri.toString()!==t[s].uri.toString();s++);s<t.length?(n!==s||r.name!==t[s].name)&&o.changed.push(r):o.removed.push(r)}return o}async initializeConfiguration(e){await this.defaultConfiguration.initialize();let t=this.policyConfiguration.initialize(),o=this.applicationConfiguration?this.applicationConfiguration.initialize():Promise.resolve(jd.createEmptyModel(this.logService)),n=async()=>{Mo("code/willInitUserConfiguration");let c=await Promise.all([this.localUserConfiguration.initialize(),this.remoteUserConfiguration?this.remoteUserConfiguration.initialize():Promise.resolve(jd.createEmptyModel(this.logService))]);if(this.applicationConfiguration){let u=await o;c[0]=this.localUserConfiguration.reparse({exclude:u.getValue(Ty)})}return Mo("code/didInitUserConfiguration"),c},[,r,[s,l]]=await Promise.all([t,o,n()]);Mo("code/willInitWorkspaceConfiguration"),await this.loadConfiguration(r,s,l,e),Mo("code/didInitWorkspaceConfiguration")}reloadDefaultConfiguration(){this.onDefaultConfigurationChanged(this.defaultConfiguration.reload())}async reloadApplicationConfiguration(e){if(!this.applicationConfiguration)return jd.createEmptyModel(this.logService);let t=await this.applicationConfiguration.loadConfiguration();return e||this.onApplicationConfigurationChanged(t),t}async reloadUserConfiguration(){let[e,t]=await Promise.all([this.reloadLocalUserConfiguration(!0),this.reloadRemoteUserConfiguration(!0)]);return{local:e,remote:t}}async reloadLocalUserConfiguration(e,t){let o=await this.localUserConfiguration.reload(t);return e||this.onLocalUserConfigurationChanged(o),o}async reloadRemoteUserConfiguration(e){if(this.remoteUserConfiguration){let t=await this.remoteUserConfiguration.reload();return e||this.onRemoteUserConfigurationChanged(t),t}return jd.createEmptyModel(this.logService)}async reloadWorkspaceConfiguration(){let e=this.getWorkbenchState();if(e===2)return this.onWorkspaceFolderConfigurationChanged(this.workspace.folders[0]);if(e===3)return this.workspaceConfiguration.reload().then(()=>this.onWorkspaceConfigurationChanged(!1))}reloadWorkspaceFolderConfiguration(e){return this.onWorkspaceFolderConfigurationChanged(e)}async loadConfiguration(e,t,o,n){this.cachedFolderConfigs.clearAndDisposeAll();let r=this.workspace.folders,s=await this.loadFolderConfigurations(r),l=this.getWorkspaceConfigurationModel(s),c=new gt;s.forEach((p,h)=>c.set(r[h].uri,p));let u=this._configuration;if(this._configuration=new Qut(this.defaultConfiguration.configurationModel,this.policyConfiguration.configurationModel,e,t,o,l,c,jd.createEmptyModel(this.logService),new gt,this.workspace,this.logService),this.initialized=!0,n){let p=this._configuration.compare(u);this.triggerConfigurationChange(p,{data:u.toData(),workspace:this.workspace},5)}this.updateRestrictedSettings()}getWorkspaceConfigurationModel(e){switch(this.getWorkbenchState()){case 2:return e[0];case 3:return this.workspaceConfiguration.getConfiguration();default:return jd.createEmptyModel(this.logService)}}onUserDataProfileChanged(e){e.join((async()=>{let t=[];t.push(this.localUserConfiguration.reset(e.profile.settingsResource,e.profile.tasksResource,e.profile.mcpResource,{scopes:NPo(e.profile,!!this.remoteUserConfiguration)})),(e.previous.isDefault!==e.profile.isDefault||!!e.previous.useDefaultFlags?.settings!=!!e.profile.useDefaultFlags?.settings)&&(this.createApplicationConfiguration(),this.applicationConfiguration&&t.push(this.reloadApplicationConfiguration(!0)));let[o,n]=await Promise.all(t);n=n??this._configuration.applicationConfiguration,this.applicationConfiguration&&(o=this.localUserConfiguration.reparse({exclude:n.getValue(Ty)})),await this.loadConfiguration(n,o,this._configuration.remoteUserConfiguration,!0)})())}onDefaultConfigurationChanged(e,t){if(this.workspace){let o=this._configuration.toData(),n=this._configuration.compareAndUpdateDefaultConfiguration(e,t);if(this.applicationConfiguration&&this._configuration.updateApplicationConfiguration(this.applicationConfiguration.reparse()),this.remoteUserConfiguration&&(this._configuration.updateLocalUserConfiguration(this.localUserConfiguration.reparse()),this._configuration.updateRemoteUserConfiguration(this.remoteUserConfiguration.reparse())),this.getWorkbenchState()===2){let r=this.cachedFolderConfigs.get(this.workspace.folders[0].uri);r&&(this._configuration.updateWorkspaceConfiguration(r.reparse()),this._configuration.updateFolderConfiguration(this.workspace.folders[0].uri,r.reparse()))}else{this._configuration.updateWorkspaceConfiguration(this.workspaceConfiguration.reparseWorkspaceSettings());for(let r of this.workspace.folders){let s=this.cachedFolderConfigs.get(r.uri);s&&this._configuration.updateFolderConfiguration(r.uri,s.reparse())}}this.triggerConfigurationChange(n,{data:o,workspace:this.workspace},7),this.updateRestrictedSettings()}}onPolicyConfigurationChanged(e){let t={data:this._configuration.toData(),workspace:this.workspace},o=this._configuration.compareAndUpdatePolicyConfiguration(e);this.triggerConfigurationChange(o,t,7)}onApplicationConfigurationChanged(e){let t={data:this._configuration.toData(),workspace:this.workspace},o=this._configuration.applicationConfiguration.getValue(Ty)??[],n=this._configuration.compareAndUpdateApplicationConfiguration(e),r=this.getValue(Ty)??[],s=this.configurationRegistry.getConfigurationProperties(),l=[];for(let c of n.keys){let u=s[c]?.scope;if(u&&Kw.includes(u)){if(l.push(c),c===Ty){for(let p of o)r.includes(p)||l.push(p);for(let p of r)o.includes(p)||l.push(p)}}else r.includes(c)&&l.push(c)}n.keys=l,n.keys.includes(Ty)&&this._configuration.updateLocalUserConfiguration(this.localUserConfiguration.reparse({exclude:r})),this.triggerConfigurationChange(n,t,2)}onLocalUserConfigurationChanged(e){let t={data:this._configuration.toData(),workspace:this.workspace},o=this._configuration.compareAndUpdateLocalUserConfiguration(e);this.triggerConfigurationChange(o,t,2)}onRemoteUserConfigurationChanged(e){let t={data:this._configuration.toData(),workspace:this.workspace},o=this._configuration.compareAndUpdateRemoteUserConfiguration(e);this.triggerConfigurationChange(o,t,2)}async onWorkspaceConfigurationChanged(e){if(this.workspace&&this.workspace.configuration){let t=RAt(this.workspaceConfiguration.getFolders(),this.workspace.configuration,this.uriIdentityService.extUri);if(this.workspace.initialized){let{added:o,removed:n,changed:r}=this.compareFolders(this.workspace.folders,t);o.length||n.length||r.length?t=await this.toValidWorkspaceFolders(t):t=this.workspace.folders}await this.updateWorkspaceConfiguration(t,this.workspaceConfiguration.getConfiguration(),e)}}updateRestrictedSettings(){let e=[],t=this.configurationRegistry.getConfigurationProperties(),o=Object.keys(t).filter(v=>t[v].restricted).sort((v,b)=>v.localeCompare(b)),n=lP(o,this._restrictedSettings.default,(v,b)=>v.localeCompare(b));e.push(...n.added,...n.removed);let r=(this.applicationConfiguration?.getRestrictedSettings()||[]).sort((v,b)=>v.localeCompare(b)),s=lP(r,this._restrictedSettings.application||[],(v,b)=>v.localeCompare(b));e.push(...s.added,...s.removed);let l=this.localUserConfiguration.getRestrictedSettings().sort((v,b)=>v.localeCompare(b)),c=lP(l,this._restrictedSettings.userLocal||[],(v,b)=>v.localeCompare(b));e.push(...c.added,...c.removed);let u=(this.remoteUserConfiguration?.getRestrictedSettings()||[]).sort((v,b)=>v.localeCompare(b)),p=lP(u,this._restrictedSettings.userRemote||[],(v,b)=>v.localeCompare(b));e.push(...p.added,...p.removed);let h=new gt;for(let v of this.workspace.folders){let S=(this.cachedFolderConfigs.get(v.uri)?.getRestrictedSettings()||[]).sort((k,T)=>k.localeCompare(T));S.length&&h.set(v.uri,S);let y=this._restrictedSettings.workspaceFolder?.get(v.uri)||[],w=lP(S,y,(k,T)=>k.localeCompare(T));e.push(...w.added,...w.removed)}let g=this.getWorkbenchState()===3?this.workspaceConfiguration.getRestrictedSettings().sort((v,b)=>v.localeCompare(b)):this.workspace.folders[0]?h.get(this.workspace.folders[0].uri)||[]:[],f=lP(g,this._restrictedSettings.workspace||[],(v,b)=>v.localeCompare(b));e.push(...f.added,...f.removed),e.length&&(this._restrictedSettings={default:o,application:r.length?r:void 0,userLocal:l.length?l:void 0,userRemote:u.length?u:void 0,workspace:g.length?g:void 0,workspaceFolder:h.size?h:void 0},this._onDidChangeRestrictedSettings.fire(this.restrictedSettings))}async updateWorkspaceConfiguration(e,t,o){let n={data:this._configuration.toData(),workspace:this.workspace},r=this._configuration.compareAndUpdateWorkspaceConfiguration(t),s=this.compareFolders(this.workspace.folders,e);if(s.added.length||s.removed.length||s.changed.length){this.workspace.folders=e;let l=await this.onFoldersChanged();await this.handleWillChangeWorkspaceFolders(s,o),this.triggerConfigurationChange(l,n,6),this._onDidChangeWorkspaceFolders.fire(s)}else this.triggerConfigurationChange(r,n,5);this.updateRestrictedSettings()}async handleWillChangeWorkspaceFolders(e,t){let o=[];this._onWillChangeWorkspaceFolders.fire({join(n){o.push(n)},changes:e,fromCache:t});try{await dn.settled(o)}catch{}}async onWorkspaceFolderConfigurationChanged(e){let[t]=await this.loadFolderConfigurations([e]),o={data:this._configuration.toData(),workspace:this.workspace},n=this._configuration.compareAndUpdateFolderConfiguration(e.uri,t);if(this.getWorkbenchState()===2){let r=this._configuration.compareAndUpdateWorkspaceConfiguration(t);this.triggerConfigurationChange(U1i(n,r),o,5)}else this.triggerConfigurationChange(n,o,6);this.updateRestrictedSettings()}async onFoldersChanged(){let e=[];for(let o of this.cachedFolderConfigs.keys())this.workspace.folders.filter(n=>n.uri.toString()===o.toString())[0]||(this.cachedFolderConfigs.deleteAndDispose(o),e.push(this._configuration.compareAndDeleteFolderConfiguration(o)));let t=this.workspace.folders.filter(o=>!this.cachedFolderConfigs.has(o.uri));return t.length&&(await this.loadFolderConfigurations(t)).forEach((n,r)=>{e.push(this._configuration.compareAndUpdateFolderConfiguration(t[r].uri,n))}),U1i(...e)}loadFolderConfigurations(e){return Promise.all([...e.map(t=>{let o=this.cachedFolderConfigs.get(t.uri);return o||(o=new B9t(!this.initialized,t,SLe,this.getWorkbenchState(),this.isWorkspaceTrusted,this.fileService,this.uriIdentityService,this.logService,this.configurationCache),o.addRelated(o.onDidChange(()=>this.onWorkspaceFolderConfigurationChanged(t))),this.cachedFolderConfigs.set(t.uri,o)),o.loadConfiguration()})])}async validateWorkspaceFoldersAndReload(e){let t=await this.toValidWorkspaceFolders(this.workspace.folders),{removed:o}=this.compareFolders(this.workspace.folders,t);o.length&&await this.updateWorkspaceConfiguration(t,this.workspaceConfiguration.getConfiguration(),e)}async toValidWorkspaceFolders(e){let t=[];for(let o of e){try{if(!(await this.fileService.stat(o.uri)).isDirectory)continue}catch(n){this.logService.warn(`Ignoring the error while validating workspace folder ${o.uri.toString()} - ${xn(n)}`)}t.push(o)}return t}async writeConfigurationValue(e,t,o,n,r){if(!this.instantiationService)throw new Error("Cannot write configuration because the configuration service is not yet ready to accept writes.");if(o===7)throw new Error("Invalid configuration target");if(o===8){let l={data:this._configuration.toData(),workspace:this.workspace};this._configuration.updateValue(e,t,n),this.triggerConfigurationChange({keys:n?.overrideIdentifiers?.length?[yft(n.overrideIdentifiers),e]:[e],overrides:n?.overrideIdentifiers?.length?n.overrideIdentifiers.map(c=>[c,[e]]):[]},l,o);return}let s=this.toEditableConfigurationTarget(o,e);if(!s)throw new Error("Invalid configuration target");if(s===2&&!this.remoteUserConfiguration)throw new Error("Invalid configuration target");if(n?.overrideIdentifiers?.length&&n.overrideIdentifiers.length>1){let l=this.getConfigurationModelForEditableConfigurationTarget(s,n.resource);if(l){let c=n.overrideIdentifiers.sort(),u=l.overrides.find(p=>$i([...p.identifiers].sort(),c));u&&(n.overrideIdentifiers=u.identifiers)}}switch(this.configurationEditing=this.configurationEditing??this.createConfigurationEditingService(this.instantiationService),await(await this.configurationEditing).writeConfiguration(s,{key:e,value:t},{scopes:n,...r}),s){case 1:this.applicationConfiguration&&this.isSettingAppliedForAllProfiles(e)?await this.reloadApplicationConfiguration():await this.reloadLocalUserConfiguration();return;case 2:return this.reloadRemoteUserConfiguration().then(()=>{});case 3:return this.reloadWorkspaceConfiguration();case 4:{let l=n&&n.resource?this.workspace.getFolder(n.resource):null;if(l)return this.reloadWorkspaceFolderConfiguration(l)}}}async createConfigurationEditingService(e){let t=(await this.remoteAgentService.getEnvironment())?.settingsPath??null;return e.createInstance(R2e,t)}getConfigurationModelForEditableConfigurationTarget(e,t){switch(e){case 1:return this._configuration.localUserConfiguration;case 2:return this._configuration.remoteUserConfiguration;case 3:return this._configuration.workspaceConfiguration;case 4:return t?this._configuration.folderConfigurations.get(t):void 0}}getConfigurationModel(e,t){switch(e){case 3:return this._configuration.localUserConfiguration;case 4:return this._configuration.remoteUserConfiguration;case 5:return this._configuration.workspaceConfiguration;case 6:return t?this._configuration.folderConfigurations.get(t):void 0;default:return}}deriveConfigurationTargets(e,t,o){if(eo(t,o.value))return[];let n=[];return o.workspaceFolderValue!==void 0&&n.push(6),o.workspaceValue!==void 0&&n.push(5),o.userRemoteValue!==void 0&&n.push(4),o.userLocalValue!==void 0&&n.push(3),o.applicationValue!==void 0&&n.push(1),t===void 0?n:[n[0]||2]}triggerConfigurationChange(e,t,o){if(e.keys.length){o!==7&&this.logService.debug(`Configuration keys changed in ${p7(o)} target`,...e.keys);let n=new R9t(e,t,this._configuration,this.workspace,this.logService);n.source=o,this._onDidChangeConfiguration.fire(n)}}toEditableConfigurationTarget(e,t){if(e===1)return 1;if(e===2){if(this.remoteUserConfiguration){let o=this.configurationRegistry.getConfigurationProperties()[t]?.scope;if(o===2||o===7||o===3)return 2;if(this.inspect(t).userRemoteValue!==void 0)return 2}return 1}return e===3?1:e===4?2:e===5?3:e===6?4:null}},Xut=class extends x{constructor(e,t,o,n,r){super();this.workspaceContextService=e;this.environmentService=t;this.workspaceTrustManagementService=o;n.whenInstalledExtensionsRegistered().then(()=>{this.registerConfigurationSchemas();let s=ne.as(Jt.Configuration),l=this._register(new Xo(50));this._register(U.any(s.onDidUpdateConfiguration,s.onDidSchemaChange,o.onDidChangeTrust)(()=>l.trigger(()=>this.registerConfigurationSchemas(),r.phase===4?void 0:2500)))})}registerConfigurationSchemas(){for(let u of Object.keys(qI.properties)){let p=qI.properties[u];p.markdownDeprecationMessage&&p.deprecationMessage===p.markdownDeprecationMessage&&(p.deprecationMessage=Da({value:yVt(p.markdownDeprecationMessage)}))}let e={properties:qI.properties,patternProperties:qI.patternProperties,additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0},t=this.environmentService.remoteAuthority?{properties:Object.assign({},tye.properties,L1.properties,fO.properties),patternProperties:qI.patternProperties,additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0}:e,o={properties:Object.assign({},Aae.properties,D1.properties,L1.properties,fO.properties),patternProperties:qI.patternProperties,additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0},n={properties:Object.assign({},iye.properties,Aae.properties,D1.properties,L1.properties,fO.properties),patternProperties:qI.patternProperties,additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0},r={properties:Object.assign({},this.checkAndFilterPropertiesRequiringTrust(D1.properties),this.checkAndFilterPropertiesRequiringTrust(L1.properties),this.checkAndFilterPropertiesRequiringTrust(fO.properties)),patternProperties:qI.patternProperties,additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0},s={properties:Object.keys(qI.properties).reduce((u,p)=>(u[p]=Object.assign({deprecationMessage:void 0},qI.properties[p]),u),{}),patternProperties:Object.keys(qI.patternProperties).reduce((u,p)=>(u[p]=Object.assign({deprecationMessage:void 0},qI.patternProperties[p]),u),{}),additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0},l=3===this.workspaceContextService.getWorkbenchState()?{properties:Object.assign({},this.checkAndFilterPropertiesRequiringTrust(D1.properties),this.checkAndFilterPropertiesRequiringTrust(fO.properties)),patternProperties:qI.patternProperties,additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0}:r,c={type:"object",description:d(17417,null),properties:Object.assign({},this.filterDefaultOverridableProperties(D1.properties),this.filterDefaultOverridableProperties(L1.properties),this.filterDefaultOverridableProperties(fO.properties)),patternProperties:{[_1]:{type:"object",default:{},$ref:ej}},additionalProperties:!1};this.registerSchemas({defaultSettingsSchema:s,userSettingsSchema:t,profileSettingsSchema:o,machineSettingsSchema:n,workspaceSettingsSchema:r,folderSettingsSchema:l,configDefaultsSchema:c})}registerSchemas(e){let t=ne.as(ma.JSONContribution);t.registerSchema(flo,e.defaultSettingsSchema),t.registerSchema(vlo,e.userSettingsSchema),t.registerSchema(blo,e.profileSettingsSchema),t.registerSchema(Slo,e.machineSettingsSchema),t.registerSchema(rFt,e.workspaceSettingsSchema),t.registerSchema(Ilo,e.folderSettingsSchema),t.registerSchema(Ift,e.configDefaultsSchema)}checkAndFilterPropertiesRequiringTrust(e){if(this.workspaceTrustManagementService.isWorkspaceTrusted())return e;let t={};return Object.entries(e).forEach(([o,n])=>{n.restricted||(t[o]=n)}),t}filterDefaultOverridableProperties(e){let t={};return Object.entries(e).forEach(([o,n])=>{n.disallowConfigurationDefault||(t[o]=n)}),t}};Xut=I([m(0,Pe),m(1,At),m(2,Nr),m(3,lt),m(4,ji)],Xut);var A2e=class extends x{constructor(e,t,o,n){super();this.workbenchAssignmentService=e;this.extensionService=t;this.configurationService=o;this.logService=n;this.processedExperimentalSettings=new Set;this.autoExperimentalSettings=new Set;this.configurationRegistry=ne.as(Jt.Configuration);this.throttler=this._register(new gu);this.throttler.queue(()=>this.updateDefaults()),this._register(e.onDidRefetchAssignments(()=>this.throttler.queue(()=>this.processExperimentalSettings(this.autoExperimentalSettings,!0)))),this._register(this.configurationRegistry.onDidUpdateConfiguration(({properties:r})=>this.processExperimentalSettings(r,!1)))}static{this.ID="workbench.contrib.configurationDefaultOverridesContribution"}async updateDefaults(){this.logService.trace("ConfigurationService#updateDefaults: begin");try{await this.processExperimentalSettings(Object.keys(this.configurationRegistry.getConfigurationProperties()),!1)}finally{await this.extensionService.whenInstalledExtensionsRegistered(),this.logService.trace("ConfigurationService#updateDefaults: resetting the defaults"),this.configurationService.reloadConfiguration(7)}}async processExperimentalSettings(e,t){let o={},n=this.configurationRegistry.getConfigurationProperties(),r=this.configurationRegistry.getRegisteredDefaultConfigurations().filter(s=>s.preventExperimentOverride);for(let s of e){let l=n[s];if(!l?.experiment)continue;let c=l.defaultValueSource&&!(l.defaultValueSource instanceof Map)?l.defaultValueSource:void 0;if(!(c&&r.some(u=>vei(u.source,c)&&u.overrides?.[s]!==void 0))&&!(!t&&this.processedExperimentalSettings.has(s))){this.processedExperimentalSettings.add(s),l.experiment.mode==="auto"&&this.autoExperimentalSettings.add(s);try{let u=await this.workbenchAssignmentService.getTreatment(l.experiment.name??`config.${s}`);!gn(u)&&!eo(u,l.default)&&(o[s]=u)}catch{}}}Object.keys(o).length&&this.configurationRegistry.registerDefaultConfigurations([{overrides:o}])}};A2e=I([m(0,yD),m(1,lt),m(2,B),m(3,se)],A2e);var zIn=ne.as(Qi.Workbench);zIn.registerWorkbenchContribution(Xut,3);It(A2e.ID,A2e,St.BlockRestore);var KIn=ne.as(Jt.Configuration);KIn.registerConfiguration({...Ud,properties:{[Ty]:{type:"array",description:d(17418,null),default:[],scope:1,additionalProperties:!0,uniqueItems:!0}}});var U9t=class extends ace{constructor(e,t,o,n){super();this.remoteService=o;this.environmentService=n;this.profileStorageDisposables=this._register(new N);this.workspaceStorageDisposables=this._register(new N);this.applicationStorageProfile=t.defaultProfile,this.applicationStorage=this.createApplicationStorage(),this.profileStorageProfile=t.currentProfile,this.profileStorage=this.createProfileStorage(this.profileStorageProfile),this.workspaceStorageId=e?.id,this.workspaceStorage=this.createWorkspaceStorage(e)}createApplicationStorage(){let e=this._register(new JRe(this.remoteService.getChannel("storage"))),t=this._register(new KO(e));return this._register(t.onDidChangeStorage(o=>this.emitDidChangeValue(-1,o))),t}createProfileStorage(e){this.profileStorageDisposables.clear(),this.profileStorageProfile=e;let t;if($Ce(e))t=this.applicationStorage;else{let o=this.profileStorageDisposables.add(new ZRe(this.remoteService.getChannel("storage"),e));t=this.profileStorageDisposables.add(new KO(o))}return this.profileStorageDisposables.add(t.onDidChangeStorage(o=>this.emitDidChangeValue(0,o))),t}createWorkspaceStorage(e){this.workspaceStorageDisposables.clear(),this.workspaceStorageId=e?.id;let t;if(e){let o=this.workspaceStorageDisposables.add(new nBt(this.remoteService.getChannel("storage"),e));t=this.workspaceStorageDisposables.add(new KO(o)),this.workspaceStorageDisposables.add(t.onDidChangeStorage(n=>this.emitDidChangeValue(1,n)))}return t}async doInitialize(){await dn.settled([this.applicationStorage.init(),this.profileStorage.init(),this.workspaceStorage?.init()??Promise.resolve()])}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 this.applicationStorageProfile.globalStorageHome.with({scheme:Q.file}).fsPath;case 0:return this.profileStorageProfile?.globalStorageHome.with({scheme:Q.file}).fsPath;default:return this.workspaceStorageId?`${Ge(this.environmentService.workspaceStorageHome,this.workspaceStorageId,"state.vscdb").with({scheme:Q.file}).fsPath}`:void 0}}async close(){this.stopFlushWhenIdle(),this.emitWillSaveState(1),await dn.settled([this.applicationStorage.close(),this.profileStorage.close(),this.workspaceStorage?.close()??Promise.resolve()])}async switchToProfile(e){if(!this.canSwitchProfile(this.profileStorageProfile,e))return;let t=this.profileStorage,o=t.items;t!==this.applicationStorage&&await t.close(),this.profileStorage=this.createProfileStorage(e),await this.profileStorage.init(),this.switchData(o,this.profileStorage,0)}async switchToWorkspace(e,t){let o=this.workspaceStorage,n=o?.items??new Map;await o?.close(),this.workspaceStorage=this.createWorkspaceStorage(e),await this.workspaceStorage.init(),this.switchData(n,this.workspaceStorage,1)}hasScope(e){return qO(e)?this.profileStorageProfile.id===e.id:this.workspaceStorageId===e.id}};var z9t=class extends U9t{constructor(e,t,o,n,r){super(e,{currentProfile:t.currentProfile,defaultProfile:o.defaultProfile},n,r);this.userDataProfileService=t;this.registerListeners()}registerListeners(){this._register(this.userDataProfileService.onDidChangeCurrentProfile(e=>e.join(this.switchToProfile(e.profile))))}};var q1i={request:"vscode:createSharedProcessChannelConnection",response:"vscode:createSharedProcessChannelConnectionResult"},$1i={request:"vscode:createSharedProcessRawConnection",response:"vscode:createSharedProcessRawConnectionResult"};var N2e=class extends x{constructor(e,t){super();this.windowId=e;this.logService=t;this.restoredBarrier=new gp;this.withSharedProcessConnection=this.connect()}async connect(){this.logService.trace("Renderer->SharedProcess#connect"),await Promise.race([this.restoredBarrier.wait(),Li(2e3)]),Mo("code/willConnectSharedProcess"),this.logService.trace("Renderer->SharedProcess#connect: before acquirePort");let e=await JU(q1i.request,q1i.response);return Mo("code/didConnectSharedProcess"),this.logService.trace("Renderer->SharedProcess#connect: connection established"),this._register(new i$(e,`window:${this.windowId}`))}notifyRestored(){this.restoredBarrier.isOpen()||this.restoredBarrier.open()}getChannel(e){return n2(this.withSharedProcessConnection.then(t=>t.getChannel(e)))}registerChannel(e,t){this.withSharedProcessConnection.then(o=>o.registerChannel(e,t))}async createRawConnection(){await this.withSharedProcessConnection,this.logService.trace("Renderer->SharedProcess#createRawConnection: before acquirePort");let e=await JU($1i.request,$1i.response);return this.logService.trace("Renderer->SharedProcess#createRawConnection: connection established"),e}};N2e=I([m(1,se)],N2e);var O2e=class extends x{constructor(e,t){super();this.remoteResourceLoader=t;this._onDidChangeConnectionData=this._register(new E);this.onDidChangeConnectionData=this._onDidChangeConnectionData.event;this._resolveAuthorityRequests=new Map,this._connectionTokens=new Map,this._canonicalURIRequests=new Map,this._canonicalURIProvider=null,RL.setServerRootPath(e,void 0)}resolveAuthority(e){return this._resolveAuthorityRequests.has(e)||this._resolveAuthorityRequests.set(e,new Ko),this._resolveAuthorityRequests.get(e).p}async getCanonicalURI(e){let t=e.toString(),o=this._canonicalURIRequests.get(t);if(o)return o.result.p;let n=new Ko;return this._canonicalURIProvider?.(e).then(r=>n.complete(r),r=>n.error(r)),this._canonicalURIRequests.set(t,{input:e,result:n}),n.p}getConnectionData(e){if(!this._resolveAuthorityRequests.has(e))return null;let t=this._resolveAuthorityRequests.get(e);if(!t.isResolved)return null;let o=this._connectionTokens.get(e);return{connectTo:t.value.authority.connectTo,connectionToken:o}}_clearResolvedAuthority(e){this._resolveAuthorityRequests.has(e)&&(this._resolveAuthorityRequests.get(e).cancel(),this._resolveAuthorityRequests.delete(e))}_setResolvedAuthority(e,t){if(this._resolveAuthorityRequests.has(e.authority)){let o=this._resolveAuthorityRequests.get(e.authority);e.connectTo.type===0?RL.set(e.authority,e.connectTo.host,e.connectTo.port):RL.setDelegate(this.remoteResourceLoader.getResourceUriProvider()),e.connectionToken&&RL.setConnectionToken(e.authority,e.connectionToken),o.complete({authority:e,options:t}),this._onDidChangeConnectionData.fire()}}_setResolvedAuthorityError(e,t){this._resolveAuthorityRequests.has(e)&&this._resolveAuthorityRequests.get(e).error(pa.fromError(t))}_setAuthorityConnectionToken(e,t){this._connectionTokens.set(e,t),RL.setConnectionToken(e,t),this._onDidChangeConnectionData.fire()}_setCanonicalURIProvider(e){this._canonicalURIProvider=e,this._canonicalURIRequests.forEach(({result:t,input:o})=>{this._canonicalURIProvider(o).then(n=>t.complete(n),n=>t.error(n))})}};O2e=I([m(0,tt)],O2e);var n$=class{static async getEnvironmentData(i,e,t){let o={remoteAuthority:e,profile:t},n=await i.call("getEnvironmentData",o),r=typeof n.reconnectionGraceTime=="number"&&n.reconnectionGraceTime>=0?n.reconnectionGraceTime:108e5;return{pid:n.pid,connectionToken:n.connectionToken,appRoot:A.revive(n.appRoot),execPath:n.execPath,tmpDir:A.revive(n.tmpDir),settingsPath:A.revive(n.settingsPath),mcpResource:A.revive(n.mcpResource),logsPath:A.revive(n.logsPath),extensionHostLogsPath:A.revive(n.extensionHostLogsPath),globalStorageHome:A.revive(n.globalStorageHome),workspaceStorageHome:A.revive(n.workspaceStorageHome),localHistoryHome:A.revive(n.localHistoryHome),userHome:A.revive(n.userHome),os:n.os,arch:n.arch,marks:n.marks,useHostProxy:n.useHostProxy,profiles:$n(n.profiles),isUnsupportedGlibc:n.isUnsupportedGlibc,reconnectionGraceTime:r}}static async getExtensionHostExitInfo(i,e,t){let o={remoteAuthority:e,reconnectionToken:t};return i.call("getExtensionHostExitInfo",o)}static getDiagnosticInfo(i,e){return i.call("getDiagnosticInfo",e)}static updateTelemetryLevel(i,e){return i.call("updateTelemetryLevel",{telemetryLevel:e})}static logTelemetry(i,e,t){return i.call("logTelemetry",{eventName:e,data:t})}static flushTelemetry(i){return i.call("flushTelemetry")}static async ping(i){await i.call("ping")}};var GIn="signService",ose=le(GIn);var F2e=class extends x{constructor(e,t,o,n,r,s,l){super();this.remoteSocketFactoryService=e;this.userDataProfileService=t;this._environmentService=o;this._remoteAuthorityResolverService=r;this._logService=l;this._environmentService.remoteAuthority?this._connection=this._register(new j1i(this._environmentService.remoteAuthority,n.commit,n.quality,this.remoteSocketFactoryService,this._remoteAuthorityResolverService,s,this._logService)):this._connection=null,this._environment=null}getConnection(){return this._connection}getEnvironment(){return this.getRawEnvironment().then(void 0,()=>null)}getRawEnvironment(){return this._environment||(this._environment=this._withChannel(async(e,t)=>{let o=await n$.getEnvironmentData(e,t.remoteAuthority,this.userDataProfileService.currentProfile.isDefault?void 0:this.userDataProfileService.currentProfile.id);return this._remoteAuthorityResolverService._setAuthorityConnectionToken(t.remoteAuthority,o.connectionToken),typeof o.reconnectionGraceTime=="number"?(this._logService.info(`[reconnection-grace-time] Client received grace time from server: ${o.reconnectionGraceTime}ms (${Math.floor(o.reconnectionGraceTime/1e3)}s)`),t.updateGraceTime(o.reconnectionGraceTime)):this._logService.info("[reconnection-grace-time] Server did not provide grace time, using default"),o},null)),this._environment}getExtensionHostExitInfo(e){return this._withChannel((t,o)=>n$.getExtensionHostExitInfo(t,o.remoteAuthority,e),null)}getDiagnosticInfo(e){return this._withChannel(t=>n$.getDiagnosticInfo(t,e),void 0)}updateTelemetryLevel(e){return this._withTelemetryChannel(t=>n$.updateTelemetryLevel(t,e),void 0)}logTelemetry(e,t){return this._withTelemetryChannel(o=>n$.logTelemetry(o,e,t),void 0)}flushTelemetry(){return this._withTelemetryChannel(e=>n$.flushTelemetry(e),void 0)}getRoundTripTime(){return this._withTelemetryChannel(async e=>{let t=Date.now();return await n$.ping(e),Date.now()-t},void 0)}async endConnection(){this._connection&&(await this._connection.end(),this._connection.dispose())}_withChannel(e,t){let o=this.getConnection();return o?o.withChannel("remoteextensionsenvironment",n=>e(n,o)):Promise.resolve(t)}_withTelemetryChannel(e,t){let o=this.getConnection();return o?o.withChannel("telemetry",n=>e(n,o)):Promise.resolve(t)}};F2e=I([m(0,r2),m(1,ln),m(2,At),m(3,tt),m(4,Uc),m(5,ose),m(6,se)],F2e);var j1i=class extends x{constructor(e,t,o,n,r,s,l){super();this._commit=t;this._quality=o;this._remoteSocketFactoryService=n;this._remoteAuthorityResolverService=r;this._signService=s;this._logService=l;this._onReconnecting=this._register(new E);this.onReconnecting=this._onReconnecting.event;this._onDidStateChange=this._register(new E);this.onDidStateChange=this._onDidStateChange.event;this._managementConnection=null;this.end=()=>Promise.resolve();this.remoteAuthority=e,this._connection=null}getChannel(e){return n2(this._getOrCreateConnection().then(t=>t.getChannel(e)))}withChannel(e,t){let o=this.getChannel(e);return t(o)}registerChannel(e,t){this._getOrCreateConnection().then(o=>o.registerChannel(e,t))}async getInitialConnectionTimeMs(){try{await this._getOrCreateConnection()}catch{}return this._initialConnectionMs}getManagementConnection(){return this._managementConnection}updateGraceTime(e){this._managementConnection&&this._managementConnection.updateGraceTime(e)}_getOrCreateConnection(){return this._connection||(this._connection=this._createConnection()),this._connection}async _createConnection(){let e=!0,t={commit:this._commit,quality:this._quality,addressProvider:{getAddress:async()=>{e?e=!1:this._onReconnecting.fire(void 0);let{authority:r}=await this._remoteAuthorityResolverService.resolveAuthority(this.remoteAuthority);return{connectTo:r.connectTo,connectionToken:r.connectionToken}}},remoteSocketFactoryService:this._remoteSocketFactoryService,signService:this._signService,logService:this._logService,ipcLogger:null},o,n=Date.now();try{o=this._register(await kRo(t,this.remoteAuthority,"renderer")),this._managementConnection=o}finally{this._initialConnectionMs=Date.now()-n}return this._register(o.protocol.onDidDispose(()=>{o.dispose()})),this.end=()=>(o.protocol.sendDisconnect(),o.protocol.drain()),this._register(o.onDidStateChange(r=>this._onDidStateChange.fire(r))),o.client}};var W2e=class extends F2e{constructor(i,e,t,o,n,r,s){super(i,e,t,o,n,r,s)}};W2e=I([m(0,r2),m(1,ln),m(2,At),m(3,tt),m(4,Uc),m(5,ose),m(6,se)],W2e);var V2e=class{constructor(i,e,t,o,n,r,s){this._remoteAgentService=i;this._remoteAuthorityResolverService=r;this._remoteAgentService.getRawEnvironment().then(void 0,l=>{if(!Ew.isHandled(l)){let c=[{label:d(17943,null),run:()=>n.openDevTools()}],u=this._getTroubleshootingURL();u&&c.push({label:d(17944,null),run:()=>s.open(u,{openExternal:!0})}),e.prompt(ft.Error,d(17942,null,l?l.message:""),c)}})}static{this.ID="workbench.contrib.nativeRemoteConnectionFailureNotification"}_getTroubleshootingURL(){let i=this._remoteAgentService.getConnection();if(!i)return null;let e=this._remoteAuthorityResolverService.getConnectionData(i.remoteAuthority);return!e||e.connectTo.type!==0?null:A.from({scheme:"http",authority:`${e.connectTo.host}:${e.connectTo.port}`,path:"/version"})}};V2e=I([m(0,bo),m(1,Ne),m(2,At),m(3,Te),m(4,ko),m(5,Uc),m(6,Je)],V2e);It(V2e.ID,V2e,St.BlockRestore);async function OPo(a,i,e,t,o,n){let r;try{await qIn(a,i,e,t,o,n)}catch(s){r=s}finally{r&&o.errorTransformer&&(r=o.errorTransformer(r)),typeof r<"u"&&e.error(r),e.end()}}async function qIn(a,i,e,t,o,n){Q1i(n);let r=await a.open(i,{create:!1});try{Q1i(n);let s=0,l=0,c=o&&typeof o.length=="number"?o.length:void 0,u=qe.alloc(Math.min(o.bufferSize,typeof c=="number"?c:o.bufferSize)),p=o&&typeof o.position=="number"?o.position:0,h=0;do l=await a.read(r,p,u.buffer,h,u.byteLength-h),p+=l,h+=l,s+=l,typeof c=="number"&&(c-=l),h===u.byteLength&&(await e.write(t(u)),u=qe.alloc(Math.min(o.bufferSize,typeof c=="number"?c:o.bufferSize)),h=0);while(l>0&&(typeof c!="number"||c>0)&&Q1i(n)&&$In(s,o));if(h>0){let g=h;typeof c=="number"&&(g=Math.min(h,c)),e.write(t(u.slice(0,g)))}}catch(s){throw Ij(s)}finally{await a.close(r)}}function Q1i(a){if(a.isCancellationRequested)throw PI();return!0}function $In(a,i){if(typeof i?.limits?.size=="number"&&a>i.limits.size)throw Ps(d(2158,null),"EntryTooLarge");return!0}var nse=class extends x{constructor(e){super();this.logService=e;this.BUFFER_SIZE=256*1024;this._onDidChangeFileSystemProviderRegistrations=this._register(new E);this.onDidChangeFileSystemProviderRegistrations=this._onDidChangeFileSystemProviderRegistrations.event;this._onWillActivateFileSystemProvider=this._register(new E);this.onWillActivateFileSystemProvider=this._onWillActivateFileSystemProvider.event;this._onDidChangeFileSystemProviderCapabilities=this._register(new E);this.onDidChangeFileSystemProviderCapabilities=this._onDidChangeFileSystemProviderCapabilities.event;this.provider=new Map;this._onDidRunOperation=this._register(new E);this.onDidRunOperation=this._onDidRunOperation.event;this.internalOnDidFilesChange=this._register(new E);this._onDidUncorrelatedFilesChange=this._register(new E);this.onDidFilesChange=this._onDidUncorrelatedFilesChange.event;this._onDidWatchError=this._register(new E);this.onDidWatchError=this._onDidWatchError.event;this.activeWatchers=new Map;this.writeQueue=this._register(new b1)}registerProvider(e,t){if(this.provider.has(e))throw new Error(`A filesystem provider for the scheme '${e}' is already registered.`);Mo(`code/registerFilesystem/${e}`);let o=new N;return this.provider.set(e,t),this._onDidChangeFileSystemProviderRegistrations.fire({added:!0,scheme:e,provider:t}),o.add(t.onDidChangeFile(n=>{let r=new RO(n,!this.isPathCaseSensitive(t));this.internalOnDidFilesChange.fire(r),r.hasCorrelation()||this._onDidUncorrelatedFilesChange.fire(r)})),typeof t.onDidWatchError=="function"&&o.add(t.onDidWatchError(n=>this._onDidWatchError.fire(new Error(n)))),o.add(t.onDidChangeCapabilities(()=>this._onDidChangeFileSystemProviderCapabilities.fire({provider:t,scheme:e}))),Z(()=>{this._onDidChangeFileSystemProviderRegistrations.fire({added:!1,scheme:e,provider:t}),this.provider.delete(e),Be(o)})}getProvider(e){return this.provider.get(e)}async activateProvider(e){let t=[];this._onWillActivateFileSystemProvider.fire({scheme:e,join(o){t.push(o)}}),!this.provider.has(e)&&await dn.settled(t)}async canHandleResource(e){return await this.activateProvider(e.scheme),this.hasProvider(e)}hasProvider(e){return this.provider.has(e.scheme)}hasCapability(e,t){let o=this.provider.get(e.scheme);return!!(o&&o.capabilities&t)}listCapabilities(){return vt.map(this.provider,([e,t])=>({scheme:e,capabilities:t.capabilities}))}async withProvider(e){if(!jht(e))throw new ta(d(2147,null,this.resourceForError(e)),8);await this.activateProvider(e.scheme);let t=this.provider.get(e.scheme);if(!t){let o=new pa;throw o.message=d(2149,null,e.toString()),o}return t}async withReadProvider(e){let t=await this.withProvider(e);if(Sj(t)||D_(t)||Ebt(t))return t;throw new Error(`Filesystem provider for scheme '${e.scheme}' neither has FileReadWrite, FileReadStream nor FileOpenReadWriteClose capability which is needed for the read operation.`)}async withWriteProvider(e){let t=await this.withProvider(e);if(Sj(t)||D_(t))return t;throw new Error(`Filesystem provider for scheme '${e.scheme}' neither has FileReadWrite nor FileOpenReadWriteClose capability which is needed for the write operation.`)}async resolve(e,t){try{return await this.doResolveFile(e,t)}catch(o){throw Ile(o)==="EntryNotFound"?new ta(d(2144,null,this.resourceForError(e)),1):Ij(o)}}async doResolveFile(e,t){let o=await this.withProvider(e),n=this.isPathCaseSensitive(o),r=t?.resolveTo,s=t?.resolveSingleChildDescendants,l=t?.resolveMetadata,c=await o.stat(e),u;return this.toFileStat(o,e,c,void 0,!!l,(p,h)=>(u||(u=Sp.forUris(()=>!n),u.set(e,!0),r&&u.fill(!0,r)),u.get(p.resource)||u.findSuperstr(p.resource.with({query:null,fragment:null}))?!0:p.isDirectory&&s?h===1:!1))}async toFileStat(e,t,o,n,r,s){let{providerExtUri:l}=this.getExtUri(e),c={resource:t,name:l.basename(t),isFile:(o.type&1)!==0,isDirectory:(o.type&2)!==0,isSymbolicLink:(o.type&64)!==0,mtime:o.mtime,ctime:o.ctime,size:o.size,readonly:!!((o.permissions??0)&1)||!!(e.capabilities&2048),locked:!!((o.permissions??0)&2),executable:!!((o.permissions??0)&4),etag:Jti({mtime:o.mtime,size:o.size}),children:void 0};if(c.isDirectory&&s(c,n)){try{let u=await e.readdir(t),p=await dn.settled(u.map(async([h,g])=>{try{let f=l.joinPath(t,h),v=r?await e.stat(f):{type:g};return await this.toFileStat(e,f,v,u.length,r,s)}catch(f){return this.logService.trace(f),null}}));c.children=di(p)}catch(u){this.logService.trace(u),c.children=[]}return c}return c}async resolveAll(e){return dn.settled(e.map(async t=>{try{return{stat:await this.doResolveFile(t.resource,t.options),success:!0}}catch(o){return this.logService.trace(o),{stat:void 0,success:!1}}}))}async stat(e){let t=await this.withProvider(e),o=await t.stat(e);return this.toFileStat(t,e,o,void 0,!0,()=>!1)}async realpath(e){let t=await this.withProvider(e);if(Y4i(t)){let o=await t.realpath(e);return e.with({path:o})}}async exists(e){let t=await this.withProvider(e);try{return!!await t.stat(e)}catch{return!1}}async canCreateFile(e,t){try{await this.doValidateCreateFile(e,t)}catch(o){return o}return!0}async doValidateCreateFile(e,t){if(!t?.overwrite&&await this.exists(e))throw new ta(d(2140,null,this.resourceForError(e)),3,t)}async createFile(e,t=qe.fromString(""),o){await this.doValidateCreateFile(e,o);let n=await this.writeFile(e,t);return this._onDidRunOperation.fire(new LO(e,0,n)),n}async writeFile(e,t,o){let n=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(e),e),{providerExtUri:r}=this.getExtUri(n),s=o;if(Yti(n)&&!s?.atomic){let l=n.enforceAtomicWriteFile?.(e);l&&(s={...o,atomic:l})}try{let{stat:l,buffer:c}=await this.validateWriteFile(n,e,t,s);l||await this.mkdirp(n,r.dirname(e)),c||(c=await this.peekBufferForWriting(n,t)),!Sj(n)||D_(n)&&c instanceof qe||D_(n)&&Yti(n)&&s?.atomic?await this.doWriteUnbuffered(n,e,s,c):await this.doWriteBuffered(n,e,s,c instanceof qe?SIe(c):c),this._onDidRunOperation.fire(new LO(e,4))}catch(l){throw new ta(d(2139,null,this.resourceForError(e),Ij(l).toString()),Au(l),s)}return this.resolve(e,{resolveMetadata:!0})}async peekBufferForWriting(e,t){let o;if(D_(e)&&!(t instanceof qe))if(z9(t)){let n=await tgt(t,3);n.ended?o=qe.concat(n.buffer):o=n}else o=JGi(t,n=>qe.concat(n),3);else o=t;return o}async validateWriteFile(e,t,o,n){let r=!!n?.unlock;if(r&&!(e.capabilities&8192))throw new Error(d(2157,null,this.resourceForError(t)));if(n?.append&&!Q4i(e))throw new ta(d(2136,null,this.resourceForError(t)),6);if(!!n?.atomic){if(!(e.capabilities&32768))throw new Error(d(2155,null,this.resourceForError(t)));if(!(e.capabilities&2))throw new Error(d(2156,null,this.resourceForError(t)));if(r)throw new Error(d(2154,null,this.resourceForError(t)))}let l;try{l=await e.stat(t)}catch{return Object.create(null)}if((l.type&2)!==0)throw new ta(d(2142,null,this.resourceForError(t)),0,n);this.throwIfFileIsReadonly(t,l);let c;if(typeof n?.mtime=="number"&&typeof n.etag=="string"&&n.etag!==JL&&typeof l.mtime=="number"&&typeof l.size=="number"&&n.mtime<l.mtime&&n.etag!==Jti({mtime:n.mtime,size:l.size})){if(c=await this.peekBufferForWriting(e,o),c instanceof qe&&c.byteLength===l.size)try{let{value:u}=await this.readFile(t,{limits:{size:l.size}});if(c.equals(u))return{stat:l,buffer:c}}catch{}throw new ta(d(2143,null),3,n)}return{stat:l,buffer:c}}async readFile(e,t,o){let n=await this.withReadProvider(e);return t?.atomic?this.doReadFileAtomic(n,e,t,o):this.doReadFile(n,e,t,o)}async doReadFileAtomic(e,t,o,n){return new Promise((r,s)=>{this.writeQueue.queueFor(t,async()=>{try{let l=await this.doReadFile(e,t,o,n);r(l)}catch(l){s(l)}},this.getExtUri(e).providerExtUri)})}async doReadFile(e,t,o,n){let r=await this.doReadFileStream(e,t,{...o,preferUnbuffered:!0},n);return{...r,value:await tb(r.value)}}async readFileStream(e,t,o){let n=await this.withReadProvider(e);return this.doReadFileStream(n,e,t,o)}async doReadFileStream(e,t,o,n){let r=new Ye(n),s=o;Tbt(e)&&e.enforceAtomicReadFile?.(t)&&(s={...o,atomic:!0});let l=this.validateReadFile(t,s).then(u=>u,u=>{throw r.dispose(!0),u}),c;try{return typeof s?.etag=="string"&&s.etag!==JL&&await l,s?.atomic&&Tbt(e)||!(Sj(e)||Ebt(e))||D_(e)&&s?.preferUnbuffered?c=this.readFileUnbuffered(e,t,s):Ebt(e)?c=this.readFileStreamed(e,t,r.token,s):c=this.readFileBuffered(e,t,r.token,s),c.on("end",()=>r.dispose()),c.on("error",()=>r.dispose()),{...await l,value:c}}catch(u){throw c&&await K9(c),this.restoreReadError(u,t,s)}}restoreReadError(e,t,o){let n=d(2137,null,this.resourceForError(t),Ij(e).toString());return e instanceof J1?new J1(n,e.stat,o):e instanceof MO?new MO(n,e.fileOperationResult,e.size,e.options):new ta(n,Au(e),o)}readFileStreamed(e,t,o,n=Object.create(null)){let r=e.readFileStream(t,n,o);return nJt(r,{data:s=>s instanceof qe?s:qe.wrap(s),error:s=>this.restoreReadError(s,t,n)},s=>qe.concat(s))}readFileBuffered(e,t,o,n=Object.create(null)){let r=IIe();return OPo(e,t,r,s=>s,{...n,bufferSize:this.BUFFER_SIZE,errorTransformer:s=>this.restoreReadError(s,t,n)},o),r}readFileUnbuffered(e,t,o){let n=VI(r=>qe.concat(r));return(async()=>{try{let r;o?.atomic&&Tbt(e)?r=await e.readFile(t,{atomic:!0}):r=await e.readFile(t),typeof o?.position=="number"&&(r=r.slice(o.position)),typeof o?.length=="number"&&(r=r.slice(0,o.length)),this.validateReadFileLimits(t,r.byteLength,o),n.end(qe.wrap(r))}catch(r){n.error(r),n.end()}})(),n}async validateReadFile(e,t){let o=await this.resolve(e,{resolveMetadata:!0});if(o.isDirectory)throw new ta(d(2141,null,this.resourceForError(e)),0,t);if(typeof t?.etag=="string"&&t.etag!==JL&&t.etag===o.etag)throw new J1(d(2145,null),o,t);return this.validateReadFileLimits(e,o.size,t),o}validateReadFileLimits(e,t,o){if(typeof o?.limits?.size=="number"&&t>o.limits.size)throw new MO(d(2146,null,this.resourceForError(e)),7,t,o)}async canMove(e,t,o){return this.doCanMoveCopy(e,t,"move",o)}async canCopy(e,t,o){return this.doCanMoveCopy(e,t,"copy",o)}async doCanMoveCopy(e,t,o,n){if(e.toString()!==t.toString())try{let r=o==="move"?this.throwIfFileSystemIsReadonly(await this.withWriteProvider(e),e):await this.withReadProvider(e),s=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(t),t);await this.doValidateMoveCopy(r,e,s,t,o,n)}catch(r){return r}return!0}async move(e,t,o){let n=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(e),e),r=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(t),t),s=await this.doMoveCopy(n,e,r,t,"move",!!o),l=await this.resolve(t,{resolveMetadata:!0});return this._onDidRunOperation.fire(new LO(e,s==="move"?2:3,l)),l}async copy(e,t,o){let n=await this.withReadProvider(e),r=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(t),t),s=await this.doMoveCopy(n,e,r,t,"copy",!!o),l=await this.resolve(t,{resolveMetadata:!0});return this._onDidRunOperation.fire(new LO(e,s==="copy"?3:2,l)),l}async doMoveCopy(e,t,o,n,r,s){if(t.toString()===n.toString())return r;let{exists:l,isSameResourceWithDifferentPathCase:c}=await this.doValidateMoveCopy(e,t,o,n,r,s);if(l&&!c&&s&&await this.del(n,{recursive:!0}),await this.mkdirp(o,this.getExtUri(o).providerExtUri.dirname(n)),r==="copy"){if(e===o&&n5e(e))await e.copy(t,n,{overwrite:s});else{let u=await this.resolve(t);u.isDirectory?await this.doCopyFolder(e,u,o,n):await this.doCopyFile(e,t,o,n)}return r}else return e===o?(await e.rename(t,n,{overwrite:s}),r):(await this.doMoveCopy(e,t,o,n,"copy",s),await this.del(t,{recursive:!0}),"copy")}async doCopyFile(e,t,o,n){if(Sj(e)&&Sj(o))return this.doPipeBuffered(e,t,o,n);if(Sj(e)&&D_(o))return this.doPipeBufferedToUnbuffered(e,t,o,n);if(D_(e)&&Sj(o))return this.doPipeUnbufferedToBuffered(e,t,o,n);if(D_(e)&&D_(o))return this.doPipeUnbuffered(e,t,o,n)}async doCopyFolder(e,t,o,n){await o.mkdir(n),Array.isArray(t.children)&&await dn.settled(t.children.map(async r=>{let s=this.getExtUri(o).providerExtUri.joinPath(n,r.name);return r.isDirectory?this.doCopyFolder(e,await this.resolve(r.resource),o,s):this.doCopyFile(e,r.resource,o,s)}))}async doValidateMoveCopy(e,t,o,n,r,s){let l=!1;if(e===o){let{providerExtUri:u,isPathCaseSensitive:p}=this.getExtUri(e);if(p||(l=u.isEqual(t,n)),l&&r==="copy")throw new Error(d(2150,null,this.resourceForError(t),this.resourceForError(n)));if(!l&&u.isEqualOrParent(n,t))throw new Error(d(2151,null,this.resourceForError(t),this.resourceForError(n)))}let c=await this.exists(n);if(c&&!l){if(!s)throw new ta(d(2152,null,this.resourceForError(t),this.resourceForError(n)),4);if(e===o){let{providerExtUri:u}=this.getExtUri(e);if(u.isEqualOrParent(t,n))throw new Error(d(2153,null,this.resourceForError(t),this.resourceForError(n)))}}return{exists:c,isSameResourceWithDifferentPathCase:l}}getExtUri(e){let t=this.isPathCaseSensitive(e);return{providerExtUri:t?ar:Ax,isPathCaseSensitive:t}}isPathCaseSensitive(e){return!!(e.capabilities&1024)}async createFolder(e){let t=this.throwIfFileSystemIsReadonly(await this.withProvider(e),e);await this.mkdirp(t,e);let o=await this.resolve(e,{resolveMetadata:!0});return this._onDidRunOperation.fire(new LO(e,0,o)),o}async mkdirp(e,t){let o=[],{providerExtUri:n}=this.getExtUri(e);for(;!n.isEqual(t,n.dirname(t));)try{if(((await e.stat(t)).type&2)===0)throw new Error(d(2148,null,this.resourceForError(t)));break}catch(r){if(Ile(r)!=="EntryNotFound")throw r;o.push(n.basename(t)),t=n.dirname(t)}for(let r=o.length-1;r>=0;r--){t=n.joinPath(t,o[r]);try{await e.mkdir(t)}catch(s){if(Ile(s)!=="EntryExists")throw s}}}async canDelete(e,t){try{await this.doValidateDelete(e,t)}catch(o){return o}return!0}async doValidateDelete(e,t){let o=this.throwIfFileSystemIsReadonly(await this.withProvider(e),e),n=!!t?.useTrash;if(n&&!(o.capabilities&4096))throw new Error(d(2135,null,this.resourceForError(e)));let r=t?.atomic;if(r&&!(o.capabilities&65536))throw new Error(d(2131,null,this.resourceForError(e)));if(n&&r)throw new Error(d(2134,null,this.resourceForError(e)));let s;try{s=await o.stat(e)}catch{}if(s)this.throwIfFileIsReadonly(e,s);else throw new ta(d(2133,null,this.resourceForError(e)),1);if(!!!t?.recursive){let c=await this.resolve(e);if(c.isDirectory&&Array.isArray(c.children)&&c.children.length>0)throw new Error(d(2132,null,this.resourceForError(e)))}return o}async del(e,t){let o=await this.doValidateDelete(e,t),n=t;if(X4i(o)&&!n?.atomic){let c=o.enforceAtomicDelete?.(e);c&&(n={...t,atomic:c})}let r=!!n?.useTrash,s=!!n?.recursive,l=n?.atomic??!1;await o.delete(e,{recursive:s,useTrash:r,atomic:l}),this._onDidRunOperation.fire(new LO(e,1))}async cloneFile(e,t){let o=await this.withProvider(e),n=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(t),t);if(!(o===n&&this.getExtUri(o).providerExtUri.isEqual(e,t)))return o===n&&kbt(o)?o.cloneFile(e,t):(await this.mkdirp(n,this.getExtUri(n).providerExtUri.dirname(t)),o===n&&n5e(o)?this.writeQueue.queueFor(e,()=>o.copy(e,t,{overwrite:!0}),this.getExtUri(o).providerExtUri):this.writeQueue.queueFor(e,()=>this.doCopyFile(o,e,n,t),this.getExtUri(o).providerExtUri))}static{this.WATCHER_CORRELATION_IDS=0}createWatcher(e,t){return this.watch(e,{...t,correlationId:nse.WATCHER_CORRELATION_IDS++})}watch(e,t={recursive:!1,excludes:[]}){let o=new N,n=!1,r=()=>{n=!0};o.add(Z(()=>r())),(async()=>{try{let l=await this.doWatch(e,t);n?Be(l):r=()=>Be(l)}catch(l){this.logService.error(l)}})();let s=t.correlationId;if(typeof s=="number"){let l=o.add(new E);return o.add(this.internalOnDidFilesChange.event(u=>{u.correlates(s)&&l.fire(u)})),{onDidChange:l.event,dispose:()=>o.dispose()}}return o}async doWatch(e,t){let o=await this.withProvider(e),n=_r([this.getExtUri(o).providerExtUri.getComparisonKey(e),t]),r=this.activeWatchers.get(n);return r||(r={count:0,disposable:o.watch(e,t)},this.activeWatchers.set(n,r)),r.count+=1,Z(()=>{r&&(r.count--,r.count===0&&(Be(r.disposable),this.activeWatchers.delete(n)))})}dispose(){super.dispose();for(let[,e]of this.activeWatchers)Be(e.disposable);this.activeWatchers.clear()}async doWriteBuffered(e,t,o,n){return this.writeQueue.queueFor(t,async()=>{let r=await e.open(t,{create:!0,unlock:o?.unlock??!1,append:o?.append??!1});try{z9(n)||egt(n)?await this.doWriteStreamBufferedQueued(e,r,n):await this.doWriteReadableBufferedQueued(e,r,n)}catch(s){throw Ij(s)}finally{await e.close(r)}},this.getExtUri(e).providerExtUri)}async doWriteStreamBufferedQueued(e,t,o){let n=0,r;if(egt(o)){if(o.buffer.length>0){let s=qe.concat(o.buffer);await this.doWriteBuffer(e,t,s,s.byteLength,n,0),n+=s.byteLength}if(o.ended)return;r=o.stream}else r=o;return new Promise((s,l)=>{fV(r,{onData:async c=>{r.pause();try{await this.doWriteBuffer(e,t,c,c.byteLength,n,0)}catch(u){return l(u)}n+=c.byteLength,setTimeout(()=>r.resume())},onError:c=>l(c),onEnd:()=>s()})})}async doWriteReadableBufferedQueued(e,t,o){let n=0,r;for(;(r=o.read())!==null;)await this.doWriteBuffer(e,t,r,r.byteLength,n,0),n+=r.byteLength}async doWriteBuffer(e,t,o,n,r,s){let l=0;for(;l<n;){let c=await e.write(t,r+l,o.buffer,s+l,n-l);l+=c}}async doWriteUnbuffered(e,t,o,n){return this.writeQueue.queueFor(t,()=>this.doWriteUnbufferedQueued(e,t,o,n),this.getExtUri(e).providerExtUri)}async doWriteUnbufferedQueued(e,t,o,n){let r;n instanceof qe?r=n:z9(n)?r=await tb(n):egt(n)?r=await lqi(n):r=ngt(n),await e.writeFile(t,r.buffer,{create:!0,overwrite:!0,unlock:o?.unlock??!1,atomic:o?.atomic??!1,append:o?.append??!1})}async doPipeBuffered(e,t,o,n){return this.writeQueue.queueFor(n,()=>this.doPipeBufferedQueued(e,t,o,n),this.getExtUri(o).providerExtUri)}async doPipeBufferedQueued(e,t,o,n){let r,s;try{r=await e.open(t,{create:!1}),s=await o.open(n,{create:!0,unlock:!1});let l=qe.alloc(this.BUFFER_SIZE),c=0,u=0,p=0;do p=await e.read(r,c,l.buffer,u,l.byteLength-u),await this.doWriteBuffer(o,s,l,p,c,u),c+=p,u+=p,u===l.byteLength&&(u=0);while(p>0)}catch(l){throw Ij(l)}finally{await dn.settled([typeof r=="number"?e.close(r):Promise.resolve(),typeof s=="number"?o.close(s):Promise.resolve()])}}async doPipeUnbuffered(e,t,o,n){return this.writeQueue.queueFor(n,()=>this.doPipeUnbufferedQueued(e,t,o,n),this.getExtUri(o).providerExtUri)}async doPipeUnbufferedQueued(e,t,o,n){return o.writeFile(n,await e.readFile(t),{create:!0,overwrite:!0,unlock:!1,atomic:!1})}async doPipeUnbufferedToBuffered(e,t,o,n){return this.writeQueue.queueFor(n,()=>this.doPipeUnbufferedToBufferedQueued(e,t,o,n),this.getExtUri(o).providerExtUri)}async doPipeUnbufferedToBufferedQueued(e,t,o,n){let r=await o.open(n,{create:!0,unlock:!1});try{let s=await e.readFile(t);await this.doWriteBuffer(o,r,qe.wrap(s),s.byteLength,0,0)}catch(s){throw Ij(s)}finally{await o.close(r)}}async doPipeBufferedToUnbuffered(e,t,o,n){let r=await tb(this.readFileBuffered(e,t,Se.None));await this.doWriteUnbuffered(o,n,void 0,r)}throwIfFileSystemIsReadonly(e,t){if(e.capabilities&2048)throw new ta(d(2138,null,this.resourceForError(t)),6);return e}throwIfFileIsReadonly(e,t){if((t.permissions??0)&1)throw new ta(d(2138,null,this.resourceForError(e)),6)}resourceForError(e){return e.scheme===Q.file?e.fsPath:e.toString(!0)}};nse=I([m(0,se)],nse);function FPo(a){return a.recursive===!0}var Y1i=class a extends x{constructor(e,t,o,n){super();this.onFileChanges=e;this.onLogMessage=t;this.verboseLogging=o;this.options=n;this.watcherDisposables=this._register(new me);this.requests=void 0;this.restartCounter=0}static{this.MAX_RESTARTS=5}init(){let e=new N;this.watcherDisposables.value=e,this.watcher=this.createWatcher(e),this.watcher.setVerboseLogging(this.verboseLogging),e.add(this.watcher.onDidChangeFile(t=>this.onFileChanges(t))),e.add(this.watcher.onDidLogMessage(t=>this.onLogMessage(t))),e.add(this.watcher.onDidError(t=>this.onError(t.error,t.request)))}onError(e,t){this.canRestart(e,t)?this.restartCounter<a.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,t){return!(!this.options.restartOnError||t||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()}};var K9t=class extends Y1i{constructor(i,e,t){super(i,e,t,{type:"universal",restartOnError:!0})}};function Zut(a){return a.map(i=>({type:i.type,resource:A.revive(i.resource),cId:i.cId}))}var WPo="localFilesystem",B2e=class extends x{constructor(e,t){super();this.channel=e;this.extraCapabilities=t;this.onDidChangeCapabilities=U.None;this._onDidChange=this._register(new E);this.onDidChangeFile=this._onDidChange.event;this._onDidWatchError=this._register(new E);this.onDidWatchError=this._onDidWatchError.event;this.sessionId=xt();this.registerFileChangeListeners()}get capabilities(){return this._capabilities||(this._capabilities=1040414,this.extraCapabilities.pathCaseSensitive&&(this._capabilities|=1024),this.extraCapabilities.trash&&(this._capabilities|=4096)),this._capabilities}stat(e){return this.channel.call("stat",[e])}realpath(e){return this.channel.call("realpath",[e])}readdir(e){return this.channel.call("readdir",[e])}async readFile(e,t){let{buffer:o}=await this.channel.call("readFile",[e,t]);return o}readFileStream(e,t,o){let n=VI(s=>qe.concat(s.map(l=>qe.wrap(l))).buffer),r=new N;return r.add(this.channel.listen("readFileStream",[e,t])(s=>{if(s instanceof qe)n.write(s.buffer);else{if(s==="end")n.end();else{let l;if(s instanceof Error)l=s;else{let c=s;l=Ps(c.message??xn(c),c.code??"Unknown")}n.error(l),n.end()}r.dispose()}})),r.add(o.onCancellationRequested(()=>{n.error(PI()),n.end(),r.dispose()})),n}writeFile(e,t,o){return this.channel.call("writeFile",[e,qe.wrap(t),o])}open(e,t){return this.channel.call("open",[e,t])}close(e){return this.channel.call("close",[e])}async read(e,t,o,n,r){let[s,l]=await this.channel.call("read",[e,t,r]);return o.set(s.buffer.slice(0,l),n),l}write(e,t,o,n,r){return this.channel.call("write",[e,t,qe.wrap(o),n,r])}mkdir(e){return this.channel.call("mkdir",[e])}delete(e,t){return this.channel.call("delete",[e,t])}rename(e,t,o){return this.channel.call("rename",[e,t,o])}copy(e,t,o){return this.channel.call("copy",[e,t,o])}cloneFile(e,t){return this.channel.call("cloneFile",[e,t])}registerFileChangeListeners(){this._register(this.channel.listen("fileChange",[this.sessionId])(e=>{if(Array.isArray(e)){let t=e;this._onDidChange.fire(Zut(t))}else{let t=e;this._onDidWatchError.fire(t)}}))}watch(e,t){let o=xt();return this.channel.call("watch",[this.sessionId,o,e,t]),Z(()=>this.channel.call("unwatch",[this.sessionId,o]))}};var jIn="remoteFilesystem",G9t=class a extends B2e{static register(i,e,t){let o=i.getConnection();if(!o)return x.None;let n=new N,r=(async()=>{try{let s=await i.getRawEnvironment();s?e.registerProvider(Q.vscodeRemote,n.add(new a(s,o))):t.error("Cannot register remote filesystem provider. Remote environment doesnot exist.")}catch(s){t.error("Cannot register remote filesystem provider. Error while fetching remote environment.",Pn(s))}})();return n.add(e.onWillActivateFileSystemProvider(s=>{s.scheme===Q.vscodeRemote&&s.join(r)})),n}constructor(i,e){super(e.getChannel(jIn),{pathCaseSensitive:i.os===3})}};var q9t=class{constructor(i,e,t){this.donotCacheResourcesWithSchemes=i;this.fileService=t;this.cachedConfigurations=new Map;this.cacheHome=e.cacheHome}needsCaching(i){return!this.donotCacheResourcesWithSchemes.includes(i.scheme)}read(i){return this.getCachedConfiguration(i).read()}write(i,e){return this.getCachedConfiguration(i).save(e)}remove(i){return this.getCachedConfiguration(i).remove()}getCachedConfiguration({type:i,key:e}){let t=`${i}:${e}`,o=this.cachedConfigurations.get(t);return o||(o=new X1i({type:i,key:e},this.cacheHome,this.fileService),this.cachedConfigurations.set(t,o)),o}},X1i=class{constructor({type:i,key:e},t,o){this.fileService=o;this.cachedConfigurationFolderResource=Ge(t,"CachedConfigurations",i,e),this.cachedConfigurationFileResource=Ge(this.cachedConfigurationFolderResource,i==="workspaces"?"workspace.json":"configuration.json"),this.queue=new uh}async read(){try{return(await this.fileService.readFile(this.cachedConfigurationFileResource)).value.toString()}catch{return""}}async save(i){await this.createCachedFolder()&&await this.queue.queue(async()=>{await this.fileService.writeFile(this.cachedConfigurationFileResource,qe.fromString(i))})}async remove(){try{await this.queue.queue(()=>this.fileService.del(this.cachedConfigurationFolderResource,{recursive:!0,useTrash:!1}))}catch(i){if(i.fileOperationResult!==1)throw i}}async createCachedFolder(){if(await this.fileService.exists(this.cachedConfigurationFolderResource))return!0;try{return await this.fileService.createFolder(this.cachedConfigurationFolderResource),!0}catch{return!1}}};var $9t=class a{constructor(i){this.uri=i;this.time=a._clock++}static{this._clock=0}touch(){return this.time=a._clock++,this}},aSe=class{constructor(i){this._fileService=i;this._dispooables=new N;this._limit=2**16;let e=new Map,t=o=>{let n=e.get(o.scheme);return n===void 0&&(n=i.hasProvider(o)&&!this._fileService.hasCapability(o,1024),e.set(o.scheme,n)),n};this._dispooables.add(U.any(i.onDidChangeFileSystemProviderRegistrations,i.onDidChangeFileSystemProviderCapabilities)(o=>{if(e.get(o.scheme)===void 0)return;e.delete(o.scheme);let r=t(A.from({scheme:o.scheme}));if(r!==r)for(let[s,l]of this._canonicalUris.entries())l.uri.scheme===o.scheme&&this._canonicalUris.delete(s)})),this.extUri=new Zse(t),this._canonicalUris=new Map}dispose(){this._dispooables.dispose(),this._canonicalUris.clear()}asCanonicalUri(i){this._fileService.hasProvider(i)&&(i=F$(i));let e=this.extUri.getComparisonKey(i,!0),t=this._canonicalUris.get(e);return t?t.touch().uri.with({fragment:i.fragment}):(this._canonicalUris.set(e,new $9t(i)),this._checkTrim(),i)}_checkTrim(){if(this._canonicalUris.size<this._limit)return;$9t._clock=1;let i=[...this._canonicalUris.values()].map(t=>t.time),e=_9(Math.floor(i.length/2),i,(t,o)=>t-o);for(let[t,o]of this._canonicalUris.entries())o.time<=e?this._canonicalUris.delete(t):o.time=0}};aSe=I([m(0,fe)],aSe);Ee(ht,aSe,1);var j9t=le("nativeKeyboardLayoutService"),H2e=class extends x{constructor(e){super();this._onDidChangeKeyboardLayout=this._register(new E);this.onDidChangeKeyboardLayout=this._onDidChangeKeyboardLayout.event;this._keyboardLayoutService=Tc.toService(e.getChannel("keyboardLayout")),this._initPromise=null,this._keyboardMapping=null,this._keyboardLayoutInfo=null,this._register(this._keyboardLayoutService.onDidChangeKeyboardLayout(async({keyboardLayoutInfo:t,keyboardMapping:o})=>{await this.initialize(),!QIn(this._keyboardMapping,o)&&(this._keyboardMapping=o,this._keyboardLayoutInfo=t,this._onDidChangeKeyboardLayout.fire())}))}initialize(){return this._initPromise||(this._initPromise=this._doInitialize()),this._initPromise}async _doInitialize(){let e=await this._keyboardLayoutService.getKeyboardLayoutData(),{keyboardLayoutInfo:t,keyboardMapping:o}=e;this._keyboardMapping=o,this._keyboardLayoutInfo=t}getRawKeyboardMapping(){return this._keyboardMapping}getCurrentKeyboardLayout(){return this._keyboardLayoutInfo}};H2e=I([m(0,pu)],H2e);function QIn(a,i){return Po===1?bdo(a,i):Sdo(a,i)}var Q9t=class{constructor(i,e){this.sender=i;this.onMessage=e}send(i){try{this.sender.send("vscode:message",i.buffer)}catch{}}disconnect(){this.sender.send("vscode:disconnect",null)}};var Y9t=class a extends GJ{static createProtocol(){let i=U.fromNodeEventEmitter(tl,"vscode:message",(e,t)=>qe.wrap(t));return tl.send("vscode:hello"),new Q9t(tl,i)}constructor(i){let e=a.createProtocol();super(e,i),this.protocol=e}dispose(){this.protocol.disconnect(),super.dispose()}};var X9t=class extends x{constructor(i){super(),this.mainProcessConnection=this._register(new Y9t(`window:${i}`))}getChannel(i){return this.mainProcessConnection.getChannel(i)}registerChannel(i,e){this.mainProcessConnection.registerChannel(i,e)}};var rse=class extends x{constructor(i,e=[]){super(),this.logger=new Kgt([i,...e]),this._register(i.onDidChangeLogLevel(t=>this.setLevel(t)))}get onDidChangeLogLevel(){return this.logger.onDidChangeLogLevel}setLevel(i){this.logger.setLevel(i)}getLevel(){return this.logger.getLevel()}trace(i,...e){this.logger.trace(i,...e)}debug(i,...e){this.logger.debug(i,...e)}info(i,...e){this.logger.info(i,...e)}warn(i,...e){this.logger.warn(i,...e)}error(i,...e){this.logger.error(i,...e)}flush(){this.logger.flush()}};var J9t=class extends rse{constructor(i,e){let t=new N,o=t.add(i.createLogger(e.logFile,{id:_pe,name:oM.name,group:oM})),n;e.isExtensionDevelopment&&e.extensionTestsLocationURI?n=i.createConsoleMainLogger():n=new zgt(o.getLevel()),super(o,[n]),this._register(t)}};var Z9t=class extends x{constructor(e,t){super();this.logService=e;this.options=t;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 ya(this.getRefreshWatchersDelay(this.universalWatchRequests.length)));this.nonRecursiveWatchRequests=[];this.nonRecursiveWatchRequestDelayer=this._register(new ya(this.getRefreshWatchersDelay(this.nonRecursiveWatchRequests.length)))}watch(e,t){return t.recursive||this.options?.watcher?.forceUniversal?this.watchUniversal(e,t):this.watchNonRecursive(e,t)}getRefreshWatchersDelay(e){return e>200?500:0}watchUniversal(e,t){let o=this.toWatchRequest(e,t),n=ah(this.universalWatchRequests,o);return this.refreshUniversalWatchers(),Z(()=>{n(),this.refreshUniversalWatchers()})}toWatchRequest(e,t){let o={path:this.toWatchPath(e),excludes:t.excludes,includes:t.includes,recursive:t.recursive,filter:t.filter,correlationId:t.correlationId};if(FPo(o)){let n=this.options?.watcher?.recursive?.usePolling;n===!0?o.pollingInterval=this.options?.watcher?.recursive?.pollingInterval??5e3:Array.isArray(n)&&n.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=>mt(e))}doRefreshUniversalWatchers(){return this.universalWatcher||(this.universalWatcher=this._register(this.createUniversalWatcher(e=>this._onDidChangeFile.fire(Zut(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,t){let o={path:this.toWatchPath(e),excludes:t.excludes,includes:t.includes,recursive:!1,filter:t.filter,correlationId:t.correlationId},n=ah(this.nonRecursiveWatchRequests,o);return this.refreshNonRecursiveWatchers(),Z(()=>{n(),this.refreshNonRecursiveWatchers()})}refreshNonRecursiveWatchers(){this.nonRecursiveWatchRequestDelayer.trigger(()=>this.doRefreshNonRecursiveWatchers(),this.getRefreshWatchersDelay(this.nonRecursiveWatchRequests.length)).catch(e=>mt(e))}doRefreshNonRecursiveWatchers(){return this.nonRecursiveWatcher||(this.nonRecursiveWatcher=this._register(this.createNonRecursiveWatcher(e=>this._onDidChangeFile.fire(Zut(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 ch(e.fsPath)}toWatchPath(e){let t=this.toFilePath(e);return WGi(t)}};var e7t=class extends K9t{constructor(e,t,o,n){super(e,t,o);this.utilityProcessWorkerWorkbenchService=n;this.init()}createWatcher(e){return Tc.toService(n2((async()=>{let{client:o,onDidTerminate:n}=e.add(await this.utilityProcessWorkerWorkbenchService.createWorker({moduleId:"vs/platform/files/node/watcher/watcherMain",type:"fileWatcher",name:"file-watcher"}));return n.then(({reason:r})=>{r?.code===0?this.trace(`terminated by itself with code ${r.code}, signal: ${r.signal}`):this.onError(`terminated by itself unexpectedly with code ${r?.code}, signal: ${r?.signal} (ETERM)`)}),o.getChannel("watcher")})()))}};var t7t=class extends Z9t{constructor(e,t,o,n){super(o,{watcher:{forceUniversal:!0}});this.utilityProcessWorkerWorkbenchService=t;this.loggerService=n;this._watcherLogService=void 0;this.provider=this._register(new B2e(e.getChannel(WPo),{pathCaseSensitive:fn,trash:!0})),this.registerListeners()}registerListeners(){this._register(this.provider.onDidChangeFile(e=>this._onDidChangeFile.fire(e))),this._register(this.provider.onDidWatchError(e=>this._onDidWatchError.fire(e)))}get onDidChangeCapabilities(){return this.provider.onDidChangeCapabilities}get capabilities(){return this.provider.capabilities}stat(e){return this.provider.stat(e)}realpath(e){return this.provider.realpath(e)}readdir(e){return this.provider.readdir(e)}readFile(e,t){return this.provider.readFile(e,t)}readFileStream(e,t,o){return this.provider.readFileStream(e,t,o)}writeFile(e,t,o){return this.provider.writeFile(e,t,o)}open(e,t){return this.provider.open(e,t)}close(e){return this.provider.close(e)}read(e,t,o,n,r){return this.provider.read(e,t,o,n,r)}write(e,t,o,n,r){return this.provider.write(e,t,o,n,r)}mkdir(e){return this.provider.mkdir(e)}delete(e,t){return this.provider.delete(e,t)}rename(e,t,o){return this.provider.rename(e,t,o)}copy(e,t,o){return this.provider.copy(e,t,o)}cloneFile(e,t){return this.provider.cloneFile(e,t)}createUniversalWatcher(e,t,o){return new e7t(n=>e(n),n=>t(n),o,this.utilityProcessWorkerWorkbenchService)}createNonRecursiveWatcher(){throw new Error("Method not implemented in sandbox.")}get watcherLogService(){return this._watcherLogService||(this._watcherLogService=new rse(this.loggerService.createLogger("fileWatcher",{name:d(17781,null)}))),this._watcherLogService}logWatcherMessage(e){this.watcherLogService[e.type](e.message),e.type!=="trace"&&e.type!=="debug"&&super.logWatcherMessage(e)}};var i7t=class extends x{constructor(e,t,o,n,r,s){super();this.fileSystemScheme=e;this.fileSystemProvider=t;this.userDataScheme=o;this.userDataProfilesService=n;this.uriIdentityService=r;this.logService=s;this.capabilities=this.fileSystemProvider.capabilities,this.onDidChangeCapabilities=this.fileSystemProvider.onDidChangeCapabilities,this._onDidChangeFile=this._register(new E),this.onDidChangeFile=this._onDidChangeFile.event,this.watchResources=Sp.forUris(()=>!(this.capabilities&1024)),this.atomicReadWriteResources=new En(l=>this.uriIdentityService.extUri.getComparisonKey(this.toFileSystemResource(l))),this.updateAtomicReadWritesResources(),this._register(n.onDidChangeProfiles(()=>this.updateAtomicReadWritesResources())),this._register(this.fileSystemProvider.onDidChangeFile(l=>this.handleFileChanges(l)))}updateAtomicReadWritesResources(){this.atomicReadWriteResources.clear();for(let e of this.userDataProfilesService.profiles)this.atomicReadWriteResources.add(e.settingsResource),this.atomicReadWriteResources.add(e.keybindingsResource),this.atomicReadWriteResources.add(e.tasksResource),this.atomicReadWriteResources.add(e.extensionsResource)}open(e,t){return this.fileSystemProvider.open(this.toFileSystemResource(e),t)}close(e){return this.fileSystemProvider.close(e)}read(e,t,o,n,r){return this.fileSystemProvider.read(e,t,o,n,r)}write(e,t,o,n,r){return this.fileSystemProvider.write(e,t,o,n,r)}watch(e,t){this.watchResources.set(e,e);let o=this.fileSystemProvider.watch(this.toFileSystemResource(e),t);return Z(()=>{this.watchResources.delete(e),o.dispose()})}stat(e){return this.fileSystemProvider.stat(this.toFileSystemResource(e))}mkdir(e){return this.fileSystemProvider.mkdir(this.toFileSystemResource(e))}rename(e,t,o){return this.fileSystemProvider.rename(this.toFileSystemResource(e),this.toFileSystemResource(t),o)}readFile(e,t){return this.fileSystemProvider.readFile(this.toFileSystemResource(e),t)}readFileStream(e,t,o){return this.fileSystemProvider.readFileStream(this.toFileSystemResource(e),t,o)}readdir(e){return this.fileSystemProvider.readdir(this.toFileSystemResource(e))}enforceAtomicReadFile(e){return this.atomicReadWriteResources.has(e)}writeFile(e,t,o){return this.fileSystemProvider.writeFile(this.toFileSystemResource(e),t,o)}enforceAtomicWriteFile(e){return this.atomicReadWriteResources.has(e)?{postfix:".vsctmp"}:!1}delete(e,t){return this.fileSystemProvider.delete(this.toFileSystemResource(e),t)}copy(e,t,o){if(n5e(this.fileSystemProvider))return this.fileSystemProvider.copy(this.toFileSystemResource(e),this.toFileSystemResource(t),o);throw new Error("copy not supported")}cloneFile(e,t){if(kbt(this.fileSystemProvider))return this.fileSystemProvider.cloneFile(this.toFileSystemResource(e),this.toFileSystemResource(t));throw new Error("clone not supported")}handleFileChanges(e){let t=[];for(let o of e){if(o.resource.scheme!==this.fileSystemScheme)continue;let n=this.toUserDataResource(o.resource);this.watchResources.findSubstr(n)&&t.push({resource:n,type:o.type,cId:o.cId})}t.length&&(this.logService.debug("User data changed"),this._onDidChangeFile.fire(t))}toFileSystemResource(e){return e.with({scheme:this.fileSystemScheme})}toUserDataResource(e){return e.with({scheme:this.userDataScheme})}};var o7t=class extends MZ{constructor(e,t){super();this.channel=t;for(let o in e){let{definition:n,value:r}=e[o];this.policyDefinitions[o]=n,r!==void 0&&this.policies.set(o,r)}this.channel.listen("onDidChange")(o=>{for(let n in o){let r=o[n];r===null?this.policies.delete(n):this.policies.set(n,r)}this._onDidChange.fire(Object.keys(o))})}async _updatePolicyDefinitions(e){let t=await this.channel.call("updatePolicyDefinitions",e);for(let o in t)this.policies.set(o,t[o])}};var n7t=class extends x{constructor(e){super();this._onDidChangeCurrentProfile=this._register(new E);this.onDidChangeCurrentProfile=this._onDidChangeCurrentProfile.event;this._currentProfile=e}get currentProfile(){return this._currentProfile}async updateCurrentProfile(e){if(eo(this._currentProfile,e))return;let t=this._currentProfile;this._currentProfile=e;let o=[];this._onDidChangeCurrentProfile.fire({previous:t,profile:e,join(n){o.push(n)}}),await dn.settled(o)}};var J1i=class extends x{constructor(e,t){super();this._onData=this._register(new E);this.onData=this._onData.event;this._onOpen=this._register(new E);this.onOpen=this._onOpen.event;this._onClose=this._register(new E);this.onClose=this._onClose.event;this._onError=this._register(new E);this.onError=this._onError.event;this._debugLabel=t,this._socket=new WebSocket(e),this.traceSocketEvent("created",{type:"BrowserWebSocket",url:e}),this._fileReader=new FileReader,this._queue=[],this._isReading=!1,this._isClosed=!1,this._fileReader.onload=u=>{this._isReading=!1;let p=u.target.result;this.traceSocketEvent("read",p),this._onData.fire(p),this._queue.length>0&&o(this._queue.shift())};let o=u=>{if(this._isReading){this._queue.push(u);return}this._isReading=!0,this._fileReader.readAsArrayBuffer(u)};this._socketMessageListener=u=>{let p=u.data;this.traceSocketEvent("browserWebSocketBlobReceived",{type:p.type,size:p.size}),o(p)},this._socket.addEventListener("message",this._socketMessageListener),this._register(j(this._socket,"open",u=>{this.traceSocketEvent("open"),this._onOpen.fire()}));let n=null,r=()=>{let u=n;n=null,this._onError.fire(u)},s=this._register(new Dt(r,0)),l=u=>{s.cancel(),n=u,s.schedule()},c=u=>{s.cancel(),n=u,r()};this._register(j(this._socket,"close",u=>{this.traceSocketEvent("close",{code:u.code,reason:u.reason,wasClean:u.wasClean}),this._isClosed=!0,n&&(navigator.onLine?u.wasClean?(s.cancel(),r()):c(new Ew(u.reason||`WebSocket close with status code ${u.code}`,"TemporarilyNotAvailable",u)):c(new Ew("Browser is offline","TemporarilyNotAvailable",u))),this._onClose.fire({code:u.code,reason:u.reason,wasClean:u.wasClean,event:u})})),this._register(j(this._socket,"error",u=>{this.traceSocketEvent("error",{message:u?.message}),l(u)}))}traceSocketEvent(e,t){c_e.traceSocketEvent(this._socket,this._debugLabel,e,t)}send(e){this._isClosed||(this.traceSocketEvent("write",e),this._socket.send(e))}close(){this._isClosed=!0,this.traceSocketEvent("close"),this._socket.close(),this._socket.removeEventListener("message",this._socketMessageListener),this.dispose()}},YIn=new class{create(a,i){return new J1i(a,i)}},Z1i=class{traceSocketEvent(i,e){typeof this.socket.traceSocketEvent=="function"?this.socket.traceSocketEvent(i,e):c_e.traceSocketEvent(this.socket,this.debugLabel,i,e)}constructor(i,e){this.socket=i,this.debugLabel=e}dispose(){this.socket.close()}onData(i){return this.socket.onData(e=>i(qe.wrap(new Uint8Array(e))))}onClose(i){let e=t=>{i(typeof t>"u"?t:{type:1,code:t.code,reason:t.reason,wasClean:t.wasClean,event:t.event})};return this.socket.onClose(e)}onEnd(i){return x.None}write(i){this.socket.send(i.buffer)}end(){this.socket.close()}drain(){return Promise.resolve()}},r7t=class{constructor(i){this._webSocketFactory=i||YIn}supports(i){return!0}connect({host:i,port:e},t,o,n){return new Promise((r,s)=>{let l=/^https:/.test(ut.location.href)?"wss":"ws",c=this._webSocketFactory.create(`${l}://${/:/.test(i)&&!/\[/.test(i)?`[${i}]`:i}:${e}${t}?${o}&skipWebSocketFrames=false`,n),u=new N;u.add(c.onError(s)),u.add(c.onOpen(()=>{u.dispose(),r(new Z1i(c,n))}))})}};var VPo="request",BPo="remoteResourceHandler";var U2e=class extends x{constructor(e,t,o){super();this.windowId=e;this.fileService=o;let n={listen(r,s){throw new Error(`Event not found: ${s}`)},call:(r,s,l)=>{if(s===VPo)return this.doRequest(A.revive(l[0]));throw new Error(`Call not found: ${s}`)}};t.registerChannel(BPo,n)}async doRequest(e){let t;try{let n=new URLSearchParams(e.query),r=e.with({scheme:n.get("scheme"),authority:n.get("authority"),query:""});t=await this.fileService.readFile(r)}catch(n){let r=Yd(qe.fromString(n.message));return n instanceof ta&&n.fileOperationResult===1?{statusCode:404,body:r}:{statusCode:500,body:r}}let o=e.path&&X$i(e.path);return{statusCode:200,body:Yd(t.value),mimeType:o}}getResourceUriProvider(){return e=>e.with({scheme:Q.vscodeManagedRemoteResource,authority:`window:${this.windowId}`,query:new URLSearchParams({authority:e.authority,scheme:e.scheme}).toString()})}};U2e=I([m(1,pu),m(2,fe)],U2e);var z2e=class extends MZ{constructor(e,t){super();this.logService=e;this.defaultAccountService=t;this._updatePolicyDefinitions(this.policyDefinitions),this._register(this.defaultAccountService.onDidChangePolicyData(()=>{this._updatePolicyDefinitions(this.policyDefinitions)}))}async _updatePolicyDefinitions(e){this.logService.trace(`AccountPolicyService#_updatePolicyDefinitions: Got ${Object.keys(e).length} policy definitions`);let t=[],o=this.defaultAccountService.policyData;for(let n in e){let r=e[n],s=o&&r.value?r.value(o):void 0;s!==void 0?this.policies.get(n)!==s&&(this.policies.set(n,s),t.push(n)):this.policies.delete(n)&&t.push(n)}t.length&&this._onDidChange.fire(t)}};z2e=I([m(0,se),m(1,ng)],z2e);var K2e=class extends MZ{constructor(e,t){super();this.policyServices=e;this.logService=t;this.updatePolicies(),this._register(U.any(...this.policyServices.map(o=>o.onDidChange))(o=>{this.updatePolicies(),this._onDidChange.fire(o)}))}async updatePolicyDefinitions(e){return await this._updatePolicyDefinitions(e),vt.reduce(this.policies.entries(),(t,[o,n])=>({...t,[o]:n}),{})}async _updatePolicyDefinitions(e){await Promise.all(this.policyServices.map(t=>t.updatePolicyDefinitions(e))),this.updatePolicies()}updatePolicies(){this.policies.clear();let e=[];for(let o of this.policyServices){let n=o.policyDefinitions;for(let r in n){let s=o.getPolicyValue(r);this.policyDefinitions[r]=n[r],s!==void 0&&(e.push(r),this.policies.set(r,s))}}let t=new Set;for(let o of e)t.has(o)&&this.logService.warn(`MultiplexPolicyService#_updatePolicyDefinitions - Found overlapping keys in policy services: ${o}`),t.add(o)}};K2e=I([m(1,se)],K2e);var ezi=class extends x{constructor(e){super();this.configuration=e;this.init()}init(){this.reviveUris(),L$(!!this.configuration.fullscreen,ut)}reviveUris(){let e=W6i(this.configuration.workspace);(ny(e)||Zh(e))&&(this.configuration.workspace=e);let t=this.configuration.filesToWait,o=t?.paths;for(let n of[o,this.configuration.filesToOpenOrCreate,this.configuration.filesToDiff,this.configuration.filesToMerge])if(Array.isArray(n))for(let r of n)r.fileUri&&(r.fileUri=A.revive(r.fileUri));t&&(t.waitMarkerFileUri=A.revive(t.waitMarkerFileUri))}async open(){let[e]=await Promise.all([this.initServices(),Xqi(ut)]);this.applyWindowZoomLevel(e.configurationService);let t=new _9t(ut.document.body,{extraClasses:this.getExtraClasses(),resetLayout:this.configuration["disable-layout-restore"]===!0},e.serviceCollection,e.logService);this.registerListeners(t,e.storageService);let o=t.startup();this._register(o.createInstance(o$))}applyWindowZoomLevel(e){let t;if(this.configuration.isCustomZoomLevel&&typeof this.configuration.zoomLevel=="number")t=this.configuration.zoomLevel;else{let o=e.getValue();t=typeof o.window?.zoomLevel=="number"?o.window.zoomLevel:0}t$(t,ut)}getExtraClasses(){return Ze&&kht(this.configuration.os.release)?["macos-tahoe"]:[]}registerListeners(e,t){this._register(e.onWillShutdown(o=>o.join(t.close(),{id:"join.closeStorage",label:d(17187,null)}))),this._register(e.onDidShutdown(()=>this.dispose()))}async initServices(){let e=new _o,t=this._register(new X9t(this.configuration.windowId));e.set(pu,t);let o={_serviceBrand:void 0,...ro};e.set(tt,o);let n=new rh(this.configuration,o);e.set(zr,n);let r=this.configuration.loggers.map(J=>({...J,resource:A.revive(J.resource)})),s=new fQt(this.configuration.windowId,this.configuration.logLevel,n.windowLogsPath,r,t.getChannel("logger"));e.set(Il,s);let l=this._register(new J9t(s,n));e.set(se,l),ef&&l.info("workbench#open()"),l.getLevel()===1&&l.trace("workbench#open(): with configuration",CV({...this.configuration,nls:void 0}));let c=this._register(new RMe(o));e.set(ng,c);let u,p=new z2e(l,c);if(this.configuration.policiesData){let J=new o7t(this.configuration.policiesData,t.getChannel("policy"));u=new K2e([J,p],l)}else u=p;e.set(iLe,u);let h=new N2e(this.configuration.windowId,l);e.set(Qb,h);let g=new D2e(this.configuration.windowId,l,t);e.set(L9t,g);let f=Tc.toService(t.getChannel("sign"));e.set(ose,f);let v=this._register(new nse(l));e.set(fe,v);let b=new O2e(o,new U2e(n.window.id,t,v));e.set(Uc,b);let S=this._register(new t7t(t,g,l,s));v.registerProvider(Q.file,S);let y=new aSe(v);e.set(ht,y);let w=new nMe(this.configuration.profiles.all,A.revive(this.configuration.profiles.home).with({scheme:n.userRoamingDataHome.scheme}),t.getChannel("userDataProfiles"));e.set(an,w);let k=new n7t(fw(this.configuration.profiles.profile,w.profilesHome.scheme));e.set(ln,k),v.registerProvider(Q.vscodeUserData,this._register(new i7t(Q.file,S,Q.vscodeUserData,w,y,l)));let T=new ZMt;T.register(0,new r7t(null)),e.set(r2,T);let P=this._register(new W2e(T,k,n,o,b,f,l));e.set(bo,P),this._register(G9t.register(P,v,l));let O=this.resolveWorkspaceIdentifier(n),[V,H]=await Promise.all([this.createWorkspaceService(O,n,k,w,v,P,y,l,u).then(J=>(e.set(Pe,J),e.set(fg,J),J)),this.createStorageService(O,n,k,w,t).then(J=>(e.set(ce,J),J)),this.createKeyboardLayoutService(t).then(J=>(e.set(j9t,J),J))]),G=new pTe(V,n);e.set(kR,G);let $=new mTe(V,b,H,y,n,V,G,v);return e.set(Nr,$),V.updateWorkspaceTrust($.isWorkspaceTrusted()),this._register($.onDidChangeTrust(()=>V.updateWorkspaceTrust($.isWorkspaceTrusted()))),{serviceCollection:e,logService:l,storageService:H,configurationService:V}}resolveWorkspaceIdentifier(e){return this.configuration.workspace?this.configuration.workspace:Dg(this.configuration.backupPath,e.isExtensionDevelopment)}async createWorkspaceService(e,t,o,n,r,s,l,c,u){let p=new q9t([Q.file,Q.vscodeUserData],t,r),h=new H9t({remoteAuthority:t.remoteAuthority,configurationCache:p},t,o,n,r,s,l,c,u);try{return await h.initialize(e),h}catch(g){return mt(g),h}}async createStorageService(e,t,o,n,r){let s=new z9t(e,o,n,r,t);try{return await s.initialize(),s}catch(l){return mt(l),s}}async createKeyboardLayoutService(e){let t=new H2e(e);try{return await t.initialize(),t}catch(o){return mt(o),t}}};function XIn(a){return new ezi(a).open()}var s7t=class extends K{constructor(){super({id:"workbench.action.toggleDevTools",title:L(17083,"Toggle Developer Tools"),category:Ve.Developer,f1:!0,keybinding:{weight:250,when:p5,primary:3111,mac:{primary:2599}},menu:{id:D.MenubarHelpMenu,group:"5_tools",order:1}})}async run(i){return i.get(ko).toggleDevTools({targetWindowId:Ki().vscodeWindowId})}},a7t=class extends K{constructor(){super({id:"workbench.action.configureRuntimeArguments",title:L(17073,"Configure Runtime Arguments"),category:Ve.Preferences,f1:!0})}async run(i){let e=i.get(ee),t=i.get(At);await e.openEditor({resource:t.argvResource,options:{pinned:!0}})}},l7t=class extends K{constructor(){super({id:"workbench.action.reloadWindowWithExtensionsDisabled",title:L(17074,"Reload with Extensions Disabled"),category:Ve.Developer,f1:!0})}async run(i){return i.get(ko).reload({disableExtensions:!0})}},c7t=class extends K{constructor(){super({id:"workbench.action.revealUserDataFolder",title:L(17075,"Reveal User Data Folder"),category:Ve.Developer,f1:!0})}async run(i){let e=i.get(ko),t=i.get(zr);return e.showItemInFolder(A.file(t.userDataPath).fsPath)}},d7t=class extends K{constructor(){super({id:"workbench.action.showGPUInfo",title:L(17077,"Show GPU Info"),category:Ve.Developer,f1:!0})}run(i){i.get(ko).openGPUInfoWindow()}},u7t=class extends K{constructor(){super({id:"workbench.action.showContentTracing",title:L(17076,"Show Content Tracing"),category:Ve.Developer,f1:!0})}run(i){i.get(ko).openContentTracingWindow()}},p7t=class a extends K{static{this.ID="workbench.action.stopTracing"}constructor(){super({id:a.ID,title:L(17078,"Stop Tracing"),category:Ve.Developer,f1:!0})}async run(i){let e=i.get(oy),t=i.get(at),o=i.get(ko),n=i.get(Fo);if(!e.args.trace){let{confirmed:r}=await t.confirm({message:d(17081,null),primaryButton:d(17079,null)});if(r)return o.relaunch({addArgs:["--trace"]})}await n.withProgress({location:20,title:d(17082,null),cancellable:!1,detail:d(17080,null)},()=>o.stopTracing())}};var ept=class a extends K{static{this.ID="workbench.action.closeWindow"}constructor(){super({id:a.ID,title:{...L(17092,"Close Window"),mnemonicTitle:d(17096,null)},f1:!0,keybinding:{weight:200,mac:{primary:3125},linux:{primary:574,secondary:[3125]},win:{primary:574,secondary:[3125]}},menu:{id:D.MenubarFileMenu,group:"6_close",order:4}})}async run(i){return i.get(ko).closeWindow({targetWindowId:Ki().vscodeWindowId})}},m7t=class a extends K{static{this.ID="workbench.action.closeOtherWindows"}constructor(){super({id:a.ID,title:L(17091,"Close Other Windows"),f1:!0})}async run(i){let e=i.get(ko),t=Ki().vscodeWindowId,o=await e.getWindows({includeAuxiliaryWindows:!1});for(let n of o)n.id!==t&&e.closeWindow({targetWindowId:n.id})}},tpt=class a extends K{static{this.ZOOM_LEVEL_SETTING_KEY="window.zoomLevel"}static{this.ZOOM_PER_WINDOW_SETTING_KEY="window.zoomPerWindow"}async setZoomLevel(i,e){let t=i.get(B),o;t.getValue(a.ZOOM_PER_WINDOW_SETTING_KEY)!==!1?o=1:o=2;let n;if(typeof e=="number")n=Math.round(e);else if(o===2)n=0;else{let r=t.getValue(a.ZOOM_LEVEL_SETTING_KEY);typeof r=="number"?n=r:n=0}n>But||n<Hut||(o===2&&await t.updateValue(a.ZOOM_LEVEL_SETTING_KEY,n),t$(n,o))}},h7t=class extends tpt{constructor(){super({id:"workbench.action.zoomIn",title:{...L(17106,"Zoom In"),mnemonicTitle:d(17097,null)},category:Ve.View,f1:!0,keybinding:{weight:200,primary:2134,secondary:[3158,2157]},menu:{id:D.MenubarAppearanceMenu,group:"5_zoom",order:1}})}run(i){return super.setZoomLevel(i,mC(Ki())+1)}},g7t=class extends tpt{constructor(){super({id:"workbench.action.zoomOut",title:{...L(17107,"Zoom Out"),mnemonicTitle:d(17098,null)},category:Ve.View,f1:!0,keybinding:{weight:200,primary:2136,secondary:[3160,2159],linux:{primary:2136,secondary:[2159]}},menu:{id:D.MenubarAppearanceMenu,group:"5_zoom",order:2}})}run(i){return super.setZoomLevel(i,mC(Ki())-1)}},f7t=class extends tpt{constructor(){super({id:"workbench.action.zoomReset",title:{...L(17108,"Reset Zoom"),mnemonicTitle:d(17099,null)},category:Ve.View,f1:!0,keybinding:{weight:200,primary:2146},menu:{id:D.MenubarAppearanceMenu,group:"5_zoom",order:3}})}run(i){return super.setZoomLevel(i,!0)}},v7t=class extends K{constructor(){super(...arguments);this.closeWindowAction={iconClass:q.asClassName(R.removeClose),tooltip:d(17089,null)};this.closeDirtyWindowAction={iconClass:"dirty-window "+q.asClassName(R.closeDirty),tooltip:d(17089,null),alwaysVisible:!0};this.closeActiveWindowAction={iconClass:"active-window "+q.asClassName(R.windowActive),tooltip:d(17090,null),alwaysVisible:!0}}async run(e){let t=e.get(Ue),o=e.get(_e),n=e.get(Tt),r=e.get(_t),s=e.get(ko),l=Ki().vscodeWindowId,c=await s.getWindows({includeAuxiliaryWindows:!0}),u=new Set,p=new Map;for(let v of c)if($6i(v)){let b=p.get(v.parentId);b||(b=new Set,p.set(v.parentId,b)),b.add(v)}else u.add(v);function h(v){return typeof v?.windowId=="number"}let g=[];for(let v of u){let b=p.get(v.id);p.size>0&&g.push({type:"separator",label:b?d(17105,null):void 0});let S=v.filename?A.file(v.filename):Zh(v.workspace)?v.workspace.uri:ny(v.workspace)?v.workspace.configPath:void 0,y=v.filename?0:Zh(v.workspace)?1:ny(v.workspace)?2:0,w={windowId:v.id,label:v.title,ariaLabel:v.dirty?d(17104,null,v.title):v.title,iconClasses:aa(n,r,S,y),description:l===v.id?d(17093,null):void 0,buttons:v.dirty?[this.closeDirtyWindowAction]:l===v.id?[this.closeActiveWindowAction]:[this.closeWindowAction]};if(g.push(w),b)for(let k of b){let T={windowId:k.id,label:k.title,iconClasses:aa(n,r,k.filename?A.file(k.filename):void 0,0),description:l===k.id?d(17093,null):void 0,buttons:l===k.id?[this.closeActiveWindowAction]:[this.closeWindowAction]};g.push(T)}}let f=await t.pick(g,{contextKey:"inWindowsPicker",activeItem:(()=>{for(let v=0;v<g.length;v++){let b=g[v];if(h(b)&&b.windowId===l){let S=g[v+1];if(h(S)||(S=g[v+2],h(S)))return S}}})(),placeHolder:d(17102,null),quickNavigate:this.isQuickNavigate()?{keybindings:o.lookupKeybindings(this.desc.id)}:void 0,hideInput:this.isQuickNavigate(),onDidTriggerItemButton:async v=>{await s.closeWindow({targetWindowId:v.item.windowId}),v.removeItem()}});f&&s.focusWindow({targetWindowId:f.windowId})}},b7t=class extends v7t{constructor(){super({id:"workbench.action.switchWindow",title:L(17101,"Switch Window..."),f1:!0,keybinding:{weight:200,primary:0,mac:{primary:309}}})}isQuickNavigate(){return!1}},S7t=class extends v7t{constructor(){super({id:"workbench.action.quickSwitchWindow",title:L(17100,"Quick Switch Window..."),f1:!1})}isQuickNavigate(){return!0}};function G2e(a){return Ze?a.get(B).getValue("window.nativeTabs")===!0:!1}var HPo=function(a){if(G2e(a))return a.get(ko).newWindowTab()},UPo=function(a){if(G2e(a))return a.get(ko).showPreviousWindowTab()},zPo=function(a){if(G2e(a))return a.get(ko).showNextWindowTab()},KPo=function(a){if(G2e(a))return a.get(ko).moveWindowTabToNewWindow()},GPo=function(a){if(G2e(a))return a.get(ko).mergeAllWindowTabs()},qPo=function(a){if(G2e(a))return a.get(ko).toggleWindowTabsBar()},I7t=class a extends K{static{this.ID="workbench.action.toggleWindowAlwaysOnTop"}constructor(){super({id:a.ID,title:L(17103,"Toggle Window Always on Top"),f1:!0,precondition:Rw})}async run(i){let e=i.get(ko),t=Ki();if(zy(t.window))return e.toggleWindowAlwaysOnTop({targetWindowId:Ki().vscodeWindowId})}},y7t=class a extends K{static{this.ID="workbench.action.enableWindowAlwaysOnTop"}constructor(){super({id:a.ID,title:d(17095,null),icon:R.pin,menu:{id:D.LayoutControlMenu,when:C.and(E6e.toNegated(),Cb),order:1}})}async run(i){let e=i.get(ko),t=Ki();if(zy(t.window))return e.setWindowAlwaysOnTop(!0,{targetWindowId:t.vscodeWindowId})}},w7t=class a extends K{static{this.ID="workbench.action.disableWindowAlwaysOnTop"}constructor(){super({id:a.ID,title:d(17094,null),icon:R.pinned,menu:{id:D.LayoutControlMenu,when:C.and(E6e,Cb),order:1}})}async run(i){let e=i.get(ko),t=Ki();if(zy(t.window))return e.setWindowAlwaysOnTop(!1,{targetWindowId:t.vscodeWindowId})}};var $Po=L(17085,"Shell Command"),C7t=class extends K{constructor(){super({id:"workbench.action.installCommandLine",title:L(17084,"Install '{0}' command in PATH",ro.applicationName),category:$Po,f1:!0})}async run(i){let e=i.get(ko),t=i.get(at),o=i.get(tt);try{await e.installShellCommand(),t.info(d(17087,null,o.applicationName))}catch(n){if(ao(n))return;t.error(xn(n))}}},x7t=class extends K{constructor(){super({id:"workbench.action.uninstallCommandLine",title:L(17088,"Uninstall '{0}' command from PATH",ro.applicationName),category:$Po,f1:!0})}async run(i){let e=i.get(ko),t=i.get(at),o=i.get(tt);try{await e.uninstallShellCommand(),t.info(d(17086,null,o.applicationName))}catch(n){if(ao(n))return;t.error(xn(n))}}};(function(){if(W(h7t),W(g7t),W(f7t),W(b7t),W(S7t),W(ept),W(m7t),W(I7t),W(y7t),W(w7t),Ze&&Ct.registerKeybindingRule({id:ept.ID,weight:200,when:C.and(KDt.toNegated(),yeo),primary:2101}),Ze&&(W(C7t),W(x7t)),Ct.registerCommandAndKeybindingRule({id:"workbench.action.quit",weight:200,async handler(i){let e=i.get(ko),o=i.get(B).getValue("window.confirmBeforeClose");(o==="always"||o==="keyboardOnly"&&nb.getInstance().isModifierPressed)&&!await o$.confirmOnShutdown(i,2)||e.quit()},when:void 0,mac:{primary:2095},linux:{primary:2095}}),Ze)for(let i of[{handler:HPo,id:"workbench.action.newWindowTab",title:L(17135,"New Window Tab")},{handler:UPo,id:"workbench.action.showPreviousWindowTab",title:L(17143,"Show Previous Window Tab")},{handler:zPo,id:"workbench.action.showNextWindowTab",title:L(17142,"Show Next Window Tab")},{handler:KPo,id:"workbench.action.moveWindowTabToNewWindow",title:L(17134,"Move Window Tab to New Window")},{handler:GPo,id:"workbench.action.mergeAllWindowTabs",title:L(17132,"Merge All Windows")},{handler:qPo,id:"workbench.action.toggleWindowTabsBar",title:L(17147,"Toggle Window Tabs Bar")}])$e.registerCommand(i.id,i.handler),ve.appendMenuItem(D.CommandPalette,{command:i,when:C.equals("config.window.nativeTabs",!0)});W(l7t),W(a7t),W(s7t),W(c7t),W(d7t),W(u7t),W(p7t)})();(function(){ve.appendMenuItem(D.MenubarFileMenu,{group:"z_Exit",command:{id:"workbench.action.quit",title:d(17133,null)},order:1,when:oxt.toNegated()})})();(function(){let i=ne.as(Jt.Configuration);i.registerConfiguration({...FRt,properties:{"application.shellEnvironmentResolutionTimeout":{type:"number",default:10,minimum:1,maximum:120,included:!ei,scope:1,markdownDescription:d(17109,null)}}}),i.registerConfiguration({id:"window",order:8,title:d(17184,null),type:"object",properties:{"window.confirmSaveUntitledWorkspace":{type:"boolean",default:!0,description:d(17127,null)},"window.openWithoutArgumentsInNewWindow":{type:"string",enum:["on","off"],enumDescriptions:[d(17178,null),d(17177,null)],default:Ze?"off":"on",scope:1,markdownDescription:d(17137,null)},"window.restoreWindows":{type:"string",enum:["preserve","all","folders","one","none"],enumDescriptions:[d(17183,null),d(17179,null),d(17180,null),d(17182,null),d(17181,null)],default:"all",scope:1,description:d(17139,null)},"window.restoreFullscreen":{type:"boolean",default:!1,scope:1,description:d(17138,null)},"window.zoomLevel":{type:"number",default:0,minimum:Hut,maximum:But,markdownDescription:d(17185,null,"`#window.zoomPerWindow#`"),ignoreSync:!0,tags:["accessibility"]},"window.zoomPerWindow":{type:"boolean",default:!0,markdownDescription:d(17186,null,"`#window.zoomLevel#`"),tags:["accessibility"]},"window.newWindowDimensions":{type:"string",enum:["default","inherit","offset","maximized","fullscreen"],enumDescriptions:[d(17172,null),d(17174,null),d(17176,null),d(17175,null),d(17173,null)],default:"default",scope:1,description:d(17136,null)},"window.closeWhenEmpty":{type:"boolean",default:!1,description:d(17126,null)},"window.doubleClickIconToClose":{type:"boolean",default:!1,scope:1,markdownDescription:d(17161,null,"`#window.titleBarStyle#`")},"window.titleBarStyle":{type:"string",enum:["native","custom"],default:"custom",scope:1,description:d(17146,null)},"window.controlsStyle":{type:"string",enum:["native","custom","hidden"],default:"native",included:!Ze,scope:1,description:d(17128,null)},"window.customTitleBarVisibility":{type:"string",enum:["auto","windowed","never"],markdownEnumDescriptions:[d(17158,null),d(17160,null),d(17159,null,"`#window.titleBarStyle#`")],default:"auto",scope:1,markdownDescription:d(17157,null,"`#window.titleBarStyle#`")},"window.menuStyle":{type:"string",enum:["custom","native","inherit"],markdownEnumDescriptions:Ze?[d(17164,null),d(17169,null),d(17166,null,"`#window.titleBarStyle#`")]:[d(17163,null),d(17168,null,"`#window.titleBarStyle#`","`custom`"),d(17165,null,"`#window.titleBarStyle#`")],default:ro.quality!=="stable"?"inherit":Ze?"native":"inherit",scope:1,markdownDescription:Ze?d(17167,null,"`#window.titleBarStyle#`"):d(17162,null,"`#window.titleBarStyle#`")},"window.dialogStyle":{type:"string",enum:["native","custom"],default:"native",scope:1,description:d(17129,null)},"window.nativeTabs":{type:"boolean",default:!1,scope:1,description:d(17171,null),included:Ze},"window.nativeFullScreen":{type:"boolean",default:!0,description:d(17170,null),scope:1,included:Ze},"window.clickThroughInactive":{type:"boolean",default:!0,scope:1,description:d(17156,null),included:Ze},"window.border":{type:"string",default:"default",markdownDescription:(()=>{let e=d(17153,null);return e+=`
- `+[d(17151,null,"`default`"),d(17155,null,"`system`"),d(17152,null,"`off`"),d(17150,null,"`<color>`")].join(`
- `),e+=`

`+d(17154,null,"`#workbench.colorCustomizations#`","`#window.titleBarStyle#`","`native`"),e})(),included:ei}}}),i.registerConfiguration({id:"telemetry",order:110,title:d(17145,null),type:"object",properties:{"telemetry.enableCrashReporter":{type:"boolean",description:d(17144,null),default:!0,tags:["usesOnlineServices","telemetry"],markdownDeprecationMessage:d(17130,null,`\`#${uO}#\``)}}}),i.registerConfiguration({id:"keyboard",order:15,type:"object",title:d(17131,null),properties:{"keyboard.touchbar.enabled":{type:"boolean",default:!0,description:d(17148,null),included:Ze},"keyboard.touchbar.ignored":{type:"array",items:{type:"string"},default:[],markdownDescription:d(17149,null),included:Ze}}}),i.registerConfiguration({...G9e,properties:{"security.promptForLocalFileProtocolHandling":{type:"boolean",default:!0,markdownDescription:d(17140,null),scope:1},"security.promptForRemoteFileProtocolHandling":{type:"boolean",default:!0,markdownDescription:d(17141,null),scope:1}}})})();(function(){let i="vscode://schemas/argv",e=ne.as(ma.JSONContribution),t={id:i,allowComments:!0,allowTrailingCommas:!0,description:"VSCode static command line definition file",type:"object",additionalProperties:!1,properties:{locale:{type:"string",description:d(17120,null)},"disable-lcd-text":{type:"boolean",description:d(17113,null)},"proxy-bypass-list":{type:"string",description:d(17123,null)},"disable-hardware-acceleration":{type:"boolean",description:d(17112,null)},"force-color-profile":{type:"string",markdownDescription:d(17118,null)},"enable-crash-reporter":{type:"boolean",markdownDescription:d(17114,null)},"crash-reporter-id":{type:"string",markdownDescription:d(17110,null)},"enable-proposed-api":{type:"array",description:d(17116,null),items:{type:"string"}},"log-level":{type:["string","array"],description:d(17121,null)},"disable-chromium-sandbox":{type:"boolean",description:d(17111,null)},"use-inmemory-secretstorage":{type:"boolean",description:d(17125,null)},"remote-debugging-port":{type:"string",description:d(17124,null)},"js-flags":{type:"string",description:d(17119,null)}}};fn&&(t.properties["force-renderer-accessibility"]={type:"boolean",description:d(17117,null)},t.properties["password-store"]={type:"string",description:d(17122,null)}),ei&&(t.properties["enable-rdp-display-tracking"]={type:"boolean",description:d(17115,null)}),e.registerSchema(i,t)})();var sse=class extends lwe{constructor(e,t,o,n,r,s,l,c){super();this.logService=e;this.layoutService=t;this.keybindingService=o;this.clipboardService=r;this.openerService=s;this.markdownRendererService=l;this.hostService=c}static{this.ALLOWABLE_COMMANDS=new Set(["copy","cut","editor.action.selectAll","editor.action.clipboardCopyAction","editor.action.clipboardCutAction","editor.action.clipboardPasteAction"])}async prompt(e){this.logService.trace("DialogService#prompt",e.message);let t=this.getPromptButtons(e),{button:o,checkboxChecked:n}=await this.doShow(e.type,e.message,t,e.detail,e.cancelButton?t.length-1:-1,e.checkbox,void 0,typeof e?.custom=="object"?e.custom:void 0,e.token);return this.getPromptResult(e,o,n)}async confirm(e){this.logService.trace("DialogService#confirm",e.message);let t=this.getConfirmationButtons(e),{button:o,checkboxChecked:n}=await this.doShow(e.type??"question",e.message,t,e.detail,t.length-1,e.checkbox,void 0,typeof e?.custom=="object"?e.custom:void 0,e.token);return{confirmed:o===0,checkboxChecked:n}}async input(e){this.logService.trace("DialogService#input",e.message);let t=this.getInputButtons(e),{button:o,checkboxChecked:n,values:r}=await this.doShow(e.type??"question",e.message,t,e.detail,t.length-1,e?.checkbox,e.inputs,typeof e.custom=="object"?e.custom:void 0,e.token);return{confirmed:o===0,checkboxChecked:n,values:r}}async about(e,t,o){let{button:n}=await this.doShow(bt.Info,e,[d(3858,null),d(3859,null)],t,1);n===0&&this.clipboardService.writeText(o)}async doShow(e,t,o,n,r,s,l,c,u){let p=new N,h=c?v=>{v.classList.add(...c.classes||[]),c.markdownDetails?.forEach(b=>{let S=p.add(this.markdownRendererService.render(b.markdown,{actionHandler:b.actionHandler||((y,w)=>U_(this.openerService,y,w.isTrusted,!0))}));v.appendChild(S.element),S.element.classList.add(...b.classes||[])})}:void 0,g=new hee(this.layoutService.activeContainer,t,o,DRe({detail:n,cancelId:r,type:this.getDialogType(e),renderBody:h,icon:c?.icon,disableCloseAction:c?.disableCloseAction,buttonOptions:c?.buttonDetails?.map(v=>({sublabel:v})),checkboxLabel:s?.label,checkboxChecked:s?.checked,inputs:l},this.keybindingService,this.layoutService,this.hostService,sse.ALLOWABLE_COMMANDS));p.add(g),u&&p.add(u.onCancellationRequested(()=>p.dispose()));let f=await g.show();return p.dispose(),f}};sse=I([m(0,se),m(1,Kl),m(2,_e),m(3,F),m(4,Fi),m(5,Je),m(6,On),m(7,Zt)],sse);var q2e=class extends lwe{constructor(e,t,o){super();this.logService=e;this.nativeHostService=t;this.clipboardService=o}async prompt(e){this.logService.trace("DialogService#prompt",e.message);let t=this.getPromptButtons(e),{response:o,checkboxChecked:n}=await this.nativeHostService.showMessageBox({type:this.getDialogType(e.type),title:e.title,message:e.message,detail:e.detail,buttons:t,cancelId:e.cancelButton?t.length-1:-1,checkboxLabel:e.checkbox?.label,checkboxChecked:e.checkbox?.checked,targetWindowId:Ki().vscodeWindowId});return this.getPromptResult(e,o,n)}async confirm(e){this.logService.trace("DialogService#confirm",e.message);let t=this.getConfirmationButtons(e),{response:o,checkboxChecked:n}=await this.nativeHostService.showMessageBox({type:this.getDialogType(e.type)??"question",title:e.title,message:e.message,detail:e.detail,buttons:t,cancelId:t.length-1,checkboxLabel:e.checkbox?.label,checkboxChecked:e.checkbox?.checked,targetWindowId:Ki().vscodeWindowId});return{confirmed:o===0,checkboxChecked:n}}input(){throw new Error("Unsupported")}async about(e,t,o){let{response:n}=await this.nativeHostService.showMessageBox({type:"info",message:e,detail:`
${t}`,buttons:[d(17188,null),d(17189,null)],targetWindowId:Ki().vscodeWindowId});n===0&&this.clipboardService.writeText(o)}};q2e=I([m(0,se),m(1,ko),m(2,Fi)],q2e);function jPo(a,i){let e=a.version;a.target?e=`${e} (${a.target} setup)`:a.darwinUniversalAssetId&&(e=`${e} (Universal)`);let t=r=>d(1939,null,e,a.commit||"Unknown",a.date?`${a.date}${r?" ("+ea(new Date(a.date),!0)+")":""}`:"Unknown",eP.versions.electron,eP.versions["microsoft-build"],eP.versions.chrome,eP.versions.node,eP.versions.v8,`${i.type} ${i.arch} ${i.release}${zSe?" snap":""}`),o=t(!0),n=t(!1);return{title:a.nameLong,details:o,detailsToCopy:n}}var $2e=class extends x{constructor(e,t,o,n,r,s,l,c){super();this.configurationService=e;this.dialogService=t;this.productService=r;this.nativeHostService=l;this.environmentService=c;this.browserImpl=new co(()=>n.createInstance(sse)),this.nativeImpl=new co(()=>new q2e(o,l,s)),this.model=this.dialogService.model,this._register(this.model.onWillShowDialog(()=>{this.currentDialog||this.processDialogs()})),this.processDialogs()}static{this.ID="workbench.contrib.dialogHandler"}async processDialogs(){for(;this.model.dialogs.length;){this.currentDialog=this.model.dialogs[0];let e;try{if(this.currentDialog.args.confirmArgs){let t=this.currentDialog.args.confirmArgs;e=this.useCustomDialog||t?.confirmation.custom?await this.browserImpl.value.confirm(t.confirmation):await this.nativeImpl.value.confirm(t.confirmation)}else if(this.currentDialog.args.inputArgs){let t=this.currentDialog.args.inputArgs;e=await this.browserImpl.value.input(t.input)}else if(this.currentDialog.args.promptArgs){let t=this.currentDialog.args.promptArgs;e=this.useCustomDialog||t?.prompt.custom?await this.browserImpl.value.prompt(t.prompt):await this.nativeImpl.value.prompt(t.prompt)}else{let t=jPo(this.productService,await this.nativeHostService.getOSProperties());this.useCustomDialog?await this.browserImpl.value.about(t.title,t.details,t.detailsToCopy):await this.nativeImpl.value.about(t.title,t.details,t.detailsToCopy)}}catch(t){e=t}this.currentDialog.close(e),this.currentDialog=void 0}}get useCustomDialog(){return this.configurationService.getValue("window.dialogStyle")==="custom"||!!this.environmentService.enableSmokeTestDriver}};$2e=I([m(0,B),m(1,at),m(2,se),m(3,F),m(4,tt),m(5,Fi),m(6,ko),m(7,At)],$2e);It($2e.ID,$2e,St.BlockStartup);var j2e=class extends x{constructor(e,t){super();this.logService=e;this.progressService=t;this.saveParticipants=new qs}addSaveParticipant(e){let t=this.saveParticipants.push(e);return Z(()=>t())}async participate(e,t,o,n){let r=new Ye(n);e.textEditorModel?.pushStackElement(),o.report({message:d(17984,null)});let s=!1;if(await this.progressService.withProgress({priority:3,location:15,cancellable:d(17985,null),delay:e.isDirty()?5e3:3e3},async l=>{let c=Array.from(this.saveParticipants).sort((u,p)=>{let h=u.ordinal??0,g=p.ordinal??0;return h-g});for(let u of c){if(r.token.isCancellationRequested||!e.textEditorModel)break;try{let p=u.participate(e,t,l,r.token);await Va(p,r.token)}catch(p){ao(p)?r.token.isCancellationRequested||(r.cancel(),s=!0):this.logService.error(p)}}},()=>{r.cancel()}),e.textEditorModel?.pushStackElement(),r.dispose(),s)throw new go}dispose(){this.saveParticipants.clear(),super.dispose()}};j2e=I([m(0,se),m(1,Fo)],j2e);var Q2e=class extends x{constructor(e,t,o,n,r){super();this.instantiationService=e;this.fileService=t;this.notificationService=o;this.workingCopyFileService=n;this.uriIdentityService=r;this._onDidCreate=this._register(new E({leakWarningThreshold:500}));this.onDidCreate=this._onDidCreate.event;this._onDidResolve=this._register(new E);this.onDidResolve=this._onDidResolve.event;this._onDidRemove=this._register(new E);this.onDidRemove=this._onDidRemove.event;this._onDidChangeDirty=this._register(new E);this.onDidChangeDirty=this._onDidChangeDirty.event;this._onDidChangeReadonly=this._register(new E);this.onDidChangeReadonly=this._onDidChangeReadonly.event;this._onDidChangeOrphaned=this._register(new E);this.onDidChangeOrphaned=this._onDidChangeOrphaned.event;this._onDidSaveError=this._register(new E);this.onDidSaveError=this._onDidSaveError.event;this._onDidSave=this._register(new E);this.onDidSave=this._onDidSave.event;this._onDidRevert=this._register(new E);this.onDidRevert=this._onDidRevert.event;this._onDidChangeEncoding=this._register(new E);this.onDidChangeEncoding=this._onDidChangeEncoding.event;this.mapResourceToModel=new gt;this.mapResourceToModelListeners=new gt;this.mapResourceToDisposeListener=new gt;this.mapResourceToPendingModelResolvers=new gt;this.modelResolveQueue=this._register(new b1);this.saveErrorHandler=(()=>{let e=this.notificationService;return{onSaveError(t,o){e.error(d(17983,null,o.name,xn(t,!1)))}}})();this.mapCorrelationIdToModelsToRestore=new Map;this.saveParticipants=this._register(this.instantiationService.createInstance(j2e)),this.registerListeners()}get models(){return[...this.mapResourceToModel.values()]}registerListeners(){this._register(this.fileService.onDidFilesChange(e=>this.onDidFilesChange(e))),this._register(this.fileService.onDidChangeFileSystemProviderCapabilities(e=>this.onDidChangeFileSystemProviderCapabilities(e))),this._register(this.fileService.onDidChangeFileSystemProviderRegistrations(e=>this.onDidChangeFileSystemProviderRegistrations(e))),this._register(this.workingCopyFileService.onWillRunWorkingCopyFileOperation(e=>this.onWillRunWorkingCopyFileOperation(e))),this._register(this.workingCopyFileService.onDidFailWorkingCopyFileOperation(e=>this.onDidFailWorkingCopyFileOperation(e))),this._register(this.workingCopyFileService.onDidRunWorkingCopyFileOperation(e=>this.onDidRunWorkingCopyFileOperation(e)))}onDidFilesChange(e){for(let t of this.models)t.isDirty()||e.contains(t.resource,0,1)&&this.queueModelReload(t)}onDidChangeFileSystemProviderCapabilities(e){this.queueModelReloads(e.scheme)}onDidChangeFileSystemProviderRegistrations(e){e.added&&this.queueModelReloads(e.scheme)}queueModelReloads(e){for(let t of this.models)t.isDirty()||e===t.resource.scheme&&this.queueModelReload(t)}queueModelReload(e){this.modelResolveQueue.queueSize(e.resource)<=1&&this.modelResolveQueue.queueFor(e.resource,async()=>{try{await this.reload(e)}catch(o){mt(o)}})}onWillRunWorkingCopyFileOperation(e){if(e.operation===2||e.operation===3){let t=[];for(let{source:o,target:n}of e.files)if(o){if(this.uriIdentityService.extUri.isEqual(o,n))continue;let r=[];for(let s of this.models)this.uriIdentityService.extUri.isEqualOrParent(s.resource,o)&&r.push(s);for(let s of r){let l=s.resource,c;this.uriIdentityService.extUri.isEqual(l,o)?c=n:c=Ge(n,l.path.substr(o.path.length+1));let u=s.getLanguageId();t.push({source:l,target:c,language:u?{id:u,explicit:s.languageChangeSource==="user"}:void 0,encoding:s.getEncoding(),snapshot:s.isDirty()?s.createSnapshot():void 0})}}this.mapCorrelationIdToModelsToRestore.set(e.correlationId,t)}}onDidFailWorkingCopyFileOperation(e){if(e.operation===2||e.operation===3){let t=this.mapCorrelationIdToModelsToRestore.get(e.correlationId);t&&(this.mapCorrelationIdToModelsToRestore.delete(e.correlationId),t.forEach(o=>{o.snapshot&&this.get(o.source)?.setDirty(!0)}))}}onDidRunWorkingCopyFileOperation(e){switch(e.operation){case 0:e.waitUntil((async()=>{for(let{target:t}of e.files){let o=this.get(t);o&&!o.isDisposed()&&await o.revert()}})());break;case 2:case 3:e.waitUntil((async()=>{let t=this.mapCorrelationIdToModelsToRestore.get(e.correlationId);t&&(this.mapCorrelationIdToModelsToRestore.delete(e.correlationId),await dn.settled(t.map(async o=>{let n=this.uriIdentityService.asCanonicalUri(o.target),r=await this.resolve(n,{reload:{async:!1},contents:o.snapshot?Yx(o.snapshot):void 0,encoding:o.encoding});o.language?.id&&o.language.id!==$r&&(o.language.explicit?r.setLanguageId(o.language.id):r.getLanguageId()===$r&&es(n)!==cje&&r.updateTextEditorModel(void 0,o.language.id))})))})());break}}get(e){return this.mapResourceToModel.get(e)}has(e){return this.mapResourceToModel.has(e)}async reload(e){await this.joinPendingResolves(e.resource),!(e.isDirty()||e.isDisposed()||!this.has(e.resource))&&await this.doResolve(e,{reload:{async:!1}})}async resolve(e,t){let o=this.joinPendingResolves(e);return o&&await o,this.doResolve(e,t)}async doResolve(e,t){let o,n;A.isUri(e)?(n=e,o=this.get(n)):(n=e.resource,o=e);let r,s=!1;if(o)t?.contents?r=o.resolve(t):t?.reload?t.reload.async?(r=Promise.resolve(),(async()=>{try{await o.resolve(t)}catch(l){o.isDisposed()||mt(l)}})()):r=o.resolve(t):r=Promise.resolve();else{s=!0;let l=o=this.instantiationService.createInstance(D0,n,t?t.encoding:void 0,t?t.languageId:void 0);r=o.resolve(t),this.registerModel(l)}this.mapResourceToPendingModelResolvers.set(n,r),this.add(n,o),s&&(this._onDidCreate.fire(o),o.isDirty()&&this._onDidChangeDirty.fire(o));try{await r}catch(l){throw s&&o.dispose(),l}finally{this.mapResourceToPendingModelResolvers.delete(n)}return t?.languageId&&o.setLanguageId(t.languageId),s&&o.isDirty()&&this._onDidChangeDirty.fire(o),o}joinPendingResolves(e){if(this.mapResourceToPendingModelResolvers.get(e))return this.doJoinPendingResolves(e)}async doJoinPendingResolves(e){let t;for(;this.mapResourceToPendingModelResolvers.has(e);){let o=this.mapResourceToPendingModelResolvers.get(e);if(o===t)return;t=o;try{await o}catch{}}}registerModel(e){let t=new N;t.add(e.onDidResolve(o=>this._onDidResolve.fire({model:e,reason:o}))),t.add(e.onDidChangeDirty(()=>this._onDidChangeDirty.fire(e))),t.add(e.onDidChangeReadonly(()=>this._onDidChangeReadonly.fire(e))),t.add(e.onDidChangeOrphaned(()=>this._onDidChangeOrphaned.fire(e))),t.add(e.onDidSaveError(()=>this._onDidSaveError.fire(e))),t.add(e.onDidSave(o=>this._onDidSave.fire({model:e,...o}))),t.add(e.onDidRevert(()=>this._onDidRevert.fire(e))),t.add(e.onDidChangeEncoding(()=>this._onDidChangeEncoding.fire(e))),this.mapResourceToModelListeners.set(e.resource,t)}add(e,t){if(this.mapResourceToModel.get(e)===t)return;this.mapResourceToDisposeListener.get(e)?.dispose(),this.mapResourceToModel.set(e,t),this.mapResourceToDisposeListener.set(e,t.onWillDispose(()=>this.remove(e)))}remove(e){let t=this.mapResourceToModel.delete(e),o=this.mapResourceToDisposeListener.get(e);o&&(Be(o),this.mapResourceToDisposeListener.delete(e));let n=this.mapResourceToModelListeners.get(e);n&&(Be(n),this.mapResourceToModelListeners.delete(e)),t&&this._onDidRemove.fire(e)}addSaveParticipant(e){return this.saveParticipants.addSaveParticipant(e)}runSaveParticipants(e,t,o,n){return this.saveParticipants.participate(e,t,o,n)}canDispose(e){return e.isDisposed()||!this.mapResourceToPendingModelResolvers.has(e.resource)&&!e.isDirty()?!0:this.doCanDispose(e)}async doCanDispose(e){let t=this.joinPendingResolves(e.resource);return t?(await t,this.canDispose(e)):e.isDirty()?(await U.toPromise(e.onDidChangeDirty),this.canDispose(e)):!0}dispose(){super.dispose(),this.mapResourceToModel.clear(),this.mapResourceToPendingModelResolvers.clear(),Be(this.mapResourceToDisposeListener.values()),this.mapResourceToDisposeListener.clear(),Be(this.mapResourceToModelListeners.values()),this.mapResourceToModelListeners.clear()}};Q2e=I([m(0,F),m(1,fe),m(2,Ne),m(3,qp),m(4,ht)],Q2e);var r9=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w){super();this.fileService=e;this.lifecycleService=o;this.instantiationService=n;this.modelService=r;this.environmentService=s;this.dialogService=l;this.fileDialogService=c;this.textResourceConfigurationService=u;this.filesConfigurationService=p;this.codeEditorService=h;this.pathService=g;this.workingCopyFileService=f;this.uriIdentityService=v;this.languageService=b;this.logService=S;this.elevatedFileService=y;this.decorationsService=w;this.files=this._register(this.instantiationService.createInstance(Q2e)),this.untitled=t,this.provideDecorations()}static{this.TEXTFILE_SAVE_CREATE_SOURCE=Ih.registerSource("textFileCreate.source",d(17977,null))}static{this.TEXTFILE_SAVE_REPLACE_SOURCE=Ih.registerSource("textFileOverwrite.source",d(17979,null))}provideDecorations(){let e=this._register(new class extends x{constructor(o){super();this.files=o;this.label=d(17978,null);this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this.registerListeners()}registerListeners(){this._register(this.files.onDidResolve(({model:o})=>{(o.isReadonly()||o.hasState(4))&&this._onDidChange.fire([o.resource])})),this._register(this.files.onDidRemove(o=>this._onDidChange.fire([o]))),this._register(this.files.onDidChangeReadonly(o=>this._onDidChange.fire([o.resource]))),this._register(this.files.onDidChangeOrphaned(o=>this._onDidChange.fire([o.resource])))}provideDecorations(o){let n=this.files.get(o);if(!n||n.isDisposed())return;let r=n.isReadonly(),s=n.hasState(4);if(r&&s)return{color:Gx,letter:R.lockSmall,strikethrough:!0,tooltip:d(17975,null)};if(r)return{letter:R.lockSmall,tooltip:d(17974,null)};if(s)return{color:Gx,strikethrough:!0,tooltip:d(17970,null)}}}(this.files));this._register(this.decorationsService.registerDecorationsProvider(e))}get encoding(){return this._encoding||(this._encoding=this._register(this.instantiationService.createInstance(ipt))),this._encoding}async read(e,t){let[o,n]=await this.doRead(e,{...t,preferUnbuffered:!0});return{...o,encoding:n.detected.encoding||kb,value:await K9(n.stream,r=>r.join(""))}}async readStream(e,t){let[o,n]=await this.doRead(e,t);return{...o,encoding:n.detected.encoding||kb,value:await iY(n.stream)}}async doRead(e,t){let o=new Ye,n;if(t?.preferUnbuffered){let r=await this.fileService.readFile(e,t,o.token);n={...r,value:v_(r.value)}}else n=await this.fileService.readFileStream(e,t,o.token);try{let r=await this.doGetDecodedStream(e,n.value,t);return[n,r]}catch(r){throw o.dispose(!0),r.decodeStreamErrorKind===1?new fRt(d(17971,null),0,t):r}}async create(e,t){let o=await Promise.all(e.map(async n=>{let r=await this.getEncodedReadable(n.resource,n.value);return{resource:n.resource,contents:r,overwrite:n.options?.overwrite}}));return this.workingCopyFileService.create(o,Se.None,t)}async write(e,t,o){let n=await this.getEncodedReadable(e,t,o);return o?.writeElevated&&this.elevatedFileService.isSupported(e)?this.elevatedFileService.writeFileElevated(e,n,o):this.fileService.writeFile(e,n,o)}async getEncodedReadable(e,t,o){let{encoding:n,addBOM:r}=await this.encoding.getWriteEncoding(e,o);if(n===kb&&!r)return typeof t>"u"?void 0:zto(t);t=t||"";let s=typeof t=="string"?ITe(t):t;return uio(s,n,{addBOM:r})}async getDecodedStream(e,t,o){return(await this.doGetDecodedStream(e,t,o)).stream}doGetDecodedStream(e,t,o){return dio(t,{acceptTextOnly:o?.acceptTextOnly??!1,guessEncoding:o?.autoGuessEncoding||this.textResourceConfigurationService.getValue(e,"files.autoGuessEncoding"),candidateGuessEncodings:o?.candidateGuessEncodings||this.textResourceConfigurationService.getValue(e,"files.candidateGuessEncodings"),overwriteEncoding:async n=>this.validateDetectedEncoding(e,n??void 0,o)})}getEncoding(e){return(e.scheme===Q.untitled?this.untitled.get(e):this.files.get(e))?.getEncoding()??this.encoding.getUnvalidatedEncodingForResource(e)}async resolveDecoding(e,t){return{preferredEncoding:(await this.encoding.getPreferredReadEncoding(e,t,void 0)).encoding,guessEncoding:t?.autoGuessEncoding||this.textResourceConfigurationService.getValue(e,"files.autoGuessEncoding"),candidateGuessEncodings:t?.candidateGuessEncodings||this.textResourceConfigurationService.getValue(e,"files.candidateGuessEncodings")}}async validateDetectedEncoding(e,t,o){let{encoding:n}=await this.encoding.getPreferredReadEncoding(e,o,t);return n}resolveEncoding(e,t){return this.encoding.getWriteEncoding(e,t)}async save(e,t){if(e.scheme===Q.untitled){let o=this.untitled.get(e);if(o){let n;if(o.hasAssociatedFilePath?n=await this.suggestSavePath(e):n=await this.fileDialogService.pickFileToSave(await this.suggestSavePath(e),t?.availableFileSystems),n)return this.saveAs(e,n,t)}}else{let o=this.files.get(e);if(o)return await o.save(t)?e:void 0}}async saveAs(e,t,o){if(t||(t=await this.fileDialogService.pickFileToSave(await this.suggestSavePath(o?.suggestedTarget??e),o?.availableFileSystems)),!!t){if(this.filesConfigurationService.isReadonly(t))if(await this.confirmMakeWriteable(t))this.filesConfigurationService.updateReadonly(t,!1);else return;return Qe(e,t)?this.save(e,{...o,force:!0}):this.fileService.hasProvider(e)&&this.uriIdentityService.extUri.isEqual(e,t)&&await this.fileService.exists(e)?(await this.workingCopyFileService.move([{file:{source:e,target:t}}],Se.None),await this.save(e,o)||await this.save(t,o),t):this.doSaveAs(e,t,o)}}async doSaveAs(e,t,o){let n=!1,r;if(e.scheme!==Q.untitled){let s=this.files.get(e);s?.isResolved()&&(r=s)}else{let s=this.untitled.get(e);s?.isResolved()&&(r=s)}if(r)n=await this.doSaveAsTextFile(r,e,t,o);else if(this.fileService.hasProvider(e))await this.fileService.copy(e,t,!0),n=!0;else{let s=this.modelService.getModel(e);s&&(n=await this.doSaveAsTextFile(s,e,t,o))}if(n){try{await this.revert(e)}catch(s){this.logService.error(s)}return e.scheme===Q.untitled&&this.untitled.notifyDidSave(e,t),t}}async doSaveAsTextFile(e,t,o,n){let r,s=e;typeof s.getEncoding=="function"&&(r=s.getEncoding());let l=!1,c=this.files.get(o);if(c?.isResolved())l=!0;else{l=await this.fileService.exists(o),l||await this.create([{resource:o,value:""}]);try{c=await this.files.resolve(o,{encoding:r})}catch(g){if(l&&(g.textFileOperationResult===0||g.fileOperationResult===7))return await this.fileService.del(o),this.doSaveAsTextFile(e,t,o,n);throw g}}let u;if(e instanceof gD&&e.hasAssociatedFilePath&&l&&this.uriIdentityService.extUri.isEqual(o,of(e.resource,this.environmentService.remoteAuthority,this.pathService.defaultUriScheme))?u=await this.confirmOverwrite(o):u=!0,!u)return!1;let p;e instanceof Lw?e.isResolved()&&(p=e.textEditorModel??void 0):p=e;let h;if(c.isResolved()&&(h=c.textEditorModel),p&&h){c.updatePreferredEncoding(r),this.modelService.updateModel(h,Yx(p.createSnapshot()));let g=p.getLanguageId(),f=h.getLanguageId();g!==$r&&f===$r&&h.setLanguage(g);let v=p.getOptions();h.updateOptions({tabSize:v.tabSize,indentSize:v.indentSize,insertSpaces:v.insertSpaces});let b=p.getEndOfLineSequence();h.setEOL(b);let S=this.codeEditorService.getTransientModelProperties(p);if(S)for(let[y,w]of S)this.codeEditorService.setTransientModelProperty(h,y,w)}return n?.source||(n={...n,source:l?r9.TEXTFILE_SAVE_REPLACE_SOURCE:r9.TEXTFILE_SAVE_CREATE_SOURCE}),c.save({...n,from:t})}async confirmOverwrite(e){let{confirmed:t}=await this.dialogService.confirm({type:"warning",message:d(17969,null,He(e)),detail:d(17973,null,He(e),He(ci(e))),primaryButton:d(17976,null)});return t}async confirmMakeWriteable(e){let{confirmed:t}=await this.dialogService.confirm({type:"warning",message:d(17967,null,He(e)),detail:d(17968,null),primaryButton:d(17972,null)});return t}async suggestSavePath(e){if(this.fileService.hasProvider(e))return e;let t=this.environmentService.remoteAuthority,o=await this.fileDialogService.defaultFilePath(),n;if(e.scheme===Q.untitled){let r=this.untitled.get(e);if(r){if(r.hasAssociatedFilePath)return of(e,t,this.pathService.defaultUriScheme);let s;await this.pathService.hasValidBasename(Ge(o,r.name),r.name)?s=r.name:s=He(e);let l=r.getLanguageId();l&&l!==$r?n=this.suggestFilename(l,s):n=s}}return n||(n=He(e)),Ge(o,n)}suggestFilename(e,t){if(!this.languageService.getLanguageName(e))return t;let n=qm(t),r=this.languageService.getExtensions(e);if(r.includes(n))return t;let s=r.at(0);if(s)return n?`${t.substring(0,t.indexOf(n))}${s}`:`${t}${s}`;let l=this.languageService.getFilenames(e);return l.includes(t)?t:l.at(0)??t}async revert(e,t){if(e.scheme===Q.untitled){let o=this.untitled.get(e);if(o)return o.revert(t)}else{let o=this.files.get(e);if(o&&(o.isDirty()||t?.force))return o.revert(t)}}isDirty(e){let t=e.scheme===Q.untitled?this.untitled.get(e):this.files.get(e);return t?t.isDirty():!1}};r9=I([m(0,fe),m(1,fD),m(2,ji),m(3,F),m(4,Tt),m(5,At),m(6,at),m(7,rn),m(8,Fn),m(9,gr),m(10,qt),m(11,An),m(12,qp),m(13,ht),m(14,_t),m(15,se),m(16,l0),m(17,Ov)],r9);var ipt=class extends x{constructor(e,t,o,n){super();this.textResourceConfigurationService=e;this.environmentService=t;this.contextService=o;this.uriIdentityService=n;this._encodingOverrides=this.getDefaultEncodingOverrides(),this.registerListeners()}get encodingOverrides(){return this._encodingOverrides}set encodingOverrides(e){this._encodingOverrides=e}registerListeners(){this._register(this.contextService.onDidChangeWorkspaceFolders(()=>this.encodingOverrides=this.getDefaultEncodingOverrides()))}getDefaultEncodingOverrides(){let e=[];return e.push({parent:this.environmentService.userRoamingDataHome,encoding:kb}),e.push({extension:FE,encoding:kb}),e.push({parent:this.environmentService.untitledWorkspacesHome,encoding:kb}),this.contextService.getWorkspace().folders.forEach(t=>{e.push({parent:Ge(t.uri,".vscode"),encoding:kb})}),e}async getWriteEncoding(e,t){let{encoding:o,hasBOM:n}=await this.getPreferredWriteEncoding(e,t?t.encoding:void 0);return{encoding:o,addBOM:n}}async getPreferredWriteEncoding(e,t){let o=await this.getValidatedEncodingForResource(e,t);return{encoding:o,hasBOM:o===E4||o===T4||o===PB}}async getPreferredReadEncoding(e,t,o){let n;t?.encoding?o===PB&&t.encoding===kb?n=PB:n=t.encoding:typeof o=="string"?n=o:this.textResourceConfigurationService.getValue(e,"files.encoding")===PB&&(n=kb);let r=await this.getValidatedEncodingForResource(e,n);return{encoding:r,hasBOM:r===E4||r===T4||r===PB}}getUnvalidatedEncodingForResource(e,t){let o,n=this.getEncodingOverride(e);return n?o=n:t?o=t:o=this.textResourceConfigurationService.getValue(e,"files.encoding"),o||kb}async getValidatedEncodingForResource(e,t){let o=this.getUnvalidatedEncodingForResource(e,t);return o!==kb&&!await pio(o)&&(o=kb),o}getEncodingOverride(e){if(e&&this.encodingOverrides?.length){for(let t of this.encodingOverrides)if(t.parent&&this.uriIdentityService.extUri.isEqualOrParent(e,t.parent)||t.extension&&es(e)===`.${t.extension}`)return t.encoding}}};ipt=I([m(0,Fn),m(1,At),m(2,Pe),m(3,ht)],ipt);var opt=class extends r9{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v,S,b,y),this.environmentService=r,this.registerListeners()}registerListeners(){this._register(this.lifecycleService.onWillShutdown(i=>i.join(this.onWillShutdown(),{id:"join.textFiles",label:d(17986,null)})))}async onWillShutdown(){let i;for(;(i=this.files.models.filter(e=>e.hasState(2))).length>0;)await dn.settled(i.map(e=>e.joinState(2)))}async read(i,e){return e=this.ensureLimits(e),super.read(i,e)}async readStream(i,e){return e=this.ensureLimits(e),super.readStream(i,e)}ensureLimits(i){let e;i?e=i:e=Object.create(null);let t;return e.limits?t=e.limits:(t=Object.create(null),e={...e,limits:t}),e}};opt=I([m(0,fe),m(1,fD),m(2,ji),m(3,F),m(4,Tt),m(5,zr),m(6,at),m(7,rn),m(8,Fn),m(9,gr),m(10,qt),m(11,An),m(12,qp),m(13,ht),m(14,_t),m(15,l0),m(16,se),m(17,Ov)],opt);Ee(Uo,opt,0);var X2e;(t=>{t.ID="workbench.action.files.openLocalFile",t.LABEL=d(17516,null);function e(){return o=>o.get(rn).pickFileAndOpen({forceNewWindow:!1,availableFileSystems:[Q.file]})}t.handler=e})(X2e||={});var J2e;(t=>{t.ID="workbench.action.files.saveLocalFile",t.LABEL=d(17536,null);function e(){return o=>{let n=o.get(ee),r=n.activeEditorPane;return r?n.save({groupId:r.group.id,editor:r.input},{saveAs:!0,availableFileSystems:[Q.file],reason:1}):Promise.resolve(void 0)}}t.handler=e})(J2e||={});var Z2e;(t=>{t.ID="workbench.action.files.openLocalFolder",t.LABEL=d(17518,null);function e(){return o=>o.get(rn).pickFolderAndOpen({forceNewWindow:!1,availableFileSystems:[Q.file]})}t.handler=e})(Z2e||={});var eGe;(t=>{t.ID="workbench.action.files.openLocalFileFolder",t.LABEL=d(17517,null);function e(){return o=>o.get(rn).pickFileFolderAndOpen({forceNewWindow:!1,availableFileSystems:[Q.file]})}t.handler=e})(eGe||={});var tGe=new Y("remoteFileDialogVisible",!1),Y2e=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super();this.fileService=e;this.quickInputService=t;this.labelService=o;this.workspaceContextService=n;this.notificationService=r;this.fileDialogService=s;this.modelService=l;this.languageService=c;this.environmentService=u;this.remoteAgentService=p;this.pathService=h;this.keybindingService=g;this.accessibilityService=v;this.storageService=b;this.hidden=!1;this.allowFileSelection=!0;this.allowFolderSelection=!1;this.requiresTrailing=!1;this.userEnteredPathSegment="";this.autoCompletePathSegment="";this.isWindows=!1;this.separator="/";this.scopedPathPrefix="";this.onBusyChangeEmitter=this._register(new E);this._showDotFiles=!0;this.remoteAuthority=this.environmentService.remoteAuthority,this.contextKey=tGe.bindTo(f),this.scheme=this.pathService.defaultUriScheme,this.getShowDotFiles();let S=this._register(new N);S.add(this.storageService.onDidChangeValue(1,"remoteFileDialog.showDotFiles",S)(async y=>{this.getShowDotFiles(),this.setButtons();let w=this.filePickBox.value,k=this.pathFromUri(this.currentFolder,!0);this.filePickBox.value=k,await this.tryUpdateItems(k,this.currentFolder,!0),this.filePickBox.value=w}))}setShowDotFiles(e){this.storageService.store("remoteFileDialog.showDotFiles",e,1,0)}getShowDotFiles(){this._showDotFiles=this.storageService.getBoolean("remoteFileDialog.showDotFiles",1,!0)}set busy(e){this.filePickBox.busy!==e&&(this.filePickBox.busy=e,this.onBusyChangeEmitter.fire(e))}get busy(){return this.filePickBox.busy}async showOpenDialog(e={}){this.scheme=this.getScheme(e.availableFileSystems,e.defaultUri),this.scopedAuthority=this.getScopedAuthority(e.defaultUri),this.scopedPathPrefix=e.defaultUri&&this.scopedAuthority?this.computeScopedPathPrefix(e.defaultUri):"",this.userHome=await this.getUserHome(),this.trueHome=await this.getUserHome(!0);let t=this.getOptions(e);if(!t)return Promise.resolve(void 0);this.options=t;let o=await this.pickResource();return Array.isArray(o)?o:o?[o]:void 0}async showSaveDialog(e){this.scheme=this.getScheme(e.availableFileSystems,e.defaultUri),this.scopedAuthority=this.getScopedAuthority(e.defaultUri),this.scopedPathPrefix=e.defaultUri&&this.scopedAuthority?this.computeScopedPathPrefix(e.defaultUri):"",this.userHome=await this.getUserHome(),this.trueHome=await this.getUserHome(!0),this.requiresTrailing=!0;let t=this.getOptions(e,!0);return t?(this.options=t,this.options.canSelectFolders=!0,this.options.canSelectFiles=!0,new Promise(o=>{this.pickResource(!0).then(n=>{o(Array.isArray(n)?n[0]:n)})})):Promise.resolve(void 0)}getOptions(e,t=!1){let o,n;if(e.defaultUri&&(o=this.scheme===e.defaultUri.scheme?e.defaultUri:void 0,n=t?He(e.defaultUri):void 0),o||(o=this.userHome,n&&(o=Ge(o,n))),this.scheme!==Q.file&&!this.fileService.hasProvider(o)){this.notificationService.info(d(17524,null,o.toString()));return}let r=Ji(e);return r.defaultUri=o,r}remoteUriFrom(e,t){if(e.startsWith("\\\\")||(e=e.replace(/\\/g,"/")),this.scopedAuthority)return A.from({scheme:this.scheme,authority:this.scopedAuthority,path:this.scopedPathPrefix+e,query:t?.query,fragment:t?.fragment});let o=this.scheme===Q.file?A.file(e):A.from({scheme:this.scheme,path:e,query:t?.query,fragment:t?.fragment}),n=o.scheme===Q.file?void 0:this.remoteAuthority??t?.authority;return of(o,n,n?this.pathService.defaultUriScheme:o.scheme)}getScheme(e,t){return e&&e.length>0?t&&e.indexOf(t.scheme)>=0?t.scheme:e[0]:t?t.scheme:Q.file}getScopedAuthority(e){if(e&&e.scheme===this.scheme&&e.authority&&e.authority!==this.remoteAuthority)return e.authority}computeScopedPathPrefix(e){let t=e.path,o=this.labelService.getUriLabel(e);return o&&t.endsWith(o)?t.substring(0,t.length-o.length):""}async getRemoteAgentEnvironment(){return this.remoteAgentEnvironment===void 0&&(this.remoteAgentEnvironment=await this.remoteAgentService.getEnvironment()),this.remoteAgentEnvironment}getUserHome(e=!1){return this.scopedAuthority?Promise.resolve(A.from({scheme:this.scheme,authority:this.scopedAuthority,path:this.scopedPathPrefix+"/"})):e?this.pathService.userHome({preferLocal:this.scheme===Q.file}):this.fileDialogService.preferredHome(this.scheme)}normalizeUri(e){return e=W$(e,this.separator),e=iae(e),e}async pickResource(e=!1){this.allowFolderSelection=!!this.options.canSelectFolders,this.allowFileSelection=!!this.options.canSelectFiles,this.separator=this.scopedAuthority?"/":this.labelService.getSeparator(this.scheme,this.remoteAuthority),this.hidden=!1,this.isWindows=this.scopedAuthority?!1:await this.checkIsWindowsOS();let t=this.options.defaultUri?this.options.defaultUri:this.workspaceContextService.getWorkspace().folders[0].uri,o,n=es(t);if(this.options.defaultUri){try{o=await this.fileService.stat(this.options.defaultUri)}catch{}(!o||!o.isDirectory)&&(t=ci(this.options.defaultUri),this.trailing=He(this.options.defaultUri))}return new Promise(r=>{if(this.filePickBox=this._register(this.quickInputService.createQuickPick()),this.busy=!0,this.filePickBox.matchOnLabel=!1,this.filePickBox.sortByLabel=!1,this.filePickBox.ignoreFocusOut=!0,this.filePickBox.placeholder=d(17525,null),this.filePickBox.ok=!0,this.filePickBox.okLabel=typeof this.options.openLabel=="string"?this.options.openLabel:this.options.openLabel?.withoutMnemonic,this.scheme!==Q.file&&this.options&&this.options.availableFileSystems&&this.options.availableFileSystems.length>1&&this.options.availableFileSystems.indexOf(Q.file)>-1){this.filePickBox.customButton=!0,this.filePickBox.customLabel=d(17523,null),this.filePickBox.customButtonSecondary=!0;let h;e?h=J2e:h=this.allowFileSelection?this.allowFolderSelection?eGe:X2e:Z2e;let g=this.keybindingService.lookupKeybinding(h.ID);if(g){let f=g.getLabel();f&&(this.filePickBox.customHover=vd("{0} ({1})",h.LABEL,f))}}this.setButtons(),this._register(this.filePickBox.onDidTriggerButton(h=>{this.setShowDotFiles(!this._showDotFiles)}));let s=0,l=!1;this.currentFolder=ci(t),this.userEnteredPathSegment="",this.autoCompletePathSegment="",this.filePickBox.title=this.options.title,this.filePickBox.value=this.pathFromUri(this.currentFolder,!0),this.filePickBox.valueSelection=[this.filePickBox.value.length,this.filePickBox.value.length];let c=h=>{h&&(Array.isArray(h)?h=h.map(g=>this.normalizeUri(g)):h=this.normalizeUri(h)),r(h),this.contextKey.set(!1),this.dispose()};this._register(this.filePickBox.onDidCustom(()=>{if(!(l||this.busy))return l=!0,s++,this.options.availableFileSystems&&this.options.availableFileSystems.length>1&&(this.options.availableFileSystems=this.options.availableFileSystems.slice(1)),this.filePickBox.hide(),e?this.fileDialogService.showSaveDialog(this.options).then(h=>{c(h)}):this.fileDialogService.showOpenDialog(this.options).then(h=>{c(h)})}));let u=this._register(new me),p=()=>{if(this.busy){u.value=this.onBusyChangeEmitter.event(h=>{h||p()});return}else if(l)return;l=!0,s++,this.onDidAccept().then(h=>{h?(this.filePickBox.hide(),c(h)):this.hidden?c(void 0):(s--,l=!1)})};this._register(this.filePickBox.onDidAccept(h=>{p()})),this._register(this.filePickBox.onDidChangeActive(h=>{if(l=!1,h.length===1&&this.isSelectionChangeFromUser()){this.filePickBox.validationMessage=void 0;let g=this.constructFullUserPath();vr(this.filePickBox.value.substring(0,g.length),g)||(this.filePickBox.valueSelection=[0,this.filePickBox.value.length],this.insertText(g,g)),this.setAutoComplete(g,this.userEnteredPathSegment,h[0],!0)}})),this._register(this.filePickBox.onDidChangeValue(async h=>this.handleValueChange(h))),this._register(this.filePickBox.onDidHide(()=>{this.hidden=!0,s===0&&c(void 0)})),this.filePickBox.show(),this.contextKey.set(!0),this.updateItems(t,!0,this.trailing).then(()=>{this.trailing?this.filePickBox.valueSelection=[this.filePickBox.value.length-this.trailing.length,this.filePickBox.value.length-n.length]:this.filePickBox.valueSelection=[this.filePickBox.value.length,this.filePickBox.value.length],this.busy=!1})})}dispose(){super.dispose()}async handleValueChange(e){try{if(this.isValueChangeFromUser())if(!vr(e,this.constructFullUserPath())&&(!this.isBadSubpath(e)||this.canTildaEscapeHatch(e))){this.filePickBox.validationMessage=void 0;let t=this.filePickBoxValue(),o=3;Ax.isEqual(this.currentFolder,t)||(o=await this.tryUpdateItems(e,t)),(o===3||o===1)&&this.setActiveItems(e)}else this.filePickBox.activeItems=[],this.userEnteredPathSegment=""}catch{}}setButtons(){this.filePickBox.buttons=[{iconClass:this._showDotFiles?q.asClassName(R.eye):q.asClassName(R.eyeClosed),tooltip:this._showDotFiles?d(17521,null):d(17526,null),alwaysVisible:!0}]}isBadSubpath(e){return this.badPath&&e.length>this.badPath.length&&vr(e.substring(0,this.badPath.length),this.badPath)}isValueChangeFromUser(){return!vr(this.filePickBox.value,this.pathAppend(this.currentFolder,this.userEnteredPathSegment+this.autoCompletePathSegment))}isSelectionChangeFromUser(){return this.activeItem!==(this.filePickBox.activeItems?this.filePickBox.activeItems[0]:void 0)}constructFullUserPath(){let e=this.pathFromUri(this.currentFolder);return vr(this.filePickBox.value.substr(0,this.userEnteredPathSegment.length),this.userEnteredPathSegment)?vr(this.filePickBox.value.substr(0,e.length),e)?e:this.userEnteredPathSegment:this.pathAppend(this.currentFolder,this.userEnteredPathSegment)}filePickBoxValue(){let e=this.remoteUriFrom(this.filePickBox.value.trimRight(),this.currentFolder),t=this.pathFromUri(this.currentFolder);if(vr(this.filePickBox.value,t))return this.currentFolder;let o=this.remoteUriFrom(t,this.currentFolder),n=Wd(o,e),r=this.filePickBox.value.length>1&&t.length>1?vr(this.filePickBox.value.substr(0,2),t.substr(0,2)):!1;if(n&&r){let s=Ge(this.currentFolder,n),l=He(e);return(l==="."||l==="..")&&(s=this.remoteUriFrom(this.pathAppend(s,l),this.currentFolder)),eae(e)?W$(s):s}else return e}async onDidAccept(){if(this.busy=!0,!this.updatingPromise&&this.filePickBox.activeItems.length===1){let t=this.filePickBox.selectedItems[0];if(t.isFolder){if(this.trailing)await this.updateItems(t.uri,!0,this.trailing);else{let o=this.pathFromUri(t.uri);mE(o,this.filePickBox.value)&&vr(t.label,He(t.uri))?(this.filePickBox.valueSelection=[this.pathFromUri(this.currentFolder).length,this.filePickBox.value.length],this.insertText(o,this.basenameWithTrailingSlash(t.uri))):t.label===".."&&mE(this.filePickBox.value,o)?(this.filePickBox.valueSelection=[o.length,this.filePickBox.value.length],this.insertText(o,"")):await this.updateItems(t.uri,!0)}this.filePickBox.busy=!1;return}}else if(!this.updatingPromise&&await this.tryUpdateItems(this.filePickBox.value,this.filePickBoxValue())!==3){this.filePickBox.busy=!1;return}let e;if(this.filePickBox.activeItems.length===0?e=this.filePickBoxValue():this.filePickBox.activeItems.length===1&&(e=this.filePickBox.selectedItems[0].uri),e&&(e=this.addPostfix(e)),await this.validate(e))return this.busy=!1,e;this.busy=!1}root(e){let t=e,o=ci(e);for(;!Qe(t,o);)t=o,o=ci(o);return o}canTildaEscapeHatch(e){return!!(e.endsWith("~")&&this.isBadSubpath(e))}tildaReplace(e){let t=this.trueHome;return e.length>0&&e[0]==="~"?Ge(t,e.substring(1)):this.canTildaEscapeHatch(e)?t:this.remoteUriFrom(e)}tryAddTrailingSeparatorToDirectory(e,t){return t.isDirectory&&!this.endsWithSlash(e.path)?W$(e):e}async tryUpdateItems(e,t,o=!1){if(e.length>0&&(e[0]==="~"||this.canTildaEscapeHatch(e))){let n=this.tildaReplace(e);return await this.updateItems(n,!0)?1:0}else{if(e==="\\")return t=this.root(this.currentFolder),e=this.pathFromUri(t),await this.updateItems(t,!0)?1:0;{let n=Ax.isEqual(this.currentFolder,t),r=Ax.isEqual(this.currentFolder,ci(t)),s=Ax.isEqualOrParent(this.currentFolder,ci(t)),l=!s&&!r;if(!n&&(this.endsWithSlash(e)||s||l)||o){let c;try{c=await this.fileService.stat(t)}catch{}if(c?.isDirectory&&He(t)!=="."&&this.endsWithSlash(e))return t=this.tryAddTrailingSeparatorToDirectory(t,c),await this.updateItems(t)?1:0;if(this.endsWithSlash(e))return this.filePickBox.validationMessage=d(17519,null),this.badPath=e,4;{let u=ci(t),p=iae(W$(this.currentFolder)),h=iae(W$(u));if(!Ax.isEqual(p,h)&&(!/^[a-zA-Z]:$/.test(this.filePickBox.value)||!vr(this.pathFromUri(this.currentFolder).substring(0,this.filePickBox.value.length),this.filePickBox.value))){let g;try{g=await this.fileService.stat(u)}catch{}if(g?.isDirectory)return this.badPath=void 0,u=this.tryAddTrailingSeparatorToDirectory(u,g),await this.updateItems(u,!1,He(t))?1:0}}}}}return this.badPath=void 0,3}tryUpdateTrailing(e){let t=es(e);this.trailing&&t&&(this.trailing=He(e))}setActiveItems(e){e=this.pathFromUri(this.tildaReplace(e));let t=this.remoteUriFrom(e),o=He(t),n=this.constructFullUserPath();if(vr(n,e.substring(0,n.length))||vr(e,n.substring(0,e.length))){let s=!1;for(let l=0;l<this.filePickBox.items.length;l++){let c=this.filePickBox.items[l];if(this.setAutoComplete(e,o,c)){s=!0;break}}if(!s){let l=o.length>=2?n.substring(n.length-o.length+2):"";this.userEnteredPathSegment=l===o?o:"",this.autoCompletePathSegment="",this.filePickBox.activeItems=[],this.tryUpdateTrailing(t)}}else this.userEnteredPathSegment=o,this.autoCompletePathSegment="",this.filePickBox.activeItems=[],this.tryUpdateTrailing(t)}setAutoComplete(e,t,o,n=!1){if(this.busy)return this.userEnteredPathSegment=t,this.autoCompletePathSegment="",!1;let r=o.label;return r===".."?(this.userEnteredPathSegment="",this.autoCompletePathSegment="",this.activeItem=o,n&&sm().execCommand("insertText",!1,""),!1):!n&&r.length>=t.length&&vr(r.substr(0,t.length),t)?(this.userEnteredPathSegment=t,this.activeItem=o,this.autoCompletePathSegment="",o.isFolder||!this.trailing?this.filePickBox.activeItems=[o]:this.filePickBox.activeItems=[],!0):n&&!vr(this.basenameWithTrailingSlash(o.uri),this.userEnteredPathSegment+this.autoCompletePathSegment)?(this.userEnteredPathSegment="",this.accessibilityService.isScreenReaderOptimized()||(this.autoCompletePathSegment=this.trimTrailingSlash(r)),this.activeItem=o,this.accessibilityService.isScreenReaderOptimized()||(this.filePickBox.valueSelection=[this.pathFromUri(this.currentFolder,!0).length,this.filePickBox.value.length],this.insertText(this.pathAppend(this.currentFolder,this.autoCompletePathSegment),this.autoCompletePathSegment),this.filePickBox.valueSelection=[this.filePickBox.value.length-this.autoCompletePathSegment.length,this.filePickBox.value.length]),!0):(this.userEnteredPathSegment=t,this.autoCompletePathSegment="",!1)}insertText(e,t){this.filePickBox.inputHasFocus()?(sm().execCommand("insertText",!1,t),this.filePickBox.value!==e&&(this.filePickBox.value=e,this.handleValueChange(e))):(this.filePickBox.value=e,this.handleValueChange(e))}addPostfix(e){let t=e;if(this.requiresTrailing&&this.options.filters&&this.options.filters.length>0&&!eae(e)){let o=!1,n=es(e).substr(1);for(let r=0;r<this.options.filters.length;r++){for(let s=0;s<this.options.filters[r].extensions.length;s++)if(this.options.filters[r].extensions[s]==="*"||this.options.filters[r].extensions[s]===n){o=!0;break}if(o)break}o||(t=Ge(ci(e),He(e)+"."+this.options.filters[0].extensions[0]))}return t}trimTrailingSlash(e){return e.length>1&&this.endsWithSlash(e)?e.substr(0,e.length-1):e}yesNoPrompt(e,t){let o=new N,n=o.add(this.quickInputService.createQuickPick());n.title=t,n.ignoreFocusOut=!0,n.ok=!0,n.customButton=!0,n.customLabel=d(17520,null),n.customButtonSecondary=!0,n.value=this.pathFromUri(e);let r=!1;return new Promise(s=>{o.add(n.onDidAccept(()=>{r=!0,n.hide(),s(!0)})),o.add(n.onDidHide(()=>{r||s(!1),this.filePickBox.show(),this.hidden=!1,o.dispose()})),o.add(n.onDidChangeValue(()=>{n.hide()})),o.add(n.onDidCustom(()=>{n.hide()})),n.show()})}async validate(e){if(e===void 0)return this.filePickBox.validationMessage=d(17522,null),Promise.resolve(!1);let t,o;try{o=await this.fileService.stat(ci(e)),t=await this.fileService.stat(e)}catch{}if(this.requiresTrailing){if(t?.isDirectory)return this.filePickBox.validationMessage=d(17531,null),Promise.resolve(!1);if(t){let n=d(17529,null,He(e));return this.yesNoPrompt(e,n)}else if(v1(He(e),this.isWindows))if(o)if(o.isDirectory){if(o.readonly)return this.filePickBox.validationMessage=d(17534,null),Promise.resolve(!1)}else return this.filePickBox.validationMessage=d(17533,null),Promise.resolve(!1);else{let n=d(17528,null,He(ci(e)));return this.yesNoPrompt(e,n)}else return this.filePickBox.validationMessage=d(17527,null),Promise.resolve(!1)}else if(t){if(e.path==="/"&&this.isWindows)return this.filePickBox.validationMessage=d(17535,null),Promise.resolve(!1);if(t.isDirectory&&!this.allowFolderSelection)return this.filePickBox.validationMessage=d(17530,null),Promise.resolve(!1);if(!t.isDirectory&&!this.allowFileSelection)return this.filePickBox.validationMessage=d(17532,null),Promise.resolve(!1)}else return this.filePickBox.validationMessage=d(17533,null),Promise.resolve(!1);return Promise.resolve(!0)}async updateItems(e,t=!1,o){this.busy=!0,this.autoCompletePathSegment="";let n=o==="..";o=n?void 0:o;let r=!!o,s=!1,l=Ln(async c=>{let u;try{u=await this.fileService.resolve(e),u.isDirectory||(o=He(e),e=ci(e),u=void 0,s=!0)}catch{}let p=o?this.pathAppend(e,o):this.pathFromUri(e,!0);return this.currentFolder=this.endsWithSlash(e.path)?e:W$(e,this.separator),this.userEnteredPathSegment=o||"",this.createItems(u,this.currentFolder,c).then(h=>c.isCancellationRequested?(this.busy=!1,!1):(this.filePickBox.itemActivation=0,this.filePickBox.items=h,!vr(this.filePickBox.value,p)&&(t||n)&&(this.filePickBox.valueSelection=[0,this.filePickBox.value.length],this.insertText(p,p)),t&&o&&r?this.filePickBox.valueSelection=[this.filePickBox.value.length-o.length,this.filePickBox.value.length-o.length]:o||(this.filePickBox.valueSelection=[this.filePickBox.value.length,this.filePickBox.value.length]),this.busy=!1,this.updatingPromise=void 0,s))});return this.updatingPromise!==void 0&&this.updatingPromise.cancel(),this.updatingPromise=l,l}pathFromUri(e,t=!1){let o;if(this.scopedAuthority){let n=e.path;this.scopedPathPrefix&&n.startsWith(this.scopedPathPrefix)&&(n=n.substring(this.scopedPathPrefix.length)),o=n.replace(/\n/g,"")}else o=Hp(e.fsPath,this.isWindows).replace(/\n/g,"");return this.separator==="/"?o=o.replace(/\\/g,this.separator):o=o.replace(/\//g,this.separator),t&&!this.endsWithSlash(o)&&(o=o+this.separator),o}pathAppend(e,t){return t===".."||t==="."?this.pathFromUri(e,!0)+t:this.pathFromUri(Ge(e,t))}async checkIsWindowsOS(){let e=ei,t=await this.getRemoteAgentEnvironment();return t&&(e=t.os===1),e}endsWithSlash(e){return/[\/\\]$/.test(e)}basenameWithTrailingSlash(e){let t=this.pathFromUri(e,!0),o=this.pathFromUri(ci(e),!0);return t.substring(o.length)}async createBackItem(e){if(this.scopedPathPrefix){let s=e.path.substring(this.scopedPathPrefix.length);if(s==="/"||s==="")return}let t=this.scopedAuthority?this.scheme:Q.file,o=this.scopedAuthority??"",n=this.currentFolder.with({scheme:t,authority:o}),r=ci(n);if(!Qe(n,r)){let s=ci(e);if(await this.fileService.exists(s))return{label:"..",uri:W$(s,this.separator),isFolder:!0}}}async createItems(e,t,o){let n=[],r=await this.createBackItem(t);try{e||(e=await this.fileService.resolve(t));let l=this._showDotFiles?e.children:e.children?.filter(u=>!u.name.startsWith(".")),c=l?await Promise.all(l.map(u=>this.createItem(u,t,o))):[];for(let u of c)u&&n.push(u)}catch(l){console.log(l)}if(o.isCancellationRequested)return[];let s=n.sort((l,c)=>{if(l.isFolder!==c.isFolder)return l.isFolder?-1:1;let u=this.endsWithSlash(l.label)?l.label.substr(0,l.label.length-1):l.label,p=this.endsWithSlash(c.label)?c.label.substr(0,c.label.length-1):c.label;return u.localeCompare(p)});return r&&s.unshift(r),s}filterFile(e){if(this.options.filters){for(let t=0;t<this.options.filters.length;t++)for(let o=0;o<this.options.filters[t].extensions.length;o++){let n=this.options.filters[t].extensions[o];if(n==="*"||e.path.endsWith("."+n))return!0}return!1}return!0}async createItem(e,t,o){if(o.isCancellationRequested)return;let n=Ge(t,e.name);if(e.isDirectory){let r=He(n);return n=W$(n,this.separator),{label:r,uri:n,isFolder:!0,iconClasses:aa(this.modelService,this.languageService,n||void 0,1)}}else if(!e.isDirectory&&this.allowFileSelection&&this.filterFile(n))return{label:e.name,uri:n,isFolder:!1,iconClasses:aa(this.modelService,this.languageService,n||void 0)}}};Y2e=I([m(0,fe),m(1,Ue),m(2,rt),m(3,Pe),m(4,Ne),m(5,rn),m(6,Tt),m(7,_t),m(8,At),m(9,bo),m(10,An),m(11,_e),m(12,X),m(13,Oi),m(14,ce)],Y2e);var iGe=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){this.hostService=i;this.contextService=e;this.historyService=t;this.environmentService=o;this.instantiationService=n;this.configurationService=r;this.fileService=s;this.openerService=l;this.dialogService=c;this.languageService=u;this.workspacesService=p;this.labelService=h;this.pathService=g;this.commandService=f;this.editorService=v;this.codeEditorService=b;this.logService=S;this.remoteAgentService=y}async defaultFilePath(i=this.getSchemeFilterForWindow(),e=this.getAuthorityFilterForWindow()){let t=this.historyService.getLastActiveFile(i,e);return t&&await this.isRemoteUserData(t)&&(this.logService.debug(`[FileDialogService] Skipping last active file as it is a remote user data resource: ${t}`),t=void 0),t?(this.logService.debug(`[FileDialogService] Default file path using parent of last active file: ${t}`),t=ci(t)):(t=this.historyService.getLastActiveWorkspaceRoot(i,e),t&&this.logService.debug(`[FileDialogService] Default file path using last active workspace root: ${t}`)),t||(t=await this.preferredHome(i),this.logService.debug(`[FileDialogService] Default file path using preferred home: ${t}`)),t}async defaultFolderPath(i=this.getSchemeFilterForWindow(),e=this.getAuthorityFilterForWindow()){let t=this.historyService.getLastActiveWorkspaceRoot(i,e);if(t?this.logService.debug(`[FileDialogService] Default folder path using last active workspace root: ${t}`):(t=this.historyService.getLastActiveFile(i,e),t&&await this.isRemoteUserData(t)&&(this.logService.debug(`[FileDialogService] Skipping last active file as it is a remote user data resource: ${t}`),t=void 0),t&&this.logService.debug(`[FileDialogService] Default folder path using parent of last active file: ${t}`)),!t){let o=await this.preferredHome(i);return this.logService.debug(`[FileDialogService] Default folder path using preferred home: ${o}`),o}return ci(t)}async preferredHome(i=this.getSchemeFilterForWindow()){let e=i===Q.file,t=this.configurationService.inspect("files.dialog.defaultPath"),o=e?t.userLocalValue:t.userRemoteValue;if(this.logService.debug(`[FileDialogService] Preferred home: preferLocal=${e}, userLocalValue=${t.userLocalValue}, userRemoteValue=${t.userRemoteValue}`),o)if(e?Zl(o):(await this.pathService.path).isAbsolute(o)){let s=e?ch(o):(await this.pathService.path).normalize(o),l=of(await this.pathService.fileURI(s),this.environmentService.remoteAuthority,this.pathService.defaultUriScheme);if(await this.fileService.exists(l))return this.logService.debug(`[FileDialogService] Preferred home using files.dialog.defaultPath setting: ${l}`),l;this.logService.debug(`[FileDialogService] Preferred home files.dialog.defaultPath path does not exist: ${l}`)}else this.logService.debug(`[FileDialogService] Preferred home files.dialog.defaultPath is not absolute: ${o}`);let n=this.pathService.userHome({preferLocal:e});return this.logService.debug(`[FileDialogService] Preferred home using user home: ${n}`),n}async defaultWorkspacePath(i=this.getSchemeFilterForWindow()){let e;if(this.contextService.getWorkbenchState()===3){let t=this.contextService.getWorkspace().configuration;t?.scheme===i&&rce(t,this.environmentService)&&!gw(t)&&(e=ci(t))}return e||(e=await this.defaultFilePath(i)),e}async showSaveConfirm(i){return this.skipDialogs()?(this.logService.trace("FileDialogService: refused to show save confirmation dialog in tests."),1):this.doShowSaveConfirm(i)}skipDialogs(){return this.environmentService.enableSmokeTestDriver&&this.logService.warn("DialogService: Dialog requested during smoke test."),this.environmentService.isExtensionDevelopment&&!!this.environmentService.extensionTestsLocationURI}async doShowSaveConfirm(i){if(i.length===0)return 1;let e,t=d(17512,null);i.length===1?e=d(17513,null,typeof i[0]=="string"?i[0]:He(i[0])):(e=d(17514,null,i.length),t=kC(i)+`
`+t);let{result:o}=await this.dialogService.prompt({type:bt.Warning,message:e,detail:t,buttons:[{label:i.length>1?d(17510,null):d(17509,null),run:()=>0},{label:d(17502,null),run:()=>1}],cancelButton:{run:()=>2}});return o}addFileSchemaIfNeeded(i,e){return i===Q.untitled?[Q.file]:i!==Q.file?[i,Q.file]:[i]}async pickFileFolderAndOpenSimplified(i,e,t){let o=d(17506,null),n=this.addFileSchemaIfNeeded(i),s=(await this.pickResource({canSelectFiles:!0,canSelectFolders:!0,canSelectMany:!1,defaultUri:e.defaultUri,title:o,availableFileSystems:n}))?.[0];if(s){let l=await this.fileService.stat(s),c=l.isDirectory?{folderUri:s}:{fileUri:s};!QCe(c)&&Q6i(c)&&this.addFileToRecentlyOpened(c.fileUri),l.isDirectory||e.forceNewWindow||t?await this.hostService.openWindow([c],{forceNewWindow:e.forceNewWindow,remoteAuthority:e.remoteAuthority}):await this.editorService.openEditors([{resource:s,options:{source:1,pinned:!0}}],void 0,{validateTrust:!0})}}async pickFileAndOpenSimplified(i,e,t){let o=d(17505,null),n=this.addFileSchemaIfNeeded(i),s=(await this.pickResource({canSelectFiles:!0,canSelectFolders:!1,canSelectMany:!1,defaultUri:e.defaultUri,title:o,availableFileSystems:n}))?.[0];s&&(this.addFileToRecentlyOpened(s),e.forceNewWindow||t?await this.hostService.openWindow([{fileUri:s}],{forceNewWindow:e.forceNewWindow,remoteAuthority:e.remoteAuthority}):await this.editorService.openEditors([{resource:s,options:{source:1,pinned:!0}}],void 0,{validateTrust:!0}))}addFileToRecentlyOpened(i){this.workspacesService.addRecentlyOpened([{fileUri:i,label:this.labelService.getUriLabel(i,{appendWorkspaceSuffix:!0})}])}async pickFolderAndOpenSimplified(i,e){let t=d(17507,null),o=this.addFileSchemaIfNeeded(i,!0),r=(await this.pickResource({canSelectFiles:!1,canSelectFolders:!0,canSelectMany:!1,defaultUri:e.defaultUri,title:t,availableFileSystems:o}))?.[0];if(r)return this.hostService.openWindow([{folderUri:r}],{forceNewWindow:e.forceNewWindow,remoteAuthority:e.remoteAuthority})}async pickWorkspaceAndOpenSimplified(i,e){let t=d(17508,null),o=[{name:d(17503,null),extensions:[FE]}],n=this.addFileSchemaIfNeeded(i,!0),s=(await this.pickResource({canSelectFiles:!0,canSelectFolders:!1,canSelectMany:!1,defaultUri:e.defaultUri,title:t,filters:o,availableFileSystems:n}))?.[0];if(s)return this.hostService.openWindow([{workspaceUri:s}],{forceNewWindow:e.forceNewWindow,remoteAuthority:e.remoteAuthority})}async pickFileToSaveSimplified(i,e){e.availableFileSystems||(e.availableFileSystems=this.addFileSchemaIfNeeded(i)),e.title=d(17515,null);let t=await this.saveRemoteResource(e);return t&&this.addFileToRecentlyOpened(t),t}async showSaveDialogSimplified(i,e){return e.availableFileSystems||(e.availableFileSystems=this.addFileSchemaIfNeeded(i)),this.saveRemoteResource(e)}async showOpenDialogSimplified(i,e){return e.availableFileSystems||(e.availableFileSystems=this.addFileSchemaIfNeeded(i,e.canSelectFolders)),this.pickResource(e)}getSimpleFileDialog(){return this.instantiationService.createInstance(Y2e)}pickResource(i){return this.getSimpleFileDialog().showOpenDialog(i)}saveRemoteResource(i){return this.getSimpleFileDialog().showSaveDialog(i)}async isRemoteUserData(i){if(!this.environmentService.remoteAuthority)return!1;let e=await this.remoteAgentService.getEnvironment();if(e){let t=ci(ci(e.settingsPath));if(!Qe(t,t.with({path:"/"}))&&ws(i,t))return!0}return!1}getSchemeFilterForWindow(i){return i??this.pathService.defaultUriScheme}getAuthorityFilterForWindow(){return this.environmentService.remoteAuthority}getFileSystemSchema(i){return i.availableFileSystems?.[0]||this.getSchemeFilterForWindow(i.defaultUri?.scheme)}getWorkspaceAvailableFileSystems(i){if(i.availableFileSystems&&i.availableFileSystems.length>0)return i.availableFileSystems;let e=[Q.file];return this.environmentService.remoteAuthority&&e.unshift(Q.vscodeRemote),e}getPickFileToSaveDialogOptions(i,e){let t={defaultUri:i,title:d(17511,null),availableFileSystems:e},o=i?es(i):void 0,n,r=this.languageService.getSortedRegisteredLanguageNames(),s=di(r.map(({languageName:l,languageId:c})=>{let u=this.languageService.getExtensions(c);if(!u.length)return null;let p={name:l,extensions:zo(u).slice(0,10).map(g=>LL(g,"."))},h=o||cje;if(!n&&u.includes(h)){n=p;let g=LL(h,".");return p.extensions.includes(g)||p.extensions.unshift(g),null}return p}));return!n&&o&&(n={name:LL(o,".").toUpperCase(),extensions:[LL(o,".")]}),t.filters=di([{name:d(17501,null),extensions:["*"]},n,...s,{name:d(17504,null),extensions:[""]}]),t}};iGe=I([m(0,Zt),m(1,Pe),m(2,na),m(3,At),m(4,F),m(5,B),m(6,fe),m(7,Je),m(8,at),m(9,_t),m(10,jp),m(11,rt),m(12,An),m(13,ge),m(14,ee),m(15,qt),m(16,se),m(17,bo)],iGe);var npt=class extends iGe{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k){super(e,t,o,n,r,s,l,c,p,h,g,f,v,b,S,y,w,k);this.nativeHostService=u}toNativeOpenDialogOptions(e){return{forceNewWindow:e.forceNewWindow,telemetryExtraData:e.telemetryExtraData,defaultPath:e.defaultUri?.fsPath}}shouldUseSimplified(e){let t=this.configurationService.getValue("files.simpleDialog.enable")===!0,o=this.configurationService.getValue("window.openFilesInNewWindow")==="on";return{useSimplified:e!==Q.file&&e!==Q.vscodeUserData||t||!!this.environmentService.enableSmokeTestDriver,isSetting:o}}async pickFileFolderAndOpen(e){let t=this.getFileSystemSchema(e);e.defaultUri||(e.defaultUri=await this.defaultFilePath(t));let o=this.shouldUseSimplified(t);return o.useSimplified?this.pickFileFolderAndOpenSimplified(t,e,o.isSetting):this.nativeHostService.pickFileFolderAndOpen(this.toNativeOpenDialogOptions(e))}async pickFileAndOpen(e){let t=this.getFileSystemSchema(e);e.defaultUri||(e.defaultUri=await this.defaultFilePath(t));let o=this.shouldUseSimplified(t);return o.useSimplified?this.pickFileAndOpenSimplified(t,e,o.isSetting):this.nativeHostService.pickFileAndOpen(this.toNativeOpenDialogOptions(e))}async pickFolderAndOpen(e){let t=this.getFileSystemSchema(e);return e.defaultUri||(e.defaultUri=await this.defaultFolderPath(t)),this.shouldUseSimplified(t).useSimplified?this.pickFolderAndOpenSimplified(t,e):this.nativeHostService.pickFolderAndOpen(this.toNativeOpenDialogOptions(e))}async pickWorkspaceAndOpen(e){e.availableFileSystems=this.getWorkspaceAvailableFileSystems(e);let t=this.getFileSystemSchema(e);return e.defaultUri||(e.defaultUri=await this.defaultWorkspacePath(t)),this.shouldUseSimplified(t).useSimplified?this.pickWorkspaceAndOpenSimplified(t,e):this.nativeHostService.pickWorkspaceAndOpen(this.toNativeOpenDialogOptions(e))}async pickFileToSave(e,t){let o=this.getFileSystemSchema({defaultUri:e,availableFileSystems:t}),n=this.getPickFileToSaveDialogOptions(e,t);if(this.shouldUseSimplified(o).useSimplified)return this.pickFileToSaveSimplified(o,n);{let r=await this.nativeHostService.showSaveDialog(this.toNativeSaveDialogOptions(n));if(r&&!r.canceled&&r.filePath){let s=A.file(r.filePath);return this.addFileToRecentlyOpened(s),s}}}toNativeSaveDialogOptions(e){return e.defaultUri=e.defaultUri?A.file(e.defaultUri.path):void 0,{defaultPath:e.defaultUri?.fsPath,buttonLabel:typeof e.saveLabel=="string"?e.saveLabel:e.saveLabel?.withMnemonic,filters:e.filters,title:e.title,targetWindowId:Ki().vscodeWindowId}}async showSaveDialog(e){let t=this.getFileSystemSchema(e);if(this.shouldUseSimplified(t).useSimplified)return this.showSaveDialogSimplified(t,e);let o=await this.nativeHostService.showSaveDialog(this.toNativeSaveDialogOptions(e));if(o&&!o.canceled&&o.filePath)return A.file(o.filePath)}async showOpenDialog(e){let t=this.getFileSystemSchema(e);if(this.shouldUseSimplified(t).useSimplified)return this.showOpenDialogSimplified(t,e);let o={title:e.title,defaultPath:e.defaultUri?.fsPath,buttonLabel:typeof e.openLabel=="string"?e.openLabel:e.openLabel?.withMnemonic,filters:e.filters,properties:[],targetWindowId:Ki().vscodeWindowId};o.properties.push("createDirectory"),e.canSelectFiles&&o.properties.push("openFile"),e.canSelectFolders&&o.properties.push("openDirectory"),e.canSelectMany&&o.properties.push("multiSelections");let n=await this.nativeHostService.showOpenDialog(o);return n&&Array.isArray(n.filePaths)&&n.filePaths.length>0?n.filePaths.map(A.file):void 0}};npt=I([m(0,Zt),m(1,Pe),m(2,na),m(3,At),m(4,F),m(5,B),m(6,fe),m(7,Je),m(8,ko),m(9,at),m(10,_t),m(11,jp),m(12,rt),m(13,An),m(14,ge),m(15,ee),m(16,qt),m(17,se),m(18,bo)],npt);Ee(rn,npt,1);var rpt=class{constructor(i,e){return Tc.toService(i.getChannel("workspaces"),{context:e.windowId})}};rpt=I([m(0,pu),m(1,ko)],rpt);Ee(jp,rpt,1);var k7t=le("menubarService");Uy(k7t,"menubar");var E7t=class{constructor(i){this.channel=i;this.disposables=new N;this._onStateChange=this.disposables.add(new E);this.onStateChange=this._onStateChange.event;this._state=boo.Uninitialized;this.disposables.add(this.channel.listen("onStateChange")(e=>this.state=e)),this.channel.call("_getInitialState").then(e=>this.state=e)}get state(){return this._state}set state(i){this._state=i,this._onStateChange.fire(i)}checkForUpdates(i){return this.channel.call("checkForUpdates",i)}downloadUpdate(i){return this.channel.call("downloadUpdate",i)}applyUpdate(){return this.channel.call("applyUpdate")}quitAndInstall(){return this.channel.call("quitAndInstall")}isLatestVersion(){return this.channel.call("isLatestVersion")}_applySpecificUpdate(i){return this.channel.call("_applySpecificUpdate",i)}setInternalOrg(i){return this.channel.call("setInternalOrg",i)}dispose(){this.disposables.dispose()}};Uy(zd,"update",{channelClientCtor:E7t});var T7t=class{constructor(i){this.handler=i}listen(i,e){throw new Error(`Event not found: ${e}`)}call(i,e,t){if(e==="handleURL")return this.handler.handleURL(A.revive(t[0]),t[1]);throw new Error(`Call not found: ${e}`)}};var tzi=class extends x{constructor(){super(...arguments);this.handlers=new Set}open(e,t){let o=[...this.handlers.values()];return nae(o.map(n=>()=>n.handleURL(e,t)),void 0,!1).then(n=>n||!1)}registerHandler(e){return this.handlers.add(e),Z(()=>this.handlers.delete(e))}},oGe=class extends tzi{constructor(e){super();this.productService=e}create(e){let{authority:t,path:o,query:n,fragment:r}=e||{authority:void 0,path:void 0,query:void 0,fragment:void 0};return t&&o&&o.indexOf("/")!==0&&(o=`/${o}`),A.from({scheme:this.productService.urlProtocol,authority:t,path:o,query:n,fragment:r})}};oGe=I([m(0,tt)],oGe);var spt=class extends oGe{constructor(e,t,o,n,r){super(n);this.nativeHostService=o;this.logService=r;this.urlService=Tc.toService(e.getChannel("url")),e.registerChannel("urlHandler",new T7t(this)),t.registerOpener(this)}create(e){let t=super.create(e),o=t.query;return o?o+=`&windowId=${encodeURIComponent(this.nativeHostService.windowId)}`:o=`windowId=${encodeURIComponent(this.nativeHostService.windowId)}`,t.with({query:o})}async open(e,t){return ec(e,this.productService.urlProtocol)?(typeof e=="string"&&(e=A.parse(e)),await this.urlService.open(e,t)):!1}async handleURL(e,t){let o=await super.open(e,t);return o?(this.logService.trace("URLService#handleURL(): handled",e.toString(!0)),await this.nativeHostService.focusWindow({mode:2,targetWindowId:this.nativeHostService.windowId})):this.logService.trace("URLService#handleURL(): not handled",e.toString(!0)),o}};spt=I([m(0,pu),m(1,Je),m(2,ko),m(3,tt),m(4,se)],spt);Ee(_b,spt,0);function _7t(a,i){if(a.length===0)return Promise.resolve(!1);let e=[],t=!1;for(let o of a){if(o===!0)return Promise.resolve(!0);f_(o)&&e.push(o.then(n=>{n&&(t=!0)},n=>{i(n),t=!0}))}return dn.settled(e).then(()=>t)}var r$=class extends x{constructor(e,t){super();this.logService=e;this.storageService=t;this._onBeforeShutdown=this._register(new E);this.onBeforeShutdown=this._onBeforeShutdown.event;this._onWillShutdown=this._register(new E);this.onWillShutdown=this._onWillShutdown.event;this._onDidShutdown=this._register(new E);this.onDidShutdown=this._onDidShutdown.event;this._onBeforeShutdownError=this._register(new E);this.onBeforeShutdownError=this._onBeforeShutdownError.event;this._onShutdownVeto=this._register(new E);this.onShutdownVeto=this._onShutdownVeto.event;this._phase=1;this._willShutdown=!1;this.phaseWhen=new Map;this._startupKind=this.resolveStartupKind(),this._register(this.storageService.onWillSaveState(o=>{o.reason===1&&this.storageService.store(r$.LAST_SHUTDOWN_REASON_KEY,this.shutdownReason,1,1)}))}static{this.LAST_SHUTDOWN_REASON_KEY="lifecyle.lastShutdownReason"}get startupKind(){return this._startupKind}get phase(){return this._phase}get willShutdown(){return this._willShutdown}resolveStartupKind(){let e=this.doResolveStartupKind()??1;return this.logService.trace(`[lifecycle] starting up (startup kind: ${e})`),e}doResolveStartupKind(){let e=this.storageService.getNumber(r$.LAST_SHUTDOWN_REASON_KEY,1);this.storageService.remove(r$.LAST_SHUTDOWN_REASON_KEY,1);let t;switch(e){case 3:t=3;break;case 4:t=4;break}return t}set phase(e){if(e<this.phase)throw new Error("Lifecycle cannot go backwards");if(this._phase===e)return;this.logService.trace(`lifecycle: phase changed (value: ${e})`),this._phase=e,Mo(`code/LifecyclePhase/${ZXi(e)}`);let t=this.phaseWhen.get(this._phase);t&&(t.open(),this.phaseWhen.delete(this._phase))}async when(e){if(e<=this._phase)return;let t=this.phaseWhen.get(e);t||(t=new gp,this.phaseWhen.set(e,t)),await t.wait()}};r$=I([m(0,se),m(1,ce)],r$);var ase=class extends r${constructor(e,t,o){super(o,t);this.nativeHostService=e;this.registerListeners()}static{this.BEFORE_SHUTDOWN_WARNING_DELAY=5e3}static{this.WILL_SHUTDOWN_WARNING_DELAY=800}registerListeners(){let e=this.nativeHostService.windowId;tl.on("vscode:onBeforeUnload",async(t,...o)=>{let n=o[0];this.logService.trace(`[lifecycle] onBeforeUnload (reason: ${n.reason})`),await this.handleBeforeShutdown(n.reason)?(this.logService.trace("[lifecycle] onBeforeUnload prevented via veto"),this._onShutdownVeto.fire(),tl.send(n.cancelChannel,e)):(this.logService.trace("[lifecycle] onBeforeUnload continues without veto"),this.shutdownReason=n.reason,tl.send(n.okChannel,e))}),tl.on("vscode:onWillUnload",async(t,...o)=>{let n=o[0];this.logService.trace(`[lifecycle] onWillUnload (reason: ${n.reason})`),await this.handleWillShutdown(n.reason),this._onDidShutdown.fire(),tl.send(n.replyChannel,e)})}async handleBeforeShutdown(e){let t=this.logService,o=[],n=new Set,r,s;this._onBeforeShutdown.fire({reason:e,veto(c,u){o.push(c),c===!0?t.info(`[lifecycle]: Shutdown was prevented (id: ${u})`):c instanceof Promise&&(n.add(u),c.then(p=>{p===!0&&t.info(`[lifecycle]: Shutdown was prevented (id: ${u})`)}).finally(()=>n.delete(u)))},finalVeto(c,u){if(!r)r=c,s=u;else throw new Error(`[lifecycle]: Final veto is already defined (id: ${u})`)}});let l=tn(()=>{t.warn(`[lifecycle] onBeforeShutdown is taking a long time, pending operations: ${Array.from(n).join(", ")}`)},ase.BEFORE_SHUTDOWN_WARNING_DELAY);try{let c=await _7t(o,u=>this.handleBeforeShutdownError(u,e));if(c)return c;if(r)try{n.add(s),c=await r(),c&&t.info(`[lifecycle]: Shutdown was prevented by final veto (id: ${s})`)}catch(u){c=!0,this.handleBeforeShutdownError(u,e)}return c}finally{l.dispose()}}handleBeforeShutdownError(e,t){this.logService.error(`[lifecycle]: Error during before-shutdown phase (error: ${xn(e)})`),this._onBeforeShutdownError.fire({reason:t,error:e})}async handleWillShutdown(e){this._willShutdown=!0;let t=[],o=[],n=new Set,r=new Ye;this._onWillShutdown.fire({reason:e,token:r.token,joiners:()=>Array.from(n.values()),join(l,c){if(n.add(c),c.order===2){let u=typeof l=="function"?l:()=>l;o.push(()=>u().finally(()=>n.delete(c)))}else{let u=typeof l=="function"?l():l;u.finally(()=>n.delete(c)),t.push(u)}},force:()=>{r.dispose(!0)}});let s=tn(()=>{this.logService.warn(`[lifecycle] onWillShutdown is taking a long time, pending operations: ${Array.from(n).map(l=>l.id).join(", ")}`)},ase.WILL_SHUTDOWN_WARNING_DELAY);try{await Va(dn.settled(t),r.token)}catch(l){this.logService.error(`[lifecycle]: Error during will-shutdown phase in default joiners (error: ${xn(l)})`)}try{await Va(dn.settled(o.map(l=>l())),r.token)}catch(l){this.logService.error(`[lifecycle]: Error during will-shutdown phase in last joiners (error: ${xn(l)})`)}s.dispose()}shutdown(){return this.nativeHostService.closeWindow()}};ase=I([m(0,ko),m(1,ce),m(2,se)],ase);Ee(ji,ase,0);var JIn="chat.disableAIFeatures",ZIn="chat.customizationsMenu.enabled",eyn="chat.agentsControl.enabled",nGe=class{constructor(i,e,t,o){this._disposables=new N;this._onDidChangeVisibility=this._disposables.add(new E);this.onDidChangeVisibility=this._onDidChangeVisibility.event;this.element=document.createElement("div");this.element.classList.add("command-center");let n=t.createInstance(or,this.element,D.CommandCenter,{contextMenu:D.TitleBarContext,hiddenItemStrategy:-1,toolbarOptions:{primaryGroup:()=>!0},telemetrySource:"commandCenter",actionViewItemProvider:(r,s)=>r instanceof Nc&&r.item.submenu===D.CommandCenterCenter?t.createInstance(lSe,r,i,{...s,hoverDelegate:e}):Bs(t,r,{...s,hoverDelegate:e})});this._disposables.add(U.filter(o.onShow,()=>wgt(this.element),this._disposables)(this._setVisibility.bind(this,!1))),this._disposables.add(o.onHide(this._setVisibility.bind(this,!0))),this._disposables.add(n)}_setVisibility(i){this.element.classList.toggle("hide",!i),this._onDidChangeVisibility.fire()}dispose(){this._disposables.dispose()}};nGe=I([m(2,F),m(3,Ue)],nGe);var lSe=class extends wl{constructor(e,t,o,n,r,s,l,c){super(void 0,e.actions.find(u=>u.id==="workbench.action.quickOpenWithModes")??e.actions[0],o);this._submenu=e;this._windowTitle=t;this._hoverService=n;this._keybindingService=r;this._instaService=s;this._editorGroupService=l;this._configurationService=c;this._hoverDelegate=o.hoverDelegate??Ri("mouse")}static{this._quickOpenCommandId="workbench.action.quickOpenWithModes"}render(e){super.render(e),e.classList.add("command-center-center"),e.classList.toggle("multiple",this._submenu.actions.length>1);let t=this._store.add(this._hoverService.setupManagedHover(this._hoverDelegate,e,this.getTooltip()));this._store.add(this._windowTitle.onDidChange(()=>{t.update(this.getTooltip())}));let o=[];for(let n of this._submenu.actions)n instanceof Fs?o.push(n.actions):o.push([n]);for(let n=0;n<o.length;n++){let r=o[n],s=this._instaService.createInstance(ol,e,{hiddenItemStrategy:-1,telemetrySource:"commandCenterCenter",actionViewItemProvider:(l,c)=>{if(c={...c,hoverDelegate:this._hoverDelegate},l.id!==lSe._quickOpenCommandId)return Bs(this._instaService,l,c);let u=this;return this._instaService.createInstance(class extends wl{constructor(){super(void 0,l,c)}render(h){super.render(h),h.classList.toggle("command-center-quick-pick"),h.role="button",h.setAttribute("aria-description",this.getTooltip());let g=u._configurationService.getValue(JIn)===!0,f=u._configurationService.getValue("disableAICustomizations")===!0||u._configurationService.getValue("workbench.disableAICustomizations")===!0||u._configurationService.getValue(ZIn)===!1,v=g&&f,b=u._configurationService.getValue(eyn),S=!v&&(b===!0||b===void 0||b==="compact");h.classList.toggle("compact-mode",S);let y=this.action,w=document.createElement("span");w.ariaHidden="true",w.className=y.class??"",w.classList.add("search-icon");let k=this._getLabel(),T=document.createElement("span");T.classList.add("search-label"),T.textContent=k,S?vi(h,T):vi(h,w,T);let P=this._store.add(u._hoverService.setupManagedHover(u._hoverDelegate,h,this.getTooltip()));this._store.add(u._windowTitle.onDidChange(()=>{P.update(this.getTooltip()),T.textContent=this._getLabel()})),this._store.add(u._editorGroupService.onDidChangeEditorPartOptions(({newPartOptions:O,oldPartOptions:V})=>{O.showTabs!==V.showTabs&&(P.update(this.getTooltip()),T.textContent=this._getLabel())}))}getTooltip(){return u.getTooltip()}_getLabel(){let{prefix:h,suffix:g}=u._windowTitle.getTitleDecorations(),f=u._windowTitle.workspaceName;return u._windowTitle.isCustomTitleFormat()?f=u._windowTitle.getWindowTitle():u._editorGroupService.partOptions.showTabs==="none"&&(f=u._windowTitle.fileName??f),f||(f=d(4483,null)),h&&(f=d(4484,null,h,f)),g&&(f=d(4485,null,f,g)),f.replaceAll(/\r\n|\r|\n/g,"\u23CE")}})}});if(s.setActions(r),this._store.add(s),n<o.length-1){let l=Sn(R.circleSmallFilled);l.style.padding="0 8px",l.style.height="100%",l.style.opacity="0.5",e.appendChild(l)}}}getTooltip(){let e=this._keybindingService.lookupKeybinding(this.action.id)?.getLabel();return e?d(4486,null,this._windowTitle.workspaceName,e,this._windowTitle.value):d(4487,null,this._windowTitle.workspaceName,this._windowTitle.value)}};lSe=I([m(3,nt),m(4,_e),m(5,F),m(6,wt),m(7,B)],lSe);ve.appendMenuItem(D.CommandCenter,{submenu:D.CommandCenterCenter,title:d(4488,null),icon:R.shield,order:101});var rGe=class extends nee{constructor(e,t,o){super("workbench.titleService",o,t);this.instantiationService=e;this.properties=void 0;this.variables=new Map;this.mainPart=this._register(this.createMainTitlebarPart()),this.onMenubarVisibilityChange=this.mainPart.onMenubarVisibilityChange,this._register(this.registerPart(this.mainPart)),this.registerActions(),this.registerAPICommands()}createMainTitlebarPart(){return this.instantiationService.createInstance(apt)}registerActions(){let e=this;this._register(W(class extends K{constructor(){super({id:"workbench.action.focusTitleBar",title:L(4525,"Focus Title Bar"),category:Ve.View,f1:!0,precondition:r4})}run(){e.getPartByDocument(sm())?.focus()}}))}registerAPICommands(){this._register($e.registerCommand({id:"registerWindowTitleVariable",handler:(e,t,o)=>{this.registerVariables([{name:t,contextKey:o}])},metadata:{description:"Registers a new title variable",args:[{name:"name",schema:{type:"string"},description:"The name of the variable to register"},{name:"contextKey",schema:{type:"string"},description:"The context key to use for the value of the variable"}]}}))}createAuxiliaryTitlebarPart(e,t,o){let n=_(".part.titlebar",{role:"none"});n.style.position="relative",e.insertBefore(n,e.firstChild);let r=new N,s=this.doCreateAuxiliaryTitlebarPart(n,t,o);return r.add(this.registerPart(s)),r.add(U.runAndSubscribe(s.onDidChange,()=>n.style.height=`${s.height}px`)),s.create(n),this.properties&&s.updateProperties(this.properties),this.variables.size&&s.registerVariables(Array.from(this.variables.values())),U.once(s.onWillDispose)(()=>r.dispose()),s}doCreateAuxiliaryTitlebarPart(e,t,o){return o.createInstance(cSe,e,t,this.mainPart)}updateProperties(e){this.properties=e;for(let t of this.parts)t.updateProperties(e)}registerVariables(e){let t=[];for(let o of e)this.variables.has(o.name)||(this.variables.set(o.name,o),t.push(o));for(let o of this.parts)o.registerVariables(t)}};rGe=I([m(0,F),m(1,ce),m(2,Le)],rGe);var lse=class extends RT{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super(e,{hasTitle:!1},c,u,p);this.editorGroupsContainer=o;this.contextMenuService=n;this.configurationService=r;this.environmentService=s;this.instantiationService=l;this.storageService=u;this.contextKeyService=h;this.hostService=g;this.editorService=f;this.menuService=v;this.keybindingService=b;this.minimumWidth=0;this.maximumWidth=Number.POSITIVE_INFINITY;this._onMenubarVisibilityChange=this._register(new E);this.onMenubarVisibilityChange=this._onMenubarVisibilityChange.event;this._onWillDispose=this._register(new E);this.onWillDispose=this._onWillDispose.event;this.customMenubar=this._register(new me);this.actionToolBarDisposable=this._register(new N);this.editorActionsChangeDisposable=this._register(new N);this.centerAdjacentToolBarDisposable=this._register(new N);this.globalToolbarMenuDisposables=this._register(new N);this.editorToolbarMenuDisposables=this._register(new N);this.layoutToolbarMenuDisposables=this._register(new N);this.activityToolbarDisposables=this._register(new N);this.titleDisposables=this._register(new N);this.isInactive=!1;this.isCompact=!1;this.isAuxiliary=t.vscodeWindowId!==ut.vscodeWindowId,this.isCompactContextKey=PF.bindTo(this.contextKeyService),this.titleBarStyle=xY(this.configurationService),this.windowTitle=this._register(l.createInstance(Mk,t)),this.hoverDelegate=this._register(Qh()),this.registerListeners(gv(t))}get minimumHeight(){let e=Wt&&zse(),t=this.isCommandCenterVisible||e?kY:30;return e&&(t=Math.max(t,pGi(Re(this.element))?.height??0)),t/(this.preventZoom?Zv(Re(this.element)):1)}get maximumHeight(){return this.minimumHeight}registerListeners(e){this._register(this.hostService.onDidChangeFocus(t=>t?this.onFocus():this.onBlur())),this._register(this.hostService.onDidChangeActiveWindow(t=>t===e?this.onFocus():this.onBlur())),this._register(this.configurationService.onDidChangeConfiguration(t=>this.onConfigurationChanged(t))),this._register(this.editorGroupsContainer.onDidChangeEditorPartOptions(t=>this.onEditorPartConfigurationChange(t)))}onBlur(){this.isInactive=!0,this.updateStyles()}onFocus(){this.isInactive=!1,this.updateStyles()}onEditorPartConfigurationChange({oldPartOptions:e,newPartOptions:t}){(e.editorActionsLocation!==t.editorActionsLocation||e.showTabs!==t.showTabs)&&jO(this.configurationService,this.titleBarStyle)&&this.actionToolBar&&(this.createActionToolBar(),this.createActionToolBarMenus({editorActions:!0}),this._onDidChange.fire(void 0))}onConfigurationChanged(e){if(!this.isAuxiliary&&!$O(this.configurationService,this.titleBarStyle)&&(!Ze||Wt)&&e.affectsConfiguration("window.menuBarVisibility")&&(this.currentMenubarVisibility==="compact"?this.uninstallMenubar():this.installMenubar()),jO(this.configurationService,this.titleBarStyle)&&this.actionToolBar){let t=e.affectsConfiguration("workbench.layoutControl.enabled"),o=e.affectsConfiguration("workbench.activityBar.location");(t||o)&&(this.createActionToolBarMenus({layoutActions:t,activityActions:o}),this._onDidChange.fire(void 0))}e.affectsConfiguration("window.commandCenter")&&this.recreateTitle()}recreateTitle(){this.createTitle(),this._onDidChange.fire(void 0)}updateOptions(e){let t=this.isCompact;this.isCompact=e.compact,this.isCompactContextKey.set(this.isCompact),t!==this.isCompact&&(this.recreateTitle(),this.createActionToolBarMenus(!0))}installMenubar(){this.menubar||(this.customMenubar.value=this.instantiationService.createInstance(pee),this.menubar=M(this.leftContent,_("div.menubar")),this.menubar.setAttribute("role","menubar"),this._register(this.customMenubar.value.onVisibilityChange(e=>this.onMenubarVisibilityChanged(e))),this.customMenubar.value.create(this.menubar))}uninstallMenubar(){this.customMenubar.value=void 0,this.menubar?.remove(),this.menubar=void 0,this.onMenubarVisibilityChanged(!1)}onMenubarVisibilityChanged(e){(Wt||ei||fn)&&(this.lastLayoutDimensions&&this.layout(this.lastLayoutDimensions.width,this.lastLayoutDimensions.height),this._onMenubarVisibilityChange.fire(e))}updateProperties(e){this.windowTitle.updateProperties(e)}registerVariables(e){this.windowTitle.registerVariables(e)}createContentArea(e){if(this.element=e,this.rootContainer=M(e,_(".titlebar-container")),this.leftContent=M(this.rootContainer,_(".titlebar-left")),this.centerContent=M(this.rootContainer,_(".titlebar-center")),this.rightContent=M(this.rootContainer,_(".titlebar-right")),(ei||fn)&&!LC(this.configurationService,this.titleBarStyle)&&(this.appIcon=KS(this.leftContent,_("a.window-appicon"))),this.dragRegion=KS(this.rootContainer,_("div.titlebar-drag-region")),!this.isAuxiliary&&!$O(this.configurationService,this.titleBarStyle)&&(!Ze||Wt)&&this.currentMenubarVisibility!=="compact"&&this.installMenubar(),this.title=M(this.centerContent,_("div.window-title")),this.createTitle(),jO(this.configurationService,this.titleBarStyle)){let t=M(this.rightContent,_("div.center-adjacent-toolbar-container"));this.centerAdjacentToolBarDisposable.add(this.instantiationService.createInstance(or,t,D.TitleBarAdjacentCenter,{contextMenu:D.TitleBarContext,hiddenItemStrategy:-1,toolbarOptions:{primaryGroup:()=>!0},actionViewItemProvider:(o,n)=>Bs(this.instantiationService,o,n),hoverDelegate:this.hoverDelegate}))}if(jO(this.configurationService,this.titleBarStyle)&&(this.actionToolBarElement=M(this.rightContent,_("div.action-toolbar-container")),this.createActionToolBar(),this.createActionToolBarMenus()),!LC(this.configurationService,this.titleBarStyle)){let t=Ze?"left":"right";if(Ze&&Vr){let n=Jc.Locale(J2i).value.textInfo;n&&typeof n=="object"&&"direction"in n&&n.direction==="rtl"&&(t="right")}Ze&&Vr&&t==="left"||N4e(this.configurationService)==="hidden"||(this.windowControlsContainer=M(t==="left"?this.leftContent:this.rightContent,_("div.window-controls-container")),Wt&&M(t==="left"?this.rightContent:this.leftContent,_("div.window-controls-container")),zse()&&this.windowControlsContainer.classList.add("wco-enabled"))}return this._register(j(this.rootContainer,re.CONTEXT_MENU,t=>{Xt.stop(t);let o;Ze&&Do(t.target)&&ts(t.target,this.title)?o=D.TitleBarTitleContext:o=D.TitleBarContext,this.onContextMenu(t,o)})),Ze&&this._register(j(this.title,re.MOUSE_DOWN,t=>{t.metaKey&&(Xt.stop(t,!0),this.onContextMenu(t,D.TitleBarTitleContext))},!0)),this.updateStyles(),this.element}createTitle(){this.titleDisposables.clear();let e=LC(this.configurationService,this.titleBarStyle);if(!this.isCommandCenterVisible)e?vi(this.title):(this.title.textContent=this.windowTitle.value,this.titleDisposables.add(this.windowTitle.onDidChange(()=>{this.title.textContent=this.windowTitle.value,this.lastLayoutDimensions&&this.updateLayout(this.lastLayoutDimensions)})));else{let t=this.instantiationService.createInstance(nGe,this.windowTitle,this.hoverDelegate);vi(this.title,t.element),this.titleDisposables.add(t)}}actionViewItemProvider(e,t){if(!this.isAuxiliary){if(e.id===bH)return this.instantiationService.createInstance(wRe,{position:()=>2},t);if(e.id===SH)return this.instantiationService.createInstance(yRe,{position:()=>2},t)}let o=this.editorGroupsContainer.activeGroup?.activeEditorPane;if(o&&o instanceof Ts){let n=o.getActionViewItem(e,t);if(n)return n}return Bs(this.instantiationService,e,{...t,menuAsChild:!1})}getKeybinding(e){let t=this.editorGroupsContainer.activeGroup?.activeEditorPane?.scopedContextKeyService??this.contextKeyService;return this.keybindingService.lookupKeybinding(e.id,t)}createActionToolBar(){this.actionToolBarDisposable.clear(),this.actionToolBar=this.actionToolBarDisposable.add(this.instantiationService.createInstance(ol,this.actionToolBarElement,{contextMenu:D.TitleBarContext,orientation:0,ariaLabel:d(4524,null),getKeyBinding:e=>this.getKeybinding(e),overflowBehavior:{maxItems:9,exempted:[SH,bH,...RFt]},anchorAlignmentProvider:()=>1,telemetrySource:"titlePart",highlightToggledItems:this.editorActionsEnabled||this.isAuxiliary,actionViewItemProvider:(e,t)=>this.actionViewItemProvider(e,t),hoverDelegate:this.hoverDelegate})),this.editorActionsEnabled&&this.actionToolBarDisposable.add(this.editorGroupsContainer.onDidChangeActiveGroup(()=>this.createActionToolBarMenus({editorActions:!0})))}createActionToolBarMenus(e=!0){e===!0&&(e={editorActions:!0,layoutActions:!0,globalActions:!0,activityActions:!0});let t=()=>{let o={primary:[],secondary:[]};if(this.editorActionsEnabled){this.editorActionsChangeDisposable.clear();let n=this.editorGroupsContainer.activeGroup;if(n){let r=n.createEditorActions(this.editorActionsChangeDisposable,this.isAuxiliary&&this.isCompact?D.CompactWindowEditorTitle:D.EditorTitle);o.primary.push(...r.actions.primary),o.secondary.push(...r.actions.secondary),this.editorActionsChangeDisposable.add(r.onDidChange(()=>t()))}}this.layoutToolbarMenu&&_z(this.layoutToolbarMenu.getActions(),o,()=>!this.editorActionsEnabled||this.isCompact),this.globalToolbarMenu&&_z(this.globalToolbarMenu.getActions(),o),this.activityActionsEnabled&&(jJe(this.storageService)&&o.primary.push(nCo),o.primary.push(rCo)),this.actionToolBar.setActions(B_(o.primary),B_(o.secondary))};if(e.editorActions)if(this.editorToolbarMenuDisposables.clear(),this.editorActionsEnabled&&this.editorService.activeEditor!==void 0){let o={groupId:this.editorGroupsContainer.activeGroup.id};this.actionToolBar.actionRunner=this.editorToolbarMenuDisposables.add(new jpe(o)),this.actionToolBar.context=o}else this.actionToolBar.actionRunner=this.editorToolbarMenuDisposables.add(new rs),this.actionToolBar.context=void 0;e.layoutActions&&(this.layoutToolbarMenuDisposables.clear(),this.layoutControlEnabled?(this.layoutToolbarMenu=this.menuService.createMenu(D.LayoutControlMenu,this.contextKeyService),this.layoutToolbarMenuDisposables.add(this.layoutToolbarMenu),this.layoutToolbarMenuDisposables.add(this.layoutToolbarMenu.onDidChange(()=>t()))):this.layoutToolbarMenu=void 0),e.globalActions&&(this.globalToolbarMenuDisposables.clear(),this.globalActionsEnabled?(this.globalToolbarMenu=this.menuService.createMenu(D.TitleBar,this.contextKeyService),this.globalToolbarMenuDisposables.add(this.globalToolbarMenu),this.globalToolbarMenuDisposables.add(this.globalToolbarMenu.onDidChange(()=>t()))):this.globalToolbarMenu=void 0),e.activityActions&&(this.activityToolbarDisposables.clear(),this.activityActionsEnabled&&this.activityToolbarDisposables.add(this.storageService.onDidChangeValue(0,yH.ACCOUNTS_VISIBILITY_PREFERENCE_KEY,this._store)(()=>t()))),t()}updateStyles(){if(super.updateStyles(),this.element){this.isInactive?this.element.classList.add("inactive"):this.element.classList.remove("inactive");let e=this.getColor(this.isInactive?HZi:NX,(n,r)=>n.isOpaque()?n:n.makeOpaque(CF(r)))||"";this.element.style.backgroundColor=e,this.appIconBadge&&(this.appIconBadge.style.backgroundColor=e),e&&We.fromHex(e).isLighter()?this.element.classList.add("light"):this.element.classList.remove("light");let t=this.getColor(this.isInactive?pDt:wF);this.element.style.color=t||"";let o=this.getColor(mDt);this.element.style.borderBottom=o?`1px solid ${o}`:""}}onContextMenu(e,t){let o=new Cn(Re(this.element),e);this.contextMenuService.showContextMenu({getAnchor:()=>o,menuId:t,contextKeyService:this.contextKeyService,domForShadowRoot:Ze&&Vr?o.target:void 0})}get currentMenubarVisibility(){return this.isAuxiliary?"hidden":uR(this.configurationService)}get layoutControlEnabled(){return this.configurationService.getValue("workbench.layoutControl.enabled")!==!1}get isCommandCenterVisible(){return!this.isCompact&&this.configurationService.getValue("window.commandCenter")!==!1}get editorActionsEnabled(){return this.editorGroupsContainer.partOptions.editorActionsLocation==="titleBar"||this.editorGroupsContainer.partOptions.editorActionsLocation==="default"&&this.editorGroupsContainer.partOptions.showTabs==="none"}get activityActionsEnabled(){let e=this.configurationService.getValue("workbench.activityBar.location");return!this.isCompact&&!this.isAuxiliary&&(e==="top"||e==="bottom")}get globalActionsEnabled(){return!this.isCompact}get hasZoomableElements(){let e=!(this.currentMenubarVisibility==="hidden"||this.currentMenubarVisibility==="compact"||!Wt&&Ze),t=this.isCommandCenterVisible,o=this.globalActionsEnabled||this.layoutControlEnabled||this.editorActionsEnabled||this.activityActionsEnabled;return e||t||o}get preventZoom(){return Zv(Re(this.element))<1||!this.hasZoomableElements}layout(e,t){this.updateLayout(new si(e,t)),super.layoutContents(e,t)}updateLayout(e){if(this.lastLayoutDimensions=e,!jO(this.configurationService,this.titleBarStyle))return;let t=Zv(Re(this.element));if(this.element.style.setProperty("--zoom-factor",t.toString()),this.rootContainer.classList.toggle("counter-zoom",this.preventZoom),this.customMenubar.value){let n=new si(0,e.height);this.customMenubar.value.layout(n)}let o=this.isCommandCenterVisible||this.title.textContent!=="";this.rootContainer.classList.toggle("has-center",o)}focus(){this.customMenubar.value?this.customMenubar.value.toggleFocus():this.element.querySelector('[tabindex]:not([tabindex="-1"])')?.focus()}toJSON(){return{type:"workbench.parts.titlebar"}}dispose(){this._onWillDispose.fire(),super.dispose()}};lse=I([m(3,Xe),m(4,B),m(5,cd),m(6,F),m(7,Le),m(8,ce),m(9,yi),m(10,X),m(11,Zt),m(12,ee),m(13,Kt),m(14,_e)],lse);var apt=class extends lse{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g){super("workbench.parts.titlebar",ut,u.mainPart,i,e,t,o,n,r,s,l,c,p,h,g)}};apt=I([m(0,Xe),m(1,B),m(2,cd),m(3,F),m(4,Le),m(5,ce),m(6,yi),m(7,X),m(8,Zt),m(9,wt),m(10,ee),m(11,Kt),m(12,_e)],apt);var cSe=class extends lse{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){let y=cSe.COUNTER++;super(`workbench.parts.auxiliaryTitle.${y}`,Re(e),t,n,r,s,l,c,u,p,h,g,v,b,S);this.container=e;this.mainTitlebar=o}static{this.COUNTER=1}get height(){return this.minimumHeight}get preventZoom(){return Zv(Re(this.element))<1||!this.mainTitlebar.hasZoomableElements}};cSe=I([m(3,Xe),m(4,B),m(5,cd),m(6,F),m(7,Le),m(8,ce),m(9,yi),m(10,X),m(11,Zt),m(12,wt),m(13,ee),m(14,Kt),m(15,_e)],cSe);var sGe=class extends $Je{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super(e,t,o,n,r,s,l,c,u,p,h,g,v,S);this.menubarService=f;this.nativeHostService=b;(async()=>(this.recentlyOpened=await this.workspacesService.getRecentlyOpened(),this.doUpdateMenubar()))(),this.registerListeners()}setupMainMenu(){super.setupMainMenu();for(let e of Object.keys(this.topLevelTitles)){let t=this.menus[e];t&&this.mainMenuDisposables.add(t.onDidChange(()=>this.updateMenubar()))}}doUpdateMenubar(){if(!this.hostService.hasFocus)return;let e={menus:{},keybindings:{}};this.getMenubarMenus(e)&&this.menubarService.updateMenubar(this.nativeHostService.windowId,e)}getMenubarMenus(e){if(!e)return!1;e.keybindings=this.getAdditionalKeybindings();for(let t of Object.keys(this.topLevelTitles)){let o=this.menus[t];if(o){let n={items:[]},r=tu(o.getActions({shouldForwardArgs:!0}));if(this.populateMenuItems(r,n,e.keybindings),n.items.length===0)return!1;e.menus[t]=n}}return!0}populateMenuItems(e,t,o){for(let n of e)if(n instanceof ri)t.items.push({id:"vscode.menubar.separator"});else if(n instanceof Lo||n instanceof Nc){let r=typeof n.item.title=="string"?n.item.title:n.item.title.mnemonicTitle??n.item.title.value;if(n instanceof Nc){let s={items:[]};if(this.populateMenuItems(n.actions,s,o),s.items.length>0){let l={id:n.id,label:r,submenu:s};t.items.push(l)}}else{if(n.id===v0.ID){let l=this.getOpenRecentActions().map(this.transformOpenRecentAction);t.items.push(...l)}let s={id:n.id,label:r};zCe(n.item.toggled)&&(s.label=n.item.toggled.mnemonicTitle??n.item.toggled.title??r),n.checked&&(s.checked=!0),n.enabled||(s.enabled=!1),o[n.id]=this.getMenubarKeybinding(n.id),t.items.push(s)}}}transformOpenRecentAction(e){return e instanceof ri?{id:"vscode.menubar.separator"}:{id:e.id,uri:e.uri,remoteAuthority:e.remoteAuthority,enabled:e.enabled,label:e.label}}getAdditionalKeybindings(){let e={};if(Ze){let t=this.getMenubarKeybinding("workbench.action.quit");t&&(e["workbench.action.quit"]=t)}return e}getMenubarKeybinding(e){let t=this.keybindingService.lookupKeybinding(e);if(!t)return;let o=t.getElectronAccelerator();if(o)return{label:o,userSettingsLabel:t.getUserSettingsLabel()??void 0};let n=t.getLabel();if(n)return{label:n,isNative:!1,userSettingsLabel:t.getUserSettingsLabel()??void 0}}};sGe=I([m(0,Kt),m(1,jp),m(2,X),m(3,_e),m(4,B),m(5,rt),m(6,zd),m(7,ce),m(8,Ne),m(9,Go),m(10,zr),m(11,Oi),m(12,k7t),m(13,Zt),m(14,ko),m(15,ge)],sGe);var aGe=class extends lse{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super(e,t,o,n,r,s,l,c,u,p,h,g,b,S,y);this.nativeHostService=f;this.tahoeOrNewer=kht(s.os.release),this.handleWindowsAlwaysOnTop(t.vscodeWindowId)}get minimumHeight(){return Ze?(this.isCommandCenterVisible?kY:this.macTitlebarSize)/(this.preventZoom?Zv(Re(this.element)):1):super.minimumHeight}get maximumHeight(){return this.minimumHeight}get macTitlebarSize(){return this.tahoeOrNewer?32:28}async handleWindowsAlwaysOnTop(e){let t=E6e.bindTo(this.contextKeyService);this._register(this.nativeHostService.onDidChangeWindowAlwaysOnTop(({windowId:o,alwaysOnTop:n})=>{o===e&&t.set(n)})),t.set(await this.nativeHostService.isWindowAlwaysOnTop({targetWindowId:e}))}onMenubarVisibilityChanged(e){(ei||fn)&&this.currentMenubarVisibility==="toggle"&&e&&this.dragRegion&&(vo(this.dragRegion),setTimeout(()=>un(this.dragRegion),50)),super.onMenubarVisibilityChanged(e)}onConfigurationChanged(e){super.onConfigurationChanged(e),e.affectsConfiguration("window.doubleClickIconToClose")&&this.appIcon&&this.onUpdateAppIconDragBehavior()}onUpdateAppIconDragBehavior(){this.configurationService.getValue("window.doubleClickIconToClose")&&this.appIcon?this.appIcon.style["-webkit-app-region"]="no-drag":this.appIcon&&(this.appIcon.style["-webkit-app-region"]="drag")}installMenubar(){super.installMenubar(),!this.menubar&&this.customMenubar.value&&this._register(this.customMenubar.value.onFocusStateChange(e=>this.onMenubarFocusChanged(e)))}onMenubarFocusChanged(e){(ei||fn)&&this.currentMenubarVisibility!=="compact"&&this.dragRegion&&(e?vo(this.dragRegion):un(this.dragRegion))}createContentArea(e){let t=super.createContentArea(e),o=Re(e),n=gv(o);if((Ze||$O(this.configurationService))&&this._register(this.instantiationService.createInstance(sGe)),this.appIcon&&(this.onUpdateAppIconDragBehavior(),this._register(j(this.appIcon,re.DBLCLICK,(()=>{this.nativeHostService.closeWindow({targetWindowId:n})})))),!LC(this.configurationService)&&!YCe(this.configurationService)&&this.windowControlsContainer){let r=M(this.windowControlsContainer,_("div.window-icon.window-minimize"+q.asCSSSelector(R.chromeMinimize)));this._register(j(r,re.CLICK,()=>{this.nativeHostService.minimizeWindow({targetWindowId:n})})),this.maxRestoreControl=M(this.windowControlsContainer,_("div.window-icon.window-max-restore")),this._register(j(this.maxRestoreControl,re.CLICK,async()=>await this.nativeHostService.isMaximized({targetWindowId:n})?this.nativeHostService.unmaximizeWindow({targetWindowId:n}):this.nativeHostService.maximizeWindow({targetWindowId:n})));let s=M(this.windowControlsContainer,_("div.window-icon.window-close"+q.asCSSSelector(R.chromeClose)));this._register(j(s,re.CLICK,()=>{this.nativeHostService.closeWindow({targetWindowId:n})})),this.resizer=M(this.rootContainer,_("div.resizer")),this._register(U.runAndSubscribe(this.layoutService.onDidChangeWindowMaximized,({windowId:l,maximized:c})=>{l===n&&this.onDidChangeWindowMaximized(c)},{windowId:n,maximized:this.layoutService.isWindowMaximized(o)}))}return ei&&!LC(this.configurationService)&&this._register(this.nativeHostService.onDidTriggerWindowSystemContextMenu(({windowId:r,x:s,y:l})=>{if(n!==r)return;let c=Zv(Re(this.element));this.onContextMenu(new MouseEvent(re.MOUSE_UP,{clientX:s/c,clientY:l/c}),D.TitleBarContext)})),t}onDidChangeWindowMaximized(e){this.maxRestoreControl&&(e?(this.maxRestoreControl.classList.remove(...q.asClassNameArray(R.chromeMaximize)),this.maxRestoreControl.classList.add(...q.asClassNameArray(R.chromeRestore))):(this.maxRestoreControl.classList.remove(...q.asClassNameArray(R.chromeRestore)),this.maxRestoreControl.classList.add(...q.asClassNameArray(R.chromeMaximize)))),this.resizer&&(e?vo(this.resizer):un(this.resizer))}updateStyles(){super.updateStyles(),this.element&&YCe(this.configurationService)&&(!this.cachedWindowControlStyles||this.cachedWindowControlStyles.bgColor!==this.element.style.backgroundColor||this.cachedWindowControlStyles.fgColor!==this.element.style.color)&&this.nativeHostService.updateWindowControls({targetWindowId:gv(Re(this.element)),backgroundColor:this.element.style.backgroundColor,foregroundColor:this.element.style.color})}layout(e,t){if(super.layout(e,t),YCe(this.configurationService)){let o=Math.round(t*Zv(Re(this.element)));o!==this.cachedWindowControlHeight&&(this.cachedWindowControlHeight=o,this.nativeHostService.updateWindowControls({targetWindowId:gv(Re(this.element)),height:o}))}}};aGe=I([m(3,Xe),m(4,B),m(5,zr),m(6,F),m(7,Le),m(8,ce),m(9,yi),m(10,X),m(11,Zt),m(12,ko),m(13,wt),m(14,ee),m(15,Kt),m(16,_e)],aGe);var lpt=class extends aGe{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f){super("workbench.parts.titlebar",ut,p.mainPart,i,e,t,o,n,r,s,l,c,u,p,h,g,f)}};lpt=I([m(0,Xe),m(1,B),m(2,zr),m(3,F),m(4,Le),m(5,ce),m(6,yi),m(7,X),m(8,Zt),m(9,ko),m(10,wt),m(11,ee),m(12,Kt),m(13,_e)],lpt);var dSe=class extends aGe{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){let w=dSe.COUNTER++;super(`workbench.parts.auxiliaryTitle.${w}`,Re(e),t,n,r,s,l,c,u,p,h,g,f,v,b,S,y);this.container=e;this.mainTitlebar=o}static{this.COUNTER=1}get height(){return this.minimumHeight}get preventZoom(){return Zv(Re(this.element))<1||!this.mainTitlebar.hasZoomableElements}};dSe=I([m(3,Xe),m(4,B),m(5,zr),m(6,F),m(7,Le),m(8,ce),m(9,yi),m(10,X),m(11,Zt),m(12,ko),m(13,wt),m(14,ee),m(15,Kt),m(16,_e)],dSe);var D7t=class extends rGe{createMainTitlebarPart(){return this.instantiationService.createInstance(lpt)}doCreateAuxiliaryTitlebarPart(i,e,t){return t.createInstance(dSe,i,e,this.mainPart)}};Ee(T0,D7t,0);var lGe=class{constructor(i,e){this.windowId=i;return Tc.toService(e.getChannel("nativeHost"),{context:i,properties:(()=>{let t=new Map;return t.set("windowId",i),t})()})}};lGe=I([m(1,pu)],lGe);async function QPo(a,i,e){let t=await tyn(i.title,{detail:i.body,sticky:!i.silent});if(!t)return{supported:!1,clicked:!1};let o=new N;a.onDidCreateToast(t);let n=new Ye(e);return o.add(Z(()=>{a.onDidDisposeToast(t),t.dispose(),n.dispose(!0)})),new Promise(r=>{let s=l=>{r(l),o.dispose()};o.add(n.token.onCancellationRequested(()=>s({supported:!0,clicked:!1}))),U.once(t.onClick)(()=>s({supported:!0,clicked:!0})),U.once(t.onClose)(()=>s({supported:!0,clicked:!1})),U.once(t.onError)(()=>s({supported:!1,clicked:!1}))})}async function tyn(a,i){if(await Notification.requestPermission()!=="granted")return;let t=new N,o=new Notification(a,{body:i?.detail,requireInteraction:i?.sticky}),n=t.add(new E),r=t.add(new E),s=t.add(new E);return t.add(j(o,"click",()=>n.fire())),t.add(j(o,"close",()=>r.fire())),t.add(j(o,"error",()=>s.fire())),t.add(Z(()=>o.close())),{onClick:n.event,onClose:r.event,onError:s.event,dispose:()=>t.dispose()}}var cpt=class extends lGe{constructor(i,e){super(i.window.id,e)}};cpt=I([m(0,zr),m(1,pu)],cpt);var cGe=class extends x{constructor(e,t,o){super();this.nativeHostService=e;this.labelService=t;this.environmentService=o;this._nativeWindowHandleCache=new Map;this.activeBrowserToasts=this._register(new BSe);this.onDidChangeFocus=U.latch(U.any(U.map(U.filter(this.nativeHostService.onDidFocusMainOrAuxiliaryWindow,n=>j9(n),this._store),()=>this.hasFocus,this._store),U.map(U.filter(this.nativeHostService.onDidBlurMainOrAuxiliaryWindow,n=>j9(n),this._store),()=>this.hasFocus,this._store),U.map(this.onDidChangeActiveWindow,()=>this.hasFocus,this._store)),void 0,this._store),this.onDidChangeFullScreen=U.filter(this.nativeHostService.onDidChangeWindowFullScreen,n=>j9(n.windowId),this._store),this.registerListeners()}registerListeners(){this._register(this.onDidChangeFocus(e=>{e&&this.clearToasts()}))}get hasFocus(){return sm().hasFocus()}async hadLastFocus(){let e=await this.nativeHostService.getActiveWindowId();return typeof e>"u"?!1:e===this.nativeHostService.windowId}get onDidChangeActiveWindow(){let e=this._register(new E);return this._register(U.filter(this.nativeHostService.onDidFocusMainOrAuxiliaryWindow,t=>j9(t),this._store)(t=>e.fire(t))),this._register(nf(({window:t,disposables:o})=>{o.add(zI(t,()=>{let n=t.document.hasFocus();return n&&e.fire(t.vscodeWindowId),n},100,20))})),U.latch(e.event,void 0,this._store)}openWindow(e,t){return Array.isArray(e)?this.doOpenWindow(e,t):this.doOpenEmptyWindow(e)}doOpenWindow(e,t){let o=this.environmentService.remoteAuthority;return o&&(e.forEach(n=>n.label=n.label||this.getRecentLabel(n)),t?.remoteAuthority===void 0&&(t=t?{...t,remoteAuthority:o}:{remoteAuthority:o})),this.nativeHostService.openWindow(e,t)}getRecentLabel(e){return j6i(e)?this.labelService.getWorkspaceLabel(e.folderUri,{verbose:2}):QCe(e)?this.labelService.getWorkspaceLabel({id:"",configPath:e.workspaceUri},{verbose:2}):this.labelService.getUriLabel(e.fileUri,{appendWorkspaceSuffix:!0})}doOpenEmptyWindow(e){let t=this.environmentService.remoteAuthority;return t&&e?.remoteAuthority===void 0&&(e=e?{...e,remoteAuthority:t}:{remoteAuthority:t}),this.nativeHostService.openWindow(e)}toggleFullScreen(e){return this.nativeHostService.toggleFullScreen({targetWindowId:zy(e)?e.vscodeWindowId:void 0})}async moveTop(e){if(!(_Ie()<=1))return this.nativeHostService.moveWindowTop(zy(e)?{targetWindowId:e.vscodeWindowId}:void 0)}async setWindowDimmed(e,t){return this.nativeHostService.updateWindowControls({dimmed:t,targetWindowId:gv(e)})}getCursorScreenPoint(){return this.nativeHostService.getCursorScreenPoint()}getWindows(e){return e.includeAuxiliaryWindows===!1?this.nativeHostService.getWindows({includeAuxiliaryWindows:!1}):this.nativeHostService.getWindows({includeAuxiliaryWindows:!0})}focus(e,t){return this.nativeHostService.focusWindow({mode:t?.mode,targetWindowId:gv(e)})}restart(){return this.nativeHostService.relaunch()}reload(e){return this.nativeHostService.reload(e)}close(){return this.nativeHostService.closeWindow()}async withExpectedShutdown(e){return await e()}getScreenshot(e){return this.nativeHostService.getScreenshot(e)}async getNativeWindowHandle(e){return this._nativeWindowHandleCache.has(e)||this._nativeWindowHandleCache.set(e,this.nativeHostService.getNativeWindowHandle(e)),this._nativeWindowHandleCache.get(e)}async showToast(e,t){let o=xt(),n=t.onCancellationRequested(()=>this.nativeHostService.clearToast(o));try{let r=await this.nativeHostService.showToast({...e,id:o});return r.supported?r:await QPo({onDidCreateToast:s=>this.activeBrowserToasts.add(s),onDidDisposeToast:s=>this.activeBrowserToasts.deleteAndDispose(s)},e,t)}finally{n.dispose()}}async clearToasts(){await this.nativeHostService.clearToasts(),this.activeBrowserToasts.clearAndDisposeAll()}};I([hi],cGe.prototype,"onDidChangeActiveWindow",1),cGe=I([m(0,ko),m(1,rt),m(2,At)],cGe);Ee(Zt,cGe,1);Ee(ko,cpt,1);var YPo="meteredConnection";var dpt=class extends fOt{constructor(i,e){super(i,sIi()),this._channel=e.getChannel(YPo);let t=navigator.connection;if(t){let o=()=>this.setIsBrowserConnectionMetered(sIi());t.addEventListener("change",o),this._register(Z(()=>t.removeEventListener("change",o)))}}onChangeBrowserConnection(){super.onChangeBrowserConnection(),this._channel.call("SetIsBrowserConnectionMetered",this.isBrowserConnectionMetered)}};dpt=I([m(0,B),m(1,pu)],dpt);Ee(k2,dpt,1);async function XPo(a,i,e){if(i.isCancellationRequested)throw PI();let t=new AbortController,o=i.onCancellationRequested(()=>t.abort()),n=a.timeout?AbortSignal.any([t.signal,AbortSignal.timeout(a.timeout)]):t.signal;try{let r={method:a.type||"GET",headers:iyn(a),body:a.data,signal:n};a.disableCache&&(r.cache="no-store");let s=await fetch(a.url||"",r);return{res:{statusCode:s.status,headers:oyn(s)},stream:v_(qe.wrap(new Uint8Array(await s.arrayBuffer())))}}catch(r){throw e&&!e()?new LZe:r?.name==="AbortError"?PI():r?.name==="TimeoutError"?new Error(`Fetch timeout: ${a.timeout}ms`):r}finally{o.dispose()}}function iyn(a){if(a.headers||a.user||a.password||a.proxyAuthorization){let i=new Headers;e:for(let e in a.headers){switch(e.toLowerCase()){case"user-agent":case"accept-encoding":case"content-length":continue e}let t=a.headers[e];if(typeof t=="string")i.set(e,t);else if(Array.isArray(t))for(let o of t)i.append(e,o)}return(a.user||a.password)&&i.set("Authorization","Basic "+btoa(`${a.user||""}:${a.password||""}`)),a.proxyAuthorization&&i.set("Proxy-Authorization",a.proxyAuthorization),i}}function oyn(a){let i=Object.create(null);return a.headers.forEach((e,t)=>{i[t]?Array.isArray(i[t])?i[t].push(e):i[t]=[i[t],e]:i[t]=e}),i}var upt=class extends DDt{constructor(e,t,o){let n=o.createLogger("network",{name:d(17945,null),group:oM}),r=new rse(n);super(r);this.nativeHostService=e;this.configurationService=t;this._register(n),this._register(r)}async request(e,t){return e.proxyAuthorization||(e.proxyAuthorization=this.configurationService.inspect("http.proxyAuthorization").userLocalValue),this.logAndRequest(e,()=>XPo(e,t,()=>navigator.onLine))}async resolveProxy(e){return this.nativeHostService.resolveProxy(e)}async lookupAuthorization(e){return this.nativeHostService.lookupAuthorization(e)}async lookupKerberosAuthorization(e){return this.nativeHostService.lookupKerberosAuthorization(e)}async loadCertificates(){return this.nativeHostService.loadCertificates()}};upt=I([m(0,ko),m(1,B),m(2,Il)],upt);Ee(Ea,upt,1);var s9=class{constructor(i,e){this.nativeHostService=i;this.logService=e}static{this.FILE_FORMAT="code/file-list"}async triggerPaste(i){return this.logService.trace("NativeClipboardService#triggerPaste called"),this.nativeHostService.triggerPaste({targetWindowId:i})}async readImage(){return this.nativeHostService.readImage()}async writeText(i,e){return this.logService.trace("NativeClipboardService#writeText called with type:",e," with text.length:",i.length),this.nativeHostService.writeClipboardText(i,e)}async readText(i){return this.logService.trace("NativeClipboardService#readText called with type:",i),this.nativeHostService.readClipboardText(i)}async readFindText(){return Ze?this.nativeHostService.readClipboardFindText():""}async writeFindText(i){if(Ze)return this.nativeHostService.writeClipboardFindText(i)}async writeResources(i){if(i.length)return this.nativeHostService.writeClipboardBuffer(s9.FILE_FORMAT,this.resourcesToBuffer(i))}async readResources(){return this.bufferToResources(await this.nativeHostService.readClipboardBuffer(s9.FILE_FORMAT))}async hasResources(){return this.nativeHostService.hasClipboard(s9.FILE_FORMAT)}resourcesToBuffer(i){return qe.fromString(i.map(e=>e.toString()).join(`
`))}bufferToResources(i){if(!i)return[];let e=i.toString();if(!e)return[];try{return e.split(`
`).map(t=>A.parse(t))}catch{return[]}}};s9=I([m(0,ko),m(1,se)],s9);Ee(Fi,s9,1);var JPo="vscode:contextmenu",ZPo="vscode:onCloseContextMenu";var nyn=0;function eAo(a,i,e){let t=[],o=nyn++,n=`vscode:onContextMenu${o}`,r=(s,...l)=>{let c=l[0],u=l[1];t[c].click?.(u)};tl.once(n,r),tl.once(ZPo,(s,...l)=>{l[0]===o&&(tl.removeListener(n,r),e?.())}),tl.send(JPo,o,a.map(s=>tAo(s,t)),n,i)}function tAo(a,i){let e={id:i.length,label:a.label,type:a.type,accelerator:a.accelerator,checked:a.checked,enabled:typeof a.enabled=="boolean"?a.enabled:!0,visible:typeof a.visible=="boolean"?a.visible:!0};return i.push(a),Array.isArray(a.submenu)&&(e.submenu=a.submenu.map(t=>tAo(t,i))),e}var L7t=class{constructor(i,e,t,o){this.contextViewService=i;this.telemetryService=e;this.notificationService=t;this.keybindingService=o;this.focusToReturn=null;this.lastContainer=null;this.block=null;this.blockDisposable=null;this.options={blockMouse:!0}}configure(i){this.options=i}showContextMenu(i){let e=i.getActions();if(!e.length)return;this.focusToReturn=Nn();let t,o=Do(i.domForShadowRoot)?i.domForShadowRoot:void 0;this.contextViewService.showContextView({getAnchor:()=>i.getAnchor(),canRelayout:!1,anchorAlignment:i.anchorAlignment,anchorAxisAlignment:i.anchorAxisAlignment,layer:i.layer,render:n=>{this.lastContainer=n;let r=i.getMenuClassName?i.getMenuClassName():"";r&&(n.className+=" "+r),this.options.blockMouse&&(this.block=n.appendChild(_(".context-view-block")),this.block.style.position="fixed",this.block.style.cursor="initial",this.block.style.left="0",this.block.style.top="0",this.block.style.width="100%",this.block.style.height="100%",this.block.style.zIndex="-1",this.blockDisposable?.dispose(),this.blockDisposable=j(this.block,re.MOUSE_DOWN,u=>u.stopPropagation()));let s=new N,l=i.actionRunner||s.add(new rs);l.onWillRun(u=>this.onActionRun(u,!i.skipTelemetry),this,s),l.onDidRun(this.onDidActionRun,this,s),t=new A3(n,e,{actionViewItemProvider:i.getActionViewItem,context:i.getActionsContext?i.getActionsContext():null,actionRunner:l,getKeyBinding:i.getKeyBinding?i.getKeyBinding:u=>this.keybindingService.lookupKeybinding(u.id)},mwt),t.onDidCancel(()=>this.contextViewService.hideContextView(!0),null,s),t.onDidBlur(()=>this.contextViewService.hideContextView(!0),null,s);let c=Re(n);return s.add(j(c,re.BLUR,()=>this.contextViewService.hideContextView(!0))),s.add(j(c,re.MOUSE_DOWN,u=>{if(u.defaultPrevented)return;let p=new Cn(c,u),h=p.target;if(!p.rightButton){for(;h;){if(h===n)return;h=h.parentElement}this.contextViewService.hideContextView(!0)}})),wn(s,t)},focus:()=>{t?.focus(!!i.autoSelectFirstItem)},onHide:n=>{i.onHide?.(!!n),this.block&&(this.block.remove(),this.block=null),this.blockDisposable?.dispose(),this.blockDisposable=null,this.lastContainer&&(Nn()===this.lastContainer||ts(Nn(),this.lastContainer))&&this.focusToReturn?.focus(),this.lastContainer=null}},o,!!o)}onActionRun(i,e){e&&this.telemetryService.publicLog2("workbenchActionExecuted",{id:i.action.id,from:"contextMenu"}),this.contextViewService.hideContextView(!1)}onDidActionRun(i){i.error&&!ao(i.error)&&this.notificationService.error(i.error)}};var dGe=class extends x{constructor(e,t,o,n,r,s){super();this.telemetryService=e;this.notificationService=t;this.contextViewService=o;this.keybindingService=n;this.menuService=r;this.contextKeyService=s;this._contextMenuHandler=void 0;this._onDidShowContextMenu=this._store.add(new E);this.onDidShowContextMenu=this._onDidShowContextMenu.event;this._onDidHideContextMenu=this._store.add(new E);this.onDidHideContextMenu=this._onDidHideContextMenu.event}get contextMenuHandler(){return this._contextMenuHandler||(this._contextMenuHandler=new L7t(this.contextViewService,this.telemetryService,this.notificationService,this.keybindingService)),this._contextMenuHandler}configure(e){this.contextMenuHandler.configure(e)}showContextMenu(e){e=R7t.transform(e,this.menuService,this.contextKeyService),this.contextMenuHandler.showContextMenu({...e,onHide:t=>{e.onHide?.(t),this._onDidHideContextMenu.fire()}}),nb.getInstance().resetKeyStatus(),this._onDidShowContextMenu.fire()}};dGe=I([m(0,Te),m(1,Ne),m(2,Wn),m(3,_e),m(4,Kt),m(5,X)],dGe);var R7t;(e=>{function a(t){return t&&t.menuId instanceof D}function i(t,o,n){if(!a(t))return t;let{menuId:r,menuActionOptions:s,contextKeyService:l}=t;return{...t,getActions:()=>{let c=[];if(r){let u=o.getMenuActions(r,l??n,s);c=tu(u)}return t.getActions?ri.join(t.getActions(),c):c}}}e.transform=i})(R7t||={});var ppt=class{get onDidShowContextMenu(){return this.impl.onDidShowContextMenu}get onDidHideContextMenu(){return this.impl.onDidHideContextMenu}constructor(i,e,t,o,n,r,s){function l(u){return u?new mpt(i,e,t,r,s):new dGe(e,i,n,t,r,s)}let c=oI(o);this.impl=l(c),Ze&&(this.listener=o.onDidChangeConfiguration(u=>{if(!u.affectsConfiguration("window.menuStyle"))return;let p=oI(o);p!==c&&(this.impl.dispose(),this.impl=l(p),c=p)}))}dispose(){this.listener?.dispose(),this.impl.dispose()}showContextMenu(i){this.impl.showContextMenu(i)}};ppt=I([m(0,Ne),m(1,Te),m(2,_e),m(3,B),m(4,Wn),m(5,Kt),m(6,X)],ppt);var mpt=class extends x{constructor(e,t,o,n,r){super();this.notificationService=e;this.telemetryService=t;this.keybindingService=o;this.menuService=n;this.contextKeyService=r;this._onDidShowContextMenu=this._store.add(new E);this.onDidShowContextMenu=this._onDidShowContextMenu.event;this._onDidHideContextMenu=this._store.add(new E);this.onDidHideContextMenu=this._onDidHideContextMenu.event}showContextMenu(e){e=R7t.transform(e,this.menuService,this.contextKeyService);let t=e.getActions();if(t.length){let o=$c(()=>{e.onHide?.(!1),nb.getInstance().resetKeyStatus(),this._onDidHideContextMenu.fire()}),n=this.createMenu(e,t,o),r=e.getAnchor(),s,l,c=Zv(Do(r)?Re(r):Ki());if(Do(r)){let u=r.getBoundingClientRect(),p={left:u.left,top:u.top,width:u.width,height:u.height},h=Re(r),g=h.innerWidth,f=h.innerHeight,v=u.left<0||u.top<0||u.right>g||u.bottom>f;c*=Y9(r),v?(s=Math.min(Math.max(u.right,0),g),l=Math.min(Math.max(u.bottom,0),f)):e.anchorAxisAlignment===1?(e.anchorAlignment===0?(s=p.left,l=p.top):(s=p.left+p.width,l=p.top),Ze||Re(r).screen.height-l<t.length*(ei?45:32)&&(l+=p.height)):e.anchorAlignment===0?(s=p.left,l=p.top+p.height):(s=p.left+p.width,l=p.top+p.height),Ze&&(l+=4/c)}else Iri(r)&&(s=r.x,l=r.y);typeof s=="number"&&(s=Math.floor(s*c)),typeof l=="number"&&(l=Math.floor(l*c)),eAo(n,{x:s,y:l,positioningItem:e.autoSelectFirstItem?0:void 0},()=>o()),this._onDidShowContextMenu.fire()}}createMenu(e,t,o,n=new Set){return di(t.map(r=>this.createMenuItem(e,r,o,n)))}createMenuItem(e,t,o,n){if(t instanceof ri)return{type:"separator"};if(t instanceof Fs){if(n.has(t.id)){console.warn(`Found submenu cycle: ${t.id}`);return}return{label:o5e(Nu(t.label)).trim(),submenu:this.createMenu(e,t.actions,o,new Set([...n,t.id]))}}else{let r;t.checked&&(typeof e.getCheckedActionsRepresentation=="function"?r=e.getCheckedActionsRepresentation(t):r="checkbox");let s={label:o5e(Nu(t.label)).trim(),checked:!!t.checked,type:r,enabled:!!t.enabled,click:c=>{o(),this.runAction(t,e,c)}},l=e.getKeyBinding?e.getKeyBinding(t):this.keybindingService.lookupKeybinding(t.id);if(l){let c=l.getElectronAccelerator();if(c)s.accelerator=c;else{let u=l.getLabel();u&&(s.label=`${s.label} [${u}]`)}}return s}}async runAction(e,t,o){t.skipTelemetry||this.telemetryService.publicLog2("workbenchActionExecuted",{id:e.id,from:"contextMenu"});let n=t.getActionsContext?t.getActionsContext(o):void 0;try{t.actionRunner?await t.actionRunner.run(e,n):e.enabled&&await e.run(n)}catch(r){this.notificationService.error(r)}}};mpt=I([m(0,Ne),m(1,Te),m(2,_e),m(3,Kt),m(4,X)],mpt);Ee(Xe,ppt,1);var izi=class{constructor(i,e){this.oldWorkspace=i;this.newWorkspace=e;this.promises=[]}join(i){this.promises.push(i)}async wait(){await dn.settled(this.promises)}},uGe=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super();this.jsonEditingService=e;this.contextService=t;this.configurationService=o;this.notificationService=n;this.commandService=r;this.fileService=s;this.textFileService=l;this.workspacesService=c;this.environmentService=u;this.fileDialogService=p;this.dialogService=h;this.hostService=g;this.uriIdentityService=f;this.workspaceTrustManagementService=v;this.userDataProfilesService=b;this.userDataProfileService=S;this.logService=y;this._onDidEnterWorkspace=this._register(new E);this.onDidEnterWorkspace=this._onDidEnterWorkspace.event}async pickNewWorkspacePath(){let e=[Q.file];this.environmentService.remoteAuthority&&e.unshift(Q.vscodeRemote);let t=await this.fileDialogService.showSaveDialog({saveLabel:d(18379,null),title:d(18380,null),filters:V6i,defaultUri:Ge(await this.fileDialogService.defaultWorkspacePath(),this.getNewWorkspaceName()),availableFileSystems:e});if(t)return GO(t)||(t=t.with({path:`${t.path}.${FE}`})),t}getNewWorkspaceName(){let e=this.getCurrentWorkspaceIdentifier()?.configPath;if(e&&rce(e,this.environmentService))return He(e);let t=this.contextService.getWorkspace().folders.at(0);return t?`${He(t.uri)}.${FE}`:`workspace.${FE}`}async updateFolders(e,t,o,n){let r=this.contextService.getWorkspace().folders,s=[];typeof t=="number"&&(s=r.slice(e,e+t).map(p=>p.uri));let l=[];Array.isArray(o)&&(l=o.map(p=>({uri:iae(p.uri),name:p.name})));let c=s.length>0,u=l.length>0;if(!(!u&&!c))return u&&!c?this.doAddFolders(l,e,n):c&&!u?this.removeFolders(s):this.includesSingleFolderWorkspace(s)?this.createAndEnterWorkspace(l):this.contextService.getWorkbenchState()!==3?this.doAddFolders(l,e,n):this.doUpdateFolders(l,s,e,n)}async doUpdateFolders(e,t,o,n=!1){try{await this.contextService.updateFolders(e,t,o)}catch(r){if(n)throw r;this.handleWorkspaceConfigurationEditingError(r)}}addFolders(e,t=!1){let o=e.map(n=>({uri:iae(n.uri),name:n.name}));return this.doAddFolders(o,void 0,t)}async doAddFolders(e,t,o=!1){let n=this.contextService.getWorkbenchState(),r=this.environmentService.remoteAuthority;if(r&&(e=e.filter(s=>s.uri.scheme!==Q.file&&(s.uri.scheme!==Q.vscodeRemote||gV(s.uri.authority,r)))),n!==3){let s=this.contextService.getWorkspace().folders.map(l=>({uri:l.uri}));return s.splice(typeof t=="number"?t:s.length,0,...e),s=zo(s,l=>this.uriIdentityService.extUri.getComparisonKey(l.uri)),n===1&&s.length===0||n===2&&s.length===1?void 0:this.createAndEnterWorkspace(s)}try{await this.contextService.addFolders(e,t)}catch(s){if(o)throw s;this.handleWorkspaceConfigurationEditingError(s)}}async removeFolders(e,t=!1){if(this.includesSingleFolderWorkspace(e))return this.createAndEnterWorkspace([]);try{await this.contextService.removeFolders(e)}catch(o){if(t)throw o;this.handleWorkspaceConfigurationEditingError(o)}}includesSingleFolderWorkspace(e){if(this.contextService.getWorkbenchState()===2){let t=this.contextService.getWorkspace().folders[0];return e.some(o=>this.uriIdentityService.extUri.isEqual(o,t.uri))}return!1}async createAndEnterWorkspace(e,t){if(t&&!await this.isValidTargetWorkspacePath(t))return;let o=this.environmentService.remoteAuthority,n=await this.workspacesService.createUntitledWorkspace(e,o);if(t)try{await this.saveWorkspaceAs(n,t)}finally{await this.workspacesService.deleteUntitledWorkspace(n)}else t=n.configPath,this.userDataProfileService.currentProfile.isDefault||await this.userDataProfilesService.setProfileForWorkspace(n,this.userDataProfileService.currentProfile);return this.enterWorkspace(t)}async saveAndEnterWorkspace(e){let t=this.getCurrentWorkspaceIdentifier();if(t){if(Qe(t.configPath,e))return this.saveWorkspace(t);if(await this.isValidTargetWorkspacePath(e))return await this.saveWorkspaceAs(t,e),this.enterWorkspace(e)}}async isValidTargetWorkspacePath(e){return!0}async saveWorkspaceAs(e,t){let o=e.configPath;if(!dR(t,this.environmentService)&&!this.userDataProfileService.currentProfile.isDefault){let c=await this.workspacesService.getWorkspaceIdentifier(t);await this.userDataProfilesService.setProfileForWorkspace(c,this.userDataProfileService.currentProfile)}if(this.uriIdentityService.extUri.isEqual(o,t))return;let r=dR(o,this.environmentService),s=await this.fileService.readFile(o),l=Wbi(s.value.toString(),o,r,t,this.uriIdentityService.extUri);await this.textFileService.create([{resource:t,value:l,options:{overwrite:!0}}]),await this.trustWorkspaceConfiguration(t)}async saveWorkspace(e){let t=e.configPath,o=this.textFileService.files.get(t);if(o){await o.save({force:!0,reason:1});return}if(await this.fileService.exists(t))return;let s=Wbi(JSON.stringify({folders:[]},null,"	"),t,!1,t,this.uriIdentityService.extUri);await this.textFileService.create([{resource:t,value:s}])}handleWorkspaceConfigurationEditingError(e){e.code===0?this.onInvalidWorkspaceConfigurationFileError():this.notificationService.error(e.message)}onInvalidWorkspaceConfigurationFileError(){let e=d(18377,null);this.askToOpenWorkspaceConfigurationFile(e)}askToOpenWorkspaceConfigurationFile(e){this.notificationService.prompt(ft.Error,e,[{label:d(18378,null),run:()=>this.commandService.executeCommand("workbench.action.openWorkspaceConfigFile")}])}async fireDidEnterWorkspace(e,t){let o=new izi(e,t);this._onDidEnterWorkspace.fire(o);try{await o.wait()}catch(n){this.logService.error("Error while waiting for participants of onDidEnterWorkspace to join:",n)}}async doEnterWorkspace(e){if(this.environmentService.extensionTestsLocationURI)throw new Error("Entering a new workspace is not possible in tests.");let t=await this.workspacesService.getWorkspaceIdentifier(e);return this.contextService.getWorkbenchState()===2&&await this.migrateWorkspaceSettings(t),await this.configurationService.initialize(t),this.workspacesService.enterWorkspace(e)}migrateWorkspaceSettings(e){return this.doCopyWorkspaceSettings(e,t=>t.scope===4)}copyWorkspaceSettings(e){return this.doCopyWorkspaceSettings(e)}doCopyWorkspaceSettings(e,t){let o=ne.as(Jt.Configuration).getConfigurationProperties(),n={};for(let r of this.configurationService.keys().workspace)if(o[r]){if(t&&!t(o[r]))continue;n[r]=this.configurationService.inspect(r).workspaceValue}return this.jsonEditingService.write(e.configPath,[{path:["settings"],value:n}],!0)}async trustWorkspaceConfiguration(e){this.contextService.getWorkbenchState()!==1&&this.workspaceTrustManagementService.isWorkspaceTrusted()&&await this.workspaceTrustManagementService.setUrisTrust([e],!0)}getCurrentWorkspaceIdentifier(){let e=Dg(this.contextService.getWorkspace());if(ny(e))return e}};uGe=I([m(0,bg),m(1,Pe),m(2,fg),m(3,Ne),m(4,ge),m(5,fe),m(6,Uo),m(7,jp),m(8,At),m(9,rn),m(10,at),m(11,Zt),m(12,ht),m(13,Nr),m(14,an),m(15,ln),m(16,se)],uGe);var ozi=class a{constructor(i,e){this.backupRoot=i;this.fileService=e;this.cache=new gt}static async create(i,e){let t=new a(i,e);return await t.resolve(),t}async resolve(){try{let i=await this.fileService.resolve(this.backupRoot);i.children&&await dn.settled(i.children.filter(e=>e.isDirectory).map(async e=>{let t=await this.fileService.resolve(e.resource);if(t.children)for(let o of t.children)o.isDirectory||this.add(o.resource)}))}catch{}}add(i,e=0,t){this.cache.set(i,{versionId:e,meta:Ji(t)})}update(i,e){let t=this.cache.get(i);t&&(t.meta=Ji(e))}count(){return this.cache.size}has(i,e,t){let o=this.cache.get(i);return!(!o||typeof e=="number"&&e!==o.versionId||t&&!eo(t,o.meta))}get(){return Array.from(this.cache.keys())}remove(i){this.cache.delete(i)}clear(){this.cache.clear()}},cse=class extends x{constructor(e,t,o){super();this.fileService=t;this.logService=o;this.impl=this._register(this.initialize(e))}initialize(e){return e?new wL(e,this.fileService,this.logService):new M7t}reinitialize(e){this.impl instanceof wL&&(e?this.impl.initialize(e):this.impl=new M7t)}hasBackupSync(e,t,o){return this.impl.hasBackupSync(e,t,o)}backup(e,t,o,n,r){return this.impl.backup(e,t,o,n,r)}discardBackup(e,t){return this.impl.discardBackup(e,t)}discardBackups(e){return this.impl.discardBackups(e)}getBackups(){return this.impl.getBackups()}resolve(e){return this.impl.resolve(e)}toBackupResource(e){return this.impl.toBackupResource(e)}joinBackups(){return this.impl.joinBackups()}};cse=I([m(1,fe),m(2,se)],cse);var wL=class extends x{constructor(e,t,o){super();this.backupWorkspaceHome=e;this.fileService=t;this.logService=o;this.ioOperationQueues=this._register(new b1);this.model=void 0;this.initialize(e)}static{this.PREAMBLE_END_MARKER=`
`}static{this.PREAMBLE_END_MARKER_CHARCODE=10}static{this.PREAMBLE_META_SEPARATOR=" "}static{this.PREAMBLE_MAX_LENGTH=1e4}initialize(e){this.backupWorkspaceHome=e,this.ready=this.doInitialize()}async doInitialize(){return this.model=await ozi.create(this.backupWorkspaceHome,this.fileService),this.model}hasBackupSync(e,t,o){if(!this.model)return!1;let n=this.toBackupResource(e);return this.model.has(n,t,o)}async backup(e,t,o,n,r){let s=await this.ready;if(r?.isCancellationRequested)return;let l=this.toBackupResource(e);if(!s.has(l,o,n))return this.ioOperationQueues.queueFor(l,async()=>{if(r?.isCancellationRequested||s.has(l,o,n))return;let c=this.createPreamble(e,n);c.length>=wL.PREAMBLE_MAX_LENGTH&&(c=this.createPreamble(e));let u=qe.fromString(c),p;z9(t)?p=aJt(u,t):t?p=cqi(u,t):p=qe.concat([u,qe.fromString("")]),await this.fileService.writeFile(l,p),s.add(l,o,n)})}createPreamble(e,t){return`${e.resource.toString()}${wL.PREAMBLE_META_SEPARATOR}${JSON.stringify({...t,typeId:e.typeId})}${wL.PREAMBLE_END_MARKER}`}async discardBackups(e){let t=await this.ready,o=e?.except;if(Array.isArray(o)&&o.length>0){let n=new gt;for(let r of o)n.set(this.toBackupResource(r),!0);await dn.settled(t.get().map(async r=>{n.has(r)||await this.doDiscardBackup(r)}))}else await this.deleteIgnoreFileNotFound(this.backupWorkspaceHome),t.clear()}discardBackup(e,t){let o=this.toBackupResource(e);return this.doDiscardBackup(o,t)}async doDiscardBackup(e,t){let o=await this.ready;if(!t?.isCancellationRequested)return this.ioOperationQueues.queueFor(e,async()=>{t?.isCancellationRequested||(await this.deleteIgnoreFileNotFound(e),o.remove(e))})}async deleteIgnoreFileNotFound(e){try{await this.fileService.del(e,{recursive:!0})}catch(t){if(t.fileOperationResult!==1)throw t}}async getBackups(){let e=await this.ready;await this.joinBackups();let t=await Promise.all(e.get().map(o=>this.resolveIdentifier(o,e)));return di(t)}async resolveIdentifier(e,t){let o;return await this.ioOperationQueues.queueFor(e,async()=>{if(!t.has(e))return;let n=await this.readToMatchingString(e,wL.PREAMBLE_END_MARKER,wL.PREAMBLE_MAX_LENGTH);if(!n)return;let r=n.indexOf(wL.PREAMBLE_META_SEPARATOR),s,l;r>0?(s=n.substring(0,r),l=n.substr(r+1)):(s=n,l=void 0);let{typeId:c,meta:u}=this.parsePreambleMeta(l);t.update(e,u),o={typeId:c??gA,resource:A.parse(s)}}),o}async readToMatchingString(e,t,o){let n=(await this.fileService.readFile(e,{length:o})).value.toString(),r=n.indexOf(t);if(r>=0)return n.substr(0,r)}async resolve(e){let t=this.toBackupResource(e),o=await this.ready,n;return await this.ioOperationQueues.queueFor(t,async()=>{if(!o.has(t))return;let r=await this.fileService.readFileStream(t),s=await tgt(r.value,1),l=qe.concat(s.buffer),c=l.buffer.indexOf(wL.PREAMBLE_END_MARKER_CHARCODE);if(c===-1){this.logService.trace(`Backup: Could not find meta end marker in ${t}. The file is probably corrupt (filesize: ${r.size}).`);return}let u=l.slice(0,c).toString(),p,h=u.indexOf(wL.PREAMBLE_META_SEPARATOR);h!==-1&&(p=this.parsePreambleMeta(u.substr(h+1)).meta),o.update(t,p);let g=l.slice(c+1),f;s.ended?f=v_(g):f=aJt(g,s.stream),n={value:f,meta:p}}),n}parsePreambleMeta(e){let t,o;if(e)try{o=JSON.parse(e),t=o?.typeId,typeof o?.typeId=="string"&&(delete o.typeId,Of(o)&&(o=void 0))}catch{}return{typeId:t,meta:o}}toBackupResource(e){return Ge(this.backupWorkspaceHome,e.resource.scheme,iAo(e))}joinBackups(){return this.ioOperationQueues.whenDrained()}};wL=I([m(1,fe),m(2,se)],wL);var M7t=class extends x{constructor(){super(...arguments);this.backups=new gt}hasBackupSync(e,t){let o=this.toBackupResource(e);return this.backups.has(o)}async backup(e,t,o,n,r){let s=this.toBackupResource(e);this.backups.set(s,{typeId:e.typeId,content:t instanceof qe?t:t?z9(t)?await tb(t):ngt(t):qe.fromString(""),meta:n})}async resolve(e){let t=this.toBackupResource(e),o=this.backups.get(t);if(o)return{value:v_(o.content),meta:o.meta}}async getBackups(){return Array.from(this.backups.entries()).map(([e,t])=>({typeId:t.typeId,resource:e}))}async discardBackup(e){this.backups.delete(this.toBackupResource(e))}async discardBackups(e){let t=e?.except;if(Array.isArray(t)&&t.length>0){let o=new gt;for(let n of t)o.set(this.toBackupResource(n),!0);for(let n of await this.getBackups())o.has(this.toBackupResource(n))||await this.discardBackup(n)}else this.backups.clear()}toBackupResource(e){return A.from({scheme:Q.inMemory,path:iAo(e)})}async joinBackups(){}};function iAo(a){let i;if(a.typeId.length>0){let e=oAo(a.typeId);a.resource.path?i=Ge(a.resource,e):i=a.resource.with({path:e})}else i=a.resource;return ryn(i)}function ryn(a){let i=a.scheme===Q.file||a.scheme===Q.untitled?a.fsPath:a.toString();return oAo(i)}function oAo(a){return _r(a).toString(16)}var hpt=class extends uGe{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,P,O,V){super(e,t,n,c,u,p,h,g,f,v,b,w,k,T,P,O,V);this.nativeHostService=o;this.storageService=r;this.extensionService=s;this.workingCopyBackupService=l;this.lifecycleService=S;this.labelService=y;this.registerListeners()}registerListeners(){this._register(this.lifecycleService.onBeforeShutdown(e=>{let t=this.saveUntitledBeforeShutdown(e.reason);e.veto(t,"veto.untitledWorkspace")}))}async saveUntitledBeforeShutdown(e){if(e!==4&&e!==1)return!1;let t=this.getCurrentWorkspaceIdentifier();if(!t||!dR(t.configPath,this.environmentService))return!1;let o=await this.nativeHostService.getWindowCount();if(e===1&&!Ze&&o===1)return!1;if(!(this.configurationService.getValue("window.confirmSaveUntitledWorkspace")!==!1))return await this.workspacesService.deleteUntitledWorkspace(t),!1;let r=!1,{result:s,checkboxChecked:l}=await this.dialogService.prompt({type:ft.Warning,message:d(18388,null),detail:d(18387,null),buttons:[{label:d(18386,null),run:async()=>{let c=await this.pickNewWorkspacePath();if(!c||!GO(c))return!0;try{await this.saveWorkspaceAs(t,c);let u=await this.workspacesService.getWorkspaceIdentifier(c);await this.workspacesService.addRecentlyOpened([{label:this.labelService.getWorkspaceLabel(u,{verbose:2}),workspace:u,remoteAuthority:this.environmentService.remoteAuthority}]),await this.workspacesService.deleteUntitledWorkspace(t)}catch{}return!1}},{label:d(18384,null),run:async()=>(await this.workspacesService.deleteUntitledWorkspace(t),!1)}],cancelButton:{run:()=>(r=!0,!0)},checkbox:{label:d(18383,null)}});return!r&&l&&await this.configurationService.updateValue("window.confirmSaveUntitledWorkspace",!1,2),s}async isValidTargetWorkspacePath(e){return(await this.nativeHostService.getWindows({includeAuxiliaryWindows:!1})).some(o=>ny(o.workspace)&&this.uriIdentityService.extUri.isEqual(o.workspace.configPath,e))?(await this.dialogService.info(d(18390,null,He(e)),d(18389,null)),!1):!0}async enterWorkspace(e){if(!await this.extensionService.stopExtensionHosts(d(18385,null)))return;let o=Dg(this.contextService.getWorkspace()),n=await this.doEnterWorkspace(e);if(n){if(await this.storageService.switch(n.workspace,!0),this.workingCopyBackupService instanceof cse){let r=n.backupPath?A.file(n.backupPath).with({scheme:this.environmentService.userRoamingDataHome.scheme}):void 0;this.workingCopyBackupService.reinitialize(r)}await this.fireDidEnterWorkspace(o,n.workspace)}this.environmentService.remoteAuthority?this.hostService.reload():this.extensionService.startExtensionHosts()}};hpt=I([m(0,bg),m(1,Pe),m(2,ko),m(3,fg),m(4,ce),m(5,lt),m(6,hm),m(7,Ne),m(8,ge),m(9,fe),m(10,Uo),m(11,jp),m(12,zr),m(13,rn),m(14,at),m(15,ji),m(16,rt),m(17,Zt),m(18,ht),m(19,Nr),m(20,an),m(21,ln),m(22,se)],hpt);Ee(Db,hpt,1);var P7t=class{constructor(i,e,t,o){this._contributedVariables=new Map;this.resolvableVariables=new Set(aso);this._context=i,this._labelService=e,this._userHomePromise=t,o&&(this._envVariablesPromise=o.then(n=>this.prepareEnv(n)))}prepareEnv(i){if(ei){let e=Object.create(null);return Object.keys(i).forEach(t=>{e[t.toLowerCase()]=i[t]}),e}return i}async resolveWithEnvironment(i,e,t){let o=TS.parse(t);for(let n of o.unresolved()){let r=await this.evaluateSingleVariable(n,e?.uri,i);r!==void 0&&o.resolve(n,String(r))}return o.toObject()}async resolveAsync(i,e){let t=TS.parse(e);for(let o of t.unresolved()){let n=await this.evaluateSingleVariable(o,i?.uri);n!==void 0&&t.resolve(o,String(n))}return t.toObject()}resolveWithInteractionReplace(i,e){throw new Error("resolveWithInteractionReplace not implemented.")}resolveWithInteraction(i,e){throw new Error("resolveWithInteraction not implemented.")}contributeVariable(i,e){if(this._contributedVariables.has(i))throw new Error("Variable "+i+" is contributed twice.");this.resolvableVariables.add(i),this._contributedVariables.set(i,e)}fsPath(i){return this._labelService?this._labelService.getUriLabel(i,{noPrefix:!0}):i.fsPath}async evaluateSingleVariable(i,e,t,o){let n={env:t!==void 0?this.prepareEnv(t):await this._envVariablesPromise,userHome:t!==void 0?void 0:await this._userHomePromise},{name:r,arg:s}=i,l=p=>{let h=this._context.getFilePath();if(h)return Hp(h);throw new ov(p,d(17486,null,i.id))},c=p=>{let h=l(p);if(this._context.getWorkspaceFolderPathForFile){let g=this._context.getWorkspaceFolderPathForFile();if(g)return Hp(g)}throw new ov(p,d(17487,null,i.id,jo(h)))},u=p=>{if(s){let h=this._context.getFolderUri(s);if(h)return h;throw new ov(p,d(17484,null,p,s))}if(e)return e;throw this._context.getWorkspaceFolderCount()>1?new ov(p,d(17492,null,p)):new ov(p,d(17491,null,p))};switch(r){case"env":if(s){if(n.env){let p=n.env[ei?s.toLowerCase():s];if(Fe(p))return p}return""}throw new ov("env",d(17497,null,i.id));case"config":if(s){let p=this._context.getConfigurationValue(e,s);if(nr(p))throw new ov("config",d(17494,null,i.id,s));if(xi(p))throw new ov("config",d(17493,null,i.id,s));return p}throw new ov("config",d(17496,null,i.id));case"command":return this.resolveFromMap("command",i.id,s,o,"command");case"input":return this.resolveFromMap("input",i.id,s,o,"input");case"extensionInstallFolder":if(s){let p=await this._context.getExtension(s);if(!p)throw new ov("extensionInstallFolder",d(17495,null,i.id,s));return this.fsPath(p.extensionLocation)}throw new ov("extensionInstallFolder",d(17498,null,i.id));default:switch(r){case"workspaceRoot":case"workspaceFolder":{let p=u("workspaceFolder");return p?Hp(this.fsPath(p)):void 0}case"cwd":{if(!e&&!s)return Hse();let p=u("cwd");return p?Hp(this.fsPath(p)):void 0}case"workspaceRootFolderName":case"workspaceFolderBasename":{let p=u("workspaceFolderBasename");return p?Hp(jo(this.fsPath(p))):void 0}case"userHome":if(n.userHome)return n.userHome;throw new ov("userHome",d(17490,null,i.id));case"lineNumber":{let p=this._context.getLineNumber();if(p)return p;throw new ov("lineNumber",d(17488,null,i.id))}case"columnNumber":{let p=this._context.getColumnNumber();if(p)return p;throw new Error(d(17485,null,i.id))}case"selectedText":{let p=this._context.getSelectedText();if(p)return p;throw new ov("selectedText",d(17489,null,i.id))}case"file":return l("file");case"fileWorkspaceFolder":return c("fileWorkspaceFolder");case"fileWorkspaceFolderBasename":return jo(c("fileWorkspaceFolderBasename"));case"relativeFile":return e||s?dP(this.fsPath(u("relativeFile")),l("relativeFile")):l("relativeFile");case"relativeFileDirname":{let p=ad(l("relativeFileDirname"));if(e||s){let h=dP(this.fsPath(u("relativeFileDirname")),p);return h.length===0?".":h}return p}case"fileDirname":return ad(l("fileDirname"));case"fileExtname":return qm(l("fileExtname"));case"fileBasename":return jo(l("fileBasename"));case"fileBasenameNoExtension":{let p=jo(l("fileBasenameNoExtension"));return p.slice(0,p.length-qm(p).length)}case"fileDirnameBasename":return jo(ad(l("fileDirnameBasename")));case"execPath":{let p=this._context.getExecPath();return p||i.id}case"execInstallFolder":{let p=this._context.getAppRoot();return p||i.id}case"pathSeparator":case"/":return Qd;default:try{return this.resolveFromMap("unknown",i.id,s,o,void 0)}catch{return i.id}}}}resolveFromMap(i,e,t,o,n){if(t&&o){let r=n===void 0?o[t]:o[n+":"+t];if(typeof r=="string")return r;throw new ov(i,d(17499,null,e))}return e}};var nAo="configResolveInputLru",syn=5,A7t=class extends P7t{constructor(e,t,o,n,r,s,l,c,u,p,h){super({getFolderUri:g=>{let f=s.getWorkspace().folders.filter(v=>v.name===g).pop();return f?f.uri:void 0},getWorkspaceFolderCount:()=>s.getWorkspace().folders.length,getConfigurationValue:(g,f)=>n.getValue(f,g?{resource:g}:{}),getAppRoot:()=>e.getAppRoot(),getExecPath:()=>e.getExecPath(),getFilePath:()=>{let g=po.getOriginalUri(o.activeEditor,{supportSideBySide:1,filterByScheme:[Q.file,Q.vscodeUserData,this.pathService.defaultUriScheme]});if(g)return this.labelService.getUriLabel(g,{noPrefix:!0})},getWorkspaceFolderPathForFile:()=>{let g=po.getOriginalUri(o.activeEditor,{supportSideBySide:1,filterByScheme:[Q.file,Q.vscodeUserData,this.pathService.defaultUriScheme]});if(!g)return;let f=s.getWorkspaceFolder(g);if(f)return this.labelService.getUriLabel(f.uri,{noPrefix:!0})},getSelectedText:()=>{let g=o.activeTextEditorControl,f=null;if(pn(g))f=g;else if(mc(g)){let S=g.getOriginalEditor(),y=g.getModifiedEditor();f=S.hasWidgetFocus()?S:y}let v=f?.getModel(),b=f?.getSelection();if(v&&b)return v.getValueInRange(b)},getLineNumber:()=>{let g=o.activeTextEditorControl;if(pn(g)){let f=g.getSelection();if(f){let v=f.positionLineNumber;return String(v)}}},getColumnNumber:()=>{let g=o.activeTextEditorControl;if(pn(g)){let f=g.getSelection();if(f){let v=f.positionColumn;return String(v)}}},getExtension:g=>p.getExtension(g)},c,u.userHome().then(g=>g.path),t);this.configurationService=n;this.commandService=r;this.quickInputService=l;this.labelService=c;this.pathService=u;this.storageService=h;this.userInputAccessQueue=new uh;this.resolvableVariables.add("command"),this.resolvableVariables.add("input")}static{this.INPUT_OR_COMMAND_VARIABLES_PATTERN=/\${((input|command):(.*?))}/g}async resolveWithInteractionReplace(e,t,o,n,r){let s=TS.parse(t);if(await this.resolveWithInteraction(e,s,o,n,r)!==void 0)return s.toObject()}async resolveWithInteraction(e,t,o,n,r){let s=TS.parse(t);for(let l of s.unresolved()){let c;if(l.name==="command"){let u=(n?n[l.arg]:void 0)||l.arg,p=await this.commandService.executeCommand(u,s.toObject());if(!nr(p)){if(typeof p!="string")throw new ov("command",d(17462,null,u));c={value:p}}}else if(l.name==="input")c=await this.showUserInput(o,l.arg,await this.resolveInputs(e,o,r),n);else if(this._contributedVariables.has(l.inner))c={value:await this._contributedVariables.get(l.inner)()};else{let u=await this.evaluateSingleVariable(l,e?.uri);if(u===void 0)continue;c=typeof u=="string"?{value:u}:u}if(c===void 0)return;s.resolve(l,c)}return new Map(vt.map(s.resolved(),([l,c])=>[l.inner,c.value]))}async resolveInputs(e,t,o){if(!t)return;let n,r=e?{resource:e.uri}:{},s=this.configurationService.inspect(t,r);if(s)switch(o){case 8:n=s.memoryValue?.inputs;break;case 7:n=s.defaultValue?.inputs;break;case 2:n=s.userValue?.inputs;break;case 3:n=s.userLocalValue?.inputs;break;case 4:n=s.userRemoteValue?.inputs;break;case 1:n=s.applicationValue?.inputs;break;case 5:n=s.workspaceValue?.inputs;break;case 6:default:n=s.workspaceFolderValue?.inputs;break}return n??=this.configurationService.getValue(t,r)?.inputs,n}readInputLru(){let e=this.storageService.get(nAo,1),t=new dl(syn);try{e&&t.fromJSON(JSON.parse(e))}catch{}return t}storeInputLru(e){this.storageService.store(nAo,JSON.stringify(e.toJSON()),1,1)}async showUserInput(e,t,o,n){if(!o)throw new ov("input",d(17466,null,t,"inputs"));let r=o.filter(s=>s.id===t).pop();if(r){let s=p=>{throw new ov("input",d(17465,null,t,r.type,p))},l=this.readInputLru(),c=`${e}.${t}`,u=l.get(c);switch(r.type){case"promptString":{Fe(r.description)||s("description");let p={prompt:r.description,ignoreFocusLost:!0,value:n?.[`input:${t}`]??u??r.default};return r.password&&(p.password=r.password),this.userInputAccessQueue.queue(()=>this.quickInputService.input(p)).then(h=>(typeof h=="string"&&!r.password&&this.storeInputLru(l.set(c,h)),h!==void 0?{value:h,input:r}:void 0))}case"pickString":{if(Fe(r.description)||s("description"),Array.isArray(r.options))for(let g of r.options)!Fe(g)&&!Fe(g.value)&&s("value");else s("options");let p=new Array;for(let g of r.options){let f=Fe(g)?g:g.value,v=Fe(g)?void 0:g.label,b={label:v?`${v}: ${f}`:f,value:f},S=n?.[`input:${t}`]??u??r.default;f===r.default?(b.description=d(17464,null),p.unshift(b)):f===S?p.unshift(b):p.push(b)}let h={placeHolder:r.description,matchOnDetail:!0,ignoreFocusLost:!0};return this.userInputAccessQueue.queue(()=>this.quickInputService.pick(p,h,void 0)).then(g=>{if(g){let f=g.value;return this.storeInputLru(l.set(c,f)),{value:f,input:r}}})}case"command":return Fe(r.command)||s("command"),this.userInputAccessQueue.queue(()=>this.commandService.executeCommand(r.command,r.args)).then(p=>{if(typeof p=="string"||nr(p))return{value:p,input:r};throw new ov("input",d(17463,null,t,r.command))});default:throw new ov("input",d(17468,null,t))}}throw new ov("input",d(17467,null,t))}};var uSe=le("shellEnvironmentService"),nzi=class{getShellEnv(){return eP.shellEnv()}};Ee(uSe,nzi,1);var gpt=class extends A7t{constructor(i,e,t,o,n,r,s,l,c,u,p){super({getAppRoot:()=>e.appRoot,getExecPath:()=>e.execPath},l.getShellEnv(),i,t,o,n,r,s,c,u,p)}};gpt=I([m(0,ee),m(1,zr),m(2,B),m(3,ge),m(4,Pe),m(5,Ue),m(6,rt),m(7,uSe),m(8,An),m(9,lt),m(10,ce)],gpt);Ee(Tp,gpt,1);var pGe=class extends x{constructor(e,t,o){super();this._contextKeyService=e;this._layoutService=t;this._configurationService=o;this._accessibilitySupport=0;this._onDidChangeScreenReaderOptimized=this._register(new E);this._onDidChangeReducedMotion=this._register(new E);this._onDidChangeReducedTransparency=this._register(new E);this._onDidChangeLinkUnderline=this._register(new E);this._accessibilityModeEnabledContext=$a.bindTo(this._contextKeyService);let n=()=>this._accessibilityModeEnabledContext.set(this.isScreenReaderOptimized());this._register(this._configurationService.onDidChangeConfiguration(l=>{l.affectsConfiguration("editor.accessibilitySupport")&&(n(),this._onDidChangeScreenReaderOptimized.fire()),l.affectsConfiguration("workbench.reduceMotion")&&(this._configMotionReduced=this._configurationService.getValue("workbench.reduceMotion"),this._onDidChangeReducedMotion.fire()),l.affectsConfiguration("workbench.reduceTransparency")&&(this._configTransparencyReduced=this._configurationService.getValue("workbench.reduceTransparency"),this._onDidChangeReducedTransparency.fire())})),n(),this._register(this.onDidChangeScreenReaderOptimized(()=>n()));let r=ut.matchMedia("(prefers-reduced-motion: reduce)");this._systemMotionReduced=r.matches,this._configMotionReduced=this._configurationService.getValue("workbench.reduceMotion");let s=ut.matchMedia("(prefers-reduced-transparency: reduce)");this._systemTransparencyReduced=s.matches,this._configTransparencyReduced=this._configurationService.getValue("workbench.reduceTransparency"),this._linkUnderlinesEnabled=this._configurationService.getValue("accessibility.underlineLinks"),this.initReducedMotionListeners(r),this.initReducedTransparencyListeners(s),this.initLinkUnderlineListeners()}initReducedMotionListeners(e){this._register(j(e,"change",()=>{this._systemMotionReduced=e.matches,this._configMotionReduced==="auto"&&this._onDidChangeReducedMotion.fire()}));let t=()=>{let o=this.isMotionReduced();this._layoutService.mainContainer.classList.toggle("monaco-reduce-motion",o),this._layoutService.mainContainer.classList.toggle("monaco-enable-motion",!o)};t(),this._register(this.onDidChangeReducedMotion(()=>t()))}initReducedTransparencyListeners(e){this._register(j(e,"change",()=>{this._systemTransparencyReduced=e.matches,this._configTransparencyReduced==="auto"&&this._onDidChangeReducedTransparency.fire()}));let t=()=>{let o=this.isTransparencyReduced();this._layoutService.mainContainer.classList.toggle("monaco-reduce-transparency",o)};t(),this._register(this.onDidChangeReducedTransparency(()=>t()))}initLinkUnderlineListeners(){this._register(this._configurationService.onDidChangeConfiguration(t=>{if(t.affectsConfiguration("accessibility.underlineLinks")){let o=this._configurationService.getValue("accessibility.underlineLinks");this._linkUnderlinesEnabled=o,this._onDidChangeLinkUnderline.fire()}}));let e=()=>{let t=this._linkUnderlinesEnabled;this._layoutService.mainContainer.classList.toggle("underline-links",t)};e(),this._register(this.onDidChangeLinkUnderlines(()=>e()))}onDidChangeLinkUnderlines(e){return this._onDidChangeLinkUnderline.event(e)}get onDidChangeScreenReaderOptimized(){return this._onDidChangeScreenReaderOptimized.event}isScreenReaderOptimized(){let e=this.getAccessibilitySupportConfigurationValue();return e==="on"||e==="auto"&&this._accessibilitySupport===2}getAccessibilitySupportConfigurationValue(){let e=this._configurationService.inspect("editor.accessibilitySupport");return e.policyValue??e.memoryValue??e.workspaceFolderValue??e.workspaceValue??e.userValue??e.applicationValue??e.defaultValue??"auto"}get onDidChangeReducedMotion(){return this._onDidChangeReducedMotion.event}isMotionReduced(){let e=this._configMotionReduced;return e==="on"||e==="auto"&&this._systemMotionReduced}get onDidChangeReducedTransparency(){return this._onDidChangeReducedTransparency.event}isTransparencyReduced(){let e=this._configTransparencyReduced;return e==="on"||e==="auto"&&this._systemTransparencyReduced}alwaysUnderlineAccessKeys(){return Promise.resolve(!1)}getAccessibilitySupport(){return this._accessibilitySupport}setAccessibilitySupport(e){this._accessibilitySupport!==e&&(this._accessibilitySupport=e,this._onDidChangeScreenReaderOptimized.fire())}alert(e){en(e)}status(e){qr(e)}};pGe=I([m(0,X),m(1,Kl),m(2,B)],pGe);var fpt=class extends pGe{constructor(e,t,o,n,r,s){super(t,n,o);this._telemetryService=r;this.nativeHostService=s;this.didSendTelemetry=!1;this.shouldAlwaysUnderlineAccessKeys=void 0;this.setAccessibilitySupport(e.window.accessibilitySupport?2:1)}async alwaysUnderlineAccessKeys(){if(!ei)return!1;if(typeof this.shouldAlwaysUnderlineAccessKeys!="boolean"){let e=await this.nativeHostService.windowsGetStringRegKey("HKEY_CURRENT_USER","Control Panel\\Accessibility\\Keyboard Preference","On");this.shouldAlwaysUnderlineAccessKeys=e==="1"}return this.shouldAlwaysUnderlineAccessKeys}setAccessibilitySupport(e){super.setAccessibilitySupport(e),!this.didSendTelemetry&&e===2&&(this._telemetryService.publicLog2("accessibility",{enabled:!0}),this.didSendTelemetry=!0)}};fpt=I([m(0,zr),m(1,X),m(2,B),m(3,Kl),m(4,Te),m(5,ko)],fpt);Ee(Oi,fpt,1);var mGe=class{static{this.ID="workbench.contrib.linuxAccessibility"}constructor(i,e,t){let o=()=>{e.isScreenReaderOptimized()&&i.write(t.argvResource,[{path:["force-renderer-accessibility"],value:!0}],!0)};o(),e.onDidChangeScreenReaderOptimized(o)}};mGe=I([m(0,bg),m(1,Oi),m(2,zr)],mGe);fn&&It(mGe.ID,mGe,St.BlockRestore);var N7t=class{constructor(i){this._actual=i,this._cache=new Map}dumpDebugInfo(){return this._actual.dumpDebugInfo()}resolveKeyboardEvent(i){return this._actual.resolveKeyboardEvent(i)}resolveKeybinding(i){let e=i.getHashCode(),t=this._cache.get(e);if(!t){let o=this._actual.resolveKeybinding(i);return this._cache.set(e,o),o}return t}};var O7t=class a extends Zee{constructor(i,e){super(e,i)}_keyCodeToUILabel(i){if(this._os===2)switch(i){case 15:return"\u2190";case 16:return"\u2191";case 17:return"\u2192";case 18:return"\u2193"}return Fp.toString(i)}_getLabel(i){return i.isDuplicateModifierCase()?"":this._keyCodeToUILabel(i.keyCode)}_getAriaLabel(i){return i.isDuplicateModifierCase()?"":Fp.toString(i.keyCode)}_getElectronAccelerator(i){return Fp.toElectronAccelerator(i.keyCode)}_getUserSettingsLabel(i){if(i.isDuplicateModifierCase())return"";let e=Fp.toUserSettingsUS(i.keyCode);return e&&e.toLowerCase()}_isWYSIWYG(){return!0}_getChordDispatch(i){return a.getDispatchStr(i)}static getDispatchStr(i){if(i.isModifierKey())return null;let e="";return i.ctrlKey&&(e+="ctrl+"),i.shiftKey&&(e+="shift+"),i.altKey&&(e+="alt+"),i.metaKey&&(e+="meta+"),e+=Fp.toString(i.keyCode),e}_getSingleModifierChordDispatch(i){return i.keyCode===5&&!i.shiftKey&&!i.altKey&&!i.metaKey?"ctrl":i.keyCode===4&&!i.ctrlKey&&!i.altKey&&!i.metaKey?"shift":i.keyCode===6&&!i.ctrlKey&&!i.shiftKey&&!i.metaKey?"alt":i.keyCode===57&&!i.ctrlKey&&!i.shiftKey&&!i.altKey?"meta":null}static _scanCodeToKeyCode(i){let e=Qy[i];if(e!==-1)return e;switch(i){case 10:return 31;case 11:return 32;case 12:return 33;case 13:return 34;case 14:return 35;case 15:return 36;case 16:return 37;case 17:return 38;case 18:return 39;case 19:return 40;case 20:return 41;case 21:return 42;case 22:return 43;case 23:return 44;case 24:return 45;case 25:return 46;case 26:return 47;case 27:return 48;case 28:return 49;case 29:return 50;case 30:return 51;case 31:return 52;case 32:return 53;case 33:return 54;case 34:return 55;case 35:return 56;case 36:return 22;case 37:return 23;case 38:return 24;case 39:return 25;case 40:return 26;case 41:return 27;case 42:return 28;case 43:return 29;case 44:return 30;case 45:return 21;case 51:return 88;case 52:return 86;case 53:return 92;case 54:return 94;case 55:return 93;case 56:return 0;case 57:return 85;case 58:return 95;case 59:return 91;case 60:return 87;case 61:return 89;case 62:return 90;case 106:return 97}return 0}static _toKeyCodeChord(i){if(!i)return null;if(i instanceof eS)return i;let e=this._scanCodeToKeyCode(i.scanCode);return e===0?null:new eS(i.ctrlKey,i.shiftKey,i.altKey,i.metaKey,e)}static resolveKeybinding(i,e){let t=MRe(i.chords.map(o=>this._toKeyCodeChord(o)));return t.length>0?[new a(t,e)]:[]}};var hGe=class{constructor(i,e){this._mapAltGrToCtrlAlt=i;this._OS=e}dumpDebugInfo(){return"FallbackKeyboardMapper dispatching on keyCode"}resolveKeyboardEvent(i){let e=i.ctrlKey||this._mapAltGrToCtrlAlt&&i.altGraphKey,t=i.altKey||this._mapAltGrToCtrlAlt&&i.altGraphKey,o=new eS(e,i.shiftKey,t,i.metaKey,i.keyCode);return this.resolveKeybinding(new m1([o]))[0]}resolveKeybinding(i){return O7t.resolveKeybinding(i,this._OS)}};var vpt=[],F7t=class extends Zee{constructor(i,e,t){super(e,t),this._mapper=i}_getLabel(i){return this._mapper.getUILabelForScanCodeChord(i)}_getAriaLabel(i){return this._mapper.getAriaLabelForScanCodeChord(i)}_getElectronAccelerator(i){return this._mapper.getElectronAcceleratorLabelForScanCodeChord(i)}_getUserSettingsLabel(i){return this._mapper.getUserSettingsLabelForScanCodeChord(i)}_isWYSIWYG(i){if(!i||Qy[i.scanCode]!==-1)return!0;let e=this._mapper.getAriaLabelForScanCodeChord(i),t=this._mapper.getUserSettingsLabelForScanCodeChord(i);return!e&&!t?!0:!e||!t?!1:e.toLowerCase()===t.toLowerCase()}_getChordDispatch(i){return this._mapper.getDispatchStrForScanCodeChord(i)}_getSingleModifierChordDispatch(i){return(i.scanCode===157||i.scanCode===161)&&!i.shiftKey&&!i.altKey&&!i.metaKey?"ctrl":(i.scanCode===159||i.scanCode===163)&&!i.ctrlKey&&!i.shiftKey&&!i.metaKey?"alt":(i.scanCode===158||i.scanCode===162)&&!i.ctrlKey&&!i.altKey&&!i.metaKey?"shift":(i.scanCode===160||i.scanCode===164)&&!i.ctrlKey&&!i.shiftKey&&!i.altKey?"meta":null}},pSe=class{constructor(i,e,t,o){this.ctrlKey=i,this.shiftKey=e,this.altKey=t,this.scanCode=o}toString(){return`${this.ctrlKey?"Ctrl+":""}${this.shiftKey?"Shift+":""}${this.altKey?"Alt+":""}${Zb.toString(this.scanCode)}`}equals(i){return this.ctrlKey===i.ctrlKey&&this.shiftKey===i.shiftKey&&this.altKey===i.altKey&&this.scanCode===i.scanCode}getProducedCharCode(i){return i?this.ctrlKey&&this.shiftKey&&this.altKey?i.withShiftAltGr:this.ctrlKey&&this.altKey?i.withAltGr:this.shiftKey?i.withShift:i.value:""}getProducedChar(i){let e=dse.getCharCode(this.getProducedCharCode(i));return e===0?" --- ":e>=768&&e<=879?"U+"+e.toString(16):"  "+String.fromCharCode(e)+"  "}},bpt=class{constructor(i,e,t,o){this.ctrlKey=i,this.shiftKey=e,this.altKey=t,this.keyCode=o}toString(){return`${this.ctrlKey?"Ctrl+":""}${this.shiftKey?"Shift+":""}${this.altKey?"Alt+":""}${Fp.toString(this.keyCode)}`}},rzi=class{constructor(){this._scanCodeToKeyCode=[];this._keyCodeToScanCode=[];this._scanCodeToKeyCode=[],this._keyCodeToScanCode=[]}registrationComplete(){this._moveToEnd(56),this._moveToEnd(106)}_moveToEnd(i){for(let e=0;e<8;e++){let t=this._scanCodeToKeyCode[(i<<3)+e];if(t)for(let o=0,n=t.length;o<n;o++){let r=this._keyCodeToScanCode[t[o]];if(r.length!==1)for(let s=0,l=r.length;s<l;s++){let c=r[s];if(c>>>3===i){for(let p=s+1;p<l;p++)r[p-1]=r[p];r[l-1]=c}}}}}registerIfUnknown(i,e){if(e.keyCode===0)return;let t=this._encodeScanCodeCombo(i),o=this._encodeKeyCodeCombo(e),n=e.keyCode>=21&&e.keyCode<=30,r=e.keyCode>=31&&e.keyCode<=56,s=this._scanCodeToKeyCode[t];if(n||r){if(s){for(let l=0,c=s.length;l<c;l++)if(s[l]===o)return}}else if(s&&s.length!==0)return;this._scanCodeToKeyCode[t]=this._scanCodeToKeyCode[t]||[],this._scanCodeToKeyCode[t].unshift(o),this._keyCodeToScanCode[o]=this._keyCodeToScanCode[o]||[],this._keyCodeToScanCode[o].unshift(t)}lookupKeyCodeCombo(i){let e=this._encodeKeyCodeCombo(i),t=this._keyCodeToScanCode[e];if(!t||t.length===0)return[];let o=[];for(let n=0,r=t.length;n<r;n++){let s=t[n],l=!!(s&1),c=!!(s&2),u=!!(s&4),p=s>>>3;o[n]=new pSe(l,c,u,p)}return o}lookupScanCodeCombo(i){let e=this._encodeScanCodeCombo(i),t=this._scanCodeToKeyCode[e];if(!t||t.length===0)return[];let o=[];for(let n=0,r=t.length;n<r;n++){let s=t[n],l=!!(s&1),c=!!(s&2),u=!!(s&4),p=s>>>3;o[n]=new bpt(l,c,u,p)}return o}guessStableKeyCode(i){if(i>=36&&i<=45)switch(i){case 36:return 22;case 37:return 23;case 38:return 24;case 39:return 25;case 40:return 26;case 41:return 27;case 42:return 28;case 43:return 29;case 44:return 30;case 45:return 21}let e=this.lookupScanCodeCombo(new pSe(!1,!1,!1,i)),t=this.lookupScanCodeCombo(new pSe(!1,!0,!1,i));if(e.length===1&&t.length===1){let o=e[0].shiftKey,n=e[0].keyCode,r=t[0].shiftKey,s=t[0].keyCode;if(n===s&&o!==r)return n}return-1}_encodeScanCodeCombo(i){return this._encode(i.ctrlKey,i.shiftKey,i.altKey,i.scanCode)}_encodeKeyCodeCombo(i){return this._encode(i.ctrlKey,i.shiftKey,i.altKey,i.keyCode)}_encode(i,e,t,o){return((i?1:0)<<0|(e?1:0)<<1|(t?1:0)<<2|o<<3)>>>0}},dse=class a{constructor(i,e,t,o){this._isUSStandard=i;this._mapAltGrToCtrlAlt=t;this._OS=o;this._scanCodeToLabel=[];this._scanCodeToDispatch=[];this._codeInfo=[],this._scanCodeKeyCodeMapper=new rzi,this._scanCodeToLabel=[],this._scanCodeToDispatch=[];let n=(u,p,h,g,f,v,b,S)=>{this._scanCodeKeyCodeMapper.registerIfUnknown(new pSe(!!u,!!p,!!h,g),new bpt(!!f,!!v,!!b,S))},r=(u,p,h,g,f)=>{for(let v=u;v<=1;v++)for(let b=p;b<=1;b++)for(let S=h;S<=1;S++)n(v,b,S,g,v,b,S,f)};for(let u=0;u<193;u++)this._scanCodeToLabel[u]=null;for(let u=0;u<193;u++)this._scanCodeToDispatch[u]=null;for(let u=0;u<193;u++){let p=Qy[u];p!==-1&&(r(0,0,0,u,p),this._scanCodeToLabel[u]=Fp.toString(p),p===0||XN(p)?this._scanCodeToDispatch[u]=null:this._scanCodeToDispatch[u]=`[${Zb.toString(u)}]`)}let s={};{let u=[];for(let h in e)if(e.hasOwnProperty(h)){let g=Zb.toEnum(h);if(g===0||Qy[g]!==-1)continue;let f=e[h],v=a.getCharCode(f.value);if(v>=97&&v<=122){let b=65+(v-97);u[b]=!0}}let p=(h,g,f,v)=>{u[h]||(s[Zb.toString(g)]={value:f,withShift:v,withAltGr:"",withShiftAltGr:""})};p(65,10,"a","A"),p(66,11,"b","B"),p(67,12,"c","C"),p(68,13,"d","D"),p(69,14,"e","E"),p(70,15,"f","F"),p(71,16,"g","G"),p(72,17,"h","H"),p(73,18,"i","I"),p(74,19,"j","J"),p(75,20,"k","K"),p(76,21,"l","L"),p(77,22,"m","M"),p(78,23,"n","N"),p(79,24,"o","O"),p(80,25,"p","P"),p(81,26,"q","Q"),p(82,27,"r","R"),p(83,28,"s","S"),p(84,29,"t","T"),p(85,30,"u","U"),p(86,31,"v","V"),p(87,32,"w","W"),p(88,33,"x","X"),p(89,34,"y","Y"),p(90,35,"z","Z")}let l=[],c=0;for(let u in e)if(e.hasOwnProperty(u)){let p=Zb.toEnum(u);if(p===0||Qy[p]!==-1)continue;this._codeInfo[p]=e[u];let h=s[u]||e[u],g=a.getCharCode(h.value),f=a.getCharCode(h.withShift),v=a.getCharCode(h.withAltGr),b=a.getCharCode(h.withShiftAltGr),S={scanCode:p,value:g,withShift:f,withAltGr:v,withShiftAltGr:b};if(l[c++]=S,this._scanCodeToDispatch[p]=`[${Zb.toString(p)}]`,g>=97&&g<=122){let y=65+(g-97);this._scanCodeToLabel[p]=String.fromCharCode(y)}else g>=65&&g<=90?this._scanCodeToLabel[p]=String.fromCharCode(g):g?this._scanCodeToLabel[p]=String.fromCharCode(g):this._scanCodeToLabel[p]=null}for(let u=l.length-1;u>=0;u--){let p=l[u],h=p.scanCode,g=p.withShiftAltGr;if(g===p.withAltGr||g===p.withShift||g===p.value)continue;let f=a._charCodeToKb(g);if(!f)continue;let v=f.shiftKey,b=f.keyCode;v?n(1,1,1,h,0,1,0,b):n(1,1,1,h,0,0,0,b)}for(let u=l.length-1;u>=0;u--){let p=l[u],h=p.scanCode,g=p.withAltGr;if(g===p.withShift||g===p.value)continue;let f=a._charCodeToKb(g);if(!f)continue;let v=f.shiftKey,b=f.keyCode;v?n(1,0,1,h,0,1,0,b):n(1,0,1,h,0,0,0,b)}for(let u=l.length-1;u>=0;u--){let p=l[u],h=p.scanCode,g=p.withShift;if(g===p.value)continue;let f=a._charCodeToKb(g);if(!f)continue;let v=f.shiftKey,b=f.keyCode;v?(n(0,1,0,h,0,1,0,b),n(0,1,1,h,0,1,1,b),n(1,1,0,h,1,1,0,b),n(1,1,1,h,1,1,1,b)):(n(0,1,0,h,0,0,0,b),n(0,1,0,h,0,1,0,b),n(0,1,1,h,0,0,1,b),n(0,1,1,h,0,1,1,b),n(1,1,0,h,1,0,0,b),n(1,1,0,h,1,1,0,b),n(1,1,1,h,1,0,1,b),n(1,1,1,h,1,1,1,b))}for(let u=l.length-1;u>=0;u--){let p=l[u],h=p.scanCode,g=a._charCodeToKb(p.value);if(!g)continue;let f=g.shiftKey,v=g.keyCode;f?(n(0,0,0,h,0,1,0,v),n(0,0,1,h,0,1,1,v),n(1,0,0,h,1,1,0,v),n(1,0,1,h,1,1,1,v)):(n(0,0,0,h,0,0,0,v),n(0,0,1,h,0,0,1,v),n(0,1,0,h,0,1,0,v),n(0,1,1,h,0,1,1,v),n(1,0,0,h,1,0,0,v),n(1,0,1,h,1,0,1,v),n(1,1,0,h,1,1,0,v),n(1,1,1,h,1,1,1,v))}r(0,0,0,36,22),r(0,0,0,37,23),r(0,0,0,38,24),r(0,0,0,39,25),r(0,0,0,40,26),r(0,0,0,41,27),r(0,0,0,42,28),r(0,0,0,43,29),r(0,0,0,44,30),r(0,0,0,45,21),this._scanCodeKeyCodeMapper.registrationComplete()}dumpDebugInfo(){let i=[],e=[88,104],t=0;i.push(`isUSStandard: ${this._isUSStandard}`),i.push("----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------");for(let o=0;o<193;o++){if(Qy[o]!==-1&&e.indexOf(o)===-1)continue;t%4===0&&(i.push("|       HW Code combination      |  Key  |    KeyCode combination    | Pri |          UI label         |         User settings          |    Electron accelerator   |       Dispatching string       | WYSIWYG |"),i.push("----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------")),t++;let n=this._codeInfo[o];for(let r=0;r<8;r++){let s=!!(r&1),l=!!(r&2),c=!!(r&4),u=new pSe(s,l,c,o),p=this.resolveKeyboardEvent({_standardKeyboardEventBrand:!0,ctrlKey:u.ctrlKey,shiftKey:u.shiftKey,altKey:u.altKey,metaKey:!1,altGraphKey:!1,keyCode:-1,code:Zb.toString(o)}),h=u.toString(),g=u.getProducedChar(n),f=p.getAriaLabel(),v=f?f.replace(/Control\+/,"Ctrl+"):null,b=p.getUserSettingsLabel(),S=p.getElectronAccelerator(),y=p.getDispatchChords()[0],k=(p?p.isWYSIWYG():!1)?"       ":"   NO  ",T=this._scanCodeKeyCodeMapper.lookupScanCodeCombo(u);if(T.length===0)i.push(`| ${this._leftPad(h,30)} | ${g} | ${this._leftPad("",25)} | ${this._leftPad("",3)} | ${this._leftPad(v,25)} | ${this._leftPad(b,30)} | ${this._leftPad(S,25)} | ${this._leftPad(y,30)} | ${k} |`);else for(let P=0,O=T.length;P<O;P++){let V=T[P],H,G=this._scanCodeKeyCodeMapper.lookupKeyCodeCombo(V);if(G.length===1)H="";else{let J=-1;for(let ae=0;ae<G.length;ae++)if(G[ae].equals(u)){J=ae+1;break}H=String(J)}let $=V.toString();P===0?i.push(`| ${this._leftPad(h,30)} | ${g} | ${this._leftPad($,25)} | ${this._leftPad(H,3)} | ${this._leftPad(v,25)} | ${this._leftPad(b,30)} | ${this._leftPad(S,25)} | ${this._leftPad(y,30)} | ${k} |`):i.push(`| ${this._leftPad("",30)} |       | ${this._leftPad($,25)} | ${this._leftPad(H,3)} | ${this._leftPad("",25)} | ${this._leftPad("",30)} | ${this._leftPad("",25)} | ${this._leftPad("",30)} |         |`)}}i.push("----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------")}return i.join(`
`)}_leftPad(i,e){for(i===null&&(i="null");i.length<e;)i=" "+i;return i}keyCodeChordToScanCodeChord(i){if(i.keyCode===3)return[new EL(i.ctrlKey,i.shiftKey,i.altKey,i.metaKey,46)];let e=this._scanCodeKeyCodeMapper.lookupKeyCodeCombo(new bpt(i.ctrlKey,i.shiftKey,i.altKey,i.keyCode)),t=[];for(let o=0,n=e.length;o<n;o++){let r=e[o];t[o]=new EL(r.ctrlKey,r.shiftKey,r.altKey,i.metaKey,r.scanCode)}return t}getUILabelForScanCodeChord(i){if(!i)return null;if(i.isDuplicateModifierCase())return"";if(this._OS===2)switch(i.scanCode){case 86:return"\u2190";case 88:return"\u2191";case 85:return"\u2192";case 87:return"\u2193"}return this._scanCodeToLabel[i.scanCode]}getAriaLabelForScanCodeChord(i){return i?i.isDuplicateModifierCase()?"":this._scanCodeToLabel[i.scanCode]:null}getDispatchStrForScanCodeChord(i){let e=this._scanCodeToDispatch[i.scanCode];if(!e)return null;let t="";return i.ctrlKey&&(t+="ctrl+"),i.shiftKey&&(t+="shift+"),i.altKey&&(t+="alt+"),i.metaKey&&(t+="meta+"),t+=e,t}getUserSettingsLabelForScanCodeChord(i){if(!i)return null;if(i.isDuplicateModifierCase())return"";let e=Qy[i.scanCode];if(e!==-1)return Fp.toUserSettingsUS(e).toLowerCase();let t=this._scanCodeKeyCodeMapper.guessStableKeyCode(i.scanCode);if(t!==-1){let o=this.keyCodeChordToScanCodeChord(new eS(i.ctrlKey,i.shiftKey,i.altKey,i.metaKey,t));for(let n=0,r=o.length;n<r;n++)if(o[n].scanCode===i.scanCode)return Fp.toUserSettingsUS(t).toLowerCase()}return this._scanCodeToDispatch[i.scanCode]}getElectronAcceleratorLabelForScanCodeChord(i){if(!i)return null;let e=Qy[i.scanCode];if(e!==-1)return Fp.toElectronAccelerator(e);let t=this._scanCodeKeyCodeMapper.guessStableKeyCode(i.scanCode);return this._OS===3&&!this._isUSStandard&&(t===85||t===86||t===87||t===88||t===89||t===90||t===91||t===92||t===93||t===94)?null:t!==-1?Fp.toElectronAccelerator(t):null}_toResolvedKeybinding(i){if(i.length===0)return[];let e=[];return this._generateResolvedKeybindings(i,0,[],e),e}_generateResolvedKeybindings(i,e,t,o){let n=i[e],r=e===i.length-1;for(let s=0,l=n.length;s<l;s++){let c=[...t,n[s]];r?o.push(new F7t(this,this._OS,c)):this._generateResolvedKeybindings(i,e+1,c,o)}}resolveKeyboardEvent(i){let e=Zb.toEnum(i.code);e===94&&(e=46);let t=i.keyCode;if(t===15||t===16||t===17||t===18||t===20||t===19||t===14||t===13||t===12||t===11||t===1){let s=nIe[t];s!==-1&&(e=s)}else if((e===95||e===96||e===97||e===98||e===99||e===100||e===101||e===102||e===103||e===104||e===105)&&t>=0){let s=nIe[t];s!==-1&&(e=s)}let o=i.ctrlKey||this._mapAltGrToCtrlAlt&&i.altGraphKey,n=i.altKey||this._mapAltGrToCtrlAlt&&i.altGraphKey,r=new EL(o,i.shiftKey,n,i.metaKey,e);return new F7t(this,this._OS,[r])}_resolveChord(i){return i?i instanceof EL?[i]:this.keyCodeChordToScanCodeChord(i):[]}resolveKeybinding(i){let e=i.chords.map(t=>this._resolveChord(t));return this._toResolvedKeybinding(e)}static _redirectCharCode(i){switch(i){case 12290:return 46;case 12300:return 91;case 12301:return 93;case 12304:return 91;case 12305:return 93;case 65307:return 59;case 65292:return 44}return i}static _charCodeToKb(i){return i=this._redirectCharCode(i),i<vpt.length?vpt[i]:null}static getCharCode(i){if(i.length===0)return 0;let e=i.charCodeAt(0);switch(e){case 768:return 96;case 769:return 180;case 770:return 94;case 771:return 732;case 772:return 175;case 773:return 8254;case 774:return 728;case 775:return 729;case 776:return 168;case 778:return 730;case 779:return 733}return e}};(function(){function a(i,e,t){for(let o=vpt.length;o<i;o++)vpt[o]=null;vpt[i]={keyCode:e,shiftKey:t}}for(let i=65;i<=90;i++)a(i,31+(i-65),!0);for(let i=97;i<=122;i++)a(i,31+(i-97),!1);a(59,85,!1),a(58,85,!0),a(61,86,!1),a(43,86,!0),a(44,87,!1),a(60,87,!0),a(45,88,!1),a(95,88,!0),a(46,89,!1),a(62,89,!0),a(47,90,!1),a(63,90,!0),a(96,91,!1),a(126,91,!0),a(91,92,!1),a(123,92,!0),a(92,93,!1),a(124,93,!0),a(93,94,!1),a(125,94,!0),a(39,95,!1),a(34,95,!0)})();function rAo(a){let i=a.getValue("keyboard"),e=i?.dispatch==="keyCode"?1:0,t=!!i?.mapAltGrToCtrlAlt;return{dispatch:e,mapAltGrToCtrlAlt:t}}var ayn=ne.as(Jt.Configuration),lyn={id:"keyboard",order:15,type:"object",title:d(2176,null),properties:{"keyboard.dispatch":{scope:1,type:"string",enum:["code","keyCode"],default:"code",markdownDescription:d(2175,null),included:Po===2||Po===3},"keyboard.mapAltGrToCtrlAlt":{scope:1,type:"boolean",default:!1,markdownDescription:d(2177,null),included:Po===1}}};ayn.registerConfiguration(lyn);var Spt=class extends x{constructor(e,t){super();this._nativeKeyboardLayoutService=e;this._configurationService=t;this._onDidChangeKeyboardLayout=this._register(new E);this.onDidChangeKeyboardLayout=this._onDidChangeKeyboardLayout.event;this._keyboardMapper=null,this._register(this._nativeKeyboardLayoutService.onDidChangeKeyboardLayout(async()=>{this._keyboardMapper=null,this._onDidChangeKeyboardLayout.fire()})),this._register(t.onDidChangeConfiguration(async o=>{o.affectsConfiguration("keyboard")&&(this._keyboardMapper=null,this._onDidChangeKeyboardLayout.fire())}))}getRawKeyboardMapping(){return this._nativeKeyboardLayoutService.getRawKeyboardMapping()}getCurrentKeyboardLayout(){return this._nativeKeyboardLayoutService.getCurrentKeyboardLayout()}getAllKeyboardLayouts(){return[]}getKeyboardMapper(){let e=rAo(this._configurationService);return e.dispatch===1?new hGe(e.mapAltGrToCtrlAlt,Po):(this._keyboardMapper||(this._keyboardMapper=new N7t(cyn(this.getCurrentKeyboardLayout(),this.getRawKeyboardMapping(),e.mapAltGrToCtrlAlt))),this._keyboardMapper)}validateCurrentKeyboardMapping(e){}};Spt=I([m(0,j9t),m(1,B)],Spt);function cyn(a,i,e){let t=dyn(a);return Po===1?new nPe(t,i,e):!i||Object.keys(i).length===0?new hGe(e,Po):Po===2&&a.id==="com.apple.keylayout.DVORAK-QWERTYCMD"?new hGe(e,Po):new dse(t,i,e,Po)}function dyn(a){if(!a)return!1;if(Po===3){let i=a;return i.layout.split(/,/g)[i.group]==="us"}return Po===2?a.id==="com.apple.keylayout.US":Po===1?a.name==="00000409":!1}Ee(kVt,Spt,1);var Ipt=class extends BX{constructor(i,e,t){super(e.userHome,i,e,t)}};Ipt=I([m(0,bo),m(1,zr),m(2,Pe)],Ipt);Ee(An,Ipt,1);var use=class extends x{constructor(e,t,o,n){super();this.nativeHostService=e;this.storageService=o;this._onDidChangeColorScheme=this._register(new E);this.onDidChangeColorScheme=this._onDidChangeColorScheme.event;this._register(this.nativeHostService.onDidChangeColorScheme(s=>this.update(s)));let r=t.window.colorScheme;n.startupKind===3&&(r=this.getStoredValue(r)),this.dark=r.dark,this.highContrast=r.highContrast,this.nativeHostService.getOSColorScheme().then(s=>this.update(s))}static{this.STORAGE_KEY="HostColorSchemeData"}getStoredValue(e){let t=this.storageService.get(use.STORAGE_KEY,-1);if(t)try{let o=JSON.parse(t);if(xi(o)&&Wa(o.highContrast)&&Wa(o.dark))return o}catch{}return e}update({highContrast:e,dark:t}){(t!==this.dark||e!==this.highContrast)&&(this.dark=t,this.highContrast=e,this.storageService.store(use.STORAGE_KEY,JSON.stringify({highContrast:e,dark:t}),-1,1),this._onDidChangeColorScheme.fire())}};use=I([m(0,ko),m(1,zr),m(2,ce),m(3,ji)],use);Ee(AVt,use,1);var mSe=class extends Error{constructor(e,t){super(e);this.code=t}},pse=le("IExtensionsProfileScannerService"),gGe=class extends x{constructor(e,t,o,n,r){super();this.extensionsLocation=e;this.fileService=t;this.userDataProfilesService=o;this.uriIdentityService=n;this.logService=r;this._onAddExtensions=this._register(new E);this.onAddExtensions=this._onAddExtensions.event;this._onDidAddExtensions=this._register(new E);this.onDidAddExtensions=this._onDidAddExtensions.event;this._onRemoveExtensions=this._register(new E);this.onRemoveExtensions=this._onRemoveExtensions.event;this._onDidRemoveExtensions=this._register(new E);this.onDidRemoveExtensions=this._onDidRemoveExtensions.event;this.resourcesAccessQueueMap=new gt}scanProfileExtensions(e,t){return this.withProfileExtensions(e,void 0,t)}async addExtensionsToProfile(e,t,o){let n=[],r=[];try{return await this.withProfileExtensions(t,s=>{let l=[];if(o)l.push(...s);else for(let c of s)e.some(([u])=>Ut(u.identifier,c.identifier)&&u.manifest.version!==c.version)?n.push(c):l.push(c);for(let[c,u]of e){let p=l.findIndex(g=>Ut(g.identifier,c.identifier)&&g.version===c.manifest.version),h={identifier:c.identifier,version:c.manifest.version,location:c.location,metadata:u};p===-1?(r.push(h),l.push(h)):l.splice(p,1,h)}return r.length&&this._onAddExtensions.fire({extensions:r,profileLocation:t}),n.length&&this._onRemoveExtensions.fire({extensions:n,profileLocation:t}),l}),r.length&&this._onDidAddExtensions.fire({extensions:r,profileLocation:t}),n.length&&this._onDidRemoveExtensions.fire({extensions:n,profileLocation:t}),r}catch(s){throw r.length&&this._onDidAddExtensions.fire({extensions:r,error:s,profileLocation:t}),n.length&&this._onDidRemoveExtensions.fire({extensions:n,error:s,profileLocation:t}),s}}async updateMetadata(e,t){let o=[];return await this.withProfileExtensions(t,n=>{let r=[];for(let s of n){let l=e.find(([c])=>Ut({id:c.identifier.id},{id:s.identifier.id})&&c.manifest.version===s.version);l&&(s.metadata={...s.metadata,...l[1]},o.push(s)),r.push(s)}return r}),o}async removeExtensionsFromProfile(e,t){let o=[];try{await this.withProfileExtensions(t,n=>{let r=[];for(let s of n)e.some(l=>Ut(s.identifier,l))?o.push(s):r.push(s);return o.length&&this._onRemoveExtensions.fire({extensions:o,profileLocation:t}),r}),o.length&&this._onDidRemoveExtensions.fire({extensions:o,profileLocation:t})}catch(n){throw o.length&&this._onDidRemoveExtensions.fire({extensions:o,error:n,profileLocation:t}),n}}async withProfileExtensions(e,t,o){return this.getResourceAccessQueue(e).queue(async()=>{let n=[],r;try{let s=await this.fileService.readFile(e);r=JSON.parse(s.value.toString().trim()||"[]")}catch(s){if(Au(s)!==1)throw s;if(this.uriIdentityService.extUri.isEqual(e,this.userDataProfilesService.defaultProfile.extensionsResource)&&(r=await this.migrateFromOldDefaultProfileExtensionsLocation()),!r&&o?.bailOutWhenFileNotFound)throw new mSe(Pn(s),"ERROR_PROFILE_NOT_FOUND")}if(r){Array.isArray(r)||this.throwInvalidConentError(e);let s=!1;for(let l of r){sAo(l)||this.throwInvalidConentError(e);let c;if(Fe(l.relativeLocation)&&l.relativeLocation)c=this.resolveExtensionLocation(l.relativeLocation);else if(Fe(l.location)){this.logService.warn(`Extensions profile: Ignoring extension with invalid location: ${l.location}`);continue}else{c=A.revive(l.location);let p=this.toRelativePath(c);p&&(s=!0,l.relativeLocation=p)}gn(l.metadata?.hasPreReleaseVersion)&&l.metadata?.preRelease&&(s=!0,l.metadata.hasPreReleaseVersion=!0);let u=l.metadata?.id??l.identifier.uuid;n.push({identifier:u?{id:l.identifier.id,uuid:u}:{id:l.identifier.id},location:c,version:l.version,metadata:l.metadata})}s&&await this.fileService.writeFile(e,qe.fromString(JSON.stringify(r)))}if(t){n=t(n);let s=n.map(l=>({identifier:l.identifier,version:l.version,location:l.location.toJSON(),relativeLocation:this.toRelativePath(l.location),metadata:l.metadata}));await this.fileService.writeFile(e,qe.fromString(JSON.stringify(s)))}return n})}throwInvalidConentError(e){throw new mSe(`Invalid extensions content in ${e.toString()}`,"ERROR_INVALID_CONTENT")}toRelativePath(e){return this.uriIdentityService.extUri.isEqual(this.uriIdentityService.extUri.dirname(e),this.extensionsLocation)?this.uriIdentityService.extUri.basename(e):void 0}resolveExtensionLocation(e){return this.uriIdentityService.extUri.joinPath(this.extensionsLocation,e)}async migrateFromOldDefaultProfileExtensionsLocation(){return this._migrationPromise||(this._migrationPromise=(async()=>{let e=this.uriIdentityService.extUri.joinPath(this.userDataProfilesService.defaultProfile.location,"extensions.json"),t=this.uriIdentityService.extUri.joinPath(this.extensionsLocation,".init-default-profile-extensions"),o;try{o=(await this.fileService.readFile(e)).value.toString()}catch(r){if(Au(r)===1)return;throw r}this.logService.info("Migrating extensions from old default profile location",e.toString());let n;try{let r=JSON.parse(o);Array.isArray(r)&&r.every(s=>sAo(s))?n=r:this.logService.warn("Skipping migrating from old default profile locaiton: Found invalid data",r)}catch(r){this.logService.error(r)}if(n)try{await this.fileService.createFile(this.userDataProfilesService.defaultProfile.extensionsResource,qe.fromString(JSON.stringify(n)),{overwrite:!1}),this.logService.info("Migrated extensions from old default profile location to new location",e.toString(),this.userDataProfilesService.defaultProfile.extensionsResource.toString())}catch(r){if(Au(r)===3)this.logService.info("Migration from old default profile location to new location is done by another window",e.toString(),this.userDataProfilesService.defaultProfile.extensionsResource.toString());else throw r}try{await this.fileService.del(e)}catch(r){Au(r)!==1&&this.logService.error(r)}try{await this.fileService.del(t)}catch(r){Au(r)!==1&&this.logService.error(r)}return n})()),this._migrationPromise}getResourceAccessQueue(e){let t=this.resourcesAccessQueueMap.get(e);return t||(t=new uh,this.resourcesAccessQueueMap.set(e,t)),t}};gGe=I([m(1,fe),m(2,an),m(3,ht),m(4,se)],gGe);function sAo(a){let i=a;return xi(i)&&rJi(i.identifier)&&(uyn(i.location)||Fe(i.location)&&!!i.location)&&(gn(i.relativeLocation)||Fe(i.relativeLocation))&&!!i.version&&Fe(i.version)}function uyn(a){if(!a)return!1;let i=a;return typeof i?.path=="string"&&typeof i?.scheme=="string"}var aAo;(i=>{function a(e,t){if(e===t)return!0;let o=Object.keys(e),n=new Set;for(let r of Object.keys(t))n.add(r);if(o.length!==n.size)return!1;for(let r of o){if(e[r]!==t[r])return!1;n.delete(r)}return n.size===0}i.equals=a})(aAo||={});var a9=le("IExtensionsScannerService"),ypt=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this.systemExtensionsLocation=e;this.userExtensionsLocation=t;this.extensionsControlLocation=o;this.userDataProfilesService=r;this.extensionsProfileScannerService=s;this.fileService=l;this.logService=c;this.environmentService=u;this.productService=p;this.uriIdentityService=h;this.instantiationService=g;this._onDidChangeCache=this._register(new E);this.onDidChangeCache=this._onDidChangeCache.event;this.initializeDefaultProfileExtensionsPromise=void 0;this.systemExtensionsCachedScanner=this._register(this.instantiationService.createInstance(vGe,n)),this.userExtensionsCachedScanner=this._register(this.instantiationService.createInstance(vGe,n)),this.extensionsScanner=this._register(this.instantiationService.createInstance(fGe)),this._register(this.systemExtensionsCachedScanner.onDidChangeCache(()=>this._onDidChangeCache.fire(0))),this._register(this.userExtensionsCachedScanner.onDidChangeCache(()=>this._onDidChangeCache.fire(1)))}getTargetPlatform(){return this._targetPlatformPromise||(this._targetPlatformPromise=ATt(this.fileService,this.logService)),this._targetPlatformPromise}async scanAllExtensions(e,t){let[o,n]=await Promise.all([this.scanSystemExtensions(e),this.scanUserExtensions(t)]);return this.dedupExtensions(o,n,[],await this.getTargetPlatform(),!0)}async scanSystemExtensions(e){let t=[];t.push(this.scanDefaultSystemExtensions(e.language)),t.push(this.scanDevSystemExtensions(e.language,!!e.checkControlFile));let[o,n]=await Promise.all(t);return this.applyScanOptions([...o,...n],0,{pickLatest:!1})}async scanUserExtensions(e){this.logService.trace("Started scanning user extensions",e.profileLocation);let t=this.uriIdentityService.extUri.isEqual(e.profileLocation,this.userDataProfilesService.defaultProfile.extensionsResource)?{bailOutWhenFileNotFound:!0}:void 0,o=await this.createExtensionScannerInput(e.profileLocation,!0,1,e.language,!0,t,e.productVersion??this.getProductVersion()),n=e.useCache&&!o.devMode?this.userExtensionsCachedScanner:this.extensionsScanner,r;try{r=await n.scanExtensions(o)}catch(s){if(s instanceof mSe&&s.code==="ERROR_PROFILE_NOT_FOUND")await this.doInitializeDefaultProfileExtensions(),r=await n.scanExtensions(o);else throw s}return r=await this.applyScanOptions(r,1,{includeInvalid:e.includeInvalid,pickLatest:!0}),this.logService.trace("Scanned user extensions:",r.length),r}async scanAllUserExtensions(e={includeInvalid:!0,includeAllVersions:!0}){let t=await this.createExtensionScannerInput(this.userExtensionsLocation,!1,1,void 0,!0,void 0,this.getProductVersion()),o=await this.extensionsScanner.scanExtensions(t);return this.applyScanOptions(o,1,{includeAllVersions:e.includeAllVersions,includeInvalid:e.includeInvalid})}async scanExtensionsUnderDevelopment(e,t){if(this.environmentService.isExtensionDevelopment&&this.environmentService.extensionDevelopmentLocationURI){let o=(await Promise.all(this.environmentService.extensionDevelopmentLocationURI.filter(n=>n.scheme===Q.file).map(async n=>{let r=await this.createExtensionScannerInput(n,!1,1,t.language,!1,void 0,this.getProductVersion());return(await this.extensionsScanner.scanOneOrMultipleExtensions(r)).map(l=>(l.type=e.find(c=>Ut(c.identifier,l.identifier))?.type??l.type,this.extensionsScanner.validate(l,r)))}))).flat();return this.applyScanOptions(o,"development",{includeInvalid:t.includeInvalid,pickLatest:!0})}return[]}async scanExistingExtension(e,t,o){let n=await this.createExtensionScannerInput(e,!1,t,o.language,!0,void 0,this.getProductVersion()),r=await this.extensionsScanner.scanExtension(n);return!r||!o.includeInvalid&&!r.isValid?null:r}async scanOneOrMultipleExtensions(e,t,o){let n=await this.createExtensionScannerInput(e,!1,t,o.language,!0,void 0,this.getProductVersion()),r=await this.extensionsScanner.scanOneOrMultipleExtensions(n);return this.applyScanOptions(r,t,{includeInvalid:o.includeInvalid,pickLatest:!0})}async scanMultipleExtensions(e,t,o){let n=[];return await Promise.all(e.map(async r=>{let s=await this.scanOneOrMultipleExtensions(r,t,o);n.push(...s)})),this.applyScanOptions(n,t,{includeInvalid:o.includeInvalid,pickLatest:!0})}async updateManifestMetadata(e,t){let o=Ge(e,"package.json"),n=(await this.fileService.readFile(o)).value.toString(),r=JSON.parse(n);r.__metadata={...r.__metadata,...t},await this.fileService.writeFile(Ge(e,"package.json"),qe.fromString(JSON.stringify(r,null,"	")))}async initializeDefaultProfileExtensions(){try{await this.extensionsProfileScannerService.scanProfileExtensions(this.userDataProfilesService.defaultProfile.extensionsResource,{bailOutWhenFileNotFound:!0})}catch(e){if(e instanceof mSe&&e.code==="ERROR_PROFILE_NOT_FOUND")await this.doInitializeDefaultProfileExtensions();else throw e}}async doInitializeDefaultProfileExtensions(){return this.initializeDefaultProfileExtensionsPromise||(this.initializeDefaultProfileExtensionsPromise=(async()=>{try{this.logService.info("Started initializing default profile extensions in extensions installation folder.",this.userExtensionsLocation.toString());let e=await this.scanAllUserExtensions({includeInvalid:!0});if(e.length)await this.extensionsProfileScannerService.addExtensionsToProfile(e.map(t=>[t,t.metadata]),this.userDataProfilesService.defaultProfile.extensionsResource);else try{await this.fileService.createFile(this.userDataProfilesService.defaultProfile.extensionsResource,qe.fromString(JSON.stringify([])))}catch(t){Au(t)!==1&&this.logService.warn("Failed to create default profile extensions manifest in extensions installation folder.",this.userExtensionsLocation.toString(),Pn(t))}this.logService.info("Completed initializing default profile extensions in extensions installation folder.",this.userExtensionsLocation.toString())}catch(e){this.logService.error(e)}finally{this.initializeDefaultProfileExtensionsPromise=void 0}})()),this.initializeDefaultProfileExtensionsPromise}async applyScanOptions(e,t,o={}){return o.includeAllVersions||(e=this.dedupExtensions(t===0?e:void 0,t===1?e:void 0,t==="development"?e:void 0,await this.getTargetPlatform(),!!o.pickLatest)),o.includeInvalid||(e=e.filter(n=>n.isValid)),e.sort((n,r)=>{let s=jo(n.location.fsPath),l=jo(r.location.fsPath);return s<l?-1:s>l?1:0})}dedupExtensions(e,t,o,n,r){let s=(c,u,p)=>{if(!p){if(c.metadata?.isApplicationScoped&&!u.metadata?.isApplicationScoped)return!1;if(!c.metadata?.isApplicationScoped&&u.metadata?.isApplicationScoped)return!0}if(c.isValid&&!u.isValid)return!1;if(c.isValid===u.isValid){if(r&&zR(c.manifest.version,u.manifest.version))return this.logService.debug(`Skipping extension ${u.location.path} with lower version ${u.manifest.version} in favour of ${c.location.path} with version ${c.manifest.version}`),!1;if(BLt(c.manifest.version,u.manifest.version)){if(c.type===0)return this.logService.debug(`Skipping extension ${u.location.path} in favour of system extension ${c.location.path} with same version`),!1;if(c.targetPlatform===n)return this.logService.debug(`Skipping extension ${u.location.path} from different target platform ${u.targetPlatform}`),!1}}return p?this.logService.warn(`Overwriting user extension ${c.location.path} with ${u.location.path}.`):this.logService.debug(`Overwriting user extension ${c.location.path} with ${u.location.path}.`),!0},l=new iu;return e?.forEach(c=>{let u=l.get(c.identifier.id);(!u||s(u,c,!1))&&l.set(c.identifier.id,c)}),t?.forEach(c=>{let u=l.get(c.identifier.id);if(!u&&e&&c.type===0){this.logService.debug(`Skipping obsolete system extension ${c.location.path}.`);return}(!u||s(u,c,!1))&&l.set(c.identifier.id,c)}),o?.forEach(c=>{let u=l.get(c.identifier.id);(!u||s(u,c,!0))&&l.set(c.identifier.id,c),l.set(c.identifier.id,c)}),[...l.values()]}async scanDefaultSystemExtensions(e){this.logService.trace("Started scanning system extensions");let t=await this.createExtensionScannerInput(this.systemExtensionsLocation,!1,0,e,!0,void 0,this.getProductVersion()),n=await(t.devMode?this.extensionsScanner:this.systemExtensionsCachedScanner).scanExtensions(t);return this.logService.trace("Scanned system extensions:",n.length),n}async scanDevSystemExtensions(e,t){let o=this.environmentService.isBuilt?[]:this.productService.builtInExtensions;if(!o?.length)return[];this.logService.trace("Started scanning dev system extensions");let n=t?await this.getBuiltInExtensionControl():{},r=[],s=A.file(ch(Yc(vn.asFileUri("").fsPath,"..",".build","builtInExtensions")));for(let c of o){let u=n[c.name]||"marketplace";switch(u){case"disabled":break;case"marketplace":r.push(Ge(s,c.name));break;default:r.push(A.file(u));break}}let l=await Promise.all(r.map(async c=>this.extensionsScanner.scanExtension(await this.createExtensionScannerInput(c,!1,0,e,!0,void 0,this.getProductVersion()))));return this.logService.trace("Scanned dev system extensions:",l.length),di(l)}async getBuiltInExtensionControl(){try{let e=await this.fileService.readFile(this.extensionsControlLocation);return JSON.parse(e.value.toString())}catch{return{}}}async createExtensionScannerInput(e,t,o,n,r,s,l){let c=await this.getTranslations(n??wr),u=await this.getMtime(e),p=t&&!this.uriIdentityService.extUri.isEqual(e,this.userDataProfilesService.defaultProfile.extensionsResource)?this.userDataProfilesService.defaultProfile.extensionsResource:void 0,h=p?await this.getMtime(p):void 0;return new hSe(e,u,p,h,t,s,o,r,l.version,l.date,this.productService.commit,!this.environmentService.isBuilt,n,c)}async getMtime(e){try{let t=await this.fileService.stat(e);if(typeof t.mtime=="number")return t.mtime}catch{}}getProductVersion(){return{version:this.productService.version,date:this.productService.date}}};ypt=I([m(4,an),m(5,pse),m(6,fe),m(7,se),m(8,Eo),m(9,tt),m(10,ht),m(11,F)],ypt);var hSe=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f){this.location=i;this.mtime=e;this.applicationExtensionslocation=t;this.applicationExtensionslocationMtime=o;this.profile=n;this.profileScanOptions=r;this.type=s;this.validate=l;this.productVersion=c;this.productDate=u;this.productCommit=p;this.devMode=h;this.language=g;this.translations=f}static createNlsConfiguration(i){return{language:i.language,pseudo:i.language==="pseudo",devMode:i.devMode,translations:i.translations}}static equals(i,e){return Qe(i.location,e.location)&&i.mtime===e.mtime&&Qe(i.applicationExtensionslocation,e.applicationExtensionslocation)&&i.applicationExtensionslocationMtime===e.applicationExtensionslocationMtime&&i.profile===e.profile&&eo(i.profileScanOptions,e.profileScanOptions)&&i.type===e.type&&i.validate===e.validate&&i.productVersion===e.productVersion&&i.productDate===e.productDate&&i.productCommit===e.productCommit&&i.devMode===e.devMode&&i.language===e.language&&aAo.equals(i.translations,e.translations)}},fGe=class extends x{constructor(e,t,o,n,r,s){super();this.extensionsProfileScannerService=e;this.uriIdentityService=t;this.fileService=o;this.environmentService=r;this.logService=s;this.extensionsEnabledWithApiProposalVersion=n.extensionsEnabledWithApiProposalVersion?.map(l=>l.toLowerCase())??[]}async scanExtensions(e){return e.profile?this.scanExtensionsFromProfile(e):this.scanExtensionsFromLocation(e)}async scanExtensionsFromLocation(e){let t=await this.fileService.resolve(e.location);if(!t.children?.length)return[];let o=await Promise.all(t.children.map(async n=>{if(!n.isDirectory||e.type===1&&He(n.resource).indexOf(".")===0)return null;let r=new hSe(n.resource,e.mtime,e.applicationExtensionslocation,e.applicationExtensionslocationMtime,e.profile,e.profileScanOptions,e.type,e.validate,e.productVersion,e.productDate,e.productCommit,e.devMode,e.language,e.translations);return this.scanExtension(r)}));return di(o).sort((n,r)=>n.location.path<r.location.path?-1:1)}async scanExtensionsFromProfile(e){let t=await this.scanExtensionsFromProfileResource(e.location,()=>!0,e);if(e.applicationExtensionslocation&&!this.uriIdentityService.extUri.isEqual(e.location,e.applicationExtensionslocation)){t=t.filter(n=>!n.metadata?.isApplicationScoped);let o=await this.scanExtensionsFromProfileResource(e.applicationExtensionslocation,n=>!!n.metadata?.isBuiltin||!!n.metadata?.isApplicationScoped,e);t.push(...o)}return t}async scanExtensionsFromProfileResource(e,t,o){let n=await this.extensionsProfileScannerService.scanProfileExtensions(e,o.profileScanOptions);if(!n.length)return[];let r=await Promise.all(n.map(async s=>{if(t(s)){let l=new hSe(s.location,o.mtime,o.applicationExtensionslocation,o.applicationExtensionslocationMtime,o.profile,o.profileScanOptions,o.type,o.validate,o.productVersion,o.productDate,o.productCommit,o.devMode,o.language,o.translations);return this.scanExtension(l,s)}return null}));return di(r)}async scanOneOrMultipleExtensions(e){try{if(await this.fileService.exists(Ge(e.location,"package.json"))){let t=await this.scanExtension(e);return t?[t]:[]}else return await this.scanExtensions(e)}catch(t){return this.logService.error(`Error scanning extensions at ${e.location.path}:`,Pn(t)),[]}}async scanExtension(e,t){let o=[],n=!0,r;try{r=await this.scanExtensionManifest(e.location)}catch(g){if(t){o.push([bt.Error,Pn(g)]),n=!1;let[f,v]=t.identifier.id.split(".");r={name:v,publisher:f,version:t.version,engines:{vscode:""}}}else return e.type!==0&&this.logService.error(g),null}r.publisher||(r.publisher=Xxt);let s;t?s={...t.metadata,size:r.__metadata?.size}:r.__metadata&&(s={installedTimestamp:r.__metadata.installedTimestamp,size:r.__metadata.size,targetPlatform:r.__metadata.targetPlatform}),delete r.__metadata;let l=Qf(r.publisher,r.name),c=s?.id?{id:l,uuid:s.id}:{id:l},u=s?.isSystem?0:e.type,p=u===0||!!s?.isBuiltin;try{r=await this.translateManifest(e.location,r,hSe.createNlsConfiguration(e))}catch(g){this.logService.warn("Failed to translate manifest",Pn(g))}let h={type:u,identifier:c,manifest:r,location:e.location,isBuiltin:p,targetPlatform:s?.targetPlatform??"undefined",publisherDisplayName:s?.publisherDisplayName,metadata:s,isValid:n,validations:o,preRelease:!!s?.preRelease};return e.validate&&(h=this.validate(h,e)),r.enabledApiProposals&&(!this.environmentService.isBuilt||this.extensionsEnabledWithApiProposalVersion.includes(l.toLowerCase()))&&(r.originalEnabledApiProposals=r.enabledApiProposals,r.enabledApiProposals=nYi([...r.enabledApiProposals])),h}validate(e,t){let o=e.isValid,n=this.environmentService.isBuilt&&this.extensionsEnabledWithApiProposalVersion.includes(e.identifier.id.toLowerCase()),r=Zdo(t.productVersion,t.productDate,t.location,e.manifest,e.isBuiltin,n);for(let[s,l]of r)s===bt.Error&&(o=!1,this.logService.error(this.formatMessage(t.location,l)));return e.isValid=o,e.validations=[...e.validations,...r],e}async scanExtensionManifest(e){let t=Ge(e,"package.json"),o;try{o=(await this.fileService.readFile(t)).value.toString()}catch(r){throw Au(r)!==1&&this.logService.error(this.formatMessage(e,d(2083,null,t.path,r.message))),r}let n;try{n=JSON.parse(o)}catch(r){let s=[];jr(o,s);for(let l of s)this.logService.error(this.formatMessage(e,d(2085,null,t.path,l.offset,l.length,SF(l.error))));throw r}if(pk(n)!=="object"){let r=this.formatMessage(e,d(2086,null,t.path));throw this.logService.error(r),new Error(r)}return n}async translateManifest(e,t,o){let n=await this.getLocalizedMessages(e,t,o);if(n)try{let r=[],s=await this.resolveOriginalMessageBundle(n.default,r);if(r.length>0)return r.forEach(c=>{this.logService.error(this.formatMessage(e,d(2087,null,n.default?.path,SF(c.error))))}),t;if(pk(n)!=="object")return this.logService.error(this.formatMessage(e,d(2084,null,n.default?.path))),t;let l=n.values||Object.create(null);return QRe(this.logService,t,l,s)}catch{}return t}async getLocalizedMessages(e,t,o){let n=Ge(e,"package.nls.json"),r=(u,p)=>{p.forEach(h=>{this.logService.error(this.formatMessage(e,d(2087,null,u?.path,SF(h.error))))})},s=u=>{this.logService.error(this.formatMessage(e,d(2084,null,u?.path)))},l=`${t.publisher}.${t.name}`,c=o.translations[l];if(c)try{let u=A.file(c),p=(await this.fileService.readFile(u)).value.toString(),h=[],g=jr(p,h);return h.length>0?(r(u,h),{values:void 0,default:n}):pk(g)!=="object"?(s(u),{values:void 0,default:n}):{values:g.contents?g.contents.package:void 0,default:n}}catch{return{values:void 0,default:n}}else{if(!await this.fileService.exists(n))return;let p;try{p=await this.findMessageBundles(e,o)}catch{return}if(!p.localized)return{values:void 0,default:p.original};try{let h=(await this.fileService.readFile(p.localized)).value.toString(),g=[],f=jr(h,g);return g.length>0?(r(p.localized,g),{values:void 0,default:p.original}):pk(f)!=="object"?(s(p.localized),{values:void 0,default:p.original}):{values:f,default:p.original}}catch{return{values:void 0,default:p.original}}}}async resolveOriginalMessageBundle(e,t){if(e)try{let o=(await this.fileService.readFile(e)).value.toString();return jr(o,t)}catch{}}findMessageBundles(e,t){return new Promise((o,n)=>{let r=s=>{let l=Ge(e,`package.nls.${s}.json`);this.fileService.exists(l).then(c=>{c&&o({localized:l,original:Ge(e,"package.nls.json")});let u=s.lastIndexOf("-");u===-1?o({localized:Ge(e,"package.nls.json"),original:null}):(s=s.substring(0,u),r(s))})};if(t.devMode||t.pseudo||!t.language)return o({localized:Ge(e,"package.nls.json"),original:null});r(t.language)})}formatMessage(e,t){return`[${e.path}]: ${t}`}};fGe=I([m(0,pse),m(1,ht),m(2,fe),m(3,tt),m(4,Eo),m(5,se)],fGe);var vGe=class extends fGe{constructor(e,t,o,n,r,s,l,c){super(o,n,r,s,l,c);this.currentProfile=e;this.userDataProfilesService=t;this.cacheValidatorThrottler=this._register(new ya(3e3));this._onDidChangeCache=this._register(new E);this.onDidChangeCache=this._onDidChangeCache.event}async scanExtensions(e){let t=this.getCacheFile(e),o=await this.readExtensionCache(t);if(this.input=e,o&&o.input&&hSe.equals(o.input,this.input))return this.logService.debug("Using cached extensions scan result",e.type===0?"system":"user",e.location.toString()),this.cacheValidatorThrottler.trigger(()=>this.validateCache()),o.result.map(r=>(r.location=A.revive(r.location),r));let n=await super.scanExtensions(e);return await this.writeExtensionCache(t,{input:e,result:n}),n}async readExtensionCache(e){try{let t=await this.fileService.readFile(e),o=JSON.parse(t.value.toString());return{result:o.result,input:$n(o.input)}}catch(t){Au(t)!==1&&this.logService.debug("Error while reading the extension cache file:",e.path,Pn(t))}return null}async writeExtensionCache(e,t){try{await this.fileService.writeFile(e,qe.fromString(JSON.stringify(t)))}catch(o){this.logService.debug("Error while writing the extension cache file:",e.path,Pn(o))}}async validateCache(){if(!this.input)return;let e=this.getCacheFile(this.input),t=await this.readExtensionCache(e);if(!t)return;let o=t.result,n=JSON.parse(JSON.stringify(await super.scanExtensions(this.input)));if(!eo(n,o))try{this.logService.info("Invalidating Cache",o,n),await this.fileService.del(e),this._onDidChangeCache.fire()}catch(r){this.logService.error(r)}}getCacheFile(e){let t=this.getProfile(e);return this.uriIdentityService.extUri.joinPath(t.cacheHome,e.type===0?tYi:eYi)}getProfile(e){return e.type===0?this.userDataProfilesService.defaultProfile:e.profile?this.uriIdentityService.extUri.isEqual(e.location,this.currentProfile.extensionsResource)?this.currentProfile:this.userDataProfilesService.profiles.find(t=>this.uriIdentityService.extUri.isEqual(e.location,t.extensionsResource))??this.currentProfile:this.userDataProfilesService.defaultProfile}};vGe=I([m(1,an),m(2,pse),m(3,ht),m(4,fe),m(5,tt),m(6,Eo),m(7,se)],vGe);function V7t(a,i){let e=gS(a.manifest.publisher,a.manifest.name);return{id:e,identifier:new Ii(e),isBuiltin:a.type===0,isUserBuiltin:a.type===1&&a.isBuiltin,isUnderDevelopment:i,extensionLocation:a.location,uuid:a.identifier.uuid,targetPlatform:a.targetPlatform,publisherDisplayName:a.publisherDisplayName,preRelease:a.preRelease,...a.manifest}}var W7t=class extends ypt{constructor(i,e,t,o,n,r,s,l,c,u,p,h){super(i,e,Ge(t,".vscode-oss-dev","extensions","control.json"),o,n,r,s,l,c,u,p,h),this.translationsPromise=(async()=>{if(_Xt)try{let g=await this.fileService.readFile(A.file(_Xt));return JSON.parse(g.value.toString())}catch{}return Object.create(null)})()}getTranslations(i){return this.translationsPromise}};var l9=class extends x{constructor(e,t){super();this.productService=e;this.allowedExtensionsService=t;this.preferPreReleases=this.productService.quality!=="stable"}async canInstall(e){let t=this.allowedExtensionsService.isAllowed({id:e.identifier.id,publisherDisplayName:e.publisherDisplayName});if(t!==!0)return new Ie(d(2019,null,t.value));if(!await this.isExtensionPlatformCompatible(e)){let o=Wt?"https://aka.ms/vscode-web-extensions-guide":"https://aka.ms/vscode-platform-specific-extensions";return new Ie(`${d(2012,null,e.displayName??e.identifier.id,this.productService.nameLong,wQe(await this.getTargetPlatform()))} [${d(2014,null)}](${o})`)}return!0}async isExtensionPlatformCompatible(e){let t=await this.getTargetPlatform();return e.allTargetPlatforms.some(o=>Sde(o,e.allTargetPlatforms,t))}};l9=I([m(0,tt),m(1,dm)],l9);var B7t=class extends l9{constructor(e,t,o,n,r,s,l){super(r,s);this.galleryService=e;this.telemetryService=t;this.uriIdentityService=o;this.logService=n;this.userDataProfilesService=l;this.lastReportTimestamp=0;this.installingExtensions=new Map;this.uninstallingExtensions=new Map;this._onInstallExtension=this._register(new E);this._onDidInstallExtensions=this._register(new E);this._onUninstallExtension=this._register(new E);this._onDidUninstallExtension=this._register(new E);this._onDidUpdateExtensionMetadata=this._register(new E);this.participants=[];this._register(Z(()=>{this.installingExtensions.forEach(({task:c})=>c.cancel()),this.uninstallingExtensions.forEach(c=>c.cancel()),this.installingExtensions.clear(),this.uninstallingExtensions.clear()}))}get onInstallExtension(){return this._onInstallExtension.event}get onDidInstallExtensions(){return this._onDidInstallExtensions.event}get onUninstallExtension(){return this._onUninstallExtension.event}get onDidUninstallExtension(){return this._onDidUninstallExtension.event}get onDidUpdateExtensionMetadata(){return this._onDidUpdateExtensionMetadata.event}async installFromGallery(e,t={}){try{let o=await this.installGalleryExtensions([{extension:e,options:t}]),n=o.find(({identifier:s})=>Ut(s,e.identifier));if(n?.local)return n.local;if(n?.error)throw n.error;let r=o[0];if(r?.local)return r.local;throw r?.error?r.error:new vh(`Unknown error while installing extension ${e.identifier.id}`,"Unknown")}catch(o){throw wpt(o)}}async installGalleryExtensions(e){if(!this.galleryService.isEnabled())throw new vh(d(2016,null),"NotAllowed");let t=[],o=[];return await Promise.allSettled(e.map(async({extension:n,options:r})=>{try{let s=await this.checkAndGetCompatibleVersion(n,!!r?.installGivenVersion,!!r?.installPreReleaseVersion,r.productVersion??{version:this.productService.version,date:this.productService.date});o.push({...s,options:r})}catch(s){t.push({identifier:n.identifier,operation:2,source:n,error:s,profileLocation:r.profileLocation??this.getCurrentExtensionsManifestLocation()})}})),o.length&&t.push(...await this.installExtensions(o)),t}async uninstall(e,t){return this.logService.trace("ExtensionManagementService#uninstall",e.identifier.id),this.uninstallExtensions([{extension:e,options:t}])}async toggleApplicationScope(e,t){if(S5(e.manifest)||e.isBuiltin)return e;if(e.isApplicationScoped){let o=await this.updateMetadata(e,{isApplicationScoped:!1},this.userDataProfilesService.defaultProfile.extensionsResource);this.uriIdentityService.extUri.isEqual(t,this.userDataProfilesService.defaultProfile.extensionsResource)||(o=await this.copyExtension(e,this.userDataProfilesService.defaultProfile.extensionsResource,t));for(let n of this.userDataProfilesService.profiles){let r=(await this.getInstalled(1,n.extensionsResource)).find(s=>Ut(s.identifier,e.identifier));r?this._onDidUpdateExtensionMetadata.fire({local:r,profileLocation:n.extensionsResource}):this._onDidUninstallExtension.fire({identifier:e.identifier,profileLocation:n.extensionsResource})}return o}else{let o=this.uriIdentityService.extUri.isEqual(t,this.userDataProfilesService.defaultProfile.extensionsResource)?await this.updateMetadata(e,{isApplicationScoped:!0},this.userDataProfilesService.defaultProfile.extensionsResource):await this.copyExtension(e,t,this.userDataProfilesService.defaultProfile.extensionsResource,{isApplicationScoped:!0});return this._onDidInstallExtensions.fire([{identifier:o.identifier,operation:2,local:o,profileLocation:this.userDataProfilesService.defaultProfile.extensionsResource,applicationScoped:!0}]),o}}getExtensionsControlManifest(){let e=new Date().getTime();return(!this.extensionsControlManifest||e-this.lastReportTimestamp>1e3*60*5)&&(this.extensionsControlManifest=this.updateControlCache(),this.lastReportTimestamp=e),this.extensionsControlManifest}registerParticipant(e){this.participants.push(e)}async resetPinnedStateForAllUserExtensions(e){try{await this.joinAllSettled(this.userDataProfilesService.profiles.map(async t=>{let o=await this.getInstalled(1,t.extensionsResource);await this.joinAllSettled(o.map(async n=>{n.pinned!==e&&await this.updateMetadata(n,{pinned:e},t.extensionsResource)}))}))}catch(t){throw this.logService.error("Error while resetting pinned state for all user extensions",Pn(t)),t}}async installExtensions(e){let t=new Map,o=new Map,n=[],r=(c,u)=>`${MTt.create(c).toString()}-${u.toString()}`,s=(c,u,p,h)=>{let g;if(!A.isUri(u)){if(o.has(`${u.identifier.id.toLowerCase()}-${p.profileLocation.toString()}`))return;let b=this.installingExtensions.get(r(u,p.profileLocation));if(b){if(h&&this.canWaitForTask(h,b.task)){let S=b.task.identifier;this.logService.info("Waiting for already requested installing extension",S.id,h.identifier.id,p.profileLocation.toString()),b.waitingTasks.push(h),n.push(U.toPromise(U.filter(this.onDidInstallExtensions,y=>y.some(w=>Ut(w.identifier,S)))).then(y=>{this.logService.info("Finished waiting for already requested installing extension",S.id,h.identifier.id,p.profileLocation.toString());let w=y.find(k=>Ut(k.identifier,S));if(!w?.local)throw new Error(`Extension ${S.id} is not installed`);return w.local}))}return}g=this.uninstallingExtensions.get(this.getUninstallExtensionTaskKey(u.identifier,p.profileLocation))}let f=this.createInstallExtensionTask(c,u,p),v=`${Qf(c.publisher,c.name)}-${p.profileLocation.toString()}`;o.set(v,{task:f,root:h,uninstallTaskToWaitFor:g}),this._onInstallExtension.fire({identifier:f.identifier,source:u,profileLocation:p.profileLocation}),this.logService.info("Installing extension:",f.identifier.id,p),A.isUri(u)||this.installingExtensions.set(r(u,p.profileLocation),{task:f,waitingTasks:[]})};try{for(let{manifest:u,extension:p,options:h}of e){let g=h.isApplicationScoped||h.isBuiltin||S5(u),f={...h,isApplicationScoped:g,profileLocation:g?this.userDataProfilesService.defaultProfile.extensionsResource:h.profileLocation??this.getCurrentExtensionsManifestLocation(),productVersion:h.productVersion??{version:this.productService.version,date:this.productService.date}},v=A.isUri(p)?void 0:this.installingExtensions.get(r(p,f.profileLocation));v?(this.logService.info("Extension is already requested to install",v.task.identifier.id,f.profileLocation.toString()),n.push(v.task.waitUntilTaskIsFinished())):s(u,p,f,void 0)}await Promise.all([...o.values()].map(async({task:u})=>{if(u.options.donotIncludePackAndDependencies)this.logService.info("Installing the extension without checking dependencies and pack",u.identifier.id);else try{let p=this.preferPreReleases;u.options.installPreReleaseVersion?p=!0:!A.isUri(u.source)&&u.source.hasPreReleaseVersion&&(p=!1);let h=await this.getInstalled(void 0,u.options.profileLocation,u.options.productVersion),g=await this.getAllDepsAndPackExtensions(u.identifier,u.manifest,p,u.options.productVersion,h),f={...u.options,pinned:!1,installGivenVersion:!1,context:{...u.options.context,[gTt]:!0}};for(let{gallery:v,manifest:b}of zo(g,({gallery:S})=>S.identifier.id)){let S=h.find(y=>Ut(y.identifier,v.identifier));S&&S.isApplicationScoped===!!f.isApplicationScoped||s(b,v,f,u)}}catch(p){if(A.isUri(u.source))yr(u.manifest.extensionDependencies)&&this.logService.warn("Cannot install dependencies of extension:",u.identifier.id,p.message),yr(u.manifest.extensionPack)&&this.logService.warn("Cannot install packed extensions of extension:",u.identifier.id,p.message);else throw this.logService.error("Error while preparing to install dependencies and extension packs of the extension:",u.identifier.id),p}}));let c=await this.getOtherProfilesToUpdateExtension([...o.values()].map(({task:u})=>u));for(let[u,p]of c)s(p.manifest,p.source,{...p.options,profileLocation:u},void 0);await this.joinAllSettled([...o.entries()].map(async([u,{task:p,uninstallTaskToWaitFor:h}])=>{let g=new Date().getTime(),f;try{if(h){this.logService.info("Waiting for existing uninstall task to complete before installing",p.identifier.id);try{await h.waitUntilTaskIsFinished(),this.logService.info("Finished waiting for uninstall task, proceeding with install",p.identifier.id)}catch(v){this.logService.info("Uninstall task failed, proceeding with install anyway",p.identifier.id,Pn(v))}}f=await p.run(),await this.joinAllSettled(this.participants.map(v=>v.postInstall(f,p.source,p.options,Se.None)),"PostInstall")}catch(v){let b=wpt(v);throw A.isUri(p.source)||szi(this.telemetryService,p.operation===3?"extensionGallery:update":"extensionGallery:install",{extensionData:xde(p.source),error:b,source:p.options.context?.[bB]}),t.set(u,{error:b,identifier:p.identifier,operation:p.operation,source:p.source,context:p.options.context,profileLocation:p.options.profileLocation,applicationScoped:p.options.isApplicationScoped}),this.logService.error("Error while installing the extension",p.identifier.id,Pn(b),p.options.profileLocation.toString()),b}if(!A.isUri(p.source)){let v=p.operation===3,b=v?void 0:(new Date().getTime()-p.source.lastUpdated)/1e3;szi(this.telemetryService,v?"extensionGallery:update":"extensionGallery:install",{extensionData:xde(p.source),verificationStatus:p.verificationStatus,duration:new Date().getTime()-g,durationSinceUpdate:b,source:p.options.context?.[bB]})}t.set(u,{local:f,identifier:p.identifier,operation:p.operation,source:p.source,context:p.options.context,profileLocation:p.options.profileLocation,applicationScoped:f.isApplicationScoped})})),n.length&&await this.joinAllSettled(n)}catch(c){let u=(g,f,v)=>{let b=[];g.manifest.extensionDependencies?.length&&b.push(...g.manifest.extensionDependencies),g.manifest.extensionPack?.length&&b.push(...g.manifest.extensionPack);for(let S of b){if(v.includes(S.toLowerCase()))continue;v.push(S.toLowerCase());let y=t.get(`${S.toLowerCase()}-${f.toString()}`);y?.local&&(v=u(y.local,f,v))}return v},p=g=>({identifier:g.identifier,operation:2,source:g.source,context:g.options.context,profileLocation:g.options.profileLocation,error:c}),h=[];for(let[g,{task:f,root:v}]of o){let b=t.get(g);b?b.local&&v&&!t.get(`${v.identifier.id.toLowerCase()}-${f.options.profileLocation.toString()}`)?.local&&(h.push(this.createUninstallExtensionTask(b.local,{versionOnly:!0,profileLocation:f.options.profileLocation})),t.set(g,p(f))):(f.cancel(),t.set(g,p(f)))}for(let[g,{task:f}]of o){let v=t.get(g);if(!v?.local||f.options.donotIncludePackAndDependencies)continue;u(v.local,f.options.profileLocation,[v.local.identifier.id.toLowerCase()]).slice(1).some(S=>o.has(`${S.toLowerCase()}-${f.options.profileLocation.toString()}`)&&!t.get(`${S.toLowerCase()}-${f.options.profileLocation.toString()}`)?.local)&&(h.push(this.createUninstallExtensionTask(v.local,{versionOnly:!0,profileLocation:f.options.profileLocation})),t.set(g,p(f)))}h.length&&await Promise.allSettled(h.map(async g=>{try{await g.run(),this.logService.info("Rollback: Uninstalled extension",g.extension.identifier.id)}catch(f){this.logService.warn("Rollback: Error while uninstalling extension",g.extension.identifier.id,Pn(f))}}))}finally{for(let{task:c}of o.values())c.source&&!A.isUri(c.source)&&this.installingExtensions.delete(r(c.source,c.options.profileLocation))}let l=[...t.values()];for(let c of l)c.local&&this.logService.info("Extension installed successfully:",c.identifier.id,c.profileLocation.toString());return this._onDidInstallExtensions.fire(l),l}async getOtherProfilesToUpdateExtension(e){let t=[],o=new gt;for(let n of e)if(!(n.operation!==3||n.options.isApplicationScoped||n.options.pinned||n.options.installGivenVersion||A.isUri(n.source)))for(let r of this.userDataProfilesService.profiles){if(this.uriIdentityService.extUri.isEqual(r.extensionsResource,n.options.profileLocation))continue;let s=o.get(r.extensionsResource);s||(s=await this.getInstalled(1,r.extensionsResource),o.set(r.extensionsResource,s));let l=s.find(c=>Ut(c.identifier,n.identifier));l&&!l.pinned&&t.push([r.extensionsResource,n])}return t}canWaitForTask(e,t){for(let[,{task:o,waitingTasks:n}]of this.installingExtensions.entries())if(o===e&&(n.includes(t)||n.some(r=>this.canWaitForTask(r,t)))||o===t&&n[0]&&!this.canWaitForTask(e,n[0]))return!1;return!0}async joinAllSettled(e,t){let o=[],n=[],r=await Promise.allSettled(e);for(let l of r)l.status==="fulfilled"?o.push(l.value):n.push(wpt(l.reason,t));if(!n.length)return o;if(n.length===1)throw n[0];let s=new vh("","Unknown");for(let l of n)s=new vh(s.message?`${s.message}, ${l.message}`:l.message,l.code!=="Unknown"&&l.code!=="Internal"?l.code:s.code);throw s}async getAllDepsAndPackExtensions(e,t,o,n,r){if(!this.galleryService.isEnabled())return[];let s=[],l=[],c=async(u,p)=>{s.push(u);let h=p.extensionDependencies?p.extensionDependencies.filter(f=>!r.some(v=>Ut(v.identifier,{id:f}))):[],g=[...h];if(p.extensionPack){let f=r.find(v=>Ut(v.identifier,u));for(let v of p.extensionPack)f&&f.manifest.extensionPack&&f.manifest.extensionPack.some(b=>Ut({id:b},{id:v}))||g.every(b=>!Ut({id:b},{id:v}))&&g.push(v)}if(g.length){let f=g.filter(v=>s.every(b=>!Ut(b,{id:v})));if(f.length){let v=await this.galleryService.getExtensions(f.map(b=>({id:b,preRelease:o})),Se.None);for(let b of v){if(s.find(w=>Ut(w,b.identifier)))continue;let S=h.some(w=>Ut({id:w},b.identifier)),y;try{y=await this.checkAndGetCompatibleVersion(b,!1,o,n)}catch(w){if(S)throw w;this.logService.info("Skipping the packed extension as it cannot be installed",b.identifier.id,Pn(w));continue}l.push({gallery:y.extension,manifest:y.manifest}),await c(y.extension.identifier,y.manifest)}}}};return await c(e,t),l}async checkAndGetCompatibleVersion(e,t,o,n){let r,s=await this.getExtensionsControlManifest();if(NTt(e.identifier,s.malicious))throw new vh(d(2015,null,e.identifier.id),"Malicious");let l=s.deprecated[e.identifier.id.toLowerCase()];if(l?.extension?.autoMigrate){if(this.logService.info(`The '${e.identifier.id}' extension is deprecated, fetching the compatible '${l.extension.id}' extension instead.`),r=(await this.galleryService.getExtensions([{id:l.extension.id,preRelease:l.extension.preRelease}],{targetPlatform:await this.getTargetPlatform(),compatible:!0,productVersion:n},Se.None))[0],!r)throw new vh(d(2021,null,e.identifier.id,l.extension.id),"Deprecated")}else{if(await this.canInstall(e)!==!0){let u=await this.getTargetPlatform();throw new vh(d(2012,null,e.identifier.id,this.productService.nameLong,wQe(u)),"IncompatibleTargetPlatform")}if(r=await this.getCompatibleVersion(e,t,o,n),!r){let u=[];throw z3(e.properties.enabledApiProposals??[],u)?!o&&e.hasPreReleaseVersion&&e.properties.isPreReleaseVersion&&(await this.galleryService.getExtensions([e.identifier],Se.None))[0]?new vh(d(2022,null,e.displayName??e.identifier.id),"ReleaseVersionNotFound"):new vh(d(2020,null,e.identifier.id,this.productService.nameLong,this.productService.version),"Incompatible"):new vh(d(2013,null,e.displayName??e.identifier.id,u[0]),"IncompatibleApi")}}this.logService.info("Getting Manifest...",r.identifier.id);let c=await this.galleryService.getManifest(r,Se.None);if(c===null)throw new vh(`Missing manifest for extension ${r.identifier.id}`,"Invalid");if(c.version!==r.version)throw new vh(`Cannot install '${r.identifier.id}' extension because of version mismatch in Marketplace`,"Invalid");return{extension:r,manifest:c}}async getCompatibleVersion(e,t,o,n){let r=await this.getTargetPlatform(),s=null;return!t&&e.hasPreReleaseVersion&&e.properties.isPreReleaseVersion!==o&&(s=(await this.galleryService.getExtensions([{...e.identifier,preRelease:o}],{targetPlatform:r,compatible:!0,productVersion:n},Se.None))[0]||null),!s&&await this.galleryService.isExtensionCompatible(e,o,r,n)&&(s=e),s||(t?s=(await this.galleryService.getExtensions([{...e.identifier,version:e.version}],{targetPlatform:r,compatible:!0,productVersion:n},Se.None))[0]||null:s=await this.galleryService.getCompatibleExtension(e,o,r,n)),s}getUninstallExtensionTaskKey(e,t,o){return`${e.id.toLowerCase()}${o?`-${o}`:""}@${t.toString()}`}async uninstallExtensions(e){let t=(h,g)=>this.getUninstallExtensionTaskKey(h.identifier,g.profileLocation,g.versionOnly?h.manifest.version:void 0),o=(h,g)=>{let f;for(let{task:b}of this.installingExtensions.values())if(!(b.source instanceof A)&&Ut(b.identifier,h.identifier)&&this.uriIdentityService.extUri.isEqual(b.options.profileLocation,g.profileLocation)){f=b;break}let v=this.createUninstallExtensionTask(h,g);this.uninstallingExtensions.set(t(v.extension,g),v),this.logService.info("Uninstalling extension from the profile:",`${h.identifier.id}@${h.manifest.version}`,g.profileLocation.toString()),this._onUninstallExtension.fire({identifier:h.identifier,profileLocation:g.profileLocation,applicationScoped:h.isApplicationScoped}),r.push({task:v,installTaskToWaitFor:f})},n=(h,g,f)=>{f?this.logService.error("Failed to uninstall extension from the profile:",`${h.identifier.id}@${h.manifest.version}`,g.profileLocation.toString(),f.message):this.logService.info("Successfully uninstalled extension from the profile",`${h.identifier.id}@${h.manifest.version}`,g.profileLocation.toString()),szi(this.telemetryService,"extensionGallery:uninstall",{extensionData:PTt(h),error:f}),this._onDidUninstallExtension.fire({identifier:h.identifier,error:f?.code,profileLocation:g.profileLocation,applicationScoped:h.isApplicationScoped})},r=[],s=[],l=[],c=[],u=new gt,p=async h=>{let g=u.get(h);return g||u.set(h,g=await this.getInstalled(1,h)),g};for(let{extension:h,options:g}of e){let f={...g,profileLocation:h.isApplicationScoped?this.userDataProfilesService.defaultProfile.extensionsResource:g?.profileLocation??this.getCurrentExtensionsManifestLocation()},v=this.uninstallingExtensions.get(t(h,f));if(v?(this.logService.info("Extensions is already requested to uninstall",h.identifier.id),l.push(v.waitUntilTaskIsFinished())):o(h,f),f.remove||h.isApplicationScoped){f.remove&&c.push(h);for(let b of this.userDataProfilesService.profiles){if(this.uriIdentityService.extUri.isEqual(b.extensionsResource,f.profileLocation))continue;let y=(await p(b.extensionsResource)).find(w=>Ut(w.identifier,h.identifier));if(y){let w={...f,profileLocation:b.extensionsResource},k=this.uninstallingExtensions.get(t(y,w));k?(this.logService.info("Extensions is already requested to uninstall",y.identifier.id),l.push(k.waitUntilTaskIsFinished())):o(y,w)}}}}try{for(let{task:h}of r.slice(0)){let g=await p(h.options.profileLocation);if(h.options.donotIncludePack)this.logService.info("Uninstalling the extension without including packed extension",`${h.extension.identifier.id}@${h.extension.manifest.version}`);else{let f=this.getAllPackExtensionsToUninstall(h.extension,g);for(let v of f)this.uninstallingExtensions.has(t(v,h.options))?this.logService.info("Extensions is already requested to uninstall",v.identifier.id):o(v,h.options)}h.options.donotCheckDependents?this.logService.info("Uninstalling the extension without checking dependents",`${h.extension.identifier.id}@${h.extension.manifest.version}`):this.checkForDependents(r.map(({task:f})=>f.extension),g,h.extension)}await this.joinAllSettled(r.map(async({task:h,installTaskToWaitFor:g})=>{try{if(g){this.logService.info("Waiting for existing install task to complete before uninstalling",h.extension.identifier.id);try{await g.waitUntilTaskIsFinished(),this.logService.info("Finished waiting for install task, proceeding with uninstall",h.extension.identifier.id)}catch(f){this.logService.info("Install task failed, proceeding with uninstall anyway",h.extension.identifier.id,Pn(f))}}if(await h.run(),await this.joinAllSettled(this.participants.map(f=>f.postUninstall(h.extension,h.options,Se.None))),h.extension.identifier.uuid&&!Wt)try{await this.galleryService.reportStatistic(h.extension.manifest.publisher,h.extension.manifest.name,h.extension.manifest.version,"uninstall")}catch{}}catch(f){let v=wpt(f);throw n(h.extension,h.options,v),v}finally{s.push(h)}})),l.length&&await this.joinAllSettled(l);for(let{task:h}of r)n(h.extension,h.options);c.length&&await this.joinAllSettled(c.map(h=>this.deleteExtension(h)))}catch(h){let g=wpt(h);for(let{task:f}of r){try{f.cancel()}catch{}s.includes(f)||n(f.extension,f.options,g)}throw g}finally{for(let{task:h}of r)this.uninstallingExtensions.delete(t(h.extension,h.options))||this.logService.warn("Uninstallation task is not found in the cache",h.extension.identifier.id)}}checkForDependents(e,t,o){for(let n of e){let r=this.getDependents(n,t);if(r.length){let s=r.filter(l=>!e.some(c=>Ut(c.identifier,l.identifier)));if(s.length)throw new Error(this.getDependentsErrorMessage(n,s,o))}}}getDependentsErrorMessage(e,t,o){return o===e?t.length===1?d(2023,null,o.manifest.displayName||o.manifest.name,t[0].manifest.displayName||t[0].manifest.name):t.length===2?d(2025,null,o.manifest.displayName||o.manifest.name,t[0].manifest.displayName||t[0].manifest.name,t[1].manifest.displayName||t[1].manifest.name):d(2017,null,o.manifest.displayName||o.manifest.name,t[0].manifest.displayName||t[0].manifest.name,t[1].manifest.displayName||t[1].manifest.name):t.length===1?d(2024,null,o.manifest.displayName||o.manifest.name,e.manifest.displayName||e.manifest.name,t[0].manifest.displayName||t[0].manifest.name):t.length===2?d(2026,null,o.manifest.displayName||o.manifest.name,e.manifest.displayName||e.manifest.name,t[0].manifest.displayName||t[0].manifest.name,t[1].manifest.displayName||t[1].manifest.name):d(2018,null,o.manifest.displayName||o.manifest.name,e.manifest.displayName||e.manifest.name,t[0].manifest.displayName||t[0].manifest.name,t[1].manifest.displayName||t[1].manifest.name)}getAllPackExtensionsToUninstall(e,t,o=[]){if(o.indexOf(e)!==-1)return[];if(Ut(e.identifier,{id:this.productService.defaultChatAgent.extensionId}))return[];o.push(e);let n=e.manifest.extensionPack?e.manifest.extensionPack:[];if(n.length){let r=t.filter(l=>!l.isBuiltin&&n.some(c=>Ut({id:c},l.identifier))),s=[];for(let l of r)s.push(...this.getAllPackExtensionsToUninstall(l,t,o));return[...r,...s]}return[]}getDependents(e,t){return t.filter(o=>o.manifest.extensionDependencies&&o.manifest.extensionDependencies.some(n=>Ut({id:n},e.identifier)))}async updateControlCache(){try{return this.logService.trace("ExtensionManagementService.updateControlCache"),await this.galleryService.getExtensionsControlManifest()}catch(e){return this.logService.trace("ExtensionManagementService.refreshControlCache - failed to get extension control manifest",Pn(e)),{malicious:[],deprecated:{},search:[]}}}};B7t=I([m(0,fa),m(1,Te),m(2,ht),m(3,se),m(4,tt),m(5,dm),m(6,an)],B7t);function wpt(a,i){if(a instanceof vh)return a;let e;return a instanceof XE?e=new vh(a.message,a.code==="DownloadFailedWriting"?"DownloadFailedWriting":"Gallery"):e=new vh(a.message,ao(a)?"Cancelled":i??"Internal"),e.stack=a.stack,e}function szi(a,i,{extensionData:e,verificationStatus:t,duration:o,error:n,source:r,durationSinceUpdate:s}){a.publicLog(i,{...e,source:r,duration:o,durationSinceUpdate:s,success:!n,errorcode:n?.code,verificationStatus:t==="Success"?"Verified":t??"Unverified"})}var H7t="extensions.trustedPublishers";function pyn(a){return a.type==="gallery"}var bGe=class extends l9{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w){super(s,S);this.extensionManagementServerService=e;this.extensionGalleryService=t;this.userDataProfileService=o;this.userDataProfilesService=n;this.configurationService=r;this.downloadService=l;this.userDataSyncEnablementService=c;this.dialogService=u;this.workspaceTrustRequestService=p;this.extensionManifestPropertiesService=h;this.fileService=g;this.logService=f;this.instantiationService=v;this.extensionsScannerService=b;this.storageService=y;this.telemetryService=w;this._onInstallExtension=this._register(new E);this._onDidInstallExtensions=this._register(new E);this._onUninstallExtension=this._register(new E);this._onDidUninstallExtension=this._register(new E);this._onDidProfileAwareInstallExtensions=this._register(new E);this._onDidProfileAwareUninstallExtension=this._register(new E);this.servers=[];this.defaultTrustedPublishers=s.trustedExtensionPublishers??[],this.workspaceExtensionManagementService=this._register(this.instantiationService.createInstance(c9)),this.onDidEnableExtensions=this.workspaceExtensionManagementService.onDidChangeInvalidExtensions,this.extensionManagementServerService.localExtensionManagementServer&&this.servers.push(this.extensionManagementServerService.localExtensionManagementServer),this.extensionManagementServerService.remoteExtensionManagementServer&&this.servers.push(this.extensionManagementServerService.remoteExtensionManagementServer),this.extensionManagementServerService.webExtensionManagementServer&&this.servers.push(this.extensionManagementServerService.webExtensionManagementServer);let k=this._register(new AI);this._register(k.add(this._onInstallExtension.event)),this.onInstallExtension=k.event;let T=this._register(new AI);this._register(T.add(this._onDidInstallExtensions.event)),this.onDidInstallExtensions=T.event;let P=this._register(new AI);this._register(P.add(this._onDidProfileAwareInstallExtensions.event)),this.onProfileAwareDidInstallExtensions=P.event;let O=this._register(new AI);this._register(O.add(this._onUninstallExtension.event)),this.onUninstallExtension=O.event;let V=this._register(new AI);this._register(V.add(this._onDidUninstallExtension.event)),this.onDidUninstallExtension=V.event;let H=this._register(new AI);this._register(H.add(this._onDidProfileAwareUninstallExtension.event)),this.onProfileAwareDidUninstallExtension=H.event;let G=this._register(new AI);this.onDidUpdateExtensionMetadata=G.event;let $=this._register(new AI);this.onProfileAwareDidUpdateExtensionMetadata=$.event;let J=this._register(new AI);this.onDidChangeProfile=J.event;for(let ae of this.servers)this._register(k.add(U.map(ae.extensionManagementService.onInstallExtension,he=>({...he,server:ae})))),this._register(T.add(ae.extensionManagementService.onDidInstallExtensions)),this._register(P.add(ae.extensionManagementService.onProfileAwareDidInstallExtensions)),this._register(O.add(U.map(ae.extensionManagementService.onUninstallExtension,he=>({...he,server:ae})))),this._register(V.add(U.map(ae.extensionManagementService.onDidUninstallExtension,he=>({...he,server:ae})))),this._register(H.add(U.map(ae.extensionManagementService.onProfileAwareDidUninstallExtension,he=>({...he,server:ae})))),this._register(G.add(ae.extensionManagementService.onDidUpdateExtensionMetadata)),this._register($.add(ae.extensionManagementService.onProfileAwareDidUpdateExtensionMetadata)),this._register(J.add(U.map(ae.extensionManagementService.onDidChangeProfile,he=>({...he,server:ae}))));this._register(this.onProfileAwareDidInstallExtensions(ae=>{let he=new Map;for(let oe of ae)oe.local&&oe.source&&!A.isUri(oe.source)&&!this.isPublisherTrusted(oe.source)&&he.set(oe.source.publisher,{publisher:oe.source.publisher,publisherDisplayName:oe.source.publisherDisplayName});he.size&&this.trustPublishers(...he.values())}))}async getInstalled(e,t,o){let n=[];return await Promise.all(this.servers.map(async r=>{let s=await r.extensionManagementService.getInstalled(e,t,o);if(r===this.getWorkspaceExtensionsServer()){let l=await this.getInstalledWorkspaceExtensions(!0);s.push(...l)}n.push(...s)})),n}uninstall(e,t){return this.uninstallExtensions([{extension:e,options:t}])}async uninstallExtensions(e){let t=[],o=new Map,n=(c,u,p)=>{let h=o.get(c);h||o.set(c,h=[]),h.push({extension:u,options:p})};for(let{extension:c,options:u}of e){if(c.isWorkspaceScoped){t.push(c);continue}let p=this.getServer(c);if(!p)throw new Error(`Invalid location ${c.location.toString()}`);if(n(p,c,u),this.servers.length>1&&IR(c.manifest)){let h=this.servers.filter(g=>g!==p);for(let g of h){let v=(await g.extensionManagementService.getInstalled()).find(b=>!b.isBuiltin&&Ut(b.identifier,c.identifier));v&&n(g,v,u)}}}let r=[];for(let c of t)r.push(this.uninstallExtensionFromWorkspace(c));for(let[c,u]of o.entries())r.push(this.uninstallInServer(c,u));let l=(await Promise.allSettled(r)).filter(c=>c.status==="rejected").map(c=>c.reason);if(l.length)throw new Error(l.map(c=>c.message).join(`
`))}async uninstallInServer(e,t){if(e===this.extensionManagementServerService.localExtensionManagementServer&&this.extensionManagementServerService.remoteExtensionManagementServer)for(let{extension:o}of t){let r=(await this.extensionManagementServerService.remoteExtensionManagementServer.extensionManagementService.getInstalled(1)).filter(s=>!this.extensionManifestPropertiesService.prefersExecuteOnUI(s.manifest)&&s.manifest.extensionDependencies&&s.manifest.extensionDependencies.some(l=>Ut({id:l},o.identifier)));if(r.length)throw new Error(this.getDependentsErrorMessage(o,r))}return e.extensionManagementService.uninstallExtensions(t)}getDependentsErrorMessage(e,t){return t.length===1?d(17620,null,e.manifest.displayName||e.manifest.name,t[0].manifest.displayName||t[0].manifest.name):t.length===2?d(17624,null,e.manifest.displayName||e.manifest.name,t[0].manifest.displayName||t[0].manifest.name,t[1].manifest.displayName||t[1].manifest.name):d(17616,null,e.manifest.displayName||e.manifest.name,t[0].manifest.displayName||t[0].manifest.name,t[1].manifest.displayName||t[1].manifest.name)}updateMetadata(e,t){let o=this.getServer(e);if(o){let n=e.isApplicationScoped?this.userDataProfilesService.defaultProfile:this.userDataProfileService.currentProfile;return o.extensionManagementService.updateMetadata(e,t,n.extensionsResource)}return Promise.reject(`Invalid location ${e.location.toString()}`)}async resetPinnedStateForAllUserExtensions(e){await Promise.allSettled(this.servers.map(t=>t.extensionManagementService.resetPinnedStateForAllUserExtensions(e)))}zip(e){let t=this.getServer(e);return t?t.extensionManagementService.zip(e):Promise.reject(`Invalid location ${e.location.toString()}`)}download(e,t,o){if(this.extensionManagementServerService.localExtensionManagementServer)return this.extensionManagementServerService.localExtensionManagementServer.extensionManagementService.download(e,t,o);throw new Error("Cannot download extension")}async install(e,t){let o=await this.getManifest(e);return this.installVSIX(e,o,t)}async installVSIX(e,t,o){let n=this.getServersToInstall(t);if(n?.length){await this.checkForWorkspaceTrust(t,!1);let[r]=await dn.settled(n.map(s=>this.installVSIXInServer(e,s,o)));return r}return Promise.reject("No Servers to Install")}getServersToInstall(e){if(this.extensionManagementServerService.localExtensionManagementServer&&this.extensionManagementServerService.remoteExtensionManagementServer)return IR(e)?[this.extensionManagementServerService.localExtensionManagementServer,this.extensionManagementServerService.remoteExtensionManagementServer]:this.extensionManifestPropertiesService.prefersExecuteOnUI(e)?[this.extensionManagementServerService.localExtensionManagementServer]:[this.extensionManagementServerService.remoteExtensionManagementServer];if(this.extensionManagementServerService.localExtensionManagementServer)return[this.extensionManagementServerService.localExtensionManagementServer];if(this.extensionManagementServerService.remoteExtensionManagementServer)return[this.extensionManagementServerService.remoteExtensionManagementServer]}async installFromLocation(e){if(e.scheme===Q.file){if(this.extensionManagementServerService.localExtensionManagementServer)return this.extensionManagementServerService.localExtensionManagementServer.extensionManagementService.installFromLocation(e,this.userDataProfileService.currentProfile.extensionsResource);throw new Error("Local extension management server is not found")}if(e.scheme===Q.vscodeRemote){if(this.extensionManagementServerService.remoteExtensionManagementServer)return this.extensionManagementServerService.remoteExtensionManagementServer.extensionManagementService.installFromLocation(e,this.userDataProfileService.currentProfile.extensionsResource);throw new Error("Remote extension management server is not found")}if(!this.extensionManagementServerService.webExtensionManagementServer)throw new Error("Web extension management server is not found");return this.extensionManagementServerService.webExtensionManagementServer.extensionManagementService.installFromLocation(e,this.userDataProfileService.currentProfile.extensionsResource)}installVSIXInServer(e,t,o){return t.extensionManagementService.install(e,o)}getManifest(e){return e.scheme===Q.file&&this.extensionManagementServerService.localExtensionManagementServer?this.extensionManagementServerService.localExtensionManagementServer.extensionManagementService.getManifest(e):e.scheme===Q.file&&this.extensionManagementServerService.remoteExtensionManagementServer?this.extensionManagementServerService.remoteExtensionManagementServer.extensionManagementService.getManifest(e):e.scheme===Q.vscodeRemote&&this.extensionManagementServerService.remoteExtensionManagementServer?this.extensionManagementServerService.remoteExtensionManagementServer.extensionManagementService.getManifest(e):Promise.reject("No Servers")}async canInstall(e){return pyn(e)?this.canInstallGalleryExtension(e):this.canInstallResourceExtension(e)}async canInstallGalleryExtension(e){if(this.extensionManagementServerService.localExtensionManagementServer&&await this.extensionManagementServerService.localExtensionManagementServer.extensionManagementService.canInstall(e)===!0)return!0;let t=await this.extensionGalleryService.getManifest(e,Se.None);return t?this.extensionManagementServerService.remoteExtensionManagementServer&&await this.extensionManagementServerService.remoteExtensionManagementServer.extensionManagementService.canInstall(e)===!0&&this.extensionManifestPropertiesService.canExecuteOnWorkspace(t)||this.extensionManagementServerService.webExtensionManagementServer&&await this.extensionManagementServerService.webExtensionManagementServer.extensionManagementService.canInstall(e)===!0&&this.extensionManifestPropertiesService.canExecuteOnWeb(t)?!0:new Ie().appendText(d(17588,null,e.displayName||e.name)):new Ie().appendText(d(17609,null))}async canInstallResourceExtension(e){return this.extensionManagementServerService.localExtensionManagementServer||this.extensionManagementServerService.remoteExtensionManagementServer&&this.extensionManifestPropertiesService.canExecuteOnWorkspace(e.manifest)||this.extensionManagementServerService.webExtensionManagementServer&&this.extensionManifestPropertiesService.canExecuteOnWeb(e.manifest)?!0:new Ie().appendText(d(17588,null,e.manifest.displayName??e.identifier.id))}async updateFromGallery(e,t,o){let n=this.getServer(t);if(!n)return Promise.reject(`Invalid location ${t.location.toString()}`);let r=[];return IR(t.manifest)?r.push(...this.servers.filter(s=>s!==this.extensionManagementServerService.webExtensionManagementServer)):r.push(n),o={...o||{},isApplicationScoped:t.isApplicationScoped},dn.settled(r.map(s=>s.extensionManagementService.installFromGallery(e,o))).then(([s])=>s)}async installGalleryExtensions(e){let t=new Map,o=new Map,n=await Promise.all(e.map(async({extension:r})=>{let s=await this.extensionGalleryService.getManifest(r,Se.None);if(!s)throw new Error(d(17610,null,r.displayName||r.name));return s}));return e.some(r=>r.options?.context?.[TR]!==!0)&&await this.checkForTrustedPublishers(e.map((r,s)=>({extension:r.extension,manifest:n[s],checkForPackAndDependencies:!r.options?.donotIncludePackAndDependencies}))),await Promise.all(e.map(async({extension:r,options:s})=>{try{let l=await this.extensionGalleryService.getManifest(r,Se.None);if(!l)throw new Error(d(17610,null,r.displayName||r.name));s?.context?.[bB]!=="settingsSync"&&(await this.checkForWorkspaceTrust(l,!1),s?.donotIncludePackAndDependencies||await this.checkInstallingExtensionOnWeb(r,l));let c=await this.getExtensionManagementServersToInstall(r,l);!s.isMachineScoped&&this.isExtensionsSyncEnabled()&&this.extensionManagementServerService.localExtensionManagementServer&&!c.includes(this.extensionManagementServerService.localExtensionManagementServer)&&await this.extensionManagementServerService.localExtensionManagementServer.extensionManagementService.canInstall(r)===!0&&c.push(this.extensionManagementServerService.localExtensionManagementServer);for(let u of c){let p=o.get(u);p||o.set(u,p=[]),p.push({extension:r,options:s})}}catch(l){t.set(r.identifier.id.toLowerCase(),{identifier:r.identifier,source:r,error:l,operation:2,profileLocation:s.profileLocation??this.userDataProfileService.currentProfile.extensionsResource})}})),await Promise.all([...o.entries()].map(async([r,s])=>{let l=await r.extensionManagementService.installGalleryExtensions(s);for(let c of l)t.set(c.identifier.id.toLowerCase(),c)})),[...t.values()]}async installFromGallery(e,t,o){let n=await this.extensionGalleryService.getManifest(e,Se.None);if(!n)throw new Error(d(17610,null,e.displayName||e.name));if(t?.context?.[TR]!==!0&&await this.checkForTrustedPublishers([{extension:e,manifest:n,checkForPackAndDependencies:!t?.donotIncludePackAndDependencies}]),t?.context?.[bB]!=="settingsSync"&&(await this.checkForWorkspaceTrust(n,!1),t?.donotIncludePackAndDependencies||await this.checkInstallingExtensionOnWeb(e,n)),o=o?.length?this.validServers(e,n,o):await this.getExtensionManagementServersToInstall(e,n),!t||gn(t.isMachineScoped)){let r=await this.hasToFlagExtensionsMachineScoped([e]);t={...t||{},isMachineScoped:r}}return!t.isMachineScoped&&this.isExtensionsSyncEnabled()&&this.extensionManagementServerService.localExtensionManagementServer&&!o.includes(this.extensionManagementServerService.localExtensionManagementServer)&&await this.extensionManagementServerService.localExtensionManagementServer.extensionManagementService.canInstall(e)===!0&&o.push(this.extensionManagementServerService.localExtensionManagementServer),dn.settled(o.map(r=>r.extensionManagementService.installFromGallery(e,t))).then(([r])=>r)}async getExtensions(e){let t=await this.extensionsScannerService.scanMultipleExtensions(e,1,{includeInvalid:!0}),o=[];return await Promise.all(t.map(async n=>{let r=await this.workspaceExtensionManagementService.toLocalWorkspaceExtension(n);r&&o.push({type:"resource",identifier:r.identifier,location:r.location,manifest:r.manifest,changelogUri:r.changelogUrl,readmeUri:r.readmeUrl})})),o}getInstalledWorkspaceExtensionLocations(){return this.workspaceExtensionManagementService.getInstalledWorkspaceExtensionsLocations()}async getInstalledWorkspaceExtensions(e){return this.workspaceExtensionManagementService.getInstalled(e)}async installResourceExtension(e,t){if(!this.canInstallResourceExtension(e))throw new Error("This extension cannot be installed in the current workspace.");if(!t.isWorkspaceScoped)return this.installFromLocation(e.location);this.logService.info(`Installing the extension ${e.identifier.id} from ${e.location.toString()} in workspace`);let o=this.getWorkspaceExtensionsServer();this._onInstallExtension.fire({identifier:e.identifier,source:e.location,server:o,applicationScoped:!1,profileLocation:this.userDataProfileService.currentProfile.extensionsResource,workspaceScoped:!0});try{await this.checkForWorkspaceTrust(e.manifest,!0);let n=await this.workspaceExtensionManagementService.install(e);return this.logService.info(`Successfully installed the extension ${n.identifier.id} from ${e.location.toString()} in the workspace`),this._onDidInstallExtensions.fire([{identifier:n.identifier,source:e.location,operation:2,applicationScoped:!1,profileLocation:this.userDataProfileService.currentProfile.extensionsResource,local:n,workspaceScoped:!0}]),n}catch(n){throw this.logService.error(`Failed to install the extension ${e.identifier.id} from ${e.location.toString()} in the workspace`,Pn(n)),this._onDidInstallExtensions.fire([{identifier:e.identifier,source:e.location,operation:2,applicationScoped:!1,profileLocation:this.userDataProfileService.currentProfile.extensionsResource,error:n,workspaceScoped:!0}]),n}}async getInstallableServers(e){let t=await this.extensionGalleryService.getManifest(e,Se.None);return t?this.getInstallableExtensionManagementServers(t):Promise.reject(d(17610,null,e.displayName||e.name))}async uninstallExtensionFromWorkspace(e){if(!e.isWorkspaceScoped)throw new Error("The extension is not a workspace extension");this.logService.info(`Uninstalling the workspace extension ${e.identifier.id} from ${e.location.toString()}`);let t=this.getWorkspaceExtensionsServer();this._onUninstallExtension.fire({identifier:e.identifier,server:t,applicationScoped:!1,workspaceScoped:!0,profileLocation:this.userDataProfileService.currentProfile.extensionsResource});try{await this.workspaceExtensionManagementService.uninstall(e),this.logService.info(`Successfully uninstalled the workspace extension ${e.identifier.id} from ${e.location.toString()}`),this.telemetryService.publicLog2("workspaceextension:uninstall"),this._onDidUninstallExtension.fire({identifier:e.identifier,server:t,applicationScoped:!1,workspaceScoped:!0,profileLocation:this.userDataProfileService.currentProfile.extensionsResource})}catch(o){throw this.logService.error(`Failed to uninstall the workspace extension ${e.identifier.id} from ${e.location.toString()}`,Pn(o)),this._onDidUninstallExtension.fire({identifier:e.identifier,server:t,error:o,applicationScoped:!1,workspaceScoped:!0,profileLocation:this.userDataProfileService.currentProfile.extensionsResource}),o}}validServers(e,t,o){let n=this.getInstallableExtensionManagementServers(t);for(let r of o)if(!n.includes(r)){let s=new Error(d(17589,null,e.displayName||e.name,r.label));throw s.name="Unsupported",s}return o}async getExtensionManagementServersToInstall(e,t){let o=[];if(IR(t))o.push(...this.servers.filter(n=>n!==this.extensionManagementServerService.webExtensionManagementServer));else{let[n]=this.getInstallableExtensionManagementServers(t);n&&o.push(n)}if(!o.length){let n=new Error(d(17588,null,e.displayName||e.name));throw n.name="Unsupported",n}return o}getInstallableExtensionManagementServers(e){if(this.servers.length===1&&this.extensionManagementServerService.localExtensionManagementServer)return[this.extensionManagementServerService.localExtensionManagementServer];let t=[],o=this.extensionManifestPropertiesService.getExtensionKind(e);for(let n of o)n==="ui"&&this.extensionManagementServerService.localExtensionManagementServer&&t.push(this.extensionManagementServerService.localExtensionManagementServer),n==="workspace"&&this.extensionManagementServerService.remoteExtensionManagementServer&&t.push(this.extensionManagementServerService.remoteExtensionManagementServer),n==="web"&&this.extensionManagementServerService.webExtensionManagementServer&&t.push(this.extensionManagementServerService.webExtensionManagementServer);return this.extensionManagementServerService.localExtensionManagementServer&&!t.includes(this.extensionManagementServerService.localExtensionManagementServer)&&t.push(this.extensionManagementServerService.localExtensionManagementServer),t}isExtensionsSyncEnabled(){return this.userDataSyncEnablementService.isEnabled()&&this.userDataSyncEnablementService.isResourceEnabled("extensions")}async hasToFlagExtensionsMachineScoped(e){if(this.isExtensionsSyncEnabled()){let{result:t}=await this.dialogService.prompt({type:bt.Info,message:e.length===1?d(17602,null):d(17603,null),detail:e.length===1?d(17605,null,e[0].displayName):d(17604,null),buttons:[{label:d(17599,null),run:()=>!1},{label:d(17600,null),run:()=>!0}],cancelButton:{run:()=>{throw new go}}});return t}return!1}getExtensionsControlManifest(){return this.extensionManagementServerService.localExtensionManagementServer?this.extensionManagementServerService.localExtensionManagementServer.extensionManagementService.getExtensionsControlManifest():this.extensionManagementServerService.remoteExtensionManagementServer?this.extensionManagementServerService.remoteExtensionManagementServer.extensionManagementService.getExtensionsControlManifest():this.extensionManagementServerService.webExtensionManagementServer?this.extensionManagementServerService.webExtensionManagementServer.extensionManagementService.getExtensionsControlManifest():this.extensionGalleryService.getExtensionsControlManifest()}getServer(e){return e.isWorkspaceScoped?this.getWorkspaceExtensionsServer():this.extensionManagementServerService.getExtensionManagementServer(e)}getWorkspaceExtensionsServer(){if(this.extensionManagementServerService.remoteExtensionManagementServer)return this.extensionManagementServerService.remoteExtensionManagementServer;if(this.extensionManagementServerService.localExtensionManagementServer)return this.extensionManagementServerService.localExtensionManagementServer;if(this.extensionManagementServerService.webExtensionManagementServer)return this.extensionManagementServerService.webExtensionManagementServer;throw new Error("No extension server found")}async requestPublisherTrust(e){let t=await Promise.all(e.map(async({extension:o})=>{let n=await this.extensionGalleryService.getManifest(o,Se.None);if(!n)throw new Error(d(17610,null,o.displayName||o.name));return n}));await this.checkForTrustedPublishers(e.map((o,n)=>({extension:o.extension,manifest:t[n],checkForPackAndDependencies:!o.options?.donotIncludePackAndDependencies})))}async checkForTrustedPublishers(e){let t=[],o=[],n=[];for(let{extension:b,manifest:S,checkForPackAndDependencies:y}of e)!b.private&&!this.isPublisherTrusted(b)&&(t.push(b),o.push(S),y&&n.push(S));if(!t.length)return;let r=n.length?await this.getOtherUntrustedPublishers(n):[],s=[...zo(t,b=>b.publisher),...r],l=s.filter(b=>!b.publisherDomain?.verified),c=s.filter(b=>b.publisherDomain?.verified),u={label:s.length>1?d(17623,null):d(17622,null),run:()=>{this.telemetryService.publicLog2("extensions:trustPublisher",{action:"trust",extensionId:t.map(b=>b.identifier.id).join(",")}),this.trustPublishers(...s.map(b=>({publisher:b.publisher,publisherDisplayName:b.publisherDisplayName})))}},p={label:d(17606,null),run:()=>{throw this.telemetryService.publicLog2("extensions:trustPublisher",{action:"learn",extensionId:t.map(b=>b.identifier.id).join(",")}),this.instantiationService.invokeFunction(b=>b.get(ge).executeCommand("vscode.open",A.parse("https://aka.ms/vscode-extension-security"))),new go}},h=({publisherDisplayName:b,publisherLink:S})=>S?`[${b}](${S})`:b,g="https://aka.ms/vscode-verify-publisher",f=s.length===1?d(17591,null,s[0].publisherDisplayName):s.length===2?d(17592,null,s[0].publisherDisplayName,s[1].publisherDisplayName):d(17590,null,s[0].publisherDisplayName,s.length-1),v=new Ie("",{supportThemeIcons:!0,isTrusted:!0});if(t.length===1){let b=t[0],S=o[0];if(r.length){v.appendMarkdown(d(17593,null,`[${b.displayName}](${b.detailsLink})`,h(b))),v.appendMarkdown("&nbsp;");let y=fc("extension.open",b.identifier.id,S.extensionPack?.length?"extensionPack":"dependencies").toString();r.length===1?v.appendMarkdown(d(17621,null,y,h(r[0]))):v.appendMarkdown(d(17613,null,y,r.slice(0,r.length-1).map(w=>h(w)).join(", "),h(r[r.length-1]))),v.appendMarkdown("&nbsp;"),v.appendMarkdown(d(17598,null))}else v.appendMarkdown(d(17611,null,`[${b.displayName}](${b.detailsLink})`,h(b)))}else v.appendMarkdown(d(17615,null,h(s[0]),h(s[s.length-1])));if(c.length||l.length===1){for(let b of c){v.appendText(`
`);let S=d(17627,null,h(b),`[$(link-external) ${A.parse(b.publisherDomain.link).authority}](${b.publisherDomain.link})`);v.appendMarkdown(`$(${gW.id})&nbsp;${S}`)}l.length&&(v.appendText(`
`),l.length===1?v.appendMarkdown(`$(${R.unverified.id})&nbsp;${d(17626,null,h(l[0]),g)}`):v.appendMarkdown(`$(${R.unverified.id})&nbsp;${d(17625,null,l.slice(0,l.length-1).map(b=>h(b)).join(", "),h(l[l.length-1]),g)}`))}else v.appendText(`
`),v.appendMarkdown(`$(${R.unverified.id})&nbsp;${d(17587,null,g)}`);v.appendText(`
`),s.length>1?v.appendMarkdown(d(17614,null,this.productService.nameLong)):v.appendMarkdown(d(17612,null,this.productService.nameLong)),await this.dialogService.prompt({message:f,type:bt.Warning,buttons:[u,p],cancelButton:{run:()=>{throw this.telemetryService.publicLog2("extensions:trustPublisher",{action:"cancel",extensionId:t.map(b=>b.identifier.id).join(",")}),new go}},custom:{markdownDetails:[{markdown:v,classes:["extensions-management-publisher-trust-dialog"]}]}})}async getOtherUntrustedPublishers(e){let t=new Set;for(let r of e)for(let s of[...r.extensionPack??[],...r.extensionDependencies??[]]){let[l]=s.split(".");l.toLowerCase()!==r.publisher.toLowerCase()&&(this.isPublisherUserTrusted(l.toLowerCase())||t.add(s.toLowerCase()))}if(!t.size)return[];let o=new Map;await this.getDependenciesAndPackedExtensionsRecursively([...t],o,Se.None);let n=new Map;for(let[,r]of o)r.private||this.isPublisherTrusted(r)||n.set(r.publisherDisplayName,r);return[...n.values()]}async getDependenciesAndPackedExtensionsRecursively(e,t,o){if(e.length===0)return;let n=await this.extensionGalleryService.getExtensions(e.map(r=>({id:r})),o);for(let r=0;r<n.length;r++){let s=n[r];t.set(s.identifier.id.toLowerCase(),s)}e=[];for(let r of n){if(yr(r.properties.dependencies))for(let s of r.properties.dependencies)t.has(s.toLowerCase())||e.push(s);if(yr(r.properties.extensionPack))for(let s of r.properties.extensionPack)t.has(s.toLowerCase())||e.push(s)}return this.getDependenciesAndPackedExtensionsRecursively(e,t,o)}async checkForWorkspaceTrust(e,t){if(t||this.extensionManifestPropertiesService.getExtensionUntrustedWorkspaceSupportType(e)===!1){let o=[];if(o.push({label:d(17594,null),type:"ContinueWithTrust"}),t||o.push({label:d(17595,null),type:"ContinueWithoutTrust"}),o.push({label:d(17596,null),type:"Manage"}),await this.workspaceTrustRequestService.requestWorkspaceTrust({message:d(17597,null),buttons:o})===void 0)throw new go}}async checkInstallingExtensionOnWeb(e,t){if(this.servers.length!==1||this.servers[0]!==this.extensionManagementServerService.webExtensionManagementServer)return;let o=[];if(t.extensionPack?.length){let v=await this.extensionGalleryService.getExtensions(t.extensionPack.map(b=>({id:b})),Se.None);for(let b of v)await this.servers[0].extensionManagementService.canInstall(b)!==!0&&o.push(b);if(o.length&&o.length===v.length)throw new vh("Not supported in Web","Unsupported")}let n=d(17628,null,this.productService.nameLong),r=this.extensionManifestPropertiesService.getExtensionVirtualWorkspaceSupportType(t),s=Gce(t.capabilities?.virtualWorkspaces),l=r==="limited"||!!s;if(!o.length&&!l)return;let c=d(17607,null,e.displayName||e.identifier.id,n),u,p=[],h,g={label:d(17601,null),run:()=>{}},f={label:d(17619,null),run:()=>this.instantiationService.invokeFunction(v=>v.get(ge).executeCommand("extension.open",e.identifier.id,"extensionPack"))};o.length&&l?(u=c,h=`${s?`${s}
`:""}${d(17618,null)}`,p=[g,f]):l?(u=c,h=s||void 0,p=[g]):(u=d(17617,null,e.displayName||e.identifier.id,n),p=[g,f]),await this.dialogService.prompt({type:bt.Info,message:u,detail:h,buttons:p,cancelButton:{run:()=>{throw new go}}})}getTargetPlatform(){return this._targetPlatformPromise||(this._targetPlatformPromise=ATt(this.fileService,this.logService)),this._targetPlatformPromise}async cleanUp(){await Promise.allSettled(this.servers.map(e=>e.extensionManagementService.cleanUp()))}toggleApplicationScope(e,t){let o=this.getServer(e);if(o)return o.extensionManagementService.toggleApplicationScope(e,t);throw new Error("Not Supported")}copyExtensions(e,t){if(this.extensionManagementServerService.remoteExtensionManagementServer)throw new Error("Not Supported");return this.extensionManagementServerService.localExtensionManagementServer?this.extensionManagementServerService.localExtensionManagementServer.extensionManagementService.copyExtensions(e,t):this.extensionManagementServerService.webExtensionManagementServer?this.extensionManagementServerService.webExtensionManagementServer.extensionManagementService.copyExtensions(e,t):Promise.resolve()}registerParticipant(){throw new Error("Not Supported")}installExtensionsFromProfile(e,t,o){throw new Error("Not Supported")}isPublisherTrusted(e){let t=e.publisher.toLowerCase();return this.defaultTrustedPublishers.includes(t)||this.defaultTrustedPublishers.includes(e.publisherDisplayName.toLowerCase())||this.allowedExtensionsService.allowedExtensionsConfigValue&&this.allowedExtensionsService.isAllowed(e)?!0:this.isPublisherUserTrusted(t)}isPublisherUserTrusted(e){return!!this.getTrustedPublishersFromStorage()[e]}getTrustedPublishers(){let e=this.getTrustedPublishersFromStorage();return Object.keys(e).map(t=>e[t])}trustPublishers(...e){let t=this.getTrustedPublishersFromStorage();for(let o of e)t[o.publisher.toLowerCase()]=o;this.storageService.store(H7t,JSON.stringify(t),-1,0)}untrustPublishers(...e){let t=this.getTrustedPublishersFromStorage();for(let o of e)delete t[o.toLowerCase()];this.storageService.store(H7t,JSON.stringify(t),-1,0)}getTrustedPublishersFromStorage(){let e=this.storageService.getObject(H7t,-1,{});return Array.isArray(e)?(this.storageService.remove(H7t,-1),Object.create(null)):Object.keys(e).reduce((t,o)=>(t[o.toLowerCase()]=e[o],t),Object.create(null))}};bGe=I([m(0,Ec),m(1,fa),m(2,ln),m(3,an),m(4,B),m(5,tt),m(6,i0),m(7,Fl),m(8,at),m(9,Vu),m(10,Gp),m(11,fe),m(12,se),m(13,F),m(14,a9),m(15,dm),m(16,ce),m(17,Te)],bGe);var c9=class extends x{constructor(e,t,o,n,r,s,l){super();this.fileService=e;this.logService=t;this.workspaceService=o;this.extensionsScannerService=n;this.storageService=r;this.uriIdentityService=s;this.telemetryService=l;this._onDidChangeInvalidExtensions=this._register(new E);this.onDidChangeInvalidExtensions=this._onDidChangeInvalidExtensions.event;this.extensions=[];this.invalidExtensionWatchers=this._register(new N);this._register(U.throttle(this.fileService.onDidFilesChange,(c,u)=>((c=c??[]).push(u),c),1e3,!1)(c=>{let u=this.extensions.filter(p=>!p.isValid&&c.some(h=>h.affects(p.location)));u.length&&this.checkExtensionsValidity(u)})),this.initializePromise=this.initialize()}static{this.WORKSPACE_EXTENSIONS_KEY="workspaceExtensions.locations"}async initialize(){let e=this.getInstalledWorkspaceExtensionsLocations();e.length&&(await Promise.allSettled(e.map(async t=>{if(!this.workspaceService.isInsideWorkspace(t)){this.logService.info(`Removing the workspace extension ${t.toString()} as it is not inside the workspace`);return}if(!await this.fileService.exists(t)){this.logService.info(`Removing the workspace extension ${t.toString()} as it does not exist`);return}try{let o=await this.scanWorkspaceExtension(t);o?this.extensions.push(o):this.logService.info(`Skipping workspace extension ${t.toString()} as it does not exist`)}catch(o){this.logService.error("Skipping the workspace extension",t.toString(),o)}})),this.saveWorkspaceExtensions())}watchInvalidExtensions(){this.invalidExtensionWatchers.clear();for(let e of this.extensions)e.isValid||this.invalidExtensionWatchers.add(this.fileService.watch(e.location))}async checkExtensionsValidity(e){let t=[];await Promise.all(e.map(async n=>{let r=await this.scanWorkspaceExtension(n.location);r?.isValid&&t.push(r)}));let o=!1;for(let n of t){let r=this.extensions.findIndex(s=>this.uriIdentityService.extUri.isEqual(s.location,n.location));r!==-1&&(o=!0,this.extensions.splice(r,1,n))}o&&(this.saveWorkspaceExtensions(),this._onDidChangeInvalidExtensions.fire(t))}async getInstalled(e){return await this.initializePromise,this.extensions.filter(t=>e||t.isValid)}async install(e){await this.initializePromise;let t=await this.scanWorkspaceExtension(e.location);if(!t)throw new Error("Cannot install the extension as it does not exist.");let o=this.extensions.findIndex(n=>Ut(n.identifier,e.identifier));return o===-1?this.extensions.push(t):this.extensions.splice(o,1,t),this.saveWorkspaceExtensions(),this.telemetryService.publicLog2("workspaceextension:install"),t}async uninstall(e){await this.initializePromise;let t=this.extensions.findIndex(o=>Ut(o.identifier,e.identifier));t!==-1&&(this.extensions.splice(t,1),this.saveWorkspaceExtensions()),this.telemetryService.publicLog2("workspaceextension:uninstall")}getInstalledWorkspaceExtensionsLocations(){let e=[];try{let t=JSON.parse(this.storageService.get(c9.WORKSPACE_EXTENSIONS_KEY,1,"[]"));if(Array.isArray(e))for(let o of t)Fe(o)?this.workspaceService.getWorkbenchState()===2?e.push(this.workspaceService.getWorkspace().folders[0].toResource(o)):this.logService.warn(`Invalid value for 'extensions' in workspace storage: ${o}`):e.push(A.revive(o));else this.logService.warn(`Invalid value for 'extensions' in workspace storage: ${e}`)}catch(t){this.logService.warn(`Error parsing workspace extensions locations: ${Pn(t)}`)}return e}saveWorkspaceExtensions(){let e=this.extensions.map(t=>t.location);this.workspaceService.getWorkbenchState()===2?this.storageService.store(c9.WORKSPACE_EXTENSIONS_KEY,JSON.stringify(di(e.map(t=>this.uriIdentityService.extUri.relativePath(this.workspaceService.getWorkspace().folders[0].uri,t)))),1,1):this.storageService.store(c9.WORKSPACE_EXTENSIONS_KEY,JSON.stringify(e),1,1),this.watchInvalidExtensions()}async scanWorkspaceExtension(e){let t=await this.extensionsScannerService.scanExistingExtension(e,1,{includeInvalid:!0});return t?this.toLocalWorkspaceExtension(t):null}async toLocalWorkspaceExtension(e){let t=await this.fileService.resolve(e.location),o,n;t.children&&(o=t.children.find(({name:l})=>/^readme(\.txt|\.md|)$/i.test(l))?.resource,n=t.children.find(({name:l})=>/^changelog(\.txt|\.md|)$/i.test(l))?.resource);let r=[...e.validations],s=e.isValid;return e.manifest.main&&(await this.fileService.exists(this.uriIdentityService.extUri.joinPath(e.location,e.manifest.main))||(s=!1,r.push([bt.Error,d(17608,null,e.manifest.main)]))),{identifier:e.identifier,type:e.type,isBuiltin:e.isBuiltin||!!e.metadata?.isBuiltin,location:e.location,manifest:e.manifest,targetPlatform:e.targetPlatform,validations:r,isValid:s,readmeUrl:o,changelogUrl:n,publisherDisplayName:e.metadata?.publisherDisplayName,publisherId:e.metadata?.publisherId||null,isApplicationScoped:!!e.metadata?.isApplicationScoped,isMachineScoped:!!e.metadata?.isMachineScoped,isPreReleaseVersion:!!e.metadata?.isPreReleaseVersion,hasPreReleaseVersion:!!e.metadata?.hasPreReleaseVersion,preRelease:!!e.metadata?.preRelease,installedTimestamp:e.metadata?.installedTimestamp,updated:!!e.metadata?.updated,pinned:!!e.metadata?.pinned,isWorkspaceScoped:!0,private:!1,source:"resource",size:e.metadata?.size??0}}};c9=I([m(0,fe),m(1,se),m(2,Pe),m(3,a9),m(4,ce),m(5,ht),m(6,Te)],c9);var Cpt=class extends bGe{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k){super(t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k);this.environmentService=e}async installVSIXInServer(e,t,o){if(e.scheme===Q.vscodeRemote&&t===this.extensionManagementServerService.localExtensionManagementServer){let n=Ge(this.environmentService.tmpDir,xt());await this.downloadService.download(e,n,"extensionManagement.downloadRemoteVsix"),e=n}return super.installVSIXInServer(e,t,o)}};Cpt=I([m(0,zr),m(1,Ec),m(2,fa),m(3,ln),m(4,an),m(5,B),m(6,tt),m(7,i0),m(8,Fl),m(9,at),m(10,Vu),m(11,Gp),m(12,fe),m(13,se),m(14,F),m(15,a9),m(16,dm),m(17,ce),m(18,Te)],Cpt);Ee(ru,Cpt,1);var azi=["v0.1","v0"],SGe=class extends x{constructor(e,t,o){super();this.productService=e;this.requestService=t;this.logService=o;this.onDidChangeMcpGalleryManifest=U.None;this.onDidChangeMcpGalleryManifestStatus=U.None;this.versionByUrl=new Map}get mcpGalleryManifestStatus(){return this.productService.mcpGallery?.serviceUrl?"available":"unavailable"}async getMcpGalleryManifest(){return this.productService.mcpGallery?this.createMcpGalleryManifest(this.productService.mcpGallery.serviceUrl,azi[0]):null}async createMcpGalleryManifest(e,t){if(e=e.endsWith("/")?e.slice(0,-1):e,!t){let s=this.versionByUrl.get(e);s||this.versionByUrl.set(e,s=this.getVersion(e)),t=await s}let o=this.productService.mcpGallery?.serviceUrl===e,n=`${e}/${t}/servers`,r=[{id:n,type:"McpServersQueryService"},{id:`${n}/{name}/versions/{version}`,type:"McpServerVersionUriTemplate"},{id:`${n}/{name}/versions/latest`,type:"McpServerLatestVersionUriTemplate"}];return o&&(r.push({id:`${n}/by-name/{name}`,type:"McpServerNamedResourceUriTemplate"}),r.push({id:this.productService.mcpGallery.itemWebUrl,type:"McpServerWebUriTemplate"}),r.push({id:this.productService.mcpGallery.publisherUrl,type:"PublisherUriTemplate"}),r.push({id:this.productService.mcpGallery.supportUrl,type:"ContactSupportUri"}),r.push({id:this.productService.mcpGallery.supportUrl,type:"ContactSupportUri"}),r.push({id:this.productService.mcpGallery.privacyPolicyUrl,type:"PrivacyPolicyUri"}),r.push({id:this.productService.mcpGallery.termsOfServiceUrl,type:"TermsOfServiceUri"}),r.push({id:this.productService.mcpGallery.reportUrl,type:"ReportUri"})),t==="v0"&&r.push({id:`${n}/{id}`,type:"McpServerIdUriTemplate"}),{version:t,url:e,resources:r}}async getVersion(e){for(let t of azi)if(await this.checkVersion(e,t))return t;return azi[0]}async checkVersion(e,t){try{let o=await this.requestService.request({type:"GET",url:`${e}/${t}/servers?limit=1`,callSite:"mcpGalleryManifestService.checkVersion"},Se.None);if(ZP(o))return!0;this.logService.info(`The service at ${e} does not support version ${t}. Service returned status ${o.res.statusCode}.`)}catch(o){this.logService.error(o)}return!1}};SGe=I([m(0,tt),m(1,Ea),m(2,se)],SGe);var IGe=class extends SGe{constructor(e,t,o,n,r){super(e,o,n);this.configurationService=r;this.mcpGalleryManifest=null;this._onDidChangeMcpGalleryManifest=this._register(new E);this.onDidChangeMcpGalleryManifest=this._onDidChangeMcpGalleryManifest.event;this.currentStatus="unavailable";this._onDidChangeMcpGalleryManifestStatus=this._register(new E);this.onDidChangeMcpGalleryManifestStatus=this._onDidChangeMcpGalleryManifestStatus.event;let s=t.getConnection();if(s){let l=s.getChannel("mcpGalleryManifest");this.getMcpGalleryManifest().then(c=>{l.call("setMcpGalleryManifest",[c]),this._register(this.onDidChangeMcpGalleryManifest(u=>l.call("setMcpGalleryManifest",[u])))})}}get mcpGalleryManifestStatus(){return this.currentStatus}async getMcpGalleryManifest(){return this.initPromise||(this.initPromise=this.doGetMcpGalleryManifest()),await this.initPromise,this.mcpGalleryManifest}async doGetMcpGalleryManifest(){await this.getAndUpdateMcpGalleryManifest(),this._register(this.configurationService.onDidChangeConfiguration(e=>{(e.affectsConfiguration(t8)||e.affectsConfiguration("chat.mcp.gallery.version"))&&this.getAndUpdateMcpGalleryManifest()}))}async getAndUpdateMcpGalleryManifest(){let e=this.configurationService.getValue("chat.mcp.gallery");e?.serviceUrl?this.update(await this.createMcpGalleryManifest(e.serviceUrl,e.version)):this.update(await super.getMcpGalleryManifest())}update(e){this.mcpGalleryManifest?.url===e?.url&&this.mcpGalleryManifest?.version===e?.version||(this.mcpGalleryManifest=e,this.mcpGalleryManifest?this.logService.trace("MCP Registry configured:",this.mcpGalleryManifest.url):this.logService.trace("No MCP Registry configured"),this.currentStatus=this.mcpGalleryManifest?"available":"unavailable",this._onDidChangeMcpGalleryManifest.fire(this.mcpGalleryManifest),this._onDidChangeMcpGalleryManifestStatus.fire(this.currentStatus))}};IGe=I([m(0,tt),m(1,bo),m(2,Ea),m(3,se),m(4,B)],IGe);var xpt=class extends IGe{constructor(i,e,t,o,n,r){super(i,e,t,o,r);let s=n.getChannel("mcpGalleryManifest");this.getMcpGalleryManifest().then(l=>{s.call("setMcpGalleryManifest",[l]),this._register(this.onDidChangeMcpGalleryManifest(c=>s.call("setMcpGalleryManifest",[c])))})}};xpt=I([m(0,tt),m(1,bo),m(2,Ea),m(3,se),m(4,Qb),m(5,B)],xpt);Ee(WB,xpt,0);var kpt=class extends ZFe{constructor(i,e,t,o,n,r,s,l,c,u){let p=new noe(u.getChannel("mcpManagement"),i,e);super(p,i,e,t,o,n,r,s,l,c),this._register(p)}};kpt=I([m(0,vM),m(1,se),m(2,ln),m(3,ht),m(4,Pe),m(5,bo),m(6,an),m(7,GA),m(8,F),m(9,Qb)],kpt);Ee(bQ,kpt,1);Uy(WEe,"encryption");var Ept=class{async resizeImage(i,e){let t=e==="image/gif";return typeof i=="string"&&(i=this.convertStringToUInt8Array(i)),new Promise((o,n)=>{let r=new Blob([i],{type:e}),s=new Image,l=URL.createObjectURL(r);s.src=l,s.onload=()=>{URL.revokeObjectURL(l);let{width:c,height:u}=s;if((c<=768||u<=768)&&!t){o(i);return}if(c>2048||u>2048){let f=2048/Math.max(c,u);c=Math.round(c*f),u=Math.round(u*f)}let p=768/Math.min(c,u);c=Math.round(c*p),u=Math.round(u*p);let h=document.createElement("canvas");h.width=c,h.height=u;let g=h.getContext("2d");if(g){g.drawImage(s,0,0,c,u);let v=e&&["image/jpeg","image/jpg"].includes(e)?"image/jpeg":"image/png";h.toBlob(b=>{if(b){let S=new FileReader;S.onload=()=>{o(new Uint8Array(S.result))},S.onerror=y=>n(y),S.readAsArrayBuffer(b)}else n(new Error("Failed to create blob from canvas"))},v)}else n(new Error("Failed to get canvas context"))},s.onerror=c=>{URL.revokeObjectURL(l),n(c)}})}convertStringToUInt8Array(i){let e=i.includes(",")?i.split(",")[1]:i;return this.isValidBase64(e)?qa(e).buffer:new TextEncoder().encode(i)}convertUint8ArrayToString(i){try{return new TextDecoder().decode(i)}catch{return""}}isValidBase64(i){try{return qa(i),!0}catch{return!1}}async createFileForMedia(i,e,t,o){await i.exists(e)||await i.createFolder(e);let r=o.split("/")[1]||"png",s=`image-${Date.now()}.${r}`,l=Ge(e,s),c=qe.wrap(t);return await i.writeFile(l,c),l}async cleanupOldImages(i,e,t){if(!await i.exists(t))return;let n=10080*60*1e3,r=await i.resolve(t);r.children&&await Promise.all(r.children.map(async s=>{try{let l=this.getTimestampFromFilename(s.name);l&&Date.now()-l>n&&await i.del(s.resource)}catch(l){e.error("Failed to clean up old images",l)}}))}getTimestampFromFilename(i){let e=i.match(/image-(\d+)\./);if(e)return parseInt(e[1],10)}};Ee(uBe,Ept,1);Ee(uBe,Ept,1);var yGe=class{constructor(i,e){this.windowId=i;return Tc.toService(e.getChannel("browserElements"),{context:i,properties:(()=>{let t=new Map;return t.set("windowId",i),t})()})}};yGe=I([m(1,pu)],yGe);var Tpt=class extends yGe{constructor(i,e){super(i.window.id,e)}};Tpt=I([m(0,zr),m(1,pu)],Tpt);var lAo=0,cAo=0,_pt=class{constructor(i){this.simpleBrowser=i}async getConsoleLogs(i){return await this.simpleBrowser.getConsoleLogs(i)}async startConsoleSession(i,e){let t=cAo++,o=`vscode:cancelConsoleSession${t}`,n=i.onCancellationRequested(()=>{tl.send(o,t),n.dispose()});try{await this.simpleBrowser.startConsoleSession(i,e,t)}catch(r){throw new Error("Failed to start console session",{cause:r})}finally{n.dispose()}}async startDebugSession(i,e){let t=cAo++,o=`vscode:cancelCurrentSession${t}`,n=i.onCancellationRequested(()=>{tl.send(o,t),n.dispose()});try{await this.simpleBrowser.startDebugSession(i,e,t)}catch(r){throw new Error("No debug session target found",{cause:r})}finally{n.dispose()}}async getElementData(i,e,t){if(!t)return;let o=lAo++,n=`vscode:cancelElementSelection${o}`,r=e.onCancellationRequested(()=>{tl.send(n,o)});try{return await this.simpleBrowser.getElementData(i,e,t,o)}catch(s){throw r.dispose(),new Error(`Native Host: Error getting element data: ${s}`)}finally{r.dispose()}}async getFocusedElementData(i,e,t){if(!t)return;let o=lAo++,n=`vscode:cancelElementSelection${o}`,r=e.onCancellationRequested(()=>{tl.send(n,o)});try{return await this.simpleBrowser.getFocusedElementData(i,e,t,o)}finally{r.dispose()}}};_pt=I([m(0,CAi)],_pt);Ee(ost,_pt,1);Ee(CAi,Tpt,1);var Dpt=class extends VEe{constructor(e,t,o,n,r,s,l,c){super(!!r.useInMemorySecretStorage,s,l,c);this._notificationService=e;this._dialogService=t;this._openerService=o;this._jsonEditingService=n;this._environmentService=r;this.notifyOfNoEncryptionOnce=$c(()=>this.notifyOfNoEncryption())}set(e,t){return this._sequencer.queue(e,async()=>{await this.resolvedStorageService,this.type!=="persisted"&&!this._environmentService.useInMemorySecretStorage&&(this._logService.trace("[NativeSecretStorageService] Notifying user that secrets are not being stored on disk."),await this.notifyOfNoEncryptionOnce())}),super.set(e,t)}async notifyOfNoEncryption(){let e=[],t={label:d(17950,null),run:()=>this._openerService.open("https://go.microsoft.com/fwlink/?linkid=2239490"),keepOpen:!0};e.push(t);let o=d(17947,null);if(!fn){this._notificationService.prompt(bt.Error,o,e);return}let n=await this._encryptionService.getKeyStorageProvider();if(n==="basic_text"){let r=d(17952,null),s={label:d(17951,null),run:async()=>{await this._encryptionService.setUsePlainTextEncryption(),await this._jsonEditingService.write(this._environmentService.argvResource,[{path:["password-store"],value:"basic"}],!0),this.reinitialize()}};e.unshift(s),await this._dialogService.prompt({type:"error",buttons:e,message:o,detail:r});return}heo(n)?o=d(17948,null):meo(n)&&(o=d(17949,null)),this._notificationService.prompt(bt.Error,o,e)}};Dpt=I([m(0,Ne),m(1,at),m(2,Je),m(3,bg),m(4,oy),m(5,ce),m(6,WEe),m(7,se)],Dpt);Ee(Dw,Dpt,1);Jv(Q5,"languagePacks");var U7t=class{constructor(i){this.channel=i}log(i,e){return this.channel.call("log",{eventName:i,data:e}).then(void 0,t=>`Failed to log telemetry: ${console.warn(t)}`),Promise.resolve(null)}flush(){return Promise.resolve()}};function dAo(a,i,e,t,o,n,r,s,l,c){let{commit:u,version:p,date:h,telemetryAppName:g}=i??{},f=bJi(e,t,l.arch,u,p,o,n,r,s,h,g),v=a.get(Hgt,-1),b=a.get(y$i,-1);return f["common.version.shell"]=l.versions?.electron,f["common.version.renderer"]=l.versions?.chrome,f["common.firstSessionDate"]=v,f["common.lastSessionDate"]=b||"",f["common.isNewSession"]=b?"0":"1",f["common.remoteAuthority"]=RTt(c,i),f["common.cli"]=!!l.env.VSCODE_CLI,f}var d9=class{constructor(i,e,t){this._configurationService=e;this._productService=t;this._experimentProperties={};this._pendingEvents=[];this._isExperimentPropertySet=!1;this._disposables=new N;this._cleanupPatterns=[];this._appenders=i.appenders,this._commonProperties=i.commonProperties??Object.create(null),this.sessionId=this._commonProperties.sessionID,this.machineId=this._commonProperties["common.machineId"],this.sqmId=this._commonProperties["common.sqmId"],this.devDeviceId=this._commonProperties["common.devDeviceId"],this.firstSessionDate=this._commonProperties["common.firstSessionDate"],this.msftInternal=this._commonProperties["common.msftInternal"],this._piiPaths=i.piiPaths||[],this._telemetryLevel=3,this._sendErrorTelemetry=!!i.sendErrorTelemetry,this._meteredConnectionService=i.meteredConnectionService,this._cleanupPatterns=[/(vscode-)?file:\/\/.*?\/resources\/app\//gi];for(let o of this._piiPaths)this._cleanupPatterns.push(new RegExp(ns(o),"gi")),o.indexOf("\\")>=0&&this._cleanupPatterns.push(new RegExp(ns(o.replace(/\\/g,"/")),"gi"));this._updateTelemetryLevel(),this._disposables.add(this._configurationService.onDidChangeConfiguration(o=>{(o.affectsConfiguration(uO)||o.affectsConfiguration(bae)||o.affectsConfiguration(Ugt))&&this._updateTelemetryLevel()})),i.waitForExperimentProperties?this._flushTimeout=setTimeout(()=>this._flushPendingEvents(),d9.BUFFER_FLUSH_TIMEOUT):this._isExperimentPropertySet=!0}static{this.IDLE_START_EVENT_NAME="UserIdleStart"}static{this.IDLE_STOP_EVENT_NAME="UserIdleStop"}static{this.BUFFER_FLUSH_TIMEOUT=1e4}static{this.MAX_BUFFER_SIZE=1e3}setExperimentProperty(i,e){this._experimentProperties[i]=e,this._isExperimentPropertySet||this._flushPendingEvents()}_flushPendingEvents(){if(!this._isExperimentPropertySet){this._isExperimentPropertySet=!0,this._flushTimeout!==void 0&&(clearTimeout(this._flushTimeout),this._flushTimeout=void 0);for(let i of this._pendingEvents)this._doLog(i.eventName,i.eventLevel,i.data);this._pendingEvents=[]}}_updateTelemetryLevel(){let i=JE(this._configurationService),e=this._productService.enabledTelemetryLevels;if(e){this._sendErrorTelemetry=this.sendErrorTelemetry?e.error:!1;let t=e.usage?3:e.error?2:0;i=Math.min(i,t)}this._telemetryLevel=i}get sendErrorTelemetry(){return this._sendErrorTelemetry}get telemetryLevel(){return this._telemetryLevel}dispose(){this._flushPendingEvents(),this._disposables.dispose()}_log(i,e,t){if(!(this._telemetryLevel<e)&&!this._meteredConnectionService?.isConnectionMetered){if(!this._isExperimentPropertySet){this._pendingEvents.length<d9.MAX_BUFFER_SIZE&&this._pendingEvents.push({eventName:i,eventLevel:e,data:t});return}this._doLog(i,e,t)}}_doLog(i,e,t){t=Xu(t,this._experimentProperties),t=CJi(t,this._cleanupPatterns),t=Xu(t,this._commonProperties),this._appenders.forEach(o=>o.log(i,t??{}))}publicLog(i,e){this._log(i,3,e)}publicLog2(i,e){this.publicLog(i,e)}publicLogError(i,e){this._sendErrorTelemetry&&this._log(i,2,e)}publicLogError2(i,e){this.publicLogError(i,e)}};d9=I([m(1,B),m(2,tt)],d9);function myn(){let a=d(2369,null,ro.nameLong),i=ro.privacyStatementUrl?d(2355,null,"https://aka.ms/vscode-telemetry",ro.privacyStatementUrl):d(2356,null,"https://aka.ms/vscode-telemetry"),e=Wt?"":d(2361,null),t=d(2354,null),o=d(2359,null),n=d(2370,null),r=d(2368,null),s=`
|       | ${t} | ${o} | ${n} |
|:------|:-------------:|:---------------:|:----------:|
| all   |       \u2713       |        \u2713        |     \u2713      |
| error |       \u2713       |        \u2713        |     -      |
| crash |       \u2713       |        -        |     -      |
| off   |       -       |        -        |     -      |
`,l=d(2364,null);return`
${a} ${i} ${e}

&nbsp;

${r}
${s}

&nbsp;

${l}
`}var hyn=ne.as(Jt.Configuration);hyn.registerConfiguration({id:w$i,order:1,type:"object",title:d(2371,null),properties:{[uO]:{type:"string",enum:["all","error","crash","off"],enumDescriptions:[d(2363,null),d(2365,null),d(2362,null),d(2366,null)],markdownDescription:myn(),default:"all",restricted:!0,scope:1,tags:["usesOnlineServices","telemetry"],policy:{name:"TelemetryLevel",category:"Telemetry",minimumVersion:"1.99",localization:{description:{key:"telemetry.telemetryLevel.policyDescription",value:d(2367,null)},enumDescriptions:[{key:"telemetry.telemetryLevel.default",value:d(2363,null)},{key:"telemetry.telemetryLevel.error",value:d(2365,null)},{key:"telemetry.telemetryLevel.crash",value:d(2362,null)},{key:"telemetry.telemetryLevel.off",value:d(2366,null)}]}}},"telemetry.feedback.enabled":{type:"boolean",default:!0,description:d(2360,null),policy:{name:"EnableFeedback",category:"Telemetry",minimumVersion:"1.99",localization:{description:{key:"telemetry.feedback.enabled",value:d(2360,null)}}}},[bae]:{type:"boolean",markdownDescription:ro.privacyStatementUrl?d(2358,null,ro.nameLong,ro.privacyStatementUrl):d(2357,null,ro.nameLong),default:!0,restricted:!0,markdownDeprecationMessage:d(2353,null,`\`#${uO}#\``),scope:1,tags:["usesOnlineServices","telemetry"]}}});var Lpt=class extends x{get sessionId(){return this.impl.sessionId}get machineId(){return this.impl.machineId}get sqmId(){return this.impl.sqmId}get devDeviceId(){return this.impl.devDeviceId}get firstSessionDate(){return this.impl.firstSessionDate}get msftInternal(){return this.impl.msftInternal}constructor(i,e,t,o,n,r){if(super(),DR(e,i)){let s=yJi(e,n),l=t.getChannel("telemetryAppender"),c={appenders:[new U7t(l)],commonProperties:dAo(o,e,i.os.release,i.os.hostname,i.machineId,i.sqmId,i.devDeviceId,s,eP,i.remoteAuthority),piiPaths:wJi(i),sendErrorTelemetry:!0,waitForExperimentProperties:UMt(n,e,i)};this.impl=this._register(new d9(c,n,e))}else this.impl=IJi;this.sendErrorTelemetry=this.impl.sendErrorTelemetry,this._register(r.onDidCompleteRequest(s=>{s.callSite===deo||e.quality==="stable"||this.publicLog2("fetchCall",{callSite:s.callSite,latency:s.latency,statusCode:s.statusCode})}))}setExperimentProperty(i,e){return this.impl.setExperimentProperty(i,e)}get telemetryLevel(){return this.impl.telemetryLevel}publicLog(i,e){this.impl.publicLog(i,e)}publicLog2(i,e){this.publicLog(i,e)}publicLogError(i,e){this.impl.publicLogError(i,e)}publicLogError2(i,e){this.publicLogError(i,e)}};Lpt=I([m(0,zr),m(1,tt),m(2,Qb),m(3,ce),m(4,B),m(5,Ea)],Lpt);Ee(Te,Lpt,1);var z7t=le("extensionHostStarter"),uAo="extensionHostStarter",pAo=6e3;Uy(z7t,uAo);var Rpt=class extends BTt{constructor(e,t,o,n,r,s,l,c){super(e,t,o,n,r,s,c);this._requestService=l}async readExtensionResource(e){if(await this.isExtensionGalleryResource(e)){let o=await this.getExtensionGalleryRequestHeaders(),n=await this._requestService.request({url:e.toString(),headers:o,callSite:"extensionResourceLoader.readExtensionResource"},Se.None);return await _w(n)||""}return(await this._fileService.readFile(e)).value.toString()}};Rpt=I([m(0,fe),m(1,ce),m(2,tt),m(3,Eo),m(4,B),m(5,Dv),m(6,Ea),m(7,se)],Rpt);Ee(mk,Rpt,1);var gyn="workbench.view.extensions",Mpt=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h){this.jsonEditingService=i;this.environmentService=e;this.notificationService=t;this.languagePackService=o;this.paneCompositePartService=n;this.extensionManagementService=r;this.progressService=s;this.textFileService=l;this.editorService=c;this.dialogService=u;this.hostService=p;this.productService=h}async validateLocaleFile(){try{let i=await this.textFileService.read(this.environmentService.argvResource,{encoding:"utf8"});zT(i.value)}catch{return this.notificationService.notify({severity:ft.Error,message:d(17867,null),actions:{primary:[ii({id:"openArgv",label:d(17869,null),run:()=>this.editorService.openEditor({resource:this.environmentService.argvResource})})]}}),!1}return!0}async writeLocaleValue(i){return await this.validateLocaleFile()?(await this.jsonEditingService.write(this.environmentService.argvResource,[{path:["locale"],value:i}],!0),!0):!1}async setLocale(i,e=!1){let t=i.id;if(t===US.value()||!t&&US.isDefaultVariant())return;let o=await this.languagePackService.getInstalledLanguages();try{if(!o.some(n=>n.id===i.id)){if(i.galleryExtension?.publisher.toLowerCase()!=="ms-ceintl"){((await this.paneCompositePartService.openPaneComposite(gyn,0))?.getViewPaneContainer()).search(`@id:${i.extensionId}`);return}await this.progressService.withProgress({location:15,title:d(17868,null,i.label)},n=>this.extensionManagementService.installFromGallery(i.galleryExtension,{isMachineScoped:!1}))}if(!e&&!await this.showRestartDialog(i.label))return;await this.writeLocaleValue(t),await this.hostService.restart()}catch(n){this.notificationService.error(n)}}async clearLocalePreference(){try{await this.writeLocaleValue(void 0),US.isDefaultVariant()||await this.showRestartDialog("English")}catch(i){this.notificationService.error(i)}}async showRestartDialog(i){let{confirmed:e}=await this.dialogService.confirm({message:d(17872,null,this.productService.nameLong,i),detail:d(17871,null,i,this.productService.nameLong),primaryButton:d(17870,null)});return e}};Mpt=I([m(0,bg),m(1,Eo),m(2,Ne),m(3,Q5),m(4,us),m(5,Cs),m(6,Fo),m(7,Uo),m(8,ee),m(9,at),m(10,Zt),m(11,tt)],Mpt);var Ppt=class{constructor(i){this.languagePackService=i}async getExtensionIdProvidingCurrentLocale(){let i=US.value();return i===l1?void 0:(await this.languagePackService.getInstalledLanguages()).find(o=>o.id===i)?.extensionId}};Ppt=I([m(0,Q5)],Ppt);Ee(DH,Mpt,1);Ee(pBt,Ppt,1);var Apt=class extends W7t{constructor(i,e,t,o,n,r,s,l,c){super(A.file(r.builtinExtensionsPath),A.file(r.extensionsPath),r.userHome,i.currentProfile,e,t,o,n,r,s,l,c)}};Apt=I([m(0,ln),m(1,an),m(2,pse),m(3,fe),m(4,se),m(5,oy),m(6,tt),m(7,ht),m(8,F)],Apt);Ee(a9,Apt,1);function s$(a,i){i=i||dBt;let e=a.manifest;return{...uBt({...a,manifest:void 0},i),manifest:e}}var K7t=class extends l9{constructor(e,t,o){super(t,o);this.channel=e;this._onInstallExtension=this._register(new E);this._onDidInstallExtensions=this._register(new E);this._onUninstallExtension=this._register(new E);this._onDidUninstallExtension=this._register(new E);this._onDidUpdateExtensionMetadata=this._register(new E);this._register(this.channel.listen("onInstallExtension")(n=>this.onInstallExtensionEvent({...n,source:this.isUriComponents(n.source)?A.revive(n.source):n.source,profileLocation:A.revive(n.profileLocation)}))),this._register(this.channel.listen("onDidInstallExtensions")(n=>this.onDidInstallExtensionsEvent(n.map(r=>({...r,local:r.local?s$(r.local,null):r.local,source:this.isUriComponents(r.source)?A.revive(r.source):r.source,profileLocation:A.revive(r.profileLocation)}))))),this._register(this.channel.listen("onUninstallExtension")(n=>this.onUninstallExtensionEvent({...n,profileLocation:A.revive(n.profileLocation)}))),this._register(this.channel.listen("onDidUninstallExtension")(n=>this.onDidUninstallExtensionEvent({...n,profileLocation:A.revive(n.profileLocation)}))),this._register(this.channel.listen("onDidUpdateExtensionMetadata")(n=>this.onDidUpdateExtensionMetadataEvent({profileLocation:A.revive(n.profileLocation),local:s$(n.local,null)})))}get onInstallExtension(){return this._onInstallExtension.event}get onDidInstallExtensions(){return this._onDidInstallExtensions.event}get onUninstallExtension(){return this._onUninstallExtension.event}get onDidUninstallExtension(){return this._onDidUninstallExtension.event}get onDidUpdateExtensionMetadata(){return this._onDidUpdateExtensionMetadata.event}onInstallExtensionEvent(e){this._onInstallExtension.fire(e)}onDidInstallExtensionsEvent(e){this._onDidInstallExtensions.fire(e)}onUninstallExtensionEvent(e){this._onUninstallExtension.fire(e)}onDidUninstallExtensionEvent(e){this._onDidUninstallExtension.fire(e)}onDidUpdateExtensionMetadataEvent(e){this._onDidUpdateExtensionMetadata.fire(e)}isUriComponents(e){if(!e)return!1;let t=e;return typeof t?.path=="string"&&typeof t?.scheme=="string"}getTargetPlatform(){return this._targetPlatformPromise||(this._targetPlatformPromise=this.channel.call("getTargetPlatform")),this._targetPlatformPromise}zip(e){return Promise.resolve(this.channel.call("zip",[e]).then(t=>A.revive(t)))}install(e,t){return Promise.resolve(this.channel.call("install",[e,t])).then(o=>s$(o,null))}installFromLocation(e,t){return Promise.resolve(this.channel.call("installFromLocation",[e,t])).then(o=>s$(o,null))}async installExtensionsFromProfile(e,t,o){return(await this.channel.call("installExtensionsFromProfile",[e,t,o])).map(r=>s$(r,null))}getManifest(e){return Promise.resolve(this.channel.call("getManifest",[e]))}installFromGallery(e,t){return Promise.resolve(this.channel.call("installFromGallery",[e,t])).then(o=>s$(o,null))}async installGalleryExtensions(e){return(await this.channel.call("installGalleryExtensions",[e])).map(o=>({...o,local:o.local?s$(o.local,null):o.local,source:this.isUriComponents(o.source)?A.revive(o.source):o.source,profileLocation:A.revive(o.profileLocation)}))}uninstall(e,t){if(e.isWorkspaceScoped)throw new Error("Cannot uninstall a workspace extension");return Promise.resolve(this.channel.call("uninstall",[e,t]))}uninstallExtensions(e){if(e.some(t=>t.extension.isWorkspaceScoped))throw new Error("Cannot uninstall a workspace extension");return Promise.resolve(this.channel.call("uninstallExtensions",[e]))}getInstalled(e=null,t,o){return Promise.resolve(this.channel.call("getInstalled",[e,t,o,wr])).then(n=>n.map(r=>s$(r,null)))}updateMetadata(e,t,o){return Promise.resolve(this.channel.call("updateMetadata",[e,t,o])).then(n=>s$(n,null))}resetPinnedStateForAllUserExtensions(e){return this.channel.call("resetPinnedStateForAllUserExtensions",[e])}toggleApplicationScope(e,t){return this.channel.call("toggleApplicationScope",[e,t]).then(o=>s$(o,null))}copyExtensions(e,t){return this.channel.call("copyExtensions",[e,t])}getExtensionsControlManifest(){return Promise.resolve(this.channel.call("getExtensionsControlManifest"))}async download(e,t,o){let n=await this.channel.call("download",[e,t,o]);return A.revive(n)}async cleanUp(){return this.channel.call("cleanUp")}registerParticipant(){throw new Error("Not Supported")}};var wGe=class extends K7t{constructor(e,t,o,n,r){super(e,t,o);this.userDataProfileService=n;this.uriIdentityService=r;this._onDidChangeProfile=this._register(new E);this.onDidChangeProfile=this._onDidChangeProfile.event;this._onDidProfileAwareInstallExtensions=this._register(new E);this._onDidProfileAwareUninstallExtension=this._register(new E);this._onDidProfileAwareUpdateExtensionMetadata=this._register(new E);this._register(n.onDidChangeCurrentProfile(s=>{this.uriIdentityService.extUri.isEqual(s.previous.extensionsResource,s.profile.extensionsResource)||s.join(this.whenProfileChanged(s))}))}get onProfileAwareDidInstallExtensions(){return this._onDidProfileAwareInstallExtensions.event}get onProfileAwareDidUninstallExtension(){return this._onDidProfileAwareUninstallExtension.event}get onProfileAwareDidUpdateExtensionMetadata(){return this._onDidProfileAwareUpdateExtensionMetadata.event}async onInstallExtensionEvent(e){let t=this.filterEvent(e.profileLocation,e.applicationScoped??!1);(t instanceof Promise?await t:t)&&this._onInstallExtension.fire(e)}async onDidInstallExtensionsEvent(e){let t=[];for(let o of e){let n=this.filterEvent(o.profileLocation,o.applicationScoped??o.local?.isApplicationScoped??!1);(n instanceof Promise?await n:n)&&t.push(o)}t.length&&this._onDidInstallExtensions.fire(t),this._onDidProfileAwareInstallExtensions.fire(e)}async onUninstallExtensionEvent(e){let t=this.filterEvent(e.profileLocation,e.applicationScoped??!1);(t instanceof Promise?await t:t)&&this._onUninstallExtension.fire(e)}async onDidUninstallExtensionEvent(e){let t=this.filterEvent(e.profileLocation,e.applicationScoped??!1);(t instanceof Promise?await t:t)&&this._onDidUninstallExtension.fire(e),this._onDidProfileAwareUninstallExtension.fire(e)}async onDidUpdateExtensionMetadataEvent(e){let t=this.filterEvent(e.profileLocation,e.local?.isApplicationScoped??!1);(t instanceof Promise?await t:t)&&this._onDidUpdateExtensionMetadata.fire(e),this._onDidProfileAwareUpdateExtensionMetadata.fire(e)}async install(e,t){return t={...t,profileLocation:await this.getProfileLocation(t?.profileLocation)},super.install(e,t)}async installFromLocation(e,t){return super.installFromLocation(e,await this.getProfileLocation(t))}async installFromGallery(e,t){return t={...t,profileLocation:await this.getProfileLocation(t?.profileLocation)},super.installFromGallery(e,t)}async installGalleryExtensions(e){let t=[];for(let o of e)t.push({...o,options:{...o.options,profileLocation:await this.getProfileLocation(o.options?.profileLocation)}});return super.installGalleryExtensions(t)}async uninstall(e,t){return t={...t,profileLocation:await this.getProfileLocation(t?.profileLocation)},super.uninstall(e,t)}async uninstallExtensions(e){let t=[];for(let{extension:o,options:n}of e)t.push({extension:o,options:{...n,profileLocation:await this.getProfileLocation(n?.profileLocation)}});return super.uninstallExtensions(t)}async getInstalled(e=null,t,o){return super.getInstalled(e,await this.getProfileLocation(t),o)}async updateMetadata(e,t,o){return super.updateMetadata(e,t,await this.getProfileLocation(o))}async toggleApplicationScope(e,t){return super.toggleApplicationScope(e,await this.getProfileLocation(t))}async copyExtensions(e,t){return super.copyExtensions(await this.getProfileLocation(e),await this.getProfileLocation(t))}async whenProfileChanged(e){let t=await this.getProfileLocation(e.previous.extensionsResource),o=await this.getProfileLocation(e.profile.extensionsResource);if(this.uriIdentityService.extUri.isEqual(t,o))return;let n=await this.switchExtensionsProfile(t,o);this._onDidChangeProfile.fire(n)}async switchExtensionsProfile(e,t,o){let n=await this.getInstalled(1,e),r=await this.getInstalled(1,t);if(o?.length){let s=[];for(let l of n)o.some(c=>Ii.equals(l.identifier.id,c))&&!r.some(c=>Ii.equals(c.identifier.id,l.identifier.id))&&s.push(l.identifier);s.length&&await this.installExtensionsFromProfile(s,e,t)}return lP(n,r,(s,l)=>Hl(`${Ii.toKey(s.identifier.id)}@${s.manifest.version}`,`${Ii.toKey(l.identifier.id)}@${l.manifest.version}`))}async getProfileLocation(e){return e??this.userDataProfileService.currentProfile.extensionsResource}};var CGe=class extends wGe{constructor(e,t,o,n,r,s,l){super(e,t,o,n,l);this.userDataProfilesService=r;this.remoteUserDataProfilesService=s}async filterEvent(e,t){if(t||!e&&this.userDataProfileService.currentProfile.isDefault)return!0;let o=await this.remoteUserDataProfilesService.getRemoteProfile(this.userDataProfileService.currentProfile);return!!this.uriIdentityService.extUri.isEqual(o.extensionsResource,e)}async getProfileLocation(e){if(!e&&this.userDataProfileService.currentProfile.isDefault)return;e=await super.getProfileLocation(e);let t=this.userDataProfilesService.profiles.find(o=>this.uriIdentityService.extUri.isEqual(o.extensionsResource,e));return t?t=await this.remoteUserDataProfilesService.getRemoteProfile(t):t=(await this.remoteUserDataProfilesService.getRemoteProfiles()).find(o=>this.uriIdentityService.extUri.isEqual(o.extensionsResource,e)),t?.extensionsResource}async switchExtensionsProfile(e,t,o){let n=await this.remoteUserDataProfilesService.getRemoteProfiles(),r=n.find(l=>this.uriIdentityService.extUri.isEqual(l.extensionsResource,e)),s=n.find(l=>this.uriIdentityService.extUri.isEqual(l.extensionsResource,t));return r?.id===s?.id?{added:[],removed:[]}:super.switchExtensionsProfile(e,t,o)}};CGe=I([m(1,tt),m(2,dm),m(3,ln),m(4,an),m(5,GA),m(6,ht)],CGe);var xGe=class extends CGe{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super(e,o,h,n,r,s,l);this.localExtensionManagementServer=t;this.logService=c;this.galleryService=u;this.configurationService=p;this.fileService=g;this.extensionManifestPropertiesService=f}async install(e,t){let o=await super.install(e,t);return await this.installUIDependenciesAndPackedExtensions(o),o}async installFromGallery(e,t={}){if(gn(t.donotVerifySignature)){let n=this.configurationService.getValue(Qke);t.donotVerifySignature=Wa(n)?!n:void 0}let o=await this.doInstallFromGallery(e,t);return await this.installUIDependenciesAndPackedExtensions(o),o}async doInstallFromGallery(e,t){if(t.downloadExtensionsLocally||this.configurationService.getValue("remote.downloadExtensionsLocally"))return this.downloadAndInstall(e,t);try{let o=await this.localExtensionManagementServer.extensionManagementService.getTargetPlatform();return await super.installFromGallery(e,{...t,context:{...t?.context,[oJi]:o}})}catch(o){switch(o.name){case"Download":case"DownloadSignature":case"Gallery":case"Internal":case"Unknown":try{return this.logService.error(`Error while installing '${e.identifier.id}' extension in the remote server.`,xn(o)),await this.downloadAndInstall(e,t)}catch(n){throw this.logService.error(n),n}default:throw this.logService.debug("Remote Install Error Name",o.name),o}}}async downloadAndInstall(e,t){this.logService.info(`Downloading the '${e.identifier.id}' extension locally and install`);let o=await this.checkAndGetCompatible(e,!!t.installPreReleaseVersion);t={...t,donotIncludePackAndDependencies:!0};let n=await this.getInstalled(1,void 0,t.productVersion),r=await this.getAllWorkspaceDependenciesAndPackedExtensions(o,Se.None);if(r.length){this.logService.info(`Downloading the workspace dependencies and packed extensions of '${o.identifier.id}' locally and install`);for(let s of r)await this.downloadCompatibleAndInstall(s,n,t)}return await this.downloadCompatibleAndInstall(o,n,t)}async downloadCompatibleAndInstall(e,t,o){let n=await this.checkAndGetCompatible(e,!!o.installPreReleaseVersion);this.logService.trace("Downloading extension:",n.identifier.id);let r=await this.localExtensionManagementServer.extensionManagementService.download(n,t.filter(s=>Ut(s.identifier,n.identifier))[0]?3:2,!!o.donotVerifySignature);this.logService.info("Downloaded extension:",n.identifier.id,r.path);try{let s=await super.install(r,{...o,keepExisting:!0});return this.logService.info(`Successfully installed '${n.identifier.id}' extension`),s}finally{try{await this.fileService.del(r)}catch(s){this.logService.error(s)}}}async checkAndGetCompatible(e,t){let o=await this.getTargetPlatform(),n=null;if(e.hasPreReleaseVersion&&e.properties.isPreReleaseVersion!==t&&(n=(await this.galleryService.getExtensions([{...e.identifier,preRelease:t}],{targetPlatform:o,compatible:!0},Se.None))[0]||null),!n&&await this.galleryService.isExtensionCompatible(e,t,o)&&(n=e),n||(n=await this.galleryService.getCompatibleExtension(e,t,o)),!n){let r=[];throw z3(e.properties.enabledApiProposals??[],r)?!t&&e.properties.isPreReleaseVersion&&(await this.galleryService.getExtensions([e.identifier],Se.None))[0]?new vh(d(17638,null,e.identifier.id),"ReleaseVersionNotFound"):new vh(d(17637,null,e.identifier.id,this.productService.nameLong,this.productService.version),"Incompatible"):new vh(d(17636,null,e.displayName??e.identifier.id,r[0]),"IncompatibleApi")}return n}async installUIDependenciesAndPackedExtensions(e){let t=await this.getAllUIDependenciesAndPackedExtensions(e.manifest,Se.None),o=await this.localExtensionManagementServer.extensionManagementService.getInstalled(),n=t.filter(r=>o.every(s=>!Ut(s.identifier,r.identifier)));n.length&&(this.logService.info(`Installing UI dependencies and packed extensions of '${e.identifier.id}' locally`),await dn.settled(n.map(r=>this.localExtensionManagementServer.extensionManagementService.installFromGallery(r))))}async getAllUIDependenciesAndPackedExtensions(e,t){let o=new Map,n=[...e.extensionPack||[],...e.extensionDependencies||[]];return await this.getDependenciesAndPackedExtensionsRecursively(n,o,!0,t),[...o.values()]}async getAllWorkspaceDependenciesAndPackedExtensions(e,t){let o=new Map;o.set(e.identifier.id.toLowerCase(),e);let n=await this.galleryService.getManifest(e,t);if(n){let r=[...n.extensionPack||[],...n.extensionDependencies||[]];await this.getDependenciesAndPackedExtensionsRecursively(r,o,!1,t)}return o.delete(e.identifier.id),[...o.values()]}async getDependenciesAndPackedExtensionsRecursively(e,t,o,n){if(e.length===0)return Promise.resolve();let r=await this.galleryService.getExtensions(e.map(c=>({id:c})),n),s=await Promise.all(r.map(c=>this.galleryService.getManifest(c,n))),l=[];for(let c=0;c<r.length;c++){let u=r[c],p=s[c];p&&this.extensionManifestPropertiesService.prefersExecuteOnUI(p)===o&&(t.set(u.identifier.id.toLowerCase(),u),l.push(p))}e=[];for(let c of l){if(yr(c.extensionDependencies))for(let u of c.extensionDependencies)t.has(u.toLowerCase())||e.push(u);if(yr(c.extensionPack))for(let u of c.extensionPack)t.has(u.toLowerCase())||e.push(u)}return this.getDependenciesAndPackedExtensionsRecursively(e,t,o,n)}};xGe=I([m(2,tt),m(3,ln),m(4,an),m(5,GA),m(6,ht),m(7,se),m(8,fa),m(9,B),m(10,dm),m(11,fe),m(12,Gp)],xGe);var kGe=class extends wGe{constructor(e,t,o,n,r,s,l,c,u){super(e,t,o,n,r);this.fileService=s;this.downloadService=l;this.nativeEnvironmentService=c;this.logService=u}filterEvent(e,t){return t||this.uriIdentityService.extUri.isEqual(this.userDataProfileService.currentProfile.extensionsResource,e)}async install(e,t){let{location:o,cleanup:n}=await this.downloadVsix(e);try{return await super.install(o,t)}finally{await n()}}async downloadVsix(e){if(e.scheme===Q.file)return{location:e,async cleanup(){}};this.logService.trace("Downloading extension from",e.toString());let t=Ge(this.nativeEnvironmentService.extensionsDownloadLocation,xt());return await this.downloadService.download(e,t,"extensionManagement.downloadNativeVsix"),this.logService.info("Downloaded extension to",t.toString()),{location:t,cleanup:async()=>{try{await this.fileService.del(t)}catch(n){this.logService.error(n)}}}}async switchExtensionsProfile(e,t,o){if(this.nativeEnvironmentService.remoteAuthority){let r=(await this.getInstalled(1,e)).find(s=>Zxe(s.manifest,this.nativeEnvironmentService.remoteAuthority));r&&(o||(o=[]),o.push(new Ii(r.identifier.id)))}return super.switchExtensionsProfile(e,t,o)}};kGe=I([m(1,tt),m(2,dm),m(3,ln),m(4,ht),m(5,fe),m(6,i0),m(7,zr),m(8,se)],kGe);var Npt=class extends x{constructor(e,t,o,n){super();this.remoteExtensionManagementServer=null;this.webExtensionManagementServer=null;let r=this._register(n.createInstance(kGe,e.getChannel("extensions")));this.localExtensionManagementServer={extensionManagementService:r,id:"local",label:d(17634,null)};let s=t.getConnection();if(s){let l=n.createInstance(xGe,s.getChannel("extensions"),this.localExtensionManagementServer);this.remoteExtensionManagementServer={id:"remote",extensionManagementService:l,get label(){return o.getHostLabel(Q.vscodeRemote,s.remoteAuthority)||d(17635,null)}}}}getExtensionManagementServer(e){if(e.location.scheme===Q.file)return this.localExtensionManagementServer;if(this.remoteExtensionManagementServer&&e.location.scheme===Q.vscodeRemote)return this.remoteExtensionManagementServer;throw new Error(`Invalid Extension ${e.location}`)}getExtensionInstallLocation(e){return this.getExtensionManagementServer(e)===this.remoteExtensionManagementServer?2:1}};Npt=I([m(0,Qb),m(1,bo),m(2,rt),m(3,F)],Npt);Ee(Ec,Npt,1);var EGe=class extends x{constructor(e){super();this.productService=e;this.onDidChangeExtensionGalleryManifest=U.None;this.onDidChangeExtensionGalleryManifestStatus=U.None}get extensionGalleryManifestStatus(){return this.productService.extensionsGallery?.serviceUrl?"available":"unavailable"}async getExtensionGalleryManifest(){let e=this.productService.extensionsGallery;if(!e?.serviceUrl)return null;let t=[{id:`${e.serviceUrl}/extensionquery`,type:"ExtensionQueryService"},{id:`${e.serviceUrl}/vscode/{publisher}/{name}/latest`,type:"ExtensionLatestVersionUriTemplate"},{id:`${e.serviceUrl}/publishers/{publisher}/extensions/{name}/{version}/stats?statType={statTypeName}`,type:"ExtensionStatisticsUriTemplate"}];e.publisherUrl&&t.push({id:`${e.publisherUrl}/{publisher}`,type:"PublisherViewUriTemplate"}),e.itemUrl&&(t.push({id:`${e.itemUrl}?itemName={publisher}.{name}`,type:"ExtensionDetailsViewUriTemplate"}),t.push({id:`${e.itemUrl}?itemName={publisher}.{name}&ssr=false#review-details`,type:"ExtensionRatingViewUriTemplate"})),e.resourceUrlTemplate&&t.push({id:e.resourceUrlTemplate,type:"ExtensionResourceUriTemplate"});let o=[{name:"Tag",value:1},{name:"ExtensionId",value:4},{name:"Category",value:5},{name:"ExtensionName",value:7},{name:"Target",value:8},{name:"Featured",value:9},{name:"SearchText",value:10},{name:"ExcludeWithFlags",value:12}],n=[{name:"NoneOrRelevance",value:0},{name:"LastUpdatedDate",value:1},{name:"Title",value:2},{name:"PublisherName",value:3},{name:"InstallCount",value:4},{name:"AverageRating",value:6},{name:"PublishedDate",value:10},{name:"WeightedRating",value:12}],r=[{name:"None",value:0},{name:"IncludeVersions",value:1},{name:"IncludeFiles",value:2},{name:"IncludeCategoryAndTags",value:4},{name:"IncludeSharedAccounts",value:8},{name:"IncludeVersionProperties",value:16},{name:"ExcludeNonValidated",value:32},{name:"IncludeInstallationTargets",value:64},{name:"IncludeAssetUri",value:128},{name:"IncludeStatistics",value:256},{name:"IncludeLatestVersionOnly",value:512},{name:"Unpublished",value:4096},{name:"IncludeNameConflictInfo",value:32768},{name:"IncludeLatestPrereleaseAndStableVersionOnly",value:65536}];return{version:"",resources:t,capabilities:{extensionQuery:{filtering:o,sorting:n,flags:r},signing:{allPublicRepositorySigned:!0}}}}};EGe=I([m(0,tt)],EGe);var Opt=class extends EGe{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super(e);this.telemetryService=n;this.configurationService=c;this.requestService=u;this.defaultAccountService=p;this.logService=h;this.dialogService=g;this.hostService=f;this.extensionGalleryManifest=null;this._onDidChangeExtensionGalleryManifest=this._register(new E);this.onDidChangeExtensionGalleryManifest=this._onDidChangeExtensionGalleryManifest.event;this.currentStatus="unavailable";this._onDidChangeExtensionGalleryManifestStatus=this._register(new E);this.onDidChangeExtensionGalleryManifestStatus=this._onDidChangeExtensionGalleryManifestStatus.event;this.commonHeadersPromise=WVt(e.version,e,t,c,o,r,n);let v=[l.getChannel("extensionGalleryManifest")],b=s.getConnection();b&&v.push(b.getChannel("extensionGalleryManifest")),this.getExtensionGalleryManifest().then(S=>{v.forEach(y=>y.call("setExtensionGalleryManifest",[S]))})}get extensionGalleryManifestStatus(){return this.currentStatus}async getExtensionGalleryManifest(){return this.extensionGalleryManifestPromise||(this.extensionGalleryManifestPromise=this.doGetExtensionGalleryManifest()),await this.extensionGalleryManifestPromise,this.extensionGalleryManifest}async doGetExtensionGalleryManifest(){if(!this.productService.extensionsGallery?.serviceUrl)return;let t=this.configurationService.getValue(TQe);if(t)await this.handleDefaultAccountAccess(t),this._register(this.defaultAccountService.onDidChangeDefaultAccount(()=>this.handleDefaultAccountAccess(t)));else{let o=await super.getExtensionGalleryManifest();this.update(o)}this._register(this.configurationService.onDidChangeConfiguration(o=>{o.affectsConfiguration(TQe)&&this.requestRestart()}))}async handleDefaultAccountAccess(e){let t=await this.defaultAccountService.getDefaultAccount();if(!t)this.logService.debug("[Marketplace] Enterprise marketplace configured but user not signed in"),this.update(null,"requiresSignIn");else if(!this.checkAccess(t))this.logService.debug("[Marketplace] User signed in but lacks access to enterprise marketplace"),this.update(null,"accessDenied");else if(this.currentStatus!=="available")try{let o=await this.getExtensionGalleryManifestFromServiceUrl(e);this.update(o),this.telemetryService.publicLog2("galleryservice:custom:marketplace")}catch(o){this.logService.error("[Marketplace] Error retrieving enterprise gallery manifest",o),this.update(null,"accessDenied")}}update(e,t){this.extensionGalleryManifest!==e&&(this.extensionGalleryManifest=e,this._onDidChangeExtensionGalleryManifest.fire(e)),this.updateStatus(t??(this.extensionGalleryManifest?"available":"unavailable"))}updateStatus(e){this.currentStatus!==e&&(this.currentStatus=e,this._onDidChangeExtensionGalleryManifestStatus.fire(e))}checkAccess(e){return this.logService.debug("[Marketplace] Checking Account SKU access for configured gallery",e.entitlementsData?.access_type_sku),e.entitlementsData?.access_type_sku&&this.productService.extensionsGallery?.accessSKUs?.includes(e.entitlementsData.access_type_sku)?(this.logService.debug("[Marketplace] Account has access to configured gallery"),!0):(this.logService.debug("[Marketplace] Checking enterprise account access for configured gallery",e.enterprise),e.enterprise)}async requestRestart(){if((await this.dialogService.confirm({message:d(17632,null,this.productService.nameLong),primaryButton:d(17633,null)})).confirmed)return this.hostService.restart()}async getExtensionGalleryManifestFromServiceUrl(e){let o={...await this.commonHeadersPromise,"Content-Type":"application/json","Accept-Encoding":"gzip"};try{let n=await this.requestService.request({type:"GET",url:e,headers:o,callSite:"extensionGalleryManifestService.fetchManifest"},Se.None),r=await If(n);if(!r)throw new Error("Unable to retrieve extension gallery manifest.");return r}catch(n){throw this.logService.error("[Marketplace] Error retrieving extension gallery manifest",n),n}}};Opt=I([m(0,tt),m(1,Eo),m(2,fe),m(3,Te),m(4,ce),m(5,bo),m(6,Qb),m(7,B),m(8,Ea),m(9,ng),m(10,se),m(11,at),m(12,Zt)],Opt);Ee(Dv,Opt,0);var TGe=class extends x{constructor(e,t){super();this.fileService=e;this.productService=t;this.allConfigBasedTips=new Map;this.productService.configBasedExtensionTips&&Object.entries(this.productService.configBasedExtensionTips).forEach(([,o])=>this.allConfigBasedTips.set(o.configPath,o))}getConfigBasedTips(e){return this.getValidConfigBasedTips(e)}async getImportantExecutableBasedTips(){return[]}async getOtherExecutableBasedTips(){return[]}async getValidConfigBasedTips(e){let t=[];for(let[o,n]of this.allConfigBasedTips)if(!(n.configScheme&&n.configScheme!==e.scheme))try{let r=(await this.fileService.readFile(Ge(e,o))).value.toString();for(let[s,l]of Object.entries(n.recommendations))(!l.contentPattern||new RegExp(l.contentPattern,"mig").test(r))&&t.push({extensionId:s,extensionName:l.name,configName:n.configName,important:!!l.important,isExtensionPack:!!l.isExtensionPack,whenNotInstalled:l.whenNotInstalled})}catch{}return t}};TGe=I([m(0,fe),m(1,tt)],TGe);var Fpt=class extends TGe{constructor(i,e,t){super(i,e),this.channel=t.getChannel("extensionTipsService")}getConfigBasedTips(i){return i.scheme===Q.file?this.channel.call("getConfigBasedTips",[i]):super.getConfigBasedTips(i)}getImportantExecutableBasedTips(){return this.channel.call("getImportantExecutableBasedTips")}getOtherExecutableBasedTips(){return this.channel.call("getOtherExecutableBasedTips")}};Fpt=I([m(0,fe),m(1,tt),m(2,Qb)],Fpt);Ee(jke,Fpt,1);var _Ge=class extends x{constructor(e,t){super();this.userDataProfilesService=t;this._status="uninitialized";this._onDidChangeStatus=this._register(new E);this.onDidChangeStatus=this._onDidChangeStatus.event;this._conflicts=[];this._onDidChangeConflicts=this._register(new E);this.onDidChangeConflicts=this._onDidChangeConflicts.event;this._lastSyncTime=void 0;this._onDidChangeLastSyncTime=this._register(new E);this.onDidChangeLastSyncTime=this._onDidChangeLastSyncTime.event;this._onSyncErrors=this._register(new E);this.onSyncErrors=this._onSyncErrors.event;this.channel={call(o,n,r){return e.call(o,n,r).then(null,s=>{throw Vg.toUserDataSyncError(s)})},listen(o,n){return e.listen(o,n)}},this.channel.call("_getInitialData").then(([o,n,r])=>{this.updateStatus(o),this.updateConflicts(n),r&&this.updateLastSyncTime(r),this._register(this.channel.listen("onDidChangeStatus")(s=>this.updateStatus(s))),this._register(this.channel.listen("onDidChangeLastSyncTime")(s=>this.updateLastSyncTime(s)))}),this._register(this.channel.listen("onDidChangeConflicts")(o=>this.updateConflicts(o))),this._register(this.channel.listen("onSyncErrors")(o=>this._onSyncErrors.fire(o.map(n=>({...n,error:Vg.toUserDataSyncError(n.error)})))))}get status(){return this._status}get onDidChangeLocal(){return this.channel.listen("onDidChangeLocal")}get conflicts(){return this._conflicts}get lastSyncTime(){return this._lastSyncTime}get onDidResetLocal(){return this.channel.listen("onDidResetLocal")}get onDidResetRemote(){return this.channel.listen("onDidResetRemote")}createSyncTask(){throw new Error("not supported")}async createManualSyncTask(){let e=await this.channel.call("createManualSyncTask"),t=this;return new lzi(e,{async call(n,r,s){return t.channel.call(`manualSync/${n}`,[e,...Array.isArray(r)?r:[r]],s)},listen(){throw new Error("not supported")}})}reset(){return this.channel.call("reset")}resetRemote(){return this.channel.call("resetRemote")}resetLocal(){return this.channel.call("resetLocal")}hasPreviouslySynced(){return this.channel.call("hasPreviouslySynced")}hasLocalData(){return this.channel.call("hasLocalData")}accept(e,t,o,n){return this.channel.call("accept",[e,t,o,n])}resolveContent(e){return this.channel.call("resolveContent",[e])}cleanUpRemoteData(){return this.channel.call("cleanUpRemoteData")}replace(e){return this.channel.call("replace",[e])}saveRemoteActivityData(e){return this.channel.call("getRemoteActivityData",[e])}extractActivityData(e,t){return this.channel.call("extractActivityData",[e,t])}async updateStatus(e){this._status=e,this._onDidChangeStatus.fire(e)}async updateConflicts(e){this._conflicts=e.map(t=>({syncResource:t.syncResource,profile:fw(t.profile,this.userDataProfilesService.profilesHome.scheme),conflicts:t.conflicts.map(o=>({...o,baseResource:A.revive(o.baseResource),localResource:A.revive(o.localResource),remoteResource:A.revive(o.remoteResource),previewResource:A.revive(o.previewResource)}))})),this._onDidChangeConflicts.fire(this._conflicts)}updateLastSyncTime(e){this._lastSyncTime!==e&&(this._lastSyncTime=e,this._onDidChangeLastSyncTime.fire(e))}};_Ge=I([m(1,an)],_Ge);var lzi=class extends x{constructor(e,t){super();this.id=e;this.channel=t}async merge(){return this.channel.call("merge")}async apply(){return this.channel.call("apply")}stop(){return this.channel.call("stop")}dispose(){this.channel.call("dispose"),super.dispose()}};var G7t=class extends x{constructor(e){super();this.channel=e;this._onDidChangeAccount=this._register(new E);this.onDidChangeAccount=this._onDidChangeAccount.event;this.channel.call("_getInitialData").then(t=>{this._account=t,this._register(this.channel.listen("onDidChangeAccount")(o=>{this._account=o,this._onDidChangeAccount.fire(o)}))})}get account(){return this._account}get onTokenFailed(){return this.channel.listen("onTokenFailed")}updateAccount(e){return this.channel.call("updateAccount",e)}};var DGe=class extends Rme{constructor(e,t,o,n){super(t,o,n);this.channel=e;this._register(this.channel.listen("onDidChangeUserDataSyncStore")(()=>this.updateUserDataSyncStore()))}async switch(e){return this.channel.call("switch",[e])}async getPreviousUserDataSyncStore(){let e=await this.channel.call("getPreviousUserDataSyncStore");return this.revive(e)}revive(e){return{url:A.revive(e.url),type:e.type,defaultUrl:A.revive(e.defaultUrl),insidersUrl:A.revive(e.insidersUrl),stableUrl:A.revive(e.stableUrl),canSwitch:e.canSwitch,authenticationProviders:e.authenticationProviders}}};DGe=I([m(1,tt),m(2,B),m(3,ce)],DGe);Jv(bI,"userDataSync",{channelClientCtor:_Ge});Jv($Re,"IUserDataSyncResourceProviderService");Jv(Pee,"userDataSyncMachines");Jv(jRe,"userDataSyncAccount",{channelClientCtor:G7t});Jv(pM,"userDataSyncStoreManagement",{channelClientCtor:DGe});var Wpt=class{get onError(){return U.map(this.channel.listen("onError"),i=>Vg.toUserDataSyncError(i))}constructor(i){this.channel=i.getChannel("userDataAutoSync")}triggerSync(i,e){return this.channel.call("triggerSync",[i,e])}turnOn(){return this.channel.call("turnOn")}turnOff(i){return this.channel.call("turnOff",[i])}};Wpt=I([m(0,Qb)],Wpt);Ee(PT,Wpt,1);var Bpt=class extends XTe{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super(o,n,r,s,l,c,u,p,h);this._nativeHostService=e;this._environmentService=t;this._productService=g;this._storageService=f;this.setPerformanceMarks("main",t.window.perfMarks)}_isInitialStartup(){return!!this._environmentService.window.isInitialStartup}_didUseCachedData(){return fyn(this._productService,this._storageService,this._environmentService)}_getWindowCount(){return this._nativeHostService.getWindowCount()}async _extendStartupInfo(e){try{let[t,o,n,r]=await Promise.all([this._nativeHostService.getOSProperties(),this._nativeHostService.getOSStatistics(),this._nativeHostService.getOSVirtualMachineHint(),this._nativeHostService.isRunningUnderARM64Translation()]);e.totalmem=o.totalmem,e.freemem=o.freemem,e.platform=t.platform,e.release=t.release,e.arch=t.arch,e.loadavg=o.loadavg,e.isARM64Emulated=r;let s=await eP.getProcessMemoryInfo();e.meminfo={workingSetSize:s.residentSet,privateBytes:s.private,sharedBytes:s.shared},e.isVMLikelyhood=Math.round(n*100);let l=t.cpus;l&&l.length>0&&(e.cpus={count:l.length,speed:l[0].speed,model:l[0].model})}catch{}}_shouldReportPerfMarks(){return super._shouldReportPerfMarks()||!!this._environmentService.args["prof-append-timers"]}};Bpt=I([m(0,ko),m(1,zr),m(2,ji),m(3,Pe),m(4,lt),m(5,zd),m(6,us),m(7,ee),m(8,Oi),m(9,Te),m(10,yi),m(11,tt),m(12,ce)],Bpt);Ee(YC,Bpt,1);var mAo="perf/lastRunningCommit",Vpt;function fyn(a,i,e){return typeof Vpt!="boolean"&&(!e.window.isCodeCaching||!a.commit?Vpt=!1:i.get(mAo,-1)===a.commit?Vpt=!0:(i.store(mAo,a.commit,-1,1),Vpt=!1)),Vpt}var q7t=le("checksumService");var czi=class a{constructor(i){this.storageService=i;this.value=this._read()}static{this.KEY="integrityService"}_read(){let i=this.storageService.get(a.KEY,-1);if(!i)return null;try{return JSON.parse(i)}catch{return null}}get(){return this.value}set(i){this.value=i,this.storageService.store(a.KEY,JSON.stringify(this.value),-1,1)}},mse=class{constructor(i,e,t,o,n,r,s){this.notificationService=i;this.lifecycleService=t;this.openerService=o;this.productService=n;this.checksumService=r;this.logService=s;this.storage=new czi(e),this.isPurePromise=this._isPure(),this._compute()}isPure(){return this.isPurePromise}async _compute(){let{isPure:i}=await this.isPure();if(i)return;this.logService.warn(`

----------------------------------------------
***	Installation has been modified on disk ***
----------------------------------------------

`);let e=this.storage.get();e?.dontShowPrompt&&e.commit===this.productService.commit||this._showNotification()}async _isPure(){let i=this.productService.checksums||{};await this.lifecycleService.when(4);let e=await Promise.all(Object.keys(i).map(o=>this._resolve(o,i[o]))),t=!0;for(let o=0,n=e.length;o<n;o++)if(!e[o].isPure){t=!1;break}return{isPure:t,proof:e}}async _resolve(i,e){let t=vn.asFileUri(i);try{let o=await this.checksumService.checksum(t);return mse._createChecksumPair(t,o,e)}catch{return mse._createChecksumPair(t,"",e)}}static _createChecksumPair(i,e,t){return{uri:i,actual:e,expected:t,isPure:e===t}}_showNotification(){let i=this.productService.checksumFailMoreInfoUrl,e=d(17801,null,this.productService.nameShort);i?this.notificationService.prompt(bt.Warning,e,[{label:d(17800,null),run:()=>this.openerService.open(A.parse(i))},{label:d(17799,null),isSecondary:!0,run:()=>this.storage.set({dontShowPrompt:!0,commit:this.productService.commit})}],{sticky:!0,priority:3}):this.notificationService.notify({severity:bt.Warning,message:e,sticky:!0,priority:3})}};mse=I([m(0,Ne),m(1,ce),m(2,ji),m(3,Je),m(4,tt),m(5,q7t),m(6,se)],mse);Ee(_2e,mse,1);var $7t=class a extends x{constructor(e,t,o,n,r,s,l){super();this.workingCopyBackupService=e;this.workingCopyService=t;this.logService=o;this.lifecycleService=n;this.filesConfigurationService=r;this.workingCopyEditorService=s;this.editorService=l;this.mapWorkingCopyToContentVersion=new Map;this.pendingBackupOperations=new Map;this.suspended=!1;this.unrestoredBackups=new Set;this._isReady=!1;this.whenReady=this.resolveBackupsToRestore();for(let c of this.workingCopyService.modifiedWorkingCopies)this.onDidRegister(c);this.registerListeners()}registerListeners(){this._register(this.workingCopyService.onDidRegister(e=>this.onDidRegister(e))),this._register(this.workingCopyService.onDidUnregister(e=>this.onDidUnregister(e))),this._register(this.workingCopyService.onDidChangeDirty(e=>this.onDidChangeDirty(e))),this._register(this.workingCopyService.onDidChangeContent(e=>this.onDidChangeContent(e))),this._register(this.lifecycleService.onBeforeShutdown(e=>e.finalVeto(()=>this.onFinalBeforeShutdown(e.reason),"veto.backups"))),this._register(this.lifecycleService.onWillShutdown(()=>this.onWillShutdown())),this._register(this.workingCopyEditorService.onDidRegisterHandler(e=>this.restoreBackups(e)))}onWillShutdown(){this.cancelBackupOperations(),this.suspendBackupOperations()}static{this.DEFAULT_BACKUP_SCHEDULE_DELAYS={default:1e3,delayed:2e3}}onDidRegister(e){if(this.suspended){this.logService.warn("[backup tracker] suspended, ignoring register event",e.resource.toString(),e.typeId);return}e.isModified()&&this.scheduleBackup(e)}onDidUnregister(e){if(this.mapWorkingCopyToContentVersion.delete(e),this.suspended){this.logService.warn("[backup tracker] suspended, ignoring unregister event",e.resource.toString(),e.typeId);return}this.discardBackup(e)}onDidChangeDirty(e){if(this.suspended){this.logService.warn("[backup tracker] suspended, ignoring dirty change event",e.resource.toString(),e.typeId);return}e.isDirty()?this.scheduleBackup(e):this.discardBackup(e)}onDidChangeContent(e){let t=this.getContentVersion(e);if(this.mapWorkingCopyToContentVersion.set(e,t+1),this.suspended){this.logService.warn("[backup tracker] suspended, ignoring content change event",e.resource.toString(),e.typeId);return}e.isModified()&&this.scheduleBackup(e)}scheduleBackup(e){this.cancelBackupOperation(e),this.logService.trace("[backup tracker] scheduling backup",e.resource.toString(),e.typeId);let t={resource:e.resource,typeId:e.typeId},o=new Ye,n=setTimeout(async()=>{if(!o.token.isCancellationRequested){if(e.isModified()){this.logService.trace("[backup tracker] creating backup",e.resource.toString(),e.typeId);try{let r=await e.backup(o.token);if(o.token.isCancellationRequested)return;e.isModified()&&(this.logService.trace("[backup tracker] storing backup",e.resource.toString(),e.typeId),await this.workingCopyBackupService.backup(e,r.content,this.getContentVersion(e),r.meta,o.token))}catch(r){this.logService.error(r)}}o.token.isCancellationRequested||this.doClearPendingBackupOperation(t)}},this.getBackupScheduleDelay(e));this.pendingBackupOperations.set(t,{cancel:()=>{this.logService.trace("[backup tracker] clearing pending backup creation",e.resource.toString(),e.typeId),o.cancel()},disposable:Z(()=>{o.dispose(),clearTimeout(n)})})}getBackupScheduleDelay(e){if(typeof e.backupDelay=="number")return e.backupDelay;let t;return e.capabilities&2?t="default":t=this.filesConfigurationService.hasShortAutoSaveDelay(e.resource)?"delayed":"default",a.DEFAULT_BACKUP_SCHEDULE_DELAYS[t]}getContentVersion(e){return this.mapWorkingCopyToContentVersion.get(e)||0}discardBackup(e){this.cancelBackupOperation(e);let t={resource:e.resource,typeId:e.typeId},o=new Ye;this.doDiscardBackup(t,o),this.pendingBackupOperations.set(t,{cancel:()=>{this.logService.trace("[backup tracker] clearing pending backup discard",e.resource.toString(),e.typeId),o.cancel()},disposable:o})}async doDiscardBackup(e,t){this.logService.trace("[backup tracker] discarding backup",e.resource.toString(),e.typeId);try{await this.workingCopyBackupService.discardBackup(e,t.token)}catch(o){this.logService.error(o)}t.token.isCancellationRequested||this.doClearPendingBackupOperation(e)}cancelBackupOperation(e){let t;for(let[o]of this.pendingBackupOperations)if(o.resource.toString()===e.resource.toString()&&o.typeId===e.typeId){t=o;break}t&&this.doClearPendingBackupOperation(t,{cancel:!0})}doClearPendingBackupOperation(e,t){let o=this.pendingBackupOperations.get(e);o&&(t?.cancel&&o.cancel(),o.disposable.dispose(),this.pendingBackupOperations.delete(e))}cancelBackupOperations(){for(let[,e]of this.pendingBackupOperations)e.cancel(),e.disposable.dispose();this.pendingBackupOperations.clear()}suspendBackupOperations(){return this.suspended=!0,{resume:()=>this.suspended=!1}}get isReady(){return this._isReady}async resolveBackupsToRestore(){await this.lifecycleService.when(3);for(let e of await this.workingCopyBackupService.getBackups())this.unrestoredBackups.add(e);this._isReady=!0}async restoreBackups(e){await this.whenReady;let t=new Set,o=new Set,n=new Set;for(let r of this.unrestoredBackups){if(!await e.handles(r))continue;let l=!1;for(let{editor:c}of this.editorService.getEditors(0))e.isOpen(r,c)&&(t.add(c),l=!0);l||o.add(await e.createEditor(r)),n.add(r)}if(o.size>0){await this.editorService.openEditors([...o].map(r=>({editor:r,options:{pinned:!0,preserveFocus:!0,inactive:!0}})));for(let r of o)t.add(r)}await dn.settled([...t].map(async r=>{if(!this.editorService.isVisible(r))return r.resolve()}));for(let r of n)this.unrestoredBackups.delete(r)}};var gSe=class extends $7t{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super(e,o,u,n,t,g,f);this.fileDialogService=r;this.dialogService=s;this.contextService=l;this.nativeHostService=c;this.environmentService=p;this.progressService=h}static{this.ID="workbench.contrib.nativeWorkingCopyBackupTracker"}async onFinalBeforeShutdown(e){this.cancelBackupOperations();let{resume:t}=this.suspendBackupOperations();try{let o=this.workingCopyService.modifiedWorkingCopies;return o.length?await this.onBeforeShutdownWithModified(e,o):await this.onBeforeShutdownWithoutModified()}finally{t()}}async onBeforeShutdownWithModified(e,t){let o=t.filter(n=>!(n.capabilities&2)&&this.filesConfigurationService.getAutoSaveMode(n.resource).mode!==0);if(o.length>0){try{await this.doSaveAllBeforeShutdown(o,2)}catch(r){this.logService.error(`[backup tracker] error saving modified working copies: ${r}`)}let n=this.workingCopyService.modifiedWorkingCopies;return n.length?this.handleModifiedBeforeShutdown(n,e):this.noVeto([...t])}return this.handleModifiedBeforeShutdown(t,e)}async handleModifiedBeforeShutdown(e,t){let o=[],n,r=await this.shouldBackupBeforeShutdown(t,e);if(r.length>0)try{let l=await this.backupBeforeShutdown(r);if(o=l.backups,n=l.error,o.length===e.length)return!1}catch(l){n=l}let s=e.filter(l=>!o.includes(l));if(n)return this.environmentService.isExtensionDevelopment?(this.logService.error(`[backup tracker] error creating backups: ${n}`),!1):this.showErrorDialog(d(18368,null),s,n,t);try{return await this.confirmBeforeShutdown(s)}catch(l){return this.environmentService.isExtensionDevelopment?(this.logService.error(`[backup tracker] error saving or reverting modified working copies: ${l}`),!1):this.showErrorDialog(d(18369,null),s,l,t)}}async shouldBackupBeforeShutdown(e,t){if(!this.filesConfigurationService.isHotExitEnabled)return[];if(this.environmentService.isExtensionDevelopment)return t;switch(e){case 1:return this.contextService.getWorkbenchState()!==1&&this.filesConfigurationService.hotExitConfiguration===XS.ON_EXIT_AND_WINDOW_CLOSE?t:Ze||await this.nativeHostService.getWindowCount()>1?this.contextService.getWorkbenchState()!==1?t.filter(o=>o.capabilities&4):[]:t;case 2:return t;case 3:return t;case 4:return this.contextService.getWorkbenchState()!==1?this.filesConfigurationService.hotExitConfiguration===XS.ON_EXIT_AND_WINDOW_CLOSE?t:t.filter(o=>o.capabilities&4):[]}}async showErrorDialog(e,t,o,n){this.logService.error(`[backup tracker] ${e}: ${o}`);let r=t.filter(u=>u.isModified()),s=d(18367,null),l=r.length?`${kC(r.map(u=>u.name))}
${s}`:s,{result:c}=await this.dialogService.prompt({type:"error",message:e,detail:l,buttons:[{label:d(18371,null),run:()=>!0},{label:this.toForceShutdownLabel(n),run:()=>!1}]});return c??!0}toForceShutdownLabel(e){switch(e){case 1:case 4:return d(18374,null);case 2:return d(18375,null);case 3:return d(18376,null)}}async backupBeforeShutdown(e){let t=[],o;return await this.withProgressAndCancellation(async n=>{try{await dn.settled(e.map(async r=>{let s=this.getContentVersion(r);if(this.workingCopyBackupService.hasBackupSync(r,s))t.push(r);else{let l=await r.backup(n);if(n.isCancellationRequested||(await this.workingCopyBackupService.backup(r,l.content,s,l.meta,n),n.isCancellationRequested))return;t.push(r)}}))}catch(r){o=r}},d(18366,null),d(18365,null)),{backups:t,error:o}}async confirmBeforeShutdown(e){let t=await this.fileDialogService.showSaveConfirm(e.map(o=>o.name));if(t===0){let o=this.workingCopyService.modifiedCount;try{await this.doSaveAllBeforeShutdown(e,1)}catch(r){this.logService.error(`[backup tracker] error saving modified working copies: ${r}`)}return o-this.workingCopyService.modifiedCount<e.length?!0:this.noVeto(e)}else if(t===1){try{await this.doRevertAllBeforeShutdown(e)}catch(o){this.logService.error(`[backup tracker] error reverting modified working copies: ${o}`)}return this.noVeto(e)}return!0}doSaveAllBeforeShutdown(e,t){return this.withProgressAndCancellation(async()=>{let o={skipSaveParticipants:!0,reason:t},n;e.length===this.workingCopyService.modifiedCount&&(n=(await this.editorService.saveAll({includeUntitled:{includeScratchpad:!0},...o})).success),n!==!1&&await dn.settled(e.map(r=>r.isModified()?r.save(o):Promise.resolve(!0)))},d(18373,null),void 0,e.some(o=>o.capabilities&2||o.capabilities&4)?10:20)}doRevertAllBeforeShutdown(e){return this.withProgressAndCancellation(async()=>{let t={soft:!0};e.length===this.workingCopyService.modifiedCount&&await this.editorService.revertAll(t),await dn.settled(e.map(o=>o.isModified()?o.revert(t):Promise.resolve()))},d(18372,null))}onBeforeShutdownWithoutModified(){return this.noVeto({except:this.contextService.getWorkbenchState()===1?[]:Array.from(this.unrestoredBackups)})}async noVeto(e){return await this.discardBackupsBeforeShutdown(e),!1}async discardBackupsBeforeShutdown(e){this.isReady&&await this.withProgressAndCancellation(async()=>{try{Array.isArray(e)?await dn.settled(e.map(t=>this.workingCopyBackupService.discardBackup(t))):await this.workingCopyBackupService.discardBackups(e)}catch(t){this.logService.error(`[backup tracker] error discarding backups: ${t}`)}},d(18370,null))}withProgressAndCancellation(e,t,o,n=20){let r=new Ye;return this.progressService.withProgress({location:n,cancellable:!0,delay:800,title:t,detail:o},()=>Va(e(r.token),r.token),()=>r.dispose(!0))}};gSe=I([m(0,hm),m(1,gr),m(2,Xa),m(3,ji),m(4,rn),m(5,at),m(6,Pe),m(7,ko),m(8,se),m(9,Eo),m(10,Fo),m(11,iv),m(12,ee)],gSe);var Hpt=class extends cse{constructor(e,t,o,n){super(e.backupPath?A.file(e.backupPath).with({scheme:e.userRoamingDataHome.scheme}):void 0,t,o);this.lifecycleService=n;this.registerListeners()}registerListeners(){this._register(this.lifecycleService.onWillShutdown(e=>e.join(this.joinBackups(),{id:"join.workingCopyBackups",label:d(18364,null)})))}};Hpt=I([m(0,zr),m(1,fe),m(2,se),m(3,ji)],Hpt);Ee(hm,Hpt,0);It(gSe.ID,gSe,St.BlockStartup);Jv(q7t,"checksum");var Upt=le("sharedProcessTunnelService"),hAo="sharedProcessTunnel";Jv(Upt,hAo);var zpt=class extends x{constructor(e,t,o,n,r,s,l,c,u){super();this._id=e;this._addressProvider=t;this.tunnelRemoteHost=o;this.tunnelRemotePort=n;this.tunnelLocalPort=r;this.localAddress=s;this._onBeforeDispose=l;this._sharedProcessTunnelService=c;this._remoteAuthorityResolverService=u;this.privacy="private";this.protocol=void 0;this._updateAddress(),this._register(this._remoteAuthorityResolverService.onDidChangeConnectionData(()=>this._updateAddress()))}_updateAddress(){this._addressProvider.getAddress().then(e=>{this._sharedProcessTunnelService.setAddress(this._id,e)})}async dispose(){this._onBeforeDispose(),super.dispose(),await this._sharedProcessTunnelService.destroyTunnel(this._id)}};zpt=I([m(7,Upt),m(8,Uc)],zpt);var Kpt=class extends bDe{constructor(e,t,o,n,r,s,l){super(e,l);this._environmentService=t;this._sharedProcessTunnelService=o;this._instantiationService=n;this._nativeWorkbenchEnvironmentService=s;this._activeSharedProcessTunnels=new Set;this._register(r.onDidShutdown(()=>{this._activeSharedProcessTunnels.forEach(c=>{this._sharedProcessTunnelService.destroyTunnel(c)})}))}isPortPrivileged(e){return gso(e,this.defaultTunnelHost,Po,this._nativeWorkbenchEnvironmentService.os.release)}retainOrCreateTunnel(e,t,o,n,r,s,l,c){let u=this.getTunnelFromMap(t,o);if(u)return++u.refcount,u.value;if(mso(e))return this.createWithProvider(e,t,o,r,s,l,c);{this.logService.trace(`ForwardedPorts: (TunnelService) Creating tunnel without provider ${t}:${o} on local port ${r}.`);let p=this._createSharedProcessTunnel(e,t,o,n,r,s);return this.logService.trace("ForwardedPorts: (TunnelService) Tunnel created without provider."),this.addTunnelToMap(t,o,p),p}}async _createSharedProcessTunnel(e,t,o,n,r,s){let{id:l}=await this._sharedProcessTunnelService.createTunnel();this._activeSharedProcessTunnels.add(l);let c=this._environmentService.remoteAuthority,u=await this._sharedProcessTunnelService.startTunnel(c,l,t,o,n,r,s);return this._instantiationService.createInstance(zpt,l,e,t,o,u.tunnelLocalPort,u.localAddress,()=>{this._activeSharedProcessTunnels.delete(l)})}canTunnel(e){return super.canTunnel(e)&&!!this._environmentService.remoteAuthority}};Kpt=I([m(0,se),m(1,At),m(2,Upt),m(3,F),m(4,ji),m(5,zr),m(6,B)],Kpt);Ee(_p,Kpt,1);Jv(fMe,"diagnostics");var j7t=le("IV8InspectProfilingService"),LGe;(e=>{function a(t){return!!(t.samples&&t.timeDeltas)}e.isValidProfile=a;function i(t,o="noAbsolutePaths"){for(let n of t.nodes)n.callFrame&&n.callFrame.url&&(Zl(n.callFrame.url)||/^\w[\w\d+.-]*:\/\/\/?/.test(n.callFrame.url))&&(n.callFrame.url=Yc(o,jo(n.callFrame.url)));return t}e.rewriteAbsolutePaths=i})(LGe||={});Jv(j7t,"v8InspectProfiling");Jv(Bgt,"customEndpointTelemetry");var Q7t=le("IRemoteTunnelService"),gAo={active:!1},vyn;(o=>(o.disconnected=n=>({type:"disconnected",onTokenFailed:n}),o.connected=(n,r)=>({type:"connected",info:n,serviceInstallFailed:r}),o.connecting=n=>({type:"connecting",progress:n}),o.uninitialized={type:"uninitialized"}))(vyn||={});var Y7t="remote.tunnels.access",fAo=Y7t+".hostNameOverride",vAo=Y7t+".preventSleep",X7t="remoteTunnelService",bAo=d(2324,null);Jv(Q7t,"remoteTunnel");var Gpt=class{constructor(i,e,t,o,n){this.nativeHostService=i;this.fileService=e;this.environmentService=t;this.workspaceTrustRequestService=o;this.labelService=n}isSupported(i){return i.scheme===Q.file}async writeFileElevated(i,e,t){if(!await this.workspaceTrustRequestService.requestWorkspaceTrust({message:ei?d(17784,null,this.labelService.getUriLabel(i)):d(17783,null,this.labelService.getUriLabel(i))}))throw new Error(d(17782,null));let n=A.file(gIe(this.environmentService.userDataPath,"code-elevated"));try{await this.fileService.writeFile(n,e,t),await this.nativeHostService.writeElevated(n,i,t)}finally{await this.fileService.del(n)}return this.fileService.resolve(i,{resolveMetadata:!0})}};Gpt=I([m(0,ko),m(1,fe),m(2,zr),m(3,Vu),m(4,rt)],Gpt);Ee(l0,Gpt,1);var RGe=class extends x{constructor(e,t,o,n,r,s,l){super();this.modelService=e;this.editorService=t;this.telemetryService=o;this.logService=n;this.extensionService=r;this.fileService=s;this.uriIdentityService=l;this.fileSearchProviders=new Map;this.textSearchProviders=new Map;this.aiTextSearchProviders=new Map;this.deferredFileSearchesByScheme=new Map;this.deferredTextSearchesByScheme=new Map;this.deferredAITextSearchesByScheme=new Map;this.loggedSchemesMissingProviders=new Set}registerSearchResultProvider(e,t,o){let n,r;if(t===0)n=this.fileSearchProviders,r=this.deferredFileSearchesByScheme;else if(t===1)n=this.textSearchProviders,r=this.deferredTextSearchesByScheme;else if(t===2)n=this.aiTextSearchProviders,r=this.deferredAITextSearchesByScheme;else throw new Error("Unknown SearchProviderType");return n.set(e,o),r.has(e)&&(r.get(e).complete(o),r.delete(e)),Z(()=>{n.delete(e)})}async textSearch(e,t,o){let n=this.textSearchSplitSyncAsync(e,t,o),r=n.syncResults,s=await n.asyncResults;return{limitHit:s.limitHit||r.limitHit,results:[...s.results,...r.results],messages:[...s.messages,...r.messages]}}async aiTextSearch(e,t,o){let n=r=>{o&&(Ivi(r)||DPt(r),o(r)),yvi(r)&&this.logService.debug("SearchService#search",r.message)};return this.doSearch(e,t,n)}async getAIName(){return await this.getSearchProvider(3).get(Q.file)?.getAIName()}textSearchSplitSyncAsync(e,t,o,n,r){let s=this.getOpenEditorResults(e);return o&&di([...s.results.values()]).filter(u=>!(n&&n.has(u.resource))).forEach(o),{syncResults:{results:di([...s.results.values()]),limitHit:s.limitHit??!1,messages:[]},asyncResults:(async()=>{let u=await r??new En,p=h=>{Ivi(h)?!s.results.has(h.resource)&&!u.has(h.resource)&&o&&o(h):o&&o(h),yvi(h)&&this.logService.debug("SearchService#search",h.message)};return await this.doSearch(e,t,p)})()}}fileSearch(e,t){return this.doSearch(e,t)}schemeHasFileSearchProvider(e){return this.fileSearchProviders.has(e)}doSearch(e,t,o){this.logService.trace("SearchService#search",JSON.stringify(e));let n=this.getSchemesInQuery(e),r=[Promise.resolve(null)];n.forEach(l=>r.push(this.extensionService.activateByEvent(`onSearch:${l}`))),r.push(this.extensionService.activateByEvent("onSearch:file"));let s=(async()=>{if(await Promise.all(r),await this.extensionService.whenInstalledExtensionsRegistered(),t&&t.isCancellationRequested)return Promise.reject(new go);let l=p=>{t&&t.isCancellationRequested||o?.(p)},c=await Promise.all(e.folderQueries.map(p=>this.fileService.exists(p.folder)));e.folderQueries=e.folderQueries.filter((p,h)=>c[h]);let u=await this.searchWithProviders(e,l,t);return u=di(u),u.length?{limitHit:u[0]&&u[0].limitHit,stats:u[0].stats,messages:di(u.flatMap(p=>p.messages)).filter(T2i(p=>p.type+p.text+p.trusted)),results:u.flatMap(p=>p.results),aiKeywords:u.flatMap(p=>p.aiKeywords).filter(p=>p!==void 0)}:{limitHit:!1,results:[],messages:[]}})();return t?Wp(s,t):s}getSchemesInQuery(e){let t=new Set;return e.folderQueries?.forEach(o=>t.add(o.folder.scheme)),e.extraFileResources?.forEach(o=>t.add(o.scheme)),t}async waitForProvider(e,t){let o=this.getDeferredTextSearchesByScheme(e);if(o.has(t))return o.get(t).p;{let n=new Ko;return o.set(t,n),n.p}}getSearchProvider(e){switch(e){case 1:return this.fileSearchProviders;case 2:return this.textSearchProviders;case 3:return this.aiTextSearchProviders;default:throw new Error(`Unknown query type: ${e}`)}}getDeferredTextSearchesByScheme(e){switch(e){case 1:return this.deferredFileSearchesByScheme;case 2:return this.deferredTextSearchesByScheme;case 3:return this.deferredAITextSearchesByScheme;default:throw new Error(`Unknown query type: ${e}`)}}async searchWithProviders(e,t,o){let n=Dn.create(!1),r=[],s=this.groupFolderQueriesByScheme(e),l=[...s.keys()].some(c=>this.getSearchProvider(e.type).has(c));return await Promise.all([...s.keys()].map(async c=>{if(e.onlyFileScheme&&c!==Q.file)return;let u=s.get(c),p=this.getSearchProvider(e.type).get(c);if(!p)if(l){this.loggedSchemesMissingProviders.has(c)||(this.logService.warn(`No search provider registered for scheme: ${c}. Another scheme has a provider, not waiting for ${c}`),this.loggedSchemesMissingProviders.add(c));return}else this.loggedSchemesMissingProviders.has(c)||(this.logService.warn(`No search provider registered for scheme: ${c}, waiting`),this.loggedSchemesMissingProviders.add(c)),p=await this.waitForProvider(e.type,c);let h={...e,folderQueries:u},g=()=>{switch(e.type){case 1:return p.fileSearch(h,o);case 2:return p.textSearch(h,t,o);default:return p.textSearch(h,t,o)}};r.push(g())})),Promise.all(r).then(c=>{let u=n.elapsed();return this.logService.trace(`SearchService#search: ${u}ms`),c.forEach(p=>{this.sendTelemetry(e,u,p)}),c},c=>{let u=n.elapsed();this.logService.trace(`SearchService#search: ${u}ms`);let p=qno(c);throw this.logService.trace(`SearchService#searchError: ${p.message}`),this.sendTelemetry(e,u,void 0,p),p})}groupFolderQueriesByScheme(e){let t=new Map;return e.folderQueries.forEach(o=>{let n=t.get(o.folder.scheme)||[];n.push(o),t.set(o.folder.scheme,n)}),t}sendTelemetry(e,t,o,n){if(!uqi(5/100))return;let r=e.folderQueries.every(c=>c.folder.scheme===Q.file),s=e.folderQueries.every(c=>c.folder.scheme!==Q.file),l=r?Q.file:s?"other":"mixed";if(e.type===1&&o&&o.stats){let c=o.stats;if(c.fromCache){let u=c.detailStats;this.telemetryService.publicLog2("cachedSearchComplete",{reason:e._reason,resultCount:c.resultCount,workspaceFolderCount:e.folderQueries.length,endToEndTime:t,sortingTime:c.sortingTime,cacheWasResolved:u.cacheWasResolved,cacheLookupTime:u.cacheLookupTime,cacheFilterTime:u.cacheFilterTime,cacheEntryCount:u.cacheEntryCount,scheme:l})}else{let u=c.detailStats;this.telemetryService.publicLog2("searchComplete",{reason:e._reason,resultCount:c.resultCount,workspaceFolderCount:e.folderQueries.length,endToEndTime:t,sortingTime:c.sortingTime,fileWalkTime:u.fileWalkTime,directoriesWalked:u.directoriesWalked,filesWalked:u.filesWalked,cmdTime:u.cmdTime,cmdResultCount:u.cmdResultCount,scheme:l})}}else if(e.type===2){let c;n&&(c=n.code===2?"regex":n.code===1?"encoding":n.code===3?"glob":n.code===4?"literal":n.code===6?"other":n.code===7?"canceled":"unknown"),this.telemetryService.publicLog2("textSearchComplete",{reason:e._reason,workspaceFolderCount:e.folderQueries.length,endToEndTime:t,scheme:l,error:c})}}getOpenEditorResults(e){let t=new gt(n=>this.uriIdentityService.extUri.getComparisonKey(n)),o=!1;if(e.type===2){let n=new gt;for(let s of this.editorService.editors){let l=po.getCanonicalUri(s,{supportSideBySide:1}),c=po.getOriginalUri(s,{supportSideBySide:1});l&&n.set(l,c??l)}this.modelService.getModels().forEach(s=>{let l=s.uri;if(!l||o)return;let c=n.get(l);if(!c||s.getLanguageId()===a2&&!(e.includePattern&&e.includePattern["**/*.code-search"])||c.scheme!==Q.untitled&&!this.fileService.hasProvider(c)||c.scheme==="git"||!this.matches(c,e))return;let u=(Yo(e.maxResults)?e.maxResults:K4)+1,p=s.findMatches(e.contentPattern.pattern,!1,!!e.contentPattern.isRegExp,!!e.contentPattern.isCaseSensitive,e.contentPattern.isWordMatch?e.contentPattern.wordSeparators:null,!1,u);if(p.length){u&&p.length>=u&&(o=!0,p=p.slice(0,u-1));let h=new EPt(c);t.set(c,h);let g=b$t(p,s,e.previewOptions);h.results=_Ve(g,s,e)}else t.set(c,null)})}return{results:t,limitHit:o}}matches(e,t){return zue(t,e.fsPath)}async clearCache(e){let t=Array.from(this.fileSearchProviders.values()).map(o=>o&&o.clearCache(e));await Promise.all(t)}};RGe=I([m(0,Tt),m(1,ee),m(2,Te),m(3,se),m(4,lt),m(5,fe),m(6,ht)],RGe);Ee(gg,RGe,1);var oV=class extends x{constructor(e,t,o,n,r,s,l,c){super();this.workingCopyService=e;this.workingCopyHistoryService=t;this.uriIdentityService=o;this.pathService=n;this.configurationService=r;this.undoRedoService=s;this.contextService=l;this.fileService=c;this.limiter=this._register(new g_(QKe));this.resourceExcludeMatcher=this._register(new H$(()=>this._register(new cI(t=>this.configurationService.getValue(oV.SETTINGS.EXCLUDES,{resource:t}),t=>t.affectsConfiguration(oV.SETTINGS.EXCLUDES),this.contextService,this.configurationService))));this.pendingAddHistoryEntryOperations=new gt(e=>this.uriIdentityService.extUri.getComparisonKey(e));this.workingCopyContentVersion=new gt(e=>this.uriIdentityService.extUri.getComparisonKey(e));this.historyEntryContentVersion=new gt(e=>this.uriIdentityService.extUri.getComparisonKey(e));this.registerListeners()}static{this.SETTINGS={ENABLED:"workbench.localHistory.enabled",SIZE_LIMIT:"workbench.localHistory.maxFileSize",EXCLUDES:"workbench.localHistory.exclude"}}static{this.UNDO_REDO_SAVE_SOURCE=Ih.registerSource("undoRedo.source",d(18363,null))}registerListeners(){this._register(this.fileService.onDidRunOperation(e=>this.onDidRunFileOperation(e))),this._register(this.workingCopyService.onDidChangeContent(e=>this.onDidChangeContent(e))),this._register(this.workingCopyService.onDidSave(e=>this.onDidSave(e)))}async onDidRunFileOperation(e){if(!this.shouldTrackHistoryFromFileOperationEvent(e))return;let t=e.resource,o=e.target.resource,n=await this.workingCopyHistoryService.moveEntries(t,o);for(let r of n){let s=this.getContentVersion(r);this.historyEntryContentVersion.set(r,s)}}onDidChangeContent(e){let t=this.getContentVersion(e.resource);this.workingCopyContentVersion.set(e.resource,t+1)}getContentVersion(e){return this.workingCopyContentVersion.get(e)||0}onDidSave(e){if(!this.shouldTrackHistoryFromSaveEvent(e))return;let t=this.getContentVersion(e.workingCopy.resource);if(this.historyEntryContentVersion.get(e.workingCopy.resource)===t)return;this.pendingAddHistoryEntryOperations.get(e.workingCopy.resource)?.dispose(!0);let o=new Ye;this.pendingAddHistoryEntryOperations.set(e.workingCopy.resource,o),this.limiter.queue(async()=>{if(o.token.isCancellationRequested)return;let n=this.getContentVersion(e.workingCopy.resource),r=e.source;e.source||(r=this.resolveSourceFromUndoRedo(e)),await this.workingCopyHistoryService.addEntry({resource:e.workingCopy.resource,source:r,timestamp:e.stat.mtime},o.token),this.historyEntryContentVersion.set(e.workingCopy.resource,n),!o.token.isCancellationRequested&&this.pendingAddHistoryEntryOperations.delete(e.workingCopy.resource)})}resolveSourceFromUndoRedo(e){let t=this.undoRedoService.getLastElement(e.workingCopy.resource);if(t)return t.code==="undoredo.textBufferEdit"?void 0:t.label;let o=this.undoRedoService.getElements(e.workingCopy.resource);if(o.future.length>0||o.past.length>0)return oV.UNDO_REDO_SAVE_SOURCE}shouldTrackHistoryFromSaveEvent(e){return nso(e)?this.shouldTrackHistory(e.workingCopy.resource,e.stat):!1}shouldTrackHistoryFromFileOperationEvent(e){return e.isOperation(2)?this.shouldTrackHistory(e.target.resource,e.target):!1}shouldTrackHistory(e,t){if(e.scheme!==this.pathService.defaultUriScheme&&e.scheme!==Q.vscodeUserData&&e.scheme!==Q.inMemory)return!1;let o=1024*this.configurationService.getValue(oV.SETTINGS.SIZE_LIMIT,{resource:e});return t.size>o||this.configurationService.getValue(oV.SETTINGS.ENABLED,{resource:e})===!1?!1:!this.resourceExcludeMatcher.value.matches(e)}};oV=I([m(0,Xa),m(1,Hy),m(2,ht),m(3,An),m(4,B),m(5,Ml),m(6,Pe),m(7,fe)],oV);var J7t=class a{constructor(i,e,t,o,n,r,s,l,c,u,p){this.historyHome=e;this.entryAddedEmitter=t;this.entryChangedEmitter=o;this.entryReplacedEmitter=n;this.entryRemovedEmitter=r;this.options=s;this.fileService=l;this.labelService=c;this.logService=u;this.configurationService=p;this.entries=[];this.whenResolved=void 0;this.workingCopyResource=void 0;this.workingCopyName=void 0;this.historyEntriesFolder=void 0;this.historyEntriesListingFile=void 0;this.historyEntriesNameMatcher=void 0;this.versionId=0;this.storedVersionId=this.versionId;this.storeLimiter=new g_(1);this.setWorkingCopy(i)}static{this.ENTRIES_FILE="entries.json"}static{this.FILE_SAVED_SOURCE=Ih.registerSource("default.source",d(18359,null))}static{this.SETTINGS={MAX_ENTRIES:"workbench.localHistory.maxFileEntries",MERGE_PERIOD:"workbench.localHistory.mergeWindow"}}setWorkingCopy(i){this.workingCopyResource=i,this.workingCopyName=this.labelService.getUriBasenameLabel(i),this.historyEntriesNameMatcher=new RegExp(`[A-Za-z0-9]{4}${ns(es(i))}`),this.historyEntriesFolder=this.toHistoryEntriesFolder(this.historyHome,i),this.historyEntriesListingFile=Ge(this.historyEntriesFolder,a.ENTRIES_FILE),this.entries=[],this.whenResolved=void 0}toHistoryEntriesFolder(i,e){return Ge(i,_r(e.toString()).toString(16))}async addEntry(i=a.FILE_SAVED_SOURCE,e=void 0,t=Date.now(),o){let n,r=this.entries.at(-1);if(r&&r.source===i){let l=this.configurationService.getValue(a.SETTINGS.MERGE_PERIOD,{resource:this.workingCopyResource});t-r.timestamp<=l*1e3&&(n=r)}let s;return n?s=await this.doReplaceEntry(n,i,e,t,o):s=await this.doAddEntry(i,e,t,o),this.options.flushOnChange&&!o.isCancellationRequested&&await this.store(o),s}async doAddEntry(i,e=void 0,t,o){let n=Ci(this.workingCopyResource),r=Ci(this.workingCopyName),s=Ci(this.historyEntriesFolder),l=`${gIe(void 0,void 0,4)}${es(n)}`,c=Ge(s,l);await this.fileService.cloneFile(n,c);let u={id:l,workingCopy:{resource:n,name:r},location:c,timestamp:t,source:i,sourceDescription:e};return this.entries.push(u),this.versionId++,this.entryAddedEmitter.fire({entry:u}),u}async doReplaceEntry(i,e,t=void 0,o,n){let r=Ci(this.workingCopyResource);return await this.fileService.cloneFile(r,i.location),i.source=e,i.sourceDescription=t,i.timestamp=o,this.versionId++,this.entryReplacedEmitter.fire({entry:i}),i}async removeEntry(i,e){if(await this.resolveEntriesOnce(),e.isCancellationRequested)return!1;let t=this.entries.indexOf(i);return t===-1?!1:(await this.deleteEntry(i),this.entries.splice(t,1),this.versionId++,this.entryRemovedEmitter.fire({entry:i}),this.options.flushOnChange&&!e.isCancellationRequested&&await this.store(e),!0)}async updateEntry(i,e,t){await this.resolveEntriesOnce(),!(t.isCancellationRequested||this.entries.indexOf(i)===-1)&&(i.source=e.source,this.versionId++,this.entryChangedEmitter.fire({entry:i}),this.options.flushOnChange&&!t.isCancellationRequested&&await this.store(t))}async getEntries(){await this.resolveEntriesOnce();let i=this.configurationService.getValue(a.SETTINGS.MAX_ENTRIES,{resource:this.workingCopyResource});return this.entries.length>i?this.entries.slice(this.entries.length-i):this.entries}async hasEntries(i){return i||await this.resolveEntriesOnce(),this.entries.length>0}resolveEntriesOnce(){return this.whenResolved||(this.whenResolved=this.doResolveEntries()),this.whenResolved}async doResolveEntries(){let i=await this.resolveEntriesFromDisk();for(let e of this.entries)i.set(e.id,e);this.entries=Array.from(i.values()).sort((e,t)=>e.timestamp-t.timestamp)}async resolveEntriesFromDisk(){let i=Ci(this.workingCopyResource),e=Ci(this.workingCopyName),[t,o]=await Promise.all([this.readEntriesFile(),this.readEntriesFolder()]),n=new Map;if(o)for(let r of o)n.set(r.name,{id:r.name,workingCopy:{resource:i,name:e},location:r.resource,timestamp:r.mtime,source:a.FILE_SAVED_SOURCE,sourceDescription:void 0});if(t)for(let r of t.entries){let s=n.get(r.id);s&&n.set(r.id,{...s,timestamp:r.timestamp,source:r.source??s.source,sourceDescription:r.sourceDescription??s.sourceDescription})}return n}async moveEntries(i,e,t){let o=Date.now(),n=this.labelService.getUriLabel(Ci(this.workingCopyResource)),r=Ci(this.historyEntriesFolder),s=Ci(i.historyEntriesFolder);try{for(let p of this.entries)await this.fileService.move(p.location,Ge(s,p.id),!0);await this.fileService.del(r,{recursive:!0})}catch(p){if(!this.isFileNotFound(p))try{await this.fileService.move(r,s,!0)}catch(h){this.isFileNotFound(h)||this.traceError(h)}}let l=zo([...this.entries,...i.entries],p=>p.id).sort((p,h)=>p.timestamp-h.timestamp),c=Ci(i.workingCopyResource);this.setWorkingCopy(c);let u=Ci(i.workingCopyName);for(let p of l)this.entries.push({id:p.id,location:Ge(s,p.id),source:p.source,sourceDescription:p.sourceDescription,timestamp:p.timestamp,workingCopy:{resource:c,name:u}});await this.addEntry(e,n,o,t),await this.store(t)}async store(i){this.shouldStore()&&await this.storeLimiter.queue(async()=>{if(!(i.isCancellationRequested||!this.shouldStore()))return this.doStore(i)})}shouldStore(){return this.storedVersionId!==this.versionId}async doStore(i){let e=Ci(this.historyEntriesFolder);if(await this.resolveEntriesOnce(),i.isCancellationRequested)return;await this.cleanUpEntries();let t=this.versionId;if(this.entries.length===0)try{await this.fileService.del(e,{recursive:!0})}catch(o){this.traceError(o)}else await this.writeEntriesFile();this.storedVersionId=t}async cleanUpEntries(){let i=this.configurationService.getValue(a.SETTINGS.MAX_ENTRIES,{resource:this.workingCopyResource});if(this.entries.length<=i)return;let e=this.entries.slice(0,this.entries.length-i),t=this.entries.slice(this.entries.length-i);for(let o of e)await this.deleteEntry(o);this.entries=t;for(let o of e)this.entryRemovedEmitter.fire({entry:o})}async deleteEntry(i){try{await this.fileService.del(i.location)}catch(e){this.traceError(e)}}async writeEntriesFile(){let i=Ci(this.workingCopyResource),e=Ci(this.historyEntriesListingFile),t={version:1,resource:i.toString(),entries:this.entries.map(o=>({id:o.id,source:o.source!==a.FILE_SAVED_SOURCE?o.source:void 0,sourceDescription:o.sourceDescription,timestamp:o.timestamp}))};await this.fileService.writeFile(e,qe.fromString(JSON.stringify(t)))}async readEntriesFile(){let i=Ci(this.historyEntriesListingFile),e;try{e=JSON.parse((await this.fileService.readFile(i)).value.toString())}catch(t){this.isFileNotFound(t)||this.traceError(t)}return e}async readEntriesFolder(){let i=Ci(this.historyEntriesFolder),e=Ci(this.historyEntriesNameMatcher),t;try{t=(await this.fileService.resolve(i,{resolveMetadata:!0})).children}catch(o){this.isFileNotFound(o)||this.traceError(o)}if(t)return t.filter(o=>!Qe(o.resource,this.historyEntriesListingFile)&&e.test(o.name))}isFileNotFound(i){return i instanceof ta&&i.fileOperationResult===1}traceError(i){this.logService.trace("[Working Copy History Service]",i)}},hse=class extends x{constructor(e,t,o,n,r,s,l){super();this.fileService=e;this.remoteAgentService=t;this.environmentService=o;this.uriIdentityService=n;this.labelService=r;this.logService=s;this.configurationService=l;this._onDidAddEntry=this._register(new E);this.onDidAddEntry=this._onDidAddEntry.event;this._onDidChangeEntry=this._register(new E);this.onDidChangeEntry=this._onDidChangeEntry.event;this._onDidReplaceEntry=this._register(new E);this.onDidReplaceEntry=this._onDidReplaceEntry.event;this._onDidMoveEntries=this._register(new E);this.onDidMoveEntries=this._onDidMoveEntries.event;this._onDidRemoveEntry=this._register(new E);this.onDidRemoveEntry=this._onDidRemoveEntry.event;this._onDidRemoveEntries=this._register(new E);this.onDidRemoveEntries=this._onDidRemoveEntries.event;this.localHistoryHome=new Ko;this.models=new gt(e=>this.uriIdentityService.extUri.getComparisonKey(e));this.resolveLocalHistoryHome()}static{this.FILE_MOVED_SOURCE=Ih.registerSource("moved.source",d(18361,null))}static{this.FILE_RENAMED_SOURCE=Ih.registerSource("renamed.source",d(18362,null))}async resolveLocalHistoryHome(){let e;try{let t=await this.remoteAgentService.getEnvironment();t&&(e=t.localHistoryHome)}catch(t){this.logService.trace(t)}e||(e=this.environmentService.localHistoryHome),this.localHistoryHome.complete(e)}async moveEntries(e,t){let o=new g_(QKe),n=[];for(let[s,l]of this.models){if(!this.uriIdentityService.extUri.isEqualOrParent(s,e))continue;let c;if(this.uriIdentityService.extUri.isEqual(e,s))c=t;else{let p=hIe(s.path,e.path);c=Ge(t,s.path.substr(p+e.path.length+1))}let u;this.uriIdentityService.extUri.isEqual(ci(s),ci(c))?u=hse.FILE_RENAMED_SOURCE:u=hse.FILE_MOVED_SOURCE,n.push(o.queue(()=>this.doMoveEntries(l,u,s,c)))}if(!n.length)return[];let r=await Promise.all(n);return this._onDidMoveEntries.fire(),r}async doMoveEntries(e,t,o,n){let r=await this.getModel(n);return await e.moveEntries(r,t,Se.None),this.models.delete(o),this.models.set(n,e),n}async addEntry({resource:e,source:t,timestamp:o},n){if(!this.fileService.hasProvider(e))return;let r=await this.getModel(e);if(!n.isCancellationRequested)return r.addEntry(t,void 0,o,n)}async updateEntry(e,t,o){let n=await this.getModel(e.workingCopy.resource);if(!o.isCancellationRequested)return n.updateEntry(e,t,o)}async removeEntry(e,t){let o=await this.getModel(e.workingCopy.resource);return t.isCancellationRequested?!1:o.removeEntry(e,t)}async removeAll(e){let t=await this.localHistoryHome.p;e.isCancellationRequested||(this.models.clear(),await this.fileService.del(t,{recursive:!0}),this._onDidRemoveEntries.fire())}async getEntries(e,t){let o=await this.getModel(e);return t.isCancellationRequested?[]:await o.getEntries()??[]}async getAll(e){let t=await this.localHistoryHome.p;if(e.isCancellationRequested)return[];let o=new gt;for(let[n,r]of this.models)await r.hasEntries(!0)&&o.set(n,!0);try{let n=await this.fileService.resolve(t);if(n.children){let r=new g_(QKe),s=[];for(let l of n.children)s.push(r.queue(async()=>{if(!e.isCancellationRequested)try{let c=JSON.parse((await this.fileService.readFile(Ge(l.resource,J7t.ENTRIES_FILE))).value.toString());c.entries.length>0&&o.set(A.parse(c.resource),!0)}catch{}}));await Promise.all(s)}}catch{}return Array.from(o.keys())}async getModel(e){let t=await this.localHistoryHome.p,o=this.models.get(e);return o||(o=new J7t(e,t,this._onDidAddEntry,this._onDidChangeEntry,this._onDidReplaceEntry,this._onDidRemoveEntry,this.getModelOptions(),this.fileService,this.labelService,this.logService,this.configurationService),this.models.set(e,o)),o}};hse=I([m(0,fe),m(1,bo),m(2,At),m(3,ht),m(4,rt),m(5,se),m(6,B)],hse);var gse=class extends hse{constructor(e,t,o,n,r,s,l,c){super(e,t,o,n,r,l,c);this.lifecycleService=s;this.isRemotelyStored=typeof this.environmentService.remoteAuthority=="string";this.storeAllCts=this._register(new Ye);this.storeAllScheduler=this._register(new Dt(()=>this.storeAll(this.storeAllCts.token),gse.STORE_ALL_INTERVAL));this.registerListeners()}static{this.STORE_ALL_INTERVAL=300*1e3}registerListeners(){this.isRemotelyStored||(this._register(this.lifecycleService.onWillShutdown(e=>this.onWillShutdown(e))),this._register(U.any(this.onDidAddEntry,this.onDidChangeEntry,this.onDidReplaceEntry,this.onDidRemoveEntry)(()=>this.onDidChangeModels())))}getModelOptions(){return{flushOnChange:this.isRemotelyStored}}onWillShutdown(e){this.storeAllScheduler.dispose(),this.storeAllCts.dispose(!0),e.join(this.storeAll(e.token),{id:"join.workingCopyHistory",label:d(18360,null)})}onDidChangeModels(){this.storeAllScheduler.isScheduled()||this.storeAllScheduler.schedule()}async storeAll(e){let t=new g_(QKe),o=[],n=Array.from(this.models.values());for(let r of n)o.push(t.queue(async()=>{if(!e.isCancellationRequested)try{await r.store(e)}catch(s){this.logService.trace(s)}}));await Promise.all(o)}};gse=I([m(0,fe),m(1,bo),m(2,At),m(3,ht),m(4,rt),m(5,ji),m(6,se),m(7,B)],gse);ne.as(Qi.Workbench).registerWorkbenchContribution(oV,3);Ee(Hy,gse,1);var dzi="sync.enable",MGe=class extends x{constructor(e,t,o){super();this.storageService=e;this.environmentService=t;this.userDataSyncStoreManagementService=o;this._onDidChangeEnablement=this._register(new E);this.onDidChangeEnablement=this._onDidChangeEnablement.event;this._onDidChangeResourceEnablement=this._register(new E);this.onDidChangeResourceEnablement=this._onDidChangeResourceEnablement.event;this._register(e.onDidChangeValue(-1,void 0,this._store)(n=>this.onDidStorageChange(n)))}isEnabled(){switch(this.environmentService.sync){case"on":return!0;case"off":return!1}return this.storageService.getBoolean(dzi,-1,!1)}canToggleEnablement(){return this.userDataSyncStoreManagementService.userDataSyncStore!==void 0&&this.environmentService.sync===void 0}setEnablement(e){e&&!this.canToggleEnablement()||this.storageService.store(dzi,e,-1,1)}isResourceEnabled(e,t){let o=this.storageService.getBoolean(Ime(e),-1);return t=t??e!=="prompts",o??t}isResourceEnablementConfigured(e){return this.storageService.getBoolean(Ime(e),-1)!==void 0}setResourceEnablement(e,t){if(this.isResourceEnabled(e)!==t){let o=Ime(e);this.storeResourceEnablement(o,t)}}getResourceSyncStateVersion(e){}storeResourceEnablement(e,t){this.storageService.store(e,t,-1,Wt?0:1)}onDidStorageChange(e){if(dzi===e.key){this._onDidChangeEnablement.fire(this.isEnabled());return}let t=Sme.filter(o=>Ime(o)===e.key)[0];if(t){this._onDidChangeResourceEnablement.fire([t,this.isResourceEnabled(t)]);return}}};MGe=I([m(0,ce),m(1,Eo),m(2,pM)],MGe);var uzi=class extends MGe{get workbenchEnvironmentService(){return this.environmentService}getResourceSyncStateVersion(i){return i==="extensions"?this.workbenchEnvironmentService.options?.settingsSyncOptions?.extensionsSyncStateVersion:void 0}};Ee(Fl,uzi,1);function PGe(a){let i=qe.alloc(1);switch(a){case 0:i.writeUInt8(1,0);break;case 1:i.writeUInt8(2,0);break;case 2:i.writeUInt8(3,0);break}return i}function u9(a,i){if(a.byteLength!==1)return!1;switch(a.readUInt8(0)){case 1:return i===0;case 2:return i===1;case 3:return i===2;default:return!1}}var AGe=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super();this.runningLocation=e;this.startup=t;this._initDataProvider=o;this._telemetryService=n;this._contextService=r;this._labelService=s;this._logService=l;this._loggerService=c;this._environmentService=u;this._userDataProfilesService=p;this._productService=h;this._layoutService=g;this._storageService=f;this._webWorkerService=v;this._defaultLogLevelsService=b;this.pid=null;this.remoteAuthority=null;this.extensions=null;this._onDidExit=this._register(new E);this.onExit=this._onDidExit.event;this._isTerminating=!1,this._protocolPromise=null,this._protocol=null,this._extensionHostLogsLocation=Ge(this._environmentService.extHostLogsPath,"webWorker")}async _getWebWorkerExtensionHostIframeSrc(){let e=new URLSearchParams;this._environmentService.debugExtensionHost&&this._environmentService.debugRenderer&&e.set("debugged","1"),Jse.addSearchParam(e,!0,!0);let t=`?${e.toString()}`,o="vs/workbench/services/extensions/worker/webWorkerExtensionHostIframe.html";if(Wt){let r=this._productService.webEndpointUrlTemplate,s=this._productService.commit,l=this._productService.quality;if(r&&s&&l){let c="webWorkerExtensionHostIframeStableOriginUUID",u=this._storageService.get(c,1);typeof u>"u"&&(u=xt(),this._storageService.store(c,u,1,1));let p=await Aht(ut.origin,u),h=r.replace("{{uuid}}",`v--${p}`).replace("{{commit}}",s).replace("{{quality}}",l),g=new URL(`${h}/out/${o}${t}`);return g.searchParams.set("parentOrigin",ut.origin),g.searchParams.set("salt",u),g.toString()}console.warn("The web worker extension host is started in a same-origin iframe!")}return`${this._webWorkerService.getWorkerUrl(new Ux({esmModuleLocation:vn.asBrowserUri(o),esmModuleLocationBundler:new URL("../worker/webWorkerExtensionHostIframe.html",import.meta.url),label:"webWorkerExtensionHostIframe"}))}${t}`}async start(){return this._protocolPromise||(this._protocolPromise=this._startInsideIframe(),this._protocolPromise.then(e=>this._protocol=e)),this._protocolPromise}async _startInsideIframe(){let e=await this._getWebWorkerExtensionHostIframeSrc(),t=this._register(new E),o=document.createElement("iframe");o.setAttribute("class","web-worker-ext-host-iframe"),o.setAttribute("sandbox","allow-scripts allow-same-origin"),o.setAttribute("allow","usb; serial; hid; cross-origin-isolated; local-network-access;"),o.setAttribute("aria-hidden","true"),o.style.display="none";let n=xt();o.setAttribute("src",`${e}&vscodeWebWorkerExtHostId=${n}`);let r=new gp,s,l=null,c=!1,u,p=(v,b)=>{l=b,c=!0,mt(l),clearTimeout(u),this._onDidExit.fire([81,l.message]),r.open()},h=v=>{s=v,clearTimeout(u),r.open()};if(u=setTimeout(()=>{console.warn("The Web Worker Extension Host did not start in 60s, that might be a problem.")},6e4),this._register(j(ut,"message",v=>{if(v.source!==o.contentWindow||v.data.vscodeWebWorkerExtHostId!==n)return;if(v.data.error){let{name:S,message:y,stack:w}=v.data.error,k=new Error;return k.message=y,k.name=S,k.stack=w,p(81,k)}if(v.data.type==="vscode.bootstrap.nls"){o.contentWindow.postMessage({type:v.data.type,data:{workerUrl:this._webWorkerService.getWorkerUrl(Syn),fileRoot:globalThis._VSCODE_FILE_ROOT,nls:{messages:t$e(),language:Pse()}}},"*");return}let{data:b}=v.data;if(r.isOpen()||!(b instanceof MessagePort)){console.warn("UNEXPECTED message",v);let S=new Error("UNEXPECTED message");return p(81,S)}h(b)})),this._layoutService.mainContainer.appendChild(o),this._register(Z(()=>o.remove())),await r.wait(),c)throw l;let g=this._environmentService.options?.messagePorts??new Map;o.contentWindow.postMessage({type:"vscode.init",data:g},"*",[...g.values()]),s.onmessage=v=>{let{data:b}=v;if(!(b instanceof ArrayBuffer)){console.warn("UNKNOWN data received",b),this._onDidExit.fire([77,"UNKNOWN data received"]);return}t.fire(qe.wrap(new Uint8Array(b,0,b.byteLength)))};let f={onMessage:t.event,send:v=>{let b=v.buffer.buffer.slice(v.buffer.byteOffset,v.buffer.byteOffset+v.buffer.byteLength);s.postMessage(b,[b])}};return this._performHandshake(f)}async _performHandshake(e){if(await U.toPromise(U.filter(e.onMessage,t=>u9(t,1))),this._isTerminating)throw PI();if(e.send(qe.fromString(JSON.stringify(await this._createExtHostInitData()))),this._isTerminating)throw PI();if(await U.toPromise(U.filter(e.onMessage,t=>u9(t,0))),this._isTerminating)throw PI();return e}dispose(){this._isTerminating||(this._isTerminating=!0,this._protocol?.send(PGe(2)),super.dispose())}getInspectPort(){}enableInspectPort(){return Promise.resolve(!1)}async _createExtHostInitData(){let e=await this._initDataProvider.getInitData();this.extensions=e.extensions;let t=this._contextService.getWorkspace(),o=this._productService.extensionsGallery?.nlsBaseUrl,n;return o&&this._productService.commit&&!US.isDefaultVariant()&&(n=A.joinPath(A.parse(o),this._productService.commit,this._productService.version,US.value())),{commit:this._productService.commit,version:this._productService.version,quality:this._productService.quality,date:this._productService.date,parentPid:0,environment:{isExtensionDevelopmentDebug:this._environmentService.debugRenderer,appName:this._productService.nameLong,appHost:this._productService.embedderIdentifier??(Wt?"web":"desktop"),appUriScheme:this._productService.urlProtocol,appLanguage:wr,isExtensionTelemetryLoggingOnly:Zke(this._productService,this._environmentService),isPortable:!1,extensionDevelopmentLocationURI:this._environmentService.extensionDevelopmentLocationURI,extensionTestsLocationURI:this._environmentService.extensionTestsLocationURI,globalStorageHome:this._userDataProfilesService.defaultProfile.globalStorageHome,workspaceStorageHome:this._environmentService.workspaceStorageHome,extensionLogLevel:this._defaultLogLevelsService.defaultLogLevels.extensions,isSessionsWindow:this._environmentService.isSessionsWindow},workspace:this._contextService.getWorkbenchState()===1?void 0:{configuration:t.configuration||void 0,id:t.id,name:this._labelService.getWorkspaceLabel(t),transient:t.transient},consoleForward:{includeStack:!1,logNative:this._environmentService.debugRenderer},extensions:this.extensions.toSnapshot(),nlsBaseUrl:n,telemetryInfo:{sessionId:this._telemetryService.sessionId,machineId:this._telemetryService.machineId,sqmId:this._telemetryService.sqmId,devDeviceId:this._telemetryService.devDeviceId??this._telemetryService.machineId,firstSessionDate:this._telemetryService.firstSessionDate,msftInternal:this._telemetryService.msftInternal},remoteExtensionTips:this._productService.remoteExtensionTips,virtualWorkspaceExtensionTips:this._productService.virtualWorkspaceExtensionTips,logLevel:this._logService.getLevel(),loggers:[...this._loggerService.getRegisteredLoggers()],logsLocation:this._extensionHostLogsLocation,autoStart:this.startup===1||this.startup===3,remote:{authority:this._environmentService.remoteAuthority,connectionData:null,isRemote:!1},uiKind:Wt?2:1}}};AGe=I([m(3,Te),m(4,Pe),m(5,rt),m(6,se),m(7,Il),m(8,cd),m(9,an),m(10,tt),m(11,Kl),m(12,ce),m(13,Zy),m(14,zD)],AGe);var Syn=new Ux({label:"extensionHostWorkerMain",esmModuleLocation:()=>vn.asBrowserUri("vs/workbench/api/worker/extensionHostWorkerMain.js"),esmModuleLocationBundler:()=>new URL("../../../api/worker/extensionHostWorkerMain.ts?esm",import.meta.url)});var pzi=class{constructor(i,e){this.versionId=i;this.removedDueToLooping=e}},mzi=class a extends x{constructor(e,t){super();this._activationEventsReader=e;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._versionId=0;this._extensionDescriptions=t,this._initialize()}static isHostExtension(e,t,o){if(t.getExtensionDescription(e))return!1;let n=o.getExtensionDescription(e);return n?!!((n.main||n.browser)&&n.api==="none"):!1}_initialize(){this._extensionDescriptions.sort(Iyn),this._extensionsMap=new iu,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 t=this._activationEventsReader.readActivationEvents(e);for(let o of t)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,t){this._extensionDescriptions=yAo(this._extensionDescriptions,t),this._extensionDescriptions=this._extensionDescriptions.concat(e);let o=a._findLoopingExtensions(this._extensionDescriptions);return this._extensionDescriptions=yAo(this._extensionDescriptions,o.map(n=>n.identifier)),this._initialize(),this._versionId++,this._onDidChange.fire(void 0),new pzi(this._versionId,o)}static _findLoopingExtensions(e){let t=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,c){this.addNode(l),this.addNode(c),this._arcs.has(l)?this._arcs.get(l).push(c):this._arcs.set(l,[c])}getArcs(l){return this._arcs.has(l)?this._arcs.get(l):[]}hasOnlyGoodArcs(l,c){let u=t.getArcs(l);for(let p=0;p<u.length;p++)if(!c.has(u[p]))return!1;return!0}getNodes(){return this._nodesArr}},o=new iu;for(let l of e)if(o.set(l.identifier,l),l.extensionDependencies)for(let c of l.extensionDependencies)t.addArc(Ii.toKey(l.identifier),Ii.toKey(c));let n=new Set;t.getNodes().filter(l=>t.getArcs(l).length===0).forEach(l=>n.add(l));let r=t.getNodes().filter(l=>!n.has(l)),s;do{s=!1;for(let l=0;l<r.length;l++){let c=r[l];t.hasOnlyGoodArcs(c,n)&&(r.splice(l,1),l--,n.add(c),s=!0)}}while(s);return r.map(l=>o.get(l))}containsActivationEvent(e){return this._activationMap.has(e)}containsExtension(e){return this._extensionsMap.has(e)}getExtensionDescriptionsForActivationEvent(e){let t=this._activationMap.get(e);return t?t.slice(0):[]}getAllExtensionDescriptions(){return this._extensionsArr.slice(0)}getSnapshot(){return new hzi(this._versionId,this.getAllExtensionDescriptions())}getExtensionDescription(e){let t=this._extensionsMap.get(e);return t||void 0}getExtensionDescriptionByUUID(e){for(let t of this._extensionsArr)if(t.uuid===e)return t}getExtensionDescriptionByIdOrUUID(e,t){return this.getExtensionDescription(e)??(t?this.getExtensionDescriptionByUUID(t):void 0)}},hzi=class{constructor(i,e){this.versionId=i;this.extensions=e}},eYt=class{constructor(i){this._lock=new vzi;this._actual=new mzi(i,[])}async acquireLock(i){let e=await this._lock.acquire(i);return new gzi(this,e)}deltaExtensions(i,e,t){if(!i.isAcquiredFor(this))throw new Error("Lock is not held");return this._actual.deltaExtensions(e,t)}containsActivationEvent(i){return this._actual.containsActivationEvent(i)}containsExtension(i){return this._actual.containsExtension(i)}getExtensionDescriptionsForActivationEvent(i){return this._actual.getExtensionDescriptionsForActivationEvent(i)}getAllExtensionDescriptions(){return this._actual.getAllExtensionDescriptions()}getSnapshot(){return this._actual.getSnapshot()}getExtensionDescription(i){return this._actual.getExtensionDescription(i)}getExtensionDescriptionByUUID(i){return this._actual.getExtensionDescriptionByUUID(i)}getExtensionDescriptionByIdOrUUID(i,e){return this._actual.getExtensionDescriptionByIdOrUUID(i,e)}},gzi=class extends x{constructor(e,t){super();this._registry=e;this._isDisposed=!1;this._register(t)}isAcquiredFor(e){return!this._isDisposed&&this._registry===e}},fzi=class{constructor(i){this.name=i;let e=WI();this.promise=e.promise,this._resolve=e.resolve}resolve(i){this._resolve(i)}},vzi=class{constructor(){this._pendingCustomers=[];this._isLocked=!1}async acquire(i){let e=new fzi(i);return this._pendingCustomers.push(e),this._advance(),e.promise}_advance(){if(this._isLocked||this._pendingCustomers.length===0)return;let i=this._pendingCustomers.shift();this._isLocked=!0;let e=!0,t=setTimeout(()=>{e&&console.warn(`The customer named ${i.name} has been holding on to the lock for 30s. This might be a problem.`)},30*1e3),o=()=>{e&&(clearTimeout(t),e=!1,this._isLocked=!1,this._advance())};i.resolve(Z(o))}};function Iyn(a,i){let e=a.isBuiltin?0:a.isUnderDevelopment?2:1,t=i.isBuiltin?0:i.isUnderDevelopment?2:1;if(e!==t)return e-t;let o=Oo.basename(a.extensionLocation.path),n=Oo.basename(i.extensionLocation.path);return o<n?-1:o>n?1:0}function yAo(a,i){let e=new ly(i);return a.filter(t=>!e.has(t.identifier))}var qpt=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((i,e)=>{this._actualOk=i,this._actualErr=e,this._hasValue&&this._actualOk(this._value),this._hasErr&&this._actualErr(this._err)})),this._actual}resolveOk(i){this._hasValue||this._hasErr||(this._hasValue=!0,this._value=i,this._actual&&this._actualOk(i))}resolveErr(i){this._hasValue||this._hasErr||(this._hasErr=!0,this._err=i,this._actual?this._actualErr(i):mt(i))}then(i,e){return this._ensureActual().then(i,e)}catch(i){return this._ensureActual().then(void 0,i)}finally(i){return this._ensureActual().finally(i)}},tYt=class extends qpt{constructor(){super(),this._hasErr=!0,this._err=new go}};function bzi(a,i){try{return JSON.stringify(a,i)}catch{return"null"}}var Izi="$$ref$$",yyn={[Izi]:-1};function wAo(a,i=null,e=!1){let t=[];return{jsonString:(e?bzi:JSON.stringify)(a,(n,r)=>{if(typeof r>"u")return yyn;if(typeof r=="object"){if(r instanceof qe){let s=t.push(r)-1;return{[Izi]:s}}if(i)return i(n,r)}return r}),referencedBuffers:t}}function EAo(a,i,e){return JSON.parse(a,(t,o)=>{if(o){let n=o[Izi];if(typeof n=="number")return i[n];if(e&&o.$mid===1)return e.transformIncoming(o)}return o})}function CAo(a,i){return JSON.stringify(a,i)}function wyn(a){return a?(i,e)=>e&&e.$mid===1?a.transformOutgoing(e):e:null}var Cyn=()=>{},xyn=Symbol.for("rpcProtocol"),kyn=Symbol.for("rpcProxy"),xAo,kAo,iYt=class a extends(kAo=x,xAo=xyn,kAo){constructor(e,t=null,o=null){super();this[xAo]=!0;this._onDidChangeResponsiveState=this._register(new E);this.onDidChangeResponsiveState=this._onDidChangeResponsiveState.event;this._protocol=e,this._logger=t,this._uriTransformer=o,this._uriReplacer=wyn(this._uriTransformer),this._isDisposed=!1,this._locals=[],this._proxies=[];for(let n=0,r=h6e.count;n<r;n++)this._locals[n]=null,this._proxies[n]=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 Dt(()=>this._checkUnresponsive(),1e3)),this._register(this._protocol.onMessage(n=>this._receiveOneMessage(n)))}static{this.UNRESPONSIVE_TIME=3*1e3}dispose(){this._isDisposed=!0,Object.keys(this._pendingRPCReplies).forEach(e=>{let t=this._pendingRPCReplies[e];delete this._pendingRPCReplies[e],t.resolveErr(PI())}),super.dispose()}drain(){return typeof this._protocol.drain=="function"?this._protocol.drain():Promise.resolve()}_onWillSendRequest(e){this._unacknowledgedCount===0&&(this._unresponsiveTime=Date.now()+a.UNRESPONSIVE_TIME),this._unacknowledgedCount++,this._asyncCheckUresponsive.isScheduled()||this._asyncCheckUresponsive.schedule()}_onDidReceiveAcknowledge(e){this._unresponsiveTime=Date.now()+a.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?_me(e,this._uriTransformer):e}getProxy(e){let{nid:t,sid:o}=e;return this._proxies[t]||(this._proxies[t]=this._createProxy(t,o)),this._proxies[t]}_createProxy(e,t){let o={get:(n,r)=>(typeof r=="string"&&!n[r]&&r.charCodeAt(0)===36&&(n[r]=(...s)=>this._remoteCall(e,r,s)),r===kyn?t:n[r])};return new Proxy(Object.create(null),o)}set(e,t){return this._locals[e.nid]=t,t}assertRegistered(e){for(let t=0,o=e.length;t<o;t++){let n=e[t];if(!this._locals[n.nid])throw new Error(`Missing proxy instance ${n.sid}`)}}_receiveOneMessage(e){if(this._isDisposed)return;let t=e.byteLength,o=uv.read(e,0),n=o.readUInt8(),r=o.readUInt32();switch(n){case 1:case 2:{let{rpcId:s,method:l,args:c}=tP.deserializeRequestJSONArgs(o);this._uriTransformer&&(c=_me(c,this._uriTransformer)),this._receiveRequest(t,r,s,l,c,n===2);break}case 3:case 4:{let{rpcId:s,method:l,args:c}=tP.deserializeRequestMixedArgs(o);this._uriTransformer&&(c=_me(c,this._uriTransformer)),this._receiveRequest(t,r,s,l,c,n===4);break}case 5:{this._logger?.logIncoming(t,r,0,"ack"),this._onDidReceiveAcknowledge(r);break}case 6:{this._receiveCancel(t,r);break}case 7:{this._receiveReply(t,r,void 0);break}case 9:{let s=tP.deserializeReplyOKJSON(o);this._uriTransformer&&(s=_me(s,this._uriTransformer)),this._receiveReply(t,r,s);break}case 10:{let s=tP.deserializeReplyOKJSONWithBuffers(o,this._uriTransformer);this._receiveReply(t,r,s);break}case 8:{let s=tP.deserializeReplyOKVSBuffer(o);this._receiveReply(t,r,s);break}case 11:{let s=tP.deserializeReplyErrError(o);this._uriTransformer&&(s=_me(s,this._uriTransformer)),this._receiveReplyErr(t,r,s);break}case 12:{this._receiveReplyErr(t,r,void 0);break}default:console.error("received unexpected message"),console.error(e)}}_receiveRequest(e,t,o,n,r,s){this._logger?.logIncoming(e,t,1,`receiveRequest ${g6e(o)}.${n}(`,r);let l=String(t),c,u;if(s){let h=new Ye;r.push(h.token),c=this._invokeHandler(o,n,r),u=()=>h.cancel()}else c=this._invokeHandler(o,n,r),u=Cyn;this._cancelInvokedHandlers[l]=u;let p=tP.serializeAcknowledged(t);this._logger?.logOutgoing(p.byteLength,t,1,"ack"),this._protocol.send(p),c.then(h=>{delete this._cancelInvokedHandlers[l];let g=tP.serializeReplyOK(t,h,this._uriReplacer);this._logger?.logOutgoing(g.byteLength,t,1,"reply:",h),this._protocol.send(g)},h=>{delete this._cancelInvokedHandlers[l];let g=tP.serializeReplyErr(t,h);this._logger?.logOutgoing(g.byteLength,t,1,"replyErr:",h),this._protocol.send(g)})}_receiveCancel(e,t){this._logger?.logIncoming(e,t,1,"receiveCancel");let o=String(t);this._cancelInvokedHandlers[o]?.()}_receiveReply(e,t,o){this._logger?.logIncoming(e,t,0,"receiveReply:",o);let n=String(t);if(!this._pendingRPCReplies.hasOwnProperty(n))return;let r=this._pendingRPCReplies[n];delete this._pendingRPCReplies[n],r.resolveOk(o)}_receiveReplyErr(e,t,o){this._logger?.logIncoming(e,t,0,"receiveReplyErr:",o);let n=String(t);if(!this._pendingRPCReplies.hasOwnProperty(n))return;let r=this._pendingRPCReplies[n];delete this._pendingRPCReplies[n];let s;o&&(o.$isError?(s=new Error,s.name=o.name,s.message=o.message,s.stack=o.stack):s=o),r.resolveErr(s)}_invokeHandler(e,t,o){try{return Promise.resolve(this._doInvokeHandler(e,t,o))}catch(n){return Promise.reject(n)}}_doInvokeHandler(e,t,o){let n=this._locals[e];if(!n)throw new Error("Unknown actor "+g6e(e));let r=n[t];if(typeof r!="function")throw new Error("Unknown method "+t+" on actor "+g6e(e));return r.apply(n,o)}_remoteCall(e,t,o){if(this._isDisposed)return new tYt;let n=null;if(o.length>0&&Se.isCancellationToken(o[o.length-1])&&(n=o.pop()),n&&n.isCancellationRequested)return Promise.reject(PI());let r=tP.serializeRequestArguments(o,this._uriReplacer),s=++this._lastMessageId,l=String(s),c=new qpt,u=new N;n&&u.add(n.onCancellationRequested(()=>{let h=tP.serializeCancel(s);this._logger?.logOutgoing(h.byteLength,s,0,"cancel"),this._protocol.send(h)})),this._pendingRPCReplies[l]=new Szi(c,u),this._onWillSendRequest(s);let p=tP.serializeRequest(s,e,t,r,!!n);return this._logger?.logOutgoing(p.byteLength,s,0,`request: ${g6e(e)}.${t}(`,o),this._protocol.send(p),c}},Szi=class{constructor(i,e){this._promise=i;this._disposable=e}resolveOk(i){this._promise.resolveOk(i),this._disposable.dispose()}resolveErr(i){this._promise.resolveErr(i),this._disposable.dispose()}},uv=class a{static alloc(i,e,t){let o=new a(qe.alloc(t+1+4),0);return o.writeUInt8(i),o.writeUInt32(e),o}static read(i,e){return new a(i,e)}get buffer(){return this._buff}constructor(i,e){this._buff=i,this._offset=e}static sizeUInt8(){return 1}static{this.sizeUInt32=4}writeUInt8(i){this._buff.writeUInt8(i,this._offset),this._offset+=1}readUInt8(){let i=this._buff.readUInt8(this._offset);return this._offset+=1,i}writeUInt32(i){this._buff.writeUInt32BE(i,this._offset),this._offset+=4}readUInt32(){let i=this._buff.readUInt32BE(this._offset);return this._offset+=4,i}static sizeShortString(i){return 1+i.byteLength}writeShortString(i){this._buff.writeUInt8(i.byteLength,this._offset),this._offset+=1,this._buff.set(i,this._offset),this._offset+=i.byteLength}readShortString(){let i=this._buff.readUInt8(this._offset);this._offset+=1;let t=this._buff.slice(this._offset,this._offset+i).toString();return this._offset+=i,t}static sizeLongString(i){return 4+i.byteLength}writeLongString(i){this._buff.writeUInt32BE(i.byteLength,this._offset),this._offset+=4,this._buff.set(i,this._offset),this._offset+=i.byteLength}readLongString(){let i=this._buff.readUInt32BE(this._offset);this._offset+=4;let t=this._buff.slice(this._offset,this._offset+i).toString();return this._offset+=i,t}writeBuffer(i){this._buff.writeUInt32BE(i.byteLength,this._offset),this._offset+=4,this._buff.set(i,this._offset),this._offset+=i.byteLength}static sizeVSBuffer(i){return 4+i.byteLength}writeVSBuffer(i){this._buff.writeUInt32BE(i.byteLength,this._offset),this._offset+=4,this._buff.set(i,this._offset),this._offset+=i.byteLength}readVSBuffer(){let i=this._buff.readUInt32BE(this._offset);this._offset+=4;let e=this._buff.slice(this._offset,this._offset+i);return this._offset+=i,e}static sizeMixedArray(i){let e=0;e+=1;for(let t=0,o=i.length;t<o;t++){let n=i[t];switch(e+=1,n.type){case 1:e+=this.sizeLongString(n.value);break;case 2:e+=this.sizeVSBuffer(n.value);break;case 3:e+=this.sizeUInt32,e+=this.sizeLongString(n.value);for(let r=0;r<n.buffers.length;++r)e+=this.sizeVSBuffer(n.buffers[r]);break;case 4:break}}return e}writeMixedArray(i){this._buff.writeUInt8(i.length,this._offset),this._offset+=1;for(let e=0,t=i.length;e<t;e++){let o=i[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 n=0;n<o.buffers.length;++n)this.writeBuffer(o.buffers[n]);break;case 4:this.writeUInt8(4);break}}}readMixedArray(){let i=this._buff.readUInt8(this._offset);this._offset+=1;let e=new Array(i);for(let t=0;t<i;t++)switch(this.readUInt8()){case 1:e[t]=this.readLongString();break;case 2:e[t]=this.readVSBuffer();break;case 3:{let n=this.readUInt32(),r=this.readLongString(),s=[];for(let l=0;l<n;++l)s.push(this.readVSBuffer());e[t]=new ag(EAo(r,s,null));break}case 4:e[t]=void 0;break}return e}};var tP=class{static _useMixedArgSerialization(i){for(let e=0,t=i.length;e<t;e++)if(i[e]instanceof qe||i[e]instanceof ag||typeof i[e]>"u")return!0;return!1}static serializeRequestArguments(i,e){if(this._useMixedArgSerialization(i)){let t=[];for(let o=0,n=i.length;o<n;o++){let r=i[o];if(r instanceof qe)t[o]={type:2,value:r};else if(typeof r>"u")t[o]={type:4};else if(r instanceof ag){let{jsonString:s,referencedBuffers:l}=wAo(r.value,e);t[o]={type:3,value:qe.fromString(s),buffers:l}}else t[o]={type:1,value:qe.fromString(CAo(r,e))}}return{type:1,args:t}}return{type:0,args:CAo(i,e)}}static serializeRequest(i,e,t,o,n){switch(o.type){case 0:return this._requestJSONArgs(i,e,t,o.args,n);case 1:return this._requestMixedArgs(i,e,t,o.args,n)}}static _requestJSONArgs(i,e,t,o,n){let r=qe.fromString(t),s=qe.fromString(o),l=0;l+=uv.sizeUInt8(),l+=uv.sizeShortString(r),l+=uv.sizeLongString(s);let c=uv.alloc(n?2:1,i,l);return c.writeUInt8(e),c.writeShortString(r),c.writeLongString(s),c.buffer}static deserializeRequestJSONArgs(i){let e=i.readUInt8(),t=i.readShortString(),o=i.readLongString();return{rpcId:e,method:t,args:JSON.parse(o)}}static _requestMixedArgs(i,e,t,o,n){let r=qe.fromString(t),s=0;s+=uv.sizeUInt8(),s+=uv.sizeShortString(r),s+=uv.sizeMixedArray(o);let l=uv.alloc(n?4:3,i,s);return l.writeUInt8(e),l.writeShortString(r),l.writeMixedArray(o),l.buffer}static deserializeRequestMixedArgs(i){let e=i.readUInt8(),t=i.readShortString(),o=i.readMixedArray(),n=new Array(o.length);for(let r=0,s=o.length;r<s;r++){let l=o[r];typeof l=="string"?n[r]=JSON.parse(l):n[r]=l}return{rpcId:e,method:t,args:n}}static serializeAcknowledged(i){return uv.alloc(5,i,0).buffer}static serializeCancel(i){return uv.alloc(6,i,0).buffer}static serializeReplyOK(i,e,t){if(typeof e>"u")return this._serializeReplyOKEmpty(i);if(e instanceof qe)return this._serializeReplyOKVSBuffer(i,e);if(e instanceof ag){let{jsonString:o,referencedBuffers:n}=wAo(e.value,t,!0);return this._serializeReplyOKJSONWithBuffers(i,o,n)}else return this._serializeReplyOKJSON(i,bzi(e,t))}static _serializeReplyOKEmpty(i){return uv.alloc(7,i,0).buffer}static _serializeReplyOKVSBuffer(i,e){let t=0;t+=uv.sizeVSBuffer(e);let o=uv.alloc(8,i,t);return o.writeVSBuffer(e),o.buffer}static deserializeReplyOKVSBuffer(i){return i.readVSBuffer()}static _serializeReplyOKJSON(i,e){let t=qe.fromString(e),o=0;o+=uv.sizeLongString(t);let n=uv.alloc(9,i,o);return n.writeLongString(t),n.buffer}static _serializeReplyOKJSONWithBuffers(i,e,t){let o=qe.fromString(e),n=0;n+=uv.sizeUInt32,n+=uv.sizeLongString(o);for(let s of t)n+=uv.sizeVSBuffer(s);let r=uv.alloc(10,i,n);r.writeUInt32(t.length),r.writeLongString(o);for(let s of t)r.writeBuffer(s);return r.buffer}static deserializeReplyOKJSON(i){let e=i.readLongString();return JSON.parse(e)}static deserializeReplyOKJSONWithBuffers(i,e){let t=i.readUInt32(),o=i.readLongString(),n=[];for(let r=0;r<t;++r)n.push(i.readVSBuffer());return new ag(EAo(o,n,e))}static serializeReplyErr(i,e){let t=e?bzi(S$(e),null):void 0;if(typeof t!="string")return this._serializeReplyErrEmpty(i);let o=qe.fromString(t),n=0;n+=uv.sizeLongString(o);let r=uv.alloc(11,i,n);return r.writeLongString(o),r.buffer}static deserializeReplyErrError(i){let e=i.readLongString();return JSON.parse(e)}static _serializeReplyErrEmpty(i){return uv.alloc(12,i,0).buffer}};var Eyn=!1,Tyn=!0,ZU=class extends x{constructor(e,t,o,n,r,s,l){super();this._internalExtensionService=o;this._instantiationService=n;this._environmentService=r;this._telemetryService=s;this._logService=l;this._onDidChangeResponsiveState=this._register(new E);this.onDidChangeResponsiveState=this._onDidChangeResponsiveState.event;this._hasStarted=!1;this._cachedActivationEvents=new Map,this._resolvedActivationEvents=new Set,this._rpcProtocol=null,this._customers=[],this._extensionHost=e,this.onDidExit=this._extensionHost.onExit;let c={time:Date.now(),action:"starting",kind:bA(this.kind)};this._telemetryService.publicLog2("extensionHostStartup",c),this._proxy=this._extensionHost.start().then(u=>{let p={time:Date.now(),action:"success",kind:bA(this.kind)};return this._telemetryService.publicLog2("extensionHostStartup",p),this._createExtensionHostCustomers(this.kind,u)},u=>{this._logService.error(`Error received from starting extension host (kind: ${bA(this.kind)})`),this._logService.error(u);let p={time:Date.now(),action:"error",kind:bA(this.kind)};return u&&u.name&&(p.errorName=u.name),u&&u.message&&(p.errorMessage=u.message),u&&u.stack&&(p.errorStack=u.stack),this._telemetryService.publicLog2("extensionHostStartup",p),null}),this._proxy.then(()=>{this._hasStarted=!0,t.forEach(u=>this.activateByEvent(u,0)),this._register(Lyn({measure:()=>this.measure()}))})}get pid(){return this._extensionHost.pid}get kind(){return this._extensionHost.runningLocation.kind}get startup(){return this._extensionHost.startup}get friendyName(){return wzi(this.kind,this.pid)}async disconnect(){await this._extensionHost?.disconnect?.()}dispose(){this._extensionHost?.dispose(),this._rpcProtocol?.dispose();for(let e=0,t=this._customers.length;e<t;e++){let o=this._customers[e];try{o.dispose()}catch(n){mt(n)}}this._proxy=null,super.dispose()}async measure(){let e=await this._proxy;if(!e)return null;let t=await this._measureLatency(e),o=await this._measureDown(e),n=await this._measureUp(e);return{remoteAuthority:this._extensionHost.remoteAuthority,latency:t,down:o,up:n}}get isReady(){return this._hasStarted}async ready(){await this._proxy}async _measureLatency(e){let o=0;for(let n=0;n<10;n++){let r=Dn.create();await e.test_latency(n),r.stop(),o+=r.elapsed()}return o/10}static _convert(e,t){return e*1e3*8/t}async _measureUp(e){let o=qe.alloc(10485760),n=Math.ceil(Math.random()*256);for(let s=0;s<o.byteLength;s++)o.writeUInt8(s,n);let r=Dn.create();return await e.test_up(o),r.stop(),ZU._convert(10485760,r.elapsed())}async _measureDown(e){let o=Dn.create();return await e.test_down(10485760),o.stop(),ZU._convert(10485760,o.elapsed())}_createExtensionHostCustomers(e,t){let o=null;Eyn||this._environmentService.logExtensionHostCommunication?o=new yzi(e):NGe.isEnabled()&&(o=new NGe(this._telemetryService)),this._rpcProtocol=new iYt(t,o),this._register(this._rpcProtocol.onDidChangeResponsiveState(u=>this._onDidChangeResponsiveState.fire(u)));let n=null,r=[],s={remoteAuthority:this._extensionHost.remoteAuthority,extensionHostKind:this.kind,getProxy:u=>this._rpcProtocol.getProxy(u),set:(u,p)=>this._rpcProtocol.set(u,p),dispose:()=>this._rpcProtocol.dispose(),assertRegistered:u=>this._rpcProtocol.assertRegistered(u),drain:()=>this._rpcProtocol.drain(),internalExtensionService:this._internalExtensionService,_setExtensionHostProxy:u=>{n=u},_setAllMainProxyIdentifiers:u=>{r=u}},l=gDt.getNamedCustomers();for(let u=0,p=l.length;u<p;u++){let[h,g]=l[u];try{let f=this._instantiationService.createInstance(g,s);this._customers.push(f),this._rpcProtocol.set(h,f)}catch(f){this._logService.error(`Cannot instantiate named customer: '${h.sid}'`),this._logService.error(f),mt(f)}}let c=gDt.getCustomers();for(let u of c)try{let p=this._instantiationService.createInstance(u,s);this._customers.push(p)}catch(p){this._logService.error(p),mt(p)}if(!n)throw new Error("Missing IExtensionHostProxy!");return this._rpcProtocol.assertRegistered(r),n}async activate(e,t){let o=await this._proxy;return o?o.activate(e,t):!1}activateByEvent(e,t){return this._cachedActivationEvents.has(e)||this._cachedActivationEvents.set(e,this._activateByEvent(e,t)),this._cachedActivationEvents.get(e)}activationEventIsDone(e){return this._resolvedActivationEvents.has(e)}async _activateByEvent(e,t){if(!this._proxy)return;let o=await this._proxy;if(o){if(!this._extensionHost.extensions.containsActivationEvent(e)){this._resolvedActivationEvents.add(e);return}await o.activateByEvent(e,t),this._resolvedActivationEvents.add(e)}}async getInspectPort(e){if(this._extensionHost){e&&await this._extensionHost.enableInspectPort();let t=this._extensionHost.getInspectPort();if(t)return t}}async resolveAuthority(e,t){let o=Dn.create(!1),n=()=>`[${bA(this._extensionHost.runningLocation.kind)}${this._extensionHost.runningLocation.affinity}][resolveAuthority(${bK(e)},${t})][${o.elapsed()}ms] `,r=u=>this._logService.info(`${n()}${u}`),s=(u,p=void 0)=>this._logService.error(`${n()}${u}`,p);r("obtaining proxy...");let l=await this._proxy;if(!l)return s("no proxy"),{type:"error",error:{message:"Cannot resolve authority",code:"Unknown",detail:void 0}};r("invoking...");let c=new FI;try{c.cancelAndSet(()=>r("waiting..."),1e3);let u=await l.resolveAuthority(e,t);return c.dispose(),u.type==="ok"?r(`returned ${u.value.authority.connectTo}`):s("returned an error",u.error),u}catch(u){return c.dispose(),s("returned an error",u),{type:"error",error:{message:u.message,code:"Unknown",detail:u}}}}async getCanonicalURI(e,t){let o=await this._proxy;if(!o)throw new Error("Cannot resolve canonical URI");return o.getCanonicalURI(e,t)}async start(e,t,o){let n=await this._proxy;if(!n)return;let r=this._extensionHost.extensions.set(e,t,o);return n.startExtensionHost(r)}async extensionTestsExecute(){let e=await this._proxy;if(!e)throw new Error("Could not obtain Extension Host Proxy");return e.extensionTestsExecute()}representsRunningLocation(e){return this._extensionHost.runningLocation.equals(e)}async deltaExtensions(e){let t=await this._proxy;if(!t)return;let o=this._extensionHost.extensions.delta(e);if(o)return t.deltaExtensions(o)}containsExtension(e){return this._extensionHost.extensions?.containsExtension(e)??!1}async setRemoteEnvironment(e){let t=await this._proxy;if(t)return t.setRemoteEnvironment(e)}};ZU=I([m(3,F),m(4,At),m(5,Te),m(6,se)],ZU);function wzi(a,i){return i?`${bA(a)} pid: ${i}`:`${bA(a)}`}var _yn=[["#2977B1","#FC802D","#34A13A","#D3282F","#9366BA"],["#8B564C","#E177C0","#7F7F7F","#BBBE3D","#2EBECD"]];function TAo(a){if(Array.isArray(a))return a;if(a&&typeof a=="object"&&typeof a.toString=="function"){let i=a.toString();if(i!=="[object Object]")return i}return a}function Dyn(a){return Array.isArray(a)?a.map(TAo):TAo(a)}var yzi=class{constructor(i){this._kind=i;this._totalIncoming=0;this._totalOutgoing=0}_log(i,e,t,o,n,r,s){s=Dyn(s);let l=_yn[n],c=Tyn?l[o%l.length]:"#000000",u=[`%c[${bA(this._kind)}][${i}]%c[${String(e).padStart(7)}]%c[len: ${String(t).padStart(5)}]%c${String(o).padStart(5)} - ${r}`,"color: darkgreen","color: grey","color: grey",`color: ${c}`];/\($/.test(r)?(u=u.concat(s),u.push(")")):u.push(s),console.log.apply(console,u)}logIncoming(i,e,t,o,n){this._totalIncoming+=i,this._log("Ext \u2192 Win",this._totalIncoming,i,e,t,o,n)}logOutgoing(i,e,t,o,n){this._totalOutgoing+=i,this._log("Win \u2192 Ext",this._totalOutgoing,i,e,t,o,n)}},NGe=class{constructor(i){this._telemetryService=i;this._pendingRequests=new Map}static isEnabled(){return Math.random()<1e-4}logIncoming(i,e,t,o){if(t===0&&/^receiveReply(Err)?:/.test(o)){let n=this._pendingRequests.get(e)??"unknown_reply";this._pendingRequests.delete(e),this._telemetryService.publicLog2("extensionhost.incoming",{type:`${o} ${n}`,length:i})}t===1&&/^receiveRequest /.test(o)&&this._telemetryService.publicLog2("extensionhost.incoming",{type:`${o}`,length:i})}logOutgoing(i,e,t,o){t===0&&o.startsWith("request: ")&&(this._pendingRequests.set(e,o),this._telemetryService.publicLog2("extensionhost.outgoing",{type:o,length:i}))}};NGe=I([m(0,Te)],NGe);var $pt=[];function Lyn(a){return $pt.push(a),{dispose:()=>{for(let i=0;i<$pt.length;i++)if($pt[i]===a){$pt.splice(i,1);return}}}}function Ryn(){return $pt.slice(0)}W(class oYt extends K{constructor(){super({id:"editor.action.measureExtHostLatency",title:L(17664,"Measure Extension Host Latency"),category:Ve.Developer,f1:!0})}async run(i){let e=i.get(ee),t=await Promise.all(Ryn().map(o=>o.measure()));e.openEditor({resource:void 0,contents:t.map(oYt._print).join(`

`),options:{pinned:!0}})}static _print(i){return i?`${i.remoteAuthority?`Authority: ${i.remoteAuthority}
`:""}Roundtrip latency: ${i.latency.toFixed(3)}ms
Up: ${oYt._printSpeed(i.up)}
Down: ${oYt._printSpeed(i.down)}
`:""}static _printSpeed(i){return i<=1024?`${i} bps`:i<1024*1024?`${(i/1024).toFixed(1)} kbps`:`${(i/1024/1024).toFixed(1)} Mbps`}});var OGe=class{constructor(i,e,t,o,n,r){this._registry=i;this._extensionHostKindPicker=e;this._environmentService=t;this._configurationService=o;this._logService=n;this._extensionManifestPropertiesService=r;this._runningLocation=new iu;this._maxLocalProcessAffinity=0;this._maxLocalWebWorkerAffinity=0}get maxLocalProcessAffinity(){return this._maxLocalProcessAffinity}get maxLocalWebWorkerAffinity(){return this._maxLocalWebWorkerAffinity}set(i,e){this._runningLocation.set(i,e)}readExtensionKinds(i){return i.isUnderDevelopment&&this._environmentService.extensionDevelopmentKind?this._environmentService.extensionDevelopmentKind:this._extensionManifestPropertiesService.getExtensionKind(i)}getRunningLocation(i){return this._runningLocation.get(i)||null}filterByRunningLocation(i,e){return jpt(i,this._runningLocation,t=>e.equals(t))}filterByExtensionHostKind(i,e){return jpt(i,this._runningLocation,t=>t.kind===e)}filterByExtensionHostManager(i,e){return jpt(i,this._runningLocation,t=>e.representsRunningLocation(t))}_computeAffinity(i,e,t){let o=new iu;for(let p of i)(p.main||p.browser)&&o.set(p.identifier,p);for(let p of this._registry.getAllExtensionDescriptions())if(p.main||p.browser){let h=this._runningLocation.get(p.identifier);h&&h.kind===e&&o.set(p.identifier,p)}let n=new iu,r=0;for(let[p,h]of o)n.set(h.identifier,++r);let s=(p,h)=>{for(let[g,f]of n)f===p&&n.set(g,h)};for(let[p,h]of o){if(!h.extensionDependencies)continue;let g=n.get(h.identifier);for(let f of h.extensionDependencies){let v=n.get(f);v&&v!==g&&s(v,g)}}for(let[p,h]of o){if(!h.extensionAffinity)continue;if(!Ua(h,"extensionAffinity")){this._logService.warn(`Extension '${h.identifier.value}' declares 'extensionAffinity' in its package.json but does not enable the 'extensionAffinity' API proposal. Add '"enabledApiProposals": ["extensionAffinity"]' to the extension's package.json to use this feature.`);continue}let g=n.get(h.identifier);for(let f of h.extensionAffinity){let v=n.get(f);v&&v!==g&&s(v,g)}}let l=new Map,c=0;for(let[p,h]of o){let g=this._runningLocation.get(h.identifier);if(g){let f=n.get(h.identifier);l.set(f,g.affinity),c=Math.max(c,g.affinity)}}if(!this._environmentService.isExtensionDevelopment){let p=this._configurationService.getValue("extensions.experimental.affinity")||{},h=Object.keys(p),g=new Map;for(let f of h){let v=p[f];if(typeof v!="number"||v<=0||Math.floor(v)!==v){this._logService.info(`Ignoring configured affinity for '${f}' because the value is not a positive integer.`);continue}let b=n.get(f);if(!b)continue;let S=l.get(b);if(S){g.set(v,S);continue}let y=g.get(v);if(y){l.set(b,y);continue}if(!t){this._logService.info(`Ignoring configured affinity for '${f}' because extension host(s) are already running. Reload window.`);continue}let w=++c;g.set(v,w),l.set(b,w)}}let u=new iu;for(let p of i){let h=n.get(p.identifier)||0,g=l.get(h)||0;u.set(p.identifier,g)}if(c>0&&t)for(let p=1;p<=c;p++){let h=[];for(let g of i)u.get(g.identifier)===p&&h.push(g.identifier);this._logService.info(`Placing extension(s) ${h.map(g=>g.value).join(", ")} on a separate extension host.`)}return{affinities:u,maxAffinity:c}}computeRunningLocation(i,e,t){return this._doComputeRunningLocation(this._runningLocation,i,e,t).runningLocation}_doComputeRunningLocation(i,e,t,o){e=e.filter(f=>!i.has(f.identifier)),t=t.filter(f=>!i.has(f.identifier));let n=voo(e,t,f=>this.readExtensionKinds(f),(f,v,b,S,y)=>this._extensionHostKindPicker.pickExtensionHostKind(f,v,b,S,y)),r=new iu;for(let f of e)r.set(f.identifier,f);for(let f of t)r.set(f.identifier,f);let s=new iu,l=[],c=[];for(let[f,v]of n){let b=null;if(v===1){let S=r.get(f);S&&l.push(S)}else if(v===2){let S=r.get(f);S&&c.push(S)}else v===3&&(b=new goe);s.set(f,b)}let{affinities:u,maxAffinity:p}=this._computeAffinity(l,1,o);for(let f of l){let v=u.get(f.identifier)||0;s.set(f.identifier,new hoe(v))}let{affinities:h,maxAffinity:g}=this._computeAffinity(c,2,o);for(let f of c){let v=h.get(f.identifier)||0;s.set(f.identifier,new rq(v))}for(let[f,v]of i)v&&s.set(f,v);return{runningLocation:s,maxLocalProcessAffinity:p,maxLocalWebWorkerAffinity:g}}initializeRunningLocation(i,e){let{runningLocation:t,maxLocalProcessAffinity:o,maxLocalWebWorkerAffinity:n}=this._doComputeRunningLocation(this._runningLocation,i,e,!0);this._runningLocation=t,this._maxLocalProcessAffinity=o,this._maxLocalWebWorkerAffinity=n}deltaExtensions(i,e){let t=new iu;for(let o of e){let n=o;t.set(n,this._runningLocation.get(n)||null),this._runningLocation.delete(n)}return this._updateRunningLocationForAddedExtensions(i),t}_updateRunningLocationForAddedExtensions(i){let e=[],t=[];for(let r of i){let s=this.readExtensionKinds(r),l=r.extensionLocation.scheme===Q.vscodeRemote,c=this._extensionHostKindPicker.pickExtensionHostKind(r.identifier,s,!l,l,0),u=null;c===1?e.push(r):c===2?t.push(r):c===3&&(u=new goe),this._runningLocation.set(r.identifier,u)}let{affinities:o}=this._computeAffinity(e,1,!1);for(let r of e){let s=o.get(r.identifier)||0;this._runningLocation.set(r.identifier,new hoe(s))}let{affinities:n}=this._computeAffinity(t,2,!1);for(let r of t){let s=n.get(r.identifier)||0;this._runningLocation.set(r.identifier,new rq(s))}}};OGe=I([m(2,At),m(3,B),m(4,se),m(5,Gp)],OGe);function jpt(a,i,e){return a.filter(t=>{let o=i.get(t.identifier);return o&&e(o)})}function DAo(a,i,e){return a.filter(t=>{let o=i.get(t);return o&&e(o)})}var FGe=class extends x{constructor(e,t,o,n,r){super();this._initialActivationEvents=t;this._internalExtensionService=o;this._instantiationService=n;this._logService=r;this._onDidChangeResponsiveState=this._register(new E);this.onDidChangeResponsiveState=this._onDidChangeResponsiveState.event;this._extensionHost=e,this.onDidExit=e.onExit,this._startCalled=new gp,this._actual=null}get pid(){return this._actual?this._actual.pid:null}get kind(){return this._extensionHost.runningLocation.kind}get startup(){return this._extensionHost.startup}get friendyName(){return wzi(this.kind,this.pid)}dispose(){this._actual||this._extensionHost.dispose(),super.dispose()}_createActual(e){return this._logService.info(`Creating lazy extension host (${this.friendyName}). Reason: ${e}`),this._actual=this._register(this._instantiationService.createInstance(ZU,this._extensionHost,this._initialActivationEvents,this._internalExtensionService)),this._register(this._actual.onDidChangeResponsiveState(t=>this._onDidChangeResponsiveState.fire(t))),this._actual}async _getOrCreateActualAndStart(e){if(this._actual)return this._actual;let t=this._createActual(e);return await t.ready(),t}get isReady(){return this._startCalled.isOpen()&&(this._actual?.isReady??!1)}async ready(){await this._startCalled.wait(),this._actual&&await this._actual.ready()}async disconnect(){await this._actual?.disconnect()}representsRunningLocation(e){return this._extensionHost.runningLocation.equals(e)}async deltaExtensions(e){if(await this._startCalled.wait(),this._actual)return this._actual.deltaExtensions(e);if(e.myToAdd.length>0){await this._createActual(`contains ${e.myToAdd.length} new extension(s) (installed or enabled): ${e.myToAdd.map(o=>o.value)}`).ready();return}}containsExtension(e){return this._extensionHost.extensions?.containsExtension(e)??!1}async activate(e,t){return await this._startCalled.wait(),this._actual?this._actual.activate(e,t):!1}async activateByEvent(e,t){if(t===1)return this._actual?this._actual.activateByEvent(e,t):void 0;if(await this._startCalled.wait(),this._actual)return this._actual.activateByEvent(e,t)}activationEventIsDone(e){return this._startCalled.isOpen()?this._actual?this._actual.activationEventIsDone(e):!0:!1}async getInspectPort(e){return await this._startCalled.wait(),this._actual?.getInspectPort(e)}async resolveAuthority(e,t){return await this._startCalled.wait(),this._actual?this._actual.resolveAuthority(e,t):{type:"error",error:{message:"Cannot resolve authority",code:"Unknown",detail:void 0}}}async getCanonicalURI(e,t){if(await this._startCalled.wait(),this._actual)return this._actual.getCanonicalURI(e,t);throw new Error("Cannot resolve canonical URI")}async start(e,t,o){if(o.length>0){let r=this._createActual(`contains ${o.length} extension(s): ${o.map(s=>s.value)}.`).ready();return this._startCalled.open(),r}this._startCalled.open()}async extensionTestsExecute(){return await this._startCalled.wait(),(await this._getOrCreateActualAndStart("execute tests.")).extensionTestsExecute()}async setRemoteEnvironment(e){if(await this._startCalled.wait(),this._actual)return this._actual.setRemoteEnvironment(e)}};FGe=I([m(3,F),m(4,se)],FGe);var Czi=Object.hasOwnProperty,Myn=Promise.resolve(void 0),vse=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,P){super();this._extensionsProposedApi=t;this._extensionHostFactory=o;this._extensionHostKindPicker=n;this._instantiationService=r;this._notificationService=s;this._environmentService=l;this._telemetryService=c;this._extensionEnablementService=u;this._fileService=p;this._productService=h;this._extensionManagementService=g;this._contextService=f;this._configurationService=v;this._extensionManifestPropertiesService=b;this._logService=S;this._remoteAgentService=y;this._remoteExtensionsScannerService=w;this._lifecycleService=k;this._remoteAuthorityResolverService=T;this._dialogService=P;this._onDidRegisterExtensions=this._register(new E);this.onDidRegisterExtensions=this._onDidRegisterExtensions.event;this._onDidChangeExtensionsStatus=this._register(new E);this.onDidChangeExtensionsStatus=this._onDidChangeExtensionsStatus.event;this._onDidChangeExtensions=this._register(new E({leakWarningThreshold:400}));this.onDidChangeExtensions=this._onDidChangeExtensions.event;this._onWillActivateByEvent=this._register(new E);this.onWillActivateByEvent=this._onWillActivateByEvent.event;this._onDidChangeResponsiveChange=this._register(new E);this.onDidChangeResponsiveChange=this._onDidChangeResponsiveChange.event;this._onWillStop=this._register(new E);this.onWillStop=this._onWillStop.event;this._activationEventReader=new Tzi;this._registry=new eYt(this._activationEventReader);this._installedExtensionsReady=new gp;this._extensionStatus=new iu;this._allRequestedActivateEvents=new Set;this._pendingRemoteActivationEvents=new Set;this._remoteCrashTracker=new Zpt;this._deltaExtensionsQueue=[];this._inHandleDeltaExtensions=!1;this._extensionHostManagers=this._register(new xzi);this._resolveAuthorityAttempt=0;this._initializePromise=null;this._hasLocalProcess=e.hasLocalProcess,this._allowRemoteExtensionsInLocalWebWorker=e.allowRemoteExtensionsInLocalWebWorker,this._register(this._fileService.onWillActivateFileSystemProvider(O=>{O.scheme!==Q.vscodeRemote&&O.join(this.activateByEvent(`onFileSystem:${O.scheme}`))})),this._runningLocations=new OGe(this._registry,this._extensionHostKindPicker,this._environmentService,this._configurationService,this._logService,this._extensionManifestPropertiesService),this._register(this._extensionEnablementService.onEnablementChanged(O=>{let V=[],H=[];for(let G of O)this._safeInvokeIsEnabled(G)?V.push(G):H.push(G);ef&&this._logService.info(`AbstractExtensionService.onEnablementChanged fired for ${O.map(G=>G.identifier.id).join(", ")}`),this._handleDeltaExtensions(new fse(V,H))})),this._register(this._extensionManagementService.onDidChangeProfile(({added:O,removed:V})=>{(O.length||V.length)&&(ef&&this._logService.info("AbstractExtensionService.onDidChangeProfile fired"),this._handleDeltaExtensions(new fse(O,V)))})),this._register(this._extensionManagementService.onDidEnableExtensions(O=>{O.length&&(ef&&this._logService.info("AbstractExtensionService.onDidEnableExtensions fired"),this._handleDeltaExtensions(new fse(O,[])))})),this._register(this._extensionManagementService.onDidInstallExtensions(O=>{let V=[],H=[];for(let{local:G,operation:$}of O)G&&G.isValid&&$!==4&&this._safeInvokeIsEnabled(G)&&(V.push(G),$===3&&H.push(G.identifier.id));V.length&&(ef&&this._logService.info(`AbstractExtensionService.onDidInstallExtensions fired for ${V.map(G=>G.identifier.id).join(", ")}`),this._handleDeltaExtensions(new fse(V,H)))})),this._register(this._extensionManagementService.onDidUninstallExtension(O=>{O.error||(ef&&this._logService.info(`AbstractExtensionService.onDidUninstallExtension fired for ${O.identifier.id}`),this._handleDeltaExtensions(new fse([],[O.identifier.id])))})),this._register(this._lifecycleService.onWillShutdown(O=>{this._remoteAgentService.getConnection()?O.join(async()=>{try{await this._remoteAgentService.endConnection(),await this._doStopExtensionHosts(),this._remoteAgentService.getConnection()?.dispose()}catch{this._logService.warn("Error while disconnecting remote agent")}},{id:"join.disconnectRemote",label:d(17654,null),order:2}):O.join(this._doStopExtensionHosts(),{id:"join.stopExtensionHosts",label:d(17663,null)})}))}_getExtensionHostManagers(e){return this._extensionHostManagers.getByKind(e)}async _handleDeltaExtensions(e){if(this._deltaExtensionsQueue.push(e),this._inHandleDeltaExtensions)return;let t=null;try{for(this._inHandleDeltaExtensions=!0,await this._installedExtensionsReady.wait(),t=await this._registry.acquireLock("handleDeltaExtensions");this._deltaExtensionsQueue.length>0;){let o=this._deltaExtensionsQueue.shift();await this._deltaExtensions(t,o.toAdd,o.toRemove)}}finally{this._inHandleDeltaExtensions=!1,t?.dispose()}}async _deltaExtensions(e,t,o){ef&&this._logService.info(`AbstractExtensionService._deltaExtensions: toAdd: [${t.map(l=>l.identifier.id).join(",")}] toRemove: [${o.map(l=>typeof l=="string"?l:l.identifier.id).join(",")}]`);let n=[];for(let l=0,c=o.length;l<c;l++){let u=o[l],p=typeof u=="string"?u:u.identifier.id,h=typeof u=="string"?null:u,g=this._registry.getExtensionDescription(p);g&&(h&&g.extensionLocation.scheme!==h.location.scheme||this.canRemoveExtension(g)&&n.push(g))}let r=[];for(let l=0,c=t.length;l<c;l++){let u=t[l],p=bF(u,!1);p&&this._canAddExtension(p,n)&&r.push(p)}if(r.length===0&&n.length===0)return;let s=this._registry.deltaExtensions(e,r,n.map(l=>l.identifier));this._onDidChangeExtensions.fire({added:r,removed:n}),n=n.concat(s.removedDueToLooping),s.removedDueToLooping.length>0&&this._notificationService.notify({severity:ft.Error,message:d(17660,null,s.removedDueToLooping.map(l=>`'${l.identifier.value}'`).join(", "))}),this._extensionsProposedApi.updateEnabledApiProposals(r),this._doHandleExtensionPoints([].concat(r).concat(n),!1),await this._updateExtensionsOnExtHosts(s.versionId,r,n.map(l=>l.identifier));for(let l=0;l<r.length;l++)this._activateAddedExtensionIfNeeded(r[l])}async _updateExtensionsOnExtHosts(e,t,o){let n=this._runningLocations.deltaExtensions(t,o),r=this._extensionHostManagers.map(s=>this._updateExtensionsOnExtHost(s,e,t,o,n));await Promise.all(r)}async _updateExtensionsOnExtHost(e,t,o,n,r){let s=this._runningLocations.filterByExtensionHostManager(o,e),l=DAo(n,r,u=>e.representsRunningLocation(u)),c=F5.createActivationEventsMap(o);if(ef){let u=h=>h.map(g=>g.identifier.value).join(","),p=h=>h.map(g=>g.value).join(",");this._logService.info(`AbstractExtensionService: Calling deltaExtensions: toRemove: [${p(n)}], toAdd: [${u(o)}], myToRemove: [${p(l)}], myToAdd: [${u(s)}],`)}await e.deltaExtensions({versionId:t,toRemove:n,toAdd:o,addActivationEvents:c,myToRemove:l,myToAdd:s.map(u=>u.identifier)})}canAddExtension(e){return this._canAddExtension(e,[])}_canAddExtension(e,t){if(this._registry.getExtensionDescriptionByIdOrUUID(e.identifier,e.id)&&!t.some(c=>Ii.equals(e.identifier,c.identifier)))return!1;let n=this._runningLocations.readExtensionKinds(e),r=e.extensionLocation.scheme===Q.vscodeRemote;return this._extensionHostKindPicker.pickExtensionHostKind(e.identifier,n,!r,r,0)!==null}canRemoveExtension(e){let t=this._registry.getExtensionDescription(e.identifier);return!(!t||this._extensionStatus.get(t.identifier)?.activationStarted)}async _activateAddedExtensionIfNeeded(e){let t=null,o=!1,n=this._activationEventReader.readActivationEvents(e);for(let r of n){if(this._allRequestedActivateEvents.has(r)){t=r;break}if(r==="*"){t=r;break}if(/^workspaceContains/.test(r)&&(o=!0),r==="onStartupFinished"){t=r;break}}if(!t&&o){let r=await this._contextService.getCompleteWorkspace(),s=!!this._environmentService.remoteAuthority,l={logService:this._logService,folders:r.folders.map(u=>u.uri),forceUsingSearch:s,exists:u=>this._fileService.exists(u),checkExists:(u,p,h)=>this._instantiationService.invokeFunction(g=>O_e(g,u,p,h))},c=await mro(l,e);c&&(t=c.activationEvent)}t&&await Promise.all(this._extensionHostManagers.map(r=>r.activate(e.identifier,{startup:!1,extensionId:e.identifier,activationEvent:t})))}_initializeIfNeeded(){return this._initializePromise||(this._initializePromise=this._initialize()),this._initializePromise}async _initialize(){Mo("code/willLoadExtensions"),this._startExtensionHostsIfNecessary(!0,[]);let e=await this._registry.acquireLock("_initialize");try{await this._resolveAndProcessExtensions(e),this._startOnDemandExtensionHosts()}finally{e.dispose()}this._releaseBarrier(),Mo("code/didLoadExtensions"),this._activateDeferredRemoteEvents(),await this._handleExtensionTests()}async _activateDeferredRemoteEvents(){if(this._pendingRemoteActivationEvents.size===0)return;let e=this._getExtensionHostManagers(3);if(e.length===0){this._pendingRemoteActivationEvents.clear();return}await Promise.all(e.map(t=>t.ready()));for(let t of this._pendingRemoteActivationEvents){let o=Promise.all(e.map(n=>n.activateByEvent(t,0))).then(()=>{});this._onWillActivateByEvent.fire({event:t,activation:o,activationKind:0})}this._pendingRemoteActivationEvents.clear()}async _resolveAndProcessExtensions(e){let t=[],o=[],n=[];for await(let h of this._resolveExtensions())h instanceof Ypt&&(t=Qpt(this._logService,this._extensionEnablementService,this._extensionsProposedApi,h.extensions,!1),this._registry.deltaExtensions(e,t,[]),this._doHandleExtensionPoints(t,!0)),h instanceof Xpt&&(o=Qpt(this._logService,this._extensionEnablementService,this._extensionsProposedApi,h.extensions,!1)),h instanceof Jpt&&(n=Qpt(this._logService,this._extensionEnablementService,this._extensionsProposedApi,h.extensions,!1));this._runningLocations.initializeRunningLocation(o,n),this._startExtensionHostsIfNecessary(!0,[]);let r=this._allowRemoteExtensionsInLocalWebWorker?this._runningLocations.filterByExtensionHostKind(n,2):[],s=this._hasLocalProcess?this._runningLocations.filterByExtensionHostKind(o,1):[],l=this._runningLocations.filterByExtensionHostKind(o,2);n=this._runningLocations.filterByExtensionHostKind(n,3);for(let h of r)Pyn(l,h.identifier)||l.push(h);let c=n.concat(s).concat(l),u=c;if(t.length&&(u=c.filter(h=>!t.some(g=>Ii.equals(g.identifier,h.identifier)&&g.extensionLocation.toString()===h.extensionLocation.toString())),c.length<u.length+t.length)){let h=t.filter(g=>!c.some(f=>Ii.equals(f.identifier,g.identifier)&&f.extensionLocation.toString()===g.extensionLocation.toString()));h.length&&(this._registry.deltaExtensions(e,[],h.map(g=>g.identifier)),this._doHandleExtensionPoints(h,!0))}let p=this._registry.deltaExtensions(e,u,[]);p.removedDueToLooping.length>0&&this._notificationService.notify({severity:ft.Error,message:d(17660,null,p.removedDueToLooping.map(h=>`'${h.identifier.value}'`).join(", "))}),this._doHandleExtensionPoints(this._registry.getAllExtensionDescriptions(),!1)}async _handleExtensionTests(){if(!this._environmentService.isExtensionDevelopment||!this._environmentService.extensionTestsLocationURI)return;let e=this.findTestExtensionHost(this._environmentService.extensionTestsLocationURI);if(!e){let o=d(17659,null,this._environmentService.extensionTestsLocationURI.toString());console.error(o),this._notificationService.error(o);return}let t;try{t=await e.extensionTestsExecute(),ef&&this._logService.info(`Extension host test runner exit code: ${t}`)}catch(o){ef&&this._logService.error("Extension host test runner error",o),console.error(o),t=1}this._onExtensionHostExit(t)}findTestExtensionHost(e){let t=null;for(let o of this._registry.getAllExtensionDescriptions())if(ws(e,o.extensionLocation)){t=this._runningLocations.getRunningLocation(o.identifier);break}return t===null&&(e.scheme===Q.vscodeRemote?t=new goe:t=new hoe(0)),t!==null?this._extensionHostManagers.getByRunningLocation(t):null}_releaseBarrier(){this._installedExtensionsReady.open(),this._onDidRegisterExtensions.fire(void 0),this._onDidChangeExtensionsStatus.fire(this._registry.getAllExtensionDescriptions().map(e=>e.identifier))}async _resolveAuthorityInitial(e){for(let o=1;;o++)try{return this._resolveAuthorityWithLogging(e)}catch(n){if(Ew.isNoResolverFound(n)||Ew.isNotAvailable(n)||o>=5)throw n}}async _resolveAuthorityAgain(){let e=this._environmentService.remoteAuthority;if(e){this._remoteAuthorityResolverService._clearResolvedAuthority(e);try{let t=await this._resolveAuthorityWithLogging(e);this._remoteAuthorityResolverService._setResolvedAuthority(t.authority,t.options)}catch(t){this._remoteAuthorityResolverService._setResolvedAuthorityError(e,t)}}}async _resolveAuthorityWithLogging(e){let t=bK(e),o=Dn.create(!1);this._logService.info(`Invoking resolveAuthority(${t})...`);try{Mo(`code/willResolveAuthority/${t}`);let n=await this._resolveAuthority(e);return Mo(`code/didResolveAuthorityOK/${t}`),this._logService.info(`resolveAuthority(${t}) returned '${n.authority.connectTo}' after ${o.elapsed()} ms`),n}catch(n){throw Mo(`code/didResolveAuthorityError/${t}`),this._logService.error(`resolveAuthority(${t}) returned an error after ${o.elapsed()} ms`,n),n}}async _resolveAuthorityOnExtensionHosts(e,t){let o=this._getExtensionHostManagers(e);if(o.length===0)throw new Error("Cannot resolve authority");this._resolveAuthorityAttempt++;let n=await Promise.all(o.map(s=>s.resolveAuthority(t,this._resolveAuthorityAttempt))),r=null;for(let s of n){if(s.type==="ok")return s.value;if(!r){r=s;continue}let l=r.error.code==="Unknown",c=s.error.code==="Unknown";l&&!c&&(r=s)}throw new Ew(r.error.message,r.error.code,r.error.detail)}async stopExtensionHosts(e,t){return await this._initializeIfNeeded(),this._doStopExtensionHostsWithVeto(e,t)}async _doStopExtensionHosts(){let e=[];for(let t of this._extensionStatus.values())t.activationStarted&&e.push(t.id);await this._extensionHostManagers.stopAllInReverse();for(let t of this._extensionStatus.values())t.clearRuntimeStatus();e.length>0&&this._onDidChangeExtensionsStatus.fire(e)}async _doStopExtensionHostsWithVeto(e,t=!1){if(t&&this._environmentService.isExtensionDevelopment)return!1;let o=[],n=new Set;this._onWillStop.fire({reason:e,auto:t,veto(s,l){o.push(s),typeof s=="boolean"?s===!0&&n.add(l):s.then(c=>{c&&n.add(l)}).catch(c=>{n.add(d(17657,null,l,xn(c)))})}});let r=await _7t(o,s=>this._logService.error(s));if(!r)await this._doStopExtensionHosts();else if(!t){let s=Array.from(n);this._logService.warn(`Extension host was not stopped because of veto (stop reason: ${e}, veto reason: ${s.join(", ")})`);let{confirmed:l}=await this._dialogService.confirm({type:ft.Warning,message:d(17658,null),detail:s.length===1?s[0]:s.join(`
 -`),primaryButton:d(17661,null)});if(l)return!0}return!r}_startExtensionHostsIfNecessary(e,t){let o=[];for(let n=0;n<=this._runningLocations.maxLocalProcessAffinity;n++)o.push(new hoe(n));for(let n=0;n<=this._runningLocations.maxLocalWebWorkerAffinity;n++)o.push(new rq(n));o.push(new goe);for(let n of o){if(this._extensionHostManagers.getByRunningLocation(n))continue;let r=this._createExtensionHostManager(n,e,t);if(r){let[s,l]=r;this._extensionHostManagers.add(s,l)}}}_createExtensionHostManager(e,t,o){let n=this._extensionHostFactory.createExtensionHost(this._runningLocations,e,t);if(!n)return null;let r=this._doCreateExtensionHostManager(n,o),s=new N;return s.add(r.onDidExit(([l,c])=>this._onExtensionHostCrashOrExit(r,l,c))),s.add(r.onDidChangeResponsiveState(l=>{this._logService.info(`Extension host (${r.friendyName}) is ${l===0?"responsive":"unresponsive"}.`),this._onDidChangeResponsiveChange.fire({extensionHostKind:r.kind,isResponsive:l===0,getInspectListener:c=>r.getInspectPort(c)})})),[r,s]}_doCreateExtensionHostManager(e,t){let o=this._acquireInternalAPI(e);return e.startup===3?this._instantiationService.createInstance(FGe,e,t,o):this._instantiationService.createInstance(ZU,e,t,o)}_onExtensionHostCrashOrExit(e,t,o){if(!KF(this._environmentService).isExtensionDevHost){this._onExtensionHostCrashed(e,t,o);return}this._onExtensionHostExit(t)}_onExtensionHostCrashed(e,t,o){console.error(`Extension host (${e.friendyName}) terminated unexpectedly. Code: ${t}, Signal: ${o}`),e.kind===1?this._doStopExtensionHosts():e.kind===3&&(o&&this._onRemoteExtensionHostCrashed(e,o),this._extensionHostManagers.stopOne(e))}_getExtensionHostExitInfoWithTimeout(e){return new Promise((t,o)=>{let n=setTimeout(()=>{o(new Error("getExtensionHostExitInfo timed out"))},2e3);this._remoteAgentService.getExtensionHostExitInfo(e).then(r=>{clearTimeout(n),t(r)},o)})}async _onRemoteExtensionHostCrashed(e,t){try{let o=await this._getExtensionHostExitInfoWithTimeout(t);o&&this._logService.error(`Extension host (${e.friendyName}) terminated unexpectedly with code ${o.code}.`),this._logExtensionHostCrash(e),this._remoteCrashTracker.registerCrash(),this._remoteCrashTracker.shouldAutomaticallyRestart()?(this._logService.info("Automatically restarting the remote extension host."),this._notificationService.status(d(17655,null),{hideAfter:5e3}),this._startExtensionHostsIfNecessary(!1,Array.from(this._allRequestedActivateEvents.keys()))):this._notificationService.prompt(ft.Error,d(17656,null),[{label:d(17662,null),run:()=>{this._startExtensionHostsIfNecessary(!1,Array.from(this._allRequestedActivateEvents.keys()))}}])}catch{}}_logExtensionHostCrash(e){let t=[];for(let o of this._extensionStatus.values())o.activationStarted&&e.containsExtension(o.id)&&t.push(o.id);t.length>0?this._logService.error(`Extension host (${e.friendyName}) terminated unexpectedly. The following extensions were running: ${t.map(o=>o.value).join(", ")}`):this._logService.error(`Extension host (${e.friendyName}) terminated unexpectedly. No extensions were activated.`)}async startExtensionHosts(e){await this._doStopExtensionHosts(),e&&await this._handleDeltaExtensions(new fse(e.toAdd,e.toRemove));let t=await this._registry.acquireLock("startExtensionHosts");try{this._startExtensionHostsIfNecessary(!1,Array.from(this._allRequestedActivateEvents.keys())),this._startOnDemandExtensionHosts();let o=this._getExtensionHostManagers(1);await Promise.all(o.map(n=>n.ready()))}finally{t.dispose()}}_startOnDemandExtensionHosts(){let e=this._registry.getSnapshot();for(let t of this._extensionHostManagers)if(t.startup!==1){let o=this._runningLocations.filterByExtensionHostManager(e.extensions,t);t.start(e.versionId,e.extensions,o.map(n=>n.identifier))}}activateByEvent(e,t=0){return this._installedExtensionsReady.isOpen()?(this._allRequestedActivateEvents.add(e),this._registry.containsActivationEvent(e)?this._activateByEvent(e,t):Myn):(this._allRequestedActivateEvents.add(e),t===1?(this._initializeIfNeeded(),this._activateByEvent(e,t)):this._installedExtensionsReady.wait().then(()=>this._activateByEvent(e,t)))}_activateByEvent(e,t){let o;t===1?(o=this._extensionHostManagers.filter(r=>r.kind===1||r.kind===2||r.isReady),this._pendingRemoteActivationEvents.add(e)):o=[...this._extensionHostManagers];let n=Promise.all(o.map(r=>r.activateByEvent(e,t))).then(()=>{});return this._onWillActivateByEvent.fire({event:e,activation:n,activationKind:t}),n}activateById(e,t){return this._activateById(e,t)}activationEventIsDone(e){return this._installedExtensionsReady.isOpen()?this._registry.containsActivationEvent(e)?this._extensionHostManagers.every(t=>t.activationEventIsDone(e)):!0:!1}whenInstalledExtensionsRegistered(){return this._installedExtensionsReady.wait()}get extensions(){return this._registry.getAllExtensionDescriptions()}_getExtensionRegistrySnapshotWhenReady(){return this._installedExtensionsReady.wait().then(()=>this._registry.getSnapshot())}getExtension(e){return this._installedExtensionsReady.wait().then(()=>this._registry.getExtensionDescription(e))}readExtensionPointContributions(e){return this._installedExtensionsReady.wait().then(()=>{let t=this._registry.getAllExtensionDescriptions(),o=[];for(let n of t)n.contributes&&Czi.call(n.contributes,e.name)&&o.push(new FTt(n,n.contributes[e.name]));return o})}getExtensionsStatus(){let e=Object.create(null);if(this._registry){let t=this._registry.getAllExtensionDescriptions();for(let o of t){let n=this._extensionStatus.get(o.identifier);e[o.identifier.value]={id:o.identifier,messages:n?.messages??[],activationStarted:n?.activationStarted??!1,activationTimes:n?.activationTimes??void 0,runtimeErrors:n?.runtimeErrors??[],runningLocation:this._runningLocations.getRunningLocation(o.identifier)}}}return e}async getInspectPorts(e,t){return(await Promise.all(this._getExtensionHostManagers(e).map(async n=>{let r=await n.getInspectPort(t);return r!==void 0&&(r={...r,devtoolsLabel:n.friendyName}),r}))).filter(lo)}async setRemoteEnvironment(e){await this._extensionHostManagers.map(t=>t.setRemoteEnvironment(e))}_safeInvokeIsEnabled(e){try{return this._extensionEnablementService.isEnabled(e)}catch{return!1}}_doHandleExtensionPoints(e,t){let o=Object.create(null);for(let l of e)if(l.contributes)for(let c in l.contributes)Czi.call(l.contributes,c)&&(o[c]=!0);let n=l=>this._handleExtensionPointMessage(l),r=this._registry.getAllExtensionDescriptions(),s=Rn.getExtensionPoints();Mo(t?"code/willHandleResolverExtensionPoints":"code/willHandleExtensionPoints");for(let l of s)o[l.name]&&(!t||l.canHandleResolver)&&(Mo(`code/willHandleExtensionPoint/${l.name}`),vse._handleExtensionPoint(l,r,n),Mo(`code/didHandleExtensionPoint/${l.name}`));Mo(t?"code/didHandleResolverExtensionPoints":"code/didHandleExtensionPoints")}_getOrCreateExtensionStatus(e){return this._extensionStatus.has(e)||this._extensionStatus.set(e,new Ezi(e)),this._extensionStatus.get(e)}_handleExtensionPointMessage(e){this._getOrCreateExtensionStatus(e.extensionId).addMessage(e);let o=this._registry.getExtensionDescription(e.extensionId),n=`[${e.extensionId.value}]: ${e.message}`;if(e.type===ft.Error?(o&&o.isUnderDevelopment&&this._notificationService.notify({severity:ft.Error,message:n}),this._logService.error(n)):e.type===ft.Warning?(o&&o.isUnderDevelopment&&this._notificationService.notify({severity:ft.Warning,message:n}),this._logService.warn(n)):this._logService.info(n),e.extensionId&&this._environmentService.isBuilt&&!this._environmentService.isExtensionDevelopment){let{type:r,extensionId:s,extensionPointId:l,message:c}=e;this._telemetryService.publicLog2("extensionsMessage",{type:r,extensionId:s.value,extensionPointId:l,message:c})}}static _handleExtensionPoint(e,t,o){let n=[];for(let r of t)r.contributes&&Czi.call(r.contributes,e.name)&&n.push({description:r,value:r.contributes[e.name],collector:new bTt(o,r,e.name)});e.acceptUsers(n)}_acquireInternalAPI(e){return{_activateById:(t,o)=>this._activateById(t,o),_onWillActivateExtension:t=>this._onWillActivateExtension(t,e.runningLocation),_onDidActivateExtension:(t,o,n,r,s)=>this._onDidActivateExtension(t,o,n,r,s),_onDidActivateExtensionError:(t,o)=>this._onDidActivateExtensionError(t,o),_onExtensionRuntimeError:(t,o)=>this._onExtensionRuntimeError(t,o)}}async _activateById(e,t){if(!(await Promise.all(this._extensionHostManagers.map(r=>r.activate(e,t)))).some(r=>r))throw new Error(`Unknown extension ${e.value}`)}_onWillActivateExtension(e,t){this._runningLocations.set(e,t),this._getOrCreateExtensionStatus(e).onWillActivate()}_onDidActivateExtension(e,t,o,n,r){this._getOrCreateExtensionStatus(e).setActivationTimes(new OTt(t,o,n,r)),this._onDidChangeExtensionsStatus.fire([e])}_onDidActivateExtensionError(e,t){this._telemetryService.publicLog2("extensionActivationError",{extensionId:e.value,error:t.message})}_onExtensionRuntimeError(e,t){this._getOrCreateExtensionStatus(e).addRuntimeError(t),this._onDidChangeExtensionsStatus.fire([e])}};vse=I([m(4,F),m(5,Ne),m(6,At),m(7,Te),m(8,Js),m(9,fe),m(10,tt),m(11,ru),m(12,Pe),m(13,B),m(14,Gp),m(15,se),m(16,bo),m(17,tG),m(18,ji),m(19,Uc),m(20,at)],vse);var xzi=class extends x{constructor(){super(...arguments);this._extensionHostManagers=[]}dispose(){for(let e=this._extensionHostManagers.length-1;e>=0;e--){let t=this._extensionHostManagers[e];t.extensionHost.disconnect(),t.dispose()}this._extensionHostManagers=[],super.dispose()}add(e,t){this._extensionHostManagers.push(new kzi(e,t))}async stopAllInReverse(){for(let e=this._extensionHostManagers.length-1;e>=0;e--){let t=this._extensionHostManagers[e];await t.extensionHost.disconnect(),t.dispose()}this._extensionHostManagers=[]}async stopOne(e){let t=this._extensionHostManagers.findIndex(o=>o.extensionHost===e);t>=0&&(this._extensionHostManagers.splice(t,1),await e.disconnect(),e.dispose())}getByKind(e){return this.filter(t=>t.kind===e)}getByRunningLocation(e){for(let t of this._extensionHostManagers)if(t.extensionHost.representsRunningLocation(e))return t.extensionHost;return null}*[Symbol.iterator](){for(let e of this._extensionHostManagers)yield e.extensionHost}map(e){return this._extensionHostManagers.map(t=>e(t.extensionHost))}every(e){return this._extensionHostManagers.every(t=>e(t.extensionHost))}filter(e){return this._extensionHostManagers.filter(t=>e(t.extensionHost)).map(t=>t.extensionHost)}},kzi=class{constructor(i,e){this.extensionHost=i;this.disposableStore=e}dispose(){this.disposableStore.dispose(),this.extensionHost.dispose()}},Ypt=class{constructor(i){this.extensions=i}},Xpt=class{constructor(i){this.extensions=i}},Jpt=class{constructor(i){this.extensions=i}},fse=class{constructor(i,e){this.toAdd=i;this.toRemove=e}};function LAo(a){return!!a.activationEvents?.some(i=>i.startsWith("onResolveRemoteAuthority:"))}function Qpt(a,i,e,t,o){return e.updateEnabledApiProposals(t),RAo(a,i,t,o)}function RAo(a,i,e,t){let o=[],n=[],r=[];for(let l of e)l.isUnderDevelopment?o.push(l):(n.push(l),r.push(ZE(l)));let s=i.getEnablementStates(r,t?{trusted:!0}:void 0);for(let l=0;l<s.length;l++)i.isEnabledEnablementState(s[l])?o.push(n[l]):ef&&a.info(`filterEnabledExtensions: extension '${n[l].identifier.value}' is disabled`);return o}function MAo(a,i,e,t){return RAo(a,i,[e],t).includes(e)}function Pyn(a,i){for(let e of a)if(Ii.equals(e.identifier,i))return!0;return!1}var Ezi=class{constructor(i){this.id=i;this._messages=[];this._activationTimes=null;this._runtimeErrors=[];this._activationStarted=!1}get messages(){return this._messages}get activationTimes(){return this._activationTimes}get runtimeErrors(){return this._runtimeErrors}get activationStarted(){return this._activationStarted}clearRuntimeStatus(){this._activationStarted=!1,this._activationTimes=null,this._runtimeErrors=[]}addMessage(i){this._messages.push(i)}setActivationTimes(i){this._activationTimes=i}addRuntimeError(i){this._runtimeErrors.push(i)}onWillActivate(){this._activationStarted=!0}},Zpt=class a{constructor(){this._recentCrashes=[]}static{this._TIME_LIMIT=300*1e3}static{this._CRASH_LIMIT=3}_removeOldCrashes(){let i=Date.now()-a._TIME_LIMIT;for(;this._recentCrashes.length>0&&this._recentCrashes[0].timestamp<i;)this._recentCrashes.shift()}registerCrash(){this._removeOldCrashes(),this._recentCrashes.push({timestamp:Date.now()})}shouldAutomaticallyRestart(){return this._removeOldCrashes(),this._recentCrashes.length<a._CRASH_LIMIT}},Tzi=class{readActivationEvents(i){return F5.readActivationEvents(i)}},_zi=class extends x{constructor(){super(...arguments);this.type="markdown"}shouldRender(e){return!!e.activationEvents}render(e){let t=e.activationEvents||[],o=new Ie;if(t.length)for(let n of t)o.appendMarkdown(`- \`${n}\`
`);return{data:o,dispose:()=>{}}}};ne.as(As.ExtensionFeaturesRegistry).registerExtensionFeature({id:"activationEvents",label:d(17653,null),access:{canToggle:!1},renderer:new Ft(_zi)});var WGe=class{constructor(i,e,t){this._logService=i;this._environmentService=e;if(this._envEnabledExtensions=new Set((e.extensionEnabledProposedApi??[]).map(o=>Ii.toKey(o))),this._envEnablesProposedApiForAll=!e.isBuilt||e.isExtensionDevelopment&&t.quality!=="stable"||this._envEnabledExtensions.size===0&&Array.isArray(e.extensionEnabledProposedApi),this._productEnabledExtensions=new Map,t.extensionEnabledApiProposals)for(let[o,n]of Object.entries(t.extensionEnabledApiProposals)){let r=Ii.toKey(o),s=n.filter(l=>vK[l]?!0:(i.warn(`Via 'product.json#extensionEnabledApiProposals' extension '${r}' wants API proposal '${l}' but that proposal DOES NOT EXIST. Likely, the proposal has been finalized (check 'vscode.d.ts') or was abandoned.`),!1));this._productEnabledExtensions.set(r,s)}}updateEnabledApiProposals(i){for(let e of i)this.doUpdateEnabledApiProposals(e)}doUpdateEnabledApiProposals(i){let e=Ii.toKey(i.identifier);if(yr(i.enabledApiProposals)&&(i.enabledApiProposals=i.enabledApiProposals.filter(t=>{let o=!!vK[t];return o||this._logService.error(`Extension '${e}' wants API proposal '${t}' but that proposal DOES NOT EXIST. Likely, the proposal has been finalized (check 'vscode.d.ts') or was abandoned.`),o})),this._productEnabledExtensions.has(e)){let t=this._productEnabledExtensions.get(e),o=new Set(t),n=new Set(i.enabledApiProposals),r=new Set([...n].filter(s=>!o.has(s)));r.size>0&&(this._logService.error(`Extension '${e}' appears in product.json but enables LESS API proposals than the extension wants.
package.json (LOSES): ${[...n].join(`
`)}
product.json (WINS): ${[...o].join(`
`)}
DELTA: ${[...r].join(`
`)}`),this._environmentService.isExtensionDevelopment&&(this._logService.error(`Proceeding with EXTRA proposals (${[...r].join(", ")}) because extension is in development mode. Still, this EXTENSION WILL BE BROKEN unless product.json is updated.`),t.push(...r))),i.enabledApiProposals=t;return}this._envEnablesProposedApiForAll||this._envEnabledExtensions.has(e)||!i.isBuiltin&&yr(i.enabledApiProposals)&&(this._logService.error(`Extension '${i.identifier.value} CANNOT USE these API proposals '${i.enabledApiProposals?.join(", ")||"*"}'. You MUST start in extension development mode or use the --enable-proposed-api command line flag`),i.enabledApiProposals=[])}};WGe=I([m(0,se),m(1,At),m(2,tt)],WGe);var Dzi=class extends x{constructor(){super(...arguments);this.type="markdown"}shouldRender(e){return!!e.originalEnabledApiProposals?.length||!!e.enabledApiProposals?.length}render(e){let t=e.originalEnabledApiProposals??e.enabledApiProposals??[],o=new Ie;if(t.length)for(let n of t)o.appendMarkdown(`- \`${n}\`
`);return{data:o,dispose:()=>{}}}};ne.as(As.ExtensionFeaturesRegistry).registerExtensionFeature({id:"enabledApiProposals",label:d(17665,null),access:{canToggle:!1},renderer:new Ft(Dzi)});var VGe=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super();this.runningLocation=e;this._initDataProvider=t;this.remoteSocketFactoryService=o;this._contextService=n;this._environmentService=r;this._telemetryService=s;this._logService=l;this._loggerService=c;this._labelService=u;this.remoteAuthorityResolverService=p;this._extensionHostDebugService=h;this._productService=g;this._signService=f;this._defaultLogLevelsService=v;this.pid=null;this.startup=1;this.extensions=null;this._onExit=this._register(new E);this.onExit=this._onExit.event;this._hasDisconnected=!1;this.remoteAuthority=this._initDataProvider.remoteAuthority,this._protocol=null,this._hasLostConnection=!1,this._terminating=!1;let b=KF(this._environmentService);this._isExtensionDevHost=b.isExtensionDevHost}start(){let e={commit:this._productService.commit,quality:this._productService.quality,addressProvider:{getAddress:async()=>{let{authority:t}=await this.remoteAuthorityResolverService.resolveAuthority(this._initDataProvider.remoteAuthority);return{connectTo:t.connectTo,connectionToken:t.connectionToken}}},remoteSocketFactoryService:this.remoteSocketFactoryService,signService:this._signService,logService:this._logService,ipcLogger:null};return this.remoteAuthorityResolverService.resolveAuthority(this._initDataProvider.remoteAuthority).then(t=>{let o={language:wr,debugId:this._environmentService.debugExtensionHost.debugId,break:this._environmentService.debugExtensionHost.break,port:this._environmentService.debugExtensionHost.port,env:{...this._environmentService.debugExtensionHost.env,...t.options?.extensionHostEnv}},n=this._environmentService.extensionDevelopmentLocationURI,r=!0;return n&&n.length>0&&n[0].scheme===Q.file&&(r=!1),r||(o.break=!1),ERo(e,o).then(s=>{this._register(s);let{protocol:l,debugPort:c,reconnectionToken:u}=s,p=typeof c=="number";return r&&this._environmentService.isExtensionDevelopment&&this._environmentService.debugExtensionHost.debugId&&c&&this._extensionHostDebugService.attachSession(this._environmentService.debugExtensionHost.debugId,c,this._initDataProvider.remoteAuthority),l.onDidDispose(()=>{this._onExtHostConnectionLost(u)}),l.onSocketClose(()=>{this._isExtensionDevHost&&this._onExtHostConnectionLost(u)}),new Promise((h,g)=>{let f=setTimeout(()=>{g("The remote extension host took longer than 60s to send its ready message.")},6e4),v=l.onMessage(b=>{if(u9(b,1)){this._createExtHostInitData(p).then(S=>{l.send(qe.fromString(JSON.stringify(S)))});return}if(u9(b,0)){clearTimeout(f),v.dispose(),this._protocol=l,h(l);return}console.error("received unexpected message during handshake phase from the extension host: ",b)})})})})}_onExtHostConnectionLost(e){this._hasLostConnection||(this._hasLostConnection=!0,this._isExtensionDevHost&&this._environmentService.debugExtensionHost.debugId&&this._extensionHostDebugService.close(this._environmentService.debugExtensionHost.debugId),!this._terminating&&this._onExit.fire([0,e]))}async _createExtHostInitData(e){let t=await this._initDataProvider.getInitData();this.extensions=t.extensions;let o=this._contextService.getWorkspace();return{commit:this._productService.commit,version:this._productService.version,quality:this._productService.quality,date:this._productService.date,parentPid:t.pid,environment:{isExtensionDevelopmentDebug:e,appRoot:t.appRoot,appName:this._productService.nameLong,appHost:this._productService.embedderIdentifier||"desktop",appUriScheme:this._productService.urlProtocol,isExtensionTelemetryLoggingOnly:Zke(this._productService,this._environmentService),appLanguage:wr,extensionDevelopmentLocationURI:this._environmentService.extensionDevelopmentLocationURI,extensionTestsLocationURI:this._environmentService.extensionTestsLocationURI,globalStorageHome:t.globalStorageHome,workspaceStorageHome:t.workspaceStorageHome,extensionLogLevel:this._defaultLogLevelsService.defaultLogLevels.extensions,isSessionsWindow:this._environmentService.isSessionsWindow},workspace:this._contextService.getWorkbenchState()===1?null:{configuration:o.configuration,id:o.id,name:this._labelService.getWorkspaceLabel(o),transient:o.transient},remote:{isRemote:!0,authority:this._initDataProvider.remoteAuthority,connectionData:t.connectionData},consoleForward:{includeStack:!1,logNative:!!this._environmentService.debugExtensionHost.debugId},extensions:this.extensions.toSnapshot(),telemetryInfo:{sessionId:this._telemetryService.sessionId,machineId:this._telemetryService.machineId,sqmId:this._telemetryService.sqmId,devDeviceId:this._telemetryService.devDeviceId??this._telemetryService.machineId,firstSessionDate:this._telemetryService.firstSessionDate,msftInternal:this._telemetryService.msftInternal},remoteExtensionTips:this._productService.remoteExtensionTips,virtualWorkspaceExtensionTips:this._productService.virtualWorkspaceExtensionTips,logLevel:this._logService.getLevel(),loggers:[...this._loggerService.getRegisteredLoggers()],logsLocation:t.extensionHostLogsPath,autoStart:this.startup===1,uiKind:Wt?2:1}}getInspectPort(){}enableInspectPort(){return Promise.resolve(!1)}async disconnect(){this._protocol&&!this._hasDisconnected&&(this._protocol.send(PGe(2)),this._protocol.sendDisconnect(),this._hasDisconnected=!0,await this._protocol.drain())}dispose(){super.dispose(),this._terminating=!0,this.disconnect(),this._protocol&&(this._protocol.getSocket().end(),this._protocol=null)}};VGe=I([m(2,r2),m(3,Pe),m(4,At),m(5,Te),m(6,se),m(7,Il),m(8,rt),m(9,Uc),m(10,ZD),m(11,tt),m(12,ose),m(13,zD)],VGe);function PAo(a,i,e,t,o){let n=new iu;return a.forEach(r=>{let s=n.get(r.identifier);s&&o.warn(d(17755,null,s.extensionLocation.fsPath,r.extensionLocation.fsPath)),n.set(r.identifier,r)}),i.forEach(r=>{let s=n.get(r.identifier);if(s)if(s.isBuiltin){if(VLt(s.version,r.version)){o.warn(`Skipping extension ${r.extensionLocation.path} in favour of the builtin extension ${s.extensionLocation.path}.`);return}r.isBuiltin=!0}else o.warn(d(17755,null,s.extensionLocation.fsPath,r.extensionLocation.fsPath));else if(r.isBuiltin){o.warn(`Skipping obsolete builtin extension ${r.extensionLocation.path}`);return}n.set(r.identifier,r)}),e.forEach(r=>{let s=n.get(r.identifier);s&&o.warn(d(17756,null,s.extensionLocation.fsPath,r.extensionLocation.fsPath)),n.set(r.identifier,r)}),t.forEach(r=>{o.info(d(17754,null,r.extensionLocation.fsPath));let s=n.get(r.identifier);s&&s.isBuiltin&&(r.isBuiltin=!0),n.set(r.identifier,r)}),Array.from(n.values())}var BGe=class{constructor(i,e,t,o,n,r,s){this._notificationService=i;this._hostService=e;this._extensionsScannerService=t;this._userDataProfileService=o;this._extensionManagementService=n;this._environmentService=r;this._logService=s;this.scannedExtensions=new Promise((l,c)=>{this._scannedExtensionsResolve=l,this._scannedExtensionsReject=c})}async startScanningExtensions(){try{let i=await this._scanInstalledExtensions();this._scannedExtensionsResolve(i)}catch(i){this._scannedExtensionsReject(i)}}async _scanInstalledExtensions(){try{let i=wr,e=await Promise.allSettled([this._extensionsScannerService.scanSystemExtensions({language:i,checkControlFile:!0}),this._extensionsScannerService.scanUserExtensions({language:i,profileLocation:this._userDataProfileService.currentProfile.extensionsResource,useCache:!0}),this._environmentService.remoteAuthority?[]:this._extensionManagementService.getInstalledWorkspaceExtensions(!1)]),t=!1,o=[];e[0].status==="fulfilled"?o=e[0].value:(t=!0,this._logService.error("Error scanning system extensions:",Pn(e[0].reason)));let n=[];e[1].status==="fulfilled"?n=e[1].value:(t=!0,this._logService.error("Error scanning user extensions:",Pn(e[1].reason)));let r=[];e[2].status==="fulfilled"?r=e[2].value:(t=!0,this._logService.error("Error scanning workspace extensions:",Pn(e[2].reason)));let s=[];try{let g=await this._extensionsScannerService.scanExtensionsUnderDevelopment([...o,...n],{language:i,includeInvalid:!0}),f=[];for(let v of g)v.isValid?s.push(v):f.push(v);f.length>0&&this._notificationService.prompt(bt.Warning,f.length===1?d(17759,null,f[0].location.fsPath,f[0].validations[0][1]):d(17758,null,f.map(v=>`'${v.location.fsPath}'`).join(", "),f.map(v=>`${v.validations[0][1]}`).join(", ")),[])}catch(g){this._logService.error(g)}let l=o.map(g=>V7t(g,!1)),c=n.map(g=>V7t(g,!1)),u=r.map(g=>bF(g,!1)),p=s.map(g=>V7t(g,!0)),h=PAo(l,c,u,p,this._logService);if(!t){let g=this._extensionsScannerService.onDidChangeCache(()=>{g.dispose(),this._notificationService.prompt(bt.Error,d(17757,null),[{label:d(17760,null),run:()=>this._hostService.reload()}])});Li(5e3).then(()=>g.dispose())}return h}catch(i){return this._logService.error("Error scanning installed extensions:"),this._logService.error(i),[]}}};BGe=I([m(0,Ne),m(1,Zt),m(2,a9),m(3,ln),m(4,ru),m(5,At),m(6,se)],BGe);var Lzi=class a{constructor(i){this.pipeName=i;this.type=1}static{this.ENV_KEY="VSCODE_EXTHOST_IPC_HOOK"}serialize(i){i[a.ENV_KEY]=this.pipeName}},Rzi=class a{constructor(){this.type=2}static{this.ENV_KEY="VSCODE_EXTHOST_WILL_SEND_SOCKET"}serialize(i){i[a.ENV_KEY]="1"}},emt=class a{constructor(){this.type=3}static{this.ENV_KEY="VSCODE_WILL_SEND_MESSAGE_PORT"}serialize(i){i[a.ENV_KEY]="1"}};function Ayn(a){delete a[Lzi.ENV_KEY],delete a[Rzi.ENV_KEY],delete a[emt.ENV_KEY]}function AAo(a,i){Ayn(i),a.serialize(i)}var Mzi=class{constructor(i,e){this._extensionHostStarter=e;this._id=i}get onStdout(){return this._extensionHostStarter.onDynamicStdout(this._id)}get onStderr(){return this._extensionHostStarter.onDynamicStderr(this._id)}get onMessage(){return this._extensionHostStarter.onDynamicMessage(this._id)}get onExit(){return this._extensionHostStarter.onDynamicExit(this._id)}start(i){return this._extensionHostStarter.start(this._id,i)}enableInspectPort(){return this._extensionHostStarter.enableInspectPort(this._id)}waitForExit(i){return this._extensionHostStarter.waitForExit(this._id,i)}kill(){return this._extensionHostStarter.kill(this._id)}},HGe=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k){super();this.runningLocation=e;this.startup=t;this._initDataProvider=o;this._contextService=n;this._notificationService=r;this._nativeHostService=s;this._lifecycleService=l;this._environmentService=c;this._userDataProfilesService=u;this._telemetryService=p;this._logService=h;this._loggerService=g;this._labelService=f;this._extensionHostDebugService=v;this._hostService=b;this._productService=S;this._shellEnvironmentService=y;this._extensionHostStarter=w;this._defaultLogLevelsService=k;this.pid=null;this.remoteAuthority=null;this.extensions=null;this._onExit=this._register(new E);this.onExit=this._onExit.event;this._onDidSetInspectPort=this._register(new E);let T=KF(this._environmentService);this._isExtensionDevHost=T.isExtensionDevHost,this._isExtensionDevDebug=T.isExtensionDevDebug,this._isExtensionDevDebugBrk=T.isExtensionDevDebugBrk,this._isExtensionDevTestFromCli=T.isExtensionDevTestFromCli,this._terminating=!1,this._mainProcessHandlesExtHostShutdown=!1,this._inspectListener=null,this._extensionHostProcess=null,this._messageProtocol=null,this._register(this._lifecycleService.onWillShutdown(P=>this._onWillShutdown(P))),this._register(this._extensionHostDebugService.onClose(P=>{this._isExtensionDevHost&&this._environmentService.debugExtensionHost.debugId===P.sessionId&&this._nativeHostService.closeWindow()})),this._register(this._extensionHostDebugService.onReload(P=>{this._isExtensionDevHost&&this._environmentService.debugExtensionHost.debugId===P.sessionId&&this._hostService.reload()}))}dispose(){this._terminating||(this._terminating=!0),super.dispose(),this._messageProtocol=null}async disconnect(){if(this._terminating=!0,this._messageProtocol)try{(await Promise.race([this._messageProtocol.then(t=>t,()=>{}),Li(1e3).then(()=>{})]))?.send(PGe(2))}catch{}this._extensionHostProcess&&!this._mainProcessHandlesExtHostShutdown&&this._extensionHostProcess.waitForExit(pAo).catch(()=>{}),this._messageProtocol=null}start(){if(this._terminating)throw new go;return this._messageProtocol||(this._messageProtocol=this._start()),this._messageProtocol}async _start(){let[e,t,o]=await Promise.all([this._extensionHostStarter.createExtensionHost(),this._tryFindDebugPort(),this._shellEnvironmentService.getShellEnv()]);this._extensionHostProcess=new Mzi(e.id,this._extensionHostStarter);let n=Xu(o,{VSCODE_ESM_ENTRYPOINT:"vs/workbench/api/node/extensionHostProcess",VSCODE_HANDLES_UNCAUGHT_ERRORS:!0});this._environmentService.debugExtensionHost.env&&Xu(n,this._environmentService.debugExtensionHost.env),T_o(n),this._isExtensionDevHost&&delete n.VSCODE_CODE_CACHE_PATH;let r={responseWindowId:this._nativeHostService.windowId,responseChannel:"vscode:startExtensionHostMessagePortResult",responseNonce:xt(),env:n,detached:!!ei,execArgv:void 0,silent:!0},s="127.0.0.1";t!==0?r.execArgv=["--nolazy",(this._isExtensionDevDebugBrk?"--inspect-brk=":"--inspect=")+`${s}:${t}`]:r.execArgv=["--inspect-port=0"],this._environmentService.extensionTestsLocationURI&&r.execArgv.unshift("--expose-gc"),this._environmentService.args["prof-v8-extensions"]&&r.execArgv.unshift("--prof"),r.execArgv.unshift("--dns-result-order=ipv4first","--experimental-network-inspection");let l=this._register(this._handleProcessOutputStream(this._extensionHostProcess.onStdout)),c=this._register(this._handleProcessOutputStream(this._extensionHostProcess.onStderr)),u=U.any(U.map(l.event,f=>({data:`%c${f}`,format:[""]})),U.map(c.event,f=>({data:`%c${f}`,format:["color: red"]}))),p=U.debounce(u,(f,v)=>f?{data:f.data+v.data,format:[...f.format,...v.format]}:{data:v.data,format:v.format},100);this._register(p(f=>{let v=f.data&&f.data.match(/ws:\/\/([^\s]+):(\d+)\/([^\s]+)/);if(v){let[,b,S,y]=v,w=`devtools://devtools/bundled/js_app.html?v8only=true&ws=${b}:${S}/${y}`;!this._environmentService.isBuilt&&!this._isExtensionDevTestFromCli&&console.debug(`%c[Extension Host] %cdebugger inspector at ${w}`,"color: blue","color:"),(!this._inspectListener||!this._inspectListener.devtoolsUrl)&&(this._inspectListener={host:b,port:Number(S),devtoolsUrl:w},this._onDidSetInspectPort.fire())}else this._isExtensionDevTestFromCli||(console.group("Extension Host"),console.log(f.data,...f.format),console.groupEnd())})),this._register(this._extensionHostProcess.onExit(({code:f,signal:v})=>this._onExtHostProcessExit(f,v))),t&&(this._isExtensionDevHost&&this._isExtensionDevDebug&&this._environmentService.debugExtensionHost.debugId&&this._extensionHostDebugService.attachSession(this._environmentService.debugExtensionHost.debugId,t),this._inspectListener={port:t,host:s},this._onDidSetInspectPort.fire());let h;(!this._environmentService.isBuilt&&!this._environmentService.remoteAuthority||this._isExtensionDevHost)&&(h=setTimeout(()=>{this._logService.error(`[LocalProcessExtensionHost]: Extension host did not start in 10 seconds (debugBrk: ${this._isExtensionDevDebugBrk})`);let f=this._isExtensionDevDebugBrk?d(17762,null):d(17761,null);this._notificationService.prompt(ft.Warning,f,[{label:d(17764,null),run:()=>this._hostService.reload()}],{sticky:!0,priority:3})},1e4));let g=await this._establishProtocol(this._extensionHostProcess,r);return await this._performHandshake(g),clearTimeout(h),g}async _tryFindDebugPort(){if(typeof this._environmentService.debugExtensionHost.port!="number")return 0;let e=this._environmentService.debugExtensionHost.port,t=await this._nativeHostService.findFreePort(e,10,5e3,2048);return this._isExtensionDevTestFromCli||(t?(t!==e&&console.warn(`%c[Extension Host] %cProvided debugging port ${e} is not free, using ${t} instead.`,"color: blue","color:"),this._isExtensionDevDebugBrk?console.warn(`%c[Extension Host] %cSTOPPED on first line for debugging on port ${t}`,"color: blue","color:"):console.debug(`%c[Extension Host] %cdebugger listening on port ${t}`,"color: blue","color:")):console.warn("%c[Extension Host] %cCould not find a free port for debugging","color: blue","color:")),t||0}_establishProtocol(e,t){AAo(new emt,t.env);let o=JU(void 0,t.responseChannel,t.responseNonce);return new Promise((n,r)=>{let s=setTimeout(()=>{r("The local extension host took longer than 60s to connect.")},6e4);o.then(c=>{this._register(Z(()=>{c.close(),c.onmessage=null})),clearTimeout(s);let u=new U4;c.onmessage=(p=>{p.data&&u.fire(qe.wrap(p.data))}),c.start(),n({onMessage:u.event,send:p=>c.postMessage(p.buffer)})});let l=Dn.create(!1);e.start(t).then(({pid:c})=>{c&&(this.pid=c),this._logService.info(`Started local extension host with pid ${c}.`);let u=l.elapsed();ef&&this._logService.info(`IExtensionHostStarter.start() took ${u} ms.`)},c=>{r(c)})})}_performHandshake(e){return new Promise((t,o)=>{let n,r=()=>{n=setTimeout(()=>{o("The local extension host took longer than 60s to send its ready message.")},6e4)},s=()=>{clearTimeout(n)};r();let l=e.onMessage(c=>{if(u9(c,1)){s(),this._createExtHostInitData().then(u=>{r(),e.send(qe.fromString(JSON.stringify(u)))});return}if(u9(c,0)){s(),l.dispose(),t();return}console.error("received unexpected message during handshake phase from the extension host: ",c)})})}async _createExtHostInitData(){let e=await this._initDataProvider.getInitData();this.extensions=e.extensions;let t=this._contextService.getWorkspace();return{commit:this._productService.commit,version:this._productService.version,quality:this._productService.quality,date:this._productService.date,parentPid:0,environment:{isExtensionDevelopmentDebug:this._isExtensionDevDebug,appRoot:this._environmentService.appRoot?A.file(this._environmentService.appRoot):void 0,appName:this._productService.nameLong,appHost:this._productService.telemetryAppName||this._productService.embedderIdentifier||"desktop",appUriScheme:this._productService.urlProtocol,isExtensionTelemetryLoggingOnly:Zke(this._productService,this._environmentService),isPortable:this._environmentService.isPortable,appLanguage:wr,extensionDevelopmentLocationURI:this._environmentService.extensionDevelopmentLocationURI,extensionTestsLocationURI:this._environmentService.extensionTestsLocationURI,globalStorageHome:this._userDataProfilesService.defaultProfile.globalStorageHome,workspaceStorageHome:this._environmentService.workspaceStorageHome,extensionLogLevel:this._defaultLogLevelsService.defaultLogLevels.extensions,isSessionsWindow:this._environmentService.isSessionsWindow},workspace:this._contextService.getWorkbenchState()===1?void 0:{configuration:t.configuration??void 0,id:t.id,name:this._labelService.getWorkspaceLabel(t),isUntitled:t.configuration?dR(t.configuration,this._environmentService):!1,transient:t.transient},remote:{authority:this._environmentService.remoteAuthority,connectionData:null,isRemote:!1},consoleForward:{includeStack:!this._isExtensionDevTestFromCli&&(this._isExtensionDevHost||!this._environmentService.isBuilt||this._productService.quality!=="stable"||this._environmentService.verbose),logNative:!this._isExtensionDevTestFromCli&&this._isExtensionDevHost},extensions:this.extensions.toSnapshot(),telemetryInfo:{sessionId:this._telemetryService.sessionId,machineId:this._telemetryService.machineId,sqmId:this._telemetryService.sqmId,devDeviceId:this._telemetryService.devDeviceId??this._telemetryService.machineId,firstSessionDate:this._telemetryService.firstSessionDate,msftInternal:this._telemetryService.msftInternal},remoteExtensionTips:this._productService.remoteExtensionTips,virtualWorkspaceExtensionTips:this._productService.virtualWorkspaceExtensionTips,logLevel:this._logService.getLevel(),loggers:[...this._loggerService.getRegisteredLoggers()],logsLocation:this._environmentService.extHostLogsPath,autoStart:this.startup===1,uiKind:1,handle:this._environmentService.window.handle?Yd(this._environmentService.window.handle):void 0}}_onExtHostProcessExit(e,t){this._terminating||this._onExit.fire([e,t])}_handleProcessOutputStream(e){let t="",o=!1,n=new E;return e(r=>{t+=r;let s=t.split(/\r?\n/g);t=s.pop(),t.length>1e4&&(s.push(t),t="");for(let l of s)o?l==="END_NATIVE_LOG"&&(o=!1):l==="START_NATIVE_LOG"?o=!0:l.length&&n.fire(l+`
`)},void 0,this._store),n}async enableInspectPort(){return this._inspectListener?!0:!this._extensionHostProcess||!await this._extensionHostProcess.enableInspectPort()?!1:(await Promise.race([U.toPromise(this._onDidSetInspectPort.event),Li(1e3)]),!!this._inspectListener)}getInspectPort(){return this._inspectListener??void 0}_onWillShutdown(e){this._mainProcessHandlesExtHostShutdown=!0,this._isExtensionDevHost&&!this._isExtensionDevTestFromCli&&!this._isExtensionDevDebug&&this._environmentService.debugExtensionHost.debugId&&(this._extensionHostDebugService.terminateSession(this._environmentService.debugExtensionHost.debugId),e.join(Li(100),{id:"join.extensionDevelopment",label:d(17763,null)}))}};HGe=I([m(3,Pe),m(4,Ne),m(5,ko),m(6,ji),m(7,zr),m(8,an),m(9,Te),m(10,se),m(11,Il),m(12,rt),m(13,ZD),m(14,Zt),m(15,tt),m(16,uSe),m(17,z7t),m(18,zD)],HGe);var tmt=class extends vse{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,P,O){let V=e.createInstance(WGe),H=e.createInstance(BGe),G=new imt(V,H,()=>this._getExtensionRegistrySnapshotWhenReady(),e,o,r,p,f,S,g);super({hasLocalProcess:!0,allowRemoteExtensionsInLocalWebWorker:!1},V,G,new fSe(o,p,g),e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,O);this._nativeHostService=y;this._hostService=w;this._remoteExplorerService=k;this._extensionGalleryService=T;this._workspaceTrustManagementService=P;this._localCrashTracker=new Zpt;this._extensionScanner=H,b.when(2).then(()=>{rf(ut,()=>{this._initializeIfNeeded()},50)})}async _scanAllLocalExtensions(){return this._extensionScanner.scannedExtensions}_onExtensionHostCrashed(e,t,o){let n=[],r=this.getExtensionsStatus();for(let s of Object.keys(r)){let l=r[s];l.activationStarted&&e.containsExtension(l.id)&&n.push(l.id)}if(super._onExtensionHostCrashed(e,t,o),e.kind===1){if(t===55){this._notificationService.prompt(ft.Error,d(17770,null),[{label:d(17775,null),run:()=>{this._instantiationService.invokeFunction(s=>{s.get(Zt).restart()})}}]);return}if(this._logExtensionHostCrash(e),this._sendExtensionHostCrashTelemetry(t,o,n),this._localCrashTracker.registerCrash(),this._localCrashTracker.shouldAutomaticallyRestart())this._logService.info("Automatically restarting the extension host."),this._notificationService.status(d(17768,null),{hideAfter:5e3}),this.startExtensionHosts();else{let s=[];this._environmentService.isBuilt?s.push({label:d(17780,null),run:()=>{this._instantiationService.invokeFunction(l=>{l.get(ge).executeCommand("extension.bisect.start")})}}):s.push({label:d(17765,null),run:()=>this._nativeHostService.openDevTools()}),s.push({label:d(17777,null),run:()=>this.startExtensionHosts()}),this._environmentService.isBuilt&&s.push({label:d(17774,null),run:()=>{this._instantiationService.invokeFunction(l=>{l.get(Je).open("https://aka.ms/vscode-extension-bisect")})}}),this._notificationService.prompt(ft.Error,d(17769,null),s)}}}_sendExtensionHostCrashTelemetry(e,t,o){this._telemetryService.publicLog2("extensionHostCrash",{code:e,signal:t,extensionIds:o.map(n=>n.value)});for(let n of o)this._telemetryService.publicLog2("extensionHostCrashExtension",{code:e,signal:t,extensionId:n.value})}async _resolveAuthority(e){if(e.indexOf("+")===-1){let{host:o,port:n}=Z7i(e);return{authority:{authority:e,connectTo:{type:0,host:o,port:n},connectionToken:void 0}}}return this._resolveAuthorityOnExtensionHosts(1,e)}async _getCanonicalURI(e,t){if(e.indexOf("+")===-1)return t;let n=this._getExtensionHostManagers(1);if(n.length===0)throw new Error("Cannot resolve canonical URI");let r=await Promise.all(n.map(s=>s.getCanonicalURI(e,t)));for(let s of r)if(s)return s;throw new Error(`Cannot get canonical URI because no extension is installed to resolve ${bK(e)}`)}_resolveExtensions(){return new fp(e=>this._doResolveExtensions(e))}async _doResolveExtensions(e){this._extensionScanner.startScanningExtensions();let t=this._environmentService.remoteAuthority,o=null,n=[];if(t){this._remoteAuthorityResolverService._setCanonicalURIProvider(async p=>{if(p.scheme!==Q.vscodeRemote||p.authority!==t)return p;Mo(`code/willGetCanonicalURI/${bK(t)}`),ef&&this._logService.info(`Invoking getCanonicalURI for authority ${bK(t)}...`);try{return this._getCanonicalURI(t,p)}finally{Mo(`code/didGetCanonicalURI/${bK(t)}`),ef&&this._logService.info(`getCanonicalURI returned for authority ${bK(t)}.`)}}),ef&&this._logService.info("Starting to wait on IWorkspaceTrustManagementService.workspaceResolved..."),await this._workspaceTrustManagementService.workspaceResolved,ef&&this._logService.info("Finished waiting on IWorkspaceTrustManagementService.workspaceResolved.");let s=(await this._scanAllLocalExtensions()).filter(p=>LAo(p));s.length&&e.emitOne(new Ypt(s));let l;try{l=await this._resolveAuthorityInitial(t)}catch(p){return Ew.isNoResolverFound(p)?p.isHandled=await this._handleNoResolverFound(t):Ew.isHandled(p)&&console.log("Error handled: Not showing a notification for the error"),this._remoteAuthorityResolverService._setResolvedAuthorityError(t,p),this._startLocalExtensionHost(e)}this._remoteAuthorityResolverService._setResolvedAuthority(l.authority,l.options),this._remoteExplorerService.setTunnelInformation(l.tunnelInformation);let c=this._remoteAgentService.getConnection();if(c&&(this._register(c.onDidStateChange(async p=>{p.type===0&&this._remoteAuthorityResolverService._clearResolvedAuthority(t)})),this._register(c.onReconnecting(()=>this._resolveAuthorityAgain()))),[o,n]=await Promise.all([this._remoteAgentService.getEnvironment(),this._remoteExtensionsScannerService.scanExtensions()]),!o)return this._notificationService.notify({severity:ft.Error,message:d(17771,null)}),this._startLocalExtensionHost(e);let u=o.useHostProxy;this._register(this._configurationService.onDidChangeConfiguration(p=>{p.affectsConfiguration("http.useLocalProxyConfiguration")&&nhi(this._configurationService.getValue("http.useLocalProxyConfiguration"),u)})),nhi(this._configurationService.getValue("http.useLocalProxyConfiguration"),u)}else this._remoteAuthorityResolverService._setCanonicalURIProvider(async r=>r);return this._startLocalExtensionHost(e,n)}async _startLocalExtensionHost(e,t=[]){await this._workspaceTrustManagementService.workspaceTrustInitialized,t.length&&e.emitOne(new Jpt(t)),e.emitOne(new Xpt(await this._scanAllLocalExtensions()))}async _onExtensionHostExit(e){await this._doStopExtensionHosts(),this._remoteAgentService.getConnection()?.dispose(),KF(this._environmentService).isExtensionDevTestFromCli?(ef&&this._logService.info(`Asking native host service to exit with code ${e}.`),this._nativeHostService.exit(e)):this._nativeHostService.closeWindow()}async _handleNoResolverFound(e){let t=gb(e),o=this._productService.remoteExtensionTips?.[t];if(!o)return!1;let n=o.extensionId,s=(await this._scanAllLocalExtensions()).filter(l=>l.identifier.value===n)[0];if(s){if(!MAo(this._logService,this._extensionEnablementService,s,!1)){let l=d(17767,null,o.friendlyName);this._notificationService.prompt(ft.Info,l,[{label:d(17766,null),run:async()=>{await this._extensionEnablementService.setEnablement([ZE(s)],12),await this._hostService.reload()}}],{sticky:!0,priority:3})}}else{let l=d(17773,null,o.friendlyName);this._notificationService.prompt(ft.Info,l,[{label:d(17772,null),run:async()=>{let[c]=await this._extensionGalleryService.getExtensions([{id:n}],Se.None);c?(await this._extensionManagementService.installFromGallery(c),await this._hostService.reload()):this._notificationService.error(d(17776,null))}}],{sticky:!0,priority:3})}return!0}};tmt=I([m(0,F),m(1,Ne),m(2,At),m(3,Te),m(4,Js),m(5,fe),m(6,tt),m(7,ru),m(8,Pe),m(9,B),m(10,Gp),m(11,se),m(12,bo),m(13,tG),m(14,ji),m(15,Uc),m(16,ko),m(17,Zt),m(18,du),m(19,fa),m(20,Nr),m(21,at)],tmt);var imt=class{constructor(i,e,t,o,n,r,s,l,c,u){this._extensionsProposedApi=i;this._extensionScanner=e;this._getExtensionRegistrySnapshotWhenReady=t;this._instantiationService=o;this._extensionEnablementService=r;this._remoteAgentService=l;this._remoteAuthorityResolverService=c;this._logService=u;this._webWorkerExtHostEnablement=NAo(n,s)}createExtensionHost(i,e,t){switch(e.kind){case 1:{let o=t?2:1;return this._instantiationService.createInstance(HGe,e,o,this._createLocalProcessExtensionHostDataProvider(i,t,e))}case 2:{if(this._webWorkerExtHostEnablement!==0){let o=this._webWorkerExtHostEnablement===2?3:2;return this._instantiationService.createInstance(AGe,e,o,this._createWebWorkerExtensionHostDataProvider(i,e))}return null}case 3:{let o=this._remoteAgentService.getConnection();return o?this._instantiationService.createInstance(VGe,e,this._createRemoteExtensionHostDataProvider(i,o.remoteAuthority)):null}}}_createLocalProcessExtensionHostDataProvider(i,e,t){return{getInitData:async()=>{if(e){let o=await this._extensionScanner.scannedExtensions;ef&&this._logService.info(`NativeExtensionHostFactory._createLocalProcessExtensionHostDataProvider.scannedExtensions: ${o.map(c=>c.identifier.value).join(",")}`);let n=Qpt(this._logService,this._extensionEnablementService,this._extensionsProposedApi,o,!0);ef&&this._logService.info(`NativeExtensionHostFactory._createLocalProcessExtensionHostDataProvider.localExtensions: ${n.map(c=>c.identifier.value).join(",")}`);let r=i.computeRunningLocation(n,[],!1),s=jpt(n,r,c=>t.equals(c)),l=new Ede(0,n,s.map(c=>c.identifier));return ef&&this._logService.info(`NativeExtensionHostFactory._createLocalProcessExtensionHostDataProvider.myExtensions: ${s.map(c=>c.identifier.value).join(",")}`),{extensions:l}}else{let o=await this._getExtensionRegistrySnapshotWhenReady(),n=i.filterByRunningLocation(o.extensions,t);return{extensions:new Ede(o.versionId,o.extensions,n.map(s=>s.identifier))}}}}}_createWebWorkerExtensionHostDataProvider(i,e){return{getInitData:async()=>{let t=await this._getExtensionRegistrySnapshotWhenReady(),o=i.filterByRunningLocation(t.extensions,e);return{extensions:new Ede(t.versionId,t.extensions,o.map(r=>r.identifier))}}}}_createRemoteExtensionHostDataProvider(i,e){return{remoteAuthority:e,getInitData:async()=>{let t=await this._getExtensionRegistrySnapshotWhenReady(),o=await this._remoteAgentService.getEnvironment();if(!o)throw new Error("Cannot provide init data for remote extension host!");let n=i.filterByExtensionHostKind(t.extensions,3),r=new Ede(t.versionId,t.extensions,n.map(s=>s.identifier));return{connectionData:this._remoteAuthorityResolverService.getConnectionData(e),pid:o.pid,appRoot:o.appRoot,extensionHostLogsPath:o.extensionHostLogsPath,globalStorageHome:o.globalStorageHome,workspaceStorageHome:o.workspaceStorageHome,extensions:r}}}}};imt=I([m(3,F),m(4,At),m(5,Js),m(6,B),m(7,bo),m(8,Uc),m(9,se)],imt);function NAo(a,i){if(a.isExtensionDevelopment&&a.extensionDevelopmentKind?.some(e=>e==="web"))return 1;{let e=i.getValue(VTt);return e===!0?1:e==="auto"?2:0}}var fSe=class{constructor(i,e,t){this._logService=t;this._hasRemoteExtHost=!!i.remoteAuthority;let o=NAo(i,e);this._hasWebWorkerExtHost=o!==0}pickExtensionHostKind(i,e,t,o,n){let r=fSe.pickExtensionHostKind(e,t,o,n,this._hasRemoteExtHost,this._hasWebWorkerExtHost);return this._logService.trace(`pickRunningLocation for ${i.value}, extension kinds: [${e.join(", ")}], isInstalledLocally: ${t}, isInstalledRemotely: ${o}, preference: ${foo(n)} => ${bA(r)}`),r}static pickExtensionHostKind(i,e,t,o,n,r){let s=[];for(let l of i){if(l==="ui"&&e){if(o===0||o===1)return 1;s.push(1)}if(l==="workspace"&&t){if(o===0||o===2)return 3;s.push(3)}if(l==="workspace"&&!n){if(o===0||o===1)return 1;s.push(1)}if(l==="web"&&e&&r){if(o===0||o===1)return 2;s.push(2)}}return s.length>0?s[0]:null}};fSe=I([m(0,At),m(1,B),m(2,se)],fSe);var Pzi=class extends K{constructor(){super({id:"workbench.action.restartExtensionHost",title:L(17778,"Restart Extension Host"),category:Ve.Developer,f1:!0})}async run(i){let e=i.get(lt);await e.stopExtensionHosts(d(17779,null))&&e.startExtensionHosts()}};W(Pzi);Ee(lt,tmt,0);var omt=class extends rBt{constructor(i,e,t,o){super(!1,i,e,t,o)}};omt=I([m(0,pu),m(1,an),m(2,ce),m(3,se)],omt);Ee(W0,omt,1);var vSe=class extends Xpe{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,t,o,n,l,c,p,h);this.nativeHostService=r;this.instantiationService=s;this.dialogService=u;this.skipUnloadConfirmation=!1;this.maximized=!1;this.alwaysOnTop=!1;Ze||this.handleMaximizedState(),this.handleFullScreenState(),this.handleAlwaysOnTopState()}handleMaximizedState(){(async()=>this.maximized=await this.nativeHostService.isMaximized({targetWindowId:this.window.vscodeWindowId}))(),this._register(this.nativeHostService.onDidMaximizeWindow(e=>{e===this.window.vscodeWindowId&&(this.maximized=!0)})),this._register(this.nativeHostService.onDidUnmaximizeWindow(e=>{e===this.window.vscodeWindowId&&(this.maximized=!1)}))}handleAlwaysOnTopState(){(async()=>this.alwaysOnTop=await this.nativeHostService.isWindowAlwaysOnTop({targetWindowId:this.window.vscodeWindowId}))(),this._register(this.nativeHostService.onDidChangeWindowAlwaysOnTop(({windowId:e,alwaysOnTop:t})=>{e===this.window.vscodeWindowId&&(this.alwaysOnTop=t)}))}async handleFullScreenState(){await this.nativeHostService.isFullScreen({targetWindowId:this.window.vscodeWindowId})&&L$(!0,this.window)}async handleVetoBeforeClose(e,t){this.preventUnload(e),await this.dialogService.error(t,d(17401,null))}async confirmBeforeClose(e){if(this.skipUnloadConfirmation)return;this.preventUnload(e),await this.instantiationService.invokeFunction(o=>vSe.confirmOnShutdown(o,1))&&(this.skipUnloadConfirmation=!0,this.nativeHostService.closeWindow({targetWindowId:this.window.vscodeWindowId}))}preventUnload(e){e.preventDefault(),e.returnValue=!0}createState(){let e=super.createState(),t=hC(this.window);return{...e,bounds:e.bounds,mode:this.maximized?0:t?2:1,alwaysOnTop:this.alwaysOnTop}}};vSe=I([m(3,B),m(4,ko),m(5,F),m(6,Zt),m(7,At),m(8,at),m(9,Xe),m(10,yi)],vSe);var nmt=class extends P3{constructor(e,t,o,n,r,s,l,c,u){super(e,n,t,s,l,c,u);this.nativeHostService=o;this.instantiationService=r}async resolveWindowId(e){Mo("code/auxiliaryWindow/willResolveWindowId");let t=await e.vscode.ipcRenderer.invoke("vscode:registerAuxiliaryWindow",this.nativeHostService.windowId);return Mo("code/auxiliaryWindow/didResolveWindowId"),qy(typeof t=="number"),t}createContainer(e,t,o){let n;return typeof o?.zoomLevel=="number"?n=o.zoomLevel:n=mC(Ki()),t$(n,e),super.createContainer(e,t)}createAuxiliaryWindow(e,t,o){return new vSe(e,t,o,this.configurationService,this.nativeHostService,this.instantiationService,this.hostService,this.environmentService,this.dialogService,this.contextMenuService,this.layoutService)}};nmt=I([m(0,yi),m(1,B),m(2,ko),m(3,at),m(4,F),m(5,Te),m(6,Zt),m(7,At),m(8,Xe)],nmt);Ee(OD,nmt,1);var rmt=class extends gGe{constructor(i,e,t,o,n){super(A.file(i.extensionsPath),e,t,o,n)}};rmt=I([m(0,oy),m(1,fe),m(2,an),m(3,ht),m(4,se)],rmt);Ee(pse,rmt,1);Uy(h8t,"sandboxHelper");Uy(VAe,"webContentExtractor");Jv(DG,"sharedWebContentExtractor");var smt=class extends x{constructor(e,t){super();this._logService=e;this.clientId=xt();this._clientEventually=new Ko;this._onAgentHostExit=this._register(new E);this.onAgentHostExit=this._onAgentHostExit.event;this._onAgentHostStart=this._register(new E);this.onAgentHostStart=this._onAgentHostStart.event;this._onDidAction=this._register(new E);this.onDidAction=this._onDidAction.event;this._onDidNotification=this._register(new E);this.onDidNotification=this._onDidNotification.event;this._proxy=Tc.toService(n2(this._clientEventually.p.then(o=>o.getChannel("agentHost")))),t.getValue(YFe)&&this._connect()}async _connect(){this._logService.info("[AgentHost:renderer] Acquiring MessagePort to agent host...");let e=await JU("vscode:createAgentHostMessageChannel","vscode:createAgentHostMessageChannelResult");this._logService.info("[AgentHost:renderer] MessagePort acquired, creating client...");let t=this._register(new N),o=t.add(new i$(e,"agentHost:window"));this._clientEventually.complete(o),t.add(this._proxy.onDidAction(n=>{this._onDidAction.fire($n(n))})),t.add(this._proxy.onDidNotification(n=>{this._onDidNotification.fire($n(n))})),this._logService.info("[AgentHost:renderer] Direct MessagePort connection established"),this._onAgentHostStart.fire()}getResourceMetadata(){return this._proxy.getResourceMetadata()}authenticate(e){return this._proxy.authenticate(e)}listAgents(){return this._proxy.listAgents()}refreshModels(){return this._proxy.refreshModels()}listSessions(){return this._proxy.listSessions()}createSession(e){return this._proxy.createSession(e)}disposeSession(e){return this._proxy.disposeSession(e)}shutdown(){return this._proxy.shutdown()}subscribe(e){return this._proxy.subscribe(e)}unsubscribe(e){this._proxy.unsubscribe(e)}dispatchAction(e,t,o){this._proxy.dispatchAction(e,t,o)}browseDirectory(e){return this._proxy.browseDirectory(e)}fetchContent(e){return this._proxy.fetchContent(e)}writeFile(e){return this._proxy.writeFile(e)}async restartAgentHost(){}};smt=I([m(0,se),m(1,B)],smt);Ee(h2t,smt,1);var amt=class{constructor(i,e){return i.call("__initialize",ut.vscodeWindowId).catch(t=>{e.error("Failed to initialize Playwright service",t)}),Tc.toService(i)}};amt=I([m(1,se)],amt);Jv(Tf,"playwright",{channelClientCtor:amt});var bse=le("processService");Uy(bse,"process");var lmt=class extends x{constructor(e){super();this.nativeHostService=e;this.onDidSuspend=e.onDidSuspendOS,this.onDidResume=U.map(e.onDidResumeOS,()=>{}),this.onDidChangeOnBatteryPower=e.onDidChangeOnBatteryPower,this.onDidChangeThermalState=e.onDidChangeThermalState,this.onDidChangeSpeedLimit=e.onDidChangeSpeedLimit,this.onWillShutdown=e.onWillShutdownOS,this.onDidLockScreen=e.onDidLockScreen,this.onDidUnlockScreen=e.onDidUnlockScreen}async getSystemIdleState(e){return this.nativeHostService.getSystemIdleState(e)}async getSystemIdleTime(){return this.nativeHostService.getSystemIdleTime()}async getCurrentThermalState(){return this.nativeHostService.getCurrentThermalState()}async isOnBatteryPower(){return this.nativeHostService.isOnBatteryPower()}async startPowerSaveBlocker(e){return this.nativeHostService.startPowerSaveBlocker(e)}async stopPowerSaveBlocker(e){return this.nativeHostService.stopPowerSaveBlocker(e)}async isPowerSaveBlockerStarted(e){return this.nativeHostService.isPowerSaveBlockerStarted(e)}};lmt=I([m(0,ko)],lmt);Ee(XPt,lmt,1);var a$=class extends it{constructor(e,t,o,n){super(e,t);this.environmentService=o;this.nativeHostService=n}static{this.ID="workbench.action.openLogsFolder"}static{this.TITLE=L(11563,"Open Logs Folder")}run(){return this.nativeHostService.showItemInFolder(Ge(this.environmentService.logsHome,"main.log").with({scheme:Q.file}).fsPath)}};a$=I([m(2,zr),m(3,ko)],a$);var l$=class extends it{constructor(e,t,o,n,r){super(e,t);this.environmentSerice=o;this.fileService=n;this.nativeHostService=r}static{this.ID="workbench.action.openExtensionLogsFolder"}static{this.TITLE=L(11562,"Open Extension Logs Folder")}async run(){let e=await this.fileService.resolve(this.environmentSerice.extHostLogsPath);if(e.children&&e.children[0])return this.nativeHostService.showItemInFolder(e.children[0].resource.with({scheme:Q.file}).fsPath)}};l$=I([m(2,zr),m(3,fe),m(4,ko)],l$);W(class extends K{constructor(){super({id:a$.ID,title:a$.TITLE,category:Ve.Developer,f1:!0})}run(a){return a.get(F).createInstance(a$,a$.ID,a$.TITLE.value).run()}});W(class extends K{constructor(){super({id:l$.ID,title:l$.TITLE,category:Ve.Developer,f1:!0})}run(a){return a.get(F).createInstance(l$,l$.ID,l$.TITLE.value).run()}});var nYt={showLanguagePackExtensions:d(11545,null),searchMarketplace:d(11544,null),installAndRestartMessage:d(11543,null),installAndRestart:d(11542,null)};var rYt=class a extends K{static{this.ID="workbench.action.configureLocale"}constructor(){super({id:a.ID,title:L(11535,"Configure Display Language"),menu:{id:D.CommandPalette},metadata:{description:L(11536,"Changes the locale of VS Code based on installed language packs. Common languages include French, Chinese, Spanish, Japanese, German, Korean, and more.")}})}async run(i){let e=i.get(Q5),t=i.get(Ue),o=i.get(DH),n=i.get(Hi),r=await e.getInstalledLanguages(),s=new N,l=s.add(t.createQuickPick({useSeparators:!0}));if(l.matchOnDescription=!0,l.placeholder=d(11533,null),r?.length){let u=[{type:"separator",label:d(11537,null)}];l.items=u.concat(this.withMoreInfoButton(r))}s.add(l.onDidHide(()=>{s.dispose()}));let c=new Set(r?.map(u=>u.id)??[]);e.getAvailableLanguages().then(u=>{let p=u.filter(h=>h.id&&!c.has(h.id));p.length&&(l.items=[...l.items,{type:"separator",label:d(11532,null)},...this.withMoreInfoButton(p)]),l.busy=!1}),s.add(l.onDidAccept(async()=>{let u=l.activeItems[0];u&&(l.hide(),await o.setLocale(u))})),s.add(l.onDidTriggerItemButton(async u=>{l.hide(),u.item.extensionId&&await n.open(u.item.extensionId)})),l.show(),l.busy=!0}withMoreInfoButton(i){for(let e of i)e.extensionId&&(e.buttons=[{tooltip:d(11538,null),iconClass:"codicon-info"}]);return i}},sYt=class a extends K{static{this.ID="workbench.action.clearLocalePreference"}static{this.LABEL=L(11534,"Clear Display Language Preference")}constructor(){super({id:a.ID,title:a.LABEL,menu:{id:D.CommandPalette}})}async run(i){await i.get(DH).clearLocalePreference()}};var aYt=class extends x{constructor(){super(),W(rYt),W(sYt),Rn.registerExtensionPoint({extensionPoint:"localizations",defaultExtensionKind:["ui","workspace"],jsonSchema:{description:d(11524,null),type:"array",default:[],items:{type:"object",required:["languageId","translations"],defaultSnippets:[{body:{languageId:"",languageName:"",localizedLanguageName:"",translations:[{id:"vscode",path:""}]}}],properties:{languageId:{description:d(11525,null),type:"string"},languageName:{description:d(11526,null),type:"string"},localizedLanguageName:{description:d(11527,null),type:"string"},translations:{description:d(11528,null),type:"array",default:[{id:"vscode",path:""}],items:{type:"object",required:["id","path"],properties:{id:{type:"string",description:d(11529,null),pattern:"^((vscode)|([a-z0-9A-Z][a-z0-9A-Z-]*)\\.([a-z0-9A-Z][a-z0-9A-Z-]*))$",patternErrorMessage:d(11530,null)},path:{type:"string",description:d(11531,null)}},defaultSnippets:[{body:{id:"",path:""}}]}}}}}})}},Azi=class extends x{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.localizations}render(e){let t=e.contributes?.localizations||[];if(!t.length)return{data:{headers:[],rows:[]},dispose:()=>{}};let o=[d(11520,null),d(11522,null),d(11523,null)],n=t.sort((r,s)=>r.languageId.localeCompare(s.languageId)).map(r=>[r.languageId,r.languageName??"",r.localizedLanguageName??""]);return{data:{headers:o,rows:n},dispose:()=>{}}}};ne.as(As.ExtensionFeaturesRegistry).registerExtensionFeature({id:"localizations",label:d(11521,null),access:{canToggle:!1},renderer:new Ft(Azi)});var Sse=class extends aYt{constructor(e,t,o,n,r,s,l,c){super();this.notificationService=e;this.localeService=t;this.productService=o;this.storageService=n;this.extensionManagementService=r;this.galleryService=s;this.extensionsWorkbenchService=l;this.telemetryService=c;this.checkAndInstall(),this._register(this.extensionManagementService.onDidInstallExtensions(u=>this.onDidInstallExtensions(u))),this._register(this.extensionManagementService.onDidUninstallExtension(u=>this.onDidUninstallExtension(u)))}static{this.LANGUAGEPACK_SUGGESTION_IGNORE_STORAGE_KEY="extensionsAssistant/languagePackSuggestionIgnore"}async onDidInstallExtensions(e){for(let t of e)t.operation===2&&t.local&&await this.onDidInstallExtension(t.local,!!t.context?.extensionsSync)}async onDidInstallExtension(e,t){let o=e.manifest.contributes?.localizations?.[0];if(!o||wr===o.languageId)return;let{languageId:n,languageName:r}=o;this.notificationService.prompt(bt.Info,d(11541,null,this.productService.nameLong,r||n),[{label:d(11539,null),run:async()=>{await this.localeService.setLocale({id:n,label:r??n,extensionId:e.identifier.id},!0)}}],{sticky:!0,priority:3,neverShowAgain:{id:"langugage.update.donotask",isSecondary:!0,scope:2}})}async onDidUninstallExtension(e){await this.isLocaleInstalled(wr)||this.localeService.setLocale({id:"en",label:"English"})}async checkAndInstall(){let e=wr,t=GSe??"",o=JSON.parse(this.storageService.get(Sse.LANGUAGEPACK_SUGGESTION_IGNORE_STORAGE_KEY,-1,"[]"));if(!this.galleryService.isEnabled()||!e||!t||US.isDefaultVariant()||t.startsWith(e)||o.includes(t)||await this.isLocaleInstalled(t))return;let r=t,s=await this.galleryService.query({text:`tag:lp-${t}`},Se.None);if(s.total===0&&(t=t.split("-")[0],s=await this.galleryService.query({text:`tag:lp-${t}`},Se.None),s.total===0))return;let l=s.total===1?s.firstPage[0]:s.firstPage.find(O=>O.publisher==="MS-CEINTL"&&O.name.startsWith("vscode-language-pack")),c=l??s.firstPage[0];if(!c.assets.manifest)return;let[u,p]=await Promise.all([this.galleryService.getManifest(c,Se.None),this.galleryService.getCoreTranslation(c,t)]),h=u?.contributes?.localizations?.find(O=>t.startsWith(O.languageId.toLowerCase())),g=h&&h.languageName||t,f=h&&(h.localizedLanguageName||h.languageName)||t,v=p?.contents?.["vs/workbench/contrib/localization/electron-browser/minimalTranslations"]??{},b=l?"installAndRestartMessage":"showLanguagePackExtensions",S=!v[b],y={};Object.keys(nYt).forEach(O=>{!v[O]||S?y[O]=nYt[O].replace("{0}",()=>g):y[O]=`${v[O].replace("{0}",()=>f)} (${nYt[O].replace("{0}",()=>g)})`});let w=O=>{this.telemetryService.publicLog("languagePackSuggestion:popup",{userReaction:O,language:t})},k={label:y.searchMarketplace,run:async()=>{w("search"),await this.extensionsWorkbenchService.openSearch(`tag:lp-${t}`)}},T={label:y.installAndRestart,run:async()=>{w("installAndRestart"),await this.localeService.setLocale({id:t,label:g,extensionId:l?.identifier.id,galleryExtension:l},!0)}},P=y[b];this.notificationService.prompt(bt.Info,P,[l?T:k,{label:d(11540,null),isSecondary:!0,run:()=>{o.push(r),this.storageService.store(Sse.LANGUAGEPACK_SUGGESTION_IGNORE_STORAGE_KEY,JSON.stringify(o),-1,0),w("neverShowAgain")}}],{priority:1,onCancel:()=>{w("cancelled")}})}async isLocaleInstalled(e){return(await this.extensionManagementService.getInstalled()).some(o=>!!o.manifest.contributes?.localizations?.length&&o.manifest.contributes.localizations.some(n=>e.startsWith(n.languageId.toLowerCase())))}};Sse=I([m(0,Ne),m(1,DH),m(2,tt),m(3,ce),m(4,Cs),m(5,fa),m(6,Hi),m(7,Te)],Sse);var Oyn=ne.as(Qi.Workbench);Oyn.registerWorkbenchContribution(Sse,4);function Nzi(a,i,e){if(a.length)Zht(a.map(t=>async()=>{let o=OAo(t);o&&i.showItemInFolder(o.fsPath)}));else if(e.getWorkspace().folders.length){let t=OAo(e.getWorkspace().folders[0].uri);t&&i.showItemInFolder(t.fsPath)}}function OAo(a){switch(a.scheme){case Q.file:case Q.vscodeUserData:return a.with({scheme:Q.file});case Q.vscodeRemote:{if(gb(a.authority)==="wsl"){let e=Yxt(a.authority);if(e)return A.from({scheme:Q.file,authority:"wsl$",path:`/${e}${a.path}`})}return}default:return}}var lYt="revealFileInOS",Ozi=ei?L(11162,"Reveal in File Explorer"):Ze?L(11161,"Reveal in Finder"):L(11160,"Open Containing Folder"),UGe=C.or(Wo.Scheme.isEqualTo(Q.file),Wo.Scheme.isEqualTo(Q.vscodeUserData));Ct.registerCommandAndKeybindingRule({id:lYt,weight:200,when:pe.focus.toNegated(),primary:2608,win:{primary:1584},handler:(a,i)=>{let e=dW(i,a.get(Io),a.get(ee),a.get(wt),a.get(Oa));Nzi(e,a.get(ko),a.get(Pe))}});var Fyn="workbench.action.files.revealActiveFileInWindows";Ct.registerCommandAndKeybindingRule({weight:200,when:void 0,primary:Vi(2089,48),id:Fyn,handler:a=>{let e=a.get(ee).activeEditor,t=po.getOriginalUri(e,{filterByScheme:[Q.file],supportSideBySide:1});Nzi(t?[t]:[],a.get(ko),a.get(Pe))}});dot(lYt,Ozi.value,UGe,"2_files",!1,0);var cYt={id:lYt,title:Ozi.value};ve.appendMenuItem(D.OpenEditorsContext,{group:"navigation",order:20,command:cYt,when:UGe});ve.appendMenuItem(D.OpenEditorsContextShare,{title:d(11159,null),submenu:D.MenubarShare,group:"share",order:3});ve.appendMenuItem(D.ExplorerContext,{group:"navigation",order:20,command:cYt,when:UGe});var Wyn=L(11158,"File");TM({id:lYt,title:Ozi,category:Wyn},UGe);ve.appendMenuItem(D.ChatAttachmentsContext,{group:"navigation",order:20,command:cYt,when:UGe});ve.appendMenuItem(D.ChatInlineResourceAnchorContext,{group:"navigation",order:20,command:cYt,when:UGe});var cmt=class extends x{constructor(e){super();this._delayer=this._register(new ya(2e3));this._register(e.onDidChangeDisplay(()=>{this._delayer.trigger(()=>(iw.clearAllFontInfos(),Promise.resolve()))}))}};cmt=I([m(0,ko)],cmt);ne.as(Qi.Workbench).registerWorkbenchContribution(cmt,4);if(Ze){let a=function(i){return()=>{Ki().document.execCommand(i)}};Ct.registerCommandAndKeybindingRule({id:"execCut",primary:2102,handler:a("cut"),weight:0,when:void 0}),Ct.registerCommandAndKeybindingRule({id:"execCopy",primary:2081,handler:a("copy"),weight:0,when:void 0}),Ct.registerCommandAndKeybindingRule({id:"execPaste",primary:2100,handler:a("paste"),weight:0,when:void 0})}var bSe=class extends x{static{this.SELECTION_LENGTH_LIMIT=65536}constructor(i,e){if(super(),fn){let t=i.getOption(121);this._register(i.onDidChangeConfiguration(n=>{n.hasChanged(121)&&(t=i.getOption(121))}));let o=this._register(new Dt(()=>{if(!i.hasModel())return;let n=i.getModel(),r=i.getSelections();r=r.slice(0),r.sort(z.compareRangesUsingStarts);let s=0;for(let u of r){if(u.isEmpty())return;s+=n.getValueLengthInRange(u)}if(s>bSe.SELECTION_LENGTH_LIMIT)return;let l=[];for(let u of r)l.push(n.getValueInRange(u,0));let c=l.join(n.getEOL());e.writeText(c,"selection")},100));this._register(i.onDidChangeCursorSelection(n=>{t&&n.source!=="restoreState"&&o.schedule()}))}}dispose(){super.dispose()}};bSe=I([m(1,Fi)],bSe);var zGe=class extends x{static{this.ID="workbench.contrib.linuxSelectionClipboardPastePreventer"}constructor(i){super(),this._register(U.runAndSubscribe(nf,({window:e,disposables:t})=>{t.add(j(e.document,"mouseup",o=>{o.button===1&&(i.getValue("editor").selectionClipboard||o.preventDefault())}))},{window:ut,disposables:this._store}))}};zGe=I([m(0,B)],zGe);var Fzi=class extends Di{constructor(){super({id:"editor.action.selectionClipboardPaste",label:L(9048,"Paste Selection Clipboard"),precondition:pe.writable})}async run(i,e,t){let n=await i.get(Fi).readText("selection");e.trigger("keyboard","paste",{text:n,pasteOnNewLine:!1,multicursorText:null})}};xo(xy,bSe,0);fn&&(It(zGe.ID,zGe,St.BlockRestore),ni(Fzi));var dmt=class extends x{constructor(i,e){super(),this._register(e.onDidResumeOS(()=>{i.listCodeEditors().forEach(t=>t.render(!0))}))}};dmt=I([m(0,qt),m(1,ko)],dmt);ne.as(Qi.Workbench).registerWorkbenchContribution(dmt,4);var Wzi=class a extends K{static{this.resource=A.parse("inmemory:///tm-log.txt")}constructor(){super({id:"editor.action.startDebugTextMate",title:L(9049,"Start TextMate Syntax Grammar Logging"),category:Ve.Developer,f1:!0})}_getOrCreateModel(i){let e=i.getModel(a.resource);return e||i.createModel("",null,a.resource)}_append(i,e){let t=i.getLineCount();i.applyEdits([{range:new z(t,1073741824,t,1073741824),text:e}])}async run(i){let e=i.get(Z3),t=i.get(Tt),o=i.get(ee),n=i.get(qt),r=i.get(Zt),s=i.get(zr),l=i.get(Il),c=i.get(fe),u=Ge(s.tmpDir,`vcode-tm-log-${xt()}.txt`);await c.createFile(u);let p=l.createLogger(u,{name:"debug textmate"}),h=this._getOrCreateModel(t),g=b=>{this._append(h,b+`
`),v(),p.info(b),p.flush()};if(await r.openWindow([{fileUri:u}],{forceNewWindow:!0}),!await o.openEditor({resource:h.uri,options:{pinned:!0}}))return;let v=()=>{let b=n.listCodeEditors();for(let S of b)S.hasModel()&&S.getModel().uri.toString()===a.resource.toString()&&S.revealLine(S.getModel().getLineCount())};g("// Open the file you want to test to the side and watch here"),g(`// Output mirrored at ${u}`),e.startDebugMode(b=>{this._append(h,b+`
`),v(),p.info(b),p.flush()},()=>{})}};W(Wzi);var dYt=class extends x{constructor(){super(...arguments);this._onCloseEmitter=this._register(new E);this._onReloadEmitter=this._register(new E);this._onTerminateEmitter=this._register(new E);this._onAttachEmitter=this._register(new E)}static{this.ChannelName="extensionhostdebugservice"}call(e,t,o){switch(t){case"close":return Promise.resolve(this._onCloseEmitter.fire({sessionId:o[0]}));case"reload":return Promise.resolve(this._onReloadEmitter.fire({sessionId:o[0]}));case"terminate":return Promise.resolve(this._onTerminateEmitter.fire({sessionId:o[0]}));case"attach":return Promise.resolve(this._onAttachEmitter.fire({sessionId:o[0],port:o[1],subId:o[2]}))}throw new Error("Method not implemented.")}listen(e,t,o){switch(t){case"close":return this._onCloseEmitter.event;case"reload":return this._onReloadEmitter.event;case"terminate":return this._onTerminateEmitter.event;case"attach":return this._onAttachEmitter.event}throw new Error("Method not implemented.")}},uYt=class extends x{constructor(e){super();this.channel=e}reload(e){this.channel.call("reload",[e])}get onReload(){return this.channel.listen("reload")}close(e){this.channel.call("close",[e])}get onClose(){return this.channel.listen("close")}attachSession(e,t,o){this.channel.call("attach",[e,t,o])}get onAttachSession(){return this.channel.listen("attach")}terminateSession(e,t){this.channel.call("terminate",[e,t])}get onTerminateSession(){return this.channel.listen("terminate")}openExtensionDevelopmentHostWindow(e,t){return this.channel.call("openExtensionDevelopmentHostWindow",[e,t])}attachToCurrentWindowRenderer(e){return this.channel.call("attachToCurrentWindowRenderer",[e])}};Uy(ZD,dYt.ChannelName,{channelClientCtor:uYt});var pYt=class{constructor(i){this.service=i}listen(i,e){throw new Error(`Event not found: ${e}`)}call(i,e,t){if(e==="promptImportantExtensionsInstallNotification")return this.service.promptImportantExtensionsInstallNotification(t[0]);throw new Error(`Call not found: ${e}`)}};function mYt(){return 1025+Math.floor(64510*Math.random())}var p9=class extends it{constructor(e,t){super(p9._id,p9._label,"extension-action report-issue");this.extension=e;this.issueService=t;this.enabled=e.isBuiltin||!!e.repository&&!!e.repository.url}static{this._id="workbench.extensions.action.reportExtensionIssue"}static{this._label=d(10710,null)}async run(){await this.issueService.openReporter({extensionId:this.extension.identifier.value})}};p9=I([m(1,OT)],p9);var hYt=class{static fromExtension(i){let e;if(i.bugs&&typeof i.bugs.url=="string"){let t=A.parse(i.bugs.url),o=/\/([^/]+)\/([^/]+)\/issues\/?$/.exec(i.bugs.url);o&&(e={base:t.with({path:null,fragment:null,query:null}).toString(!0),owner:o[1],repo:o[2]})}if(!e&&i.repository&&typeof i.repository.url=="string"){let t=A.parse(i.repository.url),o=/\/([^/]+)\/([^/]+)(\.git)?$/.exec(i.repository.url);o&&(e={base:t.with({path:null,fragment:null,query:null}).toString(!0),owner:o[1],repo:o[2]})}return e&&e.base.indexOf("github")===-1&&(e=void 0),e}},KGe=class extends it{constructor(e,t,o){super("report.slow",d(10744,null),"extension-action report-issue");this.extension=e;this.profile=t;this._instantiationService=o;this.enabled=!!hYt.fromExtension(e)}async run(){let e=await this._instantiationService.invokeFunction(Vzi,this.extension,this.profile);e&&await e.run()}};KGe=I([m(2,F)],KGe);async function Vzi(a,i,e){let t=hYt.fromExtension(i);if(!t)return;let o=a.get(Ea),n=a.get(F),r=`https://api.github.com/search/issues?q=is:issue+state:open+in:title+repo:${t.owner}/${t.repo}+%22Extension+causes+high+cpu+load%22`,s;try{s=await o.request({url:r,callSite:"extensionsSlowActions.getSlowExtensionAction"},Se.None)}catch{return}let l=await tD(s);if(!l)return;let c=JSON.parse(l);if(!(!c||typeof c.total_count!="number"))return c.total_count===0?n.createInstance(umt,i,t,e):n.createInstance(pmt,i,t,e)}var umt=class extends it{constructor(e,t,o,n,r,s,l,c,u){super("report.slow",d(10743,null));this.extension=e;this.repoInfo=t;this.profile=o;this._dialogService=n;this._openerService=r;this._productService=s;this._nativeHostService=l;this._environmentService=c;this._fileService=u}async run(){let e=LGe.rewriteAbsolutePaths(this.profile.data,"pii_removed"),t=Ge(this._environmentService.tmpDir,`${this.extension.identifier.value}-unresponsive.cpuprofile.txt`);await this._fileService.writeFile(t,qe.fromString(JSON.stringify(e,void 0,4)));let o=await this._nativeHostService.getOSProperties(),n=encodeURIComponent("Extension causes high cpu load"),r=`${o.type} ${o.arch} ${o.release}`,s=`:warning: Make sure to **attach** this file from your *home*-directory:
:warning:\`${t}\`

Find more details here: https://github.com/microsoft/vscode/wiki/Explain-extension-causes-high-cpu-load`,l=encodeURIComponent(`- Issue Type: \`Performance\`
- Extension Name: \`${this.extension.name}\`
- Extension Version: \`${this.extension.version}\`
- OS Version: \`${r}\`
- VS Code version: \`${this._productService.version}\`

${s}`),c=`${this.repoInfo.base}/${this.repoInfo.owner}/${this.repoInfo.repo}/issues/new/?body=${l}&title=${n}`;this._openerService.open(A.parse(c)),this._dialogService.info(d(10742,null),d(10740,null,t.fsPath))}};umt=I([m(3,at),m(4,Je),m(5,tt),m(6,ko),m(7,zr),m(8,fe)],umt);var pmt=class extends it{constructor(e,t,o,n,r,s,l){super("show.slow",d(10745,null));this.extension=e;this.repoInfo=t;this.profile=o;this._dialogService=n;this._openerService=r;this._environmentService=s;this._fileService=l}async run(){let e=LGe.rewriteAbsolutePaths(this.profile.data,"pii_removed"),t=Ge(this._environmentService.tmpDir,`${this.extension.identifier.value}-unresponsive.cpuprofile.txt`);await this._fileService.writeFile(t,qe.fromString(JSON.stringify(e,void 0,4)));let o=`${this.repoInfo.base}/${this.repoInfo.owner}/${this.repoInfo.repo}/issues?utf8=\u2713&q=is%3Aissue+state%3Aopen+%22Extension+causes+high+cpu+load%22`;this._openerService.open(A.parse(o)),this._dialogService.info(d(10742,null),d(10741,null,t.fsPath))}};pmt=I([m(3,at),m(4,Je),m(5,zr),m(6,fe)],pmt);var m9=le("extensionHostProfileService"),GGe=new Y("profileSessionState","none"),mmt=new Y("extensionHostProfileRecorded",!1),Bzi=(o=>(o[o.None=0]="None",o[o.Starting=1]="Starting",o[o.Running=2]="Running",o[o.Stopping=3]="Stopping",o))(Bzi||{}),GN=class extends foe{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super(e,t,o,n,r,s,l,c,u,p,h,g,f,b,S,y);this._extensionHostProfileService=v;this._profileInfo=this._extensionHostProfileService.lastProfile,this._extensionsHostRecorded=mmt.bindTo(n),this._profileSessionState=GGe.bindTo(n),this._register(this._extensionHostProfileService.onDidChangeLastProfile(()=>{this._profileInfo=this._extensionHostProfileService.lastProfile,this._extensionsHostRecorded.set(!!this._profileInfo),this._updateExtensions()})),this._register(this._extensionHostProfileService.onDidChangeState(()=>{let w=this._extensionHostProfileService.state;this._profileSessionState.set(Bzi[w].toLowerCase())}))}_getProfileInfo(){return this._profileInfo}_getUnresponsiveProfile(e){return this._extensionHostProfileService.getUnresponsiveProfile(e)}_createSlowExtensionAction(e){return e.unresponsiveProfile?this._instantiationService.createInstance(KGe,e.description,e.unresponsiveProfile):null}_createReportExtensionIssueAction(e){return e.marketplaceInfo?this._instantiationService.createInstance(p9,e.description):null}};GN=I([m(1,Te),m(2,Le),m(3,X),m(4,Hi),m(5,lt),m(6,Ne),m(7,Xe),m(8,F),m(9,ce),m(10,rt),m(11,At),m(12,Fi),m(13,m9),m(14,cy),m(15,nt),m(16,Kt)],GN);var gYt=class a extends K{static{this.ID="workbench.extensions.action.extensionHostProfile"}static{this.LABEL=d(10746,null)}constructor(){super({id:a.ID,title:{value:a.LABEL,original:"Start Extension Host Profile"},precondition:GGe.isEqualTo("none"),icon:R.circleFilled,menu:[{id:D.EditorTitle,when:C.and(fr.isEqualTo(GN.ID),GGe.notEqualsTo("running")),group:"navigation"},{id:D.ExtensionEditorContextMenu,when:GGe.notEqualsTo("running"),group:"profiling"}]})}run(i){return i.get(m9).startProfiling(),Promise.resolve()}},fYt=class a extends K{static{this.ID="workbench.extensions.action.stopExtensionHostProfile"}static{this.LABEL=d(10750,null)}constructor(){super({id:a.ID,title:{value:a.LABEL,original:"Stop Extension Host Profile"},icon:R.debugStop,menu:[{id:D.EditorTitle,when:C.and(fr.isEqualTo(GN.ID),GGe.isEqualTo("running")),group:"navigation"},{id:D.ExtensionEditorContextMenu,when:GGe.isEqualTo("running"),group:"profiling"}]})}run(i){return i.get(m9).stopProfiling(),Promise.resolve()}},vYt=class a extends K{static{this.LABEL=d(10747,null)}static{this.ID="workbench.extensions.action.openExtensionHostProfile"}constructor(){super({id:a.ID,title:{value:a.LABEL,original:"Open Extension Host Profile"},precondition:mmt,icon:R.graph,menu:[{id:D.EditorTitle,when:C.and(fr.isEqualTo(GN.ID)),group:"navigation"},{id:D.ExtensionEditorContextMenu,when:mmt,group:"profiling"}]})}async run(i){let e=i.get(m9),t=i.get(ge),o=i.get(ee);e.lastProfileSavedTo||await t.executeCommand(hmt.ID),e.lastProfileSavedTo&&await o.openEditor({resource:e.lastProfileSavedTo,options:{revealIfOpened:!0,override:"jsProfileVisualizer.cpuprofile.table"}},In)}},hmt=class a extends K{static{this.LABEL=d(10748,null)}static{this.ID="workbench.extensions.action.saveExtensionHostProfile"}constructor(){super({id:a.ID,title:{value:a.LABEL,original:"Save Extension Host Profile"},precondition:mmt,icon:R.saveAll,menu:[{id:D.EditorTitle,when:C.and(fr.isEqualTo(GN.ID)),group:"navigation"},{id:D.ExtensionEditorContextMenu,when:mmt,group:"profiling"}]})}run(i){let e=i.get(At),t=i.get(m9),o=i.get(fe),n=i.get(rn);return this._asyncRun(e,t,o,n)}async _asyncRun(i,e,t,o){let n=await o.showSaveDialog({title:d(10749,null),availableFileSystems:[Q.file],defaultUri:Ge(await o.defaultFilePath(),`CPU-${new Date().toISOString().replace(/[\-:]/g,"")}.cpuprofile`),filters:[{name:"CPU Profiles",extensions:["cpuprofile","txt"]}]});if(!n)return;let r=e.lastProfile,s=r?r.data:{},l=n.fsPath;i.isBuilt&&(s=LGe.rewriteAbsolutePaths(s,"piiRemoved"),l=l+".txt");let c=A.file(l);return e.lastProfileSavedTo=c,t.writeFile(c,qe.fromString(JSON.stringify(r?r.data:{},null,"	")))}};async function WAo(a,i,e,t){let o=await a.getInspectPorts(1,!1);if(o.length===0){(await e.confirm({message:d(10724,null),detail:d(10725,null,t.nameLong),primaryButton:d(10726,null)})).confirmed&&await i.relaunch({addArgs:[`--inspect-extensions=${mYt()}`]});return}return o.length>1&&console.warn("There are multiple extension hosts available for debugging. Picking the first one..."),o[0].port}async function VAo(a,i){let e=await a.attachToCurrentWindowRenderer(i);return e.success?e.port:void 0}var bYt=class extends K{constructor(){super({id:"workbench.extensions.action.devtoolsExtensionHost",title:L(10723,"Debug Extension Host In Dev Tools"),category:Ve.Developer,f1:!0,icon:R.debugStart})}async run(i){let e=i.get(lt),t=i.get(ko),o=i.get(Ue),n=await e.getInspectPorts(1,!0);if(n.length===0){console.log("[devtoolsExtensionHost] No extension host inspect ports found.");return}let r=n.filter(l=>l.devtoolsUrl).map(l=>({label:l.devtoolsLabel??`${l.host}:${l.port}`,detail:`${l.host}:${l.port}`,portInfo:l}));if(r.length===1){let l=r[0].portInfo;t.openDevToolsWindow(l.devtoolsUrl);return}let s=await o.pick(r,{placeHolder:d(10727,null),matchOnDetail:!0});if(s){let l=s.portInfo;t.openDevToolsWindow(l.devtoolsUrl)}}},SYt=class extends K{constructor(){super({id:"workbench.extensions.action.debugExtensionHost",title:L(10716,"Debug Extension Host In New Window"),category:Ve.Developer,f1:!0,icon:R.debugStart,menu:{id:D.EditorTitle,when:fr.isEqualTo(GN.ID),group:"navigation"}})}async run(i){let e=i.get(lt),t=i.get(ko),o=i.get(at),n=i.get(tt),r=i.get(F),s=i.get(Zt),l=await WAo(e,t,o,n);if(l===void 0)return;r.createInstance(Ise).storeDebugOnNewWindow(l),s.openWindow()}},IYt=class extends K{constructor(){super({id:"workbench.action.debugRenderer",title:L(10720,"Debug Renderer In New Window"),category:Ve.Developer,f1:!0})}async run(i){let e=i.get(ZD),t=i.get(zr),o=i.get(F),n=i.get(Zt),r=await VAo(e,t.window.id);if(r===void 0)return;o.createInstance(Ise).storeRendererDebugOnNewWindow(r),n.openWindow({remoteAuthority:null})}},yYt=class extends K{constructor(){super({id:"workbench.action.debugExtensionHostAndRenderer",title:L(10719,"Debug Extension Host and Renderer In New Window"),category:Ve.Developer,f1:!0})}async run(i){let e=i.get(lt),t=i.get(ko),o=i.get(at),n=i.get(tt),r=i.get(ZD),s=i.get(zr),l=i.get(F),c=i.get(Zt),[u,p]=await Promise.all([WAo(e,t,o,n),VAo(r,s.window.id)]);if(u===void 0||p===void 0)return;let h=l.createInstance(Ise);h.storeDebugOnNewWindow(u),h.storeRendererDebugOnNewWindow(p),c.openWindow({remoteAuthority:null})}},Ise=class{constructor(i){this._storageService=i}storeDebugOnNewWindow(i){this._storageService.store("debugExtensionHost.debugPort",i,-1,1)}getAndDeleteDebugPortIfSet(){let i=this._storageService.getNumber("debugExtensionHost.debugPort",-1);return i!==void 0&&this._storageService.remove("debugExtensionHost.debugPort",-1),i}storeRendererDebugOnNewWindow(i){this._storageService.store("debugRenderer.debugPort",i,-1,1)}getAndDeleteRendererDebugPortIfSet(){let i=this._storageService.getNumber("debugRenderer.debugPort",-1);return i!==void 0&&this._storageService.remove("debugRenderer.debugPort",-1),i}};Ise=I([m(0,ce)],Ise);var FAo={trace:!0,resolveSourceMapLocations:null,eagerSources:!0,timeouts:{sourceMapMinPause:3e4,sourceMapCumulativePause:3e5}},qGe=class extends x{constructor(e,t,o){super();this._debugService=e;this._instantiationService=t;let n=this._instantiationService.createInstance(Ise),r=n.getAndDeleteDebugPortIfSet(),s=n.getAndDeleteRendererDebugPortIfSet(),l=[];r!==void 0&&l.push(o.withProgress({location:15,title:d(10718,null)},async()=>{await this._debugService.startDebugging(void 0,{type:"node",name:d(10717,null),request:"attach",port:r,...FAo})})),s!==void 0&&l.push(o.withProgress({location:15,title:d(10722,null)},async()=>{await this._debugService.startDebugging(void 0,{type:"chrome",name:d(10721,null),request:"attach",port:s,...FAo})})),Promise.all(l)}};qGe=I([m(0,Ni),m(1,F),m(2,Fo)],qGe);var yse=class{constructor(i,e,t,o){this._host=i;this._port=e;this._extensionService=t;this._profilingService=o}async start(){let i=await this._profilingService.startProfiling({host:this._host,port:this._port});return{stop:$c(async()=>{let e=await this._profilingService.stopProfiling(i);await this._extensionService.whenInstalledExtensionsRegistered();let t=this._extensionService.extensions;return this._distill(e,t)})}}_distill(i,e){let t=Sp.forUris();for(let f of e)f.extensionLocation.scheme===Q.file&&t.set(A.file(f.extensionLocation.fsPath),f);let o=i.nodes,n=new Map,r=new Map;for(let f of o)n.set(f.id,f);function s(f,v){if(v){if(v==="self"&&f.callFrame.url){let b;try{b=t.findSubstr(A.parse(f.callFrame.url))}catch{}b&&(v=b.identifier.value)}}else switch(f.callFrame.functionName){case"(root)":break;case"(program)":v="program";break;case"(garbage collector)":v="gc";break;default:v="self";break}if(r.set(f.id,v),f.children)for(let b of f.children){let S=n.get(b);S&&s(S,v)}}s(o[0],null);let l=i.samples||[],c=i.timeDeltas||[],u=[],p=[],h=0,g;for(let f=0;f<l.length;f++){let v=l[f],b=r.get(v);b!==g&&(g&&(p.push(g),u.push(h)),g=b??void 0,h=0),h+=c[f]}return g&&(p.push(g),u.push(h)),{startTime:i.startTime,endTime:i.endTime,deltas:u,ids:p,data:i,getAggregatedTimes:()=>{let f=new Map;for(let v=0;v<p.length;v++){let b=p[v];f.set(b,(f.get(b)||0)+u[v])}return f}}}};yse=I([m(2,lt),m(3,j7t)],yse);var $Ge=class extends x{constructor(e,t,o,n,r,s,l){super();this._extensionService=e;this._editorService=t;this._instantiationService=o;this._nativeHostService=n;this._dialogService=r;this._statusbarService=s;this._productService=l;this._onDidChangeState=this._register(new E);this.onDidChangeState=this._onDidChangeState.event;this._onDidChangeLastProfile=this._register(new E);this.onDidChangeLastProfile=this._onDidChangeLastProfile.event;this._unresponsiveProfiles=new iu;this._state=0;this.profilingStatusBarIndicatorLabelUpdater=this._register(new me);this._profile=null,this._profileSession=null,this._setState(0),$e.registerCommand("workbench.action.extensionHostProfiler.stop",()=>{this.stopProfiling(),this._editorService.openEditor(DW.instance,{pinned:!0})})}get state(){return this._state}get lastProfile(){return this._profile}_setState(e){this._state!==e&&(this._state=e,this._state===2?this.updateProfilingStatusBarIndicator(!0):this._state===3&&this.updateProfilingStatusBarIndicator(!1),this._onDidChangeState.fire(void 0))}updateProfilingStatusBarIndicator(e){if(this.profilingStatusBarIndicatorLabelUpdater.clear(),e){let t={name:d(10734,null),text:d(10728,null),showProgress:!0,ariaLabel:d(10728,null),tooltip:d(10733,null),command:"workbench.action.extensionHostProfiler.stop"},o=Date.now(),n=zI(ut,()=>{this.profilingStatusBarIndicator?.update({...t,text:d(10729,null,Math.round((new Date().getTime()-o)/1e3))})},1e3);this.profilingStatusBarIndicatorLabelUpdater.value=n,this.profilingStatusBarIndicator?this.profilingStatusBarIndicator.update(t):this.profilingStatusBarIndicator=this._statusbarService.addEntry(t,"status.profiler",1)}else this.profilingStatusBarIndicator&&(this.profilingStatusBarIndicator.dispose(),this.profilingStatusBarIndicator=void 0)}async startProfiling(){if(this._state!==0)return null;let e=await this._extensionService.getInspectPorts(1,!0);return e.length===0?this._dialogService.confirm({type:"info",message:d(10730,null),detail:d(10731,null,this._productService.nameLong),primaryButton:d(10732,null)}).then(t=>{t.confirmed&&this._nativeHostService.relaunch({addArgs:[`--inspect-extensions=${mYt()}`]})}):(e.length>1&&console.warn("There are multiple extension hosts available for profiling. Picking the first one..."),this._setState(1),this._instantiationService.createInstance(yse,e[0].host,e[0].port).start().then(t=>{this._profileSession=t,this._setState(2)},t=>{mt(t),this._setState(0)}))}stopProfiling(){this._state!==2||!this._profileSession||(this._setState(3),this._profileSession.stop().then(e=>{this._setLastProfile(e),this._setState(0)},e=>{mt(e),this._setState(0)}),this._profileSession=null)}_setLastProfile(e){this._profile=e,this.lastProfileSavedTo=void 0,this._onDidChangeLastProfile.fire(void 0)}getUnresponsiveProfile(e){return this._unresponsiveProfiles.get(e)}setUnresponsiveProfile(e,t){this._unresponsiveProfiles.set(e,t),this._setLastProfile(t)}};$Ge=I([m(0,lt),m(1,ee),m(2,F),m(3,ko),m(4,at),m(5,kr),m(6,tt)],$Ge);var wYt=class extends K{constructor(){super({id:"workbench.extensions.action.openExtensionsFolder",title:L(10737,"Open Extensions Folder"),category:Ve.Developer,f1:!0})}async run(i){let e=i.get(ko),t=i.get(fe),o=i.get(zr),n=A.file(o.extensionsPath),r=await t.resolve(n),s;if(r.children&&r.children.length>0?s=r.children[0].resource:s=n,s.scheme===Q.file)return e.showItemInFolder(s.fsPath)}},CYt=class extends K{constructor(){super({id:"_workbench.extensions.action.cleanUpExtensionsFolder",title:L(10736,"Cleanup Extensions Folder"),category:Ve.Developer,f1:!0})}async run(i){return i.get(Cs).cleanUp()}};function BAo(a,i,e,t){let{sample:o,perfBaseline:n,source:r}=a;i.publicLog2("unresponsive.sample",{perfBaseline:n,selfTime:o.selfTime,totalTime:o.totalTime,percentage:o.percentage,functionName:o.location,callers:o.caller.map(l=>l.location).join("<"),callersAnnotated:o.caller.map(l=>`${l.percentage}|${l.location}`).join("<"),source:r});let s=new Hzi(a);t?k9.onUnexpectedError(s):e.error(s)}var Hzi=class extends Error{constructor(i){if(Error.hasOwnProperty("stackTraceLimit")){let t=Error,o=t.stackTraceLimit;t.stackTraceLimit=0,super(`PerfSampleError: by ${i.source} in ${i.sample.location}`),t.stackTraceLimit=o}else super(`PerfSampleError: by ${i.source} in ${i.sample.location}`);this.name="PerfSampleError",this.selfTime=i.sample.selfTime;let e=[i.sample.absLocation,...i.sample.caller.map(t=>t.absLocation)];this.stack=`
	 at ${e.join(`
	 at `)}`}};var fmt=le("IProfileAnalysisWorkerService"),gmt=class{constructor(i,e,t){this._telemetryService=i;this._logService=e;this._webWorkerService=t}async _withWorker(i){let e=this._webWorkerService.createWorkerClient(new Ux({esmModuleLocation:vn.asBrowserUri("vs/platform/profiling/electron-browser/profileAnalysisWorkerMain.js"),label:"CpuProfileAnalysisWorker"}));try{return await i(e.proxy)}finally{e.dispose()}}async analyseBottomUp(i,e,t,o){return this._withWorker(async n=>{let r=await n.$analyseBottomUp(i);if(r.kind===2)for(let s of r.samples)BAo({sample:s,perfBaseline:t,source:e(s.url)},this._telemetryService,this._logService,o);return r.kind})}async analyseByLocation(i,e){return this._withWorker(async t=>await t.$analyseByUrlCategory(i,e))}};gmt=I([m(0,Te),m(1,se),m(2,Zy)],gmt);Ee(fmt,gmt,1);var jGe=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h){this._extensionService=i;this._extensionProfileService=e;this._telemetryService=t;this._logService=o;this._notificationService=n;this._editorService=r;this._instantiationService=s;this._environmentServie=l;this._profileAnalysisService=c;this._configService=u;this._fileService=p;this._blame=new ly;this._perfBaseline=-1;h.perfBaseline.then(g=>{g<0||(this._perfBaseline=g,this._unresponsiveListener=i.onDidChangeResponsiveChange(this._onDidChangeResponsiveChange,this))})}dispose(){this._unresponsiveListener?.dispose(),this._session?.dispose(!0)}async _onDidChangeResponsiveChange(i){if(i.extensionHostKind!==1)return;let e=await i.getInspectListener(!0);if(e){if(i.isResponsive&&this._session)this._session.cancel(),this._logService.info("UNRESPONSIVE extension host: received responsive event and cancelling profiling session");else if(!i.isResponsive&&!this._session){let t=new Ye;this._session=t;let o;try{o=await this._instantiationService.createInstance(yse,e.host,e.port).start()}catch{this._session=void 0;return}this._logService.info("UNRESPONSIVE extension host: starting to profile NOW");try{await Li(5e3,t.token)}catch{}try{this._processCpuProfile(await o.stop())}catch(n){mt(n)}finally{this._session=void 0}}}}async _processCpuProfile(i){if(await this._extensionService.whenInstalledExtensionsRegistered(),this._configService.getValue("application.experimental.rendererProfiling")){let h=Sp.forUris();h.fill(this._extensionService.extensions.map(g=>[g.extensionLocation,g])),await this._profileAnalysisService.analyseBottomUp(i.data,g=>h.findSubstr(A.parse(g))?.identifier.value??"<<not-found>>",this._perfBaseline,!1)}let e=this._extensionService.extensions.filter(h=>h.extensionLocation.scheme===Q.file).map(h=>[h.extensionLocation,Ii.toKey(h.identifier)]),t=await this._profileAnalysisService.analyseByLocation(i.data,e),o=0,n="",r=-1;for(let[h,g]of t)o+=g,g>r&&(r=g,n=h);let s=r/(o/100),l=await this._extensionService.getExtension(n);if(!l)return;let c=xt(),u=Ge(this._environmentServie.tmpDir,`exthost-${Math.random().toString(16).slice(2,8)}.cpuprofile`);if(await this._fileService.writeFile(u,qe.fromString(JSON.stringify(i.data))),this._logService.warn(`UNRESPONSIVE extension host: '${n}' took ${s}% of ${r/1e3}ms, saved PROFILE here: '${u}'`),this._telemetryService.publicLog2("exthostunresponsive",{profilingSessionId:c,duration:o,data:t.map(h=>h[0]).flat(),id:Ii.toKey(l.identifier)}),this._extensionProfileService.setUnresponsiveProfile(l.identifier,i),!(s>=95&&r>=5e6))return;let p=await this._instantiationService.invokeFunction(Vzi,l,i);p&&(this._blame.has(l.identifier)||this._blame.size>=3||(this._blame.add(l.identifier),this._notificationService.prompt(ft.Warning,d(10739,null,l.displayName||l.name),[{label:d(10738,null),run:()=>this._editorService.openEditor(DW.instance,{pinned:!0})},p],{priority:2})))}};jGe=I([m(0,lt),m(1,m9),m(2,Te),m(3,se),m(4,Ne),m(5,ee),m(6,F),m(7,zr),m(8,fmt),m(9,B),m(10,fe),m(11,YC)],jGe);function bmt(a,i,e,t,o,n){let r=[],s=[],l=[];if(!i){let V=a.filter(({identifier:H})=>o.every(G=>G.toLowerCase()!==H.id.toLowerCase()));return{local:{added:r,removed:s,updated:l},remote:V.length>0?{added:V,updated:[],removed:[],all:V}:null}}a=a.map(Uzi),i=i.map(Uzi),e=e?e.map(Uzi):null;let c=new Map,u=V=>{V.uuid&&c.set(V.id.toLowerCase(),V.uuid)};a.forEach(({identifier:V})=>u(V)),i.forEach(({identifier:V})=>u(V)),e?.forEach(({identifier:V})=>u(V)),t?.forEach(({identifier:V})=>u(V)),n?.forEach(V=>u(V));let p=V=>{let H=V.identifier.uuid||c.get(V.identifier.id.toLowerCase());return H?`uuid:${H}`:`id:${V.identifier.id.toLowerCase()}`},h=(V,H)=>(V.set(p(H),H),V),g=a.reduce(h,new Map),f=i.reduce(h,new Map),v=i.reduce((V,H)=>h(V,Ji(H)),new Map),b=e?e.reduce(h,new Map):null,S=t.reduce(h,new Map),y=o.reduce((V,H)=>{let G=c.get(H.toLowerCase());return V.add(G?`uuid:${G}`:`id:${H.toLowerCase()}`)},new Set),w=n?n.reduce((V,{id:H,uuid:G})=>(G=G??c.get(H.toLowerCase()),V.add(G?`uuid:${G}`:`id:${H.toLowerCase()}`)),new Set):null,k=xYt(g,f,y,!1);if(k.added.size>0||k.removed.size>0||k.updated.size>0){let V=xYt(b,g,y,!1),H=xYt(b,f,y,!0),G=($,J,ae,he)=>{let oe,de,Ce;return J.installed?(oe=he.pinned,Ce=he.preRelease,oe&&(de=he.version)):(oe=ae.pinned,Ce=ae.preRelease,oe&&(de=ae.version)),oe===void 0&&(oe=J.pinned,oe&&(de=J.version)),Ce===void 0&&(Ce=J.preRelease),{...he,installed:J.installed||ae.installed,pinned:oe,preRelease:Ce,version:de??(ae.version&&(!J.installed||zR(ae.version,J.version))?ae.version:J.version),state:Vyn(J,ae,b?.get($))}};for(let $ of H.removed.values()){let J=g.get($);if(!J)continue;let ae=Ci(b?.get($)),he=w&&!w.has($)&&ae.installed;J.installed&&he?s.push(J.identifier):v.set($,J)}for(let $ of H.added.values()){let J=Ci(f.get($)),ae=g.get($);if(ae){if(k.updated.has($)){let he=G($,ae,J,J);HAo(ae,J,!1,!1)||l.push(vmt(he,$)),v.set($,he)}}else J.installed&&r.push(vmt(J,$))}for(let $ of H.updated.values()){let J=Ci(f.get($)),ae=Ci(b?.get($)),he=g.get($);if(he)if(w&&!w.has($)&&ae.installed&&he.installed&&!J.installed)s.push(he.identifier);else{let de=G($,he,J,J);l.push(vmt(de,$)),v.set($,de)}else J.installed&&r.push(vmt(J,$))}for(let $ of V.added.values())H.added.has($)||v.set($,Ci(g.get($)));for(let $ of V.updated.values()){if(H.removed.has($)||H.updated.has($))continue;let J=Ci(g.get($)),ae=Ci(f.get($));v.set($,G($,J,ae,J))}for(let $ of V.removed.values())H.updated.has($)||H.removed.has($)||S.has($)||Ci(f.get($)).installed&&w&&(w.has($)||!Ci(b?.get($)).installed||v.delete($))}let T=[],P=xYt(f,v,new Set,!0),O=P.added.size>0||P.updated.size>0||P.removed.size>0;return O&&v.forEach((V,H)=>T.push(vmt(V,H))),{local:{added:r,removed:s,updated:l},remote:O?{added:[...P.added].map(V=>v.get(V)),updated:[...P.updated].map(V=>v.get(V)),removed:[...P.removed].map(V=>f.get(V)),all:T}:null}}function xYt(a,i,e,t){let o=a?[...a.keys()].filter(c=>!e.has(c)):[],n=[...i.keys()].filter(c=>!e.has(c)),r=n.filter(c=>!o.includes(c)).reduce((c,u)=>(c.add(u),c),new Set),s=o.filter(c=>!n.includes(c)).reduce((c,u)=>(c.add(u),c),new Set),l=new Set;for(let c of o){if(s.has(c))continue;let u=a.get(c),p=i.get(c);(!p||!HAo(u,p,t,!0))&&l.add(c)}return{added:r,removed:s,updated:l}}function HAo(a,i,e,t){return!(a.disabled!==i.disabled||!!a.isApplicationScoped!=!!i.isApplicationScoped||t&&a.installed!==i.installed||a.installed&&i.installed&&(a.preRelease!==i.preRelease||a.pinned!==i.pinned||i.pinned&&a.version!==i.version)||!Byn(a.state,i.state)||e&&a.version!==i.version)}function Vyn(a,i,e){let t=a.state,o=i.state,n=e?.state;if(!i.version||t&&zR(a.version,i.version))return t;if(o&&zR(i.version,a.version)||!t)return o;if(!o)return t;let r=Ji(t),s=n?zzi(n,o):{added:Object.keys(o).reduce((c,u)=>(c.add(u),c),new Set),removed:new Set,updated:new Set},l=n?zzi(n,t):{added:Object.keys(t).reduce((c,u)=>(c.add(u),c),new Set),removed:new Set,updated:new Set};for(let c of[...s.added.values(),...s.updated.values()])r[c]=o[c];for(let c of s.removed.values())l.updated.has(c)||delete r[c];return r}function zzi(a,i){let e=Object.keys(a),t=Object.keys(i),o=t.filter(s=>!e.includes(s)).reduce((s,l)=>(s.add(l),s),new Set),n=e.filter(s=>!t.includes(s)).reduce((s,l)=>(s.add(l),s),new Set),r=new Set;for(let s of e){if(n.has(s))continue;let l=a[s],c=i[s];eo(l,c)||r.add(s)}return{added:o,removed:n,updated:r}}function Byn(a={},i={}){let{added:e,removed:t,updated:o}=zzi(a,i);return e.size===0&&t.size===0&&o.size===0}function Uzi(a){return{...a,disabled:!!a.disabled,installed:!!a.installed}}function vmt(a,i){let e={...a,identifier:{id:a.identifier.id,uuid:i.startsWith("uuid:")?i.substring(5):void 0},preRelease:!!a.preRelease,pinned:!!a.pinned};return a.disabled||delete e.disabled,a.installed||delete e.installed,a.state||delete e.state,a.isApplicationScoped||delete e.isApplicationScoped,e}async function EYt(a,i){let e=JSON.parse(a.content);if(a.version===1||a.version===2){let t=(await i.getInstalled(0)).filter(o=>o.isBuiltin);for(let o of e)a.version===1&&(o.enabled===!1&&(o.disabled=!0),delete o.enabled),a.version===2&&t.every(n=>!Ut(n.identifier,o.identifier))&&(o.installed=!0)}return e}function Hyn(a,i){return a.sort((e,t)=>!e.identifier.uuid&&t.identifier.uuid?-1:e.identifier.uuid&&!t.identifier.uuid?1:Hl(e.identifier.id,t.identifier.id)),i?s0(a,{}):JSON.stringify(a)}var kYt=class extends PH{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super({syncResource:"extensions",profile:e},t,n,o,r,s,l,g,f,p,h,b);this.extensionManagementService=c;this.ignoredExtensionsManagementService=u;this.instantiationService=y;this.version=6;this.previewResource=this.extUri.joinPath(this.syncPreviewFolder,"extensions.json");this.baseResource=this.previewResource.with({scheme:gx,authority:"base"});this.localResource=this.previewResource.with({scheme:gx,authority:"local"});this.remoteResource=this.previewResource.with({scheme:gx,authority:"remote"});this.acceptedResource=this.previewResource.with({scheme:gx,authority:"accepted"});this.localExtensionsProvider=this.instantiationService.createInstance(Smt),this._register(U.any(U.filter(this.extensionManagementService.onDidInstallExtensions,(w=>w.some(({local:k})=>!!k))),U.filter(this.extensionManagementService.onDidUninstallExtension,(w=>!w.error)),U.filter(S.onDidChange,w=>w.valueChanges.some(({profile:k,changes:T})=>this.syncResource.profile.id===k.id&&T.some(P=>P.key===wX))),v.onDidChangeExtensionStorageToSync)(()=>this.triggerLocalChange()))}async generateSyncPreview(e,t){let o=e.syncData?await EYt(e.syncData,this.extensionManagementService):null,n=t?.skippedExtensions??[],r=t?.builtinExtensions??null,s=t?.syncData?await EYt(t.syncData,this.extensionManagementService):null,{localExtensions:l,ignoredExtensions:c}=await this.localExtensionsProvider.getLocalExtensions(this.syncResource.profile);o?this.logService.trace(`${this.syncResourceLogLabel}: Merging remote extensions with local extensions...`):this.logService.trace(`${this.syncResourceLogLabel}: Remote extensions does not exist. Synchronizing extensions for the first time.`);let{local:u,remote:p}=bmt(l,o,s,n,c,r),h={local:u,remote:p,content:this.getPreviewContent(l,u.added,u.updated,u.removed),localChange:u.added.length>0||u.removed.length>0||u.updated.length>0?2:0,remoteChange:p!==null?2:0},g=this.stringify(l,!1);return[{skippedExtensions:n,builtinExtensions:r,baseResource:this.baseResource,baseContent:s?this.stringify(s,!1):g,localResource:this.localResource,localContent:g,localExtensions:l,remoteResource:this.remoteResource,remoteExtensions:o,remoteContent:o?this.stringify(o,!1):null,previewResource:this.previewResource,previewResult:h,localChange:h.localChange,remoteChange:h.remoteChange,acceptedResource:this.acceptedResource}]}async hasRemoteChanged(e){let t=e.syncData?await EYt(e.syncData,this.extensionManagementService):null,{localExtensions:o,ignoredExtensions:n}=await this.localExtensionsProvider.getLocalExtensions(this.syncResource.profile),{remote:r}=bmt(o,t,t,e.skippedExtensions||[],n,e.builtinExtensions||[]);return r!==null}getPreviewContent(e,t,o,n){let r=[...t,...o],s=new Set,l=c=>{s.add(c.id.toLowerCase()),c.uuid&&s.add(c.uuid)};r.forEach(({identifier:c})=>l(c)),n.forEach(l);for(let c of e)s.has(c.identifier.id.toLowerCase())||c.identifier.uuid&&s.has(c.identifier.uuid)||r.push(c);return this.stringify(r,!1)}async getMergeResult(e,t){return{...e.previewResult,hasConflicts:!1}}async getAcceptResult(e,t,o,n){if(this.extUri.isEqual(t,this.localResource))return this.acceptLocal(e);if(this.extUri.isEqual(t,this.remoteResource))return this.acceptRemote(e);if(this.extUri.isEqual(t,this.previewResource))return e.previewResult;throw new Error(`Invalid Resource: ${t.toString()}`)}async acceptLocal(e){let t=await this.extensionManagementService.getInstalled(void 0,this.syncResource.profile.extensionsResource),o=this.ignoredExtensionsManagementService.getIgnoredExtensions(t),n=e.remoteContent?JSON.parse(e.remoteContent):null,r=bmt(e.localExtensions,n,n,e.skippedExtensions,o,e.builtinExtensions),{local:s,remote:l}=r;return{content:e.localContent,local:s,remote:l,localChange:s.added.length>0||s.removed.length>0||s.updated.length>0?2:0,remoteChange:l!==null?2:0}}async acceptRemote(e){let t=await this.extensionManagementService.getInstalled(void 0,this.syncResource.profile.extensionsResource),o=this.ignoredExtensionsManagementService.getIgnoredExtensions(t),n=e.remoteContent?JSON.parse(e.remoteContent):null;if(n!==null){let r=bmt(e.localExtensions,n,e.localExtensions,[],o,e.builtinExtensions),{local:s,remote:l}=r;return{content:e.remoteContent,local:s,remote:l,localChange:s.added.length>0||s.removed.length>0||s.updated.length>0?2:0,remoteChange:l!==null?2:0}}else return{content:e.remoteContent,local:{added:[],removed:[],updated:[]},remote:null,localChange:0,remoteChange:0}}async applyResult(e,t,o,n){let{skippedExtensions:r,builtinExtensions:s,localExtensions:l}=o[0][0],{local:c,remote:u,localChange:p,remoteChange:h}=o[0][1];if(p===0&&h===0&&this.logService.info(`${this.syncResourceLogLabel}: No changes found during synchronizing extensions.`),p!==0&&(await this.backupLocal(JSON.stringify(l)),r=await this.localExtensionsProvider.updateLocalExtensions(c.added,c.removed,c.updated,r,this.syncResource.profile)),u){this.logService.trace(`${this.syncResourceLogLabel}: Updating remote extensions...`);let g=JSON.stringify(u.all);e=await this.updateRemoteUserData(g,n?null:e.ref),this.logService.info(`${this.syncResourceLogLabel}: Updated remote extensions.${u.added.length?` Added: ${JSON.stringify(u.added.map(f=>f.identifier.id))}.`:""}${u.updated.length?` Updated: ${JSON.stringify(u.updated.map(f=>f.identifier.id))}.`:""}${u.removed.length?` Removed: ${JSON.stringify(u.removed.map(f=>f.identifier.id))}.`:""}`)}t?.ref!==e.ref&&(this.logService.trace(`${this.syncResourceLogLabel}: Updating last synchronized extensions...`),s=this.computeBuiltinExtensions(l,s),await this.updateLastSyncUserData(e,{skippedExtensions:r,builtinExtensions:s}),this.logService.info(`${this.syncResourceLogLabel}: Updated last synchronized extensions.${r.length?` Skipped: ${JSON.stringify(r.map(g=>g.identifier.id))}.`:""}`))}computeBuiltinExtensions(e,t){let o=new Set,n=[];for(let r of e)o.add(r.identifier.id.toLowerCase()),r.installed||n.push(r.identifier);if(t)for(let r of t)o.has(r.id.toLowerCase())||n.push(r);return n}async resolveContent(e){if(this.extUri.isEqual(this.remoteResource,e)||this.extUri.isEqual(this.baseResource,e)||this.extUri.isEqual(this.localResource,e)||this.extUri.isEqual(this.acceptedResource,e)){let t=await this.resolvePreviewContent(e);return t&&this.stringify(JSON.parse(t),!0)}return null}stringify(e,t){return Hyn(e,t)}async hasLocalData(){try{let{localExtensions:e}=await this.localExtensionsProvider.getLocalExtensions(this.syncResource.profile);if(e.some(t=>t.installed||t.disabled))return!0}catch{}return!1}};kYt=I([m(2,Eo),m(3,fe),m(4,ce),m(5,A0),m(6,yee),m(7,Cs),m(8,rG),m(9,Dy),m(10,B),m(11,Fl),m(12,Te),m(13,l2),m(14,ht),m(15,W0),m(16,F)],kYt);var Smt=class{constructor(i,e,t,o,n,r){this.extensionManagementService=i;this.userDataProfileStorageService=e;this.extensionGalleryService=t;this.ignoredExtensionsManagementService=o;this.instantiationService=n;this.logService=r}async getLocalExtensions(i){let e=await this.extensionManagementService.getInstalled(void 0,i.extensionsResource),t=this.ignoredExtensionsManagementService.getIgnoredExtensions(e);return{localExtensions:await this.withProfileScopedServices(i,async(n,r)=>{let s=n.getDisabledExtensions();return e.map(l=>{let{identifier:c,isBuiltin:u,manifest:p,preRelease:h,pinned:g,isApplicationScoped:f}=l,v={identifier:c,preRelease:h,version:p.version,pinned:!!g};f&&!S5(p)&&(v.isApplicationScoped=f),s.some(b=>Ut(b,c))&&(v.disabled=!0),u||(v.installed=!0);try{let b=r.getKeysForSync({id:c.id,version:p.version});if(b){let S=r.getExtensionState(l,!0)||{};v.state=Object.keys(S).reduce((y,w)=>(b.includes(w)&&(y[w]=S[w]),y),{})}}catch(b){this.logService.info(`${uMe("extensions",i)}: Error while parsing extension state`,Pn(b))}return v})}),ignoredExtensions:t}}async updateLocalExtensions(i,e,t,o,n){let r=uMe("extensions",n),s=[],l=new Map,c=[],u=[],p=await this.extensionManagementService.getInstalled(void 0,n.extensionsResource);if((i.length||t.length)&&await this.withProfileScopedServices(n,async(f,v)=>{await dn.settled([...i,...t].map(async b=>{let S=p.find(k=>Ut(k.identifier,b.identifier));if(S&&S.isBuiltin){b.state&&S.manifest.version===b.version&&this.updateExtensionState(b.state,S,S.manifest.version,v),f.getDisabledExtensions().some(T=>Ut(T,b.identifier))!==!!b.disabled&&(b.disabled?(this.logService.trace(`${r}: Disabling extension...`,b.identifier.id),await f.disableExtension(b.identifier),this.logService.info(`${r}: Disabled extension`,b.identifier.id)):(this.logService.trace(`${r}: Enabling extension...`,b.identifier.id),await f.enableExtension(b.identifier),this.logService.info(`${r}: Enabled extension`,b.identifier.id))),c.push(b.identifier);return}let y=b.pinned?b.version:void 0,w=(await this.extensionGalleryService.getExtensions([{...b.identifier,version:y,preRelease:y?void 0:b.preRelease}],Se.None))[0];if(b.state&&(S?S.manifest.version===b.version:w)&&this.updateExtensionState(b.state,S||w,S?.manifest.version,v),w)try{f.getDisabledExtensions().some(T=>Ut(T,b.identifier))!==!!b.disabled&&(b.disabled?(this.logService.trace(`${r}: Disabling extension...`,b.identifier.id,w.version),await f.disableExtension(w.identifier),this.logService.info(`${r}: Disabled extension`,b.identifier.id,w.version)):(this.logService.trace(`${r}: Enabling extension...`,b.identifier.id,w.version),await f.enableExtension(w.identifier),this.logService.info(`${r}: Enabled extension`,b.identifier.id,w.version))),(!S||S.preRelease!==b.preRelease||S.pinned!==b.pinned||y&&S.manifest.version!==y)&&(await this.extensionManagementService.canInstall(w)===!0?(s.push({extension:w,options:{isMachineScoped:!1,donotIncludePackAndDependencies:!0,installGivenVersion:b.pinned&&!!b.version,pinned:b.pinned,installPreReleaseVersion:b.preRelease,preRelease:b.preRelease,profileLocation:n.extensionsResource,isApplicationScoped:b.isApplicationScoped,context:{[O5]:!0,[bB]:"settingsSync",[TR]:!0}}}),l.set(w.identifier.id.toLowerCase(),b)):(this.logService.info(`${r}: Skipped synchronizing extension because it cannot be installed.`,w.displayName||w.identifier.id),u.push(b)))}catch(k){u.push(b),this.logService.error(k),this.logService.info(`${r}: Skipped synchronizing extension`,w.displayName||w.identifier.id)}else u.push(b),this.logService.info(`${r}: Skipped synchronizing extension because the extension is not found.`,b.identifier.id)}))}),e.length){let f=p.filter(({identifier:v,isBuiltin:b})=>!b&&e.some(S=>Ut(v,S)));await dn.settled(f.map(async v=>{this.logService.trace(`${r}: Uninstalling local extension...`,v.identifier.id),await this.extensionManagementService.uninstall(v,{donotIncludePack:!0,donotCheckDependents:!0,profileLocation:n.extensionsResource}),this.logService.info(`${r}: Uninstalled local extension.`,v.identifier.id),c.push(v.identifier)}))}let h=await this.extensionManagementService.installGalleryExtensions(s);for(let{identifier:f,local:v,error:b,source:S}of h){let y=S;if(v)this.logService.info(`${r}: Installed extension.`,f.id,y.version),c.push(f);else{let w=l.get(f.id.toLowerCase());w&&(u.push(w),this.logService.info(`${r}: Skipped synchronizing extension`,y.displayName||y.identifier.id)),b instanceof vh&&["Incompatible","IncompatibleApi","IncompatibleTargetPlatform"].includes(b.code)?this.logService.info(`${r}: Skipped synchronizing extension because the compatible extension is not found.`,y.displayName||y.identifier.id):b&&this.logService.error(b)}}let g=[];for(let f of o)c.some(v=>Ut(v,f.identifier))||g.push(f);for(let f of u)g.some(v=>Ut(v.identifier,f.identifier))||g.push(f);return g}updateExtensionState(i,e,t,o){let n=o.getExtensionState(e,!0)||{},r=t?o.getKeysForSync({id:e.identifier.id,version:t}):void 0;r?r.forEach(s=>{n[s]=i[s]}):Object.keys(i).forEach(s=>n[s]=i[s]),o.setExtensionState(e,n,!0)}async withProfileScopedServices(i,e){return this.userDataProfileStorageService.withProfileScopedStorageService(i,async t=>{let o=new N,n=o.add(this.instantiationService.createChild(new _o([ce,t]))),r=o.add(n.createInstance(Y2)),s=o.add(n.createInstance(Hw));try{return await e(r,s)}finally{o.dispose()}})}};Smt=I([m(0,Cs),m(1,W0),m(2,fa),m(3,rG),m(4,F),m(5,Dy)],Smt);var QGe=class extends Mee{constructor(e,t,o,n,r,s,l,c){super("extensions",n,r,s,o,l,c);this.extensionManagementService=e;this.ignoredExtensionsManagementService=t}async parseExtensions(e){return e.syncData?await EYt(e.syncData,this.extensionManagementService):null}generatePreview(e,t){let o=[],n=[],r=[];for(let s of e){if(this.ignoredExtensionsManagementService.hasToNeverSyncExtension(s.identifier.id))continue;let l=t.find(c=>Ut(c.identifier,s.identifier));l?(o.push(l),s.disabled&&r.push(s.identifier)):s.installed&&(n.push({...s.identifier,preRelease:!!s.preRelease}),s.disabled&&r.push(s.identifier))}return{installedExtensions:o,newExtensions:n,disabledExtensions:r,remoteExtensions:e}}};QGe=I([m(0,Cs),m(1,rG),m(2,fe),m(3,an),m(4,Eo),m(5,se),m(6,ce),m(7,ht)],QGe);var YGe=class{constructor(i,e,t,o,n,r,s){this.remoteAgentService=i;this.remoteExtensionsScannerService=e;this.extensionGalleryService=t;this.extensionManagementServerService=o;this.extensionsWorkbenchService=n;this.logService=r;this.configurationService=s;this.installExtensionsIfInstalledLocallyInRemote(),this.installFailedRemoteExtensions()}async installExtensionsIfInstalledLocallyInRemote(){if(!this.remoteAgentService.getConnection())return;if(!this.extensionManagementServerService.remoteExtensionManagementServer){this.logService.error("No remote extension management server available");return}if(!this.extensionManagementServerService.localExtensionManagementServer){this.logService.error("No local extension management server available");return}let i=this.configurationService.getValue(bQt);if(!i?.length)return;let e=await this.extensionsWorkbenchService.queryLocal(this.extensionManagementServerService.localExtensionManagementServer),t=await this.extensionsWorkbenchService.queryLocal(this.extensionManagementServerService.remoteExtensionManagementServer),o=e.filter(n=>i.some(r=>Ut(n.identifier,{id:r}))).filter(n=>!t.some(r=>Ut(r.identifier,n.identifier)));o.length&&await Promise.allSettled(o.map(n=>{this.extensionsWorkbenchService.installInServer(n,this.extensionManagementServerService.remoteExtensionManagementServer,{donotIncludePackAndDependencies:!0})}))}async installFailedRemoteExtensions(){if(!this.remoteAgentService.getConnection())return;let{failed:i}=await this.remoteExtensionsScannerService.whenExtensionsReady();if(i.length===0){this.logService.trace("No extensions relayed from server");return}if(!this.extensionManagementServerService.remoteExtensionManagementServer){this.logService.error("No remote extension management server available");return}this.logService.info(`Installing '${i.length}' extensions relayed from server`);let e=await this.extensionGalleryService.getExtensions(i.map(({id:o})=>({id:o})),Se.None),t=[];for(let{id:o,installOptions:n}of i){let r=e.find(s=>Ut(s.identifier,{id:o}));r?t.push({extension:r,options:{...n,downloadExtensionsLocally:!0}}):this.logService.warn(`Relayed failed extension '${o}' from server is not found in the gallery`)}t.length&&await Promise.allSettled(t.map(o=>this.extensionManagementServerService.remoteExtensionManagementServer.extensionManagementService.installFromGallery(o.extension,o.options)))}};YGe=I([m(0,bo),m(1,tG),m(2,fa),m(3,Ec),m(4,Hi),m(5,se),m(6,B)],YGe);var XGe=class{constructor(i,e,t,o,n,r,s,l,c){this.extensionManagementServerService=i;this.storageService=e;this.remoteAgentService=t;this.userDataSyncStoreManagementService=o;this.instantiationService=n;this.logService=r;this.authenticationService=s;this.remoteAuthorityResolverService=l;this.userDataSyncEnablementService=c;this.initializeRemoteExtensions()}async initializeRemoteExtensions(){let i=this.remoteAgentService.getConnection(),e=this.extensionManagementServerService.localExtensionManagementServer,t=this.extensionManagementServerService.remoteExtensionManagementServer;if(!i||!t||!e||!this.userDataSyncStoreManagementService.userDataSyncStore)return;let o=`${Gri}.${i.remoteAuthority}`;if(!this.storageService.getBoolean(o,-1,!0)){this.logService.trace("Skipping initializing remote extensions because the window with this remote authority was opened before.");return}if(this.storageService.store(o,!1,-1,1),!this.storageService.isNew(1)){this.logService.trace("Skipping initializing remote extensions because this workspace was opened before.");return}if(!this.userDataSyncEnablementService.isEnabled())return;let n=await this.remoteAuthorityResolverService.resolveAuthority(i.remoteAuthority);if(!n.options?.authenticationSession)return;let s=(await this.authenticationService.getSessions(n.options?.authenticationSession.providerId)).find(g=>g.id===n.options?.authenticationSession?.id);if(!s){this.logService.info("Skipping initializing remote extensions because the account with given session id is not found",n.options.authenticationSession.id);return}let l=this.instantiationService.createInstance(MH,this.userDataSyncStoreManagementService.userDataSyncStore.url);l.setAuthToken(s.accessToken,n.options.authenticationSession.providerId);let c=await l.readResource("extensions",null),u=new _o;u.set(Cs,t.extensionManagementService),await this.instantiationService.createChild(u).createInstance(Imt).initialize(c)}};XGe=I([m(0,Ec),m(1,ce),m(2,bo),m(3,pM),m(4,F),m(5,se),m(6,xs),m(7,Uc),m(8,Fl)],XGe);var Imt=class extends QGe{constructor(e,t,o,n,r,s,l,c,u,p){super(e,t,o,n,r,s,u,l);this.extensionGalleryService=c;this.extensionManifestPropertiesService=p}async doInitialize(e){let t=await this.parseExtensions(e);if(!t){this.logService.info("No synced extensions exist while initializing remote extensions.");return}let o=await this.extensionManagementService.getInstalled(),{newExtensions:n}=this.generatePreview(t,o);if(!n.length){this.logService.trace("No new remote extensions to install.");return}let r=await this.extensionManagementService.getTargetPlatform(),s=await this.extensionGalleryService.getExtensions(n,{targetPlatform:r,compatible:!0},Se.None);s.length&&await Promise.allSettled(s.map(async l=>{let c=await this.extensionGalleryService.getManifest(l,Se.None);if(c&&this.extensionManifestPropertiesService.canExecuteOnWorkspace(c)){let u=t.find(p=>Ut(p.identifier,p.identifier));await this.extensionManagementService.installFromGallery(l,{installPreReleaseVersion:u?.preRelease,donotIncludePackAndDependencies:!0,context:{[TR]:!0}})}}))}};Imt=I([m(0,Cs),m(1,rG),m(2,fe),m(3,an),m(4,Eo),m(5,se),m(6,ht),m(7,fa),m(8,ce),m(9,Gp)],Imt);Ee(m9,$Ge,1);ne.as(qo.EditorPane).registerEditorPane(Br.create(GN,GN.ID,d(10735,null)),[new Ft(DW)]);var Kzi=class{canSerialize(i){return!0}serialize(i){return""}deserialize(i){return DW.instance}};ne.as(qo.EditorFactory).registerEditorSerializer(DW.ID,Kzi);var ymt=class extends x{constructor(i,e){super(),e.registerChannel("extensionRecommendationNotification",new pYt(i)),this._register(W(wYt)),this._register(W(CYt))}};ymt=I([m(0,moe),m(1,Qb)],ymt);var wmt=ne.as(Qi.Workbench);wmt.registerWorkbenchContribution(ymt,3);wmt.registerWorkbenchContribution(jGe,4);wmt.registerWorkbenchContribution(XGe,3);wmt.registerWorkbenchContribution(YGe,3);wmt.registerWorkbenchContribution(qGe,3);W(SYt);W(IYt);W(yYt);W(gYt);W(fYt);W(hmt);W(vYt);W(bYt);var h9=class extends Lh{constructor(e,t,o,n,r){super(h9.PREFIX,{canAcceptInBackground:!0});this.menuService=e;this.contextKeyService=t;this.commandService=o;this.extensionService=n;this.productService=r}static{this.PREFIX="issue "}_getPicks(e){let t=new Array,o=new Array,n=new Set,r=this.productService.nameLong,s=d(11393,null),l=lm(e,r,!0),c=lm(e,s,!0);return l&&t.push({label:r,ariaLabel:r,highlights:{label:l},accept:()=>this.commandService.executeCommand("workbench.action.openIssueReporter",{issueSource:"vscode"})}),c&&t.push({label:s,ariaLabel:s,highlights:{label:c},accept:()=>this.commandService.executeCommand("workbench.action.openIssueReporter",{issueSource:"marketplace"})}),t.push({type:"separator",label:d(11392,null)}),this.menuService.getMenuActions(D.IssueReporter,this.contextKeyService,{renderShortTitle:!0}).flatMap(p=>p[1]).forEach(p=>{"source"in p.item&&p.item.source&&n.add(p.item.source.id);let h=this._createPick(e,p);h&&o.push(h)}),this.extensionService.extensions.forEach(p=>{if(!p.isBuiltin){let h=this._createPick(e,void 0,p),g=p.identifier.value;h&&!n.has(g)&&o.push(h),n.add(g)}}),o.sort((p,h)=>{let g=p.label??"",f=h.label??"";return g.localeCompare(f)}),[...t,...o]}_createPick(e,t,o){let n=[{iconClass:q.asClassName(R.info),tooltip:d(11391,null)}],r,s,l;if(t&&"source"in t.item&&t.item.source)r=t.item.source?.title,s=()=>("source"in t.item&&t.item.source&&this.commandService.executeCommand("extension.open",t.item.source.id),1),l=()=>{t.run()};else if(o)r=o.displayName??o.name,s=()=>(this.commandService.executeCommand("extension.open",o.identifier.value),1),l=()=>{this.commandService.executeCommand("workbench.action.openIssueReporter",o.identifier.value)};else return;let c=lm(e,r,!0);if(c)return{label:r,highlights:{label:c},buttons:n,trigger:s,accept:l}}};h9=I([m(0,Kt),m(1,X),m(2,ge),m(3,lt),m(4,tt)],h9);var TYt=le("ITroubleshootIssueService");var JGe=class a{constructor(i,e){this.stage=i;this.profile=e}static fromJSON(i){if(i)try{let e=JSON.parse(i);if((e.stage===1||e.stage===2)&&typeof e.profile=="string")return new a(e.stage,e.profile)}catch{}}},c$=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super();this.userDataProfileService=e;this.userDataProfilesService=t;this.userDataProfileManagementService=o;this.userDataProfileImportExportService=n;this.dialogService=r;this.extensionBisectService=s;this.notificationService=l;this.extensionManagementService=c;this.extensionEnablementService=u;this.issueService=p;this.productService=h;this.hostService=g;this.storageService=f;this.openerService=v}static{this.storageKey="issueTroubleshootState"}isActive(){return this.state!==void 0}async start(){if(this.isActive())throw new Error("invalid state");if(!(await this.dialogService.confirm({message:d(11439,null),detail:d(11425,null,this.productService.nameLong),primaryButton:d(11432,null),custom:!0})).confirmed)return;let t=this.userDataProfileService.currentProfile;await this.userDataProfileImportExportService.createTroubleshootProfile(),this.state=new JGe(1,t.id),await this.resume()}async resume(){this.isActive()&&(this.state?.stage===1&&!this.extensionBisectService.isActive&&await this.reproduceIssueWithExtensionsDisabled(),this.state?.stage===2&&await this.reproduceIssueWithEmptyProfile(),await this.stop())}async stop(){if(!this.isActive())return;this.notificationHandle&&(this.notificationHandle.close(),this.notificationHandle=void 0),this.extensionBisectService.isActive&&await this.extensionBisectService.reset();let e=this.userDataProfilesService.profiles.find(t=>t.id===this.state?.profile)??this.userDataProfilesService.defaultProfile;this.state=void 0,await this.userDataProfileManagementService.switchProfile(e)}async reproduceIssueWithExtensionsDisabled(){if(!(await this.extensionManagementService.getInstalled(1)).length){this.state=new JGe(2,this.state.profile);return}let e=await this.askToReproduceIssue(d(11433,null));if(e==="good"){let t=this.userDataProfilesService.profiles.find(o=>o.id===this.state.profile)??this.userDataProfilesService.defaultProfile;await this.reproduceIssueWithExtensionsBisect(t)}e==="bad"&&(this.state=new JGe(2,this.state.profile)),e==="stop"&&await this.stop()}async reproduceIssueWithEmptyProfile(){await this.userDataProfileManagementService.createAndEnterTransientProfile(),this.updateState(this.state);let e=await this.askToReproduceIssue(d(11427,null));e==="stop"&&await this.stop(),e==="good"&&await this.askToReportIssue(d(11431,null)),e==="bad"&&await this.askToReportIssue(d(11430,null,this.productService.nameLong))}async reproduceIssueWithExtensionsBisect(e){await this.userDataProfileManagementService.switchProfile(e);let t=(await this.extensionManagementService.getInstalled(1)).filter(o=>this.extensionEnablementService.isEnabled(o));await this.extensionBisectService.start(t),await this.hostService.reload()}askToReproduceIssue(e){return new Promise((t,o)=>{let n={label:d(11429,null),run:()=>t("good")},r={label:d(11437,null),run:()=>t("bad")},s={label:d(11436,null),run:()=>t("stop")};this.notificationHandle=this.notificationService.prompt(ft.Info,e,[n,r,s],{sticky:!0,priority:3})})}async askToReportIssue(e){let t=!1;if(this.productService.quality==="stable"){let o=await this.askToReproduceIssueWithInsiders();if(o==="good"){await this.dialogService.prompt({type:ft.Info,message:d(11439,null),detail:d(11441,null,this.productService.nameLong),custom:!0});return}if(o==="stop"){await this.stop();return}o==="bad"&&(t=!0)}await this.issueService.openReporter({issueBody:`> ${e} ${t?`It is confirmed that the issue exists in ${this.productService.nameLong} Insiders`:""}`})}async askToReproduceIssueWithInsiders(){return!(await this.dialogService.confirm({type:"info",message:d(11439,null),primaryButton:d(11426,null,this.productService.nameLong),cancelButton:d(11434,null),detail:d(11422,null,this.productService.nameLong),custom:{disableCloseAction:!0}})).confirmed||!await this.openerService.open(A.parse("https://aka.ms/vscode-insiders"))?void 0:(await this.dialogService.prompt({type:"info",message:d(11439,null),buttons:[{label:d(11428,null),run:()=>"good"},{label:d(11424,null),run:()=>"bad"}],cancelButton:{label:d(11435,null),run:()=>"stop"},detail:d(11423,null,this.productService.nameLong),custom:{disableCloseAction:!0}})).result}get state(){if(this._state===void 0){let e=this.storageService.get(c$.storageKey,0);this._state=JGe.fromJSON(e)}return this._state||void 0}set state(e){this._state=e??null,this.updateState(e)}updateState(e){e?this.storageService.store(c$.storageKey,JSON.stringify(e),0,1):this.storageService.remove(c$.storageKey,0)}};c$=I([m(0,ln),m(1,an),m(2,vT),m(3,YB),m(4,at),m(5,K3),m(6,Ne),m(7,Cs),m(8,Js),m(9,OT),m(10,tt),m(11,Zt),m(12,ce),m(13,Je)],c$);var g9=class extends x{constructor(e,t,o){super();this.contextKeyService=e;this.troubleshootIssueService=t;this.updateContext(),t.isActive()&&t.resume(),this._register(o.onDidChangeValue(0,c$.storageKey,this._store)(()=>{this.updateContext()}))}static{this.ctxIsTroubleshootActive=new Y("isIssueTroubleshootActive",!1)}updateContext(){g9.ctxIsTroubleshootActive.bindTo(this.contextKeyService).set(this.troubleshootIssueService.isActive())}};g9=I([m(0,X),m(1,TYt),m(2,ce)],g9);ne.as(Qi.Workbench).registerWorkbenchContribution(g9,3);W(class extends K{constructor(){super({id:"workbench.action.troubleshootIssue.start",title:L(11440,"Troubleshoot Issue..."),category:Ve.Help,f1:!0,precondition:C.and(g9.ctxIsTroubleshootActive.negate(),yb.isEqualTo(""),Fu.negate())})}run(i){return i.get(TYt).start()}});W(class extends K{constructor(){super({id:"workbench.action.troubleshootIssue.stop",title:L(11438,"Stop Troubleshoot Issue"),category:Ve.Help,f1:!0,precondition:g9.ctxIsTroubleshootActive})}async run(a){return a.get(TYt).stop()}});Ee(TYt,c$,1);var Gzi="workbench.action.openIssueReporter",Uyn="vscode.openIssueReporter",UAo={description:"Open the issue reporter and optionally prefill part of the form.",args:[{name:"options",description:"Data to use to prefill the issue reporter with.",isOptional:!0,schema:{oneOf:[{type:"string",description:"The extension id to preselect."},{type:"object",properties:{extensionId:{type:"string"},issueTitle:{type:"string"},issueBody:{type:"string"}}}]}}]},ZGe=class extends x{constructor(i,e){if(super(),!e.getValue("telemetry.feedback.enabled")){this._register($e.registerCommand({id:"workbench.action.openIssueReporter",handler:function(o){o.get(Ne).info("Feedback is disabled.")}}));return}if(!i.reportIssueUrl)return;this._register($e.registerCommand({id:Gzi,handler:function(o,n){let r=typeof n=="string"?{extensionId:n}:Array.isArray(n)?{extensionId:n[0]}:n??{};return o.get(OT).openReporter(r)},metadata:UAo})),this._register($e.registerCommand({id:Uyn,handler:function(o,n){let r=typeof n=="string"?{extensionId:n}:Array.isArray(n)?{extensionId:n[0]}:n??{};return o.get(OT).openReporter(r)},metadata:UAo}));let t={id:Gzi,title:L(11443,"Report Issue..."),category:Ve.Help};this._register(ve.appendMenuItem(D.CommandPalette,{command:t})),this._register(ve.appendMenuItem(D.MenubarHelpMenu,{group:"3_feedback",command:{id:Gzi,title:d(11442,null)},order:3}))}};ZGe=I([m(0,tt),m(1,B)],ZGe);var SSe=class{constructor(i,e,t,o,n,r,s,l){this.issueFormService=i;this.themeService=e;this.extensionManagementService=t;this.extensionEnablementService=o;this.workspaceTrustManagementService=n;this.experimentService=r;this.authenticationService=s;this.integrityService=l}async openReporter(i={}){let e=[];try{let c=(await this.extensionManagementService.getInstalled()).filter(u=>this.extensionEnablementService.isEnabled(u)||i.extensionId&&u.identifier.id===i.extensionId);e.push(...c.map(u=>{let{manifest:p}=u,h=p.contributes?Object.keys(p.contributes):[],g=!p.main&&!p.browser&&h.length===1&&h[0]==="themes",f=u.type===0;return{name:p.name,publisher:p.publisher,version:p.version,repositoryUrl:p.repository&&p.repository.url,bugsUrl:p.bugs&&p.bugs.url,displayName:p.displayName,id:u.identifier.id,data:i.data,uri:i.uri,isTheme:g,isBuiltin:f,extensionData:"Extensions data loading"}}))}catch(l){e.push({name:"Workbench Issue Service",publisher:"Unknown",version:"0.0.0",repositoryUrl:void 0,bugsUrl:void 0,extensionData:"Extensions data loading",displayName:`Extensions not loaded: ${l}`,id:"workbench.issue",isTheme:!1,isBuiltin:!0})}let t=await this.experimentService.getCurrentExperiments(),o="";try{o=(await this.authenticationService.getSessions("github")).filter(u=>u.scopes.includes("repo"))[0]?.accessToken}catch{}let n=!1;try{n=!(await this.integrityService.isPure()).isPure}catch{}let r=this.themeService.getColorTheme(),s=Object.assign({styles:zyn(r),zoomLevel:mC(ut),enabledExtensions:e,experiments:t?.join(`
`),restrictedMode:!this.workspaceTrustManagementService.isWorkspaceTrusted(),isUnsupported:n,githubAccessToken:o},i);return this.issueFormService.openReporter(s)}};SSe=I([m(0,gG),m(1,Le),m(2,Cs),m(3,Js),m(4,Nr),m(5,yD),m(6,xs),m(7,_2e)],SSe);function zyn(a){return{backgroundColor:aE(a,bf),color:aE(a,To),textLinkColor:aE(a,nS),textLinkActiveForeground:aE(a,Mvt),inputBackground:aE(a,yv),inputForeground:aE(a,QL),inputBorder:aE(a,nw),inputActiveBorder:aE(a,MV),inputErrorBorder:aE(a,dle),inputErrorBackground:aE(a,Gvt),inputErrorForeground:aE(a,qvt),buttonBackground:aE(a,xC),buttonForeground:aE(a,__),buttonHoverBackground:aE(a,uj),sliderActiveColor:aE(a,K1),sliderBackgroundColor:aE(a,bf),sliderHoverColor:aE(a,z1)}}function aE(a,i){let e=a.getColor(i);return e?e.toString():void 0}Ee(OT,SSe,1);var zAo=mr(d(11416,null)),KAo=mr(d(11415,null)),GAo=mr(d(11417,null)),qAo=mr(d(11414,null)),$Ao=mr(d(11412,null)),jAo=mr(d(11413,null)),QAo=mr(d(11394,null)),Kyn=d(11411,null),YAo=()=>`
<div id="update-banner" class="issue-reporter-update-banner hidden">
	<span class="update-banner-text" id="update-banner-text">
		<!-- To be dynamically filled -->
	</span>
</div>
<div class="issue-reporter" id="issue-reporter">
	<div id="english" class="input-group hidden">${mr(d(11396,null))}</div>

	<div id="review-guidance-help-text" class="input-group">${Kyn}</div>

	<div class="section">
		<div class="input-group">
			<label class="inline-label" for="issue-type">${mr(d(11410,null))}</label>
			<select id="issue-type" class="inline-form-control">
				<!-- To be dynamically filled -->
			</select>
		</div>

		<div class="input-group" id="problem-source">
			<label class="inline-label" for="issue-source">${mr(d(11407,null))} <span class="required-input">*</span></label>
			<select id="issue-source" class="inline-form-control" required>
				<!-- To be dynamically filled -->
			</select>
			<div id="issue-source-empty-error" class="validation-error hidden" role="alert">${mr(d(11406,null))}</div>
			<div id="problem-source-help-text" class="instructions hidden">${mr(d(11401,null)).replace("{0}",()=>`<span tabIndex=0 role="button" id="disableExtensions" class="workbenchCommand">${mr(d(11400,null))}</span>`)}
			</div>

			<div id="extension-selection">
				<label class="inline-label" for="extension-selector">${mr(d(11395,null))} <span class="required-input">*</span></label>
				<select id="extension-selector" class="inline-form-control">
					<!-- To be dynamically filled -->
				</select>
				<div id="extension-selection-validation-error" class="validation-error hidden" role="alert">${mr(d(11405,null)).replace("{0}",()=>'<span tabIndex=0 role="button" id="extensionBugsLink" class="workbenchCommand"><!-- To be dynamically filled --></span>')}</div>
				<div id="extension-selection-validation-error-no-url" class="validation-error hidden" role="alert">
					${mr(d(11404,null))}
				</div>
			</div>
		</div>

		<div id="issue-title-container" class="input-group">
			<label class="inline-label" for="issue-title">${mr(d(11408,null))} <span class="required-input">*</span></label>
			<input id="issue-title" type="text" class="inline-form-control" placeholder="${mr(d(11409,null))}" required>
			<div id="issue-title-empty-error" class="validation-error hidden" role="alert">${mr(d(11419,null))}</div>
			<div id="issue-title-length-validation-error" class="validation-error hidden" role="alert">${mr(d(11420,null))}</div>
			<small id="similar-issues">
				<!-- To be dynamically filled -->
			</small>
		</div>

	</div>

	<div class="input-group description-section">
		<label for="description" id="issue-description-label">
			<!-- To be dynamically filled -->
		</label>
		<div class="instructions" id="issue-description-subtitle">
			<!-- To be dynamically filled -->
		</div>
		<div class="block-info-text">
			<textarea name="description" id="description" placeholder="${mr(d(11399,null))}" required></textarea>
		</div>
		<div id="description-empty-error" class="validation-error hidden" role="alert">${mr(d(11397,null))}</div>
		<div id="description-short-error" class="validation-error hidden" role="alert">${mr(d(11398,null))}</div>
	</div>

	<div class="system-info" id="block-container">
		<div class="block block-extension-data">
			<input class="send-extension-data" aria-label="${jAo}" type="checkbox" id="includeExtensionData" checked/>
			<label class="extension-caption" id="extension-caption" for="includeExtensionData">
				${jAo}
				<span id="ext-loading" hidden></span>
				<span class="ext-parens" hidden>(</span><a href="#" class="showInfo" id="extension-id">${mr(d(11418,null))}</a><span class="ext-parens" hidden>)</span>
				<a id="extension-data-download">${mr(d(11402,null))}</a>
			</label>
			<pre class="block-info" id="extension-data" placeholder="${mr(d(11403,null))}" style="white-space: pre-wrap; user-select: text;">
				<!-- To be dynamically filled -->
			</pre>
		</div>

		<div class="block block-system">
			<input class="sendData" aria-label="${zAo}" type="checkbox" id="includeSystemInfo" checked/>
			<label class="caption" for="includeSystemInfo">
				${zAo}
				(<a href="#" class="showInfo">${mr(d(11418,null))}</a>)
			</label>
			<div class="block-info hidden" style="user-select: text;">
				<!-- To be dynamically filled -->
		</div>
		</div>
		<div class="block block-process">
			<input class="sendData" aria-label="${KAo}" type="checkbox" id="includeProcessInfo" checked/>
			<label class="caption" for="includeProcessInfo">
				${KAo}
				(<a href="#" class="showInfo">${mr(d(11418,null))}</a>)
			</label>
			<pre class="block-info hidden" style="user-select: text;">
				<code>
				<!-- To be dynamically filled -->
				</code>
			</pre>
		</div>
		<div class="block block-workspace">
			<input class="sendData" aria-label="${GAo}" type="checkbox" id="includeWorkspaceInfo" checked/>
			<label class="caption" for="includeWorkspaceInfo">
				${GAo}
				(<a href="#" class="showInfo">${mr(d(11418,null))}</a>)
			</label>
			<pre id="systemInfo" class="block-info hidden" style="user-select: text;">
				<code>
				<!-- To be dynamically filled -->
				</code>
			</pre>
		</div>
		<div class="block block-extensions">
			<input class="sendData" aria-label="${qAo}" type="checkbox" id="includeExtensions" checked/>
			<label class="caption" for="includeExtensions">
				${qAo}
				(<a href="#" class="showInfo">${mr(d(11418,null))}</a>)
			</label>
			<div id="systemInfo" class="block-info hidden" style="user-select: text;">
				<!-- To be dynamically filled -->
			</div>
		</div>
		<div class="block block-experiments">
			<input class="sendData" aria-label="${$Ao}" type="checkbox" id="includeExperiments" checked/>
			<label class="caption" for="includeExperiments">
				${$Ao}
				(<a href="#" class="showInfo">${mr(d(11418,null))}</a>)
			</label>
			<pre class="block-info hidden" style="user-select: text;">
				<!-- To be dynamically filled -->
			</pre>
		</div>
		<div class="block block-acknowledgements hidden" id="version-acknowledgements">
			<input class="sendData" aria-label="${QAo}" type="checkbox" id="includeAcknowledgement"/>
			<label class="caption" for="includeAcknowledgement">
				${QAo}
			</label>
		</div>
	</div>

</div>`;function qzi(a){return a.endsWith(".git")&&(a=a.substr(0,a.length-4)),a=dh(a,"/"),a.endsWith("/new")&&(a=dh(a,"/new")),a.endsWith("/issues")&&(a=dh(a,"/issues")),a}var _Yt=class{constructor(i){let e={issueType:0,includeSystemInfo:!0,includeWorkspaceInfo:!0,includeProcessInfo:!0,includeExtensions:!0,includeExperiments:!0,includeExtensionData:!0,allExtensions:[]};this._data=i?Object.assign(e,i):e,ut.addEventListener("message",async t=>{t.data&&t.data.sendChannel==="vscode:triggerIssueData"&&ut.postMessage({data:{issueBody:this._data.issueDescription,issueTitle:this._data.issueTitle},replyChannel:"vscode:triggerIssueDataResponse"},"*")})}getData(){return this._data}update(i){Object.assign(this._data,i)}serialize(){let i=[];return this._data.restrictedMode&&i.push("Restricted"),this._data.isUnsupported&&i.push("Unsupported"),`
Type: <b>${this.getIssueTypeTitle()}</b>

${this._data.issueDescription}
${this.getExtensionVersion()}
VS Code version: ${this._data.versionInfo&&this._data.versionInfo.vscodeVersion}
OS version: ${this._data.versionInfo&&this._data.versionInfo.os}
Modes:${i.length?" "+i.join(", "):""}
${this.getRemoteOSes()}
${this.getInfos()}
<!-- generated by issue reporter -->`}getRemoteOSes(){return this._data.systemInfo&&this._data.systemInfo.remoteData.length?this._data.systemInfo.remoteData.map(i=>U0(i)?i.errorMessage:`Remote OS version: ${i.machineInfo.os}`).join(`
`)+`
`:""}fileOnExtension(){return(this._data.issueType===0||this._data.issueType===1||this._data.issueType===2)&&this._data.fileOnExtension}getExtensionVersion(){return this.fileOnExtension()&&this._data.selectedExtension?`
Extension version: ${this._data.selectedExtension.version}`:""}getIssueTypeTitle(){return this._data.issueType===0?"Bug":this._data.issueType===1?"Performance Issue":"Feature Request"}getInfos(){let i="";if(this._data.fileOnMarketplace)return i;let e=this._data.issueType===0||this._data.issueType===1;return e&&(this._data.includeExtensionData&&this._data.extensionData&&(i+=this.getExtensionData()),this._data.includeSystemInfo&&this._data.systemInfo&&(i+=this.generateSystemInfoMd()),this._data.includeSystemInfo&&this._data.systemInfoWeb&&(i+="System Info: "+this._data.systemInfoWeb)),this._data.issueType===1&&(this._data.includeProcessInfo&&(i+=this.generateProcessInfoMd()),this._data.includeWorkspaceInfo&&(i+=this.generateWorkspaceInfoMd())),e&&(!this._data.fileOnExtension&&this._data.includeExtensions&&(i+=this.generateExtensionsMd()),this._data.includeExperiments&&this._data.experimentInfo&&(i+=this.generateExperimentsInfoMd())),i}getExtensionData(){return this._data.extensionData??""}generateSystemInfoMd(){let i=`<details>
<summary>System Info</summary>

|Item|Value|
|---|---|
`;return this._data.systemInfo&&(i+=`|CPUs|${this._data.systemInfo.cpus}|
|GPU Status|${Object.keys(this._data.systemInfo.gpuStatus).map(e=>`${e}: ${this._data.systemInfo.gpuStatus[e]}`).join("<br>")}|
|Load (avg)|${this._data.systemInfo.load}|
|Memory (System)|${this._data.systemInfo.memory}|
|Process Argv|${this._data.systemInfo.processArgs.replace(/\\/g,"\\\\")}|
|Screen Reader|${this._data.systemInfo.screenReader}|
|VM|${this._data.systemInfo.vmHint}|`,this._data.systemInfo.linuxEnv&&(i+=`
|DESKTOP_SESSION|${this._data.systemInfo.linuxEnv.desktopSession}|
|XDG_CURRENT_DESKTOP|${this._data.systemInfo.linuxEnv.xdgCurrentDesktop}|
|XDG_SESSION_DESKTOP|${this._data.systemInfo.linuxEnv.xdgSessionDesktop}|
|XDG_SESSION_TYPE|${this._data.systemInfo.linuxEnv.xdgSessionType}|`),this._data.systemInfo.remoteData.forEach(e=>{U0(e)?i+=`

${e.errorMessage}`:i+=`

|Item|Value|
|---|---|
|Remote|${e.latency?`${e.hostName} (latency: ${e.latency.current.toFixed(2)}ms last, ${e.latency.average.toFixed(2)}ms average)`:e.hostName}|
|OS|${e.machineInfo.os}|
|CPUs|${e.machineInfo.cpus}|
|Memory (System)|${e.machineInfo.memory}|
|VM|${e.machineInfo.vmHint}|`})),i+=`
</details>`,i}generateProcessInfoMd(){return`<details>
<summary>Process Info</summary>

\`\`\`
${this._data.processInfo}
\`\`\`

</details>
`}generateWorkspaceInfoMd(){return`<details>
<summary>Workspace Info</summary>

\`\`\`
${this._data.workspaceInfo};
\`\`\`

</details>
`}generateExperimentsInfoMd(){return`<details>
<summary>A/B Experiments</summary>

\`\`\`
${this._data.experimentInfo}
\`\`\`

</details>
`}generateExtensionsMd(){if(this._data.extensionsDisabled)return"Extensions disabled";let i=this._data.numberOfThemeExtesions?`
(${this._data.numberOfThemeExtesions} theme extensions excluded)`:"";if(!this._data.enabledNonThemeExtesions)return"Extensions: none"+i;let e=`Extension|Author (truncated)|Version
---|---|---`,t=this._data.enabledNonThemeExtesions.map(o=>`${o.name}|${o.publisher?.substr(0,3)??"N/A"}|${o.version}`).join(`
`);return`<details><summary>Extensions (${this._data.enabledNonThemeExtesions.length})</summary>

${e}
${t}
${i}

</details>`}};var XAo=7500,Gyn=6e4;var d$=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.disableExtensions=e;this.data=t;this.os=o;this.product=n;this.window=r;this.isWeb=s;this.issueFormService=l;this.themeService=c;this.fileService=u;this.fileDialogService=p;this.contextMenuService=h;this.authenticationService=g;this.openerService=f;this.receivedSystemInfo=!1;this.numberOfSearchResultsDisplayed=0;this.receivedPerformanceInfo=!1;this.shouldQueueSearch=!1;this.hasBeenSubmitted=!1;this.openReporter=!1;this.loadingExtensionData=!1;this.selectedExtension="";this.delayedSubmit=new Xo(300);this.nonGitHubIssueUrl=!1;this.needsUpdate=!1;this.acknowledged=!1;let v=t.extensionId?t.enabledExtensions.find(H=>H.id.toLocaleLowerCase()===t.extensionId?.toLocaleLowerCase()):void 0;this.issueReporterModel=new _Yt({...t,issueType:t.issueType||0,versionInfo:{vscodeVersion:`${n.nameShort} ${n.darwinUniversalAssetId?`${n.version} (Universal)`:n.version} (${n.commit||"Commit unknown"}, ${n.date||"Date unknown"})`,os:`${this.os.type} ${this.os.arch} ${this.os.release}${zSe?" snap":""}`},extensionsDisabled:!!this.disableExtensions,fileOnExtension:t.extensionId?!v?.isBuiltin:void 0,selectedExtension:v}),this._register(this.authenticationService.onDidChangeSessions(async()=>{let H=!!this.data.githubAccessToken,G="";try{G=(await this.authenticationService.getSessions("github")).filter(he=>he.scopes.includes("repo"))[0]?.accessToken}catch{}this.data.githubAccessToken=G,H!==!!G&&this.updateButtonStates()}));let b=t.issueSource==="marketplace",S=t.issueSource==="vscode";this.issueReporterModel.update({fileOnMarketplace:b,fileOnProduct:S}),this.createAction=this._register(new it("issueReporter.create",d(11353,null),void 0,!0,async()=>{this.delayedSubmit.trigger(async()=>{this.createIssue(!0)})})),this.previewAction=this._register(new it("issueReporter.preview",d(11373,null),void 0,!0,async()=>{this.delayedSubmit.trigger(async()=>{this.createIssue(!1)})})),this.privateAction=this._register(new it("issueReporter.privateCreate",d(11375,null),void 0,!0,async()=>{this.delayedSubmit.trigger(async()=>{this.createIssue(!0,!0)})}));let y=t.issueTitle;if(y){let H=this.getElementById("issue-title");H&&(H.value=y)}let w=t.issueBody;if(w){let H=this.getElementById("description");H&&(H.value=w,this.issueReporterModel.update({issueDescription:w}))}this.window.document.documentElement.lang!=="en"&&Cm(this.getElementById("english"));let k=Cr();k.id="codiconStyles";let T=this._register(OVt(this.themeService));function P(){k.textContent=T.getCSS()}let O=new Dt(P,0);this._register(T.onDidChange(()=>O.schedule())),O.schedule(),this.handleExtensionData(t.enabledExtensions),this.setUpTypes(),(t.data||t.uri)&&v&&this.updateExtensionStatus(v),this.getElementById("issue-reporter")&&this.updateButtonStates()}render(){this.renderBlocks()}setInitialFocus(){let{fileOnExtension:e}=this.issueReporterModel.getData();e?this.window.document.getElementById("issue-title")?.focus():this.window.document.getElementById("issue-type")?.focus()}updateButtonStates(){let e=this.getElementById("issue-reporter");if(!e)return;let t=this.getElementById("public-elements");t||(t=document.createElement("div"),t.id="public-elements",t.classList.add("public-elements"),e.appendChild(t)),this.updatePublicGithubButton(t),this.updatePublicRepoLink(t);let o=this.getElementById("internal-elements");o||(o=document.createElement("div"),o.id="internal-elements",o.classList.add("internal-elements"),o.classList.add("hidden"),e.appendChild(o));let n=this.getElementById("internal-top-row");n||(n=document.createElement("div"),n.id="internal-top-row",n.classList.add("internal-top-row"),o.appendChild(n)),this.updateInternalFilingNote(n),this.updateInternalGithubButton(n),this.updateInternalElementsVisibility()}updateInternalFilingNote(e){let t=this.getElementById("internal-preview-message");t||(t=document.createElement("span"),t.id="internal-preview-message",t.classList.add("internal-preview-message"),e.appendChild(t)),t.textContent=mr(d(11365,null))}updatePublicGithubButton(e){if(!this.getElementById("issue-reporter"))return;this.publicGithubButton&&this.publicGithubButton.dispose(),!this.acknowledged&&this.needsUpdate?(this.publicGithubButton=this._register(new Wi(e,sxe)),this.publicGithubButton.label=d(11349,null),this.publicGithubButton.enabled=!1):this.data.githubAccessToken&&this.isPreviewEnabled()?(this.publicGithubButton=this._register(new ry(e,{contextMenuProvider:this.contextMenuService,actions:[this.previewAction],addPrimaryActionToDropdown:!1,...sxe})),this._register(this.publicGithubButton.onDidClick(()=>{this.createAction.run()})),this.publicGithubButton.label=d(11355,null),this.publicGithubButton.enabled=!0):this.data.githubAccessToken&&!this.isPreviewEnabled()?(this.publicGithubButton=this._register(new Wi(e,sxe)),this._register(this.publicGithubButton.onDidClick(()=>{this.createAction.run()})),this.publicGithubButton.label=d(11355,null),this.publicGithubButton.enabled=!0):(this.publicGithubButton=this._register(new Wi(e,sxe)),this._register(this.publicGithubButton.onDidClick(()=>{this.previewAction.run()})),this.publicGithubButton.label=d(11374,null),this.publicGithubButton.enabled=!0);let o=this.getElementById("show-repo-name");o&&e.insertBefore(this.publicGithubButton.element,o)}updatePublicRepoLink(e){let t=this.getElementById("show-repo-name");t||(t=document.createElement("a"),t.id="show-repo-name",t.classList.add("hidden"),e.appendChild(t));let o=this.issueReporterModel.getData().selectedExtension;if(o&&o.uri){let n=A.revive(o.uri).toString();t.href=n,t.addEventListener("click",s=>this.openLink(s)),t.addEventListener("auxclick",s=>this.openLink(s));let r=this.parseGitHubUrl(n);t.textContent=r?r.owner+"/"+r.repositoryName:n,Object.assign(t.style,{alignSelf:"flex-end",display:"block",fontSize:"13px",padding:"4px 0px",textDecoration:"none",width:"auto"}),Cm(t)}else t&&(t.removeAttribute("style"),Yb(t))}updateInternalGithubButton(e){this.getElementById("issue-reporter")&&(this.internalGithubButton&&this.internalGithubButton.dispose(),this.data.githubAccessToken&&this.data.privateUri&&(this.internalGithubButton=this._register(new Wi(e,sxe)),this._register(this.internalGithubButton.onDidClick(()=>{this.privateAction.run()})),this.internalGithubButton.element.id="internal-create-btn",this.internalGithubButton.element.classList.add("internal-create-subtle"),this.internalGithubButton.label=d(11354,null),this.internalGithubButton.enabled=!0,this.internalGithubButton.setTitle(this.data.privateUri.path.slice(1))))}updateInternalElementsVisibility(){let e=this.getElementById("internal-elements");e&&(this.data.githubAccessToken&&this.data.privateUri?(Cm(e),e.style.display="",this.internalGithubButton&&(this.internalGithubButton.enabled=this.publicGithubButton?.enabled??!1)):(Yb(e),e.style.display="none"))}async updateIssueReporterUri(e){try{if(e.uri){let t=A.revive(e.uri);e.bugsUrl=t.toString()}}catch{this.renderBlocks()}}handleExtensionData(e){let t=e.filter(s=>!s.isBuiltin),{nonThemes:o,themes:n}=MI(t,s=>s.isTheme?"themes":"nonThemes"),r=(n&&n.length)??0;this.issueReporterModel.update({numberOfThemeExtesions:r,enabledNonThemeExtesions:o,allExtensions:t}),this.updateExtensionTable(o??[],r),(this.disableExtensions||t.length===0)&&(this.getElementById("disableExtensions").disabled=!0),this.updateExtensionSelector(t)}updateExtensionSelector(e){let t=e.map(r=>({name:r.displayName||r.name||"",id:r.id}));t.sort((r,s)=>{let l=r.name.toLowerCase(),c=s.name.toLowerCase();return l>c?1:l<c?-1:0});let o=(r,s)=>{let l=s&&r.id===s.id;return _("option",{value:r.id,selected:l||""},r.name)},n=this.getElementById("extension-selector");if(n){let{selectedExtension:r}=this.issueReporterModel.getData();vi(n,this.makeOption("",d(11377,null),!0),...t.map(s=>o(s,r))),r||(n.selectedIndex=0),this.addEventListener("extension-selector","change",async s=>{this.clearExtensionData();let l=s.target.value;this.selectedExtension=l;let u=this.issueReporterModel.getData().allExtensions.filter(p=>p.id===l);if(u.length){this.issueReporterModel.update({selectedExtension:u[0]});let p=this.issueReporterModel.getData().selectedExtension;if(p){let h=document.createElement("span");h.classList.add(...q.asClassNameArray(R.loading),"codicon-modifier-spin"),this.setLoading(h);let g=await this.sendReporterMenu(p);g?this.selectedExtension===l&&(this.removeLoading(h,!0),this.data=g):(this.loadingExtensionData||h.classList.remove(...q.asClassNameArray(R.loading),"codicon-modifier-spin"),this.removeLoading(h),this.clearExtensionData(),p.data=void 0,p.uri=void 0),this.selectedExtension===l&&(this.updateExtensionStatus(u[0]),this.openReporter=!1)}else this.issueReporterModel.update({selectedExtension:void 0}),this.clearSearchResults(),this.clearExtensionData(),this.validateSelectedExtension(),this.updateExtensionStatus(u[0])}this.updateInternalElementsVisibility()})}this.addEventListener("problem-source","change",r=>{this.clearExtensionData(),this.validateSelectedExtension()})}async sendReporterMenu(e){try{let t=new Promise((n,r)=>setTimeout(()=>r(new Error("sendReporterMenu timed out")),1e4));return await Promise.race([this.issueFormService.sendReporterMenu(e.id),t])}catch(t){console.error(t);return}}updateAcknowledgementState(){let e=this.getElementById("includeAcknowledgement");e&&(this.acknowledged=e.checked,this.updateButtonStates())}setEventHandlers(){["includeSystemInfo","includeProcessInfo","includeWorkspaceInfo","includeExtensions","includeExperiments","includeExtensionData"].forEach(t=>{this.addEventListener(t,"click",o=>{o.stopPropagation(),this.issueReporterModel.update({[t]:!this.issueReporterModel.getData()[t]})})}),this.addEventListener("includeAcknowledgement","click",t=>{t.stopPropagation(),this.updateAcknowledgementState()});let e=this.window.document.getElementsByClassName("showInfo");for(let t=0;t<e.length;t++)e.item(t).addEventListener("click",n=>{n.preventDefault();let r=n.target;if(r){let s=r.parentElement&&r.parentElement.parentElement,l=s&&s.lastElementChild;l&&l.classList.contains("hidden")?(Cm(l),r.textContent=d(11364,null)):(Yb(l),r.textContent=d(11379,null))}});this.addEventListener("issue-source","change",t=>{let o=t.target.value,n=this.getElementById("problem-source-help-text");if(o===""){this.issueReporterModel.update({fileOnExtension:void 0}),Cm(n),this.clearSearchResults(),this.render();return}else Yb(n);let r=this.getElementById("issue-title");o==="vscode"?r.placeholder=d(11385,null):o==="extension"?r.placeholder=d(11360,null):o==="marketplace"?r.placeholder=d(11367,null):r.placeholder=d(11382,null);let s,l,c=!1;o==="extension"?s=!0:o==="marketplace"?l=!0:o==="vscode"&&(c=!0),this.issueReporterModel.update({fileOnExtension:s,fileOnMarketplace:l,fileOnProduct:c}),this.render();let u=this.getElementById("issue-title").value;this.searchIssues(u,s,l)}),this.addEventListener("description","input",t=>{let o=t.target.value;if(this.issueReporterModel.update({issueDescription:o}),this.issueReporterModel.fileOnExtension()===!1){let n=this.getElementById("issue-title").value;this.searchVSCodeIssues(n,o)}}),this.addEventListener("issue-title","input",t=>{let o=this.getElementById("issue-title");if(o){let n=o.value;this.issueReporterModel.update({issueTitle:n})}}),this.addEventListener("issue-title","input",t=>{let o=t.target.value,n=this.getElementById("issue-title-length-validation-error"),r=this.getIssueUrl();o&&this.getIssueUrlWithTitle(o,r).length>XAo?Cm(n):Yb(n);let s=this.getElementById("issue-source");if(!s||s.value==="")return;let{fileOnExtension:l,fileOnMarketplace:c}=this.issueReporterModel.getData();this.searchIssues(o,l,c)}),this.addEventListener("disableExtensions","click",()=>{this.issueFormService.reloadWithExtensionsDisabled()}),this.addEventListener("extensionBugsLink","click",t=>{let o=t.target.innerText;this.openLink(o)}),this.addEventListener("disableExtensions","keydown",t=>{t.stopPropagation(),(t.key==="Enter"||t.key===" ")&&this.issueFormService.reloadWithExtensionsDisabled()}),this.window.document.onkeydown=async t=>{let o=Ze?t.metaKey:t.ctrlKey;if(o&&t.key==="Enter"&&this.delayedSubmit.trigger(async()=>{await this.createIssue()&&this.close()}),o&&t.key==="w"){t.stopPropagation(),t.preventDefault();let n=this.getElementById("issue-title").value,{issueDescription:r}=this.issueReporterModel.getData();!this.hasBeenSubmitted&&(n||r)?this.issueFormService.showConfirmCloseDialog():this.close()}Ze&&o&&t.key==="a"&&t.target&&(mae(t.target)||J9(t.target))&&t.target.select()},this.addEventListener("review-guidance-help-text","click",t=>{let o=t.target;o.tagName==="A"&&o.getAttribute("target")==="_blank"&&this.openLink(t)})}updatePerformanceInfo(e){this.issueReporterModel.update(e),this.receivedPerformanceInfo=!0;let t=this.issueReporterModel.getData();this.updateProcessInfo(t),this.updateWorkspaceInfo(t),this.updateButtonStates()}isPreviewEnabled(){let e=this.issueReporterModel.getData().issueType;if(this.loadingExtensionData)return!1;if(this.isWeb){if(e===2||e===1||e===0)return!0}else if(e===0&&this.receivedSystemInfo||e===1&&this.receivedSystemInfo&&this.receivedPerformanceInfo||e===2)return!0;return!1}getExtensionRepositoryUrl(){let e=this.issueReporterModel.getData().selectedExtension;return e&&e.repositoryUrl}getExtensionBugsUrl(){let e=this.issueReporterModel.getData().selectedExtension;return e&&e.bugsUrl}searchVSCodeIssues(e,t){e?this.searchDuplicates(e,t):this.clearSearchResults()}searchIssues(e,t,o){if(t)return this.searchExtensionIssues(e);if(o)return this.searchMarketplaceIssues(e);let n=this.issueReporterModel.getData().issueDescription;this.searchVSCodeIssues(e,n)}searchExtensionIssues(e){let t=this.getExtensionGitHubUrl();if(e){let o=/^https?:\/\/github\.com\/(.*)/.exec(t);if(o&&o.length){let n=o[1];return this.searchGitHub(n,e)}if(this.issueReporterModel.getData().selectedExtension)return this.clearSearchResults(),this.displaySearchResults([])}this.clearSearchResults()}searchMarketplaceIssues(e){if(e){let t=this.parseGitHubUrl(this.product.reportMarketplaceIssueUrl);if(t)return this.searchGitHub(`${t.owner}/${t.repositoryName}`,e)}}async close(){await this.issueFormService.closeReporter()}clearSearchResults(){let e=this.getElementById("similar-issues");e.innerText="",this.numberOfSearchResultsDisplayed=0}searchGitHub(e,t){let o=`is:issue+repo:${e}+${t}`,n=this.getElementById("similar-issues");fetch(`https://api.github.com/search/issues?q=${o}`).then(r=>{r.json().then(s=>{n.innerText="",s&&s.items&&this.displaySearchResults(s.items)}).catch(s=>{console.warn("Timeout or query limit exceeded")})}).catch(r=>{console.warn("Error fetching GitHub issues")})}searchDuplicates(e,t){let o="https://vscode-probot.westus.cloudapp.azure.com:7890/duplicate_candidates",n={method:"POST",body:JSON.stringify({title:e,body:t}),headers:new Headers({"Content-Type":"application/json"})};fetch(o,n).then(r=>{r.json().then(s=>{if(this.clearSearchResults(),s&&s.candidates)this.displaySearchResults(s.candidates);else throw new Error("Unexpected response, no candidates property")}).catch(s=>{})}).catch(r=>{})}displaySearchResults(e){let t=this.getElementById("similar-issues");if(e.length){let o=_("div.issues-container"),n=_("div.list-title");n.textContent=d(11380,null),this.numberOfSearchResultsDisplayed=e.length<5?e.length:5;for(let r=0;r<this.numberOfSearchResultsDisplayed;r++){let s=e[r],l=_("a.issue-link",{href:s.html_url});l.textContent=s.title,l.title=s.title,l.addEventListener("click",p=>this.openLink(p)),l.addEventListener("auxclick",p=>this.openLink(p));let c,u;if(s.state){c=_("span.issue-state");let p=_("span.issue-icon");p.appendChild(Sn(s.state==="open"?R.issueOpened:R.issueClosed));let h=_("span.issue-state.label");h.textContent=s.state==="open"?d(11368,null):d(11352,null),c.title=s.state==="open"?d(11368,null):d(11352,null),c.appendChild(p),c.appendChild(h),u=_("div.issue",void 0,c,l)}else u=_("div.issue",void 0,l);o.appendChild(u)}t.appendChild(n),t.appendChild(o)}}setUpTypes(){let e=(n,r)=>_("option",{value:n.valueOf()},mr(r)),t=this.getElementById("issue-type"),{issueType:o}=this.issueReporterModel.getData();vi(t,e(0,d(11351,null)),e(2,d(11361,null)),e(1,d(11371,null))),t.value=o.toString(),this.setSourceOptions()}makeOption(e,t,o){let n=document.createElement("option");return n.disabled=o,n.value=e,n.textContent=t,n}setSourceOptions(){let e=this.getElementById("issue-source"),{issueType:t,fileOnExtension:o,selectedExtension:n,fileOnMarketplace:r,fileOnProduct:s}=this.issueReporterModel.getData(),l=e.selectedIndex;l===-1&&(o!==void 0?l=o?2:1:n?.isBuiltin?l=1:r?l=3:s&&(l=1)),e.innerText="",e.append(this.makeOption("",d(11378,null),!0)),e.append(this.makeOption("vscode",d(11384,null),!1)),e.append(this.makeOption("extension",d(11359,null),!1)),this.product.reportMarketplaceIssueUrl&&e.append(this.makeOption("marketplace",d(11366,null),!1)),t!==2&&e.append(this.makeOption("unknown",d(11383,null),!1)),l!==-1&&l<e.options.length?e.selectedIndex=l:(e.selectedIndex=0,Yb(this.getElementById("problem-source-help-text")))}async renderBlocks(){let{issueType:e,fileOnExtension:t,fileOnMarketplace:o,selectedExtension:n}=this.issueReporterModel.getData(),r=this.getElementById("block-container"),s=this.window.document.querySelector(".block-system"),l=this.window.document.querySelector(".block-process"),c=this.window.document.querySelector(".block-workspace"),u=this.window.document.querySelector(".block-extensions"),p=this.window.document.querySelector(".block-experiments"),h=this.window.document.querySelector(".block-extension-data"),g=this.getElementById("problem-source"),f=this.getElementById("issue-description-label"),v=this.getElementById("issue-description-subtitle"),b=this.getElementById("extension-selection"),S=this.getElementById("extension-data-download"),y=this.getElementById("issue-title-container"),w=this.getElementById("description"),k=this.getElementById("extension-data");Yb(r),Yb(s),Yb(l),Yb(c),Yb(u),Yb(p),Yb(b),Yb(k),Yb(h),Yb(S),Cm(g),Cm(y),Cm(w),t&&Cm(b);let T=this.issueReporterModel.getData().extensionData;if(T&&T.length>Gyn){Cm(S);let P=new Date,O=P.toISOString().split("T")[0],V=P.toTimeString().split(" ")[0].replace(/:/g,"-"),H=`extensionData_${O}_${V}.md`,G=async()=>{let $=await this.fileDialogService.showSaveDialog({title:d(11376,null),availableFileSystems:[Q.file],defaultUri:Ge(await this.fileDialogService.defaultFilePath(Q.file),H)});$&&await this.fileService.writeFile($,qe.fromString(T))};S.addEventListener("click",G),this._register({dispose:()=>S.removeEventListener("click",G)})}if(n&&this.nonGitHubIssueUrl){Yb(y),Yb(w),vi(f,d(11363,null)),vi(v,d(11358,null,n.displayName)),this.publicGithubButton.label=d(11369,null);return}if(t&&n?.data){let P=n?.data;k.innerText=P.toString(),k.readOnly=!0,Cm(h)}t&&this.openReporter&&(k.readOnly=!0,setTimeout(()=>{this.openReporter&&Cm(h)},100),Cm(h)),e===0?(o||(Cm(r),Cm(s),Cm(p),t||Cm(u)),vi(f,d(11381,null)+" ",_("span.required-input",void 0,"*")),vi(v,d(11350,null))):e===1?(o||(Cm(r),Cm(s),Cm(l),Cm(c),Cm(p)),t?Cm(b):o||Cm(u),vi(f,d(11381,null)+" ",_("span.required-input",void 0,"*")),vi(v,d(11372,null))):e===2&&(vi(f,d(11356,null)+" ",_("span.required-input",void 0,"*")),vi(v,d(11362,null)))}validateInput(e){let t=this.getElementById(e),o=this.getElementById(`${e}-empty-error`),n=this.getElementById("description-short-error");return e==="description"&&this.nonGitHubIssueUrl&&this.data.extensionId?!0:t.value?e==="description"&&t.value.length<10?(t.classList.add("invalid-input"),n?.classList.remove("hidden"),o?.classList.add("hidden"),!1):(t.classList.remove("invalid-input"),o?.classList.add("hidden"),e==="description"&&n?.classList.add("hidden"),!0):(t.classList.add("invalid-input"),o?.classList.remove("hidden"),n?.classList.add("hidden"),!1)}validateInputs(){let e=!0;return["issue-title","description","issue-source"].forEach(t=>{e=this.validateInput(t)&&e}),this.issueReporterModel.fileOnExtension()&&(e=this.validateInput("extension-selector")&&e),e}async submitToGitHub(e,t,o){let n=`https://api.github.com/repos/${o.owner}/${o.repositoryName}/issues`,r={method:"POST",body:JSON.stringify({title:e,body:t}),headers:new Headers({"Content-Type":"application/json",Authorization:`Bearer ${this.data.githubAccessToken}`,"User-Agent":"request"})},s=await fetch(n,r);if(!s.ok)return console.error("Invalid GitHub URL provided."),!1;let l=await s.json();return await this.openLink(l.html_url),this.close(),!0}async createIssue(e,t){let o=this.issueReporterModel.getData().selectedExtension;if(this.nonGitHubIssueUrl&&this.getExtensionBugsUrl())return this.hasBeenSubmitted=!0,!0;if(!this.validateInputs()){let p=this.window.document.getElementsByClassName("invalid-input");return p.length&&p[0].focus(),this.addEventListener("issue-title","input",h=>{this.validateInput("issue-title")}),this.addEventListener("description","input",h=>{this.validateInput("description")}),this.addEventListener("issue-source","change",h=>{this.validateInput("issue-source")}),this.issueReporterModel.fileOnExtension()&&this.addEventListener("extension-selector","change",h=>{this.validateInput("extension-selector")}),!1}this.hasBeenSubmitted=!0;let n=this.getElementById("issue-title").value,r=this.issueReporterModel.serialize(),s=t?this.getPrivateIssueUrl():this.getIssueUrl();if(!s)return console.error(`No ${t?"private ":""}issue url found`),!1;o?.uri&&(s=A.revive(o.uri).toString());let l=this.parseGitHubUrl(s);if(this.data.githubAccessToken&&l&&e)return this.submitToGitHub(n,r,l);let c=this.getIssueUrlWithTitle(this.getElementById("issue-title").value,s),u=c+`&body=${encodeURIComponent(r)}`;if(u=this.addTemplateToUrl(u,l?.owner,l?.repositoryName),u.length>XAo)try{u=await this.writeToClipboard(c,r),u=this.addTemplateToUrl(u,l?.owner,l?.repositoryName)}catch{return console.error("Writing to clipboard failed"),!1}return await this.openLink(u),!0}async writeToClipboard(e,t){if(!await this.issueFormService.showClipboardDialog())throw new go;return e+`&body=${encodeURIComponent(d(11370,null))}`}addTemplateToUrl(e,t,o){let n=this.issueReporterModel.getData().fileOnProduct,r=t?.toLowerCase()==="microsoft";if(n||r&&(o==="vscode"||o==="vscode-python"))try{let l=new URL(e);return l.searchParams.set("template","bug_report.md"),l.toString()}catch{return e+"&template=bug_report.md"}return e}getIssueUrl(){return this.issueReporterModel.fileOnExtension()?this.getExtensionGitHubUrl():this.issueReporterModel.getData().fileOnMarketplace?this.product.reportMarketplaceIssueUrl:this.product.reportIssueUrl}getPrivateIssueUrl(){return A.revive(this.data.privateUri)?.toString()}parseGitHubUrl(e){let t=/^https?:\/\/github\.com\/([^\/]*)\/([^\/]*).*/.exec(e);if(t&&t.length)return{owner:t[1],repositoryName:t[2]};console.error("No GitHub issues match")}getExtensionGitHubUrl(){let e="",t=this.getExtensionBugsUrl(),o=this.getExtensionRepositoryUrl();return t&&t.match(/^https?:\/\/github\.com\/([^\/]*)\/([^\/]*)\/?(\/issues)?$/)?e=qzi(t):o&&o.match(/^https?:\/\/github\.com\/([^\/]*)\/([^\/]*)$/)?e=qzi(o):(this.nonGitHubIssueUrl=!0,e=t||o||""),e}getIssueUrlWithTitle(e,t){this.issueReporterModel.fileOnExtension()&&(t=t+"/issues/new");let o=t.indexOf("?")===-1?"?":"&";return`${t}${o}title=${encodeURIComponent(e)}`}clearExtensionData(){this.nonGitHubIssueUrl=!1,this.issueReporterModel.update({extensionData:void 0}),this.data.issueBody=this.data.issueBody||"",this.data.data=void 0,this.data.uri=void 0,this.data.privateUri=void 0}async updateExtensionStatus(e){this.issueReporterModel.update({selectedExtension:e});let t=this.data.issueBody;if(t){let s=this.getElementById("description"),l=s.value;if(l===""||!l.includes(t.toString())){let c=l+(l===""?"":`
`)+t.toString();s.value=c,this.issueReporterModel.update({issueDescription:c})}}let o=this.data.data;if(o){this.issueReporterModel.update({extensionData:o}),e.data=o;let s=this.window.document.querySelector(".block-extension-data");Cm(s),this.renderBlocks()}let n=this.data.uri;n&&(e.uri=n,this.updateIssueReporterUri(e)),this.validateSelectedExtension();let r=this.getElementById("issue-title").value;this.searchExtensionIssues(r),this.updateButtonStates(),this.renderBlocks()}validateSelectedExtension(){let e=this.getElementById("extension-selection-validation-error"),t=this.getElementById("extension-selection-validation-error-no-url");if(Yb(e),Yb(t),!this.issueReporterModel.getData().selectedExtension){this.publicGithubButton.enabled=!0;return}if(this.loadingExtensionData)return;this.getExtensionGitHubUrl()?this.publicGithubButton.enabled=!0:(this.setExtensionValidationMessage(),this.publicGithubButton.enabled=!1)}setLoading(e){this.openReporter=!0,this.loadingExtensionData=!0,this.updateButtonStates();let t=this.getElementById("extension-id");Yb(t),Array.from(this.window.document.querySelectorAll(".ext-parens")).forEach(r=>Yb(r));let n=this.getElementById("ext-loading");for(Cm(n);n.firstChild;)n.firstChild.remove();n.append(e),this.renderBlocks()}removeLoading(e,t=!1){this.openReporter=t,this.loadingExtensionData=!1,this.updateButtonStates();let o=this.getElementById("extension-id");Cm(o),Array.from(this.window.document.querySelectorAll(".ext-parens")).forEach(s=>Cm(s));let r=this.getElementById("ext-loading");Yb(r),r.firstChild&&e.remove(),this.renderBlocks()}setExtensionValidationMessage(){let e=this.getElementById("extension-selection-validation-error"),t=this.getElementById("extension-selection-validation-error-no-url"),o=this.getExtensionBugsUrl();if(o){Cm(e);let r=this.getElementById("extensionBugsLink");r.textContent=o;return}let n=this.getExtensionRepositoryUrl();if(n){Cm(e);let r=this.getElementById("extensionBugsLink");r.textContent=n;return}Cm(t)}updateProcessInfo(e){let t=this.window.document.querySelector(".block-process .block-info");t&&vi(t,_("code",void 0,e.processInfo??""))}updateWorkspaceInfo(e){this.window.document.querySelector(".block-workspace .block-info code").textContent=`
`+e.workspaceInfo}updateExtensionTable(e,t){let o=this.window.document.querySelector(".block-extensions .block-info");if(o){if(this.disableExtensions){vi(o,d(11357,null));return}let n=t?`
(${t} theme extensions excluded)`:"";if(e=e||[],!e.length){o.innerText="Extensions: none"+n;return}vi(o,this.getExtensionTableHtml(e),document.createTextNode(n))}}getExtensionTableHtml(e){return _("table",void 0,_("tr",void 0,_("th",void 0,"Extension"),_("th",void 0,"Author (truncated)"),_("th",void 0,"Version")),...e.map(t=>_("tr",void 0,_("td",void 0,t.name),_("td",void 0,t.publisher?.substr(0,3)??"N/A"),_("td",void 0,t.version))))}async openLink(e){if(typeof e=="string")await this.openerService.open(e,{openExternal:!0});else{let t=e;t.preventDefault(),t.stopPropagation(),t.which<3&&await this.openerService.open(t.target.href,{openExternal:!0})}}getElementById(e){let t=this.window.document.getElementById(e);if(t)return t}addEventListener(e,t,o){this.getElementById(e)?.addEventListener(t,o)}};I([Zd(300)],d$.prototype,"searchGitHub",1),I([Zd(300)],d$.prototype,"searchDuplicates",1),d$=I([m(6,gG),m(7,Le),m(8,fe),m(9,rn),m(10,Xe),m(11,xs),m(12,Je)],d$);function Yb(a){a?.classList.add("hidden")}function Cm(a){a?.classList.remove("hidden")}var eqe=class extends d${constructor(i,e,t,o,n,r,s,l,c,u,p,h){super(i,e,t,o,n,!0,r,s,l,c,u,p,h);let g=this.window.document.querySelector(".block-system .block-info"),f=this.window.navigator.userAgent;f&&(g?.appendChild(this.window.document.createTextNode(f)),this.receivedSystemInfo=!0,this.issueReporterModel.update({systemInfoWeb:f})),this.setEventHandlers()}setEventHandlers(){super.setEventHandlers(),this.addEventListener("issue-type","change",i=>{let e=parseInt(i.target.value);this.issueReporterModel.update({issueType:e});let t=this.getElementById("issue-title");t&&(t.placeholder=d(11421,null)),this.updateButtonStates(),this.setSourceOptions(),this.render()})}};eqe=I([m(5,gG),m(6,Le),m(7,fe),m(8,rn),m(9,Xe),m(10,xs),m(11,Je)],eqe);var tqe=class{constructor(i,e,t,o,n,r,s){this.instantiationService=i;this.auxiliaryWindowService=e;this.menuService=t;this.contextKeyService=o;this.logService=n;this.dialogService=r;this.hostService=s;this.issueReporterWindow=null;this.extensionIdentifierSet=new ly;this.arch="";this.release="";this.type=""}async openReporter(i){this.hasToReload(i)||(await this.openAuxIssueReporter(i),this.issueReporterWindow&&this.instantiationService.createInstance(eqe,!1,i,{type:this.type,arch:this.arch,release:this.release},ro,this.issueReporterWindow).render())}async openAuxIssueReporter(i,e){let t={width:700,height:800};if(e&&e.x&&e.y){let s=e.x+e.width/2,l=e.y+e.height/2;t={...t,x:s-350,y:l-400}}let o=new N,n=o.add(await this.auxiliaryWindowService.open({mode:1,bounds:t,nativeTitlebar:!0,disableFullscreen:!0})),r=ei?"windows":fn?"linux":"mac";if(n){if(await n.whenStylesHaveLoaded,n.window.document.title="Issue Reporter",n.window.document.body.classList.add("issue-reporter-body","monaco-workbench",r),n.container.remove(),!A3.globalStyleSheet){let l=Cr(n.window.document.head);l.textContent=Jwi(odo,!1)}let s=document.createElement("div");s.classList.add("monaco-workbench"),n.window.document.body.appendChild(s),NP(s,YAo(),{allowedTags:{augment:["input","select","checkbox","textarea"]},allowedAttributes:{augment:["id","class","style","textarea"]}}),this.issueReporterWindow=n.window}else console.error("Failed to open auxiliary window"),o.dispose();this.issueReporterWindow?.addEventListener("beforeunload",()=>{n.window.close(),o.dispose(),this.issueReporterWindow=null})}async sendReporterMenu(i){let e=this.menuService.createMenu(D.IssueReporter,this.contextKeyService),t=e.getActions({renderShortTitle:!0}).flatMap(n=>n[1]);for(let n of t)try{n.item&&"source"in n.item&&n.item.source?.id.toLowerCase()===i.toLowerCase()&&(this.extensionIdentifierSet.add(i.toLowerCase()),await n.run())}catch(r){console.error(r)}if(!this.extensionIdentifierSet.has(i))return;this.extensionIdentifierSet.delete(new Ii(i)),e.dispose();let o=this.currentData;return this.currentData=void 0,o??void 0}async closeReporter(){this.issueReporterWindow?.close()}async reloadWithExtensionsDisabled(){if(this.issueReporterWindow)try{await this.hostService.reload({disableExtensions:!0})}catch(i){this.logService.error(i)}}async showConfirmCloseDialog(){await this.dialogService.prompt({type:bt.Warning,message:d(11387,null),buttons:[{label:d(11390,null),run:()=>{this.closeReporter(),this.issueReporterWindow=null}},{label:d(11386,null),run:()=>{}}]})}async showClipboardDialog(){let i=!1;return await this.dialogService.prompt({type:bt.Warning,message:d(11388,null),buttons:[{label:d(11389,null),run:()=>{i=!0}},{label:d(11386,null),run:()=>{i=!1}}]}),i}hasToReload(i){return i.extensionId&&this.extensionIdentifierSet.has(i.extensionId)?(this.currentData=i,this.issueReporterWindow?.focus(),!0):this.issueReporterWindow?(this.issueReporterWindow.focus(),!0):!1}};tqe=I([m(0,F),m(1,OD),m(2,Kt),m(3,X),m(4,se),m(5,at),m(6,Zt)],tqe);var qyn=7500,JAo=65500,iqe=class extends d${constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super(e,t,o,n,r,!1,l,u,p,h,v,b,S);this.nativeHostService=s;this.updateService=g;this.processService=c,this.processService.getSystemInfo().then(y=>{this.issueReporterModel.update({systemInfo:y}),this.receivedSystemInfo=!0,this.updateSystemInfo(this.issueReporterModel.getData()),this.updateButtonStates()}),this.data.issueType===1&&this.processService.getPerformanceInfo().then(y=>{this.updatePerformanceInfo(y)}),this.checkForUpdates(),this.setEventHandlers(),t$(this.data.zoomLevel,this.window),this.updateExperimentsInfo(this.data.experiments),this.updateRestrictedMode(this.data.restrictedMode),this.updateUnsupportedMode(this.data.isUnsupported)}async checkForUpdates(){let e=this.updateService.state;if(e.type==="ready"||e.type==="downloaded"){this.needsUpdate=!0;let t=this.getElementById("version-acknowledgements"),o=this.getElementById("update-banner");o&&t&&(t.classList.remove("hidden"),o.classList.remove("hidden"),o.textContent=d(11451,null,this.product.nameLong))}}setEventHandlers(){super.setEventHandlers(),this.addEventListener("issue-type","change",e=>{let t=parseInt(e.target.value);this.issueReporterModel.update({issueType:t}),t===1&&!this.receivedPerformanceInfo&&this.processService.getPerformanceInfo().then(n=>{this.updatePerformanceInfo(n)});let o=this.getElementById("issue-title");o&&(o.placeholder=d(11450,null)),this.updateButtonStates(),this.setSourceOptions(),this.render()})}async submitToGitHub(e,t,o){if(t.length>JAo){let c=this.issueReporterModel.getData().extensionData;if(c){t=t.replace(c,"");let u=new Date,p=u.toISOString().split("T")[0],h=u.toTimeString().split(" ")[0].replace(/:/g,"-"),g=`extensionData_${p}_${h}.md`;try{let f=await this.fileDialogService.showSaveDialog({title:d(11449,null),availableFileSystems:[Q.file],defaultUri:Ge(await this.fileDialogService.defaultFilePath(Q.file),g)});f&&await this.fileService.writeFile(f,qe.fromString(c))}catch{return console.error("Writing extension data to file failed"),!1}}else return console.error("Issue body too large to submit to GitHub"),!1}let n=`https://api.github.com/repos/${o.owner}/${o.repositoryName}/issues`,r={method:"POST",body:JSON.stringify({title:e,body:t}),headers:new Headers({"Content-Type":"application/json",Authorization:`Bearer ${this.data.githubAccessToken}`})},s=await fetch(n,r);if(!s.ok)return console.error("Invalid GitHub URL provided."),!1;let l=await s.json();return await this.openerService.open(l.html_url,{openExternal:!0}),this.close(),!0}async createIssue(e,t){let o=this.issueReporterModel.getData().selectedExtension;if(this.nonGitHubIssueUrl){let p=this.getExtensionBugsUrl();if(p)return this.hasBeenSubmitted=!0,await this.openerService.open(p,{openExternal:!0}),!0}if(!this.validateInputs()){let p=this.window.document.getElementsByClassName("invalid-input");return p.length&&p[0].focus(),this.addEventListener("issue-title","input",h=>{this.validateInput("issue-title")}),this.addEventListener("description","input",h=>{this.validateInput("description")}),this.addEventListener("issue-source","change",h=>{this.validateInput("issue-source")}),this.issueReporterModel.fileOnExtension()&&this.addEventListener("extension-selector","change",h=>{this.validateInput("extension-selector"),this.validateInput("description")}),!1}this.hasBeenSubmitted=!0;let n=this.getElementById("issue-title").value,r=this.issueReporterModel.serialize(),s=t?this.getPrivateIssueUrl():this.getIssueUrl();if(!s&&o?.uri)s=A.revive(o.uri).toString();else if(!s)return console.error(`No ${t?"private ":""}issue url found`),!1;let l=this.parseGitHubUrl(s),c=this.getIssueUrlWithTitle(this.getElementById("issue-title").value,s),u=c+`&body=${encodeURIComponent(r)}`;if(u=this.addTemplateToUrl(u,l?.owner,l?.repositoryName),this.data.githubAccessToken&&l&&e&&await this.submitToGitHub(n,r,l))return!0;try{(u.length>qyn||r.length>JAo)&&(u=await this.writeToClipboard(c,r),u=this.addTemplateToUrl(u,l?.owner,l?.repositoryName))}catch{return console.error("Writing to clipboard failed"),!1}return await this.openerService.open(u,{openExternal:!0}),!0}async writeToClipboard(e,t){if(!await this.issueFormService.showClipboardDialog())throw new go;return await this.nativeHostService.writeClipboardText(t),e+`&body=${encodeURIComponent(d(11448,null))}`}updateSystemInfo(e){let t=this.window.document.querySelector(".block-system .block-info");if(t){let o=e.systemInfo,n=_("table",void 0,_("tr",void 0,_("td",void 0,"CPUs"),_("td",void 0,o.cpus||"")),_("tr",void 0,_("td",void 0,"GPU Status"),_("td",void 0,Object.keys(o.gpuStatus).map(r=>`${r}: ${o.gpuStatus[r]}`).join(`
`))),_("tr",void 0,_("td",void 0,"Load (avg)"),_("td",void 0,o.load||"")),_("tr",void 0,_("td",void 0,"Memory (System)"),_("td",void 0,o.memory)),_("tr",void 0,_("td",void 0,"Process Argv"),_("td",void 0,o.processArgs)),_("tr",void 0,_("td",void 0,"Screen Reader"),_("td",void 0,o.screenReader)),_("tr",void 0,_("td",void 0,"VM"),_("td",void 0,o.vmHint)));vi(t,n),o.remoteData.forEach(r=>{if(t.appendChild(_("hr")),U0(r)){let s=_("table",void 0,_("tr",void 0,_("td",void 0,"Remote"),_("td",void 0,r.hostName)),_("tr",void 0,_("td",void 0,""),_("td",void 0,r.errorMessage)));t.appendChild(s)}else{let s=_("table",void 0,_("tr",void 0,_("td",void 0,"Remote"),_("td",void 0,r.latency?`${r.hostName} (latency: ${r.latency.current.toFixed(2)}ms last, ${r.latency.average.toFixed(2)}ms average)`:r.hostName)),_("tr",void 0,_("td",void 0,"OS"),_("td",void 0,r.machineInfo.os)),_("tr",void 0,_("td",void 0,"CPUs"),_("td",void 0,r.machineInfo.cpus||"")),_("tr",void 0,_("td",void 0,"Memory (System)"),_("td",void 0,r.machineInfo.memory)),_("tr",void 0,_("td",void 0,"VM"),_("td",void 0,r.machineInfo.vmHint)));t.appendChild(s)}})}}updateRestrictedMode(e){this.issueReporterModel.update({restrictedMode:e})}updateUnsupportedMode(e){this.issueReporterModel.update({isUnsupported:e})}updateExperimentsInfo(e){this.issueReporterModel.update({experimentInfo:e});let t=this.window.document.querySelector(".block-experiments .block-info");t&&(t.textContent=e||d(11447,null))}};iqe=I([m(5,ko),m(6,gG),m(7,bse),m(8,Le),m(9,fe),m(10,rn),m(11,zd),m(12,X),m(13,Xe),m(14,xs),m(15,Je)],iqe);var oqe=class extends tqe{constructor(e,t,o,n,r,s,l,c,u){super(e,t,r,s,o,n,l);this.nativeHostService=c;this.environmentService=u;this.store=new N}async openReporter(e){if(this.hasToReload(e))return;let t=await this.nativeHostService.getActiveWindowPosition();if(!t)return;await this.openAuxIssueReporter(e,t);let{arch:o,release:n,type:r}=await this.nativeHostService.getOSProperties();this.arch=o,this.release=n,this.type=r,this.issueReporterWindow?this.store.add(this.instantiationService.createInstance(iqe,!!this.environmentService.disableExtensions,e,{type:this.type,arch:this.arch,release:this.release},ro,this.issueReporterWindow)).render():this.store.dispose()}};oqe=I([m(0,F),m(1,OD),m(2,se),m(3,at),m(4,Kt),m(5,X),m(6,Zt),m(7,ko),m(8,oy)],oqe);Ee(OT,SSe,1);Ee(gG,oqe,1);var Cmt=class extends ZGe{constructor(i,e){if(super(i,e),!e.getValue("telemetry.feedback.enabled"))return;i.reportIssueUrl&&this._register(W(jzi));let t,o=()=>{t=ne.as(Ku.Quickaccess).registerQuickAccessProvider({ctor:h9,prefix:h9.PREFIX,contextKey:"inReportIssuePicker",placeholder:d(11446,null),helpEntries:[{description:d(11444,null),commandId:"workbench.action.openIssueReporter"}]})};this._register(e.onDidChangeConfiguration(n=>{!e.getValue("extensions.experimental.issueQuickAccess")&&t?(t.dispose(),t=void 0):t||o()})),e.getValue("extensions.experimental.issueQuickAccess")&&o()}};Cmt=I([m(0,tt),m(1,B)],Cmt);ne.as(Qi.Workbench).registerWorkbenchContribution(Cmt,3);var jzi=class a extends K{static{this.ID="workbench.action.reportPerformanceIssueUsingReporter"}constructor(){super({id:a.ID,title:L(11445,"Report Performance Issue..."),category:Ve.Help,f1:!0})}async run(i){return i.get(OT).openReporter({issueType:1})}};$e.registerCommand("_issues.getSystemStatus",a=>a.get(bse).getSystemStatus());var ZAo=/\s--inspect(?:-brk|port)?=(?<port>\d+)?/,$yn=/\s--inspect-port=(?<port>\d+)/;function DYt(a){let i=a;return!!i?.name&&!!i?.rootProcess}function iKi(a){return!!a?.processRoots}function wse(a){return typeof a?.pid=="number"}var Qzi=class{getHeight(){return 22}getTemplateId(i){return wse(i)?"process":DYt(i)?"machine":U0(i)?"error":iKi(i)?"header":""}},Yzi=class{hasChildren(i){return U0(i)?!1:wse(i)?!!i.children?.length:!0}getChildren(i){return wse(i)?i.children??[]:U0(i)?[]:iKi(i)?i.processRoots.length>1?i.processRoots:i.processRoots.length>0?[i.processRoots[0].rootProcess]:[]:DYt(i)?[i.rootProcess]:i.processes?[i.processes]:[]}};function LYt(a,i){let e=M(a,_(".row"));i&&e.classList.add(i);let t=M(e,_(".cell.name")),o=M(e,_(".cell.cpu")),n=M(e,_(".cell.memory")),r=M(e,_(".cell.pid"));return{name:t,cpu:o,memory:n,pid:r}}var Xzi=class{constructor(){this.templateId="header"}renderTemplate(i){return i.previousElementSibling?.classList.add("force-no-twistie"),LYt(i,"header")}renderElement(i,e,t){t.name.textContent=d(13303,null),t.cpu.textContent=d(13300,null),t.pid.textContent=d(13304,null),t.memory.textContent=d(13302,null)}disposeTemplate(i){}},Jzi=class{constructor(){this.templateId="machine"}renderTemplate(i){return LYt(i)}renderElement(i,e,t){t.name.textContent=i.element.name}disposeTemplate(i){}},Zzi=class{constructor(){this.templateId="error"}renderTemplate(i){return LYt(i)}renderElement(i,e,t){t.name.textContent=i.element.errorMessage}disposeTemplate(i){}},xmt=class extends x{constructor(e,t){super();this.content="";this.hover=this._register(t.setupManagedHover(Ri("mouse"),e,this.content))}update(e){this.content!==e&&(this.content=e,this.hover.update(e))}};xmt=I([m(1,nt)],xmt);var kmt=class{constructor(i,e){this.model=i;this.hoverService=e;this.templateId="process"}renderTemplate(i){let e=LYt(i);return{name:e.name,cpu:e.cpu,memory:e.memory,pid:e.pid,hover:new xmt(e.name,this.hoverService)}}renderElement(i,e,t){let{element:o}=i,n=o.pid.toFixed(0);t.name.textContent=this.model.getName(o.pid,o.name),t.cpu.textContent=o.load.toFixed(0),t.memory.textContent=(o.mem/vl.MB).toFixed(0),t.pid.textContent=n,t.pid.parentElement.id=`pid-${n}`,t.hover?.update(o.cmd)}disposeTemplate(i){i.hover?.dispose()}};kmt=I([m(1,nt)],kmt);var eKi=class{getWidgetAriaLabel(){return d(13301,null)}getAriaLabel(i){return wse(i)||DYt(i)?i.name:U0(i)?i.hostName:null}},tKi=class{getId(i){return wse(i)?i.pid.toString():U0(i)?i.hostName:iKi(i)?"processes":DYt(i)?i.name:"header"}},ISe=class extends x{constructor(e,t,o,n,r){super();this.instantiationService=e;this.productService=t;this.contextMenuService=o;this.commandService=n;this.clipboardService=r;this.dimensions=void 0;this.delayer=this._register(new Xo(1e3));this.model=new Emt(this.productService)}create(e){this.createProcessTree(e),this.update()}createProcessTree(e){e.classList.add("process-explorer"),e.id="process-explorer";let t=[this.instantiationService.createInstance(kmt,this.model),new Xzi,new Jzi,new Zzi];this.tree=this._register(this.instantiationService.createInstance(rF,"processExplorer",e,new Qzi,t,new Yzi,{accessibilityProvider:new eKi,identityProvider:new tKi,expandOnlyOnTwistieClick:!0,renderIndentGuides:"onHover"})),this._register(this.tree.onKeyDown(o=>this.onTreeKeyDown(o))),this._register(this.tree.onContextMenu(o=>this.onTreeContextMenu(e,o))),this.tree.setInput(this.model),this.layoutTree()}async onTreeKeyDown(e){let t=new gi(e);if(t.keyCode===35&&t.altKey){let o=this.getSelectedPids();await Promise.all(o.map(n=>this.killProcess?.(n,"SIGTERM")))}}onTreeContextMenu(e,t){if(!wse(t.element))return;let o=t.element,n=Number(o.pid),r=[];typeof this.killProcess=="function"&&(r.push(ii({id:"killProcess",label:d(13299,null),run:()=>this.killProcess?.(n,"SIGTERM")})),r.push(ii({id:"forceKillProcess",label:d(13298,null),run:()=>this.killProcess?.(n,"SIGKILL")})),r.push(new ri)),r.push(ii({id:"copy",label:d(13295,null),run:()=>{let s=this.getSelectedPids();s?.includes(n)||(s.length=0,s.push(n));let l=s?.map(c=>uae(e).getElementById(`pid-${c}`)).filter(c=>!!c);if(l){let c=l.map(u=>u.innerText).filter(u=>!!u);this.clipboardService.writeText(c.join(`
`))}}})),r.push(ii({id:"copyAll",label:d(13296,null),run:()=>{let s=uae(e).getElementById("process-explorer");s&&this.clipboardService.writeText(s.innerText)}})),this.isDebuggable(o.cmd)&&(r.push(new ri),r.push(ii({id:"debug",label:d(13297,null),run:()=>this.attachTo(o)}))),this.contextMenuService.showContextMenu({getAnchor:()=>t.anchor,getActions:()=>r})}isDebuggable(e){if(Wt)return!1;let t=ZAo.exec(e);return t&&t.groups.port!=="0"||e.indexOf("node ")>=0||e.indexOf("node.exe")>=0}attachTo(e){let t={type:"node",request:"attach",name:`process ${e.pid}`},o=ZAo.exec(e.cmd);o?t.port=Number(o.groups.port):t.processId=String(e.pid),o=$yn.exec(e.cmd),o&&(t.port=Number(o.groups.port)),this.commandService.executeCommand("debug.startFromConfig",t)}getSelectedPids(){return di(this.tree?.getSelection()?.map(e=>{if(wse(e))return e.pid})??[])}async update(){let{processes:e,pidToNames:t}=await this.resolveProcesses();this.model.update(e,t),this.tree?.updateChildren(),this.layoutTree(),this.delayer.trigger(()=>this.update())}focus(){this.tree?.domFocus()}layout(e){this.dimensions=e,this.layoutTree()}layoutTree(){this.dimensions&&this.tree&&this.tree.layout(this.dimensions.height,this.dimensions.width)}};ISe=I([m(0,F),m(1,tt),m(2,Xe),m(3,ge),m(4,Fi)],ISe);var Emt=class{constructor(i){this.productService=i;this.processes={processRoots:[]};this.mapPidToName=new Map}update(i,e){this.mapPidToName.clear();for(let[t,o]of e)this.mapPidToName.set(t,o);i.forEach((t,o)=>{wse(t.rootProcess)&&(t.rootProcess.name=o===0?this.productService.applicationName:"remote-server")}),this.processes={processRoots:i}}getName(i,e){return this.mapPidToName.get(i)??e}};Emt=I([m(0,tt)],Emt);var nqe=class extends ISe{constructor(e,t,o,n,r,s,l,c){super(t,o,n,r,s);this.remoteAgentService=l;this.labelService=c;this.create(e)}async resolveProcesses(){let e=this.remoteAgentService.getConnection();if(!e)return{pidToNames:[],processes:[]};let t=[],o=this.labelService.getHostLabel(Q.vscodeRemote,e.remoteAuthority),n=await this.remoteAgentService.getDiagnosticInfo({includeProcesses:!0});return n&&(U0(n)?t.push({name:n.hostName,rootProcess:n}):n.processes&&t.push({name:o,rootProcess:n.processes})),{pidToNames:[],processes:t}}};nqe=I([m(1,F),m(2,tt),m(3,Xe),m(4,ge),m(5,Fi),m(6,bo),m(7,rt)],nqe);var Cse=class extends Ts{constructor(e,t,o,n,r){super(Cse.ID,e,t,o,n);this.instantiationService=r;this.processExplorerControl=void 0}static{this.ID="workbench.editor.processExplorer"}createEditor(e){this.processExplorerControl=this._register(this.instantiationService.createInstance(nqe,e))}focus(){this.processExplorerControl?.focus()}layout(e){this.processExplorerControl?.layout(e)}};Cse=I([m(1,Te),m(2,Le),m(3,ce),m(4,F)],Cse);var rqe=class extends ISe{constructor(e,t,o,n,r,s,l,c){super(t,o,n,s,c);this.nativeHostService=r;this.processService=l;this.create(e)}killProcess(e,t){return this.nativeHostService.killProcess(e,t)}resolveProcesses(){return this.processService.resolveProcesses()}};rqe=I([m(1,F),m(2,tt),m(3,Xe),m(4,ko),m(5,ge),m(6,bse),m(7,Fi)],rqe);var ySe=class extends Cse{constructor(i,e,t,o,n){super(i,e,t,o,n)}createEditor(i){this.processExplorerControl=this._register(this.instantiationService.createInstance(rqe,i))}};ySe=I([m(1,Te),m(2,Le),m(3,ce),m(4,F)],ySe);ne.as(qo.EditorPane).registerEditorPane(Br.create(ySe,ySe.ID,d(13307,null)),[new Ft(QW)]);var Tmt=class{constructor(i,e){tl.on("vscode:getDiagnosticInfo",(t,...o)=>{let n=o[0],r=i.getConnection();if(r){let s=e.getHostLabel(Q.vscodeRemote,r.remoteAuthority);i.getDiagnosticInfo(n.args).then(l=>{l&&(l.hostName=s,DF.latency?.high&&(l.latency={average:DF.latency.average,current:DF.latency.current})),tl.send(n.replyChannel,l)}).catch(l=>{let c=l&&l.message?`Connection to '${s}' could not be established  ${l.message}`:`Connection to '${s}' could not be established `;tl.send(n.replyChannel,{hostName:s,errorMessage:c})})}else tl.send(n.replyChannel)})}};Tmt=I([m(0,bo),m(1,rt)],Tmt);var _mt=class extends x{constructor(i,e,t){super();let o=i.getConnection();o&&this._register(o.onDidStateChange(async n=>{if(n.type===4){let r=await e.resolveAuthority(o.remoteAuthority);r.options&&r.options.extensionHostEnv&&await t.setRemoteEnvironment(r.options.extensionHostEnv)}}))}};_mt=I([m(0,bo),m(1,Uc),m(2,lt)],_mt);var sqe=class extends x{constructor(e,t){super();this.remoteAgentService=e;this.configurationService=t;this.updateRemoteTelemetryEnablement(),this._register(t.onDidChangeConfiguration(o=>{o.affectsConfiguration(uO)&&this.updateRemoteTelemetryEnablement()}))}static{this.ID="workbench.contrib.remoteTelemetryEnablementUpdater"}updateRemoteTelemetryEnablement(){return this.remoteAgentService.updateTelemetryLevel(JE(this.configurationService))}};sqe=I([m(0,bo),m(1,B)],sqe);var aqe=class extends x{static{this.ID="workbench.contrib.remoteEmptyWorkbenchPresentation"}constructor(i,e,t,o,n){super();function r(){let g=t.getValue("workbench.startupEditor");return g!=="welcomePage"&&g!=="welcomePageInEmptyWorkbench"}function s(){return r()}let{remoteAuthority:l,filesToDiff:c,filesToMerge:u,filesToOpenOrCreate:p,filesToWait:h}=i;l&&n.getWorkbenchState()===1&&!c?.length&&!u?.length&&!p?.length&&!h&&e.resolveAuthority(l).then(()=>{r()&&o.executeCommand("workbench.view.explorer"),s()&&o.executeCommand("workbench.action.terminal.toggleTerminal")})}};aqe=I([m(0,zr),m(1,Uc),m(2,B),m(3,ge),m(4,Pe)],aqe);var lqe=class extends x{static{this.ID="workbench.contrib.wslContextKeyInitializer"}constructor(i,e,t,o){super();let n="wslFeatureInstalled",r="remote.wslFeatureInstalled",s=t.getBoolean(r,-1,void 0),c=new Y(n,!!s,d(13530,null)).bindTo(i);s===void 0&&o.when(4).then(async()=>{e.hasWSLFeatureInstalled().then(u=>{u&&(c.set(!0),t.store(r,!0,-1,1))})})}};lqe=I([m(0,X),m(1,ko),m(2,ce),m(3,ji)],lqe);var eNo=ne.as(Qi.Workbench);eNo.registerWorkbenchContribution(Tmt,4);eNo.registerWorkbenchContribution(_mt,4);It(sqe.ID,sqe,St.BlockRestore);It(aqe.ID,aqe,St.BlockRestore);ei&&It(lqe.ID,lqe,St.BlockRestore);ne.as(Jt.Configuration).registerConfiguration({id:"remote",title:d(13526,null),type:"object",properties:{"remote.downloadExtensionsLocally":{type:"boolean",markdownDescription:d(13529,null),default:!1}}});Ze?Ct.registerCommandAndKeybindingRule({id:eGe.ID,weight:200,primary:2093,when:tGe,metadata:{description:eGe.LABEL,args:[]},handler:eGe.handler()}):(Ct.registerCommandAndKeybindingRule({id:X2e.ID,weight:200,primary:2093,when:tGe,metadata:{description:X2e.LABEL,args:[]},handler:X2e.handler()}),Ct.registerCommandAndKeybindingRule({id:Z2e.ID,weight:200,primary:Vi(2089,2093),when:tGe,metadata:{description:Z2e.LABEL,args:[]},handler:Z2e.handler()}));Ct.registerCommandAndKeybindingRule({id:J2e.ID,weight:200,primary:3121,when:tGe,metadata:{description:J2e.LABEL,args:[]},handler:J2e.handler()});W(class extends K{constructor(){super({id:"workbench.remote.action.closeUnusedPorts",title:d(13527,null),category:d(13528,null),menu:[{id:D.CommandPalette}],precondition:C.and(C.notEquals(`config.${xD}`,vZ),yb)})}async run(a){let i=a.get(du),e=[],t=i.tunnelModel.forwarded;for(let[o,n]of t)n.hasRunningProcess===!1&&e.push(n);if(e.length)for(let o of e)await i.close({host:o.remoteHost,port:o.remotePort},"User")}});function tNo(){Er({id:"workbench.action.terminal.newLocal",title:L(15181,"Create New Integrated Terminal (Local)"),run:async(a,i)=>{let e=i.get(na),t=i.get(Uc),o=i.get(oy),n;try{let s=e.getLastActiveWorkspaceRoot(Q.vscodeRemote);if(s){let l=await t.getCanonicalURI(s);l.scheme===Q.file&&(n=l)}}catch{}n||(n=o.userHome);let r=await a.service.createTerminal({cwd:n});return r?(a.service.setActiveInstance(r),a.groupService.showPanel(!0)):Promise.resolve(void 0)}})}var cqe=class extends x{constructor(e,t,o,n){super();this._fileService=e;this._terminalService=t;tl.on("vscode:openFiles",(s,...l)=>{this._onOpenFileRequest(l[0])}),this._register(n.onDidResumeOS(()=>this._onOsResume())),this._terminalService.setNativeDelegate({getWindowCount:()=>n.getWindowCount()});let r=o.getConnection();r&&r.remoteAuthority&&tNo()}_onOsResume(){for(let e of this._terminalService.instances)e.xterm?.forceRedraw()}async _onOpenFileRequest(e){if(e.termProgram==="vscode"&&e.filesToWait){let t=A.revive(e.filesToWait.waitMarkerFileUri);await this._whenFileDeleted(t),this._terminalService.activeInstance?.focus()}}_whenFileDeleted(e){return new Promise(t=>{let o=!1,n=zI(Ki(),async()=>{if(!o){o=!0;let r=await this._fileService.exists(e);o=!1,r||(n.dispose(),t(void 0))}},1e3)})}};cqe=I([m(0,fe),m(1,nn),m(2,bo),m(3,ko)],cqe);var iNo="Generated",dqe=class extends x{constructor(e,t,o,n,r,s,l,c){super();this._context=e;this._configurationService=t;this._configurationResolverService=o;this._historyService=n;this._logService=r;this._terminalProfileService=s;this._workspaceContextService=l;this._remoteAgentService=c;this._iconRegistry=mw();this._remoteAgentService.getConnection()?this._remoteAgentService.getEnvironment().then(u=>this._primaryBackendOs=u?.os||Po):this._primaryBackendOs=Po,this._register(this._configurationService.onDidChangeConfiguration(u=>{(u.affectsConfiguration("terminal.integrated.defaultProfile.windows")||u.affectsConfiguration("terminal.integrated.defaultProfile.osx")||u.affectsConfiguration("terminal.integrated.defaultProfile.linux"))&&this._refreshDefaultProfileName()})),this._register(this._terminalProfileService.onDidChangeAvailableProfiles(()=>this._refreshDefaultProfileName()))}get defaultProfileName(){return this._defaultProfileName}async _refreshDefaultProfileName(){this._primaryBackendOs&&(this._defaultProfileName=(await this.getDefaultProfile({remoteAuthority:this._remoteAgentService.getConnection()?.remoteAuthority,os:this._primaryBackendOs}))?.profileName)}resolveIcon(e,t){if(e.icon){e.icon=this._getCustomIcon(e.icon)||this.getDefaultIcon();return}if(e.customPtyImplementation){e.icon=this.getDefaultIcon();return}if(e.executable)return;let o=this._getUnresolvedRealDefaultProfile(t);o&&(e.icon=o.icon),e.icon||(e.icon=this.getDefaultIcon())}getDefaultIcon(e){return this._iconRegistry.getIcon(this._configurationService.getValue("terminal.integrated.tabs.defaultIcon",{resource:e}))||R.terminal}async resolveShellLaunchConfig(e,t){let o;e.executable?o=await this._resolveProfile({path:e.executable,args:e.args,profileName:iNo,isDefault:!1},t):o=await this.getDefaultProfile(t),e.executable=o.path,e.args=o.args,o.env&&(e.env?e.env={...e.env,...o.env}:e.env=o.env);let n=e===void 0||Fe(e.cwd)?void 0:e.cwd;e.icon=this._getCustomIcon(e.icon)||this._getCustomIcon(o.icon)||this.getDefaultIcon(n),o.overrideName&&(e.name=o.profileName),e.color=e.color||o.color||this._configurationService.getValue("terminal.integrated.tabs.defaultColor",{resource:n}),e.useShellEnvironment===void 0&&(e.useShellEnvironment=this._configurationService.getValue("terminal.integrated.inheritEnv"))}async getDefaultShell(e){return(await this.getDefaultProfile(e)).path}async getDefaultShellArgs(e){return(await this.getDefaultProfile(e)).args||[]}async getDefaultProfile(e){return this._resolveProfile(await this._getUnresolvedDefaultProfile(e),e)}getEnvironment(e){return this._context.getEnvironment(e)}_getCustomIcon(e){if(e){if(Fe(e))return q.fromId(e);if(q.isThemeIcon(e))return e;if(A.isUri(e)||km(e))return A.revive(e);if((A.isUri(e.light)||km(e.light))&&(A.isUri(e.dark)||km(e.dark)))return{light:A.revive(e.light),dark:A.revive(e.dark)}}}async _getUnresolvedDefaultProfile(e){if(e.allowAutomationShell){let o=this._getUnresolvedAutomationShellProfile(e);if(o)return o}await this._terminalProfileService.profilesReady;let t=this._getUnresolvedRealDefaultProfile(e.os);return t?this._setIconForAutomation(e,t):this._setIconForAutomation(e,await this._getUnresolvedFallbackDefaultProfile(e))}_setIconForAutomation(e,t){if(e.allowAutomationShell){let o=Ji(t);return o.icon=R.tools,o}return t}_getUnresolvedRealDefaultProfile(e){return this._terminalProfileService.getDefaultProfile(e)}async _getUnresolvedFallbackDefaultProfile(e){let t=await this._context.getDefaultSystemShell(e.remoteAuthority,e.os);if(e.os===Po){let r=this._terminalProfileService.availableProfiles.find(s=>P$(s.path).name===P$(t).name);if(r)return e.allowAutomationShell&&(r=Ji(r),r.icon=R.tools),r}let o;e.os===2&&P$(t).name.match(/(zsh|bash)/)?o=["--login"]:o=[];let n=this._guessProfileIcon(t);return{profileName:iNo,path:t,args:o,icon:n,isDefault:!1}}_getUnresolvedAutomationShellProfile(e){let t=this._configurationService.getValue(`terminal.integrated.automationProfile.${this._getOsKey(e.os)}`);if(this._isValidAutomationProfile(t,e.os))return t.icon=this._getCustomIcon(t.icon)||R.tools,t}async _resolveProfile(e,t){let o=await this._context.getEnvironment(t.remoteAuthority);if(t.os===1){let s=!!o.hasOwnProperty("PROCESSOR_ARCHITEW6432"),l=o.windir;if(!s&&l){let c=Yc(l,"Sysnative").replace(/\//g,"\\").toLowerCase();e.path&&e.path.toLowerCase().indexOf(c)===0&&(e.path=Yc(l,"System32",e.path.substr(c.length+1)))}e.path&&(e.path=e.path.replace(/\//g,"\\"))}let n=this._historyService.getLastActiveWorkspaceRoot(t.remoteAuthority?Q.vscodeRemote:Q.file),r=n?this._workspaceContextService.getWorkspaceFolder(n)??void 0:void 0;return e.path=await this._resolveVariables(e.path,o,r),e.args&&(Fe(e.args)?e.args=await this._resolveVariables(e.args,o,r):e.args=await Promise.all(e.args.map(s=>this._resolveVariables(s,o,r)))),e}async _resolveVariables(e,t,o){try{e=await this._configurationResolverService.resolveWithEnvironment(t,o,e)}catch(n){this._logService.error("Could not resolve shell",n)}return e}_getOsKey(e){switch(e){case 3:return"linux";case 2:return"osx";case 1:return"windows"}}_guessProfileIcon(e){switch(P$(e).name){case"bash":return R.terminalBash;case"pwsh":case"powershell":return R.terminalPowershell;case"tmux":return R.terminalTmux;case"cmd":return R.terminalCmd;default:return}}_isValidAutomationProfile(e,t){return e==null||typeof e!="object"?!1:!!("path"in e&&Fe(e.path))}};I([Zd(200)],dqe.prototype,"_refreshDefaultProfileName",1);var RYt=class extends dqe{constructor(i,e,t,o,n,r,s,l){super({getDefaultSystemShell:async(c,u)=>{let p=await n.getBackend(c);return!c||!p?u===1?"pwsh":"bash":p.getDefaultSystemShell(u)},getEnvironment:async c=>{let u=await n.getBackend(c);return!c||!u?$u:u.getEnvironment()}},e,i,t,o,r,s,l)}};RYt=I([m(0,Tp),m(1,B),m(2,na),m(3,ca),m(4,Nm),m(5,vy),m(6,Pe),m(7,bo)],RYt);var uqe=class extends dqe{constructor(i,e,t,o,n,r,s,l){super({getDefaultSystemShell:async(c,u)=>{let p=await l.getBackend(c);if(!p)throw new pa(`Cannot get default system shell when there is no backend for remote authority '${c}'`);return p.getDefaultSystemShell(u)},getEnvironment:async c=>{let u=await l.getBackend(c);if(!u)throw new pa(`Cannot get environment when there is no backend for remote authority '${c}'`);return u.getEnvironment()}},e,i,t,o,r,n,s)}};uqe=I([m(0,Tp),m(1,B),m(2,na),m(3,ca),m(4,Pe),m(5,vy),m(6,bo),m(7,Nm)],uqe);var Dmt=class extends a1e{constructor(e,t,o){super(e,t);this._proxy=o}start(){return this._proxy.start(this.id)}detach(e){return this._proxy.detachFromProcess(this.id,e)}shutdown(e){this._proxy.shutdown(this.id,e)}async processBinary(e){if(!this._inReplay)return this._proxy.processBinary(this.id,e)}input(e){this._inReplay||this._proxy.input(this.id,e)}sendSignal(e){this._inReplay||this._proxy.sendSignal(this.id,e)}resize(e,t,o,n){this._inReplay||this._lastDimensions.cols===e&&this._lastDimensions.rows===t||(this._lastDimensions.cols=e,this._lastDimensions.rows=t,this._proxy.resize(this.id,e,t,o,n))}async clearBuffer(){this._proxy.clearBuffer?.(this.id)}freePortKillProcess(e){if(!this._proxy.freePortKillProcess)throw new Error("freePortKillProcess does not exist on the local pty service");return this._proxy.freePortKillProcess(e)}async refreshProperty(e){return this._proxy.refreshProperty(this.id,e)}async updateProperty(e,t){return this._proxy.updateProperty(this.id,e,t)}acknowledgeDataEvent(e){this._inReplay||this._proxy.acknowledgeDataEvent(this.id,e)}setUnicodeVersion(e){return this._proxy.setUnicodeVersion(this.id,e)}handleOrphanQuestion(){this._proxy.orphanQuestionReply(this.id)}};var CSe=class{static{this.ID="workbench.contrib.localTerminalBackend"}constructor(i,e){let t=i.createInstance(wSe);ne.as(NB.Backend).registerTerminalBackend(t),e.didRegisterBackend(t)}};CSe=I([m(0,F),m(1,Nm)],CSe);var wSe=class extends s1e{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w){super(n,o,v,c,S,e);this._lifecycleService=t;this._localPtyService=n;this._labelService=r;this._shellEnvironmentService=s;this._storageService=l;this._configurationResolverService=c;this._configurationService=u;this._productService=p;this._historyService=h;this._terminalProfileResolverService=g;this._environmentVariableService=f;this._nativeHostService=b;this._remoteAgentService=y;this._environmentService=w;this.remoteAuthority=void 0;this._ptys=new Map;this._directProxyDisposables=this._register(new me);this._whenReady=new Ko;this._onDidRequestDetach=this._register(new E);this.onDidRequestDetach=this._onDidRequestDetach.event;this._register(this.onPtyHostRestart(()=>{this._directProxy=void 0,this._directProxyClientEventually=void 0,this._connectToDirectProxy()}))}get _proxy(){return this._directProxy||this._localPtyService}get whenReady(){return this._whenReady.p}setReady(){this._whenReady.complete()}async _connectToDirectProxy(){if(this._directProxyClientEventually){await this._directProxyClientEventually.p;return}this._logService.debug("Starting pty host");let e=new Ko;this._directProxyClientEventually=e;let t=Tc.toService(n2(this._directProxyClientEventually.p.then(o=>o.getChannel("ptyHostWindow"))));this._directProxy=t,this._directProxyDisposables.clear(),this._remoteAgentService.getConnection()?.remoteAuthority||await this._lifecycleService.when(3),Mo("code/terminal/willConnectPtyHost"),this._logService.trace("Renderer->PtyHost#connect: before acquirePort"),JU("vscode:createPtyHostMessageChannel","vscode:createPtyHostMessageChannelResult").then(o=>{Mo("code/terminal/didConnectPtyHost"),this._logService.trace("Renderer->PtyHost#connect: connection established");let n=new N;this._directProxyDisposables.value=n;let r=n.add(new i$(o,`window:${this._nativeHostService.windowId}`));e.complete(r),this._onPtyHostConnected.fire(),n.add(t.onProcessData(s=>this._ptys.get(s.id)?.handleData(s.event))),n.add(t.onDidChangeProperty(s=>this._ptys.get(s.id)?.handleDidChangeProperty(s.property))),n.add(t.onProcessExit(s=>{let l=this._ptys.get(s.id);l&&(l.handleExit(s.event),l.dispose(),this._ptys.delete(s.id))})),n.add(t.onProcessReady(s=>this._ptys.get(s.id)?.handleReady(s.event))),n.add(t.onProcessReplay(s=>this._ptys.get(s.id)?.handleReplay(s.event))),n.add(t.onProcessOrphanQuestion(s=>this._ptys.get(s.id)?.handleOrphanQuestion())),n.add(t.onDidRequestDetach(s=>this._onDidRequestDetach.fire(s))),this.getEnvironment()})}async requestDetachInstance(e,t){return this._proxy.requestDetachInstance(e,t)}async acceptDetachInstanceReply(e,t){if(!t){this._logService.warn("Cannot attach to feature terminals, custom pty terminals, or those without a persistentProcessId");return}return this._proxy.acceptDetachInstanceReply(e,t)}async persistTerminalState(){let e=Array.from(this._ptys.keys()),t=await this._proxy.serializeTerminalState(e);this._storageService.store("terminal.integrated.bufferState",t,1,1)}async updateTitle(e,t,o){await this._proxy.updateTitle(e,t,o)}async updateIcon(e,t,o,n){await this._proxy.updateIcon(e,t,o,n)}async setNextCommandId(e,t,o){await this._proxy.setNextCommandId(e,t,o)}async updateProperty(e,t,o){return this._proxy.updateProperty(e,t,o)}async createProcess(e,t,o,n,r,s,l,c){await this._connectToDirectProxy();let u=await this._shellEnvironmentService.getShellEnv(),p=await this._proxy.createProcess(e,t,o,n,r,s,u,l,c,this._getWorkspaceId(),this._getWorkspaceName()),h=new Dmt(p,c,this._proxy);return this._ptys.set(p,h),h}async attachToProcess(e){await this._connectToDirectProxy();try{await this._proxy.attachToProcess(e);let t=new Dmt(e,!0,this._proxy);return this._ptys.set(e,t),t}catch(t){this._logService.warn(`Couldn't attach to process ${t.message}`)}}async attachToRevivedProcess(e){await this._connectToDirectProxy();try{let t=await this._proxy.getRevivedPtyNewId(this._getWorkspaceId(),e)??e;return await this.attachToProcess(t)}catch(t){this._logService.warn(`Couldn't attach to process ${t.message}`)}}async listProcesses(){return await this._connectToDirectProxy(),this._proxy.listProcesses()}async getLatency(){let e=[],t=new Dn;this._directProxy&&(await this._directProxy.getLatency(),t.stop(),e.push({label:"window<->ptyhost (message port)",latency:t.elapsed()}),t.reset());let o=await this._localPtyService.getLatency();return t.stop(),e.push({label:"window<->ptyhostservice<->ptyhost",latency:t.elapsed()}),[...e,...o]}async getPerformanceMarks(){return this._proxy.getPerformanceMarks()}async reduceConnectionGraceTime(){this._proxy.reduceConnectionGraceTime()}async getDefaultSystemShell(e){return this._proxy.getDefaultSystemShell(e)}async getProfiles(e,t,o){return this._localPtyService.getProfiles(this._workspaceContextService.getWorkspace().id,e,t,o)||[]}async getEnvironment(){return this._proxy.getEnvironment()}async getShellEnvironment(){let e={...await this._shellEnvironmentService.getShellEnv()};return this._environmentService.debugExtensionHost.env&&c1e(e,this._environmentService.debugExtensionHost.env),e}async getWslPath(e,t){return this._proxy.getWslPath(e,t)}async setTerminalLayoutInfo(e){let t={workspaceId:this._getWorkspaceId(),tabs:e?e.tabs:[],background:e?e.background:null};await this._proxy.setTerminalLayoutInfo(t),this._storageService.store("terminal.integrated.layoutInfo",JSON.stringify(t),1,1)}async getTerminalLayoutInfo(){let e=this._getWorkspaceId(),t={workspaceId:e},o=this._storageService.get("terminal.integrated.bufferState",1),n=this._deserializeTerminalState(o);if(n&&n.length>0)try{let r=this._historyService.getLastActiveWorkspaceRoot(),s=r?this._workspaceContextService.getWorkspaceFolder(r)??void 0:void 0,l=j3t(s,await this._terminalProfileResolverService.getEnvironment(this.remoteAuthority),this._configurationResolverService);Mo("code/terminal/willGetReviveEnvironments"),await Promise.all(n.map(u=>new Promise(p=>{this._resolveEnvironmentForRevive(l,u.shellLaunchConfig).then(h=>{u.processLaunchConfig.env=h,p()})}))),Mo("code/terminal/didGetReviveEnvironments"),Mo("code/terminal/willReviveTerminalProcesses"),await this._proxy.reviveTerminalProcesses(e,n,Intl.DateTimeFormat().resolvedOptions().locale),Mo("code/terminal/didReviveTerminalProcesses"),this._storageService.remove("terminal.integrated.bufferState",1);let c=this._storageService.get("terminal.integrated.layoutInfo",1);c&&(Mo("code/terminal/willSetTerminalLayoutInfo"),await this._proxy.setTerminalLayoutInfo(JSON.parse(c)),Mo("code/terminal/didSetTerminalLayoutInfo"),this._storageService.remove("terminal.integrated.layoutInfo",1))}catch(r){this._logService.warn("LocalTerminalBackend#getTerminalLayoutInfo Error",r.message??r)}return this._proxy.getTerminalLayoutInfo(t)}async _resolveEnvironmentForRevive(e,t){let o=ei?"windows":Ze?"osx":"linux",n=this._configurationService.getValue(`terminal.integrated.env.${o}`),r=await(t.useShellEnvironment?this.getShellEnvironment():this.getEnvironment()),s=await Q3t(t,n,e,this._productService.version,this._configurationService.getValue("terminal.integrated.detectLocale"),r);if(C5t(t)){let l=L6(t.cwd,this._workspaceContextService,this._historyService);await this._environmentVariableService.mergedCollection.applyToProcessEnvironment(s,{workspaceFolder:l},e)}return s}_getWorkspaceName(){return this._labelService.getWorkspaceLabel(this._workspaceContextService.getWorkspace())}installAutoReply(e,t){return this._proxy.installAutoReply(e,t)}uninstallAllAutoReplies(){return this._proxy.uninstallAllAutoReplies()}};I([hi],wSe.prototype,"getEnvironment",1),I([hi],wSe.prototype,"getShellEnvironment",1),wSe=I([m(0,Pe),m(1,ji),m(2,ca),m(3,rMt),m(4,rt),m(5,uSe),m(6,ce),m(7,Tp),m(8,B),m(9,tt),m(10,na),m(11,Ag),m(12,c2),m(13,na),m(14,ko),m(15,kr),m(16,bo),m(17,zr)],wSe);Uy(rMt,"localPty");Ee(Ag,uqe,1);var Qyn=ne.as(Qi.Workbench);It(CSe.ID,CSe,St.BlockStartup);Qyn.registerWorkbenchContribution(cqe,3);var MYt=class{constructor(i){this._theme=i,this._cache=Object.create(null),this._defaultColor="#000000";for(let e=0,t=this._theme.tokenColors.length;e<t;e++){let o=this._theme.tokenColors[e];o.scope||(this._defaultColor=o.settings.foreground)}}_generateExplanation(i,e){return`${i}: ${We.Format.CSS.formatHexA(e,!0).toUpperCase()}`}explainTokenColor(i,e){let t=this._findMatchingThemeRule(i);if(!t){let n=We.fromHex(this._defaultColor);if(!e.equals(n))throw new Error(`[${this._theme.label}]: Unexpected color ${We.Format.CSS.formatHexA(e)} for ${i}. Expected default ${We.Format.CSS.formatHexA(n)}`);return this._generateExplanation("default",e)}let o=We.fromHex(t.settings.foreground);if(!e.equals(o))throw new Error(`[${this._theme.label}]: Unexpected color ${We.Format.CSS.formatHexA(e)} for ${i}. Expected ${We.Format.CSS.formatHexA(o)} coming in from ${t.rawSelector}`);return this._generateExplanation(t.rawSelector,e)}_findMatchingThemeRule(i){return this._cache[i]||(this._cache[i]=rKt(this._theme,i.split(" "))),this._cache[i]}},Lmt=class{constructor(i,e,t,o){this.languageService=i;this.themeService=e;this.textMateService=t;this.modelService=o}_themedTokenize(i,e){let t=ic.getColorMap(),o=null,n=[],r=0;for(let s=0,l=e.length;s<l;s++){let c=e[s],u=i.tokenizeLine2(c,o);for(let p=0,h=u.tokens.length>>>1;p<h;p++){let g=u.tokens[p<<1],f=u.tokens[(p<<1)+1],v=p+1<h?u.tokens[p+1<<1]:c.length,b=c.substring(g,v),S=bp.getForeground(f);n[r++]={text:b,color:t[S]}}o=u.ruleStack}return n}_themedTokenizeTreeSitter(i,e){let t=ic.getColorMap(),o=Array(i.length),n=this.themeService.getColorTheme();for(let r=0,s=i.length;r<s;r++){let l=i[r],c=l.t.split(" "),u=TVt(n,c,this.languageService.languageIdCodec.encodeLanguageId(e),!1),p=bp.getForeground(u);o[r]={text:l.c,color:t[p]}}return o}_tokenize(i,e){let t=null,o=[],n=0;for(let r=0,s=e.length;r<s;r++){let l=e[r],c=i.tokenizeLine(l,t),u=null;for(let p=0,h=c.tokens.length;p<h;p++){let g=c.tokens[p],f=l.substring(g.startIndex,g.endIndex),v=g.scopes.join(" ");u===v?o[n-1].c+=f:(u=v,o[n++]={c:f,t:v,r:{dark_plus:void 0,light_plus:void 0,dark_vs:void 0,light_vs:void 0,hc_black:void 0}})}t=c.ruleStack}return o}async _getThemesResult(i,e){let t=this.themeService.getColorTheme(),o=l=>{let c="vscode-theme-defaults-themes-",u=l.indexOf(c);if(u!==-1)return l.substring(u+c.length,l.length-5)},n={},s=(await this.themeService.getColorThemes()).filter(l=>!!o(l.id));for(let l of s){let c=l.id;if(await this.themeService.setColorTheme(c,void 0)){let p=o(c);n[p]={document:new MYt(this.themeService.getColorTheme()),tokens:this._themedTokenize(i,e)}}}return await this.themeService.setColorTheme(t.id,void 0),n}async _getTreeSitterThemesResult(i,e){let t=this.themeService.getColorTheme(),o=l=>{let c="vscode-theme-defaults-themes-",u=l.indexOf(c);if(u!==-1)return l.substring(u+c.length,l.length-5)},n={},s=(await this.themeService.getColorThemes()).filter(l=>!!o(l.id));for(let l of s){let c=l.id;if(await this.themeService.setColorTheme(c,void 0)){let p=o(c);n[p]={document:new MYt(this.themeService.getColorTheme()),tokens:this._themedTokenizeTreeSitter(i,e)}}}return await this.themeService.setColorTheme(t.id,void 0),n}_enrichResult(i,e){let t={},o=Object.keys(e);for(let n of o)t[n]=0;for(let n=0,r=i.length;n<r;n++){let s=i[n];for(let l of o){let c=e[l].tokens[t[l]];c.text=c.text.substr(s.c.length),c.color&&(s.r[l]=e[l].document.explainTokenColor(s.t,c.color)),c.text.length===0&&t[l]++}}}_moveInjectionCursorToRange(i,e){let t=i.gotoFirstChild();for(;(i.startIndex<e.startIndex||i.endIndex>e.endIndex)&&t;)i.endIndex<e.startIndex?t=i.gotoNextSibling():t=i.gotoFirstChild()}async _treeSitterTokenize(i,e,t){let o=await Wf(i.tree);if(!o)return[];let n=o.walk();n.gotoFirstChild();let r=!0,s=[],l=[{cursor:n,languageId:t,startOffset:0,endOffset:i.textModel.getValueLength()}];do{let c=l[l.length-1],u=c.cursor,p=c.languageId,h=u.currentNode.endIndex>c.endOffset;if(!h&&u.currentNode.childCount===0){let g=new z(u.currentNode.startPosition.row+1,u.currentNode.startPosition.column+1,u.currentNode.endPosition.row+1,u.currentNode.endPosition.column+1),f=i.getInjectionTrees(u.currentNode.startIndex,p),v=f?.ranges.find(y=>y.startIndex<=u.currentNode.startIndex&&y.endIndex>=u.currentNode.endIndex),b=f?.tree.get(),S=f?.languageId;if(b&&S&&v&&v.startIndex===u.currentNode.startIndex){let y=b.walk();for(this._moveInjectionCursorToRange(y,v),l.push({cursor:y,languageId:S,startOffset:v.startIndex,endOffset:v.endIndex});u.endIndex<=v.endIndex&&(u.gotoNextSibling()||u.gotoParent()););}else{let y=e.captureAtRangeTree(g);for(s.push({c:u.currentNode.text.replace(/\r/g,""),t:y?.map(w=>w.name).join(" ")??"",r:{dark_plus:void 0,light_plus:void 0,dark_vs:void 0,light_vs:void 0,hc_black:void 0}});!(r=u.gotoNextSibling())&&(r=u.gotoParent()););}}else r=u.gotoFirstChild();l.length>1&&(!r&&u===l[l.length-1].cursor||h)&&(c.cursor.delete(),l.pop(),r=!0)}while(r);return n.delete(),s}captureSyntaxTokens(i,e){let t=this.languageService.guessLanguageIdByFilepathOrFirstLine(A.file(i));return this.textMateService.createTokenizer(t).then(o=>{if(!o)return[];let n=yc(e),r=this._tokenize(o,n);return this._getThemesResult(o,n).then(s=>(this._enrichResult(r,s),r.filter(l=>l.c.length>0)))})}async captureTreeSitterSyntaxTokens(i,e){let t=this.languageService.guessLanguageIdByFilepathOrFirstLine(i);if(!t)return[];let n=(this.modelService.getModel(i)??this.modelService.createModel(e,{languageId:t,onDidChange:U.None},i)).tokenization.tokens.get();if(!(n instanceof pz))return[];let r=n.tree,s=n.tokenizationImpl,l=r.get()??await Wf(r),c=s.get()??await Wf(s);if(!l)return[];let u=(await this._treeSitterTokenize(l,c,t)).filter(h=>h.c.length>0),p=await this._getTreeSitterThemesResult(u,t);return this._enrichResult(u,p),u}};Lmt=I([m(0,_t),m(1,sp),m(2,Z3),m(3,Tt)],Lmt);async function oNo(a,i,e=!1){let t=o=>{let n=a.get(fe),r=He(o),s=a.get(F).createInstance(Lmt);return n.readFile(o).then(l=>e?s.captureTreeSitterSyntaxTokens(o,l.value.toString()):s.captureSyntaxTokens(r,l.value.toString()))};if(i)return await t(i);{let o=a.get(ee),n=o.activeEditor?po.getCanonicalUri(o.activeEditor,{filterByScheme:Q.file}):null;n?t(n).then(r=>{console.log(r)}):console.log("No file editor active")}}$e.registerCommand("_workbench.captureSyntaxTokens",function(a,i){return oNo(a,i)});$e.registerCommand("_workbench.captureTreeSitterSyntaxTokens",function(a,i){return i||(i=a.get(ee).activeEditor?.resource),oNo(a,i,!0)});var Yyn=ne.as(Jt.Configuration);Yyn.registerConfiguration({properties:{"window.systemColorTheme":{type:"string",enum:["default","auto","light","dark"],enumDescriptions:[d(18213,null),d(18211,null),d(18214,null),d(18212,null)],markdownDescription:d(18210,null,UA("workbench.colorTheme"),UA("window.autoDetectColorScheme")),default:"default",included:!fn,scope:1,tags:[H3]}}});var pqe=class extends x{static{this.ID="workbench.contrib.userDataSyncServices"}constructor(i,e){super(),e.registerChannel("userDataSyncUtil",Tc.fromService(i,this._store))}};pqe=I([m(0,wee),m(1,Qb)],pqe);It(pqe.ID,pqe,St.BlockStartup);W(class extends K{constructor(){super({id:"workbench.userData.actions.openSyncBackupsFolder",title:L(16584,"Open Local Backups Folder"),category:Mh,menu:{id:D.CommandPalette,when:Ly.notEqualsTo("uninitialized")}})}async run(i){let e=i.get(Eo).userDataSyncHome,t=i.get(ko),o=i.get(fe),n=i.get(Ne);if(await o.exists(e)){let r=await o.resolve(e),s=r.children&&r.children[0]?r.children[0].resource:e;return t.showItemInFolder(s.with({scheme:Q.file}).fsPath)}else n.info(d(16582,null))}});W(class extends K{constructor(){super(CBt)}async run(i){let e=i.get(SI),t=i.get(Ne),o=i.get(ko),n=await e.downloadSyncActivity();n&&t.prompt(ft.Info,d(16581,null),[{label:d(16583,null),run:()=>o.showItemInFolder(n.fsPath)}])}});async function nNo(a,i=!1){return HMo(a,i,vV)}var xse=class{constructor(i,e,t,o,n,r,s,l,c){this.fileService=i;this.contextService=e;this.telemetryService=t;this.requestService=o;this.textFileService=n;this.workspaceTagsService=r;this.diagnosticsService=s;this.productService=l;this.nativeHostService=c;this.telemetryService.telemetryLevel===3&&this.report()}async report(){this.reportWindowsEdition(),this.workspaceTagsService.getTags().then(i=>this.reportWorkspaceTags(i),i=>mt(i)),this.reportCloudStats(),this.reportProxyStats(),this.getWorkspaceInformation().then(i=>this.diagnosticsService.reportWorkspaceStats(i))}async reportWindowsEdition(){if(!ei)return;let i=await this.nativeHostService.windowsGetStringRegKey("HKEY_LOCAL_MACHINE","SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion","EditionID");i===void 0&&(i="Unknown"),this.telemetryService.publicLog2("windowsEdition",{edition:i})}async getWorkspaceInformation(){let i=this.contextService.getWorkspace(),e=this.contextService.getWorkbenchState(),t=await this.workspaceTagsService.getTelemetryWorkspaceId(i,e);return{id:i.id,telemetryId:t,rendererSessionId:this.telemetryService.sessionId,folders:i.folders,transient:i.transient,configuration:i.configuration}}reportWorkspaceTags(i){this.telemetryService.publicLog("workspce.tags",i)}reportRemoteDomains(i){Promise.all(i.map(e=>{let t=e.path,o=e.with({path:`${t!=="/"?t:""}/.git/config`});return this.fileService.exists(o).then(n=>n?this.textFileService.read(o,{acceptTextOnly:!0}).then(r=>VMo(r.value,WMo),r=>[]):[])})).then(e=>{let t=e.reduce((n,r)=>r.reduce((s,l)=>s.add(l),n),new Set),o=[];t.forEach(n=>o.push(n)),this.telemetryService.publicLog("workspace.remotes",{domains:o.sort()})},mt)}reportRemotes(i){Promise.all(i.map(e=>this.workspaceTagsService.getHashedRemotesFromUri(e,!0))).then(()=>{},mt)}reportAzureNode(i,e){let t=i.map(o=>{let n=o.path;return o.with({path:`${n!=="/"?n:""}/node_modules`})});return this.fileService.resolveAll(t.map(o=>({resource:o}))).then(o=>{let n=[].concat(...o.map(s=>s.success?s.stat.children||[]:[])).map(s=>s.name);return xse.searchArray(n,/azure/i)&&(e.node=!0),e},o=>e)}static searchArray(i,e){return i.some(t=>t.search(e)>-1)||void 0}reportAzureJava(i,e){return Promise.all(i.map(t=>{let o=t.path,n=t.with({path:`${o!=="/"?o:""}/pom.xml`});return this.fileService.exists(n).then(r=>r?this.textFileService.read(n,{acceptTextOnly:!0}).then(s=>!!s.value.match(/azure/i),s=>!1):!1)})).then(t=>(t.indexOf(!0)!==-1&&(e.java=!0),e))}reportAzure(i){let e=Object.create(null);this.reportAzureNode(i,e).then(t=>this.reportAzureJava(i,t)).then(t=>{Object.keys(t).length&&this.telemetryService.publicLog("workspace.azure",t)}).then(void 0,mt)}reportCloudStats(){let i=this.contextService.getWorkspace().folders.map(e=>e.uri);i.length&&this.fileService&&(this.reportRemoteDomains(i),this.reportRemotes(i),this.reportAzure(i))}reportProxyStats(){let i=this.productService.downloadUrl;i&&this.requestService.resolveProxy(i).then(e=>{let t=e?String(e).trim().split(/\s+/,1)[0]:"EMPTY";["DIRECT","PROXY","HTTPS","SOCKS","EMPTY"].indexOf(t)===-1&&(t="UNKNOWN")}).then(void 0,mt)}};xse=I([m(0,fe),m(1,Pe),m(2,Te),m(3,Ea),m(4,Uo),m(5,FKe),m(6,fMe),m(7,tt),m(8,ko)],xse);var rNo=/group\s*:\s*[\'\"](.*?)[\'\"]\s*,\s*name\s*:\s*[\'\"](.*?)[\'\"]\s*,\s*version\s*:\s*[\'\"](.*?)[\'\"]/g,sNo=/[\'\"]([^\'\"\s]*?)\:([^\'\"\s]*?)\:([^\'\"\s]*?)[\'\"]/g,aNo=/<dependencies>([\s\S]*?)<\/dependencies>/g,lNo=/<dependency>([\s\S]*?)<\/dependency>/g,cNo=/<groupId>([\s\S]*?)<\/groupId>/,dNo=/<artifactId>([\s\S]*?)<\/artifactId>/,uNo=[{predicate:(a,i)=>a==="com.microsoft.azure"&&i==="azure",tag:"azure"},{predicate:(a,i)=>a==="com.microsoft.azure"&&i.startsWith("azure-mgmt-"),tag:"azure"},{predicate:(a,i)=>a.startsWith("com.microsoft.azure")&&i.startsWith("azure-mgmt-"),tag:"azure"},{predicate:(a,i)=>a==="com.azure.resourcemanager"&&i.startsWith("azure-resourcemanager"),tag:"azure"},{predicate:(a,i)=>a==="javax"&&i==="javaee-api",tag:"javaee"},{predicate:(a,i)=>a==="javax.xml.bind"&&i==="jaxb-api",tag:"javaee"},{predicate:(a,i)=>a==="mysql"&&i==="mysql-connector-java",tag:"jdbc"},{predicate:(a,i)=>a==="com.microsoft.sqlserver"&&i==="mssql-jdbc",tag:"jdbc"},{predicate:(a,i)=>a==="com.oracle.database.jdbc"&&i.startsWith("ojdbc"),tag:"jdbc"},{predicate:(a,i)=>a==="org.hibernate",tag:"jpa"},{predicate:(a,i)=>a==="org.eclipse.persistence"&&i==="eclipselink",tag:"jpa"},{predicate:(a,i)=>a==="org.projectlombok",tag:"lombok"},{predicate:(a,i)=>a==="org.springframework.data"&&i==="spring-data-redis",tag:"redis"},{predicate:(a,i)=>a==="redis.clients"&&i==="jedis",tag:"redis"},{predicate:(a,i)=>a==="org.redisson",tag:"redis"},{predicate:(a,i)=>a==="io.lettuce"&&i==="lettuce-core",tag:"redis"},{predicate:(a,i)=>a==="org.springframework.boot",tag:"springboot"},{predicate:(a,i)=>a==="org.jooq",tag:"sql"},{predicate:(a,i)=>a==="org.mybatis",tag:"sql"},{predicate:(a,i)=>a==="org.junit.jupiter"&&i==="junit-jupiter-api",tag:"unitTest"},{predicate:(a,i)=>a==="junit"&&i==="junit",tag:"unitTest"},{predicate:(a,i)=>a==="org.testng"&&i==="testng",tag:"unitTest"},{predicate:(a,i)=>a==="com.azure"&&i.includes("cosmos"),tag:"azure-cosmos"},{predicate:(a,i)=>a==="com.azure.spring"&&i.includes("cosmos"),tag:"azure-cosmos"},{predicate:(a,i)=>a==="com.azure"&&i.includes("azure-storage"),tag:"azure-storage"},{predicate:(a,i)=>a==="com.azure.spring"&&i.includes("storage"),tag:"azure-storage"},{predicate:(a,i)=>a==="com.azure"&&i==="azure-messaging-servicebus",tag:"azure-servicebus"},{predicate:(a,i)=>a==="com.azure.spring"&&i.includes("servicebus"),tag:"azure-servicebus"},{predicate:(a,i)=>a==="com.azure"&&i.startsWith("azure-messaging-eventhubs"),tag:"azure-eventhubs"},{predicate:(a,i)=>a==="com.azure.spring"&&i.includes("eventhubs"),tag:"azure-eventhubs"},{predicate:(a,i)=>a==="dev.langchain4j",tag:"langchain4j"},{predicate:(a,i)=>a==="io.springboot.ai",tag:"springboot-ai"},{predicate:(a,i)=>a==="com.microsoft.semantic-kernel",tag:"semantic-kernel"},{predicate:(a,i)=>a==="com.azure"&&i==="azure-ai-anomalydetector",tag:"azure-ai-anomalydetector"},{predicate:(a,i)=>a==="com.azure"&&i==="azure-ai-formrecognizer",tag:"azure-ai-formrecognizer"},{predicate:(a,i)=>a==="com.azure"&&i==="azure-ai-documentintelligence",tag:"azure-ai-documentintelligence"},{predicate:(a,i)=>a==="com.azure"&&i==="azure-ai-translation-document",tag:"azure-ai-translation-document"},{predicate:(a,i)=>a==="com.azure"&&i==="azure-ai-personalizer",tag:"azure-ai-personalizer"},{predicate:(a,i)=>a==="com.azure"&&i==="azure-ai-translation-text",tag:"azure-ai-translation-text"},{predicate:(a,i)=>a==="com.azure"&&i==="azure-ai-contentsafety",tag:"azure-ai-contentsafety"},{predicate:(a,i)=>a==="com.azure"&&i==="azure-ai-vision-imageanalysis",tag:"azure-ai-vision-imageanalysis"},{predicate:(a,i)=>a==="com.azure"&&i==="azure-ai-textanalytics",tag:"azure-ai-textanalytics"},{predicate:(a,i)=>a==="com.azure"&&i==="azure-search-documents",tag:"azure-search-documents"},{predicate:(a,i)=>a==="com.azure"&&i==="azure-ai-documenttranslator",tag:"azure-ai-documenttranslator"},{predicate:(a,i)=>a==="com.azure"&&i==="azure-ai-vision-face",tag:"azure-ai-vision-face"},{predicate:(a,i)=>a==="com.azure"&&i==="azure-ai-openai-assistants",tag:"azure-ai-openai-assistants"},{predicate:(a,i)=>a==="com.microsoft.azure.cognitiveservices",tag:"azure-cognitiveservices"},{predicate:(a,i)=>a==="com.microsoft.cognitiveservices.speech",tag:"azure-cognitiveservices-speech"},{predicate:(a,i)=>a==="com.theokanning.openai-gpt3-java",tag:"openai"},{predicate:(a,i)=>a==="com.azure"&&i==="azure-ai-openai",tag:"azure-openai"},{predicate:(a,i)=>a==="com.microsoft.azure.functions"&&i==="azure-functions-java-library",tag:"azure-functions"},{predicate:(a,i)=>a==="io.quarkus",tag:"quarkus"},{predicate:(a,i)=>a.startsWith("org.eclipse.microprofile"),tag:"microprofile"},{predicate:(a,i)=>a==="io.micronaut",tag:"micronaut"},{predicate:(a,i)=>a.startsWith("org.graalvm"),tag:"graalvm"}];var Xyn=["@azure","@azure/ai","@azure/core","@azure/cosmos","@azure/event","@azure/identity","@azure/keyvault","@azure/search","@azure/storage"],Jyn=["@types/vscode","@vscode/dts","@types/node","@types/bun","bun-types","@types/web","express","sails","koa","hapi","socket.io","restify","next","nuxt","@nestjs/core","strapi","gatsby","fastify","hono","react","react-native","react-native-macos","react-native-windows","rnpm-plugin-windows","@types/react","@angular/core","@ionic","vue","tns-core-modules","@nativescript/core","electron","@remix-run/react","@remix-run/express","@remix-run/node","@remix-run/dev","@sveltejs/kit","preact","@preact/signals","@builder.io/qwik","alpinejs","astro","htmx.org","solid-js","svelte","lit-html","vuepress","aws-sdk","aws-amplify","azure","azure-storage","chroma","deepseek-js","docusaurus","faiss","firebase","@google-cloud/common","heroku-cli","langchain","milvus","openai","pinecone","praisonai","qdrant","typescript","@typescript/native-preview","tslib","eslint","oxlint","oxfmt","typescript-eslint","prettier","dprint","@dprint/formatter","@babel/cli","@babel/core","@swc/cli","@swc/core","vite","esbuild","rollup","rolldown","nx","turbo","webpack","parcel","@biomejs/biome","@rspack/core","@rspack/cli","@trpc/client","@trpc/server","zod","pyright","ts-morph","oxc-minify","oxc-transform","oxc-resolver","vue-tsc","svelte-check","tsup","tsdown","@microsoft/teams-js","@microsoft/office-js","@microsoft/office-js-helpers","@types/office-js","@types/office-runtime","office-ui-fabric-react","@uifabric/icons","@uifabric/merge-styles","@uifabric/styling","@uifabric/experiments","@uifabric/utilities","@microsoft/rush","lerna","just-task","beachball","playwright","playwright-cli","@playwright/test","playwright-core","playwright-chromium","playwright-firefox","playwright-webkit","chai","cypress","gherkin","jest","mocha","nightwatch","protractor","puppeteer","selenium-webdriver","vitest","webdriverio","@azure/app-configuration","@azure/cosmos-sign","@azure/cosmos-language-service","@azure/synapse-spark","@azure/synapse-monitoring","@azure/synapse-managed-private-endpoints","@azure/synapse-artifacts","@azure/synapse-access-control","@azure/ai-metrics-advisor","@azure/service-bus","@azure/keyvault-secrets","@azure/keyvault-keys","@azure/keyvault-certificates","@azure/keyvault-admin","@azure/digital-twins-core","@azure/cognitiveservices-anomalydetector","@azure/ai-anomaly-detector","@azure/core-xml","@azure/core-tracing","@azure/core-paging","@azure/core-https","@azure/core-client","@azure/core-asynciterator-polyfill","@azure/core-arm","@azure/amqp-common","@azure/core-lro","@azure/logger","@azure/core-http","@azure/core-auth","@azure/core-amqp","@azure/abort-controller","@azure/eventgrid","@azure/storage-file-datalake","@azure/search-documents","@azure/storage-file","@azure/storage-datalake","@azure/storage-queue","@azure/storage-file-share","@azure/storage-blob-changefeed","@azure/storage-blob","@azure/cognitiveservices-formrecognizer","@azure/ai-form-recognizer","@azure/cognitiveservices-textanalytics","@azure/ai-text-analytics","@azure/event-processor-host","@azure/schema-registry-avro","@azure/schema-registry","@azure/eventhubs-checkpointstore-blob","@azure/event-hubs","@azure/communication-signaling","@azure/communication-calling","@azure/communication-sms","@azure/communication-common","@azure/communication-chat","@azure/communication-administration","@azure/attestation","@azure/data-tables","@azure/arm-appservice","@azure-rest/ai-inference","@azure-rest/arm-appservice","@azure/arm-appcontainers","@azure/arm-rediscache","@azure/arm-redisenterprisecache","@azure/arm-apimanagement","@azure/arm-logic","@azure/app-configuration","@azure/arm-appconfiguration","@azure/arm-dashboard","@azure/arm-signalr","@azure/arm-securitydevops","@azure/arm-labservices","@azure/web-pubsub","@azure/web-pubsub-client","@azure/web-pubsub-client-protobuf","@azure/web-pubsub-express","@azure/openai","@azure/arm-hybridkubernetes","@azure/arm-kubernetesconfiguration","ai","@anthropic-ai/sdk","@anthropic-ai/tokenizer","@arizeai/openinference-instrumentation-langchain","@arizeai/openinference-instrumentation-openai","@aws-sdk-client-bedrock-runtime","@aws-sdk/client-bedrock","@datastax/astra-db-ts","fireworks-js","@google-cloud/aiplatform","@huggingface/inference","humanloop","@langchain/anthropic","langsmith","llamaindex","@google-cloud/aiplatform","@mistralai/mistralai","mongodb","neo4j-driver","ollama","onnxruntime-node","onnxruntime-web","pg","postgresql","redis","@supabase/supabase-js","@tensorflow/tfjs","@xenova/transformers","tika","weaviate-client","@zilliz/milvus2-sdk-node","@azure-rest/ai-anomaly-detector","@azure-rest/ai-content-safety","@azure-rest/ai-document-intelligence","@azure-rest/ai-document-translator","@azure-rest/ai-personalizer","@azure-rest/ai-translation-text","@azure-rest/ai-vision-image-analysis","@azure/ai-anomaly-detector","@azure/ai-form-recognizer","@azure/ai-language-conversations","@azure/ai-language-text","@azure/ai-text-analytics","@azure/arm-botservice","@azure/arm-cognitiveservices","@azure/arm-machinelearning","@azure/cognitiveservices-contentmoderator","@azure/cognitiveservices-customvision-prediction","@azure/cognitiveservices-customvision-training","@azure/cognitiveservices-face","@azure/cognitiveservices-translatortext","microsoft-cognitiveservices-speech-sdk","@google/generative-ai"],Zyn=["azure-ai","azure-cognitiveservices","azure-core","azure-cosmos","azure-event","azure-identity","azure-keyvault","azure-mgmt","azure-ml","azure-search","azure-storage"],ewn=["azure","azure-ai-agents","azure-ai-inference","azure-ai-language-conversations","azure-ai-language-questionanswering","azure-ai-ml","azure-ai-projects","azure-ai-translation-document","azure-appconfiguration","azure-appconfiguration-provider","azure-loganalytics","azure-synapse-nspkg","azure-synapse-spark","azure-synapse-artifacts","azure-synapse-accesscontrol","azure-synapse","azure-cognitiveservices-vision-nspkg","azure-cognitiveservices-search-nspkg","azure-cognitiveservices-nspkg","azure-cognitiveservices-language-nspkg","azure-cognitiveservices-knowledge-nspkg","azure-containerregistry","azure-communication-identity","azure-communication-phonenumbers","azure-communication-email","azure-communication-rooms","azure-communication-callautomation","azure-confidentialledger","azure-containerregistry","azure-developer-loadtesting","azure-iot-deviceupdate","azure-messaging-webpubsubservice","azure-monitor","azure-monitor-query","azure-monitor-ingestion","azure-mgmt-appcontainers","azure-mgmt-apimanagement","azure-mgmt-web","azure-mgmt-redis","azure-mgmt-redisenterprise","azure-mgmt-logic","azure-appconfiguration","azure-appconfiguration-provider","azure-mgmt-appconfiguration","azure-mgmt-dashboard","azure-mgmt-signalr","azure-messaging-webpubsubservice","azure-mgmt-webpubsub","azure-mgmt-securitydevops","azure-mgmt-labservices","azure-ai-metricsadvisor","azure-servicebus","azureml-sdk","azure-keyvault-nspkg","azure-keyvault-secrets","azure-keyvault-keys","azure-keyvault-certificates","azure-keyvault-administration","azure-digitaltwins-nspkg","azure-digitaltwins-core","azure-cognitiveservices-anomalydetector","azure-ai-anomalydetector","azure-applicationinsights","azure-core-tracing-opentelemetry","azure-core-tracing-opencensus","azure-nspkg","azure-common","azure-eventgrid","azure-storage-file-datalake","azure-search-nspkg","azure-search-documents","azure-storage-nspkg","azure-storage-file","azure-storage-common","azure-storage-queue","azure-storage-file-share","azure-storage-blob-changefeed","azure-storage-blob","azure-cognitiveservices-formrecognizer","azure-ai-formrecognizer","azure-ai-nspkg","azure-cognitiveservices-language-textanalytics","azure-ai-textanalytics","azure-schemaregistry-avroencoder","azure-schemaregistry-avroserializer","azure-schemaregistry","azure-eventhub-checkpointstoreblob-aio","azure-eventhub-checkpointstoreblob","azure-eventhub","azure-servicefabric","azure-communication-nspkg","azure-communication-sms","azure-communication-chat","azure-communication-administration","azure-security-attestation","azure-data-nspkg","azure-data-tables","azure-devtools","azure-elasticluster","azure-functions","azure-graphrbac","azure-iothub-device-client","azure-shell","azure-translator","azure-mgmt-hybridkubernetes","azure-mgmt-kubernetesconfiguration","a2a-sdk","adal","agents","pydocumentdb","botbuilder-core","botbuilder-schema","botframework-connector","codegen","deepseek","fabric-data-agent-sdk","google-adk","playwright","praisonai","pydantic-ai","python-rai","transformers","langchain","llama-index","google-cloud-aiplatform","guidance","openai","semantic-kernel","sentence-transformers","smolagents","stripe-agent-toolkit","anthropic","aporia","arize","deepchecks","fireworks-ai","langchain-fireworks","humanloop","pymongo","langchain-anthropic","langchain-huggingface","langchain-fireworks","ollama","onnxruntime","pgvector","sentence-transformers","tika","trulens","trulens-eval","wandb","azure-ai-contentsafety","azure-ai-documentintelligence","azure-ai-translation-text","azure-ai-vision","azure-cognitiveservices-language-luis","azure-cognitiveservices-speech","azure-cognitiveservices-vision-contentmoderator","azure-cognitiveservices-vision-face","azure-mgmt-cognitiveservices","azure-mgmt-search","google-generativeai"],twn=["github.com/Azure/azure-sdk-for-go/sdk/storage/azblob","github.com/Azure/azure-sdk-for-go/sdk/storage/azfile","github.com/Azure/azure-sdk-for-go/sdk/storage/azqueue","github.com/Azure/azure-sdk-for-go/sdk/storage/azdatalake","github.com/Azure/azure-sdk-for-go/sdk/tracing/azotel","github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azadmin","github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azcertificates","github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys","github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets","github.com/Azure/azure-sdk-for-go/sdk/monitor/azquery","github.com/Azure/azure-sdk-for-go/sdk/monitor/azingest","github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventhubs","github.com/Azure/azure-sdk-for-go/sdk/messaging/azservicebus","github.com/Azure/azure-sdk-for-go/sdk/data/azappconfig","github.com/Azure/azure-sdk-for-go/sdk/data/azcosmos","github.com/Azure/azure-sdk-for-go/sdk/data/aztables","github.com/Azure/azure-sdk-for-go/sdk/containers/azcontainerregistry","github.com/Azure/azure-sdk-for-go/sdk/ai/azopenai","github.com/Azure/azure-sdk-for-go/sdk/azidentity","github.com/Azure/azure-sdk-for-go/sdk/azcore","github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/"],Rmt=class{constructor(i,e,t,o){this.fileService=i;this.contextService=e;this.environmentService=t;this.textFileService=o}async getTags(){return this._tags||(this._tags=await this.resolveWorkspaceTags()),this._tags}async getTelemetryWorkspaceId(i,e){function t(n){return vV(n.scheme===Q.file?n.fsPath:n.toString())}let o;switch(e){case 1:o=void 0;break;case 2:o=await t(i.folders[0].uri);break;case 3:i.configuration&&(o=await t(i.configuration))}return o}getHashedRemotesFromUri(i,e=!1){let t=i.path,o=i.with({path:`${t!=="/"?t:""}/.git/config`});return this.fileService.exists(o).then(n=>n?this.textFileService.read(o,{acceptTextOnly:!0}).then(r=>nNo(r.value,e),r=>[]):[])}async resolveWorkspaceTags(){let i=Object.create(null),e=this.contextService.getWorkbenchState(),t=this.contextService.getWorkspace();i["workspace.id"]=await this.getTelemetryWorkspaceId(t,e);let{filesToOpenOrCreate:o,filesToDiff:n,filesToMerge:r}=this.environmentService;i["workbench.filesToOpenOrCreate"]=o&&o.length||0,i["workbench.filesToDiff"]=n&&n.length||0,i["workbench.filesToMerge"]=r&&r.length||0;let s=e===1;i["workspace.roots"]=s?0:t.folders.length,i["workspace.empty"]=s;let l=s?void 0:t.folders.map(u=>u.uri);if(!l||!l.length)return Promise.resolve(i);let c=A.joinPath(this.environmentService.workspaceStorageHome,"aiGeneratedWorkspaces.json");return await this.fileService.exists(c).then(async u=>{if(u)try{let p=await this.fileService.readFile(c);JSON.parse(p.value.toString()).indexOf(t.folders[0].uri.toString())>-1&&(i.aiGenerated=!0)}catch{}}),this.fileService.resolveAll(l.map(u=>({resource:u}))).then(u=>{let p=[].concat(...u.map(oe=>oe.success?oe.stat.children||[]:[])).map(oe=>oe.name),h=p.reduce((oe,de)=>oe.add(de.toLowerCase()),new Set);i["workspace.grunt"]=h.has("gruntfile.js"),i["workspace.gulp"]=h.has("gulpfile.js"),i["workspace.jake"]=h.has("jakefile.js"),i["workspace.tsconfig"]=h.has("tsconfig.json"),i["workspace.jsconfig"]=h.has("jsconfig.json"),i["workspace.config.xml"]=h.has("config.xml"),i["workspace.vsc.extension"]=h.has("vsc-extension-quickstart.md"),i["workspace.ASP5"]=h.has("project.json")&&this.searchArray(p,/^.+\.cs$/i),i["workspace.sln"]=this.searchArray(p,/^.+\.sln$|^.+\.csproj$/i),i["workspace.unity"]=h.has("assets")&&h.has("library")&&h.has("projectsettings"),i["workspace.npm"]=h.has("package.json")||h.has("node_modules"),i["workspace.bower"]=h.has("bower.json")||h.has("bower_components"),i["workspace.azure.yaml"]=h.has("azure.yaml")||h.has("azure.yml"),i["workspace.java.pom"]=h.has("pom.xml"),i["workspace.java.gradle"]=h.has("build.gradle")||h.has("settings.gradle")||h.has("build.gradle.kts")||h.has("settings.gradle.kts")||h.has("gradlew")||h.has("gradlew.bat"),i["workspace.yeoman.code.ext"]=h.has("vsc-extension-quickstart.md"),i["workspace.py.requirements"]=h.has("requirements.txt"),i["workspace.py.requirements.star"]=this.searchArray(p,/^(.*)requirements(.*)\.txt$/i),i["workspace.py.Pipfile"]=h.has("pipfile"),i["workspace.py.conda"]=this.searchArray(p,/^environment(\.yml$|\.yaml$)/i),i["workspace.py.setup"]=h.has("setup.py"),i["workspace.py.manage"]=h.has("manage.py"),i["workspace.py.setupcfg"]=h.has("setup.cfg"),i["workspace.py.app"]=h.has("app.py"),i["workspace.py.pyproject"]=h.has("pyproject.toml"),i["workspace.go.mod"]=h.has("go.mod");let g=h.has("mainactivity.cs")||h.has("mainactivity.fs"),f=h.has("appdelegate.cs")||h.has("appdelegate.fs"),v=h.has("androidmanifest.xml"),b=h.has("platforms"),S=h.has("plugins"),y=h.has("www"),w=h.has("properties"),k=h.has("resources"),T=h.has("jni");i["workspace.config.xml"]&&!i["workspace.language.cs"]&&!i["workspace.language.vb"]&&!i["workspace.language.aspx"]&&(b&&S&&y?i["workspace.cordova.high"]=!0:i["workspace.cordova.low"]=!0),i["workspace.config.xml"]&&!i["workspace.language.cs"]&&!i["workspace.language.vb"]&&!i["workspace.language.aspx"]&&h.has("ionic.config.json")&&(i["workspace.ionic"]=!0),g&&w&&k&&(i["workspace.xamarin.android"]=!0),f&&k&&(i["workspace.xamarin.ios"]=!0),v&&T&&(i["workspace.android.cpp"]=!0);function P(oe,de,Ce,xe){return h.has(oe)?l.map(ze=>{let De=ze.with({path:`${ze.path!=="/"?ze.path:""}/${oe}`});return de.exists(De).then(Oe=>{if(Oe)return Ce.read(De,{acceptTextOnly:!0}).then(xe)},Oe=>{})}):[]}function O(oe){ewn.indexOf(oe)>-1&&(i["workspace.py."+oe]=!0);for(let de of Zyn)oe.startsWith(de)&&(i["workspace.py."+de]=!0);i["workspace.py.any-azure"]||(i["workspace.py.any-azure"]=/azure/i.test(oe))}let V=P("requirements.txt",this.fileService,this.textFileService,oe=>{let de=yc(oe.value);for(let Ce of de){let xe=Ce.split("=="),ze=Ce.split(">="),De=(xe.length===2?xe[0]:ze[0]).trim();O(De)}}),H=P("pipfile",this.fileService,this.textFileService,oe=>{let de=yc(oe.value);de=de.slice(de.indexOf("[packages]")+1);for(let Ce of de){if(Ce.trim().indexOf("[")>-1)break;if(Ce.indexOf("=")===-1)continue;let xe=Ce.split("=")[0].trim();O(xe)}}),G=P("package.json",this.fileService,this.textFileService,oe=>{try{let de=JSON.parse(oe.value),Ce=Object.keys(de.dependencies||{}).concat(Object.keys(de.devDependencies||{}));for(let xe of Ce)if(xe.startsWith("react-native"))i["workspace.reactNative"]=!0;else if(xe==="tns-core-modules"||xe==="@nativescript/core")i["workspace.nativescript"]=!0;else if(Jyn.indexOf(xe)>-1)i["workspace.npm."+xe]=!0;else for(let ze of Xyn)xe.startsWith(ze)&&(i["workspace.npm."+ze]=!0)}catch{}}),$=P("go.mod",this.fileService,this.textFileService,oe=>{try{let de=yc(oe.value),Ce=!1;for(let xe=0;xe<de.length;xe++){let ze=de[xe].trim();if(ze.startsWith("require (")){if(Ce)break;Ce=!0;continue}if(ze.startsWith(")"))break;if(Ce&&ze!==""){let De=ze.split(" ")[0].trim();for(let Oe of twn)De.startsWith(Oe)&&(i["workspace.go.mod."+De]=!0)}}}catch{}}),J=P("pom.xml",this.fileService,this.textFileService,oe=>{try{let de;for(;de=aNo.exec(oe.value);){let Ce;for(;Ce=lNo.exec(de[1]);){let xe=cNo.exec(Ce[1]),ze=dNo.exec(Ce[1]);xe&&ze&&this.tagJavaDependency(xe[1],ze[1],"workspace.pom.",i)}}}catch{}}),ae=P("build.gradle",this.fileService,this.textFileService,oe=>{try{this.processGradleDependencies(oe.value,rNo,i),this.processGradleDependencies(oe.value,sNo,i)}catch{}}),he=l.map(oe=>{let de=A.joinPath(oe,"/app/src/main/AndroidManifest.xml");return this.fileService.exists(de).then(Ce=>{Ce&&(i["workspace.java.android"]=!0)},Ce=>{})});return Promise.all([...G,...V,...H,...J,...ae,...he,...$]).then(()=>i)})}processGradleDependencies(i,e,t){let o;for(;o=e.exec(i);){let n=o[1],r=o[2];n&&r&&this.tagJavaDependency(n,r,"workspace.gradle.",t)}}tagJavaDependency(i,e,t,o){for(let n of uNo)if(n.predicate(i,e)){o[t+n.tag]=!0;return}}searchArray(i,e){return i.some(t=>t.search(e)>-1)||void 0}};Rmt=I([m(0,fe),m(1,Pe),m(2,At),m(3,Uo)],Rmt);Ee(FKe,Rmt,1);ne.as(Qi.Workbench).registerWorkbenchContribution(xse,4);var mqe=class{constructor(i,e,t,o,n,r,s,l,c,u,p){this._dialogService=i;this._environmentService=e;this._textModelResolverService=t;this._clipboardService=o;this._openerService=s;this._nativeHostService=l;this._productService=c;this._fileService=u;this._labelService=p;Promise.all([n.when(4),r.whenInstalledExtensionsRegistered()]).then(()=>{this._stopProfiling()})}_stopProfiling(){if(!this._environmentService.args["prof-startup-prefix"])return;let i=A.file(this._environmentService.args["prof-startup-prefix"]),e=ci(i),t=He(i),o=["--prof-startup"];this._fileService.readFile(i).then(r=>o.push(...r.toString().split("|"))).then(()=>this._fileService.del(i,{recursive:!0})).then(()=>new Promise(r=>{let s=()=>{this._fileService.exists(i).then(l=>{l?r():setTimeout(s,500)})};s()})).then(()=>this._fileService.del(i,{recursive:!0})).then(()=>this._fileService.resolve(e).then(r=>(r.children?r.children.filter(s=>s.resource.path.includes(t)):[]).map(s=>s.resource))).then(r=>{let s=r.reduce((l,c)=>`${l}${this._labelService.getUriLabel(c)}
`,`
`);return this._dialogService.confirm({type:"info",message:d(12948,null),detail:d(12946,null,s),primaryButton:d(12951,null),cancelButton:d(12949,null)}).then(l=>{l.confirmed?Promise.all([this._nativeHostService.showItemInFolder(r[0].fsPath),this._createPerfIssue(r.map(c=>He(c)))]).then(()=>this._dialogService.confirm({type:"info",message:d(12952,null),detail:d(12947,null,this._productService.nameLong),primaryButton:d(12950,null)}).then(c=>{c.confirmed&&this._nativeHostService.relaunch({removeArgs:o})})):this._nativeHostService.relaunch({removeArgs:o})})})}async _createPerfIssue(i){let e=this._productService.reportIssueUrl;if(!e)return;let t=QA.get(),o=await this._textModelResolverService.createModelReference(t.getInputUri());try{await this._clipboardService.writeText(o.object.textEditorModel.getValue())}finally{o.dispose()}let n=`
1. :warning: We have copied additional data to your clipboard. Make sure to **paste** here. :warning:
1. :warning: Make sure to **attach** these files from your *home*-directory: :warning:
${i.map(l=>`-\`${l}\``).join(`
`)}
`,r=e,s=r.indexOf("?")===-1?"?":"&";this._openerService.open(A.parse(`${r}${s}body=${encodeURIComponent(n)}`))}};mqe=I([m(0,at),m(1,zr),m(2,Bt),m(3,Fi),m(4,ji),m(5,lt),m(6,Je),m(7,ko),m(8,tt),m(9,fe),m(10,rt)],mqe);var xSe=class{constructor(i,e,t,o,n){this._editorService=i;this._paneCompositeService=e;this._lifecycleService=t;this._updateService=o;this._workspaceTrustService=n}async _isStandardStartup(){if(this._lifecycleService.startupKind!==1)return uTt(this._lifecycleService.startupKind);if(!this._workspaceTrustService.isWorkspaceTrusted())return"Workspace not trusted";let i=this._paneCompositeService.getActivePaneComposite(0);if(!i||i.getId()!==nv)return"Explorer viewlet not visible";let e=this._editorService.visibleEditorPanes;if(e.length!==1)return`Expected text editor count : 1, Actual : ${e.length}`;if(!pn(e[0].getControl()))return"Active editor is not a text editor";let t=this._paneCompositeService.getActivePaneComposite(1);if(t)return`Current active panel : ${this._paneCompositeService.getPaneComposite(t.getId(),1)?.name}`;if(await this._updateService.isLatestVersion()===!1)return"Not on latest version, updates available"}};xSe=I([m(0,ee),m(1,us),m(2,ji),m(3,zd),m(4,Nr)],xSe);var PYt=class extends xSe{constructor(e,t,o,n,r,s,l,c,u,p){super(e,t,o,n,r);this.timerService=s;this.logService=l;this.environmentService=c;this.telemetryService=u;this.productService=p;this.logPerfMarks()}async logPerfMarks(){if(!this.environmentService.profDurationMarkers)return;await this.timerService.whenReady();let e=await this._isStandardStartup(),t=await this.timerService.perfBaseline,[o,n]=this.environmentService.profDurationMarkers,r=`${this.timerService.getDuration(o,n)}	${this.productService.nameShort}	${(this.productService.commit||"").slice(0,10)||"0000000000"}	${this.telemetryService.sessionId}	${e===void 0?"standard_start":"NO_standard_start : "+e}	${String(t).padStart(4,"0")}ms
`;this.logService.info(`[prof-timers] ${r}`)}};PYt=I([m(0,ee),m(1,us),m(2,ji),m(3,zd),m(4,Nr),m(5,YC),m(6,se),m(7,cd),m(8,Te),m(9,tt)],PYt);var AYt=class{constructor(i){for(let e of performance.getEntriesByType("resource"))try{let t=new URL(e.name),o=Oo.basename(t.pathname);i.publicLog2("startup.resource.perf",{hosthash:`H${_r(t.host).toString(16)}`,name:o,duration:e.duration})}catch{}}};AYt=I([m(0,Te)],AYt);var hqe=class extends xSe{constructor(e,t,o,n,r,s,l,c,u,p,h){super(n,r,l,c,h);this._fileService=e;this._timerService=t;this._nativeHostService=o;this._telemetryService=s;this._environmentService=u;this._productService=p;this._report().catch(mt)}async _report(){let e=await this._isStandardStartup();this._appendStartupTimes(e).catch(mt)}async _appendStartupTimes(e){let t=this._environmentService.args["prof-append-timers"],o=this._environmentService.args["prof-duration-markers"],n=this._environmentService.args["prof-duration-markers-file"];if(!(!t&&!o))try{await Promise.all([this._timerService.whenReady(),Li(15e3)]);let r=await this._timerService.perfBaseline,s=await this._resolveStartupHeapStatistics();if(s&&this._telemetryLogHeapStatistics(s),t){let l=di([this._timerService.startupMetrics.ellapsed,this._productService.nameShort,(this._productService.commit||"").slice(0,10)||"0000000000",this._telemetryService.sessionId,e===void 0?"standard_start":`NO_standard_start : ${e}`,`${String(r).padStart(4,"0")}ms`,s?this._printStartupHeapStatistics(s):void 0]).join("	")+`
`;await this._appendContent(A.file(t),l)}if(o?.length){let l=[];for(let u of o){let p=0;if(u==="ellapsed")p=this._timerService.startupMetrics.ellapsed;else if(u.indexOf("-")!==-1){let h=u.split("-");h.length===2&&(p=this._timerService.getDuration(h[0],h[1]))}p&&(l.push(u),l.push(`${p}`))}let c=`${l.join("	")}
`;n?await this._appendContent(A.file(n),c):console.log(c)}}catch(r){console.error(r)}finally{this._nativeHostService.exit(0)}}async _isStandardStartup(){let e=await this._nativeHostService.getWindowCount();return e!==1?`Expected window count : 1, Actual : ${e}`:super._isStandardStartup()}async _appendContent(e,t){let o=[];await this._fileService.exists(e)&&o.push((await this._fileService.readFile(e)).value),o.push(qe.fromString(t)),await this._fileService.writeFile(e,qe.concat(o))}async _resolveStartupHeapStatistics(){if(!this._environmentService.args["enable-tracing"]||!this._environmentService.args["trace-startup-file"]||this._environmentService.args["trace-startup-format"]!=="json"||!this._environmentService.args["trace-startup-duration"])return;let e=await this._nativeHostService.getProcessId(),t=performance.memory?.usedJSHeapSize??0,o=0,n=0,r=0,s=0;try{let l=JSON.parse((await this._fileService.readFile(A.file(this._environmentService.args["trace-startup-file"]))).value.toString());for(let c of l.traceEvents)if(c.pid===e){switch(c.name){case"MinorGC":o++;break;case"MajorGC":n++;break;case"V8.GCFinalizeMC":case"V8.GCScavenger":s+=c.dur;break}(c.name==="MajorGC"||c.name==="MinorGC")&&typeof c.args?.usedHeapSizeAfter=="number"&&typeof c.args.usedHeapSizeBefore=="number"&&(r+=c.args.usedHeapSizeBefore-c.args.usedHeapSizeAfter)}return{minorGCs:o,majorGCs:n,used:t,garbage:r,duration:Math.round(s/1e3)}}catch(l){console.error(l)}}_telemetryLogHeapStatistics({used:e,garbage:t,majorGCs:o,minorGCs:n,duration:r}){this._telemetryService.publicLog2("startupHeapStatistics",{heapUsed:e,heapGarbage:t,majorGCs:o,minorGCs:n,gcsDuration:r})}_printStartupHeapStatistics({used:e,garbage:t,majorGCs:o,minorGCs:n,duration:r}){return`Heap: ${Math.round(e/1048576)}MB (used) ${Math.round(t/1048576)}MB (garbage) ${o} (MajorGC) ${n} (MinorGC) ${r}ms (GC duration)`}};hqe=I([m(0,fe),m(1,YC),m(2,ko),m(3,ee),m(4,us),m(5,Te),m(6,ji),m(7,zd),m(8,zr),m(9,tt),m(10,Nr)],hqe);var gqe=class{constructor(i,e,t,o,n,r,s){this._environmentService=i;this._fileService=e;this._logService=t;KF(i).isExtensionDevTestFromCli||n.perfBaseline.then(c=>{if((i.isBuilt?t.info:t.trace).apply(t,[`[perf] Render performance baseline is ${c}ms`]),c<0)return;let u=c*10,p=new PerformanceObserver(async h=>{p.takeRecords();let g=h.getEntries().map(v=>v.duration).reduce((v,b)=>Math.max(v,b),0);if(g<u)return;if(!r.getValue("application.experimental.rendererProfiling")){t.debug(`[perf] SLOW task detected (${g}ms) but renderer profiling is disabled via 'application.experimental.rendererProfiling'`);return}let f=xt();t.warn(`[perf] Renderer reported VERY LONG TASK (${g}ms), starting profiling session '${f}'`),p.disconnect();for(let v=0;v<3;v++)try{let b=await o.profileRenderer(f,5e3);if(await s.analyseBottomUp(b,y=>"<<renderer>>",c,!0)===2){this._store(b,f);break}Li(15e3)}catch(b){t.error(b);break}p.observe({entryTypes:["longtask"]})});p.observe({entryTypes:["longtask"]}),this._observer=p})}dispose(){this._observer?.disconnect()}async _store(i,e){let t=Ge(this._environmentService.tmpDir,`renderer-${Math.random().toString(16).slice(2,8)}.cpuprofile.json`);await this._fileService.writeFile(t,qe.fromString(JSON.stringify(i))),this._logService.info(`[perf] stored profile to DISK '${t}'`,e)}};gqe=I([m(0,zr),m(1,fe),m(2,se),m(3,ko),m(4,YC),m(5,B),m(6,fmt)],gqe);ne.as(Qi.Workbench).registerWorkbenchContribution(gqe,4);ne.as(Qi.Workbench).registerWorkbenchContribution(mqe,3);ne.as(Qi.Workbench).registerWorkbenchContribution(hqe,4);ne.as(Jt.Configuration).registerConfiguration({...FRt,properties:{"application.experimental.rendererProfiling":{type:"boolean",default:!1,tags:["experimental"],markdownDescription:d(12945,null),experiment:{mode:"startup"}}}});var Mmt=class extends $b{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,P,O,V,H,G,$,J,ae,he,oe,de,Ce,xe,ze,De,Oe,pt,et,Ti){super(i,e,t,o,n,r,s,l,c,u,p,g,f,v,b,S,y,w,k,T,P,O,V,H,G,$,J,ae,he,oe,de,Ce,xe,h,De,ze,pt,et,Ti),this._register(h.onBeforeShutdown(Ht=>Ht.veto(this.beforeShutdown(),"veto.tasks")))}_getTaskSystem(){if(this._taskSystem)return this._taskSystem;let i=this._createTerminalTaskSystem();return this._taskSystem=i,this._taskSystemListeners=[this._taskSystem.onDidStateChange(e=>{this._taskRunningState.set(this._taskSystem.isActiveSync()),this._onDidStateChange.fire(e)})],this._taskSystem}_computeLegacyConfiguration(i){let{config:e,hasParseErrors:t}=this._getConfiguration(i);return t?Promise.resolve({workspaceFolder:i,hasErrors:!0,config:void 0}):e?Promise.resolve({workspaceFolder:i,config:e,hasErrors:!1}):Promise.resolve({workspaceFolder:i,hasErrors:!0,config:void 0})}_versionAndEngineCompatible(i){let e=i&&i.version?i.version:void 0,t=this.executionEngine;return e===void 0||n9e("0.1.0",e)&&t===1||n9e("2.0.0",e)&&t===2}beforeShutdown(){if(!this._taskSystem||!this._taskSystem.isActiveSync()||this._taskSystem instanceof _re)return!1;let i;return this._taskSystem.canAutoTerminate()?i=Promise.resolve({confirmed:!0}):i=this._dialogService.confirm({message:d(14722,null),primaryButton:d(14723,null)}),i.then(e=>e.confirmed?this._taskSystem.terminateAll().then(t=>{let o=!0,n;for(let r of t)o=o&&r.success,n===void 0&&r.code!==void 0&&(n=r.code);return o?(this._taskSystem=void 0,this._disposeTaskSystemListeners(),!1):n&&n===3?this._dialogService.confirm({message:d(14721,null),primaryButton:d(14720,null),type:"info"}).then(r=>!r.confirmed):!0},t=>!0):!0)}};Mmt=I([m(0,B),m(1,oa),m(2,kl),m(3,us),m(4,$t),m(5,ge),m(6,ee),m(7,fe),m(8,Pe),m(9,Te),m(10,Uo),m(11,ji),m(12,Tt),m(13,lt),m(14,Ue),m(15,Tp),m(16,nn),m(17,lc),m(18,ce),m(19,Fo),m(20,Je),m(21,at),m(22,Ne),m(23,X),m(24,At),m(25,Ag),m(26,An),m(27,Bt),m(28,Go),m(29,Bi),m(30,Vu),m(31,Nr),m(32,se),m(33,Le),m(34,F),m(35,bo),m(36,lr),m(37,mi),m(38,cr),m(39,Zt)],Mmt);Ee(Og,Mmt,1);var NYt=le("externalTerminal");Uy(NYt,"externalTerminal");var pNo="workbench.action.terminal.openNativeConsole";Ct.registerCommandAndKeybindingRule({id:pNo,primary:3105,when:dt.notFocus,weight:200,handler:async a=>{let i=a.get(na),e=a.get(NYt),t=a.get(B),o=a.get(Uc),n=a.get(Pe),r=a.get(Ue),s=a.get(rt),l=t.getValue("terminal.external"),c=n.getWorkspace().folders,u;if(c.length>1){let h=c.map(f=>({label:f.name,description:s.getUriLabel(f.uri,{relative:!0})})),g=await r.pick(h,{placeHolder:d(10756,null)});if(!g)return;u=c[h.indexOf(g)].uri}else u=i.getLastActiveWorkspaceRoot();if(u?.scheme===Q.file){e.openTerminal(l,u.fsPath);return}try{if(u?.scheme===Q.vscodeRemote){let h=await o.getCanonicalURI(u);if(h.scheme===Q.file){e.openTerminal(l,h.fsPath);return}}}catch{}let p=i.getLastActiveFile(Q.file);if(p?.scheme===Q.file){e.openTerminal(l,ad(p.fsPath));return}try{if(p?.scheme===Q.vscodeRemote){let h=await o.getCanonicalURI(p);if(h.scheme===Q.file){e.openTerminal(l,h.fsPath);return}}}catch{}e.openTerminal(l,void 0)}});ve.appendMenuItem(D.CommandPalette,{command:{id:pNo,title:L(10755,"Open New External Terminal")}});var Pmt=class{constructor(i){this._externalTerminalService=i;this._updateConfiguration()}async _updateConfiguration(){let i=await this._externalTerminalService.getDefaultTerminalForPlatforms(),e=ne.as(Jt.Configuration),t={type:"string",enum:["integrated","external","both"],enumDescriptions:[d(10763,null),d(10762,null),d(10761,null)],default:"integrated"};e.registerConfiguration({id:"externalTerminal",order:100,title:d(10764,null),type:"object",properties:{"terminal.explorerKind":{...t,description:d(10754,null)},"terminal.sourceControlRepositoriesKind":{...t,description:d(10757,null)},"terminal.external.windowsExec":{type:"string",description:d(10760,null),default:i.windows,scope:1},"terminal.external.osxExec":{type:"string",description:d(10759,null),default:i.osx,scope:1},"terminal.external.linuxExec":{type:"string",description:d(10758,null),default:i.linux,scope:1}}})}};Pmt=I([m(0,NYt)],Pmt);var iwn=ne.as(Qi.Workbench);iwn.registerWorkbenchContribution(Pmt,3);var OYt=class extends K{constructor(){super({id:"workbench.action.webview.openDeveloperTools",title:L(16621,"Open Webview Developer Tools"),category:Ve.Developer,metadata:{description:d(16620,null)},f1:!0})}async run(i){let e=i.get(ko);Ki().document.querySelectorAll("iframe.webview.ready").length&&(console.info(d(16619,null)),e.openDevTools())}};var fqe=class extends x{constructor(e,t){super();this._themeService=e;this._configurationService=t;this._cachedWebViewThemeData=void 0;this._onThemeDataChanged=this._register(new E);this.onThemeDataChanged=this._onThemeDataChanged.event;this._register(this._themeService.onDidColorThemeChange(()=>{this._reset()}));let o=["editor.fontFamily","editor.fontWeight","editor.fontSize","editor.fontLigatures","accessibility.underlineLinks"];this._register(this._configurationService.onDidChangeConfiguration(n=>{o.some(r=>n.affectsConfiguration(r))&&this._reset()}))}getTheme(){return this._themeService.getColorTheme()}getWebviewThemeData(){if(!this._cachedWebViewThemeData){let e=this._configurationService.getValue("editor"),t=e.fontFamily||fu.fontFamily,o=e.fontWeight||fu.fontWeight,n=e.fontSize||fu.fontSize,r=new Bx().validate(e.fontLigatures),s=this._configurationService.getValue("accessibility.underlineLinks"),l=this._themeService.getColorTheme(),c=Dye().getColors().reduce((f,v)=>{let b=l.getColor(v.id);return b&&(f["vscode-"+v.id.replace(".","-")]=b.toString()),f},{}),u=EZe(),p=u.getSizes().reduce((f,v)=>{let b=u.resolveDefaultSize(v.id,l);return b&&(f["vscode-"+v.id.replace(/\./g,"-")]=xZe(b)),f},{}),h={"vscode-font-family":NO,"vscode-font-weight":"normal","vscode-font-size":"13px","vscode-editor-font-family":t,"vscode-editor-font-weight":o,"vscode-editor-font-size":n+"px","text-link-decoration":s?"underline":"none",...c,...p,"vscode-editor-font-feature-settings":r},g=FYt.fromTheme(l);this._cachedWebViewThemeData={styles:h,activeTheme:g,themeLabel:l.label,themeId:l.settingsId}}return this._cachedWebViewThemeData}_reset(){this._cachedWebViewThemeData=void 0,this._onThemeDataChanged.fire()}};fqe=I([m(0,sp),m(1,B)],fqe);var FYt=(o=>(o.light="vscode-light",o.dark="vscode-dark",o.highContrast="vscode-high-contrast",o.highContrastLight="vscode-high-contrast-light",o))(FYt||{});(i=>{function a(e){switch(e.type){case"light":return"vscode-light";case"dark":return"vscode-dark";case"hcDark":return"vscode-high-contrast";case"hcLight":return"vscode-high-contrast-light"}}i.fromTheme=a})(FYt||={});var WYt=class{constructor(i,e,t){this._getExtensionLocation=i;this._getMappings=e;this.tunnelService=t;this._tunnels=new Map}async getRedirect(i,e){let t=A.parse(e),o=IDe(t);if(o){for(let n of this._getMappings())if(n.webviewPort===o.port){let r=this._getExtensionLocation();if(r&&r.scheme===Q.vscodeRemote){let s=i&&await this.getOrCreateTunnel(i,n.extensionHostPort);if(s)return s.tunnelLocalPort===n.webviewPort?void 0:encodeURI(t.with({authority:`127.0.0.1:${s.tunnelLocalPort}`}).toString(!0))}if(n.webviewPort!==n.extensionHostPort)return encodeURI(t.with({authority:`${o.address}:${n.extensionHostPort}`}).toString(!0))}}}async dispose(){for(let i of this._tunnels.values())await i.dispose();this._tunnels.clear()}async getOrCreateTunnel(i,e){let t=this._tunnels.get(e);if(t)return t;let o=await this.tunnelService.openTunnel({getAddress:async()=>i},void 0,e),n;return typeof o=="string"&&(n=void 0),n&&this._tunnels.set(e,n),n}};var nwn=new Map([[".svg","image/svg+xml"],[".txt",tr.text],[".css","text/css"],[".js","application/javascript"],[".cjs","application/javascript"],[".mjs","application/javascript"],[".json","application/json"],[".html","text/html"],[".htm","text/html"],[".xhtml","application/xhtml+xml"],[".oft","font/otf"],[".xml","application/xml"],[".wasm","application/wasm"]]);function mNo(a){let i=qm(a.fsPath).toLowerCase();return nwn.get(i)||GI(a.fsPath)||tr.unknown}var f9;(n=>{let a;(u=>(u[u.Success=0]="Success",u[u.Failed=1]="Failed",u[u.AccessDenied=2]="AccessDenied",u[u.NotModified=3]="NotModified"))(a=n.Type||={});class i{constructor(s,l,c,u){this.stream=s;this.etag=l;this.mtime=c;this.mimeType=u;this.type=0}}n.StreamSuccess=i,n.Failed={type:1},n.AccessDenied={type:2};class o{constructor(s,l){this.mimeType=s;this.mtime=l;this.type=3}}n.NotModified=o})(f9||={});async function hNo(a,i,e,t,o,n){let r=rwn(a,i.roots,e);if(o.trace(`Webview.loadLocalResource - trying to load resource. requestUri=${a}, resourceToLoad=${r}`),!r)return o.trace(`Webview.loadLocalResource - access denied. requestUri=${a}, resourceToLoad=${r}`),f9.AccessDenied;let s=mNo(a);try{let l=await t.readFileStream(r,{etag:i.ifNoneMatch},n);return o.trace(`Webview.loadLocalResource - Loaded. requestUri=${a}, resourceToLoad=${r}`),new f9.StreamSuccess(l.value,l.etag,l.mtime,s)}catch(l){return l instanceof ta&&l.fileOperationResult===2?(o.trace(`Webview.loadLocalResource - not modified. requestUri=${a}, resourceToLoad=${r}`),new f9.NotModified(s,l.options?.mtime)):(o.error(`Webview.loadLocalResource - Error using fileReader. requestUri=${a}, resourceToLoad=${r}`),f9.Failed)}}function rwn(a,i,e){let t=a.with({query:""});for(let o of i)if(swn(o,t,e))return awn(a)}function swn(a,i,e){return e.extUri.isEqual(a,i,!0)?!1:a.scheme===Q.file&&O$(a.fsPath)?i.scheme===Q.file&&O$(i.fsPath)?e.extUri.isEqualOrParent(i.with({path:i.path.toLowerCase(),authority:i.authority.toLowerCase()}),a.with({path:a.path.toLowerCase(),authority:a.authority.toLowerCase()}),!0):!1:e.extUri.isEqualOrParent(i,a,!0)}function awn(a){return a.scheme===Q.vscodeRemote?A.from({scheme:Q.vscodeRemote,authority:a.authority,path:"/vscode-resource",query:JSON.stringify({requestResourcePath:a.path})}):a}var vqe=class extends gre{constructor(e,t,o,n,r,s,l){super({showCommonFindToggles:!1,checkImeCompletionState:e.checkImeCompletionState,enableSash:!0},t,o,n,r,s,l);this._delegate=e;this._findWidgetFocused=FK.bindTo(o),this._register(e.hasFindResult(c=>{this.updateButtons(c),this.focusFindBox()})),this._register(e.onDidStopFind(()=>{this.updateButtons(!1)}))}async _getResultCount(e){}find(e){let t=this.inputValue;t&&this._delegate.find(t,e)}hide(e=!0){super.hide(e),this._delegate.stopFind(!0),this._delegate.focus()}_onInputChanged(){let e=this.inputValue;return e?this._delegate.updateFind(e):this._delegate.stopFind(!1),!1}_onFocusTrackerFocus(){this._findWidgetFocused.set(!0)}_onFocusTrackerBlur(){this._findWidgetFocused.reset()}_onFindInputFocusTrackerFocus(){}_onFindInputFocusTrackerBlur(){}findFirst(){}};vqe=I([m(1,Wn),m(2,X),m(3,nt),m(4,_e),m(5,B),m(6,Oi)],vqe);var VYt;(t=>{let a;(r=>(r[r.Initializing=0]="Initializing",r[r.Ready=1]="Ready"))(a=t.Type||={});class i{constructor(n){this.pendingMessages=n;this.type=0}}t.Initializing=i,t.Ready={type:1}})(VYt||={});var lwn="webviewId",kse=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.webviewThemeDataProvider=t;this._environmentService=s;this._fileService=l;this._logService=c;this._remoteAuthorityResolverService=u;this._tunnelService=p;this._accessibilityService=g;this._uriIdentityService=f;this.id=xt();this._windowId=void 0;this._expectedServiceWorkerVersion=4;this._state=new VYt.Initializing([]);this._resourceLoadingCts=this._register(new Ye);this._focusDelayer=this._register(new ya(50));this._onDidHtmlChange=this._register(new E);this.onDidHtmlChange=this._onDidHtmlChange.event;this._messageHandlers=new Map;this.checkImeCompletionState=!0;this.intrinsicContentSize=Me("WebviewIntrinsicContentSize",void 0);this._disposed=!1;this._onMissingCsp=this._register(new E);this.onMissingCsp=this._onMissingCsp.event;this._onDidClickLink=this._register(new E);this.onDidClickLink=this._onDidClickLink.event;this._onMessage=this._register(new E);this.onMessage=this._onMessage.event;this._onDidScroll=this._register(new E);this.onDidScroll=this._onDidScroll.event;this._onDidWheel=this._register(new E);this.onDidWheel=this._onDidWheel.event;this._onDidUpdateState=this._register(new E);this.onDidUpdateState=this._onDidUpdateState.event;this._onDidFocus=this._register(new E);this.onDidFocus=this._onDidFocus.event;this._onDidBlur=this._register(new E);this.onDidBlur=this._onDidBlur.event;this._onFatalError=this._register(new E);this.onFatalError=this._onFatalError.event;this._onDidDispose=this._register(new E);this.onDidDispose=this._onDidDispose.event;this._hasAlertedAboutMissingCsp=!1;this._hasFindResult=this._register(new E);this.hasFindResult=this._hasFindResult.event;this._onDidStopFind=this._register(new E);this.onDidStopFind=this._onDidStopFind.event;this.providedViewType=e.providedViewType,this.origin=e.origin??this.id,this._options=e.options,this.extension=e.extension,this._content={html:"",title:e.title,options:e.contentOptions,state:void 0},this._portMappingManager=this._register(new WYt(()=>this.extension?.location,()=>this._content.options.portMapping||[],this._tunnelService)),this._element=this._createElement(e.options,e.contentOptions),this._register(this.on("no-csp-found",()=>{this.handleNoCspFound()})),this._register(this.on("did-click-link",({uri:v})=>{this._onDidClickLink.fire(v)})),this._register(this.on("onmessage",({message:v,transfer:b})=>{this._onMessage.fire({message:v,transfer:b})})),this._register(this.on("did-scroll",({scrollYPercentage:v})=>{this._onDidScroll.fire({scrollYPercentage:v})})),this._register(this.on("do-reload",()=>{this.reload()})),this._register(this.on("do-update-state",v=>{this.state=v,this._onDidUpdateState.fire(v)})),this._register(this.on("did-focus",()=>{this.handleFocusChange(!0)})),this._register(this.on("did-blur",()=>{this.handleFocusChange(!1)})),this._register(this.on("did-scroll-wheel",v=>{this._onDidWheel.fire(v)})),this._register(this.on("did-find",({didFind:v})=>{this._hasFindResult.fire(v)})),this._register(this.on("fatal-error",v=>{r.error(d(16588,null,v.message)),this._onFatalError.fire({message:v.message})})),this._register(this.on("did-keydown",v=>{this.handleKeyEvent("keydown",v)})),this._register(this.on("did-keyup",v=>{this.handleKeyEvent("keyup",v)})),this._register(this.on("did-context-menu",v=>{if(!this.element||!this._contextKeyService)return;let b=this.element.getBoundingClientRect(),S=this._contextKeyService.createOverlay([...Object.entries(v.context),[lwn,this.providedViewType]]);n.showContextMenu({menuId:D.WebviewContext,menuActionOptions:{shouldForwardArgs:!0},contextKeyService:S,getActionsContext:()=>({...v.context,webview:this.providedViewType}),getAnchor:()=>({x:b.x+v.clientX,y:b.y+v.clientY})}),this._send("set-context-menu-visible",{visible:!0})})),this._register(this.on("load-resource",async v=>{try{let b=Pho(v.authority),S=A.from({scheme:v.scheme,authority:b,path:decodeURIComponent(v.path),query:v.query?decodeURIComponent(v.query):v.query});this.loadResource(v.id,S,v.ifNoneMatch)}catch{this._send("did-load-resource",{id:v.id,status:404,path:v.path})}})),this._register(this.on("load-localhost",v=>{this.localLocalhost(v.id,v.origin)})),this._register(U.runAndSubscribe(t.onThemeDataChanged,()=>this.style())),this._register(g.onDidChangeReducedMotion(()=>this.style())),this._register(g.onDidChangeScreenReaderOptimized(()=>this.style())),this._register(n.onDidHideContextMenu(()=>this._send("set-context-menu-visible",{visible:!1}))),this._confirmBeforeClose=o.getValue("window.confirmBeforeClose"),this._register(o.onDidChangeConfiguration(v=>{v.affectsConfiguration("window.confirmBeforeClose")&&(this._confirmBeforeClose=o.getValue("window.confirmBeforeClose"),this._send("set-confirm-before-close",this._confirmBeforeClose))})),this._register(this.on("drag-start",()=>{this._startBlockingIframeDragEvents()})),this._register(this.on("drag",v=>{this.handleDragEvent("drag",v)})),this._register(this.on("updated-intrinsic-content-size",v=>{this.intrinsicContentSize.set({width:v.width,height:v.height},void 0,void 0)})),e.options.enableFindWidget&&(this._webviewFindWidget=this._register(h.createInstance(vqe,this)))}get window(){return typeof this._windowId=="number"?rb(this._windowId)?.window:void 0}get platform(){return"browser"}get element(){return this._element}get isFocused(){return!(!this._focused||!this.window||this.window.document.activeElement&&this.window.document.activeElement!==this.element)}dispose(){if(this._disposed=!0,this.element?.remove(),this._element=void 0,this._messagePort=void 0,this._state.type===0){for(let e of this._state.pendingMessages)e.resolve(!1);this._state.pendingMessages=[]}this._onDidDispose.fire(),this._resourceLoadingCts.dispose(!0),super.dispose()}setContextKeyService(e){this._contextKeyService=e}postMessage(e,t){return this._send("message",{message:e,transfer:t})}async _send(e,t,o=[]){if(this._state.type===0){let{promise:n,resolve:r}=WI();return this._state.pendingMessages.push({channel:e,data:t,transferable:o,resolve:r}),n}else return this.doPostMessage(e,t,o)}_createElement(e,t){let o=document.createElement("iframe");o.name=this.id,o.className=`webview ${e.customClasses||""}`,o.sandbox.add("allow-scripts","allow-same-origin","allow-forms","allow-pointer-lock","allow-downloads");let n=["cross-origin-isolated","autoplay","local-network-access"];return Ac||n.push("clipboard-read","clipboard-write"),o.setAttribute("allow",n.join("; ")),o.style.border="none",o.style.width="100%",o.style.height="100%",o.focus=()=>{this._doFocus()},o}_initElement(e,t,o,n){let r={id:this.id,parentId:n.vscodeWindowId.toString(),origin:this.origin,swVersion:String(this._expectedServiceWorkerVersion),extensionId:t?.id.value??"",platform:this.platform,"vscode-resource-base-authority":zEi,parentOrigin:n.origin};this._options.disableServiceWorker&&(r.disableServiceWorker="true"),this._environmentService.remoteAuthority&&(r.remoteAuthority=this._environmentService.remoteAuthority),o.purpose&&(r.purpose=o.purpose),Jse.addSearchParam(r,!0,!0);let s=new URLSearchParams(r).toString();this.perfMark("init/set-src"),this.element.setAttribute("src",`${this.webviewContentEndpoint(e)}/index.html?${s}`)}mountTo(e,t){if(this.element){this._windowId=t.vscodeWindowId,this._encodedWebviewOriginPromise=Aht(t.origin,this.origin).then(o=>this._encodedWebviewOrigin=o),this._encodedWebviewOriginPromise.then(o=>{this._disposed||this._initElement(o,this.extension,this._options,t)}),this._registerMessageHandler(t),this._webviewFindWidget&&e.appendChild(this._webviewFindWidget.getDomNode());for(let o of[re.MOUSE_DOWN,re.MOUSE_MOVE,re.DROP])this._register(j(e,o,()=>{this._stopBlockingIframeDragEvents()}));for(let o of[e,t])this._register(j(o,re.DRAG_END,()=>{this._stopBlockingIframeDragEvents()}));e.id=this.id,this.perfMark("mounted"),e.appendChild(this.element)}}_registerMessageHandler(e){let t=this._register(j(e,"message",o=>{if(!(!this._encodedWebviewOrigin||o?.data?.target!==this.id)){if(o.origin!==this._webviewContentOrigin(this._encodedWebviewOrigin)){console.log(`Skipped renderer receiving message due to mismatched origins: ${o.origin} ${this._webviewContentOrigin}`);return}if(o.data.channel==="webview-ready"){if(this._messagePort)return;this.perfMark("webview-ready"),this._logService.trace(`Webview(${this.id}): webview ready`),this._messagePort=o.ports[0],this._messagePort.onmessage=n=>{let r=this._messageHandlers.get(n.data.channel);if(!r){console.log(`No handlers found for '${n.data.channel}'`);return}r?.forEach(s=>s(n.data.data,n))},this.element?.classList.add("ready"),this._state.type===0&&this._state.pendingMessages.forEach(({channel:n,data:r,resolve:s})=>s(this.doPostMessage(n,r))),this._state=VYt.Ready,t.dispose()}}}))}perfMark(e){performance.mark(`webview/webviewElement/${e}`,{detail:{id:this.id}})}_startBlockingIframeDragEvents(){this.element&&(this.element.style.pointerEvents="none")}_stopBlockingIframeDragEvents(){this.element&&(this.element.style.pointerEvents="auto")}webviewContentEndpoint(e){let t=this._environmentService.webviewExternalEndpoint;if(!t)throw new Error("'webviewExternalEndpoint' has not been configured. Webviews will not work!");let o=t.replace("{{uuid}}",e);return o[o.length-1]==="/"?o.slice(0,o.length-1):o}_webviewContentOrigin(e){let t=A.parse(this.webviewContentEndpoint(e));return t.scheme+"://"+t.authority.toLowerCase()}doPostMessage(e,t,o=[]){return this.element&&this._messagePort?(this._messagePort.postMessage({channel:e,args:t},o),!0):!1}on(e,t){let o=this._messageHandlers.get(e);return o||(o=new Set,this._messageHandlers.set(e,o)),o.add(t),Z(()=>{this._messageHandlers.get(e)?.delete(t)})}handleNoCspFound(){this._hasAlertedAboutMissingCsp||(this._hasAlertedAboutMissingCsp=!0,this.extension?.id&&this._environmentService.isExtensionDevelopment&&this._onMissingCsp.fire(this.extension.id))}reload(){this.doUpdateContent(this._content)}reinitializeAfterDismount(){this._state=new VYt.Initializing([]),this._messagePort=void 0,this.mountTo(this.element.parentElement,Re(this.element)),this.style(),this.reload()}setHtml(e){this.doUpdateContent({...this._content,html:e}),this._onDidHtmlChange.fire(e)}setTitle(e){this._content={...this._content,title:e},this._send("set-title",e)}set contentOptions(e){if(this._logService.debug(`Webview(${this.id}): will update content options`),vto(e,this._content.options)){this._logService.debug(`Webview(${this.id}): skipping content options update`);return}this.doUpdateContent({...this._content,options:e})}set localResourcesRoot(e){this._content={...this._content,options:{...this._content.options,localResourceRoots:e}}}set state(e){this._content={...this._content,state:e}}set initialScrollProgress(e){this._send("initial-scroll-position",e)}doUpdateContent(e){this._logService.debug(`Webview(${this.id}): will update content`),this._content=e;let t=!!this._content.options.allowScripts;this.perfMark("set-content"),this._send("content",{contents:this._content.html,title:this._content.title,options:{allowMultipleAPIAcquire:!!this._content.options.allowMultipleAPIAcquire,allowScripts:t,allowForms:this._content.options.allowForms??t},state:this._content.state,cspSource:She,confirmBeforeClose:this._confirmBeforeClose})}style(){let{styles:e,activeTheme:t,themeLabel:o,themeId:n}=this.webviewThemeDataProvider.getWebviewThemeData();this._options.transformCssVariables&&(e=this._options.transformCssVariables(e));let r=this._accessibilityService.isMotionReduced(),s=this._accessibilityService.isScreenReaderOptimized();this._send("styles",{styles:e,activeTheme:t,themeId:n,themeLabel:o,reduceMotion:r,screenReader:s})}handleFocusChange(e){this._focused=e,e?this._onDidFocus.fire():this._onDidBlur.fire()}handleKeyEvent(e,t){let o=new KeyboardEvent(e,t);Object.defineProperty(o,"target",{get:()=>this.element}),this.window?.dispatchEvent(o)}handleDragEvent(e,t){let o=new DragEvent(e,t);Object.defineProperty(o,"target",{get:()=>this.element}),this.window?.dispatchEvent(o)}windowDidDragStart(){this._startBlockingIframeDragEvents()}windowDidDragEnd(){this._stopBlockingIframeDragEvents()}selectAll(){this.execCommand("selectAll")}copy(){this.execCommand("copy")}paste(){this.execCommand("paste")}cut(){this.execCommand("cut")}undo(){this.execCommand("undo")}redo(){this.execCommand("redo")}execCommand(e){this.element&&this._send("execCommand",e)}async loadResource(e,t,o){try{let n=await hNo(t,{ifNoneMatch:o,roots:this._content.options.localResourceRoots||[]},this._uriIdentityService,this._fileService,this._logService,this._resourceLoadingCts.token);switch(n.type){case f9.Type.Success:{let r=await this.streamToBuffer(n.stream);return this._send("did-load-resource",{id:e,status:200,path:t.path,mime:n.mimeType,data:r,etag:n.etag,mtime:n.mtime},[r])}case f9.Type.NotModified:return this._send("did-load-resource",{id:e,status:304,path:t.path,mime:n.mimeType,mtime:n.mtime});case f9.Type.AccessDenied:return this._send("did-load-resource",{id:e,status:401,path:t.path})}}catch{}return this._send("did-load-resource",{id:e,status:404,path:t.path})}async streamToBuffer(e){return(await tb(e)).buffer.buffer}async localLocalhost(e,t){let o=this._environmentService.remoteAuthority,n=o?await this._remoteAuthorityResolverService.resolveAuthority(o):void 0,r=n?await this._portMappingManager.getRedirect(n.authority,t):void 0;return this._send("did-load-localhost",{id:e,origin:t,location:r})}focus(){this._doFocus(),this.handleFocusChange(!0)}_doFocus(){if(this.element){try{this.element.contentWindow?.focus()}catch{}this._focusDelayer.trigger(async()=>{!this.isFocused||!this.element||this.window?.document.activeElement&&this.window.document.activeElement!==this.element&&this.window.document.activeElement?.tagName!=="BODY"||(this.window?.document.body?.focus(),this._send("focus",void 0))})}}find(e,t){this.element&&this._send("find",{value:e,previous:t})}updateFind(e){!e||!this.element||this._send("find",{value:e})}stopFind(e){this.element&&(this._send("find-stop",{clearSelection:!e}),this._onDidStopFind.fire())}showFind(e=!0){this._webviewFindWidget?.reveal(void 0,e)}hideFind(e=!0){this._webviewFindWidget?.hide(e)}runFindAction(e){this._webviewFindWidget?.find(e)}};kse=I([m(2,B),m(3,Xe),m(4,Ne),m(5,At),m(6,fe),m(7,se),m(8,Uc),m(9,_p),m(10,F),m(11,Oi),m(12,ht)],kse);var bqe=class extends x{constructor(e,t,o,n,r){super();this._layoutService=t;this._webviewService=o;this._baseContextKeyService=n;this._editorGroupsService=r;this._isFirstLoad=!0;this._firstLoadPendingMessages=new Set;this._webview=this._register(new me);this._webviewEvents=this._register(new N);this._html="";this._initialScrollProgress=0;this._state=void 0;this._owner=void 0;this._windowId=void 0;this._scopedContextKeyService=this._register(new me);this._shouldShowFindWidgetOnRestore=!1;this._isDisposed=!1;this._onDidDispose=this._register(new E);this.onDidDispose=this._onDidDispose.event;this._onDidFocus=this._register(new E);this.onDidFocus=this._onDidFocus.event;this._onDidBlur=this._register(new E);this.onDidBlur=this._onDidBlur.event;this._onDidClickLink=this._register(new E);this.onDidClickLink=this._onDidClickLink.event;this._onDidScroll=this._register(new E);this.onDidScroll=this._onDidScroll.event;this._onDidUpdateState=this._register(new E);this.onDidUpdateState=this._onDidUpdateState.event;this._onMessage=this._register(new E);this.onMessage=this._onMessage.event;this._onMissingCsp=this._register(new E);this.onMissingCsp=this._onMissingCsp.event;this._onDidWheel=this._register(new E);this.onDidWheel=this._onDidWheel.event;this._onFatalError=this._register(new E);this.onFatalError=this._onFatalError.event;this.intrinsicContentSize=Me("WebviewIntrinsicContentSize",void 0);this.providedViewType=e.providedViewType,this.origin=e.origin??xt(),this._title=e.title,this._extension=e.extension,this._options=e.options,this._contentOptions=e.contentOptions}get window(){return rb(this._windowId,!0).window}get isFocused(){return!!this._webview.value?.isFocused}dispose(){this._isDisposed=!0,this._container?.domNode.remove(),this._container=void 0;for(let e of this._firstLoadPendingMessages)e.resolve(!1);this._firstLoadPendingMessages.clear(),this._onDidDispose.fire(),super.dispose()}get container(){if(this._isDisposed)throw new Error("OverlayWebview has been disposed");if(!this._container){let e=document.createElement("div");e.style.position="absolute",e.style.overflow="hidden",this._container=new cf(e),this._container.setVisibility("hidden");let t=this._editorGroupsService.activeModalEditorPart?.modalElement,o;Do(t)?o=t:o=this._layoutService.getContainer(this.window),o.appendChild(e)}return this._container.domNode}claim(e,t,o){if(this._isDisposed)return;let n=this._owner;if(this._windowId!==t.vscodeWindowId&&(this.release(n),this._webview.clear(),this._webviewEvents.clear(),this._container?.domNode.remove(),this._container=void 0),this._owner=e,this._windowId=t.vscodeWindowId,this._show(t),n!==e){let r=o||this._baseContextKeyService;this._scopedContextKeyService.clear(),this._scopedContextKeyService.value=r.createScoped(this.container);let s=this._findWidgetVisible?.get();this._findWidgetVisible?.reset(),this._findWidgetVisible=NLt.bindTo(r),this._findWidgetVisible.set(!!s),this._findWidgetEnabled?.reset(),this._findWidgetEnabled=OLt.bindTo(r),this._findWidgetEnabled.set(!!this.options.enableFindWidget),this._webview.value?.setContextKeyService(this._scopedContextKeyService.value)}}release(e){this._owner===e&&(this._scopedContextKeyService.clear(),this._owner=void 0,this._container&&this._container.setVisibility("hidden"),this._options.retainContextWhenHidden?(this._shouldShowFindWidgetOnRestore=!!this._findWidgetVisible?.get(),this.hideFind(!1)):(this._webview.clear(),this._webviewEvents.clear()))}layoutWebviewOverElement(e,t,o){if(!this._container||!this._container.domNode.parentElement)return;let n=this._layoutService.whenContainerStylesLoaded(this.window);n?n.then(()=>this.doLayoutWebviewOverElement(e,t,o)):this.doLayoutWebviewOverElement(e,t,o)}doLayoutWebviewOverElement(e,t,o){if(!this._container||!this._container.domNode.parentElement)return;let n=e.getBoundingClientRect(),r=this._container.domNode.parentElement.getBoundingClientRect(),s=(r.height-this._container.domNode.parentElement.clientHeight)/2,l=(r.width-this._container.domNode.parentElement.clientWidth)/2;if(this._container.setTop(n.top-r.top-s),this._container.setLeft(n.left-r.left-l),this._container.setWidth(t?t.width:n.width),this._container.setHeight(t?t.height:n.height),o){let{top:c,left:u,right:p,bottom:h}=cwn(n,o);this._container.domNode.style.clipPath=`polygon(${u}px ${c}px, ${p}px ${c}px, ${p}px ${h}px, ${u}px ${h}px)`}}_show(e){if(this._isDisposed)throw new Error("OverlayWebview is disposed");if(!this._webview.value){let t=this._webviewService.createWebviewElement({providedViewType:this.providedViewType,origin:this.origin,title:this._title,options:this._options,contentOptions:this._contentOptions,extension:this.extension});this._webview.value=t,t.state=this._state,this._scopedContextKeyService.value&&this._webview.value.setContextKeyService(this._scopedContextKeyService.value),this._html&&t.setHtml(this._html),this._options.tryRestoreScrollPosition&&(t.initialScrollProgress=this._initialScrollProgress),this._findWidgetEnabled?.set(!!this.options.enableFindWidget),t.mountTo(this.container,e),this._webviewEvents.clear(),this._webviewEvents.add(t.onDidFocus(()=>{this._onDidFocus.fire()})),this._webviewEvents.add(t.onDidBlur(()=>{this._onDidBlur.fire()})),this._webviewEvents.add(t.onDidClickLink(o=>{this._onDidClickLink.fire(o)})),this._webviewEvents.add(t.onMessage(o=>{this._onMessage.fire(o)})),this._webviewEvents.add(t.onMissingCsp(o=>{this._onMissingCsp.fire(o)})),this._webviewEvents.add(t.onDidWheel(o=>{this._onDidWheel.fire(o)})),this._webviewEvents.add(t.onFatalError(o=>{this._onFatalError.fire(o)})),this._webviewEvents.add(be(o=>{this.intrinsicContentSize.set(o.readObservable(t.intrinsicContentSize),void 0,void 0)})),this._webviewEvents.add(t.onDidScroll(o=>{this._initialScrollProgress=o.scrollYPercentage,this._onDidScroll.fire(o)})),this._webviewEvents.add(t.onDidUpdateState(o=>{this._state=o,this._onDidUpdateState.fire(o)})),this._isFirstLoad&&this._firstLoadPendingMessages.forEach(async o=>{o.resolve(await t.postMessage(o.message,o.transfer))}),this._isFirstLoad=!1,this._firstLoadPendingMessages.clear()}this.options.retainContextWhenHidden&&this._shouldShowFindWidgetOnRestore&&(this.showFind(!1),this._shouldShowFindWidgetOnRestore=!1),this._container?.setVisibility("visible")}setHtml(e){this._html=e,this._withWebview(t=>t.setHtml(e))}setTitle(e){this._title=e,this._withWebview(t=>t.setTitle(e))}get initialScrollProgress(){return this._initialScrollProgress}set initialScrollProgress(e){this._initialScrollProgress=e,this._withWebview(t=>t.initialScrollProgress=e)}get state(){return this._state}set state(e){this._state=e,this._withWebview(t=>t.state=e)}get extension(){return this._extension}set extension(e){this._extension=e,this._withWebview(t=>t.extension=e)}get options(){return this._options}set options(e){this._options={customClasses:this._options.customClasses,...e}}get contentOptions(){return this._contentOptions}set contentOptions(e){this._contentOptions=e,this._withWebview(t=>t.contentOptions=e)}set localResourcesRoot(e){this._withWebview(t=>t.localResourcesRoot=e)}async postMessage(e,t){if(this._webview.value)return this._webview.value.postMessage(e,t);if(this._isFirstLoad){let o,n=new Promise(r=>o=r);return this._firstLoadPendingMessages.add({message:e,transfer:t,resolve:o}),n}return!1}focus(){this._webview.value?.focus()}reload(){this._webview.value?.reload()}selectAll(){this._webview.value?.selectAll()}copy(){this._webview.value?.copy()}paste(){this._webview.value?.paste()}cut(){this._webview.value?.cut()}undo(){this._webview.value?.undo()}redo(){this._webview.value?.redo()}showFind(e=!0){this._webview.value&&(this._webview.value.showFind(e),this._findWidgetVisible?.set(!0))}hideFind(e=!0){this._findWidgetVisible?.reset(),this._webview.value?.hideFind(e)}runFindAction(e){this._webview.value?.runFindAction(e)}_withWebview(e){this._webview.value&&e(this._webview.value)}windowDidDragStart(){this._webview.value?.windowDidDragStart()}windowDidDragEnd(){this._webview.value?.windowDidDragEnd()}setContextKeyService(e){this._webview.value?.setContextKeyService(e)}};bqe=I([m(1,yi),m(2,cp),m(3,X),m(4,wt)],bqe);function cwn(a,i){let e=i.getBoundingClientRect(),t=Math.max(e.top-a.top,0),o=Math.max(a.width-(a.right-e.right),0),n=Math.max(a.height-(a.bottom-e.bottom),0),r=Math.max(e.left-a.left,0);return{top:t,right:o,bottom:n,left:r}}var Sqe=class extends x{constructor(e){super();this._instantiationService=e;this._webviews=new Set;this._onDidChangeActiveWebview=this._register(new E);this.onDidChangeActiveWebview=this._onDidChangeActiveWebview.event;this._webviewThemeDataProvider=this._instantiationService.createInstance(fqe)}get activeWebview(){return this._activeWebview}_updateActiveWebview(e){e!==this._activeWebview&&(this._activeWebview=e,this._onDidChangeActiveWebview.fire(e))}get webviews(){return this._webviews.values()}createWebviewElement(e){let t=this._instantiationService.createInstance(kse,e,this._webviewThemeDataProvider);return this.registerNewWebview(t),t}createWebviewOverlay(e){let t=this._instantiationService.createInstance(bqe,e);return this.registerNewWebview(t),t}registerNewWebview(e){this._webviews.add(e);let t=new N;t.add(e.onDidFocus(()=>{this._updateActiveWebview(e)}));let o=()=>{this._activeWebview===e&&this._updateActiveWebview(void 0)};t.add(e.onDidBlur(o)),t.add(e.onDidDispose(()=>{o(),t.dispose(),this._webviews.delete(e)}))}};Sqe=I([m(0,F)],Sqe);var BYt=class{constructor(i,e,t){this._nativeHostService=t;this._isUsingNativeTitleBars=LC(i),this._webviewMainService=Tc.toService(e.getChannel("webview"))}didFocus(){this.setIgnoreMenuShortcuts(!0)}didBlur(){this.setIgnoreMenuShortcuts(!1)}get _shouldToggleMenuShortcutsEnablement(){return Ze||this._isUsingNativeTitleBars}setIgnoreMenuShortcuts(i){this._shouldToggleMenuShortcutsEnablement&&this._webviewMainService.setIgnoreMenuShortcuts({windowId:this._nativeHostService.windowId},i)}};var Iqe=class extends kse{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super(e,t,u,o,h,s,r,c,l,n,f,v,b);this._nativeHostService=g;this._findStarted=!1;this._iframeDelayer=this._register(new Xo(200));this._webviewKeyboardHandler=new BYt(u,p,g),this._webviewMainService=Tc.toService(p.getChannel("webview")),e.options.enableFindWidget&&(this._register(this.onDidHtmlChange(S=>{this._findStarted&&this._cachedHtmlContent!==S&&(this.stopFind(!1),this._cachedHtmlContent=S)})),this._register(this._webviewMainService.onFoundInFrame(S=>{this._hasFindResult.fire(S.matches>0)})))}get platform(){return"electron"}dispose(){this._webviewKeyboardHandler.didBlur(),super.dispose()}webviewContentEndpoint(e){return`${Q.vscodeWebview}://${e}`}streamToBuffer(e){return K9(e,t=>{let o=t.reduce((l,c)=>l+c.byteLength,0),n=new ArrayBuffer(o),r=new Uint8Array(n),s=0;for(let l of t)r.set(l.buffer,s),s+=l.byteLength;return n})}find(e,t){if(this.element)if(!this._findStarted)this.updateFind(e);else{let o={forward:!t,findNext:!1,matchCase:!1};this._webviewMainService.findInFrame({windowId:this._nativeHostService.windowId},this.id,e,o)}}updateFind(e){if(!e||!this.element)return;let t={forward:!0,findNext:!0,matchCase:!1};this._iframeDelayer.trigger(()=>{this._findStarted=!0,this._webviewMainService.findInFrame({windowId:this._nativeHostService.windowId},this.id,e,t)})}stopFind(e){this.element&&(this._iframeDelayer.cancel(),this._findStarted=!1,this._webviewMainService.stopFindInFrame({windowId:this._nativeHostService.windowId},this.id,{keepSelection:e}),this._onDidStopFind.fire())}handleFocusChange(e){super.handleFocusChange(e),e?this._webviewKeyboardHandler.didFocus():this._webviewKeyboardHandler.didBlur()}};Iqe=I([m(2,Xe),m(3,_p),m(4,fe),m(5,At),m(6,Uc),m(7,se),m(8,B),m(9,pu),m(10,Ne),m(11,ko),m(12,F),m(13,Oi),m(14,ht)],Iqe);var HYt=class extends Sqe{createWebviewElement(i){let e=this._instantiationService.createInstance(Iqe,i,this._webviewThemeDataProvider);return this.registerNewWebview(e),e}};Ee(cp,HYt,1);W(OYt);var gNo=[{className:"monaco-menu-container",type:"menu"},{className:"quick-input-widget",type:"quickInput"},{className:"monaco-hover",type:"hover"},{className:"editor-widget",type:"hover"},{className:"suggest-details-container",type:"hover"},{className:"monaco-dialog-modal-block",type:"dialog"},{className:"monaco-modal-editor-block",type:"dialog"},{className:"notifications-center",type:"notification"},{className:"notification-toast-container",type:"notification"},{className:"context-view",type:"unknown"}],VQI=le("browserOverlayManager"),UYt=class extends x{constructor(e){super();this.targetWindow=e;this._onDidChangeOverlayState=this._register(new A9({onWillAddFirstListener:()=>{this._observerIsConnected=!0,this._structuralObserver.observe(this.targetWindow.document.body,{childList:!0,subtree:!0}),this.updateTrackedElements()},onDidRemoveLastListener:()=>{this._observerIsConnected=!1,this._structuralObserver.disconnect(),this.stopTrackingElements()},merge:()=>{}}));this.onDidChangeOverlayState=this._onDidChangeOverlayState.event;this._overlayCollections=new Map;this._overlayRectangles=new WeakMap;this._elementObservers=new WeakMap;this._observerIsConnected=!1;this._shadowRootObservers=new WeakMap;this._shadowRootOverlayCache=new WeakMap;for(let t of gNo)this._overlayCollections.set(t.className,{type:t.type,collection:this.targetWindow.document.getElementsByClassName(t.className)});this._shadowRootHostCollection=this.targetWindow.document.getElementsByClassName("shadow-root-host"),this._structuralObserver=new e.MutationObserver(t=>{let o=!1;for(let n of t)for(let r of n.removedNodes){this._elementObservers.has(r)&&(this._elementObservers.get(r)?.disconnect(),this._elementObservers.delete(r),o=!0),this._overlayRectangles.delete(r)&&(o=!0);let s=r;if(s.shadowRoot){let l=s.shadowRoot,c=this._shadowRootObservers.get(l);c&&(c.disconnect(),this._shadowRootObservers.delete(l),this._shadowRootOverlayCache.delete(l),o=!0)}}this.updateTrackedElements(o)})}*overlays(){for(let e of this._overlayCollections.values())for(let t of e.collection)yield{element:t,type:e.type};for(let e of this._shadowRootHostCollection){let t=e.shadowRoot;if(t){let o=this._shadowRootOverlayCache.get(t);if(!o){o=[];for(let n of gNo){let r=t.querySelectorAll(`.${n.className}`);for(let s of r)o.push({element:s,type:n.type})}this._shadowRootOverlayCache.set(t,o)}yield*o}}}updateTrackedElements(e=!1){for(let t of this._shadowRootHostCollection){let n=t.shadowRoot;if(n&&!this._shadowRootObservers.has(n)){let r=new this.targetWindow.MutationObserver(()=>{this._shadowRootOverlayCache.delete(n),this._onDidChangeOverlayState.fire()});r.observe(n,{childList:!0,subtree:!0}),this._shadowRootObservers.set(n,r),e=!0}}for(let t of this.overlays())if(!this._elementObservers.has(t.element)){let o=new this.targetWindow.MutationObserver(()=>{this._overlayRectangles.delete(t.element),this._onDidChangeOverlayState.fire()});this._elementObservers.set(t.element,o),o.observe(t.element,{attributes:!0,attributeFilter:["style","class"],childList:!0,subtree:!0}),e=!0}e&&this._onDidChangeOverlayState.fire()}getRect(e){if(!this._overlayRectangles.has(e)){let t=ir(e);if(!this._observerIsConnected)return t;this._overlayRectangles.set(e,t)}return this._overlayRectangles.get(e)}getOverlappingOverlays(e){let t=ir(e),o=[];for(let n of this.overlays()){let r=this.getRect(n.element);r&&this.isRectanglesOverlapping(t,r)&&o.push({type:n.type,rect:r})}return o}isRectanglesOverlapping(e,t){return e.width===0||e.height===0||t.width===0||t.height===0?!1:!(e.left+e.width<=t.left||t.left+t.width<=e.left||e.top+e.height<=t.top||t.top+t.height<=e.top)}stopTrackingElements(){for(let e of this.overlays())this._elementObservers.get(e.element)?.disconnect();for(let e of this._shadowRootHostCollection){let t=e.shadowRoot;this._shadowRootObservers.get(t)?.disconnect()}this._shadowRootObservers=new WeakMap,this._shadowRootOverlayCache=new WeakMap,this._overlayRectangles=new WeakMap,this._elementObservers=new WeakMap}dispose(){this._observerIsConnected=!1,this._structuralObserver.disconnect(),this.stopTrackingElements(),super.dispose()}};var yqe=class extends x{constructor(e,t,o){super();this.editor=t;this.hoverService=o;this._container=_(".browser-site-info-container"),this._container.style.display="none",this._indicator=_(".browser-site-info-indicator"),this._indicator.tabIndex=0,this._indicator.role="button",this._indicator.ariaLabel=d(5475,null),this._indicator.appendChild(Sn(R.workspaceUntrusted)),this._container.appendChild(this._indicator),e.appendChild(this._container),this._register(j(this._indicator,re.CLICK,()=>this._showHover())),this._register(j(this._indicator,re.KEY_DOWN,n=>{(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),this._showHover())}))}setCertificateError(e){this._container.style.display=e?"":"none"}_showHover(){let e=this.editor.getCertificateError();if(!e)return;let t=document.createElement("div");t.classList.add("browser-site-info-hover-content");let o=document.createElement("div");o.classList.add("browser-site-info-hover-heading"),o.textContent=d(5473,null),t.appendChild(o);let n=document.createElement("div");if(n.classList.add("browser-site-info-hover-detail"),n.textContent=d(5471,null),t.appendChild(n),e.hasTrustedException){let s=document.createElement("div");s.classList.add("browser-site-info-hover-detail"),s.textContent=d(5472,null,e.host,e.error),t.appendChild(s);let l=document.createElement("a");l.classList.add("browser-site-info-hover-revoke"),l.textContent=d(5474,null),l.role="button",l.tabIndex=0,l.addEventListener("click",()=>{r?.dispose(),this.editor.revokeAndClose(e)}),l.addEventListener("keydown",c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),r?.dispose(),this.editor.revokeAndClose(e))}),t.appendChild(l)}let r=this.hoverService.showInstantHover({content:t,target:this._indicator,container:this._container,position:{hoverPosition:2},persistence:{sticky:!0}},!0)}};yqe=I([m(2,nt)],yqe);var nKi=new Y("browserCanGoBack",!1,d(5385,null)),rKi=new Y("browserCanGoForward",!1,d(5386,null)),u$=new Y("browserFocused",!0,d(5399,null)),iP=new Y("browserHasUrl",!1,d(5402,null)),rV=new Y("browserHasError",!1,d(5401,null)),dwn=HTMLElement.prototype.focus,nV=class extends x{constructor(e){super();this.editor=e;this._modelStore=this._register(new N);this._register(e.onDidChangeModel(t=>{this._modelStore.clear(),t?this.subscribeToModel(t,this._modelStore):this.clear()}))}subscribeToModel(e,t){}clear(){}get urlBarWidgets(){return[]}get toolbarElements(){return[]}layout(e){}},oKi=class extends x{constructor(i,e,t,o){super();let n=this._register(t.createInstance(mf,"element",void 0,{position:{hoverPosition:3}})),r=_(".browser-nav-toolbar"),s=t.createChild(new _o([X,o])),l=this._register(s.createInstance(or,r,D.BrowserNavigationToolbar,{hoverDelegate:n,highlightToggledItems:!0,toolbarOptions:{primaryGroup:()=>!0,useSeparatorsInPrimaryActions:!0},menuOptions:{shouldForwardArgs:!0}})),c=_(".browser-url-container"),u=_(".browser-site-info-slot");this._siteInfoWidget=this._register(t.createInstance(yqe,u,i)),this._urlInput=_("input.browser-url-input"),this._urlInput.type="text",this._urlInput.placeholder=d(5406,null),this._urlInput.style.display="none";let p=_(".browser-url-input-wrapper");this._urlDisplay=_("span.browser-url-display"),this._urlDisplay.tabIndex=0,p.appendChild(this._urlDisplay),p.appendChild(this._urlInput),this._urlBarWidgetsContainer=_(".browser-url-bar-widgets"),c.appendChild(u),c.appendChild(p),c.appendChild(this._urlBarWidgetsContainer);let h=_(".browser-actions-toolbar"),g=this._register(s.createInstance(or,h,D.BrowserActionsToolbar,{hoverDelegate:n,highlightToggledItems:!0,toolbarOptions:{primaryGroup:f=>f.startsWith("actions"),useSeparatorsInPrimaryActions:!0},menuOptions:{shouldForwardArgs:!0}}));l.context=i,g.context=i,e.appendChild(r),e.appendChild(c),e.appendChild(h),this._register(j(this._urlInput,re.KEY_DOWN,f=>{if(f.key==="Enter"){let v=this._urlInput.value.trim();v&&i.navigateToUrl(v)}})),this._register(j(this._urlInput,re.FOCUS,()=>{this._urlInput.select()})),this._register(j(this._urlInput,re.BLUR,()=>{this._showDisplay()})),this._register(j(this._urlDisplay,re.FOCUS,()=>{this._showInput()}))}updateFromNavigationEvent(i){this._urlInput.value=i.url,this._updateDisplay()}focusUrlInput(){this._showInput()}setCertificateError(i){this._siteInfoWidget.setCertificateError(i),this._urlInput.classList.toggle("cert-error",!!i),this._updateDisplay()}_showInput(){this._urlDisplay.style.display="none",this._urlInput.style.display="",this._urlInput.select(),this._urlInput.focus()}addUrlBarWidgets(i){let e=i.slice().sort((t,o)=>t.order-o.order);for(let t of e)this._urlBarWidgetsContainer.appendChild(t.element)}_showDisplay(){this._urlInput.style.display="none",this._urlDisplay.style.display="",this._updateDisplay()}_updateDisplay(){let i=this._urlInput.value,e=this._urlInput.classList.contains("cert-error"),t="https:";if(this._urlDisplay.textContent="",this._urlDisplay.classList.toggle("placeholder",!i),e&&i.startsWith(t)){let o=document.createElement("span");o.className="browser-url-display-protocol-bad",o.textContent=t,this._urlDisplay.appendChild(o);let n=document.createElement("span");n.textContent=i.slice(t.length),this._urlDisplay.appendChild(n)}else this._urlDisplay.textContent=i||d(5406,null)}clear(){this._urlInput.value="",this._siteInfoWidget.setCertificateError(void 0),this._updateDisplay()}},mu=class extends Ts{constructor(e,t,o,n,r,s,l,c,u,p){super(sd.EDITOR_ID,e,t,o,n);this.keybindingService=r;this.logService=s;this.instantiationService=l;this.contextKeyService=c;this.editorService=u;this.layoutService=p;this._contributionInstances=new Map;this._onDidChangeModel=this._register(new E);this.onDidChangeModel=this._onDidChangeModel.event;this._overlayVisible=!1;this._editorVisible=!1;this._inputDisposables=this._register(new N);this._certActionButton=this._register(new me)}static{this._contributions=[]}static registerContribution(e){mu._contributions.push(e)}getContribution(e){return this._contributionInstances.get(e)}get model(){return this._model}get browserContainer(){return this._browserContainer}createEditor(e){let t=this._register(this.contextKeyService.createScoped(e));this.overlayManager=this._register(new UYt(this.window)),this._canGoBackContext=nKi.bindTo(t),this._canGoForwardContext=rKi.bindTo(t),this._hasUrlContext=iP.bindTo(t),this._hasErrorContext=rV.bindTo(t),u$.bindTo(t);let o=this._register(this.instantiationService.createChild(new _o([X,t])));for(let u of mu._contributions){let p=this._register(o.createInstance(u,this));this._contributionInstances.set(u,p)}let n=_(".browser-root");e.appendChild(n);let r=_(".browser-navbar");this._navigationBar=this._register(new oKi(this,r,this.instantiationService,t));let s=[];for(let u of this._contributionInstances.values())s.push(...u.urlBarWidgets);this._navigationBar.addUrlBarWidgets(s),n.appendChild(r);for(let u of this._contributionInstances.values())for(let p of u.toolbarElements)n.appendChild(p);this._browserContainerWrapper=_(".browser-container-wrapper"),this._browserContainerWrapper.style.setProperty("--zoom-factor",String(Zv(this.window))),n.appendChild(this._browserContainerWrapper),this._browserContainer=_(".browser-container"),this._browserContainer.tabIndex=0,this._browserContainerWrapper.appendChild(this._browserContainer);let l=_(".browser-placeholder-contents");this._browserContainer.appendChild(l),this._placeholderScreenshot=_(".browser-placeholder-screenshot"),l.appendChild(this._placeholderScreenshot),this._overlayPauseContainer=_(".browser-overlay-paused");let c=_(".browser-overlay-paused-message");this._overlayPauseHeading=_(".browser-overlay-paused-heading"),this._overlayPauseDetail=_(".browser-overlay-paused-detail"),c.appendChild(this._overlayPauseHeading),c.appendChild(this._overlayPauseDetail),this._overlayPauseContainer.appendChild(c),l.appendChild(this._overlayPauseContainer),this._errorContainer=_(".browser-error-container"),this._errorContainer.style.display="none",l.appendChild(this._errorContainer),this._welcomeContainer=this.createWelcomeContainer(),l.appendChild(this._welcomeContainer),this._register(j(this._browserContainer,re.FOCUS,u=>{u.relatedTarget&&this._model&&this.shouldShowView&&this.requestFocus()})),this._register(j(this._browserContainer,re.BLUR,()=>{this.cancelFocus()})),this._register(Vqi(()=>({hasFocus:this._model?.focused??!1,window:this._model?.focused?this.window:void 0})))}focus(){this._model?.url&&!this._model.error?this.requestFocus():this.focusUrlInput()}requestFocus(){this.ensureBrowserFocus(),!this._focusTimeout&&(this._focusTimeout=setTimeout(()=>{this._focusTimeout=void 0,this._model&&this._model.focus()},0))}cancelFocus(){this._focusTimeout&&(clearTimeout(this._focusTimeout),this._focusTimeout=void 0)}async setInput(e,t,o,n){if(await super.setInput(e,t,o,n),n.isCancellationRequested)return;this._inputDisposables.clear();let r=await e.resolve();n.isCancellationRequested||this.input!==e||(this._model=r,this._onDidChangeModel.fire(r),this.updateNavigationState({url:this._model.url,title:this._model.title,canGoBack:this._model.canGoBack,canGoForward:this._model.canGoForward,certificateError:this._model.certificateError}),this.setBackgroundImage(this._model.screenshot),this._inputDisposables.add(this._model.onDidChangeVisibility(()=>this.doScreenshot())),this._inputDisposables.add(this._model.onDidKeyCommand(s=>{this.handleKeyEventFromBrowserView(s)})),this._inputDisposables.add(this._model.onDidNavigate(s=>{this.group.pinEditor(this.input),this.updateNavigationState(s)})),this._inputDisposables.add(this._model.onDidChangeLoadingState(()=>{this.updateErrorDisplay()})),this._inputDisposables.add(this._model.onDidChangeFocus(({focused:s})=>{s&&(this._onDidFocus?.fire(),this.ensureBrowserFocus())})),this._inputDisposables.add(this._model.onDidRequestNewPage(({resource:s,url:l,location:c,position:u})=>{nH(this.telemetryService,(()=>{switch(c){case"background":return"browserLinkBackground";case"foreground":return"browserLinkForeground";case"newWindow":return"browserLinkNewWindow"}})());let p=c==="newWindow"?Mg:this.group,h={url:l};this.editorService.openEditor({resource:A.revive(s),options:{pinned:!0,inactive:c==="background",auxiliary:{bounds:u,compact:!0},viewState:h}},p)})),this._inputDisposables.add(this.overlayManager.onDidChangeOverlayState(()=>{this.checkOverlays()})),this._inputDisposables.add(tIe(s=>{s===this.window.vscodeWindowId&&this._browserContainerWrapper.style.setProperty("--zoom-factor",String(Zv(this.window)))})),this.updateErrorDisplay(),this.layout(),this.updateVisibility(),this.doScreenshot())}setEditorVisible(e){this._editorVisible=e,this.updateVisibility()}ensureBrowserFocus(){dwn.call(this._browserContainer)}updateVisibility(){let e=!!this._model?.url,t=!!this._model?.error,o=!t&&e,n=o&&this._editorVisible&&this._overlayVisible;if(this._welcomeContainer.style.display=e?"none":"",this._errorContainer.style.display=t?"":"none",this._placeholderScreenshot.style.display=o?"":"none",this._overlayPauseContainer.classList.toggle("visible",n),this._model){let r=this.shouldShowView;if(r===this._model.visible)return;r?(this._model.setVisible(!0),this._browserContainer.ownerDocument.hasFocus()&&this._browserContainer.ownerDocument.activeElement===this._browserContainer&&this.requestFocus()):(this.doScreenshot(),this.window.requestAnimationFrame(()=>this._model?.setVisible(!1)))}}get shouldShowView(){return this._editorVisible&&!this._overlayVisible&&!this._model?.error&&!!this._model?.url}checkOverlays(){if(!this.overlayManager)return;let e=this.overlayManager.getOverlappingOverlays(this._browserContainer),t=e.length>0;this.updateOverlayPauseMessage(e),t!==this._overlayVisible&&(this._overlayVisible=t,this.updateVisibility())}updateOverlayPauseMessage(e){let t=e.some(o=>o.type==="notification");this._overlayPauseContainer.classList.toggle("show-message",t),t?(this._overlayPauseHeading.textContent=d(5405,null),this._overlayPauseDetail.textContent=d(5404,null)):(this._overlayPauseHeading.textContent="",this._overlayPauseDetail.textContent="")}updateErrorDisplay(){if(!this._model)return;let e=this._model.error;if(this._hasErrorContext.set(!!e),this._navigationBar.setCertificateError(this._model.certificateError??e?.certificateError),e){for(this._certActionButton.clear();this._errorContainer.firstChild;)this._errorContainer.removeChild(this._errorContainer.firstChild);let t=_(".browser-error-content"),o=!!e.certificateError,n=_(".browser-error-icon");n.classList.toggle("cert-error",o),n.appendChild(Sn(o?R.workspaceUntrusted:R.globe));let r=_(".browser-error-title");r.textContent=o?d(5392,null):d(5403,null);let s=_(".browser-error-detail"),l=_("span");l.textContent=o?d(5390,null):`${e.errorDescription} (${e.errorCode})`,s.appendChild(l);let c=_(".browser-error-detail"),u=_("strong");u.textContent=d(5400,null);let p=_("code");if(p.textContent=e.url,c.appendChild(u),c.appendChild(document.createTextNode(" ")),c.appendChild(p),t.appendChild(n),t.appendChild(r),t.appendChild(s),e.certificateError){let h=_("b.browser-error-detail");h.textContent=d(5391,null),s.appendChild(h)}if(t.appendChild(c),e.certificateError){let h=e.certificateError,g=_(".browser-cert-details-table"),f=_(".browser-cert-details-heading");f.textContent=d(5388,null),g.appendChild(f);let v=(P,O)=>{let V=_(".browser-cert-details-row"),H=_(".browser-cert-details-label");H.textContent=P;let G=_(".browser-cert-details-value");G.textContent=O,V.appendChild(H),V.appendChild(G),g.appendChild(V)};v(d(5389,null),h.error),v(d(5395,null),h.issuerName),v(d(5397,null),h.subjectName);let b=P=>new Date(P*1e3).toLocaleDateString();v(d(5398,null),`${b(h.validStart)} - ${b(h.validExpiry)}`),v(d(5393,null),h.fingerprint),t.appendChild(g);let S=_(".browser-cert-action");S.classList.toggle("reverse",Ze||fn);let y=this._model.canGoBack,w=new Sw(S);this._certActionButton.value=w;let k=w.addButton({...Qo});k.label=y?d(5394,null):d(5387,null),k.onDidClick(()=>{y?this.goBack():this.group?.closeEditor(this.input)});let T=w.addButton({...Qo,secondary:!0});T.label=d(5396,null),T.onDidClick(()=>{this._model?.trustCertificate(h.host,h.fingerprint)}),t.appendChild(S)}this._errorContainer.appendChild(t),this.setBackgroundImage(void 0)}else this.setBackgroundImage(this._model.screenshot);this.updateVisibility()}getUrl(){return this._model?.url}getCertificateError(){return this._model?.certificateError}revokeAndClose(e){this._model?.untrustCertificate(e.host,e.fingerprint)}async navigateToUrl(e){this._model&&(this.group.pinEditor(this.input),/^localhost(:|\/|$)/i.test(e)?e="http://"+e:URL.parse(e)?.protocol||(e="http://"+e),this.ensureBrowserFocus(),await this._model.loadURL(e))}focusUrlInput(){this._navigationBar.focusUrlInput()}async goBack(){return this._model?.goBack()}async goForward(){return this._model?.goForward()}async reload(e){return this._model?.reload(e)}async toggleDevTools(){return this._model?.toggleDevTools()}async clearStorage(){return this._model?.clearStorage()}updateNavigationState(e){this._navigationBar.updateFromNavigationEvent(e),this._navigationBar.setCertificateError(e.certificateError),this._canGoBackContext.set(e.canGoBack),this._canGoForwardContext.set(e.canGoForward),this._hasUrlContext.set(!!e.url),this.updateVisibility()}createWelcomeContainer(){let e=_(".browser-welcome-container"),t=_(".browser-welcome-content"),o=_(".browser-welcome-icon");o.appendChild(Sn(R.globe)),t.appendChild(o);let n=_(".browser-welcome-title");n.textContent=d(5409,null),t.appendChild(n);let r=_(".browser-welcome-subtitle"),s=this.contextKeyService.getContextKeyValue(ie.enabled.key);return r.textContent=s?d(5408,null):d(5407,null),t.appendChild(r),e.appendChild(t),e}setBackgroundImage(e){if(e){let t=`data:image/jpeg;base64,${Yd(e)}`;this._placeholderScreenshot.style.backgroundImage=`url('${t}')`}else this._placeholderScreenshot.style.backgroundImage=""}async doScreenshot(){if(this._model&&(this.cancelScheduledScreenshot(),!!this._model.visible)){try{let e=await this._model.captureScreenshot({quality:80});this.setBackgroundImage(e)}catch(e){this.logService.error("Failed to capture browser view screenshot",e)}this._screenshotTimeout=setTimeout(()=>this.doScreenshot(),1e3)}}cancelScheduledScreenshot(){this._screenshotTimeout&&(clearTimeout(this._screenshotTimeout),this._screenshotTimeout=void 0)}async handleKeyEventFromBrowserView(e){try{let t=new KeyboardEvent("keydown",e),o=new gi(t);this.keybindingService.dispatchEvent(o,this._browserContainer)}catch(t){this.logService.error("BrowserEditor.handleKeyEventFromBrowserView: Error dispatching key event",t)}}layout(e,t){if(e)for(let n of this._contributionInstances.values())n.layout(e.width);let o=this.layoutService.whenContainerStylesLoaded(this.window);o?o.then(()=>this.layoutBrowserContainer()):this.layoutBrowserContainer()}layoutBrowserContainer(){if(this._model){this.checkOverlays();let e=this._browserContainer.getBoundingClientRect(),t=this.window.getComputedStyle(this._browserContainer).borderTopLeftRadius??"0";this._model.layout({windowId:this.group.windowId,x:e.left,y:e.top,width:e.width,height:e.height,zoomFactor:Zv(this.window),cornerRadius:parseFloat(t)})}}clearInput(){this._inputDisposables.clear(),this.cancelScheduledScreenshot(),this.cancelFocus(),this._model?.setVisible(!1),this._model=void 0,this._onDidChangeModel.fire(void 0),this._canGoBackContext.reset(),this._canGoForwardContext.reset(),this._hasUrlContext.reset(),this._hasErrorContext.reset(),this._navigationBar.clear(),this.setBackgroundImage(void 0),super.clearInput()}};mu=I([m(1,Te),m(2,Le),m(3,ce),m(4,_e),m(5,se),m(6,F),m(7,X),m(8,ee),m(9,Kl)],mu);var uwn=[Du.GoBack,Du.GoForward,Du.Reload],wqe=class extends x{constructor(e,t,o,n){super();this.instantiationService=t;this.workspaceContextService=o;this.keybindingService=n;this._models=new Map;let r=e.getChannel(Cao);this._browserViewService=Tc.toService(r),this.sendKeybindings(),this._register(this.keybindingService.onDidUpdateKeybindings(()=>this.sendKeybindings()))}async getOrCreateBrowserViewModel(e){return this._getBrowserViewModel(e,!0)}async getBrowserViewModel(e){return this._getBrowserViewModel(e,!1)}async clearGlobalStorage(){return this._browserViewService.clearGlobalStorage()}async clearWorkspaceStorage(){let e=this.workspaceContextService.getWorkspace().id;return this._browserViewService.clearWorkspaceStorage(e)}async _getBrowserViewModel(e,t){let o=this._models.get(e);if(o)return o;o=this.instantiationService.createInstance(E2,e,this._browserViewService),this._models.set(e,o);try{await o.initialize(t)}catch(n){throw this._models.delete(e),n}return U.once(o.onWillDispose)(()=>{this._models.delete(e)}),o}sendKeybindings(){let e=Object.create(null);for(let t of uwn){let n=this.keybindingService.lookupKeybinding(t)?.getElectronAccelerator();n&&(e[t]=n)}this._browserViewService.updateKeybindings(e)}};wqe=I([m(0,pu),m(1,F),m(2,Pe),m(3,_e)],wqe);var fNo="browserViewGroup";var Cqe=class extends x{constructor(e,t,o){super();this.editorService=t;this.editorGroupsService=o;let n=e.getChannel(fNo);this._groupService=Tc.toService(n)}async createSessionGroup(e){let t=this._getWindowIdForBrowser(e),o=await this._groupService.createGroup(t);return await this._groupService.addViewToGroup(o,e),o}async destroySessionGroup(e){await this._groupService.destroyGroup(e)}async sendCDPMessage(e,t){await this._groupService.sendCDPMessage(e,t)}onCDPMessage(e){return this._groupService.onDynamicCDPMessage(e)}onDidDestroy(e){return this._groupService.onDynamicDidDestroy(e)}_getWindowIdForBrowser(e){let t=Ey.forId(e),o=this.editorService.findEditors(t);if(o.length>0){let n=this.editorGroupsService.getGroup(o[0].groupId);if(n)return n.windowId}return this.editorGroupsService.mainPart.windowId}};Cqe=I([m(0,pu),m(1,ee),m(2,wt)],Cqe);var BS=C.equals("activeEditor",sd.EDITOR_ID),Km=L(5418,"Browser");var sKi=class a extends K{static{this.ID=Du.GoBack}constructor(){super({id:a.ID,title:L(5412,"Go Back"),category:Km,icon:R.arrowLeft,f1:!0,precondition:C.and(BS,nKi),menu:{id:D.BrowserNavigationToolbar,group:"navigation",order:1},keybinding:{weight:250,primary:527,secondary:[122],mac:{primary:2140,secondary:[122,2063]}}})}async run(i,e=i.get(ee).activeEditorPane){e instanceof mu&&await e.goBack()}},aKi=class a extends K{static{this.ID=Du.GoForward}constructor(){super({id:a.ID,title:L(5413,"Go Forward"),category:Km,icon:R.arrowRight,f1:!0,precondition:C.and(BS,rKi),menu:{id:D.BrowserNavigationToolbar,group:"navigation",order:2},keybinding:{weight:250,primary:529,secondary:[123],mac:{primary:2142,secondary:[123,2065]}}})}async run(i,e=i.get(ee).activeEditorPane){e instanceof mu&&await e.goForward()}},lKi=class a extends K{static{this.ID=Du.Reload}constructor(){super({id:a.ID,title:L(5417,"Reload"),category:Km,icon:R.refresh,f1:!0,precondition:BS,menu:{id:D.BrowserNavigationToolbar,group:"navigation",order:3,alt:{id:zYt.ID,title:L(5414,"Hard Reload"),icon:R.refresh}},keybinding:{when:u$,weight:275,primary:2096,secondary:[63],mac:{primary:2096,secondary:[]}}})}async run(i,e=i.get(ee).activeEditorPane){e instanceof mu&&await e.reload()}},zYt=class a extends K{static{this.ID=Du.HardReload}constructor(){super({id:a.ID,title:L(5414,"Hard Reload"),category:Km,icon:R.refresh,f1:!0,precondition:BS,keybinding:{when:u$,weight:275,primary:3120,secondary:[2111],mac:{primary:3120,secondary:[]}}})}async run(i,e=i.get(ee).activeEditorPane){e instanceof mu&&await e.reload(!0)}},cKi=class a extends K{static{this.ID=Du.FocusUrlInput}constructor(){super({id:a.ID,title:L(5411,"Focus URL Input"),category:Km,f1:!0,precondition:BS,keybinding:{weight:200,primary:2090}})}async run(i,e=i.get(ee).activeEditorPane){e instanceof mu&&await e.focusUrlInput()}},dKi=class a extends K{static{this.ID=Du.OpenExternal}constructor(){super({id:a.ID,title:L(5415,"Open in External Browser"),category:Km,icon:R.linkExternal,f1:!0,precondition:C.and(BS,iP),menu:{id:D.BrowserActionsToolbar,group:"3_page",order:10}})}async run(i,e=i.get(ee).activeEditorPane){if(e instanceof mu){let t=e.getUrl();t&&await i.get(Je).open(t,{openExternal:!0,allowContributedOpeners:!1})}}},uKi=class a extends K{static{this.ID=Du.OpenSettings}constructor(){super({id:a.ID,title:L(5416,"Open Browser Settings"),category:Km,icon:R.settingsGear,f1:!1,menu:{id:D.BrowserActionsToolbar,group:"4_settings",order:2}})}async run(i){await i.get(Go).openSettings({query:"@id:workbench.browser.*,chat.sendElementsToChat.*"})}};W(sKi);W(aKi);W(lKi);W(zYt);W(cKi);W(dKi);W(uKi);var Nmt=new Y("browserStorageScope","",d(5426,null)),Amt=class extends nV{constructor(i,e){super(i),this._storageScopeContext=Nmt.bindTo(e)}subscribeToModel(i,e){this._storageScopeContext.set(i.storageScope)}clear(){this._storageScopeContext.reset()}};Amt=I([m(1,X)],Amt);mu.registerContribution(Amt);var pKi=class a extends K{static{this.ID=Du.ClearGlobalStorage}constructor(){super({id:a.ID,title:L(5420,"Clear Storage (Global)"),category:Km,icon:R.clearAll,f1:!0,menu:{id:D.BrowserActionsToolbar,group:"4_settings",order:1,when:C.equals(Nmt.key,"global")}})}async run(i){await i.get(v3).clearGlobalStorage()}},mKi=class a extends K{static{this.ID=Du.ClearWorkspaceStorage}constructor(){super({id:a.ID,title:L(5421,"Clear Storage (Workspace)"),category:Km,icon:R.clearAll,f1:!0,menu:{id:D.BrowserActionsToolbar,group:"4_settings",order:1,when:C.equals(Nmt.key,"workspace")}})}async run(i){await i.get(v3).clearWorkspaceStorage()}},hKi=class a extends K{static{this.ID=Du.ClearEphemeralStorage}constructor(){super({id:a.ID,title:L(5419,"Clear Storage (Ephemeral)"),category:Km,icon:R.clearAll,f1:!0,precondition:C.equals(Nmt.key,"ephemeral"),menu:{id:D.BrowserActionsToolbar,group:"4_settings",order:1,when:C.equals(Nmt.key,"ephemeral")}})}async run(i,e=i.get(ee).activeEditorPane){e instanceof mu&&await e.clearStorage()}};W(pKi);W(mKi);W(hKi);ne.as(Jt.Configuration).registerConfiguration({...Ud,properties:{"workbench.browser.dataStorage":{type:"string",enum:["global","workspace","ephemeral"],markdownEnumDescriptions:[d(5424,null),d(5425,null),d(5423,null)],restricted:!0,default:"global",markdownDescription:d(5422,null),scope:4,order:100}}});var vNo=new Y("browserDevToolsOpen",!1,d(5427,null)),Omt=class extends nV{constructor(i,e){super(i),this._devToolsOpenContext=vNo.bindTo(e)}subscribeToModel(i,e){this._devToolsOpenContext.set(i.isDevToolsOpen),e.add(i.onDidChangeDevToolsState(t=>{this._devToolsOpenContext.set(t.isDevToolsOpen)}))}clear(){this._devToolsOpenContext.reset()}};Omt=I([m(1,X)],Omt);mu.registerContribution(Omt);var fKi=class a extends K{static{this.ID=Du.ToggleDevTools}constructor(){super({id:a.ID,title:L(5428,"Toggle Developer Tools"),category:Km,icon:R.terminal,f1:!0,precondition:C.and(BS,iP,rV.negate()),toggled:C.equals(vNo.key,!0),menu:{id:D.BrowserActionsToolbar,group:"actions",order:3},keybinding:{weight:200,primary:70}})}async run(i,e=i.get(ee).activeEditorPane){e instanceof mu&&await e.toggleDevTools()}};W(fKi);async function bNo(a,i,e,...t){return a.invokeFunctionRaw(i,e.toString(),...t)}async function lE(a,i,e,...t){try{let o=await a.invokeFunction(i,e.toString(),...t);return{content:[{kind:"text",value:o.result?JSON.stringify(o.result):"Script executed successfully"},{kind:"text",value:o.summary}]}}catch(o){return sh(o instanceof Error?o.message:String(o))}}function sh(a){return{content:[{kind:"text",value:a}],toolResultError:a}}var aC="open_browser_page",Fmt={id:aC,toolReferenceName:"openBrowserPage",displayName:d(5510,null),userDescription:d(5511,null),modelDescription:"Open a new browser page in the integrated browser at the given URL. Returns a page ID that must be used with other browser tools to interact with the page. Prefer to reuse existing pages whenever possible and only call this tool if a new page is necessary.",icon:R.openInProduct,source:kn.Internal,inputSchema:{type:"object",properties:{url:{type:"string",description:"The full URL to open in the browser."}},required:["url"]}},xqe=class{constructor(i){this.playwrightService=i}async prepareToolInvocation(i,e){let t=i.parameters;if(!t.url)throw new Error('The "url" parameter is required.');let o=URL.parse(t.url);if(!o)throw new Error("You must provide a complete, valid URL.");return{invocationMessage:d(5508,null,o.href),pastTenseMessage:d(5509,null,o.href),confirmationMessages:{title:d(5507,null),message:d(5506,null,o.href),allowAutoConfirm:!0}}}async invoke(i,e,t,o){let n=i.parameters,{pageId:r,summary:s}=await this.playwrightService.openPage(n.url);return{content:[{kind:"text",value:`Page ID: ${r}
${s}`}]}}};xqe=I([m(0,Tf)],xqe);var vKi={id:"click_element",toolReferenceName:"clickElement",displayName:d(5480,null),userDescription:d(5481,null),modelDescription:"Click on an element in a browser page.",icon:R.cursor,source:kn.Internal,inputSchema:{type:"object",properties:{pageId:{type:"string",description:"The browser page ID, acquired from context or the open tool."},selector:{type:"string",description:"Playwright selector of the element to click."},ref:{type:"string",description:'Element reference to click. One of "selector" or "ref" must be provided.'},dblClick:{type:"boolean",description:"Set to true for double clicks. Default is false."},button:{type:"string",enum:["left","right","middle"],description:'Mouse button to click with. Default is "left".'}},required:["pageId"]}},kqe=class{constructor(i){this.playwrightService=i}async prepareToolInvocation(i,e){return{invocationMessage:d(5478,null),pastTenseMessage:d(5479,null)}}async invoke(i,e,t,o){let n=i.parameters;if(!n.pageId)return sh(`No page ID provided. Use '${aC}' first.`);let r=n.selector;if(n.ref&&(r=`aria-ref=${n.ref}`),!r)return sh('Either a "selector" or "ref" parameter is required.');let s=n.button??"left";return n.dblClick?lE(this.playwrightService,n.pageId,(l,c,u)=>l.locator(c).dblclick({button:u}),r,s):lE(this.playwrightService,n.pageId,(l,c,u)=>l.locator(c).click({button:u}),r,s)}};kqe=I([m(0,Tf)],kqe);var bKi={id:"drag_element",toolReferenceName:"dragElement",displayName:d(5484,null),userDescription:d(5485,null),modelDescription:"Drag an element over another element in a browser page.",icon:R.move,source:kn.Internal,inputSchema:{type:"object",properties:{pageId:{type:"string",description:"The browser page ID, acquired from context or the open tool."},fromSelector:{type:"string",description:"Playwright selector of the element to drag."},fromRef:{type:"string",description:'Element reference of the element to drag. One of "fromSelector" or "fromRef" must be provided.'},toSelector:{type:"string",description:"Playwright selector of the element to drop onto."},toRef:{type:"string",description:'Element reference of the element to drop onto. One of "toSelector" or "toRef" must be provided.'}},required:["pageId"]}},Eqe=class{constructor(i){this.playwrightService=i}async prepareToolInvocation(i,e){return{invocationMessage:d(5482,null),pastTenseMessage:d(5483,null)}}async invoke(i,e,t,o){let n=i.parameters;if(!n.pageId)return sh(`No page ID provided. Use '${aC}' first.`);let r=n.fromSelector;if(n.fromRef&&(r=`aria-ref=${n.fromRef}`),!r)return sh('Either a "fromSelector" or "fromRef" parameter is required for the source element.');let s=n.toSelector;return n.toRef&&(s=`aria-ref=${n.toRef}`),s?lE(this.playwrightService,n.pageId,(l,c,u)=>l.dragAndDrop(c,u),r,s):sh('Either a "toSelector" or "toRef" parameter is required for the target element.')}};Eqe=I([m(0,Tf)],Eqe);var SKi={id:"handle_dialog",toolReferenceName:"handleDialog",displayName:d(5488,null),userDescription:d(5489,null),modelDescription:"Respond to a pending modal (alert, confirm, prompt) or file chooser dialog on a browser page.",icon:R.comment,source:kn.Internal,inputSchema:{type:"object",properties:{pageId:{type:"string",description:"The browser page ID, acquired from context or the open tool."},acceptModal:{type:"boolean",description:"Whether to accept (true) or dismiss (false) a modal dialog."},promptText:{type:"string",description:"Text to enter into a prompt dialog."},selectFiles:{type:"array",items:{type:"string"},description:"Absolute paths of files to select, or empty to dismiss. Required for file chooser dialogs."}},required:["pageId"]}},Tqe=class{constructor(i){this.playwrightService=i}async prepareToolInvocation(i,e){return{invocationMessage:d(5486,null),pastTenseMessage:d(5487,null)}}async invoke(i,e,t,o){let n=i.parameters;if(!n.pageId)return sh(`No page ID provided. Use '${aC}' first.`);if(n.selectFiles!==void 0&&(n.acceptModal!==void 0||n.promptText!==void 0))return sh("Invalid parameters. 'selectFiles' cannot be used with 'acceptModal' or 'promptText'.");if(!Array.isArray(n.selectFiles)&&(n.acceptModal===void 0||n.acceptModal===null))return sh("Invalid parameters. Either 'selectFiles' or 'acceptModal' must be provided.");try{let r;return n.selectFiles!==void 0?r=await this.playwrightService.replyToFileChooser(n.pageId,n.selectFiles):r=await this.playwrightService.replyToDialog(n.pageId,n.acceptModal,n.promptText),{content:[{kind:"text",value:r.summary}]}}catch(r){return sh(r instanceof Error?r.message:String(r))}}};Tqe=I([m(0,Tf)],Tqe);var IKi={id:"hover_element",toolReferenceName:"hoverElement",displayName:d(5492,null),userDescription:d(5493,null),modelDescription:"Hover over an element in a browser page. Provide either a Playwright selector or an element reference.",icon:R.cursor,source:kn.Internal,inputSchema:{type:"object",properties:{pageId:{type:"string",description:"The browser page ID, acquired from context or the open tool."},selector:{type:"string",description:"Playwright selector of the element to hover over."},ref:{type:"string",description:'Element reference to hover over. One of "selector" or "ref" must be provided.'}},required:["pageId"]}},_qe=class{constructor(i){this.playwrightService=i}async prepareToolInvocation(i,e){return{invocationMessage:d(5490,null),pastTenseMessage:d(5491,null)}}async invoke(i,e,t,o){let n=i.parameters;if(!n.pageId)return sh(`No page ID provided. Use '${aC}' first.`);let r=n.selector;return n.ref&&(r=`aria-ref=${n.ref}`),r?lE(this.playwrightService,n.pageId,(s,l)=>s.locator(l).hover(),r):sh('Either a "selector" or "ref" parameter is required.')}};_qe=I([m(0,Tf)],_qe);var yKi={id:"navigate_page",toolReferenceName:"navigatePage",displayName:d(5504,null),userDescription:d(5505,null),modelDescription:"Navigate a browser page by URL, history, or reload.",icon:R.arrowRight,source:kn.Internal,inputSchema:{type:"object",properties:{pageId:{type:"string",description:"The browser page ID to navigate, acquired from context or the open tool."},type:{type:"string",enum:["url","back","forward","reload"],description:'Navigation type: "url" to navigate to a URL (default, requires "url" param), "back" or "forward" for history, "reload" to refresh.'},url:{type:"string",description:'The URL to navigate to. Required when type is "url".'}},required:["pageId"]}},Dqe=class{constructor(i){this.playwrightService=i}async prepareToolInvocation(i,e){let t=i.parameters;switch(t.type){case"reload":return{invocationMessage:d(5502,null),pastTenseMessage:d(5503,null)};case"back":return{invocationMessage:d(5494,null),pastTenseMessage:d(5495,null)};case"forward":return{invocationMessage:d(5496,null),pastTenseMessage:d(5497,null)};default:{if(!t.url)throw new Error('The "url" parameter is required when type is "url".');let o=URL.parse(t.url);if(!o)throw new Error("You must provide a complete, valid URL.");return{invocationMessage:d(5500,null,o.href),pastTenseMessage:d(5501,null,o.href),confirmationMessages:{title:d(5499,null),message:d(5498,null,o.href),allowAutoConfirm:!0}}}}}async invoke(i,e,t,o){let n=i.parameters;if(!n.pageId)return sh(`No page ID provided. Use '${aC}' first.`);switch(n.type){case"reload":return lE(this.playwrightService,n.pageId,r=>r.reload({waitUntil:"domcontentloaded"}));case"back":return lE(this.playwrightService,n.pageId,r=>r.goBack({waitUntil:"domcontentloaded"}));case"forward":return lE(this.playwrightService,n.pageId,r=>r.goForward({waitUntil:"domcontentloaded"}));default:return lE(this.playwrightService,n.pageId,(r,s)=>r.goto(s,{waitUntil:"domcontentloaded"}),n.url)}}};Dqe=I([m(0,Tf)],Dqe);var wKi={...Fmt,modelDescription:"Open a new browser page in the integrated browser at the given URL."},Lqe=class{constructor(i,e){this.telemetryService=i;this.editorService=e}async prepareToolInvocation(i,e){let t=i.parameters;if(!t.url)throw new Error('The "url" parameter is required.');let o=URL.parse(t.url);if(!o)throw new Error("You must provide a complete, valid URL.");return{invocationMessage:d(5514,null,o.href),pastTenseMessage:d(5515,null,o.href),confirmationMessages:{title:d(5513,null),message:d(5512,null,o.href),allowAutoConfirm:!0}}}async invoke(i,e,t,o){let n=i.parameters;nH(this.telemetryService,"chatTool");let r=Ey.forId(xt());return await this.editorService.openEditor({resource:r,options:{pinned:!0,viewState:{url:n.url}}}),{content:[{kind:"text",value:"Page opened successfully. Note that you do not have access to the page contents unless the user enables agentic tools via the `workbench.browser.enableChatTools` setting."}]}}};Lqe=I([m(0,Te),m(1,ee)],Lqe);var Wmt={id:"read_page",toolReferenceName:"readPage",displayName:d(5518,null),userDescription:d(5519,null),modelDescription:"Get a snapshot of the current browser page state. This is better than screenshot.",icon:R.fileText,source:kn.Internal,inputSchema:{type:"object",properties:{pageId:{type:"string",description:"The browser page ID to read, acquired from context or the open tool."}},required:["pageId"]}},Rqe=class{constructor(i){this.playwrightService=i}async prepareToolInvocation(i,e){let t=`[browser page](${Ey.forId(i.parameters.pageId).toString()})`;return{invocationMessage:new Ie(d(5516,null,t)),pastTenseMessage:new Ie(d(5517,null,t))}}async invoke(i,e,t,o){let n=i.parameters;if(!n.pageId)return sh(`No page ID provided. Use '${aC}' first.`);let r=await this.playwrightService.getSummary(n.pageId);return r?{content:[{kind:"text",value:r}]}:sh("No page summary available.")}};Rqe=I([m(0,Tf)],Rqe);var CKi={id:"run_playwright_code",toolReferenceName:"runPlaywrightCode",displayName:d(5525,null),userDescription:d(5526,null),modelDescription:"Run a Playwright code snippet to control a browser page. Only use this if other browser tools are insufficient.",icon:R.terminal,source:kn.Internal,inputSchema:{type:"object",properties:{pageId:{type:"string",description:"The browser page ID, acquired from context or the open tool."},code:{type:"string",description:'The Playwright code to execute. The code must be concise, serve one clear purpose, and be self-contained. You **must not** directly access `document` or `window` using this tool. You must access it via the provided `page` object, e.g. "return page.evaluate(() => document.title)".'}},required:["pageId","code"]}},Mqe=class{constructor(i){this.playwrightService=i}async prepareToolInvocation(i,e){let o=i.parameters.code??"";return{invocationMessage:new Ie(d(5522,null)),pastTenseMessage:new Ie(d(5524,null)),confirmationMessages:{title:d(5521,null),message:new Ie(`\`\`\`javascript
${o.trim()}
\`\`\``),disclaimer:d(5520,null),allowAutoConfirm:!0}}}async invoke(i,e,t,o){let n=i.parameters;if(!n.pageId)return sh(`No page ID provided. Use '${aC}' first.`);if(!n.code)return sh('The "code" parameter is required.');let r;try{r=await this.playwrightService.invokeFunction(n.pageId,`async (page) => { ${n.code} }`)}catch(c){let u=c instanceof Error?c.message:String(c);return sh(`Code execution failed: ${u}`)}let s=JSON.stringify(r.result||null),l;return r.result&&(l=new Ie,l.appendMarkdown(d(5523,null)),l.appendText(`
`),l.appendCodeblock("json",s)),{content:[{kind:"text",value:r.result?s:"Code executed successfully"},{kind:"text",value:r.summary}],toolResultDetails:{input:n.code.trim(),inputLanguage:"javascript",output:r.result?[{type:"embed",isText:!0,value:JSON.stringify(r.result,null,2)}]:[],isError:!1}}}};Mqe=I([m(0,Tf)],Mqe);var xKi={id:"screenshot_page",toolReferenceName:"screenshotPage",displayName:d(5529,null),userDescription:d(5530,null),modelDescription:`Capture a screenshot of the current browser page. You can't perform actions based on the screenshot; use ${Wmt.id} for actions.`,icon:R.deviceCamera,source:kn.Internal,inputSchema:{type:"object",properties:{pageId:{type:"string",description:"The browser page ID to capture, acquired from context or the open tool."},selector:{type:"string",description:"Playwright selector of an element to capture. If omitted, captures the whole viewport."},ref:{type:"string",description:"Element reference to capture. If omitted, captures the whole viewport."},scrollIntoViewIfNeeded:{type:"boolean",description:"Whether to scroll the element into view before capturing. Defaults to false."}},required:["pageId"]}},Pqe=class{constructor(i,e){this.browserViewWorkbenchService=i;this.playwrightService=e}async prepareToolInvocation(i,e){return{invocationMessage:d(5527,null),pastTenseMessage:d(5528,null)}}async invoke(i,e,t,o){let n=i.parameters;if(!n.pageId)return sh(`No page ID provided. Use '${aC}' first.`);let r=n.selector;n.ref&&(r=`aria-ref=${n.ref}`);let s=await this.browserViewWorkbenchService.getBrowserViewModel(n.pageId),l=r&&await bNo(this.playwrightService,n.pageId,async(u,p,h)=>{let g=u.locator(p);return h&&await g.scrollIntoViewIfNeeded(),g.boundingBox()},r,n.scrollIntoViewIfNeeded)||void 0;return{content:[{kind:"data",value:{mimeType:"image/jpeg",data:await s.captureScreenshot({pageRect:l})}}]}}};Pqe=I([m(0,v3),m(1,Tf)],Pqe);var kKi={id:"type_in_page",toolReferenceName:"typeInPage",displayName:d(5535,null),userDescription:d(5536,null),modelDescription:"Type text or press keys in a browser page.",icon:R.symbolText,source:kn.Internal,inputSchema:{type:"object",properties:{pageId:{type:"string",description:"The browser page ID, acquired from context or the open tool."},text:{type:"string",description:'The text to type. One of "text" or "key" must be provided.'},key:{type:"string",description:'A key or key combination to press (e.g., "Enter", "Tab", "Control+c"). One of "text" or "key" must be provided.'},selector:{type:"string",description:"Playwright selector of element to target. If omitted, types into the focused element."},ref:{type:"string",description:"Element reference to target. If omitted, types into the focused element."}},required:["pageId"]}},Aqe=class{constructor(i){this.playwrightService=i}async prepareToolInvocation(i,e){let t=i.parameters;return t.key?{invocationMessage:d(5531,null,t.key),pastTenseMessage:d(5532,null,t.key)}:{invocationMessage:d(5533,null),pastTenseMessage:d(5534,null)}}async invoke(i,e,t,o){let n=i.parameters;if(!n.pageId)return sh(`No page ID provided. Use '${aC}' first.`);let r=n.selector;return n.ref&&(r=`aria-ref=${n.ref}`),!n.text&&!n.key?sh('Either a "text" or "key" parameter is required.'):n.key?r?lE(this.playwrightService,n.pageId,(s,l,c)=>s.locator(l).press(c),r,n.key):lE(this.playwrightService,n.pageId,(s,l)=>s.keyboard.press(l),n.key):r?lE(this.playwrightService,n.pageId,(s,l,c)=>s.locator(l).fill(c),r,n.text):lE(this.playwrightService,n.pageId,(s,l)=>s.keyboard.type(l),n.text)}};Aqe=I([m(0,Tf)],Aqe);var p$=class extends x{constructor(e,t,o,n,r,s){super();this.instantiationService=e;this.toolsService=t;this.configurationService=o;this.playwrightService=n;this.chatContextService=r;this.editorService=s;this._toolsStore=this._register(new N);this._trackedIds=new Set;this._browserToolSet=this._register(this.toolsService.createToolSet(kn.Internal,"browser","browser",{icon:R.globe,description:d(5477,null)})),this._updateToolRegistrations(),this._register(o.onDidChangeConfiguration(l=>{l.affectsConfiguration("workbench.browser.enableChatTools")&&this._updateToolRegistrations()}))}static{this.ID="browserView.chatAgentTools"}static{this.CONTEXT_ID="browserView.trackedPages"}_updateToolRegistrations(){if(this._toolsStore.clear(),!this.configurationService.getValue("workbench.browser.enableChatTools")){this._toolsStore.add(this.toolsService.registerTool(wKi,this.instantiationService.createInstance(Lqe))),this._toolsStore.add(this._browserToolSet.addTool(wKi)),this.chatContextService.updateWorkspaceContextItems(p$.CONTEXT_ID,[]);return}this._toolsStore.add(this.toolsService.registerTool(Fmt,this.instantiationService.createInstance(xqe))),this._toolsStore.add(this.toolsService.registerTool(Wmt,this.instantiationService.createInstance(Rqe))),this._toolsStore.add(this.toolsService.registerTool(xKi,this.instantiationService.createInstance(Pqe))),this._toolsStore.add(this.toolsService.registerTool(yKi,this.instantiationService.createInstance(Dqe))),this._toolsStore.add(this.toolsService.registerTool(vKi,this.instantiationService.createInstance(kqe))),this._toolsStore.add(this.toolsService.registerTool(bKi,this.instantiationService.createInstance(Eqe))),this._toolsStore.add(this.toolsService.registerTool(IKi,this.instantiationService.createInstance(_qe))),this._toolsStore.add(this.toolsService.registerTool(kKi,this.instantiationService.createInstance(Aqe))),this._toolsStore.add(this.toolsService.registerTool(CKi,this.instantiationService.createInstance(Mqe))),this._toolsStore.add(this.toolsService.registerTool(SKi,this.instantiationService.createInstance(Tqe))),this._toolsStore.add(this._browserToolSet.addTool(Fmt)),this._toolsStore.add(this._browserToolSet.addTool(Wmt)),this._toolsStore.add(this._browserToolSet.addTool(xKi)),this._toolsStore.add(this._browserToolSet.addTool(yKi)),this._toolsStore.add(this._browserToolSet.addTool(vKi)),this._toolsStore.add(this._browserToolSet.addTool(bKi)),this._toolsStore.add(this._browserToolSet.addTool(IKi)),this._toolsStore.add(this._browserToolSet.addTool(kKi)),this._toolsStore.add(this._browserToolSet.addTool(CKi)),this._toolsStore.add(this._browserToolSet.addTool(SKi)),this.playwrightService.getTrackedPages().then(e=>{this._trackedIds=new Set(e),this._updateBrowserContext()}),this._toolsStore.add(this.playwrightService.onDidChangeTrackedPages(e=>{this._trackedIds=new Set(e),this._updateBrowserContext()})),this._toolsStore.add(this.editorService.onDidEditorsChange(()=>this._updateBrowserContext()))}_updateBrowserContext(){let e=[],t=this.editorService.activeEditor,o=new Set(this.editorService.visibleEditors);for(let n of this.editorService.editors)if(n instanceof sd&&this._trackedIds.has(n.id)){let r=n.getTitle()||"Untitled",s=n.getDescription()||"about:blank",l=n===t?" (active)":o.has(n)?" (visible)":"";e.push(`- [${n.id}] ${r} (${s})${l}`)}if(e.length===0){this.chatContextService.updateWorkspaceContextItems(p$.CONTEXT_ID,[]);return}this.chatContextService.updateWorkspaceContextItems(p$.CONTEXT_ID,[{handle:0,label:d(5476,null),modelDescription:"The following browser pages are currently available and can be interacted with using the browser tools:",value:e.join(`
`)}])}};p$=I([m(0,F),m(1,Vn),m(2,B),m(3,Tf),m(4,ED),m(5,ee)],p$);It(p$.ID,p$,St.AfterRestored);var SNo=C.equals("activeEditor",sd.EDITOR_ID),pwn=L(5437,"Browser"),GYt=new Y("browserElementSelectionActive",!1,d(5432,null)),KYt=C.and(ie.enabled,C.has("config.chat.agent.enabled"),C.has("config.workbench.browser.enableChatTools")),Ese=class extends nV{constructor(e,t,o,n,r,s,l){super(e);this.contextKeyService=t;this.telemetryService=n;this.logService=r;this.chatWidgetService=s;this.configurationService=l;this._elementSelectionActiveContext=GYt.bindTo(t);let c=this._register(o.createInstance(mf,"element",void 0,{position:{hoverPosition:3}}));this._shareButtonContainer=_(".browser-share-toggle-container"),this._shareButton=this._register(new Wi(this._shareButtonContainer,{supportIcons:!0,title:d(5434,null),small:!0,hoverDelegate:c})),this._shareButton.element.classList.add("browser-share-toggle"),this._shareButton.label="$(agent)",this._register(this._shareButton.onDidClick(()=>{this._toggleShareWithAgent()}));let u=()=>{this._shareButtonContainer.style.display=t.contextMatchesRules(KYt)?"":"none"};u();let p=new Set(KYt.keys());this._register(U.filter(t.onDidChangeContext,h=>h.affectsSome(p))(()=>{u()}))}get urlBarWidgets(){return[{element:this._shareButtonContainer,order:100}]}subscribeToModel(e,t){this._updateSharingState(!0),t.add(e.onDidChangeSharedWithAgent(()=>{this._updateSharingState(!1)})),t.add(U.filter(this.contextKeyService.onDidChangeContext,o=>o.affectsSome(new Set(KYt.keys())))(()=>{this._updateSharingState(!1)}))}clear(){this._elementSelectionCts&&(this._elementSelectionCts.dispose(!0),this._elementSelectionCts=void 0),this._elementSelectionActiveContext.reset()}_toggleShareWithAgent(){let e=this.editor.model;e&&e.setSharedWithAgent(!e.sharedWithAgent)}_updateSharingState(e){let t=this.editor.model,n=this.contextKeyService.contextMatchesRules(KYt)&&!!t&&t.sharedWithAgent;this.editor.browserContainer.classList.toggle("animate",!e),this.editor.browserContainer.classList.toggle("shared",n),this._shareButton.checked=n,this._shareButton.label=n?d(5435,null)+" $(agent)":"$(agent)",this._shareButton.setTitle(n?d(5436,null):d(5434,null))}async addElementToChat(){if(this._elementSelectionCts){this._elementSelectionCts.dispose(!0),this._elementSelectionCts=void 0,this._elementSelectionActiveContext.set(!1);return}let e=new Ye;this._elementSelectionCts=e,this._elementSelectionActiveContext.set(!0),this.telemetryService.publicLog2("integratedBrowser.addElementToChat.start",{});try{let t=this.editor.model;if(!t)throw new Error("No browser view model found");this.editor.ensureBrowserFocus();let o=await t.getElementData(e.token);if(!o)throw new Error("Element data not found");let{attachCss:n,attachImages:r}=await this._attachElementDataToChat(o);this.telemetryService.publicLog2("integratedBrowser.addElementToChat.added",{attachCss:n,attachImages:r})}catch(t){e.token.isCancellationRequested||this.logService.error("BrowserEditor.addElementToChat: Failed to select element",t)}finally{e.dispose(!0),this._elementSelectionCts===e&&(this._elementSelectionCts=void 0,this._elementSelectionActiveContext.set(!1))}}async addFocusedElementToChat(){if(!this._elementSelectionCts)return;let e=this._elementSelectionCts,t=this.editor.model;if(!t)return;let o=await t.getFocusedElementData();o&&(await this._attachElementDataToChat(o),e.dispose(!0),this._elementSelectionCts===e&&(this._elementSelectionCts=void 0,this._elementSelectionActiveContext.set(!1)))}async _attachElementDataToChat(e){let t=e.bounds,o=[],n=document.createElement("div");NP(n,e.outerHTML);let r=n.firstElementChild,s=n.textContent,l=r?`${r.tagName.toLowerCase()}${r.id?`#${r.id}`:""}`:"",c=r?`${l}${r.classList.length?`.${[...r.classList].join(".")}`:""}`:"";if(e.ancestors&&e.ancestors.length>0){let v=e.ancestors[e.ancestors.length-1],b="";v.tagName.startsWith("::")&&e.ancestors.length>1&&(b=v.tagName,v=e.ancestors[e.ancestors.length-2]),l=`${v.tagName.toLowerCase()}${v.id?`#${v.id}`:""}${b}`,c=`${v.tagName.toLowerCase()}${v.id?`#${v.id}`:""}${v.classNames&&v.classNames.length?`.${v.classNames.join(".")}`:""}${b}`}let u=this.configurationService.getValue("chat.sendElementsToChat.attachCSS"),p=DCo(e,c,u);o.push({id:"element-"+Date.now(),name:l,fullName:c,value:p,modelDescription:u?"Structured browser element context with HTML path, attributes, and computed styles.":"Structured browser element context with HTML path and attributes.",kind:"element",icon:q.fromId(R.layout.id),ancestors:e.ancestors,attributes:e.attributes,computedStyles:u?e.computedStyles:void 0,dimensions:e.dimensions,innerText:s});let h=this.configurationService.getValue("chat.sendElementsToChat.attachImages"),g=this.editor.model;if(h&&g){let v=await g.captureScreenshot({quality:90,pageRect:t});o.push({id:"element-screenshot-"+Date.now(),name:"Element Screenshot",fullName:"Element Screenshot",kind:"image",value:v.buffer})}return(await this.chatWidgetService.revealWidget()??this.chatWidgetService.lastFocusedWidget)?.attachmentModel?.addContext(...o),{attachCss:u,attachImages:h}}async addConsoleLogsToChat(){let e=this.editor.model;if(e)try{let t=await e.getConsoleLogs();if(!t)return;let o=[];o.push({id:"console-logs-"+Date.now(),name:d(5438,null),fullName:d(5438,null),value:t,modelDescription:"Console logs captured from Integrated Browser.",kind:"element",icon:q.fromId(R.terminal.id)}),(await this.chatWidgetService.revealWidget()??this.chatWidgetService.lastFocusedWidget)?.attachmentModel?.addContext(...o)}catch(t){this.logService.error("BrowserEditor.addConsoleLogsToChat: Failed to get console logs",t)}}};Ese=I([m(1,X),m(2,F),m(3,Te),m(4,se),m(5,Pt),m(6,B)],Ese);mu.registerContribution(Ese);var EKi=class a extends K{static{this.ID=Du.AddElementToChat}constructor(){let i=C.and(ie.enabled,C.equals("config.chat.sendElementsToChat.enabled",!0));super({id:a.ID,title:L(5430,"Add Element to Chat"),category:pwn,icon:R.inspect,f1:!0,precondition:C.and(SNo,iP,rV.negate(),i),toggled:GYt,menu:{id:D.BrowserActionsToolbar,group:"actions",order:1,when:i},keybinding:[{weight:250,primary:3105},{when:GYt,weight:200,primary:9}]})}async run(i,e=i.get(ee).activeEditorPane){e instanceof mu&&await e.getContribution(Ese)?.addElementToChat()}},TKi=class a extends K{static{this.ID=Du.AddConsoleLogsToChat}constructor(){let i=C.and(ie.enabled,C.equals("config.chat.sendElementsToChat.enabled",!0));super({id:a.ID,title:L(5429,"Add Console Logs to Chat"),category:Km,icon:R.output,f1:!0,precondition:C.and(SNo,iP,rV.negate(),i),menu:{id:D.BrowserActionsToolbar,group:"actions",order:2,when:i}})}async run(i,e=i.get(ee).activeEditorPane){e instanceof mu&&await e.getContribution(Ese)?.addConsoleLogsToChat()}},_Ki=class extends K{constructor(){super({id:"workbench.action.browser.addFocusedElementToChat",title:L(5431,"Add Focused Element to Chat"),category:Km,f1:!1,precondition:u$,keybinding:{weight:250,primary:2051,when:GYt}})}async run(i){let e=i.get(ee).activeEditorPane;e instanceof mu&&await e.getContribution(Ese)?.addFocusedElementToChat()}};W(EKi);W(TKi);W(_Ki);ne.as(Jt.Configuration).registerConfiguration({...Ud,properties:{"workbench.browser.enableChatTools":{type:"boolean",default:!1,experiment:{mode:"startup"},tags:["experimental"],markdownDescription:d(5433,null),policy:{name:"BrowserChatTools",category:"InteractiveSession",minimumVersion:"1.110",value:a=>a.chat_preview_features_enabled===!1?!1:void 0,localization:{description:{key:"browser.enableChatTools",value:d(5433,null)}}}}}});var INo=new Y("browserCanZoomIn",!0,d(5445,null)),yNo=new Y("browserCanZoomOut",!0,d(5446,null)),DKi=class extends x{constructor(){super();this._timeout=this._register(new me);this.element=_(".browser-zoom-pill"),this.element.setAttribute("aria-hidden","true"),this._icon=_("span"),this._label=_("span"),this.element.appendChild(this._icon),this.element.appendChild(this._label)}show(e,t){this._icon.className=q.asClassName(t?R.zoomIn:R.zoomOut),this._label.textContent=e,this.element.classList.add("visible"),this._timeout.value=tn(()=>{this.element.classList.remove("visible")},750)}},Tse=class extends nV{constructor(e,t,o,n){super(e);this.browserZoomService=o;this.accessibilityService=n;this._canZoomInContext=INo.bindTo(t),this._canZoomOutContext=yNo.bindTo(t),this._zoomPill=this._register(new DKi)}get urlBarWidgets(){return[{element:this._zoomPill.element,order:0}]}subscribeToModel(e,t){this._updateZoomContext(e),t.add(e.onDidChangeZoom(()=>{this._updateZoomContext(e)}))}clear(){this._canZoomInContext.reset(),this._canZoomOutContext.reset()}async zoomIn(){await this.editor.model?.zoomIn(),this._showZoomPill()}async zoomOut(){await this.editor.model?.zoomOut(),this._showZoomPill()}async resetZoom(){await this.editor.model?.resetZoom(),this._showZoomPill()}_updateZoomContext(e){this._canZoomInContext.set(e.canZoomIn),this._canZoomOutContext.set(e.canZoomOut)}_showZoomPill(){let e=this.editor.model;if(!e)return;let t=this.browserZoomService.getEffectiveZoomIndex(void 0,!1),o=DD[t],n=e.zoomFactor,r=xao(n);this._zoomPill.show(r,n>=o),this.accessibilityService.status(kao(n))}};Tse=I([m(1,X),m(2,YDe),m(3,Oi)],Tse);mu.registerContribution(Tse);var LKi=class a extends K{static{this.ID="workbench.action.browser.zoomIn"}constructor(){super({id:a.ID,title:L(5450,"Zoom In"),category:Km,icon:R.zoomIn,f1:!0,precondition:C.and(BS,iP,rV.negate()),menu:{id:D.BrowserActionsToolbar,group:"2_zoom",order:1,when:INo},keybinding:{when:u$,weight:275,primary:2134,secondary:[3158,2157]}})}async run(i,e=i.get(ee).activeEditorPane){e instanceof mu&&await e.getContribution(Tse)?.zoomIn()}},RKi=class a extends K{static{this.ID="workbench.action.browser.zoomOut"}constructor(){super({id:a.ID,title:L(5451,"Zoom Out"),category:Km,icon:R.zoomOut,f1:!0,precondition:C.and(BS,iP,rV.negate()),menu:{id:D.BrowserActionsToolbar,group:"2_zoom",order:2,when:yNo},keybinding:{when:u$,weight:275,primary:2136,secondary:[3160,2159],linux:{primary:2136,secondary:[2159]}}})}async run(i,e=i.get(ee).activeEditorPane){e instanceof mu&&await e.getContribution(Tse)?.zoomOut()}},MKi=class a extends K{static{this.ID="workbench.action.browser.resetZoom"}constructor(){super({id:a.ID,title:L(5449,"Reset Zoom"),category:Km,icon:R.screenNormal,f1:!0,precondition:C.and(BS,iP,rV.negate()),menu:{id:D.BrowserActionsToolbar,group:"2_zoom",order:3},keybinding:{when:u$,weight:275,primary:2146}})}async run(i,e=i.get(ee).activeEditorPane){e instanceof mu&&await e.getContribution(Tse)?.resetZoom()}};W(LKi);W(RKi);W(MKi);var Nqe=class extends x{static{this.ID="workbench.contrib.browserView.windowZoomSynchronizer"}constructor(i){super(),i.notifyWindowZoomChanged(lce(mC(ut))),this._register(tIe(()=>{i.notifyWindowZoomChanged(lce(mC(ut)))}))}};Nqe=I([m(0,YDe)],Nqe);It(Nqe.ID,Nqe,St.BlockRestore);Ee(YDe,QDe,1);ne.as(Jt.Configuration).registerConfiguration({...Ud,properties:{"workbench.browser.pageZoom":{type:"string",enum:[AXe,...DD.map(a=>`${Math.round(a*100)}%`)],markdownEnumDescriptions:[d(5447,null),...DD.map(()=>"")],default:AXe,markdownDescription:d(5448,null),scope:2}}});var qYt=new Y("browserFindWidgetVisible",!1,d(5442,null)),FKi=new Y("browserFindWidgetFocused",!1,d(5441,null)),Vmt=class extends gre{constructor(e,t,o,n,r,s,l){super({showCommonFindToggles:!0,checkImeCompletionState:!0,showResultCount:!0,enableSash:!0,initialWidth:350,previousMatchActionId:Du.FindPrevious,nextMatchActionId:Du.FindNext,closeWidgetActionId:Du.HideFind},t,o,n,r,s,l);this._modelDisposables=this._register(new N);this._hasFoundMatch=!1;this._onDidChangeHeight=this._register(new E);this.onDidChangeHeight=this._onDidChangeHeight.event;this._findWidgetVisible=qYt.bindTo(o),this._findWidgetFocused=FKi.bindTo(o);let c=this.getDomNode();e.appendChild(c);let u=c.offsetHeight,p=new(Re(e)).ResizeObserver(()=>{let h=c.offsetHeight;h!==u&&(u=h,this._onDidChangeHeight.fire())});p.observe(c),this._register(Z(()=>p.disconnect()))}setModel(e){this._modelDisposables.clear(),this._model=e,this._lastFindResult=void 0,this._hasFoundMatch=!1,e&&(this._modelDisposables.add(e.onDidFindInPage(t=>{this._lastFindResult={resultIndex:t.activeMatchOrdinal-1,resultCount:t.matches},this._hasFoundMatch=t.matches>0,this.updateButtons(this._hasFoundMatch),this.updateResultCount()})),this._modelDisposables.add(e.onWillDispose(()=>{this.setModel(void 0)})))}reveal(e){let t=this.isVisible();super.reveal(e),this._findWidgetVisible.set(!0),this.focusFindBox(),this.inputValue&&!t&&this._onInputChanged()}hide(){super.hide(!1),this._findWidgetVisible.reset(),this._model?.stopFindInPage(!0),this._model?.focus(),this._lastFindResult=void 0,this._hasFoundMatch=!1}find(e){let t=this.inputValue;t&&this._model&&this._model.findInPage(t,{forward:!e,recompute:!1,matchCase:this._getCaseSensitiveValue()})}findFirst(){let e=this.inputValue;e&&this._model&&this._model.findInPage(e,{forward:!0,recompute:!0,matchCase:this._getCaseSensitiveValue()})}clear(){this._model&&(this._model.stopFindInPage(!1),this._lastFindResult=void 0,this._hasFoundMatch=!1)}_onInputChanged(){return this.inputValue?this.findFirst():this._model&&this.clear(),!1}async _getResultCount(){return this._lastFindResult}_onFocusTrackerFocus(){this._findWidgetFocused.set(!0)}_onFocusTrackerBlur(){this._findWidgetFocused.reset()}_onFindInputFocusTrackerFocus(){}_onFindInputFocusTrackerBlur(){}};Vmt=I([m(1,Wn),m(2,X),m(3,nt),m(4,_e),m(5,B),m(6,Oi)],Vmt);var v9=class extends nV{constructor(e,t){super(e);this.instantiationService=t;this._findWidgetContainer=_(".browser-find-widget-wrapper"),this._findWidget=new co(()=>{let o=this.instantiationService.createInstance(Vmt,this._findWidgetContainer);return e.model&&o.setModel(e.model),o.onDidChangeHeight(()=>{e.layoutBrowserContainer()}),o}),this._register(Z(()=>this._findWidget.rawValue?.dispose()))}get toolbarElements(){return[this._findWidgetContainer]}subscribeToModel(e,t){this._findWidget.rawValue?.setModel(e)}clear(){this._findWidget.rawValue?.setModel(void 0),this._findWidget.rawValue?.hide()}layout(e){this._findWidget.rawValue?.layout(e)}async showFind(){let e=(await this.editor.model?.getSelectedText())?.trim(),t=e&&!/[\r\n]/.test(e)?e:void 0;this._findWidget.value.reveal(t),this._findWidget.value.layout(this._findWidgetContainer.clientWidth)}hideFind(){this._findWidget.rawValue?.hide()}findNext(){this._findWidget.rawValue?.find(!1)}findPrevious(){this._findWidget.rawValue?.find(!0)}};v9=I([m(1,F)],v9);mu.registerContribution(v9);var PKi=class a extends K{static{this.ID=Du.ShowFind}constructor(){super({id:a.ID,title:L(5444,"Find in Page"),category:Km,f1:!0,precondition:C.and(BS,iP,rV.negate()),menu:{id:D.BrowserActionsToolbar,group:"3_page",order:1},keybinding:{weight:100,primary:2084}})}run(i,e=i.get(ee).activeEditorPane){e instanceof mu&&e.getContribution(v9)?.showFind()}},AKi=class a extends K{static{this.ID=Du.HideFind}constructor(){super({id:a.ID,title:L(5443,"Close Find Widget"),category:Km,f1:!1,precondition:C.and(BS,qYt),keybinding:{weight:105,primary:9}})}run(i){let e=i.get(ee).activeEditorPane;e instanceof mu&&e.getContribution(v9)?.hideFind()}},NKi=class a extends K{static{this.ID=Du.FindNext}constructor(){super({id:a.ID,title:L(5439,"Find Next"),category:Km,f1:!1,precondition:BS,keybinding:[{when:FKi,weight:100,primary:3},{when:qYt,weight:100,primary:61,mac:{primary:2085}}]})}run(i){let e=i.get(ee).activeEditorPane;e instanceof mu&&e.getContribution(v9)?.findNext()}},OKi=class a extends K{static{this.ID=Du.FindPrevious}constructor(){super({id:a.ID,title:L(5440,"Find Previous"),category:Km,f1:!1,precondition:BS,keybinding:[{when:FKi,weight:100,primary:1027},{when:qYt,weight:100,primary:1085,mac:{primary:3109}}]})}run(i){let e=i.get(ee).activeEditorPane;e instanceof mu&&e.getContribution(v9)?.findPrevious()}};W(PKi);W(AKi);W(NKi);W(OKi);var $Yt=new Y("browserEditorOpen",!1,d(5457,null)),mwn={iconClass:q.asClassName(R.close),tooltip:d(5456,null)},hwn={iconClass:q.asClassName(R.closeAll),tooltip:d(5455,null),location:2},Bmt=class extends x{constructor(e,t,o,n){super();this._editorService=e;this._editorGroupsService=t;this._itemListeners=this._register(new N);this._openNewTabPick={groupId:-1,editor:void 0,label:d(5461,null),iconClass:q.asClassName(R.add),alwaysShow:!0};this._quickPick=this._register(o.createQuickPick({useSeparators:!0})),this._quickPick.placeholder=d(5463,null),this._quickPick.matchOnDescription=!0,this._quickPick.sortByLabel=!1,this._quickPick.buttons=[hwn],this._register(this._quickPick.onDidTriggerItemButton(async({item:r})=>{if(!r.editor)return;let s=this._editorGroupsService.getGroup(r.groupId);s&&await s.closeEditor(r.editor,{preserveFocus:!0})})),this._register(this._quickPick.onDidTriggerButton(async()=>{for(let r of this._editorGroupsService.getGroups(2)){let s=r.editors.filter(l=>l instanceof sd);s.length>0&&await r.closeEditors(s,{preserveFocus:!0})}})),this._register(this._quickPick.onDidAccept(async()=>{let[r]=this._quickPick.selectedItems;r&&(r===this._openNewTabPick?(nH(n,"quickOpenWithoutUrl"),this._quickPick.hide(),await this._editorService.openEditor({resource:Ey.forId(xt())})):await this._editorService.openEditor(r.editor,r.groupId))})),this._register(this._quickPick.onDidHide(()=>this.dispose()))}show(){this._buildItems();let e=this._editorService.activeEditor;if(e instanceof sd){let t=this._quickPick.items.find(o=>o.type!=="separator"&&o.editor===e);t&&(this._quickPick.activeItems=[t])}this._quickPick.show()}_buildItems(){this._itemListeners.clear();let e=this._quickPick.activeItems[0]?.editor,t=[],n=this._editorGroupsService.getGroups(2).map(c=>({group:c,browserEditors:c.editors.filter(u=>u instanceof sd)})).filter(({browserEditors:c})=>c.length>0),r=n.length>1,s=new Map;for(let{group:c}of n)s.set(c.id,c.ariaLabel);let l;for(let{group:c,browserEditors:u}of n){r&&t.push({type:"separator",label:c.label});for(let p of u){let h=p.getIcon(),g=p.getDescription(),f=g?`${p.getName()} ${g}`:p.getName(),v={groupId:c.id,editor:p,label:p.getName(),ariaLabel:r?d(5468,null,f,s.get(c.id)):f,description:g,buttons:[mwn],italic:!c.isPinned(p)};h instanceof A?v.iconPath={dark:h}:h&&(v.iconClass=q.asClassName(h)),t.push(v),p===e&&(l=v),this._itemListeners.add(p.onDidChangeLabel(()=>this._buildItems()))}this._itemListeners.add(c.onDidModelChange(()=>this._buildItems()))}t.push({type:"separator"}),t.push(this._openNewTabPick),this._quickPick.keepScrollPosition=!0,this._quickPick.items=t,l&&(this._quickPick.activeItems=[l])}};Bmt=I([m(0,ee),m(1,wt),m(2,Ue),m(3,Te)],Bmt);var WKi=class extends K{constructor(){let i=C.equals("config.workbench.browser.showInTitleBar",!1);super({id:Du.QuickOpen,title:L(5462,"Quick Open Browser Tab..."),icon:R.globe,category:Km,f1:!0,keybinding:{weight:200,primary:3103,when:BS},menu:{id:D.TitleBar,group:"navigation",order:10,when:C.and($Yt,i.negate())}})}run(i){i.get(F).createInstance(Bmt).show()}},VKi=class extends K{constructor(){super({id:Du.Open,title:L(5459,"Open Integrated Browser"),category:Km,icon:R.globe,f1:!0,menu:{id:D.TitleBar,group:"navigation",order:10,when:C.and(C.equals("config.workbench.browser.showInTitleBar",1),$Yt.negate())}})}async run(i,e){let t=i.get(ee),o=i.get(Te),n=typeof e=="string"?{url:e}:e??{},r=Ey.forId(xt()),s=n.openToSide?In:jn;if(n.reuseUrlFilter){let c=A.parse(n.reuseUrlFilter),u=t.editors.find(p=>{if(!(p instanceof sd))return!1;let h=A.parse(p.url||"");if(c.scheme&&n.reuseUrlFilter.startsWith(`${c.scheme}:`)&&c.scheme!==h.scheme||c.authority&&!Ed(c.authority,h.authority)||c.path&&!Ed(c.path,h.path))return!1;if(c.query){let g=new URLSearchParams(c.query),f=new URLSearchParams(h.query);if(![...g].every(([v,b])=>Ed(b,f.get(v)??"")))return!1}return!0});if(u){n.url&&u.navigate(n.url),await t.openEditor(u);return}}nH(o,n.url?"commandWithUrl":"commandWithoutUrl");let l=await t.openEditor({resource:r,options:{viewState:{url:n.url}}},s);n.openToSide&&l?.group&&l.group.lock(!0)}},BKi=class extends K{constructor(){super({id:Du.NewTab,title:L(5458,"New Tab"),category:Km,f1:!0,precondition:BS,menu:{id:D.BrowserActionsToolbar,group:"1_tabs",order:1},keybinding:{weight:250,primary:2098}})}async run(i,e=i.get(ee).activeEditorPane){let t=i.get(ee),o=i.get(Te),n=Ey.forId(xt());nH(o,"newTabCommand"),await t.openEditor({resource:n})}},HKi=class extends K{constructor(){super({id:Du.CloseAll,title:L(5452,"Close All Browser Tabs"),category:Km,f1:!0,precondition:$Yt})}async run(i){let e=i.get(wt);for(let t of e.getGroups(2)){let o=t.getEditors(1).filter(n=>n instanceof sd);o.length>0&&await t.closeEditors(o)}}},UKi=class extends K{constructor(){super({id:Du.CloseAllInGroup,title:L(5453,"Close All Browser Tabs in Group"),category:Km,f1:!0,precondition:BS})}async run(i){let e=i.get(wt),t=i.get(ee),o=e.getGroup(t.activeEditorPane?.group?.id??e.activeGroup.id);if(!o)return;let n=o.getEditors(1).filter(r=>r instanceof sd);n.length>0&&await o.closeEditors(n)}};ve.appendMenuItem(D.EditorTitleContext,{command:{id:Du.CloseAllInGroup,title:d(5454,null)},group:"1_close",order:55,when:BS});W(WKi);W(VKi);W(BKi);W(HKi);W(UKi);W(class extends MW{constructor(){super("workbench.browser.showInTitleBar",d(5469,null),d(5470,null),8)}});var Oqe=class extends x{static{this.ID="workbench.contrib.browserEditorOpenContextKey"}constructor(i,e){super();let t=$Yt.bindTo(i),o=()=>t.set(e.editors.some(n=>n instanceof sd));o(),this._register(e.onWillOpenEditor(n=>{n.editor instanceof sd&&t.set(!0)})),this._register(e.onDidCloseEditor(n=>{n.editor instanceof sd&&o()}))}};Oqe=I([m(0,X),m(1,ee)],Oqe);It(Oqe.ID,Oqe,St.AfterRestored);var Fqe=class extends x{constructor(e,t,o,n){super();this.configurationService=t;this.editorService=o;this.telemetryService=n;this._register(e.registerExternalOpener(this))}static{this.ID="workbench.contrib.localhostLinkOpener"}async openExternal(e,t,o){if(!this.configurationService.getValue("workbench.browser.openLocalhostLinks"))return!1;try{let r=new URL(e);if(r.protocol!=="http:"&&r.protocol!=="https:"||!dYe(r.host))return!1}catch{return!1}nH(this.telemetryService,"localhostLinkOpener");let n=Ey.forId(xt());return await this.editorService.openEditor({resource:n,options:{pinned:!0,viewState:{url:e}}}),!0}};Fqe=I([m(0,Je),m(1,B),m(2,ee),m(3,Te)],Fqe);It(Fqe.ID,Fqe,St.BlockStartup);ne.as(Jt.Configuration).registerConfiguration({...Ud,properties:{"workbench.browser.showInTitleBar":{type:["boolean","string"],enum:[!0,!1,"whenOpen"],enumDescriptions:[d(5466,null),d(5465,null),d(5467,null)],default:"whenOpen",experiment:{mode:"startup"},description:d(5464,null)},"workbench.browser.openLocalhostLinks":{type:"boolean",default:!1,experiment:{mode:"startup"},markdownDescription:d(5460,null)}}});ne.as(qo.EditorPane).registerEditorPane(Br.create(mu,sd.EDITOR_ID,d(5410,null)),[new Ft(sd)]);ne.as(qo.EditorFactory).registerEditorSerializer(sd.ID,yOt);var Wqe=class{static{this.ID="workbench.contrib.browserEditorResolver"}constructor(i,e){i.registerEditor(`${Q.vscodeBrowser}:/**`,{id:sd.EDITOR_ID,label:d(5410,null),priority:"exclusive"},{canSupportResource:t=>t.scheme===Q.vscodeBrowser,singlePerResource:!0},{createEditorInput:({resource:t,options:o})=>{let n=Ey.parse(t);if(!n)throw new Error(`Invalid browser view resource: ${t.toString()}`);let r=e.createInstance(sd,{...o?.viewState,id:n.id});return r.resolve(),{editor:r,options:{...o,pinned:!!r.url}}}})}};Wqe=I([m(0,Ka),m(1,F)],Wqe);It(Wqe.ID,Wqe,St.BlockStartup);Ee(v3,wqe,1);Ee(IOt,Cqe,1);var jYt=le("ISplashStorageService");var b9=class{constructor(i,e,t,o,n,r,s){this._themeService=i;this._layoutService=e;this._environmentService=t;this._configService=o;this._partSplashService=n;this._disposables=new N;U.once(e.onDidLayoutMainContainer)(()=>{this._removePartsSplash(),Mo("code/didRemovePartsSplash")},void 0,this._disposables);let l=this._disposables.add(new me),c=()=>{l.value=rf(ut,()=>this._savePartsSplash(),2500)};s.when(3).then(()=>{U.any(U.filter(YN,u=>u===ut.vscodeWindowId),r.mainPart.onDidLayout,i.onDidColorThemeChange)(c,void 0,this._disposables),c()}),o.onDidChangeConfiguration(u=>{u.affectsConfiguration("window.titleBarStyle")&&(this._didChangeTitleBarStyle=!0,this._savePartsSplash())},this,this._disposables)}static{this.ID="workbench.contrib.partsSplash"}static{this._splashElementId="monaco-parts-splash"}dispose(){this._disposables.dispose()}_savePartsSplash(){let i=this._themeService.getColorTheme();this._partSplashService.saveWindowSplash({zoomLevel:this._configService.getValue("window.zoomLevel"),baseTheme:Cj(i.type),colorInfo:{foreground:i.getColor(To)?.toString(),background:We.Format.CSS.formatHex(i.getColor(Ho)||CF(i)),editorBackground:i.getColor(Ho)?.toString(),titleBarBackground:i.getColor(NX)?.toString(),titleBarBorder:i.getColor(mDt)?.toString(),activityBarBackground:i.getColor(iDt)?.toString(),activityBarBorder:i.getColor(oDt)?.toString(),sideBarBackground:i.getColor(bf)?.toString(),sideBarBorder:i.getColor(wK)?.toString(),statusBarBackground:i.getColor(eDt)?.toString(),statusBarBorder:i.getColor(Vde)?.toString(),statusBarNoFolderBackground:i.getColor(tDt)?.toString(),windowBorder:i.getColor(CEe)?.toString()??i.getColor(xEe)?.toString()},layoutInfo:this._shouldSaveLayoutInfo()?{sideBarSide:this._layoutService.getSideBarPosition()===1?"right":"left",editorPartMinWidth:hT.width,titleBarHeight:this._layoutService.isVisible("workbench.parts.titlebar",ut)?mh(Ci(this._layoutService.getContainer(ut,"workbench.parts.titlebar"))):0,activityBarWidth:this._layoutService.isVisible("workbench.parts.activitybar")?zl(Ci(this._layoutService.getContainer(ut,"workbench.parts.activitybar"))):0,sideBarWidth:this._layoutService.isVisible("workbench.parts.sidebar")?zl(Ci(this._layoutService.getContainer(ut,"workbench.parts.sidebar"))):0,auxiliaryBarWidth:this._layoutService.isAuxiliaryBarMaximized()?Number.MAX_SAFE_INTEGER:this._layoutService.isVisible("workbench.parts.auxiliarybar")?zl(Ci(this._layoutService.getContainer(ut,"workbench.parts.auxiliarybar"))):0,statusBarHeight:this._layoutService.isVisible("workbench.parts.statusbar",ut)?mh(Ci(this._layoutService.getContainer(ut,"workbench.parts.statusbar"))):0,windowBorder:this._layoutService.hasMainWindowBorder(),windowBorderRadius:this._layoutService.getMainWindowBorderRadius()}:void 0})}_shouldSaveLayoutInfo(){return!hC(ut)&&!this._environmentService.isExtensionDevelopment&&!this._didChangeTitleBarStyle}_removePartsSplash(){let i=ut.document.getElementById(b9._splashElementId);i&&(i.style.display="none"),ut.document.head.getElementsByClassName("initialShellColors")[0]?.remove()}};b9=I([m(0,Le),m(1,yi),m(2,At),m(3,B),m(4,jYt),m(5,wt),m(6,ji)],b9);var Hmt=class{constructor(i){this.saveWindowSplash=i.saveWindowSplash.bind(i)}};Hmt=I([m(0,ko)],Hmt);Ee(jYt,Hmt,1);It(b9.ID,b9,St.BlockStartup);W(class extends K{constructor(){super({id:"workbench.action.localHistory.revealInOS",title:ei?L(11519,"Reveal in File Explorer"):Ze?L(11518,"Reveal in Finder"):L(11517,"Open Containing Folder"),menu:{id:D.TimelineItemContext,group:"4_reveal",order:1,when:C.and(QU,Wo.Scheme.isEqualTo(Q.file))}})}async run(a,i){let e=a.get(Hy),t=a.get(ko),{entry:o}=await YU(e,i);o&&await t.showItemInFolder(o.location.with({scheme:Q.file}).fsPath)}});var wNo=L(12268,"Merge Editor (Dev)"),Umt=class extends K{constructor(){super({id:"merge.dev.openContentsJson",category:wNo,title:L(12267,"Open Merge Editor State from JSON"),icon:R.layoutCentered,f1:!0})}async run(i,e){let t=i.get(Ue),o=i.get(Fi),n=i.get(ee),r=i.get(_t),s=i.get(oy),l=i.get(fe);e||(e={});let c;if(e.data)c=e.data;else{let k=await t.input({prompt:d(12269,null),value:await o.readText()});if(k===void 0)return;c=k!==""?JSON.parse(k):{base:"",input1:"",input2:"",result:"",languageId:"plaintext"}}let u=A.joinPath(s.tmpDir,gIe()),p=r.getExtensions(c.languageId)[0]||"",h=A.joinPath(u,`/base${p}`),g=A.joinPath(u,`/input1${p}`),f=A.joinPath(u,`/input2${p}`),v=A.joinPath(u,`/result${p}`),b=A.joinPath(u,`/initialResult${p}`);async function S(k,T){await l.writeFile(k,qe.fromString(T))}let y=await gwn(t,e.resultState);await Promise.all([S(h,c.base),S(g,c.input1),S(f,c.input2),S(v,y?c.initialResult||"":c.result),S(b,c.initialResult||"")]);let w={base:{resource:h},input1:{resource:g,label:"Input 1",description:"Input 1",detail:"(from JSON)"},input2:{resource:f,label:"Input 2",description:"Input 2",detail:"(from JSON)"},result:{resource:v}};n.openEditor(w)}};async function gwn(a,i){return i?i==="initial":(await a.pick([{label:"result",result:!1},{label:"initial result",result:!0}],{canPickMany:!1}))?.result}var zKi=class extends K{constructor(i){super(i)}run(i){let{activeEditorPane:e}=i.get(ee);if(e instanceof Yv){let t=e.viewModel.get();if(!t)return;this.runWithViewModel(t,i)}}},QYt=class extends zKi{constructor(){super({id:"merge.dev.openSelectionInTemporaryMergeEditor",category:wNo,title:L(12266,"Open Selection In Temporary Merge Editor"),icon:R.layoutCentered,f1:!0})}async runWithViewModel(i,e){let t=i.selectionInBase.get()?.rangesInBase;if(!t||t.length===0)return;let o=t.map(l=>i.model.base.getValueInRange(l)).join(`
`),n=t.map(l=>i.inputCodeEditorView1.editor.getModel().getValueInRange(i.model.translateBaseRangeToInput(1,l))).join(`
`),r=t.map(l=>i.inputCodeEditorView2.editor.getModel().getValueInRange(i.model.translateBaseRangeToInput(2,l))).join(`
`),s=t.map(l=>i.resultCodeEditorView.editor.getModel().getValueInRange(i.model.translateBaseRangeToResult(l))).join(`
`);new Umt().run(e,{data:{base:o,input1:n,input2:r,result:s,languageId:i.resultCodeEditorView.editor.getModel().getLanguageId()}})}};W(Umt);W(QYt);var _se=L(13562,"Remote Tunnels"),e1="remoteTunnelConnection",fwn=new Y(e1,"disconnected"),KKi="remoteTunnelServiceUsed",CNo="remoteTunnelServicePromptedPreview",xNo="remoteTunnelExtensionRecommended",kNo="remoteTunnelHasUsed",vwn=240*1e3,bwn=2;var m$;(r=>(r.turnOn=d(13561,null),r.turnOff=d(13560,null),r.showLog=d(13559,null),r.configure=d(13554,null),r.copyToClipboard=d(13555,null),r.learnMore=d(13556,null)))(m$||={});var zmt=class extends x{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super();this.authenticationService=e;this.dialogService=t;this.extensionService=o;this.contextKeyService=n;this.storageService=s;this.quickInputService=c;this.environmentService=u;this.remoteTunnelService=p;this.commandService=h;this.workspaceContextService=g;this.progressService=f;this.notificationService=v;this.expiredSessions=new Set;this.logger=this._register(l.createLogger(Ge(u.logsHome,`${X7t}.log`),{id:X7t,name:bAo})),this.connectionStateContext=fwn.bindTo(this.contextKeyService);let b=r.tunnelApplicationConfig;if(!b||!r.tunnelApplicationName){this.logger.error("Missing 'tunnelApplicationConfig' or 'tunnelApplicationName' in product.json. Remote tunneling is not available."),this.serverConfiguration={authenticationProviders:{},editorWebUrl:"",extension:{extensionId:"",friendlyName:""}};return}this.serverConfiguration=b,this._register(this.remoteTunnelService.onDidChangeTunnelStatus(S=>this.handleTunnelStatusUpdate(S))),this.registerCommands(),this.initialize(),this.recommendRemoteExtensionIfNeeded()}handleTunnelStatusUpdate(e){this.connectionInfo=void 0,e.type==="disconnected"?(e.onTokenFailed&&this.expiredSessions.add(e.onTokenFailed.sessionId),this.connectionStateContext.set("disconnected")):e.type==="connecting"?this.connectionStateContext.set("connecting"):e.type==="connected"&&(this.connectionInfo=e.info,this.connectionStateContext.set("connected"))}async recommendRemoteExtensionIfNeeded(){await this.extensionService.whenInstalledExtensionsRegistered();let e=this.serverConfiguration.extension,t=async()=>{if(this.storageService.getBoolean(xNo,-1)||await this.extensionService.getExtension(e.extensionId))return!1;let n=this.storageService.get(KKi,-1);if(!n)return!1;let r;try{let l=JSON.parse(n);if(!xi(l))return!1;let{hostName:c,timeStamp:u}=l;if(!Fe(c)||!Yo(u)||new Date().getTime()>u+vwn)return!1;r=c}catch{return!1}let s=await this.remoteTunnelService.getTunnelName();return!s||s===r?!1:r},o=async()=>{let n=await t();return n?(this.notificationService.notify({severity:ft.Info,priority:1,message:d(13553,null,n,e.friendlyName),actions:{primary:[ii({id:"showExtension",label:d(13541,null),run:()=>this.commandService.executeCommand("workbench.extensions.action.showExtensionsWithIds",[e.extensionId])}),ii({id:"doNotShowAgain",label:d(13540,null),run:()=>{this.storageService.store(xNo,!0,-1,0)}})]}}),!0):!1};if(await t()){let n=this._register(new N);n.add(this.storageService.onDidChangeValue(-1,KKi,n)(async()=>{await o()&&n.dispose()}))}}async initialize(){let[e,t]=await Promise.all([this.remoteTunnelService.getMode(),this.remoteTunnelService.getTunnelStatus()]);if(this.handleTunnelStatusUpdate(t),e.active&&e.session.token)return;let o=async r=>{let s=r&&this.remoteTunnelService.onDidChangeTunnelStatus(u=>{u.type==="connecting"&&u.progress&&r.report({message:u.progress})}),l;if(e.active){let u=await this.getSessionToken(e.session);u&&(l={...e.session,token:u})}let c=await this.remoteTunnelService.initialize(e.active&&l?{...e,session:l}:gAo);if(s?.dispose(),c.type==="connected"){this.connectionInfo=c.info,this.connectionStateContext.set("connected");return}};this.storageService.getBoolean(kNo,-1,!1)?await this.progressService.withProgress({location:10,title:d(13543,null,"workbench.remoteTunnel.actions.showLog")},o):o(void 0)}getPreferredTokenFromSession(e){return e.session.accessToken||e.session.idToken}async startTunnel(e){if(this.connectionInfo)return this.connectionInfo;this.storageService.store(kNo,!0,-1,1);let t=!1;for(let o=0;o<bwn;o++){t=!1;let n=await this.getAuthenticationSession();if(n===void 0){this.logger.info("No authentication session available, not starting tunnel");return}let r=await this.progressService.withProgress({location:15,title:d(13571,null,"workbench.remoteTunnel.actions.showLog")},s=>new Promise((l,c)=>{let u=!1,p=this.remoteTunnelService.onDidChangeTunnelStatus(f=>{switch(f.type){case"connecting":f.progress&&s.report({message:f.progress});break;case"connected":p.dispose(),u=!0,l(f.info),f.serviceInstallFailed&&this.notificationService.notify({severity:ft.Warning,message:d(13563,null,"workbench.remoteTunnel.actions.showLog")});break;case"disconnected":p.dispose(),u=!0,t=!!f.onTokenFailed,l(void 0);break}}),h=this.getPreferredTokenFromSession(n),g={sessionId:n.session.id,token:h,providerId:n.providerId,accountLabel:n.session.account.label};this.remoteTunnelService.startTunnel({active:!0,asService:e,session:g}).then(f=>{!u&&(f.type==="connected"||f.type==="disconnected")&&(p.dispose(),f.type==="connected"?l(f.info):(t=!!f.onTokenFailed,l(void 0)))})}));if(r||!t)return r}}async getAuthenticationSession(){let e=await this.getAllSessions(),t=new N,o=t.add(this.quickInputService.createQuickPick({useSeparators:!0}));return o.ok=!1,o.placeholder=d(13538,null),o.ignoreFocusOut=!0,o.items=await this.createQuickpickItems(e),new Promise((n,r)=>{t.add(o.onDidHide(s=>{n(void 0),t.dispose()})),t.add(o.onDidAccept(async s=>{let l=o.selectedItems[0];if("provider"in l){let c=await this.authenticationService.createSession(l.provider.id,l.provider.scopes);n(this.createExistingSessionItem(c,l.provider.id))}else"session"in l?n(l):n(void 0);o.hide()})),o.show()})}createExistingSessionItem(e,t){return{label:e.account.label,description:this.authenticationService.getProvider(t).label,session:e,providerId:t}}async createQuickpickItems(e){let t=[];e.length&&(t.push({type:"separator",label:d(13570,null)}),t.push(...e),t.push({type:"separator",label:d(13550,null)}));for(let o of await this.getAuthenticationProviders()){let n=e.some(s=>s.providerId===o.id),r=this.authenticationService.getProvider(o.id);(!n||r.supportsMultipleAccounts)&&t.push({label:d(13569,null,r.label),provider:o})}return t}async getAllSessions(){let e=await this.getAuthenticationProviders(),t=new Map,o=await this.remoteTunnelService.getMode(),n;for(let r of e){let s=await this.authenticationService.getSessions(r.id,r.scopes);for(let l of s)if(!this.expiredSessions.has(l.id)){let c=this.createExistingSessionItem(l,r.id);t.set(c.session.account.id,c),o.active&&o.session.sessionId===l.id&&(n=c)}}return n!==void 0&&t.set(n.session.account.id,n),[...t.values()]}async getSessionToken(e){if(e){let t=(await this.getAllSessions()).find(o=>o.session.id===e.sessionId);if(t)return this.getPreferredTokenFromSession(t)}}async getAuthenticationProviders(){let e=this.serverConfiguration.authenticationProviders,t=Object.keys(e).reduce((n,r)=>(n.push({id:r,scopes:e[r].scopes}),n),[]),o=this.authenticationService.declaredProviders;return t.filter(({id:n})=>o.some(r=>r.id===n))}registerCommands(){let e=this;this._register(W(class extends K{constructor(){super({id:"workbench.remoteTunnel.actions.turnOn",title:m$.turnOn,category:_se,precondition:C.equals(e1,"disconnected"),menu:[{id:D.CommandPalette},{id:D.AccountsContext,group:"2_remoteTunnel",when:C.equals(e1,"disconnected")}]})}async run(t){let o=t.get(Ne),n=t.get(Fi),r=t.get(ge),s=t.get(ce),l=t.get(at),c=t.get(Ue),u=t.get(tt);if(!s.getBoolean(CNo,-1,!1)){let{confirmed:b}=await l.confirm({message:d(13577,null),primaryButton:d(13542,null)});if(!b)return;s.store(CNo,!0,-1,0)}let h=new N,g=c.createQuickPick();g.placeholder=d(13572,null),g.items=[{service:!1,label:d(13575,null),description:d(13576,null,u.nameShort)},{service:!0,label:d(13573,null),description:d(13574,null)}];let f=await new Promise(b=>{h.add(g.onDidAccept(()=>b(g.selectedItems[0]?.service))),h.add(g.onDidHide(()=>b(void 0))),g.show()});if(g.dispose(),f===void 0)return;let v=await e.startTunnel(f);if(v){let b=e.getLinkToOpen(v),S=e.serverConfiguration.extension,y=b.toString(!1).replace(/\)/g,"%29");o.notify({severity:ft.Info,message:d(13552,null,v.tunnelName,v.domain,y,"workbench.remoteTunnel.actions.manage","workbench.remoteTunnel.actions.configure","workbench.remoteTunnel.actions.turnOff",S.friendlyName,"https://code.visualstudio.com/docs/remote/tunnels"),actions:{primary:[ii({id:"copyToClipboard",label:d(13539,null),run:()=>n.writeText(b.toString(!0))}),ii({id:"showExtension",label:d(13541,null),run:()=>r.executeCommand("workbench.extensions.action.showExtensionsWithIds",[S.extensionId])})]}});let w={hostName:v.tunnelName,timeStamp:new Date().getTime()};s.store(KKi,JSON.stringify(w),-1,0)}else o.notify({severity:ft.Info,message:d(13551,null)}),await r.executeCommand("workbench.remoteTunnel.actions.showLog")}})),this._register(W(class extends K{constructor(){super({id:"workbench.remoteTunnel.actions.manage",title:d(13558,null),category:_se,menu:[{id:D.AccountsContext,group:"2_remoteTunnel",when:C.equals(e1,"connected")}]})}async run(){e.showManageOptions()}})),this._register(W(class extends K{constructor(){super({id:"workbench.remoteTunnel.actions.connecting",title:d(13557,null),category:_se,menu:[{id:D.AccountsContext,group:"2_remoteTunnel",when:C.equals(e1,"connecting")}]})}async run(){e.showManageOptions()}})),this._register(W(class extends K{constructor(){super({id:"workbench.remoteTunnel.actions.turnOff",title:m$.turnOff,category:_se,precondition:C.notEquals(e1,"disconnected"),menu:[{id:D.CommandPalette,when:C.notEquals(e1,"")}]})}async run(){let t=e.connectionInfo?.isAttached?d(13565,null):d(13564,null),{confirmed:o}=await e.dialogService.confirm({message:t});o&&e.remoteTunnelService.stopTunnel()}})),this._register(W(class extends K{constructor(){super({id:"workbench.remoteTunnel.actions.showLog",title:m$.showLog,category:_se,menu:[{id:D.CommandPalette,when:C.notEquals(e1,"")}]})}async run(t){t.get(kl).showChannel(X7t)}})),this._register(W(class extends K{constructor(){super({id:"workbench.remoteTunnel.actions.configure",title:m$.configure,category:_se,menu:[{id:D.CommandPalette,when:C.notEquals(e1,"")}]})}async run(t){t.get(Go).openSettings({query:Y7t})}})),this._register(W(class extends K{constructor(){super({id:"workbench.remoteTunnel.actions.copyToClipboard",title:m$.copyToClipboard,category:_se,precondition:C.equals(e1,"connected"),menu:[{id:D.CommandPalette,when:C.equals(e1,"connected")}]})}async run(t){let o=t.get(Fi);if(e.connectionInfo){let n=e.getLinkToOpen(e.connectionInfo);o.writeText(n.toString(!0))}}})),this._register(W(class extends K{constructor(){super({id:"workbench.remoteTunnel.actions.learnMore",title:m$.learnMore,category:_se,menu:[]})}async run(t){await t.get(Je).open("https://aka.ms/vscode-server-doc")}}))}getLinkToOpen(e){let t=this.workspaceContextService.getWorkspace(),o=t.folders,n;o.length===1?n=o[0].uri:t.configuration&&!dR(t.configuration,this.environmentService)&&(n=t.configuration);let r=A.parse(e.link);return n?.scheme===Q.file?Ge(r,n.path):Ge(r,this.environmentService.userHome.path)}async showManageOptions(){let e=await this.remoteTunnelService.getMode();return new Promise((t,o)=>{let n=new N,r=this.quickInputService.createQuickPick({useSeparators:!0});r.placeholder=d(13544,null),n.add(r);let s=[];s.push({id:"workbench.remoteTunnel.actions.learnMore",label:m$.learnMore}),this.connectionInfo?(r.title=this.connectionInfo.isAttached?d(13546,null,this.connectionInfo.tunnelName):d(13548,null,this.connectionInfo.tunnelName),s.push({id:"workbench.remoteTunnel.actions.copyToClipboard",label:m$.copyToClipboard,description:this.connectionInfo.domain})):r.title=d(13547,null),s.push({id:"workbench.remoteTunnel.actions.showLog",label:d(13545,null)}),s.push({type:"separator"}),s.push({id:"workbench.remoteTunnel.actions.configure",label:d(13549,null),description:this.connectionInfo?.tunnelName}),s.push({id:"workbench.remoteTunnel.actions.turnOff",label:m$.turnOff,description:e.active?`${e.session.accountLabel} (${e.session.providerId})`:void 0}),r.items=s,n.add(r.onDidAccept(()=>{r.selectedItems[0]&&r.selectedItems[0].id&&this.commandService.executeCommand(r.selectedItems[0].id),r.hide()})),n.add(r.onDidHide(()=>{n.dispose(),t()})),r.show()})}};zmt=I([m(0,xs),m(1,at),m(2,lt),m(3,X),m(4,tt),m(5,ce),m(6,Il),m(7,Ue),m(8,oy),m(9,Q7t),m(10,ge),m(11,Pe),m(12,Fo),m(13,Ne)],zmt);var Swn=ne.as(Qi.Workbench);Swn.registerWorkbenchContribution(zmt,3);ne.as(Jt.Configuration).registerConfiguration({type:"object",properties:{[fAo]:{description:d(13566,null),type:"string",scope:1,ignoreSync:!0,pattern:"^(\\w[\\w-]*)?$",patternErrorMessage:d(13567,null),maxLength:20,default:""},[vAo]:{description:d(13568,null),type:"boolean",scope:1,default:!1}}});var YYt="vscode-agent-host";function Kmt(a,i){if(i==="local"&&a.scheme===Q.file)return a;let e=a.authority||"";return A.from({scheme:YYt,authority:i,path:`/${a.scheme}/${e||"-"}${a.path}`})}function XYt(a){let i=a.path,e=i.indexOf("/",1);if(e===-1)return A.from({scheme:"file",path:i});let t=i.substring(1,e),o=i.indexOf("/",e+1);if(o===-1){let s=i.substring(e+1);return A.from({scheme:t,authority:s,path:"/"})}let n=i.substring(e+1,o);n==="-"&&(n="");let r=i.substring(o);return A.from({scheme:t,authority:n||void 0,path:r})}var ENo={scheme:YYt,formatting:{label:"${path}",separator:"/",stripPathSegments:2}};var JYt=class extends x{constructor(){super(...arguments);this.capabilities=3074;this._onDidChangeCapabilities=this._register(new E);this.onDidChangeCapabilities=this._onDidChangeCapabilities.event;this._onDidChangeFile=this._register(new E);this.onDidChangeFile=this._onDidChangeFile.event;this._authorityToConnection=new Map}registerAuthority(e,t){return this._authorityToConnection.set(e,t),Z(()=>this._authorityToConnection.delete(e))}watch(){return x.None}async stat(e){let t=e.path;if(t==="/"||t==="")return{type:2,mtime:0,ctime:0,size:0,permissions:1};let o=XYt(e);if(o.scheme==="session-db")return{type:1,mtime:0,ctime:0,size:0,permissions:1};if(o.path==="/"||o.path==="")return{type:2,mtime:0,ctime:0,size:0,permissions:1};let n=ci(e),r=He(e),l=(await this._listDirectory(e.authority,n)).find(c=>c.name===r);if(!l)throw Ps(`File not found: ${t}`,"EntryNotFound");return{type:l.type==="directory"?2:1,mtime:0,ctime:0,size:0,permissions:1}}async readdir(e){return(await this._listDirectory(e.authority,e)).map(o=>[o.name,o.type==="directory"?2:1])}async readFile(e){let t=this._getConnection(e.authority);try{let o=XYt(e),n=await t.fetchContent(o);return qe.fromString(n.data).buffer}catch(o){throw Ps(o instanceof Error?o.message:String(o),"EntryNotFound")}}async writeFile(e,t,o){throw Ps("writeFile not supported on remote agent host filesystem","NoPermissions")}async mkdir(){throw Ps("mkdir not supported on remote agent host filesystem","NoPermissions")}async delete(e,t){throw Ps("delete not supported on remote agent host filesystem","NoPermissions")}async rename(e,t,o){throw Ps("rename not supported on remote agent host filesystem","NoPermissions")}_getConnection(e){let t=this._authorityToConnection.get(e);if(!t)throw Ps(`No connection for authority: ${e}`,"Unavailable");return t}async _listDirectory(e,t){let o=this._getConnection(e);try{let n=XYt(t);return(await o.browseDirectory(n)).entries}catch(n){throw Ps(n instanceof Error?n.message:String(n),"Unavailable")}}};function qKi(a){return a.type.startsWith("root/")}function sV(a){return a.type.startsWith("session/")}var Iwn={"root/agentsChanged":!1,"root/activeSessionsChanged":!1,"session/ready":!1,"session/creationFailed":!1,"session/turnStarted":!0,"session/delta":!1,"session/responsePart":!1,"session/toolCallStart":!1,"session/toolCallDelta":!1,"session/toolCallReady":!1,"session/toolCallConfirmed":!0,"session/toolCallComplete":!0,"session/toolCallResultConfirmed":!0,"session/turnComplete":!1,"session/turnCancelled":!0,"session/error":!1,"session/titleChanged":!1,"session/usage":!1,"session/reasoning":!1,"session/modelChanged":!0,"session/serverToolsChanged":!1,"session/activeClientChanged":!0,"session/activeClientToolsChanged":!0,"session/pendingMessageSet":!0,"session/pendingMessageRemoved":!0,"session/queuedMessagesReordered":!0,"session/customizationsChanged":!1,"session/customizationToggled":!0};function YKi(a,i){let e=`Unhandled action type: ${JSON.stringify(a)}`;(i??console.warn)(e)}function qmt(a){return{toolCallId:a.toolCallId,toolName:a.toolName,displayName:a.displayName,toolClientId:a.toolClientId,_meta:a._meta}}function $Ki(a,i,e,t,o){if(!a.activeTurn||a.activeTurn.id!==i)return a;let n=a.activeTurn,r=n.responseParts.map(l=>{if(l.kind!=="toolCall")return l;let c=l.toolCall;return c.status==="completed"||c.status==="cancelled"?l:{kind:"toolCall",toolCall:{status:"cancelled",...qmt(c),invocationMessage:c.status==="streaming"?c.invocationMessage??"":c.invocationMessage,toolInput:c.status==="streaming"?void 0:c.toolInput,reason:"skipped"}}}),s={id:n.id,userMessage:n.userMessage,responseParts:r,usage:n.usage,state:e,error:o};return{...a,turns:[...a.turns,s],activeTurn:void 0,summary:{...a.summary,status:t,modifiedAt:Date.now()}}}function Gmt(a,i,e,t){let o=a.activeTurn;if(!o||o.id!==i)return a;let n=!1,r=o.responseParts.map(s=>{if(s.kind==="toolCall"&&s.toolCall.toolCallId===e){let l=t(s.toolCall);return l===s.toolCall?s:(n=!0,{...s,toolCall:l})}return s});return n?{...a,activeTurn:{...o,responseParts:r}}:a}function TNo(a,i,e,t){let o=a.activeTurn;if(!o||o.id!==i)return a;let n=!1,r=o.responseParts.map(s=>!n&&(s.kind==="toolCall"?s.toolCall.toolCallId:"id"in s?s.id:void 0)===e?(n=!0,t(s)):s);return n?{...a,activeTurn:{...o,responseParts:r}}:a}function XKi(a,i,e){switch(i.type){case"root/agentsChanged":return{...a,agents:i.agents};case"root/activeSessionsChanged":return{...a,activeSessions:i.activeSessions};default:return YKi(i,e),a}}function $mt(a,i,e){switch(i.type){case"session/ready":return{...a,lifecycle:"ready",summary:{...a.summary,status:"idle"}};case"session/creationFailed":return{...a,lifecycle:"creationFailed",creationError:i.error};case"session/turnStarted":{let t={...a,summary:{...a.summary,status:"in-progress",modifiedAt:Date.now()},activeTurn:{id:i.turnId,userMessage:i.userMessage,responseParts:[],usage:void 0}};if(i.queuedMessageId&&(t.steeringMessage?.id===i.queuedMessageId&&(t={...t,steeringMessage:void 0}),t.queuedMessages)){let o=t.queuedMessages.filter(n=>n.id!==i.queuedMessageId);t={...t,queuedMessages:o.length>0?o:void 0}}return t}case"session/delta":return TNo(a,i.turnId,i.partId,t=>t.kind==="markdown"?{...t,content:t.content+i.content}:t);case"session/responsePart":return!a.activeTurn||a.activeTurn.id!==i.turnId?a:{...a,activeTurn:{...a.activeTurn,responseParts:[...a.activeTurn.responseParts,i.part]}};case"session/turnComplete":return $Ki(a,i.turnId,"complete","idle");case"session/turnCancelled":return $Ki(a,i.turnId,"cancelled","idle");case"session/error":return $Ki(a,i.turnId,"error","error",i.error);case"session/toolCallStart":return!a.activeTurn||a.activeTurn.id!==i.turnId?a:{...a,activeTurn:{...a.activeTurn,responseParts:[...a.activeTurn.responseParts,{kind:"toolCall",toolCall:{toolCallId:i.toolCallId,toolName:i.toolName,displayName:i.displayName,toolClientId:i.toolClientId,_meta:i._meta,status:"streaming"}}]}};case"session/toolCallDelta":return Gmt(a,i.turnId,i.toolCallId,t=>t.status!=="streaming"?t:{...t,partialInput:(t.partialInput??"")+i.content,invocationMessage:i.invocationMessage??t.invocationMessage});case"session/toolCallReady":return Gmt(a,i.turnId,i.toolCallId,t=>{if(t.status!=="streaming"&&t.status!=="running")return t;let o=qmt(t);return i.confirmed?{status:"running",...o,invocationMessage:i.invocationMessage,toolInput:i.toolInput,confirmed:i.confirmed}:{status:"pending-confirmation",...o,invocationMessage:i.invocationMessage,toolInput:i.toolInput,confirmationTitle:i.confirmationTitle}});case"session/toolCallConfirmed":return Gmt(a,i.turnId,i.toolCallId,t=>{if(t.status!=="pending-confirmation")return t;let o=qmt(t);return i.approved?{status:"running",...o,invocationMessage:t.invocationMessage,toolInput:t.toolInput,confirmed:i.confirmed}:{status:"cancelled",...o,invocationMessage:t.invocationMessage,toolInput:t.toolInput,reason:i.reason,reasonMessage:i.reasonMessage,userSuggestion:i.userSuggestion}});case"session/toolCallComplete":return Gmt(a,i.turnId,i.toolCallId,t=>{if(t.status!=="running"&&t.status!=="pending-confirmation")return t;let o=qmt(t),n=t.status==="running"?t.confirmed:"not-needed";return i.requiresResultConfirmation?{status:"pending-result-confirmation",...o,invocationMessage:t.invocationMessage,toolInput:t.toolInput,confirmed:n,...i.result}:{status:"completed",...o,invocationMessage:t.invocationMessage,toolInput:t.toolInput,confirmed:n,...i.result}});case"session/toolCallResultConfirmed":return Gmt(a,i.turnId,i.toolCallId,t=>{if(t.status!=="pending-result-confirmation")return t;let o=qmt(t);return i.approved?{status:"completed",...o,invocationMessage:t.invocationMessage,toolInput:t.toolInput,confirmed:t.confirmed,success:t.success,pastTenseMessage:t.pastTenseMessage,content:t.content,structuredContent:t.structuredContent,error:t.error}:{status:"cancelled",...o,invocationMessage:t.invocationMessage,toolInput:t.toolInput,reason:"result-denied"}});case"session/titleChanged":return{...a,summary:{...a.summary,title:i.title,modifiedAt:Date.now()}};case"session/usage":return!a.activeTurn||a.activeTurn.id!==i.turnId?a:{...a,activeTurn:{...a.activeTurn,usage:i.usage}};case"session/reasoning":return TNo(a,i.turnId,i.partId,t=>t.kind==="reasoning"?{...t,content:t.content+i.content}:t);case"session/modelChanged":return{...a,summary:{...a.summary,model:i.model,modifiedAt:Date.now()}};case"session/serverToolsChanged":return{...a,serverTools:i.tools};case"session/activeClientChanged":return{...a,activeClient:i.activeClient??void 0};case"session/activeClientToolsChanged":return a.activeClient?{...a,activeClient:{...a.activeClient,tools:i.tools}}:a;case"session/customizationsChanged":return{...a,customizations:i.customizations};case"session/customizationToggled":{let t=a.customizations;if(!t)return a;let o=t.findIndex(r=>r.customization.uri===i.uri);if(o<0)return a;let n=[...t];return n[o]={...t[o],enabled:i.enabled},{...a,customizations:n}}case"session/pendingMessageSet":{let t={id:i.id,userMessage:i.userMessage};if(i.kind==="steering")return{...a,steeringMessage:t};let o=a.queuedMessages??[],n=o.findIndex(r=>r.id===i.id);if(n>=0){let r=[...o];return r[n]=t,{...a,queuedMessages:r}}return{...a,queuedMessages:[...o,t]}}case"session/pendingMessageRemoved":{if(i.kind==="steering")return!a.steeringMessage||a.steeringMessage.id!==i.id?a:{...a,steeringMessage:void 0};let t=a.queuedMessages;if(!t)return a;let o=t.filter(n=>n.id!==i.id);return o.length===t.length?a:{...a,queuedMessages:o.length>0?o:void 0}}case"session/queuedMessagesReordered":{let t=a.queuedMessages;if(!t)return a;let o=new Map(t.map(s=>[s.id,s])),n=new Set,r=i.order.filter(s=>o.has(s)&&!n.has(s)?(n.add(s),!0):!1).map(s=>o.get(s));for(let s of t)n.has(s.id)||r.push(s);return{...a,queuedMessages:r}}default:return YKi(i,e),a}}function S9(a){return a._meta?.toolKind}function I9(a){return a._meta?.language}var Vqe="agenthost:/root";function JKi(a){if(!a.content||a.content.length===0)return;let i=[];for(let e of a.content)No(e,{type:!0})&&e.type==="text"&&i.push(e);if(i.length!==0)return i.map(e=>e.text).join(`
`)}function kSe(a){if(!a.content||a.content.length===0)return[];let i=[];for(let e of a.content)No(e,{type:!0})&&e.type==="fileEdit"&&i.push(e);return i}var Bqe=class extends x{constructor(e,t){super();this._nextClientSeq=1;this._lastSeenServerSeq=0;this._confirmedSessionStates=new Map;this._pendingActions=[];this._optimisticSessionStates=new Map;this._onDidChangeRootState=this._register(new E);this.onDidChangeRootState=this._onDidChangeRootState.event;this._onDidChangeSessionState=this._register(new E);this.onDidChangeSessionState=this._onDidChangeSessionState.event;this._onDidReceiveNotification=this._register(new E);this.onDidReceiveNotification=this._onDidReceiveNotification.event;this._clientId=e,this._log=o=>t.warn(`[SessionClientState] ${o}`)}get clientId(){return this._clientId}get lastSeenServerSeq(){return this._lastSeenServerSeq}get rootState(){return this._optimisticRootState}getSessionState(e){return this._optimisticSessionStates.get(e)}get subscribedSessions(){return[...this._confirmedSessionStates.keys()].map(e=>A.parse(e))}handleSnapshot(e,t,o){if(this._lastSeenServerSeq=Math.max(this._lastSeenServerSeq,o),e===Vqe){let n=t;this._confirmedRootState=n,this._optimisticRootState=n,this._onDidChangeRootState.fire(n)}else{let n=t;this._confirmedSessionStates.set(e,n),this._optimisticSessionStates.set(e,n),this._recomputeOptimisticSession(e),this._onDidChangeSessionState.fire({session:e,state:this._optimisticSessionStates.get(e)})}}unsubscribe(e){if(e===Vqe)this._confirmedRootState=void 0,this._optimisticRootState=void 0;else{this._confirmedSessionStates.delete(e),this._optimisticSessionStates.delete(e);for(let t=this._pendingActions.length-1;t>=0;t--){let o=this._pendingActions[t].action;sV(o)&&o.session===e&&this._pendingActions.splice(t,1)}}}applyOptimistic(e){let t=this._nextClientSeq++;return this._pendingActions.push({clientSeq:t,action:e}),this._applySessionToOptimistic(e),t}receiveEnvelope(e){this._lastSeenServerSeq=Math.max(this._lastSeenServerSeq,e.serverSeq);let t=e.origin;if(t!==void 0&&t.clientId===this._clientId){let n=this._pendingActions.findIndex(r=>r.clientSeq===t.clientSeq);n!==-1?e.rejectionReason?this._pendingActions.splice(n,1):(this._applyToConfirmed(e.action),this._pendingActions.splice(n,1)):this._applyToConfirmed(e.action)}else this._applyToConfirmed(e.action);this._recomputeOptimistic(e.action)}receiveNotification(e){this._onDidReceiveNotification.fire(e)}_applyToConfirmed(e){if(qKi(e)&&this._confirmedRootState&&(this._confirmedRootState=XKi(this._confirmedRootState,e,this._log)),sV(e)){let t=e.session.toString(),o=this._confirmedSessionStates.get(t);o&&this._confirmedSessionStates.set(t,$mt(o,e,this._log))}}_applySessionToOptimistic(e){let t=e.session.toString(),o=this._optimisticSessionStates.get(t);if(o){let n=$mt(o,e,this._log);this._optimisticSessionStates.set(t,n),this._onDidChangeSessionState.fire({session:e.session,state:n})}}_recomputeOptimistic(e){qKi(e)&&this._confirmedRootState&&(this._optimisticRootState=this._confirmedRootState,this._onDidChangeRootState.fire(this._confirmedRootState)),sV(e)&&this._recomputeOptimisticSession(e.session);let t=new Set;for(let o of this._pendingActions)sV(o.action)&&t.add(o.action.session.toString());for(let o of t)this._recomputeOptimisticSession(o)}_recomputeOptimisticSession(e){let t=this._confirmedSessionStates.get(e);if(!t)return;let o=t;for(let n of this._pendingActions)sV(n.action)&&n.action.session===e&&(o=$mt(o,n.action,this._log));this._optimisticSessionStates.set(e,o),this._onDidChangeSessionState.fire({session:e,state:o})}};async function MNo(a,i,e,t,o,n){for(let r of i){let s=A.parse(r),l=await t.getOrActivateProviderIdForServer(s,a);if(!l){o.trace(`${n} No auth provider found for server: ${r}`);continue}o.trace(`${n} Resolved auth provider '${l}' for server: ${r}`);let c=await t.getSessions(l,[...e],{authorizationServer:s},!0);if(c.length>0)return c[0].accessToken;let u=await t.getSessions(l,void 0,{authorizationServer:s},!0),p=new Set(e),h,g=1/0;for(let f of u){let v=new Set(f.scopes),b=!0;for(let S of p)if(!v.has(S)){b=!1;break}if(b){let S=v.size-p.size;S<g&&(g=S,h=f.accessToken)}}if(h)return h}}var eXt=class extends x{constructor(e,t){super();this._sessionType=e;this._vendor=t;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._models=[]}updateModels(e){this._models=e,this._onDidChange.fire()}async provideLanguageModelChatInfo(e,t){return this._models.filter(o=>o.policyState!=="disabled").map(o=>({identifier:`${this._vendor}:${o.id}`,metadata:{extension:new Ii("vscode.agent-host"),name:o.name,id:o.id,vendor:this._vendor,version:"1.0",family:o.id,maxInputTokens:o.maxContextWindow??0,maxOutputTokens:0,isDefaultForLocation:{},isUserSelectable:!0,modelPickerCategory:void 0,targetChatSessionType:this._sessionType,capabilities:{vision:o.supportsVision??!1,toolCalling:!0,agentMode:!0}}}))}async sendChatRequest(){throw new Error("Agent-host models do not support direct chat requests")}async provideTokenCount(){return 0}};var PNo=-32007;var tXt=class extends Error{constructor(e,t,o){super(t);this.code=e;this.data=o}};function ZKi(a){if(!a)return;let i=a.ptyTerminal;if(!i||typeof i!="object")return;let e=i.input,t=i.output;return{input:typeof e=="string"?e:void 0,output:typeof t=="string"?t:void 0}}function ANo(a,i){let e=[];for(let t of a){e.push({id:t.id,type:"request",prompt:t.userMessage.text,participant:i});let o=[];for(let n of t.responseParts)switch(n.kind){case"markdown":n.content&&o.push({kind:"markdownContent",content:new Ie(n.content,{supportHtml:!0})});break;case"toolCall":{let r=n.toolCall,s=kwn(r),l=ONo(r);s.length>0&&(l.presentation="hidden"),o.push(l),o.push(...s);break}case"reasoning":n.content&&o.push({kind:"thinking",value:n.content});break;case"contentRef":break}t.state==="error"&&t.error&&o.push({kind:"markdownContent",content:new Ie(`

Error: (${t.error.errorType}) ${t.error.message}`)}),e.push({type:"response",parts:o,participant:i})}return e}function NNo(a){let i=[];for(let e of a.responseParts)switch(e.kind){case"markdown":e.content&&i.push({kind:"markdownContent",content:new Ie(e.content)});break;case"reasoning":e.content&&i.push({kind:"thinking",value:e.content});break;case"toolCall":{let t=e.toolCall;t.status==="completed"||t.status==="cancelled"?i.push(ONo(t)):(t.status==="running"||t.status==="streaming"||t.status==="pending-confirmation")&&i.push(Dse(t));break}case"contentRef":break}return i}function ONo(a){let i=S9(a)==="terminal",e=a.status==="completed"&&a.success,t=ESe(a.invocationMessage)??"",o;if(i){let r=ZKi(a._meta),s=r?.input??a.toolInput,l=a.status==="completed"?r?.output??JKi(a):void 0;!s&&l===void 0?o=void 0:o={kind:"terminal",commandLine:{original:s??""},language:I9(a)??"shellscript",terminalCommandOutput:l!==void 0?{text:l}:void 0,terminalCommandState:{exitCode:e?0:1}}}let n=e?ESe(a.pastTenseMessage)??t:t;return{kind:"toolInvocationSerialized",toolCallId:a.toolCallId,toolId:a.toolName,source:kn.Internal,invocationMessage:t,originMessage:void 0,pastTenseMessage:i?void 0:n,isConfirmed:e?{type:1}:{type:0},isComplete:!0,presentation:void 0,toolSpecificData:o}}function kwn(a){if(a.status!=="completed")return[];let i=kSe(a);if(i.length===0)return[];let e=FNo(a);if(!e)return[];let t=A.file(e),o=[];for(let n of i)o.push({kind:"markdownContent",content:new Ie("\n````\n")}),o.push({kind:"codeblockUri",uri:t,isEdit:!0,undoStopId:a.toolCallId}),o.push({kind:"textEdit",uri:t,edits:[],done:!1,isExternalEdit:!0}),o.push({kind:"textEdit",uri:t,edits:[],done:!0,isExternalEdit:!0}),o.push({kind:"markdownContent",content:new Ie("\n````\n")});return o}function ESe(a){if(a!==void 0)return typeof a=="string"?a:new Ie(a.markdown)}function Dse(a){let i={id:a.toolName,source:kn.Internal,displayName:a.displayName,modelDescription:a.toolName};if(a.status==="pending-confirmation"){let t=ESe(a.confirmationTitle)??ESe(a.invocationMessage)??a.displayName,o=typeof t=="string"?t:t?.value??"",n={title:typeof t=="string"?new Ie(t):t??new Ie(""),message:new Ie("")},r;if(S9(a)==="terminal"&&a.toolInput)r={kind:"terminal",commandLine:{original:a.toolInput},language:I9(a)??"shellscript"};else if(a.toolInput){let s;try{s=JSON.parse(a.toolInput)}catch{s={input:a.toolInput}}r={kind:"input",rawInput:s}}return new MA({invocationMessage:typeof t=="string"?new Ie(o):t??new Ie(""),confirmationMessages:n,presentation:"hiddenAfterComplete",toolSpecificData:r},i,a.toolCallId,void 0,void 0)}let e=new MA(void 0,i,a.toolCallId,void 0,void 0);if(e.invocationMessage=ESe(a.invocationMessage)??"",S9(a)==="terminal"){let t=ZKi(a._meta),o=t?.input??(a.status!=="streaming"?a.toolInput??"":"");e.toolSpecificData={kind:"terminal",commandLine:{original:o},language:I9(a)??"shellscript",terminalCommandOutput:t?.output!==void 0?{text:t.output}:void 0}}return e}function iXt(a,i){let e=i.status==="completed",t=i.status==="cancelled",o=a.toolSpecificData?.kind==="terminal"||S9(i)==="terminal";if((e||t)&&No(i,{invocationMessage:!0})&&(a.invocationMessage=ESe(i.invocationMessage)??a.invocationMessage),o&&(e||t)){let l=ZKi(i._meta),c=e?l?.output??JKi(i):void 0,u=a.toolSpecificData,p=l?.input??i.toolInput??u?.commandLine?.original??"";a.toolSpecificData={kind:"terminal",commandLine:{original:p},language:u?.language??I9(i)??"shellscript",terminalCommandOutput:c!==void 0?{text:c}:void 0,terminalCommandState:{exitCode:e&&i.success?0:1}}}else e&&i.pastTenseMessage&&(a.pastTenseMessage=ESe(i.pastTenseMessage));let n=e&&!i.success||t,r=e?i.error?.message:t?i.reasonMessage:void 0,s=typeof r=="string"?r:r?.markdown;return a.didExecuteTool(n?{content:[],toolResultError:s}:void 0),e?e2i(i):[]}function e2i(a){if(a.status!=="completed")return[];let i=kSe(a);if(i.length===0)return[];let e=[];for(let t of i){let o=FNo(a);o&&e.push({resource:A.file(o),beforeContentUri:A.parse(t.beforeURI),afterContentUri:A.parse(t.afterURI),undoStopId:a.toolCallId})}return e}function FNo(a){if(!(a.status!=="completed"||!a.toolInput))try{let i=JSON.parse(a.toolInput);return typeof i.path=="string"?i.path:void 0}catch{return}}var t2i=class{constructor(i,e,t,o,n){this.state=So(1);this.isCurrentlyBeingModifiedBy=So(void 0);this.lastModifyingResponse=So(void 0);this.rewriteRatio=So(1);this.waitsForLastEdits=So(!1);this.reviewMode=So(!1);this.autoAcceptController=So(void 0);this.changesCount=So(0);this.entryId=`agenthost-${i.toString()}`,this.modifiedURI=i,this.originalURI=e,this.lastModifyingRequestId=t,(o>0||n>0)&&(this.linesAdded=So(o),this.linesRemoved=So(n))}async accept(){}async reject(){}enableReviewModeUntilSettled(){}getEditorIntegration(i){return{currentIndex:Me("currentIndex",0),reveal(){},next(){return!1},previous(){return!1},enableAccessibleDiffView(){},async acceptNearestChange(e){},async rejectNearestChange(e){},async toggleDiff(e,t){},dispose(){}}}},TSe=class extends x{constructor(e,t,o,n,r,s,l,c){super();this.chatSessionResource=e;this._connectionAuthority=t;this._editorService=o;this._instantiationService=n;this._logService=r;this._fileService=s;this._textModelService=l;this._editorWorkerService=c;this.supportsKeepUndo=!0;this.isGlobalEditingSession=!1;this._state=Me(this,2);this.state=this._state;this._entriesObs=Me(this,[]);this.entries=this._entriesObs;this.requestDisablement=So([]);this._onDidDispose=this._register(new E);this.onDidDispose=this._onDidDispose.event;this._onDidRequestFileWrite=this._register(new E);this.onDidRequestFileWrite=this._onDidRequestFileWrite.event;this._checkpoints=[];this._currentCheckpointIndex=Me(this,-1);this._diffCache=new Map;this._undoRedoSequencer=new rm;this._hasExplanations=!1;this.canUndo=ke(this,e=>this._currentCheckpointIndex.read(e)>=0);this.canRedo=ke(this,e=>this._currentCheckpointIndex.read(e)<this._checkpoints.length-1)}addToolCallEdits(e,t){if(t.status!=="completed")return[];if(this._checkpoints.some(u=>u.undoStopId===t.toolCallId))return[];let o=e2i(t);if(o.length===0)return[];let n=this._connectionAuthority,r=kSe(t),s=o.map((u,p)=>({resource:Kmt(u.resource,n),beforeContentUri:Kmt(u.beforeContentUri,n),afterContentUri:Kmt(u.afterContentUri,n),undoStopId:u.undoStopId,diff:r[p]?.diff})),l={requestId:e,undoStopId:t.toolCallId,edits:s};this._checkpoints.push(l),Gi(u=>{this._currentCheckpointIndex.set(this._checkpoints.length-1,u),this._state.get()===0&&this._state.set(2,u)}),this._rebuildEntries();let c=[];for(let u of s)c.push({kind:"markdownContent",content:new Ie("\n````\n")}),c.push({kind:"codeblockUri",uri:u.resource,isEdit:!0,undoStopId:t.toolCallId}),c.push({kind:"textEdit",uri:u.resource,edits:[],done:!1,isExternalEdit:!0}),c.push({kind:"textEdit",uri:u.resource,edits:[],done:!0,isExternalEdit:!0}),c.push({kind:"markdownContent",content:new Ie("\n````\n")});return c}async show(e){if(this._editorPane?.isVisible())return;if(this._editorPane?.input){await this._editorService.openEditor(this._editorPane.input,{pinned:!0,activation:1});return}let t=au.fromResourceMultiDiffEditorInput({multiDiffSource:ERt(this,e),label:d(6021,null)},this._instantiationService);this._editorPane=await this._editorService.openEditor(t,{pinned:!0,activation:1})}getEntry(e){return this._entriesObs.get().find(t=>Qe(t.modifiedURI,e))}readEntry(e,t){return this._entriesObs.read(t).find(o=>Qe(o.modifiedURI,e))}async accept(...e){}async reject(...e){}_findCheckpointIndex(e,t){if(t!==void 0)return this._checkpoints.findIndex(o=>o.requestId===e&&o.undoStopId===t);for(let o=this._checkpoints.length-1;o>=0;o--)if(this._checkpoints[o].requestId===e)return o;return-1}_findCheckpoint(e,t){let o=this._findCheckpointIndex(e,t);return o>=0?this._checkpoints[o]:void 0}async restoreSnapshot(e,t){let o=this._findCheckpointIndex(e,t);if(o<0){this._logService.warn(`[AgentHostEditingSession] No checkpoint found for requestId=${e}${t?`, stopId=${t}`:""}`);return}let n=this._currentCheckpointIndex.get();if(o<n)for(let r=n;r>o;r--)await this._writeCheckpointContent(this._checkpoints[r],"before");else if(o>n)for(let r=n+1;r<=o;r++)await this._writeCheckpointContent(this._checkpoints[r],"after");Gi(r=>{this._currentCheckpointIndex.set(o,r)}),this._rebuildEntries()}getSnapshotUri(e,t,o){let n=this._findCheckpoint(e,o);if(!n)return;let r=t.toString();if(n.edits.find(l=>l.resource.toString()===r))return A.from({scheme:Q.chatEditingSnapshotScheme,path:t.path,query:JSON.stringify({session:this.chatSessionResource.toString(),requestId:e,undoStop:o??""})})}async getSnapshotContents(e,t,o){let n=this._findCheckpoint(e,o);if(!n)return;let r=t.toString(),s=n.edits.find(l=>l.resource.toString()===r);if(s)try{return(await this._fileService.readFile(s.afterContentUri)).value}catch(l){this._logService.warn("[AgentHostEditingSession] Failed to fetch snapshot content",l);return}}async getSnapshotModel(e,t,o){return null}getEntryDiffBetweenStops(e,t,o){let n=t!==void 0?this._checkpoints.findIndex(l=>l.requestId===t&&(o===void 0||l.undoStopId===o)):-1;if(n<0&&t!==void 0)return;let r=t!==void 0?n-1:-1,s=t!==void 0?n:this._checkpoints.length>0?0:-1;if(!(s<0))return this._getFileDiffObservable(e,r,s)}getEntryDiffBetweenRequests(e,t,o){let n=this._checkpoints.map((c,u)=>c.requestId===t?u:-1).filter(c=>c>=0),r=this._checkpoints.map((c,u)=>c.requestId===o?u:-1).filter(c=>c>=0);if(n.length===0||r.length===0)return So(void 0);let s=n[0],l=r[r.length-1];return this._getFileDiffObservable(e,s-1,l)}_getFileDiffObservable(e,t,o){let n=e.toString(),r;if(t>=0)for(let l=t;l>=0;l--){for(let c of this._checkpoints[l].edits)if(c.resource.toString()===n){r=c.afterContentUri;break}if(r)break}let s;for(let l=Math.max(0,t);l<=o&&l<this._checkpoints.length;l++)for(let c of this._checkpoints[l].edits)c.resource.toString()===n&&(r||(r=c.beforeContentUri),l>t&&(s=c.afterContentUri));return!r||!s?So(void 0):this._computeFileDiffObservable(r,s,e)}_computeFileDiffObservable(e,t,o){let n=`${e.toString()}\0${t.toString()}`,r=this._diffCache.get(n);if(r)return So(r);let s=new bd(this._computeFileDiff(e,t,o));return Os({owner:this},l=>{let c=s.promiseResult.read(l);return c?c.data?(this._diffCache.set(n,c.data),c.data):bJ(e,t):{...bJ(e,t),isBusy:!0}})}async _computeFileDiff(e,t,o){let n=new N;try{let r=await this._textModelService.createModelReference(e);n.add(r);let s=await this._textModelService.createModelReference(t);n.add(s);let l=await this._editorWorkerService.computeDiff(r.object.textEditorModel.uri,s.object.textEditorModel.uri,{ignoreTrimWhitespace:!1,computeMoves:!1,maxComputationTimeMs:3e3},"advanced"),c={originalURI:e,modifiedURI:o,identical:!!l?.identical,isFinal:!0,quitEarly:!l||l.quitEarly,added:0,removed:0,isBusy:!1};if(l)for(let u of l.changes)c.removed+=u.original.endLineNumberExclusive-u.original.startLineNumber,c.added+=u.modified.endLineNumberExclusive-u.modified.startLineNumber;return c}catch(r){return this._logService.warn("[AgentHostEditingSession] diff computation failed",r),{...bJ(e,t),isFinal:!0}}finally{n.dispose()}}getDiffsForFilesInSession(){return ke(this,e=>{let t=this._currentCheckpointIndex.read(e);return this._readDiffsFromCheckpoints(-1,t)}).map((e,t)=>e.read(t))}getDiffsForFilesInRequest(e){return ke(this,t=>{let o=this._currentCheckpointIndex.read(t),n=[];for(let r=0;r<=o&&r<this._checkpoints.length;r++)this._checkpoints[r].requestId===e&&n.push(r);if(n.length!==0)return this._readDiffsFromCheckpoints(n[0]-1,n[n.length-1])}).map((t,o)=>t?.read(o)||[])}hasEditsInRequest(e,t){return this._checkpoints.some(o=>o.requestId===e)}getDiffForSession(){let e=this.getDiffsForFilesInSession();return ke(this,t=>{let o=e.read(t),n=0,r=0;for(let s of o)n+=s.added,r+=s.removed;return{added:n,removed:r}})}async undoInteraction(){return this._undoRedoSequencer.queue(()=>this._undoInteractionImpl())}async redoInteraction(){return this._undoRedoSequencer.queue(()=>this._redoInteractionImpl())}async _undoInteractionImpl(){let e=this._currentCheckpointIndex.get();e<0||(await this._writeCheckpointContent(this._checkpoints[e],"before"),Gi(t=>{this._currentCheckpointIndex.set(e-1,t)}),this._rebuildEntries())}async _redoInteractionImpl(){let e=this._currentCheckpointIndex.get();if(e>=this._checkpoints.length-1)return;let t=e+1;await this._writeCheckpointContent(this._checkpoints[t],"after"),Gi(o=>{this._currentCheckpointIndex.set(t,o)}),this._rebuildEntries()}async triggerExplanationGeneration(){this._hasExplanations=!0}clearExplanations(){this._hasExplanations=!1}hasExplanations(){return this._hasExplanations}startStreamingEdits(e,t,o){throw new Error("Not supported for agent host sessions")}applyWorkspaceEdit(e,t,o){throw new Error("Not supported for agent host sessions")}async startExternalEdits(e,t,o,n,r){throw new Error("Not supported for agent host sessions")}async stopExternalEdits(e,t,o){throw new Error("Not supported for agent host sessions")}async stop(e){this.dispose()}dispose(){this._state.set(3,void 0),this._onDidDispose.fire(),this._diffCache.clear(),super.dispose()}_rebuildEntries(){let e=this._currentCheckpointIndex.get(),t=new Map;for(let n=0;n<=e&&n<this._checkpoints.length;n++){let r=this._checkpoints[n];for(let s of r.edits){let l=s.resource.toString(),c=t.get(l);c?(c.afterContentUri=s.afterContentUri,c.requestId=r.requestId,c.added+=s.diff?.added??0,c.removed+=s.diff?.removed??0):t.set(l,{resource:s.resource,beforeContentUri:s.beforeContentUri,afterContentUri:s.afterContentUri,requestId:r.requestId,added:s.diff?.added??0,removed:s.diff?.removed??0})}}let o=[...t.values()].map(n=>new t2i(n.resource,n.beforeContentUri,n.requestId,n.added,n.removed));this._entriesObs.set(o,void 0)}async _writeCheckpointContent(e,t){let o=e.edits.map(async n=>{let r=t==="before"?n.beforeContentUri:n.afterContentUri;try{let s=await this._fileService.readFile(r);this._onDidRequestFileWrite.fire({uri:n.resource.toString(),data:s.value.toString(),encoding:"utf-8"})}catch(s){this._logService.warn(`[AgentHostEditingSession] Failed to fetch content for ${t}`,r.toString(),s)}});await Promise.all(o)}_readDiffsFromCheckpoints(e,t){let o=new Set,n=[];for(let s=Math.max(0,e+1);s<=t&&s<this._checkpoints.length;s++)for(let l of this._checkpoints[s].edits){let c=l.resource.toString();o.has(c)||(o.add(c),n.push(l.resource))}let r=n.map(s=>this._getFileDiffObservable(s,e,t));return ke(s=>r.flatMap(l=>l.read(s)).filter(lo))}};TSe=I([m(2,ee),m(3,F),m(4,se),m(5,fe),m(6,Bt),m(7,Qs)],TSe);var jmt=class extends x{constructor(e,t,o,n,r,s){super();this.sessionResource=e;this.history=t;this._sendRequest=o;this._logService=s;this.progressObs=Me("agentHostProgress",[]);this.isCompleteObs=Me("agentHostComplete",!0);this._onWillDispose=this._register(new E);this.onWillDispose=this._onWillDispose.event;this._onDidStartServerRequest=this._register(new E);this.onDidStartServerRequest=this._onDidStartServerRequest.event;let l=n!==void 0;l&&(this.isCompleteObs.set(!1,void 0),this.progressObs.set(n,void 0)),this._register(Z(()=>this._onWillDispose.fire())),this._register(Z(r)),this.requestHandler=async(c,u,p,h)=>{this._logService.info("[AgentHost] requestHandler called"),this.isCompleteObs.set(!1,void 0),await this._sendRequest(c,u,h),this.isCompleteObs.set(!0,void 0)},this.interruptActiveResponseCallback=l||t.length===0?async()=>!0:void 0}registerDisposable(e){return this._register(e)}appendProgress(e){let t=this.progressObs.get();this.progressObs.set([...t,...e],void 0)}complete(){this.isCompleteObs.set(!0,void 0)}startServerRequest(e){this._logService.info("[AgentHost] Server-initiated request started"),this.progressObs.set([],void 0),this.isCompleteObs.set(!1,void 0),this._onDidStartServerRequest.fire({prompt:e})}};jmt=I([m(5,se)],jmt);var _Se=class extends x{constructor(e,t,o,n,r,s,l,c){super();this._chatAgentService=t;this._chatService=o;this._chatEditingService=n;this._logService=r;this._productService=s;this._workspaceContextService=l;this._instantiationService=c;this._activeSessions=new gt;this._sessionToBackend=new gt;this._pendingMessageSubscriptions=this._register(new Xb);this._serverTurnWatchers=this._register(new Xb);this._editingSessionListeners=this._register(new Xb);this._pendingHistoryTurns=new gt;this._clientDispatchedTurnIds=new Set;this._config=e,this._clientState=this._register(new Bqe(e.connection.clientId,this._logService)),this._register(this._chatEditingService.registerEditingSessionProvider(e.sessionType,{createEditingSession:u=>this._instantiationService.createInstance(TSe,u,e.connectionAuthority)})),this._register(e.connection.onDidAction(u=>{sV(u.action)&&this._clientState.receiveEnvelope(u)})),this._registerAgent()}async provideChatSessionContent(e,t){let o,n=e.path.substring(1).startsWith("untitled-"),r=[],s,l;if(!n){o=this._resolveSessionUri(e),this._sessionToBackend.set(e,o);try{let u=await this._config.connection.subscribe(o);if(u?.state){this._clientState.handleSnapshot(o.toString(),u.state,u.fromSeq);let p=this._clientState.getSessionState(o.toString());p&&(r.push(...ANo(p.turns,this._config.agentId)),p.turns.some(g=>g.responseParts.some(f=>f.kind==="toolCall"&&f.toolCall.status==="completed"&&kSe(f.toolCall).length>0))&&this._pendingHistoryTurns.set(e,p.turns),p.activeTurn&&(l=p.activeTurn.id,r.push({type:"request",prompt:p.activeTurn.userMessage.text,participant:this._config.agentId}),r.push({type:"response",parts:[],participant:this._config.agentId}),s=NNo(p.activeTurn),this._logService.info(`[AgentHost] Reconnecting to active turn ${l} for session ${o.toString()}`)))}}catch(u){this._logService.warn(`[AgentHost] Failed to subscribe to existing session: ${o.toString()}`,u)}}let c=this._instantiationService.createInstance(jmt,e,r,async(u,p,h)=>{let g=o??await this._createAndSubscribe(e,u.userSelectedModelId);return o||(o=g,this._sessionToBackend.set(e,g)),this._ensurePendingMessageSubscription(e,g),this._handleTurn(g,u,p,h)},s,()=>{this._activeSessions.delete(e),this._sessionToBackend.delete(e),this._pendingMessageSubscriptions.deleteAndDispose(e),this._serverTurnWatchers.deleteAndDispose(e),this._editingSessionListeners.deleteAndDispose(e),this._pendingHistoryTurns.delete(e),o&&(this._clientState.unsubscribe(o.toString()),this._config.connection.unsubscribe(o),this._config.connection.disposeSession(o))});return this._activeSessions.set(e,c),o&&(this._pendingHistoryTurns.has(e)&&c.registerDisposable(U.once(this._chatService.onDidCreateModel)(u=>{Qe(u.sessionResource,e)&&this._ensureEditingSession(e)})),l&&s!==void 0&&this._reconnectToActiveTurn(o,l,c,s),this._watchForServerInitiatedTurns(o,e)),c}_registerAgent(){let e={id:this._config.agentId,name:this._config.agentId,fullName:this._config.fullName,description:this._config.description,extensionId:new Ii(this._config.extensionId??"vscode.agent-host"),extensionVersion:void 0,extensionPublisherId:"vscode",extensionDisplayName:this._config.extensionDisplayName??"Agent Host",isDefault:!1,isDynamic:!0,isCore:!0,metadata:{themeIcon:O6e(this._productService)},slashCommands:[],locations:["panel"],modes:["agent"],disambiguation:[]},t={invoke:async(o,n,r,s)=>this._invokeAgent(o,n,s)};this._register(this._chatAgentService.registerDynamicAgent(e,t))}async _invokeAgent(e,t,o){this._logService.info(`[AgentHost] _invokeAgent called for resource: ${e.sessionResource.toString()}`);let n=this._sessionToBackend.get(e.sessionResource);n||(n=await this._createAndSubscribe(e.sessionResource,e.userSelectedModelId),this._sessionToBackend.set(e.sessionResource,n)),await this._handleTurn(n,e,t,o);let r=this._activeSessions.get(e.sessionResource);return r&&r.isCompleteObs.set(!0,void 0),{}}_syncPendingMessages(e,t){let o=this._chatService.getSession(e);if(!o)return;let n=t.toString(),r=o.getPendingRequests(),s=this._clientState.getSessionState(n),l=s?.steeringMessage,c=s?.queuedMessages??[],u,p=[];for(let b of r)b.kind==="steering"?u={id:b.request.id,text:b.request.message.text}:p.push({id:b.request.id,text:b.request.message.text});u?u.id!==l?.id&&this._dispatchAction({type:"session/pendingMessageSet",session:n,kind:"steering",id:u.id,userMessage:{text:u.text}}):l&&this._dispatchAction({type:"session/pendingMessageRemoved",session:n,kind:"steering",id:l.id});let h=new Set(p.map(b=>b.id));for(let b of c)h.has(b.id)||this._dispatchAction({type:"session/pendingMessageRemoved",session:n,kind:"queued",id:b.id});let g=new Set(c.map(b=>b.id));for(let b of p)g.has(b.id)||this._dispatchAction({type:"session/pendingMessageSet",session:n,kind:"queued",id:b.id,userMessage:{text:b.text}});let v=this._clientState.getSessionState(n)?.queuedMessages??[];v.length>1&&p.length===v.length&&p.some((S,y)=>S.id!==v[y].id)&&this._dispatchAction({type:"session/queuedMessagesReordered",session:n,order:p.map(S=>S.id)})}_dispatchAction(e){let t=this._clientState.applyOptimistic(e);this._config.connection.dispatchAction(e,this._clientState.clientId,t)}_watchForServerInitiatedTurns(e,t){let o=e.toString(),r=this._clientState.getSessionState(o)?.activeTurn?.id,s,l=new N,c=new me;l.add(c),l.add(this._clientState.onDidChangeSessionState(u=>{if(u.session!==o)return;let p=new Set((u.state.queuedMessages??[]).map(v=>v.id)),h=u.state.activeTurn;if(!h||h.id===r){s=p;return}if(r=h.id,this._clientDispatchedTurnIds.has(h.id)){s=p;return}let g=this._activeSessions.get(t);if(!g){s=p;return}if(this._logService.info(`[AgentHost] Server-initiated turn detected: ${h.id}`),s)for(let v of s)p.has(v)||this._chatService.removePendingRequest(t,v);s=p,g.startServerRequest(h.userMessage.text);let f=new N;c.value=f,this._trackServerTurnProgress(e,h.id,g,t,f)})),this._serverTurnWatchers.set(t,l)}_trackServerTurnProgress(e,t,o,n,r){let s=e.toString(),l=new Map,c=new Map,u=new gu;r.add(u);let p=f=>{let v=o.progressObs.get();o.progressObs.set([...v,...f],void 0)},h=!1,g=()=>u.queue(async()=>{if(!h){h=!0;for(let[,f]of l)f.didExecuteTool(void 0);l.clear(),o.isCompleteObs.set(!0,void 0)}});r.add(this._clientState.onDidChangeSessionState(f=>{u.queue(async()=>{if(f.session!==s)return;let v=f.state.activeTurn,b=v?.id===t,S=b?v.responseParts:f.state.turns.find(y=>y.id===t)?.responseParts;if(S)for(let y of S)switch(y.kind){case"markdown":{let w=c.get(y.id)??0;if(y.content.length>w){let k=y.content.substring(w);c.set(y.id,y.content.length),p([{kind:"markdownContent",content:new Ie(k,{supportHtml:!0})}])}break}case"reasoning":{let w=c.get(y.id)??0;if(y.content.length>w){let k=y.content.substring(w);c.set(y.id,y.content.length),p([{kind:"thinking",value:k}])}break}case"toolCall":{let w=y.toolCall,k=w.toolCallId,T=l.get(k);if(!T)T=Dse(w),l.set(k,T),p([T]),w.status==="pending-confirmation"&&this._awaitToolConfirmation(T,k,e,t,Se.None);else if(w.status==="pending-confirmation"){T.didExecuteTool(void 0);let P=Dse(w);l.set(k,P),p([P]),this._awaitToolConfirmation(P,k,e,t,Se.None)}else w.status==="running"&&(T.invocationMessage=typeof w.invocationMessage=="string"?w.invocationMessage:new Ie(w.invocationMessage.markdown),S9(w)==="terminal"&&w.toolInput&&(T.toolSpecificData={kind:"terminal",commandLine:{original:w.toolInput},language:I9(w)??"shellscript"}));T&&(w.status==="completed"||w.status==="cancelled")&&!Pi.isComplete(T)&&(l.delete(k),iXt(T,w).length>0);break}}if(!b&&!h){let y=f.state.turns.find(w=>w.id===t);y?.state==="error"&&y.error&&p([{kind:"markdownContent",content:new Ie(`

Error: (${y.error.errorType}) ${y.error.message}`)}]),g()}})}))}async _handleTurn(e,t,o,n){if(n.isCancellationRequested)return;let r=xt();this._clientDispatchedTurnIds.add(r);let s=()=>this._clientDispatchedTurnIds.delete(r),c=this._convertVariablesToAttachments(t).map(T=>({type:T.type,path:T.path,displayName:T.displayName})),u=this._extractRawModelId(t.userSelectedModelId);if(u&&this._clientState.getSessionState(e.toString())?.summary.model!==u){let P={type:"session/modelChanged",session:e.toString(),model:u},O=this._clientState.applyOptimistic(P);this._config.connection.dispatchAction(P,this._clientState.clientId,O)}let p={type:"session/turnStarted",session:e.toString(),turnId:r,userMessage:{text:t.message,attachments:c.length>0?c:void 0}},h=this._clientState.applyOptimistic(p);this._config.connection.dispatchAction(p,this._clientState.clientId,h);let g=new Map,f=new Map,v=new N,b=new gu;v.add(b);let S,y=new Promise(T=>{S=T}),w=!1,k=()=>b.queue(async()=>{if(!w){w=!0,s();for(let[,T]of g)T.didExecuteTool(void 0);g.clear(),v.dispose(),S()}});v.add(this._clientState.onDidChangeSessionState(T=>{b.queue(async()=>{if(T.session!==e.toString()||n.isCancellationRequested)return;let P=T.state.activeTurn,O=P?.id===r,V=O?P.responseParts:T.state.turns.find(H=>H.id===r)?.responseParts;if(V)for(let H of V)switch(H.kind){case"markdown":{let G=f.get(H.id)??0;if(H.content.length>G){let $=H.content.substring(G);f.set(H.id,H.content.length),o([{kind:"markdownContent",content:new Ie($,{supportHtml:!0})}])}break}case"reasoning":{let G=f.get(H.id)??0;if(H.content.length>G){let $=H.content.substring(G);f.set(H.id,H.content.length),o([{kind:"thinking",value:$}])}break}case"toolCall":{let G=H.toolCall,$=G.toolCallId,J=g.get($);if(!J)J=Dse(G),g.set($,J),o([J]),G.status==="pending-confirmation"&&this._awaitToolConfirmation(J,$,e,r,n);else if(G.status==="pending-confirmation"){J.didExecuteTool(void 0);let ae=Dse(G);g.set($,ae),o([ae]),this._awaitToolConfirmation(ae,$,e,r,n)}else G.status==="running"&&(J.invocationMessage=typeof G.invocationMessage=="string"?G.invocationMessage:new Ie(G.invocationMessage.markdown),S9(G)==="terminal"&&G.toolInput&&(J.toolSpecificData={kind:"terminal",commandLine:{original:G.toolInput},language:I9(G)??"shellscript"}));if(J&&(G.status==="completed"||G.status==="cancelled")&&!Pi.isComplete(J)&&iXt(J,G).length>0){let he=this._hydrateFileEdits(t.sessionResource,t.requestId,G);he.length>0&&o(he)}break}}if(!O){let H=T.state.turns.find(G=>G.id===r);H?.state==="error"&&H.error&&o([{kind:"markdownContent",content:new Ie(`

Error: (${H.error.errorType}) ${H.error.message}`)}]),w||k()}})})),v.add(n.onCancellationRequested(()=>{this._logService.info(`[AgentHost] Cancellation requested for ${e.toString()}, dispatching turnCancelled`);let T={type:"session/turnCancelled",session:e.toString(),turnId:r},P=this._clientState.applyOptimistic(T);this._config.connection.dispatchAction(T,this._clientState.clientId,P),k()})),await y}_awaitToolConfirmation(e,t,o,n,r){Pi.awaitConfirmation(e,r).then(s=>{let l=s.type!==0&&s.type!==5;if(this._logService.info(`[AgentHost] Tool confirmation: toolCallId=${t}, approved=${l}`),l){let c={type:"session/toolCallConfirmed",session:o.toString(),turnId:n,toolCallId:t,approved:!0,confirmed:"user-action"},u=this._clientState.applyOptimistic(c);this._config.connection.dispatchAction(c,this._clientState.clientId,u)}else{let c={type:"session/toolCallConfirmed",session:o.toString(),turnId:n,toolCallId:t,approved:!1,reason:"denied"},u=this._clientState.applyOptimistic(c);this._config.connection.dispatchAction(c,this._clientState.clientId,u)}}).catch(s=>{this._logService.warn(`[AgentHost] Tool confirmation failed for toolCallId=${t}`,s)})}_reconnectToActiveTurn(e,t,o,n){let r=e.toString(),s=new Map;for(let v of n)v instanceof MA&&s.set(v.toolCallId,v);let l=new Map,c=this._clientState.getSessionState(r);if(c?.activeTurn)for(let v of c.activeTurn.responseParts)(v.kind==="markdown"||v.kind==="reasoning")&&l.set(v.id,v.content.length);let u=o.registerDisposable(new N),p=new gu;u.add(p),o.interruptActiveResponseCallback=async()=>{this._logService.info(`[AgentHost] Reconnect cancellation requested for ${r}, dispatching turnCancelled`);let v={type:"session/turnCancelled",session:r,turnId:t},b=this._clientState.applyOptimistic(v);return this._config.connection.dispatchAction(v,this._clientState.clientId,b),!0};let h=new Ye;u.add(Z(()=>h.dispose(!0)));for(let[v,b]of s)Pi.isComplete(b)||this._awaitToolConfirmation(b,v,e,t,h.token);let g=v=>{let b=v.activeTurn,S=b?.id===t,y=S?b.responseParts:v.turns.find(w=>w.id===t)?.responseParts;if(y)for(let w of y)switch(w.kind){case"markdown":{let k=l.get(w.id)??0;if(w.content.length>k){let T=w.content.substring(k);l.set(w.id,w.content.length),o.appendProgress([{kind:"markdownContent",content:new Ie(T,{supportHtml:!0})}])}break}case"reasoning":{let k=l.get(w.id)??0;if(w.content.length>k){let T=w.content.substring(k);l.set(w.id,w.content.length),o.appendProgress([{kind:"thinking",value:T}])}break}case"toolCall":{let k=w.toolCall,T=k.toolCallId,P=s.get(T);if(!P)P=Dse(k),s.set(T,P),o.appendProgress([P]),k.status==="pending-confirmation"&&this._awaitToolConfirmation(P,T,e,t,h.token);else if(k.status==="pending-confirmation"){P.didExecuteTool(void 0);let O=Dse(k);s.set(T,O),o.appendProgress([O]),this._awaitToolConfirmation(O,T,e,t,h.token)}else k.status==="running"&&(P.invocationMessage=typeof k.invocationMessage=="string"?k.invocationMessage:new Ie(k.invocationMessage.markdown),S9(k)==="terminal"&&k.toolInput&&(P.toolSpecificData={kind:"terminal",commandLine:{original:k.toolInput},language:I9(k)??"shellscript"}));P&&(k.status==="completed"||k.status==="cancelled")&&!Pi.isComplete(P)&&(s.delete(T),iXt(P,k));break}}if(!S){let w=v.turns.find(k=>k.id===t);w?.state==="error"&&w.error&&o.appendProgress([{kind:"markdownContent",content:new Ie(`

Error: (${w.error.errorType}) ${w.error.message}`)}]),o.complete(),u.dispose()}};u.add(this._clientState.onDidChangeSessionState(v=>{v.session===r&&p.queue(async()=>g(v.state))}));let f=this._clientState.getSessionState(r);f&&g(f)}_ensureEditingSession(e){let t=this._chatService.getSession(e);if(!t)return;t.editingSession||t.startEditingSession();let o=t.editingSession;if(o instanceof TSe){if(!this._editingSessionListeners.has(e)){this._editingSessionListeners.set(e,o.onDidRequestFileWrite(r=>{this._config.connection.writeFile(r).catch(s=>{this._logService.warn("[AgentHost] writeFile failed for undo/redo",s)})}));let n=this._pendingHistoryTurns.get(e);if(n){this._pendingHistoryTurns.delete(e);for(let r of n)for(let s of r.responseParts)s.kind==="toolCall"&&o.addToolCallEdits(r.id,s.toolCall)}}return o}}_hydrateFileEdits(e,t,o){let n=this._ensureEditingSession(e);return n?n.addToolCallEdits(t,o):[]}_resolveSessionUri(e){let t=e.path.substring(1);return ZG.uri(this._config.provider,t)}async _createAndSubscribe(e,t){let o=this._extractRawModelId(t),n=e.path.substring(1),r=this._config.resolveWorkingDirectory?.(n)??this._workspaceContextService.getWorkspace().folders[0]?.uri;this._logService.trace(`[AgentHost] Creating new session, model=${o??"(default)"}, provider=${this._config.provider}`);let s;try{s=await this._config.connection.createSession({model:o,provider:this._config.provider,workingDirectory:r})}catch(l){if(this._isAuthRequiredError(l)&&this._config.resolveAuthentication)if(this._logService.info("[AgentHost] Authentication required, prompting user..."),await this._config.resolveAuthentication())s=await this._config.connection.createSession({model:o,provider:this._config.provider,workingDirectory:r});else throw new Error(d(6022,null));else throw l}this._logService.trace(`[AgentHost] Created session: ${s.toString()}`);try{let l=await this._config.connection.subscribe(s);this._clientState.handleSnapshot(s.toString(),l.state,l.fromSeq)}catch(l){this._logService.error(`[AgentHost] Failed to subscribe to new session: ${s.toString()}`,l)}return this._ensurePendingMessageSubscription(e,s),this._watchForServerInitiatedTurns(s,e),s}_ensurePendingMessageSubscription(e,t){if(this._pendingMessageSubscriptions.has(e))return;let o=this._chatService?.getSession(e);o&&this._pendingMessageSubscriptions.set(e,o.onDidChangePendingRequests(()=>{this._syncPendingMessages(e,t)}))}_isAuthRequiredError(e){return!!(e instanceof tXt&&e.code===PNo||e instanceof Error&&e.message.includes("Authentication required"))}_extractRawModelId(e){if(!e)return;let t=this._config.sessionType+":";return e.startsWith(t)?e.substring(t.length):e}_convertVariablesToAttachments(e){let t=[];for(let o of e.variables.variables)if(o.kind==="file"){let n=o.value instanceof A?o.value:void 0;n?.scheme==="file"&&t.push({type:"file",path:n.fsPath,displayName:o.name})}else if(o.kind==="directory"){let n=o.value instanceof A?o.value:void 0;n?.scheme==="file"&&t.push({type:"directory",path:n.fsPath,displayName:o.name})}else if(o.kind==="implicit"&&o.isSelection){let n=o.uri;n?.scheme==="file"&&t.push({type:"selection",path:n.fsPath,displayName:o.name})}return t.length>0&&this._logService.trace(`[AgentHost] Converted ${t.length} attachments from ${e.variables.variables.length} variables`),t}dispose(){for(let[,e]of this._activeSessions)e.dispose();this._activeSessions.clear(),this._sessionToBackend.clear(),super.dispose()}};_Se=I([m(1,cr),m(2,mi),m(3,ud),m(4,se),m(5,tt),m(6,Pe),m(7,F)],_Se);var DSe=class extends x{constructor(e,t,o,n,r){super();this._sessionType=e;this._provider=t;this._connection=o;this._description=n;this._productService=r;this._onDidChangeChatSessionItems=this._register(new E);this.onDidChangeChatSessionItems=this._onDidChangeChatSessionItems.event;this._items=[];this._register(this._connection.onDidNotification(s=>{if(s.type==="notify/sessionAdded"&&s.summary.provider===this._provider){let l=ZG.id(s.summary.resource),c=typeof s.summary.workingDirectory=="string"?A.parse(s.summary.workingDirectory):void 0,u={resource:A.from({scheme:this._sessionType,path:`/${l}`}),label:s.summary.title??`Session ${l.substring(0,8)}`,description:this._description,iconPath:O6e(this._productService),status:1,metadata:this._buildMetadata(c),timing:{created:s.summary.createdAt,lastRequestStarted:s.summary.modifiedAt,lastRequestEnded:s.summary.modifiedAt}};this._items.push(u),this._onDidChangeChatSessionItems.fire({addedOrUpdated:[u]})}else if(s.type==="notify/sessionRemoved"&&ZG.provider(s.session)===this._provider){let l=ZG.id(s.session),c=this._items.findIndex(u=>u.resource.path===`/${l}`);if(c>=0){let[u]=this._items.splice(c,1);this._onDidChangeChatSessionItems.fire({removed:[u.resource]})}}})),this._register(this._connection.onDidAction(s=>{if(s.action.type==="session/turnComplete"&&sV(s.action)&&ZG.provider(s.action.session)===this._provider){let l=new Ye;this.refresh(l.token).finally(()=>l.dispose())}}))}get items(){return this._items}async refresh(e){try{let o=(await this._connection.listSessions()).filter(r=>ZG.provider(r.session)===this._provider),n=r=>ZG.id(r.session);this._items=o.map(r=>({resource:A.from({scheme:this._sessionType,path:`/${n(r)}`}),label:r.summary??`Session ${n(r).substring(0,8)}`,description:this._description,iconPath:O6e(this._productService),status:1,metadata:this._buildMetadata(r.workingDirectory),timing:{created:r.startTime,lastRequestStarted:r.modifiedTime,lastRequestEnded:r.modifiedTime}}))}catch{this._items=[]}this._onDidChangeChatSessionItems.fire({addedOrUpdated:this._items})}_buildMetadata(e){if(!this._description)return;let t={remoteAgentHost:this._description};return e&&(t.workingDirectoryPath=e.fsPath),t}};DSe=I([m(4,tt)],DSe);function Ewn(a,i){return i&&typeof i=="object"&&i.$mid!==void 0&&i.scheme!==void 0?A.revive(i).toString():i}function Twn(a){if(a===void 0)return"";try{return JSON.stringify(a,Ewn,2)}catch{return String(a)}}var Hqe=class extends x{constructor(e,t,o,n,r){super();this._inner=e;this._channelId=t;this._channelLabel=o;this._outputService=n;if(this.clientId=e.clientId,this._enabled=!!r.getValue(m2t),this._enabled){let c=ne.as(Hv.OutputChannels);c.registerChannel({id:this._channelId,label:this._channelLabel,log:!1,languageId:"log"}),this._register({dispose:()=>c.removeChannel(this._channelId)})}let s=this._register(new E);this._register(e.onDidAction(c=>{this._log("**","onDidAction",c),s.fire(c)})),this.onDidAction=s.event;let l=this._register(new E);this._register(e.onDidNotification(c=>{this._log("**","onDidNotification",c),l.fire(c)})),this.onDidNotification=l.event}async listAgents(){return this._logCall("listAgents",void 0,()=>this._inner.listAgents())}async getResourceMetadata(){return this._logCall("getResourceMetadata",void 0,()=>this._inner.getResourceMetadata())}async authenticate(e){return this._logCall("authenticate",e,()=>this._inner.authenticate(e))}async refreshModels(){return this._logCall("refreshModels",void 0,()=>this._inner.refreshModels())}async listSessions(){return this._logCall("listSessions",void 0,()=>this._inner.listSessions())}async createSession(e){return this._logCall("createSession",e,()=>this._inner.createSession(e))}async disposeSession(e){return this._logCall("disposeSession",e,()=>this._inner.disposeSession(e))}async shutdown(){return this._logCall("shutdown",void 0,()=>this._inner.shutdown())}async subscribe(e){return this._logCall("subscribe",e,()=>this._inner.subscribe(e))}unsubscribe(e){this._log(">>","unsubscribe",e),this._inner.unsubscribe(e)}dispatchAction(e,t,o){this._log(">>","dispatchAction",{action:e,clientId:t,clientSeq:o}),this._inner.dispatchAction(e,t,o)}async browseDirectory(e){return this._logCall("browseDirectory",e,()=>this._inner.browseDirectory(e))}async fetchContent(e){return this._logCall("fetchContent",e,()=>this._inner.fetchContent(e))}async writeFile(e){return this._logCall("writeFile",e,()=>this._inner.writeFile(e))}logError(e,t){this._log("!!",e,t instanceof Error?t.message:String(t))}async _logCall(e,t,o){this._log(">>",e,t);try{let n=await o();return this._log("<<",e,n),n}catch(n){throw this._log("!!",e,n instanceof Error?n.message:String(n)),n}}_log(e,t,o){if(!this._enabled||!this._outputChannel&&(this._outputChannel=this._outputService.getChannel(this._channelId),!this._outputChannel))return;let n=new Date().toISOString(),r=Twn(o);this._outputChannel.append(`[${n}] ${e} ${t}${r?`
${r}`:""}
`)}};Hqe=I([m(3,kl),m(4,B)],Hqe);var LSe=class extends x{constructor(e,t,o,n,r,s,l,c,u,p){super();this._agentHostService=e;this._chatSessionsService=t;this._defaultAccountService=o;this._authenticationService=n;this._logService=r;this._languageModelsService=s;this._instantiationService=l;this._fileService=c;this._labelService=u;this._agentRegistrations=this._register(new Vt);this._modelProviders=new Map;if(!p.getValue(YFe))return;this._loggedConnection=this._register(this._instantiationService.createInstance(Hqe,this._agentHostService,"agentHostIpc.local","Agent Host (Local)"));let h=this._register(new JYt);this._register(h.registerAuthority("local",this._agentHostService)),this._register(this._fileService.registerProvider(YYt,h)),this._register(this._labelService.registerFormatter(ENo)),this._clientState=this._register(new Bqe(this._agentHostService.clientId,this._logService)),this._register(this._loggedConnection.onDidAction(g=>{sV(g.action)||this._clientState.receiveEnvelope(g)})),this._register(this._loggedConnection.onDidNotification(g=>{this._clientState.receiveNotification(g)})),this._register(this._clientState.onDidChangeRootState(g=>{this._handleRootStateChange(g)})),this._initializeAndSubscribe()}static{this.ID="workbench.contrib.agentHostContribution"}async _initializeAndSubscribe(){try{let e=await this._loggedConnection.subscribe(A.parse(Vqe));if(this._store.isDisposed)return;this._clientState.handleSnapshot(Vqe,e.state,e.fromSeq)}catch(e){this._logService.error("[AgentHost] Failed to subscribe to root state",e),this._loggedConnection.logError("subscribe(root)",e)}}_handleRootStateChange(e){let t=new Set(e.agents.map(o=>o.provider));for(let[o]of this._agentRegistrations)t.has(o)||(this._agentRegistrations.deleteAndDispose(o),this._modelProviders.delete(o));for(let o of e.agents)this._agentRegistrations.has(o.provider)?this._modelProviders.get(o.provider)?.updateModels(o.models):this._registerAgent(o)}_registerAgent(e){let t=new N;this._agentRegistrations.set(e.provider,t);let o=`agent-host-${e.provider}`,n=o,r=o;t.add(this._chatSessionsService.registerChatSessionContribution({type:o,name:n,displayName:e.displayName,description:e.description,canDelegate:!0,requiresCustomModels:!0}));let s=t.add(this._instantiationService.createInstance(DSe,o,e.provider,this._loggedConnection,void 0));t.add(this._chatSessionsService.registerChatSessionItemController(o,s));let l=t.add(this._instantiationService.createInstance(_Se,{provider:e.provider,agentId:n,sessionType:o,fullName:e.displayName,description:e.description,connection:this._loggedConnection,connectionAuthority:"local",resolveAuthentication:()=>this._resolveAuthenticationInteractively()}));t.add(this._chatSessionsService.registerChatSessionContentProvider(o,l));let c={vendor:r,displayName:e.displayName,configuration:void 0,managementCommand:void 0,when:void 0};this._languageModelsService.deltaLanguageModelChatProviderDescriptors([c],[]),t.add(Z(()=>this._languageModelsService.deltaLanguageModelChatProviderDescriptors([],[c])));let u=t.add(new eXt(o,r));u.updateModels(e.models),this._modelProviders.set(e.provider,u),t.add(Z(()=>this._modelProviders.delete(e.provider))),t.add(this._languageModelsService.registerLanguageModelProvider(r,u)),this._authenticateWithServer().then(()=>this._loggedConnection.refreshModels()).catch(()=>{}),t.add(this._defaultAccountService.onDidChangeDefaultAccount(()=>this._authenticateWithServer().then(()=>this._loggedConnection.refreshModels()).catch(()=>{}))),t.add(this._authenticationService.onDidChangeSessions(()=>this._authenticateWithServer().then(()=>this._loggedConnection.refreshModels()).catch(()=>{})))}async _authenticateWithServer(){try{let e=await this._loggedConnection.getResourceMetadata();this._logService.trace(`[AgentHost] Resource metadata: ${e.resources.length} resource(s)`);for(let t of e.resources){let o=A.parse(t.resource),n=await this._resolveTokenForResource(o,t.authorization_servers??[],t.scopes_supported??[]);n?(this._logService.info(`[AgentHost] Authenticating for resource: ${t.resource}`),await this._loggedConnection.authenticate({resource:t.resource,token:n})):this._logService.info(`[AgentHost] No token resolved for resource: ${t.resource}`)}}catch(e){this._logService.error("[AgentHost] Failed to authenticate with server",e),this._loggedConnection.logError("authenticateWithServer",e)}}_resolveTokenForResource(e,t,o){return MNo(e,t,o,this._authenticationService,this._logService,"[AgentHost]")}async _resolveAuthenticationInteractively(){try{let e=await this._loggedConnection.getResourceMetadata();for(let t of e.resources)for(let o of t.authorization_servers??[]){let n=A.parse(o),r=A.parse(t.resource),s=await this._authenticationService.getOrActivateProviderIdForServer(n,r);if(!s)continue;let l=[...t.scopes_supported??[]],c=await this._authenticationService.createSession(s,l,{activateImmediate:!0,authorizationServer:n});return await this._loggedConnection.authenticate({resource:t.resource,token:c.accessToken}),this._logService.info(`[AgentHost] Interactive authentication succeeded for ${t.resource}`),!0}}catch(e){this._logService.error("[AgentHost] Interactive authentication failed",e),this._loggedConnection.logError("resolveAuthenticationInteractively",e)}return!1}};LSe=I([m(0,h2t),m(1,Us),m(2,ng),m(3,xs),m(4,se),m(5,ds),m(6,F),m(7,fe),m(8,rt),m(9,B)],LSe);function WNo(){W(i2i)}var i2i=class a extends K{static{this.ID="workbench.action.chat.openStorageFolder"}constructor(){super({id:a.ID,title:L(8718,"Open Chat Storage Folder"),icon:R.attach,category:Ve.Developer,f1:!0,precondition:ie.enabled})}async run(i,...e){let t=i.get(mi),o=i.get(ko),n=t.getChatStorageFolder();o.showItemInFolder(n.fsPath)}};function VNo(){W(class extends K{constructor(){super({id:"workbench.action.chat.exportAsZip",category:Si,title:L(8719,"Export Chat as Zip..."),precondition:C.and(ie.enabled,cs.Entitlement.internal),f1:!0})}async run(i){let e=i.get(Pt),t=i.get(rn),o=i.get(mi),n=i.get(ko),r=i.get(Ne),s=i.get(rd),l=i.get(fe),c=e.lastFocusedWidget;if(!c||!c.viewModel)return;let u=Ge(await t.defaultFilePath(),"chat.zip"),p=await t.showSaveDialog({defaultUri:u,filters:[{name:"Zip Archive",extensions:["zip"]}]});if(!p)return;let h=o.getSession(c.viewModel.sessionResource);if(!h)return;let g=[{path:"chat.json",contents:JSON.stringify(h.toExport(),void 0,2)}];if(h.getRequests().length>0){h.repoData&&g.push({path:"chat.repo.begin.json",contents:JSON.stringify(h.repoData,void 0,2)});let v=await FNi(s,l);v&&g.push({path:"chat.repo.end.json",contents:JSON.stringify(v,void 0,2)}),!h.repoData&&!v&&r.notify({severity:ft.Warning,message:d(8721,null)})}else{let v=await FNi(s,l);v?g.push({path:"chat.repo.begin.json",contents:JSON.stringify(v,void 0,2)}):r.notify({severity:ft.Warning,message:d(8721,null)})}try{await n.createZipFile(p,g)}catch(v){r.notify({severity:ft.Error,message:d(8720,null,v instanceof Error?v.message:String(v))})}}})}var _wn=["view","inline","quick","editor"],Lse=C.and(ie.enabled,zB),o2i=C.or(_G,ie.inChatInput),BNo=new Y("scopedVoiceChatGettingReady",!1,{type:"boolean",description:d(8727,null)}),HNo=new Y("scopedVoiceChatInProgress",void 0,{type:"string",description:d(8728,null)}),oXt=C.or(..._wn.map(a=>HNo.isEqualTo(a)));var nXt=class a{static async create(i,e){let t=i.get(Pt),o=i.get(sD),n=i.get(yi),r=i.get(ee);switch(e){case"focused":return a.doCreateForFocusedChat(t,n)??a.create(i,"view");case"view":{let s=await t.revealWidget();if(s)return a.doCreateForChatWidget("view",s);break}case"inline":{let s=ha(r.activeTextEditorControl);if(s){let l=Nd.get(s);if(l)return l.isActive||l.run(),a.doCreateForChatWidget("inline",l.widget.chatWidget)}break}case"quick":return o.open(),a.create(i,"focused")}}static doCreateForFocusedChat(i,e){let t=i.lastFocusedWidget;if(t?.hasInputFocus()){let o;return e.hasFocus("workbench.parts.editor")?o=t.location==="panel"?"editor":"inline":["workbench.parts.sidebar","workbench.parts.panel","workbench.parts.auxiliarybar","workbench.parts.titlebar","workbench.parts.statusbar","workbench.parts.banner","workbench.parts.activitybar"].some(n=>e.hasFocus(n))?o="view":o="quick",a.doCreateForChatWidget(o,t)}}static createChatContextKeyController(i,e){let t=BNo.bindTo(i),o=HNo.bindTo(i);return n=>{switch(n){case 2:t.set(!0),o.reset();break;case 3:t.reset(),o.set(e);break;case 1:t.reset(),o.reset();break}}}static doCreateForChatWidget(i,e){return{context:i,scopedContextKeyService:e.scopedContextKeyService,onDidAcceptInput:e.onDidAcceptInput,onDidHideInput:e.onDidHide,focusInput:()=>e.focusInput(),acceptInput:()=>e.acceptInput(void 0,{isVoiceInput:!0}),updateInput:t=>e.setInput(t),getInput:()=>e.getInput(),setInputPlaceholder:t=>e.setInputPlaceholder(t),clearInputPlaceholder:()=>e.resetInputPlaceholder(),updateState:a.createChatContextKeyController(e.scopedContextKeyService,i)}}},oP=class{constructor(i,e,t,o){this.voiceChatService=i;this.configurationService=e;this.instantiationService=t;this.accessibilityService=o;this.currentVoiceChatSession=void 0;this.voiceChatSessionIds=0}static{this.instance=void 0}static getInstance(i){return oP.instance||(oP.instance=i.createInstance(oP)),oP.instance}async start(i,e){this.stop(),nP.getInstance(this.instantiationService).stop();let t=!1,o=++this.voiceChatSessionIds,n=this.currentVoiceChatSession={id:o,controller:i,hasRecognizedInput:!1,disposables:new N,setTimeoutDisabled:p=>{t=p},accept:()=>this.accept(o),stop:()=>this.stop(o,i.context)},r=new Ye;n.disposables.add(Z(()=>r.dispose(!0))),n.disposables.add(i.onDidAcceptInput(()=>this.stop(o,i.context))),n.disposables.add(i.onDidHideInput(()=>this.stop(o,i.context))),i.focusInput(),i.updateState(2);let s=await this.voiceChatService.createVoiceChatSession(r.token,{usesAgents:i.context!=="inline",model:e?.widget?.viewModel?.model}),l=i.getInput(),c=this.configurationService.getValue("accessibility.voice.speechTimeout");(!Yo(c)||c<0)&&(c=NYe);let u=n.disposables.add(new Dt(()=>this.accept(o),c));return n.disposables.add(s.onDidChange(({status:p,text:h,waitingForInput:g})=>{if(!r.token.isCancellationRequested)switch(p){case 1:this.onDidSpeechToTextSessionStart(i,n.disposables);break;case 2:h&&(n.hasRecognizedInput=!0,n.controller.updateInput(l?[l,h].join(" "):h),c>0&&e?.voice?.disableTimeout!==!0&&!t&&u.cancel());break;case 3:h&&(n.hasRecognizedInput=!0,l=l?[l,h].join(" "):h,n.controller.updateInput(l),c>0&&e?.voice?.disableTimeout!==!0&&!g&&!t&&u.schedule());break;case 4:this.stop(n.id,i.context);break}})),n}onDidSpeechToTextSessionStart(i,e){i.updateState(3);let t=0,o=()=>{t=(t+1)%4,i.setInputPlaceholder(`${d(8725,null)}${".".repeat(t)}`),n.schedule()},n=e.add(new Dt(o,500));o()}stop(i=this.voiceChatSessionIds,e){!this.currentVoiceChatSession||this.voiceChatSessionIds!==i||e&&this.currentVoiceChatSession.controller.context!==e||(this.currentVoiceChatSession.controller.clearInputPlaceholder(),this.currentVoiceChatSession.controller.updateState(1),this.currentVoiceChatSession.disposables.dispose(),this.currentVoiceChatSession=void 0)}async accept(i=this.voiceChatSessionIds){if(!this.currentVoiceChatSession||this.voiceChatSessionIds!==i)return;if(!this.currentVoiceChatSession.hasRecognizedInput){this.stop(i,this.currentVoiceChatSession.controller.context);return}let e=this.currentVoiceChatSession.controller,t=await e.acceptInput();if(!t)return;let o=this.configurationService.getValue("accessibility.voice.autoSynthesize");if(o==="on"||o!=="off"&&!this.accessibilityService.isScreenReaderOptimized()){let n;e.context==="inline"?n="focused":n=e,nP.getInstance(this.instantiationService).start(this.instantiationService.invokeFunction(r=>cXt.create(r,n,t)))}}};oP=I([m(0,M2t),m(1,B),m(2,F),m(3,Oi)],oP);var UNo=500;async function zNo(a,i,e,t){let o=i.get(F),r=i.get(_e).enableKeybindingHoldMode(a),s=await nXt.create(i,e);if(!s)return;let l=await oP.getInstance(o).start(s,t),c=!1,u=tn(()=>{c=!0,l?.setTimeoutDisabled(!0)},UNo);await r,u.dispose(),c&&l.accept()}var Qmt=class extends K{constructor(e,t){super(e);this.target=t}run(e,t){return zNo(this.desc.id,e,this.target,t)}},Ymt=class a extends Qmt{static{this.ID="workbench.action.chat.voiceChatInChatView"}constructor(){super({id:a.ID,title:L(8743,"Voice Chat in Chat View"),category:Si,precondition:Lse,f1:!0},"view")}},rXt=class a extends K{static{this.ID="workbench.action.chat.holdToVoiceChatInChatView"}constructor(){super({id:a.ID,title:L(8735,"Hold to Voice Chat in Chat View"),keybinding:{weight:200,when:C.and(Lse,ie.requestInProgress.negate(),o2i?.negate(),pe.focus.negate(),pr.negate(),_i.SearchViewFocusedKey.negate(),KD.negate()),primary:2087}})}async run(i,e){let t=i.get(F),o=i.get(_e),n=i.get(Pt),r=o.enableKeybindingHoldMode(a.ID),s,l=tn(async()=>{let c=await nXt.create(i,"view");c&&(s=await oP.getInstance(t).start(c,e),s.setTimeoutDisabled(!0))},UNo);(await n.revealWidget())?.focusInput(),await r,l.dispose(),s&&s.accept()}},Uqe=class a extends Qmt{static{this.ID="workbench.action.chat.inlineVoiceChat"}constructor(){super({id:a.ID,title:L(8736,"Inline Voice Chat"),category:Si,precondition:C.and(Lse,fr),f1:!0},"inline")}},Xmt=class a extends Qmt{static{this.ID="workbench.action.chat.quickVoiceChat"}constructor(){super({id:a.ID,title:L(8737,"Quick Voice Chat"),category:Si,precondition:Lse,f1:!0},"quick")}},n2i=a=>[{id:D.ChatExecute,when:C.and(ie.location.isEqualTo("panel"),a),group:"navigation",order:3},{id:D.ChatExecute,when:C.and(ie.location.isEqualTo("panel").negate(),a),group:"navigation",order:2}],sXt=class a extends K{static{this.ID="workbench.action.chat.startVoiceChat"}constructor(){super({id:a.ID,title:L(8739,"Start Voice Chat"),category:Si,f1:!0,keybinding:{weight:200,when:C.and(o2i,pe.focus.negate(),pr.negate()),primary:2087},icon:R.mic,precondition:C.and(Lse,BNo.negate(),QJ.negate()),menu:n2i(C.and(zB,y9.negate(),oXt?.negate()))})}async run(i,e){let t=e?.widget;return t&&t.focusInput(),zNo(this.desc.id,i,"focused",e)}},aXt=class a extends K{static{this.ID="workbench.action.chat.stopListening"}constructor(){super({id:a.ID,title:L(8740,"Stop Listening"),category:Si,f1:!0,keybinding:{weight:300,primary:9,when:oXt},icon:AE,precondition:P2t,menu:n2i(oXt)})}async run(i){oP.getInstance(i.get(F)).stop()}},lXt=class a extends K{static{this.ID="workbench.action.chat.stopListeningAndSubmit"}constructor(){super({id:a.ID,title:L(8741,"Stop Listening and Submit"),category:Si,f1:!0,keybinding:{weight:200,when:C.and(o2i,oXt),primary:2087},precondition:P2t})}run(i){oP.getInstance(i.get(F)).accept()}},y9=new Y("scopedChatSynthesisInProgress",!1,{type:"boolean",description:d(8726,null)}),cXt=class a{static create(i,e,t){return e==="focused"?a.doCreateForFocusedChat(i,t):{onDidHideChat:e.onDidHideInput,contextKeyService:e.scopedContextKeyService,response:t}}static doCreateForFocusedChat(i,e){let t=i.get(Pt),o=i.get(X),n=t.getWidgetBySessionResource(e.session.sessionResource);return n?.location==="editor"&&(n=t.lastFocusedWidget),{onDidHideChat:n?.onDidHide??U.None,contextKeyService:n?.scopedContextKeyService??o,response:e}}},nP=class{constructor(i,e,t){this.speechService=i;this.configurationService=e;this.instantiationService=t;this.activeSession=void 0}static{this.instance=void 0}static getInstance(i){return nP.instance||(nP.instance=i.createInstance(nP)),nP.instance}async start(i){this.stop(),oP.getInstance(this.instantiationService).stop();let e=this.activeSession=new Ye,t=new N;t.add(e.token.onCancellationRequested(()=>t.dispose()));let o=await this.speechService.createTextToSpeechSession(e.token,"chat");if(e.token.isCancellationRequested)return;t.add(i.onDidHideChat(()=>this.stop()));let n=y9.bindTo(i.contextKeyService);t.add(Z(()=>n.reset())),t.add(o.onDidChange(r=>{switch(r.status){case 1:n.set(!0);break;case 2:n.reset();break}}));for await(let r of this.nextChatResponseChunk(i.response,e.token)){if(e.token.isCancellationRequested)return;await Va(o.synthesize(r),e.token)}}async*nextChatResponseChunk(i,e){let t={ignoreCodeBlocks:this.configurationService.getValue("accessibility.voice.ignoreCodeBlocks"),insideCodeBlock:!1},o=0,n=!1;do{let r=i.response.toString().length,{chunk:s,offset:l}=this.parseNextChatResponseChunk(i,o,t);if(o=l,n=i.isComplete,s&&(yield s),e.isCancellationRequested)return;!n&&r===i.response.toString().length&&await Va(U.toPromise(i.onDidChange),e)}while(!e.isCancellationRequested&&!n)}parseNextChatResponseChunk(i,e,t){let o,n=i.response.toString();if(i.isComplete)o=n.substring(e),e=n.length+1;else{let r=Mwn(n,e);o=r.chunk,e=r.offset}return o&&t.ignoreCodeBlocks&&(o=this.filterCodeBlocks(o,t)),{chunk:o&&Da({value:o}),offset:e}}filterCodeBlocks(i,e){return i.split(`
`).filter(t=>t.trimStart().startsWith("```")?(e.insideCodeBlock=!e.insideCodeBlock,!1):!e.insideCodeBlock).join(`
`)}stop(){this.activeSession?.dispose(!0),this.activeSession=void 0}};nP=I([m(0,ZC),m(1,B),m(2,F)],nP);var Dwn=[".","!","?",":"],Lwn=`
`,Rwn=" ";function Mwn(a,i){let e;for(let t=a.length-1;t>=i;t--){let o=a[t],n=a[t+1];if(Dwn.includes(o)&&n===Rwn||Lwn===o){e=a.substring(i,t+1).trim(),i=t+1;break}}return{chunk:e,offset:i}}var dXt=class extends K{constructor(){super({id:"workbench.action.chat.readChatResponseAloud",title:L(8738,"Read Aloud"),icon:R.unmute,precondition:Lse,menu:[{id:D.ChatMessageFooter,when:C.and(Lse,ie.isResponse,y9.negate(),ie.responseIsFiltered.negate()),group:"navigation",order:-10},{id:qH,when:C.and(Lse,ie.isResponse,y9.negate(),ie.responseIsFiltered.negate()),group:"navigation",order:-10}]})}run(i,...e){let t=i.get(F),o=i.get(Pt),n;if(e.length>0){let s=e[0];Ui(s)&&(n=s)}else{let s=o.lastFocusedWidget;if(s){let l=s.getFocus();if(l instanceof u3)n=l;else{let c=s.viewModel;if(c){let u=c.getItems();for(let p=u.length-1;p>=0;p--){let h=u[p];if(Ui(h)){n=h;break}}}}}}if(!n)return;let r=cXt.create(i,"focused",n.model);nP.getInstance(t).start(r)}},uXt=class a extends K{static{this.ID="workbench.action.speech.stopReadAloud"}constructor(){super({id:a.ID,icon:I4e,title:L(8744,"Stop Reading Aloud"),f1:!0,category:Si,precondition:SPt,keybinding:{weight:300,primary:9,when:y9},menu:n2i(y9)})}async run(i){nP.getInstance(i.get(F)).stop()}},pXt=class a extends K{static{this.ID="workbench.action.chat.stopReadChatItemAloud"}constructor(){super({id:a.ID,icon:R.mute,title:L(8742,"Stop Reading Aloud"),precondition:y9,keybinding:{weight:300,primary:9},menu:[{id:D.ChatMessageFooter,when:C.and(y9,ie.isResponse,ie.responseIsFiltered.negate()),group:"navigation",order:-10},{id:qH,when:C.and(y9,ie.isResponse,ie.responseIsFiltered.negate()),group:"navigation",order:-10}]})}async run(i,...e){nP.getInstance(i.get(F)).stop()}};function KNo(a,i,e){if(!i.hasSpeechProvider||!e.getDefaultAgent("panel"))return!1;let t=a.getValue(tue);return typeof t=="string"&&t!==cE.SETTINGS_VALUE.OFF}var cE=class extends x{constructor(e,t,o,n,r,s,l){super();this.speechService=e;this.configurationService=t;this.commandService=o;this.editorService=r;this.hostService=s;this.chatAgentService=l;this.activeSession=void 0;this._register(n.createInstance(qN)),this.registerListeners()}static{this.ID="workbench.contrib.keywordActivation"}static{this.SETTINGS_VALUE={OFF:"off",INLINE_CHAT:"inlineChat",QUICK_CHAT:"quickChat",VIEW_CHAT:"chatInView",CHAT_IN_CONTEXT:"chatInContext"}}registerListeners(){this._register(U.runAndSubscribe(this.speechService.onDidChangeHasSpeechProvider,()=>{this.updateConfiguration(),this.handleKeywordActivation()}));let e=this._register(this.chatAgentService.onDidChangeAgents(()=>{this.chatAgentService.getDefaultAgent("panel")&&(this.updateConfiguration(),this.handleKeywordActivation(),e.dispose())}));this._register(this.speechService.onDidStartSpeechToTextSession(()=>this.handleKeywordActivation())),this._register(this.speechService.onDidEndSpeechToTextSession(()=>this.handleKeywordActivation())),this._register(this.configurationService.onDidChangeConfiguration(t=>{t.affectsConfiguration(tue)&&this.handleKeywordActivation()}))}updateConfiguration(){if(!this.speechService.hasSpeechProvider||!this.chatAgentService.getDefaultAgent("panel"))return;ne.as(Jt.Configuration).registerConfiguration({...CAt,properties:{[tue]:{type:"string",enum:[cE.SETTINGS_VALUE.OFF,cE.SETTINGS_VALUE.VIEW_CHAT,cE.SETTINGS_VALUE.QUICK_CHAT,cE.SETTINGS_VALUE.INLINE_CHAT,cE.SETTINGS_VALUE.CHAT_IN_CONTEXT],enumDescriptions:[d(8733,null),d(8731,null),d(8734,null),d(8732,null),d(8730,null)],description:d(8729,null),default:"off",tags:["accessibility"]}}})}handleKeywordActivation(){let e=KNo(this.configurationService,this.speechService,this.chatAgentService)&&!this.speechService.hasActiveSpeechToTextSession;e&&this.activeSession||!e&&!this.activeSession||(e?this.enableKeywordActivation():this.disableKeywordActivation())}async enableKeywordActivation(){let e=this.activeSession=new Ye,t=await this.speechService.recognizeKeyword(e.token);e.token.isCancellationRequested||e!==this.activeSession||(this.activeSession=void 0,t===1&&(this.hostService.hasFocus&&this.commandService.executeCommand(this.getKeywordCommand()),this.handleKeywordActivation()))}getKeywordCommand(){switch(this.configurationService.getValue(tue)){case cE.SETTINGS_VALUE.INLINE_CHAT:return Uqe.ID;case cE.SETTINGS_VALUE.QUICK_CHAT:return Xmt.ID;case cE.SETTINGS_VALUE.CHAT_IN_CONTEXT:if(ha(this.editorService.activeTextEditorControl)?.hasWidgetFocus())return Uqe.ID;default:return Ymt.ID}}disableKeywordActivation(){this.activeSession?.dispose(!0),this.activeSession=void 0}dispose(){this.activeSession?.dispose(),super.dispose()}};cE=I([m(0,ZC),m(1,B),m(2,ge),m(3,F),m(4,ee),m(5,Zt),m(6,cr)],cE);var qN=class extends x{constructor(e,t,o,n,r){super();this.speechService=e;this.statusbarService=t;this.commandService=o;this.configurationService=n;this.chatAgentService=r;this.entry=this._register(new me);this._register($e.registerCommand(qN.STATUS_COMMAND,()=>this.commandService.executeCommand("workbench.action.openSettings",tue))),this.registerListeners(),this.updateStatusEntry()}static{this.STATUS_NAME=d(8724,null)}static{this.STATUS_COMMAND="keywordActivation.status.command"}static{this.STATUS_ACTIVE=d(8722,null)}static{this.STATUS_INACTIVE=d(8723,null)}registerListeners(){this._register(this.speechService.onDidStartKeywordRecognition(()=>this.updateStatusEntry())),this._register(this.speechService.onDidEndKeywordRecognition(()=>this.updateStatusEntry())),this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration(tue)&&this.updateStatusEntry()}))}updateStatusEntry(){KNo(this.configurationService,this.speechService,this.chatAgentService)?(this.entry.value||this.createStatusEntry(),this.updateStatusLabel()):this.entry.clear()}createStatusEntry(){this.entry.value=this.statusbarService.addEntry(this.getStatusEntryProperties(),"status.voiceKeywordActivation",1,103)}getStatusEntryProperties(){return{name:qN.STATUS_NAME,text:this.speechService.hasActiveKeywordRecognition?"$(mic-filled)":"$(mic)",tooltip:this.speechService.hasActiveKeywordRecognition?qN.STATUS_ACTIVE:qN.STATUS_INACTIVE,ariaLabel:this.speechService.hasActiveKeywordRecognition?qN.STATUS_ACTIVE:qN.STATUS_INACTIVE,command:qN.STATUS_COMMAND,kind:"prominent",showInAllWindows:!0}}updateStatusLabel(){this.entry.value?.update(this.getStatusEntryProperties())}};qN=I([m(0,ZC),m(1,kr),m(2,ge),m(3,B),m(4,cr)],qN);is((a,i)=>{let e,t;uf(a.type)?(e=a.getColor(bi),t=a.getColor(bi)):(e=a.getColor(yK)??a.getColor(Sd),t=e?.transparent(.38)),i.addRule(`
		.monaco-workbench.monaco-enable-motion .interactive-input-part .monaco-action-bar .action-label.codicon-sync.codicon-modifier-spin:not(.disabled),
		.monaco-workbench.monaco-enable-motion .interactive-input-part .monaco-action-bar .action-label.codicon-loading.codicon-modifier-spin:not(.disabled) {
			color: ${e};
			outline: 1px solid ${e};
			outline-offset: -1px;
			animation: pulseAnimation 1s infinite;
			border-radius: 50%;
		}

		.monaco-workbench.monaco-enable-motion .interactive-input-part .monaco-action-bar .action-label.codicon-sync.codicon-modifier-spin:not(.disabled)::before,
		.monaco-workbench.monaco-enable-motion .interactive-input-part .monaco-action-bar .action-label.codicon-loading.codicon-modifier-spin:not(.disabled)::before {
			position: absolute;
			outline: 1px solid ${e};
			outline-offset: 2px;
			border-radius: 50%;
			width: 16px;
			height: 16px;
		}

		.monaco-workbench.monaco-enable-motion .interactive-input-part .monaco-action-bar .action-label.codicon-sync.codicon-modifier-spin:not(.disabled)::after,
		.monaco-workbench.monaco-enable-motion .interactive-input-part .monaco-action-bar .action-label.codicon-loading.codicon-modifier-spin:not(.disabled)::after {
			outline: 2px solid ${e};
			outline-offset: -1px;
			animation: pulseAnimation 1500ms cubic-bezier(0.75, 0, 0.25, 1) infinite;
		}

		@keyframes pulseAnimation {
			0% {
				outline-width: 2px;
			}
			62% {
				outline-width: 5px;
				outline-color: ${t};
			}
			100% {
				outline-width: 2px;
			}
		}
	`)});var Pwn=rN({key:"chat.externalPath.workspaceAllowlist",defaultValue:[],toStorage:a=>JSON.stringify(a),fromStorage:a=>{let i=JSON.parse(a);return Array.isArray(i)?i:[]}}),mXt=class{constructor(i,e,t,o,n){this._getPathInfo=i;this._labelService=e;this._findGitRoot=t;this._pickFolder=n;this.canUseDefaultApprovals=!1;this._sessionFolderAllowlist=new gt;this._gitRootCache=new gt;o&&(this._workspaceAllowlist=Pwn(1,1,o))}dispose(){this._workspaceAllowlist?.dispose()}_getWorkspaceFolders(){if(!this._workspaceAllowlist)return new En;let i=new En;for(let e of this._workspaceAllowlist.get())try{i.add(A.parse(e))}catch{}return i}_setWorkspaceFolders(i){if(!this._workspaceAllowlist)return;let e=[];for(let t of i)e.push(t.toString());this._workspaceAllowlist.set(e,void 0)}getPreConfirmAction(i){let e=this._getPathInfo(i);if(!e)return;let t;try{t=A.file(e.path)}catch{return}let o=this._getWorkspaceFolders();for(let n of o)if(tae.isEqualOrParent(t,n))return{type:4};if(i.chatSessionResource){let n=this._sessionFolderAllowlist.get(i.chatSessionResource);if(n){for(let r of n)if(tae.isEqualOrParent(t,r))return{type:4}}}}getPreConfirmActions(i){let e=this._getPathInfo(i);if(!e||!i.chatSessionResource)return[];let t;try{t=A.file(e.path)}catch{return[]}let o=e.isDirectory?t:ci(t),n=i.chatSessionResource,r=[{label:d(8630,null),detail:d(8631,null),select:async()=>{let s=this._sessionFolderAllowlist.get(n);return s||(s=new En,this._sessionFolderAllowlist.set(n,s)),s.add(o),!0}}];if(this._findGitRoot){let s=this._findGitRoot,l=this._gitRootCache,c=this._sessionFolderAllowlist,u=l.get(t);u===null||(u?r.push({label:d(8632,null),detail:d(8633,null,u.fsPath),select:async()=>{let p=c.get(n);return p||(p=new En,c.set(n,p)),p.add(u),!0}}):r.push({label:d(8632,null),detail:d(8634,null),select:async()=>{let p=await s(t);if(l.set(t,p??null),!p)return!1;let h=c.get(n);return h||(h=new En,c.set(n,h)),h.add(p),!0}}))}return r}getManageActions(){let i=[],e=this._getWorkspaceFolders();for(let o of e)i.push({label:this._labelService.getUriLabel(o),description:d(8636,null),checked:!0,onDidChangeChecked:n=>{n?(e.add(o),this._setWorkspaceFolders(e)):(e.delete(o),this._setWorkspaceFolders(e))}});let t=new En;for(let[,o]of this._sessionFolderAllowlist)for(let n of o)t.add(n);for(let o of t){let n=[...this._sessionFolderAllowlist].filter(([,r])=>r.has(o));i.push({label:this._labelService.getUriLabel(o),description:d(8635,null),checked:!0,onDidChangeChecked:r=>{if(r)for(let[,s]of n)s.add(o);else for(let[,s]of n)s.delete(o)}})}if(this._pickFolder){let o=this._pickFolder;i.push({pickable:!1,label:d(8628,null),description:d(8629,null),onDidOpen:async()=>{let n=await o();if(n){let r=this._getWorkspaceFolders();r.add(n),this._setWorkspaceFolders(r)}}})}return i}reset(){this._sessionFolderAllowlist.clear(),this._gitRootCache.clear(),this._workspaceAllowlist&&this._workspaceAllowlist.set([],void 0)}};function GNo(a){let i=cYe(a),e=A.parse(i),t=new Set,o=e.toString(!0);t.add(o);let n=e.with({path:"",query:"",fragment:""}).toString(!0);t.add(n);let r=e.authority,s=r.split("."),l=s.length===4&&s.every(h=>Number.isInteger(+h)),c=r.includes(":")&&r.match(/^(\[)?[0-9a-fA-F:]+(\])?(?::\d+)?$/);if(!(l||c)&&s.length>2)for(let h=0;h<s.length-2;h++){let g="*."+s.slice(h+1).join("."),f=e.with({authority:g,path:"",query:"",fragment:""}).toString(!0);t.add(f)}let p=e.path.split("/").filter(h=>h.length>0);if(p.length>0)for(let h=p.length-1;h>=0;h--){let g=p.slice(0,h).join("/"),f=e.with({path:(h>0?"/":"")+g,query:"",fragment:""}).toString(!0);t.add(f)}return[...t].map(h=>h.replace(/\/+$/,""))}function r2i(a,i){let e=i;return e.startsWith("https://")?e=e.substring(8):e.startsWith("http://")&&(e=e.substring(7)),e.replace(/\/+$/,"")}function qNo(a,i,e){let t=cYe(a),o=A.parse(t);for(let[n,r]of Object.entries(i))if(w_e(o,n)){if(typeof r=="boolean")return r;if(e&&r.approveRequest!==void 0)return r.approveRequest;if(!e&&r.approveResponse!==void 0)return r.approveResponse}return!1}var Awn={iconClass:q.asClassName(R.trash),tooltip:d(8643,null)},zqe=class{constructor(i,e,t,o){this._getURLS=i;this._configurationService=e;this._quickInputService=t;this._preferencesService=o;this.canUseDefaultApprovals=!1}getPreConfirmAction(i){return this._checkApproval(i,!0)}getPostConfirmAction(i){return this._checkApproval(i,!1)}_checkApproval(i,e){let t=this._getURLS(i.parameters);if(!t||t.length===0)return;let o=this._getApprovedUrls();if(t.every(r=>{try{let s=A.parse(r);return qNo(s,o,e)}catch{return!1}}))return{type:2,id:"chat.tools.urls.autoApprove"}}getPreConfirmActions(i){return this._getConfirmActions(i,!0)}getPostConfirmActions(i){return this._getConfirmActions(i,!1)}_getConfirmActions(i,e){let t=this._getURLS(i.parameters);if(!t||t.length===0)return[];let o=t.map(l=>l.split("?")[0]),n=[],r=Array.from(new Set(o)).map(l=>A.parse(l)),s=new gt(r.map(l=>[l,GNo(l)]));if(s.size===1){let l=r[0],c=s.get(l),u=c.slice(0,2);for(let p of u){let h=r2i(l,p);n.push({label:e?d(8640,null,h):d(8641,null,h),select:async()=>(await this._approvePattern(p,e,!e),!0)})}n.push({label:d(8645,null),select:async()=>await this._showMoreOptions(i,[{uri:l,patterns:c}],e)})}else n.push({label:d(8647,null),select:async()=>(await this._showMoreOptions(i,[...s].map(([l,c])=>({uri:l,patterns:c})),e),!0)});return n}async _showMoreOptions(i,e,t){return new Promise(o=>{let n=new N,r=n.add(this._quickInputService.createQuickTree());r.ignoreFocusOut=!0,r.sortByLabel=!1,r.placeholder=d(8652,null);let s=[],l=this._getApprovedUrls(),c=new Set;for(let{uri:p,patterns:h}of e)for(let g of h.slice().sort((f,v)=>v.length-f.length)){if(c.has(g))continue;c.add(g);let f=l[g],v=typeof f=="boolean"?f:f?.approveRequest??!1,b=typeof f=="boolean"?f:f?.approveResponse??!1;s.push({label:r2i(p,g),pattern:g,checked:v&&b?!0:!v&&!b?!1:"mixed",collapsed:!0,children:[{label:d(8637,null),pattern:g,approvalType:"request",checked:v},{label:d(8638,null),pattern:g,approvalType:"response",checked:b}]})}r.setItemTree(s);let u=()=>{let p={...this._getApprovedUrls()};for(let h of r.itemTree){let g=h.children?.find(v=>v.approvalType==="request")?.checked,f=h.children?.find(v=>v.approvalType==="response")?.checked;f&&g?p[h.pattern]=!0:!f&&!g?delete p[h.pattern]:p[h.pattern]={approveRequest:!!g||void 0,approveResponse:!!f||void 0}}return this._configurationService.updateValue("chat.tools.urls.autoApprove",p)};n.add(r.onDidAccept(async()=>{r.busy=!0,await u(),o(!!this._checkApproval(i,t)),r.hide()})),n.add(r.onDidHide(()=>{u(),n.dispose(),o(!1)})),r.show()})}async _approvePattern(i,e,t){let o={...this._getApprovedUrls()},n=o[i],r=!1,s=!1;typeof n=="boolean"?(r=n,s=n):n&&(r=n.approveRequest??!1,s=n.approveResponse??!1);let l=e||r,c=t||s,u;l===c?u=l:u={approveRequest:l,approveResponse:c},o[i]=u,await this._configurationService.updateValue("chat.tools.urls.autoApprove",o)}getManageActions(){let i={...this._getApprovedUrls()},e=[];for(let[t,o]of Object.entries(i)){let n=t,r;if(typeof o=="boolean")r=o?d(8639,null):d(8644,null);else{let l=[];o.approveRequest&&l.push(d(8650,null)),o.approveResponse&&l.push(d(8651,null)),r=l.length>0?d(8642,null,l.join(", ")):d(8648,null)}let s={label:n,description:r,buttons:[Awn],checked:!0,onDidChangeChecked:l=>{l?i[t]=o:delete i[t],this._configurationService.updateValue("chat.tools.urls.autoApprove",i)}};e.push(s)}return e.push({pickable:!1,label:d(8646,null),description:d(8649,null),onDidOpen:()=>{this._preferencesService.openUserSettings({query:"chat.tools.urls.autoApprove"})}}),e}async reset(){await this._configurationService.updateValue("chat.tools.urls.autoApprove",{})}_getApprovedUrls(){return this._configurationService.getValue("chat.tools.urls.autoApprove")||{}}};zqe=I([m(1,B),m(2,Ue),m(3,Go)],zqe);var $No={id:art,displayName:"Fetch Web Page",canBeReferencedInPrompt:!1,modelDescription:"Fetches the main content from a web page. This tool is useful for summarizing or analyzing the content of a webpage.",source:kn.Internal,canRequestPostApproval:!0,canRequestPreApproval:!0,inputSchema:{type:"object",properties:{urls:{type:"array",items:{type:"string"},description:d(8762,null)}},required:["urls"]}},Kqe=class{constructor(i,e,t,o,n){this._readerModeService=i;this._fileService=e;this._trustedDomainService=t;this._chatService=o;this._workspaceContextService=n}async invoke(i,e,t,o){let n=i.parameters.urls||[],{webUris:r,fileUris:s,invalidUris:l}=this._parseUris(n);if(![...r.values(),...s.values()].length&&l.size===0)return{content:[{kind:"text",value:d(8755,null)}]};let u=[];if(r.size>0){let y=this._trustedDomainService.trustedDomains;u=await this._readerModeService.extract([...r.values()],{trustedDomains:y})}let p=[],h=[];for(let y of s.values())try{let w=await this._fileService.readFile(y,void 0,o),k=this._getSupportedImageMimeType(y);k?p.push({type:"tooldata",value:{kind:"data",value:{mimeType:k,data:w.value}}}):OTe({buffer:w.value,bytesRead:w.value.byteLength}).seemsBinary?p.push(d(8746,null)):p.push(w.value.toString()),h.push(y)}catch{p.push(void 0)}let g=[],f=0,v=0;for(let y of n)l.has(y)?g.push(void 0):r.has(y)?(g.push({type:"extracted",value:u[f]}),f++):s.has(y)?(g.push(p[v]),v++):g.push(void 0);let b;u.every(y=>y.status==="error"||y.status==="redirect")&&(b=!1);let S=[...r.values(),...h];return{content:this._getPromptPartsForResults(n,g),toolResultDetails:S,confirmResults:b}}async prepareToolInvocation(i,e){let{webUris:t,fileUris:o,invalidUris:n}=this._parseUris(i.parameters.urls),r=[],s=[];for(let[w,k]of o.entries())try{await this._fileService.stat(k),r.push(k)}catch{s.push(w)}let l=[...Array.from(n),...s],c=new En([...t.values(),...r]),u=r.filter(w=>!this._workspaceContextService.getWorkspaceFolder(w)),p=new En([...t.values(),...u]),h=l.length?l.length>1?new Ie(d(8756,null,c.size,l.map(w=>`- ${w}`).join(`
`))):new Ie(d(8757,null,l[0])):new Ie,g=new Ie;if(c.size>1)h.appendMarkdown(d(8758,null,c.size)),g.appendMarkdown(d(8752,null,c.size));else if(c.size===1){let w=vt.first(c).toString(!0);w.length>400||r.length===1?(h.appendMarkdown(d(8760,null,w)),g.appendMarkdown(d(8754,null,w))):(h.appendMarkdown(d(8759,null,w)),g.appendMarkdown(d(8753,null,w)))}let f;if(i.chatSessionResource){let k=this._chatService.getSession(i.chatSessionResource)?.getRequests().map(P=>P.message.text.toLowerCase()),T=!1;for(let P of p){let O=P.toString(!0).toLowerCase().replace(/\/$/,"");k?.some(V=>V.includes(O))&&(p.delete(P),T=!0)}T&&p.size===0&&(f=d(8761,null))}let v={invocationMessage:g,pastTenseMessage:h},b=vt.every(p,w=>this._trustedDomainService.isValid(w)),S,y;return p.size&&!b&&(p.size===1?(S=d(8749,null),y=new Ie(vt.first(p).toString(!0),{supportThemeIcons:!0})):(S=d(8748,null),y=new Ie([...p].map(w=>`- ${w.toString(!0)}`).join(`
`),{supportThemeIcons:!0}))),v.confirmationMessages={title:S,message:y,confirmResults:p.size>0,allowAutoConfirm:!0,disclaimer:new Ie("$(info) "+d(8747,null),{supportThemeIcons:!0}),confirmationNotNeededReason:f},v}_parseUris(i){let e=new Map,t=new Map,o=new Set;return i?.forEach(n=>{try{let r=A.parse(n);r.scheme==="http"||r.scheme==="https"?e.set(n,r):t.set(n,r)}catch{o.add(n)}}),{webUris:e,fileUris:t,invalidUris:o}}_getPromptPartsForResults(i,e){return e.map((t,o)=>{let n=e.length>1?d(8750,null,i[o]):void 0;if(t){if(typeof t=="string")return{kind:"text",title:n,value:t};if(t.type==="tooldata")return{...t.value,title:n};if(t.type==="extracted")switch(t.value.status){case"ok":return{kind:"text",title:n,value:t.value.result};case"redirect":return{kind:"text",title:n,value:`The webpage has redirected to "${t.value.toURI.toString(!0)}". Use the ${art} again to get its contents.`};case"error":return{kind:"text",title:n,value:`An error occurred retrieving the fetch result: ${t.value.error}`};default:os(t.value)}else throw new Error("unreachable")}else return{kind:"text",title:n,value:d(8751,null)}})}_getSupportedImageMimeType(i){switch(qm(i.path).toLowerCase()){case".png":return"image/png";case".jpg":case".jpeg":return"image/jpeg";case".gif":return"image/gif";case".webp":return"image/webp";case".bmp":return"image/bmp";default:return}}};Kqe=I([m(0,VAe),m(1,fe),m(2,$4),m(3,mi),m(4,Pe)],Kqe);var RSe=class extends x{static{this.ID="chat.nativeBuiltinTools"}constructor(i,e,t,o,n,r,s){super();let l=e.createInstance(Kqe);this._register(i.registerTool($No,l)),this._register(t.registerConfirmationContribution(art,e.createInstance(zqe,u=>u.urls)));let c=new mXt(u=>{let p=u.parameters;if(p?.filePath)return{path:p.filePath,isDirectory:!1};if(p?.path)return{path:p.path,isDirectory:!0}},s,async u=>{let p=ci(u);for(let h=0;h<100;h++){try{if(await o.exists(A.joinPath(p,".git")))return p}catch{}let g=ci(p);if(tae.isEqual(g,p))return;p=g}},n,async()=>(await r.showOpenDialog({canSelectFolders:!0,canSelectFiles:!1,canSelectMany:!1}))?.[0]);this._register(c),this._register(t.registerConfirmationContribution("copilot_readFile",c)),this._register(t.registerConfirmationContribution("copilot_listDirectory",c))}};RSe=I([m(0,Vn),m(1,F),m(2,_D),m(3,fe),m(4,ce),m(5,rn),m(6,rt)],RSe);var hXt=class extends K{constructor(){super({id:"workbench.action.openSessionsWindow",title:L(8745,"Open Sessions Window"),category:Si,precondition:C.and(eB.notEqualsTo("stable"),cs.Setup.hidden.negate(),wb.negate()),f1:!0})}async run(i){let e=i.get(Je),t=i.get(tt);if(i.get(At).isBuilt&&(Ze||ei)){let n=t.quality==="stable"?"vscode-sessions":t.quality==="exploration"?"vscode-sessions-exploration":"vscode-sessions-insiders";await e.open(A.from({scheme:n,authority:Q.file}),{openExternal:!0})}else await i.get(ko).openSessionsWindow()}};var Gqe=class extends x{constructor(e,t,o,n,r,s,l){super();this.environmentService=e;this.commandService=t;this.workspaceTrustRequestService=o;this.logService=n;this.layoutService=r;this.contextKeyService=s;this.chatWidgetService=l;this.registerListeners()}static{this.ID="workbench.contrib.chatCommandLineHandler"}registerListeners(){tl.on("vscode:handleChatRequest",(e,...t)=>{let o=t[0];this.logService.trace("vscode:handleChatRequest",o),this.prompt(o)}),tl.on("vscode:openChatSession",(e,...t)=>{let o=t[0];this.logService.trace("vscode:openChatSession",o);let n=A.parse(o);this.chatWidgetService.openSession(n,rD)})}async prompt(e){if(!Array.isArray(e?._)||!await this.workspaceTrustRequestService.requestWorkspaceTrust({message:d(8768,null)}))return;let o={query:e._.length>0?e._.join(" "):"",mode:e.mode??"agent",attachFiles:e["add-file"]?.map(n=>A.file(cP(n)))};if(e.maximize){let n=this.contextKeyService.getContextKeyValue(ie.panelLocation.key);n===2?this.layoutService.setAuxiliaryBarMaximized(!0):n===1&&!this.layoutService.isPanelMaximized()&&this.layoutService.toggleMaximizedPanel()}await this.commandService.executeCommand(Zm),await this.commandService.executeCommand(lx,o)}};Gqe=I([m(0,zr),m(1,ge),m(2,Vu),m(3,se),m(4,yi),m(5,X),m(6,Pt)],Gqe);var qqe=class extends x{static{this.ID="workbench.contrib.chatSuspendThrottlingHandler"}constructor(i,e){super(),this._register(be(t=>{let o=e.requestInProgressObs.read(t);i.setBackgroundThrottling(!o)}))}};qqe=I([m(0,ko),m(1,mi)],qqe);var $qe=class extends x{constructor(e,t,o,n,r,s,l,c){super();this.agentSessionsService=t;this.dialogService=o;this.widgetService=n;this.contextKeyService=r;this.environmentService=l;this.chatEntitlementService=c;this._register(e.onBeforeShutdown(u=>{u.veto(this.shouldVetoShutdown(u.reason),"veto.chat")})),this._register(s.onWillStop(u=>{u.veto(this.hasNonCloudSessionInProgress(),d(8765,null))}))}static{this.ID="workbench.contrib.chatLifecycleHandler"}hasNonCloudSessionInProgress(){return this.chatEntitlementService.sentiment.hidden?!1:this.agentSessionsService.model.sessions.some(e=>HC(e.status)&&e.providerType!=="copilot-cloud-agent"&&!e.isArchived())}shouldVetoShutdown(e){return this.environmentService.enableSmokeTestDriver||!this.hasNonCloudSessionInProgress()||ie.skipChatRequestInProgressMessage.getValue(this.contextKeyService)===!0?!1:this.doShouldVetoShutdown(e)}async doShouldVetoShutdown(e){this.widgetService.revealWidget();let t,o;switch(e){case 1:t=d(8767,null),o=d(8766,null);break;case 4:t=d(8764,null),o=d(8763,null);break;case 3:t=d(8774,null),o=d(8773,null);break;default:t=Ze?d(8772,null):d(8770,null),o=Ze?d(8771,null):d(8769,null);break}return!(await this.dialogService.confirm({message:t,detail:o})).confirmed}};$qe=I([m(0,ji),m(1,md),m(2,at),m(3,Pt),m(4,X),m(5,lt),m(6,zr),m(7,rr)],$qe);W(hXt);W(sXt);W(Ymt);W(rXt);W(Xmt);W(Uqe);W(aXt);W(lXt);W(dXt);W(pXt);W(uXt);WNo();VNo();It(cE.ID,cE,St.AfterRestored);It(RSe.ID,RSe,St.AfterRestored);It(Gqe.ID,Gqe,St.BlockRestore);It(qqe.ID,qqe,St.AfterRestored);It($qe.ID,$qe,St.AfterRestored);It(LSe.ID,LSe,St.AfterRestored);$e.registerCommand("workbench.action.chat.openNewChatSessionInPlace.agent-host-copilot",async(a,i)=>{let e=a.get($t),t=A.from({scheme:"agent-host-copilot",path:`/untitled-${xt()}`});if(i==="editor")await a.get(ee).openEditor({resource:t,options:{override:Na.EditorID,pinned:!0}});else{let o=await e.openView(Dr);await o.loadSession(t),o.focus()}});var Jmt=class{constructor(i,e,t,o){this.jsonEditingService=i;this.environmentService=e;this.fileService=t;this.storageService=o;this.migrateToGnomeLibsecret()}async migrateToGnomeLibsecret(){if(!(!fn||this.storageService.getBoolean("encryption.migratedToGnomeLibsecret",-1,!1)))try{let i=await this.fileService.readFile(this.environmentService.argvResource),e=zT(i.value.toString());(e["password-store"]==="gnome"||e["password-store"]==="gnome-keyring")&&this.jsonEditingService.write(this.environmentService.argvResource,[{path:["password-store"],value:"gnome-libsecret"}],!0),this.storageService.store("encryption.migratedToGnomeLibsecret",!0,-1,0)}catch(i){console.error(i)}}};Jmt=I([m(0,bg),m(1,Eo),m(2,fe),m(3,ce)],Jmt);ne.as(Qi.Workbench).registerWorkbenchContribution(Jmt,4);var Nwn=3600*1e3,jNo="emergencyAlert.banner",jqe=class extends x{constructor(e,t,o,n){super();this.bannerService=e;this.requestService=t;this.productService=o;this.logService=n;let r=o.emergencyAlertUrl;if(!r)return;this.fetchAlerts(r),this._register(new FI).cancelAndSet(()=>this.fetchAlerts(r),Nwn,ut)}static{this.ID="workbench.contrib.emergencyAlert"}async fetchAlerts(e){try{await this.doFetchAlerts(e)}catch(t){this.logService.error(t)}}async doFetchAlerts(e){let t=await this.requestService.request({type:"GET",url:e,disableCache:!0,timeout:2e4,callSite:"emergencyAlert.doFetchAlerts"},Se.None);if(t.res.statusCode!==200)throw new Error(`Failed to fetch emergency alerts: HTTP ${t.res.statusCode}`);let o=await If(t);if(!o||!Array.isArray(o.alerts)){this.dismissAlert();return}let n=o.alerts.find(r=>r.commit===this.productService.commit&&(!r.platform||r.platform===jN)&&(!r.arch||r.arch===QSe));if(!n){this.dismissAlert();return}this.currentAlertMessage===n.message&&$i(this.currentAlertActions??[],n.actions??[],(r,s)=>r.label===s.label&&r.href===s.href)||(this.currentAlertMessage=n.message,this.currentAlertActions=n.actions,this.bannerService.show({id:jNo,icon:R.warning,message:n.message,actions:n.actions}))}dismissAlert(){this.currentAlertMessage!==void 0&&(this.currentAlertMessage=void 0,this.currentAlertActions=void 0,this.bannerService.hide(jNo))}};jqe=I([m(0,FD),m(1,Ea),m(2,tt),m(3,se)],jqe);It(jqe.ID,jqe,St.Eventually);var Qqe=class extends Lie{constructor(e,t,o){super(e,t);this._nativeHostService=o}async ensureListeningOnPort(e){let t=Date.now()+3e4;for(;await this._nativeHostService.isPortFree(e)&&Date.now()<t;)await Li(50)}getDebugPort(){return this._nativeHostService.findFreePort(5e3,10,5e3,2048)}};Qqe=I([m(0,Ni),m(1,ge),m(2,ko)],Qqe);var Yqe=class extends one{constructor(e,t,o,n,r,s,l){super(null,o,n,r,s,l);this.mainProcess=e;this.logService=t}start(){Tc.toService(this.mainProcess.getChannel(njt)).load().then(t=>this.setDetails(t),t=>{this.logService.warn("Error getting main process MCP environment",t),this.setDetails(void 0)})}};Yqe=I([m(0,pu),m(1,se),m(2,rt),m(3,fe),m(4,F),m(5,Lc),m(6,B)],Yqe);var Xqe=class{constructor(i,e,t){this._remoteAgentService=e;this._logService=t;this._localChannel=i.getChannel(Xst),this._localPlatformService=Tc.toService(this._localChannel)}async createGateway(i){return this._logService.debug(`[McpGateway][Workbench] createGateway requested (inRemote=${i})`),i?this._createRemoteGateway():this._createLocalGateway()}async _createLocalGateway(){this._logService.info("[McpGateway][Workbench] Creating local gateway via main process");let i=await this._localPlatformService.createGateway(void 0),e=gXt(i.servers);this._logService.info(`[McpGateway][Workbench] Local gateway created with ${e.length} server(s)`);let t=U.map(U.filter(this._localChannel.listen("onDidChangeGatewayServers"),o=>o.gatewayId===i.gatewayId),o=>gXt(o.servers));return{servers:e,onDidChangeServers:t,dispose:()=>{this._logService.info(`[McpGateway][Workbench] Disposing local gateway: ${i.gatewayId}`),this._localPlatformService.disposeGateway(i.gatewayId)}}}async _createRemoteGateway(){let i=this._remoteAgentService.getConnection();if(!i){this._logService.info("[McpGateway][Workbench] No remote connection available for remote gateway");return}return this._logService.info("[McpGateway][Workbench] Creating remote gateway via remote server"),i.withChannel(Xst,async e=>{let t=Tc.toService(e),o=await t.createGateway(void 0),n=gXt(o.servers);this._logService.info(`[McpGateway][Workbench] Remote gateway created with ${n.length} server(s)`);let r=U.map(U.filter(e.listen("onDidChangeGatewayServers"),s=>s.gatewayId===o.gatewayId),s=>gXt(s.servers));return{servers:n,onDidChangeServers:r,dispose:()=>{this._logService.info(`[McpGateway][Workbench] Disposing remote gateway: ${o.gatewayId}`),t.disposeGateway(o.gatewayId)}}})}};Xqe=I([m(0,pu),m(1,bo),m(2,se)],Xqe);function gXt(a){return a.map(i=>({label:i.label,address:A.revive(i.address)}))}var Jqe=class{constructor(i,e,t){i.registerChannel(djt,new SBe(e,t))}};Jqe=I([m(0,pu),m(1,_s),m(2,se)],Jqe);Tq.register(new Ft(Yqe));Ee(MOe,Qqe,1);Ee(_De,Xqe,1);It("mcpGatewayToolBrokerLocal",Jqe,St.AfterRestored);var w9=class extends x{constructor(e,t,o,n,r,s,l){super();this.nativeEnvironmentService=e;this.extensionService=t;this.fileService=o;this.configurationService=n;this.nativeHostService=r;this.progressService=s;this.logService=l;if(this.nativeEnvironmentService.isBuilt)return;let c=this.nativeEnvironmentService.exportPolicyData;if(c!==void 0){let u=Yc(this.nativeEnvironmentService.appRoot,w9.DEFAULT_POLICY_EXPORT_PATH);this.exportPolicyDataAndQuit(c||u)}}static{this.ID="workbench.contrib.policyExport"}static{this.DEFAULT_POLICY_EXPORT_PATH="build/lib/policies/policyData.jsonc"}log(e,...t){this.logService.info(`[${w9.ID}]`,e,...t)}async exportPolicyDataAndQuit(e){try{await this.progressService.withProgress({location:15,title:`Exporting policy data to ${e}`},async t=>{this.log("Export started. Waiting for configurations to load."),await this.extensionService.whenInstalledExtensionsRegistered(),await this.configurationService.whenRemoteConfigurationLoaded(),this.log("Extensions and configuration loaded.");let o=ne.as(Jt.Configuration),n={...o.getExcludedConfigurationProperties(),...o.getConfigurationProperties()},r={categories:Object.values(hK).map(c=>({key:c,name:iJi[c].name})),policies:[]};for(let[c,u]of Object.entries(n))u.policy?.localization&&r.policies.push({key:c,name:u.policy.name,category:u.policy.category,minimumVersion:u.policy.minimumVersion,localization:{description:u.policy.localization.description,enumDescriptions:u.policy.localization.enumDescriptions},type:u.type,default:u.default,enum:u.enum});this.log(`Discovered ${r.policies.length} policies to export.`);let l=`/** THIS FILE IS AUTOMATICALLY GENERATED USING \`code --export-policy-data\`. DO NOT MODIFY IT MANUALLY. **/
${JSON.stringify(r,null,4)}
`;await this.fileService.writeFile(A.file(e),qe.fromString(l)),this.log(`Successfully exported ${r.policies.length} policies to ${e}.`)}),await this.nativeHostService.exit(0)}catch(t){this.log("Failed to export policy",t),await this.nativeHostService.exit(1)}}};w9=I([m(0,oy),m(1,lt),m(2,fe),m(3,fg),m(4,ko),m(5,Fo),m(6,se)],w9);It(w9.ID,w9,St.Eventually);function Own(a){let i=a,e={};for(let t in i){let o=i[t];if(o.length){let n=o[0],r=o[1],s=o[2],l=o[3],c=Number(o[4]),u=o.length===6?o[5]:void 0;e[t]={value:n,vkey:u,withShift:r,withAltGr:s,withShiftAltGr:l,valueIsDeadKey:(c&1)>0,withShiftIsDeadKey:(c&2)>0,withAltGrIsDeadKey:(c&4)>0,withShiftAltGrIsDeadKey:(c&8)>0}}else e[t]={value:"",valueIsDeadKey:!1,withShift:"",withShiftIsDeadKey:!1,withAltGr:"",withAltGrIsDeadKey:!1,withShiftAltGr:"",withShiftAltGrIsDeadKey:!1}}return e}var fXt=class a{constructor(i,e,t,o){this.layout=i;this.secondaryLayouts=e;this.mapping=Own(t),this.isUserKeyboardLayout=!!o,this.layout.isUserKeyboardLayout=!!o}static createKeyboardLayoutFromDebugInfo(i,e,t){let o=new a(i,[],{},!0);return o.mapping=e,o}update(i){this.layout=i.layout,this.secondaryLayouts=i.secondaryLayouts,this.mapping=i.mapping,this.isUserKeyboardLayout=i.isUserKeyboardLayout,this.layout.isUserKeyboardLayout=i.isUserKeyboardLayout}getScore(i){let e=0;for(let t in i){if(ei&&(t==="Backslash"||t==="KeyQ")||fn&&(t==="Backspace"||t==="Escape"))continue;let o=this.mapping[t];o===void 0&&(e-=1);let n=i[t];o&&n&&o.value!==n.value&&(e-=1)}return e}equal(i){return this.isUserKeyboardLayout!==i.isUserKeyboardLayout||yCi(this.layout)!==yCi(i.layout)?!1:this.fuzzyEqual(i.mapping)}fuzzyEqual(i){for(let e in i){if(ei&&(e==="Backslash"||e==="KeyQ"))continue;if(this.mapping[e]===void 0)return!1;let t=this.mapping[e],o=i[e];if(t.value!==o.value)return!1}return!0}};var Rse=class a{constructor(){this._layoutInfos=[]}static{this.INSTANCE=new a}get layoutInfos(){return this._layoutInfos}registerKeyboardLayout(i){this._layoutInfos.push(i)}};var s2i={layout:{name:"00000409",id:"",text:"US",isUSStandard:!0},secondaryLayouts:[{name:"00000804",id:"",text:"Chinese (Simplified) - US Keyboard"},{name:"00000411",id:"",text:"Japanese"},{name:"00000412",id:"",text:"Korean"},{name:"00000404",id:"",text:"Chinese (Traditional) - US Keyboard"}],mapping:{Sleep:[],WakeUp:[],KeyA:["a","A","","",0,"VK_A"],KeyB:["b","B","","",0,"VK_B"],KeyC:["c","C","","",0,"VK_C"],KeyD:["d","D","","",0,"VK_D"],KeyE:["e","E","","",0,"VK_E"],KeyF:["f","F","","",0,"VK_F"],KeyG:["g","G","","",0,"VK_G"],KeyH:["h","H","","",0,"VK_H"],KeyI:["i","I","","",0,"VK_I"],KeyJ:["j","J","","",0,"VK_J"],KeyK:["k","K","","",0,"VK_K"],KeyL:["l","L","","",0,"VK_L"],KeyM:["m","M","","",0,"VK_M"],KeyN:["n","N","","",0,"VK_N"],KeyO:["o","O","","",0,"VK_O"],KeyP:["p","P","","",0,"VK_P"],KeyQ:["q","Q","","",0,"VK_Q"],KeyR:["r","R","","",0,"VK_R"],KeyS:["s","S","","",0,"VK_S"],KeyT:["t","T","","",0,"VK_T"],KeyU:["u","U","","",0,"VK_U"],KeyV:["v","V","","",0,"VK_V"],KeyW:["w","W","","",0,"VK_W"],KeyX:["x","X","","",0,"VK_X"],KeyY:["y","Y","","",0,"VK_Y"],KeyZ:["z","Z","","",0,"VK_Z"],Digit1:["1","!","","",0,"VK_1"],Digit2:["2","@","","",0,"VK_2"],Digit3:["3","#","","",0,"VK_3"],Digit4:["4","$","","",0,"VK_4"],Digit5:["5","%","","",0,"VK_5"],Digit6:["6","^","","",0,"VK_6"],Digit7:["7","&","","",0,"VK_7"],Digit8:["8","*","","",0,"VK_8"],Digit9:["9","(","","",0,"VK_9"],Digit0:["0",")","","",0,"VK_0"],Enter:[],Escape:[],Backspace:[],Tab:[],Space:[" "," ","","",0,"VK_SPACE"],Minus:["-","_","","",0,"VK_OEM_MINUS"],Equal:["=","+","","",0,"VK_OEM_PLUS"],BracketLeft:["[","{","","",0,"VK_OEM_4"],BracketRight:["]","}","","",0,"VK_OEM_6"],Backslash:["\\","|","","",0,"VK_OEM_5"],Semicolon:[";",":","","",0,"VK_OEM_1"],Quote:["'",'"',"","",0,"VK_OEM_7"],Backquote:["`","~","","",0,"VK_OEM_3"],Comma:[",","<","","",0,"VK_OEM_COMMA"],Period:[".",">","","",0,"VK_OEM_PERIOD"],Slash:["/","?","","",0,"VK_OEM_2"],CapsLock:[],F1:[],F2:[],F3:[],F4:[],F5:[],F6:[],F7:[],F8:[],F9:[],F10:[],F11:[],F12:[],PrintScreen:[],ScrollLock:[],Pause:[],Insert:[],Home:[],PageUp:[],Delete:[],End:[],PageDown:[],ArrowRight:[],ArrowLeft:[],ArrowDown:[],ArrowUp:[],NumLock:[],NumpadDivide:["/","/","","",0,"VK_DIVIDE"],NumpadMultiply:["*","*","","",0,"VK_MULTIPLY"],NumpadSubtract:["-","-","","",0,"VK_SUBTRACT"],NumpadAdd:["+","+","","",0,"VK_ADD"],NumpadEnter:[],Numpad1:[],Numpad2:[],Numpad3:[],Numpad4:[],Numpad5:[],Numpad6:[],Numpad7:[],Numpad8:[],Numpad9:[],Numpad0:[],NumpadDecimal:[],IntlBackslash:["\\","|","","",0,"VK_OEM_102"],ContextMenu:[],Power:[],NumpadEqual:[],F13:[],F14:[],F15:[],F16:[],F17:[],F18:[],F19:[],F20:[],F21:[],F22:[],F23:[],F24:[],Help:[],Undo:[],Cut:[],Copy:[],Paste:[],AudioVolumeMute:[],AudioVolumeUp:[],AudioVolumeDown:[],NumpadComma:[],IntlRo:[],KanaMode:[],IntlYen:[],Convert:[],NonConvert:[],Lang1:[],Lang2:[],Lang3:[],Lang4:[],ControlLeft:[],ShiftLeft:[],AltLeft:[],MetaLeft:[],ControlRight:[],ShiftRight:[],AltRight:[],MetaRight:[],MediaTrackNext:[],MediaTrackPrevious:[],MediaStop:[],Eject:[],MediaPlayPause:[],MediaSelect:[],LaunchMail:[],LaunchApp2:[],LaunchApp1:[],BrowserSearch:[],BrowserHome:[],BrowserBack:[],BrowserForward:[],BrowserStop:[],BrowserRefresh:[],BrowserFavorites:[]}};Rse.INSTANCE.registerKeyboardLayout(s2i);var a2i={layout:{id:"com.apple.keylayout.US",lang:"en",localizedName:"U.S.",isUSStandard:!0},secondaryLayouts:[{id:"com.apple.keylayout.ABC",lang:"en",localizedName:"ABC"},{id:"com.sogou.inputmethod.sogou.pinyin",lang:"zh-Hans",localizedName:"Pinyin - Simplified"},{id:"com.apple.inputmethod.Kotoeri.Roman",lang:"en",localizedName:"Romaji"},{id:"com.apple.inputmethod.Kotoeri.Japanese",lang:"ja",localizedName:"Hiragana"},{id:"com.apple.keylayout.Australian",lang:"en",localizedName:"Australian"},{id:"com.apple.keylayout.Canadian",lang:"en",localizedName:"Canadian English"},{id:"com.apple.keylayout.Brazilian",lang:"pt",localizedName:"Brazilian"}],mapping:{KeyA:["a","A","\xE5","\xC5",0],KeyB:["b","B","\u222B","\u0131",0],KeyC:["c","C","\xE7","\xC7",0],KeyD:["d","D","\u2202","\xCE",0],KeyE:["e","E","\xB4","\xB4",4],KeyF:["f","F","\u0192","\xCF",0],KeyG:["g","G","\xA9","\u02DD",0],KeyH:["h","H","\u02D9","\xD3",0],KeyI:["i","I","\u02C6","\u02C6",4],KeyJ:["j","J","\u2206","\xD4",0],KeyK:["k","K","\u02DA","\uF8FF",0],KeyL:["l","L","\xAC","\xD2",0],KeyM:["m","M","\xB5","\xC2",0],KeyN:["n","N","\u02DC","\u02DC",4],KeyO:["o","O","\xF8","\xD8",0],KeyP:["p","P","\u03C0","\u220F",0],KeyQ:["q","Q","\u0153","\u0152",0],KeyR:["r","R","\xAE","\u2030",0],KeyS:["s","S","\xDF","\xCD",0],KeyT:["t","T","\u2020","\u02C7",0],KeyU:["u","U","\xA8","\xA8",4],KeyV:["v","V","\u221A","\u25CA",0],KeyW:["w","W","\u2211","\u201E",0],KeyX:["x","X","\u2248","\u02DB",0],KeyY:["y","Y","\xA5","\xC1",0],KeyZ:["z","Z","\u03A9","\xB8",0],Digit1:["1","!","\xA1","\u2044",0],Digit2:["2","@","\u2122","\u20AC",0],Digit3:["3","#","\xA3","\u2039",0],Digit4:["4","$","\xA2","\u203A",0],Digit5:["5","%","\u221E","\uFB01",0],Digit6:["6","^","\xA7","\uFB02",0],Digit7:["7","&","\xB6","\u2021",0],Digit8:["8","*","\u2022","\xB0",0],Digit9:["9","(","\xAA","\xB7",0],Digit0:["0",")","\xBA","\u201A",0],Enter:[],Escape:[],Backspace:[],Tab:[],Space:[" "," "," "," ",0],Minus:["-","_","\u2013","\u2014",0],Equal:["=","+","\u2260","\xB1",0],BracketLeft:["[","{","\u201C","\u201D",0],BracketRight:["]","}","\u2018","\u2019",0],Backslash:["\\","|","\xAB","\xBB",0],Semicolon:[";",":","\u2026","\xDA",0],Quote:["'",'"',"\xE6","\xC6",0],Backquote:["`","~","`","`",4],Comma:[",","<","\u2264","\xAF",0],Period:[".",">","\u2265","\u02D8",0],Slash:["/","?","\xF7","\xBF",0],CapsLock:[],F1:[],F2:[],F3:[],F4:[],F5:[],F6:[],F7:[],F8:[],F9:[],F10:[],F11:[],F12:[],Insert:[],Home:[],PageUp:[],Delete:[],End:[],PageDown:[],ArrowRight:[],ArrowLeft:[],ArrowDown:[],ArrowUp:[],NumLock:[],NumpadDivide:["/","/","/","/",0],NumpadMultiply:["*","*","*","*",0],NumpadSubtract:["-","-","-","-",0],NumpadAdd:["+","+","+","+",0],NumpadEnter:[],Numpad1:["1","1","1","1",0],Numpad2:["2","2","2","2",0],Numpad3:["3","3","3","3",0],Numpad4:["4","4","4","4",0],Numpad5:["5","5","5","5",0],Numpad6:["6","6","6","6",0],Numpad7:["7","7","7","7",0],Numpad8:["8","8","8","8",0],Numpad9:["9","9","9","9",0],Numpad0:["0","0","0","0",0],NumpadDecimal:[".",".",".",".",0],IntlBackslash:["\xA7","\xB1","\xA7","\xB1",0],ContextMenu:[],NumpadEqual:["=","=","=","=",0],F13:[],F14:[],F15:[],F16:[],F17:[],F18:[],F19:[],F20:[],AudioVolumeMute:[],AudioVolumeUp:["","=","","=",0],AudioVolumeDown:[],NumpadComma:[],IntlRo:[],KanaMode:[],IntlYen:[],ControlLeft:[],ShiftLeft:[],AltLeft:[],MetaLeft:[],ControlRight:[],ShiftRight:[],AltRight:[],MetaRight:[]}};Rse.INSTANCE.registerKeyboardLayout(a2i);var l2i={layout:{model:"pc105",group:0,layout:"us",variant:"",options:"",rules:"evdev",isUSStandard:!0},secondaryLayouts:[{model:"pc105",group:0,layout:"cn",variant:"",options:"",rules:"evdev"}],mapping:{Sleep:[],WakeUp:[],KeyA:["a","A","a","A",0],KeyB:["b","B","b","B",0],KeyC:["c","C","c","C",0],KeyD:["d","D","d","D",0],KeyE:["e","E","e","E",0],KeyF:["f","F","f","F",0],KeyG:["g","G","g","G",0],KeyH:["h","H","h","H",0],KeyI:["i","I","i","I",0],KeyJ:["j","J","j","J",0],KeyK:["k","K","k","K",0],KeyL:["l","L","l","L",0],KeyM:["m","M","m","M",0],KeyN:["n","N","n","N",0],KeyO:["o","O","o","O",0],KeyP:["p","P","p","P",0],KeyQ:["q","Q","q","Q",0],KeyR:["r","R","r","R",0],KeyS:["s","S","s","S",0],KeyT:["t","T","t","T",0],KeyU:["u","U","u","U",0],KeyV:["v","V","v","V",0],KeyW:["w","W","w","W",0],KeyX:["x","X","x","X",0],KeyY:["y","Y","y","Y",0],KeyZ:["z","Z","z","Z",0],Digit1:["1","!","1","!",0],Digit2:["2","@","2","@",0],Digit3:["3","#","3","#",0],Digit4:["4","$","4","$",0],Digit5:["5","%","5","%",0],Digit6:["6","^","6","^",0],Digit7:["7","&","7","&",0],Digit8:["8","*","8","*",0],Digit9:["9","(","9","(",0],Digit0:["0",")","0",")",0],Enter:["\r","\r","\r","\r",0],Escape:["\x1B","\x1B","\x1B","\x1B",0],Backspace:["\b","\b","\b","\b",0],Tab:["	","","	","",0],Space:[" "," "," "," ",0],Minus:["-","_","-","_",0],Equal:["=","+","=","+",0],BracketLeft:["[","{","[","{",0],BracketRight:["]","}","]","}",0],Backslash:["\\","|","\\","|",0],Semicolon:[";",":",";",":",0],Quote:["'",'"',"'",'"',0],Backquote:["`","~","`","~",0],Comma:[",","<",",","<",0],Period:[".",">",".",">",0],Slash:["/","?","/","?",0],CapsLock:[],F1:[],F2:[],F3:[],F4:[],F5:[],F6:[],F7:[],F8:[],F9:[],F10:[],F11:[],F12:[],PrintScreen:[],ScrollLock:[],Pause:[],Insert:[],Home:[],PageUp:[],Delete:["","","","",0],End:[],PageDown:[],ArrowRight:[],ArrowLeft:[],ArrowDown:[],ArrowUp:[],NumLock:[],NumpadDivide:["/","/","/","/",0],NumpadMultiply:["*","*","*","*",0],NumpadSubtract:["-","-","-","-",0],NumpadAdd:["+","+","+","+",0],NumpadEnter:["\r","\r","\r","\r",0],Numpad1:["","1","","1",0],Numpad2:["","2","","2",0],Numpad3:["","3","","3",0],Numpad4:["","4","","4",0],Numpad5:["","5","","5",0],Numpad6:["","6","","6",0],Numpad7:["","7","","7",0],Numpad8:["","8","","8",0],Numpad9:["","9","","9",0],Numpad0:["","0","","0",0],NumpadDecimal:["",".","",".",0],IntlBackslash:["<",">","|","\xA6",0],ContextMenu:[],Power:[],NumpadEqual:["=","=","=","=",0],F13:[],F14:[],F15:[],F16:[],F17:[],F18:[],F19:[],F20:[],F21:[],F22:[],F23:[],F24:[],Open:[],Help:[],Select:[],Again:[],Undo:[],Cut:[],Copy:[],Paste:[],Find:[],AudioVolumeMute:[],AudioVolumeUp:[],AudioVolumeDown:[],NumpadComma:[".",".",".",".",0],IntlRo:[],KanaMode:[],IntlYen:[],Convert:[],NonConvert:[],Lang1:[],Lang2:[],Lang3:[],Lang4:[],Lang5:[],NumpadParenLeft:["(","(","(","(",0],NumpadParenRight:[")",")",")",")",0],ControlLeft:[],ShiftLeft:[],AltLeft:[],MetaLeft:[],ControlRight:[],ShiftRight:[],AltRight:[],MetaRight:[],BrightnessUp:[],BrightnessDown:[],MediaPlay:[],MediaRecord:[],MediaFastForward:[],MediaRewind:[],MediaTrackNext:[],MediaTrackPrevious:[],MediaStop:[],Eject:[],MediaPlayPause:[],MediaSelect:[],LaunchMail:[],LaunchApp2:[],LaunchApp1:[],SelectTask:[],LaunchScreenSaver:[],BrowserSearch:[],BrowserHome:[],BrowserBack:[],BrowserForward:[],BrowserStop:[],BrowserRefresh:[],BrowserFavorites:[],MailReply:[],MailForward:[],MailSend:[]}};Rse.INSTANCE.registerKeyboardLayout(l2i);var rP=class extends x{constructor(e,t,o,n,r){super();this.nativeEnvironmentService=e;this.fileService=t;this.nativeHostService=o;this.productService=n;this.logService=r;if(this.productService.quality==="stable")return;let s=this.nativeEnvironmentService.exportDefaultKeybindings;if(s!==void 0){let l=Yc(this.nativeEnvironmentService.appRoot,"doc");this.exportDefaultKeybindingsAndQuit(s||l)}}static{this.ID="workbench.contrib.keybindingsExport"}async exportDefaultKeybindingsAndQuit(e){try{let t=[{os:1,filename:"doc.keybindings.win.json"},{os:2,filename:"doc.keybindings.osx.json"},{os:3,filename:"doc.keybindings.linux.json"}];for(let{os:o,filename:n}of t){let r=rP._getDefaultKeybindingsContentForOS(o),s=Yc(e,n);await this.fileService.writeFile(A.file(s),qe.fromString(r)),this.logService.info(`[${rP.ID}] Wrote ${s}`)}await this.nativeHostService.exit(0)}catch(t){this.logService.error(`[${rP.ID}] Failed to generate default keybindings`,t),await this.nativeHostService.exit(1)}}static _getDefaultKeybindingsContentForOS(e){let t=Ct.getDefaultKeybindingsForOS(e),o=rP._createKeyboardMapperForOS(e),n=rP._resolveKeybindingItemsWithMapper(t,o),r=new vxe(n,[],()=>{}),s=r.getDefaultKeybindings(),l=r.getDefaultBoundCommands();return rP._formatDefaultKeybindings(s)+`

`+rP._formatAllCommandsAsComment(l)}static _createKeyboardMapperForOS(e){let o={1:s2i,2:a2i,3:l2i}[e],n=new fXt(o.layout,o.secondaryLayouts,o.mapping);switch(e){case 1:return new nPe(!0,n.mapping,!1);case 2:return new dse(!0,n.mapping,!1,2);case 3:return new dse(!0,n.mapping,!1,3)}}static _resolveKeybindingItemsWithMapper(e,t){let o=[];for(let n of e){let r=n.when||void 0,s=n.keybinding;if(!s)o.push(new BA(void 0,n.command,n.commandArgs,r,!0,n.extensionId,n.isBuiltinExtension));else{let l=t.resolveKeybinding(s);for(let c=l.length-1;c>=0;c--)o.push(new BA(l[c],n.command,n.commandArgs,r,!0,n.extensionId,n.isBuiltinExtension))}}return o}static _formatDefaultKeybindings(e){let t=new HRe;t.writeLine("[");let o=e.length-1;return e.forEach((n,r)=>{dme.writeKeybindingItem(t,n),r!==o?t.writeLine(","):t.writeLine()}),t.writeLine("]"),t.toString()}static _formatAllCommandsAsComment(e){return`// Here are other available commands: 
// - `+PRe(e).sort().join(`
// - `)}};rP=I([m(0,oy),m(1,fe),m(2,ko),m(3,tt),m(4,se)],rP);It(rP.ID,rP,St.Eventually);Ee(U3,new Ft(NVt,[[]],!0));export{XIn as main};
/**
 * Copyright (c) 2022 The xterm.js authors. All rights reserved.
 * @license MIT
 */
/*! @license DOMPurify 3.2.7 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.7/LICENSE */
